From: support Date: Fri, 28 Oct 2022 05:22:38 +0000 (+0000) Subject: Built motion from commit dddd5827.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=89c8a79a62a59a4072bc8e5d1fb208019b80e9ba;p=motion2.git Built motion from commit dddd5827.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1a9ff3f..bc2b834 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-10-26T13:25:58.962Z", + "time": "2022-10-28T05:14:06.369Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index cb526c2..a6387a0 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-26T13:25:58.962Z", + "time": "2022-10-28T05:14:06.369Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/public/app/main/apps/staff/i18n/it.json b/public/app/main/apps/staff/i18n/it.json index 9515685..5d106f4 100644 --- a/public/app/main/apps/staff/i18n/it.json +++ b/public/app/main/apps/staff/i18n/it.json @@ -412,17 +412,17 @@ "AD_SSO_ENABLED": "SSO di Active Directory", "AUTHENTICATION": "Autenticazione", "AUTO_ANSWER": "Risposta automatica", - "CHAT_AUTOANSWER": "Risposta automatica della chat", - "CHAT_AUTOANSWERDELAY": "Ritardo risposta automatica chat [s]", - "EMAIL_AUTOANSWER": "Risposta automatica via e-mail", - "EMAIL_AUTOANSWERDELAY": "Ritardo risposta automatica e-mail [i]", - "FAX_AUTOANSWER": "Risposta automatica via fax", - "FAX_AUTOANSWERDELAY": "Ritardo risposta automatica fax [s]", - "OPENCHANNEL_AUTOANSWER": "Risposta automatica a canale aperto", - "OPENCHANNEL_AUTOANSWERDELAY": "Ritardo risposta automatica canale aperto [s]", - "SMS_AUTOANSWER": "Sms risposta automatica", - "SMS_AUTOANSWERDELAY": "Ritardo risposta automatica SMS [s]", - "WHATSAPP_AUTOANSWER": "Whatsapp risposta automatica", - "WHATSAPP_AUTOANSWERDELAY": "Ritardo risposta automatica Whatsapp [s]" + "CHAT_AUTOANSWER": "Risposta automatica via Chat", + "CHAT_AUTOANSWERDELAY": "Ritardo risposta automatica via Chat [s]", + "EMAIL_AUTOANSWER": "Risposta automatica via Email", + "EMAIL_AUTOANSWERDELAY": "Ritardo risposta automatica via Email [i]", + "FAX_AUTOANSWER": "Risposta automatica via Fax", + "FAX_AUTOANSWERDELAY": "Ritardo risposta automatica Fax [s]", + "OPENCHANNEL_AUTOANSWER": "Risposta automatica via Openchannel", + "OPENCHANNEL_AUTOANSWERDELAY": "Ritardo risposta automatica via Openchannel [s]", + "SMS_AUTOANSWER": "Risposta automatica via Sms", + "SMS_AUTOANSWERDELAY": "Ritardo risposta automatica via Sms [s]", + "WHATSAPP_AUTOANSWER": "Risposta automatica via Whatsapp", + "WHATSAPP_AUTOANSWERDELAY": "Ritardo risposta automatica via Whatsapp [s]" } } diff --git a/public/app/toolbar/i18n/it.json b/public/app/toolbar/i18n/it.json index 0d9949a..4796dd7 100644 --- a/public/app/toolbar/i18n/it.json +++ b/public/app/toolbar/i18n/it.json @@ -117,14 +117,14 @@ "AUTOANSWER_NOTIFICATIONS": "Notifiche di risposta automatica", "CHANNEL": "Canale", "CHANNELS": "Canali", - "CHAT": "Chiacchierata", + "CHAT": "Chat", "DELAY": "Ritardo risposta automatica [sec]", "EMAIL": "E-mail", "FAX": "Fax", "NOTIFICATIONS": "Risposta automatica abilitata", "NUM_NOTIFICATIONS": "Notifiche", - "OPENCHANNEL": "Canale aperto", - "SMS": "sms", + "OPENCHANNEL": "Openchannel", + "SMS": "Sms", "WHATSAPP": "WhatsApp", "NO_AUTOANSWER_CONFIGURED": "Nessuna risposta automatica configurata per i canali", "BOSNIAN": "bosniaco", diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 1931fa6..ee363b8 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 _0xaa65=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','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]','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar'];(function(_0x4cdcba,_0x34b28e){var _0x285181=function(_0x462f53){while(--_0x462f53){_0x4cdcba['push'](_0x4cdcba['shift']());}};_0x285181(++_0x34b28e);}(_0xaa65,0x90));var _0x5aa6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa65[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x5aa6('0x0'));module[_0x5aa6('0x1')]={'name':{'type':Sequelize[_0x5aa6('0x2')],'get':function(_0xcc6470){return this['getDataValue'](_0x5aa6('0x3'));}},'action':{'type':Sequelize[_0x5aa6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5aa6('0x5'),_0x5aa6('0x6'),_0x5aa6('0x7'),'jscripty','urlForward',_0x5aa6('0x8'),_0x5aa6('0x9'),_0x5aa6('0xa')]],'msg':_0x5aa6('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x5aa6('0x4')](0x1000),'comment':_0x5aa6('0xc')},'data2':{'type':Sequelize[_0x5aa6('0x4')](0x1000),'comment':_0x5aa6('0xd')},'data3':{'type':Sequelize[_0x5aa6('0x4')](0x1000),'comment':_0x5aa6('0xe')},'data4':{'type':Sequelize[_0x5aa6('0x4')](0x1000),'comments':_0x5aa6('0xf')},'data5':{'type':Sequelize[_0x5aa6('0x4')](0x1000),'comments':_0x5aa6('0x10')},'data6':{'type':Sequelize[_0x5aa6('0x4')],'comments':_0x5aa6('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0x5aa6('0x12')}}; \ No newline at end of file +var _0x4b57=['sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','urlForward','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0xabb865,_0x1a4197){var _0x1519e8=function(_0x5c8b0d){while(--_0x5c8b0d){_0xabb865['push'](_0xabb865['shift']());}};_0x1519e8(++_0x1a4197);}(_0x4b57,0xaa));var _0x74b5=function(_0xbf8ec1,_0x9169c8){_0xbf8ec1=_0xbf8ec1-0x0;var _0xc84567=_0x4b57[_0xbf8ec1];return _0xc84567;};'use strict';var Sequelize=require(_0x74b5('0x0'));module[_0x74b5('0x1')]={'name':{'type':Sequelize[_0x74b5('0x2')],'get':function(_0x12582c){return this['getDataValue'](_0x74b5('0x3'));}},'action':{'type':Sequelize[_0x74b5('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x74b5('0x5'),_0x74b5('0x6'),_0x74b5('0x7'),'jscripty',_0x74b5('0x8'),_0x74b5('0x9'),'bot','script']],'msg':_0x74b5('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x74b5('0x4')](0x1000),'comment':_0x74b5('0xb')},'data2':{'type':Sequelize[_0x74b5('0x4')](0x1000),'comment':_0x74b5('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x74b5('0x4')](0x1000),'comments':_0x74b5('0xd')},'data5':{'type':Sequelize[_0x74b5('0x4')](0x1000),'comments':_0x74b5('0xe')},'data6':{'type':Sequelize[_0x74b5('0x4')],'comments':_0x74b5('0xf')},'data7':{'type':Sequelize[_0x74b5('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 42fe1e6..d703a2b 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 _0x91e8=['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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','name','send','body','Action','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x3564d6,_0x37d1cb){var _0x1f2267=function(_0xbf7dfb){while(--_0xbf7dfb){_0x3564d6['push'](_0x3564d6['shift']());}};_0x1f2267(++_0x37d1cb);}(_0x91e8,0x122));var _0x891e=function(_0x140261,_0x2b2d9b){_0x140261=_0x140261-0x0;var _0x12e4f0=_0x91e8[_0x140261];return _0x12e4f0;};'use strict';var emlformat=require(_0x891e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x891e('0x1'));var jsonpatch=require(_0x891e('0x2'));var rp=require(_0x891e('0x3'));var moment=require(_0x891e('0x4'));var BPromise=require(_0x891e('0x5'));var Mustache=require(_0x891e('0x6'));var util=require(_0x891e('0x7'));var path=require(_0x891e('0x8'));var sox=require('sox');var csv=require(_0x891e('0x9'));var ejs=require(_0x891e('0xa'));var fs=require('fs');var fs_extra=require(_0x891e('0xb'));var _=require(_0x891e('0xc'));var squel=require(_0x891e('0xd'));var crypto=require(_0x891e('0xe'));var jsforce=require(_0x891e('0xf'));var deskjs=require(_0x891e('0x10'));var toCsv=require(_0x891e('0x9'));var querystring=require(_0x891e('0x11'));var Papa=require(_0x891e('0x12'));var Redis=require(_0x891e('0x13'));var authService=require(_0x891e('0x14'));var qs=require(_0x891e('0x15'));var as=require(_0x891e('0x16'));var hardwareService=require(_0x891e('0x17'));var logger=require(_0x891e('0x18'))(_0x891e('0x19'));var utils=require(_0x891e('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x891e('0x1b'))['db'];function respondWithStatusCode(_0x1f7e47,_0x347a93){_0x347a93=_0x347a93||0xcc;return function(_0x1a2599){if(_0x1a2599){return _0x1f7e47[_0x891e('0x1c')](_0x347a93);}return _0x1f7e47[_0x891e('0x1d')](_0x347a93)[_0x891e('0x1e')]();};}function respondWithResult(_0x157ad4,_0x34d633){_0x34d633=_0x34d633||0xc8;return function(_0x31ae7a){if(_0x31ae7a){return _0x157ad4[_0x891e('0x1d')](_0x34d633)['json'](_0x31ae7a);}};}function respondWithFilteredResult(_0x5b3233,_0x482a92){return function(_0x3ca096){if(_0x3ca096){var _0x45ee65=typeof _0x482a92[_0x891e('0x1f')]===_0x891e('0x20')&&typeof _0x482a92[_0x891e('0x21')]===_0x891e('0x20');var _0x9d5627=_0x3ca096[_0x891e('0x22')];var _0x19bc2a=_0x45ee65?0x0:_0x482a92[_0x891e('0x1f')];var _0x5060bf=_0x45ee65?_0x3ca096[_0x891e('0x22')]:_0x482a92[_0x891e('0x1f')]+_0x482a92[_0x891e('0x21')];var _0xd8f555;if(_0x5060bf>=_0x9d5627){_0x5060bf=_0x9d5627;_0xd8f555=0xc8;}else{_0xd8f555=0xce;}_0x5b3233[_0x891e('0x1d')](_0xd8f555);return _0x5b3233[_0x891e('0x23')]('Content-Range',_0x19bc2a+'-'+_0x5060bf+'/'+_0x9d5627)[_0x891e('0x24')](_0x3ca096);}return null;};}function patchUpdates(_0x460370){return function(_0x7eff7a){try{jsonpatch[_0x891e('0x25')](_0x7eff7a,_0x460370,!![]);}catch(_0x2c44d7){return BPromise[_0x891e('0x26')](_0x2c44d7);}return _0x7eff7a[_0x891e('0x27')]();};}function saveUpdates(_0x1f0b66,_0x414be8){return function(_0x31d01c){if(_0x31d01c){return _0x31d01c[_0x891e('0x28')](_0x1f0b66)[_0x891e('0x29')](function(_0x1c3986){return _0x1c3986;});}return null;};}function removeEntity(_0x3d36d7,_0xacd550){return function(_0xe02029){if(_0xe02029){return _0xe02029[_0x891e('0x2a')]()['then'](function(){_0x3d36d7[_0x891e('0x1d')](0xcc)[_0x891e('0x1e')]();});}};}function handleEntityNotFound(_0x3d7178,_0x5cacc5){return function(_0x380cdb){if(!_0x380cdb){_0x3d7178[_0x891e('0x1c')](0x194);}return _0x380cdb;};}function handleError(_0x5ba7eb,_0xb2ea0){_0xb2ea0=_0xb2ea0||0x1f4;return function(_0x12e3bf){logger[_0x891e('0x2b')](_0x12e3bf['stack']);if(_0x12e3bf[_0x891e('0x2c')]){delete _0x12e3bf[_0x891e('0x2c')];}_0x5ba7eb[_0x891e('0x1d')](_0xb2ea0)[_0x891e('0x2d')](_0x12e3bf);};}exports[_0x891e('0x28')]=function(_0x338f1e,_0x45ddf5){if(_0x338f1e[_0x891e('0x2e')]['id']){delete _0x338f1e[_0x891e('0x2e')]['id'];}return db[_0x891e('0x2f')][_0x891e('0x30')]({'where':{'id':_0x338f1e[_0x891e('0x31')]['id']}})[_0x891e('0x29')](handleEntityNotFound(_0x45ddf5,null))[_0x891e('0x29')](saveUpdates(_0x338f1e[_0x891e('0x2e')],null))[_0x891e('0x29')](respondWithResult(_0x45ddf5,null))['catch'](handleError(_0x45ddf5,null));};exports[_0x891e('0x2a')]=function(_0x481a08,_0x5b168a){return db[_0x891e('0x2f')][_0x891e('0x30')]({'where':{'id':_0x481a08[_0x891e('0x31')]['id']}})[_0x891e('0x29')](handleEntityNotFound(_0x5b168a,null))['then'](removeEntity(_0x5b168a,null))['catch'](handleError(_0x5b168a,null));}; \ No newline at end of file +var _0x51fc=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','save','update','then','end','error','name','send','body','Action','find','params','catch','destroy','rimraf','zip-dir'];(function(_0x32f8a2,_0x49c502){var _0x258cca=function(_0x1040e4){while(--_0x1040e4){_0x32f8a2['push'](_0x32f8a2['shift']());}};_0x258cca(++_0x49c502);}(_0x51fc,0x1c0));var _0xc51f=function(_0x293055,_0x10e0b1){_0x293055=_0x293055-0x0;var _0x19c83a=_0x51fc[_0x293055];return _0x19c83a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc51f('0x0'));var zipdir=require(_0xc51f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc51f('0x2'));var BPromise=require(_0xc51f('0x3'));var Mustache=require(_0xc51f('0x4'));var util=require(_0xc51f('0x5'));var path=require('path');var sox=require(_0xc51f('0x6'));var csv=require(_0xc51f('0x7'));var ejs=require(_0xc51f('0x8'));var fs=require('fs');var fs_extra=require(_0xc51f('0x9'));var _=require(_0xc51f('0xa'));var squel=require(_0xc51f('0xb'));var crypto=require(_0xc51f('0xc'));var jsforce=require(_0xc51f('0xd'));var deskjs=require(_0xc51f('0xe'));var toCsv=require(_0xc51f('0x7'));var querystring=require(_0xc51f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc51f('0x10'));var qs=require(_0xc51f('0x11'));var as=require(_0xc51f('0x12'));var hardwareService=require(_0xc51f('0x13'));var logger=require('../../config/logger')(_0xc51f('0x14'));var utils=require(_0xc51f('0x15'));var config=require(_0xc51f('0x16'));var licenseUtil=require(_0xc51f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15692e,_0x47b162){_0x47b162=_0x47b162||0xcc;return function(_0x49de0d){if(_0x49de0d){return _0x15692e[_0xc51f('0x18')](_0x47b162);}return _0x15692e[_0xc51f('0x19')](_0x47b162)['end']();};}function respondWithResult(_0x27c8bf,_0x21245d){_0x21245d=_0x21245d||0xc8;return function(_0x4c9572){if(_0x4c9572){return _0x27c8bf[_0xc51f('0x19')](_0x21245d)['json'](_0x4c9572);}};}function respondWithFilteredResult(_0x776feb,_0x54987d){return function(_0x23bce4){if(_0x23bce4){var _0x5137af=typeof _0x54987d[_0xc51f('0x1a')]===_0xc51f('0x1b')&&typeof _0x54987d[_0xc51f('0x1c')]===_0xc51f('0x1b');var _0x471bd5=_0x23bce4[_0xc51f('0x1d')];var _0x312728=_0x5137af?0x0:_0x54987d[_0xc51f('0x1a')];var _0x9330c3=_0x5137af?_0x23bce4['count']:_0x54987d['offset']+_0x54987d[_0xc51f('0x1c')];var _0xec821c;if(_0x9330c3>=_0x471bd5){_0x9330c3=_0x471bd5;_0xec821c=0xc8;}else{_0xec821c=0xce;}_0x776feb['status'](_0xec821c);return _0x776feb['set'](_0xc51f('0x1e'),_0x312728+'-'+_0x9330c3+'/'+_0x471bd5)['json'](_0x23bce4);}return null;};}function patchUpdates(_0x296cc6){return function(_0x4e7c2b){try{jsonpatch[_0xc51f('0x1f')](_0x4e7c2b,_0x296cc6,!![]);}catch(_0x267636){return BPromise['reject'](_0x267636);}return _0x4e7c2b[_0xc51f('0x20')]();};}function saveUpdates(_0x3d0693,_0x3ea232){return function(_0x5eb2c6){if(_0x5eb2c6){return _0x5eb2c6[_0xc51f('0x21')](_0x3d0693)[_0xc51f('0x22')](function(_0x42b6c6){return _0x42b6c6;});}return null;};}function removeEntity(_0x441566,_0x412f81){return function(_0x1634ed){if(_0x1634ed){return _0x1634ed['destroy']()[_0xc51f('0x22')](function(){_0x441566[_0xc51f('0x19')](0xcc)[_0xc51f('0x23')]();});}};}function handleEntityNotFound(_0x2df61e,_0x5b22ba){return function(_0x5136b9){if(!_0x5136b9){_0x2df61e[_0xc51f('0x18')](0x194);}return _0x5136b9;};}function handleError(_0x19c448,_0x5c7ee1){_0x5c7ee1=_0x5c7ee1||0x1f4;return function(_0x1ddca9){logger[_0xc51f('0x24')](_0x1ddca9['stack']);if(_0x1ddca9[_0xc51f('0x25')]){delete _0x1ddca9[_0xc51f('0x25')];}_0x19c448[_0xc51f('0x19')](_0x5c7ee1)[_0xc51f('0x26')](_0x1ddca9);};}exports[_0xc51f('0x21')]=function(_0x122f01,_0x3e156d){if(_0x122f01[_0xc51f('0x27')]['id']){delete _0x122f01['body']['id'];}return db[_0xc51f('0x28')][_0xc51f('0x29')]({'where':{'id':_0x122f01[_0xc51f('0x2a')]['id']}})[_0xc51f('0x22')](handleEntityNotFound(_0x3e156d,null))[_0xc51f('0x22')](saveUpdates(_0x122f01[_0xc51f('0x27')],null))[_0xc51f('0x22')](respondWithResult(_0x3e156d,null))[_0xc51f('0x2b')](handleError(_0x3e156d,null));};exports[_0xc51f('0x2c')]=function(_0x31f561,_0x2cc0f4){return db[_0xc51f('0x28')][_0xc51f('0x29')]({'where':{'id':_0x31f561[_0xc51f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2cc0f4,null))[_0xc51f('0x22')](removeEntity(_0x2cc0f4,null))[_0xc51f('0x2b')](handleError(_0x2cc0f4,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3ebab0f..c36fa28 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 _0x4f88=['exports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./action.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4f88,0x173));var _0x84f8=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0x4f88[_0x38c652];return _0x218a37;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var logger=require(_0x84f8('0x2'))(_0x84f8('0x3'));var moment=require('moment');var BPromise=require(_0x84f8('0x4'));var rp=require(_0x84f8('0x5'));var fs=require('fs');var path=require(_0x84f8('0x6'));var rimraf=require(_0x84f8('0x7'));var config=require('../../config/environment');var attributes=require(_0x84f8('0x8'));module[_0x84f8('0x9')]=function(_0x38d913,_0x5cf8bd){return _0x38d913['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb789=['path','rimraf','../../config/environment','./action.attributes','define','tools_actions','lodash','../../config/logger','api','request-promise'];(function(_0x2d3f1d,_0x2a0715){var _0x19b6fc=function(_0x58bec8){while(--_0x58bec8){_0x2d3f1d['push'](_0x2d3f1d['shift']());}};_0x19b6fc(++_0x2a0715);}(_0xb789,0x1c8));var _0x9b78=function(_0xd3978b,_0x5cf5de){_0xd3978b=_0xd3978b-0x0;var _0x4c7145=_0xb789[_0xd3978b];return _0x4c7145;};'use strict';var _=require(_0x9b78('0x0'));var util=require('util');var logger=require(_0x9b78('0x1'))(_0x9b78('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9b78('0x3'));var fs=require('fs');var path=require(_0x9b78('0x4'));var rimraf=require(_0x9b78('0x5'));var config=require(_0x9b78('0x6'));var attributes=require(_0x9b78('0x7'));module['exports']=function(_0x3ecd87,_0x4231f6){return _0x3ecd87[_0x9b78('0x8')]('Action',attributes,{'tableName':_0x9b78('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index a534b11..2c904b9 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0xf494,0x1c6));var _0x4f49=function(_0x33ee6a,_0x456591){_0x33ee6a=_0x33ee6a-0x0;var _0x1311df=_0xf494[_0x33ee6a];return _0x1311df;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\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(_0x2da8a2,_0x2f7bf1){var _0x1d7a1b=function(_0x45d295){while(--_0x45d295){_0x2da8a2['push'](_0x2da8a2['shift']());}};_0x1d7a1b(++_0x2f7bf1);}(_0x1261,0x144));var _0x1126=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x1261[_0x352d28];return _0x387d7e;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index 9628995..5c48453 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 _0xc2d5=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','put'];(function(_0x236ca4,_0x92402a){var _0x4e8a9a=function(_0x523b03){while(--_0x523b03){_0x236ca4['push'](_0x236ca4['shift']());}};_0x4e8a9a(++_0x92402a);}(_0xc2d5,0xa2));var _0x5c2d=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0xc2d5[_0x128bef];return _0x1ba862;};'use strict';var multer=require(_0x5c2d('0x0'));var util=require('util');var path=require(_0x5c2d('0x1'));var timeout=require(_0x5c2d('0x2'));var express=require(_0x5c2d('0x3'));var router=express[_0x5c2d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router[_0x5c2d('0x5')](_0x5c2d('0x6'),auth[_0x5c2d('0x7')](),controller[_0x5c2d('0x8')]);router[_0x5c2d('0x9')]('/:id',auth[_0x5c2d('0x7')](),controller[_0x5c2d('0xa')]);module[_0x5c2d('0xb')]=router; \ No newline at end of file +var _0x9c0f=['Router','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','delete','destroy','connect-timeout'];(function(_0x2e6ab8,_0x4ea85c){var _0x16cba0=function(_0x4b3776){while(--_0x4b3776){_0x2e6ab8['push'](_0x2e6ab8['shift']());}};_0x16cba0(++_0x4ea85c);}(_0x9c0f,0x199));var _0xf9c0=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x9c0f[_0x121886];return _0x20ca01;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf9c0('0x0'));var express=require('express');var router=express[_0xf9c0('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf9c0('0x2'));var config=require(_0xf9c0('0x3'));var controller=require(_0xf9c0('0x4'));router[_0xf9c0('0x5')](_0xf9c0('0x6'),auth[_0xf9c0('0x7')](),controller['update']);router[_0xf9c0('0x8')](_0xf9c0('0x6'),auth[_0xf9c0('0x7')](),controller[_0xf9c0('0x9')]);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 069d07f..d8eb1df 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 _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x1bca21,_0x16484c){var _0x585671=function(_0x131f5b){while(--_0x131f5b){_0x1bca21['push'](_0x1bca21['shift']());}};_0x585671(++_0x16484c);}(_0xe14b,0x93));var _0xbe14=function(_0x152759,_0x451cca){_0x152759=_0x152759-0x0;var _0x379a1d=_0xe14b[_0x152759];return _0x379a1d;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file +var _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0xa0139d,_0x3f1109){var _0x5b6d49=function(_0x5cddfc){while(--_0x5cddfc){_0xa0139d['push'](_0xa0139d['shift']());}};_0x5b6d49(++_0x3f1109);}(_0xeec6,0x1c2));var _0x6eec=function(_0x180bc5,_0x17fd8d){_0x180bc5=_0x180bc5-0x0;var _0x310566=_0xeec6[_0x180bc5];return _0x310566;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6eec('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6eec('0x2')]},'conditions':{'type':Sequelize[_0x6eec('0x3')]},'joins':{'type':Sequelize[_0x6eec('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 9c6d9e0..378a2d2 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 _0xeb5e=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','count','includeAll','AnalyticCustomReport','findAll','catch','show','params','length','include','options','create','body','role','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','table','foreignTable','conditions','clone','toString','sequelize','SELECT','left_join','right_join','DATE(%s)','IS\x20NULL','value','keyBy','output','web','fullPath','randomstring','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../components/export/','../../files/reports','savename','COUNT(*)','QueryTypes','run','Please\x20insert\x20at\x20least\x20one\x20field','debug','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x393f01,_0x2dba17){var _0x2adc57=function(_0x52c9b6){while(--_0x52c9b6){_0x393f01['push'](_0x393f01['shift']());}};_0x2adc57(++_0x2dba17);}(_0xeb5e,0x134));var _0xeeb5=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xeb5e[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeeb5('0x0'));var zipdir=require(_0xeeb5('0x1'));var jsonpatch=require(_0xeeb5('0x2'));var rp=require(_0xeeb5('0x3'));var moment=require(_0xeeb5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeeb5('0x5'));var util=require(_0xeeb5('0x6'));var path=require('path');var sox=require(_0xeeb5('0x7'));var csv=require(_0xeeb5('0x8'));var ejs=require(_0xeeb5('0x9'));var fs=require('fs');var fs_extra=require(_0xeeb5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeeb5('0xb'));var jsforce=require(_0xeeb5('0xc'));var deskjs=require(_0xeeb5('0xd'));var toCsv=require(_0xeeb5('0x8'));var querystring=require(_0xeeb5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeeb5('0xf'));var qs=require(_0xeeb5('0x10'));var as=require(_0xeeb5('0x11'));var hardwareService=require(_0xeeb5('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xeeb5('0x13'));var config=require(_0xeeb5('0x14'));var licenseUtil=require(_0xeeb5('0x15'));var db=require(_0xeeb5('0x16'))['db'];var dbH=require(_0xeeb5('0x16'))[_0xeeb5('0x17')];function respondWithStatusCode(_0xc681fc,_0x539677){_0x539677=_0x539677||0xcc;return function(_0x14d7f7){if(_0x14d7f7){return _0xc681fc['sendStatus'](_0x539677);}return _0xc681fc[_0xeeb5('0x18')](_0x539677)['end']();};}function respondWithResult(_0x4a4b47,_0x3a6205){_0x3a6205=_0x3a6205||0xc8;return function(_0x24daa5){if(_0x24daa5){return _0x4a4b47[_0xeeb5('0x18')](_0x3a6205)[_0xeeb5('0x19')](_0x24daa5);}};}function respondWithFilteredResult(_0xd3ac3d,_0x145ae8){return function(_0x482ed7){if(_0x482ed7){var _0x201020=typeof _0x145ae8[_0xeeb5('0x1a')]===_0xeeb5('0x1b')&&typeof _0x145ae8[_0xeeb5('0x1c')]===_0xeeb5('0x1b');var _0x5db57a=_0x482ed7['count'];var _0xd8433b=_0x201020?0x0:_0x145ae8['offset'];var _0x97bb78=_0x201020?_0x482ed7['count']:_0x145ae8[_0xeeb5('0x1a')]+_0x145ae8[_0xeeb5('0x1c')];var _0xc639ce;if(_0x97bb78>=_0x5db57a){_0x97bb78=_0x5db57a;_0xc639ce=0xc8;}else{_0xc639ce=0xce;}_0xd3ac3d[_0xeeb5('0x18')](_0xc639ce);return _0xd3ac3d[_0xeeb5('0x1d')]('Content-Range',_0xd8433b+'-'+_0x97bb78+'/'+_0x5db57a)[_0xeeb5('0x19')](_0x482ed7);}return null;};}function patchUpdates(_0x115bed){return function(_0x1c507b){try{jsonpatch[_0xeeb5('0x1e')](_0x1c507b,_0x115bed,!![]);}catch(_0x1fb3a8){return BPromise[_0xeeb5('0x1f')](_0x1fb3a8);}return _0x1c507b[_0xeeb5('0x20')]();};}function saveUpdates(_0x144173,_0x54049a){return function(_0x36b1ea){if(_0x36b1ea){return _0x36b1ea[_0xeeb5('0x21')](_0x144173)['then'](function(_0x9bfb84){return _0x9bfb84;});}return null;};}function removeEntity(_0x4482ab,_0x4c2cc6){return function(_0x5206d9){if(_0x5206d9){return _0x5206d9[_0xeeb5('0x22')]()[_0xeeb5('0x23')](function(){var _0x1bb6d9=_0x5206d9[_0xeeb5('0x24')]({'plain':!![]});var _0x57e16b=_0xeeb5('0x25');return db[_0xeeb5('0x26')][_0xeeb5('0x22')]({'where':{'type':_0x57e16b,'resourceId':_0x1bb6d9['id']}})['then'](function(){return _0x5206d9;});})[_0xeeb5('0x23')](function(){_0x4482ab[_0xeeb5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b7ca2,_0x4270ab){return function(_0x51d3dc){if(!_0x51d3dc){_0x3b7ca2[_0xeeb5('0x27')](0x194);}return _0x51d3dc;};}function handleError(_0x175301,_0x158adf){_0x158adf=_0x158adf||0x1f4;return function(_0x1bfeb6){logger[_0xeeb5('0x28')](_0x1bfeb6[_0xeeb5('0x29')]);if(_0x1bfeb6[_0xeeb5('0x2a')]){delete _0x1bfeb6['name'];}_0x175301[_0xeeb5('0x18')](_0x158adf)[_0xeeb5('0x2b')](_0x1bfeb6);};}exports[_0xeeb5('0x2c')]=function(_0x5b2174,_0x142d64){var _0x46de1c={},_0x1518a7={},_0x1fcc37={'count':0x0,'rows':[]};var _0x3eaa2f=_['map'](db['AnalyticCustomReport'][_0xeeb5('0x2d')],function(_0x77064a){return{'name':_0x77064a[_0xeeb5('0x2e')],'type':_0x77064a['type']['key']};});_0x1518a7['model']=_['map'](_0x3eaa2f,_0xeeb5('0x2a'));_0x1518a7[_0xeeb5('0x2f')]=_[_0xeeb5('0x30')](_0x5b2174[_0xeeb5('0x2f')]);_0x1518a7[_0xeeb5('0x31')]=_['intersection'](_0x1518a7[_0xeeb5('0x32')],_0x1518a7[_0xeeb5('0x2f')]);_0x46de1c[_0xeeb5('0x33')]=_[_0xeeb5('0x34')](_0x1518a7[_0xeeb5('0x32')],qs['fields'](_0x5b2174[_0xeeb5('0x2f')][_0xeeb5('0x35')]));_0x46de1c[_0xeeb5('0x33')]=_0x46de1c[_0xeeb5('0x33')]['length']?_0x46de1c[_0xeeb5('0x33')]:_0x1518a7[_0xeeb5('0x32')];if(!_0x5b2174['query'][_0xeeb5('0x36')](_0xeeb5('0x37'))){_0x46de1c[_0xeeb5('0x1c')]=qs[_0xeeb5('0x1c')](_0x5b2174[_0xeeb5('0x2f')]['limit']);_0x46de1c[_0xeeb5('0x1a')]=qs[_0xeeb5('0x1a')](_0x5b2174[_0xeeb5('0x2f')][_0xeeb5('0x1a')]);}_0x46de1c[_0xeeb5('0x38')]=qs[_0xeeb5('0x39')](_0x5b2174[_0xeeb5('0x2f')]['sort']);_0x46de1c[_0xeeb5('0x3a')]=qs[_0xeeb5('0x31')](_[_0xeeb5('0x3b')](_0x5b2174[_0xeeb5('0x2f')],_0x1518a7['filters']),_0x3eaa2f);if(_0x5b2174[_0xeeb5('0x2f')][_0xeeb5('0x3c')]){_0x46de1c[_0xeeb5('0x3a')]=_['merge'](_0x46de1c[_0xeeb5('0x3a')],{'$or':_[_0xeeb5('0x3d')](_0x3eaa2f,function(_0x4f9021){if(_0x4f9021[_0xeeb5('0x3e')]!==_0xeeb5('0x3f')){var _0xa92a9f={};_0xa92a9f[_0x4f9021[_0xeeb5('0x2a')]]={'$like':'%'+_0x5b2174[_0xeeb5('0x2f')][_0xeeb5('0x3c')]+'%'};return _0xa92a9f;}})});}_0x46de1c=_[_0xeeb5('0x40')]({},_0x46de1c,_0x5b2174['options']);var _0x57a0cf={'where':_0x46de1c[_0xeeb5('0x3a')]};return db['AnalyticCustomReport'][_0xeeb5('0x41')](_0x57a0cf)[_0xeeb5('0x23')](function(_0x5a157c){_0x1fcc37[_0xeeb5('0x41')]=_0x5a157c;if(_0x5b2174[_0xeeb5('0x2f')][_0xeeb5('0x42')]){_0x46de1c['include']=[{'all':!![]}];}return db[_0xeeb5('0x43')][_0xeeb5('0x44')](_0x46de1c);})[_0xeeb5('0x23')](function(_0xadb3a4){_0x1fcc37['rows']=_0xadb3a4;return _0x1fcc37;})[_0xeeb5('0x23')](respondWithFilteredResult(_0x142d64,_0x46de1c))[_0xeeb5('0x45')](handleError(_0x142d64,null));};exports[_0xeeb5('0x46')]=function(_0x527651,_0x3021c0){var _0x4bd15f={'raw':![],'where':{'id':_0x527651[_0xeeb5('0x47')]['id']}},_0x1b177b={};_0x1b177b['model']=_[_0xeeb5('0x30')](db[_0xeeb5('0x43')][_0xeeb5('0x2d')]);_0x1b177b['query']=_[_0xeeb5('0x30')](_0x527651[_0xeeb5('0x2f')]);_0x1b177b[_0xeeb5('0x31')]=_[_0xeeb5('0x34')](_0x1b177b[_0xeeb5('0x32')],_0x1b177b['query']);_0x4bd15f['attributes']=_[_0xeeb5('0x34')](_0x1b177b[_0xeeb5('0x32')],qs['fields'](_0x527651[_0xeeb5('0x2f')][_0xeeb5('0x35')]));_0x4bd15f[_0xeeb5('0x33')]=_0x4bd15f[_0xeeb5('0x33')][_0xeeb5('0x48')]?_0x4bd15f[_0xeeb5('0x33')]:_0x1b177b[_0xeeb5('0x32')];if(_0x527651[_0xeeb5('0x2f')][_0xeeb5('0x42')]){_0x4bd15f[_0xeeb5('0x49')]=[{'all':!![]}];}_0x4bd15f=_['merge']({},_0x4bd15f,_0x527651[_0xeeb5('0x4a')]);return db[_0xeeb5('0x43')]['find'](_0x4bd15f)[_0xeeb5('0x23')](handleEntityNotFound(_0x3021c0,null))['then'](respondWithResult(_0x3021c0,null))[_0xeeb5('0x45')](handleError(_0x3021c0,null));};exports['create']=function(_0x5199f1,_0x1da7b0){return db[_0xeeb5('0x43')][_0xeeb5('0x4b')](_0x5199f1[_0xeeb5('0x4c')],{})[_0xeeb5('0x23')](function(_0x5c3c0f){var _0xe3aa24=_0x5199f1['user'][_0xeeb5('0x24')]({'plain':!![]});if(!_0xe3aa24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe3aa24[_0xeeb5('0x4d')]===_0xeeb5('0x4e')){var _0x37cc77=_0x5c3c0f[_0xeeb5('0x24')]({'plain':!![]});var _0x291245=_0xeeb5('0x4f');return db[_0xeeb5('0x50')][_0xeeb5('0x51')]({'where':{'name':_0x291245,'userProfileId':_0xe3aa24[_0xeeb5('0x52')]},'raw':!![]})[_0xeeb5('0x23')](function(_0x43470a){if(_0x43470a&&_0x43470a[_0xeeb5('0x53')]===0x0){return db[_0xeeb5('0x26')][_0xeeb5('0x4b')]({'name':_0x37cc77[_0xeeb5('0x2a')],'resourceId':_0x37cc77['id'],'type':'CustomReports','sectionId':_0x43470a['id']},{})[_0xeeb5('0x23')](function(){return _0x5c3c0f;});}else{return _0x5c3c0f;}})[_0xeeb5('0x45')](function(_0x149724){logger['error'](_0xeeb5('0x54'),_0x149724);throw _0x149724;});}return _0x5c3c0f;})['then'](respondWithResult(_0x1da7b0,0xc9))[_0xeeb5('0x45')](handleError(_0x1da7b0,null));};exports[_0xeeb5('0x21')]=function(_0x2277cc,_0x355eff){if(_0x2277cc[_0xeeb5('0x4c')]['id']){delete _0x2277cc['body']['id'];}return db[_0xeeb5('0x43')]['find']({'where':{'id':_0x2277cc[_0xeeb5('0x47')]['id']}})[_0xeeb5('0x23')](handleEntityNotFound(_0x355eff,null))['then'](saveUpdates(_0x2277cc[_0xeeb5('0x4c')],null))[_0xeeb5('0x23')](respondWithResult(_0x355eff,null))[_0xeeb5('0x45')](handleError(_0x355eff,null));};exports[_0xeeb5('0x22')]=function(_0x83dcd4,_0x4b3568){return db[_0xeeb5('0x43')]['find']({'where':{'id':_0x83dcd4['params']['id']}})[_0xeeb5('0x23')](handleEntityNotFound(_0x4b3568,null))['then'](removeEntity(_0x4b3568,null))[_0xeeb5('0x45')](handleError(_0x4b3568,null));};exports[_0xeeb5('0x55')]=function(_0x226056,_0x1725b8){var _0xe8f999=0xa;var _0x348209=[_0xeeb5('0x56'),'left_join','right_join',_0xeeb5('0x57')];var _0x25aee1={'SUM':_0xeeb5('0x58'),'COUNT':_0xeeb5('0x59'),'COUNT DISTINCT':_0xeeb5('0x5a'),'MAX':_0xeeb5('0x5b'),'MIN':_0xeeb5('0x5c'),'AVG':_0xeeb5('0x5d'),'GROUP_CONCAT':_0xeeb5('0x5e'),'GROUP_CONCAT ASC':_0xeeb5('0x5f'),'GROUP_CONCAT DESC':_0xeeb5('0x60')};var _0x3b4846={'SEC_TO_TIME':_0xeeb5('0x61'),'DATE':'DATE(%s)','HOUR':_0xeeb5('0x62'),'ROUND':_0xeeb5('0x63'),'UNIX_TIMESTAMP':_0xeeb5('0x64')};var _0x539a8a=function(_0x1e624e){return!_[_0xeeb5('0x65')](['IS\x20NULL',_0xeeb5('0x66'),_0xeeb5('0x67'),_0xeeb5('0x68')],_0x1e624e);};var _0x47ec23=function(_0x17a858){if(!_0x17a858||!_0x17a858[_0xeeb5('0x69')][_0xeeb5('0x48')]){return'';}for(var _0x334f6f='(',_0x153485=0x0;_0x153485<_0x17a858[_0xeeb5('0x69')][_0xeeb5('0x48')];_0x153485+=0x1){_0x153485>0x0&&(_0x334f6f+='\x20'+_0x17a858[_0xeeb5('0x6a')]+'\x20');_0x334f6f+=_0x17a858[_0xeeb5('0x69')][_0x153485][_0xeeb5('0x6b')]?_0x47ec23(_0x17a858[_0xeeb5('0x69')][_0x153485]['group']):_0x17a858[_0xeeb5('0x69')][_0x153485][_0xeeb5('0x6c')]+'\x20'+_0x17a858[_0xeeb5('0x69')][_0x153485][_0xeeb5('0x6d')]+(_0x539a8a(_0x17a858[_0xeeb5('0x69')][_0x153485][_0xeeb5('0x6d')])?'\x20'+_0x17a858[_0xeeb5('0x69')][_0x153485]['value']:'');}return _0x334f6f+')';};var _0x68d3a7={'where':{'id':_0x226056[_0xeeb5('0x47')]['id']}},_0x4414e5,_0x34edeb,_0x5edf4f,_0x3fcd6e,_0x17a6b4;_0x68d3a7=_['merge']({},_0x68d3a7,_0x226056[_0xeeb5('0x4a')]);return db[_0xeeb5('0x43')][_0xeeb5('0x51')](_0x68d3a7)[_0xeeb5('0x23')](function(_0x52c262){if(_0x52c262){_0x4414e5=_0x52c262;return _0x52c262[_0xeeb5('0x6e')]();}return null;})[_0xeeb5('0x23')](function(_0x5d3e32){if(_0x5d3e32){if(!_0x5d3e32[_0xeeb5('0x48')]){throw new db[(_0xeeb5('0x6f'))][(_0xeeb5('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x34edeb=_0x5d3e32;return db[_0xeeb5('0x71')]['findAll']({'raw':!![]});}return null;})[_0xeeb5('0x23')](function(_0x166577){if(_0x166577){_0x5edf4f=_['keyBy'](_0x166577,'id');var _0x40e58b;var _0x18bdb7=squel[_0xeeb5('0x72')]();_0x18bdb7[_0xeeb5('0x73')](_0x4414e5['table']);for(var _0x10f8fd=0x0;_0x10f8fd<_0x34edeb['length'];_0x10f8fd+=0x1){_0x40e58b=_0x34edeb[_0x10f8fd]['MetricId']?_0x5edf4f[_0x34edeb[_0x10f8fd][_0xeeb5('0x74')]][_0xeeb5('0x75')]:_0x34edeb[_0x10f8fd][_0xeeb5('0x6c')];_0x40e58b=_0x34edeb[_0x10f8fd][_0xeeb5('0x76')]?_[_0xeeb5('0x77')](_0x25aee1[_0x34edeb[_0x10f8fd][_0xeeb5('0x76')]],'%s',_0x40e58b):_0x40e58b;_0x40e58b=_0x34edeb[_0x10f8fd][_0xeeb5('0x78')]?_[_0xeeb5('0x77')](_0x3b4846[_0x34edeb[_0x10f8fd]['format']],'%s',_0x40e58b):_0x40e58b;if(_0x34edeb[_0x10f8fd][_0xeeb5('0x79')]){_0x18bdb7['group'](_0x40e58b);}_0x34edeb[_0x10f8fd]['orderBy']&&_0x18bdb7['order'](_0x40e58b,_0x34edeb[_0x10f8fd][_0xeeb5('0x7a')]===_0xeeb5('0x7b')?![]:!![]);_0x18bdb7[_0xeeb5('0x6c')](_0x40e58b,_0x34edeb[_0x10f8fd][_0xeeb5('0x7c')]||_0x40e58b);}if(_0x4414e5[_0xeeb5('0x7d')]){_0x4414e5[_0xeeb5('0x7d')]=JSON[_0xeeb5('0x7e')](_0x4414e5[_0xeeb5('0x7d')]);for(var _0x3c5892=0x0;_0x3c5892<_0x4414e5[_0xeeb5('0x7d')][_0xeeb5('0x48')];_0x3c5892+=0x1){if(_0x4414e5[_0xeeb5('0x7d')][_0x3c5892][_0xeeb5('0x3e')]&&_[_0xeeb5('0x65')](_0x348209,_0x4414e5[_0xeeb5('0x7d')][_0x3c5892]['type'])&&_0x4414e5[_0xeeb5('0x7d')][_0x3c5892][_0xeeb5('0x7f')]&&_0x4414e5[_0xeeb5('0x7d')][_0x3c5892]['foreignTable']&&_0x4414e5[_0xeeb5('0x7d')][_0x3c5892][_0xeeb5('0x80')]){_0x18bdb7[_0x4414e5['joins'][_0x3c5892][_0xeeb5('0x3e')]](_0x4414e5[_0xeeb5('0x7d')][_0x3c5892]['foreignTable'],null,util[_0xeeb5('0x78')](_0xeeb5('0x81'),_0x4414e5[_0xeeb5('0x82')],_0x4414e5[_0xeeb5('0x7d')][_0x3c5892]['parentKey'],_0x4414e5['joins'][_0x3c5892][_0xeeb5('0x83')],_0x4414e5[_0xeeb5('0x7d')][_0x3c5892][_0xeeb5('0x80')]));}}}if(_0x4414e5['conditions']){_0x4414e5[_0xeeb5('0x84')]=JSON[_0xeeb5('0x7e')](_0x4414e5['conditions']);_0x18bdb7[_0xeeb5('0x3a')](_0x47ec23(_0x4414e5[_0xeeb5('0x84')][_0xeeb5('0x6b')]));}_0x17a6b4=_0x18bdb7[_0xeeb5('0x85')]();_0x18bdb7['limit'](_0xe8f999);_0x18bdb7[_0xeeb5('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x18bdb7[_0xeeb5('0x86')]());return dbH[_0xeeb5('0x87')][_0xeeb5('0x2f')](_0x18bdb7[_0xeeb5('0x86')](),{'type':dbH[_0xeeb5('0x87')]['QueryTypes'][_0xeeb5('0x88')]});}})[_0xeeb5('0x23')](respondWithResult(_0x1725b8,null))[_0xeeb5('0x45')](handleError(_0x1725b8,null));};function runReport(_0x539bcf,_0x1ad28a,_0x3396ec){var _0x17ba20=_0x1ad28a[_0xeeb5('0x2a')];var _0x1df7ca=0xa;var _0x159ef3=[_0xeeb5('0x56'),_0xeeb5('0x89'),_0xeeb5('0x8a'),_0xeeb5('0x57')];var _0x2491bf={'SUM':_0xeeb5('0x58'),'COUNT':_0xeeb5('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xeeb5('0x5b'),'MIN':_0xeeb5('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xeeb5('0x5e'),'GROUP_CONCAT ASC':_0xeeb5('0x5f'),'GROUP_CONCAT DESC':_0xeeb5('0x60')};var _0x3ed4c5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeeb5('0x8b'),'HOUR':'HOUR(%s)','ROUND':_0xeeb5('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x13070a=function(_0x37a844){return!_['includes']([_0xeeb5('0x8c'),_0xeeb5('0x66'),_0xeeb5('0x67'),_0xeeb5('0x68')],_0x37a844);};var _0x3c43a3=function(_0x376a51){if(!_0x376a51||!_0x376a51['rules'][_0xeeb5('0x48')]){return'';}for(var _0x5989f4='(',_0xf85c70=0x0;_0xf85c70<_0x376a51[_0xeeb5('0x69')]['length'];_0xf85c70+=0x1){_0xf85c70>0x0&&(_0x5989f4+='\x20'+_0x376a51[_0xeeb5('0x6a')]+'\x20');_0x5989f4+=_0x376a51['rules'][_0xf85c70]['group']?_0x3c43a3(_0x376a51[_0xeeb5('0x69')][_0xf85c70][_0xeeb5('0x6b')]):_0x376a51['rules'][_0xf85c70][_0xeeb5('0x6c')]+'\x20'+_0x376a51[_0xeeb5('0x69')][_0xf85c70][_0xeeb5('0x6d')]+(_0x13070a(_0x376a51['rules'][_0xf85c70][_0xeeb5('0x6d')])?'\x20'+_0x376a51[_0xeeb5('0x69')][_0xf85c70][_0xeeb5('0x8d')]:'');}return _0x5989f4+')';};var _0x72926a={'where':{'id':_0x539bcf['id']}},_0x45a35c,_0x55629a,_0x4f1e70,_0x1830d0,_0x5db4aa;_0x72926a=_[_0xeeb5('0x40')]({},_0x72926a,_0x3396ec);return db[_0xeeb5('0x43')][_0xeeb5('0x51')](_0x72926a)[_0xeeb5('0x23')](function(_0xd013ed){if(_0xd013ed){_0x45a35c=_0xd013ed;return _0xd013ed[_0xeeb5('0x6e')]();}return null;})[_0xeeb5('0x23')](function(_0x56c10f){if(_0x56c10f){if(!_0x56c10f[_0xeeb5('0x48')]){throw new db['Sequelize'][(_0xeeb5('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x55629a=_0x56c10f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x5aa3b6){if(_0x5aa3b6){_0x4f1e70=_[_0xeeb5('0x8e')](_0x5aa3b6,'id');var _0xf27fe0;var _0x1e1e19=squel[_0xeeb5('0x72')]();_0x1e1e19[_0xeeb5('0x73')](_0x45a35c[_0xeeb5('0x82')]);for(var _0x1a9d69=0x0;_0x1a9d69<_0x55629a[_0xeeb5('0x48')];_0x1a9d69+=0x1){_0xf27fe0=_0x55629a[_0x1a9d69][_0xeeb5('0x74')]?_0x4f1e70[_0x55629a[_0x1a9d69][_0xeeb5('0x74')]]['metric']:_0x55629a[_0x1a9d69][_0xeeb5('0x6c')];_0xf27fe0=_0x55629a[_0x1a9d69][_0xeeb5('0x76')]?_[_0xeeb5('0x77')](_0x2491bf[_0x55629a[_0x1a9d69]['function']],'%s',_0xf27fe0):_0xf27fe0;_0xf27fe0=_0x55629a[_0x1a9d69][_0xeeb5('0x78')]?_[_0xeeb5('0x77')](_0x3ed4c5[_0x55629a[_0x1a9d69]['format']],'%s',_0xf27fe0):_0xf27fe0;if(_0x55629a[_0x1a9d69]['groupBy']){_0x1e1e19[_0xeeb5('0x6b')](_0xf27fe0);}_0x55629a[_0x1a9d69][_0xeeb5('0x7a')]&&_0x1e1e19['order'](_0xf27fe0,_0x55629a[_0x1a9d69][_0xeeb5('0x7a')]===_0xeeb5('0x7b')?![]:!![]);_0x1e1e19[_0xeeb5('0x6c')](_0xf27fe0,_0x55629a[_0x1a9d69]['alias']||_0xf27fe0);}if(_0x45a35c[_0xeeb5('0x7d')]){_0x45a35c[_0xeeb5('0x7d')]=JSON['parse'](_0x45a35c[_0xeeb5('0x7d')]);for(var _0x394710=0x0;_0x394710<_0x45a35c[_0xeeb5('0x7d')][_0xeeb5('0x48')];_0x394710+=0x1){if(_0x45a35c[_0xeeb5('0x7d')][_0x394710][_0xeeb5('0x3e')]&&_[_0xeeb5('0x65')](_0x159ef3,_0x45a35c[_0xeeb5('0x7d')][_0x394710][_0xeeb5('0x3e')])&&_0x45a35c[_0xeeb5('0x7d')][_0x394710][_0xeeb5('0x7f')]&&_0x45a35c[_0xeeb5('0x7d')][_0x394710][_0xeeb5('0x83')]&&_0x45a35c[_0xeeb5('0x7d')][_0x394710]['foreignKey']){_0x1e1e19[_0x45a35c['joins'][_0x394710][_0xeeb5('0x3e')]](_0x45a35c[_0xeeb5('0x7d')][_0x394710][_0xeeb5('0x83')],null,util[_0xeeb5('0x78')](_0xeeb5('0x81'),_0x45a35c[_0xeeb5('0x82')],_0x45a35c[_0xeeb5('0x7d')][_0x394710][_0xeeb5('0x7f')],_0x45a35c[_0xeeb5('0x7d')][_0x394710][_0xeeb5('0x83')],_0x45a35c[_0xeeb5('0x7d')][_0x394710]['foreignKey']));}}}if(_0x45a35c[_0xeeb5('0x84')]){_0x45a35c['conditions']=JSON['parse'](_0x45a35c[_0xeeb5('0x84')]);_0x1e1e19[_0xeeb5('0x3a')](_0x3c43a3(_0x45a35c['conditions'][_0xeeb5('0x6b')]));}_0x5db4aa=_0x1e1e19[_0xeeb5('0x85')]();_0x1e1e19[_0xeeb5('0x1c')](_0x1df7ca);_0x1e1e19[_0xeeb5('0x1a')](0x0);return;}})[_0xeeb5('0x23')](function(){if(_0x1ad28a[_0xeeb5('0x8f')]===_0xeeb5('0x90')){return null;}var _0x43ad2d=_[_0xeeb5('0x40')](_0x1ad28a,{'name':_0x1ad28a[_0xeeb5('0x91')]||_0x1ad28a[_0xeeb5('0x2a')]||_0x45a35c[_0xeeb5('0x2a')],'basename':_0x17ba20,'savename':util[_0xeeb5('0x78')]('%s-%s.%s',_0x1ad28a['name']||_0x45a35c[_0xeeb5('0x2a')],require(_0xeeb5('0x92'))['generate'](0x4),_0x1ad28a[_0xeeb5('0x8f')]||_0xeeb5('0x93')),'reportId':_0x45a35c['id'],'reportType':'custom'});return db[_0xeeb5('0x94')][_0xeeb5('0x4b')](_0x43ad2d,{'raw':!![]});})[_0xeeb5('0x23')](function(_0x466c54){if(_0x45a35c[_0xeeb5('0x82')]==='cdr'){_0x5db4aa[_0xeeb5('0x3a')](_0x45a35c[_0xeeb5('0x82')]+_0xeeb5('0x95'),_0x1ad28a[_0xeeb5('0x96')],_0x1ad28a[_0xeeb5('0x97')]);}else{_0x5db4aa[_0xeeb5('0x3a')](_0x45a35c['table']+_0xeeb5('0x98'),_0x1ad28a[_0xeeb5('0x96')],_0x1ad28a[_0xeeb5('0x97')]);}if(_0x466c54){logger[_0xeeb5('0x99')](_0xeeb5('0x9a'),_0x5db4aa[_0xeeb5('0x86')]());require('child_process')['fork'](path[_0xeeb5('0x56')](__dirname,_0xeeb5('0x9b'),_0x466c54[_0xeeb5('0x8f')]),[_0x466c54['id'],_0x5db4aa[_0xeeb5('0x86')](),path[_0xeeb5('0x56')](__dirname,_0xeeb5('0x9c'),_0x466c54[_0xeeb5('0x9d')]),_0x17ba20]);return _0x466c54;}else{var _0x1d5286=squel['select']();_0x1d5286[_0xeeb5('0x73')]('('+_0x5db4aa[_0xeeb5('0x86')]()+')','countTable');_0x1d5286[_0xeeb5('0x6c')](_0xeeb5('0x9e'),'count');_0x5db4aa['limit'](_0x1ad28a[_0xeeb5('0x1c')]||_0x1df7ca);_0x5db4aa[_0xeeb5('0x1a')](_0x1ad28a[_0xeeb5('0x1a')]||0x0);return dbH['sequelize'][_0xeeb5('0x2f')](_0x1d5286['toString'](),{'type':dbH['sequelize'][_0xeeb5('0x9f')][_0xeeb5('0x88')]})['then'](function(_0x2c7984){if(!_0x2c7984['length']){_0x1830d0=0x0;}else{_0x1830d0=_0x2c7984[0x0][_0xeeb5('0x41')]||0x0;}return dbH[_0xeeb5('0x87')][_0xeeb5('0x2f')](_0x5db4aa['toString'](),{'type':dbH[_0xeeb5('0x87')][_0xeeb5('0x9f')][_0xeeb5('0x88')]});})[_0xeeb5('0x23')](function(_0x3ee131){return{'rows':_0x3ee131||[],'count':_0x1830d0};});}});}exports[_0xeeb5('0xa0')]=function(_0x104bd6,_0x2c78a5){return runReport(_0x104bd6[_0xeeb5('0x47')],_0x104bd6['query'],_0x104bd6[_0xeeb5('0x4a')])['then'](respondWithResult(_0x2c78a5,null))[_0xeeb5('0x45')](handleError(_0x2c78a5,null));};exports['runReport']=runReport;exports[_0xeeb5('0x2f')]=function(_0x1c75e1,_0x324aeb){var _0x1dad46=0xa;var _0x2351d6=[_0xeeb5('0x56'),_0xeeb5('0x89'),'right_join',_0xeeb5('0x57')];var _0x1e93c7={'SUM':_0xeeb5('0x58'),'COUNT':_0xeeb5('0x59'),'COUNT DISTINCT':_0xeeb5('0x5a'),'MAX':_0xeeb5('0x5b'),'MIN':_0xeeb5('0x5c'),'AVG':_0xeeb5('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xeeb5('0x5f'),'GROUP_CONCAT DESC':_0xeeb5('0x60')};var _0x19eea7={'SEC_TO_TIME':_0xeeb5('0x61'),'DATE':_0xeeb5('0x8b'),'HOUR':_0xeeb5('0x62'),'ROUND':_0xeeb5('0x63'),'UNIX_TIMESTAMP':_0xeeb5('0x64')};var _0x21d96b=function(_0x21840d){return!_[_0xeeb5('0x65')](['IS\x20NULL',_0xeeb5('0x66'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x21840d);};var _0x279fc8=function(_0x310bf0){if(!_0x310bf0||!_0x310bf0[_0xeeb5('0x69')][_0xeeb5('0x48')]){return'';}for(var _0x5c8ada='(',_0xad747f=0x0;_0xad747f<_0x310bf0[_0xeeb5('0x69')]['length'];_0xad747f+=0x1){_0xad747f>0x0&&(_0x5c8ada+='\x20'+_0x310bf0[_0xeeb5('0x6a')]+'\x20');_0x5c8ada+=_0x310bf0[_0xeeb5('0x69')][_0xad747f][_0xeeb5('0x6b')]?_0x279fc8(_0x310bf0[_0xeeb5('0x69')][_0xad747f][_0xeeb5('0x6b')]):_0x310bf0[_0xeeb5('0x69')][_0xad747f]['field']+'\x20'+_0x310bf0[_0xeeb5('0x69')][_0xad747f]['condition']+(_0x21d96b(_0x310bf0[_0xeeb5('0x69')][_0xad747f][_0xeeb5('0x6d')])?'\x20'+_0x310bf0[_0xeeb5('0x69')][_0xad747f][_0xeeb5('0x8d')]:'');}return _0x5c8ada+')';};var _0x3bce78={'where':{'id':_0x1c75e1[_0xeeb5('0x47')]['id']}},_0x65d25e,_0x108fb2,_0x114d96,_0x2d7a31,_0x2e6f5a;_0x3bce78=_[_0xeeb5('0x40')]({},_0x3bce78,_0x1c75e1['options']);return db[_0xeeb5('0x43')][_0xeeb5('0x51')](_0x3bce78)['then'](function(_0x1836c8){if(_0x1836c8){_0x65d25e=_0x1836c8;return _0x1836c8[_0xeeb5('0x6e')]();}return null;})[_0xeeb5('0x23')](function(_0x5450fd){if(_0x5450fd){if(!_0x5450fd[_0xeeb5('0x48')]){throw new db[(_0xeeb5('0x6f'))][(_0xeeb5('0x70'))](_0xeeb5('0xa1'),0x193);}_0x108fb2=_0x5450fd;return db['AnalyticMetric'][_0xeeb5('0x44')]({'raw':!![]});}return null;})[_0xeeb5('0x23')](function(_0x46da19){if(_0x46da19){_0x114d96=_['keyBy'](_0x46da19,'id');var _0x4c0333;var _0x715be7=squel[_0xeeb5('0x72')]();_0x715be7[_0xeeb5('0x73')](_0x65d25e[_0xeeb5('0x82')]);for(var _0x3783ed=0x0;_0x3783ed<_0x108fb2[_0xeeb5('0x48')];_0x3783ed+=0x1){_0x4c0333=_0x108fb2[_0x3783ed]['MetricId']?_0x114d96[_0x108fb2[_0x3783ed][_0xeeb5('0x74')]][_0xeeb5('0x75')]:_0x108fb2[_0x3783ed][_0xeeb5('0x6c')];_0x4c0333=_0x108fb2[_0x3783ed][_0xeeb5('0x76')]?_[_0xeeb5('0x77')](_0x1e93c7[_0x108fb2[_0x3783ed][_0xeeb5('0x76')]],'%s',_0x4c0333):_0x4c0333;_0x4c0333=_0x108fb2[_0x3783ed]['format']?_[_0xeeb5('0x77')](_0x19eea7[_0x108fb2[_0x3783ed][_0xeeb5('0x78')]],'%s',_0x4c0333):_0x4c0333;if(_0x108fb2[_0x3783ed][_0xeeb5('0x79')]){_0x715be7[_0xeeb5('0x6b')](_0x4c0333);}_0x108fb2[_0x3783ed][_0xeeb5('0x7a')]&&_0x715be7[_0xeeb5('0x38')](_0x4c0333,_0x108fb2[_0x3783ed][_0xeeb5('0x7a')]===_0xeeb5('0x7b')?![]:!![]);_0x715be7[_0xeeb5('0x6c')](_0x4c0333,_0x108fb2[_0x3783ed][_0xeeb5('0x7c')]||_0x4c0333);}if(_0x65d25e[_0xeeb5('0x7d')]){_0x65d25e['joins']=JSON[_0xeeb5('0x7e')](_0x65d25e[_0xeeb5('0x7d')]);for(var _0x1dee23=0x0;_0x1dee23<_0x65d25e[_0xeeb5('0x7d')][_0xeeb5('0x48')];_0x1dee23+=0x1){if(_0x65d25e[_0xeeb5('0x7d')][_0x1dee23]['type']&&_[_0xeeb5('0x65')](_0x2351d6,_0x65d25e[_0xeeb5('0x7d')][_0x1dee23][_0xeeb5('0x3e')])&&_0x65d25e[_0xeeb5('0x7d')][_0x1dee23]['parentKey']&&_0x65d25e['joins'][_0x1dee23][_0xeeb5('0x83')]&&_0x65d25e[_0xeeb5('0x7d')][_0x1dee23][_0xeeb5('0x80')]){_0x715be7[_0x65d25e['joins'][_0x1dee23][_0xeeb5('0x3e')]](_0x65d25e[_0xeeb5('0x7d')][_0x1dee23]['foreignTable'],null,util[_0xeeb5('0x78')]('%s.%s\x20=\x20%s.%s',_0x65d25e[_0xeeb5('0x82')],_0x65d25e[_0xeeb5('0x7d')][_0x1dee23]['parentKey'],_0x65d25e[_0xeeb5('0x7d')][_0x1dee23][_0xeeb5('0x83')],_0x65d25e[_0xeeb5('0x7d')][_0x1dee23][_0xeeb5('0x80')]));}}}if(_0x65d25e[_0xeeb5('0x84')]){_0x65d25e[_0xeeb5('0x84')]=JSON[_0xeeb5('0x7e')](_0x65d25e[_0xeeb5('0x84')]);_0x715be7['where'](_0x279fc8(_0x65d25e[_0xeeb5('0x84')][_0xeeb5('0x6b')]));}_0x2e6f5a=_0x715be7[_0xeeb5('0x85')]();_0x715be7[_0xeeb5('0x1c')](_0x1dad46);_0x715be7[_0xeeb5('0x1a')](0x0);logger[_0xeeb5('0xa2')]('Limited\x20Query:',_0x715be7[_0xeeb5('0x86')]());return dbH[_0xeeb5('0x87')]['query'](_0x715be7['toString'](),{'type':dbH[_0xeeb5('0x87')][_0xeeb5('0x9f')][_0xeeb5('0x88')]});}})[_0xeeb5('0x23')](function(){return{'sql':_0x2e6f5a[_0xeeb5('0x86')]()};})[_0xeeb5('0x23')](respondWithResult(_0x324aeb,null))[_0xeeb5('0x45')](handleError(_0x324aeb,null));}; \ No newline at end of file +var _0x832e=['groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','condition','getFields','ValidationErrorItem','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','destroy','get','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','AnalyticCustomReport','findAll','show','options','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','right_join','cross_join','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','rules','operator','group','field','value','params','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format'];(function(_0x47271b,_0x2fd7d7){var _0x24aa67=function(_0x5a7376){while(--_0x5a7376){_0x47271b['push'](_0x47271b['shift']());}};_0x24aa67(++_0x2fd7d7);}(_0x832e,0x17b));var _0xe832=function(_0x1c5572,_0x2b93aa){_0x1c5572=_0x1c5572-0x0;var _0x341a36=_0x832e[_0x1c5572];return _0x341a36;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe832('0x0'));var jsonpatch=require(_0xe832('0x1'));var rp=require(_0xe832('0x2'));var moment=require(_0xe832('0x3'));var BPromise=require(_0xe832('0x4'));var Mustache=require(_0xe832('0x5'));var util=require(_0xe832('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe832('0x7'));var ejs=require(_0xe832('0x8'));var fs=require('fs');var fs_extra=require(_0xe832('0x9'));var _=require(_0xe832('0xa'));var squel=require(_0xe832('0xb'));var crypto=require(_0xe832('0xc'));var jsforce=require(_0xe832('0xd'));var deskjs=require(_0xe832('0xe'));var toCsv=require(_0xe832('0x7'));var querystring=require('querystring');var Papa=require(_0xe832('0xf'));var Redis=require('ioredis');var authService=require(_0xe832('0x10'));var qs=require(_0xe832('0x11'));var as=require(_0xe832('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe832('0x13'))(_0xe832('0x14'));var utils=require(_0xe832('0x15'));var config=require(_0xe832('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe832('0x17'))['db'];var dbH=require(_0xe832('0x17'))['dbH'];function respondWithStatusCode(_0x4669b4,_0x3c46d3){_0x3c46d3=_0x3c46d3||0xcc;return function(_0x4c857b){if(_0x4c857b){return _0x4669b4[_0xe832('0x18')](_0x3c46d3);}return _0x4669b4[_0xe832('0x19')](_0x3c46d3)[_0xe832('0x1a')]();};}function respondWithResult(_0x124d4c,_0x312999){_0x312999=_0x312999||0xc8;return function(_0x3d8782){if(_0x3d8782){return _0x124d4c[_0xe832('0x19')](_0x312999)[_0xe832('0x1b')](_0x3d8782);}};}function respondWithFilteredResult(_0x4e3995,_0x3d8382){return function(_0xd70f2e){if(_0xd70f2e){var _0x918070=typeof _0x3d8382['offset']===_0xe832('0x1c')&&typeof _0x3d8382[_0xe832('0x1d')]===_0xe832('0x1c');var _0x382e95=_0xd70f2e['count'];var _0x346cbb=_0x918070?0x0:_0x3d8382[_0xe832('0x1e')];var _0x4d1603=_0x918070?_0xd70f2e[_0xe832('0x1f')]:_0x3d8382['offset']+_0x3d8382[_0xe832('0x1d')];var _0x45e24a;if(_0x4d1603>=_0x382e95){_0x4d1603=_0x382e95;_0x45e24a=0xc8;}else{_0x45e24a=0xce;}_0x4e3995[_0xe832('0x19')](_0x45e24a);return _0x4e3995[_0xe832('0x20')](_0xe832('0x21'),_0x346cbb+'-'+_0x4d1603+'/'+_0x382e95)['json'](_0xd70f2e);}return null;};}function patchUpdates(_0x3646b2){return function(_0x4753e3){try{jsonpatch[_0xe832('0x22')](_0x4753e3,_0x3646b2,!![]);}catch(_0x2e668c){return BPromise['reject'](_0x2e668c);}return _0x4753e3['save']();};}function saveUpdates(_0x57446a,_0xc4c62f){return function(_0x349553){if(_0x349553){return _0x349553[_0xe832('0x23')](_0x57446a)[_0xe832('0x24')](function(_0x596d30){return _0x596d30;});}return null;};}function removeEntity(_0x55c81f,_0x281a96){return function(_0x53984c){if(_0x53984c){return _0x53984c[_0xe832('0x25')]()[_0xe832('0x24')](function(){var _0x329ffd=_0x53984c[_0xe832('0x26')]({'plain':!![]});var _0x13420a='CustomReports';return db['UserProfileResource'][_0xe832('0x25')]({'where':{'type':_0x13420a,'resourceId':_0x329ffd['id']}})[_0xe832('0x24')](function(){return _0x53984c;});})[_0xe832('0x24')](function(){_0x55c81f[_0xe832('0x19')](0xcc)[_0xe832('0x1a')]();});}};}function handleEntityNotFound(_0x53d622,_0x5b3cab){return function(_0x55c508){if(!_0x55c508){_0x53d622[_0xe832('0x18')](0x194);}return _0x55c508;};}function handleError(_0x2c2737,_0x54497e){_0x54497e=_0x54497e||0x1f4;return function(_0x54a243){logger['error'](_0x54a243[_0xe832('0x27')]);if(_0x54a243['name']){delete _0x54a243[_0xe832('0x28')];}_0x2c2737['status'](_0x54497e)[_0xe832('0x29')](_0x54a243);};}exports[_0xe832('0x2a')]=function(_0x5391fc,_0x35d0d3){var _0x334433={},_0x583158={},_0x335d44={'count':0x0,'rows':[]};var _0x1c4c5e=_['map'](db['AnalyticCustomReport'][_0xe832('0x2b')],function(_0x4c162c){return{'name':_0x4c162c[_0xe832('0x2c')],'type':_0x4c162c[_0xe832('0x2d')][_0xe832('0x2e')]};});_0x583158['model']=_[_0xe832('0x2f')](_0x1c4c5e,_0xe832('0x28'));_0x583158[_0xe832('0x30')]=_[_0xe832('0x31')](_0x5391fc[_0xe832('0x30')]);_0x583158[_0xe832('0x32')]=_[_0xe832('0x33')](_0x583158[_0xe832('0x34')],_0x583158[_0xe832('0x30')]);_0x334433['attributes']=_[_0xe832('0x33')](_0x583158['model'],qs['fields'](_0x5391fc[_0xe832('0x30')][_0xe832('0x35')]));_0x334433[_0xe832('0x36')]=_0x334433[_0xe832('0x36')][_0xe832('0x37')]?_0x334433[_0xe832('0x36')]:_0x583158[_0xe832('0x34')];if(!_0x5391fc[_0xe832('0x30')]['hasOwnProperty'](_0xe832('0x38'))){_0x334433['limit']=qs['limit'](_0x5391fc['query'][_0xe832('0x1d')]);_0x334433[_0xe832('0x1e')]=qs['offset'](_0x5391fc[_0xe832('0x30')][_0xe832('0x1e')]);}_0x334433['order']=qs[_0xe832('0x39')](_0x5391fc[_0xe832('0x30')]['sort']);_0x334433[_0xe832('0x3a')]=qs['filters'](_[_0xe832('0x3b')](_0x5391fc[_0xe832('0x30')],_0x583158[_0xe832('0x32')]),_0x1c4c5e);if(_0x5391fc[_0xe832('0x30')]['filter']){_0x334433[_0xe832('0x3a')]=_[_0xe832('0x3c')](_0x334433[_0xe832('0x3a')],{'$or':_[_0xe832('0x2f')](_0x1c4c5e,function(_0x1dbaf8){if(_0x1dbaf8[_0xe832('0x2d')]!==_0xe832('0x3d')){var _0x4d8d03={};_0x4d8d03[_0x1dbaf8['name']]={'$like':'%'+_0x5391fc[_0xe832('0x30')][_0xe832('0x3e')]+'%'};return _0x4d8d03;}})});}_0x334433=_[_0xe832('0x3c')]({},_0x334433,_0x5391fc['options']);var _0x24f385={'where':_0x334433[_0xe832('0x3a')]};return db['AnalyticCustomReport'][_0xe832('0x1f')](_0x24f385)[_0xe832('0x24')](function(_0x233258){_0x335d44[_0xe832('0x1f')]=_0x233258;if(_0x5391fc[_0xe832('0x30')][_0xe832('0x3f')]){_0x334433[_0xe832('0x40')]=[{'all':!![]}];}return db[_0xe832('0x41')][_0xe832('0x42')](_0x334433);})[_0xe832('0x24')](function(_0x3a3671){_0x335d44['rows']=_0x3a3671;return _0x335d44;})['then'](respondWithFilteredResult(_0x35d0d3,_0x334433))['catch'](handleError(_0x35d0d3,null));};exports[_0xe832('0x43')]=function(_0x198afa,_0x580895){var _0x2f60da={'raw':![],'where':{'id':_0x198afa['params']['id']}},_0x33f68f={};_0x33f68f['model']=_['keys'](db[_0xe832('0x41')][_0xe832('0x2b')]);_0x33f68f[_0xe832('0x30')]=_[_0xe832('0x31')](_0x198afa[_0xe832('0x30')]);_0x33f68f[_0xe832('0x32')]=_[_0xe832('0x33')](_0x33f68f[_0xe832('0x34')],_0x33f68f[_0xe832('0x30')]);_0x2f60da[_0xe832('0x36')]=_[_0xe832('0x33')](_0x33f68f[_0xe832('0x34')],qs[_0xe832('0x35')](_0x198afa[_0xe832('0x30')]['fields']));_0x2f60da[_0xe832('0x36')]=_0x2f60da[_0xe832('0x36')][_0xe832('0x37')]?_0x2f60da['attributes']:_0x33f68f[_0xe832('0x34')];if(_0x198afa['query'][_0xe832('0x3f')]){_0x2f60da[_0xe832('0x40')]=[{'all':!![]}];}_0x2f60da=_[_0xe832('0x3c')]({},_0x2f60da,_0x198afa[_0xe832('0x44')]);return db[_0xe832('0x41')][_0xe832('0x45')](_0x2f60da)[_0xe832('0x24')](handleEntityNotFound(_0x580895,null))[_0xe832('0x24')](respondWithResult(_0x580895,null))[_0xe832('0x46')](handleError(_0x580895,null));};exports['create']=function(_0xfdcdbe,_0x18a560){return db[_0xe832('0x41')][_0xe832('0x47')](_0xfdcdbe['body'],{})[_0xe832('0x24')](function(_0x4110c4){var _0x2a62b4=_0xfdcdbe['user']['get']({'plain':!![]});if(!_0x2a62b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a62b4['role']===_0xe832('0x48')){var _0x518de1=_0x4110c4[_0xe832('0x26')]({'plain':!![]});var _0xd67ff9='Reports';return db[_0xe832('0x49')][_0xe832('0x45')]({'where':{'name':_0xd67ff9,'userProfileId':_0x2a62b4[_0xe832('0x4a')]},'raw':!![]})['then'](function(_0x208622){if(_0x208622&&_0x208622[_0xe832('0x4b')]===0x0){return db[_0xe832('0x4c')][_0xe832('0x47')]({'name':_0x518de1[_0xe832('0x28')],'resourceId':_0x518de1['id'],'type':_0xe832('0x4d'),'sectionId':_0x208622['id']},{})['then'](function(){return _0x4110c4;});}else{return _0x4110c4;}})['catch'](function(_0x5ad382){logger[_0xe832('0x4e')](_0xe832('0x4f'),_0x5ad382);throw _0x5ad382;});}return _0x4110c4;})[_0xe832('0x24')](respondWithResult(_0x18a560,0xc9))[_0xe832('0x46')](handleError(_0x18a560,null));};exports[_0xe832('0x23')]=function(_0x37ae6e,_0x4b35b9){if(_0x37ae6e[_0xe832('0x50')]['id']){delete _0x37ae6e[_0xe832('0x50')]['id'];}return db[_0xe832('0x41')][_0xe832('0x45')]({'where':{'id':_0x37ae6e['params']['id']}})[_0xe832('0x24')](handleEntityNotFound(_0x4b35b9,null))[_0xe832('0x24')](saveUpdates(_0x37ae6e[_0xe832('0x50')],null))[_0xe832('0x24')](respondWithResult(_0x4b35b9,null))['catch'](handleError(_0x4b35b9,null));};exports[_0xe832('0x25')]=function(_0x394efe,_0xfd9c8e){return db[_0xe832('0x41')][_0xe832('0x45')]({'where':{'id':_0x394efe['params']['id']}})[_0xe832('0x24')](handleEntityNotFound(_0xfd9c8e,null))[_0xe832('0x24')](removeEntity(_0xfd9c8e,null))['catch'](handleError(_0xfd9c8e,null));};exports['preview']=function(_0x4b9aa8,_0x312ba1){var _0x3bbef8=0xa;var _0x42ce59=[_0xe832('0x51'),'left_join',_0xe832('0x52'),_0xe832('0x53')];var _0x107413={'SUM':_0xe832('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xe832('0x55'),'GROUP_CONCAT':_0xe832('0x56'),'GROUP_CONCAT ASC':_0xe832('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x419508={'SEC_TO_TIME':_0xe832('0x58'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe832('0x59')};var _0x50731c=function(_0x41e1c1){return!_[_0xe832('0x5a')]([_0xe832('0x5b'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x41e1c1);};var _0x161e32=function(_0x162073){if(!_0x162073||!_0x162073[_0xe832('0x5c')]['length']){return'';}for(var _0x280c84='(',_0x544384=0x0;_0x544384<_0x162073[_0xe832('0x5c')][_0xe832('0x37')];_0x544384+=0x1){_0x544384>0x0&&(_0x280c84+='\x20'+_0x162073[_0xe832('0x5d')]+'\x20');_0x280c84+=_0x162073['rules'][_0x544384]['group']?_0x161e32(_0x162073[_0xe832('0x5c')][_0x544384][_0xe832('0x5e')]):_0x162073[_0xe832('0x5c')][_0x544384][_0xe832('0x5f')]+'\x20'+_0x162073[_0xe832('0x5c')][_0x544384]['condition']+(_0x50731c(_0x162073[_0xe832('0x5c')][_0x544384]['condition'])?'\x20'+_0x162073['rules'][_0x544384][_0xe832('0x60')]:'');}return _0x280c84+')';};var _0x4a01b5={'where':{'id':_0x4b9aa8[_0xe832('0x61')]['id']}},_0x38286e,_0x1be49d,_0x3c583e,_0x3cef74,_0x2d575e;_0x4a01b5=_['merge']({},_0x4a01b5,_0x4b9aa8[_0xe832('0x44')]);return db[_0xe832('0x41')][_0xe832('0x45')](_0x4a01b5)[_0xe832('0x24')](function(_0x59910e){if(_0x59910e){_0x38286e=_0x59910e;return _0x59910e['getFields']();}return null;})[_0xe832('0x24')](function(_0xa8c198){if(_0xa8c198){if(!_0xa8c198[_0xe832('0x37')]){throw new db[(_0xe832('0x62'))]['ValidationErrorItem'](_0xe832('0x63'),0x193);}_0x1be49d=_0xa8c198;return db[_0xe832('0x64')][_0xe832('0x42')]({'raw':!![]});}return null;})[_0xe832('0x24')](function(_0x304884){if(_0x304884){_0x3c583e=_[_0xe832('0x65')](_0x304884,'id');var _0x4f58b9;var _0x2778d7=squel[_0xe832('0x66')]();_0x2778d7[_0xe832('0x67')](_0x38286e[_0xe832('0x68')]);for(var _0x2ba799=0x0;_0x2ba799<_0x1be49d[_0xe832('0x37')];_0x2ba799+=0x1){_0x4f58b9=_0x1be49d[_0x2ba799][_0xe832('0x69')]?_0x3c583e[_0x1be49d[_0x2ba799][_0xe832('0x69')]][_0xe832('0x6a')]:_0x1be49d[_0x2ba799][_0xe832('0x5f')];_0x4f58b9=_0x1be49d[_0x2ba799][_0xe832('0x6b')]?_[_0xe832('0x6c')](_0x107413[_0x1be49d[_0x2ba799][_0xe832('0x6b')]],'%s',_0x4f58b9):_0x4f58b9;_0x4f58b9=_0x1be49d[_0x2ba799][_0xe832('0x6d')]?_[_0xe832('0x6c')](_0x419508[_0x1be49d[_0x2ba799][_0xe832('0x6d')]],'%s',_0x4f58b9):_0x4f58b9;if(_0x1be49d[_0x2ba799][_0xe832('0x6e')]){_0x2778d7[_0xe832('0x5e')](_0x4f58b9);}_0x1be49d[_0x2ba799][_0xe832('0x6f')]&&_0x2778d7[_0xe832('0x70')](_0x4f58b9,_0x1be49d[_0x2ba799][_0xe832('0x6f')]===_0xe832('0x71')?![]:!![]);_0x2778d7[_0xe832('0x5f')](_0x4f58b9,_0x1be49d[_0x2ba799][_0xe832('0x72')]||_0x4f58b9);}if(_0x38286e[_0xe832('0x73')]){_0x38286e['joins']=JSON[_0xe832('0x74')](_0x38286e['joins']);for(var _0x41e5f8=0x0;_0x41e5f8<_0x38286e[_0xe832('0x73')][_0xe832('0x37')];_0x41e5f8+=0x1){if(_0x38286e[_0xe832('0x73')][_0x41e5f8]['type']&&_[_0xe832('0x5a')](_0x42ce59,_0x38286e[_0xe832('0x73')][_0x41e5f8][_0xe832('0x2d')])&&_0x38286e[_0xe832('0x73')][_0x41e5f8]['parentKey']&&_0x38286e[_0xe832('0x73')][_0x41e5f8][_0xe832('0x75')]&&_0x38286e[_0xe832('0x73')][_0x41e5f8][_0xe832('0x76')]){_0x2778d7[_0x38286e[_0xe832('0x73')][_0x41e5f8][_0xe832('0x2d')]](_0x38286e[_0xe832('0x73')][_0x41e5f8]['foreignTable'],null,util['format'](_0xe832('0x77'),_0x38286e[_0xe832('0x68')],_0x38286e['joins'][_0x41e5f8][_0xe832('0x78')],_0x38286e[_0xe832('0x73')][_0x41e5f8]['foreignTable'],_0x38286e[_0xe832('0x73')][_0x41e5f8][_0xe832('0x76')]));}}}if(_0x38286e[_0xe832('0x79')]){_0x38286e[_0xe832('0x79')]=JSON[_0xe832('0x74')](_0x38286e['conditions']);_0x2778d7[_0xe832('0x3a')](_0x161e32(_0x38286e[_0xe832('0x79')][_0xe832('0x5e')]));}_0x2d575e=_0x2778d7[_0xe832('0x7a')]();_0x2778d7[_0xe832('0x1d')](_0x3bbef8);_0x2778d7['offset'](0x0);logger[_0xe832('0x7b')](_0xe832('0x7c'),_0x2778d7[_0xe832('0x7d')]());return dbH['sequelize'][_0xe832('0x30')](_0x2778d7['toString'](),{'type':dbH[_0xe832('0x7e')][_0xe832('0x7f')][_0xe832('0x80')]});}})[_0xe832('0x24')](respondWithResult(_0x312ba1,null))[_0xe832('0x46')](handleError(_0x312ba1,null));};function runReport(_0x29c6f8,_0x23d367,_0x455fe){var _0x5ca54f=_0x23d367[_0xe832('0x28')];var _0x2cd87f=0xa;var _0x199db9=['join',_0xe832('0x81'),_0xe832('0x52'),'cross_join'];var _0x329303={'SUM':_0xe832('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe832('0x82'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xe832('0x55'),'GROUP_CONCAT':_0xe832('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4273d2={'SEC_TO_TIME':_0xe832('0x58'),'DATE':'DATE(%s)','HOUR':_0xe832('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe832('0x59')};var _0x1a0807=function(_0xb4168c){return!_['includes']([_0xe832('0x5b'),_0xe832('0x84'),_0xe832('0x85'),_0xe832('0x86')],_0xb4168c);};var _0x496cd3=function(_0x8775ca){if(!_0x8775ca||!_0x8775ca[_0xe832('0x5c')][_0xe832('0x37')]){return'';}for(var _0x10f9a1='(',_0x5bff87=0x0;_0x5bff87<_0x8775ca[_0xe832('0x5c')][_0xe832('0x37')];_0x5bff87+=0x1){_0x5bff87>0x0&&(_0x10f9a1+='\x20'+_0x8775ca[_0xe832('0x5d')]+'\x20');_0x10f9a1+=_0x8775ca[_0xe832('0x5c')][_0x5bff87][_0xe832('0x5e')]?_0x496cd3(_0x8775ca[_0xe832('0x5c')][_0x5bff87][_0xe832('0x5e')]):_0x8775ca[_0xe832('0x5c')][_0x5bff87][_0xe832('0x5f')]+'\x20'+_0x8775ca[_0xe832('0x5c')][_0x5bff87][_0xe832('0x87')]+(_0x1a0807(_0x8775ca[_0xe832('0x5c')][_0x5bff87][_0xe832('0x87')])?'\x20'+_0x8775ca[_0xe832('0x5c')][_0x5bff87][_0xe832('0x60')]:'');}return _0x10f9a1+')';};var _0x39e271={'where':{'id':_0x29c6f8['id']}},_0x1b46a2,_0xe23634,_0xa802a1,_0x4659be,_0x514c83;_0x39e271=_[_0xe832('0x3c')]({},_0x39e271,_0x455fe);return db[_0xe832('0x41')][_0xe832('0x45')](_0x39e271)[_0xe832('0x24')](function(_0x1b92e8){if(_0x1b92e8){_0x1b46a2=_0x1b92e8;return _0x1b92e8[_0xe832('0x88')]();}return null;})['then'](function(_0x2e1914){if(_0x2e1914){if(!_0x2e1914['length']){throw new db[(_0xe832('0x62'))][(_0xe832('0x89'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe23634=_0x2e1914;return db[_0xe832('0x64')][_0xe832('0x42')]({'raw':!![]});}return null;})[_0xe832('0x24')](function(_0x2c8723){if(_0x2c8723){_0xa802a1=_[_0xe832('0x65')](_0x2c8723,'id');var _0x5a421d;var _0x5918d9=squel['select']();_0x5918d9[_0xe832('0x67')](_0x1b46a2[_0xe832('0x68')]);for(var _0x5dd1fd=0x0;_0x5dd1fd<_0xe23634['length'];_0x5dd1fd+=0x1){_0x5a421d=_0xe23634[_0x5dd1fd][_0xe832('0x69')]?_0xa802a1[_0xe23634[_0x5dd1fd][_0xe832('0x69')]][_0xe832('0x6a')]:_0xe23634[_0x5dd1fd][_0xe832('0x5f')];_0x5a421d=_0xe23634[_0x5dd1fd][_0xe832('0x6b')]?_[_0xe832('0x6c')](_0x329303[_0xe23634[_0x5dd1fd]['function']],'%s',_0x5a421d):_0x5a421d;_0x5a421d=_0xe23634[_0x5dd1fd][_0xe832('0x6d')]?_['replace'](_0x4273d2[_0xe23634[_0x5dd1fd][_0xe832('0x6d')]],'%s',_0x5a421d):_0x5a421d;if(_0xe23634[_0x5dd1fd][_0xe832('0x6e')]){_0x5918d9[_0xe832('0x5e')](_0x5a421d);}_0xe23634[_0x5dd1fd][_0xe832('0x6f')]&&_0x5918d9[_0xe832('0x70')](_0x5a421d,_0xe23634[_0x5dd1fd][_0xe832('0x6f')]==='DESC'?![]:!![]);_0x5918d9[_0xe832('0x5f')](_0x5a421d,_0xe23634[_0x5dd1fd]['alias']||_0x5a421d);}if(_0x1b46a2[_0xe832('0x73')]){_0x1b46a2['joins']=JSON[_0xe832('0x74')](_0x1b46a2[_0xe832('0x73')]);for(var _0x174e9c=0x0;_0x174e9c<_0x1b46a2['joins'][_0xe832('0x37')];_0x174e9c+=0x1){if(_0x1b46a2[_0xe832('0x73')][_0x174e9c][_0xe832('0x2d')]&&_[_0xe832('0x5a')](_0x199db9,_0x1b46a2[_0xe832('0x73')][_0x174e9c][_0xe832('0x2d')])&&_0x1b46a2[_0xe832('0x73')][_0x174e9c][_0xe832('0x78')]&&_0x1b46a2[_0xe832('0x73')][_0x174e9c][_0xe832('0x75')]&&_0x1b46a2[_0xe832('0x73')][_0x174e9c][_0xe832('0x76')]){_0x5918d9[_0x1b46a2[_0xe832('0x73')][_0x174e9c][_0xe832('0x2d')]](_0x1b46a2['joins'][_0x174e9c][_0xe832('0x75')],null,util[_0xe832('0x6d')](_0xe832('0x77'),_0x1b46a2['table'],_0x1b46a2['joins'][_0x174e9c][_0xe832('0x78')],_0x1b46a2[_0xe832('0x73')][_0x174e9c][_0xe832('0x75')],_0x1b46a2[_0xe832('0x73')][_0x174e9c][_0xe832('0x76')]));}}}if(_0x1b46a2[_0xe832('0x79')]){_0x1b46a2[_0xe832('0x79')]=JSON['parse'](_0x1b46a2[_0xe832('0x79')]);_0x5918d9[_0xe832('0x3a')](_0x496cd3(_0x1b46a2['conditions'][_0xe832('0x5e')]));}_0x514c83=_0x5918d9[_0xe832('0x7a')]();_0x5918d9[_0xe832('0x1d')](_0x2cd87f);_0x5918d9[_0xe832('0x1e')](0x0);return;}})[_0xe832('0x24')](function(){if(_0x23d367[_0xe832('0x8a')]===_0xe832('0x8b')){return null;}var _0x1fa98a=_[_0xe832('0x3c')](_0x23d367,{'name':_0x23d367['fullPath']||_0x23d367[_0xe832('0x28')]||_0x1b46a2['name'],'basename':_0x5ca54f,'savename':util[_0xe832('0x6d')](_0xe832('0x8c'),_0x23d367[_0xe832('0x28')]||_0x1b46a2[_0xe832('0x28')],require(_0xe832('0x8d'))[_0xe832('0x8e')](0x4),_0x23d367[_0xe832('0x8a')]||_0xe832('0x8f')),'reportId':_0x1b46a2['id'],'reportType':_0xe832('0x90')});return db[_0xe832('0x91')][_0xe832('0x47')](_0x1fa98a,{'raw':!![]});})[_0xe832('0x24')](function(_0x2c0e43){if(_0x1b46a2['table']==='cdr'){_0x514c83[_0xe832('0x3a')](_0x1b46a2[_0xe832('0x68')]+_0xe832('0x92'),_0x23d367[_0xe832('0x93')],_0x23d367[_0xe832('0x94')]);}else{_0x514c83[_0xe832('0x3a')](_0x1b46a2['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x23d367[_0xe832('0x93')],_0x23d367['endDate']);}if(_0x2c0e43){logger[_0xe832('0x95')]('Run\x20Query:',_0x514c83[_0xe832('0x7d')]());require(_0xe832('0x96'))['fork'](path[_0xe832('0x51')](__dirname,_0xe832('0x97'),_0x2c0e43[_0xe832('0x8a')]),[_0x2c0e43['id'],_0x514c83[_0xe832('0x7d')](),path['join'](__dirname,_0xe832('0x98'),_0x2c0e43[_0xe832('0x99')]),_0x5ca54f]);return _0x2c0e43;}else{var _0x1632e5=squel[_0xe832('0x66')]();_0x1632e5[_0xe832('0x67')]('('+_0x514c83[_0xe832('0x7d')]()+')',_0xe832('0x9a'));_0x1632e5[_0xe832('0x5f')](_0xe832('0x9b'),_0xe832('0x1f'));_0x514c83[_0xe832('0x1d')](_0x23d367[_0xe832('0x1d')]||_0x2cd87f);_0x514c83[_0xe832('0x1e')](_0x23d367[_0xe832('0x1e')]||0x0);return dbH[_0xe832('0x7e')][_0xe832('0x30')](_0x1632e5[_0xe832('0x7d')](),{'type':dbH[_0xe832('0x7e')][_0xe832('0x7f')][_0xe832('0x80')]})[_0xe832('0x24')](function(_0x161cce){if(!_0x161cce[_0xe832('0x37')]){_0x4659be=0x0;}else{_0x4659be=_0x161cce[0x0][_0xe832('0x1f')]||0x0;}return dbH[_0xe832('0x7e')]['query'](_0x514c83[_0xe832('0x7d')](),{'type':dbH[_0xe832('0x7e')][_0xe832('0x7f')][_0xe832('0x80')]});})[_0xe832('0x24')](function(_0x47dbc4){return{'rows':_0x47dbc4||[],'count':_0x4659be};});}});}exports['run']=function(_0xdab5b1,_0x2338b2){return runReport(_0xdab5b1[_0xe832('0x61')],_0xdab5b1[_0xe832('0x30')],_0xdab5b1['options'])[_0xe832('0x24')](respondWithResult(_0x2338b2,null))['catch'](handleError(_0x2338b2,null));};exports[_0xe832('0x9c')]=runReport;exports[_0xe832('0x30')]=function(_0x4e0433,_0xc6271e){var _0x22269c=0xa;var _0x4e2a31=[_0xe832('0x51'),'left_join',_0xe832('0x52'),_0xe832('0x53')];var _0x401bcb={'SUM':_0xe832('0x54'),'COUNT':_0xe832('0x9d'),'COUNT DISTINCT':_0xe832('0x82'),'MAX':_0xe832('0x9e'),'MIN':_0xe832('0x9f'),'AVG':_0xe832('0x55'),'GROUP_CONCAT':_0xe832('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe832('0xa0')};var _0x400f07={'SEC_TO_TIME':_0xe832('0x58'),'DATE':_0xe832('0xa1'),'HOUR':_0xe832('0x83'),'ROUND':_0xe832('0xa2'),'UNIX_TIMESTAMP':_0xe832('0x59')};var _0x1e915e=function(_0x340de8){return!_[_0xe832('0x5a')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xe832('0x85'),_0xe832('0x86')],_0x340de8);};var _0x5644fd=function(_0x4c4504){if(!_0x4c4504||!_0x4c4504[_0xe832('0x5c')]['length']){return'';}for(var _0x2cf794='(',_0x59e67b=0x0;_0x59e67b<_0x4c4504[_0xe832('0x5c')][_0xe832('0x37')];_0x59e67b+=0x1){_0x59e67b>0x0&&(_0x2cf794+='\x20'+_0x4c4504[_0xe832('0x5d')]+'\x20');_0x2cf794+=_0x4c4504[_0xe832('0x5c')][_0x59e67b]['group']?_0x5644fd(_0x4c4504[_0xe832('0x5c')][_0x59e67b][_0xe832('0x5e')]):_0x4c4504['rules'][_0x59e67b][_0xe832('0x5f')]+'\x20'+_0x4c4504[_0xe832('0x5c')][_0x59e67b][_0xe832('0x87')]+(_0x1e915e(_0x4c4504[_0xe832('0x5c')][_0x59e67b]['condition'])?'\x20'+_0x4c4504[_0xe832('0x5c')][_0x59e67b][_0xe832('0x60')]:'');}return _0x2cf794+')';};var _0x438dd8={'where':{'id':_0x4e0433['params']['id']}},_0x5b6347,_0x41875e,_0x14df33,_0x51287a,_0x56b39b;_0x438dd8=_[_0xe832('0x3c')]({},_0x438dd8,_0x4e0433['options']);return db[_0xe832('0x41')]['find'](_0x438dd8)['then'](function(_0xa73ac1){if(_0xa73ac1){_0x5b6347=_0xa73ac1;return _0xa73ac1['getFields']();}return null;})['then'](function(_0x1cfcd5){if(_0x1cfcd5){if(!_0x1cfcd5[_0xe832('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe832('0x63'),0x193);}_0x41875e=_0x1cfcd5;return db['AnalyticMetric'][_0xe832('0x42')]({'raw':!![]});}return null;})[_0xe832('0x24')](function(_0x213ba7){if(_0x213ba7){_0x14df33=_[_0xe832('0x65')](_0x213ba7,'id');var _0x1384c4;var _0xed10e6=squel[_0xe832('0x66')]();_0xed10e6['from'](_0x5b6347[_0xe832('0x68')]);for(var _0xe2b2df=0x0;_0xe2b2df<_0x41875e[_0xe832('0x37')];_0xe2b2df+=0x1){_0x1384c4=_0x41875e[_0xe2b2df][_0xe832('0x69')]?_0x14df33[_0x41875e[_0xe2b2df][_0xe832('0x69')]][_0xe832('0x6a')]:_0x41875e[_0xe2b2df][_0xe832('0x5f')];_0x1384c4=_0x41875e[_0xe2b2df][_0xe832('0x6b')]?_['replace'](_0x401bcb[_0x41875e[_0xe2b2df][_0xe832('0x6b')]],'%s',_0x1384c4):_0x1384c4;_0x1384c4=_0x41875e[_0xe2b2df][_0xe832('0x6d')]?_[_0xe832('0x6c')](_0x400f07[_0x41875e[_0xe2b2df]['format']],'%s',_0x1384c4):_0x1384c4;if(_0x41875e[_0xe2b2df][_0xe832('0x6e')]){_0xed10e6['group'](_0x1384c4);}_0x41875e[_0xe2b2df][_0xe832('0x6f')]&&_0xed10e6[_0xe832('0x70')](_0x1384c4,_0x41875e[_0xe2b2df][_0xe832('0x6f')]===_0xe832('0x71')?![]:!![]);_0xed10e6['field'](_0x1384c4,_0x41875e[_0xe2b2df]['alias']||_0x1384c4);}if(_0x5b6347[_0xe832('0x73')]){_0x5b6347['joins']=JSON[_0xe832('0x74')](_0x5b6347['joins']);for(var _0x34190a=0x0;_0x34190a<_0x5b6347[_0xe832('0x73')]['length'];_0x34190a+=0x1){if(_0x5b6347[_0xe832('0x73')][_0x34190a][_0xe832('0x2d')]&&_['includes'](_0x4e2a31,_0x5b6347[_0xe832('0x73')][_0x34190a]['type'])&&_0x5b6347[_0xe832('0x73')][_0x34190a][_0xe832('0x78')]&&_0x5b6347[_0xe832('0x73')][_0x34190a]['foreignTable']&&_0x5b6347['joins'][_0x34190a][_0xe832('0x76')]){_0xed10e6[_0x5b6347[_0xe832('0x73')][_0x34190a]['type']](_0x5b6347['joins'][_0x34190a][_0xe832('0x75')],null,util[_0xe832('0x6d')]('%s.%s\x20=\x20%s.%s',_0x5b6347[_0xe832('0x68')],_0x5b6347[_0xe832('0x73')][_0x34190a]['parentKey'],_0x5b6347['joins'][_0x34190a][_0xe832('0x75')],_0x5b6347[_0xe832('0x73')][_0x34190a]['foreignKey']));}}}if(_0x5b6347['conditions']){_0x5b6347[_0xe832('0x79')]=JSON[_0xe832('0x74')](_0x5b6347['conditions']);_0xed10e6['where'](_0x5644fd(_0x5b6347[_0xe832('0x79')][_0xe832('0x5e')]));}_0x56b39b=_0xed10e6[_0xe832('0x7a')]();_0xed10e6[_0xe832('0x1d')](_0x22269c);_0xed10e6[_0xe832('0x1e')](0x0);logger[_0xe832('0x7b')](_0xe832('0x7c'),_0xed10e6[_0xe832('0x7d')]());return dbH['sequelize'][_0xe832('0x30')](_0xed10e6[_0xe832('0x7d')](),{'type':dbH[_0xe832('0x7e')][_0xe832('0x7f')][_0xe832('0x80')]});}})[_0xe832('0x24')](function(){return{'sql':_0x56b39b[_0xe832('0x7d')]()};})['then'](respondWithResult(_0xc6271e,null))[_0xe832('0x46')](handleError(_0xc6271e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 01f838d..46a94fd 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 _0x2089=['api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x2089,0x107));var _0x9208=function(_0x231ef3,_0x75aa1c){_0x231ef3=_0x231ef3-0x0;var _0x3a9965=_0x2089[_0x231ef3];return _0x3a9965;};'use strict';var _=require(_0x9208('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9208('0x1'));var moment=require(_0x9208('0x2'));var BPromise=require(_0x9208('0x3'));var rp=require(_0x9208('0x4'));var fs=require('fs');var path=require(_0x9208('0x5'));var rimraf=require('rimraf');var config=require(_0x9208('0x6'));var attributes=require(_0x9208('0x7'));module[_0x9208('0x8')]=function(_0x4cd1fc,_0x45bc6b){return _0x4cd1fc[_0x9208('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x9208('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0821=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x170a52,_0x2e27d6){var _0x2c03ed=function(_0x32e213){while(--_0x32e213){_0x170a52['push'](_0x170a52['shift']());}};_0x2c03ed(++_0x2e27d6);}(_0x0821,0xa5));var _0x1082=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x0821[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x1082('0x0'));var util=require(_0x1082('0x1'));var logger=require(_0x1082('0x2'))('api');var moment=require(_0x1082('0x3'));var BPromise=require(_0x1082('0x4'));var rp=require(_0x1082('0x5'));var fs=require('fs');var path=require(_0x1082('0x6'));var rimraf=require(_0x1082('0x7'));var config=require(_0x1082('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0x1082('0x9')]=function(_0x1c0d4b,_0xf0839a){return _0x1c0d4b['define'](_0x1082('0xa'),attributes,{'tableName':_0x1082('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 81c0fa2..87b9312 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 _0x48ee=['AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info'];(function(_0xea0cf2,_0x1502d9){var _0x3652df=function(_0x39db2a){while(--_0x39db2a){_0xea0cf2['push'](_0xea0cf2['shift']());}};_0x3652df(++_0x1502d9);}(_0x48ee,0x138));var _0xe48e=function(_0x1ba229,_0x46fef5){_0x1ba229=_0x1ba229-0x0;var _0x44692f=_0x48ee[_0x1ba229];return _0x44692f;};'use strict';var _=require('lodash');var util=require(_0xe48e('0x0'));var moment=require(_0xe48e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe48e('0x2'));var db=require(_0xe48e('0x3'))['db'];var utils=require(_0xe48e('0x4'));var logger=require('../../config/logger')(_0xe48e('0x5'));var config=require('../../config/environment');var jayson=require(_0xe48e('0x6'));var client=jayson[_0xe48e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1ac2,_0x34f626,_0xdd9c26){return new BPromise(function(_0x54cde1,_0x5b7e13){return client[_0xe48e('0x8')](_0x3a1ac2,_0xdd9c26)[_0xe48e('0x9')](function(_0x4bde1f){logger[_0xe48e('0xa')](_0xe48e('0xb'),_0x34f626,'request\x20sent');logger['debug'](_0xe48e('0xc'),_0x34f626,_0xe48e('0xd'),JSON[_0xe48e('0xe')](_0x4bde1f));if(_0x4bde1f['error']){if(_0x4bde1f[_0xe48e('0xf')]['code']===0x1f4){logger[_0xe48e('0xf')](_0xe48e('0xb'),_0x34f626,_0x4bde1f['error'][_0xe48e('0x10')]);return _0x5b7e13(_0x4bde1f[_0xe48e('0xf')][_0xe48e('0x10')]);}logger[_0xe48e('0xf')](_0xe48e('0xb'),_0x34f626,_0x4bde1f[_0xe48e('0xf')][_0xe48e('0x10')]);return _0x54cde1(_0x4bde1f[_0xe48e('0xf')][_0xe48e('0x10')]);}else{logger[_0xe48e('0xa')](_0xe48e('0xb'),_0x34f626,_0xe48e('0xd'));_0x54cde1(_0x4bde1f[_0xe48e('0x11')]['message']);}})[_0xe48e('0x12')](function(_0x2ae9a3){logger['error'](_0xe48e('0xb'),_0x34f626,_0x2ae9a3);_0x5b7e13(_0x2ae9a3);});});} \ No newline at end of file +var _0xdc2a=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x940ce4,_0x1b0503){var _0x4b9212=function(_0x561348){while(--_0x561348){_0x940ce4['push'](_0x940ce4['shift']());}};_0x4b9212(++_0x1b0503);}(_0xdc2a,0x9d));var _0xadc2=function(_0x4fd163,_0x154781){_0x4fd163=_0x4fd163-0x0;var _0x178f7b=_0xdc2a[_0x4fd163];return _0x178f7b;};'use strict';var _=require(_0xadc2('0x0'));var util=require('util');var moment=require(_0xadc2('0x1'));var BPromise=require(_0xadc2('0x2'));var rs=require(_0xadc2('0x3'));var fs=require('fs');var Redis=require(_0xadc2('0x4'));var db=require(_0xadc2('0x5'))['db'];var utils=require(_0xadc2('0x6'));var logger=require(_0xadc2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xadc2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39f9ac,_0x20d73f,_0x5d1030){return new BPromise(function(_0x42f7ce,_0x45a615){return client['request'](_0x39f9ac,_0x5d1030)['then'](function(_0x25f8f2){logger[_0xadc2('0x9')](_0xadc2('0xa'),_0x20d73f,_0xadc2('0xb'));logger['debug'](_0xadc2('0xc'),_0x20d73f,_0xadc2('0xb'),JSON['stringify'](_0x25f8f2));if(_0x25f8f2[_0xadc2('0xd')]){if(_0x25f8f2[_0xadc2('0xd')][_0xadc2('0xe')]===0x1f4){logger[_0xadc2('0xd')](_0xadc2('0xa'),_0x20d73f,_0x25f8f2['error']['message']);return _0x45a615(_0x25f8f2[_0xadc2('0xd')][_0xadc2('0xf')]);}logger[_0xadc2('0xd')](_0xadc2('0xa'),_0x20d73f,_0x25f8f2[_0xadc2('0xd')][_0xadc2('0xf')]);return _0x42f7ce(_0x25f8f2[_0xadc2('0xd')][_0xadc2('0xf')]);}else{logger[_0xadc2('0x9')](_0xadc2('0xa'),_0x20d73f,_0xadc2('0xb'));_0x42f7ce(_0x25f8f2[_0xadc2('0x10')][_0xadc2('0xf')]);}})[_0xadc2('0x11')](function(_0x450f94){logger[_0xadc2('0xd')](_0xadc2('0xa'),_0x20d73f,_0x450f94);_0x45a615(_0x450f94);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8598295..78505c6 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 _0x29c7=['index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','create','put','update','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x29c7,0x84));var _0x729c=function(_0x179f38,_0x4a5eca){_0x179f38=_0x179f38-0x0;var _0x385a77=_0x29c7[_0x179f38];return _0x385a77;};'use strict';var multer=require(_0x729c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x729c('0x1'));var auth=require(_0x729c('0x2'));var interaction=require(_0x729c('0x3'));var config=require(_0x729c('0x4'));var controller=require(_0x729c('0x5'));router[_0x729c('0x6')]('/',auth[_0x729c('0x7')](),controller[_0x729c('0x8')]);router[_0x729c('0x6')](_0x729c('0x9'),auth[_0x729c('0x7')](),controller['show']);router[_0x729c('0x6')](_0x729c('0xa'),auth['isAuthenticated'](),controller[_0x729c('0xb')]);router[_0x729c('0x6')](_0x729c('0xc'),auth[_0x729c('0x7')](),controller[_0x729c('0xd')]);router[_0x729c('0x6')](_0x729c('0xe'),auth[_0x729c('0x7')](),controller['query']);router['post']('/',auth[_0x729c('0x7')](),controller[_0x729c('0xf')]);router[_0x729c('0x10')](_0x729c('0x9'),auth[_0x729c('0x7')](),controller[_0x729c('0x11')]);router['delete']('/:id',auth[_0x729c('0x7')](),controller[_0x729c('0x12')]);module[_0x729c('0x13')]=router; \ No newline at end of file +var _0x4af1=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','index','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','post'];(function(_0x4a563b,_0x36f42d){var _0x2935ef=function(_0x32593f){while(--_0x32593f){_0x4a563b['push'](_0x4a563b['shift']());}};_0x2935ef(++_0x36f42d);}(_0x4af1,0x94));var _0x14af=function(_0x1c00e3,_0x3c24a0){_0x1c00e3=_0x1c00e3-0x0;var _0x27181b=_0x4af1[_0x1c00e3];return _0x27181b;};'use strict';var multer=require(_0x14af('0x0'));var util=require(_0x14af('0x1'));var path=require(_0x14af('0x2'));var timeout=require(_0x14af('0x3'));var express=require(_0x14af('0x4'));var router=express['Router']();var fs_extra=require(_0x14af('0x5'));var auth=require(_0x14af('0x6'));var interaction=require(_0x14af('0x7'));var config=require('../../config/environment');var controller=require(_0x14af('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x14af('0x9')]);router[_0x14af('0xa')](_0x14af('0xb'),auth[_0x14af('0xc')](),controller[_0x14af('0xd')]);router['get'](_0x14af('0xe'),auth[_0x14af('0xc')](),controller[_0x14af('0xf')]);router[_0x14af('0xa')](_0x14af('0x10'),auth[_0x14af('0xc')](),controller['run']);router[_0x14af('0xa')](_0x14af('0x11'),auth[_0x14af('0xc')](),controller[_0x14af('0x12')]);router[_0x14af('0x13')]('/',auth[_0x14af('0xc')](),controller[_0x14af('0x14')]);router['put'](_0x14af('0xb'),auth[_0x14af('0xc')](),controller['update']);router[_0x14af('0x15')](_0x14af('0xb'),auth[_0x14af('0xc')](),controller[_0x14af('0x16')]);module[_0x14af('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e35c33f..79feb99 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 _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x4650bf,_0x44b2bd){var _0x29ec71=function(_0xb8caad){while(--_0xb8caad){_0x4650bf['push'](_0x4650bf['shift']());}};_0x29ec71(++_0x44b2bd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5fc3[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x194d2f,_0x58d4af){var _0x3e5eca=function(_0x4bd8df){while(--_0x4bd8df){_0x194d2f['push'](_0x194d2f['shift']());}};_0x3e5eca(++_0x58d4af);}(_0xeda8,0x104));var _0x8eda=function(_0x2e5d8a,_0x2f97c0){_0x2e5d8a=_0x2e5d8a-0x0;var _0x4969ae=_0xeda8[_0x2e5d8a];return _0x4969ae;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 62d599d..1bae3f7 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 _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x58f1b0,_0x3a2be3){var _0x551656=function(_0x5152c1){while(--_0x5152c1){_0x58f1b0['push'](_0x58f1b0['shift']());}};_0x551656(++_0x3a2be3);}(_0x814b,0x1a2));var _0xb814=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x814b[_0x349148];return _0x2f2b0f;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x3f80e8,_0xd88ecf){var _0x17cf31=function(_0x5c849e){while(--_0x5c849e){_0x3f80e8['push'](_0x3f80e8['shift']());}};_0x17cf31(++_0xd88ecf);}(_0xda19,0xd5));var _0x9da1=function(_0x55c498,_0x14021c){_0x55c498=_0x55c498-0x0;var _0x3323f2=_0xda19[_0x55c498];return _0x3323f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index e45c9cd..6832c46 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 _0x2b8e=['../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x3e9e78,_0x1e92c9){var _0x4fc5ac=function(_0x44cbd1){while(--_0x44cbd1){_0x3e9e78['push'](_0x3e9e78['shift']());}};_0x4fc5ac(++_0x1e92c9);}(_0x2b8e,0x14f));var _0xe2b8=function(_0x1e73ab,_0x3a9040){_0x1e73ab=_0x1e73ab-0x0;var _0x40d8c0=_0x2b8e[_0x1e73ab];return _0x40d8c0;};'use strict';var _=require(_0xe2b8('0x0'));var util=require(_0xe2b8('0x1'));var logger=require(_0xe2b8('0x2'))('api');var moment=require(_0xe2b8('0x3'));var BPromise=require(_0xe2b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2b8('0x5'));var rimraf=require('rimraf');var config=require(_0xe2b8('0x6'));var attributes=require(_0xe2b8('0x7'));module['exports']=function(_0x156628,_0x5536dc){return _0x156628[_0xe2b8('0x8')](_0xe2b8('0x9'),attributes,{'tableName':_0xe2b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb5a=['path','rimraf','./analyticDefaultReport.attributes','exports','define','util','api','bluebird','request-promise'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xdb5a,0x1d0));var _0xadb5=function(_0x1ca804,_0x2a0925){_0x1ca804=_0x1ca804-0x0;var _0x2fc5bf=_0xdb5a[_0x1ca804];return _0x2fc5bf;};'use strict';var _=require('lodash');var util=require(_0xadb5('0x0'));var logger=require('../../config/logger')(_0xadb5('0x1'));var moment=require('moment');var BPromise=require(_0xadb5('0x2'));var rp=require(_0xadb5('0x3'));var fs=require('fs');var path=require(_0xadb5('0x4'));var rimraf=require(_0xadb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xadb5('0x6'));module[_0xadb5('0x7')]=function(_0x3f0728,_0x594c43){return _0x3f0728[_0xadb5('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 57eebb9..14c2aae 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 _0x6c71=['jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2c4e42,_0x7104de){var _0x380da6=function(_0x56f273){while(--_0x56f273){_0x2c4e42['push'](_0x2c4e42['shift']());}};_0x380da6(++_0x7104de);}(_0x6c71,0x1ad));var _0x16c7=function(_0x456fc1,_0x191e3d){_0x456fc1=_0x456fc1-0x0;var _0x84fab3=_0x6c71[_0x456fc1];return _0x84fab3;};'use strict';var _=require(_0x16c7('0x0'));var util=require(_0x16c7('0x1'));var moment=require(_0x16c7('0x2'));var BPromise=require(_0x16c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x16c7('0x5'));var logger=require(_0x16c7('0x6'))('rpc');var config=require(_0x16c7('0x7'));var jayson=require(_0x16c7('0x8'));var client=jayson[_0x16c7('0x9')][_0x16c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x448d24,_0x359aea,_0x1f95e8){return new BPromise(function(_0x2eac9f,_0x116cda){return client['request'](_0x448d24,_0x1f95e8)[_0x16c7('0xb')](function(_0x21c7b2){logger[_0x16c7('0xc')](_0x16c7('0xd'),_0x359aea,_0x16c7('0xe'));logger[_0x16c7('0xf')](_0x16c7('0x10'),_0x359aea,_0x16c7('0xe'),JSON[_0x16c7('0x11')](_0x21c7b2));if(_0x21c7b2['error']){if(_0x21c7b2[_0x16c7('0x12')][_0x16c7('0x13')]===0x1f4){logger[_0x16c7('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x359aea,_0x21c7b2[_0x16c7('0x12')][_0x16c7('0x14')]);return _0x116cda(_0x21c7b2[_0x16c7('0x12')][_0x16c7('0x14')]);}logger[_0x16c7('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x359aea,_0x21c7b2['error']['message']);return _0x2eac9f(_0x21c7b2['error'][_0x16c7('0x14')]);}else{logger[_0x16c7('0xc')](_0x16c7('0xd'),_0x359aea,_0x16c7('0xe'));_0x2eac9f(_0x21c7b2[_0x16c7('0x15')]['message']);}})[_0x16c7('0x16')](function(_0x4c8c42){logger['error'](_0x16c7('0xd'),_0x359aea,_0x4c8c42);_0x116cda(_0x4c8c42);});});} \ No newline at end of file +var _0x92a0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5506cd,_0x1f1fc1){var _0x3be516=function(_0x492c42){while(--_0x492c42){_0x5506cd['push'](_0x5506cd['shift']());}};_0x3be516(++_0x1f1fc1);}(_0x92a0,0x1c6));var _0x092a=function(_0xa0be1c,_0x152d5d){_0xa0be1c=_0xa0be1c-0x0;var _0x546eec=_0x92a0[_0xa0be1c];return _0x546eec;};'use strict';var _=require(_0x092a('0x0'));var util=require(_0x092a('0x1'));var moment=require(_0x092a('0x2'));var BPromise=require('bluebird');var rs=require(_0x092a('0x3'));var fs=require('fs');var Redis=require(_0x092a('0x4'));var db=require(_0x092a('0x5'))['db'];var utils=require(_0x092a('0x6'));var logger=require('../../config/logger')(_0x092a('0x7'));var config=require(_0x092a('0x8'));var jayson=require(_0x092a('0x9'));var client=jayson[_0x092a('0xa')][_0x092a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x272931,_0x57dbef,_0x330d04){return new BPromise(function(_0x50a109,_0x4f149f){return client[_0x092a('0xc')](_0x272931,_0x330d04)['then'](function(_0x5607d6){logger['info'](_0x092a('0xd'),_0x57dbef,_0x092a('0xe'));logger[_0x092a('0xf')](_0x092a('0x10'),_0x57dbef,_0x092a('0xe'),JSON[_0x092a('0x11')](_0x5607d6));if(_0x5607d6[_0x092a('0x12')]){if(_0x5607d6[_0x092a('0x12')][_0x092a('0x13')]===0x1f4){logger[_0x092a('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x57dbef,_0x5607d6[_0x092a('0x12')][_0x092a('0x14')]);return _0x4f149f(_0x5607d6['error'][_0x092a('0x14')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x57dbef,_0x5607d6[_0x092a('0x12')][_0x092a('0x14')]);return _0x50a109(_0x5607d6[_0x092a('0x12')][_0x092a('0x14')]);}else{logger[_0x092a('0x15')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x57dbef,'request\x20sent');_0x50a109(_0x5607d6[_0x092a('0x16')][_0x092a('0x14')]);}})['catch'](function(_0xd921f9){logger[_0x092a('0x12')](_0x092a('0xd'),_0x57dbef,_0xd921f9);_0x4f149f(_0xd921f9);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 7885f1d..71756d5 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 _0x2c40=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','delete','destroy','exports'];(function(_0x59c683,_0x209444){var _0x47251b=function(_0x4db046){while(--_0x4db046){_0x59c683['push'](_0x59c683['shift']());}};_0x47251b(++_0x209444);}(_0x2c40,0xfd));var _0x02c4=function(_0x575d6b,_0x3f86c1){_0x575d6b=_0x575d6b-0x0;var _0x2c9819=_0x2c40[_0x575d6b];return _0x2c9819;};'use strict';var multer=require('multer');var util=require(_0x02c4('0x0'));var path=require(_0x02c4('0x1'));var timeout=require(_0x02c4('0x2'));var express=require(_0x02c4('0x3'));var router=express[_0x02c4('0x4')]();var fs_extra=require(_0x02c4('0x5'));var auth=require(_0x02c4('0x6'));var interaction=require(_0x02c4('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x02c4('0x8')]('/',auth[_0x02c4('0x9')](),controller['index']);router[_0x02c4('0x8')](_0x02c4('0xa'),auth[_0x02c4('0x9')](),controller[_0x02c4('0xb')]);router['get'](_0x02c4('0xc'),auth['isAuthenticated'](),controller[_0x02c4('0xd')]);router['get'](_0x02c4('0xe'),auth[_0x02c4('0x9')](),controller[_0x02c4('0xf')]);router[_0x02c4('0x8')](_0x02c4('0x10'),auth['isAuthenticated'](),controller[_0x02c4('0x11')]);router['post']('/',auth[_0x02c4('0x9')](),controller['create']);router[_0x02c4('0x12')](_0x02c4('0xa'),auth[_0x02c4('0x9')](),controller[_0x02c4('0x13')]);router[_0x02c4('0x14')](_0x02c4('0xa'),auth['isAuthenticated'](),controller[_0x02c4('0x15')]);module[_0x02c4('0x16')]=router; \ No newline at end of file +var _0x19f4=['../../components/auth/service','./analyticDefaultReport.controller','isAuthenticated','get','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x18032f,_0x4f4e45){var _0xb0b2b8=function(_0x563262){while(--_0x563262){_0x18032f['push'](_0x18032f['shift']());}};_0xb0b2b8(++_0x4f4e45);}(_0x19f4,0x10c));var _0x419f=function(_0x2d3154,_0xf911c9){_0x2d3154=_0x2d3154-0x0;var _0x30196e=_0x19f4[_0x2d3154];return _0x30196e;};'use strict';var multer=require(_0x419f('0x0'));var util=require(_0x419f('0x1'));var path=require(_0x419f('0x2'));var timeout=require(_0x419f('0x3'));var express=require('express');var router=express[_0x419f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x419f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x419f('0x6'));router['get']('/',auth[_0x419f('0x7')](),controller['index']);router[_0x419f('0x8')](_0x419f('0x9'),auth[_0x419f('0x7')](),controller[_0x419f('0xa')]);router['get'](_0x419f('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x419f('0x8')](_0x419f('0xc'),auth[_0x419f('0x7')](),controller[_0x419f('0xd')]);router[_0x419f('0x8')](_0x419f('0xe'),auth['isAuthenticated'](),controller[_0x419f('0xf')]);router[_0x419f('0x10')]('/',auth[_0x419f('0x7')](),controller[_0x419f('0x11')]);router[_0x419f('0x12')](_0x419f('0x9'),auth[_0x419f('0x7')](),controller[_0x419f('0x13')]);router['delete'](_0x419f('0x9'),auth[_0x419f('0x7')](),controller[_0x419f('0x14')]);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 d93dbc5..eaa54cc 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 _0x409a=['xlsx','DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','csv','pdf'];(function(_0xd46227,_0x18477f){var _0x2a980d=function(_0x34e452){while(--_0x34e452){_0xd46227['push'](_0xd46227['shift']());}};_0x2a980d(++_0x18477f);}(_0x409a,0x181));var _0xa409=function(_0x931503,_0x296d97){_0x931503=_0x931503-0x0;var _0x2c838f=_0x409a[_0x931503];return _0x2c838f;};'use strict';var Sequelize=require(_0xa409('0x0'));var moment=require(_0xa409('0x1'));module['exports']={'name':{'type':Sequelize[_0xa409('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xa409('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xa409('0x3'),_0xa409('0x4'),_0xa409('0x5')),'allowNull':![],'defaultValue':_0xa409('0x3')},'savename':{'type':Sequelize[_0xa409('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa409('0x6')]},'endDate':{'type':Sequelize[_0xa409('0x6')]},'status':{'type':Sequelize[_0xa409('0x2')],'defaultValue':_0xa409('0x7')},'type':{'type':Sequelize[_0xa409('0x8')](_0xa409('0x9'),_0xa409('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xa409('0xb')](0xb)[_0xa409('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4722=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','Loading'];(function(_0x322e53,_0x12446f){var _0x3e19ab=function(_0x2bb848){while(--_0x2bb848){_0x322e53['push'](_0x322e53['shift']());}};_0x3e19ab(++_0x12446f);}(_0x4722,0x18a));var _0x2472=function(_0x4cdb9b,_0x9800cf){_0x4cdb9b=_0x4cdb9b-0x0;var _0x46cfa4=_0x4722[_0x4cdb9b];return _0x46cfa4;};'use strict';var Sequelize=require(_0x2472('0x0'));var moment=require(_0x2472('0x1'));module[_0x2472('0x2')]={'name':{'type':Sequelize[_0x2472('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x2472('0x4')](_0x2472('0x5'),_0x2472('0x6'),_0x2472('0x7')),'allowNull':![],'defaultValue':_0x2472('0x5')},'savename':{'type':Sequelize[_0x2472('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x2472('0x3')],'defaultValue':_0x2472('0x8')},'type':{'type':Sequelize[_0x2472('0x4')](_0x2472('0x9'),_0x2472('0xa')),'allowNull':![],'defaultValue':_0x2472('0x9')},'reportId':{'type':Sequelize[_0x2472('0xb')](0xb)[_0x2472('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e44b41c..f33b071 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 _0x388a=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','root','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x706e7e,_0x31bb07){var _0x1dfb2e=function(_0x47cbb8){while(--_0x47cbb8){_0x706e7e['push'](_0x706e7e['shift']());}};_0x1dfb2e(++_0x31bb07);}(_0x388a,0x17e));var _0xa388=function(_0x80c112,_0xae37fc){_0x80c112=_0x80c112-0x0;var _0x23232c=_0x388a[_0x80c112];return _0x23232c;};'use strict';var emlformat=require(_0xa388('0x0'));var rimraf=require(_0xa388('0x1'));var zipdir=require(_0xa388('0x2'));var jsonpatch=require(_0xa388('0x3'));var rp=require(_0xa388('0x4'));var moment=require(_0xa388('0x5'));var BPromise=require(_0xa388('0x6'));var Mustache=require(_0xa388('0x7'));var util=require('util');var path=require(_0xa388('0x8'));var sox=require(_0xa388('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa388('0xa'));var squel=require(_0xa388('0xb'));var crypto=require(_0xa388('0xc'));var jsforce=require(_0xa388('0xd'));var deskjs=require(_0xa388('0xe'));var toCsv=require(_0xa388('0xf'));var querystring=require(_0xa388('0x10'));var Papa=require('papaparse');var Redis=require(_0xa388('0x11'));var authService=require(_0xa388('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa388('0x13'));var hardwareService=require(_0xa388('0x14'));var logger=require(_0xa388('0x15'))('api');var utils=require(_0xa388('0x16'));var config=require(_0xa388('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa388('0x18'))['db'];function respondWithStatusCode(_0x17d47e,_0x2087da){_0x2087da=_0x2087da||0xcc;return function(_0x5f4637){if(_0x5f4637){return _0x17d47e['sendStatus'](_0x2087da);}return _0x17d47e['status'](_0x2087da)[_0xa388('0x19')]();};}function respondWithResult(_0x4c816b,_0x289744){_0x289744=_0x289744||0xc8;return function(_0x388e29){if(_0x388e29){return _0x4c816b[_0xa388('0x1a')](_0x289744)[_0xa388('0x1b')](_0x388e29);}};}function respondWithFilteredResult(_0x1d01ef,_0x3b8699){return function(_0x2ae86f){if(_0x2ae86f){var _0x581364=typeof _0x3b8699['offset']===_0xa388('0x1c')&&typeof _0x3b8699[_0xa388('0x1d')]===_0xa388('0x1c');var _0x2378f0=_0x2ae86f[_0xa388('0x1e')];var _0x215e27=_0x581364?0x0:_0x3b8699[_0xa388('0x1f')];var _0x537a6d=_0x581364?_0x2ae86f[_0xa388('0x1e')]:_0x3b8699[_0xa388('0x1f')]+_0x3b8699[_0xa388('0x1d')];var _0x9be630;if(_0x537a6d>=_0x2378f0){_0x537a6d=_0x2378f0;_0x9be630=0xc8;}else{_0x9be630=0xce;}_0x1d01ef[_0xa388('0x1a')](_0x9be630);return _0x1d01ef['set'](_0xa388('0x20'),_0x215e27+'-'+_0x537a6d+'/'+_0x2378f0)[_0xa388('0x1b')](_0x2ae86f);}return null;};}function patchUpdates(_0x3d4656){return function(_0x3392ec){try{jsonpatch[_0xa388('0x21')](_0x3392ec,_0x3d4656,!![]);}catch(_0x138dc2){return BPromise[_0xa388('0x22')](_0x138dc2);}return _0x3392ec[_0xa388('0x23')]();};}function saveUpdates(_0x2b479f,_0x2c8efb){return function(_0x19552c){if(_0x19552c){return _0x19552c[_0xa388('0x24')](_0x2b479f)[_0xa388('0x25')](function(_0x15ed3e){return _0x15ed3e;});}return null;};}function removeEntity(_0x3ecff2,_0x2ffc35){return function(_0x1e56d4){if(_0x1e56d4){return _0x1e56d4['destroy']()[_0xa388('0x25')](function(){var _0x37d0e6=_0x1e56d4['get']({'plain':!![]});var _0x243ce9=_0xa388('0x26');return db[_0xa388('0x27')][_0xa388('0x28')]({'where':{'type':_0x243ce9,'resourceId':_0x37d0e6['id']}})[_0xa388('0x25')](function(){return _0x1e56d4;});})['then'](function(){_0x3ecff2[_0xa388('0x1a')](0xcc)[_0xa388('0x19')]();});}};}function handleEntityNotFound(_0x220246,_0x1e44da){return function(_0xe9e5e2){if(!_0xe9e5e2){_0x220246['sendStatus'](0x194);}return _0xe9e5e2;};}function handleError(_0xa719d6,_0x5eeccd){_0x5eeccd=_0x5eeccd||0x1f4;return function(_0xe8b4b2){logger[_0xa388('0x29')](_0xe8b4b2[_0xa388('0x2a')]);if(_0xe8b4b2[_0xa388('0x2b')]){delete _0xe8b4b2['name'];}_0xa719d6['status'](_0x5eeccd)[_0xa388('0x2c')](_0xe8b4b2);};}exports[_0xa388('0x2d')]=function(_0x17ff06,_0x129879){var _0x431a59={},_0x168508={},_0x5dc0c6={'count':0x0,'rows':[]};var _0x383b11=_[_0xa388('0x2e')](db[_0xa388('0x2f')][_0xa388('0x30')],function(_0x2f4a9e){return{'name':_0x2f4a9e[_0xa388('0x31')],'type':_0x2f4a9e[_0xa388('0x32')]['key']};});_0x168508[_0xa388('0x33')]=_['map'](_0x383b11,'name');_0x168508[_0xa388('0x34')]=_[_0xa388('0x35')](_0x17ff06[_0xa388('0x34')]);_0x168508[_0xa388('0x36')]=_['intersection'](_0x168508[_0xa388('0x33')],_0x168508['query']);_0x431a59[_0xa388('0x37')]=_[_0xa388('0x38')](_0x168508[_0xa388('0x33')],qs[_0xa388('0x39')](_0x17ff06[_0xa388('0x34')][_0xa388('0x39')]));_0x431a59[_0xa388('0x37')]=_0x431a59[_0xa388('0x37')]['length']?_0x431a59['attributes']:_0x168508[_0xa388('0x33')];if(!_0x17ff06[_0xa388('0x34')][_0xa388('0x3a')](_0xa388('0x3b'))){_0x431a59[_0xa388('0x1d')]=qs[_0xa388('0x1d')](_0x17ff06[_0xa388('0x34')][_0xa388('0x1d')]);_0x431a59[_0xa388('0x1f')]=qs[_0xa388('0x1f')](_0x17ff06[_0xa388('0x34')][_0xa388('0x1f')]);}_0x431a59['order']=qs[_0xa388('0x3c')](_0x17ff06[_0xa388('0x34')][_0xa388('0x3c')]);_0x431a59['where']=qs['filters'](_['pick'](_0x17ff06[_0xa388('0x34')],_0x168508[_0xa388('0x36')]),_0x383b11);if(_0x17ff06[_0xa388('0x34')][_0xa388('0x3d')]){_0x431a59['where']=_[_0xa388('0x3e')](_0x431a59[_0xa388('0x3f')],{'$or':_['map'](_0x383b11,function(_0x19b46d){if(_0x19b46d[_0xa388('0x32')]!==_0xa388('0x40')){var _0x529b7d={};_0x529b7d[_0x19b46d[_0xa388('0x2b')]]={'$like':'%'+_0x17ff06[_0xa388('0x34')][_0xa388('0x3d')]+'%'};return _0x529b7d;}})});}_0x431a59=_[_0xa388('0x3e')]({},_0x431a59,_0x17ff06[_0xa388('0x41')]);var _0x446095={'where':_0x431a59[_0xa388('0x3f')]};return db[_0xa388('0x2f')]['count'](_0x446095)[_0xa388('0x25')](function(_0x1f7b25){_0x5dc0c6['count']=_0x1f7b25;if(_0x17ff06['query'][_0xa388('0x42')]){_0x431a59[_0xa388('0x43')]=[{'all':!![]}];}return db[_0xa388('0x2f')][_0xa388('0x44')](_0x431a59);})['then'](function(_0x34e7df){_0x5dc0c6[_0xa388('0x45')]=_0x34e7df;return _0x5dc0c6;})[_0xa388('0x25')](respondWithFilteredResult(_0x129879,_0x431a59))['catch'](handleError(_0x129879,null));};exports[_0xa388('0x46')]=function(_0x58da0d,_0x2458db){var _0x31484b={'raw':!![],'where':{'id':_0x58da0d[_0xa388('0x47')]['id']}},_0x420442={};_0x420442[_0xa388('0x33')]=_['keys'](db[_0xa388('0x2f')][_0xa388('0x30')]);_0x420442['query']=_[_0xa388('0x35')](_0x58da0d[_0xa388('0x34')]);_0x420442[_0xa388('0x36')]=_[_0xa388('0x38')](_0x420442[_0xa388('0x33')],_0x420442[_0xa388('0x34')]);_0x31484b['attributes']=_['intersection'](_0x420442[_0xa388('0x33')],qs[_0xa388('0x39')](_0x58da0d[_0xa388('0x34')][_0xa388('0x39')]));_0x31484b[_0xa388('0x37')]=_0x31484b[_0xa388('0x37')][_0xa388('0x48')]?_0x31484b[_0xa388('0x37')]:_0x420442[_0xa388('0x33')];if(_0x58da0d[_0xa388('0x34')][_0xa388('0x42')]){_0x31484b['include']=[{'all':!![]}];}_0x31484b=_[_0xa388('0x3e')]({},_0x31484b,_0x58da0d['options']);return db[_0xa388('0x2f')]['find'](_0x31484b)[_0xa388('0x25')](handleEntityNotFound(_0x2458db,null))[_0xa388('0x25')](respondWithResult(_0x2458db,null))[_0xa388('0x49')](handleError(_0x2458db,null));};exports[_0xa388('0x4a')]=function(_0x20e99c,_0x4e7896){return db[_0xa388('0x2f')][_0xa388('0x4a')](_0x20e99c[_0xa388('0x4b')],{})[_0xa388('0x25')](function(_0x51ab75){var _0x5dcaa8=_0x20e99c[_0xa388('0x4c')]['get']({'plain':!![]});if(!_0x5dcaa8)throw new Error(_0xa388('0x4d'));if(_0x5dcaa8[_0xa388('0x4e')]===_0xa388('0x4c')){var _0x3b8abc=_0x51ab75[_0xa388('0x4f')]({'plain':!![]});var _0x1ce8c3=_0xa388('0x26');return db[_0xa388('0x50')][_0xa388('0x51')]({'where':{'name':_0x1ce8c3,'userProfileId':_0x5dcaa8[_0xa388('0x52')]},'raw':!![]})[_0xa388('0x25')](function(_0x1a28fd){if(_0x1a28fd&&_0x1a28fd[_0xa388('0x53')]===0x0){return db[_0xa388('0x27')][_0xa388('0x4a')]({'name':_0x3b8abc[_0xa388('0x2b')],'resourceId':_0x3b8abc['id'],'type':_0x1a28fd['name'],'sectionId':_0x1a28fd['id']},{})[_0xa388('0x25')](function(){return _0x51ab75;});}else{return _0x51ab75;}})['catch'](function(_0x2b0709){logger[_0xa388('0x29')](_0xa388('0x54'),_0x2b0709);throw _0x2b0709;});}return _0x51ab75;})[_0xa388('0x25')](respondWithResult(_0x4e7896,0xc9))[_0xa388('0x49')](handleError(_0x4e7896,null));};exports[_0xa388('0x24')]=function(_0x5491ca,_0xde0faf){if(_0x5491ca[_0xa388('0x4b')]['id']){delete _0x5491ca[_0xa388('0x4b')]['id'];}return db[_0xa388('0x2f')][_0xa388('0x51')]({'where':{'id':_0x5491ca['params']['id']}})[_0xa388('0x25')](handleEntityNotFound(_0xde0faf,null))['then'](saveUpdates(_0x5491ca[_0xa388('0x4b')],null))['then'](respondWithResult(_0xde0faf,null))[_0xa388('0x49')](handleError(_0xde0faf,null));};exports[_0xa388('0x28')]=function(_0x4eb570,_0x3cfcb7){return db[_0xa388('0x2f')][_0xa388('0x51')]({'where':{'id':_0x4eb570[_0xa388('0x47')]['id']}})[_0xa388('0x25')](handleEntityNotFound(_0x3cfcb7,null))['then'](removeEntity(_0x3cfcb7,null))[_0xa388('0x49')](handleError(_0x3cfcb7,null));};exports[_0xa388('0x55')]=function(_0x4f81e9,_0x1e7068,_0x35c437){return db[_0xa388('0x2f')]['find']({'where':{'id':_0x4f81e9[_0xa388('0x47')]['id']},'attributes':['name',_0xa388('0x56'),'savename',_0xa388('0x57')],'raw':!![]})[_0xa388('0x25')](handleEntityNotFound(_0x1e7068,null))[_0xa388('0x25')](function(_0x399790){if(_0x399790){if(!fs[_0xa388('0x58')](path['join'](config[_0xa388('0x59')],'server/files/reports',_0x399790[_0xa388('0x5a')]))){throw new db[(_0xa388('0x5b'))][(_0xa388('0x5c'))](_0xa388('0x5d'));}if(_0x4f81e9[_0xa388('0x34')][_0xa388('0x5e')]){return _0x1e7068['sendStatus'](0xc8);}return _0x1e7068[_0xa388('0x55')](path['join'](config[_0xa388('0x59')],_0xa388('0x5f'),_0x399790[_0xa388('0x5a')]),util[_0xa388('0x60')](_0xa388('0x61'),_0x399790[_0xa388('0x56')]||_0x399790[_0xa388('0x2b')],_0x399790[_0xa388('0x57')]['toLowerCase']()));}})[_0xa388('0x49')](handleError(_0x1e7068,null));}; \ No newline at end of file +var _0x5d89=['path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','eml-format','rimraf','request-promise','moment','mustache','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5d89,0x1e9));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x95d8('0x0'));var rimraf=require(_0x95d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x95d8('0x2'));var moment=require(_0x95d8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x95d8('0x4'));var util=require(_0x95d8('0x5'));var path=require(_0x95d8('0x6'));var sox=require(_0x95d8('0x7'));var csv=require(_0x95d8('0x8'));var ejs=require(_0x95d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95d8('0xa'));var squel=require(_0x95d8('0xb'));var crypto=require(_0x95d8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x95d8('0x8'));var querystring=require(_0x95d8('0xd'));var Papa=require(_0x95d8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x95d8('0xf'));var as=require(_0x95d8('0x10'));var hardwareService=require(_0x95d8('0x11'));var logger=require(_0x95d8('0x12'))('api');var utils=require(_0x95d8('0x13'));var config=require(_0x95d8('0x14'));var licenseUtil=require(_0x95d8('0x15'));var db=require(_0x95d8('0x16'))['db'];function respondWithStatusCode(_0x4e9972,_0x5cf2fe){_0x5cf2fe=_0x5cf2fe||0xcc;return function(_0x255382){if(_0x255382){return _0x4e9972['sendStatus'](_0x5cf2fe);}return _0x4e9972['status'](_0x5cf2fe)['end']();};}function respondWithResult(_0x23ede8,_0x4adc31){_0x4adc31=_0x4adc31||0xc8;return function(_0x2326bb){if(_0x2326bb){return _0x23ede8[_0x95d8('0x17')](_0x4adc31)[_0x95d8('0x18')](_0x2326bb);}};}function respondWithFilteredResult(_0x52a119,_0x1b3f26){return function(_0x275a83){if(_0x275a83){var _0x4850c2=typeof _0x1b3f26[_0x95d8('0x19')]===_0x95d8('0x1a')&&typeof _0x1b3f26['limit']===_0x95d8('0x1a');var _0x17f69d=_0x275a83['count'];var _0x14f9ff=_0x4850c2?0x0:_0x1b3f26[_0x95d8('0x19')];var _0x4ab61e=_0x4850c2?_0x275a83[_0x95d8('0x1b')]:_0x1b3f26[_0x95d8('0x19')]+_0x1b3f26[_0x95d8('0x1c')];var _0x286e57;if(_0x4ab61e>=_0x17f69d){_0x4ab61e=_0x17f69d;_0x286e57=0xc8;}else{_0x286e57=0xce;}_0x52a119[_0x95d8('0x17')](_0x286e57);return _0x52a119[_0x95d8('0x1d')](_0x95d8('0x1e'),_0x14f9ff+'-'+_0x4ab61e+'/'+_0x17f69d)[_0x95d8('0x18')](_0x275a83);}return null;};}function patchUpdates(_0x45a763){return function(_0x49d9da){try{jsonpatch[_0x95d8('0x1f')](_0x49d9da,_0x45a763,!![]);}catch(_0x10b11f){return BPromise[_0x95d8('0x20')](_0x10b11f);}return _0x49d9da[_0x95d8('0x21')]();};}function saveUpdates(_0x1b9735,_0x7e0444){return function(_0x502c58){if(_0x502c58){return _0x502c58[_0x95d8('0x22')](_0x1b9735)[_0x95d8('0x23')](function(_0x276e18){return _0x276e18;});}return null;};}function removeEntity(_0x3ed960,_0x6ea91b){return function(_0x900539){if(_0x900539){return _0x900539[_0x95d8('0x24')]()['then'](function(){var _0x78ad19=_0x900539[_0x95d8('0x25')]({'plain':!![]});var _0x1996ca='ExtractedReports';return db['UserProfileResource'][_0x95d8('0x24')]({'where':{'type':_0x1996ca,'resourceId':_0x78ad19['id']}})[_0x95d8('0x23')](function(){return _0x900539;});})[_0x95d8('0x23')](function(){_0x3ed960['status'](0xcc)[_0x95d8('0x26')]();});}};}function handleEntityNotFound(_0x54fa64,_0x2ba6d9){return function(_0x1a1dbc){if(!_0x1a1dbc){_0x54fa64[_0x95d8('0x27')](0x194);}return _0x1a1dbc;};}function handleError(_0x5b28da,_0x194e54){_0x194e54=_0x194e54||0x1f4;return function(_0x7cfc74){logger[_0x95d8('0x28')](_0x7cfc74[_0x95d8('0x29')]);if(_0x7cfc74[_0x95d8('0x2a')]){delete _0x7cfc74[_0x95d8('0x2a')];}_0x5b28da[_0x95d8('0x17')](_0x194e54)[_0x95d8('0x2b')](_0x7cfc74);};}exports[_0x95d8('0x2c')]=function(_0xe9b10e,_0x4c981e){var _0x20fe0b={},_0x228d65={},_0x36977e={'count':0x0,'rows':[]};var _0xfcfd00=_[_0x95d8('0x2d')](db[_0x95d8('0x2e')][_0x95d8('0x2f')],function(_0x1fe92f){return{'name':_0x1fe92f[_0x95d8('0x30')],'type':_0x1fe92f[_0x95d8('0x31')][_0x95d8('0x32')]};});_0x228d65[_0x95d8('0x33')]=_[_0x95d8('0x2d')](_0xfcfd00,'name');_0x228d65[_0x95d8('0x34')]=_[_0x95d8('0x35')](_0xe9b10e[_0x95d8('0x34')]);_0x228d65['filters']=_[_0x95d8('0x36')](_0x228d65[_0x95d8('0x33')],_0x228d65[_0x95d8('0x34')]);_0x20fe0b['attributes']=_[_0x95d8('0x36')](_0x228d65[_0x95d8('0x33')],qs[_0x95d8('0x37')](_0xe9b10e[_0x95d8('0x34')]['fields']));_0x20fe0b[_0x95d8('0x38')]=_0x20fe0b[_0x95d8('0x38')][_0x95d8('0x39')]?_0x20fe0b[_0x95d8('0x38')]:_0x228d65[_0x95d8('0x33')];if(!_0xe9b10e['query']['hasOwnProperty'](_0x95d8('0x3a'))){_0x20fe0b[_0x95d8('0x1c')]=qs[_0x95d8('0x1c')](_0xe9b10e[_0x95d8('0x34')]['limit']);_0x20fe0b[_0x95d8('0x19')]=qs[_0x95d8('0x19')](_0xe9b10e['query']['offset']);}_0x20fe0b[_0x95d8('0x3b')]=qs[_0x95d8('0x3c')](_0xe9b10e[_0x95d8('0x34')][_0x95d8('0x3c')]);_0x20fe0b[_0x95d8('0x3d')]=qs[_0x95d8('0x3e')](_['pick'](_0xe9b10e[_0x95d8('0x34')],_0x228d65['filters']),_0xfcfd00);if(_0xe9b10e[_0x95d8('0x34')][_0x95d8('0x3f')]){_0x20fe0b[_0x95d8('0x3d')]=_[_0x95d8('0x40')](_0x20fe0b[_0x95d8('0x3d')],{'$or':_['map'](_0xfcfd00,function(_0x6653d0){if(_0x6653d0[_0x95d8('0x31')]!==_0x95d8('0x41')){var _0x1c38e9={};_0x1c38e9[_0x6653d0['name']]={'$like':'%'+_0xe9b10e[_0x95d8('0x34')][_0x95d8('0x3f')]+'%'};return _0x1c38e9;}})});}_0x20fe0b=_[_0x95d8('0x40')]({},_0x20fe0b,_0xe9b10e[_0x95d8('0x42')]);var _0x501fde={'where':_0x20fe0b['where']};return db[_0x95d8('0x2e')][_0x95d8('0x1b')](_0x501fde)[_0x95d8('0x23')](function(_0x3effbf){_0x36977e[_0x95d8('0x1b')]=_0x3effbf;if(_0xe9b10e[_0x95d8('0x34')]['includeAll']){_0x20fe0b[_0x95d8('0x43')]=[{'all':!![]}];}return db[_0x95d8('0x2e')][_0x95d8('0x44')](_0x20fe0b);})[_0x95d8('0x23')](function(_0x4fc463){_0x36977e[_0x95d8('0x45')]=_0x4fc463;return _0x36977e;})[_0x95d8('0x23')](respondWithFilteredResult(_0x4c981e,_0x20fe0b))[_0x95d8('0x46')](handleError(_0x4c981e,null));};exports[_0x95d8('0x47')]=function(_0x2612be,_0x1d5f1a){var _0x5dcc49={'raw':!![],'where':{'id':_0x2612be[_0x95d8('0x48')]['id']}},_0x222d11={};_0x222d11[_0x95d8('0x33')]=_['keys'](db[_0x95d8('0x2e')]['rawAttributes']);_0x222d11[_0x95d8('0x34')]=_[_0x95d8('0x35')](_0x2612be[_0x95d8('0x34')]);_0x222d11['filters']=_[_0x95d8('0x36')](_0x222d11[_0x95d8('0x33')],_0x222d11[_0x95d8('0x34')]);_0x5dcc49['attributes']=_[_0x95d8('0x36')](_0x222d11[_0x95d8('0x33')],qs['fields'](_0x2612be['query']['fields']));_0x5dcc49['attributes']=_0x5dcc49[_0x95d8('0x38')]['length']?_0x5dcc49[_0x95d8('0x38')]:_0x222d11[_0x95d8('0x33')];if(_0x2612be[_0x95d8('0x34')][_0x95d8('0x49')]){_0x5dcc49['include']=[{'all':!![]}];}_0x5dcc49=_[_0x95d8('0x40')]({},_0x5dcc49,_0x2612be[_0x95d8('0x42')]);return db[_0x95d8('0x2e')][_0x95d8('0x4a')](_0x5dcc49)[_0x95d8('0x23')](handleEntityNotFound(_0x1d5f1a,null))[_0x95d8('0x23')](respondWithResult(_0x1d5f1a,null))[_0x95d8('0x46')](handleError(_0x1d5f1a,null));};exports[_0x95d8('0x4b')]=function(_0x51b159,_0x29f6a5){return db['AnalyticExtractedReport'][_0x95d8('0x4b')](_0x51b159[_0x95d8('0x4c')],{})[_0x95d8('0x23')](function(_0x3e340e){var _0x47e252=_0x51b159[_0x95d8('0x4d')][_0x95d8('0x25')]({'plain':!![]});if(!_0x47e252)throw new Error(_0x95d8('0x4e'));if(_0x47e252[_0x95d8('0x4f')]===_0x95d8('0x4d')){var _0x4b4de7=_0x3e340e['get']({'plain':!![]});var _0x1a2a20=_0x95d8('0x50');return db['UserProfileSection'][_0x95d8('0x4a')]({'where':{'name':_0x1a2a20,'userProfileId':_0x47e252[_0x95d8('0x51')]},'raw':!![]})['then'](function(_0x17b185){if(_0x17b185&&_0x17b185[_0x95d8('0x52')]===0x0){return db[_0x95d8('0x53')][_0x95d8('0x4b')]({'name':_0x4b4de7[_0x95d8('0x2a')],'resourceId':_0x4b4de7['id'],'type':_0x17b185[_0x95d8('0x2a')],'sectionId':_0x17b185['id']},{})[_0x95d8('0x23')](function(){return _0x3e340e;});}else{return _0x3e340e;}})[_0x95d8('0x46')](function(_0x5ba290){logger[_0x95d8('0x28')](_0x95d8('0x54'),_0x5ba290);throw _0x5ba290;});}return _0x3e340e;})['then'](respondWithResult(_0x29f6a5,0xc9))[_0x95d8('0x46')](handleError(_0x29f6a5,null));};exports[_0x95d8('0x22')]=function(_0x43309c,_0x397f07){if(_0x43309c[_0x95d8('0x4c')]['id']){delete _0x43309c[_0x95d8('0x4c')]['id'];}return db[_0x95d8('0x2e')][_0x95d8('0x4a')]({'where':{'id':_0x43309c[_0x95d8('0x48')]['id']}})[_0x95d8('0x23')](handleEntityNotFound(_0x397f07,null))[_0x95d8('0x23')](saveUpdates(_0x43309c[_0x95d8('0x4c')],null))['then'](respondWithResult(_0x397f07,null))[_0x95d8('0x46')](handleError(_0x397f07,null));};exports[_0x95d8('0x24')]=function(_0x4caf8b,_0x433ba6){return db[_0x95d8('0x2e')][_0x95d8('0x4a')]({'where':{'id':_0x4caf8b['params']['id']}})[_0x95d8('0x23')](handleEntityNotFound(_0x433ba6,null))['then'](removeEntity(_0x433ba6,null))[_0x95d8('0x46')](handleError(_0x433ba6,null));};exports[_0x95d8('0x55')]=function(_0x155073,_0x67f929,_0xbfeeb5){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x155073[_0x95d8('0x48')]['id']},'attributes':[_0x95d8('0x2a'),_0x95d8('0x56'),_0x95d8('0x57'),_0x95d8('0x58')],'raw':!![]})[_0x95d8('0x23')](handleEntityNotFound(_0x67f929,null))[_0x95d8('0x23')](function(_0x101e74){if(_0x101e74){if(!fs[_0x95d8('0x59')](path['join'](config[_0x95d8('0x5a')],_0x95d8('0x5b'),_0x101e74[_0x95d8('0x57')]))){throw new db[(_0x95d8('0x5c'))][(_0x95d8('0x5d'))](_0x95d8('0x5e'));}if(_0x155073[_0x95d8('0x34')][_0x95d8('0x5f')]){return _0x67f929[_0x95d8('0x27')](0xc8);}return _0x67f929['download'](path[_0x95d8('0x60')](config[_0x95d8('0x5a')],'server/files/reports',_0x101e74[_0x95d8('0x57')]),util[_0x95d8('0x61')](_0x95d8('0x62'),_0x101e74['basename']||_0x101e74[_0x95d8('0x2a')],_0x101e74[_0x95d8('0x58')]['toLowerCase']()));}})[_0x95d8('0x46')](handleError(_0x67f929,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ff01000..ecabe0b 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 _0xacde=['../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x34eccb,_0x3a9083){var _0x15f1f6=function(_0x454bf0){while(--_0x454bf0){_0x34eccb['push'](_0x34eccb['shift']());}};_0x15f1f6(++_0x3a9083);}(_0xacde,0xc5));var _0xeacd=function(_0x4be687,_0xe630cc){_0x4be687=_0x4be687-0x0;var _0x42156f=_0xacde[_0x4be687];return _0x42156f;};'use strict';var _=require(_0xeacd('0x0'));var util=require(_0xeacd('0x1'));var logger=require(_0xeacd('0x2'))(_0xeacd('0x3'));var moment=require(_0xeacd('0x4'));var BPromise=require(_0xeacd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeacd('0x6'));var rimraf=require('rimraf');var config=require(_0xeacd('0x7'));var attributes=require(_0xeacd('0x8'));module['exports']=function(_0x42cc59,_0x1727ba){return _0x42cc59[_0xeacd('0x9')](_0xeacd('0xa'),attributes,{'tableName':_0xeacd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1790=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x4bd9bd,_0x2fd047){var _0x1ebbd5=function(_0x1b8304){while(--_0x1b8304){_0x4bd9bd['push'](_0x4bd9bd['shift']());}};_0x1ebbd5(++_0x2fd047);}(_0x1790,0xd0));var _0x0179=function(_0x544d9a,_0x1dd46e){_0x544d9a=_0x544d9a-0x0;var _0x31cb96=_0x1790[_0x544d9a];return _0x31cb96;};'use strict';var _=require(_0x0179('0x0'));var util=require('util');var logger=require(_0x0179('0x1'))(_0x0179('0x2'));var moment=require('moment');var BPromise=require(_0x0179('0x3'));var rp=require(_0x0179('0x4'));var fs=require('fs');var path=require(_0x0179('0x5'));var rimraf=require(_0x0179('0x6'));var config=require(_0x0179('0x7'));var attributes=require(_0x0179('0x8'));module[_0x0179('0x9')]=function(_0x48b7c7,_0x4c4e36){return _0x48b7c7[_0x0179('0xa')](_0x0179('0xb'),attributes,{'tableName':_0x0179('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 04a97c1..f25a6e6 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 _0x6fa8=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x364048,_0x34dea3){var _0x591678=function(_0x239c0a){while(--_0x239c0a){_0x364048['push'](_0x364048['shift']());}};_0x591678(++_0x34dea3);}(_0x6fa8,0x79));var _0x86fa=function(_0x1ef48d,_0x203c73){_0x1ef48d=_0x1ef48d-0x0;var _0x450096=_0x6fa8[_0x1ef48d];return _0x450096;};'use strict';var _=require('lodash');var util=require(_0x86fa('0x0'));var moment=require(_0x86fa('0x1'));var BPromise=require(_0x86fa('0x2'));var rs=require(_0x86fa('0x3'));var fs=require('fs');var Redis=require(_0x86fa('0x4'));var db=require(_0x86fa('0x5'))['db'];var utils=require(_0x86fa('0x6'));var logger=require(_0x86fa('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x86fa('0x8'));var client=jayson[_0x86fa('0x9')][_0x86fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x509e45,_0x1f0e92,_0x34b993){return new BPromise(function(_0x20eec3,_0x2de438){return client[_0x86fa('0xb')](_0x509e45,_0x34b993)['then'](function(_0x2bd4bc){logger[_0x86fa('0xc')](_0x86fa('0xd'),_0x1f0e92,_0x86fa('0xe'));logger['debug'](_0x86fa('0xf'),_0x1f0e92,_0x86fa('0xe'),JSON['stringify'](_0x2bd4bc));if(_0x2bd4bc[_0x86fa('0x10')]){if(_0x2bd4bc[_0x86fa('0x10')][_0x86fa('0x11')]===0x1f4){logger[_0x86fa('0x10')](_0x86fa('0xd'),_0x1f0e92,_0x2bd4bc[_0x86fa('0x10')][_0x86fa('0x12')]);return _0x2de438(_0x2bd4bc['error'][_0x86fa('0x12')]);}logger[_0x86fa('0x10')](_0x86fa('0xd'),_0x1f0e92,_0x2bd4bc['error'][_0x86fa('0x12')]);return _0x20eec3(_0x2bd4bc[_0x86fa('0x10')][_0x86fa('0x12')]);}else{logger[_0x86fa('0xc')](_0x86fa('0xd'),_0x1f0e92,_0x86fa('0xe'));_0x20eec3(_0x2bd4bc[_0x86fa('0x13')]['message']);}})[_0x86fa('0x14')](function(_0x4ae13c){logger[_0x86fa('0x10')](_0x86fa('0xd'),_0x1f0e92,_0x4ae13c);_0x2de438(_0x4ae13c);});});} \ No newline at end of file +var _0x9280=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x2e180b,_0x1b08c7){var _0x59e9bb=function(_0x341602){while(--_0x341602){_0x2e180b['push'](_0x2e180b['shift']());}};_0x59e9bb(++_0x1b08c7);}(_0x9280,0x113));var _0x0928=function(_0x178e27,_0x2dcbde){_0x178e27=_0x178e27-0x0;var _0x582375=_0x9280[_0x178e27];return _0x582375;};'use strict';var _=require(_0x0928('0x0'));var util=require(_0x0928('0x1'));var moment=require(_0x0928('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0928('0x3'));var db=require(_0x0928('0x4'))['db'];var utils=require(_0x0928('0x5'));var logger=require(_0x0928('0x6'))(_0x0928('0x7'));var config=require(_0x0928('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0928('0x9')][_0x0928('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51404f,_0x1c26c4,_0x47a28c){return new BPromise(function(_0x1f60a5,_0x47597d){return client['request'](_0x51404f,_0x47a28c)[_0x0928('0xb')](function(_0x15861b){logger['info'](_0x0928('0xc'),_0x1c26c4,'request\x20sent');logger[_0x0928('0xd')](_0x0928('0xe'),_0x1c26c4,_0x0928('0xf'),JSON[_0x0928('0x10')](_0x15861b));if(_0x15861b[_0x0928('0x11')]){if(_0x15861b[_0x0928('0x11')][_0x0928('0x12')]===0x1f4){logger[_0x0928('0x11')](_0x0928('0xc'),_0x1c26c4,_0x15861b[_0x0928('0x11')][_0x0928('0x13')]);return _0x47597d(_0x15861b[_0x0928('0x11')][_0x0928('0x13')]);}logger['error'](_0x0928('0xc'),_0x1c26c4,_0x15861b[_0x0928('0x11')][_0x0928('0x13')]);return _0x1f60a5(_0x15861b[_0x0928('0x11')][_0x0928('0x13')]);}else{logger['info'](_0x0928('0xc'),_0x1c26c4,_0x0928('0xf'));_0x1f60a5(_0x15861b['result'][_0x0928('0x13')]);}})['catch'](function(_0x3700d6){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1c26c4,_0x3700d6);_0x47597d(_0x3700d6);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 9153d6c..2c69491 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 _0xe641=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','post','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x56d1ed,_0x237e84){var _0x1b282b=function(_0x56648c){while(--_0x56648c){_0x56d1ed['push'](_0x56d1ed['shift']());}};_0x1b282b(++_0x237e84);}(_0xe641,0xea));var _0x1e64=function(_0x30f583,_0x42b6a8){_0x30f583=_0x30f583-0x0;var _0xf24311=_0xe641[_0x30f583];return _0xf24311;};'use strict';var multer=require(_0x1e64('0x0'));var util=require(_0x1e64('0x1'));var path=require(_0x1e64('0x2'));var timeout=require(_0x1e64('0x3'));var express=require(_0x1e64('0x4'));var router=express[_0x1e64('0x5')]();var fs_extra=require(_0x1e64('0x6'));var auth=require(_0x1e64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1e64('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x1e64('0x9')]('/',auth[_0x1e64('0xa')](),controller[_0x1e64('0xb')]);router[_0x1e64('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1e64('0xc')]);router[_0x1e64('0x9')](_0x1e64('0xd'),auth[_0x1e64('0xa')](),controller[_0x1e64('0xe')]);router[_0x1e64('0xf')]('/',auth[_0x1e64('0xa')](),controller['create']);router[_0x1e64('0x10')](_0x1e64('0x11'),auth[_0x1e64('0xa')](),controller[_0x1e64('0x12')]);router[_0x1e64('0x13')](_0x1e64('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf4e7=['Router','fs-extra','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5b7b22,_0x5bc479){var _0x53dc9d=function(_0x5108c0){while(--_0x5108c0){_0x5b7b22['push'](_0x5b7b22['shift']());}};_0x53dc9d(++_0x5bc479);}(_0xf4e7,0x154));var _0x7f4e=function(_0x5f30b9,_0x196dad){_0x5f30b9=_0x5f30b9-0x0;var _0x3e8ee9=_0xf4e7[_0x5f30b9];return _0x3e8ee9;};'use strict';var multer=require(_0x7f4e('0x0'));var util=require(_0x7f4e('0x1'));var path=require(_0x7f4e('0x2'));var timeout=require(_0x7f4e('0x3'));var express=require(_0x7f4e('0x4'));var router=express[_0x7f4e('0x5')]();var fs_extra=require(_0x7f4e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7f4e('0x7'));var controller=require(_0x7f4e('0x8'));router[_0x7f4e('0x9')]('/',auth[_0x7f4e('0xa')](),controller[_0x7f4e('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7f4e('0xc')]);router[_0x7f4e('0x9')](_0x7f4e('0xd'),auth[_0x7f4e('0xa')](),controller[_0x7f4e('0xe')]);router[_0x7f4e('0xf')]('/',auth[_0x7f4e('0xa')](),controller[_0x7f4e('0x10')]);router[_0x7f4e('0x11')](_0x7f4e('0x12'),auth[_0x7f4e('0xa')](),controller[_0x7f4e('0x13')]);router[_0x7f4e('0x14')](_0x7f4e('0x12'),auth[_0x7f4e('0xa')](),controller[_0x7f4e('0x15')]);module[_0x7f4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c7ed436..21f9e6f 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 _0xd03f=['STRING','BOOLEAN','sequelize','exports'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0xd03f,0x16e));var _0xfd03=function(_0xe391aa,_0x255528){_0xe391aa=_0xe391aa-0x0;var _0x793c4d=_0xd03f[_0xe391aa];return _0x793c4d;};'use strict';var Sequelize=require(_0xfd03('0x0'));module[_0xfd03('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xfd03('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xfd03('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xfd03('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x59ad=['BOOLEAN','exports','TEXT','STRING'];(function(_0xe650fa,_0x28e061){var _0x21f96b=function(_0x167c65){while(--_0x167c65){_0xe650fa['push'](_0xe650fa['shift']());}};_0x21f96b(++_0x28e061);}(_0x59ad,0x1bd));var _0xd59a=function(_0x6830be,_0x5817ec){_0x6830be=_0x6830be-0x0;var _0x2127af=_0x59ad[_0x6830be];return _0x2127af;};'use strict';var Sequelize=require('sequelize');module[_0xd59a('0x0')]={'field':{'type':Sequelize[_0xd59a('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xd59a('0x2')]},'groupBy':{'type':Sequelize[_0xd59a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xd59a('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 bd2664d..990e9a6 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 _0x5a49=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','AnalyticFieldReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x5a49,0x1e7));var _0x95a4=function(_0x329a91,_0x2b1d8f){_0x329a91=_0x329a91-0x0;var _0x3294a8=_0x5a49[_0x329a91];return _0x3294a8;};'use strict';var emlformat=require(_0x95a4('0x0'));var rimraf=require(_0x95a4('0x1'));var zipdir=require(_0x95a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95a4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95a4('0x4'));var util=require(_0x95a4('0x5'));var path=require(_0x95a4('0x6'));var sox=require(_0x95a4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95a4('0x8'));var _=require(_0x95a4('0x9'));var squel=require('squel');var crypto=require(_0x95a4('0xa'));var jsforce=require(_0x95a4('0xb'));var deskjs=require(_0x95a4('0xc'));var toCsv=require(_0x95a4('0xd'));var querystring=require(_0x95a4('0xe'));var Papa=require(_0x95a4('0xf'));var Redis=require(_0x95a4('0x10'));var authService=require(_0x95a4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x95a4('0x12'));var hardwareService=require(_0x95a4('0x13'));var logger=require('../../config/logger')(_0x95a4('0x14'));var utils=require(_0x95a4('0x15'));var config=require(_0x95a4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x95a4('0x17'))['db'];function respondWithStatusCode(_0x44073d,_0x2ee8b1){_0x2ee8b1=_0x2ee8b1||0xcc;return function(_0x2095d9){if(_0x2095d9){return _0x44073d[_0x95a4('0x18')](_0x2ee8b1);}return _0x44073d[_0x95a4('0x19')](_0x2ee8b1)['end']();};}function respondWithResult(_0x25b9a1,_0x496c7b){_0x496c7b=_0x496c7b||0xc8;return function(_0x4656cf){if(_0x4656cf){return _0x25b9a1[_0x95a4('0x19')](_0x496c7b)[_0x95a4('0x1a')](_0x4656cf);}};}function respondWithFilteredResult(_0x34f7ce,_0x11ca6c){return function(_0x31749e){if(_0x31749e){var _0x4fae15=typeof _0x11ca6c[_0x95a4('0x1b')]===_0x95a4('0x1c')&&typeof _0x11ca6c[_0x95a4('0x1d')]===_0x95a4('0x1c');var _0x2a38d0=_0x31749e[_0x95a4('0x1e')];var _0x2dad27=_0x4fae15?0x0:_0x11ca6c[_0x95a4('0x1b')];var _0x2ae7d6=_0x4fae15?_0x31749e['count']:_0x11ca6c[_0x95a4('0x1b')]+_0x11ca6c[_0x95a4('0x1d')];var _0x425807;if(_0x2ae7d6>=_0x2a38d0){_0x2ae7d6=_0x2a38d0;_0x425807=0xc8;}else{_0x425807=0xce;}_0x34f7ce[_0x95a4('0x19')](_0x425807);return _0x34f7ce[_0x95a4('0x1f')](_0x95a4('0x20'),_0x2dad27+'-'+_0x2ae7d6+'/'+_0x2a38d0)['json'](_0x31749e);}return null;};}function patchUpdates(_0x46a4dc){return function(_0x20b932){try{jsonpatch[_0x95a4('0x21')](_0x20b932,_0x46a4dc,!![]);}catch(_0x2c4127){return BPromise[_0x95a4('0x22')](_0x2c4127);}return _0x20b932[_0x95a4('0x23')]();};}function saveUpdates(_0x586db8,_0x3ab2ad){return function(_0x68f88){if(_0x68f88){return _0x68f88[_0x95a4('0x24')](_0x586db8)[_0x95a4('0x25')](function(_0x441d72){return _0x441d72;});}return null;};}function removeEntity(_0x589d73,_0x504478){return function(_0x16575b){if(_0x16575b){return _0x16575b[_0x95a4('0x26')]()[_0x95a4('0x25')](function(){_0x589d73[_0x95a4('0x19')](0xcc)[_0x95a4('0x27')]();});}};}function handleEntityNotFound(_0x57ad12,_0x48ba44){return function(_0x1dc2b9){if(!_0x1dc2b9){_0x57ad12[_0x95a4('0x18')](0x194);}return _0x1dc2b9;};}function handleError(_0x3a5ed3,_0x31524b){_0x31524b=_0x31524b||0x1f4;return function(_0x2cd049){logger[_0x95a4('0x28')](_0x2cd049['stack']);if(_0x2cd049[_0x95a4('0x29')]){delete _0x2cd049['name'];}_0x3a5ed3[_0x95a4('0x19')](_0x31524b)[_0x95a4('0x2a')](_0x2cd049);};}exports[_0x95a4('0x2b')]=function(_0x42fbab,_0xbd0056){var _0x5a591d={},_0x16123b={},_0x57526a={'count':0x0,'rows':[]};var _0x34f0ef=_[_0x95a4('0x2c')](db[_0x95a4('0x2d')]['rawAttributes'],function(_0x3e5f8b){return{'name':_0x3e5f8b[_0x95a4('0x2e')],'type':_0x3e5f8b[_0x95a4('0x2f')][_0x95a4('0x30')]};});_0x16123b['model']=_[_0x95a4('0x2c')](_0x34f0ef,_0x95a4('0x29'));_0x16123b[_0x95a4('0x31')]=_[_0x95a4('0x32')](_0x42fbab[_0x95a4('0x31')]);_0x16123b[_0x95a4('0x33')]=_[_0x95a4('0x34')](_0x16123b[_0x95a4('0x35')],_0x16123b[_0x95a4('0x31')]);_0x5a591d[_0x95a4('0x36')]=_['intersection'](_0x16123b[_0x95a4('0x35')],qs[_0x95a4('0x37')](_0x42fbab[_0x95a4('0x31')][_0x95a4('0x37')]));_0x5a591d[_0x95a4('0x36')]=_0x5a591d[_0x95a4('0x36')][_0x95a4('0x38')]?_0x5a591d[_0x95a4('0x36')]:_0x16123b['model'];if(!_0x42fbab[_0x95a4('0x31')][_0x95a4('0x39')](_0x95a4('0x3a'))){_0x5a591d[_0x95a4('0x1d')]=qs['limit'](_0x42fbab[_0x95a4('0x31')]['limit']);_0x5a591d[_0x95a4('0x1b')]=qs[_0x95a4('0x1b')](_0x42fbab['query'][_0x95a4('0x1b')]);}_0x5a591d[_0x95a4('0x3b')]=qs['sort'](_0x42fbab[_0x95a4('0x31')][_0x95a4('0x3c')]);_0x5a591d['where']=qs[_0x95a4('0x33')](_[_0x95a4('0x3d')](_0x42fbab[_0x95a4('0x31')],_0x16123b[_0x95a4('0x33')]),_0x34f0ef);if(_0x42fbab['query']['filter']){_0x5a591d['where']=_[_0x95a4('0x3e')](_0x5a591d[_0x95a4('0x3f')],{'$or':_['map'](_0x34f0ef,function(_0x4d1108){if(_0x4d1108[_0x95a4('0x2f')]!==_0x95a4('0x40')){var _0x36404a={};_0x36404a[_0x4d1108['name']]={'$like':'%'+_0x42fbab[_0x95a4('0x31')][_0x95a4('0x41')]+'%'};return _0x36404a;}})});}_0x5a591d=_['merge']({},_0x5a591d,_0x42fbab[_0x95a4('0x42')]);var _0x96cbbc={'where':_0x5a591d[_0x95a4('0x3f')]};return db[_0x95a4('0x2d')][_0x95a4('0x1e')](_0x96cbbc)[_0x95a4('0x25')](function(_0x45f8e2){_0x57526a['count']=_0x45f8e2;if(_0x42fbab[_0x95a4('0x31')][_0x95a4('0x43')]){_0x5a591d[_0x95a4('0x44')]=[{'all':!![]}];}return db[_0x95a4('0x2d')][_0x95a4('0x45')](_0x5a591d);})[_0x95a4('0x25')](function(_0x3a1970){_0x57526a['rows']=_0x3a1970;return _0x57526a;})[_0x95a4('0x25')](respondWithFilteredResult(_0xbd0056,_0x5a591d))['catch'](handleError(_0xbd0056,null));};exports[_0x95a4('0x46')]=function(_0x544db5,_0x18d98f){var _0x40b7cb={'raw':![],'where':{'id':_0x544db5[_0x95a4('0x47')]['id']}},_0xd40964={};_0xd40964[_0x95a4('0x35')]=_['keys'](db[_0x95a4('0x2d')][_0x95a4('0x48')]);_0xd40964[_0x95a4('0x31')]=_[_0x95a4('0x32')](_0x544db5['query']);_0xd40964[_0x95a4('0x33')]=_[_0x95a4('0x34')](_0xd40964[_0x95a4('0x35')],_0xd40964[_0x95a4('0x31')]);_0x40b7cb[_0x95a4('0x36')]=_['intersection'](_0xd40964[_0x95a4('0x35')],qs[_0x95a4('0x37')](_0x544db5[_0x95a4('0x31')][_0x95a4('0x37')]));_0x40b7cb[_0x95a4('0x36')]=_0x40b7cb['attributes'][_0x95a4('0x38')]?_0x40b7cb[_0x95a4('0x36')]:_0xd40964[_0x95a4('0x35')];if(_0x544db5[_0x95a4('0x31')][_0x95a4('0x43')]){_0x40b7cb['include']=[{'all':!![]}];}_0x40b7cb=_[_0x95a4('0x3e')]({},_0x40b7cb,_0x544db5[_0x95a4('0x42')]);return db[_0x95a4('0x2d')][_0x95a4('0x49')](_0x40b7cb)['then'](handleEntityNotFound(_0x18d98f,null))[_0x95a4('0x25')](respondWithResult(_0x18d98f,null))[_0x95a4('0x4a')](handleError(_0x18d98f,null));};exports[_0x95a4('0x4b')]=function(_0x113693,_0x5b64fd){return db[_0x95a4('0x2d')]['create'](_0x113693[_0x95a4('0x4c')],{})[_0x95a4('0x25')](respondWithResult(_0x5b64fd,0xc9))[_0x95a4('0x4a')](handleError(_0x5b64fd,null));};exports['bulkCreate']=function(_0x1cf314,_0x229ca2){return db[_0x95a4('0x2d')][_0x95a4('0x4d')](_0x1cf314['body'],{'raw':![],'individualHooks':!![]})[_0x95a4('0x25')](respondWithResult(_0x229ca2,0xc9))[_0x95a4('0x4a')](handleError(_0x229ca2,null));};exports['update']=function(_0x561515,_0x511e00){if(_0x561515['body']['id']){delete _0x561515[_0x95a4('0x4c')]['id'];}return db['AnalyticFieldReport'][_0x95a4('0x49')]({'where':{'id':_0x561515[_0x95a4('0x47')]['id']}})[_0x95a4('0x25')](handleEntityNotFound(_0x511e00,null))['then'](saveUpdates(_0x561515[_0x95a4('0x4c')],null))['then'](respondWithResult(_0x511e00,null))[_0x95a4('0x4a')](handleError(_0x511e00,null));};exports[_0x95a4('0x26')]=function(_0x46ce47,_0xdd0b2e){return db[_0x95a4('0x2d')][_0x95a4('0x49')]({'where':{'id':_0x46ce47[_0x95a4('0x47')]['id']}})[_0x95a4('0x25')](handleEntityNotFound(_0xdd0b2e,null))[_0x95a4('0x25')](removeEntity(_0xdd0b2e,null))['catch'](handleError(_0xdd0b2e,null));};exports[_0x95a4('0x4e')]=function(_0x3049fb,_0xf8f4fb){return db['AnalyticFieldReport'][_0x95a4('0x26')]({'where':{'id':_0x3049fb[_0x95a4('0x31')][_0x95a4('0x4f')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xf8f4fb,0xcc))[_0x95a4('0x4a')](handleError(_0xf8f4fb,null));};exports[_0x95a4('0x50')]=function(_0x54b07f,_0x5a04eb,_0x2ed4e4){return db[_0x95a4('0x51')]['findOne']({'where':{'id':_0x54b07f['params']['id']}})[_0x95a4('0x25')](handleEntityNotFound(_0x5a04eb,null))['then'](function(_0x24cd65){if(_0x24cd65){return db[_0x95a4('0x52')][_0x95a4('0x53')](function(_0x179930){return db[_0x95a4('0x2d')][_0x95a4('0x26')]({'where':{'CustomReportId':_0x54b07f[_0x95a4('0x47')]['id']},'transaction':_0x179930})[_0x95a4('0x25')](function(_0x5b9d27){var _0x8029d6=_[_0x95a4('0x2c')](_0x54b07f[_0x95a4('0x4c')],function(_0x104b08){delete _0x104b08['id'];_0x104b08['CustomReportId']=_0x54b07f[_0x95a4('0x47')]['id'];return _0x104b08;});return db[_0x95a4('0x2d')]['bulkCreate'](_0x8029d6,{'transaction':_0x179930});});})[_0x95a4('0x25')](function(){return db[_0x95a4('0x2d')][_0x95a4('0x45')]({'where':{'CustomReportId':_0x54b07f['params']['id']}});});}})[_0x95a4('0x25')](respondWithResult(_0x5a04eb,null))[_0x95a4('0x4a')](handleError(_0x5a04eb,null));}; \ No newline at end of file +var _0x1d3c=['error','name','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','length','find','create','body','catch','bulkCreate','destroy','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus'];(function(_0x1140c3,_0x562621){var _0x2d0b43=function(_0x20bc1e){while(--_0x20bc1e){_0x1140c3['push'](_0x1140c3['shift']());}};_0x2d0b43(++_0x562621);}(_0x1d3c,0x1c7));var _0xc1d3=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0x1d3c[_0x4667b2];return _0x1070f2;};'use strict';var emlformat=require(_0xc1d3('0x0'));var rimraf=require(_0xc1d3('0x1'));var zipdir=require(_0xc1d3('0x2'));var jsonpatch=require(_0xc1d3('0x3'));var rp=require(_0xc1d3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1d3('0x5'));var path=require(_0xc1d3('0x6'));var sox=require(_0xc1d3('0x7'));var csv=require(_0xc1d3('0x8'));var ejs=require(_0xc1d3('0x9'));var fs=require('fs');var fs_extra=require(_0xc1d3('0xa'));var _=require('lodash');var squel=require(_0xc1d3('0xb'));var crypto=require(_0xc1d3('0xc'));var jsforce=require(_0xc1d3('0xd'));var deskjs=require(_0xc1d3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc1d3('0xf'));var authService=require(_0xc1d3('0x10'));var qs=require(_0xc1d3('0x11'));var as=require(_0xc1d3('0x12'));var hardwareService=require(_0xc1d3('0x13'));var logger=require(_0xc1d3('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc1d3('0x15'));var licenseUtil=require(_0xc1d3('0x16'));var db=require(_0xc1d3('0x17'))['db'];function respondWithStatusCode(_0xa6ef78,_0x58c5a8){_0x58c5a8=_0x58c5a8||0xcc;return function(_0x319e86){if(_0x319e86){return _0xa6ef78['sendStatus'](_0x58c5a8);}return _0xa6ef78[_0xc1d3('0x18')](_0x58c5a8)[_0xc1d3('0x19')]();};}function respondWithResult(_0x2866fa,_0x5a206e){_0x5a206e=_0x5a206e||0xc8;return function(_0x3a2408){if(_0x3a2408){return _0x2866fa[_0xc1d3('0x18')](_0x5a206e)[_0xc1d3('0x1a')](_0x3a2408);}};}function respondWithFilteredResult(_0x405d43,_0x393bc0){return function(_0x24ffdd){if(_0x24ffdd){var _0x795219=typeof _0x393bc0['offset']===_0xc1d3('0x1b')&&typeof _0x393bc0['limit']===_0xc1d3('0x1b');var _0x4b36be=_0x24ffdd['count'];var _0x4b14f5=_0x795219?0x0:_0x393bc0[_0xc1d3('0x1c')];var _0x431f0e=_0x795219?_0x24ffdd['count']:_0x393bc0[_0xc1d3('0x1c')]+_0x393bc0[_0xc1d3('0x1d')];var _0x4a708f;if(_0x431f0e>=_0x4b36be){_0x431f0e=_0x4b36be;_0x4a708f=0xc8;}else{_0x4a708f=0xce;}_0x405d43['status'](_0x4a708f);return _0x405d43[_0xc1d3('0x1e')](_0xc1d3('0x1f'),_0x4b14f5+'-'+_0x431f0e+'/'+_0x4b36be)[_0xc1d3('0x1a')](_0x24ffdd);}return null;};}function patchUpdates(_0x20c688){return function(_0x255145){try{jsonpatch[_0xc1d3('0x20')](_0x255145,_0x20c688,!![]);}catch(_0x3ad214){return BPromise[_0xc1d3('0x21')](_0x3ad214);}return _0x255145['save']();};}function saveUpdates(_0x1ae1f9,_0xad94f7){return function(_0x2b3e27){if(_0x2b3e27){return _0x2b3e27[_0xc1d3('0x22')](_0x1ae1f9)[_0xc1d3('0x23')](function(_0x2b9d3d){return _0x2b9d3d;});}return null;};}function removeEntity(_0xea51aa,_0x4917f2){return function(_0x1d6d1b){if(_0x1d6d1b){return _0x1d6d1b['destroy']()[_0xc1d3('0x23')](function(){_0xea51aa['status'](0xcc)[_0xc1d3('0x19')]();});}};}function handleEntityNotFound(_0x4ecf49,_0x6e7559){return function(_0x1eaadd){if(!_0x1eaadd){_0x4ecf49[_0xc1d3('0x24')](0x194);}return _0x1eaadd;};}function handleError(_0x1fb545,_0x466949){_0x466949=_0x466949||0x1f4;return function(_0x4a1422){logger[_0xc1d3('0x25')](_0x4a1422['stack']);if(_0x4a1422[_0xc1d3('0x26')]){delete _0x4a1422['name'];}_0x1fb545[_0xc1d3('0x18')](_0x466949)['send'](_0x4a1422);};}exports[_0xc1d3('0x27')]=function(_0x849553,_0x5da72e){var _0x3f288b={},_0x363358={},_0x29706a={'count':0x0,'rows':[]};var _0x3f4b92=_['map'](db[_0xc1d3('0x28')][_0xc1d3('0x29')],function(_0x406cd4){return{'name':_0x406cd4[_0xc1d3('0x2a')],'type':_0x406cd4[_0xc1d3('0x2b')][_0xc1d3('0x2c')]};});_0x363358[_0xc1d3('0x2d')]=_[_0xc1d3('0x2e')](_0x3f4b92,_0xc1d3('0x26'));_0x363358[_0xc1d3('0x2f')]=_['keys'](_0x849553[_0xc1d3('0x2f')]);_0x363358['filters']=_[_0xc1d3('0x30')](_0x363358[_0xc1d3('0x2d')],_0x363358[_0xc1d3('0x2f')]);_0x3f288b[_0xc1d3('0x31')]=_[_0xc1d3('0x30')](_0x363358[_0xc1d3('0x2d')],qs[_0xc1d3('0x32')](_0x849553['query'][_0xc1d3('0x32')]));_0x3f288b[_0xc1d3('0x31')]=_0x3f288b[_0xc1d3('0x31')]['length']?_0x3f288b[_0xc1d3('0x31')]:_0x363358[_0xc1d3('0x2d')];if(!_0x849553['query'][_0xc1d3('0x33')]('nolimit')){_0x3f288b['limit']=qs[_0xc1d3('0x1d')](_0x849553[_0xc1d3('0x2f')][_0xc1d3('0x1d')]);_0x3f288b[_0xc1d3('0x1c')]=qs[_0xc1d3('0x1c')](_0x849553[_0xc1d3('0x2f')][_0xc1d3('0x1c')]);}_0x3f288b['order']=qs[_0xc1d3('0x34')](_0x849553[_0xc1d3('0x2f')][_0xc1d3('0x34')]);_0x3f288b[_0xc1d3('0x35')]=qs[_0xc1d3('0x36')](_[_0xc1d3('0x37')](_0x849553['query'],_0x363358[_0xc1d3('0x36')]),_0x3f4b92);if(_0x849553['query'][_0xc1d3('0x38')]){_0x3f288b['where']=_[_0xc1d3('0x39')](_0x3f288b['where'],{'$or':_['map'](_0x3f4b92,function(_0x26bc91){if(_0x26bc91[_0xc1d3('0x2b')]!==_0xc1d3('0x3a')){var _0x41da28={};_0x41da28[_0x26bc91[_0xc1d3('0x26')]]={'$like':'%'+_0x849553[_0xc1d3('0x2f')][_0xc1d3('0x38')]+'%'};return _0x41da28;}})});}_0x3f288b=_[_0xc1d3('0x39')]({},_0x3f288b,_0x849553[_0xc1d3('0x3b')]);var _0x4748e3={'where':_0x3f288b['where']};return db['AnalyticFieldReport'][_0xc1d3('0x3c')](_0x4748e3)[_0xc1d3('0x23')](function(_0x6043f4){_0x29706a[_0xc1d3('0x3c')]=_0x6043f4;if(_0x849553[_0xc1d3('0x2f')][_0xc1d3('0x3d')]){_0x3f288b[_0xc1d3('0x3e')]=[{'all':!![]}];}return db[_0xc1d3('0x28')]['findAll'](_0x3f288b);})[_0xc1d3('0x23')](function(_0x212cf6){_0x29706a[_0xc1d3('0x3f')]=_0x212cf6;return _0x29706a;})['then'](respondWithFilteredResult(_0x5da72e,_0x3f288b))['catch'](handleError(_0x5da72e,null));};exports[_0xc1d3('0x40')]=function(_0x39f322,_0x221bed){var _0x468f5a={'raw':![],'where':{'id':_0x39f322[_0xc1d3('0x41')]['id']}},_0x5997f1={};_0x5997f1[_0xc1d3('0x2d')]=_[_0xc1d3('0x42')](db[_0xc1d3('0x28')][_0xc1d3('0x29')]);_0x5997f1['query']=_['keys'](_0x39f322[_0xc1d3('0x2f')]);_0x5997f1[_0xc1d3('0x36')]=_[_0xc1d3('0x30')](_0x5997f1[_0xc1d3('0x2d')],_0x5997f1[_0xc1d3('0x2f')]);_0x468f5a[_0xc1d3('0x31')]=_[_0xc1d3('0x30')](_0x5997f1[_0xc1d3('0x2d')],qs[_0xc1d3('0x32')](_0x39f322[_0xc1d3('0x2f')][_0xc1d3('0x32')]));_0x468f5a['attributes']=_0x468f5a['attributes'][_0xc1d3('0x43')]?_0x468f5a['attributes']:_0x5997f1[_0xc1d3('0x2d')];if(_0x39f322[_0xc1d3('0x2f')][_0xc1d3('0x3d')]){_0x468f5a['include']=[{'all':!![]}];}_0x468f5a=_[_0xc1d3('0x39')]({},_0x468f5a,_0x39f322[_0xc1d3('0x3b')]);return db[_0xc1d3('0x28')][_0xc1d3('0x44')](_0x468f5a)[_0xc1d3('0x23')](handleEntityNotFound(_0x221bed,null))[_0xc1d3('0x23')](respondWithResult(_0x221bed,null))['catch'](handleError(_0x221bed,null));};exports[_0xc1d3('0x45')]=function(_0x447e9d,_0x172cd6){return db['AnalyticFieldReport'][_0xc1d3('0x45')](_0x447e9d[_0xc1d3('0x46')],{})[_0xc1d3('0x23')](respondWithResult(_0x172cd6,0xc9))[_0xc1d3('0x47')](handleError(_0x172cd6,null));};exports[_0xc1d3('0x48')]=function(_0x5a2455,_0xcf2c24){return db[_0xc1d3('0x28')][_0xc1d3('0x48')](_0x5a2455['body'],{'raw':![],'individualHooks':!![]})[_0xc1d3('0x23')](respondWithResult(_0xcf2c24,0xc9))[_0xc1d3('0x47')](handleError(_0xcf2c24,null));};exports[_0xc1d3('0x22')]=function(_0x4a21c6,_0x20796d){if(_0x4a21c6[_0xc1d3('0x46')]['id']){delete _0x4a21c6[_0xc1d3('0x46')]['id'];}return db['AnalyticFieldReport'][_0xc1d3('0x44')]({'where':{'id':_0x4a21c6[_0xc1d3('0x41')]['id']}})['then'](handleEntityNotFound(_0x20796d,null))[_0xc1d3('0x23')](saveUpdates(_0x4a21c6[_0xc1d3('0x46')],null))['then'](respondWithResult(_0x20796d,null))[_0xc1d3('0x47')](handleError(_0x20796d,null));};exports[_0xc1d3('0x49')]=function(_0x56d1cb,_0x2d5b91){return db[_0xc1d3('0x28')][_0xc1d3('0x44')]({'where':{'id':_0x56d1cb[_0xc1d3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d5b91,null))[_0xc1d3('0x23')](removeEntity(_0x2d5b91,null))[_0xc1d3('0x47')](handleError(_0x2d5b91,null));};exports[_0xc1d3('0x4a')]=function(_0x2e416c,_0x195b9b){return db[_0xc1d3('0x28')][_0xc1d3('0x49')]({'where':{'id':_0x2e416c[_0xc1d3('0x2f')][_0xc1d3('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x195b9b,0xcc))[_0xc1d3('0x47')](handleError(_0x195b9b,null));};exports['addFields']=function(_0x366b1c,_0x286544,_0x173f1e){return db[_0xc1d3('0x4c')][_0xc1d3('0x4d')]({'where':{'id':_0x366b1c['params']['id']}})['then'](handleEntityNotFound(_0x286544,null))[_0xc1d3('0x23')](function(_0xbfbf4f){if(_0xbfbf4f){return db[_0xc1d3('0x4e')][_0xc1d3('0x4f')](function(_0x2a782a){return db[_0xc1d3('0x28')][_0xc1d3('0x49')]({'where':{'CustomReportId':_0x366b1c[_0xc1d3('0x41')]['id']},'transaction':_0x2a782a})[_0xc1d3('0x23')](function(_0x45b268){var _0x349ba4=_[_0xc1d3('0x2e')](_0x366b1c[_0xc1d3('0x46')],function(_0xd81085){delete _0xd81085['id'];_0xd81085[_0xc1d3('0x50')]=_0x366b1c[_0xc1d3('0x41')]['id'];return _0xd81085;});return db['AnalyticFieldReport']['bulkCreate'](_0x349ba4,{'transaction':_0x2a782a});});})[_0xc1d3('0x23')](function(){return db['AnalyticFieldReport'][_0xc1d3('0x51')]({'where':{'CustomReportId':_0x366b1c[_0xc1d3('0x41')]['id']}});});}})[_0xc1d3('0x23')](respondWithResult(_0x286544,null))['catch'](handleError(_0x286544,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 5d7d6d1..9335f1a 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 _0x88da=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','moment'];(function(_0xcf4690,_0x1888f6){var _0x1a5ebe=function(_0x1c428c){while(--_0x1c428c){_0xcf4690['push'](_0xcf4690['shift']());}};_0x1a5ebe(++_0x1888f6);}(_0x88da,0xa5));var _0xa88d=function(_0x5cb25e,_0x120a7f){_0x5cb25e=_0x5cb25e-0x0;var _0xe7d756=_0x88da[_0x5cb25e];return _0xe7d756;};'use strict';var _=require(_0xa88d('0x0'));var util=require(_0xa88d('0x1'));var logger=require(_0xa88d('0x2'))('api');var moment=require(_0xa88d('0x3'));var BPromise=require(_0xa88d('0x4'));var rp=require(_0xa88d('0x5'));var fs=require('fs');var path=require(_0xa88d('0x6'));var rimraf=require(_0xa88d('0x7'));var config=require(_0xa88d('0x8'));var attributes=require(_0xa88d('0x9'));module[_0xa88d('0xa')]=function(_0xa8a29e,_0x37a735){return _0xa8a29e[_0xa88d('0xb')](_0xa88d('0xc'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44a0=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','../../config/logger','moment','request-promise'];(function(_0x1cc32e,_0x1f278f){var _0x1dac9a=function(_0x1fb7a0){while(--_0x1fb7a0){_0x1cc32e['push'](_0x1cc32e['shift']());}};_0x1dac9a(++_0x1f278f);}(_0x44a0,0x193));var _0x044a=function(_0x4891a7,_0x566170){_0x4891a7=_0x4891a7-0x0;var _0x20a6aa=_0x44a0[_0x4891a7];return _0x20a6aa;};'use strict';var _=require(_0x044a('0x0'));var util=require('util');var logger=require(_0x044a('0x1'))('api');var moment=require(_0x044a('0x2'));var BPromise=require('bluebird');var rp=require(_0x044a('0x3'));var fs=require('fs');var path=require(_0x044a('0x4'));var rimraf=require(_0x044a('0x5'));var config=require(_0x044a('0x6'));var attributes=require(_0x044a('0x7'));module[_0x044a('0x8')]=function(_0x35e5ce,_0x476d49){return _0x35e5ce[_0x044a('0x9')](_0x044a('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index eb6904b..e0fb259 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 _0xbefc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4a7b7e,_0x1d1bf4){var _0xffd584=function(_0x6cb30c){while(--_0x6cb30c){_0x4a7b7e['push'](_0x4a7b7e['shift']());}};_0xffd584(++_0x1d1bf4);}(_0xbefc,0x80));var _0xcbef=function(_0x42af56,_0x4eaefe){_0x42af56=_0x42af56-0x0;var _0x2e5696=_0xbefc[_0x42af56];return _0x2e5696;};'use strict';var _=require(_0xcbef('0x0'));var util=require(_0xcbef('0x1'));var moment=require(_0xcbef('0x2'));var BPromise=require(_0xcbef('0x3'));var rs=require(_0xcbef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbef('0x5'))['db'];var utils=require(_0xcbef('0x6'));var logger=require(_0xcbef('0x7'))('rpc');var config=require(_0xcbef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcbef('0x9')][_0xcbef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528bdc,_0x235ad4,_0x2d4702){return new BPromise(function(_0x51c81d,_0x5c7eb6){return client['request'](_0x528bdc,_0x2d4702)['then'](function(_0x212734){logger[_0xcbef('0xb')](_0xcbef('0xc'),_0x235ad4,_0xcbef('0xd'));logger[_0xcbef('0xe')](_0xcbef('0xf'),_0x235ad4,'request\x20sent',JSON[_0xcbef('0x10')](_0x212734));if(_0x212734[_0xcbef('0x11')]){if(_0x212734[_0xcbef('0x11')][_0xcbef('0x12')]===0x1f4){logger[_0xcbef('0x11')](_0xcbef('0xc'),_0x235ad4,_0x212734[_0xcbef('0x11')][_0xcbef('0x13')]);return _0x5c7eb6(_0x212734[_0xcbef('0x11')][_0xcbef('0x13')]);}logger[_0xcbef('0x11')](_0xcbef('0xc'),_0x235ad4,_0x212734[_0xcbef('0x11')][_0xcbef('0x13')]);return _0x51c81d(_0x212734['error']['message']);}else{logger['info'](_0xcbef('0xc'),_0x235ad4,_0xcbef('0xd'));_0x51c81d(_0x212734[_0xcbef('0x14')][_0xcbef('0x13')]);}})[_0xcbef('0x15')](function(_0x109163){logger[_0xcbef('0x11')](_0xcbef('0xc'),_0x235ad4,_0x109163);_0x5c7eb6(_0x109163);});});} \ No newline at end of file +var _0x0826=['request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x42f6ca,_0x268900){var _0x509ea9=function(_0x45b0a2){while(--_0x45b0a2){_0x42f6ca['push'](_0x42f6ca['shift']());}};_0x509ea9(++_0x268900);}(_0x0826,0x104));var _0x6082=function(_0x15b065,_0x3b77a7){_0x15b065=_0x15b065-0x0;var _0x4cb0ae=_0x0826[_0x15b065];return _0x4cb0ae;};'use strict';var _=require(_0x6082('0x0'));var util=require(_0x6082('0x1'));var moment=require(_0x6082('0x2'));var BPromise=require(_0x6082('0x3'));var rs=require(_0x6082('0x4'));var fs=require('fs');var Redis=require(_0x6082('0x5'));var db=require(_0x6082('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6082('0x7'))(_0x6082('0x8'));var config=require(_0x6082('0x9'));var jayson=require(_0x6082('0xa'));var client=jayson[_0x6082('0xb')][_0x6082('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x85e0c1,_0x3210d1,_0x4387de){return new BPromise(function(_0x355aec,_0x23f9af){return client['request'](_0x85e0c1,_0x4387de)[_0x6082('0xd')](function(_0x4c0212){logger[_0x6082('0xe')](_0x6082('0xf'),_0x3210d1,_0x6082('0x10'));logger[_0x6082('0x11')](_0x6082('0x12'),_0x3210d1,_0x6082('0x10'),JSON['stringify'](_0x4c0212));if(_0x4c0212[_0x6082('0x13')]){if(_0x4c0212[_0x6082('0x13')][_0x6082('0x14')]===0x1f4){logger[_0x6082('0x13')](_0x6082('0xf'),_0x3210d1,_0x4c0212[_0x6082('0x13')][_0x6082('0x15')]);return _0x23f9af(_0x4c0212[_0x6082('0x13')][_0x6082('0x15')]);}logger[_0x6082('0x13')](_0x6082('0xf'),_0x3210d1,_0x4c0212[_0x6082('0x13')][_0x6082('0x15')]);return _0x355aec(_0x4c0212[_0x6082('0x13')]['message']);}else{logger[_0x6082('0xe')](_0x6082('0xf'),_0x3210d1,'request\x20sent');_0x355aec(_0x4c0212['result'][_0x6082('0x15')]);}})[_0x6082('0x16')](function(_0x276ed5){logger[_0x6082('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3210d1,_0x276ed5);_0x23f9af(_0x276ed5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c5f0115..aa0b4fc 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(_0x2e195d,_0x229650){var _0x15cf2a=function(_0x1603eb){while(--_0x1603eb){_0x2e195d['push'](_0x2e195d['shift']());}};_0x15cf2a(++_0x229650);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x58ef58,_0x2ea5b7){var _0x10117a=function(_0x4d282){while(--_0x4d282){_0x58ef58['push'](_0x58ef58['shift']());}};_0x10117a(++_0x2ea5b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 05b952e..88b7811 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 _0x9e5e=['STRING','TEXT','sequelize','exports','name'];(function(_0x2ab276,_0x2fc401){var _0x46dfb1=function(_0x44f9fc){while(--_0x44f9fc){_0x2ab276['push'](_0x2ab276['shift']());}};_0x46dfb1(++_0x2fc401);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x9e5e[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0xe9e5('0x0'));module[_0xe9e5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe9e5('0x2')},'table':{'type':Sequelize[_0xe9e5('0x3')]},'metric':{'type':Sequelize[_0xe9e5('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x38a5=['sequelize','exports','STRING','name','TEXT'];(function(_0x589172,_0x2839fa){var _0x105c51=function(_0x5eb9a5){while(--_0x5eb9a5){_0x589172['push'](_0x589172['shift']());}};_0x105c51(++_0x2839fa);}(_0x38a5,0x69));var _0x538a=function(_0x32c272,_0x1b6d58){_0x32c272=_0x32c272-0x0;var _0x534033=_0x38a5[_0x32c272];return _0x534033;};'use strict';var Sequelize=require(_0x538a('0x0'));module[_0x538a('0x1')]={'name':{'type':Sequelize[_0x538a('0x2')],'allowNull':![],'unique':_0x538a('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x538a('0x4')]},'description':{'type':Sequelize[_0x538a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9e6fbd7..64f3bc5 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x1e514e,_0x4c2113){var _0x54f8ae=function(_0xa83626){while(--_0xa83626){_0x1e514e['push'](_0x1e514e['shift']());}};_0x54f8ae(++_0x4c2113);}(_0x9a19,0x114));var _0x99a1=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x9a19[_0x3430aa];return _0x2ac5c;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Metrics','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x1a929b,_0x5dee96){var _0x39b6f9=function(_0x42afe8){while(--_0x42afe8){_0x1a929b['push'](_0x1a929b['shift']());}};_0x39b6f9(++_0x5dee96);}(_0x98a8,0x12c));var _0x898a=function(_0x338255,_0x457edc){_0x338255=_0x338255-0x0;var _0x3dc9c7=_0x98a8[_0x338255];return _0x3dc9c7;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){var _0x32eca5=_0x274cdf[_0x898a('0x25')]({'plain':!![]});var _0x1426e3='Metrics';return db[_0x898a('0x26')]['destroy']({'where':{'type':_0x1426e3,'resourceId':_0x32eca5['id']}})['then'](function(){return _0x274cdf;});})['then'](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x420b25,_0x40b3db){return function(_0x28ae6a){if(!_0x28ae6a){_0x420b25[_0x898a('0x27')](0x194);}return _0x28ae6a;};}function handleError(_0x398e98,_0xac1fc4){_0xac1fc4=_0xac1fc4||0x1f4;return function(_0xd31922){logger['error'](_0xd31922['stack']);if(_0xd31922['name']){delete _0xd31922[_0x898a('0x28')];}_0x398e98[_0x898a('0x1a')](_0xac1fc4)[_0x898a('0x29')](_0xd31922);};}exports[_0x898a('0x2a')]=function(_0x34f447,_0x560000){var _0xe3c983={},_0xf74645={},_0x18773a={'count':0x0,'rows':[]};var _0x4287da=_[_0x898a('0x2b')](db[_0x898a('0x2c')]['rawAttributes'],function(_0x7a1eb5){return{'name':_0x7a1eb5[_0x898a('0x2d')],'type':_0x7a1eb5[_0x898a('0x2e')][_0x898a('0x2f')]};});_0xf74645[_0x898a('0x30')]=_['map'](_0x4287da,'name');_0xf74645[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34f447[_0x898a('0x31')]);_0xf74645['filters']=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],_0xf74645[_0x898a('0x31')]);_0xe3c983[_0x898a('0x34')]=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],qs[_0x898a('0x35')](_0x34f447[_0x898a('0x31')]['fields']));_0xe3c983[_0x898a('0x34')]=_0xe3c983['attributes']['length']?_0xe3c983[_0x898a('0x34')]:_0xf74645['model'];if(!_0x34f447[_0x898a('0x31')]['hasOwnProperty'](_0x898a('0x36'))){_0xe3c983['limit']=qs[_0x898a('0x37')](_0x34f447[_0x898a('0x31')][_0x898a('0x37')]);_0xe3c983['offset']=qs['offset'](_0x34f447['query'][_0x898a('0x1e')]);}_0xe3c983[_0x898a('0x38')]=qs['sort'](_0x34f447[_0x898a('0x31')][_0x898a('0x39')]);_0xe3c983[_0x898a('0x3a')]=qs[_0x898a('0x3b')](_['pick'](_0x34f447['query'],_0xf74645[_0x898a('0x3b')]),_0x4287da);if(_0x34f447[_0x898a('0x31')]['filter']){_0xe3c983['where']=_[_0x898a('0x3c')](_0xe3c983[_0x898a('0x3a')],{'$or':_[_0x898a('0x2b')](_0x4287da,function(_0xa45405){if(_0xa45405['type']!==_0x898a('0x3d')){var _0x369c02={};_0x369c02[_0xa45405['name']]={'$like':'%'+_0x34f447['query']['filter']+'%'};return _0x369c02;}})});}_0xe3c983=_[_0x898a('0x3c')]({},_0xe3c983,_0x34f447[_0x898a('0x3e')]);var _0x35d767={'where':_0xe3c983[_0x898a('0x3a')]};return db[_0x898a('0x2c')][_0x898a('0x1d')](_0x35d767)[_0x898a('0x23')](function(_0x1432ec){_0x18773a[_0x898a('0x1d')]=_0x1432ec;if(_0x34f447[_0x898a('0x31')][_0x898a('0x3f')]){_0xe3c983[_0x898a('0x40')]=[{'all':!![]}];}return db[_0x898a('0x2c')][_0x898a('0x41')](_0xe3c983);})[_0x898a('0x23')](function(_0x4c8628){_0x18773a[_0x898a('0x42')]=_0x4c8628;return _0x18773a;})[_0x898a('0x23')](respondWithFilteredResult(_0x560000,_0xe3c983))[_0x898a('0x43')](handleError(_0x560000,null));};exports['show']=function(_0x34029e,_0x2e5451){var _0x3a8663={'raw':!![],'where':{'id':_0x34029e[_0x898a('0x44')]['id']}},_0x6ab441={};_0x6ab441[_0x898a('0x30')]=_[_0x898a('0x32')](db[_0x898a('0x2c')]['rawAttributes']);_0x6ab441[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34029e[_0x898a('0x31')]);_0x6ab441[_0x898a('0x3b')]=_['intersection'](_0x6ab441[_0x898a('0x30')],_0x6ab441[_0x898a('0x31')]);_0x3a8663['attributes']=_[_0x898a('0x33')](_0x6ab441['model'],qs[_0x898a('0x35')](_0x34029e['query']['fields']));_0x3a8663[_0x898a('0x34')]=_0x3a8663['attributes'][_0x898a('0x45')]?_0x3a8663[_0x898a('0x34')]:_0x6ab441['model'];if(_0x34029e[_0x898a('0x31')][_0x898a('0x3f')]){_0x3a8663['include']=[{'all':!![]}];}_0x3a8663=_[_0x898a('0x3c')]({},_0x3a8663,_0x34029e[_0x898a('0x3e')]);return db[_0x898a('0x2c')][_0x898a('0x46')](_0x3a8663)['then'](handleEntityNotFound(_0x2e5451,null))[_0x898a('0x23')](respondWithResult(_0x2e5451,null))[_0x898a('0x43')](handleError(_0x2e5451,null));};exports['create']=function(_0x25adcc,_0x1d8c16){return db['AnalyticMetric'][_0x898a('0x47')](_0x25adcc['body'],{})[_0x898a('0x23')](function(_0x41f291){var _0x32ccb9=_0x25adcc['user'][_0x898a('0x25')]({'plain':!![]});if(!_0x32ccb9)throw new Error(_0x898a('0x48'));if(_0x32ccb9[_0x898a('0x49')]===_0x898a('0x4a')){var _0x5a8a2c=_0x41f291[_0x898a('0x25')]({'plain':!![]});var _0x529d7c=_0x898a('0x4b');return db[_0x898a('0x4c')][_0x898a('0x46')]({'where':{'name':_0x529d7c,'userProfileId':_0x32ccb9['userProfileId']},'raw':!![]})[_0x898a('0x23')](function(_0x3c4db0){if(_0x3c4db0&&_0x3c4db0[_0x898a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a8a2c[_0x898a('0x28')],'resourceId':_0x5a8a2c['id'],'type':_0x3c4db0[_0x898a('0x28')],'sectionId':_0x3c4db0['id']},{})[_0x898a('0x23')](function(){return _0x41f291;});}else{return _0x41f291;}})[_0x898a('0x43')](function(_0x28b8c9){logger[_0x898a('0x4e')](_0x898a('0x4f'),_0x28b8c9);throw _0x28b8c9;});}return _0x41f291;})[_0x898a('0x23')](respondWithResult(_0x1d8c16,0xc9))[_0x898a('0x43')](handleError(_0x1d8c16,null));};exports[_0x898a('0x22')]=function(_0x2382a9,_0x5e9329){if(_0x2382a9[_0x898a('0x50')]['id']){delete _0x2382a9[_0x898a('0x50')]['id'];}return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x2382a9['params']['id']}})['then'](handleEntityNotFound(_0x5e9329,null))[_0x898a('0x23')](saveUpdates(_0x2382a9[_0x898a('0x50')],null))[_0x898a('0x23')](respondWithResult(_0x5e9329,null))['catch'](handleError(_0x5e9329,null));};exports['destroy']=function(_0x11a07a,_0x1f5e4b){return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x11a07a[_0x898a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5e4b,null))[_0x898a('0x23')](removeEntity(_0x1f5e4b,null))[_0x898a('0x43')](handleError(_0x1f5e4b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 38d414a..5156e2d 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 _0xbe2a=['rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1bb321,_0x16ce37){var _0x4b2937=function(_0x36a9b6){while(--_0x36a9b6){_0x1bb321['push'](_0x1bb321['shift']());}};_0x4b2937(++_0x16ce37);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x47dd4a,_0x8ecd84){_0x47dd4a=_0x47dd4a-0x0;var _0xf70f7c=_0xbe2a[_0x47dd4a];return _0xf70f7c;};'use strict';var _=require(_0xabe2('0x0'));var util=require(_0xabe2('0x1'));var logger=require(_0xabe2('0x2'))(_0xabe2('0x3'));var moment=require(_0xabe2('0x4'));var BPromise=require(_0xabe2('0x5'));var rp=require(_0xabe2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabe2('0x7'));var config=require('../../config/environment');var attributes=require(_0xabe2('0x8'));module[_0xabe2('0x9')]=function(_0x2ddf42,_0x475007){return _0x2ddf42[_0xabe2('0xa')](_0xabe2('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0689=['define','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x0689,0x161));var _0x9068=function(_0x1abfc4,_0x1e1298){_0x1abfc4=_0x1abfc4-0x0;var _0x1e6a3e=_0x0689[_0x1abfc4];return _0x1e6a3e;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var logger=require('../../config/logger')(_0x9068('0x1'));var moment=require(_0x9068('0x2'));var BPromise=require(_0x9068('0x3'));var rp=require(_0x9068('0x4'));var fs=require('fs');var path=require(_0x9068('0x5'));var rimraf=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var attributes=require(_0x9068('0x8'));module[_0x9068('0x9')]=function(_0x287846,_0x5ce5a7){return _0x287846[_0x9068('0xa')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 96152e2..ebc3a40 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 _0x3bfc=['then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0xe41a46,_0x144159){var _0x3d970c=function(_0x97c741){while(--_0x97c741){_0xe41a46['push'](_0xe41a46['shift']());}};_0x3d970c(++_0x144159);}(_0x3bfc,0x154));var _0xc3bf=function(_0x2cea58,_0x153c15){_0x2cea58=_0x2cea58-0x0;var _0x192933=_0x3bfc[_0x2cea58];return _0x192933;};'use strict';var _=require(_0xc3bf('0x0'));var util=require(_0xc3bf('0x1'));var moment=require(_0xc3bf('0x2'));var BPromise=require(_0xc3bf('0x3'));var rs=require(_0xc3bf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3bf('0x5'))['db'];var utils=require(_0xc3bf('0x6'));var logger=require(_0xc3bf('0x7'))('rpc');var config=require(_0xc3bf('0x8'));var jayson=require(_0xc3bf('0x9'));var client=jayson['client'][_0xc3bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22877f,_0x425b45,_0x24601c){return new BPromise(function(_0x1cebaf,_0x42813e){return client[_0xc3bf('0xb')](_0x22877f,_0x24601c)[_0xc3bf('0xc')](function(_0x38c2ef){logger[_0xc3bf('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x425b45,_0xc3bf('0xe'));logger[_0xc3bf('0xf')](_0xc3bf('0x10'),_0x425b45,_0xc3bf('0xe'),JSON[_0xc3bf('0x11')](_0x38c2ef));if(_0x38c2ef[_0xc3bf('0x12')]){if(_0x38c2ef['error']['code']===0x1f4){logger['error'](_0xc3bf('0x13'),_0x425b45,_0x38c2ef[_0xc3bf('0x12')]['message']);return _0x42813e(_0x38c2ef['error'][_0xc3bf('0x14')]);}logger[_0xc3bf('0x12')](_0xc3bf('0x13'),_0x425b45,_0x38c2ef[_0xc3bf('0x12')][_0xc3bf('0x14')]);return _0x1cebaf(_0x38c2ef['error'][_0xc3bf('0x14')]);}else{logger[_0xc3bf('0xd')](_0xc3bf('0x13'),_0x425b45,_0xc3bf('0xe'));_0x1cebaf(_0x38c2ef['result'][_0xc3bf('0x14')]);}})[_0xc3bf('0x15')](function(_0xb14e0c){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x425b45,_0xb14e0c);_0x42813e(_0xb14e0c);});});} \ No newline at end of file +var _0x9f66=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x547030,_0x5ac365){var _0x20dd29=function(_0x138efd){while(--_0x138efd){_0x547030['push'](_0x547030['shift']());}};_0x20dd29(++_0x5ac365);}(_0x9f66,0x1be));var _0x69f6=function(_0x28150d,_0x276ffa){_0x28150d=_0x28150d-0x0;var _0x52fd33=_0x9f66[_0x28150d];return _0x52fd33;};'use strict';var _=require(_0x69f6('0x0'));var util=require(_0x69f6('0x1'));var moment=require(_0x69f6('0x2'));var BPromise=require(_0x69f6('0x3'));var rs=require(_0x69f6('0x4'));var fs=require('fs');var Redis=require(_0x69f6('0x5'));var db=require(_0x69f6('0x6'))['db'];var utils=require(_0x69f6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x69f6('0x8'));var jayson=require(_0x69f6('0x9'));var client=jayson[_0x69f6('0xa')][_0x69f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9bc56e,_0x3b8a76,_0x43fb93){return new BPromise(function(_0x39757e,_0x2b62e5){return client[_0x69f6('0xc')](_0x9bc56e,_0x43fb93)[_0x69f6('0xd')](function(_0x38b147){logger[_0x69f6('0xe')](_0x69f6('0xf'),_0x3b8a76,_0x69f6('0x10'));logger['debug'](_0x69f6('0x11'),_0x3b8a76,_0x69f6('0x10'),JSON[_0x69f6('0x12')](_0x38b147));if(_0x38b147[_0x69f6('0x13')]){if(_0x38b147[_0x69f6('0x13')]['code']===0x1f4){logger[_0x69f6('0x13')](_0x69f6('0xf'),_0x3b8a76,_0x38b147['error']['message']);return _0x2b62e5(_0x38b147['error'][_0x69f6('0x14')]);}logger[_0x69f6('0x13')](_0x69f6('0xf'),_0x3b8a76,_0x38b147[_0x69f6('0x13')][_0x69f6('0x14')]);return _0x39757e(_0x38b147['error'][_0x69f6('0x14')]);}else{logger[_0x69f6('0xe')](_0x69f6('0xf'),_0x3b8a76,'request\x20sent');_0x39757e(_0x38b147[_0x69f6('0x15')]['message']);}})[_0x69f6('0x16')](function(_0x54a435){logger['error'](_0x69f6('0xf'),_0x3b8a76,_0x54a435);_0x2b62e5(_0x54a435);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7e40cf9..84aee45 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 _0x27a8=['/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index'];(function(_0x5e3212,_0x2b36de){var _0x62f793=function(_0x371267){while(--_0x371267){_0x5e3212['push'](_0x5e3212['shift']());}};_0x62f793(++_0x2b36de);}(_0x27a8,0x170));var _0x827a=function(_0x2f3fe7,_0x4048ba){_0x2f3fe7=_0x2f3fe7-0x0;var _0xbc9d29=_0x27a8[_0x2f3fe7];return _0xbc9d29;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x827a('0x0'));var timeout=require(_0x827a('0x1'));var express=require(_0x827a('0x2'));var router=express[_0x827a('0x3')]();var fs_extra=require(_0x827a('0x4'));var auth=require(_0x827a('0x5'));var interaction=require(_0x827a('0x6'));var config=require(_0x827a('0x7'));var controller=require(_0x827a('0x8'));router[_0x827a('0x9')]('/',auth[_0x827a('0xa')](),controller[_0x827a('0xb')]);router[_0x827a('0x9')](_0x827a('0xc'),auth[_0x827a('0xa')](),controller[_0x827a('0xd')]);router[_0x827a('0xe')]('/',auth[_0x827a('0xa')](),controller[_0x827a('0xf')]);router[_0x827a('0x10')](_0x827a('0xc'),auth[_0x827a('0xa')](),controller[_0x827a('0x11')]);router['delete']('/:id',auth[_0x827a('0xa')](),controller[_0x827a('0x12')]);module[_0x827a('0x13')]=router; \ No newline at end of file +var _0xa23f=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','delete','exports','multer','util','express','Router'];(function(_0x150d4a,_0x2ee3d8){var _0x1d31ec=function(_0x4a794a){while(--_0x4a794a){_0x150d4a['push'](_0x150d4a['shift']());}};_0x1d31ec(++_0x2ee3d8);}(_0xa23f,0x7c));var _0xfa23=function(_0x59e068,_0x8ce760){_0x59e068=_0x59e068-0x0;var _0x1a7f9e=_0xa23f[_0x59e068];return _0x1a7f9e;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var fs_extra=require(_0xfa23('0x4'));var auth=require(_0xfa23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa23('0x6'));var controller=require('./analyticMetric.controller');router[_0xfa23('0x7')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0x9')]);router[_0xfa23('0x7')]('/:id',auth[_0xfa23('0x8')](),controller['show']);router[_0xfa23('0xa')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0xb')]);router[_0xfa23('0xc')](_0xfa23('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xfa23('0xe')]('/:id',auth[_0xfa23('0x8')](),controller['destroy']);module[_0xfa23('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 ca4c962..f61c294 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 _0x2664=['TEXT','sequelize','exports'];(function(_0x4c8833,_0x14e755){var _0x30df54=function(_0x197811){while(--_0x197811){_0x4c8833['push'](_0x4c8833['shift']());}};_0x30df54(++_0x14e755);}(_0x2664,0x127));var _0x4266=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2664[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x4266('0x0'));module[_0x4266('0x1')]={'tree':{'type':Sequelize[_0x4266('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3bca=['sequelize','exports','TEXT'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x3bca,0x132));var _0xa3bc=function(_0x58927c,_0x47c5f0){_0x58927c=_0x58927c-0x0;var _0x1100c2=_0x3bca[_0x58927c];return _0x1100c2;};'use strict';var Sequelize=require(_0xa3bc('0x0'));module[_0xa3bc('0x1')]={'tree':{'type':Sequelize[_0xa3bc('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 cd9072d..ddd9165 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 _0x9788=['catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','include','AnalyticTreeReport','findAll','rows','show','params','rawAttributes','intersection','find','create','body'];(function(_0x3f3b97,_0x395d93){var _0xb6ab0c=function(_0x330c5a){while(--_0x330c5a){_0x3f3b97['push'](_0x3f3b97['shift']());}};_0xb6ab0c(++_0x395d93);}(_0x9788,0x1db));var _0x8978=function(_0x30a616,_0x16f281){_0x30a616=_0x30a616-0x0;var _0x29d79d=_0x9788[_0x30a616];return _0x29d79d;};'use strict';var emlformat=require(_0x8978('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8978('0x1'));var jsonpatch=require(_0x8978('0x2'));var rp=require(_0x8978('0x3'));var moment=require(_0x8978('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8978('0x5'));var util=require(_0x8978('0x6'));var path=require(_0x8978('0x7'));var sox=require(_0x8978('0x8'));var csv=require('to-csv');var ejs=require(_0x8978('0x9'));var fs=require('fs');var fs_extra=require(_0x8978('0xa'));var _=require(_0x8978('0xb'));var squel=require('squel');var crypto=require(_0x8978('0xc'));var jsforce=require(_0x8978('0xd'));var deskjs=require(_0x8978('0xe'));var toCsv=require(_0x8978('0xf'));var querystring=require('querystring');var Papa=require(_0x8978('0x10'));var Redis=require(_0x8978('0x11'));var authService=require(_0x8978('0x12'));var qs=require(_0x8978('0x13'));var as=require(_0x8978('0x14'));var hardwareService=require(_0x8978('0x15'));var logger=require(_0x8978('0x16'))(_0x8978('0x17'));var utils=require(_0x8978('0x18'));var config=require(_0x8978('0x19'));var licenseUtil=require(_0x8978('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x106aa2,_0x39e1d2){_0x39e1d2=_0x39e1d2||0xcc;return function(_0x9d3140){if(_0x9d3140){return _0x106aa2['sendStatus'](_0x39e1d2);}return _0x106aa2[_0x8978('0x1b')](_0x39e1d2)[_0x8978('0x1c')]();};}function respondWithResult(_0x43deef,_0x4e7d48){_0x4e7d48=_0x4e7d48||0xc8;return function(_0x8ce215){if(_0x8ce215){return _0x43deef[_0x8978('0x1b')](_0x4e7d48)['json'](_0x8ce215);}};}function respondWithFilteredResult(_0x2eff35,_0x2fb17d){return function(_0x3e1e9c){if(_0x3e1e9c){var _0x244f57=typeof _0x2fb17d[_0x8978('0x1d')]===_0x8978('0x1e')&&typeof _0x2fb17d[_0x8978('0x1f')]===_0x8978('0x1e');var _0x479a60=_0x3e1e9c[_0x8978('0x20')];var _0x5b65c7=_0x244f57?0x0:_0x2fb17d[_0x8978('0x1d')];var _0x52cd18=_0x244f57?_0x3e1e9c[_0x8978('0x20')]:_0x2fb17d[_0x8978('0x1d')]+_0x2fb17d[_0x8978('0x1f')];var _0x5ec7ec;if(_0x52cd18>=_0x479a60){_0x52cd18=_0x479a60;_0x5ec7ec=0xc8;}else{_0x5ec7ec=0xce;}_0x2eff35['status'](_0x5ec7ec);return _0x2eff35[_0x8978('0x21')](_0x8978('0x22'),_0x5b65c7+'-'+_0x52cd18+'/'+_0x479a60)['json'](_0x3e1e9c);}return null;};}function patchUpdates(_0x2a7666){return function(_0x165f58){try{jsonpatch[_0x8978('0x23')](_0x165f58,_0x2a7666,!![]);}catch(_0x2c13b3){return BPromise['reject'](_0x2c13b3);}return _0x165f58[_0x8978('0x24')]();};}function saveUpdates(_0x5c9998,_0x33a5d7){return function(_0xa98e86){if(_0xa98e86){return _0xa98e86[_0x8978('0x25')](_0x5c9998)[_0x8978('0x26')](function(_0x2569e2){return _0x2569e2;});}return null;};}function removeEntity(_0x2a430c,_0x145bb7){return function(_0x1b7758){if(_0x1b7758){return _0x1b7758[_0x8978('0x27')]()[_0x8978('0x26')](function(){_0x2a430c[_0x8978('0x1b')](0xcc)[_0x8978('0x1c')]();});}};}function handleEntityNotFound(_0x4c49fe,_0x46785b){return function(_0xda73b4){if(!_0xda73b4){_0x4c49fe[_0x8978('0x28')](0x194);}return _0xda73b4;};}function handleError(_0x226715,_0x1fb755){_0x1fb755=_0x1fb755||0x1f4;return function(_0x71a77b){logger[_0x8978('0x29')](_0x71a77b[_0x8978('0x2a')]);if(_0x71a77b['name']){delete _0x71a77b[_0x8978('0x2b')];}_0x226715[_0x8978('0x1b')](_0x1fb755)[_0x8978('0x2c')](_0x71a77b);};}exports[_0x8978('0x2d')]=function(_0x1f212c,_0x4e4250){var _0x350b15={},_0x231501={},_0x4c74c7={'count':0x0,'rows':[]};var _0x57b8a4=_[_0x8978('0x2e')](db['AnalyticTreeReport']['rawAttributes'],function(_0x2dc634){return{'name':_0x2dc634[_0x8978('0x2f')],'type':_0x2dc634['type'][_0x8978('0x30')]};});_0x231501[_0x8978('0x31')]=_[_0x8978('0x2e')](_0x57b8a4,_0x8978('0x2b'));_0x231501[_0x8978('0x32')]=_[_0x8978('0x33')](_0x1f212c[_0x8978('0x32')]);_0x231501[_0x8978('0x34')]=_['intersection'](_0x231501[_0x8978('0x31')],_0x231501[_0x8978('0x32')]);_0x350b15[_0x8978('0x35')]=_['intersection'](_0x231501['model'],qs[_0x8978('0x36')](_0x1f212c['query'][_0x8978('0x36')]));_0x350b15[_0x8978('0x35')]=_0x350b15['attributes'][_0x8978('0x37')]?_0x350b15[_0x8978('0x35')]:_0x231501[_0x8978('0x31')];if(!_0x1f212c['query'][_0x8978('0x38')](_0x8978('0x39'))){_0x350b15[_0x8978('0x1f')]=qs[_0x8978('0x1f')](_0x1f212c[_0x8978('0x32')][_0x8978('0x1f')]);_0x350b15[_0x8978('0x1d')]=qs[_0x8978('0x1d')](_0x1f212c[_0x8978('0x32')][_0x8978('0x1d')]);}_0x350b15['order']=qs[_0x8978('0x3a')](_0x1f212c[_0x8978('0x32')]['sort']);_0x350b15['where']=qs[_0x8978('0x34')](_[_0x8978('0x3b')](_0x1f212c[_0x8978('0x32')],_0x231501[_0x8978('0x34')]),_0x57b8a4);if(_0x1f212c['query']['filter']){_0x350b15[_0x8978('0x3c')]=_['merge'](_0x350b15['where'],{'$or':_['map'](_0x57b8a4,function(_0xd4d885){if(_0xd4d885[_0x8978('0x3d')]!==_0x8978('0x3e')){var _0xf03683={};_0xf03683[_0xd4d885[_0x8978('0x2b')]]={'$like':'%'+_0x1f212c[_0x8978('0x32')][_0x8978('0x3f')]+'%'};return _0xf03683;}})});}_0x350b15=_[_0x8978('0x40')]({},_0x350b15,_0x1f212c[_0x8978('0x41')]);var _0x22ef6c={'where':_0x350b15['where']};return db['AnalyticTreeReport'][_0x8978('0x20')](_0x22ef6c)[_0x8978('0x26')](function(_0x131b0e){_0x4c74c7['count']=_0x131b0e;if(_0x1f212c[_0x8978('0x32')][_0x8978('0x42')]){_0x350b15[_0x8978('0x43')]=[{'all':!![]}];}return db[_0x8978('0x44')][_0x8978('0x45')](_0x350b15);})[_0x8978('0x26')](function(_0x3301f7){_0x4c74c7[_0x8978('0x46')]=_0x3301f7;return _0x4c74c7;})['then'](respondWithFilteredResult(_0x4e4250,_0x350b15))['catch'](handleError(_0x4e4250,null));};exports[_0x8978('0x47')]=function(_0x4d4d3e,_0x4d7ccf){var _0x53fcfe={'raw':!![],'where':{'id':_0x4d4d3e[_0x8978('0x48')]['id']}},_0x4972c1={};_0x4972c1[_0x8978('0x31')]=_[_0x8978('0x33')](db[_0x8978('0x44')][_0x8978('0x49')]);_0x4972c1[_0x8978('0x32')]=_[_0x8978('0x33')](_0x4d4d3e[_0x8978('0x32')]);_0x4972c1[_0x8978('0x34')]=_['intersection'](_0x4972c1[_0x8978('0x31')],_0x4972c1['query']);_0x53fcfe[_0x8978('0x35')]=_[_0x8978('0x4a')](_0x4972c1[_0x8978('0x31')],qs[_0x8978('0x36')](_0x4d4d3e[_0x8978('0x32')]['fields']));_0x53fcfe[_0x8978('0x35')]=_0x53fcfe[_0x8978('0x35')][_0x8978('0x37')]?_0x53fcfe[_0x8978('0x35')]:_0x4972c1[_0x8978('0x31')];if(_0x4d4d3e[_0x8978('0x32')][_0x8978('0x42')]){_0x53fcfe[_0x8978('0x43')]=[{'all':!![]}];}_0x53fcfe=_['merge']({},_0x53fcfe,_0x4d4d3e[_0x8978('0x41')]);return db[_0x8978('0x44')][_0x8978('0x4b')](_0x53fcfe)['then'](handleEntityNotFound(_0x4d7ccf,null))['then'](respondWithResult(_0x4d7ccf,null))['catch'](handleError(_0x4d7ccf,null));};exports[_0x8978('0x4c')]=function(_0x193827,_0x236eca){return db['AnalyticTreeReport'][_0x8978('0x4c')](_0x193827[_0x8978('0x4d')],{})[_0x8978('0x26')](respondWithResult(_0x236eca,0xc9))['catch'](handleError(_0x236eca,null));};exports[_0x8978('0x25')]=function(_0x3933be,_0x7a070b){if(_0x3933be['body']['id']){delete _0x3933be[_0x8978('0x4d')]['id'];}return db['AnalyticTreeReport'][_0x8978('0x4b')]({'where':{'id':_0x3933be['params']['id']}})[_0x8978('0x26')](handleEntityNotFound(_0x7a070b,null))[_0x8978('0x26')](saveUpdates(_0x3933be['body'],null))['then'](respondWithResult(_0x7a070b,null))[_0x8978('0x4e')](handleError(_0x7a070b,null));};exports[_0x8978('0x27')]=function(_0x587579,_0x3fda7e){return db[_0x8978('0x44')][_0x8978('0x4b')]({'where':{'id':_0x587579[_0x8978('0x48')]['id']}})[_0x8978('0x26')](handleEntityNotFound(_0x3fda7e,null))[_0x8978('0x26')](removeEntity(_0x3fda7e,null))['catch'](handleError(_0x3fda7e,null));}; \ No newline at end of file +var _0xb96b=['end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','keys','filters','intersection','query','fields','attributes','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1b515f,_0x52aa6b){var _0x66ff73=function(_0x2cc081){while(--_0x2cc081){_0x1b515f['push'](_0x1b515f['shift']());}};_0x66ff73(++_0x52aa6b);}(_0xb96b,0xfd));var _0xbb96=function(_0x2d991c,_0x1583d4){_0x2d991c=_0x2d991c-0x0;var _0x3d5af5=_0xb96b[_0x2d991c];return _0x3d5af5;};'use strict';var emlformat=require(_0xbb96('0x0'));var rimraf=require(_0xbb96('0x1'));var zipdir=require(_0xbb96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbb96('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbb96('0x4'));var sox=require(_0xbb96('0x5'));var csv=require('to-csv');var ejs=require(_0xbb96('0x6'));var fs=require('fs');var fs_extra=require(_0xbb96('0x7'));var _=require(_0xbb96('0x8'));var squel=require(_0xbb96('0x9'));var crypto=require(_0xbb96('0xa'));var jsforce=require(_0xbb96('0xb'));var deskjs=require(_0xbb96('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbb96('0xd'));var Papa=require(_0xbb96('0xe'));var Redis=require(_0xbb96('0xf'));var authService=require(_0xbb96('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbb96('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbb96('0x12'));var utils=require('../../config/utils');var config=require(_0xbb96('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb96('0x14'))['db'];function respondWithStatusCode(_0x50f376,_0x1369a1){_0x1369a1=_0x1369a1||0xcc;return function(_0x10462a){if(_0x10462a){return _0x50f376[_0xbb96('0x15')](_0x1369a1);}return _0x50f376[_0xbb96('0x16')](_0x1369a1)[_0xbb96('0x17')]();};}function respondWithResult(_0x154b6f,_0x7e0bf9){_0x7e0bf9=_0x7e0bf9||0xc8;return function(_0x238b7c){if(_0x238b7c){return _0x154b6f[_0xbb96('0x16')](_0x7e0bf9)[_0xbb96('0x18')](_0x238b7c);}};}function respondWithFilteredResult(_0x410ca0,_0x43b182){return function(_0x19855e){if(_0x19855e){var _0x8079c0=typeof _0x43b182[_0xbb96('0x19')]===_0xbb96('0x1a')&&typeof _0x43b182[_0xbb96('0x1b')]===_0xbb96('0x1a');var _0xf17f90=_0x19855e[_0xbb96('0x1c')];var _0x1703bb=_0x8079c0?0x0:_0x43b182[_0xbb96('0x19')];var _0x77d361=_0x8079c0?_0x19855e[_0xbb96('0x1c')]:_0x43b182[_0xbb96('0x19')]+_0x43b182[_0xbb96('0x1b')];var _0x273013;if(_0x77d361>=_0xf17f90){_0x77d361=_0xf17f90;_0x273013=0xc8;}else{_0x273013=0xce;}_0x410ca0[_0xbb96('0x16')](_0x273013);return _0x410ca0['set'](_0xbb96('0x1d'),_0x1703bb+'-'+_0x77d361+'/'+_0xf17f90)[_0xbb96('0x18')](_0x19855e);}return null;};}function patchUpdates(_0x2a5e9b){return function(_0x1ea65c){try{jsonpatch[_0xbb96('0x1e')](_0x1ea65c,_0x2a5e9b,!![]);}catch(_0x8da8d5){return BPromise[_0xbb96('0x1f')](_0x8da8d5);}return _0x1ea65c[_0xbb96('0x20')]();};}function saveUpdates(_0x574a7e,_0x49b16e){return function(_0x1adc62){if(_0x1adc62){return _0x1adc62[_0xbb96('0x21')](_0x574a7e)['then'](function(_0xeed2fa){return _0xeed2fa;});}return null;};}function removeEntity(_0x3748ec,_0x28ec20){return function(_0x4bd3f6){if(_0x4bd3f6){return _0x4bd3f6['destroy']()[_0xbb96('0x22')](function(){_0x3748ec[_0xbb96('0x16')](0xcc)[_0xbb96('0x17')]();});}};}function handleEntityNotFound(_0x32c5c7,_0xd78b3c){return function(_0x5a82e5){if(!_0x5a82e5){_0x32c5c7[_0xbb96('0x15')](0x194);}return _0x5a82e5;};}function handleError(_0x52280b,_0x31b124){_0x31b124=_0x31b124||0x1f4;return function(_0x4a9ca6){logger['error'](_0x4a9ca6[_0xbb96('0x23')]);if(_0x4a9ca6[_0xbb96('0x24')]){delete _0x4a9ca6['name'];}_0x52280b[_0xbb96('0x16')](_0x31b124)['send'](_0x4a9ca6);};}exports[_0xbb96('0x25')]=function(_0x4b8162,_0x4bb140){var _0xe18b22={},_0x55d7c9={},_0x102119={'count':0x0,'rows':[]};var _0x5d9e8f=_[_0xbb96('0x26')](db[_0xbb96('0x27')][_0xbb96('0x28')],function(_0x49fdae){return{'name':_0x49fdae[_0xbb96('0x29')],'type':_0x49fdae[_0xbb96('0x2a')][_0xbb96('0x2b')]};});_0x55d7c9['model']=_[_0xbb96('0x26')](_0x5d9e8f,_0xbb96('0x24'));_0x55d7c9['query']=_[_0xbb96('0x2c')](_0x4b8162['query']);_0x55d7c9[_0xbb96('0x2d')]=_[_0xbb96('0x2e')](_0x55d7c9['model'],_0x55d7c9[_0xbb96('0x2f')]);_0xe18b22['attributes']=_[_0xbb96('0x2e')](_0x55d7c9['model'],qs[_0xbb96('0x30')](_0x4b8162['query'][_0xbb96('0x30')]));_0xe18b22[_0xbb96('0x31')]=_0xe18b22[_0xbb96('0x31')][_0xbb96('0x32')]?_0xe18b22['attributes']:_0x55d7c9[_0xbb96('0x33')];if(!_0x4b8162[_0xbb96('0x2f')][_0xbb96('0x34')]('nolimit')){_0xe18b22['limit']=qs['limit'](_0x4b8162[_0xbb96('0x2f')][_0xbb96('0x1b')]);_0xe18b22[_0xbb96('0x19')]=qs[_0xbb96('0x19')](_0x4b8162[_0xbb96('0x2f')][_0xbb96('0x19')]);}_0xe18b22[_0xbb96('0x35')]=qs[_0xbb96('0x36')](_0x4b8162[_0xbb96('0x2f')]['sort']);_0xe18b22[_0xbb96('0x37')]=qs['filters'](_[_0xbb96('0x38')](_0x4b8162['query'],_0x55d7c9[_0xbb96('0x2d')]),_0x5d9e8f);if(_0x4b8162[_0xbb96('0x2f')][_0xbb96('0x39')]){_0xe18b22[_0xbb96('0x37')]=_[_0xbb96('0x3a')](_0xe18b22[_0xbb96('0x37')],{'$or':_[_0xbb96('0x26')](_0x5d9e8f,function(_0xb8d1d){if(_0xb8d1d['type']!=='VIRTUAL'){var _0x148f8c={};_0x148f8c[_0xb8d1d[_0xbb96('0x24')]]={'$like':'%'+_0x4b8162[_0xbb96('0x2f')][_0xbb96('0x39')]+'%'};return _0x148f8c;}})});}_0xe18b22=_['merge']({},_0xe18b22,_0x4b8162['options']);var _0x16aa03={'where':_0xe18b22[_0xbb96('0x37')]};return db[_0xbb96('0x27')][_0xbb96('0x1c')](_0x16aa03)[_0xbb96('0x22')](function(_0x49cea0){_0x102119[_0xbb96('0x1c')]=_0x49cea0;if(_0x4b8162[_0xbb96('0x2f')][_0xbb96('0x3b')]){_0xe18b22[_0xbb96('0x3c')]=[{'all':!![]}];}return db[_0xbb96('0x27')][_0xbb96('0x3d')](_0xe18b22);})[_0xbb96('0x22')](function(_0x5bcaf6){_0x102119[_0xbb96('0x3e')]=_0x5bcaf6;return _0x102119;})[_0xbb96('0x22')](respondWithFilteredResult(_0x4bb140,_0xe18b22))['catch'](handleError(_0x4bb140,null));};exports['show']=function(_0xdaa1e1,_0x1a6dc1){var _0x147414={'raw':!![],'where':{'id':_0xdaa1e1[_0xbb96('0x3f')]['id']}},_0x3fe0d5={};_0x3fe0d5['model']=_[_0xbb96('0x2c')](db[_0xbb96('0x27')][_0xbb96('0x28')]);_0x3fe0d5['query']=_[_0xbb96('0x2c')](_0xdaa1e1[_0xbb96('0x2f')]);_0x3fe0d5['filters']=_['intersection'](_0x3fe0d5[_0xbb96('0x33')],_0x3fe0d5[_0xbb96('0x2f')]);_0x147414[_0xbb96('0x31')]=_[_0xbb96('0x2e')](_0x3fe0d5[_0xbb96('0x33')],qs[_0xbb96('0x30')](_0xdaa1e1[_0xbb96('0x2f')]['fields']));_0x147414[_0xbb96('0x31')]=_0x147414[_0xbb96('0x31')][_0xbb96('0x32')]?_0x147414[_0xbb96('0x31')]:_0x3fe0d5[_0xbb96('0x33')];if(_0xdaa1e1[_0xbb96('0x2f')]['includeAll']){_0x147414[_0xbb96('0x3c')]=[{'all':!![]}];}_0x147414=_['merge']({},_0x147414,_0xdaa1e1[_0xbb96('0x40')]);return db['AnalyticTreeReport'][_0xbb96('0x41')](_0x147414)[_0xbb96('0x22')](handleEntityNotFound(_0x1a6dc1,null))[_0xbb96('0x22')](respondWithResult(_0x1a6dc1,null))[_0xbb96('0x42')](handleError(_0x1a6dc1,null));};exports['create']=function(_0x1d7c35,_0x4dd29f){return db['AnalyticTreeReport'][_0xbb96('0x43')](_0x1d7c35[_0xbb96('0x44')],{})[_0xbb96('0x22')](respondWithResult(_0x4dd29f,0xc9))[_0xbb96('0x42')](handleError(_0x4dd29f,null));};exports[_0xbb96('0x21')]=function(_0x2f52a4,_0x2fb24e){if(_0x2f52a4['body']['id']){delete _0x2f52a4[_0xbb96('0x44')]['id'];}return db[_0xbb96('0x27')][_0xbb96('0x41')]({'where':{'id':_0x2f52a4['params']['id']}})[_0xbb96('0x22')](handleEntityNotFound(_0x2fb24e,null))['then'](saveUpdates(_0x2f52a4[_0xbb96('0x44')],null))[_0xbb96('0x22')](respondWithResult(_0x2fb24e,null))[_0xbb96('0x42')](handleError(_0x2fb24e,null));};exports['destroy']=function(_0x298a54,_0x2afb01){return db[_0xbb96('0x27')][_0xbb96('0x41')]({'where':{'id':_0x298a54['params']['id']}})['then'](handleEntityNotFound(_0x2afb01,null))['then'](removeEntity(_0x2afb01,null))[_0xbb96('0x42')](handleError(_0x2afb01,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8391aef..3b60112 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 _0xad91=['analytics_report_trees','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport'];(function(_0x10acb2,_0x3ca870){var _0x186379=function(_0x294bbd){while(--_0x294bbd){_0x10acb2['push'](_0x10acb2['shift']());}};_0x186379(++_0x3ca870);}(_0xad91,0x105));var _0x1ad9=function(_0x1c46c5,_0x41bc70){_0x1c46c5=_0x1c46c5-0x0;var _0x4e403c=_0xad91[_0x1c46c5];return _0x4e403c;};'use strict';var _=require(_0x1ad9('0x0'));var util=require(_0x1ad9('0x1'));var logger=require(_0x1ad9('0x2'))(_0x1ad9('0x3'));var moment=require('moment');var BPromise=require(_0x1ad9('0x4'));var rp=require(_0x1ad9('0x5'));var fs=require('fs');var path=require(_0x1ad9('0x6'));var rimraf=require(_0x1ad9('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ad9('0x8'));module[_0x1ad9('0x9')]=function(_0x22f6a6,_0x96d8fb){return _0x22f6a6[_0x1ad9('0xa')](_0x1ad9('0xb'),attributes,{'tableName':_0x1ad9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3bd=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment'];(function(_0x360cf1,_0x3c9321){var _0x1d1c80=function(_0x295473){while(--_0x295473){_0x360cf1['push'](_0x360cf1['shift']());}};_0x1d1c80(++_0x3c9321);}(_0xe3bd,0x19f));var _0xde3b=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xe3bd[_0x4551f6];return _0x581dc2;};'use strict';var _=require('lodash');var util=require(_0xde3b('0x0'));var logger=require(_0xde3b('0x1'))('api');var moment=require(_0xde3b('0x2'));var BPromise=require('bluebird');var rp=require(_0xde3b('0x3'));var fs=require('fs');var path=require(_0xde3b('0x4'));var rimraf=require(_0xde3b('0x5'));var config=require(_0xde3b('0x6'));var attributes=require(_0xde3b('0x7'));module[_0xde3b('0x8')]=function(_0x5569ff,_0x29a1dc){return _0x5569ff['define'](_0xde3b('0x9'),attributes,{'tableName':_0xde3b('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 f5c38c4..ee66dcd 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5096e5,_0x4d0c54){var _0x23dd95=function(_0x26b0cf){while(--_0x26b0cf){_0x5096e5['push'](_0x5096e5['shift']());}};_0x23dd95(++_0x4d0c54);}(_0xdb28,0x106));var _0x8db2=function(_0x19abee,_0x54372e){_0x19abee=_0x19abee-0x0;var _0x23c7bd=_0xdb28[_0x19abee];return _0x23c7bd;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x272282,_0x2e94a0){var _0xedf511=function(_0x5d1ab6){while(--_0x5d1ab6){_0x272282['push'](_0x272282['shift']());}};_0xedf511(++_0x2e94a0);}(_0xadb5,0xad));var _0x5adb=function(_0x420868,_0x3719af){_0x420868=_0x420868-0x0;var _0x3a06a3=_0xadb5[_0x420868];return _0x3a06a3;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 88fb65b..fc17b5b 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 _0x2dc7=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2dc7,0x96));var _0x72dc=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x2dc7[_0x43a37c];return _0x5d1d40;};'use strict';var multer=require(_0x72dc('0x0'));var util=require(_0x72dc('0x1'));var path=require(_0x72dc('0x2'));var timeout=require(_0x72dc('0x3'));var express=require(_0x72dc('0x4'));var router=express[_0x72dc('0x5')]();var fs_extra=require(_0x72dc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x72dc('0x7'));var config=require(_0x72dc('0x8'));var controller=require(_0x72dc('0x9'));router['get']('/',auth[_0x72dc('0xa')](),controller[_0x72dc('0xb')]);router['get'](_0x72dc('0xc'),auth[_0x72dc('0xa')](),controller['show']);router[_0x72dc('0xd')]('/',auth[_0x72dc('0xa')](),controller['create']);router[_0x72dc('0xe')](_0x72dc('0xc'),auth[_0x72dc('0xa')](),controller[_0x72dc('0xf')]);router[_0x72dc('0x10')](_0x72dc('0xc'),auth[_0x72dc('0xa')](),controller[_0x72dc('0x11')]);module[_0x72dc('0x12')]=router; \ No newline at end of file +var _0xe308=['./analyticTreeReport.controller','get','index','show','post','isAuthenticated','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x13ae4a,_0x4b8c49){var _0x514426=function(_0x2a3a3b){while(--_0x2a3a3b){_0x13ae4a['push'](_0x13ae4a['shift']());}};_0x514426(++_0x4b8c49);}(_0xe308,0x175));var _0x8e30=function(_0x2d5fb2,_0x1706f1){_0x2d5fb2=_0x2d5fb2-0x0;var _0x58439d=_0xe308[_0x2d5fb2];return _0x58439d;};'use strict';var multer=require(_0x8e30('0x0'));var util=require(_0x8e30('0x1'));var path=require(_0x8e30('0x2'));var timeout=require(_0x8e30('0x3'));var express=require('express');var router=express[_0x8e30('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8e30('0x5'));var config=require(_0x8e30('0x6'));var controller=require(_0x8e30('0x7'));router[_0x8e30('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e30('0x9')]);router[_0x8e30('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8e30('0xa')]);router[_0x8e30('0xb')]('/',auth[_0x8e30('0xc')](),controller[_0x8e30('0xd')]);router[_0x8e30('0xe')](_0x8e30('0xf'),auth[_0x8e30('0xc')](),controller['update']);router[_0x8e30('0x10')](_0x8e30('0xf'),auth[_0x8e30('0xc')](),controller[_0x8e30('0x11')]);module[_0x8e30('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 841a945..f1bbd0b 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 _0xea70=['STRING','sequelize','exports'];(function(_0x5d6806,_0x54f344){var _0x21adb5=function(_0x4448f5){while(--_0x4448f5){_0x5d6806['push'](_0x5d6806['shift']());}};_0x21adb5(++_0x54f344);}(_0xea70,0x175));var _0x0ea7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xea70[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x0ea7('0x0'));module[_0x0ea7('0x1')]={'name':{'type':Sequelize[_0x0ea7('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0ea7('0x2')]}}; \ No newline at end of file +var _0xe13e=['STRING'];(function(_0x403b7c,_0x4ff6bc){var _0x4a4272=function(_0x1ce280){while(--_0x1ce280){_0x403b7c['push'](_0x403b7c['shift']());}};_0x4a4272(++_0x4ff6bc);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee13('0x0')]},'basename':{'type':Sequelize[_0xee13('0x0')]},'type':{'type':Sequelize[_0xee13('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 69edd05..778a887 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 _0x72e9=['show','params','find','clone','merge','get','updatedAt','body','createdAt','create','file','basename','filename','mimetype','ChatOfflineMessageId','join','root','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','apply','reject','update','then','destroy','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','where','pick','filters','filter','includeAll','include','findAll','rows','catch'];(function(_0x3d50a7,_0x1f6705){var _0x4017ef=function(_0x20b7d6){while(--_0x20b7d6){_0x3d50a7['push'](_0x3d50a7['shift']());}};_0x4017ef(++_0x1f6705);}(_0x72e9,0xbb));var _0x972e=function(_0x3e197b,_0x36ba95){_0x3e197b=_0x3e197b-0x0;var _0x3ba301=_0x72e9[_0x3e197b];return _0x3ba301;};'use strict';var emlformat=require(_0x972e('0x0'));var rimraf=require(_0x972e('0x1'));var zipdir=require(_0x972e('0x2'));var jsonpatch=require(_0x972e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x972e('0x4'));var Mustache=require(_0x972e('0x5'));var util=require(_0x972e('0x6'));var path=require(_0x972e('0x7'));var sox=require(_0x972e('0x8'));var csv=require(_0x972e('0x9'));var ejs=require(_0x972e('0xa'));var fs=require('fs');var fs_extra=require(_0x972e('0xb'));var _=require(_0x972e('0xc'));var squel=require(_0x972e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x972e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x972e('0xf'));var Papa=require(_0x972e('0x10'));var Redis=require('ioredis');var authService=require(_0x972e('0x11'));var qs=require(_0x972e('0x12'));var as=require(_0x972e('0x13'));var hardwareService=require(_0x972e('0x14'));var logger=require(_0x972e('0x15'))(_0x972e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x972e('0x17'))['db'];function respondWithStatusCode(_0x30f33e,_0x3d87c9){_0x3d87c9=_0x3d87c9||0xcc;return function(_0x5c5f11){if(_0x5c5f11){return _0x30f33e[_0x972e('0x18')](_0x3d87c9);}return _0x30f33e['status'](_0x3d87c9)[_0x972e('0x19')]();};}function respondWithResult(_0x3c1378,_0x403fb2){_0x403fb2=_0x403fb2||0xc8;return function(_0x479353){if(_0x479353){return _0x3c1378[_0x972e('0x1a')](_0x403fb2)[_0x972e('0x1b')](_0x479353);}};}function respondWithFilteredResult(_0x3557f8,_0x238908){return function(_0x1f595d){if(_0x1f595d){var _0x2e7440=typeof _0x238908['offset']===_0x972e('0x1c')&&typeof _0x238908[_0x972e('0x1d')]===_0x972e('0x1c');var _0x5e0d9e=_0x1f595d['count'];var _0x4f7575=_0x2e7440?0x0:_0x238908[_0x972e('0x1e')];var _0xa91f61=_0x2e7440?_0x1f595d[_0x972e('0x1f')]:_0x238908[_0x972e('0x1e')]+_0x238908[_0x972e('0x1d')];var _0x3fcc75;if(_0xa91f61>=_0x5e0d9e){_0xa91f61=_0x5e0d9e;_0x3fcc75=0xc8;}else{_0x3fcc75=0xce;}_0x3557f8[_0x972e('0x1a')](_0x3fcc75);return _0x3557f8['set']('Content-Range',_0x4f7575+'-'+_0xa91f61+'/'+_0x5e0d9e)[_0x972e('0x1b')](_0x1f595d);}return null;};}function patchUpdates(_0x231254){return function(_0x54cd66){try{jsonpatch[_0x972e('0x20')](_0x54cd66,_0x231254,!![]);}catch(_0x46388c){return BPromise[_0x972e('0x21')](_0x46388c);}return _0x54cd66['save']();};}function saveUpdates(_0x2753b2,_0xcd8afa){return function(_0x52876c){if(_0x52876c){return _0x52876c[_0x972e('0x22')](_0x2753b2)[_0x972e('0x23')](function(_0x23e4e6){return _0x23e4e6;});}return null;};}function removeEntity(_0x178c2c,_0x1b2194){return function(_0x8f32cd){if(_0x8f32cd){return _0x8f32cd[_0x972e('0x24')]()[_0x972e('0x23')](function(){_0x178c2c[_0x972e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fbed0,_0x46ca0b){return function(_0x456a6c){if(!_0x456a6c){_0x1fbed0[_0x972e('0x18')](0x194);}return _0x456a6c;};}function handleError(_0x190fc4,_0x258961){_0x258961=_0x258961||0x1f4;return function(_0x4a4164){logger[_0x972e('0x25')](_0x4a4164[_0x972e('0x26')]);if(_0x4a4164[_0x972e('0x27')]){delete _0x4a4164[_0x972e('0x27')];}_0x190fc4['status'](_0x258961)[_0x972e('0x28')](_0x4a4164);};}exports[_0x972e('0x29')]=function(_0x229894,_0x3d62df){var _0x203466={},_0x41bc44={},_0x319917={'count':0x0,'rows':[]};var _0x519d25=_['map'](db[_0x972e('0x2a')][_0x972e('0x2b')],function(_0x2098a3){return{'name':_0x2098a3[_0x972e('0x2c')],'type':_0x2098a3[_0x972e('0x2d')]['key']};});_0x41bc44[_0x972e('0x2e')]=_[_0x972e('0x2f')](_0x519d25,_0x972e('0x27'));_0x41bc44[_0x972e('0x30')]=_[_0x972e('0x31')](_0x229894['query']);_0x41bc44['filters']=_[_0x972e('0x32')](_0x41bc44[_0x972e('0x2e')],_0x41bc44['query']);_0x203466[_0x972e('0x33')]=_[_0x972e('0x32')](_0x41bc44['model'],qs[_0x972e('0x34')](_0x229894[_0x972e('0x30')]['fields']));_0x203466[_0x972e('0x33')]=_0x203466[_0x972e('0x33')][_0x972e('0x35')]?_0x203466['attributes']:_0x41bc44['model'];if(!_0x229894['query']['hasOwnProperty'](_0x972e('0x36'))){_0x203466[_0x972e('0x1d')]=qs[_0x972e('0x1d')](_0x229894[_0x972e('0x30')][_0x972e('0x1d')]);_0x203466[_0x972e('0x1e')]=qs[_0x972e('0x1e')](_0x229894[_0x972e('0x30')][_0x972e('0x1e')]);}_0x203466[_0x972e('0x37')]=qs['sort'](_0x229894['query']['sort']);_0x203466[_0x972e('0x38')]=qs['filters'](_[_0x972e('0x39')](_0x229894[_0x972e('0x30')],_0x41bc44[_0x972e('0x3a')]),_0x519d25);if(_0x229894[_0x972e('0x30')][_0x972e('0x3b')]){_0x203466[_0x972e('0x38')]=_['merge'](_0x203466[_0x972e('0x38')],{'$or':_[_0x972e('0x2f')](_0x519d25,function(_0x1051d7){if(_0x1051d7[_0x972e('0x2d')]!=='VIRTUAL'){var _0x123783={};_0x123783[_0x1051d7[_0x972e('0x27')]]={'$like':'%'+_0x229894[_0x972e('0x30')][_0x972e('0x3b')]+'%'};return _0x123783;}})});}_0x203466=_['merge']({},_0x203466,_0x229894['options']);var _0x256509={'where':_0x203466['where']};return db['Attachment'][_0x972e('0x1f')](_0x256509)[_0x972e('0x23')](function(_0x2ee097){_0x319917[_0x972e('0x1f')]=_0x2ee097;if(_0x229894['query'][_0x972e('0x3c')]){_0x203466[_0x972e('0x3d')]=[{'all':!![]}];}return db[_0x972e('0x2a')][_0x972e('0x3e')](_0x203466);})[_0x972e('0x23')](function(_0xdf5eb7){_0x319917[_0x972e('0x3f')]=_0xdf5eb7;return _0x319917;})[_0x972e('0x23')](respondWithFilteredResult(_0x3d62df,_0x203466))[_0x972e('0x40')](handleError(_0x3d62df,null));};exports[_0x972e('0x41')]=function(_0x445fa1,_0x1c6b89){var _0x2a6160={'raw':!![],'where':{'id':_0x445fa1[_0x972e('0x42')]['id']}},_0x2ed4ef={};_0x2ed4ef['model']=_[_0x972e('0x31')](db[_0x972e('0x2a')][_0x972e('0x2b')]);_0x2ed4ef[_0x972e('0x30')]=_[_0x972e('0x31')](_0x445fa1['query']);_0x2ed4ef['filters']=_['intersection'](_0x2ed4ef['model'],_0x2ed4ef[_0x972e('0x30')]);_0x2a6160[_0x972e('0x33')]=_[_0x972e('0x32')](_0x2ed4ef['model'],qs[_0x972e('0x34')](_0x445fa1[_0x972e('0x30')][_0x972e('0x34')]));_0x2a6160['attributes']=_0x2a6160['attributes'][_0x972e('0x35')]?_0x2a6160[_0x972e('0x33')]:_0x2ed4ef['model'];if(_0x445fa1[_0x972e('0x30')][_0x972e('0x3c')]){_0x2a6160[_0x972e('0x3d')]=[{'all':!![]}];}_0x2a6160=_['merge']({},_0x2a6160,_0x445fa1['options']);return db[_0x972e('0x2a')][_0x972e('0x43')](_0x2a6160)[_0x972e('0x23')](handleEntityNotFound(_0x1c6b89,null))['then'](respondWithResult(_0x1c6b89,null))[_0x972e('0x40')](handleError(_0x1c6b89,null));};exports[_0x972e('0x44')]=function(_0x3445ec,_0x475f25){var _0xa6b13f={'where':{'id':_0x3445ec[_0x972e('0x42')]['id']}},_0x21bdf9={};_0x21bdf9[_0x972e('0x2e')]=_[_0x972e('0x31')](db[_0x972e('0x2a')]['rawAttributes']);_0xa6b13f[_0x972e('0x33')]=_[_0x972e('0x32')](_0x21bdf9[_0x972e('0x2e')],qs[_0x972e('0x34')](_0x3445ec[_0x972e('0x30')]['fields']));_0xa6b13f[_0x972e('0x33')]=_0xa6b13f['attributes'][_0x972e('0x35')]?_0xa6b13f[_0x972e('0x33')]:_0x21bdf9['model'];if(_0x3445ec[_0x972e('0x30')][_0x972e('0x3c')]){_0xa6b13f['include']=[{'all':!![]}];}_0xa6b13f=_[_0x972e('0x45')]({},_0xa6b13f,_0x3445ec['options']);return db['Attachment'][_0x972e('0x43')](_0xa6b13f)[_0x972e('0x23')](handleEntityNotFound(_0x475f25,null))[_0x972e('0x23')](function(_0x5e3e3c){if(_0x5e3e3c){var _0x4a860d=_0x5e3e3c[_0x972e('0x46')]({'plain':!![]});_0x4a860d=qs['omit'](_0x4a860d,['id','createdAt',_0x972e('0x47')]);_0x3445ec['body']=_['omit'](_0x3445ec[_0x972e('0x48')],['id',_0x972e('0x49'),'updatedAt']);return db['Attachment'][_0x972e('0x4a')](_[_0x972e('0x45')](_0x4a860d,_0x3445ec[_0x972e('0x48')]),{'include':_0x3445ec[_0x972e('0x30')][_0x972e('0x3c')]?[{'all':!![]}]:undefined});}})[_0x972e('0x23')](respondWithResult(_0x475f25,0xc9))['catch'](handleError(_0x475f25,null));};exports[_0x972e('0x22')]=function(_0x3bd1ad,_0x144ec8){if(_0x3bd1ad[_0x972e('0x48')]['id']){delete _0x3bd1ad[_0x972e('0x48')]['id'];}return db[_0x972e('0x2a')][_0x972e('0x43')]({'where':{'id':_0x3bd1ad[_0x972e('0x42')]['id']}})[_0x972e('0x23')](handleEntityNotFound(_0x144ec8,null))[_0x972e('0x23')](saveUpdates(_0x3bd1ad[_0x972e('0x48')],null))['then'](respondWithResult(_0x144ec8,null))[_0x972e('0x40')](handleError(_0x144ec8,null));};exports[_0x972e('0x24')]=function(_0xd6084,_0x3bedc8){return db['Attachment'][_0x972e('0x43')]({'where':{'id':_0xd6084[_0x972e('0x42')]['id']}})[_0x972e('0x23')](handleEntityNotFound(_0x3bedc8,null))[_0x972e('0x23')](removeEntity(_0x3bedc8,null))[_0x972e('0x40')](handleError(_0x3bedc8,null));};exports[_0x972e('0x4a')]=function(_0x270339,_0x250dc4,_0x1b22fb){_0x270339['body'][_0x972e('0x27')]=_0x270339[_0x972e('0x4b')]['originalname'];_0x270339['body'][_0x972e('0x4c')]=_0x270339[_0x972e('0x4b')][_0x972e('0x4d')];_0x270339['body'][_0x972e('0x2d')]=_0x270339[_0x972e('0x4b')][_0x972e('0x4e')];return db['Attachment'][_0x972e('0x4a')](_0x270339[_0x972e('0x48')])[_0x972e('0x23')](respondWithResult(_0x250dc4,0xc9))['catch'](handleError(_0x250dc4,null));};exports['download']=function(_0x3919d8,_0x2fb3f7,_0x4e8e75){return db[_0x972e('0x2a')]['findOne']({'where':{'id':_0x3919d8[_0x972e('0x42')]['id']},'raw':!![]})[_0x972e('0x23')](handleEntityNotFound(_0x2fb3f7,null))['then'](function(_0x375323){if(_0x375323){var _0x4e6843=_0x375323[_0x972e('0x4f')]!==null;var _0x5a5ac0=path[_0x972e('0x50')](config[_0x972e('0x51')],'server/files/attachments/');if(_0x4e6843){_0x5a5ac0=path[_0x972e('0x50')](_0x5a5ac0,_0x972e('0x52'));}var _0x284c6d=path['join'](_0x5a5ac0,_0x375323[_0x972e('0x4c')]);return _0x2fb3f7[_0x972e('0x53')](_0x284c6d);}})[_0x972e('0x40')](handleError(_0x2fb3f7,null));}; \ No newline at end of file +var _0x38ff=['filters','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','clone','get','omit','body','createdAt','updatedAt','create','update','find','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','apply','reject','destroy','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x409ea0,_0x24d255){var _0x983244=function(_0x17a19){while(--_0x17a19){_0x409ea0['push'](_0x409ea0['shift']());}};_0x983244(++_0x24d255);}(_0x38ff,0x7e));var _0xf38f=function(_0xadc7d9,_0x203608){_0xadc7d9=_0xadc7d9-0x0;var _0x915ca1=_0x38ff[_0xadc7d9];return _0x915ca1;};'use strict';var emlformat=require(_0xf38f('0x0'));var rimraf=require(_0xf38f('0x1'));var zipdir=require(_0xf38f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf38f('0x3'));var moment=require(_0xf38f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf38f('0x5'));var util=require(_0xf38f('0x6'));var path=require('path');var sox=require(_0xf38f('0x7'));var csv=require(_0xf38f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf38f('0x9'));var _=require(_0xf38f('0xa'));var squel=require(_0xf38f('0xb'));var crypto=require(_0xf38f('0xc'));var jsforce=require(_0xf38f('0xd'));var deskjs=require(_0xf38f('0xe'));var toCsv=require(_0xf38f('0x8'));var querystring=require(_0xf38f('0xf'));var Papa=require(_0xf38f('0x10'));var Redis=require('ioredis');var authService=require(_0xf38f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf38f('0x12'));var hardwareService=require(_0xf38f('0x13'));var logger=require(_0xf38f('0x14'))(_0xf38f('0x15'));var utils=require(_0xf38f('0x16'));var config=require(_0xf38f('0x17'));var licenseUtil=require(_0xf38f('0x18'));var db=require(_0xf38f('0x19'))['db'];function respondWithStatusCode(_0x45748b,_0x258385){_0x258385=_0x258385||0xcc;return function(_0x2fe1f8){if(_0x2fe1f8){return _0x45748b[_0xf38f('0x1a')](_0x258385);}return _0x45748b['status'](_0x258385)[_0xf38f('0x1b')]();};}function respondWithResult(_0x3d4e22,_0x3b2af0){_0x3b2af0=_0x3b2af0||0xc8;return function(_0x46093a){if(_0x46093a){return _0x3d4e22[_0xf38f('0x1c')](_0x3b2af0)[_0xf38f('0x1d')](_0x46093a);}};}function respondWithFilteredResult(_0x358a99,_0x50cdfa){return function(_0x59465d){if(_0x59465d){var _0x1d40c2=typeof _0x50cdfa[_0xf38f('0x1e')]==='undefined'&&typeof _0x50cdfa[_0xf38f('0x1f')]===_0xf38f('0x20');var _0x3d686a=_0x59465d[_0xf38f('0x21')];var _0x454845=_0x1d40c2?0x0:_0x50cdfa['offset'];var _0xf6ff42=_0x1d40c2?_0x59465d['count']:_0x50cdfa[_0xf38f('0x1e')]+_0x50cdfa[_0xf38f('0x1f')];var _0x46a66f;if(_0xf6ff42>=_0x3d686a){_0xf6ff42=_0x3d686a;_0x46a66f=0xc8;}else{_0x46a66f=0xce;}_0x358a99[_0xf38f('0x1c')](_0x46a66f);return _0x358a99['set']('Content-Range',_0x454845+'-'+_0xf6ff42+'/'+_0x3d686a)[_0xf38f('0x1d')](_0x59465d);}return null;};}function patchUpdates(_0x2f4ac9){return function(_0x283f01){try{jsonpatch[_0xf38f('0x22')](_0x283f01,_0x2f4ac9,!![]);}catch(_0x41f84c){return BPromise[_0xf38f('0x23')](_0x41f84c);}return _0x283f01['save']();};}function saveUpdates(_0x326ee5,_0x4e3e03){return function(_0x146992){if(_0x146992){return _0x146992['update'](_0x326ee5)['then'](function(_0x4098a7){return _0x4098a7;});}return null;};}function removeEntity(_0x30c4f0,_0x1b00f3){return function(_0x293dc2){if(_0x293dc2){return _0x293dc2[_0xf38f('0x24')]()[_0xf38f('0x25')](function(){_0x30c4f0[_0xf38f('0x1c')](0xcc)[_0xf38f('0x1b')]();});}};}function handleEntityNotFound(_0x3a6020,_0x51621e){return function(_0x3f7bbc){if(!_0x3f7bbc){_0x3a6020[_0xf38f('0x1a')](0x194);}return _0x3f7bbc;};}function handleError(_0x5956ca,_0x48f86e){_0x48f86e=_0x48f86e||0x1f4;return function(_0x5dcbd6){logger[_0xf38f('0x26')](_0x5dcbd6[_0xf38f('0x27')]);if(_0x5dcbd6[_0xf38f('0x28')]){delete _0x5dcbd6[_0xf38f('0x28')];}_0x5956ca[_0xf38f('0x1c')](_0x48f86e)[_0xf38f('0x29')](_0x5dcbd6);};}exports[_0xf38f('0x2a')]=function(_0x28f247,_0x52696f){var _0x5b81ce={},_0x1d895b={},_0xf41424={'count':0x0,'rows':[]};var _0x4aecdd=_[_0xf38f('0x2b')](db[_0xf38f('0x2c')][_0xf38f('0x2d')],function(_0x57e937){return{'name':_0x57e937[_0xf38f('0x2e')],'type':_0x57e937[_0xf38f('0x2f')][_0xf38f('0x30')]};});_0x1d895b['model']=_[_0xf38f('0x2b')](_0x4aecdd,_0xf38f('0x28'));_0x1d895b[_0xf38f('0x31')]=_[_0xf38f('0x32')](_0x28f247['query']);_0x1d895b['filters']=_[_0xf38f('0x33')](_0x1d895b['model'],_0x1d895b[_0xf38f('0x31')]);_0x5b81ce['attributes']=_[_0xf38f('0x33')](_0x1d895b[_0xf38f('0x34')],qs['fields'](_0x28f247[_0xf38f('0x31')][_0xf38f('0x35')]));_0x5b81ce[_0xf38f('0x36')]=_0x5b81ce[_0xf38f('0x36')][_0xf38f('0x37')]?_0x5b81ce[_0xf38f('0x36')]:_0x1d895b['model'];if(!_0x28f247[_0xf38f('0x31')][_0xf38f('0x38')](_0xf38f('0x39'))){_0x5b81ce[_0xf38f('0x1f')]=qs[_0xf38f('0x1f')](_0x28f247[_0xf38f('0x31')][_0xf38f('0x1f')]);_0x5b81ce['offset']=qs[_0xf38f('0x1e')](_0x28f247['query'][_0xf38f('0x1e')]);}_0x5b81ce[_0xf38f('0x3a')]=qs[_0xf38f('0x3b')](_0x28f247[_0xf38f('0x31')][_0xf38f('0x3b')]);_0x5b81ce['where']=qs[_0xf38f('0x3c')](_[_0xf38f('0x3d')](_0x28f247[_0xf38f('0x31')],_0x1d895b[_0xf38f('0x3c')]),_0x4aecdd);if(_0x28f247[_0xf38f('0x31')][_0xf38f('0x3e')]){_0x5b81ce[_0xf38f('0x3f')]=_[_0xf38f('0x40')](_0x5b81ce[_0xf38f('0x3f')],{'$or':_[_0xf38f('0x2b')](_0x4aecdd,function(_0x28419d){if(_0x28419d[_0xf38f('0x2f')]!=='VIRTUAL'){var _0x4be876={};_0x4be876[_0x28419d[_0xf38f('0x28')]]={'$like':'%'+_0x28f247[_0xf38f('0x31')]['filter']+'%'};return _0x4be876;}})});}_0x5b81ce=_[_0xf38f('0x40')]({},_0x5b81ce,_0x28f247[_0xf38f('0x41')]);var _0x12f0d6={'where':_0x5b81ce[_0xf38f('0x3f')]};return db[_0xf38f('0x2c')][_0xf38f('0x21')](_0x12f0d6)['then'](function(_0x11d8b5){_0xf41424[_0xf38f('0x21')]=_0x11d8b5;if(_0x28f247['query'][_0xf38f('0x42')]){_0x5b81ce[_0xf38f('0x43')]=[{'all':!![]}];}return db[_0xf38f('0x2c')]['findAll'](_0x5b81ce);})[_0xf38f('0x25')](function(_0x3a1509){_0xf41424[_0xf38f('0x44')]=_0x3a1509;return _0xf41424;})['then'](respondWithFilteredResult(_0x52696f,_0x5b81ce))[_0xf38f('0x45')](handleError(_0x52696f,null));};exports[_0xf38f('0x46')]=function(_0x2c0309,_0x2a4e14){var _0x2ca5b4={'raw':!![],'where':{'id':_0x2c0309[_0xf38f('0x47')]['id']}},_0x5980ad={};_0x5980ad[_0xf38f('0x34')]=_['keys'](db[_0xf38f('0x2c')]['rawAttributes']);_0x5980ad[_0xf38f('0x31')]=_['keys'](_0x2c0309['query']);_0x5980ad[_0xf38f('0x3c')]=_['intersection'](_0x5980ad[_0xf38f('0x34')],_0x5980ad[_0xf38f('0x31')]);_0x2ca5b4[_0xf38f('0x36')]=_[_0xf38f('0x33')](_0x5980ad[_0xf38f('0x34')],qs[_0xf38f('0x35')](_0x2c0309[_0xf38f('0x31')][_0xf38f('0x35')]));_0x2ca5b4['attributes']=_0x2ca5b4['attributes'][_0xf38f('0x37')]?_0x2ca5b4['attributes']:_0x5980ad[_0xf38f('0x34')];if(_0x2c0309[_0xf38f('0x31')][_0xf38f('0x42')]){_0x2ca5b4[_0xf38f('0x43')]=[{'all':!![]}];}_0x2ca5b4=_[_0xf38f('0x40')]({},_0x2ca5b4,_0x2c0309[_0xf38f('0x41')]);return db[_0xf38f('0x2c')]['find'](_0x2ca5b4)[_0xf38f('0x25')](handleEntityNotFound(_0x2a4e14,null))[_0xf38f('0x25')](respondWithResult(_0x2a4e14,null))[_0xf38f('0x45')](handleError(_0x2a4e14,null));};exports[_0xf38f('0x48')]=function(_0xb1af4f,_0x26f3a0){var _0xe616c6={'where':{'id':_0xb1af4f[_0xf38f('0x47')]['id']}},_0x373f66={};_0x373f66[_0xf38f('0x34')]=_[_0xf38f('0x32')](db[_0xf38f('0x2c')][_0xf38f('0x2d')]);_0xe616c6[_0xf38f('0x36')]=_[_0xf38f('0x33')](_0x373f66[_0xf38f('0x34')],qs['fields'](_0xb1af4f[_0xf38f('0x31')][_0xf38f('0x35')]));_0xe616c6[_0xf38f('0x36')]=_0xe616c6[_0xf38f('0x36')][_0xf38f('0x37')]?_0xe616c6[_0xf38f('0x36')]:_0x373f66[_0xf38f('0x34')];if(_0xb1af4f[_0xf38f('0x31')][_0xf38f('0x42')]){_0xe616c6[_0xf38f('0x43')]=[{'all':!![]}];}_0xe616c6=_['merge']({},_0xe616c6,_0xb1af4f[_0xf38f('0x41')]);return db[_0xf38f('0x2c')]['find'](_0xe616c6)['then'](handleEntityNotFound(_0x26f3a0,null))[_0xf38f('0x25')](function(_0x140f19){if(_0x140f19){var _0x457679=_0x140f19[_0xf38f('0x49')]({'plain':!![]});_0x457679=qs[_0xf38f('0x4a')](_0x457679,['id','createdAt','updatedAt']);_0xb1af4f[_0xf38f('0x4b')]=_[_0xf38f('0x4a')](_0xb1af4f[_0xf38f('0x4b')],['id',_0xf38f('0x4c'),_0xf38f('0x4d')]);return db[_0xf38f('0x2c')][_0xf38f('0x4e')](_['merge'](_0x457679,_0xb1af4f[_0xf38f('0x4b')]),{'include':_0xb1af4f[_0xf38f('0x31')][_0xf38f('0x42')]?[{'all':!![]}]:undefined});}})[_0xf38f('0x25')](respondWithResult(_0x26f3a0,0xc9))[_0xf38f('0x45')](handleError(_0x26f3a0,null));};exports[_0xf38f('0x4f')]=function(_0x41ce38,_0x1c888d){if(_0x41ce38[_0xf38f('0x4b')]['id']){delete _0x41ce38[_0xf38f('0x4b')]['id'];}return db['Attachment'][_0xf38f('0x50')]({'where':{'id':_0x41ce38['params']['id']}})[_0xf38f('0x25')](handleEntityNotFound(_0x1c888d,null))['then'](saveUpdates(_0x41ce38['body'],null))['then'](respondWithResult(_0x1c888d,null))['catch'](handleError(_0x1c888d,null));};exports[_0xf38f('0x24')]=function(_0x140c05,_0x3cbfa7){return db[_0xf38f('0x2c')][_0xf38f('0x50')]({'where':{'id':_0x140c05['params']['id']}})[_0xf38f('0x25')](handleEntityNotFound(_0x3cbfa7,null))[_0xf38f('0x25')](removeEntity(_0x3cbfa7,null))[_0xf38f('0x45')](handleError(_0x3cbfa7,null));};exports[_0xf38f('0x4e')]=function(_0x5e2a82,_0x13d57c,_0x17cc62){_0x5e2a82[_0xf38f('0x4b')][_0xf38f('0x28')]=_0x5e2a82[_0xf38f('0x51')][_0xf38f('0x52')];_0x5e2a82[_0xf38f('0x4b')][_0xf38f('0x53')]=_0x5e2a82['file'][_0xf38f('0x54')];_0x5e2a82[_0xf38f('0x4b')][_0xf38f('0x2f')]=_0x5e2a82['file'][_0xf38f('0x55')];return db[_0xf38f('0x2c')][_0xf38f('0x4e')](_0x5e2a82[_0xf38f('0x4b')])[_0xf38f('0x25')](respondWithResult(_0x13d57c,0xc9))['catch'](handleError(_0x13d57c,null));};exports[_0xf38f('0x56')]=function(_0x3e0d03,_0x1a6578,_0x386cc9){return db['Attachment'][_0xf38f('0x57')]({'where':{'id':_0x3e0d03[_0xf38f('0x47')]['id']},'raw':!![]})[_0xf38f('0x25')](handleEntityNotFound(_0x1a6578,null))[_0xf38f('0x25')](function(_0x3d18cd){if(_0x3d18cd){var _0x4d9232=_0x3d18cd[_0xf38f('0x58')]!==null;var _0x58ae99=path['join'](config[_0xf38f('0x59')],_0xf38f('0x5a'));if(_0x4d9232){_0x58ae99=path[_0xf38f('0x5b')](_0x58ae99,_0xf38f('0x5c'));}var _0x5b0b1b=path[_0xf38f('0x5b')](_0x58ae99,_0x3d18cd[_0xf38f('0x53')]);return _0x1a6578[_0xf38f('0x56')](_0x5b0b1b);}})[_0xf38f('0x45')](handleError(_0x1a6578,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1281382..a0d415a 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 _0x1a11=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x1a11,0x99));var _0x11a1=function(_0x5d9ab8,_0x18d257){_0x5d9ab8=_0x5d9ab8-0x0;var _0x533d5c=_0x1a11[_0x5d9ab8];return _0x533d5c;};'use strict';var _=require(_0x11a1('0x0'));var util=require(_0x11a1('0x1'));var logger=require(_0x11a1('0x2'))(_0x11a1('0x3'));var moment=require(_0x11a1('0x4'));var BPromise=require(_0x11a1('0x5'));var rp=require(_0x11a1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11a1('0x7'));var config=require(_0x11a1('0x8'));var attributes=require(_0x11a1('0x9'));module[_0x11a1('0xa')]=function(_0x5e4906,_0x224847){return _0x5e4906[_0x11a1('0xb')](_0x11a1('0xc'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0ee=['exports','define','util','moment','bluebird','request-promise','../../config/environment','./attachment.attributes'];(function(_0x485df0,_0x55eb9f){var _0xfd4f3b=function(_0x1d43e9){while(--_0x1d43e9){_0x485df0['push'](_0x485df0['shift']());}};_0xfd4f3b(++_0x55eb9f);}(_0xd0ee,0x152));var _0xed0e=function(_0x14dbda,_0x2767ff){_0x14dbda=_0x14dbda-0x0;var _0x32cbc9=_0xd0ee[_0x14dbda];return _0x32cbc9;};'use strict';var _=require('lodash');var util=require(_0xed0e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xed0e('0x1'));var BPromise=require(_0xed0e('0x2'));var rp=require(_0xed0e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xed0e('0x4'));var attributes=require(_0xed0e('0x5'));module[_0xed0e('0x6')]=function(_0xf70193,_0x49c33b){return _0xf70193[_0xed0e('0x7')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 514c35a..38069b7 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 _0xb43b=['raw','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','catch','CreateAttachment','Attachment','create','options'];(function(_0xac8c71,_0x26de55){var _0x2fbac1=function(_0x59e466){while(--_0x59e466){_0xac8c71['push'](_0xac8c71['shift']());}};_0x2fbac1(++_0x26de55);}(_0xb43b,0x1b2));var _0xbb43=function(_0x49b487,_0x27137c){_0x49b487=_0x49b487-0x0;var _0x1e04f1=_0xb43b[_0x49b487];return _0x1e04f1;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('Attachment,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('Attachment,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('Attachment,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});}exports[_0xbb43('0x15')]=function(_0x2e3b43){var _0x55dd73=this;return new Promise(function(_0x1c16d7,_0x4f28b8){return db[_0xbb43('0x16')][_0xbb43('0x17')](_0x2e3b43['body'],{'raw':_0x2e3b43['options']?_0x2e3b43[_0xbb43('0x18')][_0xbb43('0x19')]===undefined?!![]:![]:!![]})[_0xbb43('0x1a')](function(_0x2bf2d4){logger['info'](_0xbb43('0x15'),_0x2e3b43);logger['debug'](_0xbb43('0x15'),_0x2e3b43,JSON['stringify'](_0x2bf2d4));_0x1c16d7(_0x2bf2d4);})[_0xbb43('0x14')](function(_0x565256){logger[_0xbb43('0x10')](_0xbb43('0x15'),_0x565256['message'],_0x2e3b43);_0x4f28b8(_0x55dd73[_0xbb43('0x10')](0x1f4,_0x565256['message']));});});}; \ No newline at end of file +var _0xd4b6=['jayson/promise','client','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment'];(function(_0x4e7667,_0x47c33b){var _0x2dcbad=function(_0x4ec54b){while(--_0x4ec54b){_0x4e7667['push'](_0x4e7667['shift']());}};_0x2dcbad(++_0x47c33b);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x3b6148,_0x2e26e5){_0x3b6148=_0x3b6148-0x0;var _0x2d750a=_0xd4b6[_0x3b6148];return _0x2d750a;};'use strict';var _=require(_0x6d4b('0x0'));var util=require(_0x6d4b('0x1'));var moment=require('moment');var BPromise=require(_0x6d4b('0x2'));var rs=require(_0x6d4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d4b('0x5'));var jayson=require(_0x6d4b('0x6'));var client=jayson[_0x6d4b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f52a,_0x42a52a,_0x424690){return new BPromise(function(_0x262eed,_0x4dcf3d){return client[_0x6d4b('0x8')](_0x20f52a,_0x424690)[_0x6d4b('0x9')](function(_0xb2567b){logger[_0x6d4b('0xa')]('Attachment,\x20%s,\x20%s',_0x42a52a,_0x6d4b('0xb'));logger[_0x6d4b('0xc')](_0x6d4b('0xd'),_0x42a52a,_0x6d4b('0xb'),JSON[_0x6d4b('0xe')](_0xb2567b));if(_0xb2567b[_0x6d4b('0xf')]){if(_0xb2567b[_0x6d4b('0xf')]['code']===0x1f4){logger[_0x6d4b('0xf')](_0x6d4b('0x10'),_0x42a52a,_0xb2567b[_0x6d4b('0xf')]['message']);return _0x4dcf3d(_0xb2567b[_0x6d4b('0xf')][_0x6d4b('0x11')]);}logger[_0x6d4b('0xf')](_0x6d4b('0x10'),_0x42a52a,_0xb2567b[_0x6d4b('0xf')][_0x6d4b('0x11')]);return _0x262eed(_0xb2567b[_0x6d4b('0xf')][_0x6d4b('0x11')]);}else{logger[_0x6d4b('0xa')](_0x6d4b('0x10'),_0x42a52a,'request\x20sent');_0x262eed(_0xb2567b[_0x6d4b('0x12')]['message']);}})[_0x6d4b('0x13')](function(_0x428b75){logger['error']('Attachment,\x20%s,\x20%s',_0x42a52a,_0x428b75);_0x4dcf3d(_0x428b75);});});}exports[_0x6d4b('0x14')]=function(_0x3a30b2){var _0x318b0f=this;return new Promise(function(_0x2694ba,_0xa2f130){return db[_0x6d4b('0x15')][_0x6d4b('0x16')](_0x3a30b2[_0x6d4b('0x17')],{'raw':_0x3a30b2[_0x6d4b('0x18')]?_0x3a30b2[_0x6d4b('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x25a1fa){logger[_0x6d4b('0xa')](_0x6d4b('0x14'),_0x3a30b2);logger['debug'](_0x6d4b('0x14'),_0x3a30b2,JSON[_0x6d4b('0xe')](_0x25a1fa));_0x2694ba(_0x25a1fa);})[_0x6d4b('0x13')](function(_0x26b72d){logger['error'](_0x6d4b('0x14'),_0x26b72d[_0x6d4b('0x11')],_0x3a30b2);_0xa2f130(_0x318b0f[_0x6d4b('0xf')](0x1f4,_0x26b72d[_0x6d4b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index fb30a56..20b037a 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x14ca6e,_0x3cc76a){var _0x3fa76a=function(_0x3bde0b){while(--_0x3bde0b){_0x14ca6e['push'](_0x14ca6e['shift']());}};_0x3fa76a(++_0x3cc76a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b1082,_0x223695){_0x3b1082=_0x3b1082-0x0;var _0x296714=_0x5f2f[_0x3b1082];return _0x296714;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x0b0e[_0x44b3bd];return _0x1efc4a;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index ffe3dd2..2827568 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 _0x7f52=['online','admin','user','agent','add','minutes','clearBlockUser','then','getLicense','catch','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','User','passport','passport-local','Strategy','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','blockedAt'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x7f52,0x1cc));var _0x27f5=function(_0x51486a,_0x250856){_0x51486a=_0x51486a-0x0;var _0x7756d9=_0x7f52[_0x51486a];return _0x7756d9;};'use strict';var passport=require(_0x27f5('0x0'));var LocalStrategy=require(_0x27f5('0x1'))[_0x27f5('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x27f5('0x3'));var util=require(_0x27f5('0x4'));var db=require(_0x27f5('0x5'))['db'];var authService=require(_0x27f5('0x6'));var utils=require(_0x27f5('0x7'));var config=require(_0x27f5('0x8'));var logger=require('../../config/logger')(_0x27f5('0x9'));function isActiveDirectoryConfigured(_0xe0e8c3){var _0x57aca7=![];if(typeof _0xe0e8c3[_0x27f5('0xa')]!==_0x27f5('0xb')){_0x57aca7=_0xe0e8c3['activedirectory'][_0x27f5('0xc')]&&_0xe0e8c3[_0x27f5('0xa')][_0x27f5('0xd')]&&_0xe0e8c3[_0x27f5('0xa')][_0x27f5('0xe')];}return _0x57aca7;}function adAuthenticate(_0x19d7b5,_0x681fbc,_0xf7fe12){return new BPromise(function(_0x105ae5,_0x3f2d23){try{var _0x103fdb=new ActiveDirectory(_0x19d7b5);_0x103fdb[_0x27f5('0xf')](_0x681fbc,_0xf7fe12,function(_0x5cdbf2,_0x5cd642){if(_0x5cdbf2){logger[_0x27f5('0x10')](_0x27f5('0x11'),_0x681fbc,util[_0x27f5('0x12')](_0x5cdbf2,{'showHidden':![],'depth':null}));_0x3f2d23(_0x27f5('0x13'));}else if(!_0x5cd642){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x681fbc);_0x3f2d23(_0x27f5('0x13'));}else{_0x105ae5(_0x5cd642);}});}catch(_0x4b3a95){_0x3f2d23(_0x4b3a95);}});}function ActiveDirectoryAuthenticate(_0x338020,_0x52027a,_0x4dabd2,_0xf7830e){var _0xcc2e59,_0x486ffa;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x52027a);return _0xf7830e(null,![],{'message':_0x27f5('0x13')});}return db['Setting'][_0x27f5('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x27f5('0x15')],'raw':!![]})['then'](function(_0x492a34){_0xcc2e59=_0x492a34;if(!_0xcc2e59[_0x27f5('0x16')]){logger[_0x27f5('0x10')](_0x27f5('0x17'),_0x52027a);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x338020[_0x27f5('0x14')]({'attributes':['id',_0x27f5('0x18'),_0x27f5('0x19'),_0x27f5('0x1a'),'role',_0x27f5('0x1b'),_0x27f5('0x1c'),_0x27f5('0x1d'),_0x27f5('0x1e')],'where':{'name':_0x52027a,'role':{'$or':[_0x27f5('0x1f'),_0x27f5('0x20'),_0x27f5('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x307fcc){if(!_0x307fcc||_0x307fcc&&_0x307fcc[_0x27f5('0x18')]!==_0x52027a){throw new Error(_0x27f5('0x13'));}_0x486ffa=_0x307fcc;var _0x284433=_0x486ffa[_0x27f5('0x18')]+'@'+config['activedirectory'][_0x27f5('0xe')];return adAuthenticate(config['activedirectory'],_0x284433,_0x4dabd2);})['then'](function(_0x2c9960){if(_0x486ffa['disabled']){throw new Error(_0x27f5('0x13'));}if(_0xcc2e59[_0x27f5('0x15')]>0x0){if(_0x486ffa[_0x27f5('0x1c')]){if(moment(_0x486ffa[_0x27f5('0x1d')])[_0x27f5('0x22')](_0xcc2e59[_0x27f5('0x15')],_0x27f5('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x27f5('0x24')](_0x486ffa,0x0,![],null)[_0x27f5('0x25')](function(){return utils[_0x27f5('0x26')](_0x486ffa);})[_0x27f5('0x25')](function(){return _0xf7830e(null,_0x486ffa);});}else{return utils[_0x27f5('0x26')](_0x486ffa)['then'](function(){return _0xf7830e(null,_0x486ffa);});}}else{return utils[_0x27f5('0x26')](_0x486ffa)[_0x27f5('0x25')](function(){return _0xf7830e(null,_0x486ffa);});}})[_0x27f5('0x27')](function(_0x5c9eb7){return _0xf7830e(null,![],_0x5c9eb7);});}function handleError(_0x54c352,_0x1c5781,_0x8b041c){return _0x54c352['status'](_0x1c5781||0x1f4)[_0x27f5('0x28')]({'message':_0x8b041c?_0x8b041c[_0x27f5('0x29')]||_0x8b041c:''});}exports[_0x27f5('0x2a')]=function(_0x572edf,_0x400fb5,_0x27ef78){passport['authenticate']('ad-login',function(_0x7bd30a,_0x443f15,_0x265067){var _0x264374=_0x7bd30a||_0x265067;if(_0x264374){return handleError(_0x400fb5,0x191,_0x264374);}if(!_0x443f15){return handleError(_0x400fb5,0x194,{'message':_0x27f5('0x2b')});}else{var _0x16dd14={'payload':{'id':_0x443f15['id'],'role':_0x443f15[_0x27f5('0x2c')]},'options':{'expiresIn':0x15180}};return authService[_0x27f5('0x2d')](_0x16dd14)['then'](function(_0x394048){_0x400fb5[_0x27f5('0x2e')]({'id':_0x443f15['id'],'token':_0x394048,'statusCall':'','isAlreadyLogged':_0x443f15[_0x27f5('0x1e')]});});}})(_0x572edf,_0x400fb5,_0x27ef78);};passport[_0x27f5('0x2f')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x27f5('0x19')},function(_0x509400,_0xcb9087,_0x748660){return ActiveDirectoryAuthenticate(db[_0x27f5('0x30')],_0x509400,_0xcb9087,_0x748660);})); \ No newline at end of file +var _0x6889=['activedirectory2','util','../../config/utils','../../config/environment','../../config/logger','activedirectory','url','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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','blockedAt','online','user','domain','blocked','minutes','clearBlockUser','getLicense','status','send','message','authenticate','json','use','User','passport','passport-local','Strategy','moment'];(function(_0x5d5f7e,_0x17b602){var _0x4df13f=function(_0x5cf293){while(--_0x5cf293){_0x5d5f7e['push'](_0x5d5f7e['shift']());}};_0x4df13f(++_0x17b602);}(_0x6889,0x114));var _0x9688=function(_0x13f5ac,_0x303066){_0x13f5ac=_0x13f5ac-0x0;var _0x163d97=_0x6889[_0x13f5ac];return _0x163d97;};'use strict';var passport=require(_0x9688('0x0'));var LocalStrategy=require(_0x9688('0x1'))[_0x9688('0x2')];var moment=require(_0x9688('0x3'));var ActiveDirectory=require(_0x9688('0x4'));var BPromise=require('bluebird');var util=require(_0x9688('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x9688('0x6'));var config=require(_0x9688('0x7'));var logger=require(_0x9688('0x8'))('api');function isActiveDirectoryConfigured(_0x795938){var _0x2b8881=![];if(typeof _0x795938[_0x9688('0x9')]!=='undefined'){_0x2b8881=_0x795938[_0x9688('0x9')]['baseDN']&&_0x795938['activedirectory'][_0x9688('0xa')]&&_0x795938['activedirectory']['domain'];}return _0x2b8881;}function adAuthenticate(_0x5322b0,_0x3171ed,_0x396ab2){return new BPromise(function(_0x284c71,_0x4d1ef0){try{var _0x123c50=new ActiveDirectory(_0x5322b0);_0x123c50['authenticate'](_0x3171ed,_0x396ab2,function(_0x53ba22,_0x59dec3){if(_0x53ba22){logger[_0x9688('0xb')](_0x9688('0xc'),_0x3171ed,util['inspect'](_0x53ba22,{'showHidden':![],'depth':null}));_0x4d1ef0('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x59dec3){logger[_0x9688('0xb')](_0x9688('0xd'),_0x3171ed);_0x4d1ef0(_0x9688('0xe'));}else{_0x284c71(_0x59dec3);}});}catch(_0x17a9ae){_0x4d1ef0(_0x17a9ae);}});}function ActiveDirectoryAuthenticate(_0x466211,_0x5f3055,_0x17b5f6,_0xd9dfc){var _0x2daabc,_0x1b3646;if(!isActiveDirectoryConfigured(config)){logger[_0x9688('0xb')](_0x9688('0xf'),_0x5f3055);return _0xd9dfc(null,![],{'message':_0x9688('0xe')});}return db[_0x9688('0x10')][_0x9688('0x11')]({'where':{'id':0x1},'attributes':[_0x9688('0x12'),_0x9688('0x13')],'raw':!![]})[_0x9688('0x14')](function(_0x51fe0e){_0x2daabc=_0x51fe0e;if(!_0x2daabc[_0x9688('0x12')]){logger[_0x9688('0xb')](_0x9688('0x15'),_0x5f3055);throw new Error(_0x9688('0xe'));}return _0x466211['findOne']({'attributes':['id',_0x9688('0x16'),_0x9688('0x17'),'salt',_0x9688('0x18'),'disabled','blocked',_0x9688('0x19'),_0x9688('0x1a')],'where':{'name':_0x5f3055,'role':{'$or':['admin',_0x9688('0x1b'),'agent']},'adSsoEnabled':!![]}});})[_0x9688('0x14')](function(_0x477a58){if(!_0x477a58||_0x477a58&&_0x477a58['name']!==_0x5f3055){throw new Error(_0x9688('0xe'));}_0x1b3646=_0x477a58;var _0x1faf51=_0x1b3646[_0x9688('0x16')]+'@'+config[_0x9688('0x9')][_0x9688('0x1c')];return adAuthenticate(config[_0x9688('0x9')],_0x1faf51,_0x17b5f6);})[_0x9688('0x14')](function(_0x2d196a){if(_0x1b3646['disabled']){throw new Error(_0x9688('0xe'));}if(_0x2daabc[_0x9688('0x13')]>0x0){if(_0x1b3646[_0x9688('0x1d')]){if(moment(_0x1b3646[_0x9688('0x19')])['add'](_0x2daabc['blockDuration'],_0x9688('0x1e'))>moment()){throw new Error(_0x9688('0xe'));}return utils[_0x9688('0x1f')](_0x1b3646,0x0,![],null)[_0x9688('0x14')](function(){return utils[_0x9688('0x20')](_0x1b3646);})[_0x9688('0x14')](function(){return _0xd9dfc(null,_0x1b3646);});}else{return utils[_0x9688('0x20')](_0x1b3646)[_0x9688('0x14')](function(){return _0xd9dfc(null,_0x1b3646);});}}else{return utils[_0x9688('0x20')](_0x1b3646)[_0x9688('0x14')](function(){return _0xd9dfc(null,_0x1b3646);});}})['catch'](function(_0x338caa){return _0xd9dfc(null,![],_0x338caa);});}function handleError(_0x204d7c,_0x698e50,_0xc2906){return _0x204d7c[_0x9688('0x21')](_0x698e50||0x1f4)[_0x9688('0x22')]({'message':_0xc2906?_0xc2906[_0x9688('0x23')]||_0xc2906:''});}exports['login']=function(_0x4a8168,_0x567312,_0x1d6e33){passport[_0x9688('0x24')]('ad-login',function(_0x299c31,_0x142071,_0x2d9408){var _0x1af471=_0x299c31||_0x2d9408;if(_0x1af471){return handleError(_0x567312,0x191,_0x1af471);}if(!_0x142071){return handleError(_0x567312,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3bcb44={'payload':{'id':_0x142071['id'],'role':_0x142071[_0x9688('0x18')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3bcb44)[_0x9688('0x14')](function(_0x22adaa){_0x567312[_0x9688('0x25')]({'id':_0x142071['id'],'token':_0x22adaa,'statusCall':'','isAlreadyLogged':_0x142071[_0x9688('0x1a')]});});}})(_0x4a8168,_0x567312,_0x1d6e33);};passport[_0x9688('0x26')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x9688('0x17')},function(_0x5ba757,_0x4f8f07,_0x25f53e){return ActiveDirectoryAuthenticate(db[_0x9688('0x27')],_0x5ba757,_0x4f8f07,_0x25f53e);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index cb9720e..50372c0 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 _0x84c2=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x4e1ba7,_0x5311f2){var _0x145c84=function(_0x1b4788){while(--_0x1b4788){_0x4e1ba7['push'](_0x4e1ba7['shift']());}};_0x145c84(++_0x5311f2);}(_0x84c2,0x1a7));var _0x284c=function(_0x396552,_0x532a80){_0x396552=_0x396552-0x0;var _0xb63575=_0x84c2[_0x396552];return _0xb63575;};'use strict';var express=require(_0x284c('0x0'));var router=express[_0x284c('0x1')]();var controller=require(_0x284c('0x2'));router[_0x284c('0x3')]('/',controller[_0x284c('0x4')]);module[_0x284c('0x5')]=router; \ No newline at end of file +var _0x2e55=['Router','./authActiveDirectory.controller','exports','express'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x2e55,0xeb));var _0x52e5=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x2e55[_0xf26d40];return _0x50b68c;};'use strict';var express=require(_0x52e5('0x0'));var router=express[_0x52e5('0x1')]();var controller=require(_0x52e5('0x2'));router['post']('/',controller['login']);module[_0x52e5('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index ce73e5b..b895166 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 _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x213f91,_0x8f3782){var _0x5cf677=function(_0x469754){while(--_0x469754){_0x213f91['push'](_0x213f91['shift']());}};_0x5cf677(++_0x8f3782);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7a54,0x106));var _0x47a5=function(_0x28dc65,_0x47963e){_0x28dc65=_0x28dc65-0x0;var _0x74222b=_0x7a54[_0x28dc65];return _0x74222b;};'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 8a15539..204d0ff 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 _0x596c=['get','login','isMiddleware','setTokenCookie','exports','../user/user.controller.js'];(function(_0x5df033,_0x29458b){var _0x445829=function(_0x2c795b){while(--_0x2c795b){_0x5df033['push'](_0x5df033['shift']());}};_0x445829(++_0x29458b);}(_0x596c,0x1cd));var _0xc596=function(_0x55a177,_0x3fed1b){_0x55a177=_0x55a177-0x0;var _0x4196eb=_0x596c[_0x55a177];return _0x4196eb;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xc596('0x0'));var authService=require('../../components/auth/service');router[_0xc596('0x1')]('/',controller[_0xc596('0x2')]);router['get']('/callback',controller['callback'],authService[_0xc596('0x3')],userController['login'],authService[_0xc596('0x4')]);module[_0xc596('0x5')]=router; \ No newline at end of file +var _0x5e58=['callback','isMiddleware','login','express','get','/callback'];(function(_0x364a17,_0x1c3288){var _0x1a78ce=function(_0x5940a3){while(--_0x5940a3){_0x364a17['push'](_0x364a17['shift']());}};_0x1a78ce(++_0x1c3288);}(_0x5e58,0x14d));var _0x85e5=function(_0x201b94,_0x5cada6){_0x201b94=_0x201b94-0x0;var _0x49da82=_0x5e58[_0x201b94];return _0x49da82;};'use strict';var express=require(_0x85e5('0x0'));var passport=require('passport');var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x85e5('0x1')]('/',controller['login']);router['get'](_0x85e5('0x2'),controller[_0x85e5('0x3')],authService[_0x85e5('0x4')],userController[_0x85e5('0x5')],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 37c0c8d..683724b 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 _0x9d46=['format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','message','stringify','status','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','blockedAt','add','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','headers','/reset/','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','password','salt','role','disabled','loginAttempts','admin','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge'];(function(_0x34e29e,_0x3d6df5){var _0x4d0088=function(_0x317af6){while(--_0x317af6){_0x34e29e['push'](_0x34e29e['shift']());}};_0x4d0088(++_0x3d6df5);}(_0x9d46,0xe1));var _0x69d4=function(_0x17c92d,_0x571d35){_0x17c92d=_0x17c92d-0x0;var _0x2f26ba=_0x9d46[_0x17c92d];return _0x2f26ba;};'use strict';var util=require(_0x69d4('0x0'));var passport=require(_0x69d4('0x1'));var LocalStrategy=require(_0x69d4('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x69d4('0x3'));var rs=require(_0x69d4('0x4'));var moment=require('moment');var db=require(_0x69d4('0x5'))['db'];var authService=require(_0x69d4('0x6'));var utils=require(_0x69d4('0x7'));var client=jayson[_0x69d4('0x8')][_0x69d4('0x9')]({'port':0x232b});function localAuthenticate(_0x19db4c,_0x4bf4ab,_0x521088,_0x2205f8){var _0x2626ef,_0x47edc5;return db['Setting'][_0x69d4('0xa')]({'where':{'id':0x1},'attributes':[_0x69d4('0xb'),_0x69d4('0xc')],'raw':!![]})['then'](function(_0x13ec19){_0x2626ef=_0x13ec19;return _0x19db4c[_0x69d4('0xa')]({'attributes':['id','name',_0x69d4('0xd'),_0x69d4('0xe'),_0x69d4('0xf'),_0x69d4('0x10'),'blocked','blockedAt',_0x69d4('0x11')],'where':{'name':_0x4bf4ab,'role':{'$or':[_0x69d4('0x12'),_0x69d4('0x13'),_0x69d4('0x14')]}}});})[_0x69d4('0x15')](function(_0x206021){if(!_0x206021||_0x206021&&_0x206021[_0x69d4('0x16')]!==_0x4bf4ab){throw new Error(_0x69d4('0x17'));}else{_0x47edc5=_0x206021;return _0x47edc5;}})[_0x69d4('0x15')](function(){_0x47edc5['authenticate'](_0x521088,function(_0x325da1,_0x512639){var _0x3c1243=_0x47edc5['loginAttempts']+0x1;if(_0x325da1){return _0x2205f8(_0x325da1);}else if(!_0x512639){if(_0x47edc5[_0x69d4('0x10')]){return _0x2205f8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2626ef[_0x69d4('0xb')]>0x0){if(_0x47edc5[_0x69d4('0x18')]){if(_0x2626ef['blockDuration']>0x0){if(moment(_0x47edc5['blockedAt'])['add'](_0x2626ef[_0x69d4('0xc')],_0x69d4('0x19'))>moment()){return _0x2205f8(null,![],{'message':_0x69d4('0x17')});}else{return utils[_0x69d4('0x1a')](_0x47edc5,_0x3c1243,![],null)[_0x69d4('0x15')](function(){return _0x2205f8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2205f8(null,![],{'message':_0x69d4('0x17')});}}else{if(_0x3c1243>=_0x2626ef[_0x69d4('0xb')]){return utils[_0x69d4('0x1a')](_0x47edc5,0x0,!![],moment())[_0x69d4('0x15')](function(){return _0x2205f8(null,![],{'message':_0x69d4('0x17')});});}else{return utils[_0x69d4('0x1a')](_0x47edc5,_0x3c1243,![],null)[_0x69d4('0x15')](function(){return _0x2205f8(null,![],{'message':_0x69d4('0x17')});});}}}else{return _0x2205f8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x47edc5[_0x69d4('0x10')]){return _0x2205f8(null,![],{'message':_0x69d4('0x17')});}else if(_0x2626ef[_0x69d4('0xb')]>0x0){if(_0x47edc5[_0x69d4('0x18')]){if(_0x2626ef[_0x69d4('0xc')]>0x0){if(moment(_0x47edc5['blockedAt'])['add'](_0x2626ef[_0x69d4('0xc')],_0x69d4('0x19'))>moment()){return _0x2205f8(null,![],{'message':_0x69d4('0x17')});}else{return utils['clearBlockUser'](_0x47edc5,0x0,![],null)[_0x69d4('0x15')](function(){return utils[_0x69d4('0x1b')](_0x47edc5);})['then'](function(){return _0x2205f8(null,_0x47edc5);});}}else{return _0x2205f8(null,![],{'message':_0x69d4('0x17')});}}else{return utils['clearBlockUser'](_0x47edc5,0x0,![],null)['then'](function(){return utils[_0x69d4('0x1b')](_0x47edc5);})[_0x69d4('0x15')](function(){return _0x2205f8(null,_0x47edc5);})[_0x69d4('0x1c')](function(_0x2fb2e2){return _0x2205f8(null,![],_0x2fb2e2);});}}else{if(_0x47edc5[_0x69d4('0x18')]){return _0x2205f8(null,![],{'message':_0x69d4('0x17')});}else{return utils[_0x69d4('0x1b')](_0x47edc5)['then'](function(){return _0x2205f8(null,_0x47edc5);});}}}});})[_0x69d4('0x1c')](function(_0x108c49){return _0x2205f8(null,![],_0x108c49);});}function sendServiceMail(_0x3040bd){return db['MailAccount'][_0x69d4('0x1d')]({'where':{'service':!![]},'attributes':['id','name',_0x69d4('0x1e')],'include':[{'model':db[_0x69d4('0x1f')],'as':'Smtp','include':[{'model':db[_0x69d4('0x20')],'as':_0x69d4('0x20')}]}]})[_0x69d4('0x15')](function(_0x3d4e4a){if(!_0x3d4e4a){throw new Error(_0x69d4('0x21'));}var _0x4ebb7c=_0x3d4e4a[_0x69d4('0x22')]();var _0xe118d0={'account':_0x4ebb7c,'message':_[_0x69d4('0x23')]({'from':util[_0x69d4('0x24')](_0x69d4('0x25'),_0x3d4e4a[_0x69d4('0x16')],_0x3d4e4a[_0x69d4('0x1e')]||_0x3d4e4a[_0x69d4('0x26')]['user'])},_0x3040bd)};return client[_0x69d4('0x27')](_0x69d4('0x28'),_0xe118d0);})['then'](function(_0x192bd8){if(_0x192bd8[_0x69d4('0x29')]){throw new Error(util[_0x69d4('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x192bd8['error'][_0x69d4('0x2a')]||JSON[_0x69d4('0x2b')](_0x192bd8[_0x69d4('0x29')])));}return!![];});}function handleError(_0x4145f8,_0x508c63,_0x4e34b7){return _0x4145f8[_0x69d4('0x2c')](_0x508c63||0x1f4)['send']({'message':_0x4e34b7?_0x4e34b7[_0x69d4('0x2a')]||_0x4e34b7:''});}exports[_0x69d4('0x2d')]=function(_0x19dd84,_0x13adbb,_0x54b74e){passport[_0x69d4('0x2e')](_0x69d4('0x2f'),function(_0x323a9c,_0x1604f6,_0x411495){var _0x3f0f7d=_0x323a9c||_0x411495;if(_0x3f0f7d){return handleError(_0x13adbb,0x191,_0x3f0f7d);}if(!_0x1604f6){return handleError(_0x13adbb,0x194,{'message':_0x69d4('0x30')});}else{var _0x23859a={'payload':{'id':_0x1604f6['id'],'role':_0x1604f6[_0x69d4('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x69d4('0x31')](_0x23859a)[_0x69d4('0x15')](function(_0x4ef0a1){_0x13adbb[_0x69d4('0x32')]({'id':_0x1604f6['id'],'token':_0x4ef0a1,'statusCall':'','isAlreadyLogged':_0x1604f6[_0x69d4('0x33')]});});}})(_0x19dd84,_0x13adbb,_0x54b74e);};exports[_0x69d4('0x34')]=function(_0x18077e,_0x809a53){if(!_0x18077e[_0x69d4('0x35')][_0x69d4('0x1e')]){return handleError(_0x809a53,0x1f4,{'message':_0x69d4('0x36')});}var _0x5117b3=rs[_0x69d4('0x37')]();_0x18077e['body'][_0x69d4('0x1e')]=_0x18077e[_0x69d4('0x35')][_0x69d4('0x1e')][_0x69d4('0x38')]()[_0x69d4('0x39')]();var _0x2773b0;return db[_0x69d4('0x3a')][_0x69d4('0xa')]({'where':{'id':0x1},'attributes':[_0x69d4('0xb'),'blockDuration'],'raw':!![]})[_0x69d4('0x15')](function(_0x1e8b6f){_0x2773b0=_0x1e8b6f;return db[_0x69d4('0x3b')][_0x69d4('0x1d')]({'where':{'email':_0x18077e[_0x69d4('0x35')][_0x69d4('0x1e')]}});})[_0x69d4('0x15')](function(_0x1bba89){if(!_0x1bba89){throw new Error(_0x69d4('0x3c'));}if(_0x1bba89[_0x69d4('0x10')]){throw new Error(_0x69d4('0x3d'));}if(_0x1bba89['blocked']){if(moment(_0x1bba89[_0x69d4('0x3e')])[_0x69d4('0x3f')](_0x2773b0[_0x69d4('0xc')],_0x69d4('0x19'))>moment()){throw new Error(_0x69d4('0x40'));}else{_0x1bba89[_0x69d4('0x18')]=![];_0x1bba89[_0x69d4('0x3e')]=null;}}_0x1bba89[_0x69d4('0x41')]=_0x5117b3;_0x1bba89[_0x69d4('0x42')]=Date[_0x69d4('0x43')]()+0x36ee80;return _0x1bba89[_0x69d4('0x44')]();})[_0x69d4('0x15')](function(){return sendServiceMail({'to':_0x18077e[_0x69d4('0x35')][_0x69d4('0x1e')],'subject':_0x69d4('0x45'),'text':_0x69d4('0x46')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x18077e[_0x69d4('0x47')]['host']+_0x69d4('0x48')+_0x5117b3+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x69d4('0x15')](function(){_0x809a53[_0x69d4('0x2c')](0xc8)[_0x69d4('0x49')]({'message':_0x69d4('0x4a')});})['catch'](function(_0x3bd64b){return handleError(_0x809a53,0x1f4,_0x3bd64b);});};exports[_0x69d4('0x4b')]=function(_0x585e0d,_0x170f32){return db[_0x69d4('0x3b')][_0x69d4('0x1d')]({'where':{'resetPasswordToken':_0x585e0d[_0x69d4('0x4c')][_0x69d4('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x69d4('0x43')]()}}})[_0x69d4('0x15')](function(_0x3fa2d7){if(!_0x3fa2d7){throw new Error(_0x69d4('0x4e'));}return db['Setting'][_0x69d4('0xa')]({'attributes':['id',_0x69d4('0x4f'),'enforcePasswordHistory',_0x69d4('0x50')]})[_0x69d4('0x15')](function(_0x4237e0){if(_0x4237e0[_0x69d4('0x4f')])authService[_0x69d4('0x51')](_0x585e0d[_0x69d4('0x35')]['password']);if(!_0x4237e0[_0x69d4('0x52')]||!_0x3fa2d7['previousPasswords'])return _0x3fa2d7;authService[_0x69d4('0x53')](_0x585e0d[_0x69d4('0x35')][_0x69d4('0xd')],_0x3fa2d7[_0x69d4('0x54')],_0x4237e0[_0x69d4('0x50')]);return _0x3fa2d7;})['then'](function(){_0x3fa2d7[_0x69d4('0xd')]=_0x585e0d[_0x69d4('0x35')][_0x69d4('0xd')];_0x3fa2d7[_0x69d4('0x41')]=null;_0x3fa2d7[_0x69d4('0x42')]=null;return _0x3fa2d7['save']();});})[_0x69d4('0x15')](function(){_0x170f32[_0x69d4('0x2c')](0xc8)[_0x69d4('0x49')]({'message':_0x69d4('0x55')});})[_0x69d4('0x1c')](function(_0x4eebb9){return handleError(_0x170f32,0x1f4,_0x4eebb9);});};passport[_0x69d4('0x56')](_0x69d4('0x2f'),new LocalStrategy({'usernameField':_0x69d4('0x16'),'passwordField':_0x69d4('0xd')},function(_0x433b19,_0x2a007a,_0x883f2f){return localAuthenticate(db[_0x69d4('0x3b')],_0x433b19,_0x2a007a,_0x883f2f);})); \ No newline at end of file +var _0x40ff=['findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blocked','admin','user','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','minutes','clearBlockUser','blockedAt','add','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','\x22%s\x22\x20<%s>','request','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting'];(function(_0x175cd1,_0x5dd9f8){var _0x3ff513=function(_0x2835c4){while(--_0x2835c4){_0x175cd1['push'](_0x175cd1['shift']());}};_0x3ff513(++_0x5dd9f8);}(_0x40ff,0xe8));var _0xf40f=function(_0x5e41f0,_0x1799cc){_0x5e41f0=_0x5e41f0-0x0;var _0x5c85c4=_0x40ff[_0x5e41f0];return _0x5c85c4;};'use strict';var util=require(_0xf40f('0x0'));var passport=require(_0xf40f('0x1'));var LocalStrategy=require(_0xf40f('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0xf40f('0x3'));var rs=require('randomstring');var moment=require(_0xf40f('0x4'));var db=require(_0xf40f('0x5'))['db'];var authService=require(_0xf40f('0x6'));var utils=require(_0xf40f('0x7'));var client=jayson[_0xf40f('0x8')][_0xf40f('0x9')]({'port':0x232b});function localAuthenticate(_0x4323cf,_0x55d113,_0x4318c6,_0x2f9923){var _0xc6cdaf,_0x134784;return db[_0xf40f('0xa')][_0xf40f('0xb')]({'where':{'id':0x1},'attributes':[_0xf40f('0xc'),'blockDuration'],'raw':!![]})[_0xf40f('0xd')](function(_0x5bf174){_0xc6cdaf=_0x5bf174;return _0x4323cf['findOne']({'attributes':['id',_0xf40f('0xe'),_0xf40f('0xf'),_0xf40f('0x10'),_0xf40f('0x11'),_0xf40f('0x12'),_0xf40f('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x55d113,'role':{'$or':[_0xf40f('0x14'),_0xf40f('0x15'),'agent']}}});})['then'](function(_0x53948f){if(!_0x53948f||_0x53948f&&_0x53948f['name']!==_0x55d113){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x134784=_0x53948f;return _0x134784;}})[_0xf40f('0xd')](function(){_0x134784['authenticate'](_0x4318c6,function(_0x407c19,_0x14699d){var _0x54e684=_0x134784[_0xf40f('0x16')]+0x1;if(_0x407c19){return _0x2f9923(_0x407c19);}else if(!_0x14699d){if(_0x134784['disabled']){return _0x2f9923(null,![],{'message':_0xf40f('0x17')});}else if(_0xc6cdaf[_0xf40f('0xc')]>0x0){if(_0x134784['blocked']){if(_0xc6cdaf[_0xf40f('0x18')]>0x0){if(moment(_0x134784['blockedAt'])['add'](_0xc6cdaf[_0xf40f('0x18')],_0xf40f('0x19'))>moment()){return _0x2f9923(null,![],{'message':_0xf40f('0x17')});}else{return utils[_0xf40f('0x1a')](_0x134784,_0x54e684,![],null)[_0xf40f('0xd')](function(){return _0x2f9923(null,![],{'message':_0xf40f('0x17')});});}}else{return _0x2f9923(null,![],{'message':_0xf40f('0x17')});}}else{if(_0x54e684>=_0xc6cdaf[_0xf40f('0xc')]){return utils[_0xf40f('0x1a')](_0x134784,0x0,!![],moment())[_0xf40f('0xd')](function(){return _0x2f9923(null,![],{'message':_0xf40f('0x17')});});}else{return utils['clearBlockUser'](_0x134784,_0x54e684,![],null)[_0xf40f('0xd')](function(){return _0x2f9923(null,![],{'message':_0xf40f('0x17')});});}}}else{return _0x2f9923(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x134784[_0xf40f('0x12')]){return _0x2f9923(null,![],{'message':_0xf40f('0x17')});}else if(_0xc6cdaf[_0xf40f('0xc')]>0x0){if(_0x134784['blocked']){if(_0xc6cdaf['blockDuration']>0x0){if(moment(_0x134784[_0xf40f('0x1b')])[_0xf40f('0x1c')](_0xc6cdaf[_0xf40f('0x18')],_0xf40f('0x19'))>moment()){return _0x2f9923(null,![],{'message':_0xf40f('0x17')});}else{return utils['clearBlockUser'](_0x134784,0x0,![],null)[_0xf40f('0xd')](function(){return utils['getLicense'](_0x134784);})[_0xf40f('0xd')](function(){return _0x2f9923(null,_0x134784);});}}else{return _0x2f9923(null,![],{'message':_0xf40f('0x17')});}}else{return utils[_0xf40f('0x1a')](_0x134784,0x0,![],null)['then'](function(){return utils[_0xf40f('0x1d')](_0x134784);})[_0xf40f('0xd')](function(){return _0x2f9923(null,_0x134784);})[_0xf40f('0x1e')](function(_0x4d8e15){return _0x2f9923(null,![],_0x4d8e15);});}}else{if(_0x134784[_0xf40f('0x13')]){return _0x2f9923(null,![],{'message':_0xf40f('0x17')});}else{return utils['getLicense'](_0x134784)[_0xf40f('0xd')](function(){return _0x2f9923(null,_0x134784);});}}}});})[_0xf40f('0x1e')](function(_0x3b987d){return _0x2f9923(null,![],_0x3b987d);});}function sendServiceMail(_0x1e57a9){return db['MailAccount'][_0xf40f('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xf40f('0xe'),_0xf40f('0x20')],'include':[{'model':db[_0xf40f('0x21')],'as':_0xf40f('0x22'),'include':[{'model':db[_0xf40f('0x23')],'as':_0xf40f('0x23')}]}]})['then'](function(_0x1333b7){if(!_0x1333b7){throw new Error(_0xf40f('0x24'));}var _0x1b642e=_0x1333b7[_0xf40f('0x25')]();var _0x371dc9={'account':_0x1b642e,'message':_['merge']({'from':util['format'](_0xf40f('0x26'),_0x1333b7[_0xf40f('0xe')],_0x1333b7['email']||_0x1333b7['Smtp'][_0xf40f('0x15')])},_0x1e57a9)};return client[_0xf40f('0x27')](_0xf40f('0x28'),_0x371dc9);})[_0xf40f('0xd')](function(_0x532240){if(_0x532240['error']){throw new Error(util[_0xf40f('0x29')](_0xf40f('0x2a'),_0x532240[_0xf40f('0x2b')][_0xf40f('0x2c')]||JSON[_0xf40f('0x2d')](_0x532240[_0xf40f('0x2b')])));}return!![];});}function handleError(_0x4aa496,_0x1ee844,_0x441bc1){return _0x4aa496[_0xf40f('0x2e')](_0x1ee844||0x1f4)[_0xf40f('0x2f')]({'message':_0x441bc1?_0x441bc1[_0xf40f('0x2c')]||_0x441bc1:''});}exports[_0xf40f('0x30')]=function(_0x2f9170,_0x3ddddc,_0x50d96d){passport[_0xf40f('0x31')](_0xf40f('0x32'),function(_0x2f95b8,_0x556c8e,_0x5dd8f6){var _0x2eafb4=_0x2f95b8||_0x5dd8f6;if(_0x2eafb4){return handleError(_0x3ddddc,0x191,_0x2eafb4);}if(!_0x556c8e){return handleError(_0x3ddddc,0x194,{'message':_0xf40f('0x33')});}else{var _0x45d57c={'payload':{'id':_0x556c8e['id'],'role':_0x556c8e[_0xf40f('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xf40f('0x34')](_0x45d57c)['then'](function(_0x3bc02d){_0x3ddddc[_0xf40f('0x35')]({'id':_0x556c8e['id'],'token':_0x3bc02d,'statusCall':'','isAlreadyLogged':_0x556c8e['online']});});}})(_0x2f9170,_0x3ddddc,_0x50d96d);};exports[_0xf40f('0x36')]=function(_0x115e58,_0x4c22d6){if(!_0x115e58[_0xf40f('0x37')][_0xf40f('0x20')]){return handleError(_0x4c22d6,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xcc2eb3=rs['generate']();_0x115e58[_0xf40f('0x37')][_0xf40f('0x20')]=_0x115e58[_0xf40f('0x37')]['email'][_0xf40f('0x38')]()[_0xf40f('0x39')]();var _0x4b4879;return db[_0xf40f('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xf40f('0xc'),_0xf40f('0x18')],'raw':!![]})[_0xf40f('0xd')](function(_0x4609f0){_0x4b4879=_0x4609f0;return db[_0xf40f('0x3a')][_0xf40f('0x1f')]({'where':{'email':_0x115e58[_0xf40f('0x37')]['email']}});})[_0xf40f('0xd')](function(_0x19ddc3){if(!_0x19ddc3){throw new Error(_0xf40f('0x3b'));}if(_0x19ddc3['disabled']){throw new Error(_0xf40f('0x3c'));}if(_0x19ddc3[_0xf40f('0x13')]){if(moment(_0x19ddc3['blockedAt'])[_0xf40f('0x1c')](_0x4b4879[_0xf40f('0x18')],_0xf40f('0x19'))>moment()){throw new Error(_0xf40f('0x3d'));}else{_0x19ddc3[_0xf40f('0x13')]=![];_0x19ddc3['blockedAt']=null;}}_0x19ddc3['resetPasswordToken']=_0xcc2eb3;_0x19ddc3['resetPasswordExpires']=Date[_0xf40f('0x3e')]()+0x36ee80;return _0x19ddc3[_0xf40f('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0x115e58['body'][_0xf40f('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xf40f('0x40')+_0xf40f('0x41')+_0xf40f('0x42')+_0x115e58[_0xf40f('0x43')]['host']+'/reset/'+_0xcc2eb3+'\x0a\x0a'+_0xf40f('0x44')});})['then'](function(){_0x4c22d6[_0xf40f('0x2e')](0xc8)[_0xf40f('0x2f')]({'message':_0xf40f('0x45')});})[_0xf40f('0x1e')](function(_0x360340){return handleError(_0x4c22d6,0x1f4,_0x360340);});};exports[_0xf40f('0x46')]=function(_0x47ce81,_0x3d3087){return db[_0xf40f('0x3a')][_0xf40f('0x1f')]({'where':{'resetPasswordToken':_0x47ce81['params'][_0xf40f('0x47')],'resetPasswordExpires':{'$gt':Date[_0xf40f('0x3e')]()}}})[_0xf40f('0xd')](function(_0x577374){if(!_0x577374){throw new Error(_0xf40f('0x48'));}return db['Setting'][_0xf40f('0xb')]({'attributes':['id',_0xf40f('0x49'),'enforcePasswordHistory',_0xf40f('0x4a')]})[_0xf40f('0xd')](function(_0x17e0d4){if(_0x17e0d4[_0xf40f('0x49')])authService[_0xf40f('0x4b')](_0x47ce81[_0xf40f('0x37')][_0xf40f('0xf')]);if(!_0x17e0d4['enforcePasswordHistory']||!_0x577374[_0xf40f('0x4c')])return _0x577374;authService[_0xf40f('0x4d')](_0x47ce81['body'][_0xf40f('0xf')],_0x577374[_0xf40f('0x4c')],_0x17e0d4['passwordHistoryLimit']);return _0x577374;})[_0xf40f('0xd')](function(){_0x577374['password']=_0x47ce81[_0xf40f('0x37')]['password'];_0x577374['resetPasswordToken']=null;_0x577374[_0xf40f('0x4e')]=null;return _0x577374['save']();});})['then'](function(){_0x3d3087[_0xf40f('0x2e')](0xc8)[_0xf40f('0x2f')]({'message':_0xf40f('0x4f')});})[_0xf40f('0x1e')](function(_0xd15605){return handleError(_0x3d3087,0x1f4,_0xd15605);});};passport[_0xf40f('0x50')](_0xf40f('0x32'),new LocalStrategy({'usernameField':_0xf40f('0xe'),'passwordField':_0xf40f('0xf')},function(_0x4e5bc8,_0x38e62d,_0x41ebbc){return localAuthenticate(db[_0xf40f('0x3a')],_0x4e5bc8,_0x38e62d,_0x41ebbc);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 66d9d6c..cce9aed 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 _0x593a=['login','/forgot','forgot','reset','./authLocal.controller','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x593a,0x6a));var _0xa593=function(_0xf6842c,_0x5aaeb8){_0xf6842c=_0xf6842c-0x0;var _0x446268=_0x593a[_0xf6842c];return _0x446268;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xa593('0x0'));router[_0xa593('0x1')]('/',controller[_0xa593('0x2')]);router[_0xa593('0x1')](_0xa593('0x3'),controller[_0xa593('0x4')]);router[_0xa593('0x1')]('/reset/:token',controller[_0xa593('0x5')]);module['exports']=router; \ No newline at end of file +var _0x3ef3=['post','login','forgot','/reset/:token','express','Router'];(function(_0x587bdb,_0xffed85){var _0x3e292c=function(_0xc1bb6b){while(--_0xc1bb6b){_0x587bdb['push'](_0x587bdb['shift']());}};_0x3e292c(++_0xffed85);}(_0x3ef3,0xdc));var _0x33ef=function(_0x3ffa4a,_0xbfbae4){_0x3ffa4a=_0x3ffa4a-0x0;var _0x4e9062=_0x3ef3[_0x3ffa4a];return _0x4e9062;};'use strict';var express=require(_0x33ef('0x0'));var router=express[_0x33ef('0x1')]();var controller=require('./authLocal.controller');router[_0x33ef('0x2')]('/',controller[_0x33ef('0x3')]);router[_0x33ef('0x2')]('/forgot',controller[_0x33ef('0x4')]);router['post'](_0x33ef('0x5'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 556335f..a775fcb 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 _0xc02d=['sequelize','exports','STRING','INTEGER'];(function(_0x3c49b5,_0x2fce8e){var _0x146bc9=function(_0x5e4010){while(--_0x5e4010){_0x3c49b5['push'](_0x3c49b5['shift']());}};_0x146bc9(++_0x2fce8e);}(_0xc02d,0x1b0));var _0xdc02=function(_0x552516,_0x33e040){_0x552516=_0x552516-0x0;var _0x533b0a=_0xc02d[_0x552516];return _0x533b0a;};'use strict';var Sequelize=require(_0xdc02('0x0'));module[_0xdc02('0x1')]={'name':{'type':Sequelize[_0xdc02('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xdc02('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xdc02('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x8a04=['sequelize','STRING','INTEGER'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x8a04,0x1d7));var _0x48a0=function(_0x3cba10,_0x365836){_0x3cba10=_0x3cba10-0x0;var _0x27fc93=_0x8a04[_0x3cba10];return _0x27fc93;};'use strict';var Sequelize=require(_0x48a0('0x0'));module['exports']={'name':{'type':Sequelize[_0x48a0('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x48a0('0x1')]},'description':{'type':Sequelize[_0x48a0('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x48a0('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index e5d7c6c..cbef0c3 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 _0x336c=['nolimit','order','sort','where','filter','type','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','intersection','includeAll','find','create','body','addConditions','Condition','getConditions','findOne','pick','options','addActions','Action','ids','getActions','hasOwnProperty','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','Automation','rawAttributes','fieldName','model','query','filters','attributes','fields','length'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x336c,0x15f));var _0xc336=function(_0x49ae59,_0x52bdd0){_0x49ae59=_0x49ae59-0x0;var _0x3888b8=_0x336c[_0x49ae59];return _0x3888b8;};'use strict';var emlformat=require(_0xc336('0x0'));var rimraf=require(_0xc336('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc336('0x2'));var moment=require(_0xc336('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc336('0x4'));var path=require(_0xc336('0x5'));var sox=require('sox');var csv=require(_0xc336('0x6'));var ejs=require(_0xc336('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc336('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc336('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc336('0xa'));var Papa=require(_0xc336('0xb'));var Redis=require(_0xc336('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc336('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc336('0xe'));var utils=require(_0xc336('0xf'));var config=require(_0xc336('0x10'));var licenseUtil=require(_0xc336('0x11'));var db=require(_0xc336('0x12'))['db'];function respondWithStatusCode(_0x5c891e,_0x351229){_0x351229=_0x351229||0xcc;return function(_0x45302b){if(_0x45302b){return _0x5c891e['sendStatus'](_0x351229);}return _0x5c891e[_0xc336('0x13')](_0x351229)['end']();};}function respondWithResult(_0x97bba0,_0x1b74d5){_0x1b74d5=_0x1b74d5||0xc8;return function(_0x10b59b){if(_0x10b59b){return _0x97bba0[_0xc336('0x13')](_0x1b74d5)[_0xc336('0x14')](_0x10b59b);}};}function respondWithFilteredResult(_0x7b4b08,_0x90b322){return function(_0x552a60){if(_0x552a60){var _0x51c035=typeof _0x90b322[_0xc336('0x15')]===_0xc336('0x16')&&typeof _0x90b322[_0xc336('0x17')]==='undefined';var _0x125592=_0x552a60[_0xc336('0x18')];var _0x330b4c=_0x51c035?0x0:_0x90b322[_0xc336('0x15')];var _0xfff80d=_0x51c035?_0x552a60['count']:_0x90b322['offset']+_0x90b322[_0xc336('0x17')];var _0x1e121f;if(_0xfff80d>=_0x125592){_0xfff80d=_0x125592;_0x1e121f=0xc8;}else{_0x1e121f=0xce;}_0x7b4b08['status'](_0x1e121f);return _0x7b4b08[_0xc336('0x19')](_0xc336('0x1a'),_0x330b4c+'-'+_0xfff80d+'/'+_0x125592)[_0xc336('0x14')](_0x552a60);}return null;};}function patchUpdates(_0x3fcb11){return function(_0x374561){try{jsonpatch[_0xc336('0x1b')](_0x374561,_0x3fcb11,!![]);}catch(_0x1c598e){return BPromise[_0xc336('0x1c')](_0x1c598e);}return _0x374561[_0xc336('0x1d')]();};}function saveUpdates(_0x23129c,_0x5aa78b){return function(_0x43dfc2){if(_0x43dfc2){return _0x43dfc2[_0xc336('0x1e')](_0x23129c)[_0xc336('0x1f')](function(_0x70757c){return _0x70757c;});}return null;};}function removeEntity(_0x21ed12,_0x1b984a){return function(_0x308dd3){if(_0x308dd3){return _0x308dd3[_0xc336('0x20')]()['then'](function(){_0x21ed12[_0xc336('0x13')](0xcc)[_0xc336('0x21')]();});}};}function handleEntityNotFound(_0xad8b07,_0x192ec8){return function(_0x2220ac){if(!_0x2220ac){_0xad8b07[_0xc336('0x22')](0x194);}return _0x2220ac;};}function handleError(_0x50fb52,_0x4e3f96){_0x4e3f96=_0x4e3f96||0x1f4;return function(_0x133baa){logger[_0xc336('0x23')](_0x133baa['stack']);if(_0x133baa[_0xc336('0x24')]){delete _0x133baa['name'];}_0x50fb52['status'](_0x4e3f96)[_0xc336('0x25')](_0x133baa);};}exports[_0xc336('0x26')]=function(_0x3bf1d6,_0x510b09){var _0x296381={},_0x32f0eb={},_0x21b221={'count':0x0,'rows':[]};var _0x1519c6=_[_0xc336('0x27')](db[_0xc336('0x28')][_0xc336('0x29')],function(_0x11dc31){return{'name':_0x11dc31[_0xc336('0x2a')],'type':_0x11dc31['type']['key']};});_0x32f0eb[_0xc336('0x2b')]=_[_0xc336('0x27')](_0x1519c6,_0xc336('0x24'));_0x32f0eb[_0xc336('0x2c')]=_['keys'](_0x3bf1d6['query']);_0x32f0eb[_0xc336('0x2d')]=_['intersection'](_0x32f0eb['model'],_0x32f0eb[_0xc336('0x2c')]);_0x296381[_0xc336('0x2e')]=_['intersection'](_0x32f0eb[_0xc336('0x2b')],qs[_0xc336('0x2f')](_0x3bf1d6[_0xc336('0x2c')][_0xc336('0x2f')]));_0x296381[_0xc336('0x2e')]=_0x296381[_0xc336('0x2e')][_0xc336('0x30')]?_0x296381[_0xc336('0x2e')]:_0x32f0eb[_0xc336('0x2b')];if(!_0x3bf1d6[_0xc336('0x2c')]['hasOwnProperty'](_0xc336('0x31'))){_0x296381['limit']=qs[_0xc336('0x17')](_0x3bf1d6[_0xc336('0x2c')][_0xc336('0x17')]);_0x296381[_0xc336('0x15')]=qs['offset'](_0x3bf1d6[_0xc336('0x2c')][_0xc336('0x15')]);}_0x296381[_0xc336('0x32')]=qs[_0xc336('0x33')](_0x3bf1d6[_0xc336('0x2c')][_0xc336('0x33')]);_0x296381[_0xc336('0x34')]=qs[_0xc336('0x2d')](_['pick'](_0x3bf1d6[_0xc336('0x2c')],_0x32f0eb[_0xc336('0x2d')]),_0x1519c6);if(_0x3bf1d6[_0xc336('0x2c')][_0xc336('0x35')]){_0x296381[_0xc336('0x34')]=_['merge'](_0x296381['where'],{'$or':_['map'](_0x1519c6,function(_0x5126b8){if(_0x5126b8[_0xc336('0x36')]!==_0xc336('0x37')){var _0x22f8f8={};_0x22f8f8[_0x5126b8['name']]={'$like':'%'+_0x3bf1d6[_0xc336('0x2c')]['filter']+'%'};return _0x22f8f8;}})});}_0x296381=_[_0xc336('0x38')]({},_0x296381,_0x3bf1d6['options']);var _0x50e964={'where':_0x296381[_0xc336('0x34')]};return db[_0xc336('0x28')][_0xc336('0x18')](_0x50e964)[_0xc336('0x1f')](function(_0x22df8c){_0x21b221[_0xc336('0x18')]=_0x22df8c;if(_0x3bf1d6[_0xc336('0x2c')]['includeAll']){_0x296381[_0xc336('0x39')]=[{'all':!![]}];}return db['Automation'][_0xc336('0x3a')](_0x296381);})[_0xc336('0x1f')](function(_0x21438f){_0x21b221[_0xc336('0x3b')]=_0x21438f;return _0x21b221;})[_0xc336('0x1f')](respondWithFilteredResult(_0x510b09,_0x296381))[_0xc336('0x3c')](handleError(_0x510b09,null));};exports[_0xc336('0x3d')]=function(_0x1fcb3d,_0xca1ff3){var _0x1fef80={'raw':![],'where':{'id':_0x1fcb3d[_0xc336('0x3e')]['id']}},_0xc6903e={};_0xc6903e['model']=_['keys'](db[_0xc336('0x28')][_0xc336('0x29')]);_0xc6903e[_0xc336('0x2c')]=_[_0xc336('0x3f')](_0x1fcb3d['query']);_0xc6903e[_0xc336('0x2d')]=_[_0xc336('0x40')](_0xc6903e[_0xc336('0x2b')],_0xc6903e['query']);_0x1fef80[_0xc336('0x2e')]=_[_0xc336('0x40')](_0xc6903e[_0xc336('0x2b')],qs[_0xc336('0x2f')](_0x1fcb3d[_0xc336('0x2c')][_0xc336('0x2f')]));_0x1fef80[_0xc336('0x2e')]=_0x1fef80['attributes']['length']?_0x1fef80['attributes']:_0xc6903e[_0xc336('0x2b')];if(_0x1fcb3d[_0xc336('0x2c')][_0xc336('0x41')]){_0x1fef80[_0xc336('0x39')]=[{'all':!![]}];}_0x1fef80=_[_0xc336('0x38')]({},_0x1fef80,_0x1fcb3d['options']);return db['Automation'][_0xc336('0x42')](_0x1fef80)[_0xc336('0x1f')](handleEntityNotFound(_0xca1ff3,null))[_0xc336('0x1f')](respondWithResult(_0xca1ff3,null))[_0xc336('0x3c')](handleError(_0xca1ff3,null));};exports[_0xc336('0x43')]=function(_0x516433,_0x1a41b4){return db[_0xc336('0x28')][_0xc336('0x43')](_0x516433[_0xc336('0x44')],{})[_0xc336('0x1f')](respondWithResult(_0x1a41b4,0xc9))[_0xc336('0x3c')](handleError(_0x1a41b4,null));};exports[_0xc336('0x1e')]=function(_0x4a5ee2,_0x5f3123){if(_0x4a5ee2[_0xc336('0x44')]['id']){delete _0x4a5ee2[_0xc336('0x44')]['id'];}return db['Automation'][_0xc336('0x42')]({'where':{'id':_0x4a5ee2['params']['id']}})[_0xc336('0x1f')](handleEntityNotFound(_0x5f3123,null))[_0xc336('0x1f')](saveUpdates(_0x4a5ee2[_0xc336('0x44')],null))['then'](respondWithResult(_0x5f3123,null))[_0xc336('0x3c')](handleError(_0x5f3123,null));};exports['destroy']=function(_0x1cc79d,_0x27630d){return db['Automation'][_0xc336('0x42')]({'where':{'id':_0x1cc79d[_0xc336('0x3e')]['id']}})[_0xc336('0x1f')](handleEntityNotFound(_0x27630d,null))['then'](removeEntity(_0x27630d,null))[_0xc336('0x3c')](handleError(_0x27630d,null));};exports[_0xc336('0x45')]=function(_0xf3b2fa,_0x4c67dd,_0x116b24){return db[_0xc336('0x46')]['find']({'where':{'id':_0xf3b2fa[_0xc336('0x3e')]['id']}})[_0xc336('0x1f')](handleEntityNotFound(_0x4c67dd,null))[_0xc336('0x1f')](function(_0x4b5b95){if(_0x4b5b95){return _0x4b5b95[_0xc336('0x45')](_0xf3b2fa[_0xc336('0x44')]['ids'],_['omit'](_0xf3b2fa['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4c67dd,null))[_0xc336('0x3c')](handleError(_0x4c67dd,null));};exports[_0xc336('0x47')]=function(_0x438285,_0x1cd7b8,_0x5df97a){var _0x2286a1={};var _0x2c1362={};var _0x258dda;var _0x179799;return db['Automation'][_0xc336('0x48')]({'where':{'id':_0x438285[_0xc336('0x3e')]['id']}})[_0xc336('0x1f')](handleEntityNotFound(_0x1cd7b8,null))['then'](function(_0x237b52){if(_0x237b52){_0x258dda=_0x237b52;_0x2c1362[_0xc336('0x2b')]=_[_0xc336('0x3f')](db[_0xc336('0x46')]['rawAttributes']);_0x2c1362[_0xc336('0x2c')]=_[_0xc336('0x3f')](_0x438285['query']);_0x2c1362['filters']=_['intersection'](_0x2c1362[_0xc336('0x2b')],_0x2c1362[_0xc336('0x2c')]);_0x2286a1[_0xc336('0x2e')]=_['intersection'](_0x2c1362[_0xc336('0x2b')],qs[_0xc336('0x2f')](_0x438285[_0xc336('0x2c')][_0xc336('0x2f')]));_0x2286a1['attributes']=_0x2286a1['attributes'][_0xc336('0x30')]?_0x2286a1['attributes']:_0x2c1362['model'];_0x2286a1['order']=qs[_0xc336('0x33')](_0x438285['query'][_0xc336('0x33')]);_0x2286a1['where']=qs[_0xc336('0x2d')](_[_0xc336('0x49')](_0x438285[_0xc336('0x2c')],_0x2c1362[_0xc336('0x2d')]));if(_0x438285[_0xc336('0x2c')][_0xc336('0x35')]){_0x2286a1[_0xc336('0x34')]=_[_0xc336('0x38')](_0x2286a1[_0xc336('0x34')],{'$or':_[_0xc336('0x27')](_0x2286a1[_0xc336('0x2e')],function(_0x3f95ae){var _0x5cc4f3={};_0x5cc4f3[_0x3f95ae]={'$like':'%'+_0x438285[_0xc336('0x2c')][_0xc336('0x35')]+'%'};return _0x5cc4f3;})});}_0x2286a1=_[_0xc336('0x38')]({},_0x2286a1,_0x438285[_0xc336('0x4a')]);return _0x258dda['getConditions'](_0x2286a1);}})[_0xc336('0x1f')](function(_0x2edcd2){if(_0x2edcd2){_0x179799=_0x2edcd2[_0xc336('0x30')];if(!_0x438285[_0xc336('0x2c')]['hasOwnProperty']('nolimit')){_0x2286a1[_0xc336('0x17')]=qs[_0xc336('0x17')](_0x438285[_0xc336('0x2c')]['limit']);_0x2286a1['offset']=qs['offset'](_0x438285['query'][_0xc336('0x15')]);}return _0x258dda['getConditions'](_0x2286a1);}})[_0xc336('0x1f')](function(_0x53667b){if(_0x53667b){return _0x53667b?{'count':_0x179799,'rows':_0x53667b}:null;}})['then'](respondWithResult(_0x1cd7b8,null))[_0xc336('0x3c')](handleError(_0x1cd7b8,null));};exports[_0xc336('0x4b')]=function(_0x55e666,_0x86974c,_0x13f3d4){return db[_0xc336('0x4c')][_0xc336('0x42')]({'where':{'id':_0x55e666[_0xc336('0x3e')]['id']}})['then'](handleEntityNotFound(_0x86974c,null))[_0xc336('0x1f')](function(_0x4ca3f4){if(_0x4ca3f4){return _0x4ca3f4[_0xc336('0x4b')](_0x55e666[_0xc336('0x44')][_0xc336('0x4d')],_['omit'](_0x55e666['body'],[_0xc336('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x86974c,null))['catch'](handleError(_0x86974c,null));};exports[_0xc336('0x4e')]=function(_0x4df59b,_0x3ed4b1,_0xf3b328){var _0x52a238={};var _0x38455d={};var _0x521591;var _0x38b473;return db[_0xc336('0x28')][_0xc336('0x48')]({'where':{'id':_0x4df59b[_0xc336('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ed4b1,null))['then'](function(_0x217596){if(_0x217596){_0x521591=_0x217596;_0x38455d['model']=_[_0xc336('0x3f')](db['Action'][_0xc336('0x29')]);_0x38455d[_0xc336('0x2c')]=_['keys'](_0x4df59b[_0xc336('0x2c')]);_0x38455d[_0xc336('0x2d')]=_[_0xc336('0x40')](_0x38455d[_0xc336('0x2b')],_0x38455d[_0xc336('0x2c')]);_0x52a238[_0xc336('0x2e')]=_[_0xc336('0x40')](_0x38455d[_0xc336('0x2b')],qs['fields'](_0x4df59b[_0xc336('0x2c')][_0xc336('0x2f')]));_0x52a238[_0xc336('0x2e')]=_0x52a238[_0xc336('0x2e')][_0xc336('0x30')]?_0x52a238[_0xc336('0x2e')]:_0x38455d['model'];_0x52a238[_0xc336('0x32')]=qs[_0xc336('0x33')](_0x4df59b['query'][_0xc336('0x33')]);_0x52a238['where']=qs[_0xc336('0x2d')](_[_0xc336('0x49')](_0x4df59b[_0xc336('0x2c')],_0x38455d[_0xc336('0x2d')]));if(_0x4df59b[_0xc336('0x2c')][_0xc336('0x35')]){_0x52a238['where']=_[_0xc336('0x38')](_0x52a238[_0xc336('0x34')],{'$or':_[_0xc336('0x27')](_0x52a238[_0xc336('0x2e')],function(_0x40d323){var _0x5b8f5f={};_0x5b8f5f[_0x40d323]={'$like':'%'+_0x4df59b[_0xc336('0x2c')][_0xc336('0x35')]+'%'};return _0x5b8f5f;})});}_0x52a238=_[_0xc336('0x38')]({},_0x52a238,_0x4df59b[_0xc336('0x4a')]);return _0x521591[_0xc336('0x4e')](_0x52a238);}})[_0xc336('0x1f')](function(_0x390358){if(_0x390358){_0x38b473=_0x390358[_0xc336('0x30')];if(!_0x4df59b['query'][_0xc336('0x4f')](_0xc336('0x31'))){_0x52a238[_0xc336('0x17')]=qs[_0xc336('0x17')](_0x4df59b['query'][_0xc336('0x17')]);_0x52a238['offset']=qs[_0xc336('0x15')](_0x4df59b[_0xc336('0x2c')][_0xc336('0x15')]);}return _0x521591['getActions'](_0x52a238);}})[_0xc336('0x1f')](function(_0x36a225){if(_0x36a225){return _0x36a225?{'count':_0x38b473,'rows':_0x36a225}:null;}})['then'](respondWithResult(_0x3ed4b1,null))['catch'](handleError(_0x3ed4b1,null));}; \ No newline at end of file +var _0xcee9=['Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','rows','show','params','find','catch','create','body','addConditions','Condition','ids','omit','order','getConditions','addActions','Action','getActions','findOne','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set'];(function(_0x48f848,_0x887c01){var _0x783f00=function(_0x58902a){while(--_0x58902a){_0x48f848['push'](_0x48f848['shift']());}};_0x783f00(++_0x887c01);}(_0xcee9,0xe8));var _0x9cee=function(_0x3017f3,_0x138709){_0x3017f3=_0x3017f3-0x0;var _0x1a7b94=_0xcee9[_0x3017f3];return _0x1a7b94;};'use strict';var emlformat=require(_0x9cee('0x0'));var rimraf=require(_0x9cee('0x1'));var zipdir=require(_0x9cee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cee('0x3'));var moment=require(_0x9cee('0x4'));var BPromise=require(_0x9cee('0x5'));var Mustache=require(_0x9cee('0x6'));var util=require(_0x9cee('0x7'));var path=require(_0x9cee('0x8'));var sox=require(_0x9cee('0x9'));var csv=require(_0x9cee('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cee('0xb'));var _=require(_0x9cee('0xc'));var squel=require('squel');var crypto=require(_0x9cee('0xd'));var jsforce=require(_0x9cee('0xe'));var deskjs=require(_0x9cee('0xf'));var toCsv=require(_0x9cee('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9cee('0x10'));var authService=require(_0x9cee('0x11'));var qs=require(_0x9cee('0x12'));var as=require(_0x9cee('0x13'));var hardwareService=require(_0x9cee('0x14'));var logger=require('../../config/logger')(_0x9cee('0x15'));var utils=require('../../config/utils');var config=require(_0x9cee('0x16'));var licenseUtil=require(_0x9cee('0x17'));var db=require(_0x9cee('0x18'))['db'];function respondWithStatusCode(_0x1b2854,_0x5e6b9b){_0x5e6b9b=_0x5e6b9b||0xcc;return function(_0x149a7f){if(_0x149a7f){return _0x1b2854['sendStatus'](_0x5e6b9b);}return _0x1b2854['status'](_0x5e6b9b)['end']();};}function respondWithResult(_0x110be6,_0x5a0064){_0x5a0064=_0x5a0064||0xc8;return function(_0x429ed7){if(_0x429ed7){return _0x110be6[_0x9cee('0x19')](_0x5a0064)[_0x9cee('0x1a')](_0x429ed7);}};}function respondWithFilteredResult(_0x340065,_0x4569f4){return function(_0x384ee1){if(_0x384ee1){var _0x2a075=typeof _0x4569f4[_0x9cee('0x1b')]===_0x9cee('0x1c')&&typeof _0x4569f4[_0x9cee('0x1d')]===_0x9cee('0x1c');var _0x1d0a5c=_0x384ee1['count'];var _0xed57bc=_0x2a075?0x0:_0x4569f4[_0x9cee('0x1b')];var _0x17c180=_0x2a075?_0x384ee1[_0x9cee('0x1e')]:_0x4569f4[_0x9cee('0x1b')]+_0x4569f4[_0x9cee('0x1d')];var _0x7f4bed;if(_0x17c180>=_0x1d0a5c){_0x17c180=_0x1d0a5c;_0x7f4bed=0xc8;}else{_0x7f4bed=0xce;}_0x340065[_0x9cee('0x19')](_0x7f4bed);return _0x340065[_0x9cee('0x1f')](_0x9cee('0x20'),_0xed57bc+'-'+_0x17c180+'/'+_0x1d0a5c)['json'](_0x384ee1);}return null;};}function patchUpdates(_0x475c8b){return function(_0x259984){try{jsonpatch[_0x9cee('0x21')](_0x259984,_0x475c8b,!![]);}catch(_0x4fb879){return BPromise[_0x9cee('0x22')](_0x4fb879);}return _0x259984['save']();};}function saveUpdates(_0x5a713a,_0x184da2){return function(_0x17aee2){if(_0x17aee2){return _0x17aee2[_0x9cee('0x23')](_0x5a713a)[_0x9cee('0x24')](function(_0x5754a9){return _0x5754a9;});}return null;};}function removeEntity(_0x2a6fdc,_0x11e205){return function(_0x483c96){if(_0x483c96){return _0x483c96[_0x9cee('0x25')]()[_0x9cee('0x24')](function(){_0x2a6fdc[_0x9cee('0x19')](0xcc)[_0x9cee('0x26')]();});}};}function handleEntityNotFound(_0x5e445b,_0x19f746){return function(_0x276a78){if(!_0x276a78){_0x5e445b[_0x9cee('0x27')](0x194);}return _0x276a78;};}function handleError(_0x39d310,_0x5de48a){_0x5de48a=_0x5de48a||0x1f4;return function(_0x51bcc9){logger[_0x9cee('0x28')](_0x51bcc9[_0x9cee('0x29')]);if(_0x51bcc9[_0x9cee('0x2a')]){delete _0x51bcc9['name'];}_0x39d310[_0x9cee('0x19')](_0x5de48a)[_0x9cee('0x2b')](_0x51bcc9);};}exports[_0x9cee('0x2c')]=function(_0x2c6252,_0x5ee160){var _0x2f891a={},_0x4c90c1={},_0x598e70={'count':0x0,'rows':[]};var _0x3af562=_['map'](db['Automation'][_0x9cee('0x2d')],function(_0xdeab53){return{'name':_0xdeab53[_0x9cee('0x2e')],'type':_0xdeab53[_0x9cee('0x2f')][_0x9cee('0x30')]};});_0x4c90c1['model']=_[_0x9cee('0x31')](_0x3af562,_0x9cee('0x2a'));_0x4c90c1[_0x9cee('0x32')]=_[_0x9cee('0x33')](_0x2c6252[_0x9cee('0x32')]);_0x4c90c1[_0x9cee('0x34')]=_[_0x9cee('0x35')](_0x4c90c1[_0x9cee('0x36')],_0x4c90c1[_0x9cee('0x32')]);_0x2f891a[_0x9cee('0x37')]=_['intersection'](_0x4c90c1[_0x9cee('0x36')],qs['fields'](_0x2c6252['query'][_0x9cee('0x38')]));_0x2f891a['attributes']=_0x2f891a[_0x9cee('0x37')][_0x9cee('0x39')]?_0x2f891a[_0x9cee('0x37')]:_0x4c90c1[_0x9cee('0x36')];if(!_0x2c6252['query'][_0x9cee('0x3a')]('nolimit')){_0x2f891a['limit']=qs[_0x9cee('0x1d')](_0x2c6252[_0x9cee('0x32')]['limit']);_0x2f891a[_0x9cee('0x1b')]=qs[_0x9cee('0x1b')](_0x2c6252[_0x9cee('0x32')][_0x9cee('0x1b')]);}_0x2f891a['order']=qs[_0x9cee('0x3b')](_0x2c6252[_0x9cee('0x32')][_0x9cee('0x3b')]);_0x2f891a[_0x9cee('0x3c')]=qs[_0x9cee('0x34')](_[_0x9cee('0x3d')](_0x2c6252['query'],_0x4c90c1[_0x9cee('0x34')]),_0x3af562);if(_0x2c6252[_0x9cee('0x32')][_0x9cee('0x3e')]){_0x2f891a['where']=_[_0x9cee('0x3f')](_0x2f891a['where'],{'$or':_[_0x9cee('0x31')](_0x3af562,function(_0x5eb118){if(_0x5eb118[_0x9cee('0x2f')]!==_0x9cee('0x40')){var _0x345614={};_0x345614[_0x5eb118['name']]={'$like':'%'+_0x2c6252['query'][_0x9cee('0x3e')]+'%'};return _0x345614;}})});}_0x2f891a=_[_0x9cee('0x3f')]({},_0x2f891a,_0x2c6252[_0x9cee('0x41')]);var _0x415b8b={'where':_0x2f891a[_0x9cee('0x3c')]};return db[_0x9cee('0x42')]['count'](_0x415b8b)[_0x9cee('0x24')](function(_0x2d87fc){_0x598e70[_0x9cee('0x1e')]=_0x2d87fc;if(_0x2c6252[_0x9cee('0x32')][_0x9cee('0x43')]){_0x2f891a[_0x9cee('0x44')]=[{'all':!![]}];}return db[_0x9cee('0x42')][_0x9cee('0x45')](_0x2f891a);})['then'](function(_0x390a6a){_0x598e70[_0x9cee('0x46')]=_0x390a6a;return _0x598e70;})['then'](respondWithFilteredResult(_0x5ee160,_0x2f891a))['catch'](handleError(_0x5ee160,null));};exports[_0x9cee('0x47')]=function(_0x33cacc,_0x43ed0c){var _0x4823b2={'raw':![],'where':{'id':_0x33cacc[_0x9cee('0x48')]['id']}},_0x404fa6={};_0x404fa6[_0x9cee('0x36')]=_[_0x9cee('0x33')](db[_0x9cee('0x42')]['rawAttributes']);_0x404fa6[_0x9cee('0x32')]=_[_0x9cee('0x33')](_0x33cacc[_0x9cee('0x32')]);_0x404fa6[_0x9cee('0x34')]=_[_0x9cee('0x35')](_0x404fa6[_0x9cee('0x36')],_0x404fa6[_0x9cee('0x32')]);_0x4823b2[_0x9cee('0x37')]=_[_0x9cee('0x35')](_0x404fa6['model'],qs[_0x9cee('0x38')](_0x33cacc['query'][_0x9cee('0x38')]));_0x4823b2['attributes']=_0x4823b2[_0x9cee('0x37')][_0x9cee('0x39')]?_0x4823b2['attributes']:_0x404fa6[_0x9cee('0x36')];if(_0x33cacc[_0x9cee('0x32')][_0x9cee('0x43')]){_0x4823b2['include']=[{'all':!![]}];}_0x4823b2=_[_0x9cee('0x3f')]({},_0x4823b2,_0x33cacc[_0x9cee('0x41')]);return db[_0x9cee('0x42')][_0x9cee('0x49')](_0x4823b2)[_0x9cee('0x24')](handleEntityNotFound(_0x43ed0c,null))[_0x9cee('0x24')](respondWithResult(_0x43ed0c,null))[_0x9cee('0x4a')](handleError(_0x43ed0c,null));};exports[_0x9cee('0x4b')]=function(_0x2de9ed,_0xbcef18){return db[_0x9cee('0x42')][_0x9cee('0x4b')](_0x2de9ed[_0x9cee('0x4c')],{})[_0x9cee('0x24')](respondWithResult(_0xbcef18,0xc9))[_0x9cee('0x4a')](handleError(_0xbcef18,null));};exports['update']=function(_0x51d0ee,_0x5827bd){if(_0x51d0ee[_0x9cee('0x4c')]['id']){delete _0x51d0ee['body']['id'];}return db[_0x9cee('0x42')][_0x9cee('0x49')]({'where':{'id':_0x51d0ee[_0x9cee('0x48')]['id']}})[_0x9cee('0x24')](handleEntityNotFound(_0x5827bd,null))[_0x9cee('0x24')](saveUpdates(_0x51d0ee['body'],null))['then'](respondWithResult(_0x5827bd,null))[_0x9cee('0x4a')](handleError(_0x5827bd,null));};exports['destroy']=function(_0x446bcd,_0x4c675b){return db[_0x9cee('0x42')][_0x9cee('0x49')]({'where':{'id':_0x446bcd['params']['id']}})[_0x9cee('0x24')](handleEntityNotFound(_0x4c675b,null))[_0x9cee('0x24')](removeEntity(_0x4c675b,null))[_0x9cee('0x4a')](handleError(_0x4c675b,null));};exports[_0x9cee('0x4d')]=function(_0x4b02e7,_0x5d342a,_0x41b5be){return db[_0x9cee('0x4e')]['find']({'where':{'id':_0x4b02e7[_0x9cee('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d342a,null))[_0x9cee('0x24')](function(_0x34fd79){if(_0x34fd79){return _0x34fd79[_0x9cee('0x4d')](_0x4b02e7[_0x9cee('0x4c')][_0x9cee('0x4f')],_[_0x9cee('0x50')](_0x4b02e7[_0x9cee('0x4c')],['ids','id'])||{});}})[_0x9cee('0x24')](respondWithResult(_0x5d342a,null))[_0x9cee('0x4a')](handleError(_0x5d342a,null));};exports['getConditions']=function(_0x3768ed,_0x2b7fac,_0x176bda){var _0x402aa9={};var _0x5a0da5={};var _0x4d82c6;var _0x308dd6;return db['Automation']['findOne']({'where':{'id':_0x3768ed[_0x9cee('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b7fac,null))[_0x9cee('0x24')](function(_0x53d137){if(_0x53d137){_0x4d82c6=_0x53d137;_0x5a0da5['model']=_[_0x9cee('0x33')](db[_0x9cee('0x4e')][_0x9cee('0x2d')]);_0x5a0da5['query']=_[_0x9cee('0x33')](_0x3768ed[_0x9cee('0x32')]);_0x5a0da5['filters']=_[_0x9cee('0x35')](_0x5a0da5['model'],_0x5a0da5[_0x9cee('0x32')]);_0x402aa9['attributes']=_[_0x9cee('0x35')](_0x5a0da5['model'],qs[_0x9cee('0x38')](_0x3768ed[_0x9cee('0x32')][_0x9cee('0x38')]));_0x402aa9['attributes']=_0x402aa9[_0x9cee('0x37')][_0x9cee('0x39')]?_0x402aa9['attributes']:_0x5a0da5['model'];_0x402aa9[_0x9cee('0x51')]=qs[_0x9cee('0x3b')](_0x3768ed['query']['sort']);_0x402aa9[_0x9cee('0x3c')]=qs['filters'](_[_0x9cee('0x3d')](_0x3768ed[_0x9cee('0x32')],_0x5a0da5[_0x9cee('0x34')]));if(_0x3768ed[_0x9cee('0x32')][_0x9cee('0x3e')]){_0x402aa9['where']=_[_0x9cee('0x3f')](_0x402aa9[_0x9cee('0x3c')],{'$or':_[_0x9cee('0x31')](_0x402aa9['attributes'],function(_0x3c95c8){var _0xcdff11={};_0xcdff11[_0x3c95c8]={'$like':'%'+_0x3768ed[_0x9cee('0x32')][_0x9cee('0x3e')]+'%'};return _0xcdff11;})});}_0x402aa9=_[_0x9cee('0x3f')]({},_0x402aa9,_0x3768ed[_0x9cee('0x41')]);return _0x4d82c6[_0x9cee('0x52')](_0x402aa9);}})['then'](function(_0x5551b3){if(_0x5551b3){_0x308dd6=_0x5551b3[_0x9cee('0x39')];if(!_0x3768ed['query'][_0x9cee('0x3a')]('nolimit')){_0x402aa9[_0x9cee('0x1d')]=qs[_0x9cee('0x1d')](_0x3768ed[_0x9cee('0x32')][_0x9cee('0x1d')]);_0x402aa9[_0x9cee('0x1b')]=qs[_0x9cee('0x1b')](_0x3768ed['query'][_0x9cee('0x1b')]);}return _0x4d82c6[_0x9cee('0x52')](_0x402aa9);}})[_0x9cee('0x24')](function(_0x53cb3c){if(_0x53cb3c){return _0x53cb3c?{'count':_0x308dd6,'rows':_0x53cb3c}:null;}})['then'](respondWithResult(_0x2b7fac,null))[_0x9cee('0x4a')](handleError(_0x2b7fac,null));};exports[_0x9cee('0x53')]=function(_0x940e34,_0x3d887c,_0x8fb6f4){return db[_0x9cee('0x54')][_0x9cee('0x49')]({'where':{'id':_0x940e34[_0x9cee('0x48')]['id']}})[_0x9cee('0x24')](handleEntityNotFound(_0x3d887c,null))['then'](function(_0x415c06){if(_0x415c06){return _0x415c06[_0x9cee('0x53')](_0x940e34[_0x9cee('0x4c')][_0x9cee('0x4f')],_[_0x9cee('0x50')](_0x940e34[_0x9cee('0x4c')],[_0x9cee('0x4f'),'id'])||{});}})[_0x9cee('0x24')](respondWithResult(_0x3d887c,null))[_0x9cee('0x4a')](handleError(_0x3d887c,null));};exports[_0x9cee('0x55')]=function(_0x23016c,_0x2ffe51,_0x388daf){var _0x971a={};var _0x1aaec4={};var _0x7a0f01;var _0x2481f8;return db['Automation'][_0x9cee('0x56')]({'where':{'id':_0x23016c['params']['id']}})[_0x9cee('0x24')](handleEntityNotFound(_0x2ffe51,null))[_0x9cee('0x24')](function(_0x4a04d0){if(_0x4a04d0){_0x7a0f01=_0x4a04d0;_0x1aaec4[_0x9cee('0x36')]=_[_0x9cee('0x33')](db[_0x9cee('0x54')]['rawAttributes']);_0x1aaec4[_0x9cee('0x32')]=_[_0x9cee('0x33')](_0x23016c[_0x9cee('0x32')]);_0x1aaec4[_0x9cee('0x34')]=_[_0x9cee('0x35')](_0x1aaec4[_0x9cee('0x36')],_0x1aaec4[_0x9cee('0x32')]);_0x971a[_0x9cee('0x37')]=_['intersection'](_0x1aaec4[_0x9cee('0x36')],qs[_0x9cee('0x38')](_0x23016c[_0x9cee('0x32')][_0x9cee('0x38')]));_0x971a[_0x9cee('0x37')]=_0x971a[_0x9cee('0x37')][_0x9cee('0x39')]?_0x971a[_0x9cee('0x37')]:_0x1aaec4[_0x9cee('0x36')];_0x971a['order']=qs[_0x9cee('0x3b')](_0x23016c[_0x9cee('0x32')]['sort']);_0x971a[_0x9cee('0x3c')]=qs['filters'](_[_0x9cee('0x3d')](_0x23016c[_0x9cee('0x32')],_0x1aaec4[_0x9cee('0x34')]));if(_0x23016c[_0x9cee('0x32')][_0x9cee('0x3e')]){_0x971a['where']=_[_0x9cee('0x3f')](_0x971a['where'],{'$or':_[_0x9cee('0x31')](_0x971a[_0x9cee('0x37')],function(_0xc9f4c2){var _0x9f2237={};_0x9f2237[_0xc9f4c2]={'$like':'%'+_0x23016c[_0x9cee('0x32')][_0x9cee('0x3e')]+'%'};return _0x9f2237;})});}_0x971a=_['merge']({},_0x971a,_0x23016c[_0x9cee('0x41')]);return _0x7a0f01[_0x9cee('0x55')](_0x971a);}})[_0x9cee('0x24')](function(_0x37dd91){if(_0x37dd91){_0x2481f8=_0x37dd91[_0x9cee('0x39')];if(!_0x23016c['query'][_0x9cee('0x3a')](_0x9cee('0x57'))){_0x971a['limit']=qs[_0x9cee('0x1d')](_0x23016c[_0x9cee('0x32')]['limit']);_0x971a[_0x9cee('0x1b')]=qs[_0x9cee('0x1b')](_0x23016c[_0x9cee('0x32')][_0x9cee('0x1b')]);}return _0x7a0f01[_0x9cee('0x55')](_0x971a);}})[_0x9cee('0x24')](function(_0x9c7f92){if(_0x9c7f92){return _0x9c7f92?{'count':_0x2481f8,'rows':_0x9c7f92}:null;}})[_0x9cee('0x24')](respondWithResult(_0x2ffe51,null))[_0x9cee('0x4a')](handleError(_0x2ffe51,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 5e4cc75..94c97ba 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 _0xf2e2=['define','Automation','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes'];(function(_0x5ad18c,_0x4ee0d3){var _0x470c74=function(_0x3b5850){while(--_0x3b5850){_0x5ad18c['push'](_0x5ad18c['shift']());}};_0x470c74(++_0x4ee0d3);}(_0xf2e2,0x1db));var _0x2f2e=function(_0x3d3904,_0x5dfdb){_0x3d3904=_0x3d3904-0x0;var _0x20cdfc=_0xf2e2[_0x3d3904];return _0x20cdfc;};'use strict';var _=require(_0x2f2e('0x0'));var util=require(_0x2f2e('0x1'));var logger=require(_0x2f2e('0x2'))('api');var moment=require(_0x2f2e('0x3'));var BPromise=require(_0x2f2e('0x4'));var rp=require(_0x2f2e('0x5'));var fs=require('fs');var path=require(_0x2f2e('0x6'));var rimraf=require('rimraf');var config=require(_0x2f2e('0x7'));var attributes=require(_0x2f2e('0x8'));module['exports']=function(_0x33420c,_0x109a3f){return _0x33420c[_0x2f2e('0x9')](_0x2f2e('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc3d=['rimraf','./automation.attributes','exports','Automation','tools_automations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x22e6f0,_0x9d6f84){var _0x31aeaf=function(_0x203316){while(--_0x203316){_0x22e6f0['push'](_0x22e6f0['shift']());}};_0x31aeaf(++_0x9d6f84);}(_0xfc3d,0x19d));var _0xdfc3=function(_0x208cda,_0x46fb61){_0x208cda=_0x208cda-0x0;var _0x3cc9a8=_0xfc3d[_0x208cda];return _0x3cc9a8;};'use strict';var _=require(_0xdfc3('0x0'));var util=require(_0xdfc3('0x1'));var logger=require('../../config/logger')(_0xdfc3('0x2'));var moment=require(_0xdfc3('0x3'));var BPromise=require(_0xdfc3('0x4'));var rp=require(_0xdfc3('0x5'));var fs=require('fs');var path=require(_0xdfc3('0x6'));var rimraf=require(_0xdfc3('0x7'));var config=require('../../config/environment');var attributes=require(_0xdfc3('0x8'));module[_0xdfc3('0x9')]=function(_0x401d1a,_0xf38aa4){return _0x401d1a['define'](_0xdfc3('0xa'),attributes,{'tableName':_0xdfc3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 746a4ec..265151a 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 _0x3014=['request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s'];(function(_0x487af7,_0x3afa30){var _0x15be2e=function(_0xd48c1b){while(--_0xd48c1b){_0x487af7['push'](_0x487af7['shift']());}};_0x15be2e(++_0x3afa30);}(_0x3014,0x1d7));var _0x4301=function(_0x4f7fa8,_0x268486){_0x4f7fa8=_0x4f7fa8-0x0;var _0x50c25a=_0x3014[_0x4f7fa8];return _0x50c25a;};'use strict';var _=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var moment=require('moment');var BPromise=require(_0x4301('0x2'));var rs=require(_0x4301('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4301('0x4'));var logger=require(_0x4301('0x5'))(_0x4301('0x6'));var config=require(_0x4301('0x7'));var jayson=require(_0x4301('0x8'));var client=jayson[_0x4301('0x9')][_0x4301('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6e61,_0x5013c,_0x1dc855){return new BPromise(function(_0x337800,_0x4d5020){return client['request'](_0x3a6e61,_0x1dc855)[_0x4301('0xb')](function(_0x2d6581){logger['info'](_0x4301('0xc'),_0x5013c,_0x4301('0xd'));logger[_0x4301('0xe')](_0x4301('0xf'),_0x5013c,'request\x20sent',JSON[_0x4301('0x10')](_0x2d6581));if(_0x2d6581['error']){if(_0x2d6581[_0x4301('0x11')][_0x4301('0x12')]===0x1f4){logger[_0x4301('0x11')](_0x4301('0xc'),_0x5013c,_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);return _0x4d5020(_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);}logger[_0x4301('0x11')](_0x4301('0xc'),_0x5013c,_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);return _0x337800(_0x2d6581[_0x4301('0x11')]['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x5013c,_0x4301('0xd'));_0x337800(_0x2d6581[_0x4301('0x14')][_0x4301('0x13')]);}})[_0x4301('0x15')](function(_0x4da25c){logger['error'](_0x4301('0xc'),_0x5013c,_0x4da25c);_0x4d5020(_0x4da25c);});});} \ No newline at end of file +var _0xc6d7=['rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3a64dc,_0x1f46be){var _0x58d3a2=function(_0x1031cd){while(--_0x1031cd){_0x3a64dc['push'](_0x3a64dc['shift']());}};_0x58d3a2(++_0x1f46be);}(_0xc6d7,0x71));var _0x7c6d=function(_0x3c9d4b,_0x57223d){_0x3c9d4b=_0x3c9d4b-0x0;var _0x234a8a=_0xc6d7[_0x3c9d4b];return _0x234a8a;};'use strict';var _=require(_0x7c6d('0x0'));var util=require(_0x7c6d('0x1'));var moment=require(_0x7c6d('0x2'));var BPromise=require(_0x7c6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c6d('0x4'))['db'];var utils=require(_0x7c6d('0x5'));var logger=require(_0x7c6d('0x6'))(_0x7c6d('0x7'));var config=require(_0x7c6d('0x8'));var jayson=require(_0x7c6d('0x9'));var client=jayson[_0x7c6d('0xa')][_0x7c6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x446b68,_0x45713e,_0x338f94){return new BPromise(function(_0x1ad7e2,_0x22755d){return client[_0x7c6d('0xc')](_0x446b68,_0x338f94)['then'](function(_0x477a41){logger['info'](_0x7c6d('0xd'),_0x45713e,_0x7c6d('0xe'));logger[_0x7c6d('0xf')](_0x7c6d('0x10'),_0x45713e,'request\x20sent',JSON[_0x7c6d('0x11')](_0x477a41));if(_0x477a41[_0x7c6d('0x12')]){if(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x13')]===0x1f4){logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x477a41[_0x7c6d('0x12')]['message']);return _0x22755d(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);}logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);return _0x1ad7e2(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);}else{logger[_0x7c6d('0x15')]('Automation,\x20%s,\x20%s',_0x45713e,_0x7c6d('0xe'));_0x1ad7e2(_0x477a41[_0x7c6d('0x16')]['message']);}})[_0x7c6d('0x17')](function(_0x220bae){logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x220bae);_0x22755d(_0x220bae);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d39165f..fd09122 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 _0x2e3d=['addActions','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','create','post','addConditions','/:id/actions'];(function(_0x527a6c,_0x15b18d){var _0x4c780d=function(_0xebc03){while(--_0xebc03){_0x527a6c['push'](_0x527a6c['shift']());}};_0x4c780d(++_0x15b18d);}(_0x2e3d,0x8c));var _0xd2e3=function(_0x19c3fd,_0x5a83bf){_0x19c3fd=_0x19c3fd-0x0;var _0x321198=_0x2e3d[_0x19c3fd];return _0x321198;};'use strict';var multer=require(_0xd2e3('0x0'));var util=require(_0xd2e3('0x1'));var path=require(_0xd2e3('0x2'));var timeout=require(_0xd2e3('0x3'));var express=require(_0xd2e3('0x4'));var router=express[_0xd2e3('0x5')]();var fs_extra=require(_0xd2e3('0x6'));var auth=require(_0xd2e3('0x7'));var interaction=require(_0xd2e3('0x8'));var config=require('../../config/environment');var controller=require(_0xd2e3('0x9'));router[_0xd2e3('0xa')]('/',auth[_0xd2e3('0xb')](),controller[_0xd2e3('0xc')]);router['get'](_0xd2e3('0xd'),auth['isAuthenticated'](),controller[_0xd2e3('0xe')]);router['get'](_0xd2e3('0xf'),auth[_0xd2e3('0xb')](),controller[_0xd2e3('0x10')]);router[_0xd2e3('0xa')]('/:id/actions',auth[_0xd2e3('0xb')](),controller[_0xd2e3('0x11')]);router['post']('/',auth[_0xd2e3('0xb')](),controller[_0xd2e3('0x12')]);router[_0xd2e3('0x13')]('/:id/conditions',auth[_0xd2e3('0xb')](),controller[_0xd2e3('0x14')]);router[_0xd2e3('0x13')](_0xd2e3('0x15'),auth[_0xd2e3('0xb')](),controller[_0xd2e3('0x16')]);router[_0xd2e3('0x17')](_0xd2e3('0xd'),auth[_0xd2e3('0xb')](),controller[_0xd2e3('0x18')]);router[_0xd2e3('0x19')](_0xd2e3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd2e3('0x1a')]=router; \ No newline at end of file +var _0xac52=['/:id','show','/:id/conditions','getConditions','/:id/actions','post','create','addActions','put','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated'];(function(_0x205496,_0x11ab53){var _0x449187=function(_0xf07d19){while(--_0xf07d19){_0x205496['push'](_0x205496['shift']());}};_0x449187(++_0x11ab53);}(_0xac52,0x122));var _0x2ac5=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xac52[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x2ac5('0x0'));var path=require(_0x2ac5('0x1'));var timeout=require(_0x2ac5('0x2'));var express=require(_0x2ac5('0x3'));var router=express[_0x2ac5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2ac5('0x5'));var interaction=require(_0x2ac5('0x6'));var config=require('../../config/environment');var controller=require(_0x2ac5('0x7'));router[_0x2ac5('0x8')]('/',auth[_0x2ac5('0x9')](),controller['index']);router['get'](_0x2ac5('0xa'),auth[_0x2ac5('0x9')](),controller[_0x2ac5('0xb')]);router[_0x2ac5('0x8')](_0x2ac5('0xc'),auth[_0x2ac5('0x9')](),controller[_0x2ac5('0xd')]);router[_0x2ac5('0x8')](_0x2ac5('0xe'),auth[_0x2ac5('0x9')](),controller['getActions']);router[_0x2ac5('0xf')]('/',auth[_0x2ac5('0x9')](),controller[_0x2ac5('0x10')]);router[_0x2ac5('0xf')]('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x2ac5('0xf')](_0x2ac5('0xe'),auth[_0x2ac5('0x9')](),controller[_0x2ac5('0x11')]);router[_0x2ac5('0x12')]('/:id',auth[_0x2ac5('0x9')](),controller['update']);router[_0x2ac5('0x13')](_0x2ac5('0xa'),auth[_0x2ac5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 286c834..e5e6351 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 _0xb954=['#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x38ceff,_0x3c88bd){var _0x44c5f6=function(_0x3288f9){while(--_0x3288f9){_0x38ceff['push'](_0x38ceff['shift']());}};_0x44c5f6(++_0x3c88bd);}(_0xb954,0x115));var _0x4b95=function(_0x1a124d,_0x3e04b0){_0x1a124d=_0x1a124d-0x0;var _0x5f0830=_0xb954[_0x1a124d];return _0x5f0830;};'use strict';var Sequelize=require(_0x4b95('0x0'));module[_0x4b95('0x1')]={'name':{'type':Sequelize[_0x4b95('0x2')],'unique':_0x4b95('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x4b95('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4b95('0x5')],'defaultValue':0x0,'comment':_0x4b95('0x6')},'limitCalls':{'type':Sequelize[_0x4b95('0x7')](0x4)[_0x4b95('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x4b95('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4b95('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x4b95('0x7')](0x3)[_0x4b95('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4b95('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4b95('0x7')](0x3)[_0x4b95('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4b95('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4b95('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4b95('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x4b95('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4b95('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4b95('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4b95('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4b95('0x7')](0x3)[_0x4b95('0x8')],'defaultValue':0x3,'comment':_0x4b95('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4b95('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4b95('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4b95('0x7')](0x3)[_0x4b95('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4b95('0x2')],'defaultValue':_0x4b95('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x4b95('0x11')](_0x4b95('0x12'),_0x4b95('0x13'),'onlyIfOpen'),'defaultValue':_0x4b95('0x12')},'dialAMDActive':{'type':Sequelize[_0x4b95('0x5')],'defaultValue':0x0,'comment':_0x4b95('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x4b95('0x7')](0x9)[_0x4b95('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4b95('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x4b95('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4b95('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4b95('0x7')](0x9)[_0x4b95('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4b95('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4b95('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x4b95('0x7')](0x9)[_0x4b95('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4b95('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4b95('0x7')](0x9)[_0x4b95('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4b95('0x7')](0x9)[_0x4b95('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4b95('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4b95('0x7')](0x5)[_0x4b95('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4b95('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4b95('0x7')](0x9)[_0x4b95('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4b95('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4b95('0x11')]('DESC',_0x4b95('0x1d')),'defaultValue':_0x4b95('0x1e')},'dialPrefix':{'type':Sequelize[_0x4b95('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x4b95('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4b95('0x1f')},'dialCutDigit':{'type':Sequelize[_0x4b95('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4b95('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4b95('0x7')](0x3)[_0x4b95('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4b95('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4b95('0x21')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4b95('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4b95('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x4b95('0x7')](0x5)[_0x4b95('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4b95('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4b95('0x7')](0x3)[_0x4b95('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4b95('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4b95('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4b95('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x4b95('0x7')](0x3)[_0x4b95('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4b95('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4b95('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4b95('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4b95('0x7')](0x3)[_0x4b95('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4b95('0x28')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4b95('0x7')](0x5)[_0x4b95('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x028a=['ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name'];(function(_0x54854b,_0x5e2ab3){var _0x2ed79b=function(_0x3fc3af){while(--_0x3fc3af){_0x54854b['push'](_0x54854b['shift']());}};_0x2ed79b(++_0x5e2ab3);}(_0x028a,0x1b5));var _0xa028=function(_0x28b709,_0x4d7a52){_0x28b709=_0x28b709-0x0;var _0x1ebf2f=_0x028a[_0x28b709];return _0x1ebf2f;};'use strict';var Sequelize=require('sequelize');module[_0xa028('0x0')]={'name':{'type':Sequelize[_0xa028('0x1')],'unique':_0xa028('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa028('0x3')),'allowNull':![],'defaultValue':_0xa028('0x3')},'description':{'type':Sequelize[_0xa028('0x1')]},'active':{'type':Sequelize[_0xa028('0x4')],'defaultValue':0x0,'comment':_0xa028('0x5')},'limitCalls':{'type':Sequelize[_0xa028('0x6')](0x4)[_0xa028('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa028('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xa028('0x6')](0x3)[_0xa028('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa028('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa028('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa028('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa028('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa028('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xa028('0x6')](0x3)[_0xa028('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa028('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa028('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa028('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa028('0x6')](0x3)[_0xa028('0x7')],'defaultValue':0x3,'comment':_0xa028('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa028('0x6')](0x5)[_0xa028('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa028('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa028('0x6')](0x3)[_0xa028('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa028('0xf')},'dialTimezone':{'type':Sequelize[_0xa028('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa028('0x1')],'defaultValue':_0xa028('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xa028('0x11'),_0xa028('0x12')),'defaultValue':_0xa028('0x13')},'dialAMDActive':{'type':Sequelize[_0xa028('0x4')],'defaultValue':0x0,'comment':_0xa028('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xa028('0x6')](0x9)[_0xa028('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa028('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xa028('0x6')](0x9)[_0xa028('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa028('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa028('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa028('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xa028('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa028('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xa028('0x6')](0x9)[_0xa028('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa028('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa028('0x6')](0x9)[_0xa028('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa028('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xa028('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xa028('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa028('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa028('0x6')](0x9)[_0xa028('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xa028('0x1c')](_0xa028('0x1d'),_0xa028('0x1e')),'defaultValue':_0xa028('0x1d')},'dialPrefix':{'type':Sequelize[_0xa028('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa028('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa028('0x1f')},'dialCutDigit':{'type':Sequelize[_0xa028('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa028('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa028('0x6')](0x3)[_0xa028('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa028('0x6')](0x5)[_0xa028('0x7')],'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':_0xa028('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa028('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa028('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa028('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa028('0x6')](0x5)[_0xa028('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa028('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0xa028('0x6')](0x3)[_0xa028('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa028('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa028('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa028('0x6')](0x3)[_0xa028('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa028('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa028('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa028('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4a30029..4e871a0 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 _0x97c1=['where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','find','autoAssociation','getHoppers','findOne','pick','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','omit','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','insert','into','cmHopperId','OrderBy','h.id','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','format','addBlackLists','removeBlackLists','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','IvrCampaigns','sendStatus','error','stack','name','Campaign','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x26d034,_0x2c22db){var _0x3015aa=function(_0x282e96){while(--_0x282e96){_0x26d034['push'](_0x26d034['shift']());}};_0x3015aa(++_0x2c22db);}(_0x97c1,0xdf));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x52')]=function(_0x3a9261,_0x275294){var _0x5f3301={'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}},_0x244faa={};_0x244faa[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')]['rawAttributes']);_0x5f3301['attributes']=_[_0x197c('0x35')](_0x244faa[_0x197c('0x31')],qs[_0x197c('0x37')](_0x3a9261[_0x197c('0x33')][_0x197c('0x37')]));_0x5f3301['attributes']=_0x5f3301['attributes'][_0x197c('0x38')]?_0x5f3301[_0x197c('0x36')]:_0x244faa['model'];if(_0x3a9261[_0x197c('0x33')][_0x197c('0x41')]){_0x5f3301[_0x197c('0x48')]=[{'all':!![]}];}_0x5f3301=_[_0x197c('0x3f')]({},_0x5f3301,_0x3a9261[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x5f3301)[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))[_0x197c('0x24')](function(_0x57c8c8){if(_0x57c8c8){var _0x480cab=_0x57c8c8[_0x197c('0x26')]({'plain':!![]});_0x480cab=qs['omit'](_0x480cab,['id',_0x197c('0x53'),_0x197c('0x54')]);_0x3a9261[_0x197c('0x4a')]=_['omit'](_0x3a9261[_0x197c('0x4a')],['id',_0x197c('0x53'),'updatedAt']);return db[_0x197c('0x2c')][_0x197c('0x49')](_[_0x197c('0x3f')](_0x480cab,_0x3a9261['body']),{'include':_0x3a9261[_0x197c('0x33')][_0x197c('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x570d76){var _0x381191=_0x3a9261[_0x197c('0x4b')][_0x197c('0x26')]({'plain':!![]});if(!_0x381191)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x381191[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x32e8ba=_0x570d76['get']({'plain':!![]});var _0xe84f3b=_0x197c('0x27');return db[_0x197c('0x4e')][_0x197c('0x55')]({'where':{'name':_0xe84f3b,'userProfileId':_0x381191[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x8d1f3f){if(_0x8d1f3f&&_0x8d1f3f[_0x197c('0x56')]===0x0){return db[_0x197c('0x50')][_0x197c('0x49')]({'name':_0x32e8ba['name'],'resourceId':_0x32e8ba['id'],'type':_0x8d1f3f[_0x197c('0x2b')],'sectionId':_0x8d1f3f['id']},{})['then'](function(){return _0x570d76;});}else{return _0x570d76;}})['catch'](function(_0x4a8e13){logger['error'](_0x197c('0x51'),_0x4a8e13);throw _0x4a8e13;});}return _0x570d76;});}})[_0x197c('0x24')](respondWithResult(_0x275294,0xc9))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x23')]=function(_0x55b744,_0x32d739){if(_0x55b744['body']['id']){delete _0x55b744[_0x197c('0x4a')]['id'];}return db['Campaign'][_0x197c('0x55')]({'where':{'id':_0x55b744['params']['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x32d739,null))[_0x197c('0x24')](saveUpdates(_0x55b744[_0x197c('0x4a')],null))[_0x197c('0x24')](respondWithResult(_0x32d739,null))['catch'](handleError(_0x32d739,null));};exports[_0x197c('0x25')]=function(_0x304cb7,_0x33ae9c){return db['Campaign'][_0x197c('0x55')]({'where':{'id':_0x304cb7[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x33ae9c,null))[_0x197c('0x24')](removeEntity(_0x33ae9c,null))[_0x197c('0x44')](handleError(_0x33ae9c,null));};exports[_0x197c('0x57')]=function(_0x1e6371,_0x436a53,_0x2c7e66){var _0x1947bd={'raw':!![],'where':{}};var _0x342efa={};var _0x25d3c1={'count':0x0,'rows':[]};return db[_0x197c('0x2c')][_0x197c('0x58')]({'where':{'id':_0x1e6371[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x436a53,null))[_0x197c('0x24')](function(_0x2a03e3){if(_0x2a03e3){_0x342efa['model']=_['keys'](db['CmHopper'][_0x197c('0x2d')]);_0x342efa['query']=_[_0x197c('0x47')](_0x1e6371['query']);_0x342efa['filters']=_[_0x197c('0x35')](_0x342efa[_0x197c('0x31')],_0x342efa[_0x197c('0x33')]);_0x1947bd['attributes']=_[_0x197c('0x35')](_0x342efa[_0x197c('0x31')],qs['fields'](_0x1e6371[_0x197c('0x33')][_0x197c('0x37')]));_0x1947bd[_0x197c('0x36')]=_0x1947bd[_0x197c('0x36')]['length']?_0x1947bd[_0x197c('0x36')]:_0x342efa['model'];if(!_0x1e6371[_0x197c('0x33')]['hasOwnProperty'](_0x197c('0x3a'))){_0x1947bd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1e6371['query'][_0x197c('0x1b')]);_0x1947bd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1e6371['query'][_0x197c('0x19')]);}_0x1947bd[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x1e6371[_0x197c('0x33')][_0x197c('0x3c')]);_0x1947bd[_0x197c('0x3d')]=qs['filters'](_[_0x197c('0x59')](_0x1e6371['query'],_0x342efa['filters']));_0x1947bd[_0x197c('0x3d')][_0x197c('0x5a')]=_0x2a03e3['id'];if(_0x1e6371['query'][_0x197c('0x3e')]){_0x1947bd[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x1947bd[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x1947bd['attributes'],function(_0x5da64e){var _0x4ca9b9={};_0x4ca9b9[_0x5da64e]={'$like':'%'+_0x1e6371['query'][_0x197c('0x3e')]+'%'};return _0x4ca9b9;})});}_0x1947bd=_[_0x197c('0x3f')]({},_0x1947bd,_0x1e6371['options']);return db['CmHopper'][_0x197c('0x1c')]({'where':_0x1947bd['where']})['then'](function(_0x2d4b26){_0x25d3c1[_0x197c('0x1c')]=_0x2d4b26;if(_0x1e6371[_0x197c('0x33')][_0x197c('0x41')]){_0x1947bd[_0x197c('0x48')]=[{'all':!![]}];}return db[_0x197c('0x5b')]['findAll'](_0x1947bd);})[_0x197c('0x24')](function(_0x2321e1){_0x25d3c1[_0x197c('0x43')]=_0x2321e1;return _0x25d3c1;});}})[_0x197c('0x24')](respondWithFilteredResult(_0x436a53,_0x1947bd))[_0x197c('0x44')](handleError(_0x436a53,null));};exports[_0x197c('0x5c')]=function(_0x4cfcc6,_0x4b332f,_0x15d047){var _0x6c3afd={'raw':!![],'where':{}};var _0x49283d={};var _0x2519a1={'count':0x0,'rows':[]};return db[_0x197c('0x2c')][_0x197c('0x58')]({'where':{'id':_0x4cfcc6['params']['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x4b332f,null))[_0x197c('0x24')](function(_0x530d41){if(_0x530d41){_0x49283d[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x5d')][_0x197c('0x2d')]);_0x49283d[_0x197c('0x33')]=_['keys'](_0x4cfcc6['query']);_0x49283d['filters']=_[_0x197c('0x35')](_0x49283d['model'],_0x49283d['query']);_0x6c3afd[_0x197c('0x36')]=_[_0x197c('0x35')](_0x49283d[_0x197c('0x31')],qs[_0x197c('0x37')](_0x4cfcc6[_0x197c('0x33')]['fields']));_0x6c3afd['attributes']=_0x6c3afd[_0x197c('0x36')][_0x197c('0x38')]?_0x6c3afd['attributes']:_0x49283d[_0x197c('0x31')];if(!_0x4cfcc6[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x6c3afd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x4cfcc6['query'][_0x197c('0x1b')]);_0x6c3afd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x4cfcc6[_0x197c('0x33')][_0x197c('0x19')]);}_0x6c3afd['order']=qs['sort'](_0x4cfcc6[_0x197c('0x33')]['sort']);_0x6c3afd[_0x197c('0x3d')]=qs[_0x197c('0x34')](_[_0x197c('0x59')](_0x4cfcc6[_0x197c('0x33')],_0x49283d[_0x197c('0x34')]));_0x6c3afd['where'][_0x197c('0x5a')]=_0x530d41['id'];if(_0x4cfcc6[_0x197c('0x33')][_0x197c('0x3e')]){_0x6c3afd[_0x197c('0x3d')]=_['merge'](_0x6c3afd['where'],{'$or':_[_0x197c('0x32')](_0x6c3afd['attributes'],function(_0x5505e2){var _0x34b3d6={};_0x34b3d6[_0x5505e2]={'$like':'%'+_0x4cfcc6[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x34b3d6;})});}_0x6c3afd=_['merge']({},_0x6c3afd,_0x4cfcc6['options']);return db[_0x197c('0x5d')][_0x197c('0x1c')]({'where':_0x6c3afd['where']})[_0x197c('0x24')](function(_0x235fce){_0x2519a1['count']=_0x235fce;if(_0x4cfcc6[_0x197c('0x33')][_0x197c('0x41')]){_0x6c3afd['include']=[{'all':!![]}];}return db[_0x197c('0x5d')]['findAll'](_0x6c3afd);})[_0x197c('0x24')](function(_0x18c722){_0x2519a1[_0x197c('0x43')]=_0x18c722;return _0x2519a1;});}})[_0x197c('0x24')](respondWithFilteredResult(_0x4b332f,_0x6c3afd))[_0x197c('0x44')](handleError(_0x4b332f,null));};exports['getHopperFinals']=function(_0x2d1b23,_0x41b34c,_0x35269e){var _0x1a684e={'raw':!![],'where':{}};var _0x2bbe66={};var _0x33c765={'count':0x0,'rows':[]};return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x2d1b23[_0x197c('0x46')]['id']}})['then'](handleEntityNotFound(_0x41b34c,null))[_0x197c('0x24')](function(_0x3c3f7a){if(_0x3c3f7a){_0x2bbe66[_0x197c('0x31')]=_[_0x197c('0x47')](db['CmHopperFinal'][_0x197c('0x2d')]);_0x2bbe66[_0x197c('0x33')]=_[_0x197c('0x47')](_0x2d1b23['query']);_0x2bbe66[_0x197c('0x34')]=_[_0x197c('0x35')](_0x2bbe66[_0x197c('0x31')],_0x2bbe66[_0x197c('0x33')]);_0x1a684e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x2bbe66[_0x197c('0x31')],qs['fields'](_0x2d1b23[_0x197c('0x33')]['fields']));_0x1a684e[_0x197c('0x36')]=_0x1a684e[_0x197c('0x36')][_0x197c('0x38')]?_0x1a684e[_0x197c('0x36')]:_0x2bbe66[_0x197c('0x31')];if(!_0x2d1b23['query'][_0x197c('0x39')](_0x197c('0x3a'))){_0x1a684e[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x2d1b23[_0x197c('0x33')]['limit']);_0x1a684e['offset']=qs[_0x197c('0x19')](_0x2d1b23[_0x197c('0x33')][_0x197c('0x19')]);}_0x1a684e[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x2d1b23[_0x197c('0x33')][_0x197c('0x3c')]);_0x1a684e[_0x197c('0x3d')]=qs['filters'](_[_0x197c('0x59')](_0x2d1b23[_0x197c('0x33')],_0x2bbe66['filters']));_0x1a684e[_0x197c('0x3d')][_0x197c('0x5a')]=_0x3c3f7a['id'];if(_0x2d1b23['query'][_0x197c('0x3e')]){_0x1a684e[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x1a684e[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x1a684e['attributes'],function(_0x5563ff){var _0x31fe6a={};_0x31fe6a[_0x5563ff]={'$like':'%'+_0x2d1b23[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x31fe6a;})});}_0x1a684e=_[_0x197c('0x3f')]({},_0x1a684e,_0x2d1b23[_0x197c('0x40')]);return db[_0x197c('0x5e')][_0x197c('0x1c')]({'where':_0x1a684e[_0x197c('0x3d')]})['then'](function(_0xd324a0){_0x33c765[_0x197c('0x1c')]=_0xd324a0;if(_0x2d1b23[_0x197c('0x33')][_0x197c('0x41')]){_0x1a684e[_0x197c('0x48')]=[{'all':!![]}];}return db[_0x197c('0x5e')]['findAll'](_0x1a684e);})[_0x197c('0x24')](function(_0x16c3be){_0x33c765[_0x197c('0x43')]=_0x16c3be;return _0x33c765;});}})['then'](respondWithFilteredResult(_0x41b34c,_0x1a684e))[_0x197c('0x44')](handleError(_0x41b34c,null));};exports['getHopperBlacks']=function(_0x3207ed,_0x24a61d,_0x165b03){var _0x6174a5={'raw':!![],'where':{}};var _0x14040f={};var _0x2141b1={'count':0x0,'rows':[]};return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x3207ed[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x24a61d,null))[_0x197c('0x24')](function(_0x307edb){if(_0x307edb){_0x14040f['model']=_[_0x197c('0x47')](db['CmHopperBlack'][_0x197c('0x2d')]);_0x14040f[_0x197c('0x33')]=_[_0x197c('0x47')](_0x3207ed[_0x197c('0x33')]);_0x14040f['filters']=_[_0x197c('0x35')](_0x14040f[_0x197c('0x31')],_0x14040f[_0x197c('0x33')]);_0x6174a5[_0x197c('0x36')]=_[_0x197c('0x35')](_0x14040f['model'],qs[_0x197c('0x37')](_0x3207ed[_0x197c('0x33')][_0x197c('0x37')]));_0x6174a5[_0x197c('0x36')]=_0x6174a5[_0x197c('0x36')]['length']?_0x6174a5['attributes']:_0x14040f[_0x197c('0x31')];if(!_0x3207ed[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x6174a5[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x3207ed['query'][_0x197c('0x1b')]);_0x6174a5['offset']=qs['offset'](_0x3207ed[_0x197c('0x33')][_0x197c('0x19')]);}_0x6174a5[_0x197c('0x3b')]=qs['sort'](_0x3207ed[_0x197c('0x33')][_0x197c('0x3c')]);_0x6174a5[_0x197c('0x3d')]=qs[_0x197c('0x34')](_[_0x197c('0x59')](_0x3207ed[_0x197c('0x33')],_0x14040f['filters']));_0x6174a5[_0x197c('0x3d')]['CampaignId']=_0x307edb['id'];if(_0x3207ed[_0x197c('0x33')]['filter']){_0x6174a5[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x6174a5['where'],{'$or':_[_0x197c('0x32')](_0x6174a5[_0x197c('0x36')],function(_0x25ed2c){var _0x24d25a={};_0x24d25a[_0x25ed2c]={'$like':'%'+_0x3207ed[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x24d25a;})});}_0x6174a5=_[_0x197c('0x3f')]({},_0x6174a5,_0x3207ed[_0x197c('0x40')]);return db[_0x197c('0x5f')][_0x197c('0x1c')]({'where':_0x6174a5[_0x197c('0x3d')]})[_0x197c('0x24')](function(_0x4a27ac){_0x2141b1['count']=_0x4a27ac;if(_0x3207ed[_0x197c('0x33')][_0x197c('0x41')]){_0x6174a5[_0x197c('0x48')]=[{'all':!![]}];}return db[_0x197c('0x5f')][_0x197c('0x42')](_0x6174a5);})['then'](function(_0x31d653){_0x2141b1[_0x197c('0x43')]=_0x31d653;return _0x2141b1;});}})[_0x197c('0x24')](respondWithFilteredResult(_0x24a61d,_0x6174a5))[_0x197c('0x44')](handleError(_0x24a61d,null));};exports[_0x197c('0x60')]=function(_0x32370a,_0x18e177,_0x2ce52a){var _0x211abe={};var _0x1e3364={};var _0xc8ecb4;var _0x2b5d20;return db['Campaign']['findOne']({'where':{'id':_0x32370a[_0x197c('0x46')]['id']}})['then'](handleEntityNotFound(_0x18e177,null))[_0x197c('0x24')](function(_0x74def6){if(_0x74def6){_0xc8ecb4=_0x74def6;_0x1e3364[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x61')][_0x197c('0x2d')]);_0x1e3364[_0x197c('0x33')]=_['keys'](_0x32370a[_0x197c('0x33')]);_0x1e3364['filters']=_[_0x197c('0x35')](_0x1e3364[_0x197c('0x31')],_0x1e3364[_0x197c('0x33')]);_0x211abe[_0x197c('0x36')]=_[_0x197c('0x35')](_0x1e3364[_0x197c('0x31')],qs['fields'](_0x32370a[_0x197c('0x33')][_0x197c('0x37')]));_0x211abe[_0x197c('0x36')]=_0x211abe[_0x197c('0x36')][_0x197c('0x38')]?_0x211abe[_0x197c('0x36')]:_0x1e3364[_0x197c('0x31')];_0x211abe[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x32370a[_0x197c('0x33')]['sort']);_0x211abe[_0x197c('0x3d')]=qs[_0x197c('0x34')](_[_0x197c('0x59')](_0x32370a[_0x197c('0x33')],_0x1e3364[_0x197c('0x34')]));if(_0x32370a[_0x197c('0x33')][_0x197c('0x3e')]){_0x211abe[_0x197c('0x3d')]=_['merge'](_0x211abe[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x211abe[_0x197c('0x36')],function(_0x4f92e2){var _0x1eee91={};_0x1eee91[_0x4f92e2]={'$like':'%'+_0x32370a[_0x197c('0x33')]['filter']+'%'};return _0x1eee91;})});}_0x211abe=_[_0x197c('0x3f')]({},_0x211abe,_0x32370a[_0x197c('0x40')]);return _0xc8ecb4['getLists'](_0x211abe);}})[_0x197c('0x24')](function(_0x2dcb84){if(_0x2dcb84){_0x2b5d20=_0x2dcb84[_0x197c('0x38')];if(!_0x32370a[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x211abe[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x32370a['query']['limit']);_0x211abe[_0x197c('0x19')]=qs['offset'](_0x32370a[_0x197c('0x33')][_0x197c('0x19')]);}return _0xc8ecb4[_0x197c('0x60')](_0x211abe);}})['then'](function(_0x2fb26b){if(_0x2fb26b){return _0x2fb26b?{'count':_0x2b5d20,'rows':_0x2fb26b}:null;}})[_0x197c('0x24')](respondWithResult(_0x18e177,null))[_0x197c('0x44')](handleError(_0x18e177,null));};exports[_0x197c('0x62')]=function(_0x29e6ee,_0x57d9a4,_0x499624){var _0x29c93c,_0x27285d;var _0x478431=[];var _0x1db087=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x197c('0x55')]({'where':{'id':_0x29e6ee[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x57d9a4,null))[_0x197c('0x24')](function(_0x277247){if(_0x277247){_0x27285d=_0x277247;return _0x277247[_0x197c('0x62')](_0x29e6ee[_0x197c('0x4a')][_0x197c('0x63')],_[_0x197c('0x64')](_0x29e6ee['body'],[_0x197c('0x63'),'id'])||{});}return null;})[_0x197c('0x65')](function(_0x4675d3){var _0x1355e6;var _0x53cd6e;_0x29c93c=_0x4675d3||[];var _0x201ed7=[];if(_0x4675d3){for(var _0x283fa4=0x0;_0x283fa4<_0x4675d3[_0x197c('0x38')];_0x283fa4+=0x1){var _0x48ca1a=_0x4675d3[_0x283fa4][_0x197c('0x26')]({'plain':!![]});_0x27285d['dialCheckDuplicateType']=_0x29e6ee[_0x197c('0x4a')][_0x197c('0x66')]?_0x29e6ee[_0x197c('0x4a')][_0x197c('0x66')]:_0x27285d['dialCheckDuplicateType'];switch(_0x27285d['dialCheckDuplicateType']){case _0x197c('0x67'):_0x1355e6=squel['insert']()['into'](_0x197c('0x68'))[_0x197c('0x69')](['phone',_0x197c('0x6a'),_0x197c('0x6b'),_0x197c('0x6c'),_0x197c('0x5a'),_0x197c('0x53'),_0x197c('0x54')],squel['select']()[_0x197c('0x6d')](_0x197c('0x6e'),_0x197c('0x6e'))[_0x197c('0x6d')](_0x197c('0x6f'),'scheduledAt')[_0x197c('0x6d')]('id',_0x197c('0x6b'))[_0x197c('0x6d')](_0x48ca1a[_0x197c('0x70')][_0x197c('0x71')](),_0x197c('0x6c'))[_0x197c('0x6d')](_0x29e6ee[_0x197c('0x46')]['id'][_0x197c('0x71')](),_0x197c('0x5a'))[_0x197c('0x6d')]('\x27'+_0x1db087+'\x27',_0x197c('0x53'))[_0x197c('0x6d')]('\x27'+_0x1db087+'\x27',_0x197c('0x54'))[_0x197c('0x72')](_0x197c('0x73'))[_0x197c('0x3d')](_0x197c('0x74'))[_0x197c('0x3d')](_0x197c('0x75'),_0x48ca1a[_0x197c('0x70')]['toString']())[_0x197c('0x3d')](_0x197c('0x76'))['where'](_0x197c('0x77'),squel['select']()[_0x197c('0x6d')](_0x197c('0x78'))[_0x197c('0x72')](_0x197c('0x79'))[_0x197c('0x3d')](_0x197c('0x7a'),_0x29e6ee[_0x197c('0x46')]['id'][_0x197c('0x71')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x197c('0x7b')]()[_0x197c('0x6d')](_0x197c('0x7c'))[_0x197c('0x72')](_0x197c('0x68'))[_0x197c('0x3d')](_0x197c('0x7a'),_0x29e6ee[_0x197c('0x46')]['id'][_0x197c('0x71')]())))[_0x197c('0x71')]();break;case'onlyIfOpen':_0x1355e6=squel[_0x197c('0x7d')]()[_0x197c('0x7e')](_0x197c('0x68'))[_0x197c('0x69')]([_0x197c('0x6e'),_0x197c('0x6a'),'ContactId',_0x197c('0x6c'),_0x197c('0x5a'),_0x197c('0x53'),_0x197c('0x54')],squel[_0x197c('0x7b')]()[_0x197c('0x6d')]('phone',_0x197c('0x6e'))[_0x197c('0x6d')]('NOW()',_0x197c('0x6a'))[_0x197c('0x6d')]('id',_0x197c('0x6b'))[_0x197c('0x6d')](_0x48ca1a[_0x197c('0x70')][_0x197c('0x71')](),_0x197c('0x6c'))['field'](_0x29e6ee[_0x197c('0x46')]['id'][_0x197c('0x71')](),_0x197c('0x5a'))[_0x197c('0x6d')]('\x27'+_0x1db087+'\x27',_0x197c('0x53'))[_0x197c('0x6d')]('\x27'+_0x1db087+'\x27',_0x197c('0x54'))[_0x197c('0x72')]('cm_contacts')['where'](_0x197c('0x74'))['where'](_0x197c('0x75'),_0x48ca1a[_0x197c('0x70')][_0x197c('0x71')]())[_0x197c('0x3d')](_0x197c('0x76'))[_0x197c('0x3d')](_0x197c('0x77'),squel['select']()[_0x197c('0x6d')]('COALESCE(phone,\x27\x27)')['from'](_0x197c('0x68'))[_0x197c('0x3d')]('CampaignId\x20=\x20?',_0x29e6ee['params']['id'][_0x197c('0x71')]())))[_0x197c('0x71')]();break;default:_0x1355e6=squel['insert']()[_0x197c('0x7e')](_0x197c('0x68'))[_0x197c('0x69')]([_0x197c('0x6e'),'scheduledAt',_0x197c('0x6b'),'ListId','CampaignId',_0x197c('0x53'),_0x197c('0x54')],squel[_0x197c('0x7b')]()[_0x197c('0x6d')](_0x197c('0x6e'),'phone')[_0x197c('0x6d')]('NOW()','scheduledAt')[_0x197c('0x6d')]('id',_0x197c('0x6b'))[_0x197c('0x6d')](_0x48ca1a[_0x197c('0x70')][_0x197c('0x71')](),_0x197c('0x6c'))[_0x197c('0x6d')](_0x29e6ee['params']['id'][_0x197c('0x71')](),'CampaignId')[_0x197c('0x6d')]('\x27'+_0x1db087+'\x27',_0x197c('0x53'))[_0x197c('0x6d')]('\x27'+_0x1db087+'\x27','updatedAt')['from'](_0x197c('0x73'))[_0x197c('0x3d')](_0x197c('0x74'))[_0x197c('0x3d')](_0x197c('0x75'),_0x48ca1a['CmListId'][_0x197c('0x71')]())['where'](_0x197c('0x76')))[_0x197c('0x71')]();}_0x53cd6e=squel[_0x197c('0x7d')]()[_0x197c('0x7e')]('cm_hopper_additional_phones')[_0x197c('0x69')]([_0x197c('0x7f'),_0x197c('0x6a'),_0x197c('0x6e'),_0x197c('0x80'),_0x197c('0x53'),'updatedAt'],squel[_0x197c('0x7b')]()[_0x197c('0x6d')](_0x197c('0x81'),'id')[_0x197c('0x6d')](_0x197c('0x6f'),'scheduledAt')[_0x197c('0x6d')]('ci.item','phone')[_0x197c('0x6d')]('ci.OrderBY',_0x197c('0x80'))[_0x197c('0x6d')]('\x27'+_0x1db087+'\x27',_0x197c('0x53'))['field']('\x27'+_0x1db087+'\x27',_0x197c('0x54'))[_0x197c('0x72')](_0x197c('0x82'),'ci')[_0x197c('0x83')](_0x197c('0x68'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x197c('0x3d')](_0x197c('0x84'),_0x48ca1a[_0x197c('0x70')][_0x197c('0x71')]())['where'](_0x197c('0x85'),_0x29e6ee[_0x197c('0x46')]['id'][_0x197c('0x71')]())['where']('h.createdAt\x20=\x20?',_0x1db087))[_0x197c('0x71')]();_0x201ed7[_0x197c('0x86')](db[_0x197c('0x87')]['query'](_0x1355e6));_0x478431[_0x197c('0x86')](db['sequelize'][_0x197c('0x33')](_0x53cd6e));}return BPromise[_0x197c('0x88')](_0x201ed7);}})[_0x197c('0x24')](function(){return BPromise[_0x197c('0x88')](_0x478431);})[_0x197c('0x24')](function(){return _0x29c93c;})[_0x197c('0x24')](respondWithResult(_0x57d9a4,null))[_0x197c('0x44')](handleError(_0x57d9a4,null));};exports[_0x197c('0x89')]=function(_0x5e326f,_0x160a1,_0x62c16c){return db[_0x197c('0x2c')][_0x197c('0x55')]({'where':{'id':_0x5e326f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x160a1,null))[_0x197c('0x24')](function(_0x55476f){if(_0x55476f){return _0x55476f[_0x197c('0x89')](_0x5e326f[_0x197c('0x33')][_0x197c('0x63')]);}})[_0x197c('0x24')](function(_0x1daa31){if(_0x1daa31){return db[_0x197c('0x5b')]['destroy']({'where':{'ListId':_0x5e326f[_0x197c('0x33')][_0x197c('0x63')],'CampaignId':_0x5e326f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](function(){return _0x1daa31;});}})[_0x197c('0x24')](respondWithStatusCode(_0x160a1,null))[_0x197c('0x44')](handleError(_0x160a1,null));};exports[_0x197c('0x8a')]=function(_0x36ae6c,_0x3d4d3b,_0x522cbb){var _0x4b599e={};var _0x4bc033={};var _0x2bfbb0;var _0x44f647;return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x36ae6c['params']['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x3d4d3b,null))[_0x197c('0x24')](function(_0x1568c2){if(_0x1568c2){_0x2bfbb0=_0x1568c2;_0x4bc033[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x61')]['rawAttributes']);_0x4bc033[_0x197c('0x33')]=_['keys'](_0x36ae6c[_0x197c('0x33')]);_0x4bc033['filters']=_[_0x197c('0x35')](_0x4bc033[_0x197c('0x31')],_0x4bc033[_0x197c('0x33')]);_0x4b599e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x4bc033[_0x197c('0x31')],qs[_0x197c('0x37')](_0x36ae6c[_0x197c('0x33')][_0x197c('0x37')]));_0x4b599e['attributes']=_0x4b599e[_0x197c('0x36')][_0x197c('0x38')]?_0x4b599e[_0x197c('0x36')]:_0x4bc033[_0x197c('0x31')];_0x4b599e[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x36ae6c[_0x197c('0x33')][_0x197c('0x3c')]);_0x4b599e[_0x197c('0x3d')]=qs[_0x197c('0x34')](_[_0x197c('0x59')](_0x36ae6c[_0x197c('0x33')],_0x4bc033[_0x197c('0x34')]));if(_0x36ae6c[_0x197c('0x33')][_0x197c('0x3e')]){_0x4b599e[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x4b599e[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x4b599e['attributes'],function(_0x2d9880){var _0x12f785={};_0x12f785[_0x2d9880]={'$like':'%'+_0x36ae6c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x12f785;})});}_0x4b599e=_[_0x197c('0x3f')]({},_0x4b599e,_0x36ae6c[_0x197c('0x40')]);return _0x2bfbb0[_0x197c('0x8a')](_0x4b599e);}})[_0x197c('0x24')](function(_0x5b578b){if(_0x5b578b){_0x44f647=_0x5b578b['length'];if(!_0x36ae6c['query'][_0x197c('0x39')](_0x197c('0x3a'))){_0x4b599e['limit']=qs[_0x197c('0x1b')](_0x36ae6c[_0x197c('0x33')]['limit']);_0x4b599e[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x36ae6c['query'][_0x197c('0x19')]);}return _0x2bfbb0[_0x197c('0x8a')](_0x4b599e);}})['then'](function(_0x366bf0){if(_0x366bf0){return _0x366bf0?{'count':_0x44f647,'rows':_0x366bf0}:null;}})[_0x197c('0x24')](respondWithResult(_0x3d4d3b,null))[_0x197c('0x44')](handleError(_0x3d4d3b,null));};exports['addBlackLists']=function(_0x45bdad,_0x21071b,_0x8f048){var _0x10f469,_0x48e103;var _0xbfdf5a=[];var _0x4f2c75=moment()[_0x197c('0x8b')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x197c('0x2c')][_0x197c('0x55')]({'where':{'id':_0x45bdad['params']['id']}})['then'](handleEntityNotFound(_0x21071b,null))[_0x197c('0x24')](function(_0x1c608c){if(_0x1c608c){_0x48e103=_0x1c608c;return _0x1c608c[_0x197c('0x8c')](_0x45bdad[_0x197c('0x4a')][_0x197c('0x63')],_[_0x197c('0x64')](_0x45bdad[_0x197c('0x4a')],[_0x197c('0x63'),'id'])||{});}return null;})[_0x197c('0x65')](function(_0x43b746){var _0xd42353;var _0x4ccaff;_0x10f469=_0x43b746||[];var _0x109daf=[];if(_0x43b746){for(var _0x3658c9=0x0;_0x3658c9<_0x43b746[_0x197c('0x38')];_0x3658c9+=0x1){var _0x264af2=_0x43b746[_0x3658c9]['get']({'plain':!![]});_0xd42353=squel[_0x197c('0x7d')]()[_0x197c('0x7e')]('cm_hopper_black')[_0x197c('0x69')]([_0x197c('0x6e'),_0x197c('0x6b'),'ListId',_0x197c('0x5a'),_0x197c('0x53'),_0x197c('0x54')],squel[_0x197c('0x7b')]()[_0x197c('0x6d')]('phone',_0x197c('0x6e'))[_0x197c('0x6d')]('id',_0x197c('0x6b'))[_0x197c('0x6d')](_0x264af2[_0x197c('0x70')][_0x197c('0x71')](),_0x197c('0x6c'))[_0x197c('0x6d')](_0x45bdad[_0x197c('0x46')]['id'][_0x197c('0x71')](),'CampaignId')[_0x197c('0x6d')](_0x197c('0x6f'),_0x197c('0x53'))[_0x197c('0x6d')](_0x197c('0x6f'),'updatedAt')['from'](_0x197c('0x73'))['where'](_0x197c('0x74'))[_0x197c('0x3d')](_0x197c('0x75'),_0x264af2[_0x197c('0x70')][_0x197c('0x71')]())[_0x197c('0x3d')](_0x197c('0x76')))['toString']();_0x109daf[_0x197c('0x86')](db[_0x197c('0x87')]['query'](_0xd42353));}return BPromise[_0x197c('0x88')](_0x109daf);}})[_0x197c('0x24')](function(){return _0x10f469;})[_0x197c('0x24')](respondWithResult(_0x21071b,null))['catch'](handleError(_0x21071b,null));};exports[_0x197c('0x8d')]=function(_0x2eebbb,_0x43ca15,_0x22a786){return db[_0x197c('0x2c')][_0x197c('0x55')]({'where':{'id':_0x2eebbb[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x43ca15,null))['then'](function(_0x12fb25){if(_0x12fb25){return _0x12fb25[_0x197c('0x8d')](_0x2eebbb[_0x197c('0x33')][_0x197c('0x63')]);}})[_0x197c('0x24')](function(_0x498cd6){if(_0x498cd6){return db['CmHopperBlack'][_0x197c('0x25')]({'where':{'ListId':_0x2eebbb[_0x197c('0x33')]['ids'],'CampaignId':_0x2eebbb[_0x197c('0x46')]['id']}})['then'](function(){return _0x498cd6;});}})[_0x197c('0x24')](respondWithStatusCode(_0x43ca15,null))['catch'](handleError(_0x43ca15,null));}; \ No newline at end of file +var _0x336d=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','into','ListId','from','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','UserProfileResource','error','name','index','map','Campaign','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','role','IvrCampaigns','UserProfileSection','getHoppers','findOne','CmHopper','rows','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x15b916,_0x39ccf5){var _0x4f6426=function(_0x1ba9ca){while(--_0x1ba9ca){_0x15b916['push'](_0x15b916['shift']());}};_0x4f6426(++_0x39ccf5);}(_0x336d,0xae));var _0xd336=function(_0x5cda54,_0x9b37fc){_0x5cda54=_0x5cda54-0x0;var _0x33d718=_0x336d[_0x5cda54];return _0x33d718;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd336('0x0'));var zipdir=require(_0xd336('0x1'));var jsonpatch=require(_0xd336('0x2'));var rp=require(_0xd336('0x3'));var moment=require(_0xd336('0x4'));var BPromise=require(_0xd336('0x5'));var Mustache=require(_0xd336('0x6'));var util=require(_0xd336('0x7'));var path=require(_0xd336('0x8'));var sox=require(_0xd336('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd336('0xa'));var _=require(_0xd336('0xb'));var squel=require(_0xd336('0xc'));var crypto=require('crypto');var jsforce=require(_0xd336('0xd'));var deskjs=require(_0xd336('0xe'));var toCsv=require(_0xd336('0xf'));var querystring=require(_0xd336('0x10'));var Papa=require(_0xd336('0x11'));var Redis=require(_0xd336('0x12'));var authService=require(_0xd336('0x13'));var qs=require(_0xd336('0x14'));var as=require(_0xd336('0x15'));var hardwareService=require(_0xd336('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xd336('0x17'));var config=require(_0xd336('0x18'));var licenseUtil=require(_0xd336('0x19'));var db=require(_0xd336('0x1a'))['db'];function respondWithStatusCode(_0x29aa4a,_0x276abb){_0x276abb=_0x276abb||0xcc;return function(_0x327229){if(_0x327229){return _0x29aa4a[_0xd336('0x1b')](_0x276abb);}return _0x29aa4a[_0xd336('0x1c')](_0x276abb)[_0xd336('0x1d')]();};}function respondWithResult(_0x4d4fca,_0x3a8a98){_0x3a8a98=_0x3a8a98||0xc8;return function(_0x4fc32e){if(_0x4fc32e){return _0x4d4fca[_0xd336('0x1c')](_0x3a8a98)[_0xd336('0x1e')](_0x4fc32e);}};}function respondWithFilteredResult(_0x1b3cd8,_0x1c8fd7){return function(_0x1e4716){if(_0x1e4716){var _0x96cab8=typeof _0x1c8fd7[_0xd336('0x1f')]===_0xd336('0x20')&&typeof _0x1c8fd7[_0xd336('0x21')]===_0xd336('0x20');var _0x2171a2=_0x1e4716[_0xd336('0x22')];var _0x3dfc7b=_0x96cab8?0x0:_0x1c8fd7[_0xd336('0x1f')];var _0x1eabe0=_0x96cab8?_0x1e4716[_0xd336('0x22')]:_0x1c8fd7[_0xd336('0x1f')]+_0x1c8fd7['limit'];var _0x3fd3d1;if(_0x1eabe0>=_0x2171a2){_0x1eabe0=_0x2171a2;_0x3fd3d1=0xc8;}else{_0x3fd3d1=0xce;}_0x1b3cd8[_0xd336('0x1c')](_0x3fd3d1);return _0x1b3cd8[_0xd336('0x23')]('Content-Range',_0x3dfc7b+'-'+_0x1eabe0+'/'+_0x2171a2)[_0xd336('0x1e')](_0x1e4716);}return null;};}function patchUpdates(_0x2a5349){return function(_0x4d7351){try{jsonpatch[_0xd336('0x24')](_0x4d7351,_0x2a5349,!![]);}catch(_0x190123){return BPromise['reject'](_0x190123);}return _0x4d7351[_0xd336('0x25')]();};}function saveUpdates(_0x4d76b2,_0x2dad56){return function(_0x3bf076){if(_0x3bf076){return _0x3bf076[_0xd336('0x26')](_0x4d76b2)[_0xd336('0x27')](function(_0x38736e){return _0x38736e;});}return null;};}function removeEntity(_0x4d7fa6,_0x4d6f4d){return function(_0xc1f71f){if(_0xc1f71f){return _0xc1f71f[_0xd336('0x28')]()[_0xd336('0x27')](function(){var _0xfa45e8=_0xc1f71f[_0xd336('0x29')]({'plain':!![]});var _0x2f16dd='IvrCampaigns';return db[_0xd336('0x2a')][_0xd336('0x28')]({'where':{'type':_0x2f16dd,'resourceId':_0xfa45e8['id']}})['then'](function(){return _0xc1f71f;});})['then'](function(){_0x4d7fa6[_0xd336('0x1c')](0xcc)[_0xd336('0x1d')]();});}};}function handleEntityNotFound(_0x4240bc,_0x2e0678){return function(_0xa99518){if(!_0xa99518){_0x4240bc[_0xd336('0x1b')](0x194);}return _0xa99518;};}function handleError(_0x2c11d6,_0x21f288){_0x21f288=_0x21f288||0x1f4;return function(_0x289051){logger[_0xd336('0x2b')](_0x289051['stack']);if(_0x289051['name']){delete _0x289051[_0xd336('0x2c')];}_0x2c11d6[_0xd336('0x1c')](_0x21f288)['send'](_0x289051);};}exports[_0xd336('0x2d')]=function(_0x337a90,_0x489dee){var _0x45aaa8={},_0x3c2439={},_0x389ed6={'count':0x0,'rows':[]};var _0x21c898=_[_0xd336('0x2e')](db[_0xd336('0x2f')][_0xd336('0x30')],function(_0x4cab5e){return{'name':_0x4cab5e[_0xd336('0x31')],'type':_0x4cab5e['type'][_0xd336('0x32')]};});_0x3c2439[_0xd336('0x33')]=_[_0xd336('0x2e')](_0x21c898,_0xd336('0x2c'));_0x3c2439[_0xd336('0x34')]=_[_0xd336('0x35')](_0x337a90[_0xd336('0x34')]);_0x3c2439[_0xd336('0x36')]=_[_0xd336('0x37')](_0x3c2439['model'],_0x3c2439[_0xd336('0x34')]);_0x45aaa8[_0xd336('0x38')]=_[_0xd336('0x37')](_0x3c2439[_0xd336('0x33')],qs[_0xd336('0x39')](_0x337a90[_0xd336('0x34')]['fields']));_0x45aaa8[_0xd336('0x38')]=_0x45aaa8[_0xd336('0x38')]['length']?_0x45aaa8[_0xd336('0x38')]:_0x3c2439['model'];if(!_0x337a90[_0xd336('0x34')][_0xd336('0x3a')](_0xd336('0x3b'))){_0x45aaa8[_0xd336('0x21')]=qs[_0xd336('0x21')](_0x337a90[_0xd336('0x34')][_0xd336('0x21')]);_0x45aaa8[_0xd336('0x1f')]=qs[_0xd336('0x1f')](_0x337a90[_0xd336('0x34')][_0xd336('0x1f')]);}_0x45aaa8[_0xd336('0x3c')]=qs['sort'](_0x337a90[_0xd336('0x34')][_0xd336('0x3d')]);_0x45aaa8[_0xd336('0x3e')]=qs[_0xd336('0x36')](_[_0xd336('0x3f')](_0x337a90['query'],_0x3c2439[_0xd336('0x36')]),_0x21c898);if(_0x337a90[_0xd336('0x34')][_0xd336('0x40')]){_0x45aaa8[_0xd336('0x3e')]=_[_0xd336('0x41')](_0x45aaa8['where'],{'$or':_[_0xd336('0x2e')](_0x21c898,function(_0x3c126c){if(_0x3c126c[_0xd336('0x42')]!=='VIRTUAL'){var _0x877fe1={};_0x877fe1[_0x3c126c['name']]={'$like':'%'+_0x337a90['query']['filter']+'%'};return _0x877fe1;}})});}_0x45aaa8=_[_0xd336('0x41')]({},_0x45aaa8,_0x337a90['options']);var _0x418b28={'where':_0x45aaa8[_0xd336('0x3e')]};return db['Campaign'][_0xd336('0x22')](_0x418b28)[_0xd336('0x27')](function(_0x456c35){_0x389ed6[_0xd336('0x22')]=_0x456c35;if(_0x337a90[_0xd336('0x34')][_0xd336('0x43')]){_0x45aaa8[_0xd336('0x44')]=[{'all':!![]}];}return db[_0xd336('0x2f')][_0xd336('0x45')](_0x45aaa8);})[_0xd336('0x27')](function(_0x24c734){_0x389ed6['rows']=_0x24c734;return _0x389ed6;})['then'](respondWithFilteredResult(_0x489dee,_0x45aaa8))[_0xd336('0x46')](handleError(_0x489dee,null));};exports[_0xd336('0x47')]=function(_0x24d222,_0x5ec77b){var _0x112e84={'raw':![],'where':{'id':_0x24d222[_0xd336('0x48')]['id']}},_0x33fef7={};_0x33fef7['model']=_[_0xd336('0x35')](db[_0xd336('0x2f')][_0xd336('0x30')]);_0x33fef7['query']=_['keys'](_0x24d222['query']);_0x33fef7[_0xd336('0x36')]=_[_0xd336('0x37')](_0x33fef7['model'],_0x33fef7[_0xd336('0x34')]);_0x112e84[_0xd336('0x38')]=_[_0xd336('0x37')](_0x33fef7['model'],qs['fields'](_0x24d222[_0xd336('0x34')][_0xd336('0x39')]));_0x112e84[_0xd336('0x38')]=_0x112e84[_0xd336('0x38')][_0xd336('0x49')]?_0x112e84[_0xd336('0x38')]:_0x33fef7[_0xd336('0x33')];if(_0x24d222['query'][_0xd336('0x43')]){_0x112e84[_0xd336('0x44')]=[{'all':!![]}];}_0x112e84=_['merge']({},_0x112e84,_0x24d222[_0xd336('0x4a')]);return db[_0xd336('0x2f')][_0xd336('0x4b')](_0x112e84)[_0xd336('0x27')](handleEntityNotFound(_0x5ec77b,null))[_0xd336('0x27')](respondWithResult(_0x5ec77b,null))['catch'](handleError(_0x5ec77b,null));};exports[_0xd336('0x4c')]=function(_0x163c36,_0x34530e){return db['Campaign'][_0xd336('0x4c')](_0x163c36[_0xd336('0x4d')],{})['then'](function(_0x3a4ef9){var _0x2388b7=_0x163c36[_0xd336('0x4e')][_0xd336('0x29')]({'plain':!![]});if(!_0x2388b7)throw new Error(_0xd336('0x4f'));if(_0x2388b7['role']===_0xd336('0x4e')){var _0x3df648=_0x3a4ef9['get']({'plain':!![]});var _0x4040ca='IvrCampaigns';return db['UserProfileSection'][_0xd336('0x4b')]({'where':{'name':_0x4040ca,'userProfileId':_0x2388b7[_0xd336('0x50')]},'raw':!![]})[_0xd336('0x27')](function(_0x12f414){if(_0x12f414&&_0x12f414[_0xd336('0x51')]===0x0){return db['UserProfileResource'][_0xd336('0x4c')]({'name':_0x3df648[_0xd336('0x2c')],'resourceId':_0x3df648['id'],'type':_0x12f414[_0xd336('0x2c')],'sectionId':_0x12f414['id']},{})[_0xd336('0x27')](function(){return _0x3a4ef9;});}else{return _0x3a4ef9;}})[_0xd336('0x46')](function(_0x4bf412){logger[_0xd336('0x2b')](_0xd336('0x52'),_0x4bf412);throw _0x4bf412;});}return _0x3a4ef9;})['then'](respondWithResult(_0x34530e,0xc9))[_0xd336('0x46')](handleError(_0x34530e,null));};exports[_0xd336('0x53')]=function(_0x34761b,_0x2e72c0){var _0x865cc7={'where':{'id':_0x34761b[_0xd336('0x48')]['id']}},_0x179533={};_0x179533['model']=_[_0xd336('0x35')](db['Campaign'][_0xd336('0x30')]);_0x865cc7['attributes']=_[_0xd336('0x37')](_0x179533[_0xd336('0x33')],qs[_0xd336('0x39')](_0x34761b[_0xd336('0x34')][_0xd336('0x39')]));_0x865cc7['attributes']=_0x865cc7[_0xd336('0x38')]['length']?_0x865cc7[_0xd336('0x38')]:_0x179533[_0xd336('0x33')];if(_0x34761b['query'][_0xd336('0x43')]){_0x865cc7[_0xd336('0x44')]=[{'all':!![]}];}_0x865cc7=_[_0xd336('0x41')]({},_0x865cc7,_0x34761b[_0xd336('0x4a')]);return db['Campaign'][_0xd336('0x4b')](_0x865cc7)[_0xd336('0x27')](handleEntityNotFound(_0x2e72c0,null))['then'](function(_0x310cbd){if(_0x310cbd){var _0x1b436=_0x310cbd[_0xd336('0x29')]({'plain':!![]});_0x1b436=qs['omit'](_0x1b436,['id',_0xd336('0x54'),_0xd336('0x55')]);_0x34761b[_0xd336('0x4d')]=_[_0xd336('0x56')](_0x34761b[_0xd336('0x4d')],['id','createdAt',_0xd336('0x55')]);return db['Campaign'][_0xd336('0x4c')](_['merge'](_0x1b436,_0x34761b[_0xd336('0x4d')]),{'include':_0x34761b[_0xd336('0x34')][_0xd336('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0xde88fc){var _0x2e3bc5=_0x34761b[_0xd336('0x4e')][_0xd336('0x29')]({'plain':!![]});if(!_0x2e3bc5)throw new Error(_0xd336('0x4f'));if(_0x2e3bc5[_0xd336('0x57')]===_0xd336('0x4e')){var _0x3229c0=_0xde88fc['get']({'plain':!![]});var _0x1709cb=_0xd336('0x58');return db[_0xd336('0x59')][_0xd336('0x4b')]({'where':{'name':_0x1709cb,'userProfileId':_0x2e3bc5[_0xd336('0x50')]},'raw':!![]})[_0xd336('0x27')](function(_0x2693f3){if(_0x2693f3&&_0x2693f3['autoAssociation']===0x0){return db[_0xd336('0x2a')][_0xd336('0x4c')]({'name':_0x3229c0['name'],'resourceId':_0x3229c0['id'],'type':_0x2693f3[_0xd336('0x2c')],'sectionId':_0x2693f3['id']},{})[_0xd336('0x27')](function(){return _0xde88fc;});}else{return _0xde88fc;}})[_0xd336('0x46')](function(_0x50f288){logger[_0xd336('0x2b')](_0xd336('0x52'),_0x50f288);throw _0x50f288;});}return _0xde88fc;});}})[_0xd336('0x27')](respondWithResult(_0x2e72c0,0xc9))[_0xd336('0x46')](handleError(_0x2e72c0,null));};exports[_0xd336('0x26')]=function(_0x49d74e,_0x3e3911){if(_0x49d74e[_0xd336('0x4d')]['id']){delete _0x49d74e[_0xd336('0x4d')]['id'];}return db[_0xd336('0x2f')][_0xd336('0x4b')]({'where':{'id':_0x49d74e[_0xd336('0x48')]['id']}})[_0xd336('0x27')](handleEntityNotFound(_0x3e3911,null))[_0xd336('0x27')](saveUpdates(_0x49d74e[_0xd336('0x4d')],null))[_0xd336('0x27')](respondWithResult(_0x3e3911,null))['catch'](handleError(_0x3e3911,null));};exports[_0xd336('0x28')]=function(_0x54e68e,_0x29f840){return db[_0xd336('0x2f')][_0xd336('0x4b')]({'where':{'id':_0x54e68e['params']['id']}})[_0xd336('0x27')](handleEntityNotFound(_0x29f840,null))[_0xd336('0x27')](removeEntity(_0x29f840,null))[_0xd336('0x46')](handleError(_0x29f840,null));};exports[_0xd336('0x5a')]=function(_0x434a29,_0x1c5563,_0x1fe9e4){var _0x4222e2={'raw':!![],'where':{}};var _0x46713c={};var _0x5022ba={'count':0x0,'rows':[]};return db[_0xd336('0x2f')][_0xd336('0x5b')]({'where':{'id':_0x434a29[_0xd336('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c5563,null))[_0xd336('0x27')](function(_0x35f41d){if(_0x35f41d){_0x46713c[_0xd336('0x33')]=_[_0xd336('0x35')](db[_0xd336('0x5c')][_0xd336('0x30')]);_0x46713c[_0xd336('0x34')]=_[_0xd336('0x35')](_0x434a29[_0xd336('0x34')]);_0x46713c[_0xd336('0x36')]=_[_0xd336('0x37')](_0x46713c[_0xd336('0x33')],_0x46713c[_0xd336('0x34')]);_0x4222e2['attributes']=_[_0xd336('0x37')](_0x46713c[_0xd336('0x33')],qs[_0xd336('0x39')](_0x434a29[_0xd336('0x34')][_0xd336('0x39')]));_0x4222e2[_0xd336('0x38')]=_0x4222e2[_0xd336('0x38')][_0xd336('0x49')]?_0x4222e2[_0xd336('0x38')]:_0x46713c[_0xd336('0x33')];if(!_0x434a29['query']['hasOwnProperty'](_0xd336('0x3b'))){_0x4222e2[_0xd336('0x21')]=qs[_0xd336('0x21')](_0x434a29[_0xd336('0x34')]['limit']);_0x4222e2[_0xd336('0x1f')]=qs['offset'](_0x434a29[_0xd336('0x34')][_0xd336('0x1f')]);}_0x4222e2[_0xd336('0x3c')]=qs['sort'](_0x434a29[_0xd336('0x34')][_0xd336('0x3d')]);_0x4222e2[_0xd336('0x3e')]=qs[_0xd336('0x36')](_[_0xd336('0x3f')](_0x434a29[_0xd336('0x34')],_0x46713c[_0xd336('0x36')]));_0x4222e2[_0xd336('0x3e')]['CampaignId']=_0x35f41d['id'];if(_0x434a29[_0xd336('0x34')]['filter']){_0x4222e2['where']=_[_0xd336('0x41')](_0x4222e2[_0xd336('0x3e')],{'$or':_['map'](_0x4222e2[_0xd336('0x38')],function(_0x2ff83c){var _0x1f999a={};_0x1f999a[_0x2ff83c]={'$like':'%'+_0x434a29[_0xd336('0x34')][_0xd336('0x40')]+'%'};return _0x1f999a;})});}_0x4222e2=_['merge']({},_0x4222e2,_0x434a29['options']);return db[_0xd336('0x5c')][_0xd336('0x22')]({'where':_0x4222e2[_0xd336('0x3e')]})[_0xd336('0x27')](function(_0x2cb6eb){_0x5022ba[_0xd336('0x22')]=_0x2cb6eb;if(_0x434a29['query'][_0xd336('0x43')]){_0x4222e2[_0xd336('0x44')]=[{'all':!![]}];}return db[_0xd336('0x5c')][_0xd336('0x45')](_0x4222e2);})['then'](function(_0xc9c6b3){_0x5022ba[_0xd336('0x5d')]=_0xc9c6b3;return _0x5022ba;});}})[_0xd336('0x27')](respondWithFilteredResult(_0x1c5563,_0x4222e2))[_0xd336('0x46')](handleError(_0x1c5563,null));};exports[_0xd336('0x5e')]=function(_0xca6ec4,_0x239358,_0x6fc3ad){var _0x30908a={'raw':!![],'where':{}};var _0x43c0f7={};var _0x3e0663={'count':0x0,'rows':[]};return db[_0xd336('0x2f')][_0xd336('0x5b')]({'where':{'id':_0xca6ec4[_0xd336('0x48')]['id']}})[_0xd336('0x27')](handleEntityNotFound(_0x239358,null))[_0xd336('0x27')](function(_0x149acc){if(_0x149acc){_0x43c0f7[_0xd336('0x33')]=_[_0xd336('0x35')](db[_0xd336('0x5f')][_0xd336('0x30')]);_0x43c0f7[_0xd336('0x34')]=_[_0xd336('0x35')](_0xca6ec4[_0xd336('0x34')]);_0x43c0f7[_0xd336('0x36')]=_[_0xd336('0x37')](_0x43c0f7[_0xd336('0x33')],_0x43c0f7[_0xd336('0x34')]);_0x30908a[_0xd336('0x38')]=_['intersection'](_0x43c0f7[_0xd336('0x33')],qs[_0xd336('0x39')](_0xca6ec4[_0xd336('0x34')][_0xd336('0x39')]));_0x30908a['attributes']=_0x30908a[_0xd336('0x38')]['length']?_0x30908a['attributes']:_0x43c0f7['model'];if(!_0xca6ec4[_0xd336('0x34')][_0xd336('0x3a')](_0xd336('0x3b'))){_0x30908a[_0xd336('0x21')]=qs[_0xd336('0x21')](_0xca6ec4[_0xd336('0x34')]['limit']);_0x30908a[_0xd336('0x1f')]=qs[_0xd336('0x1f')](_0xca6ec4[_0xd336('0x34')]['offset']);}_0x30908a[_0xd336('0x3c')]=qs[_0xd336('0x3d')](_0xca6ec4[_0xd336('0x34')][_0xd336('0x3d')]);_0x30908a[_0xd336('0x3e')]=qs[_0xd336('0x36')](_['pick'](_0xca6ec4[_0xd336('0x34')],_0x43c0f7['filters']));_0x30908a[_0xd336('0x3e')][_0xd336('0x60')]=_0x149acc['id'];if(_0xca6ec4[_0xd336('0x34')][_0xd336('0x40')]){_0x30908a[_0xd336('0x3e')]=_[_0xd336('0x41')](_0x30908a[_0xd336('0x3e')],{'$or':_[_0xd336('0x2e')](_0x30908a[_0xd336('0x38')],function(_0x24b2fd){var _0x3ce687={};_0x3ce687[_0x24b2fd]={'$like':'%'+_0xca6ec4[_0xd336('0x34')][_0xd336('0x40')]+'%'};return _0x3ce687;})});}_0x30908a=_[_0xd336('0x41')]({},_0x30908a,_0xca6ec4[_0xd336('0x4a')]);return db['CmHopperHistory'][_0xd336('0x22')]({'where':_0x30908a['where']})[_0xd336('0x27')](function(_0x2ae4dc){_0x3e0663[_0xd336('0x22')]=_0x2ae4dc;if(_0xca6ec4[_0xd336('0x34')][_0xd336('0x43')]){_0x30908a['include']=[{'all':!![]}];}return db[_0xd336('0x5f')][_0xd336('0x45')](_0x30908a);})[_0xd336('0x27')](function(_0x1c761c){_0x3e0663[_0xd336('0x5d')]=_0x1c761c;return _0x3e0663;});}})[_0xd336('0x27')](respondWithFilteredResult(_0x239358,_0x30908a))['catch'](handleError(_0x239358,null));};exports[_0xd336('0x61')]=function(_0x35d124,_0x12bb68,_0x5290d1){var _0x13e5f0={'raw':!![],'where':{}};var _0x1d5699={};var _0x28e29={'count':0x0,'rows':[]};return db[_0xd336('0x2f')][_0xd336('0x5b')]({'where':{'id':_0x35d124[_0xd336('0x48')]['id']}})[_0xd336('0x27')](handleEntityNotFound(_0x12bb68,null))[_0xd336('0x27')](function(_0x5e038e){if(_0x5e038e){_0x1d5699[_0xd336('0x33')]=_[_0xd336('0x35')](db[_0xd336('0x62')][_0xd336('0x30')]);_0x1d5699['query']=_['keys'](_0x35d124['query']);_0x1d5699[_0xd336('0x36')]=_[_0xd336('0x37')](_0x1d5699[_0xd336('0x33')],_0x1d5699[_0xd336('0x34')]);_0x13e5f0['attributes']=_[_0xd336('0x37')](_0x1d5699[_0xd336('0x33')],qs['fields'](_0x35d124[_0xd336('0x34')][_0xd336('0x39')]));_0x13e5f0[_0xd336('0x38')]=_0x13e5f0[_0xd336('0x38')]['length']?_0x13e5f0[_0xd336('0x38')]:_0x1d5699[_0xd336('0x33')];if(!_0x35d124[_0xd336('0x34')][_0xd336('0x3a')]('nolimit')){_0x13e5f0['limit']=qs[_0xd336('0x21')](_0x35d124[_0xd336('0x34')][_0xd336('0x21')]);_0x13e5f0['offset']=qs[_0xd336('0x1f')](_0x35d124[_0xd336('0x34')][_0xd336('0x1f')]);}_0x13e5f0[_0xd336('0x3c')]=qs[_0xd336('0x3d')](_0x35d124[_0xd336('0x34')][_0xd336('0x3d')]);_0x13e5f0[_0xd336('0x3e')]=qs[_0xd336('0x36')](_[_0xd336('0x3f')](_0x35d124[_0xd336('0x34')],_0x1d5699[_0xd336('0x36')]));_0x13e5f0[_0xd336('0x3e')][_0xd336('0x60')]=_0x5e038e['id'];if(_0x35d124[_0xd336('0x34')]['filter']){_0x13e5f0[_0xd336('0x3e')]=_[_0xd336('0x41')](_0x13e5f0[_0xd336('0x3e')],{'$or':_[_0xd336('0x2e')](_0x13e5f0['attributes'],function(_0x5129b1){var _0x287a5f={};_0x287a5f[_0x5129b1]={'$like':'%'+_0x35d124[_0xd336('0x34')][_0xd336('0x40')]+'%'};return _0x287a5f;})});}_0x13e5f0=_['merge']({},_0x13e5f0,_0x35d124[_0xd336('0x4a')]);return db[_0xd336('0x62')]['count']({'where':_0x13e5f0[_0xd336('0x3e')]})['then'](function(_0x46bb99){_0x28e29['count']=_0x46bb99;if(_0x35d124[_0xd336('0x34')][_0xd336('0x43')]){_0x13e5f0['include']=[{'all':!![]}];}return db[_0xd336('0x62')][_0xd336('0x45')](_0x13e5f0);})[_0xd336('0x27')](function(_0xed5080){_0x28e29[_0xd336('0x5d')]=_0xed5080;return _0x28e29;});}})[_0xd336('0x27')](respondWithFilteredResult(_0x12bb68,_0x13e5f0))[_0xd336('0x46')](handleError(_0x12bb68,null));};exports[_0xd336('0x63')]=function(_0x5f50ef,_0x218026,_0x5540f0){var _0x593429={'raw':!![],'where':{}};var _0x513cfe={};var _0x56125b={'count':0x0,'rows':[]};return db[_0xd336('0x2f')]['findOne']({'where':{'id':_0x5f50ef['params']['id']}})['then'](handleEntityNotFound(_0x218026,null))[_0xd336('0x27')](function(_0x2042d6){if(_0x2042d6){_0x513cfe['model']=_['keys'](db[_0xd336('0x64')][_0xd336('0x30')]);_0x513cfe[_0xd336('0x34')]=_[_0xd336('0x35')](_0x5f50ef[_0xd336('0x34')]);_0x513cfe['filters']=_[_0xd336('0x37')](_0x513cfe['model'],_0x513cfe[_0xd336('0x34')]);_0x593429[_0xd336('0x38')]=_[_0xd336('0x37')](_0x513cfe[_0xd336('0x33')],qs[_0xd336('0x39')](_0x5f50ef[_0xd336('0x34')][_0xd336('0x39')]));_0x593429['attributes']=_0x593429[_0xd336('0x38')]['length']?_0x593429[_0xd336('0x38')]:_0x513cfe[_0xd336('0x33')];if(!_0x5f50ef[_0xd336('0x34')][_0xd336('0x3a')](_0xd336('0x3b'))){_0x593429['limit']=qs[_0xd336('0x21')](_0x5f50ef[_0xd336('0x34')][_0xd336('0x21')]);_0x593429['offset']=qs[_0xd336('0x1f')](_0x5f50ef[_0xd336('0x34')][_0xd336('0x1f')]);}_0x593429['order']=qs[_0xd336('0x3d')](_0x5f50ef[_0xd336('0x34')][_0xd336('0x3d')]);_0x593429['where']=qs[_0xd336('0x36')](_[_0xd336('0x3f')](_0x5f50ef[_0xd336('0x34')],_0x513cfe['filters']));_0x593429[_0xd336('0x3e')][_0xd336('0x60')]=_0x2042d6['id'];if(_0x5f50ef[_0xd336('0x34')][_0xd336('0x40')]){_0x593429['where']=_['merge'](_0x593429['where'],{'$or':_[_0xd336('0x2e')](_0x593429[_0xd336('0x38')],function(_0x299aa9){var _0x357708={};_0x357708[_0x299aa9]={'$like':'%'+_0x5f50ef[_0xd336('0x34')]['filter']+'%'};return _0x357708;})});}_0x593429=_[_0xd336('0x41')]({},_0x593429,_0x5f50ef['options']);return db[_0xd336('0x64')][_0xd336('0x22')]({'where':_0x593429[_0xd336('0x3e')]})[_0xd336('0x27')](function(_0x508025){_0x56125b[_0xd336('0x22')]=_0x508025;if(_0x5f50ef[_0xd336('0x34')][_0xd336('0x43')]){_0x593429['include']=[{'all':!![]}];}return db[_0xd336('0x64')][_0xd336('0x45')](_0x593429);})[_0xd336('0x27')](function(_0x7f7454){_0x56125b[_0xd336('0x5d')]=_0x7f7454;return _0x56125b;});}})['then'](respondWithFilteredResult(_0x218026,_0x593429))[_0xd336('0x46')](handleError(_0x218026,null));};exports[_0xd336('0x65')]=function(_0x4a6e87,_0x55bba7,_0x20e939){var _0x3ead6e={};var _0x27ccf5={};var _0x31da91;var _0x50e3b1;return db[_0xd336('0x2f')]['findOne']({'where':{'id':_0x4a6e87[_0xd336('0x48')]['id']}})['then'](handleEntityNotFound(_0x55bba7,null))[_0xd336('0x27')](function(_0x21b247){if(_0x21b247){_0x31da91=_0x21b247;_0x27ccf5[_0xd336('0x33')]=_['keys'](db[_0xd336('0x66')][_0xd336('0x30')]);_0x27ccf5[_0xd336('0x34')]=_['keys'](_0x4a6e87[_0xd336('0x34')]);_0x27ccf5[_0xd336('0x36')]=_['intersection'](_0x27ccf5[_0xd336('0x33')],_0x27ccf5[_0xd336('0x34')]);_0x3ead6e[_0xd336('0x38')]=_[_0xd336('0x37')](_0x27ccf5[_0xd336('0x33')],qs['fields'](_0x4a6e87[_0xd336('0x34')][_0xd336('0x39')]));_0x3ead6e[_0xd336('0x38')]=_0x3ead6e[_0xd336('0x38')][_0xd336('0x49')]?_0x3ead6e[_0xd336('0x38')]:_0x27ccf5['model'];_0x3ead6e['order']=qs['sort'](_0x4a6e87[_0xd336('0x34')][_0xd336('0x3d')]);_0x3ead6e['where']=qs[_0xd336('0x36')](_['pick'](_0x4a6e87[_0xd336('0x34')],_0x27ccf5[_0xd336('0x36')]));if(_0x4a6e87['query']['filter']){_0x3ead6e[_0xd336('0x3e')]=_[_0xd336('0x41')](_0x3ead6e[_0xd336('0x3e')],{'$or':_[_0xd336('0x2e')](_0x3ead6e[_0xd336('0x38')],function(_0x177761){var _0x28ccee={};_0x28ccee[_0x177761]={'$like':'%'+_0x4a6e87['query'][_0xd336('0x40')]+'%'};return _0x28ccee;})});}_0x3ead6e=_[_0xd336('0x41')]({},_0x3ead6e,_0x4a6e87[_0xd336('0x4a')]);return _0x31da91['getLists'](_0x3ead6e);}})[_0xd336('0x27')](function(_0x41d4ab){if(_0x41d4ab){_0x50e3b1=_0x41d4ab[_0xd336('0x49')];if(!_0x4a6e87[_0xd336('0x34')][_0xd336('0x3a')](_0xd336('0x3b'))){_0x3ead6e[_0xd336('0x21')]=qs['limit'](_0x4a6e87['query'][_0xd336('0x21')]);_0x3ead6e['offset']=qs[_0xd336('0x1f')](_0x4a6e87['query'][_0xd336('0x1f')]);}return _0x31da91[_0xd336('0x65')](_0x3ead6e);}})[_0xd336('0x27')](function(_0x21dd89){if(_0x21dd89){return _0x21dd89?{'count':_0x50e3b1,'rows':_0x21dd89}:null;}})[_0xd336('0x27')](respondWithResult(_0x55bba7,null))['catch'](handleError(_0x55bba7,null));};exports[_0xd336('0x67')]=function(_0xdfda16,_0x4a500e,_0x99bd7f){var _0x4e202d,_0x51540b;var _0x57a266=[];var _0x5a2b37=moment()[_0xd336('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xd336('0x2f')]['find']({'where':{'id':_0xdfda16[_0xd336('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a500e,null))[_0xd336('0x27')](function(_0xbf861c){if(_0xbf861c){_0x51540b=_0xbf861c;return _0xbf861c[_0xd336('0x67')](_0xdfda16[_0xd336('0x4d')][_0xd336('0x69')],_[_0xd336('0x56')](_0xdfda16['body'],[_0xd336('0x69'),'id'])||{});}return null;})[_0xd336('0x6a')](function(_0x28e0f0){var _0x2ad7ae;var _0x1ee500;_0x4e202d=_0x28e0f0||[];var _0x507b91=[];if(_0x28e0f0){for(var _0x4a89e8=0x0;_0x4a89e8<_0x28e0f0[_0xd336('0x49')];_0x4a89e8+=0x1){var _0x5afac5=_0x28e0f0[_0x4a89e8][_0xd336('0x29')]({'plain':!![]});_0x51540b[_0xd336('0x6b')]=_0xdfda16[_0xd336('0x4d')][_0xd336('0x6b')]?_0xdfda16['body'][_0xd336('0x6b')]:_0x51540b[_0xd336('0x6b')];switch(_0x51540b['dialCheckDuplicateType']){case _0xd336('0x6c'):_0x2ad7ae=squel[_0xd336('0x6d')]()['into'](_0xd336('0x6e'))[_0xd336('0x6f')]([_0xd336('0x70'),_0xd336('0x71'),_0xd336('0x72'),'ListId',_0xd336('0x60'),'createdAt',_0xd336('0x55')],squel[_0xd336('0x73')]()[_0xd336('0x74')](_0xd336('0x70'),_0xd336('0x70'))[_0xd336('0x74')](_0xd336('0x75'),_0xd336('0x71'))[_0xd336('0x74')]('id','ContactId')[_0xd336('0x74')](_0x5afac5[_0xd336('0x76')]['toString'](),'ListId')[_0xd336('0x74')](_0xdfda16['params']['id'][_0xd336('0x77')](),_0xd336('0x60'))['field']('\x27'+_0x5a2b37+'\x27','createdAt')[_0xd336('0x74')]('\x27'+_0x5a2b37+'\x27',_0xd336('0x55'))['from'](_0xd336('0x78'))[_0xd336('0x3e')](_0xd336('0x79'))['where'](_0xd336('0x7a'),_0x5afac5[_0xd336('0x76')][_0xd336('0x77')]())[_0xd336('0x3e')](_0xd336('0x7b'))[_0xd336('0x3e')](_0xd336('0x7c'),squel[_0xd336('0x73')]()[_0xd336('0x74')]('COALESCE(calleridnum,\x27\x27)')['from'](_0xd336('0x7d'))[_0xd336('0x3e')](_0xd336('0x7e'),_0xdfda16[_0xd336('0x48')]['id'][_0xd336('0x77')]()))[_0xd336('0x3e')](_0xd336('0x7c'),squel[_0xd336('0x73')]()[_0xd336('0x74')](_0xd336('0x7f'))['from'](_0xd336('0x6e'))[_0xd336('0x3e')](_0xd336('0x7e'),_0xdfda16[_0xd336('0x48')]['id'][_0xd336('0x77')]())))[_0xd336('0x77')]();break;case'onlyIfOpen':_0x2ad7ae=squel[_0xd336('0x6d')]()[_0xd336('0x80')](_0xd336('0x6e'))[_0xd336('0x6f')](['phone',_0xd336('0x71'),_0xd336('0x72'),_0xd336('0x81'),_0xd336('0x60'),'createdAt',_0xd336('0x55')],squel[_0xd336('0x73')]()[_0xd336('0x74')](_0xd336('0x70'),_0xd336('0x70'))[_0xd336('0x74')](_0xd336('0x75'),_0xd336('0x71'))[_0xd336('0x74')]('id',_0xd336('0x72'))[_0xd336('0x74')](_0x5afac5['CmListId'][_0xd336('0x77')](),_0xd336('0x81'))[_0xd336('0x74')](_0xdfda16[_0xd336('0x48')]['id'][_0xd336('0x77')](),_0xd336('0x60'))['field']('\x27'+_0x5a2b37+'\x27','createdAt')['field']('\x27'+_0x5a2b37+'\x27',_0xd336('0x55'))['from'](_0xd336('0x78'))[_0xd336('0x3e')]('deletedAt\x20IS\x20NULL')[_0xd336('0x3e')](_0xd336('0x7a'),_0x5afac5[_0xd336('0x76')][_0xd336('0x77')]())[_0xd336('0x3e')](_0xd336('0x7b'))[_0xd336('0x3e')](_0xd336('0x7c'),squel[_0xd336('0x73')]()[_0xd336('0x74')](_0xd336('0x7f'))['from'](_0xd336('0x6e'))[_0xd336('0x3e')]('CampaignId\x20=\x20?',_0xdfda16[_0xd336('0x48')]['id'][_0xd336('0x77')]())))['toString']();break;default:_0x2ad7ae=squel[_0xd336('0x6d')]()['into'](_0xd336('0x6e'))[_0xd336('0x6f')]([_0xd336('0x70'),_0xd336('0x71'),_0xd336('0x72'),'ListId','CampaignId',_0xd336('0x54'),_0xd336('0x55')],squel['select']()['field']('phone',_0xd336('0x70'))[_0xd336('0x74')]('NOW()','scheduledAt')['field']('id',_0xd336('0x72'))[_0xd336('0x74')](_0x5afac5[_0xd336('0x76')]['toString'](),_0xd336('0x81'))[_0xd336('0x74')](_0xdfda16[_0xd336('0x48')]['id'][_0xd336('0x77')](),_0xd336('0x60'))['field']('\x27'+_0x5a2b37+'\x27',_0xd336('0x54'))[_0xd336('0x74')]('\x27'+_0x5a2b37+'\x27',_0xd336('0x55'))[_0xd336('0x82')](_0xd336('0x78'))[_0xd336('0x3e')](_0xd336('0x79'))[_0xd336('0x3e')](_0xd336('0x7a'),_0x5afac5[_0xd336('0x76')][_0xd336('0x77')]())[_0xd336('0x3e')](_0xd336('0x7b')))[_0xd336('0x77')]();}_0x1ee500=squel[_0xd336('0x6d')]()[_0xd336('0x80')]('cm_hopper_additional_phones')[_0xd336('0x6f')](['cmHopperId',_0xd336('0x71'),_0xd336('0x70'),_0xd336('0x83'),_0xd336('0x54'),_0xd336('0x55')],squel[_0xd336('0x73')]()[_0xd336('0x74')](_0xd336('0x84'),'id')[_0xd336('0x74')](_0xd336('0x75'),_0xd336('0x71'))['field'](_0xd336('0x85'),_0xd336('0x70'))[_0xd336('0x74')]('ci.OrderBY','OrderBy')['field']('\x27'+_0x5a2b37+'\x27',_0xd336('0x54'))['field']('\x27'+_0x5a2b37+'\x27',_0xd336('0x55'))[_0xd336('0x82')](_0xd336('0x86'),'ci')['join'](_0xd336('0x6e'),'h',_0xd336('0x87'))[_0xd336('0x3e')](_0xd336('0x88'),_0x5afac5['CmListId'][_0xd336('0x77')]())[_0xd336('0x3e')](_0xd336('0x89'),_0xdfda16['params']['id'][_0xd336('0x77')]())['where'](_0xd336('0x8a'),_0x5a2b37))['toString']();_0x507b91['push'](db[_0xd336('0x8b')][_0xd336('0x34')](_0x2ad7ae));_0x57a266[_0xd336('0x8c')](db[_0xd336('0x8b')]['query'](_0x1ee500));}return BPromise[_0xd336('0x8d')](_0x507b91);}})[_0xd336('0x27')](function(){return BPromise['all'](_0x57a266);})[_0xd336('0x27')](function(){return _0x4e202d;})[_0xd336('0x27')](respondWithResult(_0x4a500e,null))['catch'](handleError(_0x4a500e,null));};exports[_0xd336('0x8e')]=function(_0x20eed7,_0x327d45,_0x63ab7d){return db[_0xd336('0x2f')][_0xd336('0x4b')]({'where':{'id':_0x20eed7['params']['id']}})['then'](handleEntityNotFound(_0x327d45,null))[_0xd336('0x27')](function(_0x1ff1c9){if(_0x1ff1c9){return _0x1ff1c9[_0xd336('0x8e')](_0x20eed7[_0xd336('0x34')]['ids']);}})[_0xd336('0x27')](function(_0x2c84a3){if(_0x2c84a3){return db[_0xd336('0x5c')][_0xd336('0x28')]({'where':{'ListId':_0x20eed7['query'][_0xd336('0x69')],'CampaignId':_0x20eed7[_0xd336('0x48')]['id']}})[_0xd336('0x27')](function(){return _0x2c84a3;});}})[_0xd336('0x27')](respondWithStatusCode(_0x327d45,null))[_0xd336('0x46')](handleError(_0x327d45,null));};exports[_0xd336('0x8f')]=function(_0x490b6e,_0x205e59,_0x43ee1c){var _0x1be820={};var _0x29b59d={};var _0x57c9d3;var _0x49c9ad;return db[_0xd336('0x2f')][_0xd336('0x5b')]({'where':{'id':_0x490b6e['params']['id']}})[_0xd336('0x27')](handleEntityNotFound(_0x205e59,null))['then'](function(_0x4e0b2c){if(_0x4e0b2c){_0x57c9d3=_0x4e0b2c;_0x29b59d[_0xd336('0x33')]=_[_0xd336('0x35')](db[_0xd336('0x66')][_0xd336('0x30')]);_0x29b59d[_0xd336('0x34')]=_['keys'](_0x490b6e[_0xd336('0x34')]);_0x29b59d[_0xd336('0x36')]=_[_0xd336('0x37')](_0x29b59d[_0xd336('0x33')],_0x29b59d['query']);_0x1be820[_0xd336('0x38')]=_[_0xd336('0x37')](_0x29b59d[_0xd336('0x33')],qs[_0xd336('0x39')](_0x490b6e[_0xd336('0x34')]['fields']));_0x1be820[_0xd336('0x38')]=_0x1be820[_0xd336('0x38')][_0xd336('0x49')]?_0x1be820[_0xd336('0x38')]:_0x29b59d[_0xd336('0x33')];_0x1be820['order']=qs[_0xd336('0x3d')](_0x490b6e[_0xd336('0x34')][_0xd336('0x3d')]);_0x1be820['where']=qs[_0xd336('0x36')](_[_0xd336('0x3f')](_0x490b6e['query'],_0x29b59d[_0xd336('0x36')]));if(_0x490b6e[_0xd336('0x34')][_0xd336('0x40')]){_0x1be820[_0xd336('0x3e')]=_['merge'](_0x1be820['where'],{'$or':_[_0xd336('0x2e')](_0x1be820['attributes'],function(_0x483d41){var _0xbec22d={};_0xbec22d[_0x483d41]={'$like':'%'+_0x490b6e[_0xd336('0x34')]['filter']+'%'};return _0xbec22d;})});}_0x1be820=_[_0xd336('0x41')]({},_0x1be820,_0x490b6e['options']);return _0x57c9d3['getBlackLists'](_0x1be820);}})[_0xd336('0x27')](function(_0x15d57c){if(_0x15d57c){_0x49c9ad=_0x15d57c[_0xd336('0x49')];if(!_0x490b6e[_0xd336('0x34')][_0xd336('0x3a')](_0xd336('0x3b'))){_0x1be820[_0xd336('0x21')]=qs[_0xd336('0x21')](_0x490b6e[_0xd336('0x34')][_0xd336('0x21')]);_0x1be820['offset']=qs['offset'](_0x490b6e['query']['offset']);}return _0x57c9d3[_0xd336('0x8f')](_0x1be820);}})[_0xd336('0x27')](function(_0x556f57){if(_0x556f57){return _0x556f57?{'count':_0x49c9ad,'rows':_0x556f57}:null;}})[_0xd336('0x27')](respondWithResult(_0x205e59,null))['catch'](handleError(_0x205e59,null));};exports[_0xd336('0x90')]=function(_0xf65e60,_0x16cfe6,_0x44e2fa){var _0x35b35d,_0x4c2437;var _0x32d6ab=[];var _0x21ed7b=moment()['format'](_0xd336('0x91'));return db[_0xd336('0x2f')][_0xd336('0x4b')]({'where':{'id':_0xf65e60['params']['id']}})[_0xd336('0x27')](handleEntityNotFound(_0x16cfe6,null))[_0xd336('0x27')](function(_0x5381b2){if(_0x5381b2){_0x4c2437=_0x5381b2;return _0x5381b2['addBlackLists'](_0xf65e60[_0xd336('0x4d')][_0xd336('0x69')],_[_0xd336('0x56')](_0xf65e60[_0xd336('0x4d')],['ids','id'])||{});}return null;})[_0xd336('0x6a')](function(_0x2e38bb){var _0xc17866;var _0x1def26;_0x35b35d=_0x2e38bb||[];var _0x10de6e=[];if(_0x2e38bb){for(var _0x599649=0x0;_0x599649<_0x2e38bb[_0xd336('0x49')];_0x599649+=0x1){var _0x5d2769=_0x2e38bb[_0x599649][_0xd336('0x29')]({'plain':!![]});_0xc17866=squel[_0xd336('0x6d')]()[_0xd336('0x80')](_0xd336('0x92'))[_0xd336('0x6f')]([_0xd336('0x70'),_0xd336('0x72'),_0xd336('0x81'),'CampaignId',_0xd336('0x54'),_0xd336('0x55')],squel['select']()['field'](_0xd336('0x70'),'phone')[_0xd336('0x74')]('id',_0xd336('0x72'))[_0xd336('0x74')](_0x5d2769[_0xd336('0x76')]['toString'](),_0xd336('0x81'))[_0xd336('0x74')](_0xf65e60[_0xd336('0x48')]['id']['toString'](),_0xd336('0x60'))[_0xd336('0x74')]('NOW()',_0xd336('0x54'))['field'](_0xd336('0x75'),_0xd336('0x55'))['from']('cm_contacts')['where'](_0xd336('0x79'))['where']('ListId\x20=\x20?',_0x5d2769['CmListId'][_0xd336('0x77')]())[_0xd336('0x3e')](_0xd336('0x7b')))[_0xd336('0x77')]();_0x10de6e[_0xd336('0x8c')](db['sequelize'][_0xd336('0x34')](_0xc17866));}return BPromise[_0xd336('0x8d')](_0x10de6e);}})[_0xd336('0x27')](function(){return _0x35b35d;})[_0xd336('0x27')](respondWithResult(_0x16cfe6,null))[_0xd336('0x46')](handleError(_0x16cfe6,null));};exports[_0xd336('0x93')]=function(_0x175d57,_0x2664b8,_0x38ea0b){return db[_0xd336('0x2f')][_0xd336('0x4b')]({'where':{'id':_0x175d57['params']['id']}})[_0xd336('0x27')](handleEntityNotFound(_0x2664b8,null))['then'](function(_0x1c8b86){if(_0x1c8b86){return _0x1c8b86[_0xd336('0x93')](_0x175d57['query'][_0xd336('0x69')]);}})[_0xd336('0x27')](function(_0x8b9ae6){if(_0x8b9ae6){return db[_0xd336('0x64')]['destroy']({'where':{'ListId':_0x175d57[_0xd336('0x34')][_0xd336('0x69')],'CampaignId':_0x175d57[_0xd336('0x48')]['id']}})[_0xd336('0x27')](function(){return _0x8b9ae6;});}})[_0xd336('0x27')](respondWithStatusCode(_0x2664b8,null))[_0xd336('0x46')](handleError(_0x2664b8,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index adc08af..9a6774d 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index dc7268c..77a407f 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 _0xde64=['randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','map','include','model','attributes','debug','lodash','util','moment','bluebird'];(function(_0x4330fb,_0x25240c){var _0xbd081a=function(_0x42bf28){while(--_0x42bf28){_0x4330fb['push'](_0x4330fb['shift']());}};_0xbd081a(++_0x25240c);}(_0xde64,0x17c));var _0x4de6=function(_0x2499c0,_0xd1f953){_0x2499c0=_0x2499c0-0x0;var _0x291404=_0xde64[_0x2499c0];return _0x291404;};'use strict';var _=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var moment=require(_0x4de6('0x2'));var BPromise=require(_0x4de6('0x3'));var rs=require(_0x4de6('0x4'));var fs=require('fs');var Redis=require(_0x4de6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4de6('0x6'));var logger=require(_0x4de6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4de6('0x8'));var client=jayson[_0x4de6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568496,_0x24edef,_0x35ae72){return new BPromise(function(_0x475fb9,_0x248e39){return client[_0x4de6('0xa')](_0x568496,_0x35ae72)[_0x4de6('0xb')](function(_0x48a974){logger[_0x4de6('0xc')](_0x4de6('0xd'),_0x24edef,_0x4de6('0xe'));logger['debug'](_0x4de6('0xf'),_0x24edef,_0x4de6('0xe'),JSON[_0x4de6('0x10')](_0x48a974));if(_0x48a974[_0x4de6('0x11')]){if(_0x48a974[_0x4de6('0x11')]['code']===0x1f4){logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x48a974[_0x4de6('0x11')]['message']);return _0x248e39(_0x48a974[_0x4de6('0x11')][_0x4de6('0x12')]);}logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x48a974['error'][_0x4de6('0x12')]);return _0x475fb9(_0x48a974[_0x4de6('0x11')][_0x4de6('0x12')]);}else{logger['info'](_0x4de6('0xd'),_0x24edef,'request\x20sent');_0x475fb9(_0x48a974['result'][_0x4de6('0x12')]);}})[_0x4de6('0x13')](function(_0x6dbcf3){logger[_0x4de6('0x11')](_0x4de6('0xd'),_0x24edef,_0x6dbcf3);_0x248e39(_0x6dbcf3);});});}exports[_0x4de6('0x14')]=function(_0x324202){var _0x5aacb4=this;return new Promise(function(_0x420f7c,_0xea1610){return db[_0x4de6('0x15')][_0x4de6('0x16')]({'raw':_0x324202[_0x4de6('0x17')]?_0x324202[_0x4de6('0x17')][_0x4de6('0x18')]===undefined?!![]:![]:!![],'where':_0x324202[_0x4de6('0x17')]?_0x324202[_0x4de6('0x17')][_0x4de6('0x19')]||null:null,'attributes':_0x324202['options']?_0x324202[_0x4de6('0x17')]['attributes']||null:null,'limit':_0x324202[_0x4de6('0x17')]?_0x324202[_0x4de6('0x17')][_0x4de6('0x1a')]||null:null,'include':_0x324202['options']?_0x324202[_0x4de6('0x17')]['include']?_[_0x4de6('0x1b')](_0x324202[_0x4de6('0x17')][_0x4de6('0x1c')],function(_0x5ddbab){return{'model':db[_0x5ddbab[_0x4de6('0x1d')]],'as':_0x5ddbab['as'],'attributes':_0x5ddbab[_0x4de6('0x1e')],'include':_0x5ddbab[_0x4de6('0x1c')]?_[_0x4de6('0x1b')](_0x5ddbab[_0x4de6('0x1c')],function(_0x25a76b){return{'model':db[_0x25a76b[_0x4de6('0x1d')]],'as':_0x25a76b['as'],'attributes':_0x25a76b['attributes'],'include':_0x25a76b[_0x4de6('0x1c')]?_[_0x4de6('0x1b')](_0x25a76b[_0x4de6('0x1c')],function(_0x327215){return{'model':db[_0x327215[_0x4de6('0x1d')]],'as':_0x327215['as'],'attributes':_0x327215[_0x4de6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4de6('0xb')](function(_0x7bc61e){logger[_0x4de6('0xc')]('GetCampaign',_0x324202);logger[_0x4de6('0x1f')](_0x4de6('0x14'),_0x324202,JSON[_0x4de6('0x10')](_0x7bc61e));_0x420f7c(_0x7bc61e);})[_0x4de6('0x13')](function(_0x24a0a7){logger['error'](_0x4de6('0x14'),_0x24a0a7['message'],_0x324202);_0xea1610(_0x5aacb4[_0x4de6('0x11')](0x1f4,_0x24a0a7[_0x4de6('0x12')]));});});}; \ No newline at end of file +var _0x1789=['debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','Campaign','options','where','attributes','limit','include','model','map','then','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x5ed1c5,_0x266bf1){var _0x2ea2fc=function(_0x3e7976){while(--_0x3e7976){_0x5ed1c5['push'](_0x5ed1c5['shift']());}};_0x2ea2fc(++_0x266bf1);}(_0x1789,0x92));var _0x9178=function(_0x334ad2,_0xcd1829){_0x334ad2=_0x334ad2-0x0;var _0x1560eb=_0x1789[_0x334ad2];return _0x1560eb;};'use strict';var _=require(_0x9178('0x0'));var util=require(_0x9178('0x1'));var moment=require(_0x9178('0x2'));var BPromise=require('bluebird');var rs=require(_0x9178('0x3'));var fs=require('fs');var Redis=require(_0x9178('0x4'));var db=require(_0x9178('0x5'))['db'];var utils=require(_0x9178('0x6'));var logger=require(_0x9178('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9178('0x8'));var client=jayson[_0x9178('0x9')][_0x9178('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f00a8,_0x502d21,_0x1001b0){return new BPromise(function(_0x333b8b,_0x3bcc1b){return client[_0x9178('0xb')](_0x1f00a8,_0x1001b0)['then'](function(_0x4bd20e){logger['info'](_0x9178('0xc'),_0x502d21,_0x9178('0xd'));logger[_0x9178('0xe')](_0x9178('0xf'),_0x502d21,'request\x20sent',JSON[_0x9178('0x10')](_0x4bd20e));if(_0x4bd20e[_0x9178('0x11')]){if(_0x4bd20e['error']['code']===0x1f4){logger['error'](_0x9178('0xc'),_0x502d21,_0x4bd20e[_0x9178('0x11')]['message']);return _0x3bcc1b(_0x4bd20e[_0x9178('0x11')][_0x9178('0x12')]);}logger[_0x9178('0x11')]('Campaign,\x20%s,\x20%s',_0x502d21,_0x4bd20e[_0x9178('0x11')][_0x9178('0x12')]);return _0x333b8b(_0x4bd20e['error'][_0x9178('0x12')]);}else{logger['info'](_0x9178('0xc'),_0x502d21,_0x9178('0xd'));_0x333b8b(_0x4bd20e[_0x9178('0x13')][_0x9178('0x12')]);}})[_0x9178('0x14')](function(_0x31baa2){logger[_0x9178('0x11')](_0x9178('0xc'),_0x502d21,_0x31baa2);_0x3bcc1b(_0x31baa2);});});}exports[_0x9178('0x15')]=function(_0x3f3dd4){var _0x2184a0=this;return new Promise(function(_0x4393f3,_0x42c31b){return db[_0x9178('0x16')]['findAll']({'raw':_0x3f3dd4[_0x9178('0x17')]?_0x3f3dd4[_0x9178('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3f3dd4[_0x9178('0x17')]?_0x3f3dd4['options'][_0x9178('0x18')]||null:null,'attributes':_0x3f3dd4[_0x9178('0x17')]?_0x3f3dd4[_0x9178('0x17')][_0x9178('0x19')]||null:null,'limit':_0x3f3dd4[_0x9178('0x17')]?_0x3f3dd4[_0x9178('0x17')][_0x9178('0x1a')]||null:null,'include':_0x3f3dd4[_0x9178('0x17')]?_0x3f3dd4['options'][_0x9178('0x1b')]?_['map'](_0x3f3dd4['options'][_0x9178('0x1b')],function(_0x19aafe){return{'model':db[_0x19aafe[_0x9178('0x1c')]],'as':_0x19aafe['as'],'attributes':_0x19aafe[_0x9178('0x19')],'include':_0x19aafe[_0x9178('0x1b')]?_[_0x9178('0x1d')](_0x19aafe[_0x9178('0x1b')],function(_0x23c04a){return{'model':db[_0x23c04a[_0x9178('0x1c')]],'as':_0x23c04a['as'],'attributes':_0x23c04a[_0x9178('0x19')],'include':_0x23c04a[_0x9178('0x1b')]?_[_0x9178('0x1d')](_0x23c04a[_0x9178('0x1b')],function(_0x3af74d){return{'model':db[_0x3af74d['model']],'as':_0x3af74d['as'],'attributes':_0x3af74d[_0x9178('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9178('0x1e')](function(_0x5c39ed){logger[_0x9178('0x1f')](_0x9178('0x15'),_0x3f3dd4);logger[_0x9178('0xe')](_0x9178('0x15'),_0x3f3dd4,JSON[_0x9178('0x10')](_0x5c39ed));_0x4393f3(_0x5c39ed);})[_0x9178('0x14')](function(_0x5d9747){logger[_0x9178('0x11')](_0x9178('0x15'),_0x5d9747['message'],_0x3f3dd4);_0x42c31b(_0x2184a0[_0x9178('0x11')](0x1f4,_0x5d9747[_0x9178('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 2a5ab09..c742e30 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 _0xbaae=['index','get','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','/:id/lists','addLists','addBlackLists','update','delete','removeBlackLists','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xbaae,0x182));var _0xebaa=function(_0x1c0f97,_0x83214b){_0x1c0f97=_0x1c0f97-0x0;var _0x1ea59d=_0xbaae[_0x1c0f97];return _0x1ea59d;};'use strict';var multer=require(_0xebaa('0x0'));var util=require(_0xebaa('0x1'));var path=require(_0xebaa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xebaa('0x3')]();var fs_extra=require(_0xebaa('0x4'));var auth=require(_0xebaa('0x5'));var interaction=require(_0xebaa('0x6'));var config=require(_0xebaa('0x7'));var controller=require(_0xebaa('0x8'));router['get']('/',auth[_0xebaa('0x9')](),controller[_0xebaa('0xa')]);router[_0xebaa('0xb')](_0xebaa('0xc'),auth[_0xebaa('0x9')](),controller[_0xebaa('0xd')]);router[_0xebaa('0xb')](_0xebaa('0xe'),auth[_0xebaa('0x9')](),controller['getHoppers']);router[_0xebaa('0xb')](_0xebaa('0xf'),auth[_0xebaa('0x9')](),controller[_0xebaa('0x10')]);router['get'](_0xebaa('0x11'),auth[_0xebaa('0x9')](),controller['getHopperFinals']);router[_0xebaa('0xb')](_0xebaa('0x12'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xebaa('0xb')]('/:id/lists',auth[_0xebaa('0x9')](),controller[_0xebaa('0x13')]);router[_0xebaa('0xb')](_0xebaa('0x14'),auth[_0xebaa('0x9')](),controller[_0xebaa('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xebaa('0x16')]);router[_0xebaa('0x17')](_0xebaa('0x18'),auth[_0xebaa('0x9')](),controller[_0xebaa('0x19')]);router[_0xebaa('0x17')](_0xebaa('0x1a'),auth[_0xebaa('0x9')](),controller[_0xebaa('0x1b')]);router[_0xebaa('0x17')](_0xebaa('0x14'),auth['isAuthenticated'](),controller[_0xebaa('0x1c')]);router['put'](_0xebaa('0xc'),auth[_0xebaa('0x9')](),controller[_0xebaa('0x1d')]);router[_0xebaa('0x1e')](_0xebaa('0xc'),auth[_0xebaa('0x9')](),controller['destroy']);router[_0xebaa('0x1e')](_0xebaa('0x1a'),auth[_0xebaa('0x9')](),controller['removeLists']);router['delete']('/:id/blacklists',auth[_0xebaa('0x9')](),controller[_0xebaa('0x1f')]);module[_0xebaa('0x20')]=router; \ No newline at end of file +var _0x05fd=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','put','/:id','delete','destroy','removeLists','removeBlackLists','exports','multer'];(function(_0x5cc2a3,_0x2d38a6){var _0x9d6e07=function(_0xa7d53f){while(--_0xa7d53f){_0x5cc2a3['push'](_0x5cc2a3['shift']());}};_0x9d6e07(++_0x2d38a6);}(_0x05fd,0x173));var _0xd05f=function(_0x466552,_0x3d4e47){_0x466552=_0x466552-0x0;var _0x3721c2=_0x05fd[_0x466552];return _0x3721c2;};'use strict';var multer=require(_0xd05f('0x0'));var util=require(_0xd05f('0x1'));var path=require('path');var timeout=require(_0xd05f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd05f('0x3'));var auth=require(_0xd05f('0x4'));var interaction=require(_0xd05f('0x5'));var config=require(_0xd05f('0x6'));var controller=require(_0xd05f('0x7'));router[_0xd05f('0x8')]('/',auth[_0xd05f('0x9')](),controller[_0xd05f('0xa')]);router[_0xd05f('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd05f('0x8')](_0xd05f('0xb'),auth[_0xd05f('0x9')](),controller['getHoppers']);router[_0xd05f('0x8')](_0xd05f('0xc'),auth['isAuthenticated'](),controller[_0xd05f('0xd')]);router['get'](_0xd05f('0xe'),auth[_0xd05f('0x9')](),controller['getHopperFinals']);router[_0xd05f('0x8')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router['get'](_0xd05f('0xf'),auth[_0xd05f('0x9')](),controller[_0xd05f('0x10')]);router[_0xd05f('0x8')](_0xd05f('0x11'),auth[_0xd05f('0x9')](),controller[_0xd05f('0x12')]);router[_0xd05f('0x13')]('/',auth[_0xd05f('0x9')](),controller[_0xd05f('0x14')]);router[_0xd05f('0x13')](_0xd05f('0x15'),auth[_0xd05f('0x9')](),controller[_0xd05f('0x16')]);router[_0xd05f('0x13')](_0xd05f('0xf'),auth[_0xd05f('0x9')](),controller[_0xd05f('0x17')]);router[_0xd05f('0x13')]('/:id/blacklists',auth[_0xd05f('0x9')](),controller['addBlackLists']);router[_0xd05f('0x18')](_0xd05f('0x19'),auth[_0xd05f('0x9')](),controller['update']);router[_0xd05f('0x1a')]('/:id',auth[_0xd05f('0x9')](),controller[_0xd05f('0x1b')]);router[_0xd05f('0x1a')]('/:id/lists',auth[_0xd05f('0x9')](),controller[_0xd05f('0x1c')]);router[_0xd05f('0x1a')](_0xd05f('0x11'),auth[_0xd05f('0x9')](),controller[_0xd05f('0x1d')]);module[_0xd05f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c87ba0b..4fd84ca 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 _0x5457=['medium','STRING','VIRTUAL','key','sequelize','TEXT'];(function(_0x33a645,_0x341973){var _0x40761d=function(_0x41a222){while(--_0x41a222){_0x33a645['push'](_0x33a645['shift']());}};_0x40761d(++_0x341973);}(_0x5457,0x70));var _0x7545=function(_0x5611af,_0x4f0e4d){_0x5611af=_0x5611af-0x0;var _0x11723d=_0x5457[_0x5611af];return _0x11723d;};'use strict';var Sequelize=require(_0x7545('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7545('0x1')],'length':_0x7545('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7545('0x3')]},'name':{'type':Sequelize[_0x7545('0x4')],'get':function(){return this['getDataValue'](_0x7545('0x5'));}}}; \ No newline at end of file +var _0x7dc0=['medium','STRING','VIRTUAL','getDataValue','key','sequelize','exports','TEXT'];(function(_0x5d78f0,_0x3784f9){var _0x4d1012=function(_0x23d0ba){while(--_0x23d0ba){_0x5d78f0['push'](_0x5d78f0['shift']());}};_0x4d1012(++_0x3784f9);}(_0x7dc0,0x9d));var _0x07dc=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x7dc0[_0x2cef86];return _0x46dfd6;};'use strict';var Sequelize=require(_0x07dc('0x0'));module[_0x07dc('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x07dc('0x2')],'length':_0x07dc('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x07dc('0x4')]},'name':{'type':Sequelize[_0x07dc('0x5')],'get':function(){return this[_0x07dc('0x6')](_0x07dc('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6781a3c..79d03da 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 _0x10c5=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','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','undefined','limit','Content-Range','apply','reject','update','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','findAll','catch','show','keys','rawAttributes','includeAll','find','params','create','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2b6bb1,_0x6ca1d7){var _0x3218b6=function(_0x5ce75c){while(--_0x5ce75c){_0x2b6bb1['push'](_0x2b6bb1['shift']());}};_0x3218b6(++_0x6ca1d7);}(_0x10c5,0x1ae));var _0x510c=function(_0x445199,_0x50daf7){_0x445199=_0x445199-0x0;var _0x1cc1a4=_0x10c5[_0x445199];return _0x1cc1a4;};'use strict';var emlformat=require(_0x510c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x510c('0x1'));var rp=require(_0x510c('0x2'));var moment=require(_0x510c('0x3'));var BPromise=require(_0x510c('0x4'));var Mustache=require(_0x510c('0x5'));var util=require(_0x510c('0x6'));var path=require('path');var sox=require(_0x510c('0x7'));var csv=require(_0x510c('0x8'));var ejs=require(_0x510c('0x9'));var fs=require('fs');var fs_extra=require(_0x510c('0xa'));var _=require(_0x510c('0xb'));var squel=require(_0x510c('0xc'));var crypto=require(_0x510c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x510c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x510c('0xf'));var Redis=require(_0x510c('0x10'));var authService=require(_0x510c('0x11'));var qs=require(_0x510c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x510c('0x13'));var logger=require(_0x510c('0x14'))(_0x510c('0x15'));var utils=require(_0x510c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x510c('0x17'));var db=require(_0x510c('0x18'))['db'];function respondWithStatusCode(_0x2b1c4c,_0xc05a86){_0xc05a86=_0xc05a86||0xcc;return function(_0x14f459){if(_0x14f459){return _0x2b1c4c[_0x510c('0x19')](_0xc05a86);}return _0x2b1c4c[_0x510c('0x1a')](_0xc05a86)[_0x510c('0x1b')]();};}function respondWithResult(_0x2ab106,_0x4a4a08){_0x4a4a08=_0x4a4a08||0xc8;return function(_0x593982){if(_0x593982){return _0x2ab106['status'](_0x4a4a08)[_0x510c('0x1c')](_0x593982);}};}function respondWithFilteredResult(_0x19c721,_0x429dc3){return function(_0x36c12c){if(_0x36c12c){var _0x16fe9b=typeof _0x429dc3[_0x510c('0x1d')]===_0x510c('0x1e')&&typeof _0x429dc3[_0x510c('0x1f')]===_0x510c('0x1e');var _0x39cbcc=_0x36c12c['count'];var _0x40ef25=_0x16fe9b?0x0:_0x429dc3['offset'];var _0x166dd8=_0x16fe9b?_0x36c12c['count']:_0x429dc3[_0x510c('0x1d')]+_0x429dc3[_0x510c('0x1f')];var _0x318b88;if(_0x166dd8>=_0x39cbcc){_0x166dd8=_0x39cbcc;_0x318b88=0xc8;}else{_0x318b88=0xce;}_0x19c721[_0x510c('0x1a')](_0x318b88);return _0x19c721['set'](_0x510c('0x20'),_0x40ef25+'-'+_0x166dd8+'/'+_0x39cbcc)[_0x510c('0x1c')](_0x36c12c);}return null;};}function patchUpdates(_0xa36377){return function(_0x4860f3){try{jsonpatch[_0x510c('0x21')](_0x4860f3,_0xa36377,!![]);}catch(_0x216d88){return BPromise[_0x510c('0x22')](_0x216d88);}return _0x4860f3['save']();};}function saveUpdates(_0x17f83b,_0x2e88eb){return function(_0x145c3f){if(_0x145c3f){return _0x145c3f[_0x510c('0x23')](_0x17f83b)['then'](function(_0x38a00e){return _0x38a00e;});}return null;};}function removeEntity(_0x57f055,_0x2acd6c){return function(_0x133555){if(_0x133555){return _0x133555[_0x510c('0x24')]()[_0x510c('0x25')](function(){var _0x2119c8=_0x133555[_0x510c('0x26')]({'plain':!![]});var _0x46f9fd=_0x510c('0x27');return db[_0x510c('0x28')][_0x510c('0x24')]({'where':{'type':_0x46f9fd,'resourceId':_0x2119c8['id']}})[_0x510c('0x25')](function(){return _0x133555;});})[_0x510c('0x25')](function(){_0x57f055[_0x510c('0x1a')](0xcc)[_0x510c('0x1b')]();});}};}function handleEntityNotFound(_0x1fc2cf,_0x550229){return function(_0x7c5f67){if(!_0x7c5f67){_0x1fc2cf[_0x510c('0x19')](0x194);}return _0x7c5f67;};}function handleError(_0x497bc2,_0x50dc65){_0x50dc65=_0x50dc65||0x1f4;return function(_0x165e1a){logger[_0x510c('0x29')](_0x165e1a[_0x510c('0x2a')]);if(_0x165e1a[_0x510c('0x2b')]){delete _0x165e1a[_0x510c('0x2b')];}_0x497bc2[_0x510c('0x1a')](_0x50dc65)[_0x510c('0x2c')](_0x165e1a);};}exports[_0x510c('0x2d')]=function(_0x85fa77,_0x9809ee){var _0x4ce854={},_0x3bec43={},_0x598977={'count':0x0,'rows':[]};var _0x3eb399=_[_0x510c('0x2e')](db[_0x510c('0x2f')]['rawAttributes'],function(_0x159cee){return{'name':_0x159cee[_0x510c('0x30')],'type':_0x159cee[_0x510c('0x31')]['key']};});_0x3bec43[_0x510c('0x32')]=_[_0x510c('0x2e')](_0x3eb399,_0x510c('0x2b'));_0x3bec43['query']=_['keys'](_0x85fa77['query']);_0x3bec43[_0x510c('0x33')]=_[_0x510c('0x34')](_0x3bec43[_0x510c('0x32')],_0x3bec43[_0x510c('0x35')]);_0x4ce854[_0x510c('0x36')]=_[_0x510c('0x34')](_0x3bec43['model'],qs[_0x510c('0x37')](_0x85fa77[_0x510c('0x35')][_0x510c('0x37')]));_0x4ce854[_0x510c('0x36')]=_0x4ce854[_0x510c('0x36')][_0x510c('0x38')]?_0x4ce854['attributes']:_0x3bec43[_0x510c('0x32')];if(!_0x85fa77[_0x510c('0x35')][_0x510c('0x39')](_0x510c('0x3a'))){_0x4ce854[_0x510c('0x1f')]=qs[_0x510c('0x1f')](_0x85fa77[_0x510c('0x35')][_0x510c('0x1f')]);_0x4ce854[_0x510c('0x1d')]=qs[_0x510c('0x1d')](_0x85fa77[_0x510c('0x35')][_0x510c('0x1d')]);}_0x4ce854[_0x510c('0x3b')]=qs['sort'](_0x85fa77[_0x510c('0x35')]['sort']);_0x4ce854[_0x510c('0x3c')]=qs[_0x510c('0x33')](_['pick'](_0x85fa77['query'],_0x3bec43['filters']),_0x3eb399);if(_0x85fa77[_0x510c('0x35')][_0x510c('0x3d')]){_0x4ce854[_0x510c('0x3c')]=_[_0x510c('0x3e')](_0x4ce854[_0x510c('0x3c')],{'$or':[{'key':{'$like':'%'+_0x85fa77[_0x510c('0x35')][_0x510c('0x3d')]+'%'}},{'value':{'$like':'%'+_0x85fa77['query'][_0x510c('0x3d')]+'%'}}]});}_0x4ce854=_[_0x510c('0x3e')]({},_0x4ce854,_0x85fa77['options']);var _0x1eec58={'where':_0x4ce854[_0x510c('0x3c')]};return db[_0x510c('0x2f')]['count'](_0x1eec58)[_0x510c('0x25')](function(_0x47c89f){_0x598977['count']=_0x47c89f;if(_0x85fa77[_0x510c('0x35')]['includeAll']){_0x4ce854['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x510c('0x3f')](_0x4ce854);})[_0x510c('0x25')](function(_0x1a2a02){_0x598977['rows']=_0x1a2a02;return _0x598977;})[_0x510c('0x25')](respondWithFilteredResult(_0x9809ee,_0x4ce854))[_0x510c('0x40')](handleError(_0x9809ee,null));};exports[_0x510c('0x41')]=function(_0x3fe8ba,_0x3b67f6){var _0xa75747={'raw':!![],'where':{'id':_0x3fe8ba['params']['id']}},_0x1b01c7={};_0x1b01c7['model']=_[_0x510c('0x42')](db[_0x510c('0x2f')][_0x510c('0x43')]);_0x1b01c7['query']=_[_0x510c('0x42')](_0x3fe8ba[_0x510c('0x35')]);_0x1b01c7[_0x510c('0x33')]=_['intersection'](_0x1b01c7[_0x510c('0x32')],_0x1b01c7[_0x510c('0x35')]);_0xa75747['attributes']=_[_0x510c('0x34')](_0x1b01c7[_0x510c('0x32')],qs[_0x510c('0x37')](_0x3fe8ba[_0x510c('0x35')][_0x510c('0x37')]));_0xa75747[_0x510c('0x36')]=_0xa75747['attributes'][_0x510c('0x38')]?_0xa75747[_0x510c('0x36')]:_0x1b01c7[_0x510c('0x32')];if(_0x3fe8ba[_0x510c('0x35')][_0x510c('0x44')]){_0xa75747['include']=[{'all':!![]}];}_0xa75747=_['merge']({},_0xa75747,_0x3fe8ba['options']);return db[_0x510c('0x2f')][_0x510c('0x45')](_0xa75747)[_0x510c('0x25')](handleEntityNotFound(_0x3b67f6,null))['then'](respondWithResult(_0x3b67f6,null))[_0x510c('0x40')](handleError(_0x3b67f6,null));};exports[_0x510c('0x23')]=function(_0xce72b4,_0xcf3283){if(_0xce72b4['body']['id']){delete _0xce72b4['body']['id'];}return db[_0x510c('0x2f')][_0x510c('0x45')]({'where':{'id':_0xce72b4[_0x510c('0x46')]['id']}})['then'](handleEntityNotFound(_0xcf3283,null))[_0x510c('0x25')](saveUpdates(_0xce72b4['body'],null))[_0x510c('0x25')](respondWithResult(_0xcf3283,null))[_0x510c('0x40')](handleError(_0xcf3283,null));};exports[_0x510c('0x24')]=function(_0x20f5f5,_0x5bf146){return db['CannedAnswer']['find']({'where':{'id':_0x20f5f5[_0x510c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf146,null))[_0x510c('0x25')](removeEntity(_0x5bf146,null))[_0x510c('0x40')](handleError(_0x5bf146,null));};exports[_0x510c('0x47')]=function(_0x38fb20,_0x2cd45a){var _0x1ec7de={'key':_0x38fb20['body']['key']};if(_0x38fb20[_0x510c('0x48')][_0x510c('0x49')]){_0x1ec7de['MailAccountId']=_0x38fb20['body']['MailAccountId'];}else if(_0x38fb20[_0x510c('0x48')]['SmsAccountId']){_0x1ec7de[_0x510c('0x4a')]=_0x38fb20[_0x510c('0x48')]['SmsAccountId'];}else if(_0x38fb20[_0x510c('0x48')][_0x510c('0x4b')]){_0x1ec7de['OpenchannelAccountId']=_0x38fb20[_0x510c('0x48')]['OpenchannelAccountId'];}else if(_0x38fb20[_0x510c('0x48')]['ChatWebsiteId']){_0x1ec7de['ChatWebsiteId']=_0x38fb20[_0x510c('0x48')][_0x510c('0x4c')];}return db[_0x510c('0x2f')][_0x510c('0x45')]({'where':_0x1ec7de})['then'](function(_0x5442c1){if(_0x5442c1){throw new db[(_0x510c('0x4d'))][(_0x510c('0x4e'))](_0x510c('0x4f'));}return db[_0x510c('0x2f')][_0x510c('0x47')](_0x38fb20['body']);})['then'](function(_0x252e66){var _0x41238b=_0x38fb20[_0x510c('0x50')][_0x510c('0x26')]({'plain':!![]});if(!_0x41238b)throw new Error(_0x510c('0x51'));if(_0x41238b[_0x510c('0x52')]==='user'){var _0x386db3=_0x252e66[_0x510c('0x26')]({'plain':!![]});return db[_0x510c('0x53')][_0x510c('0x45')]({'where':{'name':_0x510c('0x27'),'userProfileId':_0x41238b[_0x510c('0x54')]},'raw':!![]})[_0x510c('0x25')](function(_0xd3e810){if(_0xd3e810&&_0xd3e810[_0x510c('0x55')]===0x0){return db[_0x510c('0x28')][_0x510c('0x47')]({'name':_0x386db3['name'],'resourceId':_0x386db3['id'],'type':_0xd3e810[_0x510c('0x2b')],'sectionId':_0xd3e810['id']},{})[_0x510c('0x25')](function(){return _0x252e66;});}else{return _0x252e66;}})[_0x510c('0x40')](function(_0x1ec79b){logger[_0x510c('0x29')](_0x510c('0x56'),_0x1ec79b);throw _0x1ec79b;});}return _0x252e66;})['then'](respondWithResult(_0x2cd45a,0xc9))[_0x510c('0x40')](handleError(_0x2cd45a,null));}; \ No newline at end of file +var _0x9cd5=['map','CannedAnswer','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','options','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','find','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','CannedAnswers','error','name','send','index'];(function(_0x3808b5,_0x5907a0){var _0x352c3d=function(_0x334e63){while(--_0x334e63){_0x3808b5['push'](_0x3808b5['shift']());}};_0x352c3d(++_0x5907a0);}(_0x9cd5,0x1f1));var _0x59cd=function(_0x53fdd5,_0x1f3f58){_0x53fdd5=_0x53fdd5-0x0;var _0x1cc7bf=_0x9cd5[_0x53fdd5];return _0x1cc7bf;};'use strict';var emlformat=require(_0x59cd('0x0'));var rimraf=require(_0x59cd('0x1'));var zipdir=require(_0x59cd('0x2'));var jsonpatch=require(_0x59cd('0x3'));var rp=require(_0x59cd('0x4'));var moment=require('moment');var BPromise=require(_0x59cd('0x5'));var Mustache=require(_0x59cd('0x6'));var util=require(_0x59cd('0x7'));var path=require(_0x59cd('0x8'));var sox=require('sox');var csv=require(_0x59cd('0x9'));var ejs=require(_0x59cd('0xa'));var fs=require('fs');var fs_extra=require(_0x59cd('0xb'));var _=require(_0x59cd('0xc'));var squel=require(_0x59cd('0xd'));var crypto=require(_0x59cd('0xe'));var jsforce=require(_0x59cd('0xf'));var deskjs=require(_0x59cd('0x10'));var toCsv=require(_0x59cd('0x9'));var querystring=require(_0x59cd('0x11'));var Papa=require(_0x59cd('0x12'));var Redis=require(_0x59cd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x59cd('0x14'));var as=require(_0x59cd('0x15'));var hardwareService=require(_0x59cd('0x16'));var logger=require(_0x59cd('0x17'))(_0x59cd('0x18'));var utils=require(_0x59cd('0x19'));var config=require(_0x59cd('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x59cd('0x1b'))['db'];function respondWithStatusCode(_0x184d4b,_0x13e657){_0x13e657=_0x13e657||0xcc;return function(_0x513a5f){if(_0x513a5f){return _0x184d4b[_0x59cd('0x1c')](_0x13e657);}return _0x184d4b[_0x59cd('0x1d')](_0x13e657)[_0x59cd('0x1e')]();};}function respondWithResult(_0x195a8c,_0x264e4d){_0x264e4d=_0x264e4d||0xc8;return function(_0x3aa051){if(_0x3aa051){return _0x195a8c[_0x59cd('0x1d')](_0x264e4d)[_0x59cd('0x1f')](_0x3aa051);}};}function respondWithFilteredResult(_0x561fb5,_0x266d41){return function(_0x29aa0b){if(_0x29aa0b){var _0x3bab89=typeof _0x266d41[_0x59cd('0x20')]===_0x59cd('0x21')&&typeof _0x266d41['limit']===_0x59cd('0x21');var _0x21b9db=_0x29aa0b[_0x59cd('0x22')];var _0x5237e6=_0x3bab89?0x0:_0x266d41[_0x59cd('0x20')];var _0x5ecb02=_0x3bab89?_0x29aa0b['count']:_0x266d41[_0x59cd('0x20')]+_0x266d41[_0x59cd('0x23')];var _0x567691;if(_0x5ecb02>=_0x21b9db){_0x5ecb02=_0x21b9db;_0x567691=0xc8;}else{_0x567691=0xce;}_0x561fb5['status'](_0x567691);return _0x561fb5[_0x59cd('0x24')]('Content-Range',_0x5237e6+'-'+_0x5ecb02+'/'+_0x21b9db)[_0x59cd('0x1f')](_0x29aa0b);}return null;};}function patchUpdates(_0x304219){return function(_0x43c4c5){try{jsonpatch[_0x59cd('0x25')](_0x43c4c5,_0x304219,!![]);}catch(_0x5a49ab){return BPromise[_0x59cd('0x26')](_0x5a49ab);}return _0x43c4c5[_0x59cd('0x27')]();};}function saveUpdates(_0x2d0feb,_0x2d7157){return function(_0x5e5b20){if(_0x5e5b20){return _0x5e5b20[_0x59cd('0x28')](_0x2d0feb)[_0x59cd('0x29')](function(_0x3522d4){return _0x3522d4;});}return null;};}function removeEntity(_0xad36dc,_0xb1291){return function(_0x342bce){if(_0x342bce){return _0x342bce[_0x59cd('0x2a')]()[_0x59cd('0x29')](function(){var _0x490052=_0x342bce[_0x59cd('0x2b')]({'plain':!![]});var _0x3d2379=_0x59cd('0x2c');return db['UserProfileResource'][_0x59cd('0x2a')]({'where':{'type':_0x3d2379,'resourceId':_0x490052['id']}})[_0x59cd('0x29')](function(){return _0x342bce;});})[_0x59cd('0x29')](function(){_0xad36dc[_0x59cd('0x1d')](0xcc)[_0x59cd('0x1e')]();});}};}function handleEntityNotFound(_0x391d01,_0x1e47a6){return function(_0x6fb06b){if(!_0x6fb06b){_0x391d01[_0x59cd('0x1c')](0x194);}return _0x6fb06b;};}function handleError(_0x1d525d,_0x4cd1bd){_0x4cd1bd=_0x4cd1bd||0x1f4;return function(_0x46e532){logger[_0x59cd('0x2d')](_0x46e532['stack']);if(_0x46e532['name']){delete _0x46e532[_0x59cd('0x2e')];}_0x1d525d[_0x59cd('0x1d')](_0x4cd1bd)[_0x59cd('0x2f')](_0x46e532);};}exports[_0x59cd('0x30')]=function(_0x5dc6,_0x1a7e05){var _0x41b0b3={},_0x1f1af2={},_0x522f79={'count':0x0,'rows':[]};var _0x132b58=_[_0x59cd('0x31')](db[_0x59cd('0x32')]['rawAttributes'],function(_0x86cde2){return{'name':_0x86cde2['fieldName'],'type':_0x86cde2[_0x59cd('0x33')][_0x59cd('0x34')]};});_0x1f1af2[_0x59cd('0x35')]=_[_0x59cd('0x31')](_0x132b58,_0x59cd('0x2e'));_0x1f1af2[_0x59cd('0x36')]=_[_0x59cd('0x37')](_0x5dc6[_0x59cd('0x36')]);_0x1f1af2[_0x59cd('0x38')]=_[_0x59cd('0x39')](_0x1f1af2[_0x59cd('0x35')],_0x1f1af2[_0x59cd('0x36')]);_0x41b0b3[_0x59cd('0x3a')]=_[_0x59cd('0x39')](_0x1f1af2[_0x59cd('0x35')],qs[_0x59cd('0x3b')](_0x5dc6[_0x59cd('0x36')][_0x59cd('0x3b')]));_0x41b0b3[_0x59cd('0x3a')]=_0x41b0b3[_0x59cd('0x3a')][_0x59cd('0x3c')]?_0x41b0b3[_0x59cd('0x3a')]:_0x1f1af2[_0x59cd('0x35')];if(!_0x5dc6[_0x59cd('0x36')]['hasOwnProperty']('nolimit')){_0x41b0b3[_0x59cd('0x23')]=qs[_0x59cd('0x23')](_0x5dc6[_0x59cd('0x36')]['limit']);_0x41b0b3[_0x59cd('0x20')]=qs[_0x59cd('0x20')](_0x5dc6[_0x59cd('0x36')][_0x59cd('0x20')]);}_0x41b0b3[_0x59cd('0x3d')]=qs[_0x59cd('0x3e')](_0x5dc6[_0x59cd('0x36')][_0x59cd('0x3e')]);_0x41b0b3['where']=qs[_0x59cd('0x38')](_[_0x59cd('0x3f')](_0x5dc6[_0x59cd('0x36')],_0x1f1af2['filters']),_0x132b58);if(_0x5dc6[_0x59cd('0x36')][_0x59cd('0x40')]){_0x41b0b3['where']=_[_0x59cd('0x41')](_0x41b0b3[_0x59cd('0x42')],{'$or':[{'key':{'$like':'%'+_0x5dc6[_0x59cd('0x36')][_0x59cd('0x40')]+'%'}},{'value':{'$like':'%'+_0x5dc6[_0x59cd('0x36')][_0x59cd('0x40')]+'%'}}]});}_0x41b0b3=_[_0x59cd('0x41')]({},_0x41b0b3,_0x5dc6['options']);var _0x442e0c={'where':_0x41b0b3[_0x59cd('0x42')]};return db[_0x59cd('0x32')][_0x59cd('0x22')](_0x442e0c)[_0x59cd('0x29')](function(_0x1e550e){_0x522f79[_0x59cd('0x22')]=_0x1e550e;if(_0x5dc6['query'][_0x59cd('0x43')]){_0x41b0b3[_0x59cd('0x44')]=[{'all':!![]}];}return db[_0x59cd('0x32')][_0x59cd('0x45')](_0x41b0b3);})['then'](function(_0x2a5eff){_0x522f79['rows']=_0x2a5eff;return _0x522f79;})[_0x59cd('0x29')](respondWithFilteredResult(_0x1a7e05,_0x41b0b3))[_0x59cd('0x46')](handleError(_0x1a7e05,null));};exports[_0x59cd('0x47')]=function(_0x313796,_0x148e57){var _0x313b54={'raw':!![],'where':{'id':_0x313796[_0x59cd('0x48')]['id']}},_0x198dd1={};_0x198dd1[_0x59cd('0x35')]=_[_0x59cd('0x37')](db['CannedAnswer']['rawAttributes']);_0x198dd1[_0x59cd('0x36')]=_['keys'](_0x313796['query']);_0x198dd1['filters']=_['intersection'](_0x198dd1['model'],_0x198dd1[_0x59cd('0x36')]);_0x313b54[_0x59cd('0x3a')]=_['intersection'](_0x198dd1[_0x59cd('0x35')],qs[_0x59cd('0x3b')](_0x313796[_0x59cd('0x36')][_0x59cd('0x3b')]));_0x313b54[_0x59cd('0x3a')]=_0x313b54[_0x59cd('0x3a')][_0x59cd('0x3c')]?_0x313b54[_0x59cd('0x3a')]:_0x198dd1[_0x59cd('0x35')];if(_0x313796[_0x59cd('0x36')][_0x59cd('0x43')]){_0x313b54['include']=[{'all':!![]}];}_0x313b54=_[_0x59cd('0x41')]({},_0x313b54,_0x313796[_0x59cd('0x49')]);return db[_0x59cd('0x32')]['find'](_0x313b54)[_0x59cd('0x29')](handleEntityNotFound(_0x148e57,null))['then'](respondWithResult(_0x148e57,null))[_0x59cd('0x46')](handleError(_0x148e57,null));};exports[_0x59cd('0x28')]=function(_0x5bac72,_0x4f706c){if(_0x5bac72[_0x59cd('0x4a')]['id']){delete _0x5bac72[_0x59cd('0x4a')]['id'];}return db[_0x59cd('0x32')]['find']({'where':{'id':_0x5bac72[_0x59cd('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f706c,null))[_0x59cd('0x29')](saveUpdates(_0x5bac72[_0x59cd('0x4a')],null))[_0x59cd('0x29')](respondWithResult(_0x4f706c,null))[_0x59cd('0x46')](handleError(_0x4f706c,null));};exports[_0x59cd('0x2a')]=function(_0x22d2f6,_0xdf9712){return db[_0x59cd('0x32')]['find']({'where':{'id':_0x22d2f6['params']['id']}})[_0x59cd('0x29')](handleEntityNotFound(_0xdf9712,null))['then'](removeEntity(_0xdf9712,null))[_0x59cd('0x46')](handleError(_0xdf9712,null));};exports['create']=function(_0x149a06,_0x3aa8dc){var _0x230cd4={'key':_0x149a06[_0x59cd('0x4a')][_0x59cd('0x34')]};if(_0x149a06[_0x59cd('0x4a')]['MailAccountId']){_0x230cd4[_0x59cd('0x4b')]=_0x149a06[_0x59cd('0x4a')][_0x59cd('0x4b')];}else if(_0x149a06['body']['SmsAccountId']){_0x230cd4[_0x59cd('0x4c')]=_0x149a06[_0x59cd('0x4a')][_0x59cd('0x4c')];}else if(_0x149a06[_0x59cd('0x4a')][_0x59cd('0x4d')]){_0x230cd4[_0x59cd('0x4d')]=_0x149a06[_0x59cd('0x4a')]['OpenchannelAccountId'];}else if(_0x149a06['body'][_0x59cd('0x4e')]){_0x230cd4[_0x59cd('0x4e')]=_0x149a06[_0x59cd('0x4a')][_0x59cd('0x4e')];}return db[_0x59cd('0x32')][_0x59cd('0x4f')]({'where':_0x230cd4})[_0x59cd('0x29')](function(_0x1acf54){if(_0x1acf54){throw new db[(_0x59cd('0x50'))][(_0x59cd('0x51'))](_0x59cd('0x52'));}return db['CannedAnswer']['create'](_0x149a06[_0x59cd('0x4a')]);})['then'](function(_0xa47d22){var _0x1ff85c=_0x149a06[_0x59cd('0x53')]['get']({'plain':!![]});if(!_0x1ff85c)throw new Error(_0x59cd('0x54'));if(_0x1ff85c[_0x59cd('0x55')]===_0x59cd('0x53')){var _0x820f91=_0xa47d22[_0x59cd('0x2b')]({'plain':!![]});return db[_0x59cd('0x56')][_0x59cd('0x4f')]({'where':{'name':_0x59cd('0x2c'),'userProfileId':_0x1ff85c[_0x59cd('0x57')]},'raw':!![]})[_0x59cd('0x29')](function(_0x51c1ce){if(_0x51c1ce&&_0x51c1ce[_0x59cd('0x58')]===0x0){return db['UserProfileResource'][_0x59cd('0x59')]({'name':_0x820f91[_0x59cd('0x2e')],'resourceId':_0x820f91['id'],'type':_0x51c1ce['name'],'sectionId':_0x51c1ce['id']},{})[_0x59cd('0x29')](function(){return _0xa47d22;});}else{return _0xa47d22;}})['catch'](function(_0x1b71de){logger[_0x59cd('0x2d')](_0x59cd('0x5a'),_0x1b71de);throw _0x1b71de;});}return _0xa47d22;})[_0x59cd('0x29')](respondWithResult(_0x3aa8dc,0xc9))[_0x59cd('0x46')](handleError(_0x3aa8dc,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a090a3a..34c3137 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 _0xe82b=['tools_canned_answers','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x41130b,_0x2654b1){var _0x1ff258=function(_0x284984){while(--_0x284984){_0x41130b['push'](_0x41130b['shift']());}};_0x1ff258(++_0x2654b1);}(_0xe82b,0x11a));var _0xbe82=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xe82b[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xbe82('0x0'));var util=require(_0xbe82('0x1'));var logger=require('../../config/logger')(_0xbe82('0x2'));var moment=require(_0xbe82('0x3'));var BPromise=require(_0xbe82('0x4'));var rp=require(_0xbe82('0x5'));var fs=require('fs');var path=require(_0xbe82('0x6'));var rimraf=require(_0xbe82('0x7'));var config=require('../../config/environment');var attributes=require(_0xbe82('0x8'));module[_0xbe82('0x9')]=function(_0x5e33b2,_0x1f02d7){return _0x5e33b2[_0xbe82('0xa')](_0xbe82('0xb'),attributes,{'tableName':_0xbe82('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe82('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd592=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x119f3c,_0x4bee97){var _0x335bfc=function(_0x2102cd){while(--_0x2102cd){_0x119f3c['push'](_0x119f3c['shift']());}};_0x335bfc(++_0x4bee97);}(_0xd592,0x97));var _0x2d59=function(_0x26c264,_0xd8bc65){_0x26c264=_0x26c264-0x0;var _0x2a40a4=_0xd592[_0x26c264];return _0x2a40a4;};'use strict';var _=require(_0x2d59('0x0'));var util=require(_0x2d59('0x1'));var logger=require(_0x2d59('0x2'))(_0x2d59('0x3'));var moment=require(_0x2d59('0x4'));var BPromise=require(_0x2d59('0x5'));var rp=require(_0x2d59('0x6'));var fs=require('fs');var path=require(_0x2d59('0x7'));var rimraf=require(_0x2d59('0x8'));var config=require(_0x2d59('0x9'));var attributes=require('./cannedAnswer.attributes');module[_0x2d59('0xa')]=function(_0x5f059b,_0x44f619){return _0x5f059b[_0x2d59('0xb')](_0x2d59('0xc'),attributes,{'tableName':_0x2d59('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2d59('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 037be3e..9787022 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(_0x27e671,_0x4dee15){var _0x4b0b6d=function(_0x2bd1da){while(--_0x2bd1da){_0x27e671['push'](_0x27e671['shift']());}};_0x4b0b6d(++_0x4dee15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x30d199,_0x287cb0){var _0x5c465d=function(_0x4bc356){while(--_0x4bc356){_0x30d199['push'](_0x30d199['shift']());}};_0x5c465d(++_0x287cb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 2de9dd7..ba0e9b4 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 _0x7663=['../../config/environment','./cannedAnswer.controller','index','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2ce0a2,_0x1529ae){var _0x201721=function(_0x145f8d){while(--_0x145f8d){_0x2ce0a2['push'](_0x2ce0a2['shift']());}};_0x201721(++_0x1529ae);}(_0x7663,0x142));var _0x3766=function(_0x3073d5,_0xd1fdf5){_0x3073d5=_0x3073d5-0x0;var _0x56ee5a=_0x7663[_0x3073d5];return _0x56ee5a;};'use strict';var multer=require(_0x3766('0x0'));var util=require(_0x3766('0x1'));var path=require(_0x3766('0x2'));var timeout=require(_0x3766('0x3'));var express=require(_0x3766('0x4'));var router=express['Router']();var fs_extra=require(_0x3766('0x5'));var auth=require(_0x3766('0x6'));var interaction=require(_0x3766('0x7'));var config=require(_0x3766('0x8'));var controller=require(_0x3766('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3766('0xa')]);router[_0x3766('0xb')]('/:id',auth[_0x3766('0xc')](),controller[_0x3766('0xd')]);router[_0x3766('0xe')]('/',auth[_0x3766('0xc')](),controller[_0x3766('0xf')]);router[_0x3766('0x10')](_0x3766('0x11'),auth['isAuthenticated'](),controller[_0x3766('0x12')]);router[_0x3766('0x13')](_0x3766('0x11'),auth[_0x3766('0xc')](),controller[_0x3766('0x14')]);module[_0x3766('0x15')]=router; \ No newline at end of file +var _0x8c26=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','create','put','delete','destroy'];(function(_0x52ef9a,_0x312e31){var _0x424c2b=function(_0x231947){while(--_0x231947){_0x52ef9a['push'](_0x52ef9a['shift']());}};_0x424c2b(++_0x312e31);}(_0x8c26,0x1e1));var _0x68c2=function(_0x5e31d6,_0x238cb5){_0x5e31d6=_0x5e31d6-0x0;var _0x2e206a=_0x8c26[_0x5e31d6];return _0x2e206a;};'use strict';var multer=require(_0x68c2('0x0'));var util=require(_0x68c2('0x1'));var path=require(_0x68c2('0x2'));var timeout=require(_0x68c2('0x3'));var express=require('express');var router=express[_0x68c2('0x4')]();var fs_extra=require(_0x68c2('0x5'));var auth=require(_0x68c2('0x6'));var interaction=require(_0x68c2('0x7'));var config=require(_0x68c2('0x8'));var controller=require(_0x68c2('0x9'));router[_0x68c2('0xa')]('/',auth['isAuthenticated'](),controller[_0x68c2('0xb')]);router['get'](_0x68c2('0xc'),auth[_0x68c2('0xd')](),controller[_0x68c2('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x68c2('0xf')]);router[_0x68c2('0x10')]('/:id',auth[_0x68c2('0xd')](),controller['update']);router[_0x68c2('0x11')](_0x68c2('0xc'),auth[_0x68c2('0xd')](),controller[_0x68c2('0x12')]);module[_0x68c2('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 71339cc..f8a5ac7 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 _0xf45e=['INTEGER','sequelize','DATE','STRING'];(function(_0x10b099,_0x847335){var _0xace9f7=function(_0x3e5ccb){while(--_0x3e5ccb){_0x10b099['push'](_0x10b099['shift']());}};_0xace9f7(++_0x847335);}(_0xf45e,0x115));var _0xef45=function(_0x4b531b,_0x299078){_0x4b531b=_0x4b531b-0x0;var _0x1bc994=_0xf45e[_0x4b531b];return _0x1bc994;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xef45('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xef45('0x2')]},'src':{'type':Sequelize[_0xef45('0x2')]},'dst':{'type':Sequelize[_0xef45('0x2')]},'dcontext':{'type':Sequelize[_0xef45('0x2')]},'channel':{'type':Sequelize[_0xef45('0x2')]},'dstchannel':{'type':Sequelize[_0xef45('0x2')]},'lastapp':{'type':Sequelize[_0xef45('0x2')]},'lastdata':{'type':Sequelize[_0xef45('0x2')]},'duration':{'type':Sequelize[_0xef45('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xef45('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xef45('0x2')]},'amaflags':{'type':Sequelize[_0xef45('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xef45('0x2')]},'userfield':{'type':Sequelize[_0xef45('0x2')]},'uniqueid':{'type':Sequelize[_0xef45('0x2')]},'linkedid':{'type':Sequelize[_0xef45('0x2')]},'sequence':{'type':Sequelize[_0xef45('0x2')]},'peeraccount':{'type':Sequelize[_0xef45('0x2')]},'type':{'type':Sequelize[_0xef45('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6449=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x504b50,_0x3ee98c){var _0x4f627c=function(_0x3120cf){while(--_0x3120cf){_0x504b50['push'](_0x504b50['shift']());}};_0x4f627c(++_0x3ee98c);}(_0x6449,0xee));var _0x9644=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x6449[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require('sequelize');module[_0x9644('0x0')]={'calldate':{'type':Sequelize[_0x9644('0x1')],'allowNull':![],'defaultValue':_0x9644('0x2')},'clid':{'type':Sequelize[_0x9644('0x3')]},'src':{'type':Sequelize[_0x9644('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x9644('0x3')]},'channel':{'type':Sequelize[_0x9644('0x3')]},'dstchannel':{'type':Sequelize[_0x9644('0x3')]},'lastapp':{'type':Sequelize[_0x9644('0x3')]},'lastdata':{'type':Sequelize[_0x9644('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9644('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9644('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9644('0x3')]},'userfield':{'type':Sequelize[_0x9644('0x3')]},'uniqueid':{'type':Sequelize[_0x9644('0x3')]},'linkedid':{'type':Sequelize[_0x9644('0x3')]},'sequence':{'type':Sequelize[_0x9644('0x3')]},'peeraccount':{'type':Sequelize[_0x9644('0x3')]},'type':{'type':Sequelize[_0x9644('0x3')]},'tag':{'type':Sequelize[_0x9644('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index bcb1507..66690b5 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 _0x826a=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','Cdr','fieldName','type'];(function(_0x5ab238,_0x4ddda9){var _0x236db6=function(_0x5f1f3f){while(--_0x5f1f3f){_0x5ab238['push'](_0x5ab238['shift']());}};_0x236db6(++_0x4ddda9);}(_0x826a,0x1aa));var _0xa826=function(_0x7f4ea5,_0x1655e0){_0x7f4ea5=_0x7f4ea5-0x0;var _0x26f5b7=_0x826a[_0x7f4ea5];return _0x26f5b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa826('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa826('0x1'));var rp=require('request-promise');var moment=require(_0xa826('0x2'));var BPromise=require(_0xa826('0x3'));var Mustache=require(_0xa826('0x4'));var util=require(_0xa826('0x5'));var path=require('path');var sox=require(_0xa826('0x6'));var csv=require(_0xa826('0x7'));var ejs=require(_0xa826('0x8'));var fs=require('fs');var fs_extra=require(_0xa826('0x9'));var _=require(_0xa826('0xa'));var squel=require(_0xa826('0xb'));var crypto=require(_0xa826('0xc'));var jsforce=require(_0xa826('0xd'));var deskjs=require(_0xa826('0xe'));var toCsv=require(_0xa826('0x7'));var querystring=require(_0xa826('0xf'));var Papa=require(_0xa826('0x10'));var Redis=require(_0xa826('0x11'));var authService=require(_0xa826('0x12'));var qs=require(_0xa826('0x13'));var as=require(_0xa826('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa826('0x15'))('api');var utils=require(_0xa826('0x16'));var config=require(_0xa826('0x17'));var licenseUtil=require(_0xa826('0x18'));var db=require(_0xa826('0x19'))['db'];function respondWithStatusCode(_0x212fac,_0x40838f){_0x40838f=_0x40838f||0xcc;return function(_0x2f1d39){if(_0x2f1d39){return _0x212fac['sendStatus'](_0x40838f);}return _0x212fac[_0xa826('0x1a')](_0x40838f)['end']();};}function respondWithResult(_0x3e99b0,_0x41c0c2){_0x41c0c2=_0x41c0c2||0xc8;return function(_0x5dc0c7){if(_0x5dc0c7){return _0x3e99b0['status'](_0x41c0c2)['json'](_0x5dc0c7);}};}function respondWithFilteredResult(_0x1b6d16,_0x4f25bd){return function(_0x4c546b){if(_0x4c546b){var _0x9a3788=typeof _0x4f25bd[_0xa826('0x1b')]===_0xa826('0x1c')&&typeof _0x4f25bd['limit']===_0xa826('0x1c');var _0x312e14=_0x4c546b[_0xa826('0x1d')];var _0x453c5d=_0x9a3788?0x0:_0x4f25bd[_0xa826('0x1b')];var _0x48930f=_0x9a3788?_0x4c546b[_0xa826('0x1d')]:_0x4f25bd[_0xa826('0x1b')]+_0x4f25bd[_0xa826('0x1e')];var _0x57e96e;if(_0x48930f>=_0x312e14){_0x48930f=_0x312e14;_0x57e96e=0xc8;}else{_0x57e96e=0xce;}_0x1b6d16['status'](_0x57e96e);return _0x1b6d16[_0xa826('0x1f')](_0xa826('0x20'),_0x453c5d+'-'+_0x48930f+'/'+_0x312e14)[_0xa826('0x21')](_0x4c546b);}return null;};}function patchUpdates(_0x8d1650){return function(_0x124564){try{jsonpatch['apply'](_0x124564,_0x8d1650,!![]);}catch(_0x3171ff){return BPromise[_0xa826('0x22')](_0x3171ff);}return _0x124564[_0xa826('0x23')]();};}function saveUpdates(_0x5d410f,_0x5ddeef){return function(_0x361ca5){if(_0x361ca5){return _0x361ca5[_0xa826('0x24')](_0x5d410f)[_0xa826('0x25')](function(_0x4eb4f3){return _0x4eb4f3;});}return null;};}function removeEntity(_0x1d7adf,_0x26ef25){return function(_0x1d4ade){if(_0x1d4ade){return _0x1d4ade[_0xa826('0x26')]()[_0xa826('0x25')](function(){_0x1d7adf['status'](0xcc)[_0xa826('0x27')]();});}};}function handleEntityNotFound(_0x4fa5db,_0x17ef2d){return function(_0x174f16){if(!_0x174f16){_0x4fa5db['sendStatus'](0x194);}return _0x174f16;};}function handleError(_0xfc0448,_0xfa4d94){_0xfa4d94=_0xfa4d94||0x1f4;return function(_0x38c919){logger[_0xa826('0x28')](_0x38c919[_0xa826('0x29')]);if(_0x38c919[_0xa826('0x2a')]){delete _0x38c919[_0xa826('0x2a')];}_0xfc0448[_0xa826('0x1a')](_0xfa4d94)[_0xa826('0x2b')](_0x38c919);};}exports[_0xa826('0x2c')]=function(_0x1e35de,_0x473d8d){var _0x1f2749={},_0x2cb586={},_0x2253c7={'count':0x0,'rows':[]};var _0x27f8f9=_['map'](db[_0xa826('0x2d')]['rawAttributes'],function(_0x2dd810){return{'name':_0x2dd810[_0xa826('0x2e')],'type':_0x2dd810[_0xa826('0x2f')][_0xa826('0x30')]};});_0x2cb586[_0xa826('0x31')]=_['map'](_0x27f8f9,'name');_0x2cb586[_0xa826('0x32')]=_[_0xa826('0x33')](_0x1e35de[_0xa826('0x32')]);_0x2cb586[_0xa826('0x34')]=_['intersection'](_0x2cb586[_0xa826('0x31')],_0x2cb586[_0xa826('0x32')]);_0x1f2749['attributes']=_[_0xa826('0x35')](_0x2cb586['model'],qs[_0xa826('0x36')](_0x1e35de[_0xa826('0x32')][_0xa826('0x36')]));_0x1f2749[_0xa826('0x37')]=_0x1f2749[_0xa826('0x37')]['length']?_0x1f2749[_0xa826('0x37')]:_0x2cb586[_0xa826('0x31')];if(!_0x1e35de[_0xa826('0x32')][_0xa826('0x38')](_0xa826('0x39'))){_0x1f2749[_0xa826('0x1e')]=qs[_0xa826('0x1e')](_0x1e35de[_0xa826('0x32')][_0xa826('0x1e')]);_0x1f2749[_0xa826('0x1b')]=qs[_0xa826('0x1b')](_0x1e35de['query'][_0xa826('0x1b')]);}_0x1f2749['order']=qs[_0xa826('0x3a')](_0x1e35de['query'][_0xa826('0x3a')]);_0x1f2749[_0xa826('0x3b')]=qs[_0xa826('0x34')](_[_0xa826('0x3c')](_0x1e35de[_0xa826('0x32')],_0x2cb586[_0xa826('0x34')]),_0x27f8f9);if(_0x1e35de[_0xa826('0x32')][_0xa826('0x3d')]){_0x1f2749[_0xa826('0x3b')]=_[_0xa826('0x3e')](_0x1f2749[_0xa826('0x3b')],{'$or':_[_0xa826('0x3f')](_0x27f8f9,function(_0x5911d3){if(_0x5911d3[_0xa826('0x2f')]!==_0xa826('0x40')){var _0x251208={};_0x251208[_0x5911d3['name']]={'$like':'%'+_0x1e35de[_0xa826('0x32')][_0xa826('0x3d')]+'%'};return _0x251208;}})});}_0x1f2749=_['merge']({},_0x1f2749,_0x1e35de[_0xa826('0x41')]);var _0x47d9f1={'where':_0x1f2749['where']};return db[_0xa826('0x2d')][_0xa826('0x1d')](_0x47d9f1)[_0xa826('0x25')](function(_0x308d4){_0x2253c7[_0xa826('0x1d')]=_0x308d4;if(_0x1e35de[_0xa826('0x32')]['includeAll']){_0x1f2749[_0xa826('0x42')]=[{'all':!![]}];}return db[_0xa826('0x2d')][_0xa826('0x43')](_0x1f2749);})[_0xa826('0x25')](function(_0x244fd3){_0x2253c7[_0xa826('0x44')]=_0x244fd3;return _0x2253c7;})['then'](respondWithFilteredResult(_0x473d8d,_0x1f2749))[_0xa826('0x45')](handleError(_0x473d8d,null));};exports[_0xa826('0x46')]=function(_0x405ee1,_0x162be1){var _0x258e57={'raw':!![],'where':{'id':_0x405ee1[_0xa826('0x47')]['id']}},_0x53b70e={};_0x53b70e[_0xa826('0x31')]=_[_0xa826('0x33')](db[_0xa826('0x2d')][_0xa826('0x48')]);_0x53b70e[_0xa826('0x32')]=_[_0xa826('0x33')](_0x405ee1[_0xa826('0x32')]);_0x53b70e[_0xa826('0x34')]=_[_0xa826('0x35')](_0x53b70e[_0xa826('0x31')],_0x53b70e[_0xa826('0x32')]);_0x258e57['attributes']=_[_0xa826('0x35')](_0x53b70e[_0xa826('0x31')],qs[_0xa826('0x36')](_0x405ee1['query'][_0xa826('0x36')]));_0x258e57[_0xa826('0x37')]=_0x258e57[_0xa826('0x37')][_0xa826('0x49')]?_0x258e57[_0xa826('0x37')]:_0x53b70e['model'];if(_0x405ee1[_0xa826('0x32')][_0xa826('0x4a')]){_0x258e57[_0xa826('0x42')]=[{'all':!![]}];}_0x258e57=_[_0xa826('0x3e')]({},_0x258e57,_0x405ee1[_0xa826('0x41')]);return db[_0xa826('0x2d')][_0xa826('0x4b')](_0x258e57)['then'](handleEntityNotFound(_0x162be1,null))[_0xa826('0x25')](respondWithResult(_0x162be1,null))['catch'](handleError(_0x162be1,null));};exports['create']=function(_0x4b4352,_0x26a858){return db[_0xa826('0x2d')][_0xa826('0x4c')](_0x4b4352[_0xa826('0x4d')],{})['then'](respondWithResult(_0x26a858,0xc9))[_0xa826('0x45')](handleError(_0x26a858,null));};exports['update']=function(_0x5e0947,_0xedcbc2){if(_0x5e0947[_0xa826('0x4d')]['id']){delete _0x5e0947['body']['id'];}return db[_0xa826('0x2d')][_0xa826('0x4b')]({'where':{'id':_0x5e0947['params']['id']}})['then'](handleEntityNotFound(_0xedcbc2,null))['then'](saveUpdates(_0x5e0947['body'],null))['then'](respondWithResult(_0xedcbc2,null))['catch'](handleError(_0xedcbc2,null));};exports['destroy']=function(_0xb3fae0,_0x5d5269){return db[_0xa826('0x2d')]['find']({'where':{'id':_0xb3fae0[_0xa826('0x47')]['id']}})[_0xa826('0x25')](handleEntityNotFound(_0x5d5269,null))[_0xa826('0x25')](removeEntity(_0x5d5269,null))[_0xa826('0x45')](handleError(_0x5d5269,null));};exports[_0xa826('0x4e')]=function(_0x52cf5e,_0x209704){return db['Cdr']['describe']()[_0xa826('0x25')](respondWithResult(_0x209704,null))[_0xa826('0x45')](handleError(_0x209704,null));}; \ No newline at end of file +var _0x7a59=['describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','Cdr','findAll','show','params','keys','include','find','create','body','catch','update'];(function(_0x272700,_0x525483){var _0x3927a4=function(_0x5a98e0){while(--_0x5a98e0){_0x272700['push'](_0x272700['shift']());}};_0x3927a4(++_0x525483);}(_0x7a59,0x16e));var _0x97a5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7a59[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x97a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97a5('0x1'));var rp=require(_0x97a5('0x2'));var moment=require(_0x97a5('0x3'));var BPromise=require(_0x97a5('0x4'));var Mustache=require(_0x97a5('0x5'));var util=require('util');var path=require(_0x97a5('0x6'));var sox=require(_0x97a5('0x7'));var csv=require(_0x97a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a5('0x9'));var _=require(_0x97a5('0xa'));var squel=require(_0x97a5('0xb'));var crypto=require(_0x97a5('0xc'));var jsforce=require(_0x97a5('0xd'));var deskjs=require(_0x97a5('0xe'));var toCsv=require(_0x97a5('0x8'));var querystring=require('querystring');var Papa=require(_0x97a5('0xf'));var Redis=require(_0x97a5('0x10'));var authService=require(_0x97a5('0x11'));var qs=require(_0x97a5('0x12'));var as=require(_0x97a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97a5('0x14'));var utils=require(_0x97a5('0x15'));var config=require(_0x97a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97a5('0x17'))['db'];function respondWithStatusCode(_0x350720,_0x55305a){_0x55305a=_0x55305a||0xcc;return function(_0x4f85a0){if(_0x4f85a0){return _0x350720[_0x97a5('0x18')](_0x55305a);}return _0x350720[_0x97a5('0x19')](_0x55305a)['end']();};}function respondWithResult(_0x595437,_0x51d5e2){_0x51d5e2=_0x51d5e2||0xc8;return function(_0x5a4471){if(_0x5a4471){return _0x595437[_0x97a5('0x19')](_0x51d5e2)[_0x97a5('0x1a')](_0x5a4471);}};}function respondWithFilteredResult(_0x3603e4,_0x4d8ba7){return function(_0x1a7a62){if(_0x1a7a62){var _0x3fa986=typeof _0x4d8ba7['offset']===_0x97a5('0x1b')&&typeof _0x4d8ba7['limit']===_0x97a5('0x1b');var _0x55071b=_0x1a7a62['count'];var _0x52ce92=_0x3fa986?0x0:_0x4d8ba7[_0x97a5('0x1c')];var _0x5c5740=_0x3fa986?_0x1a7a62[_0x97a5('0x1d')]:_0x4d8ba7[_0x97a5('0x1c')]+_0x4d8ba7[_0x97a5('0x1e')];var _0x1efe8c;if(_0x5c5740>=_0x55071b){_0x5c5740=_0x55071b;_0x1efe8c=0xc8;}else{_0x1efe8c=0xce;}_0x3603e4['status'](_0x1efe8c);return _0x3603e4['set'](_0x97a5('0x1f'),_0x52ce92+'-'+_0x5c5740+'/'+_0x55071b)[_0x97a5('0x1a')](_0x1a7a62);}return null;};}function patchUpdates(_0x4e3386){return function(_0x51858b){try{jsonpatch[_0x97a5('0x20')](_0x51858b,_0x4e3386,!![]);}catch(_0x3d7dba){return BPromise[_0x97a5('0x21')](_0x3d7dba);}return _0x51858b['save']();};}function saveUpdates(_0x34fb55,_0x3a5849){return function(_0x23f4f8){if(_0x23f4f8){return _0x23f4f8['update'](_0x34fb55)[_0x97a5('0x22')](function(_0x33d6da){return _0x33d6da;});}return null;};}function removeEntity(_0x4e2074,_0x5e731e){return function(_0x469592){if(_0x469592){return _0x469592[_0x97a5('0x23')]()[_0x97a5('0x22')](function(){_0x4e2074[_0x97a5('0x19')](0xcc)[_0x97a5('0x24')]();});}};}function handleEntityNotFound(_0x302d78,_0xf7ad1e){return function(_0x4743e0){if(!_0x4743e0){_0x302d78['sendStatus'](0x194);}return _0x4743e0;};}function handleError(_0x2038dd,_0x46ee45){_0x46ee45=_0x46ee45||0x1f4;return function(_0x2ca97c){logger[_0x97a5('0x25')](_0x2ca97c[_0x97a5('0x26')]);if(_0x2ca97c[_0x97a5('0x27')]){delete _0x2ca97c['name'];}_0x2038dd[_0x97a5('0x19')](_0x46ee45)[_0x97a5('0x28')](_0x2ca97c);};}exports['index']=function(_0x274ccb,_0x52248f){var _0x48f1c1={},_0x1bdb74={},_0x2eaae4={'count':0x0,'rows':[]};var _0x5c1c67=_[_0x97a5('0x29')](db['Cdr'][_0x97a5('0x2a')],function(_0x3c5d02){return{'name':_0x3c5d02[_0x97a5('0x2b')],'type':_0x3c5d02[_0x97a5('0x2c')]['key']};});_0x1bdb74['model']=_[_0x97a5('0x29')](_0x5c1c67,_0x97a5('0x27'));_0x1bdb74[_0x97a5('0x2d')]=_['keys'](_0x274ccb[_0x97a5('0x2d')]);_0x1bdb74[_0x97a5('0x2e')]=_['intersection'](_0x1bdb74[_0x97a5('0x2f')],_0x1bdb74[_0x97a5('0x2d')]);_0x48f1c1['attributes']=_[_0x97a5('0x30')](_0x1bdb74[_0x97a5('0x2f')],qs[_0x97a5('0x31')](_0x274ccb['query'][_0x97a5('0x31')]));_0x48f1c1[_0x97a5('0x32')]=_0x48f1c1[_0x97a5('0x32')][_0x97a5('0x33')]?_0x48f1c1[_0x97a5('0x32')]:_0x1bdb74[_0x97a5('0x2f')];if(!_0x274ccb[_0x97a5('0x2d')]['hasOwnProperty'](_0x97a5('0x34'))){_0x48f1c1[_0x97a5('0x1e')]=qs[_0x97a5('0x1e')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x1e')]);_0x48f1c1[_0x97a5('0x1c')]=qs[_0x97a5('0x1c')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x1c')]);}_0x48f1c1[_0x97a5('0x35')]=qs[_0x97a5('0x36')](_0x274ccb[_0x97a5('0x2d')][_0x97a5('0x36')]);_0x48f1c1['where']=qs[_0x97a5('0x2e')](_[_0x97a5('0x37')](_0x274ccb[_0x97a5('0x2d')],_0x1bdb74[_0x97a5('0x2e')]),_0x5c1c67);if(_0x274ccb[_0x97a5('0x2d')]['filter']){_0x48f1c1['where']=_[_0x97a5('0x38')](_0x48f1c1[_0x97a5('0x39')],{'$or':_[_0x97a5('0x29')](_0x5c1c67,function(_0x45a548){if(_0x45a548[_0x97a5('0x2c')]!==_0x97a5('0x3a')){var _0x57333b={};_0x57333b[_0x45a548[_0x97a5('0x27')]]={'$like':'%'+_0x274ccb['query'][_0x97a5('0x3b')]+'%'};return _0x57333b;}})});}_0x48f1c1=_[_0x97a5('0x38')]({},_0x48f1c1,_0x274ccb[_0x97a5('0x3c')]);var _0x798318={'where':_0x48f1c1[_0x97a5('0x39')]};return db['Cdr'][_0x97a5('0x1d')](_0x798318)[_0x97a5('0x22')](function(_0x64505){_0x2eaae4[_0x97a5('0x1d')]=_0x64505;if(_0x274ccb[_0x97a5('0x2d')]['includeAll']){_0x48f1c1['include']=[{'all':!![]}];}return db[_0x97a5('0x3d')][_0x97a5('0x3e')](_0x48f1c1);})[_0x97a5('0x22')](function(_0x20dbc6){_0x2eaae4['rows']=_0x20dbc6;return _0x2eaae4;})[_0x97a5('0x22')](respondWithFilteredResult(_0x52248f,_0x48f1c1))['catch'](handleError(_0x52248f,null));};exports[_0x97a5('0x3f')]=function(_0x331108,_0x111e72){var _0x5baf77={'raw':!![],'where':{'id':_0x331108[_0x97a5('0x40')]['id']}},_0xefb019={};_0xefb019['model']=_[_0x97a5('0x41')](db[_0x97a5('0x3d')][_0x97a5('0x2a')]);_0xefb019[_0x97a5('0x2d')]=_[_0x97a5('0x41')](_0x331108[_0x97a5('0x2d')]);_0xefb019[_0x97a5('0x2e')]=_[_0x97a5('0x30')](_0xefb019[_0x97a5('0x2f')],_0xefb019[_0x97a5('0x2d')]);_0x5baf77[_0x97a5('0x32')]=_[_0x97a5('0x30')](_0xefb019['model'],qs[_0x97a5('0x31')](_0x331108[_0x97a5('0x2d')][_0x97a5('0x31')]));_0x5baf77['attributes']=_0x5baf77[_0x97a5('0x32')][_0x97a5('0x33')]?_0x5baf77[_0x97a5('0x32')]:_0xefb019[_0x97a5('0x2f')];if(_0x331108[_0x97a5('0x2d')]['includeAll']){_0x5baf77[_0x97a5('0x42')]=[{'all':!![]}];}_0x5baf77=_[_0x97a5('0x38')]({},_0x5baf77,_0x331108[_0x97a5('0x3c')]);return db[_0x97a5('0x3d')][_0x97a5('0x43')](_0x5baf77)['then'](handleEntityNotFound(_0x111e72,null))[_0x97a5('0x22')](respondWithResult(_0x111e72,null))['catch'](handleError(_0x111e72,null));};exports[_0x97a5('0x44')]=function(_0x235f9d,_0x330f6a){return db['Cdr'][_0x97a5('0x44')](_0x235f9d[_0x97a5('0x45')],{})[_0x97a5('0x22')](respondWithResult(_0x330f6a,0xc9))[_0x97a5('0x46')](handleError(_0x330f6a,null));};exports[_0x97a5('0x47')]=function(_0x42ced6,_0x49b215){if(_0x42ced6[_0x97a5('0x45')]['id']){delete _0x42ced6[_0x97a5('0x45')]['id'];}return db[_0x97a5('0x3d')][_0x97a5('0x43')]({'where':{'id':_0x42ced6['params']['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x49b215,null))[_0x97a5('0x22')](saveUpdates(_0x42ced6['body'],null))[_0x97a5('0x22')](respondWithResult(_0x49b215,null))[_0x97a5('0x46')](handleError(_0x49b215,null));};exports[_0x97a5('0x23')]=function(_0x56890f,_0x2a6fa0){return db[_0x97a5('0x3d')]['find']({'where':{'id':_0x56890f[_0x97a5('0x40')]['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x2a6fa0,null))[_0x97a5('0x22')](removeEntity(_0x2a6fa0,null))['catch'](handleError(_0x2a6fa0,null));};exports[_0x97a5('0x48')]=function(_0xc3c9e5,_0x7adad){return db['Cdr']['describe']()[_0x97a5('0x22')](respondWithResult(_0x7adad,null))[_0x97a5('0x46')](handleError(_0x7adad,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 6b5c418..526a101 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x400a3b,_0x5a5189){var _0x53426b=function(_0x113d6d){while(--_0x113d6d){_0x400a3b['push'](_0x400a3b['shift']());}};_0x53426b(++_0x5a5189);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3bbce0,_0x1a8d2c){var _0x40a716=function(_0x28c470){while(--_0x28c470){_0x3bbce0['push'](_0x3bbce0['shift']());}};_0x40a716(++_0x1a8d2c);}(_0x7a54,0x106));var _0x47a5=function(_0x26ac6e,_0xb38c5e){_0x26ac6e=_0x26ac6e-0x0;var _0x275731=_0x7a54[_0x26ac6e];return _0x275731;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 9f86bcb..88064a0 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 _0xd892=['request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s'];(function(_0x2f77d6,_0x815a1d){var _0x5bf9eb=function(_0xb05bb5){while(--_0xb05bb5){_0x2f77d6['push'](_0x2f77d6['shift']());}};_0x5bf9eb(++_0x815a1d);}(_0xd892,0x18f));var _0x2d89=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xd892[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x2d89('0x0'));var util=require(_0x2d89('0x1'));var moment=require(_0x2d89('0x2'));var BPromise=require(_0x2d89('0x3'));var rs=require(_0x2d89('0x4'));var fs=require('fs');var Redis=require(_0x2d89('0x5'));var db=require(_0x2d89('0x6'))['db'];var utils=require(_0x2d89('0x7'));var logger=require(_0x2d89('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2d89('0x9'));var client=jayson[_0x2d89('0xa')][_0x2d89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x363cb9,_0x370d2a,_0xa3365d){return new BPromise(function(_0x14332c,_0xd82516){return client[_0x2d89('0xc')](_0x363cb9,_0xa3365d)[_0x2d89('0xd')](function(_0x470a45){logger['info'](_0x2d89('0xe'),_0x370d2a,_0x2d89('0xf'));logger[_0x2d89('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x370d2a,'request\x20sent',JSON[_0x2d89('0x11')](_0x470a45));if(_0x470a45[_0x2d89('0x12')]){if(_0x470a45[_0x2d89('0x12')][_0x2d89('0x13')]===0x1f4){logger[_0x2d89('0x12')](_0x2d89('0xe'),_0x370d2a,_0x470a45[_0x2d89('0x12')][_0x2d89('0x14')]);return _0xd82516(_0x470a45[_0x2d89('0x12')]['message']);}logger[_0x2d89('0x12')](_0x2d89('0xe'),_0x370d2a,_0x470a45[_0x2d89('0x12')][_0x2d89('0x14')]);return _0x14332c(_0x470a45[_0x2d89('0x12')][_0x2d89('0x14')]);}else{logger[_0x2d89('0x15')](_0x2d89('0xe'),_0x370d2a,_0x2d89('0xf'));_0x14332c(_0x470a45['result'][_0x2d89('0x14')]);}})[_0x2d89('0x16')](function(_0x2f62e4){logger[_0x2d89('0x12')](_0x2d89('0xe'),_0x370d2a,_0x2f62e4);_0xd82516(_0x2f62e4);});});} \ No newline at end of file +var _0x3e55=['code','Cdr,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xd4fcd0,_0x10ed9c){var _0x841d2=function(_0x5e6054){while(--_0x5e6054){_0xd4fcd0['push'](_0xd4fcd0['shift']());}};_0x841d2(++_0x10ed9c);}(_0x3e55,0x9e));var _0x53e5=function(_0x333690,_0x33b5cb){_0x333690=_0x333690-0x0;var _0x33b681=_0x3e55[_0x333690];return _0x33b681;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x53e5('0x0'));var BPromise=require(_0x53e5('0x1'));var rs=require(_0x53e5('0x2'));var fs=require('fs');var Redis=require(_0x53e5('0x3'));var db=require(_0x53e5('0x4'))['db'];var utils=require(_0x53e5('0x5'));var logger=require('../../config/logger')(_0x53e5('0x6'));var config=require('../../config/environment');var jayson=require(_0x53e5('0x7'));var client=jayson[_0x53e5('0x8')][_0x53e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a1158,_0x44b561,_0x4479cd){return new BPromise(function(_0x5f33ad,_0x11fa2c){return client[_0x53e5('0xa')](_0x1a1158,_0x4479cd)[_0x53e5('0xb')](function(_0x195d2f){logger[_0x53e5('0xc')]('Cdr,\x20%s,\x20%s',_0x44b561,_0x53e5('0xd'));logger[_0x53e5('0xe')](_0x53e5('0xf'),_0x44b561,'request\x20sent',JSON[_0x53e5('0x10')](_0x195d2f));if(_0x195d2f[_0x53e5('0x11')]){if(_0x195d2f[_0x53e5('0x11')][_0x53e5('0x12')]===0x1f4){logger['error'](_0x53e5('0x13'),_0x44b561,_0x195d2f[_0x53e5('0x11')][_0x53e5('0x14')]);return _0x11fa2c(_0x195d2f['error'][_0x53e5('0x14')]);}logger[_0x53e5('0x11')](_0x53e5('0x13'),_0x44b561,_0x195d2f[_0x53e5('0x11')]['message']);return _0x5f33ad(_0x195d2f[_0x53e5('0x11')]['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x44b561,_0x53e5('0xd'));_0x5f33ad(_0x195d2f[_0x53e5('0x15')][_0x53e5('0x14')]);}})['catch'](function(_0x20393e){logger[_0x53e5('0x11')](_0x53e5('0x13'),_0x44b561,_0x20393e);_0x11fa2c(_0x20393e);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3dd46ec..0e8b163 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(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x39eaf1,_0x56f6b9){var _0x116705=function(_0x242c21){while(--_0x242c21){_0x39eaf1['push'](_0x39eaf1['shift']());}};_0x116705(++_0x56f6b9);}(_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 16ece3c..e844475 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 _0x9c76=['exports','noop','STRING','*,*,*,*','sequelize'];(function(_0x983327,_0x54bbf9){var _0x30e0c2=function(_0x22cedc){while(--_0x22cedc){_0x983327['push'](_0x983327['shift']());}};_0x30e0c2(++_0x54bbf9);}(_0x9c76,0x199));var _0x69c7=function(_0x1c73e8,_0x5349ec){_0x1c73e8=_0x1c73e8-0x0;var _0x5f2c5b=_0x9c76[_0x1c73e8];return _0x5f2c5b;};'use strict';var Sequelize=require(_0x69c7('0x0'));module[_0x69c7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x69c7('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x69c7('0x3')]},'interval':{'type':Sequelize[_0x69c7('0x3')],'defaultValue':_0x69c7('0x4')}}; \ No newline at end of file +var _0xdb9c=['TEXT','exports','STRING'];(function(_0x534027,_0x381ca3){var _0x2c8b53=function(_0x3f8343){while(--_0x3f8343){_0x534027['push'](_0x534027['shift']());}};_0x2c8b53(++_0x381ca3);}(_0xdb9c,0x1cf));var _0xcdb9=function(_0x21a897,_0xfde1f8){_0x21a897=_0x21a897-0x0;var _0x1d841c=_0xdb9c[_0x21a897];return _0x1d841c;};'use strict';var Sequelize=require('sequelize');module[_0xcdb9('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcdb9('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcdb9('0x2')]()},'description':{'type':Sequelize[_0xcdb9('0x1')]},'interval':{'type':Sequelize[_0xcdb9('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 8b682b7..e3cf006 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 _0xb077=['intersection','fields','length','include','merge','catch','body','find','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','offset','limit','apply','reject','save','update','destroy','then','status','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','attributes'];(function(_0x23e797,_0x1dc763){var _0xa5e856=function(_0x4578af){while(--_0x4578af){_0x23e797['push'](_0x23e797['shift']());}};_0xa5e856(++_0x1dc763);}(_0xb077,0x7a));var _0x7b07=function(_0x52551d,_0x9d47ba){_0x52551d=_0x52551d-0x0;var _0x5df61d=_0xb077[_0x52551d];return _0x5df61d;};'use strict';var emlformat=require(_0x7b07('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7b07('0x1'));var rp=require('request-promise');var moment=require(_0x7b07('0x2'));var BPromise=require(_0x7b07('0x3'));var Mustache=require(_0x7b07('0x4'));var util=require(_0x7b07('0x5'));var path=require(_0x7b07('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b07('0x7'));var fs=require('fs');var fs_extra=require(_0x7b07('0x8'));var _=require(_0x7b07('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b07('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7b07('0xb'));var querystring=require(_0x7b07('0xc'));var Papa=require(_0x7b07('0xd'));var Redis=require(_0x7b07('0xe'));var authService=require(_0x7b07('0xf'));var qs=require(_0x7b07('0x10'));var as=require(_0x7b07('0x11'));var hardwareService=require(_0x7b07('0x12'));var logger=require(_0x7b07('0x13'))('api');var utils=require(_0x7b07('0x14'));var config=require(_0x7b07('0x15'));var licenseUtil=require(_0x7b07('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe825c4,_0x3d73c6){_0x3d73c6=_0x3d73c6||0xcc;return function(_0x9f3404){if(_0x9f3404){return _0xe825c4[_0x7b07('0x17')](_0x3d73c6);}return _0xe825c4['status'](_0x3d73c6)[_0x7b07('0x18')]();};}function respondWithResult(_0x10fc29,_0x44cf4c){_0x44cf4c=_0x44cf4c||0xc8;return function(_0x5ded26){if(_0x5ded26){return _0x10fc29['status'](_0x44cf4c)[_0x7b07('0x19')](_0x5ded26);}};}function respondWithFilteredResult(_0x389f3c,_0x2acc2f){return function(_0x2f6e33){if(_0x2f6e33){var _0x4b7d85=typeof _0x2acc2f['offset']==='undefined'&&typeof _0x2acc2f['limit']===_0x7b07('0x1a');var _0x18311b=_0x2f6e33[_0x7b07('0x1b')];var _0x3aab02=_0x4b7d85?0x0:_0x2acc2f[_0x7b07('0x1c')];var _0x282b2f=_0x4b7d85?_0x2f6e33[_0x7b07('0x1b')]:_0x2acc2f[_0x7b07('0x1c')]+_0x2acc2f[_0x7b07('0x1d')];var _0x2d9278;if(_0x282b2f>=_0x18311b){_0x282b2f=_0x18311b;_0x2d9278=0xc8;}else{_0x2d9278=0xce;}_0x389f3c['status'](_0x2d9278);return _0x389f3c['set']('Content-Range',_0x3aab02+'-'+_0x282b2f+'/'+_0x18311b)[_0x7b07('0x19')](_0x2f6e33);}return null;};}function patchUpdates(_0x3d0f65){return function(_0x2e5e24){try{jsonpatch[_0x7b07('0x1e')](_0x2e5e24,_0x3d0f65,!![]);}catch(_0x2f97ab){return BPromise[_0x7b07('0x1f')](_0x2f97ab);}return _0x2e5e24[_0x7b07('0x20')]();};}function saveUpdates(_0x481812,_0xe41126){return function(_0x44e774){if(_0x44e774){return _0x44e774[_0x7b07('0x21')](_0x481812)['then'](function(_0xf43662){return _0xf43662;});}return null;};}function removeEntity(_0x5ed88d,_0x2b81cf){return function(_0x5e858d){if(_0x5e858d){return _0x5e858d[_0x7b07('0x22')]()[_0x7b07('0x23')](function(){_0x5ed88d[_0x7b07('0x24')](0xcc)[_0x7b07('0x18')]();});}};}function handleEntityNotFound(_0x572e32,_0x3a960c){return function(_0x54943d){if(!_0x54943d){_0x572e32[_0x7b07('0x17')](0x194);}return _0x54943d;};}function handleError(_0x343e21,_0x4ded23){_0x4ded23=_0x4ded23||0x1f4;return function(_0x447119){logger[_0x7b07('0x25')](_0x447119[_0x7b07('0x26')]);if(_0x447119[_0x7b07('0x27')]){delete _0x447119[_0x7b07('0x27')];}_0x343e21[_0x7b07('0x24')](_0x4ded23)[_0x7b07('0x28')](_0x447119);};}exports[_0x7b07('0x29')]=function(_0x4777cc,_0x232f70){var _0xcaeb2a={'raw':!![],'where':{'id':_0x4777cc[_0x7b07('0x2a')]['id']}},_0xa78d19={};_0xa78d19[_0x7b07('0x2b')]=_[_0x7b07('0x2c')](db[_0x7b07('0x2d')]['rawAttributes']);_0xa78d19['query']=_[_0x7b07('0x2c')](_0x4777cc[_0x7b07('0x2e')]);_0xa78d19[_0x7b07('0x2f')]=_['intersection'](_0xa78d19[_0x7b07('0x2b')],_0xa78d19[_0x7b07('0x2e')]);_0xcaeb2a[_0x7b07('0x30')]=_[_0x7b07('0x31')](_0xa78d19['model'],qs[_0x7b07('0x32')](_0x4777cc['query'][_0x7b07('0x32')]));_0xcaeb2a['attributes']=_0xcaeb2a[_0x7b07('0x30')][_0x7b07('0x33')]?_0xcaeb2a['attributes']:_0xa78d19['model'];if(_0x4777cc[_0x7b07('0x2e')]['includeAll']){_0xcaeb2a[_0x7b07('0x34')]=[{'all':!![]}];}_0xcaeb2a=_[_0x7b07('0x35')]({},_0xcaeb2a,_0x4777cc['options']);return db[_0x7b07('0x2d')]['find'](_0xcaeb2a)[_0x7b07('0x23')](handleEntityNotFound(_0x232f70,null))[_0x7b07('0x23')](respondWithResult(_0x232f70,null))[_0x7b07('0x36')](handleError(_0x232f70,null));};exports[_0x7b07('0x21')]=function(_0xcfc128,_0x19c41f){if(_0xcfc128[_0x7b07('0x37')]['id']){delete _0xcfc128[_0x7b07('0x37')]['id'];}return db[_0x7b07('0x2d')][_0x7b07('0x38')]({'where':{'id':_0xcfc128[_0x7b07('0x2a')]['id']}})[_0x7b07('0x23')](handleEntityNotFound(_0x19c41f,null))[_0x7b07('0x23')](saveUpdates(_0xcfc128[_0x7b07('0x37')],null))[_0x7b07('0x23')](respondWithResult(_0x19c41f,null))[_0x7b07('0x36')](handleError(_0x19c41f,null));};exports[_0x7b07('0x22')]=function(_0x409f8d,_0x46f5bd){return db[_0x7b07('0x2d')]['find']({'where':{'id':_0x409f8d[_0x7b07('0x2a')]['id']}})[_0x7b07('0x23')](handleEntityNotFound(_0x46f5bd,null))[_0x7b07('0x23')](removeEntity(_0x46f5bd,null))[_0x7b07('0x36')](handleError(_0x46f5bd,null));}; \ No newline at end of file +var _0x847d=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','name','send','show','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','merge','find','catch','body','params','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x210d00,_0x2a89a3){var _0x53db70=function(_0x5655d1){while(--_0x5655d1){_0x210d00['push'](_0x210d00['shift']());}};_0x53db70(++_0x2a89a3);}(_0x847d,0x14a));var _0xd847=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x847d[_0x466af7];return _0x348c96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd847('0x0'));var zipdir=require(_0xd847('0x1'));var jsonpatch=require(_0xd847('0x2'));var rp=require('request-promise');var moment=require(_0xd847('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd847('0x4'));var util=require(_0xd847('0x5'));var path=require('path');var sox=require(_0xd847('0x6'));var csv=require(_0xd847('0x7'));var ejs=require(_0xd847('0x8'));var fs=require('fs');var fs_extra=require(_0xd847('0x9'));var _=require('lodash');var squel=require(_0xd847('0xa'));var crypto=require(_0xd847('0xb'));var jsforce=require(_0xd847('0xc'));var deskjs=require(_0xd847('0xd'));var toCsv=require(_0xd847('0x7'));var querystring=require(_0xd847('0xe'));var Papa=require(_0xd847('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd847('0x10'));var logger=require(_0xd847('0x11'))(_0xd847('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd847('0x13'));var db=require(_0xd847('0x14'))['db'];function respondWithStatusCode(_0x344d39,_0x2ea8e7){_0x2ea8e7=_0x2ea8e7||0xcc;return function(_0x1e4e26){if(_0x1e4e26){return _0x344d39[_0xd847('0x15')](_0x2ea8e7);}return _0x344d39[_0xd847('0x16')](_0x2ea8e7)[_0xd847('0x17')]();};}function respondWithResult(_0x1c827a,_0x2faa39){_0x2faa39=_0x2faa39||0xc8;return function(_0x3c4805){if(_0x3c4805){return _0x1c827a['status'](_0x2faa39)[_0xd847('0x18')](_0x3c4805);}};}function respondWithFilteredResult(_0x165fbe,_0xd69fc9){return function(_0x404bdb){if(_0x404bdb){var _0x16c79a=typeof _0xd69fc9['offset']===_0xd847('0x19')&&typeof _0xd69fc9[_0xd847('0x1a')]===_0xd847('0x19');var _0x1a01ad=_0x404bdb['count'];var _0x1ef765=_0x16c79a?0x0:_0xd69fc9['offset'];var _0x4b6264=_0x16c79a?_0x404bdb[_0xd847('0x1b')]:_0xd69fc9[_0xd847('0x1c')]+_0xd69fc9[_0xd847('0x1a')];var _0x3905b8;if(_0x4b6264>=_0x1a01ad){_0x4b6264=_0x1a01ad;_0x3905b8=0xc8;}else{_0x3905b8=0xce;}_0x165fbe['status'](_0x3905b8);return _0x165fbe[_0xd847('0x1d')]('Content-Range',_0x1ef765+'-'+_0x4b6264+'/'+_0x1a01ad)['json'](_0x404bdb);}return null;};}function patchUpdates(_0x25e139){return function(_0x2c1091){try{jsonpatch[_0xd847('0x1e')](_0x2c1091,_0x25e139,!![]);}catch(_0x2a57df){return BPromise[_0xd847('0x1f')](_0x2a57df);}return _0x2c1091[_0xd847('0x20')]();};}function saveUpdates(_0x1490a1,_0x39c465){return function(_0x1eaf08){if(_0x1eaf08){return _0x1eaf08[_0xd847('0x21')](_0x1490a1)[_0xd847('0x22')](function(_0x3795fc){return _0x3795fc;});}return null;};}function removeEntity(_0x4a1691,_0x560563){return function(_0x26a787){if(_0x26a787){return _0x26a787[_0xd847('0x23')]()[_0xd847('0x22')](function(){_0x4a1691['status'](0xcc)[_0xd847('0x17')]();});}};}function handleEntityNotFound(_0x246920,_0x74bf0e){return function(_0x64b701){if(!_0x64b701){_0x246920[_0xd847('0x15')](0x194);}return _0x64b701;};}function handleError(_0x5b8e2a,_0x24793c){_0x24793c=_0x24793c||0x1f4;return function(_0x460eba){logger[_0xd847('0x24')](_0x460eba['stack']);if(_0x460eba[_0xd847('0x25')]){delete _0x460eba[_0xd847('0x25')];}_0x5b8e2a[_0xd847('0x16')](_0x24793c)[_0xd847('0x26')](_0x460eba);};}exports[_0xd847('0x27')]=function(_0x3301cd,_0x5c0099){var _0x1e6119={'raw':!![],'where':{'id':_0x3301cd['params']['id']}},_0x5375fe={};_0x5375fe['model']=_[_0xd847('0x28')](db[_0xd847('0x29')][_0xd847('0x2a')]);_0x5375fe[_0xd847('0x2b')]=_[_0xd847('0x28')](_0x3301cd[_0xd847('0x2b')]);_0x5375fe[_0xd847('0x2c')]=_[_0xd847('0x2d')](_0x5375fe[_0xd847('0x2e')],_0x5375fe[_0xd847('0x2b')]);_0x1e6119[_0xd847('0x2f')]=_[_0xd847('0x2d')](_0x5375fe['model'],qs['fields'](_0x3301cd[_0xd847('0x2b')][_0xd847('0x30')]));_0x1e6119[_0xd847('0x2f')]=_0x1e6119[_0xd847('0x2f')][_0xd847('0x31')]?_0x1e6119['attributes']:_0x5375fe[_0xd847('0x2e')];if(_0x3301cd['query'][_0xd847('0x32')]){_0x1e6119['include']=[{'all':!![]}];}_0x1e6119=_[_0xd847('0x33')]({},_0x1e6119,_0x3301cd['options']);return db[_0xd847('0x29')][_0xd847('0x34')](_0x1e6119)['then'](handleEntityNotFound(_0x5c0099,null))['then'](respondWithResult(_0x5c0099,null))[_0xd847('0x35')](handleError(_0x5c0099,null));};exports[_0xd847('0x21')]=function(_0x429bb5,_0x2d2c94){if(_0x429bb5[_0xd847('0x36')]['id']){delete _0x429bb5[_0xd847('0x36')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x429bb5[_0xd847('0x37')]['id']}})[_0xd847('0x22')](handleEntityNotFound(_0x2d2c94,null))[_0xd847('0x22')](saveUpdates(_0x429bb5['body'],null))[_0xd847('0x22')](respondWithResult(_0x2d2c94,null))[_0xd847('0x35')](handleError(_0x2d2c94,null));};exports['destroy']=function(_0x547794,_0x3e5590){return db['ChatApplication'][_0xd847('0x34')]({'where':{'id':_0x547794[_0xd847('0x37')]['id']}})[_0xd847('0x22')](handleEntityNotFound(_0x3e5590,null))['then'](removeEntity(_0x3e5590,null))['catch'](handleError(_0x3e5590,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 791e586..39a8224 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 _0xaffb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x57169f,_0x2695f6){var _0xb9279=function(_0x4a4e32){while(--_0x4a4e32){_0x57169f['push'](_0x57169f['shift']());}};_0xb9279(++_0x2695f6);}(_0xaffb,0x85));var _0xbaff=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0xaffb[_0x5401ae];return _0x286068;};'use strict';var _=require(_0xbaff('0x0'));var util=require(_0xbaff('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbaff('0x2'));var BPromise=require(_0xbaff('0x3'));var rp=require(_0xbaff('0x4'));var fs=require('fs');var path=require(_0xbaff('0x5'));var rimraf=require(_0xbaff('0x6'));var config=require(_0xbaff('0x7'));var attributes=require(_0xbaff('0x8'));module[_0xbaff('0x9')]=function(_0x2e7034,_0xd86e22){return _0x2e7034[_0xbaff('0xa')](_0xbaff('0xb'),attributes,{'tableName':_0xbaff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbaff('0xd'),'collate':_0xbaff('0xe')});}; \ No newline at end of file +var _0x3423=['exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x431640,_0x1bd49a){var _0xd9dd62=function(_0x418069){while(--_0x418069){_0x431640['push'](_0x431640['shift']());}};_0xd9dd62(++_0x1bd49a);}(_0x3423,0x1f0));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var logger=require('../../config/logger')(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require('./chatApplication.attributes');module[_0x3342('0x8')]=function(_0x43d55b,_0x3a56ff){return _0x43d55b[_0x3342('0x9')](_0x3342('0xa'),attributes,{'tableName':_0x3342('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3342('0xc'),'collate':_0x3342('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 9b7cf35..03a140b 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 _0x3864=['error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x13d153,_0x3edda1){var _0x508a08=function(_0x465db7){while(--_0x465db7){_0x13d153['push'](_0x13d153['shift']());}};_0x508a08(++_0x3edda1);}(_0x3864,0x124));var _0x4386=function(_0x3515e4,_0x1b3681){_0x3515e4=_0x3515e4-0x0;var _0x5ce445=_0x3864[_0x3515e4];return _0x5ce445;};'use strict';var _=require(_0x4386('0x0'));var util=require(_0x4386('0x1'));var moment=require(_0x4386('0x2'));var BPromise=require('bluebird');var rs=require(_0x4386('0x3'));var fs=require('fs');var Redis=require(_0x4386('0x4'));var db=require(_0x4386('0x5'))['db'];var utils=require(_0x4386('0x6'));var logger=require('../../config/logger')(_0x4386('0x7'));var config=require(_0x4386('0x8'));var jayson=require(_0x4386('0x9'));var client=jayson['client'][_0x4386('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x749358,_0x4ee23b,_0x4cd0db){return new BPromise(function(_0x115fde,_0x33b78f){return client[_0x4386('0xb')](_0x749358,_0x4cd0db)[_0x4386('0xc')](function(_0x1b6c79){logger[_0x4386('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4ee23b,_0x4386('0xe'));logger[_0x4386('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4ee23b,'request\x20sent',JSON['stringify'](_0x1b6c79));if(_0x1b6c79['error']){if(_0x1b6c79[_0x4386('0x10')][_0x4386('0x11')]===0x1f4){logger[_0x4386('0x10')](_0x4386('0x12'),_0x4ee23b,_0x1b6c79[_0x4386('0x10')][_0x4386('0x13')]);return _0x33b78f(_0x1b6c79[_0x4386('0x10')][_0x4386('0x13')]);}logger[_0x4386('0x10')](_0x4386('0x12'),_0x4ee23b,_0x1b6c79[_0x4386('0x10')]['message']);return _0x115fde(_0x1b6c79[_0x4386('0x10')]['message']);}else{logger[_0x4386('0xd')](_0x4386('0x12'),_0x4ee23b,'request\x20sent');_0x115fde(_0x1b6c79[_0x4386('0x14')]['message']);}})[_0x4386('0x15')](function(_0x5c5ff7){logger['error'](_0x4386('0x12'),_0x4ee23b,_0x5c5ff7);_0x33b78f(_0x5c5ff7);});});} \ No newline at end of file +var _0x21e5=['http','request','then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','randomstring','ioredis','rpc','client'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x21e5,0x172));var _0x521e=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x21e5[_0x11155f];return _0xd07e48;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x521e('0x0'));var fs=require('fs');var Redis=require(_0x521e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x521e('0x2'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x521e('0x3')][_0x521e('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x469924,_0x79be67,_0x5da1a7){return new BPromise(function(_0x465446,_0x47e015){return client[_0x521e('0x5')](_0x469924,_0x5da1a7)[_0x521e('0x6')](function(_0x3d8726){logger[_0x521e('0x7')]('ChatApplication,\x20%s,\x20%s',_0x79be67,'request\x20sent');logger[_0x521e('0x8')](_0x521e('0x9'),_0x79be67,_0x521e('0xa'),JSON['stringify'](_0x3d8726));if(_0x3d8726[_0x521e('0xb')]){if(_0x3d8726[_0x521e('0xb')][_0x521e('0xc')]===0x1f4){logger[_0x521e('0xb')](_0x521e('0xd'),_0x79be67,_0x3d8726['error'][_0x521e('0xe')]);return _0x47e015(_0x3d8726['error'][_0x521e('0xe')]);}logger[_0x521e('0xb')](_0x521e('0xd'),_0x79be67,_0x3d8726[_0x521e('0xb')][_0x521e('0xe')]);return _0x465446(_0x3d8726[_0x521e('0xb')][_0x521e('0xe')]);}else{logger['info'](_0x521e('0xd'),_0x79be67,_0x521e('0xa'));_0x465446(_0x3d8726[_0x521e('0xf')][_0x521e('0xe')]);}})[_0x521e('0x10')](function(_0x4fb816){logger['error'](_0x521e('0xd'),_0x79be67,_0x4fb816);_0x47e015(_0x4fb816);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0673885..baa34ba 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 _0x3acd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','put','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0xaf2f45,_0x23d92a){var _0xa228b8=function(_0x390d4f){while(--_0x390d4f){_0xaf2f45['push'](_0xaf2f45['shift']());}};_0xa228b8(++_0x23d92a);}(_0x3acd,0x14e));var _0xd3ac=function(_0x255a7f,_0x107d6e){_0x255a7f=_0x255a7f-0x0;var _0x57e195=_0x3acd[_0x255a7f];return _0x57e195;};'use strict';var multer=require(_0xd3ac('0x0'));var util=require(_0xd3ac('0x1'));var path=require(_0xd3ac('0x2'));var timeout=require(_0xd3ac('0x3'));var express=require(_0xd3ac('0x4'));var router=express['Router']();var fs_extra=require(_0xd3ac('0x5'));var auth=require(_0xd3ac('0x6'));var interaction=require(_0xd3ac('0x7'));var config=require(_0xd3ac('0x8'));var controller=require(_0xd3ac('0x9'));router[_0xd3ac('0xa')](_0xd3ac('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd3ac('0xc')]('/:id',auth[_0xd3ac('0xd')](),controller[_0xd3ac('0xe')]);router[_0xd3ac('0xf')](_0xd3ac('0xb'),auth[_0xd3ac('0xd')](),controller['destroy']);module[_0xd3ac('0x10')]=router; \ No newline at end of file +var _0x568d=['../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x246419,_0x554ea8){var _0x5c54c6=function(_0xc723fc){while(--_0xc723fc){_0x246419['push'](_0x246419['shift']());}};_0x5c54c6(++_0x554ea8);}(_0x568d,0xf9));var _0xd568=function(_0x7a35b1,_0x925417){_0x7a35b1=_0x7a35b1-0x0;var _0x3c4535=_0x568d[_0x7a35b1];return _0x3c4535;};'use strict';var multer=require(_0xd568('0x0'));var util=require(_0xd568('0x1'));var path=require(_0xd568('0x2'));var timeout=require('connect-timeout');var express=require(_0xd568('0x3'));var router=express[_0xd568('0x4')]();var fs_extra=require(_0xd568('0x5'));var auth=require(_0xd568('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd568('0x7'));var controller=require(_0xd568('0x8'));router[_0xd568('0x9')](_0xd568('0xa'),auth[_0xd568('0xb')](),controller[_0xd568('0xc')]);router[_0xd568('0xd')](_0xd568('0xa'),auth[_0xd568('0xb')](),controller['update']);router[_0xd568('0xe')](_0xd568('0xa'),auth[_0xd568('0xb')](),controller[_0xd568('0xf')]);module[_0xd568('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 69664c1..7a2eed1 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 _0x1dbb=['BOOLEAN','sequelize','exports','STRING'];(function(_0x43dbd8,_0x4f70e6){var _0x4dac4d=function(_0x213056){while(--_0x213056){_0x43dbd8['push'](_0x43dbd8['shift']());}};_0x4dac4d(++_0x4f70e6);}(_0x1dbb,0xed));var _0xb1db=function(_0x317554,_0x53e29f){_0x317554=_0x317554-0x0;var _0x4db3d6=_0x1dbb[_0x317554];return _0x4db3d6;};'use strict';var Sequelize=require(_0xb1db('0x0'));module[_0xb1db('0x1')]={'name':{'type':Sequelize[_0xb1db('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb1db('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4df9=['exports','BOOLEAN'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0x4df9,0x19a));var _0x94df=function(_0x1654ec,_0x584374){_0x1654ec=_0x1654ec-0x0;var _0x329fbf=_0x4df9[_0x1654ec];return _0x329fbf;};'use strict';var Sequelize=require('sequelize');module[_0x94df('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x94df('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 e714363..de02b90 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 _0x0ca0=['include','findAll','show','params','rawAttributes','options','find','create','body','destroy','describe','catch','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','ChatGroup','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ca0,0x142));var _0x00ca=function(_0x2c48f3,_0x58ec6c){_0x2c48f3=_0x2c48f3-0x0;var _0x234a62=_0x0ca0[_0x2c48f3];return _0x234a62;};'use strict';var emlformat=require(_0x00ca('0x0'));var rimraf=require(_0x00ca('0x1'));var zipdir=require(_0x00ca('0x2'));var jsonpatch=require(_0x00ca('0x3'));var rp=require(_0x00ca('0x4'));var moment=require(_0x00ca('0x5'));var BPromise=require(_0x00ca('0x6'));var Mustache=require('mustache');var util=require(_0x00ca('0x7'));var path=require(_0x00ca('0x8'));var sox=require(_0x00ca('0x9'));var csv=require(_0x00ca('0xa'));var ejs=require(_0x00ca('0xb'));var fs=require('fs');var fs_extra=require(_0x00ca('0xc'));var _=require(_0x00ca('0xd'));var squel=require('squel');var crypto=require(_0x00ca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x00ca('0xf'));var toCsv=require(_0x00ca('0xa'));var querystring=require('querystring');var Papa=require(_0x00ca('0x10'));var Redis=require(_0x00ca('0x11'));var authService=require(_0x00ca('0x12'));var qs=require(_0x00ca('0x13'));var as=require(_0x00ca('0x14'));var hardwareService=require(_0x00ca('0x15'));var logger=require(_0x00ca('0x16'))(_0x00ca('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x00ca('0x18'));var db=require('../../mysqldb')['db'];config[_0x00ca('0x19')]=_[_0x00ca('0x1a')](config[_0x00ca('0x19')],{'host':_0x00ca('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x00ca('0x19')]));require(_0x00ca('0x1c'))[_0x00ca('0x1d')](socket);function respondWithStatusCode(_0x599f36,_0x2c2841){_0x2c2841=_0x2c2841||0xcc;return function(_0x498762){if(_0x498762){return _0x599f36[_0x00ca('0x1e')](_0x2c2841);}return _0x599f36[_0x00ca('0x1f')](_0x2c2841)[_0x00ca('0x20')]();};}function respondWithResult(_0x568e98,_0x314898){_0x314898=_0x314898||0xc8;return function(_0x4916d2){if(_0x4916d2){return _0x568e98[_0x00ca('0x1f')](_0x314898)[_0x00ca('0x21')](_0x4916d2);}};}function respondWithFilteredResult(_0x55c9cf,_0x7752c8){return function(_0x3849e5){if(_0x3849e5){var _0x1b61ae=typeof _0x7752c8[_0x00ca('0x22')]===_0x00ca('0x23')&&typeof _0x7752c8['limit']===_0x00ca('0x23');var _0x4cc0a9=_0x3849e5[_0x00ca('0x24')];var _0x44ce38=_0x1b61ae?0x0:_0x7752c8[_0x00ca('0x22')];var _0x52c013=_0x1b61ae?_0x3849e5[_0x00ca('0x24')]:_0x7752c8['offset']+_0x7752c8[_0x00ca('0x25')];var _0x10619b;if(_0x52c013>=_0x4cc0a9){_0x52c013=_0x4cc0a9;_0x10619b=0xc8;}else{_0x10619b=0xce;}_0x55c9cf[_0x00ca('0x1f')](_0x10619b);return _0x55c9cf['set'](_0x00ca('0x26'),_0x44ce38+'-'+_0x52c013+'/'+_0x4cc0a9)['json'](_0x3849e5);}return null;};}function patchUpdates(_0x4ae11f){return function(_0x197713){try{jsonpatch[_0x00ca('0x27')](_0x197713,_0x4ae11f,!![]);}catch(_0x1a6d08){return BPromise[_0x00ca('0x28')](_0x1a6d08);}return _0x197713['save']();};}function saveUpdates(_0x1111b5,_0x245176){return function(_0x33cea2){if(_0x33cea2){return _0x33cea2[_0x00ca('0x29')](_0x1111b5)['then'](function(_0x1c1188){return _0x1c1188;});}return null;};}function removeEntity(_0x51ec44,_0x32c023){return function(_0xd1939b){if(_0xd1939b){return _0xd1939b['destroy']()[_0x00ca('0x2a')](function(){_0x51ec44['status'](0xcc)[_0x00ca('0x20')]();});}};}function handleEntityNotFound(_0x20be1f,_0x3d89c1){return function(_0x4bb609){if(!_0x4bb609){_0x20be1f['sendStatus'](0x194);}return _0x4bb609;};}function handleError(_0x1d66d4,_0xe45610){_0xe45610=_0xe45610||0x1f4;return function(_0x187c61){logger[_0x00ca('0x2b')](_0x187c61[_0x00ca('0x2c')]);if(_0x187c61['name']){delete _0x187c61[_0x00ca('0x2d')];}_0x1d66d4['status'](_0xe45610)[_0x00ca('0x2e')](_0x187c61);};}exports[_0x00ca('0x2f')]=function(_0x4decf3,_0x518f0c){var _0x5391b1={},_0xf31194={},_0x33c461={'count':0x0,'rows':[]};var _0x102dec=_['map'](db['ChatGroup']['rawAttributes'],function(_0x226bac){return{'name':_0x226bac[_0x00ca('0x30')],'type':_0x226bac[_0x00ca('0x31')]['key']};});_0xf31194[_0x00ca('0x32')]=_[_0x00ca('0x33')](_0x102dec,_0x00ca('0x2d'));_0xf31194['query']=_[_0x00ca('0x34')](_0x4decf3[_0x00ca('0x35')]);_0xf31194[_0x00ca('0x36')]=_[_0x00ca('0x37')](_0xf31194[_0x00ca('0x32')],_0xf31194[_0x00ca('0x35')]);_0x5391b1['attributes']=_[_0x00ca('0x37')](_0xf31194[_0x00ca('0x32')],qs[_0x00ca('0x38')](_0x4decf3[_0x00ca('0x35')][_0x00ca('0x38')]));_0x5391b1[_0x00ca('0x39')]=_0x5391b1[_0x00ca('0x39')][_0x00ca('0x3a')]?_0x5391b1[_0x00ca('0x39')]:_0xf31194[_0x00ca('0x32')];if(!_0x4decf3[_0x00ca('0x35')][_0x00ca('0x3b')](_0x00ca('0x3c'))){_0x5391b1['limit']=qs[_0x00ca('0x25')](_0x4decf3[_0x00ca('0x35')][_0x00ca('0x25')]);_0x5391b1[_0x00ca('0x22')]=qs[_0x00ca('0x22')](_0x4decf3[_0x00ca('0x35')][_0x00ca('0x22')]);}_0x5391b1[_0x00ca('0x3d')]=qs[_0x00ca('0x3e')](_0x4decf3['query'][_0x00ca('0x3e')]);_0x5391b1[_0x00ca('0x3f')]=qs[_0x00ca('0x36')](_[_0x00ca('0x40')](_0x4decf3['query'],_0xf31194[_0x00ca('0x36')]),_0x102dec);if(_0x4decf3[_0x00ca('0x35')][_0x00ca('0x41')]){_0x5391b1[_0x00ca('0x3f')]=_['merge'](_0x5391b1['where'],{'$or':_['map'](_0x102dec,function(_0x45ff7e){if(_0x45ff7e[_0x00ca('0x31')]!==_0x00ca('0x42')){var _0xd7b2e2={};_0xd7b2e2[_0x45ff7e[_0x00ca('0x2d')]]={'$like':'%'+_0x4decf3[_0x00ca('0x35')][_0x00ca('0x41')]+'%'};return _0xd7b2e2;}})});}_0x5391b1=_[_0x00ca('0x43')]({},_0x5391b1,_0x4decf3['options']);var _0x5c090a={'where':_0x5391b1[_0x00ca('0x3f')]};return db[_0x00ca('0x44')][_0x00ca('0x24')](_0x5c090a)[_0x00ca('0x2a')](function(_0x7c901){_0x33c461[_0x00ca('0x24')]=_0x7c901;if(_0x4decf3[_0x00ca('0x35')][_0x00ca('0x45')]){_0x5391b1[_0x00ca('0x46')]=[{'all':!![]}];}return db[_0x00ca('0x44')][_0x00ca('0x47')](_0x5391b1);})[_0x00ca('0x2a')](function(_0x1193b4){_0x33c461['rows']=_0x1193b4;return _0x33c461;})[_0x00ca('0x2a')](respondWithFilteredResult(_0x518f0c,_0x5391b1))['catch'](handleError(_0x518f0c,null));};exports[_0x00ca('0x48')]=function(_0x360315,_0x5d58b5){var _0x37a040={'raw':!![],'where':{'id':_0x360315[_0x00ca('0x49')]['id']}},_0x47ca7c={};_0x47ca7c[_0x00ca('0x32')]=_[_0x00ca('0x34')](db['ChatGroup'][_0x00ca('0x4a')]);_0x47ca7c[_0x00ca('0x35')]=_[_0x00ca('0x34')](_0x360315[_0x00ca('0x35')]);_0x47ca7c[_0x00ca('0x36')]=_[_0x00ca('0x37')](_0x47ca7c['model'],_0x47ca7c[_0x00ca('0x35')]);_0x37a040['attributes']=_['intersection'](_0x47ca7c[_0x00ca('0x32')],qs[_0x00ca('0x38')](_0x360315[_0x00ca('0x35')][_0x00ca('0x38')]));_0x37a040[_0x00ca('0x39')]=_0x37a040[_0x00ca('0x39')][_0x00ca('0x3a')]?_0x37a040[_0x00ca('0x39')]:_0x47ca7c[_0x00ca('0x32')];if(_0x360315[_0x00ca('0x35')]['includeAll']){_0x37a040['include']=[{'all':!![]}];}_0x37a040=_[_0x00ca('0x43')]({},_0x37a040,_0x360315[_0x00ca('0x4b')]);return db['ChatGroup'][_0x00ca('0x4c')](_0x37a040)[_0x00ca('0x2a')](handleEntityNotFound(_0x5d58b5,null))[_0x00ca('0x2a')](respondWithResult(_0x5d58b5,null))['catch'](handleError(_0x5d58b5,null));};exports[_0x00ca('0x4d')]=function(_0xabe623,_0x1d5af1){return db[_0x00ca('0x44')][_0x00ca('0x4d')](_0xabe623[_0x00ca('0x4e')],{})[_0x00ca('0x2a')](respondWithResult(_0x1d5af1,0xc9))['catch'](handleError(_0x1d5af1,null));};exports[_0x00ca('0x29')]=function(_0x327423,_0x276d98){if(_0x327423[_0x00ca('0x4e')]['id']){delete _0x327423['body']['id'];}return db[_0x00ca('0x44')]['find']({'where':{'id':_0x327423[_0x00ca('0x49')]['id']}})[_0x00ca('0x2a')](handleEntityNotFound(_0x276d98,null))[_0x00ca('0x2a')](saveUpdates(_0x327423['body'],null))[_0x00ca('0x2a')](respondWithResult(_0x276d98,null))['catch'](handleError(_0x276d98,null));};exports[_0x00ca('0x4f')]=function(_0x2f221a,_0x144949){return db[_0x00ca('0x44')][_0x00ca('0x4c')]({'where':{'id':_0x2f221a[_0x00ca('0x49')]['id']}})[_0x00ca('0x2a')](handleEntityNotFound(_0x144949,null))[_0x00ca('0x2a')](removeEntity(_0x144949,null))['catch'](handleError(_0x144949,null));};exports[_0x00ca('0x50')]=function(_0x5252e5,_0x3f82c3){return db[_0x00ca('0x44')][_0x00ca('0x50')]()[_0x00ca('0x2a')](respondWithResult(_0x3f82c3,null))[_0x00ca('0x51')](handleError(_0x3f82c3,null));};exports[_0x00ca('0x52')]=function(_0x3ebb0c,_0x362b8c,_0x3c15d3){return db[_0x00ca('0x53')][_0x00ca('0x24')]({'where':{'ChatGroupId':_0x3ebb0c[_0x00ca('0x49')]['id'],'ToId':_0x3ebb0c[_0x00ca('0x54')]['id'],'read':![]}})['then'](function(_0x2c0095){return{'id':_[_0x00ca('0x55')](_0x3ebb0c[_0x00ca('0x49')]['id']),'count':_0x2c0095};})[_0x00ca('0x2a')](respondWithResult(_0x362b8c,null))[_0x00ca('0x51')](handleError(_0x362b8c,null));};exports[_0x00ca('0x56')]=function(_0x54f5fe,_0x6071dc,_0x34ab37){return db[_0x00ca('0x44')][_0x00ca('0x4c')]({'where':{'id':_0x54f5fe['params']['id']}})[_0x00ca('0x2a')](handleEntityNotFound(_0x6071dc,null))[_0x00ca('0x2a')](function(_0x19aa69){if(_0x19aa69){return _0x19aa69['addMembers'](_0x54f5fe['body'][_0x00ca('0x57')],_[_0x00ca('0x58')](_0x54f5fe[_0x00ca('0x4e')],[_0x00ca('0x57'),'id'])||{});}})[_0x00ca('0x2a')](respondWithResult(_0x6071dc,null))[_0x00ca('0x51')](handleError(_0x6071dc,null));};exports[_0x00ca('0x59')]=function(_0x4e190f,_0x2bb36a,_0x585e0a){var _0x36302d={};var _0x643c24={};var _0x4f58c1;var _0x24e054;return db[_0x00ca('0x44')]['findOne']({'where':{'id':_0x4e190f[_0x00ca('0x49')]['id']}})[_0x00ca('0x2a')](handleEntityNotFound(_0x2bb36a,null))[_0x00ca('0x2a')](function(_0x238038){if(_0x238038){_0x4f58c1=_0x238038;_0x643c24[_0x00ca('0x32')]=_['keys'](db['User'][_0x00ca('0x4a')]);_0x643c24[_0x00ca('0x35')]=_['keys'](_0x4e190f[_0x00ca('0x35')]);_0x643c24[_0x00ca('0x36')]=_['intersection'](_0x643c24[_0x00ca('0x32')],_0x643c24[_0x00ca('0x35')]);_0x36302d[_0x00ca('0x39')]=_['intersection'](_0x643c24[_0x00ca('0x32')],qs[_0x00ca('0x38')](_0x4e190f[_0x00ca('0x35')][_0x00ca('0x38')]));_0x36302d[_0x00ca('0x39')]=_0x36302d['attributes']['length']?_0x36302d[_0x00ca('0x39')]:_0x643c24[_0x00ca('0x32')];_0x36302d[_0x00ca('0x3d')]=qs[_0x00ca('0x3e')](_0x4e190f[_0x00ca('0x35')][_0x00ca('0x3e')]);_0x36302d[_0x00ca('0x3f')]=qs[_0x00ca('0x36')](_[_0x00ca('0x40')](_0x4e190f[_0x00ca('0x35')],_0x643c24[_0x00ca('0x36')]));if(_0x4e190f[_0x00ca('0x35')][_0x00ca('0x41')]){_0x36302d['where']=_[_0x00ca('0x43')](_0x36302d[_0x00ca('0x3f')],{'$or':_['map'](_0x36302d[_0x00ca('0x39')],function(_0x305d7b){var _0x306ce8={};_0x306ce8[_0x305d7b]={'$like':'%'+_0x4e190f[_0x00ca('0x35')][_0x00ca('0x41')]+'%'};return _0x306ce8;})});}_0x36302d=_[_0x00ca('0x43')]({},_0x36302d,_0x4e190f[_0x00ca('0x4b')]);return _0x4f58c1[_0x00ca('0x59')](_0x36302d);}})['then'](function(_0x413e3f){if(_0x413e3f){_0x24e054=_0x413e3f['length'];if(!_0x4e190f[_0x00ca('0x35')][_0x00ca('0x3b')](_0x00ca('0x3c'))){_0x36302d['limit']=qs[_0x00ca('0x25')](_0x4e190f[_0x00ca('0x35')][_0x00ca('0x25')]);_0x36302d[_0x00ca('0x22')]=qs[_0x00ca('0x22')](_0x4e190f[_0x00ca('0x35')][_0x00ca('0x22')]);}return _0x4f58c1['getMembers'](_0x36302d);}})[_0x00ca('0x2a')](function(_0x1008f2){if(_0x1008f2){return _0x1008f2?{'count':_0x24e054,'rows':_0x1008f2}:null;}})[_0x00ca('0x2a')](respondWithResult(_0x2bb36a,null))[_0x00ca('0x51')](handleError(_0x2bb36a,null));};exports['removeMembers']=function(_0x297d5e,_0x114e38,_0x41b315){return db[_0x00ca('0x44')]['find']({'where':{'id':_0x297d5e[_0x00ca('0x49')]['id']}})[_0x00ca('0x2a')](handleEntityNotFound(_0x114e38,null))['then'](function(_0x22b3b3){if(_0x22b3b3){return _0x22b3b3[_0x00ca('0x5a')](_0x297d5e[_0x00ca('0x35')][_0x00ca('0x57')]);}})['then'](respondWithStatusCode(_0x114e38,null))[_0x00ca('0x51')](handleError(_0x114e38,null));};exports[_0x00ca('0x5b')]=function(_0x356544,_0x353a66,_0x41441a){if(_0x356544[_0x00ca('0x4e')]['id']){delete _0x356544['body']['id'];}return db[_0x00ca('0x44')]['find']({'where':{'id':_0x356544[_0x00ca('0x49')]['id']}})[_0x00ca('0x2a')](handleEntityNotFound(_0x353a66,null))['then'](function(_0x43e895){if(_0x43e895){_0x356544['body'][_0x00ca('0x5c')]=_0x43e895['id'];return db[_0x00ca('0x53')]['create'](_0x356544['body']);}})[_0x00ca('0x2a')](respondWithResult(_0x353a66,null))[_0x00ca('0x51')](handleError(_0x353a66,null));};exports[_0x00ca('0x5d')]=function(_0x4e3018,_0x47c260,_0x168648){var _0xe3b893={};var _0x37340a={};var _0x4c4397;var _0x4c4a94;return db[_0x00ca('0x44')][_0x00ca('0x5e')]({'where':{'id':_0x4e3018[_0x00ca('0x49')]['id']}})[_0x00ca('0x2a')](handleEntityNotFound(_0x47c260,null))[_0x00ca('0x2a')](function(_0x3ce5d7){if(_0x3ce5d7){_0x4c4397=_0x3ce5d7;_0x37340a[_0x00ca('0x32')]=_['keys'](db['ChatInternalMessage'][_0x00ca('0x4a')]);_0x37340a['query']=_[_0x00ca('0x34')](_0x4e3018['query']);_0x37340a['filters']=_[_0x00ca('0x37')](_0x37340a[_0x00ca('0x32')],_0x37340a[_0x00ca('0x35')]);_0xe3b893[_0x00ca('0x39')]=_['intersection'](_0x37340a['model'],qs[_0x00ca('0x38')](_0x4e3018[_0x00ca('0x35')][_0x00ca('0x38')]));_0xe3b893[_0x00ca('0x39')]=_0xe3b893[_0x00ca('0x39')][_0x00ca('0x3a')]?_0xe3b893[_0x00ca('0x39')]:_0x37340a[_0x00ca('0x32')];_0xe3b893[_0x00ca('0x3d')]=qs['sort'](_0x4e3018[_0x00ca('0x35')][_0x00ca('0x3e')]);_0xe3b893[_0x00ca('0x3f')]=qs[_0x00ca('0x36')](_[_0x00ca('0x40')](_0x4e3018[_0x00ca('0x35')],_0x37340a[_0x00ca('0x36')]));if(_0x4e3018[_0x00ca('0x35')]['filter']){_0xe3b893[_0x00ca('0x3f')]=_['merge'](_0xe3b893[_0x00ca('0x3f')],{'$or':_[_0x00ca('0x33')](_0xe3b893[_0x00ca('0x39')],function(_0x44c401){var _0x191fe3={};_0x191fe3[_0x44c401]={'$like':'%'+_0x4e3018['query']['filter']+'%'};return _0x191fe3;})});}if(_0x4e3018['query'][_0x00ca('0x5f')]){var _0xa169f6=_0x4e3018[_0x00ca('0x35')][_0x00ca('0x5f')]['split'](',');var _0x534df9={};_0x534df9[_0xa169f6[0x0]]={'$gte':moment(_0xa169f6[0x1])[_0x00ca('0x60')](_0x00ca('0x61'))};_0xe3b893[_0x00ca('0x3f')]=_[_0x00ca('0x43')](_0xe3b893[_0x00ca('0x3f')],_0x534df9);}_0xe3b893=_[_0x00ca('0x43')]({},_0xe3b893,_0x4e3018[_0x00ca('0x4b')]);return _0x4c4397[_0x00ca('0x5d')](_0xe3b893);}})[_0x00ca('0x2a')](function(_0xcebd8){if(_0xcebd8){_0x4c4a94=_0xcebd8[_0x00ca('0x3a')];if(!_0x4e3018[_0x00ca('0x35')][_0x00ca('0x3b')](_0x00ca('0x3c'))){_0xe3b893[_0x00ca('0x25')]=qs[_0x00ca('0x25')](_0x4e3018['query']['limit']);_0xe3b893[_0x00ca('0x22')]=qs['offset'](_0x4e3018[_0x00ca('0x35')][_0x00ca('0x22')]);}return _0x4c4397[_0x00ca('0x5d')](_0xe3b893);}})[_0x00ca('0x2a')](function(_0x175caf){if(_0x175caf){return _0x175caf?{'count':_0x4c4a94,'rows':_0x175caf}:null;}})['then'](respondWithResult(_0x47c260,null))['catch'](handleError(_0x47c260,null));}; \ No newline at end of file +var _0xed08=['find','create','body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','removeMembers','getMessages','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xed08,0x7a));var _0x8ed0=function(_0x54e29a,_0x1c9650){_0x54e29a=_0x54e29a-0x0;var _0x49bda7=_0xed08[_0x54e29a];return _0x49bda7;};'use strict';var emlformat=require(_0x8ed0('0x0'));var rimraf=require(_0x8ed0('0x1'));var zipdir=require(_0x8ed0('0x2'));var jsonpatch=require(_0x8ed0('0x3'));var rp=require('request-promise');var moment=require(_0x8ed0('0x4'));var BPromise=require(_0x8ed0('0x5'));var Mustache=require('mustache');var util=require(_0x8ed0('0x6'));var path=require('path');var sox=require(_0x8ed0('0x7'));var csv=require(_0x8ed0('0x8'));var ejs=require(_0x8ed0('0x9'));var fs=require('fs');var fs_extra=require(_0x8ed0('0xa'));var _=require('lodash');var squel=require(_0x8ed0('0xb'));var crypto=require('crypto');var jsforce=require(_0x8ed0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ed0('0xd'));var Papa=require(_0x8ed0('0xe'));var Redis=require(_0x8ed0('0xf'));var authService=require(_0x8ed0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8ed0('0x11'));var hardwareService=require(_0x8ed0('0x12'));var logger=require(_0x8ed0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8ed0('0x14'));var licenseUtil=require(_0x8ed0('0x15'));var db=require(_0x8ed0('0x16'))['db'];config[_0x8ed0('0x17')]=_[_0x8ed0('0x18')](config['redis'],{'host':_0x8ed0('0x19'),'port':0x18eb});var socket=require(_0x8ed0('0x1a'))(new Redis(config[_0x8ed0('0x17')]));require(_0x8ed0('0x1b'))['register'](socket);function respondWithStatusCode(_0x1aa3ac,_0x51e341){_0x51e341=_0x51e341||0xcc;return function(_0x5ead40){if(_0x5ead40){return _0x1aa3ac[_0x8ed0('0x1c')](_0x51e341);}return _0x1aa3ac[_0x8ed0('0x1d')](_0x51e341)[_0x8ed0('0x1e')]();};}function respondWithResult(_0x4644c4,_0x4dfb4b){_0x4dfb4b=_0x4dfb4b||0xc8;return function(_0x734a42){if(_0x734a42){return _0x4644c4['status'](_0x4dfb4b)['json'](_0x734a42);}};}function respondWithFilteredResult(_0x39c61c,_0x261b58){return function(_0x340a4a){if(_0x340a4a){var _0x2da6ce=typeof _0x261b58[_0x8ed0('0x1f')]===_0x8ed0('0x20')&&typeof _0x261b58['limit']==='undefined';var _0x1c6163=_0x340a4a['count'];var _0x524d7d=_0x2da6ce?0x0:_0x261b58[_0x8ed0('0x1f')];var _0x4768a3=_0x2da6ce?_0x340a4a[_0x8ed0('0x21')]:_0x261b58[_0x8ed0('0x1f')]+_0x261b58[_0x8ed0('0x22')];var _0x489ca0;if(_0x4768a3>=_0x1c6163){_0x4768a3=_0x1c6163;_0x489ca0=0xc8;}else{_0x489ca0=0xce;}_0x39c61c[_0x8ed0('0x1d')](_0x489ca0);return _0x39c61c[_0x8ed0('0x23')](_0x8ed0('0x24'),_0x524d7d+'-'+_0x4768a3+'/'+_0x1c6163)[_0x8ed0('0x25')](_0x340a4a);}return null;};}function patchUpdates(_0x587536){return function(_0x4d0111){try{jsonpatch['apply'](_0x4d0111,_0x587536,!![]);}catch(_0x434107){return BPromise[_0x8ed0('0x26')](_0x434107);}return _0x4d0111[_0x8ed0('0x27')]();};}function saveUpdates(_0x367fbf,_0x1ad4d5){return function(_0x41e011){if(_0x41e011){return _0x41e011['update'](_0x367fbf)[_0x8ed0('0x28')](function(_0x1297ec){return _0x1297ec;});}return null;};}function removeEntity(_0x3f015f,_0x41a340){return function(_0x4d7f62){if(_0x4d7f62){return _0x4d7f62[_0x8ed0('0x29')]()[_0x8ed0('0x28')](function(){_0x3f015f[_0x8ed0('0x1d')](0xcc)[_0x8ed0('0x1e')]();});}};}function handleEntityNotFound(_0x1045cb,_0x360ca5){return function(_0x55ce28){if(!_0x55ce28){_0x1045cb[_0x8ed0('0x1c')](0x194);}return _0x55ce28;};}function handleError(_0x389ac9,_0x33310f){_0x33310f=_0x33310f||0x1f4;return function(_0x329a17){logger[_0x8ed0('0x2a')](_0x329a17['stack']);if(_0x329a17[_0x8ed0('0x2b')]){delete _0x329a17[_0x8ed0('0x2b')];}_0x389ac9[_0x8ed0('0x1d')](_0x33310f)[_0x8ed0('0x2c')](_0x329a17);};}exports[_0x8ed0('0x2d')]=function(_0x47db4a,_0x2983db){var _0x5e93bc={},_0x1813d7={},_0x16b23a={'count':0x0,'rows':[]};var _0x4a2ebe=_[_0x8ed0('0x2e')](db[_0x8ed0('0x2f')][_0x8ed0('0x30')],function(_0x38d4a9){return{'name':_0x38d4a9[_0x8ed0('0x31')],'type':_0x38d4a9[_0x8ed0('0x32')][_0x8ed0('0x33')]};});_0x1813d7[_0x8ed0('0x34')]=_['map'](_0x4a2ebe,_0x8ed0('0x2b'));_0x1813d7['query']=_[_0x8ed0('0x35')](_0x47db4a['query']);_0x1813d7[_0x8ed0('0x36')]=_[_0x8ed0('0x37')](_0x1813d7[_0x8ed0('0x34')],_0x1813d7[_0x8ed0('0x38')]);_0x5e93bc[_0x8ed0('0x39')]=_[_0x8ed0('0x37')](_0x1813d7['model'],qs['fields'](_0x47db4a[_0x8ed0('0x38')][_0x8ed0('0x3a')]));_0x5e93bc[_0x8ed0('0x39')]=_0x5e93bc[_0x8ed0('0x39')]['length']?_0x5e93bc['attributes']:_0x1813d7[_0x8ed0('0x34')];if(!_0x47db4a['query'][_0x8ed0('0x3b')](_0x8ed0('0x3c'))){_0x5e93bc[_0x8ed0('0x22')]=qs[_0x8ed0('0x22')](_0x47db4a[_0x8ed0('0x38')][_0x8ed0('0x22')]);_0x5e93bc['offset']=qs[_0x8ed0('0x1f')](_0x47db4a['query']['offset']);}_0x5e93bc['order']=qs[_0x8ed0('0x3d')](_0x47db4a['query'][_0x8ed0('0x3d')]);_0x5e93bc[_0x8ed0('0x3e')]=qs[_0x8ed0('0x36')](_['pick'](_0x47db4a[_0x8ed0('0x38')],_0x1813d7[_0x8ed0('0x36')]),_0x4a2ebe);if(_0x47db4a[_0x8ed0('0x38')]['filter']){_0x5e93bc[_0x8ed0('0x3e')]=_['merge'](_0x5e93bc[_0x8ed0('0x3e')],{'$or':_[_0x8ed0('0x2e')](_0x4a2ebe,function(_0x1854d2){if(_0x1854d2['type']!==_0x8ed0('0x3f')){var _0xe6863b={};_0xe6863b[_0x1854d2[_0x8ed0('0x2b')]]={'$like':'%'+_0x47db4a[_0x8ed0('0x38')]['filter']+'%'};return _0xe6863b;}})});}_0x5e93bc=_[_0x8ed0('0x40')]({},_0x5e93bc,_0x47db4a[_0x8ed0('0x41')]);var _0x14e687={'where':_0x5e93bc[_0x8ed0('0x3e')]};return db[_0x8ed0('0x2f')][_0x8ed0('0x21')](_0x14e687)[_0x8ed0('0x28')](function(_0x580a30){_0x16b23a[_0x8ed0('0x21')]=_0x580a30;if(_0x47db4a[_0x8ed0('0x38')][_0x8ed0('0x42')]){_0x5e93bc['include']=[{'all':!![]}];}return db[_0x8ed0('0x2f')][_0x8ed0('0x43')](_0x5e93bc);})[_0x8ed0('0x28')](function(_0x1857f9){_0x16b23a[_0x8ed0('0x44')]=_0x1857f9;return _0x16b23a;})[_0x8ed0('0x28')](respondWithFilteredResult(_0x2983db,_0x5e93bc))[_0x8ed0('0x45')](handleError(_0x2983db,null));};exports[_0x8ed0('0x46')]=function(_0x1e5d58,_0x1a6bd8){var _0x10c2a6={'raw':!![],'where':{'id':_0x1e5d58[_0x8ed0('0x47')]['id']}},_0x202811={};_0x202811[_0x8ed0('0x34')]=_[_0x8ed0('0x35')](db[_0x8ed0('0x2f')][_0x8ed0('0x30')]);_0x202811['query']=_[_0x8ed0('0x35')](_0x1e5d58[_0x8ed0('0x38')]);_0x202811[_0x8ed0('0x36')]=_['intersection'](_0x202811[_0x8ed0('0x34')],_0x202811['query']);_0x10c2a6[_0x8ed0('0x39')]=_[_0x8ed0('0x37')](_0x202811[_0x8ed0('0x34')],qs['fields'](_0x1e5d58['query'][_0x8ed0('0x3a')]));_0x10c2a6[_0x8ed0('0x39')]=_0x10c2a6[_0x8ed0('0x39')][_0x8ed0('0x48')]?_0x10c2a6[_0x8ed0('0x39')]:_0x202811[_0x8ed0('0x34')];if(_0x1e5d58[_0x8ed0('0x38')]['includeAll']){_0x10c2a6[_0x8ed0('0x49')]=[{'all':!![]}];}_0x10c2a6=_['merge']({},_0x10c2a6,_0x1e5d58[_0x8ed0('0x41')]);return db['ChatGroup'][_0x8ed0('0x4a')](_0x10c2a6)[_0x8ed0('0x28')](handleEntityNotFound(_0x1a6bd8,null))[_0x8ed0('0x28')](respondWithResult(_0x1a6bd8,null))[_0x8ed0('0x45')](handleError(_0x1a6bd8,null));};exports[_0x8ed0('0x4b')]=function(_0x1d7851,_0x5c37af){return db['ChatGroup'][_0x8ed0('0x4b')](_0x1d7851[_0x8ed0('0x4c')],{})[_0x8ed0('0x28')](respondWithResult(_0x5c37af,0xc9))[_0x8ed0('0x45')](handleError(_0x5c37af,null));};exports[_0x8ed0('0x4d')]=function(_0x255f7f,_0x4cb4ca){if(_0x255f7f['body']['id']){delete _0x255f7f[_0x8ed0('0x4c')]['id'];}return db[_0x8ed0('0x2f')]['find']({'where':{'id':_0x255f7f['params']['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x4cb4ca,null))[_0x8ed0('0x28')](saveUpdates(_0x255f7f['body'],null))['then'](respondWithResult(_0x4cb4ca,null))['catch'](handleError(_0x4cb4ca,null));};exports['destroy']=function(_0x193abb,_0x1b7d9e){return db[_0x8ed0('0x2f')][_0x8ed0('0x4a')]({'where':{'id':_0x193abb[_0x8ed0('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b7d9e,null))['then'](removeEntity(_0x1b7d9e,null))['catch'](handleError(_0x1b7d9e,null));};exports[_0x8ed0('0x4e')]=function(_0x119fae,_0x5c1f1c){return db[_0x8ed0('0x2f')][_0x8ed0('0x4e')]()['then'](respondWithResult(_0x5c1f1c,null))['catch'](handleError(_0x5c1f1c,null));};exports[_0x8ed0('0x4f')]=function(_0x3a42ad,_0x380ac8,_0x32f3b1){return db[_0x8ed0('0x50')][_0x8ed0('0x21')]({'where':{'ChatGroupId':_0x3a42ad['params']['id'],'ToId':_0x3a42ad[_0x8ed0('0x51')]['id'],'read':![]}})[_0x8ed0('0x28')](function(_0x45e51a){return{'id':_[_0x8ed0('0x52')](_0x3a42ad[_0x8ed0('0x47')]['id']),'count':_0x45e51a};})['then'](respondWithResult(_0x380ac8,null))[_0x8ed0('0x45')](handleError(_0x380ac8,null));};exports[_0x8ed0('0x53')]=function(_0x3067e4,_0x271a6c,_0x4aaf1a){return db[_0x8ed0('0x2f')]['find']({'where':{'id':_0x3067e4['params']['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x271a6c,null))[_0x8ed0('0x28')](function(_0x57f82a){if(_0x57f82a){return _0x57f82a['addMembers'](_0x3067e4[_0x8ed0('0x4c')][_0x8ed0('0x54')],_[_0x8ed0('0x55')](_0x3067e4['body'],[_0x8ed0('0x54'),'id'])||{});}})[_0x8ed0('0x28')](respondWithResult(_0x271a6c,null))['catch'](handleError(_0x271a6c,null));};exports[_0x8ed0('0x56')]=function(_0x15bdaa,_0x21f9e1,_0x137ef2){var _0x56c4a7={};var _0x57e080={};var _0x24fe7c;var _0x4c0ed5;return db['ChatGroup'][_0x8ed0('0x57')]({'where':{'id':_0x15bdaa['params']['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x21f9e1,null))[_0x8ed0('0x28')](function(_0x349dd7){if(_0x349dd7){_0x24fe7c=_0x349dd7;_0x57e080['model']=_[_0x8ed0('0x35')](db[_0x8ed0('0x58')][_0x8ed0('0x30')]);_0x57e080[_0x8ed0('0x38')]=_[_0x8ed0('0x35')](_0x15bdaa[_0x8ed0('0x38')]);_0x57e080[_0x8ed0('0x36')]=_[_0x8ed0('0x37')](_0x57e080[_0x8ed0('0x34')],_0x57e080[_0x8ed0('0x38')]);_0x56c4a7[_0x8ed0('0x39')]=_[_0x8ed0('0x37')](_0x57e080[_0x8ed0('0x34')],qs[_0x8ed0('0x3a')](_0x15bdaa[_0x8ed0('0x38')][_0x8ed0('0x3a')]));_0x56c4a7[_0x8ed0('0x39')]=_0x56c4a7[_0x8ed0('0x39')][_0x8ed0('0x48')]?_0x56c4a7['attributes']:_0x57e080[_0x8ed0('0x34')];_0x56c4a7[_0x8ed0('0x59')]=qs['sort'](_0x15bdaa[_0x8ed0('0x38')]['sort']);_0x56c4a7[_0x8ed0('0x3e')]=qs[_0x8ed0('0x36')](_['pick'](_0x15bdaa[_0x8ed0('0x38')],_0x57e080[_0x8ed0('0x36')]));if(_0x15bdaa['query']['filter']){_0x56c4a7['where']=_[_0x8ed0('0x40')](_0x56c4a7['where'],{'$or':_[_0x8ed0('0x2e')](_0x56c4a7[_0x8ed0('0x39')],function(_0x3d1d47){var _0x21d3f7={};_0x21d3f7[_0x3d1d47]={'$like':'%'+_0x15bdaa[_0x8ed0('0x38')]['filter']+'%'};return _0x21d3f7;})});}_0x56c4a7=_[_0x8ed0('0x40')]({},_0x56c4a7,_0x15bdaa[_0x8ed0('0x41')]);return _0x24fe7c[_0x8ed0('0x56')](_0x56c4a7);}})[_0x8ed0('0x28')](function(_0x2d89e7){if(_0x2d89e7){_0x4c0ed5=_0x2d89e7[_0x8ed0('0x48')];if(!_0x15bdaa['query'][_0x8ed0('0x3b')](_0x8ed0('0x3c'))){_0x56c4a7[_0x8ed0('0x22')]=qs[_0x8ed0('0x22')](_0x15bdaa[_0x8ed0('0x38')]['limit']);_0x56c4a7[_0x8ed0('0x1f')]=qs['offset'](_0x15bdaa[_0x8ed0('0x38')][_0x8ed0('0x1f')]);}return _0x24fe7c[_0x8ed0('0x56')](_0x56c4a7);}})['then'](function(_0x27a577){if(_0x27a577){return _0x27a577?{'count':_0x4c0ed5,'rows':_0x27a577}:null;}})[_0x8ed0('0x28')](respondWithResult(_0x21f9e1,null))['catch'](handleError(_0x21f9e1,null));};exports[_0x8ed0('0x5a')]=function(_0x3dd1ac,_0xca2045,_0xd6da19){return db[_0x8ed0('0x2f')][_0x8ed0('0x4a')]({'where':{'id':_0x3dd1ac[_0x8ed0('0x47')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0xca2045,null))[_0x8ed0('0x28')](function(_0x172bbb){if(_0x172bbb){return _0x172bbb[_0x8ed0('0x5a')](_0x3dd1ac['query'][_0x8ed0('0x54')]);}})[_0x8ed0('0x28')](respondWithStatusCode(_0xca2045,null))[_0x8ed0('0x45')](handleError(_0xca2045,null));};exports['addMessage']=function(_0x16b0f9,_0x7a5396,_0x3719d6){if(_0x16b0f9[_0x8ed0('0x4c')]['id']){delete _0x16b0f9[_0x8ed0('0x4c')]['id'];}return db[_0x8ed0('0x2f')][_0x8ed0('0x4a')]({'where':{'id':_0x16b0f9['params']['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x7a5396,null))[_0x8ed0('0x28')](function(_0x3a6b92){if(_0x3a6b92){_0x16b0f9['body']['ChatGroupId']=_0x3a6b92['id'];return db[_0x8ed0('0x50')]['create'](_0x16b0f9['body']);}})['then'](respondWithResult(_0x7a5396,null))[_0x8ed0('0x45')](handleError(_0x7a5396,null));};exports[_0x8ed0('0x5b')]=function(_0x9ba15,_0x54511a,_0x99334f){var _0x59a495={};var _0x3f8115={};var _0xfff855;var _0x287f34;return db['ChatGroup']['findOne']({'where':{'id':_0x9ba15[_0x8ed0('0x47')]['id']}})['then'](handleEntityNotFound(_0x54511a,null))['then'](function(_0x377d19){if(_0x377d19){_0xfff855=_0x377d19;_0x3f8115['model']=_[_0x8ed0('0x35')](db['ChatInternalMessage'][_0x8ed0('0x30')]);_0x3f8115[_0x8ed0('0x38')]=_[_0x8ed0('0x35')](_0x9ba15['query']);_0x3f8115['filters']=_[_0x8ed0('0x37')](_0x3f8115[_0x8ed0('0x34')],_0x3f8115['query']);_0x59a495['attributes']=_[_0x8ed0('0x37')](_0x3f8115[_0x8ed0('0x34')],qs['fields'](_0x9ba15[_0x8ed0('0x38')][_0x8ed0('0x3a')]));_0x59a495['attributes']=_0x59a495['attributes'][_0x8ed0('0x48')]?_0x59a495[_0x8ed0('0x39')]:_0x3f8115['model'];_0x59a495[_0x8ed0('0x59')]=qs[_0x8ed0('0x3d')](_0x9ba15['query'][_0x8ed0('0x3d')]);_0x59a495[_0x8ed0('0x3e')]=qs['filters'](_[_0x8ed0('0x5c')](_0x9ba15[_0x8ed0('0x38')],_0x3f8115['filters']));if(_0x9ba15['query'][_0x8ed0('0x5d')]){_0x59a495[_0x8ed0('0x3e')]=_['merge'](_0x59a495[_0x8ed0('0x3e')],{'$or':_['map'](_0x59a495[_0x8ed0('0x39')],function(_0x387d70){var _0x297e15={};_0x297e15[_0x387d70]={'$like':'%'+_0x9ba15['query']['filter']+'%'};return _0x297e15;})});}if(_0x9ba15['query'][_0x8ed0('0x5e')]){var _0x1b04ee=_0x9ba15[_0x8ed0('0x38')][_0x8ed0('0x5e')][_0x8ed0('0x5f')](',');var _0x4ab876={};_0x4ab876[_0x1b04ee[0x0]]={'$gte':moment(_0x1b04ee[0x1])[_0x8ed0('0x60')](_0x8ed0('0x61'))};_0x59a495[_0x8ed0('0x3e')]=_[_0x8ed0('0x40')](_0x59a495[_0x8ed0('0x3e')],_0x4ab876);}_0x59a495=_[_0x8ed0('0x40')]({},_0x59a495,_0x9ba15[_0x8ed0('0x41')]);return _0xfff855[_0x8ed0('0x5b')](_0x59a495);}})['then'](function(_0x381d8e){if(_0x381d8e){_0x287f34=_0x381d8e[_0x8ed0('0x48')];if(!_0x9ba15[_0x8ed0('0x38')][_0x8ed0('0x3b')](_0x8ed0('0x3c'))){_0x59a495[_0x8ed0('0x22')]=qs[_0x8ed0('0x22')](_0x9ba15[_0x8ed0('0x38')][_0x8ed0('0x22')]);_0x59a495['offset']=qs[_0x8ed0('0x1f')](_0x9ba15['query']['offset']);}return _0xfff855[_0x8ed0('0x5b')](_0x59a495);}})[_0x8ed0('0x28')](function(_0xa6e989){if(_0xa6e989){return _0xa6e989?{'count':_0x287f34,'rows':_0xa6e989}:null;}})[_0x8ed0('0x28')](respondWithResult(_0x54511a,null))['catch'](handleError(_0x54511a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 803190b..6650d2e 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 _0x7750=['hook','events','ChatGroup','setMaxListeners','emit'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x7750,0x182));var _0x0775=function(_0x248ab0,_0x5a7934){_0x248ab0=_0x248ab0-0x0;var _0x54f4ee=_0x7750[_0x248ab0];return _0x54f4ee;};'use strict';var EventEmitter=require(_0x0775('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x0775('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0775('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x255bdc){return function(_0x26b370,_0x114bbd,_0x3a2f34){ChatGroupEvents[_0x0775('0x3')](_0x255bdc+':'+_0x26b370['id'],_0x26b370);ChatGroupEvents[_0x0775('0x3')](_0x255bdc,_0x26b370);_0x3a2f34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x0775('0x4')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xdb21=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x295a55,_0x56e0dc){var _0x3890cf=function(_0x284d42){while(--_0x284d42){_0x295a55['push'](_0x295a55['shift']());}};_0x3890cf(++_0x56e0dc);}(_0xdb21,0x135));var _0x1db2=function(_0x4f3949,_0x1b28b5){_0x4f3949=_0x4f3949-0x0;var _0x2bbb60=_0xdb21[_0x4f3949];return _0x2bbb60;};'use strict';var EventEmitter=require(_0x1db2('0x0'));var ChatGroup=require(_0x1db2('0x1'))['db'][_0x1db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1db2('0x3')](0x0);var events={'afterCreate':_0x1db2('0x4'),'afterUpdate':_0x1db2('0x5'),'afterDestroy':_0x1db2('0x6')};function emitEvent(_0xdc2c0c){return function(_0x4102c4,_0x54a04e,_0x3b16c7){ChatGroupEvents['emit'](_0xdc2c0c+':'+_0x4102c4['id'],_0x4102c4);ChatGroupEvents['emit'](_0xdc2c0c,_0x4102c4);_0x3b16c7(null);};}for(var e in events){if(events[_0x1db2('0x7')](e)){var event=events[e];ChatGroup[_0x1db2('0x8')](e,emitEvent(event));}}module[_0x1db2('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 b53b939..0457e5e 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 _0x0d22=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','util','../../config/logger','api','moment'];(function(_0x216e58,_0x497adc){var _0x5adcad=function(_0x22197f){while(--_0x22197f){_0x216e58['push'](_0x216e58['shift']());}};_0x5adcad(++_0x497adc);}(_0x0d22,0xe6));var _0x20d2=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x0d22[_0x38aeea];return _0x5e8d2c;};'use strict';var _=require('lodash');var util=require(_0x20d2('0x0'));var logger=require(_0x20d2('0x1'))(_0x20d2('0x2'));var moment=require(_0x20d2('0x3'));var BPromise=require(_0x20d2('0x4'));var rp=require(_0x20d2('0x5'));var fs=require('fs');var path=require(_0x20d2('0x6'));var rimraf=require(_0x20d2('0x7'));var config=require(_0x20d2('0x8'));var attributes=require(_0x20d2('0x9'));module[_0x20d2('0xa')]=function(_0x4ea7d3,_0x431c77){return _0x4ea7d3[_0x20d2('0xb')](_0x20d2('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2275=['request-promise','path','../../config/environment','./chatGroup.attributes','exports','ChatGroup','lodash','util','../../config/logger','moment'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x2275,0x132));var _0x5227=function(_0x387ce6,_0x3a45c4){_0x387ce6=_0x387ce6-0x0;var _0x8d2923=_0x2275[_0x387ce6];return _0x8d2923;};'use strict';var _=require(_0x5227('0x0'));var util=require(_0x5227('0x1'));var logger=require(_0x5227('0x2'))('api');var moment=require(_0x5227('0x3'));var BPromise=require('bluebird');var rp=require(_0x5227('0x4'));var fs=require('fs');var path=require(_0x5227('0x5'));var rimraf=require('rimraf');var config=require(_0x5227('0x6'));var attributes=require(_0x5227('0x7'));module[_0x5227('0x8')]=function(_0x4c0469,_0xd3d705){return _0x4c0469['define'](_0x5227('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 14998c5..637cba7 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 _0x4784=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5e7bbc,_0x413a95){var _0x3d6abc=function(_0x10d177){while(--_0x10d177){_0x5e7bbc['push'](_0x5e7bbc['shift']());}};_0x3d6abc(++_0x413a95);}(_0x4784,0xe4));var _0x4478=function(_0x2c072b,_0x6c4449){_0x2c072b=_0x2c072b-0x0;var _0x167ee3=_0x4784[_0x2c072b];return _0x167ee3;};'use strict';var _=require(_0x4478('0x0'));var util=require(_0x4478('0x1'));var moment=require(_0x4478('0x2'));var BPromise=require(_0x4478('0x3'));var rs=require(_0x4478('0x4'));var fs=require('fs');var Redis=require(_0x4478('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4478('0x6'));var logger=require(_0x4478('0x7'))(_0x4478('0x8'));var config=require('../../config/environment');var jayson=require(_0x4478('0x9'));var client=jayson['client'][_0x4478('0xa')]({'port':0x232a});config['redis']=_[_0x4478('0xb')](config[_0x4478('0xc')],{'host':_0x4478('0xd'),'port':0x18eb});var socket=require(_0x4478('0xe'))(new Redis(config[_0x4478('0xc')]));require('./chatGroup.socket')[_0x4478('0xf')](socket);function respondWithRpcPromise(_0x2747ad,_0x2bca2c,_0x3cf977){return new BPromise(function(_0xcc937d,_0x2d95ef){return client[_0x4478('0x10')](_0x2747ad,_0x3cf977)['then'](function(_0x21e831){logger[_0x4478('0x11')](_0x4478('0x12'),_0x2bca2c,_0x4478('0x13'));logger[_0x4478('0x14')](_0x4478('0x15'),_0x2bca2c,'request\x20sent',JSON[_0x4478('0x16')](_0x21e831));if(_0x21e831[_0x4478('0x17')]){if(_0x21e831[_0x4478('0x17')][_0x4478('0x18')]===0x1f4){logger[_0x4478('0x17')]('ChatGroup,\x20%s,\x20%s',_0x2bca2c,_0x21e831['error'][_0x4478('0x19')]);return _0x2d95ef(_0x21e831[_0x4478('0x17')][_0x4478('0x19')]);}logger[_0x4478('0x17')](_0x4478('0x12'),_0x2bca2c,_0x21e831[_0x4478('0x17')][_0x4478('0x19')]);return _0xcc937d(_0x21e831['error'][_0x4478('0x19')]);}else{logger[_0x4478('0x11')](_0x4478('0x12'),_0x2bca2c,_0x4478('0x13'));_0xcc937d(_0x21e831[_0x4478('0x1a')]['message']);}})[_0x4478('0x1b')](function(_0x12b731){logger['error'](_0x4478('0x12'),_0x2bca2c,_0x12b731);_0x2d95ef(_0x12b731);});});} \ No newline at end of file +var _0x95f4=['catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3e16c4,_0x1f1954){var _0x5945d1=function(_0x404a8f){while(--_0x404a8f){_0x3e16c4['push'](_0x3e16c4['shift']());}};_0x5945d1(++_0x1f1954);}(_0x95f4,0xf1));var _0x495f=function(_0x3206cb,_0x3d3f65){_0x3206cb=_0x3206cb-0x0;var _0x4be1ea=_0x95f4[_0x3206cb];return _0x4be1ea;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var moment=require(_0x495f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x495f('0x3'));var db=require(_0x495f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x495f('0x5'));var config=require(_0x495f('0x6'));var jayson=require(_0x495f('0x7'));var client=jayson['client'][_0x495f('0x8')]({'port':0x232a});config[_0x495f('0x9')]=_[_0x495f('0xa')](config['redis'],{'host':_0x495f('0xb'),'port':0x18eb});var socket=require(_0x495f('0xc'))(new Redis(config[_0x495f('0x9')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x3f5880,_0x48c225,_0x415017){return new BPromise(function(_0x508c3d,_0x2b6d9d){return client[_0x495f('0xd')](_0x3f5880,_0x415017)[_0x495f('0xe')](function(_0x2a90c0){logger['info'](_0x495f('0xf'),_0x48c225,_0x495f('0x10'));logger[_0x495f('0x11')](_0x495f('0x12'),_0x48c225,_0x495f('0x10'),JSON['stringify'](_0x2a90c0));if(_0x2a90c0[_0x495f('0x13')]){if(_0x2a90c0[_0x495f('0x13')][_0x495f('0x14')]===0x1f4){logger[_0x495f('0x13')](_0x495f('0xf'),_0x48c225,_0x2a90c0[_0x495f('0x13')][_0x495f('0x15')]);return _0x2b6d9d(_0x2a90c0['error'][_0x495f('0x15')]);}logger[_0x495f('0x13')](_0x495f('0xf'),_0x48c225,_0x2a90c0[_0x495f('0x13')]['message']);return _0x508c3d(_0x2a90c0[_0x495f('0x13')][_0x495f('0x15')]);}else{logger['info'](_0x495f('0xf'),_0x48c225,_0x495f('0x10'));_0x508c3d(_0x2a90c0[_0x495f('0x16')]['message']);}})[_0x495f('0x17')](function(_0x3dc481){logger[_0x495f('0x13')](_0x495f('0xf'),_0x48c225,_0x3dc481);_0x2b6d9d(_0x3dc481);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c914cb2..7478a85 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 _0xd578=['register','./chatGroup.events','remove','update'];(function(_0x2e8cbd,_0x3015b6){var _0x18107c=function(_0x51150c){while(--_0x51150c){_0x2e8cbd['push'](_0x2e8cbd['shift']());}};_0x18107c(++_0x3015b6);}(_0xd578,0x18d));var _0x8d57=function(_0x56fae,_0x2d1fe0){_0x56fae=_0x56fae-0x0;var _0x1eeed7=_0xd578[_0x56fae];return _0x1eeed7;};'use strict';var ChatGroupEvents=require(_0x8d57('0x0'));var events=['save',_0x8d57('0x1'),_0x8d57('0x2')];function createListener(_0xa581c1,_0x4850c0){return function(_0x5173e2){_0x4850c0['emit'](_0xa581c1,_0x5173e2);};}function removeListener(_0x54c6e6,_0x21f998){return function(){ChatGroupEvents['removeListener'](_0x54c6e6,_0x21f998);};}exports[_0x8d57('0x3')]=function(_0x5e5fc0){for(var _0x2d781c=0x0,_0x1443ee=events['length'];_0x2d781c<_0x1443ee;_0x2d781c++){var _0x24a4c4=events[_0x2d781c];var _0x1c068a=createListener('chatGroup:'+_0x24a4c4,_0x5e5fc0);ChatGroupEvents['on'](_0x24a4c4,_0x1c068a);}}; \ No newline at end of file +var _0x2b98=['update','register','length','chatGroup:','./chatGroup.events','remove'];(function(_0x335c97,_0x485355){var _0x36ac8e=function(_0x582562){while(--_0x582562){_0x335c97['push'](_0x335c97['shift']());}};_0x36ac8e(++_0x485355);}(_0x2b98,0x1f0));var _0x82b9=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x2b98[_0x9df060];return _0x338dfe;};'use strict';var ChatGroupEvents=require(_0x82b9('0x0'));var events=['save',_0x82b9('0x1'),_0x82b9('0x2')];function createListener(_0x3eb099,_0x5ca328){return function(_0x285393){_0x5ca328['emit'](_0x3eb099,_0x285393);};}function removeListener(_0x53bda9,_0x36aec0){return function(){ChatGroupEvents['removeListener'](_0x53bda9,_0x36aec0);};}exports[_0x82b9('0x3')]=function(_0x439941){for(var _0x5b2727=0x0,_0x2af581=events[_0x82b9('0x4')];_0x5b2727<_0x2af581;_0x5b2727++){var _0x55c248=events[_0x5b2727];var _0x360b47=createListener(_0x82b9('0x5')+_0x55c248,_0x439941);ChatGroupEvents['on'](_0x55c248,_0x360b47);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index c28c62b..c8c04da 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 _0xb059=['destroy','removeMembers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','index','get','/describe','/:id','isAuthenticated','show','getUnread','getMembers','/:id/messages','getMessages','create','post','/:id/members','addMembers','delete'];(function(_0xa34bda,_0x34f584){var _0x37c970=function(_0xa3eca2){while(--_0xa3eca2){_0xa34bda['push'](_0xa34bda['shift']());}};_0x37c970(++_0x34f584);}(_0xb059,0x12b));var _0x9b05=function(_0x16152d,_0x5a5b49){_0x16152d=_0x16152d-0x0;var _0x1768d8=_0xb059[_0x16152d];return _0x1768d8;};'use strict';var multer=require(_0x9b05('0x0'));var util=require(_0x9b05('0x1'));var path=require(_0x9b05('0x2'));var timeout=require(_0x9b05('0x3'));var express=require(_0x9b05('0x4'));var router=express[_0x9b05('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9b05('0x6'));var interaction=require(_0x9b05('0x7'));var config=require(_0x9b05('0x8'));var controller=require(_0x9b05('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b05('0xa')]);router[_0x9b05('0xb')](_0x9b05('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x9b05('0xd'),auth[_0x9b05('0xe')](),controller[_0x9b05('0xf')]);router['get']('/:id/unread',auth['isAuthenticated'](),controller[_0x9b05('0x10')]);router[_0x9b05('0xb')]('/:id/members',auth[_0x9b05('0xe')](),controller[_0x9b05('0x11')]);router[_0x9b05('0xb')](_0x9b05('0x12'),auth['isAuthenticated'](),controller[_0x9b05('0x13')]);router['post']('/',auth[_0x9b05('0xe')](),controller[_0x9b05('0x14')]);router[_0x9b05('0x15')](_0x9b05('0x16'),auth[_0x9b05('0xe')](),controller[_0x9b05('0x17')]);router[_0x9b05('0x15')](_0x9b05('0x12'),auth[_0x9b05('0xe')](),controller['addMessage']);router['put'](_0x9b05('0xd'),auth[_0x9b05('0xe')](),controller['update']);router[_0x9b05('0x18')](_0x9b05('0xd'),auth[_0x9b05('0xe')](),controller[_0x9b05('0x19')]);router[_0x9b05('0x18')](_0x9b05('0x16'),auth[_0x9b05('0xe')](),controller[_0x9b05('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x3734=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','isAuthenticated','/describe','get','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','/:id','update','delete','destroy','removeMembers'];(function(_0xcb5530,_0x1de24a){var _0x3bb3e7=function(_0x461fa8){while(--_0x461fa8){_0xcb5530['push'](_0xcb5530['shift']());}};_0x3bb3e7(++_0x1de24a);}(_0x3734,0x179));var _0x4373=function(_0x290be4,_0x2df3bd){_0x290be4=_0x290be4-0x0;var _0x2cbe14=_0x3734[_0x290be4];return _0x2cbe14;};'use strict';var multer=require(_0x4373('0x0'));var util=require(_0x4373('0x1'));var path=require(_0x4373('0x2'));var timeout=require(_0x4373('0x3'));var express=require(_0x4373('0x4'));var router=express[_0x4373('0x5')]();var fs_extra=require(_0x4373('0x6'));var auth=require(_0x4373('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4373('0x8'));var controller=require(_0x4373('0x9'));router['get']('/',auth[_0x4373('0xa')](),controller['index']);router['get'](_0x4373('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4373('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x4373('0xd')]);router['get'](_0x4373('0xe'),auth['isAuthenticated'](),controller[_0x4373('0xf')]);router[_0x4373('0xc')](_0x4373('0x10'),auth[_0x4373('0xa')](),controller[_0x4373('0x11')]);router[_0x4373('0xc')](_0x4373('0x12'),auth[_0x4373('0xa')](),controller[_0x4373('0x13')]);router[_0x4373('0x14')]('/',auth['isAuthenticated'](),controller[_0x4373('0x15')]);router[_0x4373('0x14')]('/:id/members',auth[_0x4373('0xa')](),controller[_0x4373('0x16')]);router[_0x4373('0x14')](_0x4373('0x12'),auth['isAuthenticated'](),controller[_0x4373('0x17')]);router['put'](_0x4373('0x18'),auth[_0x4373('0xa')](),controller[_0x4373('0x19')]);router[_0x4373('0x1a')](_0x4373('0x18'),auth[_0x4373('0xa')](),controller[_0x4373('0x1b')]);router[_0x4373('0x1a')]('/:id/members',auth[_0x4373('0xa')](),controller[_0x4373('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 08a1f24..3483e33 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 _0x3613=['DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long'];(function(_0x495291,_0x3ba520){var _0x13a724=function(_0x7dcdd1){while(--_0x7dcdd1){_0x495291['push'](_0x495291['shift']());}};_0x13a724(++_0x3ba520);}(_0x3613,0x6e));var _0x3361=function(_0x9ddaa0,_0x1d3878){_0x9ddaa0=_0x9ddaa0-0x0;var _0x14dce9=_0x3613[_0x9ddaa0];return _0x14dce9;};'use strict';var Sequelize=require(_0x3361('0x0'));module[_0x3361('0x1')]={'closed':{'type':Sequelize[_0x3361('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3361('0x3')]},'ratingType':{'type':Sequelize[_0x3361('0x4')](_0x3361('0x5'),_0x3361('0x6')),'defaultValue':_0x3361('0x5')},'ratingMessage':{'type':Sequelize[_0x3361('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3361('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3361('0x8')]},'secondDisposition':{'type':Sequelize[_0x3361('0x8')]},'thirdDisposition':{'type':Sequelize[_0x3361('0x8')]},'note':{'type':Sequelize[_0x3361('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x3361('0x8')]},'osName':{'type':Sequelize[_0x3361('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x3361('0x7')]},'customerIp':{'type':Sequelize[_0x3361('0x8')]},'formData':{'type':Sequelize[_0x3361('0x7')](_0x3361('0x9'))},'read1stAt':{'type':Sequelize[_0x3361('0xa')]},'lastMsgAt':{'type':Sequelize[_0x3361('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x3361('0x4')]('in',_0x3361('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3361('0x8')]},'customerPort':{'type':Sequelize[_0x3361('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x3361('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3361('0x3')]}}; \ No newline at end of file +var _0x0b89=['ENUM','thumb','star','TEXT','STRING','DATE','long','INTEGER','sequelize','BOOLEAN'];(function(_0x415210,_0x33aff1){var _0x2cb0fa=function(_0x2ad5a1){while(--_0x2ad5a1){_0x415210['push'](_0x415210['shift']());}};_0x2cb0fa(++_0x33aff1);}(_0x0b89,0xc6));var _0x90b8=function(_0x38ddfc,_0x572362){_0x38ddfc=_0x38ddfc-0x0;var _0x1a8e60=_0x0b89[_0x38ddfc];return _0x1a8e60;};'use strict';var Sequelize=require(_0x90b8('0x0'));module['exports']={'closed':{'type':Sequelize[_0x90b8('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x90b8('0x2')]('star',_0x90b8('0x3')),'defaultValue':_0x90b8('0x4')},'ratingMessage':{'type':Sequelize[_0x90b8('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x90b8('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x90b8('0x7')]},'disposition':{'type':Sequelize[_0x90b8('0x6')]},'secondDisposition':{'type':Sequelize[_0x90b8('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x90b8('0x6')]},'browserName':{'type':Sequelize[_0x90b8('0x6')]},'browserVersion':{'type':Sequelize[_0x90b8('0x6')]},'osName':{'type':Sequelize[_0x90b8('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x90b8('0x6')]},'deviceVendor':{'type':Sequelize[_0x90b8('0x6')]},'deviceType':{'type':Sequelize[_0x90b8('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x90b8('0x6')]},'formData':{'type':Sequelize['TEXT'](_0x90b8('0x8'))},'read1stAt':{'type':Sequelize[_0x90b8('0x7')]},'lastMsgAt':{'type':Sequelize[_0x90b8('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x90b8('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x90b8('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x90b8('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x90b8('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0a248d5..1f0a28a 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 _0x70e1=['User','ChatWebsiteId','ContactId','format','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','System','agent_alias','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','getMessages','hasOwnProperty','nolimit','order','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','sort','secret','includeAgent','push','addTags','setTags','ids','spread','Tag','color','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','ChatWebsite','Owner','get','mkdirSync','Chat','Account','toString','closedAt','browserName','osName','referer','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','read','value','renderFile','views','transcript-','.pdf','err','unlinkSync','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','localhost','./chatInteraction.socket','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','update','destroy','end','sendStatus','stack','name','send','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','getOptions','findAll','chat','query','show','params','model','keys','ChatInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','create','find','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','basename','filename','mimetype','Unauthorized','Attachment','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages'];(function(_0x2196f3,_0x25609c){var _0x3b865f=function(_0x344ba9){while(--_0x344ba9){_0x2196f3['push'](_0x2196f3['shift']());}};_0x3b865f(++_0x25609c);}(_0x70e1,0x124));var _0x170e=function(_0x78e522,_0x37c539){_0x78e522=_0x78e522-0x0;var _0x4a170d=_0x70e1[_0x78e522];return _0x4a170d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x170e('0x0'));var rp=require(_0x170e('0x1'));var moment=require(_0x170e('0x2'));var BPromise=require(_0x170e('0x3'));var Mustache=require('mustache');var util=require(_0x170e('0x4'));var path=require(_0x170e('0x5'));var ejs=require(_0x170e('0x6'));var fs=require('fs');var _=require(_0x170e('0x7'));var Redis=require(_0x170e('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x170e('0x9'));var pdf=require(_0x170e('0xa'));var logger=require('../../config/logger')(_0x170e('0xb'));var config=require('../../config/environment');var db=require(_0x170e('0xc'))['db'];config[_0x170e('0xd')]=_['defaults'](config[_0x170e('0xd')],{'host':_0x170e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x170e('0xd')]));require(_0x170e('0xf'))['register'](socket);var jayson=require(_0x170e('0x10'));var client=jayson[_0x170e('0x11')][_0x170e('0x12')]({'port':0x232b});var client9004=jayson[_0x170e('0x11')][_0x170e('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x14ba22,_0x4e8ab7,_0x459732,_0x303eaa){return new BPromise(function(_0xa4b7a3,_0x5ea7b7){var _0x321eff=_0x303eaa||client;return _0x321eff[_0x170e('0x13')](_0x14ba22,_0x459732)[_0x170e('0x14')](function(_0x13e27e){logger['info'](_0x170e('0x15'),_0x4e8ab7,_0x170e('0x16'));logger[_0x170e('0x17')](_0x170e('0x18'),_0x4e8ab7,'request\x20sent',JSON[_0x170e('0x19')](_0x13e27e));if(_0x13e27e[_0x170e('0x1a')]){if(_0x13e27e['error'][_0x170e('0x1b')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x4e8ab7,_0x13e27e[_0x170e('0x1a')][_0x170e('0x1c')]);return _0x5ea7b7(_0x13e27e[_0x170e('0x1a')]['message']);}logger[_0x170e('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x4e8ab7,_0x13e27e[_0x170e('0x1a')][_0x170e('0x1c')]);return _0xa4b7a3(_0x13e27e['error']['message']);}else{logger['info'](_0x170e('0x15'),_0x4e8ab7,_0x170e('0x16'));_0xa4b7a3(_0x13e27e[_0x170e('0x1d')]['message']);}})[_0x170e('0x1e')](function(_0x1d66ad){logger[_0x170e('0x1a')](_0x170e('0x15'),_0x4e8ab7,_0x1d66ad);_0x5ea7b7(_0x1d66ad);});});}function respondWithStatusCode(_0x2cf0ae,_0x10b52a){_0x10b52a=_0x10b52a||0xcc;return function(_0x2a5aa9){if(_0x2a5aa9){return _0x2cf0ae['sendStatus'](_0x10b52a);}return _0x2cf0ae['status'](_0x10b52a)['end']();};}function respondWithResult(_0x568dfd,_0x4743df){_0x4743df=_0x4743df||0xc8;return function(_0x54b9a1){if(_0x54b9a1){return _0x568dfd[_0x170e('0x1f')](_0x4743df)['json'](_0x54b9a1);}};}function respondWithFilteredResult(_0x334b50,_0xd7789f){return function(_0x380577){if(_0x380577){var _0x4456c0=typeof _0xd7789f[_0x170e('0x20')]===_0x170e('0x21')&&typeof _0xd7789f[_0x170e('0x22')]==='undefined';var _0x1e642d=_0x380577['count'];var _0x50f318=_0x4456c0?0x0:_0xd7789f[_0x170e('0x20')];var _0xa739fd=_0x4456c0?_0x380577[_0x170e('0x23')]:_0xd7789f[_0x170e('0x20')]+_0xd7789f[_0x170e('0x22')];var _0x87e16e;if(_0xa739fd>=_0x1e642d){_0xa739fd=_0x1e642d;_0x87e16e=0xc8;}else{_0x87e16e=0xce;}_0x334b50[_0x170e('0x1f')](_0x87e16e);return _0x334b50['set']('Content-Range',_0x50f318+'-'+_0xa739fd+'/'+_0x1e642d)['json'](_0x380577);}return null;};}function saveUpdates(_0x2d6761){return function(_0x43a999){if(_0x43a999){return _0x43a999[_0x170e('0x24')](_0x2d6761)[_0x170e('0x14')](function(_0x3ddd26){return _0x3ddd26;});}return null;};}function removeEntity(_0x391874){return function(_0x5954a0){if(_0x5954a0){return _0x5954a0[_0x170e('0x25')]()[_0x170e('0x14')](function(){_0x391874[_0x170e('0x1f')](0xcc)[_0x170e('0x26')]();});}};}function handleEntityNotFound(_0x39855e){return function(_0x2016be){if(!_0x2016be){_0x39855e[_0x170e('0x27')](0x194);}return _0x2016be;};}function handleError(_0x5e05a4,_0x1ce8ea){_0x1ce8ea=_0x1ce8ea||0x1f4;return function(_0x3790ae){logger['error'](_0x3790ae[_0x170e('0x28')]);if(_0x3790ae['name']){delete _0x3790ae[_0x170e('0x29')];}_0x5e05a4[_0x170e('0x1f')](_0x1ce8ea)[_0x170e('0x2a')](_0x3790ae);};}function getMustacheRender(_0x47110c,_0x1e86a5){return Mustache['render'](_0x47110c,_[_0x170e('0x2b')](_0x1e86a5[_0x170e('0x2c')],{'contact':_0x1e86a5[_0x170e('0x2d')],'message':_0x1e86a5['message'],'agent':_0x1e86a5[_0x170e('0x2e')],'interaction':_0x1e86a5[_0x170e('0x2f')],'account':_0x1e86a5[_0x170e('0x30')]}))||'';}exports[_0x170e('0x31')]=function(_0x5986d4,_0x113959){var _0x259245={};var _0x13b321=_[_0x170e('0x32')](db['ChatInteraction'][_0x170e('0x33')],function(_0x16a305){return{'name':_0x16a305[_0x170e('0x34')],'type':_0x16a305[_0x170e('0x35')]['key']};});_0x259245=qs[_0x170e('0x36')](_0x13b321,_0x5986d4);return interaction[_0x170e('0x37')](_0x170e('0x38'),_0x5986d4[_0x170e('0x39')],_0x5986d4['user'],_0x259245,_0x13b321)[_0x170e('0x14')](respondWithFilteredResult(_0x113959,_0x259245))['catch'](handleError(_0x113959,null));};exports[_0x170e('0x3a')]=function(_0x2f4638,_0x496793){var _0x461766={'raw':![],'where':{'id':_0x2f4638[_0x170e('0x3b')]['id']}},_0x1b8d40={};_0x1b8d40[_0x170e('0x3c')]=_[_0x170e('0x3d')](db[_0x170e('0x3e')][_0x170e('0x33')]);_0x1b8d40[_0x170e('0x39')]=_[_0x170e('0x3d')](_0x2f4638[_0x170e('0x39')]);_0x1b8d40[_0x170e('0x3f')]=_[_0x170e('0x40')](_0x1b8d40[_0x170e('0x3c')],_0x1b8d40[_0x170e('0x39')]);_0x461766[_0x170e('0x41')]=_['intersection'](_0x1b8d40[_0x170e('0x3c')],qs[_0x170e('0x42')](_0x2f4638['query'][_0x170e('0x42')]));_0x461766[_0x170e('0x41')]=_0x461766[_0x170e('0x41')][_0x170e('0x43')]?_0x461766[_0x170e('0x41')]:_0x1b8d40[_0x170e('0x3c')];if(_0x2f4638[_0x170e('0x39')][_0x170e('0x44')]){_0x461766[_0x170e('0x45')]=[{'all':!![]}];}_0x461766=_[_0x170e('0x2b')]({},_0x461766,_0x2f4638[_0x170e('0x46')]);return db[_0x170e('0x3e')]['find'](_0x461766)['then'](handleEntityNotFound(_0x496793,null))['then'](respondWithResult(_0x496793,null))[_0x170e('0x1e')](handleError(_0x496793,null));};exports[_0x170e('0x47')]=function(_0x11fc40,_0x447441){return db[_0x170e('0x3e')][_0x170e('0x47')](_0x11fc40[_0x170e('0x2c')],{})[_0x170e('0x14')](respondWithResult(_0x447441,0xc9))[_0x170e('0x1e')](handleError(_0x447441,null));};exports[_0x170e('0x24')]=function(_0x3b224b,_0x589a0a){if(_0x3b224b[_0x170e('0x2c')]['id']){delete _0x3b224b['body']['id'];}return db['ChatInteraction'][_0x170e('0x48')]({'where':{'id':_0x3b224b[_0x170e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x589a0a,null))[_0x170e('0x14')](saveUpdates(_0x3b224b[_0x170e('0x2c')],null))[_0x170e('0x14')](respondWithResult(_0x589a0a,null))[_0x170e('0x1e')](handleError(_0x589a0a,null));};exports[_0x170e('0x25')]=function(_0x3749d0,_0x129e16){return db['ChatInteraction']['find']({'where':{'id':_0x3749d0[_0x170e('0x3b')]['id']}})[_0x170e('0x14')](handleEntityNotFound(_0x129e16,null))[_0x170e('0x14')](removeEntity(_0x129e16,null))[_0x170e('0x1e')](handleError(_0x129e16,null));};exports['describe']=function(_0x281f50,_0x3a0fee){return db['ChatInteraction'][_0x170e('0x49')]()[_0x170e('0x14')](respondWithResult(_0x3a0fee,null))[_0x170e('0x1e')](handleError(_0x3a0fee,null));};exports[_0x170e('0x4a')]=function(_0x2986e3,_0xf992a7){var _0x4f1b41=_0x2986e3['params']['id'];var _0x5bc945;var _0x486e1e;var _0xa8061;return db[_0x170e('0x3e')][_0x170e('0x4b')]({'where':{'id':_0x4f1b41}})['then'](function(_0x1654cc){_0x5bc945=_0x1654cc;return db['ChatWebsite'][_0x170e('0x4b')]({'where':{'id':_0x1654cc['ChatWebsiteId']},'attributes':['id',_0x170e('0x4c'),_0x170e('0x4d'),_0x170e('0x4e'),_0x170e('0x4f'),_0x170e('0x50')],'raw':!![]});})[_0x170e('0x14')](function(_0x169cc2){if(_0x169cc2&&_0x169cc2[_0x170e('0x4c')]&&_0x169cc2['vidaooEscalation']){_0x486e1e=_0x169cc2;var _0x5a50c3={'interaction':{'id':_0x4f1b41},'agent':{'id':_0x2986e3['user']['id'],'name':_0x2986e3[_0x170e('0x51')]['name'],'fullname':_0x2986e3[_0x170e('0x51')][_0x170e('0x52')],'email':_0x2986e3[_0x170e('0x51')][_0x170e('0x53')]},'contact':_0x2986e3[_0x170e('0x2c')][_0x170e('0x2d')],'account':_0x2986e3[_0x170e('0x2c')][_0x170e('0x30')]};var _0x21860c={'rejectUnauthorized':![],'method':_0x170e('0x54'),'url':_0x170e('0x55'),'headers':{'X-APIKEY':_0x169cc2[_0x170e('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2986e3[_0x170e('0x51')][_0x170e('0x53')]],'buttons':null,'topic':_0x486e1e[_0x170e('0x4e')],'note':_['isNull'](_0x486e1e['vidaooNote'])?null:getMustacheRender(_0x486e1e[_0x170e('0x4f')],_0x5a50c3),'metadata':null},'redirect':_0x170e('0x56'),'json':!![]};try{if(!_['isNull'](_0x486e1e[_0x170e('0x50')])){var _0x5c1f5f=getMustacheRender(_0x486e1e[_0x170e('0x50')],_0x5a50c3);var _0x1ebc34=JSON[_0x170e('0x57')](_0x5c1f5f);_0x21860c[_0x170e('0x2c')][_0x170e('0x58')]=_0x1ebc34;}}catch(_0x27be7e){throw new db[(_0x170e('0x59'))][(_0x170e('0x5a'))](_0x170e('0x5b'));}return rp(_0x21860c);}else{throw new db[(_0x170e('0x59'))][(_0x170e('0x5a'))](_0x170e('0x5c'));}})[_0x170e('0x14')](function(_0x27e4cf){_0xa8061=_0x27e4cf;if(_0xa8061['id']){var _0x1c0d0b={'body':_0xa8061[_0x170e('0x5d')],'ChatWebsiteId':_0x486e1e['id'],'ChatInteractionId':_0x5bc945['id'],'direction':_0x170e('0x5e'),'UserId':_0x2986e3[_0x170e('0x51')]['id']};return db[_0x170e('0x5f')][_0x170e('0x47')](_0x1c0d0b,{});}else{throw new db['Sequelize'][(_0x170e('0x5a'))](_0x170e('0x60'));}})[_0x170e('0x14')](function(){return _0x5bc945[_0x170e('0x61')]({'vidaooSessionId':_0xa8061['id']});})['then'](respondWithResult(_0xf992a7,null))['catch'](handleError(_0xf992a7,null));};exports[_0x170e('0x62')]=function(_0x33711c,_0xfdee2d){if(_0x33711c[_0x170e('0x2c')]['id']){delete _0x33711c['body']['id'];}return db[_0x170e('0x3e')]['find']({'where':{'id':_0x33711c[_0x170e('0x3b')]['id']},'include':[{'model':db['CmContact'],'as':_0x170e('0x63')}]})[_0x170e('0x14')](handleEntityNotFound(_0xfdee2d,null))[_0x170e('0x14')](saveUpdates(_0x33711c['body'],null))[_0x170e('0x14')](respondWithResult(_0xfdee2d,null))[_0x170e('0x1e')](handleError(_0xfdee2d,null));};exports['abandon']=function(_0x270259,_0x2aab5e){if(_0x270259[_0x170e('0x2c')]['id']){delete _0x270259[_0x170e('0x2c')]['id'];}return db[_0x170e('0x3e')][_0x170e('0x48')]({'where':{'id':_0x270259[_0x170e('0x3b')]['id']}})['then'](function(_0x258b07){if(!_0x258b07){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x170e('0x64'),0x194,_0x170e('0x65'));_0x2aab5e[_0x170e('0x27')](0x194);}else{if(_0x258b07[_0x170e('0x66')]){throw new db[(_0x170e('0x59'))][(_0x170e('0x5a'))](_0x170e('0x67'));}}return _0x258b07;})[_0x170e('0x14')](function(_0x309d03){if(_0x309d03){return _0x309d03[_0x170e('0x24')]({'closed':_0x270259[_0x170e('0x2c')][_0x170e('0x68')],'disposition':_0x270259[_0x170e('0x2c')][_0x170e('0x69')]})[_0x170e('0x14')](function(_0x852d8){return _0x852d8;});}})[_0x170e('0x14')](function(){return respondWithRpcPromise('AbandonInteraction',_0x170e('0x64'),_0x270259[_0x170e('0x2c')],client9004);})[_0x170e('0x14')](respondWithResult(_0x2aab5e,null))[_0x170e('0x1e')](handleError(_0x2aab5e,null));};exports[_0x170e('0x6a')]=function(_0x7b1011,_0xf6a202){_0x7b1011[_0x170e('0x2c')]['name']=_0x7b1011[_0x170e('0x6b')]['originalname'];_0x7b1011['body'][_0x170e('0x6c')]=_0x7b1011['file'][_0x170e('0x6d')];_0x7b1011[_0x170e('0x2c')]['type']=_0x7b1011[_0x170e('0x6b')][_0x170e('0x6e')];return db['Attachment'][_0x170e('0x47')](_0x7b1011[_0x170e('0x2c')])[_0x170e('0x14')](respondWithResult(_0xf6a202,0xc9))['catch'](handleError(_0xf6a202,null));};exports['attachmentDownload']=function(_0x58a11b,_0x26e291){return db[_0x170e('0x3e')][_0x170e('0x4b')]({'where':{'id':_0x58a11b[_0x170e('0x3b')]['id']},'raw':!![]})[_0x170e('0x14')](handleEntityNotFound(_0x26e291,null))[_0x170e('0x14')](function(_0x15aeab){if(_0x15aeab){if(_0x15aeab[_0x170e('0x68')]){return _0x26e291[_0x170e('0x1f')](0x193)['json']({'status':0x193,'message':_0x170e('0x6f')});}return db[_0x170e('0x70')][_0x170e('0x4b')]({'where':{'id':_0x58a11b[_0x170e('0x39')][_0x170e('0x71')]},'raw':!![]})['then'](handleEntityNotFound(_0x26e291,null));}})[_0x170e('0x14')](function(_0x1cf558){if(_0x1cf558){var _0x3538b5=_0x1cf558[_0x170e('0x72')]!==null;var _0xefd4c3=path['join'](config[_0x170e('0x73')],_0x170e('0x74'));if(_0x3538b5){_0xefd4c3=path[_0x170e('0x75')](_0xefd4c3,_0x170e('0x76'));}var _0x27c0f3=path[_0x170e('0x75')](_0xefd4c3,_0x1cf558['basename']);return _0x26e291[_0x170e('0x77')](_0x27c0f3);}})[_0x170e('0x1e')](handleError(_0x26e291,null));};exports[_0x170e('0x78')]=function(_0x4a5f73,_0x3a1aa6){var _0x4747d4=null;var _0x1e1c6e=null;var _0x1ee0f3=null;if(_0x4a5f73[_0x170e('0x2c')]['id']){delete _0x4a5f73[_0x170e('0x2c')]['id'];}if(_0x4a5f73[_0x170e('0x2c')][_0x170e('0x79')]){_0x1ee0f3=path[_0x170e('0x75')](config[_0x170e('0x73')],_0x170e('0x7a'),util['format'](_0x170e('0x7b'),Date['now']()));_0x4a5f73[_0x170e('0x2c')][_0x170e('0x7c')]=_0x1ee0f3;}return db[_0x170e('0x3e')][_0x170e('0x48')]({'where':{'id':_0x4a5f73[_0x170e('0x3b')]['id']},'include':[{'model':db[_0x170e('0x5f')],'as':_0x170e('0x7d'),'include':[{'model':db[_0x170e('0x7e')],'as':_0x170e('0x7e')}]}]})[_0x170e('0x14')](handleEntityNotFound(_0x3a1aa6,null))[_0x170e('0x14')](saveUpdates(_0x4a5f73[_0x170e('0x2c')],null))[_0x170e('0x14')](function(_0x2333ae){if(_0x2333ae){_0x4747d4=_0x2333ae;return db['ChatWebsite'][_0x170e('0x48')]({'where':{'id':_0x4747d4[_0x170e('0x7f')]}});}})[_0x170e('0x14')](function(_0x44d68f){if(_0x44d68f){_0x1e1c6e=_0x44d68f;return db['CmContact'][_0x170e('0x48')]({'where':{'id':_0x4747d4[_0x170e('0x80')]}});}})[_0x170e('0x14')](function(_0x288c72){if(_0x288c72){if(_0x1ee0f3){var _0x4481e6=null;for(var _0xa2abaa=0x1;_0xa2abaa<_0x4747d4[_0x170e('0x7d')][_0x170e('0x43')];++_0xa2abaa){_0x4481e6=_0x4747d4[_0x170e('0x7d')][_0xa2abaa];var _0x389e1c=_0x4481e6['UserId']?util[_0x170e('0x81')]('%s%d',_0x1e1c6e[_0x170e('0x82')],_0x4481e6[_0x170e('0x66')]):'System';var _0x68e882=_0x4a5f73[_0x170e('0x2c')][_0x170e('0x83')]||util[_0x170e('0x81')](_0x170e('0x84'),_0x170e('0x85'),_0x4481e6[_0x170e('0x80')]);switch(_0x1e1c6e[_0x170e('0x86')]){case _0x170e('0x87'):_0x389e1c=_0x4481e6[_0x170e('0x66')]?util[_0x170e('0x81')](_0x170e('0x84'),_0x1e1c6e[_0x170e('0x82')],_0x4481e6['UserId']):_0x170e('0x88');break;case _0x170e('0x89'):_0x389e1c=_0x4481e6[_0x170e('0x66')]?_0x4481e6[_0x170e('0x7e')]['alias']||_0x4481e6['User'][_0x170e('0x52')]:_0x170e('0x88');break;case'agent_fullname':_0x389e1c=_0x4481e6['UserId']?_0x4481e6[_0x170e('0x7e')][_0x170e('0x52')]:_0x170e('0x88');break;default:_0x389e1c=_0x4481e6[_0x170e('0x66')]?util[_0x170e('0x81')](_0x170e('0x84'),_0x1e1c6e[_0x170e('0x82')],_0x4481e6[_0x170e('0x66')]):_0x170e('0x88');}var _0x1172bb=util[_0x170e('0x81')](_0x170e('0x8a'),moment(_0x4481e6[_0x170e('0x8b')])[_0x170e('0x81')]('MM/DD/YYYY\x20HH:mm:ss'),_0x4481e6[_0x170e('0x8c')]==='in'?_0x68e882:_0x389e1c,_0x4481e6['body']);if(!_0x4481e6['secret']){fs[_0x170e('0x8d')](_0x1ee0f3,_0x1172bb);}}return db[_0x170e('0x8e')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x170e('0x8f')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x170e('0x90'),'raw':!![]}]}]});}}})['then'](function(_0x5e37ff){if(!_0x5e37ff||!_0x5e37ff[_0x170e('0x91')]||!_0x4a5f73[_0x170e('0x2c')])return _0x4747d4;var _0xf150e7=_0x5e37ff[_0x170e('0x92')]();return respondWithRpcPromise(_0x170e('0x93'),'sendMail',{'account':_0xf150e7,'message':{'from':util[_0x170e('0x81')](_0x170e('0x94'),_0x5e37ff[_0x170e('0x29')],_0x5e37ff[_0x170e('0x53')]||_0x5e37ff['Smtp'][_0x170e('0x51')]),'to':_0x4a5f73[_0x170e('0x2c')][_0x170e('0x79')],'subject':_0x170e('0x95'),'text':util[_0x170e('0x81')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4a5f73[_0x170e('0x2c')][_0x170e('0x79')]),'attachments':[{'path':_0x1ee0f3}]}})['then'](function(){return _0x4747d4;})['catch'](function(_0x3c36cf){logger['error'](_0x3c36cf);});})['then'](respondWithStatusCode(_0x3a1aa6,0xc8))['catch'](handleError(_0x3a1aa6,null));};exports[_0x170e('0x96')]=function(_0x56e189,_0x44c952){return db['ChatMessage'][_0x170e('0x48')]({'where':{'id':_0x56e189[_0x170e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x44c952,null))[_0x170e('0x14')](function(_0x4e6e14){if(_0x4e6e14){return _0x4e6e14[_0x170e('0x96')](_0x56e189['body']['ids'],_[_0x170e('0x97')](_0x56e189['body'],['ids','id'])||{});}})[_0x170e('0x14')](respondWithResult(_0x44c952,null))[_0x170e('0x1e')](handleError(_0x44c952,null));};exports[_0x170e('0x98')]=function(_0x3fc59c,_0x5b1925){var _0x2df274={'raw':![],'where':{}};var _0x44acfb={};var _0x1a1acb={'count':0x0,'rows':[]};return db[_0x170e('0x3e')][_0x170e('0x4b')]({'where':{'id':_0x3fc59c['params']['id']}})['then'](handleEntityNotFound(_0x5b1925,null))[_0x170e('0x14')](function(_0x1395f3){if(_0x1395f3){_0x44acfb[_0x170e('0x3c')]=_[_0x170e('0x3d')](db[_0x170e('0x5f')][_0x170e('0x33')]);_0x44acfb[_0x170e('0x39')]=_[_0x170e('0x3d')](_0x3fc59c[_0x170e('0x39')]);_0x44acfb[_0x170e('0x3f')]=_[_0x170e('0x40')](_0x44acfb[_0x170e('0x3c')],_0x44acfb['query']);_0x2df274[_0x170e('0x41')]=_['intersection'](_0x44acfb[_0x170e('0x3c')],qs[_0x170e('0x42')](_0x3fc59c[_0x170e('0x39')][_0x170e('0x42')]));_0x2df274[_0x170e('0x41')]=_0x2df274['attributes']['length']?_0x2df274[_0x170e('0x41')]:_0x44acfb[_0x170e('0x3c')];if(!_0x3fc59c[_0x170e('0x39')][_0x170e('0x99')](_0x170e('0x9a'))){_0x2df274[_0x170e('0x22')]=qs[_0x170e('0x22')](_0x3fc59c[_0x170e('0x39')][_0x170e('0x22')]);_0x2df274[_0x170e('0x20')]=qs[_0x170e('0x20')](_0x3fc59c['query']['offset']);}_0x2df274[_0x170e('0x9b')]=qs['sort'](_0x3fc59c[_0x170e('0x39')]['sort']);_0x2df274[_0x170e('0x9c')]=qs[_0x170e('0x3f')](_[_0x170e('0x9d')](_0x3fc59c[_0x170e('0x39')],_0x44acfb[_0x170e('0x3f')]));_0x2df274[_0x170e('0x9c')][_0x170e('0x9e')]=_0x1395f3['id'];if(_0x3fc59c['query'][_0x170e('0x9f')]){_0x2df274[_0x170e('0x9c')]=_['merge'](_0x2df274[_0x170e('0x9c')],{'$or':_['map'](_0x2df274[_0x170e('0x41')],function(_0x826f57){var _0x40ce4e={};_0x40ce4e[_0x826f57]={'$like':'%'+_0x3fc59c[_0x170e('0x39')][_0x170e('0x9f')]+'%'};return _0x40ce4e;})});}if(_0x3fc59c[_0x170e('0x39')][_0x170e('0xa0')]){var _0x5a4c25=_0x3fc59c[_0x170e('0x39')][_0x170e('0xa0')]['split'](',');var _0x421626={};_0x421626[_0x5a4c25[0x0]]={'$gte':moment(_0x5a4c25[0x1])[_0x170e('0x81')](_0x170e('0xa1'))};_0x2df274[_0x170e('0x9c')]=_[_0x170e('0x2b')](_0x2df274[_0x170e('0x9c')],_0x421626);}_0x2df274=_[_0x170e('0x2b')]({},_0x2df274,_0x3fc59c[_0x170e('0x46')]);return db[_0x170e('0x5f')][_0x170e('0x23')]({'where':_0x2df274[_0x170e('0x9c')]})['then'](function(_0x411b6e){_0x1a1acb[_0x170e('0x23')]=_0x411b6e;if(_0x3fc59c[_0x170e('0x39')]['includeAll']){_0x2df274[_0x170e('0x45')]=[{'all':!![]}];}return db['ChatMessage'][_0x170e('0x37')](_0x2df274);})[_0x170e('0x14')](function(_0x373ab8){_0x1a1acb[_0x170e('0xa2')]=_0x373ab8;return _0x1a1acb;});}})[_0x170e('0x14')](respondWithFilteredResult(_0x5b1925,_0x2df274))[_0x170e('0x1e')](handleError(_0x5b1925,null));};exports['getMyMessages']=function(_0x3729ec,_0x32d3c7){var _0x582b7a={'where':{}},_0x3a1f0c={},_0x1350a6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x170e('0x4b')]({'where':{'id':_0x3729ec[_0x170e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x32d3c7,null))[_0x170e('0x14')](function(_0x1f0933){if(_0x1f0933){_0x3a1f0c[_0x170e('0x3c')]=_['keys'](db[_0x170e('0x5f')][_0x170e('0x33')]);_0x3a1f0c[_0x170e('0x39')]=_['keys'](_0x3729ec['query']);_0x3a1f0c['filters']=_['intersection'](_0x3a1f0c[_0x170e('0x3c')],_0x3a1f0c['query']);_0x582b7a[_0x170e('0x41')]=_[_0x170e('0x40')](_0x3a1f0c[_0x170e('0x3c')],qs['fields'](_0x3729ec[_0x170e('0x39')][_0x170e('0x42')]));_0x582b7a['attributes']=_0x582b7a['attributes'][_0x170e('0x43')]?_0x582b7a[_0x170e('0x41')]:_0x3a1f0c['model'];if(!_0x3729ec['query']['hasOwnProperty'](_0x170e('0x9a'))){_0x582b7a[_0x170e('0x22')]=qs['limit'](_0x3729ec[_0x170e('0x39')][_0x170e('0x22')]);_0x582b7a[_0x170e('0x20')]=qs[_0x170e('0x20')](_0x3729ec[_0x170e('0x39')]['offset']);}_0x582b7a[_0x170e('0x9b')]=qs[_0x170e('0xa3')](_0x3729ec[_0x170e('0x39')][_0x170e('0xa3')]);_0x582b7a[_0x170e('0x9c')]=qs[_0x170e('0x3f')](_[_0x170e('0x9d')](_0x3729ec[_0x170e('0x39')],_0x3a1f0c[_0x170e('0x3f')]));_0x582b7a[_0x170e('0x9c')][_0x170e('0x9e')]=_0x1f0933['id'];if(_0x3729ec[_0x170e('0x39')][_0x170e('0x9f')]){_0x582b7a[_0x170e('0x9c')]=_['merge'](_0x582b7a[_0x170e('0x9c')],{'$or':_[_0x170e('0x32')](_0x582b7a[_0x170e('0x41')],function(_0x529e38){var _0x523532={};_0x523532[_0x529e38]={'$like':'%'+_0x3729ec[_0x170e('0x39')][_0x170e('0x9f')]+'%'};return _0x523532;})});}_0x582b7a['where'][_0x170e('0xa4')]=![];if(_0x3729ec[_0x170e('0x39')]['id']){_0x582b7a[_0x170e('0x9c')]['id']={'$gt':_0x3729ec['query']['id']};}_0x582b7a=_['merge']({},_0x582b7a,_0x3729ec[_0x170e('0x46')]);return db['ChatMessage'][_0x170e('0x23')]({'where':_0x582b7a['where']})[_0x170e('0x14')](function(_0x100d0c){_0x1350a6[_0x170e('0x23')]=_0x100d0c;_0x582b7a[_0x170e('0x45')]=[];if(_0x3729ec['query'][_0x170e('0xa5')]){_0x582b7a[_0x170e('0x45')][_0x170e('0xa6')]({'model':db[_0x170e('0x7e')],'as':'User','attributes':['id','fullname','alias']});}if(_0x3729ec[_0x170e('0x39')][_0x170e('0x44')]){_0x582b7a[_0x170e('0x45')]=[{'all':!![]}];}return db[_0x170e('0x5f')][_0x170e('0x37')](_0x582b7a);})[_0x170e('0x14')](function(_0x1e0496){_0x1350a6['rows']=_0x1e0496;return _0x1350a6;});}})[_0x170e('0x14')](respondWithFilteredResult(_0x32d3c7,_0x582b7a))[_0x170e('0x1e')](handleError(_0x32d3c7,null));};exports[_0x170e('0xa7')]=function(_0x5dee75,_0x13fd57){return db[_0x170e('0x3e')][_0x170e('0x48')]({'where':{'id':_0x5dee75[_0x170e('0x3b')]['id']}})[_0x170e('0x14')](handleEntityNotFound(_0x13fd57,null))[_0x170e('0x14')](function(_0x2b86cd){if(_0x2b86cd){return _0x2b86cd[_0x170e('0xa8')](_0x5dee75[_0x170e('0x2c')][_0x170e('0xa9')],_[_0x170e('0x97')](_0x5dee75[_0x170e('0x2c')],[_0x170e('0xa9'),'id'])||{})[_0x170e('0xaa')](function(){return db[_0x170e('0xab')][_0x170e('0x37')]({'attributes':['id',_0x170e('0x29'),_0x170e('0xac')],'where':{'id':_0x5dee75['body'][_0x170e('0xa9')]}});})[_0x170e('0x14')](function(_0xbf958c){socket['emit'](_0x170e('0xad'),{'id':Number(_0x5dee75[_0x170e('0x3b')]['id']),'tags':_0xbf958c||[]});return{'id':Number(_0x5dee75[_0x170e('0x3b')]['id']),'tags':_0xbf958c||[]};});}})[_0x170e('0x14')](respondWithResult(_0x13fd57,null))[_0x170e('0x1e')](handleError(_0x13fd57,null));};exports[_0x170e('0xae')]=function(_0x2f614b,_0x1f1c8c){return db[_0x170e('0x3e')][_0x170e('0x48')]({'where':{'id':_0x2f614b[_0x170e('0x3b')]['id']}})[_0x170e('0x14')](handleEntityNotFound(_0x1f1c8c,null))[_0x170e('0x14')](function(_0x210b81){if(_0x210b81){return _0x210b81[_0x170e('0xae')](_0x2f614b[_0x170e('0x39')]['ids']);}})[_0x170e('0x14')](respondWithStatusCode(_0x1f1c8c,null))[_0x170e('0x1e')](handleError(_0x1f1c8c,null));};exports[_0x170e('0x77')]=function(_0xa7daad,_0x28d0e7){var _0x510ea7=moment()['unix']()['toString']();var _0xcbb72b=path[_0x170e('0x75')](config[_0x170e('0x73')],_0x170e('0xaf'),_0x170e('0xb0'),_0x170e('0xb1'));var _0x528260=path[_0x170e('0x75')](config[_0x170e('0x73')],_0x170e('0xaf'),_0x170e('0xb0'),_0x170e('0xb2'));var _0x2e3a23=path[_0x170e('0x75')](_0xcbb72b,_0x510ea7);var _0x5c7e7c=util[_0x170e('0x81')](_0x170e('0xb3'),_0xa7daad[_0x170e('0x3b')]['id'],_0x510ea7);var _0x15becc=path['join'](_0xcbb72b,_0x5c7e7c);var _0x48254b=[];_0x48254b[_0x170e('0xa6')]({'model':db[_0x170e('0x7e')],'as':'User','attributes':['id',_0x170e('0x52')],'raw':!![]});_0x48254b['push']({'model':db[_0x170e('0xb4')],'as':'Contact','attributes':['id',_0x170e('0xb5'),_0x170e('0xb6')],'raw':!![]});if(_0xa7daad[_0x170e('0x39')]['attachments']){_0x48254b[_0x170e('0xa6')]({'model':db[_0x170e('0x70')],'as':_0x170e('0x70'),'raw':!![]});}var _0x556a05=[{'model':db[_0x170e('0x5f')],'as':'Messages','attributes':['id',_0x170e('0x2c'),_0x170e('0x8b'),_0x170e('0x8c'),'secret','read'],'include':_0x48254b}];_0x556a05[_0x170e('0xa6')]({'model':db[_0x170e('0xb7')],'as':'Account','attributes':['id',_0x170e('0x29')]});_0x556a05[_0x170e('0xa6')]({'model':db['User'],'as':_0x170e('0xb8'),'attributes':['id',_0x170e('0x52')]});return db[_0x170e('0x3e')][_0x170e('0x48')]({'where':{'id':_0xa7daad[_0x170e('0x3b')]['id']},'include':_0x556a05})[_0x170e('0x14')](handleEntityNotFound(_0x28d0e7,null))[_0x170e('0x14')](function(_0x204445){if(_0x204445){var _0x536061=_0x204445[_0x170e('0xb9')]({'plain':!![]});fs[_0x170e('0xba')](_0x2e3a23);var _0x23bc71={'channel':_0x170e('0xbb'),'account':_0x536061[_0x170e('0xbc')][_0x170e('0x29')],'agent':_0x536061[_0x170e('0xb8')]?_0x536061[_0x170e('0xb8')]['fullname']:'N.A.','createdAt':moment(_0x536061[_0x170e('0x8b')])[_0x170e('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0x170e('0xbd')](),'closedAt':_0x536061[_0x170e('0x68')]?moment(_0x536061[_0x170e('0xbe')])[_0x170e('0x81')](_0x170e('0xa1'))[_0x170e('0xbd')]():'','disposition':_0x536061['disposition'],'chatInfo':{'browser':_0x536061[_0x170e('0xbf')],'os':_0x536061[_0x170e('0xc0')],'referer':_0x536061[_0x170e('0xc1')],'customerIp':_0x536061['customerIp'],'customerPort':_0x536061[_0x170e('0xc2')]?_0x536061[_0x170e('0xc2')]:_0x170e('0xc3')},'messages':_(_0x536061[_0x170e('0x7d')])[_0x170e('0xc4')]()[_0x170e('0x9f')]({'secret':![]})[_0x170e('0x32')](function(_0x324c33){if(_0x324c33[_0x170e('0x70')]){var _0x7aca0=path[_0x170e('0x75')](_0x528260,_0x324c33[_0x170e('0x70')]['basename']);if(fs[_0x170e('0xc5')](_0x7aca0)){fs[_0x170e('0xc6')](_0x7aca0)[_0x170e('0xc7')](fs[_0x170e('0xc8')](path[_0x170e('0x75')](_0x2e3a23,_0x324c33[_0x170e('0x70')]['basename'])));}}return{'date':moment(_0x324c33[_0x170e('0x8b')])[_0x170e('0x81')](_0x170e('0xa1'))['toString'](),'sender':_0x324c33[_0x170e('0x8c')]===_0x170e('0x5e')?_0x324c33[_0x170e('0x7e')]?_0x324c33[_0x170e('0x7e')]['fullname']:_0x170e('0x88'):_0x324c33[_0x170e('0x63')]['firstName']+(_0x324c33['Contact'][_0x170e('0xb6')]?'\x20'+_0x324c33[_0x170e('0x63')][_0x170e('0xb6')]:''),'body':_0x324c33['Attachment']?_0x324c33[_0x170e('0x70')][_0x170e('0x6c')]:_0x324c33[_0x170e('0x2c')],'direction':_0x324c33[_0x170e('0x8c')]===_0x170e('0x5e')?'A':'C','secret':_0x324c33[_0x170e('0xa4')],'read':_0x324c33[_0x170e('0xc9')],'attachment':_0x324c33[_0x170e('0x70')]};})[_0x170e('0xca')]()};return ejs[_0x170e('0xcb')](path[_0x170e('0x75')](config['root'],_0x170e('0xaf'),_0x170e('0xcc'),'downloadInteraction.ejs'),{'interaction':_0x23bc71})['then'](function(_0x4eb17f){var _0x3f6497=path[_0x170e('0x75')](_0x2e3a23,_0x170e('0xcd')+_0x536061['id']+'-'+_0x510ea7+_0x170e('0xce'));var _0x1be69d={'path':_0x3f6497,'channel':'Chat','interactionId':_0x536061['id']};return pdf['createPdfFromHTML'](_0x4eb17f,_0x1be69d);})['then'](function(){return new Promise(function(_0x445359,_0x51ec03){zipdir(_0x2e3a23,{'saveTo':_0x15becc},function(_0x315b9f,_0x2b17ce){if(_0x315b9f)return _0x51ec03(_0x315b9f);return _0x445359(_0x2b17ce);});})[_0x170e('0x14')](function(){return new BPromise(function(_0x535edb,_0x36a053){rimraf(_0x2e3a23,function(_0x5bc016){if(_0x5bc016)_0x36a053(_0x5bc016);return _0x535edb();});});})[_0x170e('0x14')](function(){return _0x28d0e7[_0x170e('0x77')](_0x15becc,_0x5c7e7c,function(_0x1933f3){if(_0x1933f3){logger['error'](_0x170e('0xcf'),_0x1933f3);}else{fs[_0x170e('0xd0')](_0x15becc);}});});});}else{return _0x28d0e7['sendStatus'](0xc8);}})[_0x170e('0x1e')](handleError(_0x28d0e7,null));}; \ No newline at end of file +var _0x2faf=['secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','rows','hasOwnProperty','ChatInteractionId','includeAgent','push','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','createdAt','Account','get','Chat','Owner','N.A.','closedAt','browserName','osName','referer','customerIp','tail','existsSync','pipe','createWriteStream','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','status','stack','name','send','render','merge','interaction','account','map','type','getOptions','chat','query','user','params','model','ChatInteraction','rawAttributes','keys','filters','intersection','attributes','fields','length','includeAll','create','body','find','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','format','now','pathTranscript','User','ChatWebsite','ContactId','Messages','%s%d','agentAlias','System','customer','Visitor','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction'];(function(_0x4b649b,_0x544487){var _0x1a92a8=function(_0xa0f8b6){while(--_0xa0f8b6){_0x4b649b['push'](_0x4b649b['shift']());}};_0x1a92a8(++_0x544487);}(_0x2faf,0x114));var _0xf2fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2faf[_0xa464c9];return _0x3d73c4;};'use strict';var rimraf=require(_0xf2fa('0x0'));var zipdir=require(_0xf2fa('0x1'));var rp=require('request-promise');var moment=require(_0xf2fa('0x2'));var BPromise=require(_0xf2fa('0x3'));var Mustache=require(_0xf2fa('0x4'));var util=require(_0xf2fa('0x5'));var path=require(_0xf2fa('0x6'));var ejs=require(_0xf2fa('0x7'));var fs=require('fs');var _=require(_0xf2fa('0x8'));var Redis=require(_0xf2fa('0x9'));var interaction=require(_0xf2fa('0xa'));var qs=require(_0xf2fa('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0xf2fa('0xc'))('api');var config=require('../../config/environment');var db=require(_0xf2fa('0xd'))['db'];config['redis']=_['defaults'](config[_0xf2fa('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2fa('0xf'))(new Redis(config['redis']));require(_0xf2fa('0x10'))[_0xf2fa('0x11')](socket);var jayson=require(_0xf2fa('0x12'));var client=jayson[_0xf2fa('0x13')]['http']({'port':0x232b});var client9004=jayson[_0xf2fa('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0x153a45,_0xe024e6,_0x375f1d,_0x339a55){return new BPromise(function(_0x1e133e,_0x26c9cf){var _0xa131ad=_0x339a55||client;return _0xa131ad[_0xf2fa('0x14')](_0x153a45,_0x375f1d)[_0xf2fa('0x15')](function(_0x5e24fb){logger[_0xf2fa('0x16')](_0xf2fa('0x17'),_0xe024e6,'request\x20sent');logger[_0xf2fa('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xe024e6,'request\x20sent',JSON[_0xf2fa('0x19')](_0x5e24fb));if(_0x5e24fb[_0xf2fa('0x1a')]){if(_0x5e24fb[_0xf2fa('0x1a')][_0xf2fa('0x1b')]===0x1f4){logger[_0xf2fa('0x1a')](_0xf2fa('0x17'),_0xe024e6,_0x5e24fb[_0xf2fa('0x1a')][_0xf2fa('0x1c')]);return _0x26c9cf(_0x5e24fb[_0xf2fa('0x1a')][_0xf2fa('0x1c')]);}logger['error'](_0xf2fa('0x17'),_0xe024e6,_0x5e24fb[_0xf2fa('0x1a')][_0xf2fa('0x1c')]);return _0x1e133e(_0x5e24fb[_0xf2fa('0x1a')][_0xf2fa('0x1c')]);}else{logger['info'](_0xf2fa('0x17'),_0xe024e6,_0xf2fa('0x1d'));_0x1e133e(_0x5e24fb['result'][_0xf2fa('0x1c')]);}})[_0xf2fa('0x1e')](function(_0x4c47a9){logger[_0xf2fa('0x1a')](_0xf2fa('0x17'),_0xe024e6,_0x4c47a9);_0x26c9cf(_0x4c47a9);});});}function respondWithStatusCode(_0x1b99c7,_0x40dc30){_0x40dc30=_0x40dc30||0xcc;return function(_0x178e8a){if(_0x178e8a){return _0x1b99c7[_0xf2fa('0x1f')](_0x40dc30);}return _0x1b99c7['status'](_0x40dc30)[_0xf2fa('0x20')]();};}function respondWithResult(_0x9a8a7d,_0xb69e9e){_0xb69e9e=_0xb69e9e||0xc8;return function(_0x4722ca){if(_0x4722ca){return _0x9a8a7d['status'](_0xb69e9e)['json'](_0x4722ca);}};}function respondWithFilteredResult(_0x2c9429,_0x589b2d){return function(_0x52bedf){if(_0x52bedf){var _0x216862=typeof _0x589b2d[_0xf2fa('0x21')]===_0xf2fa('0x22')&&typeof _0x589b2d[_0xf2fa('0x23')]==='undefined';var _0x29e753=_0x52bedf[_0xf2fa('0x24')];var _0x5d70fb=_0x216862?0x0:_0x589b2d['offset'];var _0x26c676=_0x216862?_0x52bedf['count']:_0x589b2d[_0xf2fa('0x21')]+_0x589b2d[_0xf2fa('0x23')];var _0x35bbea;if(_0x26c676>=_0x29e753){_0x26c676=_0x29e753;_0x35bbea=0xc8;}else{_0x35bbea=0xce;}_0x2c9429['status'](_0x35bbea);return _0x2c9429[_0xf2fa('0x25')](_0xf2fa('0x26'),_0x5d70fb+'-'+_0x26c676+'/'+_0x29e753)[_0xf2fa('0x27')](_0x52bedf);}return null;};}function saveUpdates(_0xf3f270){return function(_0x3e75d6){if(_0x3e75d6){return _0x3e75d6[_0xf2fa('0x28')](_0xf3f270)[_0xf2fa('0x15')](function(_0x5c61dc){return _0x5c61dc;});}return null;};}function removeEntity(_0xe31ce6){return function(_0x4eb599){if(_0x4eb599){return _0x4eb599[_0xf2fa('0x29')]()[_0xf2fa('0x15')](function(){_0xe31ce6[_0xf2fa('0x2a')](0xcc)[_0xf2fa('0x20')]();});}};}function handleEntityNotFound(_0x4545b2){return function(_0x3605a7){if(!_0x3605a7){_0x4545b2['sendStatus'](0x194);}return _0x3605a7;};}function handleError(_0x57148c,_0x124179){_0x124179=_0x124179||0x1f4;return function(_0x285f27){logger['error'](_0x285f27[_0xf2fa('0x2b')]);if(_0x285f27[_0xf2fa('0x2c')]){delete _0x285f27['name'];}_0x57148c[_0xf2fa('0x2a')](_0x124179)[_0xf2fa('0x2d')](_0x285f27);};}function getMustacheRender(_0x46768f,_0xd3df82){return Mustache[_0xf2fa('0x2e')](_0x46768f,_[_0xf2fa('0x2f')](_0xd3df82['body'],{'contact':_0xd3df82['contact'],'message':_0xd3df82[_0xf2fa('0x1c')],'agent':_0xd3df82['agent'],'interaction':_0xd3df82[_0xf2fa('0x30')],'account':_0xd3df82[_0xf2fa('0x31')]}))||'';}exports['index']=function(_0x4c3def,_0x5017dd){var _0x1a07da={};var _0x294467=_[_0xf2fa('0x32')](db['ChatInteraction']['rawAttributes'],function(_0x421a9f){return{'name':_0x421a9f['fieldName'],'type':_0x421a9f[_0xf2fa('0x33')]['key']};});_0x1a07da=qs[_0xf2fa('0x34')](_0x294467,_0x4c3def);return interaction['findAll'](_0xf2fa('0x35'),_0x4c3def[_0xf2fa('0x36')],_0x4c3def[_0xf2fa('0x37')],_0x1a07da,_0x294467)['then'](respondWithFilteredResult(_0x5017dd,_0x1a07da))[_0xf2fa('0x1e')](handleError(_0x5017dd,null));};exports['show']=function(_0x112ee1,_0x438e12){var _0x426885={'raw':![],'where':{'id':_0x112ee1[_0xf2fa('0x38')]['id']}},_0x381c8e={};_0x381c8e[_0xf2fa('0x39')]=_['keys'](db[_0xf2fa('0x3a')][_0xf2fa('0x3b')]);_0x381c8e['query']=_[_0xf2fa('0x3c')](_0x112ee1[_0xf2fa('0x36')]);_0x381c8e[_0xf2fa('0x3d')]=_[_0xf2fa('0x3e')](_0x381c8e['model'],_0x381c8e[_0xf2fa('0x36')]);_0x426885[_0xf2fa('0x3f')]=_['intersection'](_0x381c8e['model'],qs[_0xf2fa('0x40')](_0x112ee1[_0xf2fa('0x36')][_0xf2fa('0x40')]));_0x426885[_0xf2fa('0x3f')]=_0x426885[_0xf2fa('0x3f')][_0xf2fa('0x41')]?_0x426885[_0xf2fa('0x3f')]:_0x381c8e[_0xf2fa('0x39')];if(_0x112ee1['query'][_0xf2fa('0x42')]){_0x426885['include']=[{'all':!![]}];}_0x426885=_[_0xf2fa('0x2f')]({},_0x426885,_0x112ee1['options']);return db[_0xf2fa('0x3a')]['find'](_0x426885)['then'](handleEntityNotFound(_0x438e12,null))['then'](respondWithResult(_0x438e12,null))[_0xf2fa('0x1e')](handleError(_0x438e12,null));};exports[_0xf2fa('0x43')]=function(_0x1fe147,_0x34419f){return db['ChatInteraction'][_0xf2fa('0x43')](_0x1fe147['body'],{})[_0xf2fa('0x15')](respondWithResult(_0x34419f,0xc9))[_0xf2fa('0x1e')](handleError(_0x34419f,null));};exports[_0xf2fa('0x28')]=function(_0x3b187f,_0xdf38ae){if(_0x3b187f['body']['id']){delete _0x3b187f[_0xf2fa('0x44')]['id'];}return db[_0xf2fa('0x3a')][_0xf2fa('0x45')]({'where':{'id':_0x3b187f[_0xf2fa('0x38')]['id']}})[_0xf2fa('0x15')](handleEntityNotFound(_0xdf38ae,null))[_0xf2fa('0x15')](saveUpdates(_0x3b187f[_0xf2fa('0x44')],null))['then'](respondWithResult(_0xdf38ae,null))[_0xf2fa('0x1e')](handleError(_0xdf38ae,null));};exports[_0xf2fa('0x29')]=function(_0x496cc8,_0x2a092f){return db['ChatInteraction'][_0xf2fa('0x45')]({'where':{'id':_0x496cc8[_0xf2fa('0x38')]['id']}})['then'](handleEntityNotFound(_0x2a092f,null))['then'](removeEntity(_0x2a092f,null))[_0xf2fa('0x1e')](handleError(_0x2a092f,null));};exports[_0xf2fa('0x46')]=function(_0x34f35e,_0x31a9c3){return db[_0xf2fa('0x3a')]['describe']()[_0xf2fa('0x15')](respondWithResult(_0x31a9c3,null))[_0xf2fa('0x1e')](handleError(_0x31a9c3,null));};exports['createVidaooSession']=function(_0x5ae15c,_0x2b7012){var _0x47cd30=_0x5ae15c[_0xf2fa('0x38')]['id'];var _0x32e7c4;var _0x347523;var _0x59c6f8;return db[_0xf2fa('0x3a')][_0xf2fa('0x47')]({'where':{'id':_0x47cd30}})[_0xf2fa('0x15')](function(_0x33369a){_0x32e7c4=_0x33369a;return db['ChatWebsite']['findOne']({'where':{'id':_0x33369a[_0xf2fa('0x48')]},'attributes':['id',_0xf2fa('0x49'),_0xf2fa('0x4a'),_0xf2fa('0x4b'),_0xf2fa('0x4c'),_0xf2fa('0x4d')],'raw':!![]});})[_0xf2fa('0x15')](function(_0x2d9f72){if(_0x2d9f72&&_0x2d9f72[_0xf2fa('0x49')]&&_0x2d9f72[_0xf2fa('0x4a')]){_0x347523=_0x2d9f72;var _0x48d55c={'interaction':{'id':_0x47cd30},'agent':{'id':_0x5ae15c['user']['id'],'name':_0x5ae15c['user'][_0xf2fa('0x2c')],'fullname':_0x5ae15c['user'][_0xf2fa('0x4e')],'email':_0x5ae15c[_0xf2fa('0x37')][_0xf2fa('0x4f')]},'contact':_0x5ae15c[_0xf2fa('0x44')][_0xf2fa('0x50')],'account':_0x5ae15c[_0xf2fa('0x44')]['account']};var _0x1e5e67={'rejectUnauthorized':![],'method':_0xf2fa('0x51'),'url':_0xf2fa('0x52'),'headers':{'X-APIKEY':_0x2d9f72[_0xf2fa('0x49')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5ae15c[_0xf2fa('0x37')]['email']],'buttons':null,'topic':_0x347523['vidaooTopic'],'note':_[_0xf2fa('0x53')](_0x347523[_0xf2fa('0x4c')])?null:getMustacheRender(_0x347523['vidaooNote'],_0x48d55c),'metadata':null},'redirect':_0xf2fa('0x54'),'json':!![]};try{if(!_[_0xf2fa('0x53')](_0x347523[_0xf2fa('0x4d')])){var _0xb0f779=getMustacheRender(_0x347523[_0xf2fa('0x4d')],_0x48d55c);var _0x230b66=JSON['parse'](_0xb0f779);_0x1e5e67[_0xf2fa('0x44')][_0xf2fa('0x55')]=_0x230b66;}}catch(_0x235cb4){throw new db[(_0xf2fa('0x56'))][(_0xf2fa('0x57'))](_0xf2fa('0x58'));}return rp(_0x1e5e67);}else{throw new db['Sequelize'][(_0xf2fa('0x57'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xf2fa('0x15')](function(_0x1b8cc6){_0x59c6f8=_0x1b8cc6;if(_0x59c6f8['id']){var _0x4d1715={'body':_0x59c6f8[_0xf2fa('0x59')],'ChatWebsiteId':_0x347523['id'],'ChatInteractionId':_0x32e7c4['id'],'direction':_0xf2fa('0x5a'),'UserId':_0x5ae15c[_0xf2fa('0x37')]['id']};return db[_0xf2fa('0x5b')][_0xf2fa('0x43')](_0x4d1715,{});}else{throw new db[(_0xf2fa('0x56'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xf2fa('0x15')](function(){return _0x32e7c4[_0xf2fa('0x5c')]({'vidaooSessionId':_0x59c6f8['id']});})[_0xf2fa('0x15')](respondWithResult(_0x2b7012,null))[_0xf2fa('0x1e')](handleError(_0x2b7012,null));};exports[_0xf2fa('0x5d')]=function(_0x5bb579,_0x237a6f){if(_0x5bb579[_0xf2fa('0x44')]['id']){delete _0x5bb579[_0xf2fa('0x44')]['id'];}return db[_0xf2fa('0x3a')]['find']({'where':{'id':_0x5bb579[_0xf2fa('0x38')]['id']},'include':[{'model':db[_0xf2fa('0x5e')],'as':'Contact'}]})[_0xf2fa('0x15')](handleEntityNotFound(_0x237a6f,null))[_0xf2fa('0x15')](saveUpdates(_0x5bb579[_0xf2fa('0x44')],null))[_0xf2fa('0x15')](respondWithResult(_0x237a6f,null))[_0xf2fa('0x1e')](handleError(_0x237a6f,null));};exports[_0xf2fa('0x5f')]=function(_0x203349,_0x122470){if(_0x203349['body']['id']){delete _0x203349[_0xf2fa('0x44')]['id'];}return db[_0xf2fa('0x3a')][_0xf2fa('0x45')]({'where':{'id':_0x203349['params']['id']}})[_0xf2fa('0x15')](function(_0x40493d){if(!_0x40493d){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0xf2fa('0x60'));_0x122470['sendStatus'](0x194);}else{if(_0x40493d[_0xf2fa('0x61')]){throw new db[(_0xf2fa('0x56'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x40493d;})[_0xf2fa('0x15')](function(_0x3b16ff){if(_0x3b16ff){return _0x3b16ff[_0xf2fa('0x28')]({'closed':_0x203349[_0xf2fa('0x44')][_0xf2fa('0x62')],'disposition':_0x203349['body'][_0xf2fa('0x63')]})[_0xf2fa('0x15')](function(_0x2c83f7){return _0x2c83f7;});}})['then'](function(){return respondWithRpcPromise(_0xf2fa('0x64'),_0xf2fa('0x5f'),_0x203349[_0xf2fa('0x44')],client9004);})[_0xf2fa('0x15')](respondWithResult(_0x122470,null))['catch'](handleError(_0x122470,null));};exports[_0xf2fa('0x65')]=function(_0x215845,_0x5a4a96){_0x215845[_0xf2fa('0x44')][_0xf2fa('0x2c')]=_0x215845['file'][_0xf2fa('0x66')];_0x215845['body'][_0xf2fa('0x67')]=_0x215845['file'][_0xf2fa('0x68')];_0x215845['body'][_0xf2fa('0x33')]=_0x215845['file']['mimetype'];return db[_0xf2fa('0x69')][_0xf2fa('0x43')](_0x215845[_0xf2fa('0x44')])['then'](respondWithResult(_0x5a4a96,0xc9))[_0xf2fa('0x1e')](handleError(_0x5a4a96,null));};exports[_0xf2fa('0x6a')]=function(_0x22db86,_0x4e4d1d){return db['ChatInteraction'][_0xf2fa('0x47')]({'where':{'id':_0x22db86['params']['id']},'raw':!![]})[_0xf2fa('0x15')](handleEntityNotFound(_0x4e4d1d,null))[_0xf2fa('0x15')](function(_0x52386d){if(_0x52386d){if(_0x52386d[_0xf2fa('0x62')]){return _0x4e4d1d[_0xf2fa('0x2a')](0x193)[_0xf2fa('0x27')]({'status':0x193,'message':_0xf2fa('0x6b')});}return db['Attachment']['findOne']({'where':{'id':_0x22db86[_0xf2fa('0x36')][_0xf2fa('0x6c')]},'raw':!![]})[_0xf2fa('0x15')](handleEntityNotFound(_0x4e4d1d,null));}})[_0xf2fa('0x15')](function(_0x126f28){if(_0x126f28){var _0xa068a2=_0x126f28[_0xf2fa('0x6d')]!==null;var _0x2ef7ec=path[_0xf2fa('0x6e')](config['root'],_0xf2fa('0x6f'));if(_0xa068a2){_0x2ef7ec=path['join'](_0x2ef7ec,_0xf2fa('0x70'));}var _0x4ccf37=path[_0xf2fa('0x6e')](_0x2ef7ec,_0x126f28[_0xf2fa('0x67')]);return _0x4e4d1d[_0xf2fa('0x71')](_0x4ccf37);}})[_0xf2fa('0x1e')](handleError(_0x4e4d1d,null));};exports[_0xf2fa('0x72')]=function(_0x46a15a,_0x40b0c2){var _0x411d64=null;var _0x4bb0f4=null;var _0x524fc6=null;if(_0x46a15a['body']['id']){delete _0x46a15a[_0xf2fa('0x44')]['id'];}if(_0x46a15a['body'][_0xf2fa('0x73')]){_0x524fc6=path['join'](config[_0xf2fa('0x74')],_0xf2fa('0x75'),util[_0xf2fa('0x76')]('transcript-%s.txt',Date[_0xf2fa('0x77')]()));_0x46a15a['body'][_0xf2fa('0x78')]=_0x524fc6;}return db[_0xf2fa('0x3a')][_0xf2fa('0x45')]({'where':{'id':_0x46a15a['params']['id']},'include':[{'model':db[_0xf2fa('0x5b')],'as':'Messages','include':[{'model':db[_0xf2fa('0x79')],'as':'User'}]}]})[_0xf2fa('0x15')](handleEntityNotFound(_0x40b0c2,null))[_0xf2fa('0x15')](saveUpdates(_0x46a15a[_0xf2fa('0x44')],null))[_0xf2fa('0x15')](function(_0x188bae){if(_0x188bae){_0x411d64=_0x188bae;return db[_0xf2fa('0x7a')][_0xf2fa('0x45')]({'where':{'id':_0x411d64[_0xf2fa('0x48')]}});}})['then'](function(_0x32a7e8){if(_0x32a7e8){_0x4bb0f4=_0x32a7e8;return db[_0xf2fa('0x5e')]['find']({'where':{'id':_0x411d64[_0xf2fa('0x7b')]}});}})[_0xf2fa('0x15')](function(_0x5012e2){if(_0x5012e2){if(_0x524fc6){var _0xb2a141=null;for(var _0x4f67a9=0x1;_0x4f67a9<_0x411d64[_0xf2fa('0x7c')][_0xf2fa('0x41')];++_0x4f67a9){_0xb2a141=_0x411d64['Messages'][_0x4f67a9];var _0x45b8ba=_0xb2a141[_0xf2fa('0x61')]?util[_0xf2fa('0x76')](_0xf2fa('0x7d'),_0x4bb0f4[_0xf2fa('0x7e')],_0xb2a141[_0xf2fa('0x61')]):_0xf2fa('0x7f');var _0x14eabf=_0x46a15a[_0xf2fa('0x44')][_0xf2fa('0x80')]||util[_0xf2fa('0x76')](_0xf2fa('0x7d'),_0xf2fa('0x81'),_0xb2a141[_0xf2fa('0x7b')]);switch(_0x4bb0f4['agentIdentifier']){case _0xf2fa('0x82'):_0x45b8ba=_0xb2a141[_0xf2fa('0x61')]?util['format'](_0xf2fa('0x7d'),_0x4bb0f4[_0xf2fa('0x7e')],_0xb2a141[_0xf2fa('0x61')]):_0xf2fa('0x7f');break;case'agent_alias':_0x45b8ba=_0xb2a141[_0xf2fa('0x61')]?_0xb2a141[_0xf2fa('0x79')][_0xf2fa('0x83')]||_0xb2a141[_0xf2fa('0x79')][_0xf2fa('0x4e')]:'System';break;case _0xf2fa('0x84'):_0x45b8ba=_0xb2a141[_0xf2fa('0x61')]?_0xb2a141[_0xf2fa('0x79')][_0xf2fa('0x4e')]:_0xf2fa('0x7f');break;default:_0x45b8ba=_0xb2a141['UserId']?util[_0xf2fa('0x76')](_0xf2fa('0x7d'),_0x4bb0f4[_0xf2fa('0x7e')],_0xb2a141[_0xf2fa('0x61')]):_0xf2fa('0x7f');}var _0x10fae9=util[_0xf2fa('0x76')](_0xf2fa('0x85'),moment(_0xb2a141['createdAt'])[_0xf2fa('0x76')](_0xf2fa('0x86')),_0xb2a141[_0xf2fa('0x87')]==='in'?_0x14eabf:_0x45b8ba,_0xb2a141[_0xf2fa('0x44')]);if(!_0xb2a141[_0xf2fa('0x88')]){fs[_0xf2fa('0x89')](_0x524fc6,_0x10fae9);}}return db[_0xf2fa('0x8a')][_0xf2fa('0x47')]({'where':{'service':!![]},'include':[{'model':db[_0xf2fa('0x8b')],'as':_0xf2fa('0x8c'),'raw':!![],'include':[{'model':db[_0xf2fa('0x8d')],'as':_0xf2fa('0x8d'),'raw':!![]}]}]});}}})[_0xf2fa('0x15')](function(_0x4526cb){if(!_0x4526cb||!_0x4526cb[_0xf2fa('0x8c')]||!_0x46a15a[_0xf2fa('0x44')])return _0x411d64;var _0x30dd7c=_0x4526cb[_0xf2fa('0x8e')]();return respondWithRpcPromise(_0xf2fa('0x8f'),'sendMail',{'account':_0x30dd7c,'message':{'from':util[_0xf2fa('0x76')]('\x22%s\x22\x20<%s>',_0x4526cb[_0xf2fa('0x2c')],_0x4526cb[_0xf2fa('0x4f')]||_0x4526cb[_0xf2fa('0x8c')][_0xf2fa('0x37')]),'to':_0x46a15a[_0xf2fa('0x44')][_0xf2fa('0x73')],'subject':_0xf2fa('0x90'),'text':util[_0xf2fa('0x76')](_0xf2fa('0x91'),_0x46a15a[_0xf2fa('0x44')][_0xf2fa('0x73')]),'attachments':[{'path':_0x524fc6}]}})[_0xf2fa('0x15')](function(){return _0x411d64;})[_0xf2fa('0x1e')](function(_0x4f2d36){logger['error'](_0x4f2d36);});})['then'](respondWithStatusCode(_0x40b0c2,0xc8))[_0xf2fa('0x1e')](handleError(_0x40b0c2,null));};exports[_0xf2fa('0x92')]=function(_0x2a4c02,_0x2cc662){return db['ChatMessage'][_0xf2fa('0x45')]({'where':{'id':_0x2a4c02[_0xf2fa('0x38')]['id']}})['then'](handleEntityNotFound(_0x2cc662,null))[_0xf2fa('0x15')](function(_0x4d3776){if(_0x4d3776){return _0x4d3776['addMessage'](_0x2a4c02[_0xf2fa('0x44')]['ids'],_[_0xf2fa('0x93')](_0x2a4c02[_0xf2fa('0x44')],[_0xf2fa('0x94'),'id'])||{});}})[_0xf2fa('0x15')](respondWithResult(_0x2cc662,null))[_0xf2fa('0x1e')](handleError(_0x2cc662,null));};exports[_0xf2fa('0x95')]=function(_0x5d097e,_0x4bb3c2){var _0x512d89={'raw':![],'where':{}};var _0x5b17ae={};var _0x409764={'count':0x0,'rows':[]};return db[_0xf2fa('0x3a')][_0xf2fa('0x47')]({'where':{'id':_0x5d097e[_0xf2fa('0x38')]['id']}})['then'](handleEntityNotFound(_0x4bb3c2,null))[_0xf2fa('0x15')](function(_0x524c48){if(_0x524c48){_0x5b17ae[_0xf2fa('0x39')]=_['keys'](db[_0xf2fa('0x5b')][_0xf2fa('0x3b')]);_0x5b17ae['query']=_['keys'](_0x5d097e[_0xf2fa('0x36')]);_0x5b17ae['filters']=_[_0xf2fa('0x3e')](_0x5b17ae['model'],_0x5b17ae[_0xf2fa('0x36')]);_0x512d89[_0xf2fa('0x3f')]=_[_0xf2fa('0x3e')](_0x5b17ae['model'],qs['fields'](_0x5d097e[_0xf2fa('0x36')]['fields']));_0x512d89[_0xf2fa('0x3f')]=_0x512d89[_0xf2fa('0x3f')][_0xf2fa('0x41')]?_0x512d89[_0xf2fa('0x3f')]:_0x5b17ae['model'];if(!_0x5d097e[_0xf2fa('0x36')]['hasOwnProperty'](_0xf2fa('0x96'))){_0x512d89[_0xf2fa('0x23')]=qs['limit'](_0x5d097e[_0xf2fa('0x36')][_0xf2fa('0x23')]);_0x512d89['offset']=qs[_0xf2fa('0x21')](_0x5d097e['query']['offset']);}_0x512d89[_0xf2fa('0x97')]=qs[_0xf2fa('0x98')](_0x5d097e[_0xf2fa('0x36')][_0xf2fa('0x98')]);_0x512d89[_0xf2fa('0x99')]=qs[_0xf2fa('0x3d')](_[_0xf2fa('0x9a')](_0x5d097e[_0xf2fa('0x36')],_0x5b17ae['filters']));_0x512d89[_0xf2fa('0x99')]['ChatInteractionId']=_0x524c48['id'];if(_0x5d097e[_0xf2fa('0x36')][_0xf2fa('0x9b')]){_0x512d89[_0xf2fa('0x99')]=_[_0xf2fa('0x2f')](_0x512d89[_0xf2fa('0x99')],{'$or':_[_0xf2fa('0x32')](_0x512d89['attributes'],function(_0x10136a){var _0x44f34a={};_0x44f34a[_0x10136a]={'$like':'%'+_0x5d097e[_0xf2fa('0x36')][_0xf2fa('0x9b')]+'%'};return _0x44f34a;})});}if(_0x5d097e[_0xf2fa('0x36')]['$gte']){var _0x2b5a04=_0x5d097e[_0xf2fa('0x36')][_0xf2fa('0x9c')][_0xf2fa('0x9d')](',');var _0x9ddd6={};_0x9ddd6[_0x2b5a04[0x0]]={'$gte':moment(_0x2b5a04[0x1])['format'](_0xf2fa('0x9e'))};_0x512d89[_0xf2fa('0x99')]=_[_0xf2fa('0x2f')](_0x512d89[_0xf2fa('0x99')],_0x9ddd6);}_0x512d89=_[_0xf2fa('0x2f')]({},_0x512d89,_0x5d097e[_0xf2fa('0x9f')]);return db[_0xf2fa('0x5b')][_0xf2fa('0x24')]({'where':_0x512d89[_0xf2fa('0x99')]})['then'](function(_0x52f48f){_0x409764[_0xf2fa('0x24')]=_0x52f48f;if(_0x5d097e[_0xf2fa('0x36')][_0xf2fa('0x42')]){_0x512d89[_0xf2fa('0xa0')]=[{'all':!![]}];}return db[_0xf2fa('0x5b')][_0xf2fa('0xa1')](_0x512d89);})[_0xf2fa('0x15')](function(_0x4e7161){_0x409764[_0xf2fa('0xa2')]=_0x4e7161;return _0x409764;});}})[_0xf2fa('0x15')](respondWithFilteredResult(_0x4bb3c2,_0x512d89))[_0xf2fa('0x1e')](handleError(_0x4bb3c2,null));};exports['getMyMessages']=function(_0x4dd93c,_0x2ac43c){var _0x59b864={'where':{}},_0x53221c={},_0x1ae891={'count':0x0,'rows':[]};return db[_0xf2fa('0x3a')]['findOne']({'where':{'id':_0x4dd93c[_0xf2fa('0x38')]['id']}})[_0xf2fa('0x15')](handleEntityNotFound(_0x2ac43c,null))[_0xf2fa('0x15')](function(_0x4ae4df){if(_0x4ae4df){_0x53221c['model']=_[_0xf2fa('0x3c')](db['ChatMessage'][_0xf2fa('0x3b')]);_0x53221c[_0xf2fa('0x36')]=_[_0xf2fa('0x3c')](_0x4dd93c['query']);_0x53221c[_0xf2fa('0x3d')]=_[_0xf2fa('0x3e')](_0x53221c[_0xf2fa('0x39')],_0x53221c[_0xf2fa('0x36')]);_0x59b864[_0xf2fa('0x3f')]=_[_0xf2fa('0x3e')](_0x53221c[_0xf2fa('0x39')],qs['fields'](_0x4dd93c[_0xf2fa('0x36')]['fields']));_0x59b864[_0xf2fa('0x3f')]=_0x59b864[_0xf2fa('0x3f')]['length']?_0x59b864['attributes']:_0x53221c[_0xf2fa('0x39')];if(!_0x4dd93c[_0xf2fa('0x36')][_0xf2fa('0xa3')]('nolimit')){_0x59b864['limit']=qs[_0xf2fa('0x23')](_0x4dd93c['query'][_0xf2fa('0x23')]);_0x59b864[_0xf2fa('0x21')]=qs[_0xf2fa('0x21')](_0x4dd93c['query'][_0xf2fa('0x21')]);}_0x59b864[_0xf2fa('0x97')]=qs[_0xf2fa('0x98')](_0x4dd93c[_0xf2fa('0x36')][_0xf2fa('0x98')]);_0x59b864[_0xf2fa('0x99')]=qs['filters'](_[_0xf2fa('0x9a')](_0x4dd93c[_0xf2fa('0x36')],_0x53221c[_0xf2fa('0x3d')]));_0x59b864[_0xf2fa('0x99')][_0xf2fa('0xa4')]=_0x4ae4df['id'];if(_0x4dd93c['query'][_0xf2fa('0x9b')]){_0x59b864[_0xf2fa('0x99')]=_[_0xf2fa('0x2f')](_0x59b864[_0xf2fa('0x99')],{'$or':_[_0xf2fa('0x32')](_0x59b864[_0xf2fa('0x3f')],function(_0x3bde55){var _0x20357f={};_0x20357f[_0x3bde55]={'$like':'%'+_0x4dd93c['query'][_0xf2fa('0x9b')]+'%'};return _0x20357f;})});}_0x59b864[_0xf2fa('0x99')][_0xf2fa('0x88')]=![];if(_0x4dd93c['query']['id']){_0x59b864[_0xf2fa('0x99')]['id']={'$gt':_0x4dd93c[_0xf2fa('0x36')]['id']};}_0x59b864=_[_0xf2fa('0x2f')]({},_0x59b864,_0x4dd93c[_0xf2fa('0x9f')]);return db['ChatMessage']['count']({'where':_0x59b864[_0xf2fa('0x99')]})[_0xf2fa('0x15')](function(_0x5776d7){_0x1ae891['count']=_0x5776d7;_0x59b864[_0xf2fa('0xa0')]=[];if(_0x4dd93c[_0xf2fa('0x36')][_0xf2fa('0xa5')]){_0x59b864[_0xf2fa('0xa0')][_0xf2fa('0xa6')]({'model':db['User'],'as':'User','attributes':['id',_0xf2fa('0x4e'),_0xf2fa('0x83')]});}if(_0x4dd93c[_0xf2fa('0x36')][_0xf2fa('0x42')]){_0x59b864[_0xf2fa('0xa0')]=[{'all':!![]}];}return db[_0xf2fa('0x5b')][_0xf2fa('0xa1')](_0x59b864);})[_0xf2fa('0x15')](function(_0x430fdb){_0x1ae891['rows']=_0x430fdb;return _0x1ae891;});}})['then'](respondWithFilteredResult(_0x2ac43c,_0x59b864))['catch'](handleError(_0x2ac43c,null));};exports['addTags']=function(_0x2dd141,_0x16f79d){return db[_0xf2fa('0x3a')][_0xf2fa('0x45')]({'where':{'id':_0x2dd141['params']['id']}})[_0xf2fa('0x15')](handleEntityNotFound(_0x16f79d,null))[_0xf2fa('0x15')](function(_0x424dc4){if(_0x424dc4){return _0x424dc4[_0xf2fa('0xa7')](_0x2dd141[_0xf2fa('0x44')][_0xf2fa('0x94')],_[_0xf2fa('0x93')](_0x2dd141[_0xf2fa('0x44')],[_0xf2fa('0x94'),'id'])||{})[_0xf2fa('0xa8')](function(){return db[_0xf2fa('0xa9')][_0xf2fa('0xa1')]({'attributes':['id',_0xf2fa('0x2c'),'color'],'where':{'id':_0x2dd141[_0xf2fa('0x44')][_0xf2fa('0x94')]}});})[_0xf2fa('0x15')](function(_0x20a488){socket[_0xf2fa('0xaa')](_0xf2fa('0xab'),{'id':Number(_0x2dd141[_0xf2fa('0x38')]['id']),'tags':_0x20a488||[]});return{'id':Number(_0x2dd141['params']['id']),'tags':_0x20a488||[]};});}})[_0xf2fa('0x15')](respondWithResult(_0x16f79d,null))[_0xf2fa('0x1e')](handleError(_0x16f79d,null));};exports[_0xf2fa('0xac')]=function(_0x3b645a,_0xfb9985){return db[_0xf2fa('0x3a')][_0xf2fa('0x45')]({'where':{'id':_0x3b645a[_0xf2fa('0x38')]['id']}})['then'](handleEntityNotFound(_0xfb9985,null))[_0xf2fa('0x15')](function(_0x567bc8){if(_0x567bc8){return _0x567bc8[_0xf2fa('0xac')](_0x3b645a[_0xf2fa('0x36')][_0xf2fa('0x94')]);}})[_0xf2fa('0x15')](respondWithStatusCode(_0xfb9985,null))[_0xf2fa('0x1e')](handleError(_0xfb9985,null));};exports[_0xf2fa('0x71')]=function(_0x38b6e4,_0x278409){var _0x40433f=moment()[_0xf2fa('0xad')]()[_0xf2fa('0xae')]();var _0x428d86=path['join'](config[_0xf2fa('0x74')],_0xf2fa('0xaf'),_0xf2fa('0xb0'),_0xf2fa('0xb1'));var _0x3a23a6=path['join'](config[_0xf2fa('0x74')],_0xf2fa('0xaf'),'files',_0xf2fa('0xb2'));var _0x121fc8=path['join'](_0x428d86,_0x40433f);var _0x553b27=util[_0xf2fa('0x76')](_0xf2fa('0xb3'),_0x38b6e4['params']['id'],_0x40433f);var _0x59201f=path[_0xf2fa('0x6e')](_0x428d86,_0x553b27);var _0x3f0502=[];_0x3f0502['push']({'model':db[_0xf2fa('0x79')],'as':_0xf2fa('0x79'),'attributes':['id',_0xf2fa('0x4e')],'raw':!![]});_0x3f0502[_0xf2fa('0xa6')]({'model':db['CmContact'],'as':_0xf2fa('0xb4'),'attributes':['id',_0xf2fa('0xb5'),_0xf2fa('0xb6')],'raw':!![]});if(_0x38b6e4[_0xf2fa('0x36')][_0xf2fa('0xb2')]){_0x3f0502[_0xf2fa('0xa6')]({'model':db[_0xf2fa('0x69')],'as':_0xf2fa('0x69'),'raw':!![]});}var _0x32e3d9=[{'model':db['ChatMessage'],'as':_0xf2fa('0x7c'),'attributes':['id','body',_0xf2fa('0xb7'),'direction',_0xf2fa('0x88'),'read'],'include':_0x3f0502}];_0x32e3d9['push']({'model':db[_0xf2fa('0x7a')],'as':_0xf2fa('0xb8'),'attributes':['id',_0xf2fa('0x2c')]});_0x32e3d9[_0xf2fa('0xa6')]({'model':db[_0xf2fa('0x79')],'as':'Owner','attributes':['id',_0xf2fa('0x4e')]});return db[_0xf2fa('0x3a')]['find']({'where':{'id':_0x38b6e4[_0xf2fa('0x38')]['id']},'include':_0x32e3d9})[_0xf2fa('0x15')](handleEntityNotFound(_0x278409,null))[_0xf2fa('0x15')](function(_0x4e5c7f){if(_0x4e5c7f){var _0x2eab29=_0x4e5c7f[_0xf2fa('0xb9')]({'plain':!![]});fs['mkdirSync'](_0x121fc8);var _0x10663f={'channel':_0xf2fa('0xba'),'account':_0x2eab29[_0xf2fa('0xb8')][_0xf2fa('0x2c')],'agent':_0x2eab29[_0xf2fa('0xbb')]?_0x2eab29['Owner'][_0xf2fa('0x4e')]:_0xf2fa('0xbc'),'createdAt':moment(_0x2eab29[_0xf2fa('0xb7')])[_0xf2fa('0x76')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2eab29[_0xf2fa('0x62')]?moment(_0x2eab29[_0xf2fa('0xbd')])[_0xf2fa('0x76')](_0xf2fa('0x9e'))[_0xf2fa('0xae')]():'','disposition':_0x2eab29[_0xf2fa('0x63')],'chatInfo':{'browser':_0x2eab29[_0xf2fa('0xbe')],'os':_0x2eab29[_0xf2fa('0xbf')],'referer':_0x2eab29[_0xf2fa('0xc0')],'customerIp':_0x2eab29[_0xf2fa('0xc1')],'customerPort':_0x2eab29['customerPort']?_0x2eab29['customerPort']:_0xf2fa('0xbc')},'messages':_(_0x2eab29[_0xf2fa('0x7c')])[_0xf2fa('0xc2')]()[_0xf2fa('0x9b')]({'secret':![]})[_0xf2fa('0x32')](function(_0x5aea6e){if(_0x5aea6e[_0xf2fa('0x69')]){var _0x269b60=path[_0xf2fa('0x6e')](_0x3a23a6,_0x5aea6e[_0xf2fa('0x69')][_0xf2fa('0x67')]);if(fs[_0xf2fa('0xc3')](_0x269b60)){fs['createReadStream'](_0x269b60)[_0xf2fa('0xc4')](fs[_0xf2fa('0xc5')](path[_0xf2fa('0x6e')](_0x121fc8,_0x5aea6e[_0xf2fa('0x69')]['basename'])));}}return{'date':moment(_0x5aea6e[_0xf2fa('0xb7')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xf2fa('0xae')](),'sender':_0x5aea6e[_0xf2fa('0x87')]===_0xf2fa('0x5a')?_0x5aea6e[_0xf2fa('0x79')]?_0x5aea6e[_0xf2fa('0x79')][_0xf2fa('0x4e')]:_0xf2fa('0x7f'):_0x5aea6e[_0xf2fa('0xb4')][_0xf2fa('0xb5')]+(_0x5aea6e[_0xf2fa('0xb4')][_0xf2fa('0xb6')]?'\x20'+_0x5aea6e[_0xf2fa('0xb4')]['lastName']:''),'body':_0x5aea6e['Attachment']?_0x5aea6e['Attachment']['basename']:_0x5aea6e[_0xf2fa('0x44')],'direction':_0x5aea6e[_0xf2fa('0x87')]===_0xf2fa('0x5a')?'A':'C','secret':_0x5aea6e[_0xf2fa('0x88')],'read':_0x5aea6e[_0xf2fa('0xc6')],'attachment':_0x5aea6e[_0xf2fa('0x69')]};})[_0xf2fa('0xc7')]()};return ejs[_0xf2fa('0xc8')](path[_0xf2fa('0x6e')](config[_0xf2fa('0x74')],_0xf2fa('0xaf'),_0xf2fa('0xc9'),_0xf2fa('0xca')),{'interaction':_0x10663f})['then'](function(_0x580e53){var _0x426fcf=path[_0xf2fa('0x6e')](_0x121fc8,_0xf2fa('0xcb')+_0x2eab29['id']+'-'+_0x40433f+'.pdf');var _0x4c8b88={'path':_0x426fcf,'channel':_0xf2fa('0xba'),'interactionId':_0x2eab29['id']};return pdf[_0xf2fa('0xcc')](_0x580e53,_0x4c8b88);})[_0xf2fa('0x15')](function(){return new Promise(function(_0x1b336e,_0x343241){zipdir(_0x121fc8,{'saveTo':_0x59201f},function(_0x5848ea,_0x3d49f9){if(_0x5848ea)return _0x343241(_0x5848ea);return _0x1b336e(_0x3d49f9);});})[_0xf2fa('0x15')](function(){return new BPromise(function(_0x59eaf4,_0x438f3d){rimraf(_0x121fc8,function(_0x40b2b9){if(_0x40b2b9)_0x438f3d(_0x40b2b9);return _0x59eaf4();});});})['then'](function(){return _0x278409[_0xf2fa('0x71')](_0x59201f,_0x553b27,function(_0x5a482c){if(_0x5a482c){logger[_0xf2fa('0x1a')]('err',_0x5a482c);}else{fs[_0xf2fa('0xcd')](_0x59201f);}});});});}else{return _0x278409['sendStatus'](0xc8);}})['catch'](handleError(_0x278409,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5833d48..da7bc7c 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 _0xb67d=['findAll','unreadMessages','length','emit','hasOwnProperty','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','then','setDataValue','map'];(function(_0x2f10e3,_0x5018fe){var _0x37264=function(_0x6e2ce1){while(--_0x6e2ce1){_0x2f10e3['push'](_0x2f10e3['shift']());}};_0x37264(++_0x5018fe);}(_0xb67d,0x116));var _0xdb67=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb67d[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xdb67('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xdb67('0x1')];var ChatMessage=require(_0xdb67('0x2'))['db'][_0xdb67('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdb67('0x4')](0x0);var events={'afterCreate':_0xdb67('0x5'),'afterUpdate':_0xdb67('0x6'),'afterDestroy':'remove'};function emitEvent(_0x293dcb){return function(_0x990fca,_0x1f085d,_0x292cca){_0x990fca['getUsers']({'attributes':['id'],'raw':!![]})[_0xdb67('0x7')](function(_0x10fb08){_0x990fca[_0xdb67('0x8')]('Users',_0x10fb08[_0xdb67('0x9')](function(_0x7b2620){return{'id':_0x7b2620['id']};}));return ChatMessage[_0xdb67('0xa')]({'where':{'ChatInteractionId':_0x990fca['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdb67('0x7')](function(_0x2ab672){_0x990fca['setDataValue'](_0xdb67('0xb'),_0x2ab672[_0xdb67('0xc')]);ChatInteractionEvents['emit'](_0x293dcb+':'+_0x990fca['id'],_0x990fca);ChatInteractionEvents[_0xdb67('0xd')](_0x293dcb,_0x990fca);_0x292cca(null);})['catch'](_0x292cca(null));};}for(var e in events){if(events[_0xdb67('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xdb67('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x7ed4=['then','setDataValue','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x7ed4,0x182));var _0x47ed=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0x7ed4[_0x4cc280];return _0x16ed24;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x47ed('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x47ed('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47ed('0x1'),'afterUpdate':_0x47ed('0x2'),'afterDestroy':_0x47ed('0x3')};function emitEvent(_0x2b8bf2){return function(_0x2a7ebd,_0x53d383,_0x497689){_0x2a7ebd['getUsers']({'attributes':['id'],'raw':!![]})[_0x47ed('0x4')](function(_0x26bd9a){_0x2a7ebd[_0x47ed('0x5')]('Users',_0x26bd9a['map'](function(_0x374ed6){return{'id':_0x374ed6['id']};}));return ChatMessage[_0x47ed('0x6')]({'where':{'ChatInteractionId':_0x2a7ebd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x47ed('0x4')](function(_0x20d1b0){_0x2a7ebd[_0x47ed('0x5')](_0x47ed('0x7'),_0x20d1b0[_0x47ed('0x8')]);ChatInteractionEvents[_0x47ed('0x9')](_0x2b8bf2+':'+_0x2a7ebd['id'],_0x2a7ebd);ChatInteractionEvents['emit'](_0x2b8bf2,_0x2a7ebd);_0x497689(null);})['catch'](_0x497689(null));};}for(var e in events){if(events[_0x47ed('0xa')](e)){var event=events[e];ChatInteraction[_0x47ed('0xb')](e,emitEvent(event));}}module[_0x47ed('0xc')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e6b26a7..0bd14c9 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 _0xaefa=['closedAt','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed'];(function(_0x51c343,_0xf63b5){var _0x4d3855=function(_0x55721a){while(--_0x55721a){_0x51c343['push'](_0x51c343['shift']());}};_0x4d3855(++_0xf63b5);}(_0xaefa,0x64));var _0xaaef=function(_0x386c03,_0x32b041){_0x386c03=_0x386c03-0x0;var _0x4806fa=_0xaefa[_0x386c03];return _0x4806fa;};'use strict';var _=require('lodash');var util=require(_0xaaef('0x0'));var logger=require(_0xaaef('0x1'))('api');var moment=require(_0xaaef('0x2'));var BPromise=require(_0xaaef('0x3'));var rp=require(_0xaaef('0x4'));var fs=require('fs');var path=require(_0xaaef('0x5'));var rimraf=require('rimraf');var config=require(_0xaaef('0x6'));var attributes=require(_0xaaef('0x7'));module[_0xaaef('0x8')]=function(_0x54b113,_0x260933){return _0x54b113[_0xaaef('0x9')](_0xaaef('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x800f18,_0x1f0b5a,_0x29659){if(_0x800f18[_0xaaef('0xb')]('closed')){_0x800f18[_0xaaef('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x29659(null,_0x800f18);}},'charset':'utf8mb4','collate':_0xaaef('0xd')});}; \ No newline at end of file +var _0xd1cc=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','changed','closed','closedAt'];(function(_0x3f0c4d,_0x36c466){var _0x4789fd=function(_0x3e2c36){while(--_0x3e2c36){_0x3f0c4d['push'](_0x3f0c4d['shift']());}};_0x4789fd(++_0x36c466);}(_0xd1cc,0x76));var _0xcd1c=function(_0x6d7d6d,_0x401215){_0x6d7d6d=_0x6d7d6d-0x0;var _0x34dc6d=_0xd1cc[_0x6d7d6d];return _0x34dc6d;};'use strict';var _=require(_0xcd1c('0x0'));var util=require('util');var logger=require(_0xcd1c('0x1'))(_0xcd1c('0x2'));var moment=require(_0xcd1c('0x3'));var BPromise=require(_0xcd1c('0x4'));var rp=require(_0xcd1c('0x5'));var fs=require('fs');var path=require(_0xcd1c('0x6'));var rimraf=require(_0xcd1c('0x7'));var config=require(_0xcd1c('0x8'));var attributes=require(_0xcd1c('0x9'));module['exports']=function(_0x18aed3,_0x2c0bae){return _0x18aed3[_0xcd1c('0xa')](_0xcd1c('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4bfc3d,_0x2b153,_0x3b3f54){if(_0x4bfc3d[_0xcd1c('0xc')](_0xcd1c('0xd'))){_0x4bfc3d[_0xcd1c('0xe')]=moment()[_0xcd1c('0xf')](_0xcd1c('0x10'));}_0x3b3f54(null,_0x4bfc3d);}},'charset':_0xcd1c('0x11'),'collate':_0xcd1c('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 040937b..e8bbf46 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 _0x2000=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','ChatInteraction','update','raw','options','attributes','limit','info','UpdateChatInteraction','stringify','catch','AddTagsToChatInteraction','where','addTags','body','ids','omit','AddTags','lodash'];(function(_0x53e4ab,_0x22e0cb){var _0x21bb4f=function(_0x107787){while(--_0x107787){_0x53e4ab['push'](_0x53e4ab['shift']());}};_0x21bb4f(++_0x22e0cb);}(_0x2000,0x13f));var _0x0200=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0x2000[_0x1d3791];return _0x40fbf5;};'use strict';var _=require(_0x0200('0x0'));var util=require(_0x0200('0x1'));var moment=require('moment');var BPromise=require(_0x0200('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0200('0x3'));var db=require(_0x0200('0x4'))['db'];var utils=require(_0x0200('0x5'));var logger=require(_0x0200('0x6'))(_0x0200('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0200('0x8')][_0x0200('0x9')]({'port':0x232a});config[_0x0200('0xa')]=_['defaults'](config[_0x0200('0xa')],{'host':_0x0200('0xb'),'port':0x18eb});var socket=require(_0x0200('0xc'))(new Redis(config[_0x0200('0xa')]));require('./chatInteraction.socket')[_0x0200('0xd')](socket);function respondWithRpcPromise(_0x22b43a,_0x4071df,_0x10a728){return new BPromise(function(_0x264556,_0x42c5e0){return client[_0x0200('0xe')](_0x22b43a,_0x10a728)[_0x0200('0xf')](function(_0x37b067){logger['info'](_0x0200('0x10'),_0x4071df,'request\x20sent');logger[_0x0200('0x11')](_0x0200('0x12'),_0x4071df,_0x0200('0x13'),JSON['stringify'](_0x37b067));if(_0x37b067[_0x0200('0x14')]){if(_0x37b067[_0x0200('0x14')]['code']===0x1f4){logger[_0x0200('0x14')](_0x0200('0x10'),_0x4071df,_0x37b067[_0x0200('0x14')]['message']);return _0x42c5e0(_0x37b067[_0x0200('0x14')]['message']);}logger[_0x0200('0x14')](_0x0200('0x10'),_0x4071df,_0x37b067[_0x0200('0x14')]['message']);return _0x264556(_0x37b067[_0x0200('0x14')][_0x0200('0x15')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4071df,_0x0200('0x13'));_0x264556(_0x37b067[_0x0200('0x16')][_0x0200('0x15')]);}})['catch'](function(_0x5d2850){logger[_0x0200('0x14')](_0x0200('0x10'),_0x4071df,_0x5d2850);_0x42c5e0(_0x5d2850);});});}exports['UpdateChatInteraction']=function(_0x21c8ed){var _0x1aadd4=this;return new Promise(function(_0x302c4f,_0x149929){return db[_0x0200('0x17')][_0x0200('0x18')](_0x21c8ed['body'],{'raw':_0x21c8ed['options']?_0x21c8ed['options'][_0x0200('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21c8ed[_0x0200('0x1a')]?_0x21c8ed['options']['where']||null:null,'attributes':_0x21c8ed[_0x0200('0x1a')]?_0x21c8ed[_0x0200('0x1a')][_0x0200('0x1b')]||null:null,'limit':_0x21c8ed[_0x0200('0x1a')]?_0x21c8ed['options'][_0x0200('0x1c')]||null:null})[_0x0200('0xf')](function(_0x5df627){logger[_0x0200('0x1d')]('UpdateChatInteraction',_0x21c8ed);logger[_0x0200('0x11')](_0x0200('0x1e'),_0x21c8ed,JSON[_0x0200('0x1f')](_0x5df627));_0x302c4f(_0x5df627);})[_0x0200('0x20')](function(_0x2ea1d4){logger[_0x0200('0x14')](_0x0200('0x1e'),_0x2ea1d4[_0x0200('0x15')],_0x21c8ed);_0x149929(_0x1aadd4[_0x0200('0x14')](0x1f4,_0x2ea1d4[_0x0200('0x15')]));});});};exports[_0x0200('0x21')]=function(_0x52d7c5){return new Promise(function(_0x1bbc61,_0x40cbbc){return db['ChatInteraction']['find']({'where':_0x52d7c5[_0x0200('0x1a')]?_0x52d7c5[_0x0200('0x1a')][_0x0200('0x22')]||null:null})[_0x0200('0xf')](function(_0x1b676f){if(_0x1b676f){return _0x1b676f[_0x0200('0x23')](_0x52d7c5[_0x0200('0x24')][_0x0200('0x25')],_[_0x0200('0x26')](_0x52d7c5[_0x0200('0x24')],[_0x0200('0x25'),'id'])||{});}})['spread'](function(_0x219c0e){logger['info'](_0x0200('0x27'),_0x52d7c5);logger[_0x0200('0x11')](_0x0200('0x27'),_0x52d7c5,JSON[_0x0200('0x1f')](_0x219c0e));_0x1bbc61(_0x219c0e);})[_0x0200('0x20')](function(_0x1318b8){logger[_0x0200('0x14')](_0x0200('0x27'),_0x1318b8[_0x0200('0x15')],_0x52d7c5);_0x40cbbc(_this[_0x0200('0x14')](0x1f4,_0x1318b8[_0x0200('0x15')]));});});}; \ No newline at end of file +var _0xf7f4=['find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateChatInteraction','update','body','options','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction'];(function(_0xe33dfe,_0x326077){var _0x4eaed0=function(_0x5c448a){while(--_0x5c448a){_0xe33dfe['push'](_0xe33dfe['shift']());}};_0x4eaed0(++_0x326077);}(_0xf7f4,0xd8));var _0x4f7f=function(_0x30b734,_0x17baf6){_0x30b734=_0x30b734-0x0;var _0x2c4c07=_0xf7f4[_0x30b734];return _0x2c4c07;};'use strict';var _=require(_0x4f7f('0x0'));var util=require('util');var moment=require(_0x4f7f('0x1'));var BPromise=require(_0x4f7f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f7f('0x3'));var db=require(_0x4f7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f7f('0x5'))(_0x4f7f('0x6'));var config=require(_0x4f7f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4f7f('0x8')][_0x4f7f('0x9')]({'port':0x232a});config[_0x4f7f('0xa')]=_['defaults'](config['redis'],{'host':_0x4f7f('0xb'),'port':0x18eb});var socket=require(_0x4f7f('0xc'))(new Redis(config[_0x4f7f('0xa')]));require(_0x4f7f('0xd'))[_0x4f7f('0xe')](socket);function respondWithRpcPromise(_0x13b0b9,_0x2f1c06,_0xf556a0){return new BPromise(function(_0x5cf9a6,_0x3ad9b4){return client['request'](_0x13b0b9,_0xf556a0)[_0x4f7f('0xf')](function(_0x5bc629){logger[_0x4f7f('0x10')](_0x4f7f('0x11'),_0x2f1c06,'request\x20sent');logger[_0x4f7f('0x12')](_0x4f7f('0x13'),_0x2f1c06,'request\x20sent',JSON[_0x4f7f('0x14')](_0x5bc629));if(_0x5bc629[_0x4f7f('0x15')]){if(_0x5bc629[_0x4f7f('0x15')][_0x4f7f('0x16')]===0x1f4){logger[_0x4f7f('0x15')](_0x4f7f('0x11'),_0x2f1c06,_0x5bc629[_0x4f7f('0x15')][_0x4f7f('0x17')]);return _0x3ad9b4(_0x5bc629[_0x4f7f('0x15')][_0x4f7f('0x17')]);}logger[_0x4f7f('0x15')](_0x4f7f('0x11'),_0x2f1c06,_0x5bc629[_0x4f7f('0x15')][_0x4f7f('0x17')]);return _0x5cf9a6(_0x5bc629[_0x4f7f('0x15')][_0x4f7f('0x17')]);}else{logger[_0x4f7f('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x2f1c06,_0x4f7f('0x18'));_0x5cf9a6(_0x5bc629[_0x4f7f('0x19')][_0x4f7f('0x17')]);}})[_0x4f7f('0x1a')](function(_0x292683){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2f1c06,_0x292683);_0x3ad9b4(_0x292683);});});}exports[_0x4f7f('0x1b')]=function(_0x52300d){var _0x362b3c=this;return new Promise(function(_0x4e023f,_0x1dbbca){return db['ChatInteraction'][_0x4f7f('0x1c')](_0x52300d[_0x4f7f('0x1d')],{'raw':_0x52300d[_0x4f7f('0x1e')]?_0x52300d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52300d[_0x4f7f('0x1e')]?_0x52300d['options'][_0x4f7f('0x1f')]||null:null,'attributes':_0x52300d[_0x4f7f('0x1e')]?_0x52300d[_0x4f7f('0x1e')][_0x4f7f('0x20')]||null:null,'limit':_0x52300d[_0x4f7f('0x1e')]?_0x52300d[_0x4f7f('0x1e')][_0x4f7f('0x21')]||null:null})[_0x4f7f('0xf')](function(_0x5c9366){logger[_0x4f7f('0x10')]('UpdateChatInteraction',_0x52300d);logger['debug']('UpdateChatInteraction',_0x52300d,JSON[_0x4f7f('0x14')](_0x5c9366));_0x4e023f(_0x5c9366);})[_0x4f7f('0x1a')](function(_0x15286a){logger[_0x4f7f('0x15')](_0x4f7f('0x1b'),_0x15286a[_0x4f7f('0x17')],_0x52300d);_0x1dbbca(_0x362b3c[_0x4f7f('0x15')](0x1f4,_0x15286a[_0x4f7f('0x17')]));});});};exports[_0x4f7f('0x22')]=function(_0x50719f){return new Promise(function(_0x555a15,_0x340fc3){return db[_0x4f7f('0x23')][_0x4f7f('0x24')]({'where':_0x50719f[_0x4f7f('0x1e')]?_0x50719f[_0x4f7f('0x1e')][_0x4f7f('0x1f')]||null:null})[_0x4f7f('0xf')](function(_0x15513b){if(_0x15513b){return _0x15513b[_0x4f7f('0x25')](_0x50719f[_0x4f7f('0x1d')][_0x4f7f('0x26')],_[_0x4f7f('0x27')](_0x50719f[_0x4f7f('0x1d')],[_0x4f7f('0x26'),'id'])||{});}})[_0x4f7f('0x28')](function(_0x392a61){logger[_0x4f7f('0x10')](_0x4f7f('0x29'),_0x50719f);logger[_0x4f7f('0x12')](_0x4f7f('0x29'),_0x50719f,JSON[_0x4f7f('0x14')](_0x392a61));_0x555a15(_0x392a61);})[_0x4f7f('0x1a')](function(_0x550052){logger[_0x4f7f('0x15')](_0x4f7f('0x29'),_0x550052[_0x4f7f('0x17')],_0x50719f);_0x340fc3(_this[_0x4f7f('0x15')](0x1f4,_0x550052[_0x4f7f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 63d2b79..0ef2291 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 _0x28bc=['emit','removeListener','register','length','chatInteraction:','remove'];(function(_0x6bd2c1,_0x1ff03d){var _0x4f7c03=function(_0x3238d4){while(--_0x3238d4){_0x6bd2c1['push'](_0x6bd2c1['shift']());}};_0x4f7c03(++_0x1ff03d);}(_0x28bc,0xf5));var _0xc28b=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x28bc[_0x35a274];return _0x40d905;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xc28b('0x0'),'update'];function createListener(_0x2bf447,_0x39a141){return function(_0x57b981){_0x39a141[_0xc28b('0x1')](_0x2bf447,_0x57b981);};}function removeListener(_0x38b1eb,_0x491178){return function(){ChatInteractionEvents[_0xc28b('0x2')](_0x38b1eb,_0x491178);};}exports[_0xc28b('0x3')]=function(_0x1e2848){for(var _0x5c1be7=0x0,_0x4cdf9c=events[_0xc28b('0x4')];_0x5c1be7<_0x4cdf9c;_0x5c1be7++){var _0x2266d2=events[_0x5c1be7];var _0x20b169=createListener(_0xc28b('0x5')+_0x2266d2,_0x1e2848);ChatInteractionEvents['on'](_0x2266d2,_0x20b169);}}; \ No newline at end of file +var _0x58e4=['emit','register','length','chatInteraction:','./chatInteraction.events','remove','update'];(function(_0x2b7b29,_0x59b527){var _0x179776=function(_0x414f34){while(--_0x414f34){_0x2b7b29['push'](_0x2b7b29['shift']());}};_0x179776(++_0x59b527);}(_0x58e4,0x1c4));var _0x458e=function(_0x2e9b61,_0x2120cf){_0x2e9b61=_0x2e9b61-0x0;var _0x597ccd=_0x58e4[_0x2e9b61];return _0x597ccd;};'use strict';var ChatInteractionEvents=require(_0x458e('0x0'));var events=['save',_0x458e('0x1'),_0x458e('0x2')];function createListener(_0x1cfd14,_0x34c66f){return function(_0x22d432){_0x34c66f[_0x458e('0x3')](_0x1cfd14,_0x22d432);};}function removeListener(_0x17f459,_0x304b9c){return function(){ChatInteractionEvents['removeListener'](_0x17f459,_0x304b9c);};}exports[_0x458e('0x4')]=function(_0x2c628a){for(var _0x4eb896=0x0,_0x4a54c0=events[_0x458e('0x5')];_0x4eb896<_0x4a54c0;_0x4eb896++){var _0x3025b9=events[_0x4eb896];var _0x2d4560=createListener(_0x458e('0x6')+_0x3025b9,_0x2c628a);ChatInteractionEvents['on'](_0x3025b9,_0x2d4560);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 226bf0a..386323d 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 _0x15b4=['/:id/attachment_upload','file','tracked','chat','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','/:id/download','download','post','create','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace'];(function(_0x4d9acc,_0x5c8738){var _0x5e0d3a=function(_0x5ce4c1){while(--_0x5ce4c1){_0x4d9acc['push'](_0x4d9acc['shift']());}};_0x5e0d3a(++_0x5c8738);}(_0x15b4,0x74));var _0x415b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x15b4[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x415b('0x0'));var util=require(_0x415b('0x1'));var path=require(_0x415b('0x2'));var timeout=require(_0x415b('0x3'));var express=require(_0x415b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x415b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x415b('0x6'));router[_0x415b('0x7')]('/',auth[_0x415b('0x8')](),controller[_0x415b('0x9')]);router[_0x415b('0x7')](_0x415b('0xa'),auth[_0x415b('0x8')](),controller[_0x415b('0xb')]);router['get'](_0x415b('0xc'),auth[_0x415b('0xd')](),controller[_0x415b('0xe')]);router[_0x415b('0x7')](_0x415b('0xf'),auth[_0x415b('0xd')](),controller[_0x415b('0x10')]);router['get']('/:id/messages',auth[_0x415b('0x8')](),controller[_0x415b('0x11')]);router[_0x415b('0x7')](_0x415b('0x12'),auth[_0x415b('0xd')](),controller['getMyMessages']);router['get'](_0x415b('0x13'),auth[_0x415b('0x8')](),controller[_0x415b('0x14')]);router[_0x415b('0x15')]('/',auth['isAuthenticated'](),controller[_0x415b('0x16')]);router[_0x415b('0x15')]('/:id/vidaoo',auth[_0x415b('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x235b51,_0x19bb43,_0xcda6b3){_0xcda6b3(null,path[_0x415b('0x17')](config[_0x415b('0x18')],_0x415b('0x19')));},'filename':function(_0x5776aa,_0x585e9e,_0x34a243){_0x34a243(null,util[_0x415b('0x1a')](_0x415b('0x1b'),Date[_0x415b('0x1c')](),_0x585e9e[_0x415b('0x1d')][_0x415b('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x415b('0x15')](_0x415b('0x1f'),upload['single'](_0x415b('0x20')),controller['attachmentUpload']);router[_0x415b('0x15')]('/:id/messages',auth[_0x415b('0xd')](),controller['addMessage']);router[_0x415b('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x415b('0x21')](_0x415b('0x22'),'chatinteraction:addtags'),controller[_0x415b('0x23')]);router[_0x415b('0x24')](_0x415b('0xc'),auth[_0x415b('0x8')](),interaction[_0x415b('0x21')]('chat',_0x415b('0x25')),controller[_0x415b('0x26')]);router[_0x415b('0x24')](_0x415b('0x27'),controller[_0x415b('0x28')]);router['put'](_0x415b('0x29'),auth[_0x415b('0xd')](),controller[_0x415b('0x2a')]);router[_0x415b('0x24')](_0x415b('0x2b'),controller['close']);router[_0x415b('0x2c')](_0x415b('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x415b('0x22'),_0x415b('0x2d')),controller[_0x415b('0x2e')]);router[_0x415b('0x2c')](_0x415b('0x2f'),auth['isAuthenticated'](),controller['removeTags']);module[_0x415b('0x30')]=router; \ No newline at end of file +var _0xc1e2=['attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','/:id/tags','exports','multer','path','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','diskStorage','join','root','server/files/attachments/','%s-%s','originalname','single'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0xc1e2,0xa5));var _0x2c1e=function(_0x2708c3,_0x2149c4){_0x2708c3=_0x2708c3-0x0;var _0x803a64=_0xc1e2[_0x2708c3];return _0x803a64;};'use strict';var multer=require(_0x2c1e('0x0'));var util=require('util');var path=require(_0x2c1e('0x1'));var timeout=require('connect-timeout');var express=require(_0x2c1e('0x2'));var router=express[_0x2c1e('0x3')]();var fs_extra=require(_0x2c1e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c1e('0x5'));var controller=require(_0x2c1e('0x6'));router[_0x2c1e('0x7')]('/',auth[_0x2c1e('0x8')](),controller[_0x2c1e('0x9')]);router[_0x2c1e('0x7')](_0x2c1e('0xa'),auth[_0x2c1e('0x8')](),controller[_0x2c1e('0xb')]);router['get'](_0x2c1e('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x2c1e('0xd')]);router['get'](_0x2c1e('0xe'),auth[_0x2c1e('0xf')](),controller[_0x2c1e('0x10')]);router['get']('/:id/messages',auth[_0x2c1e('0x8')](),controller[_0x2c1e('0x11')]);router['get'](_0x2c1e('0x12'),auth[_0x2c1e('0xf')](),controller[_0x2c1e('0x13')]);router[_0x2c1e('0x7')](_0x2c1e('0x14'),auth['isAuthenticated'](),controller[_0x2c1e('0x15')]);router['post']('/',auth[_0x2c1e('0x8')](),controller[_0x2c1e('0x16')]);router[_0x2c1e('0x17')]('/:id/vidaoo',auth[_0x2c1e('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x2c1e('0x18')]({'destination':function(_0x5c7e5c,_0x13f03d,_0xb473db){_0xb473db(null,path[_0x2c1e('0x19')](config[_0x2c1e('0x1a')],_0x2c1e('0x1b')));},'filename':function(_0x407590,_0x2ed754,_0x5715c6){_0x5715c6(null,util['format'](_0x2c1e('0x1c'),Date['now'](),_0x2ed754[_0x2c1e('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2c1e('0x17')]('/:id/attachment_upload',upload[_0x2c1e('0x1e')]('file'),controller[_0x2c1e('0x1f')]);router['post'](_0x2c1e('0x20'),auth[_0x2c1e('0xf')](),controller[_0x2c1e('0x21')]);router[_0x2c1e('0x17')]('/:id/tags',auth[_0x2c1e('0x8')](),interaction[_0x2c1e('0x22')](_0x2c1e('0x23'),_0x2c1e('0x24')),controller[_0x2c1e('0x25')]);router[_0x2c1e('0x26')](_0x2c1e('0xc'),auth['isAuthenticated'](),interaction[_0x2c1e('0x22')](_0x2c1e('0x23'),'chatinteraction:update'),controller['update']);router['put'](_0x2c1e('0x27'),controller[_0x2c1e('0x28')]);router['put'](_0x2c1e('0x29'),auth[_0x2c1e('0xf')](),controller[_0x2c1e('0x2a')]);router['put']('/:id/close',controller[_0x2c1e('0x2b')]);router[_0x2c1e('0x2c')](_0x2c1e('0xc'),auth[_0x2c1e('0x8')](),interaction[_0x2c1e('0x22')](_0x2c1e('0x23'),_0x2c1e('0x2d')),controller[_0x2c1e('0x2e')]);router[_0x2c1e('0x2c')](_0x2c1e('0x2f'),auth[_0x2c1e('0x8')](),controller['removeTags']);module[_0x2c1e('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 878c200..9a07860 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 _0x9ac5=['INTEGER','sequelize','exports','BOOLEAN'];(function(_0x8a0aed,_0x9370b5){var _0x3723fa=function(_0x25a50f){while(--_0x25a50f){_0x8a0aed['push'](_0x8a0aed['shift']());}};_0x3723fa(++_0x9370b5);}(_0x9ac5,0x141));var _0x59ac=function(_0x27eea1,_0x144cea){_0x27eea1=_0x27eea1-0x0;var _0x3e4f5b=_0x9ac5[_0x27eea1];return _0x3e4f5b;};'use strict';var Sequelize=require(_0x59ac('0x0'));module[_0x59ac('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x59ac('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x59ac('0x3')]}}; \ No newline at end of file +var _0xb0de=['medium','INTEGER','sequelize','TEXT'];(function(_0xc7006a,_0x26fe34){var _0x4b49d9=function(_0x4ee238){while(--_0x4ee238){_0xc7006a['push'](_0xc7006a['shift']());}};_0x4b49d9(++_0x26fe34);}(_0xb0de,0xc2));var _0xeb0d=function(_0x17369c,_0x57e58f){_0x17369c=_0x17369c-0x0;var _0x5d558e=_0xb0de[_0x17369c];return _0x5d558e;};'use strict';var Sequelize=require(_0xeb0d('0x0'));module['exports']={'body':{'type':Sequelize[_0xeb0d('0x1')](_0xeb0d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xeb0d('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index c89704c..d55dd93 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 _0x8dd0=['attributes','fields','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','rawAttributes','length','include','create','body','find','params','describe','get','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','ChatInternalMessage','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x2aa9da,_0x33c82d){var _0x5d2c88=function(_0x127a78){while(--_0x127a78){_0x2aa9da['push'](_0x2aa9da['shift']());}};_0x5d2c88(++_0x33c82d);}(_0x8dd0,0x112));var _0x08dd=function(_0x4ca280,_0x1a1c4b){_0x4ca280=_0x4ca280-0x0;var _0x4bff7a=_0x8dd0[_0x4ca280];return _0x4bff7a;};'use strict';var emlformat=require(_0x08dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08dd('0x1'));var jsonpatch=require(_0x08dd('0x2'));var rp=require(_0x08dd('0x3'));var moment=require(_0x08dd('0x4'));var BPromise=require(_0x08dd('0x5'));var Mustache=require(_0x08dd('0x6'));var util=require(_0x08dd('0x7'));var path=require(_0x08dd('0x8'));var sox=require(_0x08dd('0x9'));var csv=require(_0x08dd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08dd('0xb'));var _=require(_0x08dd('0xc'));var squel=require(_0x08dd('0xd'));var crypto=require(_0x08dd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x08dd('0xa'));var querystring=require(_0x08dd('0xf'));var Papa=require(_0x08dd('0x10'));var Redis=require(_0x08dd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x08dd('0x12'));var as=require(_0x08dd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x08dd('0x14'));var utils=require(_0x08dd('0x15'));var config=require(_0x08dd('0x16'));var licenseUtil=require(_0x08dd('0x17'));var db=require(_0x08dd('0x18'))['db'];config[_0x08dd('0x19')]=_['defaults'](config[_0x08dd('0x19')],{'host':_0x08dd('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08dd('0x19')]));require(_0x08dd('0x1b'))['register'](socket);function respondWithStatusCode(_0x4fd31a,_0x2d1c8a){_0x2d1c8a=_0x2d1c8a||0xcc;return function(_0x17045b){if(_0x17045b){return _0x4fd31a[_0x08dd('0x1c')](_0x2d1c8a);}return _0x4fd31a[_0x08dd('0x1d')](_0x2d1c8a)[_0x08dd('0x1e')]();};}function respondWithResult(_0x2ab3c6,_0x492528){_0x492528=_0x492528||0xc8;return function(_0x7e227b){if(_0x7e227b){return _0x2ab3c6['status'](_0x492528)[_0x08dd('0x1f')](_0x7e227b);}};}function respondWithFilteredResult(_0x314356,_0x4ff1c2){return function(_0x87ad4){if(_0x87ad4){var _0x178fae=typeof _0x4ff1c2['offset']===_0x08dd('0x20')&&typeof _0x4ff1c2[_0x08dd('0x21')]===_0x08dd('0x20');var _0x109d03=_0x87ad4[_0x08dd('0x22')];var _0xf4d44a=_0x178fae?0x0:_0x4ff1c2[_0x08dd('0x23')];var _0x2454aa=_0x178fae?_0x87ad4[_0x08dd('0x22')]:_0x4ff1c2[_0x08dd('0x23')]+_0x4ff1c2[_0x08dd('0x21')];var _0x37d398;if(_0x2454aa>=_0x109d03){_0x2454aa=_0x109d03;_0x37d398=0xc8;}else{_0x37d398=0xce;}_0x314356[_0x08dd('0x1d')](_0x37d398);return _0x314356['set'](_0x08dd('0x24'),_0xf4d44a+'-'+_0x2454aa+'/'+_0x109d03)[_0x08dd('0x1f')](_0x87ad4);}return null;};}function patchUpdates(_0xa566de){return function(_0x2da508){try{jsonpatch[_0x08dd('0x25')](_0x2da508,_0xa566de,!![]);}catch(_0x46beaa){return BPromise[_0x08dd('0x26')](_0x46beaa);}return _0x2da508['save']();};}function saveUpdates(_0x31947a,_0x14008b){return function(_0x1155c7){if(_0x1155c7){return _0x1155c7[_0x08dd('0x27')](_0x31947a)['then'](function(_0xb3c9d5){return _0xb3c9d5;});}return null;};}function removeEntity(_0x268a03,_0xc0eb9d){return function(_0x46fe8f){if(_0x46fe8f){return _0x46fe8f[_0x08dd('0x28')]()[_0x08dd('0x29')](function(){_0x268a03['status'](0xcc)[_0x08dd('0x1e')]();});}};}function handleEntityNotFound(_0x3e4042,_0x2c047f){return function(_0x388a24){if(!_0x388a24){_0x3e4042[_0x08dd('0x1c')](0x194);}return _0x388a24;};}function handleError(_0x47b19a,_0x3ecac3){_0x3ecac3=_0x3ecac3||0x1f4;return function(_0x4ba6ad){logger[_0x08dd('0x2a')](_0x4ba6ad[_0x08dd('0x2b')]);if(_0x4ba6ad[_0x08dd('0x2c')]){delete _0x4ba6ad[_0x08dd('0x2c')];}_0x47b19a['status'](_0x3ecac3)[_0x08dd('0x2d')](_0x4ba6ad);};}exports[_0x08dd('0x2e')]=function(_0x4b4efd,_0x204fc7){var _0x50e8b3={},_0x380bbc={},_0x28ecbc={'count':0x0,'rows':[]};var _0x4e736f=_['map'](db[_0x08dd('0x2f')]['rawAttributes'],function(_0xfbbfe2){return{'name':_0xfbbfe2[_0x08dd('0x30')],'type':_0xfbbfe2[_0x08dd('0x31')][_0x08dd('0x32')]};});_0x380bbc[_0x08dd('0x33')]=_[_0x08dd('0x34')](_0x4e736f,_0x08dd('0x2c'));_0x380bbc[_0x08dd('0x35')]=_[_0x08dd('0x36')](_0x4b4efd[_0x08dd('0x35')]);_0x380bbc['filters']=_[_0x08dd('0x37')](_0x380bbc[_0x08dd('0x33')],_0x380bbc['query']);_0x50e8b3[_0x08dd('0x38')]=_['intersection'](_0x380bbc[_0x08dd('0x33')],qs[_0x08dd('0x39')](_0x4b4efd[_0x08dd('0x35')][_0x08dd('0x39')]));_0x50e8b3[_0x08dd('0x38')]=_0x50e8b3[_0x08dd('0x38')]['length']?_0x50e8b3[_0x08dd('0x38')]:_0x380bbc['model'];if(!_0x4b4efd['query']['hasOwnProperty'](_0x08dd('0x3a'))){_0x50e8b3[_0x08dd('0x21')]=qs[_0x08dd('0x21')](_0x4b4efd[_0x08dd('0x35')][_0x08dd('0x21')]);_0x50e8b3['offset']=qs['offset'](_0x4b4efd[_0x08dd('0x35')][_0x08dd('0x23')]);}_0x50e8b3[_0x08dd('0x3b')]=qs['sort'](_0x4b4efd[_0x08dd('0x35')][_0x08dd('0x3c')]);_0x50e8b3[_0x08dd('0x3d')]=qs[_0x08dd('0x3e')](_[_0x08dd('0x3f')](_0x4b4efd['query'],_0x380bbc[_0x08dd('0x3e')]),_0x4e736f);if(_0x4b4efd['query']['filter']){_0x50e8b3[_0x08dd('0x3d')]=_['merge'](_0x50e8b3[_0x08dd('0x3d')],{'$or':_['map'](_0x4e736f,function(_0x38e071){if(_0x38e071['type']!==_0x08dd('0x40')){var _0x567fa8={};_0x567fa8[_0x38e071[_0x08dd('0x2c')]]={'$like':'%'+_0x4b4efd['query'][_0x08dd('0x41')]+'%'};return _0x567fa8;}})});}_0x50e8b3=_[_0x08dd('0x42')]({},_0x50e8b3,_0x4b4efd[_0x08dd('0x43')]);var _0x1693c9={'where':_0x50e8b3[_0x08dd('0x3d')]};return db[_0x08dd('0x2f')]['count'](_0x1693c9)['then'](function(_0x3adc1a){_0x28ecbc['count']=_0x3adc1a;if(_0x4b4efd[_0x08dd('0x35')][_0x08dd('0x44')]){_0x50e8b3['include']=[{'all':!![]}];}return db[_0x08dd('0x2f')][_0x08dd('0x45')](_0x50e8b3);})[_0x08dd('0x29')](function(_0x4c88a0){_0x28ecbc['rows']=_0x4c88a0;return _0x28ecbc;})[_0x08dd('0x29')](respondWithFilteredResult(_0x204fc7,_0x50e8b3))[_0x08dd('0x46')](handleError(_0x204fc7,null));};exports[_0x08dd('0x47')]=function(_0x15e0f6,_0xb17f88){var _0x193fc0={'raw':!![],'where':{'id':_0x15e0f6['params']['id']}},_0x9aea12={};_0x9aea12[_0x08dd('0x33')]=_[_0x08dd('0x36')](db[_0x08dd('0x2f')][_0x08dd('0x48')]);_0x9aea12['query']=_[_0x08dd('0x36')](_0x15e0f6[_0x08dd('0x35')]);_0x9aea12[_0x08dd('0x3e')]=_['intersection'](_0x9aea12['model'],_0x9aea12[_0x08dd('0x35')]);_0x193fc0['attributes']=_[_0x08dd('0x37')](_0x9aea12[_0x08dd('0x33')],qs['fields'](_0x15e0f6[_0x08dd('0x35')][_0x08dd('0x39')]));_0x193fc0[_0x08dd('0x38')]=_0x193fc0[_0x08dd('0x38')][_0x08dd('0x49')]?_0x193fc0[_0x08dd('0x38')]:_0x9aea12[_0x08dd('0x33')];if(_0x15e0f6['query'][_0x08dd('0x44')]){_0x193fc0[_0x08dd('0x4a')]=[{'all':!![]}];}_0x193fc0=_['merge']({},_0x193fc0,_0x15e0f6[_0x08dd('0x43')]);return db['ChatInternalMessage']['find'](_0x193fc0)['then'](handleEntityNotFound(_0xb17f88,null))[_0x08dd('0x29')](respondWithResult(_0xb17f88,null))[_0x08dd('0x46')](handleError(_0xb17f88,null));};exports[_0x08dd('0x4b')]=function(_0x31a4d9,_0x4b803b){return db[_0x08dd('0x2f')][_0x08dd('0x4b')](_0x31a4d9[_0x08dd('0x4c')],{})[_0x08dd('0x29')](respondWithResult(_0x4b803b,0xc9))[_0x08dd('0x46')](handleError(_0x4b803b,null));};exports['update']=function(_0x164810,_0x26352f){if(_0x164810[_0x08dd('0x4c')]['id']){delete _0x164810[_0x08dd('0x4c')]['id'];}return db[_0x08dd('0x2f')][_0x08dd('0x4d')]({'where':{'id':_0x164810[_0x08dd('0x4e')]['id']}})[_0x08dd('0x29')](handleEntityNotFound(_0x26352f,null))['then'](saveUpdates(_0x164810[_0x08dd('0x4c')],null))['then'](respondWithResult(_0x26352f,null))[_0x08dd('0x46')](handleError(_0x26352f,null));};exports['destroy']=function(_0x10b14d,_0x5803a6){return db[_0x08dd('0x2f')][_0x08dd('0x4d')]({'where':{'id':_0x10b14d[_0x08dd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5803a6,null))['then'](removeEntity(_0x5803a6,null))[_0x08dd('0x46')](handleError(_0x5803a6,null));};exports[_0x08dd('0x4f')]=function(_0x5753d6,_0x192ccf){return db['ChatInternalMessage'][_0x08dd('0x4f')]()[_0x08dd('0x29')](respondWithResult(_0x192ccf,null))[_0x08dd('0x46')](handleError(_0x192ccf,null));};function wrapUser(_0x54f692){return function(_0x209e86){var _0x35e6fe=_0x54f692[_0x08dd('0x50')]({'plain':!![]});_0x35e6fe['messages']=[];if(_0x209e86){_0x35e6fe[_0x08dd('0x51')]=_0x209e86['createdAt'];_0x35e6fe['lastMessage']=_0x209e86;}else{_0x35e6fe[_0x08dd('0x51')]=moment(0x0)[_0x08dd('0x52')](_0x08dd('0x53'));_0x35e6fe[_0x08dd('0x54')]={};}return _0x35e6fe;};}exports['getUsers']=function(_0x2037b9,_0x5438e7,_0x58a357){var _0x546fa9=[];return db[_0x08dd('0x55')][_0x08dd('0x45')]({'where':{'role':[_0x08dd('0x56'),_0x08dd('0x57'),'user']},'attributes':['id',_0x08dd('0x58'),'name',_0x08dd('0x59'),_0x08dd('0x5a'),'internal',_0x08dd('0x5b'),_0x08dd('0x5c'),_0x08dd('0x5d'),_0x08dd('0x5e')],'order':qs[_0x08dd('0x3c')](_0x08dd('0x5f')),'include':[{'model':db[_0x08dd('0x60')],'as':_0x08dd('0x61'),'attributes':['id','name',_0x08dd('0x31')],'through':{'attributes':[]}}]})[_0x08dd('0x29')](function(_0x572dcc){if(_0x572dcc){var _0x52cfe2=_0x2037b9[_0x08dd('0x62')][_0x08dd('0x50')]({'plain':!![]});if(!_0x52cfe2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52cfe2['role']===_0x08dd('0x62')){return db[_0x08dd('0x63')][_0x08dd('0x4d')]({'where':{'name':_0x08dd('0x64'),'userProfileId':_0x52cfe2[_0x08dd('0x65')]},'raw':!![]})['then'](function(_0x344730){if(_0x344730){if(_0x344730[_0x08dd('0x66')]===0x0){return db[_0x08dd('0x67')]['findAll']({'where':{'sectionId':_0x344730['id']},'raw':!![]})['then'](function(_0x2fac51){var _0x15e042=[];if(_['isEmpty'](_0x2fac51)){_0x15e042=_[_0x08dd('0x41')](_0x572dcc,function(_0x36733a){if(_0x36733a[_0x08dd('0x59')]!==_0x08dd('0x56')){return _0x36733a;}});return _0x15e042;}else{for(var _0x143115=0x0;_0x143115<_0x572dcc[_0x08dd('0x49')];_0x143115++){var _0xc1b5e1=_0x572dcc[_0x143115];if(_0xc1b5e1[_0x08dd('0x59')]===_0x08dd('0x56')){var _0x5cd9d1=_[_0x08dd('0x4d')](_0x2fac51,function(_0x445d25){return _0x445d25[_0x08dd('0x68')]===_0xc1b5e1['id'];});if(_0x5cd9d1)_0x15e042[_0x08dd('0x69')](_0xc1b5e1);}else{_0x15e042[_0x08dd('0x69')](_0xc1b5e1);}}return _0x15e042;}});}else{return _0x572dcc;}}else{var _0x127992=_[_0x08dd('0x41')](_0x572dcc,function(_0x238455){if(_0x238455['role']!=='agent'){return _0x238455;}});return _0x127992;}});}else{return _0x572dcc;}}})[_0x08dd('0x29')](function(_0x594cf6){var _0x358641=[];if(_0x594cf6){_0x546fa9=_0x594cf6;for(var _0x1bfe6a=0x0;_0x1bfe6a<_0x594cf6[_0x08dd('0x49')];_0x1bfe6a+=0x1){_0x546fa9[_0x1bfe6a][_0x08dd('0x6a')]=[];_0x358641['push'](db[_0x08dd('0x2f')][_0x08dd('0x4d')]({'where':{'FromId':[_0x2037b9[_0x08dd('0x62')]['id'],_0x594cf6[_0x1bfe6a]['id']],'ToId':[_0x2037b9[_0x08dd('0x62')]['id'],_0x594cf6[_0x1bfe6a]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x08dd('0x6b'),_0x08dd('0x6c'),'body'],'order':qs[_0x08dd('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x08dd('0x29')](wrapUser(_0x594cf6[_0x1bfe6a])));}return BPromise[_0x08dd('0x6d')](_0x358641);}return[];})['then'](function(_0x266fd3){return{'rows':_0x266fd3,'count':_0x266fd3[_0x08dd('0x49')]};})[_0x08dd('0x29')](respondWithResult(_0x5438e7,null))['catch'](handleError(_0x5438e7,null));}; \ No newline at end of file +var _0xbd7d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','rows','catch','params','find','body','update','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','admin','user','fullname','userpic','online','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xf0b5aa,_0x2bf688){var _0x116c02=function(_0x3d6d94){while(--_0x3d6d94){_0xf0b5aa['push'](_0xf0b5aa['shift']());}};_0x116c02(++_0x2bf688);}(_0xbd7d,0x1a6));var _0xdbd7=function(_0x5d23c2,_0x314419){_0x5d23c2=_0x5d23c2-0x0;var _0x50b8f0=_0xbd7d[_0x5d23c2];return _0x50b8f0;};'use strict';var emlformat=require(_0xdbd7('0x0'));var rimraf=require(_0xdbd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbd7('0x2'));var rp=require(_0xdbd7('0x3'));var moment=require(_0xdbd7('0x4'));var BPromise=require(_0xdbd7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdbd7('0x6'));var csv=require(_0xdbd7('0x7'));var ejs=require(_0xdbd7('0x8'));var fs=require('fs');var fs_extra=require(_0xdbd7('0x9'));var _=require(_0xdbd7('0xa'));var squel=require(_0xdbd7('0xb'));var crypto=require(_0xdbd7('0xc'));var jsforce=require(_0xdbd7('0xd'));var deskjs=require(_0xdbd7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbd7('0xf'));var Papa=require(_0xdbd7('0x10'));var Redis=require(_0xdbd7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdbd7('0x12'));var hardwareService=require(_0xdbd7('0x13'));var logger=require(_0xdbd7('0x14'))(_0xdbd7('0x15'));var utils=require(_0xdbd7('0x16'));var config=require(_0xdbd7('0x17'));var licenseUtil=require(_0xdbd7('0x18'));var db=require(_0xdbd7('0x19'))['db'];config[_0xdbd7('0x1a')]=_[_0xdbd7('0x1b')](config[_0xdbd7('0x1a')],{'host':_0xdbd7('0x1c'),'port':0x18eb});var socket=require(_0xdbd7('0x1d'))(new Redis(config[_0xdbd7('0x1a')]));require(_0xdbd7('0x1e'))[_0xdbd7('0x1f')](socket);function respondWithStatusCode(_0x1347ed,_0x3286ab){_0x3286ab=_0x3286ab||0xcc;return function(_0xd13b4a){if(_0xd13b4a){return _0x1347ed[_0xdbd7('0x20')](_0x3286ab);}return _0x1347ed[_0xdbd7('0x21')](_0x3286ab)[_0xdbd7('0x22')]();};}function respondWithResult(_0x4ae3f3,_0x22a553){_0x22a553=_0x22a553||0xc8;return function(_0x230499){if(_0x230499){return _0x4ae3f3[_0xdbd7('0x21')](_0x22a553)[_0xdbd7('0x23')](_0x230499);}};}function respondWithFilteredResult(_0x34a468,_0x1718b0){return function(_0x44d192){if(_0x44d192){var _0x439677=typeof _0x1718b0[_0xdbd7('0x24')]===_0xdbd7('0x25')&&typeof _0x1718b0[_0xdbd7('0x26')]===_0xdbd7('0x25');var _0x375f13=_0x44d192[_0xdbd7('0x27')];var _0x1f25ae=_0x439677?0x0:_0x1718b0[_0xdbd7('0x24')];var _0x509c99=_0x439677?_0x44d192[_0xdbd7('0x27')]:_0x1718b0[_0xdbd7('0x24')]+_0x1718b0['limit'];var _0x3e703f;if(_0x509c99>=_0x375f13){_0x509c99=_0x375f13;_0x3e703f=0xc8;}else{_0x3e703f=0xce;}_0x34a468['status'](_0x3e703f);return _0x34a468[_0xdbd7('0x28')](_0xdbd7('0x29'),_0x1f25ae+'-'+_0x509c99+'/'+_0x375f13)[_0xdbd7('0x23')](_0x44d192);}return null;};}function patchUpdates(_0x55ce67){return function(_0x4a106e){try{jsonpatch[_0xdbd7('0x2a')](_0x4a106e,_0x55ce67,!![]);}catch(_0x36d0c2){return BPromise[_0xdbd7('0x2b')](_0x36d0c2);}return _0x4a106e[_0xdbd7('0x2c')]();};}function saveUpdates(_0x4a339f,_0xad2939){return function(_0x5e2c99){if(_0x5e2c99){return _0x5e2c99['update'](_0x4a339f)[_0xdbd7('0x2d')](function(_0x294889){return _0x294889;});}return null;};}function removeEntity(_0x5a510e,_0x525d7b){return function(_0x3845fe){if(_0x3845fe){return _0x3845fe[_0xdbd7('0x2e')]()[_0xdbd7('0x2d')](function(){_0x5a510e[_0xdbd7('0x21')](0xcc)[_0xdbd7('0x22')]();});}};}function handleEntityNotFound(_0x5b7a54,_0x1d835e){return function(_0xb05d91){if(!_0xb05d91){_0x5b7a54['sendStatus'](0x194);}return _0xb05d91;};}function handleError(_0x15347f,_0x159630){_0x159630=_0x159630||0x1f4;return function(_0x5a926f){logger['error'](_0x5a926f[_0xdbd7('0x2f')]);if(_0x5a926f['name']){delete _0x5a926f[_0xdbd7('0x30')];}_0x15347f[_0xdbd7('0x21')](_0x159630)['send'](_0x5a926f);};}exports[_0xdbd7('0x31')]=function(_0x74e3f5,_0x2f9118){var _0x174316={},_0x286c41={},_0x495eef={'count':0x0,'rows':[]};var _0x51faaa=_[_0xdbd7('0x32')](db['ChatInternalMessage']['rawAttributes'],function(_0x574d7c){return{'name':_0x574d7c[_0xdbd7('0x33')],'type':_0x574d7c[_0xdbd7('0x34')]['key']};});_0x286c41[_0xdbd7('0x35')]=_[_0xdbd7('0x32')](_0x51faaa,_0xdbd7('0x30'));_0x286c41[_0xdbd7('0x36')]=_[_0xdbd7('0x37')](_0x74e3f5[_0xdbd7('0x36')]);_0x286c41[_0xdbd7('0x38')]=_[_0xdbd7('0x39')](_0x286c41['model'],_0x286c41[_0xdbd7('0x36')]);_0x174316[_0xdbd7('0x3a')]=_[_0xdbd7('0x39')](_0x286c41['model'],qs[_0xdbd7('0x3b')](_0x74e3f5[_0xdbd7('0x36')][_0xdbd7('0x3b')]));_0x174316[_0xdbd7('0x3a')]=_0x174316[_0xdbd7('0x3a')][_0xdbd7('0x3c')]?_0x174316[_0xdbd7('0x3a')]:_0x286c41[_0xdbd7('0x35')];if(!_0x74e3f5[_0xdbd7('0x36')][_0xdbd7('0x3d')]('nolimit')){_0x174316[_0xdbd7('0x26')]=qs[_0xdbd7('0x26')](_0x74e3f5[_0xdbd7('0x36')]['limit']);_0x174316[_0xdbd7('0x24')]=qs[_0xdbd7('0x24')](_0x74e3f5[_0xdbd7('0x36')][_0xdbd7('0x24')]);}_0x174316['order']=qs[_0xdbd7('0x3e')](_0x74e3f5[_0xdbd7('0x36')][_0xdbd7('0x3e')]);_0x174316[_0xdbd7('0x3f')]=qs[_0xdbd7('0x38')](_[_0xdbd7('0x40')](_0x74e3f5[_0xdbd7('0x36')],_0x286c41[_0xdbd7('0x38')]),_0x51faaa);if(_0x74e3f5[_0xdbd7('0x36')][_0xdbd7('0x41')]){_0x174316['where']=_[_0xdbd7('0x42')](_0x174316[_0xdbd7('0x3f')],{'$or':_[_0xdbd7('0x32')](_0x51faaa,function(_0x41e1d5){if(_0x41e1d5[_0xdbd7('0x34')]!==_0xdbd7('0x43')){var _0x4bbf8b={};_0x4bbf8b[_0x41e1d5['name']]={'$like':'%'+_0x74e3f5[_0xdbd7('0x36')]['filter']+'%'};return _0x4bbf8b;}})});}_0x174316=_[_0xdbd7('0x42')]({},_0x174316,_0x74e3f5[_0xdbd7('0x44')]);var _0x5e3e5a={'where':_0x174316[_0xdbd7('0x3f')]};return db[_0xdbd7('0x45')][_0xdbd7('0x27')](_0x5e3e5a)['then'](function(_0x273b29){_0x495eef['count']=_0x273b29;if(_0x74e3f5[_0xdbd7('0x36')][_0xdbd7('0x46')]){_0x174316[_0xdbd7('0x47')]=[{'all':!![]}];}return db[_0xdbd7('0x45')]['findAll'](_0x174316);})[_0xdbd7('0x2d')](function(_0x20b343){_0x495eef[_0xdbd7('0x48')]=_0x20b343;return _0x495eef;})[_0xdbd7('0x2d')](respondWithFilteredResult(_0x2f9118,_0x174316))[_0xdbd7('0x49')](handleError(_0x2f9118,null));};exports['show']=function(_0x1feca8,_0x4eca72){var _0xe2b428={'raw':!![],'where':{'id':_0x1feca8[_0xdbd7('0x4a')]['id']}},_0x45bc2e={};_0x45bc2e[_0xdbd7('0x35')]=_[_0xdbd7('0x37')](db['ChatInternalMessage']['rawAttributes']);_0x45bc2e[_0xdbd7('0x36')]=_[_0xdbd7('0x37')](_0x1feca8[_0xdbd7('0x36')]);_0x45bc2e[_0xdbd7('0x38')]=_[_0xdbd7('0x39')](_0x45bc2e[_0xdbd7('0x35')],_0x45bc2e['query']);_0xe2b428[_0xdbd7('0x3a')]=_[_0xdbd7('0x39')](_0x45bc2e[_0xdbd7('0x35')],qs[_0xdbd7('0x3b')](_0x1feca8['query'][_0xdbd7('0x3b')]));_0xe2b428['attributes']=_0xe2b428['attributes'][_0xdbd7('0x3c')]?_0xe2b428[_0xdbd7('0x3a')]:_0x45bc2e[_0xdbd7('0x35')];if(_0x1feca8[_0xdbd7('0x36')][_0xdbd7('0x46')]){_0xe2b428[_0xdbd7('0x47')]=[{'all':!![]}];}_0xe2b428=_[_0xdbd7('0x42')]({},_0xe2b428,_0x1feca8['options']);return db[_0xdbd7('0x45')][_0xdbd7('0x4b')](_0xe2b428)[_0xdbd7('0x2d')](handleEntityNotFound(_0x4eca72,null))[_0xdbd7('0x2d')](respondWithResult(_0x4eca72,null))['catch'](handleError(_0x4eca72,null));};exports['create']=function(_0x146ceb,_0x54be24){return db['ChatInternalMessage']['create'](_0x146ceb[_0xdbd7('0x4c')],{})[_0xdbd7('0x2d')](respondWithResult(_0x54be24,0xc9))[_0xdbd7('0x49')](handleError(_0x54be24,null));};exports[_0xdbd7('0x4d')]=function(_0x33fcd1,_0x576a41){if(_0x33fcd1[_0xdbd7('0x4c')]['id']){delete _0x33fcd1[_0xdbd7('0x4c')]['id'];}return db[_0xdbd7('0x45')][_0xdbd7('0x4b')]({'where':{'id':_0x33fcd1[_0xdbd7('0x4a')]['id']}})[_0xdbd7('0x2d')](handleEntityNotFound(_0x576a41,null))[_0xdbd7('0x2d')](saveUpdates(_0x33fcd1[_0xdbd7('0x4c')],null))[_0xdbd7('0x2d')](respondWithResult(_0x576a41,null))[_0xdbd7('0x49')](handleError(_0x576a41,null));};exports[_0xdbd7('0x2e')]=function(_0x13836c,_0x58c5ea){return db[_0xdbd7('0x45')]['find']({'where':{'id':_0x13836c[_0xdbd7('0x4a')]['id']}})[_0xdbd7('0x2d')](handleEntityNotFound(_0x58c5ea,null))[_0xdbd7('0x2d')](removeEntity(_0x58c5ea,null))['catch'](handleError(_0x58c5ea,null));};exports['describe']=function(_0x436124,_0x380bae){return db[_0xdbd7('0x45')][_0xdbd7('0x4e')]()[_0xdbd7('0x2d')](respondWithResult(_0x380bae,null))[_0xdbd7('0x49')](handleError(_0x380bae,null));};function wrapUser(_0xb0bd93){return function(_0x50f22d){var _0x11e457=_0xb0bd93[_0xdbd7('0x4f')]({'plain':!![]});_0x11e457[_0xdbd7('0x50')]=[];if(_0x50f22d){_0x11e457['lastMessageAt']=_0x50f22d[_0xdbd7('0x51')];_0x11e457[_0xdbd7('0x52')]=_0x50f22d;}else{_0x11e457[_0xdbd7('0x53')]=moment(0x0)[_0xdbd7('0x54')](_0xdbd7('0x55'));_0x11e457['lastMessage']={};}return _0x11e457;};}exports[_0xdbd7('0x56')]=function(_0x5eaf0b,_0x55345a,_0x443716){var _0x4209b9=[];return db['User'][_0xdbd7('0x57')]({'where':{'role':[_0xdbd7('0x58'),_0xdbd7('0x59'),_0xdbd7('0x5a')]},'attributes':['id',_0xdbd7('0x5b'),_0xdbd7('0x30'),'role',_0xdbd7('0x5c'),'internal',_0xdbd7('0x5d'),'lastLoginAt',_0xdbd7('0x5e'),'showWebBar'],'order':qs[_0xdbd7('0x3e')](_0xdbd7('0x5f')),'include':[{'model':db[_0xdbd7('0x60')],'as':_0xdbd7('0x61'),'attributes':['id',_0xdbd7('0x30'),_0xdbd7('0x34')],'through':{'attributes':[]}}]})[_0xdbd7('0x2d')](function(_0x42a35b){if(_0x42a35b){var _0x4c735d=_0x5eaf0b[_0xdbd7('0x5a')][_0xdbd7('0x4f')]({'plain':!![]});if(!_0x4c735d)throw new Error(_0xdbd7('0x62'));if(_0x4c735d[_0xdbd7('0x63')]==='user'){return db[_0xdbd7('0x64')][_0xdbd7('0x4b')]({'where':{'name':'Agents','userProfileId':_0x4c735d[_0xdbd7('0x65')]},'raw':!![]})['then'](function(_0x533311){if(_0x533311){if(_0x533311[_0xdbd7('0x66')]===0x0){return db[_0xdbd7('0x67')][_0xdbd7('0x57')]({'where':{'sectionId':_0x533311['id']},'raw':!![]})[_0xdbd7('0x2d')](function(_0x4ef8fd){var _0x42eb39=[];if(_['isEmpty'](_0x4ef8fd)){_0x42eb39=_['filter'](_0x42a35b,function(_0x4925d5){if(_0x4925d5['role']!==_0xdbd7('0x58')){return _0x4925d5;}});return _0x42eb39;}else{for(var _0x529ce6=0x0;_0x529ce6<_0x42a35b[_0xdbd7('0x3c')];_0x529ce6++){var _0x59cb03=_0x42a35b[_0x529ce6];if(_0x59cb03[_0xdbd7('0x63')]===_0xdbd7('0x58')){var _0x5f0ab4=_['find'](_0x4ef8fd,function(_0x3588fd){return _0x3588fd[_0xdbd7('0x68')]===_0x59cb03['id'];});if(_0x5f0ab4)_0x42eb39[_0xdbd7('0x69')](_0x59cb03);}else{_0x42eb39['push'](_0x59cb03);}}return _0x42eb39;}});}else{return _0x42a35b;}}else{var _0x12b688=_[_0xdbd7('0x41')](_0x42a35b,function(_0x4bd285){if(_0x4bd285[_0xdbd7('0x63')]!==_0xdbd7('0x58')){return _0x4bd285;}});return _0x12b688;}});}else{return _0x42a35b;}}})[_0xdbd7('0x2d')](function(_0x5c6c0d){var _0x47b70b=[];if(_0x5c6c0d){_0x4209b9=_0x5c6c0d;for(var _0x43403a=0x0;_0x43403a<_0x5c6c0d[_0xdbd7('0x3c')];_0x43403a+=0x1){_0x4209b9[_0x43403a][_0xdbd7('0x50')]=[];_0x47b70b[_0xdbd7('0x69')](db[_0xdbd7('0x45')][_0xdbd7('0x4b')]({'where':{'FromId':[_0x5eaf0b[_0xdbd7('0x5a')]['id'],_0x5c6c0d[_0x43403a]['id']],'ToId':[_0x5eaf0b[_0xdbd7('0x5a')]['id'],_0x5c6c0d[_0x43403a]['id']],'ChatGroupId':null},'attributes':['id',_0xdbd7('0x51'),_0xdbd7('0x6a'),_0xdbd7('0x6b'),_0xdbd7('0x6c'),_0xdbd7('0x4c')],'order':qs[_0xdbd7('0x3e')](_0xdbd7('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xdbd7('0x2d')](wrapUser(_0x5c6c0d[_0x43403a])));}return BPromise[_0xdbd7('0x6e')](_0x47b70b);}return[];})['then'](function(_0x233045){return{'rows':_0x233045,'count':_0x233045['length']};})[_0xdbd7('0x2d')](respondWithResult(_0x55345a,null))['catch'](handleError(_0x55345a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a2d3002..5d14210 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 _0x32e3=['update','remove','emit','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x32e3,0x1d8));var _0x332e=function(_0x5cd3d5,_0x326da8){_0x5cd3d5=_0x5cd3d5-0x0;var _0x3d1993=_0x32e3[_0x5cd3d5];return _0x3d1993;};'use strict';var EventEmitter=require(_0x332e('0x0'));var ChatInternalMessage=require(_0x332e('0x1'))['db'][_0x332e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x332e('0x3')](0x0);var events={'afterCreate':_0x332e('0x4'),'afterUpdate':_0x332e('0x5'),'afterDestroy':_0x332e('0x6')};function emitEvent(_0x4512b3){return function(_0x5c866b,_0x1017db,_0x1a5500){ChatInternalMessageEvents[_0x332e('0x7')](_0x4512b3+':'+_0x5c866b['id'],_0x5c866b);ChatInternalMessageEvents[_0x332e('0x7')](_0x4512b3,_0x5c866b);_0x1a5500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x332e('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xf628=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','emit','hasOwnProperty'];(function(_0x398a4b,_0x3474fb){var _0x493eda=function(_0x388dbb){while(--_0x388dbb){_0x398a4b['push'](_0x398a4b['shift']());}};_0x493eda(++_0x3474fb);}(_0xf628,0x7f));var _0x8f62=function(_0x46ce86,_0x2e07e0){_0x46ce86=_0x46ce86-0x0;var _0x29e3b6=_0xf628[_0x46ce86];return _0x29e3b6;};'use strict';var EventEmitter=require(_0x8f62('0x0'));var ChatInternalMessage=require(_0x8f62('0x1'))['db'][_0x8f62('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8f62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x393c04){return function(_0x18593f,_0x1706d2,_0x2377a5){ChatInternalMessageEvents[_0x8f62('0x4')](_0x393c04+':'+_0x18593f['id'],_0x18593f);ChatInternalMessageEvents['emit'](_0x393c04,_0x18593f);_0x2377a5(null);};}for(var e in events){if(events[_0x8f62('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x8f62('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 33cd22c..07bc515 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 _0x5f39=['request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x5f39,0x1cb));var _0x95f3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5f39[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x95f3('0x0'));var util=require(_0x95f3('0x1'));var logger=require(_0x95f3('0x2'))(_0x95f3('0x3'));var moment=require(_0x95f3('0x4'));var BPromise=require(_0x95f3('0x5'));var rp=require(_0x95f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95f3('0x7'));var config=require(_0x95f3('0x8'));var attributes=require(_0x95f3('0x9'));module[_0x95f3('0xa')]=function(_0x4b0f91,_0xf57150){return _0x4b0f91[_0x95f3('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x95f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95f3('0xd'),'collate':_0x95f3('0xe')});}; \ No newline at end of file +var _0xc7b4=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','lodash'];(function(_0x3e6ac0,_0x34b200){var _0xe1dee5=function(_0x8864a8){while(--_0x8864a8){_0x3e6ac0['push'](_0x3e6ac0['shift']());}};_0xe1dee5(++_0x34b200);}(_0xc7b4,0x8b));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c7b('0x0'));var util=require(_0x4c7b('0x1'));var logger=require('../../config/logger')(_0x4c7b('0x2'));var moment=require(_0x4c7b('0x3'));var BPromise=require(_0x4c7b('0x4'));var rp=require(_0x4c7b('0x5'));var fs=require('fs');var path=require(_0x4c7b('0x6'));var rimraf=require(_0x4c7b('0x7'));var config=require(_0x4c7b('0x8'));var attributes=require(_0x4c7b('0x9'));module[_0x4c7b('0xa')]=function(_0xa2f065,_0x20234b){return _0xa2f065[_0x4c7b('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x4c7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4c7b('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index da3f461..ffe6b11 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 _0x8881=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0xb37185,_0x3ec508){var _0x575b45=function(_0x2d9b5a){while(--_0x2d9b5a){_0xb37185['push'](_0xb37185['shift']());}};_0x575b45(++_0x3ec508);}(_0x8881,0xd0));var _0x1888=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x8881[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x1888('0x0'));var util=require(_0x1888('0x1'));var moment=require(_0x1888('0x2'));var BPromise=require(_0x1888('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1888('0x4'))['db'];var utils=require(_0x1888('0x5'));var logger=require('../../config/logger')(_0x1888('0x6'));var config=require('../../config/environment');var jayson=require(_0x1888('0x7'));var client=jayson['client'][_0x1888('0x8')]({'port':0x232a});config[_0x1888('0x9')]=_[_0x1888('0xa')](config[_0x1888('0x9')],{'host':_0x1888('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1888('0x9')]));require(_0x1888('0xc'))[_0x1888('0xd')](socket);function respondWithRpcPromise(_0x276def,_0x37837b,_0x2b9bf9){return new BPromise(function(_0x22ff6b,_0x1da670){return client[_0x1888('0xe')](_0x276def,_0x2b9bf9)[_0x1888('0xf')](function(_0x5eb1a2){logger[_0x1888('0x10')](_0x1888('0x11'),_0x37837b,_0x1888('0x12'));logger[_0x1888('0x13')](_0x1888('0x14'),_0x37837b,_0x1888('0x12'),JSON[_0x1888('0x15')](_0x5eb1a2));if(_0x5eb1a2[_0x1888('0x16')]){if(_0x5eb1a2['error']['code']===0x1f4){logger[_0x1888('0x16')](_0x1888('0x11'),_0x37837b,_0x5eb1a2['error'][_0x1888('0x17')]);return _0x1da670(_0x5eb1a2[_0x1888('0x16')][_0x1888('0x17')]);}logger[_0x1888('0x16')](_0x1888('0x11'),_0x37837b,_0x5eb1a2[_0x1888('0x16')]['message']);return _0x22ff6b(_0x5eb1a2[_0x1888('0x16')]['message']);}else{logger[_0x1888('0x10')](_0x1888('0x11'),_0x37837b,_0x1888('0x12'));_0x22ff6b(_0x5eb1a2[_0x1888('0x18')][_0x1888('0x17')]);}})[_0x1888('0x19')](function(_0x3b3f3e){logger[_0x1888('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x37837b,_0x3b3f3e);_0x1da670(_0x3b3f3e);});});} \ No newline at end of file +var _0xde84=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','register','info','ChatInternalMessage,\x20%s,\x20%s','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2f6322,_0xaf6305){var _0x77bcf6=function(_0x358932){while(--_0x358932){_0x2f6322['push'](_0x2f6322['shift']());}};_0x77bcf6(++_0xaf6305);}(_0xde84,0x84));var _0x4de8=function(_0x287e0f,_0x5638e7){_0x287e0f=_0x287e0f-0x0;var _0x4dd42a=_0xde84[_0x287e0f];return _0x4dd42a;};'use strict';var _=require(_0x4de8('0x0'));var util=require(_0x4de8('0x1'));var moment=require(_0x4de8('0x2'));var BPromise=require(_0x4de8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4de8('0x4'));var db=require(_0x4de8('0x5'))['db'];var utils=require(_0x4de8('0x6'));var logger=require(_0x4de8('0x7'))(_0x4de8('0x8'));var config=require(_0x4de8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4de8('0xa')]({'port':0x232a});config[_0x4de8('0xb')]=_[_0x4de8('0xc')](config[_0x4de8('0xb')],{'host':_0x4de8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4de8('0xb')]));require('./chatInternalMessage.socket')[_0x4de8('0xe')](socket);function respondWithRpcPromise(_0x170a2b,_0x387a29,_0x185136){return new BPromise(function(_0x531f82,_0x65e52d){return client['request'](_0x170a2b,_0x185136)['then'](function(_0x718a0e){logger[_0x4de8('0xf')](_0x4de8('0x10'),_0x387a29,'request\x20sent');logger[_0x4de8('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x387a29,'request\x20sent',JSON[_0x4de8('0x12')](_0x718a0e));if(_0x718a0e['error']){if(_0x718a0e[_0x4de8('0x13')][_0x4de8('0x14')]===0x1f4){logger[_0x4de8('0x13')](_0x4de8('0x10'),_0x387a29,_0x718a0e[_0x4de8('0x13')][_0x4de8('0x15')]);return _0x65e52d(_0x718a0e[_0x4de8('0x13')]['message']);}logger[_0x4de8('0x13')](_0x4de8('0x10'),_0x387a29,_0x718a0e['error'][_0x4de8('0x15')]);return _0x531f82(_0x718a0e[_0x4de8('0x13')][_0x4de8('0x15')]);}else{logger['info'](_0x4de8('0x10'),_0x387a29,'request\x20sent');_0x531f82(_0x718a0e[_0x4de8('0x16')][_0x4de8('0x15')]);}})['catch'](function(_0x2edd23){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x387a29,_0x2edd23);_0x65e52d(_0x2edd23);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 84464ff..d7bb81a 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 _0x73ce=['save','remove','update','emit','register','length','./chatInternalMessage.events'];(function(_0x91964a,_0x2dc2f6){var _0x4490b1=function(_0x3ed329){while(--_0x3ed329){_0x91964a['push'](_0x91964a['shift']());}};_0x4490b1(++_0x2dc2f6);}(_0x73ce,0x172));var _0xe73c=function(_0x535fef,_0x416c17){_0x535fef=_0x535fef-0x0;var _0x545e9b=_0x73ce[_0x535fef];return _0x545e9b;};'use strict';var ChatInternalMessageEvents=require(_0xe73c('0x0'));var events=[_0xe73c('0x1'),_0xe73c('0x2'),_0xe73c('0x3')];function createListener(_0x17d472,_0x193b81){return function(_0x5522ca){_0x193b81[_0xe73c('0x4')](_0x17d472,_0x5522ca);};}function removeListener(_0x4edb32,_0x3fec1d){return function(){ChatInternalMessageEvents['removeListener'](_0x4edb32,_0x3fec1d);};}exports[_0xe73c('0x5')]=function(_0x1b131c){for(var _0x1cd963=0x0,_0x5ed683=events[_0xe73c('0x6')];_0x1cd963<_0x5ed683;_0x1cd963++){var _0x53cde7=events[_0x1cd963];var _0x33ffd7=createListener('chatInternalMessage:'+_0x53cde7,_0x1b131c);ChatInternalMessageEvents['on'](_0x53cde7,_0x33ffd7);}}; \ No newline at end of file +var _0xe2e5=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','update'];(function(_0x566e36,_0x25a2f9){var _0x18fc87=function(_0x102b83){while(--_0x102b83){_0x566e36['push'](_0x566e36['shift']());}};_0x18fc87(++_0x25a2f9);}(_0xe2e5,0x135));var _0x5e2e=function(_0x365e6d,_0x2b0157){_0x365e6d=_0x365e6d-0x0;var _0x76b60=_0xe2e5[_0x365e6d];return _0x76b60;};'use strict';var ChatInternalMessageEvents=require(_0x5e2e('0x0'));var events=[_0x5e2e('0x1'),'remove',_0x5e2e('0x2')];function createListener(_0x542ae8,_0x33a6b8){return function(_0x2c375a){_0x33a6b8[_0x5e2e('0x3')](_0x542ae8,_0x2c375a);};}function removeListener(_0x5ecd21,_0x5bad8a){return function(){ChatInternalMessageEvents[_0x5e2e('0x4')](_0x5ecd21,_0x5bad8a);};}exports[_0x5e2e('0x5')]=function(_0x58518e){for(var _0x5f5bc7=0x0,_0x9166fc=events[_0x5e2e('0x6')];_0x5f5bc7<_0x9166fc;_0x5f5bc7++){var _0x2c08ee=events[_0x5f5bc7];var _0x58fce3=createListener(_0x5e2e('0x7')+_0x2c08ee,_0x58518e);ChatInternalMessageEvents['on'](_0x2c08ee,_0x58fce3);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f93c5ce..fd99667 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 _0x418c=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x340a1a,_0x47003a){var _0x1f13e5=function(_0x28ef88){while(--_0x28ef88){_0x340a1a['push'](_0x340a1a['shift']());}};_0x1f13e5(++_0x47003a);}(_0x418c,0x13f));var _0xc418=function(_0x1f7524,_0x56f235){_0x1f7524=_0x1f7524-0x0;var _0x210671=_0x418c[_0x1f7524];return _0x210671;};'use strict';var multer=require('multer');var util=require(_0xc418('0x0'));var path=require(_0xc418('0x1'));var timeout=require(_0xc418('0x2'));var express=require(_0xc418('0x3'));var router=express['Router']();var fs_extra=require(_0xc418('0x4'));var auth=require(_0xc418('0x5'));var interaction=require(_0xc418('0x6'));var config=require(_0xc418('0x7'));var controller=require(_0xc418('0x8'));router[_0xc418('0x9')]('/',auth[_0xc418('0xa')](),controller['index']);router[_0xc418('0x9')](_0xc418('0xb'),auth[_0xc418('0xa')](),controller[_0xc418('0xc')]);router[_0xc418('0x9')](_0xc418('0xd'),auth[_0xc418('0xa')](),controller[_0xc418('0xe')]);router[_0xc418('0x9')](_0xc418('0xf'),auth['isAuthenticated'](),controller[_0xc418('0x10')]);router[_0xc418('0x11')]('/',auth[_0xc418('0xa')](),controller['create']);router[_0xc418('0x12')](_0xc418('0xf'),controller[_0xc418('0x13')]);router[_0xc418('0x14')](_0xc418('0xf'),auth['isAuthenticated'](),controller[_0xc418('0x15')]);module[_0xc418('0x16')]=router; \ No newline at end of file +var _0x969d=['post','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show'];(function(_0x311879,_0x25d1e1){var _0x4e7cd4=function(_0x4f4e88){while(--_0x4f4e88){_0x311879['push'](_0x311879['shift']());}};_0x4e7cd4(++_0x25d1e1);}(_0x969d,0x155));var _0xd969=function(_0x5c6831,_0x3fe733){_0x5c6831=_0x5c6831-0x0;var _0x4d96af=_0x969d[_0x5c6831];return _0x4d96af;};'use strict';var multer=require(_0xd969('0x0'));var util=require(_0xd969('0x1'));var path=require('path');var timeout=require(_0xd969('0x2'));var express=require(_0xd969('0x3'));var router=express[_0xd969('0x4')]();var fs_extra=require(_0xd969('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd969('0x6'));router[_0xd969('0x7')]('/',auth[_0xd969('0x8')](),controller[_0xd969('0x9')]);router[_0xd969('0x7')](_0xd969('0xa'),auth[_0xd969('0x8')](),controller[_0xd969('0xb')]);router[_0xd969('0x7')](_0xd969('0xc'),auth['isAuthenticated'](),controller[_0xd969('0xd')]);router[_0xd969('0x7')](_0xd969('0xe'),auth['isAuthenticated'](),controller[_0xd969('0xf')]);router[_0xd969('0x10')]('/',auth[_0xd969('0x8')](),controller[_0xd969('0x11')]);router[_0xd969('0x12')](_0xd969('0xe'),controller[_0xd969('0x13')]);router['delete']('/:id',auth[_0xd969('0x8')](),controller[_0xd969('0x14')]);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 da54004..ddce367 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 _0x5c00=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x12d0bb,_0x56430a){var _0x44e5af=function(_0x1c0db0){while(--_0x1c0db0){_0x12d0bb['push'](_0x12d0bb['shift']());}};_0x44e5af(++_0x56430a);}(_0x5c00,0x17e));var _0x05c0=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x5c00[_0x1ebce2];return _0x4a330c;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'body':{'type':Sequelize[_0x05c0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x05c0('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x05c0('0x4')]('in',_0x05c0('0x5')),'defaultValue':_0x05c0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x05c0('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x1123=['TEXT','BOOLEAN','ENUM','DATE','STRING'];(function(_0x54aef6,_0x4155fc){var _0x1a2d10=function(_0x4cefb6){while(--_0x4cefb6){_0x54aef6['push'](_0x54aef6['shift']());}};_0x1a2d10(++_0x4155fc);}(_0x1123,0x118));var _0x3112=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1123[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3112('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3112('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3112('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3112('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3112('0x3')]},'providerName':{'type':Sequelize[_0x3112('0x4')]},'providerResponse':{'type':Sequelize[_0x3112('0x0')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4e08110..4608446 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 _0x8aed=['interface','channel','event','EventManager','acceptmessage','parse','../../config/logger','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','User','fullname','internal','SIP/%s','rejectmessage','formData','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','fields','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','manual'];(function(_0x27968c,_0x5f4dbd){var _0x3cfb3a=function(_0x296d49){while(--_0x296d49){_0x27968c['push'](_0x27968c['shift']());}};_0x3cfb3a(++_0x5f4dbd);}(_0x8aed,0x96));var _0xd8ae=function(_0x4e8799,_0x2854ba){_0x4e8799=_0x4e8799-0x0;var _0x366238=_0x8aed[_0x4e8799];return _0x366238;};'use strict';var emlformat=require(_0xd8ae('0x0'));var rimraf=require(_0xd8ae('0x1'));var zipdir=require(_0xd8ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8ae('0x3'));var moment=require(_0xd8ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd8ae('0x5'));var util=require(_0xd8ae('0x6'));var path=require('path');var sox=require(_0xd8ae('0x7'));var csv=require(_0xd8ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8ae('0x9'));var _=require(_0xd8ae('0xa'));var squel=require(_0xd8ae('0xb'));var crypto=require(_0xd8ae('0xc'));var jsforce=require(_0xd8ae('0xd'));var deskjs=require(_0xd8ae('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd8ae('0xf'));var Papa=require(_0xd8ae('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8ae('0x11'));var as=require(_0xd8ae('0x12'));var hardwareService=require(_0xd8ae('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd8ae('0x14'));var config=require(_0xd8ae('0x15'));var licenseUtil=require(_0xd8ae('0x16'));var db=require(_0xd8ae('0x17'))['db'];config[_0xd8ae('0x18')]=_[_0xd8ae('0x19')](config[_0xd8ae('0x18')],{'host':_0xd8ae('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8ae('0x18')]));require(_0xd8ae('0x1b'))[_0xd8ae('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd8ae('0x1d')][_0xd8ae('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xd8ae('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5ea127,_0x506bf0,_0x48d56d,_0x312a79){return new BPromise(function(_0x192ea5,_0x27e189){var _0x2b84f8=_0x312a79||client;return _0x2b84f8[_0xd8ae('0x1f')](_0x5ea127,_0x48d56d)[_0xd8ae('0x20')](function(_0x3b8bca){logger[_0xd8ae('0x21')](_0xd8ae('0x22'),_0x506bf0,_0xd8ae('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x506bf0,_0xd8ae('0x23'),JSON[_0xd8ae('0x24')](_0x3b8bca));if(_0x3b8bca['error']){if(_0x3b8bca[_0xd8ae('0x25')][_0xd8ae('0x26')]===0x1f4){logger[_0xd8ae('0x25')]('ChatMessage,\x20%s,\x20%s',_0x506bf0,_0x3b8bca[_0xd8ae('0x25')]['message']);return _0x27e189(_0x3b8bca['error'][_0xd8ae('0x27')]);}logger[_0xd8ae('0x25')](_0xd8ae('0x22'),_0x506bf0,_0x3b8bca['error'][_0xd8ae('0x27')]);return _0x192ea5(_0x3b8bca[_0xd8ae('0x25')][_0xd8ae('0x27')]);}else{logger[_0xd8ae('0x21')](_0xd8ae('0x22'),_0x506bf0,'request\x20sent');_0x192ea5(_0x3b8bca[_0xd8ae('0x28')][_0xd8ae('0x27')]);}})[_0xd8ae('0x29')](function(_0x4fb645){logger[_0xd8ae('0x25')](_0xd8ae('0x22'),_0x506bf0,_0x4fb645);_0x27e189(_0x4fb645);});});}function respondWithStatusCode(_0x4cf479,_0x55f57e){_0x55f57e=_0x55f57e||0xcc;return function(_0xcffeb3){if(_0xcffeb3){return _0x4cf479[_0xd8ae('0x2a')](_0x55f57e);}return _0x4cf479['status'](_0x55f57e)['end']();};}function respondWithResult(_0x503e60,_0x537a93){_0x537a93=_0x537a93||0xc8;return function(_0x42e64b){if(_0x42e64b){return _0x503e60[_0xd8ae('0x2b')](_0x537a93)[_0xd8ae('0x2c')](_0x42e64b);}};}function respondWithFilteredResult(_0x50f82c,_0x3e25e2){return function(_0x424e71){if(_0x424e71){var _0x1c6a44=typeof _0x3e25e2[_0xd8ae('0x2d')]===_0xd8ae('0x2e')&&typeof _0x3e25e2[_0xd8ae('0x2f')]===_0xd8ae('0x2e');var _0x4ae93f=_0x424e71['count'];var _0x17bbf2=_0x1c6a44?0x0:_0x3e25e2['offset'];var _0x198117=_0x1c6a44?_0x424e71['count']:_0x3e25e2[_0xd8ae('0x2d')]+_0x3e25e2[_0xd8ae('0x2f')];var _0x14e0a5;if(_0x198117>=_0x4ae93f){_0x198117=_0x4ae93f;_0x14e0a5=0xc8;}else{_0x14e0a5=0xce;}_0x50f82c[_0xd8ae('0x2b')](_0x14e0a5);return _0x50f82c['set'](_0xd8ae('0x30'),_0x17bbf2+'-'+_0x198117+'/'+_0x4ae93f)[_0xd8ae('0x2c')](_0x424e71);}return null;};}function patchUpdates(_0x32b0da){return function(_0x3e0e92){try{jsonpatch[_0xd8ae('0x31')](_0x3e0e92,_0x32b0da,!![]);}catch(_0x512f46){return BPromise[_0xd8ae('0x32')](_0x512f46);}return _0x3e0e92[_0xd8ae('0x33')]();};}function saveUpdates(_0x27c7bf,_0x594bfb){return function(_0x557c4b){if(_0x557c4b){return _0x557c4b[_0xd8ae('0x34')](_0x27c7bf)[_0xd8ae('0x20')](function(_0x15404b){return _0x15404b;});}return null;};}function removeEntity(_0x1741c0,_0x5c7f26){return function(_0x5765a0){if(_0x5765a0){return _0x5765a0[_0xd8ae('0x35')]()[_0xd8ae('0x20')](function(){_0x1741c0['status'](0xcc)[_0xd8ae('0x36')]();});}};}function handleEntityNotFound(_0x1f239c,_0x2f00f4){return function(_0x386343){if(!_0x386343){_0x1f239c[_0xd8ae('0x2a')](0x194);}return _0x386343;};}function handleError(_0x5c21ca,_0x58f6d8){_0x58f6d8=_0x58f6d8||0x1f4;return function(_0x330f73){logger[_0xd8ae('0x25')](_0x330f73[_0xd8ae('0x37')]);if(_0x330f73['name']){delete _0x330f73[_0xd8ae('0x38')];}_0x5c21ca['status'](_0x58f6d8)[_0xd8ae('0x39')](_0x330f73);};}exports[_0xd8ae('0x3a')]=function(_0x21c63c,_0x575fae){var _0x2b4133={},_0x4cea34={},_0x2d7b47={'count':0x0,'rows':[]};var _0x473dd2=_[_0xd8ae('0x3b')](db[_0xd8ae('0x3c')][_0xd8ae('0x3d')],function(_0x1e6cac){return{'name':_0x1e6cac[_0xd8ae('0x3e')],'type':_0x1e6cac['type'][_0xd8ae('0x3f')]};});_0x4cea34[_0xd8ae('0x40')]=_[_0xd8ae('0x3b')](_0x473dd2,_0xd8ae('0x38'));_0x4cea34['query']=_['keys'](_0x21c63c[_0xd8ae('0x41')]);_0x4cea34[_0xd8ae('0x42')]=_[_0xd8ae('0x43')](_0x4cea34[_0xd8ae('0x40')],_0x4cea34[_0xd8ae('0x41')]);_0x2b4133['attributes']=_[_0xd8ae('0x43')](_0x4cea34[_0xd8ae('0x40')],qs['fields'](_0x21c63c[_0xd8ae('0x41')]['fields']));_0x2b4133[_0xd8ae('0x44')]=_0x2b4133[_0xd8ae('0x44')][_0xd8ae('0x45')]?_0x2b4133[_0xd8ae('0x44')]:_0x4cea34[_0xd8ae('0x40')];if(!_0x21c63c[_0xd8ae('0x41')][_0xd8ae('0x46')]('nolimit')){_0x2b4133[_0xd8ae('0x2f')]=qs['limit'](_0x21c63c['query']['limit']);_0x2b4133[_0xd8ae('0x2d')]=qs[_0xd8ae('0x2d')](_0x21c63c[_0xd8ae('0x41')][_0xd8ae('0x2d')]);}_0x2b4133[_0xd8ae('0x47')]=qs[_0xd8ae('0x48')](_0x21c63c['query'][_0xd8ae('0x48')]);_0x2b4133[_0xd8ae('0x49')]=qs[_0xd8ae('0x42')](_[_0xd8ae('0x4a')](_0x21c63c['query'],_0x4cea34['filters']),_0x473dd2);if(_0x21c63c[_0xd8ae('0x41')][_0xd8ae('0x4b')]){_0x2b4133[_0xd8ae('0x49')]=_[_0xd8ae('0x4c')](_0x2b4133[_0xd8ae('0x49')],{'$or':_['map'](_0x473dd2,function(_0x278aff){if(_0x278aff[_0xd8ae('0x4d')]!==_0xd8ae('0x4e')){var _0x346b13={};_0x346b13[_0x278aff[_0xd8ae('0x38')]]={'$like':'%'+_0x21c63c[_0xd8ae('0x41')]['filter']+'%'};return _0x346b13;}})});}_0x2b4133=_[_0xd8ae('0x4c')]({},_0x2b4133,_0x21c63c['options']);var _0xb5ec06={'where':_0x2b4133[_0xd8ae('0x49')]};return db[_0xd8ae('0x3c')][_0xd8ae('0x4f')](_0xb5ec06)[_0xd8ae('0x20')](function(_0x11db47){_0x2d7b47[_0xd8ae('0x4f')]=_0x11db47;if(_0x21c63c[_0xd8ae('0x41')][_0xd8ae('0x50')]){_0x2b4133[_0xd8ae('0x51')]=[{'all':!![]}];}return db[_0xd8ae('0x3c')][_0xd8ae('0x52')](_0x2b4133);})[_0xd8ae('0x20')](function(_0x1beb34){_0x2d7b47[_0xd8ae('0x53')]=_0x1beb34;return _0x2d7b47;})[_0xd8ae('0x20')](respondWithFilteredResult(_0x575fae,_0x2b4133))[_0xd8ae('0x29')](handleError(_0x575fae,null));};exports[_0xd8ae('0x54')]=function(_0x2bb36a,_0xc0c80f){var _0x33bae8={'raw':!![],'where':{'id':_0x2bb36a[_0xd8ae('0x55')]['id']}},_0x2fa1a5={};_0x2fa1a5[_0xd8ae('0x40')]=_['keys'](db[_0xd8ae('0x3c')]['rawAttributes']);_0x2fa1a5[_0xd8ae('0x41')]=_[_0xd8ae('0x56')](_0x2bb36a[_0xd8ae('0x41')]);_0x2fa1a5['filters']=_['intersection'](_0x2fa1a5[_0xd8ae('0x40')],_0x2fa1a5[_0xd8ae('0x41')]);_0x33bae8['attributes']=_[_0xd8ae('0x43')](_0x2fa1a5[_0xd8ae('0x40')],qs[_0xd8ae('0x57')](_0x2bb36a[_0xd8ae('0x41')][_0xd8ae('0x57')]));_0x33bae8['attributes']=_0x33bae8[_0xd8ae('0x44')]['length']?_0x33bae8[_0xd8ae('0x44')]:_0x2fa1a5['model'];if(_0x2bb36a[_0xd8ae('0x41')][_0xd8ae('0x50')]){_0x33bae8[_0xd8ae('0x51')]=[{'all':!![]}];}_0x33bae8=_[_0xd8ae('0x4c')]({},_0x33bae8,_0x2bb36a['options']);return db[_0xd8ae('0x3c')][_0xd8ae('0x58')](_0x33bae8)[_0xd8ae('0x20')](handleEntityNotFound(_0xc0c80f,null))[_0xd8ae('0x20')](respondWithResult(_0xc0c80f,null))[_0xd8ae('0x29')](handleError(_0xc0c80f,null));};exports[_0xd8ae('0x59')]=function(_0x48f6bc,_0x80935e){return db[_0xd8ae('0x3c')][_0xd8ae('0x59')](_0x48f6bc[_0xd8ae('0x5a')],{})['then'](respondWithResult(_0x80935e,0xc9))['catch'](handleError(_0x80935e,null));};exports[_0xd8ae('0x34')]=function(_0x497e36,_0x5f965e){if(_0x497e36['body']['id']){delete _0x497e36[_0xd8ae('0x5a')]['id'];}return db[_0xd8ae('0x3c')][_0xd8ae('0x58')]({'where':{'id':_0x497e36[_0xd8ae('0x55')]['id']}})[_0xd8ae('0x20')](handleEntityNotFound(_0x5f965e,null))[_0xd8ae('0x20')](saveUpdates(_0x497e36[_0xd8ae('0x5a')],null))[_0xd8ae('0x20')](respondWithResult(_0x5f965e,null))[_0xd8ae('0x29')](handleError(_0x5f965e,null));};exports[_0xd8ae('0x35')]=function(_0x326dc9,_0x575b43){return db['ChatMessage'][_0xd8ae('0x58')]({'where':{'id':_0x326dc9[_0xd8ae('0x55')]['id']}})['then'](handleEntityNotFound(_0x575b43,null))[_0xd8ae('0x20')](removeEntity(_0x575b43,null))['catch'](handleError(_0x575b43,null));};exports[_0xd8ae('0x5b')]=function(_0x464bb6,_0x25c18d){return db['ChatMessage'][_0xd8ae('0x5b')]()[_0xd8ae('0x20')](respondWithResult(_0x25c18d,null))[_0xd8ae('0x29')](handleError(_0x25c18d,null));};var interaction_log=require('../../config/logger')(_0xd8ae('0x5c'));exports[_0xd8ae('0x5d')]=function(_0xc297fb,_0x421ff0,_0x1a7845){var _0x2f0bdf={'agent':{},'channel':_0xd8ae('0x5e')};if(_0xc297fb['body']['id']){delete _0xc297fb[_0xd8ae('0x5a')]['id'];}_0xc297fb[_0xd8ae('0x5a')][_0xd8ae('0x5f')]=!![];_0xc297fb[_0xd8ae('0x5a')]['readAt']=moment()[_0xd8ae('0x60')](_0xd8ae('0x61'));_0xc297fb[_0xd8ae('0x5a')][_0xd8ae('0x62')]=_0xc297fb['body']['UserId']||_0xc297fb[_0xd8ae('0x63')]['id'];_0x2f0bdf[_0xd8ae('0x64')]['id']=_0xc297fb[_0xd8ae('0x5a')]['UserId'];return db[_0xd8ae('0x3c')]['find']({'where':{'id':_0xc297fb[_0xd8ae('0x55')]['id'],'UserId':null}})[_0xd8ae('0x20')](handleEntityNotFound(_0x421ff0,null))[_0xd8ae('0x20')](saveUpdates(_0xc297fb[_0xd8ae('0x5a')],null))[_0xd8ae('0x20')](function(_0x132dcd){if(_0x132dcd){_0x2f0bdf['message']=_0x132dcd[_0xd8ae('0x65')]({'plain':!![]});return db[_0xd8ae('0x66')]['find']({'where':{'id':_0x132dcd[_0xd8ae('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x421ff0,null))[_0xd8ae('0x20')](function(_0x442004){if(_0x442004){return _0x442004[_0xd8ae('0x34')]({'UserId':_0xc297fb[_0xd8ae('0x5a')][_0xd8ae('0x62')],'read1stAt':_[_0xd8ae('0x68')](_0x442004[_0xd8ae('0x69')])?moment()['format'](_0xd8ae('0x61')):undefined});}return null;})[_0xd8ae('0x20')](function(_0x40c219){if(_0x40c219){_0x2f0bdf['interaction']=_0x40c219['get']({'plain':!![]});interaction_log[_0xd8ae('0x21')](_0xd8ae('0x6a'),_0xc297fb[_0xd8ae('0x63')]['id'],_0xc297fb['user'][_0xd8ae('0x38')],_0xc297fb[_0xd8ae('0x63')]['role'],_0x2f0bdf[_0xd8ae('0x6b')]['id'],_0xc297fb[_0xd8ae('0x5a')]?JSON[_0xd8ae('0x24')](_0xc297fb['body']):_0xd8ae('0x6c'));return respondWithRpcPromise(_0xd8ae('0x6d'),_0xd8ae('0x6e'),_0x2f0bdf);}return null;})[_0xd8ae('0x20')](function(_0x1b0308){var _0xb25d82=_0xd8ae('0x6f')+_0x1b0308['message'][_0xd8ae('0x70')];return db[_0xd8ae('0x71')]['query'](_0xb25d82,{'type':db[_0xd8ae('0x72')][_0xd8ae('0x73')][_0xd8ae('0x74')],'raw':!![]})[_0xd8ae('0x20')](function(_0x316218){return _0x316218;});})[_0xd8ae('0x20')](function(_0x518a67){if(_0x518a67){_0x2f0bdf[_0xd8ae('0x27')][_0xd8ae('0x75')]=_0x518a67[0x0];if(!_0xc297fb[_0xd8ae('0x5a')]['UserId'])return;return db['User'][_0xd8ae('0x58')]({'where':{'id':_0xc297fb[_0xd8ae('0x5a')][_0xd8ae('0x62')],'role':'agent'},'attributes':['id','name','fullname',_0xd8ae('0x76'),'internal'],'raw':!![]});}return null;})[_0xd8ae('0x20')](function(_0x5703eb){if(!_0x5703eb)return null;_0x2f0bdf[_0xd8ae('0x27')][_0xd8ae('0x64')]=_0x5703eb;return _0x2f0bdf;})[_0xd8ae('0x20')](function(_0x24a5db){if(_0x24a5db){if(_0xc297fb[_0xd8ae('0x5a')][_0xd8ae('0x77')]){_0x2f0bdf[_0xd8ae('0x27')][_0xd8ae('0x78')]=util[_0xd8ae('0x60')]('SIP/%s',_0xc297fb[_0xd8ae('0x63')][_0xd8ae('0x38')]);_0x2f0bdf[_0xd8ae('0x27')]['channel']=_0x2f0bdf[_0xd8ae('0x79')];_0x2f0bdf[_0xd8ae('0x27')]['motionChannel']=_0x2f0bdf[_0xd8ae('0x79')];_0x2f0bdf[_0xd8ae('0x27')][_0xd8ae('0x7a')]=_0xd8ae('0x5d');return respondWithRpcPromise(_0xd8ae('0x7b'),'EventManager',{'event':_0xd8ae('0x7c'),'message':_[_0xd8ae('0x4c')](_0x2f0bdf['message'],JSON[_0xd8ae('0x7d')](_0x2f0bdf[_0xd8ae('0x6b')]['formData']))},client9002)[_0xd8ae('0x20')](function(){return _0x2f0bdf;});}return _0x2f0bdf;}return null;})['then'](respondWithResult(_0x421ff0,null))['catch'](handleError(_0x421ff0,null));};var interaction_log=require(_0xd8ae('0x7e'))(_0xd8ae('0x5c'));exports[_0xd8ae('0x32')]=function(_0x2cb653,_0x44b6b2,_0x45a4d4){var _0x583028={'agent':{},'channel':_0xd8ae('0x5e')};if(_0x2cb653[_0xd8ae('0x5a')]['id']){delete _0x2cb653[_0xd8ae('0x5a')]['id'];}_0x2cb653['body'][_0xd8ae('0x62')]=_0x2cb653[_0xd8ae('0x5a')]['UserId']||_0x2cb653[_0xd8ae('0x63')]['id'];_0x583028[_0xd8ae('0x64')]['id']=_0x2cb653[_0xd8ae('0x5a')][_0xd8ae('0x62')];return db['ChatMessage'][_0xd8ae('0x58')]({'where':{'id':_0x2cb653['params']['id'],'UserId':null}})[_0xd8ae('0x20')](handleEntityNotFound(_0x44b6b2,null))[_0xd8ae('0x20')](function(_0x1971dc){if(_0x1971dc){_0x583028[_0xd8ae('0x27')]=_0x1971dc[_0xd8ae('0x65')]({'plain':!![]});return db['ChatInteraction'][_0xd8ae('0x58')]({'where':{'id':_0x1971dc[_0xd8ae('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x44b6b2,null))[_0xd8ae('0x20')](function(_0xe914c2){if(_0xe914c2){_0x583028[_0xd8ae('0x6b')]=_0xe914c2[_0xd8ae('0x65')]({'plain':!![]});interaction_log[_0xd8ae('0x21')](_0xd8ae('0x7f'),_0x2cb653[_0xd8ae('0x63')]['id'],_0x2cb653['user'][_0xd8ae('0x38')],_0x2cb653[_0xd8ae('0x63')][_0xd8ae('0x80')],_0x583028[_0xd8ae('0x6b')]['id'],_0x2cb653[_0xd8ae('0x5a')]?JSON[_0xd8ae('0x24')](_0x2cb653['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x583028);}return null;})[_0xd8ae('0x20')](function(_0x53eba7){var _0x21d421=_0xd8ae('0x6f')+_0x53eba7['message'][_0xd8ae('0x70')];return db[_0xd8ae('0x71')][_0xd8ae('0x41')](_0x21d421,{'type':db[_0xd8ae('0x72')]['QueryTypes'][_0xd8ae('0x74')],'raw':!![]})['then'](function(_0x1799c6){return _0x1799c6;});})['then'](function(_0x4c421f){if(_0x4c421f){_0x583028['message'][_0xd8ae('0x75')]=_0x4c421f[0x0];if(!_0x2cb653[_0xd8ae('0x5a')][_0xd8ae('0x62')])return;return db[_0xd8ae('0x81')][_0xd8ae('0x58')]({'where':{'id':_0x2cb653[_0xd8ae('0x5a')][_0xd8ae('0x62')],'role':'agent'},'attributes':['id',_0xd8ae('0x38'),_0xd8ae('0x82'),_0xd8ae('0x76'),_0xd8ae('0x83')],'raw':!![]});}return null;})['then'](function(_0x14a12b){if(!_0x14a12b)return null;_0x583028[_0xd8ae('0x27')][_0xd8ae('0x64')]=_0x14a12b;return _0x583028;})['then'](function(_0x44f3d8){if(_0x44f3d8){_0x44f3d8[_0xd8ae('0x27')][_0xd8ae('0x78')]=util[_0xd8ae('0x60')](_0xd8ae('0x84'),_0x2cb653[_0xd8ae('0x63')][_0xd8ae('0x38')]);_0x44f3d8[_0xd8ae('0x27')][_0xd8ae('0x79')]=_0x583028[_0xd8ae('0x79')];_0x44f3d8[_0xd8ae('0x27')]['motionChannel']=_0x583028['channel'];_0x44f3d8['message']['event']=_0xd8ae('0x32');respondWithRpcPromise(_0xd8ae('0x7b'),_0xd8ae('0x7b'),{'event':_0xd8ae('0x85'),'message':_[_0xd8ae('0x4c')](_0x583028['message'],JSON[_0xd8ae('0x7d')](_0x583028[_0xd8ae('0x6b')][_0xd8ae('0x86')]))},client9002);return _0x583028;}return null;})[_0xd8ae('0x20')](respondWithResult(_0x44b6b2,null))['catch'](handleError(_0x44b6b2,null));}; \ No newline at end of file +var _0x05cd=['set','Content-Range','reject','save','destroy','sendStatus','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','ChatMessage','includeAll','include','findAll','rows','find','create','body','update','params','describe','../../config/logger','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','ChatInteractionId','read1stAt','interaction','get','[CHATMESSAGE: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','contact','User','agent','fullname','email','internal','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','rejectMessage','QueryTypes','SELECT','interface','rejectmessage','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','end','status','json','offset','limit','count'];(function(_0x555573,_0x462f66){var _0x2c48e4=function(_0x1c00ac){while(--_0x1c00ac){_0x555573['push'](_0x555573['shift']());}};_0x2c48e4(++_0x462f66);}(_0x05cd,0xd4));var _0xd05c=function(_0x3b58b5,_0x5799ad){_0x3b58b5=_0x3b58b5-0x0;var _0x5d48e6=_0x05cd[_0x3b58b5];return _0x5d48e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd05c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd05c('0x1'));var rp=require(_0xd05c('0x2'));var moment=require(_0xd05c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd05c('0x4'));var util=require(_0xd05c('0x5'));var path=require(_0xd05c('0x6'));var sox=require(_0xd05c('0x7'));var csv=require(_0xd05c('0x8'));var ejs=require(_0xd05c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd05c('0xa'));var squel=require(_0xd05c('0xb'));var crypto=require(_0xd05c('0xc'));var jsforce=require(_0xd05c('0xd'));var deskjs=require(_0xd05c('0xe'));var toCsv=require(_0xd05c('0x8'));var querystring=require(_0xd05c('0xf'));var Papa=require('papaparse');var Redis=require(_0xd05c('0x10'));var authService=require(_0xd05c('0x11'));var qs=require(_0xd05c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd05c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd05c('0x14'));var config=require(_0xd05c('0x15'));var licenseUtil=require(_0xd05c('0x16'));var db=require(_0xd05c('0x17'))['db'];config[_0xd05c('0x18')]=_[_0xd05c('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd05c('0x1a'))(new Redis(config[_0xd05c('0x18')]));require(_0xd05c('0x1b'))['register'](socket);var jayson=require(_0xd05c('0x1c'));var client=jayson[_0xd05c('0x1d')][_0xd05c('0x1e')]({'port':0x232c});var client9002=jayson[_0xd05c('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x504db0,_0x455804,_0x2645d3,_0x29a6e7){return new BPromise(function(_0x1d6838,_0x57fa3f){var _0x431611=_0x29a6e7||client;return _0x431611[_0xd05c('0x1f')](_0x504db0,_0x2645d3)[_0xd05c('0x20')](function(_0xb3a471){logger[_0xd05c('0x21')](_0xd05c('0x22'),_0x455804,'request\x20sent');logger['debug'](_0xd05c('0x23'),_0x455804,'request\x20sent',JSON['stringify'](_0xb3a471));if(_0xb3a471[_0xd05c('0x24')]){if(_0xb3a471[_0xd05c('0x24')][_0xd05c('0x25')]===0x1f4){logger['error'](_0xd05c('0x22'),_0x455804,_0xb3a471[_0xd05c('0x24')][_0xd05c('0x26')]);return _0x57fa3f(_0xb3a471[_0xd05c('0x24')][_0xd05c('0x26')]);}logger['error'](_0xd05c('0x22'),_0x455804,_0xb3a471[_0xd05c('0x24')]['message']);return _0x1d6838(_0xb3a471[_0xd05c('0x24')][_0xd05c('0x26')]);}else{logger['info'](_0xd05c('0x22'),_0x455804,'request\x20sent');_0x1d6838(_0xb3a471['result'][_0xd05c('0x26')]);}})[_0xd05c('0x27')](function(_0x6d4d9e){logger[_0xd05c('0x24')](_0xd05c('0x22'),_0x455804,_0x6d4d9e);_0x57fa3f(_0x6d4d9e);});});}function respondWithStatusCode(_0x4937f2,_0x27876d){_0x27876d=_0x27876d||0xcc;return function(_0x58011b){if(_0x58011b){return _0x4937f2['sendStatus'](_0x27876d);}return _0x4937f2['status'](_0x27876d)[_0xd05c('0x28')]();};}function respondWithResult(_0x3a38a0,_0x254034){_0x254034=_0x254034||0xc8;return function(_0x49d14a){if(_0x49d14a){return _0x3a38a0[_0xd05c('0x29')](_0x254034)[_0xd05c('0x2a')](_0x49d14a);}};}function respondWithFilteredResult(_0x546107,_0x2b9a43){return function(_0x26e195){if(_0x26e195){var _0x4d5513=typeof _0x2b9a43[_0xd05c('0x2b')]==='undefined'&&typeof _0x2b9a43[_0xd05c('0x2c')]==='undefined';var _0x573bfb=_0x26e195[_0xd05c('0x2d')];var _0x530949=_0x4d5513?0x0:_0x2b9a43[_0xd05c('0x2b')];var _0x52c85c=_0x4d5513?_0x26e195['count']:_0x2b9a43['offset']+_0x2b9a43[_0xd05c('0x2c')];var _0xfd08e2;if(_0x52c85c>=_0x573bfb){_0x52c85c=_0x573bfb;_0xfd08e2=0xc8;}else{_0xfd08e2=0xce;}_0x546107[_0xd05c('0x29')](_0xfd08e2);return _0x546107[_0xd05c('0x2e')](_0xd05c('0x2f'),_0x530949+'-'+_0x52c85c+'/'+_0x573bfb)['json'](_0x26e195);}return null;};}function patchUpdates(_0x178333){return function(_0x4b580c){try{jsonpatch['apply'](_0x4b580c,_0x178333,!![]);}catch(_0x497e59){return BPromise[_0xd05c('0x30')](_0x497e59);}return _0x4b580c[_0xd05c('0x31')]();};}function saveUpdates(_0x44b905,_0x5c2430){return function(_0x922ccb){if(_0x922ccb){return _0x922ccb['update'](_0x44b905)['then'](function(_0x4621df){return _0x4621df;});}return null;};}function removeEntity(_0x53bef1,_0xc25105){return function(_0xaffdce){if(_0xaffdce){return _0xaffdce[_0xd05c('0x32')]()[_0xd05c('0x20')](function(){_0x53bef1[_0xd05c('0x29')](0xcc)[_0xd05c('0x28')]();});}};}function handleEntityNotFound(_0x136d97,_0x515f02){return function(_0x3372f7){if(!_0x3372f7){_0x136d97[_0xd05c('0x33')](0x194);}return _0x3372f7;};}function handleError(_0x215fd8,_0x8a4931){_0x8a4931=_0x8a4931||0x1f4;return function(_0x1febbd){logger[_0xd05c('0x24')](_0x1febbd['stack']);if(_0x1febbd[_0xd05c('0x34')]){delete _0x1febbd[_0xd05c('0x34')];}_0x215fd8['status'](_0x8a4931)[_0xd05c('0x35')](_0x1febbd);};}exports['index']=function(_0x5afaaa,_0x1c4b85){var _0x56f26f={},_0x4f7307={},_0x569432={'count':0x0,'rows':[]};var _0x5b50ce=_[_0xd05c('0x36')](db['ChatMessage'][_0xd05c('0x37')],function(_0x32cd33){return{'name':_0x32cd33[_0xd05c('0x38')],'type':_0x32cd33['type'][_0xd05c('0x39')]};});_0x4f7307[_0xd05c('0x3a')]=_[_0xd05c('0x36')](_0x5b50ce,'name');_0x4f7307[_0xd05c('0x3b')]=_[_0xd05c('0x3c')](_0x5afaaa[_0xd05c('0x3b')]);_0x4f7307[_0xd05c('0x3d')]=_[_0xd05c('0x3e')](_0x4f7307[_0xd05c('0x3a')],_0x4f7307[_0xd05c('0x3b')]);_0x56f26f[_0xd05c('0x3f')]=_[_0xd05c('0x3e')](_0x4f7307[_0xd05c('0x3a')],qs[_0xd05c('0x40')](_0x5afaaa[_0xd05c('0x3b')][_0xd05c('0x40')]));_0x56f26f['attributes']=_0x56f26f['attributes'][_0xd05c('0x41')]?_0x56f26f[_0xd05c('0x3f')]:_0x4f7307[_0xd05c('0x3a')];if(!_0x5afaaa[_0xd05c('0x3b')]['hasOwnProperty'](_0xd05c('0x42'))){_0x56f26f[_0xd05c('0x2c')]=qs[_0xd05c('0x2c')](_0x5afaaa[_0xd05c('0x3b')][_0xd05c('0x2c')]);_0x56f26f[_0xd05c('0x2b')]=qs[_0xd05c('0x2b')](_0x5afaaa[_0xd05c('0x3b')][_0xd05c('0x2b')]);}_0x56f26f[_0xd05c('0x43')]=qs[_0xd05c('0x44')](_0x5afaaa[_0xd05c('0x3b')][_0xd05c('0x44')]);_0x56f26f['where']=qs[_0xd05c('0x3d')](_[_0xd05c('0x45')](_0x5afaaa[_0xd05c('0x3b')],_0x4f7307['filters']),_0x5b50ce);if(_0x5afaaa[_0xd05c('0x3b')][_0xd05c('0x46')]){_0x56f26f[_0xd05c('0x47')]=_[_0xd05c('0x48')](_0x56f26f[_0xd05c('0x47')],{'$or':_[_0xd05c('0x36')](_0x5b50ce,function(_0x2a28f2){if(_0x2a28f2[_0xd05c('0x49')]!=='VIRTUAL'){var _0x352c2a={};_0x352c2a[_0x2a28f2['name']]={'$like':'%'+_0x5afaaa[_0xd05c('0x3b')][_0xd05c('0x46')]+'%'};return _0x352c2a;}})});}_0x56f26f=_['merge']({},_0x56f26f,_0x5afaaa[_0xd05c('0x4a')]);var _0x48ae35={'where':_0x56f26f[_0xd05c('0x47')]};return db[_0xd05c('0x4b')][_0xd05c('0x2d')](_0x48ae35)[_0xd05c('0x20')](function(_0x402c3a){_0x569432[_0xd05c('0x2d')]=_0x402c3a;if(_0x5afaaa['query'][_0xd05c('0x4c')]){_0x56f26f[_0xd05c('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0xd05c('0x4e')](_0x56f26f);})['then'](function(_0x5c523e){_0x569432[_0xd05c('0x4f')]=_0x5c523e;return _0x569432;})[_0xd05c('0x20')](respondWithFilteredResult(_0x1c4b85,_0x56f26f))[_0xd05c('0x27')](handleError(_0x1c4b85,null));};exports['show']=function(_0x162b20,_0x2bb870){var _0x27add4={'raw':!![],'where':{'id':_0x162b20['params']['id']}},_0x5c8cb2={};_0x5c8cb2[_0xd05c('0x3a')]=_['keys'](db[_0xd05c('0x4b')][_0xd05c('0x37')]);_0x5c8cb2[_0xd05c('0x3b')]=_[_0xd05c('0x3c')](_0x162b20[_0xd05c('0x3b')]);_0x5c8cb2['filters']=_[_0xd05c('0x3e')](_0x5c8cb2[_0xd05c('0x3a')],_0x5c8cb2[_0xd05c('0x3b')]);_0x27add4[_0xd05c('0x3f')]=_[_0xd05c('0x3e')](_0x5c8cb2[_0xd05c('0x3a')],qs[_0xd05c('0x40')](_0x162b20['query'][_0xd05c('0x40')]));_0x27add4[_0xd05c('0x3f')]=_0x27add4[_0xd05c('0x3f')][_0xd05c('0x41')]?_0x27add4[_0xd05c('0x3f')]:_0x5c8cb2['model'];if(_0x162b20[_0xd05c('0x3b')][_0xd05c('0x4c')]){_0x27add4[_0xd05c('0x4d')]=[{'all':!![]}];}_0x27add4=_[_0xd05c('0x48')]({},_0x27add4,_0x162b20[_0xd05c('0x4a')]);return db[_0xd05c('0x4b')][_0xd05c('0x50')](_0x27add4)['then'](handleEntityNotFound(_0x2bb870,null))[_0xd05c('0x20')](respondWithResult(_0x2bb870,null))['catch'](handleError(_0x2bb870,null));};exports[_0xd05c('0x51')]=function(_0x4a2702,_0x399956){return db[_0xd05c('0x4b')][_0xd05c('0x51')](_0x4a2702[_0xd05c('0x52')],{})[_0xd05c('0x20')](respondWithResult(_0x399956,0xc9))[_0xd05c('0x27')](handleError(_0x399956,null));};exports[_0xd05c('0x53')]=function(_0x45b50c,_0x77916d){if(_0x45b50c[_0xd05c('0x52')]['id']){delete _0x45b50c['body']['id'];}return db['ChatMessage'][_0xd05c('0x50')]({'where':{'id':_0x45b50c['params']['id']}})['then'](handleEntityNotFound(_0x77916d,null))[_0xd05c('0x20')](saveUpdates(_0x45b50c[_0xd05c('0x52')],null))[_0xd05c('0x20')](respondWithResult(_0x77916d,null))[_0xd05c('0x27')](handleError(_0x77916d,null));};exports['destroy']=function(_0x325983,_0x419da7){return db[_0xd05c('0x4b')][_0xd05c('0x50')]({'where':{'id':_0x325983[_0xd05c('0x54')]['id']}})[_0xd05c('0x20')](handleEntityNotFound(_0x419da7,null))[_0xd05c('0x20')](removeEntity(_0x419da7,null))[_0xd05c('0x27')](handleError(_0x419da7,null));};exports[_0xd05c('0x55')]=function(_0x28b175,_0x537339){return db['ChatMessage'][_0xd05c('0x55')]()['then'](respondWithResult(_0x537339,null))['catch'](handleError(_0x537339,null));};var interaction_log=require(_0xd05c('0x56'))(_0xd05c('0x57'));exports[_0xd05c('0x58')]=function(_0x542ed4,_0x5cd5e0,_0x37bcc7){var _0x24e7c3={'agent':{},'channel':_0xd05c('0x59')};if(_0x542ed4['body']['id']){delete _0x542ed4[_0xd05c('0x52')]['id'];}_0x542ed4[_0xd05c('0x52')]['read']=!![];_0x542ed4[_0xd05c('0x52')][_0xd05c('0x5a')]=moment()[_0xd05c('0x5b')](_0xd05c('0x5c'));_0x542ed4['body'][_0xd05c('0x5d')]=_0x542ed4[_0xd05c('0x52')][_0xd05c('0x5d')]||_0x542ed4['user']['id'];_0x24e7c3['agent']['id']=_0x542ed4['body']['UserId'];return db[_0xd05c('0x4b')][_0xd05c('0x50')]({'where':{'id':_0x542ed4['params']['id'],'UserId':null}})[_0xd05c('0x20')](handleEntityNotFound(_0x5cd5e0,null))['then'](saveUpdates(_0x542ed4[_0xd05c('0x52')],null))[_0xd05c('0x20')](function(_0x1a50e5){if(_0x1a50e5){_0x24e7c3[_0xd05c('0x26')]=_0x1a50e5['get']({'plain':!![]});return db['ChatInteraction'][_0xd05c('0x50')]({'where':{'id':_0x1a50e5[_0xd05c('0x5e')]}});}return null;})[_0xd05c('0x20')](handleEntityNotFound(_0x5cd5e0,null))['then'](function(_0x59c217){if(_0x59c217){return _0x59c217[_0xd05c('0x53')]({'UserId':_0x542ed4['body'][_0xd05c('0x5d')],'read1stAt':_['isNil'](_0x59c217[_0xd05c('0x5f')])?moment()[_0xd05c('0x5b')](_0xd05c('0x5c')):undefined});}return null;})[_0xd05c('0x20')](function(_0x11f0ac){if(_0x11f0ac){_0x24e7c3[_0xd05c('0x60')]=_0x11f0ac[_0xd05c('0x61')]({'plain':!![]});interaction_log[_0xd05c('0x21')](_0xd05c('0x62'),_0x542ed4[_0xd05c('0x63')]['id'],_0x542ed4[_0xd05c('0x63')]['name'],_0x542ed4[_0xd05c('0x63')][_0xd05c('0x64')],_0x24e7c3[_0xd05c('0x60')]['id'],_0x542ed4['body']?JSON['stringify'](_0x542ed4['body']):'null');return respondWithRpcPromise(_0xd05c('0x65'),_0xd05c('0x66'),_0x24e7c3);}return null;})[_0xd05c('0x20')](function(_0x50bdc1){var _0x2d9e54=_0xd05c('0x67')+_0x50bdc1['message'][_0xd05c('0x68')];return db[_0xd05c('0x69')][_0xd05c('0x3b')](_0x2d9e54,{'type':db[_0xd05c('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})[_0xd05c('0x20')](function(_0x22cd55){return _0x22cd55;});})[_0xd05c('0x20')](function(_0x34655c){if(_0x34655c){_0x24e7c3[_0xd05c('0x26')][_0xd05c('0x6b')]=_0x34655c[0x0];if(!_0x542ed4['body'][_0xd05c('0x5d')])return;return db[_0xd05c('0x6c')][_0xd05c('0x50')]({'where':{'id':_0x542ed4[_0xd05c('0x52')]['UserId'],'role':_0xd05c('0x6d')},'attributes':['id',_0xd05c('0x34'),_0xd05c('0x6e'),_0xd05c('0x6f'),_0xd05c('0x70')],'raw':!![]});}return null;})['then'](function(_0xca753a){if(!_0xca753a)return null;_0x24e7c3['message'][_0xd05c('0x6d')]=_0xca753a;return _0x24e7c3;})['then'](function(_0x1e23e5){if(_0x1e23e5){if(_0x542ed4[_0xd05c('0x52')]['manual']){_0x24e7c3[_0xd05c('0x26')]['interface']=util[_0xd05c('0x5b')](_0xd05c('0x71'),_0x542ed4['user'][_0xd05c('0x34')]);_0x24e7c3['message'][_0xd05c('0x72')]=_0x24e7c3['channel'];_0x24e7c3[_0xd05c('0x26')][_0xd05c('0x73')]=_0x24e7c3[_0xd05c('0x72')];_0x24e7c3[_0xd05c('0x26')]['event']=_0xd05c('0x58');return respondWithRpcPromise('EventManager',_0xd05c('0x74'),{'event':_0xd05c('0x75'),'message':_[_0xd05c('0x48')](_0x24e7c3[_0xd05c('0x26')],JSON[_0xd05c('0x76')](_0x24e7c3['interaction'][_0xd05c('0x77')]))},client9002)[_0xd05c('0x20')](function(){return _0x24e7c3;});}return _0x24e7c3;}return null;})[_0xd05c('0x20')](respondWithResult(_0x5cd5e0,null))[_0xd05c('0x27')](handleError(_0x5cd5e0,null));};var interaction_log=require(_0xd05c('0x56'))(_0xd05c('0x57'));exports['reject']=function(_0x3e2815,_0x56d64b,_0x56f12c){var _0x2d6041={'agent':{},'channel':_0xd05c('0x59')};if(_0x3e2815['body']['id']){delete _0x3e2815['body']['id'];}_0x3e2815[_0xd05c('0x52')][_0xd05c('0x5d')]=_0x3e2815[_0xd05c('0x52')][_0xd05c('0x5d')]||_0x3e2815[_0xd05c('0x63')]['id'];_0x2d6041[_0xd05c('0x6d')]['id']=_0x3e2815[_0xd05c('0x52')][_0xd05c('0x5d')];return db[_0xd05c('0x4b')][_0xd05c('0x50')]({'where':{'id':_0x3e2815['params']['id'],'UserId':null}})[_0xd05c('0x20')](handleEntityNotFound(_0x56d64b,null))['then'](function(_0x3661de){if(_0x3661de){_0x2d6041['message']=_0x3661de[_0xd05c('0x61')]({'plain':!![]});return db[_0xd05c('0x78')][_0xd05c('0x50')]({'where':{'id':_0x3661de[_0xd05c('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x56d64b,null))[_0xd05c('0x20')](function(_0x1c7791){if(_0x1c7791){_0x2d6041[_0xd05c('0x60')]=_0x1c7791[_0xd05c('0x61')]({'plain':!![]});interaction_log[_0xd05c('0x21')](_0xd05c('0x79'),_0x3e2815[_0xd05c('0x63')]['id'],_0x3e2815[_0xd05c('0x63')][_0xd05c('0x34')],_0x3e2815['user'][_0xd05c('0x64')],_0x2d6041[_0xd05c('0x60')]['id'],_0x3e2815[_0xd05c('0x52')]?JSON[_0xd05c('0x7a')](_0x3e2815[_0xd05c('0x52')]):_0xd05c('0x7b'));return respondWithRpcPromise('RejectMessage',_0xd05c('0x7c'),_0x2d6041);}return null;})[_0xd05c('0x20')](function(_0x15a87a){var _0x530775=_0xd05c('0x67')+_0x15a87a[_0xd05c('0x26')][_0xd05c('0x68')];return db[_0xd05c('0x69')]['query'](_0x530775,{'type':db[_0xd05c('0x6a')][_0xd05c('0x7d')][_0xd05c('0x7e')],'raw':!![]})[_0xd05c('0x20')](function(_0x18387e){return _0x18387e;});})[_0xd05c('0x20')](function(_0x34b001){if(_0x34b001){_0x2d6041[_0xd05c('0x26')][_0xd05c('0x6b')]=_0x34b001[0x0];if(!_0x3e2815['body'][_0xd05c('0x5d')])return;return db['User'][_0xd05c('0x50')]({'where':{'id':_0x3e2815[_0xd05c('0x52')][_0xd05c('0x5d')],'role':_0xd05c('0x6d')},'attributes':['id','name',_0xd05c('0x6e'),'email',_0xd05c('0x70')],'raw':!![]});}return null;})[_0xd05c('0x20')](function(_0x2dbbba){if(!_0x2dbbba)return null;_0x2d6041[_0xd05c('0x26')]['agent']=_0x2dbbba;return _0x2d6041;})['then'](function(_0x250598){if(_0x250598){_0x250598[_0xd05c('0x26')][_0xd05c('0x7f')]=util[_0xd05c('0x5b')](_0xd05c('0x71'),_0x3e2815[_0xd05c('0x63')][_0xd05c('0x34')]);_0x250598[_0xd05c('0x26')][_0xd05c('0x72')]=_0x2d6041[_0xd05c('0x72')];_0x250598[_0xd05c('0x26')]['motionChannel']=_0x2d6041['channel'];_0x250598[_0xd05c('0x26')]['event']=_0xd05c('0x30');respondWithRpcPromise(_0xd05c('0x74'),_0xd05c('0x74'),{'event':_0xd05c('0x80'),'message':_[_0xd05c('0x48')](_0x2d6041['message'],JSON[_0xd05c('0x76')](_0x2d6041['interaction'][_0xd05c('0x77')]))},client9002);return _0x2d6041;}return null;})[_0xd05c('0x20')](respondWithResult(_0x56d64b,null))[_0xd05c('0x27')](handleError(_0x56d64b,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index ca913b6..0997b4e 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 _0x3432=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x193653,_0x422a45){var _0x1ed7b8=function(_0xdc78ca){while(--_0xdc78ca){_0x193653['push'](_0x193653['shift']());}};_0x1ed7b8(++_0x422a45);}(_0x3432,0x163));var _0x2343=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3432[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x2343('0x0'));var ChatMessage=require(_0x2343('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2343('0x2')](0x0);var events={'afterCreate':_0x2343('0x3'),'afterUpdate':_0x2343('0x4'),'afterDestroy':_0x2343('0x5')};function emitEvent(_0x28ae09){return function(_0x49c984,_0x3a5a89,_0x217adc){ChatMessageEvents[_0x2343('0x6')](_0x28ae09+':'+_0x49c984['id'],_0x49c984);ChatMessageEvents[_0x2343('0x6')](_0x28ae09,_0x49c984);_0x217adc(null);};}for(var e in events){if(events[_0x2343('0x7')](e)){var event=events[e];ChatMessage[_0x2343('0x8')](e,emitEvent(event));}}module[_0x2343('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x780b=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit'];(function(_0xd5307f,_0x4d1fe9){var _0x39d3d4=function(_0x40c4e1){while(--_0x40c4e1){_0xd5307f['push'](_0xd5307f['shift']());}};_0x39d3d4(++_0x4d1fe9);}(_0x780b,0xa3));var _0xb780=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x780b[_0x297fd3];return _0x2af381;};'use strict';var EventEmitter=require(_0xb780('0x0'));var ChatMessage=require(_0xb780('0x1'))['db'][_0xb780('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb780('0x3')](0x0);var events={'afterCreate':_0xb780('0x4'),'afterUpdate':_0xb780('0x5'),'afterDestroy':'remove'};function emitEvent(_0x25a884){return function(_0x15e882,_0x412b4d,_0x418bc1){ChatMessageEvents[_0xb780('0x6')](_0x25a884+':'+_0x15e882['id'],_0x15e882);ChatMessageEvents[_0xb780('0x6')](_0x25a884,_0x15e882);_0x418bc1(null);};}for(var e in events){if(events[_0xb780('0x7')](e)){var event=events[e];ChatMessage[_0xb780('0x8')](e,emitEvent(event));}}module[_0xb780('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a584c4b..42da59c 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 _0xea49=['request-promise','path','rimraf','./chatMessage.attributes','exports','define','fti_chat_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','ChatInteraction','findOne','then','createdAt','toLowerCase','catch','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x161587,_0x5c4528){var _0x293546=function(_0x40406e){while(--_0x40406e){_0x161587['push'](_0x161587['shift']());}};_0x293546(++_0x5c4528);}(_0xea49,0x14b));var _0x9ea4=function(_0x213ed5,_0x26712a){_0x213ed5=_0x213ed5-0x0;var _0x191514=_0xea49[_0x213ed5];return _0x191514;};'use strict';var _=require(_0x9ea4('0x0'));var util=require(_0x9ea4('0x1'));var logger=require('../../config/logger')(_0x9ea4('0x2'));var moment=require(_0x9ea4('0x3'));var BPromise=require(_0x9ea4('0x4'));var rp=require(_0x9ea4('0x5'));var fs=require('fs');var path=require(_0x9ea4('0x6'));var rimraf=require(_0x9ea4('0x7'));var config=require('../../config/environment');var attributes=require(_0x9ea4('0x8'));module[_0x9ea4('0x9')]=function(_0x28aa83,_0x1cd230){return _0x28aa83[_0x9ea4('0xa')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x9ea4('0xb'),'fields':[_0x9ea4('0xc')],'type':_0x9ea4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x231ec0,_0x433d5a,_0x3e81b8){var _0x4fbdf0=_0x28aa83[_0x9ea4('0xe')];var _0x2f8309=_0x231ec0[_0x9ea4('0xf')]({'plain':!![]});if(_0x2f8309[_0x9ea4('0x10')]['toLowerCase']()==='in'||_0x2f8309[_0x9ea4('0x10')]['toLowerCase']()===_0x9ea4('0x11')&&!_0x2f8309[_0x9ea4('0x12')]&&!_[_0x9ea4('0x13')](_0x2f8309[_0x9ea4('0x14')])){_0x4fbdf0[_0x9ea4('0x15')][_0x9ea4('0x16')]({'where':{'id':_0x2f8309['ChatInteractionId']}})[_0x9ea4('0x17')](function(_0x54f930){if(_0x54f930){_0x54f930['update']({'lastMsgAt':_0x2f8309[_0x9ea4('0x18')],'lastMsgDirection':_0x2f8309[_0x9ea4('0x10')][_0x9ea4('0x19')]()});}})[_0x9ea4('0x1a')](function(_0x3bf7a5){console['error'](_0x3bf7a5);});}_0x3e81b8();}},'charset':'utf8mb4','collate':_0x9ea4('0x1b')});}; \ No newline at end of file +var _0x8f1d=['define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports'];(function(_0x876194,_0x2d77c2){var _0x5dd914=function(_0x681caa){while(--_0x681caa){_0x876194['push'](_0x876194['shift']());}};_0x5dd914(++_0x2d77c2);}(_0x8f1d,0x72));var _0xd8f1=function(_0x477491,_0x5ca700){_0x477491=_0x477491-0x0;var _0xac6aec=_0x8f1d[_0x477491];return _0xac6aec;};'use strict';var _=require(_0xd8f1('0x0'));var util=require(_0xd8f1('0x1'));var logger=require('../../config/logger')(_0xd8f1('0x2'));var moment=require(_0xd8f1('0x3'));var BPromise=require(_0xd8f1('0x4'));var rp=require(_0xd8f1('0x5'));var fs=require('fs');var path=require(_0xd8f1('0x6'));var rimraf=require('rimraf');var config=require(_0xd8f1('0x7'));var attributes=require(_0xd8f1('0x8'));module[_0xd8f1('0x9')]=function(_0x103610,_0x5ef96f){return _0x103610[_0xd8f1('0xa')](_0xd8f1('0xb'),attributes,{'tableName':_0xd8f1('0xc'),'paranoid':![],'indexes':[{'name':_0xd8f1('0xd'),'fields':[_0xd8f1('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29db48,_0x2e88e9,_0x2c423e){var _0xfa16f5=_0x103610[_0xd8f1('0xf')];var _0x53c6b6=_0x29db48[_0xd8f1('0x10')]({'plain':!![]});if(_0x53c6b6[_0xd8f1('0x11')]['toLowerCase']()==='in'||_0x53c6b6[_0xd8f1('0x11')]['toLowerCase']()===_0xd8f1('0x12')&&!_0x53c6b6[_0xd8f1('0x13')]&&!_['isNil'](_0x53c6b6[_0xd8f1('0x14')])){_0xfa16f5[_0xd8f1('0x15')][_0xd8f1('0x16')]({'where':{'id':_0x53c6b6[_0xd8f1('0x17')]}})[_0xd8f1('0x18')](function(_0x269e57){if(_0x269e57){_0x269e57[_0xd8f1('0x19')]({'lastMsgAt':_0x53c6b6[_0xd8f1('0x1a')],'lastMsgDirection':_0x53c6b6['direction'][_0xd8f1('0x1b')]()});}})[_0xd8f1('0x1c')](function(_0xc6828c){console['error'](_0xc6828c);});}_0x2c423e();}},'charset':_0xd8f1('0x1d'),'collate':_0xd8f1('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5df5ca8..6dc1aec 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 _0xa673=['ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateChatMessage','create','body','options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','./chatMessage.socket','request','then'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0xa673,0x17b));var _0x3a67=function(_0x35005f,_0x4dad9f){_0x35005f=_0x35005f-0x0;var _0x1f0270=_0xa673[_0x35005f];return _0x1f0270;};'use strict';var _=require(_0x3a67('0x0'));var util=require(_0x3a67('0x1'));var moment=require(_0x3a67('0x2'));var BPromise=require(_0x3a67('0x3'));var rs=require(_0x3a67('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a67('0x5'))['db'];var utils=require(_0x3a67('0x6'));var logger=require(_0x3a67('0x7'))('rpc');var config=require(_0x3a67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a67('0x9')][_0x3a67('0xa')]({'port':0x232a});config['redis']=_[_0x3a67('0xb')](config[_0x3a67('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a67('0xd'))(new Redis(config[_0x3a67('0xc')]));require(_0x3a67('0xe'))['register'](socket);function respondWithRpcPromise(_0x5195d2,_0x3b3ed2,_0x27f828){return new BPromise(function(_0x1884e2,_0x1774f4){return client[_0x3a67('0xf')](_0x5195d2,_0x27f828)[_0x3a67('0x10')](function(_0x4ff92f){logger['info'](_0x3a67('0x11'),_0x3b3ed2,'request\x20sent');logger['debug'](_0x3a67('0x12'),_0x3b3ed2,_0x3a67('0x13'),JSON['stringify'](_0x4ff92f));if(_0x4ff92f[_0x3a67('0x14')]){if(_0x4ff92f['error'][_0x3a67('0x15')]===0x1f4){logger[_0x3a67('0x14')](_0x3a67('0x11'),_0x3b3ed2,_0x4ff92f['error'][_0x3a67('0x16')]);return _0x1774f4(_0x4ff92f[_0x3a67('0x14')][_0x3a67('0x16')]);}logger[_0x3a67('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3b3ed2,_0x4ff92f['error'][_0x3a67('0x16')]);return _0x1884e2(_0x4ff92f[_0x3a67('0x14')][_0x3a67('0x16')]);}else{logger[_0x3a67('0x17')](_0x3a67('0x11'),_0x3b3ed2,_0x3a67('0x13'));_0x1884e2(_0x4ff92f[_0x3a67('0x18')][_0x3a67('0x16')]);}})[_0x3a67('0x19')](function(_0x1c4b43){logger[_0x3a67('0x14')](_0x3a67('0x11'),_0x3b3ed2,_0x1c4b43);_0x1774f4(_0x1c4b43);});});}exports[_0x3a67('0x1a')]=function(_0x2b9813){var _0x2115dd=this;return new Promise(function(_0x372778,_0xc08b88){return db['ChatMessage'][_0x3a67('0x1b')](_0x2b9813[_0x3a67('0x1c')],{'raw':_0x2b9813[_0x3a67('0x1d')]?_0x2b9813[_0x3a67('0x1d')][_0x3a67('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0xb199d){logger['info'](_0x3a67('0x1a'),_0x2b9813);logger[_0x3a67('0x1f')](_0x3a67('0x1a'),_0x2b9813,JSON[_0x3a67('0x20')](_0xb199d));_0x372778(_0xb199d);})[_0x3a67('0x19')](function(_0x225481){logger[_0x3a67('0x14')]('CreateChatMessage',_0x225481[_0x3a67('0x16')],_0x2b9813);_0xc08b88(_0x2115dd[_0x3a67('0x14')](0x1f4,_0x225481['message']));});});}; \ No newline at end of file +var _0x9834=['ChatMessage,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatMessage','create','body','options','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','socket.io-emitter','register','request','then'];(function(_0xe72e2a,_0x3d600f){var _0x1ee37e=function(_0x27c473){while(--_0x27c473){_0xe72e2a['push'](_0xe72e2a['shift']());}};_0x1ee37e(++_0x3d600f);}(_0x9834,0xd1));var _0x4983=function(_0xe057df,_0x49c828){_0xe057df=_0xe057df-0x0;var _0x518ae4=_0x9834[_0xe057df];return _0x518ae4;};'use strict';var _=require(_0x4983('0x0'));var util=require(_0x4983('0x1'));var moment=require(_0x4983('0x2'));var BPromise=require('bluebird');var rs=require(_0x4983('0x3'));var fs=require('fs');var Redis=require(_0x4983('0x4'));var db=require(_0x4983('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4983('0x6'));var config=require('../../config/environment');var jayson=require(_0x4983('0x7'));var client=jayson[_0x4983('0x8')][_0x4983('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4983('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4983('0xb'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x4983('0xc')](socket);function respondWithRpcPromise(_0x1f1adf,_0x215037,_0x2b379a){return new BPromise(function(_0xbcb969,_0x2ad925){return client[_0x4983('0xd')](_0x1f1adf,_0x2b379a)[_0x4983('0xe')](function(_0x507ea2){logger['info'](_0x4983('0xf'),_0x215037,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x215037,'request\x20sent',JSON[_0x4983('0x10')](_0x507ea2));if(_0x507ea2[_0x4983('0x11')]){if(_0x507ea2[_0x4983('0x11')][_0x4983('0x12')]===0x1f4){logger[_0x4983('0x11')]('ChatMessage,\x20%s,\x20%s',_0x215037,_0x507ea2['error'][_0x4983('0x13')]);return _0x2ad925(_0x507ea2[_0x4983('0x11')][_0x4983('0x13')]);}logger[_0x4983('0x11')](_0x4983('0xf'),_0x215037,_0x507ea2[_0x4983('0x11')][_0x4983('0x13')]);return _0xbcb969(_0x507ea2[_0x4983('0x11')][_0x4983('0x13')]);}else{logger[_0x4983('0x14')](_0x4983('0xf'),_0x215037,'request\x20sent');_0xbcb969(_0x507ea2[_0x4983('0x15')]['message']);}})[_0x4983('0x16')](function(_0x498d7c){logger['error']('ChatMessage,\x20%s,\x20%s',_0x215037,_0x498d7c);_0x2ad925(_0x498d7c);});});}exports[_0x4983('0x17')]=function(_0x5e6f12){var _0x55aff3=this;return new Promise(function(_0x4f3195,_0x129edc){return db['ChatMessage'][_0x4983('0x18')](_0x5e6f12[_0x4983('0x19')],{'raw':_0x5e6f12[_0x4983('0x1a')]?_0x5e6f12[_0x4983('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x4983('0xe')](function(_0xd27719){logger[_0x4983('0x14')](_0x4983('0x17'),_0x5e6f12);logger[_0x4983('0x1b')](_0x4983('0x17'),_0x5e6f12,JSON[_0x4983('0x10')](_0xd27719));_0x4f3195(_0xd27719);})['catch'](function(_0x3e8ba7){logger[_0x4983('0x11')]('CreateChatMessage',_0x3e8ba7[_0x4983('0x13')],_0x5e6f12);_0x129edc(_0x55aff3['error'](0x1f4,_0x3e8ba7[_0x4983('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index c706f62..4b2aa78 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 _0x47c7=['./chatMessage.events','remove','update','removeListener','register','length','chatMessage:'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0x47c7,0x1ab));var _0x747c=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x47c7[_0x12a554];return _0x244ba0;};'use strict';var ChatMessageEvents=require(_0x747c('0x0'));var events=['save',_0x747c('0x1'),_0x747c('0x2')];function createListener(_0x4a6fc3,_0xbe1d88){return function(_0x2af847){_0xbe1d88['emit'](_0x4a6fc3,_0x2af847);};}function removeListener(_0x3313cd,_0x3c0c0){return function(){ChatMessageEvents[_0x747c('0x3')](_0x3313cd,_0x3c0c0);};}exports[_0x747c('0x4')]=function(_0x5e991e){for(var _0xa1148a=0x0,_0x4eb6bc=events[_0x747c('0x5')];_0xa1148a<_0x4eb6bc;_0xa1148a++){var _0x24206f=events[_0xa1148a];var _0x10b9f0=createListener(_0x747c('0x6')+_0x24206f,_0x5e991e);ChatMessageEvents['on'](_0x24206f,_0x10b9f0);}}; \ No newline at end of file +var _0x6c32=['remove','update','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var ChatMessageEvents=require(_0x26c3('0x0'));var events=[_0x26c3('0x1'),_0x26c3('0x2'),_0x26c3('0x3')];function createListener(_0x2bbfc4,_0x44fc8c){return function(_0x40cb8e){_0x44fc8c[_0x26c3('0x4')](_0x2bbfc4,_0x40cb8e);};}function removeListener(_0x36528a,_0x49d4a1){return function(){ChatMessageEvents[_0x26c3('0x5')](_0x36528a,_0x49d4a1);};}exports[_0x26c3('0x6')]=function(_0x15ac36){for(var _0x57d915=0x0,_0x187b81=events['length'];_0x57d915<_0x187b81;_0x57d915++){var _0x3dde22=events[_0x57d915];var _0x3ff8e7=createListener(_0x26c3('0x7')+_0x3dde22,_0x15ac36);ChatMessageEvents['on'](_0x3dde22,_0x3ff8e7);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b00560b..29f35ab 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 _0x10d5=['chat','chatmessage:create','create','put','/:id','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','connect-timeout','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked'];(function(_0x52f975,_0x4e4e7d){var _0x1103e7=function(_0x5d82fc){while(--_0x5d82fc){_0x52f975['push'](_0x52f975['shift']());}};_0x1103e7(++_0x4e4e7d);}(_0x10d5,0xab));var _0x510d=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x10d5[_0x4409e7];return _0x24c751;};'use strict';var multer=require(_0x510d('0x0'));var util=require(_0x510d('0x1'));var path=require('path');var timeout=require(_0x510d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x510d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x510d('0x4'));router[_0x510d('0x5')]('/',auth[_0x510d('0x6')](),controller[_0x510d('0x7')]);router[_0x510d('0x5')](_0x510d('0x8'),auth[_0x510d('0x6')](),controller[_0x510d('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x510d('0xa')]);router[_0x510d('0xb')]('/',auth[_0x510d('0x6')](),interaction[_0x510d('0xc')](_0x510d('0xd'),_0x510d('0xe')),controller[_0x510d('0xf')]);router[_0x510d('0x10')](_0x510d('0x11'),controller['update']);router[_0x510d('0x10')](_0x510d('0x12'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x510d('0x13'),auth['isAuthenticated'](),controller[_0x510d('0x14')]);router['delete']('/:id',auth[_0x510d('0x6')](),controller[_0x510d('0x15')]);module[_0x510d('0x16')]=router; \ No newline at end of file +var _0x835e=['../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','reject','destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2adb42,_0xed8b12){var _0x101363=function(_0x1a9d3d){while(--_0x1a9d3d){_0x2adb42['push'](_0x2adb42['shift']());}};_0x101363(++_0xed8b12);}(_0x835e,0xb3));var _0xe835=function(_0x143a9e,_0x561a1a){_0x143a9e=_0x143a9e-0x0;var _0x46b750=_0x835e[_0x143a9e];return _0x46b750;};'use strict';var multer=require(_0xe835('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe835('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe835('0x2'));var auth=require(_0xe835('0x3'));var interaction=require(_0xe835('0x4'));var config=require(_0xe835('0x5'));var controller=require(_0xe835('0x6'));router[_0xe835('0x7')]('/',auth[_0xe835('0x8')](),controller[_0xe835('0x9')]);router[_0xe835('0x7')](_0xe835('0xa'),auth[_0xe835('0x8')](),controller[_0xe835('0xb')]);router['get'](_0xe835('0xc'),auth['isAuthenticated'](),controller[_0xe835('0xd')]);router[_0xe835('0xe')]('/',auth[_0xe835('0x8')](),interaction[_0xe835('0xf')](_0xe835('0x10'),_0xe835('0x11')),controller[_0xe835('0x12')]);router[_0xe835('0x13')](_0xe835('0xc'),controller['update']);router['put'](_0xe835('0x14'),auth[_0xe835('0x8')](),controller['accept']);router[_0xe835('0x13')]('/:id/reject',auth[_0xe835('0x8')](),controller[_0xe835('0x15')]);router['delete']('/:id',auth[_0xe835('0x8')](),controller[_0xe835('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 192ce44..a43820e 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x0b0e[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x5a90cd,_0x140d12){var _0x50d5ad=function(_0x10d94f){while(--_0x10d94f){_0x5a90cd['push'](_0x5a90cd['shift']());}};_0x50d5ad(++_0x140d12);}(_0xadb5,0xad));var _0x5adb=function(_0x31ff15,_0x59c221){_0x31ff15=_0x31ff15-0x0;var _0x49927a=_0xadb5[_0x31ff15];return _0x49927a;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b07432d..329a36d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x7a54,0x106));var _0x47a5=function(_0x562c00,_0x185000){_0x562c00=_0x562c00-0x0;var _0x1a0c79=_0x7a54[_0x562c00];return _0x1a0c79;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x6dc537,_0x4fb967){var _0x5ede93=function(_0x24ecf9){while(--_0x24ecf9){_0x6dc537['push'](_0x6dc537['shift']());}};_0x5ede93(++_0x4fb967);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 193c9c8..ff2ad44 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 _0x7449=['emit','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7449,0x14b));var _0x9744=function(_0x27e1fe,_0x194c88){_0x27e1fe=_0x27e1fe-0x0;var _0x37d1b7=_0x7449[_0x27e1fe];return _0x37d1b7;};'use strict';var EventEmitter=require(_0x9744('0x0'));var ChatOfflineMessage=require(_0x9744('0x1'))['db'][_0x9744('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9744('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9744('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1243a4){return function(_0x5df42f,_0x31aad8,_0x149ff6){ChatOfflineMessageEvents[_0x9744('0x5')](_0x1243a4+':'+_0x5df42f['id'],_0x5df42f);ChatOfflineMessageEvents[_0x9744('0x5')](_0x1243a4,_0x5df42f);_0x149ff6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x9744('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xa0f4=['hasOwnProperty','../../mysqldb','update','remove','emit'];(function(_0x349a3d,_0x12c2a3){var _0x211a04=function(_0x1edaea){while(--_0x1edaea){_0x349a3d['push'](_0x349a3d['shift']());}};_0x211a04(++_0x12c2a3);}(_0xa0f4,0x1b4));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x4a0f('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4a0f('0x1'),'afterDestroy':_0x4a0f('0x2')};function emitEvent(_0x317118){return function(_0x4fe4a3,_0x50ab71,_0x552648){ChatOfflineMessageEvents[_0x4a0f('0x3')](_0x317118+':'+_0x4fe4a3['id'],_0x4fe4a3);ChatOfflineMessageEvents['emit'](_0x317118,_0x4fe4a3);_0x552648(null);};}for(var e in events){if(events[_0x4a0f('0x4')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index f3a917f..b3dfcd6 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 _0xc1fb=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x4cb9aa,_0x58b44f){var _0x2eff51=function(_0x18a09c){while(--_0x18a09c){_0x4cb9aa['push'](_0x4cb9aa['shift']());}};_0x2eff51(++_0x58b44f);}(_0xc1fb,0xd8));var _0xbc1f=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xc1fb[_0x5f5cce];return _0x705ecf;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xbc1f('0x0')]=function(_0x4f7d3a){return _0x4f7d3a['define'](_0xbc1f('0x1'),attributes,{'tableName':_0xbc1f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc1f('0x3'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6526=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x6526,0x1ca));var _0x6652=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0x6526[_0x21205e];return _0x136ebb;};'use strict';var attributes=require(_0x6652('0x0'));module[_0x6652('0x1')]=function(_0x2bd8ee){return _0x2bd8ee[_0x6652('0x2')](_0x6652('0x3'),attributes,{'tableName':_0x6652('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6652('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0706eb0..1d1a5c9 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 _0xa6e7=['stringify','error','code','message','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5270b4,_0x5ad6c0){var _0x40dff8=function(_0x4d0b5f){while(--_0x4d0b5f){_0x5270b4['push'](_0x5270b4['shift']());}};_0x40dff8(++_0x5ad6c0);}(_0xa6e7,0xb0));var _0x7a6e=function(_0xfbb8c3,_0xdc7b86){_0xfbb8c3=_0xfbb8c3-0x0;var _0x134bc2=_0xa6e7[_0xfbb8c3];return _0x134bc2;};'use strict';var _=require(_0x7a6e('0x0'));var util=require('util');var moment=require(_0x7a6e('0x1'));var BPromise=require(_0x7a6e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7a6e('0x3'));var logger=require(_0x7a6e('0x4'))(_0x7a6e('0x5'));var config=require(_0x7a6e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7a6e('0x7')][_0x7a6e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e3ec1,_0x48f81e,_0x56984a){return new BPromise(function(_0x50d511,_0x415f8d){return client[_0x7a6e('0x9')](_0x2e3ec1,_0x56984a)['then'](function(_0x4adb65){logger[_0x7a6e('0xa')](_0x7a6e('0xb'),_0x48f81e,_0x7a6e('0xc'));logger[_0x7a6e('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x48f81e,_0x7a6e('0xc'),JSON[_0x7a6e('0xe')](_0x4adb65));if(_0x4adb65['error']){if(_0x4adb65[_0x7a6e('0xf')][_0x7a6e('0x10')]===0x1f4){logger[_0x7a6e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x48f81e,_0x4adb65[_0x7a6e('0xf')]['message']);return _0x415f8d(_0x4adb65[_0x7a6e('0xf')]['message']);}logger[_0x7a6e('0xf')](_0x7a6e('0xb'),_0x48f81e,_0x4adb65[_0x7a6e('0xf')]['message']);return _0x50d511(_0x4adb65['error'][_0x7a6e('0x11')]);}else{logger[_0x7a6e('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x48f81e,_0x7a6e('0xc'));_0x50d511(_0x4adb65['result'][_0x7a6e('0x11')]);}})[_0x7a6e('0x12')](function(_0x68974d){logger['error'](_0x7a6e('0xb'),_0x48f81e,_0x68974d);_0x415f8d(_0x68974d);});});} \ No newline at end of file +var _0xaa7d=['code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x33ca83,_0x54f25c){var _0x175082=function(_0x1c44a9){while(--_0x1c44a9){_0x33ca83['push'](_0x33ca83['shift']());}};_0x175082(++_0x54f25c);}(_0xaa7d,0x1ea));var _0xdaa7=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xaa7d[_0x5e9a69];return _0x5979c8;};'use strict';var _=require(_0xdaa7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdaa7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaa7('0x2'))['db'];var utils=require(_0xdaa7('0x3'));var logger=require(_0xdaa7('0x4'))(_0xdaa7('0x5'));var config=require(_0xdaa7('0x6'));var jayson=require(_0xdaa7('0x7'));var client=jayson['client'][_0xdaa7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x995170,_0x478a70,_0x45f435){return new BPromise(function(_0x324e0b,_0x2eb2e2){return client['request'](_0x995170,_0x45f435)['then'](function(_0x5f3364){logger['info'](_0xdaa7('0x9'),_0x478a70,_0xdaa7('0xa'));logger['debug'](_0xdaa7('0xb'),_0x478a70,'request\x20sent',JSON[_0xdaa7('0xc')](_0x5f3364));if(_0x5f3364[_0xdaa7('0xd')]){if(_0x5f3364[_0xdaa7('0xd')][_0xdaa7('0xe')]===0x1f4){logger[_0xdaa7('0xd')](_0xdaa7('0x9'),_0x478a70,_0x5f3364[_0xdaa7('0xd')]['message']);return _0x2eb2e2(_0x5f3364[_0xdaa7('0xd')][_0xdaa7('0xf')]);}logger[_0xdaa7('0xd')](_0xdaa7('0x9'),_0x478a70,_0x5f3364[_0xdaa7('0xd')]['message']);return _0x324e0b(_0x5f3364[_0xdaa7('0xd')][_0xdaa7('0xf')]);}else{logger['info'](_0xdaa7('0x9'),_0x478a70,_0xdaa7('0xa'));_0x324e0b(_0x5f3364[_0xdaa7('0x10')][_0xdaa7('0xf')]);}})[_0xdaa7('0x11')](function(_0x5ddfb6){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x478a70,_0x5ddfb6);_0x2eb2e2(_0x5ddfb6);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 676cdd7..cb3fe91 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 _0x5068=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x3a430b,_0x3b491a){var _0x470839=function(_0x120be2){while(--_0x120be2){_0x3a430b['push'](_0x3a430b['shift']());}};_0x470839(++_0x3b491a);}(_0x5068,0xe3));var _0x8506=function(_0x5c4c20,_0x59b68b){_0x5c4c20=_0x5c4c20-0x0;var _0x1defb5=_0x5068[_0x5c4c20];return _0x1defb5;};'use strict';var multer=require(_0x8506('0x0'));var util=require(_0x8506('0x1'));var path=require(_0x8506('0x2'));var timeout=require(_0x8506('0x3'));var express=require(_0x8506('0x4'));var router=express[_0x8506('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8506('0x6'));var interaction=require(_0x8506('0x7'));var config=require(_0x8506('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0x8506('0x9')]('/',auth[_0x8506('0xa')](),controller[_0x8506('0xb')]);router[_0x8506('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8506('0xc')]);router[_0x8506('0x9')](_0x8506('0xd'),auth[_0x8506('0xa')](),controller[_0x8506('0xe')]);router[_0x8506('0xf')]('/',auth[_0x8506('0xa')](),controller[_0x8506('0x10')]);router[_0x8506('0x11')](_0x8506('0xd'),auth[_0x8506('0xa')](),controller[_0x8506('0x12')]);router[_0x8506('0x13')]('/:id',auth[_0x8506('0xa')](),controller[_0x8506('0x14')]);module[_0x8506('0x15')]=router; \ No newline at end of file +var _0x5510=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x2e1051,_0x58b01d){var _0x5aa734=function(_0x15a99d){while(--_0x15a99d){_0x2e1051['push'](_0x2e1051['shift']());}};_0x5aa734(++_0x58b01d);}(_0x5510,0x149));var _0x0551=function(_0x3ad9b3,_0x5c76e9){_0x3ad9b3=_0x3ad9b3-0x0;var _0x4ef8d1=_0x5510[_0x3ad9b3];return _0x4ef8d1;};'use strict';var multer=require(_0x0551('0x0'));var util=require('util');var path=require(_0x0551('0x1'));var timeout=require(_0x0551('0x2'));var express=require(_0x0551('0x3'));var router=express[_0x0551('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0551('0x5'));var interaction=require(_0x0551('0x6'));var config=require(_0x0551('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x0551('0x8')]('/',auth[_0x0551('0x9')](),controller['index']);router[_0x0551('0x8')](_0x0551('0xa'),auth[_0x0551('0x9')](),controller[_0x0551('0xb')]);router['get'](_0x0551('0xc'),auth[_0x0551('0x9')](),controller[_0x0551('0xd')]);router[_0x0551('0xe')]('/',auth[_0x0551('0x9')](),controller[_0x0551('0xf')]);router[_0x0551('0x10')]('/:id',auth[_0x0551('0x9')](),controller['update']);router[_0x0551('0x11')](_0x0551('0xc'),auth[_0x0551('0x9')](),controller[_0x0551('0x12')]);module[_0x0551('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7e25f26..57bb7e7 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 _0x3b93=['sequelize','exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x5b5199,_0x58a8e5){var _0x2f5736=function(_0x1f35ce){while(--_0x1f35ce){_0x5b5199['push'](_0x5b5199['shift']());}};_0x2f5736(++_0x58a8e5);}(_0x3b93,0xe0));var _0x33b9=function(_0x2a8e31,_0x5c4853){_0x2a8e31=_0x2a8e31-0x0;var _0x11cc23=_0x3b93[_0x2a8e31];return _0x11cc23;};'use strict';var Sequelize=require(_0x33b9('0x0'));module[_0x33b9('0x1')]={'name':{'type':Sequelize[_0x33b9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x33b9('0x3')](_0x33b9('0x4'),_0x33b9('0x5')),'defaultValue':_0x33b9('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x33b9('0x6')]}}; \ No newline at end of file +var _0x67b5=['sequelize','exports','STRING','mouseOver','timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x67b5,0x11d));var _0x567b=function(_0x2a2091,_0x5d6a29){_0x2a2091=_0x2a2091-0x0;var _0x284077=_0x67b5[_0x2a2091];return _0x284077;};'use strict';var Sequelize=require(_0x567b('0x0'));module[_0x567b('0x1')]={'name':{'type':Sequelize[_0x567b('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x567b('0x3'),_0x567b('0x4')),'defaultValue':_0x567b('0x3')},'selector':{'type':Sequelize[_0x567b('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9a36499..be7e5c7 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 _0xabe8=['send','model','keys','filters','intersection','query','attributes','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','create','update','body','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name'];(function(_0xf28958,_0x53f0ed){var _0x4a4ce4=function(_0x5275fb){while(--_0x5275fb){_0xf28958['push'](_0xf28958['shift']());}};_0x4a4ce4(++_0x53f0ed);}(_0xabe8,0x8c));var _0x8abe=function(_0x56338a,_0x1d112e){_0x56338a=_0x56338a-0x0;var _0x404efd=_0xabe8[_0x56338a];return _0x404efd;};'use strict';var emlformat=require(_0x8abe('0x0'));var rimraf=require(_0x8abe('0x1'));var zipdir=require(_0x8abe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8abe('0x3'));var moment=require(_0x8abe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8abe('0x5'));var util=require('util');var path=require(_0x8abe('0x6'));var sox=require(_0x8abe('0x7'));var csv=require(_0x8abe('0x8'));var ejs=require(_0x8abe('0x9'));var fs=require('fs');var fs_extra=require(_0x8abe('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8abe('0xb'));var jsforce=require(_0x8abe('0xc'));var deskjs=require(_0x8abe('0xd'));var toCsv=require(_0x8abe('0x8'));var querystring=require(_0x8abe('0xe'));var Papa=require(_0x8abe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8abe('0x10'));var hardwareService=require(_0x8abe('0x11'));var logger=require(_0x8abe('0x12'))(_0x8abe('0x13'));var utils=require(_0x8abe('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8abe('0x15'))['db'];function respondWithStatusCode(_0x8d4179,_0x1970b2){_0x1970b2=_0x1970b2||0xcc;return function(_0x3890f8){if(_0x3890f8){return _0x8d4179['sendStatus'](_0x1970b2);}return _0x8d4179['status'](_0x1970b2)['end']();};}function respondWithResult(_0xb75397,_0x5e7c8b){_0x5e7c8b=_0x5e7c8b||0xc8;return function(_0x1c407d){if(_0x1c407d){return _0xb75397['status'](_0x5e7c8b)[_0x8abe('0x16')](_0x1c407d);}};}function respondWithFilteredResult(_0x168f96,_0x5d24ad){return function(_0x1bcd6d){if(_0x1bcd6d){var _0x5bc34a=typeof _0x5d24ad[_0x8abe('0x17')]===_0x8abe('0x18')&&typeof _0x5d24ad[_0x8abe('0x19')]===_0x8abe('0x18');var _0x3f5d9b=_0x1bcd6d[_0x8abe('0x1a')];var _0x1cd7c9=_0x5bc34a?0x0:_0x5d24ad[_0x8abe('0x17')];var _0x45905e=_0x5bc34a?_0x1bcd6d[_0x8abe('0x1a')]:_0x5d24ad[_0x8abe('0x17')]+_0x5d24ad['limit'];var _0x190e2e;if(_0x45905e>=_0x3f5d9b){_0x45905e=_0x3f5d9b;_0x190e2e=0xc8;}else{_0x190e2e=0xce;}_0x168f96[_0x8abe('0x1b')](_0x190e2e);return _0x168f96[_0x8abe('0x1c')](_0x8abe('0x1d'),_0x1cd7c9+'-'+_0x45905e+'/'+_0x3f5d9b)[_0x8abe('0x16')](_0x1bcd6d);}return null;};}function patchUpdates(_0x49f03d){return function(_0x4f6c1c){try{jsonpatch[_0x8abe('0x1e')](_0x4f6c1c,_0x49f03d,!![]);}catch(_0xfa8e74){return BPromise[_0x8abe('0x1f')](_0xfa8e74);}return _0x4f6c1c[_0x8abe('0x20')]();};}function saveUpdates(_0x346153,_0x2f7e3c){return function(_0x113ab2){if(_0x113ab2){return _0x113ab2['update'](_0x346153)[_0x8abe('0x21')](function(_0x1eaf31){return _0x1eaf31;});}return null;};}function removeEntity(_0x383ca7,_0x1873d5){return function(_0x1f9bde){if(_0x1f9bde){return _0x1f9bde[_0x8abe('0x22')]()[_0x8abe('0x21')](function(){_0x383ca7[_0x8abe('0x1b')](0xcc)[_0x8abe('0x23')]();});}};}function handleEntityNotFound(_0x3d1785,_0x40f33a){return function(_0x301d4a){if(!_0x301d4a){_0x3d1785[_0x8abe('0x24')](0x194);}return _0x301d4a;};}function handleError(_0x189440,_0x14c9db){_0x14c9db=_0x14c9db||0x1f4;return function(_0x261c62){logger[_0x8abe('0x25')](_0x261c62[_0x8abe('0x26')]);if(_0x261c62['name']){delete _0x261c62[_0x8abe('0x27')];}_0x189440[_0x8abe('0x1b')](_0x14c9db)[_0x8abe('0x28')](_0x261c62);};}exports['show']=function(_0xca4d,_0x4a899c){var _0x1e9316={'raw':!![],'where':{'id':_0xca4d['params']['id']}},_0x3f30bf={};_0x3f30bf[_0x8abe('0x29')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x3f30bf['query']=_[_0x8abe('0x2a')](_0xca4d['query']);_0x3f30bf[_0x8abe('0x2b')]=_[_0x8abe('0x2c')](_0x3f30bf[_0x8abe('0x29')],_0x3f30bf[_0x8abe('0x2d')]);_0x1e9316[_0x8abe('0x2e')]=_[_0x8abe('0x2c')](_0x3f30bf[_0x8abe('0x29')],qs['fields'](_0xca4d[_0x8abe('0x2d')][_0x8abe('0x2f')]));_0x1e9316[_0x8abe('0x2e')]=_0x1e9316[_0x8abe('0x2e')][_0x8abe('0x30')]?_0x1e9316[_0x8abe('0x2e')]:_0x3f30bf['model'];if(_0xca4d[_0x8abe('0x2d')][_0x8abe('0x31')]){_0x1e9316[_0x8abe('0x32')]=[{'all':!![]}];}_0x1e9316=_[_0x8abe('0x33')]({},_0x1e9316,_0xca4d[_0x8abe('0x34')]);return db[_0x8abe('0x35')][_0x8abe('0x36')](_0x1e9316)[_0x8abe('0x21')](handleEntityNotFound(_0x4a899c,null))[_0x8abe('0x21')](respondWithResult(_0x4a899c,null))['catch'](handleError(_0x4a899c,null));};exports[_0x8abe('0x37')]=function(_0x47d627,_0x1a0364){return db[_0x8abe('0x35')]['create'](_0x47d627['body'],{})[_0x8abe('0x21')](respondWithResult(_0x1a0364,0xc9))['catch'](handleError(_0x1a0364,null));};exports[_0x8abe('0x38')]=function(_0xbf1d9,_0x3599de){if(_0xbf1d9[_0x8abe('0x39')]['id']){delete _0xbf1d9[_0x8abe('0x39')]['id'];}return db['ChatProactiveAction'][_0x8abe('0x36')]({'where':{'id':_0xbf1d9['params']['id']}})['then'](handleEntityNotFound(_0x3599de,null))[_0x8abe('0x21')](saveUpdates(_0xbf1d9[_0x8abe('0x39')],null))[_0x8abe('0x21')](respondWithResult(_0x3599de,null))[_0x8abe('0x3a')](handleError(_0x3599de,null));};exports['destroy']=function(_0xf736e6,_0x30af7c){return db['ChatProactiveAction'][_0x8abe('0x36')]({'where':{'id':_0xf736e6[_0x8abe('0x3b')]['id']}})['then'](handleEntityNotFound(_0x30af7c,null))[_0x8abe('0x21')](removeEntity(_0x30af7c,null))['catch'](handleError(_0x30af7c,null));}; \ No newline at end of file +var _0x5a52=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','save','then','destroy','error','stack','name','send','show','params','model','ChatProactiveAction','query','keys','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','update','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x2e561f,_0x1b1660){var _0x4160ea=function(_0x1fa2ca){while(--_0x1fa2ca){_0x2e561f['push'](_0x2e561f['shift']());}};_0x4160ea(++_0x1b1660);}(_0x5a52,0x18d));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x25a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x25a5('0x1'));var moment=require(_0x25a5('0x2'));var BPromise=require(_0x25a5('0x3'));var Mustache=require(_0x25a5('0x4'));var util=require(_0x25a5('0x5'));var path=require(_0x25a5('0x6'));var sox=require(_0x25a5('0x7'));var csv=require(_0x25a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25a5('0x9'));var _=require('lodash');var squel=require(_0x25a5('0xa'));var crypto=require(_0x25a5('0xb'));var jsforce=require(_0x25a5('0xc'));var deskjs=require(_0x25a5('0xd'));var toCsv=require(_0x25a5('0x8'));var querystring=require(_0x25a5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x25a5('0xf'));var qs=require(_0x25a5('0x10'));var as=require(_0x25a5('0x11'));var hardwareService=require(_0x25a5('0x12'));var logger=require(_0x25a5('0x13'))(_0x25a5('0x14'));var utils=require(_0x25a5('0x15'));var config=require(_0x25a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x25a5('0x17'))['db'];function respondWithStatusCode(_0x20df69,_0x425f2e){_0x425f2e=_0x425f2e||0xcc;return function(_0x5deb28){if(_0x5deb28){return _0x20df69[_0x25a5('0x18')](_0x425f2e);}return _0x20df69['status'](_0x425f2e)[_0x25a5('0x19')]();};}function respondWithResult(_0x25b7bb,_0x1edef3){_0x1edef3=_0x1edef3||0xc8;return function(_0x47d1d1){if(_0x47d1d1){return _0x25b7bb['status'](_0x1edef3)[_0x25a5('0x1a')](_0x47d1d1);}};}function respondWithFilteredResult(_0x5e1590,_0x7e183e){return function(_0x1c0ad6){if(_0x1c0ad6){var _0x39313e=typeof _0x7e183e[_0x25a5('0x1b')]==='undefined'&&typeof _0x7e183e[_0x25a5('0x1c')]==='undefined';var _0x5f257b=_0x1c0ad6[_0x25a5('0x1d')];var _0x17901b=_0x39313e?0x0:_0x7e183e[_0x25a5('0x1b')];var _0x95dfbc=_0x39313e?_0x1c0ad6[_0x25a5('0x1d')]:_0x7e183e['offset']+_0x7e183e['limit'];var _0x1390fb;if(_0x95dfbc>=_0x5f257b){_0x95dfbc=_0x5f257b;_0x1390fb=0xc8;}else{_0x1390fb=0xce;}_0x5e1590[_0x25a5('0x1e')](_0x1390fb);return _0x5e1590[_0x25a5('0x1f')](_0x25a5('0x20'),_0x17901b+'-'+_0x95dfbc+'/'+_0x5f257b)[_0x25a5('0x1a')](_0x1c0ad6);}return null;};}function patchUpdates(_0x44f1ed){return function(_0x514c59){try{jsonpatch[_0x25a5('0x21')](_0x514c59,_0x44f1ed,!![]);}catch(_0x4dba9d){return BPromise['reject'](_0x4dba9d);}return _0x514c59[_0x25a5('0x22')]();};}function saveUpdates(_0x54cc71,_0x34a92f){return function(_0x3177ea){if(_0x3177ea){return _0x3177ea['update'](_0x54cc71)[_0x25a5('0x23')](function(_0x174c3f){return _0x174c3f;});}return null;};}function removeEntity(_0x4be312,_0x37f7fe){return function(_0xaea9aa){if(_0xaea9aa){return _0xaea9aa[_0x25a5('0x24')]()['then'](function(){_0x4be312[_0x25a5('0x1e')](0xcc)[_0x25a5('0x19')]();});}};}function handleEntityNotFound(_0x5e8db0,_0x23b304){return function(_0x48db7e){if(!_0x48db7e){_0x5e8db0[_0x25a5('0x18')](0x194);}return _0x48db7e;};}function handleError(_0x42f14a,_0x400800){_0x400800=_0x400800||0x1f4;return function(_0x5caf87){logger[_0x25a5('0x25')](_0x5caf87[_0x25a5('0x26')]);if(_0x5caf87[_0x25a5('0x27')]){delete _0x5caf87[_0x25a5('0x27')];}_0x42f14a[_0x25a5('0x1e')](_0x400800)[_0x25a5('0x28')](_0x5caf87);};}exports[_0x25a5('0x29')]=function(_0x387774,_0x12e1be){var _0x112a08={'raw':!![],'where':{'id':_0x387774[_0x25a5('0x2a')]['id']}},_0x412f42={};_0x412f42[_0x25a5('0x2b')]=_['keys'](db[_0x25a5('0x2c')]['rawAttributes']);_0x412f42[_0x25a5('0x2d')]=_[_0x25a5('0x2e')](_0x387774['query']);_0x412f42['filters']=_[_0x25a5('0x2f')](_0x412f42[_0x25a5('0x2b')],_0x412f42[_0x25a5('0x2d')]);_0x112a08[_0x25a5('0x30')]=_['intersection'](_0x412f42[_0x25a5('0x2b')],qs[_0x25a5('0x31')](_0x387774[_0x25a5('0x2d')][_0x25a5('0x31')]));_0x112a08[_0x25a5('0x30')]=_0x112a08[_0x25a5('0x30')][_0x25a5('0x32')]?_0x112a08['attributes']:_0x412f42['model'];if(_0x387774[_0x25a5('0x2d')][_0x25a5('0x33')]){_0x112a08[_0x25a5('0x34')]=[{'all':!![]}];}_0x112a08=_['merge']({},_0x112a08,_0x387774[_0x25a5('0x35')]);return db[_0x25a5('0x2c')][_0x25a5('0x36')](_0x112a08)[_0x25a5('0x23')](handleEntityNotFound(_0x12e1be,null))[_0x25a5('0x23')](respondWithResult(_0x12e1be,null))[_0x25a5('0x37')](handleError(_0x12e1be,null));};exports[_0x25a5('0x38')]=function(_0x19ab5f,_0xaedce7){return db[_0x25a5('0x2c')][_0x25a5('0x38')](_0x19ab5f[_0x25a5('0x39')],{})['then'](respondWithResult(_0xaedce7,0xc9))['catch'](handleError(_0xaedce7,null));};exports[_0x25a5('0x3a')]=function(_0x5b872c,_0x27eefb){if(_0x5b872c['body']['id']){delete _0x5b872c[_0x25a5('0x39')]['id'];}return db[_0x25a5('0x2c')][_0x25a5('0x36')]({'where':{'id':_0x5b872c[_0x25a5('0x2a')]['id']}})[_0x25a5('0x23')](handleEntityNotFound(_0x27eefb,null))['then'](saveUpdates(_0x5b872c[_0x25a5('0x39')],null))['then'](respondWithResult(_0x27eefb,null))[_0x25a5('0x37')](handleError(_0x27eefb,null));};exports['destroy']=function(_0x5ad0b6,_0x3c3c64){return db[_0x25a5('0x2c')][_0x25a5('0x36')]({'where':{'id':_0x5ad0b6[_0x25a5('0x2a')]['id']}})[_0x25a5('0x23')](handleEntityNotFound(_0x3c3c64,null))[_0x25a5('0x23')](removeEntity(_0x3c3c64,null))[_0x25a5('0x37')](handleError(_0x3c3c64,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 27e82ce..932a05f 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 _0x496b=['path','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4392af,_0xec5afe){var _0x9fa8eb=function(_0x41d7a4){while(--_0x41d7a4){_0x4392af['push'](_0x4392af['shift']());}};_0x9fa8eb(++_0xec5afe);}(_0x496b,0x12d));var _0xb496=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0x496b[_0x277af0];return _0x43bd7c;};'use strict';var _=require(_0xb496('0x0'));var util=require(_0xb496('0x1'));var logger=require(_0xb496('0x2'))(_0xb496('0x3'));var moment=require(_0xb496('0x4'));var BPromise=require(_0xb496('0x5'));var rp=require(_0xb496('0x6'));var fs=require('fs');var path=require(_0xb496('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb496('0x8'));module[_0xb496('0x9')]=function(_0x28843c,_0x387eee){return _0x28843c['define'](_0xb496('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77d7=['ChatProactiveAction','lodash','../../config/logger','bluebird','path','./chatProactiveAction.attributes'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x77d7,0x12d));var _0x777d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x77d7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x777d('0x0'));var util=require('util');var logger=require(_0x777d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x777d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x777d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x777d('0x4'));module['exports']=function(_0xa4ac17,_0x4791fc){return _0xa4ac17['define'](_0x777d('0x5'),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 e533246..435e2d7 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 _0x8792=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8792,0xc1));var _0x2879=function(_0x584354,_0x3b4a6f){_0x584354=_0x584354-0x0;var _0x285f14=_0x8792[_0x584354];return _0x285f14;};'use strict';var _=require(_0x2879('0x0'));var util=require(_0x2879('0x1'));var moment=require(_0x2879('0x2'));var BPromise=require(_0x2879('0x3'));var rs=require(_0x2879('0x4'));var fs=require('fs');var Redis=require(_0x2879('0x5'));var db=require(_0x2879('0x6'))['db'];var utils=require(_0x2879('0x7'));var logger=require(_0x2879('0x8'))(_0x2879('0x9'));var config=require(_0x2879('0xa'));var jayson=require(_0x2879('0xb'));var client=jayson[_0x2879('0xc')][_0x2879('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x487821,_0x55a6c6,_0x5dbc71){return new BPromise(function(_0x2c8690,_0x585d05){return client[_0x2879('0xe')](_0x487821,_0x5dbc71)[_0x2879('0xf')](function(_0x26ec16){logger[_0x2879('0x10')](_0x2879('0x11'),_0x55a6c6,_0x2879('0x12'));logger[_0x2879('0x13')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x55a6c6,_0x2879('0x12'),JSON['stringify'](_0x26ec16));if(_0x26ec16[_0x2879('0x14')]){if(_0x26ec16[_0x2879('0x14')][_0x2879('0x15')]===0x1f4){logger[_0x2879('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x55a6c6,_0x26ec16[_0x2879('0x14')]['message']);return _0x585d05(_0x26ec16[_0x2879('0x14')][_0x2879('0x16')]);}logger[_0x2879('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x55a6c6,_0x26ec16['error'][_0x2879('0x16')]);return _0x2c8690(_0x26ec16['error'][_0x2879('0x16')]);}else{logger[_0x2879('0x10')](_0x2879('0x11'),_0x55a6c6,_0x2879('0x12'));_0x2c8690(_0x26ec16[_0x2879('0x17')][_0x2879('0x16')]);}})[_0x2879('0x18')](function(_0x5d9575){logger[_0x2879('0x14')](_0x2879('0x11'),_0x55a6c6,_0x5d9575);_0x585d05(_0x5d9575);});});} \ No newline at end of file +var _0x5707=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','message','ChatProactiveAction,\x20%s,\x20%s','lodash','util','moment','bluebird'];(function(_0x38157b,_0x28834d){var _0x3e8df2=function(_0x21ff1){while(--_0x21ff1){_0x38157b['push'](_0x38157b['shift']());}};_0x3e8df2(++_0x28834d);}(_0x5707,0x122));var _0x7570=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0x5707[_0x180c9b];return _0x3ff116;};'use strict';var _=require(_0x7570('0x0'));var util=require(_0x7570('0x1'));var moment=require(_0x7570('0x2'));var BPromise=require(_0x7570('0x3'));var rs=require(_0x7570('0x4'));var fs=require('fs');var Redis=require(_0x7570('0x5'));var db=require(_0x7570('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7570('0x7'))(_0x7570('0x8'));var config=require(_0x7570('0x9'));var jayson=require(_0x7570('0xa'));var client=jayson[_0x7570('0xb')][_0x7570('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56626b,_0xb8da42,_0x94d5cf){return new BPromise(function(_0x8ffb97,_0x429d0c){return client[_0x7570('0xd')](_0x56626b,_0x94d5cf)[_0x7570('0xe')](function(_0x37121f){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0xb8da42,_0x7570('0xf'));logger[_0x7570('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0xb8da42,'request\x20sent',JSON[_0x7570('0x11')](_0x37121f));if(_0x37121f[_0x7570('0x12')]){if(_0x37121f[_0x7570('0x12')]['code']===0x1f4){logger[_0x7570('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0xb8da42,_0x37121f[_0x7570('0x12')]['message']);return _0x429d0c(_0x37121f[_0x7570('0x12')][_0x7570('0x13')]);}logger[_0x7570('0x12')](_0x7570('0x14'),_0xb8da42,_0x37121f[_0x7570('0x12')][_0x7570('0x13')]);return _0x8ffb97(_0x37121f[_0x7570('0x12')][_0x7570('0x13')]);}else{logger['info'](_0x7570('0x14'),_0xb8da42,_0x7570('0xf'));_0x8ffb97(_0x37121f['result'][_0x7570('0x13')]);}})['catch'](function(_0xf6c705){logger[_0x7570('0x12')](_0x7570('0x14'),_0xb8da42,_0xf6c705);_0x429d0c(_0xf6c705);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 661e53e..3cf2d9a 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 _0x33c5=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x2d5346,_0xb13ba4){var _0x5348eb=function(_0x694baa){while(--_0x694baa){_0x2d5346['push'](_0x2d5346['shift']());}};_0x5348eb(++_0xb13ba4);}(_0x33c5,0xe6));var _0x533c=function(_0x2d1cf4,_0x2ea9ee){_0x2d1cf4=_0x2d1cf4-0x0;var _0x554a7c=_0x33c5[_0x2d1cf4];return _0x554a7c;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')]('/',auth[_0x533c('0xa')](),controller[_0x533c('0xd')]);router[_0x533c('0xe')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xeff8,0x186));var _0x8eff=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xeff8[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);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 9ebad90..0652ac9 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 _0xc34c=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x28958c,_0x4cf771){var _0x31c1a7=function(_0x2a542c){while(--_0x2a542c){_0x28958c['push'](_0x28958c['shift']());}};_0x31c1a7(++_0x4cf771);}(_0xc34c,0x169));var _0xcc34=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc34c[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xcc34('0x0'));module[_0xcc34('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcc34('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcc34('0x3')]},'timeout':{'type':Sequelize[_0xcc34('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcc34('0x5')](_0xcc34('0x6'),_0xcc34('0x7'),_0xcc34('0x8'))}}; \ No newline at end of file +var _0x5529=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5529,0x180));var _0x9552=function(_0x1c09f4,_0x46a2e5){_0x1c09f4=_0x1c09f4-0x0;var _0x122707=_0x5529[_0x1c09f4];return _0x122707;};'use strict';var Sequelize=require(_0x9552('0x0'));module[_0x9552('0x1')]={'name':{'type':Sequelize[_0x9552('0x2')],'unique':_0x9552('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9552('0x4')](_0x9552('0x5'),_0x9552('0x6'),_0x9552('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f06c039..4f268a4 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 _0x98ec=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','User','findAndCountAll','UserId','chatPause','updatedAt','%s/%s','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','create'];(function(_0x6b6190,_0x3131ac){var _0x1c1982=function(_0x3535b3){while(--_0x3535b3){_0x6b6190['push'](_0x6b6190['shift']());}};_0x1c1982(++_0x3131ac);}(_0x98ec,0x145));var _0xc98e=function(_0x57e14f,_0x17f93c){_0x57e14f=_0x57e14f-0x0;var _0x39fce2=_0x98ec[_0x57e14f];return _0x39fce2;};'use strict';var BPromise=require(_0xc98e('0x0'));var util=require(_0xc98e('0x1'));var _=require(_0xc98e('0x2'));var squel=require(_0xc98e('0x3'));var Redis=require(_0xc98e('0x4'));var qs=require(_0xc98e('0x5'));var logger=require(_0xc98e('0x6'))(_0xc98e('0x7'));var config=require('../../config/environment');var db=require(_0xc98e('0x8'))['db'];config[_0xc98e('0x9')]=_[_0xc98e('0xa')](config['redis'],{'host':_0xc98e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc98e('0x9')]));require(_0xc98e('0xc'))['register'](socket);function respondWithStatusCode(_0x294242,_0x250d84){_0x250d84=_0x250d84||0xcc;return function(_0x156c85){if(_0x156c85){return _0x294242[_0xc98e('0xd')](_0x250d84);}return _0x294242['status'](_0x250d84)[_0xc98e('0xe')]();};}function respondWithResult(_0x242fef,_0x3c2ac1){_0x3c2ac1=_0x3c2ac1||0xc8;return function(_0x2ac12e){if(_0x2ac12e){return _0x242fef['status'](_0x3c2ac1)[_0xc98e('0xf')](_0x2ac12e);}};}function respondWithFilteredResult(_0x3e5f96,_0x55be17){return function(_0x23bc17){if(_0x23bc17){var _0x3a9518=typeof _0x55be17[_0xc98e('0x10')]===_0xc98e('0x11')&&typeof _0x55be17[_0xc98e('0x12')]===_0xc98e('0x11');var _0x3fd228=_0x23bc17[_0xc98e('0x13')];var _0x5ecbf2=_0x3a9518?0x0:_0x55be17[_0xc98e('0x10')];var _0x1915c1=_0x3a9518?_0x23bc17[_0xc98e('0x13')]:_0x55be17[_0xc98e('0x10')]+_0x55be17[_0xc98e('0x12')];var _0x50a8f6;if(_0x1915c1>=_0x3fd228){_0x1915c1=_0x3fd228;_0x50a8f6=0xc8;}else{_0x50a8f6=0xce;}_0x3e5f96[_0xc98e('0x14')](_0x50a8f6);return _0x3e5f96['set'](_0xc98e('0x15'),_0x5ecbf2+'-'+_0x1915c1+'/'+_0x3fd228)['json'](_0x23bc17);}return null;};}function saveUpdates(_0x431ed1){return function(_0x3bd548){if(_0x3bd548){return _0x3bd548[_0xc98e('0x16')](_0x431ed1)[_0xc98e('0x17')](function(_0x5653d5){return _0x5653d5;});}return null;};}function removeEntity(_0x46a940){return function(_0x252ef9){if(_0x252ef9){return _0x252ef9[_0xc98e('0x18')]()['then'](function(){var _0x16781b=_0x252ef9[_0xc98e('0x19')]({'plain':!![]});var _0x78513d=_0xc98e('0x1a');return db[_0xc98e('0x1b')][_0xc98e('0x18')]({'where':{'type':_0x78513d,'resourceId':_0x16781b['id']}})[_0xc98e('0x17')](function(){return _0x252ef9;});})[_0xc98e('0x17')](function(){_0x46a940[_0xc98e('0x14')](0xcc)[_0xc98e('0xe')]();});}};}function handleEntityNotFound(_0xd3a04){return function(_0x2c4f1f){if(!_0x2c4f1f){_0xd3a04[_0xc98e('0xd')](0x194);}return _0x2c4f1f;};}function handleError(_0x5dd65d,_0x49b3f7){_0x49b3f7=_0x49b3f7||0x1f4;return function(_0x1ed13b){logger[_0xc98e('0x1c')](_0x1ed13b[_0xc98e('0x1d')]);if(_0x1ed13b['name']){delete _0x1ed13b[_0xc98e('0x1e')];}_0x5dd65d['status'](_0x49b3f7)[_0xc98e('0x1f')](_0x1ed13b);};}exports[_0xc98e('0x20')]=function(_0x523168,_0x508a1f){var _0x4d977e={};var _0x2cb23a={'count':0x0,'rows':[]};var _0x417636=_[_0xc98e('0x21')](db[_0xc98e('0x22')][_0xc98e('0x23')],function(_0x38e53e){return{'name':_0x38e53e[_0xc98e('0x24')],'type':_0x38e53e[_0xc98e('0x25')][_0xc98e('0x26')]};});_0x4d977e=qs[_0xc98e('0x27')](_0x417636,_0x523168);var _0xee3a0b={'where':_0x4d977e[_0xc98e('0x28')]};return db[_0xc98e('0x22')]['count'](_0xee3a0b)[_0xc98e('0x17')](function(_0x50895b){_0x2cb23a[_0xc98e('0x13')]=_0x50895b;_0x4d977e[_0xc98e('0x29')]=qs[_0xc98e('0x29')](_0x523168[_0xc98e('0x2a')]);return db[_0xc98e('0x22')][_0xc98e('0x2b')](_0x4d977e);})[_0xc98e('0x17')](function(_0x494609){_0x2cb23a[_0xc98e('0x2c')]=_0x494609;return _0x2cb23a;})[_0xc98e('0x17')](respondWithFilteredResult(_0x508a1f,_0x4d977e))['catch'](handleError(_0x508a1f,null));};exports[_0xc98e('0x2d')]=function(_0x3288ab,_0x32e585){var _0x5f5187={'raw':!![],'where':{'id':_0x3288ab[_0xc98e('0x2e')]['id']}},_0x504d1a={};_0x504d1a[_0xc98e('0x2f')]=_['keys'](db[_0xc98e('0x22')]['rawAttributes']);_0x504d1a[_0xc98e('0x2a')]=_[_0xc98e('0x30')](_0x3288ab[_0xc98e('0x2a')]);_0x504d1a[_0xc98e('0x31')]=_[_0xc98e('0x32')](_0x504d1a[_0xc98e('0x2f')],_0x504d1a[_0xc98e('0x2a')]);_0x5f5187[_0xc98e('0x33')]=_[_0xc98e('0x32')](_0x504d1a[_0xc98e('0x2f')],qs['fields'](_0x3288ab['query'][_0xc98e('0x34')]));_0x5f5187['attributes']=_0x5f5187[_0xc98e('0x33')][_0xc98e('0x35')]?_0x5f5187[_0xc98e('0x33')]:_0x504d1a[_0xc98e('0x2f')];if(_0x3288ab[_0xc98e('0x2a')][_0xc98e('0x36')]){_0x5f5187[_0xc98e('0x29')]=[{'all':!![]}];}_0x5f5187=_[_0xc98e('0x37')]({},_0x5f5187,_0x3288ab[_0xc98e('0x38')]);return db[_0xc98e('0x22')]['find'](_0x5f5187)[_0xc98e('0x17')](handleEntityNotFound(_0x32e585,null))['then'](respondWithResult(_0x32e585,null))[_0xc98e('0x39')](handleError(_0x32e585,null));};exports[_0xc98e('0x3a')]=function(_0x37f685,_0x302453){return db[_0xc98e('0x22')][_0xc98e('0x3a')](_0x37f685[_0xc98e('0x3b')],{})[_0xc98e('0x17')](function(_0x572643){var _0x2857d9=_0x37f685[_0xc98e('0x3c')]['get']({'plain':!![]});if(!_0x2857d9)throw new Error(_0xc98e('0x3d'));if(_0x2857d9[_0xc98e('0x3e')]===_0xc98e('0x3c')){var _0x2e953b=_0x572643[_0xc98e('0x19')]({'plain':!![]});var _0x3df0af='ChatQueues';return db[_0xc98e('0x3f')][_0xc98e('0x40')]({'where':{'name':_0x3df0af,'userProfileId':_0x2857d9[_0xc98e('0x41')]},'raw':!![]})['then'](function(_0x43347e){if(_0x43347e&&_0x43347e[_0xc98e('0x42')]===0x0){return db[_0xc98e('0x1b')][_0xc98e('0x3a')]({'name':_0x2e953b[_0xc98e('0x1e')],'resourceId':_0x2e953b['id'],'type':_0x43347e[_0xc98e('0x1e')],'sectionId':_0x43347e['id']},{})[_0xc98e('0x17')](function(){return _0x572643;});}else{return _0x572643;}})['catch'](function(_0x2cabfe){logger[_0xc98e('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cabfe);throw _0x2cabfe;});}return _0x572643;})[_0xc98e('0x17')](respondWithResult(_0x302453,0xc9))[_0xc98e('0x39')](handleError(_0x302453,null));};exports[_0xc98e('0x16')]=function(_0x59c78b,_0x5f59f8){if(_0x59c78b[_0xc98e('0x3b')]['id']){delete _0x59c78b[_0xc98e('0x3b')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x59c78b[_0xc98e('0x2e')]['id']}})[_0xc98e('0x17')](handleEntityNotFound(_0x5f59f8,null))['then'](saveUpdates(_0x59c78b['body'],null))['then'](respondWithResult(_0x5f59f8,null))[_0xc98e('0x39')](handleError(_0x5f59f8,null));};exports[_0xc98e('0x18')]=function(_0x79b489,_0x2a7a90){return db[_0xc98e('0x22')][_0xc98e('0x40')]({'where':{'id':_0x79b489['params']['id']}})[_0xc98e('0x17')](handleEntityNotFound(_0x2a7a90,null))[_0xc98e('0x17')](removeEntity(_0x2a7a90,null))[_0xc98e('0x39')](handleError(_0x2a7a90,null));};exports[_0xc98e('0x43')]=function(_0xa57843,_0x1b8e5e){return db[_0xc98e('0x22')][_0xc98e('0x43')]()[_0xc98e('0x17')](respondWithResult(_0x1b8e5e,null))[_0xc98e('0x39')](handleError(_0x1b8e5e,null));};exports[_0xc98e('0x44')]=function(_0x54b6fd,_0x25aae7){var _0x4a496c={'raw':!![],'where':{}},_0x1043f1={},_0x10e370;return db[_0xc98e('0x22')][_0xc98e('0x45')]({'where':{'id':_0x54b6fd[_0xc98e('0x2e')]['id']}})[_0xc98e('0x17')](handleEntityNotFound(_0x25aae7,null))['then'](function(_0x72d614){if(_0x72d614){_0x10e370=_0x72d614[_0xc98e('0x19')]({'plain':!![]});_0x1043f1[_0xc98e('0x2f')]=_[_0xc98e('0x30')](db[_0xc98e('0x46')][_0xc98e('0x23')]);_0x1043f1['query']=_[_0xc98e('0x30')](_0x54b6fd['query']);_0x1043f1[_0xc98e('0x31')]=_[_0xc98e('0x32')](_0x1043f1[_0xc98e('0x2f')],_0x1043f1[_0xc98e('0x2a')]);_0x4a496c['attributes']=_['intersection'](_0x1043f1[_0xc98e('0x2f')],qs['fields'](_0x54b6fd['query']['fields']));_0x4a496c[_0xc98e('0x33')]=_0x4a496c[_0xc98e('0x33')][_0xc98e('0x35')]?_0x4a496c[_0xc98e('0x33')]:_0x1043f1[_0xc98e('0x2f')];if(!_0x54b6fd['query'][_0xc98e('0x47')](_0xc98e('0x48'))){_0x4a496c[_0xc98e('0x12')]=qs[_0xc98e('0x12')](_0x54b6fd[_0xc98e('0x2a')][_0xc98e('0x12')]);_0x4a496c[_0xc98e('0x10')]=qs[_0xc98e('0x10')](_0x54b6fd[_0xc98e('0x2a')][_0xc98e('0x10')]);}_0x4a496c[_0xc98e('0x49')]=qs[_0xc98e('0x4a')](_0x54b6fd[_0xc98e('0x2a')]['sort']);_0x4a496c['where']=qs[_0xc98e('0x31')](_['pick'](_0x54b6fd[_0xc98e('0x2a')],_0x1043f1[_0xc98e('0x31')]));_0x4a496c[_0xc98e('0x28')][_0xc98e('0x4b')]=_0x72d614['id'];if(_0x54b6fd[_0xc98e('0x2a')][_0xc98e('0x4c')]){_0x4a496c['where']=_[_0xc98e('0x37')](_0x4a496c['where'],{'$or':_[_0xc98e('0x21')](_0x4a496c[_0xc98e('0x33')],function(_0x4f4bb3){var _0x514204={};_0x514204[_0x4f4bb3]={'$like':'%'+_0x54b6fd['query'][_0xc98e('0x4c')]+'%'};return _0x514204;})});}_0x4a496c=_[_0xc98e('0x37')]({},_0x4a496c,_0x54b6fd[_0xc98e('0x38')]);return db[_0xc98e('0x46')][_0xc98e('0x2b')](_0x4a496c);}})['then'](function(_0x20fe9a){if(_0x20fe9a){return db[_0xc98e('0x4d')][_0xc98e('0x4e')]({'where':{'id':_['map'](_0x20fe9a,_0xc98e('0x4f')),'role':'agent'},'attributes':['id',_0xc98e('0x1e'),_0xc98e('0x50'),_0xc98e('0x51'),'createdAt']});}})[_0xc98e('0x17')](function(_0x388b1e){if(_0x388b1e){return{'count':_0x388b1e[_0xc98e('0x13')],'rows':_[_0xc98e('0x21')](_0x388b1e[_0xc98e('0x2c')],function(_0x433790){return{'membername':_0x433790[_0xc98e('0x1e')],'UserId':_0x433790['id'],'queue_name':_0x10e370[_0xc98e('0x1e')],'ChatQueueId':_0x10e370['id'],'interface':util['format'](_0xc98e('0x52'),'SIP',_0x433790[_0xc98e('0x1e')]),'penalty':0x0,'paused':_0x433790['chatPause'],'createdAt':_0x433790[_0xc98e('0x53')],'updatedAt':_0x433790[_0xc98e('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x25aae7,_0x4a496c))[_0xc98e('0x39')](handleError(_0x25aae7,null));};exports[_0xc98e('0x54')]=function(_0xdfe919,_0xa90964){var _0x130b80={};var _0x275ebd={};var _0x3634eb;var _0x1270d3;return db[_0xc98e('0x22')][_0xc98e('0x45')]({'where':{'id':_0xdfe919[_0xc98e('0x2e')]['id']}})[_0xc98e('0x17')](handleEntityNotFound(_0xa90964,null))[_0xc98e('0x17')](function(_0x196b0d){if(_0x196b0d){_0x3634eb=_0x196b0d;_0x275ebd['model']=_[_0xc98e('0x30')](db[_0xc98e('0x55')][_0xc98e('0x23')]);_0x275ebd['query']=_[_0xc98e('0x30')](_0xdfe919[_0xc98e('0x2a')]);_0x275ebd[_0xc98e('0x31')]=_[_0xc98e('0x32')](_0x275ebd[_0xc98e('0x2f')],_0x275ebd[_0xc98e('0x2a')]);_0x130b80[_0xc98e('0x33')]=_['intersection'](_0x275ebd['model'],qs[_0xc98e('0x34')](_0xdfe919['query']['fields']));_0x130b80['attributes']=_0x130b80['attributes']['length']?_0x130b80[_0xc98e('0x33')]:_0x275ebd[_0xc98e('0x2f')];_0x130b80[_0xc98e('0x49')]=qs[_0xc98e('0x4a')](_0xdfe919[_0xc98e('0x2a')][_0xc98e('0x4a')]);_0x130b80[_0xc98e('0x28')]=qs[_0xc98e('0x31')](_['pick'](_0xdfe919[_0xc98e('0x2a')],_0x275ebd[_0xc98e('0x31')]));if(_0xdfe919[_0xc98e('0x2a')][_0xc98e('0x4c')]){_0x130b80['where']=_[_0xc98e('0x37')](_0x130b80[_0xc98e('0x28')],{'$or':_[_0xc98e('0x21')](_0x130b80['attributes'],function(_0x3ad195){var _0x588d73={};_0x588d73[_0x3ad195]={'$like':'%'+_0xdfe919[_0xc98e('0x2a')]['filter']+'%'};return _0x588d73;})});}_0x130b80=_[_0xc98e('0x37')]({},_0x130b80,_0xdfe919[_0xc98e('0x38')]);return _0x3634eb['getTeams'](_0x130b80);}})[_0xc98e('0x17')](function(_0xf1fad7){if(_0xf1fad7){_0x1270d3=_0xf1fad7[_0xc98e('0x35')];if(!_0xdfe919[_0xc98e('0x2a')]['hasOwnProperty'](_0xc98e('0x48'))){_0x130b80['limit']=qs[_0xc98e('0x12')](_0xdfe919[_0xc98e('0x2a')]['limit']);_0x130b80['offset']=qs['offset'](_0xdfe919[_0xc98e('0x2a')][_0xc98e('0x10')]);}return _0x3634eb[_0xc98e('0x54')](_0x130b80);}})['then'](function(_0x46c88d){if(_0x46c88d){return _0x46c88d?{'count':_0x1270d3,'rows':_0x46c88d}:null;}})['then'](respondWithResult(_0xa90964,null))[_0xc98e('0x39')](handleError(_0xa90964,null));};exports[_0xc98e('0x56')]=function(_0x32bc4,_0x4e4789){var _0x57d29f=_0x32bc4[_0xc98e('0x3b')][_0xc98e('0x57')];return db[_0xc98e('0x55')][_0xc98e('0x2b')]({'where':{'id':_0x57d29f},'attributes':['id'],'include':[{'model':db[_0xc98e('0x4d')],'as':_0xc98e('0x58'),'attributes':['id',_0xc98e('0x1e'),_0xc98e('0x59'),_0xc98e('0x5a'),_0xc98e('0x5b')],'raw':!![]}]})[_0xc98e('0x17')](function(_0x41a905){if(_0x41a905){var _0x8a6eb=_[_0xc98e('0x5c')](_0x41a905,function(_0x5c24bd){var _0x5cad24=_0x5c24bd[_0xc98e('0x19')]({'plain':!![]});return _0x5cad24[_0xc98e('0x58')];});return db['ChatQueue'][_0xc98e('0x40')]({'where':{'id':_0x32bc4[_0xc98e('0x2e')]['id']}})['then'](function(_0x170867){return db[_0xc98e('0x5d')][_0xc98e('0x5e')](function(_0x1cc1f9){return _0x170867['addTeams'](_0x57d29f,{'transaction':_0x1cc1f9})[_0xc98e('0x17')](function(){return BPromise[_0xc98e('0x5f')](_0x8a6eb,function(_0x555e2b){return db[_0xc98e('0x46')]['findOrCreate']({'where':{'UserId':_0x555e2b['id'],'ChatQueueId':_0x32bc4[_0xc98e('0x2e')]['id']},'transaction':_0x1cc1f9});});})[_0xc98e('0x17')](function(){_0x8a6eb[_0xc98e('0x60')](function(_0x6c4efd){socket[_0xc98e('0x61')](_0xc98e('0x62'),{'UserId':_0x6c4efd['id'],'ChatQueueId':_0x170867['id']});});});});});}})[_0xc98e('0x17')](respondWithStatusCode(_0x4e4789,null))[_0xc98e('0x39')](handleError(_0x4e4789,null));};exports[_0xc98e('0x63')]=function(_0x1b980c,_0x2c0ae5){return db[_0xc98e('0x55')]['findAll']({'where':{'id':_0x1b980c[_0xc98e('0x2a')][_0xc98e('0x57')]},'attributes':['id'],'include':[{'model':db[_0xc98e('0x4d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc98e('0x17')](handleEntityNotFound(_0x2c0ae5,null))[_0xc98e('0x17')](function(_0xa8a0ab){var _0x3f8a77=_['map'](_0xa8a0ab,'id');var _0xb56fac=[];var _0x252b2e=[];var _0x595ff2=squel[_0xc98e('0x64')]();_0x595ff2[_0xc98e('0x65')](_0xc98e('0x66'))[_0xc98e('0x67')](_0xc98e('0x68'),'tq')[_0xc98e('0x69')]('user_has_teams','ut',_0xc98e('0x6a'))[_0xc98e('0x28')](_0xc98e('0x6b'),_0x1b980c[_0xc98e('0x2e')]['id']);for(var _0x2b8835=0x0;_0x2b8835<_0xa8a0ab[_0xc98e('0x35')];_0x2b8835+=0x1){let _0x47c734=_0xa8a0ab[_0x2b8835];for(var _0x32a362=0x0;_0x32a362<_0x47c734[_0xc98e('0x58')]['length'];_0x32a362+=0x1){let _0x306a27=_0x47c734[_0xc98e('0x58')][_0x32a362];var _0x571d75=_0x595ff2[_0xc98e('0x6c')]();_0x571d75[_0xc98e('0x28')]('ut.UserId\x20=\x20?',_0x306a27['id']);_0x252b2e[_0xc98e('0x6d')](db[_0xc98e('0x5d')][_0xc98e('0x2a')](_0x571d75[_0xc98e('0x6e')](),{'type':db['sequelize'][_0xc98e('0x6f')][_0xc98e('0x70')]})[_0xc98e('0x17')](function(_0x2fe92c){if(_0x2fe92c[_0xc98e('0x35')]===0x1){return _0x306a27['id'];}else{var _0x53cf6a=_[_0xc98e('0x71')](_[_0xc98e('0x21')](_0x2fe92c,_0xc98e('0x72')),function(_0x17fa44){return _[_0xc98e('0x73')](_0x3f8a77,_0x17fa44);});if(_0x53cf6a){return _0x306a27['id'];}}}));}}return BPromise[_0xc98e('0x74')](_0x252b2e)['then'](function(_0x28f7a6){_0xb56fac=_(_0xb56fac)[_0xc98e('0x75')](_0x28f7a6)['compact']()[_0xc98e('0x76')]();return db[_0xc98e('0x22')]['find']({'where':{'id':_0x1b980c['params']['id']}})[_0xc98e('0x17')](function(_0x314a94){return db[_0xc98e('0x5d')][_0xc98e('0x5e')](function(_0x5e05f6){return _0x314a94['removeTeams'](_0x1b980c[_0xc98e('0x2a')][_0xc98e('0x57')],{'transaction':_0x5e05f6})[_0xc98e('0x17')](function(){if(!_[_0xc98e('0x77')](_0xb56fac)){return _0x314a94[_0xc98e('0x78')](_0xb56fac,{'transaction':_0x5e05f6});}})[_0xc98e('0x17')](function(){_0xb56fac['forEach'](function(_0x42809f){socket[_0xc98e('0x61')](_0xc98e('0x79'),{'UserId':_0x42809f,'ChatQueueId':_0x314a94['id']});});});});});});})[_0xc98e('0x17')](respondWithStatusCode(_0x2c0ae5,null))[_0xc98e('0x39')](handleError(_0x2c0ae5,null));};exports[_0xc98e('0x7a')]=function(_0x1be9a9,_0x317c2b){return db[_0xc98e('0x22')][_0xc98e('0x40')]({'where':{'id':_0x1be9a9[_0xc98e('0x2e')]['id']}})['then'](handleEntityNotFound(_0x317c2b,null))[_0xc98e('0x17')](function(_0x2a93ee){if(_0x2a93ee){return _0x2a93ee[_0xc98e('0x7a')](_0x1be9a9['body'][_0xc98e('0x57')],_[_0xc98e('0x7b')](_0x1be9a9[_0xc98e('0x3b')],['ids','id'])||{})[_0xc98e('0x7c')](function(_0x468e3f){for(var _0x525c64=0x0;_0x525c64<_0x1be9a9['body'][_0xc98e('0x57')]['length'];_0x525c64+=0x1){socket[_0xc98e('0x61')]('userChatQueue:save',{'UserId':Number(_0x1be9a9[_0xc98e('0x3b')][_0xc98e('0x57')][_0x525c64]),'ChatQueueId':Number(_0x1be9a9[_0xc98e('0x2e')]['id'])});}return _0x468e3f;});}})[_0xc98e('0x17')](respondWithResult(_0x317c2b,null))[_0xc98e('0x39')](handleError(_0x317c2b,null));};exports[_0xc98e('0x78')]=function(_0x3ab47e,_0x452948){return db[_0xc98e('0x22')][_0xc98e('0x40')]({'where':{'id':_0x3ab47e[_0xc98e('0x2e')]['id']}})[_0xc98e('0x17')](handleEntityNotFound(_0x452948,null))[_0xc98e('0x17')](function(_0x1987bc){if(_0x1987bc){return _0x1987bc[_0xc98e('0x78')](_0x3ab47e[_0xc98e('0x2a')][_0xc98e('0x57')])[_0xc98e('0x17')](function(){if(_[_0xc98e('0x7d')](_0x3ab47e['query'][_0xc98e('0x57')])){for(var _0x5c0b3d=0x0;_0x5c0b3d<_0x3ab47e['query'][_0xc98e('0x57')][_0xc98e('0x35')];_0x5c0b3d+=0x1){socket[_0xc98e('0x61')]('userChatQueue:remove',{'UserId':Number(_0x3ab47e[_0xc98e('0x2a')][_0xc98e('0x57')][_0x5c0b3d]),'ChatQueueId':Number(_0x3ab47e[_0xc98e('0x2e')]['id'])});}}else{socket[_0xc98e('0x61')](_0xc98e('0x79'),{'UserId':Number(_0x3ab47e[_0xc98e('0x2a')]['ids']),'ChatQueueId':Number(_0x3ab47e[_0xc98e('0x2e')]['id'])});}});}})[_0xc98e('0x17')](respondWithStatusCode(_0x452948,null))[_0xc98e('0x39')](handleError(_0x452948,null));};exports[_0xc98e('0x7e')]=function(_0x5df54e,_0x1d7d93){var _0x5032af={};var _0x2484ce={};var _0x4fde54;var _0xa52fbe;return db[_0xc98e('0x22')][_0xc98e('0x45')]({'where':{'id':_0x5df54e[_0xc98e('0x2e')]['id']}})[_0xc98e('0x17')](handleEntityNotFound(_0x1d7d93,null))[_0xc98e('0x17')](function(_0x612f1d){if(_0x612f1d){_0x4fde54=_0x612f1d;_0x2484ce[_0xc98e('0x2f')]=_['keys'](db[_0xc98e('0x4d')][_0xc98e('0x23')]);_0x2484ce['query']=_[_0xc98e('0x30')](_0x5df54e[_0xc98e('0x2a')]);_0x2484ce[_0xc98e('0x31')]=_['intersection'](_0x2484ce[_0xc98e('0x2f')],_0x2484ce[_0xc98e('0x2a')]);_0x5032af['attributes']=_[_0xc98e('0x32')](_0x2484ce[_0xc98e('0x2f')],qs[_0xc98e('0x34')](_0x5df54e['query'][_0xc98e('0x34')]));_0x5032af[_0xc98e('0x33')]=_0x5032af[_0xc98e('0x33')]['length']?_0x5032af[_0xc98e('0x33')]:_0x2484ce[_0xc98e('0x2f')];_0x5032af[_0xc98e('0x49')]=qs[_0xc98e('0x4a')](_0x5df54e[_0xc98e('0x2a')][_0xc98e('0x4a')]);_0x5032af[_0xc98e('0x28')]=qs['filters'](_[_0xc98e('0x7f')](_0x5df54e[_0xc98e('0x2a')],_0x2484ce[_0xc98e('0x31')]));if(_0x5df54e['query'][_0xc98e('0x4c')]){_0x5032af['where']=_['merge'](_0x5032af[_0xc98e('0x28')],{'$or':_['map'](_0x5032af[_0xc98e('0x33')],function(_0x24de70){var _0x2197db={};_0x2197db[_0x24de70]={'$like':'%'+_0x5df54e['query']['filter']+'%'};return _0x2197db;})});}_0x5032af=_[_0xc98e('0x37')]({},_0x5032af,_0x5df54e[_0xc98e('0x38')]);return _0x4fde54['getAgents'](_0x5032af);}})[_0xc98e('0x17')](function(_0x43af75){if(_0x43af75){_0xa52fbe=_0x43af75[_0xc98e('0x35')];if(!_0x5df54e['query'][_0xc98e('0x47')](_0xc98e('0x48'))){_0x5032af['limit']=qs[_0xc98e('0x12')](_0x5df54e[_0xc98e('0x2a')]['limit']);_0x5032af[_0xc98e('0x10')]=qs[_0xc98e('0x10')](_0x5df54e[_0xc98e('0x2a')]['offset']);}return _0x4fde54['getAgents'](_0x5032af);}})[_0xc98e('0x17')](function(_0x17db52){if(_0x17db52){return _0x17db52?{'count':_0xa52fbe,'rows':_0x17db52}:null;}})[_0xc98e('0x17')](respondWithResult(_0x1d7d93,null))[_0xc98e('0x39')](handleError(_0x1d7d93,null));}; \ No newline at end of file +var _0xdc2b=['compact','value','removeAgents','userChatQueue:remove','addAgents','omit','userChatQueue:save','isArray','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','get','ChatQueues','UserProfileResource','destroy','error','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','catch','show','params','model','keys','query','intersection','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','nolimit','sort','where','User','UserId','chatPause','updatedAt','rows','format','%s/%s','createdAt','Team','order','pick','filter','getTeams','length','ids','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','Agents','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union'];(function(_0x1a2f18,_0x400424){var _0x1a6a7f=function(_0x2022a2){while(--_0x2022a2){_0x1a2f18['push'](_0x1a2f18['shift']());}};_0x1a6a7f(++_0x400424);}(_0xdc2b,0x174));var _0xbdc2=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xdc2b[_0xa6cc5c];return _0x44803d;};'use strict';var BPromise=require(_0xbdc2('0x0'));var util=require(_0xbdc2('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xbdc2('0x2'));var qs=require(_0xbdc2('0x3'));var logger=require(_0xbdc2('0x4'))(_0xbdc2('0x5'));var config=require(_0xbdc2('0x6'));var db=require('../../mysqldb')['db'];config[_0xbdc2('0x7')]=_[_0xbdc2('0x8')](config[_0xbdc2('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xbdc2('0x9'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xbdc2('0xa')](socket);function respondWithStatusCode(_0x565313,_0x15317d){_0x15317d=_0x15317d||0xcc;return function(_0x1ef8f6){if(_0x1ef8f6){return _0x565313[_0xbdc2('0xb')](_0x15317d);}return _0x565313[_0xbdc2('0xc')](_0x15317d)[_0xbdc2('0xd')]();};}function respondWithResult(_0x25b9bb,_0x511256){_0x511256=_0x511256||0xc8;return function(_0x45b01a){if(_0x45b01a){return _0x25b9bb[_0xbdc2('0xc')](_0x511256)['json'](_0x45b01a);}};}function respondWithFilteredResult(_0x6c5ce2,_0x4b2c81){return function(_0x5d4622){if(_0x5d4622){var _0x2e0521=typeof _0x4b2c81[_0xbdc2('0xe')]==='undefined'&&typeof _0x4b2c81[_0xbdc2('0xf')]===_0xbdc2('0x10');var _0x171014=_0x5d4622[_0xbdc2('0x11')];var _0xc0a6d7=_0x2e0521?0x0:_0x4b2c81[_0xbdc2('0xe')];var _0x4c8ae6=_0x2e0521?_0x5d4622[_0xbdc2('0x11')]:_0x4b2c81[_0xbdc2('0xe')]+_0x4b2c81['limit'];var _0x16837b;if(_0x4c8ae6>=_0x171014){_0x4c8ae6=_0x171014;_0x16837b=0xc8;}else{_0x16837b=0xce;}_0x6c5ce2[_0xbdc2('0xc')](_0x16837b);return _0x6c5ce2[_0xbdc2('0x12')](_0xbdc2('0x13'),_0xc0a6d7+'-'+_0x4c8ae6+'/'+_0x171014)[_0xbdc2('0x14')](_0x5d4622);}return null;};}function saveUpdates(_0xeba671){return function(_0x33f7ea){if(_0x33f7ea){return _0x33f7ea[_0xbdc2('0x15')](_0xeba671)[_0xbdc2('0x16')](function(_0x4222df){return _0x4222df;});}return null;};}function removeEntity(_0x2de6d1){return function(_0x10bcaa){if(_0x10bcaa){return _0x10bcaa['destroy']()[_0xbdc2('0x16')](function(){var _0x2782c1=_0x10bcaa[_0xbdc2('0x17')]({'plain':!![]});var _0x35ab99=_0xbdc2('0x18');return db[_0xbdc2('0x19')][_0xbdc2('0x1a')]({'where':{'type':_0x35ab99,'resourceId':_0x2782c1['id']}})['then'](function(){return _0x10bcaa;});})[_0xbdc2('0x16')](function(){_0x2de6d1[_0xbdc2('0xc')](0xcc)[_0xbdc2('0xd')]();});}};}function handleEntityNotFound(_0x3a5fda){return function(_0x59281f){if(!_0x59281f){_0x3a5fda['sendStatus'](0x194);}return _0x59281f;};}function handleError(_0x2cb1ba,_0x19cb96){_0x19cb96=_0x19cb96||0x1f4;return function(_0x4365a9){logger[_0xbdc2('0x1b')](_0x4365a9['stack']);if(_0x4365a9[_0xbdc2('0x1c')]){delete _0x4365a9[_0xbdc2('0x1c')];}_0x2cb1ba[_0xbdc2('0xc')](_0x19cb96)[_0xbdc2('0x1d')](_0x4365a9);};}exports[_0xbdc2('0x1e')]=function(_0x150981,_0x241a3b){var _0x265935={};var _0x1ab11d={'count':0x0,'rows':[]};var _0x646363=_[_0xbdc2('0x1f')](db[_0xbdc2('0x20')][_0xbdc2('0x21')],function(_0x347f06){return{'name':_0x347f06[_0xbdc2('0x22')],'type':_0x347f06[_0xbdc2('0x23')][_0xbdc2('0x24')]};});_0x265935=qs[_0xbdc2('0x25')](_0x646363,_0x150981);var _0x48798d={'where':_0x265935['where']};return db['ChatQueue']['count'](_0x48798d)['then'](function(_0xb13846){_0x1ab11d['count']=_0xb13846;_0x265935[_0xbdc2('0x26')]=qs[_0xbdc2('0x26')](_0x150981['query']);return db['ChatQueue'][_0xbdc2('0x27')](_0x265935);})['then'](function(_0x41133a){_0x1ab11d['rows']=_0x41133a;return _0x1ab11d;})[_0xbdc2('0x16')](respondWithFilteredResult(_0x241a3b,_0x265935))[_0xbdc2('0x28')](handleError(_0x241a3b,null));};exports[_0xbdc2('0x29')]=function(_0xdcade9,_0x941804){var _0x51cc40={'raw':!![],'where':{'id':_0xdcade9[_0xbdc2('0x2a')]['id']}},_0x39acd2={};_0x39acd2[_0xbdc2('0x2b')]=_[_0xbdc2('0x2c')](db['ChatQueue']['rawAttributes']);_0x39acd2['query']=_[_0xbdc2('0x2c')](_0xdcade9[_0xbdc2('0x2d')]);_0x39acd2['filters']=_[_0xbdc2('0x2e')](_0x39acd2['model'],_0x39acd2['query']);_0x51cc40[_0xbdc2('0x2f')]=_[_0xbdc2('0x2e')](_0x39acd2['model'],qs[_0xbdc2('0x30')](_0xdcade9[_0xbdc2('0x2d')]['fields']));_0x51cc40[_0xbdc2('0x2f')]=_0x51cc40[_0xbdc2('0x2f')]['length']?_0x51cc40[_0xbdc2('0x2f')]:_0x39acd2[_0xbdc2('0x2b')];if(_0xdcade9['query'][_0xbdc2('0x31')]){_0x51cc40[_0xbdc2('0x26')]=[{'all':!![]}];}_0x51cc40=_[_0xbdc2('0x32')]({},_0x51cc40,_0xdcade9[_0xbdc2('0x33')]);return db[_0xbdc2('0x20')][_0xbdc2('0x34')](_0x51cc40)[_0xbdc2('0x16')](handleEntityNotFound(_0x941804,null))['then'](respondWithResult(_0x941804,null))[_0xbdc2('0x28')](handleError(_0x941804,null));};exports[_0xbdc2('0x35')]=function(_0x4ef443,_0x37f176){return db['ChatQueue'][_0xbdc2('0x35')](_0x4ef443[_0xbdc2('0x36')],{})[_0xbdc2('0x16')](function(_0x29bddd){var _0x4b6aa3=_0x4ef443[_0xbdc2('0x37')][_0xbdc2('0x17')]({'plain':!![]});if(!_0x4b6aa3)throw new Error(_0xbdc2('0x38'));if(_0x4b6aa3['role']===_0xbdc2('0x37')){var _0x374382=_0x29bddd[_0xbdc2('0x17')]({'plain':!![]});var _0x373bea=_0xbdc2('0x18');return db['UserProfileSection'][_0xbdc2('0x34')]({'where':{'name':_0x373bea,'userProfileId':_0x4b6aa3['userProfileId']},'raw':!![]})[_0xbdc2('0x16')](function(_0x208fd0){if(_0x208fd0&&_0x208fd0[_0xbdc2('0x39')]===0x0){return db['UserProfileResource'][_0xbdc2('0x35')]({'name':_0x374382['name'],'resourceId':_0x374382['id'],'type':_0x208fd0[_0xbdc2('0x1c')],'sectionId':_0x208fd0['id']},{})[_0xbdc2('0x16')](function(){return _0x29bddd;});}else{return _0x29bddd;}})['catch'](function(_0x39fc26){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39fc26);throw _0x39fc26;});}return _0x29bddd;})['then'](respondWithResult(_0x37f176,0xc9))[_0xbdc2('0x28')](handleError(_0x37f176,null));};exports[_0xbdc2('0x15')]=function(_0x2c67c3,_0x53687b){if(_0x2c67c3[_0xbdc2('0x36')]['id']){delete _0x2c67c3[_0xbdc2('0x36')]['id'];}return db[_0xbdc2('0x20')][_0xbdc2('0x34')]({'where':{'id':_0x2c67c3[_0xbdc2('0x2a')]['id']}})[_0xbdc2('0x16')](handleEntityNotFound(_0x53687b,null))[_0xbdc2('0x16')](saveUpdates(_0x2c67c3['body'],null))[_0xbdc2('0x16')](respondWithResult(_0x53687b,null))['catch'](handleError(_0x53687b,null));};exports[_0xbdc2('0x1a')]=function(_0xb20a1,_0x280b24){return db[_0xbdc2('0x20')][_0xbdc2('0x34')]({'where':{'id':_0xb20a1['params']['id']}})[_0xbdc2('0x16')](handleEntityNotFound(_0x280b24,null))[_0xbdc2('0x16')](removeEntity(_0x280b24,null))[_0xbdc2('0x28')](handleError(_0x280b24,null));};exports[_0xbdc2('0x3a')]=function(_0x4b6d1e,_0x5a6d47){return db['ChatQueue'][_0xbdc2('0x3a')]()[_0xbdc2('0x16')](respondWithResult(_0x5a6d47,null))[_0xbdc2('0x28')](handleError(_0x5a6d47,null));};exports[_0xbdc2('0x3b')]=function(_0x33bc0f,_0x3733d4){var _0x266c61={'raw':!![],'where':{}},_0x5aa5e1={},_0xc6be87;return db[_0xbdc2('0x20')][_0xbdc2('0x3c')]({'where':{'id':_0x33bc0f['params']['id']}})[_0xbdc2('0x16')](handleEntityNotFound(_0x3733d4,null))[_0xbdc2('0x16')](function(_0x152f3e){if(_0x152f3e){_0xc6be87=_0x152f3e[_0xbdc2('0x17')]({'plain':!![]});_0x5aa5e1[_0xbdc2('0x2b')]=_[_0xbdc2('0x2c')](db[_0xbdc2('0x3d')][_0xbdc2('0x21')]);_0x5aa5e1[_0xbdc2('0x2d')]=_[_0xbdc2('0x2c')](_0x33bc0f[_0xbdc2('0x2d')]);_0x5aa5e1[_0xbdc2('0x3e')]=_['intersection'](_0x5aa5e1[_0xbdc2('0x2b')],_0x5aa5e1[_0xbdc2('0x2d')]);_0x266c61['attributes']=_[_0xbdc2('0x2e')](_0x5aa5e1[_0xbdc2('0x2b')],qs['fields'](_0x33bc0f[_0xbdc2('0x2d')][_0xbdc2('0x30')]));_0x266c61[_0xbdc2('0x2f')]=_0x266c61['attributes']['length']?_0x266c61[_0xbdc2('0x2f')]:_0x5aa5e1['model'];if(!_0x33bc0f[_0xbdc2('0x2d')][_0xbdc2('0x3f')](_0xbdc2('0x40'))){_0x266c61[_0xbdc2('0xf')]=qs[_0xbdc2('0xf')](_0x33bc0f[_0xbdc2('0x2d')][_0xbdc2('0xf')]);_0x266c61['offset']=qs[_0xbdc2('0xe')](_0x33bc0f['query'][_0xbdc2('0xe')]);}_0x266c61['order']=qs[_0xbdc2('0x41')](_0x33bc0f[_0xbdc2('0x2d')][_0xbdc2('0x41')]);_0x266c61[_0xbdc2('0x42')]=qs[_0xbdc2('0x3e')](_['pick'](_0x33bc0f[_0xbdc2('0x2d')],_0x5aa5e1[_0xbdc2('0x3e')]));_0x266c61[_0xbdc2('0x42')]['ChatQueueId']=_0x152f3e['id'];if(_0x33bc0f[_0xbdc2('0x2d')]['filter']){_0x266c61[_0xbdc2('0x42')]=_[_0xbdc2('0x32')](_0x266c61[_0xbdc2('0x42')],{'$or':_[_0xbdc2('0x1f')](_0x266c61[_0xbdc2('0x2f')],function(_0x3da852){var _0x3c64a0={};_0x3c64a0[_0x3da852]={'$like':'%'+_0x33bc0f['query']['filter']+'%'};return _0x3c64a0;})});}_0x266c61=_[_0xbdc2('0x32')]({},_0x266c61,_0x33bc0f[_0xbdc2('0x33')]);return db[_0xbdc2('0x3d')]['findAll'](_0x266c61);}})[_0xbdc2('0x16')](function(_0x887ca4){if(_0x887ca4){return db[_0xbdc2('0x43')]['findAndCountAll']({'where':{'id':_[_0xbdc2('0x1f')](_0x887ca4,_0xbdc2('0x44')),'role':'agent'},'attributes':['id',_0xbdc2('0x1c'),_0xbdc2('0x45'),_0xbdc2('0x46'),'createdAt']});}})[_0xbdc2('0x16')](function(_0x58242a){if(_0x58242a){return{'count':_0x58242a['count'],'rows':_[_0xbdc2('0x1f')](_0x58242a[_0xbdc2('0x47')],function(_0x43eff1){return{'membername':_0x43eff1['name'],'UserId':_0x43eff1['id'],'queue_name':_0xc6be87[_0xbdc2('0x1c')],'ChatQueueId':_0xc6be87['id'],'interface':util[_0xbdc2('0x48')](_0xbdc2('0x49'),'SIP',_0x43eff1[_0xbdc2('0x1c')]),'penalty':0x0,'paused':_0x43eff1['chatPause'],'createdAt':_0x43eff1[_0xbdc2('0x4a')],'updatedAt':_0x43eff1[_0xbdc2('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbdc2('0x16')](respondWithFilteredResult(_0x3733d4,_0x266c61))[_0xbdc2('0x28')](handleError(_0x3733d4,null));};exports['getTeams']=function(_0x362f58,_0x2a6ba3){var _0xb19c24={};var _0x5681a9={};var _0x5be75c;var _0x1289d1;return db[_0xbdc2('0x20')][_0xbdc2('0x3c')]({'where':{'id':_0x362f58['params']['id']}})['then'](handleEntityNotFound(_0x2a6ba3,null))[_0xbdc2('0x16')](function(_0x56780){if(_0x56780){_0x5be75c=_0x56780;_0x5681a9['model']=_[_0xbdc2('0x2c')](db[_0xbdc2('0x4b')][_0xbdc2('0x21')]);_0x5681a9[_0xbdc2('0x2d')]=_['keys'](_0x362f58['query']);_0x5681a9[_0xbdc2('0x3e')]=_['intersection'](_0x5681a9[_0xbdc2('0x2b')],_0x5681a9[_0xbdc2('0x2d')]);_0xb19c24[_0xbdc2('0x2f')]=_['intersection'](_0x5681a9[_0xbdc2('0x2b')],qs[_0xbdc2('0x30')](_0x362f58['query'][_0xbdc2('0x30')]));_0xb19c24[_0xbdc2('0x2f')]=_0xb19c24[_0xbdc2('0x2f')]['length']?_0xb19c24[_0xbdc2('0x2f')]:_0x5681a9[_0xbdc2('0x2b')];_0xb19c24[_0xbdc2('0x4c')]=qs[_0xbdc2('0x41')](_0x362f58[_0xbdc2('0x2d')][_0xbdc2('0x41')]);_0xb19c24[_0xbdc2('0x42')]=qs[_0xbdc2('0x3e')](_[_0xbdc2('0x4d')](_0x362f58[_0xbdc2('0x2d')],_0x5681a9[_0xbdc2('0x3e')]));if(_0x362f58['query'][_0xbdc2('0x4e')]){_0xb19c24['where']=_[_0xbdc2('0x32')](_0xb19c24[_0xbdc2('0x42')],{'$or':_['map'](_0xb19c24[_0xbdc2('0x2f')],function(_0x2aa285){var _0x357539={};_0x357539[_0x2aa285]={'$like':'%'+_0x362f58['query'][_0xbdc2('0x4e')]+'%'};return _0x357539;})});}_0xb19c24=_[_0xbdc2('0x32')]({},_0xb19c24,_0x362f58[_0xbdc2('0x33')]);return _0x5be75c[_0xbdc2('0x4f')](_0xb19c24);}})[_0xbdc2('0x16')](function(_0x21faf8){if(_0x21faf8){_0x1289d1=_0x21faf8[_0xbdc2('0x50')];if(!_0x362f58[_0xbdc2('0x2d')][_0xbdc2('0x3f')](_0xbdc2('0x40'))){_0xb19c24[_0xbdc2('0xf')]=qs[_0xbdc2('0xf')](_0x362f58['query']['limit']);_0xb19c24[_0xbdc2('0xe')]=qs[_0xbdc2('0xe')](_0x362f58[_0xbdc2('0x2d')][_0xbdc2('0xe')]);}return _0x5be75c['getTeams'](_0xb19c24);}})[_0xbdc2('0x16')](function(_0x4962b8){if(_0x4962b8){return _0x4962b8?{'count':_0x1289d1,'rows':_0x4962b8}:null;}})['then'](respondWithResult(_0x2a6ba3,null))[_0xbdc2('0x28')](handleError(_0x2a6ba3,null));};exports['addTeams']=function(_0x34a0f8,_0x4e2c2d){var _0x24fbfa=_0x34a0f8['body'][_0xbdc2('0x51')];return db[_0xbdc2('0x4b')]['findAll']({'where':{'id':_0x24fbfa},'attributes':['id'],'include':[{'model':db[_0xbdc2('0x43')],'as':'Agents','attributes':['id',_0xbdc2('0x1c'),_0xbdc2('0x52'),_0xbdc2('0x53'),_0xbdc2('0x54')],'raw':!![]}]})[_0xbdc2('0x16')](function(_0x33b504){if(_0x33b504){var _0xc48eb6=_[_0xbdc2('0x55')](_0x33b504,function(_0x3ca6a1){var _0x44d04e=_0x3ca6a1[_0xbdc2('0x17')]({'plain':!![]});return _0x44d04e['Agents'];});return db[_0xbdc2('0x20')][_0xbdc2('0x34')]({'where':{'id':_0x34a0f8[_0xbdc2('0x2a')]['id']}})[_0xbdc2('0x16')](function(_0x458979){return db['sequelize'][_0xbdc2('0x56')](function(_0x5b63df){return _0x458979[_0xbdc2('0x57')](_0x24fbfa,{'transaction':_0x5b63df})[_0xbdc2('0x16')](function(){return BPromise[_0xbdc2('0x58')](_0xc48eb6,function(_0x1d5ed2){return db[_0xbdc2('0x3d')][_0xbdc2('0x59')]({'where':{'UserId':_0x1d5ed2['id'],'ChatQueueId':_0x34a0f8[_0xbdc2('0x2a')]['id']},'transaction':_0x5b63df});});})[_0xbdc2('0x16')](function(){_0xc48eb6[_0xbdc2('0x5a')](function(_0x3fb7f1){socket[_0xbdc2('0x5b')]('userChatQueue:save',{'UserId':_0x3fb7f1['id'],'ChatQueueId':_0x458979['id']});});});});});}})[_0xbdc2('0x16')](respondWithStatusCode(_0x4e2c2d,null))['catch'](handleError(_0x4e2c2d,null));};exports[_0xbdc2('0x5c')]=function(_0x30700f,_0x182cae){return db[_0xbdc2('0x4b')]['findAll']({'where':{'id':_0x30700f[_0xbdc2('0x2d')][_0xbdc2('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x182cae,null))['then'](function(_0x292e79){var _0xecf9d7=_[_0xbdc2('0x1f')](_0x292e79,'id');var _0x32b137=[];var _0x17303c=[];var _0x448ad6=squel[_0xbdc2('0x5d')]();_0x448ad6[_0xbdc2('0x5e')](_0xbdc2('0x5f'))[_0xbdc2('0x60')](_0xbdc2('0x61'),'tq')[_0xbdc2('0x62')]('user_has_teams','ut',_0xbdc2('0x63'))['where'](_0xbdc2('0x64'),_0x30700f[_0xbdc2('0x2a')]['id']);for(var _0x3cf7d9=0x0;_0x3cf7d9<_0x292e79[_0xbdc2('0x50')];_0x3cf7d9+=0x1){let _0x2cfcbf=_0x292e79[_0x3cf7d9];for(var _0x73afe1=0x0;_0x73afe1<_0x2cfcbf[_0xbdc2('0x65')][_0xbdc2('0x50')];_0x73afe1+=0x1){let _0x21d9e0=_0x2cfcbf[_0xbdc2('0x65')][_0x73afe1];var _0x2a2aa4=_0x448ad6['clone']();_0x2a2aa4['where'](_0xbdc2('0x66'),_0x21d9e0['id']);_0x17303c[_0xbdc2('0x67')](db[_0xbdc2('0x68')][_0xbdc2('0x2d')](_0x2a2aa4[_0xbdc2('0x69')](),{'type':db[_0xbdc2('0x68')][_0xbdc2('0x6a')][_0xbdc2('0x6b')]})[_0xbdc2('0x16')](function(_0x1e8cab){if(_0x1e8cab[_0xbdc2('0x50')]===0x1){return _0x21d9e0['id'];}else{var _0x3b48e5=_['every'](_['map'](_0x1e8cab,_0xbdc2('0x6c')),function(_0x46fc79){return _[_0xbdc2('0x6d')](_0xecf9d7,_0x46fc79);});if(_0x3b48e5){return _0x21d9e0['id'];}}}));}}return BPromise[_0xbdc2('0x6e')](_0x17303c)[_0xbdc2('0x16')](function(_0x21dd49){_0x32b137=_(_0x32b137)[_0xbdc2('0x6f')](_0x21dd49)[_0xbdc2('0x70')]()[_0xbdc2('0x71')]();return db[_0xbdc2('0x20')][_0xbdc2('0x34')]({'where':{'id':_0x30700f['params']['id']}})[_0xbdc2('0x16')](function(_0x4df595){return db['sequelize']['transaction'](function(_0x39d64f){return _0x4df595[_0xbdc2('0x5c')](_0x30700f[_0xbdc2('0x2d')]['ids'],{'transaction':_0x39d64f})[_0xbdc2('0x16')](function(){if(!_['isEmpty'](_0x32b137)){return _0x4df595[_0xbdc2('0x72')](_0x32b137,{'transaction':_0x39d64f});}})[_0xbdc2('0x16')](function(){_0x32b137[_0xbdc2('0x5a')](function(_0x4a941a){socket[_0xbdc2('0x5b')](_0xbdc2('0x73'),{'UserId':_0x4a941a,'ChatQueueId':_0x4df595['id']});});});});});});})[_0xbdc2('0x16')](respondWithStatusCode(_0x182cae,null))[_0xbdc2('0x28')](handleError(_0x182cae,null));};exports[_0xbdc2('0x74')]=function(_0x22b82,_0x1cd65c){return db[_0xbdc2('0x20')][_0xbdc2('0x34')]({'where':{'id':_0x22b82[_0xbdc2('0x2a')]['id']}})[_0xbdc2('0x16')](handleEntityNotFound(_0x1cd65c,null))[_0xbdc2('0x16')](function(_0x58937a){if(_0x58937a){return _0x58937a['addAgents'](_0x22b82[_0xbdc2('0x36')]['ids'],_[_0xbdc2('0x75')](_0x22b82[_0xbdc2('0x36')],[_0xbdc2('0x51'),'id'])||{})['spread'](function(_0xd0e7ac){for(var _0x1b41c5=0x0;_0x1b41c5<_0x22b82[_0xbdc2('0x36')][_0xbdc2('0x51')][_0xbdc2('0x50')];_0x1b41c5+=0x1){socket['emit'](_0xbdc2('0x76'),{'UserId':Number(_0x22b82[_0xbdc2('0x36')]['ids'][_0x1b41c5]),'ChatQueueId':Number(_0x22b82[_0xbdc2('0x2a')]['id'])});}return _0xd0e7ac;});}})['then'](respondWithResult(_0x1cd65c,null))[_0xbdc2('0x28')](handleError(_0x1cd65c,null));};exports[_0xbdc2('0x72')]=function(_0x22bc7b,_0x3c4822){return db[_0xbdc2('0x20')][_0xbdc2('0x34')]({'where':{'id':_0x22bc7b[_0xbdc2('0x2a')]['id']}})[_0xbdc2('0x16')](handleEntityNotFound(_0x3c4822,null))[_0xbdc2('0x16')](function(_0x309ddc){if(_0x309ddc){return _0x309ddc[_0xbdc2('0x72')](_0x22bc7b[_0xbdc2('0x2d')][_0xbdc2('0x51')])[_0xbdc2('0x16')](function(){if(_[_0xbdc2('0x77')](_0x22bc7b['query'][_0xbdc2('0x51')])){for(var _0x322c57=0x0;_0x322c57<_0x22bc7b[_0xbdc2('0x2d')][_0xbdc2('0x51')][_0xbdc2('0x50')];_0x322c57+=0x1){socket[_0xbdc2('0x5b')](_0xbdc2('0x73'),{'UserId':Number(_0x22bc7b['query'][_0xbdc2('0x51')][_0x322c57]),'ChatQueueId':Number(_0x22bc7b['params']['id'])});}}else{socket[_0xbdc2('0x5b')](_0xbdc2('0x73'),{'UserId':Number(_0x22bc7b[_0xbdc2('0x2d')][_0xbdc2('0x51')]),'ChatQueueId':Number(_0x22bc7b[_0xbdc2('0x2a')]['id'])});}});}})[_0xbdc2('0x16')](respondWithStatusCode(_0x3c4822,null))[_0xbdc2('0x28')](handleError(_0x3c4822,null));};exports['getAgents']=function(_0x18d501,_0x1eda3a){var _0x3948aa={};var _0x22b9c8={};var _0x178d7;var _0x49940b;return db[_0xbdc2('0x20')][_0xbdc2('0x3c')]({'where':{'id':_0x18d501['params']['id']}})[_0xbdc2('0x16')](handleEntityNotFound(_0x1eda3a,null))['then'](function(_0x2e09dc){if(_0x2e09dc){_0x178d7=_0x2e09dc;_0x22b9c8[_0xbdc2('0x2b')]=_[_0xbdc2('0x2c')](db[_0xbdc2('0x43')][_0xbdc2('0x21')]);_0x22b9c8[_0xbdc2('0x2d')]=_['keys'](_0x18d501[_0xbdc2('0x2d')]);_0x22b9c8[_0xbdc2('0x3e')]=_[_0xbdc2('0x2e')](_0x22b9c8['model'],_0x22b9c8['query']);_0x3948aa['attributes']=_[_0xbdc2('0x2e')](_0x22b9c8[_0xbdc2('0x2b')],qs[_0xbdc2('0x30')](_0x18d501[_0xbdc2('0x2d')][_0xbdc2('0x30')]));_0x3948aa[_0xbdc2('0x2f')]=_0x3948aa[_0xbdc2('0x2f')]['length']?_0x3948aa[_0xbdc2('0x2f')]:_0x22b9c8[_0xbdc2('0x2b')];_0x3948aa[_0xbdc2('0x4c')]=qs[_0xbdc2('0x41')](_0x18d501[_0xbdc2('0x2d')][_0xbdc2('0x41')]);_0x3948aa[_0xbdc2('0x42')]=qs['filters'](_[_0xbdc2('0x4d')](_0x18d501['query'],_0x22b9c8[_0xbdc2('0x3e')]));if(_0x18d501['query'][_0xbdc2('0x4e')]){_0x3948aa[_0xbdc2('0x42')]=_[_0xbdc2('0x32')](_0x3948aa[_0xbdc2('0x42')],{'$or':_['map'](_0x3948aa['attributes'],function(_0x4157c6){var _0xbe3097={};_0xbe3097[_0x4157c6]={'$like':'%'+_0x18d501[_0xbdc2('0x2d')]['filter']+'%'};return _0xbe3097;})});}_0x3948aa=_[_0xbdc2('0x32')]({},_0x3948aa,_0x18d501['options']);return _0x178d7['getAgents'](_0x3948aa);}})[_0xbdc2('0x16')](function(_0x5f2672){if(_0x5f2672){_0x49940b=_0x5f2672[_0xbdc2('0x50')];if(!_0x18d501[_0xbdc2('0x2d')][_0xbdc2('0x3f')](_0xbdc2('0x40'))){_0x3948aa['limit']=qs[_0xbdc2('0xf')](_0x18d501[_0xbdc2('0x2d')]['limit']);_0x3948aa[_0xbdc2('0xe')]=qs[_0xbdc2('0xe')](_0x18d501['query'][_0xbdc2('0xe')]);}return _0x178d7[_0xbdc2('0x78')](_0x3948aa);}})[_0xbdc2('0x16')](function(_0x315cba){if(_0x315cba){return _0x315cba?{'count':_0x49940b,'rows':_0x315cba}:null;}})[_0xbdc2('0x16')](respondWithResult(_0x1eda3a,null))[_0xbdc2('0x28')](handleError(_0x1eda3a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index df51624..4727016 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 _0x7e8e=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save'];(function(_0x3356f0,_0x230069){var _0x33de59=function(_0x19b8da){while(--_0x19b8da){_0x3356f0['push'](_0x3356f0['shift']());}};_0x33de59(++_0x230069);}(_0x7e8e,0x91));var _0xe7e8=function(_0x3849ff,_0x4ae25e){_0x3849ff=_0x3849ff-0x0;var _0x3ab676=_0x7e8e[_0x3849ff];return _0x3ab676;};'use strict';var EventEmitter=require(_0xe7e8('0x0'));var ChatQueue=require(_0xe7e8('0x1'))['db'][_0xe7e8('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe7e8('0x3')](0x0);var events={'afterCreate':_0xe7e8('0x4'),'afterUpdate':_0xe7e8('0x5'),'afterDestroy':_0xe7e8('0x6')};function emitEvent(_0xd0a13b){return function(_0x3c3670,_0x143dc7,_0x533317){ChatQueueEvents['emit'](_0xd0a13b+':'+_0x3c3670['id'],_0x3c3670);ChatQueueEvents[_0xe7e8('0x7')](_0xd0a13b,_0x3c3670);_0x533317(null);};}for(var e in events){if(events[_0xe7e8('0x8')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xe7e8('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x0141=['../../mysqldb','ChatQueue','save','update','remove','emit','hook','exports','events'];(function(_0x277541,_0x5e4f04){var _0x531d89=function(_0x151a5b){while(--_0x151a5b){_0x277541['push'](_0x277541['shift']());}};_0x531d89(++_0x5e4f04);}(_0x0141,0x104));var _0x1014=function(_0x4a7501,_0x135d07){_0x4a7501=_0x4a7501-0x0;var _0x5b1a76=_0x0141[_0x4a7501];return _0x5b1a76;};'use strict';var EventEmitter=require(_0x1014('0x0'));var ChatQueue=require(_0x1014('0x1'))['db'][_0x1014('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1014('0x3'),'afterUpdate':_0x1014('0x4'),'afterDestroy':_0x1014('0x5')};function emitEvent(_0x5ef913){return function(_0x4748e7,_0x127683,_0x3d66ae){ChatQueueEvents[_0x1014('0x6')](_0x5ef913+':'+_0x4748e7['id'],_0x4748e7);ChatQueueEvents[_0x1014('0x6')](_0x5ef913,_0x4748e7);_0x3d66ae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x1014('0x7')](e,emitEvent(event));}}module[_0x1014('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index aa7cf3e..547ea44 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 _0x724c=['rimraf','./chatQueue.attributes','define','ChatQueue','util','moment','bluebird','request-promise','path'];(function(_0xf1a50a,_0xf21556){var _0x19c1d3=function(_0x163be7){while(--_0x163be7){_0xf1a50a['push'](_0xf1a50a['shift']());}};_0x19c1d3(++_0xf21556);}(_0x724c,0xd3));var _0xc724=function(_0x4e1d60,_0x4e93ef){_0x4e1d60=_0x4e1d60-0x0;var _0x39cd7a=_0x724c[_0x4e1d60];return _0x39cd7a;};'use strict';var _=require('lodash');var util=require(_0xc724('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc724('0x1'));var BPromise=require(_0xc724('0x2'));var rp=require(_0xc724('0x3'));var fs=require('fs');var path=require(_0xc724('0x4'));var rimraf=require(_0xc724('0x5'));var config=require('../../config/environment');var attributes=require(_0xc724('0x6'));module['exports']=function(_0x5a70fe,_0x214ff2){return _0x5a70fe[_0xc724('0x7')](_0xc724('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc753=['request-promise','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x38c5bb,_0x153bdb){var _0x5cbd09=function(_0xe17565){while(--_0xe17565){_0x38c5bb['push'](_0x38c5bb['shift']());}};_0x5cbd09(++_0x153bdb);}(_0xc753,0x193));var _0x3c75=function(_0x4cca37,_0x4319e6){_0x4cca37=_0x4cca37-0x0;var _0x365981=_0xc753[_0x4cca37];return _0x365981;};'use strict';var _=require('lodash');var util=require(_0x3c75('0x0'));var logger=require(_0x3c75('0x1'))(_0x3c75('0x2'));var moment=require(_0x3c75('0x3'));var BPromise=require(_0x3c75('0x4'));var rp=require(_0x3c75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c75('0x6'));var config=require('../../config/environment');var attributes=require(_0x3c75('0x7'));module[_0x3c75('0x8')]=function(_0xb84f8e,_0x1c0134){return _0xb84f8e[_0x3c75('0x9')](_0x3c75('0xa'),attributes,{'tableName':_0x3c75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index a965163..9de173c 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 _0x77f1=['then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','register','request'];(function(_0x48af02,_0xa58dcf){var _0xa8280a=function(_0x46c7f9){while(--_0x46c7f9){_0x48af02['push'](_0x48af02['shift']());}};_0xa8280a(++_0xa58dcf);}(_0x77f1,0x1dd));var _0x177f=function(_0x1c7fe7,_0x13f754){_0x1c7fe7=_0x1c7fe7-0x0;var _0x366cff=_0x77f1[_0x1c7fe7];return _0x366cff;};'use strict';var _=require('lodash');var util=require(_0x177f('0x0'));var moment=require(_0x177f('0x1'));var BPromise=require(_0x177f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x177f('0x3'));var logger=require(_0x177f('0x4'))('rpc');var config=require(_0x177f('0x5'));var jayson=require(_0x177f('0x6'));var client=jayson[_0x177f('0x7')][_0x177f('0x8')]({'port':0x232a});config[_0x177f('0x9')]=_['defaults'](config[_0x177f('0x9')],{'host':_0x177f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x177f('0x9')]));require('./chatQueue.socket')[_0x177f('0xb')](socket);function respondWithRpcPromise(_0x4e1bab,_0x2050c2,_0x38989d){return new BPromise(function(_0x47ccab,_0x42d6d2){return client[_0x177f('0xc')](_0x4e1bab,_0x38989d)[_0x177f('0xd')](function(_0xf5086c){logger[_0x177f('0xe')](_0x177f('0xf'),_0x2050c2,_0x177f('0x10'));logger[_0x177f('0x11')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2050c2,_0x177f('0x10'),JSON[_0x177f('0x12')](_0xf5086c));if(_0xf5086c[_0x177f('0x13')]){if(_0xf5086c[_0x177f('0x13')]['code']===0x1f4){logger[_0x177f('0x13')](_0x177f('0xf'),_0x2050c2,_0xf5086c[_0x177f('0x13')]['message']);return _0x42d6d2(_0xf5086c['error'][_0x177f('0x14')]);}logger[_0x177f('0x13')](_0x177f('0xf'),_0x2050c2,_0xf5086c[_0x177f('0x13')][_0x177f('0x14')]);return _0x47ccab(_0xf5086c[_0x177f('0x13')][_0x177f('0x14')]);}else{logger[_0x177f('0xe')](_0x177f('0xf'),_0x2050c2,_0x177f('0x10'));_0x47ccab(_0xf5086c['result'][_0x177f('0x14')]);}})[_0x177f('0x15')](function(_0x4d1c1e){logger[_0x177f('0x13')](_0x177f('0xf'),_0x2050c2,_0x4d1c1e);_0x42d6d2(_0x4d1c1e);});});}exports[_0x177f('0x16')]=function(_0x3cccbf){var _0x3ff483=this;return new Promise(function(_0x4649f0,_0x40f6ed){return db[_0x177f('0x17')][_0x177f('0x18')]({'raw':_0x3cccbf[_0x177f('0x19')]?_0x3cccbf['options'][_0x177f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3cccbf[_0x177f('0x19')]?_0x3cccbf[_0x177f('0x19')][_0x177f('0x1b')]||null:null,'attributes':_0x3cccbf[_0x177f('0x19')]?_0x3cccbf[_0x177f('0x19')][_0x177f('0x1c')]||null:null,'limit':_0x3cccbf['options']?_0x3cccbf['options'][_0x177f('0x1d')]||null:null,'include':_0x3cccbf[_0x177f('0x19')]?_0x3cccbf[_0x177f('0x19')][_0x177f('0x1e')]?_[_0x177f('0x1f')](_0x3cccbf[_0x177f('0x19')]['include'],function(_0x248e4c){return{'model':db[_0x248e4c[_0x177f('0x20')]],'as':_0x248e4c['as'],'attributes':_0x248e4c[_0x177f('0x1c')],'include':_0x248e4c[_0x177f('0x1e')]?_[_0x177f('0x1f')](_0x248e4c[_0x177f('0x1e')],function(_0x1a8e92){return{'model':db[_0x1a8e92[_0x177f('0x20')]],'as':_0x1a8e92['as'],'attributes':_0x1a8e92[_0x177f('0x1c')],'include':_0x1a8e92[_0x177f('0x1e')]?_[_0x177f('0x1f')](_0x1a8e92[_0x177f('0x1e')],function(_0x25d876){return{'model':db[_0x25d876[_0x177f('0x20')]],'as':_0x25d876['as'],'attributes':_0x25d876[_0x177f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfa8ad0){logger[_0x177f('0xe')]('GetChatQueue',_0x3cccbf);logger[_0x177f('0x11')](_0x177f('0x16'),_0x3cccbf,JSON['stringify'](_0xfa8ad0));_0x4649f0(_0xfa8ad0);})[_0x177f('0x15')](function(_0x27cfb3){logger['error']('GetChatQueue',_0x27cfb3['message'],_0x3cccbf);_0x40f6ed(_0x3ff483['error'](0x1f4,_0x27cfb3[_0x177f('0x14')]));});});};exports[_0x177f('0x21')]=function(_0x6cc694){var _0x15681b=this;return new Promise(function(_0xcf2134,_0x99a037){return db[_0x177f('0x17')][_0x177f('0x22')]({'raw':_0x6cc694[_0x177f('0x19')]?_0x6cc694[_0x177f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x6cc694[_0x177f('0x19')]?_0x6cc694[_0x177f('0x19')]['where']||null:null,'attributes':_0x6cc694[_0x177f('0x19')]?_0x6cc694[_0x177f('0x19')]['attributes']||null:null,'include':_0x6cc694['options']?_0x6cc694[_0x177f('0x19')][_0x177f('0x1e')]?_[_0x177f('0x1f')](_0x6cc694[_0x177f('0x19')]['include'],function(_0x5c0033){return{'model':db[_0x5c0033[_0x177f('0x20')]],'as':_0x5c0033['as'],'attributes':_0x5c0033[_0x177f('0x1c')],'include':_0x5c0033[_0x177f('0x1e')]?_[_0x177f('0x1f')](_0x5c0033[_0x177f('0x1e')],function(_0x25659d){return{'model':db[_0x25659d[_0x177f('0x20')]],'as':_0x25659d['as'],'attributes':_0x25659d['attributes'],'include':_0x25659d[_0x177f('0x1e')]?_['map'](_0x25659d[_0x177f('0x1e')],function(_0x23b8c9){return{'model':db[_0x23b8c9['model']],'as':_0x23b8c9['as'],'attributes':_0x23b8c9[_0x177f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x177f('0xd')](function(_0x408154){logger[_0x177f('0xe')]('ShowChatQueue',_0x6cc694);logger['debug']('ShowChatQueue',_0x6cc694,JSON[_0x177f('0x12')](_0x408154));_0xcf2134(_0x408154);})[_0x177f('0x15')](function(_0x47532c){logger[_0x177f('0x13')](_0x177f('0x21'),_0x47532c[_0x177f('0x14')],_0x6cc694);_0x99a037(_0x15681b[_0x177f('0x13')](0x1f4,_0x47532c[_0x177f('0x14')]));});});}; \ No newline at end of file +var _0x531a=['jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowChatQueue','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xf16af5,_0x358d22){var _0x41d3f1=function(_0x168618){while(--_0x168618){_0xf16af5['push'](_0xf16af5['shift']());}};_0x41d3f1(++_0x358d22);}(_0x531a,0x100));var _0xa531=function(_0x35563c,_0x1393e9){_0x35563c=_0x35563c-0x0;var _0x2a763c=_0x531a[_0x35563c];return _0x2a763c;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});config[_0xa531('0xc')]=_[_0xa531('0xd')](config[_0xa531('0xc')],{'host':_0xa531('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa531('0xc')]));require(_0xa531('0xf'))['register'](socket);function respondWithRpcPromise(_0x190db4,_0x3eebc8,_0x10f6e0){return new BPromise(function(_0x3eb94f,_0x3e25a8){return client['request'](_0x190db4,_0x10f6e0)[_0xa531('0x10')](function(_0x4df80e){logger[_0xa531('0x11')](_0xa531('0x12'),_0x3eebc8,_0xa531('0x13'));logger['debug'](_0xa531('0x14'),_0x3eebc8,_0xa531('0x13'),JSON['stringify'](_0x4df80e));if(_0x4df80e[_0xa531('0x15')]){if(_0x4df80e[_0xa531('0x15')]['code']===0x1f4){logger[_0xa531('0x15')](_0xa531('0x12'),_0x3eebc8,_0x4df80e[_0xa531('0x15')]['message']);return _0x3e25a8(_0x4df80e['error']['message']);}logger[_0xa531('0x15')](_0xa531('0x12'),_0x3eebc8,_0x4df80e[_0xa531('0x15')][_0xa531('0x16')]);return _0x3eb94f(_0x4df80e[_0xa531('0x15')][_0xa531('0x16')]);}else{logger['info'](_0xa531('0x12'),_0x3eebc8,'request\x20sent');_0x3eb94f(_0x4df80e[_0xa531('0x17')][_0xa531('0x16')]);}})['catch'](function(_0x4eb512){logger[_0xa531('0x15')](_0xa531('0x12'),_0x3eebc8,_0x4eb512);_0x3e25a8(_0x4eb512);});});}exports[_0xa531('0x18')]=function(_0x55a731){var _0x42b629=this;return new Promise(function(_0x468b75,_0x4096f0){return db['ChatQueue'][_0xa531('0x19')]({'raw':_0x55a731[_0xa531('0x1a')]?_0x55a731['options'][_0xa531('0x1b')]===undefined?!![]:![]:!![],'where':_0x55a731[_0xa531('0x1a')]?_0x55a731[_0xa531('0x1a')][_0xa531('0x1c')]||null:null,'attributes':_0x55a731[_0xa531('0x1a')]?_0x55a731[_0xa531('0x1a')][_0xa531('0x1d')]||null:null,'limit':_0x55a731[_0xa531('0x1a')]?_0x55a731[_0xa531('0x1a')][_0xa531('0x1e')]||null:null,'include':_0x55a731[_0xa531('0x1a')]?_0x55a731[_0xa531('0x1a')]['include']?_[_0xa531('0x1f')](_0x55a731[_0xa531('0x1a')][_0xa531('0x20')],function(_0x487a8c){return{'model':db[_0x487a8c[_0xa531('0x21')]],'as':_0x487a8c['as'],'attributes':_0x487a8c[_0xa531('0x1d')],'include':_0x487a8c['include']?_['map'](_0x487a8c[_0xa531('0x20')],function(_0x56b96d){return{'model':db[_0x56b96d[_0xa531('0x21')]],'as':_0x56b96d['as'],'attributes':_0x56b96d[_0xa531('0x1d')],'include':_0x56b96d['include']?_[_0xa531('0x1f')](_0x56b96d['include'],function(_0x36a8e6){return{'model':db[_0x36a8e6['model']],'as':_0x36a8e6['as'],'attributes':_0x36a8e6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27bd5c){logger[_0xa531('0x11')]('GetChatQueue',_0x55a731);logger['debug'](_0xa531('0x18'),_0x55a731,JSON['stringify'](_0x27bd5c));_0x468b75(_0x27bd5c);})[_0xa531('0x22')](function(_0x133431){logger['error'](_0xa531('0x18'),_0x133431[_0xa531('0x16')],_0x55a731);_0x4096f0(_0x42b629[_0xa531('0x15')](0x1f4,_0x133431['message']));});});};exports[_0xa531('0x23')]=function(_0x3c3376){var _0x4b8104=this;return new Promise(function(_0x2fc577,_0x13c270){return db['ChatQueue'][_0xa531('0x24')]({'raw':_0x3c3376[_0xa531('0x1a')]?_0x3c3376[_0xa531('0x1a')][_0xa531('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c3376[_0xa531('0x1a')]?_0x3c3376[_0xa531('0x1a')][_0xa531('0x1c')]||null:null,'attributes':_0x3c3376['options']?_0x3c3376['options'][_0xa531('0x1d')]||null:null,'include':_0x3c3376[_0xa531('0x1a')]?_0x3c3376[_0xa531('0x1a')][_0xa531('0x20')]?_[_0xa531('0x1f')](_0x3c3376['options'][_0xa531('0x20')],function(_0x3b1ba7){return{'model':db[_0x3b1ba7[_0xa531('0x21')]],'as':_0x3b1ba7['as'],'attributes':_0x3b1ba7[_0xa531('0x1d')],'include':_0x3b1ba7[_0xa531('0x20')]?_[_0xa531('0x1f')](_0x3b1ba7[_0xa531('0x20')],function(_0x24efee){return{'model':db[_0x24efee[_0xa531('0x21')]],'as':_0x24efee['as'],'attributes':_0x24efee[_0xa531('0x1d')],'include':_0x24efee[_0xa531('0x20')]?_['map'](_0x24efee[_0xa531('0x20')],function(_0x311aee){return{'model':db[_0x311aee[_0xa531('0x21')]],'as':_0x311aee['as'],'attributes':_0x311aee[_0xa531('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa531('0x10')](function(_0x4eae17){logger[_0xa531('0x11')](_0xa531('0x23'),_0x3c3376);logger[_0xa531('0x25')](_0xa531('0x23'),_0x3c3376,JSON['stringify'](_0x4eae17));_0x2fc577(_0x4eae17);})[_0xa531('0x22')](function(_0x297c78){logger[_0xa531('0x15')]('ShowChatQueue',_0x297c78['message'],_0x3c3376);_0x13c270(_0x4b8104[_0xa531('0x15')](0x1f4,_0x297c78['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index fe51aff..962ccc1 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 _0x303a=['removeListener','register','length','./chatQueue.events','remove','update','emit'];(function(_0x3445fc,_0xe740b8){var _0x4534c2=function(_0x1fe7dc){while(--_0x1fe7dc){_0x3445fc['push'](_0x3445fc['shift']());}};_0x4534c2(++_0xe740b8);}(_0x303a,0x1a0));var _0xa303=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x303a[_0x20845e];return _0x28cf2b;};'use strict';var ChatQueueEvents=require(_0xa303('0x0'));var events=['save',_0xa303('0x1'),_0xa303('0x2')];function createListener(_0x36e548,_0x19d27a){return function(_0x594b49){_0x19d27a[_0xa303('0x3')](_0x36e548,_0x594b49);};}function removeListener(_0x26b47c,_0x38a354){return function(){ChatQueueEvents[_0xa303('0x4')](_0x26b47c,_0x38a354);};}exports[_0xa303('0x5')]=function(_0x1c7ee9){for(var _0x2bc3d7=0x0,_0x3f61f1=events[_0xa303('0x6')];_0x2bc3d7<_0x3f61f1;_0x2bc3d7++){var _0x5d95fd=events[_0x2bc3d7];var _0x51e1ee=createListener('chatQueue:'+_0x5d95fd,_0x1c7ee9);ChatQueueEvents['on'](_0x5d95fd,_0x51e1ee);}}; \ No newline at end of file +var _0x9a19=['removeListener','register','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9a19,0x114));var _0x99a1=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x9a19[_0x45bf86];return _0x1f02b7;};'use strict';var ChatQueueEvents=require(_0x99a1('0x0'));var events=[_0x99a1('0x1'),_0x99a1('0x2'),'update'];function createListener(_0x16fd8b,_0x2ba463){return function(_0x112bcc){_0x2ba463[_0x99a1('0x3')](_0x16fd8b,_0x112bcc);};}function removeListener(_0x214082,_0x3d73c5){return function(){ChatQueueEvents[_0x99a1('0x4')](_0x214082,_0x3d73c5);};}exports[_0x99a1('0x5')]=function(_0x3eff4a){for(var _0xff0240=0x0,_0x65045d=events['length'];_0xff0240<_0x65045d;_0xff0240++){var _0x4d2a5c=events[_0xff0240];var _0x5aa6c2=createListener(_0x99a1('0x6')+_0x4d2a5c,_0x3eff4a);ChatQueueEvents['on'](_0x4d2a5c,_0x5aa6c2);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 698ad40..ea289ef 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x532d14,_0x285b6b){var _0x2e636f=function(_0x594503){while(--_0x594503){_0x532d14['push'](_0x532d14['shift']());}};_0x2e636f(++_0x285b6b);}(_0x008c,0x188));var _0xc008=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x008c[_0x320b8e];return _0x55a10a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x4e16f2,_0x24ba3b){_0x4e16f2=_0x4e16f2-0x0;var _0x77bca4=_0x3e74[_0x4e16f2];return _0x77bca4;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 777e422..2e0b0ce 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 _0x9fe1=['moment','exports','STRING','DATE'];(function(_0x3a5b58,_0x1a206f){var _0x230d94=function(_0xcb4681){while(--_0xcb4681){_0x3a5b58['push'](_0x3a5b58['shift']());}};_0x230d94(++_0x1a206f);}(_0x9fe1,0x18c));var _0x19fe=function(_0x266d00,_0x3cd3b8){_0x266d00=_0x266d00-0x0;var _0x3a5690=_0x9fe1[_0x266d00];return _0x3a5690;};'use strict';var moment=require(_0x19fe('0x0'));var Sequelize=require('sequelize');module[_0x19fe('0x1')]={'uniqueid':{'type':Sequelize[_0x19fe('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x19fe('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x19fe('0x3')]},'exitAt':{'type':Sequelize[_0x19fe('0x3')]},'reason':{'type':Sequelize[_0x19fe('0x2')]}}; \ No newline at end of file +var _0x38db=['sequelize','exports','STRING','DATE','moment'];(function(_0x46e4da,_0x448bf3){var _0x4db797=function(_0x4f2eaa){while(--_0x4f2eaa){_0x46e4da['push'](_0x46e4da['shift']());}};_0x4db797(++_0x448bf3);}(_0x38db,0x18a));var _0xb38d=function(_0x3fc9af,_0x9bb776){_0x3fc9af=_0x3fc9af-0x0;var _0x3574c0=_0x38db[_0x3fc9af];return _0x3574c0;};'use strict';var moment=require(_0xb38d('0x0'));var Sequelize=require(_0xb38d('0x1'));module[_0xb38d('0x2')]={'uniqueid':{'type':Sequelize[_0xb38d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb38d('0x3')]},'joinAt':{'type':Sequelize[_0xb38d('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb38d('0x4')]},'exitAt':{'type':Sequelize[_0xb38d('0x4')]},'reason':{'type':Sequelize[_0xb38d('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index a6b60d7..e6d204e 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 _0xc4aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','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'];(function(_0x17d76b,_0x54345b){var _0x16f3ac=function(_0x315442){while(--_0x315442){_0x17d76b['push'](_0x17d76b['shift']());}};_0x16f3ac(++_0x54345b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'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'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));};exports[_0xac4a('0x4c')]=function(_0x26e716,_0x3ac36e){return db['ChatQueueReport'][_0xac4a('0x4c')]()[_0xac4a('0x24')](respondWithResult(_0x3ac36e,null))[_0xac4a('0x44')](handleError(_0x3ac36e,null));}; \ No newline at end of file +var _0x9303=['order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','create','body','find','describe','eml-format','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','apply','save','update','then','destroy','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x9303,0xd7));var _0x3930=function(_0x37810c,_0x480382){_0x37810c=_0x37810c-0x0;var _0x44c4ef=_0x9303[_0x37810c];return _0x44c4ef;};'use strict';var emlformat=require(_0x3930('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3930('0x1'));var rp=require('request-promise');var moment=require(_0x3930('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3930('0x3'));var path=require(_0x3930('0x4'));var sox=require(_0x3930('0x5'));var csv=require(_0x3930('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3930('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3930('0x8'));var jsforce=require(_0x3930('0x9'));var deskjs=require(_0x3930('0xa'));var toCsv=require(_0x3930('0x6'));var querystring=require(_0x3930('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3930('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3930('0xd'))(_0x3930('0xe'));var utils=require(_0x3930('0xf'));var config=require(_0x3930('0x10'));var licenseUtil=require(_0x3930('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13b928,_0x55130d){_0x55130d=_0x55130d||0xcc;return function(_0x185659){if(_0x185659){return _0x13b928[_0x3930('0x12')](_0x55130d);}return _0x13b928[_0x3930('0x13')](_0x55130d)['end']();};}function respondWithResult(_0x11b256,_0x15f039){_0x15f039=_0x15f039||0xc8;return function(_0x4ef6c4){if(_0x4ef6c4){return _0x11b256[_0x3930('0x13')](_0x15f039)[_0x3930('0x14')](_0x4ef6c4);}};}function respondWithFilteredResult(_0x3bc35e,_0x135498){return function(_0x5db060){if(_0x5db060){var _0x55ec9b=typeof _0x135498[_0x3930('0x15')]==='undefined'&&typeof _0x135498[_0x3930('0x16')]==='undefined';var _0x4113c4=_0x5db060[_0x3930('0x17')];var _0x5a1c39=_0x55ec9b?0x0:_0x135498['offset'];var _0x4b02b6=_0x55ec9b?_0x5db060[_0x3930('0x17')]:_0x135498[_0x3930('0x15')]+_0x135498[_0x3930('0x16')];var _0x5b5f55;if(_0x4b02b6>=_0x4113c4){_0x4b02b6=_0x4113c4;_0x5b5f55=0xc8;}else{_0x5b5f55=0xce;}_0x3bc35e['status'](_0x5b5f55);return _0x3bc35e['set']('Content-Range',_0x5a1c39+'-'+_0x4b02b6+'/'+_0x4113c4)[_0x3930('0x14')](_0x5db060);}return null;};}function patchUpdates(_0x2ba9ba){return function(_0x2e650d){try{jsonpatch[_0x3930('0x18')](_0x2e650d,_0x2ba9ba,!![]);}catch(_0x3d2a2f){return BPromise['reject'](_0x3d2a2f);}return _0x2e650d[_0x3930('0x19')]();};}function saveUpdates(_0x315f73,_0x1c5f4a){return function(_0x4a4307){if(_0x4a4307){return _0x4a4307[_0x3930('0x1a')](_0x315f73)[_0x3930('0x1b')](function(_0x12eeb7){return _0x12eeb7;});}return null;};}function removeEntity(_0x3a0e16,_0x2bcc3b){return function(_0x186e2e){if(_0x186e2e){return _0x186e2e[_0x3930('0x1c')]()[_0x3930('0x1b')](function(){_0x3a0e16['status'](0xcc)[_0x3930('0x1d')]();});}};}function handleEntityNotFound(_0x1dcdcd,_0x187453){return function(_0x11358e){if(!_0x11358e){_0x1dcdcd[_0x3930('0x12')](0x194);}return _0x11358e;};}function handleError(_0x5b4c56,_0x276940){_0x276940=_0x276940||0x1f4;return function(_0x7b6825){logger[_0x3930('0x1e')](_0x7b6825['stack']);if(_0x7b6825[_0x3930('0x1f')]){delete _0x7b6825[_0x3930('0x1f')];}_0x5b4c56[_0x3930('0x13')](_0x276940)[_0x3930('0x20')](_0x7b6825);};}exports[_0x3930('0x21')]=function(_0x575e76,_0x447d71){var _0x121cce={},_0xca904a={},_0x51ceb9={'count':0x0,'rows':[]};var _0x3b9168=_[_0x3930('0x22')](db[_0x3930('0x23')][_0x3930('0x24')],function(_0x11290d){return{'name':_0x11290d[_0x3930('0x25')],'type':_0x11290d[_0x3930('0x26')][_0x3930('0x27')]};});_0xca904a[_0x3930('0x28')]=_[_0x3930('0x22')](_0x3b9168,_0x3930('0x1f'));_0xca904a[_0x3930('0x29')]=_[_0x3930('0x2a')](_0x575e76[_0x3930('0x29')]);_0xca904a[_0x3930('0x2b')]=_[_0x3930('0x2c')](_0xca904a[_0x3930('0x28')],_0xca904a[_0x3930('0x29')]);_0x121cce[_0x3930('0x2d')]=_[_0x3930('0x2c')](_0xca904a['model'],qs['fields'](_0x575e76['query'][_0x3930('0x2e')]));_0x121cce[_0x3930('0x2d')]=_0x121cce['attributes'][_0x3930('0x2f')]?_0x121cce[_0x3930('0x2d')]:_0xca904a['model'];if(!_0x575e76[_0x3930('0x29')]['hasOwnProperty'](_0x3930('0x30'))){_0x121cce[_0x3930('0x16')]=qs[_0x3930('0x16')](_0x575e76[_0x3930('0x29')][_0x3930('0x16')]);_0x121cce[_0x3930('0x15')]=qs[_0x3930('0x15')](_0x575e76[_0x3930('0x29')][_0x3930('0x15')]);}_0x121cce[_0x3930('0x31')]=qs[_0x3930('0x32')](_0x575e76[_0x3930('0x29')][_0x3930('0x32')]);_0x121cce[_0x3930('0x33')]=qs[_0x3930('0x2b')](_[_0x3930('0x34')](_0x575e76['query'],_0xca904a[_0x3930('0x2b')]),_0x3b9168);if(_0x575e76['query'][_0x3930('0x35')]){_0x121cce['where']=_[_0x3930('0x36')](_0x121cce['where'],{'$or':_['map'](_0x3b9168,function(_0x37cb76){if(_0x37cb76[_0x3930('0x26')]!=='VIRTUAL'){var _0x4f1717={};_0x4f1717[_0x37cb76[_0x3930('0x1f')]]={'$like':'%'+_0x575e76['query'][_0x3930('0x35')]+'%'};return _0x4f1717;}})});}_0x121cce=_[_0x3930('0x36')]({},_0x121cce,_0x575e76[_0x3930('0x37')]);var _0x3a8c7e={'where':_0x121cce[_0x3930('0x33')]};return db[_0x3930('0x23')][_0x3930('0x17')](_0x3a8c7e)[_0x3930('0x1b')](function(_0x4d6a5b){_0x51ceb9['count']=_0x4d6a5b;if(_0x575e76[_0x3930('0x29')][_0x3930('0x38')]){_0x121cce['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x3930('0x39')](_0x121cce);})[_0x3930('0x1b')](function(_0x5cab01){_0x51ceb9['rows']=_0x5cab01;return _0x51ceb9;})['then'](respondWithFilteredResult(_0x447d71,_0x121cce))[_0x3930('0x3a')](handleError(_0x447d71,null));};exports[_0x3930('0x3b')]=function(_0x3ddc79,_0x1f9076){var _0x5cc6d8={'raw':!![],'where':{'id':_0x3ddc79[_0x3930('0x3c')]['id']}},_0x5e7718={};_0x5e7718['model']=_[_0x3930('0x2a')](db[_0x3930('0x23')]['rawAttributes']);_0x5e7718[_0x3930('0x29')]=_['keys'](_0x3ddc79[_0x3930('0x29')]);_0x5e7718[_0x3930('0x2b')]=_[_0x3930('0x2c')](_0x5e7718[_0x3930('0x28')],_0x5e7718[_0x3930('0x29')]);_0x5cc6d8[_0x3930('0x2d')]=_[_0x3930('0x2c')](_0x5e7718[_0x3930('0x28')],qs[_0x3930('0x2e')](_0x3ddc79[_0x3930('0x29')][_0x3930('0x2e')]));_0x5cc6d8[_0x3930('0x2d')]=_0x5cc6d8[_0x3930('0x2d')][_0x3930('0x2f')]?_0x5cc6d8[_0x3930('0x2d')]:_0x5e7718['model'];if(_0x3ddc79[_0x3930('0x29')][_0x3930('0x38')]){_0x5cc6d8[_0x3930('0x3d')]=[{'all':!![]}];}_0x5cc6d8=_[_0x3930('0x36')]({},_0x5cc6d8,_0x3ddc79[_0x3930('0x37')]);return db[_0x3930('0x23')]['find'](_0x5cc6d8)[_0x3930('0x1b')](handleEntityNotFound(_0x1f9076,null))[_0x3930('0x1b')](respondWithResult(_0x1f9076,null))[_0x3930('0x3a')](handleError(_0x1f9076,null));};exports[_0x3930('0x3e')]=function(_0x576beb,_0xc5d137){return db['ChatQueueReport'][_0x3930('0x3e')](_0x576beb['body'],{})['then'](respondWithResult(_0xc5d137,0xc9))[_0x3930('0x3a')](handleError(_0xc5d137,null));};exports[_0x3930('0x1a')]=function(_0x5cbb07,_0x2bdb26){if(_0x5cbb07[_0x3930('0x3f')]['id']){delete _0x5cbb07[_0x3930('0x3f')]['id'];}return db[_0x3930('0x23')]['find']({'where':{'id':_0x5cbb07[_0x3930('0x3c')]['id']}})[_0x3930('0x1b')](handleEntityNotFound(_0x2bdb26,null))[_0x3930('0x1b')](saveUpdates(_0x5cbb07[_0x3930('0x3f')],null))['then'](respondWithResult(_0x2bdb26,null))[_0x3930('0x3a')](handleError(_0x2bdb26,null));};exports[_0x3930('0x1c')]=function(_0x435735,_0x2efbb4){return db[_0x3930('0x23')][_0x3930('0x40')]({'where':{'id':_0x435735['params']['id']}})[_0x3930('0x1b')](handleEntityNotFound(_0x2efbb4,null))[_0x3930('0x1b')](removeEntity(_0x2efbb4,null))['catch'](handleError(_0x2efbb4,null));};exports[_0x3930('0x41')]=function(_0x5b2707,_0x28d074){return db[_0x3930('0x23')][_0x3930('0x41')]()[_0x3930('0x1b')](respondWithResult(_0x28d074,null))['catch'](handleError(_0x28d074,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 349b94e..5686701 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(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x12c944,_0x3a3a06){var _0xebfda5=function(_0x668806){while(--_0x668806){_0x12c944['push'](_0x12c944['shift']());}};_0xebfda5(++_0x3a3a06);}(_0x757a,0xde));var _0xa757=function(_0xb80757,_0x53340a){_0xb80757=_0xb80757-0x0;var _0x2daefe=_0x757a[_0xb80757];return _0x2daefe;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 84fd5dd..7dd3764 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 _0xeb79=['error','ChatQueueReport,\x20%s,\x20%s','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','debug','update','attributes','UpdateChatQueueReport','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x76baa8,_0xbc5f21){var _0xc6ca5f=function(_0x46a42c){while(--_0x46a42c){_0x76baa8['push'](_0x76baa8['shift']());}};_0xc6ca5f(++_0xbc5f21);}(_0xeb79,0x143));var _0x9eb7=function(_0x55732c,_0x4da144){_0x55732c=_0x55732c-0x0;var _0x24887a=_0xeb79[_0x55732c];return _0x24887a;};'use strict';var _=require(_0x9eb7('0x0'));var util=require(_0x9eb7('0x1'));var moment=require(_0x9eb7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9eb7('0x3'))['db'];var utils=require(_0x9eb7('0x4'));var logger=require(_0x9eb7('0x5'))('rpc');var config=require(_0x9eb7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9eb7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x276ee1,_0x4ed9a3,_0x43074d){return new BPromise(function(_0x39b77a,_0x7acd19){return client[_0x9eb7('0x8')](_0x276ee1,_0x43074d)['then'](function(_0xbd2855){logger[_0x9eb7('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x4ed9a3,_0x9eb7('0xa'));logger['debug'](_0x9eb7('0xb'),_0x4ed9a3,_0x9eb7('0xa'),JSON[_0x9eb7('0xc')](_0xbd2855));if(_0xbd2855['error']){if(_0xbd2855[_0x9eb7('0xd')]['code']===0x1f4){logger[_0x9eb7('0xd')](_0x9eb7('0xe'),_0x4ed9a3,_0xbd2855[_0x9eb7('0xd')][_0x9eb7('0xf')]);return _0x7acd19(_0xbd2855[_0x9eb7('0xd')][_0x9eb7('0xf')]);}logger[_0x9eb7('0xd')](_0x9eb7('0xe'),_0x4ed9a3,_0xbd2855[_0x9eb7('0xd')]['message']);return _0x39b77a(_0xbd2855[_0x9eb7('0xd')][_0x9eb7('0xf')]);}else{logger[_0x9eb7('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x4ed9a3,'request\x20sent');_0x39b77a(_0xbd2855['result']['message']);}})[_0x9eb7('0x10')](function(_0x172aa6){logger[_0x9eb7('0xd')](_0x9eb7('0xe'),_0x4ed9a3,_0x172aa6);_0x7acd19(_0x172aa6);});});}exports[_0x9eb7('0x11')]=function(_0x1bb1ae){var _0x57a19b=this;return new Promise(function(_0x4c1398,_0x304f44){return db[_0x9eb7('0x12')][_0x9eb7('0x13')](_0x1bb1ae[_0x9eb7('0x14')],{'raw':_0x1bb1ae[_0x9eb7('0x15')]?_0x1bb1ae[_0x9eb7('0x15')][_0x9eb7('0x16')]===undefined?!![]:![]:!![]})[_0x9eb7('0x17')](function(_0x4a13c1){logger[_0x9eb7('0x9')]('CreateChatQueueReport',_0x1bb1ae);logger[_0x9eb7('0x18')](_0x9eb7('0x11'),_0x1bb1ae,JSON[_0x9eb7('0xc')](_0x4a13c1));_0x4c1398(_0x4a13c1);})['catch'](function(_0xb940ca){logger[_0x9eb7('0xd')](_0x9eb7('0x11'),_0xb940ca[_0x9eb7('0xf')],_0x1bb1ae);_0x304f44(_0x57a19b['error'](0x1f4,_0xb940ca[_0x9eb7('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x3624f2){var _0x460cd1=this;return new Promise(function(_0x2e924e,_0x4aea1f){return db['ChatQueueReport'][_0x9eb7('0x19')](_0x3624f2[_0x9eb7('0x14')],{'raw':_0x3624f2['options']?_0x3624f2[_0x9eb7('0x15')][_0x9eb7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3624f2[_0x9eb7('0x15')]?_0x3624f2[_0x9eb7('0x15')]['where']||null:null,'attributes':_0x3624f2['options']?_0x3624f2[_0x9eb7('0x15')][_0x9eb7('0x1a')]||null:null,'limit':_0x3624f2[_0x9eb7('0x15')]?_0x3624f2[_0x9eb7('0x15')]['limit']||null:null})['then'](function(_0x3275ba){logger[_0x9eb7('0x9')](_0x9eb7('0x1b'),_0x3624f2);logger[_0x9eb7('0x18')](_0x9eb7('0x1b'),_0x3624f2,JSON[_0x9eb7('0xc')](_0x3275ba));_0x2e924e(_0x3275ba);})[_0x9eb7('0x10')](function(_0x27a553){logger[_0x9eb7('0xd')](_0x9eb7('0x1b'),_0x27a553['message'],_0x3624f2);_0x4aea1f(_0x460cd1[_0x9eb7('0xd')](0x1f4,_0x27a553[_0x9eb7('0xf')]));});});}; \ No newline at end of file +var _0x081c=['catch','ChatQueueReport','body','options','raw','CreateChatQueueReport','debug','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatQueueReport,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x081c,0xd7));var _0xc081=function(_0x416a3c,_0x481c83){_0x416a3c=_0x416a3c-0x0;var _0x2a055d=_0x081c[_0x416a3c];return _0x2a055d;};'use strict';var _=require(_0xc081('0x0'));var util=require(_0xc081('0x1'));var moment=require(_0xc081('0x2'));var BPromise=require(_0xc081('0x3'));var rs=require(_0xc081('0x4'));var fs=require('fs');var Redis=require(_0xc081('0x5'));var db=require(_0xc081('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc081('0x7'))(_0xc081('0x8'));var config=require(_0xc081('0x9'));var jayson=require(_0xc081('0xa'));var client=jayson[_0xc081('0xb')][_0xc081('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x85f165,_0x29539d,_0x16089f){return new BPromise(function(_0x43d6f3,_0x1cfbe2){return client[_0xc081('0xd')](_0x85f165,_0x16089f)[_0xc081('0xe')](function(_0x50e75a){logger[_0xc081('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x29539d,_0xc081('0x10'));logger['debug'](_0xc081('0x11'),_0x29539d,_0xc081('0x10'),JSON[_0xc081('0x12')](_0x50e75a));if(_0x50e75a['error']){if(_0x50e75a['error'][_0xc081('0x13')]===0x1f4){logger[_0xc081('0x14')](_0xc081('0x15'),_0x29539d,_0x50e75a['error'][_0xc081('0x16')]);return _0x1cfbe2(_0x50e75a[_0xc081('0x14')][_0xc081('0x16')]);}logger[_0xc081('0x14')](_0xc081('0x15'),_0x29539d,_0x50e75a[_0xc081('0x14')][_0xc081('0x16')]);return _0x43d6f3(_0x50e75a['error'][_0xc081('0x16')]);}else{logger[_0xc081('0xf')](_0xc081('0x15'),_0x29539d,'request\x20sent');_0x43d6f3(_0x50e75a['result'][_0xc081('0x16')]);}})[_0xc081('0x17')](function(_0x56e454){logger['error'](_0xc081('0x15'),_0x29539d,_0x56e454);_0x1cfbe2(_0x56e454);});});}exports['CreateChatQueueReport']=function(_0x529e49){var _0x3b0e22=this;return new Promise(function(_0x5c837a,_0x43ab94){return db[_0xc081('0x18')]['create'](_0x529e49[_0xc081('0x19')],{'raw':_0x529e49['options']?_0x529e49[_0xc081('0x1a')][_0xc081('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xb14a50){logger[_0xc081('0xf')](_0xc081('0x1c'),_0x529e49);logger[_0xc081('0x1d')](_0xc081('0x1c'),_0x529e49,JSON['stringify'](_0xb14a50));_0x5c837a(_0xb14a50);})[_0xc081('0x17')](function(_0x2ef1b3){logger['error'](_0xc081('0x1c'),_0x2ef1b3[_0xc081('0x16')],_0x529e49);_0x43ab94(_0x3b0e22['error'](0x1f4,_0x2ef1b3[_0xc081('0x16')]));});});};exports[_0xc081('0x1e')]=function(_0x29c0fa){var _0x5f5410=this;return new Promise(function(_0x33d506,_0x5aa45c){return db[_0xc081('0x18')]['update'](_0x29c0fa[_0xc081('0x19')],{'raw':_0x29c0fa[_0xc081('0x1a')]?_0x29c0fa['options'][_0xc081('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29c0fa['options']?_0x29c0fa['options'][_0xc081('0x1f')]||null:null,'attributes':_0x29c0fa[_0xc081('0x1a')]?_0x29c0fa[_0xc081('0x1a')][_0xc081('0x20')]||null:null,'limit':_0x29c0fa[_0xc081('0x1a')]?_0x29c0fa[_0xc081('0x1a')][_0xc081('0x21')]||null:null})[_0xc081('0xe')](function(_0x55d712){logger[_0xc081('0xf')](_0xc081('0x1e'),_0x29c0fa);logger[_0xc081('0x1d')](_0xc081('0x1e'),_0x29c0fa,JSON[_0xc081('0x12')](_0x55d712));_0x33d506(_0x55d712);})[_0xc081('0x17')](function(_0x1ad3ef){logger['error']('UpdateChatQueueReport',_0x1ad3ef[_0xc081('0x16')],_0x29c0fa);_0x5aa45c(_0x5f5410[_0xc081('0x14')](0x1f4,_0x1ad3ef['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index addb32f..60e1c02 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 _0x8516=['destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0x8516,0x131));var _0x6851=function(_0x21f843,_0x6e15b3){_0x21f843=_0x21f843-0x0;var _0x1ee7da=_0x8516[_0x21f843];return _0x1ee7da;};'use strict';var multer=require(_0x6851('0x0'));var util=require(_0x6851('0x1'));var path=require('path');var timeout=require(_0x6851('0x2'));var express=require('express');var router=express[_0x6851('0x3')]();var fs_extra=require(_0x6851('0x4'));var auth=require(_0x6851('0x5'));var interaction=require(_0x6851('0x6'));var config=require(_0x6851('0x7'));var controller=require(_0x6851('0x8'));router[_0x6851('0x9')]('/',auth[_0x6851('0xa')](),controller[_0x6851('0xb')]);router[_0x6851('0x9')]('/describe',auth[_0x6851('0xa')](),controller['describe']);router[_0x6851('0x9')](_0x6851('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6851('0xd')]('/',auth[_0x6851('0xa')](),controller['create']);router[_0x6851('0xe')]('/:id',auth[_0x6851('0xa')](),controller['update']);router['delete'](_0x6851('0xc'),auth[_0x6851('0xa')](),controller[_0x6851('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa319=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xa319,0x178));var _0x9a31=function(_0x1caf21,_0x48a169){_0x1caf21=_0x1caf21-0x0;var _0x55e77f=_0xa319[_0x1caf21];return _0x55e77f;};'use strict';var multer=require(_0x9a31('0x0'));var util=require(_0x9a31('0x1'));var path=require(_0x9a31('0x2'));var timeout=require(_0x9a31('0x3'));var express=require(_0x9a31('0x4'));var router=express[_0x9a31('0x5')]();var fs_extra=require(_0x9a31('0x6'));var auth=require(_0x9a31('0x7'));var interaction=require(_0x9a31('0x8'));var config=require('../../config/environment');var controller=require(_0x9a31('0x9'));router['get']('/',auth[_0x9a31('0xa')](),controller['index']);router[_0x9a31('0xb')](_0x9a31('0xc'),auth[_0x9a31('0xa')](),controller[_0x9a31('0xd')]);router[_0x9a31('0xb')](_0x9a31('0xe'),auth['isAuthenticated'](),controller[_0x9a31('0xf')]);router[_0x9a31('0x10')]('/',auth[_0x9a31('0xa')](),controller[_0x9a31('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9a31('0x12')]);router[_0x9a31('0x13')](_0x9a31('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a31('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 769881a..7055265 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4d73b1,_0x91ab71){var _0xe394f9=function(_0x47dd5d){while(--_0x47dd5d){_0x4d73b1['push'](_0x4d73b1['shift']());}};_0xe394f9(++_0x91ab71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x10f100,_0x20f3d3){var _0x51546e=function(_0x488217){while(--_0x488217){_0x10f100['push'](_0x10f100['shift']());}};_0x51546e(++_0x20f3d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 169a816..2462d6f 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 _0x6fc9=['length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','update','then','destroy','name','send','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields'];(function(_0xbb3ab4,_0x14a77d){var _0x3853f1=function(_0xbab961){while(--_0xbab961){_0xbb3ab4['push'](_0xbb3ab4['shift']());}};_0x3853f1(++_0x14a77d);}(_0x6fc9,0xf6));var _0x96fc=function(_0x422fac,_0x2e9a25){_0x422fac=_0x422fac-0x0;var _0x3fdf64=_0x6fc9[_0x422fac];return _0x3fdf64;};'use strict';var emlformat=require(_0x96fc('0x0'));var rimraf=require(_0x96fc('0x1'));var zipdir=require(_0x96fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96fc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x96fc('0x4'));var util=require(_0x96fc('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x96fc('0x6'));var ejs=require(_0x96fc('0x7'));var fs=require('fs');var fs_extra=require(_0x96fc('0x8'));var _=require('lodash');var squel=require(_0x96fc('0x9'));var crypto=require(_0x96fc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x96fc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x96fc('0xc'));var Papa=require(_0x96fc('0xd'));var Redis=require('ioredis');var authService=require(_0x96fc('0xe'));var qs=require(_0x96fc('0xf'));var as=require(_0x96fc('0x10'));var hardwareService=require(_0x96fc('0x11'));var logger=require(_0x96fc('0x12'))('api');var utils=require(_0x96fc('0x13'));var config=require(_0x96fc('0x14'));var licenseUtil=require(_0x96fc('0x15'));var db=require(_0x96fc('0x16'))['db'];function respondWithStatusCode(_0x9d6a3c,_0x3164d5){_0x3164d5=_0x3164d5||0xcc;return function(_0x1ffa86){if(_0x1ffa86){return _0x9d6a3c[_0x96fc('0x17')](_0x3164d5);}return _0x9d6a3c[_0x96fc('0x18')](_0x3164d5)[_0x96fc('0x19')]();};}function respondWithResult(_0x39319e,_0x16b1ac){_0x16b1ac=_0x16b1ac||0xc8;return function(_0xeff20d){if(_0xeff20d){return _0x39319e['status'](_0x16b1ac)['json'](_0xeff20d);}};}function respondWithFilteredResult(_0x645fa0,_0x5edb47){return function(_0xbd38d5){if(_0xbd38d5){var _0x54ce40=typeof _0x5edb47['offset']===_0x96fc('0x1a')&&typeof _0x5edb47[_0x96fc('0x1b')]===_0x96fc('0x1a');var _0x3fba66=_0xbd38d5[_0x96fc('0x1c')];var _0x212273=_0x54ce40?0x0:_0x5edb47[_0x96fc('0x1d')];var _0x1e733f=_0x54ce40?_0xbd38d5[_0x96fc('0x1c')]:_0x5edb47[_0x96fc('0x1d')]+_0x5edb47[_0x96fc('0x1b')];var _0x2f78ac;if(_0x1e733f>=_0x3fba66){_0x1e733f=_0x3fba66;_0x2f78ac=0xc8;}else{_0x2f78ac=0xce;}_0x645fa0[_0x96fc('0x18')](_0x2f78ac);return _0x645fa0[_0x96fc('0x1e')]('Content-Range',_0x212273+'-'+_0x1e733f+'/'+_0x3fba66)[_0x96fc('0x1f')](_0xbd38d5);}return null;};}function patchUpdates(_0x5a25cf){return function(_0x47bcaa){try{jsonpatch[_0x96fc('0x20')](_0x47bcaa,_0x5a25cf,!![]);}catch(_0x22b9da){return BPromise[_0x96fc('0x21')](_0x22b9da);}return _0x47bcaa['save']();};}function saveUpdates(_0x196fbb,_0x5a56f7){return function(_0x170fc1){if(_0x170fc1){return _0x170fc1[_0x96fc('0x22')](_0x196fbb)[_0x96fc('0x23')](function(_0x40bac6){return _0x40bac6;});}return null;};}function removeEntity(_0x202537,_0x362b93){return function(_0x14e382){if(_0x14e382){return _0x14e382[_0x96fc('0x24')]()[_0x96fc('0x23')](function(){_0x202537[_0x96fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x168a2a,_0x4265e3){return function(_0x1ff151){if(!_0x1ff151){_0x168a2a[_0x96fc('0x17')](0x194);}return _0x1ff151;};}function handleError(_0x363e9f,_0x45feed){_0x45feed=_0x45feed||0x1f4;return function(_0x4b37cb){logger['error'](_0x4b37cb['stack']);if(_0x4b37cb['name']){delete _0x4b37cb[_0x96fc('0x25')];}_0x363e9f[_0x96fc('0x18')](_0x45feed)[_0x96fc('0x26')](_0x4b37cb);};}exports['index']=function(_0x12c89f,_0x367fb3){var _0x42ef34={},_0x1ab3e1={},_0x2c8f83={'count':0x0,'rows':[]};var _0x3969f8=_[_0x96fc('0x27')](db[_0x96fc('0x28')][_0x96fc('0x29')],function(_0x5edc66){return{'name':_0x5edc66[_0x96fc('0x2a')],'type':_0x5edc66['type'][_0x96fc('0x2b')]};});_0x1ab3e1[_0x96fc('0x2c')]=_[_0x96fc('0x27')](_0x3969f8,_0x96fc('0x25'));_0x1ab3e1[_0x96fc('0x2d')]=_[_0x96fc('0x2e')](_0x12c89f['query']);_0x1ab3e1[_0x96fc('0x2f')]=_[_0x96fc('0x30')](_0x1ab3e1[_0x96fc('0x2c')],_0x1ab3e1[_0x96fc('0x2d')]);_0x42ef34['attributes']=_['intersection'](_0x1ab3e1[_0x96fc('0x2c')],qs[_0x96fc('0x31')](_0x12c89f[_0x96fc('0x2d')][_0x96fc('0x31')]));_0x42ef34['attributes']=_0x42ef34['attributes'][_0x96fc('0x32')]?_0x42ef34[_0x96fc('0x33')]:_0x1ab3e1[_0x96fc('0x2c')];if(!_0x12c89f['query'][_0x96fc('0x34')](_0x96fc('0x35'))){_0x42ef34[_0x96fc('0x1b')]=qs[_0x96fc('0x1b')](_0x12c89f['query'][_0x96fc('0x1b')]);_0x42ef34[_0x96fc('0x1d')]=qs['offset'](_0x12c89f[_0x96fc('0x2d')][_0x96fc('0x1d')]);}_0x42ef34[_0x96fc('0x36')]=qs[_0x96fc('0x37')](_0x12c89f[_0x96fc('0x2d')]['sort']);_0x42ef34[_0x96fc('0x38')]=qs[_0x96fc('0x2f')](_[_0x96fc('0x39')](_0x12c89f[_0x96fc('0x2d')],_0x1ab3e1[_0x96fc('0x2f')]),_0x3969f8);if(_0x12c89f[_0x96fc('0x2d')][_0x96fc('0x3a')]){_0x42ef34[_0x96fc('0x38')]=_[_0x96fc('0x3b')](_0x42ef34[_0x96fc('0x38')],{'$or':_[_0x96fc('0x27')](_0x3969f8,function(_0x510425){if(_0x510425[_0x96fc('0x3c')]!==_0x96fc('0x3d')){var _0x2520c5={};_0x2520c5[_0x510425[_0x96fc('0x25')]]={'$like':'%'+_0x12c89f[_0x96fc('0x2d')][_0x96fc('0x3a')]+'%'};return _0x2520c5;}})});}_0x42ef34=_['merge']({},_0x42ef34,_0x12c89f['options']);var _0x5be071={'where':_0x42ef34['where']};return db[_0x96fc('0x28')]['count'](_0x5be071)[_0x96fc('0x23')](function(_0x273dc3){_0x2c8f83[_0x96fc('0x1c')]=_0x273dc3;if(_0x12c89f[_0x96fc('0x2d')][_0x96fc('0x3e')]){_0x42ef34[_0x96fc('0x3f')]=[{'all':!![]}];}return db[_0x96fc('0x28')][_0x96fc('0x40')](_0x42ef34);})['then'](function(_0x33caaa){_0x2c8f83[_0x96fc('0x41')]=_0x33caaa;return _0x2c8f83;})[_0x96fc('0x23')](respondWithFilteredResult(_0x367fb3,_0x42ef34))[_0x96fc('0x42')](handleError(_0x367fb3,null));};exports[_0x96fc('0x43')]=function(_0x179418,_0x5826de){var _0x54a324={'raw':!![],'where':{'id':_0x179418[_0x96fc('0x44')]['id']}},_0x243101={};_0x243101[_0x96fc('0x2c')]=_[_0x96fc('0x2e')](db[_0x96fc('0x28')]['rawAttributes']);_0x243101['query']=_['keys'](_0x179418[_0x96fc('0x2d')]);_0x243101[_0x96fc('0x2f')]=_[_0x96fc('0x30')](_0x243101[_0x96fc('0x2c')],_0x243101[_0x96fc('0x2d')]);_0x54a324[_0x96fc('0x33')]=_[_0x96fc('0x30')](_0x243101[_0x96fc('0x2c')],qs['fields'](_0x179418['query'][_0x96fc('0x31')]));_0x54a324['attributes']=_0x54a324[_0x96fc('0x33')][_0x96fc('0x32')]?_0x54a324[_0x96fc('0x33')]:_0x243101[_0x96fc('0x2c')];if(_0x179418[_0x96fc('0x2d')][_0x96fc('0x3e')]){_0x54a324[_0x96fc('0x3f')]=[{'all':!![]}];}_0x54a324=_['merge']({},_0x54a324,_0x179418[_0x96fc('0x45')]);return db[_0x96fc('0x28')][_0x96fc('0x46')](_0x54a324)[_0x96fc('0x23')](handleEntityNotFound(_0x5826de,null))['then'](respondWithResult(_0x5826de,null))[_0x96fc('0x42')](handleError(_0x5826de,null));};exports[_0x96fc('0x47')]=function(_0x345bd3,_0x1d95c8){return db[_0x96fc('0x28')][_0x96fc('0x47')](_0x345bd3[_0x96fc('0x48')],{})[_0x96fc('0x23')](respondWithResult(_0x1d95c8,0xc9))[_0x96fc('0x42')](handleError(_0x1d95c8,null));};exports[_0x96fc('0x22')]=function(_0x42e41e,_0x19a921){if(_0x42e41e['body']['id']){delete _0x42e41e[_0x96fc('0x48')]['id'];}return db[_0x96fc('0x28')][_0x96fc('0x46')]({'where':{'id':_0x42e41e['params']['id']}})['then'](handleEntityNotFound(_0x19a921,null))['then'](saveUpdates(_0x42e41e[_0x96fc('0x48')],null))[_0x96fc('0x23')](respondWithResult(_0x19a921,null))[_0x96fc('0x42')](handleError(_0x19a921,null));};exports['destroy']=function(_0x4f8730,_0x34bb95){return db['ChatTransferReport'][_0x96fc('0x46')]({'where':{'id':_0x4f8730[_0x96fc('0x44')]['id']}})[_0x96fc('0x23')](handleEntityNotFound(_0x34bb95,null))[_0x96fc('0x23')](removeEntity(_0x34bb95,null))['catch'](handleError(_0x34bb95,null));};exports[_0x96fc('0x49')]=function(_0xe58152,_0xe803ae){return db[_0x96fc('0x28')][_0x96fc('0x49')]()[_0x96fc('0x23')](respondWithResult(_0xe803ae,null))['catch'](handleError(_0xe803ae,null));}; \ No newline at end of file +var _0xc1e0=['update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc1e0,0xe7));var _0x0c1e=function(_0x29059d,_0x332387){_0x29059d=_0x29059d-0x0;var _0x4d5f08=_0xc1e0[_0x29059d];return _0x4d5f08;};'use strict';var emlformat=require(_0x0c1e('0x0'));var rimraf=require(_0x0c1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c1e('0x2'));var rp=require(_0x0c1e('0x3'));var moment=require(_0x0c1e('0x4'));var BPromise=require(_0x0c1e('0x5'));var Mustache=require('mustache');var util=require(_0x0c1e('0x6'));var path=require(_0x0c1e('0x7'));var sox=require(_0x0c1e('0x8'));var csv=require(_0x0c1e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c1e('0xa'));var _=require(_0x0c1e('0xb'));var squel=require('squel');var crypto=require(_0x0c1e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0c1e('0xd'));var Redis=require(_0x0c1e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0c1e('0xf'));var as=require(_0x0c1e('0x10'));var hardwareService=require(_0x0c1e('0x11'));var logger=require('../../config/logger')(_0x0c1e('0x12'));var utils=require(_0x0c1e('0x13'));var config=require(_0x0c1e('0x14'));var licenseUtil=require(_0x0c1e('0x15'));var db=require(_0x0c1e('0x16'))['db'];function respondWithStatusCode(_0x7639cf,_0x129851){_0x129851=_0x129851||0xcc;return function(_0x789fc0){if(_0x789fc0){return _0x7639cf[_0x0c1e('0x17')](_0x129851);}return _0x7639cf[_0x0c1e('0x18')](_0x129851)[_0x0c1e('0x19')]();};}function respondWithResult(_0x54b1ec,_0x4017cd){_0x4017cd=_0x4017cd||0xc8;return function(_0x2fd6e4){if(_0x2fd6e4){return _0x54b1ec['status'](_0x4017cd)[_0x0c1e('0x1a')](_0x2fd6e4);}};}function respondWithFilteredResult(_0x53f9a3,_0x4db2de){return function(_0x1425da){if(_0x1425da){var _0x44e94c=typeof _0x4db2de['offset']===_0x0c1e('0x1b')&&typeof _0x4db2de['limit']===_0x0c1e('0x1b');var _0x5dcdc2=_0x1425da['count'];var _0x4ba793=_0x44e94c?0x0:_0x4db2de['offset'];var _0x2a1ff3=_0x44e94c?_0x1425da[_0x0c1e('0x1c')]:_0x4db2de['offset']+_0x4db2de[_0x0c1e('0x1d')];var _0x3ce25e;if(_0x2a1ff3>=_0x5dcdc2){_0x2a1ff3=_0x5dcdc2;_0x3ce25e=0xc8;}else{_0x3ce25e=0xce;}_0x53f9a3[_0x0c1e('0x18')](_0x3ce25e);return _0x53f9a3['set'](_0x0c1e('0x1e'),_0x4ba793+'-'+_0x2a1ff3+'/'+_0x5dcdc2)[_0x0c1e('0x1a')](_0x1425da);}return null;};}function patchUpdates(_0x213562){return function(_0x1fdc9b){try{jsonpatch[_0x0c1e('0x1f')](_0x1fdc9b,_0x213562,!![]);}catch(_0x42b13d){return BPromise[_0x0c1e('0x20')](_0x42b13d);}return _0x1fdc9b[_0x0c1e('0x21')]();};}function saveUpdates(_0x18e1c2,_0x4a67ad){return function(_0x3753fe){if(_0x3753fe){return _0x3753fe['update'](_0x18e1c2)[_0x0c1e('0x22')](function(_0x484eee){return _0x484eee;});}return null;};}function removeEntity(_0xa127db,_0xc4ef8e){return function(_0x174119){if(_0x174119){return _0x174119[_0x0c1e('0x23')]()[_0x0c1e('0x22')](function(){_0xa127db['status'](0xcc)[_0x0c1e('0x19')]();});}};}function handleEntityNotFound(_0xeb7dde,_0x557c59){return function(_0x5b8619){if(!_0x5b8619){_0xeb7dde[_0x0c1e('0x17')](0x194);}return _0x5b8619;};}function handleError(_0x472130,_0x20f02b){_0x20f02b=_0x20f02b||0x1f4;return function(_0xcbf211){logger[_0x0c1e('0x24')](_0xcbf211['stack']);if(_0xcbf211[_0x0c1e('0x25')]){delete _0xcbf211[_0x0c1e('0x25')];}_0x472130[_0x0c1e('0x18')](_0x20f02b)[_0x0c1e('0x26')](_0xcbf211);};}exports[_0x0c1e('0x27')]=function(_0x312a34,_0xd1d45e){var _0x473da9={},_0x36e5b8={},_0x2fcade={'count':0x0,'rows':[]};var _0x414bfe=_['map'](db[_0x0c1e('0x28')][_0x0c1e('0x29')],function(_0x52dbc6){return{'name':_0x52dbc6[_0x0c1e('0x2a')],'type':_0x52dbc6[_0x0c1e('0x2b')][_0x0c1e('0x2c')]};});_0x36e5b8['model']=_[_0x0c1e('0x2d')](_0x414bfe,'name');_0x36e5b8[_0x0c1e('0x2e')]=_[_0x0c1e('0x2f')](_0x312a34[_0x0c1e('0x2e')]);_0x36e5b8['filters']=_[_0x0c1e('0x30')](_0x36e5b8['model'],_0x36e5b8[_0x0c1e('0x2e')]);_0x473da9[_0x0c1e('0x31')]=_[_0x0c1e('0x30')](_0x36e5b8['model'],qs[_0x0c1e('0x32')](_0x312a34[_0x0c1e('0x2e')]['fields']));_0x473da9[_0x0c1e('0x31')]=_0x473da9[_0x0c1e('0x31')][_0x0c1e('0x33')]?_0x473da9[_0x0c1e('0x31')]:_0x36e5b8[_0x0c1e('0x34')];if(!_0x312a34[_0x0c1e('0x2e')][_0x0c1e('0x35')](_0x0c1e('0x36'))){_0x473da9[_0x0c1e('0x1d')]=qs['limit'](_0x312a34[_0x0c1e('0x2e')]['limit']);_0x473da9[_0x0c1e('0x37')]=qs['offset'](_0x312a34['query'][_0x0c1e('0x37')]);}_0x473da9[_0x0c1e('0x38')]=qs['sort'](_0x312a34[_0x0c1e('0x2e')][_0x0c1e('0x39')]);_0x473da9[_0x0c1e('0x3a')]=qs[_0x0c1e('0x3b')](_[_0x0c1e('0x3c')](_0x312a34[_0x0c1e('0x2e')],_0x36e5b8[_0x0c1e('0x3b')]),_0x414bfe);if(_0x312a34[_0x0c1e('0x2e')][_0x0c1e('0x3d')]){_0x473da9[_0x0c1e('0x3a')]=_[_0x0c1e('0x3e')](_0x473da9['where'],{'$or':_[_0x0c1e('0x2d')](_0x414bfe,function(_0xce21fd){if(_0xce21fd[_0x0c1e('0x2b')]!==_0x0c1e('0x3f')){var _0xf712ac={};_0xf712ac[_0xce21fd[_0x0c1e('0x25')]]={'$like':'%'+_0x312a34['query'][_0x0c1e('0x3d')]+'%'};return _0xf712ac;}})});}_0x473da9=_[_0x0c1e('0x3e')]({},_0x473da9,_0x312a34[_0x0c1e('0x40')]);var _0x11a4ba={'where':_0x473da9[_0x0c1e('0x3a')]};return db[_0x0c1e('0x28')][_0x0c1e('0x1c')](_0x11a4ba)['then'](function(_0x443cdb){_0x2fcade[_0x0c1e('0x1c')]=_0x443cdb;if(_0x312a34[_0x0c1e('0x2e')][_0x0c1e('0x41')]){_0x473da9[_0x0c1e('0x42')]=[{'all':!![]}];}return db[_0x0c1e('0x28')][_0x0c1e('0x43')](_0x473da9);})[_0x0c1e('0x22')](function(_0x2c5b6d){_0x2fcade[_0x0c1e('0x44')]=_0x2c5b6d;return _0x2fcade;})[_0x0c1e('0x22')](respondWithFilteredResult(_0xd1d45e,_0x473da9))[_0x0c1e('0x45')](handleError(_0xd1d45e,null));};exports[_0x0c1e('0x46')]=function(_0x276062,_0x1aa175){var _0x11038d={'raw':!![],'where':{'id':_0x276062['params']['id']}},_0x5738d0={};_0x5738d0[_0x0c1e('0x34')]=_['keys'](db[_0x0c1e('0x28')][_0x0c1e('0x29')]);_0x5738d0['query']=_[_0x0c1e('0x2f')](_0x276062[_0x0c1e('0x2e')]);_0x5738d0[_0x0c1e('0x3b')]=_[_0x0c1e('0x30')](_0x5738d0[_0x0c1e('0x34')],_0x5738d0[_0x0c1e('0x2e')]);_0x11038d['attributes']=_[_0x0c1e('0x30')](_0x5738d0[_0x0c1e('0x34')],qs[_0x0c1e('0x32')](_0x276062['query']['fields']));_0x11038d['attributes']=_0x11038d['attributes'][_0x0c1e('0x33')]?_0x11038d[_0x0c1e('0x31')]:_0x5738d0[_0x0c1e('0x34')];if(_0x276062[_0x0c1e('0x2e')][_0x0c1e('0x41')]){_0x11038d['include']=[{'all':!![]}];}_0x11038d=_[_0x0c1e('0x3e')]({},_0x11038d,_0x276062[_0x0c1e('0x40')]);return db[_0x0c1e('0x28')][_0x0c1e('0x47')](_0x11038d)[_0x0c1e('0x22')](handleEntityNotFound(_0x1aa175,null))[_0x0c1e('0x22')](respondWithResult(_0x1aa175,null))[_0x0c1e('0x45')](handleError(_0x1aa175,null));};exports['create']=function(_0x1393d7,_0x540176){return db['ChatTransferReport']['create'](_0x1393d7[_0x0c1e('0x48')],{})[_0x0c1e('0x22')](respondWithResult(_0x540176,0xc9))['catch'](handleError(_0x540176,null));};exports[_0x0c1e('0x49')]=function(_0x5d960b,_0x53dbb0){if(_0x5d960b[_0x0c1e('0x48')]['id']){delete _0x5d960b['body']['id'];}return db['ChatTransferReport'][_0x0c1e('0x47')]({'where':{'id':_0x5d960b[_0x0c1e('0x4a')]['id']}})[_0x0c1e('0x22')](handleEntityNotFound(_0x53dbb0,null))[_0x0c1e('0x22')](saveUpdates(_0x5d960b[_0x0c1e('0x48')],null))[_0x0c1e('0x22')](respondWithResult(_0x53dbb0,null))[_0x0c1e('0x45')](handleError(_0x53dbb0,null));};exports['destroy']=function(_0x6a2a71,_0x1c7ebf){return db[_0x0c1e('0x28')][_0x0c1e('0x47')]({'where':{'id':_0x6a2a71[_0x0c1e('0x4a')]['id']}})[_0x0c1e('0x22')](handleEntityNotFound(_0x1c7ebf,null))[_0x0c1e('0x22')](removeEntity(_0x1c7ebf,null))['catch'](handleError(_0x1c7ebf,null));};exports[_0x0c1e('0x4b')]=function(_0x28f79d,_0x39a969){return db[_0x0c1e('0x28')][_0x0c1e('0x4b')]()[_0x0c1e('0x22')](respondWithResult(_0x39a969,null))[_0x0c1e('0x45')](handleError(_0x39a969,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 761ab56..d8ec4cc 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 _0xa538=['moment','bluebird','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','api'];(function(_0x3509b9,_0x38bb75){var _0x11704f=function(_0x37a435){while(--_0x37a435){_0x3509b9['push'](_0x3509b9['shift']());}};_0x11704f(++_0x38bb75);}(_0xa538,0xb2));var _0x8a53=function(_0x31c1d9,_0xf3b483){_0x31c1d9=_0x31c1d9-0x0;var _0x2ccc8d=_0xa538[_0x31c1d9];return _0x2ccc8d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8a53('0x0'))(_0x8a53('0x1'));var moment=require(_0x8a53('0x2'));var BPromise=require(_0x8a53('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a53('0x4'));var rimraf=require('rimraf');var config=require(_0x8a53('0x5'));var attributes=require(_0x8a53('0x6'));module[_0x8a53('0x7')]=function(_0x20a7f3,_0x2db190){return _0x20a7f3[_0x8a53('0x8')](_0x8a53('0x9'),attributes,{'tableName':_0x8a53('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8a53('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xebe3=['./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','../../config/environment'];(function(_0x3165c0,_0x429078){var _0x5d7e16=function(_0x184539){while(--_0x184539){_0x3165c0['push'](_0x3165c0['shift']());}};_0x5d7e16(++_0x429078);}(_0xebe3,0x73));var _0x3ebe=function(_0x4211f6,_0x4934e6){_0x4211f6=_0x4211f6-0x0;var _0x1253f2=_0xebe3[_0x4211f6];return _0x1253f2;};'use strict';var _=require(_0x3ebe('0x0'));var util=require(_0x3ebe('0x1'));var logger=require('../../config/logger')(_0x3ebe('0x2'));var moment=require(_0x3ebe('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(_0x3ebe('0x4'));var attributes=require(_0x3ebe('0x5'));module['exports']=function(_0x57ea6f,_0x39b3e3){return _0x57ea6f[_0x3ebe('0x6')](_0x3ebe('0x7'),attributes,{'tableName':_0x3ebe('0x8'),'paranoid':![],'indexes':[{'name':_0x3ebe('0x9'),'fields':[_0x3ebe('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0751149..c9a73d3 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 _0x9c44=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c44,0xf1));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x49c4('0x0'));var util=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rs=require(_0x49c4('0x4'));var fs=require('fs');var Redis=require(_0x49c4('0x5'));var db=require(_0x49c4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x49c4('0x7'))('rpc');var config=require(_0x49c4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x9')][_0x49c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bbcb7,_0x2ca38b,_0x4a48dd){return new BPromise(function(_0x26dba2,_0x2b5f93){return client[_0x49c4('0xb')](_0x1bbcb7,_0x4a48dd)[_0x49c4('0xc')](function(_0x227492){logger[_0x49c4('0xd')](_0x49c4('0xe'),_0x2ca38b,_0x49c4('0xf'));logger[_0x49c4('0x10')](_0x49c4('0x11'),_0x2ca38b,'request\x20sent',JSON['stringify'](_0x227492));if(_0x227492[_0x49c4('0x12')]){if(_0x227492[_0x49c4('0x12')][_0x49c4('0x13')]===0x1f4){logger['error'](_0x49c4('0xe'),_0x2ca38b,_0x227492[_0x49c4('0x12')][_0x49c4('0x14')]);return _0x2b5f93(_0x227492[_0x49c4('0x12')]['message']);}logger[_0x49c4('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2ca38b,_0x227492['error'][_0x49c4('0x14')]);return _0x26dba2(_0x227492[_0x49c4('0x12')]['message']);}else{logger[_0x49c4('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x2ca38b,_0x49c4('0xf'));_0x26dba2(_0x227492[_0x49c4('0x15')][_0x49c4('0x14')]);}})['catch'](function(_0x3dac25){logger[_0x49c4('0x12')](_0x49c4('0xe'),_0x2ca38b,_0x3dac25);_0x2b5f93(_0x3dac25);});});} \ No newline at end of file +var _0x0aae=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0aae,0xb9));var _0xe0aa=function(_0x513c0c,_0x3fc365){_0x513c0c=_0x513c0c-0x0;var _0x5ee35b=_0x0aae[_0x513c0c];return _0x5ee35b;};'use strict';var _=require('lodash');var util=require(_0xe0aa('0x0'));var moment=require(_0xe0aa('0x1'));var BPromise=require(_0xe0aa('0x2'));var rs=require(_0xe0aa('0x3'));var fs=require('fs');var Redis=require(_0xe0aa('0x4'));var db=require(_0xe0aa('0x5'))['db'];var utils=require(_0xe0aa('0x6'));var logger=require('../../config/logger')(_0xe0aa('0x7'));var config=require(_0xe0aa('0x8'));var jayson=require(_0xe0aa('0x9'));var client=jayson[_0xe0aa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x320a2d,_0x186392,_0x5afb10){return new BPromise(function(_0x1919ab,_0x2b2920){return client['request'](_0x320a2d,_0x5afb10)[_0xe0aa('0xb')](function(_0x3d1118){logger[_0xe0aa('0xc')](_0xe0aa('0xd'),_0x186392,_0xe0aa('0xe'));logger[_0xe0aa('0xf')](_0xe0aa('0x10'),_0x186392,_0xe0aa('0xe'),JSON[_0xe0aa('0x11')](_0x3d1118));if(_0x3d1118[_0xe0aa('0x12')]){if(_0x3d1118[_0xe0aa('0x12')]['code']===0x1f4){logger[_0xe0aa('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x186392,_0x3d1118[_0xe0aa('0x12')]['message']);return _0x2b2920(_0x3d1118[_0xe0aa('0x12')][_0xe0aa('0x13')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x186392,_0x3d1118[_0xe0aa('0x12')][_0xe0aa('0x13')]);return _0x1919ab(_0x3d1118[_0xe0aa('0x12')][_0xe0aa('0x13')]);}else{logger['info'](_0xe0aa('0xd'),_0x186392,'request\x20sent');_0x1919ab(_0x3d1118[_0xe0aa('0x14')][_0xe0aa('0x13')]);}})[_0xe0aa('0x15')](function(_0xaa4fa5){logger[_0xe0aa('0x12')](_0xe0aa('0xd'),_0x186392,_0xaa4fa5);_0x2b2920(_0xaa4fa5);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ea1851e..6c4b556 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 _0xbd7b=['/describe','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0x142733,_0x19bf15){var _0xd17009=function(_0x1db652){while(--_0x1db652){_0x142733['push'](_0x142733['shift']());}};_0xd17009(++_0x19bf15);}(_0xbd7b,0x10c));var _0xbbd7=function(_0x5303a2,_0x49716b){_0x5303a2=_0x5303a2-0x0;var _0x448ac5=_0xbd7b[_0x5303a2];return _0x448ac5;};'use strict';var multer=require(_0xbbd7('0x0'));var util=require('util');var path=require(_0xbbd7('0x1'));var timeout=require(_0xbbd7('0x2'));var express=require(_0xbbd7('0x3'));var router=express[_0xbbd7('0x4')]();var fs_extra=require(_0xbbd7('0x5'));var auth=require(_0xbbd7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd7('0x7'));var controller=require(_0xbbd7('0x8'));router[_0xbbd7('0x9')]('/',auth[_0xbbd7('0xa')](),controller[_0xbbd7('0xb')]);router[_0xbbd7('0x9')](_0xbbd7('0xc'),auth[_0xbbd7('0xa')](),controller['describe']);router[_0xbbd7('0x9')](_0xbbd7('0xd'),auth[_0xbbd7('0xa')](),controller['show']);router[_0xbbd7('0xe')]('/',auth[_0xbbd7('0xa')](),controller[_0xbbd7('0xf')]);router[_0xbbd7('0x10')](_0xbbd7('0xd'),auth[_0xbbd7('0xa')](),controller['update']);router[_0xbbd7('0x11')](_0xbbd7('0xd'),auth[_0xbbd7('0xa')](),controller[_0xbbd7('0x12')]);module[_0xbbd7('0x13')]=router; \ No newline at end of file +var _0x16c1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','create','update','delete','destroy','multer','path'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x16c1,0xe8));var _0x116c=function(_0x2bdc70,_0x4464f9){_0x2bdc70=_0x2bdc70-0x0;var _0x5494ac=_0x16c1[_0x2bdc70];return _0x5494ac;};'use strict';var multer=require(_0x116c('0x0'));var util=require('util');var path=require(_0x116c('0x1'));var timeout=require(_0x116c('0x2'));var express=require(_0x116c('0x3'));var router=express[_0x116c('0x4')]();var fs_extra=require(_0x116c('0x5'));var auth=require(_0x116c('0x6'));var interaction=require(_0x116c('0x7'));var config=require('../../config/environment');var controller=require(_0x116c('0x8'));router[_0x116c('0x9')]('/',auth[_0x116c('0xa')](),controller['index']);router[_0x116c('0x9')](_0x116c('0xb'),auth[_0x116c('0xa')](),controller[_0x116c('0xc')]);router[_0x116c('0x9')](_0x116c('0xd'),auth[_0x116c('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x116c('0xe')]);router['put'](_0x116c('0xd'),auth[_0x116c('0xa')](),controller[_0x116c('0xf')]);router[_0x116c('0x10')](_0x116c('0xd'),auth['isAuthenticated'](),controller[_0x116c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 97fc5e1..a61fd32 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 _0x5542=['All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Type\x20a\x20message','Skip','star','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate'];(function(_0x417955,_0x4ed8c8){var _0x3a94ef=function(_0xa3a38d){while(--_0xa3a38d){_0x417955['push'](_0x417955['shift']());}};_0x3a94ef(++_0x4ed8c8);}(_0x5542,0xcf));var _0x2554=function(_0x2a557a,_0x585b4a){_0x2a557a=_0x2a557a-0x0;var _0x439f83=_0x5542[_0x2a557a];return _0x439f83;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2554('0x0'));module[_0x2554('0x1')]={'name':{'type':Sequelize[_0x2554('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x2554('0x2')],'allowNull':![],'unique':_0x2554('0x3')},'description':{'type':Sequelize[_0x2554('0x2')]},'mapKey':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x4')},'mapKeyOffline':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x4')},'key':{'type':Sequelize[_0x2554('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x2554('0x5')},'customerAlias':{'type':Sequelize[_0x2554('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2554('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2554('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2554('0x2')],'allowNull':![],'defaultValue':_0x2554('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x2554('0x2')],'allowNull':![],'defaultValue':_0x2554('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2554('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2554('0x2')]},'animation':{'type':Sequelize[_0x2554('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2554('0xa')](_0x2554('0xb'),_0x2554('0xc')),'defaultValue':_0x2554('0xb')},'header_online':{'type':Sequelize[_0x2554('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0xd')},'offline_chat_button':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0xe')},'header_offline':{'type':Sequelize[_0x2554('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2554('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x2554('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x2554('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2554('0x10')]},'closingQuestion':{'type':Sequelize[_0x2554('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x11')},'noteTitle':{'type':Sequelize[_0x2554('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x2554('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x13')},'conditionAgreement':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2554('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x2554('0xa')](_0x2554('0x14'),'thumb'),'defaultValue':_0x2554('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x2554('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2554('0x10')],'defaultValue':function(){return JSON[_0x2554('0x15')]({'items':[{'type':_0x2554('0x16'),'variable':null,'config':{'placeholder':_0x2554('0x17'),'type':'text','required':!![]},'props':{'title':_0x2554('0x17'),'helpText':''}},{'type':'input','props':{'title':_0x2554('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x2554('0x4'),'type':_0x2554('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2554('0x18')](_0x2554('0x19'))?JSON[_0x2554('0x1a')](this[_0x2554('0x18')](_0x2554('0x19'))):{};},'set':function(_0x4d650b){return this[_0x2554('0x1b')](_0x2554('0x19'),JSON['stringify'](_0x4d650b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x2554('0x15')]({'items':[{'type':_0x2554('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2554('0x4'),'type':_0x2554('0x4')},'variable':null},{'type':_0x2554('0x1c'),'config':{'placeholder':_0x2554('0x1d')},'props':{'title':'Comments','helpText':_0x2554('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0x2554('0x18')](_0x2554('0x1f'))?JSON[_0x2554('0x1a')](this[_0x2554('0x18')]('offlineForm')):{};},'set':function(_0xa98fb1){return this[_0x2554('0x1b')](_0x2554('0x1f'),JSON[_0x2554('0x15')](_0xa98fb1));}},'token':{'type':Sequelize[_0x2554('0x2')],'defaultValue':function(){return rs[_0x2554('0x20')]();}},'autoclose':{'type':Sequelize[_0x2554('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2554('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2554('0x2')]},'waitingTitle':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x21')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2554('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x23')},'offlineMessageBody':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x2554('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x25')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2554('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2554('0x10')],'defaultValue':function(){return _0x2554('0x26');}},'notificationSound':{'type':Sequelize[_0x2554('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2554('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x27')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x28')},'messagesAlignment':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x29')},'defaultTitle':{'type':Sequelize[_0x2554('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2554('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2554('0x2')],'allowNull':![],'defaultValue':_0x2554('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2554('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2554('0x2')],'defaultValue':_0x2554('0x2b')},'systemAvatar':{'type':Sequelize[_0x2554('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2554('0x8')],'comment':_0x2554('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2554('0x2d'),'set':function(_0x181292){if(!_0x181292)this[_0x2554('0x1b')]('mandatoryDispositionPauseId',null);this[_0x2554('0x1b')]('mandatoryDisposition',_0x181292);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2554('0x2')]},'vidaooTopic':{'type':Sequelize[_0x2554('0x2')],'allowNull':![],'defaultValue':_0x2554('0x2e')},'vidaooNote':{'type':Sequelize[_0x2554('0x2')],'defaultValue':function(){return _0x2554('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x2554('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2554('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2554('0x10')]}}; \ No newline at end of file +var _0x18c0=['Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','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.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message'];(function(_0x36befb,_0x12559c){var _0x479e63=function(_0x3a1f39){while(--_0x3a1f39){_0x36befb['push'](_0x36befb['shift']());}};_0x479e63(++_0x12559c);}(_0x18c0,0x174));var _0x018c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x18c0[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x018c('0x0'));var rs=require(_0x018c('0x1'));module[_0x018c('0x2')]={'name':{'type':Sequelize[_0x018c('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x018c('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x018c('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x018c('0x3')],'allowNull':![],'defaultValue':_0x018c('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x018c('0x3')],'allowNull':![],'defaultValue':_0x018c('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x018c('0x3')],'allowNull':![],'defaultValue':_0x018c('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x018c('0x3')],'allowNull':![],'defaultValue':_0x018c('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x018c('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x018c('0x3')]},'animation':{'type':Sequelize[_0x018c('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x018c('0x9')](_0x018c('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0xb')},'offline_chat_button':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0xd')},'download_transcript':{'type':Sequelize[_0x018c('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x018c('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x018c('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x018c('0xf')]},'closingQuestion':{'type':Sequelize[_0x018c('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0x11')},'noteTitle':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0x13')},'closingMessage':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0x14')},'closingMessageButton':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x018c('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x018c('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0x15')},'ratingType':{'type':Sequelize[_0x018c('0x9')](_0x018c('0x16'),_0x018c('0x17')),'defaultValue':_0x018c('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x018c('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x018c('0x18')]({'items':[{'type':_0x018c('0x19'),'variable':null,'config':{'placeholder':_0x018c('0x1a'),'type':'text','required':!![]},'props':{'title':_0x018c('0x1a'),'helpText':''}},{'type':_0x018c('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x018c('0x4'),'type':_0x018c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x018c('0x1b')](_0x018c('0x1c'))?JSON[_0x018c('0x1d')](this[_0x018c('0x1b')]('onlineForm')):{};},'set':function(_0xa88043){return this[_0x018c('0x1e')]('onlineForm',JSON['stringify'](_0xa88043));}},'offlineForm':{'type':Sequelize[_0x018c('0xf')],'defaultValue':function(){return JSON[_0x018c('0x18')]({'items':[{'type':'input','props':{'title':_0x018c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x018c('0x4'),'type':_0x018c('0x4')},'variable':null},{'type':_0x018c('0x1f'),'config':{'placeholder':_0x018c('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x018c('0x1b')](_0x018c('0x21'))?JSON['parse'](this['getDataValue'](_0x018c('0x21'))):{};},'set':function(_0x578da3){return this[_0x018c('0x1e')](_0x018c('0x21'),JSON[_0x018c('0x18')](_0x578da3));}},'token':{'type':Sequelize[_0x018c('0x3')],'defaultValue':function(){return rs[_0x018c('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x018c('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x018c('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x018c('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0x26')},'skipUnmanaged':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0x27')},'sendUnmanaged':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x018c('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x018c('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x018c('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[_0x018c('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x018c('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x018c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x018c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0x28')},'verticalAlignment':{'type':Sequelize[_0x018c('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x018c('0x29')},'messagesAlignment':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0x2a')},'defaultTitle':{'type':Sequelize[_0x018c('0x3')]},'customerAvatar':{'type':Sequelize[_0x018c('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x018c('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x018c('0x3')],'allowNull':![],'defaultValue':_0x018c('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x018c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x018c('0x3')],'defaultValue':_0x018c('0x2c')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x018c('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x018c('0x8')],'defaultValue':![],'comment':_0x018c('0x2d'),'set':function(_0x5a6d80){if(!_0x5a6d80)this[_0x018c('0x1e')](_0x018c('0x2e'),null);this[_0x018c('0x1e')](_0x018c('0x2f'),_0x5a6d80);}},'vidaooEscalation':{'type':Sequelize[_0x018c('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x018c('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x018c('0x30')},'vidaooNote':{'type':Sequelize[_0x018c('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x018c('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x018c('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d66a8a1..f0c7605 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 _0xe37a=['firstName','lastName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','NotifyMailAccount','notifyMail','server','addInteraction','omit','Contact','Owner','fullname','Tag','Tags','color','tag','getSnippet','getProactiveActions','getLicense','License','readFileSync','utf8','URL','address','origin','remote','headers','x-real-ip','connection','remoteAddress','virtual','alignment','labelText','textColor','hideWhenOffline','IntervalId','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','items','getOfflineMessages','Attachment','Attachments','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','lodash','querystring','html-to-text','jayson/promise','url','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIOutOfIntervalError','handleError','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','get','UserProfileResource','name','send','Command','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','map','Interval','Intervals','all','some','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','vendor','type','index','Pause','ChatWebsite','fieldName','key','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','intersection','length','include','create','user','role','ChatWebsites','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','sort','filter','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','asc','contact','threadId','externalUrl','ChatInteraction','interaction'];(function(_0xe5f973,_0x1edce7){var _0x34d054=function(_0x2dba4d){while(--_0x2dba4d){_0xe5f973['push'](_0xe5f973['shift']());}};_0x34d054(++_0x1edce7);}(_0xe37a,0x69));var _0xae37=function(_0x43b045,_0x8ae9ce){_0x43b045=_0x43b045-0x0;var _0x48e7ee=_0xe37a[_0x43b045];return _0x48e7ee;};'use strict';var Mustache=require(_0xae37('0x0'));var util=require(_0xae37('0x1'));var path=require(_0xae37('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae37('0x3'));var _=require(_0xae37('0x4'));var querystring=require(_0xae37('0x5'));var htmlToText=require(_0xae37('0x6'));var Redis=require('ioredis');var jayson=require(_0xae37('0x7'));var url=require(_0xae37('0x8'));var qs=require(_0xae37('0x9'));var logger=require(_0xae37('0xa'))('api');var config=require(_0xae37('0xb'));var APIOutOfIntervalError=require(_0xae37('0xc'))[_0xae37('0xd')];var APINotFoundError=require(_0xae37('0xc'))['APINotFoundError'];var APIHandleError=require(_0xae37('0xc'))[_0xae37('0xe')];var db=require('../../mysqldb')['db'];config['redis']=_[_0xae37('0xf')](config[_0xae37('0x10')],{'host':_0xae37('0x11'),'port':0x18eb});var socket=require(_0xae37('0x12'))(new Redis(config['redis']));require(_0xae37('0x13'))[_0xae37('0x14')](socket);var client=jayson[_0xae37('0x15')]['http']({'port':0x232c});var client9002=jayson[_0xae37('0x15')][_0xae37('0x16')]({'port':0x232a});var client9003=jayson['client'][_0xae37('0x16')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x4a977a,_0x2928d4,_0x1f4c3b,_0x38e1fe){return new Promise(function(_0x4b8612,_0x5e998f){var _0x42a88e=_0x38e1fe||client;return _0x42a88e['request'](_0x4a977a,_0x1f4c3b)[_0xae37('0x17')](function(_0x2257c2){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2928d4,'request\x20sent');logger['debug'](_0xae37('0x18'),_0x2928d4,_0xae37('0x19'),JSON[_0xae37('0x1a')](_0x2257c2));if(_0x2257c2[_0xae37('0x1b')]){if(_0x2257c2[_0xae37('0x1b')][_0xae37('0x1c')]===0x1f4){logger[_0xae37('0x1b')](_0xae37('0x1d'),_0x2928d4,_0x2257c2['error']['message']);return _0x5e998f(_0x2257c2[_0xae37('0x1b')][_0xae37('0x1e')]);}logger['error'](_0xae37('0x1d'),_0x2928d4,_0x2257c2[_0xae37('0x1b')][_0xae37('0x1e')]);return _0x4b8612(_0x2257c2[_0xae37('0x1b')][_0xae37('0x1e')]);}else{logger[_0xae37('0x1f')](_0xae37('0x1d'),_0x2928d4,_0xae37('0x19'));_0x4b8612(_0x2257c2[_0xae37('0x20')][_0xae37('0x1e')]);}})[_0xae37('0x21')](function(_0x213b6c){logger[_0xae37('0x1b')](_0xae37('0x1d'),_0x2928d4,_0x213b6c);_0x5e998f(_0x213b6c);});});}function respondWithStatusCode(_0x845390,_0x37e922){_0x37e922=_0x37e922||0xcc;return function(_0x337179){if(_0x337179){return _0x845390[_0xae37('0x22')](_0x37e922);}return _0x845390[_0xae37('0x23')](_0x37e922)[_0xae37('0x24')]();};}function respondWithResult(_0x18d125,_0x542149){_0x542149=_0x542149||0xc8;return function(_0x5cfe59){if(_0x5cfe59){return _0x18d125['status'](_0x542149)[_0xae37('0x25')](_0x5cfe59);}};}function respondWithFilteredResult(_0x4bfba0,_0x1c5571){return function(_0x2b9699){if(_0x2b9699){var _0x54e95a=typeof _0x1c5571[_0xae37('0x26')]===_0xae37('0x27')&&typeof _0x1c5571[_0xae37('0x28')]==='undefined';var _0x3492f3=_0x2b9699['count'];var _0x1aed00=_0x54e95a?0x0:_0x1c5571[_0xae37('0x26')];var _0x31ac5f=_0x54e95a?_0x2b9699[_0xae37('0x29')]:_0x1c5571[_0xae37('0x26')]+_0x1c5571[_0xae37('0x28')];var _0x90a55c;if(_0x31ac5f>=_0x3492f3){_0x31ac5f=_0x3492f3;_0x90a55c=0xc8;}else{_0x90a55c=0xce;}_0x4bfba0[_0xae37('0x23')](_0x90a55c);return _0x4bfba0[_0xae37('0x2a')]('Content-Range',_0x1aed00+'-'+_0x31ac5f+'/'+_0x3492f3)['json'](_0x2b9699);}return null;};}function saveUpdates(_0x935ef7){return function(_0x24413c){if(_0x24413c){return _0x24413c[_0xae37('0x2b')](_0x935ef7)[_0xae37('0x17')](function(_0x34362b){return _0x34362b;});}return null;};}function removeEntity(_0x2b87f0){return function(_0x55d379){if(_0x55d379){return _0x55d379[_0xae37('0x2c')]()[_0xae37('0x17')](function(){var _0x37ff2e=_0x55d379[_0xae37('0x2d')]({'plain':!![]});var _0x56f9f1='ChatWebsites';return db[_0xae37('0x2e')][_0xae37('0x2c')]({'where':{'type':_0x56f9f1,'resourceId':_0x37ff2e['id']}})[_0xae37('0x17')](function(){return _0x55d379;});})[_0xae37('0x17')](function(){_0x2b87f0[_0xae37('0x23')](0xcc)[_0xae37('0x24')]();});}};}function handleEntityNotFound(_0x35afd0){return function(_0x59288e){if(!_0x59288e){_0x35afd0['sendStatus'](0x194);}return _0x59288e;};}function handleError(_0x3c9df4,_0x5bed43){_0x5bed43=_0x5bed43||0x1f4;return function(_0x5359b4){logger[_0xae37('0x1b')](_0x5359b4['stack']);if(_0x5359b4['name']){delete _0x5359b4[_0xae37('0x2f')];}_0x3c9df4['status'](_0x5bed43)[_0xae37('0x30')](_0x5359b4);};}function iftimePromise(_0x52b168,_0x524e64){return respondWithRpcPromise(_0xae37('0x31'),'getSnippet',{'command':_0x524e64[_0xae37('0x32')]?util[_0xae37('0x33')](_0xae37('0x34'),_0x52b168[_0xae37('0x35')],_0x524e64[_0xae37('0x32')]):util[_0xae37('0x33')](_0xae37('0x36'),_0x52b168[_0xae37('0x35')])},client9002)[_0xae37('0x17')](function(_0x295a29){var _0x1e02c8=_0x295a29&&_0x295a29['indexOf']('true')>=0x0?!![]:![];logger[_0xae37('0x1f')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x524e64['id'],_0x52b168['id'],_0x52b168[_0xae37('0x35')],_0x1e02c8?_0xae37('0x37'):'OFFLINE',_0x524e64[_0xae37('0x32')]?_0x524e64[_0xae37('0x32')]:_0xae37('0x38'));return _0x1e02c8;})[_0xae37('0x21')](function(_0x5929f6){logger['error'](_0xae37('0x39'),_0x524e64['id'],_0x52b168['id'],_0x52b168[_0xae37('0x35')],util[_0xae37('0x3a')](_0x5929f6,{'showHidden':![],'depth':null}),_0x524e64['timezone']?_0x524e64['timezone']:_0xae37('0x38'));return![];});}function checkWebsiteIntervals(_0x4a1510){var _0x23e553=_[_0xae37('0x3b')](_0x4a1510[_0xae37('0x3c')][_0xae37('0x3d')],function(_0x53264d){var _0x5777ea=_0x53264d[_0xae37('0x2d')]({'plain':!![]});return iftimePromise(_0x5777ea,_0x4a1510);});return Promise[_0xae37('0x3e')](_0x23e553)[_0xae37('0x17')](function(_0x38666a){return _[_0xae37('0x3f')](_0x38666a);});}function createInteractionObject(_0x41cd85,_0x1bdadc,_0x2350f5,_0x207429){var _0x2489a5=require(_0xae37('0x40'));var _0x4d6942=new _0x2489a5();var _0x3c5c28=_0x4d6942['setUA'](_0x2350f5[_0xae37('0x41')])[_0xae37('0x42')]();var _0x3d62e5=_0x1bdadc[_0xae37('0x43')];if(_0x2350f5[_0xae37('0x44')]){_0x3d62e5=_0x2350f5[_0xae37('0x44')];}else if(_0x2350f5[_0xae37('0x45')]){_0x3d62e5=_[_0xae37('0x46')](_0x2350f5[_0xae37('0x45')][_0xae37('0x47')](','));}return{'ContactId':_0x207429['id'],'ChatWebsiteId':_0x41cd85,'from':(_0x207429['firstName']||'')+'\x20'+(_0x207429['lastName']||''),'customerIp':_0x3d62e5,'customerPort':_0x2350f5[_0xae37('0x48')]?_0x2350f5[_0xae37('0x48')]:null,'referer':_0x1bdadc[_0xae37('0x49')],'browserName':_0x3c5c28[_0xae37('0x4a')][_0xae37('0x2f')]&&_0x3c5c28[_0xae37('0x4a')][_0xae37('0x4b')]?util['format'](_0xae37('0x4c'),_0x3c5c28[_0xae37('0x4a')][_0xae37('0x2f')],_0x3c5c28[_0xae37('0x4a')]['version']):'unknown','browserVersion':_0x3c5c28[_0xae37('0x4a')][_0xae37('0x4b')]||_0xae37('0x4d'),'osName':util[_0xae37('0x33')](_0xae37('0x4c'),_0x3c5c28['os']['name'],_0x3c5c28['os'][_0xae37('0x4b')]),'osVersion':_0x3c5c28['os']['version'],'deviceModel':_0x3c5c28[_0xae37('0x4e')][_0xae37('0x4f')]&&_0x3c5c28[_0xae37('0x4e')][_0xae37('0x50')]?util[_0xae37('0x33')]('%s\x20%s\x20%s',_0x3c5c28[_0xae37('0x4e')][_0xae37('0x4f')],_0x3c5c28[_0xae37('0x4e')][_0xae37('0x50')],_0x3c5c28['device'][_0xae37('0x51')]):null,'deviceVendor':_0x3c5c28[_0xae37('0x4e')]['vendor'],'deviceType':_0x3c5c28[_0xae37('0x4e')][_0xae37('0x51')],'formData':JSON[_0xae37('0x1a')](_0x1bdadc)};}exports[_0xae37('0x52')]=function(_0x738bd1,_0x3cef96){var _0x4aa6d5={'include':[{'model':db[_0xae37('0x53')],'as':'mandatoryDispositionPause'}]},_0x11dc3f={},_0x3c24ce={'count':0x0,'rows':[]};var _0x464f8d=_[_0xae37('0x3b')](db[_0xae37('0x54')]['rawAttributes'],function(_0x24ad3a){return{'name':_0x24ad3a[_0xae37('0x55')],'type':_0x24ad3a[_0xae37('0x51')][_0xae37('0x56')]};});_0x11dc3f[_0xae37('0x4f')]=_[_0xae37('0x3b')](_0x464f8d,_0xae37('0x2f'));_0x11dc3f[_0xae37('0x57')]=_[_0xae37('0x58')](_0x738bd1['query']);_0x11dc3f[_0xae37('0x59')]=_['intersection'](_0x11dc3f[_0xae37('0x4f')],_0x11dc3f[_0xae37('0x57')]);_0x4aa6d5[_0xae37('0x5a')]=_['intersection'](_0x11dc3f[_0xae37('0x4f')],qs[_0xae37('0x5b')](_0x738bd1[_0xae37('0x57')][_0xae37('0x5b')]));_0x4aa6d5[_0xae37('0x5a')]=_0x4aa6d5[_0xae37('0x5a')]['length']?_0x4aa6d5[_0xae37('0x5a')]:_0x11dc3f[_0xae37('0x4f')];if(!_0x738bd1['query'][_0xae37('0x5c')](_0xae37('0x5d'))){_0x4aa6d5[_0xae37('0x28')]=qs[_0xae37('0x28')](_0x738bd1[_0xae37('0x57')]['limit']);_0x4aa6d5[_0xae37('0x26')]=qs[_0xae37('0x26')](_0x738bd1[_0xae37('0x57')][_0xae37('0x26')]);}_0x4aa6d5[_0xae37('0x5e')]=qs['sort'](_0x738bd1['query']['sort']);_0x4aa6d5[_0xae37('0x5f')]=qs[_0xae37('0x59')](_[_0xae37('0x60')](_0x738bd1['query'],_0x11dc3f['filters']),_0x464f8d);if(_0x738bd1[_0xae37('0x57')]['filter']){_0x4aa6d5['where']=_[_0xae37('0x61')](_0x4aa6d5[_0xae37('0x5f')],{'$or':_['map'](_0x464f8d,function(_0x3451ac){if(_0x3451ac[_0xae37('0x51')]!==_0xae37('0x62')){var _0x342805={};_0x342805[_0x3451ac['name']]={'$like':'%'+_0x738bd1['query']['filter']+'%'};return _0x342805;}})});}_0x4aa6d5=_['merge']({},_0x4aa6d5,_0x738bd1[_0xae37('0x63')]);var _0x3e4022={'where':_0x4aa6d5[_0xae37('0x5f')]};return db[_0xae37('0x54')][_0xae37('0x29')](_0x3e4022)[_0xae37('0x17')](function(_0x13b058){_0x3c24ce['count']=_0x13b058;if(_0x738bd1[_0xae37('0x57')][_0xae37('0x64')]){_0x4aa6d5['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xae37('0x65')](_0x4aa6d5);})[_0xae37('0x17')](function(_0x497809){_0x3c24ce[_0xae37('0x66')]=_0x497809;return _0x3c24ce;})[_0xae37('0x17')](respondWithFilteredResult(_0x3cef96,_0x4aa6d5))['catch'](handleError(_0x3cef96,null));};exports[_0xae37('0x67')]=function(_0x2078b5,_0x3a38f3){var _0x232090={'raw':![],'where':{'id':_0x2078b5[_0xae37('0x68')]['id']},'include':[{'model':db[_0xae37('0x53')],'as':_0xae37('0x69')}]},_0x4226ab={};_0x4226ab[_0xae37('0x4f')]=_[_0xae37('0x58')](db['ChatWebsite'][_0xae37('0x6a')]);_0x4226ab[_0xae37('0x57')]=_[_0xae37('0x58')](_0x2078b5[_0xae37('0x57')]);_0x4226ab[_0xae37('0x59')]=_[_0xae37('0x6b')](_0x4226ab[_0xae37('0x4f')],_0x4226ab[_0xae37('0x57')]);_0x232090['attributes']=_[_0xae37('0x6b')](_0x4226ab['model'],qs[_0xae37('0x5b')](_0x2078b5[_0xae37('0x57')][_0xae37('0x5b')]));_0x232090[_0xae37('0x5a')]=_0x232090['attributes'][_0xae37('0x6c')]?_0x232090['attributes']:_0x4226ab[_0xae37('0x4f')];if(_0x2078b5[_0xae37('0x57')][_0xae37('0x64')]){_0x232090[_0xae37('0x6d')]=[{'all':!![]}];}_0x232090=_['merge']({},_0x232090,_0x2078b5[_0xae37('0x63')]);return db['ChatWebsite']['find'](_0x232090)[_0xae37('0x17')](handleEntityNotFound(_0x3a38f3,null))[_0xae37('0x17')](respondWithResult(_0x3a38f3,null))['catch'](handleError(_0x3a38f3,null));};exports[_0xae37('0x6e')]=function(_0x2462ae,_0x2ea4fe){return db[_0xae37('0x54')][_0xae37('0x6e')](_0x2462ae['body'],{})[_0xae37('0x17')](function(_0x3b32ea){var _0x25af62=_0x2462ae[_0xae37('0x6f')][_0xae37('0x2d')]({'plain':!![]});if(!_0x25af62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25af62[_0xae37('0x70')]==='user'){var _0x571e26=_0x3b32ea[_0xae37('0x2d')]({'plain':!![]});var _0x49fc2d=_0xae37('0x71');return db[_0xae37('0x72')][_0xae37('0x73')]({'where':{'name':_0x49fc2d,'userProfileId':_0x25af62['userProfileId']},'raw':!![]})['then'](function(_0x158d79){if(_0x158d79&&_0x158d79[_0xae37('0x74')]===0x0){return db[_0xae37('0x2e')][_0xae37('0x6e')]({'name':_0x571e26[_0xae37('0x2f')],'resourceId':_0x571e26['id'],'type':_0x158d79['name'],'sectionId':_0x158d79['id']},{})[_0xae37('0x17')](function(){return _0x3b32ea;});}else{return _0x3b32ea;}})['catch'](function(_0x26d95a){logger[_0xae37('0x1b')](_0xae37('0x75'),_0x26d95a);throw _0x26d95a;});}return _0x3b32ea;})[_0xae37('0x17')](respondWithResult(_0x2ea4fe,0xc9))[_0xae37('0x21')](handleError(_0x2ea4fe,null));};exports[_0xae37('0x2b')]=function(_0x40a8d4,_0xbba271){if(_0x40a8d4[_0xae37('0x76')]['id']){delete _0x40a8d4[_0xae37('0x76')]['id'];}return db[_0xae37('0x54')]['find']({'where':{'id':_0x40a8d4[_0xae37('0x68')]['id']},'include':[{'model':db['Pause'],'as':_0xae37('0x69')}]})[_0xae37('0x17')](handleEntityNotFound(_0xbba271,null))[_0xae37('0x17')](saveUpdates(_0x40a8d4[_0xae37('0x76')],null))['then'](respondWithResult(_0xbba271,null))[_0xae37('0x21')](handleError(_0xbba271,null));};exports[_0xae37('0x2c')]=function(_0x3404b6,_0x49e86d){return db[_0xae37('0x54')][_0xae37('0x73')]({'where':{'id':_0x3404b6[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x49e86d,null))[_0xae37('0x17')](removeEntity(_0x49e86d,null))[_0xae37('0x21')](handleError(_0x49e86d,null));};exports['describe']=function(_0xa6f321,_0x1c8b71){return db[_0xae37('0x54')][_0xae37('0x77')]()['then'](respondWithResult(_0x1c8b71,null))[_0xae37('0x21')](handleError(_0x1c8b71,null));};exports[_0xae37('0x78')]=function(_0x45fe97,_0x1e4a60){if(_0x45fe97[_0xae37('0x76')]['id']){delete _0x45fe97[_0xae37('0x76')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x45fe97[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x1e4a60,null))[_0xae37('0x17')](function(_0x2a4955){if(_0x2a4955){_0x45fe97[_0xae37('0x76')][_0xae37('0x79')]=_0x2a4955['id'];return db[_0xae37('0x7a')]['create'](_0x45fe97[_0xae37('0x76')]);}})[_0xae37('0x17')](respondWithResult(_0x1e4a60,null))['catch'](handleError(_0x1e4a60,null));};exports[_0xae37('0x7b')]=function(_0x1e8b2a,_0x82c671){var _0x564247={'raw':![],'where':{}};var _0x492582={};var _0x5734e7={'count':0x0,'rows':[]};return db[_0xae37('0x54')][_0xae37('0x7c')]({'where':{'id':_0x1e8b2a[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x82c671,null))[_0xae37('0x17')](function(_0x21c0a9){if(_0x21c0a9){_0x492582[_0xae37('0x4f')]=_['keys'](db[_0xae37('0x7a')][_0xae37('0x6a')]);_0x492582['query']=_['keys'](_0x1e8b2a[_0xae37('0x57')]);_0x492582[_0xae37('0x59')]=_[_0xae37('0x6b')](_0x492582[_0xae37('0x4f')],_0x492582['query']);_0x564247[_0xae37('0x5a')]=_[_0xae37('0x6b')](_0x492582[_0xae37('0x4f')],qs[_0xae37('0x5b')](_0x1e8b2a[_0xae37('0x57')][_0xae37('0x5b')]));_0x564247[_0xae37('0x5a')]=_0x564247['attributes'][_0xae37('0x6c')]?_0x564247[_0xae37('0x5a')]:_0x492582[_0xae37('0x4f')];if(!_0x1e8b2a['query'][_0xae37('0x5c')](_0xae37('0x5d'))){_0x564247[_0xae37('0x28')]=qs[_0xae37('0x28')](_0x1e8b2a[_0xae37('0x57')][_0xae37('0x28')]);_0x564247[_0xae37('0x26')]=qs[_0xae37('0x26')](_0x1e8b2a['query'][_0xae37('0x26')]);}_0x564247[_0xae37('0x5e')]=qs[_0xae37('0x7d')](_0x1e8b2a[_0xae37('0x57')][_0xae37('0x7d')]);_0x564247['where']=qs[_0xae37('0x59')](_[_0xae37('0x60')](_0x1e8b2a[_0xae37('0x57')],_0x492582[_0xae37('0x59')]));_0x564247[_0xae37('0x5f')][_0xae37('0x79')]=_0x21c0a9['id'];if(_0x1e8b2a[_0xae37('0x57')][_0xae37('0x7e')]){_0x564247[_0xae37('0x5f')]=_[_0xae37('0x61')](_0x564247[_0xae37('0x5f')],{'$or':_['map'](_0x564247[_0xae37('0x5a')],function(_0x1a3a7e){var _0xdb921={};_0xdb921[_0x1a3a7e]={'$like':'%'+_0x1e8b2a[_0xae37('0x57')][_0xae37('0x7e')]+'%'};return _0xdb921;})});}_0x564247=_['merge']({},_0x564247,_0x1e8b2a[_0xae37('0x63')]);return db[_0xae37('0x7a')][_0xae37('0x29')]({'where':_0x564247[_0xae37('0x5f')]})['then'](function(_0x4b4cc1){_0x5734e7[_0xae37('0x29')]=_0x4b4cc1;if(_0x1e8b2a[_0xae37('0x57')][_0xae37('0x64')]){_0x564247[_0xae37('0x6d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x564247);})[_0xae37('0x17')](function(_0x3f6481){_0x5734e7[_0xae37('0x66')]=_0x3f6481;return _0x5734e7;});}})[_0xae37('0x17')](respondWithFilteredResult(_0x82c671,_0x564247))[_0xae37('0x21')](handleError(_0x82c671,null));};exports[_0xae37('0x7f')]=function(_0x5554a8,_0x35a382){return db[_0xae37('0x54')][_0xae37('0x73')]({'where':{'id':_0x5554a8[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x35a382,null))[_0xae37('0x17')](function(_0x2abceb){if(_0x2abceb){return _0x2abceb['removeDispositions'](_0x5554a8['query'][_0xae37('0x80')]);}})[_0xae37('0x17')](respondWithStatusCode(_0x35a382,null))[_0xae37('0x21')](handleError(_0x35a382,null));};exports[_0xae37('0x81')]=function(_0x44efa7,_0x458791){if(_0x44efa7['body']['id']){delete _0x44efa7[_0xae37('0x76')]['id'];}return db[_0xae37('0x54')]['find']({'where':{'id':_0x44efa7[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x458791,null))[_0xae37('0x17')](function(_0x88cedf){if(_0x88cedf){_0x44efa7[_0xae37('0x76')][_0xae37('0x79')]=_0x88cedf['id'];return db[_0xae37('0x82')][_0xae37('0x6e')](_0x44efa7[_0xae37('0x76')]);}})[_0xae37('0x17')](respondWithResult(_0x458791,null))['catch'](handleError(_0x458791,null));};exports['getAnswers']=function(_0x53b47e,_0x35a830){var _0x156dbc={'raw':![],'where':{}};var _0x1c8152={};var _0x4dc8de={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x53b47e[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x35a830,null))['then'](function(_0x10b32c){if(_0x10b32c){_0x1c8152['model']=_[_0xae37('0x58')](db['CannedAnswer'][_0xae37('0x6a')]);_0x1c8152['query']=_[_0xae37('0x58')](_0x53b47e[_0xae37('0x57')]);_0x1c8152[_0xae37('0x59')]=_['intersection'](_0x1c8152[_0xae37('0x4f')],_0x1c8152[_0xae37('0x57')]);_0x156dbc['attributes']=_['intersection'](_0x1c8152['model'],qs[_0xae37('0x5b')](_0x53b47e['query'][_0xae37('0x5b')]));_0x156dbc[_0xae37('0x5a')]=_0x156dbc[_0xae37('0x5a')][_0xae37('0x6c')]?_0x156dbc['attributes']:_0x1c8152[_0xae37('0x4f')];if(!_0x53b47e['query']['hasOwnProperty'](_0xae37('0x5d'))){_0x156dbc[_0xae37('0x28')]=qs[_0xae37('0x28')](_0x53b47e['query'][_0xae37('0x28')]);_0x156dbc[_0xae37('0x26')]=qs['offset'](_0x53b47e[_0xae37('0x57')]['offset']);}_0x156dbc['order']=qs[_0xae37('0x7d')](_0x53b47e['query'][_0xae37('0x7d')]);_0x156dbc[_0xae37('0x5f')]=qs[_0xae37('0x59')](_[_0xae37('0x60')](_0x53b47e[_0xae37('0x57')],_0x1c8152[_0xae37('0x59')]));_0x156dbc['where'][_0xae37('0x79')]=_0x10b32c['id'];if(_0x53b47e['query'][_0xae37('0x7e')]){_0x156dbc[_0xae37('0x5f')]=_['merge'](_0x156dbc[_0xae37('0x5f')],{'$or':_[_0xae37('0x3b')](_0x156dbc[_0xae37('0x5a')],function(_0x857872){var _0xdcda3={};_0xdcda3[_0x857872]={'$like':'%'+_0x53b47e[_0xae37('0x57')]['filter']+'%'};return _0xdcda3;})});}_0x156dbc=_[_0xae37('0x61')]({},_0x156dbc,_0x53b47e[_0xae37('0x63')]);return db[_0xae37('0x82')][_0xae37('0x29')]({'where':_0x156dbc['where']})[_0xae37('0x17')](function(_0x516aaf){_0x4dc8de['count']=_0x516aaf;if(_0x53b47e[_0xae37('0x57')][_0xae37('0x64')]){_0x156dbc[_0xae37('0x6d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xae37('0x65')](_0x156dbc);})['then'](function(_0x583403){_0x4dc8de[_0xae37('0x66')]=_0x583403;return _0x4dc8de;});}})[_0xae37('0x17')](respondWithFilteredResult(_0x35a830,_0x156dbc))['catch'](handleError(_0x35a830,null));};exports[_0xae37('0x83')]=function(_0x2fcceb,_0x279765){return db[_0xae37('0x54')][_0xae37('0x73')]({'where':{'id':_0x2fcceb[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x279765,null))[_0xae37('0x17')](function(_0x16d92d){if(_0x16d92d){return _0x16d92d['removeAnswers'](_0x2fcceb[_0xae37('0x57')]['ids']);}})[_0xae37('0x17')](respondWithStatusCode(_0x279765,null))[_0xae37('0x21')](handleError(_0x279765,null));};exports[_0xae37('0x84')]=function(_0x26056d,_0x5a11e1){_0x26056d[_0xae37('0x76')][_0xae37('0x85')]=_0x26056d[_0xae37('0x86')][_0xae37('0x87')];return db[_0xae37('0x54')][_0xae37('0x73')]({'where':{'id':_0x26056d['params']['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x5a11e1,null))['then'](saveUpdates(_0x26056d['body'],null))['then'](respondWithResult(_0x5a11e1,null))[_0xae37('0x21')](handleError(_0x5a11e1,null));};exports[_0xae37('0x88')]=function(_0x3fb3e8,_0x27acce){_0x3fb3e8[_0xae37('0x76')][_0xae37('0x89')]=_0x3fb3e8['file']['filename'];return db['ChatWebsite'][_0xae37('0x73')]({'where':{'id':_0x3fb3e8[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x27acce,null))['then'](saveUpdates(_0x3fb3e8[_0xae37('0x76')],null))[_0xae37('0x17')](respondWithResult(_0x27acce,null))[_0xae37('0x21')](handleError(_0x27acce,null));};exports[_0xae37('0x8a')]=function(_0x1c730b,_0x4a3c68){_0x1c730b[_0xae37('0x76')][_0xae37('0x8b')]=_0x1c730b['file']['filename'];return db[_0xae37('0x54')][_0xae37('0x73')]({'where':{'id':_0x1c730b[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x4a3c68,null))[_0xae37('0x17')](saveUpdates(_0x1c730b[_0xae37('0x76')],null))[_0xae37('0x17')](respondWithResult(_0x4a3c68,null))[_0xae37('0x21')](handleError(_0x4a3c68,null));};exports['addSystemAvatar']=function(_0x1f4905,_0x45ec35){_0x1f4905[_0xae37('0x76')][_0xae37('0x8c')]=_0x1f4905[_0xae37('0x86')]['filename'];return db[_0xae37('0x54')]['find']({'where':{'id':_0x1f4905[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x45ec35,null))[_0xae37('0x17')](saveUpdates(_0x1f4905['body'],null))[_0xae37('0x17')](respondWithResult(_0x45ec35,null))['catch'](handleError(_0x45ec35,null));};exports[_0xae37('0x8d')]=function(_0x1e6633,_0x53ccdb){var _0x193f38=path[_0xae37('0x8e')](config[_0xae37('0x8f')],_0xae37('0x90'));var _0x5aabca={'where':{'id':_0x1e6633[_0xae37('0x68')]['id']},'attributes':['id',_0xae37('0x85')],'raw':!![]};var _0x59bfcb=![];return require(_0xae37('0x91'))['getLicense']()['then'](function(_0x27d052){if(_0x27d052){_0x59bfcb=_0x27d052[_0xae37('0x92')];}})['then'](function(){return db['ChatWebsite'][_0xae37('0x73')](_0x5aabca);})[_0xae37('0x17')](handleEntityNotFound(_0x53ccdb,null))[_0xae37('0x17')](function(_0x13a185){if(_0x13a185){if(!_[_0xae37('0x93')](_0x13a185[_0xae37('0x85')])){if(fs[_0xae37('0x94')](path[_0xae37('0x8e')](config[_0xae37('0x8f')],'server/files/images/logos/',_0x13a185['sitepic']))&&_0x59bfcb){_0x193f38=path['join'](config['root'],'server/files/images/logos/',_0x13a185[_0xae37('0x85')]);}}return _0x53ccdb['download'](_0x193f38);}})['catch'](handleError(_0x53ccdb,null));};exports[_0xae37('0x95')]=function(_0x1552fa,_0x5d77a1){var _0x1e0d4e=path[_0xae37('0x8e')](config[_0xae37('0x8f')],_0xae37('0x96'));var _0x1000ef={'where':{'id':_0x1552fa[_0xae37('0x68')]['id']},'attributes':['id',_0xae37('0x89')],'raw':!![]};return db[_0xae37('0x54')]['find'](_0x1000ef)['then'](handleEntityNotFound(_0x5d77a1,null))['then'](function(_0x1eec26){if(_0x1eec26){if(!_[_0xae37('0x93')](_0x1eec26[_0xae37('0x89')])){if(fs[_0xae37('0x94')](path['join'](config[_0xae37('0x8f')],_0xae37('0x97'),_0x1eec26[_0xae37('0x89')]))){_0x1e0d4e=path[_0xae37('0x8e')](config[_0xae37('0x8f')],'server/files/images/avatars/',_0x1eec26[_0xae37('0x89')]);}}return _0x5d77a1[_0xae37('0x98')](_0x1e0d4e);}})[_0xae37('0x21')](handleError(_0x5d77a1,null));};exports[_0xae37('0x99')]=function(_0xaa76c6,_0x1b38c1){var _0x3259e6=path[_0xae37('0x8e')](config[_0xae37('0x8f')],_0xae37('0x9a'));var _0x204431={'where':{'id':_0xaa76c6[_0xae37('0x68')]['id']},'attributes':['id','customerAvatar',_0xae37('0x9b')],'raw':!![]};return db['ChatWebsite'][_0xae37('0x73')](_0x204431)['then'](handleEntityNotFound(_0x1b38c1,null))['then'](function(_0x367542){if(_0x367542){if(!_[_0xae37('0x93')](_0x367542[_0xae37('0x8b')])){if(fs[_0xae37('0x94')](path[_0xae37('0x8e')](config[_0xae37('0x8f')],_0xae37('0x97'),_0x367542[_0xae37('0x8b')]))&&_0x367542[_0xae37('0x9b')]){_0x3259e6=path[_0xae37('0x8e')](config[_0xae37('0x8f')],_0xae37('0x97'),_0x367542[_0xae37('0x8b')]);}}return _0x1b38c1[_0xae37('0x98')](_0x3259e6);}})[_0xae37('0x21')](handleError(_0x1b38c1,null));};exports[_0xae37('0x9c')]=function(_0x4244a2,_0x3fe905){var _0x239732=path['join'](config[_0xae37('0x8f')],'server/files/images/avatars/system_avatar.png');var _0x10b6e1={'where':{'id':_0x4244a2[_0xae37('0x68')]['id']},'attributes':['id',_0xae37('0x8c')],'raw':!![]};return db[_0xae37('0x54')][_0xae37('0x73')](_0x10b6e1)[_0xae37('0x17')](handleEntityNotFound(_0x3fe905,null))[_0xae37('0x17')](function(_0x21a6d0){if(_0x21a6d0){if(!_[_0xae37('0x93')](_0x21a6d0[_0xae37('0x8c')])){if(fs[_0xae37('0x94')](path['join'](config['root'],'server/files/images/avatars/',_0x21a6d0[_0xae37('0x8c')]))){_0x239732=path[_0xae37('0x8e')](config['root'],'server/files/images/avatars/',_0x21a6d0[_0xae37('0x8c')]);}}return _0x3fe905[_0xae37('0x98')](_0x239732);}})[_0xae37('0x21')](handleError(_0x3fe905,null));};exports[_0xae37('0x9d')]=function(_0x176cd5,_0x357a54){var _0x4f4fc5={'body':_0x176cd5['body'],'channel':'chat'};var _0x45b447=[];var _0x560bba=[];var _0x22b11f={};var _0xb15878=![];return db['CmContact'][_0xae37('0x77')]()[_0xae37('0x17')](function(_0x9be747){if(!_0x9be747){throw new db['Sequelize'][(_0xae37('0x9e'))]('no\x20available\x20attributes');}_0x45b447=_[_0xae37('0x9f')](_['keys'](_0x9be747),[_0xae37('0xa0'),_0xae37('0xa1')]);_0x560bba=_[_0xae37('0x9f')](_['keys'](_0x9be747),[_0xae37('0xa0'),_0xae37('0xa1'),_0xae37('0xa2'),_0xae37('0xa3')]);if(_0x176cd5['body']['id']){delete _0x176cd5[_0xae37('0x76')]['id'];}if(_[_0xae37('0x93')](_0x176cd5[_0xae37('0x76')][_0xae37('0xa4')])){throw new db[(_0xae37('0xa5'))][(_0xae37('0x9e'))](_0xae37('0xa6'));}if(_[_0xae37('0x93')](_0x176cd5['body'][_0xae37('0x76')])||_0x176cd5[_0xae37('0x76')][_0xae37('0x76')]===''){throw new db[(_0xae37('0xa5'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xae37('0x93')](_0x176cd5[_0xae37('0x76')][_0xae37('0xa7')])){throw new db['Sequelize'][(_0xae37('0x9e'))](_0xae37('0xa8')+_0x560bba);}if(!_[_0xae37('0xa9')](_0x560bba,_0x176cd5['body'][_0xae37('0xa7')])){throw new db[(_0xae37('0xa5'))][(_0xae37('0x9e'))](_0xae37('0xaa')+_0x560bba);}_0x22b11f[_0x176cd5['body'][_0xae37('0xa7')]]=_0x176cd5[_0xae37('0x76')][_0xae37('0xa4')];})[_0xae37('0x17')](function(){return db[_0xae37('0x54')]['find']({'where':{'id':_0x176cd5['params']['id']},'include':[{'model':db[_0xae37('0xab')],'as':_0xae37('0xac'),'include':[{'model':db[_0xae37('0xad')],'as':_0xae37('0xae'),'where':_0x22b11f,'limit':0x1,'order':[[_0xae37('0xa1'),_0xae37('0xaf')]]}]},{'model':db[_0xae37('0xb0')],'as':_0xae37('0xb1')},{'model':db[_0xae37('0x3c')],'as':'Interval','include':[{'model':db[_0xae37('0x3c')],'as':_0xae37('0x3d'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0xae37('0x17')](function(_0x5af5c7){if(!_0x5af5c7)throw new APINotFoundError(util[_0xae37('0x33')](_0xae37('0xb2'),_0x176cd5[_0xae37('0x68')]['id']));if(!_0x5af5c7[_0xae37('0x3c')]||!_0x5af5c7[_0xae37('0x3c')][_0xae37('0x3d')])return[_0x5af5c7,!![]];return[_0x5af5c7,checkWebsiteIntervals(_0x5af5c7)];})[_0xae37('0xb3')](function(_0x41ec26,_0x4c49c5){if(!_0x4c49c5)throw new APIOutOfIntervalError();if(!_0x41ec26[_0xae37('0xac')])return;_0x4f4fc5[_0xae37('0xb4')]=_0x41ec26;_0x4f4fc5[_0xae37('0xb5')]=_0x41ec26[_0xae37('0xac')];_0x4f4fc5[_0xae37('0xb6')]=_[_0xae37('0xb7')](_0x41ec26[_0xae37('0xb1')],['priority'],[_0xae37('0xb8')]);if(_0x4f4fc5[_0xae37('0xb4')][_0xae37('0xb1')]){delete _0x4f4fc5[_0xae37('0xb4')]['Applications'];}if(_0x4f4fc5['account'][_0xae37('0xac')]&&_0x4f4fc5[_0xae37('0xb4')][_0xae37('0xac')][_0xae37('0xae')][_0xae37('0x6c')]){return _0x4f4fc5[_0xae37('0xb4')][_0xae37('0xac')][_0xae37('0xae')][0x0];}var _0x5255b7=_['defaults'](_0x176cd5[_0xae37('0x76')],{'firstName':_0x176cd5[_0xae37('0x76')]['from'],'ListId':_0x41ec26[_0xae37('0xa3')]});_0x5255b7[_0x176cd5[_0xae37('0x76')][_0xae37('0xa7')]]=_0x176cd5[_0xae37('0x76')][_0xae37('0xa4')];return db[_0xae37('0xad')][_0xae37('0x6e')](_0x5255b7,{'fields':_0x45b447,'raw':!![]});})[_0xae37('0x17')](function(_0x1d0a6d){_0x4f4fc5[_0xae37('0xb9')]=_0x1d0a6d;var _0x23a11a=createInteractionObject(_0x176cd5[_0xae37('0x68')]['id'],_0x176cd5[_0xae37('0x76')],_0x176cd5['headers'],_0x1d0a6d);var _0x48a4a9={'ChatWebsiteId':_0x176cd5[_0xae37('0x68')]['id'],'closed':![]};if(_0x176cd5[_0xae37('0x76')][_0xae37('0xba')]){_0x48a4a9[_0xae37('0xba')]=_0x176cd5[_0xae37('0x76')]['threadId'];return db['ChatInteraction'][_0xae37('0x73')]({'where':_0x48a4a9})[_0xae37('0x17')](function(_0x4c97c6){if(_0x4c97c6){_0xb15878=!![];return _0x4c97c6;}_0x23a11a[_0xae37('0xba')]=_0x176cd5['body'][_0xae37('0xba')];_0x23a11a[_0xae37('0xbb')]=_0x176cd5[_0xae37('0x76')][_0xae37('0xbb')];return db[_0xae37('0xbc')]['create'](_0x23a11a);});}_0x48a4a9['ContactId']=_0x1d0a6d['id'];if(_0x176cd5[_0xae37('0x76')][_0xae37('0xbd')]&&_0x176cd5[_0xae37('0x76')][_0xae37('0xbd')]['id']){_0x48a4a9['id']=_0x176cd5[_0xae37('0x76')][_0xae37('0xbd')]['id'];return db[_0xae37('0xbc')][_0xae37('0x73')]({'where':_0x48a4a9})[_0xae37('0x17')](function(_0x430ab5){if(_0x430ab5){_0xb15878=!![];return _0x430ab5;}return db['ChatInteraction'][_0xae37('0x6e')](_0x23a11a);});}return db[_0xae37('0xbc')]['create'](_0x23a11a);})['then'](function(_0xbc07e){if(!_0xb15878)return _0xbc07e;var _0x48d7a6={'from':(_0x4f4fc5[_0xae37('0xb9')][_0xae37('0xbe')]||'')+'\x20'+(_0x4f4fc5[_0xae37('0xb9')][_0xae37('0xbf')]||'')};if(_0x176cd5[_0xae37('0x76')]['threadId']&&_0x176cd5['body'][_0xae37('0xc0')]&&_0x176cd5[_0xae37('0x76')][_0xae37('0xba')]!=_0x176cd5[_0xae37('0x76')][_0xae37('0xc0')]){_0x48d7a6[_0xae37('0xba')]=_0x176cd5[_0xae37('0x76')][_0xae37('0xc0')];}return _0xbc07e['update'](_0x48d7a6);})[_0xae37('0x17')](function(_0x247f97){_0x4f4fc5[_0xae37('0xbd')]=_0x247f97[_0xae37('0x2d')]({'plain':!![]});_0x4f4fc5[_0xae37('0xbd')][_0xae37('0xc1')]=!_0xb15878;if(_0x4f4fc5[_0xae37('0xbd')][_0xae37('0xc1')]){if(_0x4f4fc5[_0xae37('0xb4')]['autoclose']){_0x4f4fc5['applications'][_0xae37('0xc2')]({'id':0x0,'priority':_0x4f4fc5[_0xae37('0xb6')]['length']+0x1,'app':_0xae37('0xc3'),'appdata':_0xae37('0xc4'),'interval':_0xae37('0xc5')});}}return db[_0xae37('0xc6')][_0xae37('0x6e')]({'body':_0x176cd5[_0xae37('0x76')][_0xae37('0x76')],'ChatWebsiteId':_0x176cd5[_0xae37('0x68')]['id'],'ChatInteractionId':_0x247f97['id'],'direction':'in','ContactId':_0x4f4fc5['contact']['id'],'AttachmentId':_0x176cd5[_0xae37('0x76')][_0xae37('0xc7')]});})[_0xae37('0x17')](function(_0x11bc00){_0x4f4fc5['message']=_0x11bc00;if(!_0x4f4fc5[_0xae37('0xbd')]['UserId']){return;}return db[_0xae37('0xc8')]['find']({'attributes':['id',_0xae37('0x2f')],'where':{'id':_0x4f4fc5[_0xae37('0xbd')][_0xae37('0xc9')]}});})[_0xae37('0x17')](function(_0x28b90d){if(_0x28b90d){_0x4f4fc5[_0xae37('0xb6')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x28b90d['name']+','+(_0x4f4fc5['account'][_0xae37('0xca')]||0xa),'interval':_0xae37('0xc5')});_0x4f4fc5[_0xae37('0xcb')]=!![];}if(!_0x4f4fc5[_0xae37('0xbd')][_0xae37('0xcc')]){return;}return db[_0xae37('0xcd')][_0xae37('0x73')]({'attributes':['id',_0xae37('0x2f')],'where':{'id':_0x4f4fc5[_0xae37('0xbd')][_0xae37('0xcc')]}});})[_0xae37('0x17')](function(_0x158620){if(_0x158620){_0x4f4fc5[_0xae37('0xb6')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x158620['name']+','+(_0x4f4fc5[_0xae37('0xb4')][_0xae37('0xce')]||0x12c),'interval':_0xae37('0xc5')});}return respondWithRpcPromise(_0xae37('0xcf'),_0xae37('0xd0'),_0x4f4fc5);})[_0xae37('0x17')](function(_0x47941c){respondWithRpcPromise(_0xae37('0xd1'),_0xae37('0xd1'),{'event':'notify','message':_0x47941c},client9002);return _0x47941c;})['then'](respondWithResult(_0x357a54,null))[_0xae37('0x21')](APIHandleError(_0x357a54));};exports[_0xae37('0xd2')]=function(_0xf15b4f,_0x11908a){var _0x48b229,_0x378f3f,_0x2234f1;var _0x55bf3c=[];var _0x20fc4e={};var _0xcd61e6=_0xf15b4f[_0xae37('0xd3')]||[];var _0x1a692c=[];var _0x3b1111;return db[_0xae37('0xad')][_0xae37('0x77')]()['then'](function(_0x19615f){if(!_0x19615f){throw new db[(_0xae37('0xa5'))][(_0xae37('0x9e'))]('no\x20available\x20attributes');}_0x55bf3c=_[_0xae37('0x9f')](_['keys'](_0x19615f),['createdAt',_0xae37('0xa1'),'CompanyId',_0xae37('0xa3')]);if(_0xf15b4f['body']['id']){delete _0xf15b4f['body']['id'];}if(_[_0xae37('0x93')](_0xf15b4f[_0xae37('0x76')]['from'])){throw _0x11908a[_0xae37('0x23')](0x1f4)[_0xae37('0x30')](new db[(_0xae37('0xa5'))]['ValidationError'](_0xae37('0xa6')));}if(_[_0xae37('0x93')](_0xf15b4f['body'][_0xae37('0x76')])||_0xf15b4f['body']['body']===''){throw _0x11908a[_0xae37('0x23')](0x1f4)[_0xae37('0x30')](new db[(_0xae37('0xa5'))][(_0xae37('0x9e'))](_0xae37('0xd4')));}if(_[_0xae37('0x93')](_0xf15b4f['body'][_0xae37('0xd5')])){throw _0x11908a[_0xae37('0x23')](0x1f4)['send'](new db[(_0xae37('0xa5'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55bf3c));}if(!_[_0xae37('0xa9')](_0x55bf3c,_0xf15b4f['body'][_0xae37('0xd5')])){throw _0x11908a['status'](0x1f4)[_0xae37('0x30')](new db[(_0xae37('0xa5'))][(_0xae37('0x9e'))](_0xae37('0xd6')+_0x55bf3c));}_0x20fc4e[_0xf15b4f[_0xae37('0x76')][_0xae37('0xd5')]]=_0xf15b4f[_0xae37('0x76')][_0xae37('0xa4')];})['then'](function(){return db[_0xae37('0x54')][_0xae37('0x73')]({'where':{'id':_0xf15b4f[_0xae37('0x68')]['id']},'include':[{'model':db[_0xae37('0xab')],'as':_0xae37('0xac')},{'model':db[_0xae37('0xd7')],'as':_0xae37('0xd7')}]});})[_0xae37('0x17')](handleEntityNotFound(_0x11908a,null))[_0xae37('0x17')](function(_0x256cae){if(_0x256cae&&_0x256cae[_0xae37('0xac')]){_0x378f3f=_0x256cae;var _0x68731a=_[_0xae37('0xf')](_0xf15b4f['body'],{'firstName':_0xf15b4f[_0xae37('0x76')][_0xae37('0xa4')],'phone':_0xf15b4f[_0xae37('0x76')][_0xae37('0xa4')],'ListId':_0x256cae['ListId']});_0x68731a[_0xf15b4f[_0xae37('0x76')][_0xae37('0xd5')]]=_0xf15b4f['body'][_0xae37('0xa4')];return db[_0xae37('0xad')][_0xae37('0xd8')]({'where':_0x20fc4e,'defaults':_0x68731a});}})[_0xae37('0xb3')](function(_0x426e25){if(_0x426e25){_0x2234f1=_0x426e25;var _0x33e481=fs['readFileSync'](path[_0xae37('0x8e')](config['root'],_0xae37('0xd9')),'utf8');var _0x5115a4=ejs[_0xae37('0xda')](_0x33e481,{'body':_['toPairs'](_0xf15b4f['body'][_0xae37('0x76')]),'bodyTitle':_0x378f3f[_0xae37('0xdb')]});return db[_0xae37('0xdc')][_0xae37('0x6e')]({'body':_0x5115a4,'plainBody':htmlToText[_0xae37('0xdd')](_0x5115a4),'ContactId':_0x426e25['id'],'ChatWebsiteId':_0x378f3f['id']});}})[_0xae37('0x17')](function(_0x58056c){_0x3b1111=_0x58056c;if(_0xcd61e6[_0xae37('0x6c')]){var _0x563928=_0xcd61e6['map'](function(_0x5e08e1){return{'name':_0x5e08e1[_0xae37('0xde')],'basename':_0x5e08e1['filename'],'type':_0x5e08e1[_0xae37('0xdf')],'ChatOfflineMessageId':_0x58056c['id']};});_0x1a692c=_0x563928[_0xae37('0x3b')](_0x3c87b9=>{var _0x2bf0f4={'filename':_0x3c87b9[_0xae37('0x2f')],'path':path[_0xae37('0x8e')](config[_0xae37('0x8f')],'server','files','attachments',_0xae37('0xe0'),_0x3c87b9[_0xae37('0xe1')])};return _0x2bf0f4;});if(!_0x378f3f[_0xae37('0xe2')]){return db[_0xae37('0xe3')][_0xae37('0xe4')](function(_0x332370){return db['Attachment'][_0xae37('0xe5')](_0x563928,{'transaction':_0x332370});});}}})['then'](function(){if(_0x3b1111){_0x48b229=_0x3b1111;return db[_0xae37('0xd7')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xae37('0xe6')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xae37('0xe7')],'as':_0xae37('0xe7'),'raw':!![]}]}]});}})[_0xae37('0x17')](function(_0x1a02a8){if(_0x1a02a8&&_0x1a02a8['Smtp']&&_0x378f3f[_0xae37('0xe8')]&&_0x378f3f[_0xae37('0xe9')]){var _0x4184b4=_0x1a02a8[_0xae37('0xea')]();return respondWithRpcPromise(_0xae37('0xeb'),'sendMail',{'account':_0x4184b4,'message':{'from':util['format'](_0xae37('0xec'),_0x1a02a8[_0xae37('0x2f')],_0x1a02a8[_0xae37('0xed')]||_0x1a02a8['Smtp'][_0xae37('0x6f')]),'to':_0x378f3f[_0xae37('0xe9')],'subject':_0x378f3f[_0xae37('0xee')],'html':_0x48b229[_0xae37('0x76')],'attachments':_0x1a692c}},client9003)[_0xae37('0x17')](function(){return _0x48b229;})[_0xae37('0x21')](function(_0x25a3f8){logger[_0xae37('0x1b')](_0x25a3f8);});}})[_0xae37('0x17')](function(){if(_0x378f3f&&_0x378f3f[_0xae37('0xe2')]&&_0x378f3f[_0xae37('0xef')]){var _0x21d848=[];if(_0xcd61e6[_0xae37('0x6c')]){_0x21d848=_0xcd61e6[_0xae37('0x3b')](function(_0x181e36){return{'name':_0x181e36['originalname'],'basename':_0x181e36[_0xae37('0x87')],'type':_0x181e36['mimetype'],'ChatOfflineMessageId':_0x3b1111['id']};});}var _0x15698a;if(!_[_0xae37('0x93')](_0x378f3f['subjectOffline'])){var _0x15373e=_[_0xae37('0x3b')](_0xf15b4f['body'],function(_0x1a2467){return _0x1a2467;});var _0x662677=_[_0xae37('0xf0')](_0x15373e)[0x0];var _0x2bb2ec=_[_0xae37('0xf1')](_0x662677,function(_0x5603ad){return _0x5603ad;});_0x15698a=_0x2bb2ec[0x1][_0x378f3f[_0xae37('0xf2')]];}var _0x212e5f={'from':_0x2234f1['email'],'firstName':_0x2234f1[_0xae37('0xbe')],'lastName':_0x2234f1[_0xae37('0xbf')],'mapKey':_0xae37('0xed'),'message':{'from':_0x2234f1[_0xae37('0xed')],'to':_0x378f3f[_0xae37('0xd7')]['email'],'cc':'','subject':_['isNil'](_0x15698a)?_0x378f3f[_0xae37('0xee')]:_0x15698a,'messageId':'','sentAt':new Date(),'attach':_0x21d848[_0xae37('0x6c')],'attachments':_0x21d848,'originChannel':'Chat','ChatWebsiteId':_0x378f3f['id'],'ChatOfflineMessageId':_0x48b229['id'],'originTo':_0x378f3f['MailAccount'][_0xae37('0xed')]},'body':_0x48b229[_0xae37('0x76')]};var _0x2d04b6={'account':{'id':_0x378f3f[_0xae37('0xef')]},'body':_0x212e5f,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xae37('0xf3'),_0xae37('0xf4'),_0x2d04b6,client9001)[_0xae37('0x17')](function(){return _0x48b229;})[_0xae37('0x21')](function(_0x45b49f){logger[_0xae37('0x1b')](_0x45b49f);});}return;})[_0xae37('0x17')](function(){if(_0x48b229){return _0x48b229;}})[_0xae37('0x17')](respondWithResult(_0x11908a,null))[_0xae37('0x21')](function(){for(var _0x10b636 of _0xcd61e6){var _0xbdf25d=path['join'](config[_0xae37('0x8f')],_0xae37('0xf5'),'files','attachments',_0xae37('0xe0'),_0x10b636['filename']);fs_extra['remove'](_0xbdf25d)[_0xae37('0x21')](function(_0x3ff06a){logger[_0xae37('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0xbdf25d,_0x3ff06a);});}});};exports[_0xae37('0xf6')]=function(_0x3d3dae,_0x35288e){return db[_0xae37('0xbc')][_0xae37('0x73')]({'where':{'id':_0x3d3dae['params']['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x35288e,null))[_0xae37('0x17')](function(_0x19c6d4){if(_0x19c6d4){return _0x19c6d4[_0xae37('0xf6')](_0x3d3dae['body'][_0xae37('0x80')],_[_0xae37('0xf7')](_0x3d3dae[_0xae37('0x76')],['ids','id'])||{});}})['then'](respondWithResult(_0x35288e,null))[_0xae37('0x21')](handleError(_0x35288e,null));};exports['getInteractions']=function(_0x5997dc,_0x3903db){var _0x504800={'raw':![],'where':{}};var _0x3cdc8e={};var _0x1f0139={'count':0x0,'rows':[]};return db[_0xae37('0x54')]['findOne']({'where':{'id':_0x5997dc[_0xae37('0x68')]['id']}})['then'](handleEntityNotFound(_0x3903db,null))[_0xae37('0x17')](function(_0x30ce42){if(_0x30ce42){_0x3cdc8e[_0xae37('0x4f')]=_['keys'](db[_0xae37('0xbc')][_0xae37('0x6a')]);_0x3cdc8e['query']=_[_0xae37('0x58')](_0x5997dc[_0xae37('0x57')]);_0x3cdc8e[_0xae37('0x59')]=_['intersection'](_0x3cdc8e[_0xae37('0x4f')],_0x3cdc8e[_0xae37('0x57')]);_0x504800[_0xae37('0x5a')]=_[_0xae37('0x6b')](_0x3cdc8e[_0xae37('0x4f')],qs[_0xae37('0x5b')](_0x5997dc['query'][_0xae37('0x5b')]));_0x504800[_0xae37('0x5a')]=_0x504800[_0xae37('0x5a')][_0xae37('0x6c')]?_0x504800['attributes']:_0x3cdc8e['model'];if(!_0x5997dc[_0xae37('0x57')][_0xae37('0x5c')](_0xae37('0x5d'))){_0x504800[_0xae37('0x28')]=qs[_0xae37('0x28')](_0x5997dc[_0xae37('0x57')][_0xae37('0x28')]);_0x504800[_0xae37('0x26')]=qs[_0xae37('0x26')](_0x5997dc[_0xae37('0x57')][_0xae37('0x26')]);}_0x504800[_0xae37('0x5e')]=qs['sort'](_0x5997dc[_0xae37('0x57')][_0xae37('0x7d')]);_0x504800[_0xae37('0x5f')]=qs[_0xae37('0x59')](_[_0xae37('0x60')](_0x5997dc['query'],_0x3cdc8e['filters']));_0x504800[_0xae37('0x5f')][_0xae37('0x79')]=_0x30ce42['id'];if(_0x5997dc[_0xae37('0x57')][_0xae37('0x7e')]){_0x504800['where']=_[_0xae37('0x61')](_0x504800['where'],{'$or':_[_0xae37('0x3b')](_0x504800[_0xae37('0x5a')],function(_0x24bd9d){var _0x1b76f4={};_0x1b76f4[_0x24bd9d]={'$like':'%'+_0x5997dc['query']['filter']+'%'};return _0x1b76f4;})});}_0x504800=_[_0xae37('0x61')]({},_0x504800,_0x5997dc['options']);return db['ChatInteraction'][_0xae37('0x29')]({'where':_0x504800[_0xae37('0x5f')]})['then'](function(_0x48a36f){_0x1f0139[_0xae37('0x29')]=_0x48a36f;if(_0x5997dc[_0xae37('0x57')]['includeAll']){_0x504800[_0xae37('0x6d')]=[{'model':db[_0xae37('0xad')],'as':_0xae37('0xf8'),'required':![]},{'model':db[_0xae37('0xc8')],'as':_0xae37('0xf9'),'attributes':['name',_0xae37('0xfa'),'internal'],'required':![]},{'model':db[_0xae37('0xfb')],'as':_0xae37('0xfc'),'attributes':['id',_0xae37('0x2f'),_0xae37('0xfd')],'where':_0x5997dc['query'][_0xae37('0xfe')]?{'id':_0x5997dc[_0xae37('0x57')][_0xae37('0xfe')]}:undefined,'required':_0x5997dc[_0xae37('0x57')][_0xae37('0xfe')]?!![]:![]}];}return db[_0xae37('0xbc')]['findAll'](_0x504800);})[_0xae37('0x17')](function(_0xd42d1d){_0x1f0139[_0xae37('0x66')]=_0xd42d1d;return _0x1f0139;});}})[_0xae37('0x17')](respondWithFilteredResult(_0x3903db,_0x504800))[_0xae37('0x21')](handleError(_0x3903db,null));};exports[_0xae37('0xff')]=function(_0x4bc63b,_0x303460){var _0xa71229=0x0;var _0x4fcf33=0x0;var _0x12c314=![];var _0x1dd219;var _0x238b4d;return db['ChatWebsite']['find']({'where':{'id':_0x4bc63b['params']['id']},'include':[{'model':db['Interval'],'as':_0xae37('0x3c'),'include':[{'model':db[_0xae37('0x3c')],'as':_0xae37('0x3d'),'attributes':['id','interval']}]}]})[_0xae37('0x17')](handleEntityNotFound(_0x303460,null))[_0xae37('0x17')](function(_0x1ce492){if(_0x1ce492){_0x1dd219=_0x1ce492;return _0x1ce492[_0xae37('0x100')]({'raw':!![]});}})[_0xae37('0x17')](function(_0x509a46){if(_0x1dd219){if(_0x509a46){_0x238b4d=_0x509a46;}}return require(_0xae37('0x91'))[_0xae37('0x101')]();})[_0xae37('0x17')](function(_0x463c86){if(_0x463c86){_0x4fcf33=_0x463c86['virtual'];_0x12c314=_0x463c86[_0xae37('0x92')];}})[_0xae37('0x17')](function(){return db[_0xae37('0xbc')][_0xae37('0x29')]({'where':{'closed':![]}});})[_0xae37('0x17')](function(_0x7c85bc){_0xa71229=_0x7c85bc;if(_0x4fcf33&&_0x7c85bc>_0x4fcf33){return db[_0xae37('0x102')][_0xae37('0x7c')]({'where':{'id':0x1}})[_0xae37('0x17')](function(_0x325662){if(_0x325662){_0x325662['increment']('chatLicenseExceeded');}});}})[_0xae37('0x17')](function(){if(!_0x1dd219['Interval']||!_0x1dd219[_0xae37('0x3c')][_0xae37('0x3d')])return!![];return checkWebsiteIntervals(_0x1dd219);})['then'](function(_0x49a366){var _0x591c06=fs[_0xae37('0x103')](path[_0xae37('0x8e')](config[_0xae37('0x8f')],'server/files/chat/iframe.ejs'),_0xae37('0x104'));var _0x46c840=new url[(_0xae37('0x105'))](_0x1dd219[_0xae37('0x106')])[_0xae37('0x107')];var _0x4e48ac='3.5.0';var _0x2ed891=![];var _0x32ea88={'chatVersion':_0x4e48ac,'chatWebsiteAddressOrigin':_0x46c840,'remote':_0x1dd219[_0xae37('0x108')],'query':querystring[_0xae37('0x1a')](_[_0xae37('0x61')](_0x1dd219[_0xae37('0x2d')]({'plain':!![]}),{'customerIp':_0x4bc63b[_0xae37('0x109')][_0xae37('0x45')]||_0x4bc63b[_0xae37('0x109')][_0xae37('0x10a')]||_0x4bc63b[_0xae37('0x10b')][_0xae37('0x10c')]||_0x4bc63b['ip'],'referer':_0x4bc63b[_0xae37('0x109')][_0xae37('0x49')],'openedInteractions':_0xa71229,'maxInteractions':_0x4fcf33,'virtual':_0x12c314[_0xae37('0x10d')],'online':_0x49a366,'custom':_0x12c314}))['replace'](/'/g,'\x5c\x27')};_0x303460[_0xae37('0x30')](ejs[_0xae37('0xda')](Mustache['render'](_0x591c06,_0x32ea88),{'proactiveActions':_0x238b4d,'alignment':_0x1dd219[_0xae37('0x10e')],'verticalAlignment':_0x1dd219['verticalAlignment'],'div_color':_0x1dd219['color'],'labelText':_0x1dd219[_0xae37('0x10f')],'text_color':_0x1dd219[_0xae37('0x110')],'text_button_color':_0x1dd219['textButtonColor'],'button_color':_0x1dd219['color_button'],'background_color':_0x1dd219['backgroundColor'],'hideWhenOffline':_0x1dd219[_0xae37('0x111')],'intervalId':_0x1dd219[_0xae37('0x112')],'isDevelopment':_0x2ed891,'chatVersion':_0x4e48ac}));})[_0xae37('0x21')](handleError(_0x303460,null));};exports['addApplications']=function(_0x2607a0,_0x7377f9){var _0x35fe4d=_0x2607a0['params']['id'];var _0x4fbe06=_0x2607a0[_0xae37('0x76')];var _0x407501=0xc8;var _0x95edaf=null;return db[_0xae37('0xe3')][_0xae37('0xe4')]({'isolationLevel':db[_0xae37('0xe3')]['Transaction'][_0xae37('0x113')][_0xae37('0x114')]},function(_0xc9569d){return db[_0xae37('0x54')]['findOne']({'where':{'id':_0x35fe4d},'transaction':_0xc9569d})[_0xae37('0x17')](function(_0x3c536a){if(_0x3c536a){return db[_0xae37('0xb0')][_0xae37('0x2c')]({'where':{'ChatWebsiteId':_0x35fe4d},'transaction':_0xc9569d})[_0xae37('0x17')](function(){var _0x3bae48=_[_0xae37('0x3b')](_0x4fbe06,function(_0x56a951){_0x56a951['ChatWebsiteId']=_0x35fe4d;return _0x56a951;});return db['ChatApplication'][_0xae37('0xe5')](_0x3bae48,{'transaction':_0xc9569d});});}else{_0x407501=0x194;_0x95edaf=[];}});})[_0xae37('0x17')](function(){if(_0x407501!==0x194){return db['ChatApplication'][_0xae37('0x115')]({'where':{'ChatWebsiteId':_0x35fe4d},'order':_0xae37('0x116')})['then'](function(_0x23000b){_0x95edaf=_0x23000b;});}})[_0xae37('0x21')](function(_0x5ca98d){_0x407501=0x1f4;logger['error'](_0x5ca98d['stack']);if(_0x5ca98d[_0xae37('0x2f')]){delete _0x5ca98d[_0xae37('0x2f')];}_0x95edaf=_0x5ca98d;})[_0xae37('0x117')](function(){if(_0x95edaf===null){_0x7377f9['sendStatus'](_0x407501);}else{if(_0x407501===0x1f4){_0x7377f9[_0xae37('0x23')](_0x407501)[_0xae37('0x30')](_0x95edaf);}else{_0x7377f9[_0xae37('0x23')](_0x407501)['json'](_0x95edaf);}}});};exports[_0xae37('0x118')]=function(_0x4afffc,_0x2ad93b){var _0x359b49={};var _0x14129f={};var _0x5e76bf;var _0x1718b5;return db[_0xae37('0x54')][_0xae37('0x7c')]({'where':{'id':_0x4afffc[_0xae37('0x68')]['id']}})['then'](handleEntityNotFound(_0x2ad93b,null))[_0xae37('0x17')](function(_0xcc1ab1){if(_0xcc1ab1){_0x5e76bf=_0xcc1ab1;_0x14129f[_0xae37('0x4f')]=_['keys'](db[_0xae37('0xb0')][_0xae37('0x6a')]);_0x14129f[_0xae37('0x57')]=_[_0xae37('0x58')](_0x4afffc['query']);_0x14129f['filters']=_['intersection'](_0x14129f['model'],_0x14129f[_0xae37('0x57')]);_0x359b49['attributes']=_[_0xae37('0x6b')](_0x14129f['model'],qs[_0xae37('0x5b')](_0x4afffc[_0xae37('0x57')][_0xae37('0x5b')]));_0x359b49[_0xae37('0x5a')]=_0x359b49[_0xae37('0x5a')]['length']?_0x359b49[_0xae37('0x5a')]:_0x14129f[_0xae37('0x4f')];_0x359b49[_0xae37('0x5e')]=qs[_0xae37('0x7d')](_0x4afffc[_0xae37('0x57')][_0xae37('0x7d')]);_0x359b49[_0xae37('0x5f')]=qs['filters'](_[_0xae37('0x60')](_0x4afffc['query'],_0x14129f[_0xae37('0x59')]));if(_0x4afffc['query']['filter']){_0x359b49[_0xae37('0x5f')]=_['merge'](_0x359b49[_0xae37('0x5f')],{'$or':_[_0xae37('0x3b')](_0x359b49[_0xae37('0x5a')],function(_0x46e098){var _0x49ab72={};_0x49ab72[_0x46e098]={'$like':'%'+_0x4afffc[_0xae37('0x57')]['filter']+'%'};return _0x49ab72;})});}_0x359b49=_[_0xae37('0x61')]({},_0x359b49,_0x4afffc[_0xae37('0x63')]);return _0x5e76bf[_0xae37('0x118')](_0x359b49);}})[_0xae37('0x17')](function(_0x2f22ac){if(_0x2f22ac){_0x1718b5=_0x2f22ac[_0xae37('0x6c')];if(!_0x4afffc[_0xae37('0x57')][_0xae37('0x5c')](_0xae37('0x5d'))){_0x359b49[_0xae37('0x28')]=qs[_0xae37('0x28')](_0x4afffc[_0xae37('0x57')][_0xae37('0x28')]);_0x359b49[_0xae37('0x26')]=qs[_0xae37('0x26')](_0x4afffc[_0xae37('0x57')][_0xae37('0x26')]);}return _0x5e76bf[_0xae37('0x118')](_0x359b49);}})[_0xae37('0x17')](function(_0x322025){if(_0x322025){return _0x322025?{'count':_0x1718b5,'rows':_0x322025}:null;}})[_0xae37('0x17')](respondWithResult(_0x2ad93b,null))[_0xae37('0x21')](handleError(_0x2ad93b,null));};exports['addProactiveActions']=function(_0x3191a6,_0x131758){return db[_0xae37('0x119')][_0xae37('0x73')]({'where':{'id':_0x3191a6[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x131758,null))[_0xae37('0x17')](function(_0x4bfad5){if(_0x4bfad5){return _0x4bfad5['addProactiveActions'](_0x3191a6[_0xae37('0x76')][_0xae37('0x80')],_['omit'](_0x3191a6[_0xae37('0x76')],[_0xae37('0x80'),'id'])||{});}})[_0xae37('0x17')](respondWithResult(_0x131758,null))[_0xae37('0x21')](handleError(_0x131758,null));};exports[_0xae37('0x100')]=function(_0xa7d796,_0x135061){var _0x4d8640={};var _0x33de9f={};var _0x1c985a;var _0x2a5464;return db[_0xae37('0x54')]['findOne']({'where':{'id':_0xa7d796['params']['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x135061,null))[_0xae37('0x17')](function(_0x34f96d){if(_0x34f96d){_0x1c985a=_0x34f96d;_0x33de9f[_0xae37('0x4f')]=_[_0xae37('0x58')](db[_0xae37('0x11a')][_0xae37('0x6a')]);_0x33de9f[_0xae37('0x57')]=_[_0xae37('0x58')](_0xa7d796[_0xae37('0x57')]);_0x33de9f[_0xae37('0x59')]=_[_0xae37('0x6b')](_0x33de9f[_0xae37('0x4f')],_0x33de9f[_0xae37('0x57')]);_0x4d8640[_0xae37('0x5a')]=_['intersection'](_0x33de9f['model'],qs[_0xae37('0x5b')](_0xa7d796[_0xae37('0x57')]['fields']));_0x4d8640['attributes']=_0x4d8640[_0xae37('0x5a')][_0xae37('0x6c')]?_0x4d8640['attributes']:_0x33de9f['model'];_0x4d8640['order']=qs[_0xae37('0x7d')](_0xa7d796[_0xae37('0x57')][_0xae37('0x7d')]);_0x4d8640[_0xae37('0x5f')]=qs[_0xae37('0x59')](_[_0xae37('0x60')](_0xa7d796[_0xae37('0x57')],_0x33de9f[_0xae37('0x59')]));if(_0xa7d796[_0xae37('0x57')]['filter']){_0x4d8640['where']=_[_0xae37('0x61')](_0x4d8640[_0xae37('0x5f')],{'$or':_[_0xae37('0x3b')](_0x4d8640[_0xae37('0x5a')],function(_0x3299ec){var _0xb2faf3={};_0xb2faf3[_0x3299ec]={'$like':'%'+_0xa7d796['query'][_0xae37('0x7e')]+'%'};return _0xb2faf3;})});}_0x4d8640=_[_0xae37('0x61')]({},_0x4d8640,_0xa7d796['options']);return _0x1c985a[_0xae37('0x100')](_0x4d8640);}})['then'](function(_0x5b7900){if(_0x5b7900){_0x2a5464=_0x5b7900['length'];if(!_0xa7d796[_0xae37('0x57')][_0xae37('0x5c')](_0xae37('0x5d'))){_0x4d8640[_0xae37('0x28')]=qs[_0xae37('0x28')](_0xa7d796['query'][_0xae37('0x28')]);_0x4d8640[_0xae37('0x26')]=qs['offset'](_0xa7d796[_0xae37('0x57')][_0xae37('0x26')]);}return _0x1c985a[_0xae37('0x100')](_0x4d8640);}})[_0xae37('0x17')](function(_0xa68616){if(_0xa68616){return _0xa68616?{'count':_0x2a5464,'rows':_0xa68616}:null;}})['then'](respondWithResult(_0x135061,null))['catch'](handleError(_0x135061,null));};exports[_0xae37('0x11b')]=function(_0x3512ad,_0x3e0a74){var _0x25955f=_0x3512ad[_0xae37('0x57')][_0xae37('0x11c')]==='false'?_0xae37('0x11d'):'onlineForm';return db[_0xae37('0x54')][_0xae37('0x73')]({'attributes':['id',_0x25955f],'where':{'id':_0x3512ad['params']['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x3e0a74,null))[_0xae37('0x17')](function(_0x5ad4f1){if(_0x5ad4f1){var _0x14728c=_0x5ad4f1[_0x25955f];var _0x36ff36=_0x14728c&&_0x14728c[_0xae37('0x11e')]?_0x14728c[_0xae37('0x11e')]:[];_0x3e0a74[_0xae37('0x30')]({'fromKey':_['isNil'](_0x14728c['fromKey'])?undefined:_0x14728c['fromKey'],'count':_0x36ff36['length'],'rows':_0x36ff36});}})[_0xae37('0x21')](handleError(_0x3e0a74,null));};exports[_0xae37('0x11f')]=function(_0x5e536a,_0xa8362d){var _0x44eaa4={'raw':![],'where':{}};var _0x33212d={};var _0x471d52={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xae37('0x7c')]({'where':{'id':_0x5e536a[_0xae37('0x68')]['id']}})['then'](handleEntityNotFound(_0xa8362d,null))[_0xae37('0x17')](function(_0x3606f9){if(_0x3606f9){_0x33212d[_0xae37('0x4f')]=_[_0xae37('0x58')](db[_0xae37('0xdc')]['rawAttributes']);_0x33212d['query']=_['keys'](_0x5e536a[_0xae37('0x57')]);_0x33212d[_0xae37('0x59')]=_[_0xae37('0x6b')](_0x33212d[_0xae37('0x4f')],_0x33212d[_0xae37('0x57')]);_0x44eaa4[_0xae37('0x5a')]=_[_0xae37('0x6b')](_0x33212d['model'],qs[_0xae37('0x5b')](_0x5e536a[_0xae37('0x57')][_0xae37('0x5b')]));_0x44eaa4[_0xae37('0x5a')]=_0x44eaa4[_0xae37('0x5a')][_0xae37('0x6c')]?_0x44eaa4[_0xae37('0x5a')]:_0x33212d[_0xae37('0x4f')];if(!_0x5e536a[_0xae37('0x57')][_0xae37('0x5c')](_0xae37('0x5d'))){_0x44eaa4[_0xae37('0x28')]=qs['limit'](_0x5e536a['query'][_0xae37('0x28')]);_0x44eaa4[_0xae37('0x26')]=qs[_0xae37('0x26')](_0x5e536a[_0xae37('0x57')][_0xae37('0x26')]);}_0x44eaa4[_0xae37('0x5e')]=qs['sort'](_0x5e536a[_0xae37('0x57')][_0xae37('0x7d')]);_0x44eaa4[_0xae37('0x5f')]=qs[_0xae37('0x59')](_[_0xae37('0x60')](_0x5e536a[_0xae37('0x57')],_0x33212d[_0xae37('0x59')]));_0x44eaa4['where'][_0xae37('0x79')]=_0x3606f9['id'];if(_0x5e536a['query']['filter']){_0x44eaa4[_0xae37('0x5f')]=_['merge'](_0x44eaa4[_0xae37('0x5f')],{'$or':_[_0xae37('0x3b')](_0x44eaa4[_0xae37('0x5a')],function(_0x50b6ed){var _0x2f7d6c={};_0x2f7d6c[_0x50b6ed]={'$like':'%'+_0x5e536a[_0xae37('0x57')]['filter']+'%'};return _0x2f7d6c;})});}_0x44eaa4=_[_0xae37('0x61')]({},_0x44eaa4,_0x5e536a[_0xae37('0x63')]);return db[_0xae37('0xdc')][_0xae37('0x29')]({'where':_0x44eaa4['where']})[_0xae37('0x17')](function(_0x4edf14){_0x471d52['count']=_0x4edf14;if(_0x5e536a[_0xae37('0x57')][_0xae37('0x64')]){_0x44eaa4['include']=[{'all':!![]}];}else{_0x44eaa4[_0xae37('0x6d')]=[{'model':db[_0xae37('0xad')],'as':_0xae37('0xf8'),'required':![]},{'model':db[_0xae37('0x120')],'as':_0xae37('0x121'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x44eaa4);})['then'](function(_0x33bcf1){_0x471d52[_0xae37('0x66')]=_0x33bcf1;return _0x471d52;});}})[_0xae37('0x17')](respondWithFilteredResult(_0xa8362d,_0x44eaa4))[_0xae37('0x21')](handleError(_0xa8362d,null));};exports['addAgents']=function(_0x43071e,_0xaea7af){return db[_0xae37('0x54')][_0xae37('0x73')]({'where':{'id':_0x43071e[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0xaea7af,null))['then'](function(_0x4334ee){if(_0x4334ee){return _0x4334ee['addAgents'](_0x43071e[_0xae37('0x76')]['ids'],_[_0xae37('0xf7')](_0x43071e[_0xae37('0x76')],['ids','id'])||{})['spread'](function(_0x4a1996){for(var _0x43f3f9=0x0;_0x43f3f9<_0x43071e[_0xae37('0x76')][_0xae37('0x80')][_0xae37('0x6c')];_0x43f3f9+=0x1){socket[_0xae37('0x122')](_0xae37('0x123'),{'UserId':Number(_0x43071e['body']['ids'][_0x43f3f9]),'ChatWebsiteId':Number(_0x43071e[_0xae37('0x68')]['id'])});}return _0x4a1996;});}})['then'](respondWithResult(_0xaea7af,null))[_0xae37('0x21')](handleError(_0xaea7af,null));};exports[_0xae37('0x124')]=function(_0x4afae3,_0x4a4a4c){return db['ChatWebsite']['find']({'where':{'id':_0x4afae3[_0xae37('0x68')]['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x4a4a4c,null))[_0xae37('0x17')](function(_0x7c615e){if(_0x7c615e){return _0x7c615e[_0xae37('0x124')](_0x4afae3[_0xae37('0x57')][_0xae37('0x80')])[_0xae37('0x17')](function(){if(_['isArray'](_0x4afae3[_0xae37('0x57')][_0xae37('0x80')])){for(var _0xb70b6f=0x0;_0xb70b6f<_0x4afae3['query'][_0xae37('0x80')][_0xae37('0x6c')];_0xb70b6f+=0x1){socket[_0xae37('0x122')](_0xae37('0x125'),{'UserId':Number(_0x4afae3[_0xae37('0x57')][_0xae37('0x80')][_0xb70b6f]),'ChatWebsiteId':Number(_0x4afae3[_0xae37('0x68')]['id'])});}}else{socket['emit'](_0xae37('0x125'),{'UserId':Number(_0x4afae3[_0xae37('0x57')][_0xae37('0x80')]),'ChatWebsiteId':Number(_0x4afae3[_0xae37('0x68')]['id'])});}});}})[_0xae37('0x17')](respondWithStatusCode(_0x4a4a4c,null))['catch'](handleError(_0x4a4a4c,null));};exports['getAgents']=function(_0x56278a,_0x2f1471){var _0x2a4938={};var _0x184469={};var _0x3b1b62;var _0x265fef;return db[_0xae37('0x54')][_0xae37('0x7c')]({'where':{'id':_0x56278a['params']['id']}})[_0xae37('0x17')](handleEntityNotFound(_0x2f1471,null))[_0xae37('0x17')](function(_0x2c1432){if(_0x2c1432){_0x3b1b62=_0x2c1432;_0x184469[_0xae37('0x4f')]=_[_0xae37('0x58')](db[_0xae37('0xc8')]['rawAttributes']);_0x184469[_0xae37('0x57')]=_[_0xae37('0x58')](_0x56278a['query']);_0x184469['filters']=_[_0xae37('0x6b')](_0x184469[_0xae37('0x4f')],_0x184469[_0xae37('0x57')]);_0x2a4938[_0xae37('0x5a')]=_[_0xae37('0x6b')](_0x184469[_0xae37('0x4f')],qs[_0xae37('0x5b')](_0x56278a['query']['fields']));_0x2a4938[_0xae37('0x5a')]=_0x2a4938[_0xae37('0x5a')][_0xae37('0x6c')]?_0x2a4938[_0xae37('0x5a')]:_0x184469['model'];_0x2a4938[_0xae37('0x5e')]=qs[_0xae37('0x7d')](_0x56278a[_0xae37('0x57')][_0xae37('0x7d')]);_0x2a4938['where']=qs['filters'](_[_0xae37('0x60')](_0x56278a[_0xae37('0x57')],_0x184469['filters']));if(_0x56278a['query'][_0xae37('0x7e')]){_0x2a4938[_0xae37('0x5f')]=_[_0xae37('0x61')](_0x2a4938[_0xae37('0x5f')],{'$or':_[_0xae37('0x3b')](_0x2a4938[_0xae37('0x5a')],function(_0xda617c){var _0x1e83d7={};_0x1e83d7[_0xda617c]={'$like':'%'+_0x56278a[_0xae37('0x57')][_0xae37('0x7e')]+'%'};return _0x1e83d7;})});}_0x2a4938=_['merge']({},_0x2a4938,_0x56278a[_0xae37('0x63')]);return _0x3b1b62[_0xae37('0x126')](_0x2a4938);}})[_0xae37('0x17')](function(_0x3e62cf){if(_0x3e62cf){_0x265fef=_0x3e62cf['length'];if(!_0x56278a[_0xae37('0x57')]['hasOwnProperty']('nolimit')){_0x2a4938[_0xae37('0x28')]=qs['limit'](_0x56278a[_0xae37('0x57')][_0xae37('0x28')]);_0x2a4938[_0xae37('0x26')]=qs[_0xae37('0x26')](_0x56278a[_0xae37('0x57')][_0xae37('0x26')]);}return _0x3b1b62[_0xae37('0x126')](_0x2a4938);}})[_0xae37('0x17')](function(_0x535649){if(_0x535649){return _0x535649?{'count':_0x265fef,'rows':_0x535649}:null;}})[_0xae37('0x17')](respondWithResult(_0x2f1471,null))['catch'](handleError(_0x2f1471,null));}; \ No newline at end of file +var _0x70e0=['getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','Chat','NotifyMailAccount','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','hasOwnProperty','Owner','fullname','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','../../config/license/util','License','increment','chatLicenseExceeded','all','some','URL','origin','remote','x-real-ip','connection','remoteAddress','virtual','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','false','onlineForm','items','fromKey','Contact','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','fs-extra','lodash','querystring','ioredis','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','type','key','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','intersection','create','user','get','role','ChatWebsites','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','ChatWebsiteId','pick','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','DESC','ChatApplication','Applications','List','applications','orderBy','priority','account','Contacts','contact','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','files','CompanyId','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress'];(function(_0x4fe35d,_0x21fee1){var _0x5bb28e=function(_0x214051){while(--_0x214051){_0x4fe35d['push'](_0x4fe35d['shift']());}};_0x5bb28e(++_0x21fee1);}(_0x70e0,0x17b));var _0x070e=function(_0x37f1d9,_0x95a04f){_0x37f1d9=_0x37f1d9-0x0;var _0x47413d=_0x70e0[_0x37f1d9];return _0x47413d;};'use strict';var BPromise=require(_0x070e('0x0'));var Mustache=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x070e('0x3'));var _=require(_0x070e('0x4'));var querystring=require(_0x070e('0x5'));var Redis=require(_0x070e('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x070e('0x7'))('api');var config=require(_0x070e('0x8'));var url=require('url');var db=require('../../mysqldb')['db'];config['redis']=_[_0x070e('0x9')](config[_0x070e('0xa')],{'host':_0x070e('0xb'),'port':0x18eb});var socket=require(_0x070e('0xc'))(new Redis(config[_0x070e('0xa')]));require(_0x070e('0xd'))[_0x070e('0xe')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0x070e('0xf')][_0x070e('0x10')]({'port':0x232c});var client9002=jayson[_0x070e('0xf')][_0x070e('0x10')]({'port':0x232a});var client9003=jayson[_0x070e('0xf')][_0x070e('0x10')]({'port':0x232b});var client9001=jayson[_0x070e('0xf')][_0x070e('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x39d2b9,_0x5bf079,_0x2930b8,_0x52da3b){return new BPromise(function(_0x5dca0f,_0x24baba){var _0x56c7ba=_0x52da3b||client;return _0x56c7ba['request'](_0x39d2b9,_0x2930b8)['then'](function(_0x11d2ce){logger[_0x070e('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x5bf079,'request\x20sent');logger[_0x070e('0x12')](_0x070e('0x13'),_0x5bf079,_0x070e('0x14'),JSON[_0x070e('0x15')](_0x11d2ce));if(_0x11d2ce['error']){if(_0x11d2ce['error'][_0x070e('0x16')]===0x1f4){logger[_0x070e('0x17')](_0x070e('0x18'),_0x5bf079,_0x11d2ce[_0x070e('0x17')][_0x070e('0x19')]);return _0x24baba(_0x11d2ce['error'][_0x070e('0x19')]);}logger[_0x070e('0x17')](_0x070e('0x18'),_0x5bf079,_0x11d2ce[_0x070e('0x17')][_0x070e('0x19')]);return _0x5dca0f(_0x11d2ce['error']['message']);}else{logger['info'](_0x070e('0x18'),_0x5bf079,_0x070e('0x14'));_0x5dca0f(_0x11d2ce[_0x070e('0x1a')]['message']);}})[_0x070e('0x1b')](function(_0x5dc5d2){logger[_0x070e('0x17')](_0x070e('0x18'),_0x5bf079,_0x5dc5d2);_0x24baba(_0x5dc5d2);});});}function respondWithStatusCode(_0x27a01e,_0x33e8c6){_0x33e8c6=_0x33e8c6||0xcc;return function(_0x28a1c3){if(_0x28a1c3){return _0x27a01e[_0x070e('0x1c')](_0x33e8c6);}return _0x27a01e[_0x070e('0x1d')](_0x33e8c6)[_0x070e('0x1e')]();};}function respondWithResult(_0x595c7e,_0x2f8055){_0x2f8055=_0x2f8055||0xc8;return function(_0x270061){if(_0x270061){return _0x595c7e[_0x070e('0x1d')](_0x2f8055)['json'](_0x270061);}};}function respondWithFilteredResult(_0xf17c56,_0x5f3e9d){return function(_0x4a2dbd){if(_0x4a2dbd){var _0x2ccbd7=typeof _0x5f3e9d[_0x070e('0x1f')]===_0x070e('0x20')&&typeof _0x5f3e9d[_0x070e('0x21')]===_0x070e('0x20');var _0x497f58=_0x4a2dbd[_0x070e('0x22')];var _0x219e48=_0x2ccbd7?0x0:_0x5f3e9d[_0x070e('0x1f')];var _0x1d2a34=_0x2ccbd7?_0x4a2dbd[_0x070e('0x22')]:_0x5f3e9d[_0x070e('0x1f')]+_0x5f3e9d[_0x070e('0x21')];var _0x26373b;if(_0x1d2a34>=_0x497f58){_0x1d2a34=_0x497f58;_0x26373b=0xc8;}else{_0x26373b=0xce;}_0xf17c56['status'](_0x26373b);return _0xf17c56[_0x070e('0x23')](_0x070e('0x24'),_0x219e48+'-'+_0x1d2a34+'/'+_0x497f58)[_0x070e('0x25')](_0x4a2dbd);}return null;};}function saveUpdates(_0x56fc12){return function(_0x5c5f0d){if(_0x5c5f0d){return _0x5c5f0d[_0x070e('0x26')](_0x56fc12)[_0x070e('0x27')](function(_0xa6c0ab){return _0xa6c0ab;});}return null;};}function removeEntity(_0x51402c){return function(_0x3fa994){if(_0x3fa994){return _0x3fa994[_0x070e('0x28')]()[_0x070e('0x27')](function(){var _0x5f2bee=_0x3fa994['get']({'plain':!![]});var _0x5bf522='ChatWebsites';return db['UserProfileResource'][_0x070e('0x28')]({'where':{'type':_0x5bf522,'resourceId':_0x5f2bee['id']}})['then'](function(){return _0x3fa994;});})[_0x070e('0x27')](function(){_0x51402c[_0x070e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a739){return function(_0x699739){if(!_0x699739){_0x47a739[_0x070e('0x1c')](0x194);}return _0x699739;};}function handleError(_0x55288a,_0x546a16){_0x546a16=_0x546a16||0x1f4;return function(_0x41ade4){logger[_0x070e('0x17')](_0x41ade4[_0x070e('0x29')]);if(_0x41ade4[_0x070e('0x2a')]){delete _0x41ade4[_0x070e('0x2a')];}_0x55288a['status'](_0x546a16)['send'](_0x41ade4);};}exports[_0x070e('0x2b')]=function(_0x3011c4,_0x4bb439){var _0xf57ed={'include':[{'model':db[_0x070e('0x2c')],'as':_0x070e('0x2d')}]},_0xf11439={},_0x4deaf8={'count':0x0,'rows':[]};var _0x534150=_[_0x070e('0x2e')](db[_0x070e('0x2f')]['rawAttributes'],function(_0x4d4ee8){return{'name':_0x4d4ee8['fieldName'],'type':_0x4d4ee8[_0x070e('0x30')][_0x070e('0x31')]};});_0xf11439[_0x070e('0x32')]=_[_0x070e('0x2e')](_0x534150,_0x070e('0x2a'));_0xf11439['query']=_[_0x070e('0x33')](_0x3011c4[_0x070e('0x34')]);_0xf11439[_0x070e('0x35')]=_['intersection'](_0xf11439[_0x070e('0x32')],_0xf11439[_0x070e('0x34')]);_0xf57ed[_0x070e('0x36')]=_['intersection'](_0xf11439[_0x070e('0x32')],qs[_0x070e('0x37')](_0x3011c4['query'][_0x070e('0x37')]));_0xf57ed['attributes']=_0xf57ed[_0x070e('0x36')][_0x070e('0x38')]?_0xf57ed[_0x070e('0x36')]:_0xf11439[_0x070e('0x32')];if(!_0x3011c4[_0x070e('0x34')]['hasOwnProperty'](_0x070e('0x39'))){_0xf57ed['limit']=qs['limit'](_0x3011c4[_0x070e('0x34')][_0x070e('0x21')]);_0xf57ed[_0x070e('0x1f')]=qs['offset'](_0x3011c4[_0x070e('0x34')][_0x070e('0x1f')]);}_0xf57ed[_0x070e('0x3a')]=qs[_0x070e('0x3b')](_0x3011c4['query'][_0x070e('0x3b')]);_0xf57ed['where']=qs['filters'](_['pick'](_0x3011c4[_0x070e('0x34')],_0xf11439[_0x070e('0x35')]),_0x534150);if(_0x3011c4[_0x070e('0x34')][_0x070e('0x3c')]){_0xf57ed[_0x070e('0x3d')]=_['merge'](_0xf57ed[_0x070e('0x3d')],{'$or':_['map'](_0x534150,function(_0x23dac5){if(_0x23dac5[_0x070e('0x30')]!==_0x070e('0x3e')){var _0x52fcea={};_0x52fcea[_0x23dac5['name']]={'$like':'%'+_0x3011c4[_0x070e('0x34')]['filter']+'%'};return _0x52fcea;}})});}_0xf57ed=_[_0x070e('0x3f')]({},_0xf57ed,_0x3011c4[_0x070e('0x40')]);var _0x139820={'where':_0xf57ed['where']};return db[_0x070e('0x2f')][_0x070e('0x22')](_0x139820)['then'](function(_0x589b97){_0x4deaf8[_0x070e('0x22')]=_0x589b97;if(_0x3011c4[_0x070e('0x34')][_0x070e('0x41')]){_0xf57ed[_0x070e('0x42')]=[{'all':!![]}];}return db[_0x070e('0x2f')]['findAll'](_0xf57ed);})[_0x070e('0x27')](function(_0x3f6c64){_0x4deaf8[_0x070e('0x43')]=_0x3f6c64;return _0x4deaf8;})[_0x070e('0x27')](respondWithFilteredResult(_0x4bb439,_0xf57ed))[_0x070e('0x1b')](handleError(_0x4bb439,null));};exports[_0x070e('0x44')]=function(_0x1f54d5,_0x1b5374){var _0xd67987={'raw':![],'where':{'id':_0x1f54d5[_0x070e('0x45')]['id']},'include':[{'model':db[_0x070e('0x2c')],'as':_0x070e('0x2d')}]},_0x66a3f3={};_0x66a3f3[_0x070e('0x32')]=_[_0x070e('0x33')](db['ChatWebsite'][_0x070e('0x46')]);_0x66a3f3[_0x070e('0x34')]=_[_0x070e('0x33')](_0x1f54d5[_0x070e('0x34')]);_0x66a3f3[_0x070e('0x35')]=_[_0x070e('0x47')](_0x66a3f3[_0x070e('0x32')],_0x66a3f3[_0x070e('0x34')]);_0xd67987[_0x070e('0x36')]=_['intersection'](_0x66a3f3[_0x070e('0x32')],qs['fields'](_0x1f54d5[_0x070e('0x34')][_0x070e('0x37')]));_0xd67987['attributes']=_0xd67987[_0x070e('0x36')][_0x070e('0x38')]?_0xd67987[_0x070e('0x36')]:_0x66a3f3[_0x070e('0x32')];if(_0x1f54d5[_0x070e('0x34')][_0x070e('0x41')]){_0xd67987[_0x070e('0x42')]=[{'all':!![]}];}_0xd67987=_['merge']({},_0xd67987,_0x1f54d5[_0x070e('0x40')]);return db['ChatWebsite']['find'](_0xd67987)[_0x070e('0x27')](handleEntityNotFound(_0x1b5374,null))[_0x070e('0x27')](respondWithResult(_0x1b5374,null))[_0x070e('0x1b')](handleError(_0x1b5374,null));};exports[_0x070e('0x48')]=function(_0x202015,_0x7948ed){return db[_0x070e('0x2f')][_0x070e('0x48')](_0x202015['body'],{})[_0x070e('0x27')](function(_0x51d27d){var _0x564d82=_0x202015[_0x070e('0x49')][_0x070e('0x4a')]({'plain':!![]});if(!_0x564d82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x564d82[_0x070e('0x4b')]===_0x070e('0x49')){var _0x210f4a=_0x51d27d[_0x070e('0x4a')]({'plain':!![]});var _0x1aacfc=_0x070e('0x4c');return db[_0x070e('0x4d')]['find']({'where':{'name':_0x1aacfc,'userProfileId':_0x564d82['userProfileId']},'raw':!![]})['then'](function(_0x3087e5){if(_0x3087e5&&_0x3087e5[_0x070e('0x4e')]===0x0){return db[_0x070e('0x4f')][_0x070e('0x48')]({'name':_0x210f4a['name'],'resourceId':_0x210f4a['id'],'type':_0x3087e5[_0x070e('0x2a')],'sectionId':_0x3087e5['id']},{})['then'](function(){return _0x51d27d;});}else{return _0x51d27d;}})[_0x070e('0x1b')](function(_0x1cbb7e){logger[_0x070e('0x17')](_0x070e('0x50'),_0x1cbb7e);throw _0x1cbb7e;});}return _0x51d27d;})[_0x070e('0x27')](respondWithResult(_0x7948ed,0xc9))[_0x070e('0x1b')](handleError(_0x7948ed,null));};exports['update']=function(_0x20ff87,_0x18e8d0){if(_0x20ff87[_0x070e('0x51')]['id']){delete _0x20ff87['body']['id'];}return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x20ff87['params']['id']},'include':[{'model':db[_0x070e('0x2c')],'as':'mandatoryDispositionPause'}]})[_0x070e('0x27')](handleEntityNotFound(_0x18e8d0,null))['then'](saveUpdates(_0x20ff87['body'],null))['then'](respondWithResult(_0x18e8d0,null))[_0x070e('0x1b')](handleError(_0x18e8d0,null));};exports[_0x070e('0x28')]=function(_0x1100d8,_0x122198){return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x1100d8['params']['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x122198,null))['then'](removeEntity(_0x122198,null))[_0x070e('0x1b')](handleError(_0x122198,null));};exports['describe']=function(_0x2e10f7,_0x34f410){return db['ChatWebsite'][_0x070e('0x53')]()['then'](respondWithResult(_0x34f410,null))[_0x070e('0x1b')](handleError(_0x34f410,null));};exports[_0x070e('0x54')]=function(_0x2f1604,_0x2b172a){if(_0x2f1604[_0x070e('0x51')]['id']){delete _0x2f1604[_0x070e('0x51')]['id'];}return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x2f1604[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x2b172a,null))[_0x070e('0x27')](function(_0x16887c){if(_0x16887c){_0x2f1604[_0x070e('0x51')][_0x070e('0x55')]=_0x16887c['id'];return db['Disposition'][_0x070e('0x48')](_0x2f1604[_0x070e('0x51')]);}})[_0x070e('0x27')](respondWithResult(_0x2b172a,null))[_0x070e('0x1b')](handleError(_0x2b172a,null));};exports['getDispositions']=function(_0x2ccd8d,_0x4e8e58){var _0x398f54={'raw':![],'where':{}};var _0x5625a9={};var _0x2a7b5d={'count':0x0,'rows':[]};return db[_0x070e('0x2f')]['findOne']({'where':{'id':_0x2ccd8d[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x4e8e58,null))[_0x070e('0x27')](function(_0x2fe202){if(_0x2fe202){_0x5625a9['model']=_[_0x070e('0x33')](db['Disposition'][_0x070e('0x46')]);_0x5625a9[_0x070e('0x34')]=_[_0x070e('0x33')](_0x2ccd8d[_0x070e('0x34')]);_0x5625a9[_0x070e('0x35')]=_['intersection'](_0x5625a9[_0x070e('0x32')],_0x5625a9[_0x070e('0x34')]);_0x398f54[_0x070e('0x36')]=_[_0x070e('0x47')](_0x5625a9['model'],qs[_0x070e('0x37')](_0x2ccd8d['query'][_0x070e('0x37')]));_0x398f54[_0x070e('0x36')]=_0x398f54[_0x070e('0x36')]['length']?_0x398f54[_0x070e('0x36')]:_0x5625a9['model'];if(!_0x2ccd8d[_0x070e('0x34')]['hasOwnProperty'](_0x070e('0x39'))){_0x398f54[_0x070e('0x21')]=qs['limit'](_0x2ccd8d[_0x070e('0x34')]['limit']);_0x398f54[_0x070e('0x1f')]=qs[_0x070e('0x1f')](_0x2ccd8d['query']['offset']);}_0x398f54[_0x070e('0x3a')]=qs[_0x070e('0x3b')](_0x2ccd8d[_0x070e('0x34')][_0x070e('0x3b')]);_0x398f54[_0x070e('0x3d')]=qs[_0x070e('0x35')](_[_0x070e('0x56')](_0x2ccd8d[_0x070e('0x34')],_0x5625a9[_0x070e('0x35')]));_0x398f54[_0x070e('0x3d')][_0x070e('0x55')]=_0x2fe202['id'];if(_0x2ccd8d[_0x070e('0x34')][_0x070e('0x3c')]){_0x398f54['where']=_[_0x070e('0x3f')](_0x398f54[_0x070e('0x3d')],{'$or':_['map'](_0x398f54['attributes'],function(_0x1916f4){var _0x2a4de5={};_0x2a4de5[_0x1916f4]={'$like':'%'+_0x2ccd8d[_0x070e('0x34')][_0x070e('0x3c')]+'%'};return _0x2a4de5;})});}_0x398f54=_[_0x070e('0x3f')]({},_0x398f54,_0x2ccd8d[_0x070e('0x40')]);return db[_0x070e('0x57')][_0x070e('0x22')]({'where':_0x398f54[_0x070e('0x3d')]})[_0x070e('0x27')](function(_0x62800d){_0x2a7b5d[_0x070e('0x22')]=_0x62800d;if(_0x2ccd8d[_0x070e('0x34')]['includeAll']){_0x398f54['include']=[{'all':!![]}];}return db['Disposition'][_0x070e('0x58')](_0x398f54);})[_0x070e('0x27')](function(_0x2c4e67){_0x2a7b5d[_0x070e('0x43')]=_0x2c4e67;return _0x2a7b5d;});}})['then'](respondWithFilteredResult(_0x4e8e58,_0x398f54))[_0x070e('0x1b')](handleError(_0x4e8e58,null));};exports[_0x070e('0x59')]=function(_0x416dde,_0xd74f9c){return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x416dde['params']['id']}})[_0x070e('0x27')](handleEntityNotFound(_0xd74f9c,null))['then'](function(_0x2e5bca){if(_0x2e5bca){return _0x2e5bca[_0x070e('0x59')](_0x416dde[_0x070e('0x34')][_0x070e('0x5a')]);}})[_0x070e('0x27')](respondWithStatusCode(_0xd74f9c,null))['catch'](handleError(_0xd74f9c,null));};exports[_0x070e('0x5b')]=function(_0x15450f,_0x5d3bd8){if(_0x15450f[_0x070e('0x51')]['id']){delete _0x15450f[_0x070e('0x51')]['id'];}return db['ChatWebsite'][_0x070e('0x52')]({'where':{'id':_0x15450f[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x5d3bd8,null))['then'](function(_0x40d7e6){if(_0x40d7e6){_0x15450f[_0x070e('0x51')][_0x070e('0x55')]=_0x40d7e6['id'];return db[_0x070e('0x5c')][_0x070e('0x48')](_0x15450f[_0x070e('0x51')]);}})[_0x070e('0x27')](respondWithResult(_0x5d3bd8,null))[_0x070e('0x1b')](handleError(_0x5d3bd8,null));};exports[_0x070e('0x5d')]=function(_0x31ab81,_0x1b1a0c){var _0x46d2b7={'raw':![],'where':{}};var _0x18c27a={};var _0x4b058d={'count':0x0,'rows':[]};return db[_0x070e('0x2f')][_0x070e('0x5e')]({'where':{'id':_0x31ab81[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x1b1a0c,null))[_0x070e('0x27')](function(_0x1d1aa2){if(_0x1d1aa2){_0x18c27a['model']=_['keys'](db['CannedAnswer'][_0x070e('0x46')]);_0x18c27a[_0x070e('0x34')]=_[_0x070e('0x33')](_0x31ab81[_0x070e('0x34')]);_0x18c27a['filters']=_[_0x070e('0x47')](_0x18c27a[_0x070e('0x32')],_0x18c27a[_0x070e('0x34')]);_0x46d2b7['attributes']=_[_0x070e('0x47')](_0x18c27a['model'],qs[_0x070e('0x37')](_0x31ab81[_0x070e('0x34')]['fields']));_0x46d2b7['attributes']=_0x46d2b7[_0x070e('0x36')][_0x070e('0x38')]?_0x46d2b7['attributes']:_0x18c27a[_0x070e('0x32')];if(!_0x31ab81['query']['hasOwnProperty']('nolimit')){_0x46d2b7[_0x070e('0x21')]=qs[_0x070e('0x21')](_0x31ab81[_0x070e('0x34')][_0x070e('0x21')]);_0x46d2b7[_0x070e('0x1f')]=qs[_0x070e('0x1f')](_0x31ab81[_0x070e('0x34')][_0x070e('0x1f')]);}_0x46d2b7[_0x070e('0x3a')]=qs[_0x070e('0x3b')](_0x31ab81[_0x070e('0x34')][_0x070e('0x3b')]);_0x46d2b7[_0x070e('0x3d')]=qs[_0x070e('0x35')](_[_0x070e('0x56')](_0x31ab81[_0x070e('0x34')],_0x18c27a[_0x070e('0x35')]));_0x46d2b7[_0x070e('0x3d')][_0x070e('0x55')]=_0x1d1aa2['id'];if(_0x31ab81[_0x070e('0x34')][_0x070e('0x3c')]){_0x46d2b7[_0x070e('0x3d')]=_['merge'](_0x46d2b7[_0x070e('0x3d')],{'$or':_[_0x070e('0x2e')](_0x46d2b7[_0x070e('0x36')],function(_0xe50b1b){var _0x495403={};_0x495403[_0xe50b1b]={'$like':'%'+_0x31ab81[_0x070e('0x34')][_0x070e('0x3c')]+'%'};return _0x495403;})});}_0x46d2b7=_[_0x070e('0x3f')]({},_0x46d2b7,_0x31ab81[_0x070e('0x40')]);return db[_0x070e('0x5c')][_0x070e('0x22')]({'where':_0x46d2b7['where']})['then'](function(_0x524a81){_0x4b058d[_0x070e('0x22')]=_0x524a81;if(_0x31ab81['query'][_0x070e('0x41')]){_0x46d2b7[_0x070e('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0x070e('0x58')](_0x46d2b7);})[_0x070e('0x27')](function(_0x4f9a95){_0x4b058d['rows']=_0x4f9a95;return _0x4b058d;});}})[_0x070e('0x27')](respondWithFilteredResult(_0x1b1a0c,_0x46d2b7))[_0x070e('0x1b')](handleError(_0x1b1a0c,null));};exports[_0x070e('0x5f')]=function(_0x38f600,_0x6149cc){return db['ChatWebsite'][_0x070e('0x52')]({'where':{'id':_0x38f600['params']['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x6149cc,null))[_0x070e('0x27')](function(_0x490641){if(_0x490641){return _0x490641[_0x070e('0x5f')](_0x38f600[_0x070e('0x34')][_0x070e('0x5a')]);}})[_0x070e('0x27')](respondWithStatusCode(_0x6149cc,null))[_0x070e('0x1b')](handleError(_0x6149cc,null));};exports[_0x070e('0x60')]=function(_0x4bc490,_0x41a3cc){_0x4bc490[_0x070e('0x51')][_0x070e('0x61')]=_0x4bc490[_0x070e('0x62')][_0x070e('0x63')];return db['ChatWebsite'][_0x070e('0x52')]({'where':{'id':_0x4bc490[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x41a3cc,null))[_0x070e('0x27')](saveUpdates(_0x4bc490[_0x070e('0x51')],null))[_0x070e('0x27')](respondWithResult(_0x41a3cc,null))[_0x070e('0x1b')](handleError(_0x41a3cc,null));};exports[_0x070e('0x64')]=function(_0x1fb1e6,_0xfe61be){_0x1fb1e6[_0x070e('0x51')][_0x070e('0x65')]=_0x1fb1e6[_0x070e('0x62')][_0x070e('0x63')];return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x1fb1e6['params']['id']}})['then'](handleEntityNotFound(_0xfe61be,null))[_0x070e('0x27')](saveUpdates(_0x1fb1e6[_0x070e('0x51')],null))['then'](respondWithResult(_0xfe61be,null))['catch'](handleError(_0xfe61be,null));};exports['addCustomerAvatar']=function(_0x4cb7b2,_0x1a430d){_0x4cb7b2[_0x070e('0x51')][_0x070e('0x66')]=_0x4cb7b2[_0x070e('0x62')][_0x070e('0x63')];return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x4cb7b2[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x1a430d,null))[_0x070e('0x27')](saveUpdates(_0x4cb7b2['body'],null))[_0x070e('0x27')](respondWithResult(_0x1a430d,null))[_0x070e('0x1b')](handleError(_0x1a430d,null));};exports['addSystemAvatar']=function(_0x30db4a,_0x2890ba){_0x30db4a[_0x070e('0x51')][_0x070e('0x67')]=_0x30db4a['file'][_0x070e('0x63')];return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x30db4a[_0x070e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2890ba,null))[_0x070e('0x27')](saveUpdates(_0x30db4a[_0x070e('0x51')],null))[_0x070e('0x27')](respondWithResult(_0x2890ba,null))[_0x070e('0x1b')](handleError(_0x2890ba,null));};exports[_0x070e('0x68')]=function(_0x27b51c,_0x1a4ed1){var _0xb2cca5=path[_0x070e('0x69')](config[_0x070e('0x6a')],_0x070e('0x6b'));var _0x479888={'where':{'id':_0x27b51c[_0x070e('0x45')]['id']},'attributes':['id',_0x070e('0x61')],'raw':!![]};var _0x5e3263=![];return require('../../config/license/util')[_0x070e('0x6c')]()['then'](function(_0x2c759a){if(_0x2c759a){_0x5e3263=_0x2c759a[_0x070e('0x6d')];}})[_0x070e('0x27')](function(){return db[_0x070e('0x2f')][_0x070e('0x52')](_0x479888);})[_0x070e('0x27')](handleEntityNotFound(_0x1a4ed1,null))[_0x070e('0x27')](function(_0x5186d8){if(_0x5186d8){if(!_[_0x070e('0x6e')](_0x5186d8[_0x070e('0x61')])){if(fs[_0x070e('0x6f')](path[_0x070e('0x69')](config['root'],'server/files/images/logos/',_0x5186d8[_0x070e('0x61')]))&&_0x5e3263){_0xb2cca5=path[_0x070e('0x69')](config[_0x070e('0x6a')],'server/files/images/logos/',_0x5186d8[_0x070e('0x61')]);}}return _0x1a4ed1[_0x070e('0x70')](_0xb2cca5);}})['catch'](handleError(_0x1a4ed1,null));};exports[_0x070e('0x71')]=function(_0x344289,_0x7af3cd){var _0x33009c=path[_0x070e('0x69')](config[_0x070e('0x6a')],'server/files/images/avatars/default_avatar.png');var _0x58c3d7={'where':{'id':_0x344289[_0x070e('0x45')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x070e('0x2f')][_0x070e('0x52')](_0x58c3d7)['then'](handleEntityNotFound(_0x7af3cd,null))[_0x070e('0x27')](function(_0x4b80b9){if(_0x4b80b9){if(!_[_0x070e('0x6e')](_0x4b80b9[_0x070e('0x65')])){if(fs[_0x070e('0x6f')](path[_0x070e('0x69')](config[_0x070e('0x6a')],_0x070e('0x72'),_0x4b80b9['agentAvatar']))){_0x33009c=path[_0x070e('0x69')](config[_0x070e('0x6a')],'server/files/images/avatars/',_0x4b80b9['agentAvatar']);}}return _0x7af3cd[_0x070e('0x70')](_0x33009c);}})[_0x070e('0x1b')](handleError(_0x7af3cd,null));};exports[_0x070e('0x73')]=function(_0x13ffd9,_0x3893a5){var _0x3e2c30=path[_0x070e('0x69')](config[_0x070e('0x6a')],'server/files/images/avatars/customer_avatar.png');var _0x1deb2a={'where':{'id':_0x13ffd9[_0x070e('0x45')]['id']},'attributes':['id',_0x070e('0x66'),_0x070e('0x74')],'raw':!![]};return db[_0x070e('0x2f')][_0x070e('0x52')](_0x1deb2a)[_0x070e('0x27')](handleEntityNotFound(_0x3893a5,null))[_0x070e('0x27')](function(_0x522513){if(_0x522513){if(!_[_0x070e('0x6e')](_0x522513[_0x070e('0x66')])){if(fs[_0x070e('0x6f')](path[_0x070e('0x69')](config[_0x070e('0x6a')],_0x070e('0x72'),_0x522513[_0x070e('0x66')]))&&_0x522513[_0x070e('0x74')]){_0x3e2c30=path[_0x070e('0x69')](config[_0x070e('0x6a')],'server/files/images/avatars/',_0x522513['customerAvatar']);}}return _0x3893a5[_0x070e('0x70')](_0x3e2c30);}})[_0x070e('0x1b')](handleError(_0x3893a5,null));};exports[_0x070e('0x75')]=function(_0x567202,_0xefd35a){var _0x36dfb5=path['join'](config[_0x070e('0x6a')],_0x070e('0x76'));var _0x2f34b9={'where':{'id':_0x567202[_0x070e('0x45')]['id']},'attributes':['id',_0x070e('0x67')],'raw':!![]};return db[_0x070e('0x2f')]['find'](_0x2f34b9)['then'](handleEntityNotFound(_0xefd35a,null))[_0x070e('0x27')](function(_0x3f3d7e){if(_0x3f3d7e){if(!_['isNil'](_0x3f3d7e[_0x070e('0x67')])){if(fs[_0x070e('0x6f')](path[_0x070e('0x69')](config[_0x070e('0x6a')],_0x070e('0x72'),_0x3f3d7e[_0x070e('0x67')]))){_0x36dfb5=path['join'](config[_0x070e('0x6a')],_0x070e('0x72'),_0x3f3d7e['systemAvatar']);}}return _0xefd35a[_0x070e('0x70')](_0x36dfb5);}})[_0x070e('0x1b')](handleError(_0xefd35a,null));};exports[_0x070e('0x77')]=function(_0x1fe46c,_0x4b6569){var _0x4c621a=require(_0x070e('0x78'));var _0x210e92=new _0x4c621a();var _0x2ad143=_0x210e92[_0x070e('0x79')](_0x1fe46c[_0x070e('0x7a')][_0x070e('0x7b')])[_0x070e('0x7c')]();var _0x2e1753={'body':_0x1fe46c[_0x070e('0x51')],'channel':_0x070e('0x7d')};var _0x4aab66=[];var _0x3759a6=[];var _0x13e414={};var _0x1de175=![];return db[_0x070e('0x7e')]['describe']()[_0x070e('0x27')](function(_0x35ddab){if(!_0x35ddab){throw new db['Sequelize']['ValidationError'](_0x070e('0x7f'));}_0x4aab66=_[_0x070e('0x80')](_[_0x070e('0x33')](_0x35ddab),['createdAt',_0x070e('0x81')]);_0x3759a6=_[_0x070e('0x80')](_[_0x070e('0x33')](_0x35ddab),[_0x070e('0x82'),_0x070e('0x81'),'CompanyId',_0x070e('0x83')]);if(_0x1fe46c[_0x070e('0x51')]['id']){delete _0x1fe46c['body']['id'];}if(_[_0x070e('0x6e')](_0x1fe46c['body']['from'])){throw new db['Sequelize'][(_0x070e('0x84'))](_0x070e('0x85'));}if(_[_0x070e('0x6e')](_0x1fe46c[_0x070e('0x51')]['body'])||_0x1fe46c[_0x070e('0x51')][_0x070e('0x51')]===''){throw new db['Sequelize'][(_0x070e('0x84'))](_0x070e('0x86'));}if(_[_0x070e('0x6e')](_0x1fe46c[_0x070e('0x51')][_0x070e('0x87')])){throw new db[(_0x070e('0x88'))]['ValidationError'](_0x070e('0x89')+_0x3759a6);}if(!_['includes'](_0x3759a6,_0x1fe46c[_0x070e('0x51')][_0x070e('0x87')])){throw new db[(_0x070e('0x88'))]['ValidationError'](_0x070e('0x8a')+_0x3759a6);}_0x13e414[_0x1fe46c[_0x070e('0x51')][_0x070e('0x87')]]=_0x1fe46c['body'][_0x070e('0x8b')];})[_0x070e('0x27')](function(){return db['ChatWebsite'][_0x070e('0x52')]({'where':{'id':_0x1fe46c[_0x070e('0x45')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x13e414,'limit':0x1,'order':[[_0x070e('0x81'),_0x070e('0x8c')]]}]},{'model':db[_0x070e('0x8d')],'as':_0x070e('0x8e')}]});})[_0x070e('0x27')](handleEntityNotFound(_0x4b6569,null))[_0x070e('0x27')](function(_0x3ce644){if(_0x3ce644&&_0x3ce644[_0x070e('0x8f')]){_0x2e1753['account']=_0x3ce644;_0x2e1753['applications']=_0x3ce644['Applications'];_0x2e1753['list']=_0x3ce644[_0x070e('0x8f')];_0x2e1753[_0x070e('0x90')]=_[_0x070e('0x91')](_0x2e1753[_0x070e('0x90')],[_0x070e('0x92')],['asc']);if(_0x2e1753['account'][_0x070e('0x8e')]){delete _0x2e1753[_0x070e('0x93')]['Applications'];}if(_0x2e1753[_0x070e('0x93')][_0x070e('0x8f')]&&_0x2e1753[_0x070e('0x93')][_0x070e('0x8f')][_0x070e('0x94')][_0x070e('0x38')]){return _0x2e1753['account'][_0x070e('0x8f')][_0x070e('0x94')][0x0];}var _0xb56b8e=_['defaults'](_0x1fe46c[_0x070e('0x51')],{'firstName':_0x1fe46c[_0x070e('0x51')][_0x070e('0x8b')],'ListId':_0x3ce644[_0x070e('0x83')]});_0xb56b8e[_0x1fe46c['body'][_0x070e('0x87')]]=_0x1fe46c[_0x070e('0x51')]['from'];return db[_0x070e('0x7e')][_0x070e('0x48')](_0xb56b8e,{'fields':_0x4aab66,'raw':!![]});}})['then'](handleEntityNotFound(_0x4b6569,null))[_0x070e('0x27')](function(_0x4ff695){_0x2e1753[_0x070e('0x95')]=_0x4ff695;var _0x54f8d3=_0x1fe46c[_0x070e('0x51')]['customerIp'];if(_0x1fe46c['headers'][_0x070e('0x96')]){_0x54f8d3=_0x1fe46c['headers']['cf-connecting-ip'];}else if(_0x1fe46c[_0x070e('0x7a')][_0x070e('0x97')]){_0x54f8d3=_[_0x070e('0x98')](_0x1fe46c[_0x070e('0x7a')][_0x070e('0x97')]['split'](','));}if(_0x4ff695){var _0x29e1f8={'ContactId':_0x4ff695['id'],'ChatWebsiteId':_0x1fe46c[_0x070e('0x45')]['id'],'from':(_0x4ff695[_0x070e('0x99')]||'')+'\x20'+(_0x4ff695[_0x070e('0x9a')]||''),'customerIp':_0x54f8d3,'customerPort':_0x1fe46c[_0x070e('0x7a')][_0x070e('0x9b')]?_0x1fe46c['headers'][_0x070e('0x9b')]:null,'referer':_0x1fe46c[_0x070e('0x51')][_0x070e('0x9c')],'browserName':_0x2ad143[_0x070e('0x9d')]['name']&&_0x2ad143['browser'][_0x070e('0x9e')]?util[_0x070e('0x9f')](_0x070e('0xa0'),_0x2ad143[_0x070e('0x9d')][_0x070e('0x2a')],_0x2ad143[_0x070e('0x9d')]['version']):_0x070e('0xa1'),'browserVersion':_0x2ad143[_0x070e('0x9d')][_0x070e('0x9e')]||_0x070e('0xa1'),'osName':util[_0x070e('0x9f')](_0x070e('0xa0'),_0x2ad143['os']['name'],_0x2ad143['os']['version']),'osVersion':_0x2ad143['os'][_0x070e('0x9e')],'deviceModel':_0x2ad143[_0x070e('0xa2')][_0x070e('0x32')]&&_0x2ad143[_0x070e('0xa2')][_0x070e('0xa3')]?util[_0x070e('0x9f')](_0x070e('0xa4'),_0x2ad143['device'][_0x070e('0x32')],_0x2ad143['device'][_0x070e('0xa3')],_0x2ad143['device']['type']):null,'deviceVendor':_0x2ad143['device'][_0x070e('0xa3')],'deviceType':_0x2ad143[_0x070e('0xa2')][_0x070e('0x30')],'formData':JSON[_0x070e('0x15')](_0x1fe46c[_0x070e('0x51')])};var _0x2016e8={'ChatWebsiteId':_0x1fe46c[_0x070e('0x45')]['id'],'closed':![]};if(_0x1fe46c[_0x070e('0x51')][_0x070e('0xa5')]){_0x2016e8['threadId']=_0x1fe46c[_0x070e('0x51')][_0x070e('0xa5')];return db[_0x070e('0xa6')][_0x070e('0x52')]({'where':_0x2016e8})[_0x070e('0x27')](function(_0x3d3375){if(_0x3d3375){return[_0x3d3375,![]];}_0x29e1f8[_0x070e('0xa5')]=_0x1fe46c[_0x070e('0x51')][_0x070e('0xa5')];_0x29e1f8['externalUrl']=_0x1fe46c['body'][_0x070e('0xa7')];return db[_0x070e('0xa6')]['create'](_0x29e1f8)[_0x070e('0x27')](function(_0x58985b){return[_0x58985b,!![]];});});}_0x2016e8['ContactId']=_0x4ff695['id'];if(_0x1fe46c[_0x070e('0x51')][_0x070e('0xa8')]&&_0x1fe46c['body'][_0x070e('0xa8')]['id']){_0x2016e8['id']=_0x1fe46c[_0x070e('0x51')][_0x070e('0xa8')]['id'];return db['ChatInteraction']['find']({'where':_0x2016e8})[_0x070e('0x27')](function(_0x33bd72){if(_0x33bd72){return[_0x33bd72,![]];}return db[_0x070e('0xa6')]['create'](_0x29e1f8)[_0x070e('0x27')](function(_0x36a2cf){return[_0x36a2cf,!![]];});});}return db['ChatInteraction'][_0x070e('0x48')](_0x29e1f8)[_0x070e('0x27')](function(_0x2f5f19){return[_0x2f5f19,!![]];});}})[_0x070e('0xa9')](function(_0x3f7b2c,_0x92db3c){if(_0x3f7b2c){_0x1de175=_0x92db3c;if(!_0x92db3c){var _0x921cc0={'from':(_0x2e1753[_0x070e('0x95')][_0x070e('0x99')]||'')+'\x20'+(_0x2e1753[_0x070e('0x95')][_0x070e('0x9a')]||'')};if(_0x1fe46c[_0x070e('0x51')][_0x070e('0xa5')]&&_0x1fe46c[_0x070e('0x51')][_0x070e('0xaa')]&&_0x1fe46c[_0x070e('0x51')][_0x070e('0xa5')]!=_0x1fe46c['body']['messageId']){_0x921cc0['threadId']=_0x1fe46c['body'][_0x070e('0xaa')];}return _0x3f7b2c[_0x070e('0x26')](_0x921cc0);}else{return _0x3f7b2c;}}})[_0x070e('0x27')](function(_0x4f89d2){_0x2e1753[_0x070e('0xa8')]=_0x4f89d2[_0x070e('0x4a')]({'plain':!![]});_0x2e1753[_0x070e('0xa8')]['created']=_0x1de175;if(_0x2e1753[_0x070e('0xa8')][_0x070e('0xab')]){if(_0x2e1753[_0x070e('0x93')][_0x070e('0xac')]){_0x2e1753['applications'][_0x070e('0xad')]({'id':0x0,'priority':_0x2e1753[_0x070e('0x90')][_0x070e('0x38')]+0x1,'app':'close','appdata':_0x070e('0xae'),'interval':_0x070e('0xaf')});}}return db[_0x070e('0xb0')][_0x070e('0x48')]({'body':_0x1fe46c[_0x070e('0x51')][_0x070e('0x51')],'ChatWebsiteId':_0x1fe46c[_0x070e('0x45')]['id'],'ChatInteractionId':_0x4f89d2['id'],'direction':'in','ContactId':_0x2e1753[_0x070e('0x95')]['id'],'AttachmentId':_0x1fe46c[_0x070e('0x51')]['AttachmentId']});})['then'](function(_0x276c34){_0x2e1753['message']=_0x276c34;if(!_0x2e1753['interaction'][_0x070e('0xb1')]){return;}return db[_0x070e('0xb2')][_0x070e('0x52')]({'attributes':['id',_0x070e('0x2a')],'where':{'id':_0x2e1753[_0x070e('0xa8')][_0x070e('0xb1')]}});})['then'](function(_0x2b9209){if(_0x2b9209){_0x2e1753[_0x070e('0x90')][_0x070e('0xb3')]({'id':0x0,'priority':0x0,'app':_0x070e('0xb4'),'appdata':_0x2b9209['name']+','+(_0x2e1753[_0x070e('0x93')]['waitForTheAssignedAgent']||0xa),'interval':_0x070e('0xaf')});_0x2e1753[_0x070e('0xb5')]=!![];}if(!_0x2e1753[_0x070e('0xa8')][_0x070e('0xb6')]){return;}return db[_0x070e('0xb7')][_0x070e('0x52')]({'attributes':['id',_0x070e('0x2a')],'where':{'id':_0x2e1753[_0x070e('0xa8')][_0x070e('0xb6')]}});})['then'](function(_0xc35037){if(_0xc35037){_0x2e1753[_0x070e('0x90')][_0x070e('0xb3')]({'id':0x0,'priority':0x1,'app':_0x070e('0xb8'),'appdata':_0xc35037[_0x070e('0x2a')]+','+(_0x2e1753[_0x070e('0x93')][_0x070e('0xb9')]||0x12c),'interval':_0x070e('0xaf')});}return respondWithRpcPromise('Start',_0x070e('0xba'),_0x2e1753);})[_0x070e('0x27')](function(_0x5356d0){respondWithRpcPromise('EventManager',_0x070e('0xbb'),{'event':_0x070e('0x77'),'message':_0x5356d0},client9002);return _0x5356d0;})[_0x070e('0x27')](respondWithResult(_0x4b6569,null))[_0x070e('0x1b')](handleError(_0x4b6569,null));};exports[_0x070e('0xbc')]=function(_0x45ee9e,_0x545fb5){var _0x5c44b4,_0x236ccb,_0x37fb87;var _0x5079d9=[];var _0x31d3fa={};var _0x5aebee=_0x45ee9e[_0x070e('0xbd')]||[];var _0xa2c957=[];var _0x535518;return db[_0x070e('0x7e')][_0x070e('0x53')]()['then'](function(_0x5549ad){if(!_0x5549ad){throw new db[(_0x070e('0x88'))]['ValidationError'](_0x070e('0x7f'));}_0x5079d9=_[_0x070e('0x80')](_[_0x070e('0x33')](_0x5549ad),['createdAt',_0x070e('0x81'),_0x070e('0xbe'),'ListId']);if(_0x45ee9e[_0x070e('0x51')]['id']){delete _0x45ee9e[_0x070e('0x51')]['id'];}if(_[_0x070e('0x6e')](_0x45ee9e[_0x070e('0x51')][_0x070e('0x8b')])){throw _0x545fb5[_0x070e('0x1d')](0x1f4)[_0x070e('0xbf')](new db[(_0x070e('0x88'))][(_0x070e('0x84'))](_0x070e('0x85')));}if(_['isNil'](_0x45ee9e[_0x070e('0x51')][_0x070e('0x51')])||_0x45ee9e[_0x070e('0x51')]['body']===''){throw _0x545fb5['status'](0x1f4)[_0x070e('0xbf')](new db[(_0x070e('0x88'))][(_0x070e('0x84'))](_0x070e('0x86')));}if(_['isNil'](_0x45ee9e[_0x070e('0x51')]['mapKeyOffline'])){throw _0x545fb5['status'](0x1f4)[_0x070e('0xbf')](new db['Sequelize'][(_0x070e('0x84'))](_0x070e('0xc0')+_0x5079d9));}if(!_[_0x070e('0xc1')](_0x5079d9,_0x45ee9e[_0x070e('0x51')]['mapKeyOffline'])){throw _0x545fb5[_0x070e('0x1d')](0x1f4)['send'](new db[(_0x070e('0x88'))][(_0x070e('0x84'))](_0x070e('0xc2')+_0x5079d9));}_0x31d3fa[_0x45ee9e[_0x070e('0x51')][_0x070e('0xc3')]]=_0x45ee9e[_0x070e('0x51')][_0x070e('0x8b')];})[_0x070e('0x27')](function(){return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x45ee9e[_0x070e('0x45')]['id']},'include':[{'model':db[_0x070e('0xc4')],'as':_0x070e('0x8f')},{'model':db[_0x070e('0xc5')],'as':_0x070e('0xc5')}]});})[_0x070e('0x27')](handleEntityNotFound(_0x545fb5,null))['then'](function(_0x48ea98){if(_0x48ea98&&_0x48ea98[_0x070e('0x8f')]){_0x236ccb=_0x48ea98;var _0x2b2b57=_['defaults'](_0x45ee9e[_0x070e('0x51')],{'firstName':_0x45ee9e[_0x070e('0x51')]['from'],'phone':_0x45ee9e[_0x070e('0x51')][_0x070e('0x8b')],'ListId':_0x48ea98['ListId']});_0x2b2b57[_0x45ee9e[_0x070e('0x51')][_0x070e('0xc3')]]=_0x45ee9e[_0x070e('0x51')][_0x070e('0x8b')];return db[_0x070e('0x7e')][_0x070e('0xc6')]({'where':_0x31d3fa,'defaults':_0x2b2b57});}})['spread'](function(_0x3a01db){if(_0x3a01db){_0x37fb87=_0x3a01db;var _0x283199=fs[_0x070e('0xc7')](path['join'](config[_0x070e('0x6a')],_0x070e('0xc8')),_0x070e('0xc9'));var _0x1a6a01=ejs['render'](_0x283199,{'body':_['toPairs'](_0x45ee9e[_0x070e('0x51')][_0x070e('0x51')]),'bodyTitle':_0x236ccb[_0x070e('0xca')]});return db[_0x070e('0xcb')][_0x070e('0x48')]({'body':_0x1a6a01,'plainBody':htmlToText[_0x070e('0xcc')](_0x1a6a01),'ContactId':_0x3a01db['id'],'ChatWebsiteId':_0x236ccb['id']});}})[_0x070e('0x27')](function(_0x48882f){_0x535518=_0x48882f;if(_0x5aebee[_0x070e('0x38')]){var _0x181cce=_0x5aebee[_0x070e('0x2e')](function(_0x172aa1){return{'name':_0x172aa1[_0x070e('0xcd')],'basename':_0x172aa1[_0x070e('0x63')],'type':_0x172aa1[_0x070e('0xce')],'ChatOfflineMessageId':_0x48882f['id']};});_0xa2c957=_0x181cce[_0x070e('0x2e')](_0x408ba0=>{var _0x5734ba={'filename':_0x408ba0[_0x070e('0x2a')],'path':path[_0x070e('0x69')](config[_0x070e('0x6a')],_0x070e('0xcf'),_0x070e('0xbd'),'attachments',_0x070e('0xd0'),_0x408ba0[_0x070e('0xd1')])};return _0x5734ba;});if(!_0x236ccb[_0x070e('0xd2')]){return db[_0x070e('0xd3')][_0x070e('0xd4')](function(_0x3c5019){return db[_0x070e('0xd5')]['bulkCreate'](_0x181cce,{'transaction':_0x3c5019});});}}})[_0x070e('0x27')](function(){if(_0x535518){_0x5c44b4=_0x535518;return db[_0x070e('0xc5')][_0x070e('0x5e')]({'where':{'service':!![]},'include':[{'model':db[_0x070e('0xd6')],'as':_0x070e('0xd7'),'raw':!![],'include':[{'model':db[_0x070e('0xd8')],'as':_0x070e('0xd8'),'raw':!![]}]}]});}})[_0x070e('0x27')](function(_0x45735c){if(_0x45735c&&_0x45735c['Smtp']&&_0x236ccb[_0x070e('0xd9')]&&_0x236ccb[_0x070e('0xda')]){var _0xf94878=_0x45735c[_0x070e('0xdb')]();return respondWithRpcPromise(_0x070e('0xdc'),_0x070e('0xdd'),{'account':_0xf94878,'message':{'from':util[_0x070e('0x9f')](_0x070e('0xde'),_0x45735c[_0x070e('0x2a')],_0x45735c[_0x070e('0xdf')]||_0x45735c[_0x070e('0xd7')][_0x070e('0x49')]),'to':_0x236ccb[_0x070e('0xda')],'subject':_0x236ccb[_0x070e('0xe0')],'html':_0x5c44b4[_0x070e('0x51')],'attachments':_0xa2c957}},client9003)[_0x070e('0x27')](function(){return _0x5c44b4;})[_0x070e('0x1b')](function(_0x5608f9){logger[_0x070e('0x17')](_0x5608f9);});}})[_0x070e('0x27')](function(){if(_0x236ccb&&_0x236ccb[_0x070e('0xd2')]&&_0x236ccb[_0x070e('0xe1')]){var _0x5608d0=[];if(_0x5aebee[_0x070e('0x38')]){_0x5608d0=_0x5aebee[_0x070e('0x2e')](function(_0x1fd493){return{'name':_0x1fd493[_0x070e('0xcd')],'basename':_0x1fd493['filename'],'type':_0x1fd493[_0x070e('0xce')],'ChatOfflineMessageId':_0x535518['id']};});}var _0x4c9619;if(!_[_0x070e('0x6e')](_0x236ccb['subjectOffline'])){var _0x59383a=_[_0x070e('0x2e')](_0x45ee9e[_0x070e('0x51')],function(_0x906cb7){return _0x906cb7;});var _0x5880bb=_[_0x070e('0xe2')](_0x59383a)[0x0];var _0x5ab854=_[_0x070e('0xe3')](_0x5880bb,function(_0x1e0e55){return _0x1e0e55;});_0x4c9619=_0x5ab854[0x1][_0x236ccb['subjectOffline']];}var _0x17a593={'from':_0x37fb87['email'],'firstName':_0x37fb87[_0x070e('0x99')],'lastName':_0x37fb87[_0x070e('0x9a')],'mapKey':_0x070e('0xdf'),'message':{'from':_0x37fb87['email'],'to':_0x236ccb['MailAccount'][_0x070e('0xdf')],'cc':'','subject':_['isNil'](_0x4c9619)?_0x236ccb[_0x070e('0xe0')]:_0x4c9619,'messageId':'','sentAt':new Date(),'attach':_0x5608d0[_0x070e('0x38')],'attachments':_0x5608d0,'originChannel':_0x070e('0xe4'),'ChatWebsiteId':_0x236ccb['id'],'ChatOfflineMessageId':_0x5c44b4['id'],'originTo':_0x236ccb[_0x070e('0xc5')][_0x070e('0xdf')]},'body':_0x5c44b4[_0x070e('0x51')]};var _0x4aaf0f={'account':{'id':_0x236ccb['MailAccountId']},'body':_0x17a593,'log':_0x070e('0xe5')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x4aaf0f,client9001)[_0x070e('0x27')](function(){return _0x5c44b4;})[_0x070e('0x1b')](function(_0x3c8b7d){logger['error'](_0x3c8b7d);});}return;})[_0x070e('0x27')](function(){if(_0x5c44b4){return _0x5c44b4;}})[_0x070e('0x27')](respondWithResult(_0x545fb5,null))[_0x070e('0x1b')](function(_0x4dfac3){logger['error'](_0x070e('0x1b'),_0x4dfac3);for(var _0x421d8e of _0x5aebee){var _0x306654=path['join'](config[_0x070e('0x6a')],'server',_0x070e('0xbd'),'attachments',_0x070e('0xd0'),_0x421d8e[_0x070e('0x63')]);fs_extra['remove'](_0x306654)[_0x070e('0x1b')](function(_0x30fa55){logger[_0x070e('0x17')](_0x070e('0xe6'),_0x306654,_0x30fa55);});}});};exports[_0x070e('0xe7')]=function(_0xd6529a,_0x24ded2){return db[_0x070e('0xa6')][_0x070e('0x52')]({'where':{'id':_0xd6529a[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x24ded2,null))[_0x070e('0x27')](function(_0x3301b8){if(_0x3301b8){return _0x3301b8['addInteraction'](_0xd6529a[_0x070e('0x51')][_0x070e('0x5a')],_[_0x070e('0xe8')](_0xd6529a['body'],['ids','id'])||{});}})[_0x070e('0x27')](respondWithResult(_0x24ded2,null))[_0x070e('0x1b')](handleError(_0x24ded2,null));};exports['getInteractions']=function(_0x134ca4,_0x800c97){var _0x216d58={'raw':![],'where':{}};var _0x483c30={};var _0x9f2102={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x070e('0x5e')]({'where':{'id':_0x134ca4[_0x070e('0x45')]['id']}})['then'](handleEntityNotFound(_0x800c97,null))[_0x070e('0x27')](function(_0x2268ea){if(_0x2268ea){_0x483c30[_0x070e('0x32')]=_[_0x070e('0x33')](db[_0x070e('0xa6')][_0x070e('0x46')]);_0x483c30[_0x070e('0x34')]=_[_0x070e('0x33')](_0x134ca4[_0x070e('0x34')]);_0x483c30['filters']=_[_0x070e('0x47')](_0x483c30[_0x070e('0x32')],_0x483c30[_0x070e('0x34')]);_0x216d58[_0x070e('0x36')]=_['intersection'](_0x483c30['model'],qs['fields'](_0x134ca4[_0x070e('0x34')]['fields']));_0x216d58[_0x070e('0x36')]=_0x216d58[_0x070e('0x36')]['length']?_0x216d58[_0x070e('0x36')]:_0x483c30['model'];if(!_0x134ca4['query'][_0x070e('0xe9')](_0x070e('0x39'))){_0x216d58[_0x070e('0x21')]=qs[_0x070e('0x21')](_0x134ca4[_0x070e('0x34')][_0x070e('0x21')]);_0x216d58[_0x070e('0x1f')]=qs[_0x070e('0x1f')](_0x134ca4[_0x070e('0x34')][_0x070e('0x1f')]);}_0x216d58[_0x070e('0x3a')]=qs[_0x070e('0x3b')](_0x134ca4['query'][_0x070e('0x3b')]);_0x216d58[_0x070e('0x3d')]=qs[_0x070e('0x35')](_[_0x070e('0x56')](_0x134ca4[_0x070e('0x34')],_0x483c30[_0x070e('0x35')]));_0x216d58['where']['ChatWebsiteId']=_0x2268ea['id'];if(_0x134ca4['query'][_0x070e('0x3c')]){_0x216d58[_0x070e('0x3d')]=_[_0x070e('0x3f')](_0x216d58['where'],{'$or':_[_0x070e('0x2e')](_0x216d58[_0x070e('0x36')],function(_0x48437d){var _0x495926={};_0x495926[_0x48437d]={'$like':'%'+_0x134ca4[_0x070e('0x34')]['filter']+'%'};return _0x495926;})});}_0x216d58=_[_0x070e('0x3f')]({},_0x216d58,_0x134ca4[_0x070e('0x40')]);return db[_0x070e('0xa6')][_0x070e('0x22')]({'where':_0x216d58[_0x070e('0x3d')]})[_0x070e('0x27')](function(_0x4e1e0e){_0x9f2102[_0x070e('0x22')]=_0x4e1e0e;if(_0x134ca4[_0x070e('0x34')][_0x070e('0x41')]){_0x216d58['include']=[{'model':db[_0x070e('0x7e')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x070e('0xea'),'attributes':['name',_0x070e('0xeb'),'internal'],'required':![]},{'model':db[_0x070e('0xec')],'as':_0x070e('0xed'),'attributes':['id','name',_0x070e('0xee')],'where':_0x134ca4[_0x070e('0x34')][_0x070e('0xef')]?{'id':_0x134ca4[_0x070e('0x34')][_0x070e('0xef')]}:undefined,'required':_0x134ca4[_0x070e('0x34')][_0x070e('0xef')]?!![]:![]}];}return db[_0x070e('0xa6')][_0x070e('0x58')](_0x216d58);})[_0x070e('0x27')](function(_0x52acf3){_0x9f2102[_0x070e('0x43')]=_0x52acf3;return _0x9f2102;});}})['then'](respondWithFilteredResult(_0x800c97,_0x216d58))[_0x070e('0x1b')](handleError(_0x800c97,null));};function iftimePromise(_0x8d52b9,_0x58052b){return respondWithRpcPromise(_0x070e('0xf0'),'getSnippet',{'command':_0x58052b[_0x070e('0xf1')]?util['format'](_0x070e('0xf2'),_0x8d52b9[_0x070e('0xf3')],_0x58052b['timezone']):util[_0x070e('0x9f')](_0x070e('0xf4'),_0x8d52b9[_0x070e('0xf3')])},client9002)[_0x070e('0x27')](function(_0x12e363){var _0x5cbcf6=_0x12e363&&_0x12e363[_0x070e('0xf5')]('true')>=0x0?!![]:![];logger['info'](_0x070e('0xf6'),_0x58052b['id'],_0x8d52b9['id'],_0x8d52b9['interval'],_0x5cbcf6?'ONLINE':_0x070e('0xf7'),_0x58052b['timezone']?_0x58052b[_0x070e('0xf1')]:_0x070e('0xf8'));return _0x5cbcf6;})[_0x070e('0x1b')](function(_0x56f60d){logger[_0x070e('0x17')](_0x070e('0xf6'),_0x58052b['id'],_0x8d52b9['id'],_0x8d52b9[_0x070e('0xf3')],util[_0x070e('0xf9')](_0x56f60d,{'showHidden':![],'depth':null}),_0x58052b[_0x070e('0xf1')]?_0x58052b['timezone']:_0x070e('0xf8'));return![];});}exports[_0x070e('0xfa')]=function(_0x2bc10f,_0x486249){var _0x20cae7=0x0;var _0x952836=0x0;var _0x399add=![];var _0x4e4996;var _0x1dbff0;return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x2bc10f[_0x070e('0x45')]['id']},'include':[{'model':db['Interval'],'as':_0x070e('0xfb'),'include':[{'model':db[_0x070e('0xfb')],'as':_0x070e('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x070e('0x27')](handleEntityNotFound(_0x486249,null))[_0x070e('0x27')](function(_0x73e3f4){if(_0x73e3f4){_0x4e4996=_0x73e3f4;return _0x73e3f4['getProactiveActions']({'raw':!![]});}})[_0x070e('0x27')](function(_0x581b04){if(_0x4e4996){if(_0x581b04){_0x1dbff0=_0x581b04;}}return require(_0x070e('0xfd'))[_0x070e('0x6c')]();})[_0x070e('0x27')](function(_0x46bc31){if(_0x46bc31){_0x952836=_0x46bc31['virtual'];_0x399add=_0x46bc31[_0x070e('0x6d')];}})[_0x070e('0x27')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x070e('0x27')](function(_0x4542a8){_0x20cae7=_0x4542a8;if(_0x952836&&_0x4542a8>_0x952836){return db[_0x070e('0xfe')][_0x070e('0x5e')]({'where':{'id':0x1}})['then'](function(_0x43b79d){if(_0x43b79d){_0x43b79d[_0x070e('0xff')](_0x070e('0x100'));}});}})['then'](function(){if(_0x4e4996[_0x070e('0xfb')]&&_0x4e4996[_0x070e('0xfb')][_0x070e('0xfc')]){var _0x26a26b=[];for(var _0x4d5e29=0x0;_0x4d5e29<_0x4e4996['Interval'][_0x070e('0xfc')][_0x070e('0x38')];_0x4d5e29++){var _0x58c7e1=_0x4e4996[_0x070e('0xfb')][_0x070e('0xfc')][_0x4d5e29]['get']({'plain':!![]});_0x26a26b['push'](iftimePromise(_0x58c7e1,_0x4e4996));}return BPromise[_0x070e('0x101')](_0x26a26b)[_0x070e('0x27')](function(_0x3094d4){return _[_0x070e('0x102')](_0x3094d4);});}else{return!![];}})['then'](function(_0x59d668){var _0x2d597c=fs[_0x070e('0xc7')](path['join'](config[_0x070e('0x6a')],'server/files/chat/iframe.ejs'),_0x070e('0xc9'));var _0x3420d0=new url[(_0x070e('0x103'))](_0x4e4996['address'])[_0x070e('0x104')];var _0x589b76='3.5.0';var _0x47e50f=![];var _0x36ad23={'chatVersion':_0x589b76,'chatWebsiteAddressOrigin':_0x3420d0,'remote':_0x4e4996[_0x070e('0x105')],'query':querystring[_0x070e('0x15')](_[_0x070e('0x3f')](_0x4e4996[_0x070e('0x4a')]({'plain':!![]}),{'customerIp':_0x2bc10f[_0x070e('0x7a')][_0x070e('0x97')]||_0x2bc10f[_0x070e('0x7a')][_0x070e('0x106')]||_0x2bc10f[_0x070e('0x107')][_0x070e('0x108')]||_0x2bc10f['ip'],'referer':_0x2bc10f['headers'][_0x070e('0x9c')],'openedInteractions':_0x20cae7,'maxInteractions':_0x952836,'virtual':_0x399add[_0x070e('0x109')],'online':_0x59d668,'custom':_0x399add}))['replace'](/'/g,'\x5c\x27')};_0x486249['send'](ejs[_0x070e('0x10a')](Mustache[_0x070e('0x10a')](_0x2d597c,_0x36ad23),{'proactiveActions':_0x1dbff0,'alignment':_0x4e4996[_0x070e('0x10b')],'verticalAlignment':_0x4e4996[_0x070e('0x10c')],'div_color':_0x4e4996['color'],'labelText':_0x4e4996[_0x070e('0x10d')],'text_color':_0x4e4996[_0x070e('0x10e')],'text_button_color':_0x4e4996[_0x070e('0x10f')],'button_color':_0x4e4996[_0x070e('0x110')],'background_color':_0x4e4996[_0x070e('0x111')],'hideWhenOffline':_0x4e4996[_0x070e('0x112')],'intervalId':_0x4e4996['IntervalId'],'isDevelopment':_0x47e50f,'chatVersion':_0x589b76}));})[_0x070e('0x1b')](handleError(_0x486249,null));};exports['addApplications']=function(_0x260eb9,_0x835606){var _0x20612b=_0x260eb9[_0x070e('0x45')]['id'];var _0x2290e8=_0x260eb9[_0x070e('0x51')];var _0x22cca8=0xc8;var _0x560176=null;return db[_0x070e('0xd3')][_0x070e('0xd4')]({'isolationLevel':db[_0x070e('0xd3')][_0x070e('0x113')][_0x070e('0x114')][_0x070e('0x115')]},function(_0x405d9f){return db[_0x070e('0x2f')][_0x070e('0x5e')]({'where':{'id':_0x20612b},'transaction':_0x405d9f})[_0x070e('0x27')](function(_0x14c924){if(_0x14c924){return db[_0x070e('0x8d')][_0x070e('0x28')]({'where':{'ChatWebsiteId':_0x20612b},'transaction':_0x405d9f})[_0x070e('0x27')](function(){var _0x4c9226=_[_0x070e('0x2e')](_0x2290e8,function(_0x234fe6){_0x234fe6['ChatWebsiteId']=_0x20612b;return _0x234fe6;});return db[_0x070e('0x8d')][_0x070e('0x116')](_0x4c9226,{'transaction':_0x405d9f});});}else{_0x22cca8=0x194;_0x560176=[];}});})[_0x070e('0x27')](function(){if(_0x22cca8!==0x194){return db[_0x070e('0x8d')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x20612b},'order':_0x070e('0x92')})[_0x070e('0x27')](function(_0x4c9334){_0x560176=_0x4c9334;});}})[_0x070e('0x1b')](function(_0x606970){_0x22cca8=0x1f4;logger[_0x070e('0x17')](_0x606970[_0x070e('0x29')]);if(_0x606970[_0x070e('0x2a')]){delete _0x606970['name'];}_0x560176=_0x606970;})[_0x070e('0x117')](function(){if(_0x560176===null){_0x835606[_0x070e('0x1c')](_0x22cca8);}else{if(_0x22cca8===0x1f4){_0x835606[_0x070e('0x1d')](_0x22cca8)[_0x070e('0xbf')](_0x560176);}else{_0x835606['status'](_0x22cca8)[_0x070e('0x25')](_0x560176);}}});};exports[_0x070e('0x118')]=function(_0x3d0462,_0x50267c){var _0x2855c9={};var _0x4292f0={};var _0x5448ef;var _0x3a684d;return db[_0x070e('0x2f')][_0x070e('0x5e')]({'where':{'id':_0x3d0462[_0x070e('0x45')]['id']}})['then'](handleEntityNotFound(_0x50267c,null))[_0x070e('0x27')](function(_0x5e1a7a){if(_0x5e1a7a){_0x5448ef=_0x5e1a7a;_0x4292f0[_0x070e('0x32')]=_[_0x070e('0x33')](db[_0x070e('0x8d')]['rawAttributes']);_0x4292f0['query']=_['keys'](_0x3d0462[_0x070e('0x34')]);_0x4292f0[_0x070e('0x35')]=_['intersection'](_0x4292f0[_0x070e('0x32')],_0x4292f0[_0x070e('0x34')]);_0x2855c9[_0x070e('0x36')]=_[_0x070e('0x47')](_0x4292f0[_0x070e('0x32')],qs[_0x070e('0x37')](_0x3d0462[_0x070e('0x34')]['fields']));_0x2855c9[_0x070e('0x36')]=_0x2855c9['attributes'][_0x070e('0x38')]?_0x2855c9[_0x070e('0x36')]:_0x4292f0[_0x070e('0x32')];_0x2855c9[_0x070e('0x3a')]=qs['sort'](_0x3d0462[_0x070e('0x34')][_0x070e('0x3b')]);_0x2855c9[_0x070e('0x3d')]=qs['filters'](_[_0x070e('0x56')](_0x3d0462['query'],_0x4292f0[_0x070e('0x35')]));if(_0x3d0462[_0x070e('0x34')][_0x070e('0x3c')]){_0x2855c9['where']=_[_0x070e('0x3f')](_0x2855c9[_0x070e('0x3d')],{'$or':_[_0x070e('0x2e')](_0x2855c9[_0x070e('0x36')],function(_0x45fa15){var _0x155c3d={};_0x155c3d[_0x45fa15]={'$like':'%'+_0x3d0462[_0x070e('0x34')][_0x070e('0x3c')]+'%'};return _0x155c3d;})});}_0x2855c9=_[_0x070e('0x3f')]({},_0x2855c9,_0x3d0462[_0x070e('0x40')]);return _0x5448ef[_0x070e('0x118')](_0x2855c9);}})['then'](function(_0x15fc52){if(_0x15fc52){_0x3a684d=_0x15fc52[_0x070e('0x38')];if(!_0x3d0462['query'][_0x070e('0xe9')](_0x070e('0x39'))){_0x2855c9[_0x070e('0x21')]=qs[_0x070e('0x21')](_0x3d0462[_0x070e('0x34')][_0x070e('0x21')]);_0x2855c9[_0x070e('0x1f')]=qs[_0x070e('0x1f')](_0x3d0462[_0x070e('0x34')]['offset']);}return _0x5448ef[_0x070e('0x118')](_0x2855c9);}})[_0x070e('0x27')](function(_0x3f459b){if(_0x3f459b){return _0x3f459b?{'count':_0x3a684d,'rows':_0x3f459b}:null;}})['then'](respondWithResult(_0x50267c,null))[_0x070e('0x1b')](handleError(_0x50267c,null));};exports[_0x070e('0x119')]=function(_0x2f5572,_0x42c8b3){return db[_0x070e('0x11a')][_0x070e('0x52')]({'where':{'id':_0x2f5572[_0x070e('0x45')]['id']}})['then'](handleEntityNotFound(_0x42c8b3,null))[_0x070e('0x27')](function(_0x673c7e){if(_0x673c7e){return _0x673c7e[_0x070e('0x119')](_0x2f5572[_0x070e('0x51')][_0x070e('0x5a')],_['omit'](_0x2f5572[_0x070e('0x51')],[_0x070e('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x42c8b3,null))['catch'](handleError(_0x42c8b3,null));};exports['getProactiveActions']=function(_0x395bf7,_0x41b760){var _0x5906f5={};var _0x550c04={};var _0x205559;var _0x4878d8;return db[_0x070e('0x2f')][_0x070e('0x5e')]({'where':{'id':_0x395bf7[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x41b760,null))[_0x070e('0x27')](function(_0x1d5c86){if(_0x1d5c86){_0x205559=_0x1d5c86;_0x550c04[_0x070e('0x32')]=_['keys'](db[_0x070e('0x11b')][_0x070e('0x46')]);_0x550c04[_0x070e('0x34')]=_[_0x070e('0x33')](_0x395bf7['query']);_0x550c04['filters']=_[_0x070e('0x47')](_0x550c04[_0x070e('0x32')],_0x550c04[_0x070e('0x34')]);_0x5906f5['attributes']=_[_0x070e('0x47')](_0x550c04[_0x070e('0x32')],qs[_0x070e('0x37')](_0x395bf7[_0x070e('0x34')]['fields']));_0x5906f5['attributes']=_0x5906f5[_0x070e('0x36')][_0x070e('0x38')]?_0x5906f5[_0x070e('0x36')]:_0x550c04[_0x070e('0x32')];_0x5906f5[_0x070e('0x3a')]=qs['sort'](_0x395bf7['query']['sort']);_0x5906f5[_0x070e('0x3d')]=qs[_0x070e('0x35')](_[_0x070e('0x56')](_0x395bf7[_0x070e('0x34')],_0x550c04['filters']));if(_0x395bf7[_0x070e('0x34')]['filter']){_0x5906f5['where']=_[_0x070e('0x3f')](_0x5906f5[_0x070e('0x3d')],{'$or':_['map'](_0x5906f5[_0x070e('0x36')],function(_0x1b6728){var _0x158670={};_0x158670[_0x1b6728]={'$like':'%'+_0x395bf7[_0x070e('0x34')][_0x070e('0x3c')]+'%'};return _0x158670;})});}_0x5906f5=_[_0x070e('0x3f')]({},_0x5906f5,_0x395bf7['options']);return _0x205559[_0x070e('0x11c')](_0x5906f5);}})[_0x070e('0x27')](function(_0x408b87){if(_0x408b87){_0x4878d8=_0x408b87['length'];if(!_0x395bf7[_0x070e('0x34')][_0x070e('0xe9')](_0x070e('0x39'))){_0x5906f5['limit']=qs[_0x070e('0x21')](_0x395bf7[_0x070e('0x34')][_0x070e('0x21')]);_0x5906f5[_0x070e('0x1f')]=qs[_0x070e('0x1f')](_0x395bf7[_0x070e('0x34')][_0x070e('0x1f')]);}return _0x205559[_0x070e('0x11c')](_0x5906f5);}})[_0x070e('0x27')](function(_0x39497c){if(_0x39497c){return _0x39497c?{'count':_0x4878d8,'rows':_0x39497c}:null;}})[_0x070e('0x27')](respondWithResult(_0x41b760,null))['catch'](handleError(_0x41b760,null));};exports[_0x070e('0x11d')]=function(_0x1e0b95,_0x460933){var _0x9fa764=_0x1e0b95['query'][_0x070e('0x11e')]===_0x070e('0x11f')?'offlineForm':_0x070e('0x120');return db[_0x070e('0x2f')]['find']({'attributes':['id',_0x9fa764],'where':{'id':_0x1e0b95[_0x070e('0x45')]['id']}})['then'](handleEntityNotFound(_0x460933,null))[_0x070e('0x27')](function(_0x5a7692){if(_0x5a7692){var _0x5b85be=_0x5a7692[_0x9fa764];var _0x3877b3=_0x5b85be&&_0x5b85be['items']?_0x5b85be[_0x070e('0x121')]:[];_0x460933[_0x070e('0xbf')]({'fromKey':_[_0x070e('0x6e')](_0x5b85be[_0x070e('0x122')])?undefined:_0x5b85be[_0x070e('0x122')],'count':_0x3877b3[_0x070e('0x38')],'rows':_0x3877b3});}})['catch'](handleError(_0x460933,null));};exports['getOfflineMessages']=function(_0x50f8c4,_0x4b1e3a){var _0x349339={'raw':![],'where':{}};var _0x54ffda={};var _0x295e24={'count':0x0,'rows':[]};return db[_0x070e('0x2f')][_0x070e('0x5e')]({'where':{'id':_0x50f8c4[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x4b1e3a,null))[_0x070e('0x27')](function(_0x5d7cbf){if(_0x5d7cbf){_0x54ffda[_0x070e('0x32')]=_[_0x070e('0x33')](db[_0x070e('0xcb')][_0x070e('0x46')]);_0x54ffda[_0x070e('0x34')]=_[_0x070e('0x33')](_0x50f8c4['query']);_0x54ffda[_0x070e('0x35')]=_[_0x070e('0x47')](_0x54ffda[_0x070e('0x32')],_0x54ffda['query']);_0x349339[_0x070e('0x36')]=_[_0x070e('0x47')](_0x54ffda[_0x070e('0x32')],qs[_0x070e('0x37')](_0x50f8c4[_0x070e('0x34')][_0x070e('0x37')]));_0x349339[_0x070e('0x36')]=_0x349339[_0x070e('0x36')][_0x070e('0x38')]?_0x349339[_0x070e('0x36')]:_0x54ffda[_0x070e('0x32')];if(!_0x50f8c4[_0x070e('0x34')][_0x070e('0xe9')](_0x070e('0x39'))){_0x349339[_0x070e('0x21')]=qs[_0x070e('0x21')](_0x50f8c4[_0x070e('0x34')][_0x070e('0x21')]);_0x349339[_0x070e('0x1f')]=qs[_0x070e('0x1f')](_0x50f8c4['query'][_0x070e('0x1f')]);}_0x349339['order']=qs['sort'](_0x50f8c4[_0x070e('0x34')]['sort']);_0x349339[_0x070e('0x3d')]=qs[_0x070e('0x35')](_[_0x070e('0x56')](_0x50f8c4[_0x070e('0x34')],_0x54ffda[_0x070e('0x35')]));_0x349339[_0x070e('0x3d')][_0x070e('0x55')]=_0x5d7cbf['id'];if(_0x50f8c4[_0x070e('0x34')][_0x070e('0x3c')]){_0x349339[_0x070e('0x3d')]=_['merge'](_0x349339[_0x070e('0x3d')],{'$or':_[_0x070e('0x2e')](_0x349339[_0x070e('0x36')],function(_0x24cc9e){var _0x340df0={};_0x340df0[_0x24cc9e]={'$like':'%'+_0x50f8c4['query'][_0x070e('0x3c')]+'%'};return _0x340df0;})});}_0x349339=_[_0x070e('0x3f')]({},_0x349339,_0x50f8c4[_0x070e('0x40')]);return db[_0x070e('0xcb')]['count']({'where':_0x349339[_0x070e('0x3d')]})[_0x070e('0x27')](function(_0x5c0fa5){_0x295e24[_0x070e('0x22')]=_0x5c0fa5;if(_0x50f8c4[_0x070e('0x34')][_0x070e('0x41')]){_0x349339[_0x070e('0x42')]=[{'all':!![]}];}else{_0x349339['include']=[{'model':db[_0x070e('0x7e')],'as':_0x070e('0x123'),'required':![]},{'model':db[_0x070e('0xd5')],'as':'Attachments','required':![]}];}return db[_0x070e('0xcb')]['findAll'](_0x349339);})[_0x070e('0x27')](function(_0xc4a364){_0x295e24['rows']=_0xc4a364;return _0x295e24;});}})[_0x070e('0x27')](respondWithFilteredResult(_0x4b1e3a,_0x349339))[_0x070e('0x1b')](handleError(_0x4b1e3a,null));};exports[_0x070e('0x124')]=function(_0x553cf8,_0x353041){return db[_0x070e('0x2f')][_0x070e('0x52')]({'where':{'id':_0x553cf8['params']['id']}})['then'](handleEntityNotFound(_0x353041,null))[_0x070e('0x27')](function(_0x22932b){if(_0x22932b){return _0x22932b[_0x070e('0x124')](_0x553cf8['body']['ids'],_[_0x070e('0xe8')](_0x553cf8['body'],['ids','id'])||{})[_0x070e('0xa9')](function(_0xeb1314){for(var _0x42414c=0x0;_0x42414c<_0x553cf8[_0x070e('0x51')]['ids']['length'];_0x42414c+=0x1){socket[_0x070e('0x125')](_0x070e('0x126'),{'UserId':Number(_0x553cf8[_0x070e('0x51')][_0x070e('0x5a')][_0x42414c]),'ChatWebsiteId':Number(_0x553cf8[_0x070e('0x45')]['id'])});}return _0xeb1314;});}})['then'](respondWithResult(_0x353041,null))[_0x070e('0x1b')](handleError(_0x353041,null));};exports[_0x070e('0x127')]=function(_0x1a2d80,_0x50c3a9){return db[_0x070e('0x2f')]['find']({'where':{'id':_0x1a2d80[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x50c3a9,null))[_0x070e('0x27')](function(_0x5274f){if(_0x5274f){return _0x5274f[_0x070e('0x127')](_0x1a2d80['query']['ids'])[_0x070e('0x27')](function(){if(_[_0x070e('0x128')](_0x1a2d80[_0x070e('0x34')]['ids'])){for(var _0x5c5fcb=0x0;_0x5c5fcb<_0x1a2d80[_0x070e('0x34')][_0x070e('0x5a')][_0x070e('0x38')];_0x5c5fcb+=0x1){socket[_0x070e('0x125')](_0x070e('0x129'),{'UserId':Number(_0x1a2d80[_0x070e('0x34')][_0x070e('0x5a')][_0x5c5fcb]),'ChatWebsiteId':Number(_0x1a2d80[_0x070e('0x45')]['id'])});}}else{socket[_0x070e('0x125')](_0x070e('0x129'),{'UserId':Number(_0x1a2d80[_0x070e('0x34')][_0x070e('0x5a')]),'ChatWebsiteId':Number(_0x1a2d80[_0x070e('0x45')]['id'])});}});}})[_0x070e('0x27')](respondWithStatusCode(_0x50c3a9,null))[_0x070e('0x1b')](handleError(_0x50c3a9,null));};exports['getAgents']=function(_0x15277b,_0x31db5c){var _0x2f20d9={};var _0x5268e9={};var _0x51836a;var _0x4dd9cb;return db['ChatWebsite'][_0x070e('0x5e')]({'where':{'id':_0x15277b[_0x070e('0x45')]['id']}})[_0x070e('0x27')](handleEntityNotFound(_0x31db5c,null))[_0x070e('0x27')](function(_0xd10a6e){if(_0xd10a6e){_0x51836a=_0xd10a6e;_0x5268e9[_0x070e('0x32')]=_[_0x070e('0x33')](db[_0x070e('0xb2')][_0x070e('0x46')]);_0x5268e9['query']=_['keys'](_0x15277b['query']);_0x5268e9['filters']=_[_0x070e('0x47')](_0x5268e9['model'],_0x5268e9[_0x070e('0x34')]);_0x2f20d9[_0x070e('0x36')]=_[_0x070e('0x47')](_0x5268e9[_0x070e('0x32')],qs[_0x070e('0x37')](_0x15277b[_0x070e('0x34')][_0x070e('0x37')]));_0x2f20d9[_0x070e('0x36')]=_0x2f20d9['attributes'][_0x070e('0x38')]?_0x2f20d9[_0x070e('0x36')]:_0x5268e9[_0x070e('0x32')];_0x2f20d9[_0x070e('0x3a')]=qs[_0x070e('0x3b')](_0x15277b[_0x070e('0x34')][_0x070e('0x3b')]);_0x2f20d9[_0x070e('0x3d')]=qs[_0x070e('0x35')](_[_0x070e('0x56')](_0x15277b[_0x070e('0x34')],_0x5268e9['filters']));if(_0x15277b[_0x070e('0x34')][_0x070e('0x3c')]){_0x2f20d9['where']=_[_0x070e('0x3f')](_0x2f20d9['where'],{'$or':_['map'](_0x2f20d9[_0x070e('0x36')],function(_0x4c9db4){var _0x28456b={};_0x28456b[_0x4c9db4]={'$like':'%'+_0x15277b[_0x070e('0x34')][_0x070e('0x3c')]+'%'};return _0x28456b;})});}_0x2f20d9=_['merge']({},_0x2f20d9,_0x15277b[_0x070e('0x40')]);return _0x51836a['getAgents'](_0x2f20d9);}})[_0x070e('0x27')](function(_0x5c04b8){if(_0x5c04b8){_0x4dd9cb=_0x5c04b8[_0x070e('0x38')];if(!_0x15277b[_0x070e('0x34')][_0x070e('0xe9')]('nolimit')){_0x2f20d9['limit']=qs[_0x070e('0x21')](_0x15277b[_0x070e('0x34')][_0x070e('0x21')]);_0x2f20d9[_0x070e('0x1f')]=qs['offset'](_0x15277b[_0x070e('0x34')][_0x070e('0x1f')]);}return _0x51836a[_0x070e('0x12a')](_0x2f20d9);}})[_0x070e('0x27')](function(_0x326961){if(_0x326961){return _0x326961?{'count':_0x4dd9cb,'rows':_0x326961}:null;}})[_0x070e('0x27')](respondWithResult(_0x31db5c,null))['catch'](handleError(_0x31db5c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a648404..55123e9 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 _0x2a9a=['hasOwnProperty','hook','events','ChatWebsite','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a9a,0x64));var _0xa2a9=function(_0xfba519,_0x7b249b){_0xfba519=_0xfba519-0x0;var _0x15a578=_0x2a9a[_0xfba519];return _0x15a578;};'use strict';var EventEmitter=require(_0xa2a9('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xa2a9('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa2a9('0x2'),'afterDestroy':_0xa2a9('0x3')};function emitEvent(_0x39eca6){return function(_0x1a817a,_0x593d5c,_0x55dc29){ChatWebsiteEvents[_0xa2a9('0x4')](_0x39eca6+':'+_0x1a817a['id'],_0x1a817a);ChatWebsiteEvents[_0xa2a9('0x4')](_0x39eca6,_0x1a817a);_0x55dc29(null);};}for(var e in events){if(events[_0xa2a9('0x5')](e)){var event=events[e];ChatWebsite[_0xa2a9('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xbf4e=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1ad89c,_0x49dfe0){var _0x1dd3b1=function(_0xb4094c){while(--_0xb4094c){_0x1ad89c['push'](_0x1ad89c['shift']());}};_0x1dd3b1(++_0x49dfe0);}(_0xbf4e,0x172));var _0xebf4=function(_0x5be829,_0x48378c){_0x5be829=_0x5be829-0x0;var _0x343686=_0xbf4e[_0x5be829];return _0x343686;};'use strict';var EventEmitter=require(_0xebf4('0x0'));var ChatWebsite=require(_0xebf4('0x1'))['db'][_0xebf4('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xebf4('0x3')](0x0);var events={'afterCreate':_0xebf4('0x4'),'afterUpdate':_0xebf4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41cb2c){return function(_0x5d2ad5,_0x59cc54,_0x15328a){ChatWebsiteEvents[_0xebf4('0x6')](_0x41cb2c+':'+_0x5d2ad5['id'],_0x5d2ad5);ChatWebsiteEvents['emit'](_0x41cb2c,_0x5d2ad5);_0x15328a(null);};}for(var e in events){if(events[_0xebf4('0x7')](e)){var event=events[e];ChatWebsite[_0xebf4('0x8')](e,emitEvent(event));}}module[_0xebf4('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 85899d1..28c0dbb 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 _0x6170=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','chat_websites','util','../../config/logger','api','bluebird'];(function(_0x50a171,_0x46a5a7){var _0x51999c=function(_0x3c3dab){while(--_0x3c3dab){_0x50a171['push'](_0x50a171['shift']());}};_0x51999c(++_0x46a5a7);}(_0x6170,0x164));var _0x0617=function(_0x1c048a,_0x138c9f){_0x1c048a=_0x1c048a-0x0;var _0x828391=_0x6170[_0x1c048a];return _0x828391;};'use strict';var _=require('lodash');var util=require(_0x0617('0x0'));var logger=require(_0x0617('0x1'))(_0x0617('0x2'));var moment=require('moment');var BPromise=require(_0x0617('0x3'));var rp=require(_0x0617('0x4'));var fs=require('fs');var path=require(_0x0617('0x5'));var rimraf=require(_0x0617('0x6'));var config=require(_0x0617('0x7'));var attributes=require(_0x0617('0x8'));module['exports']=function(_0x39af8f,_0x5eda8a){return _0x39af8f['define']('ChatWebsite',attributes,{'tableName':_0x0617('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c2f=['api','moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','define','chat_websites','util','../../config/logger'];(function(_0x44583b,_0x4f23f7){var _0x12fd08=function(_0x5b8815){while(--_0x5b8815){_0x44583b['push'](_0x44583b['shift']());}};_0x12fd08(++_0x4f23f7);}(_0x0c2f,0x111));var _0xf0c2=function(_0x5c0b22,_0x56d46a){_0x5c0b22=_0x5c0b22-0x0;var _0x16a8a6=_0x0c2f[_0x5c0b22];return _0x16a8a6;};'use strict';var _=require('lodash');var util=require(_0xf0c2('0x0'));var logger=require(_0xf0c2('0x1'))(_0xf0c2('0x2'));var moment=require(_0xf0c2('0x3'));var BPromise=require(_0xf0c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0c2('0x5'));var rimraf=require(_0xf0c2('0x6'));var config=require(_0xf0c2('0x7'));var attributes=require(_0xf0c2('0x8'));module['exports']=function(_0x33989e,_0x245e79){return _0x33989e[_0xf0c2('0x9')]('ChatWebsite',attributes,{'tableName':_0xf0c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 5e299c3..3161af9 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 _0x9e1f=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x123414,_0x4f85f6){var _0x50e83a=function(_0x585a1e){while(--_0x585a1e){_0x123414['push'](_0x123414['shift']());}};_0x50e83a(++_0x4f85f6);}(_0x9e1f,0xfd));var _0xf9e1=function(_0x50e425,_0x3ca8d7){_0x50e425=_0x50e425-0x0;var _0x4b985d=_0x9e1f[_0x50e425];return _0x4b985d;};'use strict';var _=require(_0xf9e1('0x0'));var util=require(_0xf9e1('0x1'));var moment=require(_0xf9e1('0x2'));var BPromise=require(_0xf9e1('0x3'));var rs=require(_0xf9e1('0x4'));var fs=require('fs');var Redis=require(_0xf9e1('0x5'));var db=require(_0xf9e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9e1('0x7'))(_0xf9e1('0x8'));var config=require('../../config/environment');var jayson=require(_0xf9e1('0x9'));var client=jayson['client'][_0xf9e1('0xa')]({'port':0x232a});config[_0xf9e1('0xb')]=_['defaults'](config[_0xf9e1('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9e1('0xb')]));require(_0xf9e1('0xc'))[_0xf9e1('0xd')](socket);function respondWithRpcPromise(_0x18492c,_0x3c8260,_0x321a85){return new BPromise(function(_0x27ca46,_0x28f165){return client[_0xf9e1('0xe')](_0x18492c,_0x321a85)['then'](function(_0x1bf640){logger[_0xf9e1('0xf')](_0xf9e1('0x10'),_0x3c8260,_0xf9e1('0x11'));logger[_0xf9e1('0x12')](_0xf9e1('0x13'),_0x3c8260,_0xf9e1('0x11'),JSON[_0xf9e1('0x14')](_0x1bf640));if(_0x1bf640[_0xf9e1('0x15')]){if(_0x1bf640[_0xf9e1('0x15')][_0xf9e1('0x16')]===0x1f4){logger['error'](_0xf9e1('0x10'),_0x3c8260,_0x1bf640[_0xf9e1('0x15')][_0xf9e1('0x17')]);return _0x28f165(_0x1bf640[_0xf9e1('0x15')][_0xf9e1('0x17')]);}logger[_0xf9e1('0x15')](_0xf9e1('0x10'),_0x3c8260,_0x1bf640[_0xf9e1('0x15')][_0xf9e1('0x17')]);return _0x27ca46(_0x1bf640[_0xf9e1('0x15')][_0xf9e1('0x17')]);}else{logger[_0xf9e1('0xf')](_0xf9e1('0x10'),_0x3c8260,'request\x20sent');_0x27ca46(_0x1bf640['result']['message']);}})[_0xf9e1('0x18')](function(_0x4851a9){logger['error'](_0xf9e1('0x10'),_0x3c8260,_0x4851a9);_0x28f165(_0x4851a9);});});} \ No newline at end of file +var _0xe0b0=['redis','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults'];(function(_0x5a59b9,_0x438b5a){var _0x41d2a4=function(_0x296606){while(--_0x296606){_0x5a59b9['push'](_0x5a59b9['shift']());}};_0x41d2a4(++_0x438b5a);}(_0xe0b0,0x7c));var _0x0e0b=function(_0x16505c,_0x573d70){_0x16505c=_0x16505c-0x0;var _0x2893a0=_0xe0b0[_0x16505c];return _0x2893a0;};'use strict';var _=require(_0x0e0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0e0b('0x1'));var rs=require(_0x0e0b('0x2'));var fs=require('fs');var Redis=require(_0x0e0b('0x3'));var db=require(_0x0e0b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e0b('0x5'))(_0x0e0b('0x6'));var config=require(_0x0e0b('0x7'));var jayson=require(_0x0e0b('0x8'));var client=jayson[_0x0e0b('0x9')]['http']({'port':0x232a});config['redis']=_[_0x0e0b('0xa')](config[_0x0e0b('0xb')],{'host':_0x0e0b('0xc'),'port':0x18eb});var socket=require(_0x0e0b('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x0e0b('0xe')](socket);function respondWithRpcPromise(_0x163492,_0x5e1af1,_0x57b2a2){return new BPromise(function(_0x36381b,_0x1d0fac){return client[_0x0e0b('0xf')](_0x163492,_0x57b2a2)[_0x0e0b('0x10')](function(_0x46527c){logger[_0x0e0b('0x11')](_0x0e0b('0x12'),_0x5e1af1,_0x0e0b('0x13'));logger[_0x0e0b('0x14')](_0x0e0b('0x15'),_0x5e1af1,'request\x20sent',JSON[_0x0e0b('0x16')](_0x46527c));if(_0x46527c['error']){if(_0x46527c[_0x0e0b('0x17')]['code']===0x1f4){logger[_0x0e0b('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5e1af1,_0x46527c[_0x0e0b('0x17')][_0x0e0b('0x18')]);return _0x1d0fac(_0x46527c[_0x0e0b('0x17')][_0x0e0b('0x18')]);}logger[_0x0e0b('0x17')](_0x0e0b('0x12'),_0x5e1af1,_0x46527c[_0x0e0b('0x17')]['message']);return _0x36381b(_0x46527c[_0x0e0b('0x17')][_0x0e0b('0x18')]);}else{logger[_0x0e0b('0x11')](_0x0e0b('0x12'),_0x5e1af1,_0x0e0b('0x13'));_0x36381b(_0x46527c[_0x0e0b('0x19')][_0x0e0b('0x18')]);}})[_0x0e0b('0x1a')](function(_0x1318b7){logger[_0x0e0b('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5e1af1,_0x1318b7);_0x1d0fac(_0x1318b7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 646ee4f..2a8c9cb 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 _0x79fd=['register','length','chatWebsite:','save','remove','emit','removeListener'];(function(_0x60fa35,_0x12abc6){var _0x2d9933=function(_0x310304){while(--_0x310304){_0x60fa35['push'](_0x60fa35['shift']());}};_0x2d9933(++_0x12abc6);}(_0x79fd,0x114));var _0xd79f=function(_0xb48c0,_0x35e2c1){_0xb48c0=_0xb48c0-0x0;var _0x196404=_0x79fd[_0xb48c0];return _0x196404;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xd79f('0x0'),_0xd79f('0x1'),'update'];function createListener(_0x1450d7,_0x494ce3){return function(_0x1e3d77){_0x494ce3[_0xd79f('0x2')](_0x1450d7,_0x1e3d77);};}function removeListener(_0x281ab9,_0x509f19){return function(){ChatWebsiteEvents[_0xd79f('0x3')](_0x281ab9,_0x509f19);};}exports[_0xd79f('0x4')]=function(_0x56737e){for(var _0x2d5c2d=0x0,_0x4dcfb1=events[_0xd79f('0x5')];_0x2d5c2d<_0x4dcfb1;_0x2d5c2d++){var _0x9ba835=events[_0x2d5c2d];var _0x7b155d=createListener(_0xd79f('0x6')+_0x9ba835,_0x56737e);ChatWebsiteEvents['on'](_0x9ba835,_0x7b155d);}}; \ No newline at end of file +var _0x6816=['update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x231e97,_0x478239){var _0x4565b2=function(_0xce29c9){while(--_0xce29c9){_0x231e97['push'](_0x231e97['shift']());}};_0x4565b2(++_0x478239);}(_0x6816,0x126));var _0x6681=function(_0x1c8c26,_0xa43196){_0x1c8c26=_0x1c8c26-0x0;var _0xd021dd=_0x6816[_0x1c8c26];return _0xd021dd;};'use strict';var ChatWebsiteEvents=require(_0x6681('0x0'));var events=[_0x6681('0x1'),_0x6681('0x2'),_0x6681('0x3')];function createListener(_0x283205,_0x1d205e){return function(_0x11117f){_0x1d205e[_0x6681('0x4')](_0x283205,_0x11117f);};}function removeListener(_0x3c2261,_0x3c37c8){return function(){ChatWebsiteEvents[_0x6681('0x5')](_0x3c2261,_0x3c37c8);};}exports[_0x6681('0x6')]=function(_0xe50b7){for(var _0x88b1e5=0x0,_0x535138=events[_0x6681('0x7')];_0x88b1e5<_0x535138;_0x88b1e5++){var _0xc2b5bd=events[_0x88b1e5];var _0x365251=createListener(_0x6681('0x8')+_0xc2b5bd,_0xe50b7);ChatWebsiteEvents['on'](_0xc2b5bd,_0x365251);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 21ce322..86a6bfa 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 _0xe22e=['post','/:id/dispositions','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','single','addLogo','diskStorage','server/files/images/avatars/','originalname','/:id/avatar','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline-chat','ensureDir','extname','replace','offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','/:id/users','getAgents'];(function(_0x18295a,_0x381298){var _0x2a22a1=function(_0x57151d){while(--_0x57151d){_0x18295a['push'](_0x18295a['shift']());}};_0x2a22a1(++_0x381298);}(_0xe22e,0xfa));var _0xee22=function(_0x14790f,_0x432b5f){_0x14790f=_0x14790f-0x0;var _0x5acc1f=_0xe22e[_0x14790f];return _0x5acc1f;};'use strict';var multer=require(_0xee22('0x0'));var util=require(_0xee22('0x1'));var path=require(_0xee22('0x2'));var timeout=require(_0xee22('0x3'));var express=require(_0xee22('0x4'));var router=express['Router']();var fs_extra=require(_0xee22('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee22('0x6'));var config=require(_0xee22('0x7'));var controller=require(_0xee22('0x8'));router[_0xee22('0x9')]('/',auth[_0xee22('0xa')](),controller[_0xee22('0xb')]);router[_0xee22('0x9')](_0xee22('0xc'),auth[_0xee22('0xa')](),controller[_0xee22('0xd')]);router[_0xee22('0x9')](_0xee22('0xe'),auth[_0xee22('0xa')](),controller[_0xee22('0xf')]);router[_0xee22('0x9')]('/:id/dispositions',auth[_0xee22('0xa')](),controller[_0xee22('0x10')]);router[_0xee22('0x9')](_0xee22('0x11'),auth[_0xee22('0xa')](),controller[_0xee22('0x12')]);router[_0xee22('0x9')](_0xee22('0x13'),controller['getLogo']);router[_0xee22('0x9')]('/:id/avatar',controller[_0xee22('0x14')]);router[_0xee22('0x9')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xee22('0x9')](_0xee22('0x15'),controller[_0xee22('0x16')]);router[_0xee22('0x9')](_0xee22('0x17'),auth[_0xee22('0xa')](),controller[_0xee22('0x18')]);router[_0xee22('0x9')](_0xee22('0x19'),controller[_0xee22('0x1a')]);router[_0xee22('0x9')](_0xee22('0x1b'),auth['isAuthenticated'](),controller[_0xee22('0x1c')]);router['get']('/:id/proactive_actions',auth[_0xee22('0xa')](),controller[_0xee22('0x1d')]);router['get']('/:id/fields',controller[_0xee22('0x1e')]);router[_0xee22('0x9')](_0xee22('0x1f'),auth[_0xee22('0xa')](),controller['getOfflineMessages']);router[_0xee22('0x9')](_0xee22('0x20'),auth[_0xee22('0xa')](),controller[_0xee22('0x21')]);router[_0xee22('0x22')]('/',auth[_0xee22('0xa')](),controller['create']);router['post'](_0xee22('0x23'),auth[_0xee22('0xa')](),controller[_0xee22('0x24')]);router[_0xee22('0x22')](_0xee22('0x11'),auth[_0xee22('0xa')](),controller[_0xee22('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22d46f,_0x209e7e,_0x386d64){_0x386d64(null,path[_0xee22('0x26')](config[_0xee22('0x27')],_0xee22('0x28')));},'filename':function(_0x16c919,_0x2bdc08,_0x594f2b){_0x594f2b(null,util[_0xee22('0x29')](_0xee22('0x2a'),Date[_0xee22('0x2b')](),_0x2bdc08['originalname']));}})});router['post'](_0xee22('0x13'),upload[_0xee22('0x2c')]('file'),controller[_0xee22('0x2d')]);var upload=multer({'storage':multer[_0xee22('0x2e')]({'destination':function(_0x163da5,_0x23cac2,_0x5792a1){_0x5792a1(null,path[_0xee22('0x26')](config[_0xee22('0x27')],_0xee22('0x2f')));},'filename':function(_0x1aac97,_0x5468ef,_0x5496e4){_0x5496e4(null,util[_0xee22('0x29')](_0xee22('0x2a'),Date[_0xee22('0x2b')](),_0x5468ef[_0xee22('0x30')]));}})});router[_0xee22('0x22')](_0xee22('0x31'),upload[_0xee22('0x2c')]('file'),controller[_0xee22('0x32')]);var upload=multer({'storage':multer[_0xee22('0x2e')]({'destination':function(_0x4e194d,_0x376545,_0x59852f){_0x59852f(null,path[_0xee22('0x26')](config['root'],'server/files/images/avatars/'));},'filename':function(_0xdceca5,_0x38c1f0,_0x4c7713){_0x4c7713(null,util['format']('%s-%s',Date[_0xee22('0x2b')](),_0x38c1f0['originalname']));}})});router[_0xee22('0x22')](_0xee22('0x33'),upload['single']('file'),controller[_0xee22('0x34')]);var upload=multer({'storage':multer[_0xee22('0x2e')]({'destination':function(_0x5230e2,_0x7f8b47,_0x465bbd){_0x465bbd(null,path[_0xee22('0x26')](config['root'],_0xee22('0x2f')));},'filename':function(_0x4b0a2c,_0x4575d9,_0xefe1ad){_0xefe1ad(null,util[_0xee22('0x29')]('%s-%s',Date[_0xee22('0x2b')](),_0x4575d9[_0xee22('0x30')]));}})});router[_0xee22('0x22')](_0xee22('0x15'),upload['single']('file'),controller[_0xee22('0x35')]);router[_0xee22('0x22')](_0xee22('0x36'),controller[_0xee22('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x14a2df,_0x2e5e96,_0x362db0){const _0x4b0862=path[_0xee22('0x26')](config[_0xee22('0x27')],'server/files','attachments',_0xee22('0x38'));fs_extra[_0xee22('0x39')](_0x4b0862,function(){_0x362db0(null,_0x4b0862);});},'filename':function(_0x4e617f,_0x5c7669,_0x21f886){const _0x54e0f7=_0x5c7669[_0xee22('0x30')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x47f378=path[_0xee22('0x3a')](_0x54e0f7);const _0xb6128c=Date[_0xee22('0x2b')]()+'-'+_0x54e0f7[_0xee22('0x3b')](_0x47f378,'')+_0x47f378;_0x21f886(null,_0xb6128c);}})});router['post']('/:id/offline',offlineUploadMulter['any'](),controller[_0xee22('0x3c')]);router[_0xee22('0x22')]('/:id/interactions',auth[_0xee22('0xa')](),controller['addInteraction']);router['post'](_0xee22('0x1b'),auth[_0xee22('0xa')](),controller[_0xee22('0x3d')]);router[_0xee22('0x22')]('/:id/proactive_actions',auth[_0xee22('0xa')](),controller[_0xee22('0x3e')]);router[_0xee22('0x22')](_0xee22('0x20'),auth[_0xee22('0xa')](),controller[_0xee22('0x3f')]);router[_0xee22('0x40')]('/:id',auth[_0xee22('0xa')](),controller[_0xee22('0x41')]);router[_0xee22('0x42')]('/:id',auth[_0xee22('0xa')](),controller[_0xee22('0x43')]);router[_0xee22('0x42')](_0xee22('0x23'),auth[_0xee22('0xa')](),controller[_0xee22('0x44')]);router[_0xee22('0x42')](_0xee22('0x11'),auth[_0xee22('0xa')](),controller[_0xee22('0x45')]);router[_0xee22('0x42')]('/:id/users',auth[_0xee22('0xa')](),controller['removeAgents']);module[_0xee22('0x46')]=router; \ No newline at end of file +var _0x004b=['/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','format','now','originalname','file','root','server/files/images/avatars/','single','%s-%s','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace'];(function(_0x4b3280,_0x2b3d50){var _0x4005c2=function(_0x16d705){while(--_0x16d705){_0x4b3280['push'](_0x4b3280['shift']());}};_0x4005c2(++_0x2b3d50);}(_0x004b,0x171));var _0xb004=function(_0x21b580,_0x5b7172){_0x21b580=_0x21b580-0x0;var _0x16a50e=_0x004b[_0x21b580];return _0x16a50e;};'use strict';var multer=require(_0xb004('0x0'));var util=require(_0xb004('0x1'));var path=require('path');var timeout=require(_0xb004('0x2'));var express=require(_0xb004('0x3'));var router=express[_0xb004('0x4')]();var fs_extra=require(_0xb004('0x5'));var auth=require(_0xb004('0x6'));var interaction=require(_0xb004('0x7'));var config=require('../../config/environment');var controller=require(_0xb004('0x8'));router[_0xb004('0x9')]('/',auth['isAuthenticated'](),controller[_0xb004('0xa')]);router[_0xb004('0x9')]('/describe',auth[_0xb004('0xb')](),controller[_0xb004('0xc')]);router[_0xb004('0x9')](_0xb004('0xd'),auth[_0xb004('0xb')](),controller[_0xb004('0xe')]);router[_0xb004('0x9')](_0xb004('0xf'),auth[_0xb004('0xb')](),controller[_0xb004('0x10')]);router[_0xb004('0x9')](_0xb004('0x11'),auth['isAuthenticated'](),controller[_0xb004('0x12')]);router[_0xb004('0x9')](_0xb004('0x13'),controller[_0xb004('0x14')]);router['get'](_0xb004('0x15'),controller['getAvatar']);router[_0xb004('0x9')](_0xb004('0x16'),controller[_0xb004('0x17')]);router[_0xb004('0x9')](_0xb004('0x18'),controller['getSystemAvatar']);router[_0xb004('0x9')](_0xb004('0x19'),auth[_0xb004('0xb')](),controller[_0xb004('0x1a')]);router[_0xb004('0x9')](_0xb004('0x1b'),controller[_0xb004('0x1c')]);router[_0xb004('0x9')](_0xb004('0x1d'),auth[_0xb004('0xb')](),controller['getApplications']);router[_0xb004('0x9')](_0xb004('0x1e'),auth['isAuthenticated'](),controller[_0xb004('0x1f')]);router[_0xb004('0x9')](_0xb004('0x20'),controller[_0xb004('0x21')]);router['get'](_0xb004('0x22'),auth[_0xb004('0xb')](),controller['getOfflineMessages']);router[_0xb004('0x9')](_0xb004('0x23'),auth[_0xb004('0xb')](),controller[_0xb004('0x24')]);router[_0xb004('0x25')]('/',auth[_0xb004('0xb')](),controller['create']);router[_0xb004('0x25')](_0xb004('0xf'),auth[_0xb004('0xb')](),controller[_0xb004('0x26')]);router[_0xb004('0x25')](_0xb004('0x11'),auth[_0xb004('0xb')](),controller[_0xb004('0x27')]);var upload=multer({'storage':multer[_0xb004('0x28')]({'destination':function(_0x51c11a,_0x277d06,_0xf8125e){_0xf8125e(null,path[_0xb004('0x29')](config['root'],'server/files/images/logos/'));},'filename':function(_0xcdaf85,_0x3f104b,_0x3aa826){_0x3aa826(null,util[_0xb004('0x2a')]('%s-%s',Date[_0xb004('0x2b')](),_0x3f104b[_0xb004('0x2c')]));}})});router[_0xb004('0x25')](_0xb004('0x13'),upload['single'](_0xb004('0x2d')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x552e9c,_0x2d5fec,_0x18fb87){_0x18fb87(null,path['join'](config[_0xb004('0x2e')],_0xb004('0x2f')));},'filename':function(_0x5e08bb,_0x14a614,_0x32d0a5){_0x32d0a5(null,util['format']('%s-%s',Date['now'](),_0x14a614[_0xb004('0x2c')]));}})});router['post'](_0xb004('0x15'),upload[_0xb004('0x30')](_0xb004('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0xb004('0x28')]({'destination':function(_0x1fe02a,_0xdab94a,_0x3f1a5d){_0x3f1a5d(null,path[_0xb004('0x29')](config['root'],_0xb004('0x2f')));},'filename':function(_0x223094,_0x363f7a,_0x3afeba){_0x3afeba(null,util[_0xb004('0x2a')](_0xb004('0x31'),Date[_0xb004('0x2b')](),_0x363f7a[_0xb004('0x2c')]));}})});router[_0xb004('0x25')](_0xb004('0x16'),upload[_0xb004('0x30')](_0xb004('0x2d')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xb004('0x28')]({'destination':function(_0x4cc0fe,_0x5f07a6,_0x4a7f66){_0x4a7f66(null,path[_0xb004('0x29')](config[_0xb004('0x2e')],_0xb004('0x2f')));},'filename':function(_0x5e8747,_0x4b443d,_0x2261f5){_0x2261f5(null,util[_0xb004('0x2a')](_0xb004('0x31'),Date[_0xb004('0x2b')](),_0x4b443d[_0xb004('0x2c')]));}})});router[_0xb004('0x25')]('/:id/system_avatar',upload[_0xb004('0x30')](_0xb004('0x2d')),controller['addSystemAvatar']);router['post'](_0xb004('0x32'),controller[_0xb004('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xb004('0x28')]({'destination':function(_0x19b13e,_0x5c0038,_0x2d8dc2){const _0x3c0bf2=path[_0xb004('0x29')](config[_0xb004('0x2e')],_0xb004('0x34'),_0xb004('0x35'),_0xb004('0x36'));fs_extra[_0xb004('0x37')](_0x3c0bf2,function(){_0x2d8dc2(null,_0x3c0bf2);});},'filename':function(_0x588b32,_0x4b6989,_0x403e8a){const _0xd02bf8=_0x4b6989[_0xb004('0x2c')][_0xb004('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xc5ac08=path['extname'](_0xd02bf8);const _0x4e27ef=Date[_0xb004('0x2b')]()+'-'+_0xd02bf8[_0xb004('0x38')](_0xc5ac08,'')+_0xc5ac08;_0x403e8a(null,_0x4e27ef);}})});router['post'](_0xb004('0x39'),offlineUploadMulter[_0xb004('0x3a')](),controller[_0xb004('0x3b')]);router['post'](_0xb004('0x19'),auth[_0xb004('0xb')](),controller['addInteraction']);router[_0xb004('0x25')]('/:id/applications',auth[_0xb004('0xb')](),controller[_0xb004('0x3c')]);router[_0xb004('0x25')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xb004('0x3d')]);router[_0xb004('0x25')](_0xb004('0x23'),auth[_0xb004('0xb')](),controller[_0xb004('0x3e')]);router[_0xb004('0x3f')](_0xb004('0xd'),auth[_0xb004('0xb')](),controller[_0xb004('0x40')]);router[_0xb004('0x41')](_0xb004('0xd'),auth[_0xb004('0xb')](),controller[_0xb004('0x42')]);router[_0xb004('0x41')](_0xb004('0xf'),auth['isAuthenticated'](),controller[_0xb004('0x43')]);router[_0xb004('0x41')](_0xb004('0x11'),auth[_0xb004('0xb')](),controller[_0xb004('0x44')]);router[_0xb004('0x41')](_0xb004('0x23'),auth[_0xb004('0xb')](),controller[_0xb004('0x45')]);module[_0xb004('0x46')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 98f0c59..aa6ae81 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 _0x1740=['express','../components/auth/service','../config/environment','Router','production','app','get','client-side-logger','expressEndpoint','/client-logs','exports','beaver-logger/server'];(function(_0x26c559,_0x3421ec){var _0x262123=function(_0x194378){while(--_0x194378){_0x26c559['push'](_0x26c559['shift']());}};_0x262123(++_0x3421ec);}(_0x1740,0x143));var _0x0174=function(_0x19efa0,_0x245b7b){_0x19efa0=_0x19efa0-0x0;var _0x374b08=_0x1740[_0x19efa0];return _0x374b08;};var beaverLogger=require(_0x0174('0x0'));var express=require(_0x0174('0x1'));var auth=require(_0x0174('0x2'));var config=require(_0x0174('0x3'));var router=express[_0x0174('0x4')]();var isProduction=config['env']===_0x0174('0x5')||![];function clientSideLogs(_0x5a2059,_0xca4224,_0x4c3726){var _0x1a3f9e=_0x5a2059[_0x0174('0x6')][_0x0174('0x7')](_0x0174('0x8'));if(!_0x1a3f9e){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x0174('0x9')]({'uri':_0x0174('0xa'),'logger':_0x1a3f9e,'enableCors':!isProduction})(_0x5a2059,_0xca4224,_0x4c3726);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x0174('0xb')]=router; \ No newline at end of file +var _0x4ea5=['use','isAuthenticated','exports','beaver-logger/server','../config/environment','Router','env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x4ea5,0xd3));var _0x54ea=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x4ea5[_0x550d12];return _0x12103d;};var beaverLogger=require(_0x54ea('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x54ea('0x1'));var router=express[_0x54ea('0x2')]();var isProduction=config[_0x54ea('0x3')]==='production'||![];function clientSideLogs(_0x47b7f5,_0x4dc268,_0xa6a5ed){var _0x1dc925=_0x47b7f5[_0x54ea('0x4')][_0x54ea('0x5')](_0x54ea('0x6'));if(!_0x1dc925){throw new Error(_0x54ea('0x7'));}return beaverLogger[_0x54ea('0x8')]({'uri':_0x54ea('0x9'),'logger':_0x1dc925,'enableCors':!isProduction})(_0x47b7f5,_0x4dc268,_0xa6a5ed);}router[_0x54ea('0xa')](auth[_0x54ea('0xb')](),clientSideLogs);module[_0x54ea('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c54c1c9..2f71b6e 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 _0x62d7=['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','sequelize','exports','STRING','Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365'];(function(_0x52969b,_0x35eb2e){var _0x157c5b=function(_0x26ffef){while(--_0x26ffef){_0x52969b['push'](_0x52969b['shift']());}};_0x157c5b(++_0x35eb2e);}(_0x62d7,0x168));var _0x762d=function(_0x29c54e,_0xd415a2){_0x29c54e=_0x29c54e-0x0;var _0x142be0=_0x62d7[_0x29c54e];return _0x142be0;};'use strict';var Sequelize=require(_0x762d('0x0'));module[_0x762d('0x1')]={'name':{'type':Sequelize[_0x762d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x762d('0x3'),_0x762d('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x762d('0x5')](_0x762d('0x6'),_0x762d('0x7'))},'data1':{'type':Sequelize[_0x762d('0x2')],'comment':_0x762d('0x8')},'data2':{'type':Sequelize[_0x762d('0x2')],'comment':_0x762d('0x9')},'data3':{'type':Sequelize[_0x762d('0x2')],'comment':_0x762d('0xa')},'data4':{'type':Sequelize[_0x762d('0x2')],'comment':_0x762d('0xb')},'data5':{'type':Sequelize[_0x762d('0xc')],'comment':_0x762d('0xd')},'data6':{'type':Sequelize[_0x762d('0xc')],'comment':_0x762d('0xe')},'data7':{'type':Sequelize[_0x762d('0xc')],'comment':_0x762d('0xf')}}; \ No newline at end of file +var _0xdcce=['ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x19f094,_0x53af25){var _0x122ad5=function(_0x29dd24){while(--_0x29dd24){_0x19f094['push'](_0x19f094['shift']());}};_0x122ad5(++_0x53af25);}(_0xdcce,0xad));var _0xedcc=function(_0x2d1e90,_0x359a52){_0x2d1e90=_0x2d1e90-0x0;var _0x3c168b=_0xdcce[_0x2d1e90];return _0x3c168b;};'use strict';var Sequelize=require(_0xedcc('0x0'));module[_0xedcc('0x1')]={'name':{'type':Sequelize[_0xedcc('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xedcc('0x3')](_0xedcc('0x4'),_0xedcc('0x5'),_0xedcc('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xedcc('0x3')](_0xedcc('0x7'),_0xedcc('0x8'))},'data1':{'type':Sequelize[_0xedcc('0x2')],'comment':_0xedcc('0x9')},'data2':{'type':Sequelize[_0xedcc('0x2')],'comment':_0xedcc('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0xedcc('0xb')},'data4':{'type':Sequelize[_0xedcc('0x2')],'comment':_0xedcc('0xc')},'data5':{'type':Sequelize[_0xedcc('0xd')],'comment':_0xedcc('0xe')},'data6':{'type':Sequelize[_0xedcc('0xd')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xedcc('0xd')],'comment':_0xedcc('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8951d76..9cbcaab 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 _0x2baf=['status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','sendStatus','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','show','params','options','find','decryptString','create','Name\x20parameter\x20not\x20specified','values','includes','body','join','encryptString','catch','oauth2MicrosoftAuthorize','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','access_token','refresh_token','update','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','end'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x2baf,0x1cd));var _0xf2ba=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x2baf[_0x2afbb0];return _0x411ff2;};'use strict';var _=require(_0xf2ba('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0xf2ba('0x1'));var logger=require('../../config/logger')(_0xf2ba('0x2'));var db=require(_0xf2ba('0x3'))['db'];var oauth=require(_0xf2ba('0x4'));config[_0xf2ba('0x5')]=_[_0xf2ba('0x6')](config[_0xf2ba('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2ba('0x7'))(new Redis(config[_0xf2ba('0x5')]));var redis=new Redis(config[_0xf2ba('0x5')]);function respondWithStatusCode(_0x22f241,_0x3cda5e){_0x3cda5e=_0x3cda5e||0xcc;return function(_0x404681){if(_0x404681){return _0x22f241['sendStatus'](_0x3cda5e);}return _0x22f241['status'](_0x3cda5e)[_0xf2ba('0x8')]();};}function respondWithResult(_0x8b9c94,_0x2b84bf){_0x2b84bf=_0x2b84bf||0xc8;return function(_0x21ae11){if(_0x21ae11){return _0x8b9c94[_0xf2ba('0x9')](_0x2b84bf)[_0xf2ba('0xa')](_0x21ae11);}};}function respondWithFilteredResult(_0x1c1c9d,_0x4a55c9){return function(_0x15d5c6){if(_0x15d5c6){var _0x4616a2=typeof _0x4a55c9[_0xf2ba('0xb')]===_0xf2ba('0xc')&&typeof _0x4a55c9[_0xf2ba('0xd')]===_0xf2ba('0xc');var _0x266448=_0x15d5c6[_0xf2ba('0xe')];var _0x2e06d1=_0x4616a2?0x0:_0x4a55c9[_0xf2ba('0xb')];var _0x1ebec7=_0x4616a2?_0x15d5c6[_0xf2ba('0xe')]:_0x4a55c9['offset']+_0x4a55c9[_0xf2ba('0xd')];var _0x1a02ac;if(_0x1ebec7>=_0x266448){_0x1ebec7=_0x266448;_0x1a02ac=0xc8;}else{_0x1a02ac=0xce;}_0x1c1c9d[_0xf2ba('0x9')](_0x1a02ac);return _0x1c1c9d[_0xf2ba('0xf')](_0xf2ba('0x10'),_0x2e06d1+'-'+_0x1ebec7+'/'+_0x266448)[_0xf2ba('0xa')](_0x15d5c6);}return null;};}function saveUpdates(_0x3f47ea){return function(_0xdaceab){if(_0xdaceab){return _0xdaceab['update'](_0x3f47ea)['then'](function(_0x140fbe){return _0x140fbe;});}return null;};}function removeEntity(_0x1097cf){return function(_0xed32a8){if(_0xed32a8){return _0xed32a8[_0xf2ba('0x11')]()[_0xf2ba('0x12')](function(){_0x1097cf[_0xf2ba('0x9')](0xcc)[_0xf2ba('0x8')]();});}};}function handleEntityNotFound(_0x5d5b82){return function(_0x22d884){if(!_0x22d884){_0x5d5b82[_0xf2ba('0x13')](0x194);}return _0x22d884;};}function handleError(_0xbe698f,_0x52c8ef){_0x52c8ef=_0x52c8ef||0x1f4;return function(_0xa0436a){logger[_0xf2ba('0x14')](_0xa0436a[_0xf2ba('0x15')]);if(_0xa0436a[_0xf2ba('0x16')]){delete _0xa0436a[_0xf2ba('0x16')];}_0xbe698f[_0xf2ba('0x9')](_0x52c8ef)[_0xf2ba('0x17')](_0xa0436a);};}function maskClientSecret(_0x314c5b){return _[_0xf2ba('0x18')](_0x314c5b[_0xf2ba('0x19')](0x0,0x3),0x14,'*');}exports[_0xf2ba('0x1a')]=function(_0x248ff9,_0x61c2fc){var _0x5f3d62={},_0x4146bc={},_0x49894a={'count':0x0,'rows':[]};var _0x384a6f=_[_0xf2ba('0x1b')](db[_0xf2ba('0x1c')][_0xf2ba('0x1d')],function(_0x3ef2b8){return{'name':_0x3ef2b8[_0xf2ba('0x1e')],'type':_0x3ef2b8[_0xf2ba('0x1f')][_0xf2ba('0x20')]};});_0x4146bc['model']=_['map'](_0x384a6f,_0xf2ba('0x16'));_0x4146bc[_0xf2ba('0x21')]=_[_0xf2ba('0x22')](_0x248ff9[_0xf2ba('0x21')]);_0x4146bc['filters']=_[_0xf2ba('0x23')](_0x4146bc[_0xf2ba('0x24')],_0x4146bc[_0xf2ba('0x21')]);_0x5f3d62[_0xf2ba('0x25')]=_['intersection'](_0x4146bc[_0xf2ba('0x24')],qs[_0xf2ba('0x26')](_0x248ff9['query'][_0xf2ba('0x26')]));_0x5f3d62['attributes']=_0x5f3d62[_0xf2ba('0x25')][_0xf2ba('0x27')]?_0x5f3d62[_0xf2ba('0x25')]:_0x4146bc[_0xf2ba('0x24')];if(!_0x248ff9['query'][_0xf2ba('0x28')](_0xf2ba('0x29'))){_0x5f3d62[_0xf2ba('0xd')]=qs['limit'](_0x248ff9[_0xf2ba('0x21')][_0xf2ba('0xd')]);_0x5f3d62[_0xf2ba('0xb')]=qs[_0xf2ba('0xb')](_0x248ff9['query'][_0xf2ba('0xb')]);}_0x5f3d62[_0xf2ba('0x2a')]=qs[_0xf2ba('0x2b')](_0x248ff9[_0xf2ba('0x21')][_0xf2ba('0x2b')]);_0x5f3d62[_0xf2ba('0x2c')]=qs[_0xf2ba('0x2d')](_['pick'](_0x248ff9['query'],_0x4146bc[_0xf2ba('0x2d')]),_0x384a6f);if(_0x248ff9[_0xf2ba('0x21')][_0xf2ba('0x2e')]){_0x5f3d62[_0xf2ba('0x2c')]=_['merge'](_0x5f3d62[_0xf2ba('0x2c')],{'$or':_[_0xf2ba('0x1b')](_0x384a6f,function(_0x532063){if(_0x532063[_0xf2ba('0x1f')]!=='VIRTUAL'){var _0x1e375e={};_0x1e375e[_0x532063[_0xf2ba('0x16')]]={'$like':'%'+_0x248ff9[_0xf2ba('0x21')][_0xf2ba('0x2e')]+'%'};return _0x1e375e;}})});}_0x5f3d62=_[_0xf2ba('0x2f')]({},_0x5f3d62,_0x248ff9['options']);var _0x2cd520={'where':_0x5f3d62[_0xf2ba('0x2c')]};return db[_0xf2ba('0x1c')][_0xf2ba('0xe')](_0x2cd520)[_0xf2ba('0x12')](function(_0x3da1cd){_0x49894a['count']=_0x3da1cd;if(_0x248ff9['query'][_0xf2ba('0x30')]){_0x5f3d62[_0xf2ba('0x31')]=[{'all':!![]}];}return db[_0xf2ba('0x1c')][_0xf2ba('0x32')](_0x5f3d62);})[_0xf2ba('0x12')](function(_0x314b9f){_0x49894a[_0xf2ba('0x33')]=_[_0xf2ba('0x1b')](_0x314b9f,function(_0x4362a0){if(_0x4362a0[_0xf2ba('0x34')]===_0xf2ba('0x35')){var _0x50a991=encryptor['decryptString'](_0x4362a0[_0xf2ba('0x36')]);_0x4362a0[_0xf2ba('0x36')]=maskClientSecret(_0x50a991);}return _0x4362a0;});return _0x49894a;})[_0xf2ba('0x12')](respondWithFilteredResult(_0x61c2fc,_0x5f3d62))['catch'](handleError(_0x61c2fc,null));};exports[_0xf2ba('0x37')]=function(_0x1a65bb,_0x520abc){var _0x4c435d={'raw':!![],'where':{'id':_0x1a65bb[_0xf2ba('0x38')]['id']}},_0x174a83={};_0x174a83[_0xf2ba('0x24')]=_['keys'](db['CloudProvider'][_0xf2ba('0x1d')]);_0x174a83[_0xf2ba('0x21')]=_[_0xf2ba('0x22')](_0x1a65bb[_0xf2ba('0x21')]);_0x174a83[_0xf2ba('0x2d')]=_['intersection'](_0x174a83[_0xf2ba('0x24')],_0x174a83[_0xf2ba('0x21')]);_0x4c435d[_0xf2ba('0x25')]=_[_0xf2ba('0x23')](_0x174a83[_0xf2ba('0x24')],qs[_0xf2ba('0x26')](_0x1a65bb[_0xf2ba('0x21')]['fields']));_0x4c435d[_0xf2ba('0x25')]=_0x4c435d[_0xf2ba('0x25')][_0xf2ba('0x27')]?_0x4c435d[_0xf2ba('0x25')]:_0x174a83[_0xf2ba('0x24')];if(_0x1a65bb[_0xf2ba('0x21')]['includeAll']){_0x4c435d[_0xf2ba('0x31')]=[{'all':!![]}];}_0x4c435d=_[_0xf2ba('0x2f')]({},_0x4c435d,_0x1a65bb[_0xf2ba('0x39')]);return db[_0xf2ba('0x1c')][_0xf2ba('0x3a')](_0x4c435d)[_0xf2ba('0x12')](handleEntityNotFound(_0x520abc,null))[_0xf2ba('0x12')](function(_0x23a300){if(_0x23a300[_0xf2ba('0x34')]===_0xf2ba('0x35')){var _0x57bf3c=encryptor[_0xf2ba('0x3b')](_0x23a300['data3']);_0x23a300['data3']=maskClientSecret(_0x57bf3c);}return _0x23a300;})[_0xf2ba('0x12')](respondWithResult(_0x520abc,null))['catch'](handleError(_0x520abc,null));};exports[_0xf2ba('0x3c')]=function(_0x56816f,_0x420925){if(!_0x56816f['body'][_0xf2ba('0x16')])throw new Error(_0xf2ba('0x3d'));if(!_0x56816f['body']['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x229f62=db[_0xf2ba('0x1c')][_0xf2ba('0x1d')]['service'][_0xf2ba('0x3e')];if(!_0x229f62[_0xf2ba('0x3f')](_0x56816f[_0xf2ba('0x40')][_0xf2ba('0x34')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x229f62[_0xf2ba('0x41')](',\x20'));if(_0x56816f[_0xf2ba('0x40')]['service']===_0xf2ba('0x35')&&_0x56816f[_0xf2ba('0x40')][_0xf2ba('0x36')]){_0x56816f[_0xf2ba('0x40')][_0xf2ba('0x36')]=encryptor[_0xf2ba('0x42')](_0x56816f[_0xf2ba('0x40')]['data3']);}return db['CloudProvider'][_0xf2ba('0x3c')](_0x56816f['body'],{})[_0xf2ba('0x12')](respondWithResult(_0x420925,0xc9))['catch'](handleError(_0x420925,null));};exports['update']=function(_0x3f17c5,_0x4552c5){if(_0x3f17c5[_0xf2ba('0x40')]['id']){delete _0x3f17c5[_0xf2ba('0x40')]['id'];}return db[_0xf2ba('0x1c')][_0xf2ba('0x3a')]({'where':{'id':_0x3f17c5[_0xf2ba('0x38')]['id']}})[_0xf2ba('0x12')](handleEntityNotFound(_0x4552c5,null))['then'](function(_0x12f45c){if(_0x12f45c[_0xf2ba('0x34')]===_0xf2ba('0x35')&&_0x3f17c5[_0xf2ba('0x40')][_0xf2ba('0x36')]){_0x3f17c5['body'][_0xf2ba('0x36')]=encryptor['encryptString'](_0x3f17c5[_0xf2ba('0x40')][_0xf2ba('0x36')]);}return _0x12f45c;})[_0xf2ba('0x12')](saveUpdates(_0x3f17c5[_0xf2ba('0x40')],null))[_0xf2ba('0x12')](respondWithResult(_0x4552c5,null))['catch'](handleError(_0x4552c5,null));};exports[_0xf2ba('0x11')]=function(_0x496e50,_0x2afe6d){return db[_0xf2ba('0x1c')][_0xf2ba('0x3a')]({'where':{'id':_0x496e50['params']['id']}})[_0xf2ba('0x12')](handleEntityNotFound(_0x2afe6d,null))[_0xf2ba('0x12')](removeEntity(_0x2afe6d,null))[_0xf2ba('0x43')](handleError(_0x2afe6d,null));};exports[_0xf2ba('0x44')]=function(_0x239142,_0x570282){return db[_0xf2ba('0x1c')]['findOne']({'where':{'id':_0x239142[_0xf2ba('0x38')]['id']},'raw':!![]})['then'](function(_0x36f413){if(!_0x36f413)return _0x570282['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x36f413,_0x239142[_0xf2ba('0x45')]['id'])};})[_0xf2ba('0x12')](respondWithResult(_0x570282,null))[_0xf2ba('0x43')](handleError(_0x570282,null));};exports['oauth2MicrosoftCallback']=function(_0x135851,_0x553759){var _0x384453=_0x135851[_0xf2ba('0x40')];var _0x529656;var _0x1d9aac;if(_0x384453[_0xf2ba('0x14')])throw _0x384453;redis[_0xf2ba('0x46')](_0x384453[_0xf2ba('0x47')])['then'](function(_0x2ab535){if(!_0x2ab535)throw new Error(_0xf2ba('0x48'));_0x529656=JSON[_0xf2ba('0x49')](_0x2ab535);var _0x50230b=Buffer[_0xf2ba('0x4a')](_0x384453['state'],_0xf2ba('0x4b'))[_0xf2ba('0x4c')](_0xf2ba('0x4d'));_0x1d9aac=JSON[_0xf2ba('0x49')](_0x50230b);if(!oauth[_0xf2ba('0x4e')](_0x384453[_0xf2ba('0x4f')],_0x529656[_0xf2ba('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xf2ba('0x51')](_0x384453['state']);return oauth[_0xf2ba('0x52')](_0x384453[_0xf2ba('0x53')],_0x529656);})['then'](function(_0x92bb48){_0x529656['data5']=_0x92bb48[_0xf2ba('0x54')];_0x529656['data6']=_0x92bb48[_0xf2ba('0x55')];return db[_0xf2ba('0x1c')][_0xf2ba('0x56')]({'data5':_0x529656['data5'],'data6':_0x529656['data6']},{'where':{'id':_0x529656['id']}});})[_0xf2ba('0x12')](function(){oauth[_0xf2ba('0x57')](_0x529656);socket[_0xf2ba('0x58')]('microsoftAuthorization:success',{'id':_0x1d9aac['id']});return;})[_0xf2ba('0x12')](respondWithStatusCode(_0x553759,null))[_0xf2ba('0x43')](function(_0x30496c){if(_0x1d9aac){socket[_0xf2ba('0x58')](_0xf2ba('0x59'),{'id':_0x1d9aac['id']});}if(!_0x529656){logger[_0xf2ba('0x14')](_0xf2ba('0x5a'),_0x30496c);return _0x553759[_0xf2ba('0x9')](0x1f4)[_0xf2ba('0x17')](_0x30496c[_0xf2ba('0x5b')]);}logger[_0xf2ba('0x14')](_0xf2ba('0x5c'),_0x529656['id'],JSON[_0xf2ba('0x5d')](_0x30496c));});}; \ No newline at end of file +var _0xdef4=['filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','decryptString','data3','params','rawAttributes','intersection','includeAll','options','find','MicrosoftAzure','catch','body','Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','values','join','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','json','undefined','limit','count','offset','update','then','destroy','sendStatus','error','stack','name','send','padEnd','slice','index','map','CloudProvider','type','key','model','query','keys'];(function(_0x52740f,_0x343961){var _0x1cbe11=function(_0x376976){while(--_0x376976){_0x52740f['push'](_0x52740f['shift']());}};_0x1cbe11(++_0x343961);}(_0xdef4,0x94));var _0x4def=function(_0x24eab8,_0x2f471c){_0x24eab8=_0x24eab8-0x0;var _0x41d883=_0xdef4[_0x24eab8];return _0x41d883;};'use strict';var _=require(_0x4def('0x0'));var Redis=require(_0x4def('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x4def('0x2'));var config=require(_0x4def('0x3'));var logger=require('../../config/logger')(_0x4def('0x4'));var db=require(_0x4def('0x5'))['db'];var oauth=require(_0x4def('0x6'));config[_0x4def('0x7')]=_[_0x4def('0x8')](config['redis'],{'host':_0x4def('0x9'),'port':0x18eb});var socket=require(_0x4def('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x4def('0x7')]);function respondWithStatusCode(_0x2697b7,_0x4db75e){_0x4db75e=_0x4db75e||0xcc;return function(_0x18cb56){if(_0x18cb56){return _0x2697b7['sendStatus'](_0x4db75e);}return _0x2697b7[_0x4def('0xb')](_0x4db75e)[_0x4def('0xc')]();};}function respondWithResult(_0x2f479d,_0x140490){_0x140490=_0x140490||0xc8;return function(_0x3128c7){if(_0x3128c7){return _0x2f479d[_0x4def('0xb')](_0x140490)[_0x4def('0xd')](_0x3128c7);}};}function respondWithFilteredResult(_0x4ab486,_0x3e222c){return function(_0x3c50c6){if(_0x3c50c6){var _0x178869=typeof _0x3e222c['offset']===_0x4def('0xe')&&typeof _0x3e222c[_0x4def('0xf')]===_0x4def('0xe');var _0x3556e2=_0x3c50c6[_0x4def('0x10')];var _0x3b623b=_0x178869?0x0:_0x3e222c[_0x4def('0x11')];var _0x467b18=_0x178869?_0x3c50c6['count']:_0x3e222c[_0x4def('0x11')]+_0x3e222c[_0x4def('0xf')];var _0x4b0d08;if(_0x467b18>=_0x3556e2){_0x467b18=_0x3556e2;_0x4b0d08=0xc8;}else{_0x4b0d08=0xce;}_0x4ab486[_0x4def('0xb')](_0x4b0d08);return _0x4ab486['set']('Content-Range',_0x3b623b+'-'+_0x467b18+'/'+_0x3556e2)[_0x4def('0xd')](_0x3c50c6);}return null;};}function saveUpdates(_0x22ba32){return function(_0x1b88f2){if(_0x1b88f2){return _0x1b88f2[_0x4def('0x12')](_0x22ba32)[_0x4def('0x13')](function(_0x7712b1){return _0x7712b1;});}return null;};}function removeEntity(_0x2ed17f){return function(_0x5733d0){if(_0x5733d0){return _0x5733d0[_0x4def('0x14')]()[_0x4def('0x13')](function(){_0x2ed17f['status'](0xcc)[_0x4def('0xc')]();});}};}function handleEntityNotFound(_0x59e14a){return function(_0x188fd2){if(!_0x188fd2){_0x59e14a[_0x4def('0x15')](0x194);}return _0x188fd2;};}function handleError(_0x37e188,_0x255779){_0x255779=_0x255779||0x1f4;return function(_0x5337a7){logger[_0x4def('0x16')](_0x5337a7[_0x4def('0x17')]);if(_0x5337a7[_0x4def('0x18')]){delete _0x5337a7['name'];}_0x37e188[_0x4def('0xb')](_0x255779)[_0x4def('0x19')](_0x5337a7);};}function maskClientSecret(_0x4ba3f9){return _[_0x4def('0x1a')](_0x4ba3f9[_0x4def('0x1b')](0x0,0x3),0x14,'*');}exports[_0x4def('0x1c')]=function(_0x508eab,_0x33bbde){var _0x2c1232={},_0x1cc6dd={},_0x336314={'count':0x0,'rows':[]};var _0x39663d=_[_0x4def('0x1d')](db[_0x4def('0x1e')]['rawAttributes'],function(_0x37eac4){return{'name':_0x37eac4['fieldName'],'type':_0x37eac4[_0x4def('0x1f')][_0x4def('0x20')]};});_0x1cc6dd[_0x4def('0x21')]=_[_0x4def('0x1d')](_0x39663d,_0x4def('0x18'));_0x1cc6dd[_0x4def('0x22')]=_[_0x4def('0x23')](_0x508eab[_0x4def('0x22')]);_0x1cc6dd[_0x4def('0x24')]=_['intersection'](_0x1cc6dd['model'],_0x1cc6dd[_0x4def('0x22')]);_0x2c1232[_0x4def('0x25')]=_['intersection'](_0x1cc6dd['model'],qs[_0x4def('0x26')](_0x508eab[_0x4def('0x22')]['fields']));_0x2c1232['attributes']=_0x2c1232[_0x4def('0x25')][_0x4def('0x27')]?_0x2c1232[_0x4def('0x25')]:_0x1cc6dd['model'];if(!_0x508eab['query'][_0x4def('0x28')]('nolimit')){_0x2c1232[_0x4def('0xf')]=qs[_0x4def('0xf')](_0x508eab['query'][_0x4def('0xf')]);_0x2c1232[_0x4def('0x11')]=qs[_0x4def('0x11')](_0x508eab[_0x4def('0x22')][_0x4def('0x11')]);}_0x2c1232[_0x4def('0x29')]=qs[_0x4def('0x2a')](_0x508eab['query'][_0x4def('0x2a')]);_0x2c1232[_0x4def('0x2b')]=qs[_0x4def('0x24')](_[_0x4def('0x2c')](_0x508eab[_0x4def('0x22')],_0x1cc6dd[_0x4def('0x24')]),_0x39663d);if(_0x508eab[_0x4def('0x22')]['filter']){_0x2c1232[_0x4def('0x2b')]=_['merge'](_0x2c1232[_0x4def('0x2b')],{'$or':_['map'](_0x39663d,function(_0x59fa5){if(_0x59fa5[_0x4def('0x1f')]!==_0x4def('0x2d')){var _0x345e32={};_0x345e32[_0x59fa5['name']]={'$like':'%'+_0x508eab[_0x4def('0x22')][_0x4def('0x2e')]+'%'};return _0x345e32;}})});}_0x2c1232=_[_0x4def('0x2f')]({},_0x2c1232,_0x508eab['options']);var _0x323840={'where':_0x2c1232[_0x4def('0x2b')]};return db[_0x4def('0x1e')][_0x4def('0x10')](_0x323840)[_0x4def('0x13')](function(_0x537178){_0x336314[_0x4def('0x10')]=_0x537178;if(_0x508eab[_0x4def('0x22')]['includeAll']){_0x2c1232[_0x4def('0x30')]=[{'all':!![]}];}return db[_0x4def('0x1e')][_0x4def('0x31')](_0x2c1232);})[_0x4def('0x13')](function(_0x3d46c6){_0x336314['rows']=_[_0x4def('0x1d')](_0x3d46c6,function(_0x26879a){if(_0x26879a['service']==='MicrosoftAzure'){var _0x6b8329=encryptor[_0x4def('0x32')](_0x26879a[_0x4def('0x33')]);_0x26879a[_0x4def('0x33')]=maskClientSecret(_0x6b8329);}return _0x26879a;});return _0x336314;})['then'](respondWithFilteredResult(_0x33bbde,_0x2c1232))['catch'](handleError(_0x33bbde,null));};exports['show']=function(_0x5285b6,_0x2e741b){var _0x58b952={'raw':!![],'where':{'id':_0x5285b6[_0x4def('0x34')]['id']}},_0x5adf12={};_0x5adf12[_0x4def('0x21')]=_['keys'](db[_0x4def('0x1e')][_0x4def('0x35')]);_0x5adf12['query']=_['keys'](_0x5285b6[_0x4def('0x22')]);_0x5adf12[_0x4def('0x24')]=_[_0x4def('0x36')](_0x5adf12[_0x4def('0x21')],_0x5adf12[_0x4def('0x22')]);_0x58b952[_0x4def('0x25')]=_[_0x4def('0x36')](_0x5adf12['model'],qs[_0x4def('0x26')](_0x5285b6['query']['fields']));_0x58b952[_0x4def('0x25')]=_0x58b952[_0x4def('0x25')][_0x4def('0x27')]?_0x58b952[_0x4def('0x25')]:_0x5adf12['model'];if(_0x5285b6['query'][_0x4def('0x37')]){_0x58b952[_0x4def('0x30')]=[{'all':!![]}];}_0x58b952=_[_0x4def('0x2f')]({},_0x58b952,_0x5285b6[_0x4def('0x38')]);return db[_0x4def('0x1e')][_0x4def('0x39')](_0x58b952)[_0x4def('0x13')](handleEntityNotFound(_0x2e741b,null))[_0x4def('0x13')](function(_0x37f18d){if(_0x37f18d['service']===_0x4def('0x3a')){var _0x2cd938=encryptor[_0x4def('0x32')](_0x37f18d[_0x4def('0x33')]);_0x37f18d[_0x4def('0x33')]=maskClientSecret(_0x2cd938);}return _0x37f18d;})[_0x4def('0x13')](respondWithResult(_0x2e741b,null))[_0x4def('0x3b')](handleError(_0x2e741b,null));};exports['create']=function(_0x4e538f,_0xa38611){if(!_0x4e538f[_0x4def('0x3c')][_0x4def('0x18')])throw new Error(_0x4def('0x3d'));if(!_0x4e538f[_0x4def('0x3c')][_0x4def('0x3e')])throw new Error(_0x4def('0x3f'));var _0x263791=db['CloudProvider'][_0x4def('0x35')]['service'][_0x4def('0x40')];if(!_0x263791['includes'](_0x4e538f[_0x4def('0x3c')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x263791[_0x4def('0x41')](',\x20'));if(_0x4e538f[_0x4def('0x3c')][_0x4def('0x3e')]===_0x4def('0x3a')&&_0x4e538f[_0x4def('0x3c')][_0x4def('0x33')]){_0x4e538f[_0x4def('0x3c')][_0x4def('0x33')]=encryptor[_0x4def('0x42')](_0x4e538f[_0x4def('0x3c')]['data3']);}return db[_0x4def('0x1e')]['create'](_0x4e538f[_0x4def('0x3c')],{})[_0x4def('0x13')](respondWithResult(_0xa38611,0xc9))[_0x4def('0x3b')](handleError(_0xa38611,null));};exports[_0x4def('0x12')]=function(_0xb0d201,_0x1b2af0){if(_0xb0d201[_0x4def('0x3c')]['id']){delete _0xb0d201[_0x4def('0x3c')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0xb0d201[_0x4def('0x34')]['id']}})['then'](handleEntityNotFound(_0x1b2af0,null))[_0x4def('0x13')](function(_0x142f11){if(_0x142f11['service']===_0x4def('0x3a')&&_0xb0d201['body']['data3']){_0xb0d201[_0x4def('0x3c')][_0x4def('0x33')]=encryptor[_0x4def('0x42')](_0xb0d201[_0x4def('0x3c')][_0x4def('0x33')]);}return _0x142f11;})[_0x4def('0x13')](saveUpdates(_0xb0d201[_0x4def('0x3c')],null))[_0x4def('0x13')](respondWithResult(_0x1b2af0,null))[_0x4def('0x3b')](handleError(_0x1b2af0,null));};exports[_0x4def('0x14')]=function(_0x4cc7b7,_0x202d4f){return db[_0x4def('0x1e')]['find']({'where':{'id':_0x4cc7b7[_0x4def('0x34')]['id']}})[_0x4def('0x13')](handleEntityNotFound(_0x202d4f,null))['then'](removeEntity(_0x202d4f,null))[_0x4def('0x3b')](handleError(_0x202d4f,null));};exports[_0x4def('0x43')]=function(_0x44cbb2,_0x2c403c){return db[_0x4def('0x1e')][_0x4def('0x44')]({'where':{'id':_0x44cbb2['params']['id']},'raw':!![]})['then'](function(_0xdc8b04){if(!_0xdc8b04)return _0x2c403c[_0x4def('0x15')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0xdc8b04,_0x44cbb2[_0x4def('0x45')]['id'])};})[_0x4def('0x13')](respondWithResult(_0x2c403c,null))['catch'](handleError(_0x2c403c,null));};exports[_0x4def('0x46')]=function(_0x51b32a,_0x1d8d01){var _0x4a258c=_0x51b32a[_0x4def('0x3c')];var _0x577c03;var _0xe99e98;if(_0x4a258c[_0x4def('0x16')])throw _0x4a258c;redis[_0x4def('0x47')](_0x4a258c[_0x4def('0x48')])['then'](function(_0x20f774){if(!_0x20f774)throw new Error('Invalid\x20state\x20parameter');_0x577c03=JSON[_0x4def('0x49')](_0x20f774);var _0x5d06f8=Buffer[_0x4def('0x4a')](_0x4a258c[_0x4def('0x48')],_0x4def('0x4b'))[_0x4def('0x4c')](_0x4def('0x4d'));_0xe99e98=JSON[_0x4def('0x49')](_0x5d06f8);if(!oauth[_0x4def('0x4e')](_0x4a258c[_0x4def('0x4f')],_0x577c03[_0x4def('0x50')]))throw new Error(_0x4def('0x51'));redis[_0x4def('0x52')](_0x4a258c[_0x4def('0x48')]);return oauth[_0x4def('0x53')](_0x4a258c['code'],_0x577c03);})[_0x4def('0x13')](function(_0x239421){_0x577c03[_0x4def('0x54')]=_0x239421['access_token'];_0x577c03['data6']=_0x239421['refresh_token'];return db[_0x4def('0x1e')][_0x4def('0x12')]({'data5':_0x577c03[_0x4def('0x54')],'data6':_0x577c03[_0x4def('0x55')]},{'where':{'id':_0x577c03['id']}});})[_0x4def('0x13')](function(){oauth[_0x4def('0x56')](_0x577c03);socket[_0x4def('0x57')]('microsoftAuthorization:success',{'id':_0xe99e98['id']});return;})[_0x4def('0x13')](respondWithStatusCode(_0x1d8d01,null))[_0x4def('0x3b')](function(_0x429bcc){if(_0xe99e98){socket[_0x4def('0x57')](_0x4def('0x58'),{'id':_0xe99e98['id']});}if(!_0x577c03){logger[_0x4def('0x16')](_0x4def('0x59'),_0x429bcc);return _0x1d8d01['status'](0x1f4)[_0x4def('0x19')](_0x429bcc[_0x4def('0x5a')]);}logger['error'](_0x4def('0x5b'),_0x577c03['id'],JSON['stringify'](_0x429bcc));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e3b5ead..79f8b74 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 _0x3af5=['CloudProvider','cloud_providers','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x3af5,0x1db));var _0x53af=function(_0x4277b0,_0x2b2cf6){_0x4277b0=_0x4277b0-0x0;var _0x57c93f=_0x3af5[_0x4277b0];return _0x57c93f;};'use strict';var _=require(_0x53af('0x0'));var util=require(_0x53af('0x1'));var logger=require(_0x53af('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x53af('0x3'));var fs=require('fs');var path=require(_0x53af('0x4'));var rimraf=require(_0x53af('0x5'));var config=require(_0x53af('0x6'));var attributes=require(_0x53af('0x7'));module['exports']=function(_0x41c533,_0xcb68dc){return _0x41c533[_0x53af('0x8')](_0x53af('0x9'),attributes,{'tableName':_0x53af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bce=['path','rimraf','../../config/environment','./cloudProvider.attributes','define','cloud_providers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x9bce,0x192));var _0xe9bc=function(_0x2288c3,_0x470419){_0x2288c3=_0x2288c3-0x0;var _0x1ccf3e=_0x9bce[_0x2288c3];return _0x1ccf3e;};'use strict';var _=require(_0xe9bc('0x0'));var util=require(_0xe9bc('0x1'));var logger=require(_0xe9bc('0x2'))('api');var moment=require(_0xe9bc('0x3'));var BPromise=require(_0xe9bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9bc('0x5'));var rimraf=require(_0xe9bc('0x6'));var config=require(_0xe9bc('0x7'));var attributes=require(_0xe9bc('0x8'));module['exports']=function(_0x4fc601,_0x5a3fe6){return _0x4fc601[_0xe9bc('0x9')]('CloudProvider',attributes,{'tableName':_0xe9bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index f4551a1..f484161 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 _0xdbb3=['bind','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','data7','/.default','join','replace','data2','code','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','refresh_token','data6','decryptString','{TENANT_ID}','data5','access_token','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data4','POST','intervals'];(function(_0x8d5e52,_0x40df7b){var _0x563f85=function(_0xcd4da7){while(--_0xcd4da7){_0x8d5e52['push'](_0x8d5e52['shift']());}};_0x563f85(++_0x40df7b);}(_0xdbb3,0x1ea));var _0x3dbb=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xdbb3[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x3dbb('0x0'));var crypto=require(_0x3dbb('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x3dbb('0x2'));var Redis=require(_0x3dbb('0x3'));var rp=require(_0x3dbb('0x4'));var util=require(_0x3dbb('0x5'));var encryptor=require(_0x3dbb('0x6'));var config=require(_0x3dbb('0x7'));var logger=require(_0x3dbb('0x8'))(_0x3dbb('0x9'));var schedule=require(_0x3dbb('0xa'));var db=require(_0x3dbb('0xb'))['db'];config[_0x3dbb('0xc')]=_[_0x3dbb('0xd')](config[_0x3dbb('0xc')],{'host':_0x3dbb('0xe'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x3dbb('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0x3dbb('0x10'),_0x3dbb('0x11'),_0x3dbb('0x12'),_0x3dbb('0x13'),_0x3dbb('0x14'),_0x3dbb('0x15'),_0x3dbb('0x16')],'Dynamics365':['openid',_0x3dbb('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0x3dbb('0x17');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x334860){var _0x3a3dc0=_[_0x3dbb('0x18')](AZURE_AUTH_SCOPES[_0x334860[_0x3dbb('0x19')]]);if(_0x334860[_0x3dbb('0x19')]===_0x3dbb('0x1a'))_0x3a3dc0['push'](_0x334860[_0x3dbb('0x1b')]+_0x3dbb('0x1c'));return _0x3a3dc0[_0x3dbb('0x1d')]('\x20');}function getAccessTokenScope(_0x5b7f2d){if(_0x5b7f2d[_0x3dbb('0x19')]==='Outlook365')return _0x3dbb('0x14');if(_0x5b7f2d[_0x3dbb('0x19')]===_0x3dbb('0x1a'))return _0x5b7f2d[_0x3dbb('0x1b')]+_0x3dbb('0x1c');}function generateMicrosoftAuthorizationUrl(_0x141ba0,_0x39293b){var _0x2eb46c=MICROSOFT_AUTH_URL[_0x3dbb('0x1e')]('{TENANT_ID}',_0x141ba0[_0x3dbb('0x1f')]);var _0x5ce3a7=[_0x3dbb('0x20'),'id_token'];var _0x504686=Buffer[_0x3dbb('0x21')](JSON[_0x3dbb('0x22')]({'id':_0x39293b}))[_0x3dbb('0x23')]('base64');var _0x33aea8=crypto[_0x3dbb('0x24')](0x10)['toString'](_0x3dbb('0x25'));var _0x25330e=getAuthorizationScopes(_0x141ba0);var _0x341ae3=[{'key':_0x3dbb('0x26'),'value':_0x141ba0[_0x3dbb('0x27')]},{'key':_0x3dbb('0x28'),'value':encodeURIComponent(_0x5ce3a7['join']('\x20'))},{'key':_0x3dbb('0x29'),'value':_0x141ba0['data4']},{'key':_0x3dbb('0x2a'),'value':_0x3dbb('0x2b')},{'key':_0x3dbb('0x2c'),'value':encodeURIComponent(_0x25330e)},{'key':_0x3dbb('0x2d'),'value':_0x504686},{'key':_0x3dbb('0x2e'),'value':_0x33aea8},{'key':_0x3dbb('0x2f'),'value':'login'}];var _0x560c6d=_0x2eb46c+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x341ae3,function(_0x3b15cc){return _0x3b15cc['key']+'='+_0x3b15cc[_0x3dbb('0x30')];})[_0x3dbb('0x1d')]('&');_0x141ba0[_0x3dbb('0x31')]={'issuer':_0x2eb46c[_0x3dbb('0x1e')](_0x3dbb('0x32'),''),'audience':_0x141ba0[_0x3dbb('0x27')],'state':_0x504686,'nonce':_0x33aea8};redis[_0x3dbb('0x33')](_0x504686,JSON[_0x3dbb('0x22')](_0x141ba0));return _0x560c6d;}function isValidIdToken(_0x1813ee,_0x423641){try{var _0x18ccd=jwt[_0x3dbb('0x34')](_0x1813ee,{'complete':!![]});var _0xe30df1=_0x18ccd[_0x3dbb('0x35')];if(_0xe30df1[_0x3dbb('0x36')]!==_0x423641[_0x3dbb('0x37')])return![];if(_0xe30df1[_0x3dbb('0x38')]!==_0x423641[_0x3dbb('0x39')])return![];if(_0xe30df1[_0x3dbb('0x2e')]!==_0x423641[_0x3dbb('0x2e')])return![];if(moment()[_0x3dbb('0x3a')](moment[_0x3dbb('0x3b')](_0xe30df1[_0x3dbb('0x3c')])))return![];return!![];}catch(_0x5e5ec4){throw _0x5e5ec4;}}function refreshOauth2MicrosoftAccessToken(_0x41a73a){return Promise[_0x3dbb('0x3d')]()[_0x3dbb('0x3e')](function(){if(_0x41a73a[_0x3dbb('0x3f')])return _0x41a73a;return db[_0x3dbb('0x40')]['findOne']({'where':{'id':_0x41a73a['id']},'raw':!![]});})[_0x3dbb('0x3e')](function(_0x18b66f){var _0x4453dd={'grant_type':_0x3dbb('0x41'),'refresh_token':_0x18b66f[_0x3dbb('0x42')],'scope':getAccessTokenScope(_0x18b66f),'redirect_uri':_0x18b66f['data4'],'client_id':_0x18b66f[_0x3dbb('0x27')],'client_secret':encryptor[_0x3dbb('0x43')](_0x18b66f[_0x3dbb('0x3f')])};var _0x42006e={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x3dbb('0x44'),_0x18b66f[_0x3dbb('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4453dd,'json':!![]};return rp(_0x42006e);})['then'](function(_0x339a6a){_0x41a73a[_0x3dbb('0x45')]=_0x339a6a[_0x3dbb('0x46')];_0x41a73a['data6']=_0x339a6a[_0x3dbb('0x41')];return db[_0x3dbb('0x40')]['update']({'data5':_0x41a73a[_0x3dbb('0x45')],'data6':_0x41a73a['data6']},{'where':{'id':_0x41a73a['id']}});})[_0x3dbb('0x3e')](function(){return _0x41a73a;})['catch'](function(_0x118c69){logger[_0x3dbb('0x47')](_0x3dbb('0x48'),_0x41a73a['id'],_0x118c69);});}function getOauth2MicrosoftAccessToken(_0x2f9fc4,_0x15a44e){var _0x57ac89={'grant_type':_0x3dbb('0x49'),'code':_0x2f9fc4,'scope':getAccessTokenScope(_0x15a44e),'redirect_uri':_0x15a44e[_0x3dbb('0x4a')],'client_id':_0x15a44e[_0x3dbb('0x27')],'client_secret':encryptor['decryptString'](_0x15a44e[_0x3dbb('0x3f')])};var _0x239cc7={'method':_0x3dbb('0x4b'),'uri':MICROSOFT_AUTH_URL['replace'](_0x3dbb('0x44'),_0x15a44e[_0x3dbb('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x57ac89,'json':!![]};return rp(_0x239cc7);}function startRefreshInterval(_0x275144){var _0x2249b9=schedule[_0x3dbb('0x4c')];if(_0x2249b9[_0x275144['id']])clearInterval(_0x2249b9[_0x275144['id']]);_0x2249b9[_0x275144['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3dbb('0x4d')](this,{'id':_0x275144['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3dbb('0x4c')]=_0x2249b9;}function startAllRefreshIntervals(){return db[_0x3dbb('0x40')][_0x3dbb('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x17999d){var _0x2b983e=_0x17999d['map'](function(_0x132867){return refreshOauth2MicrosoftAccessToken(_0x132867)[_0x3dbb('0x3e')](function(_0xa89f1e){startRefreshInterval(_0xa89f1e);});});return Promise[_0x3dbb('0x4f')](_0x2b983e);})['catch'](function(_0x249ce6){var _0x33d9cf=_0x249ce6?util['inspect'](_0x249ce6,{'showHidden':![],'depth':null}):'';logger[_0x3dbb('0x47')](_0x3dbb('0x50'),_0x33d9cf);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x258f=['update','data5','then','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','findAll','inspect','exports','lodash','moment','ioredis','request-promise','util','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','type','Dynamics365','push','data7','/.default','Outlook365','replace','{TENANT_ID}','data2','id_token','from','stringify','randomBytes','toString','response_type','redirect_uri','data4','response_mode','scope','nonce','prompt','login','map','key','oauth2Claims','oauth2/','data1','decode','payload','iss','audience','isAfter','exp','resolve','data3','refresh_token','data6','decryptString','POST','access_token','CloudProvider'];(function(_0x260e07,_0x2dd0e4){var _0x28ba4e=function(_0x237146){while(--_0x237146){_0x260e07['push'](_0x260e07['shift']());}};_0x28ba4e(++_0x2dd0e4);}(_0x258f,0x11c));var _0xf258=function(_0xee2791,_0x3fb463){_0xee2791=_0xee2791-0x0;var _0x4c0cfb=_0x258f[_0xee2791];return _0x4c0cfb;};'use strict';var _=require(_0xf258('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0xf258('0x1'));var Redis=require(_0xf258('0x2'));var rp=require(_0xf258('0x3'));var util=require(_0xf258('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0xf258('0x5'));var logger=require('../../config/logger')(_0xf258('0x6'));var schedule=require(_0xf258('0x7'));var db=require(_0xf258('0x8'))['db'];config[_0xf258('0x9')]=_[_0xf258('0xa')](config[_0xf258('0x9')],{'host':_0xf258('0xb'),'port':0x18eb});var redis=new Redis(config[_0xf258('0x9')]);var MICROSOFT_AUTH_URL=_0xf258('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xf258('0xd'),_0xf258('0xe'),_0xf258('0xf'),_0xf258('0x10'),_0xf258('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0xf258('0x12')],'Dynamics365':[_0xf258('0xd'),_0xf258('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xf258('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x28b962){var _0x726940=_['map'](AZURE_AUTH_SCOPES[_0x28b962[_0xf258('0x14')]]);if(_0x28b962['type']===_0xf258('0x15'))_0x726940[_0xf258('0x16')](_0x28b962[_0xf258('0x17')]+_0xf258('0x18'));return _0x726940['join']('\x20');}function getAccessTokenScope(_0x390a53){if(_0x390a53[_0xf258('0x14')]===_0xf258('0x19'))return _0xf258('0x11');if(_0x390a53[_0xf258('0x14')]===_0xf258('0x15'))return _0x390a53[_0xf258('0x17')]+_0xf258('0x18');}function generateMicrosoftAuthorizationUrl(_0x3f79f0,_0x102403){var _0x202626=MICROSOFT_AUTH_URL[_0xf258('0x1a')](_0xf258('0x1b'),_0x3f79f0[_0xf258('0x1c')]);var _0x106c04=['code',_0xf258('0x1d')];var _0x6f8ff7=Buffer[_0xf258('0x1e')](JSON[_0xf258('0x1f')]({'id':_0x102403}))['toString']('base64');var _0x2eee29=crypto[_0xf258('0x20')](0x10)[_0xf258('0x21')]('hex');var _0x20af4d=getAuthorizationScopes(_0x3f79f0);var _0x48076a=[{'key':'client_id','value':_0x3f79f0['data1']},{'key':_0xf258('0x22'),'value':encodeURIComponent(_0x106c04['join']('\x20'))},{'key':_0xf258('0x23'),'value':_0x3f79f0[_0xf258('0x24')]},{'key':_0xf258('0x25'),'value':'form_post'},{'key':_0xf258('0x26'),'value':encodeURIComponent(_0x20af4d)},{'key':'state','value':_0x6f8ff7},{'key':_0xf258('0x27'),'value':_0x2eee29},{'key':_0xf258('0x28'),'value':_0xf258('0x29')}];var _0x618115=_0x202626+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xf258('0x2a')](_0x48076a,function(_0x30b09c){return _0x30b09c[_0xf258('0x2b')]+'='+_0x30b09c['value'];})['join']('&');_0x3f79f0[_0xf258('0x2c')]={'issuer':_0x202626[_0xf258('0x1a')](_0xf258('0x2d'),''),'audience':_0x3f79f0[_0xf258('0x2e')],'state':_0x6f8ff7,'nonce':_0x2eee29};redis['set'](_0x6f8ff7,JSON[_0xf258('0x1f')](_0x3f79f0));return _0x618115;}function isValidIdToken(_0x330ec7,_0x1c2140){try{var _0x1cf52e=jwt[_0xf258('0x2f')](_0x330ec7,{'complete':!![]});var _0x37cea0=_0x1cf52e[_0xf258('0x30')];if(_0x37cea0[_0xf258('0x31')]!==_0x1c2140['issuer'])return![];if(_0x37cea0['aud']!==_0x1c2140[_0xf258('0x32')])return![];if(_0x37cea0[_0xf258('0x27')]!==_0x1c2140[_0xf258('0x27')])return![];if(moment()[_0xf258('0x33')](moment['unix'](_0x37cea0[_0xf258('0x34')])))return![];return!![];}catch(_0x25c3ee){throw _0x25c3ee;}}function refreshOauth2MicrosoftAccessToken(_0x118813){return Promise[_0xf258('0x35')]()['then'](function(){if(_0x118813[_0xf258('0x36')])return _0x118813;return db['CloudProvider']['findOne']({'where':{'id':_0x118813['id']},'raw':!![]});})['then'](function(_0xc7928){var _0x557116={'grant_type':_0xf258('0x37'),'refresh_token':_0xc7928[_0xf258('0x38')],'scope':getAccessTokenScope(_0xc7928),'redirect_uri':_0xc7928[_0xf258('0x24')],'client_id':_0xc7928[_0xf258('0x2e')],'client_secret':encryptor[_0xf258('0x39')](_0xc7928[_0xf258('0x36')])};var _0x1ea6da={'method':_0xf258('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xf258('0x1a')]('{TENANT_ID}',_0xc7928[_0xf258('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x557116,'json':!![]};return rp(_0x1ea6da);})['then'](function(_0x3bd07b){_0x118813['data5']=_0x3bd07b[_0xf258('0x3b')];_0x118813[_0xf258('0x38')]=_0x3bd07b[_0xf258('0x37')];return db[_0xf258('0x3c')][_0xf258('0x3d')]({'data5':_0x118813[_0xf258('0x3e')],'data6':_0x118813['data6']},{'where':{'id':_0x118813['id']}});})[_0xf258('0x3f')](function(){return _0x118813;})['catch'](function(_0x5a8b2d){logger[_0xf258('0x40')](_0xf258('0x41'),_0x118813['id'],_0x5a8b2d);});}function getOauth2MicrosoftAccessToken(_0x317d25,_0x2087c0){var _0x3460e9={'grant_type':'authorization_code','code':_0x317d25,'scope':getAccessTokenScope(_0x2087c0),'redirect_uri':_0x2087c0[_0xf258('0x24')],'client_id':_0x2087c0[_0xf258('0x2e')],'client_secret':encryptor[_0xf258('0x39')](_0x2087c0[_0xf258('0x36')])};var _0x2c7545={'method':_0xf258('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xf258('0x1a')]('{TENANT_ID}',_0x2087c0[_0xf258('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3460e9,'json':!![]};return rp(_0x2c7545);}function startRefreshInterval(_0x3a2daa){var _0x230889=schedule['intervals'];if(_0x230889[_0x3a2daa['id']])clearInterval(_0x230889[_0x3a2daa['id']]);_0x230889[_0x3a2daa['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x3a2daa['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x230889;}function startAllRefreshIntervals(){return db[_0xf258('0x3c')][_0xf258('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf258('0x3f')](function(_0x1438eb){var _0x183ee0=_0x1438eb[_0xf258('0x2a')](function(_0x426a3e){return refreshOauth2MicrosoftAccessToken(_0x426a3e)[_0xf258('0x3f')](function(_0x4ba0b3){startRefreshInterval(_0x4ba0b3);});});return Promise['all'](_0x183ee0);})['catch'](function(_0x1fcf42){var _0x3b6261=_0x1fcf42?util[_0xf258('0x43')](_0x1fcf42,{'showHidden':![],'depth':null}):'';logger[_0xf258('0x40')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3b6261);});}module[_0xf258('0x44')]={'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 894586b..db02546 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 _0x7d06=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7d06,0x158));var _0x67d0=function(_0x204a77,_0x40ae18){_0x204a77=_0x204a77-0x0;var _0x348407=_0x7d06[_0x204a77];return _0x348407;};'use strict';var _=require(_0x67d0('0x0'));var util=require(_0x67d0('0x1'));var moment=require(_0x67d0('0x2'));var BPromise=require(_0x67d0('0x3'));var rs=require(_0x67d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67d0('0x5'))['db'];var utils=require(_0x67d0('0x6'));var logger=require(_0x67d0('0x7'))('rpc');var config=require(_0x67d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x67d0('0x9')][_0x67d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x367f1d,_0xe4789b,_0x3c9976){return new BPromise(function(_0x481a08,_0x358986){return client['request'](_0x367f1d,_0x3c9976)[_0x67d0('0xb')](function(_0x5916d0){logger[_0x67d0('0xc')](_0x67d0('0xd'),_0xe4789b,_0x67d0('0xe'));logger[_0x67d0('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0xe4789b,_0x67d0('0xe'),JSON['stringify'](_0x5916d0));if(_0x5916d0['error']){if(_0x5916d0[_0x67d0('0x10')][_0x67d0('0x11')]===0x1f4){logger['error'](_0x67d0('0xd'),_0xe4789b,_0x5916d0[_0x67d0('0x10')]['message']);return _0x358986(_0x5916d0[_0x67d0('0x10')]['message']);}logger[_0x67d0('0x10')](_0x67d0('0xd'),_0xe4789b,_0x5916d0[_0x67d0('0x10')][_0x67d0('0x12')]);return _0x481a08(_0x5916d0[_0x67d0('0x10')][_0x67d0('0x12')]);}else{logger[_0x67d0('0xc')](_0x67d0('0xd'),_0xe4789b,_0x67d0('0xe'));_0x481a08(_0x5916d0[_0x67d0('0x13')]['message']);}})[_0x67d0('0x14')](function(_0xa1b889){logger['error'](_0x67d0('0xd'),_0xe4789b,_0xa1b889);_0x358986(_0xa1b889);});});} \ No newline at end of file +var _0xed03=['info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x57afc0,_0x24ff04){var _0x44b769=function(_0x238847){while(--_0x238847){_0x57afc0['push'](_0x57afc0['shift']());}};_0x44b769(++_0x24ff04);}(_0xed03,0xdc));var _0x3ed0=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xed03[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x3ed0('0x0'));var util=require(_0x3ed0('0x1'));var moment=require('moment');var BPromise=require(_0x3ed0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ed0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ed0('0x4'))('rpc');var config=require(_0x3ed0('0x5'));var jayson=require(_0x3ed0('0x6'));var client=jayson[_0x3ed0('0x7')][_0x3ed0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8470b7,_0x3f1277,_0xd729a0){return new BPromise(function(_0x4500aa,_0xddc4c5){return client[_0x3ed0('0x9')](_0x8470b7,_0xd729a0)[_0x3ed0('0xa')](function(_0x34950c){logger[_0x3ed0('0xb')](_0x3ed0('0xc'),_0x3f1277,'request\x20sent');logger[_0x3ed0('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3f1277,_0x3ed0('0xe'),JSON[_0x3ed0('0xf')](_0x34950c));if(_0x34950c[_0x3ed0('0x10')]){if(_0x34950c['error'][_0x3ed0('0x11')]===0x1f4){logger[_0x3ed0('0x10')](_0x3ed0('0xc'),_0x3f1277,_0x34950c[_0x3ed0('0x10')][_0x3ed0('0x12')]);return _0xddc4c5(_0x34950c['error'][_0x3ed0('0x12')]);}logger[_0x3ed0('0x10')](_0x3ed0('0xc'),_0x3f1277,_0x34950c[_0x3ed0('0x10')][_0x3ed0('0x12')]);return _0x4500aa(_0x34950c['error'][_0x3ed0('0x12')]);}else{logger[_0x3ed0('0xb')]('CloudProvider,\x20%s,\x20%s',_0x3f1277,_0x3ed0('0xe'));_0x4500aa(_0x34950c[_0x3ed0('0x13')][_0x3ed0('0x12')]);}})[_0x3ed0('0x14')](function(_0xaa73cd){logger[_0x3ed0('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3f1277,_0xaa73cd);_0xddc4c5(_0xaa73cd);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 52d0047..4ec3099 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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x39bf17,_0x319d5e){var _0x1ccf1d=function(_0x1244ec){while(--_0x1244ec){_0x39bf17['push'](_0x39bf17['shift']());}};_0x1ccf1d(++_0x319d5e);}(_0x2ef3,0xba));var _0x32ef=function(_0x28cffc,_0x59e0c3){_0x28cffc=_0x28cffc-0x0;var _0x4253d4=_0x2ef3[_0x28cffc];return _0x4253d4;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x5c82e9,_0x1a13d5){var _0x57fc44=function(_0x196831){while(--_0x196831){_0x5c82e9['push'](_0x5c82e9['shift']());}};_0x57fc44(++_0x1a13d5);}(_0x2ef3,0xba));var _0x32ef=function(_0x421c29,_0x4074f6){_0x421c29=_0x421c29-0x0;var _0xd2c93b=_0x2ef3[_0x421c29];return _0xd2c93b;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index faa2c47..a8133a1 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 _0x6824=['exports','STRING','sequelize'];(function(_0xbb0ce8,_0xb63549){var _0x1a1b17=function(_0x171af3){while(--_0x171af3){_0xbb0ce8['push'](_0xbb0ce8['shift']());}};_0x1a1b17(++_0xb63549);}(_0x6824,0x80));var _0x4682=function(_0x248d93,_0xf9322c){_0x248d93=_0x248d93-0x0;var _0x1abac3=_0x6824[_0x248d93];return _0x1abac3;};'use strict';var Sequelize=require(_0x4682('0x0'));module[_0x4682('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4682('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x4682('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x4682('0x2')]},'type':{'type':Sequelize[_0x4682('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x4682('0x2')]},'country':{'type':Sequelize[_0x4682('0x2')]},'email':{'type':Sequelize[_0x4682('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x4682('0x2')]},'sPostalCode':{'type':Sequelize[_0x4682('0x2')]},'sCity':{'type':Sequelize[_0x4682('0x2')]},'sCountry':{'type':Sequelize[_0x4682('0x2')]},'description':{'type':Sequelize[_0x4682('0x2')]}}; \ No newline at end of file +var _0x9a45=['name','STRING'];(function(_0x119961,_0x38c0a1){var _0x147fe2=function(_0xd2e914){while(--_0xd2e914){_0x119961['push'](_0x119961['shift']());}};_0x147fe2(++_0x38c0a1);}(_0x9a45,0x11d));var _0x59a4=function(_0x21f729,_0x20de13){_0x21f729=_0x21f729-0x0;var _0x41c0ab=_0x9a45[_0x21f729];return _0x41c0ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x59a4('0x0')],'unique':_0x59a4('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x59a4('0x0')]},'companyId':{'type':Sequelize[_0x59a4('0x0')]},'website':{'type':Sequelize[_0x59a4('0x0')]},'phone':{'type':Sequelize[_0x59a4('0x0')]},'fax':{'type':Sequelize[_0x59a4('0x0')]},'type':{'type':Sequelize[_0x59a4('0x0')]},'street':{'type':Sequelize[_0x59a4('0x0')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x59a4('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x59a4('0x0')]},'sPostalCode':{'type':Sequelize[_0x59a4('0x0')]},'sCity':{'type':Sequelize[_0x59a4('0x0')]},'sCountry':{'type':Sequelize[_0x59a4('0x0')]},'description':{'type':Sequelize[_0x59a4('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b41ee60..1284121 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 _0x56cc=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','error','name','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','count','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection'];(function(_0x1f0f46,_0x3873ff){var _0x5d12f8=function(_0x455bf7){while(--_0x455bf7){_0x1f0f46['push'](_0x1f0f46['shift']());}};_0x5d12f8(++_0x3873ff);}(_0x56cc,0x1db));var _0xc56c=function(_0x20dbe5,_0x15a188){_0x20dbe5=_0x20dbe5-0x0;var _0x5ae2d7=_0x56cc[_0x20dbe5];return _0x5ae2d7;};'use strict';var emlformat=require(_0xc56c('0x0'));var rimraf=require(_0xc56c('0x1'));var zipdir=require(_0xc56c('0x2'));var jsonpatch=require(_0xc56c('0x3'));var rp=require(_0xc56c('0x4'));var moment=require(_0xc56c('0x5'));var BPromise=require(_0xc56c('0x6'));var Mustache=require(_0xc56c('0x7'));var util=require('util');var path=require(_0xc56c('0x8'));var sox=require(_0xc56c('0x9'));var csv=require(_0xc56c('0xa'));var ejs=require(_0xc56c('0xb'));var fs=require('fs');var fs_extra=require(_0xc56c('0xc'));var _=require(_0xc56c('0xd'));var squel=require(_0xc56c('0xe'));var crypto=require(_0xc56c('0xf'));var jsforce=require(_0xc56c('0x10'));var deskjs=require(_0xc56c('0x11'));var toCsv=require(_0xc56c('0xa'));var querystring=require(_0xc56c('0x12'));var Papa=require(_0xc56c('0x13'));var Redis=require(_0xc56c('0x14'));var authService=require(_0xc56c('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xc56c('0x16'));var hardwareService=require(_0xc56c('0x17'));var logger=require(_0xc56c('0x18'))(_0xc56c('0x19'));var utils=require(_0xc56c('0x1a'));var config=require(_0xc56c('0x1b'));var licenseUtil=require(_0xc56c('0x1c'));var db=require(_0xc56c('0x1d'))['db'];function respondWithStatusCode(_0x371f6a,_0x5040c1){_0x5040c1=_0x5040c1||0xcc;return function(_0x590443){if(_0x590443){return _0x371f6a[_0xc56c('0x1e')](_0x5040c1);}return _0x371f6a[_0xc56c('0x1f')](_0x5040c1)[_0xc56c('0x20')]();};}function respondWithResult(_0x1c2880,_0x26390c){_0x26390c=_0x26390c||0xc8;return function(_0x49f315){if(_0x49f315){return _0x1c2880['status'](_0x26390c)[_0xc56c('0x21')](_0x49f315);}};}function respondWithFilteredResult(_0x14f18b,_0x24417b){return function(_0xc9cad5){if(_0xc9cad5){var _0x543e=typeof _0x24417b['offset']===_0xc56c('0x22')&&typeof _0x24417b[_0xc56c('0x23')]===_0xc56c('0x22');var _0xda752a=_0xc9cad5['count'];var _0x4fa547=_0x543e?0x0:_0x24417b[_0xc56c('0x24')];var _0x3de48e=_0x543e?_0xc9cad5['count']:_0x24417b['offset']+_0x24417b[_0xc56c('0x23')];var _0x5bd0fb;if(_0x3de48e>=_0xda752a){_0x3de48e=_0xda752a;_0x5bd0fb=0xc8;}else{_0x5bd0fb=0xce;}_0x14f18b[_0xc56c('0x1f')](_0x5bd0fb);return _0x14f18b[_0xc56c('0x25')](_0xc56c('0x26'),_0x4fa547+'-'+_0x3de48e+'/'+_0xda752a)[_0xc56c('0x21')](_0xc9cad5);}return null;};}function patchUpdates(_0x1fa096){return function(_0x3d856c){try{jsonpatch['apply'](_0x3d856c,_0x1fa096,!![]);}catch(_0xe02930){return BPromise['reject'](_0xe02930);}return _0x3d856c[_0xc56c('0x27')]();};}function saveUpdates(_0x2a7fca,_0x1f2210){return function(_0x4d8269){if(_0x4d8269){return _0x4d8269[_0xc56c('0x28')](_0x2a7fca)[_0xc56c('0x29')](function(_0x37ab2a){return _0x37ab2a;});}return null;};}function removeEntity(_0x422e9e,_0x50e355){return function(_0x54c637){if(_0x54c637){return _0x54c637[_0xc56c('0x2a')]()[_0xc56c('0x29')](function(){var _0x48d1b3=_0x54c637[_0xc56c('0x2b')]({'plain':!![]});var _0xd9fcec='Companies';return db[_0xc56c('0x2c')][_0xc56c('0x2a')]({'where':{'type':_0xd9fcec,'resourceId':_0x48d1b3['id']}})[_0xc56c('0x29')](function(){return _0x54c637;});})[_0xc56c('0x29')](function(){_0x422e9e[_0xc56c('0x1f')](0xcc)[_0xc56c('0x20')]();});}};}function handleEntityNotFound(_0x47e738,_0xc0b9c){return function(_0x51ffcd){if(!_0x51ffcd){_0x47e738[_0xc56c('0x1e')](0x194);}return _0x51ffcd;};}function handleError(_0x430315,_0x1c53d3){_0x1c53d3=_0x1c53d3||0x1f4;return function(_0x42a70a){logger[_0xc56c('0x2d')](_0x42a70a['stack']);if(_0x42a70a[_0xc56c('0x2e')]){delete _0x42a70a[_0xc56c('0x2e')];}_0x430315['status'](_0x1c53d3)['send'](_0x42a70a);};}exports['index']=function(_0x3ca308,_0xceccfe){var _0x4b98db={},_0x505b7f={},_0x5aa2f7={'count':0x0,'rows':[]};return db[_0xc56c('0x2f')][_0xc56c('0x30')]()[_0xc56c('0x29')](function(_0x1efcb4){_0x505b7f[_0xc56c('0x31')]=_[_0xc56c('0x32')](_0x1efcb4);_0x505b7f[_0xc56c('0x33')]=_[_0xc56c('0x32')](_0x3ca308[_0xc56c('0x33')]);_0x505b7f[_0xc56c('0x34')]=_[_0xc56c('0x35')](_0x505b7f[_0xc56c('0x31')],_0x505b7f[_0xc56c('0x33')]);_0x4b98db[_0xc56c('0x36')]=_[_0xc56c('0x35')](_0x505b7f[_0xc56c('0x31')],qs[_0xc56c('0x37')](_0x3ca308[_0xc56c('0x33')][_0xc56c('0x37')]));_0x4b98db[_0xc56c('0x36')]=_0x4b98db['attributes'][_0xc56c('0x38')]?_0x4b98db[_0xc56c('0x36')]:_0x505b7f[_0xc56c('0x31')];if(!_0x3ca308[_0xc56c('0x33')][_0xc56c('0x39')](_0xc56c('0x3a'))){_0x4b98db[_0xc56c('0x23')]=qs['limit'](_0x3ca308[_0xc56c('0x33')][_0xc56c('0x23')]);_0x4b98db['offset']=qs[_0xc56c('0x24')](_0x3ca308[_0xc56c('0x33')][_0xc56c('0x24')]);}_0x4b98db[_0xc56c('0x3b')]=qs[_0xc56c('0x3c')](_0x3ca308[_0xc56c('0x33')][_0xc56c('0x3c')]);_0x4b98db[_0xc56c('0x3d')]=qs[_0xc56c('0x34')](_[_0xc56c('0x3e')](_0x3ca308['query'],_0x505b7f[_0xc56c('0x34')]),_0x1efcb4);if(_0x3ca308[_0xc56c('0x33')]['filter']){_0x4b98db[_0xc56c('0x3d')]=_[_0xc56c('0x3f')](_0x4b98db[_0xc56c('0x3d')],{'$or':_[_0xc56c('0x40')](_0x4b98db['attributes'],function(_0x27c9db){var _0xe21ebc={};_0xe21ebc[_0x27c9db]={'$like':'%'+_0x3ca308['query'][_0xc56c('0x41')]+'%'};return _0xe21ebc;})});}_0x4b98db=_[_0xc56c('0x3f')]({},_0x4b98db,_0x3ca308[_0xc56c('0x42')]);var _0x36c7e1={'where':_0x4b98db[_0xc56c('0x3d')]};return db[_0xc56c('0x2f')][_0xc56c('0x43')](_0x36c7e1)[_0xc56c('0x29')](function(_0x450703){_0x5aa2f7[_0xc56c('0x43')]=_0x450703;if(_0x3ca308[_0xc56c('0x33')]['includeAll']){_0x4b98db[_0xc56c('0x44')]=[{'all':!![]}];}return db[_0xc56c('0x2f')][_0xc56c('0x45')](_0x4b98db);})['then'](function(_0x1e54af){_0x5aa2f7[_0xc56c('0x46')]=_0x1e54af;return _0x5aa2f7;})[_0xc56c('0x29')](respondWithFilteredResult(_0xceccfe,_0x4b98db))[_0xc56c('0x47')](handleError(_0xceccfe,null));})['catch'](handleError(_0xceccfe,null));};exports[_0xc56c('0x48')]=function(_0x322e06,_0x2cfe65){var _0x43ca28={'raw':![],'where':{'id':_0x322e06['params']['id']}},_0xbdbd63={};_0xbdbd63[_0xc56c('0x31')]=_[_0xc56c('0x32')](db[_0xc56c('0x2f')][_0xc56c('0x49')]);_0xbdbd63[_0xc56c('0x33')]=_[_0xc56c('0x32')](_0x322e06['query']);_0xbdbd63[_0xc56c('0x34')]=_[_0xc56c('0x35')](_0xbdbd63[_0xc56c('0x31')],_0xbdbd63[_0xc56c('0x33')]);_0x43ca28['attributes']=_[_0xc56c('0x35')](_0xbdbd63['model'],qs[_0xc56c('0x37')](_0x322e06['query'][_0xc56c('0x37')]));_0x43ca28['attributes']=_0x43ca28[_0xc56c('0x36')][_0xc56c('0x38')]?_0x43ca28[_0xc56c('0x36')]:_0xbdbd63[_0xc56c('0x31')];if(_0x322e06[_0xc56c('0x33')][_0xc56c('0x4a')]){_0x43ca28[_0xc56c('0x44')]=[{'all':!![]}];}_0x43ca28=_[_0xc56c('0x3f')]({},_0x43ca28,_0x322e06[_0xc56c('0x42')]);return db[_0xc56c('0x2f')][_0xc56c('0x4b')](_0x43ca28)[_0xc56c('0x29')](handleEntityNotFound(_0x2cfe65,null))[_0xc56c('0x29')](respondWithResult(_0x2cfe65,null))['catch'](handleError(_0x2cfe65,null));};exports[_0xc56c('0x4c')]=function(_0x51f2db,_0x4a6402){return db[_0xc56c('0x2f')][_0xc56c('0x4c')](_0x51f2db[_0xc56c('0x4d')],{})['then'](function(_0x2f38e0){var _0xb9582c=_0x51f2db[_0xc56c('0x4e')][_0xc56c('0x2b')]({'plain':!![]});if(!_0xb9582c)throw new Error(_0xc56c('0x4f'));if(_0xb9582c[_0xc56c('0x50')]===_0xc56c('0x4e')){var _0x3ffb44=_0x2f38e0['get']({'plain':!![]});var _0x1063c5=_0xc56c('0x51');return db[_0xc56c('0x52')][_0xc56c('0x4b')]({'where':{'name':_0x1063c5,'userProfileId':_0xb9582c[_0xc56c('0x53')]},'raw':!![]})[_0xc56c('0x29')](function(_0x2f66ca){if(_0x2f66ca&&_0x2f66ca[_0xc56c('0x54')]===0x0){return db[_0xc56c('0x2c')]['create']({'name':_0x3ffb44['name'],'resourceId':_0x3ffb44['id'],'type':_0x2f66ca[_0xc56c('0x2e')],'sectionId':_0x2f66ca['id']},{})[_0xc56c('0x29')](function(){return _0x2f38e0;});}else{return _0x2f38e0;}})['catch'](function(_0x2fc7c0){logger[_0xc56c('0x2d')](_0xc56c('0x55'),_0x2fc7c0);throw _0x2fc7c0;});}return _0x2f38e0;})['then'](respondWithResult(_0x4a6402,0xc9))['catch'](handleError(_0x4a6402,null));};exports[_0xc56c('0x28')]=function(_0x3ab92c,_0x27b1b1){if(_0x3ab92c[_0xc56c('0x4d')]['id']){delete _0x3ab92c[_0xc56c('0x4d')]['id'];}return db[_0xc56c('0x2f')][_0xc56c('0x4b')]({'where':{'id':_0x3ab92c[_0xc56c('0x56')]['id']}})[_0xc56c('0x29')](handleEntityNotFound(_0x27b1b1,null))['then'](saveUpdates(_0x3ab92c[_0xc56c('0x4d')],null))['then'](respondWithResult(_0x27b1b1,null))[_0xc56c('0x47')](handleError(_0x27b1b1,null));};exports[_0xc56c('0x2a')]=function(_0x2341aa,_0x2e00bf){return db['CmCompany']['find']({'where':{'id':_0x2341aa[_0xc56c('0x56')]['id']}})[_0xc56c('0x29')](handleEntityNotFound(_0x2e00bf,null))[_0xc56c('0x29')](removeEntity(_0x2e00bf,null))[_0xc56c('0x47')](handleError(_0x2e00bf,null));};exports[_0xc56c('0x30')]=function(_0x382fd9,_0x53fe46){return db[_0xc56c('0x2f')][_0xc56c('0x30')]()[_0xc56c('0x29')](respondWithResult(_0x53fe46,null))['catch'](handleError(_0x53fe46,null));};exports[_0xc56c('0x57')]=function(_0x47240e,_0xea4dd0,_0x45a6e6){return db[_0xc56c('0x58')]['find']({'where':{'id':_0x47240e[_0xc56c('0x56')]['id']}})[_0xc56c('0x29')](handleEntityNotFound(_0xea4dd0,null))['then'](function(_0x397a52){if(_0x397a52){return _0x397a52[_0xc56c('0x57')](_0x47240e[_0xc56c('0x4d')][_0xc56c('0x59')],_[_0xc56c('0x5a')](_0x47240e[_0xc56c('0x4d')],[_0xc56c('0x59'),'id'])||{});}})[_0xc56c('0x29')](respondWithResult(_0xea4dd0,null))[_0xc56c('0x47')](handleError(_0xea4dd0,null));};exports[_0xc56c('0x5b')]=function(_0x38de47,_0x1da6e8,_0x4bb16b){var _0x200ced={};var _0x422c97={};var _0x191fde;var _0x41af65;return db[_0xc56c('0x2f')][_0xc56c('0x5c')]({'where':{'id':_0x38de47[_0xc56c('0x56')]['id']}})[_0xc56c('0x29')](handleEntityNotFound(_0x1da6e8,null))['then'](function(_0x536108){if(_0x536108){_0x191fde=_0x536108;_0x422c97[_0xc56c('0x31')]=_[_0xc56c('0x32')](db[_0xc56c('0x58')][_0xc56c('0x49')]);_0x422c97[_0xc56c('0x33')]=_['keys'](_0x38de47['query']);_0x422c97[_0xc56c('0x34')]=_[_0xc56c('0x35')](_0x422c97[_0xc56c('0x31')],_0x422c97['query']);_0x200ced[_0xc56c('0x36')]=_[_0xc56c('0x35')](_0x422c97[_0xc56c('0x31')],qs['fields'](_0x38de47[_0xc56c('0x33')][_0xc56c('0x37')]));_0x200ced['attributes']=_0x200ced[_0xc56c('0x36')][_0xc56c('0x38')]?_0x200ced['attributes']:_0x422c97[_0xc56c('0x31')];_0x200ced[_0xc56c('0x3b')]=qs['sort'](_0x38de47[_0xc56c('0x33')][_0xc56c('0x3c')]);_0x200ced[_0xc56c('0x3d')]=qs[_0xc56c('0x34')](_[_0xc56c('0x3e')](_0x38de47[_0xc56c('0x33')],_0x422c97[_0xc56c('0x34')]));if(_0x38de47[_0xc56c('0x33')][_0xc56c('0x41')]){_0x200ced[_0xc56c('0x3d')]=_[_0xc56c('0x3f')](_0x200ced[_0xc56c('0x3d')],{'$or':_[_0xc56c('0x40')](_0x200ced[_0xc56c('0x36')],function(_0x2d7d5f){var _0x3ac751={};_0x3ac751[_0x2d7d5f]={'$like':'%'+_0x38de47[_0xc56c('0x33')][_0xc56c('0x41')]+'%'};return _0x3ac751;})});}_0x200ced=_['merge']({},_0x200ced,_0x38de47[_0xc56c('0x42')]);return _0x191fde[_0xc56c('0x5b')](_0x200ced);}})[_0xc56c('0x29')](function(_0x4e2ece){if(_0x4e2ece){_0x41af65=_0x4e2ece['length'];if(!_0x38de47['query'][_0xc56c('0x39')](_0xc56c('0x3a'))){_0x200ced[_0xc56c('0x23')]=qs[_0xc56c('0x23')](_0x38de47[_0xc56c('0x33')][_0xc56c('0x23')]);_0x200ced[_0xc56c('0x24')]=qs['offset'](_0x38de47[_0xc56c('0x33')][_0xc56c('0x24')]);}return _0x191fde[_0xc56c('0x5b')](_0x200ced);}})[_0xc56c('0x29')](function(_0x1922ad){if(_0x1922ad){return _0x1922ad?{'count':_0x41af65,'rows':_0x1922ad}:null;}})['then'](respondWithResult(_0x1da6e8,null))['catch'](handleError(_0x1da6e8,null));}; \ No newline at end of file +var _0x3e89=['describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','pick','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany'];(function(_0x3ee39d,_0x2e04a5){var _0x1ada4f=function(_0x145d54){while(--_0x145d54){_0x3ee39d['push'](_0x3ee39d['shift']());}};_0x1ada4f(++_0x2e04a5);}(_0x3e89,0x17d));var _0x93e8=function(_0x1cdaaa,_0x493dda){_0x1cdaaa=_0x1cdaaa-0x0;var _0x1c761d=_0x3e89[_0x1cdaaa];return _0x1c761d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93e8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93e8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x93e8('0x2'));var Mustache=require(_0x93e8('0x3'));var util=require(_0x93e8('0x4'));var path=require(_0x93e8('0x5'));var sox=require(_0x93e8('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(_0x93e8('0x7'));var jsforce=require(_0x93e8('0x8'));var deskjs=require(_0x93e8('0x9'));var toCsv=require(_0x93e8('0xa'));var querystring=require(_0x93e8('0xb'));var Papa=require(_0x93e8('0xc'));var Redis=require(_0x93e8('0xd'));var authService=require(_0x93e8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x93e8('0xf'));var hardwareService=require(_0x93e8('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x93e8('0x11'));var config=require(_0x93e8('0x12'));var licenseUtil=require(_0x93e8('0x13'));var db=require(_0x93e8('0x14'))['db'];function respondWithStatusCode(_0x1c71ba,_0x240045){_0x240045=_0x240045||0xcc;return function(_0x298d63){if(_0x298d63){return _0x1c71ba['sendStatus'](_0x240045);}return _0x1c71ba[_0x93e8('0x15')](_0x240045)[_0x93e8('0x16')]();};}function respondWithResult(_0x59c05d,_0x540013){_0x540013=_0x540013||0xc8;return function(_0x11690e){if(_0x11690e){return _0x59c05d[_0x93e8('0x15')](_0x540013)[_0x93e8('0x17')](_0x11690e);}};}function respondWithFilteredResult(_0x5db59f,_0x198ee6){return function(_0x273add){if(_0x273add){var _0x597357=typeof _0x198ee6[_0x93e8('0x18')]===_0x93e8('0x19')&&typeof _0x198ee6[_0x93e8('0x1a')]==='undefined';var _0x52dc66=_0x273add[_0x93e8('0x1b')];var _0x4f8fe9=_0x597357?0x0:_0x198ee6[_0x93e8('0x18')];var _0x42ffe3=_0x597357?_0x273add[_0x93e8('0x1b')]:_0x198ee6['offset']+_0x198ee6[_0x93e8('0x1a')];var _0x2f0902;if(_0x42ffe3>=_0x52dc66){_0x42ffe3=_0x52dc66;_0x2f0902=0xc8;}else{_0x2f0902=0xce;}_0x5db59f[_0x93e8('0x15')](_0x2f0902);return _0x5db59f['set'](_0x93e8('0x1c'),_0x4f8fe9+'-'+_0x42ffe3+'/'+_0x52dc66)['json'](_0x273add);}return null;};}function patchUpdates(_0x242a84){return function(_0x1024ea){try{jsonpatch[_0x93e8('0x1d')](_0x1024ea,_0x242a84,!![]);}catch(_0x36951e){return BPromise[_0x93e8('0x1e')](_0x36951e);}return _0x1024ea[_0x93e8('0x1f')]();};}function saveUpdates(_0x2c891e,_0x43734b){return function(_0x3749f0){if(_0x3749f0){return _0x3749f0[_0x93e8('0x20')](_0x2c891e)['then'](function(_0x429cc6){return _0x429cc6;});}return null;};}function removeEntity(_0x4b0a7f,_0x4fee7d){return function(_0x46b5ed){if(_0x46b5ed){return _0x46b5ed[_0x93e8('0x21')]()[_0x93e8('0x22')](function(){var _0x2fe8c4=_0x46b5ed[_0x93e8('0x23')]({'plain':!![]});var _0x28797e=_0x93e8('0x24');return db[_0x93e8('0x25')][_0x93e8('0x21')]({'where':{'type':_0x28797e,'resourceId':_0x2fe8c4['id']}})[_0x93e8('0x22')](function(){return _0x46b5ed;});})['then'](function(){_0x4b0a7f[_0x93e8('0x15')](0xcc)[_0x93e8('0x16')]();});}};}function handleEntityNotFound(_0x4117c5,_0x2b79f8){return function(_0x21a58f){if(!_0x21a58f){_0x4117c5['sendStatus'](0x194);}return _0x21a58f;};}function handleError(_0x2ea8f7,_0x1bbb89){_0x1bbb89=_0x1bbb89||0x1f4;return function(_0x37e2c1){logger[_0x93e8('0x26')](_0x37e2c1[_0x93e8('0x27')]);if(_0x37e2c1['name']){delete _0x37e2c1[_0x93e8('0x28')];}_0x2ea8f7[_0x93e8('0x15')](_0x1bbb89)[_0x93e8('0x29')](_0x37e2c1);};}exports[_0x93e8('0x2a')]=function(_0x114ebe,_0x9695c9){var _0x3e22c5={},_0x26a1ab={},_0x501ed4={'count':0x0,'rows':[]};return db[_0x93e8('0x2b')][_0x93e8('0x2c')]()['then'](function(_0x5e7e78){_0x26a1ab[_0x93e8('0x2d')]=_[_0x93e8('0x2e')](_0x5e7e78);_0x26a1ab[_0x93e8('0x2f')]=_[_0x93e8('0x2e')](_0x114ebe['query']);_0x26a1ab['filters']=_[_0x93e8('0x30')](_0x26a1ab['model'],_0x26a1ab[_0x93e8('0x2f')]);_0x3e22c5[_0x93e8('0x31')]=_[_0x93e8('0x30')](_0x26a1ab[_0x93e8('0x2d')],qs['fields'](_0x114ebe[_0x93e8('0x2f')][_0x93e8('0x32')]));_0x3e22c5[_0x93e8('0x31')]=_0x3e22c5[_0x93e8('0x31')][_0x93e8('0x33')]?_0x3e22c5[_0x93e8('0x31')]:_0x26a1ab[_0x93e8('0x2d')];if(!_0x114ebe['query'][_0x93e8('0x34')](_0x93e8('0x35'))){_0x3e22c5[_0x93e8('0x1a')]=qs[_0x93e8('0x1a')](_0x114ebe[_0x93e8('0x2f')][_0x93e8('0x1a')]);_0x3e22c5['offset']=qs[_0x93e8('0x18')](_0x114ebe['query'][_0x93e8('0x18')]);}_0x3e22c5[_0x93e8('0x36')]=qs[_0x93e8('0x37')](_0x114ebe[_0x93e8('0x2f')][_0x93e8('0x37')]);_0x3e22c5[_0x93e8('0x38')]=qs[_0x93e8('0x39')](_['pick'](_0x114ebe[_0x93e8('0x2f')],_0x26a1ab[_0x93e8('0x39')]),_0x5e7e78);if(_0x114ebe[_0x93e8('0x2f')][_0x93e8('0x3a')]){_0x3e22c5[_0x93e8('0x38')]=_[_0x93e8('0x3b')](_0x3e22c5[_0x93e8('0x38')],{'$or':_[_0x93e8('0x3c')](_0x3e22c5[_0x93e8('0x31')],function(_0x1b32bb){var _0x16a044={};_0x16a044[_0x1b32bb]={'$like':'%'+_0x114ebe['query'][_0x93e8('0x3a')]+'%'};return _0x16a044;})});}_0x3e22c5=_[_0x93e8('0x3b')]({},_0x3e22c5,_0x114ebe[_0x93e8('0x3d')]);var _0x5134b8={'where':_0x3e22c5[_0x93e8('0x38')]};return db[_0x93e8('0x2b')][_0x93e8('0x1b')](_0x5134b8)['then'](function(_0x30ced0){_0x501ed4[_0x93e8('0x1b')]=_0x30ced0;if(_0x114ebe[_0x93e8('0x2f')][_0x93e8('0x3e')]){_0x3e22c5['include']=[{'all':!![]}];}return db['CmCompany'][_0x93e8('0x3f')](_0x3e22c5);})[_0x93e8('0x22')](function(_0x5431b1){_0x501ed4[_0x93e8('0x40')]=_0x5431b1;return _0x501ed4;})[_0x93e8('0x22')](respondWithFilteredResult(_0x9695c9,_0x3e22c5))[_0x93e8('0x41')](handleError(_0x9695c9,null));})[_0x93e8('0x41')](handleError(_0x9695c9,null));};exports['show']=function(_0x199eda,_0x36ab0f){var _0x161f96={'raw':![],'where':{'id':_0x199eda[_0x93e8('0x42')]['id']}},_0x1dcc4d={};_0x1dcc4d[_0x93e8('0x2d')]=_[_0x93e8('0x2e')](db[_0x93e8('0x2b')][_0x93e8('0x43')]);_0x1dcc4d[_0x93e8('0x2f')]=_['keys'](_0x199eda[_0x93e8('0x2f')]);_0x1dcc4d['filters']=_[_0x93e8('0x30')](_0x1dcc4d[_0x93e8('0x2d')],_0x1dcc4d[_0x93e8('0x2f')]);_0x161f96[_0x93e8('0x31')]=_['intersection'](_0x1dcc4d[_0x93e8('0x2d')],qs[_0x93e8('0x32')](_0x199eda['query'][_0x93e8('0x32')]));_0x161f96['attributes']=_0x161f96[_0x93e8('0x31')][_0x93e8('0x33')]?_0x161f96[_0x93e8('0x31')]:_0x1dcc4d[_0x93e8('0x2d')];if(_0x199eda[_0x93e8('0x2f')][_0x93e8('0x3e')]){_0x161f96[_0x93e8('0x44')]=[{'all':!![]}];}_0x161f96=_[_0x93e8('0x3b')]({},_0x161f96,_0x199eda[_0x93e8('0x3d')]);return db[_0x93e8('0x2b')][_0x93e8('0x45')](_0x161f96)[_0x93e8('0x22')](handleEntityNotFound(_0x36ab0f,null))[_0x93e8('0x22')](respondWithResult(_0x36ab0f,null))['catch'](handleError(_0x36ab0f,null));};exports[_0x93e8('0x46')]=function(_0x56eb63,_0x4fe99a){return db[_0x93e8('0x2b')][_0x93e8('0x46')](_0x56eb63[_0x93e8('0x47')],{})[_0x93e8('0x22')](function(_0x1fd6de){var _0x78d35b=_0x56eb63[_0x93e8('0x48')]['get']({'plain':!![]});if(!_0x78d35b)throw new Error(_0x93e8('0x49'));if(_0x78d35b[_0x93e8('0x4a')]===_0x93e8('0x48')){var _0x1837ed=_0x1fd6de[_0x93e8('0x23')]({'plain':!![]});var _0x114ea4=_0x93e8('0x24');return db[_0x93e8('0x4b')][_0x93e8('0x45')]({'where':{'name':_0x114ea4,'userProfileId':_0x78d35b[_0x93e8('0x4c')]},'raw':!![]})[_0x93e8('0x22')](function(_0x26cb80){if(_0x26cb80&&_0x26cb80['autoAssociation']===0x0){return db['UserProfileResource'][_0x93e8('0x46')]({'name':_0x1837ed[_0x93e8('0x28')],'resourceId':_0x1837ed['id'],'type':_0x26cb80['name'],'sectionId':_0x26cb80['id']},{})['then'](function(){return _0x1fd6de;});}else{return _0x1fd6de;}})['catch'](function(_0x389df4){logger[_0x93e8('0x26')](_0x93e8('0x4d'),_0x389df4);throw _0x389df4;});}return _0x1fd6de;})[_0x93e8('0x22')](respondWithResult(_0x4fe99a,0xc9))[_0x93e8('0x41')](handleError(_0x4fe99a,null));};exports[_0x93e8('0x20')]=function(_0x2d2b7f,_0x51b5a1){if(_0x2d2b7f[_0x93e8('0x47')]['id']){delete _0x2d2b7f[_0x93e8('0x47')]['id'];}return db[_0x93e8('0x2b')]['find']({'where':{'id':_0x2d2b7f[_0x93e8('0x42')]['id']}})[_0x93e8('0x22')](handleEntityNotFound(_0x51b5a1,null))[_0x93e8('0x22')](saveUpdates(_0x2d2b7f['body'],null))['then'](respondWithResult(_0x51b5a1,null))[_0x93e8('0x41')](handleError(_0x51b5a1,null));};exports['destroy']=function(_0xc60f0a,_0xccb513){return db[_0x93e8('0x2b')][_0x93e8('0x45')]({'where':{'id':_0xc60f0a[_0x93e8('0x42')]['id']}})['then'](handleEntityNotFound(_0xccb513,null))[_0x93e8('0x22')](removeEntity(_0xccb513,null))[_0x93e8('0x41')](handleError(_0xccb513,null));};exports['describe']=function(_0x3dfd4b,_0x28cc8b){return db[_0x93e8('0x2b')]['describe']()[_0x93e8('0x22')](respondWithResult(_0x28cc8b,null))['catch'](handleError(_0x28cc8b,null));};exports[_0x93e8('0x4e')]=function(_0xa0d379,_0x332f41,_0xb98850){return db[_0x93e8('0x4f')][_0x93e8('0x45')]({'where':{'id':_0xa0d379[_0x93e8('0x42')]['id']}})['then'](handleEntityNotFound(_0x332f41,null))[_0x93e8('0x22')](function(_0x2c67ec){if(_0x2c67ec){return _0x2c67ec[_0x93e8('0x4e')](_0xa0d379[_0x93e8('0x47')][_0x93e8('0x50')],_[_0x93e8('0x51')](_0xa0d379['body'],[_0x93e8('0x50'),'id'])||{});}})[_0x93e8('0x22')](respondWithResult(_0x332f41,null))['catch'](handleError(_0x332f41,null));};exports[_0x93e8('0x52')]=function(_0x3df805,_0x5b395b,_0x30e631){var _0x18feff={};var _0x425605={};var _0x3862a6;var _0x373d0a;return db[_0x93e8('0x2b')][_0x93e8('0x53')]({'where':{'id':_0x3df805[_0x93e8('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b395b,null))[_0x93e8('0x22')](function(_0x15a008){if(_0x15a008){_0x3862a6=_0x15a008;_0x425605[_0x93e8('0x2d')]=_[_0x93e8('0x2e')](db[_0x93e8('0x4f')]['rawAttributes']);_0x425605[_0x93e8('0x2f')]=_[_0x93e8('0x2e')](_0x3df805[_0x93e8('0x2f')]);_0x425605[_0x93e8('0x39')]=_[_0x93e8('0x30')](_0x425605[_0x93e8('0x2d')],_0x425605[_0x93e8('0x2f')]);_0x18feff[_0x93e8('0x31')]=_[_0x93e8('0x30')](_0x425605['model'],qs[_0x93e8('0x32')](_0x3df805[_0x93e8('0x2f')][_0x93e8('0x32')]));_0x18feff[_0x93e8('0x31')]=_0x18feff[_0x93e8('0x31')][_0x93e8('0x33')]?_0x18feff['attributes']:_0x425605[_0x93e8('0x2d')];_0x18feff['order']=qs[_0x93e8('0x37')](_0x3df805[_0x93e8('0x2f')][_0x93e8('0x37')]);_0x18feff[_0x93e8('0x38')]=qs[_0x93e8('0x39')](_[_0x93e8('0x54')](_0x3df805[_0x93e8('0x2f')],_0x425605[_0x93e8('0x39')]));if(_0x3df805[_0x93e8('0x2f')][_0x93e8('0x3a')]){_0x18feff['where']=_[_0x93e8('0x3b')](_0x18feff[_0x93e8('0x38')],{'$or':_[_0x93e8('0x3c')](_0x18feff['attributes'],function(_0x157c25){var _0x377d9b={};_0x377d9b[_0x157c25]={'$like':'%'+_0x3df805[_0x93e8('0x2f')][_0x93e8('0x3a')]+'%'};return _0x377d9b;})});}_0x18feff=_[_0x93e8('0x3b')]({},_0x18feff,_0x3df805['options']);return _0x3862a6[_0x93e8('0x52')](_0x18feff);}})[_0x93e8('0x22')](function(_0x1244ce){if(_0x1244ce){_0x373d0a=_0x1244ce[_0x93e8('0x33')];if(!_0x3df805[_0x93e8('0x2f')]['hasOwnProperty'](_0x93e8('0x35'))){_0x18feff['limit']=qs[_0x93e8('0x1a')](_0x3df805[_0x93e8('0x2f')][_0x93e8('0x1a')]);_0x18feff[_0x93e8('0x18')]=qs[_0x93e8('0x18')](_0x3df805['query'][_0x93e8('0x18')]);}return _0x3862a6[_0x93e8('0x52')](_0x18feff);}})['then'](function(_0x5f5a18){if(_0x5f5a18){return _0x5f5a18?{'count':_0x373d0a,'rows':_0x5f5a18}:null;}})['then'](respondWithResult(_0x5b395b,null))[_0x93e8('0x41')](handleError(_0x5b395b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a18db96..040e890 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 _0xed0a=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','../../config/logger','api'];(function(_0x4336bc,_0x1a0da6){var _0x231421=function(_0x3d31a8){while(--_0x3d31a8){_0x4336bc['push'](_0x4336bc['shift']());}};_0x231421(++_0x1a0da6);}(_0xed0a,0x19d));var _0xaed0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xed0a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaed0('0x0'));var util=require('util');var logger=require(_0xaed0('0x1'))(_0xaed0('0x2'));var moment=require(_0xaed0('0x3'));var BPromise=require(_0xaed0('0x4'));var rp=require(_0xaed0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaed0('0x6'));var config=require(_0xaed0('0x7'));var attributes=require(_0xaed0('0x8'));module[_0xaed0('0x9')]=function(_0x5650b0,_0x4a30be){return _0x5650b0[_0xaed0('0xa')](_0xaed0('0xb'),attributes,{'tableName':_0xaed0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ed7=['api','moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x598ac5,_0x11aa0e){var _0x317e7f=function(_0x487a5a){while(--_0x487a5a){_0x598ac5['push'](_0x598ac5['shift']());}};_0x317e7f(++_0x11aa0e);}(_0x0ed7,0x1d9));var _0x70ed=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x0ed7[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x70ed('0x0'));var util=require(_0x70ed('0x1'));var logger=require(_0x70ed('0x2'))(_0x70ed('0x3'));var moment=require(_0x70ed('0x4'));var BPromise=require(_0x70ed('0x5'));var rp=require(_0x70ed('0x6'));var fs=require('fs');var path=require(_0x70ed('0x7'));var rimraf=require('rimraf');var config=require(_0x70ed('0x8'));var attributes=require(_0x70ed('0x9'));module[_0x70ed('0xa')]=function(_0x285d70,_0x2159c6){return _0x285d70[_0x70ed('0xb')](_0x70ed('0xc'),attributes,{'tableName':_0x70ed('0xd'),'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 c9f9c98..1da5d89 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 _0x17ce=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','lodash','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x17ce,0x1a0));var _0xe17c=function(_0x4188e6,_0x403e0a){_0x4188e6=_0x4188e6-0x0;var _0x3e3c9a=_0x17ce[_0x4188e6];return _0x3e3c9a;};'use strict';var _=require(_0xe17c('0x0'));var util=require(_0xe17c('0x1'));var moment=require(_0xe17c('0x2'));var BPromise=require(_0xe17c('0x3'));var rs=require(_0xe17c('0x4'));var fs=require('fs');var Redis=require(_0xe17c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe17c('0x6'));var logger=require(_0xe17c('0x7'))(_0xe17c('0x8'));var config=require(_0xe17c('0x9'));var jayson=require(_0xe17c('0xa'));var client=jayson[_0xe17c('0xb')][_0xe17c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a0cfc,_0x372069,_0x49d828){return new BPromise(function(_0x4a5e73,_0x1354a5){return client['request'](_0x5a0cfc,_0x49d828)[_0xe17c('0xd')](function(_0x40e19b){logger[_0xe17c('0xe')]('CmCompany,\x20%s,\x20%s',_0x372069,_0xe17c('0xf'));logger[_0xe17c('0x10')](_0xe17c('0x11'),_0x372069,_0xe17c('0xf'),JSON[_0xe17c('0x12')](_0x40e19b));if(_0x40e19b[_0xe17c('0x13')]){if(_0x40e19b[_0xe17c('0x13')]['code']===0x1f4){logger[_0xe17c('0x13')](_0xe17c('0x14'),_0x372069,_0x40e19b[_0xe17c('0x13')][_0xe17c('0x15')]);return _0x1354a5(_0x40e19b[_0xe17c('0x13')][_0xe17c('0x15')]);}logger[_0xe17c('0x13')](_0xe17c('0x14'),_0x372069,_0x40e19b[_0xe17c('0x13')][_0xe17c('0x15')]);return _0x4a5e73(_0x40e19b['error']['message']);}else{logger[_0xe17c('0xe')](_0xe17c('0x14'),_0x372069,_0xe17c('0xf'));_0x4a5e73(_0x40e19b['result'][_0xe17c('0x15')]);}})['catch'](function(_0x1a1326){logger[_0xe17c('0x13')](_0xe17c('0x14'),_0x372069,_0x1a1326);_0x1354a5(_0x1a1326);});});} \ No newline at end of file +var _0xc3b1=['result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x916117,_0x3101da){var _0x5ddef9=function(_0x43136a){while(--_0x43136a){_0x916117['push'](_0x916117['shift']());}};_0x5ddef9(++_0x3101da);}(_0xc3b1,0x10f));var _0x1c3b=function(_0x2ecf13,_0x213a49){_0x2ecf13=_0x2ecf13-0x0;var _0x423a67=_0xc3b1[_0x2ecf13];return _0x423a67;};'use strict';var _=require(_0x1c3b('0x0'));var util=require('util');var moment=require(_0x1c3b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c3b('0x2'));var db=require(_0x1c3b('0x3'))['db'];var utils=require(_0x1c3b('0x4'));var logger=require(_0x1c3b('0x5'))('rpc');var config=require(_0x1c3b('0x6'));var jayson=require(_0x1c3b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa3b870,_0x1c53a9,_0x32ac49){return new BPromise(function(_0x261f47,_0x30a82d){return client[_0x1c3b('0x8')](_0xa3b870,_0x32ac49)[_0x1c3b('0x9')](function(_0x1ac37c){logger['info'](_0x1c3b('0xa'),_0x1c53a9,_0x1c3b('0xb'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x1c53a9,'request\x20sent',JSON[_0x1c3b('0xc')](_0x1ac37c));if(_0x1ac37c[_0x1c3b('0xd')]){if(_0x1ac37c['error'][_0x1c3b('0xe')]===0x1f4){logger[_0x1c3b('0xd')](_0x1c3b('0xa'),_0x1c53a9,_0x1ac37c[_0x1c3b('0xd')][_0x1c3b('0xf')]);return _0x30a82d(_0x1ac37c['error'][_0x1c3b('0xf')]);}logger[_0x1c3b('0xd')](_0x1c3b('0xa'),_0x1c53a9,_0x1ac37c[_0x1c3b('0xd')]['message']);return _0x261f47(_0x1ac37c[_0x1c3b('0xd')][_0x1c3b('0xf')]);}else{logger[_0x1c3b('0x10')](_0x1c3b('0xa'),_0x1c53a9,'request\x20sent');_0x261f47(_0x1ac37c[_0x1c3b('0x11')][_0x1c3b('0xf')]);}})['catch'](function(_0x6aafba){logger[_0x1c3b('0xd')](_0x1c3b('0xa'),_0x1c53a9,_0x6aafba);_0x30a82d(_0x6aafba);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index abc3c15..e377ed0 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 _0xc165=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/contacts','post','addContacts','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x33b627,_0xcd64e0){var _0x531df0=function(_0x46db94){while(--_0x46db94){_0x33b627['push'](_0x33b627['shift']());}};_0x531df0(++_0xcd64e0);}(_0xc165,0x199));var _0x5c16=function(_0x50ac27,_0x1306e3){_0x50ac27=_0x50ac27-0x0;var _0x45f86a=_0xc165[_0x50ac27];return _0x45f86a;};'use strict';var multer=require(_0x5c16('0x0'));var util=require(_0x5c16('0x1'));var path=require(_0x5c16('0x2'));var timeout=require(_0x5c16('0x3'));var express=require(_0x5c16('0x4'));var router=express[_0x5c16('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5c16('0x6'));var interaction=require(_0x5c16('0x7'));var config=require(_0x5c16('0x8'));var controller=require('./cmCompany.controller');router[_0x5c16('0x9')]('/',auth[_0x5c16('0xa')](),controller['index']);router[_0x5c16('0x9')](_0x5c16('0xb'),auth[_0x5c16('0xa')](),controller[_0x5c16('0xc')]);router[_0x5c16('0x9')]('/:id',auth[_0x5c16('0xa')](),controller[_0x5c16('0xd')]);router[_0x5c16('0x9')](_0x5c16('0xe'),auth[_0x5c16('0xa')](),controller['getContacts']);router[_0x5c16('0xf')]('/',auth[_0x5c16('0xa')](),controller['create']);router[_0x5c16('0xf')](_0x5c16('0xe'),auth['isAuthenticated'](),controller[_0x5c16('0x10')]);router[_0x5c16('0x11')]('/:id',auth[_0x5c16('0xa')](),controller[_0x5c16('0x12')]);router[_0x5c16('0x13')](_0x5c16('0x14'),auth['isAuthenticated'](),controller[_0x5c16('0x15')]);module[_0x5c16('0x16')]=router; \ No newline at end of file +var _0xe2da=['../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x53f152,_0x7e09db){var _0x54e658=function(_0x597bf0){while(--_0x597bf0){_0x53f152['push'](_0x53f152['shift']());}};_0x54e658(++_0x7e09db);}(_0xe2da,0xc8));var _0xae2d=function(_0x195e0b,_0x3c536b){_0x195e0b=_0x195e0b-0x0;var _0x3df39e=_0xe2da[_0x195e0b];return _0x3df39e;};'use strict';var multer=require(_0xae2d('0x0'));var util=require(_0xae2d('0x1'));var path=require(_0xae2d('0x2'));var timeout=require(_0xae2d('0x3'));var express=require(_0xae2d('0x4'));var router=express['Router']();var fs_extra=require(_0xae2d('0x5'));var auth=require(_0xae2d('0x6'));var interaction=require(_0xae2d('0x7'));var config=require(_0xae2d('0x8'));var controller=require(_0xae2d('0x9'));router[_0xae2d('0xa')]('/',auth['isAuthenticated'](),controller[_0xae2d('0xb')]);router['get'](_0xae2d('0xc'),auth[_0xae2d('0xd')](),controller[_0xae2d('0xe')]);router['get'](_0xae2d('0xf'),auth[_0xae2d('0xd')](),controller[_0xae2d('0x10')]);router[_0xae2d('0xa')](_0xae2d('0x11'),auth[_0xae2d('0xd')](),controller[_0xae2d('0x12')]);router[_0xae2d('0x13')]('/',auth[_0xae2d('0xd')](),controller[_0xae2d('0x14')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0xae2d('0x15')]);router[_0xae2d('0x16')](_0xae2d('0xf'),auth[_0xae2d('0xd')](),controller['update']);router[_0xae2d('0x17')](_0xae2d('0xf'),auth[_0xae2d('0xd')](),controller[_0xae2d('0x18')]);module[_0xae2d('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c6e32a1..151d68c 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 _0x0f0a=['UNSIGNED','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x5c4f31,_0x4bcb71){var _0x1340e8=function(_0x5940ba){while(--_0x5940ba){_0x5c4f31['push'](_0x5c4f31['shift']());}};_0x1340e8(++_0x4bcb71);}(_0x0f0a,0x133));var _0xa0f0=function(_0x2067ae,_0x2297d9){_0x2067ae=_0x2067ae-0x0;var _0x15d9e7=_0x0f0a[_0x2067ae];return _0x15d9e7;};'use strict';var _=require(_0xa0f0('0x0'));var Sequelize=require(_0xa0f0('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xa0f0('0x2')]},'street':{'type':Sequelize[_0xa0f0('0x2')]},'postalCode':{'type':Sequelize[_0xa0f0('0x2')]},'city':{'type':Sequelize[_0xa0f0('0x2')]},'country':{'type':Sequelize[_0xa0f0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa0f0('0x2')]},'description':{'type':Sequelize[_0xa0f0('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xa0f0('0x2')]},'fax':{'type':Sequelize[_0xa0f0('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa0f0('0x2')]},'fb_data':{'type':Sequelize[_0xa0f0('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xa0f0('0x2')]},'teams':{'type':Sequelize[_0xa0f0('0x2')]},'viber':{'type':Sequelize[_0xa0f0('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xa0f0('0x2')]},'UserId':{'type':Sequelize[_0xa0f0('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xa0f0('0x2')]},'priority':{'type':Sequelize[_0xa0f0('0x4')](0x2)[_0xa0f0('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xa0f0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1436=['NOW','sequelize','exports','STRING','TEXT','INTEGER','DATE'];(function(_0x47a385,_0x5d8781){var _0x31abb9=function(_0x210f7a){while(--_0x210f7a){_0x47a385['push'](_0x47a385['shift']());}};_0x31abb9(++_0x5d8781);}(_0x1436,0x1eb));var _0x6143=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1436[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var Sequelize=require(_0x6143('0x0'));module[_0x6143('0x1')]={'firstName':{'type':Sequelize[_0x6143('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6143('0x2')]},'street':{'type':Sequelize[_0x6143('0x2')]},'postalCode':{'type':Sequelize[_0x6143('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x6143('0x2')]},'description':{'type':Sequelize[_0x6143('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6143('0x2')]},'fax':{'type':Sequelize[_0x6143('0x2')]},'email':{'type':Sequelize[_0x6143('0x2')]},'url':{'type':Sequelize[_0x6143('0x2')]},'facebook':{'type':Sequelize[_0x6143('0x2')]},'fb_data':{'type':Sequelize[_0x6143('0x2')]},'twitter':{'type':Sequelize[_0x6143('0x2')]},'skype':{'type':Sequelize[_0x6143('0x2')]},'teams':{'type':Sequelize[_0x6143('0x2')]},'viber':{'type':Sequelize[_0x6143('0x2')]},'line':{'type':Sequelize[_0x6143('0x2')]},'wechat':{'type':Sequelize[_0x6143('0x2')]},'telegram':{'type':Sequelize[_0x6143('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x6143('0x2')]},'priority':{'type':Sequelize[_0x6143('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6143('0x5')],'defaultValue':Sequelize[_0x6143('0x6')]},'dialTimezone':{'type':Sequelize[_0x6143('0x2')]},'utcOffset':{'type':Sequelize[_0x6143('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 46ed02c..9afd072 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 _0x5e53=['includeAll','include','rows','getHopperHistories','rawAttributes','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','root','server/files/tmp','file','filename','chmodSync','child_process','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','binding','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','fork','../../components/import/cm/csv2','stringify','error\x20child\x20process','importUpdates','User','agent','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','exit','chat','sms','openchannel','fax','whatsapp','voice','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','UserId','DESC','VoiceCallReport','fullname','startCase','Website','Account','closed','closedAt','note','secondDisposition','thirdDisposition','Owner','browserName','customerIp','customerPort','deviceModel','ratingMessage','referer','mail','subject','substatus','externalUrl','threadId','Interaction','findAndCountAll','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','papaparse','ioredis','../../components/contacts','api','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','json','undefined','limit','offset','status','set','destroy','then','end','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','startsWith','cf_','displayName','analytics','length','columnName','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','keys','forEach','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','spread','contact','show','Tag','Tags','tag','Phones','ItemType','sequelize','literal','$and','CmCustomField','omit','format','cf_%d','isEmpty','table','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','filters','intersection','attributes','fields','sort','pick','filter','map','hasOwnProperty','nolimit','setTags','ids','setAdditionalPhones','all','CmContactHasItem','ContactItemType','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','order','ContactId','options','count'];(function(_0x5ae5b5,_0x51d4d5){var _0x23c34f=function(_0x50527d){while(--_0x50527d){_0x5ae5b5['push'](_0x5ae5b5['shift']());}};_0x23c34f(++_0x51d4d5);}(_0x5e53,0x15e));var _0x35e5=function(_0x3a6d7a,_0x1210ea){_0x3a6d7a=_0x3a6d7a-0x0;var _0x1eda3d=_0x5e53[_0x3a6d7a];return _0x1eda3d;};'use strict';var moment=require(_0x35e5('0x0'));var BPromise=require(_0x35e5('0x1'));var util=require(_0x35e5('0x2'));var path=require(_0x35e5('0x3'));var fs=require('fs');var _=require(_0x35e5('0x4'));var squel=require('squel');var Papa=require(_0x35e5('0x5'));var Redis=require(_0x35e5('0x6'));var contacts=require(_0x35e5('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x35e5('0x8'));var config=require('../../config/environment');var shared=require(_0x35e5('0x9'));var db=require(_0x35e5('0xa'))['db'];config['redis']=_[_0x35e5('0xb')](config[_0x35e5('0xc')],{'host':_0x35e5('0xd'),'port':0x18eb});var socket=require(_0x35e5('0xe'))(new Redis(config['redis']));require(_0x35e5('0xf'))[_0x35e5('0x10')](socket);function respondWithResult(_0x563442,_0x298da1){_0x298da1=_0x298da1||0xc8;return function(_0x581551){if(_0x581551){return _0x563442['status'](_0x298da1)[_0x35e5('0x11')](_0x581551);}};}function respondWithFilteredResult(_0x5f201c,_0x3642b3){return function(_0x1e09cb){if(_0x1e09cb){var _0xc69d8b=typeof _0x3642b3['offset']===_0x35e5('0x12')&&typeof _0x3642b3[_0x35e5('0x13')]===_0x35e5('0x12');var _0xb32c4=_0x1e09cb['count'];var _0x5a2f08=_0xc69d8b?0x0:_0x3642b3[_0x35e5('0x14')];var _0x37acd4=_0xc69d8b?_0x1e09cb['count']:_0x3642b3['offset']+_0x3642b3[_0x35e5('0x13')];var _0x2b2877;if(_0x37acd4>=_0xb32c4){_0x37acd4=_0xb32c4;_0x2b2877=0xc8;}else{_0x2b2877=0xce;}_0x5f201c[_0x35e5('0x15')](_0x2b2877);return _0x5f201c[_0x35e5('0x16')]('Content-Range',_0x5a2f08+'-'+_0x37acd4+'/'+_0xb32c4)[_0x35e5('0x11')](_0x1e09cb);}return null;};}function saveUpdates(_0x40ba71){return function(_0x86d20c){if(_0x86d20c){return _0x86d20c['update'](_0x40ba71)['then'](function(_0x10dd5a){return _0x10dd5a;});}return null;};}function removeEntity(_0x1ff33a){return function(_0x42bea1){if(_0x42bea1){return _0x42bea1[_0x35e5('0x17')]()[_0x35e5('0x18')](function(){_0x1ff33a[_0x35e5('0x15')](0xcc)[_0x35e5('0x19')]();});}};}function handleEntityNotFound(_0x1fbe88){return function(_0x51c30d){if(!_0x51c30d){_0x1fbe88[_0x35e5('0x1a')](0x194);}return _0x51c30d;};}function handleError(_0x256947,_0x1351c0){_0x1351c0=_0x1351c0||0x1f4;return function(_0x3a5724){logger[_0x35e5('0x1b')](_0x3a5724[_0x35e5('0x1c')]);if(_0x3a5724[_0x35e5('0x1d')]){delete _0x3a5724[_0x35e5('0x1d')];}_0x256947[_0x35e5('0x15')](_0x1351c0)[_0x35e5('0x1e')](_0x3a5724);};}exports[_0x35e5('0x1f')]=function(_0x4cb4e1,_0x5e9b32){var _0x2206cd={};return contacts[_0x35e5('0x20')]()[_0x35e5('0x18')](function(_0x3ecacb){_0x2206cd=qs[_0x35e5('0x21')](_0x3ecacb,_0x4cb4e1);return contacts[_0x35e5('0x22')](_0x4cb4e1[_0x35e5('0x23')],_0x4cb4e1[_0x35e5('0x24')],_0x2206cd,_0x3ecacb);})[_0x35e5('0x18')](respondWithFilteredResult(_0x5e9b32,_0x2206cd))[_0x35e5('0x25')](handleError(_0x5e9b32,null));};exports[_0x35e5('0x17')]=function(_0xe0205,_0x2d4141){return db[_0x35e5('0x26')][_0x35e5('0x27')]({'where':{'id':_0xe0205[_0x35e5('0x28')]['id']}})['then'](handleEntityNotFound(_0x2d4141,null))[_0x35e5('0x18')](removeEntity(_0x2d4141,null))[_0x35e5('0x25')](handleError(_0x2d4141,null));};exports[_0x35e5('0x20')]=function(_0x5758af,_0x2821fe){return db[_0x35e5('0x26')][_0x35e5('0x20')]()[_0x35e5('0x18')](function(_0xd1f258){delete _0xd1f258[_0x35e5('0x29')];for(var _0x298fad=0x0;_0x298fad0x0){return new Promise(function(_0x15785d){var _0x5dcff5=[];for(var _0x4033a0=0x0;_0x4033a0<_0x5ca928['length'];_0x4033a0++){_0x5dcff5[_0x35e5('0x5f')](insertAdditionalPhones(_0x5ca928[_0x4033a0][_0x35e5('0x63')],_0x5ca928[_0x4033a0][_0x35e5('0x5a')]));}Promise['all'](_0x5dcff5)['then'](function(){_0x15785d(0x1);});})[_0x35e5('0x18')](function(){return{'success':_0x5e177f,'failure':_0x39c788,'duplicates':_0x1404b4};});}else{return{'success':_0x5e177f,'failure':_0x39c788,'duplicates':_0x1404b4};}}})[_0x35e5('0x18')](respondWithResult(_0x3d4cc8,0xc9))['catch'](handleError(_0x3d4cc8,null));};exports[_0x35e5('0x64')]=function(_0x45d5a6,_0x2bb3b3){var _0x4f807e;return db[_0x35e5('0x26')][_0x35e5('0x20')]()[_0x35e5('0x18')](function(_0x2349e8){return db[_0x35e5('0x26')]['find']({'where':{'id':_0x45d5a6[_0x35e5('0x28')]['id']},'include':[{'model':db[_0x35e5('0x65')],'as':_0x35e5('0x66'),'attributes':['id',_0x35e5('0x1d'),'color'],'required':_0x45d5a6['query'][_0x35e5('0x67')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x35e5('0x68'),'where':{'CmContactId':_0x45d5a6[_0x35e5('0x28')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x35e5('0x69')}]}],'order':[db[_0x35e5('0x6a')][_0x35e5('0x6b')]('Phones.OrderBy')],'attributes':_[_0x35e5('0x35')](_0x2349e8)});})[_0x35e5('0x18')](function(_0xdae934){if(!_['isNil'](_0xdae934)){_0x4f807e=_0xdae934[_0x35e5('0x3a')]({'plain':!![]});var _0x44dca6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xdae934&&_0xdae934['ListId']){if(_0xdae934[_0x35e5('0x60')]){_0x44dca6['where'][_0x35e5('0x6c')][_0x35e5('0x5f')]({'ListId':{'$ne':_0xdae934[_0x35e5('0x60')]}});}}return db[_0x35e5('0x6d')][_0x35e5('0x22')](_0x44dca6);}})[_0x35e5('0x18')](function(_0x14955b){if(!_[_0x35e5('0x56')](_0x14955b)){return _[_0x35e5('0x6e')](_0x4f807e,_['map'](_0x14955b,function(_0x3908ca){return util[_0x35e5('0x6f')](_0x35e5('0x70'),_0x3908ca['id']);}));}})['then'](handleEntityNotFound(_0x2bb3b3,null))[_0x35e5('0x18')](respondWithResult(_0x2bb3b3,null))[_0x35e5('0x25')](handleError(_0x2bb3b3,null));};exports[_0x35e5('0x44')]=function(_0x861daa,_0x4694bf){var _0x1da31e;if(_0x861daa[_0x35e5('0x38')]['id']){delete _0x861daa[_0x35e5('0x38')]['id'];}if(!_['isNil'](_0x861daa[_0x35e5('0x38')]['dialTimezone'])){var _0x48aa25=_0x861daa[_0x35e5('0x38')][_0x35e5('0x57')];if(!_[_0x35e5('0x56')](shared[_0x35e5('0x59')][_0x48aa25]))_0x861daa['body'][_0x35e5('0x58')]=shared['timezones'][_0x48aa25][_0x35e5('0x58')];}return db['CmContact']['find']({'where':{'id':_0x861daa[_0x35e5('0x28')]['id']}})[_0x35e5('0x18')](handleEntityNotFound(_0x4694bf,null))[_0x35e5('0x18')](saveUpdates(_0x861daa[_0x35e5('0x38')],null))[_0x35e5('0x18')](function(_0x2728bc){_0x1da31e=_0x2728bc;var _0xced604={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2728bc&&_0x2728bc['ListId']){if(_0x2728bc[_0x35e5('0x60')]){_0xced604[_0x35e5('0x5e')]['$and'][_0x35e5('0x5f')]({'ListId':{'$ne':_0x2728bc[_0x35e5('0x60')]}});}}return db[_0x35e5('0x6d')][_0x35e5('0x22')](_0xced604);})[_0x35e5('0x18')](function(_0x2b0a5c){if(_0x2b0a5c){return _[_0x35e5('0x6e')](_['pickBy'](_0x861daa['body'],function(_0xac200d,_0x4d61ca){return _[_0x35e5('0x2a')](_0x4d61ca,_0x35e5('0x2b'));}),_['map'](_0x2b0a5c,function(_0x143f78){return util['format'](_0x35e5('0x70'),_0x143f78['id']);}));}})[_0x35e5('0x18')](function(_0x717b9b){if(_0x717b9b&&!_[_0x35e5('0x71')](_0x717b9b)){var _0x5a9085=squel['update']()[_0x35e5('0x72')]('cm_contacts')[_0x35e5('0x73')](_0x717b9b)[_0x35e5('0x5e')](_0x35e5('0x74'),_0x861daa[_0x35e5('0x28')]['id'])[_0x35e5('0x75')]();return db[_0x35e5('0x6a')][_0x35e5('0x23')](_0x5a9085[_0x35e5('0x76')],{'replacements':_0x5a9085['values']});}})[_0x35e5('0x18')](function(){if(_0x861daa[_0x35e5('0x38')][_0x35e5('0x77')]&&_0x1da31e){return db['CmHopper'][_0x35e5('0x44')]({'phone':_0x861daa[_0x35e5('0x38')][_0x35e5('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x1da31e['id']}});}})[_0x35e5('0x18')](function(){return _0x1da31e;})['then'](respondWithResult(_0x4694bf,null))[_0x35e5('0x25')](handleError(_0x4694bf,null));};exports[_0x35e5('0x78')]=function(_0x230726,_0x3ac659){var _0x269672={};var _0x3bab9a={};var _0x29eaed;var _0x3bd282;return db['CmContact'][_0x35e5('0x79')]({'where':{'id':_0x230726[_0x35e5('0x28')]['id']}})[_0x35e5('0x18')](handleEntityNotFound(_0x3ac659,null))['then'](function(_0x355e44){if(_0x355e44){_0x29eaed=_0x355e44;_0x3bab9a[_0x35e5('0x7a')]=_[_0x35e5('0x35')](db['Tag']['rawAttributes']);_0x3bab9a[_0x35e5('0x23')]=_['keys'](_0x230726[_0x35e5('0x23')]);_0x3bab9a[_0x35e5('0x7b')]=_[_0x35e5('0x7c')](_0x3bab9a[_0x35e5('0x7a')],_0x3bab9a[_0x35e5('0x23')]);_0x269672[_0x35e5('0x7d')]=_[_0x35e5('0x7c')](_0x3bab9a['model'],qs[_0x35e5('0x7e')](_0x230726[_0x35e5('0x23')][_0x35e5('0x7e')]));_0x269672[_0x35e5('0x7d')]=_0x269672[_0x35e5('0x7d')][_0x35e5('0x2e')]?_0x269672[_0x35e5('0x7d')]:_0x3bab9a[_0x35e5('0x7a')];_0x269672['order']=qs['sort'](_0x230726[_0x35e5('0x23')][_0x35e5('0x7f')]);_0x269672['where']=qs[_0x35e5('0x7b')](_[_0x35e5('0x80')](_0x230726[_0x35e5('0x23')],_0x3bab9a[_0x35e5('0x7b')]));if(_0x230726[_0x35e5('0x23')][_0x35e5('0x81')]){_0x269672[_0x35e5('0x5e')]=_['merge'](_0x269672[_0x35e5('0x5e')],{'$or':_[_0x35e5('0x82')](_0x269672['attributes'],function(_0x416551){var _0xce524={};_0xce524[_0x416551]={'$like':'%'+_0x230726['query'][_0x35e5('0x81')]+'%'};return _0xce524;})});}_0x269672=_[_0x35e5('0x37')]({},_0x269672,_0x230726['options']);return _0x29eaed[_0x35e5('0x78')](_0x269672);}})[_0x35e5('0x18')](function(_0x47a7f5){if(_0x47a7f5){_0x3bd282=_0x47a7f5[_0x35e5('0x2e')];if(!_0x230726[_0x35e5('0x23')][_0x35e5('0x83')](_0x35e5('0x84'))){_0x269672[_0x35e5('0x13')]=qs['limit'](_0x230726['query'][_0x35e5('0x13')]);_0x269672[_0x35e5('0x14')]=qs['offset'](_0x230726['query'][_0x35e5('0x14')]);}return _0x29eaed[_0x35e5('0x78')](_0x269672);}})[_0x35e5('0x18')](function(_0xd4cb3b){if(_0xd4cb3b){return _0xd4cb3b?{'count':_0x3bd282,'rows':_0xd4cb3b}:null;}})[_0x35e5('0x18')](respondWithResult(_0x3ac659,null))[_0x35e5('0x25')](handleError(_0x3ac659,null));};exports[_0x35e5('0x85')]=function(_0x5a1f5f,_0xf1e209){if(_0x5a1f5f[_0x35e5('0x38')]['id']){delete _0x5a1f5f[_0x35e5('0x38')]['id'];}return db[_0x35e5('0x26')][_0x35e5('0x79')]({'where':{'id':_0x5a1f5f[_0x35e5('0x28')]['id']}})[_0x35e5('0x18')](handleEntityNotFound(_0xf1e209,null))[_0x35e5('0x18')](function(_0x59a6ef){if(_0x59a6ef){return _0x59a6ef['setTags'](_0x5a1f5f[_0x35e5('0x38')][_0x35e5('0x86')]||[]);}return null;})[_0x35e5('0x18')](respondWithResult(_0xf1e209,null))['catch'](handleError(_0xf1e209,null));};exports[_0x35e5('0x87')]=function(_0x1b53d9,_0x73ec7d){var _0x346860=[];_0x346860[_0x35e5('0x5f')](addAdditionalPhones(_0x1b53d9[_0x35e5('0x38')]));Promise[_0x35e5('0x88')](_0x346860)[_0x35e5('0x18')](function(){_0x346860=[];_0x346860[_0x35e5('0x5f')](deleteCmHopperPhones(_0x1b53d9[_0x35e5('0x38')]['id']));_0x346860[_0x35e5('0x5f')](addCmHopperPhones(_0x1b53d9[_0x35e5('0x38')]['id']));Promise[_0x35e5('0x88')](_0x346860)[_0x35e5('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x73ec7d,null));});};function addAdditionalPhones(_0x513e9a){var _0x282309;return new Promise(function(_0x2c351e){return db[_0x35e5('0x89')]['destroy']({'where':{'CmContactId':_0x513e9a['id']}})[_0x35e5('0x18')](function(){db[_0x35e5('0x8a')][_0x35e5('0x22')]({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x183c5e){var _0x2e5827=[];for(var _0x5de7af=0x0;_0x5de7af<_0x513e9a[_0x35e5('0x8b')][_0x35e5('0x2e')];_0x5de7af++){var _0x4660f6=_0x513e9a['item_types']?_[_0x35e5('0x56')](_0x513e9a[_0x35e5('0x8c')][_0x5de7af])?'':_0x513e9a[_0x35e5('0x8c')][_0x5de7af]:_0x513e9a[_0x35e5('0x8b')][_0x5de7af]['ItemTypeId']?_0x513e9a['items'][_0x5de7af][_0x35e5('0x8d')]:'';var _0x2067f3=_[_0x35e5('0x56')](_0x513e9a[_0x35e5('0x8b')][_0x5de7af][_0x35e5('0x8e')])?'':_0x513e9a[_0x35e5('0x8b')][_0x5de7af][_0x35e5('0x8e')];var _0x33a593=_0x4660f6+':'+_0x513e9a[_0x35e5('0x8b')][_0x5de7af][_0x35e5('0x77')]+'§'+_0x2067f3;if(_[_0x35e5('0x56')](_0x282309))_0x282309=_0x33a593;else _0x282309+=';'+_0x33a593;var _0x6b8403=null;var _0x19844e=null;if(_0x513e9a[_0x35e5('0x8c')]){if(!_[_0x35e5('0x56')](_0x513e9a[_0x35e5('0x8c')][_0x5de7af])){_0x19844e=_[_0x35e5('0x27')](_0x183c5e,function(_0xeda858){return _0xeda858['id']===_0x513e9a[_0x35e5('0x8c')][_0x5de7af];});if(!_['isNil'](_0x19844e)){_0x6b8403=_0x19844e[_0x35e5('0x8f')];}}}else{if(!_['isNil'](_0x513e9a[_0x35e5('0x8b')][_0x5de7af])){_0x19844e=_[_0x35e5('0x27')](_0x183c5e,function(_0xd6cde){return _0xd6cde['id']===_0x513e9a['items'][_0x5de7af][_0x35e5('0x8d')];});if(!_[_0x35e5('0x56')](_0x19844e)){_0x6b8403=_0x5de7af;}}}if(_[_0x35e5('0x56')](_0x6b8403)){_0x6b8403=0x64;}_0x2e5827[_0x35e5('0x5f')](addAdditionalPhone(_0x513e9a['id'],_0x513e9a['items'][_0x5de7af]['phone'],_0x513e9a['item_types']?_[_0x35e5('0x56')](_0x513e9a['item_types'][_0x5de7af])?null:_0x513e9a[_0x35e5('0x8c')][_0x5de7af]:_0x513e9a[_0x35e5('0x8b')][_0x5de7af][_0x35e5('0x8d')]?_0x513e9a['items'][_0x5de7af][_0x35e5('0x8d')]:null,_0x6b8403,_0x2067f3));}Promise[_0x35e5('0x88')](_0x2e5827)[_0x35e5('0x18')](function(){db[_0x35e5('0x26')][_0x35e5('0x44')]({'AdditionalPhones':_0x282309},{'where':{'id':_0x513e9a['id']}})['then'](function(){_0x2c351e(0x1);});});});});});}function addAdditionalPhone(_0x335492,_0x5e8554,_0x41ec23,_0x255d02,_0x531146){return db['CmContactHasItem'][_0x35e5('0x27')]({'where':{'CmContactId':_0x335492,'item':_0x5e8554}})[_0x35e5('0x18')](function(_0x1f00d0){if(_0x1f00d0)logger[_0x35e5('0x33')](_0x35e5('0x90'),_0x1f00d0);else{db['CmContactHasItem'][_0x35e5('0x41')]({'CmContactId':_0x335492,'item':_0x5e8554,'ItemTypeId':_0x41ec23,'OrderBy':_0x255d02,'ItemClass':_0x35e5('0x91'),'description':_0x531146});}});}function deleteCmHopperPhones(_0x58f627){return new Promise(function(_0x28984c){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x58f627}})[_0x35e5('0x18')](function(_0x461e9a){db[_0x35e5('0x92')][_0x35e5('0x17')]({'where':{'CmHopperId':{'$in':_[_0x35e5('0x82')](_0x461e9a,'id')}}});})[_0x35e5('0x18')](function(){_0x28984c(0x1);});});}function addCmHopperPhones(_0x5a73c2){return new Promise(function(_0x4d2acc){return db[_0x35e5('0x3e')][_0x35e5('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5a73c2}})[_0x35e5('0x18')](function(_0x336017){var _0x10c462=[];_[_0x35e5('0x82')](_0x336017,function(_0x39d17d){_0x10c462[_0x35e5('0x5f')](createCmHopperPhone(_0x5a73c2,_0x39d17d['id']));});Promise[_0x35e5('0x88')](_0x10c462)['then'](function(){_0x4d2acc(0x1);});});});}function createCmHopperPhone(_0x42955b,_0x28b8ed){return new Promise(function(_0x530046){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':[_0x35e5('0x93'),_0x35e5('0x8f')],'where':{'CmContactId':_0x42955b,'ItemClass':_0x35e5('0x91')},'include':[{'model':db[_0x35e5('0x8a')],'attributes':['OrderBy'],'as':_0x35e5('0x69')}],'order':[_0x35e5('0x8f'),db[_0x35e5('0x6a')][_0x35e5('0x6b')](_0x35e5('0x94'))]})[_0x35e5('0x18')](function(_0x4801ff){var _0x411ed1=0x1;var _0x32c1af=_[_0x35e5('0x82')](_0x4801ff,function(_0x43e91b){_0x43e91b[_0x35e5('0x95')]=_0x28b8ed;_0x43e91b[_0x35e5('0x77')]=_0x43e91b['item'];_0x43e91b[_0x35e5('0x8f')]=_0x411ed1;delete _0x43e91b['ItemType.OrderBy'];_0x411ed1=_0x411ed1+0x1;return _0x43e91b;});return db[_0x35e5('0x92')][_0x35e5('0x5b')](_0x32c1af,{});})[_0x35e5('0x18')](function(){_0x530046(0x1);});});}function insertAdditionalPhones(_0x5ee84a,_0x2b4b0c){return new Promise(function(_0x2ab83e){var _0x35eff0=[];for(var _0x244da9=0x0;_0x244da9<_0x2b4b0c['length'];_0x244da9++){var _0x480dc7=_0x2b4b0c[_0x244da9];_0x35eff0[_0x35e5('0x5f')](parseContactItemType(_0x480dc7));}Promise[_0x35e5('0x88')](_0x35eff0)[_0x35e5('0x18')](function(){var _0xc26737={'id':_0x5ee84a['id'],'items':_0x2b4b0c};return addAdditionalPhones(_0xc26737)['then'](function(){return addCmHopperPhones(_0x5ee84a['id']);});})[_0x35e5('0x18')](function(){_0x2ab83e(_0x5ee84a);});});}function parseContactItemType(_0x430847){return new Promise(function(_0x39aa04){if(_0x430847[_0x35e5('0x83')](_0x35e5('0x8d'))){_0x39aa04(_0x430847);}else{return db[_0x35e5('0x8a')][_0x35e5('0x27')]({'where':{'name':_0x430847[_0x35e5('0x69')]}})[_0x35e5('0x18')](function(_0x3eb08f){if(_['isNil'](_0x3eb08f))_0x430847[_0x35e5('0x8d')]=null;else _0x430847[_0x35e5('0x8d')]=_0x3eb08f['id'];_0x39aa04(_0x430847);});}});}exports['getAdditionalPhones']=function(_0xa6852f,_0x3e5de0){return db[_0x35e5('0x89')]['findAll']({'raw':!![],'where':{'CmContactId':_0xa6852f[_0x35e5('0x28')]['id'],'ItemClass':_0x35e5('0x91')},'include':[{'model':db[_0x35e5('0x8a')],'as':_0x35e5('0x69')}],'order':[['OrderBy'],[db[_0x35e5('0x6a')][_0x35e5('0x6b')](_0x35e5('0x94'))]]})['then'](function(_0x2f1728){return _0x2f1728;})[_0x35e5('0x18')](respondWithResult(_0x3e5de0,null))[_0x35e5('0x25')](handleError(_0x3e5de0,null));};exports[_0x35e5('0x96')]=function(_0x597500,_0x521e5f){return db[_0x35e5('0x89')][_0x35e5('0x22')]({'raw':!![],'where':{'CmContactId':_0x597500['body'][_0x35e5('0x97')]}})[_0x35e5('0x18')](function(_0x53d5d3){var _0x14dcb1=_[_0x35e5('0x82')](_0x53d5d3,function(_0x2887f6){_0x2887f6[_0x35e5('0x98')]=_0x597500['body'][_0x35e5('0x99')];return _0x2887f6;});return db[_0x35e5('0x89')]['bulkCreate'](_0x14dcb1,{});})[_0x35e5('0x18')](function(){return addCmHopperPhones(_0x597500['body'][_0x35e5('0x99')]);})[_0x35e5('0x18')](function(){return['ok'];})[_0x35e5('0x18')](respondWithResult(_0x521e5f,null))[_0x35e5('0x25')](handleError(_0x521e5f,null));};exports[_0x35e5('0x9a')]=function(_0x46b5df,_0x1f9b90){var _0x3f6935=[];_0x3f6935['push'](createCmHopperPhone(_0x46b5df[_0x35e5('0x38')]['id'],_0x46b5df[_0x35e5('0x38')]['hopperId']));Promise[_0x35e5('0x88')](_0x3f6935)[_0x35e5('0x18')](function(){return[0x1];})[_0x35e5('0x18')](respondWithResult(_0x1f9b90,null));};exports[_0x35e5('0x9b')]=function(_0x145099,_0x10e1e5){var _0x6d2de3={'raw':![],'where':{}};var _0x34760={};var _0x27d55b={'count':0x0,'rows':[]};return db['CmContact'][_0x35e5('0x79')]({'where':{'id':_0x145099[_0x35e5('0x28')]['id']}})[_0x35e5('0x18')](handleEntityNotFound(_0x10e1e5,null))['then'](function(_0x50688f){if(_0x50688f){_0x34760[_0x35e5('0x7a')]=_['keys'](db['CmHopper']['rawAttributes']);_0x34760[_0x35e5('0x23')]=_['keys'](_0x145099[_0x35e5('0x23')]);_0x34760[_0x35e5('0x7b')]=_[_0x35e5('0x7c')](_0x34760[_0x35e5('0x7a')],_0x34760[_0x35e5('0x23')]);_0x6d2de3[_0x35e5('0x7d')]=_[_0x35e5('0x7c')](_0x34760[_0x35e5('0x7a')],qs[_0x35e5('0x7e')](_0x145099['query'][_0x35e5('0x7e')]));_0x6d2de3[_0x35e5('0x7d')]=_0x6d2de3[_0x35e5('0x7d')][_0x35e5('0x2e')]?_0x6d2de3[_0x35e5('0x7d')]:_0x34760[_0x35e5('0x7a')];if(!_0x145099[_0x35e5('0x23')][_0x35e5('0x83')](_0x35e5('0x84'))){_0x6d2de3['limit']=qs['limit'](_0x145099[_0x35e5('0x23')][_0x35e5('0x13')]);_0x6d2de3[_0x35e5('0x14')]=qs['offset'](_0x145099[_0x35e5('0x23')][_0x35e5('0x14')]);}_0x6d2de3[_0x35e5('0x9c')]=qs[_0x35e5('0x7f')](_0x145099[_0x35e5('0x23')][_0x35e5('0x7f')]);_0x6d2de3[_0x35e5('0x5e')]=qs['filters'](_[_0x35e5('0x80')](_0x145099[_0x35e5('0x23')],_0x34760[_0x35e5('0x7b')]));_0x6d2de3[_0x35e5('0x5e')][_0x35e5('0x9d')]=_0x50688f['id'];if(_0x145099[_0x35e5('0x23')][_0x35e5('0x81')]){_0x6d2de3['where']=_[_0x35e5('0x37')](_0x6d2de3[_0x35e5('0x5e')],{'$or':_['map'](_0x6d2de3[_0x35e5('0x7d')],function(_0x26efde){var _0x3d1f8d={};_0x3d1f8d[_0x26efde]={'$like':'%'+_0x145099[_0x35e5('0x23')][_0x35e5('0x81')]+'%'};return _0x3d1f8d;})});}_0x6d2de3=_[_0x35e5('0x37')]({},_0x6d2de3,_0x145099[_0x35e5('0x9e')]);return db[_0x35e5('0x3e')]['count']({'where':_0x6d2de3[_0x35e5('0x5e')]})['then'](function(_0x4505e3){_0x27d55b[_0x35e5('0x9f')]=_0x4505e3;if(_0x145099[_0x35e5('0x23')][_0x35e5('0xa0')]){_0x6d2de3[_0x35e5('0xa1')]=[{'all':!![]}];}return db[_0x35e5('0x3e')][_0x35e5('0x22')](_0x6d2de3);})[_0x35e5('0x18')](function(_0xda9942){_0x27d55b[_0x35e5('0xa2')]=_0xda9942;return _0x27d55b;});}})[_0x35e5('0x18')](respondWithFilteredResult(_0x10e1e5,_0x6d2de3))[_0x35e5('0x25')](handleError(_0x10e1e5,null));};exports[_0x35e5('0xa3')]=function(_0x572a75,_0xcacd93){var _0x5add9f={'raw':!![],'where':{}};var _0x1198c={};var _0x34cdb6={'count':0x0,'rows':[]};return db[_0x35e5('0x26')][_0x35e5('0x79')]({'where':{'id':_0x572a75['params']['id']}})[_0x35e5('0x18')](handleEntityNotFound(_0xcacd93,null))[_0x35e5('0x18')](function(_0x59b712){if(_0x59b712){_0x1198c[_0x35e5('0x7a')]=_['keys'](db[_0x35e5('0x4f')][_0x35e5('0xa4')]);_0x1198c[_0x35e5('0x23')]=_[_0x35e5('0x35')](_0x572a75['query']);_0x1198c[_0x35e5('0x7b')]=_[_0x35e5('0x7c')](_0x1198c[_0x35e5('0x7a')],_0x1198c[_0x35e5('0x23')]);_0x5add9f['attributes']=_['intersection'](_0x1198c[_0x35e5('0x7a')],qs[_0x35e5('0x7e')](_0x572a75[_0x35e5('0x23')]['fields']));_0x5add9f[_0x35e5('0x7d')]=_0x5add9f[_0x35e5('0x7d')][_0x35e5('0x2e')]?_0x5add9f[_0x35e5('0x7d')]:_0x1198c[_0x35e5('0x7a')];if(!_0x572a75[_0x35e5('0x23')][_0x35e5('0x83')](_0x35e5('0x84'))){_0x5add9f['limit']=qs[_0x35e5('0x13')](_0x572a75['query'][_0x35e5('0x13')]);_0x5add9f[_0x35e5('0x14')]=qs['offset'](_0x572a75['query'][_0x35e5('0x14')]);}_0x5add9f[_0x35e5('0x9c')]=qs['sort'](_0x572a75[_0x35e5('0x23')][_0x35e5('0x7f')]);_0x5add9f[_0x35e5('0x5e')]=qs[_0x35e5('0x7b')](_[_0x35e5('0x80')](_0x572a75[_0x35e5('0x23')],_0x1198c[_0x35e5('0x7b')]));_0x5add9f[_0x35e5('0x5e')][_0x35e5('0x9d')]=_0x59b712['id'];if(_0x572a75[_0x35e5('0x23')][_0x35e5('0x81')]){_0x5add9f[_0x35e5('0x5e')]=_[_0x35e5('0x37')](_0x5add9f['where'],{'$or':_[_0x35e5('0x82')](_0x5add9f['attributes'],function(_0x1e9182){var _0x5140f3={};_0x5140f3[_0x1e9182]={'$like':'%'+_0x572a75[_0x35e5('0x23')][_0x35e5('0x81')]+'%'};return _0x5140f3;})});}_0x5add9f=_['merge']({},_0x5add9f,_0x572a75[_0x35e5('0x9e')]);return db['CmHopperHistory'][_0x35e5('0x9f')]({'where':_0x5add9f['where']})[_0x35e5('0x18')](function(_0x4a6e7c){_0x34cdb6[_0x35e5('0x9f')]=_0x4a6e7c;if(_0x572a75[_0x35e5('0x23')][_0x35e5('0xa0')]){_0x5add9f[_0x35e5('0xa1')]=[{'all':!![]}];}return db[_0x35e5('0x4f')][_0x35e5('0x22')](_0x5add9f);})[_0x35e5('0x18')](function(_0x210d59){_0x34cdb6['rows']=_0x210d59;return _0x34cdb6;});}})[_0x35e5('0x18')](respondWithFilteredResult(_0xcacd93,_0x5add9f))[_0x35e5('0x25')](handleError(_0xcacd93,null));};exports[_0x35e5('0xa5')]=function(_0x2ab1ac,_0x5ef4b8){var _0x8b8dbc={'raw':!![],'where':{}};var _0x1cd377={};var _0x43aa88={'count':0x0,'rows':[]};return db[_0x35e5('0x26')][_0x35e5('0x79')]({'where':{'id':_0x2ab1ac[_0x35e5('0x28')]['id']}})[_0x35e5('0x18')](handleEntityNotFound(_0x5ef4b8,null))[_0x35e5('0x18')](function(_0x50d19d){if(_0x50d19d){_0x1cd377['model']=_['keys'](db[_0x35e5('0x4e')][_0x35e5('0xa4')]);_0x1cd377[_0x35e5('0x23')]=_[_0x35e5('0x35')](_0x2ab1ac[_0x35e5('0x23')]);_0x1cd377[_0x35e5('0x7b')]=_[_0x35e5('0x7c')](_0x1cd377['model'],_0x1cd377[_0x35e5('0x23')]);_0x8b8dbc['attributes']=_[_0x35e5('0x7c')](_0x1cd377[_0x35e5('0x7a')],qs[_0x35e5('0x7e')](_0x2ab1ac[_0x35e5('0x23')][_0x35e5('0x7e')]));_0x8b8dbc['attributes']=_0x8b8dbc[_0x35e5('0x7d')][_0x35e5('0x2e')]?_0x8b8dbc[_0x35e5('0x7d')]:_0x1cd377[_0x35e5('0x7a')];if(!_0x2ab1ac[_0x35e5('0x23')]['hasOwnProperty'](_0x35e5('0x84'))){_0x8b8dbc[_0x35e5('0x13')]=qs[_0x35e5('0x13')](_0x2ab1ac[_0x35e5('0x23')][_0x35e5('0x13')]);_0x8b8dbc[_0x35e5('0x14')]=qs[_0x35e5('0x14')](_0x2ab1ac[_0x35e5('0x23')][_0x35e5('0x14')]);}_0x8b8dbc[_0x35e5('0x9c')]=qs[_0x35e5('0x7f')](_0x2ab1ac['query'][_0x35e5('0x7f')]);_0x8b8dbc[_0x35e5('0x5e')]=qs['filters'](_[_0x35e5('0x80')](_0x2ab1ac[_0x35e5('0x23')],_0x1cd377[_0x35e5('0x7b')]));_0x8b8dbc[_0x35e5('0x5e')][_0x35e5('0x9d')]=_0x50d19d['id'];if(_0x2ab1ac[_0x35e5('0x23')]['filter']){_0x8b8dbc['where']=_['merge'](_0x8b8dbc[_0x35e5('0x5e')],{'$or':_[_0x35e5('0x82')](_0x8b8dbc[_0x35e5('0x7d')],function(_0x3f61d2){var _0x44846={};_0x44846[_0x3f61d2]={'$like':'%'+_0x2ab1ac[_0x35e5('0x23')][_0x35e5('0x81')]+'%'};return _0x44846;})});}_0x8b8dbc=_[_0x35e5('0x37')]({},_0x8b8dbc,_0x2ab1ac[_0x35e5('0x9e')]);return db[_0x35e5('0x4e')]['count']({'where':_0x8b8dbc[_0x35e5('0x5e')]})[_0x35e5('0x18')](function(_0x200300){_0x43aa88['count']=_0x200300;if(_0x2ab1ac[_0x35e5('0x23')][_0x35e5('0xa0')]){_0x8b8dbc['include']=[{'all':!![]}];}return db[_0x35e5('0x4e')][_0x35e5('0x22')](_0x8b8dbc);})['then'](function(_0x24c4b5){_0x43aa88[_0x35e5('0xa2')]=_0x24c4b5;return _0x43aa88;});}})[_0x35e5('0x18')](respondWithFilteredResult(_0x5ef4b8,_0x8b8dbc))[_0x35e5('0x25')](handleError(_0x5ef4b8,null));};exports[_0x35e5('0xa6')]=function(_0x1945b2,_0x385184){var _0x69a7c9={'raw':!![],'where':{}};var _0x356cdb={};var _0x2066dd={'count':0x0,'rows':[]};return db[_0x35e5('0x26')][_0x35e5('0x79')]({'where':{'id':_0x1945b2[_0x35e5('0x28')]['id']}})[_0x35e5('0x18')](handleEntityNotFound(_0x385184,null))[_0x35e5('0x18')](function(_0x42b895){if(_0x42b895){_0x356cdb['model']=_[_0x35e5('0x35')](db[_0x35e5('0x53')][_0x35e5('0xa4')]);_0x356cdb['query']=_[_0x35e5('0x35')](_0x1945b2[_0x35e5('0x23')]);_0x356cdb[_0x35e5('0x7b')]=_[_0x35e5('0x7c')](_0x356cdb['model'],_0x356cdb['query']);_0x69a7c9[_0x35e5('0x7d')]=_[_0x35e5('0x7c')](_0x356cdb[_0x35e5('0x7a')],qs[_0x35e5('0x7e')](_0x1945b2['query']['fields']));_0x69a7c9['attributes']=_0x69a7c9[_0x35e5('0x7d')][_0x35e5('0x2e')]?_0x69a7c9[_0x35e5('0x7d')]:_0x356cdb[_0x35e5('0x7a')];if(!_0x1945b2['query'][_0x35e5('0x83')](_0x35e5('0x84'))){_0x69a7c9[_0x35e5('0x13')]=qs[_0x35e5('0x13')](_0x1945b2['query'][_0x35e5('0x13')]);_0x69a7c9[_0x35e5('0x14')]=qs['offset'](_0x1945b2[_0x35e5('0x23')][_0x35e5('0x14')]);}_0x69a7c9[_0x35e5('0x9c')]=qs[_0x35e5('0x7f')](_0x1945b2[_0x35e5('0x23')][_0x35e5('0x7f')]);_0x69a7c9['where']=qs[_0x35e5('0x7b')](_[_0x35e5('0x80')](_0x1945b2[_0x35e5('0x23')],_0x356cdb['filters']));_0x69a7c9[_0x35e5('0x5e')][_0x35e5('0x9d')]=_0x42b895['id'];if(_0x1945b2[_0x35e5('0x23')][_0x35e5('0x81')]){_0x69a7c9[_0x35e5('0x5e')]=_[_0x35e5('0x37')](_0x69a7c9['where'],{'$or':_[_0x35e5('0x82')](_0x69a7c9[_0x35e5('0x7d')],function(_0x553872){var _0x204259={};_0x204259[_0x553872]={'$like':'%'+_0x1945b2[_0x35e5('0x23')][_0x35e5('0x81')]+'%'};return _0x204259;})});}_0x69a7c9=_[_0x35e5('0x37')]({},_0x69a7c9,_0x1945b2['options']);return db[_0x35e5('0x53')]['count']({'where':_0x69a7c9['where']})['then'](function(_0x1b8bbf){_0x2066dd[_0x35e5('0x9f')]=_0x1b8bbf;if(_0x1945b2['query'][_0x35e5('0xa0')]){_0x69a7c9[_0x35e5('0xa1')]=[{'all':!![]}];}return db[_0x35e5('0x53')][_0x35e5('0x22')](_0x69a7c9);})['then'](function(_0x307bd1){_0x2066dd['rows']=_0x307bd1;return _0x2066dd;});}})[_0x35e5('0x18')](respondWithFilteredResult(_0x385184,_0x69a7c9))[_0x35e5('0x25')](handleError(_0x385184,null));};exports['uploadCsv']=function(_0x7ba7c7,_0x12bdcb){try{if(!_0x7ba7c7['body']['ListId']){throw new Error(_0x35e5('0xa7'));}if(!_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0xa8')]){throw new Error(_0x35e5('0xa9'));}if(!_0x7ba7c7['body'][_0x35e5('0xaa')]){throw new Error(_0x35e5('0xab'));}if(!_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0xac')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x35a8a3=_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0xa8')]['split'](',');var _0x4f2bdf=_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0xaa')][_0x35e5('0xad')](',');if(!_0x35a8a3[_0x35e5('0x2e')]||!_0x4f2bdf['length']||_0x35a8a3[_0x35e5('0x2e')]!==_0x4f2bdf[_0x35e5('0x2e')]){throw new Error(_0x35e5('0xae'));}_0x7ba7c7[_0x35e5('0x38')]['fields']=_[_0x35e5('0xaf')](_0x35a8a3,_0x4f2bdf);if(!_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0x7e')][_0x35e5('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x7ba7c7['body'][_0x35e5('0x7e')][_0x35e5('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x3aab3b=path[_0x35e5('0x3c')](config[_0x35e5('0xb1')],_0x35e5('0xb2'),_0x7ba7c7[_0x35e5('0xb3')][_0x35e5('0xb4')]);fs[_0x35e5('0xb5')](_0x3aab3b,parseInt('0777',0x8));var _0x221d6d=require(_0x35e5('0xb6'))['fork'](path[_0x35e5('0x3c')](__dirname,_0x35e5('0xb7')),[_0x3aab3b,_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0xa8')],_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0xaa')],_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0x60')],_0x7ba7c7['body']['CompanyId'],_0x7ba7c7[_0x35e5('0x38')]['duplicates'],_0x7ba7c7[_0x35e5('0x38')][_0x35e5('0xac')]]);return _0x12bdcb[_0x35e5('0x15')](0xc8)['json']({'message':_0x35e5('0xb8'),'pid':_0x221d6d[_0x35e5('0xb9')]});}catch(_0x2a190e){return _0x12bdcb[_0x35e5('0x15')](0x1f4)[_0x35e5('0x1e')](_0x2a190e);}};exports[_0x35e5('0xba')]=function(_0x41a587,_0x48fcba){var _0xb23e37=fs[_0x35e5('0xbb')](_0x41a587[_0x35e5('0xb3')][_0x35e5('0x3')]);Papa[_0x35e5('0xbc')](_0xb23e37,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2a94ae){return _0x48fcba[_0x35e5('0x15')](0xc8)[_0x35e5('0x11')]({'file':_0x41a587[_0x35e5('0xb3')],'fields':_0x2a94ae['meta']['fields']});}});};exports['import']=function(_0x64cc5d,_0x814f9d){return db['User'][_0x35e5('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x35e5('0x18')](function(_0x1e981a){var _0x1b180b=![];if(!_0x64cc5d['body'][_0x35e5('0x60')]){throw new Error(_0x35e5('0xa7'));}if(!_0x64cc5d[_0x35e5('0x38')][_0x35e5('0xbd')][_0x35e5('0x77')]){throw new Error(_0x35e5('0xbe'));}if(!_0x64cc5d[_0x35e5('0x38')]['binding'][_0x35e5('0xb0')]){throw new Error(_0x35e5('0xbf'));}if(!_0x64cc5d[_0x35e5('0x38')]['socket_timestamp']){throw new Error(_0x35e5('0xc0'));}var _0x807f7=require(_0x35e5('0xb6'))[_0x35e5('0xc1')](path['join'](__dirname,_0x35e5('0xc2')),[_0x64cc5d['params']['id'],JSON[_0x35e5('0xc3')](_0x64cc5d[_0x35e5('0x38')]),JSON['stringify'](_0x1e981a)]);_0x807f7['on']('message',function(){_0x1b180b=!![];return _0x814f9d[_0x35e5('0x15')](0xc8)[_0x35e5('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x807f7['pid']});});_0x807f7['on']('exit',function(_0x49a02f){if(_0x49a02f&&!_0x1b180b){return _0x814f9d[_0x35e5('0x15')](0x1f4)[_0x35e5('0x11')]({'message':_0x35e5('0xc4'),'pid':_0x807f7[_0x35e5('0xb9')]});}});})[_0x35e5('0x25')](handleError(_0x814f9d,null));};exports[_0x35e5('0xc5')]=function(_0x1f6daa,_0x35e3a9){return db[_0x35e5('0xc6')][_0x35e5('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x35e5('0xc7')}})[_0x35e5('0x18')](function(_0x3ed564){var _0x1f0678=![];if(!_0x1f6daa[_0x35e5('0x38')][_0x35e5('0x60')]){throw new Error(_0x35e5('0xa7'));}if(!_0x1f6daa['body'][_0x35e5('0xbd')][_0x35e5('0x77')]){throw new Error(_0x35e5('0xbe'));}if(!_0x1f6daa[_0x35e5('0x38')][_0x35e5('0xbd')]['firstName']){throw new Error(_0x35e5('0xbf'));}if(!_0x1f6daa[_0x35e5('0x38')][_0x35e5('0xac')]){throw new Error(_0x35e5('0xc0'));}var _0x36b8da=require(_0x35e5('0xb6'))['fork'](path[_0x35e5('0x3c')](__dirname,_0x35e5('0xc8')),[_0x1f6daa[_0x35e5('0x28')]['id'],JSON[_0x35e5('0xc3')](_0x1f6daa[_0x35e5('0x38')]),JSON[_0x35e5('0xc3')](_0x3ed564)]);_0x36b8da['on']('message',function(){_0x1f0678=!![];return _0x35e3a9[_0x35e5('0x15')](0xc8)['json']({'message':_0x35e5('0xc9'),'pid':_0x36b8da[_0x35e5('0xb9')]});});_0x36b8da['on'](_0x35e5('0xca'),function(_0x3bdeb2){if(_0x3bdeb2&&!_0x1f0678){return _0x35e3a9['status'](0x1f4)['json']({'message':_0x35e5('0xc4'),'pid':_0x36b8da[_0x35e5('0xb9')]});}});})['catch'](handleError(_0x35e3a9,null));};exports['getJourney']=function(_0x21bff1,_0x34a105){var _0x183bf2=['mail',_0x35e5('0xcb'),_0x35e5('0xcc'),_0x35e5('0xcd'),_0x35e5('0xce'),_0x35e5('0xcf'),_0x35e5('0xd0')];var _0x2e9847={'offset':0x0,'order':qs[_0x35e5('0x7f')]('-createdAt')},_0x7630={'count':0x0,'rows':[]};Promise['resolve']()[_0x35e5('0x18')](function(){if(_0x21bff1[_0x35e5('0x23')]['channel']){if(!_['includes'](_0x183bf2,_0x21bff1[_0x35e5('0x23')][_0x35e5('0xd1')][_0x35e5('0xd2')]())){throw new Error(_0x35e5('0xd3'));}_0x183bf2=[_0x21bff1[_0x35e5('0x23')][_0x35e5('0xd1')][_0x35e5('0xd2')]()];}if(_0x21bff1[_0x35e5('0x23')]['range']){try{var _0x336743=JSON['parse'](_0x21bff1[_0x35e5('0x23')][_0x35e5('0xd4')]);if(!moment(_0x336743[_0x35e5('0x39')])['isValid']()){throw new Error(_0x35e5('0xd5'));}if(!moment(_0x336743['to'])['isValid']()){throw new Error(_0x35e5('0xd6'));}}catch(_0x5aebef){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x21bff1[_0x35e5('0x23')][_0x35e5('0x83')](_0x35e5('0x84'))){_0x2e9847[_0x35e5('0x13')]=qs[_0x35e5('0x13')](_0x21bff1[_0x35e5('0x23')]['limit']||0xa);_0x2e9847['offset']=qs['offset'](_0x21bff1['query'][_0x35e5('0x14')]);}var _0x1660b0=_0x183bf2[_0x35e5('0x82')](function(_0x422a9d){if(_0x422a9d==='voice'){var _0x4dc47c={'attributes':['id',_0x35e5('0xd7'),_0x35e5('0x31'),'source',_0x35e5('0xd8'),_0x35e5('0xd9'),_0x35e5('0xda'),_0x35e5('0xdb'),_0x35e5('0xdc'),'note',_0x35e5('0xdd'),_0x35e5('0xde'),_0x35e5('0xdf'),'userThirdDisposition',_0x35e5('0xe0')],'where':{'ContactId':_0x21bff1[_0x35e5('0x28')]['id']},'include':[{'model':db[_0x35e5('0xc6')],'as':'User','attributes':['id',_0x35e5('0x1d'),'fullname',_0x35e5('0x30')]}],'order':[['createdAt',_0x35e5('0xe1')]]};if(_0x21bff1[_0x35e5('0x23')][_0x35e5('0xd4')]){_0x4dc47c[_0x35e5('0x5e')][_0x35e5('0xdd')]={'$gte':_0x336743[_0x35e5('0x39')],'$lte':_0x336743['to']};}return db[_0x35e5('0xe2')]['findAndCountAll'](_0x4dc47c)[_0x35e5('0x18')](function(_0x154e54){_0x7630[_0x35e5('0x9f')]+=_0x154e54[_0x35e5('0x9f')];return _[_0x35e5('0x82')](_0x154e54[_0x35e5('0xa2')],function(_0xbed055){var _0x105c59=_0xbed055['get']({'plain':!![]});_0x105c59[_0x35e5('0xd1')]=_0x422a9d;if(_0x105c59[_0x35e5('0xc6')]){_0x105c59[_0x35e5('0xc6')]={'id':_0x105c59[_0x35e5('0xc6')]['id'],'name':_0x105c59[_0x35e5('0xc6')][_0x35e5('0x1d')],'fullname':_0x105c59[_0x35e5('0xc6')][_0x35e5('0xe3')],'alias':_0x105c59['User'][_0x35e5('0x30')]};}return _0x105c59;});});}else{var _0x2ea3ef=_[_0x35e5('0xe4')](_0x422a9d)+(_0x422a9d==='chat'?_0x35e5('0xe5'):_0x35e5('0xe6'));var _0xc712cb={'attributes':['id',_0x35e5('0xe7'),_0x35e5('0xe8'),_0x35e5('0xdd'),_0x35e5('0xe9'),'disposition',_0x35e5('0xea'),_0x35e5('0xeb'),'UserId',_0x2ea3ef+'Id'],'where':{'ContactId':_0x21bff1[_0x35e5('0x28')]['id']},'include':[{'model':db[_0x2ea3ef],'as':_0x35e5('0xe6'),'attributes':['id','name','key']},{'model':db[_0x35e5('0xc6')],'as':_0x35e5('0xec'),'attributes':['id',_0x35e5('0x1d'),'fullname']},{'model':db[_0x35e5('0x65')],'as':_0x35e5('0x66'),'attributes':['id',_0x35e5('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0x35e5('0xdd'),_0x35e5('0xe1')]]};if(_0x21bff1[_0x35e5('0x23')][_0x35e5('0xd4')]){_0xc712cb[_0x35e5('0x5e')][_0x35e5('0xdd')]={'$gte':_0x336743[_0x35e5('0x39')],'$lte':_0x336743['to']};}switch(_0x422a9d){case'chat':_0xc712cb[_0x35e5('0x7d')]['push'](_0x35e5('0xed'),_0x35e5('0xee'),_0x35e5('0xef'),_0x35e5('0xf0'),'osName',_0x35e5('0xf1'),'ratingType','ratingValue',_0x35e5('0xf2'));break;case _0x35e5('0xf3'):_0xc712cb['attributes'][_0x35e5('0x5f')](_0x35e5('0xf4'),_0x35e5('0xf5'));break;case _0x35e5('0xcd'):_0xc712cb[_0x35e5('0x7d')][_0x35e5('0x5f')](_0x35e5('0xf6'),_0x35e5('0xf7'));break;}return db[_[_0x35e5('0xe4')](_0x422a9d)+_0x35e5('0xf8')][_0x35e5('0xf9')](_0xc712cb)[_0x35e5('0x18')](function(_0x8f0cf2){_0x7630[_0x35e5('0x9f')]+=_0x8f0cf2[_0x35e5('0x9f')];return _[_0x35e5('0x82')](_0x8f0cf2[_0x35e5('0xa2')],function(_0x5e5c1b){var _0x695e36=_0x5e5c1b['get']({'plain':!![]});_0x695e36[_0x35e5('0xd1')]=_0x422a9d;if(_0x695e36[_0x35e5('0xec')]){_0x695e36[_0x35e5('0xec')]={'id':_0x695e36[_0x35e5('0xec')]['id'],'name':_0x695e36[_0x35e5('0xec')][_0x35e5('0x1d')],'fullname':_0x695e36[_0x35e5('0xec')][_0x35e5('0xe3')]};}return _0x695e36;});});}});return Promise[_0x35e5('0x88')](_0x1660b0);})['then'](function(_0x226fc7){return _(_0x226fc7)[_0x35e5('0xfa')]()[_0x35e5('0xfb')](_0x35e5('0xdd'))[_0x35e5('0xfc')]()[_0x35e5('0xfd')]();})[_0x35e5('0x18')](function(_0x45600e){_0x7630[_0x35e5('0xa2')]=_0x2e9847['limit']?_0x45600e[_0x35e5('0xfe')](_0x2e9847[_0x35e5('0x14')],_0x2e9847['offset']+_0x2e9847['limit']):_0x45600e;return _0x7630;})['then'](respondWithFilteredResult(_0x34a105,_0x2e9847))['catch'](handleError(_0x34a105,null));}; \ No newline at end of file +var _0x658c=['range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','destination','callerid','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','startCase','Website','closed','closedAt','secondDisposition','key','Owner','DESC','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','threadId','findAndCountAll','flatten','sortBy','reverse','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','register','status','offset','limit','undefined','count','set','then','destroy','end','sendStatus','error','name','send','describe','getOptions','query','catch','CmContact','find','keys','startsWith','cf_','displayName','CmCustomField','findAll','length','columnName','alias','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','update','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','show','Tag','Tags','tag','Phones','params','ContactItemType','ItemType','sequelize','literal','$and','omit','map','format','cf_%d','pickBy','isEmpty','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','CmHopper','findOne','model','filters','intersection','attributes','fields','order','sort','pick','filter','getTags','setTags','ids','setAdditionalPhones','item_types','items','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','rawAttributes','nolimit','ContactId','options','include','rows','getHopperHistories','getHopperFinals','includeAll','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','CompanyId','json','File\x20uploaded\x20correctly!','upload','createReadStream','file','import','User','agent','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','No\x20phone\x20column\x20specified','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0x658c,0x129));var _0xc658=function(_0x450210,_0x4cbf0f){_0x450210=_0x450210-0x0;var _0x541e23=_0x658c[_0x450210];return _0x541e23;};'use strict';var moment=require(_0xc658('0x0'));var BPromise=require(_0xc658('0x1'));var util=require(_0xc658('0x2'));var path=require(_0xc658('0x3'));var fs=require('fs');var _=require(_0xc658('0x4'));var squel=require(_0xc658('0x5'));var Papa=require(_0xc658('0x6'));var Redis=require(_0xc658('0x7'));var contacts=require(_0xc658('0x8'));var qs=require(_0xc658('0x9'));var logger=require(_0xc658('0xa'))(_0xc658('0xb'));var config=require(_0xc658('0xc'));var shared=require(_0xc658('0xd'));var db=require(_0xc658('0xe'))['db'];config[_0xc658('0xf')]=_[_0xc658('0x10')](config[_0xc658('0xf')],{'host':_0xc658('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc658('0xf')]));require('./cmContact.socket')[_0xc658('0x12')](socket);function respondWithResult(_0x184e10,_0x3b96fd){_0x3b96fd=_0x3b96fd||0xc8;return function(_0x4063ce){if(_0x4063ce){return _0x184e10[_0xc658('0x13')](_0x3b96fd)['json'](_0x4063ce);}};}function respondWithFilteredResult(_0x51087c,_0x1473f0){return function(_0x54b749){if(_0x54b749){var _0x1eb565=typeof _0x1473f0[_0xc658('0x14')]==='undefined'&&typeof _0x1473f0[_0xc658('0x15')]===_0xc658('0x16');var _0x44e447=_0x54b749[_0xc658('0x17')];var _0x5924fb=_0x1eb565?0x0:_0x1473f0[_0xc658('0x14')];var _0x5b90db=_0x1eb565?_0x54b749[_0xc658('0x17')]:_0x1473f0[_0xc658('0x14')]+_0x1473f0['limit'];var _0xb6f390;if(_0x5b90db>=_0x44e447){_0x5b90db=_0x44e447;_0xb6f390=0xc8;}else{_0xb6f390=0xce;}_0x51087c[_0xc658('0x13')](_0xb6f390);return _0x51087c[_0xc658('0x18')]('Content-Range',_0x5924fb+'-'+_0x5b90db+'/'+_0x44e447)['json'](_0x54b749);}return null;};}function saveUpdates(_0xa0ad5){return function(_0x4a8d06){if(_0x4a8d06){return _0x4a8d06['update'](_0xa0ad5)[_0xc658('0x19')](function(_0x1c3d2f){return _0x1c3d2f;});}return null;};}function removeEntity(_0x3f6159){return function(_0x58ccfd){if(_0x58ccfd){return _0x58ccfd[_0xc658('0x1a')]()[_0xc658('0x19')](function(){_0x3f6159['status'](0xcc)[_0xc658('0x1b')]();});}};}function handleEntityNotFound(_0x1d40d5){return function(_0x1f76d6){if(!_0x1f76d6){_0x1d40d5[_0xc658('0x1c')](0x194);}return _0x1f76d6;};}function handleError(_0x5a476c,_0x4cd9b8){_0x4cd9b8=_0x4cd9b8||0x1f4;return function(_0x31d8f9){logger[_0xc658('0x1d')](_0x31d8f9['stack']);if(_0x31d8f9[_0xc658('0x1e')]){delete _0x31d8f9[_0xc658('0x1e')];}_0x5a476c[_0xc658('0x13')](_0x4cd9b8)[_0xc658('0x1f')](_0x31d8f9);};}exports['index']=function(_0x59e8d0,_0x342c1f){var _0x4b550b={};return contacts[_0xc658('0x20')]()[_0xc658('0x19')](function(_0x10e920){_0x4b550b=qs[_0xc658('0x21')](_0x10e920,_0x59e8d0);return contacts['findAll'](_0x59e8d0[_0xc658('0x22')],_0x59e8d0['user'],_0x4b550b,_0x10e920);})[_0xc658('0x19')](respondWithFilteredResult(_0x342c1f,_0x4b550b))[_0xc658('0x23')](handleError(_0x342c1f,null));};exports['destroy']=function(_0x58acfd,_0x1c9388){return db[_0xc658('0x24')][_0xc658('0x25')]({'where':{'id':_0x58acfd['params']['id']}})[_0xc658('0x19')](handleEntityNotFound(_0x1c9388,null))['then'](removeEntity(_0x1c9388,null))[_0xc658('0x23')](handleError(_0x1c9388,null));};exports['describe']=function(_0x4705d4,_0x3e3e6b){return db[_0xc658('0x24')][_0xc658('0x20')]()[_0xc658('0x19')](function(_0x3338ae){delete _0x3338ae['tags'];for(var _0x4336e8=0x0;_0x4336e80x0){return new Promise(function(_0x2ff357){var _0x4437b6=[];for(var _0x462431=0x0;_0x462431<_0x864d1b[_0xc658('0x2c')];_0x462431++){_0x4437b6['push'](insertAdditionalPhones(_0x864d1b[_0x462431][_0xc658('0x63')],_0x864d1b[_0x462431][_0xc658('0x59')]));}Promise[_0xc658('0x64')](_0x4437b6)[_0xc658('0x19')](function(){_0x2ff357(0x1);});})[_0xc658('0x19')](function(){return{'success':_0x1620e9,'failure':_0x113e85,'duplicates':_0x67005c};});}else{return{'success':_0x1620e9,'failure':_0x113e85,'duplicates':_0x67005c};}}})[_0xc658('0x19')](respondWithResult(_0x2ce4d8,0xc9))['catch'](handleError(_0x2ce4d8,null));};exports[_0xc658('0x65')]=function(_0xb6515b,_0x5ea209){var _0x4d3d1b;return db[_0xc658('0x24')][_0xc658('0x20')]()[_0xc658('0x19')](function(_0x16df90){return db[_0xc658('0x24')][_0xc658('0x25')]({'where':{'id':_0xb6515b['params']['id']},'include':[{'model':db[_0xc658('0x66')],'as':_0xc658('0x67'),'attributes':['id',_0xc658('0x1e'),'color'],'required':_0xb6515b[_0xc658('0x22')][_0xc658('0x68')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xc658('0x69'),'where':{'CmContactId':_0xb6515b[_0xc658('0x6a')]['id']},'required':![],'include':[{'model':db[_0xc658('0x6b')],'as':_0xc658('0x6c')}]}],'order':[db[_0xc658('0x6d')][_0xc658('0x6e')]('Phones.OrderBy')],'attributes':_[_0xc658('0x26')](_0x16df90)});})[_0xc658('0x19')](function(_0x3bb306){if(!_[_0xc658('0x55')](_0x3bb306)){_0x4d3d1b=_0x3bb306['get']({'plain':!![]});var _0xa206ab={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3bb306&&_0x3bb306[_0xc658('0x60')]){if(_0x3bb306[_0xc658('0x60')]){_0xa206ab[_0xc658('0x5d')][_0xc658('0x6f')][_0xc658('0x5f')]({'ListId':{'$ne':_0x3bb306[_0xc658('0x60')]}});}}return db[_0xc658('0x2a')][_0xc658('0x2b')](_0xa206ab);}})['then'](function(_0x201887){if(!_['isNil'](_0x201887)){return _[_0xc658('0x70')](_0x4d3d1b,_[_0xc658('0x71')](_0x201887,function(_0x4ef2b0){return util[_0xc658('0x72')](_0xc658('0x73'),_0x4ef2b0['id']);}));}})[_0xc658('0x19')](handleEntityNotFound(_0x5ea209,null))[_0xc658('0x19')](respondWithResult(_0x5ea209,null))[_0xc658('0x23')](handleError(_0x5ea209,null));};exports[_0xc658('0x41')]=function(_0x2b512e,_0x25e69d){var _0x3bcee9;if(_0x2b512e['body']['id']){delete _0x2b512e['body']['id'];}if(!_[_0xc658('0x55')](_0x2b512e[_0xc658('0x35')]['dialTimezone'])){var _0x17ccc8=_0x2b512e[_0xc658('0x35')][_0xc658('0x56')];if(!_[_0xc658('0x55')](shared[_0xc658('0x57')][_0x17ccc8]))_0x2b512e[_0xc658('0x35')]['utcOffset']=shared[_0xc658('0x57')][_0x17ccc8]['utcOffset'];}return db[_0xc658('0x24')][_0xc658('0x25')]({'where':{'id':_0x2b512e['params']['id']}})[_0xc658('0x19')](handleEntityNotFound(_0x25e69d,null))[_0xc658('0x19')](saveUpdates(_0x2b512e[_0xc658('0x35')],null))[_0xc658('0x19')](function(_0x38c193){_0x3bcee9=_0x38c193;var _0x2456d2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x38c193&&_0x38c193[_0xc658('0x60')]){if(_0x38c193[_0xc658('0x60')]){_0x2456d2[_0xc658('0x5d')][_0xc658('0x6f')][_0xc658('0x5f')]({'ListId':{'$ne':_0x38c193['ListId']}});}}return db['CmCustomField'][_0xc658('0x2b')](_0x2456d2);})[_0xc658('0x19')](function(_0x985631){if(_0x985631){return _[_0xc658('0x70')](_[_0xc658('0x74')](_0x2b512e[_0xc658('0x35')],function(_0x317cf5,_0x1fe96e){return _['startsWith'](_0x1fe96e,_0xc658('0x28'));}),_[_0xc658('0x71')](_0x985631,function(_0x5e46c8){return util['format'](_0xc658('0x73'),_0x5e46c8['id']);}));}})[_0xc658('0x19')](function(_0x40fdca){if(_0x40fdca&&!_[_0xc658('0x75')](_0x40fdca)){var _0x55823a=squel[_0xc658('0x41')]()['table'](_0xc658('0x76'))[_0xc658('0x77')](_0x40fdca)['where'](_0xc658('0x78'),_0x2b512e[_0xc658('0x6a')]['id'])[_0xc658('0x79')]();return db[_0xc658('0x6d')][_0xc658('0x22')](_0x55823a[_0xc658('0x7a')],{'replacements':_0x55823a[_0xc658('0x2f')]});}})['then'](function(){if(_0x2b512e[_0xc658('0x35')][_0xc658('0x7b')]&&_0x3bcee9){return db[_0xc658('0x7c')][_0xc658('0x41')]({'phone':_0x2b512e[_0xc658('0x35')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x3bcee9['id']}});}})[_0xc658('0x19')](function(){return _0x3bcee9;})[_0xc658('0x19')](respondWithResult(_0x25e69d,null))[_0xc658('0x23')](handleError(_0x25e69d,null));};exports['getTags']=function(_0x54600e,_0x2bf52a){var _0x22ec15={};var _0xc33d5b={};var _0x18ed22;var _0x3972ed;return db[_0xc658('0x24')][_0xc658('0x7d')]({'where':{'id':_0x54600e[_0xc658('0x6a')]['id']}})['then'](handleEntityNotFound(_0x2bf52a,null))[_0xc658('0x19')](function(_0x47ec95){if(_0x47ec95){_0x18ed22=_0x47ec95;_0xc33d5b[_0xc658('0x7e')]=_[_0xc658('0x26')](db[_0xc658('0x66')]['rawAttributes']);_0xc33d5b[_0xc658('0x22')]=_[_0xc658('0x26')](_0x54600e[_0xc658('0x22')]);_0xc33d5b[_0xc658('0x7f')]=_[_0xc658('0x80')](_0xc33d5b[_0xc658('0x7e')],_0xc33d5b[_0xc658('0x22')]);_0x22ec15[_0xc658('0x81')]=_['intersection'](_0xc33d5b['model'],qs['fields'](_0x54600e[_0xc658('0x22')][_0xc658('0x82')]));_0x22ec15[_0xc658('0x81')]=_0x22ec15[_0xc658('0x81')]['length']?_0x22ec15[_0xc658('0x81')]:_0xc33d5b[_0xc658('0x7e')];_0x22ec15[_0xc658('0x83')]=qs[_0xc658('0x84')](_0x54600e[_0xc658('0x22')][_0xc658('0x84')]);_0x22ec15['where']=qs[_0xc658('0x7f')](_[_0xc658('0x85')](_0x54600e[_0xc658('0x22')],_0xc33d5b['filters']));if(_0x54600e[_0xc658('0x22')][_0xc658('0x86')]){_0x22ec15[_0xc658('0x5d')]=_['merge'](_0x22ec15['where'],{'$or':_['map'](_0x22ec15[_0xc658('0x81')],function(_0x526f85){var _0x233e4c={};_0x233e4c[_0x526f85]={'$like':'%'+_0x54600e['query'][_0xc658('0x86')]+'%'};return _0x233e4c;})});}_0x22ec15=_['merge']({},_0x22ec15,_0x54600e['options']);return _0x18ed22[_0xc658('0x87')](_0x22ec15);}})[_0xc658('0x19')](function(_0x4abe28){if(_0x4abe28){_0x3972ed=_0x4abe28[_0xc658('0x2c')];if(!_0x54600e[_0xc658('0x22')][_0xc658('0x33')]('nolimit')){_0x22ec15['limit']=qs[_0xc658('0x15')](_0x54600e[_0xc658('0x22')]['limit']);_0x22ec15['offset']=qs[_0xc658('0x14')](_0x54600e[_0xc658('0x22')][_0xc658('0x14')]);}return _0x18ed22[_0xc658('0x87')](_0x22ec15);}})[_0xc658('0x19')](function(_0x2114d1){if(_0x2114d1){return _0x2114d1?{'count':_0x3972ed,'rows':_0x2114d1}:null;}})[_0xc658('0x19')](respondWithResult(_0x2bf52a,null))[_0xc658('0x23')](handleError(_0x2bf52a,null));};exports[_0xc658('0x88')]=function(_0x1e777c,_0x13d7b0){if(_0x1e777c['body']['id']){delete _0x1e777c[_0xc658('0x35')]['id'];}return db[_0xc658('0x24')]['findOne']({'where':{'id':_0x1e777c['params']['id']}})[_0xc658('0x19')](handleEntityNotFound(_0x13d7b0,null))[_0xc658('0x19')](function(_0x2eef1a){if(_0x2eef1a){return _0x2eef1a[_0xc658('0x88')](_0x1e777c[_0xc658('0x35')][_0xc658('0x89')]||[]);}return null;})[_0xc658('0x19')](respondWithResult(_0x13d7b0,null))[_0xc658('0x23')](handleError(_0x13d7b0,null));};exports[_0xc658('0x8a')]=function(_0x27419d,_0x5a11ed){var _0x4a2b36=[];_0x4a2b36[_0xc658('0x5f')](addAdditionalPhones(_0x27419d[_0xc658('0x35')]));Promise[_0xc658('0x64')](_0x4a2b36)[_0xc658('0x19')](function(){_0x4a2b36=[];_0x4a2b36[_0xc658('0x5f')](deleteCmHopperPhones(_0x27419d[_0xc658('0x35')]['id']));_0x4a2b36[_0xc658('0x5f')](addCmHopperPhones(_0x27419d['body']['id']));Promise[_0xc658('0x64')](_0x4a2b36)[_0xc658('0x19')](function(){return[0x1];})[_0xc658('0x19')](respondWithResult(_0x5a11ed,null));});};function addAdditionalPhones(_0x4dd25c){var _0x409bb1;return new Promise(function(_0x213720){return db[_0xc658('0x4a')][_0xc658('0x1a')]({'where':{'CmContactId':_0x4dd25c['id']}})['then'](function(){db['ContactItemType'][_0xc658('0x2b')]({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x20d53b){var _0x3b4fb6=[];for(var _0x40463d=0x0;_0x40463d<_0x4dd25c['items'][_0xc658('0x2c')];_0x40463d++){var _0x248c5e=_0x4dd25c[_0xc658('0x8b')]?_[_0xc658('0x55')](_0x4dd25c[_0xc658('0x8b')][_0x40463d])?'':_0x4dd25c[_0xc658('0x8b')][_0x40463d]:_0x4dd25c[_0xc658('0x8c')][_0x40463d][_0xc658('0x8d')]?_0x4dd25c[_0xc658('0x8c')][_0x40463d][_0xc658('0x8d')]:'';var _0x3cf8f0=_[_0xc658('0x55')](_0x4dd25c[_0xc658('0x8c')][_0x40463d][_0xc658('0x8e')])?'':_0x4dd25c[_0xc658('0x8c')][_0x40463d]['description'];var _0xe1e67=_0x248c5e+':'+_0x4dd25c['items'][_0x40463d]['phone']+'§'+_0x3cf8f0;if(_[_0xc658('0x55')](_0x409bb1))_0x409bb1=_0xe1e67;else _0x409bb1+=';'+_0xe1e67;var _0x48d563=null;var _0xa28cc=null;if(_0x4dd25c[_0xc658('0x8b')]){if(!_[_0xc658('0x55')](_0x4dd25c['item_types'][_0x40463d])){_0xa28cc=_[_0xc658('0x25')](_0x20d53b,function(_0x35092a){return _0x35092a['id']===_0x4dd25c[_0xc658('0x8b')][_0x40463d];});if(!_['isNil'](_0xa28cc)){_0x48d563=_0xa28cc[_0xc658('0x8f')];}}}else{if(!_['isNil'](_0x4dd25c[_0xc658('0x8c')][_0x40463d])){_0xa28cc=_['find'](_0x20d53b,function(_0x162030){return _0x162030['id']===_0x4dd25c['items'][_0x40463d][_0xc658('0x8d')];});if(!_['isNil'](_0xa28cc)){_0x48d563=_0x40463d;}}}if(_[_0xc658('0x55')](_0x48d563)){_0x48d563=0x64;}_0x3b4fb6['push'](addAdditionalPhone(_0x4dd25c['id'],_0x4dd25c[_0xc658('0x8c')][_0x40463d][_0xc658('0x7b')],_0x4dd25c['item_types']?_[_0xc658('0x55')](_0x4dd25c['item_types'][_0x40463d])?null:_0x4dd25c['item_types'][_0x40463d]:_0x4dd25c[_0xc658('0x8c')][_0x40463d][_0xc658('0x8d')]?_0x4dd25c[_0xc658('0x8c')][_0x40463d]['ItemTypeId']:null,_0x48d563,_0x3cf8f0));}Promise['all'](_0x3b4fb6)[_0xc658('0x19')](function(){db[_0xc658('0x24')][_0xc658('0x41')]({'AdditionalPhones':_0x409bb1},{'where':{'id':_0x4dd25c['id']}})['then'](function(){_0x213720(0x1);});});});});});}function addAdditionalPhone(_0x1189d1,_0x580b27,_0x3b91fd,_0x2b86ff,_0x1cf880){return db[_0xc658('0x4a')][_0xc658('0x25')]({'where':{'CmContactId':_0x1189d1,'item':_0x580b27}})[_0xc658('0x19')](function(_0x430ab7){if(_0x430ab7)logger['info'](_0xc658('0x90'),_0x430ab7);else{db[_0xc658('0x4a')][_0xc658('0x3f')]({'CmContactId':_0x1189d1,'item':_0x580b27,'ItemTypeId':_0x3b91fd,'OrderBy':_0x2b86ff,'ItemClass':_0xc658('0x91'),'description':_0x1cf880});}});}function deleteCmHopperPhones(_0x1c3323){return new Promise(function(_0x557c28){return db['CmHopper'][_0xc658('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1c3323}})[_0xc658('0x19')](function(_0x3a39c1){db[_0xc658('0x92')][_0xc658('0x1a')]({'where':{'CmHopperId':{'$in':_['map'](_0x3a39c1,'id')}}});})[_0xc658('0x19')](function(){_0x557c28(0x1);});});}function addCmHopperPhones(_0x528d43){return new Promise(function(_0x52ccac){return db[_0xc658('0x7c')][_0xc658('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x528d43}})[_0xc658('0x19')](function(_0x49b761){var _0x473ae6=[];_[_0xc658('0x71')](_0x49b761,function(_0x1d5619){_0x473ae6['push'](createCmHopperPhone(_0x528d43,_0x1d5619['id']));});Promise[_0xc658('0x64')](_0x473ae6)[_0xc658('0x19')](function(){_0x52ccac(0x1);});});});}function createCmHopperPhone(_0x5e0469,_0xe567dc){return new Promise(function(_0x22f96d){db[_0xc658('0x4a')][_0xc658('0x2b')]({'raw':!![],'attributes':[_0xc658('0x93'),_0xc658('0x8f')],'where':{'CmContactId':_0x5e0469,'ItemClass':_0xc658('0x91')},'include':[{'model':db['ContactItemType'],'attributes':[_0xc658('0x8f')],'as':_0xc658('0x6c')}],'order':[_0xc658('0x8f'),db['sequelize'][_0xc658('0x6e')](_0xc658('0x94'))]})[_0xc658('0x19')](function(_0x13bc68){var _0x5b15c0=0x1;var _0x33bb5f=_[_0xc658('0x71')](_0x13bc68,function(_0x36d7e7){_0x36d7e7[_0xc658('0x95')]=_0xe567dc;_0x36d7e7[_0xc658('0x7b')]=_0x36d7e7[_0xc658('0x93')];_0x36d7e7['OrderBy']=_0x5b15c0;delete _0x36d7e7[_0xc658('0x96')];_0x5b15c0=_0x5b15c0+0x1;return _0x36d7e7;});return db['CmHopperAdditionalPhone'][_0xc658('0x5a')](_0x33bb5f,{});})[_0xc658('0x19')](function(){_0x22f96d(0x1);});});}function insertAdditionalPhones(_0x2d77e6,_0x976d29){return new Promise(function(_0x1dc2dd){var _0x3ba293=[];for(var _0x11c065=0x0;_0x11c065<_0x976d29['length'];_0x11c065++){var _0x2578da=_0x976d29[_0x11c065];_0x3ba293[_0xc658('0x5f')](parseContactItemType(_0x2578da));}Promise[_0xc658('0x64')](_0x3ba293)[_0xc658('0x19')](function(){var _0x7e4eb={'id':_0x2d77e6['id'],'items':_0x976d29};return addAdditionalPhones(_0x7e4eb)[_0xc658('0x19')](function(){return addCmHopperPhones(_0x2d77e6['id']);});})[_0xc658('0x19')](function(){_0x1dc2dd(_0x2d77e6);});});}function parseContactItemType(_0x266e24){return new Promise(function(_0xf76ffe){if(_0x266e24['hasOwnProperty'](_0xc658('0x8d'))){_0xf76ffe(_0x266e24);}else{return db['ContactItemType'][_0xc658('0x25')]({'where':{'name':_0x266e24[_0xc658('0x6c')]}})[_0xc658('0x19')](function(_0x29a231){if(_['isNil'](_0x29a231))_0x266e24[_0xc658('0x8d')]=null;else _0x266e24[_0xc658('0x8d')]=_0x29a231['id'];_0xf76ffe(_0x266e24);});}});}exports[_0xc658('0x97')]=function(_0x4c1607,_0xb7289f){return db[_0xc658('0x4a')][_0xc658('0x2b')]({'raw':!![],'where':{'CmContactId':_0x4c1607['params']['id'],'ItemClass':_0xc658('0x91')},'include':[{'model':db[_0xc658('0x6b')],'as':'ItemType'}],'order':[[_0xc658('0x8f')],[db[_0xc658('0x6d')][_0xc658('0x6e')](_0xc658('0x94'))]]})[_0xc658('0x19')](function(_0x8431ed){return _0x8431ed;})[_0xc658('0x19')](respondWithResult(_0xb7289f,null))['catch'](handleError(_0xb7289f,null));};exports[_0xc658('0x98')]=function(_0x1c2e0d,_0x3ed4c3){return db[_0xc658('0x4a')][_0xc658('0x2b')]({'raw':!![],'where':{'CmContactId':_0x1c2e0d['body'][_0xc658('0x99')]}})['then'](function(_0x3750f9){var _0x31bc3d=_[_0xc658('0x71')](_0x3750f9,function(_0x472133){_0x472133[_0xc658('0x9a')]=_0x1c2e0d[_0xc658('0x35')][_0xc658('0x9b')];return _0x472133;});return db[_0xc658('0x4a')][_0xc658('0x5a')](_0x31bc3d,{});})[_0xc658('0x19')](function(){return addCmHopperPhones(_0x1c2e0d[_0xc658('0x35')][_0xc658('0x9b')]);})[_0xc658('0x19')](function(){return['ok'];})[_0xc658('0x19')](respondWithResult(_0x3ed4c3,null))[_0xc658('0x23')](handleError(_0x3ed4c3,null));};exports[_0xc658('0x9c')]=function(_0x2c82a0,_0x50eef1){var _0x4a42fb=[];_0x4a42fb[_0xc658('0x5f')](createCmHopperPhone(_0x2c82a0['body']['id'],_0x2c82a0[_0xc658('0x35')][_0xc658('0x9d')]));Promise[_0xc658('0x64')](_0x4a42fb)['then'](function(){return[0x1];})['then'](respondWithResult(_0x50eef1,null));};exports['getHoppers']=function(_0x52b824,_0x4e1636){var _0x6d609d={'raw':![],'where':{}};var _0x5335c7={};var _0x2d2dc4={'count':0x0,'rows':[]};return db[_0xc658('0x24')][_0xc658('0x7d')]({'where':{'id':_0x52b824['params']['id']}})[_0xc658('0x19')](handleEntityNotFound(_0x4e1636,null))[_0xc658('0x19')](function(_0x956c45){if(_0x956c45){_0x5335c7[_0xc658('0x7e')]=_[_0xc658('0x26')](db[_0xc658('0x7c')][_0xc658('0x9e')]);_0x5335c7[_0xc658('0x22')]=_['keys'](_0x52b824['query']);_0x5335c7[_0xc658('0x7f')]=_[_0xc658('0x80')](_0x5335c7[_0xc658('0x7e')],_0x5335c7[_0xc658('0x22')]);_0x6d609d['attributes']=_[_0xc658('0x80')](_0x5335c7[_0xc658('0x7e')],qs[_0xc658('0x82')](_0x52b824[_0xc658('0x22')][_0xc658('0x82')]));_0x6d609d[_0xc658('0x81')]=_0x6d609d[_0xc658('0x81')][_0xc658('0x2c')]?_0x6d609d['attributes']:_0x5335c7[_0xc658('0x7e')];if(!_0x52b824[_0xc658('0x22')][_0xc658('0x33')](_0xc658('0x9f'))){_0x6d609d['limit']=qs[_0xc658('0x15')](_0x52b824[_0xc658('0x22')][_0xc658('0x15')]);_0x6d609d[_0xc658('0x14')]=qs[_0xc658('0x14')](_0x52b824[_0xc658('0x22')][_0xc658('0x14')]);}_0x6d609d['order']=qs['sort'](_0x52b824[_0xc658('0x22')][_0xc658('0x84')]);_0x6d609d[_0xc658('0x5d')]=qs[_0xc658('0x7f')](_[_0xc658('0x85')](_0x52b824['query'],_0x5335c7[_0xc658('0x7f')]));_0x6d609d[_0xc658('0x5d')][_0xc658('0xa0')]=_0x956c45['id'];if(_0x52b824[_0xc658('0x22')][_0xc658('0x86')]){_0x6d609d['where']=_[_0xc658('0x34')](_0x6d609d[_0xc658('0x5d')],{'$or':_[_0xc658('0x71')](_0x6d609d['attributes'],function(_0x30c893){var _0xc00194={};_0xc00194[_0x30c893]={'$like':'%'+_0x52b824[_0xc658('0x22')][_0xc658('0x86')]+'%'};return _0xc00194;})});}_0x6d609d=_[_0xc658('0x34')]({},_0x6d609d,_0x52b824[_0xc658('0xa1')]);return db[_0xc658('0x7c')][_0xc658('0x17')]({'where':_0x6d609d['where']})['then'](function(_0x2e5074){_0x2d2dc4[_0xc658('0x17')]=_0x2e5074;if(_0x52b824['query']['includeAll']){_0x6d609d[_0xc658('0xa2')]=[{'all':!![]}];}return db[_0xc658('0x7c')][_0xc658('0x2b')](_0x6d609d);})['then'](function(_0x165d03){_0x2d2dc4[_0xc658('0xa3')]=_0x165d03;return _0x2d2dc4;});}})[_0xc658('0x19')](respondWithFilteredResult(_0x4e1636,_0x6d609d))[_0xc658('0x23')](handleError(_0x4e1636,null));};exports[_0xc658('0xa4')]=function(_0x18917c,_0x3e4e9f){var _0x1988b7={'raw':!![],'where':{}};var _0x3a4c08={};var _0x178737={'count':0x0,'rows':[]};return db['CmContact'][_0xc658('0x7d')]({'where':{'id':_0x18917c[_0xc658('0x6a')]['id']}})[_0xc658('0x19')](handleEntityNotFound(_0x3e4e9f,null))[_0xc658('0x19')](function(_0x276d40){if(_0x276d40){_0x3a4c08[_0xc658('0x7e')]=_[_0xc658('0x26')](db[_0xc658('0x4c')]['rawAttributes']);_0x3a4c08[_0xc658('0x22')]=_[_0xc658('0x26')](_0x18917c[_0xc658('0x22')]);_0x3a4c08[_0xc658('0x7f')]=_[_0xc658('0x80')](_0x3a4c08[_0xc658('0x7e')],_0x3a4c08[_0xc658('0x22')]);_0x1988b7['attributes']=_[_0xc658('0x80')](_0x3a4c08['model'],qs['fields'](_0x18917c[_0xc658('0x22')][_0xc658('0x82')]));_0x1988b7[_0xc658('0x81')]=_0x1988b7['attributes'][_0xc658('0x2c')]?_0x1988b7[_0xc658('0x81')]:_0x3a4c08[_0xc658('0x7e')];if(!_0x18917c[_0xc658('0x22')][_0xc658('0x33')]('nolimit')){_0x1988b7['limit']=qs[_0xc658('0x15')](_0x18917c[_0xc658('0x22')][_0xc658('0x15')]);_0x1988b7[_0xc658('0x14')]=qs[_0xc658('0x14')](_0x18917c[_0xc658('0x22')][_0xc658('0x14')]);}_0x1988b7[_0xc658('0x83')]=qs[_0xc658('0x84')](_0x18917c['query'][_0xc658('0x84')]);_0x1988b7[_0xc658('0x5d')]=qs['filters'](_[_0xc658('0x85')](_0x18917c[_0xc658('0x22')],_0x3a4c08['filters']));_0x1988b7[_0xc658('0x5d')]['ContactId']=_0x276d40['id'];if(_0x18917c[_0xc658('0x22')][_0xc658('0x86')]){_0x1988b7[_0xc658('0x5d')]=_[_0xc658('0x34')](_0x1988b7[_0xc658('0x5d')],{'$or':_['map'](_0x1988b7['attributes'],function(_0x5946b1){var _0x20d2fa={};_0x20d2fa[_0x5946b1]={'$like':'%'+_0x18917c[_0xc658('0x22')][_0xc658('0x86')]+'%'};return _0x20d2fa;})});}_0x1988b7=_[_0xc658('0x34')]({},_0x1988b7,_0x18917c['options']);return db[_0xc658('0x4c')]['count']({'where':_0x1988b7[_0xc658('0x5d')]})[_0xc658('0x19')](function(_0x3f9e7b){_0x178737['count']=_0x3f9e7b;if(_0x18917c[_0xc658('0x22')]['includeAll']){_0x1988b7[_0xc658('0xa2')]=[{'all':!![]}];}return db[_0xc658('0x4c')][_0xc658('0x2b')](_0x1988b7);})['then'](function(_0x27b98c){_0x178737[_0xc658('0xa3')]=_0x27b98c;return _0x178737;});}})[_0xc658('0x19')](respondWithFilteredResult(_0x3e4e9f,_0x1988b7))[_0xc658('0x23')](handleError(_0x3e4e9f,null));};exports[_0xc658('0xa5')]=function(_0x287c6d,_0x5142ec){var _0x2c1ed6={'raw':!![],'where':{}};var _0x409f07={};var _0x48e82b={'count':0x0,'rows':[]};return db[_0xc658('0x24')][_0xc658('0x7d')]({'where':{'id':_0x287c6d[_0xc658('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5142ec,null))[_0xc658('0x19')](function(_0x491351){if(_0x491351){_0x409f07[_0xc658('0x7e')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x409f07[_0xc658('0x22')]=_[_0xc658('0x26')](_0x287c6d[_0xc658('0x22')]);_0x409f07[_0xc658('0x7f')]=_[_0xc658('0x80')](_0x409f07['model'],_0x409f07[_0xc658('0x22')]);_0x2c1ed6[_0xc658('0x81')]=_[_0xc658('0x80')](_0x409f07[_0xc658('0x7e')],qs[_0xc658('0x82')](_0x287c6d['query'][_0xc658('0x82')]));_0x2c1ed6['attributes']=_0x2c1ed6['attributes']['length']?_0x2c1ed6['attributes']:_0x409f07['model'];if(!_0x287c6d['query']['hasOwnProperty'](_0xc658('0x9f'))){_0x2c1ed6['limit']=qs[_0xc658('0x15')](_0x287c6d[_0xc658('0x22')][_0xc658('0x15')]);_0x2c1ed6['offset']=qs[_0xc658('0x14')](_0x287c6d[_0xc658('0x22')][_0xc658('0x14')]);}_0x2c1ed6['order']=qs[_0xc658('0x84')](_0x287c6d[_0xc658('0x22')]['sort']);_0x2c1ed6[_0xc658('0x5d')]=qs[_0xc658('0x7f')](_[_0xc658('0x85')](_0x287c6d[_0xc658('0x22')],_0x409f07[_0xc658('0x7f')]));_0x2c1ed6[_0xc658('0x5d')][_0xc658('0xa0')]=_0x491351['id'];if(_0x287c6d[_0xc658('0x22')][_0xc658('0x86')]){_0x2c1ed6[_0xc658('0x5d')]=_[_0xc658('0x34')](_0x2c1ed6[_0xc658('0x5d')],{'$or':_[_0xc658('0x71')](_0x2c1ed6['attributes'],function(_0x35969a){var _0x26f8b9={};_0x26f8b9[_0x35969a]={'$like':'%'+_0x287c6d[_0xc658('0x22')][_0xc658('0x86')]+'%'};return _0x26f8b9;})});}_0x2c1ed6=_[_0xc658('0x34')]({},_0x2c1ed6,_0x287c6d['options']);return db[_0xc658('0x4b')]['count']({'where':_0x2c1ed6['where']})[_0xc658('0x19')](function(_0x33c5f6){_0x48e82b[_0xc658('0x17')]=_0x33c5f6;if(_0x287c6d[_0xc658('0x22')][_0xc658('0xa6')]){_0x2c1ed6[_0xc658('0xa2')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xc658('0x2b')](_0x2c1ed6);})['then'](function(_0xbc74a4){_0x48e82b[_0xc658('0xa3')]=_0xbc74a4;return _0x48e82b;});}})['then'](respondWithFilteredResult(_0x5142ec,_0x2c1ed6))[_0xc658('0x23')](handleError(_0x5142ec,null));};exports[_0xc658('0xa7')]=function(_0x15ed95,_0x527065){var _0x1a7abb={'raw':!![],'where':{}};var _0x9b3fa6={};var _0x42072b={'count':0x0,'rows':[]};return db['CmContact'][_0xc658('0x7d')]({'where':{'id':_0x15ed95['params']['id']}})[_0xc658('0x19')](handleEntityNotFound(_0x527065,null))[_0xc658('0x19')](function(_0x1a942c){if(_0x1a942c){_0x9b3fa6[_0xc658('0x7e')]=_[_0xc658('0x26')](db['JscriptySessionReport'][_0xc658('0x9e')]);_0x9b3fa6[_0xc658('0x22')]=_['keys'](_0x15ed95['query']);_0x9b3fa6[_0xc658('0x7f')]=_[_0xc658('0x80')](_0x9b3fa6['model'],_0x9b3fa6['query']);_0x1a7abb[_0xc658('0x81')]=_['intersection'](_0x9b3fa6['model'],qs[_0xc658('0x82')](_0x15ed95['query'][_0xc658('0x82')]));_0x1a7abb[_0xc658('0x81')]=_0x1a7abb['attributes'][_0xc658('0x2c')]?_0x1a7abb[_0xc658('0x81')]:_0x9b3fa6[_0xc658('0x7e')];if(!_0x15ed95[_0xc658('0x22')]['hasOwnProperty'](_0xc658('0x9f'))){_0x1a7abb[_0xc658('0x15')]=qs['limit'](_0x15ed95[_0xc658('0x22')]['limit']);_0x1a7abb[_0xc658('0x14')]=qs['offset'](_0x15ed95[_0xc658('0x22')]['offset']);}_0x1a7abb['order']=qs[_0xc658('0x84')](_0x15ed95[_0xc658('0x22')][_0xc658('0x84')]);_0x1a7abb[_0xc658('0x5d')]=qs[_0xc658('0x7f')](_['pick'](_0x15ed95[_0xc658('0x22')],_0x9b3fa6[_0xc658('0x7f')]));_0x1a7abb[_0xc658('0x5d')]['ContactId']=_0x1a942c['id'];if(_0x15ed95[_0xc658('0x22')][_0xc658('0x86')]){_0x1a7abb[_0xc658('0x5d')]=_[_0xc658('0x34')](_0x1a7abb['where'],{'$or':_[_0xc658('0x71')](_0x1a7abb['attributes'],function(_0x468f5d){var _0x524113={};_0x524113[_0x468f5d]={'$like':'%'+_0x15ed95[_0xc658('0x22')][_0xc658('0x86')]+'%'};return _0x524113;})});}_0x1a7abb=_['merge']({},_0x1a7abb,_0x15ed95[_0xc658('0xa1')]);return db[_0xc658('0x51')][_0xc658('0x17')]({'where':_0x1a7abb[_0xc658('0x5d')]})[_0xc658('0x19')](function(_0x5604af){_0x42072b[_0xc658('0x17')]=_0x5604af;if(_0x15ed95['query'][_0xc658('0xa6')]){_0x1a7abb[_0xc658('0xa2')]=[{'all':!![]}];}return db[_0xc658('0x51')][_0xc658('0x2b')](_0x1a7abb);})[_0xc658('0x19')](function(_0x10cc24){_0x42072b[_0xc658('0xa3')]=_0x10cc24;return _0x42072b;});}})[_0xc658('0x19')](respondWithFilteredResult(_0x527065,_0x1a7abb))[_0xc658('0x23')](handleError(_0x527065,null));};exports[_0xc658('0xa8')]=function(_0x19ec9c,_0x3e9bbe){try{if(!_0x19ec9c[_0xc658('0x35')][_0xc658('0x60')]){throw new Error(_0xc658('0xa9'));}if(!_0x19ec9c['body'][_0xc658('0xaa')]){throw new Error(_0xc658('0xab'));}if(!_0x19ec9c[_0xc658('0x35')][_0xc658('0xac')]){throw new Error(_0xc658('0xad'));}if(!_0x19ec9c[_0xc658('0x35')][_0xc658('0xae')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3576a6=_0x19ec9c[_0xc658('0x35')][_0xc658('0xaa')]['split'](',');var _0x35c557=_0x19ec9c['body'][_0xc658('0xac')][_0xc658('0xaf')](',');if(!_0x3576a6['length']||!_0x35c557['length']||_0x3576a6['length']!==_0x35c557['length']){throw new Error(_0xc658('0xb0'));}_0x19ec9c[_0xc658('0x35')][_0xc658('0x82')]=_[_0xc658('0xb1')](_0x3576a6,_0x35c557);if(!_0x19ec9c['body'][_0xc658('0x82')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x19ec9c[_0xc658('0x35')][_0xc658('0x82')][_0xc658('0xb2')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x21abad=path['join'](config[_0xc658('0xb3')],_0xc658('0xb4'),_0x19ec9c['file'][_0xc658('0xb5')]);fs[_0xc658('0xb6')](_0x21abad,parseInt(_0xc658('0xb7'),0x8));var _0x567011=require(_0xc658('0xb8'))['fork'](path[_0xc658('0x3b')](__dirname,'../../components/import/cm/csv'),[_0x21abad,_0x19ec9c[_0xc658('0x35')][_0xc658('0xaa')],_0x19ec9c['body'][_0xc658('0xac')],_0x19ec9c[_0xc658('0x35')][_0xc658('0x60')],_0x19ec9c[_0xc658('0x35')][_0xc658('0xb9')],_0x19ec9c[_0xc658('0x35')][_0xc658('0x5c')],_0x19ec9c[_0xc658('0x35')]['socket_timestamp']]);return _0x3e9bbe['status'](0xc8)[_0xc658('0xba')]({'message':_0xc658('0xbb'),'pid':_0x567011['pid']});}catch(_0x11e1a9){return _0x3e9bbe[_0xc658('0x13')](0x1f4)[_0xc658('0x1f')](_0x11e1a9);}};exports[_0xc658('0xbc')]=function(_0x473f0a,_0x306abb){var _0x41b1b1=fs[_0xc658('0xbd')](_0x473f0a[_0xc658('0xbe')][_0xc658('0x3')]);Papa['parse'](_0x41b1b1,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x449974){return _0x306abb[_0xc658('0x13')](0xc8)['json']({'file':_0x473f0a[_0xc658('0xbe')],'fields':_0x449974['meta'][_0xc658('0x82')]});}});};exports[_0xc658('0xbf')]=function(_0x4cca2b,_0x509957){return db[_0xc658('0xc0')][_0xc658('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc658('0xc1')}})['then'](function(_0x1baa54){var _0x3e23e5=![];if(!_0x4cca2b[_0xc658('0x35')]['ListId']){throw new Error(_0xc658('0xa9'));}if(!_0x4cca2b[_0xc658('0x35')]['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4cca2b['body'][_0xc658('0xc2')][_0xc658('0xb2')]){throw new Error(_0xc658('0xc3'));}if(!_0x4cca2b['body'][_0xc658('0xae')]){throw new Error(_0xc658('0xc4'));}var _0x1b4d1e=require(_0xc658('0xb8'))[_0xc658('0xc5')](path[_0xc658('0x3b')](__dirname,_0xc658('0xc6')),[_0x4cca2b[_0xc658('0x6a')]['id'],JSON['stringify'](_0x4cca2b[_0xc658('0x35')]),JSON[_0xc658('0xc7')](_0x1baa54)]);_0x1b4d1e['on'](_0xc658('0xc8'),function(){_0x3e23e5=!![];return _0x509957[_0xc658('0x13')](0xc8)['json']({'message':_0xc658('0xc9'),'pid':_0x1b4d1e[_0xc658('0xca')]});});_0x1b4d1e['on'](_0xc658('0xcb'),function(_0x317614){if(_0x317614&&!_0x3e23e5){return _0x509957['status'](0x1f4)[_0xc658('0xba')]({'message':_0xc658('0xcc'),'pid':_0x1b4d1e['pid']});}});})[_0xc658('0x23')](handleError(_0x509957,null));};exports[_0xc658('0xcd')]=function(_0x320855,_0x112503){return db['User'][_0xc658('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc658('0xc1')}})[_0xc658('0x19')](function(_0x32ba7e){var _0x48958e=![];if(!_0x320855[_0xc658('0x35')][_0xc658('0x60')]){throw new Error(_0xc658('0xa9'));}if(!_0x320855[_0xc658('0x35')][_0xc658('0xc2')][_0xc658('0x7b')]){throw new Error(_0xc658('0xce'));}if(!_0x320855[_0xc658('0x35')]['binding'][_0xc658('0xb2')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x320855[_0xc658('0x35')][_0xc658('0xae')]){throw new Error(_0xc658('0xc4'));}var _0x15f95c=require(_0xc658('0xb8'))[_0xc658('0xc5')](path[_0xc658('0x3b')](__dirname,'../../components/import/cm/csvUpdates'),[_0x320855[_0xc658('0x6a')]['id'],JSON[_0xc658('0xc7')](_0x320855['body']),JSON[_0xc658('0xc7')](_0x32ba7e)]);_0x15f95c['on']('message',function(){_0x48958e=!![];return _0x112503['status'](0xc8)[_0xc658('0xba')]({'message':_0xc658('0xc9'),'pid':_0x15f95c[_0xc658('0xca')]});});_0x15f95c['on'](_0xc658('0xcb'),function(_0x55329c){if(_0x55329c&&!_0x48958e){return _0x112503[_0xc658('0x13')](0x1f4)[_0xc658('0xba')]({'message':_0xc658('0xcc'),'pid':_0x15f95c[_0xc658('0xca')]});}});})['catch'](handleError(_0x112503,null));};exports[_0xc658('0xcf')]=function(_0x14947c,_0x29298f){var _0x27d8ed=['mail',_0xc658('0xd0'),_0xc658('0xd1'),_0xc658('0xd2'),_0xc658('0xd3'),_0xc658('0xd4'),_0xc658('0xd5')];var _0x38ce84={'offset':0x0,'order':qs[_0xc658('0x84')](_0xc658('0xd6'))},_0x1561be={'count':0x0,'rows':[]};Promise[_0xc658('0xd7')]()[_0xc658('0x19')](function(){if(_0x14947c[_0xc658('0x22')]['channel']){if(!_[_0xc658('0xd8')](_0x27d8ed,_0x14947c[_0xc658('0x22')][_0xc658('0xd9')][_0xc658('0xda')]())){throw new Error('Invalid\x20channel');}_0x27d8ed=[_0x14947c[_0xc658('0x22')][_0xc658('0xd9')]['toLowerCase']()];}if(_0x14947c[_0xc658('0x22')][_0xc658('0xdb')]){try{var _0x5dd7a2=JSON[_0xc658('0xdc')](_0x14947c[_0xc658('0x22')]['range']);if(!moment(_0x5dd7a2[_0xc658('0x36')])[_0xc658('0xdd')]()){throw new Error(_0xc658('0xde'));}if(!moment(_0x5dd7a2['to'])[_0xc658('0xdd')]()){throw new Error(_0xc658('0xdf'));}}catch(_0x3fd61f){throw new Error(_0xc658('0xe0'));}}if(!_0x14947c[_0xc658('0x22')][_0xc658('0x33')](_0xc658('0x9f'))){_0x38ce84['limit']=qs[_0xc658('0x15')](_0x14947c[_0xc658('0x22')][_0xc658('0x15')]||0xa);_0x38ce84[_0xc658('0x14')]=qs['offset'](_0x14947c['query'][_0xc658('0x14')]);}var _0x4da095=_0x27d8ed[_0xc658('0x71')](function(_0x4fd047){if(_0x4fd047===_0xc658('0xd5')){var _0x2d5081={'attributes':['id',_0xc658('0xe1'),_0xc658('0xe2'),'source',_0xc658('0xe3'),_0xc658('0xe4'),'starttime','endtime',_0xc658('0xe5'),_0xc658('0xe6'),_0xc658('0xe7'),_0xc658('0xe8'),_0xc658('0xe9'),_0xc658('0xea'),_0xc658('0xeb')],'where':{'ContactId':_0x14947c[_0xc658('0x6a')]['id']},'include':[{'model':db['User'],'as':_0xc658('0xc0'),'attributes':['id',_0xc658('0x1e'),_0xc658('0xec'),_0xc658('0x2e')]}],'order':[[_0xc658('0xe7'),'DESC']]};if(_0x14947c['query'][_0xc658('0xdb')]){_0x2d5081[_0xc658('0x5d')][_0xc658('0xe7')]={'$gte':_0x5dd7a2[_0xc658('0x36')],'$lte':_0x5dd7a2['to']};}return db[_0xc658('0x4e')]['findAndCountAll'](_0x2d5081)[_0xc658('0x19')](function(_0x1bb21d){_0x1561be[_0xc658('0x17')]+=_0x1bb21d[_0xc658('0x17')];return _[_0xc658('0x71')](_0x1bb21d[_0xc658('0xa3')],function(_0x34a990){var _0x110dc4=_0x34a990[_0xc658('0x37')]({'plain':!![]});_0x110dc4[_0xc658('0xd9')]=_0x4fd047;if(_0x110dc4[_0xc658('0xc0')]){_0x110dc4['User']={'id':_0x110dc4[_0xc658('0xc0')]['id'],'name':_0x110dc4['User'][_0xc658('0x1e')],'fullname':_0x110dc4[_0xc658('0xc0')][_0xc658('0xec')],'alias':_0x110dc4['User'][_0xc658('0x2e')]};}return _0x110dc4;});});}else{var _0x123263=_[_0xc658('0xed')](_0x4fd047)+(_0x4fd047===_0xc658('0xd0')?_0xc658('0xee'):'Account');var _0x4feb57={'attributes':['id',_0xc658('0xef'),_0xc658('0xf0'),_0xc658('0xe7'),_0xc658('0xe6'),'disposition',_0xc658('0xf1'),'thirdDisposition',_0xc658('0xeb'),_0x123263+'Id'],'where':{'ContactId':_0x14947c[_0xc658('0x6a')]['id']},'include':[{'model':db[_0x123263],'as':'Account','attributes':['id',_0xc658('0x1e'),_0xc658('0xf2')]},{'model':db['User'],'as':_0xc658('0xf3'),'attributes':['id','name',_0xc658('0xec')]},{'model':db[_0xc658('0x66')],'as':_0xc658('0x67'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[[_0xc658('0xe7'),_0xc658('0xf4')]]};if(_0x14947c[_0xc658('0x22')][_0xc658('0xdb')]){_0x4feb57[_0xc658('0x5d')][_0xc658('0xe7')]={'$gte':_0x5dd7a2['from'],'$lte':_0x5dd7a2['to']};}switch(_0x4fd047){case'chat':_0x4feb57[_0xc658('0x81')]['push']('browserName',_0xc658('0xf5'),_0xc658('0xf6'),_0xc658('0xf7'),'osName',_0xc658('0xf8'),_0xc658('0xf9'),_0xc658('0xfa'),_0xc658('0xfb'));break;case'mail':_0x4feb57['attributes'][_0xc658('0x5f')](_0xc658('0xfc'),'substatus');break;case'openchannel':_0x4feb57[_0xc658('0x81')][_0xc658('0x5f')]('externalUrl',_0xc658('0xfd'));break;}return db[_[_0xc658('0xed')](_0x4fd047)+'Interaction'][_0xc658('0xfe')](_0x4feb57)[_0xc658('0x19')](function(_0x4b7395){_0x1561be[_0xc658('0x17')]+=_0x4b7395['count'];return _[_0xc658('0x71')](_0x4b7395[_0xc658('0xa3')],function(_0x41e2b1){var _0x449d54=_0x41e2b1[_0xc658('0x37')]({'plain':!![]});_0x449d54[_0xc658('0xd9')]=_0x4fd047;if(_0x449d54[_0xc658('0xf3')]){_0x449d54['Owner']={'id':_0x449d54[_0xc658('0xf3')]['id'],'name':_0x449d54[_0xc658('0xf3')][_0xc658('0x1e')],'fullname':_0x449d54[_0xc658('0xf3')]['fullname']};}return _0x449d54;});});}});return Promise[_0xc658('0x64')](_0x4da095);})['then'](function(_0x3fb638){return _(_0x3fb638)[_0xc658('0xff')]()[_0xc658('0x100')](_0xc658('0xe7'))[_0xc658('0x101')]()['value']();})[_0xc658('0x19')](function(_0x50da8b){_0x1561be[_0xc658('0xa3')]=_0x38ce84[_0xc658('0x15')]?_0x50da8b['slice'](_0x38ce84[_0xc658('0x14')],_0x38ce84[_0xc658('0x14')]+_0x38ce84[_0xc658('0x15')]):_0x50da8b;return _0x1561be;})[_0xc658('0x19')](respondWithFilteredResult(_0x29298f,_0x38ce84))[_0xc658('0x23')](handleError(_0x29298f,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index ee64cd0..9892b9c 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38b2=['../../mysqldb','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x38b2,0xff));var _0x238b=function(_0x10bdd9,_0x2a13a5){_0x10bdd9=_0x10bdd9-0x0;var _0x5c4829=_0x38b2[_0x10bdd9];return _0x5c4829;};'use strict';var EventEmitter=require(_0x238b('0x0'));var CmContact=require(_0x238b('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x238b('0x2')](0x0);var events={'afterCreate':_0x238b('0x3'),'afterUpdate':_0x238b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x12aff7){return function(_0x4f01f9,_0x622ec9,_0x1982c9){CmContactEvents['emit'](_0x12aff7+':'+_0x4f01f9['id'],_0x4f01f9);CmContactEvents[_0x238b('0x5')](_0x12aff7,_0x4f01f9);_0x1982c9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x238b('0x6')](e,emitEvent(event));}}module[_0x238b('0x7')]=CmContactEvents; \ No newline at end of file +var _0xd6c6=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','update','emit'];(function(_0xe94a6c,_0x4b00da){var _0x21ea62=function(_0x265776){while(--_0x265776){_0xe94a6c['push'](_0xe94a6c['shift']());}};_0x21ea62(++_0x4b00da);}(_0xd6c6,0x1b3));var _0x6d6c=function(_0x476b08,_0x183f91){_0x476b08=_0x476b08-0x0;var _0x3b3c1a=_0xd6c6[_0x476b08];return _0x3b3c1a;};'use strict';var EventEmitter=require(_0x6d6c('0x0'));var CmContact=require(_0x6d6c('0x1'))['db'][_0x6d6c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6d6c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d6c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ca6dd){return function(_0x4f5b97,_0x14a282,_0x2c6d5f){CmContactEvents[_0x6d6c('0x5')](_0x1ca6dd+':'+_0x4f5b97['id'],_0x4f5b97);CmContactEvents[_0x6d6c('0x5')](_0x1ca6dd,_0x4f5b97);_0x2c6d5f(null);};}for(var e in events){if(events[_0x6d6c('0x6')](e)){var event=events[e];CmContact[_0x6d6c('0x7')](e,emitEvent(event));}}module[_0x6d6c('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 2ab1d6d..7f44211 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc83b=['length','get','always','onlyIfOpen','BlackLists','message','Campaign','dialCheckDuplicateType','CmHopperBlack','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','priority','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists'];(function(_0x5af22b,_0xc2b30b){var _0x2da6c0=function(_0x34f26c){while(--_0x34f26c){_0x5af22b['push'](_0x5af22b['shift']());}};_0x2da6c0(++_0xc2b30b);}(_0xc83b,0x19a));var _0xbc83=function(_0x3bf302,_0x432e63){_0x3bf302=_0x3bf302-0x0;var _0x5528bd=_0xc83b[_0x3bf302];return _0x5528bd;};'use strict';var _=require(_0xbc83('0x0'));var util=require('util');var logger=require(_0xbc83('0x1'))(_0xbc83('0x2'));var moment=require(_0xbc83('0x3'));var BPromise=require(_0xbc83('0x4'));var rp=require(_0xbc83('0x5'));var fs=require('fs');var path=require(_0xbc83('0x6'));var rimraf=require(_0xbc83('0x7'));var config=require('../../config/environment');var shared=require(_0xbc83('0x8'));var attributes=require(_0xbc83('0x9'));module['exports']=function(_0x13d45d,_0x2a88c8){return _0x13d45d[_0xbc83('0xa')](_0xbc83('0xb'),attributes,{'tableName':_0xbc83('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xbc83('0xd')]},{'name':_0xbc83('0xe'),'fields':[_0xbc83('0xf'),_0xbc83('0x10'),'phone',_0xbc83('0x11'),'fax',_0xbc83('0x12')],'type':_0xbc83('0x13')}],'timestamps':!![],'charset':_0xbc83('0x14'),'collate':_0xbc83('0x15'),'hooks':{'afterCreate':function(_0x276b42,_0xed26f2,_0x1cb80e){var _0x4e82f3=_0x13d45d[_0xbc83('0x16')];var _0x56771d=_0x276b42['get']({'plain':!![]});function _0x4df566(){return function(_0x30d5fd){logger[_0xbc83('0x17')](_0xbc83('0x18'),_0xbc83('0x19'),util[_0xbc83('0x1a')](_0x30d5fd,{'showHidden':![],'depth':null}));};}function _0x595f61(_0x25e132,_0x388a51){var _0x23ed12=_0x388a51[_0xbc83('0x1b')]?_0x388a51[_0xbc83('0x1b')]:moment()[_0xbc83('0x1c')](_0xbc83('0x1d'));return new BPromise(function(_0x3d0d60,_0x290b85){if(_[_0xbc83('0x1e')](_0x388a51[_0xbc83('0x1f')])){_0x3d0d60({'ret':_0x23ed12});}else{_0x4e82f3[_0xbc83('0x20')][_0xbc83('0x21')]({'where':{'id':_0x25e132['id']}})[_0xbc83('0x22')](function(_0x449f99){if(!_[_0xbc83('0x1e')](_0x449f99)){var _0x235a01=_0x449f99[_0xbc83('0x1f')];if(!_['isNil'](_0x235a01)){var _0x5df0e9=shared[_0xbc83('0x23')];var _0xe704ee=_0x5df0e9[_0x235a01];var _0x2ba3af=_0x5df0e9[_0x388a51[_0xbc83('0x1f')]];if(!_['isNil'](_0xe704ee)&&!_[_0xbc83('0x1e')](_0x2ba3af)){var _0x472a67=_0xe704ee[_0xbc83('0x24')]-_0x2ba3af[_0xbc83('0x24')];_0x23ed12=_0x388a51['scheduledat']?_0x388a51[_0xbc83('0x1b')]:moment();var _0x3cc2d9=moment(_0x23ed12)[_0xbc83('0x25')](_0x472a67,_0xbc83('0x26'));_0x3d0d60({'ret':_0x3cc2d9['format'](_0xbc83('0x1d'))});}else _0x3d0d60({'ret':_0x23ed12});}else _0x3d0d60({'ret':_0x23ed12});}else{_0x3d0d60({'ret':_0x23ed12});}});}});return 0xa;}var _0x2b3fac=function(_0x55b399){return new BPromise(function(_0x47b51a,_0xc6fd6b){_0x595f61(_0x55b399,_0x56771d)[_0xbc83('0x22')](function(_0x2fac2f){_0x56771d[_0xbc83('0x1b')]=_0x2fac2f[_0xbc83('0x27')];_0x4e82f3[_0xbc83('0x28')][_0xbc83('0x21')]({'where':{'phone':_0x56771d['phone'],'VoiceQueueId':_0x55b399['id']}})[_0xbc83('0x22')](function(_0x9b9aa0){if(!_['isNil'](_0x9b9aa0)){throw new Error(_0xbc83('0x29')+_0x56771d[_0xbc83('0xd')]+_0xbc83('0x2a')+_0x55b399['id']);}return _0x4e82f3[_0xbc83('0x28')][_0xbc83('0x2b')]({'phone':_0x56771d[_0xbc83('0xd')],'ContactId':_0x56771d['id'],'ListId':_0x56771d[_0xbc83('0x2c')],'priority':_0x56771d['priority']?_0x56771d['priority']:0x2,'scheduledat':_0x56771d['scheduledat']?_0x56771d[_0xbc83('0x1b')]:moment()[_0xbc83('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x56771d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x56771d[_0xbc83('0x2d')]?_0x56771d['callbackUniqueid']:undefined,'callbackat':_0x56771d[_0xbc83('0x2d')]?moment()[_0xbc83('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x55b399['id']});})[_0xbc83('0x2e')](function(_0x572c48){_0xc6fd6b(_0x572c48);});});});};var _0x55690d=function(_0x3b03de){return new BPromise(function(_0x355ef1,_0x21ea6f){_0x595f61(_0x3b03de,_0x56771d)[_0xbc83('0x22')](function(_0x4ae858){_0x56771d[_0xbc83('0x1b')]=_0x4ae858['ret'];_0x4e82f3[_0xbc83('0x28')]['findOne']({'where':{'phone':_0x56771d[_0xbc83('0xd')],'VoiceQueueId':_0x3b03de['id']}})[_0xbc83('0x22')](function(_0x324817){if(!_[_0xbc83('0x1e')](_0x324817)){throw new Error(_0xbc83('0x29')+_0x56771d[_0xbc83('0xd')]+_0xbc83('0x2f')+_0x3b03de['id']);}return _0x4e82f3[_0xbc83('0x30')][_0xbc83('0x21')]({'where':{'calleridnum':_0x56771d[_0xbc83('0xd')],'VoiceQueueId':_0x3b03de['id']}});})[_0xbc83('0x22')](function(_0x38611f){if(!_[_0xbc83('0x1e')](_0x38611f)){throw new Error(_0xbc83('0x31')+_0x56771d['phone']+_0xbc83('0x32')+_0x3b03de['id']);}return _0x4e82f3[_0xbc83('0x28')]['create']({'phone':_0x56771d[_0xbc83('0xd')],'ContactId':_0x56771d['id'],'ListId':_0x56771d[_0xbc83('0x2c')],'priority':_0x56771d[_0xbc83('0x33')]?_0x56771d[_0xbc83('0x33')]:0x2,'scheduledat':_0x56771d[_0xbc83('0x1b')]?_0x56771d[_0xbc83('0x1b')]:moment()[_0xbc83('0x1c')](_0xbc83('0x1d')),'callback':_0x56771d[_0xbc83('0x2d')]?!![]:![],'callbackuniqueid':_0x56771d[_0xbc83('0x2d')]?_0x56771d[_0xbc83('0x2d')]:undefined,'callbackat':_0x56771d[_0xbc83('0x2d')]?moment()[_0xbc83('0x1c')](_0xbc83('0x1d')):undefined,'VoiceQueueId':_0x3b03de['id']});})[_0xbc83('0x2e')](function(_0x5bd1a7){_0x21ea6f(_0x5bd1a7);});});});};function _0x495d1f(){return function(_0x5aff90){logger['error'](_0xbc83('0x18'),_0xbc83('0x19'),util[_0xbc83('0x1a')](_0x5aff90,{'showHidden':![],'depth':null}));};}function _0x2522da(_0x10f4ae,_0xb3212d){var _0x9b6370=_0xb3212d[_0xbc83('0x1b')]?_0xb3212d[_0xbc83('0x1b')]:moment()['format'](_0xbc83('0x1d'));return new BPromise(function(_0x508f8f,_0x486cfa){if(_['isNil'](_0xb3212d['dialTimezone'])){_0x508f8f({'ret':_0x9b6370});}else{_0x4e82f3['Campaign'][_0xbc83('0x21')]({'where':{'id':_0x10f4ae['id']}})[_0xbc83('0x22')](function(_0x52bbc0){if(!_[_0xbc83('0x1e')](_0x52bbc0)){var _0x5a3071=_0x52bbc0['dialTimezone'];if(!_[_0xbc83('0x1e')](_0x5a3071)){var _0x233b6c=shared[_0xbc83('0x23')];var _0xd721bf=_0x233b6c[_0x5a3071];var _0x3d30cb=_0x233b6c[_0xb3212d['dialTimezone']];if(!_[_0xbc83('0x1e')](_0xd721bf)&&!_[_0xbc83('0x1e')](_0x3d30cb)){var _0x89dd76=_0xd721bf[_0xbc83('0x24')]-_0x3d30cb['utcOffset'];_0x9b6370=_0xb3212d[_0xbc83('0x1b')]?_0xb3212d[_0xbc83('0x1b')]:moment();var _0x4f6d2f=moment(_0x9b6370)[_0xbc83('0x25')](_0x89dd76,'minutes');_0x508f8f({'ret':_0x4f6d2f[_0xbc83('0x1c')](_0xbc83('0x1d'))});}else _0x508f8f({'ret':_0x9b6370});}else _0x508f8f({'ret':_0x9b6370});}else{_0x508f8f({'ret':_0x9b6370});}});}});return 0xa;}var _0x1179e1=function(_0x9ff3e7){return new BPromise(function(_0x2a5574,_0x4b5457){_0x2522da(_0x9ff3e7,_0x56771d)[_0xbc83('0x22')](function(_0x4d2093){_0x56771d[_0xbc83('0x1b')]=_0x4d2093[_0xbc83('0x27')];_0x4e82f3['CmHopper'][_0xbc83('0x21')]({'where':{'phone':_0x56771d['phone'],'CampaignId':_0x9ff3e7['id']}})[_0xbc83('0x22')](function(_0x3b2007){if(!_[_0xbc83('0x1e')](_0x3b2007)){throw new Error(_0xbc83('0x29')+_0x56771d['phone']+_0xbc83('0x34')+_0x9ff3e7['id']);}return _0x4e82f3[_0xbc83('0x28')]['create']({'phone':_0x56771d['phone'],'ContactId':_0x56771d['id'],'ListId':_0x56771d['ListId'],'priority':_0x56771d['priority']?_0x56771d[_0xbc83('0x33')]:0x2,'scheduledat':_0x56771d['scheduledat']?_0x56771d['scheduledat']:moment()[_0xbc83('0x1c')](_0xbc83('0x1d')),'callback':_0x56771d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x56771d[_0xbc83('0x2d')]?_0x56771d['callbackUniqueid']:undefined,'callbackat':_0x56771d['callbackUniqueid']?moment()['format'](_0xbc83('0x1d')):undefined,'CampaignId':_0x9ff3e7['id']});})['catch'](function(_0x2d14c4){_0x4b5457(_0x2d14c4);});});});};var _0x560350=function(_0x2ea2ce){return new BPromise(function(_0x4cb466,_0x19d3ca){_0x2522da(_0x2ea2ce,_0x56771d)[_0xbc83('0x22')](function(_0x2a7876){_0x56771d[_0xbc83('0x1b')]=_0x2a7876[_0xbc83('0x27')];_0x4e82f3[_0xbc83('0x28')][_0xbc83('0x21')]({'where':{'phone':_0x56771d['phone'],'CampaignId':_0x2ea2ce['id']}})[_0xbc83('0x22')](function(_0x1e1aec){if(!_[_0xbc83('0x1e')](_0x1e1aec)){throw new Error('cmContact,\x20afterCreate\x20'+_0x56771d['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x2ea2ce['id']);}return _0x4e82f3[_0xbc83('0x30')][_0xbc83('0x21')]({'where':{'calleridnum':_0x56771d[_0xbc83('0xd')],'CampaignId':_0x2ea2ce['id']}});})[_0xbc83('0x22')](function(_0x1e2605){if(!_[_0xbc83('0x1e')](_0x1e2605)){throw new Error(_0xbc83('0x31')+_0x56771d[_0xbc83('0xd')]+_0xbc83('0x35')+_0x2ea2ce['id']);}return _0x4e82f3[_0xbc83('0x28')]['create']({'phone':_0x56771d[_0xbc83('0xd')],'ContactId':_0x56771d['id'],'ListId':_0x56771d[_0xbc83('0x2c')],'priority':_0x56771d[_0xbc83('0x33')]?_0x56771d[_0xbc83('0x33')]:0x2,'scheduledat':_0x56771d[_0xbc83('0x1b')]?_0x56771d[_0xbc83('0x1b')]:moment()['format'](_0xbc83('0x1d')),'callback':_0x56771d[_0xbc83('0x2d')]?!![]:![],'callbackuniqueid':_0x56771d[_0xbc83('0x2d')]?_0x56771d[_0xbc83('0x2d')]:undefined,'callbackat':_0x56771d[_0xbc83('0x2d')]?moment()['format'](_0xbc83('0x1d')):undefined,'CampaignId':_0x2ea2ce['id']});})[_0xbc83('0x2e')](function(_0x3f23d2){_0x19d3ca(_0x3f23d2);});});});};if(_0x56771d[_0xbc83('0x2c')]){_0x4e82f3[_0xbc83('0x20')][_0xbc83('0x36')]({'where':{'type':_0xbc83('0x37')},'attributes':['id','dialCheckDuplicateType',_0xbc83('0x1f')],'include':[{'model':_0x4e82f3[_0xbc83('0x38')],'as':_0xbc83('0x39'),'where':{'id':_0x56771d[_0xbc83('0x2c')]}}]})[_0xbc83('0x22')](function(_0x3f467d){if(_0x3f467d){var _0x42de22=[];for(var _0x2a0b3d=0x0,_0x3bbe56;_0x2a0b3d<_0x3f467d[_0xbc83('0x3a')];_0x2a0b3d+=0x1){_0x3bbe56=_0x3f467d[_0x2a0b3d][_0xbc83('0x3b')]({'plain':!![]});switch(_0x3bbe56['dialCheckDuplicateType']){case _0xbc83('0x3c'):_0x55690d(_0x3bbe56)[_0xbc83('0x2e')](_0x4df566());break;case _0xbc83('0x3d'):_0x2b3fac(_0x3bbe56)[_0xbc83('0x2e')](_0x4df566());break;default:_0x2522da(_0x3bbe56,_0x56771d)[_0xbc83('0x22')](function(_0x360202){_0x56771d[_0xbc83('0x1b')]=_0x360202['ret'];_0x4e82f3[_0xbc83('0x28')][_0xbc83('0x2b')]({'phone':_0x56771d['phone'],'ContactId':_0x56771d['id'],'ListId':_0x56771d[_0xbc83('0x2c')],'scheduledat':_0x56771d['scheduledat']?_0x56771d['scheduledat']:moment()[_0xbc83('0x1c')](_0xbc83('0x1d')),'priority':_0x56771d['priority']?_0x56771d[_0xbc83('0x33')]:0x2,'callback':_0x56771d[_0xbc83('0x2d')]?!![]:![],'callbackuniqueid':_0x56771d[_0xbc83('0x2d')]?_0x56771d[_0xbc83('0x2d')]:undefined,'callbackat':_0x56771d[_0xbc83('0x2d')]?moment()[_0xbc83('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3bbe56['id']})[_0xbc83('0x2e')](_0x4df566());});}}}})[_0xbc83('0x22')](function(){return _0x4e82f3[_0xbc83('0x20')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x4e82f3['CmList'],'as':_0xbc83('0x3e'),'where':{'id':_0x56771d['ListId']}}]})['then'](function(_0x1b3e66){if(_0x1b3e66){var _0x1f4739=[];for(var _0x41c801=0x0,_0x4a6ae7;_0x41c801<_0x1b3e66[_0xbc83('0x3a')];_0x41c801+=0x1){_0x4a6ae7=_0x1b3e66[_0x41c801][_0xbc83('0x3b')]({'plain':!![]});_0x4e82f3['CmHopperBlack'][_0xbc83('0x2b')]({'phone':_0x56771d['phone'],'ContactId':_0x56771d['id'],'ListId':_0x56771d[_0xbc83('0x2c')],'VoiceQueueId':_0x4a6ae7['id']})[_0xbc83('0x2e')](function(_0x180f7){logger[_0xbc83('0x17')]('cmContact,\x20%s,\x20%s',_0xbc83('0x19'),_0x180f7[_0xbc83('0x3f')]);});}}});})[_0xbc83('0x22')](function(){return _0x4e82f3[_0xbc83('0x40')][_0xbc83('0x36')]({'attributes':['id','dialCheckDuplicateType',_0xbc83('0x1f')],'include':[{'model':_0x4e82f3['CmList'],'as':'Lists','where':{'id':_0x56771d[_0xbc83('0x2c')]}}]})[_0xbc83('0x22')](function(_0x5000a6){if(_0x5000a6){var _0x24bb1a=[];for(var _0x466715=0x0,_0x11620f;_0x466715<_0x5000a6[_0xbc83('0x3a')];_0x466715+=0x1){_0x11620f=_0x5000a6[_0x466715][_0xbc83('0x3b')]({'plain':!![]});switch(_0x11620f[_0xbc83('0x41')]){case _0xbc83('0x3c'):_0x560350(_0x11620f)['catch'](_0x495d1f());break;case'onlyIfOpen':_0x1179e1(_0x11620f)[_0xbc83('0x2e')](_0x495d1f());break;default:_0x4e82f3[_0xbc83('0x28')]['create']({'phone':_0x56771d[_0xbc83('0xd')],'ContactId':_0x56771d['id'],'ListId':_0x56771d[_0xbc83('0x2c')],'scheduledat':_0x56771d['scheduledat']?_0x56771d[_0xbc83('0x1b')]:moment()['format'](_0xbc83('0x1d')),'priority':_0x56771d[_0xbc83('0x33')]?_0x56771d[_0xbc83('0x33')]:0x2,'callback':_0x56771d[_0xbc83('0x2d')]?!![]:![],'callbackuniqueid':_0x56771d[_0xbc83('0x2d')]?_0x56771d[_0xbc83('0x2d')]:undefined,'callbackat':_0x56771d['callbackUniqueid']?moment()[_0xbc83('0x1c')](_0xbc83('0x1d')):undefined,'CampaignId':_0x11620f['id']})[_0xbc83('0x2e')](_0x495d1f());}}}});})[_0xbc83('0x22')](function(){return _0x4e82f3['Campaign'][_0xbc83('0x36')]({'attributes':['id'],'include':[{'model':_0x4e82f3[_0xbc83('0x38')],'as':_0xbc83('0x3e'),'where':{'id':_0x56771d[_0xbc83('0x2c')]}}]})[_0xbc83('0x22')](function(_0x59588c){if(_0x59588c){var _0x4cebeb=[];for(var _0x15d88b=0x0,_0x16dd2d;_0x15d88b<_0x59588c[_0xbc83('0x3a')];_0x15d88b+=0x1){_0x16dd2d=_0x59588c[_0x15d88b][_0xbc83('0x3b')]({'plain':!![]});_0x4e82f3[_0xbc83('0x42')][_0xbc83('0x2b')]({'phone':_0x56771d[_0xbc83('0xd')],'ContactId':_0x56771d['id'],'ListId':_0x56771d[_0xbc83('0x2c')],'CampaignId':_0x16dd2d['id']})['catch'](function(_0x468db1){logger[_0xbc83('0x17')](_0xbc83('0x43'),_0xbc83('0x19'),_0x468db1[_0xbc83('0x3f')]);});}}});})['then'](function(){_0x1cb80e();})['catch'](function(_0x5b5f28){logger[_0xbc83('0x17')](_0xbc83('0x43'),_0xbc83('0x19'),_0x5b5f28['message']);_0x1cb80e(_0x5b5f28);});}else{_0x1cb80e(new Error(_0xbc83('0x44')));}},'afterDestroy':function(_0x574842,_0x1a1317,_0x5f03a8){var _0x5deed8=_0x13d45d[_0xbc83('0x16')];var _0x25c5c7=_0x574842['get']({'plain':!![]});return _0x5deed8[_0xbc83('0x28')]['findAll']({'raw':!![],'where':{'ListId':_0x25c5c7[_0xbc83('0x2c')],'ContactId':_0x25c5c7['id']}})['then'](function(_0x2314f4){if(!_[_0xbc83('0x45')](_0x2314f4)){var _0x4dc608=[];for(var _0x1bc235=0x0;_0x1bc235<_0x2314f4['length'];_0x1bc235+=0x1){var _0x539b89=_0x5deed8[_0xbc83('0x28')][_0xbc83('0x46')]({'where':{'ListId':_0x2314f4[_0x1bc235][_0xbc83('0x2c')],'ContactId':_0x2314f4[_0x1bc235][_0xbc83('0x47')],'VoiceQueueId':_0x2314f4[_0x1bc235][_0xbc83('0x48')],'CampaignId':_0x2314f4[_0x1bc235][_0xbc83('0x49')]}});_0x4dc608[_0xbc83('0x4a')](_0x539b89);}return BPromise['all'](_0x4dc608);}})[_0xbc83('0x22')](function(_0x723ff){logger[_0xbc83('0x4b')](_0xbc83('0x4c'),util[_0xbc83('0x1a')](_0x723ff,{'showHidden':![],'depth':null}));_0x5f03a8();})['catch'](function(_0x483eee){logger[_0xbc83('0x17')](_0xbc83('0x4d'),util[_0xbc83('0x1a')](_0x483eee,{'showHidden':![],'depth':null}));_0x5f03a8(_0x483eee);});}}});}; \ No newline at end of file +var _0x170f=['priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','afterCreate','Campaign','utcOffset','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','get','always','CmList','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','mobile','fax','email','utf8mb4_unicode_ci','cmContact','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','isNil','timezones','dialTimezone','add','CmHopper','findOne','then','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x170f,0xb2));var _0xf170=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0x170f[_0xf31767];return _0x24bd0c;};'use strict';var _=require('lodash');var util=require(_0xf170('0x0'));var logger=require(_0xf170('0x1'))(_0xf170('0x2'));var moment=require(_0xf170('0x3'));var BPromise=require(_0xf170('0x4'));var rp=require(_0xf170('0x5'));var fs=require('fs');var path=require(_0xf170('0x6'));var rimraf=require(_0xf170('0x7'));var config=require(_0xf170('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0xf170('0x9'));module[_0xf170('0xa')]=function(_0x3892f4,_0x1dacbd){return _0x3892f4[_0xf170('0xb')](_0xf170('0xc'),attributes,{'tableName':_0xf170('0xd'),'paranoid':!![],'indexes':[{'name':_0xf170('0xe'),'fields':[_0xf170('0xe')]},{'name':_0xf170('0xf'),'fields':['firstName',_0xf170('0x10'),_0xf170('0xe'),_0xf170('0x11'),_0xf170('0x12'),_0xf170('0x13')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0xf170('0x14'),'hooks':{'afterCreate':function(_0xe8ee5c,_0x9957a0,_0x437c71){var _0x3acf6=_0x3892f4['models'];var _0x5da77c=_0xe8ee5c['get']({'plain':!![]});function _0x1dc950(){return function(_0x173916){logger['error'](_0xf170('0x15'),'afterCreate',util[_0xf170('0x16')](_0x173916,{'showHidden':![],'depth':null}));};}function _0x449249(_0x1a220f,_0x371dfb){var _0x357cf3=_0x371dfb[_0xf170('0x17')]?_0x371dfb[_0xf170('0x17')]:moment()[_0xf170('0x18')](_0xf170('0x19'));return new BPromise(function(_0x279c0d,_0x252340){if(_['isNil'](_0x371dfb['dialTimezone'])){_0x279c0d({'ret':_0x357cf3});}else{_0x3acf6[_0xf170('0x1a')]['findOne']({'where':{'id':_0x1a220f['id']}})['then'](function(_0x57c0b1){if(!_[_0xf170('0x1b')](_0x57c0b1)){var _0x1802e2=_0x57c0b1['dialTimezone'];if(!_['isNil'](_0x1802e2)){var _0x49b88a=shared[_0xf170('0x1c')];var _0x3709a6=_0x49b88a[_0x1802e2];var _0x357e05=_0x49b88a[_0x371dfb[_0xf170('0x1d')]];if(!_[_0xf170('0x1b')](_0x3709a6)&&!_['isNil'](_0x357e05)){var _0x5116e2=_0x3709a6['utcOffset']-_0x357e05['utcOffset'];_0x357cf3=_0x371dfb[_0xf170('0x17')]?_0x371dfb[_0xf170('0x17')]:moment();var _0x4ee84f=moment(_0x357cf3)[_0xf170('0x1e')](_0x5116e2,'minutes');_0x279c0d({'ret':_0x4ee84f[_0xf170('0x18')](_0xf170('0x19'))});}else _0x279c0d({'ret':_0x357cf3});}else _0x279c0d({'ret':_0x357cf3});}else{_0x279c0d({'ret':_0x357cf3});}});}});return 0xa;}var _0xa39a38=function(_0x4f48d4){return new BPromise(function(_0x4ff68f,_0x21cffc){_0x449249(_0x4f48d4,_0x5da77c)['then'](function(_0x11f6da){_0x5da77c[_0xf170('0x17')]=_0x11f6da['ret'];_0x3acf6[_0xf170('0x1f')][_0xf170('0x20')]({'where':{'phone':_0x5da77c[_0xf170('0xe')],'VoiceQueueId':_0x4f48d4['id']}})[_0xf170('0x21')](function(_0x5d1afe){if(!_[_0xf170('0x1b')](_0x5d1afe)){throw new Error(_0xf170('0x22')+_0x5da77c[_0xf170('0xe')]+_0xf170('0x23')+_0x4f48d4['id']);}return _0x3acf6[_0xf170('0x1f')][_0xf170('0x24')]({'phone':_0x5da77c[_0xf170('0xe')],'ContactId':_0x5da77c['id'],'ListId':_0x5da77c[_0xf170('0x25')],'priority':_0x5da77c[_0xf170('0x26')]?_0x5da77c[_0xf170('0x26')]:0x2,'scheduledat':_0x5da77c[_0xf170('0x17')]?_0x5da77c[_0xf170('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5da77c[_0xf170('0x27')]?!![]:![],'callbackuniqueid':_0x5da77c[_0xf170('0x27')]?_0x5da77c[_0xf170('0x27')]:undefined,'callbackat':_0x5da77c[_0xf170('0x27')]?moment()[_0xf170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4f48d4['id']});})[_0xf170('0x28')](function(_0x4ccb03){_0x21cffc(_0x4ccb03);});});});};var _0x501965=function(_0x204057){return new BPromise(function(_0x3a9748,_0x15d632){_0x449249(_0x204057,_0x5da77c)[_0xf170('0x21')](function(_0x55c81c){_0x5da77c[_0xf170('0x17')]=_0x55c81c[_0xf170('0x29')];_0x3acf6[_0xf170('0x1f')][_0xf170('0x20')]({'where':{'phone':_0x5da77c[_0xf170('0xe')],'VoiceQueueId':_0x204057['id']}})[_0xf170('0x21')](function(_0x5c62fd){if(!_[_0xf170('0x1b')](_0x5c62fd)){throw new Error(_0xf170('0x22')+_0x5da77c[_0xf170('0xe')]+_0xf170('0x2a')+_0x204057['id']);}return _0x3acf6[_0xf170('0x2b')]['findOne']({'where':{'calleridnum':_0x5da77c[_0xf170('0xe')],'VoiceQueueId':_0x204057['id']}});})[_0xf170('0x21')](function(_0x3a1629){if(!_[_0xf170('0x1b')](_0x3a1629)){throw new Error(_0xf170('0x2c')+_0x5da77c[_0xf170('0xe')]+_0xf170('0x2d')+_0x204057['id']);}return _0x3acf6['CmHopper'][_0xf170('0x24')]({'phone':_0x5da77c[_0xf170('0xe')],'ContactId':_0x5da77c['id'],'ListId':_0x5da77c[_0xf170('0x25')],'priority':_0x5da77c[_0xf170('0x26')]?_0x5da77c[_0xf170('0x26')]:0x2,'scheduledat':_0x5da77c[_0xf170('0x17')]?_0x5da77c[_0xf170('0x17')]:moment()['format'](_0xf170('0x19')),'callback':_0x5da77c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5da77c['callbackUniqueid']?_0x5da77c[_0xf170('0x27')]:undefined,'callbackat':_0x5da77c['callbackUniqueid']?moment()['format'](_0xf170('0x19')):undefined,'VoiceQueueId':_0x204057['id']});})[_0xf170('0x28')](function(_0x44a188){_0x15d632(_0x44a188);});});});};function _0x81efe8(){return function(_0x239430){logger[_0xf170('0x2e')]('cmContact',_0xf170('0x2f'),util[_0xf170('0x16')](_0x239430,{'showHidden':![],'depth':null}));};}function _0x4779a9(_0x487a3d,_0x181d45){var _0x1b4164=_0x181d45[_0xf170('0x17')]?_0x181d45['scheduledat']:moment()[_0xf170('0x18')](_0xf170('0x19'));return new BPromise(function(_0x5ee63e,_0x12942a){if(_[_0xf170('0x1b')](_0x181d45[_0xf170('0x1d')])){_0x5ee63e({'ret':_0x1b4164});}else{_0x3acf6[_0xf170('0x30')][_0xf170('0x20')]({'where':{'id':_0x487a3d['id']}})[_0xf170('0x21')](function(_0xd9e88e){if(!_[_0xf170('0x1b')](_0xd9e88e)){var _0x347c0f=_0xd9e88e[_0xf170('0x1d')];if(!_[_0xf170('0x1b')](_0x347c0f)){var _0x594c96=shared[_0xf170('0x1c')];var _0x5a1a3c=_0x594c96[_0x347c0f];var _0x24d1ce=_0x594c96[_0x181d45['dialTimezone']];if(!_[_0xf170('0x1b')](_0x5a1a3c)&&!_[_0xf170('0x1b')](_0x24d1ce)){var _0x3759e0=_0x5a1a3c[_0xf170('0x31')]-_0x24d1ce[_0xf170('0x31')];_0x1b4164=_0x181d45[_0xf170('0x17')]?_0x181d45[_0xf170('0x17')]:moment();var _0xf6e1d1=moment(_0x1b4164)['add'](_0x3759e0,_0xf170('0x32'));_0x5ee63e({'ret':_0xf6e1d1[_0xf170('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5ee63e({'ret':_0x1b4164});}else _0x5ee63e({'ret':_0x1b4164});}else{_0x5ee63e({'ret':_0x1b4164});}});}});return 0xa;}var _0x3058cf=function(_0x2626dc){return new BPromise(function(_0x2aba56,_0x4f301c){_0x4779a9(_0x2626dc,_0x5da77c)[_0xf170('0x21')](function(_0xdd1544){_0x5da77c['scheduledat']=_0xdd1544[_0xf170('0x29')];_0x3acf6[_0xf170('0x1f')][_0xf170('0x20')]({'where':{'phone':_0x5da77c['phone'],'CampaignId':_0x2626dc['id']}})[_0xf170('0x21')](function(_0x22461c){if(!_[_0xf170('0x1b')](_0x22461c)){throw new Error(_0xf170('0x22')+_0x5da77c['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x2626dc['id']);}return _0x3acf6[_0xf170('0x1f')][_0xf170('0x24')]({'phone':_0x5da77c[_0xf170('0xe')],'ContactId':_0x5da77c['id'],'ListId':_0x5da77c[_0xf170('0x25')],'priority':_0x5da77c[_0xf170('0x26')]?_0x5da77c[_0xf170('0x26')]:0x2,'scheduledat':_0x5da77c['scheduledat']?_0x5da77c[_0xf170('0x17')]:moment()[_0xf170('0x18')](_0xf170('0x19')),'callback':_0x5da77c[_0xf170('0x27')]?!![]:![],'callbackuniqueid':_0x5da77c[_0xf170('0x27')]?_0x5da77c[_0xf170('0x27')]:undefined,'callbackat':_0x5da77c[_0xf170('0x27')]?moment()[_0xf170('0x18')](_0xf170('0x19')):undefined,'CampaignId':_0x2626dc['id']});})[_0xf170('0x28')](function(_0x86d24a){_0x4f301c(_0x86d24a);});});});};var _0x112cb8=function(_0x507c89){return new BPromise(function(_0x1986b5,_0x78c4d0){_0x4779a9(_0x507c89,_0x5da77c)[_0xf170('0x21')](function(_0x251fb5){_0x5da77c[_0xf170('0x17')]=_0x251fb5['ret'];_0x3acf6[_0xf170('0x1f')][_0xf170('0x20')]({'where':{'phone':_0x5da77c[_0xf170('0xe')],'CampaignId':_0x507c89['id']}})[_0xf170('0x21')](function(_0x2f4fe1){if(!_[_0xf170('0x1b')](_0x2f4fe1)){throw new Error(_0xf170('0x22')+_0x5da77c[_0xf170('0xe')]+_0xf170('0x33')+_0x507c89['id']);}return _0x3acf6['CmHopperFinal'][_0xf170('0x20')]({'where':{'calleridnum':_0x5da77c['phone'],'CampaignId':_0x507c89['id']}});})[_0xf170('0x21')](function(_0x5d7bae){if(!_[_0xf170('0x1b')](_0x5d7bae)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5da77c[_0xf170('0xe')]+_0xf170('0x34')+_0x507c89['id']);}return _0x3acf6[_0xf170('0x1f')][_0xf170('0x24')]({'phone':_0x5da77c[_0xf170('0xe')],'ContactId':_0x5da77c['id'],'ListId':_0x5da77c['ListId'],'priority':_0x5da77c[_0xf170('0x26')]?_0x5da77c[_0xf170('0x26')]:0x2,'scheduledat':_0x5da77c['scheduledat']?_0x5da77c[_0xf170('0x17')]:moment()[_0xf170('0x18')](_0xf170('0x19')),'callback':_0x5da77c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5da77c[_0xf170('0x27')]?_0x5da77c[_0xf170('0x27')]:undefined,'callbackat':_0x5da77c[_0xf170('0x27')]?moment()[_0xf170('0x18')](_0xf170('0x19')):undefined,'CampaignId':_0x507c89['id']});})[_0xf170('0x28')](function(_0x51dc53){_0x78c4d0(_0x51dc53);});});});};if(_0x5da77c['ListId']){_0x3acf6[_0xf170('0x1a')][_0xf170('0x35')]({'where':{'type':_0xf170('0x36')},'attributes':['id',_0xf170('0x37'),'dialTimezone'],'include':[{'model':_0x3acf6['CmList'],'as':_0xf170('0x38'),'where':{'id':_0x5da77c[_0xf170('0x25')]}}]})[_0xf170('0x21')](function(_0x6c4a10){if(_0x6c4a10){var _0x1130b3=[];for(var _0x5f4fec=0x0,_0x2f9234;_0x5f4fec<_0x6c4a10['length'];_0x5f4fec+=0x1){_0x2f9234=_0x6c4a10[_0x5f4fec][_0xf170('0x39')]({'plain':!![]});switch(_0x2f9234[_0xf170('0x37')]){case _0xf170('0x3a'):_0x501965(_0x2f9234)[_0xf170('0x28')](_0x1dc950());break;case'onlyIfOpen':_0xa39a38(_0x2f9234)[_0xf170('0x28')](_0x1dc950());break;default:_0x4779a9(_0x2f9234,_0x5da77c)[_0xf170('0x21')](function(_0x69e4c0){_0x5da77c[_0xf170('0x17')]=_0x69e4c0[_0xf170('0x29')];_0x3acf6[_0xf170('0x1f')][_0xf170('0x24')]({'phone':_0x5da77c[_0xf170('0xe')],'ContactId':_0x5da77c['id'],'ListId':_0x5da77c[_0xf170('0x25')],'scheduledat':_0x5da77c[_0xf170('0x17')]?_0x5da77c[_0xf170('0x17')]:moment()['format'](_0xf170('0x19')),'priority':_0x5da77c[_0xf170('0x26')]?_0x5da77c['priority']:0x2,'callback':_0x5da77c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5da77c['callbackUniqueid']?_0x5da77c[_0xf170('0x27')]:undefined,'callbackat':_0x5da77c[_0xf170('0x27')]?moment()[_0xf170('0x18')](_0xf170('0x19')):undefined,'VoiceQueueId':_0x2f9234['id']})[_0xf170('0x28')](_0x1dc950());});}}}})[_0xf170('0x21')](function(){return _0x3acf6['VoiceQueue']['findAll']({'where':{'type':_0xf170('0x36')},'attributes':['id'],'include':[{'model':_0x3acf6[_0xf170('0x3b')],'as':_0xf170('0x3c'),'where':{'id':_0x5da77c[_0xf170('0x25')]}}]})[_0xf170('0x21')](function(_0x7e480e){if(_0x7e480e){var _0x4f4089=[];for(var _0xc8d053=0x0,_0x2ae17a;_0xc8d053<_0x7e480e[_0xf170('0x3d')];_0xc8d053+=0x1){_0x2ae17a=_0x7e480e[_0xc8d053]['get']({'plain':!![]});_0x3acf6[_0xf170('0x3e')]['create']({'phone':_0x5da77c[_0xf170('0xe')],'ContactId':_0x5da77c['id'],'ListId':_0x5da77c[_0xf170('0x25')],'VoiceQueueId':_0x2ae17a['id']})[_0xf170('0x28')](function(_0x56fadd){logger[_0xf170('0x2e')]('cmContact,\x20%s,\x20%s',_0xf170('0x2f'),_0x56fadd['message']);});}}});})[_0xf170('0x21')](function(){return _0x3acf6[_0xf170('0x30')]['findAll']({'attributes':['id',_0xf170('0x37'),'dialTimezone'],'include':[{'model':_0x3acf6[_0xf170('0x3b')],'as':_0xf170('0x38'),'where':{'id':_0x5da77c[_0xf170('0x25')]}}]})[_0xf170('0x21')](function(_0x2dac9b){if(_0x2dac9b){var _0x6a3bed=[];for(var _0x5035d9=0x0,_0x33c70c;_0x5035d9<_0x2dac9b['length'];_0x5035d9+=0x1){_0x33c70c=_0x2dac9b[_0x5035d9][_0xf170('0x39')]({'plain':!![]});switch(_0x33c70c[_0xf170('0x37')]){case _0xf170('0x3a'):_0x112cb8(_0x33c70c)['catch'](_0x81efe8());break;case'onlyIfOpen':_0x3058cf(_0x33c70c)[_0xf170('0x28')](_0x81efe8());break;default:_0x3acf6['CmHopper'][_0xf170('0x24')]({'phone':_0x5da77c['phone'],'ContactId':_0x5da77c['id'],'ListId':_0x5da77c[_0xf170('0x25')],'scheduledat':_0x5da77c[_0xf170('0x17')]?_0x5da77c['scheduledat']:moment()[_0xf170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5da77c[_0xf170('0x26')]?_0x5da77c[_0xf170('0x26')]:0x2,'callback':_0x5da77c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5da77c['callbackUniqueid']?_0x5da77c[_0xf170('0x27')]:undefined,'callbackat':_0x5da77c[_0xf170('0x27')]?moment()[_0xf170('0x18')](_0xf170('0x19')):undefined,'CampaignId':_0x33c70c['id']})['catch'](_0x81efe8());}}}});})[_0xf170('0x21')](function(){return _0x3acf6[_0xf170('0x30')][_0xf170('0x35')]({'attributes':['id'],'include':[{'model':_0x3acf6[_0xf170('0x3b')],'as':_0xf170('0x3c'),'where':{'id':_0x5da77c[_0xf170('0x25')]}}]})['then'](function(_0x4495cb){if(_0x4495cb){var _0x3b4351=[];for(var _0x4d836f=0x0,_0x18e10d;_0x4d836f<_0x4495cb[_0xf170('0x3d')];_0x4d836f+=0x1){_0x18e10d=_0x4495cb[_0x4d836f][_0xf170('0x39')]({'plain':!![]});_0x3acf6['CmHopperBlack'][_0xf170('0x24')]({'phone':_0x5da77c[_0xf170('0xe')],'ContactId':_0x5da77c['id'],'ListId':_0x5da77c['ListId'],'CampaignId':_0x18e10d['id']})['catch'](function(_0x55bc0c){logger['error'](_0xf170('0x3f'),_0xf170('0x2f'),_0x55bc0c['message']);});}}});})['then'](function(){_0x437c71();})[_0xf170('0x28')](function(_0x28f439){logger[_0xf170('0x2e')](_0xf170('0x3f'),_0xf170('0x2f'),_0x28f439['message']);_0x437c71(_0x28f439);});}else{_0x437c71(new Error(_0xf170('0x40')));}},'afterDestroy':function(_0x1f850c,_0x29a06a,_0x16e235){var _0x2d55d8=_0x3892f4['models'];var _0x1c7eb8=_0x1f850c[_0xf170('0x39')]({'plain':!![]});return _0x2d55d8[_0xf170('0x1f')][_0xf170('0x35')]({'raw':!![],'where':{'ListId':_0x1c7eb8[_0xf170('0x25')],'ContactId':_0x1c7eb8['id']}})[_0xf170('0x21')](function(_0x515ed9){if(!_[_0xf170('0x41')](_0x515ed9)){var _0x33fda6=[];for(var _0x2e3d66=0x0;_0x2e3d66<_0x515ed9[_0xf170('0x3d')];_0x2e3d66+=0x1){var _0x42d4e1=_0x2d55d8[_0xf170('0x1f')][_0xf170('0x42')]({'where':{'ListId':_0x515ed9[_0x2e3d66]['ListId'],'ContactId':_0x515ed9[_0x2e3d66][_0xf170('0x43')],'VoiceQueueId':_0x515ed9[_0x2e3d66]['VoiceQueueId'],'CampaignId':_0x515ed9[_0x2e3d66][_0xf170('0x44')]}});_0x33fda6['push'](_0x42d4e1);}return BPromise[_0xf170('0x45')](_0x33fda6);}})[_0xf170('0x21')](function(_0x5ecfff){logger[_0xf170('0x46')](_0xf170('0x47'),util['inspect'](_0x5ecfff,{'showHidden':![],'depth':null}));_0x16e235();})['catch'](function(_0xba4c66){logger['error']('[CmContact][afterDestroy][Error]',util[_0xf170('0x16')](_0xba4c66,{'showHidden':![],'depth':null}));_0x16e235(_0xba4c66);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 351d8f2..5e8619d 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x59b8fc,_0x33cfae){var _0xc28350=function(_0x280c9e){while(--_0x280c9e){_0x59b8fc['push'](_0x59b8fc['shift']());}};_0xc28350(++_0x33cfae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index fc993c5..81d0f6f 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe31=['INTEGER','STRING','PHONE','exports'];(function(_0x500fc6,_0x1540cf){var _0xa478ff=function(_0x1f014a){while(--_0x1f014a){_0x500fc6['push'](_0x500fc6['shift']());}};_0xa478ff(++_0x1540cf);}(_0xbe31,0x83));var _0x1be3=function(_0x1f6193,_0x2de9ff){_0x1f6193=_0x1f6193-0x0;var _0x160297=_0xbe31[_0x1f6193];return _0x160297;};'use strict';var Sequelize=require('sequelize');module[_0x1be3('0x0')]={'CmContactId':{'type':Sequelize[_0x1be3('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1be3('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1be3('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x1be3('0x2')],'defaultValue':_0x1be3('0x3')},'OrderBy':{'type':Sequelize[_0x1be3('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x1be3('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x7217=['PHONE','INTEGER','STRING'];(function(_0x486141,_0x1ff5dd){var _0x4f619d=function(_0x1e6525){while(--_0x1e6525){_0x486141['push'](_0x486141['shift']());}};_0x4f619d(++_0x1ff5dd);}(_0x7217,0xa9));var _0x7721=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7217[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x7721('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7721('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7721('0x1')],'defaultValue':_0x7721('0x2')},'OrderBy':{'type':Sequelize[_0x7721('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x7721('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 384111e..c3abd59 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ff7=['undefined','limit','count','offset','set','Content-Range','json','reject','save','then','get','CmContactHasItems','UserProfileResource','destroy','end','stack','send','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','CmContactHasItem','findAll','rows','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','name','catch','error','body','params','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x44b752,_0x3e6677){var _0x352165=function(_0x4e07a9){while(--_0x4e07a9){_0x44b752['push'](_0x44b752['shift']());}};_0x352165(++_0x3e6677);}(_0x3ff7,0x1c3));var _0x73ff=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x3ff7[_0x592e40];return _0x5d4288;};'use strict';var emlformat=require(_0x73ff('0x0'));var rimraf=require(_0x73ff('0x1'));var zipdir=require(_0x73ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x73ff('0x3'));var BPromise=require(_0x73ff('0x4'));var Mustache=require('mustache');var util=require(_0x73ff('0x5'));var path=require('path');var sox=require(_0x73ff('0x6'));var csv=require(_0x73ff('0x7'));var ejs=require(_0x73ff('0x8'));var fs=require('fs');var fs_extra=require(_0x73ff('0x9'));var _=require(_0x73ff('0xa'));var squel=require('squel');var crypto=require(_0x73ff('0xb'));var jsforce=require(_0x73ff('0xc'));var deskjs=require(_0x73ff('0xd'));var toCsv=require(_0x73ff('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x73ff('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73ff('0xf'));var logger=require(_0x73ff('0x10'))('api');var utils=require(_0x73ff('0x11'));var config=require(_0x73ff('0x12'));var licenseUtil=require(_0x73ff('0x13'));var db=require(_0x73ff('0x14'))['db'];function respondWithStatusCode(_0x14bc2b,_0x707e04){_0x707e04=_0x707e04||0xcc;return function(_0x1c9db1){if(_0x1c9db1){return _0x14bc2b[_0x73ff('0x15')](_0x707e04);}return _0x14bc2b['status'](_0x707e04)['end']();};}function respondWithResult(_0x11ee7e,_0x221346){_0x221346=_0x221346||0xc8;return function(_0x508129){if(_0x508129){return _0x11ee7e[_0x73ff('0x16')](_0x221346)['json'](_0x508129);}};}function respondWithFilteredResult(_0x50b64b,_0x2c1628){return function(_0x29db08){if(_0x29db08){var _0x31f170=typeof _0x2c1628['offset']===_0x73ff('0x17')&&typeof _0x2c1628[_0x73ff('0x18')]===_0x73ff('0x17');var _0x378409=_0x29db08[_0x73ff('0x19')];var _0x32df63=_0x31f170?0x0:_0x2c1628[_0x73ff('0x1a')];var _0x440b5a=_0x31f170?_0x29db08['count']:_0x2c1628[_0x73ff('0x1a')]+_0x2c1628[_0x73ff('0x18')];var _0x2146aa;if(_0x440b5a>=_0x378409){_0x440b5a=_0x378409;_0x2146aa=0xc8;}else{_0x2146aa=0xce;}_0x50b64b[_0x73ff('0x16')](_0x2146aa);return _0x50b64b[_0x73ff('0x1b')](_0x73ff('0x1c'),_0x32df63+'-'+_0x440b5a+'/'+_0x378409)[_0x73ff('0x1d')](_0x29db08);}return null;};}function patchUpdates(_0x3b5106){return function(_0x595da7){try{jsonpatch['apply'](_0x595da7,_0x3b5106,!![]);}catch(_0x4cb0be){return BPromise[_0x73ff('0x1e')](_0x4cb0be);}return _0x595da7[_0x73ff('0x1f')]();};}function saveUpdates(_0xcf7108,_0x5249fb){return function(_0x372262){if(_0x372262){return _0x372262['update'](_0xcf7108)[_0x73ff('0x20')](function(_0xf45bee){return _0xf45bee;});}return null;};}function removeEntity(_0x115d49,_0x559e10){return function(_0x4481a4){if(_0x4481a4){return _0x4481a4['destroy']()[_0x73ff('0x20')](function(){var _0x299337=_0x4481a4[_0x73ff('0x21')]({'plain':!![]});var _0x3785f8=_0x73ff('0x22');return db[_0x73ff('0x23')][_0x73ff('0x24')]({'where':{'type':_0x3785f8,'resourceId':_0x299337['id']}})[_0x73ff('0x20')](function(){return _0x4481a4;});})[_0x73ff('0x20')](function(){_0x115d49[_0x73ff('0x16')](0xcc)[_0x73ff('0x25')]();});}};}function handleEntityNotFound(_0x418e20,_0x21a663){return function(_0x1a1650){if(!_0x1a1650){_0x418e20[_0x73ff('0x15')](0x194);}return _0x1a1650;};}function handleError(_0x1ecdcd,_0x20838d){_0x20838d=_0x20838d||0x1f4;return function(_0x3a39d5){logger['error'](_0x3a39d5[_0x73ff('0x26')]);if(_0x3a39d5['name']){delete _0x3a39d5['name'];}_0x1ecdcd[_0x73ff('0x16')](_0x20838d)[_0x73ff('0x27')](_0x3a39d5);};}exports['index']=function(_0x3b8837,_0x13b5ae){var _0x34edc9={},_0x2a752e={},_0x1d4ab5={'count':0x0,'rows':[]};var _0x47d25e=_['map'](db['CmContactHasItem']['rawAttributes'],function(_0x435a83){return{'name':_0x435a83['fieldName'],'type':_0x435a83['type'][_0x73ff('0x28')]};});_0x2a752e[_0x73ff('0x29')]=_[_0x73ff('0x2a')](_0x47d25e,'name');_0x2a752e['query']=_[_0x73ff('0x2b')](_0x3b8837[_0x73ff('0x2c')]);_0x2a752e[_0x73ff('0x2d')]=_[_0x73ff('0x2e')](_0x2a752e['model'],_0x2a752e[_0x73ff('0x2c')]);_0x34edc9['attributes']=_['intersection'](_0x2a752e[_0x73ff('0x29')],qs[_0x73ff('0x2f')](_0x3b8837[_0x73ff('0x2c')][_0x73ff('0x2f')]));_0x34edc9[_0x73ff('0x30')]=_0x34edc9[_0x73ff('0x30')][_0x73ff('0x31')]?_0x34edc9['attributes']:_0x2a752e[_0x73ff('0x29')];if(!_0x3b8837['query'][_0x73ff('0x32')](_0x73ff('0x33'))){_0x34edc9[_0x73ff('0x18')]=qs['limit'](_0x3b8837['query'][_0x73ff('0x18')]);_0x34edc9[_0x73ff('0x1a')]=qs[_0x73ff('0x1a')](_0x3b8837['query']['offset']);}_0x34edc9[_0x73ff('0x34')]=qs[_0x73ff('0x35')](_0x3b8837['query'][_0x73ff('0x35')]);_0x34edc9[_0x73ff('0x36')]=qs['filters'](_[_0x73ff('0x37')](_0x3b8837['query'],_0x2a752e[_0x73ff('0x2d')]),_0x47d25e);if(_0x3b8837[_0x73ff('0x2c')][_0x73ff('0x38')]){_0x34edc9[_0x73ff('0x36')]=_[_0x73ff('0x39')](_0x34edc9[_0x73ff('0x36')],{'$or':_[_0x73ff('0x2a')](_0x47d25e,function(_0x1d725d){if(_0x1d725d[_0x73ff('0x3a')]!==_0x73ff('0x3b')){var _0x3d0562={};_0x3d0562[_0x1d725d['name']]={'$like':'%'+_0x3b8837[_0x73ff('0x2c')][_0x73ff('0x38')]+'%'};return _0x3d0562;}})});}_0x34edc9=_[_0x73ff('0x39')]({},_0x34edc9,_0x3b8837[_0x73ff('0x3c')]);var _0x1d5a89={'where':_0x34edc9['where']};return db['CmContactHasItem']['count'](_0x1d5a89)['then'](function(_0x5809fb){_0x1d4ab5['count']=_0x5809fb;if(_0x3b8837[_0x73ff('0x2c')][_0x73ff('0x3d')]){_0x34edc9[_0x73ff('0x3e')]=[{'all':!![]}];}return db[_0x73ff('0x3f')][_0x73ff('0x40')](_0x34edc9);})['then'](function(_0x58eb85){_0x1d4ab5[_0x73ff('0x41')]=_0x58eb85;return _0x1d4ab5;})[_0x73ff('0x20')](respondWithFilteredResult(_0x13b5ae,_0x34edc9))['catch'](handleError(_0x13b5ae,null));};exports['show']=function(_0x59fdf1,_0x2f071d){var _0x1ff59d={'raw':!![],'where':{'id':_0x59fdf1['params']['id']}},_0x31c2bb={};_0x31c2bb[_0x73ff('0x29')]=_[_0x73ff('0x2b')](db[_0x73ff('0x3f')][_0x73ff('0x42')]);_0x31c2bb[_0x73ff('0x2c')]=_['keys'](_0x59fdf1[_0x73ff('0x2c')]);_0x31c2bb['filters']=_[_0x73ff('0x2e')](_0x31c2bb['model'],_0x31c2bb[_0x73ff('0x2c')]);_0x1ff59d[_0x73ff('0x30')]=_[_0x73ff('0x2e')](_0x31c2bb['model'],qs[_0x73ff('0x2f')](_0x59fdf1['query'][_0x73ff('0x2f')]));_0x1ff59d[_0x73ff('0x30')]=_0x1ff59d['attributes']['length']?_0x1ff59d[_0x73ff('0x30')]:_0x31c2bb[_0x73ff('0x29')];if(_0x59fdf1['query'][_0x73ff('0x3d')]){_0x1ff59d[_0x73ff('0x3e')]=[{'all':!![]}];}_0x1ff59d=_[_0x73ff('0x39')]({},_0x1ff59d,_0x59fdf1[_0x73ff('0x3c')]);return db[_0x73ff('0x3f')][_0x73ff('0x43')](_0x1ff59d)[_0x73ff('0x20')](handleEntityNotFound(_0x2f071d,null))[_0x73ff('0x20')](respondWithResult(_0x2f071d,null))['catch'](handleError(_0x2f071d,null));};exports[_0x73ff('0x44')]=function(_0x15b28c,_0x3dc75e){return db[_0x73ff('0x3f')][_0x73ff('0x44')](_0x15b28c['body'],{})[_0x73ff('0x20')](function(_0x33712b){var _0x5cbda8=_0x15b28c[_0x73ff('0x45')][_0x73ff('0x21')]({'plain':!![]});if(!_0x5cbda8)throw new Error(_0x73ff('0x46'));if(_0x5cbda8['role']==='user'){var _0x3f706b=_0x33712b[_0x73ff('0x21')]({'plain':!![]});var _0x268b5e=_0x73ff('0x22');return db[_0x73ff('0x47')]['find']({'where':{'name':_0x268b5e,'userProfileId':_0x5cbda8[_0x73ff('0x48')]},'raw':!![]})['then'](function(_0x43f23f){if(_0x43f23f&&_0x43f23f[_0x73ff('0x49')]===0x0){return db[_0x73ff('0x23')][_0x73ff('0x44')]({'name':_0x3f706b[_0x73ff('0x4a')],'resourceId':_0x3f706b['id'],'type':_0x43f23f[_0x73ff('0x4a')],'sectionId':_0x43f23f['id']},{})[_0x73ff('0x20')](function(){return _0x33712b;});}else{return _0x33712b;}})[_0x73ff('0x4b')](function(_0x429a8e){logger[_0x73ff('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x429a8e);throw _0x429a8e;});}return _0x33712b;})[_0x73ff('0x20')](respondWithResult(_0x3dc75e,0xc9))['catch'](handleError(_0x3dc75e,null));};exports['update']=function(_0x57824a,_0x37d0c6){if(_0x57824a[_0x73ff('0x4d')]['id']){delete _0x57824a[_0x73ff('0x4d')]['id'];}return db['CmContactHasItem'][_0x73ff('0x43')]({'where':{'id':_0x57824a[_0x73ff('0x4e')]['id']}})[_0x73ff('0x20')](handleEntityNotFound(_0x37d0c6,null))[_0x73ff('0x20')](saveUpdates(_0x57824a[_0x73ff('0x4d')],null))[_0x73ff('0x20')](respondWithResult(_0x37d0c6,null))[_0x73ff('0x4b')](handleError(_0x37d0c6,null));};exports['destroy']=function(_0x3e378d,_0x652fd9){return db[_0x73ff('0x3f')][_0x73ff('0x43')]({'where':{'id':_0x3e378d[_0x73ff('0x4e')]['id']}})[_0x73ff('0x20')](handleEntityNotFound(_0x652fd9,null))[_0x73ff('0x20')](removeEntity(_0x652fd9,null))['catch'](handleError(_0x652fd9,null));}; \ No newline at end of file +var _0xe95e=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmContactHasItem','findAll','rows','show','includeAll','include','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../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','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','name','send','index','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty'];(function(_0xed759,_0x247163){var _0x169bb1=function(_0x27fda4){while(--_0x27fda4){_0xed759['push'](_0xed759['shift']());}};_0x169bb1(++_0x247163);}(_0xe95e,0xbf));var _0xee95=function(_0x32ef5a,_0x38647a){_0x32ef5a=_0x32ef5a-0x0;var _0x31c603=_0xe95e[_0x32ef5a];return _0x31c603;};'use strict';var emlformat=require(_0xee95('0x0'));var rimraf=require(_0xee95('0x1'));var zipdir=require(_0xee95('0x2'));var jsonpatch=require(_0xee95('0x3'));var rp=require(_0xee95('0x4'));var moment=require(_0xee95('0x5'));var BPromise=require(_0xee95('0x6'));var Mustache=require(_0xee95('0x7'));var util=require(_0xee95('0x8'));var path=require(_0xee95('0x9'));var sox=require(_0xee95('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee95('0xb'));var squel=require(_0xee95('0xc'));var crypto=require(_0xee95('0xd'));var jsforce=require(_0xee95('0xe'));var deskjs=require(_0xee95('0xf'));var toCsv=require(_0xee95('0x10'));var querystring=require(_0xee95('0x11'));var Papa=require(_0xee95('0x12'));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(_0xee95('0x13'));var logger=require(_0xee95('0x14'))(_0xee95('0x15'));var utils=require(_0xee95('0x16'));var config=require(_0xee95('0x17'));var licenseUtil=require(_0xee95('0x18'));var db=require(_0xee95('0x19'))['db'];function respondWithStatusCode(_0x250e07,_0x166128){_0x166128=_0x166128||0xcc;return function(_0xa67339){if(_0xa67339){return _0x250e07[_0xee95('0x1a')](_0x166128);}return _0x250e07[_0xee95('0x1b')](_0x166128)['end']();};}function respondWithResult(_0x38f08e,_0x101fd5){_0x101fd5=_0x101fd5||0xc8;return function(_0x474bd3){if(_0x474bd3){return _0x38f08e[_0xee95('0x1b')](_0x101fd5)['json'](_0x474bd3);}};}function respondWithFilteredResult(_0x491b4e,_0x144ca1){return function(_0x4ea030){if(_0x4ea030){var _0xaae6e6=typeof _0x144ca1[_0xee95('0x1c')]===_0xee95('0x1d')&&typeof _0x144ca1[_0xee95('0x1e')]===_0xee95('0x1d');var _0x26451b=_0x4ea030[_0xee95('0x1f')];var _0x1a1568=_0xaae6e6?0x0:_0x144ca1['offset'];var _0x561f01=_0xaae6e6?_0x4ea030[_0xee95('0x1f')]:_0x144ca1[_0xee95('0x1c')]+_0x144ca1[_0xee95('0x1e')];var _0x13431a;if(_0x561f01>=_0x26451b){_0x561f01=_0x26451b;_0x13431a=0xc8;}else{_0x13431a=0xce;}_0x491b4e[_0xee95('0x1b')](_0x13431a);return _0x491b4e[_0xee95('0x20')](_0xee95('0x21'),_0x1a1568+'-'+_0x561f01+'/'+_0x26451b)[_0xee95('0x22')](_0x4ea030);}return null;};}function patchUpdates(_0x2f6144){return function(_0x3236cc){try{jsonpatch[_0xee95('0x23')](_0x3236cc,_0x2f6144,!![]);}catch(_0x9c489a){return BPromise[_0xee95('0x24')](_0x9c489a);}return _0x3236cc[_0xee95('0x25')]();};}function saveUpdates(_0x3d2edc,_0x3a4107){return function(_0x20fd90){if(_0x20fd90){return _0x20fd90[_0xee95('0x26')](_0x3d2edc)['then'](function(_0x5a6848){return _0x5a6848;});}return null;};}function removeEntity(_0x3ccef6,_0x3b03c6){return function(_0x50751b){if(_0x50751b){return _0x50751b['destroy']()[_0xee95('0x27')](function(){var _0x5213d8=_0x50751b[_0xee95('0x28')]({'plain':!![]});var _0x566cee=_0xee95('0x29');return db[_0xee95('0x2a')][_0xee95('0x2b')]({'where':{'type':_0x566cee,'resourceId':_0x5213d8['id']}})[_0xee95('0x27')](function(){return _0x50751b;});})['then'](function(){_0x3ccef6[_0xee95('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xca99ae,_0x300721){return function(_0x202633){if(!_0x202633){_0xca99ae[_0xee95('0x1a')](0x194);}return _0x202633;};}function handleError(_0x182470,_0x354972){_0x354972=_0x354972||0x1f4;return function(_0x41ee47){logger['error'](_0x41ee47['stack']);if(_0x41ee47[_0xee95('0x2c')]){delete _0x41ee47[_0xee95('0x2c')];}_0x182470[_0xee95('0x1b')](_0x354972)[_0xee95('0x2d')](_0x41ee47);};}exports[_0xee95('0x2e')]=function(_0x42f5d3,_0x285f5f){var _0x4ad43d={},_0x460e22={},_0x137ebf={'count':0x0,'rows':[]};var _0x1eaefa=_['map'](db['CmContactHasItem']['rawAttributes'],function(_0x37ae1c){return{'name':_0x37ae1c['fieldName'],'type':_0x37ae1c[_0xee95('0x2f')][_0xee95('0x30')]};});_0x460e22['model']=_[_0xee95('0x31')](_0x1eaefa,'name');_0x460e22[_0xee95('0x32')]=_[_0xee95('0x33')](_0x42f5d3[_0xee95('0x32')]);_0x460e22[_0xee95('0x34')]=_[_0xee95('0x35')](_0x460e22[_0xee95('0x36')],_0x460e22[_0xee95('0x32')]);_0x4ad43d[_0xee95('0x37')]=_['intersection'](_0x460e22[_0xee95('0x36')],qs['fields'](_0x42f5d3[_0xee95('0x32')]['fields']));_0x4ad43d[_0xee95('0x37')]=_0x4ad43d[_0xee95('0x37')][_0xee95('0x38')]?_0x4ad43d[_0xee95('0x37')]:_0x460e22['model'];if(!_0x42f5d3['query'][_0xee95('0x39')](_0xee95('0x3a'))){_0x4ad43d[_0xee95('0x1e')]=qs[_0xee95('0x1e')](_0x42f5d3[_0xee95('0x32')]['limit']);_0x4ad43d[_0xee95('0x1c')]=qs[_0xee95('0x1c')](_0x42f5d3[_0xee95('0x32')][_0xee95('0x1c')]);}_0x4ad43d['order']=qs[_0xee95('0x3b')](_0x42f5d3['query'][_0xee95('0x3b')]);_0x4ad43d[_0xee95('0x3c')]=qs['filters'](_[_0xee95('0x3d')](_0x42f5d3['query'],_0x460e22['filters']),_0x1eaefa);if(_0x42f5d3[_0xee95('0x32')][_0xee95('0x3e')]){_0x4ad43d[_0xee95('0x3c')]=_[_0xee95('0x3f')](_0x4ad43d[_0xee95('0x3c')],{'$or':_[_0xee95('0x31')](_0x1eaefa,function(_0xde64ca){if(_0xde64ca['type']!==_0xee95('0x40')){var _0x1a6166={};_0x1a6166[_0xde64ca['name']]={'$like':'%'+_0x42f5d3[_0xee95('0x32')][_0xee95('0x3e')]+'%'};return _0x1a6166;}})});}_0x4ad43d=_[_0xee95('0x3f')]({},_0x4ad43d,_0x42f5d3[_0xee95('0x41')]);var _0x428a36={'where':_0x4ad43d[_0xee95('0x3c')]};return db[_0xee95('0x42')][_0xee95('0x1f')](_0x428a36)[_0xee95('0x27')](function(_0x7fe2b){_0x137ebf['count']=_0x7fe2b;if(_0x42f5d3[_0xee95('0x32')]['includeAll']){_0x4ad43d['include']=[{'all':!![]}];}return db[_0xee95('0x42')][_0xee95('0x43')](_0x4ad43d);})['then'](function(_0x249c0f){_0x137ebf[_0xee95('0x44')]=_0x249c0f;return _0x137ebf;})[_0xee95('0x27')](respondWithFilteredResult(_0x285f5f,_0x4ad43d))['catch'](handleError(_0x285f5f,null));};exports[_0xee95('0x45')]=function(_0x155a85,_0x1710f3){var _0x4181ea={'raw':!![],'where':{'id':_0x155a85['params']['id']}},_0x1fb16f={};_0x1fb16f[_0xee95('0x36')]=_['keys'](db['CmContactHasItem']['rawAttributes']);_0x1fb16f['query']=_[_0xee95('0x33')](_0x155a85[_0xee95('0x32')]);_0x1fb16f[_0xee95('0x34')]=_[_0xee95('0x35')](_0x1fb16f[_0xee95('0x36')],_0x1fb16f['query']);_0x4181ea[_0xee95('0x37')]=_['intersection'](_0x1fb16f['model'],qs['fields'](_0x155a85[_0xee95('0x32')]['fields']));_0x4181ea[_0xee95('0x37')]=_0x4181ea[_0xee95('0x37')]['length']?_0x4181ea[_0xee95('0x37')]:_0x1fb16f['model'];if(_0x155a85[_0xee95('0x32')][_0xee95('0x46')]){_0x4181ea[_0xee95('0x47')]=[{'all':!![]}];}_0x4181ea=_[_0xee95('0x3f')]({},_0x4181ea,_0x155a85['options']);return db[_0xee95('0x42')][_0xee95('0x48')](_0x4181ea)['then'](handleEntityNotFound(_0x1710f3,null))[_0xee95('0x27')](respondWithResult(_0x1710f3,null))[_0xee95('0x49')](handleError(_0x1710f3,null));};exports['create']=function(_0x462b3e,_0x45da5d){return db[_0xee95('0x42')][_0xee95('0x4a')](_0x462b3e['body'],{})[_0xee95('0x27')](function(_0x132dc2){var _0x244a4a=_0x462b3e[_0xee95('0x4b')][_0xee95('0x28')]({'plain':!![]});if(!_0x244a4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x244a4a[_0xee95('0x4c')]==='user'){var _0x53bcb1=_0x132dc2[_0xee95('0x28')]({'plain':!![]});var _0x1ec5e7='CmContactHasItems';return db[_0xee95('0x4d')][_0xee95('0x48')]({'where':{'name':_0x1ec5e7,'userProfileId':_0x244a4a[_0xee95('0x4e')]},'raw':!![]})[_0xee95('0x27')](function(_0x36ebf9){if(_0x36ebf9&&_0x36ebf9[_0xee95('0x4f')]===0x0){return db[_0xee95('0x2a')][_0xee95('0x4a')]({'name':_0x53bcb1[_0xee95('0x2c')],'resourceId':_0x53bcb1['id'],'type':_0x36ebf9[_0xee95('0x2c')],'sectionId':_0x36ebf9['id']},{})[_0xee95('0x27')](function(){return _0x132dc2;});}else{return _0x132dc2;}})[_0xee95('0x49')](function(_0x4d4ac7){logger[_0xee95('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d4ac7);throw _0x4d4ac7;});}return _0x132dc2;})[_0xee95('0x27')](respondWithResult(_0x45da5d,0xc9))[_0xee95('0x49')](handleError(_0x45da5d,null));};exports[_0xee95('0x26')]=function(_0x389658,_0x2bbd88){if(_0x389658['body']['id']){delete _0x389658[_0xee95('0x51')]['id'];}return db[_0xee95('0x42')][_0xee95('0x48')]({'where':{'id':_0x389658[_0xee95('0x52')]['id']}})[_0xee95('0x27')](handleEntityNotFound(_0x2bbd88,null))[_0xee95('0x27')](saveUpdates(_0x389658[_0xee95('0x51')],null))[_0xee95('0x27')](respondWithResult(_0x2bbd88,null))[_0xee95('0x49')](handleError(_0x2bbd88,null));};exports['destroy']=function(_0x2eb6a5,_0x504b63){return db['CmContactHasItem']['find']({'where':{'id':_0x2eb6a5[_0xee95('0x52')]['id']}})[_0xee95('0x27')](handleEntityNotFound(_0x504b63,null))['then'](removeEntity(_0x504b63,null))[_0xee95('0x49')](handleError(_0x504b63,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 9443f6c..4724447 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4742=['../../config/environment','exports','define','CmContactHasItem','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x24d4c6,_0x246fb0){var _0x1d43e6=function(_0x3b42c1){while(--_0x3b42c1){_0x24d4c6['push'](_0x24d4c6['shift']());}};_0x1d43e6(++_0x246fb0);}(_0x4742,0x10c));var _0x2474=function(_0x44f980,_0x105fc0){_0x44f980=_0x44f980-0x0;var _0x59ae66=_0x4742[_0x44f980];return _0x59ae66;};'use strict';var _=require(_0x2474('0x0'));var util=require('util');var logger=require(_0x2474('0x1'))(_0x2474('0x2'));var moment=require('moment');var BPromise=require(_0x2474('0x3'));var rp=require(_0x2474('0x4'));var fs=require('fs');var path=require(_0x2474('0x5'));var rimraf=require(_0x2474('0x6'));var config=require(_0x2474('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0x2474('0x8')]=function(_0x416972,_0x501a7a){return _0x416972[_0x2474('0x9')](_0x2474('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa656=['cm_contact_has_items','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x196267,_0x14865d){var _0x285525=function(_0x21ad44){while(--_0x21ad44){_0x196267['push'](_0x196267['shift']());}};_0x285525(++_0x14865d);}(_0xa656,0x115));var _0x6a65=function(_0x11074a,_0x26ab3e){_0x11074a=_0x11074a-0x0;var _0x5d24f8=_0xa656[_0x11074a];return _0x5d24f8;};'use strict';var _=require(_0x6a65('0x0'));var util=require(_0x6a65('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6a65('0x2'));var rp=require(_0x6a65('0x3'));var fs=require('fs');var path=require(_0x6a65('0x4'));var rimraf=require(_0x6a65('0x5'));var config=require(_0x6a65('0x6'));var attributes=require(_0x6a65('0x7'));module[_0x6a65('0x8')]=function(_0x4d0a65,_0x42308a){return _0x4d0a65[_0x6a65('0x9')](_0x6a65('0xa'),attributes,{'tableName':_0x6a65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index f85ead5..34d6d43 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8471=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x1b29ee,_0x8fef0a){var _0x26e9b9=function(_0x441742){while(--_0x441742){_0x1b29ee['push'](_0x1b29ee['shift']());}};_0x26e9b9(++_0x8fef0a);}(_0x8471,0xbf));var _0x1847=function(_0x1a129c,_0x513025){_0x1a129c=_0x1a129c-0x0;var _0x256de3=_0x8471[_0x1a129c];return _0x256de3;};'use strict';var _=require(_0x1847('0x0'));var util=require(_0x1847('0x1'));var moment=require(_0x1847('0x2'));var BPromise=require(_0x1847('0x3'));var rs=require(_0x1847('0x4'));var fs=require('fs');var Redis=require(_0x1847('0x5'));var db=require(_0x1847('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1847('0x7'))(_0x1847('0x8'));var config=require(_0x1847('0x9'));var jayson=require(_0x1847('0xa'));var client=jayson[_0x1847('0xb')][_0x1847('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15e135,_0x5d9f54,_0x464cfe){return new BPromise(function(_0x565cc6,_0x1dcf0b){return client[_0x1847('0xd')](_0x15e135,_0x464cfe)['then'](function(_0x88a915){logger[_0x1847('0xe')](_0x1847('0xf'),_0x5d9f54,'request\x20sent');logger[_0x1847('0x10')](_0x1847('0x11'),_0x5d9f54,'request\x20sent',JSON['stringify'](_0x88a915));if(_0x88a915[_0x1847('0x12')]){if(_0x88a915[_0x1847('0x12')][_0x1847('0x13')]===0x1f4){logger[_0x1847('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x5d9f54,_0x88a915[_0x1847('0x12')][_0x1847('0x14')]);return _0x1dcf0b(_0x88a915[_0x1847('0x12')]['message']);}logger[_0x1847('0x12')](_0x1847('0xf'),_0x5d9f54,_0x88a915[_0x1847('0x12')][_0x1847('0x14')]);return _0x565cc6(_0x88a915[_0x1847('0x12')]['message']);}else{logger['info'](_0x1847('0xf'),_0x5d9f54,_0x1847('0x15'));_0x565cc6(_0x88a915[_0x1847('0x16')][_0x1847('0x14')]);}})[_0x1847('0x17')](function(_0x2ccc88){logger['error'](_0x1847('0xf'),_0x5d9f54,_0x2ccc88);_0x1dcf0b(_0x2ccc88);});});} \ No newline at end of file +var _0xc446=['CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26fc3b,_0x2b1be3){var _0x380e31=function(_0x391a02){while(--_0x391a02){_0x26fc3b['push'](_0x26fc3b['shift']());}};_0x380e31(++_0x2b1be3);}(_0xc446,0x157));var _0x6c44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc446[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c44('0x0'));var util=require('util');var moment=require(_0x6c44('0x1'));var BPromise=require(_0x6c44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c44('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c44('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c44('0x5'));var jayson=require(_0x6c44('0x6'));var client=jayson[_0x6c44('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4edaaa,_0x348ae6,_0x5f50e3){return new BPromise(function(_0x3efd59,_0x2164be){return client[_0x6c44('0x8')](_0x4edaaa,_0x5f50e3)[_0x6c44('0x9')](function(_0x196a77){logger[_0x6c44('0xa')](_0x6c44('0xb'),_0x348ae6,_0x6c44('0xc'));logger[_0x6c44('0xd')](_0x6c44('0xe'),_0x348ae6,_0x6c44('0xc'),JSON[_0x6c44('0xf')](_0x196a77));if(_0x196a77['error']){if(_0x196a77[_0x6c44('0x10')][_0x6c44('0x11')]===0x1f4){logger[_0x6c44('0x10')](_0x6c44('0xb'),_0x348ae6,_0x196a77[_0x6c44('0x10')][_0x6c44('0x12')]);return _0x2164be(_0x196a77[_0x6c44('0x10')][_0x6c44('0x12')]);}logger[_0x6c44('0x10')](_0x6c44('0xb'),_0x348ae6,_0x196a77['error'][_0x6c44('0x12')]);return _0x3efd59(_0x196a77[_0x6c44('0x10')][_0x6c44('0x12')]);}else{logger[_0x6c44('0xa')](_0x6c44('0xb'),_0x348ae6,_0x6c44('0xc'));_0x3efd59(_0x196a77[_0x6c44('0x13')]['message']);}})[_0x6c44('0x14')](function(_0x15792b){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x348ae6,_0x15792b);_0x2164be(_0x15792b);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 685ad7b..c081fa8 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74a0=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','/:id'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x74a0,0x1ca));var _0x074a=function(_0x4049f9,_0x2f13a3){_0x4049f9=_0x4049f9-0x0;var _0x1e88f9=_0x74a0[_0x4049f9];return _0x1e88f9;};'use strict';var multer=require(_0x074a('0x0'));var util=require(_0x074a('0x1'));var path=require(_0x074a('0x2'));var timeout=require('connect-timeout');var express=require(_0x074a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x074a('0x4'));var interaction=require(_0x074a('0x5'));var config=require(_0x074a('0x6'));var controller=require(_0x074a('0x7'));router['get']('/',auth[_0x074a('0x8')](),controller['index']);router['get'](_0x074a('0x9'),auth[_0x074a('0x8')](),controller[_0x074a('0xa')]);router[_0x074a('0xb')]('/',auth[_0x074a('0x8')](),controller[_0x074a('0xc')]);router[_0x074a('0xd')](_0x074a('0x9'),auth[_0x074a('0x8')](),controller[_0x074a('0xe')]);router[_0x074a('0xf')]('/:id',auth[_0x074a('0x8')](),controller[_0x074a('0x10')]);module[_0x074a('0x11')]=router; \ No newline at end of file +var _0xc139=['Router','fs-extra','../../components/auth/service','./cmContactHasItem.controller','index','get','/:id','isAuthenticated','create','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xc139,0x10d));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9c13('0x0'));var timeout=require(_0x9c13('0x1'));var express=require(_0x9c13('0x2'));var router=express[_0x9c13('0x3')]();var fs_extra=require(_0x9c13('0x4'));var auth=require(_0x9c13('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c13('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9c13('0x7')]);router[_0x9c13('0x8')](_0x9c13('0x9'),auth[_0x9c13('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9c13('0xb')]);router['put']('/:id',auth[_0x9c13('0xa')](),controller[_0x9c13('0xc')]);router[_0x9c13('0xd')](_0x9c13('0x9'),auth[_0x9c13('0xa')](),controller[_0x9c13('0xe')]);module[_0x9c13('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 6e63ec9..7206986 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 _0x9777=['VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','long','type','select','parse','values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash','exports'];(function(_0x3753c8,_0x50a0cf){var _0x5b66b7=function(_0x46b6bd){while(--_0x46b6bd){_0x3753c8['push'](_0x3753c8['shift']());}};_0x5b66b7(++_0x50a0cf);}(_0x9777,0xbb));var _0x7977=function(_0x491f8f,_0x537d78){_0x491f8f=_0x491f8f-0x0;var _0x20a108=_0x9777[_0x491f8f];return _0x20a108;};'use strict';var Sequelize=require(_0x7977('0x0'));var _=require(_0x7977('0x1'));module[_0x7977('0x2')]={'name':{'type':Sequelize[_0x7977('0x3')],'get':function(_0x45634d){return this[_0x7977('0x4')]('alias');}},'alias':{'type':Sequelize[_0x7977('0x5')],'allowNull':![],'set':function(_0x5f30de){this[_0x7977('0x6')](_0x7977('0x7'),_0x5f30de?_0x5f30de:this[_0x7977('0x4')](_0x7977('0x8')));}},'type':{'type':Sequelize[_0x7977('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x7977('0x9')](_0x7977('0xa')),'get':function(){if(this[_0x7977('0x4')](_0x7977('0xb'))===_0x7977('0xc')){return JSON[_0x7977('0xd')](this[_0x7977('0x4')]('values'));}else{return this[_0x7977('0x4')](_0x7977('0xe'));}},'set':function(_0x40be23){if(Array[_0x7977('0xf')](_0x40be23)){this[_0x7977('0x6')](_0x7977('0xe'),JSON['stringify'](_0x40be23));}else{this[_0x7977('0x6')](_0x7977('0xe'),_0x40be23);}}},'required':{'type':Sequelize[_0x7977('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7977('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7977('0x11')](_0x7977('0x12'))}}; \ No newline at end of file +var _0x7900=['VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports'];(function(_0x808062,_0x9e69c4){var _0x2163ef=function(_0x2884f8){while(--_0x2884f8){_0x808062['push'](_0x808062['shift']());}};_0x2163ef(++_0x9e69c4);}(_0x7900,0x179));var _0x0790=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7900[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0790('0x0'));var _=require(_0x0790('0x1'));module[_0x0790('0x2')]={'name':{'type':Sequelize[_0x0790('0x3')],'get':function(_0x12229e){return this[_0x0790('0x4')](_0x0790('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3d4804){this[_0x0790('0x6')](_0x0790('0x5'),_0x3d4804?_0x3d4804:this[_0x0790('0x4')](_0x0790('0x7')));}},'type':{'type':Sequelize[_0x0790('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x0790('0x9')](_0x0790('0xa')),'get':function(){if(this[_0x0790('0x4')](_0x0790('0xb'))===_0x0790('0xc')){return JSON[_0x0790('0xd')](this['getDataValue'](_0x0790('0xe')));}else{return this[_0x0790('0x4')](_0x0790('0xe'));}},'set':function(_0x1da734){if(Array[_0x0790('0xf')](_0x1da734)){this[_0x0790('0x6')](_0x0790('0xe'),JSON[_0x0790('0x10')](_0x1da734));}else{this[_0x0790('0x6')](_0x0790('0xe'),_0x1da734);}}},'required':{'type':Sequelize[_0x0790('0x11')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0790('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0790('0x12')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 311ac44..c9b1dbe 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 _0xff91=['show','params','CmCustomField','length','catch','body','find','create','sequelize','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows'];(function(_0x6c85f8,_0x46e518){var _0x5d313e=function(_0x38b8eb){while(--_0x38b8eb){_0x6c85f8['push'](_0x6c85f8['shift']());}};_0x5d313e(++_0x46e518);}(_0xff91,0x116));var _0x1ff9=function(_0x451104,_0x5e979e){_0x451104=_0x451104-0x0;var _0xce5d43=_0xff91[_0x451104];return _0xce5d43;};'use strict';var emlformat=require(_0x1ff9('0x0'));var rimraf=require(_0x1ff9('0x1'));var zipdir=require(_0x1ff9('0x2'));var jsonpatch=require(_0x1ff9('0x3'));var rp=require(_0x1ff9('0x4'));var moment=require(_0x1ff9('0x5'));var BPromise=require(_0x1ff9('0x6'));var Mustache=require(_0x1ff9('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1ff9('0x8'));var ejs=require(_0x1ff9('0x9'));var fs=require('fs');var fs_extra=require(_0x1ff9('0xa'));var _=require(_0x1ff9('0xb'));var squel=require('squel');var crypto=require(_0x1ff9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1ff9('0xd'));var toCsv=require(_0x1ff9('0x8'));var querystring=require('querystring');var Papa=require(_0x1ff9('0xe'));var Redis=require(_0x1ff9('0xf'));var authService=require(_0x1ff9('0x10'));var qs=require(_0x1ff9('0x11'));var as=require(_0x1ff9('0x12'));var hardwareService=require(_0x1ff9('0x13'));var logger=require(_0x1ff9('0x14'))(_0x1ff9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1ff9('0x16'))['db'];function respondWithStatusCode(_0x4cbc3c,_0x2e6c6f){_0x2e6c6f=_0x2e6c6f||0xcc;return function(_0x2c1f40){if(_0x2c1f40){return _0x4cbc3c[_0x1ff9('0x17')](_0x2e6c6f);}return _0x4cbc3c[_0x1ff9('0x18')](_0x2e6c6f)[_0x1ff9('0x19')]();};}function respondWithResult(_0x4e119c,_0x40721d){_0x40721d=_0x40721d||0xc8;return function(_0x504405){if(_0x504405){return _0x4e119c[_0x1ff9('0x18')](_0x40721d)[_0x1ff9('0x1a')](_0x504405);}};}function respondWithFilteredResult(_0x3d2e91,_0x8a9817){return function(_0x400e83){if(_0x400e83){var _0x3ff97a=typeof _0x8a9817[_0x1ff9('0x1b')]==='undefined'&&typeof _0x8a9817['limit']===_0x1ff9('0x1c');var _0xacac60=_0x400e83[_0x1ff9('0x1d')];var _0x1a7822=_0x3ff97a?0x0:_0x8a9817[_0x1ff9('0x1b')];var _0x3ec761=_0x3ff97a?_0x400e83[_0x1ff9('0x1d')]:_0x8a9817[_0x1ff9('0x1b')]+_0x8a9817[_0x1ff9('0x1e')];var _0x347660;if(_0x3ec761>=_0xacac60){_0x3ec761=_0xacac60;_0x347660=0xc8;}else{_0x347660=0xce;}_0x3d2e91['status'](_0x347660);return _0x3d2e91['set'](_0x1ff9('0x1f'),_0x1a7822+'-'+_0x3ec761+'/'+_0xacac60)[_0x1ff9('0x1a')](_0x400e83);}return null;};}function patchUpdates(_0x4224b8){return function(_0xba4379){try{jsonpatch[_0x1ff9('0x20')](_0xba4379,_0x4224b8,!![]);}catch(_0x9dcdac){return BPromise[_0x1ff9('0x21')](_0x9dcdac);}return _0xba4379[_0x1ff9('0x22')]();};}function saveUpdates(_0x556eaf,_0x5b7f37){return function(_0x3bb662){if(_0x3bb662){return _0x3bb662[_0x1ff9('0x23')](_0x556eaf)[_0x1ff9('0x24')](function(_0x35441c){return _0x35441c;});}return null;};}function removeEntity(_0x28c62d,_0x149f8e){return function(_0x5754bf){if(_0x5754bf){return _0x5754bf[_0x1ff9('0x25')]()[_0x1ff9('0x24')](function(){_0x28c62d['status'](0xcc)[_0x1ff9('0x19')]();});}};}function handleEntityNotFound(_0x27a0be,_0x1cc7b6){return function(_0x2ec56a){if(!_0x2ec56a){_0x27a0be[_0x1ff9('0x17')](0x194);}return _0x2ec56a;};}function handleError(_0x1bb77a,_0x1d3bc3){_0x1d3bc3=_0x1d3bc3||0x1f4;return function(_0x291c1c){logger[_0x1ff9('0x26')](_0x291c1c['stack']);if(_0x291c1c[_0x1ff9('0x27')]){delete _0x291c1c['name'];}_0x1bb77a['status'](_0x1d3bc3)['send'](_0x291c1c);};}exports[_0x1ff9('0x28')]=function(_0x8a463e,_0x4bbbe8){var _0x18759a={},_0x1c3049={},_0x3f7b6a={'count':0x0,'rows':[]};var _0x59c758=_[_0x1ff9('0x29')](db['CmCustomField'][_0x1ff9('0x2a')],function(_0x50830b){return{'name':_0x50830b[_0x1ff9('0x2b')],'type':_0x50830b[_0x1ff9('0x2c')][_0x1ff9('0x2d')]};});_0x1c3049[_0x1ff9('0x2e')]=_[_0x1ff9('0x2f')](_[_0x1ff9('0x29')](_0x59c758,'name'),['name']);_0x1c3049[_0x1ff9('0x30')]=_[_0x1ff9('0x31')](_0x8a463e[_0x1ff9('0x30')]);_0x1c3049['filters']=_[_0x1ff9('0x32')](_0x1c3049[_0x1ff9('0x2e')],_0x1c3049[_0x1ff9('0x30')]);_0x18759a[_0x1ff9('0x33')]=_[_0x1ff9('0x32')](_0x1c3049['model'],qs[_0x1ff9('0x34')](_0x8a463e['query'][_0x1ff9('0x34')]));_0x18759a['attributes']=_0x18759a[_0x1ff9('0x33')]['length']?_0x18759a['attributes']:_0x1c3049['model'];if(!_0x8a463e[_0x1ff9('0x30')][_0x1ff9('0x35')](_0x1ff9('0x36'))){_0x18759a[_0x1ff9('0x1e')]=qs[_0x1ff9('0x1e')](_0x8a463e[_0x1ff9('0x30')][_0x1ff9('0x1e')]);_0x18759a[_0x1ff9('0x1b')]=qs[_0x1ff9('0x1b')](_0x8a463e[_0x1ff9('0x30')][_0x1ff9('0x1b')]);}_0x18759a['order']=qs[_0x1ff9('0x37')](_0x8a463e[_0x1ff9('0x30')][_0x1ff9('0x37')]);_0x18759a['where']=qs[_0x1ff9('0x38')](_[_0x1ff9('0x39')](_0x8a463e[_0x1ff9('0x30')],_0x1c3049[_0x1ff9('0x38')]),_0x59c758);if(_0x8a463e['query'][_0x1ff9('0x3a')]){_0x18759a[_0x1ff9('0x3b')]=_[_0x1ff9('0x3c')](_0x18759a[_0x1ff9('0x3b')],{'$or':_['map'](_0x59c758,function(_0x178a0d){if(_0x178a0d[_0x1ff9('0x2c')]!=='VIRTUAL'){var _0x45d37f={};_0x45d37f[_0x178a0d[_0x1ff9('0x27')]]={'$like':'%'+_0x8a463e[_0x1ff9('0x30')]['filter']+'%'};return _0x45d37f;}})});}_0x18759a=_[_0x1ff9('0x3c')]({},_0x18759a,_0x8a463e[_0x1ff9('0x3d')]);var _0x3ddef2={'where':_0x18759a[_0x1ff9('0x3b')]};return db['CmCustomField'][_0x1ff9('0x1d')](_0x3ddef2)[_0x1ff9('0x24')](function(_0x58c026){_0x3f7b6a['count']=_0x58c026;if(_0x8a463e[_0x1ff9('0x30')][_0x1ff9('0x3e')]){_0x18759a[_0x1ff9('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0x1ff9('0x40')](_0x18759a);})[_0x1ff9('0x24')](function(_0x50148c){_0x3f7b6a[_0x1ff9('0x41')]=_0x50148c;return _0x3f7b6a;})['then'](respondWithFilteredResult(_0x4bbbe8,_0x18759a))['catch'](handleError(_0x4bbbe8,null));};exports[_0x1ff9('0x42')]=function(_0x18ddea,_0x1105d6){var _0x2b5b77={'raw':!![],'where':{'id':_0x18ddea[_0x1ff9('0x43')]['id']}},_0x221bc1={};_0x221bc1['model']=_[_0x1ff9('0x31')](db[_0x1ff9('0x44')]['rawAttributes']);_0x221bc1[_0x1ff9('0x30')]=_[_0x1ff9('0x31')](_0x18ddea[_0x1ff9('0x30')]);_0x221bc1[_0x1ff9('0x38')]=_[_0x1ff9('0x32')](_0x221bc1[_0x1ff9('0x2e')],_0x221bc1[_0x1ff9('0x30')]);_0x2b5b77[_0x1ff9('0x33')]=_[_0x1ff9('0x32')](_0x221bc1['model'],qs[_0x1ff9('0x34')](_0x18ddea[_0x1ff9('0x30')][_0x1ff9('0x34')]));_0x2b5b77[_0x1ff9('0x33')]=_0x2b5b77[_0x1ff9('0x33')][_0x1ff9('0x45')]?_0x2b5b77[_0x1ff9('0x33')]:_0x221bc1['model'];if(_0x18ddea['query'][_0x1ff9('0x3e')]){_0x2b5b77['include']=[{'all':!![]}];}_0x2b5b77=_[_0x1ff9('0x3c')]({},_0x2b5b77,_0x18ddea[_0x1ff9('0x3d')]);return db['CmCustomField']['find'](_0x2b5b77)[_0x1ff9('0x24')](handleEntityNotFound(_0x1105d6,null))[_0x1ff9('0x24')](respondWithResult(_0x1105d6,null))[_0x1ff9('0x46')](handleError(_0x1105d6,null));};exports[_0x1ff9('0x23')]=function(_0x32d458,_0x3c8925){if(_0x32d458[_0x1ff9('0x47')]['id']){delete _0x32d458['body']['id'];}return db[_0x1ff9('0x44')][_0x1ff9('0x48')]({'where':{'id':_0x32d458[_0x1ff9('0x43')]['id']}})[_0x1ff9('0x24')](handleEntityNotFound(_0x3c8925,null))['then'](saveUpdates(_0x32d458[_0x1ff9('0x47')],null))['then'](respondWithResult(_0x3c8925,null))[_0x1ff9('0x46')](handleError(_0x3c8925,null));};exports[_0x1ff9('0x25')]=function(_0x1d3e6f,_0x3db062){return db[_0x1ff9('0x44')][_0x1ff9('0x48')]({'where':{'id':_0x1d3e6f['params']['id']}})[_0x1ff9('0x24')](handleEntityNotFound(_0x3db062,null))[_0x1ff9('0x24')](removeEntity(_0x3db062,null))[_0x1ff9('0x46')](handleError(_0x3db062,null));};exports[_0x1ff9('0x49')]=function(_0x1148e8,_0x3e9b77){var _0x178649;return db[_0x1ff9('0x4a')]['transaction'](function(_0x3c93f5){return db[_0x1ff9('0x44')][_0x1ff9('0x49')](_0x1148e8[_0x1ff9('0x47')],{'transaction':_0x3c93f5})[_0x1ff9('0x24')](function(_0x1d9e49){_0x178649=_0x1d9e49;var _0xad6a43={'type':db[_0x1ff9('0x4b')]['TEXT'],'transaction':_0x3c93f5};switch(_0x1148e8[_0x1ff9('0x47')][_0x1ff9('0x2c')]){case _0x1ff9('0x4c'):_0xad6a43['type']=db['Sequelize'][_0x1ff9('0x4d')];break;case _0x1ff9('0x4e'):_0xad6a43[_0x1ff9('0x2c')]=db[_0x1ff9('0x4b')][_0x1ff9('0x4f')];break;case _0x1ff9('0x50'):_0xad6a43[_0x1ff9('0x2c')]=db[_0x1ff9('0x4b')][_0x1ff9('0x51')];_0xad6a43[_0x1ff9('0x52')]=![];break;default:}return db['sequelize']['queryInterface'][_0x1ff9('0x53')](_0x1ff9('0x54'),util['format'](_0x1ff9('0x55'),_0x178649['id']),_0xad6a43);})[_0x1ff9('0x24')](function(){return _0x178649;});})['then'](respondWithResult(_0x3e9b77,0xc9))[_0x1ff9('0x46')](handleError(_0x3e9b77,null));}; \ No newline at end of file +var _0x5860=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','body','sequelize','transaction','create','Sequelize','TEXT','text','INTEGER','switch','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x29449d,_0x241933){var _0xe88c81=function(_0x475fa7){while(--_0x475fa7){_0x29449d['push'](_0x29449d['shift']());}};_0xe88c81(++_0x241933);}(_0x5860,0x147));var _0x0586=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x5860[_0x2af29a];return _0x5ef02f;};'use strict';var emlformat=require(_0x0586('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0586('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0586('0x2'));var moment=require(_0x0586('0x3'));var BPromise=require(_0x0586('0x4'));var Mustache=require('mustache');var util=require(_0x0586('0x5'));var path=require(_0x0586('0x6'));var sox=require(_0x0586('0x7'));var csv=require(_0x0586('0x8'));var ejs=require(_0x0586('0x9'));var fs=require('fs');var fs_extra=require(_0x0586('0xa'));var _=require(_0x0586('0xb'));var squel=require(_0x0586('0xc'));var crypto=require(_0x0586('0xd'));var jsforce=require(_0x0586('0xe'));var deskjs=require(_0x0586('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0586('0x10'));var Papa=require(_0x0586('0x11'));var Redis=require(_0x0586('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0586('0x13'));var hardwareService=require(_0x0586('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0586('0x15'));var licenseUtil=require(_0x0586('0x16'));var db=require(_0x0586('0x17'))['db'];function respondWithStatusCode(_0x2062e4,_0x580046){_0x580046=_0x580046||0xcc;return function(_0x43af67){if(_0x43af67){return _0x2062e4[_0x0586('0x18')](_0x580046);}return _0x2062e4[_0x0586('0x19')](_0x580046)[_0x0586('0x1a')]();};}function respondWithResult(_0x115743,_0x56581){_0x56581=_0x56581||0xc8;return function(_0x463cc4){if(_0x463cc4){return _0x115743[_0x0586('0x19')](_0x56581)[_0x0586('0x1b')](_0x463cc4);}};}function respondWithFilteredResult(_0x2562ae,_0x5a0488){return function(_0x39df84){if(_0x39df84){var _0x343752=typeof _0x5a0488[_0x0586('0x1c')]===_0x0586('0x1d')&&typeof _0x5a0488[_0x0586('0x1e')]==='undefined';var _0x433ce2=_0x39df84[_0x0586('0x1f')];var _0x6e944a=_0x343752?0x0:_0x5a0488[_0x0586('0x1c')];var _0x799a33=_0x343752?_0x39df84[_0x0586('0x1f')]:_0x5a0488['offset']+_0x5a0488[_0x0586('0x1e')];var _0x18b7b0;if(_0x799a33>=_0x433ce2){_0x799a33=_0x433ce2;_0x18b7b0=0xc8;}else{_0x18b7b0=0xce;}_0x2562ae['status'](_0x18b7b0);return _0x2562ae['set'](_0x0586('0x20'),_0x6e944a+'-'+_0x799a33+'/'+_0x433ce2)[_0x0586('0x1b')](_0x39df84);}return null;};}function patchUpdates(_0x37529b){return function(_0x51e6b5){try{jsonpatch[_0x0586('0x21')](_0x51e6b5,_0x37529b,!![]);}catch(_0x112602){return BPromise[_0x0586('0x22')](_0x112602);}return _0x51e6b5[_0x0586('0x23')]();};}function saveUpdates(_0x265ab7,_0x247021){return function(_0x18c9a4){if(_0x18c9a4){return _0x18c9a4[_0x0586('0x24')](_0x265ab7)[_0x0586('0x25')](function(_0x625716){return _0x625716;});}return null;};}function removeEntity(_0x1522cd,_0x2d9cab){return function(_0x136e1f){if(_0x136e1f){return _0x136e1f['destroy']()['then'](function(){_0x1522cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa6d0,_0x4c416f){return function(_0x392708){if(!_0x392708){_0x4aa6d0[_0x0586('0x18')](0x194);}return _0x392708;};}function handleError(_0x4ea105,_0x4d7a52){_0x4d7a52=_0x4d7a52||0x1f4;return function(_0x2699d4){logger[_0x0586('0x26')](_0x2699d4['stack']);if(_0x2699d4[_0x0586('0x27')]){delete _0x2699d4['name'];}_0x4ea105[_0x0586('0x19')](_0x4d7a52)['send'](_0x2699d4);};}exports[_0x0586('0x28')]=function(_0x188c43,_0x7157c9){var _0xd77392={},_0x10e10d={},_0x345bf7={'count':0x0,'rows':[]};var _0x313fe4=_[_0x0586('0x29')](db[_0x0586('0x2a')][_0x0586('0x2b')],function(_0xa7bce){return{'name':_0xa7bce[_0x0586('0x2c')],'type':_0xa7bce[_0x0586('0x2d')][_0x0586('0x2e')]};});_0x10e10d[_0x0586('0x2f')]=_[_0x0586('0x30')](_[_0x0586('0x29')](_0x313fe4,_0x0586('0x27')),[_0x0586('0x27')]);_0x10e10d[_0x0586('0x31')]=_[_0x0586('0x32')](_0x188c43[_0x0586('0x31')]);_0x10e10d[_0x0586('0x33')]=_['intersection'](_0x10e10d[_0x0586('0x2f')],_0x10e10d['query']);_0xd77392[_0x0586('0x34')]=_[_0x0586('0x35')](_0x10e10d['model'],qs[_0x0586('0x36')](_0x188c43[_0x0586('0x31')]['fields']));_0xd77392[_0x0586('0x34')]=_0xd77392[_0x0586('0x34')]['length']?_0xd77392[_0x0586('0x34')]:_0x10e10d[_0x0586('0x2f')];if(!_0x188c43[_0x0586('0x31')][_0x0586('0x37')](_0x0586('0x38'))){_0xd77392['limit']=qs[_0x0586('0x1e')](_0x188c43[_0x0586('0x31')]['limit']);_0xd77392[_0x0586('0x1c')]=qs[_0x0586('0x1c')](_0x188c43[_0x0586('0x31')][_0x0586('0x1c')]);}_0xd77392[_0x0586('0x39')]=qs[_0x0586('0x3a')](_0x188c43[_0x0586('0x31')][_0x0586('0x3a')]);_0xd77392[_0x0586('0x3b')]=qs[_0x0586('0x33')](_[_0x0586('0x3c')](_0x188c43['query'],_0x10e10d[_0x0586('0x33')]),_0x313fe4);if(_0x188c43[_0x0586('0x31')][_0x0586('0x3d')]){_0xd77392['where']=_[_0x0586('0x3e')](_0xd77392[_0x0586('0x3b')],{'$or':_[_0x0586('0x29')](_0x313fe4,function(_0x130d96){if(_0x130d96[_0x0586('0x2d')]!=='VIRTUAL'){var _0x127f9b={};_0x127f9b[_0x130d96[_0x0586('0x27')]]={'$like':'%'+_0x188c43[_0x0586('0x31')]['filter']+'%'};return _0x127f9b;}})});}_0xd77392=_['merge']({},_0xd77392,_0x188c43[_0x0586('0x3f')]);var _0xb46915={'where':_0xd77392[_0x0586('0x3b')]};return db['CmCustomField'][_0x0586('0x1f')](_0xb46915)[_0x0586('0x25')](function(_0x3b4bca){_0x345bf7['count']=_0x3b4bca;if(_0x188c43[_0x0586('0x31')][_0x0586('0x40')]){_0xd77392['include']=[{'all':!![]}];}return db['CmCustomField'][_0x0586('0x41')](_0xd77392);})[_0x0586('0x25')](function(_0x1e270b){_0x345bf7[_0x0586('0x42')]=_0x1e270b;return _0x345bf7;})[_0x0586('0x25')](respondWithFilteredResult(_0x7157c9,_0xd77392))['catch'](handleError(_0x7157c9,null));};exports[_0x0586('0x43')]=function(_0x56d7b0,_0x520929){var _0x1c7cdd={'raw':!![],'where':{'id':_0x56d7b0[_0x0586('0x44')]['id']}},_0x36f7c3={};_0x36f7c3[_0x0586('0x2f')]=_[_0x0586('0x32')](db[_0x0586('0x2a')][_0x0586('0x2b')]);_0x36f7c3['query']=_['keys'](_0x56d7b0[_0x0586('0x31')]);_0x36f7c3[_0x0586('0x33')]=_[_0x0586('0x35')](_0x36f7c3[_0x0586('0x2f')],_0x36f7c3['query']);_0x1c7cdd[_0x0586('0x34')]=_['intersection'](_0x36f7c3['model'],qs[_0x0586('0x36')](_0x56d7b0[_0x0586('0x31')][_0x0586('0x36')]));_0x1c7cdd[_0x0586('0x34')]=_0x1c7cdd['attributes']['length']?_0x1c7cdd[_0x0586('0x34')]:_0x36f7c3[_0x0586('0x2f')];if(_0x56d7b0[_0x0586('0x31')][_0x0586('0x40')]){_0x1c7cdd[_0x0586('0x45')]=[{'all':!![]}];}_0x1c7cdd=_[_0x0586('0x3e')]({},_0x1c7cdd,_0x56d7b0['options']);return db[_0x0586('0x2a')][_0x0586('0x46')](_0x1c7cdd)[_0x0586('0x25')](handleEntityNotFound(_0x520929,null))[_0x0586('0x25')](respondWithResult(_0x520929,null))[_0x0586('0x47')](handleError(_0x520929,null));};exports[_0x0586('0x24')]=function(_0x4059e2,_0x47e19a){if(_0x4059e2[_0x0586('0x48')]['id']){delete _0x4059e2[_0x0586('0x48')]['id'];}return db[_0x0586('0x2a')]['find']({'where':{'id':_0x4059e2['params']['id']}})[_0x0586('0x25')](handleEntityNotFound(_0x47e19a,null))['then'](saveUpdates(_0x4059e2[_0x0586('0x48')],null))[_0x0586('0x25')](respondWithResult(_0x47e19a,null))[_0x0586('0x47')](handleError(_0x47e19a,null));};exports['destroy']=function(_0x4980dd,_0xcddb67){return db[_0x0586('0x2a')][_0x0586('0x46')]({'where':{'id':_0x4980dd[_0x0586('0x44')]['id']}})[_0x0586('0x25')](handleEntityNotFound(_0xcddb67,null))['then'](removeEntity(_0xcddb67,null))[_0x0586('0x47')](handleError(_0xcddb67,null));};exports['create']=function(_0x1e2db6,_0x696097){var _0x534555;return db[_0x0586('0x49')][_0x0586('0x4a')](function(_0x466c6a){return db[_0x0586('0x2a')][_0x0586('0x4b')](_0x1e2db6['body'],{'transaction':_0x466c6a})[_0x0586('0x25')](function(_0x2be908){_0x534555=_0x2be908;var _0x23a4d2={'type':db[_0x0586('0x4c')][_0x0586('0x4d')],'transaction':_0x466c6a};switch(_0x1e2db6['body']['type']){case _0x0586('0x4e'):_0x23a4d2[_0x0586('0x2d')]=db[_0x0586('0x4c')][_0x0586('0x4d')];break;case'number':_0x23a4d2[_0x0586('0x2d')]=db[_0x0586('0x4c')][_0x0586('0x4f')];break;case _0x0586('0x50'):_0x23a4d2['type']=db['Sequelize']['BOOLEAN'];_0x23a4d2[_0x0586('0x51')]=![];break;default:}return db[_0x0586('0x49')]['queryInterface'][_0x0586('0x52')](_0x0586('0x53'),util[_0x0586('0x54')](_0x0586('0x55'),_0x534555['id']),_0x23a4d2);})[_0x0586('0x25')](function(){return _0x534555;});})[_0x0586('0x25')](respondWithResult(_0x696097,0xc9))[_0x0586('0x47')](handleError(_0x696097,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 32fc88c..fe3693d 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 _0x2130=['exports','lodash','util','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x373893,_0x20f9aa){var _0x345720=function(_0x3d3e80){while(--_0x3d3e80){_0x373893['push'](_0x373893['shift']());}};_0x345720(++_0x20f9aa);}(_0x2130,0x10f));var _0x0213=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x2130[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x0213('0x0'));var util=require(_0x0213('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0213('0x2'));var config=require(_0x0213('0x3'));var attributes=require(_0x0213('0x4'));module[_0x0213('0x5')]=function(_0x49a273,_0x83771){return _0x49a273['define']('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe31f=['define','CmCustomField','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x31937f,_0x11e249){var _0x46eaec=function(_0x279aed){while(--_0x279aed){_0x31937f['push'](_0x31937f['shift']());}};_0x46eaec(++_0x11e249);}(_0xe31f,0x15e));var _0xfe31=function(_0xaee2ba,_0x5e1e67){_0xaee2ba=_0xaee2ba-0x0;var _0x16d8c1=_0xe31f[_0xaee2ba];return _0x16d8c1;};'use strict';var _=require(_0xfe31('0x0'));var util=require(_0xfe31('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfe31('0x2'));var BPromise=require(_0xfe31('0x3'));var rp=require(_0xfe31('0x4'));var fs=require('fs');var path=require(_0xfe31('0x5'));var rimraf=require(_0xfe31('0x6'));var config=require(_0xfe31('0x7'));var attributes=require(_0xfe31('0x8'));module[_0xfe31('0x9')]=function(_0x4c9d98,_0x4d3ac0){return _0x4c9d98[_0xfe31('0xa')](_0xfe31('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index c1ec58e..268bb61 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 _0x4a64=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util'];(function(_0x2f7bec,_0x27b9f6){var _0x5d1c2e=function(_0x442b0a){while(--_0x442b0a){_0x2f7bec['push'](_0x2f7bec['shift']());}};_0x5d1c2e(++_0x27b9f6);}(_0x4a64,0x1cd));var _0x44a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a64[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x44a6('0x0'));var moment=require(_0x44a6('0x1'));var BPromise=require(_0x44a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44a6('0x3'));var db=require(_0x44a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x44a6('0x5'))(_0x44a6('0x6'));var config=require(_0x44a6('0x7'));var jayson=require(_0x44a6('0x8'));var client=jayson[_0x44a6('0x9')][_0x44a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58e312,_0x49447c,_0x26f45d){return new BPromise(function(_0x248c43,_0x2fb6db){return client[_0x44a6('0xb')](_0x58e312,_0x26f45d)[_0x44a6('0xc')](function(_0x5a51ec){logger[_0x44a6('0xd')](_0x44a6('0xe'),_0x49447c,_0x44a6('0xf'));logger[_0x44a6('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x49447c,'request\x20sent',JSON[_0x44a6('0x11')](_0x5a51ec));if(_0x5a51ec[_0x44a6('0x12')]){if(_0x5a51ec['error'][_0x44a6('0x13')]===0x1f4){logger[_0x44a6('0x12')](_0x44a6('0xe'),_0x49447c,_0x5a51ec['error']['message']);return _0x2fb6db(_0x5a51ec[_0x44a6('0x12')][_0x44a6('0x14')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x49447c,_0x5a51ec[_0x44a6('0x12')][_0x44a6('0x14')]);return _0x248c43(_0x5a51ec['error']['message']);}else{logger[_0x44a6('0xd')](_0x44a6('0xe'),_0x49447c,_0x44a6('0xf'));_0x248c43(_0x5a51ec['result'][_0x44a6('0x14')]);}})['catch'](function(_0x2b11a7){logger['error'](_0x44a6('0xe'),_0x49447c,_0x2b11a7);_0x2fb6db(_0x2b11a7);});});} \ No newline at end of file +var _0xa1a9=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3ce00b,_0x3a9c7f){var _0x2cb40e=function(_0x2b3f5f){while(--_0x2b3f5f){_0x3ce00b['push'](_0x3ce00b['shift']());}};_0x2cb40e(++_0x3a9c7f);}(_0xa1a9,0xd4));var _0x9a1a=function(_0x1a334f,_0x177b97){_0x1a334f=_0x1a334f-0x0;var _0x2f9710=_0xa1a9[_0x1a334f];return _0x2f9710;};'use strict';var _=require(_0x9a1a('0x0'));var util=require('util');var moment=require(_0x9a1a('0x1'));var BPromise=require(_0x9a1a('0x2'));var rs=require(_0x9a1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a1a('0x4'))['db'];var utils=require(_0x9a1a('0x5'));var logger=require(_0x9a1a('0x6'))(_0x9a1a('0x7'));var config=require('../../config/environment');var jayson=require(_0x9a1a('0x8'));var client=jayson[_0x9a1a('0x9')][_0x9a1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25b8c6,_0x2ba4ab,_0x4336a5){return new BPromise(function(_0x1deb18,_0x2dfea0){return client[_0x9a1a('0xb')](_0x25b8c6,_0x4336a5)[_0x9a1a('0xc')](function(_0x592edd){logger[_0x9a1a('0xd')](_0x9a1a('0xe'),_0x2ba4ab,_0x9a1a('0xf'));logger[_0x9a1a('0x10')](_0x9a1a('0x11'),_0x2ba4ab,_0x9a1a('0xf'),JSON[_0x9a1a('0x12')](_0x592edd));if(_0x592edd[_0x9a1a('0x13')]){if(_0x592edd['error'][_0x9a1a('0x14')]===0x1f4){logger[_0x9a1a('0x13')]('CmCustomField,\x20%s,\x20%s',_0x2ba4ab,_0x592edd['error'][_0x9a1a('0x15')]);return _0x2dfea0(_0x592edd[_0x9a1a('0x13')][_0x9a1a('0x15')]);}logger[_0x9a1a('0x13')](_0x9a1a('0xe'),_0x2ba4ab,_0x592edd[_0x9a1a('0x13')][_0x9a1a('0x15')]);return _0x1deb18(_0x592edd['error'][_0x9a1a('0x15')]);}else{logger[_0x9a1a('0xd')](_0x9a1a('0xe'),_0x2ba4ab,_0x9a1a('0xf'));_0x1deb18(_0x592edd[_0x9a1a('0x16')][_0x9a1a('0x15')]);}})[_0x9a1a('0x17')](function(_0x23da7c){logger[_0x9a1a('0x13')](_0x9a1a('0xe'),_0x2ba4ab,_0x23da7c);_0x2dfea0(_0x23da7c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0698cdb..3cf90ef 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 _0xd6bb=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0xd6bb[_0x5e6bec];return _0x5dc5cf;};'use strict';var multer=require(_0xbd6b('0x0'));var util=require('util');var path=require(_0xbd6b('0x1'));var timeout=require(_0xbd6b('0x2'));var express=require(_0xbd6b('0x3'));var router=express[_0xbd6b('0x4')]();var fs_extra=require(_0xbd6b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbd6b('0x6'));var config=require(_0xbd6b('0x7'));var controller=require(_0xbd6b('0x8'));router['get']('/',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xa')]);router[_0xbd6b('0xb')](_0xbd6b('0xc'),auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xd')]);router[_0xbd6b('0xe')]('/',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xf')]);router[_0xbd6b('0x10')](_0xbd6b('0xc'),auth['isAuthenticated'](),controller[_0xbd6b('0x11')]);router[_0xbd6b('0x12')]('/:id',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xecb2=['show','post','put','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','isAuthenticated'];(function(_0x48d737,_0x338ed9){var _0x12e5c8=function(_0x3fed01){while(--_0x3fed01){_0x48d737['push'](_0x48d737['shift']());}};_0x12e5c8(++_0x338ed9);}(_0xecb2,0xf6));var _0x2ecb=function(_0x5a46e7,_0x3be817){_0x5a46e7=_0x5a46e7-0x0;var _0x373f31=_0xecb2[_0x5a46e7];return _0x373f31;};'use strict';var multer=require(_0x2ecb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ecb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ecb('0x2'));var auth=require(_0x2ecb('0x3'));var interaction=require(_0x2ecb('0x4'));var config=require(_0x2ecb('0x5'));var controller=require(_0x2ecb('0x6'));router[_0x2ecb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller[_0x2ecb('0xa')]);router[_0x2ecb('0xb')]('/',auth[_0x2ecb('0x9')](),controller['create']);router[_0x2ecb('0xc')](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller['update']);router[_0x2ecb('0xd')](_0x2ecb('0x8'),auth[_0x2ecb('0x9')](),controller[_0x2ecb('0xe')]);module[_0x2ecb('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index af6ab2c..11a7bec 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 _0x2d85=['INTEGER','UNSIGNED','contactListQueue','STRING','exports','BOOLEAN','DATE'];(function(_0x3760fb,_0x459816){var _0x39040e=function(_0x141361){while(--_0x141361){_0x3760fb['push'](_0x3760fb['shift']());}};_0x39040e(++_0x459816);}(_0x2d85,0x10e));var _0x52d8=function(_0x4efb90,_0x493995){_0x4efb90=_0x4efb90-0x0;var _0x524a80=_0x2d85[_0x4efb90];return _0x524a80;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x52d8('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x52d8('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x52d8('0x2')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x52d8('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x52d8('0x3')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x52d8('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x52d8('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x52d8('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x52d8('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x52d8('0x3')],'unique':_0x52d8('0x5')},'ListId':{'type':Sequelize[_0x52d8('0x3')],'unique':_0x52d8('0x5')},'UserId':{'type':Sequelize[_0x52d8('0x3')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x52d8('0x5')},'CampaignId':{'type':Sequelize[_0x52d8('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x52d8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x52d8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x52d8('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x52d8('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x52d8('0x3')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x52d8('0x6')]},'recallmeNotifiedDate':{'type':Sequelize[_0x52d8('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x8c54=['format','INTEGER','DATE','contactListQueue','sequelize','STRING','BOOLEAN'];(function(_0x4ae89d,_0x5af74b){var _0x411fd7=function(_0x14079d){while(--_0x14079d){_0x4ae89d['push'](_0x4ae89d['shift']());}};_0x411fd7(++_0x5af74b);}(_0x8c54,0x1ee));var _0x48c5=function(_0x2f419b,_0x3e2405){_0x2f419b=_0x2f419b-0x0;var _0x32ef8f=_0x8c54[_0x2f419b];return _0x32ef8f;};'use strict';var moment=require('moment');var Sequelize=require(_0x48c5('0x0'));module['exports']={'phone':{'type':Sequelize[_0x48c5('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x48c5('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x48c5('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x48c5('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x48c5('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x48c5('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x48c5('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x48c5('0x5')]},'priority':{'type':Sequelize[_0x48c5('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x48c5('0x4')],'unique':_0x48c5('0x6')},'UserId':{'type':Sequelize[_0x48c5('0x4')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x48c5('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x48c5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x48c5('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x48c5('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x48c5('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x48c5('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index b11a2e3..e4d9942 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 _0x202c=['update','then','error','name','send','index','rawAttributes','fieldName','type','key','keys','query','model','filters','concat','$and','$or','$lt','$lte','$ne','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','length','find','create','body','describe','destroy','params','CampaignId','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','UserId','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','map','prev','isEmpty','hopperIds','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','CmCompany','Company','List','Queue','CmContact','VoiceQueue','getOpenContacts','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','moment','../../config/logger','api','../../config/environment','status','undefined','limit','count','offset','Content-Range','json'];(function(_0x496ce8,_0x1dc145){var _0x3b93c6=function(_0x594d91){while(--_0x594d91){_0x496ce8['push'](_0x496ce8['shift']());}};_0x3b93c6(++_0x1dc145);}(_0x202c,0x178));var _0xc202=function(_0x4f9621,_0x402691){_0x4f9621=_0x4f9621-0x0;var _0x338c02=_0x202c[_0x4f9621];return _0x338c02;};'use strict';var moment=require(_0xc202('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xc202('0x1'))(_0xc202('0x2'));var shared=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x215161,_0x155c3b){_0x155c3b=_0x155c3b||0xc8;return function(_0x1763f5){if(_0x1763f5){return _0x215161[_0xc202('0x4')](_0x155c3b)['json'](_0x1763f5);}};}function respondWithFilteredResult(_0x28e51c,_0x68d363){return function(_0x59563a){if(_0x59563a){var _0xc2b3eb=typeof _0x68d363['offset']===_0xc202('0x5')&&typeof _0x68d363[_0xc202('0x6')]===_0xc202('0x5');var _0x336fc8=_0x59563a[_0xc202('0x7')];var _0x3ea754=_0xc2b3eb?0x0:_0x68d363[_0xc202('0x8')];var _0xdfe8bf=_0xc2b3eb?_0x59563a[_0xc202('0x7')]:_0x68d363[_0xc202('0x8')]+_0x68d363[_0xc202('0x6')];var _0x870346;if(_0xdfe8bf>=_0x336fc8){_0xdfe8bf=_0x336fc8;_0x870346=0xc8;}else{_0x870346=0xce;}_0x28e51c[_0xc202('0x4')](_0x870346);return _0x28e51c['set'](_0xc202('0x9'),_0x3ea754+'-'+_0xdfe8bf+'/'+_0x336fc8)[_0xc202('0xa')](_0x59563a);}return null;};}function saveUpdates(_0x2805af,_0xbf3618){return function(_0x269dc0){if(_0x269dc0){return _0x269dc0[_0xc202('0xb')](_0x2805af)[_0xc202('0xc')](function(_0x53600c){return _0x53600c;});}return null;};}function handleEntityNotFound(_0xbd4353,_0x32b5d9){return function(_0x591cc0){if(!_0x591cc0){_0xbd4353['sendStatus'](0x194);}return _0x591cc0;};}function handleError(_0x5c10dd,_0x2dafa5){_0x2dafa5=_0x2dafa5||0x1f4;return function(_0x4a333c){logger[_0xc202('0xd')](_0x4a333c['stack']);if(_0x4a333c[_0xc202('0xe')]){delete _0x4a333c[_0xc202('0xe')];}_0x5c10dd[_0xc202('0x4')](_0x2dafa5)[_0xc202('0xf')](_0x4a333c);};}exports[_0xc202('0x10')]=function(_0x2419c5,_0x9620a0){var _0x591ecc={},_0x16ec7c={},_0x2c5557={'count':0x0,'rows':[]};var _0x3f322d=_['map'](db['CmHopper'][_0xc202('0x11')],function(_0x1af67a){return{'name':_0x1af67a[_0xc202('0x12')],'type':_0x1af67a[_0xc202('0x13')][_0xc202('0x14')]};});_0x16ec7c['model']=_['map'](_0x3f322d,_0xc202('0xe'));_0x16ec7c['query']=_[_0xc202('0x15')](_0x2419c5[_0xc202('0x16')]);_0x16ec7c['filters']=_['intersection'](_0x16ec7c[_0xc202('0x17')],_0x16ec7c['query']);_0x16ec7c[_0xc202('0x18')]=_[_0xc202('0x19')](_0x16ec7c[_0xc202('0x18')],[_0xc202('0x1a'),_0xc202('0x1b'),'$gt','$gte',_0xc202('0x1c'),_0xc202('0x1d'),_0xc202('0x1e'),'$eq',_0xc202('0x1f'),_0xc202('0x20'),'$notBetween','$in',_0xc202('0x21'),_0xc202('0x22'),_0xc202('0x23'),_0xc202('0x24'),_0xc202('0x25'),'$like',_0xc202('0x26'),_0xc202('0x27'),'$contained','$any']);_0x591ecc[_0xc202('0x28')]=_[_0xc202('0x29')](_0x16ec7c[_0xc202('0x17')],qs[_0xc202('0x2a')](_0x2419c5['query'][_0xc202('0x2a')]));_0x591ecc[_0xc202('0x28')]=_0x591ecc[_0xc202('0x28')]['length']?_0x591ecc[_0xc202('0x28')]:_0x16ec7c[_0xc202('0x17')];if(!_0x2419c5[_0xc202('0x16')][_0xc202('0x2b')](_0xc202('0x2c'))){_0x591ecc[_0xc202('0x6')]=qs[_0xc202('0x6')](_0x2419c5[_0xc202('0x16')][_0xc202('0x6')]);_0x591ecc[_0xc202('0x8')]=qs[_0xc202('0x8')](_0x2419c5[_0xc202('0x16')]['offset']);}_0x591ecc[_0xc202('0x2d')]=qs[_0xc202('0x2e')](_0x2419c5[_0xc202('0x16')]['sort']);_0x591ecc[_0xc202('0x2f')]=qs['filters'](_[_0xc202('0x30')](_0x2419c5[_0xc202('0x16')],_0x16ec7c[_0xc202('0x18')]),_0x3f322d);if(_0x2419c5[_0xc202('0x16')][_0xc202('0x31')]){_0x591ecc[_0xc202('0x2f')]=_['merge'](_0x591ecc[_0xc202('0x2f')],{'$or':_['map'](_0x3f322d,function(_0x3ac7e8){if(_0x3ac7e8['type']!==_0xc202('0x32')){var _0x147272={};_0x147272[_0x3ac7e8[_0xc202('0xe')]]={'$like':'%'+_0x2419c5['query'][_0xc202('0x31')]+'%'};return _0x147272;}})});}_0x591ecc=_[_0xc202('0x33')]({},_0x591ecc,_0x2419c5[_0xc202('0x34')]);var _0x444a8d={'where':_0x591ecc[_0xc202('0x2f')]};return db[_0xc202('0x35')]['count'](_0x444a8d)[_0xc202('0xc')](function(_0x1e57c3){_0x2c5557[_0xc202('0x7')]=_0x1e57c3;if(_0x2419c5['query'][_0xc202('0x36')]){_0x591ecc[_0xc202('0x37')]=[{'all':!![]}];}return db[_0xc202('0x35')][_0xc202('0x38')](_0x591ecc);})['then'](function(_0x57d5a4){_0x2c5557[_0xc202('0x39')]=_0x57d5a4;return _0x2c5557;})['then'](respondWithFilteredResult(_0x9620a0,_0x591ecc))[_0xc202('0x3a')](handleError(_0x9620a0,null));};exports[_0xc202('0x3b')]=function(_0x25fdd8,_0x200c27){var _0x9dbdb={'raw':!![],'where':{'id':_0x25fdd8['params']['id']}},_0x126c62={};_0x126c62[_0xc202('0x17')]=_[_0xc202('0x15')](db[_0xc202('0x35')][_0xc202('0x11')]);_0x126c62[_0xc202('0x16')]=_['keys'](_0x25fdd8[_0xc202('0x16')]);_0x126c62[_0xc202('0x18')]=_[_0xc202('0x29')](_0x126c62[_0xc202('0x17')],_0x126c62[_0xc202('0x16')]);_0x9dbdb['attributes']=_[_0xc202('0x29')](_0x126c62['model'],qs[_0xc202('0x2a')](_0x25fdd8['query'][_0xc202('0x2a')]));_0x9dbdb[_0xc202('0x28')]=_0x9dbdb[_0xc202('0x28')][_0xc202('0x3c')]?_0x9dbdb['attributes']:_0x126c62[_0xc202('0x17')];if(_0x25fdd8[_0xc202('0x16')][_0xc202('0x36')]){_0x9dbdb[_0xc202('0x37')]=[{'all':!![]}];}_0x9dbdb=_[_0xc202('0x33')]({},_0x9dbdb,_0x25fdd8[_0xc202('0x34')]);return db[_0xc202('0x35')][_0xc202('0x3d')](_0x9dbdb)[_0xc202('0xc')](handleEntityNotFound(_0x200c27,null))[_0xc202('0xc')](respondWithResult(_0x200c27,null))[_0xc202('0x3a')](handleError(_0x200c27,null));};exports[_0xc202('0x3e')]=function(_0x157c2e,_0x39607d){return db[_0xc202('0x35')][_0xc202('0x3e')](_0x157c2e[_0xc202('0x3f')],{})[_0xc202('0xc')](respondWithResult(_0x39607d,0xc9))[_0xc202('0x3a')](handleError(_0x39607d,null));};exports[_0xc202('0xb')]=function(_0x484013,_0x39f2c1){if(_0x484013[_0xc202('0x3f')]['id']){delete _0x484013[_0xc202('0x3f')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x484013['params']['id']}})[_0xc202('0xc')](handleEntityNotFound(_0x39f2c1,null))[_0xc202('0xc')](saveUpdates(_0x484013[_0xc202('0x3f')],null))[_0xc202('0xc')](respondWithResult(_0x39f2c1,null))[_0xc202('0x3a')](handleError(_0x39f2c1,null));};exports[_0xc202('0x40')]=function(_0x157d89,_0x466ba4){return db[_0xc202('0x35')][_0xc202('0x40')]()[_0xc202('0xc')](respondWithResult(_0x466ba4,null))[_0xc202('0x3a')](handleError(_0x466ba4,null));};exports[_0xc202('0x41')]=function(_0x5220a2,_0x33e70c){var _0x163023;var _0x57855e=_0x5220a2[_0xc202('0x42')]['id'];return db[_0xc202('0x35')][_0xc202('0x3d')]({'where':{'id':_0x5220a2[_0xc202('0x42')]['id']}})[_0xc202('0xc')](handleEntityNotFound(_0x33e70c,null))['then'](function(_0x2250a6){if(_0x2250a6){return _0x2250a6['destroy']()[_0xc202('0xc')](function(_0x5f1b99){return _0x5f1b99;});}})[_0xc202('0xc')](function(_0x20ffe5){_0x163023=_0x20ffe5;if(_0x20ffe5){if(_0x20ffe5['VoiceQueueId']||_0x20ffe5[_0xc202('0x43')]){return db[_0x20ffe5[_0xc202('0x44')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x20ffe5[_0xc202('0x44')]?_0x20ffe5['VoiceQueueId']:_0x20ffe5[_0xc202('0x43')]},'attributes':['id',_0xc202('0xe')],'raw':!![]});}}})[_0xc202('0xc')](function(_0x1f6233){var _0x3858b9={};if(_0x1f6233){_[_0xc202('0x33')](_0x3858b9,_[_0xc202('0x45')](_0x163023[_0xc202('0x46')],[_0xc202('0x47'),_0xc202('0x48'),'id']));_0x3858b9[_0xc202('0x49')]=0x15;_0x3858b9[_0xc202('0x4a')]=_0xc202('0x4b');_0x3858b9['campaign']=_0x1f6233[_0xc202('0xe')];_0x3858b9['membername']=_0x5220a2['user'][_0xc202('0xe')];_0x3858b9[_0xc202('0x4c')]=_0x5220a2[_0xc202('0x4d')]['id'];_0x3858b9['deleted']=!![];_0x3858b9[_0xc202('0x4e')]=moment()['format'](_0xc202('0x4f'));_0x3858b9[_0xc202('0x50')]=_0x163023['phone'];_0x3858b9[_0xc202('0x51')]=_0x163023[_0xc202('0x44')]?'queue':_0xc202('0x52');return db['CmContact'][_0xc202('0x3d')]({'where':{'id':_0x3858b9[_0xc202('0x53')]},'attributes':[_0xc202('0x54'),_0xc202('0x55')]})[_0xc202('0xc')](function(_0x2d475a){if(!_[_0xc202('0x56')](_0x33e70c)&&!_['isNil'](_0x2d475a[_0xc202('0x54')])){_0x3858b9[_0xc202('0x57')]=_0x2d475a['firstName'];if(!_[_0xc202('0x56')](_0x2d475a['lastName'])){_0x3858b9[_0xc202('0x57')]+='\x20'+_0x2d475a['lastName'];}}})[_0xc202('0x58')](function(){return db['CmHopperFinal'][_0xc202('0x3e')](_0x3858b9);});}})['then'](function(_0x5f212b){return db[_0xc202('0x59')][_0xc202('0x41')]({'where':{'CmHopperId':_0x57855e}});})[_0xc202('0xc')](function(){return _0x33e70c[_0xc202('0x4')](0xcc)[_0xc202('0x5a')]();})[_0xc202('0x3a')](handleError(_0x33e70c,null));};exports[_0xc202('0x5b')]=function(_0x2b0865,_0x409845){var _0x135797=[];return db['CmContact'][_0xc202('0x40')]()[_0xc202('0xc')](function(_0x58bc02){_0x135797=_[_0xc202('0x15')](_0x58bc02);return _0x2b0865[_0xc202('0x4d')][_0xc202('0x5c')]({'where':{'type':_0xc202('0x5d'),'dialActive':!![],'dialMethod':_0xc202('0x5e')},'attributes':['id',_0xc202('0x5f'),_0xc202('0x60')],'raw':!![]});})[_0xc202('0xc')](function(_0x502caf){if(_0x502caf&&_0x502caf[_0xc202('0x3c')]){return db[_0xc202('0x61')][_0xc202('0x62')](function(_0x3095d2){var _0x233e0a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc202('0x4f'))},'VoiceQueueId':{'$in':_[_0xc202('0x63')](_0x502caf,'id')},'$or':[{'UserId':null},{'UserId':_0x2b0865[_0xc202('0x4d')]['id']}]};var _0x5ae21d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x502caf)[_0xc202('0x31')](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2b0865[_0xc202('0x4d')]['id']}]};var _0xd2d160={'$or':[_0x233e0a,_0x5ae21d]};var _0x189884=[];if(_0x2b0865[_0xc202('0x3f')]['direction']&&_0x2b0865[_0xc202('0x3f')]['direction']===_0xc202('0x64')){if(!_[_0xc202('0x65')](_0x2b0865['body'][_0xc202('0x66')])){_0xd2d160['id']={'$in':_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')]};}_0x189884=[['priority','ASC'],['scheduledAt',_0x502caf[0x0][_0xc202('0x5f')]===_0xc202('0x67')?'DESC':_0xc202('0x67')],db[_0xc202('0x61')]['literal'](_0xc202('0x68')),['id','DESC']];}else{if(!_[_0xc202('0x65')](_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')])){_0xd2d160['id']={'$notIn':_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')]};}_0x189884=[['priority','DESC'],[_0xc202('0x69'),_0x502caf[0x0][_0xc202('0x5f')]],db[_0xc202('0x61')][_0xc202('0x6a')](_0xc202('0x6b')),['id','ASC']];}return db['CmHopper'][_0xc202('0x6c')]({'attributes':['id',_0xc202('0x6d'),_0xc202('0x6e'),_0xc202('0x6f')],'where':_0xd2d160,'order':_0x189884,'transaction':_0x3095d2,'lock':_0x3095d2[_0xc202('0x70')][_0xc202('0x71')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x135797,'include':[{'model':db[_0xc202('0x72')],'as':_0xc202('0x73'),'attributes':['id',_0xc202('0xe')]}]},{'model':db['CmList'],'as':_0xc202('0x74'),'attributes':['id',_0xc202('0xe')]},{'model':db['VoiceQueue'],'as':_0xc202('0x75'),'attributes':['id',_0xc202('0xe'),'dialActive']}]})[_0xc202('0xc')](function(_0x382dea){if(_0x382dea){return _0x382dea[_0xc202('0xb')]({'UserId':_0x2b0865[_0xc202('0x4d')]['id']},{'transaction':_0x3095d2});}});});}})[_0xc202('0xc')](handleEntityNotFound(_0x409845,null))['then'](respondWithResult(_0x409845,null))[_0xc202('0x3a')](handleError(_0x409845,null));};exports['getPreviewRecall']=function(_0x3cfbaa,_0x17ff38,_0x585984){var _0x2d149a=[];var _0x5b8a32=_0x3cfbaa[_0xc202('0x42')]['id'];var _0x411043=_0x3cfbaa[_0xc202('0x4d')]['id'];return db[_0xc202('0x76')]['describe']()[_0xc202('0xc')](function(_0x234770){_0x2d149a=_[_0xc202('0x15')](_0x234770);return db[_0xc202('0x61')][_0xc202('0x62')](function(_0x3ba0c4){const _0x5f2b84={'id':_0x5b8a32};return db[_0xc202('0x35')][_0xc202('0x6c')]({'attributes':['id','scheduledat',_0xc202('0x6f')],'where':_0x5f2b84,'transaction':_0x3ba0c4,'lock':_0x3ba0c4[_0xc202('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x2d149a,'include':[{'model':db[_0xc202('0x72')],'as':_0xc202('0x73'),'attributes':['id',_0xc202('0xe')]}]},{'model':db['CmList'],'as':_0xc202('0x74'),'attributes':['id',_0xc202('0xe')]},{'model':db[_0xc202('0x77')],'as':_0xc202('0x75'),'attributes':['id',_0xc202('0xe'),'dialActive']}]})[_0xc202('0xc')](function(_0x1bf945){if(_0x1bf945){return _0x1bf945[_0xc202('0xb')]({'UserId':_0x411043},{'transaction':_0x3ba0c4});}});});})[_0xc202('0xc')](handleEntityNotFound(_0x17ff38,null))[_0xc202('0xc')](respondWithResult(_0x17ff38,null))[_0xc202('0x3a')](handleError(_0x17ff38,null));};exports[_0xc202('0x78')]=function(_0x27147e,_0x906dc2){return _0x27147e[_0xc202('0x4d')][_0xc202('0x5c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc202('0x5e')},'attributes':['id'],'raw':!![]})[_0xc202('0xc')](function(_0x48a098){if(_0x48a098&&_0x48a098[_0xc202('0x3c')]){return db[_0xc202('0x35')][_0xc202('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc202('0x79')](_0xc202('0x4f'))},'VoiceQueueId':{'$in':_['map'](_0x48a098,'id')},'$or':[{'UserId':null},{'UserId':_0x27147e[_0xc202('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x41908c){if(!_[_0xc202('0x56')](_0x41908c)&&_[_0xc202('0x7a')](_0x41908c)){return _0x906dc2[_0xc202('0x4')](0xc8)['json']({'contacts':_0x41908c});}else{logger[_0xc202('0xd')](_0xc202('0x7b'),_0xc202('0x78'),0x194,_0xc202('0x7c'));_0x906dc2[_0xc202('0x7d')](0x194);}})[_0xc202('0x3a')](handleError(_0x906dc2,null));};exports[_0xc202('0x7e')]=function(_0x414557,_0x80109){var _0x1bf8b8=shared[_0xc202('0x7f')];var _0x48521a=[];_['map'](_0x1bf8b8,function(_0x41ef84){_0x48521a[_0xc202('0x80')]({'id':_0x41ef84[_0xc202('0xe')],'name':_0x41ef84[_0xc202('0xe')],'utcOffset':_0x41ef84['utcOffset']});});return _0x80109[_0xc202('0x4')](0xc8)['json']({'tz':_0x48521a});};exports['getTimezone']=function(_0x30f49c,_0x151976){var _0x53e43a=shared['timezones'];var _0x4f6c06={};if(!_[_0xc202('0x56')](_0x53e43a[_0x30f49c[_0xc202('0x3f')]['id']]))_0x4f6c06=_0x53e43a[_0x30f49c['body']['id']];return _0x151976[_0xc202('0x4')](0xc8)[_0xc202('0xa')](_0x4f6c06);}; \ No newline at end of file +var _0x723e=['concat','$and','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$iLike','$like','$overlap','$contains','$any','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','CmHopper','then','includeAll','include','rows','rawAttributes','find','catch','create','body','params','describe','destroy','CampaignId','VoiceQueueId','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','calleridnum','phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','outbound','preview','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','dialOrderByScheduledAt','ASC','DESC','literal','scheduledAt','findOne','scheduledat','recallme','LOCK','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','update','getPreviewRecall','sequelize','Contact','getOpenContacts','getVoiceQueues','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','sendStatus','error','stack','name','send','index','map','fieldName','key','model','keys','query','filters','intersection'];(function(_0x446ac5,_0x20191b){var _0x4b3bb1=function(_0x27df21){while(--_0x27df21){_0x446ac5['push'](_0x446ac5['shift']());}};_0x4b3bb1(++_0x20191b);}(_0x723e,0x179));var _0xe723=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x723e[_0x7ad123];return _0x37d073;};'use strict';var moment=require('moment');var _=require(_0xe723('0x0'));var qs=require(_0xe723('0x1'));var logger=require(_0xe723('0x2'))(_0xe723('0x3'));var shared=require(_0xe723('0x4'));var db=require(_0xe723('0x5'))['db'];function respondWithResult(_0x39e35c,_0x1da20f){_0x1da20f=_0x1da20f||0xc8;return function(_0x8f78b2){if(_0x8f78b2){return _0x39e35c[_0xe723('0x6')](_0x1da20f)['json'](_0x8f78b2);}};}function respondWithFilteredResult(_0x32d689,_0x20c13b){return function(_0x1335cd){if(_0x1335cd){var _0x3bf082=typeof _0x20c13b[_0xe723('0x7')]===_0xe723('0x8')&&typeof _0x20c13b[_0xe723('0x9')]===_0xe723('0x8');var _0x4a6983=_0x1335cd[_0xe723('0xa')];var _0x270346=_0x3bf082?0x0:_0x20c13b[_0xe723('0x7')];var _0x5a43fb=_0x3bf082?_0x1335cd[_0xe723('0xa')]:_0x20c13b[_0xe723('0x7')]+_0x20c13b[_0xe723('0x9')];var _0x583291;if(_0x5a43fb>=_0x4a6983){_0x5a43fb=_0x4a6983;_0x583291=0xc8;}else{_0x583291=0xce;}_0x32d689[_0xe723('0x6')](_0x583291);return _0x32d689[_0xe723('0xb')](_0xe723('0xc'),_0x270346+'-'+_0x5a43fb+'/'+_0x4a6983)[_0xe723('0xd')](_0x1335cd);}return null;};}function saveUpdates(_0x236b69,_0x5c066c){return function(_0x29a1e){if(_0x29a1e){return _0x29a1e['update'](_0x236b69)['then'](function(_0x5201f2){return _0x5201f2;});}return null;};}function handleEntityNotFound(_0x57bc0e,_0x75c12c){return function(_0x30b2ba){if(!_0x30b2ba){_0x57bc0e[_0xe723('0xe')](0x194);}return _0x30b2ba;};}function handleError(_0x2b010b,_0xf29a39){_0xf29a39=_0xf29a39||0x1f4;return function(_0x5aec97){logger[_0xe723('0xf')](_0x5aec97[_0xe723('0x10')]);if(_0x5aec97[_0xe723('0x11')]){delete _0x5aec97[_0xe723('0x11')];}_0x2b010b[_0xe723('0x6')](_0xf29a39)[_0xe723('0x12')](_0x5aec97);};}exports[_0xe723('0x13')]=function(_0x4a6f95,_0x17e2c1){var _0x3906ea={},_0x2057d7={},_0x3012cf={'count':0x0,'rows':[]};var _0x262a8d=_[_0xe723('0x14')](db['CmHopper']['rawAttributes'],function(_0x31c839){return{'name':_0x31c839[_0xe723('0x15')],'type':_0x31c839['type'][_0xe723('0x16')]};});_0x2057d7[_0xe723('0x17')]=_['map'](_0x262a8d,_0xe723('0x11'));_0x2057d7['query']=_[_0xe723('0x18')](_0x4a6f95[_0xe723('0x19')]);_0x2057d7[_0xe723('0x1a')]=_[_0xe723('0x1b')](_0x2057d7[_0xe723('0x17')],_0x2057d7[_0xe723('0x19')]);_0x2057d7[_0xe723('0x1a')]=_[_0xe723('0x1c')](_0x2057d7[_0xe723('0x1a')],[_0xe723('0x1d'),_0xe723('0x1e'),_0xe723('0x1f'),'$gte',_0xe723('0x20'),'$lte',_0xe723('0x21'),_0xe723('0x22'),_0xe723('0x23'),_0xe723('0x24'),_0xe723('0x25'),'$in',_0xe723('0x26'),'$like','$notLike',_0xe723('0x27'),'$notILike',_0xe723('0x28'),_0xe723('0x29'),_0xe723('0x2a'),'$contained',_0xe723('0x2b')]);_0x3906ea[_0xe723('0x2c')]=_['intersection'](_0x2057d7[_0xe723('0x17')],qs['fields'](_0x4a6f95['query'][_0xe723('0x2d')]));_0x3906ea[_0xe723('0x2c')]=_0x3906ea[_0xe723('0x2c')][_0xe723('0x2e')]?_0x3906ea['attributes']:_0x2057d7['model'];if(!_0x4a6f95[_0xe723('0x19')]['hasOwnProperty'](_0xe723('0x2f'))){_0x3906ea[_0xe723('0x9')]=qs[_0xe723('0x9')](_0x4a6f95[_0xe723('0x19')][_0xe723('0x9')]);_0x3906ea[_0xe723('0x7')]=qs[_0xe723('0x7')](_0x4a6f95[_0xe723('0x19')][_0xe723('0x7')]);}_0x3906ea[_0xe723('0x30')]=qs[_0xe723('0x31')](_0x4a6f95[_0xe723('0x19')][_0xe723('0x31')]);_0x3906ea[_0xe723('0x32')]=qs['filters'](_[_0xe723('0x33')](_0x4a6f95['query'],_0x2057d7[_0xe723('0x1a')]),_0x262a8d);if(_0x4a6f95[_0xe723('0x19')]['filter']){_0x3906ea['where']=_[_0xe723('0x34')](_0x3906ea[_0xe723('0x32')],{'$or':_[_0xe723('0x14')](_0x262a8d,function(_0x2ef00d){if(_0x2ef00d[_0xe723('0x35')]!==_0xe723('0x36')){var _0x5122da={};_0x5122da[_0x2ef00d[_0xe723('0x11')]]={'$like':'%'+_0x4a6f95[_0xe723('0x19')][_0xe723('0x37')]+'%'};return _0x5122da;}})});}_0x3906ea=_[_0xe723('0x34')]({},_0x3906ea,_0x4a6f95[_0xe723('0x38')]);var _0x37bb5d={'where':_0x3906ea[_0xe723('0x32')]};return db[_0xe723('0x39')][_0xe723('0xa')](_0x37bb5d)[_0xe723('0x3a')](function(_0x9918d9){_0x3012cf[_0xe723('0xa')]=_0x9918d9;if(_0x4a6f95[_0xe723('0x19')][_0xe723('0x3b')]){_0x3906ea[_0xe723('0x3c')]=[{'all':!![]}];}return db[_0xe723('0x39')]['findAll'](_0x3906ea);})[_0xe723('0x3a')](function(_0x29c148){_0x3012cf[_0xe723('0x3d')]=_0x29c148;return _0x3012cf;})[_0xe723('0x3a')](respondWithFilteredResult(_0x17e2c1,_0x3906ea))['catch'](handleError(_0x17e2c1,null));};exports['show']=function(_0x105233,_0x3ba6ef){var _0xc0c2c7={'raw':!![],'where':{'id':_0x105233['params']['id']}},_0xfafc1d={};_0xfafc1d['model']=_[_0xe723('0x18')](db[_0xe723('0x39')][_0xe723('0x3e')]);_0xfafc1d[_0xe723('0x19')]=_[_0xe723('0x18')](_0x105233[_0xe723('0x19')]);_0xfafc1d[_0xe723('0x1a')]=_[_0xe723('0x1b')](_0xfafc1d[_0xe723('0x17')],_0xfafc1d['query']);_0xc0c2c7['attributes']=_[_0xe723('0x1b')](_0xfafc1d['model'],qs['fields'](_0x105233[_0xe723('0x19')]['fields']));_0xc0c2c7[_0xe723('0x2c')]=_0xc0c2c7[_0xe723('0x2c')][_0xe723('0x2e')]?_0xc0c2c7[_0xe723('0x2c')]:_0xfafc1d[_0xe723('0x17')];if(_0x105233[_0xe723('0x19')][_0xe723('0x3b')]){_0xc0c2c7['include']=[{'all':!![]}];}_0xc0c2c7=_['merge']({},_0xc0c2c7,_0x105233[_0xe723('0x38')]);return db['CmHopper'][_0xe723('0x3f')](_0xc0c2c7)['then'](handleEntityNotFound(_0x3ba6ef,null))[_0xe723('0x3a')](respondWithResult(_0x3ba6ef,null))[_0xe723('0x40')](handleError(_0x3ba6ef,null));};exports[_0xe723('0x41')]=function(_0x2c22c4,_0x119550){return db[_0xe723('0x39')][_0xe723('0x41')](_0x2c22c4[_0xe723('0x42')],{})[_0xe723('0x3a')](respondWithResult(_0x119550,0xc9))['catch'](handleError(_0x119550,null));};exports['update']=function(_0x1824b6,_0x23425b){if(_0x1824b6[_0xe723('0x42')]['id']){delete _0x1824b6['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0x1824b6[_0xe723('0x43')]['id']}})[_0xe723('0x3a')](handleEntityNotFound(_0x23425b,null))[_0xe723('0x3a')](saveUpdates(_0x1824b6['body'],null))[_0xe723('0x3a')](respondWithResult(_0x23425b,null))[_0xe723('0x40')](handleError(_0x23425b,null));};exports[_0xe723('0x44')]=function(_0x38bd1a,_0x15bfd0){return db['CmHopper'][_0xe723('0x44')]()['then'](respondWithResult(_0x15bfd0,null))[_0xe723('0x40')](handleError(_0x15bfd0,null));};exports['destroy']=function(_0x52f42e,_0x1590fe){var _0x42a302;var _0x22a1d3=_0x52f42e['params']['id'];return db[_0xe723('0x39')]['find']({'where':{'id':_0x52f42e[_0xe723('0x43')]['id']}})[_0xe723('0x3a')](handleEntityNotFound(_0x1590fe,null))[_0xe723('0x3a')](function(_0x37329e){if(_0x37329e){return _0x37329e[_0xe723('0x45')]()[_0xe723('0x3a')](function(_0x41e1c4){return _0x41e1c4;});}})[_0xe723('0x3a')](function(_0x1bf58b){_0x42a302=_0x1bf58b;if(_0x1bf58b){if(_0x1bf58b['VoiceQueueId']||_0x1bf58b[_0xe723('0x46')]){return db[_0x1bf58b[_0xe723('0x47')]?'VoiceQueue':_0xe723('0x48')][_0xe723('0x3f')]({'where':{'id':_0x1bf58b['VoiceQueueId']?_0x1bf58b[_0xe723('0x47')]:_0x1bf58b['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xe723('0x3a')](function(_0x1825fa){var _0x21d3ef={};if(_0x1825fa){_[_0xe723('0x34')](_0x21d3ef,_[_0xe723('0x49')](_0x42a302['dataValues'],[_0xe723('0x4a'),_0xe723('0x4b'),'id']));_0x21d3ef[_0xe723('0x4c')]=0x15;_0x21d3ef[_0xe723('0x4d')]=_0xe723('0x4e');_0x21d3ef[_0xe723('0x4f')]=_0x1825fa[_0xe723('0x11')];_0x21d3ef[_0xe723('0x50')]=_0x52f42e[_0xe723('0x51')][_0xe723('0x11')];_0x21d3ef['UserId']=_0x52f42e[_0xe723('0x51')]['id'];_0x21d3ef[_0xe723('0x4e')]=!![];_0x21d3ef[_0xe723('0x52')]=moment()[_0xe723('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x21d3ef[_0xe723('0x54')]=_0x42a302[_0xe723('0x55')];_0x21d3ef['campaigntype']=_0x42a302[_0xe723('0x47')]?_0xe723('0x56'):_0xe723('0x57');return db[_0xe723('0x58')][_0xe723('0x3f')]({'where':{'id':_0x21d3ef[_0xe723('0x59')]},'attributes':['firstName',_0xe723('0x5a')]})['then'](function(_0x58a39f){if(!_[_0xe723('0x5b')](_0x1590fe)&&!_['isNil'](_0x58a39f[_0xe723('0x5c')])){_0x21d3ef[_0xe723('0x5d')]=_0x58a39f[_0xe723('0x5c')];if(!_[_0xe723('0x5b')](_0x58a39f[_0xe723('0x5a')])){_0x21d3ef['calleridname']+='\x20'+_0x58a39f[_0xe723('0x5a')];}}})[_0xe723('0x5e')](function(){return db[_0xe723('0x5f')]['create'](_0x21d3ef);});}})['then'](function(_0x4022a7){return db[_0xe723('0x60')][_0xe723('0x45')]({'where':{'CmHopperId':_0x22a1d3}});})['then'](function(){return _0x1590fe[_0xe723('0x6')](0xcc)[_0xe723('0x61')]();})['catch'](handleError(_0x1590fe,null));};exports['getPreview']=function(_0x2556bf,_0x7b0dd9){var _0x113860=[];return db[_0xe723('0x58')][_0xe723('0x44')]()[_0xe723('0x3a')](function(_0x6fbf5e){_0x113860=_['keys'](_0x6fbf5e);return _0x2556bf['user']['getVoiceQueues']({'where':{'type':_0xe723('0x62'),'dialActive':!![],'dialMethod':_0xe723('0x63')},'attributes':['id','dialOrderByScheduledAt',_0xe723('0x64')],'raw':!![]});})[_0xe723('0x3a')](function(_0x189b5c){if(_0x189b5c&&_0x189b5c['length']){return db['sequelize'][_0xe723('0x65')](function(_0x3868a9){var _0x2463c3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe723('0x14')](_0x189b5c,'id')},'$or':[{'UserId':null},{'UserId':_0x2556bf['user']['id']}]};var _0x876a6d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x189b5c)[_0xe723('0x37')]([_0xe723('0x64'),0x0])[_0xe723('0x14')]('id')[_0xe723('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x2556bf[_0xe723('0x51')]['id']}]};var _0x1b0cd6={'$or':[_0x2463c3,_0x876a6d]};var _0x421520=[];if(_0x2556bf[_0xe723('0x42')]['direction']&&_0x2556bf[_0xe723('0x42')][_0xe723('0x67')]===_0xe723('0x68')){if(!_[_0xe723('0x69')](_0x2556bf[_0xe723('0x42')][_0xe723('0x6a')])){_0x1b0cd6['id']={'$in':_0x2556bf['body'][_0xe723('0x6a')]};}_0x421520=[[_0xe723('0x6b'),'ASC'],['scheduledAt',_0x189b5c[0x0][_0xe723('0x6c')]===_0xe723('0x6d')?_0xe723('0x6e'):'ASC'],db['sequelize'][_0xe723('0x6f')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xe723('0x6e')]];}else{if(!_[_0xe723('0x69')](_0x2556bf[_0xe723('0x42')][_0xe723('0x6a')])){_0x1b0cd6['id']={'$notIn':_0x2556bf[_0xe723('0x42')]['hopperIds']};}_0x421520=[['priority',_0xe723('0x6e')],[_0xe723('0x70'),_0x189b5c[0x0][_0xe723('0x6c')]],db['sequelize'][_0xe723('0x6f')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xe723('0x39')][_0xe723('0x71')]({'attributes':['id',_0xe723('0x72'),_0xe723('0x55'),_0xe723('0x73')],'where':_0x1b0cd6,'order':_0x421520,'transaction':_0x3868a9,'lock':_0x3868a9[_0xe723('0x74')]['UPDATE'],'include':[{'model':db[_0xe723('0x58')],'as':'Contact','attributes':_0x113860,'include':[{'model':db[_0xe723('0x75')],'as':_0xe723('0x76'),'attributes':['id','name']}]},{'model':db[_0xe723('0x77')],'as':_0xe723('0x78'),'attributes':['id',_0xe723('0x11')]},{'model':db[_0xe723('0x79')],'as':_0xe723('0x7a'),'attributes':['id',_0xe723('0x11'),_0xe723('0x7b')]}]})[_0xe723('0x3a')](function(_0x33685e){if(_0x33685e){return _0x33685e[_0xe723('0x7c')]({'UserId':_0x2556bf[_0xe723('0x51')]['id']},{'transaction':_0x3868a9});}});});}})[_0xe723('0x3a')](handleEntityNotFound(_0x7b0dd9,null))[_0xe723('0x3a')](respondWithResult(_0x7b0dd9,null))[_0xe723('0x40')](handleError(_0x7b0dd9,null));};exports[_0xe723('0x7d')]=function(_0x4d5685,_0x3e8bd4,_0x44468e){var _0x1d4fe0=[];var _0x507267=_0x4d5685[_0xe723('0x43')]['id'];var _0x7af941=_0x4d5685[_0xe723('0x51')]['id'];return db[_0xe723('0x58')][_0xe723('0x44')]()[_0xe723('0x3a')](function(_0x1e2cb0){_0x1d4fe0=_[_0xe723('0x18')](_0x1e2cb0);return db[_0xe723('0x7e')][_0xe723('0x65')](function(_0x5dc44a){const _0x14cd1d={'id':_0x507267};return db[_0xe723('0x39')][_0xe723('0x71')]({'attributes':['id',_0xe723('0x72'),_0xe723('0x73')],'where':_0x14cd1d,'transaction':_0x5dc44a,'lock':_0x5dc44a[_0xe723('0x74')]['UPDATE'],'include':[{'model':db[_0xe723('0x58')],'as':_0xe723('0x7f'),'attributes':_0x1d4fe0,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xe723('0x11')]}]},{'model':db[_0xe723('0x77')],'as':'List','attributes':['id',_0xe723('0x11')]},{'model':db[_0xe723('0x79')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0xe723('0x3a')](function(_0x48b73c){if(_0x48b73c){return _0x48b73c['update']({'UserId':_0x7af941},{'transaction':_0x5dc44a});}});});})['then'](handleEntityNotFound(_0x3e8bd4,null))[_0xe723('0x3a')](respondWithResult(_0x3e8bd4,null))[_0xe723('0x40')](handleError(_0x3e8bd4,null));};exports[_0xe723('0x80')]=function(_0x296bf1,_0x31ccef){return _0x296bf1[_0xe723('0x51')][_0xe723('0x81')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe723('0x63')},'attributes':['id'],'raw':!![]})[_0xe723('0x3a')](function(_0x36d962){if(_0x36d962&&_0x36d962[_0xe723('0x2e')]){return db[_0xe723('0x39')][_0xe723('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe723('0x14')](_0x36d962,'id')},'$or':[{'UserId':null},{'UserId':_0x296bf1['user']['id']}]}});}return 0x0;})['then'](function(_0x345278){if(!_[_0xe723('0x5b')](_0x345278)&&_['isNumber'](_0x345278)){return _0x31ccef[_0xe723('0x6')](0xc8)[_0xe723('0xd')]({'contacts':_0x345278});}else{logger[_0xe723('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0xe723('0x82'));_0x31ccef[_0xe723('0xe')](0x194);}})[_0xe723('0x40')](handleError(_0x31ccef,null));};exports[_0xe723('0x83')]=function(_0x155e7c,_0x34e46f){var _0x2674dd=shared[_0xe723('0x84')];var _0x5a8810=[];_['map'](_0x2674dd,function(_0x4b359f){_0x5a8810[_0xe723('0x85')]({'id':_0x4b359f[_0xe723('0x11')],'name':_0x4b359f[_0xe723('0x11')],'utcOffset':_0x4b359f[_0xe723('0x86')]});});return _0x34e46f[_0xe723('0x6')](0xc8)['json']({'tz':_0x5a8810});};exports['getTimezone']=function(_0x4cecc8,_0x374476){var _0x231ac9=shared[_0xe723('0x84')];var _0x1597aa={};if(!_['isNil'](_0x231ac9[_0x4cecc8['body']['id']]))_0x1597aa=_0x231ac9[_0x4cecc8['body']['id']];return _0x374476['status'](0xc8)[_0xe723('0xd')](_0x1597aa);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index db76633..2585094 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 _0x71ab=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xc')]},{'name':_0xb71a('0xd'),'fields':[_0xb71a('0xd')]},{'name':_0xb71a('0xe'),'fields':[_0xb71a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x90b1,0x1bb));var _0x190b=function(_0x41cb4b,_0x200468){_0x41cb4b=_0x41cb4b-0x0;var _0x1719c1=_0x90b1[_0x41cb4b];return _0x1719c1;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 88e8c31..b053454 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 _0x009e=['create','debug','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','name','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','voicePause','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','info','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper'];(function(_0x1108fe,_0x5315f9){var _0x30cd9d=function(_0xae37ea){while(--_0xae37ea){_0x1108fe['push'](_0x1108fe['shift']());}};_0x30cd9d(++_0x5315f9);}(_0x009e,0x1d7));var _0xe009=function(_0x23101c,_0xb416de){_0x23101c=_0x23101c-0x0;var _0x30e9af=_0x009e[_0x23101c];return _0x30e9af;};'use strict';var _=require(_0xe009('0x0'));var util=require(_0xe009('0x1'));var moment=require(_0xe009('0x2'));var BPromise=require(_0xe009('0x3'));var db=require(_0xe009('0x4'))['db'];var logger=require(_0xe009('0x5'))(_0xe009('0x6'));exports[_0xe009('0x7')]=function(_0x11c773){var _0x3a015d=this;return new Promise(function(_0x4b7bab,_0x20a8e0){return db[_0xe009('0x8')][_0xe009('0x9')]({'raw':_0x11c773[_0xe009('0xa')]?_0x11c773['options'][_0xe009('0xb')]===undefined?!![]:![]:!![],'where':_0x11c773[_0xe009('0xa')]?_0x11c773['options'][_0xe009('0xc')]||null:null,'attributes':_0x11c773[_0xe009('0xa')]?_0x11c773['options']['attributes']||null:null,'limit':_0x11c773[_0xe009('0xa')]?_0x11c773['options'][_0xe009('0xd')]||null:null,'include':_0x11c773[_0xe009('0xa')]?_0x11c773[_0xe009('0xa')][_0xe009('0xe')]?_[_0xe009('0xf')](_0x11c773[_0xe009('0xa')][_0xe009('0xe')],function(_0x4a1c80){return{'model':db[_0x4a1c80['model']],'as':_0x4a1c80['as'],'attributes':_0x4a1c80['attributes'],'include':_0x4a1c80[_0xe009('0xe')]?_['map'](_0x4a1c80['include'],function(_0xf6778e){return{'model':db[_0xf6778e[_0xe009('0x10')]],'as':_0xf6778e['as'],'attributes':_0xf6778e[_0xe009('0x11')],'include':_0xf6778e['include']?_[_0xe009('0xf')](_0xf6778e['include'],function(_0x464375){return{'model':db[_0x464375[_0xe009('0x10')]],'as':_0x464375['as'],'attributes':_0x464375[_0xe009('0x11')]};}):[]};}):[]};}):[]:[]})[_0xe009('0x12')](function(_0x3858fe){logger[_0xe009('0x13')](_0xe009('0x7'),_0x11c773);logger['debug'](_0xe009('0x7'),_0x11c773,JSON[_0xe009('0x14')](_0x3858fe));_0x4b7bab(_0x3858fe);})[_0xe009('0x15')](function(_0x4bb402){logger[_0xe009('0x16')]('GetCmHopper',_0x4bb402[_0xe009('0x17')],_0x11c773);_0x20a8e0(_0x3a015d[_0xe009('0x16')](0x1f4,_0x4bb402[_0xe009('0x17')]));});});};exports[_0xe009('0x18')]=function(_0x24796a){var _0xba27fb=this;return new Promise(function(_0x472943,_0x41a053){return db[_0xe009('0x8')][_0xe009('0x19')]({'raw':_0x24796a[_0xe009('0xa')]?_0x24796a[_0xe009('0xa')][_0xe009('0xb')]===undefined?!![]:![]:!![],'where':_0x24796a[_0xe009('0xa')]?_0x24796a[_0xe009('0xa')]['where']||null:null,'attributes':_0x24796a[_0xe009('0xa')]?_0x24796a[_0xe009('0xa')][_0xe009('0x11')]||null:null,'include':_0x24796a['options']?_0x24796a[_0xe009('0xa')][_0xe009('0xe')]?_[_0xe009('0xf')](_0x24796a['options'][_0xe009('0xe')],function(_0x304fea){return{'model':db[_0x304fea[_0xe009('0x10')]],'as':_0x304fea['as'],'attributes':_0x304fea[_0xe009('0x11')],'include':_0x304fea[_0xe009('0xe')]?_[_0xe009('0xf')](_0x304fea[_0xe009('0xe')],function(_0x279180){return{'model':db[_0x279180['model']],'as':_0x279180['as'],'attributes':_0x279180[_0xe009('0x11')],'include':_0x279180['include']?_[_0xe009('0xf')](_0x279180[_0xe009('0xe')],function(_0x4c7008){return{'model':db[_0x4c7008[_0xe009('0x10')]],'as':_0x4c7008['as'],'attributes':_0x4c7008[_0xe009('0x11')]};}):[]};}):[]};}):[]:[]})[_0xe009('0x12')](function(_0x3d7041){logger[_0xe009('0x13')](_0xe009('0x18'),_0x24796a);logger['debug'](_0xe009('0x18'),_0x24796a,JSON[_0xe009('0x14')](_0x3d7041));_0x472943(_0x3d7041);})['catch'](function(_0x2af8d6){logger[_0xe009('0x16')](_0xe009('0x18'),_0x2af8d6[_0xe009('0x17')],_0x24796a);_0x41a053(_0xba27fb[_0xe009('0x16')](0x1f4,_0x2af8d6[_0xe009('0x17')]));});});};exports[_0xe009('0x1a')]=function(_0x5d6eee){var _0x1c2dc8=this;return new Promise(function(_0x28e870,_0x310110){return db['CmHopper'][_0xe009('0x1b')](_0x5d6eee['body'],{'raw':_0x5d6eee[_0xe009('0xa')]?_0x5d6eee[_0xe009('0xa')][_0xe009('0xb')]===undefined?!![]:![]:!![]})['then'](function(_0xe6edae){logger[_0xe009('0x13')]('CreateCmHopper',_0x5d6eee);logger[_0xe009('0x1c')](_0xe009('0x1a'),_0x5d6eee,JSON[_0xe009('0x14')](_0xe6edae));_0x28e870(_0xe6edae);})[_0xe009('0x15')](function(_0x47f6c0){logger[_0xe009('0x16')]('CreateCmHopper',_0x47f6c0[_0xe009('0x17')],_0x5d6eee);_0x310110(_0x1c2dc8['error'](0x1f4,_0x47f6c0['message']));});});};exports[_0xe009('0x1d')]=function(_0xe25c0){var _0x282ad3=this;return new Promise(function(_0x29a638,_0x58aa02){return db[_0xe009('0x8')][_0xe009('0x1e')](_0xe25c0[_0xe009('0x1f')],{'raw':_0xe25c0[_0xe009('0xa')]?_0xe25c0['options'][_0xe009('0xb')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe25c0[_0xe009('0xa')]?_0xe25c0[_0xe009('0xa')][_0xe009('0xc')]||null:null,'attributes':_0xe25c0[_0xe009('0xa')]?_0xe25c0[_0xe009('0xa')][_0xe009('0x11')]||null:null,'limit':_0xe25c0[_0xe009('0xa')]?_0xe25c0[_0xe009('0xa')][_0xe009('0xd')]||null:null})['then'](function(_0x1c3a58){logger['info'](_0xe009('0x1d'),_0xe25c0);logger[_0xe009('0x13')](_0xe009('0x20'),JSON[_0xe009('0x14')](_0xe25c0[_0xe009('0xa')][_0xe009('0xc')]),_0xe25c0[_0xe009('0x1f')][_0xe009('0x21')]);logger[_0xe009('0x1c')](_0xe009('0x1d'),_0xe25c0,JSON[_0xe009('0x14')](_0x1c3a58));_0x29a638(_0x1c3a58);})[_0xe009('0x15')](function(_0x3d8d7a){logger[_0xe009('0x16')](_0xe009('0x1d'),_0x3d8d7a[_0xe009('0x17')],_0xe25c0);_0x58aa02(_0x282ad3[_0xe009('0x16')](0x1f4,_0x3d8d7a[_0xe009('0x17')]));});});};exports[_0xe009('0x22')]=function(_0x4af66f){var _0x2dc0c5=this;return new Promise(function(_0x2f93a2,_0x5686d8){return db[_0xe009('0x8')][_0xe009('0x23')]({'where':_0x4af66f[_0xe009('0xa')]?_0x4af66f['options'][_0xe009('0xc')]||null:null})['then'](function(_0x322fb6){logger[_0xe009('0x13')](_0xe009('0x22'),_0x4af66f);logger[_0xe009('0x1c')](_0xe009('0x22'),_0x4af66f,JSON[_0xe009('0x14')](_0x322fb6));_0x2f93a2(_0x322fb6);})['catch'](function(_0x17310d){logger['error'](_0xe009('0x22'),_0x17310d[_0xe009('0x17')],_0x4af66f);_0x5686d8(_0x2dc0c5[_0xe009('0x16')](0x1f4,_0x17310d[_0xe009('0x17')]));});});};exports[_0xe009('0x24')]=function(_0x56028b){var _0x1b50e0=this;return new Promise(function(_0x52fefb,_0x4318eb){return db[_0xe009('0x25')][_0xe009('0x26')]()[_0xe009('0x12')](function(_0x4152dd){return db[_0xe009('0x27')][_0xe009('0x28')](function(_0x33362){return db[_0xe009('0x8')]['findAll']({'where':_0x56028b[_0xe009('0xa')]?_0x56028b[_0xe009('0xa')][_0xe009('0xc')]||null:null,'attributes':_0x56028b[_0xe009('0xa')]?_0x56028b[_0xe009('0xa')][_0xe009('0x11')]||null:null,'limit':_0x56028b['options']?_0x56028b[_0xe009('0xa')][_0xe009('0xd')]||null:null,'order':_0x56028b['options']?_0x56028b[_0xe009('0xa')][_0xe009('0x29')]||null:null,'transaction':_0x33362,'lock':_0x33362[_0xe009('0x2a')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xe009('0x2b'),'attributes':_[_0xe009('0x2c')](_0x4152dd)},{'model':db[_0xe009('0x2d')],'as':'Agent','attributes':['id',_0xe009('0x2e'),'voicePause']}]})[_0xe009('0x12')](function(_0x24864d){var _0x463dfb=[];var _0x5f377f=[];for(var _0x3cf13c=0x0;_0x3cf13c<_0x24864d[_0xe009('0x2f')];_0x3cf13c+=0x1){var _0x5c27e4=_0x24864d[_0x3cf13c][_0xe009('0x30')];if(_0x5c27e4===null){_0x463dfb['push'](_0x24864d[_0x3cf13c][_0xe009('0x1e')](_0x56028b['body'],{'transaction':_0x33362}));}else if(!_0x5f377f['includes'](_0x5c27e4)){_0x5f377f['push'](_0x5c27e4);_0x463dfb[_0xe009('0x31')](_0x24864d[_0x3cf13c]['update'](_0x56028b[_0xe009('0x1f')],{'transaction':_0x33362}));}}return BPromise[_0xe009('0x32')](_0x463dfb);});})[_0xe009('0x12')](function(_0x2ff27b){logger[_0xe009('0x13')]('GetContactDialer',_0x56028b);if(_0x2ff27b['length']>0x0){logger[_0xe009('0x13')](_0xe009('0x33'),_0x2ff27b[0x0][_0xe009('0x34')]['id'],_0x2ff27b[0x0][_0xe009('0x34')][_0xe009('0x35')],_0x2ff27b[0x0][_0xe009('0x34')][_0xe009('0x21')]);}logger[_0xe009('0x1c')](_0xe009('0x24'),_0x56028b,JSON[_0xe009('0x14')](_0x2ff27b));_0x52fefb(_0x2ff27b);})['catch'](function(_0x4877e9){logger['error'](_0xe009('0x24'),_0x4877e9['message'],_0x56028b);_0x4318eb(_0x1b50e0[_0xe009('0x16')](0x1f4,_0x4877e9[_0xe009('0x17')]));});});});};exports[_0xe009('0x36')]=function(_0x3b7e31){var _0x2cef02=this;return new Promise(function(_0x1a34de,_0x16df49){return db['sequelize'][_0xe009('0x28')](function(_0x433fc3){return db[_0xe009('0x37')][_0xe009('0x1b')](_0x3b7e31[_0xe009('0x1f')],{'raw':_0x3b7e31[_0xe009('0xa')]?_0x3b7e31['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x433fc3})[_0xe009('0x12')](function(){logger[_0xe009('0x13')](_0xe009('0x38'),JSON[_0xe009('0x14')](_0x3b7e31['options']['where']),_0x3b7e31[_0xe009('0xa')][_0xe009('0xc')][_0xe009('0x21')]);return db[_0xe009('0x8')][_0xe009('0x23')]({'where':_0x3b7e31[_0xe009('0xa')]?_0x3b7e31[_0xe009('0xa')][_0xe009('0xc')]||null:null,'transaction':_0x433fc3});});})['then'](function(_0x41813b){logger[_0xe009('0x13')](_0xe009('0x36'),_0x3b7e31);logger[_0xe009('0x1c')](_0xe009('0x36'),_0x3b7e31,JSON[_0xe009('0x14')](_0x41813b));_0x1a34de(_0x41813b);})[_0xe009('0x15')](function(_0x5bec27){logger['error'](_0xe009('0x36'),_0x5bec27['message'],_0x3b7e31);_0x16df49(_0x2cef02['error'](0x1f4,_0x5bec27[_0xe009('0x17')]));});});};exports[_0xe009('0x39')]=function(_0x391e38){var _0x1dab26=this;return new Promise(function(_0x3b3346,_0x57b8f1){return db[_0xe009('0x8')][_0xe009('0x9')]({'raw':_0x391e38[_0xe009('0xa')]?_0x391e38[_0xe009('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x391e38[_0xe009('0xa')]?_0x391e38[_0xe009('0xa')][_0xe009('0xc')]||null:null,'attributes':[[db[_0xe009('0x27')]['fn'](_0xe009('0x3a'),db['sequelize']['fn']('IF',db[_0xe009('0x27')][_0xe009('0x3b')](_0xe009('0x3c')+util[_0xe009('0x3d')](_0xe009('0x3e'),moment()[_0xe009('0x3d')](_0xe009('0x3f')))+'\x20,\x201,\x20null'))),_0xe009('0x40')]]})['then'](function(_0x5d1035){logger[_0xe009('0x13')](_0xe009('0x39'),_0x391e38);logger['debug'](_0xe009('0x39'),_0x391e38,JSON[_0xe009('0x14')](_0x5d1035));_0x3b3346(_0x5d1035);})[_0xe009('0x15')](function(_0xb08f18){logger['error']('CountReScheduled',_0xb08f18[_0xe009('0x17')],_0x391e38);_0x57b8f1(_0x1dab26[_0xe009('0x16')](0x1f4,_0xb08f18[_0xe009('0x17')]));});});};exports[_0xe009('0x41')]=function(_0x33fd1c){var _0x55c458=this;return new Promise(function(_0x45bd73,_0x3e3d96){return db[_0xe009('0x25')][_0xe009('0x26')]()['then'](function(){return db[_0xe009('0x27')][_0xe009('0x28')](function(_0x23c42c){return db[_0xe009('0x8')][_0xe009('0x9')]({'where':_0x33fd1c[_0xe009('0xa')]?_0x33fd1c[_0xe009('0xa')][_0xe009('0xc')]||null:null,'attributes':_0x33fd1c['options']?_0x33fd1c[_0xe009('0xa')][_0xe009('0x11')]||null:null,'limit':0x1,'order':_0x33fd1c['options']?_0x33fd1c['options'][_0xe009('0x29')]||null:null,'group':db['CmHopper'][_0xe009('0x30')],'transaction':_0x23c42c,'lock':_0x23c42c['LOCK'][_0xe009('0x42')],'include':_0x33fd1c[_0xe009('0xa')]?_0x33fd1c[_0xe009('0xa')][_0xe009('0xe')]?_['map'](_0x33fd1c['options'][_0xe009('0xe')],function(_0x55c23b){return{'model':db[_0x55c23b[_0xe009('0x10')]],'as':_0x55c23b['as'],'attributes':_0x55c23b[_0xe009('0x11')],'include':_0x55c23b['include']?_[_0xe009('0xf')](_0x55c23b[_0xe009('0xe')],function(_0x376a69){return{'model':db[_0x376a69[_0xe009('0x10')]],'as':_0x376a69['as'],'attributes':_0x376a69[_0xe009('0x11')],'include':_0x376a69[_0xe009('0xe')]?_[_0xe009('0xf')](_0x376a69['include'],function(_0x2d5081){return{'model':db[_0x2d5081[_0xe009('0x10')]],'as':_0x2d5081['as'],'attributes':_0x2d5081[_0xe009('0x11')]};}):[]};}):[]};}):[]:[]})[_0xe009('0x12')](function(_0xbc0bf3){var _0x1af6a1=[];for(var _0x23f2f7=0x0;_0x23f2f7<_0xbc0bf3[_0xe009('0x2f')];_0x23f2f7+=0x1){_0x1af6a1[_0xe009('0x31')](_0xbc0bf3[_0x23f2f7][_0xe009('0x1e')](_0x33fd1c['body'],{'transaction':_0x23c42c}));}return BPromise[_0xe009('0x32')](_0x1af6a1);});})[_0xe009('0x12')](function(_0xb76d38){logger[_0xe009('0x13')](_0xe009('0x41'),_0x33fd1c);logger[_0xe009('0x1c')](_0xe009('0x41'),_0x33fd1c,JSON[_0xe009('0x14')](_0xb76d38));_0x45bd73(_0xb76d38);})[_0xe009('0x15')](function(_0x372b3f){logger[_0xe009('0x16')](_0xe009('0x41'),_0x372b3f[_0xe009('0x17')],_0x33fd1c);_0x3e3d96(_0x55c458[_0xe009('0x16')](0x1f4,_0x372b3f[_0xe009('0x17')]));});});});};exports[_0xe009('0x43')]=function(_0x1d7b09){var _0x1699dd=this;return new Promise(function(_0x298e41,_0x11805e){db['CmContact'][_0xe009('0x26')]()[_0xe009('0x12')](function(_0x55b197){return db['CmHopper'][_0xe009('0x9')]({'raw':_0x1d7b09[_0xe009('0xa')]?_0x1d7b09[_0xe009('0xa')][_0xe009('0xb')]===undefined?!![]:![]:!![],'where':_0x1d7b09[_0xe009('0xa')]?_0x1d7b09[_0xe009('0xa')][_0xe009('0xc')]||null:null,'attributes':_0x1d7b09[_0xe009('0xa')]?_0x1d7b09['options'][_0xe009('0x11')]||null:null,'limit':_0x1d7b09[_0xe009('0xa')]?_0x1d7b09[_0xe009('0xa')]['limit']||null:null,'include':_0x1d7b09['options']?_0x1d7b09['options'][_0xe009('0xe')]?_[_0xe009('0xf')](_0x1d7b09[_0xe009('0xa')][_0xe009('0xe')],function(_0x42f12b){return{'model':db[_0x42f12b[_0xe009('0x10')]],'as':_0x42f12b['as'],'attributes':_0x42f12b['as']===_0xe009('0x2b')?_['keys'](_0x55b197):_0x42f12b[_0xe009('0x11')],'include':_0x42f12b[_0xe009('0xe')]?_[_0xe009('0xf')](_0x42f12b[_0xe009('0xe')],function(_0x64b56d){return{'model':db[_0x64b56d['model']],'as':_0x64b56d['as'],'attributes':_0x64b56d[_0xe009('0x11')],'include':_0x64b56d[_0xe009('0xe')]?_['map'](_0x64b56d[_0xe009('0xe')],function(_0x500edd){return{'model':db[_0x500edd[_0xe009('0x10')]],'as':_0x500edd['as'],'attributes':_0x500edd[_0xe009('0x11')]};}):[]};}):[]};}):[]:[]})[_0xe009('0x12')](function(_0xd49de7){logger[_0xe009('0x13')]('GetCmHopper',_0x1d7b09);logger[_0xe009('0x1c')]('GetCmHopper',_0x1d7b09,JSON[_0xe009('0x14')](_0xd49de7));_0x298e41(_0xd49de7);})[_0xe009('0x15')](function(_0x15ac2b){logger['error']('GetCmHopper',_0x15ac2b[_0xe009('0x17')],_0x1d7b09);_0x11805e(_0x1699dd[_0xe009('0x16')](0x1f4,_0x15ac2b[_0xe009('0x17')]));});});});};exports[_0xe009('0x44')]=function(_0x45e4d0){var _0x4797f1=this;return new Promise(function(_0x1105e1,_0x5b31c9){return db[_0xe009('0x25')][_0xe009('0x45')]({'raw':!![],'where':{'phone':_0x45e4d0[_0xe009('0xa')][_0xe009('0xc')]['phone']},'attributes':['id','dialTimezone'],'order':[['id',_0xe009('0x46')]]})['then'](function(_0x2841b1){logger['info'](_0xe009('0x47'),_0x45e4d0);logger[_0xe009('0x1c')]('getContactByPhone',_0x45e4d0,JSON[_0xe009('0x14')](_0x2841b1));_0x1105e1(_0x2841b1);})[_0xe009('0x15')](function(_0x4d7b3b){logger[_0xe009('0x16')]('getContactByPhone',_0x4d7b3b[_0xe009('0x17')],_0x45e4d0);_0x5b31c9(_0x4797f1['error'](0x1f4,_0x4d7b3b[_0xe009('0x17')]));});});};exports[_0xe009('0x48')]=function(_0x341efd){var _0x250100=this;return new Promise(function(_0x14992a,_0x185249){return db[_0xe009('0x27')][_0xe009('0x28')](function(_0x1cebde){var _0x1cfd06=_0x341efd[_0xe009('0xa')]&&_0x341efd['options'][_0xe009('0xc')]?_0x341efd[_0xe009('0xa')][_0xe009('0xc')]:{};return db[_0xe009('0x8')]['update'](_0x341efd[_0xe009('0x1f')],{'where':_0x1cfd06,'transaction':_0x1cebde})['then'](function(_0x1a0252){logger['info'](_0xe009('0x48'),_0x341efd);logger['debug']('ResetActiveCalls',_0x341efd,JSON[_0xe009('0x14')](_0x1a0252));_0x14992a(_0x1a0252);})[_0xe009('0x15')](function(_0x562fd6){logger[_0xe009('0x16')](_0xe009('0x48'),_0x562fd6[_0xe009('0x17')],_0x341efd);_0x185249(_0x250100['error'](0x1f4,_0x562fd6[_0xe009('0x17')]));});});});};exports[_0xe009('0x49')]=function(_0x3b19ff){var _0x2f0990=this;var _0x1a6221=_0x3b19ff[_0xe009('0x1f')][_0xe009('0xc')]['voiceQueueIds'];var _0x57bb94=_0x3b19ff['body']['where'][_0xe009('0x4a')];var _0x1e8d73=_0x3b19ff[_0xe009('0x1f')][_0xe009('0xc')][_0xe009('0x4b')];return new Promise(function(_0x24783a,_0x4df52c){return db[_0xe009('0x8')][_0xe009('0x9')]({'where':{'voiceQueueId':{'$in':_0x1a6221},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe009('0x27')][_0xe009('0x3b')](_0xe009('0x4c')+_0x57bb94+_0xe009('0x4d')),'$gt':db[_0xe009('0x27')][_0xe009('0x3b')](_0xe009('0x4e'))}},'UserId':{'$in':_0x1e8d73}},'include':[{'model':db[_0xe009('0x25')],'as':_0xe009('0x2b')},{'model':db[_0xe009('0x2d')],'as':_0xe009('0x4f'),'attributes':['id',_0xe009('0x2e'),_0xe009('0x50')]},{'model':db[_0xe009('0x51')],'as':_0xe009('0x52')}]})[_0xe009('0x12')](function(_0x52604a){if(_0x52604a['length']>0x0){return db[_0xe009('0x27')]['transaction'](function(_0xf2f51f){return db[_0xe009('0x8')][_0xe009('0x1e')]({'recallmeNotifiedDate':db['sequelize'][_0xe009('0x3b')](_0xe009('0x4e'))},{'where':{'id':{'$in':_[_0xe009('0xf')](_0x52604a,'id')}},'transaction':_0xf2f51f})[_0xe009('0x12')](function(){_0x24783a(_0x52604a);})['catch'](function(_0x2c9816){logger[_0xe009('0x16')](_0xe009('0x49'),_0x2c9816['message'],_0x3b19ff);_0x4df52c(_0x2f0990[_0xe009('0x16')](0x1f4,_0x2c9816[_0xe009('0x17')]));});})[_0xe009('0x15')](function(_0x2d35b1){logger[_0xe009('0x16')]('CmHopperHandlePreviewRecallNotifications',_0x2d35b1['message'],_0x3b19ff);_0x4df52c(_0x2f0990[_0xe009('0x16')](0x1f4,_0x2d35b1[_0xe009('0x17')]));});}else{_0x24783a(_0x52604a);}});});}; \ No newline at end of file +var _0x28e1=['debug','stringify','catch','error','message','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','findAll','order','UPDATE','Contact','User','name','voicePause','length','UserId','includes','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','LOCK','all','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','lodash','util','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','raw','options','where','limit','include','map','model','attributes','then','info'];(function(_0x51ece4,_0x39165c){var _0x2b7e27=function(_0x88b36e){while(--_0x88b36e){_0x51ece4['push'](_0x51ece4['shift']());}};_0x2b7e27(++_0x39165c);}(_0x28e1,0xcf));var _0x128e=function(_0xcb1481,_0x26036f){_0xcb1481=_0xcb1481-0x0;var _0x4c52df=_0x28e1[_0xcb1481];return _0x4c52df;};'use strict';var _=require(_0x128e('0x0'));var util=require(_0x128e('0x1'));var moment=require(_0x128e('0x2'));var BPromise=require('bluebird');var db=require(_0x128e('0x3'))['db'];var logger=require(_0x128e('0x4'))(_0x128e('0x5'));exports[_0x128e('0x6')]=function(_0x56fa23){var _0x42c59e=this;return new Promise(function(_0x4f546b,_0x116ae5){return db[_0x128e('0x7')]['findAll']({'raw':_0x56fa23['options']?_0x56fa23['options'][_0x128e('0x8')]===undefined?!![]:![]:!![],'where':_0x56fa23[_0x128e('0x9')]?_0x56fa23['options'][_0x128e('0xa')]||null:null,'attributes':_0x56fa23['options']?_0x56fa23[_0x128e('0x9')]['attributes']||null:null,'limit':_0x56fa23[_0x128e('0x9')]?_0x56fa23[_0x128e('0x9')][_0x128e('0xb')]||null:null,'include':_0x56fa23[_0x128e('0x9')]?_0x56fa23[_0x128e('0x9')][_0x128e('0xc')]?_[_0x128e('0xd')](_0x56fa23[_0x128e('0x9')][_0x128e('0xc')],function(_0x5f38cb){return{'model':db[_0x5f38cb[_0x128e('0xe')]],'as':_0x5f38cb['as'],'attributes':_0x5f38cb[_0x128e('0xf')],'include':_0x5f38cb[_0x128e('0xc')]?_['map'](_0x5f38cb[_0x128e('0xc')],function(_0x1dfeba){return{'model':db[_0x1dfeba['model']],'as':_0x1dfeba['as'],'attributes':_0x1dfeba['attributes'],'include':_0x1dfeba[_0x128e('0xc')]?_[_0x128e('0xd')](_0x1dfeba[_0x128e('0xc')],function(_0x5cd529){return{'model':db[_0x5cd529[_0x128e('0xe')]],'as':_0x5cd529['as'],'attributes':_0x5cd529[_0x128e('0xf')]};}):[]};}):[]};}):[]:[]})[_0x128e('0x10')](function(_0x1589a8){logger[_0x128e('0x11')](_0x128e('0x6'),_0x56fa23);logger[_0x128e('0x12')]('GetCmHopper',_0x56fa23,JSON[_0x128e('0x13')](_0x1589a8));_0x4f546b(_0x1589a8);})[_0x128e('0x14')](function(_0x56ec26){logger[_0x128e('0x15')]('GetCmHopper',_0x56ec26[_0x128e('0x16')],_0x56fa23);_0x116ae5(_0x42c59e[_0x128e('0x15')](0x1f4,_0x56ec26[_0x128e('0x16')]));});});};exports[_0x128e('0x17')]=function(_0x478d6d){var _0x446558=this;return new Promise(function(_0x3aa514,_0x1bf277){return db['CmHopper']['find']({'raw':_0x478d6d[_0x128e('0x9')]?_0x478d6d[_0x128e('0x9')][_0x128e('0x8')]===undefined?!![]:![]:!![],'where':_0x478d6d[_0x128e('0x9')]?_0x478d6d['options'][_0x128e('0xa')]||null:null,'attributes':_0x478d6d['options']?_0x478d6d['options']['attributes']||null:null,'include':_0x478d6d[_0x128e('0x9')]?_0x478d6d[_0x128e('0x9')][_0x128e('0xc')]?_['map'](_0x478d6d['options'][_0x128e('0xc')],function(_0x1ce5fd){return{'model':db[_0x1ce5fd[_0x128e('0xe')]],'as':_0x1ce5fd['as'],'attributes':_0x1ce5fd[_0x128e('0xf')],'include':_0x1ce5fd['include']?_[_0x128e('0xd')](_0x1ce5fd['include'],function(_0x119b2c){return{'model':db[_0x119b2c[_0x128e('0xe')]],'as':_0x119b2c['as'],'attributes':_0x119b2c['attributes'],'include':_0x119b2c[_0x128e('0xc')]?_[_0x128e('0xd')](_0x119b2c['include'],function(_0x49dbab){return{'model':db[_0x49dbab[_0x128e('0xe')]],'as':_0x49dbab['as'],'attributes':_0x49dbab[_0x128e('0xf')]};}):[]};}):[]};}):[]:[]})[_0x128e('0x10')](function(_0x2889e3){logger['info']('ShowCmHopper',_0x478d6d);logger[_0x128e('0x12')](_0x128e('0x17'),_0x478d6d,JSON[_0x128e('0x13')](_0x2889e3));_0x3aa514(_0x2889e3);})[_0x128e('0x14')](function(_0x11eb8f){logger[_0x128e('0x15')](_0x128e('0x17'),_0x11eb8f[_0x128e('0x16')],_0x478d6d);_0x1bf277(_0x446558[_0x128e('0x15')](0x1f4,_0x11eb8f['message']));});});};exports[_0x128e('0x18')]=function(_0x18b135){var _0x4fabba=this;return new Promise(function(_0x3e607b,_0x41e381){return db[_0x128e('0x7')][_0x128e('0x19')](_0x18b135[_0x128e('0x1a')],{'raw':_0x18b135[_0x128e('0x9')]?_0x18b135[_0x128e('0x9')][_0x128e('0x8')]===undefined?!![]:![]:!![]})[_0x128e('0x10')](function(_0x3e8770){logger['info'](_0x128e('0x18'),_0x18b135);logger[_0x128e('0x12')](_0x128e('0x18'),_0x18b135,JSON['stringify'](_0x3e8770));_0x3e607b(_0x3e8770);})[_0x128e('0x14')](function(_0x3e57bd){logger['error'](_0x128e('0x18'),_0x3e57bd['message'],_0x18b135);_0x41e381(_0x4fabba[_0x128e('0x15')](0x1f4,_0x3e57bd[_0x128e('0x16')]));});});};exports[_0x128e('0x1b')]=function(_0x32e863){var _0x1efdce=this;return new Promise(function(_0x115cc1,_0x2507eb){return db['CmHopper'][_0x128e('0x1c')](_0x32e863[_0x128e('0x1a')],{'raw':_0x32e863[_0x128e('0x9')]?_0x32e863[_0x128e('0x9')][_0x128e('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e863[_0x128e('0x9')]?_0x32e863[_0x128e('0x9')]['where']||null:null,'attributes':_0x32e863[_0x128e('0x9')]?_0x32e863[_0x128e('0x9')]['attributes']||null:null,'limit':_0x32e863['options']?_0x32e863['options'][_0x128e('0xb')]||null:null})['then'](function(_0x4b3740){logger['info'](_0x128e('0x1b'),_0x32e863);logger[_0x128e('0x11')](_0x128e('0x1d'),JSON['stringify'](_0x32e863[_0x128e('0x9')][_0x128e('0xa')]),_0x32e863[_0x128e('0x1a')][_0x128e('0x1e')]);logger['debug'](_0x128e('0x1b'),_0x32e863,JSON[_0x128e('0x13')](_0x4b3740));_0x115cc1(_0x4b3740);})[_0x128e('0x14')](function(_0x486864){logger[_0x128e('0x15')]('UpdateCmHopper',_0x486864['message'],_0x32e863);_0x2507eb(_0x1efdce[_0x128e('0x15')](0x1f4,_0x486864[_0x128e('0x16')]));});});};exports[_0x128e('0x1f')]=function(_0x3818dc){var _0x34c077=this;return new Promise(function(_0x5de750,_0xd4ea9d){return db[_0x128e('0x7')][_0x128e('0x20')]({'where':_0x3818dc[_0x128e('0x9')]?_0x3818dc['options'][_0x128e('0xa')]||null:null})[_0x128e('0x10')](function(_0x388cca){logger[_0x128e('0x11')](_0x128e('0x1f'),_0x3818dc);logger[_0x128e('0x12')](_0x128e('0x1f'),_0x3818dc,JSON['stringify'](_0x388cca));_0x5de750(_0x388cca);})['catch'](function(_0x445586){logger[_0x128e('0x15')]('DestroyCmHopper',_0x445586[_0x128e('0x16')],_0x3818dc);_0xd4ea9d(_0x34c077[_0x128e('0x15')](0x1f4,_0x445586[_0x128e('0x16')]));});});};exports[_0x128e('0x21')]=function(_0x53e7b5){var _0x2991b0=this;return new Promise(function(_0x1be2e9,_0x1ff29e){return db[_0x128e('0x22')][_0x128e('0x23')]()['then'](function(_0x5b3398){return db['sequelize']['transaction'](function(_0x586b11){return db[_0x128e('0x7')][_0x128e('0x24')]({'where':_0x53e7b5['options']?_0x53e7b5[_0x128e('0x9')][_0x128e('0xa')]||null:null,'attributes':_0x53e7b5['options']?_0x53e7b5[_0x128e('0x9')][_0x128e('0xf')]||null:null,'limit':_0x53e7b5[_0x128e('0x9')]?_0x53e7b5[_0x128e('0x9')][_0x128e('0xb')]||null:null,'order':_0x53e7b5[_0x128e('0x9')]?_0x53e7b5[_0x128e('0x9')][_0x128e('0x25')]||null:null,'transaction':_0x586b11,'lock':_0x586b11['LOCK'][_0x128e('0x26')],'include':[{'model':db[_0x128e('0x22')],'as':_0x128e('0x27'),'attributes':_['keys'](_0x5b3398)},{'model':db[_0x128e('0x28')],'as':'Agent','attributes':['id',_0x128e('0x29'),_0x128e('0x2a')]}]})[_0x128e('0x10')](function(_0x4d2d98){var _0x480b4b=[];var _0x4f91a8=[];for(var _0x16dc38=0x0;_0x16dc38<_0x4d2d98[_0x128e('0x2b')];_0x16dc38+=0x1){var _0x18919d=_0x4d2d98[_0x16dc38][_0x128e('0x2c')];if(_0x18919d===null){_0x480b4b['push'](_0x4d2d98[_0x16dc38]['update'](_0x53e7b5['body'],{'transaction':_0x586b11}));}else if(!_0x4f91a8[_0x128e('0x2d')](_0x18919d)){_0x4f91a8['push'](_0x18919d);_0x480b4b[_0x128e('0x2e')](_0x4d2d98[_0x16dc38][_0x128e('0x1c')](_0x53e7b5[_0x128e('0x1a')],{'transaction':_0x586b11}));}}return BPromise['all'](_0x480b4b);});})['then'](function(_0x1e30a2){logger[_0x128e('0x11')]('GetContactDialer',_0x53e7b5);if(_0x1e30a2[_0x128e('0x2b')]>0x0){logger[_0x128e('0x11')](_0x128e('0x2f'),_0x1e30a2[0x0][_0x128e('0x30')]['id'],_0x1e30a2[0x0][_0x128e('0x30')]['ContactId'],_0x1e30a2[0x0][_0x128e('0x30')][_0x128e('0x1e')]);}logger['debug'](_0x128e('0x21'),_0x53e7b5,JSON['stringify'](_0x1e30a2));_0x1be2e9(_0x1e30a2);})[_0x128e('0x14')](function(_0x3f84d2){logger[_0x128e('0x15')](_0x128e('0x21'),_0x3f84d2[_0x128e('0x16')],_0x53e7b5);_0x1ff29e(_0x2991b0[_0x128e('0x15')](0x1f4,_0x3f84d2[_0x128e('0x16')]));});});});};exports[_0x128e('0x31')]=function(_0x37bc2d){var _0x396bfc=this;return new Promise(function(_0x47a216,_0x13ec02){return db[_0x128e('0x32')][_0x128e('0x33')](function(_0x969534){return db[_0x128e('0x34')][_0x128e('0x19')](_0x37bc2d[_0x128e('0x1a')],{'raw':_0x37bc2d[_0x128e('0x9')]?_0x37bc2d[_0x128e('0x9')][_0x128e('0x8')]===undefined?!![]:![]:!![],'transaction':_0x969534})[_0x128e('0x10')](function(){logger[_0x128e('0x11')](_0x128e('0x35'),JSON['stringify'](_0x37bc2d['options'][_0x128e('0xa')]),_0x37bc2d['options'][_0x128e('0xa')][_0x128e('0x1e')]);return db[_0x128e('0x7')][_0x128e('0x20')]({'where':_0x37bc2d[_0x128e('0x9')]?_0x37bc2d['options'][_0x128e('0xa')]||null:null,'transaction':_0x969534});});})['then'](function(_0x4d17c4){logger[_0x128e('0x11')](_0x128e('0x31'),_0x37bc2d);logger['debug']('MoveContactManagedDialer',_0x37bc2d,JSON[_0x128e('0x13')](_0x4d17c4));_0x47a216(_0x4d17c4);})[_0x128e('0x14')](function(_0x192308){logger[_0x128e('0x15')](_0x128e('0x31'),_0x192308[_0x128e('0x16')],_0x37bc2d);_0x13ec02(_0x396bfc[_0x128e('0x15')](0x1f4,_0x192308['message']));});});};exports['CountReScheduled']=function(_0x29e9a5){var _0x550722=this;return new Promise(function(_0x3d9ddb,_0xcab5c7){return db[_0x128e('0x7')][_0x128e('0x24')]({'raw':_0x29e9a5[_0x128e('0x9')]?_0x29e9a5['options'][_0x128e('0x8')]===undefined?!![]:![]:!![],'where':_0x29e9a5['options']?_0x29e9a5[_0x128e('0x9')][_0x128e('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0x128e('0x36'),db['sequelize']['fn']('IF',db[_0x128e('0x32')][_0x128e('0x37')]('`scheduledat`\x20>=\x20'+util[_0x128e('0x38')]('\x22%s\x22',moment()[_0x128e('0x38')](_0x128e('0x39')))+'\x20,\x201,\x20null'))),_0x128e('0x3a')]]})[_0x128e('0x10')](function(_0x35c88f){logger[_0x128e('0x11')]('CountReScheduled',_0x29e9a5);logger[_0x128e('0x12')](_0x128e('0x3b'),_0x29e9a5,JSON['stringify'](_0x35c88f));_0x3d9ddb(_0x35c88f);})[_0x128e('0x14')](function(_0x23d45d){logger[_0x128e('0x15')](_0x128e('0x3b'),_0x23d45d[_0x128e('0x16')],_0x29e9a5);_0xcab5c7(_0x550722[_0x128e('0x15')](0x1f4,_0x23d45d[_0x128e('0x16')]));});});};exports[_0x128e('0x3c')]=function(_0x1f2a93){var _0xceae72=this;return new Promise(function(_0x33b4a1,_0x36fe97){return db['CmContact'][_0x128e('0x23')]()[_0x128e('0x10')](function(){return db[_0x128e('0x32')][_0x128e('0x33')](function(_0x5985cf){return db['CmHopper']['findAll']({'where':_0x1f2a93[_0x128e('0x9')]?_0x1f2a93[_0x128e('0x9')][_0x128e('0xa')]||null:null,'attributes':_0x1f2a93[_0x128e('0x9')]?_0x1f2a93[_0x128e('0x9')][_0x128e('0xf')]||null:null,'limit':0x1,'order':_0x1f2a93['options']?_0x1f2a93[_0x128e('0x9')][_0x128e('0x25')]||null:null,'group':db[_0x128e('0x7')][_0x128e('0x2c')],'transaction':_0x5985cf,'lock':_0x5985cf[_0x128e('0x3d')][_0x128e('0x26')],'include':_0x1f2a93[_0x128e('0x9')]?_0x1f2a93['options'][_0x128e('0xc')]?_[_0x128e('0xd')](_0x1f2a93[_0x128e('0x9')][_0x128e('0xc')],function(_0x48c07b){return{'model':db[_0x48c07b[_0x128e('0xe')]],'as':_0x48c07b['as'],'attributes':_0x48c07b[_0x128e('0xf')],'include':_0x48c07b[_0x128e('0xc')]?_[_0x128e('0xd')](_0x48c07b['include'],function(_0x3e7136){return{'model':db[_0x3e7136[_0x128e('0xe')]],'as':_0x3e7136['as'],'attributes':_0x3e7136[_0x128e('0xf')],'include':_0x3e7136['include']?_[_0x128e('0xd')](_0x3e7136[_0x128e('0xc')],function(_0x313209){return{'model':db[_0x313209[_0x128e('0xe')]],'as':_0x313209['as'],'attributes':_0x313209[_0x128e('0xf')]};}):[]};}):[]};}):[]:[]})[_0x128e('0x10')](function(_0x3f7eaa){var _0x29aaca=[];for(var _0x6eac87=0x0;_0x6eac87<_0x3f7eaa[_0x128e('0x2b')];_0x6eac87+=0x1){_0x29aaca['push'](_0x3f7eaa[_0x6eac87][_0x128e('0x1c')](_0x1f2a93[_0x128e('0x1a')],{'transaction':_0x5985cf}));}return BPromise[_0x128e('0x3e')](_0x29aaca);});})[_0x128e('0x10')](function(_0x7b6bc4){logger['info'](_0x128e('0x3c'),_0x1f2a93);logger['debug'](_0x128e('0x3c'),_0x1f2a93,JSON[_0x128e('0x13')](_0x7b6bc4));_0x33b4a1(_0x7b6bc4);})['catch'](function(_0x58ad2b){logger[_0x128e('0x15')](_0x128e('0x3c'),_0x58ad2b[_0x128e('0x16')],_0x1f2a93);_0x36fe97(_0xceae72[_0x128e('0x15')](0x1f4,_0x58ad2b[_0x128e('0x16')]));});});});};exports['GetCmHopperPreview']=function(_0x313017){var _0x1136b1=this;return new Promise(function(_0x5b927c,_0x2d34b1){db[_0x128e('0x22')]['describe']()[_0x128e('0x10')](function(_0x15cf06){return db[_0x128e('0x7')][_0x128e('0x24')]({'raw':_0x313017[_0x128e('0x9')]?_0x313017[_0x128e('0x9')][_0x128e('0x8')]===undefined?!![]:![]:!![],'where':_0x313017[_0x128e('0x9')]?_0x313017[_0x128e('0x9')][_0x128e('0xa')]||null:null,'attributes':_0x313017[_0x128e('0x9')]?_0x313017['options']['attributes']||null:null,'limit':_0x313017['options']?_0x313017[_0x128e('0x9')][_0x128e('0xb')]||null:null,'include':_0x313017[_0x128e('0x9')]?_0x313017['options']['include']?_[_0x128e('0xd')](_0x313017[_0x128e('0x9')][_0x128e('0xc')],function(_0x1d9b51){return{'model':db[_0x1d9b51[_0x128e('0xe')]],'as':_0x1d9b51['as'],'attributes':_0x1d9b51['as']==='Contact'?_['keys'](_0x15cf06):_0x1d9b51[_0x128e('0xf')],'include':_0x1d9b51['include']?_[_0x128e('0xd')](_0x1d9b51[_0x128e('0xc')],function(_0x55b66e){return{'model':db[_0x55b66e[_0x128e('0xe')]],'as':_0x55b66e['as'],'attributes':_0x55b66e['attributes'],'include':_0x55b66e['include']?_[_0x128e('0xd')](_0x55b66e[_0x128e('0xc')],function(_0x3e4ce3){return{'model':db[_0x3e4ce3[_0x128e('0xe')]],'as':_0x3e4ce3['as'],'attributes':_0x3e4ce3[_0x128e('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1701da){logger[_0x128e('0x11')](_0x128e('0x6'),_0x313017);logger[_0x128e('0x12')](_0x128e('0x6'),_0x313017,JSON[_0x128e('0x13')](_0x1701da));_0x5b927c(_0x1701da);})[_0x128e('0x14')](function(_0x462611){logger[_0x128e('0x15')](_0x128e('0x6'),_0x462611[_0x128e('0x16')],_0x313017);_0x2d34b1(_0x1136b1[_0x128e('0x15')](0x1f4,_0x462611['message']));});});});};exports[_0x128e('0x3f')]=function(_0x53270b){var _0x31ab59=this;return new Promise(function(_0x555eec,_0x240d85){return db[_0x128e('0x22')][_0x128e('0x40')]({'raw':!![],'where':{'phone':_0x53270b['options']['where'][_0x128e('0x41')]},'attributes':['id',_0x128e('0x42')],'order':[['id','DESC']]})[_0x128e('0x10')](function(_0x31bdfe){logger['info'](_0x128e('0x43'),_0x53270b);logger[_0x128e('0x12')](_0x128e('0x43'),_0x53270b,JSON[_0x128e('0x13')](_0x31bdfe));_0x555eec(_0x31bdfe);})[_0x128e('0x14')](function(_0x2d3c93){logger[_0x128e('0x15')]('getContactByPhone',_0x2d3c93['message'],_0x53270b);_0x240d85(_0x31ab59[_0x128e('0x15')](0x1f4,_0x2d3c93[_0x128e('0x16')]));});});};exports[_0x128e('0x44')]=function(_0x29b90f){var _0x59984d=this;return new Promise(function(_0x5b0bca,_0x4879d6){return db[_0x128e('0x32')][_0x128e('0x33')](function(_0x12624a){var _0x136edf=_0x29b90f[_0x128e('0x9')]&&_0x29b90f[_0x128e('0x9')][_0x128e('0xa')]?_0x29b90f[_0x128e('0x9')]['where']:{};return db[_0x128e('0x7')][_0x128e('0x1c')](_0x29b90f[_0x128e('0x1a')],{'where':_0x136edf,'transaction':_0x12624a})[_0x128e('0x10')](function(_0x113fa6){logger[_0x128e('0x11')](_0x128e('0x44'),_0x29b90f);logger[_0x128e('0x12')](_0x128e('0x44'),_0x29b90f,JSON[_0x128e('0x13')](_0x113fa6));_0x5b0bca(_0x113fa6);})[_0x128e('0x14')](function(_0x510c3e){logger['error'](_0x128e('0x44'),_0x510c3e[_0x128e('0x16')],_0x29b90f);_0x4879d6(_0x59984d[_0x128e('0x15')](0x1f4,_0x510c3e[_0x128e('0x16')]));});});});};exports[_0x128e('0x45')]=function(_0x3dc99c){var _0x34b43=this;var _0x13b6fd=_0x3dc99c[_0x128e('0x1a')][_0x128e('0xa')][_0x128e('0x46')];var _0x3ae65c=_0x3dc99c['body'][_0x128e('0xa')]['interval'];var _0x5794d1=_0x3dc99c[_0x128e('0x1a')]['where']['availableAgentsIds'];return new Promise(function(_0x59c1b6,_0x17fd1b){return db['CmHopper'][_0x128e('0x24')]({'where':{'voiceQueueId':{'$in':_0x13b6fd},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x128e('0x32')][_0x128e('0x37')](_0x128e('0x47')+_0x3ae65c+_0x128e('0x48')),'$gt':db[_0x128e('0x32')][_0x128e('0x37')](_0x128e('0x49'))}},'UserId':{'$in':_0x5794d1}},'include':[{'model':db[_0x128e('0x22')],'as':_0x128e('0x27')},{'model':db['User'],'as':'Agent','attributes':['id',_0x128e('0x29'),_0x128e('0x2a')]},{'model':db[_0x128e('0x4a')],'as':'List'}]})[_0x128e('0x10')](function(_0x8da44f){if(_0x8da44f[_0x128e('0x2b')]>0x0){return db[_0x128e('0x32')][_0x128e('0x33')](function(_0x5dc999){return db[_0x128e('0x7')][_0x128e('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0x128e('0x37')]('NOW()')},{'where':{'id':{'$in':_[_0x128e('0xd')](_0x8da44f,'id')}},'transaction':_0x5dc999})['then'](function(){_0x59c1b6(_0x8da44f);})['catch'](function(_0x3749bc){logger[_0x128e('0x15')](_0x128e('0x45'),_0x3749bc['message'],_0x3dc99c);_0x17fd1b(_0x34b43['error'](0x1f4,_0x3749bc['message']));});})[_0x128e('0x14')](function(_0x449d89){logger[_0x128e('0x15')](_0x128e('0x45'),_0x449d89['message'],_0x3dc99c);_0x17fd1b(_0x34b43[_0x128e('0x15')](0x1f4,_0x449d89[_0x128e('0x16')]));});}else{_0x59c1b6(_0x8da44f);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5be99ac..518b35f 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 _0xaed4=['/:id','show','getPreviewRecall','post','create','/preview','/timezone','getTimezone','update','destroy','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','getOpenContacts','/timezones','getTimezones'];(function(_0x4eb51d,_0xc4ddea){var _0xbf88b9=function(_0xf5b603){while(--_0xf5b603){_0x4eb51d['push'](_0x4eb51d['shift']());}};_0xbf88b9(++_0xc4ddea);}(_0xaed4,0xb5));var _0x4aed=function(_0x63cf23,_0x360999){_0x63cf23=_0x63cf23-0x0;var _0x30960c=_0xaed4[_0x63cf23];return _0x30960c;};'use strict';var express=require('express');var router=express[_0x4aed('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x4aed('0x1'));router[_0x4aed('0x2')]('/',auth[_0x4aed('0x3')](),controller[_0x4aed('0x4')]);router[_0x4aed('0x2')](_0x4aed('0x5'),auth[_0x4aed('0x3')](),controller['describe']);router[_0x4aed('0x2')]('/opencontacts',auth[_0x4aed('0x3')](),controller[_0x4aed('0x6')]);router[_0x4aed('0x2')](_0x4aed('0x7'),auth['isAuthenticated'](),controller[_0x4aed('0x8')]);router[_0x4aed('0x2')](_0x4aed('0x9'),auth[_0x4aed('0x3')](),controller[_0x4aed('0xa')]);router[_0x4aed('0x2')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x4aed('0xb')]);router[_0x4aed('0xc')]('/',auth[_0x4aed('0x3')](),controller[_0x4aed('0xd')]);router['post'](_0x4aed('0xe'),auth['isAuthenticated'](),controller['getPreview']);router[_0x4aed('0xc')](_0x4aed('0xf'),auth[_0x4aed('0x3')](),controller[_0x4aed('0x10')]);router['put']('/:id',auth[_0x4aed('0x3')](),controller[_0x4aed('0x11')]);router['delete'](_0x4aed('0x9'),auth['isAuthenticated'](),controller[_0x4aed('0x12')]);module['exports']=router; \ No newline at end of file +var _0x446d=['getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','get','isAuthenticated','index','/describe','describe','/opencontacts','/timezones','getTimezones','/:id','show','post','/preview'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x446d,0xa2));var _0xd446=function(_0x2af3e1,_0xb5207f){_0x2af3e1=_0x2af3e1-0x0;var _0xfa27d=_0x446d[_0x2af3e1];return _0xfa27d;};'use strict';var express=require(_0xd446('0x0'));var router=express[_0xd446('0x1')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0xd446('0x2')]('/',auth[_0xd446('0x3')](),controller[_0xd446('0x4')]);router['get'](_0xd446('0x5'),auth['isAuthenticated'](),controller[_0xd446('0x6')]);router[_0xd446('0x2')](_0xd446('0x7'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xd446('0x2')](_0xd446('0x8'),auth[_0xd446('0x3')](),controller[_0xd446('0x9')]);router['get'](_0xd446('0xa'),auth[_0xd446('0x3')](),controller[_0xd446('0xb')]);router['get']('/:id/previewrecall',auth[_0xd446('0x3')](),controller['getPreviewRecall']);router[_0xd446('0xc')]('/',auth[_0xd446('0x3')](),controller['create']);router[_0xd446('0xc')](_0xd446('0xd'),auth['isAuthenticated'](),controller[_0xd446('0xe')]);router[_0xd446('0xc')](_0xd446('0xf'),auth[_0xd446('0x3')](),controller[_0xd446('0x10')]);router[_0xd446('0x11')]('/:id',auth[_0xd446('0x3')](),controller[_0xd446('0x12')]);router[_0xd446('0x13')](_0xd446('0xa'),auth[_0xd446('0x3')](),controller[_0xd446('0x14')]);module[_0xd446('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index ffd6e01..3a5fa60 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9515=['format','moment','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x12b911,_0x283b38){var _0x3e3205=function(_0x3b8343){while(--_0x3b8343){_0x12b911['push'](_0x12b911['shift']());}};_0x3e3205(++_0x283b38);}(_0x9515,0x1eb));var _0x5951=function(_0x56fc41,_0x550632){_0x56fc41=_0x56fc41-0x0;var _0x2de570=_0x9515[_0x56fc41];return _0x2de570;};'use strict';var moment=require(_0x5951('0x0'));var Sequelize=require(_0x5951('0x1'));module[_0x5951('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x5951('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5951('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5951('0x5')],'defaultValue':moment()[_0x5951('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x5951('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5951('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5951('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5951('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5951('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5951('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2159=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER'];(function(_0x201740,_0x3de1f0){var _0x5b62a1=function(_0x532b0f){while(--_0x532b0f){_0x201740['push'](_0x201740['shift']());}};_0x5b62a1(++_0x3de1f0);}(_0x2159,0xff));var _0x9215=function(_0x5d43f5,_0x8c9030){_0x5d43f5=_0x5d43f5-0x0;var _0x453144=_0x2159[_0x5d43f5];return _0x453144;};'use strict';var moment=require(_0x9215('0x0'));var Sequelize=require(_0x9215('0x1'));module[_0x9215('0x2')]={'CmHopperId':{'type':Sequelize[_0x9215('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9215('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9215('0x4')],'defaultValue':moment()[_0x9215('0x5')](_0x9215('0x6'))},'countbusyretry':{'type':Sequelize[_0x9215('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9215('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9215('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9215('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9215('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9215('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9215('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 4a46905..a69f297 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2d8=['json','apply','reject','save','update','get','CmHopperAdditionalPhones','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0xa2d8,0xdd));var _0x8a2d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa2d8[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x8a2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a2d('0x1'));var jsonpatch=require(_0x8a2d('0x2'));var rp=require(_0x8a2d('0x3'));var moment=require('moment');var BPromise=require(_0x8a2d('0x4'));var Mustache=require(_0x8a2d('0x5'));var util=require(_0x8a2d('0x6'));var path=require('path');var sox=require(_0x8a2d('0x7'));var csv=require(_0x8a2d('0x8'));var ejs=require(_0x8a2d('0x9'));var fs=require('fs');var fs_extra=require(_0x8a2d('0xa'));var _=require(_0x8a2d('0xb'));var squel=require(_0x8a2d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8a2d('0xd'));var toCsv=require(_0x8a2d('0x8'));var querystring=require(_0x8a2d('0xe'));var Papa=require(_0x8a2d('0xf'));var Redis=require(_0x8a2d('0x10'));var authService=require(_0x8a2d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8a2d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a2d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8a2d('0x14'));var licenseUtil=require(_0x8a2d('0x15'));var db=require(_0x8a2d('0x16'))['db'];function respondWithStatusCode(_0x5e314a,_0x4946ac){_0x4946ac=_0x4946ac||0xcc;return function(_0x28ca01){if(_0x28ca01){return _0x5e314a['sendStatus'](_0x4946ac);}return _0x5e314a[_0x8a2d('0x17')](_0x4946ac)[_0x8a2d('0x18')]();};}function respondWithResult(_0x52b976,_0x8a7e10){_0x8a7e10=_0x8a7e10||0xc8;return function(_0x26033e){if(_0x26033e){return _0x52b976['status'](_0x8a7e10)['json'](_0x26033e);}};}function respondWithFilteredResult(_0x5050ad,_0xe8d97f){return function(_0x4a6364){if(_0x4a6364){var _0x398a29=typeof _0xe8d97f[_0x8a2d('0x19')]===_0x8a2d('0x1a')&&typeof _0xe8d97f['limit']===_0x8a2d('0x1a');var _0xb9c98f=_0x4a6364[_0x8a2d('0x1b')];var _0x281998=_0x398a29?0x0:_0xe8d97f[_0x8a2d('0x19')];var _0x33cf07=_0x398a29?_0x4a6364['count']:_0xe8d97f['offset']+_0xe8d97f['limit'];var _0x1e1f40;if(_0x33cf07>=_0xb9c98f){_0x33cf07=_0xb9c98f;_0x1e1f40=0xc8;}else{_0x1e1f40=0xce;}_0x5050ad['status'](_0x1e1f40);return _0x5050ad['set']('Content-Range',_0x281998+'-'+_0x33cf07+'/'+_0xb9c98f)[_0x8a2d('0x1c')](_0x4a6364);}return null;};}function patchUpdates(_0x56a457){return function(_0x20c23c){try{jsonpatch[_0x8a2d('0x1d')](_0x20c23c,_0x56a457,!![]);}catch(_0x15db3d){return BPromise[_0x8a2d('0x1e')](_0x15db3d);}return _0x20c23c[_0x8a2d('0x1f')]();};}function saveUpdates(_0x4a5cda,_0x5bdd85){return function(_0x1ab8ef){if(_0x1ab8ef){return _0x1ab8ef[_0x8a2d('0x20')](_0x4a5cda)['then'](function(_0x58f327){return _0x58f327;});}return null;};}function removeEntity(_0x38287a,_0x3f2b34){return function(_0x572593){if(_0x572593){return _0x572593['destroy']()['then'](function(){var _0x51d1a6=_0x572593[_0x8a2d('0x21')]({'plain':!![]});var _0x3b3799=_0x8a2d('0x22');return db[_0x8a2d('0x23')][_0x8a2d('0x24')]({'where':{'type':_0x3b3799,'resourceId':_0x51d1a6['id']}})[_0x8a2d('0x25')](function(){return _0x572593;});})[_0x8a2d('0x25')](function(){_0x38287a[_0x8a2d('0x17')](0xcc)[_0x8a2d('0x18')]();});}};}function handleEntityNotFound(_0x4c012a,_0xcb0077){return function(_0x592c79){if(!_0x592c79){_0x4c012a[_0x8a2d('0x26')](0x194);}return _0x592c79;};}function handleError(_0x52ca4a,_0x5206d5){_0x5206d5=_0x5206d5||0x1f4;return function(_0x503ced){logger[_0x8a2d('0x27')](_0x503ced[_0x8a2d('0x28')]);if(_0x503ced[_0x8a2d('0x29')]){delete _0x503ced[_0x8a2d('0x29')];}_0x52ca4a[_0x8a2d('0x17')](_0x5206d5)[_0x8a2d('0x2a')](_0x503ced);};}exports[_0x8a2d('0x2b')]=function(_0x512cd8,_0xfaad6c){var _0xd2f4e9={},_0x9f2f72={},_0x5b5161={'count':0x0,'rows':[]};var _0x4f736e=_[_0x8a2d('0x2c')](db[_0x8a2d('0x2d')][_0x8a2d('0x2e')],function(_0xc24813){return{'name':_0xc24813[_0x8a2d('0x2f')],'type':_0xc24813[_0x8a2d('0x30')][_0x8a2d('0x31')]};});_0x9f2f72[_0x8a2d('0x32')]=_['map'](_0x4f736e,_0x8a2d('0x29'));_0x9f2f72['query']=_[_0x8a2d('0x33')](_0x512cd8['query']);_0x9f2f72['filters']=_[_0x8a2d('0x34')](_0x9f2f72['model'],_0x9f2f72[_0x8a2d('0x35')]);_0xd2f4e9['attributes']=_[_0x8a2d('0x34')](_0x9f2f72[_0x8a2d('0x32')],qs['fields'](_0x512cd8[_0x8a2d('0x35')][_0x8a2d('0x36')]));_0xd2f4e9[_0x8a2d('0x37')]=_0xd2f4e9[_0x8a2d('0x37')][_0x8a2d('0x38')]?_0xd2f4e9[_0x8a2d('0x37')]:_0x9f2f72[_0x8a2d('0x32')];if(!_0x512cd8[_0x8a2d('0x35')][_0x8a2d('0x39')]('nolimit')){_0xd2f4e9[_0x8a2d('0x3a')]=qs['limit'](_0x512cd8[_0x8a2d('0x35')][_0x8a2d('0x3a')]);_0xd2f4e9[_0x8a2d('0x19')]=qs[_0x8a2d('0x19')](_0x512cd8[_0x8a2d('0x35')][_0x8a2d('0x19')]);}_0xd2f4e9[_0x8a2d('0x3b')]=qs[_0x8a2d('0x3c')](_0x512cd8[_0x8a2d('0x35')][_0x8a2d('0x3c')]);_0xd2f4e9['where']=qs[_0x8a2d('0x3d')](_[_0x8a2d('0x3e')](_0x512cd8[_0x8a2d('0x35')],_0x9f2f72[_0x8a2d('0x3d')]),_0x4f736e);if(_0x512cd8['query'][_0x8a2d('0x3f')]){_0xd2f4e9[_0x8a2d('0x40')]=_['merge'](_0xd2f4e9[_0x8a2d('0x40')],{'$or':_[_0x8a2d('0x2c')](_0x4f736e,function(_0x58d5e9){if(_0x58d5e9[_0x8a2d('0x30')]!==_0x8a2d('0x41')){var _0xf3a67f={};_0xf3a67f[_0x58d5e9['name']]={'$like':'%'+_0x512cd8[_0x8a2d('0x35')][_0x8a2d('0x3f')]+'%'};return _0xf3a67f;}})});}_0xd2f4e9=_[_0x8a2d('0x42')]({},_0xd2f4e9,_0x512cd8[_0x8a2d('0x43')]);var _0xb90d4a={'where':_0xd2f4e9[_0x8a2d('0x40')]};return db['CmHopperAdditionalPhone']['count'](_0xb90d4a)[_0x8a2d('0x25')](function(_0x4d3bef){_0x5b5161[_0x8a2d('0x1b')]=_0x4d3bef;if(_0x512cd8[_0x8a2d('0x35')][_0x8a2d('0x44')]){_0xd2f4e9[_0x8a2d('0x45')]=[{'all':!![]}];}return db[_0x8a2d('0x2d')]['findAll'](_0xd2f4e9);})[_0x8a2d('0x25')](function(_0x1bfcb4){_0x5b5161[_0x8a2d('0x46')]=_0x1bfcb4;return _0x5b5161;})[_0x8a2d('0x25')](respondWithFilteredResult(_0xfaad6c,_0xd2f4e9))['catch'](handleError(_0xfaad6c,null));};exports['show']=function(_0x27147f,_0x21ae17){var _0x2fb91e={'raw':!![],'where':{'id':_0x27147f['params']['id']}},_0x4c2c84={};_0x4c2c84[_0x8a2d('0x32')]=_[_0x8a2d('0x33')](db[_0x8a2d('0x2d')][_0x8a2d('0x2e')]);_0x4c2c84['query']=_['keys'](_0x27147f[_0x8a2d('0x35')]);_0x4c2c84[_0x8a2d('0x3d')]=_[_0x8a2d('0x34')](_0x4c2c84['model'],_0x4c2c84[_0x8a2d('0x35')]);_0x2fb91e['attributes']=_[_0x8a2d('0x34')](_0x4c2c84[_0x8a2d('0x32')],qs[_0x8a2d('0x36')](_0x27147f[_0x8a2d('0x35')][_0x8a2d('0x36')]));_0x2fb91e['attributes']=_0x2fb91e['attributes'][_0x8a2d('0x38')]?_0x2fb91e['attributes']:_0x4c2c84[_0x8a2d('0x32')];if(_0x27147f[_0x8a2d('0x35')][_0x8a2d('0x44')]){_0x2fb91e[_0x8a2d('0x45')]=[{'all':!![]}];}_0x2fb91e=_['merge']({},_0x2fb91e,_0x27147f[_0x8a2d('0x43')]);return db[_0x8a2d('0x2d')][_0x8a2d('0x47')](_0x2fb91e)[_0x8a2d('0x25')](handleEntityNotFound(_0x21ae17,null))[_0x8a2d('0x25')](respondWithResult(_0x21ae17,null))['catch'](handleError(_0x21ae17,null));};exports[_0x8a2d('0x48')]=function(_0x119b2a,_0x3c9736){return db[_0x8a2d('0x2d')][_0x8a2d('0x48')](_0x119b2a[_0x8a2d('0x49')],{})[_0x8a2d('0x25')](function(_0x26b044){var _0xbe5dd2=_0x119b2a[_0x8a2d('0x4a')][_0x8a2d('0x21')]({'plain':!![]});if(!_0xbe5dd2)throw new Error(_0x8a2d('0x4b'));if(_0xbe5dd2[_0x8a2d('0x4c')]===_0x8a2d('0x4a')){var _0x4e7005=_0x26b044['get']({'plain':!![]});var _0x5a0ccf=_0x8a2d('0x22');return db[_0x8a2d('0x4d')]['find']({'where':{'name':_0x5a0ccf,'userProfileId':_0xbe5dd2[_0x8a2d('0x4e')]},'raw':!![]})['then'](function(_0x213205){if(_0x213205&&_0x213205[_0x8a2d('0x4f')]===0x0){return db[_0x8a2d('0x23')]['create']({'name':_0x4e7005[_0x8a2d('0x29')],'resourceId':_0x4e7005['id'],'type':_0x213205['name'],'sectionId':_0x213205['id']},{})[_0x8a2d('0x25')](function(){return _0x26b044;});}else{return _0x26b044;}})['catch'](function(_0x3289ca){logger[_0x8a2d('0x27')](_0x8a2d('0x50'),_0x3289ca);throw _0x3289ca;});}return _0x26b044;})[_0x8a2d('0x25')](respondWithResult(_0x3c9736,0xc9))[_0x8a2d('0x51')](handleError(_0x3c9736,null));};exports[_0x8a2d('0x20')]=function(_0x214644,_0x2b1811){if(_0x214644[_0x8a2d('0x49')]['id']){delete _0x214644[_0x8a2d('0x49')]['id'];}return db[_0x8a2d('0x2d')][_0x8a2d('0x47')]({'where':{'id':_0x214644[_0x8a2d('0x52')]['id']}})[_0x8a2d('0x25')](handleEntityNotFound(_0x2b1811,null))[_0x8a2d('0x25')](saveUpdates(_0x214644[_0x8a2d('0x49')],null))[_0x8a2d('0x25')](respondWithResult(_0x2b1811,null))[_0x8a2d('0x51')](handleError(_0x2b1811,null));};exports['destroy']=function(_0x25a1f7,_0x43c0fa){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x25a1f7[_0x8a2d('0x52')]['id']}})['then'](handleEntityNotFound(_0x43c0fa,null))['then'](removeEntity(_0x43c0fa,null))[_0x8a2d('0x51')](handleError(_0x43c0fa,null));}; \ No newline at end of file +var _0x5b16=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','end','sendStatus','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x5b16,0x77));var _0x65b1=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x5b16[_0x231e16];return _0x570a7c;};'use strict';var emlformat=require(_0x65b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65b1('0x1'));var jsonpatch=require(_0x65b1('0x2'));var rp=require('request-promise');var moment=require(_0x65b1('0x3'));var BPromise=require(_0x65b1('0x4'));var Mustache=require('mustache');var util=require(_0x65b1('0x5'));var path=require(_0x65b1('0x6'));var sox=require(_0x65b1('0x7'));var csv=require(_0x65b1('0x8'));var ejs=require(_0x65b1('0x9'));var fs=require('fs');var fs_extra=require(_0x65b1('0xa'));var _=require(_0x65b1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x65b1('0xc'));var deskjs=require(_0x65b1('0xd'));var toCsv=require(_0x65b1('0x8'));var querystring=require('querystring');var Papa=require(_0x65b1('0xe'));var Redis=require(_0x65b1('0xf'));var authService=require(_0x65b1('0x10'));var qs=require(_0x65b1('0x11'));var as=require(_0x65b1('0x12'));var hardwareService=require(_0x65b1('0x13'));var logger=require(_0x65b1('0x14'))(_0x65b1('0x15'));var utils=require(_0x65b1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x65b1('0x17'));var db=require(_0x65b1('0x18'))['db'];function respondWithStatusCode(_0x563148,_0x1dfc2c){_0x1dfc2c=_0x1dfc2c||0xcc;return function(_0x5a760a){if(_0x5a760a){return _0x563148['sendStatus'](_0x1dfc2c);}return _0x563148[_0x65b1('0x19')](_0x1dfc2c)['end']();};}function respondWithResult(_0x3e4330,_0x10bcae){_0x10bcae=_0x10bcae||0xc8;return function(_0x52b5a2){if(_0x52b5a2){return _0x3e4330[_0x65b1('0x19')](_0x10bcae)[_0x65b1('0x1a')](_0x52b5a2);}};}function respondWithFilteredResult(_0x3e0dd9,_0x4c2ce0){return function(_0xe66326){if(_0xe66326){var _0x192b7e=typeof _0x4c2ce0['offset']===_0x65b1('0x1b')&&typeof _0x4c2ce0[_0x65b1('0x1c')]===_0x65b1('0x1b');var _0x2b66be=_0xe66326[_0x65b1('0x1d')];var _0x348757=_0x192b7e?0x0:_0x4c2ce0[_0x65b1('0x1e')];var _0x293344=_0x192b7e?_0xe66326['count']:_0x4c2ce0[_0x65b1('0x1e')]+_0x4c2ce0[_0x65b1('0x1c')];var _0x584b0d;if(_0x293344>=_0x2b66be){_0x293344=_0x2b66be;_0x584b0d=0xc8;}else{_0x584b0d=0xce;}_0x3e0dd9[_0x65b1('0x19')](_0x584b0d);return _0x3e0dd9[_0x65b1('0x1f')](_0x65b1('0x20'),_0x348757+'-'+_0x293344+'/'+_0x2b66be)[_0x65b1('0x1a')](_0xe66326);}return null;};}function patchUpdates(_0x8c1327){return function(_0x56fe13){try{jsonpatch[_0x65b1('0x21')](_0x56fe13,_0x8c1327,!![]);}catch(_0x28de90){return BPromise[_0x65b1('0x22')](_0x28de90);}return _0x56fe13[_0x65b1('0x23')]();};}function saveUpdates(_0x1a313f,_0x10091e){return function(_0x561f59){if(_0x561f59){return _0x561f59[_0x65b1('0x24')](_0x1a313f)[_0x65b1('0x25')](function(_0x5c2ce8){return _0x5c2ce8;});}return null;};}function removeEntity(_0x1e7ca9,_0x3dfa18){return function(_0x26fd52){if(_0x26fd52){return _0x26fd52[_0x65b1('0x26')]()['then'](function(){var _0x366034=_0x26fd52[_0x65b1('0x27')]({'plain':!![]});var _0x49552f=_0x65b1('0x28');return db['UserProfileResource'][_0x65b1('0x26')]({'where':{'type':_0x49552f,'resourceId':_0x366034['id']}})[_0x65b1('0x25')](function(){return _0x26fd52;});})[_0x65b1('0x25')](function(){_0x1e7ca9[_0x65b1('0x19')](0xcc)[_0x65b1('0x29')]();});}};}function handleEntityNotFound(_0x4cb791,_0x32ce65){return function(_0x542c03){if(!_0x542c03){_0x4cb791[_0x65b1('0x2a')](0x194);}return _0x542c03;};}function handleError(_0x2e5862,_0x228849){_0x228849=_0x228849||0x1f4;return function(_0x36e3a5){logger['error'](_0x36e3a5[_0x65b1('0x2b')]);if(_0x36e3a5[_0x65b1('0x2c')]){delete _0x36e3a5[_0x65b1('0x2c')];}_0x2e5862['status'](_0x228849)[_0x65b1('0x2d')](_0x36e3a5);};}exports[_0x65b1('0x2e')]=function(_0x4e6781,_0x56b75d){var _0x9bdea0={},_0x3c41ba={},_0x4b769f={'count':0x0,'rows':[]};var _0x7d433=_[_0x65b1('0x2f')](db[_0x65b1('0x30')]['rawAttributes'],function(_0x3aa98a){return{'name':_0x3aa98a[_0x65b1('0x31')],'type':_0x3aa98a[_0x65b1('0x32')][_0x65b1('0x33')]};});_0x3c41ba[_0x65b1('0x34')]=_[_0x65b1('0x2f')](_0x7d433,'name');_0x3c41ba[_0x65b1('0x35')]=_[_0x65b1('0x36')](_0x4e6781[_0x65b1('0x35')]);_0x3c41ba[_0x65b1('0x37')]=_[_0x65b1('0x38')](_0x3c41ba[_0x65b1('0x34')],_0x3c41ba['query']);_0x9bdea0[_0x65b1('0x39')]=_[_0x65b1('0x38')](_0x3c41ba[_0x65b1('0x34')],qs[_0x65b1('0x3a')](_0x4e6781[_0x65b1('0x35')][_0x65b1('0x3a')]));_0x9bdea0[_0x65b1('0x39')]=_0x9bdea0[_0x65b1('0x39')][_0x65b1('0x3b')]?_0x9bdea0[_0x65b1('0x39')]:_0x3c41ba[_0x65b1('0x34')];if(!_0x4e6781[_0x65b1('0x35')][_0x65b1('0x3c')](_0x65b1('0x3d'))){_0x9bdea0[_0x65b1('0x1c')]=qs[_0x65b1('0x1c')](_0x4e6781['query']['limit']);_0x9bdea0[_0x65b1('0x1e')]=qs['offset'](_0x4e6781[_0x65b1('0x35')][_0x65b1('0x1e')]);}_0x9bdea0[_0x65b1('0x3e')]=qs[_0x65b1('0x3f')](_0x4e6781[_0x65b1('0x35')]['sort']);_0x9bdea0[_0x65b1('0x40')]=qs[_0x65b1('0x37')](_[_0x65b1('0x41')](_0x4e6781[_0x65b1('0x35')],_0x3c41ba[_0x65b1('0x37')]),_0x7d433);if(_0x4e6781[_0x65b1('0x35')][_0x65b1('0x42')]){_0x9bdea0[_0x65b1('0x40')]=_['merge'](_0x9bdea0['where'],{'$or':_['map'](_0x7d433,function(_0x12f556){if(_0x12f556['type']!=='VIRTUAL'){var _0x523f2c={};_0x523f2c[_0x12f556['name']]={'$like':'%'+_0x4e6781[_0x65b1('0x35')][_0x65b1('0x42')]+'%'};return _0x523f2c;}})});}_0x9bdea0=_[_0x65b1('0x43')]({},_0x9bdea0,_0x4e6781[_0x65b1('0x44')]);var _0x9dc22e={'where':_0x9bdea0[_0x65b1('0x40')]};return db[_0x65b1('0x30')]['count'](_0x9dc22e)[_0x65b1('0x25')](function(_0x528b90){_0x4b769f['count']=_0x528b90;if(_0x4e6781['query'][_0x65b1('0x45')]){_0x9bdea0[_0x65b1('0x46')]=[{'all':!![]}];}return db[_0x65b1('0x30')]['findAll'](_0x9bdea0);})[_0x65b1('0x25')](function(_0x307338){_0x4b769f[_0x65b1('0x47')]=_0x307338;return _0x4b769f;})[_0x65b1('0x25')](respondWithFilteredResult(_0x56b75d,_0x9bdea0))[_0x65b1('0x48')](handleError(_0x56b75d,null));};exports['show']=function(_0x5e55dd,_0x4b25e8){var _0x10248e={'raw':!![],'where':{'id':_0x5e55dd[_0x65b1('0x49')]['id']}},_0x53264e={};_0x53264e[_0x65b1('0x34')]=_[_0x65b1('0x36')](db[_0x65b1('0x30')][_0x65b1('0x4a')]);_0x53264e[_0x65b1('0x35')]=_[_0x65b1('0x36')](_0x5e55dd['query']);_0x53264e[_0x65b1('0x37')]=_[_0x65b1('0x38')](_0x53264e[_0x65b1('0x34')],_0x53264e[_0x65b1('0x35')]);_0x10248e[_0x65b1('0x39')]=_[_0x65b1('0x38')](_0x53264e[_0x65b1('0x34')],qs[_0x65b1('0x3a')](_0x5e55dd[_0x65b1('0x35')][_0x65b1('0x3a')]));_0x10248e[_0x65b1('0x39')]=_0x10248e[_0x65b1('0x39')]['length']?_0x10248e[_0x65b1('0x39')]:_0x53264e['model'];if(_0x5e55dd[_0x65b1('0x35')]['includeAll']){_0x10248e[_0x65b1('0x46')]=[{'all':!![]}];}_0x10248e=_[_0x65b1('0x43')]({},_0x10248e,_0x5e55dd[_0x65b1('0x44')]);return db['CmHopperAdditionalPhone'][_0x65b1('0x4b')](_0x10248e)[_0x65b1('0x25')](handleEntityNotFound(_0x4b25e8,null))[_0x65b1('0x25')](respondWithResult(_0x4b25e8,null))[_0x65b1('0x48')](handleError(_0x4b25e8,null));};exports[_0x65b1('0x4c')]=function(_0x7e2c43,_0x52768a){return db[_0x65b1('0x30')]['create'](_0x7e2c43[_0x65b1('0x4d')],{})['then'](function(_0x4f6b65){var _0x532f5b=_0x7e2c43[_0x65b1('0x4e')][_0x65b1('0x27')]({'plain':!![]});if(!_0x532f5b)throw new Error(_0x65b1('0x4f'));if(_0x532f5b[_0x65b1('0x50')]==='user'){var _0x1c9309=_0x4f6b65['get']({'plain':!![]});var _0x17c88d=_0x65b1('0x28');return db[_0x65b1('0x51')][_0x65b1('0x4b')]({'where':{'name':_0x17c88d,'userProfileId':_0x532f5b[_0x65b1('0x52')]},'raw':!![]})[_0x65b1('0x25')](function(_0x5efdbe){if(_0x5efdbe&&_0x5efdbe[_0x65b1('0x53')]===0x0){return db[_0x65b1('0x54')][_0x65b1('0x4c')]({'name':_0x1c9309[_0x65b1('0x2c')],'resourceId':_0x1c9309['id'],'type':_0x5efdbe[_0x65b1('0x2c')],'sectionId':_0x5efdbe['id']},{})[_0x65b1('0x25')](function(){return _0x4f6b65;});}else{return _0x4f6b65;}})[_0x65b1('0x48')](function(_0x49d5e2){logger[_0x65b1('0x55')](_0x65b1('0x56'),_0x49d5e2);throw _0x49d5e2;});}return _0x4f6b65;})[_0x65b1('0x25')](respondWithResult(_0x52768a,0xc9))[_0x65b1('0x48')](handleError(_0x52768a,null));};exports[_0x65b1('0x24')]=function(_0x33fa50,_0x29a342){if(_0x33fa50[_0x65b1('0x4d')]['id']){delete _0x33fa50[_0x65b1('0x4d')]['id'];}return db[_0x65b1('0x30')]['find']({'where':{'id':_0x33fa50[_0x65b1('0x49')]['id']}})[_0x65b1('0x25')](handleEntityNotFound(_0x29a342,null))[_0x65b1('0x25')](saveUpdates(_0x33fa50['body'],null))[_0x65b1('0x25')](respondWithResult(_0x29a342,null))[_0x65b1('0x48')](handleError(_0x29a342,null));};exports['destroy']=function(_0x5a59fa,_0x568c42){return db[_0x65b1('0x30')][_0x65b1('0x4b')]({'where':{'id':_0x5a59fa[_0x65b1('0x49')]['id']}})[_0x65b1('0x25')](handleEntityNotFound(_0x568c42,null))[_0x65b1('0x25')](removeEntity(_0x568c42,null))[_0x65b1('0x48')](handleError(_0x568c42,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 69b028f..2f14f16 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c05=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','CmHopperAdditionalPhone'];(function(_0xe9066,_0x23a99b){var _0x3fbde1=function(_0x57c75f){while(--_0x57c75f){_0xe9066['push'](_0xe9066['shift']());}};_0x3fbde1(++_0x23a99b);}(_0x8c05,0x1e4));var _0x58c0=function(_0x1274f5,_0x3ddb6b){_0x1274f5=_0x1274f5-0x0;var _0x5542db=_0x8c05[_0x1274f5];return _0x5542db;};'use strict';var _=require(_0x58c0('0x0'));var util=require(_0x58c0('0x1'));var logger=require(_0x58c0('0x2'))(_0x58c0('0x3'));var moment=require(_0x58c0('0x4'));var BPromise=require(_0x58c0('0x5'));var rp=require(_0x58c0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58c0('0x7'));var config=require(_0x58c0('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x58c0('0x9')]=function(_0x24c584,_0x390e54){return _0x24c584['define'](_0x58c0('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadae=['lodash','util','../../config/logger','../../config/environment','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x5ecc4b,_0x5a58a0){var _0x233dc6=function(_0x5b97e4){while(--_0x5b97e4){_0x5ecc4b['push'](_0x5ecc4b['shift']());}};_0x233dc6(++_0x5a58a0);}(_0xadae,0x134));var _0xeada=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xadae[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xeada('0x0'));var util=require(_0xeada('0x1'));var logger=require(_0xeada('0x2'))('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(_0xeada('0x3'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xeada('0x4')]=function(_0x5ef766,_0x5967e6){return _0x5ef766['define'](_0xeada('0x5'),attributes,{'tableName':_0xeada('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 13ff65c..08818b3 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf570=['add','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat'];(function(_0x29fea4,_0x3e6c73){var _0x37bb47=function(_0x25c3c5){while(--_0x25c3c5){_0x29fea4['push'](_0x29fea4['shift']());}};_0x37bb47(++_0x3e6c73);}(_0xf570,0x7a));var _0x0f57=function(_0x5fa560,_0x3d14b2){_0x5fa560=_0x5fa560-0x0;var _0x4758ab=_0xf570[_0x5fa560];return _0x4758ab;};'use strict';var _=require(_0x0f57('0x0'));var util=require(_0x0f57('0x1'));var moment=require(_0x0f57('0x2'));var BPromise=require(_0x0f57('0x3'));var rs=require(_0x0f57('0x4'));var fs=require('fs');var Redis=require(_0x0f57('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f57('0x6'));var logger=require('../../config/logger')(_0x0f57('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f57('0x8'));var client=jayson[_0x0f57('0x9')][_0x0f57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35d1db,_0x560739,_0x4bb57f){return new BPromise(function(_0x4a7b97,_0x17b745){return client['request'](_0x35d1db,_0x4bb57f)[_0x0f57('0xb')](function(_0x43904c){logger[_0x0f57('0xc')](_0x0f57('0xd'),_0x560739,_0x0f57('0xe'));logger['debug'](_0x0f57('0xf'),_0x560739,'request\x20sent',JSON[_0x0f57('0x10')](_0x43904c));if(_0x43904c[_0x0f57('0x11')]){if(_0x43904c['error']['code']===0x1f4){logger[_0x0f57('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x560739,_0x43904c[_0x0f57('0x11')][_0x0f57('0x12')]);return _0x17b745(_0x43904c[_0x0f57('0x11')][_0x0f57('0x12')]);}logger[_0x0f57('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x560739,_0x43904c[_0x0f57('0x11')][_0x0f57('0x12')]);return _0x4a7b97(_0x43904c['error']['message']);}else{logger['info'](_0x0f57('0xd'),_0x560739,_0x0f57('0xe'));_0x4a7b97(_0x43904c[_0x0f57('0x13')][_0x0f57('0x12')]);}})[_0x0f57('0x14')](function(_0x311a31){logger['error'](_0x0f57('0xd'),_0x560739,_0x311a31);_0x17b745(_0x311a31);});});}exports[_0x0f57('0x15')]=function(_0xc45790){var _0x235876=this;return new Promise(function(_0x3721e8,_0x4f4971){return db[_0x0f57('0x16')][_0x0f57('0x17')]({'raw':!![],'where':{'ContactId':_0xc45790[_0x0f57('0x18')][_0x0f57('0x19')],'ListId':_0xc45790[_0x0f57('0x18')]['ListId'],'VoiceQueueId':_0xc45790[_0x0f57('0x18')][_0x0f57('0x1a')]===undefined?null:_0xc45790[_0x0f57('0x18')][_0x0f57('0x1a')],'CampaignId':_0xc45790['body'][_0x0f57('0x1b')]===undefined?null:_0xc45790[_0x0f57('0x18')][_0x0f57('0x1b')]}})[_0x0f57('0xb')](function(_0x38ed45){if(_0x38ed45!=null){return db[_0x0f57('0x1c')][_0x0f57('0x17')]({'raw':!![],'where':{'CmHopperId':_0x38ed45['id'],'OrderBy':{'$gt':_0x38ed45[_0x0f57('0x1d')]}},'order':[[_0x0f57('0x1d'),_0x0f57('0x1e')]]})['then'](function(_0x598fa9){var _0x23d027=0x0;if(_0x598fa9){if(_0x598fa9['countbusyretry']+_0x598fa9[_0x0f57('0x1f')]+_0x598fa9[_0x0f57('0x20')]+_0x598fa9[_0x0f57('0x21')]+_0x598fa9[_0x0f57('0x22')]+_0x598fa9[_0x0f57('0x23')]+_0x598fa9[_0x0f57('0x24')]+_0x598fa9[_0x0f57('0x25')]<_0xc45790[_0x0f57('0x26')][_0x0f57('0x27')])_0x23d027=0x1;_0x3721e8({'additional':_0x23d027});}else{return db[_0x0f57('0x1c')][_0x0f57('0x17')]({'raw':!![],'where':{'CmHopperId':_0x38ed45['id']},'order':[[_0x0f57('0x1d'),_0x0f57('0x1e')]]})[_0x0f57('0xb')](function(_0x2a25f4){var _0x82a88d=0x0;if(_0x2a25f4){if(_0x2a25f4[_0x0f57('0x28')]+_0x2a25f4[_0x0f57('0x1f')]+_0x2a25f4[_0x0f57('0x20')]+_0x2a25f4[_0x0f57('0x21')]+_0x2a25f4[_0x0f57('0x22')]+_0x2a25f4['countabandonedretry']+_0x2a25f4['countmachineretry']+_0x2a25f4[_0x0f57('0x25')]<_0xc45790[_0x0f57('0x26')][_0x0f57('0x27')])_0x82a88d=0x1;_0x3721e8({'additional':_0x82a88d});}else{_0x3721e8({'additional':0x0});}})[_0x0f57('0x14')](function(_0x37fb43){logger[_0x0f57('0x11')](_0x0f57('0x15'),_0x37fb43[_0x0f57('0x12')]);_0x4f4971(_0x235876[_0x0f57('0x11')](0x1f4,_0x37fb43[_0x0f57('0x12')]));});}})['catch'](function(_0x52f58d){logger['error'](_0x0f57('0x15'),_0x52f58d['message']);_0x4f4971(_0x235876[_0x0f57('0x11')](0x1f4,_0x52f58d[_0x0f57('0x12')]));});}else _0x3721e8({'additional':0x0});});});};exports[_0x0f57('0x29')]=function(_0xdaa08){var _0x4e4fd2=this;return new Promise(function(_0x359be4,_0xe0ab24){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0xdaa08[_0x0f57('0x18')]['ContactId'],'ListId':_0xdaa08['body']['ListId'],'VoiceQueueId':_0xdaa08[_0x0f57('0x18')]['VoiceQueueId']===undefined?null:_0xdaa08[_0x0f57('0x18')][_0x0f57('0x1a')],'CampaignId':_0xdaa08[_0x0f57('0x18')][_0x0f57('0x1b')]===undefined?null:_0xdaa08[_0x0f57('0x18')][_0x0f57('0x1b')]}})[_0x0f57('0xb')](function(_0x2d5018){if(_0x2d5018!=null){return db[_0x0f57('0x1c')][_0x0f57('0x17')]({'raw':!![],'where':{'CmHopperId':_0x2d5018['id'],'OrderBy':{'$gte':_0x2d5018['OrderBy']}},'order':[['OrderBy',_0x0f57('0x1e')]]})[_0x0f57('0xb')](function(_0x3f547d){if(_0x3f547d)return activateAdditionalPhone(_0x2d5018,_0xdaa08['body'],_0x3f547d,_0xdaa08[_0x0f57('0x2a')],_0xdaa08[_0x0f57('0x2b')])['then'](function(_0x4c6e1e){_0x359be4(_0x4c6e1e);});else{return db[_0x0f57('0x1c')][_0x0f57('0x17')]({'raw':!![],'where':{'CmHopperId':_0x2d5018['id']},'order':[[_0x0f57('0x1d'),_0x0f57('0x1e')]]})['then'](function(_0x411816){if(_0x411816)return activateAdditionalPhone(_0x2d5018,_0xdaa08[_0x0f57('0x18')],_0x411816,_0xdaa08[_0x0f57('0x2a')],_0xdaa08[_0x0f57('0x2b')])[_0x0f57('0xb')](function(_0x343e8c){_0x359be4(_0x343e8c);});else{_0x359be4({'id':_0x2d5018['id'],'phone':''});}})[_0x0f57('0x14')](function(_0x189639){logger[_0x0f57('0x11')](_0x0f57('0x15'),_0x189639['message']);_0xe0ab24(_0x4e4fd2['error'](0x1f4,_0x189639[_0x0f57('0x12')]));});}})[_0x0f57('0x14')](function(_0x3a7c5d){logger[_0x0f57('0x11')]('VerifyAdditionalPhones',_0x3a7c5d[_0x0f57('0x12')]);_0xe0ab24(_0x4e4fd2[_0x0f57('0x11')](0x1f4,_0x3a7c5d[_0x0f57('0x12')]));});}else _0x359be4(0x1);});});};function activateAdditionalPhone(_0xe5b6f7,_0x109494,_0x3f31e1,_0x1cb425,_0x49b5ce){return new Promise(function(_0x536e70,_0x4e1e58){var _0x10f35e;if(_[_0x0f57('0x2c')](_0x3f31e1[_0x0f57('0x2d')])){_0x3f31e1[_0x0f57('0x2d')]=moment();}if(moment()>moment(_0x3f31e1['scheduledat'])){_0x10f35e=moment()[_0x0f57('0x2e')](_0x49b5ce||0x3,'minutes');}else{if(_0x3f31e1[_0x0f57('0x1d')]==0x0){_0x10f35e=moment(_0x3f31e1[_0x0f57('0x2d')]);}else{_0x10f35e=moment()[_0x0f57('0x2e')](_0x49b5ce||0x3,'minutes');}}if(_[_0x0f57('0x2c')](_0x10f35e)){_0x10f35e=moment()['add'](_0x49b5ce||0x3,'minutes');}var _0x585ff5={'phone':_0xe5b6f7[_0x0f57('0x2f')],'active':0x0,'OrderBy':_[_0x0f57('0x2c')](_0xe5b6f7[_0x0f57('0x1d')])?0x0:_0xe5b6f7[_0x0f57('0x1d')],'scheduledat':moment()[_0x0f57('0x2e')](_0x1cb425||0x1,'minutes'),'countbusyretry':_0x109494[_0x0f57('0x28')],'countcongestionretry':_0x109494[_0x0f57('0x1f')],'countnoanswerretry':_0x109494[_0x0f57('0x20')],'countnosuchnumberretry':_0x109494['countnosuchnumberretry'],'countdropretry':_0x109494[_0x0f57('0x22')],'countabandonedretry':_0x109494['countabandonedretry'],'countmachineretry':_0x109494[_0x0f57('0x24')],'countagentrejectretry':_0x109494[_0x0f57('0x25')],'createdAt':_0x109494[_0x0f57('0x30')],'updatedAt':_0x109494['updatedAt']};var _0x16ac50={'CmHopperId':_0xe5b6f7['id'],'phone':_0x3f31e1[_0x0f57('0x2f')],'active':0x0,'OrderBy':_[_0x0f57('0x2c')](_0x3f31e1[_0x0f57('0x1d')])?0x0:_0x3f31e1[_0x0f57('0x1d')],'scheduledat':_0x10f35e,'countbusyretry':_0x3f31e1['countbusyretry'],'countcongestionretry':_0x3f31e1[_0x0f57('0x1f')],'countnoanswerretry':_0x3f31e1[_0x0f57('0x20')],'countnosuchnumberretry':_0x3f31e1[_0x0f57('0x21')],'countdropretry':_0x3f31e1[_0x0f57('0x22')],'countabandonedretry':_0x3f31e1[_0x0f57('0x23')],'countmachineretry':_0x3f31e1[_0x0f57('0x24')],'countagentrejectretry':_0x3f31e1[_0x0f57('0x25')],'createdAt':_0x3f31e1[_0x0f57('0x30')],'updatedAt':_0x3f31e1[_0x0f57('0x31')]};return db[_0x0f57('0x32')][_0x0f57('0x33')](function(_0x3c0459){return db[_0x0f57('0x1c')][_0x0f57('0x34')](_0x585ff5,{'where':{'id':_0x3f31e1['id']}},{'transaction':_0x3c0459})['then'](function(){return db['CmHopper'][_0x0f57('0x34')](_0x16ac50,{'where':{'id':_0xe5b6f7['id']}},{'transaction':_0x3c0459});});})['then'](function(_0x516528){_0x536e70({'id':_0xe5b6f7['id'],'phone':_0x3f31e1['phone']});})['catch'](function(_0x3711e0){logger[_0x0f57('0x11')](_0x0f57('0x35'),_0x3711e0[_0x0f57('0x12')]);_0x4e1e58({'error':_0x3711e0[_0x0f57('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x2862ce){var _0x51d00=this;return new Promise(function(_0x45da21,_0xf9e57d){return db[_0x0f57('0x16')][_0x0f57('0x34')](_0x2862ce[_0x0f57('0x18')][_0x0f57('0x36')],{'where':{'id':_0x2862ce[_0x0f57('0x18')]['id']}})[_0x0f57('0xb')](function(_0x50a2ae){_0x45da21(_0x50a2ae);})[_0x0f57('0x14')](function(_0x3e32a7){logger[_0x0f57('0x11')](_0x0f57('0x37'),_0x3e32a7['message']);_0xf9e57d(_0x51d00[_0x0f57('0x11')](0x1f4,_0x3e32a7[_0x0f57('0x12')]));});});}; \ No newline at end of file +var _0xd139=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','VoiceQueueId','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','sequelize','transaction','IncrementPreviewCounters','update','field','lodash','util'];(function(_0x43a625,_0x1a7f74){var _0x581656=function(_0x4aa76c){while(--_0x4aa76c){_0x43a625['push'](_0x43a625['shift']());}};_0x581656(++_0x1a7f74);}(_0xd139,0x14e));var _0x9d13=function(_0x414641,_0x20af11){_0x414641=_0x414641-0x0;var _0xbb293=_0xd139[_0x414641];return _0xbb293;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d13('0x2'));var fs=require('fs');var Redis=require(_0x9d13('0x3'));var db=require(_0x9d13('0x4'))['db'];var utils=require(_0x9d13('0x5'));var logger=require(_0x9d13('0x6'))(_0x9d13('0x7'));var config=require(_0x9d13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d13('0x9')][_0x9d13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50294b,_0x198d7d,_0x4b3db0){return new BPromise(function(_0x434ef6,_0x524947){return client['request'](_0x50294b,_0x4b3db0)['then'](function(_0x3ccdf9){logger[_0x9d13('0xb')](_0x9d13('0xc'),_0x198d7d,_0x9d13('0xd'));logger[_0x9d13('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x198d7d,_0x9d13('0xd'),JSON[_0x9d13('0xf')](_0x3ccdf9));if(_0x3ccdf9[_0x9d13('0x10')]){if(_0x3ccdf9['error']['code']===0x1f4){logger[_0x9d13('0x10')](_0x9d13('0xc'),_0x198d7d,_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);return _0x524947(_0x3ccdf9[_0x9d13('0x10')]['message']);}logger['error'](_0x9d13('0xc'),_0x198d7d,_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);return _0x434ef6(_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);}else{logger[_0x9d13('0xb')](_0x9d13('0xc'),_0x198d7d,'request\x20sent');_0x434ef6(_0x3ccdf9[_0x9d13('0x12')][_0x9d13('0x11')]);}})[_0x9d13('0x13')](function(_0x250234){logger[_0x9d13('0x10')](_0x9d13('0xc'),_0x198d7d,_0x250234);_0x524947(_0x250234);});});}exports[_0x9d13('0x14')]=function(_0x10aa89){var _0x45a07a=this;return new Promise(function(_0x2acb0b,_0xa1de89){return db[_0x9d13('0x15')][_0x9d13('0x16')]({'raw':!![],'where':{'ContactId':_0x10aa89['body'][_0x9d13('0x17')],'ListId':_0x10aa89[_0x9d13('0x18')][_0x9d13('0x19')],'VoiceQueueId':_0x10aa89[_0x9d13('0x18')]['VoiceQueueId']===undefined?null:_0x10aa89['body']['VoiceQueueId'],'CampaignId':_0x10aa89[_0x9d13('0x18')][_0x9d13('0x1a')]===undefined?null:_0x10aa89[_0x9d13('0x18')][_0x9d13('0x1a')]}})[_0x9d13('0x1b')](function(_0x3040e7){if(_0x3040e7!=null){return db[_0x9d13('0x1c')][_0x9d13('0x16')]({'raw':!![],'where':{'CmHopperId':_0x3040e7['id'],'OrderBy':{'$gt':_0x3040e7['OrderBy']}},'order':[[_0x9d13('0x1d'),_0x9d13('0x1e')]]})[_0x9d13('0x1b')](function(_0x21999c){var _0x517003=0x0;if(_0x21999c){if(_0x21999c[_0x9d13('0x1f')]+_0x21999c['countcongestionretry']+_0x21999c[_0x9d13('0x20')]+_0x21999c[_0x9d13('0x21')]+_0x21999c[_0x9d13('0x22')]+_0x21999c[_0x9d13('0x23')]+_0x21999c[_0x9d13('0x24')]+_0x21999c[_0x9d13('0x25')]<_0x10aa89[_0x9d13('0x26')][_0x9d13('0x27')])_0x517003=0x1;_0x2acb0b({'additional':_0x517003});}else{return db['CmHopperAdditionalPhone'][_0x9d13('0x16')]({'raw':!![],'where':{'CmHopperId':_0x3040e7['id']},'order':[['OrderBy',_0x9d13('0x1e')]]})[_0x9d13('0x1b')](function(_0x2f314b){var _0x1d9f56=0x0;if(_0x2f314b){if(_0x2f314b[_0x9d13('0x1f')]+_0x2f314b[_0x9d13('0x28')]+_0x2f314b[_0x9d13('0x20')]+_0x2f314b[_0x9d13('0x21')]+_0x2f314b[_0x9d13('0x22')]+_0x2f314b[_0x9d13('0x23')]+_0x2f314b[_0x9d13('0x24')]+_0x2f314b[_0x9d13('0x25')]<_0x10aa89['entity'][_0x9d13('0x27')])_0x1d9f56=0x1;_0x2acb0b({'additional':_0x1d9f56});}else{_0x2acb0b({'additional':0x0});}})['catch'](function(_0x2295bc){logger[_0x9d13('0x10')]('VerifyAdditionalPhones',_0x2295bc[_0x9d13('0x11')]);_0xa1de89(_0x45a07a[_0x9d13('0x10')](0x1f4,_0x2295bc['message']));});}})['catch'](function(_0x5c5ab4){logger[_0x9d13('0x10')]('VerifyAdditionalPhones',_0x5c5ab4[_0x9d13('0x11')]);_0xa1de89(_0x45a07a[_0x9d13('0x10')](0x1f4,_0x5c5ab4[_0x9d13('0x11')]));});}else _0x2acb0b({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x443005){var _0x234dbb=this;return new Promise(function(_0x26d95e,_0x369c43){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x443005[_0x9d13('0x18')][_0x9d13('0x17')],'ListId':_0x443005['body'][_0x9d13('0x19')],'VoiceQueueId':_0x443005[_0x9d13('0x18')][_0x9d13('0x29')]===undefined?null:_0x443005[_0x9d13('0x18')][_0x9d13('0x29')],'CampaignId':_0x443005[_0x9d13('0x18')][_0x9d13('0x1a')]===undefined?null:_0x443005['body'][_0x9d13('0x1a')]}})['then'](function(_0x4b60d7){if(_0x4b60d7!=null){return db['CmHopperAdditionalPhone'][_0x9d13('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4b60d7['id'],'OrderBy':{'$gte':_0x4b60d7[_0x9d13('0x1d')]}},'order':[[_0x9d13('0x1d'),_0x9d13('0x1e')]]})[_0x9d13('0x1b')](function(_0x4b32d8){if(_0x4b32d8)return activateAdditionalPhone(_0x4b60d7,_0x443005[_0x9d13('0x18')],_0x4b32d8,_0x443005[_0x9d13('0x2a')],_0x443005[_0x9d13('0x2b')])[_0x9d13('0x1b')](function(_0x41ae16){_0x26d95e(_0x41ae16);});else{return db[_0x9d13('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4b60d7['id']},'order':[[_0x9d13('0x1d'),_0x9d13('0x1e')]]})[_0x9d13('0x1b')](function(_0x547a6b){if(_0x547a6b)return activateAdditionalPhone(_0x4b60d7,_0x443005['body'],_0x547a6b,_0x443005[_0x9d13('0x2a')],_0x443005[_0x9d13('0x2b')])[_0x9d13('0x1b')](function(_0x4a36ea){_0x26d95e(_0x4a36ea);});else{_0x26d95e({'id':_0x4b60d7['id'],'phone':''});}})[_0x9d13('0x13')](function(_0x198fe7){logger['error'](_0x9d13('0x14'),_0x198fe7[_0x9d13('0x11')]);_0x369c43(_0x234dbb[_0x9d13('0x10')](0x1f4,_0x198fe7[_0x9d13('0x11')]));});}})[_0x9d13('0x13')](function(_0x28a68c){logger[_0x9d13('0x10')](_0x9d13('0x14'),_0x28a68c[_0x9d13('0x11')]);_0x369c43(_0x234dbb['error'](0x1f4,_0x28a68c[_0x9d13('0x11')]));});}else _0x26d95e(0x1);});});};function activateAdditionalPhone(_0x1d2ee6,_0x26f255,_0x1dd5dc,_0x227e4c,_0x20e89e){return new Promise(function(_0x395972,_0x5635f4){var _0x30114a;if(_[_0x9d13('0x2c')](_0x1dd5dc[_0x9d13('0x2d')])){_0x1dd5dc[_0x9d13('0x2d')]=moment();}if(moment()>moment(_0x1dd5dc[_0x9d13('0x2d')])){_0x30114a=moment()[_0x9d13('0x2e')](_0x20e89e||0x3,'minutes');}else{if(_0x1dd5dc['OrderBy']==0x0){_0x30114a=moment(_0x1dd5dc[_0x9d13('0x2d')]);}else{_0x30114a=moment()['add'](_0x20e89e||0x3,_0x9d13('0x2f'));}}if(_['isNil'](_0x30114a)){_0x30114a=moment()[_0x9d13('0x2e')](_0x20e89e||0x3,_0x9d13('0x2f'));}var _0x1678c0={'phone':_0x1d2ee6[_0x9d13('0x30')],'active':0x0,'OrderBy':_[_0x9d13('0x2c')](_0x1d2ee6['OrderBy'])?0x0:_0x1d2ee6[_0x9d13('0x1d')],'scheduledat':moment()[_0x9d13('0x2e')](_0x227e4c||0x1,_0x9d13('0x2f')),'countbusyretry':_0x26f255[_0x9d13('0x1f')],'countcongestionretry':_0x26f255[_0x9d13('0x28')],'countnoanswerretry':_0x26f255[_0x9d13('0x20')],'countnosuchnumberretry':_0x26f255[_0x9d13('0x21')],'countdropretry':_0x26f255[_0x9d13('0x22')],'countabandonedretry':_0x26f255[_0x9d13('0x23')],'countmachineretry':_0x26f255[_0x9d13('0x24')],'countagentrejectretry':_0x26f255['countagentrejectretry'],'createdAt':_0x26f255['createdAt'],'updatedAt':_0x26f255[_0x9d13('0x31')]};var _0xece6c4={'CmHopperId':_0x1d2ee6['id'],'phone':_0x1dd5dc['phone'],'active':0x0,'OrderBy':_[_0x9d13('0x2c')](_0x1dd5dc['OrderBy'])?0x0:_0x1dd5dc[_0x9d13('0x1d')],'scheduledat':_0x30114a,'countbusyretry':_0x1dd5dc[_0x9d13('0x1f')],'countcongestionretry':_0x1dd5dc['countcongestionretry'],'countnoanswerretry':_0x1dd5dc['countnoanswerretry'],'countnosuchnumberretry':_0x1dd5dc[_0x9d13('0x21')],'countdropretry':_0x1dd5dc[_0x9d13('0x22')],'countabandonedretry':_0x1dd5dc[_0x9d13('0x23')],'countmachineretry':_0x1dd5dc[_0x9d13('0x24')],'countagentrejectretry':_0x1dd5dc[_0x9d13('0x25')],'createdAt':_0x1dd5dc[_0x9d13('0x32')],'updatedAt':_0x1dd5dc[_0x9d13('0x31')]};return db[_0x9d13('0x33')][_0x9d13('0x34')](function(_0x519c6f){return db[_0x9d13('0x1c')]['update'](_0x1678c0,{'where':{'id':_0x1dd5dc['id']}},{'transaction':_0x519c6f})['then'](function(){return db[_0x9d13('0x15')]['update'](_0xece6c4,{'where':{'id':_0x1d2ee6['id']}},{'transaction':_0x519c6f});});})[_0x9d13('0x1b')](function(_0x12849c){_0x395972({'id':_0x1d2ee6['id'],'phone':_0x1dd5dc[_0x9d13('0x30')]});})[_0x9d13('0x13')](function(_0x1aca60){logger[_0x9d13('0x10')]('activateAdditionalPhone',_0x1aca60[_0x9d13('0x11')]);_0x5635f4({'error':_0x1aca60[_0x9d13('0x11')]});});});}exports[_0x9d13('0x35')]=function(_0x3967e6){var _0x23ad92=this;return new Promise(function(_0x171968,_0xf26caa){return db['CmHopper'][_0x9d13('0x36')](_0x3967e6[_0x9d13('0x18')][_0x9d13('0x37')],{'where':{'id':_0x3967e6[_0x9d13('0x18')]['id']}})[_0x9d13('0x1b')](function(_0x28776d){_0x171968(_0x28776d);})[_0x9d13('0x13')](function(_0x2a8a65){logger[_0x9d13('0x10')](_0x9d13('0x35'),_0x2a8a65['message']);_0xf26caa(_0x23ad92[_0x9d13('0x10')](0x1f4,_0x2a8a65[_0x9d13('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index d13f7ed..dbbfd05 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb07=['show','create','put','update','exports','multer','express','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id'];(function(_0x385401,_0x2dff2f){var _0x119c8a=function(_0x2758e4){while(--_0x2758e4){_0x385401['push'](_0x385401['shift']());}};_0x119c8a(++_0x2dff2f);}(_0xfb07,0x94));var _0x7fb0=function(_0x2451ab,_0x37e9d9){_0x2451ab=_0x2451ab-0x0;var _0x1b38de=_0xfb07[_0x2451ab];return _0x1b38de;};'use strict';var multer=require(_0x7fb0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7fb0('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7fb0('0x2'));var interaction=require(_0x7fb0('0x3'));var config=require('../../config/environment');var controller=require(_0x7fb0('0x4'));router['get']('/',auth[_0x7fb0('0x5')](),controller[_0x7fb0('0x6')]);router['get'](_0x7fb0('0x7'),auth[_0x7fb0('0x5')](),controller[_0x7fb0('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7fb0('0x9')]);router[_0x7fb0('0xa')]('/:id',auth[_0x7fb0('0x5')](),controller[_0x7fb0('0xb')]);router['delete']('/:id',auth[_0x7fb0('0x5')](),controller['destroy']);module[_0x7fb0('0xc')]=router; \ No newline at end of file +var _0xe820=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x64dd09,_0x15713a){var _0x42be45=function(_0x5920d6){while(--_0x5920d6){_0x64dd09['push'](_0x64dd09['shift']());}};_0x42be45(++_0x15713a);}(_0xe820,0xd2));var _0x0e82=function(_0x39d484,_0x5eceba){_0x39d484=_0x39d484-0x0;var _0x232c12=_0xe820[_0x39d484];return _0x232c12;};'use strict';var multer=require(_0x0e82('0x0'));var util=require('util');var path=require(_0x0e82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e82('0x2')]();var fs_extra=require(_0x0e82('0x3'));var auth=require(_0x0e82('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0e82('0x5'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x0e82('0x6')]('/',auth[_0x0e82('0x7')](),controller[_0x0e82('0x8')]);router[_0x0e82('0x6')](_0x0e82('0x9'),auth['isAuthenticated'](),controller[_0x0e82('0xa')]);router[_0x0e82('0xb')]('/',auth[_0x0e82('0x7')](),controller[_0x0e82('0xc')]);router[_0x0e82('0xd')]('/:id',auth[_0x0e82('0x7')](),controller[_0x0e82('0xe')]);router[_0x0e82('0xf')](_0x0e82('0x9'),auth[_0x0e82('0x7')](),controller[_0x0e82('0x10')]);module[_0x0e82('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 18cbf65..9bda291 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 _0x386f=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x386f,0x11a));var _0xf386=function(_0x3b6775,_0x223931){_0x3b6775=_0x3b6775-0x0;var _0xe93b9f=_0x386f[_0x3b6775];return _0xe93b9f;};'use strict';var moment=require(_0xf386('0x0'));var Sequelize=require(_0xf386('0x1'));module[_0xf386('0x2')]={'phone':{'type':Sequelize[_0xf386('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf386('0x4')],'unique':_0xf386('0x5')},'ListId':{'type':Sequelize[_0xf386('0x4')],'unique':_0xf386('0x5')},'VoiceQueueId':{'type':Sequelize[_0xf386('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xb0df=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x19a6de,_0x5df840){var _0x3fd18f=function(_0x2aef3f){while(--_0x2aef3f){_0x19a6de['push'](_0x19a6de['shift']());}};_0x3fd18f(++_0x5df840);}(_0xb0df,0x85));var _0xfb0d=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0xb0df[_0x26bf51];return _0x503415;};'use strict';var moment=require('moment');var Sequelize=require(_0xfb0d('0x0'));module[_0xfb0d('0x1')]={'phone':{'type':Sequelize[_0xfb0d('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfb0d('0x3')],'unique':_0xfb0d('0x4')},'ListId':{'type':Sequelize[_0xfb0d('0x3')],'unique':_0xfb0d('0x4')},'VoiceQueueId':{'type':Sequelize[_0xfb0d('0x3')],'unique':_0xfb0d('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 4bbd605..293f82a 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 _0xc31d=['rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','CmHopperBlack'];(function(_0x341d31,_0x4786f9){var _0x58095e=function(_0x3c9d7a){while(--_0x3c9d7a){_0x341d31['push'](_0x341d31['shift']());}};_0x58095e(++_0x4786f9);}(_0xc31d,0x18a));var _0xdc31=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc31d[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0xdc31('0x0'));var rimraf=require(_0xdc31('0x1'));var zipdir=require(_0xdc31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc31('0x3'));var BPromise=require(_0xdc31('0x4'));var Mustache=require(_0xdc31('0x5'));var util=require(_0xdc31('0x6'));var path=require('path');var sox=require(_0xdc31('0x7'));var csv=require(_0xdc31('0x8'));var ejs=require(_0xdc31('0x9'));var fs=require('fs');var fs_extra=require(_0xdc31('0xa'));var _=require(_0xdc31('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdc31('0xc'));var deskjs=require(_0xdc31('0xd'));var toCsv=require(_0xdc31('0x8'));var querystring=require(_0xdc31('0xe'));var Papa=require(_0xdc31('0xf'));var Redis=require('ioredis');var authService=require(_0xdc31('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdc31('0x11'));var hardwareService=require(_0xdc31('0x12'));var logger=require(_0xdc31('0x13'))('api');var utils=require(_0xdc31('0x14'));var config=require(_0xdc31('0x15'));var licenseUtil=require(_0xdc31('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x513491,_0x433327){_0x433327=_0x433327||0xcc;return function(_0x748bd8){if(_0x748bd8){return _0x513491[_0xdc31('0x17')](_0x433327);}return _0x513491[_0xdc31('0x18')](_0x433327)['end']();};}function respondWithResult(_0x4ffb9b,_0x4a3e3d){_0x4a3e3d=_0x4a3e3d||0xc8;return function(_0x33c6fd){if(_0x33c6fd){return _0x4ffb9b[_0xdc31('0x18')](_0x4a3e3d)['json'](_0x33c6fd);}};}function respondWithFilteredResult(_0x182712,_0x55ceb7){return function(_0x222715){if(_0x222715){var _0x394a6b=typeof _0x55ceb7[_0xdc31('0x19')]===_0xdc31('0x1a')&&typeof _0x55ceb7[_0xdc31('0x1b')]==='undefined';var _0x154d79=_0x222715[_0xdc31('0x1c')];var _0x20ed41=_0x394a6b?0x0:_0x55ceb7[_0xdc31('0x19')];var _0x411880=_0x394a6b?_0x222715['count']:_0x55ceb7['offset']+_0x55ceb7[_0xdc31('0x1b')];var _0x3e8a17;if(_0x411880>=_0x154d79){_0x411880=_0x154d79;_0x3e8a17=0xc8;}else{_0x3e8a17=0xce;}_0x182712[_0xdc31('0x18')](_0x3e8a17);return _0x182712['set'](_0xdc31('0x1d'),_0x20ed41+'-'+_0x411880+'/'+_0x154d79)[_0xdc31('0x1e')](_0x222715);}return null;};}function patchUpdates(_0x45e3a2){return function(_0x500673){try{jsonpatch[_0xdc31('0x1f')](_0x500673,_0x45e3a2,!![]);}catch(_0x4e5317){return BPromise[_0xdc31('0x20')](_0x4e5317);}return _0x500673[_0xdc31('0x21')]();};}function saveUpdates(_0x31f4d5,_0x1433d1){return function(_0x5cfd28){if(_0x5cfd28){return _0x5cfd28[_0xdc31('0x22')](_0x31f4d5)[_0xdc31('0x23')](function(_0x2589fb){return _0x2589fb;});}return null;};}function removeEntity(_0x65cd59,_0x12ff5d){return function(_0x35ea28){if(_0x35ea28){return _0x35ea28[_0xdc31('0x24')]()[_0xdc31('0x23')](function(){_0x65cd59[_0xdc31('0x18')](0xcc)[_0xdc31('0x25')]();});}};}function handleEntityNotFound(_0x354fb5,_0x5b8486){return function(_0x5beea3){if(!_0x5beea3){_0x354fb5[_0xdc31('0x17')](0x194);}return _0x5beea3;};}function handleError(_0x57880d,_0x51076c){_0x51076c=_0x51076c||0x1f4;return function(_0x50e06e){logger['error'](_0x50e06e[_0xdc31('0x26')]);if(_0x50e06e[_0xdc31('0x27')]){delete _0x50e06e[_0xdc31('0x27')];}_0x57880d[_0xdc31('0x18')](_0x51076c)[_0xdc31('0x28')](_0x50e06e);};}exports[_0xdc31('0x29')]=function(_0x115920,_0x322290){var _0x19516a={},_0x2ac5c2={},_0x4a444e={'count':0x0,'rows':[]};var _0x1a57db=_[_0xdc31('0x2a')](db[_0xdc31('0x2b')][_0xdc31('0x2c')],function(_0x5a2785){return{'name':_0x5a2785[_0xdc31('0x2d')],'type':_0x5a2785[_0xdc31('0x2e')]['key']};});_0x2ac5c2['model']=_[_0xdc31('0x2a')](_0x1a57db,_0xdc31('0x27'));_0x2ac5c2[_0xdc31('0x2f')]=_[_0xdc31('0x30')](_0x115920[_0xdc31('0x2f')]);_0x2ac5c2[_0xdc31('0x31')]=_[_0xdc31('0x32')](_0x2ac5c2[_0xdc31('0x33')],_0x2ac5c2['query']);_0x19516a['attributes']=_['intersection'](_0x2ac5c2[_0xdc31('0x33')],qs[_0xdc31('0x34')](_0x115920['query'][_0xdc31('0x34')]));_0x19516a['attributes']=_0x19516a[_0xdc31('0x35')][_0xdc31('0x36')]?_0x19516a[_0xdc31('0x35')]:_0x2ac5c2['model'];if(!_0x115920['query'][_0xdc31('0x37')](_0xdc31('0x38'))){_0x19516a[_0xdc31('0x1b')]=qs[_0xdc31('0x1b')](_0x115920[_0xdc31('0x2f')][_0xdc31('0x1b')]);_0x19516a[_0xdc31('0x19')]=qs[_0xdc31('0x19')](_0x115920['query'][_0xdc31('0x19')]);}_0x19516a[_0xdc31('0x39')]=qs[_0xdc31('0x3a')](_0x115920[_0xdc31('0x2f')][_0xdc31('0x3a')]);_0x19516a[_0xdc31('0x3b')]=qs['filters'](_[_0xdc31('0x3c')](_0x115920[_0xdc31('0x2f')],_0x2ac5c2[_0xdc31('0x31')]),_0x1a57db);if(_0x115920[_0xdc31('0x2f')][_0xdc31('0x3d')]){_0x19516a['where']=_[_0xdc31('0x3e')](_0x19516a[_0xdc31('0x3b')],{'$or':_['map'](_0x1a57db,function(_0x4c35de){if(_0x4c35de[_0xdc31('0x2e')]!=='VIRTUAL'){var _0x547e53={};_0x547e53[_0x4c35de[_0xdc31('0x27')]]={'$like':'%'+_0x115920[_0xdc31('0x2f')][_0xdc31('0x3d')]+'%'};return _0x547e53;}})});}_0x19516a=_[_0xdc31('0x3e')]({},_0x19516a,_0x115920['options']);var _0x59dda5={'where':_0x19516a[_0xdc31('0x3b')]};return db[_0xdc31('0x2b')]['count'](_0x59dda5)[_0xdc31('0x23')](function(_0x379fdc){_0x4a444e[_0xdc31('0x1c')]=_0x379fdc;if(_0x115920[_0xdc31('0x2f')]['includeAll']){_0x19516a[_0xdc31('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xdc31('0x40')](_0x19516a);})[_0xdc31('0x23')](function(_0x549496){_0x4a444e[_0xdc31('0x41')]=_0x549496;return _0x4a444e;})[_0xdc31('0x23')](respondWithFilteredResult(_0x322290,_0x19516a))[_0xdc31('0x42')](handleError(_0x322290,null));};exports[_0xdc31('0x43')]=function(_0x4bad52,_0x503d86){var _0x340659={'raw':!![],'where':{'id':_0x4bad52[_0xdc31('0x44')]['id']}},_0x13e631={};_0x13e631[_0xdc31('0x33')]=_[_0xdc31('0x30')](db[_0xdc31('0x2b')][_0xdc31('0x2c')]);_0x13e631[_0xdc31('0x2f')]=_[_0xdc31('0x30')](_0x4bad52[_0xdc31('0x2f')]);_0x13e631[_0xdc31('0x31')]=_[_0xdc31('0x32')](_0x13e631[_0xdc31('0x33')],_0x13e631[_0xdc31('0x2f')]);_0x340659[_0xdc31('0x35')]=_[_0xdc31('0x32')](_0x13e631[_0xdc31('0x33')],qs[_0xdc31('0x34')](_0x4bad52[_0xdc31('0x2f')][_0xdc31('0x34')]));_0x340659[_0xdc31('0x35')]=_0x340659[_0xdc31('0x35')]['length']?_0x340659[_0xdc31('0x35')]:_0x13e631['model'];if(_0x4bad52[_0xdc31('0x2f')][_0xdc31('0x45')]){_0x340659[_0xdc31('0x3f')]=[{'all':!![]}];}_0x340659=_[_0xdc31('0x3e')]({},_0x340659,_0x4bad52['options']);return db[_0xdc31('0x2b')]['find'](_0x340659)['then'](handleEntityNotFound(_0x503d86,null))[_0xdc31('0x23')](respondWithResult(_0x503d86,null))[_0xdc31('0x42')](handleError(_0x503d86,null));};exports['update']=function(_0x49c756,_0x2745d5){if(_0x49c756[_0xdc31('0x46')]['id']){delete _0x49c756[_0xdc31('0x46')]['id'];}return db[_0xdc31('0x2b')][_0xdc31('0x47')]({'where':{'id':_0x49c756[_0xdc31('0x44')]['id']}})[_0xdc31('0x23')](handleEntityNotFound(_0x2745d5,null))[_0xdc31('0x23')](saveUpdates(_0x49c756[_0xdc31('0x46')],null))[_0xdc31('0x23')](respondWithResult(_0x2745d5,null))['catch'](handleError(_0x2745d5,null));};exports[_0xdc31('0x24')]=function(_0x432bf7,_0x501f32){return db[_0xdc31('0x2b')][_0xdc31('0x47')]({'where':{'id':_0x432bf7[_0xdc31('0x44')]['id']}})['then'](handleEntityNotFound(_0x501f32,null))['then'](removeEntity(_0x501f32,null))[_0xdc31('0x42')](handleError(_0x501f32,null));};exports['describe']=function(_0x55b439,_0xb38fe1){return db[_0xdc31('0x2b')][_0xdc31('0x48')]()[_0xdc31('0x23')](respondWithResult(_0xb38fe1,null))[_0xdc31('0x42')](handleError(_0xb38fe1,null));}; \ No newline at end of file +var _0x9cf7=['filters','filter','merge','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','rawAttributes','fieldName','key','model','map','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x355ee7,_0x398425){var _0x228109=function(_0x433697){while(--_0x433697){_0x355ee7['push'](_0x355ee7['shift']());}};_0x228109(++_0x398425);}(_0x9cf7,0x13e));var _0x79cf=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9cf7[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0x79cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79cf('0x1'));var jsonpatch=require(_0x79cf('0x2'));var rp=require(_0x79cf('0x3'));var moment=require(_0x79cf('0x4'));var BPromise=require(_0x79cf('0x5'));var Mustache=require(_0x79cf('0x6'));var util=require('util');var path=require(_0x79cf('0x7'));var sox=require(_0x79cf('0x8'));var csv=require(_0x79cf('0x9'));var ejs=require(_0x79cf('0xa'));var fs=require('fs');var fs_extra=require(_0x79cf('0xb'));var _=require(_0x79cf('0xc'));var squel=require(_0x79cf('0xd'));var crypto=require(_0x79cf('0xe'));var jsforce=require(_0x79cf('0xf'));var deskjs=require(_0x79cf('0x10'));var toCsv=require(_0x79cf('0x9'));var querystring=require(_0x79cf('0x11'));var Papa=require(_0x79cf('0x12'));var Redis=require(_0x79cf('0x13'));var authService=require(_0x79cf('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x79cf('0x15'))(_0x79cf('0x16'));var utils=require('../../config/utils');var config=require(_0x79cf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x79cf('0x18'))['db'];function respondWithStatusCode(_0x197d55,_0x19026f){_0x19026f=_0x19026f||0xcc;return function(_0x5eb041){if(_0x5eb041){return _0x197d55[_0x79cf('0x19')](_0x19026f);}return _0x197d55[_0x79cf('0x1a')](_0x19026f)['end']();};}function respondWithResult(_0x4456ef,_0x536bb4){_0x536bb4=_0x536bb4||0xc8;return function(_0x4f8bec){if(_0x4f8bec){return _0x4456ef[_0x79cf('0x1a')](_0x536bb4)['json'](_0x4f8bec);}};}function respondWithFilteredResult(_0x3a1c4f,_0x298cf1){return function(_0x1d75b0){if(_0x1d75b0){var _0x40bda1=typeof _0x298cf1[_0x79cf('0x1b')]===_0x79cf('0x1c')&&typeof _0x298cf1[_0x79cf('0x1d')]===_0x79cf('0x1c');var _0x3119ad=_0x1d75b0[_0x79cf('0x1e')];var _0x3ebe2=_0x40bda1?0x0:_0x298cf1['offset'];var _0x57b7fb=_0x40bda1?_0x1d75b0[_0x79cf('0x1e')]:_0x298cf1['offset']+_0x298cf1[_0x79cf('0x1d')];var _0x2ffbd6;if(_0x57b7fb>=_0x3119ad){_0x57b7fb=_0x3119ad;_0x2ffbd6=0xc8;}else{_0x2ffbd6=0xce;}_0x3a1c4f[_0x79cf('0x1a')](_0x2ffbd6);return _0x3a1c4f[_0x79cf('0x1f')](_0x79cf('0x20'),_0x3ebe2+'-'+_0x57b7fb+'/'+_0x3119ad)[_0x79cf('0x21')](_0x1d75b0);}return null;};}function patchUpdates(_0x5bd30a){return function(_0x8f9e9f){try{jsonpatch[_0x79cf('0x22')](_0x8f9e9f,_0x5bd30a,!![]);}catch(_0x29bc24){return BPromise[_0x79cf('0x23')](_0x29bc24);}return _0x8f9e9f[_0x79cf('0x24')]();};}function saveUpdates(_0x30b42a,_0x49ea36){return function(_0x45cc95){if(_0x45cc95){return _0x45cc95[_0x79cf('0x25')](_0x30b42a)[_0x79cf('0x26')](function(_0x1ca790){return _0x1ca790;});}return null;};}function removeEntity(_0x262b19,_0x573479){return function(_0x54eba8){if(_0x54eba8){return _0x54eba8[_0x79cf('0x27')]()[_0x79cf('0x26')](function(){_0x262b19[_0x79cf('0x1a')](0xcc)[_0x79cf('0x28')]();});}};}function handleEntityNotFound(_0x5bfa74,_0x1ba209){return function(_0x18d3b6){if(!_0x18d3b6){_0x5bfa74['sendStatus'](0x194);}return _0x18d3b6;};}function handleError(_0x2be2b7,_0x46cb4c){_0x46cb4c=_0x46cb4c||0x1f4;return function(_0x575efe){logger[_0x79cf('0x29')](_0x575efe['stack']);if(_0x575efe[_0x79cf('0x2a')]){delete _0x575efe['name'];}_0x2be2b7[_0x79cf('0x1a')](_0x46cb4c)[_0x79cf('0x2b')](_0x575efe);};}exports['index']=function(_0x17e1e1,_0x1a06a5){var _0x4fd510={},_0xf65984={},_0x39a85c={'count':0x0,'rows':[]};var _0x99d58f=_['map'](db['CmHopperBlack'][_0x79cf('0x2c')],function(_0x55bf65){return{'name':_0x55bf65[_0x79cf('0x2d')],'type':_0x55bf65['type'][_0x79cf('0x2e')]};});_0xf65984[_0x79cf('0x2f')]=_[_0x79cf('0x30')](_0x99d58f,_0x79cf('0x2a'));_0xf65984['query']=_['keys'](_0x17e1e1[_0x79cf('0x31')]);_0xf65984['filters']=_['intersection'](_0xf65984[_0x79cf('0x2f')],_0xf65984['query']);_0x4fd510[_0x79cf('0x32')]=_['intersection'](_0xf65984[_0x79cf('0x2f')],qs[_0x79cf('0x33')](_0x17e1e1['query'][_0x79cf('0x33')]));_0x4fd510[_0x79cf('0x32')]=_0x4fd510['attributes']['length']?_0x4fd510[_0x79cf('0x32')]:_0xf65984[_0x79cf('0x2f')];if(!_0x17e1e1[_0x79cf('0x31')][_0x79cf('0x34')](_0x79cf('0x35'))){_0x4fd510[_0x79cf('0x1d')]=qs[_0x79cf('0x1d')](_0x17e1e1['query'][_0x79cf('0x1d')]);_0x4fd510[_0x79cf('0x1b')]=qs[_0x79cf('0x1b')](_0x17e1e1[_0x79cf('0x31')]['offset']);}_0x4fd510['order']=qs[_0x79cf('0x36')](_0x17e1e1[_0x79cf('0x31')][_0x79cf('0x36')]);_0x4fd510[_0x79cf('0x37')]=qs['filters'](_[_0x79cf('0x38')](_0x17e1e1[_0x79cf('0x31')],_0xf65984[_0x79cf('0x39')]),_0x99d58f);if(_0x17e1e1['query'][_0x79cf('0x3a')]){_0x4fd510['where']=_[_0x79cf('0x3b')](_0x4fd510[_0x79cf('0x37')],{'$or':_[_0x79cf('0x30')](_0x99d58f,function(_0x241090){if(_0x241090['type']!=='VIRTUAL'){var _0x14659b={};_0x14659b[_0x241090[_0x79cf('0x2a')]]={'$like':'%'+_0x17e1e1[_0x79cf('0x31')]['filter']+'%'};return _0x14659b;}})});}_0x4fd510=_[_0x79cf('0x3b')]({},_0x4fd510,_0x17e1e1[_0x79cf('0x3c')]);var _0x5850ac={'where':_0x4fd510['where']};return db[_0x79cf('0x3d')][_0x79cf('0x1e')](_0x5850ac)[_0x79cf('0x26')](function(_0x9b097a){_0x39a85c[_0x79cf('0x1e')]=_0x9b097a;if(_0x17e1e1[_0x79cf('0x31')][_0x79cf('0x3e')]){_0x4fd510[_0x79cf('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x79cf('0x40')](_0x4fd510);})[_0x79cf('0x26')](function(_0xac70ac){_0x39a85c[_0x79cf('0x41')]=_0xac70ac;return _0x39a85c;})[_0x79cf('0x26')](respondWithFilteredResult(_0x1a06a5,_0x4fd510))[_0x79cf('0x42')](handleError(_0x1a06a5,null));};exports[_0x79cf('0x43')]=function(_0x81a2d7,_0x399635){var _0x7a2076={'raw':!![],'where':{'id':_0x81a2d7[_0x79cf('0x44')]['id']}},_0x34563b={};_0x34563b[_0x79cf('0x2f')]=_[_0x79cf('0x45')](db['CmHopperBlack'][_0x79cf('0x2c')]);_0x34563b[_0x79cf('0x31')]=_[_0x79cf('0x45')](_0x81a2d7['query']);_0x34563b[_0x79cf('0x39')]=_[_0x79cf('0x46')](_0x34563b[_0x79cf('0x2f')],_0x34563b[_0x79cf('0x31')]);_0x7a2076[_0x79cf('0x32')]=_[_0x79cf('0x46')](_0x34563b[_0x79cf('0x2f')],qs[_0x79cf('0x33')](_0x81a2d7[_0x79cf('0x31')][_0x79cf('0x33')]));_0x7a2076[_0x79cf('0x32')]=_0x7a2076[_0x79cf('0x32')][_0x79cf('0x47')]?_0x7a2076[_0x79cf('0x32')]:_0x34563b[_0x79cf('0x2f')];if(_0x81a2d7[_0x79cf('0x31')][_0x79cf('0x3e')]){_0x7a2076[_0x79cf('0x3f')]=[{'all':!![]}];}_0x7a2076=_[_0x79cf('0x3b')]({},_0x7a2076,_0x81a2d7[_0x79cf('0x3c')]);return db[_0x79cf('0x3d')][_0x79cf('0x48')](_0x7a2076)[_0x79cf('0x26')](handleEntityNotFound(_0x399635,null))[_0x79cf('0x26')](respondWithResult(_0x399635,null))[_0x79cf('0x42')](handleError(_0x399635,null));};exports['update']=function(_0x28d03d,_0x2763d7){if(_0x28d03d[_0x79cf('0x49')]['id']){delete _0x28d03d[_0x79cf('0x49')]['id'];}return db[_0x79cf('0x3d')][_0x79cf('0x48')]({'where':{'id':_0x28d03d[_0x79cf('0x44')]['id']}})[_0x79cf('0x26')](handleEntityNotFound(_0x2763d7,null))[_0x79cf('0x26')](saveUpdates(_0x28d03d['body'],null))['then'](respondWithResult(_0x2763d7,null))[_0x79cf('0x42')](handleError(_0x2763d7,null));};exports[_0x79cf('0x27')]=function(_0x37ec4d,_0x38b652){return db[_0x79cf('0x3d')][_0x79cf('0x48')]({'where':{'id':_0x37ec4d[_0x79cf('0x44')]['id']}})[_0x79cf('0x26')](handleEntityNotFound(_0x38b652,null))[_0x79cf('0x26')](removeEntity(_0x38b652,null))['catch'](handleError(_0x38b652,null));};exports[_0x79cf('0x4a')]=function(_0xd1ab27,_0x51184a){return db[_0x79cf('0x3d')][_0x79cf('0x4a')]()[_0x79cf('0x26')](respondWithResult(_0x51184a,null))['catch'](handleError(_0x51184a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e61df05..4af05c8 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 _0x452c=['moment','bluebird','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','util','api'];(function(_0x234f19,_0x102456){var _0x34c83e=function(_0x792e2a){while(--_0x792e2a){_0x234f19['push'](_0x234f19['shift']());}};_0x34c83e(++_0x102456);}(_0x452c,0x8a));var _0xc452=function(_0x51494d,_0x375f8e){_0x51494d=_0x51494d-0x0;var _0x203e6a=_0x452c[_0x51494d];return _0x203e6a;};'use strict';var _=require('lodash');var util=require(_0xc452('0x0'));var logger=require('../../config/logger')(_0xc452('0x1'));var moment=require(_0xc452('0x2'));var BPromise=require(_0xc452('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc452('0x4'));var config=require(_0xc452('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0xc452('0x6')]=function(_0x4a8a68,_0x35fcfc){return _0x4a8a68[_0xc452('0x7')](_0xc452('0x8'),attributes,{'tableName':_0xc452('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66f1=['cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x66f1,0x175));var _0x166f=function(_0x1d227e,_0x361094){_0x1d227e=_0x1d227e-0x0;var _0x7ccf13=_0x66f1[_0x1d227e];return _0x7ccf13;};'use strict';var _=require(_0x166f('0x0'));var util=require(_0x166f('0x1'));var logger=require(_0x166f('0x2'))(_0x166f('0x3'));var moment=require(_0x166f('0x4'));var BPromise=require(_0x166f('0x5'));var rp=require(_0x166f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x166f('0x7'));var config=require('../../config/environment');var attributes=require(_0x166f('0x8'));module['exports']=function(_0x3a30a6,_0xfef711){return _0x3a30a6[_0x166f('0x9')](_0x166f('0xa'),attributes,{'tableName':_0x166f('0xb'),'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 998e3c2..5560d94 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 _0x4aeb=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','limit','include','model','map','attributes','UpdateCmHopperBlack','raw','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x4aeb,0x19c));var _0xb4ae=function(_0x132c77,_0x480f44){_0x132c77=_0x132c77-0x0;var _0x1fb83b=_0x4aeb[_0x132c77];return _0x1fb83b;};'use strict';var _=require(_0xb4ae('0x0'));var util=require('util');var moment=require(_0xb4ae('0x1'));var BPromise=require(_0xb4ae('0x2'));var rs=require(_0xb4ae('0x3'));var fs=require('fs');var Redis=require(_0xb4ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4ae('0x5'));var logger=require('../../config/logger')(_0xb4ae('0x6'));var config=require(_0xb4ae('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb4ae('0x8')][_0xb4ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ba213,_0xfc06fa,_0x48ed7e){return new BPromise(function(_0x423d9e,_0x83e630){return client['request'](_0x3ba213,_0x48ed7e)[_0xb4ae('0xa')](function(_0x4268e2){logger[_0xb4ae('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0xfc06fa,'request\x20sent');logger[_0xb4ae('0xc')](_0xb4ae('0xd'),_0xfc06fa,_0xb4ae('0xe'),JSON[_0xb4ae('0xf')](_0x4268e2));if(_0x4268e2['error']){if(_0x4268e2[_0xb4ae('0x10')][_0xb4ae('0x11')]===0x1f4){logger['error'](_0xb4ae('0x12'),_0xfc06fa,_0x4268e2[_0xb4ae('0x10')][_0xb4ae('0x13')]);return _0x83e630(_0x4268e2[_0xb4ae('0x10')][_0xb4ae('0x13')]);}logger[_0xb4ae('0x10')](_0xb4ae('0x12'),_0xfc06fa,_0x4268e2[_0xb4ae('0x10')]['message']);return _0x423d9e(_0x4268e2[_0xb4ae('0x10')]['message']);}else{logger[_0xb4ae('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0xfc06fa,_0xb4ae('0xe'));_0x423d9e(_0x4268e2[_0xb4ae('0x14')][_0xb4ae('0x13')]);}})[_0xb4ae('0x15')](function(_0x1bf427){logger['error'](_0xb4ae('0x12'),_0xfc06fa,_0x1bf427);_0x83e630(_0x1bf427);});});}exports[_0xb4ae('0x16')]=function(_0x4bdc9e){var _0x4f69f9=this;return new Promise(function(_0x52b92a,_0xa5f43b){return db[_0xb4ae('0x17')][_0xb4ae('0x18')]({'raw':_0x4bdc9e['options']?_0x4bdc9e[_0xb4ae('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4bdc9e['options']?_0x4bdc9e[_0xb4ae('0x19')][_0xb4ae('0x1a')]||null:null,'attributes':_0x4bdc9e[_0xb4ae('0x19')]?_0x4bdc9e['options']['attributes']||null:null,'limit':_0x4bdc9e[_0xb4ae('0x19')]?_0x4bdc9e['options'][_0xb4ae('0x1b')]||null:null,'include':_0x4bdc9e[_0xb4ae('0x19')]?_0x4bdc9e[_0xb4ae('0x19')]['include']?_['map'](_0x4bdc9e[_0xb4ae('0x19')][_0xb4ae('0x1c')],function(_0x2db02f){return{'model':db[_0x2db02f[_0xb4ae('0x1d')]],'as':_0x2db02f['as'],'attributes':_0x2db02f['attributes'],'include':_0x2db02f['include']?_[_0xb4ae('0x1e')](_0x2db02f[_0xb4ae('0x1c')],function(_0x2e8eb4){return{'model':db[_0x2e8eb4['model']],'as':_0x2e8eb4['as'],'attributes':_0x2e8eb4[_0xb4ae('0x1f')],'include':_0x2e8eb4[_0xb4ae('0x1c')]?_['map'](_0x2e8eb4[_0xb4ae('0x1c')],function(_0x49dfd1){return{'model':db[_0x49dfd1[_0xb4ae('0x1d')]],'as':_0x49dfd1['as'],'attributes':_0x49dfd1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48ccb5){logger[_0xb4ae('0xb')](_0xb4ae('0x16'),_0x4bdc9e);logger['debug'](_0xb4ae('0x16'),_0x4bdc9e,JSON['stringify'](_0x48ccb5));_0x52b92a(_0x48ccb5);})[_0xb4ae('0x15')](function(_0x5d231a){logger[_0xb4ae('0x10')]('GetCmHopperBlack',_0x5d231a[_0xb4ae('0x13')],_0x4bdc9e);_0xa5f43b(_0x4f69f9['error'](0x1f4,_0x5d231a[_0xb4ae('0x13')]));});});};exports[_0xb4ae('0x20')]=function(_0x493e55){var _0x2a450a=this;return new Promise(function(_0x39c7af,_0x45dc6a){return db['CmHopperBlack']['update'](_0x493e55['body'],{'raw':_0x493e55[_0xb4ae('0x19')]?_0x493e55[_0xb4ae('0x19')][_0xb4ae('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493e55[_0xb4ae('0x19')]?_0x493e55[_0xb4ae('0x19')][_0xb4ae('0x1a')]||null:null,'attributes':_0x493e55[_0xb4ae('0x19')]?_0x493e55['options']['attributes']||null:null,'limit':_0x493e55[_0xb4ae('0x19')]?_0x493e55['options'][_0xb4ae('0x1b')]||null:null})[_0xb4ae('0xa')](function(_0x588291){logger[_0xb4ae('0xb')](_0xb4ae('0x20'),_0x493e55);logger[_0xb4ae('0xc')](_0xb4ae('0x20'),_0x493e55,JSON[_0xb4ae('0xf')](_0x588291));_0x39c7af(_0x588291);})[_0xb4ae('0x15')](function(_0x18c1f2){logger[_0xb4ae('0x10')]('UpdateCmHopperBlack',_0x18c1f2[_0xb4ae('0x13')],_0x493e55);_0x45dc6a(_0x2a450a[_0xb4ae('0x10')](0x1f4,_0x18c1f2[_0xb4ae('0x13')]));});});};exports[_0xb4ae('0x22')]=function(_0x284a3a){var _0x21a837=this;return new Promise(function(_0x544481,_0x33787d){return db[_0xb4ae('0x17')][_0xb4ae('0x23')]({'where':_0x284a3a[_0xb4ae('0x19')]?_0x284a3a[_0xb4ae('0x19')][_0xb4ae('0x1a')]||null:null})['then'](function(_0x8832eb){logger[_0xb4ae('0xb')](_0xb4ae('0x22'),_0x284a3a);logger[_0xb4ae('0xc')](_0xb4ae('0x22'),_0x284a3a,JSON['stringify'](_0x8832eb));_0x544481(_0x8832eb);})[_0xb4ae('0x15')](function(_0x176ff1){logger[_0xb4ae('0x10')](_0xb4ae('0x22'),_0x176ff1[_0xb4ae('0x13')],_0x284a3a);_0x33787d(_0x21a837[_0xb4ae('0x10')](0x1f4,_0x176ff1[_0xb4ae('0x13')]));});});}; \ No newline at end of file +var _0x1997=['attributes','limit','include','map','model','UpdateCmHopperBlack','body','raw','debug','DestroyCmHopperBlack','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where'];(function(_0x3b7bb4,_0x223886){var _0x51d0f3=function(_0x2977ea){while(--_0x2977ea){_0x3b7bb4['push'](_0x3b7bb4['shift']());}};_0x51d0f3(++_0x223886);}(_0x1997,0x92));var _0x7199=function(_0x13843a,_0x4fdeb9){_0x13843a=_0x13843a-0x0;var _0x23b5e4=_0x1997[_0x13843a];return _0x23b5e4;};'use strict';var _=require(_0x7199('0x0'));var util=require('util');var moment=require(_0x7199('0x1'));var BPromise=require(_0x7199('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7199('0x3'))['db'];var utils=require(_0x7199('0x4'));var logger=require(_0x7199('0x5'))(_0x7199('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7199('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4075dc,_0x38443d,_0x13eb40){return new BPromise(function(_0x452204,_0x54c459){return client[_0x7199('0x8')](_0x4075dc,_0x13eb40)[_0x7199('0x9')](function(_0x1bcf2f){logger[_0x7199('0xa')](_0x7199('0xb'),_0x38443d,_0x7199('0xc'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x38443d,_0x7199('0xc'),JSON[_0x7199('0xd')](_0x1bcf2f));if(_0x1bcf2f['error']){if(_0x1bcf2f[_0x7199('0xe')][_0x7199('0xf')]===0x1f4){logger[_0x7199('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x38443d,_0x1bcf2f['error'][_0x7199('0x10')]);return _0x54c459(_0x1bcf2f['error']['message']);}logger[_0x7199('0xe')](_0x7199('0xb'),_0x38443d,_0x1bcf2f[_0x7199('0xe')]['message']);return _0x452204(_0x1bcf2f[_0x7199('0xe')][_0x7199('0x10')]);}else{logger[_0x7199('0xa')](_0x7199('0xb'),_0x38443d,'request\x20sent');_0x452204(_0x1bcf2f[_0x7199('0x11')][_0x7199('0x10')]);}})[_0x7199('0x12')](function(_0x23c220){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x38443d,_0x23c220);_0x54c459(_0x23c220);});});}exports[_0x7199('0x13')]=function(_0x5b6dc4){var _0x190e03=this;return new Promise(function(_0x420094,_0x3da686){return db[_0x7199('0x14')][_0x7199('0x15')]({'raw':_0x5b6dc4[_0x7199('0x16')]?_0x5b6dc4[_0x7199('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5b6dc4['options']?_0x5b6dc4[_0x7199('0x16')][_0x7199('0x17')]||null:null,'attributes':_0x5b6dc4['options']?_0x5b6dc4[_0x7199('0x16')][_0x7199('0x18')]||null:null,'limit':_0x5b6dc4[_0x7199('0x16')]?_0x5b6dc4[_0x7199('0x16')][_0x7199('0x19')]||null:null,'include':_0x5b6dc4[_0x7199('0x16')]?_0x5b6dc4['options'][_0x7199('0x1a')]?_[_0x7199('0x1b')](_0x5b6dc4[_0x7199('0x16')][_0x7199('0x1a')],function(_0x1d7142){return{'model':db[_0x1d7142['model']],'as':_0x1d7142['as'],'attributes':_0x1d7142[_0x7199('0x18')],'include':_0x1d7142[_0x7199('0x1a')]?_[_0x7199('0x1b')](_0x1d7142['include'],function(_0x30a3dc){return{'model':db[_0x30a3dc[_0x7199('0x1c')]],'as':_0x30a3dc['as'],'attributes':_0x30a3dc[_0x7199('0x18')],'include':_0x30a3dc[_0x7199('0x1a')]?_[_0x7199('0x1b')](_0x30a3dc['include'],function(_0x2b4ad3){return{'model':db[_0x2b4ad3[_0x7199('0x1c')]],'as':_0x2b4ad3['as'],'attributes':_0x2b4ad3['attributes']};}):[]};}):[]};}):[]:[]})[_0x7199('0x9')](function(_0x3ea74e){logger[_0x7199('0xa')](_0x7199('0x13'),_0x5b6dc4);logger['debug'](_0x7199('0x13'),_0x5b6dc4,JSON[_0x7199('0xd')](_0x3ea74e));_0x420094(_0x3ea74e);})[_0x7199('0x12')](function(_0xe464c7){logger[_0x7199('0xe')](_0x7199('0x13'),_0xe464c7[_0x7199('0x10')],_0x5b6dc4);_0x3da686(_0x190e03[_0x7199('0xe')](0x1f4,_0xe464c7[_0x7199('0x10')]));});});};exports[_0x7199('0x1d')]=function(_0x197883){var _0x3891ff=this;return new Promise(function(_0x10a8ad,_0x3d0a6f){return db['CmHopperBlack']['update'](_0x197883[_0x7199('0x1e')],{'raw':_0x197883['options']?_0x197883[_0x7199('0x16')][_0x7199('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x197883[_0x7199('0x16')]?_0x197883[_0x7199('0x16')][_0x7199('0x17')]||null:null,'attributes':_0x197883['options']?_0x197883[_0x7199('0x16')]['attributes']||null:null,'limit':_0x197883[_0x7199('0x16')]?_0x197883['options']['limit']||null:null})[_0x7199('0x9')](function(_0x21028c){logger[_0x7199('0xa')](_0x7199('0x1d'),_0x197883);logger[_0x7199('0x20')](_0x7199('0x1d'),_0x197883,JSON['stringify'](_0x21028c));_0x10a8ad(_0x21028c);})[_0x7199('0x12')](function(_0x3114b){logger[_0x7199('0xe')]('UpdateCmHopperBlack',_0x3114b['message'],_0x197883);_0x3d0a6f(_0x3891ff[_0x7199('0xe')](0x1f4,_0x3114b['message']));});});};exports[_0x7199('0x21')]=function(_0x10ca81){var _0x3eb705=this;return new Promise(function(_0x444350,_0x3811fd){return db[_0x7199('0x14')]['destroy']({'where':_0x10ca81[_0x7199('0x16')]?_0x10ca81['options'][_0x7199('0x17')]||null:null})[_0x7199('0x9')](function(_0x2a546a){logger[_0x7199('0xa')]('DestroyCmHopperBlack',_0x10ca81);logger[_0x7199('0x20')]('DestroyCmHopperBlack',_0x10ca81,JSON[_0x7199('0xd')](_0x2a546a));_0x444350(_0x2a546a);})['catch'](function(_0x201e13){logger[_0x7199('0xe')](_0x7199('0x21'),_0x201e13[_0x7199('0x10')],_0x10ca81);_0x3811fd(_0x3eb705[_0x7199('0xe')](0x1f4,_0x201e13[_0x7199('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5300a62..590f8b1 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 _0xa6b0=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x4aa624,_0x13124c){_0x4aa624=_0x4aa624-0x0;var _0x11e2fb=_0xa6b0[_0x4aa624];return _0x11e2fb;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0xe')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file +var _0x4137=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'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')]('/:id',auth[_0x7413('0xe')](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ac30654..5fe11db 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 _0xf298=['seconds','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','endtime'];(function(_0x554d01,_0x45ceb8){var _0x4794ae=function(_0x276bc1){while(--_0x276bc1){_0x554d01['push'](_0x554d01['shift']());}};_0x4794ae(++_0x45ceb8);}(_0xf298,0x1b2));var _0x8f29=function(_0x3d140d,_0x27f24f){_0x3d140d=_0x3d140d-0x0;var _0x39ec27=_0xf298[_0x3d140d];return _0x39ec27;};'use strict';var Sequelize=require(_0x8f29('0x0'));var moment=require(_0x8f29('0x1'));module['exports']={'state':{'type':Sequelize[_0x8f29('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8f29('0x3')]},'scheduledat':{'type':Sequelize[_0x8f29('0x4')]},'countbusyretry':{'type':Sequelize[_0x8f29('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8f29('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f29('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8f29('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8f29('0x3')]},'calleridnum':{'type':Sequelize[_0x8f29('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8f29('0x4')]},'answertime':{'type':Sequelize[_0x8f29('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8f29('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8f29('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8f29('0x3')]},'campaign':{'type':Sequelize[_0x8f29('0x3')]},'campaigntype':{'type':Sequelize[_0x8f29('0x3')]},'membername':{'type':Sequelize[_0x8f29('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x8f29('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8f29('0x3')]},'dispositionat':{'type':Sequelize[_0x8f29('0x4')],'set':function(_0x2a51c5){var _0x966142=this['getDataValue'](_0x8f29('0x5'));if(_0x966142&&_0x2a51c5){this['setDataValue']('followuptime',moment(_0x2a51c5)['diff'](moment(_0x966142),_0x8f29('0x6')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8f29('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8f29('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8f29('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x8f29('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8f29('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8f29('0x4')]},'deleted':{'type':Sequelize[_0x8f29('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8f29('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8f29('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x8f29('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x73f4=['sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','BOOLEAN'];(function(_0x548604,_0x289b7e){var _0x12394c=function(_0x32bb42){while(--_0x32bb42){_0x548604['push'](_0x548604['shift']());}};_0x12394c(++_0x289b7e);}(_0x73f4,0xdc));var _0x473f=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x73f4[_0x2fee96];return _0x2e6ad1;};'use strict';var Sequelize=require(_0x473f('0x0'));var moment=require('moment');module[_0x473f('0x1')]={'state':{'type':Sequelize[_0x473f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x473f('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x473f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x473f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x473f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x473f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x473f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x473f('0x3')]},'calleridname':{'type':Sequelize[_0x473f('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x473f('0x4')]},'answertime':{'type':Sequelize[_0x473f('0x4')]},'droptime':{'type':Sequelize[_0x473f('0x4')]},'endtime':{'type':Sequelize[_0x473f('0x4')]},'ringtime':{'type':Sequelize[_0x473f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x473f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x473f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x473f('0x3')]},'campaign':{'type':Sequelize[_0x473f('0x3')]},'campaigntype':{'type':Sequelize[_0x473f('0x3')]},'membername':{'type':Sequelize[_0x473f('0x3')]},'reason':{'type':Sequelize[_0x473f('0x3')]},'disposition':{'type':Sequelize[_0x473f('0x3')]},'secondDisposition':{'type':Sequelize[_0x473f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x473f('0x3')]},'dispositionat':{'type':Sequelize[_0x473f('0x4')],'set':function(_0x434daa){var _0x3617da=this[_0x473f('0x5')](_0x473f('0x6'));if(_0x3617da&&_0x434daa){this['setDataValue'](_0x473f('0x7'),moment(_0x434daa)[_0x473f('0x8')](moment(_0x3617da),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x473f('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x473f('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x473f('0x4')]},'callback':{'type':Sequelize[_0x473f('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x473f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x473f('0x4')]},'deleted':{'type':Sequelize[_0x473f('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x473f('0x4')]},'recallme':{'type':Sequelize[_0x473f('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x473f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x473f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 2ff12f5..b102049 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 _0x781d=['length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields'];(function(_0x29fc2c,_0x4ff86a){var _0x1adbc8=function(_0x596f87){while(--_0x596f87){_0x29fc2c['push'](_0x29fc2c['shift']());}};_0x1adbc8(++_0x4ff86a);}(_0x781d,0x14a));var _0xd781=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x781d[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':!![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['describe']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['describe']()[_0xd781('0x26')](respondWithResult(_0x16d16e,null))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x39ecdb,_0x336d30){if(_0x39ecdb[_0xd781('0x44')][_0xd781('0x45')]){delete _0x39ecdb['body'][_0xd781('0x45')];}return db[_0xd781('0x2c')][_0xd781('0x46')]({'where':{'uniqueid':_0x39ecdb['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x336d30,null))[_0xd781('0x26')](saveUpdates(_0x39ecdb['body'],null))[_0xd781('0x26')](respondWithResult(_0x336d30,null))[_0xd781('0x3f')](handleError(_0x336d30,null));};exports[_0xd781('0x47')]=function(_0x207546,_0x42a2f9,_0x599915){return db[_0xd781('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x207546[_0xd781('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xd781('0x4b')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xd781('0x4c')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal'](_0xd781('0x4f')))),_0xd781('0x50')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd781('0x53')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x54')))),_0xd781('0x55')]]})['then'](handleEntityNotFound(_0x42a2f9,null))[_0xd781('0x26')](respondWithResult(_0x42a2f9,null))[_0xd781('0x3f')](handleError(_0x42a2f9,null));};exports[_0xd781('0x56')]=function(_0x2c4874,_0x2e8bab,_0x38bd3e){return db[_0xd781('0x2c')][_0xd781('0x57')]({'raw':![],'where':{'CampaignId':_0x2c4874[_0xd781('0x41')]['id']},'attributes':[[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x58')))),_0xd781('0x59')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5a')))),_0xd781('0x4b')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4f')))),_0xd781('0x50')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5b')))),_0xd781('0x53')],[db['sequelize']['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xd781('0x26')](handleEntityNotFound(_0x2e8bab,null))[_0xd781('0x26')](respondWithResult(_0x2e8bab,null))[_0xd781('0x3f')](handleError(_0x2e8bab,null));};exports[_0xd781('0x5c')]=function(_0x26a0a9,_0x172a05,_0x2e0401){return db[_0xd781('0x5d')][_0xd781('0x46')]({'where':{'id':_0x26a0a9['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x172a05,null))[_0xd781('0x26')](function(_0x4c712f){var _0x24e3f5;if(_0x4c712f){_0x24e3f5=squel['insert']()[_0xd781('0x5e')](_0xd781('0x5f'))['fromQuery'](['phone',_0xd781('0x60'),_0xd781('0x61'),_0xd781('0x62'),_0xd781('0x63'),_0xd781('0x64'),_0xd781('0x65')],squel['select']()[_0xd781('0x66')](_0xd781('0x67'),_0xd781('0x68'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),'ListId')[_0xd781('0x66')]('ANY_VALUE(VoiceQueueId)',_0xd781('0x63'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x65'))[_0xd781('0x6c')](_0xd781('0x6d'))[_0xd781('0x39')]('VoiceQueueId\x20=\x20?',_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]())['where'](_0xd781('0x6f'),_0x26a0a9[_0xd781('0x44')][_0xd781('0x70')]['toString']())['where'](_0xd781('0x71'))['where'](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x68'))[_0xd781('0x6c')]('cm_hopper')[_0xd781('0x39')](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))[_0xd781('0x6c')](_0xd781('0x6d'))['where'](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id']['toString']())[_0xd781('0x39')](_0xd781('0x76')))[_0xd781('0x77')]('ContactId'))[_0xd781('0x6e')]();return db[_0xd781('0x49')]['query'](_0x24e3f5);}return[];})[_0xd781('0x26')](respondWithResult(_0x172a05,null))['catch'](handleError(_0x172a05,null));};exports[_0xd781('0x78')]=function(_0x23dba5,_0x3e0749,_0x192c95){return db[_0xd781('0x79')]['find']({'where':{'id':_0x23dba5[_0xd781('0x41')]['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x3e0749,null))[_0xd781('0x26')](function(_0x3897bf){var _0xaa945b;if(_0x3897bf){_0xaa945b=squel[_0xd781('0x7a')]()['into'](_0xd781('0x5f'))[_0xd781('0x7b')](['phone',_0xd781('0x60'),_0xd781('0x61'),'ListId',_0xd781('0x7c'),_0xd781('0x64'),_0xd781('0x65')],squel[_0xd781('0x73')]()[_0xd781('0x66')]('ANY_VALUE(calleridnum)','phone')['field'](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),_0xd781('0x62'))[_0xd781('0x66')]('ANY_VALUE(CampaignId)',_0xd781('0x7c'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')]('NOW()','updatedAt')['from'](_0xd781('0x6d'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id']['toString']())['where'](_0xd781('0x6f'),_0x23dba5[_0xd781('0x44')][_0xd781('0x70')][_0xd781('0x6e')]())['where'](_0xd781('0x71'))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')]('phone')[_0xd781('0x6c')](_0xd781('0x5f'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))['from']('cm_hopper_final')[_0xd781('0x39')](_0xd781('0x7d'),_0x23dba5['params']['id'][_0xd781('0x6e')]())[_0xd781('0x39')]('state\x20=\x204'))[_0xd781('0x77')](_0xd781('0x61')))['toString']();return db[_0xd781('0x49')]['query'](_0xaa945b);}return[];})[_0xd781('0x26')](respondWithResult(_0x3e0749,null))[_0xd781('0x3f')](handleError(_0x3e0749,null));};exports[_0xd781('0x7e')]=function(_0x52b9c6,_0x5a2252,_0x356c56){return db[_0xd781('0x7f')]['findOne']({'where':{'VoiceQueueId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x63')],'CampaignId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x7c')],'ContactId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x61')]}})[_0xd781('0x26')](handleEntityNotFound(_0x5a2252,null))[_0xd781('0x26')](function(_0x532fd8){if(_0x532fd8){return _0x532fd8;}return null;})[_0xd781('0x26')](respondWithResult(_0x5a2252,null))[_0xd781('0x3f')](handleError(_0x5a2252,null));}; \ No newline at end of file +var _0x687b=['filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper_final','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x687b,0x14a));var _0xb687=function(_0x27125a,_0x252d0d){_0x27125a=_0x27125a-0x0;var _0x391f7a=_0x687b[_0x27125a];return _0x391f7a;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':!![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['CmHopperFinal'][_0xb687('0x4b')]()[_0xb687('0x26')](respondWithResult(_0x4f3069,null))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports[_0xb687('0x25')]=function(_0x535c00,_0x33a0b0){if(_0x535c00[_0xb687('0x4c')][_0xb687('0x4d')]){delete _0x535c00[_0xb687('0x4c')]['uniqueid'];}return db['CmHopperFinal'][_0xb687('0x49')]({'where':{'uniqueid':_0x535c00[_0xb687('0x4e')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x33a0b0,null))['then'](saveUpdates(_0x535c00['body'],null))[_0xb687('0x26')](respondWithResult(_0x33a0b0,null))[_0xb687('0x4a')](handleError(_0x33a0b0,null));};exports[_0xb687('0x4f')]=function(_0x22e618,_0x34205d,_0x1fb31a){return db[_0xb687('0x2f')][_0xb687('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x22e618['params']['id']},'attributes':[[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x53')))),_0xb687('0x54')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x55')))),_0xb687('0x56')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb687('0x57')))),_0xb687('0x58')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb687('0x59')],[db['sequelize']['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb687('0x5a')))),_0xb687('0x5b')],[db['sequelize']['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')]['literal'](_0xb687('0x5c')))),'reCallContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xb687('0x26')](handleEntityNotFound(_0x34205d,null))['then'](respondWithResult(_0x34205d,null))['catch'](handleError(_0x34205d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5d266c,_0x1cc507,_0x1db4ca){return db[_0xb687('0x2f')][_0xb687('0x43')]({'raw':![],'where':{'CampaignId':_0x5d266c[_0xb687('0x4e')]['id']},'attributes':[[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5d')))),'noSuchContacts'],[db['sequelize']['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x53')))),_0xb687('0x54')],[db[_0xb687('0x50')]['fn']('COUNT',db[_0xb687('0x50')]['fn']('IF',db['sequelize'][_0xb687('0x52')](_0xb687('0x55')))),_0xb687('0x56')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')]['literal'](_0xb687('0x57')))),_0xb687('0x58')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db['sequelize'][_0xb687('0x52')](_0xb687('0x5e')))),_0xb687('0x59')],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5a')))),_0xb687('0x5b')],[db[_0xb687('0x50')]['fn']('COUNT',db[_0xb687('0x50')]['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5c')))),'reCallContacts'],[db[_0xb687('0x50')]['fn'](_0xb687('0x51'),db['sequelize']['fn']('IF',db[_0xb687('0x50')][_0xb687('0x52')](_0xb687('0x5f')))),'answeringMachine']]})[_0xb687('0x26')](handleEntityNotFound(_0x1cc507,null))[_0xb687('0x26')](respondWithResult(_0x1cc507,null))['catch'](handleError(_0x1cc507,null));};exports[_0xb687('0x60')]=function(_0x5449c4,_0x2c2add,_0x431cc5){return db['VoiceQueue'][_0xb687('0x49')]({'where':{'id':_0x5449c4[_0xb687('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c2add,null))[_0xb687('0x26')](function(_0x1736ef){var _0x52285e;if(_0x1736ef){_0x52285e=squel['insert']()[_0xb687('0x61')]('cm_hopper')[_0xb687('0x62')]([_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65'),_0xb687('0x66'),_0xb687('0x67'),_0xb687('0x68'),_0xb687('0x69')],squel['select']()[_0xb687('0x6a')](_0xb687('0x6b'),_0xb687('0x63'))[_0xb687('0x6a')](_0xb687('0x6c'),_0xb687('0x64'))['field'](_0xb687('0x6d'),_0xb687('0x65'))['field'](_0xb687('0x6e'),_0xb687('0x66'))[_0xb687('0x6a')](_0xb687('0x6f'),'VoiceQueueId')[_0xb687('0x6a')]('NOW()','createdAt')[_0xb687('0x6a')]('NOW()','updatedAt')[_0xb687('0x70')]('cm_hopper_final')[_0xb687('0x3e')](_0xb687('0x71'),_0x5449c4['params']['id'][_0xb687('0x72')]())[_0xb687('0x3e')]('state\x20=\x20?',_0x5449c4[_0xb687('0x4c')][_0xb687('0x73')][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x74'))[_0xb687('0x3e')](_0xb687('0x75'),squel[_0xb687('0x76')]()[_0xb687('0x6a')](_0xb687('0x63'))[_0xb687('0x70')]('cm_hopper')[_0xb687('0x3e')]('VoiceQueueId\x20=\x20?',_0x5449c4['params']['id'][_0xb687('0x72')]()))[_0xb687('0x3e')](_0xb687('0x75'),squel[_0xb687('0x76')]()[_0xb687('0x6a')]('calleridnum')['from'](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x71'),_0x5449c4[_0xb687('0x4e')]['id']['toString']())[_0xb687('0x3e')](_0xb687('0x78')))[_0xb687('0x79')](_0xb687('0x65')))[_0xb687('0x72')]();return db[_0xb687('0x50')][_0xb687('0x34')](_0x52285e);}return[];})[_0xb687('0x26')](respondWithResult(_0x2c2add,null))[_0xb687('0x4a')](handleError(_0x2c2add,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x25f5c3,_0x33d1fc,_0x207953){return db[_0xb687('0x7a')][_0xb687('0x49')]({'where':{'id':_0x25f5c3['params']['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x33d1fc,null))[_0xb687('0x26')](function(_0x48bbee){var _0x19ac6d;if(_0x48bbee){_0x19ac6d=squel['insert']()[_0xb687('0x61')](_0xb687('0x7b'))['fromQuery']([_0xb687('0x63'),_0xb687('0x64'),'ContactId',_0xb687('0x66'),_0xb687('0x7c'),_0xb687('0x68'),_0xb687('0x69')],squel[_0xb687('0x76')]()[_0xb687('0x6a')]('ANY_VALUE(calleridnum)',_0xb687('0x63'))[_0xb687('0x6a')](_0xb687('0x6c'),_0xb687('0x64'))[_0xb687('0x6a')](_0xb687('0x6d'),_0xb687('0x65'))[_0xb687('0x6a')](_0xb687('0x6e'),_0xb687('0x66'))[_0xb687('0x6a')]('ANY_VALUE(CampaignId)',_0xb687('0x7c'))['field'](_0xb687('0x6c'),_0xb687('0x68'))['field']('NOW()',_0xb687('0x69'))[_0xb687('0x70')](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3[_0xb687('0x4e')]['id'][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x7e'),_0x25f5c3[_0xb687('0x4c')][_0xb687('0x73')][_0xb687('0x72')]())[_0xb687('0x3e')](_0xb687('0x74'))[_0xb687('0x3e')](_0xb687('0x75'),squel['select']()['field'](_0xb687('0x63'))['from']('cm_hopper')[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3['params']['id'][_0xb687('0x72')]()))[_0xb687('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb687('0x76')]()[_0xb687('0x6a')](_0xb687('0x7f'))[_0xb687('0x70')](_0xb687('0x77'))[_0xb687('0x3e')](_0xb687('0x7d'),_0x25f5c3[_0xb687('0x4e')]['id'][_0xb687('0x72')]())['where'](_0xb687('0x78')))[_0xb687('0x79')]('ContactId'))[_0xb687('0x72')]();return db['sequelize'][_0xb687('0x34')](_0x19ac6d);}return[];})[_0xb687('0x26')](respondWithResult(_0x33d1fc,null))['catch'](handleError(_0x33d1fc,null));};exports[_0xb687('0x80')]=function(_0x20e46a,_0x1c389f,_0x45d0ab){return db[_0xb687('0x81')][_0xb687('0x82')]({'where':{'VoiceQueueId':_0x20e46a[_0xb687('0x4c')]['VoiceQueueId'],'CampaignId':_0x20e46a['body'][_0xb687('0x7c')],'ContactId':_0x20e46a['body'][_0xb687('0x65')]}})[_0xb687('0x26')](handleEntityNotFound(_0x1c389f,null))[_0xb687('0x26')](function(_0x312529){if(_0x312529){return _0x312529;}return null;})['then'](respondWithResult(_0x1c389f,null))[_0xb687('0x4a')](handleError(_0x1c389f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d0a819f..0d10ea2 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 _0x68b8=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x68b8,0x161));var _0x868b=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x68b8[_0x26b622];return _0x58a028;};'use strict';var _=require(_0x868b('0x0'));var util=require(_0x868b('0x1'));var logger=require(_0x868b('0x2'))(_0x868b('0x3'));var moment=require(_0x868b('0x4'));var BPromise=require(_0x868b('0x5'));var rp=require(_0x868b('0x6'));var fs=require('fs');var path=require(_0x868b('0x7'));var rimraf=require(_0x868b('0x8'));var config=require(_0x868b('0x9'));var attributes=require(_0x868b('0xa'));module[_0x868b('0xb')]=function(_0x590f16,_0x579509){return _0x590f16['define'](_0x868b('0xc'),attributes,{'tableName':_0x868b('0xd'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x868b('0xe')]},{'name':_0x868b('0xf'),'fields':[_0x868b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d04=['path','rimraf','../../config/environment','exports','define','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4f8d92,_0x4e38e9){var _0x294d97=function(_0x4521d2){while(--_0x4521d2){_0x4f8d92['push'](_0x4f8d92['shift']());}};_0x294d97(++_0x4e38e9);}(_0x7d04,0x7c));var _0x47d0=function(_0x502d81,_0x49d6a4){_0x502d81=_0x502d81-0x0;var _0x592db5=_0x7d04[_0x502d81];return _0x592db5;};'use strict';var _=require(_0x47d0('0x0'));var util=require(_0x47d0('0x1'));var logger=require(_0x47d0('0x2'))(_0x47d0('0x3'));var moment=require(_0x47d0('0x4'));var BPromise=require('bluebird');var rp=require(_0x47d0('0x5'));var fs=require('fs');var path=require(_0x47d0('0x6'));var rimraf=require(_0x47d0('0x7'));var config=require(_0x47d0('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0x47d0('0x9')]=function(_0x43a92c,_0x53a8bd){return _0x43a92c[_0x47d0('0xa')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x47d0('0xb')]},{'name':_0x47d0('0xc'),'fields':[_0x47d0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 471094c..0a6ce70 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(_0x53c702,_0x22a758){var _0x296d83=function(_0x587cc7){while(--_0x587cc7){_0x53c702['push'](_0x53c702['shift']());}};_0x296d83(++_0x22a758);}(_0x7a54,0x106));var _0x47a5=function(_0xa84d1,_0x1121cd){_0xa84d1=_0xa84d1-0x0;var _0x550f24=_0x7a54[_0xa84d1];return _0x550f24;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x386a08,_0x15ebd7){var _0x2bd829=function(_0x2485c0){while(--_0x2485c0){_0x386a08['push'](_0x386a08['shift']());}};_0x2bd829(++_0x15ebd7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3805e9,_0x33a4ed){_0x3805e9=_0x3805e9-0x0;var _0x207e20=_0xb10b[_0x3805e9];return _0x207e20;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 2bd59d7..bda36fa 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 _0x6b9f=['../../components/auth/service','index','get','/describe','isAuthenticated','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x6b9f,0x1db));var _0xf6b9=function(_0x52989c,_0x44d622){_0x52989c=_0x52989c-0x0;var _0x16758a=_0x6b9f[_0x52989c];return _0x16758a;};'use strict';var multer=require(_0xf6b9('0x0'));var util=require('util');var path=require(_0xf6b9('0x1'));var timeout=require(_0xf6b9('0x2'));var express=require(_0xf6b9('0x3'));var router=express['Router']();var fs_extra=require(_0xf6b9('0x4'));var auth=require(_0xf6b9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf6b9('0x6')]);router[_0xf6b9('0x7')](_0xf6b9('0x8'),auth[_0xf6b9('0x9')](),controller[_0xf6b9('0xa')]);router[_0xf6b9('0x7')](_0xf6b9('0xb'),auth[_0xf6b9('0x9')](),controller[_0xf6b9('0xc')]);router[_0xf6b9('0x7')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0xf6b9('0xd')]);router[_0xf6b9('0x7')](_0xf6b9('0xe'),auth[_0xf6b9('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xf6b9('0xf')](_0xf6b9('0x10'),auth[_0xf6b9('0x9')](),controller[_0xf6b9('0x11')]);router[_0xf6b9('0xf')]('/voice/campaign/moveContacts/:id',auth[_0xf6b9('0x9')](),controller[_0xf6b9('0x12')]);router['post'](_0xf6b9('0x13'),auth['isAuthenticated'](),controller[_0xf6b9('0x14')]);router[_0xf6b9('0x15')](_0xf6b9('0xb'),auth['isAuthenticated'](),controller[_0xf6b9('0x16')]);module[_0xf6b9('0x17')]=router; \ No newline at end of file +var _0x7348=['../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','get','/describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','put','/:id','update','exports','util','path','express','Router','fs-extra'];(function(_0x50f9c0,_0x4b97dd){var _0x114a23=function(_0x2e2c25){while(--_0x2e2c25){_0x50f9c0['push'](_0x50f9c0['shift']());}};_0x114a23(++_0x4b97dd);}(_0x7348,0x16b));var _0x8734=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7348[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x8734('0x0'));var path=require(_0x8734('0x1'));var timeout=require('connect-timeout');var express=require(_0x8734('0x2'));var router=express[_0x8734('0x3')]();var fs_extra=require(_0x8734('0x4'));var auth=require(_0x8734('0x5'));var interaction=require(_0x8734('0x6'));var config=require('../../config/environment');var controller=require(_0x8734('0x7'));router['get']('/',auth[_0x8734('0x8')](),controller['index']);router[_0x8734('0x9')](_0x8734('0xa'),auth[_0x8734('0x8')](),controller['describe']);router[_0x8734('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8734('0xb')]);router['get'](_0x8734('0xc'),auth['isAuthenticated'](),controller[_0x8734('0xd')]);router[_0x8734('0x9')](_0x8734('0xe'),auth[_0x8734('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x8734('0xf')](_0x8734('0x10'),auth[_0x8734('0x8')](),controller[_0x8734('0x11')]);router[_0x8734('0xf')](_0x8734('0x12'),auth[_0x8734('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8734('0xf')]('/checkContactHopper',auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x8734('0x13')](_0x8734('0x14'),auth[_0x8734('0x8')](),controller[_0x8734('0x15')]);module[_0x8734('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ab8d739..eadb737 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 _0x9eac=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x4d880e,_0x47f225){var _0x5a1326=function(_0x3d656a){while(--_0x3d656a){_0x4d880e['push'](_0x4d880e['shift']());}};_0x5a1326(++_0x47f225);}(_0x9eac,0x14d));var _0xc9ea=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0x9eac[_0x4327fe];return _0x138651;};'use strict';var Sequelize=require('sequelize');module[_0xc9ea('0x0')]={'state':{'type':Sequelize[_0xc9ea('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc9ea('0x2')]},'scheduledat':{'type':Sequelize[_0xc9ea('0x3')]},'countbusyretry':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc9ea('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xc9ea('0x2')]},'originatecalleridname':{'type':Sequelize[_0xc9ea('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc9ea('0x2')]},'starttime':{'type':Sequelize[_0xc9ea('0x3')]},'responsetime':{'type':Sequelize[_0xc9ea('0x3')]},'answertime':{'type':Sequelize[_0xc9ea('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc9ea('0x3')]},'ringtime':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc9ea('0x2')]},'campaign':{'type':Sequelize[_0xc9ea('0x2')]},'campaigntype':{'type':Sequelize[_0xc9ea('0x2')]},'membername':{'type':Sequelize[_0xc9ea('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xc9ea('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc9ea('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc9ea('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc9ea('0x3')]},'edited':{'type':Sequelize[_0xc9ea('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc9ea('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc9ea('0x2')]}}; \ No newline at end of file +var _0x9c0b=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x88f752,_0x943f24){var _0x226eb7=function(_0x10057b){while(--_0x10057b){_0x88f752['push'](_0x88f752['shift']());}};_0x226eb7(++_0x943f24);}(_0x9c0b,0xc8));var _0xb9c0=function(_0x294e64,_0x22460a){_0x294e64=_0x294e64-0x0;var _0x42b05b=_0x9c0b[_0x294e64];return _0x42b05b;};'use strict';var Sequelize=require(_0xb9c0('0x0'));module[_0xb9c0('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb9c0('0x2')]},'scheduledat':{'type':Sequelize[_0xb9c0('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb9c0('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xb9c0('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb9c0('0x2')]},'calleridname':{'type':Sequelize[_0xb9c0('0x2')]},'starttime':{'type':Sequelize[_0xb9c0('0x3')]},'responsetime':{'type':Sequelize[_0xb9c0('0x3')]},'answertime':{'type':Sequelize[_0xb9c0('0x3')]},'droptime':{'type':Sequelize[_0xb9c0('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb9c0('0x2')]},'campaign':{'type':Sequelize[_0xb9c0('0x2')]},'campaigntype':{'type':Sequelize[_0xb9c0('0x2')]},'membername':{'type':Sequelize[_0xb9c0('0x2')]},'reason':{'type':Sequelize[_0xb9c0('0x2')]},'amd':{'type':Sequelize[_0xb9c0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb9c0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb9c0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb9c0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb9c0('0x3')]},'recallme':{'type':Sequelize[_0xb9c0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xb9c0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb9c0('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb9c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1e92c42..40fb4cf 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 _0xb8f3=['status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','sort','filters','pick','where','merge','VIRTUAL','filter','options','CmHopperHistory','findAll','rows','catch','show','params','keys','include','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x13052b,_0x565758){var _0x135a7a=function(_0x21ab67){while(--_0x21ab67){_0x13052b['push'](_0x13052b['shift']());}};_0x135a7a(++_0x565758);}(_0xb8f3,0x112));var _0x3b8f=function(_0x508c0a,_0x1bcd5e){_0x508c0a=_0x508c0a-0x0;var _0x1c19b7=_0xb8f3[_0x508c0a];return _0x1c19b7;};'use strict';var emlformat=require(_0x3b8f('0x0'));var rimraf=require(_0x3b8f('0x1'));var zipdir=require(_0x3b8f('0x2'));var jsonpatch=require(_0x3b8f('0x3'));var rp=require(_0x3b8f('0x4'));var moment=require(_0x3b8f('0x5'));var BPromise=require(_0x3b8f('0x6'));var Mustache=require('mustache');var util=require(_0x3b8f('0x7'));var path=require(_0x3b8f('0x8'));var sox=require(_0x3b8f('0x9'));var csv=require(_0x3b8f('0xa'));var ejs=require(_0x3b8f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b8f('0xc'));var squel=require(_0x3b8f('0xd'));var crypto=require(_0x3b8f('0xe'));var jsforce=require(_0x3b8f('0xf'));var deskjs=require(_0x3b8f('0x10'));var toCsv=require(_0x3b8f('0xa'));var querystring=require('querystring');var Papa=require(_0x3b8f('0x11'));var Redis=require(_0x3b8f('0x12'));var authService=require(_0x3b8f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3b8f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b8f('0x15'))(_0x3b8f('0x16'));var utils=require(_0x3b8f('0x17'));var config=require(_0x3b8f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b8f('0x19'))['db'];function respondWithStatusCode(_0x255702,_0x632552){_0x632552=_0x632552||0xcc;return function(_0x134790){if(_0x134790){return _0x255702['sendStatus'](_0x632552);}return _0x255702[_0x3b8f('0x1a')](_0x632552)[_0x3b8f('0x1b')]();};}function respondWithResult(_0x21e7df,_0x1b4f33){_0x1b4f33=_0x1b4f33||0xc8;return function(_0x4388a0){if(_0x4388a0){return _0x21e7df[_0x3b8f('0x1a')](_0x1b4f33)[_0x3b8f('0x1c')](_0x4388a0);}};}function respondWithFilteredResult(_0x574846,_0x32c78a){return function(_0x3d4d5f){if(_0x3d4d5f){var _0xb38476=typeof _0x32c78a[_0x3b8f('0x1d')]===_0x3b8f('0x1e')&&typeof _0x32c78a[_0x3b8f('0x1f')]==='undefined';var _0x3d22e6=_0x3d4d5f[_0x3b8f('0x20')];var _0x2929b1=_0xb38476?0x0:_0x32c78a['offset'];var _0x3968ac=_0xb38476?_0x3d4d5f[_0x3b8f('0x20')]:_0x32c78a[_0x3b8f('0x1d')]+_0x32c78a[_0x3b8f('0x1f')];var _0x5b5021;if(_0x3968ac>=_0x3d22e6){_0x3968ac=_0x3d22e6;_0x5b5021=0xc8;}else{_0x5b5021=0xce;}_0x574846['status'](_0x5b5021);return _0x574846[_0x3b8f('0x21')]('Content-Range',_0x2929b1+'-'+_0x3968ac+'/'+_0x3d22e6)['json'](_0x3d4d5f);}return null;};}function patchUpdates(_0x5b1d5f){return function(_0x47722a){try{jsonpatch[_0x3b8f('0x22')](_0x47722a,_0x5b1d5f,!![]);}catch(_0x82c4b7){return BPromise[_0x3b8f('0x23')](_0x82c4b7);}return _0x47722a[_0x3b8f('0x24')]();};}function saveUpdates(_0x2e1d9e,_0x445f7b){return function(_0x42f636){if(_0x42f636){return _0x42f636[_0x3b8f('0x25')](_0x2e1d9e)[_0x3b8f('0x26')](function(_0x49c3df){return _0x49c3df;});}return null;};}function removeEntity(_0x4850f5,_0xde2c2e){return function(_0xc486ad){if(_0xc486ad){return _0xc486ad['destroy']()[_0x3b8f('0x26')](function(){_0x4850f5[_0x3b8f('0x1a')](0xcc)[_0x3b8f('0x1b')]();});}};}function handleEntityNotFound(_0x3082c6,_0x2fbc25){return function(_0x5ad85d){if(!_0x5ad85d){_0x3082c6['sendStatus'](0x194);}return _0x5ad85d;};}function handleError(_0x14ca1a,_0x235585){_0x235585=_0x235585||0x1f4;return function(_0x3fdbf8){logger[_0x3b8f('0x27')](_0x3fdbf8['stack']);if(_0x3fdbf8[_0x3b8f('0x28')]){delete _0x3fdbf8[_0x3b8f('0x28')];}_0x14ca1a[_0x3b8f('0x1a')](_0x235585)[_0x3b8f('0x29')](_0x3fdbf8);};}exports[_0x3b8f('0x2a')]=function(_0x947dd8,_0x5961e4){var _0x587411={},_0x1d43e2={},_0x59d0c2={'count':0x0,'rows':[]};var _0x12f563=_[_0x3b8f('0x2b')](db['CmHopperHistory'][_0x3b8f('0x2c')],function(_0x1097e0){return{'name':_0x1097e0[_0x3b8f('0x2d')],'type':_0x1097e0[_0x3b8f('0x2e')][_0x3b8f('0x2f')]};});_0x1d43e2[_0x3b8f('0x30')]=_['map'](_0x12f563,_0x3b8f('0x28'));_0x1d43e2[_0x3b8f('0x31')]=_['keys'](_0x947dd8[_0x3b8f('0x31')]);_0x1d43e2['filters']=_[_0x3b8f('0x32')](_0x1d43e2[_0x3b8f('0x30')],_0x1d43e2['query']);_0x587411[_0x3b8f('0x33')]=_[_0x3b8f('0x32')](_0x1d43e2[_0x3b8f('0x30')],qs[_0x3b8f('0x34')](_0x947dd8[_0x3b8f('0x31')]['fields']));_0x587411[_0x3b8f('0x33')]=_0x587411[_0x3b8f('0x33')][_0x3b8f('0x35')]?_0x587411['attributes']:_0x1d43e2['model'];if(!_0x947dd8['query']['hasOwnProperty']('nolimit')){_0x587411[_0x3b8f('0x1f')]=qs[_0x3b8f('0x1f')](_0x947dd8[_0x3b8f('0x31')][_0x3b8f('0x1f')]);_0x587411[_0x3b8f('0x1d')]=qs[_0x3b8f('0x1d')](_0x947dd8[_0x3b8f('0x31')][_0x3b8f('0x1d')]);}_0x587411['order']=qs[_0x3b8f('0x36')](_0x947dd8['query'][_0x3b8f('0x36')]);_0x587411['where']=qs[_0x3b8f('0x37')](_[_0x3b8f('0x38')](_0x947dd8[_0x3b8f('0x31')],_0x1d43e2[_0x3b8f('0x37')]),_0x12f563);if(_0x947dd8[_0x3b8f('0x31')]['filter']){_0x587411[_0x3b8f('0x39')]=_[_0x3b8f('0x3a')](_0x587411['where'],{'$or':_[_0x3b8f('0x2b')](_0x12f563,function(_0x269d46){if(_0x269d46[_0x3b8f('0x2e')]!==_0x3b8f('0x3b')){var _0x87a1a2={};_0x87a1a2[_0x269d46['name']]={'$like':'%'+_0x947dd8[_0x3b8f('0x31')][_0x3b8f('0x3c')]+'%'};return _0x87a1a2;}})});}_0x587411=_[_0x3b8f('0x3a')]({},_0x587411,_0x947dd8[_0x3b8f('0x3d')]);var _0x247f02={'where':_0x587411['where']};return db[_0x3b8f('0x3e')][_0x3b8f('0x20')](_0x247f02)[_0x3b8f('0x26')](function(_0x48dc65){_0x59d0c2[_0x3b8f('0x20')]=_0x48dc65;if(_0x947dd8[_0x3b8f('0x31')]['includeAll']){_0x587411['include']=[{'all':!![]}];}return db[_0x3b8f('0x3e')][_0x3b8f('0x3f')](_0x587411);})['then'](function(_0x29d8a3){_0x59d0c2[_0x3b8f('0x40')]=_0x29d8a3;return _0x59d0c2;})[_0x3b8f('0x26')](respondWithFilteredResult(_0x5961e4,_0x587411))[_0x3b8f('0x41')](handleError(_0x5961e4,null));};exports[_0x3b8f('0x42')]=function(_0x44d657,_0x2c9663){var _0x21bf5d={'raw':!![],'where':{'id':_0x44d657[_0x3b8f('0x43')]['id']}},_0x5ef614={};_0x5ef614['model']=_['keys'](db[_0x3b8f('0x3e')]['rawAttributes']);_0x5ef614[_0x3b8f('0x31')]=_[_0x3b8f('0x44')](_0x44d657['query']);_0x5ef614['filters']=_[_0x3b8f('0x32')](_0x5ef614[_0x3b8f('0x30')],_0x5ef614[_0x3b8f('0x31')]);_0x21bf5d[_0x3b8f('0x33')]=_[_0x3b8f('0x32')](_0x5ef614[_0x3b8f('0x30')],qs['fields'](_0x44d657[_0x3b8f('0x31')][_0x3b8f('0x34')]));_0x21bf5d[_0x3b8f('0x33')]=_0x21bf5d['attributes']['length']?_0x21bf5d['attributes']:_0x5ef614[_0x3b8f('0x30')];if(_0x44d657[_0x3b8f('0x31')]['includeAll']){_0x21bf5d[_0x3b8f('0x45')]=[{'all':!![]}];}_0x21bf5d=_[_0x3b8f('0x3a')]({},_0x21bf5d,_0x44d657[_0x3b8f('0x3d')]);return db['CmHopperHistory'][_0x3b8f('0x46')](_0x21bf5d)[_0x3b8f('0x26')](handleEntityNotFound(_0x2c9663,null))[_0x3b8f('0x26')](respondWithResult(_0x2c9663,null))['catch'](handleError(_0x2c9663,null));};exports['create']=function(_0x260164,_0x56432e){return db[_0x3b8f('0x3e')][_0x3b8f('0x47')](_0x260164[_0x3b8f('0x48')],{})[_0x3b8f('0x26')](respondWithResult(_0x56432e,0xc9))[_0x3b8f('0x41')](handleError(_0x56432e,null));};exports[_0x3b8f('0x49')]=function(_0x368f57,_0x13ea64){return db[_0x3b8f('0x3e')][_0x3b8f('0x49')]()[_0x3b8f('0x26')](respondWithResult(_0x13ea64,null))[_0x3b8f('0x41')](handleError(_0x13ea64,null));};exports['update']=function(_0x2373f8,_0x2f213c){if(_0x2373f8[_0x3b8f('0x48')][_0x3b8f('0x4a')]){delete _0x2373f8[_0x3b8f('0x48')][_0x3b8f('0x4a')];}return db[_0x3b8f('0x3e')][_0x3b8f('0x46')]({'where':{'uniqueid':_0x2373f8[_0x3b8f('0x43')]['id']}})[_0x3b8f('0x26')](handleEntityNotFound(_0x2f213c,null))[_0x3b8f('0x26')](saveUpdates(_0x2373f8[_0x3b8f('0x48')],null))['then'](respondWithResult(_0x2f213c,null))[_0x3b8f('0x41')](handleError(_0x2f213c,null));}; \ No newline at end of file +var _0x4d1f=['create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','end','sendStatus','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','include','find','catch'];(function(_0x579d69,_0x25d50e){var _0x5e2b18=function(_0x54b258){while(--_0x54b258){_0x579d69['push'](_0x579d69['shift']());}};_0x5e2b18(++_0x25d50e);}(_0x4d1f,0x166));var _0xf4d1=function(_0x1168ed,_0x38daf0){_0x1168ed=_0x1168ed-0x0;var _0x366a8f=_0x4d1f[_0x1168ed];return _0x366a8f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4d1('0x0'));var zipdir=require(_0xf4d1('0x1'));var jsonpatch=require(_0xf4d1('0x2'));var rp=require(_0xf4d1('0x3'));var moment=require(_0xf4d1('0x4'));var BPromise=require(_0xf4d1('0x5'));var Mustache=require(_0xf4d1('0x6'));var util=require(_0xf4d1('0x7'));var path=require('path');var sox=require(_0xf4d1('0x8'));var csv=require(_0xf4d1('0x9'));var ejs=require(_0xf4d1('0xa'));var fs=require('fs');var fs_extra=require(_0xf4d1('0xb'));var _=require('lodash');var squel=require(_0xf4d1('0xc'));var crypto=require(_0xf4d1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4d1('0xe'));var Papa=require(_0xf4d1('0xf'));var Redis=require(_0xf4d1('0x10'));var authService=require(_0xf4d1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4d1('0x12'))(_0xf4d1('0x13'));var utils=require('../../config/utils');var config=require(_0xf4d1('0x14'));var licenseUtil=require(_0xf4d1('0x15'));var db=require(_0xf4d1('0x16'))['db'];function respondWithStatusCode(_0x4c7c03,_0x114253){_0x114253=_0x114253||0xcc;return function(_0x2521b7){if(_0x2521b7){return _0x4c7c03['sendStatus'](_0x114253);}return _0x4c7c03['status'](_0x114253)['end']();};}function respondWithResult(_0x25d6f4,_0x47260e){_0x47260e=_0x47260e||0xc8;return function(_0x597ad7){if(_0x597ad7){return _0x25d6f4[_0xf4d1('0x17')](_0x47260e)[_0xf4d1('0x18')](_0x597ad7);}};}function respondWithFilteredResult(_0x27dd5f,_0xcd90a4){return function(_0x552ea7){if(_0x552ea7){var _0x1f3cb6=typeof _0xcd90a4[_0xf4d1('0x19')]===_0xf4d1('0x1a')&&typeof _0xcd90a4[_0xf4d1('0x1b')]===_0xf4d1('0x1a');var _0x5636c3=_0x552ea7[_0xf4d1('0x1c')];var _0x2d7f03=_0x1f3cb6?0x0:_0xcd90a4[_0xf4d1('0x19')];var _0x19f7fd=_0x1f3cb6?_0x552ea7['count']:_0xcd90a4[_0xf4d1('0x19')]+_0xcd90a4[_0xf4d1('0x1b')];var _0x4dd649;if(_0x19f7fd>=_0x5636c3){_0x19f7fd=_0x5636c3;_0x4dd649=0xc8;}else{_0x4dd649=0xce;}_0x27dd5f[_0xf4d1('0x17')](_0x4dd649);return _0x27dd5f['set'](_0xf4d1('0x1d'),_0x2d7f03+'-'+_0x19f7fd+'/'+_0x5636c3)[_0xf4d1('0x18')](_0x552ea7);}return null;};}function patchUpdates(_0x5ca8ec){return function(_0x4191ce){try{jsonpatch[_0xf4d1('0x1e')](_0x4191ce,_0x5ca8ec,!![]);}catch(_0x373f47){return BPromise['reject'](_0x373f47);}return _0x4191ce['save']();};}function saveUpdates(_0x43838a,_0x57d5a4){return function(_0x3eff8d){if(_0x3eff8d){return _0x3eff8d[_0xf4d1('0x1f')](_0x43838a)['then'](function(_0xd099ca){return _0xd099ca;});}return null;};}function removeEntity(_0x20cc22,_0x59c43a){return function(_0x555f00){if(_0x555f00){return _0x555f00['destroy']()[_0xf4d1('0x20')](function(){_0x20cc22[_0xf4d1('0x17')](0xcc)[_0xf4d1('0x21')]();});}};}function handleEntityNotFound(_0x38f6ae,_0x4e5eef){return function(_0x18639e){if(!_0x18639e){_0x38f6ae[_0xf4d1('0x22')](0x194);}return _0x18639e;};}function handleError(_0x4ffe7c,_0x54ec6c){_0x54ec6c=_0x54ec6c||0x1f4;return function(_0x7d2e2f){logger[_0xf4d1('0x23')](_0x7d2e2f[_0xf4d1('0x24')]);if(_0x7d2e2f[_0xf4d1('0x25')]){delete _0x7d2e2f[_0xf4d1('0x25')];}_0x4ffe7c[_0xf4d1('0x17')](_0x54ec6c)['send'](_0x7d2e2f);};}exports[_0xf4d1('0x26')]=function(_0x5924a7,_0x52a05b){var _0x516127={},_0x6cb1b4={},_0x3ee486={'count':0x0,'rows':[]};var _0x50d4a1=_[_0xf4d1('0x27')](db[_0xf4d1('0x28')][_0xf4d1('0x29')],function(_0x24074c){return{'name':_0x24074c[_0xf4d1('0x2a')],'type':_0x24074c['type'][_0xf4d1('0x2b')]};});_0x6cb1b4[_0xf4d1('0x2c')]=_['map'](_0x50d4a1,'name');_0x6cb1b4[_0xf4d1('0x2d')]=_[_0xf4d1('0x2e')](_0x5924a7[_0xf4d1('0x2d')]);_0x6cb1b4[_0xf4d1('0x2f')]=_[_0xf4d1('0x30')](_0x6cb1b4['model'],_0x6cb1b4[_0xf4d1('0x2d')]);_0x516127[_0xf4d1('0x31')]=_[_0xf4d1('0x30')](_0x6cb1b4['model'],qs[_0xf4d1('0x32')](_0x5924a7[_0xf4d1('0x2d')][_0xf4d1('0x32')]));_0x516127['attributes']=_0x516127[_0xf4d1('0x31')][_0xf4d1('0x33')]?_0x516127['attributes']:_0x6cb1b4[_0xf4d1('0x2c')];if(!_0x5924a7[_0xf4d1('0x2d')]['hasOwnProperty'](_0xf4d1('0x34'))){_0x516127['limit']=qs['limit'](_0x5924a7[_0xf4d1('0x2d')][_0xf4d1('0x1b')]);_0x516127['offset']=qs[_0xf4d1('0x19')](_0x5924a7[_0xf4d1('0x2d')]['offset']);}_0x516127[_0xf4d1('0x35')]=qs['sort'](_0x5924a7[_0xf4d1('0x2d')][_0xf4d1('0x36')]);_0x516127[_0xf4d1('0x37')]=qs[_0xf4d1('0x2f')](_[_0xf4d1('0x38')](_0x5924a7[_0xf4d1('0x2d')],_0x6cb1b4[_0xf4d1('0x2f')]),_0x50d4a1);if(_0x5924a7[_0xf4d1('0x2d')][_0xf4d1('0x39')]){_0x516127[_0xf4d1('0x37')]=_[_0xf4d1('0x3a')](_0x516127['where'],{'$or':_[_0xf4d1('0x27')](_0x50d4a1,function(_0x16a7b4){if(_0x16a7b4[_0xf4d1('0x3b')]!==_0xf4d1('0x3c')){var _0x1e7a11={};_0x1e7a11[_0x16a7b4['name']]={'$like':'%'+_0x5924a7[_0xf4d1('0x2d')][_0xf4d1('0x39')]+'%'};return _0x1e7a11;}})});}_0x516127=_[_0xf4d1('0x3a')]({},_0x516127,_0x5924a7[_0xf4d1('0x3d')]);var _0x24ada9={'where':_0x516127[_0xf4d1('0x37')]};return db['CmHopperHistory'][_0xf4d1('0x1c')](_0x24ada9)['then'](function(_0x4cd76a){_0x3ee486['count']=_0x4cd76a;if(_0x5924a7[_0xf4d1('0x2d')][_0xf4d1('0x3e')]){_0x516127['include']=[{'all':!![]}];}return db[_0xf4d1('0x28')][_0xf4d1('0x3f')](_0x516127);})[_0xf4d1('0x20')](function(_0x54de20){_0x3ee486[_0xf4d1('0x40')]=_0x54de20;return _0x3ee486;})[_0xf4d1('0x20')](respondWithFilteredResult(_0x52a05b,_0x516127))['catch'](handleError(_0x52a05b,null));};exports['show']=function(_0x211b8f,_0x1cc221){var _0xf9ac5f={'raw':!![],'where':{'id':_0x211b8f['params']['id']}},_0x5e2ccb={};_0x5e2ccb['model']=_['keys'](db[_0xf4d1('0x28')]['rawAttributes']);_0x5e2ccb[_0xf4d1('0x2d')]=_['keys'](_0x211b8f[_0xf4d1('0x2d')]);_0x5e2ccb[_0xf4d1('0x2f')]=_[_0xf4d1('0x30')](_0x5e2ccb[_0xf4d1('0x2c')],_0x5e2ccb[_0xf4d1('0x2d')]);_0xf9ac5f[_0xf4d1('0x31')]=_['intersection'](_0x5e2ccb[_0xf4d1('0x2c')],qs['fields'](_0x211b8f[_0xf4d1('0x2d')]['fields']));_0xf9ac5f['attributes']=_0xf9ac5f[_0xf4d1('0x31')][_0xf4d1('0x33')]?_0xf9ac5f[_0xf4d1('0x31')]:_0x5e2ccb[_0xf4d1('0x2c')];if(_0x211b8f['query'][_0xf4d1('0x3e')]){_0xf9ac5f[_0xf4d1('0x41')]=[{'all':!![]}];}_0xf9ac5f=_['merge']({},_0xf9ac5f,_0x211b8f['options']);return db[_0xf4d1('0x28')][_0xf4d1('0x42')](_0xf9ac5f)[_0xf4d1('0x20')](handleEntityNotFound(_0x1cc221,null))[_0xf4d1('0x20')](respondWithResult(_0x1cc221,null))[_0xf4d1('0x43')](handleError(_0x1cc221,null));};exports[_0xf4d1('0x44')]=function(_0x11a2fd,_0x526e2f){return db[_0xf4d1('0x28')][_0xf4d1('0x44')](_0x11a2fd[_0xf4d1('0x45')],{})[_0xf4d1('0x20')](respondWithResult(_0x526e2f,0xc9))[_0xf4d1('0x43')](handleError(_0x526e2f,null));};exports['describe']=function(_0x1fde47,_0x22ee40){return db[_0xf4d1('0x28')]['describe']()[_0xf4d1('0x20')](respondWithResult(_0x22ee40,null))[_0xf4d1('0x43')](handleError(_0x22ee40,null));};exports[_0xf4d1('0x1f')]=function(_0x10f574,_0x4efb00){if(_0x10f574['body']['uniqueid']){delete _0x10f574[_0xf4d1('0x45')]['uniqueid'];}return db[_0xf4d1('0x28')][_0xf4d1('0x42')]({'where':{'uniqueid':_0x10f574[_0xf4d1('0x46')]['id']}})[_0xf4d1('0x20')](handleEntityNotFound(_0x4efb00,null))[_0xf4d1('0x20')](saveUpdates(_0x10f574[_0xf4d1('0x45')],null))[_0xf4d1('0x20')](respondWithResult(_0x4efb00,null))[_0xf4d1('0x43')](handleError(_0x4efb00,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 5fddcbe..7c9b48f 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 _0x8ace=['request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1f4e09,_0x1fc591){var _0x10deec=function(_0x5c1fb9){while(--_0x5c1fb9){_0x1f4e09['push'](_0x1f4e09['shift']());}};_0x10deec(++_0x1fc591);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x8eb3ce,_0x130a49){_0x8eb3ce=_0x8eb3ce-0x0;var _0x44df65=_0x8ace[_0x8eb3ce];return _0x44df65;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));module[_0xe8ac('0xb')]=function(_0x170e14,_0x2b48ec){return _0x170e14['define'](_0xe8ac('0xc'),attributes,{'tableName':_0xe8ac('0xd'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xe8ac('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6da9=['./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x6da9,0x161));var _0x96da=function(_0x305c83,_0x1d142a){_0x305c83=_0x305c83-0x0;var _0x180efd=_0x6da9[_0x305c83];return _0x180efd;};'use strict';var _=require(_0x96da('0x0'));var util=require(_0x96da('0x1'));var logger=require(_0x96da('0x2'))(_0x96da('0x3'));var moment=require(_0x96da('0x4'));var BPromise=require(_0x96da('0x5'));var rp=require(_0x96da('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x96da('0x7'));module[_0x96da('0x8')]=function(_0x26fdbb,_0x5c4924){return _0x26fdbb[_0x96da('0x9')]('CmHopperHistory',attributes,{'tableName':_0x96da('0xa'),'paranoid':![],'indexes':[{'name':_0x96da('0xb'),'fields':[_0x96da('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 07eea07..dbb1dde 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 _0xea12=['http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','create','body','options','debug','AvgHandleTime','CmHopperHistory','findAll','raw','where','sequelize','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','GetVoiceQueueHopperHistory','stringify','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x18e90b,_0x45630e){var _0x11cd20=function(_0x4edd0d){while(--_0x4edd0d){_0x18e90b['push'](_0x18e90b['shift']());}};_0x11cd20(++_0x45630e);}(_0xea12,0x149));var _0x2ea1=function(_0x15fc09,_0x3bf36c){_0x15fc09=_0x15fc09-0x0;var _0x12c202=_0xea12[_0x15fc09];return _0x12c202;};'use strict';var _=require(_0x2ea1('0x0'));var util=require(_0x2ea1('0x1'));var moment=require(_0x2ea1('0x2'));var BPromise=require(_0x2ea1('0x3'));var rs=require(_0x2ea1('0x4'));var fs=require('fs');var Redis=require(_0x2ea1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ea1('0x6'));var logger=require(_0x2ea1('0x7'))('rpc');var config=require(_0x2ea1('0x8'));var jayson=require(_0x2ea1('0x9'));var client=jayson[_0x2ea1('0xa')][_0x2ea1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e7ab2,_0x3177fd,_0x16b11e){return new BPromise(function(_0x5efe62,_0x19bfe4){return client['request'](_0x4e7ab2,_0x16b11e)[_0x2ea1('0xc')](function(_0x4016f3){logger[_0x2ea1('0xd')](_0x2ea1('0xe'),_0x3177fd,_0x2ea1('0xf'));logger['debug'](_0x2ea1('0x10'),_0x3177fd,_0x2ea1('0xf'),JSON['stringify'](_0x4016f3));if(_0x4016f3['error']){if(_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x12')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3177fd,_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x13')]);return _0x19bfe4(_0x4016f3['error'][_0x2ea1('0x13')]);}logger[_0x2ea1('0x11')](_0x2ea1('0xe'),_0x3177fd,_0x4016f3[_0x2ea1('0x11')][_0x2ea1('0x13')]);return _0x5efe62(_0x4016f3[_0x2ea1('0x11')]['message']);}else{logger[_0x2ea1('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x3177fd,'request\x20sent');_0x5efe62(_0x4016f3[_0x2ea1('0x14')][_0x2ea1('0x13')]);}})[_0x2ea1('0x15')](function(_0x3d5736){logger[_0x2ea1('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3177fd,_0x3d5736);_0x19bfe4(_0x3d5736);});});}exports[_0x2ea1('0x16')]=function(_0xb0b766){var _0x219f92=this;return new Promise(function(_0x224622,_0xf0eeac){return db['CmHopperHistory'][_0x2ea1('0x17')](_0xb0b766[_0x2ea1('0x18')],{'raw':_0xb0b766['options']?_0xb0b766[_0x2ea1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2ea1('0xc')](function(_0x11c3ab){logger[_0x2ea1('0xd')](_0x2ea1('0x16'),_0xb0b766);logger[_0x2ea1('0x1a')](_0x2ea1('0x16'),_0xb0b766,JSON['stringify'](_0x11c3ab));_0x224622(_0x11c3ab);})[_0x2ea1('0x15')](function(_0x1ff647){logger[_0x2ea1('0x11')]('CreateCmHopperHistory',_0x1ff647[_0x2ea1('0x13')],_0xb0b766);_0xf0eeac(_0x219f92[_0x2ea1('0x11')](0x1f4,_0x1ff647[_0x2ea1('0x13')]));});});};exports[_0x2ea1('0x1b')]=function(_0x1ef4fa){var _0x1b8816=this;return new Promise(function(_0xa169e8,_0x1aeaf2){return db[_0x2ea1('0x1c')][_0x2ea1('0x1d')]({'raw':_0x1ef4fa['options']?_0x1ef4fa[_0x2ea1('0x19')][_0x2ea1('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ef4fa[_0x2ea1('0x19')]?_0x1ef4fa[_0x2ea1('0x19')][_0x2ea1('0x1f')]||null:null,'attributes':[[db[_0x2ea1('0x20')]['fn']('COUNT',db[_0x2ea1('0x20')]['col']('id')),_0x2ea1('0x21')],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db['sequelize']['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x24')))),_0x2ea1('0x25')],[db['sequelize']['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x26')))),_0x2ea1('0x27')],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x2ea1('0x20')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x2ea1('0x29')))),_0x2ea1('0x2a')],[db['sequelize']['fn'](_0x2ea1('0x2b'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x2ea1('0x2c')]]})['then'](function(_0x4a7ede){logger['info'](_0x2ea1('0x1b'),_0x1ef4fa);logger[_0x2ea1('0x1a')](_0x2ea1('0x1b'),_0x1ef4fa,JSON['stringify'](_0x4a7ede));_0xa169e8(_0x4a7ede);})[_0x2ea1('0x15')](function(_0x1ba1de){logger[_0x2ea1('0x11')](_0x2ea1('0x1b'),_0x1ba1de[_0x2ea1('0x13')],_0x1ef4fa);_0x1aeaf2(_0x1b8816['error'](0x1f4,_0x1ba1de[_0x2ea1('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4532dd){var _0x43750a=this;return new Promise(function(_0x509ead,_0x2b0a71){return db[_0x2ea1('0x1c')]['findAll']({'raw':_0x4532dd['options']?_0x4532dd[_0x2ea1('0x19')][_0x2ea1('0x1e')]===undefined?!![]:![]:!![],'where':_0x4532dd[_0x2ea1('0x19')]?_0x4532dd['options'][_0x2ea1('0x1f')]||null:null,'attributes':[[_0x2ea1('0x2d'),'name'],[db['sequelize']['fn'](_0x2ea1('0x22'),db['sequelize']['fn']('IF',db[_0x2ea1('0x20')]['literal'](_0x2ea1('0x2e')))),'outboundNoSuchCallsDay'],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db['sequelize']['literal'](_0x2ea1('0x2f')))),_0x2ea1('0x30')],[db['sequelize']['fn']('COUNT',db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')]['literal'](_0x2ea1('0x24')))),_0x2ea1('0x31')],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db['sequelize']['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x32')))),'outboundBusyCallsDay'],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x33')))),_0x2ea1('0x34')],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x35')))),_0x2ea1('0x36')],[db[_0x2ea1('0x20')]['fn']('COUNT',db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')]['literal'](_0x2ea1('0x37')))),_0x2ea1('0x38')],[db['sequelize']['fn'](_0x2ea1('0x22'),db['sequelize']['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x39')))),_0x2ea1('0x3a')],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x3b')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')]['literal'](_0x2ea1('0x3c')))),_0x2ea1('0x3d')],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')]['literal'](_0x2ea1('0x3e')))),_0x2ea1('0x3f')],[db[_0x2ea1('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')](_0x2ea1('0x40')))),'outboundAnswerAgiCallsDay'],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db[_0x2ea1('0x20')][_0x2ea1('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x2ea1('0x2d')]})[_0x2ea1('0xc')](function(_0x597d9b){logger['info'](_0x2ea1('0x41'),_0x4532dd);logger['debug'](_0x2ea1('0x41'),_0x4532dd,JSON[_0x2ea1('0x42')](_0x597d9b));_0x509ead(_0x597d9b);})['catch'](function(_0x1f24ca){logger[_0x2ea1('0x11')](_0x2ea1('0x41'),_0x1f24ca['message'],_0x4532dd);_0x2b0a71(_0x43750a[_0x2ea1('0x11')](0x1f4,_0x1f24ca['message']));});});};exports[_0x2ea1('0x43')]=function(_0xa985f8){var _0x549728=this;return new Promise(function(_0x5d4515,_0x433db2){return db[_0x2ea1('0x1c')][_0x2ea1('0x1d')]({'raw':_0xa985f8[_0x2ea1('0x19')]?_0xa985f8[_0x2ea1('0x19')][_0x2ea1('0x1e')]===undefined?!![]:![]:!![],'where':_0xa985f8['options']?_0xa985f8[_0x2ea1('0x19')][_0x2ea1('0x1f')]||null:null,'attributes':[[_0x2ea1('0x2d'),'name'],[db[_0x2ea1('0x20')]['fn']('COUNT',db[_0x2ea1('0x20')]['col']('id')),'ivrTotalCallsDays'],[db[_0x2ea1('0x20')]['fn'](_0x2ea1('0x22'),db[_0x2ea1('0x20')]['fn']('IF',db['sequelize'][_0x2ea1('0x23')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x2ea1('0x2d')]})['then'](function(_0x3589b4){logger[_0x2ea1('0xd')](_0x2ea1('0x43'),_0xa985f8);logger[_0x2ea1('0x1a')]('GetCampaignHopperHistory',_0xa985f8,JSON[_0x2ea1('0x42')](_0x3589b4));_0x5d4515(_0x3589b4);})[_0x2ea1('0x15')](function(_0x4c24eb){logger[_0x2ea1('0x11')](_0x2ea1('0x43'),_0x4c24eb[_0x2ea1('0x13')],_0xa985f8);_0x433db2(_0x549728[_0x2ea1('0x11')](0x1f4,_0x4c24eb[_0x2ea1('0x13')]));});});}; \ No newline at end of file +var _0x9d02=['lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','then','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory'];(function(_0x6eb02d,_0x20bdf5){var _0xb756de=function(_0x18fef2){while(--_0x18fef2){_0x6eb02d['push'](_0x6eb02d['shift']());}};_0xb756de(++_0x20bdf5);}(_0x9d02,0x118));var _0x29d0=function(_0x50c8cd,_0x1e4e8d){_0x50c8cd=_0x50c8cd-0x0;var _0x1dc8e5=_0x9d02[_0x50c8cd];return _0x1dc8e5;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var moment=require(_0x29d0('0x1'));var BPromise=require('bluebird');var rs=require(_0x29d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29d0('0x3'))['db'];var utils=require(_0x29d0('0x4'));var logger=require('../../config/logger')(_0x29d0('0x5'));var config=require(_0x29d0('0x6'));var jayson=require(_0x29d0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e35b3,_0x351d26,_0x18a02c){return new BPromise(function(_0x4a4019,_0x402fa6){return client[_0x29d0('0x8')](_0x5e35b3,_0x18a02c)['then'](function(_0x4bc0f9){logger[_0x29d0('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x351d26,_0x29d0('0xa'));logger[_0x29d0('0xb')](_0x29d0('0xc'),_0x351d26,_0x29d0('0xa'),JSON['stringify'](_0x4bc0f9));if(_0x4bc0f9['error']){if(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0xe')]===0x1f4){logger[_0x29d0('0xd')](_0x29d0('0xf'),_0x351d26,_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);return _0x402fa6(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);}logger[_0x29d0('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x351d26,_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);return _0x4a4019(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);}else{logger[_0x29d0('0x9')](_0x29d0('0xf'),_0x351d26,'request\x20sent');_0x4a4019(_0x4bc0f9[_0x29d0('0x11')][_0x29d0('0x10')]);}})[_0x29d0('0x12')](function(_0x49e919){logger[_0x29d0('0xd')](_0x29d0('0xf'),_0x351d26,_0x49e919);_0x402fa6(_0x49e919);});});}exports[_0x29d0('0x13')]=function(_0x443031){var _0x2b83e7=this;return new Promise(function(_0x28c0ee,_0x4fe4bb){return db[_0x29d0('0x14')][_0x29d0('0x15')](_0x443031[_0x29d0('0x16')],{'raw':_0x443031[_0x29d0('0x17')]?_0x443031[_0x29d0('0x17')][_0x29d0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x385e63){logger[_0x29d0('0x9')](_0x29d0('0x13'),_0x443031);logger['debug'](_0x29d0('0x13'),_0x443031,JSON[_0x29d0('0x19')](_0x385e63));_0x28c0ee(_0x385e63);})[_0x29d0('0x12')](function(_0x4179a0){logger['error'](_0x29d0('0x13'),_0x4179a0[_0x29d0('0x10')],_0x443031);_0x4fe4bb(_0x2b83e7[_0x29d0('0xd')](0x1f4,_0x4179a0['message']));});});};exports[_0x29d0('0x1a')]=function(_0x1c80f2){var _0x7e2520=this;return new Promise(function(_0x4313fb,_0x2a976d){return db[_0x29d0('0x14')][_0x29d0('0x1b')]({'raw':_0x1c80f2['options']?_0x1c80f2[_0x29d0('0x17')][_0x29d0('0x18')]===undefined?!![]:![]:!![],'where':_0x1c80f2[_0x29d0('0x17')]?_0x1c80f2[_0x29d0('0x17')][_0x29d0('0x1c')]||null:null,'attributes':[[db[_0x29d0('0x1d')]['fn']('COUNT',db[_0x29d0('0x1d')][_0x29d0('0x1e')]('id')),_0x29d0('0x1f')],[db['sequelize']['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')](_0x29d0('0x22')))),_0x29d0('0x23')],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0x29d0('0x24')],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x20'),db['sequelize']['fn']('IF',db[_0x29d0('0x1d')]['literal'](_0x29d0('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x29d0('0x1d')]['fn']('AVG',db[_0x29d0('0x1d')]['fn']('IF',db['sequelize'][_0x29d0('0x21')](_0x29d0('0x26')))),_0x29d0('0x27')],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x28'),db['sequelize']['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x57f049){logger[_0x29d0('0x9')]('AvgHandleTime',_0x1c80f2);logger[_0x29d0('0xb')](_0x29d0('0x1a'),_0x1c80f2,JSON[_0x29d0('0x19')](_0x57f049));_0x4313fb(_0x57f049);})[_0x29d0('0x12')](function(_0x5d2de9){logger[_0x29d0('0xd')](_0x29d0('0x1a'),_0x5d2de9[_0x29d0('0x10')],_0x1c80f2);_0x2a976d(_0x7e2520['error'](0x1f4,_0x5d2de9['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4bd1cf){var _0x4576a8=this;return new Promise(function(_0x26d731,_0xa5ee11){return db[_0x29d0('0x14')][_0x29d0('0x1b')]({'raw':_0x4bd1cf[_0x29d0('0x17')]?_0x4bd1cf[_0x29d0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4bd1cf[_0x29d0('0x17')]?_0x4bd1cf[_0x29d0('0x17')][_0x29d0('0x1c')]||null:null,'attributes':[['campaign',_0x29d0('0x29')],[db['sequelize']['fn'](_0x29d0('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x29d0('0x21')](_0x29d0('0x2a')))),_0x29d0('0x2b')],[db['sequelize']['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')](_0x29d0('0x2c')))),_0x29d0('0x2d')],[db[_0x29d0('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x29d0('0x1d')]['literal'](_0x29d0('0x22')))),_0x29d0('0x2e')],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db['sequelize'][_0x29d0('0x21')](_0x29d0('0x2f')))),_0x29d0('0x30')],[db[_0x29d0('0x1d')]['fn']('COUNT',db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')](_0x29d0('0x31')))),_0x29d0('0x32')],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')](_0x29d0('0x33')))),_0x29d0('0x34')],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x20'),db['sequelize']['fn']('IF',db[_0x29d0('0x1d')]['literal'](_0x29d0('0x35')))),_0x29d0('0x36')],[db[_0x29d0('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')](_0x29d0('0x37')))),_0x29d0('0x38')],[db['sequelize']['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')](_0x29d0('0x39')))),_0x29d0('0x3a')],[db[_0x29d0('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x29d0('0x3b')],[db['sequelize']['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x29d0('0x3c')],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x29d0('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x29d0('0x3d')],[db[_0x29d0('0x1d')]['fn']('COUNT',db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')](_0x29d0('0x3e')))),'outboundRejectCallsDay'],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x29d0('0x3f')]],'group':[_0x29d0('0x40')]})[_0x29d0('0x41')](function(_0x30502b){logger[_0x29d0('0x9')](_0x29d0('0x42'),_0x4bd1cf);logger[_0x29d0('0xb')](_0x29d0('0x42'),_0x4bd1cf,JSON['stringify'](_0x30502b));_0x26d731(_0x30502b);})[_0x29d0('0x12')](function(_0x978177){logger['error'](_0x29d0('0x42'),_0x978177[_0x29d0('0x10')],_0x4bd1cf);_0xa5ee11(_0x4576a8[_0x29d0('0xd')](0x1f4,_0x978177['message']));});});};exports['GetCampaignHopperHistory']=function(_0x569fa8){var _0x20c847=this;return new Promise(function(_0x19a822,_0xcd472a){return db['CmHopperHistory'][_0x29d0('0x1b')]({'raw':_0x569fa8[_0x29d0('0x17')]?_0x569fa8[_0x29d0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x569fa8[_0x29d0('0x17')]?_0x569fa8[_0x29d0('0x17')]['where']||null:null,'attributes':[[_0x29d0('0x40'),_0x29d0('0x29')],[db[_0x29d0('0x1d')]['fn']('COUNT',db['sequelize'][_0x29d0('0x1e')]('id')),_0x29d0('0x43')],[db[_0x29d0('0x1d')]['fn'](_0x29d0('0x20'),db[_0x29d0('0x1d')]['fn']('IF',db[_0x29d0('0x1d')][_0x29d0('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x29d0('0x44')]],'group':[_0x29d0('0x40')]})['then'](function(_0x2ba1ce){logger[_0x29d0('0x9')](_0x29d0('0x45'),_0x569fa8);logger['debug']('GetCampaignHopperHistory',_0x569fa8,JSON['stringify'](_0x2ba1ce));_0x19a822(_0x2ba1ce);})['catch'](function(_0xb84374){logger['error'](_0x29d0('0x45'),_0xb84374[_0x29d0('0x10')],_0x569fa8);_0xcd472a(_0x20c847[_0x29d0('0xd')](0x1f4,_0xb84374[_0x29d0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 52a161a..211395f 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 _0x96bf=['/describe','isAuthenticated','describe','/:id','show','post','create','put','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x96bf,0x16d));var _0xf96b=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x96bf[_0xcfd89f];return _0x59acd4;};'use strict';var multer=require('multer');var util=require(_0xf96b('0x0'));var path=require('path');var timeout=require(_0xf96b('0x1'));var express=require(_0xf96b('0x2'));var router=express['Router']();var fs_extra=require(_0xf96b('0x3'));var auth=require(_0xf96b('0x4'));var interaction=require(_0xf96b('0x5'));var config=require(_0xf96b('0x6'));var controller=require('./cmHopperHistory.controller');router[_0xf96b('0x7')]('/',auth['isAuthenticated'](),controller[_0xf96b('0x8')]);router[_0xf96b('0x7')](_0xf96b('0x9'),auth[_0xf96b('0xa')](),controller[_0xf96b('0xb')]);router[_0xf96b('0x7')](_0xf96b('0xc'),auth[_0xf96b('0xa')](),controller[_0xf96b('0xd')]);router[_0xf96b('0xe')]('/',auth[_0xf96b('0xa')](),controller[_0xf96b('0xf')]);router[_0xf96b('0x10')](_0xf96b('0xc'),auth[_0xf96b('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x7ccf=['describe','/:id','post','create','put','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x7ccf,0x1b0));var _0xf7cc=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x7ccf[_0x2a67fe];return _0x57e726;};'use strict';var multer=require(_0xf7cc('0x0'));var util=require('util');var path=require(_0xf7cc('0x1'));var timeout=require('connect-timeout');var express=require(_0xf7cc('0x2'));var router=express[_0xf7cc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf7cc('0x4'));var interaction=require(_0xf7cc('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xf7cc('0x6')](),controller[_0xf7cc('0x7')]);router[_0xf7cc('0x8')](_0xf7cc('0x9'),auth[_0xf7cc('0x6')](),controller[_0xf7cc('0xa')]);router[_0xf7cc('0x8')](_0xf7cc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf7cc('0xc')]('/',auth[_0xf7cc('0x6')](),controller[_0xf7cc('0xd')]);router[_0xf7cc('0xe')](_0xf7cc('0xb'),auth[_0xf7cc('0x6')](),controller[_0xf7cc('0xf')]);module[_0xf7cc('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6bf8b18..43ff2b7 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 _0xca8d=['STRING','name','sequelize','exports'];(function(_0xb3fed2,_0x286a73){var _0x11692d=function(_0x7d4562){while(--_0x7d4562){_0xb3fed2['push'](_0xb3fed2['shift']());}};_0x11692d(++_0x286a73);}(_0xca8d,0x172));var _0xdca8=function(_0x49c1b0,_0x35b033){_0x49c1b0=_0x49c1b0-0x0;var _0x5be831=_0xca8d[_0x49c1b0];return _0x5be831;};'use strict';var Sequelize=require(_0xdca8('0x0'));module[_0xdca8('0x1')]={'name':{'type':Sequelize[_0xdca8('0x2')],'unique':_0xdca8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdca8('0x2')]},'dialPrefix':{'type':Sequelize[_0xdca8('0x2')]}}; \ No newline at end of file +var _0xde64=['sequelize','exports','STRING','name'];(function(_0x127f2b,_0x764323){var _0x577712=function(_0x57ea03){while(--_0x57ea03){_0x127f2b['push'](_0x127f2b['shift']());}};_0x577712(++_0x764323);}(_0xde64,0x17c));var _0x4de6=function(_0x493fee,_0x1515b6){_0x493fee=_0x493fee-0x0;var _0x214cd8=_0xde64[_0x493fee];return _0x214cd8;};'use strict';var Sequelize=require(_0x4de6('0x0'));module[_0x4de6('0x1')]={'name':{'type':Sequelize[_0x4de6('0x2')],'unique':_0x4de6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4de6('0x2')]},'dialPrefix':{'type':Sequelize[_0x4de6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 9065af1..679bf95 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 _0x0448=['getDispositions','Disposition','length','removeDispositions','ids','addContacts','isArray','tags','join','CmContact','success','push','dataValues','message','json','Malformed\x20request\x20syntax','CmCustomField','format','raw','getContacts','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','each','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','type','text','Sequelize','TEXT','number','INTEGER','switch','queryInterface','addColumn','cf_%s','getCustomFields','findOne','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','info','eml-format','rimraf','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','limit','count','Content-Range','apply','then','Lists','destroy','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ListId'];(function(_0x2cd31d,_0x4bfbb9){var _0x312155=function(_0x3f9e83){while(--_0x3f9e83){_0x2cd31d['push'](_0x2cd31d['shift']());}};_0x312155(++_0x4bfbb9);}(_0x0448,0xea));var _0x8044=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x0448[_0x44d9ab];return _0x31485e;};'use strict';var emlformat=require(_0x8044('0x0'));var rimraf=require(_0x8044('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8044('0x2'));var rp=require('request-promise');var moment=require(_0x8044('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8044('0x4'));var sox=require(_0x8044('0x5'));var csv=require(_0x8044('0x6'));var ejs=require(_0x8044('0x7'));var fs=require('fs');var fs_extra=require(_0x8044('0x8'));var _=require(_0x8044('0x9'));var squel=require(_0x8044('0xa'));var crypto=require(_0x8044('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8044('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8044('0xd'));var Redis=require(_0x8044('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8044('0xf'));var as=require(_0x8044('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8044('0x11'));var config=require(_0x8044('0x12'));var licenseUtil=require(_0x8044('0x13'));var db=require(_0x8044('0x14'))['db'];var csv_results;config[_0x8044('0x15')]=_[_0x8044('0x16')](config['redis'],{'host':_0x8044('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8044('0x15')]));require('./cmList.socket')[_0x8044('0x18')](socket);function respondWithStatusCode(_0x370515,_0x3e292a){_0x3e292a=_0x3e292a||0xcc;return function(_0x15249c){if(_0x15249c){return _0x370515[_0x8044('0x19')](_0x3e292a);}return _0x370515[_0x8044('0x1a')](_0x3e292a)[_0x8044('0x1b')]();};}function respondWithResult(_0x1fac59,_0x2941bb){_0x2941bb=_0x2941bb||0xc8;return function(_0x650f16){if(_0x650f16){return _0x1fac59['status'](_0x2941bb)['json'](_0x650f16);}};}function respondWithFilteredResult(_0x1b6a60,_0x206e30){return function(_0x48744f){if(_0x48744f){var _0x320dbc=typeof _0x206e30[_0x8044('0x1c')]==='undefined'&&typeof _0x206e30[_0x8044('0x1d')]==='undefined';var _0x5ab85d=_0x48744f[_0x8044('0x1e')];var _0x2d4d52=_0x320dbc?0x0:_0x206e30[_0x8044('0x1c')];var _0x1c4d7b=_0x320dbc?_0x48744f['count']:_0x206e30[_0x8044('0x1c')]+_0x206e30[_0x8044('0x1d')];var _0x13381a;if(_0x1c4d7b>=_0x5ab85d){_0x1c4d7b=_0x5ab85d;_0x13381a=0xc8;}else{_0x13381a=0xce;}_0x1b6a60[_0x8044('0x1a')](_0x13381a);return _0x1b6a60['set'](_0x8044('0x1f'),_0x2d4d52+'-'+_0x1c4d7b+'/'+_0x5ab85d)['json'](_0x48744f);}return null;};}function patchUpdates(_0x3cfb59){return function(_0x36fe75){try{jsonpatch[_0x8044('0x20')](_0x36fe75,_0x3cfb59,!![]);}catch(_0x116579){return BPromise['reject'](_0x116579);}return _0x36fe75['save']();};}function saveUpdates(_0x42bc28,_0x24cfa1){return function(_0x5dd172){if(_0x5dd172){return _0x5dd172['update'](_0x42bc28)[_0x8044('0x21')](function(_0x260bd7){return _0x260bd7;});}return null;};}function removeEntity(_0x56112b,_0x1de41d){return function(_0x53b140){if(_0x53b140){return _0x53b140['destroy']()['then'](function(){var _0x39ff4a=_0x53b140['get']({'plain':!![]});var _0x3d0efb=_0x8044('0x22');return db['UserProfileResource'][_0x8044('0x23')]({'where':{'type':_0x3d0efb,'resourceId':_0x39ff4a['id']}})[_0x8044('0x21')](function(){return _0x53b140;});})[_0x8044('0x21')](function(){_0x56112b[_0x8044('0x1a')](0xcc)[_0x8044('0x1b')]();});}};}function handleEntityNotFound(_0x51ee00,_0x3a9172){return function(_0x50ce1a){if(!_0x50ce1a){_0x51ee00[_0x8044('0x19')](0x194);}return _0x50ce1a;};}function handleError(_0x4ce4a0,_0x21fcf2){_0x21fcf2=_0x21fcf2||0x1f4;return function(_0x3a65be){logger['error'](_0x3a65be[_0x8044('0x24')]);if(_0x3a65be['name']){delete _0x3a65be[_0x8044('0x25')];}_0x4ce4a0[_0x8044('0x1a')](_0x21fcf2)[_0x8044('0x26')](_0x3a65be);};}exports[_0x8044('0x27')]=function(_0xaa30b7,_0x44e550){var _0x3c8056={},_0x1aaf55={},_0x112bf2={'count':0x0,'rows':[]};var _0x370dbf=_[_0x8044('0x28')](db[_0x8044('0x29')][_0x8044('0x2a')],function(_0xfe0189){return{'name':_0xfe0189[_0x8044('0x2b')],'type':_0xfe0189['type'][_0x8044('0x2c')]};});_0x1aaf55[_0x8044('0x2d')]=_[_0x8044('0x28')](_0x370dbf,_0x8044('0x25'));_0x1aaf55[_0x8044('0x2e')]=_[_0x8044('0x2f')](_0xaa30b7[_0x8044('0x2e')]);_0x1aaf55[_0x8044('0x30')]=_[_0x8044('0x31')](_0x1aaf55['model'],_0x1aaf55[_0x8044('0x2e')]);_0x3c8056['attributes']=_[_0x8044('0x31')](_0x1aaf55[_0x8044('0x2d')],qs[_0x8044('0x32')](_0xaa30b7['query']['fields']));_0x3c8056['attributes']=_0x3c8056['attributes']['length']?_0x3c8056[_0x8044('0x33')]:_0x1aaf55[_0x8044('0x2d')];if(!_0xaa30b7['query'][_0x8044('0x34')](_0x8044('0x35'))){_0x3c8056[_0x8044('0x1d')]=qs[_0x8044('0x1d')](_0xaa30b7[_0x8044('0x2e')]['limit']);_0x3c8056[_0x8044('0x1c')]=qs['offset'](_0xaa30b7['query'][_0x8044('0x1c')]);}_0x3c8056[_0x8044('0x36')]=qs[_0x8044('0x37')](_0xaa30b7['query'][_0x8044('0x37')]);_0x3c8056['where']=qs[_0x8044('0x30')](_[_0x8044('0x38')](_0xaa30b7[_0x8044('0x2e')],_0x1aaf55[_0x8044('0x30')]),_0x370dbf);if(_0xaa30b7[_0x8044('0x2e')][_0x8044('0x39')]){_0x3c8056[_0x8044('0x3a')]=_[_0x8044('0x3b')](_0x3c8056[_0x8044('0x3a')],{'$or':_[_0x8044('0x28')](_0x370dbf,function(_0x3b0609){if(_0x3b0609['type']!==_0x8044('0x3c')){var _0xfb2d={};_0xfb2d[_0x3b0609[_0x8044('0x25')]]={'$like':'%'+_0xaa30b7['query'][_0x8044('0x39')]+'%'};return _0xfb2d;}})});}_0x3c8056=_[_0x8044('0x3b')]({},_0x3c8056,_0xaa30b7[_0x8044('0x3d')]);var _0x26d81c={'where':_0x3c8056[_0x8044('0x3a')]};return db['CmList'][_0x8044('0x1e')](_0x26d81c)[_0x8044('0x21')](function(_0x296c24){_0x112bf2[_0x8044('0x1e')]=_0x296c24;if(_0xaa30b7[_0x8044('0x2e')][_0x8044('0x3e')]){_0x3c8056[_0x8044('0x3f')]=[{'all':!![]}];}return db[_0x8044('0x29')][_0x8044('0x40')](_0x3c8056);})['then'](function(_0x1e2d56){_0x112bf2[_0x8044('0x41')]=_0x1e2d56;return _0x112bf2;})[_0x8044('0x21')](respondWithFilteredResult(_0x44e550,_0x3c8056))[_0x8044('0x42')](handleError(_0x44e550,null));};exports['show']=function(_0x31f647,_0x269d8f){var _0x3505c6={'raw':![],'where':{'id':_0x31f647['params']['id']}},_0x29c55e={};_0x29c55e[_0x8044('0x2d')]=_[_0x8044('0x2f')](db[_0x8044('0x29')][_0x8044('0x2a')]);_0x29c55e[_0x8044('0x2e')]=_[_0x8044('0x2f')](_0x31f647[_0x8044('0x2e')]);_0x29c55e[_0x8044('0x30')]=_['intersection'](_0x29c55e[_0x8044('0x2d')],_0x29c55e[_0x8044('0x2e')]);_0x3505c6[_0x8044('0x33')]=_['intersection'](_0x29c55e[_0x8044('0x2d')],qs[_0x8044('0x32')](_0x31f647['query'][_0x8044('0x32')]));_0x3505c6[_0x8044('0x33')]=_0x3505c6[_0x8044('0x33')]['length']?_0x3505c6[_0x8044('0x33')]:_0x29c55e['model'];if(_0x31f647[_0x8044('0x2e')][_0x8044('0x3e')]){_0x3505c6['include']=[{'all':!![]}];}_0x3505c6=_[_0x8044('0x3b')]({},_0x3505c6,_0x31f647[_0x8044('0x3d')]);return db[_0x8044('0x29')]['find'](_0x3505c6)[_0x8044('0x21')](handleEntityNotFound(_0x269d8f,null))['then'](respondWithResult(_0x269d8f,null))['catch'](handleError(_0x269d8f,null));};exports[_0x8044('0x43')]=function(_0x549e0f,_0x43cb56){return db[_0x8044('0x29')]['create'](_0x549e0f[_0x8044('0x44')],{})['then'](function(_0x3ad9dd){var _0x21748a=_0x549e0f[_0x8044('0x45')]['get']({'plain':!![]});if(!_0x21748a)throw new Error(_0x8044('0x46'));if(_0x21748a['role']===_0x8044('0x45')){var _0xfca89=_0x3ad9dd[_0x8044('0x47')]({'plain':!![]});var _0x186b8d='Lists';return db[_0x8044('0x48')][_0x8044('0x49')]({'where':{'name':_0x186b8d,'userProfileId':_0x21748a[_0x8044('0x4a')]},'raw':!![]})[_0x8044('0x21')](function(_0xb61f5d){if(_0xb61f5d&&_0xb61f5d[_0x8044('0x4b')]===0x0){return db[_0x8044('0x4c')][_0x8044('0x43')]({'name':_0xfca89[_0x8044('0x25')],'resourceId':_0xfca89['id'],'type':_0xb61f5d[_0x8044('0x25')],'sectionId':_0xb61f5d['id']},{})['then'](function(){return _0x3ad9dd;});}else{return _0x3ad9dd;}})[_0x8044('0x42')](function(_0x34bc25){logger[_0x8044('0x4d')](_0x8044('0x4e'),_0x34bc25);throw _0x34bc25;});}return _0x3ad9dd;})[_0x8044('0x21')](respondWithResult(_0x43cb56,0xc9))[_0x8044('0x42')](handleError(_0x43cb56,null));};exports[_0x8044('0x4f')]=function(_0x476097,_0x30a846){if(_0x476097[_0x8044('0x44')]['id']){delete _0x476097[_0x8044('0x44')]['id'];}return db[_0x8044('0x29')][_0x8044('0x49')]({'where':{'id':_0x476097[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x30a846,null))[_0x8044('0x21')](saveUpdates(_0x476097[_0x8044('0x44')],null))[_0x8044('0x21')](respondWithResult(_0x30a846,null))['catch'](handleError(_0x30a846,null));};exports[_0x8044('0x23')]=function(_0x1c8a8d,_0x4cd1db){return db['CmList'][_0x8044('0x49')]({'where':{'id':_0x1c8a8d[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x4cd1db,null))['then'](removeEntity(_0x4cd1db,null))[_0x8044('0x42')](handleError(_0x4cd1db,null));};exports[_0x8044('0x51')]=function(_0xbb3e22,_0xd3bc9c){return db[_0x8044('0x29')][_0x8044('0x51')]()[_0x8044('0x21')](respondWithResult(_0xd3bc9c,null))[_0x8044('0x42')](handleError(_0xd3bc9c,null));};exports[_0x8044('0x52')]=function(_0x303f00,_0x33f7b4,_0x22decd){if(_0x303f00[_0x8044('0x44')]['id']){delete _0x303f00[_0x8044('0x44')]['id'];}return db[_0x8044('0x29')][_0x8044('0x49')]({'where':{'id':_0x303f00[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x33f7b4,null))[_0x8044('0x21')](function(_0x8442ce){if(_0x8442ce){_0x303f00['body'][_0x8044('0x53')]=_0x8442ce['id'];return db['Disposition'][_0x8044('0x43')](_0x303f00['body']);}})[_0x8044('0x21')](respondWithResult(_0x33f7b4,null))[_0x8044('0x42')](handleError(_0x33f7b4,null));};exports[_0x8044('0x54')]=function(_0x11a559,_0x202ebc,_0x17cae4){var _0x2c466a={'raw':![],'where':{}};var _0x36535a={};var _0x24b6a4={'count':0x0,'rows':[]};return db[_0x8044('0x29')]['findOne']({'where':{'id':_0x11a559[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x202ebc,null))[_0x8044('0x21')](function(_0x294caa){if(_0x294caa){_0x36535a[_0x8044('0x2d')]=_[_0x8044('0x2f')](db[_0x8044('0x55')][_0x8044('0x2a')]);_0x36535a[_0x8044('0x2e')]=_[_0x8044('0x2f')](_0x11a559['query']);_0x36535a[_0x8044('0x30')]=_['intersection'](_0x36535a[_0x8044('0x2d')],_0x36535a['query']);_0x2c466a[_0x8044('0x33')]=_[_0x8044('0x31')](_0x36535a['model'],qs[_0x8044('0x32')](_0x11a559[_0x8044('0x2e')][_0x8044('0x32')]));_0x2c466a[_0x8044('0x33')]=_0x2c466a['attributes'][_0x8044('0x56')]?_0x2c466a['attributes']:_0x36535a[_0x8044('0x2d')];if(!_0x11a559[_0x8044('0x2e')][_0x8044('0x34')](_0x8044('0x35'))){_0x2c466a['limit']=qs['limit'](_0x11a559[_0x8044('0x2e')]['limit']);_0x2c466a[_0x8044('0x1c')]=qs[_0x8044('0x1c')](_0x11a559[_0x8044('0x2e')][_0x8044('0x1c')]);}_0x2c466a[_0x8044('0x36')]=qs[_0x8044('0x37')](_0x11a559[_0x8044('0x2e')][_0x8044('0x37')]);_0x2c466a['where']=qs[_0x8044('0x30')](_['pick'](_0x11a559['query'],_0x36535a['filters']));_0x2c466a[_0x8044('0x3a')][_0x8044('0x53')]=_0x294caa['id'];if(_0x11a559[_0x8044('0x2e')]['filter']){_0x2c466a[_0x8044('0x3a')]=_[_0x8044('0x3b')](_0x2c466a[_0x8044('0x3a')],{'$or':_['map'](_0x2c466a[_0x8044('0x33')],function(_0x37ee07){var _0x8f8807={};_0x8f8807[_0x37ee07]={'$like':'%'+_0x11a559['query'][_0x8044('0x39')]+'%'};return _0x8f8807;})});}_0x2c466a=_[_0x8044('0x3b')]({},_0x2c466a,_0x11a559[_0x8044('0x3d')]);return db[_0x8044('0x55')][_0x8044('0x1e')]({'where':_0x2c466a[_0x8044('0x3a')]})[_0x8044('0x21')](function(_0x821553){_0x24b6a4[_0x8044('0x1e')]=_0x821553;if(_0x11a559['query'][_0x8044('0x3e')]){_0x2c466a['include']=[{'all':!![]}];}return db['Disposition'][_0x8044('0x40')](_0x2c466a);})['then'](function(_0x4f80ea){_0x24b6a4[_0x8044('0x41')]=_0x4f80ea;return _0x24b6a4;});}})[_0x8044('0x21')](respondWithFilteredResult(_0x202ebc,_0x2c466a))[_0x8044('0x42')](handleError(_0x202ebc,null));};exports[_0x8044('0x57')]=function(_0x2bd2c0,_0x4c1b1b,_0x175d7c){return db[_0x8044('0x29')][_0x8044('0x49')]({'where':{'id':_0x2bd2c0[_0x8044('0x50')]['id']}})['then'](handleEntityNotFound(_0x4c1b1b,null))[_0x8044('0x21')](function(_0x10a513){if(_0x10a513){return _0x10a513[_0x8044('0x57')](_0x2bd2c0['query'][_0x8044('0x58')]);}})[_0x8044('0x21')](respondWithStatusCode(_0x4c1b1b,null))[_0x8044('0x42')](handleError(_0x4c1b1b,null));};exports[_0x8044('0x59')]=function(_0x1e4efa,_0x3e168d,_0x2456a1){return db[_0x8044('0x29')][_0x8044('0x49')]({'where':{'id':_0x1e4efa[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x3e168d,null))[_0x8044('0x21')](function(_0x17d8f4){if(_0x17d8f4){var _0x5cb1cf=[];var _0x177062={'success':[],'errors':[]};return db['CmContact'][_0x8044('0x51')]()[_0x8044('0x21')](function(_0x52ae08){if(_0x1e4efa[_0x8044('0x44')]['tags']&&_[_0x8044('0x5a')](_0x1e4efa['body'][_0x8044('0x5b')])){if(_0x1e4efa[_0x8044('0x44')]['tags']['length']){_0x1e4efa[_0x8044('0x44')][_0x8044('0x5b')]=_0x1e4efa[_0x8044('0x44')][_0x8044('0x5b')][_0x8044('0x5c')](';')+';';}else{_0x1e4efa['body']['tags']=null;}}else{_0x1e4efa[_0x8044('0x44')][_0x8044('0x5b')]=null;}if(_0x1e4efa[_0x8044('0x44')]&&_['isArray'](_0x1e4efa['body'])){for(var _0x8c0b45=0x0;_0x8c0b45<_0x1e4efa[_0x8044('0x44')][_0x8044('0x56')];_0x8c0b45+=0x1){_0x1e4efa['body'][_0x8c0b45][_0x8044('0x53')]=_0x1e4efa[_0x8044('0x50')]['id'];_0x5cb1cf['push'](_0x1e4efa[_0x8044('0x44')][_0x8c0b45]);}return BPromise['each'](_0x5cb1cf,function(_0x187843){return db[_0x8044('0x5d')]['create'](_['omit'](_0x187843,[_0x8044('0x58'),'id'])||{},{'fields':_[_0x8044('0x2f')](_0x52ae08),'raw':!![]})[_0x8044('0x21')](function(_0x56ac42){_0x177062[_0x8044('0x5e')][_0x8044('0x5f')](_0x56ac42[_0x8044('0x60')]);})[_0x8044('0x42')](function(_0x1ff503){_0x177062['errors'][_0x8044('0x5f')]({'data':_0x187843,'error':_0x1ff503[_0x8044('0x61')]});});})['then'](function(_0x2f9974){return _0x177062;})[_0x8044('0x42')](function(_0x49c664){return _0x49c664;});}else{_0x3e168d[_0x8044('0x1a')](0x190)[_0x8044('0x62')]({'message':_0x8044('0x63')});}});}})[_0x8044('0x21')](respondWithResult(_0x3e168d,null))['catch'](handleError(_0x3e168d,null));};exports['getContacts']=function(_0x3ae6c7,_0x45a070,_0xcda78c){var _0x27b176;return db[_0x8044('0x29')][_0x8044('0x49')]({'where':{'id':_0x3ae6c7[_0x8044('0x50')]['id']},'include':[{'model':db[_0x8044('0x64')],'as':'CustomFields'}]})[_0x8044('0x21')](handleEntityNotFound(_0x45a070,null))[_0x8044('0x21')](function(_0x287238){if(_0x287238){_0x27b176=_0x287238;return db[_0x8044('0x5d')][_0x8044('0x2a')];}})[_0x8044('0x21')](function(_0x11da28){if(_0x11da28){var _0x3de286={};var _0x408bbc={};_0x408bbc[_0x8044('0x2d')]=_['concat'](_['keys'](_0x11da28),_[_0x8044('0x28')](_0x27b176['CustomFields'],function(_0x1f8f83){return util[_0x8044('0x65')]('cf_%d',_0x1f8f83['id']);}));_0x408bbc[_0x8044('0x2e')]=_['keys'](_0x3ae6c7['query']);_0x408bbc[_0x8044('0x30')]=_[_0x8044('0x31')](_0x408bbc[_0x8044('0x2d')],_0x408bbc[_0x8044('0x2e')]);_0x3de286[_0x8044('0x33')]=_[_0x8044('0x31')](_0x408bbc[_0x8044('0x2d')],qs[_0x8044('0x32')](_0x3ae6c7[_0x8044('0x2e')][_0x8044('0x32')]));_0x3de286[_0x8044('0x33')]=_0x3de286[_0x8044('0x33')]['length']?_0x3de286[_0x8044('0x33')]:_0x408bbc[_0x8044('0x2d')];if(!_0x3ae6c7[_0x8044('0x2e')][_0x8044('0x34')](_0x8044('0x35'))){_0x3de286['limit']=qs[_0x8044('0x1d')](_0x3ae6c7[_0x8044('0x2e')][_0x8044('0x1d')]);_0x3de286[_0x8044('0x1c')]=qs[_0x8044('0x1c')](_0x3ae6c7['query']['offset']);}_0x3de286[_0x8044('0x36')]=qs[_0x8044('0x37')](_0x3ae6c7['query']['sort']);_0x3de286[_0x8044('0x3a')]=qs['filters'](_['pick'](_0x3ae6c7[_0x8044('0x2e')],_0x408bbc[_0x8044('0x30')]));_0x3de286[_0x8044('0x66')]=!![];if(_0x3ae6c7[_0x8044('0x2e')][_0x8044('0x39')]){_0x3de286[_0x8044('0x3a')]=_[_0x8044('0x3b')](_0x3de286['where'],{'$or':_['map'](_0x3de286[_0x8044('0x33')],function(_0x56d27b){var _0xac09b3={};_0xac09b3[_0x56d27b]={'$like':'%'+_0x3ae6c7[_0x8044('0x2e')][_0x8044('0x39')]+'%'};return _0xac09b3;})});}_0x3de286=_[_0x8044('0x3b')]({},_0x3de286,_0x3ae6c7[_0x8044('0x3d')]);return _0x27b176[_0x8044('0x67')](_0x3de286);}})[_0x8044('0x21')](respondWithResult(_0x45a070,null))[_0x8044('0x42')](handleError(_0x45a070,null));};exports['getContactsCsv']=function(_0x9218f5,_0x4bdb35,_0x521034){var _0x313868;var _0x2c5002;var _0x3d4f74;var _0x174855=_0x9218f5[_0x8044('0x50')]['id'];csv_results=[];return db['ContactItemType'][_0x8044('0x40')]({'attributes':['id',_0x8044('0x25')],'raw':!![],'order':[_0x8044('0x68')]})['then'](function(_0x3685db){_0x313868=_0x3685db;var _0x52bc4e=_[_0x8044('0x2f')](db[_0x8044('0x5d')]['rawAttributes']);return db[_0x8044('0x64')]['findAll']({'raw':!![],'attributes':['id',_0x8044('0x69')]})[_0x8044('0x21')](function(_0x104841){_0x2c5002=_0x104841;var _0x315354=squel[_0x8044('0x6a')]()[_0x8044('0x32')](_0x52bc4e)[_0x8044('0x6b')](_0x8044('0x6c'),'c')[_0x8044('0x3a')]('c.ListId\x20=\x20?',_0x174855)[_0x8044('0x3a')](_0x8044('0x6d'))[_0x8044('0x6e')]();for(var _0xe1e1e5=0x0;_0xe1e1e5<_0x2c5002[_0x8044('0x56')];_0xe1e1e5++){_0x315354[_0x8044('0x6f')]('c.cf_'+_0x2c5002[_0xe1e1e5]['id'],_0x8044('0x70')+_0x2c5002[_0xe1e1e5][_0x8044('0x69')]);}for(var _0xe1e1e5=0x0;_0xe1e1e5<_0x313868['length'];_0xe1e1e5++){_0x315354[_0x8044('0x6f')](squel[_0x8044('0x6a')]()['field'](_0x8044('0x71'))[_0x8044('0x6b')](_0x8044('0x72'))[_0x8044('0x3a')](_0x8044('0x73'),_0x313868[_0xe1e1e5]['id'])[_0x8044('0x3a')](_0x8044('0x74')),_0x8044('0x75')+_0x313868[_0xe1e1e5][_0x8044('0x25')]);_0x315354[_0x8044('0x6f')](squel[_0x8044('0x6a')]()[_0x8044('0x6f')](_0x8044('0x76'))[_0x8044('0x6b')](_0x8044('0x72'))[_0x8044('0x3a')](_0x8044('0x73'),_0x313868[_0xe1e1e5]['id'])[_0x8044('0x3a')](_0x8044('0x74')),_0x8044('0x77')+_0x313868[_0xe1e1e5][_0x8044('0x25')]);}var _0x1ea020=[];_0x1ea020[_0x8044('0x5f')](_0x315354[_0x8044('0x78')]());BPromise[_0x8044('0x79')](_0x1ea020,handleQuery)[_0x8044('0x21')](function(_0x617ac4){handleQuery(_0x315354[_0x8044('0x78')]());var _0x37781e=csv_results[0x0];if(!_[_0x8044('0x7a')](_0x37781e)){var _0x230ebc=toCsv(_0x37781e);var _0xcb7677=Date[_0x8044('0x7b')]();fs[_0x8044('0x7c')](util[_0x8044('0x65')]('/tmp/list_%d_%s.csv',_0x174855,_0xcb7677),_0x230ebc);_0x4bdb35[_0x8044('0x7d')](_0x8044('0x7e'),_0x8044('0x7f')+util[_0x8044('0x65')](_0x8044('0x80'),_0x174855,_0xcb7677));_0x4bdb35[_0x8044('0x7d')](_0x8044('0x81'),_0x8044('0x82'));return _0x4bdb35[_0x8044('0x83')](util[_0x8044('0x65')](_0x8044('0x84'),_0x174855,_0xcb7677));}else{return _0x4bdb35['sendStatus'](0xcc);}});});});};exports[_0x8044('0x85')]=function(_0x478f08,_0x4de55f,_0xf0dffb){var _0x5e5b29;delete _0x478f08['body']['id'];return db[_0x8044('0x29')]['findOne']({'where':{'id':_0x478f08[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x4de55f,null))[_0x8044('0x21')](function(_0xa5a483){if(_0xa5a483){return db[_0x8044('0x86')][_0x8044('0x87')](function(_0x5a2bc9){return db[_0x8044('0x64')][_0x8044('0x43')](_0x478f08[_0x8044('0x44')],{'transaction':_0x5a2bc9})[_0x8044('0x21')](function(_0x4ac0b8){_0x5e5b29=_0x4ac0b8;return _0xa5a483['addCustomFields'](_0x4ac0b8,{'transaction':_0x5a2bc9});})['then'](function(){var _0x2daa75={'type':db['Sequelize']['TEXT'],'transaction':_0x5a2bc9};switch(_0x478f08[_0x8044('0x44')][_0x8044('0x88')]){case _0x8044('0x89'):_0x2daa75[_0x8044('0x88')]=db[_0x8044('0x8a')][_0x8044('0x8b')];break;case _0x8044('0x8c'):_0x2daa75['type']=db[_0x8044('0x8a')][_0x8044('0x8d')];break;case _0x8044('0x8e'):_0x2daa75[_0x8044('0x88')]=db['Sequelize']['BOOLEAN'];_0x2daa75['defaultValue']=![];break;default:}return db[_0x8044('0x86')][_0x8044('0x8f')][_0x8044('0x90')](_0x8044('0x6c'),util[_0x8044('0x65')](_0x8044('0x91'),_0x5e5b29['id']),_0x2daa75);})['then'](function(){return _0x5e5b29;});});}})[_0x8044('0x21')](respondWithResult(_0x4de55f,null))[_0x8044('0x42')](handleError(_0x4de55f,null));};exports[_0x8044('0x92')]=function(_0xbc9528,_0x4d39ad,_0x3741ae){var _0x1ed624={};var _0x997e3e={};var _0xf7babd;var _0x4eb8dd;return db[_0x8044('0x29')][_0x8044('0x93')]({'where':{'id':_0xbc9528[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x4d39ad,null))[_0x8044('0x21')](function(_0x1281e2){if(_0x1281e2){_0xf7babd=_0x1281e2;_0x997e3e['model']=_['keys'](db[_0x8044('0x64')]['rawAttributes']);_0x997e3e['query']=_[_0x8044('0x2f')](_0xbc9528[_0x8044('0x2e')]);_0x997e3e[_0x8044('0x30')]=_[_0x8044('0x31')](_0x997e3e[_0x8044('0x2d')],_0x997e3e[_0x8044('0x2e')]);_0x1ed624[_0x8044('0x33')]=_[_0x8044('0x31')](_0x997e3e[_0x8044('0x2d')],qs['fields'](_0xbc9528['query'][_0x8044('0x32')]));_0x1ed624[_0x8044('0x33')]=_0x1ed624['attributes'][_0x8044('0x56')]?_0x1ed624[_0x8044('0x33')]:_0x997e3e[_0x8044('0x2d')];_0x1ed624[_0x8044('0x36')]=qs[_0x8044('0x37')](_0xbc9528[_0x8044('0x2e')][_0x8044('0x37')]);_0x1ed624['where']=qs[_0x8044('0x30')](_[_0x8044('0x38')](_0xbc9528[_0x8044('0x2e')],_0x997e3e[_0x8044('0x30')]));_0x1ed624['where']=_[_0x8044('0x3b')](_0x1ed624[_0x8044('0x3a')],{'$or':[{'ListId':_0x1281e2['id']},{'ListId':null}]});if(_0xbc9528[_0x8044('0x2e')][_0x8044('0x39')]){_0x1ed624['where']=_[_0x8044('0x3b')](_0x1ed624[_0x8044('0x3a')],{'$or':_[_0x8044('0x28')](_0x1ed624[_0x8044('0x33')],function(_0x9a0e2b){var _0x1d9ecd={};_0x1d9ecd[_0x9a0e2b]={'$like':'%'+_0xbc9528[_0x8044('0x2e')]['filter']+'%'};return _0x1d9ecd;})});}_0x1ed624=_[_0x8044('0x3b')]({},_0x1ed624,_0xbc9528['options']);return db[_0x8044('0x64')][_0x8044('0x94')](_0x1ed624);}})[_0x8044('0x21')](respondWithResult(_0x4d39ad,null))[_0x8044('0x42')](handleError(_0x4d39ad,null));};exports[_0x8044('0x95')]=function(_0x912ef,_0x4dcd93){return db[_0x8044('0x64')][_0x8044('0x94')]({'where':{'ListId':null}})[_0x8044('0x21')](handleEntityNotFound(_0x4dcd93,null))[_0x8044('0x21')](function(_0x50a920){return _0x50a920;})['then'](respondWithResult(_0x4dcd93,null))['catch'](handleError(_0x4dcd93,null));};exports[_0x8044('0x96')]=function(_0x25a351,_0x2a6eb6,_0x468b38){return db['CmList'][_0x8044('0x49')]({'where':{'id':_0x25a351['params']['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x2a6eb6,null))['then'](function(_0x32f76e){if(_0x32f76e){return _0x32f76e['addAgents'](_0x25a351[_0x8044('0x44')][_0x8044('0x58')],_[_0x8044('0x97')](_0x25a351[_0x8044('0x44')],[_0x8044('0x58'),'id'])||{})[_0x8044('0x98')](function(_0xae426b){for(var _0x18293a=0x0;_0x18293a<_0x25a351['body'][_0x8044('0x58')]['length'];_0x18293a+=0x1){socket[_0x8044('0x99')](_0x8044('0x9a'),{'UserId':Number(_0x25a351[_0x8044('0x44')][_0x8044('0x58')][_0x18293a]),'CmListId':Number(_0x25a351[_0x8044('0x50')]['id'])});}return _0xae426b;});}})[_0x8044('0x21')](respondWithResult(_0x2a6eb6,null))['catch'](handleError(_0x2a6eb6,null));};exports['removeAgents']=function(_0x4be123,_0x13e18b,_0x2bd7c2){return db[_0x8044('0x29')]['find']({'where':{'id':_0x4be123[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x13e18b,null))[_0x8044('0x21')](function(_0x4b82bb){if(_0x4b82bb){return _0x4b82bb[_0x8044('0x9b')](_0x4be123[_0x8044('0x2e')][_0x8044('0x58')])[_0x8044('0x21')](function(){if(_['isArray'](_0x4be123['query'][_0x8044('0x58')])){for(var _0x259af6=0x0;_0x259af6<_0x4be123[_0x8044('0x2e')][_0x8044('0x58')][_0x8044('0x56')];_0x259af6+=0x1){socket[_0x8044('0x99')](_0x8044('0x9c'),{'UserId':Number(_0x4be123[_0x8044('0x2e')]['ids'][_0x259af6]),'CmListId':Number(_0x4be123[_0x8044('0x50')]['id'])});}}else{socket[_0x8044('0x99')](_0x8044('0x9c'),{'UserId':Number(_0x4be123['query']['ids']),'CmListId':Number(_0x4be123[_0x8044('0x50')]['id'])});}});}})[_0x8044('0x21')](respondWithStatusCode(_0x13e18b,null))[_0x8044('0x42')](handleError(_0x13e18b,null));};exports['getAgents']=function(_0x5d17d6,_0x127ec3,_0x1ab6e1){var _0x38ff9f={};var _0x18f4df={};var _0x5cc694;var _0x48d9da;return db[_0x8044('0x29')][_0x8044('0x93')]({'where':{'id':_0x5d17d6[_0x8044('0x50')]['id']}})[_0x8044('0x21')](handleEntityNotFound(_0x127ec3,null))[_0x8044('0x21')](function(_0x5c6cfb){if(_0x5c6cfb){_0x5cc694=_0x5c6cfb;_0x18f4df[_0x8044('0x2d')]=_['keys'](db[_0x8044('0x9d')][_0x8044('0x2a')]);_0x18f4df[_0x8044('0x2e')]=_[_0x8044('0x2f')](_0x5d17d6[_0x8044('0x2e')]);_0x18f4df['filters']=_[_0x8044('0x31')](_0x18f4df['model'],_0x18f4df['query']);_0x38ff9f['attributes']=_[_0x8044('0x31')](_0x18f4df[_0x8044('0x2d')],qs['fields'](_0x5d17d6[_0x8044('0x2e')][_0x8044('0x32')]));_0x38ff9f[_0x8044('0x33')]=_0x38ff9f[_0x8044('0x33')][_0x8044('0x56')]?_0x38ff9f[_0x8044('0x33')]:_0x18f4df[_0x8044('0x2d')];_0x38ff9f['order']=qs['sort'](_0x5d17d6[_0x8044('0x2e')][_0x8044('0x37')]);_0x38ff9f[_0x8044('0x3a')]=qs['filters'](_[_0x8044('0x38')](_0x5d17d6[_0x8044('0x2e')],_0x18f4df[_0x8044('0x30')]));if(_0x5d17d6['query'][_0x8044('0x39')]){_0x38ff9f[_0x8044('0x3a')]=_[_0x8044('0x3b')](_0x38ff9f[_0x8044('0x3a')],{'$or':_[_0x8044('0x28')](_0x38ff9f[_0x8044('0x33')],function(_0x47dac1){var _0x24cb71={};_0x24cb71[_0x47dac1]={'$like':'%'+_0x5d17d6[_0x8044('0x2e')][_0x8044('0x39')]+'%'};return _0x24cb71;})});}_0x38ff9f=_['merge']({},_0x38ff9f,_0x5d17d6[_0x8044('0x3d')]);return _0x5cc694['getAgents'](_0x38ff9f);}})[_0x8044('0x21')](function(_0x13b30d){if(_0x13b30d){_0x48d9da=_0x13b30d['length'];if(!_0x5d17d6[_0x8044('0x2e')]['hasOwnProperty'](_0x8044('0x35'))){_0x38ff9f['limit']=qs[_0x8044('0x1d')](_0x5d17d6[_0x8044('0x2e')][_0x8044('0x1d')]);_0x38ff9f[_0x8044('0x1c')]=qs['offset'](_0x5d17d6[_0x8044('0x2e')][_0x8044('0x1c')]);}return _0x5cc694['getAgents'](_0x38ff9f);}})['then'](function(_0x2e2a8c){if(_0x2e2a8c){return _0x2e2a8c?{'count':_0x48d9da,'rows':_0x2e2a8c}:null;}})[_0x8044('0x21')](respondWithResult(_0x127ec3,null))[_0x8044('0x42')](handleError(_0x127ec3,null));};function handleQuery(_0x1dd8ef){logger[_0x8044('0x9e')](_0x1dd8ef);return db[_0x8044('0x86')][_0x8044('0x2e')](_0x1dd8ef)[_0x8044('0x98')](function(_0x3d0051){csv_results[_0x8044('0x5f')](_0x3d0051);})[_0x8044('0x42')](function(_0x4f32f2){logger[_0x8044('0x4d')](_0x4f32f2[_0x8044('0x61')]);});} \ No newline at end of file +var _0x8872=['sendStatus','error','name','send','index','CmList','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','nolimit','order','removeDispositions','addContacts','CmContact','isArray','tags','ListId','push','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','format','cf_%d','pick','raw','getContactsCsv','OrderBy','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','select','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','ids','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','spread','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Lists','UserProfileResource','end'];(function(_0x445202,_0x3566a1){var _0x5379a1=function(_0x38800f){while(--_0x38800f){_0x445202['push'](_0x445202['shift']());}};_0x5379a1(++_0x3566a1);}(_0x8872,0x117));var _0x2887=function(_0x569c3f,_0x454321){_0x569c3f=_0x569c3f-0x0;var _0x48909c=_0x8872[_0x569c3f];return _0x48909c;};'use strict';var emlformat=require(_0x2887('0x0'));var rimraf=require(_0x2887('0x1'));var zipdir=require(_0x2887('0x2'));var jsonpatch=require(_0x2887('0x3'));var rp=require(_0x2887('0x4'));var moment=require(_0x2887('0x5'));var BPromise=require(_0x2887('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2887('0x7'));var sox=require(_0x2887('0x8'));var csv=require(_0x2887('0x9'));var ejs=require(_0x2887('0xa'));var fs=require('fs');var fs_extra=require(_0x2887('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2887('0xc'));var deskjs=require(_0x2887('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2887('0xe'));var Redis=require(_0x2887('0xf'));var authService=require(_0x2887('0x10'));var qs=require(_0x2887('0x11'));var as=require(_0x2887('0x12'));var hardwareService=require(_0x2887('0x13'));var logger=require(_0x2887('0x14'))(_0x2887('0x15'));var utils=require('../../config/utils');var config=require(_0x2887('0x16'));var licenseUtil=require(_0x2887('0x17'));var db=require(_0x2887('0x18'))['db'];var csv_results;config[_0x2887('0x19')]=_[_0x2887('0x1a')](config[_0x2887('0x19')],{'host':_0x2887('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2887('0x1c'))[_0x2887('0x1d')](socket);function respondWithStatusCode(_0x575b77,_0xe04837){_0xe04837=_0xe04837||0xcc;return function(_0x1f5c76){if(_0x1f5c76){return _0x575b77['sendStatus'](_0xe04837);}return _0x575b77[_0x2887('0x1e')](_0xe04837)['end']();};}function respondWithResult(_0x3dbc7b,_0x2b049e){_0x2b049e=_0x2b049e||0xc8;return function(_0x1220ca){if(_0x1220ca){return _0x3dbc7b[_0x2887('0x1e')](_0x2b049e)[_0x2887('0x1f')](_0x1220ca);}};}function respondWithFilteredResult(_0x4c0999,_0x33f2f2){return function(_0x3a1e66){if(_0x3a1e66){var _0x36ccb5=typeof _0x33f2f2[_0x2887('0x20')]===_0x2887('0x21')&&typeof _0x33f2f2[_0x2887('0x22')]===_0x2887('0x21');var _0x3dc037=_0x3a1e66[_0x2887('0x23')];var _0x5c9153=_0x36ccb5?0x0:_0x33f2f2['offset'];var _0x91c879=_0x36ccb5?_0x3a1e66['count']:_0x33f2f2[_0x2887('0x20')]+_0x33f2f2[_0x2887('0x22')];var _0x247ec7;if(_0x91c879>=_0x3dc037){_0x91c879=_0x3dc037;_0x247ec7=0xc8;}else{_0x247ec7=0xce;}_0x4c0999[_0x2887('0x1e')](_0x247ec7);return _0x4c0999[_0x2887('0x24')](_0x2887('0x25'),_0x5c9153+'-'+_0x91c879+'/'+_0x3dc037)[_0x2887('0x1f')](_0x3a1e66);}return null;};}function patchUpdates(_0x3657d4){return function(_0x566c5b){try{jsonpatch[_0x2887('0x26')](_0x566c5b,_0x3657d4,!![]);}catch(_0x52e92a){return BPromise['reject'](_0x52e92a);}return _0x566c5b[_0x2887('0x27')]();};}function saveUpdates(_0x5c84f6,_0x1c5253){return function(_0xe3d3fa){if(_0xe3d3fa){return _0xe3d3fa[_0x2887('0x28')](_0x5c84f6)['then'](function(_0x4f3e25){return _0x4f3e25;});}return null;};}function removeEntity(_0x509200,_0x1825f5){return function(_0x47e48e){if(_0x47e48e){return _0x47e48e[_0x2887('0x29')]()[_0x2887('0x2a')](function(){var _0x604b32=_0x47e48e[_0x2887('0x2b')]({'plain':!![]});var _0x1d81eb=_0x2887('0x2c');return db[_0x2887('0x2d')][_0x2887('0x29')]({'where':{'type':_0x1d81eb,'resourceId':_0x604b32['id']}})[_0x2887('0x2a')](function(){return _0x47e48e;});})[_0x2887('0x2a')](function(){_0x509200[_0x2887('0x1e')](0xcc)[_0x2887('0x2e')]();});}};}function handleEntityNotFound(_0x25d2ff,_0x1c66f5){return function(_0x7918c9){if(!_0x7918c9){_0x25d2ff[_0x2887('0x2f')](0x194);}return _0x7918c9;};}function handleError(_0x14ac91,_0x4f7167){_0x4f7167=_0x4f7167||0x1f4;return function(_0x14f8bf){logger[_0x2887('0x30')](_0x14f8bf['stack']);if(_0x14f8bf[_0x2887('0x31')]){delete _0x14f8bf[_0x2887('0x31')];}_0x14ac91[_0x2887('0x1e')](_0x4f7167)[_0x2887('0x32')](_0x14f8bf);};}exports[_0x2887('0x33')]=function(_0x52383b,_0x255af7){var _0x3d459d={},_0x251cce={},_0x3aeaec={'count':0x0,'rows':[]};var _0x5780bf=_['map'](db[_0x2887('0x34')][_0x2887('0x35')],function(_0x55bb95){return{'name':_0x55bb95['fieldName'],'type':_0x55bb95[_0x2887('0x36')]['key']};});_0x251cce[_0x2887('0x37')]=_[_0x2887('0x38')](_0x5780bf,_0x2887('0x31'));_0x251cce[_0x2887('0x39')]=_[_0x2887('0x3a')](_0x52383b[_0x2887('0x39')]);_0x251cce[_0x2887('0x3b')]=_[_0x2887('0x3c')](_0x251cce[_0x2887('0x37')],_0x251cce[_0x2887('0x39')]);_0x3d459d[_0x2887('0x3d')]=_[_0x2887('0x3c')](_0x251cce[_0x2887('0x37')],qs[_0x2887('0x3e')](_0x52383b[_0x2887('0x39')][_0x2887('0x3e')]));_0x3d459d[_0x2887('0x3d')]=_0x3d459d['attributes'][_0x2887('0x3f')]?_0x3d459d[_0x2887('0x3d')]:_0x251cce['model'];if(!_0x52383b[_0x2887('0x39')][_0x2887('0x40')]('nolimit')){_0x3d459d[_0x2887('0x22')]=qs['limit'](_0x52383b['query']['limit']);_0x3d459d[_0x2887('0x20')]=qs[_0x2887('0x20')](_0x52383b[_0x2887('0x39')][_0x2887('0x20')]);}_0x3d459d['order']=qs[_0x2887('0x41')](_0x52383b[_0x2887('0x39')][_0x2887('0x41')]);_0x3d459d['where']=qs[_0x2887('0x3b')](_['pick'](_0x52383b['query'],_0x251cce[_0x2887('0x3b')]),_0x5780bf);if(_0x52383b[_0x2887('0x39')][_0x2887('0x42')]){_0x3d459d[_0x2887('0x43')]=_[_0x2887('0x44')](_0x3d459d[_0x2887('0x43')],{'$or':_['map'](_0x5780bf,function(_0x24ea45){if(_0x24ea45[_0x2887('0x36')]!==_0x2887('0x45')){var _0x4f5e85={};_0x4f5e85[_0x24ea45[_0x2887('0x31')]]={'$like':'%'+_0x52383b[_0x2887('0x39')]['filter']+'%'};return _0x4f5e85;}})});}_0x3d459d=_['merge']({},_0x3d459d,_0x52383b[_0x2887('0x46')]);var _0x2b0278={'where':_0x3d459d['where']};return db[_0x2887('0x34')][_0x2887('0x23')](_0x2b0278)[_0x2887('0x2a')](function(_0x4437f8){_0x3aeaec[_0x2887('0x23')]=_0x4437f8;if(_0x52383b['query']['includeAll']){_0x3d459d[_0x2887('0x47')]=[{'all':!![]}];}return db[_0x2887('0x34')][_0x2887('0x48')](_0x3d459d);})[_0x2887('0x2a')](function(_0x4fd28a){_0x3aeaec[_0x2887('0x49')]=_0x4fd28a;return _0x3aeaec;})[_0x2887('0x2a')](respondWithFilteredResult(_0x255af7,_0x3d459d))[_0x2887('0x4a')](handleError(_0x255af7,null));};exports[_0x2887('0x4b')]=function(_0x315f08,_0x3bf51d){var _0x54ee0b={'raw':![],'where':{'id':_0x315f08[_0x2887('0x4c')]['id']}},_0x137ad1={};_0x137ad1[_0x2887('0x37')]=_[_0x2887('0x3a')](db[_0x2887('0x34')][_0x2887('0x35')]);_0x137ad1[_0x2887('0x39')]=_['keys'](_0x315f08['query']);_0x137ad1[_0x2887('0x3b')]=_[_0x2887('0x3c')](_0x137ad1[_0x2887('0x37')],_0x137ad1[_0x2887('0x39')]);_0x54ee0b[_0x2887('0x3d')]=_[_0x2887('0x3c')](_0x137ad1[_0x2887('0x37')],qs[_0x2887('0x3e')](_0x315f08[_0x2887('0x39')][_0x2887('0x3e')]));_0x54ee0b[_0x2887('0x3d')]=_0x54ee0b[_0x2887('0x3d')][_0x2887('0x3f')]?_0x54ee0b[_0x2887('0x3d')]:_0x137ad1[_0x2887('0x37')];if(_0x315f08[_0x2887('0x39')][_0x2887('0x4d')]){_0x54ee0b[_0x2887('0x47')]=[{'all':!![]}];}_0x54ee0b=_[_0x2887('0x44')]({},_0x54ee0b,_0x315f08[_0x2887('0x46')]);return db['CmList'][_0x2887('0x4e')](_0x54ee0b)[_0x2887('0x2a')](handleEntityNotFound(_0x3bf51d,null))[_0x2887('0x2a')](respondWithResult(_0x3bf51d,null))[_0x2887('0x4a')](handleError(_0x3bf51d,null));};exports[_0x2887('0x4f')]=function(_0x336b6c,_0x37f317){return db[_0x2887('0x34')][_0x2887('0x4f')](_0x336b6c[_0x2887('0x50')],{})['then'](function(_0x2f2669){var _0x538d9b=_0x336b6c[_0x2887('0x51')][_0x2887('0x2b')]({'plain':!![]});if(!_0x538d9b)throw new Error(_0x2887('0x52'));if(_0x538d9b[_0x2887('0x53')]==='user'){var _0x4c2870=_0x2f2669[_0x2887('0x2b')]({'plain':!![]});var _0x3ddb7='Lists';return db['UserProfileSection'][_0x2887('0x4e')]({'where':{'name':_0x3ddb7,'userProfileId':_0x538d9b[_0x2887('0x54')]},'raw':!![]})['then'](function(_0x3ba809){if(_0x3ba809&&_0x3ba809[_0x2887('0x55')]===0x0){return db[_0x2887('0x2d')]['create']({'name':_0x4c2870[_0x2887('0x31')],'resourceId':_0x4c2870['id'],'type':_0x3ba809['name'],'sectionId':_0x3ba809['id']},{})[_0x2887('0x2a')](function(){return _0x2f2669;});}else{return _0x2f2669;}})[_0x2887('0x4a')](function(_0x15e9ac){logger['error'](_0x2887('0x56'),_0x15e9ac);throw _0x15e9ac;});}return _0x2f2669;})[_0x2887('0x2a')](respondWithResult(_0x37f317,0xc9))['catch'](handleError(_0x37f317,null));};exports[_0x2887('0x28')]=function(_0x219a9f,_0x2afb22){if(_0x219a9f[_0x2887('0x50')]['id']){delete _0x219a9f['body']['id'];}return db[_0x2887('0x34')][_0x2887('0x4e')]({'where':{'id':_0x219a9f[_0x2887('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2afb22,null))[_0x2887('0x2a')](saveUpdates(_0x219a9f[_0x2887('0x50')],null))[_0x2887('0x2a')](respondWithResult(_0x2afb22,null))[_0x2887('0x4a')](handleError(_0x2afb22,null));};exports[_0x2887('0x29')]=function(_0x49b4d3,_0x4ce3cc){return db[_0x2887('0x34')][_0x2887('0x4e')]({'where':{'id':_0x49b4d3[_0x2887('0x4c')]['id']}})[_0x2887('0x2a')](handleEntityNotFound(_0x4ce3cc,null))[_0x2887('0x2a')](removeEntity(_0x4ce3cc,null))[_0x2887('0x4a')](handleError(_0x4ce3cc,null));};exports[_0x2887('0x57')]=function(_0x5e9a71,_0x25ee74){return db[_0x2887('0x34')][_0x2887('0x57')]()[_0x2887('0x2a')](respondWithResult(_0x25ee74,null))[_0x2887('0x4a')](handleError(_0x25ee74,null));};exports[_0x2887('0x58')]=function(_0x1a1615,_0x5b6490,_0x2e5caf){if(_0x1a1615[_0x2887('0x50')]['id']){delete _0x1a1615[_0x2887('0x50')]['id'];}return db[_0x2887('0x34')][_0x2887('0x4e')]({'where':{'id':_0x1a1615[_0x2887('0x4c')]['id']}})[_0x2887('0x2a')](handleEntityNotFound(_0x5b6490,null))[_0x2887('0x2a')](function(_0x358896){if(_0x358896){_0x1a1615[_0x2887('0x50')]['ListId']=_0x358896['id'];return db[_0x2887('0x59')][_0x2887('0x4f')](_0x1a1615[_0x2887('0x50')]);}})[_0x2887('0x2a')](respondWithResult(_0x5b6490,null))['catch'](handleError(_0x5b6490,null));};exports['getDispositions']=function(_0x2f71a5,_0x52594e,_0x4ce9f7){var _0x2354e9={'raw':![],'where':{}};var _0x3b6f93={};var _0x24fe63={'count':0x0,'rows':[]};return db['CmList'][_0x2887('0x5a')]({'where':{'id':_0x2f71a5[_0x2887('0x4c')]['id']}})[_0x2887('0x2a')](handleEntityNotFound(_0x52594e,null))['then'](function(_0x3ba8c5){if(_0x3ba8c5){_0x3b6f93['model']=_['keys'](db[_0x2887('0x59')][_0x2887('0x35')]);_0x3b6f93[_0x2887('0x39')]=_['keys'](_0x2f71a5[_0x2887('0x39')]);_0x3b6f93[_0x2887('0x3b')]=_[_0x2887('0x3c')](_0x3b6f93[_0x2887('0x37')],_0x3b6f93[_0x2887('0x39')]);_0x2354e9[_0x2887('0x3d')]=_[_0x2887('0x3c')](_0x3b6f93[_0x2887('0x37')],qs[_0x2887('0x3e')](_0x2f71a5[_0x2887('0x39')]['fields']));_0x2354e9[_0x2887('0x3d')]=_0x2354e9[_0x2887('0x3d')][_0x2887('0x3f')]?_0x2354e9['attributes']:_0x3b6f93[_0x2887('0x37')];if(!_0x2f71a5[_0x2887('0x39')]['hasOwnProperty'](_0x2887('0x5b'))){_0x2354e9[_0x2887('0x22')]=qs[_0x2887('0x22')](_0x2f71a5[_0x2887('0x39')][_0x2887('0x22')]);_0x2354e9[_0x2887('0x20')]=qs[_0x2887('0x20')](_0x2f71a5[_0x2887('0x39')]['offset']);}_0x2354e9[_0x2887('0x5c')]=qs[_0x2887('0x41')](_0x2f71a5[_0x2887('0x39')][_0x2887('0x41')]);_0x2354e9[_0x2887('0x43')]=qs['filters'](_['pick'](_0x2f71a5[_0x2887('0x39')],_0x3b6f93[_0x2887('0x3b')]));_0x2354e9[_0x2887('0x43')]['ListId']=_0x3ba8c5['id'];if(_0x2f71a5['query'][_0x2887('0x42')]){_0x2354e9['where']=_[_0x2887('0x44')](_0x2354e9[_0x2887('0x43')],{'$or':_[_0x2887('0x38')](_0x2354e9[_0x2887('0x3d')],function(_0x59abce){var _0x387390={};_0x387390[_0x59abce]={'$like':'%'+_0x2f71a5[_0x2887('0x39')][_0x2887('0x42')]+'%'};return _0x387390;})});}_0x2354e9=_['merge']({},_0x2354e9,_0x2f71a5['options']);return db[_0x2887('0x59')]['count']({'where':_0x2354e9[_0x2887('0x43')]})[_0x2887('0x2a')](function(_0xef5740){_0x24fe63[_0x2887('0x23')]=_0xef5740;if(_0x2f71a5[_0x2887('0x39')][_0x2887('0x4d')]){_0x2354e9[_0x2887('0x47')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2354e9);})[_0x2887('0x2a')](function(_0x5cc439){_0x24fe63[_0x2887('0x49')]=_0x5cc439;return _0x24fe63;});}})[_0x2887('0x2a')](respondWithFilteredResult(_0x52594e,_0x2354e9))[_0x2887('0x4a')](handleError(_0x52594e,null));};exports[_0x2887('0x5d')]=function(_0xb9eca8,_0x34c119,_0x4eb4d0){return db[_0x2887('0x34')][_0x2887('0x4e')]({'where':{'id':_0xb9eca8['params']['id']}})['then'](handleEntityNotFound(_0x34c119,null))[_0x2887('0x2a')](function(_0x33140d){if(_0x33140d){return _0x33140d[_0x2887('0x5d')](_0xb9eca8[_0x2887('0x39')]['ids']);}})[_0x2887('0x2a')](respondWithStatusCode(_0x34c119,null))['catch'](handleError(_0x34c119,null));};exports[_0x2887('0x5e')]=function(_0x194851,_0x5ea7cc,_0x347fba){return db['CmList'][_0x2887('0x4e')]({'where':{'id':_0x194851[_0x2887('0x4c')]['id']}})[_0x2887('0x2a')](handleEntityNotFound(_0x5ea7cc,null))[_0x2887('0x2a')](function(_0x457483){if(_0x457483){var _0x47c286=[];var _0x5aaf34={'success':[],'errors':[]};return db[_0x2887('0x5f')][_0x2887('0x57')]()[_0x2887('0x2a')](function(_0x1bb6df){if(_0x194851[_0x2887('0x50')]['tags']&&_[_0x2887('0x60')](_0x194851['body'][_0x2887('0x61')])){if(_0x194851[_0x2887('0x50')][_0x2887('0x61')][_0x2887('0x3f')]){_0x194851[_0x2887('0x50')][_0x2887('0x61')]=_0x194851[_0x2887('0x50')][_0x2887('0x61')]['join'](';')+';';}else{_0x194851['body'][_0x2887('0x61')]=null;}}else{_0x194851['body'][_0x2887('0x61')]=null;}if(_0x194851['body']&&_['isArray'](_0x194851['body'])){for(var _0x110b12=0x0;_0x110b12<_0x194851[_0x2887('0x50')][_0x2887('0x3f')];_0x110b12+=0x1){_0x194851[_0x2887('0x50')][_0x110b12][_0x2887('0x62')]=_0x194851[_0x2887('0x4c')]['id'];_0x47c286[_0x2887('0x63')](_0x194851[_0x2887('0x50')][_0x110b12]);}return BPromise['each'](_0x47c286,function(_0x398a6c){return db[_0x2887('0x5f')][_0x2887('0x4f')](_[_0x2887('0x64')](_0x398a6c,['ids','id'])||{},{'fields':_['keys'](_0x1bb6df),'raw':!![]})[_0x2887('0x2a')](function(_0x5627c5){_0x5aaf34[_0x2887('0x65')][_0x2887('0x63')](_0x5627c5[_0x2887('0x66')]);})[_0x2887('0x4a')](function(_0x193e9c){_0x5aaf34[_0x2887('0x67')][_0x2887('0x63')]({'data':_0x398a6c,'error':_0x193e9c[_0x2887('0x68')]});});})['then'](function(_0x4482b3){return _0x5aaf34;})[_0x2887('0x4a')](function(_0x1e209e){return _0x1e209e;});}else{_0x5ea7cc[_0x2887('0x1e')](0x190)['json']({'message':_0x2887('0x69')});}});}})[_0x2887('0x2a')](respondWithResult(_0x5ea7cc,null))[_0x2887('0x4a')](handleError(_0x5ea7cc,null));};exports[_0x2887('0x6a')]=function(_0x38688c,_0x5cfd1f,_0x5c1fcd){var _0x357ba8;return db[_0x2887('0x34')][_0x2887('0x4e')]({'where':{'id':_0x38688c[_0x2887('0x4c')]['id']},'include':[{'model':db[_0x2887('0x6b')],'as':'CustomFields'}]})[_0x2887('0x2a')](handleEntityNotFound(_0x5cfd1f,null))['then'](function(_0x47fc29){if(_0x47fc29){_0x357ba8=_0x47fc29;return db[_0x2887('0x5f')][_0x2887('0x35')];}})[_0x2887('0x2a')](function(_0x3a2e2f){if(_0x3a2e2f){var _0x9d813c={};var _0x40c01b={};_0x40c01b[_0x2887('0x37')]=_[_0x2887('0x6c')](_[_0x2887('0x3a')](_0x3a2e2f),_[_0x2887('0x38')](_0x357ba8['CustomFields'],function(_0x283ba7){return util[_0x2887('0x6d')](_0x2887('0x6e'),_0x283ba7['id']);}));_0x40c01b[_0x2887('0x39')]=_[_0x2887('0x3a')](_0x38688c['query']);_0x40c01b['filters']=_[_0x2887('0x3c')](_0x40c01b[_0x2887('0x37')],_0x40c01b[_0x2887('0x39')]);_0x9d813c[_0x2887('0x3d')]=_[_0x2887('0x3c')](_0x40c01b[_0x2887('0x37')],qs[_0x2887('0x3e')](_0x38688c[_0x2887('0x39')][_0x2887('0x3e')]));_0x9d813c[_0x2887('0x3d')]=_0x9d813c['attributes'][_0x2887('0x3f')]?_0x9d813c['attributes']:_0x40c01b['model'];if(!_0x38688c[_0x2887('0x39')][_0x2887('0x40')](_0x2887('0x5b'))){_0x9d813c[_0x2887('0x22')]=qs[_0x2887('0x22')](_0x38688c['query'][_0x2887('0x22')]);_0x9d813c['offset']=qs[_0x2887('0x20')](_0x38688c['query']['offset']);}_0x9d813c[_0x2887('0x5c')]=qs[_0x2887('0x41')](_0x38688c[_0x2887('0x39')][_0x2887('0x41')]);_0x9d813c[_0x2887('0x43')]=qs[_0x2887('0x3b')](_[_0x2887('0x6f')](_0x38688c[_0x2887('0x39')],_0x40c01b[_0x2887('0x3b')]));_0x9d813c[_0x2887('0x70')]=!![];if(_0x38688c[_0x2887('0x39')][_0x2887('0x42')]){_0x9d813c[_0x2887('0x43')]=_['merge'](_0x9d813c[_0x2887('0x43')],{'$or':_[_0x2887('0x38')](_0x9d813c[_0x2887('0x3d')],function(_0x16d67b){var _0x3da494={};_0x3da494[_0x16d67b]={'$like':'%'+_0x38688c[_0x2887('0x39')][_0x2887('0x42')]+'%'};return _0x3da494;})});}_0x9d813c=_[_0x2887('0x44')]({},_0x9d813c,_0x38688c[_0x2887('0x46')]);return _0x357ba8[_0x2887('0x6a')](_0x9d813c);}})['then'](respondWithResult(_0x5cfd1f,null))[_0x2887('0x4a')](handleError(_0x5cfd1f,null));};exports[_0x2887('0x71')]=function(_0x22f8a3,_0x56f344,_0xbe7319){var _0x22c58e;var _0x171d73;var _0x1d3b56;var _0x2419ca=_0x22f8a3[_0x2887('0x4c')]['id'];csv_results=[];return db['ContactItemType'][_0x2887('0x48')]({'attributes':['id',_0x2887('0x31')],'raw':!![],'order':[_0x2887('0x72')]})[_0x2887('0x2a')](function(_0x5a81ea){_0x22c58e=_0x5a81ea;var _0x118dd2=_[_0x2887('0x3a')](db[_0x2887('0x5f')]['rawAttributes']);return db['CmCustomField'][_0x2887('0x48')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x3930df){_0x171d73=_0x3930df;var _0x531570=squel['select']()[_0x2887('0x3e')](_0x118dd2)[_0x2887('0x73')](_0x2887('0x74'),'c')[_0x2887('0x43')](_0x2887('0x75'),_0x2419ca)[_0x2887('0x43')](_0x2887('0x76'))[_0x2887('0x77')]();for(var _0x86526c=0x0;_0x86526c<_0x171d73[_0x2887('0x3f')];_0x86526c++){_0x531570[_0x2887('0x78')](_0x2887('0x79')+_0x171d73[_0x86526c]['id'],_0x2887('0x7a')+_0x171d73[_0x86526c][_0x2887('0x7b')]);}for(var _0x86526c=0x0;_0x86526c<_0x22c58e[_0x2887('0x3f')];_0x86526c++){_0x531570[_0x2887('0x78')](squel[_0x2887('0x7c')]()['field']('item')[_0x2887('0x73')]('cm_contact_has_items')['where'](_0x2887('0x7d'),_0x22c58e[_0x86526c]['id'])['where'](_0x2887('0x7e')),_0x2887('0x7f')+_0x22c58e[_0x86526c][_0x2887('0x31')]);_0x531570[_0x2887('0x78')](squel[_0x2887('0x7c')]()[_0x2887('0x78')](_0x2887('0x80'))[_0x2887('0x73')]('cm_contact_has_items')[_0x2887('0x43')](_0x2887('0x7d'),_0x22c58e[_0x86526c]['id'])['where'](_0x2887('0x7e')),'description_additionalPhone_'+_0x22c58e[_0x86526c][_0x2887('0x31')]);}var _0x62d309=[];_0x62d309['push'](_0x531570['toString']());BPromise['each'](_0x62d309,handleQuery)['then'](function(_0x4012a2){handleQuery(_0x531570['toString']());var _0x55fa7b=csv_results[0x0];if(!_[_0x2887('0x81')](_0x55fa7b)){var _0x230133=toCsv(_0x55fa7b);var _0x406f62=Date[_0x2887('0x82')]();fs['writeFileSync'](util['format'](_0x2887('0x83'),_0x2419ca,_0x406f62),_0x230133);_0x56f344[_0x2887('0x84')](_0x2887('0x85'),'attachment;\x20filename='+util['format']('list_%d_%s.csv',_0x2419ca,_0x406f62));_0x56f344['setHeader'](_0x2887('0x86'),_0x2887('0x87'));return _0x56f344[_0x2887('0x88')](util[_0x2887('0x6d')](_0x2887('0x83'),_0x2419ca,_0x406f62));}else{return _0x56f344[_0x2887('0x2f')](0xcc);}});});});};exports[_0x2887('0x89')]=function(_0x8d8184,_0x38efaa,_0x13f059){var _0x10faa6;delete _0x8d8184[_0x2887('0x50')]['id'];return db[_0x2887('0x34')][_0x2887('0x5a')]({'where':{'id':_0x8d8184[_0x2887('0x4c')]['id']}})[_0x2887('0x2a')](handleEntityNotFound(_0x38efaa,null))[_0x2887('0x2a')](function(_0x560d27){if(_0x560d27){return db[_0x2887('0x8a')][_0x2887('0x8b')](function(_0x3fa79a){return db['CmCustomField'][_0x2887('0x4f')](_0x8d8184[_0x2887('0x50')],{'transaction':_0x3fa79a})[_0x2887('0x2a')](function(_0x2f3de2){_0x10faa6=_0x2f3de2;return _0x560d27[_0x2887('0x8c')](_0x2f3de2,{'transaction':_0x3fa79a});})[_0x2887('0x2a')](function(){var _0x5016cb={'type':db['Sequelize'][_0x2887('0x8d')],'transaction':_0x3fa79a};switch(_0x8d8184['body'][_0x2887('0x36')]){case _0x2887('0x8e'):_0x5016cb[_0x2887('0x36')]=db[_0x2887('0x8f')][_0x2887('0x8d')];break;case _0x2887('0x90'):_0x5016cb[_0x2887('0x36')]=db[_0x2887('0x8f')][_0x2887('0x91')];break;case'switch':_0x5016cb[_0x2887('0x36')]=db[_0x2887('0x8f')][_0x2887('0x92')];_0x5016cb[_0x2887('0x93')]=![];break;default:}return db['sequelize'][_0x2887('0x94')][_0x2887('0x95')](_0x2887('0x74'),util[_0x2887('0x6d')](_0x2887('0x96'),_0x10faa6['id']),_0x5016cb);})['then'](function(){return _0x10faa6;});});}})[_0x2887('0x2a')](respondWithResult(_0x38efaa,null))[_0x2887('0x4a')](handleError(_0x38efaa,null));};exports[_0x2887('0x97')]=function(_0x5075d0,_0x1e38ab,_0x2aac5c){var _0x4952c3={};var _0x4b9b18={};var _0x2c8945;var _0x9074a4;return db[_0x2887('0x34')][_0x2887('0x5a')]({'where':{'id':_0x5075d0[_0x2887('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e38ab,null))[_0x2887('0x2a')](function(_0x4921f3){if(_0x4921f3){_0x2c8945=_0x4921f3;_0x4b9b18[_0x2887('0x37')]=_[_0x2887('0x3a')](db[_0x2887('0x6b')]['rawAttributes']);_0x4b9b18[_0x2887('0x39')]=_[_0x2887('0x3a')](_0x5075d0[_0x2887('0x39')]);_0x4b9b18[_0x2887('0x3b')]=_[_0x2887('0x3c')](_0x4b9b18['model'],_0x4b9b18[_0x2887('0x39')]);_0x4952c3[_0x2887('0x3d')]=_[_0x2887('0x3c')](_0x4b9b18['model'],qs[_0x2887('0x3e')](_0x5075d0[_0x2887('0x39')][_0x2887('0x3e')]));_0x4952c3[_0x2887('0x3d')]=_0x4952c3[_0x2887('0x3d')][_0x2887('0x3f')]?_0x4952c3[_0x2887('0x3d')]:_0x4b9b18[_0x2887('0x37')];_0x4952c3['order']=qs['sort'](_0x5075d0['query']['sort']);_0x4952c3['where']=qs['filters'](_[_0x2887('0x6f')](_0x5075d0[_0x2887('0x39')],_0x4b9b18[_0x2887('0x3b')]));_0x4952c3['where']=_[_0x2887('0x44')](_0x4952c3[_0x2887('0x43')],{'$or':[{'ListId':_0x4921f3['id']},{'ListId':null}]});if(_0x5075d0['query'][_0x2887('0x42')]){_0x4952c3[_0x2887('0x43')]=_[_0x2887('0x44')](_0x4952c3[_0x2887('0x43')],{'$or':_[_0x2887('0x38')](_0x4952c3[_0x2887('0x3d')],function(_0x53867d){var _0x50bdc2={};_0x50bdc2[_0x53867d]={'$like':'%'+_0x5075d0['query']['filter']+'%'};return _0x50bdc2;})});}_0x4952c3=_[_0x2887('0x44')]({},_0x4952c3,_0x5075d0[_0x2887('0x46')]);return db[_0x2887('0x6b')][_0x2887('0x98')](_0x4952c3);}})['then'](respondWithResult(_0x1e38ab,null))[_0x2887('0x4a')](handleError(_0x1e38ab,null));};exports[_0x2887('0x99')]=function(_0x38e6cf,_0x29e1ca){return db[_0x2887('0x6b')][_0x2887('0x98')]({'where':{'ListId':null}})[_0x2887('0x2a')](handleEntityNotFound(_0x29e1ca,null))[_0x2887('0x2a')](function(_0x4124a7){return _0x4124a7;})[_0x2887('0x2a')](respondWithResult(_0x29e1ca,null))[_0x2887('0x4a')](handleError(_0x29e1ca,null));};exports[_0x2887('0x9a')]=function(_0x50f61a,_0xb90b35,_0x3cd1ff){return db[_0x2887('0x34')][_0x2887('0x4e')]({'where':{'id':_0x50f61a['params']['id']}})[_0x2887('0x2a')](handleEntityNotFound(_0xb90b35,null))[_0x2887('0x2a')](function(_0x367dde){if(_0x367dde){return _0x367dde[_0x2887('0x9a')](_0x50f61a[_0x2887('0x50')][_0x2887('0x9b')],_[_0x2887('0x64')](_0x50f61a['body'],[_0x2887('0x9b'),'id'])||{})['spread'](function(_0x46cc8c){for(var _0x4b291d=0x0;_0x4b291d<_0x50f61a[_0x2887('0x50')]['ids'][_0x2887('0x3f')];_0x4b291d+=0x1){socket[_0x2887('0x9c')](_0x2887('0x9d'),{'UserId':Number(_0x50f61a[_0x2887('0x50')][_0x2887('0x9b')][_0x4b291d]),'CmListId':Number(_0x50f61a[_0x2887('0x4c')]['id'])});}return _0x46cc8c;});}})[_0x2887('0x2a')](respondWithResult(_0xb90b35,null))[_0x2887('0x4a')](handleError(_0xb90b35,null));};exports[_0x2887('0x9e')]=function(_0x2e609a,_0x17de14,_0x3c26b7){return db['CmList'][_0x2887('0x4e')]({'where':{'id':_0x2e609a['params']['id']}})[_0x2887('0x2a')](handleEntityNotFound(_0x17de14,null))[_0x2887('0x2a')](function(_0x31cffe){if(_0x31cffe){return _0x31cffe[_0x2887('0x9e')](_0x2e609a[_0x2887('0x39')][_0x2887('0x9b')])[_0x2887('0x2a')](function(){if(_[_0x2887('0x60')](_0x2e609a[_0x2887('0x39')][_0x2887('0x9b')])){for(var _0x56a988=0x0;_0x56a988<_0x2e609a[_0x2887('0x39')][_0x2887('0x9b')][_0x2887('0x3f')];_0x56a988+=0x1){socket[_0x2887('0x9c')](_0x2887('0x9f'),{'UserId':Number(_0x2e609a['query'][_0x2887('0x9b')][_0x56a988]),'CmListId':Number(_0x2e609a[_0x2887('0x4c')]['id'])});}}else{socket['emit'](_0x2887('0x9f'),{'UserId':Number(_0x2e609a[_0x2887('0x39')][_0x2887('0x9b')]),'CmListId':Number(_0x2e609a[_0x2887('0x4c')]['id'])});}});}})[_0x2887('0x2a')](respondWithStatusCode(_0x17de14,null))[_0x2887('0x4a')](handleError(_0x17de14,null));};exports[_0x2887('0xa0')]=function(_0xafa8ad,_0x2140e0,_0x1886b9){var _0x233ac1={};var _0x4efba1={};var _0x4ffa69;var _0x353f21;return db['CmList'][_0x2887('0x5a')]({'where':{'id':_0xafa8ad[_0x2887('0x4c')]['id']}})[_0x2887('0x2a')](handleEntityNotFound(_0x2140e0,null))[_0x2887('0x2a')](function(_0x560fd3){if(_0x560fd3){_0x4ffa69=_0x560fd3;_0x4efba1[_0x2887('0x37')]=_[_0x2887('0x3a')](db['User'][_0x2887('0x35')]);_0x4efba1[_0x2887('0x39')]=_[_0x2887('0x3a')](_0xafa8ad[_0x2887('0x39')]);_0x4efba1[_0x2887('0x3b')]=_[_0x2887('0x3c')](_0x4efba1[_0x2887('0x37')],_0x4efba1[_0x2887('0x39')]);_0x233ac1[_0x2887('0x3d')]=_['intersection'](_0x4efba1[_0x2887('0x37')],qs[_0x2887('0x3e')](_0xafa8ad[_0x2887('0x39')]['fields']));_0x233ac1['attributes']=_0x233ac1[_0x2887('0x3d')][_0x2887('0x3f')]?_0x233ac1['attributes']:_0x4efba1[_0x2887('0x37')];_0x233ac1[_0x2887('0x5c')]=qs[_0x2887('0x41')](_0xafa8ad['query'][_0x2887('0x41')]);_0x233ac1[_0x2887('0x43')]=qs[_0x2887('0x3b')](_['pick'](_0xafa8ad[_0x2887('0x39')],_0x4efba1[_0x2887('0x3b')]));if(_0xafa8ad[_0x2887('0x39')][_0x2887('0x42')]){_0x233ac1['where']=_[_0x2887('0x44')](_0x233ac1['where'],{'$or':_[_0x2887('0x38')](_0x233ac1[_0x2887('0x3d')],function(_0x34125b){var _0x218af4={};_0x218af4[_0x34125b]={'$like':'%'+_0xafa8ad[_0x2887('0x39')]['filter']+'%'};return _0x218af4;})});}_0x233ac1=_[_0x2887('0x44')]({},_0x233ac1,_0xafa8ad[_0x2887('0x46')]);return _0x4ffa69[_0x2887('0xa0')](_0x233ac1);}})[_0x2887('0x2a')](function(_0x2133c8){if(_0x2133c8){_0x353f21=_0x2133c8[_0x2887('0x3f')];if(!_0xafa8ad[_0x2887('0x39')]['hasOwnProperty']('nolimit')){_0x233ac1[_0x2887('0x22')]=qs[_0x2887('0x22')](_0xafa8ad['query'][_0x2887('0x22')]);_0x233ac1[_0x2887('0x20')]=qs[_0x2887('0x20')](_0xafa8ad[_0x2887('0x39')]['offset']);}return _0x4ffa69[_0x2887('0xa0')](_0x233ac1);}})['then'](function(_0x429679){if(_0x429679){return _0x429679?{'count':_0x353f21,'rows':_0x429679}:null;}})['then'](respondWithResult(_0x2140e0,null))[_0x2887('0x4a')](handleError(_0x2140e0,null));};function handleQuery(_0x4290a1){logger[_0x2887('0xa1')](_0x4290a1);return db[_0x2887('0x8a')][_0x2887('0x39')](_0x4290a1)[_0x2887('0xa2')](function(_0x3115e5){csv_results[_0x2887('0x63')](_0x3115e5);})['catch'](function(_0x39ab93){logger[_0x2887('0x30')](_0x39ab93[_0x2887('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 963a702..7578756 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x58d43a,_0x2e127a){_0x58d43a=_0x58d43a-0x0;var _0x178bb9=_0x3e74[_0x58d43a];return _0x178bb9;};'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 _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(_0x286d20,_0x4118af){_0x286d20=_0x286d20-0x0;var _0x326b32=_0x3e74[_0x286d20];return _0x326b32;};'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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3222d1f..162f560 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','CmList','util'];(function(_0x3aac02,_0x5a9b9c){var _0x428e81=function(_0x3a843a){while(--_0x3a843a){_0x3aac02['push'](_0x3aac02['shift']());}};_0x428e81(++_0x5a9b9c);}(_0xedd9,0xfc));var _0x9edd=function(_0x1b428d,_0x21be12){_0x1b428d=_0x1b428d-0x0;var _0x169cf2=_0xedd9[_0x1b428d];return _0x169cf2;};'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':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb903=['rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2d2f17,_0x2bd8a9){var _0x5a49ae=function(_0x1383d2){while(--_0x1383d2){_0x2d2f17['push'](_0x2d2f17['shift']());}};_0x5a49ae(++_0x2bd8a9);}(_0xb903,0x185));var _0x3b90=function(_0x2dc438,_0x3851c2){_0x2dc438=_0x2dc438-0x0;var _0x13029a=_0xb903[_0x2dc438];return _0x13029a;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('CmList',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index c7595cd..0025642 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 _0xb81b=['localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x59e108,_0x26ea18){var _0x3c1dc4=function(_0x20a90b){while(--_0x20a90b){_0x59e108['push'](_0x59e108['shift']());}};_0x3c1dc4(++_0x26ea18);}(_0xb81b,0x10d));var _0xbb81=function(_0x429bfe,_0x164784){_0x429bfe=_0x429bfe-0x0;var _0x80ea3a=_0xb81b[_0x429bfe];return _0x80ea3a;};'use strict';var _=require('lodash');var util=require(_0xbb81('0x0'));var moment=require(_0xbb81('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb81('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbb81('0x3'));var logger=require(_0xbb81('0x4'))(_0xbb81('0x5'));var config=require(_0xbb81('0x6'));var jayson=require(_0xbb81('0x7'));var client=jayson['client'][_0xbb81('0x8')]({'port':0x232a});config[_0xbb81('0x9')]=_[_0xbb81('0xa')](config['redis'],{'host':_0xbb81('0xb'),'port':0x18eb});var socket=require(_0xbb81('0xc'))(new Redis(config[_0xbb81('0x9')]));require(_0xbb81('0xd'))[_0xbb81('0xe')](socket);function respondWithRpcPromise(_0x1672e3,_0x2fc204,_0x28ac37){return new BPromise(function(_0x50115c,_0x3a286e){return client[_0xbb81('0xf')](_0x1672e3,_0x28ac37)[_0xbb81('0x10')](function(_0x3fe4fd){logger[_0xbb81('0x11')](_0xbb81('0x12'),_0x2fc204,_0xbb81('0x13'));logger[_0xbb81('0x14')](_0xbb81('0x15'),_0x2fc204,'request\x20sent',JSON[_0xbb81('0x16')](_0x3fe4fd));if(_0x3fe4fd['error']){if(_0x3fe4fd['error'][_0xbb81('0x17')]===0x1f4){logger[_0xbb81('0x18')](_0xbb81('0x12'),_0x2fc204,_0x3fe4fd[_0xbb81('0x18')][_0xbb81('0x19')]);return _0x3a286e(_0x3fe4fd[_0xbb81('0x18')][_0xbb81('0x19')]);}logger[_0xbb81('0x18')](_0xbb81('0x12'),_0x2fc204,_0x3fe4fd['error'][_0xbb81('0x19')]);return _0x50115c(_0x3fe4fd['error'][_0xbb81('0x19')]);}else{logger[_0xbb81('0x11')](_0xbb81('0x12'),_0x2fc204,'request\x20sent');_0x50115c(_0x3fe4fd[_0xbb81('0x1a')][_0xbb81('0x19')]);}})[_0xbb81('0x1b')](function(_0x2c79f4){logger[_0xbb81('0x18')](_0xbb81('0x12'),_0x2fc204,_0x2c79f4);_0x3a286e(_0x2c79f4);});});} \ No newline at end of file +var _0xc744=['localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xc744,0xc4));var _0x4c74=function(_0x5b058b,_0x294c77){_0x5b058b=_0x5b058b-0x0;var _0x2a78ad=_0xc744[_0x5b058b];return _0x2a78ad;};'use strict';var _=require(_0x4c74('0x0'));var util=require(_0x4c74('0x1'));var moment=require(_0x4c74('0x2'));var BPromise=require(_0x4c74('0x3'));var rs=require(_0x4c74('0x4'));var fs=require('fs');var Redis=require(_0x4c74('0x5'));var db=require(_0x4c74('0x6'))['db'];var utils=require(_0x4c74('0x7'));var logger=require('../../config/logger')(_0x4c74('0x8'));var config=require(_0x4c74('0x9'));var jayson=require(_0x4c74('0xa'));var client=jayson[_0x4c74('0xb')][_0x4c74('0xc')]({'port':0x232a});config[_0x4c74('0xd')]=_['defaults'](config['redis'],{'host':_0x4c74('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4c74('0xf'))[_0x4c74('0x10')](socket);function respondWithRpcPromise(_0x2e3477,_0x199a9b,_0x32ed2b){return new BPromise(function(_0x23270f,_0x4e00e8){return client[_0x4c74('0x11')](_0x2e3477,_0x32ed2b)[_0x4c74('0x12')](function(_0x539f23){logger[_0x4c74('0x13')](_0x4c74('0x14'),_0x199a9b,'request\x20sent');logger[_0x4c74('0x15')](_0x4c74('0x16'),_0x199a9b,_0x4c74('0x17'),JSON[_0x4c74('0x18')](_0x539f23));if(_0x539f23['error']){if(_0x539f23['error'][_0x4c74('0x19')]===0x1f4){logger[_0x4c74('0x1a')](_0x4c74('0x14'),_0x199a9b,_0x539f23[_0x4c74('0x1a')][_0x4c74('0x1b')]);return _0x4e00e8(_0x539f23['error'][_0x4c74('0x1b')]);}logger['error'](_0x4c74('0x14'),_0x199a9b,_0x539f23[_0x4c74('0x1a')]['message']);return _0x23270f(_0x539f23[_0x4c74('0x1a')][_0x4c74('0x1b')]);}else{logger[_0x4c74('0x13')](_0x4c74('0x14'),_0x199a9b,_0x4c74('0x17'));_0x23270f(_0x539f23[_0x4c74('0x1c')][_0x4c74('0x1b')]);}})[_0x4c74('0x1d')](function(_0x5cc088){logger[_0x4c74('0x1a')](_0x4c74('0x14'),_0x199a9b,_0x5cc088);_0x4e00e8(_0x5cc088);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4099c5b..9205044 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 _0x4a1a=['update','register','cmList:','remove'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x4a1a,0x11f));var _0xa4a1=function(_0x413087,_0x96db5a){_0x413087=_0x413087-0x0;var _0x1c773f=_0x4a1a[_0x413087];return _0x1c773f;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xa4a1('0x0'),_0xa4a1('0x1')];function createListener(_0x48e807,_0x534ec3){return function(_0x480284){_0x534ec3['emit'](_0x48e807,_0x480284);};}function removeListener(_0x350902,_0x4a3e0e){return function(){CmListEvents['removeListener'](_0x350902,_0x4a3e0e);};}exports[_0xa4a1('0x2')]=function(_0x58c7b8){for(var _0x6284e3=0x0,_0x42a54c=events['length'];_0x6284e3<_0x42a54c;_0x6284e3++){var _0x2be135=events[_0x6284e3];var _0x1f6b96=createListener(_0xa4a1('0x3')+_0x2be135,_0x58c7b8);CmListEvents['on'](_0x2be135,_0x1f6b96);}}; \ No newline at end of file +var _0x825a=['cmList:','./cmList.events','remove','update','emit','removeListener','register','length'];(function(_0x11db1c,_0x2e7a75){var _0x48d116=function(_0x29cc2d){while(--_0x29cc2d){_0x11db1c['push'](_0x11db1c['shift']());}};_0x48d116(++_0x2e7a75);}(_0x825a,0x1a9));var _0xa825=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x825a[_0x5cb1af];return _0x8d7940;};'use strict';var CmListEvents=require(_0xa825('0x0'));var events=['save',_0xa825('0x1'),_0xa825('0x2')];function createListener(_0x1d60cb,_0x3a794d){return function(_0x15f6ec){_0x3a794d[_0xa825('0x3')](_0x1d60cb,_0x15f6ec);};}function removeListener(_0x586901,_0x5ea931){return function(){CmListEvents[_0xa825('0x4')](_0x586901,_0x5ea931);};}exports[_0xa825('0x5')]=function(_0x308a81){for(var _0x2ffb8e=0x0,_0x3ec5df=events[_0xa825('0x6')];_0x2ffb8e<_0x3ec5df;_0x2ffb8e++){var _0x19e4da=events[_0x2ffb8e];var _0xee6883=createListener(_0xa825('0x7')+_0x19e4da,_0x308a81);CmListEvents['on'](_0x19e4da,_0xee6883);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 99003f0..5e78b8a 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 _0xdead=['../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','post','create','addCustomField','/:id/users','addAgents','/:id','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','express'];(function(_0x361152,_0x532e27){var _0x4b30d0=function(_0x333339){while(--_0x333339){_0x361152['push'](_0x361152['shift']());}};_0x4b30d0(++_0x532e27);}(_0xdead,0x172));var _0xddea=function(_0x17983d,_0x30e8c1){_0x17983d=_0x17983d-0x0;var _0x1ca89d=_0xdead[_0x17983d];return _0x1ca89d;};'use strict';var multer=require(_0xddea('0x0'));var util=require(_0xddea('0x1'));var path=require(_0xddea('0x2'));var timeout=require('connect-timeout');var express=require(_0xddea('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xddea('0x4'));var config=require('../../config/environment');var controller=require(_0xddea('0x5'));router[_0xddea('0x6')]('/',auth['isAuthenticated'](),controller[_0xddea('0x7')]);router[_0xddea('0x6')](_0xddea('0x8'),auth[_0xddea('0x9')](),controller[_0xddea('0xa')]);router['get'](_0xddea('0xb'),auth['isAuthenticated'](),controller[_0xddea('0xc')]);router[_0xddea('0x6')]('/:id',auth[_0xddea('0x9')](),controller[_0xddea('0xd')]);router[_0xddea('0x6')](_0xddea('0xe'),auth[_0xddea('0x9')](),controller[_0xddea('0xf')]);router['get'](_0xddea('0x10'),auth[_0xddea('0x9')](),controller[_0xddea('0x11')]);router[_0xddea('0x6')](_0xddea('0x12'),auth[_0xddea('0x9')](),controller[_0xddea('0x13')]);router[_0xddea('0x6')](_0xddea('0x14'),auth[_0xddea('0x9')](),controller['getCustomFields']);router[_0xddea('0x6')]('/:id/users',auth[_0xddea('0x9')](),controller[_0xddea('0x15')]);router[_0xddea('0x16')]('/',auth[_0xddea('0x9')](),controller[_0xddea('0x17')]);router[_0xddea('0x16')]('/:id/dispositions',auth[_0xddea('0x9')](),controller['addDisposition']);router['post'](_0xddea('0x10'),auth['isAuthenticated'](),controller['addContacts']);router[_0xddea('0x16')](_0xddea('0x14'),auth['isAuthenticated'](),controller[_0xddea('0x18')]);router['post'](_0xddea('0x19'),auth[_0xddea('0x9')](),controller[_0xddea('0x1a')]);router['put'](_0xddea('0x1b'),auth[_0xddea('0x9')](),controller[_0xddea('0x1c')]);router['delete'](_0xddea('0x1b'),auth[_0xddea('0x9')](),controller[_0xddea('0x1d')]);router[_0xddea('0x1e')](_0xddea('0xe'),auth[_0xddea('0x9')](),controller[_0xddea('0x1f')]);router[_0xddea('0x1e')]('/:id/users',auth[_0xddea('0x9')](),controller[_0xddea('0x20')]);module[_0xddea('0x21')]=router; \ No newline at end of file +var _0x2632=['/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','put','/:id','update','delete','removeAgents','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','get','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x17785e,_0xbfe61d){var _0x43a276=function(_0x358414){while(--_0x358414){_0x17785e['push'](_0x17785e['shift']());}};_0x43a276(++_0xbfe61d);}(_0x2632,0xae));var _0x2263=function(_0x282ce6,_0x548677){_0x282ce6=_0x282ce6-0x0;var _0x4da37d=_0x2632[_0x282ce6];return _0x4da37d;};'use strict';var multer=require('multer');var util=require(_0x2263('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2263('0x1'));var router=express['Router']();var fs_extra=require(_0x2263('0x2'));var auth=require(_0x2263('0x3'));var interaction=require(_0x2263('0x4'));var config=require(_0x2263('0x5'));var controller=require(_0x2263('0x6'));router['get']('/',auth[_0x2263('0x7')](),controller[_0x2263('0x8')]);router['get'](_0x2263('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x2263('0xa'),auth[_0x2263('0x7')](),controller[_0x2263('0xb')]);router[_0x2263('0xc')]('/:id',auth[_0x2263('0x7')](),controller[_0x2263('0xd')]);router['get']('/:id/dispositions',auth[_0x2263('0x7')](),controller[_0x2263('0xe')]);router[_0x2263('0xc')](_0x2263('0xf'),auth[_0x2263('0x7')](),controller[_0x2263('0x10')]);router[_0x2263('0xc')](_0x2263('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x2263('0xc')](_0x2263('0x12'),auth['isAuthenticated'](),controller[_0x2263('0x13')]);router['get'](_0x2263('0x14'),auth[_0x2263('0x7')](),controller['getAgents']);router[_0x2263('0x15')]('/',auth[_0x2263('0x7')](),controller[_0x2263('0x16')]);router['post'](_0x2263('0x17'),auth['isAuthenticated'](),controller[_0x2263('0x18')]);router[_0x2263('0x15')](_0x2263('0xf'),auth[_0x2263('0x7')](),controller[_0x2263('0x19')]);router['post']('/:id/fields',auth[_0x2263('0x7')](),controller[_0x2263('0x1a')]);router[_0x2263('0x15')](_0x2263('0x14'),auth[_0x2263('0x7')](),controller['addAgents']);router[_0x2263('0x1b')](_0x2263('0x1c'),auth[_0x2263('0x7')](),controller[_0x2263('0x1d')]);router[_0x2263('0x1e')](_0x2263('0x1c'),auth[_0x2263('0x7')](),controller['destroy']);router['delete'](_0x2263('0x17'),auth[_0x2263('0x7')](),controller['removeDispositions']);router['delete'](_0x2263('0x14'),auth[_0x2263('0x7')](),controller[_0x2263('0x1f')]);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 cc8096b..cfc9ca6 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 _0x336b=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x5c7352,_0x26cb3a){var _0x5842eb=function(_0x59f63a){while(--_0x59f63a){_0x5c7352['push'](_0x5c7352['shift']());}};_0x5842eb(++_0x26cb3a);}(_0x336b,0x73));var _0xb336=function(_0x494218,_0x3d4c83){_0x494218=_0x494218-0x0;var _0x18d7da=_0x336b[_0x494218];return _0x18d7da;};'use strict';var Sequelize=require(_0xb336('0x0'));module[_0xb336('0x1')]={'name':{'type':Sequelize[_0xb336('0x2')],'get':function(_0x4f1e58){return this[_0xb336('0x3')](_0xb336('0x4'));}},'field':{'type':Sequelize[_0xb336('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xb336('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x27d9=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x35b190,_0x589b87){var _0x4175e0=function(_0x34ee92){while(--_0x34ee92){_0x35b190['push'](_0x35b190['shift']());}};_0x4175e0(++_0x589b87);}(_0x27d9,0x1a4));var _0x927d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x27d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x927d('0x0'));module[_0x927d('0x1')]={'name':{'type':Sequelize[_0x927d('0x2')],'get':function(_0x26200d){return this[_0x927d('0x3')](_0x927d('0x4'));}},'field':{'type':Sequelize[_0x927d('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x927d('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 681ea88..d020350 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xa153b1,_0x3fe7ed){var _0x60cfb=function(_0x469585){while(--_0x469585){_0xa153b1['push'](_0xa153b1['shift']());}};_0x60cfb(++_0x3fe7ed);}(_0x7a54,0x106));var _0x47a5=function(_0x19b191,_0x58d363){_0x19b191=_0x19b191-0x0;var _0x32a9db=_0x7a54[_0x19b191];return _0x32a9db;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2fbfb7,_0x48b974){var _0x34357e=function(_0x4b7fe5){while(--_0x4b7fe5){_0x2fbfb7['push'](_0x2fbfb7['shift']());}};_0x34357e(++_0x48b974);}(_0x7a54,0x106));var _0x47a5=function(_0x38d8b9,_0x353e93){_0x38d8b9=_0x38d8b9-0x0;var _0x555b09=_0x7a54[_0x38d8b9];return _0x555b09;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index d262780..7a10f17 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 _0xdfc2=['bluebird','../../config/environment','./condition.attributes','define','Condition','tools_conditions','util','../../config/logger','api','moment'];(function(_0x17226d,_0x5cdceb){var _0x1a0243=function(_0x45c441){while(--_0x45c441){_0x17226d['push'](_0x17226d['shift']());}};_0x1a0243(++_0x5cdceb);}(_0xdfc2,0x178));var _0x2dfc=function(_0x508a41,_0x391cf0){_0x508a41=_0x508a41-0x0;var _0x4ed9e7=_0xdfc2[_0x508a41];return _0x4ed9e7;};'use strict';var _=require('lodash');var util=require(_0x2dfc('0x0'));var logger=require(_0x2dfc('0x1'))(_0x2dfc('0x2'));var moment=require(_0x2dfc('0x3'));var BPromise=require(_0x2dfc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2dfc('0x5'));var attributes=require(_0x2dfc('0x6'));module['exports']=function(_0xaaa7ef,_0x498299){return _0xaaa7ef[_0x2dfc('0x7')](_0x2dfc('0x8'),attributes,{'tableName':_0x2dfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd07=['request-promise','rimraf','../../config/environment','./condition.attributes','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird'];(function(_0x18d45a,_0x586837){var _0x303688=function(_0x4a1d82){while(--_0x4a1d82){_0x18d45a['push'](_0x18d45a['shift']());}};_0x303688(++_0x586837);}(_0xcd07,0xa0));var _0x7cd0=function(_0x4fdb10,_0x34c498){_0x4fdb10=_0x4fdb10-0x0;var _0xbd8dea=_0xcd07[_0x4fdb10];return _0xbd8dea;};'use strict';var _=require('lodash');var util=require(_0x7cd0('0x0'));var logger=require(_0x7cd0('0x1'))(_0x7cd0('0x2'));var moment=require(_0x7cd0('0x3'));var BPromise=require(_0x7cd0('0x4'));var rp=require(_0x7cd0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7cd0('0x6'));var config=require(_0x7cd0('0x7'));var attributes=require(_0x7cd0('0x8'));module['exports']=function(_0x151909,_0x51a814){return _0x151909['define'](_0x7cd0('0x9'),attributes,{'tableName':_0x7cd0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 2225e94..63e993f 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 _0x6543=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6543,0xdb));var _0x3654=function(_0x37e665,_0xd6a998){_0x37e665=_0x37e665-0x0;var _0x2e9536=_0x6543[_0x37e665];return _0x2e9536;};'use strict';var _=require(_0x3654('0x0'));var util=require('util');var moment=require(_0x3654('0x1'));var BPromise=require(_0x3654('0x2'));var rs=require(_0x3654('0x3'));var fs=require('fs');var Redis=require(_0x3654('0x4'));var db=require(_0x3654('0x5'))['db'];var utils=require(_0x3654('0x6'));var logger=require(_0x3654('0x7'))(_0x3654('0x8'));var config=require('../../config/environment');var jayson=require(_0x3654('0x9'));var client=jayson[_0x3654('0xa')][_0x3654('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f90c4,_0x5d0472,_0x1a8cf4){return new BPromise(function(_0x3d9deb,_0x4f76f7){return client[_0x3654('0xc')](_0x4f90c4,_0x1a8cf4)['then'](function(_0x1e7bf1){logger[_0x3654('0xd')](_0x3654('0xe'),_0x5d0472,_0x3654('0xf'));logger['debug'](_0x3654('0x10'),_0x5d0472,_0x3654('0xf'),JSON[_0x3654('0x11')](_0x1e7bf1));if(_0x1e7bf1['error']){if(_0x1e7bf1[_0x3654('0x12')]['code']===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x5d0472,_0x1e7bf1[_0x3654('0x12')][_0x3654('0x13')]);return _0x4f76f7(_0x1e7bf1[_0x3654('0x12')]['message']);}logger[_0x3654('0x12')]('Condition,\x20%s,\x20%s',_0x5d0472,_0x1e7bf1[_0x3654('0x12')]['message']);return _0x3d9deb(_0x1e7bf1[_0x3654('0x12')]['message']);}else{logger[_0x3654('0xd')]('Condition,\x20%s,\x20%s',_0x5d0472,_0x3654('0xf'));_0x3d9deb(_0x1e7bf1[_0x3654('0x14')][_0x3654('0x13')]);}})[_0x3654('0x15')](function(_0x4376b5){logger[_0x3654('0x12')](_0x3654('0xe'),_0x5d0472,_0x4376b5);_0x4f76f7(_0x4376b5);});});} \ No newline at end of file +var _0xfeb5=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0xfeb5,0x102));var _0x5feb=function(_0x3bdce2,_0x14a65e){_0x3bdce2=_0x3bdce2-0x0;var _0x14cb89=_0xfeb5[_0x3bdce2];return _0x14cb89;};'use strict';var _=require(_0x5feb('0x0'));var util=require(_0x5feb('0x1'));var moment=require('moment');var BPromise=require(_0x5feb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5feb('0x3'));var db=require(_0x5feb('0x4'))['db'];var utils=require(_0x5feb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5feb('0x6'));var jayson=require(_0x5feb('0x7'));var client=jayson[_0x5feb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d281f,_0x3aeca8,_0x7617be){return new BPromise(function(_0x4bacf1,_0x4dc6c8){return client[_0x5feb('0x9')](_0x1d281f,_0x7617be)[_0x5feb('0xa')](function(_0x2be9c8){logger[_0x5feb('0xb')](_0x5feb('0xc'),_0x3aeca8,_0x5feb('0xd'));logger[_0x5feb('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x3aeca8,_0x5feb('0xd'),JSON['stringify'](_0x2be9c8));if(_0x2be9c8['error']){if(_0x2be9c8[_0x5feb('0xf')][_0x5feb('0x10')]===0x1f4){logger[_0x5feb('0xf')](_0x5feb('0xc'),_0x3aeca8,_0x2be9c8[_0x5feb('0xf')]['message']);return _0x4dc6c8(_0x2be9c8['error']['message']);}logger[_0x5feb('0xf')]('Condition,\x20%s,\x20%s',_0x3aeca8,_0x2be9c8['error'][_0x5feb('0x11')]);return _0x4bacf1(_0x2be9c8[_0x5feb('0xf')][_0x5feb('0x11')]);}else{logger[_0x5feb('0xb')](_0x5feb('0xc'),_0x3aeca8,_0x5feb('0xd'));_0x4bacf1(_0x2be9c8[_0x5feb('0x12')]['message']);}})[_0x5feb('0x13')](function(_0xd27e88){logger['error'](_0x5feb('0xc'),_0x3aeca8,_0xd27e88);_0x4dc6c8(_0xd27e88);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 8dcdc72..456a18e 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 _0xf55b=['isAuthenticated','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','put','/:id'];(function(_0x2aeb4b,_0x29d79d){var _0x16138d=function(_0xab860f){while(--_0xab860f){_0x2aeb4b['push'](_0x2aeb4b['shift']());}};_0x16138d(++_0x29d79d);}(_0xf55b,0x1c4));var _0xbf55=function(_0x5c17fa,_0x2f8ec0){_0x5c17fa=_0x5c17fa-0x0;var _0x582a13=_0xf55b[_0x5c17fa];return _0x582a13;};'use strict';var multer=require(_0xbf55('0x0'));var util=require(_0xbf55('0x1'));var path=require('path');var timeout=require(_0xbf55('0x2'));var express=require(_0xbf55('0x3'));var router=express[_0xbf55('0x4')]();var fs_extra=require(_0xbf55('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf55('0x6'));var config=require(_0xbf55('0x7'));var controller=require('./condition.controller');router[_0xbf55('0x8')](_0xbf55('0x9'),auth[_0xbf55('0xa')](),controller[_0xbf55('0xb')]);router[_0xbf55('0xc')](_0xbf55('0x9'),auth[_0xbf55('0xa')](),controller[_0xbf55('0xd')]);module['exports']=router; \ No newline at end of file +var _0xe775=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x16af46,_0x49be9b){var _0x40e491=function(_0x3bdf02){while(--_0x3bdf02){_0x16af46['push'](_0x16af46['shift']());}};_0x40e491(++_0x49be9b);}(_0xe775,0x1c3));var _0x5e77=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0xe775[_0xc55d64];return _0x4194f6;};'use strict';var multer=require(_0x5e77('0x0'));var util=require(_0x5e77('0x1'));var path=require('path');var timeout=require(_0x5e77('0x2'));var express=require(_0x5e77('0x3'));var router=express[_0x5e77('0x4')]();var fs_extra=require(_0x5e77('0x5'));var auth=require(_0x5e77('0x6'));var interaction=require(_0x5e77('0x7'));var config=require(_0x5e77('0x8'));var controller=require(_0x5e77('0x9'));router[_0x5e77('0xa')](_0x5e77('0xb'),auth[_0x5e77('0xc')](),controller[_0x5e77('0xd')]);router[_0x5e77('0xe')](_0x5e77('0xb'),auth[_0x5e77('0xc')](),controller[_0x5e77('0xf')]);module[_0x5e77('0x10')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 798efa1..5467b72 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0547=['INTEGER','sequelize','STRING','name'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x0547,0x17d));var _0x7054=function(_0x253f8d,_0x1b9e02){_0x253f8d=_0x253f8d-0x0;var _0x464264=_0x0547[_0x253f8d];return _0x464264;};'use strict';var Sequelize=require(_0x7054('0x0'));module['exports']={'name':{'type':Sequelize[_0x7054('0x1')],'allowNull':![],'unique':_0x7054('0x2')},'OrderBy':{'type':Sequelize[_0x7054('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7054('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xa2ab=['name','INTEGER','STRING','sequelize'];(function(_0x485840,_0x122071){var _0x41ec7d=function(_0x1e45d0){while(--_0x1e45d0){_0x485840['push'](_0x485840['shift']());}};_0x41ec7d(++_0x122071);}(_0xa2ab,0xef));var _0xba2a=function(_0x59cd35,_0x5a9053){_0x59cd35=_0x59cd35-0x0;var _0x26e325=_0xa2ab[_0x59cd35];return _0x26e325;};'use strict';var Sequelize=require(_0xba2a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xba2a('0x1')},'OrderBy':{'type':Sequelize[_0xba2a('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xba2a('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 733925a..2f85f6b 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd943=['nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','stack','index','ContactItemType','rawAttributes','fieldName','key','map','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0xd943,0x15d));var _0x3d94=function(_0x599034,_0x347cbd){_0x599034=_0x599034-0x0;var _0x2edd06=_0xd943[_0x599034];return _0x2edd06;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){var _0x18f58c=_0x295493[_0x3d94('0x24')]({'plain':!![]});var _0x192839=_0x3d94('0x25');return db[_0x3d94('0x26')][_0x3d94('0x23')]({'where':{'type':_0x192839,'resourceId':_0x18f58c['id']}})['then'](function(){return _0x295493;});})[_0x3d94('0x22')](function(){_0x395133['status'](0xcc)[_0x3d94('0x27')]();});}};}function handleEntityNotFound(_0x1d0a7a,_0xc2885){return function(_0x439173){if(!_0x439173){_0x1d0a7a[_0x3d94('0x16')](0x194);}return _0x439173;};}function handleError(_0x82b568,_0x401857){_0x401857=_0x401857||0x1f4;return function(_0x47d6ab){logger['error'](_0x47d6ab[_0x3d94('0x28')]);if(_0x47d6ab['name']){delete _0x47d6ab['name'];}_0x82b568[_0x3d94('0x17')](_0x401857)['send'](_0x47d6ab);};}exports[_0x3d94('0x29')]=function(_0xef9644,_0x32403a){var _0x4cef9c={},_0x2a07b4={},_0x4c1237={'count':0x0,'rows':[]};var _0x3d4994=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x29b1ff){return{'name':_0x29b1ff[_0x3d94('0x2c')],'type':_0x29b1ff['type'][_0x3d94('0x2d')]};});_0x2a07b4['model']=_[_0x3d94('0x2e')](_0x3d4994,_0x3d94('0x2f'));_0x2a07b4['query']=_['keys'](_0xef9644[_0x3d94('0x30')]);_0x2a07b4[_0x3d94('0x31')]=_[_0x3d94('0x32')](_0x2a07b4['model'],_0x2a07b4[_0x3d94('0x30')]);_0x4cef9c[_0x3d94('0x33')]=_['intersection'](_0x2a07b4[_0x3d94('0x34')],qs[_0x3d94('0x35')](_0xef9644[_0x3d94('0x30')][_0x3d94('0x35')]));_0x4cef9c[_0x3d94('0x33')]=_0x4cef9c['attributes'][_0x3d94('0x36')]?_0x4cef9c[_0x3d94('0x33')]:_0x2a07b4[_0x3d94('0x34')];if(!_0xef9644[_0x3d94('0x30')][_0x3d94('0x37')](_0x3d94('0x38'))){_0x4cef9c['limit']=qs['limit'](_0xef9644[_0x3d94('0x30')][_0x3d94('0x1b')]);_0x4cef9c[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0xef9644[_0x3d94('0x30')][_0x3d94('0x19')]);}_0x4cef9c[_0x3d94('0x39')]=qs[_0x3d94('0x3a')](_0xef9644[_0x3d94('0x30')][_0x3d94('0x3a')]);_0x4cef9c['where']=qs[_0x3d94('0x31')](_[_0x3d94('0x3b')](_0xef9644[_0x3d94('0x30')],_0x2a07b4[_0x3d94('0x31')]),_0x3d4994);if(_0xef9644['query'][_0x3d94('0x3c')]){_0x4cef9c[_0x3d94('0x3d')]=_[_0x3d94('0x3e')](_0x4cef9c[_0x3d94('0x3d')],{'$or':_[_0x3d94('0x2e')](_0x3d4994,function(_0x4b5a1a){if(_0x4b5a1a[_0x3d94('0x3f')]!==_0x3d94('0x40')){var _0x1d3d41={};_0x1d3d41[_0x4b5a1a['name']]={'$like':'%'+_0xef9644['query']['filter']+'%'};return _0x1d3d41;}})});}_0x4cef9c=_['merge']({},_0x4cef9c,_0xef9644[_0x3d94('0x41')]);var _0x22f52c={'where':_0x4cef9c[_0x3d94('0x3d')]};return db[_0x3d94('0x2a')][_0x3d94('0x1c')](_0x22f52c)[_0x3d94('0x22')](function(_0x3a3898){_0x4c1237['count']=_0x3a3898;if(_0xef9644['query'][_0x3d94('0x42')]){_0x4cef9c[_0x3d94('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0x3d94('0x44')](_0x4cef9c);})['then'](function(_0x1361fb){_0x4c1237[_0x3d94('0x45')]=_0x1361fb;return _0x4c1237;})[_0x3d94('0x22')](respondWithFilteredResult(_0x32403a,_0x4cef9c))[_0x3d94('0x46')](handleError(_0x32403a,null));};exports[_0x3d94('0x47')]=function(_0x5a9263,_0x3e0da8){var _0x168771={'raw':!![],'where':{'id':_0x5a9263['params']['id']}},_0x18a70c={};_0x18a70c[_0x3d94('0x34')]=_['keys'](db['ContactItemType'][_0x3d94('0x2b')]);_0x18a70c[_0x3d94('0x30')]=_[_0x3d94('0x48')](_0x5a9263[_0x3d94('0x30')]);_0x18a70c['filters']=_[_0x3d94('0x32')](_0x18a70c['model'],_0x18a70c[_0x3d94('0x30')]);_0x168771[_0x3d94('0x33')]=_[_0x3d94('0x32')](_0x18a70c[_0x3d94('0x34')],qs[_0x3d94('0x35')](_0x5a9263[_0x3d94('0x30')][_0x3d94('0x35')]));_0x168771['attributes']=_0x168771[_0x3d94('0x33')][_0x3d94('0x36')]?_0x168771['attributes']:_0x18a70c['model'];if(_0x5a9263[_0x3d94('0x30')][_0x3d94('0x42')]){_0x168771['include']=[{'all':!![]}];}_0x168771=_[_0x3d94('0x3e')]({},_0x168771,_0x5a9263[_0x3d94('0x41')]);return db[_0x3d94('0x2a')][_0x3d94('0x49')](_0x168771)[_0x3d94('0x22')](handleEntityNotFound(_0x3e0da8,null))[_0x3d94('0x22')](respondWithResult(_0x3e0da8,null))[_0x3d94('0x46')](handleError(_0x3e0da8,null));};exports[_0x3d94('0x4a')]=function(_0x60279f,_0x2429bc){return db[_0x3d94('0x2a')][_0x3d94('0x4a')](_0x60279f[_0x3d94('0x4b')],{})[_0x3d94('0x22')](function(_0xbe50d0){var _0x49209b=_0x60279f[_0x3d94('0x4c')][_0x3d94('0x24')]({'plain':!![]});if(!_0x49209b)throw new Error(_0x3d94('0x4d'));if(_0x49209b[_0x3d94('0x4e')]===_0x3d94('0x4c')){var _0x3ce0be=_0xbe50d0[_0x3d94('0x24')]({'plain':!![]});var _0x33db0a=_0x3d94('0x25');return db['UserProfileSection'][_0x3d94('0x49')]({'where':{'name':_0x33db0a,'userProfileId':_0x49209b['userProfileId']},'raw':!![]})[_0x3d94('0x22')](function(_0x3a7eb0){if(_0x3a7eb0&&_0x3a7eb0['autoAssociation']===0x0){return db[_0x3d94('0x26')]['create']({'name':_0x3ce0be['name'],'resourceId':_0x3ce0be['id'],'type':_0x3a7eb0[_0x3d94('0x2f')],'sectionId':_0x3a7eb0['id']},{})['then'](function(){return _0xbe50d0;});}else{return _0xbe50d0;}})[_0x3d94('0x46')](function(_0x132e0b){logger['error'](_0x3d94('0x4f'),_0x132e0b);throw _0x132e0b;});}return _0xbe50d0;})['then'](respondWithResult(_0x2429bc,0xc9))['catch'](handleError(_0x2429bc,null));};exports[_0x3d94('0x21')]=function(_0x1fb53e,_0xa9f159){if(_0x1fb53e[_0x3d94('0x4b')]['id']){delete _0x1fb53e[_0x3d94('0x4b')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x49')]({'where':{'id':_0x1fb53e[_0x3d94('0x50')]['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0xa9f159,null))['then'](saveUpdates(_0x1fb53e[_0x3d94('0x4b')],null))[_0x3d94('0x22')](respondWithResult(_0xa9f159,null))[_0x3d94('0x46')](handleError(_0xa9f159,null));};exports[_0x3d94('0x23')]=function(_0xe7d1dc,_0x3e1992){return db[_0x3d94('0x2a')][_0x3d94('0x49')]({'where':{'id':_0xe7d1dc[_0x3d94('0x50')]['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x3e1992,null))[_0x3d94('0x22')](db['CmContactHasItem'][_0x3d94('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0xe7d1dc['params']['id']}}))[_0x3d94('0x22')](removeEntity(_0x3e1992,null))[_0x3d94('0x46')](handleError(_0x3e1992,null));}; \ No newline at end of file +var _0xa30a=['offset','undefined','count','limit','apply','save','update','then','get','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','attributes','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','intersection','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json'];(function(_0x6218f9,_0x221546){var _0x38f432=function(_0x59ee33){while(--_0x59ee33){_0x6218f9['push'](_0x6218f9['shift']());}};_0x38f432(++_0x221546);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec992f,_0x3de2d1){_0x3de2d1=_0x3de2d1||0xcc;return function(_0xcd1d3b){if(_0xcd1d3b){return _0xec992f['sendStatus'](_0x3de2d1);}return _0xec992f[_0xaa30('0x19')](_0x3de2d1)[_0xaa30('0x1a')]();};}function respondWithResult(_0x25c02e,_0x14de74){_0x14de74=_0x14de74||0xc8;return function(_0x41f1d9){if(_0x41f1d9){return _0x25c02e[_0xaa30('0x19')](_0x14de74)[_0xaa30('0x1b')](_0x41f1d9);}};}function respondWithFilteredResult(_0x3b8095,_0x2e37af){return function(_0xfae724){if(_0xfae724){var _0x519518=typeof _0x2e37af[_0xaa30('0x1c')]==='undefined'&&typeof _0x2e37af['limit']===_0xaa30('0x1d');var _0x153939=_0xfae724[_0xaa30('0x1e')];var _0x540e36=_0x519518?0x0:_0x2e37af['offset'];var _0x53f9fd=_0x519518?_0xfae724[_0xaa30('0x1e')]:_0x2e37af['offset']+_0x2e37af[_0xaa30('0x1f')];var _0x332a0a;if(_0x53f9fd>=_0x153939){_0x53f9fd=_0x153939;_0x332a0a=0xc8;}else{_0x332a0a=0xce;}_0x3b8095['status'](_0x332a0a);return _0x3b8095['set']('Content-Range',_0x540e36+'-'+_0x53f9fd+'/'+_0x153939)[_0xaa30('0x1b')](_0xfae724);}return null;};}function patchUpdates(_0x3e4f1d){return function(_0x61b85){try{jsonpatch[_0xaa30('0x20')](_0x61b85,_0x3e4f1d,!![]);}catch(_0x43a526){return BPromise['reject'](_0x43a526);}return _0x61b85[_0xaa30('0x21')]();};}function saveUpdates(_0x24bb25,_0x2e16e7){return function(_0x2d9e35){if(_0x2d9e35){return _0x2d9e35[_0xaa30('0x22')](_0x24bb25)['then'](function(_0x325b42){return _0x325b42;});}return null;};}function removeEntity(_0x13128a,_0x2fecdd){return function(_0x326f84){if(_0x326f84){return _0x326f84['destroy']()[_0xaa30('0x23')](function(){var _0x1be54c=_0x326f84[_0xaa30('0x24')]({'plain':!![]});var _0x12da2f=_0xaa30('0x25');return db[_0xaa30('0x26')]['destroy']({'where':{'type':_0x12da2f,'resourceId':_0x1be54c['id']}})[_0xaa30('0x23')](function(){return _0x326f84;});})[_0xaa30('0x23')](function(){_0x13128a['status'](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x5b3efb,_0x2da4da){return function(_0x33a0c9){if(!_0x33a0c9){_0x5b3efb[_0xaa30('0x27')](0x194);}return _0x33a0c9;};}function handleError(_0xd1eb3a,_0x37b4a6){_0x37b4a6=_0x37b4a6||0x1f4;return function(_0xc10b8f){logger[_0xaa30('0x28')](_0xc10b8f[_0xaa30('0x29')]);if(_0xc10b8f[_0xaa30('0x2a')]){delete _0xc10b8f[_0xaa30('0x2a')];}_0xd1eb3a[_0xaa30('0x19')](_0x37b4a6)[_0xaa30('0x2b')](_0xc10b8f);};}exports[_0xaa30('0x2c')]=function(_0x46abb9,_0x40e4ee){var _0x1a3f64={},_0x230d56={},_0x1fa8d4={'count':0x0,'rows':[]};var _0x484ffb=_[_0xaa30('0x2d')](db[_0xaa30('0x2e')][_0xaa30('0x2f')],function(_0x20916f){return{'name':_0x20916f[_0xaa30('0x30')],'type':_0x20916f[_0xaa30('0x31')]['key']};});_0x230d56['model']=_['map'](_0x484ffb,_0xaa30('0x2a'));_0x230d56[_0xaa30('0x32')]=_[_0xaa30('0x33')](_0x46abb9[_0xaa30('0x32')]);_0x230d56[_0xaa30('0x34')]=_['intersection'](_0x230d56['model'],_0x230d56[_0xaa30('0x32')]);_0x1a3f64[_0xaa30('0x35')]=_['intersection'](_0x230d56[_0xaa30('0x36')],qs['fields'](_0x46abb9[_0xaa30('0x32')]['fields']));_0x1a3f64[_0xaa30('0x35')]=_0x1a3f64[_0xaa30('0x35')]['length']?_0x1a3f64[_0xaa30('0x35')]:_0x230d56[_0xaa30('0x36')];if(!_0x46abb9[_0xaa30('0x32')][_0xaa30('0x37')](_0xaa30('0x38'))){_0x1a3f64[_0xaa30('0x1f')]=qs['limit'](_0x46abb9[_0xaa30('0x32')][_0xaa30('0x1f')]);_0x1a3f64['offset']=qs[_0xaa30('0x1c')](_0x46abb9[_0xaa30('0x32')][_0xaa30('0x1c')]);}_0x1a3f64['order']=qs['sort'](_0x46abb9[_0xaa30('0x32')][_0xaa30('0x39')]);_0x1a3f64[_0xaa30('0x3a')]=qs[_0xaa30('0x34')](_[_0xaa30('0x3b')](_0x46abb9[_0xaa30('0x32')],_0x230d56['filters']),_0x484ffb);if(_0x46abb9['query'][_0xaa30('0x3c')]){_0x1a3f64[_0xaa30('0x3a')]=_[_0xaa30('0x3d')](_0x1a3f64['where'],{'$or':_[_0xaa30('0x2d')](_0x484ffb,function(_0x1c8cd7){if(_0x1c8cd7[_0xaa30('0x31')]!==_0xaa30('0x3e')){var _0x554144={};_0x554144[_0x1c8cd7[_0xaa30('0x2a')]]={'$like':'%'+_0x46abb9[_0xaa30('0x32')][_0xaa30('0x3c')]+'%'};return _0x554144;}})});}_0x1a3f64=_[_0xaa30('0x3d')]({},_0x1a3f64,_0x46abb9[_0xaa30('0x3f')]);var _0x4f72a7={'where':_0x1a3f64[_0xaa30('0x3a')]};return db[_0xaa30('0x2e')][_0xaa30('0x1e')](_0x4f72a7)[_0xaa30('0x23')](function(_0x13f08f){_0x1fa8d4[_0xaa30('0x1e')]=_0x13f08f;if(_0x46abb9[_0xaa30('0x32')][_0xaa30('0x40')]){_0x1a3f64['include']=[{'all':!![]}];}return db['ContactItemType'][_0xaa30('0x41')](_0x1a3f64);})['then'](function(_0x5208f8){_0x1fa8d4['rows']=_0x5208f8;return _0x1fa8d4;})[_0xaa30('0x23')](respondWithFilteredResult(_0x40e4ee,_0x1a3f64))['catch'](handleError(_0x40e4ee,null));};exports[_0xaa30('0x42')]=function(_0x55f0bb,_0x421f79){var _0x3b892b={'raw':!![],'where':{'id':_0x55f0bb[_0xaa30('0x43')]['id']}},_0x3f530e={};_0x3f530e[_0xaa30('0x36')]=_[_0xaa30('0x33')](db[_0xaa30('0x2e')][_0xaa30('0x2f')]);_0x3f530e[_0xaa30('0x32')]=_[_0xaa30('0x33')](_0x55f0bb[_0xaa30('0x32')]);_0x3f530e['filters']=_[_0xaa30('0x44')](_0x3f530e[_0xaa30('0x36')],_0x3f530e[_0xaa30('0x32')]);_0x3b892b[_0xaa30('0x35')]=_[_0xaa30('0x44')](_0x3f530e['model'],qs['fields'](_0x55f0bb[_0xaa30('0x32')]['fields']));_0x3b892b[_0xaa30('0x35')]=_0x3b892b[_0xaa30('0x35')][_0xaa30('0x45')]?_0x3b892b[_0xaa30('0x35')]:_0x3f530e[_0xaa30('0x36')];if(_0x55f0bb[_0xaa30('0x32')][_0xaa30('0x40')]){_0x3b892b['include']=[{'all':!![]}];}_0x3b892b=_[_0xaa30('0x3d')]({},_0x3b892b,_0x55f0bb[_0xaa30('0x3f')]);return db[_0xaa30('0x2e')]['find'](_0x3b892b)[_0xaa30('0x23')](handleEntityNotFound(_0x421f79,null))[_0xaa30('0x23')](respondWithResult(_0x421f79,null))['catch'](handleError(_0x421f79,null));};exports[_0xaa30('0x46')]=function(_0x4a8fcc,_0x25d227){return db['ContactItemType']['create'](_0x4a8fcc[_0xaa30('0x47')],{})['then'](function(_0x56389c){var _0xf6a737=_0x4a8fcc[_0xaa30('0x48')][_0xaa30('0x24')]({'plain':!![]});if(!_0xf6a737)throw new Error(_0xaa30('0x49'));if(_0xf6a737[_0xaa30('0x4a')]===_0xaa30('0x48')){var _0x5616cd=_0x56389c[_0xaa30('0x24')]({'plain':!![]});var _0x17868d=_0xaa30('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x17868d,'userProfileId':_0xf6a737['userProfileId']},'raw':!![]})['then'](function(_0x998162){if(_0x998162&&_0x998162[_0xaa30('0x4b')]===0x0){return db[_0xaa30('0x26')][_0xaa30('0x46')]({'name':_0x5616cd[_0xaa30('0x2a')],'resourceId':_0x5616cd['id'],'type':_0x998162[_0xaa30('0x2a')],'sectionId':_0x998162['id']},{})['then'](function(){return _0x56389c;});}else{return _0x56389c;}})[_0xaa30('0x4c')](function(_0x2db9d5){logger[_0xaa30('0x28')](_0xaa30('0x4d'),_0x2db9d5);throw _0x2db9d5;});}return _0x56389c;})['then'](respondWithResult(_0x25d227,0xc9))[_0xaa30('0x4c')](handleError(_0x25d227,null));};exports[_0xaa30('0x22')]=function(_0x399007,_0x1edd3a){if(_0x399007[_0xaa30('0x47')]['id']){delete _0x399007['body']['id'];}return db['ContactItemType'][_0xaa30('0x4e')]({'where':{'id':_0x399007[_0xaa30('0x43')]['id']}})[_0xaa30('0x23')](handleEntityNotFound(_0x1edd3a,null))['then'](saveUpdates(_0x399007[_0xaa30('0x47')],null))['then'](respondWithResult(_0x1edd3a,null))[_0xaa30('0x4c')](handleError(_0x1edd3a,null));};exports[_0xaa30('0x4f')]=function(_0x483a01,_0x1fdca8){return db[_0xaa30('0x2e')]['find']({'where':{'id':_0x483a01[_0xaa30('0x43')]['id']}})['then'](handleEntityNotFound(_0x1fdca8,null))['then'](db[_0xaa30('0x50')][_0xaa30('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x483a01[_0xaa30('0x43')]['id']}}))['then'](removeEntity(_0x1fdca8,null))[_0xaa30('0x4c')](handleError(_0x1fdca8,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4c5a68d..b9ba9ff 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x550e=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes'];(function(_0x59dca3,_0x5ade34){var _0x1f2aba=function(_0xadaa62){while(--_0xadaa62){_0x59dca3['push'](_0x59dca3['shift']());}};_0x1f2aba(++_0x5ade34);}(_0x550e,0x162));var _0xe550=function(_0x2e1036,_0x2af8e0){_0x2e1036=_0x2e1036-0x0;var _0x47c474=_0x550e[_0x2e1036];return _0x47c474;};'use strict';var _=require(_0xe550('0x0'));var util=require(_0xe550('0x1'));var logger=require(_0xe550('0x2'))(_0xe550('0x3'));var moment=require(_0xe550('0x4'));var BPromise=require(_0xe550('0x5'));var rp=require(_0xe550('0x6'));var fs=require('fs');var path=require(_0xe550('0x7'));var rimraf=require(_0xe550('0x8'));var config=require('../../config/environment');var attributes=require(_0xe550('0x9'));module['exports']=function(_0x520701,_0x17c5fc){return _0x520701[_0xe550('0xa')](_0xe550('0xb'),attributes,{'tableName':_0xe550('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd59e=['tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType'];(function(_0x888608,_0x3e787f){var _0x113485=function(_0x46a168){while(--_0x46a168){_0x888608['push'](_0x888608['shift']());}};_0x113485(++_0x3e787f);}(_0xd59e,0x69));var _0xed59=function(_0x40f220,_0xef9391){_0x40f220=_0x40f220-0x0;var _0x1f338d=_0xd59e[_0x40f220];return _0x1f338d;};'use strict';var _=require(_0xed59('0x0'));var util=require('util');var logger=require(_0xed59('0x1'))(_0xed59('0x2'));var moment=require(_0xed59('0x3'));var BPromise=require(_0xed59('0x4'));var rp=require(_0xed59('0x5'));var fs=require('fs');var path=require(_0xed59('0x6'));var rimraf=require('rimraf');var config=require(_0xed59('0x7'));var attributes=require(_0xed59('0x8'));module[_0xed59('0x9')]=function(_0x8f0598,_0x5cdc0f){return _0x8f0598[_0xed59('0xa')](_0xed59('0xb'),attributes,{'tableName':_0xed59('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index b78cceb..1a3f770 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce33=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0xffa654,_0x4c734){var _0x5dd847=function(_0x64173a){while(--_0x64173a){_0xffa654['push'](_0xffa654['shift']());}};_0x5dd847(++_0x4c734);}(_0xce33,0x1f3));var _0x3ce3=function(_0x5c92a4,_0x819c46){_0x5c92a4=_0x5c92a4-0x0;var _0x2007e7=_0xce33[_0x5c92a4];return _0x2007e7;};'use strict';var _=require('lodash');var util=require(_0x3ce3('0x0'));var moment=require(_0x3ce3('0x1'));var BPromise=require(_0x3ce3('0x2'));var rs=require(_0x3ce3('0x3'));var fs=require('fs');var Redis=require(_0x3ce3('0x4'));var db=require(_0x3ce3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ce3('0x6'))(_0x3ce3('0x7'));var config=require(_0x3ce3('0x8'));var jayson=require(_0x3ce3('0x9'));var client=jayson[_0x3ce3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x205ba,_0x289739,_0x923bc3){return new BPromise(function(_0x5f32dd,_0x31c9ef){return client['request'](_0x205ba,_0x923bc3)['then'](function(_0x15b20b){logger['info'](_0x3ce3('0xb'),_0x289739,_0x3ce3('0xc'));logger[_0x3ce3('0xd')](_0x3ce3('0xe'),_0x289739,_0x3ce3('0xc'),JSON[_0x3ce3('0xf')](_0x15b20b));if(_0x15b20b[_0x3ce3('0x10')]){if(_0x15b20b[_0x3ce3('0x10')][_0x3ce3('0x11')]===0x1f4){logger[_0x3ce3('0x10')]('ContactItemType,\x20%s,\x20%s',_0x289739,_0x15b20b[_0x3ce3('0x10')][_0x3ce3('0x12')]);return _0x31c9ef(_0x15b20b['error'][_0x3ce3('0x12')]);}logger[_0x3ce3('0x10')]('ContactItemType,\x20%s,\x20%s',_0x289739,_0x15b20b[_0x3ce3('0x10')][_0x3ce3('0x12')]);return _0x5f32dd(_0x15b20b['error'][_0x3ce3('0x12')]);}else{logger[_0x3ce3('0x13')](_0x3ce3('0xb'),_0x289739,_0x3ce3('0xc'));_0x5f32dd(_0x15b20b['result']['message']);}})[_0x3ce3('0x14')](function(_0x56e8b3){logger[_0x3ce3('0x10')](_0x3ce3('0xb'),_0x289739,_0x56e8b3);_0x31c9ef(_0x56e8b3);});});} \ No newline at end of file +var _0xcec9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x2e4a0f,_0x3a9bb6){var _0x25a3cd=function(_0x1c614f){while(--_0x1c614f){_0x2e4a0f['push'](_0x2e4a0f['shift']());}};_0x25a3cd(++_0x3a9bb6);}(_0xcec9,0x164));var _0x9cec=function(_0x37ec7,_0x13460c){_0x37ec7=_0x37ec7-0x0;var _0x351c70=_0xcec9[_0x37ec7];return _0x351c70;};'use strict';var _=require(_0x9cec('0x0'));var util=require(_0x9cec('0x1'));var moment=require(_0x9cec('0x2'));var BPromise=require(_0x9cec('0x3'));var rs=require(_0x9cec('0x4'));var fs=require('fs');var Redis=require(_0x9cec('0x5'));var db=require(_0x9cec('0x6'))['db'];var utils=require(_0x9cec('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9cec('0x8'));var jayson=require(_0x9cec('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4075f4,_0x466b70,_0x2a998a){return new BPromise(function(_0x584d48,_0x2c0bfd){return client[_0x9cec('0xa')](_0x4075f4,_0x2a998a)[_0x9cec('0xb')](function(_0xfb2e85){logger[_0x9cec('0xc')](_0x9cec('0xd'),_0x466b70,_0x9cec('0xe'));logger[_0x9cec('0xf')](_0x9cec('0x10'),_0x466b70,_0x9cec('0xe'),JSON[_0x9cec('0x11')](_0xfb2e85));if(_0xfb2e85[_0x9cec('0x12')]){if(_0xfb2e85[_0x9cec('0x12')]['code']===0x1f4){logger[_0x9cec('0x12')](_0x9cec('0xd'),_0x466b70,_0xfb2e85[_0x9cec('0x12')][_0x9cec('0x13')]);return _0x2c0bfd(_0xfb2e85[_0x9cec('0x12')]['message']);}logger[_0x9cec('0x12')](_0x9cec('0xd'),_0x466b70,_0xfb2e85['error'][_0x9cec('0x13')]);return _0x584d48(_0xfb2e85[_0x9cec('0x12')][_0x9cec('0x13')]);}else{logger[_0x9cec('0xc')](_0x9cec('0xd'),_0x466b70,_0x9cec('0xe'));_0x584d48(_0xfb2e85[_0x9cec('0x14')][_0x9cec('0x13')]);}})['catch'](function(_0x10f333){logger[_0x9cec('0x12')](_0x9cec('0xd'),_0x466b70,_0x10f333);_0x2c0bfd(_0x10f333);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index a10f00c..4823fb7 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea35=['delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xea35,0x8e));var _0x5ea3=function(_0x1f01a7,_0x473999){_0x1f01a7=_0x1f01a7-0x0;var _0x220c65=_0xea35[_0x1f01a7];return _0x220c65;};'use strict';var multer=require(_0x5ea3('0x0'));var util=require(_0x5ea3('0x1'));var path=require(_0x5ea3('0x2'));var timeout=require(_0x5ea3('0x3'));var express=require('express');var router=express[_0x5ea3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ea3('0x5'));var interaction=require(_0x5ea3('0x6'));var config=require(_0x5ea3('0x7'));var controller=require(_0x5ea3('0x8'));router[_0x5ea3('0x9')]('/',auth[_0x5ea3('0xa')](),controller[_0x5ea3('0xb')]);router[_0x5ea3('0x9')](_0x5ea3('0xc'),auth['isAuthenticated'](),controller[_0x5ea3('0xd')]);router[_0x5ea3('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ea3('0xf')]);router[_0x5ea3('0x10')]('/:id',auth[_0x5ea3('0xa')](),controller[_0x5ea3('0x11')]);router[_0x5ea3('0x12')](_0x5ea3('0xc'),auth[_0x5ea3('0xa')](),controller['destroy']);module[_0x5ea3('0x13')]=router; \ No newline at end of file +var _0xfe65=['index','/:id','post','put','update','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated'];(function(_0x10a90a,_0x524ac2){var _0x57b51d=function(_0x3c6973){while(--_0x3c6973){_0x10a90a['push'](_0x10a90a['shift']());}};_0x57b51d(++_0x524ac2);}(_0xfe65,0x95));var _0x5fe6=function(_0x4f0bc0,_0x4b6788){_0x4f0bc0=_0x4f0bc0-0x0;var _0x324868=_0xfe65[_0x4f0bc0];return _0x324868;};'use strict';var multer=require('multer');var util=require(_0x5fe6('0x0'));var path=require('path');var timeout=require(_0x5fe6('0x1'));var express=require(_0x5fe6('0x2'));var router=express[_0x5fe6('0x3')]();var fs_extra=require(_0x5fe6('0x4'));var auth=require(_0x5fe6('0x5'));var interaction=require(_0x5fe6('0x6'));var config=require(_0x5fe6('0x7'));var controller=require(_0x5fe6('0x8'));router[_0x5fe6('0x9')]('/',auth[_0x5fe6('0xa')](),controller[_0x5fe6('0xb')]);router[_0x5fe6('0x9')](_0x5fe6('0xc'),auth[_0x5fe6('0xa')](),controller['show']);router[_0x5fe6('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5fe6('0xe')](_0x5fe6('0xc'),auth['isAuthenticated'](),controller[_0x5fe6('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a932a10..93ba198 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x33f4bf,_0x466cd1){var _0x2b51e1=function(_0x5ccca4){while(--_0x5ccca4){_0x33f4bf['push'](_0x33f4bf['shift']());}};_0x2b51e1(++_0x466cd1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x6a5a73,_0x4806d1){var _0x292e28=function(_0x6a8071){while(--_0x6a8071){_0x6a5a73['push'](_0x6a5a73['shift']());}};_0x292e28(++_0x4806d1);}(_0x2032,0xd9));var _0x2203=function(_0x30b391,_0x238485){_0x30b391=_0x30b391-0x0;var _0x152048=_0x2032[_0x30b391];return _0x152048;};'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 8f9ec6b..09b5883 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 _0x570e=['stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','catch','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','body','update','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrEmailAccounts','attrOpenchannelAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','order','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','then','destroy','get','CustomDashboards','UserProfileResource','end','error'];(function(_0x1baef6,_0x104b34){var _0x5f34a6=function(_0x4db449){while(--_0x4db449){_0x1baef6['push'](_0x1baef6['shift']());}};_0x5f34a6(++_0x104b34);}(_0x570e,0xd4));var _0xe570=function(_0x1226b3,_0x2e39c1){_0x1226b3=_0x1226b3-0x0;var _0x119703=_0x570e[_0x1226b3];return _0x119703;};'use strict';var emlformat=require(_0xe570('0x0'));var rimraf=require(_0xe570('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe570('0x2'));var rp=require(_0xe570('0x3'));var moment=require(_0xe570('0x4'));var BPromise=require(_0xe570('0x5'));var Mustache=require(_0xe570('0x6'));var util=require(_0xe570('0x7'));var path=require('path');var sox=require(_0xe570('0x8'));var csv=require(_0xe570('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe570('0xa'));var _=require(_0xe570('0xb'));var squel=require(_0xe570('0xc'));var crypto=require(_0xe570('0xd'));var jsforce=require(_0xe570('0xe'));var deskjs=require(_0xe570('0xf'));var toCsv=require(_0xe570('0x9'));var querystring=require(_0xe570('0x10'));var Papa=require(_0xe570('0x11'));var Redis=require(_0xe570('0x12'));var authService=require(_0xe570('0x13'));var qs=require(_0xe570('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe570('0x15'));var logger=require('../../config/logger')(_0xe570('0x16'));var utils=require('../../config/utils');var config=require(_0xe570('0x17'));var licenseUtil=require(_0xe570('0x18'));var db=require(_0xe570('0x19'))['db'];config[_0xe570('0x1a')]=_[_0xe570('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe570('0x1c'))(new Redis(config[_0xe570('0x1a')]));require(_0xe570('0x1d'))[_0xe570('0x1e')](socket);function respondWithStatusCode(_0x1df65f,_0x4d84cd){_0x4d84cd=_0x4d84cd||0xcc;return function(_0x46a7cf){if(_0x46a7cf){return _0x1df65f[_0xe570('0x1f')](_0x4d84cd);}return _0x1df65f[_0xe570('0x20')](_0x4d84cd)['end']();};}function respondWithResult(_0x4538fd,_0x522640){_0x522640=_0x522640||0xc8;return function(_0x37ed09){if(_0x37ed09){return _0x4538fd[_0xe570('0x20')](_0x522640)['json'](_0x37ed09);}};}function respondWithFilteredResult(_0xc9d8bf,_0x23e548){return function(_0x20bfc0){if(_0x20bfc0){var _0x494aaf=typeof _0x23e548[_0xe570('0x21')]==='undefined'&&typeof _0x23e548[_0xe570('0x22')]===_0xe570('0x23');var _0x3c0c06=_0x20bfc0[_0xe570('0x24')];var _0x4d70ee=_0x494aaf?0x0:_0x23e548[_0xe570('0x21')];var _0x2617aa=_0x494aaf?_0x20bfc0['count']:_0x23e548[_0xe570('0x21')]+_0x23e548[_0xe570('0x22')];var _0x45ef75;if(_0x2617aa>=_0x3c0c06){_0x2617aa=_0x3c0c06;_0x45ef75=0xc8;}else{_0x45ef75=0xce;}_0xc9d8bf[_0xe570('0x20')](_0x45ef75);return _0xc9d8bf[_0xe570('0x25')](_0xe570('0x26'),_0x4d70ee+'-'+_0x2617aa+'/'+_0x3c0c06)[_0xe570('0x27')](_0x20bfc0);}return null;};}function patchUpdates(_0x342c3c){return function(_0x1e1a2d){try{jsonpatch['apply'](_0x1e1a2d,_0x342c3c,!![]);}catch(_0x24d50a){return BPromise[_0xe570('0x28')](_0x24d50a);}return _0x1e1a2d['save']();};}function saveUpdates(_0x5591c1,_0x269d3c){return function(_0x35b8c8){if(_0x35b8c8){return _0x35b8c8['update'](_0x5591c1)[_0xe570('0x29')](function(_0x11f801){return _0x11f801;});}return null;};}function removeEntity(_0x399209,_0x3bddb2){return function(_0x36f14d){if(_0x36f14d){return _0x36f14d[_0xe570('0x2a')]()[_0xe570('0x29')](function(){var _0x5bc949=_0x36f14d[_0xe570('0x2b')]({'plain':!![]});var _0x4a1ec8=_0xe570('0x2c');return db[_0xe570('0x2d')]['destroy']({'where':{'type':_0x4a1ec8,'resourceId':_0x5bc949['id']}})[_0xe570('0x29')](function(){return _0x36f14d;});})[_0xe570('0x29')](function(){_0x399209[_0xe570('0x20')](0xcc)[_0xe570('0x2e')]();});}};}function handleEntityNotFound(_0x15004a,_0x4d1811){return function(_0x4409f0){if(!_0x4409f0){_0x15004a[_0xe570('0x1f')](0x194);}return _0x4409f0;};}function handleError(_0x3749af,_0xe4eab7){_0xe4eab7=_0xe4eab7||0x1f4;return function(_0x4183d7){logger[_0xe570('0x2f')](_0x4183d7[_0xe570('0x30')]);if(_0x4183d7[_0xe570('0x31')]){delete _0x4183d7[_0xe570('0x31')];}_0x3749af[_0xe570('0x20')](_0xe4eab7)['send'](_0x4183d7);};}exports[_0xe570('0x32')]=function(_0x44a390,_0x204f2a){var _0x573cd3={},_0x36ca39={},_0x34baf3={'count':0x0,'rows':[]};var _0x41c313=_[_0xe570('0x33')](db[_0xe570('0x34')][_0xe570('0x35')],function(_0x297018){return{'name':_0x297018[_0xe570('0x36')],'type':_0x297018[_0xe570('0x37')][_0xe570('0x38')]};});_0x36ca39[_0xe570('0x39')]=_[_0xe570('0x33')](_0x41c313,_0xe570('0x31'));_0x36ca39[_0xe570('0x3a')]=_['keys'](_0x44a390[_0xe570('0x3a')]);_0x36ca39[_0xe570('0x3b')]=_[_0xe570('0x3c')](_0x36ca39[_0xe570('0x39')],_0x36ca39['query']);_0x573cd3[_0xe570('0x3d')]=_['intersection'](_0x36ca39[_0xe570('0x39')],qs[_0xe570('0x3e')](_0x44a390['query'][_0xe570('0x3e')]));_0x573cd3['attributes']=_0x573cd3['attributes'][_0xe570('0x3f')]?_0x573cd3[_0xe570('0x3d')]:_0x36ca39[_0xe570('0x39')];if(!_0x44a390['query'][_0xe570('0x40')](_0xe570('0x41'))){_0x573cd3[_0xe570('0x22')]=qs[_0xe570('0x22')](_0x44a390[_0xe570('0x3a')][_0xe570('0x22')]);_0x573cd3['offset']=qs[_0xe570('0x21')](_0x44a390[_0xe570('0x3a')][_0xe570('0x21')]);}_0x573cd3['order']=qs[_0xe570('0x42')](_0x44a390[_0xe570('0x3a')][_0xe570('0x42')]);_0x573cd3['where']=qs[_0xe570('0x3b')](_[_0xe570('0x43')](_0x44a390[_0xe570('0x3a')],_0x36ca39[_0xe570('0x3b')]),_0x41c313);if(_0x44a390[_0xe570('0x3a')][_0xe570('0x44')]){_0x573cd3['where']=_[_0xe570('0x45')](_0x573cd3[_0xe570('0x46')],{'$or':_[_0xe570('0x33')](_0x41c313,function(_0x2f704b){if(_0x2f704b[_0xe570('0x37')]!==_0xe570('0x47')){var _0x157c8f={};_0x157c8f[_0x2f704b[_0xe570('0x31')]]={'$like':'%'+_0x44a390['query'][_0xe570('0x44')]+'%'};return _0x157c8f;}})});}_0x573cd3=_[_0xe570('0x45')]({},_0x573cd3,_0x44a390[_0xe570('0x48')]);var _0x469e9a={'where':_0x573cd3['where']};return db[_0xe570('0x34')][_0xe570('0x24')](_0x469e9a)['then'](function(_0x42feb0){_0x34baf3[_0xe570('0x24')]=_0x42feb0;if(_0x44a390[_0xe570('0x3a')]['includeAll']){_0x573cd3[_0xe570('0x49')]=[{'all':!![]}];}return db[_0xe570('0x34')]['findAll'](_0x573cd3);})[_0xe570('0x29')](function(_0x458c9f){_0x34baf3['rows']=_0x458c9f;return _0x34baf3;})[_0xe570('0x29')](respondWithFilteredResult(_0x204f2a,_0x573cd3))[_0xe570('0x4a')](handleError(_0x204f2a,null));};exports[_0xe570('0x4b')]=function(_0x2c8daf,_0x5ead23){var _0x3db2b4={'raw':![],'where':{'id':_0x2c8daf[_0xe570('0x4c')]['id']}},_0x5e6b7a={};_0x5e6b7a[_0xe570('0x39')]=_[_0xe570('0x4d')](db[_0xe570('0x34')][_0xe570('0x35')]);_0x5e6b7a[_0xe570('0x3a')]=_['keys'](_0x2c8daf[_0xe570('0x3a')]);_0x5e6b7a[_0xe570('0x3b')]=_['intersection'](_0x5e6b7a[_0xe570('0x39')],_0x5e6b7a['query']);_0x3db2b4['attributes']=_[_0xe570('0x3c')](_0x5e6b7a[_0xe570('0x39')],qs[_0xe570('0x3e')](_0x2c8daf[_0xe570('0x3a')][_0xe570('0x3e')]));_0x3db2b4[_0xe570('0x3d')]=_0x3db2b4[_0xe570('0x3d')][_0xe570('0x3f')]?_0x3db2b4['attributes']:_0x5e6b7a[_0xe570('0x39')];if(_0x2c8daf['query']['includeAll']){_0x3db2b4[_0xe570('0x49')]=[{'all':!![]}];}_0x3db2b4=_[_0xe570('0x45')]({},_0x3db2b4,_0x2c8daf[_0xe570('0x48')]);return db[_0xe570('0x34')]['find'](_0x3db2b4)[_0xe570('0x29')](handleEntityNotFound(_0x5ead23,null))[_0xe570('0x29')](respondWithResult(_0x5ead23,null))[_0xe570('0x4a')](handleError(_0x5ead23,null));};exports[_0xe570('0x4e')]=function(_0x2eff6d,_0x400937){return db[_0xe570('0x34')][_0xe570('0x4e')](_0x2eff6d['body'],{})[_0xe570('0x29')](function(_0x7a7148){var _0x288b0b=_0x2eff6d[_0xe570('0x4f')][_0xe570('0x2b')]({'plain':!![]});if(!_0x288b0b)throw new Error(_0xe570('0x50'));if(_0x288b0b[_0xe570('0x51')]===_0xe570('0x4f')){var _0x2610aa=_0x7a7148['get']({'plain':!![]});var _0x1a5352=_0xe570('0x2c');return db[_0xe570('0x52')][_0xe570('0x53')]({'where':{'name':_0x1a5352,'userProfileId':_0x288b0b[_0xe570('0x54')]},'raw':!![]})['then'](function(_0x4198c4){if(_0x4198c4&&_0x4198c4[_0xe570('0x55')]===0x0){return db['UserProfileResource'][_0xe570('0x4e')]({'name':_0x2610aa['name'],'resourceId':_0x2610aa['id'],'type':_0x4198c4['name'],'sectionId':_0x4198c4['id']},{})[_0xe570('0x29')](function(){return _0x7a7148;});}else{return _0x7a7148;}})[_0xe570('0x4a')](function(_0x5c8f02){logger[_0xe570('0x2f')](_0xe570('0x56'),_0x5c8f02);throw _0x5c8f02;});}return _0x7a7148;})[_0xe570('0x29')](respondWithResult(_0x400937,0xc9))[_0xe570('0x4a')](handleError(_0x400937,null));};exports[_0xe570('0x57')]=function(_0x163490,_0x2a9167){var _0x4d0b25={'where':{'id':_0x163490['params']['id']}},_0x507df6={};_0x507df6['model']=_[_0xe570('0x4d')](db['Dashboard'][_0xe570('0x35')]);_0x4d0b25[_0xe570('0x3d')]=_['intersection'](_0x507df6[_0xe570('0x39')],qs[_0xe570('0x3e')](_0x163490[_0xe570('0x3a')][_0xe570('0x3e')]));_0x4d0b25['attributes']=_0x4d0b25[_0xe570('0x3d')][_0xe570('0x3f')]?_0x4d0b25[_0xe570('0x3d')]:_0x507df6[_0xe570('0x39')];if(_0x163490[_0xe570('0x3a')][_0xe570('0x58')]){_0x4d0b25[_0xe570('0x49')]=[{'all':!![]}];}_0x4d0b25=_[_0xe570('0x45')]({},_0x4d0b25,_0x163490['options']);return db[_0xe570('0x34')][_0xe570('0x53')](_0x4d0b25)[_0xe570('0x29')](handleEntityNotFound(_0x2a9167,null))[_0xe570('0x29')](function(_0x36d893){if(_0x36d893){var _0x4f8181=_0x36d893[_0xe570('0x2b')]({'plain':!![]});_0x4f8181=qs[_0xe570('0x59')](_0x4f8181,['id',_0xe570('0x5a'),_0xe570('0x5b')]);_0x163490['body']=_[_0xe570('0x59')](_0x163490[_0xe570('0x5c')],['id',_0xe570('0x5a'),_0xe570('0x5b')]);return db[_0xe570('0x34')][_0xe570('0x4e')](_[_0xe570('0x45')](_0x4f8181,_0x163490[_0xe570('0x5c')]),{'include':_0x163490[_0xe570('0x3a')][_0xe570('0x58')]?[{'all':!![]}]:undefined})[_0xe570('0x29')](function(_0x3c913c){var _0x11b283=_0x163490[_0xe570('0x4f')][_0xe570('0x2b')]({'plain':!![]});if(!_0x11b283)throw new Error(_0xe570('0x50'));if(_0x11b283[_0xe570('0x51')]===_0xe570('0x4f')){var _0x4b0e8b=_0x3c913c['get']({'plain':!![]});var _0x1f03d9=_0xe570('0x2c');return db[_0xe570('0x52')][_0xe570('0x53')]({'where':{'name':_0x1f03d9,'userProfileId':_0x11b283[_0xe570('0x54')]},'raw':!![]})[_0xe570('0x29')](function(_0x58e6fe){if(_0x58e6fe&&_0x58e6fe[_0xe570('0x55')]===0x0){return db[_0xe570('0x2d')]['create']({'name':_0x4b0e8b[_0xe570('0x31')],'resourceId':_0x4b0e8b['id'],'type':_0x58e6fe['name'],'sectionId':_0x58e6fe['id']},{})[_0xe570('0x29')](function(){return _0x3c913c;});}else{return _0x3c913c;}})['catch'](function(_0x32a7da){logger[_0xe570('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a7da);throw _0x32a7da;});}return _0x3c913c;});}})[_0xe570('0x29')](respondWithResult(_0x2a9167,0xc9))[_0xe570('0x4a')](handleError(_0x2a9167,null));};exports[_0xe570('0x5d')]=function(_0x5249f4,_0x1da1fd){if(_0x5249f4['body']['id']){delete _0x5249f4[_0xe570('0x5c')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x5249f4[_0xe570('0x4c')]['id']}})[_0xe570('0x29')](handleEntityNotFound(_0x1da1fd,null))['then'](saveUpdates(_0x5249f4['body'],null))[_0xe570('0x29')](respondWithResult(_0x1da1fd,null))[_0xe570('0x4a')](handleError(_0x1da1fd,null));};exports[_0xe570('0x2a')]=function(_0x42f065,_0x4be508){return db[_0xe570('0x34')][_0xe570('0x53')]({'where':{'id':_0x42f065[_0xe570('0x4c')]['id']}})[_0xe570('0x29')](handleEntityNotFound(_0x4be508,null))['then'](removeEntity(_0x4be508,null))[_0xe570('0x4a')](handleError(_0x4be508,null));};function widgetAttributes(_0x34e182){try{switch(_0x34e182[_0xe570('0x37')]){case _0xe570('0x5e'):return[{'name':'attrUrl','value':_0x34e182[_0xe570('0x5f')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x0]?_0x34e182[_0xe570('0x60')][0x0][_0xe570('0x61')]:undefined)||_0xe570('0x62')}];case _0xe570('0x63'):return[{'name':'attrPath','value':_0x34e182['attrPath']||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x0]?_0x34e182[_0xe570('0x60')][0x0][_0xe570('0x61')]:undefined)||''}];case _0xe570('0x64'):return[{'name':_0xe570('0x65'),'value':_0x34e182['attrHourFormat']||(_0x34e182[_0xe570('0x60')]&&_0x34e182['attrs'][0x0]?_0x34e182['attrs'][0x0][_0xe570('0x61')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x34e182[_0xe570('0x66')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x1]?_0x34e182[_0xe570('0x60')][0x1][_0xe570('0x61')]:undefined)||_0xe570('0x67')},{'name':_0xe570('0x68'),'value':_0x34e182[_0xe570('0x68')]||(_0x34e182['attrs']&&_0x34e182['attrs'][0x2]?_0x34e182['attrs'][0x2][_0xe570('0x61')]:undefined)||0xc}];case'counter':return[{'name':_0xe570('0x69'),'value':_0x34e182[_0xe570('0x69')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182['attrs'][0x0]?_0x34e182[_0xe570('0x60')][0x0][_0xe570('0x61')]:undefined)||_0xe570('0x6a')},{'name':_0xe570('0x6b'),'value':_0x34e182[_0xe570('0x6b')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x1]?_0x34e182['attrs'][0x1][_0xe570('0x61')]:undefined)||[]},{'name':_0xe570('0x68'),'value':_0x34e182[_0xe570('0x68')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x2]?_0x34e182[_0xe570('0x60')][0x2][_0xe570('0x61')]:undefined)||0x14},{'name':_0xe570('0x6c'),'value':_0x34e182[_0xe570('0x6c')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182['attrs'][0x3]?_0x34e182['attrs'][0x3][_0xe570('0x61')]:undefined)||_0xe570('0x6d')},{'name':'attrEmailAccounts','value':_0x34e182['attrEmailAccounts']||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x4]?_0x34e182[_0xe570('0x60')][0x4][_0xe570('0x61')]:undefined)||''},{'name':_0xe570('0x6e'),'value':_0x34e182[_0xe570('0x6e')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182['attrs'][0x5]?_0x34e182[_0xe570('0x60')][0x5][_0xe570('0x61')]:undefined)||''},{'name':_0xe570('0x6f'),'value':_0x34e182[_0xe570('0x6f')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x6]?_0x34e182[_0xe570('0x60')][0x6][_0xe570('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x34e182['attrOpenchannelAccounts']||(_0x34e182['attrs']&&_0x34e182[_0xe570('0x60')][0x7]?_0x34e182[_0xe570('0x60')][0x7][_0xe570('0x61')]:undefined)||''},{'name':_0xe570('0x70'),'value':_0x34e182['attrWhatsappAccounts']||(_0x34e182[_0xe570('0x60')]&&_0x34e182['attrs'][0x8]?_0x34e182[_0xe570('0x60')][0x8]['value']:undefined)||''},{'name':_0xe570('0x71'),'value':_0x34e182['attrChatWebsites']||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x9]?_0x34e182[_0xe570('0x60')][0x9][_0xe570('0x61')]:undefined)||''}];case _0xe570('0x72'):case _0xe570('0x73'):return[{'name':'attrSerie1','value':_0x34e182['attrSerie1']||(_0x34e182['attrs']&&_0x34e182[_0xe570('0x60')][0x0]?_0x34e182['attrs'][0x0][_0xe570('0x61')]:undefined)||_0xe570('0x6a')},{'name':_0xe570('0x74'),'value':_0x34e182[_0xe570('0x74')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182['attrs'][0x1]?_0x34e182['attrs'][0x1][_0xe570('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0x34e182[_0xe570('0x75')]||(_0x34e182['attrs']&&_0x34e182[_0xe570('0x60')][0x2]?_0x34e182[_0xe570('0x60')][0x2][_0xe570('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x34e182[_0xe570('0x6b')]||(_0x34e182['attrs']&&_0x34e182[_0xe570('0x60')][0x3]?_0x34e182[_0xe570('0x60')][0x3][_0xe570('0x61')]:undefined)||[]},{'name':_0xe570('0x6c'),'value':_0x34e182['attrChannel']||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x4]?_0x34e182[_0xe570('0x60')][0x4][_0xe570('0x61')]:undefined)||_0xe570('0x6d')},{'name':_0xe570('0x76'),'value':_0x34e182[_0xe570('0x76')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182['attrs'][0x5]?_0x34e182[_0xe570('0x60')][0x5][_0xe570('0x61')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x34e182[_0xe570('0x6e')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x6]?_0x34e182[_0xe570('0x60')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x34e182['attrSmsAccounts']||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x7]?_0x34e182['attrs'][0x7]['value']:undefined)||''},{'name':_0xe570('0x77'),'value':_0x34e182[_0xe570('0x77')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x8]?_0x34e182[_0xe570('0x60')][0x8]['value']:undefined)||''},{'name':_0xe570('0x70'),'value':_0x34e182[_0xe570('0x70')]||(_0x34e182['attrs']&&_0x34e182[_0xe570('0x60')][0x9]?_0x34e182[_0xe570('0x60')][0x9][_0xe570('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x34e182[_0xe570('0x71')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182['attrs'][0xa]?_0x34e182[_0xe570('0x60')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xe570('0x78'),'type':_0x34e182[_0xe570('0x79')]||(_0x34e182['attrs']&&_0x34e182['attrs'][0x0]?_0x34e182[_0xe570('0x60')][0x0]['type']:undefined)||null,'value':_0x34e182[_0xe570('0x78')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x0]?_0x34e182['attrs'][0x0][_0xe570('0x61')]:undefined)||null},{'name':_0xe570('0x7a'),'value':_0x34e182[_0xe570('0x7a')]||(_0x34e182[_0xe570('0x60')]&&_0x34e182[_0xe570('0x60')][0x1]?_0x34e182[_0xe570('0x60')][0x1][_0xe570('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x3ed25c){logger[_0xe570('0x2f')](_0xe570('0x7b'),JSON['stringify'](_0x3ed25c));return[];}}exports[_0xe570('0x7c')]=function(_0x4196b1,_0x5889a5,_0x5f69b8){if(_0x4196b1[_0xe570('0x5c')]['id']){delete _0x4196b1[_0xe570('0x5c')]['id'];}return db[_0xe570('0x34')]['find']({'where':{'id':_0x4196b1[_0xe570('0x4c')]['id']}})[_0xe570('0x29')](handleEntityNotFound(_0x5889a5,null))[_0xe570('0x29')](function(_0xcc5c8f){if(_0xcc5c8f){_0x4196b1[_0xe570('0x5c')][_0xe570('0x7d')]=_0xcc5c8f['id'];_0x4196b1[_0xe570('0x5c')][_0xe570('0x60')]=widgetAttributes(_0x4196b1['body']);return db[_0xe570('0x7e')][_0xe570('0x4e')](_0x4196b1[_0xe570('0x5c')]);}})[_0xe570('0x29')](respondWithResult(_0x5889a5,null))[_0xe570('0x4a')](handleError(_0x5889a5,null));};exports[_0xe570('0x7f')]=function(_0x59f008,_0x40e712,_0x189076){var _0x1390b6={};var _0xb5e498={};var _0x4df9fa;var _0x4fe42c;return db[_0xe570('0x34')][_0xe570('0x80')]({'where':{'id':_0x59f008[_0xe570('0x4c')]['id']}})['then'](handleEntityNotFound(_0x40e712,null))[_0xe570('0x29')](function(_0xeb3645){if(_0xeb3645){_0x4df9fa=_0xeb3645;_0xb5e498['model']=_[_0xe570('0x4d')](db[_0xe570('0x7e')]['rawAttributes']);_0xb5e498[_0xe570('0x3a')]=_['keys'](_0x59f008[_0xe570('0x3a')]);_0xb5e498[_0xe570('0x3b')]=_['intersection'](_0xb5e498[_0xe570('0x39')],_0xb5e498['query']);_0x1390b6[_0xe570('0x3d')]=_[_0xe570('0x3c')](_0xb5e498[_0xe570('0x39')],qs[_0xe570('0x3e')](_0x59f008[_0xe570('0x3a')][_0xe570('0x3e')]));_0x1390b6[_0xe570('0x3d')]=_0x1390b6[_0xe570('0x3d')][_0xe570('0x3f')]?_0x1390b6[_0xe570('0x3d')]:_0xb5e498[_0xe570('0x39')];_0x1390b6[_0xe570('0x81')]=qs['sort'](_0x59f008[_0xe570('0x3a')][_0xe570('0x42')]);_0x1390b6[_0xe570('0x46')]=qs[_0xe570('0x3b')](_[_0xe570('0x43')](_0x59f008[_0xe570('0x3a')],_0xb5e498['filters']));if(_0x59f008['query'][_0xe570('0x44')]){_0x1390b6[_0xe570('0x46')]=_[_0xe570('0x45')](_0x1390b6['where'],{'$or':_[_0xe570('0x33')](_0x1390b6[_0xe570('0x3d')],function(_0x12772c){var _0x252af2={};_0x252af2[_0x12772c]={'$like':'%'+_0x59f008[_0xe570('0x3a')][_0xe570('0x44')]+'%'};return _0x252af2;})});}_0x1390b6=_[_0xe570('0x45')]({},_0x1390b6,_0x59f008['options']);return _0x4df9fa['getItems'](_0x1390b6);}})[_0xe570('0x29')](function(_0x36ccaf){if(_0x36ccaf){_0x4fe42c=_0x36ccaf['length'];if(!_0x59f008['query'][_0xe570('0x40')](_0xe570('0x41'))){_0x1390b6[_0xe570('0x22')]=qs[_0xe570('0x22')](_0x59f008[_0xe570('0x3a')][_0xe570('0x22')]);_0x1390b6[_0xe570('0x21')]=qs[_0xe570('0x21')](_0x59f008['query'][_0xe570('0x21')]);}return _0x4df9fa['getItems'](_0x1390b6);}})[_0xe570('0x29')](function(_0x253393){if(_0x253393){return _0x253393?{'count':_0x4fe42c,'rows':_0x253393}:null;}})[_0xe570('0x29')](respondWithResult(_0x40e712,null))[_0xe570('0x4a')](handleError(_0x40e712,null));}; \ No newline at end of file +var _0xc00f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','CustomDashboards','UserProfileSection','userProfileId','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x26ea06,_0x4a12b5){var _0x589e17=function(_0x3e57dc){while(--_0x3e57dc){_0x26ea06['push'](_0x26ea06['shift']());}};_0x589e17(++_0x4a12b5);}(_0xc00f,0x1d7));var _0xfc00=function(_0xb518e5,_0x5b627c){_0xb518e5=_0xb518e5-0x0;var _0x59c78e=_0xc00f[_0xb518e5];return _0x59c78e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc00('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc00('0x1'));var Mustache=require(_0xfc00('0x2'));var util=require(_0xfc00('0x3'));var path=require(_0xfc00('0x4'));var sox=require(_0xfc00('0x5'));var csv=require('to-csv');var ejs=require(_0xfc00('0x6'));var fs=require('fs');var fs_extra=require(_0xfc00('0x7'));var _=require(_0xfc00('0x8'));var squel=require(_0xfc00('0x9'));var crypto=require(_0xfc00('0xa'));var jsforce=require(_0xfc00('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfc00('0xc'));var querystring=require(_0xfc00('0xd'));var Papa=require(_0xfc00('0xe'));var Redis=require(_0xfc00('0xf'));var authService=require(_0xfc00('0x10'));var qs=require(_0xfc00('0x11'));var as=require(_0xfc00('0x12'));var hardwareService=require(_0xfc00('0x13'));var logger=require(_0xfc00('0x14'))('api');var utils=require(_0xfc00('0x15'));var config=require(_0xfc00('0x16'));var licenseUtil=require(_0xfc00('0x17'));var db=require(_0xfc00('0x18'))['db'];config['redis']=_[_0xfc00('0x19')](config['redis'],{'host':_0xfc00('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc00('0x1b')]));require(_0xfc00('0x1c'))[_0xfc00('0x1d')](socket);function respondWithStatusCode(_0x186a90,_0xd3c961){_0xd3c961=_0xd3c961||0xcc;return function(_0x58ea8d){if(_0x58ea8d){return _0x186a90[_0xfc00('0x1e')](_0xd3c961);}return _0x186a90[_0xfc00('0x1f')](_0xd3c961)[_0xfc00('0x20')]();};}function respondWithResult(_0x52649b,_0x4030d9){_0x4030d9=_0x4030d9||0xc8;return function(_0x4a4852){if(_0x4a4852){return _0x52649b[_0xfc00('0x1f')](_0x4030d9)[_0xfc00('0x21')](_0x4a4852);}};}function respondWithFilteredResult(_0x5f3412,_0x480cfa){return function(_0x4b3142){if(_0x4b3142){var _0x47f19a=typeof _0x480cfa[_0xfc00('0x22')]==='undefined'&&typeof _0x480cfa[_0xfc00('0x23')]===_0xfc00('0x24');var _0x5d3c41=_0x4b3142[_0xfc00('0x25')];var _0x14d623=_0x47f19a?0x0:_0x480cfa[_0xfc00('0x22')];var _0x82c148=_0x47f19a?_0x4b3142[_0xfc00('0x25')]:_0x480cfa['offset']+_0x480cfa['limit'];var _0x253ab6;if(_0x82c148>=_0x5d3c41){_0x82c148=_0x5d3c41;_0x253ab6=0xc8;}else{_0x253ab6=0xce;}_0x5f3412[_0xfc00('0x1f')](_0x253ab6);return _0x5f3412['set'](_0xfc00('0x26'),_0x14d623+'-'+_0x82c148+'/'+_0x5d3c41)[_0xfc00('0x21')](_0x4b3142);}return null;};}function patchUpdates(_0x3cecdc){return function(_0x7c0172){try{jsonpatch[_0xfc00('0x27')](_0x7c0172,_0x3cecdc,!![]);}catch(_0x1aed7d){return BPromise[_0xfc00('0x28')](_0x1aed7d);}return _0x7c0172[_0xfc00('0x29')]();};}function saveUpdates(_0x1c012a,_0x42443b){return function(_0x2f32c6){if(_0x2f32c6){return _0x2f32c6[_0xfc00('0x2a')](_0x1c012a)[_0xfc00('0x2b')](function(_0x1e42f9){return _0x1e42f9;});}return null;};}function removeEntity(_0xc6d0b5,_0x2f0f55){return function(_0x3b7ed0){if(_0x3b7ed0){return _0x3b7ed0[_0xfc00('0x2c')]()[_0xfc00('0x2b')](function(){var _0x1c07f7=_0x3b7ed0['get']({'plain':!![]});var _0x299e30='CustomDashboards';return db[_0xfc00('0x2d')][_0xfc00('0x2c')]({'where':{'type':_0x299e30,'resourceId':_0x1c07f7['id']}})[_0xfc00('0x2b')](function(){return _0x3b7ed0;});})[_0xfc00('0x2b')](function(){_0xc6d0b5['status'](0xcc)[_0xfc00('0x20')]();});}};}function handleEntityNotFound(_0x191fa7,_0x46461e){return function(_0x16ddd0){if(!_0x16ddd0){_0x191fa7[_0xfc00('0x1e')](0x194);}return _0x16ddd0;};}function handleError(_0x59d819,_0x375fc1){_0x375fc1=_0x375fc1||0x1f4;return function(_0x483c63){logger[_0xfc00('0x2e')](_0x483c63[_0xfc00('0x2f')]);if(_0x483c63[_0xfc00('0x30')]){delete _0x483c63[_0xfc00('0x30')];}_0x59d819[_0xfc00('0x1f')](_0x375fc1)['send'](_0x483c63);};}exports[_0xfc00('0x31')]=function(_0x333bc7,_0x1b35b0){var _0x550e6f={},_0xf324ca={},_0x1ee2a4={'count':0x0,'rows':[]};var _0xc87948=_[_0xfc00('0x32')](db[_0xfc00('0x33')][_0xfc00('0x34')],function(_0x2b3798){return{'name':_0x2b3798[_0xfc00('0x35')],'type':_0x2b3798[_0xfc00('0x36')][_0xfc00('0x37')]};});_0xf324ca[_0xfc00('0x38')]=_[_0xfc00('0x32')](_0xc87948,_0xfc00('0x30'));_0xf324ca[_0xfc00('0x39')]=_[_0xfc00('0x3a')](_0x333bc7[_0xfc00('0x39')]);_0xf324ca[_0xfc00('0x3b')]=_[_0xfc00('0x3c')](_0xf324ca[_0xfc00('0x38')],_0xf324ca[_0xfc00('0x39')]);_0x550e6f[_0xfc00('0x3d')]=_[_0xfc00('0x3c')](_0xf324ca[_0xfc00('0x38')],qs['fields'](_0x333bc7[_0xfc00('0x39')][_0xfc00('0x3e')]));_0x550e6f['attributes']=_0x550e6f['attributes'][_0xfc00('0x3f')]?_0x550e6f[_0xfc00('0x3d')]:_0xf324ca[_0xfc00('0x38')];if(!_0x333bc7[_0xfc00('0x39')][_0xfc00('0x40')](_0xfc00('0x41'))){_0x550e6f[_0xfc00('0x23')]=qs[_0xfc00('0x23')](_0x333bc7[_0xfc00('0x39')]['limit']);_0x550e6f[_0xfc00('0x22')]=qs[_0xfc00('0x22')](_0x333bc7['query'][_0xfc00('0x22')]);}_0x550e6f[_0xfc00('0x42')]=qs[_0xfc00('0x43')](_0x333bc7[_0xfc00('0x39')]['sort']);_0x550e6f[_0xfc00('0x44')]=qs[_0xfc00('0x3b')](_[_0xfc00('0x45')](_0x333bc7[_0xfc00('0x39')],_0xf324ca[_0xfc00('0x3b')]),_0xc87948);if(_0x333bc7[_0xfc00('0x39')][_0xfc00('0x46')]){_0x550e6f[_0xfc00('0x44')]=_[_0xfc00('0x47')](_0x550e6f[_0xfc00('0x44')],{'$or':_['map'](_0xc87948,function(_0xb7f2e7){if(_0xb7f2e7[_0xfc00('0x36')]!==_0xfc00('0x48')){var _0x85ea20={};_0x85ea20[_0xb7f2e7[_0xfc00('0x30')]]={'$like':'%'+_0x333bc7[_0xfc00('0x39')]['filter']+'%'};return _0x85ea20;}})});}_0x550e6f=_['merge']({},_0x550e6f,_0x333bc7[_0xfc00('0x49')]);var _0x31219c={'where':_0x550e6f[_0xfc00('0x44')]};return db[_0xfc00('0x33')][_0xfc00('0x25')](_0x31219c)[_0xfc00('0x2b')](function(_0x162e18){_0x1ee2a4[_0xfc00('0x25')]=_0x162e18;if(_0x333bc7['query'][_0xfc00('0x4a')]){_0x550e6f['include']=[{'all':!![]}];}return db[_0xfc00('0x33')][_0xfc00('0x4b')](_0x550e6f);})[_0xfc00('0x2b')](function(_0x1bf9e3){_0x1ee2a4['rows']=_0x1bf9e3;return _0x1ee2a4;})[_0xfc00('0x2b')](respondWithFilteredResult(_0x1b35b0,_0x550e6f))[_0xfc00('0x4c')](handleError(_0x1b35b0,null));};exports[_0xfc00('0x4d')]=function(_0x1683b9,_0x5006bd){var _0x3fbcfa={'raw':![],'where':{'id':_0x1683b9[_0xfc00('0x4e')]['id']}},_0x4c2a82={};_0x4c2a82[_0xfc00('0x38')]=_[_0xfc00('0x3a')](db[_0xfc00('0x33')][_0xfc00('0x34')]);_0x4c2a82['query']=_[_0xfc00('0x3a')](_0x1683b9[_0xfc00('0x39')]);_0x4c2a82[_0xfc00('0x3b')]=_[_0xfc00('0x3c')](_0x4c2a82[_0xfc00('0x38')],_0x4c2a82['query']);_0x3fbcfa[_0xfc00('0x3d')]=_['intersection'](_0x4c2a82[_0xfc00('0x38')],qs['fields'](_0x1683b9[_0xfc00('0x39')][_0xfc00('0x3e')]));_0x3fbcfa['attributes']=_0x3fbcfa[_0xfc00('0x3d')][_0xfc00('0x3f')]?_0x3fbcfa[_0xfc00('0x3d')]:_0x4c2a82[_0xfc00('0x38')];if(_0x1683b9[_0xfc00('0x39')][_0xfc00('0x4a')]){_0x3fbcfa[_0xfc00('0x4f')]=[{'all':!![]}];}_0x3fbcfa=_[_0xfc00('0x47')]({},_0x3fbcfa,_0x1683b9['options']);return db['Dashboard'][_0xfc00('0x50')](_0x3fbcfa)['then'](handleEntityNotFound(_0x5006bd,null))[_0xfc00('0x2b')](respondWithResult(_0x5006bd,null))[_0xfc00('0x4c')](handleError(_0x5006bd,null));};exports['create']=function(_0x4f78b2,_0x1581a5){return db[_0xfc00('0x33')][_0xfc00('0x51')](_0x4f78b2[_0xfc00('0x52')],{})['then'](function(_0x100a39){var _0x5ca353=_0x4f78b2[_0xfc00('0x53')][_0xfc00('0x54')]({'plain':!![]});if(!_0x5ca353)throw new Error(_0xfc00('0x55'));if(_0x5ca353[_0xfc00('0x56')]===_0xfc00('0x53')){var _0x535f70=_0x100a39['get']({'plain':!![]});var _0x1c6318='CustomDashboards';return db['UserProfileSection'][_0xfc00('0x50')]({'where':{'name':_0x1c6318,'userProfileId':_0x5ca353['userProfileId']},'raw':!![]})[_0xfc00('0x2b')](function(_0x140275){if(_0x140275&&_0x140275[_0xfc00('0x57')]===0x0){return db[_0xfc00('0x2d')][_0xfc00('0x51')]({'name':_0x535f70[_0xfc00('0x30')],'resourceId':_0x535f70['id'],'type':_0x140275['name'],'sectionId':_0x140275['id']},{})[_0xfc00('0x2b')](function(){return _0x100a39;});}else{return _0x100a39;}})[_0xfc00('0x4c')](function(_0x3864cc){logger[_0xfc00('0x2e')](_0xfc00('0x58'),_0x3864cc);throw _0x3864cc;});}return _0x100a39;})['then'](respondWithResult(_0x1581a5,0xc9))['catch'](handleError(_0x1581a5,null));};exports[_0xfc00('0x59')]=function(_0x4ada42,_0x3dd6f4){var _0x470c2f={'where':{'id':_0x4ada42[_0xfc00('0x4e')]['id']}},_0x2e96f3={};_0x2e96f3[_0xfc00('0x38')]=_[_0xfc00('0x3a')](db['Dashboard'][_0xfc00('0x34')]);_0x470c2f['attributes']=_[_0xfc00('0x3c')](_0x2e96f3[_0xfc00('0x38')],qs[_0xfc00('0x3e')](_0x4ada42[_0xfc00('0x39')][_0xfc00('0x3e')]));_0x470c2f[_0xfc00('0x3d')]=_0x470c2f[_0xfc00('0x3d')]['length']?_0x470c2f[_0xfc00('0x3d')]:_0x2e96f3['model'];if(_0x4ada42['query'][_0xfc00('0x4a')]){_0x470c2f[_0xfc00('0x4f')]=[{'all':!![]}];}_0x470c2f=_['merge']({},_0x470c2f,_0x4ada42[_0xfc00('0x49')]);return db['Dashboard'][_0xfc00('0x50')](_0x470c2f)['then'](handleEntityNotFound(_0x3dd6f4,null))['then'](function(_0x8e723d){if(_0x8e723d){var _0x302b9e=_0x8e723d[_0xfc00('0x54')]({'plain':!![]});_0x302b9e=qs[_0xfc00('0x5a')](_0x302b9e,['id',_0xfc00('0x5b'),'updatedAt']);_0x4ada42[_0xfc00('0x52')]=_[_0xfc00('0x5a')](_0x4ada42[_0xfc00('0x52')],['id',_0xfc00('0x5b'),_0xfc00('0x5c')]);return db[_0xfc00('0x33')]['create'](_['merge'](_0x302b9e,_0x4ada42[_0xfc00('0x52')]),{'include':_0x4ada42[_0xfc00('0x39')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x139bc6){var _0x33f726=_0x4ada42[_0xfc00('0x53')][_0xfc00('0x54')]({'plain':!![]});if(!_0x33f726)throw new Error(_0xfc00('0x55'));if(_0x33f726[_0xfc00('0x56')]===_0xfc00('0x53')){var _0x1bd36f=_0x139bc6['get']({'plain':!![]});var _0x265fcb=_0xfc00('0x5d');return db[_0xfc00('0x5e')]['find']({'where':{'name':_0x265fcb,'userProfileId':_0x33f726[_0xfc00('0x5f')]},'raw':!![]})[_0xfc00('0x2b')](function(_0x1bff24){if(_0x1bff24&&_0x1bff24['autoAssociation']===0x0){return db[_0xfc00('0x2d')][_0xfc00('0x51')]({'name':_0x1bd36f[_0xfc00('0x30')],'resourceId':_0x1bd36f['id'],'type':_0x1bff24[_0xfc00('0x30')],'sectionId':_0x1bff24['id']},{})['then'](function(){return _0x139bc6;});}else{return _0x139bc6;}})['catch'](function(_0x2eb0b7){logger[_0xfc00('0x2e')](_0xfc00('0x58'),_0x2eb0b7);throw _0x2eb0b7;});}return _0x139bc6;});}})[_0xfc00('0x2b')](respondWithResult(_0x3dd6f4,0xc9))[_0xfc00('0x4c')](handleError(_0x3dd6f4,null));};exports[_0xfc00('0x2a')]=function(_0xb2ee40,_0x2b6662){if(_0xb2ee40[_0xfc00('0x52')]['id']){delete _0xb2ee40[_0xfc00('0x52')]['id'];}return db[_0xfc00('0x33')][_0xfc00('0x50')]({'where':{'id':_0xb2ee40['params']['id']}})[_0xfc00('0x2b')](handleEntityNotFound(_0x2b6662,null))[_0xfc00('0x2b')](saveUpdates(_0xb2ee40[_0xfc00('0x52')],null))[_0xfc00('0x2b')](respondWithResult(_0x2b6662,null))[_0xfc00('0x4c')](handleError(_0x2b6662,null));};exports['destroy']=function(_0x39deb5,_0x742a7){return db[_0xfc00('0x33')][_0xfc00('0x50')]({'where':{'id':_0x39deb5[_0xfc00('0x4e')]['id']}})['then'](handleEntityNotFound(_0x742a7,null))[_0xfc00('0x2b')](removeEntity(_0x742a7,null))[_0xfc00('0x4c')](handleError(_0x742a7,null));};function widgetAttributes(_0x5a6f67){try{switch(_0x5a6f67[_0xfc00('0x36')]){case _0xfc00('0x60'):return[{'name':_0xfc00('0x61'),'value':_0x5a6f67[_0xfc00('0x61')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x0]?_0x5a6f67[_0xfc00('0x62')][0x0][_0xfc00('0x63')]:undefined)||_0xfc00('0x64')}];case'custom':return[{'name':_0xfc00('0x65'),'value':_0x5a6f67['attrPath']||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x0]?_0x5a6f67[_0xfc00('0x62')][0x0]['value']:undefined)||''}];case _0xfc00('0x66'):return[{'name':_0xfc00('0x67'),'value':_0x5a6f67[_0xfc00('0x67')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67['attrs'][0x0]?_0x5a6f67[_0xfc00('0x62')][0x0][_0xfc00('0x63')]:undefined)||_0xfc00('0x68')},{'name':'attrTimezone','value':_0x5a6f67[_0xfc00('0x69')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x1]?_0x5a6f67[_0xfc00('0x62')][0x1][_0xfc00('0x63')]:undefined)||_0xfc00('0x6a')},{'name':_0xfc00('0x6b'),'value':_0x5a6f67[_0xfc00('0x6b')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67['attrs'][0x2]?_0x5a6f67[_0xfc00('0x62')][0x2][_0xfc00('0x63')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x5a6f67[_0xfc00('0x6c')]||(_0x5a6f67['attrs']&&_0x5a6f67[_0xfc00('0x62')][0x0]?_0x5a6f67[_0xfc00('0x62')][0x0]['value']:undefined)||'total'},{'name':_0xfc00('0x6d'),'value':_0x5a6f67['attrVoiceQueues']||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x1]?_0x5a6f67[_0xfc00('0x62')][0x1][_0xfc00('0x63')]:undefined)||[]},{'name':'attrFontSize','value':_0x5a6f67[_0xfc00('0x6b')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67['attrs'][0x2]?_0x5a6f67[_0xfc00('0x62')][0x2][_0xfc00('0x63')]:undefined)||0x14},{'name':_0xfc00('0x6e'),'value':_0x5a6f67[_0xfc00('0x6e')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67['attrs'][0x3]?_0x5a6f67[_0xfc00('0x62')][0x3]['value']:undefined)||_0xfc00('0x6f')},{'name':_0xfc00('0x70'),'value':_0x5a6f67[_0xfc00('0x70')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x4]?_0x5a6f67[_0xfc00('0x62')][0x4][_0xfc00('0x63')]:undefined)||''},{'name':_0xfc00('0x71'),'value':_0x5a6f67['attrFaxAccounts']||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x5]?_0x5a6f67['attrs'][0x5][_0xfc00('0x63')]:undefined)||''},{'name':_0xfc00('0x72'),'value':_0x5a6f67[_0xfc00('0x72')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x6]?_0x5a6f67[_0xfc00('0x62')][0x6][_0xfc00('0x63')]:undefined)||''},{'name':_0xfc00('0x73'),'value':_0x5a6f67[_0xfc00('0x73')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x7]?_0x5a6f67[_0xfc00('0x62')][0x7][_0xfc00('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5a6f67[_0xfc00('0x74')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67['attrs'][0x8]?_0x5a6f67['attrs'][0x8][_0xfc00('0x63')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5a6f67[_0xfc00('0x75')]||(_0x5a6f67['attrs']&&_0x5a6f67[_0xfc00('0x62')][0x9]?_0x5a6f67[_0xfc00('0x62')][0x9]['value']:undefined)||''}];case _0xfc00('0x76'):case _0xfc00('0x77'):return[{'name':_0xfc00('0x78'),'value':_0x5a6f67['attrSerie1']||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x0]?_0x5a6f67[_0xfc00('0x62')][0x0][_0xfc00('0x63')]:undefined)||_0xfc00('0x79')},{'name':_0xfc00('0x7a'),'value':_0x5a6f67['attrSerie2']||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x1]?_0x5a6f67[_0xfc00('0x62')][0x1][_0xfc00('0x63')]:undefined)||null},{'name':_0xfc00('0x7b'),'value':_0x5a6f67[_0xfc00('0x7b')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x2]?_0x5a6f67[_0xfc00('0x62')][0x2][_0xfc00('0x63')]:undefined)||null},{'name':_0xfc00('0x6d'),'value':_0x5a6f67[_0xfc00('0x6d')]||(_0x5a6f67['attrs']&&_0x5a6f67[_0xfc00('0x62')][0x3]?_0x5a6f67[_0xfc00('0x62')][0x3][_0xfc00('0x63')]:undefined)||[]},{'name':_0xfc00('0x6e'),'value':_0x5a6f67[_0xfc00('0x6e')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x4]?_0x5a6f67['attrs'][0x4][_0xfc00('0x63')]:undefined)||_0xfc00('0x6f')},{'name':_0xfc00('0x70'),'value':_0x5a6f67[_0xfc00('0x70')]||(_0x5a6f67['attrs']&&_0x5a6f67[_0xfc00('0x62')][0x5]?_0x5a6f67[_0xfc00('0x62')][0x5][_0xfc00('0x63')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5a6f67['attrFaxAccounts']||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x6]?_0x5a6f67[_0xfc00('0x62')][0x6]['value']:undefined)||''},{'name':_0xfc00('0x72'),'value':_0x5a6f67[_0xfc00('0x72')]||(_0x5a6f67['attrs']&&_0x5a6f67['attrs'][0x7]?_0x5a6f67[_0xfc00('0x62')][0x7]['value']:undefined)||''},{'name':_0xfc00('0x73'),'value':_0x5a6f67['attrOpenchannelAccounts']||(_0x5a6f67['attrs']&&_0x5a6f67['attrs'][0x8]?_0x5a6f67['attrs'][0x8]['value']:undefined)||''},{'name':_0xfc00('0x74'),'value':_0x5a6f67[_0xfc00('0x74')]||(_0x5a6f67['attrs']&&_0x5a6f67[_0xfc00('0x62')][0x9]?_0x5a6f67[_0xfc00('0x62')][0x9][_0xfc00('0x63')]:undefined)||''},{'name':_0xfc00('0x75'),'value':_0x5a6f67[_0xfc00('0x75')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0xa]?_0x5a6f67[_0xfc00('0x62')][0xa]['value']:undefined)||''}];case _0xfc00('0x7c'):return[{'name':'attrReport','type':_0x5a6f67['reportType']||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x0]?_0x5a6f67['attrs'][0x0][_0xfc00('0x36')]:undefined)||null,'value':_0x5a6f67[_0xfc00('0x7d')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67[_0xfc00('0x62')][0x0]?_0x5a6f67[_0xfc00('0x62')][0x0][_0xfc00('0x63')]:undefined)||null},{'name':_0xfc00('0x7e'),'value':_0x5a6f67[_0xfc00('0x7e')]||(_0x5a6f67[_0xfc00('0x62')]&&_0x5a6f67['attrs'][0x1]?_0x5a6f67[_0xfc00('0x62')][0x1][_0xfc00('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x3075e9){logger[_0xfc00('0x2e')]('widgetAttributes:\x20%s',JSON[_0xfc00('0x7f')](_0x3075e9));return[];}}exports[_0xfc00('0x80')]=function(_0x1b40fb,_0x5afe1e,_0x32f789){if(_0x1b40fb[_0xfc00('0x52')]['id']){delete _0x1b40fb['body']['id'];}return db[_0xfc00('0x33')][_0xfc00('0x50')]({'where':{'id':_0x1b40fb[_0xfc00('0x4e')]['id']}})[_0xfc00('0x2b')](handleEntityNotFound(_0x5afe1e,null))[_0xfc00('0x2b')](function(_0xf3eb8d){if(_0xf3eb8d){_0x1b40fb[_0xfc00('0x52')][_0xfc00('0x81')]=_0xf3eb8d['id'];_0x1b40fb['body']['attrs']=widgetAttributes(_0x1b40fb[_0xfc00('0x52')]);return db[_0xfc00('0x82')][_0xfc00('0x51')](_0x1b40fb[_0xfc00('0x52')]);}})[_0xfc00('0x2b')](respondWithResult(_0x5afe1e,null))[_0xfc00('0x4c')](handleError(_0x5afe1e,null));};exports[_0xfc00('0x83')]=function(_0x5b0f7a,_0x30dcd0,_0x4262e3){var _0x2acbef={};var _0x2660c9={};var _0x73fabb;var _0x671788;return db['Dashboard'][_0xfc00('0x84')]({'where':{'id':_0x5b0f7a['params']['id']}})['then'](handleEntityNotFound(_0x30dcd0,null))[_0xfc00('0x2b')](function(_0x57f7a6){if(_0x57f7a6){_0x73fabb=_0x57f7a6;_0x2660c9[_0xfc00('0x38')]=_[_0xfc00('0x3a')](db[_0xfc00('0x82')]['rawAttributes']);_0x2660c9[_0xfc00('0x39')]=_['keys'](_0x5b0f7a[_0xfc00('0x39')]);_0x2660c9['filters']=_[_0xfc00('0x3c')](_0x2660c9['model'],_0x2660c9[_0xfc00('0x39')]);_0x2acbef['attributes']=_[_0xfc00('0x3c')](_0x2660c9['model'],qs['fields'](_0x5b0f7a[_0xfc00('0x39')]['fields']));_0x2acbef[_0xfc00('0x3d')]=_0x2acbef[_0xfc00('0x3d')][_0xfc00('0x3f')]?_0x2acbef[_0xfc00('0x3d')]:_0x2660c9['model'];_0x2acbef[_0xfc00('0x42')]=qs[_0xfc00('0x43')](_0x5b0f7a[_0xfc00('0x39')][_0xfc00('0x43')]);_0x2acbef[_0xfc00('0x44')]=qs['filters'](_['pick'](_0x5b0f7a[_0xfc00('0x39')],_0x2660c9['filters']));if(_0x5b0f7a[_0xfc00('0x39')][_0xfc00('0x46')]){_0x2acbef[_0xfc00('0x44')]=_[_0xfc00('0x47')](_0x2acbef[_0xfc00('0x44')],{'$or':_[_0xfc00('0x32')](_0x2acbef[_0xfc00('0x3d')],function(_0xa7192){var _0x1405b2={};_0x1405b2[_0xa7192]={'$like':'%'+_0x5b0f7a['query'][_0xfc00('0x46')]+'%'};return _0x1405b2;})});}_0x2acbef=_[_0xfc00('0x47')]({},_0x2acbef,_0x5b0f7a[_0xfc00('0x49')]);return _0x73fabb[_0xfc00('0x83')](_0x2acbef);}})[_0xfc00('0x2b')](function(_0x3ea914){if(_0x3ea914){_0x671788=_0x3ea914[_0xfc00('0x3f')];if(!_0x5b0f7a[_0xfc00('0x39')][_0xfc00('0x40')](_0xfc00('0x41'))){_0x2acbef[_0xfc00('0x23')]=qs[_0xfc00('0x23')](_0x5b0f7a[_0xfc00('0x39')]['limit']);_0x2acbef['offset']=qs[_0xfc00('0x22')](_0x5b0f7a[_0xfc00('0x39')][_0xfc00('0x22')]);}return _0x73fabb[_0xfc00('0x83')](_0x2acbef);}})[_0xfc00('0x2b')](function(_0x728c27){if(_0x728c27){return _0x728c27?{'count':_0x671788,'rows':_0x728c27}:null;}})['then'](respondWithResult(_0x30dcd0,null))[_0xfc00('0x4c')](handleError(_0x30dcd0,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8eec909..ae2567f 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 _0x8dd4=['hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0xeeca45,_0x5ce4af){var _0x366bcb=function(_0x411cd5){while(--_0x411cd5){_0xeeca45['push'](_0xeeca45['shift']());}};_0x366bcb(++_0x5ce4af);}(_0x8dd4,0x142));var _0x48dd=function(_0x3c514,_0x2893b5){_0x3c514=_0x3c514-0x0;var _0x3dcec8=_0x8dd4[_0x3c514];return _0x3dcec8;};'use strict';var EventEmitter=require(_0x48dd('0x0'));var Dashboard=require(_0x48dd('0x1'))['db'][_0x48dd('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x48dd('0x3')](0x0);var events={'afterCreate':_0x48dd('0x4'),'afterUpdate':_0x48dd('0x5'),'afterDestroy':_0x48dd('0x6')};function emitEvent(_0x3f6a02){return function(_0x1d1ee7,_0x333632,_0x3dc538){DashboardEvents[_0x48dd('0x7')](_0x3f6a02+':'+_0x1d1ee7['id'],_0x1d1ee7);DashboardEvents[_0x48dd('0x7')](_0x3f6a02,_0x1d1ee7);_0x3dc538(null);};}for(var e in events){if(events[_0x48dd('0x8')](e)){var event=events[e];Dashboard[_0x48dd('0x9')](e,emitEvent(event));}}module[_0x48dd('0xa')]=DashboardEvents; \ No newline at end of file +var _0x7953=['hook','exports','events','../../mysqldb','Dashboard','save','remove','emit','hasOwnProperty'];(function(_0x119175,_0xbf50a8){var _0x514223=function(_0xf05c03){while(--_0xf05c03){_0x119175['push'](_0x119175['shift']());}};_0x514223(++_0xbf50a8);}(_0x7953,0x1c4));var _0x3795=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x7953[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x3795('0x0'));var Dashboard=require(_0x3795('0x1'))['db'][_0x3795('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3795('0x3'),'afterUpdate':'update','afterDestroy':_0x3795('0x4')};function emitEvent(_0x5ea6c1){return function(_0x20ab50,_0x134fb7,_0x21bb6e){DashboardEvents['emit'](_0x5ea6c1+':'+_0x20ab50['id'],_0x20ab50);DashboardEvents[_0x3795('0x5')](_0x5ea6c1,_0x20ab50);_0x21bb6e(null);};}for(var e in events){if(events[_0x3795('0x6')](e)){var event=events[e];Dashboard[_0x3795('0x7')](e,emitEvent(event));}}module[_0x3795('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 566662f..951b6c1 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 _0xed26=['dashboards','lodash','api','moment','bluebird','request-promise','path','./dashboard.attributes','Dashboard'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0xed26,0x64));var _0x6ed2=function(_0x57c0ac,_0x6e6be){_0x57c0ac=_0x57c0ac-0x0;var _0x4f4e96=_0xed26[_0x57c0ac];return _0x4f4e96;};'use strict';var _=require(_0x6ed2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ed2('0x1'));var moment=require(_0x6ed2('0x2'));var BPromise=require(_0x6ed2('0x3'));var rp=require(_0x6ed2('0x4'));var fs=require('fs');var path=require(_0x6ed2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ed2('0x6'));module['exports']=function(_0xde0c81,_0x55189f){return _0xde0c81['define'](_0x6ed2('0x7'),attributes,{'tableName':_0x6ed2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd21f=['util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','Dashboard','dashboards','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd21f,0x175));var _0xfd21=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0xd21f[_0x52c4e9];return _0x252a03;};'use strict';var _=require(_0xfd21('0x0'));var util=require(_0xfd21('0x1'));var logger=require(_0xfd21('0x2'))('api');var moment=require(_0xfd21('0x3'));var BPromise=require(_0xfd21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd21('0x5'));var rimraf=require('rimraf');var config=require(_0xfd21('0x6'));var attributes=require('./dashboard.attributes');module[_0xfd21('0x7')]=function(_0x3ecd51,_0x45cec4){return _0x3ecd51[_0xfd21('0x8')](_0xfd21('0x9'),attributes,{'tableName':_0xfd21('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index a5f9867..d469e29 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 _0x2e66=['http','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x9a998b,_0x2fb091){var _0x35c369=function(_0x323583){while(--_0x323583){_0x9a998b['push'](_0x9a998b['shift']());}};_0x35c369(++_0x2fb091);}(_0x2e66,0x155));var _0x62e6=function(_0x45312c,_0x32ad2f){_0x45312c=_0x45312c-0x0;var _0x246131=_0x2e66[_0x45312c];return _0x246131;};'use strict';var _=require(_0x62e6('0x0'));var util=require(_0x62e6('0x1'));var moment=require(_0x62e6('0x2'));var BPromise=require(_0x62e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x62e6('0x5'));var logger=require(_0x62e6('0x6'))(_0x62e6('0x7'));var config=require(_0x62e6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x62e6('0x9')][_0x62e6('0xa')]({'port':0x232a});config[_0x62e6('0xb')]=_['defaults'](config[_0x62e6('0xb')],{'host':_0x62e6('0xc'),'port':0x18eb});var socket=require(_0x62e6('0xd'))(new Redis(config['redis']));require(_0x62e6('0xe'))['register'](socket);function respondWithRpcPromise(_0x44948f,_0x2c1ca5,_0x272cd7){return new BPromise(function(_0x12cc5c,_0xf71800){return client[_0x62e6('0xf')](_0x44948f,_0x272cd7)[_0x62e6('0x10')](function(_0x50c075){logger[_0x62e6('0x11')](_0x62e6('0x12'),_0x2c1ca5,_0x62e6('0x13'));logger[_0x62e6('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2c1ca5,_0x62e6('0x13'),JSON[_0x62e6('0x15')](_0x50c075));if(_0x50c075[_0x62e6('0x16')]){if(_0x50c075[_0x62e6('0x16')][_0x62e6('0x17')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x2c1ca5,_0x50c075[_0x62e6('0x16')][_0x62e6('0x18')]);return _0xf71800(_0x50c075[_0x62e6('0x16')]['message']);}logger[_0x62e6('0x16')]('Dashboard,\x20%s,\x20%s',_0x2c1ca5,_0x50c075[_0x62e6('0x16')]['message']);return _0x12cc5c(_0x50c075[_0x62e6('0x16')][_0x62e6('0x18')]);}else{logger['info'](_0x62e6('0x12'),_0x2c1ca5,'request\x20sent');_0x12cc5c(_0x50c075[_0x62e6('0x19')][_0x62e6('0x18')]);}})[_0x62e6('0x1a')](function(_0x2c7bf5){logger[_0x62e6('0x16')](_0x62e6('0x12'),_0x2c1ca5,_0x2c7bf5);_0xf71800(_0x2c7bf5);});});} \ No newline at end of file +var _0xf9fb=['moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','util'];(function(_0x5c1727,_0x4acc94){var _0x88b8f9=function(_0x237dc7){while(--_0x237dc7){_0x5c1727['push'](_0x5c1727['shift']());}};_0x88b8f9(++_0x4acc94);}(_0xf9fb,0xad));var _0xbf9f=function(_0x56556d,_0x5d32ba){_0x56556d=_0x56556d-0x0;var _0x5404f3=_0xf9fb[_0x56556d];return _0x5404f3;};'use strict';var _=require(_0xbf9f('0x0'));var util=require(_0xbf9f('0x1'));var moment=require(_0xbf9f('0x2'));var BPromise=require(_0xbf9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf9f('0x4'))['db'];var utils=require(_0xbf9f('0x5'));var logger=require('../../config/logger')(_0xbf9f('0x6'));var config=require('../../config/environment');var jayson=require(_0xbf9f('0x7'));var client=jayson[_0xbf9f('0x8')][_0xbf9f('0x9')]({'port':0x232a});config[_0xbf9f('0xa')]=_[_0xbf9f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbf9f('0xc'))(new Redis(config[_0xbf9f('0xa')]));require(_0xbf9f('0xd'))[_0xbf9f('0xe')](socket);function respondWithRpcPromise(_0x2259fc,_0x8770b7,_0x3057a5){return new BPromise(function(_0x2c75b1,_0x513511){return client[_0xbf9f('0xf')](_0x2259fc,_0x3057a5)['then'](function(_0x28aee3){logger[_0xbf9f('0x10')](_0xbf9f('0x11'),_0x8770b7,_0xbf9f('0x12'));logger[_0xbf9f('0x13')](_0xbf9f('0x14'),_0x8770b7,_0xbf9f('0x12'),JSON[_0xbf9f('0x15')](_0x28aee3));if(_0x28aee3['error']){if(_0x28aee3['error'][_0xbf9f('0x16')]===0x1f4){logger[_0xbf9f('0x17')](_0xbf9f('0x11'),_0x8770b7,_0x28aee3[_0xbf9f('0x17')][_0xbf9f('0x18')]);return _0x513511(_0x28aee3[_0xbf9f('0x17')]['message']);}logger[_0xbf9f('0x17')](_0xbf9f('0x11'),_0x8770b7,_0x28aee3['error'][_0xbf9f('0x18')]);return _0x2c75b1(_0x28aee3[_0xbf9f('0x17')][_0xbf9f('0x18')]);}else{logger[_0xbf9f('0x10')](_0xbf9f('0x11'),_0x8770b7,_0xbf9f('0x12'));_0x2c75b1(_0x28aee3['result'][_0xbf9f('0x18')]);}})['catch'](function(_0xc32af1){logger['error'](_0xbf9f('0x11'),_0x8770b7,_0xc32af1);_0x513511(_0xc32af1);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b033372..5fdcd33 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 _0x5d30=['length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x394556,_0x1fc39b){var _0x538e88=function(_0xc9eaeb){while(--_0xc9eaeb){_0x394556['push'](_0x394556['shift']());}};_0x538e88(++_0x1fc39b);}(_0x5d30,0x1d6));var _0x05d3=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0x5d30[_0x364a36];return _0x5cd6fa;};'use strict';var DashboardEvents=require(_0x05d3('0x0'));var events=[_0x05d3('0x1'),_0x05d3('0x2'),_0x05d3('0x3')];function createListener(_0x4126c2,_0x44984a){return function(_0x5532d1){_0x44984a[_0x05d3('0x4')](_0x4126c2,_0x5532d1);};}function removeListener(_0x2bb1cf,_0x48731b){return function(){DashboardEvents[_0x05d3('0x5')](_0x2bb1cf,_0x48731b);};}exports[_0x05d3('0x6')]=function(_0x2e7d50){for(var _0x3aaba5=0x0,_0x56b438=events[_0x05d3('0x7')];_0x3aaba5<_0x56b438;_0x3aaba5++){var _0xde9fd9=events[_0x3aaba5];var _0x5ccaa0=createListener(_0x05d3('0x8')+_0xde9fd9,_0x2e7d50);DashboardEvents['on'](_0xde9fd9,_0x5ccaa0);}}; \ No newline at end of file +var _0xb9f4=['remove','update','emit','removeListener','register','length','./dashboard.events','save'];(function(_0x4c2b0c,_0x2058bf){var _0x452b30=function(_0x46ed52){while(--_0x46ed52){_0x4c2b0c['push'](_0x4c2b0c['shift']());}};_0x452b30(++_0x2058bf);}(_0xb9f4,0xce));var _0x4b9f=function(_0x2f3e93,_0xe3e023){_0x2f3e93=_0x2f3e93-0x0;var _0x4c7cc9=_0xb9f4[_0x2f3e93];return _0x4c7cc9;};'use strict';var DashboardEvents=require(_0x4b9f('0x0'));var events=[_0x4b9f('0x1'),_0x4b9f('0x2'),_0x4b9f('0x3')];function createListener(_0x529607,_0x43bf9d){return function(_0x176ceb){_0x43bf9d[_0x4b9f('0x4')](_0x529607,_0x176ceb);};}function removeListener(_0x557ce7,_0x3dc0cb){return function(){DashboardEvents[_0x4b9f('0x5')](_0x557ce7,_0x3dc0cb);};}exports[_0x4b9f('0x6')]=function(_0x54db04){for(var _0x3f7a51=0x0,_0x2b1acc=events[_0x4b9f('0x7')];_0x3f7a51<_0x2b1acc;_0x3f7a51++){var _0x5070b4=events[_0x3f7a51];var _0x1e5179=createListener('dashboard:'+_0x5070b4,_0x54db04);DashboardEvents['on'](_0x5070b4,_0x1e5179);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 672ab0a..975c58f 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 _0x4ecd=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','/:id/items','getItems','post','create','addItem','put','update','destroy'];(function(_0x3bec7c,_0x444b1e){var _0x7084a9=function(_0x1e116f){while(--_0x1e116f){_0x3bec7c['push'](_0x3bec7c['shift']());}};_0x7084a9(++_0x444b1e);}(_0x4ecd,0xd9));var _0xd4ec=function(_0x43c0c7,_0x4739b6){_0x43c0c7=_0x43c0c7-0x0;var _0x3df9c9=_0x4ecd[_0x43c0c7];return _0x3df9c9;};'use strict';var multer=require(_0xd4ec('0x0'));var util=require(_0xd4ec('0x1'));var path=require(_0xd4ec('0x2'));var timeout=require(_0xd4ec('0x3'));var express=require(_0xd4ec('0x4'));var router=express[_0xd4ec('0x5')]();var fs_extra=require(_0xd4ec('0x6'));var auth=require(_0xd4ec('0x7'));var interaction=require(_0xd4ec('0x8'));var config=require(_0xd4ec('0x9'));var controller=require(_0xd4ec('0xa'));router[_0xd4ec('0xb')]('/',auth['isAuthenticated'](),controller[_0xd4ec('0xc')]);router[_0xd4ec('0xb')](_0xd4ec('0xd'),auth[_0xd4ec('0xe')](),controller['show']);router[_0xd4ec('0xb')](_0xd4ec('0xf'),auth['isAuthenticated'](),controller[_0xd4ec('0x10')]);router[_0xd4ec('0x11')]('/',auth[_0xd4ec('0xe')](),controller[_0xd4ec('0x12')]);router[_0xd4ec('0x11')]('/:id/clone',auth[_0xd4ec('0xe')](),controller['clone']);router['post'](_0xd4ec('0xf'),auth[_0xd4ec('0xe')](),controller[_0xd4ec('0x13')]);router[_0xd4ec('0x14')]('/:id',auth[_0xd4ec('0xe')](),controller[_0xd4ec('0x15')]);router['delete']('/:id',auth[_0xd4ec('0xe')](),controller[_0xd4ec('0x16')]);module[_0xd4ec('0x17')]=router; \ No newline at end of file +var _0x0c90=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/items','getItems','post','/:id/clone','addItem','put','/:id','delete','destroy','multer','connect-timeout','express','Router','fs-extra'];(function(_0x154584,_0x421e12){var _0x969074=function(_0x17303b){while(--_0x17303b){_0x154584['push'](_0x154584['shift']());}};_0x969074(++_0x421e12);}(_0x0c90,0x19f));var _0x00c9=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0c90[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x00c9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x00c9('0x1'));var express=require(_0x00c9('0x2'));var router=express[_0x00c9('0x3')]();var fs_extra=require(_0x00c9('0x4'));var auth=require(_0x00c9('0x5'));var interaction=require(_0x00c9('0x6'));var config=require(_0x00c9('0x7'));var controller=require('./dashboard.controller');router[_0x00c9('0x8')]('/',auth[_0x00c9('0x9')](),controller[_0x00c9('0xa')]);router[_0x00c9('0x8')]('/:id',auth[_0x00c9('0x9')](),controller[_0x00c9('0xb')]);router[_0x00c9('0x8')](_0x00c9('0xc'),auth['isAuthenticated'](),controller[_0x00c9('0xd')]);router[_0x00c9('0xe')]('/',auth[_0x00c9('0x9')](),controller['create']);router[_0x00c9('0xe')](_0x00c9('0xf'),auth[_0x00c9('0x9')](),controller['clone']);router[_0x00c9('0xe')](_0x00c9('0xc'),auth[_0x00c9('0x9')](),controller[_0x00c9('0x10')]);router[_0x00c9('0x11')](_0x00c9('0x12'),auth[_0x00c9('0x9')](),controller['update']);router[_0x00c9('0x13')](_0x00c9('0x12'),auth['isAuthenticated'](),controller[_0x00c9('0x14')]);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 03883fb..a302f5b 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 _0xe3da=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize'];(function(_0x3706a5,_0x232c2a){var _0x5188a6=function(_0x4afb04){while(--_0x4afb04){_0x3706a5['push'](_0x3706a5['shift']());}};_0x5188a6(++_0x232c2a);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xae3d('0x0'));var squel=require(_0xae3d('0x1'));var _=require(_0xae3d('0x2'));module[_0xae3d('0x3')]={'title':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xae3d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){try{return JSON[_0xae3d('0x7')](this[_0xae3d('0x8')](_0xae3d('0x9')));}catch(_0x26282d){return[];}},'set':function(_0xa9a1a){try{this[_0xae3d('0xa')](_0xae3d('0x9'),JSON[_0xae3d('0xb')](_0xa9a1a));}catch(_0x583b98){this[_0xae3d('0xa')](_0xae3d('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xae3d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xae3d('0xc')]},'col':{'type':Sequelize[_0xae3d('0xc')]},'background':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':_0xae3d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xae3d('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x9536=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x1ede50,_0x1bbda6){var _0x5979cc=function(_0x112d62){while(--_0x112d62){_0x1ede50['push'](_0x1ede50['shift']());}};_0x5979cc(++_0x1bbda6);}(_0x9536,0x179));var _0x6953=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x9536[_0x5cb97e];return _0x1714b4;};'use strict';var Sequelize=require(_0x6953('0x0'));var squel=require(_0x6953('0x1'));var _=require(_0x6953('0x2'));module[_0x6953('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6953('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x6953('0x5')),'get':function(){try{return JSON[_0x6953('0x6')](this[_0x6953('0x7')](_0x6953('0x8')));}catch(_0x2f3cc3){return[];}},'set':function(_0x494ac2){try{this[_0x6953('0x9')](_0x6953('0x8'),JSON[_0x6953('0xa')](_0x494ac2));}catch(_0x3e1aff){this[_0x6953('0x9')]('attrs',JSON[_0x6953('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x6953('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6953('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6953('0xb')]},'background':{'type':Sequelize[_0x6953('0x4')],'allowNull':![],'defaultValue':_0x6953('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6953('0x4')],'allowNull':![],'defaultValue':_0x6953('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6953('0x4')]},'titleFontSize':{'type':Sequelize[_0x6953('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 9c27d35..dca788e 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 _0x1561=['attrRefresh','widgetAttributes:\x20%s','create','body','DashboardItem','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','show','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','params','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrFaxAccounts','attrReport','reportType'];(function(_0x10a7b2,_0x37587c){var _0x5cf00e=function(_0x69b0b9){while(--_0x69b0b9){_0x10a7b2['push'](_0x10a7b2['shift']());}};_0x5cf00e(++_0x37587c);}(_0x1561,0x1bd));var _0x1156=function(_0x22ad1c,_0x265c13){_0x22ad1c=_0x22ad1c-0x0;var _0x7744b0=_0x1561[_0x22ad1c];return _0x7744b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1156('0x0'));var jsonpatch=require(_0x1156('0x1'));var rp=require(_0x1156('0x2'));var moment=require(_0x1156('0x3'));var BPromise=require(_0x1156('0x4'));var Mustache=require('mustache');var util=require(_0x1156('0x5'));var path=require(_0x1156('0x6'));var sox=require(_0x1156('0x7'));var csv=require(_0x1156('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1156('0x9'));var _=require('lodash');var squel=require(_0x1156('0xa'));var crypto=require(_0x1156('0xb'));var jsforce=require(_0x1156('0xc'));var deskjs=require(_0x1156('0xd'));var toCsv=require(_0x1156('0x8'));var querystring=require('querystring');var Papa=require(_0x1156('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1156('0xf'));var as=require(_0x1156('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1156('0x11'))('api');var utils=require(_0x1156('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1156('0x13'));var db=require(_0x1156('0x14'))['db'];config['redis']=_['defaults'](config[_0x1156('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x1156('0x16'))(new Redis(config[_0x1156('0x15')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x3a7c28,_0xf521c2){_0xf521c2=_0xf521c2||0xcc;return function(_0x9673ef){if(_0x9673ef){return _0x3a7c28['sendStatus'](_0xf521c2);}return _0x3a7c28['status'](_0xf521c2)[_0x1156('0x17')]();};}function respondWithResult(_0x236d32,_0x3c244d){_0x3c244d=_0x3c244d||0xc8;return function(_0x399417){if(_0x399417){return _0x236d32[_0x1156('0x18')](_0x3c244d)[_0x1156('0x19')](_0x399417);}};}function respondWithFilteredResult(_0x2c1ff5,_0x6dd20){return function(_0x2d820d){if(_0x2d820d){var _0x211e6b=typeof _0x6dd20[_0x1156('0x1a')]==='undefined'&&typeof _0x6dd20[_0x1156('0x1b')]===_0x1156('0x1c');var _0x40eab4=_0x2d820d['count'];var _0x30353b=_0x211e6b?0x0:_0x6dd20[_0x1156('0x1a')];var _0x33f611=_0x211e6b?_0x2d820d[_0x1156('0x1d')]:_0x6dd20[_0x1156('0x1a')]+_0x6dd20[_0x1156('0x1b')];var _0x3633ef;if(_0x33f611>=_0x40eab4){_0x33f611=_0x40eab4;_0x3633ef=0xc8;}else{_0x3633ef=0xce;}_0x2c1ff5[_0x1156('0x18')](_0x3633ef);return _0x2c1ff5['set'](_0x1156('0x1e'),_0x30353b+'-'+_0x33f611+'/'+_0x40eab4)['json'](_0x2d820d);}return null;};}function patchUpdates(_0x40f190){return function(_0x271515){try{jsonpatch[_0x1156('0x1f')](_0x271515,_0x40f190,!![]);}catch(_0x4a1abe){return BPromise[_0x1156('0x20')](_0x4a1abe);}return _0x271515[_0x1156('0x21')]();};}function saveUpdates(_0x28caf5,_0x2946b5){return function(_0xdcc9dd){if(_0xdcc9dd){return _0xdcc9dd[_0x1156('0x22')](_0x28caf5)['then'](function(_0xa5ffd7){return _0xa5ffd7;});}return null;};}function removeEntity(_0x4599c8,_0x204acc){return function(_0x178383){if(_0x178383){return _0x178383[_0x1156('0x23')]()[_0x1156('0x24')](function(){_0x4599c8[_0x1156('0x18')](0xcc)[_0x1156('0x17')]();});}};}function handleEntityNotFound(_0x195aef,_0x2826e9){return function(_0x225502){if(!_0x225502){_0x195aef[_0x1156('0x25')](0x194);}return _0x225502;};}function handleError(_0x1af5b2,_0x17bf39){_0x17bf39=_0x17bf39||0x1f4;return function(_0x4f5c32){logger[_0x1156('0x26')](_0x4f5c32[_0x1156('0x27')]);if(_0x4f5c32['name']){delete _0x4f5c32[_0x1156('0x28')];}_0x1af5b2[_0x1156('0x18')](_0x17bf39)['send'](_0x4f5c32);};}exports[_0x1156('0x29')]=function(_0x3e4cc3,_0x5299d3){var _0x12a68e={'raw':![],'where':{'id':_0x3e4cc3['params']['id']}},_0x265406={};_0x265406[_0x1156('0x2a')]=_[_0x1156('0x2b')](db['DashboardItem'][_0x1156('0x2c')]);_0x265406[_0x1156('0x2d')]=_['keys'](_0x3e4cc3[_0x1156('0x2d')]);_0x265406[_0x1156('0x2e')]=_[_0x1156('0x2f')](_0x265406[_0x1156('0x2a')],_0x265406['query']);_0x12a68e['attributes']=_[_0x1156('0x2f')](_0x265406[_0x1156('0x2a')],qs[_0x1156('0x30')](_0x3e4cc3[_0x1156('0x2d')][_0x1156('0x30')]));_0x12a68e[_0x1156('0x31')]=_0x12a68e[_0x1156('0x31')][_0x1156('0x32')]?_0x12a68e[_0x1156('0x31')]:_0x265406['model'];if(_0x3e4cc3['query'][_0x1156('0x33')]){_0x12a68e['include']=[{'all':!![]}];}_0x12a68e=_[_0x1156('0x34')]({},_0x12a68e,_0x3e4cc3[_0x1156('0x35')]);return db['DashboardItem'][_0x1156('0x36')](_0x12a68e)[_0x1156('0x24')](handleEntityNotFound(_0x5299d3,null))[_0x1156('0x24')](respondWithResult(_0x5299d3,null))[_0x1156('0x37')](handleError(_0x5299d3,null));};exports['destroy']=function(_0x20c243,_0xa68f3d){return db['DashboardItem'][_0x1156('0x36')]({'where':{'id':_0x20c243[_0x1156('0x38')]['id']}})[_0x1156('0x24')](handleEntityNotFound(_0xa68f3d,null))[_0x1156('0x24')](removeEntity(_0xa68f3d,null))['catch'](handleError(_0xa68f3d,null));};function widgetAttributes(_0x44aeaf){try{switch(_0x44aeaf['type']){case'iframe':return[{'name':_0x1156('0x39'),'value':_0x44aeaf['attrUrl']||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf['attrs'][0x0]?_0x44aeaf['attrs'][0x0][_0x1156('0x3b')]:undefined)||_0x1156('0x3c')}];case _0x1156('0x3d'):return[{'name':_0x1156('0x3e'),'value':_0x44aeaf[_0x1156('0x3e')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x0]?_0x44aeaf['attrs'][0x0][_0x1156('0x3b')]:undefined)||''}];case'clock':return[{'name':_0x1156('0x3f'),'value':_0x44aeaf['attrHourFormat']||(_0x44aeaf['attrs']&&_0x44aeaf[_0x1156('0x3a')][0x0]?_0x44aeaf[_0x1156('0x3a')][0x0][_0x1156('0x3b')]:undefined)||_0x1156('0x40')},{'name':_0x1156('0x41'),'value':_0x44aeaf[_0x1156('0x41')]||(_0x44aeaf['attrs']&&_0x44aeaf[_0x1156('0x3a')][0x1]?_0x44aeaf[_0x1156('0x3a')][0x1][_0x1156('0x3b')]:undefined)||_0x1156('0x42')},{'name':_0x1156('0x43'),'value':_0x44aeaf[_0x1156('0x43')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf['attrs'][0x2]?_0x44aeaf['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x1156('0x44'),'value':_0x44aeaf[_0x1156('0x44')]||(_0x44aeaf['attrs']&&_0x44aeaf['attrs'][0x0]?_0x44aeaf['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x1156('0x45'),'value':_0x44aeaf[_0x1156('0x45')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf['attrs'][0x1]?_0x44aeaf[_0x1156('0x3a')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x44aeaf[_0x1156('0x43')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x2]?_0x44aeaf[_0x1156('0x3a')][0x2][_0x1156('0x3b')]:undefined)||0x14},{'name':_0x1156('0x46'),'value':_0x44aeaf[_0x1156('0x46')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf['attrs'][0x3]?_0x44aeaf[_0x1156('0x3a')][0x3][_0x1156('0x3b')]:undefined)||'voice'},{'name':_0x1156('0x47'),'value':_0x44aeaf[_0x1156('0x47')]||(_0x44aeaf['attrs']&&_0x44aeaf[_0x1156('0x3a')][0x4]?_0x44aeaf['attrs'][0x4][_0x1156('0x3b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x44aeaf['attrFaxAccounts']||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x5]?_0x44aeaf[_0x1156('0x3a')][0x5][_0x1156('0x3b')]:undefined)||''},{'name':_0x1156('0x48'),'value':_0x44aeaf[_0x1156('0x48')]||(_0x44aeaf['attrs']&&_0x44aeaf[_0x1156('0x3a')][0x6]?_0x44aeaf['attrs'][0x6][_0x1156('0x3b')]:undefined)||''},{'name':_0x1156('0x49'),'value':_0x44aeaf[_0x1156('0x49')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x7]?_0x44aeaf[_0x1156('0x3a')][0x7][_0x1156('0x3b')]:undefined)||''},{'name':_0x1156('0x4a'),'value':_0x44aeaf[_0x1156('0x4a')]||(_0x44aeaf['attrs']&&_0x44aeaf[_0x1156('0x3a')][0x8]?_0x44aeaf[_0x1156('0x3a')][0x8][_0x1156('0x3b')]:undefined)||''},{'name':_0x1156('0x4b'),'value':_0x44aeaf['attrChatWebsites']||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x9]?_0x44aeaf[_0x1156('0x3a')][0x9]['value']:undefined)||''}];case _0x1156('0x4c'):case _0x1156('0x4d'):return[{'name':_0x1156('0x4e'),'value':_0x44aeaf[_0x1156('0x4e')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x0]?_0x44aeaf['attrs'][0x0][_0x1156('0x3b')]:undefined)||'total'},{'name':'attrSerie2','value':_0x44aeaf[_0x1156('0x4f')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x1]?_0x44aeaf[_0x1156('0x3a')][0x1][_0x1156('0x3b')]:undefined)||null},{'name':'attrSerie3','value':_0x44aeaf['attrSerie3']||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x2]?_0x44aeaf['attrs'][0x2][_0x1156('0x3b')]:undefined)||null},{'name':_0x1156('0x45'),'value':_0x44aeaf[_0x1156('0x45')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x3]?_0x44aeaf[_0x1156('0x3a')][0x3]['value']:undefined)||[]},{'name':_0x1156('0x46'),'value':_0x44aeaf[_0x1156('0x46')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x4]?_0x44aeaf['attrs'][0x4][_0x1156('0x3b')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x44aeaf['attrEmailAccounts']||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x5]?_0x44aeaf[_0x1156('0x3a')][0x5][_0x1156('0x3b')]:undefined)||''},{'name':_0x1156('0x50'),'value':_0x44aeaf[_0x1156('0x50')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf['attrs'][0x6]?_0x44aeaf['attrs'][0x6]['value']:undefined)||''},{'name':_0x1156('0x48'),'value':_0x44aeaf[_0x1156('0x48')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x7]?_0x44aeaf[_0x1156('0x3a')][0x7][_0x1156('0x3b')]:undefined)||''},{'name':_0x1156('0x49'),'value':_0x44aeaf['attrOpenchannelAccounts']||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x8]?_0x44aeaf['attrs'][0x8][_0x1156('0x3b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x44aeaf[_0x1156('0x4a')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x9]?_0x44aeaf[_0x1156('0x3a')][0x9]['value']:undefined)||''},{'name':_0x1156('0x4b'),'value':_0x44aeaf['attrChatWebsites']||(_0x44aeaf['attrs']&&_0x44aeaf['attrs'][0xa]?_0x44aeaf['attrs'][0xa][_0x1156('0x3b')]:undefined)||''}];case'web-report':return[{'name':_0x1156('0x51'),'type':_0x44aeaf[_0x1156('0x52')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x0]?_0x44aeaf[_0x1156('0x3a')][0x0]['type']:undefined)||null,'value':_0x44aeaf['attrReport']||(_0x44aeaf['attrs']&&_0x44aeaf['attrs'][0x0]?_0x44aeaf[_0x1156('0x3a')][0x0]['value']:undefined)||null},{'name':_0x1156('0x53'),'value':_0x44aeaf[_0x1156('0x53')]||(_0x44aeaf[_0x1156('0x3a')]&&_0x44aeaf[_0x1156('0x3a')][0x1]?_0x44aeaf[_0x1156('0x3a')][0x1][_0x1156('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x1f9dd9){logger[_0x1156('0x26')](_0x1156('0x54'),JSON['stringify'](_0x1f9dd9));return[];}}exports[_0x1156('0x55')]=function(_0x179e95,_0x18f737){if(_0x179e95[_0x1156('0x56')]){_0x179e95[_0x1156('0x56')][_0x1156('0x3a')]=widgetAttributes(_0x179e95[_0x1156('0x56')]);}return db[_0x1156('0x57')]['create'](_0x179e95['body'],{})[_0x1156('0x24')](respondWithResult(_0x18f737,0xc9))[_0x1156('0x37')](handleError(_0x18f737,null));};exports[_0x1156('0x22')]=function(_0x2d34ce,_0x32c7fd){if(_0x2d34ce[_0x1156('0x56')]['id']){delete _0x2d34ce[_0x1156('0x56')]['id'];}_0x2d34ce[_0x1156('0x56')][_0x1156('0x3a')]=widgetAttributes(_0x2d34ce['body']);return db[_0x1156('0x57')][_0x1156('0x36')]({'where':{'id':_0x2d34ce[_0x1156('0x38')]['id']}})['then'](handleEntityNotFound(_0x32c7fd,null))[_0x1156('0x24')](saveUpdates(_0x2d34ce[_0x1156('0x56')],null))[_0x1156('0x24')](respondWithResult(_0x32c7fd,null))[_0x1156('0x37')](handleError(_0x32c7fd,null));}; \ No newline at end of file +var _0x9541=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','then','sendStatus','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','length','attributes','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x184e1a,_0x2136c4){var _0x54c7b9=function(_0xfa3835){while(--_0xfa3835){_0x184e1a['push'](_0x184e1a['shift']());}};_0x54c7b9(++_0x2136c4);}(_0x9541,0xb3));var _0x1954=function(_0x3354ab,_0x3bc63a){_0x3354ab=_0x3354ab-0x0;var _0x581958=_0x9541[_0x3354ab];return _0x581958;};'use strict';var emlformat=require(_0x1954('0x0'));var rimraf=require(_0x1954('0x1'));var zipdir=require(_0x1954('0x2'));var jsonpatch=require(_0x1954('0x3'));var rp=require(_0x1954('0x4'));var moment=require(_0x1954('0x5'));var BPromise=require(_0x1954('0x6'));var Mustache=require(_0x1954('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1954('0x8'));var csv=require(_0x1954('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1954('0xa'));var _=require(_0x1954('0xb'));var squel=require(_0x1954('0xc'));var crypto=require(_0x1954('0xd'));var jsforce=require(_0x1954('0xe'));var deskjs=require(_0x1954('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1954('0x10'));var Papa=require(_0x1954('0x11'));var Redis=require(_0x1954('0x12'));var authService=require(_0x1954('0x13'));var qs=require(_0x1954('0x14'));var as=require(_0x1954('0x15'));var hardwareService=require(_0x1954('0x16'));var logger=require(_0x1954('0x17'))('api');var utils=require(_0x1954('0x18'));var config=require(_0x1954('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1954('0x1a'))['db'];config['redis']=_[_0x1954('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1954('0x1c')]));require(_0x1954('0x1d'))[_0x1954('0x1e')](socket);function respondWithStatusCode(_0x520dc7,_0x287fc3){_0x287fc3=_0x287fc3||0xcc;return function(_0x5c359d){if(_0x5c359d){return _0x520dc7['sendStatus'](_0x287fc3);}return _0x520dc7[_0x1954('0x1f')](_0x287fc3)[_0x1954('0x20')]();};}function respondWithResult(_0x36565c,_0x451bda){_0x451bda=_0x451bda||0xc8;return function(_0x7c8b78){if(_0x7c8b78){return _0x36565c[_0x1954('0x1f')](_0x451bda)[_0x1954('0x21')](_0x7c8b78);}};}function respondWithFilteredResult(_0x46b400,_0x1b8975){return function(_0xb9c2cd){if(_0xb9c2cd){var _0xc8cb0b=typeof _0x1b8975[_0x1954('0x22')]===_0x1954('0x23')&&typeof _0x1b8975[_0x1954('0x24')]===_0x1954('0x23');var _0x4503d7=_0xb9c2cd[_0x1954('0x25')];var _0x1c65da=_0xc8cb0b?0x0:_0x1b8975[_0x1954('0x22')];var _0x5b26c7=_0xc8cb0b?_0xb9c2cd['count']:_0x1b8975[_0x1954('0x22')]+_0x1b8975[_0x1954('0x24')];var _0x3a84c0;if(_0x5b26c7>=_0x4503d7){_0x5b26c7=_0x4503d7;_0x3a84c0=0xc8;}else{_0x3a84c0=0xce;}_0x46b400[_0x1954('0x1f')](_0x3a84c0);return _0x46b400[_0x1954('0x26')]('Content-Range',_0x1c65da+'-'+_0x5b26c7+'/'+_0x4503d7)[_0x1954('0x21')](_0xb9c2cd);}return null;};}function patchUpdates(_0x15dd0b){return function(_0x5ea2c3){try{jsonpatch[_0x1954('0x27')](_0x5ea2c3,_0x15dd0b,!![]);}catch(_0x6d8a2){return BPromise['reject'](_0x6d8a2);}return _0x5ea2c3['save']();};}function saveUpdates(_0x18a883,_0x363064){return function(_0x3b954b){if(_0x3b954b){return _0x3b954b[_0x1954('0x28')](_0x18a883)['then'](function(_0x21f395){return _0x21f395;});}return null;};}function removeEntity(_0x26484f,_0x27dc66){return function(_0x29b732){if(_0x29b732){return _0x29b732[_0x1954('0x29')]()[_0x1954('0x2a')](function(){_0x26484f[_0x1954('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c0a27,_0x337aad){return function(_0x513917){if(!_0x513917){_0x1c0a27[_0x1954('0x2b')](0x194);}return _0x513917;};}function handleError(_0x1a2f6b,_0x35ca31){_0x35ca31=_0x35ca31||0x1f4;return function(_0x3a488b){logger[_0x1954('0x2c')](_0x3a488b[_0x1954('0x2d')]);if(_0x3a488b[_0x1954('0x2e')]){delete _0x3a488b[_0x1954('0x2e')];}_0x1a2f6b[_0x1954('0x1f')](_0x35ca31)[_0x1954('0x2f')](_0x3a488b);};}exports[_0x1954('0x30')]=function(_0x3c27d3,_0x40da25){var _0x22509c={'raw':![],'where':{'id':_0x3c27d3[_0x1954('0x31')]['id']}},_0x228a57={};_0x228a57[_0x1954('0x32')]=_[_0x1954('0x33')](db[_0x1954('0x34')][_0x1954('0x35')]);_0x228a57[_0x1954('0x36')]=_[_0x1954('0x33')](_0x3c27d3[_0x1954('0x36')]);_0x228a57[_0x1954('0x37')]=_['intersection'](_0x228a57['model'],_0x228a57[_0x1954('0x36')]);_0x22509c['attributes']=_[_0x1954('0x38')](_0x228a57[_0x1954('0x32')],qs['fields'](_0x3c27d3[_0x1954('0x36')][_0x1954('0x39')]));_0x22509c['attributes']=_0x22509c['attributes'][_0x1954('0x3a')]?_0x22509c[_0x1954('0x3b')]:_0x228a57[_0x1954('0x32')];if(_0x3c27d3[_0x1954('0x36')][_0x1954('0x3c')]){_0x22509c[_0x1954('0x3d')]=[{'all':!![]}];}_0x22509c=_[_0x1954('0x3e')]({},_0x22509c,_0x3c27d3['options']);return db['DashboardItem'][_0x1954('0x3f')](_0x22509c)[_0x1954('0x2a')](handleEntityNotFound(_0x40da25,null))[_0x1954('0x2a')](respondWithResult(_0x40da25,null))[_0x1954('0x40')](handleError(_0x40da25,null));};exports[_0x1954('0x29')]=function(_0x1d2f96,_0x5d235f){return db[_0x1954('0x34')][_0x1954('0x3f')]({'where':{'id':_0x1d2f96['params']['id']}})[_0x1954('0x2a')](handleEntityNotFound(_0x5d235f,null))[_0x1954('0x2a')](removeEntity(_0x5d235f,null))['catch'](handleError(_0x5d235f,null));};function widgetAttributes(_0x580990){try{switch(_0x580990[_0x1954('0x41')]){case _0x1954('0x42'):return[{'name':'attrUrl','value':_0x580990[_0x1954('0x43')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x0]?_0x580990[_0x1954('0x44')][0x0]['value']:undefined)||_0x1954('0x45')}];case'custom':return[{'name':_0x1954('0x46'),'value':_0x580990[_0x1954('0x46')]||(_0x580990[_0x1954('0x44')]&&_0x580990['attrs'][0x0]?_0x580990[_0x1954('0x44')][0x0][_0x1954('0x47')]:undefined)||''}];case _0x1954('0x48'):return[{'name':_0x1954('0x49'),'value':_0x580990[_0x1954('0x49')]||(_0x580990['attrs']&&_0x580990[_0x1954('0x44')][0x0]?_0x580990['attrs'][0x0][_0x1954('0x47')]:undefined)||'HH:mm:ss'},{'name':_0x1954('0x4a'),'value':_0x580990[_0x1954('0x4a')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x1]?_0x580990['attrs'][0x1][_0x1954('0x47')]:undefined)||'0.00'},{'name':_0x1954('0x4b'),'value':_0x580990[_0x1954('0x4b')]||(_0x580990['attrs']&&_0x580990[_0x1954('0x44')][0x2]?_0x580990[_0x1954('0x44')][0x2][_0x1954('0x47')]:undefined)||0xc}];case _0x1954('0x4c'):return[{'name':_0x1954('0x4d'),'value':_0x580990[_0x1954('0x4d')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x0]?_0x580990[_0x1954('0x44')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x580990[_0x1954('0x4e')]||(_0x580990['attrs']&&_0x580990[_0x1954('0x44')][0x1]?_0x580990[_0x1954('0x44')][0x1][_0x1954('0x47')]:undefined)||[]},{'name':_0x1954('0x4b'),'value':_0x580990[_0x1954('0x4b')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x2]?_0x580990[_0x1954('0x44')][0x2][_0x1954('0x47')]:undefined)||0x14},{'name':'attrChannel','value':_0x580990['attrChannel']||(_0x580990[_0x1954('0x44')]&&_0x580990['attrs'][0x3]?_0x580990[_0x1954('0x44')][0x3]['value']:undefined)||_0x1954('0x4f')},{'name':_0x1954('0x50'),'value':_0x580990[_0x1954('0x50')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x4]?_0x580990[_0x1954('0x44')][0x4][_0x1954('0x47')]:undefined)||''},{'name':_0x1954('0x51'),'value':_0x580990[_0x1954('0x51')]||(_0x580990[_0x1954('0x44')]&&_0x580990['attrs'][0x5]?_0x580990[_0x1954('0x44')][0x5][_0x1954('0x47')]:undefined)||''},{'name':_0x1954('0x52'),'value':_0x580990[_0x1954('0x52')]||(_0x580990['attrs']&&_0x580990[_0x1954('0x44')][0x6]?_0x580990[_0x1954('0x44')][0x6]['value']:undefined)||''},{'name':_0x1954('0x53'),'value':_0x580990['attrOpenchannelAccounts']||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x7]?_0x580990[_0x1954('0x44')][0x7][_0x1954('0x47')]:undefined)||''},{'name':_0x1954('0x54'),'value':_0x580990[_0x1954('0x54')]||(_0x580990[_0x1954('0x44')]&&_0x580990['attrs'][0x8]?_0x580990[_0x1954('0x44')][0x8]['value']:undefined)||''},{'name':_0x1954('0x55'),'value':_0x580990[_0x1954('0x55')]||(_0x580990[_0x1954('0x44')]&&_0x580990['attrs'][0x9]?_0x580990[_0x1954('0x44')][0x9][_0x1954('0x47')]:undefined)||''}];case _0x1954('0x56'):case _0x1954('0x57'):return[{'name':_0x1954('0x58'),'value':_0x580990['attrSerie1']||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x0]?_0x580990[_0x1954('0x44')][0x0][_0x1954('0x47')]:undefined)||_0x1954('0x59')},{'name':'attrSerie2','value':_0x580990[_0x1954('0x5a')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x1]?_0x580990[_0x1954('0x44')][0x1][_0x1954('0x47')]:undefined)||null},{'name':_0x1954('0x5b'),'value':_0x580990[_0x1954('0x5b')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x2]?_0x580990['attrs'][0x2][_0x1954('0x47')]:undefined)||null},{'name':_0x1954('0x4e'),'value':_0x580990[_0x1954('0x4e')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x3]?_0x580990[_0x1954('0x44')][0x3][_0x1954('0x47')]:undefined)||[]},{'name':_0x1954('0x5c'),'value':_0x580990[_0x1954('0x5c')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x4]?_0x580990[_0x1954('0x44')][0x4][_0x1954('0x47')]:undefined)||_0x1954('0x4f')},{'name':_0x1954('0x50'),'value':_0x580990[_0x1954('0x50')]||(_0x580990['attrs']&&_0x580990['attrs'][0x5]?_0x580990['attrs'][0x5]['value']:undefined)||''},{'name':_0x1954('0x51'),'value':_0x580990['attrFaxAccounts']||(_0x580990['attrs']&&_0x580990[_0x1954('0x44')][0x6]?_0x580990[_0x1954('0x44')][0x6][_0x1954('0x47')]:undefined)||''},{'name':_0x1954('0x52'),'value':_0x580990[_0x1954('0x52')]||(_0x580990['attrs']&&_0x580990['attrs'][0x7]?_0x580990[_0x1954('0x44')][0x7][_0x1954('0x47')]:undefined)||''},{'name':_0x1954('0x53'),'value':_0x580990[_0x1954('0x53')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x8]?_0x580990[_0x1954('0x44')][0x8][_0x1954('0x47')]:undefined)||''},{'name':_0x1954('0x54'),'value':_0x580990['attrWhatsappAccounts']||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x9]?_0x580990[_0x1954('0x44')][0x9]['value']:undefined)||''},{'name':_0x1954('0x55'),'value':_0x580990[_0x1954('0x55')]||(_0x580990[_0x1954('0x44')]&&_0x580990['attrs'][0xa]?_0x580990[_0x1954('0x44')][0xa]['value']:undefined)||''}];case _0x1954('0x5d'):return[{'name':_0x1954('0x5e'),'type':_0x580990[_0x1954('0x5f')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x0]?_0x580990[_0x1954('0x44')][0x0][_0x1954('0x41')]:undefined)||null,'value':_0x580990[_0x1954('0x5e')]||(_0x580990[_0x1954('0x44')]&&_0x580990['attrs'][0x0]?_0x580990[_0x1954('0x44')][0x0][_0x1954('0x47')]:undefined)||null},{'name':'attrRefresh','value':_0x580990[_0x1954('0x60')]||(_0x580990[_0x1954('0x44')]&&_0x580990[_0x1954('0x44')][0x1]?_0x580990[_0x1954('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1cce3d){logger[_0x1954('0x2c')](_0x1954('0x61'),JSON[_0x1954('0x62')](_0x1cce3d));return[];}}exports[_0x1954('0x63')]=function(_0x86cc39,_0x458306){if(_0x86cc39[_0x1954('0x64')]){_0x86cc39['body']['attrs']=widgetAttributes(_0x86cc39[_0x1954('0x64')]);}return db['DashboardItem'][_0x1954('0x63')](_0x86cc39['body'],{})[_0x1954('0x2a')](respondWithResult(_0x458306,0xc9))[_0x1954('0x40')](handleError(_0x458306,null));};exports[_0x1954('0x28')]=function(_0x5c5d9c,_0x3e1fe5){if(_0x5c5d9c[_0x1954('0x64')]['id']){delete _0x5c5d9c[_0x1954('0x64')]['id'];}_0x5c5d9c['body']['attrs']=widgetAttributes(_0x5c5d9c[_0x1954('0x64')]);return db[_0x1954('0x34')][_0x1954('0x3f')]({'where':{'id':_0x5c5d9c[_0x1954('0x31')]['id']}})['then'](handleEntityNotFound(_0x3e1fe5,null))[_0x1954('0x2a')](saveUpdates(_0x5c5d9c['body'],null))['then'](respondWithResult(_0x3e1fe5,null))['catch'](handleError(_0x3e1fe5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 3480b07..b730568 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 _0x803d=['update','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners','save'];(function(_0x3a9a6a,_0x51afcd){var _0xc860c8=function(_0x4578b6){while(--_0x4578b6){_0x3a9a6a['push'](_0x3a9a6a['shift']());}};_0xc860c8(++_0x51afcd);}(_0x803d,0x15a));var _0xd803=function(_0x49ee48,_0x52b2ff){_0x49ee48=_0x49ee48-0x0;var _0x1a3a64=_0x803d[_0x49ee48];return _0x1a3a64;};'use strict';var EventEmitter=require(_0xd803('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xd803('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd803('0x2')](0x0);var events={'afterCreate':_0xd803('0x3'),'afterUpdate':_0xd803('0x4'),'afterDestroy':_0xd803('0x5')};function emitEvent(_0x11253c){return function(_0x57138a,_0xc67786,_0x55e3d2){DashboardItemEvents[_0xd803('0x6')](_0x11253c+':'+_0x57138a['id'],_0x57138a);DashboardItemEvents[_0xd803('0x6')](_0x11253c,_0x57138a);_0x55e3d2(null);};}for(var e in events){if(events[_0xd803('0x7')](e)){var event=events[e];DashboardItem[_0xd803('0x8')](e,emitEvent(event));}}module[_0xd803('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x2f0f=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','emit'];(function(_0x14ec5e,_0x6e3111){var _0x4c67a1=function(_0xc8aa1c){while(--_0xc8aa1c){_0x14ec5e['push'](_0x14ec5e['shift']());}};_0x4c67a1(++_0x6e3111);}(_0x2f0f,0xc2));var _0xf2f0=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0x2f0f[_0x147497];return _0x35f45;};'use strict';var EventEmitter=require(_0xf2f0('0x0'));var DashboardItem=require(_0xf2f0('0x1'))['db'][_0xf2f0('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf2f0('0x3')](0x0);var events={'afterCreate':_0xf2f0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31a3d8){return function(_0x461246,_0x45123c,_0x1af8c1){DashboardItemEvents[_0xf2f0('0x5')](_0x31a3d8+':'+_0x461246['id'],_0x461246);DashboardItemEvents[_0xf2f0('0x5')](_0x31a3d8,_0x461246);_0x1af8c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xf2f0('0x6')](e,emitEvent(event));}}module[_0xf2f0('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 2da02f6..138a34f 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 _0x7cd2=['DashboardItem','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x4ad441,_0x28f14f){var _0x3693b6=function(_0x3813a9){while(--_0x3813a9){_0x4ad441['push'](_0x4ad441['shift']());}};_0x3693b6(++_0x28f14f);}(_0x7cd2,0x118));var _0x27cd=function(_0x180861,_0x2acb76){_0x180861=_0x180861-0x0;var _0x514d29=_0x7cd2[_0x180861];return _0x514d29;};'use strict';var _=require('lodash');var util=require(_0x27cd('0x0'));var logger=require(_0x27cd('0x1'))(_0x27cd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x27cd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27cd('0x4'));var config=require(_0x27cd('0x5'));var attributes=require(_0x27cd('0x6'));module[_0x27cd('0x7')]=function(_0x2646a9,_0x38098b){return _0x2646a9['define'](_0x27cd('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ee8=['request-promise','../../config/environment','./dashboardItem.attributes','define','dashboard_items','util','moment','bluebird'];(function(_0x115850,_0x4bb634){var _0xbad084=function(_0xa14074){while(--_0xa14074){_0x115850['push'](_0x115850['shift']());}};_0xbad084(++_0x4bb634);}(_0x1ee8,0x6d));var _0x81ee=function(_0x277779,_0x348b9e){_0x277779=_0x277779-0x0;var _0x2e2fe0=_0x1ee8[_0x277779];return _0x2e2fe0;};'use strict';var _=require('lodash');var util=require(_0x81ee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x81ee('0x1'));var BPromise=require(_0x81ee('0x2'));var rp=require(_0x81ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x81ee('0x4'));var attributes=require(_0x81ee('0x5'));module['exports']=function(_0x333ceb,_0x9b2f78){return _0x333ceb[_0x81ee('0x6')]('DashboardItem',attributes,{'tableName':_0x81ee('0x7'),'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 5144775..84e5a82 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 _0xd4ca=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','request','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x5b80a8,_0x571b3c){var _0x227b0a=function(_0x4c3c65){while(--_0x4c3c65){_0x5b80a8['push'](_0x5b80a8['shift']());}};_0x227b0a(++_0x571b3c);}(_0xd4ca,0xb4));var _0xad4c=function(_0x2f2c65,_0x246a0c){_0x2f2c65=_0x2f2c65-0x0;var _0x89664b=_0xd4ca[_0x2f2c65];return _0x89664b;};'use strict';var _=require(_0xad4c('0x0'));var util=require(_0xad4c('0x1'));var moment=require(_0xad4c('0x2'));var BPromise=require(_0xad4c('0x3'));var rs=require(_0xad4c('0x4'));var fs=require('fs');var Redis=require(_0xad4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xad4c('0x6'))(_0xad4c('0x7'));var config=require(_0xad4c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xad4c('0x9')][_0xad4c('0xa')]({'port':0x232a});config[_0xad4c('0xb')]=_[_0xad4c('0xc')](config[_0xad4c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xad4c('0xd'))(new Redis(config[_0xad4c('0xb')]));require(_0xad4c('0xe'))['register'](socket);function respondWithRpcPromise(_0x46c9a4,_0x130213,_0x1e30a7){return new BPromise(function(_0x35be26,_0x2d2a98){return client[_0xad4c('0xf')](_0x46c9a4,_0x1e30a7)['then'](function(_0x76ebfb){logger[_0xad4c('0x10')](_0xad4c('0x11'),_0x130213,'request\x20sent');logger[_0xad4c('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x130213,_0xad4c('0x13'),JSON[_0xad4c('0x14')](_0x76ebfb));if(_0x76ebfb[_0xad4c('0x15')]){if(_0x76ebfb['error'][_0xad4c('0x16')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x130213,_0x76ebfb[_0xad4c('0x15')]['message']);return _0x2d2a98(_0x76ebfb['error'][_0xad4c('0x17')]);}logger[_0xad4c('0x15')](_0xad4c('0x11'),_0x130213,_0x76ebfb[_0xad4c('0x15')][_0xad4c('0x17')]);return _0x35be26(_0x76ebfb[_0xad4c('0x15')][_0xad4c('0x17')]);}else{logger[_0xad4c('0x10')](_0xad4c('0x11'),_0x130213,_0xad4c('0x13'));_0x35be26(_0x76ebfb[_0xad4c('0x18')][_0xad4c('0x17')]);}})[_0xad4c('0x19')](function(_0x2e00f0){logger['error'](_0xad4c('0x11'),_0x130213,_0x2e00f0);_0x2d2a98(_0x2e00f0);});});} \ No newline at end of file +var _0xb3df=['./dashboardItem.socket','register','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','DashboardItem,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x48a0b4,_0x2a4c3f){var _0x44b1e6=function(_0x3cfaa6){while(--_0x3cfaa6){_0x48a0b4['push'](_0x48a0b4['shift']());}};_0x44b1e6(++_0x2a4c3f);}(_0xb3df,0x1cf));var _0xfb3d=function(_0x46c698,_0x475514){_0x46c698=_0x46c698-0x0;var _0x4e24c3=_0xb3df[_0x46c698];return _0x4e24c3;};'use strict';var _=require(_0xfb3d('0x0'));var util=require(_0xfb3d('0x1'));var moment=require(_0xfb3d('0x2'));var BPromise=require(_0xfb3d('0x3'));var rs=require(_0xfb3d('0x4'));var fs=require('fs');var Redis=require(_0xfb3d('0x5'));var db=require(_0xfb3d('0x6'))['db'];var utils=require(_0xfb3d('0x7'));var logger=require('../../config/logger')(_0xfb3d('0x8'));var config=require(_0xfb3d('0x9'));var jayson=require(_0xfb3d('0xa'));var client=jayson[_0xfb3d('0xb')][_0xfb3d('0xc')]({'port':0x232a});config[_0xfb3d('0xd')]=_[_0xfb3d('0xe')](config['redis'],{'host':_0xfb3d('0xf'),'port':0x18eb});var socket=require(_0xfb3d('0x10'))(new Redis(config[_0xfb3d('0xd')]));require(_0xfb3d('0x11'))[_0xfb3d('0x12')](socket);function respondWithRpcPromise(_0x358e70,_0x1b074d,_0x167e8d){return new BPromise(function(_0x2ad992,_0x3a0eef){return client['request'](_0x358e70,_0x167e8d)[_0xfb3d('0x13')](function(_0x4e5b6f){logger[_0xfb3d('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1b074d,_0xfb3d('0x15'));logger[_0xfb3d('0x16')](_0xfb3d('0x17'),_0x1b074d,_0xfb3d('0x15'),JSON[_0xfb3d('0x18')](_0x4e5b6f));if(_0x4e5b6f['error']){if(_0x4e5b6f['error'][_0xfb3d('0x19')]===0x1f4){logger[_0xfb3d('0x1a')](_0xfb3d('0x1b'),_0x1b074d,_0x4e5b6f[_0xfb3d('0x1a')]['message']);return _0x3a0eef(_0x4e5b6f[_0xfb3d('0x1a')]['message']);}logger[_0xfb3d('0x1a')](_0xfb3d('0x1b'),_0x1b074d,_0x4e5b6f[_0xfb3d('0x1a')][_0xfb3d('0x1c')]);return _0x2ad992(_0x4e5b6f[_0xfb3d('0x1a')][_0xfb3d('0x1c')]);}else{logger[_0xfb3d('0x14')](_0xfb3d('0x1b'),_0x1b074d,'request\x20sent');_0x2ad992(_0x4e5b6f['result']['message']);}})[_0xfb3d('0x1d')](function(_0x2307b7){logger[_0xfb3d('0x1a')](_0xfb3d('0x1b'),_0x1b074d,_0x2307b7);_0x3a0eef(_0x2307b7);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 1c24afa..43a3c6f 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 _0x7b08=['emit','length','remove'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x7b08,0x98));var _0x87b0=function(_0x477d06,_0xb9a044){_0x477d06=_0x477d06-0x0;var _0x36fd67=_0x7b08[_0x477d06];return _0x36fd67;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x87b0('0x0'),'update'];function createListener(_0x20aa16,_0x4a1ec2){return function(_0x2661b5){_0x4a1ec2[_0x87b0('0x1')](_0x20aa16,_0x2661b5);};}function removeListener(_0x21bb7a,_0xe7263){return function(){DashboardItemEvents['removeListener'](_0x21bb7a,_0xe7263);};}exports['register']=function(_0x149df6){for(var _0x384b9a=0x0,_0x3867a6=events[_0x87b0('0x2')];_0x384b9a<_0x3867a6;_0x384b9a++){var _0xacc3bc=events[_0x384b9a];var _0x4b5602=createListener('dashboardItem:'+_0xacc3bc,_0x149df6);DashboardItemEvents['on'](_0xacc3bc,_0x4b5602);}}; \ No newline at end of file +var _0x05ee=['update','removeListener','length','./dashboardItem.events','save','remove'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0x05ee,0x111));var _0xe05e=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x05ee[_0xabbd2f];return _0x34a040;};'use strict';var DashboardItemEvents=require(_0xe05e('0x0'));var events=[_0xe05e('0x1'),_0xe05e('0x2'),_0xe05e('0x3')];function createListener(_0x546185,_0xa6a13a){return function(_0x801ef2){_0xa6a13a['emit'](_0x546185,_0x801ef2);};}function removeListener(_0x37645e,_0x132ede){return function(){DashboardItemEvents[_0xe05e('0x4')](_0x37645e,_0x132ede);};}exports['register']=function(_0x308356){for(var _0x3397f5=0x0,_0x12a874=events[_0xe05e('0x5')];_0x3397f5<_0x12a874;_0x3397f5++){var _0x3ea6f4=events[_0x3397f5];var _0x56ad4c=createListener('dashboardItem:'+_0x3ea6f4,_0x308356);DashboardItemEvents['on'](_0x3ea6f4,_0x56ad4c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 78cb4d1..b6625e4 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 _0x9e22=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x558a32,_0x186b9e){var _0x7185b4=function(_0x257277){while(--_0x257277){_0x558a32['push'](_0x558a32['shift']());}};_0x7185b4(++_0x186b9e);}(_0x9e22,0x143));var _0x29e2=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x9e22[_0x53fe97];return _0x5c49a2;};'use strict';var multer=require(_0x29e2('0x0'));var util=require(_0x29e2('0x1'));var path=require('path');var timeout=require(_0x29e2('0x2'));var express=require('express');var router=express[_0x29e2('0x3')]();var fs_extra=require(_0x29e2('0x4'));var auth=require(_0x29e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x29e2('0x6'));var controller=require('./dashboardItem.controller');router[_0x29e2('0x7')]('/:id',auth[_0x29e2('0x8')](),controller[_0x29e2('0x9')]);router[_0x29e2('0xa')]('/',auth[_0x29e2('0x8')](),controller[_0x29e2('0xb')]);router[_0x29e2('0xc')](_0x29e2('0xd'),auth[_0x29e2('0x8')](),controller[_0x29e2('0xe')]);router[_0x29e2('0xf')]('/:id',auth[_0x29e2('0x8')](),controller[_0x29e2('0x10')]);module[_0x29e2('0x11')]=router; \ No newline at end of file +var _0x667f=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x12df28,_0x291c3c){var _0x37cd3c=function(_0x2b746d){while(--_0x2b746d){_0x12df28['push'](_0x12df28['shift']());}};_0x37cd3c(++_0x291c3c);}(_0x667f,0x8a));var _0xf667=function(_0x2da544,_0x17a9f7){_0x2da544=_0x2da544-0x0;var _0x1d2e53=_0x667f[_0x2da544];return _0x1d2e53;};'use strict';var multer=require(_0xf667('0x0'));var util=require('util');var path=require(_0xf667('0x1'));var timeout=require(_0xf667('0x2'));var express=require('express');var router=express[_0xf667('0x3')]();var fs_extra=require(_0xf667('0x4'));var auth=require(_0xf667('0x5'));var interaction=require(_0xf667('0x6'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xf667('0x7')](_0xf667('0x8'),auth[_0xf667('0x9')](),controller[_0xf667('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf667('0xb')]);router[_0xf667('0xc')](_0xf667('0x8'),auth[_0xf667('0x9')](),controller[_0xf667('0xd')]);router[_0xf667('0xe')]('/:id',auth[_0xf667('0x9')](),controller[_0xf667('0xf')]);module[_0xf667('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 2464494..55bec70 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 _0xc3ac=['STRING','ENUM','first','third','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc3ac,0x1f0));var _0xcc3a=function(_0x611333,_0x1121a){_0x611333=_0x611333-0x0;var _0x3726c3=_0xc3ac[_0x611333];return _0x3726c3;};'use strict';var Sequelize=require(_0xcc3a('0x0'));module[_0xcc3a('0x1')]={'name':{'type':Sequelize[_0xcc3a('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xcc3a('0x3')](_0xcc3a('0x4'),'second',_0xcc3a('0x5')),'allowNull':![],'defaultValue':_0xcc3a('0x4')},'description':{'type':Sequelize[_0xcc3a('0x2')]}}; \ No newline at end of file +var _0xcd74=['sequelize','exports','STRING','ENUM','first'];(function(_0x1ef547,_0x31bfdb){var _0x1d697b=function(_0x57fbdc){while(--_0x57fbdc){_0x1ef547['push'](_0x1ef547['shift']());}};_0x1d697b(++_0x31bfdb);}(_0xcd74,0x1db));var _0x4cd7=function(_0x481bdf,_0x4f95f8){_0x481bdf=_0x481bdf-0x0;var _0x11f09d=_0xcd74[_0x481bdf];return _0x11f09d;};'use strict';var Sequelize=require(_0x4cd7('0x0'));module[_0x4cd7('0x1')]={'name':{'type':Sequelize[_0x4cd7('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x4cd7('0x3')](_0x4cd7('0x4'),'second','third'),'allowNull':![],'defaultValue':_0x4cd7('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d6966c6..99c1336 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 _0x2b1b=['get','Dispositions','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','length','includeAll','options','Disposition','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy'];(function(_0x1313a6,_0x322a25){var _0x3bc093=function(_0x484501){while(--_0x484501){_0x1313a6['push'](_0x1313a6['shift']());}};_0x3bc093(++_0x322a25);}(_0x2b1b,0x11f));var _0xb2b1=function(_0x5d7b16,_0x274bc2){_0x5d7b16=_0x5d7b16-0x0;var _0x441f4b=_0x2b1b[_0x5d7b16];return _0x441f4b;};'use strict';var emlformat=require(_0xb2b1('0x0'));var rimraf=require(_0xb2b1('0x1'));var zipdir=require(_0xb2b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2b1('0x3'));var moment=require(_0xb2b1('0x4'));var BPromise=require(_0xb2b1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb2b1('0x6'));var sox=require(_0xb2b1('0x7'));var csv=require(_0xb2b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2b1('0x9'));var squel=require(_0xb2b1('0xa'));var crypto=require(_0xb2b1('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb2b1('0x8'));var querystring=require(_0xb2b1('0xc'));var Papa=require(_0xb2b1('0xd'));var Redis=require(_0xb2b1('0xe'));var authService=require(_0xb2b1('0xf'));var qs=require(_0xb2b1('0x10'));var as=require(_0xb2b1('0x11'));var hardwareService=require(_0xb2b1('0x12'));var logger=require(_0xb2b1('0x13'))('api');var utils=require(_0xb2b1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb2b1('0x15'));var db=require(_0xb2b1('0x16'))['db'];function respondWithStatusCode(_0x211788,_0x1d14d0){_0x1d14d0=_0x1d14d0||0xcc;return function(_0x15e674){if(_0x15e674){return _0x211788[_0xb2b1('0x17')](_0x1d14d0);}return _0x211788[_0xb2b1('0x18')](_0x1d14d0)[_0xb2b1('0x19')]();};}function respondWithResult(_0x2aab62,_0xed6b41){_0xed6b41=_0xed6b41||0xc8;return function(_0x2eee4f){if(_0x2eee4f){return _0x2aab62['status'](_0xed6b41)[_0xb2b1('0x1a')](_0x2eee4f);}};}function respondWithFilteredResult(_0x5db0f3,_0x600647){return function(_0x1fa19e){if(_0x1fa19e){var _0x79cf05=typeof _0x600647['offset']===_0xb2b1('0x1b')&&typeof _0x600647[_0xb2b1('0x1c')]==='undefined';var _0x5c873f=_0x1fa19e[_0xb2b1('0x1d')];var _0x19561c=_0x79cf05?0x0:_0x600647[_0xb2b1('0x1e')];var _0x598eef=_0x79cf05?_0x1fa19e[_0xb2b1('0x1d')]:_0x600647[_0xb2b1('0x1e')]+_0x600647[_0xb2b1('0x1c')];var _0x5edf0e;if(_0x598eef>=_0x5c873f){_0x598eef=_0x5c873f;_0x5edf0e=0xc8;}else{_0x5edf0e=0xce;}_0x5db0f3[_0xb2b1('0x18')](_0x5edf0e);return _0x5db0f3[_0xb2b1('0x1f')](_0xb2b1('0x20'),_0x19561c+'-'+_0x598eef+'/'+_0x5c873f)[_0xb2b1('0x1a')](_0x1fa19e);}return null;};}function patchUpdates(_0x1698b7){return function(_0x25683b){try{jsonpatch['apply'](_0x25683b,_0x1698b7,!![]);}catch(_0x858550){return BPromise['reject'](_0x858550);}return _0x25683b[_0xb2b1('0x21')]();};}function saveUpdates(_0x37f636,_0x4d0efb){return function(_0x1f18f8){if(_0x1f18f8){return _0x1f18f8[_0xb2b1('0x22')](_0x37f636)[_0xb2b1('0x23')](function(_0x92aa66){return _0x92aa66;});}return null;};}function removeEntity(_0x3dd0fc,_0x4bbd80){return function(_0x4046fb){if(_0x4046fb){return _0x4046fb[_0xb2b1('0x24')]()[_0xb2b1('0x23')](function(){var _0x5912d0=_0x4046fb[_0xb2b1('0x25')]({'plain':!![]});var _0x52c959=_0xb2b1('0x26');return db['UserProfileResource'][_0xb2b1('0x24')]({'where':{'type':_0x52c959,'resourceId':_0x5912d0['id']}})[_0xb2b1('0x23')](function(){return _0x4046fb;});})[_0xb2b1('0x23')](function(){_0x3dd0fc[_0xb2b1('0x18')](0xcc)[_0xb2b1('0x19')]();});}};}function handleEntityNotFound(_0x4e4d9f,_0x540750){return function(_0x5858b4){if(!_0x5858b4){_0x4e4d9f[_0xb2b1('0x17')](0x194);}return _0x5858b4;};}function handleError(_0x26dc47,_0x1c9fea){_0x1c9fea=_0x1c9fea||0x1f4;return function(_0x201d17){logger[_0xb2b1('0x27')](_0x201d17[_0xb2b1('0x28')]);if(_0x201d17[_0xb2b1('0x29')]){delete _0x201d17[_0xb2b1('0x29')];}_0x26dc47[_0xb2b1('0x18')](_0x1c9fea)[_0xb2b1('0x2a')](_0x201d17);};}exports[_0xb2b1('0x2b')]=function(_0x479917,_0x12a567){var _0x3a661f={},_0x27a744={},_0x3756c2={'count':0x0,'rows':[]};var _0xf18e80=_[_0xb2b1('0x2c')](db['Disposition'][_0xb2b1('0x2d')],function(_0x105f75){return{'name':_0x105f75['fieldName'],'type':_0x105f75[_0xb2b1('0x2e')][_0xb2b1('0x2f')]};});_0x27a744[_0xb2b1('0x30')]=_['map'](_0xf18e80,_0xb2b1('0x29'));_0x27a744[_0xb2b1('0x31')]=_[_0xb2b1('0x32')](_0x479917['query']);_0x27a744[_0xb2b1('0x33')]=_['intersection'](_0x27a744[_0xb2b1('0x30')],_0x27a744[_0xb2b1('0x31')]);_0x3a661f[_0xb2b1('0x34')]=_[_0xb2b1('0x35')](_0x27a744[_0xb2b1('0x30')],qs[_0xb2b1('0x36')](_0x479917[_0xb2b1('0x31')]['fields']));_0x3a661f[_0xb2b1('0x34')]=_0x3a661f[_0xb2b1('0x34')]['length']?_0x3a661f[_0xb2b1('0x34')]:_0x27a744[_0xb2b1('0x30')];if(!_0x479917[_0xb2b1('0x31')][_0xb2b1('0x37')](_0xb2b1('0x38'))){_0x3a661f[_0xb2b1('0x1c')]=qs[_0xb2b1('0x1c')](_0x479917['query'][_0xb2b1('0x1c')]);_0x3a661f['offset']=qs[_0xb2b1('0x1e')](_0x479917[_0xb2b1('0x31')][_0xb2b1('0x1e')]);}_0x3a661f['order']=qs['sort'](_0x479917[_0xb2b1('0x31')][_0xb2b1('0x39')]);_0x3a661f[_0xb2b1('0x3a')]=qs[_0xb2b1('0x33')](_[_0xb2b1('0x3b')](_0x479917[_0xb2b1('0x31')],_0x27a744[_0xb2b1('0x33')]),_0xf18e80);if(_0x479917['query'][_0xb2b1('0x3c')]){_0x3a661f[_0xb2b1('0x3a')]=_[_0xb2b1('0x3d')](_0x3a661f['where'],{'$or':_['map'](_0xf18e80,function(_0x1d9484){if(_0x1d9484[_0xb2b1('0x2e')]!==_0xb2b1('0x3e')){var _0x1d9ed2={};_0x1d9ed2[_0x1d9484[_0xb2b1('0x29')]]={'$like':'%'+_0x479917['query'][_0xb2b1('0x3c')]+'%'};return _0x1d9ed2;}})});}_0x3a661f=_[_0xb2b1('0x3d')]({},_0x3a661f,_0x479917['options']);var _0x59b506={'where':_0x3a661f[_0xb2b1('0x3a')]};return db['Disposition'][_0xb2b1('0x1d')](_0x59b506)[_0xb2b1('0x23')](function(_0x3cae57){_0x3756c2[_0xb2b1('0x1d')]=_0x3cae57;if(_0x479917[_0xb2b1('0x31')]['includeAll']){_0x3a661f[_0xb2b1('0x3f')]=[{'all':!![]}];}return db['Disposition'][_0xb2b1('0x40')](_0x3a661f);})[_0xb2b1('0x23')](function(_0xa70bc3){_0x3756c2['rows']=_0xa70bc3;return _0x3756c2;})['then'](respondWithFilteredResult(_0x12a567,_0x3a661f))[_0xb2b1('0x41')](handleError(_0x12a567,null));};exports[_0xb2b1('0x42')]=function(_0x1f353a,_0x1665c5){var _0x31d94d={'raw':!![],'where':{'id':_0x1f353a['params']['id']}},_0x14b11d={};_0x14b11d[_0xb2b1('0x30')]=_[_0xb2b1('0x32')](db['Disposition']['rawAttributes']);_0x14b11d['query']=_['keys'](_0x1f353a[_0xb2b1('0x31')]);_0x14b11d[_0xb2b1('0x33')]=_[_0xb2b1('0x35')](_0x14b11d[_0xb2b1('0x30')],_0x14b11d[_0xb2b1('0x31')]);_0x31d94d['attributes']=_['intersection'](_0x14b11d['model'],qs[_0xb2b1('0x36')](_0x1f353a['query'][_0xb2b1('0x36')]));_0x31d94d[_0xb2b1('0x34')]=_0x31d94d[_0xb2b1('0x34')][_0xb2b1('0x43')]?_0x31d94d[_0xb2b1('0x34')]:_0x14b11d['model'];if(_0x1f353a['query'][_0xb2b1('0x44')]){_0x31d94d[_0xb2b1('0x3f')]=[{'all':!![]}];}_0x31d94d=_['merge']({},_0x31d94d,_0x1f353a[_0xb2b1('0x45')]);return db[_0xb2b1('0x46')][_0xb2b1('0x47')](_0x31d94d)['then'](handleEntityNotFound(_0x1665c5,null))[_0xb2b1('0x23')](respondWithResult(_0x1665c5,null))[_0xb2b1('0x41')](handleError(_0x1665c5,null));};exports[_0xb2b1('0x48')]=function(_0x2f9088,_0x44608b){return db['Disposition']['create'](_0x2f9088[_0xb2b1('0x49')],{})[_0xb2b1('0x23')](function(_0x41d39d){var _0x35c242=_0x2f9088[_0xb2b1('0x4a')][_0xb2b1('0x25')]({'plain':!![]});if(!_0x35c242)throw new Error(_0xb2b1('0x4b'));if(_0x35c242[_0xb2b1('0x4c')]===_0xb2b1('0x4a')){var _0x5a2cbf=_0x41d39d[_0xb2b1('0x25')]({'plain':!![]});var _0x6e0794=_0xb2b1('0x26');return db['UserProfileSection'][_0xb2b1('0x47')]({'where':{'name':_0x6e0794,'userProfileId':_0x35c242[_0xb2b1('0x4d')]},'raw':!![]})[_0xb2b1('0x23')](function(_0x4b1557){if(_0x4b1557&&_0x4b1557['autoAssociation']===0x0){return db[_0xb2b1('0x4e')][_0xb2b1('0x48')]({'name':_0x5a2cbf[_0xb2b1('0x29')],'resourceId':_0x5a2cbf['id'],'type':_0x4b1557[_0xb2b1('0x29')],'sectionId':_0x4b1557['id']},{})[_0xb2b1('0x23')](function(){return _0x41d39d;});}else{return _0x41d39d;}})['catch'](function(_0x36ef4b){logger[_0xb2b1('0x27')](_0xb2b1('0x4f'),_0x36ef4b);throw _0x36ef4b;});}return _0x41d39d;})['then'](respondWithResult(_0x44608b,0xc9))['catch'](handleError(_0x44608b,null));};exports['update']=function(_0x48b56e,_0x1abd1a){if(_0x48b56e[_0xb2b1('0x49')]['id']){delete _0x48b56e[_0xb2b1('0x49')]['id'];}return db[_0xb2b1('0x46')][_0xb2b1('0x47')]({'where':{'id':_0x48b56e['params']['id']}})[_0xb2b1('0x23')](handleEntityNotFound(_0x1abd1a,null))[_0xb2b1('0x23')](saveUpdates(_0x48b56e[_0xb2b1('0x49')],null))['then'](respondWithResult(_0x1abd1a,null))['catch'](handleError(_0x1abd1a,null));};exports[_0xb2b1('0x24')]=function(_0x43b467,_0x1c1563){return db[_0xb2b1('0x46')][_0xb2b1('0x47')]({'where':{'id':_0x43b467[_0xb2b1('0x50')]['id']}})[_0xb2b1('0x23')](handleEntityNotFound(_0x1c1563,null))[_0xb2b1('0x23')](removeEntity(_0x1c1563,null))['catch'](handleError(_0x1c1563,null));}; \ No newline at end of file +var _0xa8bf=['query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','intersection','include','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','then','get','Dispositions','UserProfileResource','end','sendStatus','stack','name','send','index','map','Disposition','type','key','model'];(function(_0x370b49,_0x151875){var _0x23864c=function(_0x142ae5){while(--_0x142ae5){_0x370b49['push'](_0x370b49['shift']());}};_0x23864c(++_0x151875);}(_0xa8bf,0x1c2));var _0xfa8b=function(_0x10a12a,_0xee7529){_0x10a12a=_0x10a12a-0x0;var _0x1905af=_0xa8bf[_0x10a12a];return _0x1905af;};'use strict';var emlformat=require(_0xfa8b('0x0'));var rimraf=require(_0xfa8b('0x1'));var zipdir=require(_0xfa8b('0x2'));var jsonpatch=require(_0xfa8b('0x3'));var rp=require(_0xfa8b('0x4'));var moment=require('moment');var BPromise=require(_0xfa8b('0x5'));var Mustache=require('mustache');var util=require(_0xfa8b('0x6'));var path=require(_0xfa8b('0x7'));var sox=require('sox');var csv=require(_0xfa8b('0x8'));var ejs=require(_0xfa8b('0x9'));var fs=require('fs');var fs_extra=require(_0xfa8b('0xa'));var _=require(_0xfa8b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa8b('0xc'));var deskjs=require(_0xfa8b('0xd'));var toCsv=require(_0xfa8b('0x8'));var querystring=require(_0xfa8b('0xe'));var Papa=require('papaparse');var Redis=require(_0xfa8b('0xf'));var authService=require(_0xfa8b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfa8b('0x11'));var hardwareService=require(_0xfa8b('0x12'));var logger=require(_0xfa8b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfa8b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa8b('0x15'))['db'];function respondWithStatusCode(_0x5934b6,_0x2f891f){_0x2f891f=_0x2f891f||0xcc;return function(_0x5f4142){if(_0x5f4142){return _0x5934b6['sendStatus'](_0x2f891f);}return _0x5934b6[_0xfa8b('0x16')](_0x2f891f)['end']();};}function respondWithResult(_0x12e0dd,_0x1febd1){_0x1febd1=_0x1febd1||0xc8;return function(_0x4afd00){if(_0x4afd00){return _0x12e0dd[_0xfa8b('0x16')](_0x1febd1)[_0xfa8b('0x17')](_0x4afd00);}};}function respondWithFilteredResult(_0x5a5fa1,_0x4e7b8f){return function(_0x50cb12){if(_0x50cb12){var _0x3ed057=typeof _0x4e7b8f[_0xfa8b('0x18')]===_0xfa8b('0x19')&&typeof _0x4e7b8f['limit']===_0xfa8b('0x19');var _0x3e0882=_0x50cb12[_0xfa8b('0x1a')];var _0x3c4397=_0x3ed057?0x0:_0x4e7b8f[_0xfa8b('0x18')];var _0x4db6f6=_0x3ed057?_0x50cb12[_0xfa8b('0x1a')]:_0x4e7b8f[_0xfa8b('0x18')]+_0x4e7b8f[_0xfa8b('0x1b')];var _0x2628ef;if(_0x4db6f6>=_0x3e0882){_0x4db6f6=_0x3e0882;_0x2628ef=0xc8;}else{_0x2628ef=0xce;}_0x5a5fa1[_0xfa8b('0x16')](_0x2628ef);return _0x5a5fa1['set'](_0xfa8b('0x1c'),_0x3c4397+'-'+_0x4db6f6+'/'+_0x3e0882)[_0xfa8b('0x17')](_0x50cb12);}return null;};}function patchUpdates(_0x34d284){return function(_0x4b1af0){try{jsonpatch[_0xfa8b('0x1d')](_0x4b1af0,_0x34d284,!![]);}catch(_0x4641a7){return BPromise[_0xfa8b('0x1e')](_0x4641a7);}return _0x4b1af0['save']();};}function saveUpdates(_0x320f60,_0x307499){return function(_0x955222){if(_0x955222){return _0x955222[_0xfa8b('0x1f')](_0x320f60)['then'](function(_0x35cf5b){return _0x35cf5b;});}return null;};}function removeEntity(_0x1a2b32,_0x346797){return function(_0x4936aa){if(_0x4936aa){return _0x4936aa[_0xfa8b('0x20')]()[_0xfa8b('0x21')](function(){var _0x370cae=_0x4936aa[_0xfa8b('0x22')]({'plain':!![]});var _0x162ff9=_0xfa8b('0x23');return db[_0xfa8b('0x24')][_0xfa8b('0x20')]({'where':{'type':_0x162ff9,'resourceId':_0x370cae['id']}})[_0xfa8b('0x21')](function(){return _0x4936aa;});})[_0xfa8b('0x21')](function(){_0x1a2b32['status'](0xcc)[_0xfa8b('0x25')]();});}};}function handleEntityNotFound(_0x3e12c4,_0x2b60da){return function(_0xa5c3a8){if(!_0xa5c3a8){_0x3e12c4[_0xfa8b('0x26')](0x194);}return _0xa5c3a8;};}function handleError(_0x55b3e3,_0x1659fa){_0x1659fa=_0x1659fa||0x1f4;return function(_0x1e08c9){logger['error'](_0x1e08c9[_0xfa8b('0x27')]);if(_0x1e08c9[_0xfa8b('0x28')]){delete _0x1e08c9['name'];}_0x55b3e3[_0xfa8b('0x16')](_0x1659fa)[_0xfa8b('0x29')](_0x1e08c9);};}exports[_0xfa8b('0x2a')]=function(_0x69834e,_0x2e3cc0){var _0x697f1b={},_0x118336={},_0x26d4d9={'count':0x0,'rows':[]};var _0x299f98=_[_0xfa8b('0x2b')](db[_0xfa8b('0x2c')]['rawAttributes'],function(_0x5e6462){return{'name':_0x5e6462['fieldName'],'type':_0x5e6462[_0xfa8b('0x2d')][_0xfa8b('0x2e')]};});_0x118336[_0xfa8b('0x2f')]=_[_0xfa8b('0x2b')](_0x299f98,_0xfa8b('0x28'));_0x118336[_0xfa8b('0x30')]=_['keys'](_0x69834e[_0xfa8b('0x30')]);_0x118336['filters']=_['intersection'](_0x118336[_0xfa8b('0x2f')],_0x118336[_0xfa8b('0x30')]);_0x697f1b['attributes']=_['intersection'](_0x118336[_0xfa8b('0x2f')],qs[_0xfa8b('0x31')](_0x69834e[_0xfa8b('0x30')][_0xfa8b('0x31')]));_0x697f1b[_0xfa8b('0x32')]=_0x697f1b['attributes'][_0xfa8b('0x33')]?_0x697f1b[_0xfa8b('0x32')]:_0x118336[_0xfa8b('0x2f')];if(!_0x69834e[_0xfa8b('0x30')][_0xfa8b('0x34')](_0xfa8b('0x35'))){_0x697f1b[_0xfa8b('0x1b')]=qs[_0xfa8b('0x1b')](_0x69834e[_0xfa8b('0x30')]['limit']);_0x697f1b[_0xfa8b('0x18')]=qs[_0xfa8b('0x18')](_0x69834e['query'][_0xfa8b('0x18')]);}_0x697f1b[_0xfa8b('0x36')]=qs['sort'](_0x69834e[_0xfa8b('0x30')][_0xfa8b('0x37')]);_0x697f1b[_0xfa8b('0x38')]=qs[_0xfa8b('0x39')](_[_0xfa8b('0x3a')](_0x69834e['query'],_0x118336[_0xfa8b('0x39')]),_0x299f98);if(_0x69834e[_0xfa8b('0x30')]['filter']){_0x697f1b[_0xfa8b('0x38')]=_['merge'](_0x697f1b[_0xfa8b('0x38')],{'$or':_['map'](_0x299f98,function(_0x57c839){if(_0x57c839['type']!==_0xfa8b('0x3b')){var _0x3ee7a8={};_0x3ee7a8[_0x57c839[_0xfa8b('0x28')]]={'$like':'%'+_0x69834e[_0xfa8b('0x30')][_0xfa8b('0x3c')]+'%'};return _0x3ee7a8;}})});}_0x697f1b=_[_0xfa8b('0x3d')]({},_0x697f1b,_0x69834e[_0xfa8b('0x3e')]);var _0x25c84a={'where':_0x697f1b['where']};return db[_0xfa8b('0x2c')][_0xfa8b('0x1a')](_0x25c84a)[_0xfa8b('0x21')](function(_0x54a8e1){_0x26d4d9[_0xfa8b('0x1a')]=_0x54a8e1;if(_0x69834e['query'][_0xfa8b('0x3f')]){_0x697f1b['include']=[{'all':!![]}];}return db[_0xfa8b('0x2c')][_0xfa8b('0x40')](_0x697f1b);})[_0xfa8b('0x21')](function(_0x5bc97e){_0x26d4d9[_0xfa8b('0x41')]=_0x5bc97e;return _0x26d4d9;})[_0xfa8b('0x21')](respondWithFilteredResult(_0x2e3cc0,_0x697f1b))[_0xfa8b('0x42')](handleError(_0x2e3cc0,null));};exports[_0xfa8b('0x43')]=function(_0x2edce2,_0x1421ee){var _0x399c2b={'raw':!![],'where':{'id':_0x2edce2[_0xfa8b('0x44')]['id']}},_0x5d9a7e={};_0x5d9a7e[_0xfa8b('0x2f')]=_['keys'](db[_0xfa8b('0x2c')][_0xfa8b('0x45')]);_0x5d9a7e['query']=_[_0xfa8b('0x46')](_0x2edce2[_0xfa8b('0x30')]);_0x5d9a7e[_0xfa8b('0x39')]=_[_0xfa8b('0x47')](_0x5d9a7e[_0xfa8b('0x2f')],_0x5d9a7e[_0xfa8b('0x30')]);_0x399c2b[_0xfa8b('0x32')]=_[_0xfa8b('0x47')](_0x5d9a7e[_0xfa8b('0x2f')],qs[_0xfa8b('0x31')](_0x2edce2[_0xfa8b('0x30')][_0xfa8b('0x31')]));_0x399c2b['attributes']=_0x399c2b[_0xfa8b('0x32')][_0xfa8b('0x33')]?_0x399c2b['attributes']:_0x5d9a7e[_0xfa8b('0x2f')];if(_0x2edce2[_0xfa8b('0x30')][_0xfa8b('0x3f')]){_0x399c2b[_0xfa8b('0x48')]=[{'all':!![]}];}_0x399c2b=_[_0xfa8b('0x3d')]({},_0x399c2b,_0x2edce2[_0xfa8b('0x3e')]);return db[_0xfa8b('0x2c')][_0xfa8b('0x49')](_0x399c2b)[_0xfa8b('0x21')](handleEntityNotFound(_0x1421ee,null))['then'](respondWithResult(_0x1421ee,null))[_0xfa8b('0x42')](handleError(_0x1421ee,null));};exports[_0xfa8b('0x4a')]=function(_0x45bedd,_0x53796f){return db[_0xfa8b('0x2c')][_0xfa8b('0x4a')](_0x45bedd[_0xfa8b('0x4b')],{})[_0xfa8b('0x21')](function(_0x39751b){var _0x4ac480=_0x45bedd[_0xfa8b('0x4c')][_0xfa8b('0x22')]({'plain':!![]});if(!_0x4ac480)throw new Error(_0xfa8b('0x4d'));if(_0x4ac480[_0xfa8b('0x4e')]===_0xfa8b('0x4c')){var _0x35305f=_0x39751b['get']({'plain':!![]});var _0x5e0ebb=_0xfa8b('0x23');return db['UserProfileSection'][_0xfa8b('0x49')]({'where':{'name':_0x5e0ebb,'userProfileId':_0x4ac480[_0xfa8b('0x4f')]},'raw':!![]})['then'](function(_0x396a14){if(_0x396a14&&_0x396a14[_0xfa8b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x35305f[_0xfa8b('0x28')],'resourceId':_0x35305f['id'],'type':_0x396a14[_0xfa8b('0x28')],'sectionId':_0x396a14['id']},{})['then'](function(){return _0x39751b;});}else{return _0x39751b;}})[_0xfa8b('0x42')](function(_0x5abe7f){logger[_0xfa8b('0x51')](_0xfa8b('0x52'),_0x5abe7f);throw _0x5abe7f;});}return _0x39751b;})[_0xfa8b('0x21')](respondWithResult(_0x53796f,0xc9))['catch'](handleError(_0x53796f,null));};exports[_0xfa8b('0x1f')]=function(_0x539b62,_0x1691b7){if(_0x539b62['body']['id']){delete _0x539b62['body']['id'];}return db[_0xfa8b('0x2c')]['find']({'where':{'id':_0x539b62['params']['id']}})[_0xfa8b('0x21')](handleEntityNotFound(_0x1691b7,null))[_0xfa8b('0x21')](saveUpdates(_0x539b62[_0xfa8b('0x4b')],null))['then'](respondWithResult(_0x1691b7,null))[_0xfa8b('0x42')](handleError(_0x1691b7,null));};exports['destroy']=function(_0x5a25d0,_0x1b54d7){return db['Disposition'][_0xfa8b('0x49')]({'where':{'id':_0x5a25d0[_0xfa8b('0x44')]['id']}})[_0xfa8b('0x21')](handleEntityNotFound(_0x1b54d7,null))[_0xfa8b('0x21')](removeEntity(_0x1b54d7,null))[_0xfa8b('0x42')](handleError(_0x1b54d7,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2db45c9..5913275 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 _0x3944=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','name_voice','name_chat','name','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId'];(function(_0x377200,_0x2331de){var _0x2ba92a=function(_0x24f7a8){while(--_0x24f7a8){_0x377200['push'](_0x377200['shift']());}};_0x2ba92a(++_0x2331de);}(_0x3944,0xf0));var _0x4394=function(_0x1c631f,_0x52c12e){_0x1c631f=_0x1c631f-0x0;var _0xe686ca=_0x3944[_0x1c631f];return _0xe686ca;};'use strict';var _=require('lodash');var util=require(_0x4394('0x0'));var logger=require(_0x4394('0x1'))(_0x4394('0x2'));var moment=require(_0x4394('0x3'));var BPromise=require(_0x4394('0x4'));var rp=require(_0x4394('0x5'));var fs=require('fs');var path=require(_0x4394('0x6'));var rimraf=require(_0x4394('0x7'));var config=require(_0x4394('0x8'));var attributes=require(_0x4394('0x9'));module[_0x4394('0xa')]=function(_0x1a7375,_0x4ee2d6){return _0x1a7375['define']('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x4394('0xb'),'fields':['name','ListId']},{'unique':!![],'name':_0x4394('0xc'),'fields':[_0x4394('0xd'),_0x4394('0xe')]},{'unique':!![],'name':_0x4394('0xf'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x4394('0x10'),'fields':[_0x4394('0xd'),_0x4394('0x11')]},{'unique':!![],'name':_0x4394('0x12'),'fields':[_0x4394('0xd'),_0x4394('0x13')]},{'unique':!![],'name':_0x4394('0x14'),'fields':[_0x4394('0xd'),_0x4394('0x15')]},{'unique':!![],'name':_0x4394('0x16'),'fields':[_0x4394('0xd'),_0x4394('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01ff=['api','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger'];(function(_0x35101c,_0x3fcd72){var _0x1e7512=function(_0x2e364b){while(--_0x2e364b){_0x35101c['push'](_0x35101c['shift']());}};_0x1e7512(++_0x3fcd72);}(_0x01ff,0x125));var _0xf01f=function(_0x238235,_0x826021){_0x238235=_0x238235-0x0;var _0x179d70=_0x01ff[_0x238235];return _0x179d70;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf01f('0x0'))(_0xf01f('0x1'));var moment=require('moment');var BPromise=require(_0xf01f('0x2'));var rp=require(_0xf01f('0x3'));var fs=require('fs');var path=require(_0xf01f('0x4'));var rimraf=require(_0xf01f('0x5'));var config=require('../../config/environment');var attributes=require(_0xf01f('0x6'));module[_0xf01f('0x7')]=function(_0xb62e,_0x4b9c17){return _0xb62e['define'](_0xf01f('0x8'),attributes,{'tableName':_0xf01f('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf01f('0xa'),'fields':[_0xf01f('0xb'),_0xf01f('0xc')]},{'unique':!![],'name':_0xf01f('0xd'),'fields':[_0xf01f('0xb'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xf01f('0xb'),'MailAccountId']},{'unique':!![],'name':_0xf01f('0xe'),'fields':['name',_0xf01f('0xf')]},{'unique':!![],'name':_0xf01f('0x10'),'fields':['name',_0xf01f('0x11')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xf01f('0x12')]},{'unique':!![],'name':_0xf01f('0x13'),'fields':[_0xf01f('0xb'),_0xf01f('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 19c155c..13e37b2 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(_0x24f5ea,_0x3e19ea){var _0x5d6de5=function(_0x64ebc2){while(--_0x64ebc2){_0x24f5ea['push'](_0x24f5ea['shift']());}};_0x5d6de5(++_0x3e19ea);}(_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 +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(_0x52abb9,_0x328e54){var _0x3ddd67=function(_0x4e6919){while(--_0x4e6919){_0x52abb9['push'](_0x52abb9['shift']());}};_0x3ddd67(++_0x328e54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 013a70a..d45c871 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 _0x016c=['/:id','post','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get'];(function(_0x4cc712,_0x1f12d8){var _0x3401de=function(_0x348ec5){while(--_0x348ec5){_0x4cc712['push'](_0x4cc712['shift']());}};_0x3401de(++_0x1f12d8);}(_0x016c,0x1da));var _0xc016=function(_0x753a38,_0x1aa4c8){_0x753a38=_0x753a38-0x0;var _0xf5f53c=_0x016c[_0x753a38];return _0xf5f53c;};'use strict';var multer=require(_0xc016('0x0'));var util=require(_0xc016('0x1'));var path=require(_0xc016('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc016('0x3')]();var fs_extra=require(_0xc016('0x4'));var auth=require(_0xc016('0x5'));var interaction=require(_0xc016('0x6'));var config=require(_0xc016('0x7'));var controller=require(_0xc016('0x8'));router['get']('/',auth[_0xc016('0x9')](),controller[_0xc016('0xa')]);router[_0xc016('0xb')](_0xc016('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc016('0xd')]('/',auth[_0xc016('0x9')](),controller['create']);router[_0xc016('0xe')](_0xc016('0xc'),auth[_0xc016('0x9')](),controller[_0xc016('0xf')]);router[_0xc016('0x10')](_0xc016('0xc'),auth[_0xc016('0x9')](),controller['destroy']);module[_0xc016('0x11')]=router; \ No newline at end of file +var _0xb62a=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb62a,0x1a2));var _0xab62=function(_0x57645e,_0x5ba81e){_0x57645e=_0x57645e-0x0;var _0x10ad92=_0xb62a[_0x57645e];return _0x10ad92;};'use strict';var multer=require(_0xab62('0x0'));var util=require(_0xab62('0x1'));var path=require(_0xab62('0x2'));var timeout=require(_0xab62('0x3'));var express=require('express');var router=express[_0xab62('0x4')]();var fs_extra=require(_0xab62('0x5'));var auth=require(_0xab62('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xab62('0x7'));var controller=require(_0xab62('0x8'));router[_0xab62('0x9')]('/',auth[_0xab62('0xa')](),controller[_0xab62('0xb')]);router[_0xab62('0x9')](_0xab62('0xc'),auth[_0xab62('0xa')](),controller['show']);router[_0xab62('0xd')]('/',auth[_0xab62('0xa')](),controller[_0xab62('0xe')]);router['put'](_0xab62('0xc'),auth['isAuthenticated'](),controller[_0xab62('0xf')]);router[_0xab62('0x10')](_0xab62('0xc'),auth[_0xab62('0xa')](),controller[_0xab62('0x11')]);module[_0xab62('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 9d561fb..b35579c 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 _0x2d72=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','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'];(function(_0x3a98de,_0x2f2d42){var _0x4a767d=function(_0x2a9341){while(--_0x2a9341){_0x3a98de['push'](_0x3a98de['shift']());}};_0x4a767d(++_0x2f2d42);}(_0x2d72,0xa8));var _0x22d7=function(_0x10a067,_0x321f71){_0x10a067=_0x10a067-0x0;var _0x351064=_0x2d72[_0x10a067];return _0x351064;};'use strict';var Sequelize=require(_0x22d7('0x0'));module[_0x22d7('0x1')]={'name':{'type':Sequelize[_0x22d7('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x22d7('0x2')]},'ecm':{'type':Sequelize[_0x22d7('0x3')](_0x22d7('0x4'),'no'),'defaultValue':_0x22d7('0x4')},'headerinfo':{'type':Sequelize[_0x22d7('0x2')],'defaultValue':_0x22d7('0x5')},'localstationid':{'type':Sequelize[_0x22d7('0x2')],'unique':_0x22d7('0x6')},'minrate':{'type':Sequelize[_0x22d7('0x3')](_0x22d7('0x7'),_0x22d7('0x8'),'7200',_0x22d7('0x9'),_0x22d7('0xa'),'14400'),'defaultValue':_0x22d7('0x8')},'maxrate':{'type':Sequelize[_0x22d7('0x3')](_0x22d7('0x7'),_0x22d7('0x8'),'7200','9600',_0x22d7('0xa'),_0x22d7('0xb')),'defaultValue':_0x22d7('0xb')},'modem':{'type':Sequelize[_0x22d7('0x2')],'defaultValue':_0x22d7('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x22d7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x22d7('0xe'),_0x22d7('0xf'),'DADHI',_0x22d7('0x10')),'defaultValue':_0x22d7('0xe')},'key':{'type':Sequelize[_0x22d7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x22d7('0x11')],'defaultValue':function(){return _0x22d7('0x12');}},'notificationSound':{'type':Sequelize[_0x22d7('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x22d7('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x22d7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x22d7('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x22d7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x22d7('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x22d7('0x13')],'defaultValue':![],'comment':_0x22d7('0x14'),'set':function(_0xac2233){if(!_0xac2233)this[_0x22d7('0x15')](_0x22d7('0x16'),null);this['setDataValue'](_0x22d7('0x17'),_0xac2233);}}}; \ No newline at end of file +var _0xa23f=['ENUM','yes','STRING','2400','4800','7200','12000','14400','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x142156,_0x5169f8){var _0x5b1ea3=function(_0x26080b){while(--_0x26080b){_0x142156['push'](_0x142156['shift']());}};_0x5b1ea3(++_0x5169f8);}(_0xa23f,0x7c));var _0xfa23=function(_0x44f6b3,_0x189af6){_0x44f6b3=_0x44f6b3-0x0;var _0x397e29=_0xa23f[_0x44f6b3];return _0x397e29;};'use strict';var Sequelize=require(_0xfa23('0x0'));module[_0xfa23('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xfa23('0x2')](_0xfa23('0x3'),'no'),'defaultValue':_0xfa23('0x3')},'headerinfo':{'type':Sequelize[_0xfa23('0x4')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xfa23('0x4')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xfa23('0x2')](_0xfa23('0x5'),_0xfa23('0x6'),_0xfa23('0x7'),'9600',_0xfa23('0x8'),'14400'),'defaultValue':_0xfa23('0x6')},'maxrate':{'type':Sequelize[_0xfa23('0x2')](_0xfa23('0x5'),_0xfa23('0x6'),_0xfa23('0x7'),'9600','12000',_0xfa23('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xfa23('0x4')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xfa23('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xfa23('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xfa23('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xfa23('0xb'),_0xfa23('0xc'),_0xfa23('0xd'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xfa23('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfa23('0xe')],'defaultValue':function(){return _0xfa23('0xf');}},'notificationSound':{'type':Sequelize[_0xfa23('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa23('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfa23('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfa23('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfa23('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfa23('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa23('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0xfa23('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xfa23('0x10')],'defaultValue':![],'comment':_0xfa23('0x12'),'set':function(_0x4e5b77){if(!_0x4e5b77)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xfa23('0x13')](_0xfa23('0x14'),_0x4e5b77);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9144d73..6b325f2 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 _0x8ec3=['Contacts','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','redis','register','jayson/promise','http','client','info','debug','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','find','describe','addDisposition','getDispositions','findOne','Disposition','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','nolimit','ids','addInteraction','FaxInteraction','omit','getInteractions','FaxAccountId','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','findAll','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','findAndCountAll','finally','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','ListId','findById','FaxMessage','$gte','split','CmList','List'];(function(_0x518d89,_0x206af3){var _0x502df8=function(_0x4c8999){while(--_0x4c8999){_0x518d89['push'](_0x518d89['shift']());}};_0x502df8(++_0x206af3);}(_0x8ec3,0x19d));var _0x38ec=function(_0x48dce2,_0x170625){_0x48dce2=_0x48dce2-0x0;var _0x2023e2=_0x8ec3[_0x48dce2];return _0x2023e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38ec('0x0'));var zipdir=require(_0x38ec('0x1'));var jsonpatch=require(_0x38ec('0x2'));var rp=require(_0x38ec('0x3'));var moment=require(_0x38ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x38ec('0x5'));var util=require(_0x38ec('0x6'));var path=require(_0x38ec('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x38ec('0x8'));var fs=require('fs');var fs_extra=require(_0x38ec('0x9'));var _=require(_0x38ec('0xa'));var squel=require(_0x38ec('0xb'));var crypto=require('crypto');var jsforce=require(_0x38ec('0xc'));var deskjs=require(_0x38ec('0xd'));var toCsv=require(_0x38ec('0xe'));var querystring=require(_0x38ec('0xf'));var Papa=require(_0x38ec('0x10'));var Redis=require(_0x38ec('0x11'));var authService=require(_0x38ec('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38ec('0x13'));var logger=require(_0x38ec('0x14'))('api');var utils=require(_0x38ec('0x15'));var config=require(_0x38ec('0x16'));var licenseUtil=require(_0x38ec('0x17'));var db=require('../../mysqldb')['db'];config[_0x38ec('0x18')]=_['defaults'](config[_0x38ec('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38ec('0x18')]));require('./faxAccount.socket')[_0x38ec('0x19')](socket);var jayson=require(_0x38ec('0x1a'));var client=jayson['client'][_0x38ec('0x1b')]({'port':0x232c});var client9002=jayson[_0x38ec('0x1c')][_0x38ec('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x115fa7,_0x2366a4,_0x52093c,_0x28b547){return new BPromise(function(_0x1ea9b9,_0x77c129){var _0x1ede92=_0x28b547||client;return _0x1ede92['request'](_0x115fa7,_0x52093c)['then'](function(_0x828675){logger[_0x38ec('0x1d')]('FaxAccount,\x20%s,\x20%s',_0x2366a4,'request\x20sent');logger[_0x38ec('0x1e')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2366a4,_0x38ec('0x1f'),JSON[_0x38ec('0x20')](_0x828675));if(_0x828675[_0x38ec('0x21')]){if(_0x828675[_0x38ec('0x21')][_0x38ec('0x22')]===0x1f4){logger[_0x38ec('0x21')](_0x38ec('0x23'),_0x2366a4,_0x828675[_0x38ec('0x21')]['message']);return _0x77c129(_0x828675[_0x38ec('0x21')][_0x38ec('0x24')]);}logger[_0x38ec('0x21')](_0x38ec('0x23'),_0x2366a4,_0x828675[_0x38ec('0x21')][_0x38ec('0x24')]);return _0x1ea9b9(_0x828675[_0x38ec('0x21')][_0x38ec('0x24')]);}else{logger['info'](_0x38ec('0x23'),_0x2366a4,_0x38ec('0x1f'));_0x1ea9b9(_0x828675[_0x38ec('0x25')]['message']);}})[_0x38ec('0x26')](function(_0x2a8bce){logger[_0x38ec('0x21')](_0x38ec('0x23'),_0x2366a4,_0x2a8bce);_0x77c129(_0x2a8bce);});});}function respondWithStatusCode(_0x3a6951,_0x54c6ed){_0x54c6ed=_0x54c6ed||0xcc;return function(_0x149865){if(_0x149865){return _0x3a6951['sendStatus'](_0x54c6ed);}return _0x3a6951[_0x38ec('0x27')](_0x54c6ed)[_0x38ec('0x28')]();};}function respondWithResult(_0x3a796e,_0x7e7b67){_0x7e7b67=_0x7e7b67||0xc8;return function(_0x549600){if(_0x549600){return _0x3a796e[_0x38ec('0x27')](_0x7e7b67)[_0x38ec('0x29')](_0x549600);}};}function respondWithFilteredResult(_0x164bc2,_0x350f9f){return function(_0x176e12){if(_0x176e12){var _0x189cd7=typeof _0x350f9f['offset']===_0x38ec('0x2a')&&typeof _0x350f9f['limit']===_0x38ec('0x2a');var _0x16f640=_0x176e12['count'];var _0x5d97ac=_0x189cd7?0x0:_0x350f9f[_0x38ec('0x2b')];var _0x51b34c=_0x189cd7?_0x176e12[_0x38ec('0x2c')]:_0x350f9f[_0x38ec('0x2b')]+_0x350f9f[_0x38ec('0x2d')];var _0x32850d;if(_0x51b34c>=_0x16f640){_0x51b34c=_0x16f640;_0x32850d=0xc8;}else{_0x32850d=0xce;}_0x164bc2['status'](_0x32850d);return _0x164bc2[_0x38ec('0x2e')](_0x38ec('0x2f'),_0x5d97ac+'-'+_0x51b34c+'/'+_0x16f640)[_0x38ec('0x29')](_0x176e12);}return null;};}function patchUpdates(_0x1c85ad){return function(_0x157eff){try{jsonpatch[_0x38ec('0x30')](_0x157eff,_0x1c85ad,!![]);}catch(_0x2a73d9){return BPromise['reject'](_0x2a73d9);}return _0x157eff[_0x38ec('0x31')]();};}function saveUpdates(_0x45fbc2,_0x37794a){return function(_0x372e5a){if(_0x372e5a){return _0x372e5a[_0x38ec('0x32')](_0x45fbc2)[_0x38ec('0x33')](function(_0x2407c8){return _0x2407c8;});}return null;};}function removeEntity(_0x4af298,_0x391f82){return function(_0x5bfc80){if(_0x5bfc80){return _0x5bfc80[_0x38ec('0x34')]()[_0x38ec('0x33')](function(){var _0x3db432=_0x5bfc80[_0x38ec('0x35')]({'plain':!![]});var _0x2c7c29=_0x38ec('0x36');return db[_0x38ec('0x37')]['destroy']({'where':{'type':_0x2c7c29,'resourceId':_0x3db432['id']}})[_0x38ec('0x33')](function(){return _0x5bfc80;});})[_0x38ec('0x33')](function(){_0x4af298[_0x38ec('0x27')](0xcc)[_0x38ec('0x28')]();});}};}function handleEntityNotFound(_0x14d973,_0x1e9806){return function(_0x550e04){if(!_0x550e04){_0x14d973[_0x38ec('0x38')](0x194);}return _0x550e04;};}function handleError(_0x3d58bd,_0x44cd7d){_0x44cd7d=_0x44cd7d||0x1f4;return function(_0x1f9177){logger[_0x38ec('0x21')](_0x1f9177[_0x38ec('0x39')]);if(_0x1f9177[_0x38ec('0x3a')]){delete _0x1f9177[_0x38ec('0x3a')];}_0x3d58bd[_0x38ec('0x27')](_0x44cd7d)['send'](_0x1f9177);};}exports[_0x38ec('0x3b')]=function(_0x584868,_0x2c6ca3){var _0x3c9adb={'include':[{'model':db[_0x38ec('0x3c')],'as':_0x38ec('0x3d')}]},_0x2f80e8={},_0x453a10={'count':0x0,'rows':[]};var _0x38117c=_[_0x38ec('0x3e')](db[_0x38ec('0x3f')][_0x38ec('0x40')],function(_0x4167ab){return{'name':_0x4167ab[_0x38ec('0x41')],'type':_0x4167ab[_0x38ec('0x42')][_0x38ec('0x43')]};});_0x2f80e8[_0x38ec('0x44')]=_[_0x38ec('0x3e')](_0x38117c,_0x38ec('0x3a'));_0x2f80e8[_0x38ec('0x45')]=_[_0x38ec('0x46')](_0x584868[_0x38ec('0x45')]);_0x2f80e8[_0x38ec('0x47')]=_[_0x38ec('0x48')](_0x2f80e8['model'],_0x2f80e8['query']);_0x3c9adb[_0x38ec('0x49')]=_[_0x38ec('0x48')](_0x2f80e8[_0x38ec('0x44')],qs[_0x38ec('0x4a')](_0x584868[_0x38ec('0x45')][_0x38ec('0x4a')]));_0x3c9adb[_0x38ec('0x49')]=_0x3c9adb[_0x38ec('0x49')][_0x38ec('0x4b')]?_0x3c9adb[_0x38ec('0x49')]:_0x2f80e8[_0x38ec('0x44')];if(!_0x584868[_0x38ec('0x45')][_0x38ec('0x4c')]('nolimit')){_0x3c9adb[_0x38ec('0x2d')]=qs[_0x38ec('0x2d')](_0x584868['query'][_0x38ec('0x2d')]);_0x3c9adb['offset']=qs[_0x38ec('0x2b')](_0x584868[_0x38ec('0x45')][_0x38ec('0x2b')]);}_0x3c9adb[_0x38ec('0x4d')]=qs[_0x38ec('0x4e')](_0x584868[_0x38ec('0x45')]['sort']);_0x3c9adb[_0x38ec('0x4f')]=qs[_0x38ec('0x47')](_['pick'](_0x584868[_0x38ec('0x45')],_0x2f80e8['filters']),_0x38117c);if(_0x584868[_0x38ec('0x45')]['filter']){_0x3c9adb[_0x38ec('0x4f')]=_['merge'](_0x3c9adb['where'],{'$or':_[_0x38ec('0x3e')](_0x38117c,function(_0xf277c8){if(_0xf277c8[_0x38ec('0x42')]!==_0x38ec('0x50')){var _0x458a38={};_0x458a38[_0xf277c8[_0x38ec('0x3a')]]={'$like':'%'+_0x584868[_0x38ec('0x45')][_0x38ec('0x51')]+'%'};return _0x458a38;}})});}_0x3c9adb=_[_0x38ec('0x52')]({},_0x3c9adb,_0x584868[_0x38ec('0x53')]);var _0x36952e={'where':_0x3c9adb[_0x38ec('0x4f')]};return db[_0x38ec('0x3f')][_0x38ec('0x2c')](_0x36952e)[_0x38ec('0x33')](function(_0x7351ce){_0x453a10[_0x38ec('0x2c')]=_0x7351ce;if(_0x584868[_0x38ec('0x45')][_0x38ec('0x54')]){_0x3c9adb[_0x38ec('0x55')]=[{'all':!![]}];}return db[_0x38ec('0x3f')]['findAll'](_0x3c9adb);})[_0x38ec('0x33')](function(_0x4168f0){_0x453a10[_0x38ec('0x56')]=_0x4168f0;return _0x453a10;})[_0x38ec('0x33')](respondWithFilteredResult(_0x2c6ca3,_0x3c9adb))['catch'](handleError(_0x2c6ca3,null));};exports[_0x38ec('0x57')]=function(_0xd0faa2,_0xaa47b0){var _0x3434df={'raw':![],'where':{'id':_0xd0faa2[_0x38ec('0x58')]['id']},'include':[{'model':db[_0x38ec('0x3c')],'as':'mandatoryDispositionPause'}]},_0x1b7ae7={};_0x1b7ae7[_0x38ec('0x44')]=_['keys'](db[_0x38ec('0x3f')][_0x38ec('0x40')]);_0x1b7ae7[_0x38ec('0x45')]=_[_0x38ec('0x46')](_0xd0faa2[_0x38ec('0x45')]);_0x1b7ae7['filters']=_[_0x38ec('0x48')](_0x1b7ae7['model'],_0x1b7ae7['query']);_0x3434df[_0x38ec('0x49')]=_['intersection'](_0x1b7ae7[_0x38ec('0x44')],qs['fields'](_0xd0faa2['query'][_0x38ec('0x4a')]));_0x3434df[_0x38ec('0x49')]=_0x3434df[_0x38ec('0x49')]['length']?_0x3434df[_0x38ec('0x49')]:_0x1b7ae7['model'];if(_0xd0faa2[_0x38ec('0x45')]['includeAll']){_0x3434df[_0x38ec('0x55')]=[{'all':!![]}];}_0x3434df=_[_0x38ec('0x52')]({},_0x3434df,_0xd0faa2[_0x38ec('0x53')]);return db[_0x38ec('0x3f')]['find'](_0x3434df)[_0x38ec('0x33')](handleEntityNotFound(_0xaa47b0,null))[_0x38ec('0x33')](respondWithResult(_0xaa47b0,null))[_0x38ec('0x26')](handleError(_0xaa47b0,null));};exports[_0x38ec('0x59')]=function(_0x3e3ca3,_0x503a8b){return db['FaxAccount'][_0x38ec('0x59')](_0x3e3ca3[_0x38ec('0x5a')],{})[_0x38ec('0x33')](function(_0xb25153){var _0x42f203=_0x3e3ca3[_0x38ec('0x5b')][_0x38ec('0x35')]({'plain':!![]});if(!_0x42f203)throw new Error(_0x38ec('0x5c'));if(_0x42f203[_0x38ec('0x5d')]==='user'){var _0x3267f3=_0xb25153['get']({'plain':!![]});var _0x6d5f2b=_0x38ec('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x6d5f2b,'userProfileId':_0x42f203[_0x38ec('0x5e')]},'raw':!![]})['then'](function(_0x371d5e){if(_0x371d5e&&_0x371d5e[_0x38ec('0x5f')]===0x0){return db[_0x38ec('0x37')][_0x38ec('0x59')]({'name':_0x3267f3[_0x38ec('0x3a')],'resourceId':_0x3267f3['id'],'type':_0x371d5e[_0x38ec('0x3a')],'sectionId':_0x371d5e['id']},{})[_0x38ec('0x33')](function(){return _0xb25153;});}else{return _0xb25153;}})[_0x38ec('0x26')](function(_0x2e782b){logger[_0x38ec('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e782b);throw _0x2e782b;});}return _0xb25153;})[_0x38ec('0x33')](respondWithResult(_0x503a8b,0xc9))[_0x38ec('0x26')](handleError(_0x503a8b,null));};exports['update']=function(_0x5e3700,_0xec5315){if(_0x5e3700[_0x38ec('0x5a')]['id']){delete _0x5e3700['body']['id'];}return db[_0x38ec('0x3f')][_0x38ec('0x60')]({'where':{'id':_0x5e3700[_0x38ec('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x38ec('0x3d')}]})['then'](handleEntityNotFound(_0xec5315,null))[_0x38ec('0x33')](saveUpdates(_0x5e3700[_0x38ec('0x5a')],null))[_0x38ec('0x33')](respondWithResult(_0xec5315,null))[_0x38ec('0x26')](handleError(_0xec5315,null));};exports[_0x38ec('0x34')]=function(_0x5121c4,_0x571589){return db['FaxAccount'][_0x38ec('0x60')]({'where':{'id':_0x5121c4[_0x38ec('0x58')]['id']}})['then'](handleEntityNotFound(_0x571589,null))[_0x38ec('0x33')](removeEntity(_0x571589,null))[_0x38ec('0x26')](handleError(_0x571589,null));};exports[_0x38ec('0x61')]=function(_0x4f0739,_0xc3669a){return db['FaxAccount'][_0x38ec('0x61')]()[_0x38ec('0x33')](respondWithResult(_0xc3669a,null))[_0x38ec('0x26')](handleError(_0xc3669a,null));};exports[_0x38ec('0x62')]=function(_0x21b71b,_0x4dfe4c,_0x17c826){if(_0x21b71b[_0x38ec('0x5a')]['id']){delete _0x21b71b[_0x38ec('0x5a')]['id'];}return db[_0x38ec('0x3f')][_0x38ec('0x60')]({'where':{'id':_0x21b71b[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x4dfe4c,null))['then'](function(_0x47a4e2){if(_0x47a4e2){_0x21b71b[_0x38ec('0x5a')]['FaxAccountId']=_0x47a4e2['id'];return db['Disposition']['create'](_0x21b71b[_0x38ec('0x5a')]);}})['then'](respondWithResult(_0x4dfe4c,null))[_0x38ec('0x26')](handleError(_0x4dfe4c,null));};exports[_0x38ec('0x63')]=function(_0x2e0365,_0x1dfc68,_0x12bef8){var _0x26e7a0={'raw':![],'where':{}};var _0xcda73c={};var _0x53220a={'count':0x0,'rows':[]};return db[_0x38ec('0x3f')][_0x38ec('0x64')]({'where':{'id':_0x2e0365[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x1dfc68,null))[_0x38ec('0x33')](function(_0x2bfb92){if(_0x2bfb92){_0xcda73c[_0x38ec('0x44')]=_[_0x38ec('0x46')](db[_0x38ec('0x65')][_0x38ec('0x40')]);_0xcda73c[_0x38ec('0x45')]=_[_0x38ec('0x46')](_0x2e0365['query']);_0xcda73c[_0x38ec('0x47')]=_[_0x38ec('0x48')](_0xcda73c['model'],_0xcda73c[_0x38ec('0x45')]);_0x26e7a0[_0x38ec('0x49')]=_[_0x38ec('0x48')](_0xcda73c[_0x38ec('0x44')],qs['fields'](_0x2e0365[_0x38ec('0x45')][_0x38ec('0x4a')]));_0x26e7a0[_0x38ec('0x49')]=_0x26e7a0[_0x38ec('0x49')][_0x38ec('0x4b')]?_0x26e7a0[_0x38ec('0x49')]:_0xcda73c['model'];if(!_0x2e0365[_0x38ec('0x45')][_0x38ec('0x4c')]('nolimit')){_0x26e7a0['limit']=qs[_0x38ec('0x2d')](_0x2e0365[_0x38ec('0x45')][_0x38ec('0x2d')]);_0x26e7a0[_0x38ec('0x2b')]=qs[_0x38ec('0x2b')](_0x2e0365[_0x38ec('0x45')]['offset']);}_0x26e7a0['order']=qs[_0x38ec('0x4e')](_0x2e0365[_0x38ec('0x45')]['sort']);_0x26e7a0[_0x38ec('0x4f')]=qs[_0x38ec('0x47')](_[_0x38ec('0x66')](_0x2e0365[_0x38ec('0x45')],_0xcda73c['filters']));_0x26e7a0['where']['FaxAccountId']=_0x2bfb92['id'];if(_0x2e0365['query']['filter']){_0x26e7a0[_0x38ec('0x4f')]=_[_0x38ec('0x52')](_0x26e7a0[_0x38ec('0x4f')],{'$or':_[_0x38ec('0x3e')](_0x26e7a0['attributes'],function(_0x315376){var _0x299e72={};_0x299e72[_0x315376]={'$like':'%'+_0x2e0365[_0x38ec('0x45')][_0x38ec('0x51')]+'%'};return _0x299e72;})});}_0x26e7a0=_[_0x38ec('0x52')]({},_0x26e7a0,_0x2e0365[_0x38ec('0x53')]);return db['Disposition'][_0x38ec('0x2c')]({'where':_0x26e7a0[_0x38ec('0x4f')]})[_0x38ec('0x33')](function(_0x498af2){_0x53220a[_0x38ec('0x2c')]=_0x498af2;if(_0x2e0365['query']['includeAll']){_0x26e7a0['include']=[{'all':!![]}];}return db[_0x38ec('0x65')]['findAll'](_0x26e7a0);})[_0x38ec('0x33')](function(_0x1c909b){_0x53220a[_0x38ec('0x56')]=_0x1c909b;return _0x53220a;});}})[_0x38ec('0x33')](respondWithFilteredResult(_0x1dfc68,_0x26e7a0))[_0x38ec('0x26')](handleError(_0x1dfc68,null));};exports[_0x38ec('0x67')]=function(_0x3a8ff1,_0x4388e2,_0x28f78d){return db[_0x38ec('0x3f')]['find']({'where':{'id':_0x3a8ff1[_0x38ec('0x58')]['id']}})['then'](handleEntityNotFound(_0x4388e2,null))[_0x38ec('0x33')](function(_0x153150){if(_0x153150){return _0x153150['removeDispositions'](_0x3a8ff1[_0x38ec('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x4388e2,null))[_0x38ec('0x26')](handleError(_0x4388e2,null));};exports[_0x38ec('0x68')]=function(_0x2884fa,_0x5c7827,_0x276f53){if(_0x2884fa[_0x38ec('0x5a')]['id']){delete _0x2884fa[_0x38ec('0x5a')]['id'];}return db[_0x38ec('0x3f')][_0x38ec('0x60')]({'where':{'id':_0x2884fa[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x5c7827,null))['then'](function(_0x245664){if(_0x245664){_0x2884fa[_0x38ec('0x5a')]['FaxAccountId']=_0x245664['id'];return db[_0x38ec('0x69')][_0x38ec('0x59')](_0x2884fa[_0x38ec('0x5a')]);}})['then'](respondWithResult(_0x5c7827,null))[_0x38ec('0x26')](handleError(_0x5c7827,null));};exports[_0x38ec('0x6a')]=function(_0x5007b9,_0x384024,_0x4ae63f){var _0x3cce17={'raw':![],'where':{}};var _0x28596c={};var _0x29734f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x38ec('0x64')]({'where':{'id':_0x5007b9[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x384024,null))[_0x38ec('0x33')](function(_0x7be8af){if(_0x7be8af){_0x28596c[_0x38ec('0x44')]=_[_0x38ec('0x46')](db['CannedAnswer'][_0x38ec('0x40')]);_0x28596c[_0x38ec('0x45')]=_['keys'](_0x5007b9[_0x38ec('0x45')]);_0x28596c['filters']=_[_0x38ec('0x48')](_0x28596c['model'],_0x28596c[_0x38ec('0x45')]);_0x3cce17[_0x38ec('0x49')]=_[_0x38ec('0x48')](_0x28596c['model'],qs[_0x38ec('0x4a')](_0x5007b9[_0x38ec('0x45')][_0x38ec('0x4a')]));_0x3cce17['attributes']=_0x3cce17[_0x38ec('0x49')][_0x38ec('0x4b')]?_0x3cce17[_0x38ec('0x49')]:_0x28596c[_0x38ec('0x44')];if(!_0x5007b9['query']['hasOwnProperty'](_0x38ec('0x6b'))){_0x3cce17['limit']=qs[_0x38ec('0x2d')](_0x5007b9['query'][_0x38ec('0x2d')]);_0x3cce17[_0x38ec('0x2b')]=qs[_0x38ec('0x2b')](_0x5007b9[_0x38ec('0x45')]['offset']);}_0x3cce17['order']=qs[_0x38ec('0x4e')](_0x5007b9[_0x38ec('0x45')][_0x38ec('0x4e')]);_0x3cce17[_0x38ec('0x4f')]=qs[_0x38ec('0x47')](_[_0x38ec('0x66')](_0x5007b9['query'],_0x28596c[_0x38ec('0x47')]));_0x3cce17[_0x38ec('0x4f')]['FaxAccountId']=_0x7be8af['id'];if(_0x5007b9['query'][_0x38ec('0x51')]){_0x3cce17[_0x38ec('0x4f')]=_[_0x38ec('0x52')](_0x3cce17[_0x38ec('0x4f')],{'$or':_[_0x38ec('0x3e')](_0x3cce17[_0x38ec('0x49')],function(_0x5d8709){var _0x321b1b={};_0x321b1b[_0x5d8709]={'$like':'%'+_0x5007b9['query'][_0x38ec('0x51')]+'%'};return _0x321b1b;})});}_0x3cce17=_[_0x38ec('0x52')]({},_0x3cce17,_0x5007b9[_0x38ec('0x53')]);return db[_0x38ec('0x69')]['count']({'where':_0x3cce17[_0x38ec('0x4f')]})[_0x38ec('0x33')](function(_0x2f72ca){_0x29734f['count']=_0x2f72ca;if(_0x5007b9['query'][_0x38ec('0x54')]){_0x3cce17[_0x38ec('0x55')]=[{'all':!![]}];}return db[_0x38ec('0x69')]['findAll'](_0x3cce17);})[_0x38ec('0x33')](function(_0x3d9061){_0x29734f[_0x38ec('0x56')]=_0x3d9061;return _0x29734f;});}})[_0x38ec('0x33')](respondWithFilteredResult(_0x384024,_0x3cce17))[_0x38ec('0x26')](handleError(_0x384024,null));};exports['removeAnswers']=function(_0xc1550a,_0x44586b,_0x4f1dda){return db['FaxAccount']['find']({'where':{'id':_0xc1550a[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x44586b,null))[_0x38ec('0x33')](function(_0x365ad5){if(_0x365ad5){return _0x365ad5['removeAnswers'](_0xc1550a[_0x38ec('0x45')][_0x38ec('0x6c')]);}})[_0x38ec('0x33')](respondWithStatusCode(_0x44586b,null))[_0x38ec('0x26')](handleError(_0x44586b,null));};exports[_0x38ec('0x6d')]=function(_0x10fa0f,_0x496348,_0x2fba22){return db[_0x38ec('0x6e')][_0x38ec('0x60')]({'where':{'id':_0x10fa0f[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x496348,null))['then'](function(_0x4a4ce5){if(_0x4a4ce5){return _0x4a4ce5[_0x38ec('0x6d')](_0x10fa0f[_0x38ec('0x5a')]['ids'],_[_0x38ec('0x6f')](_0x10fa0f[_0x38ec('0x5a')],[_0x38ec('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x496348,null))['catch'](handleError(_0x496348,null));};exports[_0x38ec('0x70')]=function(_0x2ef036,_0x21547d,_0x5f0e29){var _0x39626d={'raw':![],'where':{}};var _0x57a9b7={};var _0xc11c70={'count':0x0,'rows':[]};return db[_0x38ec('0x3f')][_0x38ec('0x64')]({'where':{'id':_0x2ef036['params']['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x21547d,null))['then'](function(_0x3f9d13){if(_0x3f9d13){_0x57a9b7[_0x38ec('0x44')]=_[_0x38ec('0x46')](db[_0x38ec('0x6e')][_0x38ec('0x40')]);_0x57a9b7['query']=_[_0x38ec('0x46')](_0x2ef036[_0x38ec('0x45')]);_0x57a9b7[_0x38ec('0x47')]=_[_0x38ec('0x48')](_0x57a9b7['model'],_0x57a9b7['query']);_0x39626d[_0x38ec('0x49')]=_['intersection'](_0x57a9b7[_0x38ec('0x44')],qs[_0x38ec('0x4a')](_0x2ef036[_0x38ec('0x45')]['fields']));_0x39626d[_0x38ec('0x49')]=_0x39626d[_0x38ec('0x49')][_0x38ec('0x4b')]?_0x39626d[_0x38ec('0x49')]:_0x57a9b7[_0x38ec('0x44')];if(!_0x2ef036[_0x38ec('0x45')][_0x38ec('0x4c')](_0x38ec('0x6b'))){_0x39626d[_0x38ec('0x2d')]=qs[_0x38ec('0x2d')](_0x2ef036[_0x38ec('0x45')]['limit']);_0x39626d[_0x38ec('0x2b')]=qs['offset'](_0x2ef036['query'][_0x38ec('0x2b')]);}_0x39626d[_0x38ec('0x4d')]=qs['sort'](_0x2ef036[_0x38ec('0x45')][_0x38ec('0x4e')]);_0x39626d[_0x38ec('0x4f')]=qs[_0x38ec('0x47')](_['pick'](_0x2ef036[_0x38ec('0x45')],_0x57a9b7['filters']));_0x39626d[_0x38ec('0x4f')][_0x38ec('0x71')]=_0x3f9d13['id'];if(_0x2ef036[_0x38ec('0x45')]['filter']){_0x39626d[_0x38ec('0x4f')]=_[_0x38ec('0x52')](_0x39626d[_0x38ec('0x4f')],{'$or':_[_0x38ec('0x3e')](_0x39626d[_0x38ec('0x49')],function(_0x355435){var _0x412a2a={};_0x412a2a[_0x355435]={'$like':'%'+_0x2ef036[_0x38ec('0x45')]['filter']+'%'};return _0x412a2a;})});}_0x39626d=_[_0x38ec('0x52')]({},_0x39626d,_0x2ef036['options']);return db['FaxInteraction'][_0x38ec('0x2c')]({'where':_0x39626d[_0x38ec('0x4f')]})[_0x38ec('0x33')](function(_0x596ad4){_0xc11c70[_0x38ec('0x2c')]=_0x596ad4;if(_0x2ef036[_0x38ec('0x45')][_0x38ec('0x54')]){_0x39626d[_0x38ec('0x55')]=[{'model':db[_0x38ec('0x72')],'as':_0x38ec('0x73'),'required':![]},{'model':db[_0x38ec('0x74')],'as':_0x38ec('0x75'),'attributes':[_0x38ec('0x3a'),_0x38ec('0x76'),_0x38ec('0x77')],'required':![]},{'model':db[_0x38ec('0x78')],'as':_0x38ec('0x79'),'attributes':['id',_0x38ec('0x3a'),_0x38ec('0x7a')],'where':_0x2ef036[_0x38ec('0x45')]['tag']?{'id':_0x2ef036[_0x38ec('0x45')]['tag']}:undefined,'required':_0x2ef036[_0x38ec('0x45')]['tag']?!![]:![]}];}return db[_0x38ec('0x6e')][_0x38ec('0x7b')](_0x39626d);})[_0x38ec('0x33')](function(_0x139780){_0xc11c70[_0x38ec('0x56')]=_0x139780;return _0xc11c70;});}})[_0x38ec('0x33')](respondWithFilteredResult(_0x21547d,_0x39626d))[_0x38ec('0x26')](handleError(_0x21547d,null));};exports[_0x38ec('0x7c')]=function(_0x15c275,_0x304c44){var _0x2ab584=_0x15c275[_0x38ec('0x58')]['id'];var _0x199ffa=_0x15c275['body'];var _0x264298=0xc8;var _0x113c2f=null;return db['sequelize'][_0x38ec('0x7d')]({'isolationLevel':db[_0x38ec('0x7e')][_0x38ec('0x7f')][_0x38ec('0x80')]['READ_COMMITTED']},function(_0x2432de){return db[_0x38ec('0x3f')][_0x38ec('0x64')]({'where':{'id':_0x2ab584},'transaction':_0x2432de})[_0x38ec('0x33')](function(_0x36821d){if(_0x36821d){return db[_0x38ec('0x81')][_0x38ec('0x34')]({'where':{'FaxAccountId':_0x2ab584},'transaction':_0x2432de})[_0x38ec('0x33')](function(){var _0x2f23de=_['map'](_0x199ffa,function(_0x20c336){_0x20c336[_0x38ec('0x71')]=_0x2ab584;return _0x20c336;});return db[_0x38ec('0x81')]['bulkCreate'](_0x2f23de,{'transaction':_0x2432de});});}else{_0x264298=0x194;_0x113c2f=[];}});})[_0x38ec('0x33')](function(){if(_0x264298!==0x194){return db[_0x38ec('0x81')][_0x38ec('0x82')]({'where':{'FaxAccountId':_0x2ab584},'order':'priority'})[_0x38ec('0x33')](function(_0x53ca6f){_0x113c2f=_0x53ca6f;});}})[_0x38ec('0x26')](function(_0xe0405c){_0x264298=0x1f4;logger[_0x38ec('0x21')](_0xe0405c[_0x38ec('0x39')]);if(_0xe0405c[_0x38ec('0x3a')]){delete _0xe0405c[_0x38ec('0x3a')];}_0x113c2f=_0xe0405c;})[_0x38ec('0x83')](function(){if(_0x113c2f===null){_0x304c44['sendStatus'](_0x264298);}else{if(_0x264298===0x1f4){_0x304c44[_0x38ec('0x27')](_0x264298)[_0x38ec('0x84')](_0x113c2f);}else{_0x304c44[_0x38ec('0x27')](_0x264298)['json'](_0x113c2f);}}});};exports[_0x38ec('0x85')]=function(_0x5d9613,_0xccad92,_0x363d3e){var _0x13b1ba={};var _0x31fb93={};var _0x111b80;var _0x2041fe;return db[_0x38ec('0x3f')]['findOne']({'where':{'id':_0x5d9613[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0xccad92,null))[_0x38ec('0x33')](function(_0x4621b4){if(_0x4621b4){_0x111b80=_0x4621b4;_0x31fb93[_0x38ec('0x44')]=_[_0x38ec('0x46')](db['FaxApplication'][_0x38ec('0x40')]);_0x31fb93['query']=_[_0x38ec('0x46')](_0x5d9613[_0x38ec('0x45')]);_0x31fb93[_0x38ec('0x47')]=_['intersection'](_0x31fb93['model'],_0x31fb93[_0x38ec('0x45')]);_0x13b1ba[_0x38ec('0x49')]=_[_0x38ec('0x48')](_0x31fb93[_0x38ec('0x44')],qs[_0x38ec('0x4a')](_0x5d9613[_0x38ec('0x45')][_0x38ec('0x4a')]));_0x13b1ba[_0x38ec('0x49')]=_0x13b1ba[_0x38ec('0x49')][_0x38ec('0x4b')]?_0x13b1ba[_0x38ec('0x49')]:_0x31fb93[_0x38ec('0x44')];_0x13b1ba[_0x38ec('0x4d')]=qs[_0x38ec('0x4e')](_0x5d9613[_0x38ec('0x45')][_0x38ec('0x4e')]);_0x13b1ba[_0x38ec('0x4f')]=qs[_0x38ec('0x47')](_[_0x38ec('0x66')](_0x5d9613[_0x38ec('0x45')],_0x31fb93[_0x38ec('0x47')]));if(_0x5d9613[_0x38ec('0x45')]['filter']){_0x13b1ba[_0x38ec('0x4f')]=_['merge'](_0x13b1ba['where'],{'$or':_[_0x38ec('0x3e')](_0x13b1ba[_0x38ec('0x49')],function(_0x20fd75){var _0x4331a7={};_0x4331a7[_0x20fd75]={'$like':'%'+_0x5d9613[_0x38ec('0x45')][_0x38ec('0x51')]+'%'};return _0x4331a7;})});}_0x13b1ba=_[_0x38ec('0x52')]({},_0x13b1ba,_0x5d9613[_0x38ec('0x53')]);return _0x111b80[_0x38ec('0x85')](_0x13b1ba);}})[_0x38ec('0x33')](function(_0x4aa365){if(_0x4aa365){_0x2041fe=_0x4aa365[_0x38ec('0x4b')];if(!_0x5d9613[_0x38ec('0x45')][_0x38ec('0x4c')](_0x38ec('0x6b'))){_0x13b1ba[_0x38ec('0x2d')]=qs[_0x38ec('0x2d')](_0x5d9613[_0x38ec('0x45')][_0x38ec('0x2d')]);_0x13b1ba['offset']=qs[_0x38ec('0x2b')](_0x5d9613['query'][_0x38ec('0x2b')]);}return _0x111b80[_0x38ec('0x85')](_0x13b1ba);}})[_0x38ec('0x33')](function(_0x588196){if(_0x588196){return _0x588196?{'count':_0x2041fe,'rows':_0x588196}:null;}})[_0x38ec('0x33')](respondWithResult(_0xccad92,null))['catch'](handleError(_0xccad92,null));};function Extension(_0x163dac,_0x2de68c,_0x1468df,_0x88c87c){this[_0x38ec('0x86')]=_0x38ec('0x87');this[_0x38ec('0x88')]=_0x163dac[_0x38ec('0x89')];this[_0x38ec('0x8a')]=_0x88c87c;this['type']=_0x38ec('0x8b');this[_0x38ec('0x8c')]=_0x38ec('0x8d');this[_0x38ec('0x71')]=_0x163dac['id'];this[_0x38ec('0x8e')]=_0x2de68c;this['appdata']=_0x1468df;}function createExtensionsReciveFax(_0xa86347){var _0x8634fe=0x1;var _0x302652=[];_0x302652[_0x38ec('0x8f')](new Extension(_0xa86347,_0x8634fe,'',_0x38ec('0x90')));_0x8634fe+=0x1;_0x302652[_0x38ec('0x8f')](new Extension(_0xa86347,_0x8634fe,_0x38ec('0x91'),_0x38ec('0x92')));_0x8634fe+=0x1;for(var _0x19bf32 in _0xa86347){if(_0xa86347['hasOwnProperty'](_0x19bf32)&&(_0x19bf32==='ecm'||_0x19bf32===_0x38ec('0x89')||_0x19bf32==='gateway'||_0x19bf32===_0x38ec('0x93')||_0x19bf32===_0x38ec('0x94')||_0x19bf32===_0x38ec('0x95')||_0x19bf32==='minrate'||_0x19bf32==='modem'||_0x19bf32===_0x38ec('0x96'))){_0x302652[_0x38ec('0x8f')](new Extension(_0xa86347,_0x8634fe,'FAXOPT('+_0x19bf32+')='+_0xa86347[_0x19bf32],_0x38ec('0x92')));_0x8634fe+=0x1;}}_0x302652[_0x38ec('0x8f')](new Extension(_0xa86347,_0x8634fe,'6','Wait'));_0x8634fe+=0x1;_0x302652[_0x38ec('0x8f')](new Extension(_0xa86347,_0x8634fe,_0x38ec('0x97'),_0x38ec('0x98')));_0x8634fe=0x0;return _0x302652;}exports[_0x38ec('0x99')]=function(_0x8017d4,_0x2984ae,_0x4ac814){var _0x12a6f3;return db[_0x38ec('0x7e')][_0x38ec('0x7d')](function(_0x4d02a3){return db[_0x38ec('0x3f')][_0x38ec('0x59')](_0x8017d4[_0x38ec('0x5a')],{'transaction':_0x4d02a3})['then'](function(_0x50954a){_0x12a6f3=_0x50954a['get']({'plain':!![]});return db[_0x38ec('0x9a')]['bulkCreate'](createExtensionsReciveFax(_0x12a6f3),{'transaction':_0x4d02a3});});})[_0x38ec('0x33')](function(){return _0x12a6f3;})[_0x38ec('0x33')](respondWithResult(_0x2984ae,null))[_0x38ec('0x26')](handleError(_0x2984ae,null));};exports['updateAccountApplications']=function(_0x3b32da,_0x1e2cf1,_0x5a4280){var _0xd8b457;return db['sequelize'][_0x38ec('0x7d')](function(_0x439ea9){return db[_0x38ec('0x3f')]['update'](_0x3b32da[_0x38ec('0x5a')],{'where':{'id':_0x3b32da['body']['id']},'transaction':_0x439ea9})[_0x38ec('0x33')](function(_0x2c8757){return db[_0x38ec('0x9a')]['destroy']({'where':{'FaxAccountId':_0x3b32da[_0x38ec('0x5a')]['id']},'transaction':_0x439ea9})[_0x38ec('0x33')](function(_0x343da7){return db[_0x38ec('0x9a')][_0x38ec('0x9b')](createExtensionsReciveFax(_['omit'](_0x3b32da[_0x38ec('0x5a')],[_0x38ec('0x9c'),_0x38ec('0x43'),_0x38ec('0x9d'),_0x38ec('0x9e'),'TrunkId',_0x38ec('0x9f')])),{'transaction':_0x439ea9});});});})[_0x38ec('0x33')](function(){return db['FaxAccount'][_0x38ec('0xa0')](_0x3b32da['body']['id']);})[_0x38ec('0x33')](respondWithResult(_0x1e2cf1,null))[_0x38ec('0x26')](handleError(_0x1e2cf1,null));};exports['getMessages']=function(_0x30c5cd,_0x6b9179,_0x4e9165){var _0x58688f={'raw':!![],'where':{}};var _0x159372={};var _0x562561={'count':0x0,'rows':[]};return db[_0x38ec('0x3f')][_0x38ec('0x64')]({'where':{'id':_0x30c5cd[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x6b9179,null))[_0x38ec('0x33')](function(_0xb45460){if(_0xb45460){_0x159372[_0x38ec('0x44')]=_['keys'](db[_0x38ec('0xa1')][_0x38ec('0x40')]);_0x159372[_0x38ec('0x45')]=_['keys'](_0x30c5cd['query']);_0x159372[_0x38ec('0x47')]=_[_0x38ec('0x48')](_0x159372[_0x38ec('0x44')],_0x159372[_0x38ec('0x45')]);_0x58688f['attributes']=_[_0x38ec('0x48')](_0x159372['model'],qs[_0x38ec('0x4a')](_0x30c5cd[_0x38ec('0x45')][_0x38ec('0x4a')]));_0x58688f[_0x38ec('0x49')]=_0x58688f[_0x38ec('0x49')][_0x38ec('0x4b')]?_0x58688f[_0x38ec('0x49')]:_0x159372[_0x38ec('0x44')];if(!_0x30c5cd[_0x38ec('0x45')][_0x38ec('0x4c')]('nolimit')){_0x58688f[_0x38ec('0x2d')]=qs[_0x38ec('0x2d')](_0x30c5cd[_0x38ec('0x45')]['limit']);_0x58688f['offset']=qs[_0x38ec('0x2b')](_0x30c5cd[_0x38ec('0x45')][_0x38ec('0x2b')]);}_0x58688f['order']=qs[_0x38ec('0x4e')](_0x30c5cd[_0x38ec('0x45')][_0x38ec('0x4e')]);_0x58688f[_0x38ec('0x4f')]=qs['filters'](_[_0x38ec('0x66')](_0x30c5cd[_0x38ec('0x45')],_0x159372[_0x38ec('0x47')]));_0x58688f[_0x38ec('0x4f')]['FaxAccountId']=_0xb45460['id'];if(_0x30c5cd[_0x38ec('0x45')][_0x38ec('0x51')]){_0x58688f[_0x38ec('0x4f')]=_[_0x38ec('0x52')](_0x58688f[_0x38ec('0x4f')],{'$or':_[_0x38ec('0x3e')](_0x58688f['attributes'],function(_0x279145){var _0x1c778b={};_0x1c778b[_0x279145]={'$like':'%'+_0x30c5cd[_0x38ec('0x45')][_0x38ec('0x51')]+'%'};return _0x1c778b;})});}if(_0x30c5cd[_0x38ec('0x45')][_0x38ec('0xa2')]){var _0x46417e=_0x30c5cd['query']['$gte'][_0x38ec('0xa3')](',');var _0x19fce7={};_0x19fce7[_0x46417e[0x0]]={'$gte':moment(_0x46417e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x58688f[_0x38ec('0x4f')]=_[_0x38ec('0x52')](_0x58688f['where'],_0x19fce7);}_0x58688f=_[_0x38ec('0x52')]({},_0x58688f,_0x30c5cd[_0x38ec('0x53')]);return db[_0x38ec('0xa1')]['count']({'where':_0x58688f['where']})['then'](function(_0x147b90){_0x562561['count']=_0x147b90;if(_0x30c5cd[_0x38ec('0x45')][_0x38ec('0x54')]){_0x58688f[_0x38ec('0x55')]=[{'all':!![]}];}return db[_0x38ec('0xa1')][_0x38ec('0x7b')](_0x58688f);})[_0x38ec('0x33')](function(_0x1d0771){_0x562561['rows']=_0x1d0771;return _0x562561;});}})[_0x38ec('0x33')](respondWithFilteredResult(_0x6b9179,_0x58688f))[_0x38ec('0x26')](handleError(_0x6b9179,null));};exports[_0x38ec('0x84')]=function(_0x35d61e,_0x3a78c1,_0x2f7762){var _0x4c2e78,_0x1f9753={},_0x24af8d;if(_0x35d61e[_0x38ec('0x5a')]['to']){_0x24af8d=_0x35d61e[_0x38ec('0x5a')]['to'][0x0];}return db[_0x38ec('0x3f')][_0x38ec('0x60')]({'where':{'id':_0x35d61e[_0x38ec('0x58')]['id']},'include':[{'model':db[_0x38ec('0xa4')],'as':_0x38ec('0xa5'),'include':[{'model':db[_0x38ec('0x72')],'as':_0x38ec('0xa6'),'where':{'fax':_0x24af8d},'limit':0x1,'order':[[_0x38ec('0x9e'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3a78c1,null))[_0x38ec('0x33')](function(_0x1cec2e){_0x4c2e78=_0x1cec2e;if(_0x35d61e['body'][_0x38ec('0xa7')]&&_0x35d61e[_0x38ec('0x5a')]['attachments'][_0x38ec('0x4b')]){for(var _0xf2fee4=0x0;_0xf2fee4<_0x35d61e[_0x38ec('0x5a')]['attachments'][_0x38ec('0x4b')];_0xf2fee4+=0x1){_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xa7')][_0xf2fee4]={'filename':_0x35d61e['body']['attachments'][_0xf2fee4][_0x38ec('0x3a')],'id':_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xa7')][_0xf2fee4]['id'],'path':path['join'](config['root'],_0x38ec('0xa8'),_0x35d61e['body'][_0x38ec('0xa7')][_0xf2fee4][_0x38ec('0xa9')])};}}return respondWithRpcPromise(_0x38ec('0xaa'),_0x38ec('0xaa'),{'FaxAccountId':_[_0x38ec('0xab')](_0x35d61e['params']['id'])?undefined:_0x35d61e[_0x38ec('0x58')]['id'],'path':_[_0x38ec('0xab')](_0x35d61e['body'][_0x38ec('0xa7')][0x0][_0x38ec('0x7')])?undefined:_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xa7')][0x0]['path'],'fax':_['isNil'](_0x35d61e[_0x38ec('0x5a')]['to'][0x0])?undefined:_0x35d61e[_0x38ec('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x4c2e78){if(_['isNil'](_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xac')])){_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xac')]=util[_0x38ec('0xad')](_0x38ec('0xae'),_0x4c2e78[_0x38ec('0x3a')],_0x4c2e78[_0x38ec('0xaf')]);}if(_0x4c2e78[_0x38ec('0xa5')]){if(_0x4c2e78[_0x38ec('0xa5')][_0x38ec('0xa6')][_0x38ec('0x4b')]){return _0x4c2e78['List']['Contacts'][0x0];}else{return db[_0x38ec('0x72')][_0x38ec('0x59')](_[_0x38ec('0xb0')](_0x35d61e[_0x38ec('0x5a')],{'firstName':_0x35d61e[_0x38ec('0x5a')]['to'][0x0],'phone':_0x35d61e[_0x38ec('0x5a')]['to'][0x0],'fax':_0x35d61e[_0x38ec('0x5a')]['to'][0x0],'ListId':_0x4c2e78[_0x38ec('0x9f')]}));}}else{throw new Error(_0x38ec('0xb1'));}}else{throw new Error(_0x38ec('0xb2'));}})[_0x38ec('0x33')](function(_0x3f36c0){if(_0x3f36c0){return db[_0x38ec('0x6e')][_0x38ec('0x60')]({'where':{'ContactId':_0x3f36c0['id'],'closed':![],'FaxAccountId':_0x4c2e78['id']}})['then'](function(_0x523314){if(_0x523314){return[_0x523314,![]];}return db[_0x38ec('0x6e')][_0x38ec('0x59')]({'UserId':_0x35d61e[_0x38ec('0x5b')]['id'],'ContactId':_0x3f36c0['id'],'FaxAccountId':_0x4c2e78['id'],'fax':_0x35d61e[_0x38ec('0x5a')]['to'][0x0],'firstMsgDirection':_0x38ec('0xb3'),'Messages':[_[_0x38ec('0x52')](_0x35d61e[_0x38ec('0x5a')],{'read':![],'body':_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xa7')][0x0][_0x38ec('0xb4')],'FaxAccountId':_0x4c2e78['id'],'UserId':_0x35d61e[_0x38ec('0x5b')]['id'],'ContactId':_0x3f36c0['id'],'AttachmentId':_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x38ec('0xa1')],'as':_0x38ec('0xb5')}]})['then'](function(_0x16e971){return[_0x16e971,!![]];});});}else{throw new Error(_0x38ec('0xb6'));}})[_0x38ec('0xb7')](function(_0xa987ff,_0x16a339){if(_0x16a339){return _0xa987ff;}return db[_0x38ec('0xa1')]['create']({'direction':'out','read':![],'body':_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xa7')][0x0][_0x38ec('0xb4')],'FaxAccountId':_0x4c2e78['id'],'FaxInteractionId':_0xa987ff['id'],'UserId':_0x35d61e[_0x38ec('0x5b')]['id'],'ContactId':_0xa987ff['ContactId'],'AttachmentId':_0x35d61e[_0x38ec('0x5a')]['attachments'][0x0]['id']})[_0x38ec('0x33')](function(_0x44ac6a){_0xa987ff[_0x38ec('0xb8')][_0x38ec('0xb5')]=[];_0xa987ff['dataValues'][_0x38ec('0xb5')]['push'](_0x44ac6a[_0x38ec('0xb8')]);return _0xa987ff;});})[_0x38ec('0x33')](function(_0x2a3c8d){respondWithRpcPromise(_0x38ec('0xb9'),_0x38ec('0xb9'),{'FaxAccountId':_['isNil'](_0x35d61e[_0x38ec('0x58')]['id'])?undefined:_0x35d61e[_0x38ec('0x58')]['id'],'path':_[_0x38ec('0xab')](_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xa7')][0x0][_0x38ec('0x7')])?undefined:_0x35d61e[_0x38ec('0x5a')][_0x38ec('0xa7')][0x0][_0x38ec('0x7')],'fax':_['isNil'](_0x35d61e[_0x38ec('0x5a')]['to'][0x0])?undefined:_0x35d61e[_0x38ec('0x5a')]['to'][0x0],'AttachmentId':_0x35d61e['body'][_0x38ec('0xa7')][0x0]['id']},client9002)[_0x38ec('0x33')](function(_0x19b6d7){logger[_0x38ec('0x1d')]('SendFaxRpc,\x20%s',_0x19b6d7);})[_0x38ec('0x26')](function(_0x42795d){logger['info'](_0x38ec('0xba'),_0x42795d);});return _0x2a3c8d;})[_0x38ec('0x33')](respondWithResult(_0x3a78c1,null))[_0x38ec('0x26')](handleError(_0x3a78c1,null));};exports[_0x38ec('0xbb')]=function(_0x5ec4fb,_0x5b24c9,_0x228f0a){return db[_0x38ec('0x3f')][_0x38ec('0x60')]({'where':{'id':_0x5ec4fb['params']['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x5b24c9,null))[_0x38ec('0x33')](function(_0x5a2fa0){if(_0x5a2fa0){return _0x5a2fa0['addAgents'](_0x5ec4fb[_0x38ec('0x5a')]['ids'],_['omit'](_0x5ec4fb[_0x38ec('0x5a')],[_0x38ec('0x6c'),'id'])||{})['spread'](function(_0x5e98eb){for(var _0x17afb1=0x0;_0x17afb1<_0x5ec4fb['body'][_0x38ec('0x6c')][_0x38ec('0x4b')];_0x17afb1+=0x1){socket[_0x38ec('0xbc')](_0x38ec('0xbd'),{'UserId':Number(_0x5ec4fb['body'][_0x38ec('0x6c')][_0x17afb1]),'FaxAccountId':Number(_0x5ec4fb[_0x38ec('0x58')]['id'])});}return _0x5e98eb;});}})[_0x38ec('0x33')](respondWithResult(_0x5b24c9,null))[_0x38ec('0x26')](handleError(_0x5b24c9,null));};exports[_0x38ec('0xbe')]=function(_0x2832b1,_0x5f3668,_0x3145bb){return db[_0x38ec('0x3f')][_0x38ec('0x60')]({'where':{'id':_0x2832b1[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x5f3668,null))[_0x38ec('0x33')](function(_0x48f6a4){if(_0x48f6a4){return _0x48f6a4[_0x38ec('0xbe')](_0x2832b1[_0x38ec('0x45')][_0x38ec('0x6c')])[_0x38ec('0x33')](function(){if(_[_0x38ec('0xbf')](_0x2832b1[_0x38ec('0x45')][_0x38ec('0x6c')])){for(var _0x17354f=0x0;_0x17354f<_0x2832b1[_0x38ec('0x45')][_0x38ec('0x6c')]['length'];_0x17354f+=0x1){socket[_0x38ec('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x2832b1[_0x38ec('0x45')][_0x38ec('0x6c')][_0x17354f]),'FaxAccountId':Number(_0x2832b1[_0x38ec('0x58')]['id'])});}}else{socket[_0x38ec('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x2832b1[_0x38ec('0x45')][_0x38ec('0x6c')]),'FaxAccountId':Number(_0x2832b1['params']['id'])});}});}})[_0x38ec('0x33')](respondWithStatusCode(_0x5f3668,null))[_0x38ec('0x26')](handleError(_0x5f3668,null));};exports[_0x38ec('0xc0')]=function(_0x4d3ff8,_0x247308,_0x75ed68){var _0xb45fd4={};var _0xe86d68={};var _0x655330;var _0xaadc78;return db[_0x38ec('0x3f')][_0x38ec('0x64')]({'where':{'id':_0x4d3ff8[_0x38ec('0x58')]['id']}})[_0x38ec('0x33')](handleEntityNotFound(_0x247308,null))[_0x38ec('0x33')](function(_0x153b7e){if(_0x153b7e){_0x655330=_0x153b7e;_0xe86d68[_0x38ec('0x44')]=_[_0x38ec('0x46')](db[_0x38ec('0x74')]['rawAttributes']);_0xe86d68['query']=_['keys'](_0x4d3ff8[_0x38ec('0x45')]);_0xe86d68[_0x38ec('0x47')]=_[_0x38ec('0x48')](_0xe86d68[_0x38ec('0x44')],_0xe86d68[_0x38ec('0x45')]);_0xb45fd4[_0x38ec('0x49')]=_['intersection'](_0xe86d68[_0x38ec('0x44')],qs[_0x38ec('0x4a')](_0x4d3ff8['query'][_0x38ec('0x4a')]));_0xb45fd4[_0x38ec('0x49')]=_0xb45fd4[_0x38ec('0x49')][_0x38ec('0x4b')]?_0xb45fd4[_0x38ec('0x49')]:_0xe86d68[_0x38ec('0x44')];_0xb45fd4[_0x38ec('0x4d')]=qs[_0x38ec('0x4e')](_0x4d3ff8[_0x38ec('0x45')]['sort']);_0xb45fd4[_0x38ec('0x4f')]=qs[_0x38ec('0x47')](_['pick'](_0x4d3ff8['query'],_0xe86d68[_0x38ec('0x47')]));if(_0x4d3ff8[_0x38ec('0x45')][_0x38ec('0x51')]){_0xb45fd4[_0x38ec('0x4f')]=_[_0x38ec('0x52')](_0xb45fd4[_0x38ec('0x4f')],{'$or':_[_0x38ec('0x3e')](_0xb45fd4['attributes'],function(_0x19762a){var _0x161fbe={};_0x161fbe[_0x19762a]={'$like':'%'+_0x4d3ff8[_0x38ec('0x45')][_0x38ec('0x51')]+'%'};return _0x161fbe;})});}_0xb45fd4=_[_0x38ec('0x52')]({},_0xb45fd4,_0x4d3ff8[_0x38ec('0x53')]);return _0x655330['getAgents'](_0xb45fd4);}})['then'](function(_0x5b4aeb){if(_0x5b4aeb){_0xaadc78=_0x5b4aeb['length'];if(!_0x4d3ff8[_0x38ec('0x45')]['hasOwnProperty'](_0x38ec('0x6b'))){_0xb45fd4[_0x38ec('0x2d')]=qs['limit'](_0x4d3ff8[_0x38ec('0x45')]['limit']);_0xb45fd4[_0x38ec('0x2b')]=qs[_0x38ec('0x2b')](_0x4d3ff8[_0x38ec('0x45')]['offset']);}return _0x655330['getAgents'](_0xb45fd4);}})[_0x38ec('0x33')](function(_0x415467){if(_0x415467){return _0x415467?{'count':_0xaadc78,'rows':_0x415467}:null;}})[_0x38ec('0x33')](respondWithResult(_0x247308,null))['catch'](handleError(_0x247308,null));}; \ No newline at end of file +var _0x5da1=['root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','limit','set','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','mandatoryDispositionPause','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','bulkCreate','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments'];(function(_0x528c55,_0x4667fc){var _0x198df1=function(_0x571d57){while(--_0x571d57){_0x528c55['push'](_0x528c55['shift']());}};_0x198df1(++_0x4667fc);}(_0x5da1,0xe0));var _0x15da=function(_0x6c5bc1,_0x5c0300){_0x6c5bc1=_0x6c5bc1-0x0;var _0x46b127=_0x5da1[_0x6c5bc1];return _0x46b127;};'use strict';var emlformat=require(_0x15da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15da('0x1'));var jsonpatch=require(_0x15da('0x2'));var rp=require(_0x15da('0x3'));var moment=require(_0x15da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15da('0x5'));var util=require(_0x15da('0x6'));var path=require(_0x15da('0x7'));var sox=require(_0x15da('0x8'));var csv=require('to-csv');var ejs=require(_0x15da('0x9'));var fs=require('fs');var fs_extra=require(_0x15da('0xa'));var _=require(_0x15da('0xb'));var squel=require(_0x15da('0xc'));var crypto=require(_0x15da('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x15da('0xe'));var toCsv=require(_0x15da('0xf'));var querystring=require(_0x15da('0x10'));var Papa=require(_0x15da('0x11'));var Redis=require(_0x15da('0x12'));var authService=require(_0x15da('0x13'));var qs=require(_0x15da('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15da('0x15'));var logger=require(_0x15da('0x16'))(_0x15da('0x17'));var utils=require(_0x15da('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x15da('0x19'))['db'];config[_0x15da('0x1a')]=_[_0x15da('0x1b')](config[_0x15da('0x1a')],{'host':_0x15da('0x1c'),'port':0x18eb});var socket=require(_0x15da('0x1d'))(new Redis(config[_0x15da('0x1a')]));require('./faxAccount.socket')[_0x15da('0x1e')](socket);var jayson=require(_0x15da('0x1f'));var client=jayson[_0x15da('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0x15da('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x508220,_0x1352dd,_0x283452,_0x13d30c){return new BPromise(function(_0x33857d,_0x2f1dd7){var _0x4659c9=_0x13d30c||client;return _0x4659c9['request'](_0x508220,_0x283452)[_0x15da('0x22')](function(_0x352244){logger['info'](_0x15da('0x23'),_0x1352dd,_0x15da('0x24'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1352dd,'request\x20sent',JSON['stringify'](_0x352244));if(_0x352244[_0x15da('0x25')]){if(_0x352244[_0x15da('0x25')][_0x15da('0x26')]===0x1f4){logger[_0x15da('0x25')]('FaxAccount,\x20%s,\x20%s',_0x1352dd,_0x352244[_0x15da('0x25')][_0x15da('0x27')]);return _0x2f1dd7(_0x352244[_0x15da('0x25')]['message']);}logger[_0x15da('0x25')](_0x15da('0x23'),_0x1352dd,_0x352244['error'][_0x15da('0x27')]);return _0x33857d(_0x352244['error'][_0x15da('0x27')]);}else{logger['info'](_0x15da('0x23'),_0x1352dd,'request\x20sent');_0x33857d(_0x352244[_0x15da('0x28')][_0x15da('0x27')]);}})[_0x15da('0x29')](function(_0x59384a){logger[_0x15da('0x25')]('FaxAccount,\x20%s,\x20%s',_0x1352dd,_0x59384a);_0x2f1dd7(_0x59384a);});});}function respondWithStatusCode(_0x2e37ab,_0x2637e9){_0x2637e9=_0x2637e9||0xcc;return function(_0x2dd46f){if(_0x2dd46f){return _0x2e37ab[_0x15da('0x2a')](_0x2637e9);}return _0x2e37ab[_0x15da('0x2b')](_0x2637e9)[_0x15da('0x2c')]();};}function respondWithResult(_0x33d322,_0x1b1070){_0x1b1070=_0x1b1070||0xc8;return function(_0x5368fb){if(_0x5368fb){return _0x33d322['status'](_0x1b1070)[_0x15da('0x2d')](_0x5368fb);}};}function respondWithFilteredResult(_0x3a8c9c,_0x42e30d){return function(_0x3879df){if(_0x3879df){var _0x475d31=typeof _0x42e30d['offset']===_0x15da('0x2e')&&typeof _0x42e30d['limit']==='undefined';var _0x207442=_0x3879df[_0x15da('0x2f')];var _0x2b8769=_0x475d31?0x0:_0x42e30d['offset'];var _0x1fcc58=_0x475d31?_0x3879df[_0x15da('0x2f')]:_0x42e30d['offset']+_0x42e30d[_0x15da('0x30')];var _0x5ceaf7;if(_0x1fcc58>=_0x207442){_0x1fcc58=_0x207442;_0x5ceaf7=0xc8;}else{_0x5ceaf7=0xce;}_0x3a8c9c[_0x15da('0x2b')](_0x5ceaf7);return _0x3a8c9c[_0x15da('0x31')]('Content-Range',_0x2b8769+'-'+_0x1fcc58+'/'+_0x207442)[_0x15da('0x2d')](_0x3879df);}return null;};}function patchUpdates(_0x3af123){return function(_0x19000f){try{jsonpatch[_0x15da('0x32')](_0x19000f,_0x3af123,!![]);}catch(_0x175a9f){return BPromise[_0x15da('0x33')](_0x175a9f);}return _0x19000f[_0x15da('0x34')]();};}function saveUpdates(_0x4db925,_0x293b58){return function(_0x4fb543){if(_0x4fb543){return _0x4fb543[_0x15da('0x35')](_0x4db925)[_0x15da('0x22')](function(_0x5efbf4){return _0x5efbf4;});}return null;};}function removeEntity(_0x199e04,_0x111aa4){return function(_0x56b0c9){if(_0x56b0c9){return _0x56b0c9[_0x15da('0x36')]()[_0x15da('0x22')](function(){var _0x4f3397=_0x56b0c9['get']({'plain':!![]});var _0x3351cc='FaxAccounts';return db[_0x15da('0x37')][_0x15da('0x36')]({'where':{'type':_0x3351cc,'resourceId':_0x4f3397['id']}})[_0x15da('0x22')](function(){return _0x56b0c9;});})[_0x15da('0x22')](function(){_0x199e04['status'](0xcc)[_0x15da('0x2c')]();});}};}function handleEntityNotFound(_0x16f8e1,_0x1245f6){return function(_0x13ab7e){if(!_0x13ab7e){_0x16f8e1['sendStatus'](0x194);}return _0x13ab7e;};}function handleError(_0x5793aa,_0x2d351a){_0x2d351a=_0x2d351a||0x1f4;return function(_0x317028){logger[_0x15da('0x25')](_0x317028[_0x15da('0x38')]);if(_0x317028[_0x15da('0x39')]){delete _0x317028['name'];}_0x5793aa[_0x15da('0x2b')](_0x2d351a)[_0x15da('0x3a')](_0x317028);};}exports['index']=function(_0x4b4899,_0x1ec46a){var _0x3fbc0d={'include':[{'model':db[_0x15da('0x3b')],'as':'mandatoryDispositionPause'}]},_0x313c04={},_0x10b962={'count':0x0,'rows':[]};var _0x4cf328=_[_0x15da('0x3c')](db[_0x15da('0x3d')][_0x15da('0x3e')],function(_0x139fa0){return{'name':_0x139fa0[_0x15da('0x3f')],'type':_0x139fa0[_0x15da('0x40')][_0x15da('0x41')]};});_0x313c04[_0x15da('0x42')]=_[_0x15da('0x3c')](_0x4cf328,_0x15da('0x39'));_0x313c04[_0x15da('0x43')]=_[_0x15da('0x44')](_0x4b4899[_0x15da('0x43')]);_0x313c04[_0x15da('0x45')]=_[_0x15da('0x46')](_0x313c04[_0x15da('0x42')],_0x313c04['query']);_0x3fbc0d['attributes']=_['intersection'](_0x313c04[_0x15da('0x42')],qs[_0x15da('0x47')](_0x4b4899['query'][_0x15da('0x47')]));_0x3fbc0d['attributes']=_0x3fbc0d[_0x15da('0x48')][_0x15da('0x49')]?_0x3fbc0d['attributes']:_0x313c04[_0x15da('0x42')];if(!_0x4b4899[_0x15da('0x43')][_0x15da('0x4a')](_0x15da('0x4b'))){_0x3fbc0d[_0x15da('0x30')]=qs[_0x15da('0x30')](_0x4b4899[_0x15da('0x43')][_0x15da('0x30')]);_0x3fbc0d[_0x15da('0x4c')]=qs['offset'](_0x4b4899[_0x15da('0x43')][_0x15da('0x4c')]);}_0x3fbc0d['order']=qs[_0x15da('0x4d')](_0x4b4899['query'][_0x15da('0x4d')]);_0x3fbc0d[_0x15da('0x4e')]=qs[_0x15da('0x45')](_[_0x15da('0x4f')](_0x4b4899[_0x15da('0x43')],_0x313c04[_0x15da('0x45')]),_0x4cf328);if(_0x4b4899[_0x15da('0x43')][_0x15da('0x50')]){_0x3fbc0d[_0x15da('0x4e')]=_[_0x15da('0x51')](_0x3fbc0d[_0x15da('0x4e')],{'$or':_[_0x15da('0x3c')](_0x4cf328,function(_0x1234e8){if(_0x1234e8[_0x15da('0x40')]!=='VIRTUAL'){var _0x14697f={};_0x14697f[_0x1234e8[_0x15da('0x39')]]={'$like':'%'+_0x4b4899[_0x15da('0x43')]['filter']+'%'};return _0x14697f;}})});}_0x3fbc0d=_[_0x15da('0x51')]({},_0x3fbc0d,_0x4b4899[_0x15da('0x52')]);var _0x2b0024={'where':_0x3fbc0d['where']};return db[_0x15da('0x3d')][_0x15da('0x2f')](_0x2b0024)['then'](function(_0x19012d){_0x10b962[_0x15da('0x2f')]=_0x19012d;if(_0x4b4899[_0x15da('0x43')][_0x15da('0x53')]){_0x3fbc0d[_0x15da('0x54')]=[{'all':!![]}];}return db[_0x15da('0x3d')][_0x15da('0x55')](_0x3fbc0d);})[_0x15da('0x22')](function(_0xd96d1d){_0x10b962[_0x15da('0x56')]=_0xd96d1d;return _0x10b962;})['then'](respondWithFilteredResult(_0x1ec46a,_0x3fbc0d))['catch'](handleError(_0x1ec46a,null));};exports['show']=function(_0x205b85,_0x11bdde){var _0x3bd057={'raw':![],'where':{'id':_0x205b85[_0x15da('0x57')]['id']},'include':[{'model':db[_0x15da('0x3b')],'as':_0x15da('0x58')}]},_0x4de4cd={};_0x4de4cd['model']=_[_0x15da('0x44')](db[_0x15da('0x3d')][_0x15da('0x3e')]);_0x4de4cd[_0x15da('0x43')]=_['keys'](_0x205b85[_0x15da('0x43')]);_0x4de4cd[_0x15da('0x45')]=_[_0x15da('0x46')](_0x4de4cd['model'],_0x4de4cd[_0x15da('0x43')]);_0x3bd057['attributes']=_['intersection'](_0x4de4cd[_0x15da('0x42')],qs[_0x15da('0x47')](_0x205b85[_0x15da('0x43')][_0x15da('0x47')]));_0x3bd057[_0x15da('0x48')]=_0x3bd057[_0x15da('0x48')][_0x15da('0x49')]?_0x3bd057[_0x15da('0x48')]:_0x4de4cd[_0x15da('0x42')];if(_0x205b85[_0x15da('0x43')][_0x15da('0x53')]){_0x3bd057[_0x15da('0x54')]=[{'all':!![]}];}_0x3bd057=_['merge']({},_0x3bd057,_0x205b85[_0x15da('0x52')]);return db['FaxAccount']['find'](_0x3bd057)[_0x15da('0x22')](handleEntityNotFound(_0x11bdde,null))['then'](respondWithResult(_0x11bdde,null))[_0x15da('0x29')](handleError(_0x11bdde,null));};exports[_0x15da('0x59')]=function(_0x38102a,_0x4bb170){return db['FaxAccount'][_0x15da('0x59')](_0x38102a[_0x15da('0x5a')],{})['then'](function(_0x37f5e5){var _0xbff44=_0x38102a['user'][_0x15da('0x5b')]({'plain':!![]});if(!_0xbff44)throw new Error(_0x15da('0x5c'));if(_0xbff44['role']===_0x15da('0x5d')){var _0x3bfc2b=_0x37f5e5[_0x15da('0x5b')]({'plain':!![]});var _0x3d8d4f=_0x15da('0x5e');return db[_0x15da('0x5f')]['find']({'where':{'name':_0x3d8d4f,'userProfileId':_0xbff44[_0x15da('0x60')]},'raw':!![]})[_0x15da('0x22')](function(_0x550d97){if(_0x550d97&&_0x550d97[_0x15da('0x61')]===0x0){return db[_0x15da('0x37')][_0x15da('0x59')]({'name':_0x3bfc2b[_0x15da('0x39')],'resourceId':_0x3bfc2b['id'],'type':_0x550d97['name'],'sectionId':_0x550d97['id']},{})['then'](function(){return _0x37f5e5;});}else{return _0x37f5e5;}})['catch'](function(_0x4af211){logger['error'](_0x15da('0x62'),_0x4af211);throw _0x4af211;});}return _0x37f5e5;})['then'](respondWithResult(_0x4bb170,0xc9))[_0x15da('0x29')](handleError(_0x4bb170,null));};exports[_0x15da('0x35')]=function(_0x16825f,_0x345d0b){if(_0x16825f['body']['id']){delete _0x16825f[_0x15da('0x5a')]['id'];}return db[_0x15da('0x3d')][_0x15da('0x63')]({'where':{'id':_0x16825f['params']['id']},'include':[{'model':db[_0x15da('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x15da('0x22')](handleEntityNotFound(_0x345d0b,null))[_0x15da('0x22')](saveUpdates(_0x16825f[_0x15da('0x5a')],null))[_0x15da('0x22')](respondWithResult(_0x345d0b,null))['catch'](handleError(_0x345d0b,null));};exports[_0x15da('0x36')]=function(_0x10794a,_0xf7438a){return db[_0x15da('0x3d')]['find']({'where':{'id':_0x10794a[_0x15da('0x57')]['id']}})['then'](handleEntityNotFound(_0xf7438a,null))[_0x15da('0x22')](removeEntity(_0xf7438a,null))[_0x15da('0x29')](handleError(_0xf7438a,null));};exports[_0x15da('0x64')]=function(_0x425b32,_0x9e9bd5){return db['FaxAccount'][_0x15da('0x64')]()[_0x15da('0x22')](respondWithResult(_0x9e9bd5,null))['catch'](handleError(_0x9e9bd5,null));};exports['addDisposition']=function(_0x30dc66,_0x3f78fd,_0x1b4b6c){if(_0x30dc66[_0x15da('0x5a')]['id']){delete _0x30dc66[_0x15da('0x5a')]['id'];}return db[_0x15da('0x3d')][_0x15da('0x63')]({'where':{'id':_0x30dc66[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x3f78fd,null))[_0x15da('0x22')](function(_0x29509e){if(_0x29509e){_0x30dc66[_0x15da('0x5a')][_0x15da('0x65')]=_0x29509e['id'];return db[_0x15da('0x66')][_0x15da('0x59')](_0x30dc66['body']);}})['then'](respondWithResult(_0x3f78fd,null))[_0x15da('0x29')](handleError(_0x3f78fd,null));};exports[_0x15da('0x67')]=function(_0x5727bf,_0x2d94e6,_0x4122f9){var _0x18a776={'raw':![],'where':{}};var _0x564d54={};var _0x49419f={'count':0x0,'rows':[]};return db[_0x15da('0x3d')][_0x15da('0x68')]({'where':{'id':_0x5727bf[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x2d94e6,null))['then'](function(_0x865344){if(_0x865344){_0x564d54[_0x15da('0x42')]=_[_0x15da('0x44')](db[_0x15da('0x66')][_0x15da('0x3e')]);_0x564d54[_0x15da('0x43')]=_[_0x15da('0x44')](_0x5727bf[_0x15da('0x43')]);_0x564d54[_0x15da('0x45')]=_[_0x15da('0x46')](_0x564d54[_0x15da('0x42')],_0x564d54['query']);_0x18a776[_0x15da('0x48')]=_['intersection'](_0x564d54[_0x15da('0x42')],qs[_0x15da('0x47')](_0x5727bf[_0x15da('0x43')]['fields']));_0x18a776[_0x15da('0x48')]=_0x18a776['attributes'][_0x15da('0x49')]?_0x18a776[_0x15da('0x48')]:_0x564d54[_0x15da('0x42')];if(!_0x5727bf[_0x15da('0x43')][_0x15da('0x4a')](_0x15da('0x4b'))){_0x18a776[_0x15da('0x30')]=qs['limit'](_0x5727bf['query'][_0x15da('0x30')]);_0x18a776[_0x15da('0x4c')]=qs[_0x15da('0x4c')](_0x5727bf['query'][_0x15da('0x4c')]);}_0x18a776[_0x15da('0x69')]=qs[_0x15da('0x4d')](_0x5727bf[_0x15da('0x43')][_0x15da('0x4d')]);_0x18a776[_0x15da('0x4e')]=qs['filters'](_['pick'](_0x5727bf[_0x15da('0x43')],_0x564d54[_0x15da('0x45')]));_0x18a776[_0x15da('0x4e')][_0x15da('0x65')]=_0x865344['id'];if(_0x5727bf[_0x15da('0x43')]['filter']){_0x18a776[_0x15da('0x4e')]=_[_0x15da('0x51')](_0x18a776['where'],{'$or':_[_0x15da('0x3c')](_0x18a776[_0x15da('0x48')],function(_0x5e48d2){var _0x5d32a5={};_0x5d32a5[_0x5e48d2]={'$like':'%'+_0x5727bf['query'][_0x15da('0x50')]+'%'};return _0x5d32a5;})});}_0x18a776=_['merge']({},_0x18a776,_0x5727bf[_0x15da('0x52')]);return db['Disposition']['count']({'where':_0x18a776[_0x15da('0x4e')]})['then'](function(_0x3c91e8){_0x49419f[_0x15da('0x2f')]=_0x3c91e8;if(_0x5727bf[_0x15da('0x43')][_0x15da('0x53')]){_0x18a776[_0x15da('0x54')]=[{'all':!![]}];}return db[_0x15da('0x66')][_0x15da('0x55')](_0x18a776);})[_0x15da('0x22')](function(_0xd1ff12){_0x49419f[_0x15da('0x56')]=_0xd1ff12;return _0x49419f;});}})[_0x15da('0x22')](respondWithFilteredResult(_0x2d94e6,_0x18a776))[_0x15da('0x29')](handleError(_0x2d94e6,null));};exports[_0x15da('0x6a')]=function(_0x5b1502,_0x33ddfe,_0x2f234e){return db['FaxAccount'][_0x15da('0x63')]({'where':{'id':_0x5b1502[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x33ddfe,null))[_0x15da('0x22')](function(_0x56365c){if(_0x56365c){return _0x56365c['removeDispositions'](_0x5b1502['query'][_0x15da('0x6b')]);}})['then'](respondWithStatusCode(_0x33ddfe,null))[_0x15da('0x29')](handleError(_0x33ddfe,null));};exports['addAnswer']=function(_0x7e2a78,_0x1d3731,_0x2b5aa2){if(_0x7e2a78[_0x15da('0x5a')]['id']){delete _0x7e2a78[_0x15da('0x5a')]['id'];}return db[_0x15da('0x3d')][_0x15da('0x63')]({'where':{'id':_0x7e2a78[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x1d3731,null))[_0x15da('0x22')](function(_0x4f60a6){if(_0x4f60a6){_0x7e2a78[_0x15da('0x5a')][_0x15da('0x65')]=_0x4f60a6['id'];return db[_0x15da('0x6c')]['create'](_0x7e2a78[_0x15da('0x5a')]);}})['then'](respondWithResult(_0x1d3731,null))[_0x15da('0x29')](handleError(_0x1d3731,null));};exports['getAnswers']=function(_0x498ac3,_0x26677c,_0x2c72d2){var _0x47d433={'raw':![],'where':{}};var _0x1ec300={};var _0xa1ae46={'count':0x0,'rows':[]};return db[_0x15da('0x3d')][_0x15da('0x68')]({'where':{'id':_0x498ac3[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x26677c,null))[_0x15da('0x22')](function(_0x54254c){if(_0x54254c){_0x1ec300[_0x15da('0x42')]=_['keys'](db['CannedAnswer'][_0x15da('0x3e')]);_0x1ec300['query']=_[_0x15da('0x44')](_0x498ac3[_0x15da('0x43')]);_0x1ec300[_0x15da('0x45')]=_[_0x15da('0x46')](_0x1ec300[_0x15da('0x42')],_0x1ec300[_0x15da('0x43')]);_0x47d433['attributes']=_['intersection'](_0x1ec300[_0x15da('0x42')],qs['fields'](_0x498ac3['query'][_0x15da('0x47')]));_0x47d433['attributes']=_0x47d433[_0x15da('0x48')][_0x15da('0x49')]?_0x47d433[_0x15da('0x48')]:_0x1ec300[_0x15da('0x42')];if(!_0x498ac3[_0x15da('0x43')][_0x15da('0x4a')](_0x15da('0x4b'))){_0x47d433[_0x15da('0x30')]=qs[_0x15da('0x30')](_0x498ac3[_0x15da('0x43')][_0x15da('0x30')]);_0x47d433[_0x15da('0x4c')]=qs[_0x15da('0x4c')](_0x498ac3[_0x15da('0x43')][_0x15da('0x4c')]);}_0x47d433[_0x15da('0x69')]=qs[_0x15da('0x4d')](_0x498ac3[_0x15da('0x43')][_0x15da('0x4d')]);_0x47d433[_0x15da('0x4e')]=qs[_0x15da('0x45')](_[_0x15da('0x4f')](_0x498ac3[_0x15da('0x43')],_0x1ec300[_0x15da('0x45')]));_0x47d433[_0x15da('0x4e')]['FaxAccountId']=_0x54254c['id'];if(_0x498ac3['query'][_0x15da('0x50')]){_0x47d433[_0x15da('0x4e')]=_['merge'](_0x47d433[_0x15da('0x4e')],{'$or':_[_0x15da('0x3c')](_0x47d433[_0x15da('0x48')],function(_0x3c18ab){var _0x10aa45={};_0x10aa45[_0x3c18ab]={'$like':'%'+_0x498ac3[_0x15da('0x43')]['filter']+'%'};return _0x10aa45;})});}_0x47d433=_[_0x15da('0x51')]({},_0x47d433,_0x498ac3[_0x15da('0x52')]);return db['CannedAnswer'][_0x15da('0x2f')]({'where':_0x47d433[_0x15da('0x4e')]})[_0x15da('0x22')](function(_0x44edb8){_0xa1ae46[_0x15da('0x2f')]=_0x44edb8;if(_0x498ac3[_0x15da('0x43')][_0x15da('0x53')]){_0x47d433[_0x15da('0x54')]=[{'all':!![]}];}return db[_0x15da('0x6c')][_0x15da('0x55')](_0x47d433);})[_0x15da('0x22')](function(_0x4cd822){_0xa1ae46[_0x15da('0x56')]=_0x4cd822;return _0xa1ae46;});}})[_0x15da('0x22')](respondWithFilteredResult(_0x26677c,_0x47d433))['catch'](handleError(_0x26677c,null));};exports['removeAnswers']=function(_0x13527d,_0x5d2bfe,_0x297379){return db[_0x15da('0x3d')][_0x15da('0x63')]({'where':{'id':_0x13527d[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x5d2bfe,null))[_0x15da('0x22')](function(_0x55c68b){if(_0x55c68b){return _0x55c68b[_0x15da('0x6d')](_0x13527d[_0x15da('0x43')][_0x15da('0x6b')]);}})[_0x15da('0x22')](respondWithStatusCode(_0x5d2bfe,null))[_0x15da('0x29')](handleError(_0x5d2bfe,null));};exports[_0x15da('0x6e')]=function(_0x1ff76a,_0x370e59,_0x431b4f){return db[_0x15da('0x6f')]['find']({'where':{'id':_0x1ff76a[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x370e59,null))['then'](function(_0x57a52a){if(_0x57a52a){return _0x57a52a[_0x15da('0x6e')](_0x1ff76a[_0x15da('0x5a')][_0x15da('0x6b')],_[_0x15da('0x70')](_0x1ff76a[_0x15da('0x5a')],[_0x15da('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x370e59,null))[_0x15da('0x29')](handleError(_0x370e59,null));};exports['getInteractions']=function(_0x481e2,_0xb8237c,_0x540311){var _0x667d00={'raw':![],'where':{}};var _0x3bd704={};var _0x79671d={'count':0x0,'rows':[]};return db[_0x15da('0x3d')][_0x15da('0x68')]({'where':{'id':_0x481e2[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0xb8237c,null))[_0x15da('0x22')](function(_0x5c02f5){if(_0x5c02f5){_0x3bd704[_0x15da('0x42')]=_[_0x15da('0x44')](db[_0x15da('0x6f')][_0x15da('0x3e')]);_0x3bd704[_0x15da('0x43')]=_[_0x15da('0x44')](_0x481e2[_0x15da('0x43')]);_0x3bd704[_0x15da('0x45')]=_[_0x15da('0x46')](_0x3bd704['model'],_0x3bd704['query']);_0x667d00['attributes']=_[_0x15da('0x46')](_0x3bd704['model'],qs['fields'](_0x481e2[_0x15da('0x43')]['fields']));_0x667d00[_0x15da('0x48')]=_0x667d00['attributes']['length']?_0x667d00['attributes']:_0x3bd704['model'];if(!_0x481e2[_0x15da('0x43')][_0x15da('0x4a')](_0x15da('0x4b'))){_0x667d00['limit']=qs[_0x15da('0x30')](_0x481e2[_0x15da('0x43')][_0x15da('0x30')]);_0x667d00[_0x15da('0x4c')]=qs[_0x15da('0x4c')](_0x481e2[_0x15da('0x43')][_0x15da('0x4c')]);}_0x667d00['order']=qs[_0x15da('0x4d')](_0x481e2[_0x15da('0x43')][_0x15da('0x4d')]);_0x667d00['where']=qs['filters'](_[_0x15da('0x4f')](_0x481e2[_0x15da('0x43')],_0x3bd704['filters']));_0x667d00[_0x15da('0x4e')]['FaxAccountId']=_0x5c02f5['id'];if(_0x481e2[_0x15da('0x43')][_0x15da('0x50')]){_0x667d00[_0x15da('0x4e')]=_[_0x15da('0x51')](_0x667d00[_0x15da('0x4e')],{'$or':_[_0x15da('0x3c')](_0x667d00[_0x15da('0x48')],function(_0x5f133b){var _0x5ca54d={};_0x5ca54d[_0x5f133b]={'$like':'%'+_0x481e2[_0x15da('0x43')][_0x15da('0x50')]+'%'};return _0x5ca54d;})});}_0x667d00=_[_0x15da('0x51')]({},_0x667d00,_0x481e2[_0x15da('0x52')]);return db[_0x15da('0x6f')][_0x15da('0x2f')]({'where':_0x667d00['where']})[_0x15da('0x22')](function(_0x513dbe){_0x79671d['count']=_0x513dbe;if(_0x481e2[_0x15da('0x43')][_0x15da('0x53')]){_0x667d00['include']=[{'model':db['CmContact'],'as':_0x15da('0x71'),'required':![]},{'model':db['User'],'as':_0x15da('0x72'),'attributes':[_0x15da('0x39'),_0x15da('0x73'),_0x15da('0x74')],'required':![]},{'model':db[_0x15da('0x75')],'as':_0x15da('0x76'),'attributes':['id','name',_0x15da('0x77')],'where':_0x481e2[_0x15da('0x43')][_0x15da('0x78')]?{'id':_0x481e2[_0x15da('0x43')][_0x15da('0x78')]}:undefined,'required':_0x481e2[_0x15da('0x43')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x15da('0x55')](_0x667d00);})[_0x15da('0x22')](function(_0x598eae){_0x79671d[_0x15da('0x56')]=_0x598eae;return _0x79671d;});}})['then'](respondWithFilteredResult(_0xb8237c,_0x667d00))[_0x15da('0x29')](handleError(_0xb8237c,null));};exports['addApplications']=function(_0x21945f,_0x591cd4){var _0x3607ec=_0x21945f['params']['id'];var _0xf80ad0=_0x21945f['body'];var _0xad3a39=0xc8;var _0x1060bb=null;return db['sequelize'][_0x15da('0x79')]({'isolationLevel':db[_0x15da('0x7a')][_0x15da('0x7b')][_0x15da('0x7c')][_0x15da('0x7d')]},function(_0x3c3803){return db[_0x15da('0x3d')]['findOne']({'where':{'id':_0x3607ec},'transaction':_0x3c3803})[_0x15da('0x22')](function(_0x2a794a){if(_0x2a794a){return db[_0x15da('0x7e')][_0x15da('0x36')]({'where':{'FaxAccountId':_0x3607ec},'transaction':_0x3c3803})['then'](function(){var _0x194859=_[_0x15da('0x3c')](_0xf80ad0,function(_0x4d9c9b){_0x4d9c9b[_0x15da('0x65')]=_0x3607ec;return _0x4d9c9b;});return db[_0x15da('0x7e')]['bulkCreate'](_0x194859,{'transaction':_0x3c3803});});}else{_0xad3a39=0x194;_0x1060bb=[];}});})[_0x15da('0x22')](function(){if(_0xad3a39!==0x194){return db[_0x15da('0x7e')][_0x15da('0x7f')]({'where':{'FaxAccountId':_0x3607ec},'order':_0x15da('0x80')})[_0x15da('0x22')](function(_0x53ec84){_0x1060bb=_0x53ec84;});}})['catch'](function(_0x430d8c){_0xad3a39=0x1f4;logger[_0x15da('0x25')](_0x430d8c[_0x15da('0x38')]);if(_0x430d8c[_0x15da('0x39')]){delete _0x430d8c[_0x15da('0x39')];}_0x1060bb=_0x430d8c;})[_0x15da('0x81')](function(){if(_0x1060bb===null){_0x591cd4[_0x15da('0x2a')](_0xad3a39);}else{if(_0xad3a39===0x1f4){_0x591cd4[_0x15da('0x2b')](_0xad3a39)[_0x15da('0x3a')](_0x1060bb);}else{_0x591cd4['status'](_0xad3a39)[_0x15da('0x2d')](_0x1060bb);}}});};exports[_0x15da('0x82')]=function(_0x454b25,_0x5e5c9c,_0x4d8adc){var _0x5a1d28={};var _0x5c90d2={};var _0x387ee9;var _0x2b4739;return db[_0x15da('0x3d')][_0x15da('0x68')]({'where':{'id':_0x454b25[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x5e5c9c,null))[_0x15da('0x22')](function(_0x543110){if(_0x543110){_0x387ee9=_0x543110;_0x5c90d2[_0x15da('0x42')]=_[_0x15da('0x44')](db[_0x15da('0x7e')][_0x15da('0x3e')]);_0x5c90d2[_0x15da('0x43')]=_[_0x15da('0x44')](_0x454b25[_0x15da('0x43')]);_0x5c90d2[_0x15da('0x45')]=_['intersection'](_0x5c90d2[_0x15da('0x42')],_0x5c90d2[_0x15da('0x43')]);_0x5a1d28['attributes']=_[_0x15da('0x46')](_0x5c90d2[_0x15da('0x42')],qs[_0x15da('0x47')](_0x454b25[_0x15da('0x43')][_0x15da('0x47')]));_0x5a1d28[_0x15da('0x48')]=_0x5a1d28[_0x15da('0x48')][_0x15da('0x49')]?_0x5a1d28[_0x15da('0x48')]:_0x5c90d2[_0x15da('0x42')];_0x5a1d28[_0x15da('0x69')]=qs[_0x15da('0x4d')](_0x454b25[_0x15da('0x43')][_0x15da('0x4d')]);_0x5a1d28[_0x15da('0x4e')]=qs[_0x15da('0x45')](_[_0x15da('0x4f')](_0x454b25['query'],_0x5c90d2[_0x15da('0x45')]));if(_0x454b25['query'][_0x15da('0x50')]){_0x5a1d28['where']=_['merge'](_0x5a1d28[_0x15da('0x4e')],{'$or':_[_0x15da('0x3c')](_0x5a1d28[_0x15da('0x48')],function(_0x2c9e34){var _0xed6a4c={};_0xed6a4c[_0x2c9e34]={'$like':'%'+_0x454b25['query'][_0x15da('0x50')]+'%'};return _0xed6a4c;})});}_0x5a1d28=_[_0x15da('0x51')]({},_0x5a1d28,_0x454b25['options']);return _0x387ee9[_0x15da('0x82')](_0x5a1d28);}})[_0x15da('0x22')](function(_0x5889f1){if(_0x5889f1){_0x2b4739=_0x5889f1[_0x15da('0x49')];if(!_0x454b25['query'][_0x15da('0x4a')]('nolimit')){_0x5a1d28[_0x15da('0x30')]=qs[_0x15da('0x30')](_0x454b25[_0x15da('0x43')][_0x15da('0x30')]);_0x5a1d28[_0x15da('0x4c')]=qs['offset'](_0x454b25[_0x15da('0x43')]['offset']);}return _0x387ee9[_0x15da('0x82')](_0x5a1d28);}})['then'](function(_0x349ba5){if(_0x349ba5){return _0x349ba5?{'count':_0x2b4739,'rows':_0x349ba5}:null;}})[_0x15da('0x22')](respondWithResult(_0x5e5c9c,null))[_0x15da('0x29')](handleError(_0x5e5c9c,null));};function Extension(_0x2e140b,_0x2c09ce,_0x47968a,_0x172a74){this[_0x15da('0x83')]=_0x15da('0x84');this[_0x15da('0x85')]=_0x2e140b[_0x15da('0x86')];this[_0x15da('0x87')]=_0x172a74;this['type']='system';this[_0x15da('0x88')]=_0x15da('0x89');this[_0x15da('0x65')]=_0x2e140b['id'];this[_0x15da('0x80')]=_0x2c09ce;this[_0x15da('0x8a')]=_0x47968a;}function createExtensionsReciveFax(_0x33b000){var _0x2a94df=0x1;var _0x1e5e16=[];_0x1e5e16[_0x15da('0x8b')](new Extension(_0x33b000,_0x2a94df,'',_0x15da('0x8c')));_0x2a94df+=0x1;_0x1e5e16['push'](new Extension(_0x33b000,_0x2a94df,'CDR(type)=inbound-fax',_0x15da('0x8d')));_0x2a94df+=0x1;for(var _0x45e0bf in _0x33b000){if(_0x33b000[_0x15da('0x4a')](_0x45e0bf)&&(_0x45e0bf===_0x15da('0x8e')||_0x45e0bf===_0x15da('0x86')||_0x45e0bf==='gateway'||_0x45e0bf==='faxdetect'||_0x45e0bf==='headerinfo'||_0x45e0bf===_0x15da('0x8f')||_0x45e0bf===_0x15da('0x90')||_0x45e0bf===_0x15da('0x91')||_0x45e0bf===_0x15da('0x92'))){_0x1e5e16[_0x15da('0x8b')](new Extension(_0x33b000,_0x2a94df,_0x15da('0x93')+_0x45e0bf+')='+_0x33b000[_0x45e0bf],'Set'));_0x2a94df+=0x1;}}_0x1e5e16['push'](new Extension(_0x33b000,_0x2a94df,'6','Wait'));_0x2a94df+=0x1;_0x1e5e16['push'](new Extension(_0x33b000,_0x2a94df,_0x15da('0x94'),_0x15da('0x95')));_0x2a94df=0x0;return _0x1e5e16;}exports['addAccountApplications']=function(_0x348cae,_0x29140b,_0x282bf7){var _0x220c58;return db[_0x15da('0x7a')]['transaction'](function(_0x10d8fe){return db['FaxAccount'][_0x15da('0x59')](_0x348cae[_0x15da('0x5a')],{'transaction':_0x10d8fe})[_0x15da('0x22')](function(_0x22266b){_0x220c58=_0x22266b[_0x15da('0x5b')]({'plain':!![]});return db[_0x15da('0x96')][_0x15da('0x97')](createExtensionsReciveFax(_0x220c58),{'transaction':_0x10d8fe});});})[_0x15da('0x22')](function(){return _0x220c58;})[_0x15da('0x22')](respondWithResult(_0x29140b,null))[_0x15da('0x29')](handleError(_0x29140b,null));};exports['updateAccountApplications']=function(_0x9d8c7a,_0x8bccf1,_0x5263b4){var _0x23408e;return db['sequelize'][_0x15da('0x79')](function(_0x384390){return db[_0x15da('0x3d')]['update'](_0x9d8c7a[_0x15da('0x5a')],{'where':{'id':_0x9d8c7a[_0x15da('0x5a')]['id']},'transaction':_0x384390})[_0x15da('0x22')](function(_0x3a9741){return db[_0x15da('0x96')][_0x15da('0x36')]({'where':{'FaxAccountId':_0x9d8c7a[_0x15da('0x5a')]['id']},'transaction':_0x384390})['then'](function(_0x5229b1){return db[_0x15da('0x96')][_0x15da('0x97')](createExtensionsReciveFax(_[_0x15da('0x70')](_0x9d8c7a[_0x15da('0x5a')],['tech','key',_0x15da('0x98'),_0x15da('0x99'),_0x15da('0x9a'),_0x15da('0x9b')])),{'transaction':_0x384390});});});})[_0x15da('0x22')](function(){return db['FaxAccount'][_0x15da('0x9c')](_0x9d8c7a[_0x15da('0x5a')]['id']);})['then'](respondWithResult(_0x8bccf1,null))[_0x15da('0x29')](handleError(_0x8bccf1,null));};exports[_0x15da('0x9d')]=function(_0x4f1a15,_0x592fe3,_0x1bd59b){var _0x2d3a14={'raw':!![],'where':{}};var _0xd01184={};var _0x325d96={'count':0x0,'rows':[]};return db[_0x15da('0x3d')]['findOne']({'where':{'id':_0x4f1a15[_0x15da('0x57')]['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x592fe3,null))[_0x15da('0x22')](function(_0x5020ef){if(_0x5020ef){_0xd01184['model']=_[_0x15da('0x44')](db[_0x15da('0x9e')]['rawAttributes']);_0xd01184['query']=_['keys'](_0x4f1a15[_0x15da('0x43')]);_0xd01184[_0x15da('0x45')]=_[_0x15da('0x46')](_0xd01184[_0x15da('0x42')],_0xd01184[_0x15da('0x43')]);_0x2d3a14[_0x15da('0x48')]=_[_0x15da('0x46')](_0xd01184[_0x15da('0x42')],qs[_0x15da('0x47')](_0x4f1a15['query'][_0x15da('0x47')]));_0x2d3a14['attributes']=_0x2d3a14[_0x15da('0x48')][_0x15da('0x49')]?_0x2d3a14[_0x15da('0x48')]:_0xd01184[_0x15da('0x42')];if(!_0x4f1a15[_0x15da('0x43')]['hasOwnProperty']('nolimit')){_0x2d3a14['limit']=qs[_0x15da('0x30')](_0x4f1a15[_0x15da('0x43')][_0x15da('0x30')]);_0x2d3a14[_0x15da('0x4c')]=qs['offset'](_0x4f1a15[_0x15da('0x43')][_0x15da('0x4c')]);}_0x2d3a14['order']=qs[_0x15da('0x4d')](_0x4f1a15[_0x15da('0x43')]['sort']);_0x2d3a14['where']=qs[_0x15da('0x45')](_[_0x15da('0x4f')](_0x4f1a15[_0x15da('0x43')],_0xd01184[_0x15da('0x45')]));_0x2d3a14['where'][_0x15da('0x65')]=_0x5020ef['id'];if(_0x4f1a15[_0x15da('0x43')][_0x15da('0x50')]){_0x2d3a14[_0x15da('0x4e')]=_[_0x15da('0x51')](_0x2d3a14['where'],{'$or':_[_0x15da('0x3c')](_0x2d3a14[_0x15da('0x48')],function(_0x5be48a){var _0x45d7c5={};_0x45d7c5[_0x5be48a]={'$like':'%'+_0x4f1a15[_0x15da('0x43')][_0x15da('0x50')]+'%'};return _0x45d7c5;})});}if(_0x4f1a15[_0x15da('0x43')][_0x15da('0x9f')]){var _0x82c562=_0x4f1a15[_0x15da('0x43')][_0x15da('0x9f')][_0x15da('0xa0')](',');var _0x5baa7f={};_0x5baa7f[_0x82c562[0x0]]={'$gte':moment(_0x82c562[0x1])[_0x15da('0xa1')](_0x15da('0xa2'))};_0x2d3a14['where']=_[_0x15da('0x51')](_0x2d3a14[_0x15da('0x4e')],_0x5baa7f);}_0x2d3a14=_[_0x15da('0x51')]({},_0x2d3a14,_0x4f1a15[_0x15da('0x52')]);return db[_0x15da('0x9e')][_0x15da('0x2f')]({'where':_0x2d3a14[_0x15da('0x4e')]})[_0x15da('0x22')](function(_0x3f4cf4){_0x325d96[_0x15da('0x2f')]=_0x3f4cf4;if(_0x4f1a15['query']['includeAll']){_0x2d3a14[_0x15da('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x15da('0x55')](_0x2d3a14);})[_0x15da('0x22')](function(_0xb015ca){_0x325d96[_0x15da('0x56')]=_0xb015ca;return _0x325d96;});}})[_0x15da('0x22')](respondWithFilteredResult(_0x592fe3,_0x2d3a14))[_0x15da('0x29')](handleError(_0x592fe3,null));};exports['send']=function(_0xafe5cf,_0x4603b8,_0x3681f2){var _0x694545,_0xc3003c={},_0x36e1c1;if(_0xafe5cf['body']['to']){_0x36e1c1=_0xafe5cf[_0x15da('0x5a')]['to'][0x0];}return db[_0x15da('0x3d')][_0x15da('0x63')]({'where':{'id':_0xafe5cf[_0x15da('0x57')]['id']},'include':[{'model':db[_0x15da('0xa3')],'as':_0x15da('0xa4'),'include':[{'model':db[_0x15da('0xa5')],'as':'Contacts','where':{'fax':_0x36e1c1},'limit':0x1,'order':[[_0x15da('0x99'),_0x15da('0xa6')]]}]}]})[_0x15da('0x22')](handleEntityNotFound(_0x4603b8,null))[_0x15da('0x22')](function(_0x3aa0f1){_0x694545=_0x3aa0f1;if(_0xafe5cf[_0x15da('0x5a')][_0x15da('0xa7')]&&_0xafe5cf[_0x15da('0x5a')][_0x15da('0xa7')][_0x15da('0x49')]){for(var _0x396055=0x0;_0x396055<_0xafe5cf[_0x15da('0x5a')][_0x15da('0xa7')][_0x15da('0x49')];_0x396055+=0x1){_0xafe5cf[_0x15da('0x5a')][_0x15da('0xa7')][_0x396055]={'filename':_0xafe5cf[_0x15da('0x5a')]['attachments'][_0x396055][_0x15da('0x39')],'id':_0xafe5cf['body'][_0x15da('0xa7')][_0x396055]['id'],'path':path['join'](config[_0x15da('0xa8')],_0x15da('0xa9'),_0xafe5cf['body']['attachments'][_0x396055]['basename'])};}}return respondWithRpcPromise(_0x15da('0xaa'),_0x15da('0xaa'),{'FaxAccountId':_['isNil'](_0xafe5cf[_0x15da('0x57')]['id'])?undefined:_0xafe5cf[_0x15da('0x57')]['id'],'path':_['isNil'](_0xafe5cf[_0x15da('0x5a')][_0x15da('0xa7')][0x0]['path'])?undefined:_0xafe5cf['body'][_0x15da('0xa7')][0x0][_0x15da('0x7')],'fax':_[_0x15da('0xab')](_0xafe5cf[_0x15da('0x5a')]['to'][0x0])?undefined:_0xafe5cf[_0x15da('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x694545){if(_[_0x15da('0xab')](_0xafe5cf[_0x15da('0x5a')][_0x15da('0xac')])){_0xafe5cf[_0x15da('0x5a')][_0x15da('0xac')]=util['format'](_0x15da('0xad'),_0x694545['name'],_0x694545[_0x15da('0xae')]);}if(_0x694545['List']){if(_0x694545[_0x15da('0xa4')]['Contacts']['length']){return _0x694545[_0x15da('0xa4')][_0x15da('0xaf')][0x0];}else{return db['CmContact']['create'](_[_0x15da('0x1b')](_0xafe5cf[_0x15da('0x5a')],{'firstName':_0xafe5cf[_0x15da('0x5a')]['to'][0x0],'phone':_0xafe5cf['body']['to'][0x0],'fax':_0xafe5cf[_0x15da('0x5a')]['to'][0x0],'ListId':_0x694545['ListId']}));}}else{throw new Error(_0x15da('0xb0'));}}else{throw new Error(_0x15da('0xb1'));}})[_0x15da('0x22')](function(_0x178215){if(_0x178215){return db[_0x15da('0x6f')][_0x15da('0x63')]({'where':{'ContactId':_0x178215['id'],'closed':![],'FaxAccountId':_0x694545['id']}})[_0x15da('0x22')](function(_0x9e4df2){if(_0x9e4df2){return[_0x9e4df2,![]];}return db['FaxInteraction'][_0x15da('0x59')]({'UserId':_0xafe5cf[_0x15da('0x5d')]['id'],'ContactId':_0x178215['id'],'FaxAccountId':_0x694545['id'],'fax':_0xafe5cf[_0x15da('0x5a')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x15da('0x51')](_0xafe5cf[_0x15da('0x5a')],{'read':![],'body':_0xafe5cf['body']['attachments'][0x0][_0x15da('0xb2')],'FaxAccountId':_0x694545['id'],'UserId':_0xafe5cf['user']['id'],'ContactId':_0x178215['id'],'AttachmentId':_0xafe5cf[_0x15da('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x15da('0x9e')],'as':_0x15da('0xb3')}]})['then'](function(_0x593693){return[_0x593693,!![]];});});}else{throw new Error(_0x15da('0xb4'));}})[_0x15da('0xb5')](function(_0x312053,_0x52e251){if(_0x52e251){return _0x312053;}return db['FaxMessage'][_0x15da('0x59')]({'direction':_0x15da('0xb6'),'read':![],'body':_0xafe5cf[_0x15da('0x5a')][_0x15da('0xa7')][0x0][_0x15da('0xb2')],'FaxAccountId':_0x694545['id'],'FaxInteractionId':_0x312053['id'],'UserId':_0xafe5cf[_0x15da('0x5d')]['id'],'ContactId':_0x312053[_0x15da('0xb7')],'AttachmentId':_0xafe5cf['body'][_0x15da('0xa7')][0x0]['id']})[_0x15da('0x22')](function(_0x32094a){_0x312053[_0x15da('0xb8')][_0x15da('0xb3')]=[];_0x312053[_0x15da('0xb8')][_0x15da('0xb3')][_0x15da('0x8b')](_0x32094a[_0x15da('0xb8')]);return _0x312053;});})[_0x15da('0x22')](function(_0x1e461b){respondWithRpcPromise(_0x15da('0xb9'),_0x15da('0xb9'),{'FaxAccountId':_[_0x15da('0xab')](_0xafe5cf[_0x15da('0x57')]['id'])?undefined:_0xafe5cf[_0x15da('0x57')]['id'],'path':_[_0x15da('0xab')](_0xafe5cf['body'][_0x15da('0xa7')][0x0][_0x15da('0x7')])?undefined:_0xafe5cf[_0x15da('0x5a')]['attachments'][0x0][_0x15da('0x7')],'fax':_['isNil'](_0xafe5cf[_0x15da('0x5a')]['to'][0x0])?undefined:_0xafe5cf[_0x15da('0x5a')]['to'][0x0],'AttachmentId':_0xafe5cf[_0x15da('0x5a')][_0x15da('0xa7')][0x0]['id']},client9002)[_0x15da('0x22')](function(_0x54463f){logger[_0x15da('0xba')](_0x15da('0xbb'),_0x54463f);})[_0x15da('0x29')](function(_0x353b9f){logger[_0x15da('0xba')](_0x15da('0xbb'),_0x353b9f);});return _0x1e461b;})[_0x15da('0x22')](respondWithResult(_0x4603b8,null))['catch'](handleError(_0x4603b8,null));};exports['addAgents']=function(_0x975e34,_0x1bfa06,_0x2fe241){return db[_0x15da('0x3d')]['find']({'where':{'id':_0x975e34['params']['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x1bfa06,null))[_0x15da('0x22')](function(_0x3e7040){if(_0x3e7040){return _0x3e7040[_0x15da('0xbc')](_0x975e34[_0x15da('0x5a')][_0x15da('0x6b')],_[_0x15da('0x70')](_0x975e34[_0x15da('0x5a')],[_0x15da('0x6b'),'id'])||{})['spread'](function(_0x56da41){for(var _0x202d22=0x0;_0x202d22<_0x975e34[_0x15da('0x5a')]['ids']['length'];_0x202d22+=0x1){socket['emit'](_0x15da('0xbd'),{'UserId':Number(_0x975e34[_0x15da('0x5a')][_0x15da('0x6b')][_0x202d22]),'FaxAccountId':Number(_0x975e34[_0x15da('0x57')]['id'])});}return _0x56da41;});}})[_0x15da('0x22')](respondWithResult(_0x1bfa06,null))[_0x15da('0x29')](handleError(_0x1bfa06,null));};exports[_0x15da('0xbe')]=function(_0x3c1e1e,_0x56694a,_0x5e9e82){return db['FaxAccount'][_0x15da('0x63')]({'where':{'id':_0x3c1e1e['params']['id']}})[_0x15da('0x22')](handleEntityNotFound(_0x56694a,null))[_0x15da('0x22')](function(_0x9d6398){if(_0x9d6398){return _0x9d6398[_0x15da('0xbe')](_0x3c1e1e['query'][_0x15da('0x6b')])[_0x15da('0x22')](function(){if(_[_0x15da('0xbf')](_0x3c1e1e['query']['ids'])){for(var _0x43cbc6=0x0;_0x43cbc6<_0x3c1e1e['query'][_0x15da('0x6b')][_0x15da('0x49')];_0x43cbc6+=0x1){socket[_0x15da('0xc0')](_0x15da('0xc1'),{'UserId':Number(_0x3c1e1e[_0x15da('0x43')]['ids'][_0x43cbc6]),'FaxAccountId':Number(_0x3c1e1e[_0x15da('0x57')]['id'])});}}else{socket[_0x15da('0xc0')](_0x15da('0xc1'),{'UserId':Number(_0x3c1e1e[_0x15da('0x43')][_0x15da('0x6b')]),'FaxAccountId':Number(_0x3c1e1e[_0x15da('0x57')]['id'])});}});}})[_0x15da('0x22')](respondWithStatusCode(_0x56694a,null))[_0x15da('0x29')](handleError(_0x56694a,null));};exports[_0x15da('0xc2')]=function(_0x5060bd,_0x4ee0cd,_0x1e5e50){var _0x489407={};var _0x324754={};var _0x2c1303;var _0x26c680;return db[_0x15da('0x3d')][_0x15da('0x68')]({'where':{'id':_0x5060bd[_0x15da('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ee0cd,null))[_0x15da('0x22')](function(_0x440318){if(_0x440318){_0x2c1303=_0x440318;_0x324754[_0x15da('0x42')]=_[_0x15da('0x44')](db[_0x15da('0xc3')][_0x15da('0x3e')]);_0x324754[_0x15da('0x43')]=_[_0x15da('0x44')](_0x5060bd[_0x15da('0x43')]);_0x324754[_0x15da('0x45')]=_[_0x15da('0x46')](_0x324754[_0x15da('0x42')],_0x324754[_0x15da('0x43')]);_0x489407[_0x15da('0x48')]=_['intersection'](_0x324754['model'],qs[_0x15da('0x47')](_0x5060bd[_0x15da('0x43')][_0x15da('0x47')]));_0x489407['attributes']=_0x489407[_0x15da('0x48')][_0x15da('0x49')]?_0x489407[_0x15da('0x48')]:_0x324754['model'];_0x489407[_0x15da('0x69')]=qs['sort'](_0x5060bd[_0x15da('0x43')][_0x15da('0x4d')]);_0x489407[_0x15da('0x4e')]=qs[_0x15da('0x45')](_['pick'](_0x5060bd[_0x15da('0x43')],_0x324754[_0x15da('0x45')]));if(_0x5060bd['query'][_0x15da('0x50')]){_0x489407[_0x15da('0x4e')]=_[_0x15da('0x51')](_0x489407[_0x15da('0x4e')],{'$or':_[_0x15da('0x3c')](_0x489407[_0x15da('0x48')],function(_0x23ad59){var _0x168e76={};_0x168e76[_0x23ad59]={'$like':'%'+_0x5060bd['query'][_0x15da('0x50')]+'%'};return _0x168e76;})});}_0x489407=_[_0x15da('0x51')]({},_0x489407,_0x5060bd[_0x15da('0x52')]);return _0x2c1303[_0x15da('0xc2')](_0x489407);}})[_0x15da('0x22')](function(_0xf30939){if(_0xf30939){_0x26c680=_0xf30939[_0x15da('0x49')];if(!_0x5060bd['query'][_0x15da('0x4a')]('nolimit')){_0x489407[_0x15da('0x30')]=qs[_0x15da('0x30')](_0x5060bd['query']['limit']);_0x489407[_0x15da('0x4c')]=qs['offset'](_0x5060bd[_0x15da('0x43')][_0x15da('0x4c')]);}return _0x2c1303[_0x15da('0xc2')](_0x489407);}})[_0x15da('0x22')](function(_0x20354e){if(_0x20354e){return _0x20354e?{'count':_0x26c680,'rows':_0x20354e}:null;}})[_0x15da('0x22')](respondWithResult(_0x4ee0cd,null))[_0x15da('0x29')](handleError(_0x4ee0cd,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 46ee22a..8f7929f 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 _0x733f=['events','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5c1e75,_0x173aaa){var _0x2067d0=function(_0x42c051){while(--_0x42c051){_0x5c1e75['push'](_0x5c1e75['shift']());}};_0x2067d0(++_0x173aaa);}(_0x733f,0x120));var _0xf733=function(_0x58f2f4,_0x1fe95e){_0x58f2f4=_0x58f2f4-0x0;var _0x4d5e94=_0x733f[_0x58f2f4];return _0x4d5e94;};'use strict';var EventEmitter=require(_0xf733('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xf733('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf733('0x2')](0x0);var events={'afterCreate':_0xf733('0x3'),'afterUpdate':'update','afterDestroy':_0xf733('0x4')};function emitEvent(_0x3bacc8){return function(_0x1bde79,_0x28241e,_0xa6f6fe){FaxAccountEvents[_0xf733('0x5')](_0x3bacc8+':'+_0x1bde79['id'],_0x1bde79);FaxAccountEvents[_0xf733('0x5')](_0x3bacc8,_0x1bde79);_0xa6f6fe(null);};}for(var e in events){if(events[_0xf733('0x6')](e)){var event=events[e];FaxAccount[_0xf733('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x7795=['update','emit','hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners','save'];(function(_0x1aebb2,_0x54ab2b){var _0x46ed80=function(_0x48c7ee){while(--_0x48c7ee){_0x1aebb2['push'](_0x1aebb2['shift']());}};_0x46ed80(++_0x54ab2b);}(_0x7795,0x149));var _0x5779=function(_0x3af182,_0x5af22e){_0x3af182=_0x3af182-0x0;var _0x376d04=_0x7795[_0x3af182];return _0x376d04;};'use strict';var EventEmitter=require(_0x5779('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x5779('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5779('0x2')](0x0);var events={'afterCreate':_0x5779('0x3'),'afterUpdate':_0x5779('0x4'),'afterDestroy':'remove'};function emitEvent(_0x88cd49){return function(_0x52b28d,_0x24ec28,_0x443b4e){FaxAccountEvents[_0x5779('0x5')](_0x88cd49+':'+_0x52b28d['id'],_0x52b28d);FaxAccountEvents[_0x5779('0x5')](_0x88cd49,_0x52b28d);_0x443b4e(null);};}for(var e in events){if(events[_0x5779('0x6')](e)){var event=events[e];FaxAccount[_0x5779('0x7')](e,emitEvent(event));}}module[_0x5779('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c8bb7b9..476e087 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 _0xc2f0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x3569b7,_0x1f9423){var _0x3d0e5e=function(_0x379f58){while(--_0x379f58){_0x3569b7['push'](_0x3569b7['shift']());}};_0x3d0e5e(++_0x1f9423);}(_0xc2f0,0x18c));var _0x0c2f=function(_0x4fff08,_0x14255b){_0x4fff08=_0x4fff08-0x0;var _0x3485aa=_0xc2f0[_0x4fff08];return _0x3485aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c2f('0x0'))(_0x0c2f('0x1'));var moment=require(_0x0c2f('0x2'));var BPromise=require(_0x0c2f('0x3'));var rp=require(_0x0c2f('0x4'));var fs=require('fs');var path=require(_0x0c2f('0x5'));var rimraf=require(_0x0c2f('0x6'));var config=require(_0x0c2f('0x7'));var attributes=require(_0x0c2f('0x8'));module[_0x0c2f('0x9')]=function(_0x156356,_0x5e79fd){return _0x156356[_0x0c2f('0xa')](_0x0c2f('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac0d=['../../config/environment','exports','FaxAccount','fax_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac0d,0x10c));var _0xdac0=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xac0d[_0x25bea7];return _0x175952;};'use strict';var _=require('lodash');var util=require(_0xdac0('0x0'));var logger=require(_0xdac0('0x1'))(_0xdac0('0x2'));var moment=require(_0xdac0('0x3'));var BPromise=require(_0xdac0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdac0('0x5'));var rimraf=require(_0xdac0('0x6'));var config=require(_0xdac0('0x7'));var attributes=require('./faxAccount.attributes');module[_0xdac0('0x8')]=function(_0x5d6aa2,_0x3504d5){return _0x5d6aa2['define'](_0xdac0('0x9'),attributes,{'tableName':_0xdac0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 0f22868..46187f2 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 _0xb867=['CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','asc','length','from','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','FaxQueue','queueId','waitForTheAssignedQueue','Start','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','then','stringify','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb867,0xe5));var _0x7b86=function(_0x781ea,_0x2c3ce2){_0x781ea=_0x781ea-0x0;var _0x5b16ee=_0xb867[_0x781ea];return _0x5b16ee;};'use strict';var _=require(_0x7b86('0x0'));var util=require('util');var moment=require(_0x7b86('0x1'));var BPromise=require(_0x7b86('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7b86('0x3'));var logger=require(_0x7b86('0x4'))(_0x7b86('0x5'));var config=require(_0x7b86('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7b86('0x7')][_0x7b86('0x8')]({'port':0x232c});config['redis']=_[_0x7b86('0x9')](config[_0x7b86('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b86('0xb'))(new Redis(config['redis']));require(_0x7b86('0xc'))[_0x7b86('0xd')](socket);function respondWithRpcPromise(_0x29084c,_0x524110,_0x43f7ce){return new BPromise(function(_0x2583b6,_0x36afd8){return client['request'](_0x29084c,_0x43f7ce)['then'](function(_0x5e44a8){logger[_0x7b86('0xe')](_0x7b86('0xf'),_0x524110,_0x7b86('0x10'));logger[_0x7b86('0x11')](_0x7b86('0x12'),_0x524110,_0x7b86('0x10'),JSON['stringify'](_0x5e44a8));if(_0x5e44a8[_0x7b86('0x13')]){if(_0x5e44a8[_0x7b86('0x13')][_0x7b86('0x14')]===0x1f4){logger[_0x7b86('0x13')](_0x7b86('0xf'),_0x524110,_0x5e44a8['error'][_0x7b86('0x15')]);return _0x36afd8(_0x5e44a8[_0x7b86('0x13')][_0x7b86('0x15')]);}logger['error'](_0x7b86('0xf'),_0x524110,_0x5e44a8[_0x7b86('0x13')][_0x7b86('0x15')]);return _0x2583b6(_0x5e44a8['error'][_0x7b86('0x15')]);}else{logger[_0x7b86('0xe')](_0x7b86('0xf'),_0x524110,_0x7b86('0x10'));_0x2583b6(_0x5e44a8['result']['message']);}})['catch'](function(_0x3a0fcc){logger[_0x7b86('0x13')](_0x7b86('0xf'),_0x524110,_0x3a0fcc);_0x36afd8(_0x3a0fcc);});});}exports[_0x7b86('0x16')]=function(_0x2d7f6a){var _0x60cd5c=this;return new Promise(function(_0x1da8bf,_0x4f5e0b){return db[_0x7b86('0x17')]['findAll']({'raw':_0x2d7f6a[_0x7b86('0x18')]?_0x2d7f6a[_0x7b86('0x18')][_0x7b86('0x19')]===undefined?!![]:![]:!![],'where':_0x2d7f6a[_0x7b86('0x18')]?_0x2d7f6a[_0x7b86('0x18')][_0x7b86('0x1a')]||null:null,'attributes':_0x2d7f6a[_0x7b86('0x18')]?_0x2d7f6a[_0x7b86('0x18')][_0x7b86('0x1b')]||null:null,'limit':_0x2d7f6a[_0x7b86('0x18')]?_0x2d7f6a[_0x7b86('0x18')][_0x7b86('0x1c')]||null:null,'include':_0x2d7f6a[_0x7b86('0x18')]?_0x2d7f6a[_0x7b86('0x18')][_0x7b86('0x1d')]?_[_0x7b86('0x1e')](_0x2d7f6a[_0x7b86('0x18')]['include'],function(_0x3367d7){return{'model':db[_0x3367d7['model']],'as':_0x3367d7['as'],'attributes':_0x3367d7['attributes'],'include':_0x3367d7[_0x7b86('0x1d')]?_['map'](_0x3367d7[_0x7b86('0x1d')],function(_0x5deb06){return{'model':db[_0x5deb06[_0x7b86('0x1f')]],'as':_0x5deb06['as'],'attributes':_0x5deb06[_0x7b86('0x1b')],'include':_0x5deb06[_0x7b86('0x1d')]?_['map'](_0x5deb06[_0x7b86('0x1d')],function(_0x5c55d7){return{'model':db[_0x5c55d7['model']],'as':_0x5c55d7['as'],'attributes':_0x5c55d7[_0x7b86('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7b86('0x20')](function(_0x5831ef){logger[_0x7b86('0xe')](_0x7b86('0x16'),_0x2d7f6a);logger[_0x7b86('0x11')](_0x7b86('0x16'),_0x2d7f6a,JSON[_0x7b86('0x21')](_0x5831ef));_0x1da8bf(_0x5831ef);})[_0x7b86('0x22')](function(_0x3af4c6){logger[_0x7b86('0x13')](_0x7b86('0x16'),_0x3af4c6[_0x7b86('0x15')],_0x2d7f6a);_0x4f5e0b(_0x60cd5c[_0x7b86('0x13')](0x1f4,_0x3af4c6[_0x7b86('0x15')]));});});};exports[_0x7b86('0x23')]=function(_0x35b3df,_0x254883,_0x332a5c){var _0x2dfa83=this;return new Promise(function(_0x9090ba,_0x33caaf){var _0x5187c0={'body':_0x35b3df[_0x7b86('0x24')],'channel':_0x7b86('0x25')};var _0x1b4cf9=[];var _0x314064=[];var _0x122a82={};return db[_0x7b86('0x26')][_0x7b86('0x27')]()['then'](function(_0x37229a){if(!_0x37229a){throw new db[(_0x7b86('0x28'))][(_0x7b86('0x29'))](_0x7b86('0x2a'));}_0x1b4cf9=_['difference'](_['keys'](_0x37229a),[_0x7b86('0x2b'),_0x7b86('0x2c')]);_0x314064=_[_0x7b86('0x2d')](_[_0x7b86('0x2e')](_0x37229a),[_0x7b86('0x2b'),'updatedAt',_0x7b86('0x2f'),_0x7b86('0x30')]);if(_0x35b3df['body']['id']){delete _0x35b3df[_0x7b86('0x24')]['id'];}if(_[_0x7b86('0x31')](_0x35b3df[_0x7b86('0x24')]['from'])){throw new db[(_0x7b86('0x28'))][(_0x7b86('0x29'))](_0x7b86('0x32'));}if(_[_0x7b86('0x31')](_0x35b3df['body'][_0x7b86('0x24')])||_0x35b3df[_0x7b86('0x24')]['body']===''){throw new db[(_0x7b86('0x28'))]['ValidationError'](_0x7b86('0x33'));}if(_[_0x7b86('0x31')](_0x35b3df[_0x7b86('0x24')]['mapKey'])){throw new db[(_0x7b86('0x28'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x314064);}if(!_[_0x7b86('0x34')](_0x314064,_0x35b3df[_0x7b86('0x24')][_0x7b86('0x35')])){throw new db[(_0x7b86('0x28'))]['ValidationError'](_0x7b86('0x36')+_0x314064);}_0x122a82[_0x35b3df[_0x7b86('0x24')]['mapKey']]=_0x35b3df[_0x7b86('0x24')]['from'];})[_0x7b86('0x20')](function(){return db[_0x7b86('0x17')][_0x7b86('0x37')]({'where':{'id':_0x35b3df[_0x7b86('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x7b86('0x39'),'include':[{'model':db[_0x7b86('0x26')],'as':_0x7b86('0x3a'),'where':_0x122a82,'limit':0x1,'order':[[_0x7b86('0x2c'),_0x7b86('0x3b')]]}]},{'model':db[_0x7b86('0x3c')],'as':'Applications'}]});})[_0x7b86('0x20')](function(_0x48d226){if(_0x48d226&&_0x48d226['List']){var _0x51d2db=_0x48d226[_0x7b86('0x3d')]({'plain':!![]});_0x5187c0[_0x7b86('0x38')]=_0x51d2db;_0x5187c0[_0x7b86('0x3e')]=_0x51d2db[_0x7b86('0x3f')];_0x5187c0[_0x7b86('0x40')]=_0x51d2db[_0x7b86('0x39')];_0x5187c0[_0x7b86('0x3e')]=_[_0x7b86('0x41')](_0x5187c0[_0x7b86('0x3e')],[_0x7b86('0x42')],[_0x7b86('0x43')]);if(_0x5187c0['account']['Applications']){delete _0x5187c0[_0x7b86('0x38')]['Applications'];}if(_0x5187c0[_0x7b86('0x38')][_0x7b86('0x39')]&&_0x5187c0[_0x7b86('0x38')][_0x7b86('0x39')][_0x7b86('0x3a')][_0x7b86('0x44')]){return _0x5187c0['account'][_0x7b86('0x39')][_0x7b86('0x3a')][0x0];}var _0x3f15c0=_[_0x7b86('0x9')](_0x35b3df['body'],{'firstName':_0x35b3df[_0x7b86('0x24')][_0x7b86('0x45')],'ListId':_0x51d2db[_0x7b86('0x30')]});_0x3f15c0[_0x35b3df[_0x7b86('0x24')][_0x7b86('0x35')]]=_0x35b3df[_0x7b86('0x24')][_0x7b86('0x45')];return db['CmContact'][_0x7b86('0x46')](_0x3f15c0,{'fields':_0x1b4cf9,'raw':!![]});}})[_0x7b86('0x20')](function(_0x55345c){_0x5187c0[_0x7b86('0x47')]=_0x55345c;if(_0x55345c){var _0x40789f={'ContactId':_0x55345c['id'],'FaxAccountId':_0x35b3df[_0x7b86('0x38')]['id'],'fax':_0x55345c['fax']};return db[_0x7b86('0x48')]['find']({'where':{'ContactId':_0x55345c['id'],'closed':![],'FaxAccountId':_0x35b3df[_0x7b86('0x38')]['id']}})[_0x7b86('0x20')](function(_0x24411f){if(_0x24411f){return[_0x24411f,![]];}return db[_0x7b86('0x48')][_0x7b86('0x46')](_0x40789f)[_0x7b86('0x20')](function(_0xd3cb70){return[_0xd3cb70,!![]];});});}else{throw new Error(_0x7b86('0x49'));}})[_0x7b86('0x4a')](function(_0xd89d51,_0x3966e4){var _0x30564a=_0xd89d51[_0x7b86('0x3d')]({'plain':!![]});if(_0x3966e4){if(_0x5187c0[_0x7b86('0x38')]['autoclose']){_0x5187c0[_0x7b86('0x3e')][_0x7b86('0x4b')]({'id':0x0,'priority':_0x5187c0[_0x7b86('0x3e')][_0x7b86('0x44')]+0x1,'app':_0x7b86('0x4c'),'appdata':_0x7b86('0x4d'),'interval':_0x7b86('0x4e')});}_0x30564a[_0x7b86('0x4f')]=!![];}else{_0x30564a[_0x7b86('0x4f')]=![];}_0x5187c0[_0x7b86('0x50')]=_0x30564a;return db['FaxMessage']['create']({'body':_0x35b3df[_0x7b86('0x24')][_0x7b86('0x24')],'FaxAccountId':_0x35b3df[_0x7b86('0x38')]['id'],'FaxInteractionId':_0xd89d51['id'],'direction':'in','ContactId':_0xd89d51[_0x7b86('0x51')],'AttachmentId':_0x35b3df[_0x7b86('0x24')]['AttachmentId']});})[_0x7b86('0x20')](function(_0x8f0a88){_0x5187c0[_0x7b86('0x15')]=_0x8f0a88;if(!_0x5187c0[_0x7b86('0x50')][_0x7b86('0x52')])return;return db[_0x7b86('0x53')][_0x7b86('0x37')]({'attributes':['id',_0x7b86('0x54')],'where':{'id':_0x5187c0['interaction'][_0x7b86('0x52')]}});})[_0x7b86('0x20')](function(_0x2e1a02){if(_0x2e1a02){_0x5187c0['applications'][_0x7b86('0x55')]({'id':0x0,'priority':0x0,'app':_0x7b86('0x56'),'appdata':_0x2e1a02[_0x7b86('0x54')]+','+(_0x5187c0['account'][_0x7b86('0x57')]||0xa),'interval':_0x7b86('0x4e')});}if(!_0x5187c0[_0x7b86('0x50')]['queueId'])return;return db[_0x7b86('0x58')][_0x7b86('0x37')]({'attributes':['id',_0x7b86('0x54')],'where':{'id':_0x5187c0[_0x7b86('0x50')][_0x7b86('0x59')]}});})['then'](function(_0x147f9c){if(_0x147f9c){_0x5187c0['applications'][_0x7b86('0x55')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x147f9c[_0x7b86('0x54')]+','+(_0x5187c0[_0x7b86('0x38')][_0x7b86('0x5a')]||0x12c),'interval':_0x7b86('0x4e')});}return respondWithRpcPromise(_0x7b86('0x5b'),'startRouting',_0x5187c0);})['then'](function(_0xb77ee1){_0x9090ba(_0xb77ee1);})['catch'](function(_0x51aabf){_0x33caaf(_0x2dfa83[_0x7b86('0x13')](0x1f4,_0x51aabf[_0x7b86('0x15')]));});});}; \ No newline at end of file +var _0x2c14=['FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','AttachmentId','User','name','UserId','unshift','waitForTheAssignedAgent','FaxQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','get','applications','Applications','list','length','ListId','create'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x2c14,0x129));var _0x42c1=function(_0xe093e1,_0x475395){_0xe093e1=_0xe093e1-0x0;var _0x577773=_0x2c14[_0xe093e1];return _0x577773;};'use strict';var _=require(_0x42c1('0x0'));var util=require(_0x42c1('0x1'));var moment=require(_0x42c1('0x2'));var BPromise=require(_0x42c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42c1('0x5'));var logger=require(_0x42c1('0x6'))(_0x42c1('0x7'));var config=require(_0x42c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x42c1('0x9')][_0x42c1('0xa')]({'port':0x232c});config[_0x42c1('0xb')]=_[_0x42c1('0xc')](config[_0x42c1('0xb')],{'host':_0x42c1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42c1('0xb')]));require(_0x42c1('0xe'))[_0x42c1('0xf')](socket);function respondWithRpcPromise(_0x37e7d6,_0x294364,_0xa5fe9f){return new BPromise(function(_0x2229fe,_0x5d0de6){return client['request'](_0x37e7d6,_0xa5fe9f)[_0x42c1('0x10')](function(_0x295c4){logger['info'](_0x42c1('0x11'),_0x294364,_0x42c1('0x12'));logger[_0x42c1('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x294364,_0x42c1('0x12'),JSON[_0x42c1('0x14')](_0x295c4));if(_0x295c4[_0x42c1('0x15')]){if(_0x295c4[_0x42c1('0x15')][_0x42c1('0x16')]===0x1f4){logger['error'](_0x42c1('0x11'),_0x294364,_0x295c4[_0x42c1('0x15')]['message']);return _0x5d0de6(_0x295c4[_0x42c1('0x15')]['message']);}logger['error'](_0x42c1('0x11'),_0x294364,_0x295c4[_0x42c1('0x15')]['message']);return _0x2229fe(_0x295c4['error'][_0x42c1('0x17')]);}else{logger[_0x42c1('0x18')](_0x42c1('0x11'),_0x294364,_0x42c1('0x12'));_0x2229fe(_0x295c4[_0x42c1('0x19')][_0x42c1('0x17')]);}})['catch'](function(_0x137de9){logger['error'](_0x42c1('0x11'),_0x294364,_0x137de9);_0x5d0de6(_0x137de9);});});}exports[_0x42c1('0x1a')]=function(_0x512724){var _0x297290=this;return new Promise(function(_0x16a3b5,_0x508f65){return db[_0x42c1('0x1b')][_0x42c1('0x1c')]({'raw':_0x512724[_0x42c1('0x1d')]?_0x512724[_0x42c1('0x1d')][_0x42c1('0x1e')]===undefined?!![]:![]:!![],'where':_0x512724[_0x42c1('0x1d')]?_0x512724[_0x42c1('0x1d')][_0x42c1('0x1f')]||null:null,'attributes':_0x512724[_0x42c1('0x1d')]?_0x512724[_0x42c1('0x1d')][_0x42c1('0x20')]||null:null,'limit':_0x512724[_0x42c1('0x1d')]?_0x512724[_0x42c1('0x1d')][_0x42c1('0x21')]||null:null,'include':_0x512724['options']?_0x512724['options'][_0x42c1('0x22')]?_['map'](_0x512724['options'][_0x42c1('0x22')],function(_0x2a2625){return{'model':db[_0x2a2625[_0x42c1('0x23')]],'as':_0x2a2625['as'],'attributes':_0x2a2625[_0x42c1('0x20')],'include':_0x2a2625[_0x42c1('0x22')]?_[_0x42c1('0x24')](_0x2a2625[_0x42c1('0x22')],function(_0x377b6a){return{'model':db[_0x377b6a[_0x42c1('0x23')]],'as':_0x377b6a['as'],'attributes':_0x377b6a[_0x42c1('0x20')],'include':_0x377b6a[_0x42c1('0x22')]?_[_0x42c1('0x24')](_0x377b6a[_0x42c1('0x22')],function(_0x1ee88d){return{'model':db[_0x1ee88d['model']],'as':_0x1ee88d['as'],'attributes':_0x1ee88d[_0x42c1('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x244ad3){logger[_0x42c1('0x18')]('GetFaxAccount',_0x512724);logger[_0x42c1('0x13')](_0x42c1('0x1a'),_0x512724,JSON['stringify'](_0x244ad3));_0x16a3b5(_0x244ad3);})[_0x42c1('0x25')](function(_0x57137a){logger['error'](_0x42c1('0x1a'),_0x57137a[_0x42c1('0x17')],_0x512724);_0x508f65(_0x297290[_0x42c1('0x15')](0x1f4,_0x57137a[_0x42c1('0x17')]));});});};exports[_0x42c1('0x26')]=function(_0x13a561,_0x5cee49,_0x365613){var _0xc369ce=this;return new Promise(function(_0x150a94,_0x5ca4e1){var _0x2009c1={'body':_0x13a561[_0x42c1('0x27')],'channel':_0x42c1('0x28')};var _0x2793a4=[];var _0x291453=[];var _0x4edc2c={};return db[_0x42c1('0x29')][_0x42c1('0x2a')]()[_0x42c1('0x10')](function(_0x127cab){if(!_0x127cab){throw new db[(_0x42c1('0x2b'))][(_0x42c1('0x2c'))](_0x42c1('0x2d'));}_0x2793a4=_[_0x42c1('0x2e')](_[_0x42c1('0x2f')](_0x127cab),['createdAt',_0x42c1('0x30')]);_0x291453=_[_0x42c1('0x2e')](_[_0x42c1('0x2f')](_0x127cab),[_0x42c1('0x31'),'updatedAt',_0x42c1('0x32'),'ListId']);if(_0x13a561[_0x42c1('0x27')]['id']){delete _0x13a561[_0x42c1('0x27')]['id'];}if(_[_0x42c1('0x33')](_0x13a561[_0x42c1('0x27')][_0x42c1('0x34')])){throw new db[(_0x42c1('0x2b'))][(_0x42c1('0x2c'))](_0x42c1('0x35'));}if(_[_0x42c1('0x33')](_0x13a561[_0x42c1('0x27')][_0x42c1('0x27')])||_0x13a561[_0x42c1('0x27')][_0x42c1('0x27')]===''){throw new db[(_0x42c1('0x2b'))][(_0x42c1('0x2c'))](_0x42c1('0x36'));}if(_[_0x42c1('0x33')](_0x13a561['body'][_0x42c1('0x37')])){throw new db[(_0x42c1('0x2b'))][(_0x42c1('0x2c'))](_0x42c1('0x38')+_0x291453);}if(!_[_0x42c1('0x39')](_0x291453,_0x13a561[_0x42c1('0x27')][_0x42c1('0x37')])){throw new db[(_0x42c1('0x2b'))]['ValidationError'](_0x42c1('0x3a')+_0x291453);}_0x4edc2c[_0x13a561[_0x42c1('0x27')][_0x42c1('0x37')]]=_0x13a561[_0x42c1('0x27')][_0x42c1('0x34')];})['then'](function(){return db[_0x42c1('0x1b')][_0x42c1('0x3b')]({'where':{'id':_0x13a561[_0x42c1('0x3c')]['id']},'include':[{'model':db['CmList'],'as':_0x42c1('0x3d'),'include':[{'model':db['CmContact'],'as':_0x42c1('0x3e'),'where':_0x4edc2c,'limit':0x1,'order':[[_0x42c1('0x30'),_0x42c1('0x3f')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x42c1('0x10')](function(_0x80a48a){if(_0x80a48a&&_0x80a48a[_0x42c1('0x3d')]){var _0x2c0f2f=_0x80a48a[_0x42c1('0x40')]({'plain':!![]});_0x2009c1[_0x42c1('0x3c')]=_0x2c0f2f;_0x2009c1[_0x42c1('0x41')]=_0x2c0f2f[_0x42c1('0x42')];_0x2009c1[_0x42c1('0x43')]=_0x2c0f2f[_0x42c1('0x3d')];_0x2009c1[_0x42c1('0x41')]=_['orderBy'](_0x2009c1[_0x42c1('0x41')],['priority'],['asc']);if(_0x2009c1['account'][_0x42c1('0x42')]){delete _0x2009c1['account'][_0x42c1('0x42')];}if(_0x2009c1[_0x42c1('0x3c')][_0x42c1('0x3d')]&&_0x2009c1[_0x42c1('0x3c')][_0x42c1('0x3d')][_0x42c1('0x3e')][_0x42c1('0x44')]){return _0x2009c1[_0x42c1('0x3c')][_0x42c1('0x3d')]['Contacts'][0x0];}var _0x1027fb=_['defaults'](_0x13a561[_0x42c1('0x27')],{'firstName':_0x13a561[_0x42c1('0x27')][_0x42c1('0x34')],'ListId':_0x2c0f2f[_0x42c1('0x45')]});_0x1027fb[_0x13a561[_0x42c1('0x27')]['mapKey']]=_0x13a561['body']['from'];return db[_0x42c1('0x29')][_0x42c1('0x46')](_0x1027fb,{'fields':_0x2793a4,'raw':!![]});}})['then'](function(_0x1e6b87){_0x2009c1['contact']=_0x1e6b87;if(_0x1e6b87){var _0x170f06={'ContactId':_0x1e6b87['id'],'FaxAccountId':_0x13a561[_0x42c1('0x3c')]['id'],'fax':_0x1e6b87['fax']};return db[_0x42c1('0x47')][_0x42c1('0x3b')]({'where':{'ContactId':_0x1e6b87['id'],'closed':![],'FaxAccountId':_0x13a561['account']['id']}})[_0x42c1('0x10')](function(_0x4e90c7){if(_0x4e90c7){return[_0x4e90c7,![]];}return db[_0x42c1('0x47')][_0x42c1('0x46')](_0x170f06)[_0x42c1('0x10')](function(_0x22b70b){return[_0x22b70b,!![]];});});}else{throw new Error(_0x42c1('0x48'));}})['spread'](function(_0x318f3c,_0x1bc3d2){var _0x3791b1=_0x318f3c[_0x42c1('0x40')]({'plain':!![]});if(_0x1bc3d2){if(_0x2009c1[_0x42c1('0x3c')][_0x42c1('0x49')]){_0x2009c1['applications'][_0x42c1('0x4a')]({'id':0x0,'priority':_0x2009c1['applications'][_0x42c1('0x44')]+0x1,'app':_0x42c1('0x4b'),'appdata':_0x42c1('0x4c'),'interval':_0x42c1('0x4d')});}_0x3791b1[_0x42c1('0x4e')]=!![];}else{_0x3791b1[_0x42c1('0x4e')]=![];}_0x2009c1[_0x42c1('0x4f')]=_0x3791b1;return db['FaxMessage'][_0x42c1('0x46')]({'body':_0x13a561['body']['body'],'FaxAccountId':_0x13a561['account']['id'],'FaxInteractionId':_0x318f3c['id'],'direction':'in','ContactId':_0x318f3c['ContactId'],'AttachmentId':_0x13a561[_0x42c1('0x27')][_0x42c1('0x50')]});})[_0x42c1('0x10')](function(_0x44b63e){_0x2009c1['message']=_0x44b63e;if(!_0x2009c1['interaction']['UserId'])return;return db[_0x42c1('0x51')][_0x42c1('0x3b')]({'attributes':['id',_0x42c1('0x52')],'where':{'id':_0x2009c1[_0x42c1('0x4f')][_0x42c1('0x53')]}});})[_0x42c1('0x10')](function(_0x4d479c){if(_0x4d479c){_0x2009c1[_0x42c1('0x41')][_0x42c1('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4d479c[_0x42c1('0x52')]+','+(_0x2009c1[_0x42c1('0x3c')][_0x42c1('0x55')]||0xa),'interval':'*,*,*,*'});}if(!_0x2009c1[_0x42c1('0x4f')]['queueId'])return;return db[_0x42c1('0x56')]['find']({'attributes':['id','name'],'where':{'id':_0x2009c1[_0x42c1('0x4f')][_0x42c1('0x57')]}});})[_0x42c1('0x10')](function(_0x26eaab){if(_0x26eaab){_0x2009c1[_0x42c1('0x41')][_0x42c1('0x54')]({'id':0x0,'priority':0x1,'app':_0x42c1('0x58'),'appdata':_0x26eaab[_0x42c1('0x52')]+','+(_0x2009c1['account'][_0x42c1('0x59')]||0x12c),'interval':_0x42c1('0x4d')});}return respondWithRpcPromise(_0x42c1('0x5a'),_0x42c1('0x5b'),_0x2009c1);})['then'](function(_0x5ab062){_0x150a94(_0x5ab062);})['catch'](function(_0x19f6ff){_0x5ca4e1(_0xc369ce['error'](0x1f4,_0x19f6ff['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1b8fff0..311626d 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 _0x8fbe=['faxAccount:','./faxAccount.events','save','update','emit','removeListener','register','length'];(function(_0x51ae26,_0x18d826){var _0x5e81cb=function(_0x4e7415){while(--_0x4e7415){_0x51ae26['push'](_0x51ae26['shift']());}};_0x5e81cb(++_0x18d826);}(_0x8fbe,0x81));var _0xe8fb=function(_0x4af9e4,_0x1a3458){_0x4af9e4=_0x4af9e4-0x0;var _0x4b8c9b=_0x8fbe[_0x4af9e4];return _0x4b8c9b;};'use strict';var FaxAccountEvents=require(_0xe8fb('0x0'));var events=[_0xe8fb('0x1'),'remove',_0xe8fb('0x2')];function createListener(_0x1880cf,_0x20494c){return function(_0x85d274){_0x20494c[_0xe8fb('0x3')](_0x1880cf,_0x85d274);};}function removeListener(_0x6944c3,_0xbfddb6){return function(){FaxAccountEvents[_0xe8fb('0x4')](_0x6944c3,_0xbfddb6);};}exports[_0xe8fb('0x5')]=function(_0x178f55){for(var _0x34b850=0x0,_0x58a0ff=events[_0xe8fb('0x6')];_0x34b850<_0x58a0ff;_0x34b850++){var _0x5c7a91=events[_0x34b850];var _0x47e002=createListener(_0xe8fb('0x7')+_0x5c7a91,_0x178f55);FaxAccountEvents['on'](_0x5c7a91,_0x47e002);}}; \ No newline at end of file +var _0x352a=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x28e5ef,_0x4e406f){var _0x128683=function(_0x189fe8){while(--_0x189fe8){_0x28e5ef['push'](_0x28e5ef['shift']());}};_0x128683(++_0x4e406f);}(_0x352a,0x123));var _0xa352=function(_0x45cb89,_0x99520e){_0x45cb89=_0x45cb89-0x0;var _0x5948c1=_0x352a[_0x45cb89];return _0x5948c1;};'use strict';var FaxAccountEvents=require(_0xa352('0x0'));var events=[_0xa352('0x1'),_0xa352('0x2'),_0xa352('0x3')];function createListener(_0x463941,_0x346566){return function(_0x37bbcd){_0x346566[_0xa352('0x4')](_0x463941,_0x37bbcd);};}function removeListener(_0x4db9c5,_0x362283){return function(){FaxAccountEvents[_0xa352('0x5')](_0x4db9c5,_0x362283);};}exports[_0xa352('0x6')]=function(_0x36af40){for(var _0x5c397e=0x0,_0x53124d=events[_0xa352('0x7')];_0x5c397e<_0x53124d;_0x5c397e++){var _0x327a4a=events[_0x5c397e];var _0x46b327=createListener(_0xa352('0x8')+_0x327a4a,_0x36af40);FaxAccountEvents['on'](_0x327a4a,_0x46b327);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index fa15436..900bade 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 _0x1b35=['get','isAuthenticated','index','/describe','describe','/:id','show','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','/:id/interactions','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller'];(function(_0x5036f1,_0x555d55){var _0x283263=function(_0x3a7508){while(--_0x3a7508){_0x5036f1['push'](_0x5036f1['shift']());}};_0x283263(++_0x555d55);}(_0x1b35,0x98));var _0x51b3=function(_0x58efb4,_0x2ee648){_0x58efb4=_0x58efb4-0x0;var _0x2d5dfd=_0x1b35[_0x58efb4];return _0x2d5dfd;};'use strict';var multer=require('multer');var util=require(_0x51b3('0x0'));var path=require('path');var timeout=require(_0x51b3('0x1'));var express=require(_0x51b3('0x2'));var router=express[_0x51b3('0x3')]();var fs_extra=require(_0x51b3('0x4'));var auth=require(_0x51b3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x51b3('0x6'));var controller=require(_0x51b3('0x7'));router[_0x51b3('0x8')]('/',auth[_0x51b3('0x9')](),controller[_0x51b3('0xa')]);router[_0x51b3('0x8')](_0x51b3('0xb'),auth[_0x51b3('0x9')](),controller[_0x51b3('0xc')]);router['get'](_0x51b3('0xd'),auth['isAuthenticated'](),controller[_0x51b3('0xe')]);router[_0x51b3('0x8')]('/:id/dispositions',auth[_0x51b3('0x9')](),controller['getDispositions']);router[_0x51b3('0x8')]('/:id/canned_answers',auth[_0x51b3('0x9')](),controller['getAnswers']);router[_0x51b3('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x51b3('0xf')]);router['get'](_0x51b3('0x10'),auth[_0x51b3('0x9')](),controller['getApplications']);router[_0x51b3('0x8')](_0x51b3('0x11'),auth['isAuthenticated'](),controller[_0x51b3('0x12')]);router[_0x51b3('0x8')](_0x51b3('0x13'),auth[_0x51b3('0x9')](),controller[_0x51b3('0x14')]);router[_0x51b3('0x15')]('/',auth[_0x51b3('0x9')](),controller[_0x51b3('0x16')]);router['post'](_0x51b3('0x17'),auth['isAuthenticated'](),controller[_0x51b3('0x18')]);router[_0x51b3('0x15')](_0x51b3('0x19'),auth[_0x51b3('0x9')](),controller['addAnswer']);router['post'](_0x51b3('0x1a'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x51b3('0x15')](_0x51b3('0x10'),auth['isAuthenticated'](),controller[_0x51b3('0x1b')]);router[_0x51b3('0x15')](_0x51b3('0x1c'),auth['isAuthenticated'](),controller[_0x51b3('0x1d')]);router[_0x51b3('0x15')](_0x51b3('0x1e'),auth[_0x51b3('0x9')](),controller[_0x51b3('0x1f')]);router[_0x51b3('0x15')](_0x51b3('0x20'),auth[_0x51b3('0x9')](),controller[_0x51b3('0x21')]);router[_0x51b3('0x15')](_0x51b3('0x13'),auth[_0x51b3('0x9')](),controller['addAgents']);router[_0x51b3('0x22')]('/:id',auth[_0x51b3('0x9')](),controller['update']);router[_0x51b3('0x23')](_0x51b3('0xd'),auth[_0x51b3('0x9')](),controller[_0x51b3('0x24')]);router['delete'](_0x51b3('0x17'),auth[_0x51b3('0x9')](),controller[_0x51b3('0x25')]);router[_0x51b3('0x23')](_0x51b3('0x19'),auth[_0x51b3('0x9')](),controller[_0x51b3('0x26')]);router[_0x51b3('0x23')](_0x51b3('0x13'),auth[_0x51b3('0x9')](),controller[_0x51b3('0x27')]);module['exports']=router; \ No newline at end of file +var _0x0f6e=['/:id/messages','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction','/:id/applications','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','isAuthenticated','getAnswers','getApplications'];(function(_0x2d0270,_0x104042){var _0x4b8643=function(_0x59d13c){while(--_0x59d13c){_0x2d0270['push'](_0x2d0270['shift']());}};_0x4b8643(++_0x104042);}(_0x0f6e,0x70));var _0xe0f6=function(_0x4654d5,_0x55fdf3){_0x4654d5=_0x4654d5-0x0;var _0x2da3f9=_0x0f6e[_0x4654d5];return _0x2da3f9;};'use strict';var multer=require(_0xe0f6('0x0'));var util=require(_0xe0f6('0x1'));var path=require(_0xe0f6('0x2'));var timeout=require(_0xe0f6('0x3'));var express=require(_0xe0f6('0x4'));var router=express[_0xe0f6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe0f6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe0f6('0x7'));var controller=require(_0xe0f6('0x8'));router[_0xe0f6('0x9')]('/',auth['isAuthenticated'](),controller[_0xe0f6('0xa')]);router[_0xe0f6('0x9')](_0xe0f6('0xb'),auth['isAuthenticated'](),controller[_0xe0f6('0xc')]);router[_0xe0f6('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0f6('0xd')]);router[_0xe0f6('0x9')](_0xe0f6('0xe'),auth['isAuthenticated'](),controller[_0xe0f6('0xf')]);router[_0xe0f6('0x9')](_0xe0f6('0x10'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x12')]);router[_0xe0f6('0x9')]('/:id/interactions',auth[_0xe0f6('0x11')](),controller['getInteractions']);router[_0xe0f6('0x9')]('/:id/applications',auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x13')]);router[_0xe0f6('0x9')](_0xe0f6('0x14'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x15')]);router['get'](_0xe0f6('0x16'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x17')]);router['post']('/',auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x18')]);router[_0xe0f6('0x19')](_0xe0f6('0xe'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x1a')]);router[_0xe0f6('0x19')](_0xe0f6('0x10'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x1b')]);router['post']('/:id/interactions',auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x1c')]);router[_0xe0f6('0x19')](_0xe0f6('0x1d'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x1e')]);router['post']('/addaccountapplications',auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x1f')]);router[_0xe0f6('0x19')](_0xe0f6('0x20'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x21')]);router[_0xe0f6('0x19')]('/:id/send',auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x22')]);router[_0xe0f6('0x19')](_0xe0f6('0x16'),auth['isAuthenticated'](),controller[_0xe0f6('0x23')]);router[_0xe0f6('0x24')](_0xe0f6('0x25'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x26')]);router[_0xe0f6('0x27')](_0xe0f6('0x25'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x28')]);router[_0xe0f6('0x27')](_0xe0f6('0xe'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x29')]);router[_0xe0f6('0x27')](_0xe0f6('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xe0f6('0x27')](_0xe0f6('0x16'),auth[_0xe0f6('0x11')](),controller[_0xe0f6('0x2a')]);module[_0xe0f6('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 34f54ba..548dec5 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 _0x5973=['noop','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5973,0xb9));var _0x3597=function(_0x5d1566,_0x3fed4b){_0x5d1566=_0x5d1566-0x0;var _0x3441a2=_0x5973[_0x5d1566];return _0x3441a2;};'use strict';var Sequelize=require(_0x3597('0x0'));module[_0x3597('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3597('0x2')],'allowNull':![],'defaultValue':_0x3597('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3597('0x2')]},'interval':{'type':Sequelize[_0x3597('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0b66=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x0b66,0x75));var _0x60b6=function(_0x45885f,_0x63316){_0x45885f=_0x45885f-0x0;var _0x500322=_0x0b66[_0x45885f];return _0x500322;};'use strict';var Sequelize=require(_0x60b6('0x0'));module[_0x60b6('0x1')]={'priority':{'type':Sequelize[_0x60b6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x60b6('0x3')],'allowNull':![],'defaultValue':_0x60b6('0x4')},'appdata':{'type':Sequelize[_0x60b6('0x5')]()},'description':{'type':Sequelize[_0x60b6('0x3')]},'interval':{'type':Sequelize[_0x60b6('0x3')],'defaultValue':_0x60b6('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c553e03..3a50ab8 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 _0x254c=['stack','name','index','FaxApplication','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','options','find','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../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','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x535e2e,_0x5180ed){var _0x357681=function(_0x19fa9f){while(--_0x19fa9f){_0x535e2e['push'](_0x535e2e['shift']());}};_0x357681(++_0x5180ed);}(_0x254c,0x6b));var _0xc254=function(_0x19e71c,_0x19319b){_0x19e71c=_0x19e71c-0x0;var _0x446a00=_0x254c[_0x19e71c];return _0x446a00;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc254('0x0'));var jsonpatch=require(_0xc254('0x1'));var rp=require(_0xc254('0x2'));var moment=require(_0xc254('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc254('0x4'));var util=require(_0xc254('0x5'));var path=require(_0xc254('0x6'));var sox=require('sox');var csv=require(_0xc254('0x7'));var ejs=require(_0xc254('0x8'));var fs=require('fs');var fs_extra=require(_0xc254('0x9'));var _=require(_0xc254('0xa'));var squel=require('squel');var crypto=require(_0xc254('0xb'));var jsforce=require(_0xc254('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc254('0x7'));var querystring=require(_0xc254('0xd'));var Papa=require(_0xc254('0xe'));var Redis=require('ioredis');var authService=require(_0xc254('0xf'));var qs=require(_0xc254('0x10'));var as=require(_0xc254('0x11'));var hardwareService=require(_0xc254('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc254('0x13'));var config=require(_0xc254('0x14'));var licenseUtil=require(_0xc254('0x15'));var db=require(_0xc254('0x16'))['db'];function respondWithStatusCode(_0xfa90f0,_0x2ee2e2){_0x2ee2e2=_0x2ee2e2||0xcc;return function(_0x21a46b){if(_0x21a46b){return _0xfa90f0['sendStatus'](_0x2ee2e2);}return _0xfa90f0[_0xc254('0x17')](_0x2ee2e2)[_0xc254('0x18')]();};}function respondWithResult(_0x4ffd78,_0x3f9e85){_0x3f9e85=_0x3f9e85||0xc8;return function(_0x533299){if(_0x533299){return _0x4ffd78[_0xc254('0x17')](_0x3f9e85)[_0xc254('0x19')](_0x533299);}};}function respondWithFilteredResult(_0x23cbe8,_0x5704d8){return function(_0x4135c3){if(_0x4135c3){var _0x1dd55d=typeof _0x5704d8[_0xc254('0x1a')]===_0xc254('0x1b')&&typeof _0x5704d8['limit']===_0xc254('0x1b');var _0x563bab=_0x4135c3[_0xc254('0x1c')];var _0x24da48=_0x1dd55d?0x0:_0x5704d8[_0xc254('0x1a')];var _0x554d66=_0x1dd55d?_0x4135c3['count']:_0x5704d8[_0xc254('0x1a')]+_0x5704d8[_0xc254('0x1d')];var _0x3dc055;if(_0x554d66>=_0x563bab){_0x554d66=_0x563bab;_0x3dc055=0xc8;}else{_0x3dc055=0xce;}_0x23cbe8[_0xc254('0x17')](_0x3dc055);return _0x23cbe8['set'](_0xc254('0x1e'),_0x24da48+'-'+_0x554d66+'/'+_0x563bab)[_0xc254('0x19')](_0x4135c3);}return null;};}function patchUpdates(_0x926daa){return function(_0x5eef4a){try{jsonpatch[_0xc254('0x1f')](_0x5eef4a,_0x926daa,!![]);}catch(_0x68163a){return BPromise[_0xc254('0x20')](_0x68163a);}return _0x5eef4a[_0xc254('0x21')]();};}function saveUpdates(_0x167c05,_0x17a9ab){return function(_0x1aab22){if(_0x1aab22){return _0x1aab22[_0xc254('0x22')](_0x167c05)[_0xc254('0x23')](function(_0x20261e){return _0x20261e;});}return null;};}function removeEntity(_0x24c754,_0x40465a){return function(_0x236b9b){if(_0x236b9b){return _0x236b9b[_0xc254('0x24')]()[_0xc254('0x23')](function(){_0x24c754[_0xc254('0x17')](0xcc)[_0xc254('0x18')]();});}};}function handleEntityNotFound(_0x44ae59,_0x4361e5){return function(_0xc242c4){if(!_0xc242c4){_0x44ae59[_0xc254('0x25')](0x194);}return _0xc242c4;};}function handleError(_0x7f52ea,_0x469962){_0x469962=_0x469962||0x1f4;return function(_0x25ba9e){logger[_0xc254('0x26')](_0x25ba9e[_0xc254('0x27')]);if(_0x25ba9e['name']){delete _0x25ba9e[_0xc254('0x28')];}_0x7f52ea[_0xc254('0x17')](_0x469962)['send'](_0x25ba9e);};}exports[_0xc254('0x29')]=function(_0x3d9e69,_0x16f990){var _0x5c54ed={},_0x1f5652={},_0x3f2206={'count':0x0,'rows':[]};var _0x7e8437=_['map'](db[_0xc254('0x2a')]['rawAttributes'],function(_0x1037a0){return{'name':_0x1037a0[_0xc254('0x2b')],'type':_0x1037a0[_0xc254('0x2c')][_0xc254('0x2d')]};});_0x1f5652[_0xc254('0x2e')]=_[_0xc254('0x2f')](_0x7e8437,'name');_0x1f5652[_0xc254('0x30')]=_['keys'](_0x3d9e69['query']);_0x1f5652[_0xc254('0x31')]=_[_0xc254('0x32')](_0x1f5652[_0xc254('0x2e')],_0x1f5652[_0xc254('0x30')]);_0x5c54ed[_0xc254('0x33')]=_[_0xc254('0x32')](_0x1f5652[_0xc254('0x2e')],qs[_0xc254('0x34')](_0x3d9e69[_0xc254('0x30')][_0xc254('0x34')]));_0x5c54ed[_0xc254('0x33')]=_0x5c54ed[_0xc254('0x33')]['length']?_0x5c54ed['attributes']:_0x1f5652[_0xc254('0x2e')];if(!_0x3d9e69[_0xc254('0x30')][_0xc254('0x35')](_0xc254('0x36'))){_0x5c54ed[_0xc254('0x1d')]=qs['limit'](_0x3d9e69[_0xc254('0x30')]['limit']);_0x5c54ed[_0xc254('0x1a')]=qs[_0xc254('0x1a')](_0x3d9e69[_0xc254('0x30')]['offset']);}_0x5c54ed[_0xc254('0x37')]=qs[_0xc254('0x38')](_0x3d9e69['query'][_0xc254('0x38')]);_0x5c54ed['where']=qs[_0xc254('0x31')](_['pick'](_0x3d9e69[_0xc254('0x30')],_0x1f5652['filters']),_0x7e8437);if(_0x3d9e69['query']['filter']){_0x5c54ed[_0xc254('0x39')]=_[_0xc254('0x3a')](_0x5c54ed[_0xc254('0x39')],{'$or':_['map'](_0x7e8437,function(_0x4502e1){if(_0x4502e1[_0xc254('0x2c')]!==_0xc254('0x3b')){var _0x251fb5={};_0x251fb5[_0x4502e1['name']]={'$like':'%'+_0x3d9e69[_0xc254('0x30')]['filter']+'%'};return _0x251fb5;}})});}_0x5c54ed=_['merge']({},_0x5c54ed,_0x3d9e69['options']);var _0x5c991e={'where':_0x5c54ed[_0xc254('0x39')]};return db[_0xc254('0x2a')][_0xc254('0x1c')](_0x5c991e)[_0xc254('0x23')](function(_0x36dd1c){_0x3f2206['count']=_0x36dd1c;if(_0x3d9e69[_0xc254('0x30')][_0xc254('0x3c')]){_0x5c54ed[_0xc254('0x3d')]=[{'all':!![]}];}return db['FaxApplication'][_0xc254('0x3e')](_0x5c54ed);})['then'](function(_0x4355b6){_0x3f2206[_0xc254('0x3f')]=_0x4355b6;return _0x3f2206;})[_0xc254('0x23')](respondWithFilteredResult(_0x16f990,_0x5c54ed))[_0xc254('0x40')](handleError(_0x16f990,null));};exports['show']=function(_0xb44bb3,_0x391754){var _0x5843e4={'raw':!![],'where':{'id':_0xb44bb3[_0xc254('0x41')]['id']}},_0x126548={};_0x126548[_0xc254('0x2e')]=_[_0xc254('0x42')](db['FaxApplication'][_0xc254('0x43')]);_0x126548[_0xc254('0x30')]=_[_0xc254('0x42')](_0xb44bb3[_0xc254('0x30')]);_0x126548[_0xc254('0x31')]=_['intersection'](_0x126548[_0xc254('0x2e')],_0x126548['query']);_0x5843e4[_0xc254('0x33')]=_[_0xc254('0x32')](_0x126548['model'],qs[_0xc254('0x34')](_0xb44bb3[_0xc254('0x30')][_0xc254('0x34')]));_0x5843e4['attributes']=_0x5843e4[_0xc254('0x33')][_0xc254('0x44')]?_0x5843e4[_0xc254('0x33')]:_0x126548[_0xc254('0x2e')];if(_0xb44bb3['query']['includeAll']){_0x5843e4[_0xc254('0x3d')]=[{'all':!![]}];}_0x5843e4=_[_0xc254('0x3a')]({},_0x5843e4,_0xb44bb3[_0xc254('0x45')]);return db[_0xc254('0x2a')][_0xc254('0x46')](_0x5843e4)[_0xc254('0x23')](handleEntityNotFound(_0x391754,null))[_0xc254('0x23')](respondWithResult(_0x391754,null))[_0xc254('0x40')](handleError(_0x391754,null));};exports['create']=function(_0x46856d,_0xede370){return db['FaxApplication'][_0xc254('0x47')](_0x46856d['body'],{})[_0xc254('0x23')](respondWithResult(_0xede370,0xc9))['catch'](handleError(_0xede370,null));};exports['update']=function(_0xbbd152,_0x408e60){if(_0xbbd152[_0xc254('0x48')]['id']){delete _0xbbd152[_0xc254('0x48')]['id'];}return db[_0xc254('0x2a')]['find']({'where':{'id':_0xbbd152[_0xc254('0x41')]['id']}})['then'](handleEntityNotFound(_0x408e60,null))[_0xc254('0x23')](saveUpdates(_0xbbd152[_0xc254('0x48')],null))[_0xc254('0x23')](respondWithResult(_0x408e60,null))[_0xc254('0x40')](handleError(_0x408e60,null));};exports[_0xc254('0x24')]=function(_0x3f9517,_0x1ffe41){return db[_0xc254('0x2a')][_0xc254('0x46')]({'where':{'id':_0x3f9517[_0xc254('0x41')]['id']}})[_0xc254('0x23')](handleEntityNotFound(_0x1ffe41,null))[_0xc254('0x23')](removeEntity(_0x1ffe41,null))[_0xc254('0x40')](handleError(_0x1ffe41,null));}; \ No newline at end of file +var _0xb1fa=['params','keys','length','options','find','create','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','sort','filters','pick','filter','where','merge','include','FaxApplication','findAll','catch','show'];(function(_0x3608b0,_0x51e41e){var _0x4eb9e8=function(_0x36fdfd){while(--_0x36fdfd){_0x3608b0['push'](_0x3608b0['shift']());}};_0x4eb9e8(++_0x51e41e);}(_0xb1fa,0x1b7));var _0xab1f=function(_0x1e39d1,_0x5aa884){_0x1e39d1=_0x1e39d1-0x0;var _0x1ac9ce=_0xb1fa[_0x1e39d1];return _0x1ac9ce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab1f('0x0'));var jsonpatch=require(_0xab1f('0x1'));var rp=require('request-promise');var moment=require(_0xab1f('0x2'));var BPromise=require(_0xab1f('0x3'));var Mustache=require(_0xab1f('0x4'));var util=require(_0xab1f('0x5'));var path=require(_0xab1f('0x6'));var sox=require('sox');var csv=require(_0xab1f('0x7'));var ejs=require(_0xab1f('0x8'));var fs=require('fs');var fs_extra=require(_0xab1f('0x9'));var _=require(_0xab1f('0xa'));var squel=require(_0xab1f('0xb'));var crypto=require('crypto');var jsforce=require(_0xab1f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab1f('0xd'));var Redis=require(_0xab1f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xab1f('0xf'));var as=require(_0xab1f('0x10'));var hardwareService=require(_0xab1f('0x11'));var logger=require(_0xab1f('0x12'))(_0xab1f('0x13'));var utils=require(_0xab1f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xab1f('0x15'));var db=require(_0xab1f('0x16'))['db'];function respondWithStatusCode(_0x37b048,_0x45e13c){_0x45e13c=_0x45e13c||0xcc;return function(_0x3c0516){if(_0x3c0516){return _0x37b048[_0xab1f('0x17')](_0x45e13c);}return _0x37b048[_0xab1f('0x18')](_0x45e13c)['end']();};}function respondWithResult(_0x46a774,_0x4d4d4a){_0x4d4d4a=_0x4d4d4a||0xc8;return function(_0x4ae032){if(_0x4ae032){return _0x46a774[_0xab1f('0x18')](_0x4d4d4a)[_0xab1f('0x19')](_0x4ae032);}};}function respondWithFilteredResult(_0x58060b,_0x49e487){return function(_0x292b55){if(_0x292b55){var _0x34d224=typeof _0x49e487['offset']===_0xab1f('0x1a')&&typeof _0x49e487[_0xab1f('0x1b')]===_0xab1f('0x1a');var _0x4e144e=_0x292b55[_0xab1f('0x1c')];var _0x2c1ea6=_0x34d224?0x0:_0x49e487[_0xab1f('0x1d')];var _0x3690f4=_0x34d224?_0x292b55['count']:_0x49e487[_0xab1f('0x1d')]+_0x49e487[_0xab1f('0x1b')];var _0x1b055d;if(_0x3690f4>=_0x4e144e){_0x3690f4=_0x4e144e;_0x1b055d=0xc8;}else{_0x1b055d=0xce;}_0x58060b[_0xab1f('0x18')](_0x1b055d);return _0x58060b[_0xab1f('0x1e')](_0xab1f('0x1f'),_0x2c1ea6+'-'+_0x3690f4+'/'+_0x4e144e)[_0xab1f('0x19')](_0x292b55);}return null;};}function patchUpdates(_0x3f5f76){return function(_0x3c81d9){try{jsonpatch[_0xab1f('0x20')](_0x3c81d9,_0x3f5f76,!![]);}catch(_0x4930fe){return BPromise[_0xab1f('0x21')](_0x4930fe);}return _0x3c81d9[_0xab1f('0x22')]();};}function saveUpdates(_0x30f46b,_0x158ff4){return function(_0x1d6797){if(_0x1d6797){return _0x1d6797[_0xab1f('0x23')](_0x30f46b)[_0xab1f('0x24')](function(_0x586294){return _0x586294;});}return null;};}function removeEntity(_0x46bb7f,_0x176950){return function(_0x40f108){if(_0x40f108){return _0x40f108[_0xab1f('0x25')]()[_0xab1f('0x24')](function(){_0x46bb7f[_0xab1f('0x18')](0xcc)[_0xab1f('0x26')]();});}};}function handleEntityNotFound(_0x539485,_0x14fc96){return function(_0x143b28){if(!_0x143b28){_0x539485['sendStatus'](0x194);}return _0x143b28;};}function handleError(_0x56be0b,_0x433049){_0x433049=_0x433049||0x1f4;return function(_0x3417fd){logger[_0xab1f('0x27')](_0x3417fd['stack']);if(_0x3417fd['name']){delete _0x3417fd[_0xab1f('0x28')];}_0x56be0b[_0xab1f('0x18')](_0x433049)[_0xab1f('0x29')](_0x3417fd);};}exports[_0xab1f('0x2a')]=function(_0x4bf5df,_0x16a58b){var _0x53555b={},_0x1d7b10={},_0x108f6e={'count':0x0,'rows':[]};var _0x11a8ab=_[_0xab1f('0x2b')](db['FaxApplication'][_0xab1f('0x2c')],function(_0x159f0){return{'name':_0x159f0[_0xab1f('0x2d')],'type':_0x159f0[_0xab1f('0x2e')][_0xab1f('0x2f')]};});_0x1d7b10[_0xab1f('0x30')]=_['map'](_0x11a8ab,_0xab1f('0x28'));_0x1d7b10['query']=_['keys'](_0x4bf5df[_0xab1f('0x31')]);_0x1d7b10['filters']=_[_0xab1f('0x32')](_0x1d7b10[_0xab1f('0x30')],_0x1d7b10['query']);_0x53555b['attributes']=_[_0xab1f('0x32')](_0x1d7b10[_0xab1f('0x30')],qs[_0xab1f('0x33')](_0x4bf5df[_0xab1f('0x31')][_0xab1f('0x33')]));_0x53555b[_0xab1f('0x34')]=_0x53555b[_0xab1f('0x34')]['length']?_0x53555b[_0xab1f('0x34')]:_0x1d7b10[_0xab1f('0x30')];if(!_0x4bf5df[_0xab1f('0x31')][_0xab1f('0x35')]('nolimit')){_0x53555b[_0xab1f('0x1b')]=qs[_0xab1f('0x1b')](_0x4bf5df[_0xab1f('0x31')][_0xab1f('0x1b')]);_0x53555b['offset']=qs[_0xab1f('0x1d')](_0x4bf5df[_0xab1f('0x31')][_0xab1f('0x1d')]);}_0x53555b['order']=qs['sort'](_0x4bf5df['query'][_0xab1f('0x36')]);_0x53555b['where']=qs[_0xab1f('0x37')](_[_0xab1f('0x38')](_0x4bf5df['query'],_0x1d7b10['filters']),_0x11a8ab);if(_0x4bf5df[_0xab1f('0x31')][_0xab1f('0x39')]){_0x53555b[_0xab1f('0x3a')]=_['merge'](_0x53555b[_0xab1f('0x3a')],{'$or':_['map'](_0x11a8ab,function(_0x5b652b){if(_0x5b652b[_0xab1f('0x2e')]!=='VIRTUAL'){var _0x75819d={};_0x75819d[_0x5b652b['name']]={'$like':'%'+_0x4bf5df[_0xab1f('0x31')]['filter']+'%'};return _0x75819d;}})});}_0x53555b=_[_0xab1f('0x3b')]({},_0x53555b,_0x4bf5df['options']);var _0xf3f2e4={'where':_0x53555b[_0xab1f('0x3a')]};return db['FaxApplication']['count'](_0xf3f2e4)[_0xab1f('0x24')](function(_0x54c714){_0x108f6e[_0xab1f('0x1c')]=_0x54c714;if(_0x4bf5df[_0xab1f('0x31')]['includeAll']){_0x53555b[_0xab1f('0x3c')]=[{'all':!![]}];}return db[_0xab1f('0x3d')][_0xab1f('0x3e')](_0x53555b);})['then'](function(_0x10bc7e){_0x108f6e['rows']=_0x10bc7e;return _0x108f6e;})['then'](respondWithFilteredResult(_0x16a58b,_0x53555b))[_0xab1f('0x3f')](handleError(_0x16a58b,null));};exports[_0xab1f('0x40')]=function(_0x2fa952,_0x2e6fb3){var _0x9c475a={'raw':!![],'where':{'id':_0x2fa952[_0xab1f('0x41')]['id']}},_0x2a6f43={};_0x2a6f43['model']=_[_0xab1f('0x42')](db['FaxApplication'][_0xab1f('0x2c')]);_0x2a6f43[_0xab1f('0x31')]=_[_0xab1f('0x42')](_0x2fa952[_0xab1f('0x31')]);_0x2a6f43[_0xab1f('0x37')]=_[_0xab1f('0x32')](_0x2a6f43[_0xab1f('0x30')],_0x2a6f43[_0xab1f('0x31')]);_0x9c475a[_0xab1f('0x34')]=_[_0xab1f('0x32')](_0x2a6f43['model'],qs[_0xab1f('0x33')](_0x2fa952['query'][_0xab1f('0x33')]));_0x9c475a[_0xab1f('0x34')]=_0x9c475a[_0xab1f('0x34')][_0xab1f('0x43')]?_0x9c475a[_0xab1f('0x34')]:_0x2a6f43[_0xab1f('0x30')];if(_0x2fa952['query']['includeAll']){_0x9c475a['include']=[{'all':!![]}];}_0x9c475a=_[_0xab1f('0x3b')]({},_0x9c475a,_0x2fa952[_0xab1f('0x44')]);return db[_0xab1f('0x3d')][_0xab1f('0x45')](_0x9c475a)[_0xab1f('0x24')](handleEntityNotFound(_0x2e6fb3,null))['then'](respondWithResult(_0x2e6fb3,null))[_0xab1f('0x3f')](handleError(_0x2e6fb3,null));};exports['create']=function(_0x152492,_0x5c8431){return db['FaxApplication'][_0xab1f('0x46')](_0x152492[_0xab1f('0x47')],{})[_0xab1f('0x24')](respondWithResult(_0x5c8431,0xc9))[_0xab1f('0x3f')](handleError(_0x5c8431,null));};exports[_0xab1f('0x23')]=function(_0x539a68,_0x2389cf){if(_0x539a68[_0xab1f('0x47')]['id']){delete _0x539a68[_0xab1f('0x47')]['id'];}return db['FaxApplication'][_0xab1f('0x45')]({'where':{'id':_0x539a68[_0xab1f('0x41')]['id']}})[_0xab1f('0x24')](handleEntityNotFound(_0x2389cf,null))['then'](saveUpdates(_0x539a68[_0xab1f('0x47')],null))[_0xab1f('0x24')](respondWithResult(_0x2389cf,null))['catch'](handleError(_0x2389cf,null));};exports[_0xab1f('0x25')]=function(_0x41acae,_0x4aade2){return db['FaxApplication'][_0xab1f('0x45')]({'where':{'id':_0x41acae[_0xab1f('0x41')]['id']}})[_0xab1f('0x24')](handleEntityNotFound(_0x4aade2,null))[_0xab1f('0x24')](removeEntity(_0x4aade2,null))['catch'](handleError(_0x4aade2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 62c4a7d..83333f2 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 _0x71fe=['moment','bluebird','path','rimraf','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2e7eb5,_0x234560){var _0x401a31=function(_0x3710fe){while(--_0x3710fe){_0x2e7eb5['push'](_0x2e7eb5['shift']());}};_0x401a31(++_0x234560);}(_0x71fe,0x98));var _0xe71f=function(_0x4a27a9,_0x3e6a4d){_0x4a27a9=_0x4a27a9-0x0;var _0x58dc91=_0x71fe[_0x4a27a9];return _0x58dc91;};'use strict';var _=require(_0xe71f('0x0'));var util=require(_0xe71f('0x1'));var logger=require(_0xe71f('0x2'))(_0xe71f('0x3'));var moment=require(_0xe71f('0x4'));var BPromise=require(_0xe71f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe71f('0x6'));var rimraf=require(_0xe71f('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0xe71f('0x8')]=function(_0x1d3172,_0x1b8167){return _0x1d3172[_0xe71f('0x9')]('FaxApplication',attributes,{'tableName':_0xe71f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe71f('0xb'),'collate':_0xe71f('0xc')});}; \ No newline at end of file +var _0x42a1=['moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0xe10df3,_0x4195aa){var _0x3860e7=function(_0x500c87){while(--_0x500c87){_0xe10df3['push'](_0xe10df3['shift']());}};_0x3860e7(++_0x4195aa);}(_0x42a1,0x7b));var _0x142a=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x42a1[_0x490be3];return _0x3f5140;};'use strict';var _=require(_0x142a('0x0'));var util=require('util');var logger=require(_0x142a('0x1'))(_0x142a('0x2'));var moment=require(_0x142a('0x3'));var BPromise=require(_0x142a('0x4'));var rp=require(_0x142a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x142a('0x6'));var config=require(_0x142a('0x7'));var attributes=require(_0x142a('0x8'));module[_0x142a('0x9')]=function(_0x451c6f,_0xd18310){return _0x451c6f[_0x142a('0xa')]('FaxApplication',attributes,{'tableName':_0x142a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x142a('0xc'),'collate':_0x142a('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 35954a9..c48caf5 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 _0x03f2=['attributes','limit','UpdateFaxApplication','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','result','catch','update','body','options'];(function(_0x51ede4,_0x56feb7){var _0x19f452=function(_0x4f56cc){while(--_0x4f56cc){_0x51ede4['push'](_0x51ede4['shift']());}};_0x19f452(++_0x56feb7);}(_0x03f2,0x154));var _0x203f=function(_0x596155,_0x17ade6){_0x596155=_0x596155-0x0;var _0x49feb2=_0x03f2[_0x596155];return _0x49feb2;};'use strict';var _=require('lodash');var util=require(_0x203f('0x0'));var moment=require('moment');var BPromise=require(_0x203f('0x1'));var rs=require(_0x203f('0x2'));var fs=require('fs');var Redis=require(_0x203f('0x3'));var db=require(_0x203f('0x4'))['db'];var utils=require(_0x203f('0x5'));var logger=require(_0x203f('0x6'))(_0x203f('0x7'));var config=require(_0x203f('0x8'));var jayson=require(_0x203f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55b759,_0x3cc757,_0x8943a5){return new BPromise(function(_0x145fe0,_0x8decf8){return client[_0x203f('0xa')](_0x55b759,_0x8943a5)[_0x203f('0xb')](function(_0x12aed0){logger[_0x203f('0xc')]('FaxApplication,\x20%s,\x20%s',_0x3cc757,_0x203f('0xd'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3cc757,_0x203f('0xd'),JSON[_0x203f('0xe')](_0x12aed0));if(_0x12aed0[_0x203f('0xf')]){if(_0x12aed0[_0x203f('0xf')][_0x203f('0x10')]===0x1f4){logger[_0x203f('0xf')]('FaxApplication,\x20%s,\x20%s',_0x3cc757,_0x12aed0[_0x203f('0xf')][_0x203f('0x11')]);return _0x8decf8(_0x12aed0[_0x203f('0xf')][_0x203f('0x11')]);}logger[_0x203f('0xf')](_0x203f('0x12'),_0x3cc757,_0x12aed0[_0x203f('0xf')]['message']);return _0x145fe0(_0x12aed0['error']['message']);}else{logger[_0x203f('0xc')](_0x203f('0x12'),_0x3cc757,_0x203f('0xd'));_0x145fe0(_0x12aed0[_0x203f('0x13')][_0x203f('0x11')]);}})[_0x203f('0x14')](function(_0x5e953b){logger[_0x203f('0xf')](_0x203f('0x12'),_0x3cc757,_0x5e953b);_0x8decf8(_0x5e953b);});});}exports['UpdateFaxApplication']=function(_0x17b272){var _0x2ea0f9=this;return new Promise(function(_0x1b20fd,_0x47dd6b){return db['FaxApplication'][_0x203f('0x15')](_0x17b272[_0x203f('0x16')],{'raw':_0x17b272[_0x203f('0x17')]?_0x17b272[_0x203f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17b272[_0x203f('0x17')]?_0x17b272[_0x203f('0x17')]['where']||null:null,'attributes':_0x17b272[_0x203f('0x17')]?_0x17b272[_0x203f('0x17')][_0x203f('0x18')]||null:null,'limit':_0x17b272[_0x203f('0x17')]?_0x17b272[_0x203f('0x17')][_0x203f('0x19')]||null:null})[_0x203f('0xb')](function(_0x3d68d9){logger['info'](_0x203f('0x1a'),_0x17b272);logger[_0x203f('0x1b')]('UpdateFaxApplication',_0x17b272,JSON[_0x203f('0xe')](_0x3d68d9));_0x1b20fd(_0x3d68d9);})[_0x203f('0x14')](function(_0x2c8bad){logger[_0x203f('0xf')](_0x203f('0x1a'),_0x2c8bad[_0x203f('0x11')],_0x17b272);_0x47dd6b(_0x2ea0f9[_0x203f('0xf')](0x1f4,_0x2c8bad[_0x203f('0x11')]));});});}; \ No newline at end of file +var _0x0b03=['FaxApplication','update','body','options','raw','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxApplication,\x20%s,\x20%s','result','catch','UpdateFaxApplication'];(function(_0x19f7b0,_0x291ae9){var _0x1eff48=function(_0x3cf92d){while(--_0x3cf92d){_0x19f7b0['push'](_0x19f7b0['shift']());}};_0x1eff48(++_0x291ae9);}(_0x0b03,0x19a));var _0x30b0=function(_0x5b54ea,_0x825561){_0x5b54ea=_0x5b54ea-0x0;var _0x58b448=_0x0b03[_0x5b54ea];return _0x58b448;};'use strict';var _=require(_0x30b0('0x0'));var util=require(_0x30b0('0x1'));var moment=require(_0x30b0('0x2'));var BPromise=require(_0x30b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30b0('0x4'));var db=require(_0x30b0('0x5'))['db'];var utils=require(_0x30b0('0x6'));var logger=require(_0x30b0('0x7'))(_0x30b0('0x8'));var config=require(_0x30b0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x30b0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17a96d,_0x1f879c,_0x16890a){return new BPromise(function(_0x457f78,_0x250e74){return client[_0x30b0('0xb')](_0x17a96d,_0x16890a)[_0x30b0('0xc')](function(_0xc6ee0a){logger[_0x30b0('0xd')]('FaxApplication,\x20%s,\x20%s',_0x1f879c,_0x30b0('0xe'));logger[_0x30b0('0xf')](_0x30b0('0x10'),_0x1f879c,_0x30b0('0xe'),JSON[_0x30b0('0x11')](_0xc6ee0a));if(_0xc6ee0a[_0x30b0('0x12')]){if(_0xc6ee0a[_0x30b0('0x12')]['code']===0x1f4){logger[_0x30b0('0x12')]('FaxApplication,\x20%s,\x20%s',_0x1f879c,_0xc6ee0a['error']['message']);return _0x250e74(_0xc6ee0a['error']['message']);}logger[_0x30b0('0x12')]('FaxApplication,\x20%s,\x20%s',_0x1f879c,_0xc6ee0a[_0x30b0('0x12')][_0x30b0('0x13')]);return _0x457f78(_0xc6ee0a[_0x30b0('0x12')][_0x30b0('0x13')]);}else{logger[_0x30b0('0xd')](_0x30b0('0x14'),_0x1f879c,'request\x20sent');_0x457f78(_0xc6ee0a[_0x30b0('0x15')][_0x30b0('0x13')]);}})[_0x30b0('0x16')](function(_0x1f139e){logger[_0x30b0('0x12')](_0x30b0('0x14'),_0x1f879c,_0x1f139e);_0x250e74(_0x1f139e);});});}exports[_0x30b0('0x17')]=function(_0x6a8e79){var _0x3a2722=this;return new Promise(function(_0x397896,_0x15ede9){return db[_0x30b0('0x18')][_0x30b0('0x19')](_0x6a8e79[_0x30b0('0x1a')],{'raw':_0x6a8e79['options']?_0x6a8e79[_0x30b0('0x1b')][_0x30b0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a8e79[_0x30b0('0x1b')]?_0x6a8e79[_0x30b0('0x1b')]['where']||null:null,'attributes':_0x6a8e79[_0x30b0('0x1b')]?_0x6a8e79[_0x30b0('0x1b')][_0x30b0('0x1d')]||null:null,'limit':_0x6a8e79['options']?_0x6a8e79[_0x30b0('0x1b')][_0x30b0('0x1e')]||null:null})[_0x30b0('0xc')](function(_0x5b3fee){logger[_0x30b0('0xd')](_0x30b0('0x17'),_0x6a8e79);logger[_0x30b0('0xf')](_0x30b0('0x17'),_0x6a8e79,JSON[_0x30b0('0x11')](_0x5b3fee));_0x397896(_0x5b3fee);})[_0x30b0('0x16')](function(_0x290e7c){logger[_0x30b0('0x12')]('UpdateFaxApplication',_0x290e7c['message'],_0x6a8e79);_0x15ede9(_0x3a2722[_0x30b0('0x12')](0x1f4,_0x290e7c[_0x30b0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 223c063..21c0202 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','express'];(function(_0x287b9a,_0x2d1557){var _0x296702=function(_0x538a65){while(--_0x538a65){_0x287b9a['push'](_0x287b9a['shift']());}};_0x296702(++_0x2d1557);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x538fd3,_0x5d8f5b){_0x538fd3=_0x538fd3-0x0;var _0x1a0f97=_0xdd4f[_0x538fd3];return _0x1a0f97;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./faxApplication.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['post']('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')]('/:id',auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0xd')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x23cbbd,_0xfe1549){var _0x4c7684=function(_0x594aa5){while(--_0x594aa5){_0x23cbbd['push'](_0x23cbbd['shift']());}};_0x4c7684(++_0xfe1549);}(_0x2032,0xd9));var _0x2203=function(_0xd8f3a1,_0x4f2db1){_0xd8f3a1=_0xd8f3a1-0x0;var _0x3353fc=_0x2032[_0xd8f3a1];return _0x3353fc;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d285a3b..6767907 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 _0x8aad=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0xfdd3f8,_0x3e9680){var _0x190eed=function(_0x227165){while(--_0x227165){_0xfdd3f8['push'](_0xfdd3f8['shift']());}};_0x190eed(++_0x3e9680);}(_0x8aad,0x146));var _0xd8aa=function(_0x1a666b,_0x3290e3){_0x1a666b=_0x1a666b-0x0;var _0x43c6e8=_0x8aad[_0x1a666b];return _0x43c6e8;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8aa('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xd8aa('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd8aa('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd8aa('0x4')]('in',_0xd8aa('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc6ac=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x5bb3a1,_0x447385){var _0x86fb1c=function(_0x171d7e){while(--_0x171d7e){_0x5bb3a1['push'](_0x5bb3a1['shift']());}};_0x86fb1c(++_0x447385);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x22bd1d,_0xa8fb29){_0x22bd1d=_0x22bd1d-0x0;var _0x496cee=_0xc6ac[_0x22bd1d];return _0x496cee;};'use strict';var Sequelize=require(_0xcc6a('0x0'));module[_0xcc6a('0x1')]={'closed':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcc6a('0x3')]},'disposition':{'type':Sequelize[_0xcc6a('0x4')]},'secondDisposition':{'type':Sequelize[_0xcc6a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcc6a('0x4')]},'note':{'type':Sequelize[_0xcc6a('0x4')]},'read1stAt':{'type':Sequelize[_0xcc6a('0x3')]},'fax':{'type':Sequelize[_0xcc6a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xcc6a('0x5')]('in',_0xcc6a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcc6a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xcc6a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xcc6a('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b7fe440..d5d23ba 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 _0xbed8=['faxInteractionTags:save','removeTags','download','unix','join','root','tmp','files','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','error','name','send','FaxInteraction','fieldName','type','key','findAll','fax','query','user','catch','show','rawAttributes','keys','filters','intersection','model','fields','attributes','length','include','merge','options','create','body','params','find','describe','FaxMessage','addMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','includeAll','rows','addTags','setTags','omit','spread','Tag','color','emit'];(function(_0x1622a0,_0x2b55a9){var _0x2a2308=function(_0x38d05b){while(--_0x38d05b){_0x1622a0['push'](_0x1622a0['shift']());}};_0x2a2308(++_0x2b55a9);}(_0xbed8,0xeb));var _0x8bed=function(_0xbe048b,_0x2f8970){_0xbe048b=_0xbe048b-0x0;var _0x1d9099=_0xbed8[_0xbe048b];return _0x1d9099;};'use strict';var rimraf=require(_0x8bed('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8bed('0x1'));var BPromise=require(_0x8bed('0x2'));var util=require(_0x8bed('0x3'));var path=require(_0x8bed('0x4'));var fs=require('fs');var _=require(_0x8bed('0x5'));var Redis=require(_0x8bed('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x8bed('0x7'))(_0x8bed('0x8'));var config=require(_0x8bed('0x9'));var db=require(_0x8bed('0xa'))['db'];config['redis']=_[_0x8bed('0xb')](config[_0x8bed('0xc')],{'host':_0x8bed('0xd'),'port':0x18eb});var socket=require(_0x8bed('0xe'))(new Redis(config[_0x8bed('0xc')]));require(_0x8bed('0xf'))[_0x8bed('0x10')](socket);function respondWithStatusCode(_0x2cdb68,_0x21759e){_0x21759e=_0x21759e||0xcc;return function(_0x46b15c){if(_0x46b15c){return _0x2cdb68[_0x8bed('0x11')](_0x21759e);}return _0x2cdb68['status'](_0x21759e)[_0x8bed('0x12')]();};}function respondWithResult(_0x7008dd,_0x3d782e){_0x3d782e=_0x3d782e||0xc8;return function(_0x65093c){if(_0x65093c){return _0x7008dd['status'](_0x3d782e)[_0x8bed('0x13')](_0x65093c);}};}function respondWithFilteredResult(_0x5485e5,_0x55f806){return function(_0x27a2cf){if(_0x27a2cf){var _0x30cb61=typeof _0x55f806[_0x8bed('0x14')]===_0x8bed('0x15')&&typeof _0x55f806[_0x8bed('0x16')]===_0x8bed('0x15');var _0x5da27d=_0x27a2cf[_0x8bed('0x17')];var _0x3a40d3=_0x30cb61?0x0:_0x55f806[_0x8bed('0x14')];var _0x18304c=_0x30cb61?_0x27a2cf[_0x8bed('0x17')]:_0x55f806[_0x8bed('0x14')]+_0x55f806[_0x8bed('0x16')];var _0x4d10ef;if(_0x18304c>=_0x5da27d){_0x18304c=_0x5da27d;_0x4d10ef=0xc8;}else{_0x4d10ef=0xce;}_0x5485e5[_0x8bed('0x18')](_0x4d10ef);return _0x5485e5[_0x8bed('0x19')](_0x8bed('0x1a'),_0x3a40d3+'-'+_0x18304c+'/'+_0x5da27d)[_0x8bed('0x13')](_0x27a2cf);}return null;};}function saveUpdates(_0x48f81a){return function(_0x5079d1){if(_0x5079d1){return _0x5079d1[_0x8bed('0x1b')](_0x48f81a)[_0x8bed('0x1c')](function(_0x211e2a){return _0x211e2a;});}return null;};}function removeEntity(_0x466577){return function(_0x1db101){if(_0x1db101){return _0x1db101[_0x8bed('0x1d')]()['then'](function(){_0x466577['status'](0xcc)[_0x8bed('0x12')]();});}};}function handleEntityNotFound(_0x25dcd0){return function(_0x419e15){if(!_0x419e15){_0x25dcd0[_0x8bed('0x11')](0x194);}return _0x419e15;};}function handleError(_0x5da6ea,_0x5065e0){_0x5065e0=_0x5065e0||0x1f4;return function(_0x268f10){logger[_0x8bed('0x1e')](_0x268f10['stack']);if(_0x268f10[_0x8bed('0x1f')]){delete _0x268f10[_0x8bed('0x1f')];}_0x5da6ea['status'](_0x5065e0)[_0x8bed('0x20')](_0x268f10);};}exports['index']=function(_0x1d7ca7,_0xc6c1c5){var _0x289b6c={};var _0x399c30=_['map'](db[_0x8bed('0x21')]['rawAttributes'],function(_0x2da034){return{'name':_0x2da034[_0x8bed('0x22')],'type':_0x2da034[_0x8bed('0x23')][_0x8bed('0x24')]};});_0x289b6c=qs['getOptions'](_0x399c30,_0x1d7ca7);return interaction[_0x8bed('0x25')](_0x8bed('0x26'),_0x1d7ca7[_0x8bed('0x27')],_0x1d7ca7[_0x8bed('0x28')],_0x289b6c,_0x399c30)['then'](respondWithFilteredResult(_0xc6c1c5,_0x289b6c))[_0x8bed('0x29')](handleError(_0xc6c1c5,null));};exports[_0x8bed('0x2a')]=function(_0x5a7799,_0x2c2893){var _0x3c9572={'raw':![],'where':{'id':_0x5a7799['params']['id']}},_0x3df087={};_0x3df087['model']=_['keys'](db[_0x8bed('0x21')][_0x8bed('0x2b')]);_0x3df087[_0x8bed('0x27')]=_[_0x8bed('0x2c')](_0x5a7799[_0x8bed('0x27')]);_0x3df087[_0x8bed('0x2d')]=_[_0x8bed('0x2e')](_0x3df087['model'],_0x3df087[_0x8bed('0x27')]);_0x3c9572['attributes']=_[_0x8bed('0x2e')](_0x3df087[_0x8bed('0x2f')],qs[_0x8bed('0x30')](_0x5a7799[_0x8bed('0x27')]['fields']));_0x3c9572[_0x8bed('0x31')]=_0x3c9572[_0x8bed('0x31')][_0x8bed('0x32')]?_0x3c9572[_0x8bed('0x31')]:_0x3df087[_0x8bed('0x2f')];if(_0x5a7799[_0x8bed('0x27')]['includeAll']){_0x3c9572[_0x8bed('0x33')]=[{'all':!![]}];}_0x3c9572=_[_0x8bed('0x34')]({},_0x3c9572,_0x5a7799[_0x8bed('0x35')]);return db[_0x8bed('0x21')]['find'](_0x3c9572)[_0x8bed('0x1c')](handleEntityNotFound(_0x2c2893,null))[_0x8bed('0x1c')](respondWithResult(_0x2c2893,null))[_0x8bed('0x29')](handleError(_0x2c2893,null));};exports[_0x8bed('0x36')]=function(_0x28d3b5,_0x5df22f){return db[_0x8bed('0x21')][_0x8bed('0x36')](_0x28d3b5[_0x8bed('0x37')],{})['then'](respondWithResult(_0x5df22f,0xc9))[_0x8bed('0x29')](handleError(_0x5df22f,null));};exports[_0x8bed('0x1b')]=function(_0xcad4a8,_0x39a629){if(_0xcad4a8[_0x8bed('0x37')]['id']){delete _0xcad4a8[_0x8bed('0x37')]['id'];}return db[_0x8bed('0x21')]['find']({'where':{'id':_0xcad4a8[_0x8bed('0x38')]['id']}})['then'](handleEntityNotFound(_0x39a629,null))[_0x8bed('0x1c')](saveUpdates(_0xcad4a8[_0x8bed('0x37')],null))[_0x8bed('0x1c')](respondWithResult(_0x39a629,null))[_0x8bed('0x29')](handleError(_0x39a629,null));};exports[_0x8bed('0x1d')]=function(_0x55193a,_0x57e49b){return db[_0x8bed('0x21')][_0x8bed('0x39')]({'where':{'id':_0x55193a[_0x8bed('0x38')]['id']}})[_0x8bed('0x1c')](handleEntityNotFound(_0x57e49b,null))['then'](removeEntity(_0x57e49b,null))['catch'](handleError(_0x57e49b,null));};exports[_0x8bed('0x3a')]=function(_0x57ab90,_0x3d1c96){return db['FaxInteraction'][_0x8bed('0x3a')]()[_0x8bed('0x1c')](respondWithResult(_0x3d1c96,null))[_0x8bed('0x29')](handleError(_0x3d1c96,null));};exports['addMessage']=function(_0x1781f2,_0x4dc25b){return db[_0x8bed('0x3b')][_0x8bed('0x39')]({'where':{'id':_0x1781f2[_0x8bed('0x38')]['id']}})[_0x8bed('0x1c')](handleEntityNotFound(_0x4dc25b,null))['then'](function(_0x265a29){if(_0x265a29){return _0x265a29[_0x8bed('0x3c')](_0x1781f2[_0x8bed('0x37')]['ids'],_['omit'](_0x1781f2[_0x8bed('0x37')],[_0x8bed('0x3d'),'id'])||{});}})[_0x8bed('0x1c')](respondWithResult(_0x4dc25b,null))[_0x8bed('0x29')](handleError(_0x4dc25b,null));};exports['getMessages']=function(_0x5af32a,_0x5869b9){var _0x38dd8f={'raw':![],'where':{}};var _0xb9a3e3={};var _0x404cc8={'count':0x0,'rows':[]};return db[_0x8bed('0x21')][_0x8bed('0x3e')]({'where':{'id':_0x5af32a[_0x8bed('0x38')]['id']}})[_0x8bed('0x1c')](handleEntityNotFound(_0x5869b9,null))[_0x8bed('0x1c')](function(_0x523da4){if(_0x523da4){_0xb9a3e3['model']=_[_0x8bed('0x2c')](db[_0x8bed('0x3b')][_0x8bed('0x2b')]);_0xb9a3e3[_0x8bed('0x27')]=_[_0x8bed('0x2c')](_0x5af32a[_0x8bed('0x27')]);_0xb9a3e3['filters']=_[_0x8bed('0x2e')](_0xb9a3e3[_0x8bed('0x2f')],_0xb9a3e3['query']);_0x38dd8f['attributes']=_[_0x8bed('0x2e')](_0xb9a3e3[_0x8bed('0x2f')],qs[_0x8bed('0x30')](_0x5af32a[_0x8bed('0x27')][_0x8bed('0x30')]));_0x38dd8f[_0x8bed('0x31')]=_0x38dd8f[_0x8bed('0x31')][_0x8bed('0x32')]?_0x38dd8f[_0x8bed('0x31')]:_0xb9a3e3[_0x8bed('0x2f')];if(!_0x5af32a[_0x8bed('0x27')][_0x8bed('0x3f')](_0x8bed('0x40'))){_0x38dd8f[_0x8bed('0x16')]=qs[_0x8bed('0x16')](_0x5af32a[_0x8bed('0x27')][_0x8bed('0x16')]);_0x38dd8f[_0x8bed('0x14')]=qs['offset'](_0x5af32a[_0x8bed('0x27')][_0x8bed('0x14')]);}_0x38dd8f[_0x8bed('0x41')]=qs[_0x8bed('0x42')](_0x5af32a[_0x8bed('0x27')][_0x8bed('0x42')]);_0x38dd8f[_0x8bed('0x43')]=qs[_0x8bed('0x2d')](_[_0x8bed('0x44')](_0x5af32a[_0x8bed('0x27')],_0xb9a3e3[_0x8bed('0x2d')]));_0x38dd8f['where']['FaxInteractionId']=_0x523da4['id'];if(_0x5af32a[_0x8bed('0x27')][_0x8bed('0x45')]){_0x38dd8f[_0x8bed('0x43')]=_[_0x8bed('0x34')](_0x38dd8f['where'],{'$or':_['map'](_0x38dd8f['attributes'],function(_0x263906){var _0x41834={};_0x41834[_0x263906]={'$like':'%'+_0x5af32a[_0x8bed('0x27')][_0x8bed('0x45')]+'%'};return _0x41834;})});}if(_0x5af32a['query'][_0x8bed('0x46')]){var _0x41efe5=_0x5af32a[_0x8bed('0x27')]['$gte']['split'](',');var _0x453781={};_0x453781[_0x41efe5[0x0]]={'$gte':moment(_0x41efe5[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x38dd8f[_0x8bed('0x43')]=_['merge'](_0x38dd8f[_0x8bed('0x43')],_0x453781);}_0x38dd8f=_['merge']({},_0x38dd8f,_0x5af32a[_0x8bed('0x35')]);return db['FaxMessage']['count']({'where':_0x38dd8f[_0x8bed('0x43')]})[_0x8bed('0x1c')](function(_0x2edb37){_0x404cc8['count']=_0x2edb37;if(_0x5af32a[_0x8bed('0x27')][_0x8bed('0x47')]){_0x38dd8f[_0x8bed('0x33')]=[{'all':!![]}];}return db['FaxMessage'][_0x8bed('0x25')](_0x38dd8f);})['then'](function(_0x4072ca){_0x404cc8[_0x8bed('0x48')]=_0x4072ca;return _0x404cc8;});}})[_0x8bed('0x1c')](respondWithFilteredResult(_0x5869b9,_0x38dd8f))[_0x8bed('0x29')](handleError(_0x5869b9,null));};exports[_0x8bed('0x49')]=function(_0x4af697,_0x273958){return db[_0x8bed('0x21')][_0x8bed('0x39')]({'where':{'id':_0x4af697[_0x8bed('0x38')]['id']}})['then'](handleEntityNotFound(_0x273958,null))['then'](function(_0x1bcd41){if(_0x1bcd41){return _0x1bcd41[_0x8bed('0x4a')](_0x4af697[_0x8bed('0x37')][_0x8bed('0x3d')],_[_0x8bed('0x4b')](_0x4af697[_0x8bed('0x37')],['ids','id'])||{})[_0x8bed('0x4c')](function(){return db[_0x8bed('0x4d')][_0x8bed('0x25')]({'attributes':['id',_0x8bed('0x1f'),_0x8bed('0x4e')],'where':{'id':_0x4af697[_0x8bed('0x37')][_0x8bed('0x3d')]}});})[_0x8bed('0x1c')](function(_0x312deb){socket[_0x8bed('0x4f')](_0x8bed('0x50'),{'id':Number(_0x4af697[_0x8bed('0x38')]['id']),'tags':_0x312deb||[]});return{'id':Number(_0x4af697[_0x8bed('0x38')]['id']),'tags':_0x312deb||[]};});}})[_0x8bed('0x1c')](respondWithResult(_0x273958,null))[_0x8bed('0x29')](handleError(_0x273958,null));};exports[_0x8bed('0x51')]=function(_0x213ae2,_0x396d78){return db[_0x8bed('0x21')]['find']({'where':{'id':_0x213ae2['params']['id']}})[_0x8bed('0x1c')](handleEntityNotFound(_0x396d78,null))[_0x8bed('0x1c')](function(_0x3bf733){if(_0x3bf733){return _0x3bf733[_0x8bed('0x51')](_0x213ae2[_0x8bed('0x27')][_0x8bed('0x3d')]);}})['then'](respondWithStatusCode(_0x396d78,null))['catch'](handleError(_0x396d78,null));};exports[_0x8bed('0x52')]=function(_0x41f11d,_0xc1e58e){var _0x536960=moment()[_0x8bed('0x53')]()['toString']();var _0x374a8d=path[_0x8bed('0x54')](config[_0x8bed('0x55')],'server','files',_0x8bed('0x56'));var _0x1b70eb=path[_0x8bed('0x54')](config[_0x8bed('0x55')],'server',_0x8bed('0x57'),_0x8bed('0x58'));var _0x2b08a8=path['join'](_0x374a8d,_0x536960);var _0xf57cdb=util[_0x8bed('0x59')](_0x8bed('0x5a'),_0x41f11d[_0x8bed('0x38')]['id'],_0x536960);var _0x30d9a1=path[_0x8bed('0x54')](_0x374a8d,_0xf57cdb);var _0x52e38b=[];_0x52e38b[_0x8bed('0x5b')]({'model':db[_0x8bed('0x5c')],'as':_0x8bed('0x5c'),'raw':!![]});var _0x375031=[{'model':db[_0x8bed('0x3b')],'as':_0x8bed('0x5d'),'attributes':['id',_0x8bed('0x37'),_0x8bed('0x5e')],'include':_0x52e38b}];return db['FaxInteraction'][_0x8bed('0x39')]({'where':{'id':_0x41f11d[_0x8bed('0x38')]['id']},'include':_0x375031})[_0x8bed('0x1c')](handleEntityNotFound(_0xc1e58e,null))[_0x8bed('0x1c')](function(_0x31a341){if(_0x31a341&&_0x31a341[_0x8bed('0x5d')]){var _0x542070=_0x31a341[_0x8bed('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x2b08a8);for(var _0x1d926f=0x0;_0x1d926f<_0x542070[_0x8bed('0x5d')][_0x8bed('0x32')];_0x1d926f++){var _0x4a6e48=_0x542070['Messages'][_0x1d926f][_0x8bed('0x5c')];if(_0x4a6e48){var _0x350d76=path[_0x8bed('0x54')](_0x1b70eb,_0x4a6e48[_0x8bed('0x60')]);if(fs[_0x8bed('0x61')](_0x350d76)){fs[_0x8bed('0x62')](_0x350d76)[_0x8bed('0x63')](fs[_0x8bed('0x64')](path[_0x8bed('0x54')](_0x2b08a8,_0x4a6e48['basename'])));}}}return BPromise[_0x8bed('0x65')]()['then'](function(){return new BPromise(function(_0x4c4742,_0x30aba1){zipdir(_0x2b08a8,{'saveTo':_0x30d9a1},function(_0x5af1d5,_0x4a3374){if(_0x5af1d5)return _0x30aba1(_0x5af1d5);return _0x4c4742(_0x4a3374);});})['then'](function(){return new BPromise(function(_0x58eeb4,_0x5c8cd7){rimraf(_0x2b08a8,function(_0x55dccc){if(_0x55dccc)_0x5c8cd7(_0x55dccc);return _0x58eeb4();});});})[_0x8bed('0x1c')](function(){return _0xc1e58e[_0x8bed('0x52')](_0x30d9a1,_0xf57cdb,function(_0x54ebaf){if(_0x54ebaf){console[_0x8bed('0x66')](_0x8bed('0x67'),_0x54ebaf);}else{fs[_0x8bed('0x68')](_0x30d9a1);}});});});}else{return _0xc1e58e['sendStatus'](0xc8);}})[_0x8bed('0x29')](handleError(_0xc1e58e,null));}; \ No newline at end of file +var _0xe389=['err','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','count','Content-Range','then','sendStatus','stack','name','send','index','map','FaxInteraction','fieldName','type','key','getOptions','findAll','fax','user','catch','params','keys','query','intersection','model','attributes','length','includeAll','include','merge','options','find','create','body','update','destroy','describe','addMessage','FaxMessage','ids','omit','findOne','rawAttributes','filters','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','log'];(function(_0x492d77,_0x22c312){var _0x5e4980=function(_0x6b8304){while(--_0x6b8304){_0x492d77['push'](_0x492d77['shift']());}};_0x5e4980(++_0x22c312);}(_0xe389,0x148));var _0x9e38=function(_0x39ecaf,_0x32c974){_0x39ecaf=_0x39ecaf-0x0;var _0x37e95b=_0xe389[_0x39ecaf];return _0x37e95b;};'use strict';var rimraf=require(_0x9e38('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9e38('0x1'));var BPromise=require(_0x9e38('0x2'));var util=require(_0x9e38('0x3'));var path=require(_0x9e38('0x4'));var fs=require('fs');var _=require(_0x9e38('0x5'));var Redis=require(_0x9e38('0x6'));var interaction=require(_0x9e38('0x7'));var qs=require(_0x9e38('0x8'));var logger=require('../../config/logger')(_0x9e38('0x9'));var config=require(_0x9e38('0xa'));var db=require(_0x9e38('0xb'))['db'];config[_0x9e38('0xc')]=_['defaults'](config[_0x9e38('0xc')],{'host':_0x9e38('0xd'),'port':0x18eb});var socket=require(_0x9e38('0xe'))(new Redis(config[_0x9e38('0xc')]));require(_0x9e38('0xf'))[_0x9e38('0x10')](socket);function respondWithStatusCode(_0x5c0d57,_0x1968d3){_0x1968d3=_0x1968d3||0xcc;return function(_0x4f0618){if(_0x4f0618){return _0x5c0d57['sendStatus'](_0x1968d3);}return _0x5c0d57[_0x9e38('0x11')](_0x1968d3)[_0x9e38('0x12')]();};}function respondWithResult(_0x83ef8a,_0x3eb46a){_0x3eb46a=_0x3eb46a||0xc8;return function(_0x49d4d4){if(_0x49d4d4){return _0x83ef8a[_0x9e38('0x11')](_0x3eb46a)[_0x9e38('0x13')](_0x49d4d4);}};}function respondWithFilteredResult(_0x4a295f,_0x27f535){return function(_0x491d8c){if(_0x491d8c){var _0xeddbc7=typeof _0x27f535[_0x9e38('0x14')]===_0x9e38('0x15')&&typeof _0x27f535['limit']===_0x9e38('0x15');var _0x3a7d3c=_0x491d8c[_0x9e38('0x16')];var _0x40851d=_0xeddbc7?0x0:_0x27f535[_0x9e38('0x14')];var _0x1ee7fd=_0xeddbc7?_0x491d8c[_0x9e38('0x16')]:_0x27f535[_0x9e38('0x14')]+_0x27f535['limit'];var _0x2d98b6;if(_0x1ee7fd>=_0x3a7d3c){_0x1ee7fd=_0x3a7d3c;_0x2d98b6=0xc8;}else{_0x2d98b6=0xce;}_0x4a295f[_0x9e38('0x11')](_0x2d98b6);return _0x4a295f['set'](_0x9e38('0x17'),_0x40851d+'-'+_0x1ee7fd+'/'+_0x3a7d3c)['json'](_0x491d8c);}return null;};}function saveUpdates(_0x4f246d){return function(_0x1d1951){if(_0x1d1951){return _0x1d1951['update'](_0x4f246d)['then'](function(_0x365aa2){return _0x365aa2;});}return null;};}function removeEntity(_0x19e5d5){return function(_0xcb22ff){if(_0xcb22ff){return _0xcb22ff['destroy']()[_0x9e38('0x18')](function(){_0x19e5d5[_0x9e38('0x11')](0xcc)[_0x9e38('0x12')]();});}};}function handleEntityNotFound(_0x1bc03f){return function(_0x1957e9){if(!_0x1957e9){_0x1bc03f[_0x9e38('0x19')](0x194);}return _0x1957e9;};}function handleError(_0x46a13c,_0x3e6862){_0x3e6862=_0x3e6862||0x1f4;return function(_0x56f10d){logger['error'](_0x56f10d[_0x9e38('0x1a')]);if(_0x56f10d[_0x9e38('0x1b')]){delete _0x56f10d[_0x9e38('0x1b')];}_0x46a13c['status'](_0x3e6862)[_0x9e38('0x1c')](_0x56f10d);};}exports[_0x9e38('0x1d')]=function(_0xcc2bb0,_0x5c25a5){var _0x216cf9={};var _0xdce958=_[_0x9e38('0x1e')](db[_0x9e38('0x1f')]['rawAttributes'],function(_0x2c9adc){return{'name':_0x2c9adc[_0x9e38('0x20')],'type':_0x2c9adc[_0x9e38('0x21')][_0x9e38('0x22')]};});_0x216cf9=qs[_0x9e38('0x23')](_0xdce958,_0xcc2bb0);return interaction[_0x9e38('0x24')](_0x9e38('0x25'),_0xcc2bb0['query'],_0xcc2bb0[_0x9e38('0x26')],_0x216cf9,_0xdce958)[_0x9e38('0x18')](respondWithFilteredResult(_0x5c25a5,_0x216cf9))[_0x9e38('0x27')](handleError(_0x5c25a5,null));};exports['show']=function(_0x226562,_0x597bbc){var _0x443ecb={'raw':![],'where':{'id':_0x226562[_0x9e38('0x28')]['id']}},_0x22e936={};_0x22e936['model']=_[_0x9e38('0x29')](db[_0x9e38('0x1f')]['rawAttributes']);_0x22e936['query']=_[_0x9e38('0x29')](_0x226562[_0x9e38('0x2a')]);_0x22e936['filters']=_[_0x9e38('0x2b')](_0x22e936[_0x9e38('0x2c')],_0x22e936[_0x9e38('0x2a')]);_0x443ecb[_0x9e38('0x2d')]=_[_0x9e38('0x2b')](_0x22e936[_0x9e38('0x2c')],qs['fields'](_0x226562['query']['fields']));_0x443ecb[_0x9e38('0x2d')]=_0x443ecb[_0x9e38('0x2d')][_0x9e38('0x2e')]?_0x443ecb[_0x9e38('0x2d')]:_0x22e936[_0x9e38('0x2c')];if(_0x226562[_0x9e38('0x2a')][_0x9e38('0x2f')]){_0x443ecb[_0x9e38('0x30')]=[{'all':!![]}];}_0x443ecb=_[_0x9e38('0x31')]({},_0x443ecb,_0x226562[_0x9e38('0x32')]);return db['FaxInteraction'][_0x9e38('0x33')](_0x443ecb)['then'](handleEntityNotFound(_0x597bbc,null))[_0x9e38('0x18')](respondWithResult(_0x597bbc,null))[_0x9e38('0x27')](handleError(_0x597bbc,null));};exports[_0x9e38('0x34')]=function(_0x49ac1b,_0x1ba679){return db[_0x9e38('0x1f')]['create'](_0x49ac1b[_0x9e38('0x35')],{})[_0x9e38('0x18')](respondWithResult(_0x1ba679,0xc9))[_0x9e38('0x27')](handleError(_0x1ba679,null));};exports[_0x9e38('0x36')]=function(_0x2d8c90,_0x2addb6){if(_0x2d8c90[_0x9e38('0x35')]['id']){delete _0x2d8c90['body']['id'];}return db[_0x9e38('0x1f')][_0x9e38('0x33')]({'where':{'id':_0x2d8c90[_0x9e38('0x28')]['id']}})[_0x9e38('0x18')](handleEntityNotFound(_0x2addb6,null))[_0x9e38('0x18')](saveUpdates(_0x2d8c90[_0x9e38('0x35')],null))[_0x9e38('0x18')](respondWithResult(_0x2addb6,null))[_0x9e38('0x27')](handleError(_0x2addb6,null));};exports[_0x9e38('0x37')]=function(_0x1a039d,_0x3fc433){return db[_0x9e38('0x1f')]['find']({'where':{'id':_0x1a039d[_0x9e38('0x28')]['id']}})['then'](handleEntityNotFound(_0x3fc433,null))[_0x9e38('0x18')](removeEntity(_0x3fc433,null))[_0x9e38('0x27')](handleError(_0x3fc433,null));};exports[_0x9e38('0x38')]=function(_0x29acdc,_0x58af05){return db['FaxInteraction'][_0x9e38('0x38')]()[_0x9e38('0x18')](respondWithResult(_0x58af05,null))[_0x9e38('0x27')](handleError(_0x58af05,null));};exports[_0x9e38('0x39')]=function(_0x247d1b,_0x5599c8){return db[_0x9e38('0x3a')]['find']({'where':{'id':_0x247d1b[_0x9e38('0x28')]['id']}})[_0x9e38('0x18')](handleEntityNotFound(_0x5599c8,null))[_0x9e38('0x18')](function(_0x26e582){if(_0x26e582){return _0x26e582['addMessage'](_0x247d1b['body'][_0x9e38('0x3b')],_[_0x9e38('0x3c')](_0x247d1b['body'],[_0x9e38('0x3b'),'id'])||{});}})[_0x9e38('0x18')](respondWithResult(_0x5599c8,null))[_0x9e38('0x27')](handleError(_0x5599c8,null));};exports['getMessages']=function(_0x1e3406,_0x2a22a0){var _0x1ebe77={'raw':![],'where':{}};var _0x3e5e2c={};var _0x1ee366={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x9e38('0x3d')]({'where':{'id':_0x1e3406[_0x9e38('0x28')]['id']}})[_0x9e38('0x18')](handleEntityNotFound(_0x2a22a0,null))[_0x9e38('0x18')](function(_0x511d25){if(_0x511d25){_0x3e5e2c['model']=_[_0x9e38('0x29')](db[_0x9e38('0x3a')][_0x9e38('0x3e')]);_0x3e5e2c[_0x9e38('0x2a')]=_['keys'](_0x1e3406[_0x9e38('0x2a')]);_0x3e5e2c[_0x9e38('0x3f')]=_[_0x9e38('0x2b')](_0x3e5e2c[_0x9e38('0x2c')],_0x3e5e2c[_0x9e38('0x2a')]);_0x1ebe77['attributes']=_[_0x9e38('0x2b')](_0x3e5e2c[_0x9e38('0x2c')],qs[_0x9e38('0x40')](_0x1e3406[_0x9e38('0x2a')][_0x9e38('0x40')]));_0x1ebe77[_0x9e38('0x2d')]=_0x1ebe77['attributes'][_0x9e38('0x2e')]?_0x1ebe77[_0x9e38('0x2d')]:_0x3e5e2c[_0x9e38('0x2c')];if(!_0x1e3406[_0x9e38('0x2a')][_0x9e38('0x41')](_0x9e38('0x42'))){_0x1ebe77[_0x9e38('0x43')]=qs['limit'](_0x1e3406[_0x9e38('0x2a')][_0x9e38('0x43')]);_0x1ebe77['offset']=qs['offset'](_0x1e3406[_0x9e38('0x2a')]['offset']);}_0x1ebe77[_0x9e38('0x44')]=qs[_0x9e38('0x45')](_0x1e3406[_0x9e38('0x2a')][_0x9e38('0x45')]);_0x1ebe77[_0x9e38('0x46')]=qs[_0x9e38('0x3f')](_[_0x9e38('0x47')](_0x1e3406['query'],_0x3e5e2c[_0x9e38('0x3f')]));_0x1ebe77[_0x9e38('0x46')]['FaxInteractionId']=_0x511d25['id'];if(_0x1e3406['query'][_0x9e38('0x48')]){_0x1ebe77[_0x9e38('0x46')]=_[_0x9e38('0x31')](_0x1ebe77[_0x9e38('0x46')],{'$or':_[_0x9e38('0x1e')](_0x1ebe77[_0x9e38('0x2d')],function(_0x37931f){var _0x5a067b={};_0x5a067b[_0x37931f]={'$like':'%'+_0x1e3406[_0x9e38('0x2a')][_0x9e38('0x48')]+'%'};return _0x5a067b;})});}if(_0x1e3406[_0x9e38('0x2a')][_0x9e38('0x49')]){var _0x36645a=_0x1e3406[_0x9e38('0x2a')]['$gte'][_0x9e38('0x4a')](',');var _0x31fbe0={};_0x31fbe0[_0x36645a[0x0]]={'$gte':moment(_0x36645a[0x1])[_0x9e38('0x4b')](_0x9e38('0x4c'))};_0x1ebe77['where']=_[_0x9e38('0x31')](_0x1ebe77[_0x9e38('0x46')],_0x31fbe0);}_0x1ebe77=_[_0x9e38('0x31')]({},_0x1ebe77,_0x1e3406[_0x9e38('0x32')]);return db[_0x9e38('0x3a')][_0x9e38('0x16')]({'where':_0x1ebe77[_0x9e38('0x46')]})[_0x9e38('0x18')](function(_0x5866a2){_0x1ee366[_0x9e38('0x16')]=_0x5866a2;if(_0x1e3406[_0x9e38('0x2a')]['includeAll']){_0x1ebe77[_0x9e38('0x30')]=[{'all':!![]}];}return db['FaxMessage'][_0x9e38('0x24')](_0x1ebe77);})[_0x9e38('0x18')](function(_0x175cae){_0x1ee366[_0x9e38('0x4d')]=_0x175cae;return _0x1ee366;});}})[_0x9e38('0x18')](respondWithFilteredResult(_0x2a22a0,_0x1ebe77))['catch'](handleError(_0x2a22a0,null));};exports[_0x9e38('0x4e')]=function(_0x124d13,_0x28d24b){return db[_0x9e38('0x1f')][_0x9e38('0x33')]({'where':{'id':_0x124d13[_0x9e38('0x28')]['id']}})[_0x9e38('0x18')](handleEntityNotFound(_0x28d24b,null))[_0x9e38('0x18')](function(_0x363dac){if(_0x363dac){return _0x363dac[_0x9e38('0x4f')](_0x124d13[_0x9e38('0x35')][_0x9e38('0x3b')],_['omit'](_0x124d13[_0x9e38('0x35')],[_0x9e38('0x3b'),'id'])||{})[_0x9e38('0x50')](function(){return db[_0x9e38('0x51')][_0x9e38('0x24')]({'attributes':['id',_0x9e38('0x1b'),_0x9e38('0x52')],'where':{'id':_0x124d13[_0x9e38('0x35')][_0x9e38('0x3b')]}});})[_0x9e38('0x18')](function(_0x4fc200){socket[_0x9e38('0x53')](_0x9e38('0x54'),{'id':Number(_0x124d13['params']['id']),'tags':_0x4fc200||[]});return{'id':Number(_0x124d13[_0x9e38('0x28')]['id']),'tags':_0x4fc200||[]};});}})[_0x9e38('0x18')](respondWithResult(_0x28d24b,null))[_0x9e38('0x27')](handleError(_0x28d24b,null));};exports[_0x9e38('0x55')]=function(_0x114a0a,_0x454958){return db[_0x9e38('0x1f')][_0x9e38('0x33')]({'where':{'id':_0x114a0a[_0x9e38('0x28')]['id']}})[_0x9e38('0x18')](handleEntityNotFound(_0x454958,null))['then'](function(_0x3116d4){if(_0x3116d4){return _0x3116d4[_0x9e38('0x55')](_0x114a0a['query'][_0x9e38('0x3b')]);}})[_0x9e38('0x18')](respondWithStatusCode(_0x454958,null))[_0x9e38('0x27')](handleError(_0x454958,null));};exports[_0x9e38('0x56')]=function(_0x2522f5,_0x205689){var _0x2d1cc2=moment()[_0x9e38('0x57')]()[_0x9e38('0x58')]();var _0x2539f3=path[_0x9e38('0x59')](config[_0x9e38('0x5a')],'server',_0x9e38('0x5b'),_0x9e38('0x5c'));var _0x4d9642=path[_0x9e38('0x59')](config['root'],_0x9e38('0x5d'),_0x9e38('0x5b'),_0x9e38('0x5e'));var _0x5deda8=path[_0x9e38('0x59')](_0x2539f3,_0x2d1cc2);var _0x37bf33=util[_0x9e38('0x4b')](_0x9e38('0x5f'),_0x2522f5[_0x9e38('0x28')]['id'],_0x2d1cc2);var _0x36d72c=path[_0x9e38('0x59')](_0x2539f3,_0x37bf33);var _0x52a4db=[];_0x52a4db[_0x9e38('0x60')]({'model':db[_0x9e38('0x61')],'as':_0x9e38('0x61'),'raw':!![]});var _0x1ca3be=[{'model':db['FaxMessage'],'as':_0x9e38('0x62'),'attributes':['id','body',_0x9e38('0x63')],'include':_0x52a4db}];return db[_0x9e38('0x1f')]['find']({'where':{'id':_0x2522f5[_0x9e38('0x28')]['id']},'include':_0x1ca3be})['then'](handleEntityNotFound(_0x205689,null))[_0x9e38('0x18')](function(_0x156fd5){if(_0x156fd5&&_0x156fd5['Messages']){var _0x1dae03=_0x156fd5[_0x9e38('0x64')]({'plain':!![]});fs[_0x9e38('0x65')](_0x5deda8);for(var _0x481e6c=0x0;_0x481e6c<_0x1dae03[_0x9e38('0x62')]['length'];_0x481e6c++){var _0x517da3=_0x1dae03[_0x9e38('0x62')][_0x481e6c][_0x9e38('0x61')];if(_0x517da3){var _0x5676a2=path['join'](_0x4d9642,_0x517da3[_0x9e38('0x66')]);if(fs[_0x9e38('0x67')](_0x5676a2)){fs[_0x9e38('0x68')](_0x5676a2)['pipe'](fs[_0x9e38('0x69')](path[_0x9e38('0x59')](_0x5deda8,_0x517da3[_0x9e38('0x66')])));}}}return BPromise[_0x9e38('0x6a')]()[_0x9e38('0x18')](function(){return new BPromise(function(_0x58bc67,_0xa255b1){zipdir(_0x5deda8,{'saveTo':_0x36d72c},function(_0x117831,_0x4f193d){if(_0x117831)return _0xa255b1(_0x117831);return _0x58bc67(_0x4f193d);});})[_0x9e38('0x18')](function(){return new BPromise(function(_0x106168,_0x2f5b56){rimraf(_0x5deda8,function(_0x46f9d3){if(_0x46f9d3)_0x2f5b56(_0x46f9d3);return _0x106168();});});})[_0x9e38('0x18')](function(){return _0x205689[_0x9e38('0x56')](_0x36d72c,_0x37bf33,function(_0x5af42f){if(_0x5af42f){console[_0x9e38('0x6b')](_0x9e38('0x6c'),_0x5af42f);}else{fs['unlinkSync'](_0x36d72c);}});});});}else{return _0x205689[_0x9e38('0x19')](0xc8);}})[_0x9e38('0x27')](handleError(_0x205689,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 1a614b5..e36b58f 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 _0x400a=['length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','remove','then','setDataValue','Users','unreadMessages'];(function(_0xb440b2,_0x3e89c2){var _0x33dfe3=function(_0x4fd633){while(--_0x4fd633){_0xb440b2['push'](_0xb440b2['shift']());}};_0x33dfe3(++_0x3e89c2);}(_0x400a,0x122));var _0xa400=function(_0x4b8444,_0x3e420c){_0x4b8444=_0x4b8444-0x0;var _0x360749=_0x400a[_0x4b8444];return _0x360749;};'use strict';var EventEmitter=require(_0xa400('0x0'));var FaxInteraction=require(_0xa400('0x1'))['db'][_0xa400('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa400('0x3')](0x0);var events={'afterCreate':_0xa400('0x4'),'afterUpdate':'update','afterDestroy':_0xa400('0x5')};function emitEvent(_0x326137){return function(_0x1b3ed3,_0x5f34bd,_0x2087c6){_0x1b3ed3['getUsers']({'attributes':['id'],'raw':!![]})[_0xa400('0x6')](function(_0x4e32d1){_0x1b3ed3[_0xa400('0x7')](_0xa400('0x8'),_0x4e32d1['map'](function(_0x443005){return{'id':_0x443005['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1b3ed3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5ea203){_0x1b3ed3['setDataValue'](_0xa400('0x9'),_0x5ea203[_0xa400('0xa')]);FaxInteractionEvents[_0xa400('0xb')](_0x326137+':'+_0x1b3ed3['id'],_0x1b3ed3);FaxInteractionEvents[_0xa400('0xb')](_0x326137,_0x1b3ed3);_0x2087c6(null);})[_0xa400('0xc')](_0x2087c6(null));};}for(var e in events){if(events[_0xa400('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xa400('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x0cbc=['findAll','setDataValue','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','update','remove','getUsers','then','Users','map'];(function(_0x4c9ea4,_0x3ff94d){var _0x1aca33=function(_0x2644de){while(--_0x2644de){_0x4c9ea4['push'](_0x4c9ea4['shift']());}};_0x1aca33(++_0x3ff94d);}(_0x0cbc,0x1dc));var _0xc0cb=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x0cbc[_0x171fdc];return _0x3782ea;};'use strict';var EventEmitter=require(_0xc0cb('0x0'));var FaxInteraction=require(_0xc0cb('0x1'))['db'][_0xc0cb('0x2')];var FaxMessage=require(_0xc0cb('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc0cb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0cb('0x4'),'afterDestroy':_0xc0cb('0x5')};function emitEvent(_0x747685){return function(_0x2e27b9,_0x631879,_0x2b3967){_0x2e27b9[_0xc0cb('0x6')]({'attributes':['id'],'raw':!![]})[_0xc0cb('0x7')](function(_0x41d777){_0x2e27b9['setDataValue'](_0xc0cb('0x8'),_0x41d777[_0xc0cb('0x9')](function(_0x3c5227){return{'id':_0x3c5227['id']};}));return FaxMessage[_0xc0cb('0xa')]({'where':{'FaxInteractionId':_0x2e27b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc0cb('0x7')](function(_0x450c88){_0x2e27b9[_0xc0cb('0xb')](_0xc0cb('0xc'),_0x450c88[_0xc0cb('0xd')]);FaxInteractionEvents['emit'](_0x747685+':'+_0x2e27b9['id'],_0x2e27b9);FaxInteractionEvents[_0xc0cb('0xe')](_0x747685,_0x2e27b9);_0x2b3967(null);})[_0xc0cb('0xf')](_0x2b3967(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xc0cb('0x10')](e,emitEvent(event));}}module[_0xc0cb('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index f5b5b5c..cc466e2 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 _0xc00b=['FaxInteraction','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc00b,0x1e5));var _0xbc00=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xc00b[_0x55d8c5];return _0x225ae5;};'use strict';var _=require(_0xbc00('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbc00('0x1'));var BPromise=require('bluebird');var rp=require(_0xbc00('0x2'));var fs=require('fs');var path=require(_0xbc00('0x3'));var rimraf=require(_0xbc00('0x4'));var config=require(_0xbc00('0x5'));var attributes=require('./faxInteraction.attributes');module[_0xbc00('0x6')]=function(_0x5b47bf,_0x1cc85f){return _0x5b47bf['define'](_0xbc00('0x7'),attributes,{'tableName':_0xbc00('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x284270,_0x221909,_0x337870){if(_0x284270[_0xbc00('0x9')]('closed')){_0x284270[_0xbc00('0xa')]=moment()['format'](_0xbc00('0xb'));}_0x337870(null,_0x284270);}}});}; \ No newline at end of file +var _0x7818=['define','FaxInteraction','fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxInteraction.attributes','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7818,0x1c7));var _0x8781=function(_0xc91b54,_0x35808e){_0xc91b54=_0xc91b54-0x0;var _0x4c1309=_0x7818[_0xc91b54];return _0x4c1309;};'use strict';var _=require(_0x8781('0x0'));var util=require(_0x8781('0x1'));var logger=require(_0x8781('0x2'))(_0x8781('0x3'));var moment=require(_0x8781('0x4'));var BPromise=require(_0x8781('0x5'));var rp=require(_0x8781('0x6'));var fs=require('fs');var path=require(_0x8781('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8781('0x8'));module[_0x8781('0x9')]=function(_0xb2bade,_0x3b1dd2){return _0xb2bade[_0x8781('0xa')](_0x8781('0xb'),attributes,{'tableName':_0x8781('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e633c,_0xd8eac3,_0x14ccf2){if(_0x1e633c[_0x8781('0xd')]('closed')){_0x1e633c['closedAt']=moment()['format'](_0x8781('0xe'));}_0x14ccf2(null,_0x1e633c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 129a3c4..7fb7922 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 _0xce96=['register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','update','body','options','raw','where','attributes','UpdateFaxInteraction','debug','FaxInteraction','addTags','ids','spread','AddTags','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x278000,_0x383fca){var _0x198f37=function(_0x54ac41){while(--_0x54ac41){_0x278000['push'](_0x278000['shift']());}};_0x198f37(++_0x383fca);}(_0xce96,0x19d));var _0x6ce9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xce96[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x6ce9('0x0'));var util=require(_0x6ce9('0x1'));var moment=require('moment');var BPromise=require(_0x6ce9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ce9('0x3'));var db=require(_0x6ce9('0x4'))['db'];var utils=require(_0x6ce9('0x5'));var logger=require(_0x6ce9('0x6'))('rpc');var config=require(_0x6ce9('0x7'));var jayson=require(_0x6ce9('0x8'));var client=jayson[_0x6ce9('0x9')][_0x6ce9('0xa')]({'port':0x232a});config['redis']=_[_0x6ce9('0xb')](config[_0x6ce9('0xc')],{'host':_0x6ce9('0xd'),'port':0x18eb});var socket=require(_0x6ce9('0xe'))(new Redis(config[_0x6ce9('0xc')]));require(_0x6ce9('0xf'))[_0x6ce9('0x10')](socket);function respondWithRpcPromise(_0x259993,_0x3d214a,_0x5a11f4){return new BPromise(function(_0x27e00d,_0x1cc8c0){return client['request'](_0x259993,_0x5a11f4)[_0x6ce9('0x11')](function(_0x283384){logger[_0x6ce9('0x12')](_0x6ce9('0x13'),_0x3d214a,_0x6ce9('0x14'));logger['debug'](_0x6ce9('0x15'),_0x3d214a,_0x6ce9('0x14'),JSON['stringify'](_0x283384));if(_0x283384[_0x6ce9('0x16')]){if(_0x283384[_0x6ce9('0x16')]['code']===0x1f4){logger[_0x6ce9('0x16')](_0x6ce9('0x13'),_0x3d214a,_0x283384[_0x6ce9('0x16')]['message']);return _0x1cc8c0(_0x283384['error']['message']);}logger[_0x6ce9('0x16')](_0x6ce9('0x13'),_0x3d214a,_0x283384['error'][_0x6ce9('0x17')]);return _0x27e00d(_0x283384[_0x6ce9('0x16')][_0x6ce9('0x17')]);}else{logger[_0x6ce9('0x12')](_0x6ce9('0x13'),_0x3d214a,_0x6ce9('0x14'));_0x27e00d(_0x283384['result']['message']);}})[_0x6ce9('0x18')](function(_0x24664a){logger[_0x6ce9('0x16')](_0x6ce9('0x13'),_0x3d214a,_0x24664a);_0x1cc8c0(_0x24664a);});});}exports['UpdateFaxInteraction']=function(_0x931704){var _0x5a94d8=this;return new Promise(function(_0x54c943,_0x1d4714){return db['FaxInteraction'][_0x6ce9('0x19')](_0x931704[_0x6ce9('0x1a')],{'raw':_0x931704[_0x6ce9('0x1b')]?_0x931704['options'][_0x6ce9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x931704['options']?_0x931704['options'][_0x6ce9('0x1d')]||null:null,'attributes':_0x931704[_0x6ce9('0x1b')]?_0x931704[_0x6ce9('0x1b')][_0x6ce9('0x1e')]||null:null,'limit':_0x931704[_0x6ce9('0x1b')]?_0x931704[_0x6ce9('0x1b')]['limit']||null:null})[_0x6ce9('0x11')](function(_0xdb5fd2){logger[_0x6ce9('0x12')](_0x6ce9('0x1f'),_0x931704);logger[_0x6ce9('0x20')](_0x6ce9('0x1f'),_0x931704,JSON['stringify'](_0xdb5fd2));_0x54c943(_0xdb5fd2);})[_0x6ce9('0x18')](function(_0x4ce10e){logger[_0x6ce9('0x16')]('UpdateFaxInteraction',_0x4ce10e[_0x6ce9('0x17')],_0x931704);_0x1d4714(_0x5a94d8[_0x6ce9('0x16')](0x1f4,_0x4ce10e[_0x6ce9('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x59a5da){return new Promise(function(_0x2f2042,_0x525457){return db[_0x6ce9('0x21')]['find']({'where':_0x59a5da[_0x6ce9('0x1b')]?_0x59a5da[_0x6ce9('0x1b')][_0x6ce9('0x1d')]||null:null})[_0x6ce9('0x11')](function(_0x44e3e0){if(_0x44e3e0){return _0x44e3e0[_0x6ce9('0x22')](_0x59a5da[_0x6ce9('0x1a')][_0x6ce9('0x23')],_['omit'](_0x59a5da[_0x6ce9('0x1a')],['ids','id'])||{});}})[_0x6ce9('0x24')](function(_0x2b96d2){logger[_0x6ce9('0x12')](_0x6ce9('0x25'),_0x59a5da);logger[_0x6ce9('0x20')](_0x6ce9('0x25'),_0x59a5da,JSON[_0x6ce9('0x26')](_0x2b96d2));_0x2f2042(_0x2b96d2);})[_0x6ce9('0x18')](function(_0x4ff855){logger[_0x6ce9('0x16')](_0x6ce9('0x25'),_0x4ff855[_0x6ce9('0x17')],_0x59a5da);_0x525457(_this['error'](0x1f4,_0x4ff855[_0x6ce9('0x17')]));});});}; \ No newline at end of file +var _0x2c70=['request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where','attributes','limit','then','UpdateFaxInteraction','debug','FaxInteraction','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','register'];(function(_0x1d9101,_0x2501d4){var _0x341b34=function(_0x8b8047){while(--_0x8b8047){_0x1d9101['push'](_0x1d9101['shift']());}};_0x341b34(++_0x2501d4);}(_0x2c70,0x90));var _0x02c7=function(_0x2b7338,_0x71669b){_0x2b7338=_0x2b7338-0x0;var _0x26660e=_0x2c70[_0x2b7338];return _0x26660e;};'use strict';var _=require('lodash');var util=require(_0x02c7('0x0'));var moment=require(_0x02c7('0x1'));var BPromise=require(_0x02c7('0x2'));var rs=require(_0x02c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02c7('0x4'))['db'];var utils=require(_0x02c7('0x5'));var logger=require(_0x02c7('0x6'))(_0x02c7('0x7'));var config=require(_0x02c7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x02c7('0x9')]({'port':0x232a});config[_0x02c7('0xa')]=_['defaults'](config[_0x02c7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x02c7('0xa')]));require('./faxInteraction.socket')[_0x02c7('0xb')](socket);function respondWithRpcPromise(_0x691cdc,_0x19b168,_0x29eead){return new BPromise(function(_0xb51cf2,_0x1a3810){return client[_0x02c7('0xc')](_0x691cdc,_0x29eead)['then'](function(_0x5f57c8){logger[_0x02c7('0xd')](_0x02c7('0xe'),_0x19b168,_0x02c7('0xf'));logger['debug'](_0x02c7('0x10'),_0x19b168,_0x02c7('0xf'),JSON[_0x02c7('0x11')](_0x5f57c8));if(_0x5f57c8['error']){if(_0x5f57c8[_0x02c7('0x12')][_0x02c7('0x13')]===0x1f4){logger['error'](_0x02c7('0xe'),_0x19b168,_0x5f57c8[_0x02c7('0x12')][_0x02c7('0x14')]);return _0x1a3810(_0x5f57c8[_0x02c7('0x12')][_0x02c7('0x14')]);}logger[_0x02c7('0x12')](_0x02c7('0xe'),_0x19b168,_0x5f57c8[_0x02c7('0x12')]['message']);return _0xb51cf2(_0x5f57c8[_0x02c7('0x12')][_0x02c7('0x14')]);}else{logger[_0x02c7('0xd')](_0x02c7('0xe'),_0x19b168,_0x02c7('0xf'));_0xb51cf2(_0x5f57c8[_0x02c7('0x15')][_0x02c7('0x14')]);}})[_0x02c7('0x16')](function(_0x5f345f){logger[_0x02c7('0x12')](_0x02c7('0xe'),_0x19b168,_0x5f345f);_0x1a3810(_0x5f345f);});});}exports['UpdateFaxInteraction']=function(_0x1c6745){var _0x141348=this;return new Promise(function(_0x3f3e48,_0x3d2228){return db['FaxInteraction'][_0x02c7('0x17')](_0x1c6745[_0x02c7('0x18')],{'raw':_0x1c6745['options']?_0x1c6745[_0x02c7('0x19')][_0x02c7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c6745[_0x02c7('0x19')]?_0x1c6745['options'][_0x02c7('0x1b')]||null:null,'attributes':_0x1c6745[_0x02c7('0x19')]?_0x1c6745[_0x02c7('0x19')][_0x02c7('0x1c')]||null:null,'limit':_0x1c6745[_0x02c7('0x19')]?_0x1c6745['options'][_0x02c7('0x1d')]||null:null})[_0x02c7('0x1e')](function(_0x2fcc6a){logger[_0x02c7('0xd')](_0x02c7('0x1f'),_0x1c6745);logger[_0x02c7('0x20')](_0x02c7('0x1f'),_0x1c6745,JSON[_0x02c7('0x11')](_0x2fcc6a));_0x3f3e48(_0x2fcc6a);})['catch'](function(_0x3e0694){logger[_0x02c7('0x12')](_0x02c7('0x1f'),_0x3e0694[_0x02c7('0x14')],_0x1c6745);_0x3d2228(_0x141348[_0x02c7('0x12')](0x1f4,_0x3e0694[_0x02c7('0x14')]));});});};exports['AddTagsToFaxInteraction']=function(_0x3efae0){return new Promise(function(_0x1c0aad,_0xd23faf){return db[_0x02c7('0x21')]['find']({'where':_0x3efae0[_0x02c7('0x19')]?_0x3efae0[_0x02c7('0x19')][_0x02c7('0x1b')]||null:null})[_0x02c7('0x1e')](function(_0x58a9f3){if(_0x58a9f3){return _0x58a9f3[_0x02c7('0x22')](_0x3efae0[_0x02c7('0x18')][_0x02c7('0x23')],_[_0x02c7('0x24')](_0x3efae0[_0x02c7('0x18')],[_0x02c7('0x23'),'id'])||{});}})[_0x02c7('0x25')](function(_0x1c0180){logger[_0x02c7('0xd')]('AddTags',_0x3efae0);logger['debug'](_0x02c7('0x26'),_0x3efae0,JSON['stringify'](_0x1c0180));_0x1c0aad(_0x1c0180);})['catch'](function(_0x136382){logger[_0x02c7('0x12')]('AddTags',_0x136382[_0x02c7('0x14')],_0x3efae0);_0xd23faf(_this[_0x02c7('0x12')](0x1f4,_0x136382['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d3079ac..6b09a2e 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 _0x4a3f=['length','faxInteraction:','./faxInteraction.events','remove','update','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4a3f,0x64));var _0xf4a3=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x4a3f[_0x4914e2];return _0x2dcd07;};'use strict';var FaxInteractionEvents=require(_0xf4a3('0x0'));var events=['save',_0xf4a3('0x1'),_0xf4a3('0x2')];function createListener(_0x2b9436,_0x17fac4){return function(_0x332a41){_0x17fac4['emit'](_0x2b9436,_0x332a41);};}function removeListener(_0xccc2ba,_0x262bd5){return function(){FaxInteractionEvents[_0xf4a3('0x3')](_0xccc2ba,_0x262bd5);};}exports[_0xf4a3('0x4')]=function(_0x29439d){for(var _0x4c7070=0x0,_0x550aa3=events[_0xf4a3('0x5')];_0x4c7070<_0x550aa3;_0x4c7070++){var _0x4e2123=events[_0x4c7070];var _0x5790da=createListener(_0xf4a3('0x6')+_0x4e2123,_0x29439d);FaxInteractionEvents['on'](_0x4e2123,_0x5790da);}}; \ No newline at end of file +var _0xa61a=['update','emit','register','faxInteraction:','save','remove'];(function(_0x22a2aa,_0x258d18){var _0x21f853=function(_0x1d0b7b){while(--_0x1d0b7b){_0x22a2aa['push'](_0x22a2aa['shift']());}};_0x21f853(++_0x258d18);}(_0xa61a,0x124));var _0xaa61=function(_0x2f1d2f,_0x527d85){_0x2f1d2f=_0x2f1d2f-0x0;var _0x2874cf=_0xa61a[_0x2f1d2f];return _0x2874cf;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xaa61('0x0'),_0xaa61('0x1'),_0xaa61('0x2')];function createListener(_0x3d16e7,_0x5b9df9){return function(_0x4cea05){_0x5b9df9[_0xaa61('0x3')](_0x3d16e7,_0x4cea05);};}function removeListener(_0x346075,_0x3c0697){return function(){FaxInteractionEvents['removeListener'](_0x346075,_0x3c0697);};}exports[_0xaa61('0x4')]=function(_0xda6d4f){for(var _0x1f516f=0x0,_0x31b184=events['length'];_0x1f516f<_0x31b184;_0x1f516f++){var _0xf74de=events[_0x1f516f];var _0x40b789=createListener(_0xaa61('0x5')+_0xf74de,_0xda6d4f);FaxInteractionEvents['on'](_0xf74de,_0x40b789);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index aa58bd3..726e1d6 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 _0xacf6=['/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','update','delete','/:id','faxinteraction:destroy','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages'];(function(_0x4eb3e7,_0x208810){var _0x383384=function(_0x246e52){while(--_0x246e52){_0x4eb3e7['push'](_0x4eb3e7['shift']());}};_0x383384(++_0x208810);}(_0xacf6,0xbc));var _0x6acf=function(_0x45e532,_0x21108f){_0x45e532=_0x45e532-0x0;var _0x45e5d2=_0xacf6[_0x45e532];return _0x45e5d2;};'use strict';var multer=require(_0x6acf('0x0'));var util=require('util');var path=require(_0x6acf('0x1'));var timeout=require(_0x6acf('0x2'));var express=require(_0x6acf('0x3'));var router=express[_0x6acf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6acf('0x5'));var interaction=require(_0x6acf('0x6'));var config=require(_0x6acf('0x7'));var controller=require('./faxInteraction.controller');router[_0x6acf('0x8')]('/',auth[_0x6acf('0x9')](),controller[_0x6acf('0xa')]);router[_0x6acf('0x8')](_0x6acf('0xb'),auth[_0x6acf('0x9')](),controller[_0x6acf('0xc')]);router[_0x6acf('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6acf('0x8')](_0x6acf('0xd'),auth['isAuthenticated'](),controller[_0x6acf('0xe')]);router['get'](_0x6acf('0xf'),auth[_0x6acf('0x9')](),controller[_0x6acf('0x10')]);router[_0x6acf('0x11')]('/',auth['isAuthenticated'](),controller[_0x6acf('0x12')]);router[_0x6acf('0x11')](_0x6acf('0xd'),auth[_0x6acf('0x9')](),controller[_0x6acf('0x13')]);router[_0x6acf('0x11')](_0x6acf('0x14'),auth[_0x6acf('0x9')](),interaction[_0x6acf('0x15')](_0x6acf('0x16'),'faxinteraction:addtags'),controller[_0x6acf('0x17')]);router['put']('/:id',auth[_0x6acf('0x9')](),interaction[_0x6acf('0x15')](_0x6acf('0x16'),'faxinteraction:update'),controller[_0x6acf('0x18')]);router[_0x6acf('0x19')](_0x6acf('0x1a'),auth[_0x6acf('0x9')](),interaction[_0x6acf('0x15')](_0x6acf('0x16'),_0x6acf('0x1b')),controller[_0x6acf('0x1c')]);router[_0x6acf('0x19')](_0x6acf('0x14'),auth[_0x6acf('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x8c73=['show','/:id/messages','getMessages','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','destroy','delete','removeTags','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','/:id'];(function(_0xe95af,_0x4b849b){var _0x16effb=function(_0x454cd0){while(--_0x454cd0){_0xe95af['push'](_0xe95af['shift']());}};_0x16effb(++_0x4b849b);}(_0x8c73,0x183));var _0x38c7=function(_0x347862,_0x339566){_0x347862=_0x347862-0x0;var _0x2ec88b=_0x8c73[_0x347862];return _0x2ec88b;};'use strict';var multer=require('multer');var util=require(_0x38c7('0x0'));var path=require('path');var timeout=require(_0x38c7('0x1'));var express=require(_0x38c7('0x2'));var router=express[_0x38c7('0x3')]();var fs_extra=require(_0x38c7('0x4'));var auth=require(_0x38c7('0x5'));var interaction=require(_0x38c7('0x6'));var config=require(_0x38c7('0x7'));var controller=require(_0x38c7('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x38c7('0x9')](_0x38c7('0xa'),auth[_0x38c7('0xb')](),controller['describe']);router[_0x38c7('0x9')](_0x38c7('0xc'),auth[_0x38c7('0xb')](),controller[_0x38c7('0xd')]);router[_0x38c7('0x9')](_0x38c7('0xe'),auth[_0x38c7('0xb')](),controller[_0x38c7('0xf')]);router['get']('/:id/download',auth[_0x38c7('0xb')](),controller['download']);router['post']('/',auth[_0x38c7('0xb')](),controller['create']);router['post']('/:id/messages',auth[_0x38c7('0xb')](),controller['addMessage']);router['post'](_0x38c7('0x10'),auth[_0x38c7('0xb')](),interaction[_0x38c7('0x11')](_0x38c7('0x12'),_0x38c7('0x13')),controller['addTags']);router[_0x38c7('0x14')](_0x38c7('0xc'),auth[_0x38c7('0xb')](),interaction[_0x38c7('0x11')](_0x38c7('0x12'),_0x38c7('0x15')),controller['update']);router['delete'](_0x38c7('0xc'),auth[_0x38c7('0xb')](),interaction[_0x38c7('0x11')]('fax','faxinteraction:destroy'),controller[_0x38c7('0x16')]);router[_0x38c7('0x17')](_0x38c7('0x10'),auth[_0x38c7('0xb')](),controller[_0x38c7('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d0026bc..60c4f99 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 _0x2209=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x2209,0x95));var _0x9220=function(_0x32fe7d,_0x9ebdcb){_0x32fe7d=_0x32fe7d-0x0;var _0x3aa43d=_0x2209[_0x32fe7d];return _0x3aa43d;};'use strict';var Sequelize=require(_0x9220('0x0'));module[_0x9220('0x1')]={'body':{'type':Sequelize[_0x9220('0x2')](_0x9220('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9220('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9220('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9220('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9220('0x6')]}}; \ No newline at end of file +var _0xf257=['BOOLEAN','ENUM','out','DATE','TEXT','medium'];(function(_0x90f6be,_0x5ebf25){var _0x41f160=function(_0x4ea5f6){while(--_0x4ea5f6){_0x90f6be['push'](_0x90f6be['shift']());}};_0x41f160(++_0x5ebf25);}(_0xf257,0x82));var _0x7f25=function(_0x463d53,_0x59b94d){_0x463d53=_0x463d53-0x0;var _0x528135=_0xf257[_0x463d53];return _0x528135;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x7f25('0x0')](_0x7f25('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7f25('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f25('0x3')]('in','out'),'defaultValue':_0x7f25('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x7f25('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7f25('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 07811c1..00aaaa9 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 _0xe82e=['info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','map','FaxMessage','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','findAll','rows','params','rawAttributes','intersection','include','options','find','body','describe','../../config/logger','fax','read','readAt','UserId','agent','get','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','fax-interactions','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','SELECT','interface','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','attachments','rimraf','fast-json-patch','moment','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/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','request','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe82e,0x6f));var _0xee82=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xe82e[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee82('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee82('0x1'));var rp=require('request-promise');var moment=require(_0xee82('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xee82('0x3'));var util=require(_0xee82('0x4'));var path=require(_0xee82('0x5'));var sox=require(_0xee82('0x6'));var csv=require('to-csv');var ejs=require(_0xee82('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee82('0x8'));var squel=require('squel');var crypto=require(_0xee82('0x9'));var jsforce=require(_0xee82('0xa'));var deskjs=require(_0xee82('0xb'));var toCsv=require(_0xee82('0xc'));var querystring=require(_0xee82('0xd'));var Papa=require(_0xee82('0xe'));var Redis=require(_0xee82('0xf'));var authService=require(_0xee82('0x10'));var qs=require(_0xee82('0x11'));var as=require(_0xee82('0x12'));var hardwareService=require(_0xee82('0x13'));var logger=require('../../config/logger')(_0xee82('0x14'));var utils=require(_0xee82('0x15'));var config=require(_0xee82('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xee82('0x17')]=_[_0xee82('0x18')](config[_0xee82('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xee82('0x19'))(new Redis(config[_0xee82('0x17')]));require(_0xee82('0x1a'))[_0xee82('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xee82('0x1c')][_0xee82('0x1d')]({'port':0x232c});var client9002=jayson[_0xee82('0x1c')][_0xee82('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x55505d,_0x42a6ae,_0x420955,_0x503b6b){return new BPromise(function(_0x2293d4,_0x3c15fc){var _0x571992=_0x503b6b||client;return _0x571992[_0xee82('0x1e')](_0x55505d,_0x420955)[_0xee82('0x1f')](function(_0x115c24){logger[_0xee82('0x20')](_0xee82('0x21'),_0x42a6ae,'request\x20sent');logger[_0xee82('0x22')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x42a6ae,_0xee82('0x23'),JSON[_0xee82('0x24')](_0x115c24));if(_0x115c24[_0xee82('0x25')]){if(_0x115c24['error'][_0xee82('0x26')]===0x1f4){logger[_0xee82('0x25')](_0xee82('0x21'),_0x42a6ae,_0x115c24[_0xee82('0x25')][_0xee82('0x27')]);return _0x3c15fc(_0x115c24[_0xee82('0x25')][_0xee82('0x27')]);}logger[_0xee82('0x25')]('FaxMessage,\x20%s,\x20%s',_0x42a6ae,_0x115c24['error']['message']);return _0x2293d4(_0x115c24[_0xee82('0x25')][_0xee82('0x27')]);}else{logger['info'](_0xee82('0x21'),_0x42a6ae,_0xee82('0x23'));_0x2293d4(_0x115c24[_0xee82('0x28')][_0xee82('0x27')]);}})[_0xee82('0x29')](function(_0x38b596){logger[_0xee82('0x25')](_0xee82('0x21'),_0x42a6ae,_0x38b596);_0x3c15fc(_0x38b596);});});}function respondWithStatusCode(_0x3abe51,_0x1c2af4){_0x1c2af4=_0x1c2af4||0xcc;return function(_0x43f0fe){if(_0x43f0fe){return _0x3abe51[_0xee82('0x2a')](_0x1c2af4);}return _0x3abe51[_0xee82('0x2b')](_0x1c2af4)[_0xee82('0x2c')]();};}function respondWithResult(_0x4eab65,_0x24473f){_0x24473f=_0x24473f||0xc8;return function(_0x47bb94){if(_0x47bb94){return _0x4eab65[_0xee82('0x2b')](_0x24473f)[_0xee82('0x2d')](_0x47bb94);}};}function respondWithFilteredResult(_0x10d7d5,_0x54b2fb){return function(_0x22416b){if(_0x22416b){var _0x1f25e1=typeof _0x54b2fb[_0xee82('0x2e')]===_0xee82('0x2f')&&typeof _0x54b2fb[_0xee82('0x30')]==='undefined';var _0x3a24ee=_0x22416b[_0xee82('0x31')];var _0x3eebbf=_0x1f25e1?0x0:_0x54b2fb['offset'];var _0x47cc0d=_0x1f25e1?_0x22416b[_0xee82('0x31')]:_0x54b2fb[_0xee82('0x2e')]+_0x54b2fb['limit'];var _0x2ab784;if(_0x47cc0d>=_0x3a24ee){_0x47cc0d=_0x3a24ee;_0x2ab784=0xc8;}else{_0x2ab784=0xce;}_0x10d7d5['status'](_0x2ab784);return _0x10d7d5[_0xee82('0x32')](_0xee82('0x33'),_0x3eebbf+'-'+_0x47cc0d+'/'+_0x3a24ee)[_0xee82('0x2d')](_0x22416b);}return null;};}function patchUpdates(_0x5dd1d6){return function(_0x1e0ed4){try{jsonpatch['apply'](_0x1e0ed4,_0x5dd1d6,!![]);}catch(_0xdae3d3){return BPromise[_0xee82('0x34')](_0xdae3d3);}return _0x1e0ed4[_0xee82('0x35')]();};}function saveUpdates(_0x148243,_0x5b956e){return function(_0x25910a){if(_0x25910a){return _0x25910a[_0xee82('0x36')](_0x148243)['then'](function(_0x453d54){return _0x453d54;});}return null;};}function removeEntity(_0x4200de,_0x51c182){return function(_0x2217b5){if(_0x2217b5){return _0x2217b5[_0xee82('0x37')]()[_0xee82('0x1f')](function(){_0x4200de['status'](0xcc)[_0xee82('0x2c')]();});}};}function handleEntityNotFound(_0x2d8250,_0x3ab6dd){return function(_0x298ba4){if(!_0x298ba4){_0x2d8250[_0xee82('0x2a')](0x194);}return _0x298ba4;};}function handleError(_0xada6fb,_0x367dc4){_0x367dc4=_0x367dc4||0x1f4;return function(_0x11670c){logger['error'](_0x11670c[_0xee82('0x38')]);if(_0x11670c['name']){delete _0x11670c[_0xee82('0x39')];}_0xada6fb['status'](_0x367dc4)['send'](_0x11670c);};}exports['index']=function(_0x57d4d4,_0xcd067b){var _0x363dd8={},_0x98cedf={},_0x639e4b={'count':0x0,'rows':[]};var _0x16e7c4=_[_0xee82('0x3a')](db[_0xee82('0x3b')]['rawAttributes'],function(_0x580e58){return{'name':_0x580e58[_0xee82('0x3c')],'type':_0x580e58[_0xee82('0x3d')]['key']};});_0x98cedf[_0xee82('0x3e')]=_[_0xee82('0x3a')](_0x16e7c4,_0xee82('0x39'));_0x98cedf[_0xee82('0x3f')]=_[_0xee82('0x40')](_0x57d4d4[_0xee82('0x3f')]);_0x98cedf[_0xee82('0x41')]=_['intersection'](_0x98cedf[_0xee82('0x3e')],_0x98cedf[_0xee82('0x3f')]);_0x363dd8[_0xee82('0x42')]=_['intersection'](_0x98cedf['model'],qs['fields'](_0x57d4d4[_0xee82('0x3f')][_0xee82('0x43')]));_0x363dd8['attributes']=_0x363dd8['attributes'][_0xee82('0x44')]?_0x363dd8[_0xee82('0x42')]:_0x98cedf[_0xee82('0x3e')];if(!_0x57d4d4[_0xee82('0x3f')][_0xee82('0x45')](_0xee82('0x46'))){_0x363dd8[_0xee82('0x30')]=qs[_0xee82('0x30')](_0x57d4d4['query'][_0xee82('0x30')]);_0x363dd8['offset']=qs[_0xee82('0x2e')](_0x57d4d4[_0xee82('0x3f')][_0xee82('0x2e')]);}_0x363dd8[_0xee82('0x47')]=qs['sort'](_0x57d4d4['query']['sort']);_0x363dd8[_0xee82('0x48')]=qs[_0xee82('0x41')](_[_0xee82('0x49')](_0x57d4d4[_0xee82('0x3f')],_0x98cedf[_0xee82('0x41')]),_0x16e7c4);if(_0x57d4d4[_0xee82('0x3f')]['filter']){_0x363dd8[_0xee82('0x48')]=_['merge'](_0x363dd8[_0xee82('0x48')],{'$or':_[_0xee82('0x3a')](_0x16e7c4,function(_0x3337f2){if(_0x3337f2['type']!=='VIRTUAL'){var _0x4baae9={};_0x4baae9[_0x3337f2['name']]={'$like':'%'+_0x57d4d4[_0xee82('0x3f')][_0xee82('0x4a')]+'%'};return _0x4baae9;}})});}_0x363dd8=_[_0xee82('0x4b')]({},_0x363dd8,_0x57d4d4['options']);var _0x3cb866={'where':_0x363dd8[_0xee82('0x48')]};return db[_0xee82('0x3b')]['count'](_0x3cb866)[_0xee82('0x1f')](function(_0x546afd){_0x639e4b['count']=_0x546afd;if(_0x57d4d4[_0xee82('0x3f')][_0xee82('0x4c')]){_0x363dd8['include']=[{'all':!![]}];}return db[_0xee82('0x3b')][_0xee82('0x4d')](_0x363dd8);})[_0xee82('0x1f')](function(_0x121d36){_0x639e4b[_0xee82('0x4e')]=_0x121d36;return _0x639e4b;})[_0xee82('0x1f')](respondWithFilteredResult(_0xcd067b,_0x363dd8))[_0xee82('0x29')](handleError(_0xcd067b,null));};exports['show']=function(_0x453368,_0x481b26){var _0x36d099={'raw':!![],'where':{'id':_0x453368[_0xee82('0x4f')]['id']}},_0x5c49da={};_0x5c49da[_0xee82('0x3e')]=_['keys'](db[_0xee82('0x3b')][_0xee82('0x50')]);_0x5c49da['query']=_[_0xee82('0x40')](_0x453368[_0xee82('0x3f')]);_0x5c49da['filters']=_[_0xee82('0x51')](_0x5c49da[_0xee82('0x3e')],_0x5c49da[_0xee82('0x3f')]);_0x36d099['attributes']=_[_0xee82('0x51')](_0x5c49da['model'],qs[_0xee82('0x43')](_0x453368[_0xee82('0x3f')]['fields']));_0x36d099[_0xee82('0x42')]=_0x36d099['attributes'][_0xee82('0x44')]?_0x36d099[_0xee82('0x42')]:_0x5c49da[_0xee82('0x3e')];if(_0x453368['query'][_0xee82('0x4c')]){_0x36d099[_0xee82('0x52')]=[{'all':!![]}];}_0x36d099=_['merge']({},_0x36d099,_0x453368[_0xee82('0x53')]);return db[_0xee82('0x3b')][_0xee82('0x54')](_0x36d099)['then'](handleEntityNotFound(_0x481b26,null))[_0xee82('0x1f')](respondWithResult(_0x481b26,null))[_0xee82('0x29')](handleError(_0x481b26,null));};exports['update']=function(_0x4ff195,_0x57831b){if(_0x4ff195[_0xee82('0x55')]['id']){delete _0x4ff195[_0xee82('0x55')]['id'];}return db[_0xee82('0x3b')][_0xee82('0x54')]({'where':{'id':_0x4ff195[_0xee82('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57831b,null))[_0xee82('0x1f')](saveUpdates(_0x4ff195[_0xee82('0x55')],null))[_0xee82('0x1f')](respondWithResult(_0x57831b,null))['catch'](handleError(_0x57831b,null));};exports[_0xee82('0x37')]=function(_0x248cb8,_0x49e47c){return db[_0xee82('0x3b')][_0xee82('0x54')]({'where':{'id':_0x248cb8[_0xee82('0x4f')]['id']}})[_0xee82('0x1f')](handleEntityNotFound(_0x49e47c,null))[_0xee82('0x1f')](removeEntity(_0x49e47c,null))[_0xee82('0x29')](handleError(_0x49e47c,null));};exports[_0xee82('0x56')]=function(_0x3e5f31,_0x19ef53){return db[_0xee82('0x3b')][_0xee82('0x56')]()[_0xee82('0x1f')](respondWithResult(_0x19ef53,null))[_0xee82('0x29')](handleError(_0x19ef53,null));};var interaction_log=require(_0xee82('0x57'))('fax-interactions');exports['accept']=function(_0x3579d8,_0x3a516c,_0x3ee75e){var _0x52e5e0={'agent':{},'channel':_0xee82('0x58')};if(_0x3579d8[_0xee82('0x55')]['id']){delete _0x3579d8['body']['id'];}_0x3579d8[_0xee82('0x55')][_0xee82('0x59')]=!![];_0x3579d8['body'][_0xee82('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3579d8[_0xee82('0x55')][_0xee82('0x5b')]=_0x3579d8['body']['UserId']||_0x3579d8['user']['id'];_0x52e5e0[_0xee82('0x5c')]['id']=_0x3579d8[_0xee82('0x55')][_0xee82('0x5b')];return db[_0xee82('0x3b')]['find']({'where':{'id':_0x3579d8[_0xee82('0x4f')]['id'],'UserId':null}})[_0xee82('0x1f')](handleEntityNotFound(_0x3a516c,null))[_0xee82('0x1f')](saveUpdates(_0x3579d8[_0xee82('0x55')],null))['then'](function(_0x208197){if(_0x208197){_0x52e5e0[_0xee82('0x27')]=_0x208197[_0xee82('0x5d')]({'plain':!![]});return db['FaxInteraction'][_0xee82('0x54')]({'where':{'id':_0x208197['FaxInteractionId']}});}return null;})[_0xee82('0x1f')](handleEntityNotFound(_0x3a516c,null))[_0xee82('0x1f')](function(_0x379318){if(_0x379318){return _0x379318[_0xee82('0x36')]({'UserId':_0x3579d8[_0xee82('0x55')]['UserId'],'read1stAt':_[_0xee82('0x5e')](_0x379318[_0xee82('0x5f')])?moment()[_0xee82('0x60')](_0xee82('0x61')):undefined});}return null;})[_0xee82('0x1f')](function(_0x4723f8){if(_0x4723f8){_0x52e5e0[_0xee82('0x62')]=_0x4723f8['get']({'plain':!![]});interaction_log[_0xee82('0x20')](_0xee82('0x63'),_0x3579d8[_0xee82('0x64')]['id'],_0x3579d8[_0xee82('0x64')][_0xee82('0x39')],_0x3579d8[_0xee82('0x64')][_0xee82('0x65')],_0x52e5e0[_0xee82('0x62')]['id'],_0x3579d8[_0xee82('0x55')]?JSON[_0xee82('0x24')](_0x3579d8['body']):_0xee82('0x66'));return respondWithRpcPromise(_0xee82('0x67'),'acceptMessage',_0x52e5e0);}return null;})[_0xee82('0x1f')](function(_0x59a492){var _0x66827c=_0xee82('0x68')+_0x59a492[_0xee82('0x27')][_0xee82('0x69')];return db[_0xee82('0x6a')][_0xee82('0x3f')](_0x66827c,{'type':db[_0xee82('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})[_0xee82('0x1f')](function(_0x3411f1){return _0x3411f1;});})[_0xee82('0x1f')](function(_0xd69546){if(_0xd69546){_0x52e5e0[_0xee82('0x27')][_0xee82('0x6c')]=_0xd69546[0x0];if(!_0x3579d8[_0xee82('0x55')][_0xee82('0x5b')])return;return db[_0xee82('0x6d')]['find']({'where':{'id':_0x3579d8[_0xee82('0x55')][_0xee82('0x5b')],'role':'agent'},'attributes':['id',_0xee82('0x39'),_0xee82('0x6e'),_0xee82('0x6f'),_0xee82('0x70')],'raw':!![]});}return null;})['then'](function(_0x19ec24){if(!_0x19ec24)return null;_0x52e5e0[_0xee82('0x27')][_0xee82('0x5c')]=_0x19ec24;return _0x52e5e0;})[_0xee82('0x1f')](function(_0x3cd78b){if(_0x3cd78b){if(_0x3579d8[_0xee82('0x55')][_0xee82('0x71')]){_0x52e5e0[_0xee82('0x27')]['interface']=util[_0xee82('0x60')](_0xee82('0x72'),_0x3579d8[_0xee82('0x64')]['name']);_0x52e5e0[_0xee82('0x27')][_0xee82('0x73')]=_0x52e5e0[_0xee82('0x73')];_0x52e5e0[_0xee82('0x27')][_0xee82('0x74')]=_0x52e5e0[_0xee82('0x73')];_0x52e5e0['message'][_0xee82('0x75')]=_0xee82('0x76');return respondWithRpcPromise(_0xee82('0x77'),_0xee82('0x77'),{'event':_0xee82('0x78'),'message':_0x52e5e0['message']},client9002)[_0xee82('0x1f')](function(){return _0x52e5e0;});}return _0x52e5e0;}return null;})['then'](respondWithResult(_0x3a516c,null))[_0xee82('0x29')](handleError(_0x3a516c,null));};var interaction_log=require(_0xee82('0x57'))(_0xee82('0x79'));exports[_0xee82('0x34')]=function(_0x24557d,_0x3e72a3,_0x380642){var _0x3468ca={'agent':{},'channel':_0xee82('0x58')};if(_0x24557d['body']['id']){delete _0x24557d[_0xee82('0x55')]['id'];}_0x24557d[_0xee82('0x55')]['UserId']=_0x24557d[_0xee82('0x55')]['UserId']||_0x24557d[_0xee82('0x64')]['id'];_0x3468ca['agent']['id']=_0x24557d['body'][_0xee82('0x5b')];return db[_0xee82('0x3b')]['find']({'where':{'id':_0x24557d[_0xee82('0x4f')]['id'],'UserId':null}})[_0xee82('0x1f')](handleEntityNotFound(_0x3e72a3,null))[_0xee82('0x1f')](function(_0x25fa38){if(_0x25fa38){_0x3468ca[_0xee82('0x27')]=_0x25fa38['get']({'plain':!![]});return db[_0xee82('0x7a')][_0xee82('0x54')]({'where':{'id':_0x25fa38[_0xee82('0x7b')]}});}return null;})[_0xee82('0x1f')](handleEntityNotFound(_0x3e72a3,null))[_0xee82('0x1f')](function(_0x3d597a){if(_0x3d597a){_0x3468ca[_0xee82('0x62')]=_0x3d597a['get']({'plain':!![]});interaction_log[_0xee82('0x20')](_0xee82('0x7c'),_0x24557d[_0xee82('0x64')]['id'],_0x24557d[_0xee82('0x64')][_0xee82('0x39')],_0x24557d[_0xee82('0x64')]['role'],_0x3468ca[_0xee82('0x62')]['id'],_0x24557d[_0xee82('0x55')]?JSON['stringify'](_0x24557d[_0xee82('0x55')]):_0xee82('0x66'));return respondWithRpcPromise(_0xee82('0x7d'),'rejectMessage',_0x3468ca);}return null;})[_0xee82('0x1f')](function(_0x5f1b62){var _0x2b38fb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f1b62[_0xee82('0x27')][_0xee82('0x69')];return db['sequelize'][_0xee82('0x3f')](_0x2b38fb,{'type':db[_0xee82('0x6b')][_0xee82('0x7e')][_0xee82('0x7f')],'raw':!![]})[_0xee82('0x1f')](function(_0x9748a0){return _0x9748a0;});})['then'](function(_0x3032b5){if(_0x3032b5){_0x3468ca[_0xee82('0x27')][_0xee82('0x6c')]=_0x3032b5[0x0];if(!_0x24557d['body'][_0xee82('0x5b')])return;return db[_0xee82('0x6d')]['find']({'where':{'id':_0x24557d[_0xee82('0x55')][_0xee82('0x5b')],'role':_0xee82('0x5c')},'attributes':['id',_0xee82('0x39'),_0xee82('0x6e'),_0xee82('0x6f'),_0xee82('0x70')],'raw':!![]});}return null;})['then'](function(_0x23798e){if(!_0x23798e)return null;_0x3468ca[_0xee82('0x27')][_0xee82('0x5c')]=_0x23798e;return _0x3468ca;})[_0xee82('0x1f')](function(_0x3e8847){if(_0x3e8847){_0x3e8847[_0xee82('0x27')][_0xee82('0x80')]=util[_0xee82('0x60')](_0xee82('0x72'),_0x24557d[_0xee82('0x64')][_0xee82('0x39')]);_0x3e8847[_0xee82('0x27')][_0xee82('0x73')]=_0x3468ca[_0xee82('0x73')];_0x3e8847[_0xee82('0x27')][_0xee82('0x74')]=_0x3468ca[_0xee82('0x73')];_0x3e8847[_0xee82('0x27')][_0xee82('0x75')]=_0xee82('0x34');respondWithRpcPromise(_0xee82('0x77'),'EventManager',{'event':_0xee82('0x81'),'message':_0x3e8847[_0xee82('0x27')]},client9002);return _0x3468ca;}return null;})[_0xee82('0x1f')](respondWithResult(_0x3e72a3,null))['catch'](handleError(_0x3e72a3,null));};exports[_0xee82('0x82')]=function(_0x4d26cf,_0x42602f){var _0x599cc8;return db[_0xee82('0x3b')][_0xee82('0x82')](_0x4d26cf[_0xee82('0x55')],{})['then'](function(_0x32203d){_0x599cc8=_0x32203d;return db[_0xee82('0x83')]['findOne']({'where':{'id':_0x599cc8['ContactId']}});})[_0xee82('0x1f')](function(_0x5bd1e0){if(_['isNil'](_0x5bd1e0)){return;}else{_0x599cc8[_0xee82('0x58')]=_0x5bd1e0['fax'];return db[_0xee82('0x84')][_0xee82('0x85')]({'where':{'id':_0x599cc8[_0xee82('0x86')]}});}})['then'](function(_0x119d77){return respondWithRpcPromise('SendFax',_0xee82('0x87'),{'FaxAccountId':_[_0xee82('0x5e')](_0x4d26cf['body'])?undefined:_0x4d26cf['body'][_0xee82('0x88')],'path':_[_0xee82('0x5e')](_0x119d77)?undefined:util[_0xee82('0x60')](_0xee82('0x89'),_0x119d77[_0xee82('0x8a')]),'fax':_[_0xee82('0x5e')](_0x599cc8[_0xee82('0x58')])?undefined:_0x599cc8[_0xee82('0x58')],'AttachmentId':_0x599cc8['AttachmentId']},client9002);})['then'](respondWithResult(_0x42602f,0xc9))[_0xee82('0x29')](handleError(_0x42602f,null));};exports[_0xee82('0x8b')]=function(_0x41cdb6,_0x120a7e){var _0x402fcd=path[_0xee82('0x8c')](config[_0xee82('0x8d')],'server','files',_0xee82('0x8e'));return db[_0xee82('0x3b')][_0xee82('0x54')]({'where':{'id':_0x41cdb6[_0xee82('0x4f')]['id']},'include':[{'model':db[_0xee82('0x84')],'as':_0xee82('0x84')}]})[_0xee82('0x1f')](handleEntityNotFound(_0x120a7e,null))[_0xee82('0x1f')](function(_0x580293){if(_0x580293){return _0x120a7e[_0xee82('0x8b')](path[_0xee82('0x8c')](_0x402fcd,_0x580293[_0xee82('0x84')][_0xee82('0x8a')]));}})['catch'](handleError(_0x120a7e,null));}; \ No newline at end of file +var _0xcd9f=['fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','sequelize','contact','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','Attachment','rimraf','zip-dir','fast-json-patch','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','end','stack','name','send','FaxMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe'];(function(_0x3b9ab2,_0x53e560){var _0x8ad4d2=function(_0x54df0a){while(--_0x54df0a){_0x3b9ab2['push'](_0x3b9ab2['shift']());}};_0x8ad4d2(++_0x53e560);}(_0xcd9f,0xc1));var _0xfcd9=function(_0x3c4763,_0x7120e4){_0x3c4763=_0x3c4763-0x0;var _0x1de6fb=_0xcd9f[_0x3c4763];return _0x1de6fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcd9('0x0'));var zipdir=require(_0xfcd9('0x1'));var jsonpatch=require(_0xfcd9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfcd9('0x3'));var sox=require('sox');var csv=require(_0xfcd9('0x4'));var ejs=require(_0xfcd9('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcd9('0x6'));var squel=require(_0xfcd9('0x7'));var crypto=require(_0xfcd9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xfcd9('0x9'));var toCsv=require('to-csv');var querystring=require(_0xfcd9('0xa'));var Papa=require(_0xfcd9('0xb'));var Redis=require(_0xfcd9('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfcd9('0xd'));var hardwareService=require(_0xfcd9('0xe'));var logger=require(_0xfcd9('0xf'))(_0xfcd9('0x10'));var utils=require('../../config/utils');var config=require(_0xfcd9('0x11'));var licenseUtil=require(_0xfcd9('0x12'));var db=require(_0xfcd9('0x13'))['db'];config['redis']=_[_0xfcd9('0x14')](config[_0xfcd9('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcd9('0x16'))(new Redis(config[_0xfcd9('0x15')]));require(_0xfcd9('0x17'))[_0xfcd9('0x18')](socket);var jayson=require(_0xfcd9('0x19'));var client=jayson[_0xfcd9('0x1a')][_0xfcd9('0x1b')]({'port':0x232c});var client9002=jayson[_0xfcd9('0x1a')][_0xfcd9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4f85f8,_0x179953,_0x3e5b52,_0x22992f){return new BPromise(function(_0x30247e,_0xafc3aa){var _0x273bc9=_0x22992f||client;return _0x273bc9[_0xfcd9('0x1c')](_0x4f85f8,_0x3e5b52)[_0xfcd9('0x1d')](function(_0x23d4e9){logger[_0xfcd9('0x1e')](_0xfcd9('0x1f'),_0x179953,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x179953,_0xfcd9('0x20'),JSON[_0xfcd9('0x21')](_0x23d4e9));if(_0x23d4e9[_0xfcd9('0x22')]){if(_0x23d4e9[_0xfcd9('0x22')]['code']===0x1f4){logger[_0xfcd9('0x22')]('FaxMessage,\x20%s,\x20%s',_0x179953,_0x23d4e9[_0xfcd9('0x22')]['message']);return _0xafc3aa(_0x23d4e9[_0xfcd9('0x22')][_0xfcd9('0x23')]);}logger[_0xfcd9('0x22')](_0xfcd9('0x1f'),_0x179953,_0x23d4e9[_0xfcd9('0x22')][_0xfcd9('0x23')]);return _0x30247e(_0x23d4e9[_0xfcd9('0x22')][_0xfcd9('0x23')]);}else{logger['info'](_0xfcd9('0x1f'),_0x179953,_0xfcd9('0x20'));_0x30247e(_0x23d4e9['result'][_0xfcd9('0x23')]);}})['catch'](function(_0x562177){logger['error'](_0xfcd9('0x1f'),_0x179953,_0x562177);_0xafc3aa(_0x562177);});});}function respondWithStatusCode(_0x308a6e,_0x39c453){_0x39c453=_0x39c453||0xcc;return function(_0x50d038){if(_0x50d038){return _0x308a6e[_0xfcd9('0x24')](_0x39c453);}return _0x308a6e[_0xfcd9('0x25')](_0x39c453)['end']();};}function respondWithResult(_0x197cff,_0x3310b1){_0x3310b1=_0x3310b1||0xc8;return function(_0xead7d6){if(_0xead7d6){return _0x197cff[_0xfcd9('0x25')](_0x3310b1)[_0xfcd9('0x26')](_0xead7d6);}};}function respondWithFilteredResult(_0x5f3775,_0x30ef90){return function(_0x5b461a){if(_0x5b461a){var _0x4d716b=typeof _0x30ef90[_0xfcd9('0x27')]===_0xfcd9('0x28')&&typeof _0x30ef90[_0xfcd9('0x29')]===_0xfcd9('0x28');var _0x1115d4=_0x5b461a[_0xfcd9('0x2a')];var _0x3a175b=_0x4d716b?0x0:_0x30ef90[_0xfcd9('0x27')];var _0x27e990=_0x4d716b?_0x5b461a[_0xfcd9('0x2a')]:_0x30ef90[_0xfcd9('0x27')]+_0x30ef90[_0xfcd9('0x29')];var _0x179012;if(_0x27e990>=_0x1115d4){_0x27e990=_0x1115d4;_0x179012=0xc8;}else{_0x179012=0xce;}_0x5f3775[_0xfcd9('0x25')](_0x179012);return _0x5f3775[_0xfcd9('0x2b')]('Content-Range',_0x3a175b+'-'+_0x27e990+'/'+_0x1115d4)['json'](_0x5b461a);}return null;};}function patchUpdates(_0x29cf25){return function(_0x48687c){try{jsonpatch['apply'](_0x48687c,_0x29cf25,!![]);}catch(_0x2a4b21){return BPromise[_0xfcd9('0x2c')](_0x2a4b21);}return _0x48687c[_0xfcd9('0x2d')]();};}function saveUpdates(_0x6c8bd2,_0x19d2f0){return function(_0x1d11bb){if(_0x1d11bb){return _0x1d11bb[_0xfcd9('0x2e')](_0x6c8bd2)[_0xfcd9('0x1d')](function(_0x5dd1cb){return _0x5dd1cb;});}return null;};}function removeEntity(_0x3a7f7,_0x18d94f){return function(_0x2fa0c2){if(_0x2fa0c2){return _0x2fa0c2[_0xfcd9('0x2f')]()[_0xfcd9('0x1d')](function(){_0x3a7f7[_0xfcd9('0x25')](0xcc)[_0xfcd9('0x30')]();});}};}function handleEntityNotFound(_0x334617,_0x10f026){return function(_0x5ce55a){if(!_0x5ce55a){_0x334617[_0xfcd9('0x24')](0x194);}return _0x5ce55a;};}function handleError(_0x13676c,_0x3817f7){_0x3817f7=_0x3817f7||0x1f4;return function(_0x4ab016){logger[_0xfcd9('0x22')](_0x4ab016[_0xfcd9('0x31')]);if(_0x4ab016[_0xfcd9('0x32')]){delete _0x4ab016[_0xfcd9('0x32')];}_0x13676c[_0xfcd9('0x25')](_0x3817f7)[_0xfcd9('0x33')](_0x4ab016);};}exports['index']=function(_0x2e73f3,_0x330545){var _0x11cacc={},_0x5153fe={},_0x4745bd={'count':0x0,'rows':[]};var _0x189c98=_['map'](db[_0xfcd9('0x34')][_0xfcd9('0x35')],function(_0x13d53a){return{'name':_0x13d53a[_0xfcd9('0x36')],'type':_0x13d53a[_0xfcd9('0x37')][_0xfcd9('0x38')]};});_0x5153fe['model']=_['map'](_0x189c98,'name');_0x5153fe[_0xfcd9('0x39')]=_[_0xfcd9('0x3a')](_0x2e73f3[_0xfcd9('0x39')]);_0x5153fe[_0xfcd9('0x3b')]=_[_0xfcd9('0x3c')](_0x5153fe[_0xfcd9('0x3d')],_0x5153fe[_0xfcd9('0x39')]);_0x11cacc[_0xfcd9('0x3e')]=_[_0xfcd9('0x3c')](_0x5153fe['model'],qs[_0xfcd9('0x3f')](_0x2e73f3[_0xfcd9('0x39')]['fields']));_0x11cacc[_0xfcd9('0x3e')]=_0x11cacc[_0xfcd9('0x3e')][_0xfcd9('0x40')]?_0x11cacc[_0xfcd9('0x3e')]:_0x5153fe['model'];if(!_0x2e73f3[_0xfcd9('0x39')]['hasOwnProperty']('nolimit')){_0x11cacc[_0xfcd9('0x29')]=qs[_0xfcd9('0x29')](_0x2e73f3[_0xfcd9('0x39')][_0xfcd9('0x29')]);_0x11cacc[_0xfcd9('0x27')]=qs[_0xfcd9('0x27')](_0x2e73f3['query'][_0xfcd9('0x27')]);}_0x11cacc['order']=qs[_0xfcd9('0x41')](_0x2e73f3[_0xfcd9('0x39')][_0xfcd9('0x41')]);_0x11cacc['where']=qs[_0xfcd9('0x3b')](_[_0xfcd9('0x42')](_0x2e73f3['query'],_0x5153fe['filters']),_0x189c98);if(_0x2e73f3[_0xfcd9('0x39')][_0xfcd9('0x43')]){_0x11cacc[_0xfcd9('0x44')]=_[_0xfcd9('0x45')](_0x11cacc[_0xfcd9('0x44')],{'$or':_[_0xfcd9('0x46')](_0x189c98,function(_0xfc57b5){if(_0xfc57b5[_0xfcd9('0x37')]!==_0xfcd9('0x47')){var _0x2f8852={};_0x2f8852[_0xfc57b5[_0xfcd9('0x32')]]={'$like':'%'+_0x2e73f3[_0xfcd9('0x39')]['filter']+'%'};return _0x2f8852;}})});}_0x11cacc=_[_0xfcd9('0x45')]({},_0x11cacc,_0x2e73f3[_0xfcd9('0x48')]);var _0x28adeb={'where':_0x11cacc[_0xfcd9('0x44')]};return db['FaxMessage']['count'](_0x28adeb)['then'](function(_0x4be9d9){_0x4745bd[_0xfcd9('0x2a')]=_0x4be9d9;if(_0x2e73f3[_0xfcd9('0x39')][_0xfcd9('0x49')]){_0x11cacc['include']=[{'all':!![]}];}return db[_0xfcd9('0x34')][_0xfcd9('0x4a')](_0x11cacc);})[_0xfcd9('0x1d')](function(_0x345e70){_0x4745bd[_0xfcd9('0x4b')]=_0x345e70;return _0x4745bd;})[_0xfcd9('0x1d')](respondWithFilteredResult(_0x330545,_0x11cacc))[_0xfcd9('0x4c')](handleError(_0x330545,null));};exports[_0xfcd9('0x4d')]=function(_0x12c530,_0x4fbdea){var _0x434074={'raw':!![],'where':{'id':_0x12c530[_0xfcd9('0x4e')]['id']}},_0x7cbf2a={};_0x7cbf2a[_0xfcd9('0x3d')]=_['keys'](db['FaxMessage'][_0xfcd9('0x35')]);_0x7cbf2a[_0xfcd9('0x39')]=_[_0xfcd9('0x3a')](_0x12c530[_0xfcd9('0x39')]);_0x7cbf2a[_0xfcd9('0x3b')]=_[_0xfcd9('0x3c')](_0x7cbf2a[_0xfcd9('0x3d')],_0x7cbf2a[_0xfcd9('0x39')]);_0x434074['attributes']=_[_0xfcd9('0x3c')](_0x7cbf2a[_0xfcd9('0x3d')],qs['fields'](_0x12c530[_0xfcd9('0x39')]['fields']));_0x434074[_0xfcd9('0x3e')]=_0x434074['attributes'][_0xfcd9('0x40')]?_0x434074[_0xfcd9('0x3e')]:_0x7cbf2a[_0xfcd9('0x3d')];if(_0x12c530[_0xfcd9('0x39')][_0xfcd9('0x49')]){_0x434074[_0xfcd9('0x4f')]=[{'all':!![]}];}_0x434074=_['merge']({},_0x434074,_0x12c530[_0xfcd9('0x48')]);return db['FaxMessage'][_0xfcd9('0x50')](_0x434074)[_0xfcd9('0x1d')](handleEntityNotFound(_0x4fbdea,null))[_0xfcd9('0x1d')](respondWithResult(_0x4fbdea,null))[_0xfcd9('0x4c')](handleError(_0x4fbdea,null));};exports['update']=function(_0x40c434,_0x5476c5){if(_0x40c434[_0xfcd9('0x51')]['id']){delete _0x40c434[_0xfcd9('0x51')]['id'];}return db[_0xfcd9('0x34')][_0xfcd9('0x50')]({'where':{'id':_0x40c434[_0xfcd9('0x4e')]['id']}})[_0xfcd9('0x1d')](handleEntityNotFound(_0x5476c5,null))[_0xfcd9('0x1d')](saveUpdates(_0x40c434[_0xfcd9('0x51')],null))[_0xfcd9('0x1d')](respondWithResult(_0x5476c5,null))['catch'](handleError(_0x5476c5,null));};exports[_0xfcd9('0x2f')]=function(_0x4093df,_0x237ce7){return db[_0xfcd9('0x34')][_0xfcd9('0x50')]({'where':{'id':_0x4093df[_0xfcd9('0x4e')]['id']}})[_0xfcd9('0x1d')](handleEntityNotFound(_0x237ce7,null))[_0xfcd9('0x1d')](removeEntity(_0x237ce7,null))[_0xfcd9('0x4c')](handleError(_0x237ce7,null));};exports[_0xfcd9('0x52')]=function(_0x53e2f7,_0x37011c){return db[_0xfcd9('0x34')][_0xfcd9('0x52')]()[_0xfcd9('0x1d')](respondWithResult(_0x37011c,null))[_0xfcd9('0x4c')](handleError(_0x37011c,null));};var interaction_log=require('../../config/logger')(_0xfcd9('0x53'));exports['accept']=function(_0x413ac2,_0x767853,_0x1634eb){var _0x28f48c={'agent':{},'channel':_0xfcd9('0x54')};if(_0x413ac2[_0xfcd9('0x51')]['id']){delete _0x413ac2[_0xfcd9('0x51')]['id'];}_0x413ac2['body'][_0xfcd9('0x55')]=!![];_0x413ac2[_0xfcd9('0x51')][_0xfcd9('0x56')]=moment()[_0xfcd9('0x57')](_0xfcd9('0x58'));_0x413ac2['body'][_0xfcd9('0x59')]=_0x413ac2['body'][_0xfcd9('0x59')]||_0x413ac2['user']['id'];_0x28f48c[_0xfcd9('0x5a')]['id']=_0x413ac2[_0xfcd9('0x51')]['UserId'];return db[_0xfcd9('0x34')][_0xfcd9('0x50')]({'where':{'id':_0x413ac2['params']['id'],'UserId':null}})[_0xfcd9('0x1d')](handleEntityNotFound(_0x767853,null))[_0xfcd9('0x1d')](saveUpdates(_0x413ac2[_0xfcd9('0x51')],null))[_0xfcd9('0x1d')](function(_0x36f41f){if(_0x36f41f){_0x28f48c['message']=_0x36f41f[_0xfcd9('0x5b')]({'plain':!![]});return db[_0xfcd9('0x5c')][_0xfcd9('0x50')]({'where':{'id':_0x36f41f[_0xfcd9('0x5d')]}});}return null;})[_0xfcd9('0x1d')](handleEntityNotFound(_0x767853,null))[_0xfcd9('0x1d')](function(_0x1150c6){if(_0x1150c6){return _0x1150c6[_0xfcd9('0x2e')]({'UserId':_0x413ac2[_0xfcd9('0x51')][_0xfcd9('0x59')],'read1stAt':_[_0xfcd9('0x5e')](_0x1150c6[_0xfcd9('0x5f')])?moment()[_0xfcd9('0x57')](_0xfcd9('0x58')):undefined});}return null;})[_0xfcd9('0x1d')](function(_0x5cd3e9){if(_0x5cd3e9){_0x28f48c[_0xfcd9('0x60')]=_0x5cd3e9[_0xfcd9('0x5b')]({'plain':!![]});interaction_log[_0xfcd9('0x1e')](_0xfcd9('0x61'),_0x413ac2['user']['id'],_0x413ac2[_0xfcd9('0x62')][_0xfcd9('0x32')],_0x413ac2[_0xfcd9('0x62')][_0xfcd9('0x63')],_0x28f48c['interaction']['id'],_0x413ac2['body']?JSON[_0xfcd9('0x21')](_0x413ac2['body']):'null');return respondWithRpcPromise(_0xfcd9('0x64'),'acceptMessage',_0x28f48c);}return null;})[_0xfcd9('0x1d')](function(_0x1993a2){var _0x49d503=_0xfcd9('0x65')+_0x1993a2[_0xfcd9('0x23')][_0xfcd9('0x66')];return db['sequelize'][_0xfcd9('0x39')](_0x49d503,{'type':db[_0xfcd9('0x67')][_0xfcd9('0x68')][_0xfcd9('0x69')],'raw':!![]})[_0xfcd9('0x1d')](function(_0x4f64d1){return _0x4f64d1;});})[_0xfcd9('0x1d')](function(_0x1dee0a){if(_0x1dee0a){_0x28f48c['message']['contact']=_0x1dee0a[0x0];if(!_0x413ac2['body']['UserId'])return;return db[_0xfcd9('0x6a')][_0xfcd9('0x50')]({'where':{'id':_0x413ac2['body']['UserId'],'role':_0xfcd9('0x5a')},'attributes':['id',_0xfcd9('0x32'),'fullname',_0xfcd9('0x6b'),_0xfcd9('0x6c')],'raw':!![]});}return null;})['then'](function(_0x511226){if(!_0x511226)return null;_0x28f48c[_0xfcd9('0x23')]['agent']=_0x511226;return _0x28f48c;})[_0xfcd9('0x1d')](function(_0x20353b){if(_0x20353b){if(_0x413ac2['body'][_0xfcd9('0x6d')]){_0x28f48c[_0xfcd9('0x23')][_0xfcd9('0x6e')]=util[_0xfcd9('0x57')](_0xfcd9('0x6f'),_0x413ac2[_0xfcd9('0x62')][_0xfcd9('0x32')]);_0x28f48c['message'][_0xfcd9('0x70')]=_0x28f48c[_0xfcd9('0x70')];_0x28f48c[_0xfcd9('0x23')][_0xfcd9('0x71')]=_0x28f48c['channel'];_0x28f48c[_0xfcd9('0x23')][_0xfcd9('0x72')]=_0xfcd9('0x73');return respondWithRpcPromise(_0xfcd9('0x74'),_0xfcd9('0x74'),{'event':_0xfcd9('0x75'),'message':_0x28f48c[_0xfcd9('0x23')]},client9002)[_0xfcd9('0x1d')](function(){return _0x28f48c;});}return _0x28f48c;}return null;})[_0xfcd9('0x1d')](respondWithResult(_0x767853,null))['catch'](handleError(_0x767853,null));};var interaction_log=require('../../config/logger')(_0xfcd9('0x53'));exports[_0xfcd9('0x2c')]=function(_0x3fc379,_0x473f0f,_0x1e1958){var _0xa5c47a={'agent':{},'channel':'fax'};if(_0x3fc379[_0xfcd9('0x51')]['id']){delete _0x3fc379[_0xfcd9('0x51')]['id'];}_0x3fc379[_0xfcd9('0x51')][_0xfcd9('0x59')]=_0x3fc379[_0xfcd9('0x51')][_0xfcd9('0x59')]||_0x3fc379['user']['id'];_0xa5c47a[_0xfcd9('0x5a')]['id']=_0x3fc379[_0xfcd9('0x51')]['UserId'];return db[_0xfcd9('0x34')][_0xfcd9('0x50')]({'where':{'id':_0x3fc379[_0xfcd9('0x4e')]['id'],'UserId':null}})[_0xfcd9('0x1d')](handleEntityNotFound(_0x473f0f,null))[_0xfcd9('0x1d')](function(_0x160cab){if(_0x160cab){_0xa5c47a[_0xfcd9('0x23')]=_0x160cab[_0xfcd9('0x5b')]({'plain':!![]});return db[_0xfcd9('0x5c')][_0xfcd9('0x50')]({'where':{'id':_0x160cab['FaxInteractionId']}});}return null;})[_0xfcd9('0x1d')](handleEntityNotFound(_0x473f0f,null))[_0xfcd9('0x1d')](function(_0x21e50f){if(_0x21e50f){_0xa5c47a[_0xfcd9('0x60')]=_0x21e50f[_0xfcd9('0x5b')]({'plain':!![]});interaction_log[_0xfcd9('0x1e')](_0xfcd9('0x76'),_0x3fc379[_0xfcd9('0x62')]['id'],_0x3fc379['user'][_0xfcd9('0x32')],_0x3fc379[_0xfcd9('0x62')][_0xfcd9('0x63')],_0xa5c47a[_0xfcd9('0x60')]['id'],_0x3fc379[_0xfcd9('0x51')]?JSON[_0xfcd9('0x21')](_0x3fc379[_0xfcd9('0x51')]):_0xfcd9('0x77'));return respondWithRpcPromise(_0xfcd9('0x78'),'rejectMessage',_0xa5c47a);}return null;})[_0xfcd9('0x1d')](function(_0x5583c){var _0x56d8ef=_0xfcd9('0x65')+_0x5583c[_0xfcd9('0x23')][_0xfcd9('0x66')];return db[_0xfcd9('0x79')][_0xfcd9('0x39')](_0x56d8ef,{'type':db[_0xfcd9('0x67')][_0xfcd9('0x68')][_0xfcd9('0x69')],'raw':!![]})['then'](function(_0xe9bcb3){return _0xe9bcb3;});})[_0xfcd9('0x1d')](function(_0x584db2){if(_0x584db2){_0xa5c47a[_0xfcd9('0x23')][_0xfcd9('0x7a')]=_0x584db2[0x0];if(!_0x3fc379[_0xfcd9('0x51')][_0xfcd9('0x59')])return;return db[_0xfcd9('0x6a')][_0xfcd9('0x50')]({'where':{'id':_0x3fc379[_0xfcd9('0x51')]['UserId'],'role':_0xfcd9('0x5a')},'attributes':['id','name','fullname','email',_0xfcd9('0x6c')],'raw':!![]});}return null;})['then'](function(_0xf9257f){if(!_0xf9257f)return null;_0xa5c47a[_0xfcd9('0x23')][_0xfcd9('0x5a')]=_0xf9257f;return _0xa5c47a;})[_0xfcd9('0x1d')](function(_0x4466b1){if(_0x4466b1){_0x4466b1[_0xfcd9('0x23')][_0xfcd9('0x6e')]=util['format'](_0xfcd9('0x6f'),_0x3fc379[_0xfcd9('0x62')][_0xfcd9('0x32')]);_0x4466b1[_0xfcd9('0x23')][_0xfcd9('0x70')]=_0xa5c47a['channel'];_0x4466b1['message'][_0xfcd9('0x71')]=_0xa5c47a[_0xfcd9('0x70')];_0x4466b1[_0xfcd9('0x23')][_0xfcd9('0x72')]=_0xfcd9('0x2c');respondWithRpcPromise(_0xfcd9('0x74'),_0xfcd9('0x74'),{'event':_0xfcd9('0x7b'),'message':_0x4466b1[_0xfcd9('0x23')]},client9002);return _0xa5c47a;}return null;})[_0xfcd9('0x1d')](respondWithResult(_0x473f0f,null))[_0xfcd9('0x4c')](handleError(_0x473f0f,null));};exports[_0xfcd9('0x7c')]=function(_0x25ddc5,_0x417e34){var _0x468bf0;return db[_0xfcd9('0x34')][_0xfcd9('0x7c')](_0x25ddc5['body'],{})[_0xfcd9('0x1d')](function(_0x24edce){_0x468bf0=_0x24edce;return db[_0xfcd9('0x7d')]['findOne']({'where':{'id':_0x468bf0[_0xfcd9('0x66')]}});})[_0xfcd9('0x1d')](function(_0xfff894){if(_[_0xfcd9('0x5e')](_0xfff894)){return;}else{_0x468bf0[_0xfcd9('0x54')]=_0xfff894['fax'];return db['Attachment'][_0xfcd9('0x7e')]({'where':{'id':_0x468bf0[_0xfcd9('0x7f')]}});}})[_0xfcd9('0x1d')](function(_0x56c006){return respondWithRpcPromise(_0xfcd9('0x80'),'SendFax',{'FaxAccountId':_['isNil'](_0x25ddc5[_0xfcd9('0x51')])?undefined:_0x25ddc5[_0xfcd9('0x51')][_0xfcd9('0x81')],'path':_[_0xfcd9('0x5e')](_0x56c006)?undefined:util[_0xfcd9('0x57')](_0xfcd9('0x82'),_0x56c006[_0xfcd9('0x83')]),'fax':_['isNil'](_0x468bf0[_0xfcd9('0x54')])?undefined:_0x468bf0[_0xfcd9('0x54')],'AttachmentId':_0x468bf0[_0xfcd9('0x7f')]},client9002);})[_0xfcd9('0x1d')](respondWithResult(_0x417e34,0xc9))[_0xfcd9('0x4c')](handleError(_0x417e34,null));};exports[_0xfcd9('0x84')]=function(_0x51ff50,_0x119801){var _0x583d91=path[_0xfcd9('0x85')](config[_0xfcd9('0x86')],_0xfcd9('0x87'),'files',_0xfcd9('0x88'));return db[_0xfcd9('0x34')][_0xfcd9('0x50')]({'where':{'id':_0x51ff50[_0xfcd9('0x4e')]['id']},'include':[{'model':db[_0xfcd9('0x89')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x119801,null))[_0xfcd9('0x1d')](function(_0x2beac8){if(_0x2beac8){return _0x119801['download'](path[_0xfcd9('0x85')](_0x583d91,_0x2beac8[_0xfcd9('0x89')][_0xfcd9('0x83')]));}})[_0xfcd9('0x4c')](handleError(_0x119801,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 61272d4..f3c932a 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 _0x147b=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4fb334,_0x4ca8c9){var _0x56dc84=function(_0x470d7b){while(--_0x470d7b){_0x4fb334['push'](_0x4fb334['shift']());}};_0x56dc84(++_0x4ca8c9);}(_0x147b,0x193));var _0xb147=function(_0x46306f,_0x5aef14){_0x46306f=_0x46306f-0x0;var _0x16a27f=_0x147b[_0x46306f];return _0x16a27f;};'use strict';var EventEmitter=require(_0xb147('0x0'));var FaxMessage=require(_0xb147('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb147('0x2')](0x0);var events={'afterCreate':_0xb147('0x3'),'afterUpdate':'update','afterDestroy':_0xb147('0x4')};function emitEvent(_0x2ff391){return function(_0x22eea5,_0x5f457b,_0x10b93f){FaxMessageEvents['emit'](_0x2ff391+':'+_0x22eea5['id'],_0x22eea5);FaxMessageEvents[_0xb147('0x5')](_0x2ff391,_0x22eea5);_0x10b93f(null);};}for(var e in events){if(events[_0xb147('0x6')](e)){var event=events[e];FaxMessage[_0xb147('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xeda8=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xeda8,0x104));var _0x8eda=function(_0x96776d,_0x40902c){_0x96776d=_0x96776d-0x0;var _0x3e015b=_0xeda8[_0x96776d];return _0x3e015b;};'use strict';var EventEmitter=require(_0x8eda('0x0'));var FaxMessage=require(_0x8eda('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8eda('0x2')](0x0);var events={'afterCreate':_0x8eda('0x3'),'afterUpdate':_0x8eda('0x4'),'afterDestroy':_0x8eda('0x5')};function emitEvent(_0x37ab2c){return function(_0x94b83f,_0x25b19a,_0x3eb7b1){FaxMessageEvents[_0x8eda('0x6')](_0x37ab2c+':'+_0x94b83f['id'],_0x94b83f);FaxMessageEvents[_0x8eda('0x6')](_0x37ab2c,_0x94b83f);_0x3eb7b1(null);};}for(var e in events){if(events[_0x8eda('0x7')](e)){var event=events[e];FaxMessage[_0x8eda('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index af15ad2..a251889 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 _0x6fab=['rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','then','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path'];(function(_0xcb5252,_0x58f6d1){var _0x456676=function(_0x382e4d){while(--_0x382e4d){_0xcb5252['push'](_0xcb5252['shift']());}};_0x456676(++_0x58f6d1);}(_0x6fab,0x175));var _0xb6fa=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x6fab[_0xf51c06];return _0x1d5420;};'use strict';var _=require('lodash');var util=require(_0xb6fa('0x0'));var logger=require(_0xb6fa('0x1'))('api');var moment=require(_0xb6fa('0x2'));var BPromise=require(_0xb6fa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6fa('0x4'));var rimraf=require(_0xb6fa('0x5'));var config=require(_0xb6fa('0x6'));var attributes=require(_0xb6fa('0x7'));module[_0xb6fa('0x8')]=function(_0x3f9676,_0x2b0ab2){return _0x3f9676[_0xb6fa('0x9')](_0xb6fa('0xa'),attributes,{'tableName':_0xb6fa('0xb'),'paranoid':![],'indexes':[{'name':_0xb6fa('0xc'),'fields':['body'],'type':_0xb6fa('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x467c33,_0x327632,_0x264913){var _0x583b71=_0x3f9676[_0xb6fa('0xe')];var _0x34cacd=_0x467c33[_0xb6fa('0xf')]({'plain':!![]});if(_0x34cacd[_0xb6fa('0x10')][_0xb6fa('0x11')]()==='in'||_0x34cacd['direction'][_0xb6fa('0x11')]()==='out'&&!_0x34cacd[_0xb6fa('0x12')]&&!_[_0xb6fa('0x13')](_0x34cacd[_0xb6fa('0x14')])){_0x583b71[_0xb6fa('0x15')][_0xb6fa('0x16')]({'where':{'id':_0x34cacd['FaxInteractionId']}})[_0xb6fa('0x17')](function(_0x3553a6){if(_0x3553a6){_0x3553a6['update']({'lastMsgAt':_0x34cacd['createdAt'],'lastMsgDirection':_0x34cacd[_0xb6fa('0x10')]['toLowerCase']()});}})['catch'](function(_0xcb1978){console[_0xb6fa('0x18')](_0xcb1978);});}_0x264913();}},'charset':_0xb6fa('0x19'),'collate':_0xb6fa('0x1a')});}; \ No newline at end of file +var _0x4998=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','UserId','FaxInteraction','findOne','update'];(function(_0x2751cd,_0x577ff2){var _0x1bd43a=function(_0x4ac90a){while(--_0x4ac90a){_0x2751cd['push'](_0x2751cd['shift']());}};_0x1bd43a(++_0x577ff2);}(_0x4998,0xe5));var _0x8499=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x4998[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x8499('0x0'));var util=require(_0x8499('0x1'));var logger=require(_0x8499('0x2'))(_0x8499('0x3'));var moment=require(_0x8499('0x4'));var BPromise=require(_0x8499('0x5'));var rp=require(_0x8499('0x6'));var fs=require('fs');var path=require(_0x8499('0x7'));var rimraf=require(_0x8499('0x8'));var config=require('../../config/environment');var attributes=require(_0x8499('0x9'));module[_0x8499('0xa')]=function(_0x4ca613,_0x59e2fa){return _0x4ca613[_0x8499('0xb')](_0x8499('0xc'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x8499('0xd'),'fields':[_0x8499('0xe')],'type':_0x8499('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7da5b1,_0x719583,_0x586e21){var _0x598517=_0x4ca613['models'];var _0x587b10=_0x7da5b1[_0x8499('0x10')]({'plain':!![]});if(_0x587b10[_0x8499('0x11')][_0x8499('0x12')]()==='in'||_0x587b10[_0x8499('0x11')]['toLowerCase']()==='out'&&!_0x587b10['secret']&&!_['isNil'](_0x587b10[_0x8499('0x13')])){_0x598517[_0x8499('0x14')][_0x8499('0x15')]({'where':{'id':_0x587b10['FaxInteractionId']}})['then'](function(_0xa70e1){if(_0xa70e1){_0xa70e1[_0x8499('0x16')]({'lastMsgAt':_0x587b10[_0x8499('0x17')],'lastMsgDirection':_0x587b10['direction']['toLowerCase']()});}})[_0x8499('0x18')](function(_0x2f24eb){console[_0x8499('0x19')](_0x2f24eb);});}_0x586e21();}},'charset':_0x8499('0x1a'),'collate':_0x8499('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 86c581c..8427435 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 _0xb903=['options','raw','then','stringify','UpdateFaxMessage','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body'];(function(_0x4958ec,_0x594e08){var _0x367443=function(_0x542f74){while(--_0x542f74){_0x4958ec['push'](_0x4958ec['shift']());}};_0x367443(++_0x594e08);}(_0xb903,0x185));var _0x3b90=function(_0x2d24a1,_0x2a9341){_0x2d24a1=_0x2d24a1-0x0;var _0xa1dc5e=_0xb903[_0x2d24a1];return _0xa1dc5e;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3b90('0xc')],{'host':_0x3b90('0xd'),'port':0x18eb});var socket=require(_0x3b90('0xe'))(new Redis(config[_0x3b90('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x52401e,_0x51f916,_0x56261b){return new BPromise(function(_0x55db3f,_0x336913){return client[_0x3b90('0xf')](_0x52401e,_0x56261b)['then'](function(_0x30c49c){logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));logger[_0x3b90('0x12')](_0x3b90('0x13'),_0x51f916,'request\x20sent',JSON['stringify'](_0x30c49c));if(_0x30c49c[_0x3b90('0x14')]){if(_0x30c49c['error']['code']===0x1f4){logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c['error']['message']);return _0x336913(_0x30c49c[_0x3b90('0x14')][_0x3b90('0x16')]);}logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c[_0x3b90('0x14')]['message']);return _0x55db3f(_0x30c49c['error'][_0x3b90('0x16')]);}else{logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));_0x55db3f(_0x30c49c[_0x3b90('0x17')][_0x3b90('0x16')]);}})[_0x3b90('0x18')](function(_0x4f388b){logger[_0x3b90('0x14')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x4f388b);_0x336913(_0x4f388b);});});}exports[_0x3b90('0x19')]=function(_0x231690){var _0x535894=this;return new Promise(function(_0x39ae7c,_0x12e1cf){return db[_0x3b90('0x1a')][_0x3b90('0x1b')](_0x231690[_0x3b90('0x1c')],{'raw':_0x231690[_0x3b90('0x1d')]?_0x231690[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![]})[_0x3b90('0x1f')](function(_0x3e5bb8){logger['info'](_0x3b90('0x19'),_0x231690);logger[_0x3b90('0x12')](_0x3b90('0x19'),_0x231690,JSON[_0x3b90('0x20')](_0x3e5bb8));_0x39ae7c(_0x3e5bb8);})[_0x3b90('0x18')](function(_0x93b8e7){logger['error']('CreateFaxMessage',_0x93b8e7[_0x3b90('0x16')],_0x231690);_0x12e1cf(_0x535894[_0x3b90('0x14')](0x1f4,_0x93b8e7[_0x3b90('0x16')]));});});};exports[_0x3b90('0x21')]=function(_0x583523){var _0x414462=this;return new Promise(function(_0x2936d7,_0x1787d1){return db['FaxMessage'][_0x3b90('0x22')](_0x583523[_0x3b90('0x1c')],{'raw':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583523[_0x3b90('0x1d')]?_0x583523['options'][_0x3b90('0x23')]||null:null,'attributes':_0x583523['options']?_0x583523[_0x3b90('0x1d')][_0x3b90('0x24')]||null:null,'limit':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x25')]||null:null})[_0x3b90('0x1f')](function(_0x290283){logger[_0x3b90('0x10')]('UpdateFaxMessage',_0x583523);logger['debug'](_0x3b90('0x21'),_0x583523,JSON[_0x3b90('0x20')](_0x290283));_0x2936d7(_0x290283);})[_0x3b90('0x18')](function(_0x1c2e84){logger['error']('UpdateFaxMessage',_0x1c2e84[_0x3b90('0x16')],_0x583523);_0x1787d1(_0x414462[_0x3b90('0x14')](0x1f4,_0x1c2e84[_0x3b90('0x16')]));});});}; \ No newline at end of file +var _0xdace=['FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','debug'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xdace,0xc5));var _0xedac=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xdace[_0x432fca];return _0x3adba4;};'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});config['redis']=_[_0xedac('0xb')](config[_0xedac('0xc')],{'host':_0xedac('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedac('0xc')]));require(_0xedac('0xe'))[_0xedac('0xf')](socket);function respondWithRpcPromise(_0x4af030,_0x5e188c,_0x144368){return new BPromise(function(_0x2ea11d,_0x57e1bf){return client['request'](_0x4af030,_0x144368)[_0xedac('0x10')](function(_0x25395d){logger['info'](_0xedac('0x11'),_0x5e188c,'request\x20sent');logger[_0xedac('0x12')](_0xedac('0x13'),_0x5e188c,_0xedac('0x14'),JSON[_0xedac('0x15')](_0x25395d));if(_0x25395d[_0xedac('0x16')]){if(_0x25395d[_0xedac('0x16')][_0xedac('0x17')]===0x1f4){logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);return _0x57e1bf(_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);}logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25395d[_0xedac('0x16')]['message']);return _0x2ea11d(_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);}else{logger[_0xedac('0x19')](_0xedac('0x11'),_0x5e188c,'request\x20sent');_0x2ea11d(_0x25395d['result'][_0xedac('0x18')]);}})[_0xedac('0x1a')](function(_0x25fe64){logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25fe64);_0x57e1bf(_0x25fe64);});});}exports['CreateFaxMessage']=function(_0x2b2ae9){var _0x17766c=this;return new Promise(function(_0x23c609,_0xcc1605){return db[_0xedac('0x1b')][_0xedac('0x1c')](_0x2b2ae9[_0xedac('0x1d')],{'raw':_0x2b2ae9[_0xedac('0x1e')]?_0x2b2ae9['options'][_0xedac('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x29cd40){logger[_0xedac('0x19')]('CreateFaxMessage',_0x2b2ae9);logger[_0xedac('0x12')](_0xedac('0x20'),_0x2b2ae9,JSON[_0xedac('0x15')](_0x29cd40));_0x23c609(_0x29cd40);})[_0xedac('0x1a')](function(_0x6b13ca){logger[_0xedac('0x16')]('CreateFaxMessage',_0x6b13ca[_0xedac('0x18')],_0x2b2ae9);_0xcc1605(_0x17766c[_0xedac('0x16')](0x1f4,_0x6b13ca[_0xedac('0x18')]));});});};exports[_0xedac('0x21')]=function(_0x1ff33e){var _0x453a3c=this;return new Promise(function(_0x40ba53,_0x26c6f7){return db[_0xedac('0x1b')][_0xedac('0x22')](_0x1ff33e['body'],{'raw':_0x1ff33e[_0xedac('0x1e')]?_0x1ff33e[_0xedac('0x1e')][_0xedac('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff33e['options']?_0x1ff33e[_0xedac('0x1e')]['where']||null:null,'attributes':_0x1ff33e['options']?_0x1ff33e[_0xedac('0x1e')][_0xedac('0x23')]||null:null,'limit':_0x1ff33e[_0xedac('0x1e')]?_0x1ff33e[_0xedac('0x1e')]['limit']||null:null})['then'](function(_0xe813e6){logger[_0xedac('0x19')](_0xedac('0x21'),_0x1ff33e);logger[_0xedac('0x12')](_0xedac('0x21'),_0x1ff33e,JSON[_0xedac('0x15')](_0xe813e6));_0x40ba53(_0xe813e6);})[_0xedac('0x1a')](function(_0x483233){logger[_0xedac('0x16')](_0xedac('0x21'),_0x483233[_0xedac('0x18')],_0x1ff33e);_0x26c6f7(_0x453a3c['error'](0x1f4,_0x483233[_0xedac('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 407e195..75920c3 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 _0xf16d=['faxMessage:','./faxMessage.events','save','remove','emit','length'];(function(_0x184ae2,_0x5ca67b){var _0x538f2b=function(_0x32c520){while(--_0x32c520){_0x184ae2['push'](_0x184ae2['shift']());}};_0x538f2b(++_0x5ca67b);}(_0xf16d,0x13f));var _0xdf16=function(_0x127e2,_0x24417a){_0x127e2=_0x127e2-0x0;var _0xacfacd=_0xf16d[_0x127e2];return _0xacfacd;};'use strict';var FaxMessageEvents=require(_0xdf16('0x0'));var events=[_0xdf16('0x1'),_0xdf16('0x2'),'update'];function createListener(_0x50bcda,_0x43c3fd){return function(_0xb63a0c){_0x43c3fd[_0xdf16('0x3')](_0x50bcda,_0xb63a0c);};}function removeListener(_0x43996c,_0x216425){return function(){FaxMessageEvents['removeListener'](_0x43996c,_0x216425);};}exports['register']=function(_0x2e899f){for(var _0x502653=0x0,_0x1ea9e4=events[_0xdf16('0x4')];_0x502653<_0x1ea9e4;_0x502653++){var _0x5f002e=events[_0x502653];var _0x564fee=createListener(_0xdf16('0x5')+_0x5f002e,_0x2e899f);FaxMessageEvents['on'](_0x5f002e,_0x564fee);}}; \ No newline at end of file +var _0x2bcb=['faxMessage:','./faxMessage.events','update','emit','removeListener'];(function(_0x1933a1,_0x5ea5e1){var _0x362416=function(_0x24bee3){while(--_0x24bee3){_0x1933a1['push'](_0x1933a1['shift']());}};_0x362416(++_0x5ea5e1);}(_0x2bcb,0x1e6));var _0xb2bc=function(_0x44e80d,_0x4efd18){_0x44e80d=_0x44e80d-0x0;var _0x59169a=_0x2bcb[_0x44e80d];return _0x59169a;};'use strict';var FaxMessageEvents=require(_0xb2bc('0x0'));var events=['save','remove',_0xb2bc('0x1')];function createListener(_0x3199ba,_0xd1cf2a){return function(_0x1f831e){_0xd1cf2a[_0xb2bc('0x2')](_0x3199ba,_0x1f831e);};}function removeListener(_0x5ef804,_0x41b169){return function(){FaxMessageEvents[_0xb2bc('0x3')](_0x5ef804,_0x41b169);};}exports['register']=function(_0x27d57b){for(var _0x38dbcf=0x0,_0x4eb8b2=events['length'];_0x38dbcf<_0x4eb8b2;_0x38dbcf++){var _0x1ec761=events[_0x38dbcf];var _0x331d45=createListener(_0xb2bc('0x4')+_0x1ec761,_0x27d57b);FaxMessageEvents['on'](_0x1ec761,_0x331d45);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 8d81219..d7626c6 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 _0x9bde=['index','/describe','isAuthenticated','describe','/:id','show','download','post','fax','faxmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get'];(function(_0x1be814,_0x475cfe){var _0x22eee5=function(_0x5928f9){while(--_0x5928f9){_0x1be814['push'](_0x1be814['shift']());}};_0x22eee5(++_0x475cfe);}(_0x9bde,0xe1));var _0xe9bd=function(_0x22b550,_0x10ab61){_0x22b550=_0x22b550-0x0;var _0x3da430=_0x9bde[_0x22b550];return _0x3da430;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xe9bd('0xf')]);router[_0xe9bd('0x10')]('/',auth[_0xe9bd('0xb')](),interaction['tracked'](_0xe9bd('0x11'),_0xe9bd('0x12')),controller[_0xe9bd('0x13')]);router[_0xe9bd('0x14')]('/:id',auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x14')](_0xe9bd('0x15'),auth[_0xe9bd('0xb')](),controller['accept']);router['put'](_0xe9bd('0x16'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x17')]);router[_0xe9bd('0x18')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x19')]);module['exports']=router; \ No newline at end of file +var _0x9aea=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express'];(function(_0x1791cb,_0x4de9ca){var _0x29963f=function(_0x35a43d){while(--_0x35a43d){_0x1791cb['push'](_0x1791cb['shift']());}};_0x29963f(++_0x4de9ca);}(_0x9aea,0xdd));var _0xa9ae=function(_0x468c97,_0x48197c){_0x468c97=_0x468c97-0x0;var _0x1ebac3=_0x9aea[_0x468c97];return _0x1ebac3;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require('util');var path=require(_0xa9ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9ae('0x2'));var router=express[_0xa9ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ae('0x4'));var interaction=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var controller=require(_0xa9ae('0x7'));router[_0xa9ae('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9ae('0x9')]);router[_0xa9ae('0x8')](_0xa9ae('0xa'),auth['isAuthenticated'](),controller[_0xa9ae('0xb')]);router[_0xa9ae('0x8')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0xe')]);router[_0xa9ae('0x8')](_0xa9ae('0xf'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x10')]);router['post']('/',auth[_0xa9ae('0xd')](),interaction['tracked'](_0xa9ae('0x11'),_0xa9ae('0x12')),controller[_0xa9ae('0x13')]);router[_0xa9ae('0x14')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x15')]);router[_0xa9ae('0x14')]('/:id/accept',auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x16')]);router[_0xa9ae('0x14')](_0xa9ae('0x17'),auth['isAuthenticated'](),controller[_0xa9ae('0x18')]);router[_0xa9ae('0x19')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x1a')]);module[_0xa9ae('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 3c2aec6..f39d47e 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 _0x8710=['exports','name','STRING','INTEGER','rrmemory','beepall','sequelize'];(function(_0x5d7747,_0x55c074){var _0x291142=function(_0x221f7d){while(--_0x221f7d){_0x5d7747['push'](_0x5d7747['shift']());}};_0x291142(++_0x55c074);}(_0x8710,0x68));var _0x0871=function(_0x2bb783,_0x20576e){_0x2bb783=_0x2bb783-0x0;var _0x5c5fe1=_0x8710[_0x2bb783];return _0x5c5fe1;};'use strict';var Sequelize=require(_0x0871('0x0'));module[_0x0871('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0871('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0871('0x3')]},'timeout':{'type':Sequelize[_0x0871('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0871('0x5'),_0x0871('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0871('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc48d=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xc48d,0x11a));var _0xdc48=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xc48d[_0x470bfb];return _0x2f5d97;};'use strict';var Sequelize=require(_0xdc48('0x0'));module[_0xdc48('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdc48('0x2')]},'timeout':{'type':Sequelize[_0xdc48('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdc48('0x4')](_0xdc48('0x5'),_0xdc48('0x6'),_0xdc48('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xdc48('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 ad95052..8cb6513 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 _0x11e5=['ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','FaxQueues','UserProfileResource','destroy','then','error','stack','name','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','rows','show','model','keys','query','filters','attributes','intersection','length','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','params','UserFaxQueue','fields','hasOwnProperty','nolimit','sort','where','pick','FaxQueueId','filter','User','findAndCountAll','UserId','faxPause','format','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone'];(function(_0x13c890,_0xffea04){var _0x4bbbae=function(_0x1cfa34){while(--_0x1cfa34){_0x13c890['push'](_0x13c890['shift']());}};_0x4bbbae(++_0xffea04);}(_0x11e5,0x8b));var _0x511e=function(_0x5463c2,_0x22c4cc){_0x5463c2=_0x5463c2-0x0;var _0x5a7da7=_0x11e5[_0x5463c2];return _0x5a7da7;};'use strict';var BPromise=require(_0x511e('0x0'));var util=require('util');var _=require(_0x511e('0x1'));var squel=require(_0x511e('0x2'));var Redis=require('ioredis');var qs=require(_0x511e('0x3'));var logger=require(_0x511e('0x4'))(_0x511e('0x5'));var config=require('../../config/environment');var db=require(_0x511e('0x6'))['db'];config['redis']=_['defaults'](config[_0x511e('0x7')],{'host':_0x511e('0x8'),'port':0x18eb});var socket=require(_0x511e('0x9'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x511e('0xa')](socket);function respondWithStatusCode(_0xf0ba86,_0x25deeb){_0x25deeb=_0x25deeb||0xcc;return function(_0x306694){if(_0x306694){return _0xf0ba86[_0x511e('0xb')](_0x25deeb);}return _0xf0ba86[_0x511e('0xc')](_0x25deeb)[_0x511e('0xd')]();};}function respondWithResult(_0x50564b,_0x2f547a){_0x2f547a=_0x2f547a||0xc8;return function(_0x1c6def){if(_0x1c6def){return _0x50564b[_0x511e('0xc')](_0x2f547a)['json'](_0x1c6def);}};}function respondWithFilteredResult(_0x7e50db,_0x5dd510){return function(_0x4d041f){if(_0x4d041f){var _0x3deecc=typeof _0x5dd510[_0x511e('0xe')]===_0x511e('0xf')&&typeof _0x5dd510[_0x511e('0x10')]===_0x511e('0xf');var _0x7dc1bc=_0x4d041f['count'];var _0xdd0dcd=_0x3deecc?0x0:_0x5dd510[_0x511e('0xe')];var _0x4e6507=_0x3deecc?_0x4d041f[_0x511e('0x11')]:_0x5dd510[_0x511e('0xe')]+_0x5dd510['limit'];var _0xed773e;if(_0x4e6507>=_0x7dc1bc){_0x4e6507=_0x7dc1bc;_0xed773e=0xc8;}else{_0xed773e=0xce;}_0x7e50db[_0x511e('0xc')](_0xed773e);return _0x7e50db[_0x511e('0x12')](_0x511e('0x13'),_0xdd0dcd+'-'+_0x4e6507+'/'+_0x7dc1bc)['json'](_0x4d041f);}return null;};}function saveUpdates(_0x3e0415){return function(_0x2dd346){if(_0x2dd346){return _0x2dd346[_0x511e('0x14')](_0x3e0415)['then'](function(_0x26af67){return _0x26af67;});}return null;};}function removeEntity(_0x5bd814){return function(_0x34e6cd){if(_0x34e6cd){return _0x34e6cd['destroy']()['then'](function(){var _0x37ae92=_0x34e6cd['get']({'plain':!![]});var _0x33bef5=_0x511e('0x15');return db[_0x511e('0x16')][_0x511e('0x17')]({'where':{'type':_0x33bef5,'resourceId':_0x37ae92['id']}})[_0x511e('0x18')](function(){return _0x34e6cd;});})[_0x511e('0x18')](function(){_0x5bd814[_0x511e('0xc')](0xcc)[_0x511e('0xd')]();});}};}function handleEntityNotFound(_0x4a8067){return function(_0x1e2b41){if(!_0x1e2b41){_0x4a8067[_0x511e('0xb')](0x194);}return _0x1e2b41;};}function handleError(_0x2ebf30,_0x1a273b){_0x1a273b=_0x1a273b||0x1f4;return function(_0xaea29d){logger[_0x511e('0x19')](_0xaea29d[_0x511e('0x1a')]);if(_0xaea29d[_0x511e('0x1b')]){delete _0xaea29d[_0x511e('0x1b')];}_0x2ebf30[_0x511e('0xc')](_0x1a273b)['send'](_0xaea29d);};}exports['index']=function(_0x3e1711,_0x4d94a1){var _0x1ff5c4={};var _0x53017d={'count':0x0,'rows':[]};var _0x3fbd19=_[_0x511e('0x1c')](db[_0x511e('0x1d')][_0x511e('0x1e')],function(_0x1bb7f9){return{'name':_0x1bb7f9[_0x511e('0x1f')],'type':_0x1bb7f9[_0x511e('0x20')][_0x511e('0x21')]};});_0x1ff5c4=qs[_0x511e('0x22')](_0x3fbd19,_0x3e1711);var _0x2451c2={'where':_0x1ff5c4['where']};return db[_0x511e('0x1d')][_0x511e('0x11')](_0x2451c2)[_0x511e('0x18')](function(_0x1aaac1){_0x53017d[_0x511e('0x11')]=_0x1aaac1;_0x1ff5c4['include']=qs[_0x511e('0x23')](_0x3e1711['query']);return db['FaxQueue'][_0x511e('0x24')](_0x1ff5c4);})[_0x511e('0x18')](function(_0xa3b110){_0x53017d[_0x511e('0x25')]=_0xa3b110;return _0x53017d;})[_0x511e('0x18')](respondWithFilteredResult(_0x4d94a1,_0x1ff5c4))['catch'](handleError(_0x4d94a1,null));};exports[_0x511e('0x26')]=function(_0x2e6529,_0xf2a22){var _0x32be08={'raw':!![],'where':{'id':_0x2e6529['params']['id']}},_0x43c95f={};_0x43c95f[_0x511e('0x27')]=_[_0x511e('0x28')](db[_0x511e('0x1d')][_0x511e('0x1e')]);_0x43c95f[_0x511e('0x29')]=_[_0x511e('0x28')](_0x2e6529[_0x511e('0x29')]);_0x43c95f[_0x511e('0x2a')]=_['intersection'](_0x43c95f[_0x511e('0x27')],_0x43c95f[_0x511e('0x29')]);_0x32be08[_0x511e('0x2b')]=_[_0x511e('0x2c')](_0x43c95f['model'],qs['fields'](_0x2e6529[_0x511e('0x29')]['fields']));_0x32be08['attributes']=_0x32be08[_0x511e('0x2b')][_0x511e('0x2d')]?_0x32be08[_0x511e('0x2b')]:_0x43c95f[_0x511e('0x27')];if(_0x2e6529[_0x511e('0x29')]['includeAll']){_0x32be08[_0x511e('0x23')]=[{'all':!![]}];}_0x32be08=_[_0x511e('0x2e')]({},_0x32be08,_0x2e6529[_0x511e('0x2f')]);return db['FaxQueue'][_0x511e('0x30')](_0x32be08)[_0x511e('0x18')](handleEntityNotFound(_0xf2a22,null))[_0x511e('0x18')](respondWithResult(_0xf2a22,null))['catch'](handleError(_0xf2a22,null));};exports[_0x511e('0x31')]=function(_0x2fd83d,_0x4f124f){return db[_0x511e('0x1d')][_0x511e('0x31')](_0x2fd83d[_0x511e('0x32')],{})[_0x511e('0x18')](function(_0xb1603e){var _0x1a989a=_0x2fd83d[_0x511e('0x33')][_0x511e('0x34')]({'plain':!![]});if(!_0x1a989a)throw new Error(_0x511e('0x35'));if(_0x1a989a[_0x511e('0x36')]===_0x511e('0x33')){var _0x4f1f1d=_0xb1603e[_0x511e('0x34')]({'plain':!![]});var _0x5dc823='FaxQueues';return db[_0x511e('0x37')]['find']({'where':{'name':_0x5dc823,'userProfileId':_0x1a989a['userProfileId']},'raw':!![]})[_0x511e('0x18')](function(_0x200207){if(_0x200207&&_0x200207[_0x511e('0x38')]===0x0){return db[_0x511e('0x16')][_0x511e('0x31')]({'name':_0x4f1f1d[_0x511e('0x1b')],'resourceId':_0x4f1f1d['id'],'type':_0x200207[_0x511e('0x1b')],'sectionId':_0x200207['id']},{})[_0x511e('0x18')](function(){return _0xb1603e;});}else{return _0xb1603e;}})[_0x511e('0x39')](function(_0x396542){logger[_0x511e('0x19')](_0x511e('0x3a'),_0x396542);throw _0x396542;});}return _0xb1603e;})[_0x511e('0x18')](respondWithResult(_0x4f124f,0xc9))[_0x511e('0x39')](handleError(_0x4f124f,null));};exports['update']=function(_0x5a7a12,_0x19ffde){if(_0x5a7a12[_0x511e('0x32')]['id']){delete _0x5a7a12[_0x511e('0x32')]['id'];}return db[_0x511e('0x1d')][_0x511e('0x30')]({'where':{'id':_0x5a7a12['params']['id']}})[_0x511e('0x18')](handleEntityNotFound(_0x19ffde,null))[_0x511e('0x18')](saveUpdates(_0x5a7a12[_0x511e('0x32')],null))['then'](respondWithResult(_0x19ffde,null))['catch'](handleError(_0x19ffde,null));};exports['destroy']=function(_0x311c5d,_0x20b859){return db[_0x511e('0x1d')]['find']({'where':{'id':_0x311c5d['params']['id']}})['then'](handleEntityNotFound(_0x20b859,null))[_0x511e('0x18')](removeEntity(_0x20b859,null))[_0x511e('0x39')](handleError(_0x20b859,null));};exports[_0x511e('0x3b')]=function(_0x1e6bc8,_0x40e017){return db[_0x511e('0x1d')][_0x511e('0x3b')]()[_0x511e('0x18')](respondWithResult(_0x40e017,null))[_0x511e('0x39')](handleError(_0x40e017,null));};exports[_0x511e('0x3c')]=function(_0x1a2e4,_0x354f06){var _0x19a6c8={'raw':!![],'where':{}},_0x411709={},_0x625454;return db[_0x511e('0x1d')][_0x511e('0x3d')]({'where':{'id':_0x1a2e4[_0x511e('0x3e')]['id']}})[_0x511e('0x18')](handleEntityNotFound(_0x354f06,null))[_0x511e('0x18')](function(_0x2a00a5){if(_0x2a00a5){_0x625454=_0x2a00a5[_0x511e('0x34')]({'plain':!![]});_0x411709[_0x511e('0x27')]=_[_0x511e('0x28')](db[_0x511e('0x3f')][_0x511e('0x1e')]);_0x411709[_0x511e('0x29')]=_[_0x511e('0x28')](_0x1a2e4[_0x511e('0x29')]);_0x411709[_0x511e('0x2a')]=_[_0x511e('0x2c')](_0x411709['model'],_0x411709[_0x511e('0x29')]);_0x19a6c8['attributes']=_[_0x511e('0x2c')](_0x411709[_0x511e('0x27')],qs[_0x511e('0x40')](_0x1a2e4['query'][_0x511e('0x40')]));_0x19a6c8[_0x511e('0x2b')]=_0x19a6c8[_0x511e('0x2b')]['length']?_0x19a6c8[_0x511e('0x2b')]:_0x411709[_0x511e('0x27')];if(!_0x1a2e4['query'][_0x511e('0x41')](_0x511e('0x42'))){_0x19a6c8[_0x511e('0x10')]=qs[_0x511e('0x10')](_0x1a2e4['query'][_0x511e('0x10')]);_0x19a6c8['offset']=qs[_0x511e('0xe')](_0x1a2e4[_0x511e('0x29')][_0x511e('0xe')]);}_0x19a6c8['order']=qs[_0x511e('0x43')](_0x1a2e4['query'][_0x511e('0x43')]);_0x19a6c8[_0x511e('0x44')]=qs[_0x511e('0x2a')](_[_0x511e('0x45')](_0x1a2e4[_0x511e('0x29')],_0x411709['filters']));_0x19a6c8[_0x511e('0x44')][_0x511e('0x46')]=_0x2a00a5['id'];if(_0x1a2e4[_0x511e('0x29')][_0x511e('0x47')]){_0x19a6c8[_0x511e('0x44')]=_[_0x511e('0x2e')](_0x19a6c8[_0x511e('0x44')],{'$or':_[_0x511e('0x1c')](_0x19a6c8['attributes'],function(_0x3f780c){var _0x2eb672={};_0x2eb672[_0x3f780c]={'$like':'%'+_0x1a2e4['query'][_0x511e('0x47')]+'%'};return _0x2eb672;})});}_0x19a6c8=_[_0x511e('0x2e')]({},_0x19a6c8,_0x1a2e4[_0x511e('0x2f')]);return db[_0x511e('0x3f')][_0x511e('0x24')](_0x19a6c8);}})[_0x511e('0x18')](function(_0x5d16e6){if(_0x5d16e6){return db[_0x511e('0x48')][_0x511e('0x49')]({'where':{'id':_['map'](_0x5d16e6,_0x511e('0x4a')),'role':'agent'},'attributes':['id',_0x511e('0x1b'),_0x511e('0x4b'),'updatedAt','createdAt']});}})['then'](function(_0x5a1511){if(_0x5a1511){return{'count':_0x5a1511[_0x511e('0x11')],'rows':_['map'](_0x5a1511['rows'],function(_0x14c28b){return{'membername':_0x14c28b[_0x511e('0x1b')],'UserId':_0x14c28b['id'],'queue_name':_0x625454['name'],'FaxQueueId':_0x625454['id'],'interface':util[_0x511e('0x4c')]('%s/%s',_0x511e('0x4d'),_0x14c28b['name']),'penalty':0x0,'paused':_0x14c28b['faxPause'],'createdAt':_0x14c28b['createdAt'],'updatedAt':_0x14c28b[_0x511e('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x511e('0x18')](respondWithFilteredResult(_0x354f06,_0x19a6c8))['catch'](handleError(_0x354f06,null));};exports['getTeams']=function(_0x51940a,_0x4f1e55){var _0x264470={};var _0x54d2b0={};var _0xb404bb;var _0x4e9ddd;return db[_0x511e('0x1d')][_0x511e('0x3d')]({'where':{'id':_0x51940a[_0x511e('0x3e')]['id']}})[_0x511e('0x18')](handleEntityNotFound(_0x4f1e55,null))['then'](function(_0x460a72){if(_0x460a72){_0xb404bb=_0x460a72;_0x54d2b0[_0x511e('0x27')]=_[_0x511e('0x28')](db[_0x511e('0x4f')][_0x511e('0x1e')]);_0x54d2b0['query']=_['keys'](_0x51940a[_0x511e('0x29')]);_0x54d2b0[_0x511e('0x2a')]=_[_0x511e('0x2c')](_0x54d2b0[_0x511e('0x27')],_0x54d2b0[_0x511e('0x29')]);_0x264470[_0x511e('0x2b')]=_[_0x511e('0x2c')](_0x54d2b0[_0x511e('0x27')],qs[_0x511e('0x40')](_0x51940a[_0x511e('0x29')]['fields']));_0x264470['attributes']=_0x264470['attributes'][_0x511e('0x2d')]?_0x264470['attributes']:_0x54d2b0[_0x511e('0x27')];_0x264470['order']=qs[_0x511e('0x43')](_0x51940a['query'][_0x511e('0x43')]);_0x264470[_0x511e('0x44')]=qs[_0x511e('0x2a')](_[_0x511e('0x45')](_0x51940a[_0x511e('0x29')],_0x54d2b0['filters']));if(_0x51940a[_0x511e('0x29')]['filter']){_0x264470[_0x511e('0x44')]=_[_0x511e('0x2e')](_0x264470[_0x511e('0x44')],{'$or':_['map'](_0x264470[_0x511e('0x2b')],function(_0x45eb71){var _0x376f1a={};_0x376f1a[_0x45eb71]={'$like':'%'+_0x51940a[_0x511e('0x29')]['filter']+'%'};return _0x376f1a;})});}_0x264470=_['merge']({},_0x264470,_0x51940a[_0x511e('0x2f')]);return _0xb404bb[_0x511e('0x50')](_0x264470);}})['then'](function(_0x2545d2){if(_0x2545d2){_0x4e9ddd=_0x2545d2['length'];if(!_0x51940a[_0x511e('0x29')][_0x511e('0x41')]('nolimit')){_0x264470['limit']=qs[_0x511e('0x10')](_0x51940a[_0x511e('0x29')][_0x511e('0x10')]);_0x264470['offset']=qs[_0x511e('0xe')](_0x51940a[_0x511e('0x29')][_0x511e('0xe')]);}return _0xb404bb[_0x511e('0x50')](_0x264470);}})[_0x511e('0x18')](function(_0x561d50){if(_0x561d50){return _0x561d50?{'count':_0x4e9ddd,'rows':_0x561d50}:null;}})[_0x511e('0x18')](respondWithResult(_0x4f1e55,null))['catch'](handleError(_0x4f1e55,null));};exports[_0x511e('0x51')]=function(_0x3fac95,_0x59daab){var _0x57c150=_0x3fac95[_0x511e('0x32')][_0x511e('0x52')];return db['Team'][_0x511e('0x24')]({'where':{'id':_0x57c150},'attributes':['id'],'include':[{'model':db['User'],'as':_0x511e('0x53'),'attributes':['id','name','online',_0x511e('0x54'),_0x511e('0x55')],'raw':!![]}]})[_0x511e('0x18')](function(_0x3a0284){if(_0x3a0284){var _0x42059c=_['flatMap'](_0x3a0284,function(_0x52ab0e){var _0x28e533=_0x52ab0e[_0x511e('0x34')]({'plain':!![]});return _0x28e533[_0x511e('0x53')];});return db['FaxQueue'][_0x511e('0x30')]({'where':{'id':_0x3fac95[_0x511e('0x3e')]['id']}})['then'](function(_0x4cb219){return db[_0x511e('0x56')][_0x511e('0x57')](function(_0x3be0cb){return _0x4cb219[_0x511e('0x51')](_0x57c150,{'transaction':_0x3be0cb})[_0x511e('0x18')](function(){return BPromise[_0x511e('0x58')](_0x42059c,function(_0x4f6ee9){return db[_0x511e('0x3f')][_0x511e('0x59')]({'where':{'UserId':_0x4f6ee9['id'],'FaxQueueId':_0x3fac95['params']['id']},'transaction':_0x3be0cb});});})['then'](function(){_0x42059c[_0x511e('0x5a')](function(_0x528885){socket[_0x511e('0x5b')]('userFaxQueue:save',{'UserId':_0x528885['id'],'FaxQueueId':_0x4cb219['id']});});});});});}})['then'](respondWithStatusCode(_0x59daab,null))[_0x511e('0x39')](handleError(_0x59daab,null));};exports[_0x511e('0x5c')]=function(_0x3129fc,_0x2c61a5){return db[_0x511e('0x4f')][_0x511e('0x24')]({'where':{'id':_0x3129fc[_0x511e('0x29')][_0x511e('0x52')]},'attributes':['id'],'include':[{'model':db[_0x511e('0x48')],'as':_0x511e('0x53'),'attributes':['id'],'raw':!![]}]})[_0x511e('0x18')](handleEntityNotFound(_0x2c61a5,null))[_0x511e('0x18')](function(_0x3b4712){var _0x2f35cc=_[_0x511e('0x1c')](_0x3b4712,'id');var _0x327516=[];var _0x4a07b7=[];var _0x38b1cc=squel[_0x511e('0x5d')]();_0x38b1cc[_0x511e('0x5e')](_0x511e('0x5f'))[_0x511e('0x60')](_0x511e('0x61'),'tq')[_0x511e('0x62')](_0x511e('0x63'),'ut',_0x511e('0x64'))[_0x511e('0x44')](_0x511e('0x65'),_0x3129fc['params']['id']);for(var _0x200470=0x0;_0x200470<_0x3b4712[_0x511e('0x2d')];_0x200470+=0x1){let _0x1d4eb0=_0x3b4712[_0x200470];for(var _0x362cf7=0x0;_0x362cf7<_0x1d4eb0['Agents'][_0x511e('0x2d')];_0x362cf7+=0x1){let _0x385f5a=_0x1d4eb0[_0x511e('0x53')][_0x362cf7];var _0x2e1750=_0x38b1cc[_0x511e('0x66')]();_0x2e1750[_0x511e('0x44')](_0x511e('0x67'),_0x385f5a['id']);_0x4a07b7[_0x511e('0x68')](db[_0x511e('0x56')][_0x511e('0x29')](_0x2e1750['toString'](),{'type':db[_0x511e('0x56')][_0x511e('0x69')][_0x511e('0x6a')]})[_0x511e('0x18')](function(_0x2dba35){if(_0x2dba35[_0x511e('0x2d')]===0x1){return _0x385f5a['id'];}else{var _0x436e65=_['every'](_['map'](_0x2dba35,_0x511e('0x6b')),function(_0x13446d){return _[_0x511e('0x6c')](_0x2f35cc,_0x13446d);});if(_0x436e65){return _0x385f5a['id'];}}}));}}return BPromise[_0x511e('0x6d')](_0x4a07b7)[_0x511e('0x18')](function(_0x4316de){_0x327516=_(_0x327516)[_0x511e('0x6e')](_0x4316de)[_0x511e('0x6f')]()[_0x511e('0x70')]();return db[_0x511e('0x1d')]['find']({'where':{'id':_0x3129fc[_0x511e('0x3e')]['id']}})[_0x511e('0x18')](function(_0x19671c){return db[_0x511e('0x56')][_0x511e('0x57')](function(_0x4d9773){return _0x19671c['removeTeams'](_0x3129fc[_0x511e('0x29')][_0x511e('0x52')],{'transaction':_0x4d9773})[_0x511e('0x18')](function(){if(!_[_0x511e('0x71')](_0x327516)){return _0x19671c['removeAgents'](_0x327516,{'transaction':_0x4d9773});}})[_0x511e('0x18')](function(){_0x327516[_0x511e('0x5a')](function(_0x5c9f54){socket[_0x511e('0x5b')]('userFaxQueue:remove',{'UserId':_0x5c9f54,'FaxQueueId':_0x19671c['id']});});});});});});})[_0x511e('0x18')](respondWithStatusCode(_0x2c61a5,null))[_0x511e('0x39')](handleError(_0x2c61a5,null));};exports[_0x511e('0x72')]=function(_0x473867,_0x128014){return db[_0x511e('0x1d')][_0x511e('0x30')]({'where':{'id':_0x473867[_0x511e('0x3e')]['id']}})[_0x511e('0x18')](handleEntityNotFound(_0x128014,null))[_0x511e('0x18')](function(_0x37bb80){if(_0x37bb80){return _0x37bb80[_0x511e('0x72')](_0x473867[_0x511e('0x32')][_0x511e('0x52')],_[_0x511e('0x73')](_0x473867[_0x511e('0x32')],[_0x511e('0x52'),'id'])||{})[_0x511e('0x74')](function(_0x50ccc7){for(var _0x26065a=0x0;_0x26065a<_0x473867[_0x511e('0x32')][_0x511e('0x52')][_0x511e('0x2d')];_0x26065a+=0x1){socket[_0x511e('0x5b')]('userFaxQueue:save',{'UserId':Number(_0x473867[_0x511e('0x32')][_0x511e('0x52')][_0x26065a]),'FaxQueueId':Number(_0x473867[_0x511e('0x3e')]['id'])});}return _0x50ccc7;});}})['then'](respondWithResult(_0x128014,null))[_0x511e('0x39')](handleError(_0x128014,null));};exports[_0x511e('0x75')]=function(_0x176941,_0x334374){return db['FaxQueue']['find']({'where':{'id':_0x176941['params']['id']}})[_0x511e('0x18')](handleEntityNotFound(_0x334374,null))[_0x511e('0x18')](function(_0x48a735){if(_0x48a735){return _0x48a735[_0x511e('0x75')](_0x176941['query'][_0x511e('0x52')])['then'](function(){if(_[_0x511e('0x76')](_0x176941[_0x511e('0x29')]['ids'])){for(var _0x222547=0x0;_0x222547<_0x176941[_0x511e('0x29')][_0x511e('0x52')][_0x511e('0x2d')];_0x222547+=0x1){socket[_0x511e('0x5b')]('userFaxQueue:remove',{'UserId':Number(_0x176941['query']['ids'][_0x222547]),'FaxQueueId':Number(_0x176941['params']['id'])});}}else{socket['emit'](_0x511e('0x77'),{'UserId':Number(_0x176941[_0x511e('0x29')][_0x511e('0x52')]),'FaxQueueId':Number(_0x176941['params']['id'])});}});}})[_0x511e('0x18')](respondWithStatusCode(_0x334374,null))[_0x511e('0x39')](handleError(_0x334374,null));};exports[_0x511e('0x78')]=function(_0x2c4f4d,_0x2f2af0){var _0x31cdb3={};var _0x35e894={};var _0x5e880f;var _0x26cf0c;return db[_0x511e('0x1d')][_0x511e('0x3d')]({'where':{'id':_0x2c4f4d['params']['id']}})[_0x511e('0x18')](handleEntityNotFound(_0x2f2af0,null))[_0x511e('0x18')](function(_0x5dcbf7){if(_0x5dcbf7){_0x5e880f=_0x5dcbf7;_0x35e894[_0x511e('0x27')]=_[_0x511e('0x28')](db[_0x511e('0x48')][_0x511e('0x1e')]);_0x35e894[_0x511e('0x29')]=_['keys'](_0x2c4f4d['query']);_0x35e894[_0x511e('0x2a')]=_[_0x511e('0x2c')](_0x35e894[_0x511e('0x27')],_0x35e894[_0x511e('0x29')]);_0x31cdb3['attributes']=_[_0x511e('0x2c')](_0x35e894[_0x511e('0x27')],qs[_0x511e('0x40')](_0x2c4f4d[_0x511e('0x29')][_0x511e('0x40')]));_0x31cdb3[_0x511e('0x2b')]=_0x31cdb3[_0x511e('0x2b')][_0x511e('0x2d')]?_0x31cdb3[_0x511e('0x2b')]:_0x35e894['model'];_0x31cdb3['order']=qs[_0x511e('0x43')](_0x2c4f4d['query'][_0x511e('0x43')]);_0x31cdb3[_0x511e('0x44')]=qs[_0x511e('0x2a')](_[_0x511e('0x45')](_0x2c4f4d[_0x511e('0x29')],_0x35e894[_0x511e('0x2a')]));if(_0x2c4f4d[_0x511e('0x29')]['filter']){_0x31cdb3[_0x511e('0x44')]=_['merge'](_0x31cdb3[_0x511e('0x44')],{'$or':_[_0x511e('0x1c')](_0x31cdb3[_0x511e('0x2b')],function(_0x330f4a){var _0x29340e={};_0x29340e[_0x330f4a]={'$like':'%'+_0x2c4f4d[_0x511e('0x29')][_0x511e('0x47')]+'%'};return _0x29340e;})});}_0x31cdb3=_[_0x511e('0x2e')]({},_0x31cdb3,_0x2c4f4d[_0x511e('0x2f')]);return _0x5e880f['getAgents'](_0x31cdb3);}})[_0x511e('0x18')](function(_0x85721e){if(_0x85721e){_0x26cf0c=_0x85721e[_0x511e('0x2d')];if(!_0x2c4f4d['query'][_0x511e('0x41')](_0x511e('0x42'))){_0x31cdb3[_0x511e('0x10')]=qs[_0x511e('0x10')](_0x2c4f4d[_0x511e('0x29')]['limit']);_0x31cdb3[_0x511e('0xe')]=qs[_0x511e('0xe')](_0x2c4f4d['query'][_0x511e('0xe')]);}return _0x5e880f['getAgents'](_0x31cdb3);}})[_0x511e('0x18')](function(_0x283214){if(_0x283214){return _0x283214?{'count':_0x26cf0c,'rows':_0x283214}:null;}})['then'](respondWithResult(_0x2f2af0,null))[_0x511e('0x39')](handleError(_0x2f2af0,null));}; \ No newline at end of file +var _0x1115=['sort','FaxQueueId','merge','map','filter','options','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','userFaxQueue:save','ids','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','sequelize','removeTeams','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','User','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./faxQueue.socket','sendStatus','json','offset','undefined','limit','count','set','update','destroy','then','get','FaxQueues','UserProfileResource','status','end','error','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','rows','params','model','keys','query','attributes','intersection','fields','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','filters','hasOwnProperty','nolimit','order'];(function(_0x2a3cb2,_0x55280a){var _0x4120af=function(_0x2f470c){while(--_0x2f470c){_0x2a3cb2['push'](_0x2a3cb2['shift']());}};_0x4120af(++_0x55280a);}(_0x1115,0x1b6));var _0x5111=function(_0x428dd8,_0x2c30b4){_0x428dd8=_0x428dd8-0x0;var _0x9776cf=_0x1115[_0x428dd8];return _0x9776cf;};'use strict';var BPromise=require('bluebird');var util=require(_0x5111('0x0'));var _=require(_0x5111('0x1'));var squel=require(_0x5111('0x2'));var Redis=require(_0x5111('0x3'));var qs=require(_0x5111('0x4'));var logger=require(_0x5111('0x5'))(_0x5111('0x6'));var config=require(_0x5111('0x7'));var db=require(_0x5111('0x8'))['db'];config['redis']=_['defaults'](config[_0x5111('0x9')],{'host':_0x5111('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5111('0x9')]));require(_0x5111('0xb'))['register'](socket);function respondWithStatusCode(_0x42a3c5,_0x5e629a){_0x5e629a=_0x5e629a||0xcc;return function(_0x2d8e0a){if(_0x2d8e0a){return _0x42a3c5[_0x5111('0xc')](_0x5e629a);}return _0x42a3c5['status'](_0x5e629a)['end']();};}function respondWithResult(_0x347d87,_0x5a826a){_0x5a826a=_0x5a826a||0xc8;return function(_0x162624){if(_0x162624){return _0x347d87['status'](_0x5a826a)[_0x5111('0xd')](_0x162624);}};}function respondWithFilteredResult(_0x532984,_0x1fa1d2){return function(_0x334450){if(_0x334450){var _0x46043a=typeof _0x1fa1d2[_0x5111('0xe')]===_0x5111('0xf')&&typeof _0x1fa1d2[_0x5111('0x10')]===_0x5111('0xf');var _0x10e3c4=_0x334450[_0x5111('0x11')];var _0x62ce44=_0x46043a?0x0:_0x1fa1d2[_0x5111('0xe')];var _0x3e60b5=_0x46043a?_0x334450[_0x5111('0x11')]:_0x1fa1d2[_0x5111('0xe')]+_0x1fa1d2[_0x5111('0x10')];var _0x45052e;if(_0x3e60b5>=_0x10e3c4){_0x3e60b5=_0x10e3c4;_0x45052e=0xc8;}else{_0x45052e=0xce;}_0x532984['status'](_0x45052e);return _0x532984[_0x5111('0x12')]('Content-Range',_0x62ce44+'-'+_0x3e60b5+'/'+_0x10e3c4)['json'](_0x334450);}return null;};}function saveUpdates(_0x387e1e){return function(_0x843784){if(_0x843784){return _0x843784[_0x5111('0x13')](_0x387e1e)['then'](function(_0x367f8d){return _0x367f8d;});}return null;};}function removeEntity(_0xa3f4ba){return function(_0x52c614){if(_0x52c614){return _0x52c614[_0x5111('0x14')]()[_0x5111('0x15')](function(){var _0x28f24b=_0x52c614[_0x5111('0x16')]({'plain':!![]});var _0x5e8f1d=_0x5111('0x17');return db[_0x5111('0x18')][_0x5111('0x14')]({'where':{'type':_0x5e8f1d,'resourceId':_0x28f24b['id']}})[_0x5111('0x15')](function(){return _0x52c614;});})[_0x5111('0x15')](function(){_0xa3f4ba[_0x5111('0x19')](0xcc)[_0x5111('0x1a')]();});}};}function handleEntityNotFound(_0x262e58){return function(_0x6a1158){if(!_0x6a1158){_0x262e58[_0x5111('0xc')](0x194);}return _0x6a1158;};}function handleError(_0x4b73ce,_0x3f462d){_0x3f462d=_0x3f462d||0x1f4;return function(_0x162ff9){logger[_0x5111('0x1b')](_0x162ff9['stack']);if(_0x162ff9[_0x5111('0x1c')]){delete _0x162ff9[_0x5111('0x1c')];}_0x4b73ce[_0x5111('0x19')](_0x3f462d)[_0x5111('0x1d')](_0x162ff9);};}exports[_0x5111('0x1e')]=function(_0x33fea2,_0x5990){var _0x316b39={};var _0x382bd0={'count':0x0,'rows':[]};var _0x1a5793=_['map'](db[_0x5111('0x1f')][_0x5111('0x20')],function(_0x151b67){return{'name':_0x151b67[_0x5111('0x21')],'type':_0x151b67[_0x5111('0x22')][_0x5111('0x23')]};});_0x316b39=qs[_0x5111('0x24')](_0x1a5793,_0x33fea2);var _0x4be100={'where':_0x316b39[_0x5111('0x25')]};return db[_0x5111('0x1f')][_0x5111('0x11')](_0x4be100)['then'](function(_0xdf9031){_0x382bd0[_0x5111('0x11')]=_0xdf9031;_0x316b39[_0x5111('0x26')]=qs['include'](_0x33fea2['query']);return db[_0x5111('0x1f')]['findAll'](_0x316b39);})[_0x5111('0x15')](function(_0x5b5a6d){_0x382bd0[_0x5111('0x27')]=_0x5b5a6d;return _0x382bd0;})['then'](respondWithFilteredResult(_0x5990,_0x316b39))['catch'](handleError(_0x5990,null));};exports['show']=function(_0x36d86c,_0x3fb9a5){var _0xe0839e={'raw':!![],'where':{'id':_0x36d86c[_0x5111('0x28')]['id']}},_0x3763f4={};_0x3763f4[_0x5111('0x29')]=_[_0x5111('0x2a')](db['FaxQueue'][_0x5111('0x20')]);_0x3763f4[_0x5111('0x2b')]=_[_0x5111('0x2a')](_0x36d86c[_0x5111('0x2b')]);_0x3763f4['filters']=_['intersection'](_0x3763f4[_0x5111('0x29')],_0x3763f4[_0x5111('0x2b')]);_0xe0839e[_0x5111('0x2c')]=_[_0x5111('0x2d')](_0x3763f4[_0x5111('0x29')],qs[_0x5111('0x2e')](_0x36d86c[_0x5111('0x2b')][_0x5111('0x2e')]));_0xe0839e['attributes']=_0xe0839e[_0x5111('0x2c')][_0x5111('0x2f')]?_0xe0839e[_0x5111('0x2c')]:_0x3763f4['model'];if(_0x36d86c[_0x5111('0x2b')][_0x5111('0x30')]){_0xe0839e[_0x5111('0x26')]=[{'all':!![]}];}_0xe0839e=_['merge']({},_0xe0839e,_0x36d86c['options']);return db['FaxQueue'][_0x5111('0x31')](_0xe0839e)[_0x5111('0x15')](handleEntityNotFound(_0x3fb9a5,null))[_0x5111('0x15')](respondWithResult(_0x3fb9a5,null))[_0x5111('0x32')](handleError(_0x3fb9a5,null));};exports[_0x5111('0x33')]=function(_0x570126,_0x45d094){return db[_0x5111('0x1f')][_0x5111('0x33')](_0x570126[_0x5111('0x34')],{})['then'](function(_0x1d0646){var _0x444d82=_0x570126[_0x5111('0x35')][_0x5111('0x16')]({'plain':!![]});if(!_0x444d82)throw new Error(_0x5111('0x36'));if(_0x444d82[_0x5111('0x37')]===_0x5111('0x35')){var _0x41b6ac=_0x1d0646[_0x5111('0x16')]({'plain':!![]});var _0x222e9c=_0x5111('0x17');return db[_0x5111('0x38')][_0x5111('0x31')]({'where':{'name':_0x222e9c,'userProfileId':_0x444d82['userProfileId']},'raw':!![]})[_0x5111('0x15')](function(_0xf00f9){if(_0xf00f9&&_0xf00f9['autoAssociation']===0x0){return db[_0x5111('0x18')][_0x5111('0x33')]({'name':_0x41b6ac[_0x5111('0x1c')],'resourceId':_0x41b6ac['id'],'type':_0xf00f9[_0x5111('0x1c')],'sectionId':_0xf00f9['id']},{})[_0x5111('0x15')](function(){return _0x1d0646;});}else{return _0x1d0646;}})[_0x5111('0x32')](function(_0x1f1534){logger['error'](_0x5111('0x39'),_0x1f1534);throw _0x1f1534;});}return _0x1d0646;})[_0x5111('0x15')](respondWithResult(_0x45d094,0xc9))[_0x5111('0x32')](handleError(_0x45d094,null));};exports[_0x5111('0x13')]=function(_0x96893c,_0x49307f){if(_0x96893c['body']['id']){delete _0x96893c[_0x5111('0x34')]['id'];}return db[_0x5111('0x1f')]['find']({'where':{'id':_0x96893c[_0x5111('0x28')]['id']}})[_0x5111('0x15')](handleEntityNotFound(_0x49307f,null))[_0x5111('0x15')](saveUpdates(_0x96893c[_0x5111('0x34')],null))[_0x5111('0x15')](respondWithResult(_0x49307f,null))[_0x5111('0x32')](handleError(_0x49307f,null));};exports[_0x5111('0x14')]=function(_0x461787,_0xe99d8e){return db[_0x5111('0x1f')]['find']({'where':{'id':_0x461787['params']['id']}})[_0x5111('0x15')](handleEntityNotFound(_0xe99d8e,null))[_0x5111('0x15')](removeEntity(_0xe99d8e,null))[_0x5111('0x32')](handleError(_0xe99d8e,null));};exports[_0x5111('0x3a')]=function(_0x24abe7,_0x4ff01a){return db['FaxQueue'][_0x5111('0x3a')]()[_0x5111('0x15')](respondWithResult(_0x4ff01a,null))[_0x5111('0x32')](handleError(_0x4ff01a,null));};exports[_0x5111('0x3b')]=function(_0x5d5b0b,_0x2242b7){var _0x135993={'raw':!![],'where':{}},_0xf2dc3c={},_0x4fb6e8;return db[_0x5111('0x1f')][_0x5111('0x3c')]({'where':{'id':_0x5d5b0b[_0x5111('0x28')]['id']}})[_0x5111('0x15')](handleEntityNotFound(_0x2242b7,null))['then'](function(_0x4ab584){if(_0x4ab584){_0x4fb6e8=_0x4ab584[_0x5111('0x16')]({'plain':!![]});_0xf2dc3c['model']=_['keys'](db[_0x5111('0x3d')][_0x5111('0x20')]);_0xf2dc3c['query']=_[_0x5111('0x2a')](_0x5d5b0b[_0x5111('0x2b')]);_0xf2dc3c[_0x5111('0x3e')]=_[_0x5111('0x2d')](_0xf2dc3c[_0x5111('0x29')],_0xf2dc3c[_0x5111('0x2b')]);_0x135993[_0x5111('0x2c')]=_[_0x5111('0x2d')](_0xf2dc3c[_0x5111('0x29')],qs[_0x5111('0x2e')](_0x5d5b0b[_0x5111('0x2b')][_0x5111('0x2e')]));_0x135993['attributes']=_0x135993[_0x5111('0x2c')][_0x5111('0x2f')]?_0x135993[_0x5111('0x2c')]:_0xf2dc3c[_0x5111('0x29')];if(!_0x5d5b0b[_0x5111('0x2b')][_0x5111('0x3f')](_0x5111('0x40'))){_0x135993['limit']=qs['limit'](_0x5d5b0b[_0x5111('0x2b')]['limit']);_0x135993[_0x5111('0xe')]=qs[_0x5111('0xe')](_0x5d5b0b[_0x5111('0x2b')][_0x5111('0xe')]);}_0x135993[_0x5111('0x41')]=qs[_0x5111('0x42')](_0x5d5b0b[_0x5111('0x2b')]['sort']);_0x135993[_0x5111('0x25')]=qs[_0x5111('0x3e')](_['pick'](_0x5d5b0b[_0x5111('0x2b')],_0xf2dc3c[_0x5111('0x3e')]));_0x135993['where'][_0x5111('0x43')]=_0x4ab584['id'];if(_0x5d5b0b['query']['filter']){_0x135993['where']=_[_0x5111('0x44')](_0x135993[_0x5111('0x25')],{'$or':_[_0x5111('0x45')](_0x135993[_0x5111('0x2c')],function(_0x513d8b){var _0x14a940={};_0x14a940[_0x513d8b]={'$like':'%'+_0x5d5b0b[_0x5111('0x2b')][_0x5111('0x46')]+'%'};return _0x14a940;})});}_0x135993=_['merge']({},_0x135993,_0x5d5b0b[_0x5111('0x47')]);return db[_0x5111('0x3d')][_0x5111('0x48')](_0x135993);}})['then'](function(_0x11413a){if(_0x11413a){return db['User'][_0x5111('0x49')]({'where':{'id':_[_0x5111('0x45')](_0x11413a,_0x5111('0x4a')),'role':_0x5111('0x4b')},'attributes':['id','name',_0x5111('0x4c'),_0x5111('0x4d'),_0x5111('0x4e')]});}})[_0x5111('0x15')](function(_0x2b07ae){if(_0x2b07ae){return{'count':_0x2b07ae[_0x5111('0x11')],'rows':_[_0x5111('0x45')](_0x2b07ae['rows'],function(_0x27edea){return{'membername':_0x27edea['name'],'UserId':_0x27edea['id'],'queue_name':_0x4fb6e8[_0x5111('0x1c')],'FaxQueueId':_0x4fb6e8['id'],'interface':util[_0x5111('0x4f')](_0x5111('0x50'),_0x5111('0x51'),_0x27edea[_0x5111('0x1c')]),'penalty':0x0,'paused':_0x27edea[_0x5111('0x4c')],'createdAt':_0x27edea['createdAt'],'updatedAt':_0x27edea[_0x5111('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5111('0x15')](respondWithFilteredResult(_0x2242b7,_0x135993))[_0x5111('0x32')](handleError(_0x2242b7,null));};exports[_0x5111('0x52')]=function(_0x3384ee,_0x434c07){var _0x5e7249={};var _0x2334a2={};var _0x13ce00;var _0x40d206;return db[_0x5111('0x1f')][_0x5111('0x3c')]({'where':{'id':_0x3384ee['params']['id']}})[_0x5111('0x15')](handleEntityNotFound(_0x434c07,null))[_0x5111('0x15')](function(_0x18f6c8){if(_0x18f6c8){_0x13ce00=_0x18f6c8;_0x2334a2[_0x5111('0x29')]=_[_0x5111('0x2a')](db[_0x5111('0x53')][_0x5111('0x20')]);_0x2334a2['query']=_['keys'](_0x3384ee['query']);_0x2334a2[_0x5111('0x3e')]=_[_0x5111('0x2d')](_0x2334a2[_0x5111('0x29')],_0x2334a2[_0x5111('0x2b')]);_0x5e7249[_0x5111('0x2c')]=_['intersection'](_0x2334a2[_0x5111('0x29')],qs[_0x5111('0x2e')](_0x3384ee[_0x5111('0x2b')][_0x5111('0x2e')]));_0x5e7249[_0x5111('0x2c')]=_0x5e7249[_0x5111('0x2c')][_0x5111('0x2f')]?_0x5e7249[_0x5111('0x2c')]:_0x2334a2[_0x5111('0x29')];_0x5e7249[_0x5111('0x41')]=qs['sort'](_0x3384ee[_0x5111('0x2b')][_0x5111('0x42')]);_0x5e7249['where']=qs[_0x5111('0x3e')](_[_0x5111('0x54')](_0x3384ee['query'],_0x2334a2[_0x5111('0x3e')]));if(_0x3384ee[_0x5111('0x2b')][_0x5111('0x46')]){_0x5e7249[_0x5111('0x25')]=_[_0x5111('0x44')](_0x5e7249[_0x5111('0x25')],{'$or':_[_0x5111('0x45')](_0x5e7249['attributes'],function(_0x72cc93){var _0x56c89c={};_0x56c89c[_0x72cc93]={'$like':'%'+_0x3384ee['query'][_0x5111('0x46')]+'%'};return _0x56c89c;})});}_0x5e7249=_['merge']({},_0x5e7249,_0x3384ee[_0x5111('0x47')]);return _0x13ce00['getTeams'](_0x5e7249);}})[_0x5111('0x15')](function(_0x206442){if(_0x206442){_0x40d206=_0x206442[_0x5111('0x2f')];if(!_0x3384ee[_0x5111('0x2b')][_0x5111('0x3f')](_0x5111('0x40'))){_0x5e7249[_0x5111('0x10')]=qs[_0x5111('0x10')](_0x3384ee[_0x5111('0x2b')][_0x5111('0x10')]);_0x5e7249[_0x5111('0xe')]=qs[_0x5111('0xe')](_0x3384ee[_0x5111('0x2b')]['offset']);}return _0x13ce00[_0x5111('0x52')](_0x5e7249);}})['then'](function(_0x2561c8){if(_0x2561c8){return _0x2561c8?{'count':_0x40d206,'rows':_0x2561c8}:null;}})['then'](respondWithResult(_0x434c07,null))[_0x5111('0x32')](handleError(_0x434c07,null));};exports[_0x5111('0x55')]=function(_0x36c719,_0x140cad){var _0x30d604=_0x36c719['body']['ids'];return db[_0x5111('0x53')]['findAll']({'where':{'id':_0x30d604},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5111('0x56'),'attributes':['id',_0x5111('0x1c'),_0x5111('0x57'),_0x5111('0x58'),_0x5111('0x59')],'raw':!![]}]})[_0x5111('0x15')](function(_0x5b7b02){if(_0x5b7b02){var _0x220375=_[_0x5111('0x5a')](_0x5b7b02,function(_0x5add8f){var _0x435e72=_0x5add8f['get']({'plain':!![]});return _0x435e72[_0x5111('0x56')];});return db[_0x5111('0x1f')][_0x5111('0x31')]({'where':{'id':_0x36c719[_0x5111('0x28')]['id']}})['then'](function(_0x1f8ac1){return db['sequelize'][_0x5111('0x5b')](function(_0x57388d){return _0x1f8ac1[_0x5111('0x55')](_0x30d604,{'transaction':_0x57388d})[_0x5111('0x15')](function(){return BPromise[_0x5111('0x5c')](_0x220375,function(_0x199dbb){return db[_0x5111('0x3d')][_0x5111('0x5d')]({'where':{'UserId':_0x199dbb['id'],'FaxQueueId':_0x36c719[_0x5111('0x28')]['id']},'transaction':_0x57388d});});})[_0x5111('0x15')](function(){_0x220375['forEach'](function(_0x97815f){socket[_0x5111('0x5e')](_0x5111('0x5f'),{'UserId':_0x97815f['id'],'FaxQueueId':_0x1f8ac1['id']});});});});});}})[_0x5111('0x15')](respondWithStatusCode(_0x140cad,null))[_0x5111('0x32')](handleError(_0x140cad,null));};exports['removeTeams']=function(_0x389078,_0x367b4a){return db['Team'][_0x5111('0x48')]({'where':{'id':_0x389078[_0x5111('0x2b')][_0x5111('0x60')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5111('0x56'),'attributes':['id'],'raw':!![]}]})[_0x5111('0x15')](handleEntityNotFound(_0x367b4a,null))['then'](function(_0x2dfa6e){var _0x56bb3d=_[_0x5111('0x45')](_0x2dfa6e,'id');var _0x5dcc50=[];var _0x27dd95=[];var _0x44b7ff=squel[_0x5111('0x61')]();_0x44b7ff[_0x5111('0x62')]('tq.TeamId')[_0x5111('0x63')](_0x5111('0x64'),'tq')[_0x5111('0x65')](_0x5111('0x66'),'ut',_0x5111('0x67'))[_0x5111('0x25')](_0x5111('0x68'),_0x389078[_0x5111('0x28')]['id']);for(var _0x439c1d=0x0;_0x439c1d<_0x2dfa6e[_0x5111('0x2f')];_0x439c1d+=0x1){let _0x4be0f0=_0x2dfa6e[_0x439c1d];for(var _0x1c31da=0x0;_0x1c31da<_0x4be0f0[_0x5111('0x56')]['length'];_0x1c31da+=0x1){let _0x44d460=_0x4be0f0[_0x5111('0x56')][_0x1c31da];var _0x4eb0b9=_0x44b7ff['clone']();_0x4eb0b9['where'](_0x5111('0x69'),_0x44d460['id']);_0x27dd95[_0x5111('0x6a')](db['sequelize'][_0x5111('0x2b')](_0x4eb0b9[_0x5111('0x6b')](),{'type':db['sequelize'][_0x5111('0x6c')][_0x5111('0x6d')]})[_0x5111('0x15')](function(_0x2a58f5){if(_0x2a58f5[_0x5111('0x2f')]===0x1){return _0x44d460['id'];}else{var _0x779d7f=_['every'](_[_0x5111('0x45')](_0x2a58f5,_0x5111('0x6e')),function(_0x6319a0){return _[_0x5111('0x6f')](_0x56bb3d,_0x6319a0);});if(_0x779d7f){return _0x44d460['id'];}}}));}}return BPromise[_0x5111('0x70')](_0x27dd95)['then'](function(_0x1efb6a){_0x5dcc50=_(_0x5dcc50)[_0x5111('0x71')](_0x1efb6a)[_0x5111('0x72')]()[_0x5111('0x73')]();return db[_0x5111('0x1f')][_0x5111('0x31')]({'where':{'id':_0x389078[_0x5111('0x28')]['id']}})['then'](function(_0x5a95a4){return db[_0x5111('0x74')][_0x5111('0x5b')](function(_0x2e4783){return _0x5a95a4[_0x5111('0x75')](_0x389078[_0x5111('0x2b')][_0x5111('0x60')],{'transaction':_0x2e4783})[_0x5111('0x15')](function(){if(!_[_0x5111('0x76')](_0x5dcc50)){return _0x5a95a4[_0x5111('0x77')](_0x5dcc50,{'transaction':_0x2e4783});}})[_0x5111('0x15')](function(){_0x5dcc50[_0x5111('0x78')](function(_0x48db8d){socket[_0x5111('0x5e')](_0x5111('0x79'),{'UserId':_0x48db8d,'FaxQueueId':_0x5a95a4['id']});});});});});});})['then'](respondWithStatusCode(_0x367b4a,null))[_0x5111('0x32')](handleError(_0x367b4a,null));};exports[_0x5111('0x7a')]=function(_0xc3780d,_0x248d95){return db['FaxQueue'][_0x5111('0x31')]({'where':{'id':_0xc3780d[_0x5111('0x28')]['id']}})['then'](handleEntityNotFound(_0x248d95,null))['then'](function(_0x1688f3){if(_0x1688f3){return _0x1688f3[_0x5111('0x7a')](_0xc3780d[_0x5111('0x34')][_0x5111('0x60')],_['omit'](_0xc3780d[_0x5111('0x34')],[_0x5111('0x60'),'id'])||{})[_0x5111('0x7b')](function(_0x292c67){for(var _0x2623a6=0x0;_0x2623a6<_0xc3780d[_0x5111('0x34')][_0x5111('0x60')]['length'];_0x2623a6+=0x1){socket[_0x5111('0x5e')](_0x5111('0x5f'),{'UserId':Number(_0xc3780d['body']['ids'][_0x2623a6]),'FaxQueueId':Number(_0xc3780d[_0x5111('0x28')]['id'])});}return _0x292c67;});}})[_0x5111('0x15')](respondWithResult(_0x248d95,null))[_0x5111('0x32')](handleError(_0x248d95,null));};exports['removeAgents']=function(_0x4a5b3e,_0x2e99a4){return db[_0x5111('0x1f')]['find']({'where':{'id':_0x4a5b3e[_0x5111('0x28')]['id']}})[_0x5111('0x15')](handleEntityNotFound(_0x2e99a4,null))[_0x5111('0x15')](function(_0x46ca55){if(_0x46ca55){return _0x46ca55[_0x5111('0x77')](_0x4a5b3e[_0x5111('0x2b')]['ids'])['then'](function(){if(_['isArray'](_0x4a5b3e[_0x5111('0x2b')]['ids'])){for(var _0x28fc7e=0x0;_0x28fc7e<_0x4a5b3e['query'][_0x5111('0x60')][_0x5111('0x2f')];_0x28fc7e+=0x1){socket[_0x5111('0x5e')](_0x5111('0x79'),{'UserId':Number(_0x4a5b3e[_0x5111('0x2b')][_0x5111('0x60')][_0x28fc7e]),'FaxQueueId':Number(_0x4a5b3e['params']['id'])});}}else{socket[_0x5111('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x4a5b3e[_0x5111('0x2b')]['ids']),'FaxQueueId':Number(_0x4a5b3e['params']['id'])});}});}})[_0x5111('0x15')](respondWithStatusCode(_0x2e99a4,null))[_0x5111('0x32')](handleError(_0x2e99a4,null));};exports['getAgents']=function(_0x1404be,_0x163f83){var _0xb8920={};var _0x1826b9={};var _0x390857;var _0x1a8114;return db[_0x5111('0x1f')]['findOne']({'where':{'id':_0x1404be[_0x5111('0x28')]['id']}})[_0x5111('0x15')](handleEntityNotFound(_0x163f83,null))[_0x5111('0x15')](function(_0x32745c){if(_0x32745c){_0x390857=_0x32745c;_0x1826b9[_0x5111('0x29')]=_['keys'](db[_0x5111('0x7c')][_0x5111('0x20')]);_0x1826b9[_0x5111('0x2b')]=_['keys'](_0x1404be['query']);_0x1826b9[_0x5111('0x3e')]=_['intersection'](_0x1826b9[_0x5111('0x29')],_0x1826b9[_0x5111('0x2b')]);_0xb8920[_0x5111('0x2c')]=_['intersection'](_0x1826b9[_0x5111('0x29')],qs['fields'](_0x1404be[_0x5111('0x2b')][_0x5111('0x2e')]));_0xb8920['attributes']=_0xb8920[_0x5111('0x2c')][_0x5111('0x2f')]?_0xb8920[_0x5111('0x2c')]:_0x1826b9[_0x5111('0x29')];_0xb8920[_0x5111('0x41')]=qs[_0x5111('0x42')](_0x1404be['query'][_0x5111('0x42')]);_0xb8920[_0x5111('0x25')]=qs[_0x5111('0x3e')](_['pick'](_0x1404be[_0x5111('0x2b')],_0x1826b9[_0x5111('0x3e')]));if(_0x1404be[_0x5111('0x2b')][_0x5111('0x46')]){_0xb8920[_0x5111('0x25')]=_[_0x5111('0x44')](_0xb8920[_0x5111('0x25')],{'$or':_[_0x5111('0x45')](_0xb8920['attributes'],function(_0x3ec675){var _0x5aba55={};_0x5aba55[_0x3ec675]={'$like':'%'+_0x1404be[_0x5111('0x2b')][_0x5111('0x46')]+'%'};return _0x5aba55;})});}_0xb8920=_[_0x5111('0x44')]({},_0xb8920,_0x1404be[_0x5111('0x47')]);return _0x390857[_0x5111('0x7d')](_0xb8920);}})['then'](function(_0xfecd37){if(_0xfecd37){_0x1a8114=_0xfecd37[_0x5111('0x2f')];if(!_0x1404be[_0x5111('0x2b')][_0x5111('0x3f')](_0x5111('0x40'))){_0xb8920[_0x5111('0x10')]=qs[_0x5111('0x10')](_0x1404be[_0x5111('0x2b')]['limit']);_0xb8920['offset']=qs[_0x5111('0xe')](_0x1404be[_0x5111('0x2b')][_0x5111('0xe')]);}return _0x390857['getAgents'](_0xb8920);}})['then'](function(_0x506359){if(_0x506359){return _0x506359?{'count':_0x1a8114,'rows':_0x506359}:null;}})['then'](respondWithResult(_0x163f83,null))[_0x5111('0x32')](handleError(_0x163f83,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 752f428..3504331 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 _0x335e=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x4dc5f7,_0x3ab3c0){var _0x30d0de=function(_0x37ce8a){while(--_0x37ce8a){_0x4dc5f7['push'](_0x4dc5f7['shift']());}};_0x30d0de(++_0x3ab3c0);}(_0x335e,0x18f));var _0xe335=function(_0x372a48,_0x5b145c){_0x372a48=_0x372a48-0x0;var _0x4ee1fa=_0x335e[_0x372a48];return _0x4ee1fa;};'use strict';var EventEmitter=require(_0xe335('0x0'));var FaxQueue=require(_0xe335('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe335('0x2')](0x0);var events={'afterCreate':_0xe335('0x3'),'afterUpdate':_0xe335('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2bf963){return function(_0x5ed8d2,_0x9a465d,_0x4fac68){FaxQueueEvents['emit'](_0x2bf963+':'+_0x5ed8d2['id'],_0x5ed8d2);FaxQueueEvents[_0xe335('0x5')](_0x2bf963,_0x5ed8d2);_0x4fac68(null);};}for(var e in events){if(events[_0xe335('0x6')](e)){var event=events[e];FaxQueue[_0xe335('0x7')](e,emitEvent(event));}}module[_0xe335('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x5f37=['events','../../mysqldb','FaxQueue','setMaxListeners','save','emit','hook','exports'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0x5f37,0xe0));var _0x75f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5f37[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x75f3('0x0'));var FaxQueue=require(_0x75f3('0x1'))['db'][_0x75f3('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x75f3('0x3')](0x0);var events={'afterCreate':_0x75f3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5ab3dc){return function(_0x5e6623,_0x131f12,_0xd4336a){FaxQueueEvents[_0x75f3('0x5')](_0x5ab3dc+':'+_0x5e6623['id'],_0x5e6623);FaxQueueEvents[_0x75f3('0x5')](_0x5ab3dc,_0x5e6623);_0xd4336a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x75f3('0x6')](e,emitEvent(event));}}module[_0x75f3('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index cef94c1..fa4cb37 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 _0xa4bc=['../../config/environment','./faxQueue.attributes','define','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0xa4bc,0x160));var _0xca4b=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xa4bc[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xca4b('0x0'));var util=require(_0xca4b('0x1'));var logger=require(_0xca4b('0x2'))(_0xca4b('0x3'));var moment=require(_0xca4b('0x4'));var BPromise=require(_0xca4b('0x5'));var rp=require(_0xca4b('0x6'));var fs=require('fs');var path=require(_0xca4b('0x7'));var rimraf=require('rimraf');var config=require(_0xca4b('0x8'));var attributes=require(_0xca4b('0x9'));module['exports']=function(_0x4e8ba3,_0x5520ca){return _0x4e8ba3[_0xca4b('0xa')]('FaxQueue',attributes,{'tableName':_0xca4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad8b=['moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','FaxQueue','fax_queues','lodash','util','api'];(function(_0xe166e1,_0x4becb1){var _0x1b66f2=function(_0x354aaf){while(--_0x354aaf){_0xe166e1['push'](_0xe166e1['shift']());}};_0x1b66f2(++_0x4becb1);}(_0xad8b,0x8c));var _0xbad8=function(_0xaa431b,_0x35f040){_0xaa431b=_0xaa431b-0x0;var _0x30d808=_0xad8b[_0xaa431b];return _0x30d808;};'use strict';var _=require(_0xbad8('0x0'));var util=require(_0xbad8('0x1'));var logger=require('../../config/logger')(_0xbad8('0x2'));var moment=require(_0xbad8('0x3'));var BPromise=require(_0xbad8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbad8('0x5'));var rimraf=require(_0xbad8('0x6'));var config=require(_0xbad8('0x7'));var attributes=require(_0xbad8('0x8'));module['exports']=function(_0x4ca6db,_0x388ada){return _0x4ca6db['define'](_0xbad8('0x9'),attributes,{'tableName':_0xbad8('0xa'),'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 b9a273c..e29f05d 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 _0x8f2b=['error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5a5bf0,_0x586555){var _0x33c9aa=function(_0x2873ff){while(--_0x2873ff){_0x5a5bf0['push'](_0x5a5bf0['shift']());}};_0x33c9aa(++_0x586555);}(_0x8f2b,0x183));var _0xb8f2=function(_0x5c3358,_0x246038){_0x5c3358=_0x5c3358-0x0;var _0x43ae35=_0x8f2b[_0x5c3358];return _0x43ae35;};'use strict';var _=require(_0xb8f2('0x0'));var util=require(_0xb8f2('0x1'));var moment=require(_0xb8f2('0x2'));var BPromise=require(_0xb8f2('0x3'));var rs=require(_0xb8f2('0x4'));var fs=require('fs');var Redis=require(_0xb8f2('0x5'));var db=require(_0xb8f2('0x6'))['db'];var utils=require(_0xb8f2('0x7'));var logger=require(_0xb8f2('0x8'))('rpc');var config=require(_0xb8f2('0x9'));var jayson=require(_0xb8f2('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xb8f2('0xb')]=_[_0xb8f2('0xc')](config[_0xb8f2('0xb')],{'host':_0xb8f2('0xd'),'port':0x18eb});var socket=require(_0xb8f2('0xe'))(new Redis(config['redis']));require(_0xb8f2('0xf'))[_0xb8f2('0x10')](socket);function respondWithRpcPromise(_0x5ac1ae,_0x1f1dcb,_0x3ecf99){return new BPromise(function(_0x43f7df,_0x13b26a){return client['request'](_0x5ac1ae,_0x3ecf99)[_0xb8f2('0x11')](function(_0x3dd8bb){logger[_0xb8f2('0x12')](_0xb8f2('0x13'),_0x1f1dcb,_0xb8f2('0x14'));logger[_0xb8f2('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1f1dcb,'request\x20sent',JSON[_0xb8f2('0x16')](_0x3dd8bb));if(_0x3dd8bb[_0xb8f2('0x17')]){if(_0x3dd8bb[_0xb8f2('0x17')][_0xb8f2('0x18')]===0x1f4){logger[_0xb8f2('0x17')](_0xb8f2('0x13'),_0x1f1dcb,_0x3dd8bb[_0xb8f2('0x17')][_0xb8f2('0x19')]);return _0x13b26a(_0x3dd8bb[_0xb8f2('0x17')]['message']);}logger[_0xb8f2('0x17')]('FaxQueue,\x20%s,\x20%s',_0x1f1dcb,_0x3dd8bb[_0xb8f2('0x17')][_0xb8f2('0x19')]);return _0x43f7df(_0x3dd8bb['error'][_0xb8f2('0x19')]);}else{logger[_0xb8f2('0x12')](_0xb8f2('0x13'),_0x1f1dcb,_0xb8f2('0x14'));_0x43f7df(_0x3dd8bb[_0xb8f2('0x1a')][_0xb8f2('0x19')]);}})[_0xb8f2('0x1b')](function(_0x20d2ec){logger[_0xb8f2('0x17')](_0xb8f2('0x13'),_0x1f1dcb,_0x20d2ec);_0x13b26a(_0x20d2ec);});});}exports[_0xb8f2('0x1c')]=function(_0x34120c){var _0x241974=this;return new Promise(function(_0x1667d8,_0x6aff8){return db[_0xb8f2('0x1d')][_0xb8f2('0x1e')]({'raw':_0x34120c[_0xb8f2('0x1f')]?_0x34120c[_0xb8f2('0x1f')][_0xb8f2('0x20')]===undefined?!![]:![]:!![],'where':_0x34120c[_0xb8f2('0x1f')]?_0x34120c[_0xb8f2('0x1f')][_0xb8f2('0x21')]||null:null,'attributes':_0x34120c['options']?_0x34120c[_0xb8f2('0x1f')][_0xb8f2('0x22')]||null:null,'limit':_0x34120c[_0xb8f2('0x1f')]?_0x34120c['options'][_0xb8f2('0x23')]||null:null,'include':_0x34120c[_0xb8f2('0x1f')]?_0x34120c[_0xb8f2('0x1f')][_0xb8f2('0x24')]?_[_0xb8f2('0x25')](_0x34120c[_0xb8f2('0x1f')][_0xb8f2('0x24')],function(_0x4f8a3e){return{'model':db[_0x4f8a3e[_0xb8f2('0x26')]],'as':_0x4f8a3e['as'],'attributes':_0x4f8a3e[_0xb8f2('0x22')],'include':_0x4f8a3e['include']?_[_0xb8f2('0x25')](_0x4f8a3e[_0xb8f2('0x24')],function(_0x3025cc){return{'model':db[_0x3025cc[_0xb8f2('0x26')]],'as':_0x3025cc['as'],'attributes':_0x3025cc[_0xb8f2('0x22')],'include':_0x3025cc['include']?_['map'](_0x3025cc[_0xb8f2('0x24')],function(_0xb6bcf6){return{'model':db[_0xb6bcf6[_0xb8f2('0x26')]],'as':_0xb6bcf6['as'],'attributes':_0xb6bcf6[_0xb8f2('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9c3820){logger[_0xb8f2('0x12')]('GetFaxQueue',_0x34120c);logger[_0xb8f2('0x15')](_0xb8f2('0x1c'),_0x34120c,JSON[_0xb8f2('0x16')](_0x9c3820));_0x1667d8(_0x9c3820);})[_0xb8f2('0x1b')](function(_0x70795f){logger[_0xb8f2('0x17')](_0xb8f2('0x1c'),_0x70795f[_0xb8f2('0x19')],_0x34120c);_0x6aff8(_0x241974[_0xb8f2('0x17')](0x1f4,_0x70795f[_0xb8f2('0x19')]));});});};exports[_0xb8f2('0x27')]=function(_0x76f61e){var _0xbf71d4=this;return new Promise(function(_0x1efd94,_0x2c7a24){return db[_0xb8f2('0x1d')][_0xb8f2('0x28')]({'raw':_0x76f61e['options']?_0x76f61e[_0xb8f2('0x1f')][_0xb8f2('0x20')]===undefined?!![]:![]:!![],'where':_0x76f61e['options']?_0x76f61e[_0xb8f2('0x1f')][_0xb8f2('0x21')]||null:null,'attributes':_0x76f61e[_0xb8f2('0x1f')]?_0x76f61e[_0xb8f2('0x1f')][_0xb8f2('0x22')]||null:null,'include':_0x76f61e[_0xb8f2('0x1f')]?_0x76f61e[_0xb8f2('0x1f')][_0xb8f2('0x24')]?_[_0xb8f2('0x25')](_0x76f61e['options'][_0xb8f2('0x24')],function(_0x427a9c){return{'model':db[_0x427a9c[_0xb8f2('0x26')]],'as':_0x427a9c['as'],'attributes':_0x427a9c[_0xb8f2('0x22')],'include':_0x427a9c[_0xb8f2('0x24')]?_[_0xb8f2('0x25')](_0x427a9c['include'],function(_0x529d84){return{'model':db[_0x529d84[_0xb8f2('0x26')]],'as':_0x529d84['as'],'attributes':_0x529d84[_0xb8f2('0x22')],'include':_0x529d84['include']?_['map'](_0x529d84[_0xb8f2('0x24')],function(_0xe68dc6){return{'model':db[_0xe68dc6[_0xb8f2('0x26')]],'as':_0xe68dc6['as'],'attributes':_0xe68dc6[_0xb8f2('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34db91){logger['info'](_0xb8f2('0x27'),_0x76f61e);logger[_0xb8f2('0x15')](_0xb8f2('0x27'),_0x76f61e,JSON[_0xb8f2('0x16')](_0x34db91));_0x1efd94(_0x34db91);})[_0xb8f2('0x1b')](function(_0x3254bc){logger[_0xb8f2('0x17')](_0xb8f2('0x27'),_0x3254bc[_0xb8f2('0x19')],_0x76f61e);_0x2c7a24(_0xbf71d4[_0xb8f2('0x17')](0x1f4,_0x3254bc[_0xb8f2('0x19')]));});});}; \ No newline at end of file +var _0x5bfa=['./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowFaxQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bfa,0x138));var _0xa5bf=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0x5bfa[_0x5c768b];return _0x335af8;};'use strict';var _=require(_0xa5bf('0x0'));var util=require(_0xa5bf('0x1'));var moment=require(_0xa5bf('0x2'));var BPromise=require(_0xa5bf('0x3'));var rs=require(_0xa5bf('0x4'));var fs=require('fs');var Redis=require(_0xa5bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5bf('0x6'));var logger=require(_0xa5bf('0x7'))(_0xa5bf('0x8'));var config=require(_0xa5bf('0x9'));var jayson=require(_0xa5bf('0xa'));var client=jayson[_0xa5bf('0xb')][_0xa5bf('0xc')]({'port':0x232a});config[_0xa5bf('0xd')]=_['defaults'](config[_0xa5bf('0xd')],{'host':_0xa5bf('0xe'),'port':0x18eb});var socket=require(_0xa5bf('0xf'))(new Redis(config[_0xa5bf('0xd')]));require(_0xa5bf('0x10'))['register'](socket);function respondWithRpcPromise(_0x299436,_0x2479ef,_0x528379){return new BPromise(function(_0x555e50,_0x2a3de1){return client[_0xa5bf('0x11')](_0x299436,_0x528379)[_0xa5bf('0x12')](function(_0x5c6616){logger[_0xa5bf('0x13')](_0xa5bf('0x14'),_0x2479ef,_0xa5bf('0x15'));logger['debug'](_0xa5bf('0x16'),_0x2479ef,_0xa5bf('0x15'),JSON[_0xa5bf('0x17')](_0x5c6616));if(_0x5c6616[_0xa5bf('0x18')]){if(_0x5c6616[_0xa5bf('0x18')][_0xa5bf('0x19')]===0x1f4){logger[_0xa5bf('0x18')]('FaxQueue,\x20%s,\x20%s',_0x2479ef,_0x5c6616[_0xa5bf('0x18')][_0xa5bf('0x1a')]);return _0x2a3de1(_0x5c6616[_0xa5bf('0x18')][_0xa5bf('0x1a')]);}logger['error'](_0xa5bf('0x14'),_0x2479ef,_0x5c6616[_0xa5bf('0x18')][_0xa5bf('0x1a')]);return _0x555e50(_0x5c6616[_0xa5bf('0x18')]['message']);}else{logger[_0xa5bf('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2479ef,_0xa5bf('0x15'));_0x555e50(_0x5c6616['result'][_0xa5bf('0x1a')]);}})['catch'](function(_0x2d1ebe){logger[_0xa5bf('0x18')](_0xa5bf('0x14'),_0x2479ef,_0x2d1ebe);_0x2a3de1(_0x2d1ebe);});});}exports[_0xa5bf('0x1b')]=function(_0x5742ed){var _0x227726=this;return new Promise(function(_0x4c5add,_0x25c90c){return db['FaxQueue'][_0xa5bf('0x1c')]({'raw':_0x5742ed[_0xa5bf('0x1d')]?_0x5742ed[_0xa5bf('0x1d')][_0xa5bf('0x1e')]===undefined?!![]:![]:!![],'where':_0x5742ed[_0xa5bf('0x1d')]?_0x5742ed[_0xa5bf('0x1d')][_0xa5bf('0x1f')]||null:null,'attributes':_0x5742ed[_0xa5bf('0x1d')]?_0x5742ed[_0xa5bf('0x1d')][_0xa5bf('0x20')]||null:null,'limit':_0x5742ed['options']?_0x5742ed[_0xa5bf('0x1d')][_0xa5bf('0x21')]||null:null,'include':_0x5742ed[_0xa5bf('0x1d')]?_0x5742ed['options'][_0xa5bf('0x22')]?_[_0xa5bf('0x23')](_0x5742ed[_0xa5bf('0x1d')][_0xa5bf('0x22')],function(_0x2a65f5){return{'model':db[_0x2a65f5['model']],'as':_0x2a65f5['as'],'attributes':_0x2a65f5['attributes'],'include':_0x2a65f5[_0xa5bf('0x22')]?_['map'](_0x2a65f5[_0xa5bf('0x22')],function(_0x2a3fe0){return{'model':db[_0x2a3fe0['model']],'as':_0x2a3fe0['as'],'attributes':_0x2a3fe0[_0xa5bf('0x20')],'include':_0x2a3fe0[_0xa5bf('0x22')]?_[_0xa5bf('0x23')](_0x2a3fe0[_0xa5bf('0x22')],function(_0x4e980a){return{'model':db[_0x4e980a[_0xa5bf('0x24')]],'as':_0x4e980a['as'],'attributes':_0x4e980a[_0xa5bf('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa5bf('0x12')](function(_0x4f7246){logger[_0xa5bf('0x13')]('GetFaxQueue',_0x5742ed);logger[_0xa5bf('0x25')](_0xa5bf('0x1b'),_0x5742ed,JSON[_0xa5bf('0x17')](_0x4f7246));_0x4c5add(_0x4f7246);})['catch'](function(_0xb18c5a){logger[_0xa5bf('0x18')](_0xa5bf('0x1b'),_0xb18c5a[_0xa5bf('0x1a')],_0x5742ed);_0x25c90c(_0x227726[_0xa5bf('0x18')](0x1f4,_0xb18c5a[_0xa5bf('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x33997e){var _0x52178f=this;return new Promise(function(_0x26de7c,_0x2f8bb5){return db['FaxQueue'][_0xa5bf('0x26')]({'raw':_0x33997e[_0xa5bf('0x1d')]?_0x33997e[_0xa5bf('0x1d')][_0xa5bf('0x1e')]===undefined?!![]:![]:!![],'where':_0x33997e[_0xa5bf('0x1d')]?_0x33997e[_0xa5bf('0x1d')][_0xa5bf('0x1f')]||null:null,'attributes':_0x33997e[_0xa5bf('0x1d')]?_0x33997e[_0xa5bf('0x1d')][_0xa5bf('0x20')]||null:null,'include':_0x33997e[_0xa5bf('0x1d')]?_0x33997e['options'][_0xa5bf('0x22')]?_[_0xa5bf('0x23')](_0x33997e[_0xa5bf('0x1d')]['include'],function(_0x531414){return{'model':db[_0x531414[_0xa5bf('0x24')]],'as':_0x531414['as'],'attributes':_0x531414['attributes'],'include':_0x531414[_0xa5bf('0x22')]?_[_0xa5bf('0x23')](_0x531414[_0xa5bf('0x22')],function(_0xf69de3){return{'model':db[_0xf69de3['model']],'as':_0xf69de3['as'],'attributes':_0xf69de3[_0xa5bf('0x20')],'include':_0xf69de3[_0xa5bf('0x22')]?_['map'](_0xf69de3['include'],function(_0x29843d){return{'model':db[_0x29843d[_0xa5bf('0x24')]],'as':_0x29843d['as'],'attributes':_0x29843d[_0xa5bf('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa5bf('0x12')](function(_0x472210){logger[_0xa5bf('0x13')](_0xa5bf('0x27'),_0x33997e);logger[_0xa5bf('0x25')]('ShowFaxQueue',_0x33997e,JSON[_0xa5bf('0x17')](_0x472210));_0x26de7c(_0x472210);})[_0xa5bf('0x28')](function(_0x5e532e){logger[_0xa5bf('0x18')](_0xa5bf('0x27'),_0x5e532e['message'],_0x33997e);_0x2f8bb5(_0x52178f[_0xa5bf('0x18')](0x1f4,_0x5e532e[_0xa5bf('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7e60fed..c75abbf 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 _0x9417=['emit','removeListener','register','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x89d79e,_0x3b5ddf){var _0x1a01c7=function(_0xdca183){while(--_0xdca183){_0x89d79e['push'](_0x89d79e['shift']());}};_0x1a01c7(++_0x3b5ddf);}(_0x9417,0xb4));var _0x7941=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x9417[_0x4fc421];return _0x8c6d63;};'use strict';var FaxQueueEvents=require(_0x7941('0x0'));var events=[_0x7941('0x1'),_0x7941('0x2'),_0x7941('0x3')];function createListener(_0x5e2057,_0x32968f){return function(_0x240766){_0x32968f[_0x7941('0x4')](_0x5e2057,_0x240766);};}function removeListener(_0x3351ee,_0x6f6dca){return function(){FaxQueueEvents[_0x7941('0x5')](_0x3351ee,_0x6f6dca);};}exports[_0x7941('0x6')]=function(_0x3e38d8){for(var _0x1dee1a=0x0,_0x15c666=events['length'];_0x1dee1a<_0x15c666;_0x1dee1a++){var _0x11a155=events[_0x1dee1a];var _0x238e43=createListener(_0x7941('0x7')+_0x11a155,_0x3e38d8);FaxQueueEvents['on'](_0x11a155,_0x238e43);}}; \ No newline at end of file +var _0xc628=['emit','removeListener','register','length','./faxQueue.events','save','remove'];(function(_0x390e6c,_0x4d7d42){var _0x596b05=function(_0xe6d4aa){while(--_0xe6d4aa){_0x390e6c['push'](_0x390e6c['shift']());}};_0x596b05(++_0x4d7d42);}(_0xc628,0x6d));var _0x8c62=function(_0xa6953d,_0x3cdd33){_0xa6953d=_0xa6953d-0x0;var _0x381ccc=_0xc628[_0xa6953d];return _0x381ccc;};'use strict';var FaxQueueEvents=require(_0x8c62('0x0'));var events=[_0x8c62('0x1'),_0x8c62('0x2'),'update'];function createListener(_0x150fb8,_0x3cab01){return function(_0x15dc5f){_0x3cab01[_0x8c62('0x3')](_0x150fb8,_0x15dc5f);};}function removeListener(_0x249544,_0xe09324){return function(){FaxQueueEvents[_0x8c62('0x4')](_0x249544,_0xe09324);};}exports[_0x8c62('0x5')]=function(_0x4cdc3b){for(var _0x375825=0x0,_0x4f623d=events[_0x8c62('0x6')];_0x375825<_0x4f623d;_0x375825++){var _0x1a1874=events[_0x375825];var _0x42ead3=createListener('faxQueue:'+_0x1a1874,_0x4cdc3b);FaxQueueEvents['on'](_0x1a1874,_0x42ead3);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7f28184..ae87ee5 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 _0xa809=['express','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addAgents','put','update','delete','removeTeams','/:id/users','exports','util'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xa809,0x1f3));var _0x9a80=function(_0x4dc4ac,_0x1e9bac){_0x4dc4ac=_0x4dc4ac-0x0;var _0x12d55b=_0xa809[_0x4dc4ac];return _0x12d55b;};'use strict';var multer=require('multer');var util=require(_0x9a80('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9a80('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a80('0x2'));var config=require(_0x9a80('0x3'));var controller=require(_0x9a80('0x4'));router[_0x9a80('0x5')]('/',auth['isAuthenticated'](),controller[_0x9a80('0x6')]);router['get'](_0x9a80('0x7'),auth[_0x9a80('0x8')](),controller['describe']);router[_0x9a80('0x5')](_0x9a80('0x9'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xa')]);router['get'](_0x9a80('0xb'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xc')]);router[_0x9a80('0x5')](_0x9a80('0xd'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xe')]);router[_0x9a80('0x5')]('/:id/users',auth[_0x9a80('0x8')](),controller[_0x9a80('0xf')]);router[_0x9a80('0x10')]('/',auth[_0x9a80('0x8')](),controller[_0x9a80('0x11')]);router[_0x9a80('0x10')](_0x9a80('0xd'),auth[_0x9a80('0x8')](),controller['addTeams']);router[_0x9a80('0x10')]('/:id/users',auth[_0x9a80('0x8')](),controller[_0x9a80('0x12')]);router[_0x9a80('0x13')]('/:id',auth[_0x9a80('0x8')](),controller[_0x9a80('0x14')]);router[_0x9a80('0x15')](_0x9a80('0x9'),auth[_0x9a80('0x8')](),controller['destroy']);router[_0x9a80('0x15')]('/:id/teams',auth[_0x9a80('0x8')](),controller[_0x9a80('0x16')]);router[_0x9a80('0x15')](_0x9a80('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9a80('0x18')]=router; \ No newline at end of file +var _0x6363=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x6363,0x13a));var _0x3636=function(_0x57fc27,_0x5e4d8b){_0x57fc27=_0x57fc27-0x0;var _0x44d5b8=_0x6363[_0x57fc27];return _0x44d5b8;};'use strict';var multer=require(_0x3636('0x0'));var util=require('util');var path=require(_0x3636('0x1'));var timeout=require(_0x3636('0x2'));var express=require(_0x3636('0x3'));var router=express[_0x3636('0x4')]();var fs_extra=require(_0x3636('0x5'));var auth=require(_0x3636('0x6'));var interaction=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var controller=require(_0x3636('0x9'));router[_0x3636('0xa')]('/',auth[_0x3636('0xb')](),controller[_0x3636('0xc')]);router[_0x3636('0xa')](_0x3636('0xd'),auth['isAuthenticated'](),controller[_0x3636('0xe')]);router['get'](_0x3636('0xf'),auth[_0x3636('0xb')](),controller[_0x3636('0x10')]);router[_0x3636('0xa')](_0x3636('0x11'),auth[_0x3636('0xb')](),controller[_0x3636('0x12')]);router[_0x3636('0xa')](_0x3636('0x13'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3636('0xa')]('/:id/users',auth[_0x3636('0xb')](),controller[_0x3636('0x14')]);router[_0x3636('0x15')]('/',auth[_0x3636('0xb')](),controller[_0x3636('0x16')]);router[_0x3636('0x15')](_0x3636('0x13'),auth[_0x3636('0xb')](),controller[_0x3636('0x17')]);router[_0x3636('0x15')](_0x3636('0x18'),auth[_0x3636('0xb')](),controller[_0x3636('0x19')]);router[_0x3636('0x1a')](_0x3636('0xf'),auth[_0x3636('0xb')](),controller[_0x3636('0x1b')]);router['delete'](_0x3636('0xf'),auth[_0x3636('0xb')](),controller['destroy']);router[_0x3636('0x1c')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3636('0x1d')]);router[_0x3636('0x1c')](_0x3636('0x18'),auth[_0x3636('0xb')](),controller[_0x3636('0x1e')]);module[_0x3636('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7ff083c..90c4f8a 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 _0xb34b=['moment','STRING','DATE'];(function(_0x42f8b5,_0x45e908){var _0x1c5c01=function(_0x4184a8){while(--_0x4184a8){_0x42f8b5['push'](_0x42f8b5['shift']());}};_0x1c5c01(++_0x45e908);}(_0xb34b,0x1e9));var _0xbb34=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb34b[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0xbb34('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xbb34('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbb34('0x2')]},'leaveAt':{'type':Sequelize[_0xbb34('0x2')]},'acceptAt':{'type':Sequelize[_0xbb34('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbb34('0x1')]}}; \ No newline at end of file +var _0xc7b9=['moment','sequelize','exports','STRING','DATE'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xc7b9,0x1b3));var _0x9c7b=function(_0x272bae,_0x5acf53){_0x272bae=_0x272bae-0x0;var _0x322f77=_0xc7b9[_0x272bae];return _0x322f77;};'use strict';var moment=require(_0x9c7b('0x0'));var Sequelize=require(_0x9c7b('0x1'));module[_0x9c7b('0x2')]={'uniqueid':{'type':Sequelize[_0x9c7b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9c7b('0x3')]},'joinAt':{'type':Sequelize[_0x9c7b('0x4')]},'leaveAt':{'type':Sequelize[_0x9c7b('0x4')]},'acceptAt':{'type':Sequelize[_0x9c7b('0x4')]},'exitAt':{'type':Sequelize[_0x9c7b('0x4')]},'reason':{'type':Sequelize[_0x9c7b('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4664978..d3195b4 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 _0xf296=['create','body','destroy','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find'];(function(_0x4bf12a,_0x125aa0){var _0x1336c2=function(_0x326383){while(--_0x326383){_0x4bf12a['push'](_0x4bf12a['shift']());}};_0x1336c2(++_0x125aa0);}(_0xf296,0x94));var _0x6f29=function(_0x5da107,_0x10357c){_0x5da107=_0x5da107-0x0;var _0x224f15=_0xf296[_0x5da107];return _0x224f15;};'use strict';var emlformat=require(_0x6f29('0x0'));var rimraf=require(_0x6f29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f29('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6f29('0x3'));var Mustache=require(_0x6f29('0x4'));var util=require('util');var path=require(_0x6f29('0x5'));var sox=require(_0x6f29('0x6'));var csv=require(_0x6f29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f29('0x8'));var _=require(_0x6f29('0x9'));var squel=require('squel');var crypto=require(_0x6f29('0xa'));var jsforce=require(_0x6f29('0xb'));var deskjs=require(_0x6f29('0xc'));var toCsv=require(_0x6f29('0x7'));var querystring=require(_0x6f29('0xd'));var Papa=require(_0x6f29('0xe'));var Redis=require(_0x6f29('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f29('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6f29('0x11'));var utils=require('../../config/utils');var config=require(_0x6f29('0x12'));var licenseUtil=require(_0x6f29('0x13'));var db=require(_0x6f29('0x14'))['db'];function respondWithStatusCode(_0x56e2a4,_0x1ce6a2){_0x1ce6a2=_0x1ce6a2||0xcc;return function(_0x3cec2a){if(_0x3cec2a){return _0x56e2a4[_0x6f29('0x15')](_0x1ce6a2);}return _0x56e2a4[_0x6f29('0x16')](_0x1ce6a2)[_0x6f29('0x17')]();};}function respondWithResult(_0x4b9304,_0x429604){_0x429604=_0x429604||0xc8;return function(_0x115d08){if(_0x115d08){return _0x4b9304[_0x6f29('0x16')](_0x429604)['json'](_0x115d08);}};}function respondWithFilteredResult(_0x3602e4,_0x50e0d6){return function(_0x3959e4){if(_0x3959e4){var _0x2907e4=typeof _0x50e0d6[_0x6f29('0x18')]===_0x6f29('0x19')&&typeof _0x50e0d6['limit']==='undefined';var _0x28995e=_0x3959e4[_0x6f29('0x1a')];var _0x5b524d=_0x2907e4?0x0:_0x50e0d6['offset'];var _0x30e10f=_0x2907e4?_0x3959e4[_0x6f29('0x1a')]:_0x50e0d6[_0x6f29('0x18')]+_0x50e0d6[_0x6f29('0x1b')];var _0x29b580;if(_0x30e10f>=_0x28995e){_0x30e10f=_0x28995e;_0x29b580=0xc8;}else{_0x29b580=0xce;}_0x3602e4['status'](_0x29b580);return _0x3602e4[_0x6f29('0x1c')](_0x6f29('0x1d'),_0x5b524d+'-'+_0x30e10f+'/'+_0x28995e)[_0x6f29('0x1e')](_0x3959e4);}return null;};}function patchUpdates(_0x33afa3){return function(_0x1f7c53){try{jsonpatch[_0x6f29('0x1f')](_0x1f7c53,_0x33afa3,!![]);}catch(_0x56ca2d){return BPromise['reject'](_0x56ca2d);}return _0x1f7c53[_0x6f29('0x20')]();};}function saveUpdates(_0x430dc8,_0xf7309){return function(_0x4924ca){if(_0x4924ca){return _0x4924ca[_0x6f29('0x21')](_0x430dc8)[_0x6f29('0x22')](function(_0x1ae43e){return _0x1ae43e;});}return null;};}function removeEntity(_0x3e9977,_0x16eaa9){return function(_0x9d7eda){if(_0x9d7eda){return _0x9d7eda['destroy']()[_0x6f29('0x22')](function(){_0x3e9977[_0x6f29('0x16')](0xcc)[_0x6f29('0x17')]();});}};}function handleEntityNotFound(_0x54c05b,_0x5883e3){return function(_0x4fa5f9){if(!_0x4fa5f9){_0x54c05b[_0x6f29('0x15')](0x194);}return _0x4fa5f9;};}function handleError(_0x2593ba,_0x1b0ff7){_0x1b0ff7=_0x1b0ff7||0x1f4;return function(_0x301406){logger[_0x6f29('0x23')](_0x301406[_0x6f29('0x24')]);if(_0x301406[_0x6f29('0x25')]){delete _0x301406[_0x6f29('0x25')];}_0x2593ba['status'](_0x1b0ff7)[_0x6f29('0x26')](_0x301406);};}exports[_0x6f29('0x27')]=function(_0x4ceaea,_0x18f379){var _0x8e0348={},_0x3c6d71={},_0x305367={'count':0x0,'rows':[]};var _0x315116=_['map'](db[_0x6f29('0x28')][_0x6f29('0x29')],function(_0x5b57a3){return{'name':_0x5b57a3[_0x6f29('0x2a')],'type':_0x5b57a3[_0x6f29('0x2b')]['key']};});_0x3c6d71[_0x6f29('0x2c')]=_['map'](_0x315116,_0x6f29('0x25'));_0x3c6d71[_0x6f29('0x2d')]=_[_0x6f29('0x2e')](_0x4ceaea['query']);_0x3c6d71[_0x6f29('0x2f')]=_[_0x6f29('0x30')](_0x3c6d71[_0x6f29('0x2c')],_0x3c6d71['query']);_0x8e0348[_0x6f29('0x31')]=_[_0x6f29('0x30')](_0x3c6d71['model'],qs[_0x6f29('0x32')](_0x4ceaea[_0x6f29('0x2d')][_0x6f29('0x32')]));_0x8e0348[_0x6f29('0x31')]=_0x8e0348[_0x6f29('0x31')][_0x6f29('0x33')]?_0x8e0348[_0x6f29('0x31')]:_0x3c6d71[_0x6f29('0x2c')];if(!_0x4ceaea[_0x6f29('0x2d')][_0x6f29('0x34')]('nolimit')){_0x8e0348['limit']=qs[_0x6f29('0x1b')](_0x4ceaea['query'][_0x6f29('0x1b')]);_0x8e0348[_0x6f29('0x18')]=qs[_0x6f29('0x18')](_0x4ceaea['query'][_0x6f29('0x18')]);}_0x8e0348[_0x6f29('0x35')]=qs['sort'](_0x4ceaea[_0x6f29('0x2d')]['sort']);_0x8e0348[_0x6f29('0x36')]=qs[_0x6f29('0x2f')](_[_0x6f29('0x37')](_0x4ceaea['query'],_0x3c6d71[_0x6f29('0x2f')]),_0x315116);if(_0x4ceaea[_0x6f29('0x2d')][_0x6f29('0x38')]){_0x8e0348[_0x6f29('0x36')]=_[_0x6f29('0x39')](_0x8e0348[_0x6f29('0x36')],{'$or':_[_0x6f29('0x3a')](_0x315116,function(_0x2ebc0a){if(_0x2ebc0a[_0x6f29('0x2b')]!==_0x6f29('0x3b')){var _0x314004={};_0x314004[_0x2ebc0a[_0x6f29('0x25')]]={'$like':'%'+_0x4ceaea[_0x6f29('0x2d')]['filter']+'%'};return _0x314004;}})});}_0x8e0348=_['merge']({},_0x8e0348,_0x4ceaea[_0x6f29('0x3c')]);var _0x319ed2={'where':_0x8e0348[_0x6f29('0x36')]};return db[_0x6f29('0x28')][_0x6f29('0x1a')](_0x319ed2)[_0x6f29('0x22')](function(_0x1c3ed6){_0x305367['count']=_0x1c3ed6;if(_0x4ceaea[_0x6f29('0x2d')][_0x6f29('0x3d')]){_0x8e0348['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x6f29('0x3e')](_0x8e0348);})['then'](function(_0x35e4c2){_0x305367[_0x6f29('0x3f')]=_0x35e4c2;return _0x305367;})[_0x6f29('0x22')](respondWithFilteredResult(_0x18f379,_0x8e0348))[_0x6f29('0x40')](handleError(_0x18f379,null));};exports['show']=function(_0x4eb78d,_0x320b64){var _0x12ab79={'raw':!![],'where':{'id':_0x4eb78d[_0x6f29('0x41')]['id']}},_0x41d214={};_0x41d214[_0x6f29('0x2c')]=_[_0x6f29('0x2e')](db['FaxQueueReport'][_0x6f29('0x29')]);_0x41d214[_0x6f29('0x2d')]=_['keys'](_0x4eb78d[_0x6f29('0x2d')]);_0x41d214[_0x6f29('0x2f')]=_[_0x6f29('0x30')](_0x41d214[_0x6f29('0x2c')],_0x41d214[_0x6f29('0x2d')]);_0x12ab79[_0x6f29('0x31')]=_[_0x6f29('0x30')](_0x41d214[_0x6f29('0x2c')],qs[_0x6f29('0x32')](_0x4eb78d[_0x6f29('0x2d')][_0x6f29('0x32')]));_0x12ab79[_0x6f29('0x31')]=_0x12ab79[_0x6f29('0x31')][_0x6f29('0x33')]?_0x12ab79['attributes']:_0x41d214[_0x6f29('0x2c')];if(_0x4eb78d[_0x6f29('0x2d')]['includeAll']){_0x12ab79[_0x6f29('0x42')]=[{'all':!![]}];}_0x12ab79=_[_0x6f29('0x39')]({},_0x12ab79,_0x4eb78d[_0x6f29('0x3c')]);return db['FaxQueueReport'][_0x6f29('0x43')](_0x12ab79)[_0x6f29('0x22')](handleEntityNotFound(_0x320b64,null))['then'](respondWithResult(_0x320b64,null))[_0x6f29('0x40')](handleError(_0x320b64,null));};exports[_0x6f29('0x44')]=function(_0x2c97e7,_0x9e10e){return db[_0x6f29('0x28')][_0x6f29('0x44')](_0x2c97e7[_0x6f29('0x45')],{})[_0x6f29('0x22')](respondWithResult(_0x9e10e,0xc9))['catch'](handleError(_0x9e10e,null));};exports[_0x6f29('0x21')]=function(_0x27d36f,_0x1042c9){if(_0x27d36f[_0x6f29('0x45')]['id']){delete _0x27d36f[_0x6f29('0x45')]['id'];}return db['FaxQueueReport'][_0x6f29('0x43')]({'where':{'id':_0x27d36f[_0x6f29('0x41')]['id']}})[_0x6f29('0x22')](handleEntityNotFound(_0x1042c9,null))[_0x6f29('0x22')](saveUpdates(_0x27d36f['body'],null))[_0x6f29('0x22')](respondWithResult(_0x1042c9,null))[_0x6f29('0x40')](handleError(_0x1042c9,null));};exports[_0x6f29('0x46')]=function(_0x341f64,_0x58f431){return db[_0x6f29('0x28')][_0x6f29('0x43')]({'where':{'id':_0x341f64[_0x6f29('0x41')]['id']}})[_0x6f29('0x22')](handleEntityNotFound(_0x58f431,null))['then'](removeEntity(_0x58f431,null))['catch'](handleError(_0x58f431,null));};exports[_0x6f29('0x47')]=function(_0x117ffb,_0x436fb4){return db[_0x6f29('0x28')][_0x6f29('0x47')]()[_0x6f29('0x22')](respondWithResult(_0x436fb4,null))[_0x6f29('0x40')](handleError(_0x436fb4,null));}; \ No newline at end of file +var _0xcd4e=['Content-Range','apply','save','update','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','FaxQueueReport','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set'];(function(_0x405832,_0x10f728){var _0x138aab=function(_0x5d3759){while(--_0x5d3759){_0x405832['push'](_0x405832['shift']());}};_0x138aab(++_0x10f728);}(_0xcd4e,0x187));var _0xecd4=function(_0x3c02af,_0x168cf2){_0x3c02af=_0x3c02af-0x0;var _0x1bd9e6=_0xcd4e[_0x3c02af];return _0x1bd9e6;};'use strict';var emlformat=require(_0xecd4('0x0'));var rimraf=require(_0xecd4('0x1'));var zipdir=require(_0xecd4('0x2'));var jsonpatch=require(_0xecd4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xecd4('0x4'));var Mustache=require(_0xecd4('0x5'));var util=require('util');var path=require(_0xecd4('0x6'));var sox=require('sox');var csv=require(_0xecd4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecd4('0x8'));var _=require(_0xecd4('0x9'));var squel=require(_0xecd4('0xa'));var crypto=require(_0xecd4('0xb'));var jsforce=require(_0xecd4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecd4('0x7'));var querystring=require(_0xecd4('0xd'));var Papa=require('papaparse');var Redis=require(_0xecd4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xecd4('0xf'));var as=require(_0xecd4('0x10'));var hardwareService=require(_0xecd4('0x11'));var logger=require('../../config/logger')(_0xecd4('0x12'));var utils=require(_0xecd4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xecd4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ccd07,_0x1a5f58){_0x1a5f58=_0x1a5f58||0xcc;return function(_0x425de2){if(_0x425de2){return _0x3ccd07[_0xecd4('0x15')](_0x1a5f58);}return _0x3ccd07[_0xecd4('0x16')](_0x1a5f58)['end']();};}function respondWithResult(_0x3645d1,_0x21cb7b){_0x21cb7b=_0x21cb7b||0xc8;return function(_0x15dddc){if(_0x15dddc){return _0x3645d1[_0xecd4('0x16')](_0x21cb7b)[_0xecd4('0x17')](_0x15dddc);}};}function respondWithFilteredResult(_0x1b69a2,_0x2add6f){return function(_0x39d681){if(_0x39d681){var _0x1fb460=typeof _0x2add6f['offset']===_0xecd4('0x18')&&typeof _0x2add6f[_0xecd4('0x19')]===_0xecd4('0x18');var _0x2b542c=_0x39d681[_0xecd4('0x1a')];var _0x2470ec=_0x1fb460?0x0:_0x2add6f['offset'];var _0x703bb4=_0x1fb460?_0x39d681['count']:_0x2add6f[_0xecd4('0x1b')]+_0x2add6f[_0xecd4('0x19')];var _0x38eb18;if(_0x703bb4>=_0x2b542c){_0x703bb4=_0x2b542c;_0x38eb18=0xc8;}else{_0x38eb18=0xce;}_0x1b69a2[_0xecd4('0x16')](_0x38eb18);return _0x1b69a2[_0xecd4('0x1c')](_0xecd4('0x1d'),_0x2470ec+'-'+_0x703bb4+'/'+_0x2b542c)[_0xecd4('0x17')](_0x39d681);}return null;};}function patchUpdates(_0x26bb76){return function(_0x21d7d1){try{jsonpatch[_0xecd4('0x1e')](_0x21d7d1,_0x26bb76,!![]);}catch(_0x14d24c){return BPromise['reject'](_0x14d24c);}return _0x21d7d1[_0xecd4('0x1f')]();};}function saveUpdates(_0x353f13,_0x269451){return function(_0x588f0b){if(_0x588f0b){return _0x588f0b[_0xecd4('0x20')](_0x353f13)['then'](function(_0x57ae55){return _0x57ae55;});}return null;};}function removeEntity(_0x2e5a0a,_0x11c791){return function(_0x104507){if(_0x104507){return _0x104507[_0xecd4('0x21')]()[_0xecd4('0x22')](function(){_0x2e5a0a[_0xecd4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2910e1,_0x38b6da){return function(_0x1b76d7){if(!_0x1b76d7){_0x2910e1['sendStatus'](0x194);}return _0x1b76d7;};}function handleError(_0x2d0a43,_0x3941d4){_0x3941d4=_0x3941d4||0x1f4;return function(_0x3ccb67){logger['error'](_0x3ccb67[_0xecd4('0x23')]);if(_0x3ccb67[_0xecd4('0x24')]){delete _0x3ccb67['name'];}_0x2d0a43[_0xecd4('0x16')](_0x3941d4)['send'](_0x3ccb67);};}exports[_0xecd4('0x25')]=function(_0x40b76f,_0x40d0a2){var _0x5e509a={},_0x3b1ef0={},_0x48e059={'count':0x0,'rows':[]};var _0x220ec5=_[_0xecd4('0x26')](db['FaxQueueReport'][_0xecd4('0x27')],function(_0x46696e){return{'name':_0x46696e[_0xecd4('0x28')],'type':_0x46696e[_0xecd4('0x29')][_0xecd4('0x2a')]};});_0x3b1ef0[_0xecd4('0x2b')]=_['map'](_0x220ec5,_0xecd4('0x24'));_0x3b1ef0[_0xecd4('0x2c')]=_['keys'](_0x40b76f[_0xecd4('0x2c')]);_0x3b1ef0[_0xecd4('0x2d')]=_['intersection'](_0x3b1ef0[_0xecd4('0x2b')],_0x3b1ef0[_0xecd4('0x2c')]);_0x5e509a[_0xecd4('0x2e')]=_[_0xecd4('0x2f')](_0x3b1ef0[_0xecd4('0x2b')],qs[_0xecd4('0x30')](_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x30')]));_0x5e509a[_0xecd4('0x2e')]=_0x5e509a['attributes'][_0xecd4('0x31')]?_0x5e509a[_0xecd4('0x2e')]:_0x3b1ef0[_0xecd4('0x2b')];if(!_0x40b76f['query'][_0xecd4('0x32')](_0xecd4('0x33'))){_0x5e509a['limit']=qs['limit'](_0x40b76f[_0xecd4('0x2c')]['limit']);_0x5e509a['offset']=qs[_0xecd4('0x1b')](_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x1b')]);}_0x5e509a['order']=qs['sort'](_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x34')]);_0x5e509a[_0xecd4('0x35')]=qs[_0xecd4('0x2d')](_[_0xecd4('0x36')](_0x40b76f[_0xecd4('0x2c')],_0x3b1ef0['filters']),_0x220ec5);if(_0x40b76f['query'][_0xecd4('0x37')]){_0x5e509a[_0xecd4('0x35')]=_['merge'](_0x5e509a[_0xecd4('0x35')],{'$or':_[_0xecd4('0x26')](_0x220ec5,function(_0x43c32d){if(_0x43c32d[_0xecd4('0x29')]!=='VIRTUAL'){var _0x4794fa={};_0x4794fa[_0x43c32d[_0xecd4('0x24')]]={'$like':'%'+_0x40b76f[_0xecd4('0x2c')][_0xecd4('0x37')]+'%'};return _0x4794fa;}})});}_0x5e509a=_[_0xecd4('0x38')]({},_0x5e509a,_0x40b76f[_0xecd4('0x39')]);var _0x32c1db={'where':_0x5e509a['where']};return db['FaxQueueReport']['count'](_0x32c1db)[_0xecd4('0x22')](function(_0x4a0009){_0x48e059[_0xecd4('0x1a')]=_0x4a0009;if(_0x40b76f['query'][_0xecd4('0x3a')]){_0x5e509a[_0xecd4('0x3b')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x5e509a);})[_0xecd4('0x22')](function(_0x107dcb){_0x48e059[_0xecd4('0x3c')]=_0x107dcb;return _0x48e059;})['then'](respondWithFilteredResult(_0x40d0a2,_0x5e509a))[_0xecd4('0x3d')](handleError(_0x40d0a2,null));};exports[_0xecd4('0x3e')]=function(_0xbf419,_0x4aaf66){var _0x256612={'raw':!![],'where':{'id':_0xbf419[_0xecd4('0x3f')]['id']}},_0xd732a1={};_0xd732a1[_0xecd4('0x2b')]=_[_0xecd4('0x40')](db[_0xecd4('0x41')]['rawAttributes']);_0xd732a1[_0xecd4('0x2c')]=_[_0xecd4('0x40')](_0xbf419[_0xecd4('0x2c')]);_0xd732a1['filters']=_[_0xecd4('0x2f')](_0xd732a1[_0xecd4('0x2b')],_0xd732a1['query']);_0x256612[_0xecd4('0x2e')]=_['intersection'](_0xd732a1[_0xecd4('0x2b')],qs[_0xecd4('0x30')](_0xbf419[_0xecd4('0x2c')][_0xecd4('0x30')]));_0x256612[_0xecd4('0x2e')]=_0x256612[_0xecd4('0x2e')][_0xecd4('0x31')]?_0x256612[_0xecd4('0x2e')]:_0xd732a1['model'];if(_0xbf419['query'][_0xecd4('0x3a')]){_0x256612[_0xecd4('0x3b')]=[{'all':!![]}];}_0x256612=_[_0xecd4('0x38')]({},_0x256612,_0xbf419[_0xecd4('0x39')]);return db[_0xecd4('0x41')][_0xecd4('0x42')](_0x256612)[_0xecd4('0x22')](handleEntityNotFound(_0x4aaf66,null))[_0xecd4('0x22')](respondWithResult(_0x4aaf66,null))[_0xecd4('0x3d')](handleError(_0x4aaf66,null));};exports[_0xecd4('0x43')]=function(_0x1a29a,_0x234b0a){return db['FaxQueueReport']['create'](_0x1a29a[_0xecd4('0x44')],{})[_0xecd4('0x22')](respondWithResult(_0x234b0a,0xc9))[_0xecd4('0x3d')](handleError(_0x234b0a,null));};exports[_0xecd4('0x20')]=function(_0x161ec3,_0x34d09a){if(_0x161ec3[_0xecd4('0x44')]['id']){delete _0x161ec3[_0xecd4('0x44')]['id'];}return db[_0xecd4('0x41')]['find']({'where':{'id':_0x161ec3['params']['id']}})[_0xecd4('0x22')](handleEntityNotFound(_0x34d09a,null))[_0xecd4('0x22')](saveUpdates(_0x161ec3[_0xecd4('0x44')],null))[_0xecd4('0x22')](respondWithResult(_0x34d09a,null))[_0xecd4('0x3d')](handleError(_0x34d09a,null));};exports['destroy']=function(_0x3f5f8c,_0x247ab5){return db[_0xecd4('0x41')][_0xecd4('0x42')]({'where':{'id':_0x3f5f8c[_0xecd4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x247ab5,null))['then'](removeEntity(_0x247ab5,null))['catch'](handleError(_0x247ab5,null));};exports['describe']=function(_0x2f50bc,_0x5c45c8){return db[_0xecd4('0x41')][_0xecd4('0x45')]()[_0xecd4('0x22')](respondWithResult(_0x5c45c8,null))[_0xecd4('0x3d')](handleError(_0x5c45c8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a1410e9..9bfbfbd 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x3ed508,_0x5734c4){var _0x111e50=function(_0x29557){while(--_0x29557){_0x3ed508['push'](_0x3ed508['shift']());}};_0x111e50(++_0x5734c4);}(_0xf494,0x1c6));var _0x4f49=function(_0x756a10,_0x332327){_0x756a10=_0x756a10-0x0;var _0x2a8006=_0xf494[_0x756a10];return _0x2a8006;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3356d9,_0x4b2e3e){var _0x37b8ce=function(_0x3b45ac){while(--_0x3b45ac){_0x3356d9['push'](_0x3356d9['shift']());}};_0x37b8ce(++_0x4b2e3e);}(_0xabce,0x103));var _0xeabc=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xabce[_0x4baae2];return _0x1a2285;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 41d288a..d53835b 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 _0x8cc5=['../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','UpdateFaxQueueReport','where','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8cc5,0x1ab));var _0x58cc=function(_0x20b9ac,_0x2b2e46){_0x20b9ac=_0x20b9ac-0x0;var _0x1772c8=_0x8cc5[_0x20b9ac];return _0x1772c8;};'use strict';var _=require('lodash');var util=require(_0x58cc('0x0'));var moment=require('moment');var BPromise=require(_0x58cc('0x1'));var rs=require(_0x58cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58cc('0x3'))['db'];var utils=require(_0x58cc('0x4'));var logger=require(_0x58cc('0x5'))(_0x58cc('0x6'));var config=require(_0x58cc('0x7'));var jayson=require(_0x58cc('0x8'));var client=jayson[_0x58cc('0x9')][_0x58cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b68c3,_0xf6510b,_0x10283c){return new BPromise(function(_0x3e8222,_0x18aec3){return client[_0x58cc('0xb')](_0x2b68c3,_0x10283c)[_0x58cc('0xc')](function(_0x5b1a9d){logger[_0x58cc('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0xf6510b,'request\x20sent');logger['debug'](_0x58cc('0xe'),_0xf6510b,'request\x20sent',JSON[_0x58cc('0xf')](_0x5b1a9d));if(_0x5b1a9d[_0x58cc('0x10')]){if(_0x5b1a9d[_0x58cc('0x10')][_0x58cc('0x11')]===0x1f4){logger[_0x58cc('0x10')](_0x58cc('0x12'),_0xf6510b,_0x5b1a9d[_0x58cc('0x10')][_0x58cc('0x13')]);return _0x18aec3(_0x5b1a9d[_0x58cc('0x10')][_0x58cc('0x13')]);}logger[_0x58cc('0x10')](_0x58cc('0x12'),_0xf6510b,_0x5b1a9d[_0x58cc('0x10')][_0x58cc('0x13')]);return _0x3e8222(_0x5b1a9d[_0x58cc('0x10')]['message']);}else{logger[_0x58cc('0xd')](_0x58cc('0x12'),_0xf6510b,'request\x20sent');_0x3e8222(_0x5b1a9d[_0x58cc('0x14')][_0x58cc('0x13')]);}})[_0x58cc('0x15')](function(_0x460a77){logger[_0x58cc('0x10')](_0x58cc('0x12'),_0xf6510b,_0x460a77);_0x18aec3(_0x460a77);});});}exports['CreateFaxQueueReport']=function(_0x355184){var _0x5e8d01=this;return new Promise(function(_0x14b313,_0x5e8415){return db[_0x58cc('0x16')][_0x58cc('0x17')](_0x355184[_0x58cc('0x18')],{'raw':_0x355184['options']?_0x355184[_0x58cc('0x19')][_0x58cc('0x1a')]===undefined?!![]:![]:!![]})[_0x58cc('0xc')](function(_0x2f779d){logger[_0x58cc('0xd')](_0x58cc('0x1b'),_0x355184);logger[_0x58cc('0x1c')](_0x58cc('0x1b'),_0x355184,JSON[_0x58cc('0xf')](_0x2f779d));_0x14b313(_0x2f779d);})[_0x58cc('0x15')](function(_0x32a664){logger['error'](_0x58cc('0x1b'),_0x32a664[_0x58cc('0x13')],_0x355184);_0x5e8415(_0x5e8d01[_0x58cc('0x10')](0x1f4,_0x32a664[_0x58cc('0x13')]));});});};exports[_0x58cc('0x1d')]=function(_0x335ccb){var _0x217e7a=this;return new Promise(function(_0x31f3ae,_0x5d8cc3){return db['FaxQueueReport']['update'](_0x335ccb[_0x58cc('0x18')],{'raw':_0x335ccb['options']?_0x335ccb['options'][_0x58cc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x335ccb['options']?_0x335ccb[_0x58cc('0x19')][_0x58cc('0x1e')]||null:null,'attributes':_0x335ccb['options']?_0x335ccb[_0x58cc('0x19')]['attributes']||null:null,'limit':_0x335ccb[_0x58cc('0x19')]?_0x335ccb[_0x58cc('0x19')]['limit']||null:null})[_0x58cc('0xc')](function(_0x192991){logger[_0x58cc('0xd')]('UpdateFaxQueueReport',_0x335ccb);logger[_0x58cc('0x1c')](_0x58cc('0x1d'),_0x335ccb,JSON[_0x58cc('0xf')](_0x192991));_0x31f3ae(_0x192991);})[_0x58cc('0x15')](function(_0x2596a2){logger[_0x58cc('0x10')](_0x58cc('0x1d'),_0x2596a2['message'],_0x335ccb);_0x5d8cc3(_0x217e7a[_0x58cc('0x10')](0x1f4,_0x2596a2[_0x58cc('0x13')]));});});}; \ No newline at end of file +var _0x2671=['update','attributes','limit','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x2671,0x1d5));var _0x1267=function(_0x4bf3a7,_0x5d756b){_0x4bf3a7=_0x4bf3a7-0x0;var _0x58c9cc=_0x2671[_0x4bf3a7];return _0x58c9cc;};'use strict';var _=require(_0x1267('0x0'));var util=require(_0x1267('0x1'));var moment=require(_0x1267('0x2'));var BPromise=require(_0x1267('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1267('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1267('0x5'));var logger=require(_0x1267('0x6'))(_0x1267('0x7'));var config=require(_0x1267('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1267('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x291d07,_0x4510a4,_0x16679a){return new BPromise(function(_0x5eb632,_0x693b41){return client[_0x1267('0xa')](_0x291d07,_0x16679a)['then'](function(_0x9743e7){logger[_0x1267('0xb')](_0x1267('0xc'),_0x4510a4,_0x1267('0xd'));logger[_0x1267('0xe')](_0x1267('0xf'),_0x4510a4,_0x1267('0xd'),JSON['stringify'](_0x9743e7));if(_0x9743e7['error']){if(_0x9743e7[_0x1267('0x10')]['code']===0x1f4){logger['error'](_0x1267('0xc'),_0x4510a4,_0x9743e7[_0x1267('0x10')][_0x1267('0x11')]);return _0x693b41(_0x9743e7['error'][_0x1267('0x11')]);}logger[_0x1267('0x10')](_0x1267('0xc'),_0x4510a4,_0x9743e7['error'][_0x1267('0x11')]);return _0x5eb632(_0x9743e7[_0x1267('0x10')]['message']);}else{logger[_0x1267('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4510a4,_0x1267('0xd'));_0x5eb632(_0x9743e7['result']['message']);}})[_0x1267('0x12')](function(_0x444d18){logger['error'](_0x1267('0xc'),_0x4510a4,_0x444d18);_0x693b41(_0x444d18);});});}exports[_0x1267('0x13')]=function(_0x41df46){var _0x53c818=this;return new Promise(function(_0x1ff2f8,_0x551204){return db[_0x1267('0x14')][_0x1267('0x15')](_0x41df46[_0x1267('0x16')],{'raw':_0x41df46['options']?_0x41df46[_0x1267('0x17')][_0x1267('0x18')]===undefined?!![]:![]:!![]})[_0x1267('0x19')](function(_0x19e604){logger['info'](_0x1267('0x13'),_0x41df46);logger[_0x1267('0xe')]('CreateFaxQueueReport',_0x41df46,JSON['stringify'](_0x19e604));_0x1ff2f8(_0x19e604);})[_0x1267('0x12')](function(_0x1a120b){logger[_0x1267('0x10')]('CreateFaxQueueReport',_0x1a120b[_0x1267('0x11')],_0x41df46);_0x551204(_0x53c818[_0x1267('0x10')](0x1f4,_0x1a120b['message']));});});};exports[_0x1267('0x1a')]=function(_0x3fed04){var _0x150d6b=this;return new Promise(function(_0x5912fb,_0x4eac5d){return db[_0x1267('0x14')][_0x1267('0x1b')](_0x3fed04[_0x1267('0x16')],{'raw':_0x3fed04[_0x1267('0x17')]?_0x3fed04['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fed04['options']?_0x3fed04['options']['where']||null:null,'attributes':_0x3fed04[_0x1267('0x17')]?_0x3fed04[_0x1267('0x17')][_0x1267('0x1c')]||null:null,'limit':_0x3fed04[_0x1267('0x17')]?_0x3fed04[_0x1267('0x17')][_0x1267('0x1d')]||null:null})[_0x1267('0x19')](function(_0x4dbc4d){logger[_0x1267('0xb')](_0x1267('0x1a'),_0x3fed04);logger[_0x1267('0xe')](_0x1267('0x1a'),_0x3fed04,JSON[_0x1267('0x1e')](_0x4dbc4d));_0x5912fb(_0x4dbc4d);})[_0x1267('0x12')](function(_0x398cc8){logger[_0x1267('0x10')](_0x1267('0x1a'),_0x398cc8[_0x1267('0x11')],_0x3fed04);_0x4eac5d(_0x150d6b[_0x1267('0x10')](0x1f4,_0x398cc8[_0x1267('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index df3c0e6..91b203b 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 _0x63e0=['update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','describe','post','create','put'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x63e0,0x1df));var _0x063e=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x63e0[_0x3e2fcf];return _0x497db7;};'use strict';var multer=require(_0x063e('0x0'));var util=require(_0x063e('0x1'));var path=require(_0x063e('0x2'));var timeout=require(_0x063e('0x3'));var express=require('express');var router=express[_0x063e('0x4')]();var fs_extra=require(_0x063e('0x5'));var auth=require(_0x063e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x063e('0x7'));var controller=require(_0x063e('0x8'));router[_0x063e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x063e('0x9')]('/describe',auth[_0x063e('0xa')](),controller[_0x063e('0xb')]);router[_0x063e('0x9')]('/:id',auth[_0x063e('0xa')](),controller['show']);router[_0x063e('0xc')]('/',auth['isAuthenticated'](),controller[_0x063e('0xd')]);router[_0x063e('0xe')]('/:id',auth[_0x063e('0xa')](),controller[_0x063e('0xf')]);router[_0x063e('0x10')](_0x063e('0x11'),auth[_0x063e('0xa')](),controller[_0x063e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7f1e=['isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get'];(function(_0x22aeb7,_0x31bafc){var _0x5a4da6=function(_0x4406f2){while(--_0x4406f2){_0x22aeb7['push'](_0x22aeb7['shift']());}};_0x5a4da6(++_0x31bafc);}(_0x7f1e,0x19c));var _0xe7f1=function(_0x410be9,_0x559186){_0x410be9=_0x410be9-0x0;var _0x3ec84b=_0x7f1e[_0x410be9];return _0x3ec84b;};'use strict';var multer=require(_0xe7f1('0x0'));var util=require(_0xe7f1('0x1'));var path=require('path');var timeout=require(_0xe7f1('0x2'));var express=require(_0xe7f1('0x3'));var router=express[_0xe7f1('0x4')]();var fs_extra=require(_0xe7f1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe7f1('0x6'));var controller=require('./faxQueueReport.controller');router[_0xe7f1('0x7')]('/',auth[_0xe7f1('0x8')](),controller[_0xe7f1('0x9')]);router[_0xe7f1('0x7')](_0xe7f1('0xa'),auth[_0xe7f1('0x8')](),controller[_0xe7f1('0xb')]);router[_0xe7f1('0x7')]('/:id',auth[_0xe7f1('0x8')](),controller[_0xe7f1('0xc')]);router[_0xe7f1('0xd')]('/',auth[_0xe7f1('0x8')](),controller[_0xe7f1('0xe')]);router[_0xe7f1('0xf')](_0xe7f1('0x10'),auth['isAuthenticated'](),controller[_0xe7f1('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe7f1('0x12')]);module[_0xe7f1('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 1b2612b..b657563 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xe25c95,_0x1c7a4f){var _0xe566a7=function(_0x425da3){while(--_0x425da3){_0xe25c95['push'](_0xe25c95['shift']());}};_0xe566a7(++_0x1c7a4f);}(_0xaa88,0x137));var _0x8aa8=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0xaa88[_0x4e11d5];return _0x5e4e4c;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x36ef8c,_0x285e19){var _0x2a27d1=function(_0x4a1a89){while(--_0x4a1a89){_0x36ef8c['push'](_0x36ef8c['shift']());}};_0x2a27d1(++_0x285e19);}(_0x70e0,0x17b));var _0x070e=function(_0x8335b,_0x1ddd58){_0x8335b=_0x8335b-0x0;var _0x611a64=_0x70e0[_0x8335b];return _0x611a64;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fca75c6..871fe9d 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 _0x8575=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','FaxTransferReport','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','describe','eml-format','rimraf'];(function(_0x52740f,_0x343961){var _0x1cbe11=function(_0x376976){while(--_0x376976){_0x52740f['push'](_0x52740f['shift']());}};_0x1cbe11(++_0x343961);}(_0x8575,0x9c));var _0x5857=function(_0x24f001,_0x5728ac){_0x24f001=_0x24f001-0x0;var _0x2b67b8=_0x8575[_0x24f001];return _0x2b67b8;};'use strict';var emlformat=require(_0x5857('0x0'));var rimraf=require(_0x5857('0x1'));var zipdir=require(_0x5857('0x2'));var jsonpatch=require(_0x5857('0x3'));var rp=require(_0x5857('0x4'));var moment=require(_0x5857('0x5'));var BPromise=require(_0x5857('0x6'));var Mustache=require(_0x5857('0x7'));var util=require(_0x5857('0x8'));var path=require('path');var sox=require(_0x5857('0x9'));var csv=require('to-csv');var ejs=require(_0x5857('0xa'));var fs=require('fs');var fs_extra=require(_0x5857('0xb'));var _=require(_0x5857('0xc'));var squel=require(_0x5857('0xd'));var crypto=require(_0x5857('0xe'));var jsforce=require(_0x5857('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5857('0x10'));var querystring=require(_0x5857('0x11'));var Papa=require(_0x5857('0x12'));var Redis=require(_0x5857('0x13'));var authService=require(_0x5857('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5857('0x15'));var hardwareService=require(_0x5857('0x16'));var logger=require(_0x5857('0x17'))(_0x5857('0x18'));var utils=require(_0x5857('0x19'));var config=require(_0x5857('0x1a'));var licenseUtil=require(_0x5857('0x1b'));var db=require(_0x5857('0x1c'))['db'];function respondWithStatusCode(_0xb0d532,_0x513545){_0x513545=_0x513545||0xcc;return function(_0x5d93b2){if(_0x5d93b2){return _0xb0d532[_0x5857('0x1d')](_0x513545);}return _0xb0d532[_0x5857('0x1e')](_0x513545)['end']();};}function respondWithResult(_0x387c32,_0x241658){_0x241658=_0x241658||0xc8;return function(_0x35a016){if(_0x35a016){return _0x387c32[_0x5857('0x1e')](_0x241658)[_0x5857('0x1f')](_0x35a016);}};}function respondWithFilteredResult(_0x45c7a1,_0x425a97){return function(_0x17ef0c){if(_0x17ef0c){var _0x302be5=typeof _0x425a97[_0x5857('0x20')]==='undefined'&&typeof _0x425a97[_0x5857('0x21')]==='undefined';var _0x5420c8=_0x17ef0c[_0x5857('0x22')];var _0x1d2363=_0x302be5?0x0:_0x425a97[_0x5857('0x20')];var _0x141f5b=_0x302be5?_0x17ef0c[_0x5857('0x22')]:_0x425a97[_0x5857('0x20')]+_0x425a97[_0x5857('0x21')];var _0x57d961;if(_0x141f5b>=_0x5420c8){_0x141f5b=_0x5420c8;_0x57d961=0xc8;}else{_0x57d961=0xce;}_0x45c7a1[_0x5857('0x1e')](_0x57d961);return _0x45c7a1[_0x5857('0x23')]('Content-Range',_0x1d2363+'-'+_0x141f5b+'/'+_0x5420c8)['json'](_0x17ef0c);}return null;};}function patchUpdates(_0x18bab2){return function(_0x463e6c){try{jsonpatch['apply'](_0x463e6c,_0x18bab2,!![]);}catch(_0x352b74){return BPromise[_0x5857('0x24')](_0x352b74);}return _0x463e6c[_0x5857('0x25')]();};}function saveUpdates(_0x337620,_0x1df13a){return function(_0x519508){if(_0x519508){return _0x519508['update'](_0x337620)[_0x5857('0x26')](function(_0x4dd017){return _0x4dd017;});}return null;};}function removeEntity(_0x3c5ce1,_0x7aaa48){return function(_0x766ecc){if(_0x766ecc){return _0x766ecc[_0x5857('0x27')]()[_0x5857('0x26')](function(){_0x3c5ce1['status'](0xcc)[_0x5857('0x28')]();});}};}function handleEntityNotFound(_0x5a1665,_0x5cbeef){return function(_0x2ae50f){if(!_0x2ae50f){_0x5a1665[_0x5857('0x1d')](0x194);}return _0x2ae50f;};}function handleError(_0x5d4bb2,_0x5212a2){_0x5212a2=_0x5212a2||0x1f4;return function(_0x155ca0){logger[_0x5857('0x29')](_0x155ca0[_0x5857('0x2a')]);if(_0x155ca0[_0x5857('0x2b')]){delete _0x155ca0[_0x5857('0x2b')];}_0x5d4bb2['status'](_0x5212a2)[_0x5857('0x2c')](_0x155ca0);};}exports['index']=function(_0x16847a,_0x157384){var _0x40891f={},_0x4f93c4={},_0x39eeeb={'count':0x0,'rows':[]};var _0xf4a711=_[_0x5857('0x2d')](db['FaxTransferReport'][_0x5857('0x2e')],function(_0x3250af){return{'name':_0x3250af[_0x5857('0x2f')],'type':_0x3250af[_0x5857('0x30')][_0x5857('0x31')]};});_0x4f93c4[_0x5857('0x32')]=_[_0x5857('0x2d')](_0xf4a711,_0x5857('0x2b'));_0x4f93c4[_0x5857('0x33')]=_['keys'](_0x16847a[_0x5857('0x33')]);_0x4f93c4[_0x5857('0x34')]=_[_0x5857('0x35')](_0x4f93c4[_0x5857('0x32')],_0x4f93c4[_0x5857('0x33')]);_0x40891f[_0x5857('0x36')]=_[_0x5857('0x35')](_0x4f93c4['model'],qs['fields'](_0x16847a[_0x5857('0x33')][_0x5857('0x37')]));_0x40891f['attributes']=_0x40891f[_0x5857('0x36')][_0x5857('0x38')]?_0x40891f[_0x5857('0x36')]:_0x4f93c4[_0x5857('0x32')];if(!_0x16847a[_0x5857('0x33')][_0x5857('0x39')](_0x5857('0x3a'))){_0x40891f[_0x5857('0x21')]=qs[_0x5857('0x21')](_0x16847a[_0x5857('0x33')][_0x5857('0x21')]);_0x40891f['offset']=qs[_0x5857('0x20')](_0x16847a[_0x5857('0x33')][_0x5857('0x20')]);}_0x40891f[_0x5857('0x3b')]=qs['sort'](_0x16847a[_0x5857('0x33')]['sort']);_0x40891f['where']=qs[_0x5857('0x34')](_[_0x5857('0x3c')](_0x16847a[_0x5857('0x33')],_0x4f93c4[_0x5857('0x34')]),_0xf4a711);if(_0x16847a['query']['filter']){_0x40891f[_0x5857('0x3d')]=_[_0x5857('0x3e')](_0x40891f[_0x5857('0x3d')],{'$or':_[_0x5857('0x2d')](_0xf4a711,function(_0x4c6ee0){if(_0x4c6ee0[_0x5857('0x30')]!==_0x5857('0x3f')){var _0x2cbd48={};_0x2cbd48[_0x4c6ee0[_0x5857('0x2b')]]={'$like':'%'+_0x16847a[_0x5857('0x33')][_0x5857('0x40')]+'%'};return _0x2cbd48;}})});}_0x40891f=_[_0x5857('0x3e')]({},_0x40891f,_0x16847a[_0x5857('0x41')]);var _0x1e8bc1={'where':_0x40891f[_0x5857('0x3d')]};return db[_0x5857('0x42')]['count'](_0x1e8bc1)[_0x5857('0x26')](function(_0x29e5f0){_0x39eeeb['count']=_0x29e5f0;if(_0x16847a[_0x5857('0x33')][_0x5857('0x43')]){_0x40891f[_0x5857('0x44')]=[{'all':!![]}];}return db[_0x5857('0x42')][_0x5857('0x45')](_0x40891f);})['then'](function(_0x16cf35){_0x39eeeb[_0x5857('0x46')]=_0x16cf35;return _0x39eeeb;})[_0x5857('0x26')](respondWithFilteredResult(_0x157384,_0x40891f))[_0x5857('0x47')](handleError(_0x157384,null));};exports['show']=function(_0x4fa1ec,_0x3e0378){var _0xdca3e3={'raw':!![],'where':{'id':_0x4fa1ec[_0x5857('0x48')]['id']}},_0x4997d4={};_0x4997d4[_0x5857('0x32')]=_[_0x5857('0x49')](db[_0x5857('0x42')][_0x5857('0x2e')]);_0x4997d4['query']=_[_0x5857('0x49')](_0x4fa1ec[_0x5857('0x33')]);_0x4997d4[_0x5857('0x34')]=_[_0x5857('0x35')](_0x4997d4[_0x5857('0x32')],_0x4997d4['query']);_0xdca3e3[_0x5857('0x36')]=_[_0x5857('0x35')](_0x4997d4[_0x5857('0x32')],qs['fields'](_0x4fa1ec[_0x5857('0x33')]['fields']));_0xdca3e3[_0x5857('0x36')]=_0xdca3e3['attributes'][_0x5857('0x38')]?_0xdca3e3['attributes']:_0x4997d4['model'];if(_0x4fa1ec[_0x5857('0x33')][_0x5857('0x43')]){_0xdca3e3[_0x5857('0x44')]=[{'all':!![]}];}_0xdca3e3=_[_0x5857('0x3e')]({},_0xdca3e3,_0x4fa1ec[_0x5857('0x41')]);return db[_0x5857('0x42')][_0x5857('0x4a')](_0xdca3e3)[_0x5857('0x26')](handleEntityNotFound(_0x3e0378,null))[_0x5857('0x26')](respondWithResult(_0x3e0378,null))[_0x5857('0x47')](handleError(_0x3e0378,null));};exports[_0x5857('0x4b')]=function(_0xb19cb3,_0x1e84e9){return db[_0x5857('0x42')]['create'](_0xb19cb3['body'],{})[_0x5857('0x26')](respondWithResult(_0x1e84e9,0xc9))[_0x5857('0x47')](handleError(_0x1e84e9,null));};exports[_0x5857('0x4c')]=function(_0x34cf48,_0x45cd5c){if(_0x34cf48['body']['id']){delete _0x34cf48[_0x5857('0x4d')]['id'];}return db[_0x5857('0x42')][_0x5857('0x4a')]({'where':{'id':_0x34cf48[_0x5857('0x48')]['id']}})[_0x5857('0x26')](handleEntityNotFound(_0x45cd5c,null))[_0x5857('0x26')](saveUpdates(_0x34cf48[_0x5857('0x4d')],null))[_0x5857('0x26')](respondWithResult(_0x45cd5c,null))[_0x5857('0x47')](handleError(_0x45cd5c,null));};exports[_0x5857('0x27')]=function(_0x7070c1,_0x51e2a1){return db['FaxTransferReport']['find']({'where':{'id':_0x7070c1[_0x5857('0x48')]['id']}})[_0x5857('0x26')](handleEntityNotFound(_0x51e2a1,null))[_0x5857('0x26')](removeEntity(_0x51e2a1,null))[_0x5857('0x47')](handleError(_0x51e2a1,null));};exports[_0x5857('0x4e')]=function(_0x48b679,_0x4f750b){return db[_0x5857('0x42')][_0x5857('0x4e')]()[_0x5857('0x26')](respondWithResult(_0x4f750b,null))[_0x5857('0x47')](handleError(_0x4f750b,null));}; \ No newline at end of file +var _0xc8d9=['apply','save','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','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(_0x22d68a,_0x3f6978){var _0x131c53=function(_0x1781dc){while(--_0x1781dc){_0x22d68a['push'](_0x22d68a['shift']());}};_0x131c53(++_0x3f6978);}(_0xc8d9,0x141));var _0x9c8d=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0xc8d9[_0x4991d6];return _0x50faf7;};'use strict';var emlformat=require(_0x9c8d('0x0'));var rimraf=require(_0x9c8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c8d('0x2'));var rp=require('request-promise');var moment=require(_0x9c8d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9c8d('0x4'));var util=require('util');var path=require(_0x9c8d('0x5'));var sox=require('sox');var csv=require(_0x9c8d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c8d('0x7'));var _=require(_0x9c8d('0x8'));var squel=require(_0x9c8d('0x9'));var crypto=require(_0x9c8d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9c8d('0x6'));var querystring=require(_0x9c8d('0xb'));var Papa=require('papaparse');var Redis=require(_0x9c8d('0xc'));var authService=require(_0x9c8d('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c8d('0xe'));var logger=require('../../config/logger')(_0x9c8d('0xf'));var utils=require(_0x9c8d('0x10'));var config=require(_0x9c8d('0x11'));var licenseUtil=require(_0x9c8d('0x12'));var db=require(_0x9c8d('0x13'))['db'];function respondWithStatusCode(_0x43e433,_0x1af283){_0x1af283=_0x1af283||0xcc;return function(_0xe17c56){if(_0xe17c56){return _0x43e433[_0x9c8d('0x14')](_0x1af283);}return _0x43e433[_0x9c8d('0x15')](_0x1af283)[_0x9c8d('0x16')]();};}function respondWithResult(_0x1db482,_0x42e737){_0x42e737=_0x42e737||0xc8;return function(_0x2603e2){if(_0x2603e2){return _0x1db482[_0x9c8d('0x15')](_0x42e737)[_0x9c8d('0x17')](_0x2603e2);}};}function respondWithFilteredResult(_0x47b7b2,_0x7db300){return function(_0x30a9a0){if(_0x30a9a0){var _0xce2931=typeof _0x7db300[_0x9c8d('0x18')]===_0x9c8d('0x19')&&typeof _0x7db300[_0x9c8d('0x1a')]===_0x9c8d('0x19');var _0xba5bb6=_0x30a9a0[_0x9c8d('0x1b')];var _0x3dc8e1=_0xce2931?0x0:_0x7db300['offset'];var _0x3bab76=_0xce2931?_0x30a9a0['count']:_0x7db300['offset']+_0x7db300[_0x9c8d('0x1a')];var _0x2d1a59;if(_0x3bab76>=_0xba5bb6){_0x3bab76=_0xba5bb6;_0x2d1a59=0xc8;}else{_0x2d1a59=0xce;}_0x47b7b2[_0x9c8d('0x15')](_0x2d1a59);return _0x47b7b2['set'](_0x9c8d('0x1c'),_0x3dc8e1+'-'+_0x3bab76+'/'+_0xba5bb6)[_0x9c8d('0x17')](_0x30a9a0);}return null;};}function patchUpdates(_0x127567){return function(_0x76bd6d){try{jsonpatch[_0x9c8d('0x1d')](_0x76bd6d,_0x127567,!![]);}catch(_0x8744b4){return BPromise['reject'](_0x8744b4);}return _0x76bd6d[_0x9c8d('0x1e')]();};}function saveUpdates(_0x1d099c,_0x43783c){return function(_0x5c1be2){if(_0x5c1be2){return _0x5c1be2['update'](_0x1d099c)[_0x9c8d('0x1f')](function(_0x215e1f){return _0x215e1f;});}return null;};}function removeEntity(_0x2c4459,_0x3a7d33){return function(_0x28fb86){if(_0x28fb86){return _0x28fb86[_0x9c8d('0x20')]()['then'](function(){_0x2c4459['status'](0xcc)[_0x9c8d('0x16')]();});}};}function handleEntityNotFound(_0x449a74,_0x2ef0a2){return function(_0x52a840){if(!_0x52a840){_0x449a74['sendStatus'](0x194);}return _0x52a840;};}function handleError(_0x1fb0ec,_0xc6d681){_0xc6d681=_0xc6d681||0x1f4;return function(_0x153d07){logger[_0x9c8d('0x21')](_0x153d07[_0x9c8d('0x22')]);if(_0x153d07[_0x9c8d('0x23')]){delete _0x153d07[_0x9c8d('0x23')];}_0x1fb0ec[_0x9c8d('0x15')](_0xc6d681)[_0x9c8d('0x24')](_0x153d07);};}exports[_0x9c8d('0x25')]=function(_0x3872ea,_0x42b1c4){var _0x567d96={},_0x405164={},_0x194b0d={'count':0x0,'rows':[]};var _0x37a317=_[_0x9c8d('0x26')](db[_0x9c8d('0x27')][_0x9c8d('0x28')],function(_0x27b446){return{'name':_0x27b446[_0x9c8d('0x29')],'type':_0x27b446[_0x9c8d('0x2a')]['key']};});_0x405164[_0x9c8d('0x2b')]=_[_0x9c8d('0x26')](_0x37a317,'name');_0x405164[_0x9c8d('0x2c')]=_[_0x9c8d('0x2d')](_0x3872ea[_0x9c8d('0x2c')]);_0x405164['filters']=_['intersection'](_0x405164['model'],_0x405164[_0x9c8d('0x2c')]);_0x567d96[_0x9c8d('0x2e')]=_[_0x9c8d('0x2f')](_0x405164[_0x9c8d('0x2b')],qs[_0x9c8d('0x30')](_0x3872ea[_0x9c8d('0x2c')][_0x9c8d('0x30')]));_0x567d96[_0x9c8d('0x2e')]=_0x567d96[_0x9c8d('0x2e')][_0x9c8d('0x31')]?_0x567d96[_0x9c8d('0x2e')]:_0x405164[_0x9c8d('0x2b')];if(!_0x3872ea[_0x9c8d('0x2c')]['hasOwnProperty'](_0x9c8d('0x32'))){_0x567d96[_0x9c8d('0x1a')]=qs[_0x9c8d('0x1a')](_0x3872ea[_0x9c8d('0x2c')]['limit']);_0x567d96[_0x9c8d('0x18')]=qs[_0x9c8d('0x18')](_0x3872ea['query'][_0x9c8d('0x18')]);}_0x567d96[_0x9c8d('0x33')]=qs[_0x9c8d('0x34')](_0x3872ea['query'][_0x9c8d('0x34')]);_0x567d96['where']=qs[_0x9c8d('0x35')](_['pick'](_0x3872ea[_0x9c8d('0x2c')],_0x405164[_0x9c8d('0x35')]),_0x37a317);if(_0x3872ea[_0x9c8d('0x2c')][_0x9c8d('0x36')]){_0x567d96[_0x9c8d('0x37')]=_[_0x9c8d('0x38')](_0x567d96[_0x9c8d('0x37')],{'$or':_[_0x9c8d('0x26')](_0x37a317,function(_0xf7e4fc){if(_0xf7e4fc['type']!==_0x9c8d('0x39')){var _0x609616={};_0x609616[_0xf7e4fc[_0x9c8d('0x23')]]={'$like':'%'+_0x3872ea[_0x9c8d('0x2c')][_0x9c8d('0x36')]+'%'};return _0x609616;}})});}_0x567d96=_[_0x9c8d('0x38')]({},_0x567d96,_0x3872ea[_0x9c8d('0x3a')]);var _0x1c1e2f={'where':_0x567d96[_0x9c8d('0x37')]};return db[_0x9c8d('0x27')][_0x9c8d('0x1b')](_0x1c1e2f)['then'](function(_0x21e8ad){_0x194b0d['count']=_0x21e8ad;if(_0x3872ea[_0x9c8d('0x2c')][_0x9c8d('0x3b')]){_0x567d96[_0x9c8d('0x3c')]=[{'all':!![]}];}return db[_0x9c8d('0x27')]['findAll'](_0x567d96);})[_0x9c8d('0x1f')](function(_0x5ca8dd){_0x194b0d[_0x9c8d('0x3d')]=_0x5ca8dd;return _0x194b0d;})['then'](respondWithFilteredResult(_0x42b1c4,_0x567d96))[_0x9c8d('0x3e')](handleError(_0x42b1c4,null));};exports[_0x9c8d('0x3f')]=function(_0xd0fcba,_0x39e741){var _0x25082d={'raw':!![],'where':{'id':_0xd0fcba[_0x9c8d('0x40')]['id']}},_0x34f85f={};_0x34f85f[_0x9c8d('0x2b')]=_[_0x9c8d('0x2d')](db[_0x9c8d('0x27')][_0x9c8d('0x28')]);_0x34f85f[_0x9c8d('0x2c')]=_[_0x9c8d('0x2d')](_0xd0fcba[_0x9c8d('0x2c')]);_0x34f85f[_0x9c8d('0x35')]=_[_0x9c8d('0x2f')](_0x34f85f[_0x9c8d('0x2b')],_0x34f85f['query']);_0x25082d[_0x9c8d('0x2e')]=_[_0x9c8d('0x2f')](_0x34f85f[_0x9c8d('0x2b')],qs[_0x9c8d('0x30')](_0xd0fcba[_0x9c8d('0x2c')]['fields']));_0x25082d['attributes']=_0x25082d[_0x9c8d('0x2e')][_0x9c8d('0x31')]?_0x25082d[_0x9c8d('0x2e')]:_0x34f85f[_0x9c8d('0x2b')];if(_0xd0fcba[_0x9c8d('0x2c')][_0x9c8d('0x3b')]){_0x25082d[_0x9c8d('0x3c')]=[{'all':!![]}];}_0x25082d=_[_0x9c8d('0x38')]({},_0x25082d,_0xd0fcba[_0x9c8d('0x3a')]);return db[_0x9c8d('0x27')][_0x9c8d('0x41')](_0x25082d)[_0x9c8d('0x1f')](handleEntityNotFound(_0x39e741,null))['then'](respondWithResult(_0x39e741,null))['catch'](handleError(_0x39e741,null));};exports['create']=function(_0x4b4bac,_0x8c0969){return db['FaxTransferReport'][_0x9c8d('0x42')](_0x4b4bac[_0x9c8d('0x43')],{})[_0x9c8d('0x1f')](respondWithResult(_0x8c0969,0xc9))['catch'](handleError(_0x8c0969,null));};exports[_0x9c8d('0x44')]=function(_0x4df202,_0x1fc39f){if(_0x4df202[_0x9c8d('0x43')]['id']){delete _0x4df202[_0x9c8d('0x43')]['id'];}return db[_0x9c8d('0x27')][_0x9c8d('0x41')]({'where':{'id':_0x4df202[_0x9c8d('0x40')]['id']}})[_0x9c8d('0x1f')](handleEntityNotFound(_0x1fc39f,null))['then'](saveUpdates(_0x4df202[_0x9c8d('0x43')],null))[_0x9c8d('0x1f')](respondWithResult(_0x1fc39f,null))[_0x9c8d('0x3e')](handleError(_0x1fc39f,null));};exports[_0x9c8d('0x20')]=function(_0x4ad7e6,_0x3a968d){return db['FaxTransferReport'][_0x9c8d('0x41')]({'where':{'id':_0x4ad7e6['params']['id']}})[_0x9c8d('0x1f')](handleEntityNotFound(_0x3a968d,null))[_0x9c8d('0x1f')](removeEntity(_0x3a968d,null))[_0x9c8d('0x3e')](handleError(_0x3a968d,null));};exports[_0x9c8d('0x45')]=function(_0x5c526c,_0x5927d8){return db[_0x9c8d('0x27')]['describe']()['then'](respondWithResult(_0x5927d8,null))[_0x9c8d('0x3e')](handleError(_0x5927d8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 05e6536..7654371 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 _0x116c=['./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x43ddd6,_0x5125ed){var _0x15976f=function(_0x1e1b63){while(--_0x1e1b63){_0x43ddd6['push'](_0x43ddd6['shift']());}};_0x15976f(++_0x5125ed);}(_0x116c,0xca));var _0xc116=function(_0x54ec00,_0xed3b66){_0x54ec00=_0x54ec00-0x0;var _0x32517e=_0x116c[_0x54ec00];return _0x32517e;};'use strict';var _=require(_0xc116('0x0'));var util=require(_0xc116('0x1'));var logger=require(_0xc116('0x2'))(_0xc116('0x3'));var moment=require(_0xc116('0x4'));var BPromise=require('bluebird');var rp=require(_0xc116('0x5'));var fs=require('fs');var path=require(_0xc116('0x6'));var rimraf=require('rimraf');var config=require(_0xc116('0x7'));var attributes=require(_0xc116('0x8'));module[_0xc116('0x9')]=function(_0x6ad633,_0x5950a1){return _0x6ad633[_0xc116('0xa')](_0xc116('0xb'),attributes,{'tableName':_0xc116('0xc'),'paranoid':![],'indexes':[{'name':_0xc116('0xd'),'fields':[_0xc116('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7497=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4f2be2,_0x2aa7da){var _0x32e56f=function(_0x2a48ac){while(--_0x2a48ac){_0x4f2be2['push'](_0x4f2be2['shift']());}};_0x32e56f(++_0x2aa7da);}(_0x7497,0x13c));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))(_0x7749('0x3'));var moment=require(_0x7749('0x4'));var BPromise=require(_0x7749('0x5'));var rp=require(_0x7749('0x6'));var fs=require('fs');var path=require(_0x7749('0x7'));var rimraf=require(_0x7749('0x8'));var config=require(_0x7749('0x9'));var attributes=require(_0x7749('0xa'));module[_0x7749('0xb')]=function(_0x35c27b,_0x341c81){return _0x35c27b[_0x7749('0xc')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x7749('0xd'),'fields':[_0x7749('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 f9a34a7..8982ca6 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 _0x6c33=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x5b697a,_0x280202){var _0x5de43b=function(_0x2bc32f){while(--_0x2bc32f){_0x5b697a['push'](_0x5b697a['shift']());}};_0x5de43b(++_0x280202);}(_0x6c33,0x120));var _0x36c3=function(_0x118c30,_0x7eb1eb){_0x118c30=_0x118c30-0x0;var _0x569999=_0x6c33[_0x118c30];return _0x569999;};'use strict';var _=require(_0x36c3('0x0'));var util=require(_0x36c3('0x1'));var moment=require('moment');var BPromise=require(_0x36c3('0x2'));var rs=require(_0x36c3('0x3'));var fs=require('fs');var Redis=require(_0x36c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x36c3('0x5'));var logger=require(_0x36c3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x36c3('0x7')][_0x36c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3941ef,_0x2e5302,_0x3e5f38){return new BPromise(function(_0x316e3c,_0x4e8ef5){return client['request'](_0x3941ef,_0x3e5f38)['then'](function(_0x344ad4){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2e5302,_0x36c3('0x9'));logger['debug'](_0x36c3('0xa'),_0x2e5302,_0x36c3('0x9'),JSON['stringify'](_0x344ad4));if(_0x344ad4[_0x36c3('0xb')]){if(_0x344ad4[_0x36c3('0xb')][_0x36c3('0xc')]===0x1f4){logger[_0x36c3('0xb')](_0x36c3('0xd'),_0x2e5302,_0x344ad4[_0x36c3('0xb')]['message']);return _0x4e8ef5(_0x344ad4[_0x36c3('0xb')]['message']);}logger[_0x36c3('0xb')](_0x36c3('0xd'),_0x2e5302,_0x344ad4['error'][_0x36c3('0xe')]);return _0x316e3c(_0x344ad4[_0x36c3('0xb')]['message']);}else{logger[_0x36c3('0xf')](_0x36c3('0xd'),_0x2e5302,_0x36c3('0x9'));_0x316e3c(_0x344ad4[_0x36c3('0x10')][_0x36c3('0xe')]);}})['catch'](function(_0x135cd9){logger[_0x36c3('0xb')](_0x36c3('0xd'),_0x2e5302,_0x135cd9);_0x4e8ef5(_0x135cd9);});});} \ No newline at end of file +var _0xf8fa=['request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x56eca2,_0x52fc38){var _0x53330c=function(_0x41650c){while(--_0x41650c){_0x56eca2['push'](_0x56eca2['shift']());}};_0x53330c(++_0x52fc38);}(_0xf8fa,0x79));var _0xaf8f=function(_0x56d3a2,_0x5f191b){_0x56d3a2=_0x56d3a2-0x0;var _0x2c14d0=_0xf8fa[_0x56d3a2];return _0x2c14d0;};'use strict';var _=require('lodash');var util=require(_0xaf8f('0x0'));var moment=require(_0xaf8f('0x1'));var BPromise=require('bluebird');var rs=require(_0xaf8f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf8f('0x3'))['db'];var utils=require(_0xaf8f('0x4'));var logger=require(_0xaf8f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf8f('0x6')][_0xaf8f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x589bff,_0x14c340,_0x4b18ef){return new BPromise(function(_0x569126,_0x6e28d){return client[_0xaf8f('0x8')](_0x589bff,_0x4b18ef)[_0xaf8f('0x9')](function(_0x32cfae){logger[_0xaf8f('0xa')](_0xaf8f('0xb'),_0x14c340,_0xaf8f('0xc'));logger[_0xaf8f('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x14c340,_0xaf8f('0xc'),JSON[_0xaf8f('0xe')](_0x32cfae));if(_0x32cfae[_0xaf8f('0xf')]){if(_0x32cfae[_0xaf8f('0xf')]['code']===0x1f4){logger['error'](_0xaf8f('0xb'),_0x14c340,_0x32cfae[_0xaf8f('0xf')][_0xaf8f('0x10')]);return _0x6e28d(_0x32cfae[_0xaf8f('0xf')][_0xaf8f('0x10')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x14c340,_0x32cfae['error'][_0xaf8f('0x10')]);return _0x569126(_0x32cfae[_0xaf8f('0xf')][_0xaf8f('0x10')]);}else{logger[_0xaf8f('0xa')](_0xaf8f('0xb'),_0x14c340,_0xaf8f('0xc'));_0x569126(_0x32cfae[_0xaf8f('0x11')][_0xaf8f('0x10')]);}})[_0xaf8f('0x12')](function(_0x133423){logger[_0xaf8f('0xf')](_0xaf8f('0xb'),_0x14c340,_0x133423);_0x6e28d(_0x133423);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0527f0d..2ccf9f8 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 _0x9e2d=['isAuthenticated','index','/:id','show','post','create','put','delete','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x40b22c,_0x448a14){var _0x3384ed=function(_0x117a98){while(--_0x117a98){_0x40b22c['push'](_0x40b22c['shift']());}};_0x3384ed(++_0x448a14);}(_0x9e2d,0x17e));var _0xd9e2=function(_0x24c1fd,_0x347d2e){_0x24c1fd=_0x24c1fd-0x0;var _0x40cd59=_0x9e2d[_0x24c1fd];return _0x40cd59;};'use strict';var multer=require('multer');var util=require(_0xd9e2('0x0'));var path=require('path');var timeout=require(_0xd9e2('0x1'));var express=require(_0xd9e2('0x2'));var router=express['Router']();var fs_extra=require(_0xd9e2('0x3'));var auth=require(_0xd9e2('0x4'));var interaction=require(_0xd9e2('0x5'));var config=require(_0xd9e2('0x6'));var controller=require(_0xd9e2('0x7'));router[_0xd9e2('0x8')]('/',auth[_0xd9e2('0x9')](),controller[_0xd9e2('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd9e2('0x8')](_0xd9e2('0xb'),auth[_0xd9e2('0x9')](),controller[_0xd9e2('0xc')]);router[_0xd9e2('0xd')]('/',auth['isAuthenticated'](),controller[_0xd9e2('0xe')]);router[_0xd9e2('0xf')]('/:id',auth[_0xd9e2('0x9')](),controller['update']);router[_0xd9e2('0x10')](_0xd9e2('0xb'),auth[_0xd9e2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9235=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5b2414,_0x16d22f){var _0x30a395=function(_0x450826){while(--_0x450826){_0x5b2414['push'](_0x5b2414['shift']());}};_0x30a395(++_0x16d22f);}(_0x9235,0x8c));var _0x5923=function(_0x2d54c3,_0x2f7f9d){_0x2d54c3=_0x2d54c3-0x0;var _0x24575c=_0x9235[_0x2d54c3];return _0x24575c;};'use strict';var multer=require('multer');var util=require(_0x5923('0x0'));var path=require(_0x5923('0x1'));var timeout=require(_0x5923('0x2'));var express=require(_0x5923('0x3'));var router=express[_0x5923('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5923('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5923('0x6'));var controller=require('./faxTransferReport.controller');router[_0x5923('0x7')]('/',auth[_0x5923('0x8')](),controller[_0x5923('0x9')]);router['get'](_0x5923('0xa'),auth[_0x5923('0x8')](),controller[_0x5923('0xb')]);router[_0x5923('0x7')](_0x5923('0xc'),auth[_0x5923('0x8')](),controller[_0x5923('0xd')]);router[_0x5923('0xe')]('/',auth[_0x5923('0x8')](),controller[_0x5923('0xf')]);router[_0x5923('0x10')](_0x5923('0xc'),auth[_0x5923('0x8')](),controller[_0x5923('0x11')]);router[_0x5923('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5923('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 63c68de..6b3ec67 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 _0x2700=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','addConfiguration','put','update','destroy','exports','multer'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x2700,0x1b8));var _0x0270=function(_0x2fa4ee,_0x3e1dea){_0x2fa4ee=_0x2fa4ee-0x0;var _0x11b8aa=_0x2700[_0x2fa4ee];return _0x11b8aa;};'use strict';var multer=require(_0x0270('0x0'));var util=require(_0x0270('0x1'));var path=require(_0x0270('0x2'));var timeout=require(_0x0270('0x3'));var express=require(_0x0270('0x4'));var router=express[_0x0270('0x5')]();var fs_extra=require(_0x0270('0x6'));var auth=require(_0x0270('0x7'));var interaction=require(_0x0270('0x8'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x0270('0x9')]('/',auth[_0x0270('0xa')](),controller['index']);router['get'](_0x0270('0xb'),auth[_0x0270('0xa')](),controller[_0x0270('0xc')]);router[_0x0270('0x9')](_0x0270('0xd'),auth[_0x0270('0xa')](),controller['getConfigurations']);router['get'](_0x0270('0xe'),auth[_0x0270('0xa')](),controller['getFields']);router[_0x0270('0xf')]('/',auth[_0x0270('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x0270('0xa')](),controller[_0x0270('0x10')]);router[_0x0270('0x11')](_0x0270('0xb'),auth['isAuthenticated'](),controller[_0x0270('0x12')]);router['delete'](_0x0270('0xb'),auth['isAuthenticated'](),controller[_0x0270('0x13')]);module[_0x0270('0x14')]=router; \ No newline at end of file +var _0x3e30=['./intDeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x3e30,0x185));var _0x03e3=function(_0x3972c0,_0x4b49ea){_0x3972c0=_0x3972c0-0x0;var _0x1c7018=_0x3e30[_0x3972c0];return _0x1c7018;};'use strict';var multer=require('multer');var util=require(_0x03e3('0x0'));var path=require('path');var timeout=require(_0x03e3('0x1'));var express=require(_0x03e3('0x2'));var router=express['Router']();var fs_extra=require(_0x03e3('0x3'));var auth=require(_0x03e3('0x4'));var interaction=require(_0x03e3('0x5'));var config=require(_0x03e3('0x6'));var controller=require(_0x03e3('0x7'));router['get']('/',auth[_0x03e3('0x8')](),controller[_0x03e3('0x9')]);router['get'](_0x03e3('0xa'),auth['isAuthenticated'](),controller[_0x03e3('0xb')]);router[_0x03e3('0xc')](_0x03e3('0xd'),auth[_0x03e3('0x8')](),controller[_0x03e3('0xe')]);router['get'](_0x03e3('0xf'),auth[_0x03e3('0x8')](),controller['getFields']);router[_0x03e3('0x10')]('/',auth['isAuthenticated'](),controller[_0x03e3('0x11')]);router[_0x03e3('0x10')](_0x03e3('0xd'),auth[_0x03e3('0x8')](),controller[_0x03e3('0x12')]);router['put'](_0x03e3('0xa'),auth[_0x03e3('0x8')](),controller[_0x03e3('0x13')]);router[_0x03e3('0x14')]('/:id',auth[_0x03e3('0x8')](),controller[_0x03e3('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 d5cc07c..09b29dc 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 _0xdb5f=['STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x468e00,_0x812a1f){var _0x500f08=function(_0x150470){while(--_0x150470){_0x468e00['push'](_0x468e00['shift']());}};_0x500f08(++_0x812a1f);}(_0xdb5f,0x9b));var _0xfdb5=function(_0x5c5e15,_0x52a61f){_0x5c5e15=_0x5c5e15-0x0;var _0x32358e=_0xdb5f[_0x5c5e15];return _0x32358e;};'use strict';var Sequelize=require(_0xfdb5('0x0'));module['exports']={'name':{'type':Sequelize[_0xfdb5('0x1')]},'description':{'type':Sequelize[_0xfdb5('0x1')]},'username':{'type':Sequelize[_0xfdb5('0x1')]},'remoteUri':{'type':Sequelize[_0xfdb5('0x1')]},'authType':{'type':Sequelize[_0xfdb5('0x2')](_0xfdb5('0x3')),'defaultValue':_0xfdb5('0x3')},'password':{'type':Sequelize[_0xfdb5('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xfdb5('0x1')]},'token':{'type':Sequelize[_0xfdb5('0x1')]},'tokenSecret':{'type':Sequelize[_0xfdb5('0x1')]},'serverUrl':{'type':Sequelize[_0xfdb5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfdb5('0x2')](_0xfdb5('0x4'),_0xfdb5('0x5')),'defaultValue':_0xfdb5('0x4')}}; \ No newline at end of file +var _0x1ae4=['integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0x1ae4,0x103));var _0x41ae=function(_0x208ca5,_0x4a4689){_0x208ca5=_0x208ca5-0x0;var _0x59cb7d=_0x1ae4[_0x208ca5];return _0x59cb7d;};'use strict';var Sequelize=require(_0x41ae('0x0'));module[_0x41ae('0x1')]={'name':{'type':Sequelize[_0x41ae('0x2')]},'description':{'type':Sequelize[_0x41ae('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x41ae('0x2')]},'authType':{'type':Sequelize[_0x41ae('0x3')](_0x41ae('0x4')),'defaultValue':_0x41ae('0x4')},'password':{'type':Sequelize[_0x41ae('0x2')]},'consumerKey':{'type':Sequelize[_0x41ae('0x2')]},'consumerSecret':{'type':Sequelize[_0x41ae('0x2')]},'token':{'type':Sequelize[_0x41ae('0x2')]},'tokenSecret':{'type':Sequelize[_0x41ae('0x2')]},'serverUrl':{'type':Sequelize[_0x41ae('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x41ae('0x3')](_0x41ae('0x5'),'newTab'),'defaultValue':_0x41ae('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index abf226b..8850606 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 _0x391d=['apply','reject','save','update','then','sendStatus','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','destroy','getConfigurations','pick','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','Subjects','getFields','priority','findOne','remoteUri','username','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Basic\x20%s','%s:%s','password','toString','base64','concat','active','label','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count'];(function(_0x2f90ed,_0x90af12){var _0x4cda45=function(_0x46e1ca){while(--_0x46e1ca){_0x2f90ed['push'](_0x2f90ed['shift']());}};_0x4cda45(++_0x90af12);}(_0x391d,0xc6));var _0xd391=function(_0x39bf21,_0x5c2e3f){_0x39bf21=_0x39bf21-0x0;var _0x19c6e9=_0x391d[_0x39bf21];return _0x19c6e9;};'use strict';var emlformat=require(_0xd391('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd391('0x1'));var rp=require(_0xd391('0x2'));var moment=require(_0xd391('0x3'));var BPromise=require(_0xd391('0x4'));var Mustache=require(_0xd391('0x5'));var util=require(_0xd391('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd391('0x7'));var fs=require('fs');var fs_extra=require(_0xd391('0x8'));var _=require('lodash');var squel=require(_0xd391('0x9'));var crypto=require(_0xd391('0xa'));var jsforce=require(_0xd391('0xb'));var deskjs=require(_0xd391('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd391('0xd'));var Papa=require('papaparse');var Redis=require(_0xd391('0xe'));var authService=require(_0xd391('0xf'));var qs=require(_0xd391('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd391('0x11'));var logger=require('../../config/logger')(_0xd391('0x12'));var utils=require(_0xd391('0x13'));var config=require(_0xd391('0x14'));var licenseUtil=require(_0xd391('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd391('0x16'));function respondWithStatusCode(_0x7d6bae,_0x22c1e2){_0x22c1e2=_0x22c1e2||0xcc;return function(_0x2f3811){if(_0x2f3811){return _0x7d6bae['sendStatus'](_0x22c1e2);}return _0x7d6bae[_0xd391('0x17')](_0x22c1e2)[_0xd391('0x18')]();};}function respondWithResult(_0x1f149d,_0x1fc134){_0x1fc134=_0x1fc134||0xc8;return function(_0x3f3918){if(_0x3f3918){return _0x1f149d[_0xd391('0x17')](_0x1fc134)[_0xd391('0x19')](_0x3f3918);}};}function respondWithFilteredResult(_0x2bf9b6,_0x144245){return function(_0x11db3c){if(_0x11db3c){var _0x3fa735=typeof _0x144245[_0xd391('0x1a')]===_0xd391('0x1b')&&typeof _0x144245[_0xd391('0x1c')]===_0xd391('0x1b');var _0x2b6b53=_0x11db3c['count'];var _0x42cf82=_0x3fa735?0x0:_0x144245['offset'];var _0x59ec39=_0x3fa735?_0x11db3c[_0xd391('0x1d')]:_0x144245['offset']+_0x144245[_0xd391('0x1c')];var _0x1580f4;if(_0x59ec39>=_0x2b6b53){_0x59ec39=_0x2b6b53;_0x1580f4=0xc8;}else{_0x1580f4=0xce;}_0x2bf9b6[_0xd391('0x17')](_0x1580f4);return _0x2bf9b6['set']('Content-Range',_0x42cf82+'-'+_0x59ec39+'/'+_0x2b6b53)[_0xd391('0x19')](_0x11db3c);}return null;};}function patchUpdates(_0xa43f17){return function(_0x2022cf){try{jsonpatch[_0xd391('0x1e')](_0x2022cf,_0xa43f17,!![]);}catch(_0x3dea88){return BPromise[_0xd391('0x1f')](_0x3dea88);}return _0x2022cf[_0xd391('0x20')]();};}function saveUpdates(_0x222ebe,_0x4fbc35){return function(_0x513e45){if(_0x513e45){return _0x513e45[_0xd391('0x21')](_0x222ebe)[_0xd391('0x22')](function(_0x25f0f6){return _0x25f0f6;});}return null;};}function removeEntity(_0x45165a,_0x8bc5ed){return function(_0x414af2){if(_0x414af2){return _0x414af2['destroy']()[_0xd391('0x22')](function(){_0x45165a[_0xd391('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1b584,_0x50b1d0){return function(_0x4a2fc3){if(!_0x4a2fc3){_0xc1b584[_0xd391('0x23')](0x194);}return _0x4a2fc3;};}function handleError(_0xc8ac1,_0x484823){_0x484823=_0x484823||0x1f4;return function(_0x34ae9a){logger[_0xd391('0x24')](_0x34ae9a[_0xd391('0x25')]);if(_0x34ae9a[_0xd391('0x26')]){delete _0x34ae9a['name'];}_0xc8ac1[_0xd391('0x17')](_0x484823)['send'](_0x34ae9a);};}exports[_0xd391('0x27')]=function(_0x5941b0,_0x3d7ac1){var _0x5b5525={},_0x4534b9={},_0xe243d2={'count':0x0,'rows':[]};var _0x2dd85b=_[_0xd391('0x28')](db[_0xd391('0x29')][_0xd391('0x2a')],function(_0x184543){return{'name':_0x184543[_0xd391('0x2b')],'type':_0x184543['type'][_0xd391('0x2c')]};});_0x4534b9[_0xd391('0x2d')]=_['map'](_0x2dd85b,_0xd391('0x26'));_0x4534b9[_0xd391('0x2e')]=_[_0xd391('0x2f')](_0x5941b0['query']);_0x4534b9[_0xd391('0x30')]=_['intersection'](_0x4534b9[_0xd391('0x2d')],_0x4534b9[_0xd391('0x2e')]);_0x5b5525[_0xd391('0x31')]=_[_0xd391('0x32')](_0x4534b9[_0xd391('0x2d')],qs['fields'](_0x5941b0[_0xd391('0x2e')]['fields']));_0x5b5525[_0xd391('0x31')]=_0x5b5525[_0xd391('0x31')][_0xd391('0x33')]?_0x5b5525['attributes']:_0x4534b9[_0xd391('0x2d')];if(!_0x5941b0[_0xd391('0x2e')]['hasOwnProperty'](_0xd391('0x34'))){_0x5b5525[_0xd391('0x1c')]=qs['limit'](_0x5941b0[_0xd391('0x2e')][_0xd391('0x1c')]);_0x5b5525[_0xd391('0x1a')]=qs['offset'](_0x5941b0[_0xd391('0x2e')][_0xd391('0x1a')]);}_0x5b5525[_0xd391('0x35')]=qs[_0xd391('0x36')](_0x5941b0['query'][_0xd391('0x36')]);_0x5b5525[_0xd391('0x37')]=qs[_0xd391('0x30')](_['pick'](_0x5941b0[_0xd391('0x2e')],_0x4534b9[_0xd391('0x30')]),_0x2dd85b);if(_0x5941b0[_0xd391('0x2e')][_0xd391('0x38')]){_0x5b5525['where']=_[_0xd391('0x39')](_0x5b5525['where'],{'$or':_['map'](_0x2dd85b,function(_0x55d3ca){if(_0x55d3ca['type']!==_0xd391('0x3a')){var _0x211ed9={};_0x211ed9[_0x55d3ca[_0xd391('0x26')]]={'$like':'%'+_0x5941b0[_0xd391('0x2e')][_0xd391('0x38')]+'%'};return _0x211ed9;}})});}_0x5b5525=_['merge']({},_0x5b5525,_0x5941b0[_0xd391('0x3b')]);var _0xc6aac9={'where':_0x5b5525[_0xd391('0x37')]};return db[_0xd391('0x29')][_0xd391('0x1d')](_0xc6aac9)['then'](function(_0xf76080){_0xe243d2['count']=_0xf76080;if(_0x5941b0[_0xd391('0x2e')][_0xd391('0x3c')]){_0x5b5525[_0xd391('0x3d')]=[{'all':!![]}];}return db[_0xd391('0x29')][_0xd391('0x3e')](_0x5b5525);})[_0xd391('0x22')](function(_0x4b40a6){_0xe243d2[_0xd391('0x3f')]=_0x4b40a6;return _0xe243d2;})[_0xd391('0x22')](respondWithFilteredResult(_0x3d7ac1,_0x5b5525))['catch'](handleError(_0x3d7ac1,null));};exports[_0xd391('0x40')]=function(_0xd1c20c,_0x30f4cd){var _0x4ea16e={'raw':![],'where':{'id':_0xd1c20c[_0xd391('0x41')]['id']}},_0x35f6b6={};_0x35f6b6[_0xd391('0x2d')]=_[_0xd391('0x2f')](db[_0xd391('0x29')]['rawAttributes']);_0x35f6b6[_0xd391('0x2e')]=_['keys'](_0xd1c20c[_0xd391('0x2e')]);_0x35f6b6['filters']=_[_0xd391('0x32')](_0x35f6b6[_0xd391('0x2d')],_0x35f6b6['query']);_0x4ea16e[_0xd391('0x31')]=_[_0xd391('0x32')](_0x35f6b6['model'],qs[_0xd391('0x42')](_0xd1c20c[_0xd391('0x2e')][_0xd391('0x42')]));_0x4ea16e['attributes']=_0x4ea16e['attributes'][_0xd391('0x33')]?_0x4ea16e[_0xd391('0x31')]:_0x35f6b6[_0xd391('0x2d')];if(_0xd1c20c[_0xd391('0x2e')][_0xd391('0x3c')]){_0x4ea16e[_0xd391('0x3d')]=[{'all':!![]}];}_0x4ea16e=_['merge']({},_0x4ea16e,_0xd1c20c['options']);return db[_0xd391('0x29')][_0xd391('0x43')](_0x4ea16e)[_0xd391('0x22')](handleEntityNotFound(_0x30f4cd,null))[_0xd391('0x22')](respondWithResult(_0x30f4cd,null))[_0xd391('0x44')](handleError(_0x30f4cd,null));};exports[_0xd391('0x45')]=function(_0x1f75bb,_0x3695d7){return db[_0xd391('0x29')][_0xd391('0x45')](_0x1f75bb[_0xd391('0x46')],{})['then'](respondWithResult(_0x3695d7,0xc9))[_0xd391('0x44')](handleError(_0x3695d7,null));};exports['update']=function(_0xfac182,_0x488873){if(_0xfac182[_0xd391('0x46')]['id']){delete _0xfac182[_0xd391('0x46')]['id'];}return db['DeskAccount'][_0xd391('0x43')]({'where':{'id':_0xfac182['params']['id']}})['then'](handleEntityNotFound(_0x488873,null))['then'](saveUpdates(_0xfac182[_0xd391('0x46')],null))[_0xd391('0x22')](respondWithResult(_0x488873,null))[_0xd391('0x44')](handleError(_0x488873,null));};exports[_0xd391('0x47')]=function(_0x1bc786,_0x4806c1){return db[_0xd391('0x29')][_0xd391('0x43')]({'where':{'id':_0x1bc786[_0xd391('0x41')]['id']}})[_0xd391('0x22')](handleEntityNotFound(_0x4806c1,null))['then'](removeEntity(_0x4806c1,null))['catch'](handleError(_0x4806c1,null));};exports[_0xd391('0x48')]=function(_0x162254,_0x2b3c86,_0x2114b3){var _0x478aa2={};var _0x479658={};var _0x2a1026;var _0x2d8bdd;return db['DeskAccount']['findOne']({'where':{'id':_0x162254[_0xd391('0x41')]['id']}})[_0xd391('0x22')](handleEntityNotFound(_0x2b3c86,null))[_0xd391('0x22')](function(_0xbfa2b7){if(_0xbfa2b7){_0x2a1026=_0xbfa2b7;_0x479658[_0xd391('0x2d')]=_[_0xd391('0x2f')](db['DeskConfiguration'][_0xd391('0x2a')]);_0x479658[_0xd391('0x2e')]=_[_0xd391('0x2f')](_0x162254[_0xd391('0x2e')]);_0x479658[_0xd391('0x30')]=_[_0xd391('0x32')](_0x479658['model'],_0x479658[_0xd391('0x2e')]);_0x478aa2[_0xd391('0x31')]=_[_0xd391('0x32')](_0x479658['model'],qs['fields'](_0x162254[_0xd391('0x2e')][_0xd391('0x42')]));_0x478aa2[_0xd391('0x31')]=_0x478aa2[_0xd391('0x31')][_0xd391('0x33')]?_0x478aa2[_0xd391('0x31')]:_0x479658[_0xd391('0x2d')];_0x478aa2[_0xd391('0x35')]=qs[_0xd391('0x36')](_0x162254[_0xd391('0x2e')][_0xd391('0x36')]);_0x478aa2['where']=qs[_0xd391('0x30')](_[_0xd391('0x49')](_0x162254[_0xd391('0x2e')],_0x479658[_0xd391('0x30')]));if(_0x162254[_0xd391('0x2e')][_0xd391('0x38')]){_0x478aa2[_0xd391('0x37')]=_['merge'](_0x478aa2['where'],{'$or':_[_0xd391('0x28')](_0x478aa2[_0xd391('0x31')],function(_0x175f5e){var _0x46a062={};_0x46a062[_0x175f5e]={'$like':'%'+_0x162254[_0xd391('0x2e')][_0xd391('0x38')]+'%'};return _0x46a062;})});}_0x478aa2=_[_0xd391('0x39')]({},_0x478aa2,_0x162254['options']);return _0x2a1026['getConfigurations'](_0x478aa2);}})['then'](function(_0x3e85f5){if(_0x3e85f5){_0x2d8bdd=_0x3e85f5['length'];if(!_0x162254[_0xd391('0x2e')][_0xd391('0x4a')](_0xd391('0x34'))){_0x478aa2[_0xd391('0x1c')]=qs[_0xd391('0x1c')](_0x162254[_0xd391('0x2e')][_0xd391('0x1c')]);_0x478aa2['offset']=qs[_0xd391('0x1a')](_0x162254[_0xd391('0x2e')][_0xd391('0x1a')]);}return _0x2a1026[_0xd391('0x48')](_0x478aa2);}})[_0xd391('0x22')](function(_0x92d8fd){if(_0x92d8fd){return _0x92d8fd?{'count':_0x2d8bdd,'rows':_0x92d8fd}:null;}})['then'](respondWithResult(_0x2b3c86,null))[_0xd391('0x44')](handleError(_0x2b3c86,null));};exports[_0xd391('0x4b')]=function(_0x4f34c9,_0x219624,_0x408105){if(_0x4f34c9[_0xd391('0x46')]['id']){delete _0x4f34c9[_0xd391('0x46')]['id'];}return db[_0xd391('0x29')]['findOne']({'where':{'id':_0x4f34c9['params']['id']}})[_0xd391('0x22')](handleEntityNotFound(_0x219624,null))['then'](function(_0x129c8e){if(_0x129c8e){_0x4f34c9[_0xd391('0x46')][_0xd391('0x4c')]=_0x129c8e['id'];_0x4f34c9[_0xd391('0x46')]['Subjects']=integrations[_0xd391('0x4d')](_0x4f34c9['body'][_0xd391('0x4e')],_0x4f34c9[_0xd391('0x46')][_0xd391('0x4f')]);_0x4f34c9[_0xd391('0x46')][_0xd391('0x50')]=integrations[_0xd391('0x51')](_0x4f34c9[_0xd391('0x46')][_0xd391('0x4e')],_0x4f34c9[_0xd391('0x46')][_0xd391('0x4f')]);return db['DeskConfiguration'][_0xd391('0x45')](_0x4f34c9[_0xd391('0x46')],{'include':[{'model':db['DeskField'],'as':_0xd391('0x52')},{'model':db['DeskField'],'as':_0xd391('0x50')}]});}return null;})[_0xd391('0x22')](respondWithResult(_0x219624,null))[_0xd391('0x44')](handleError(_0x219624,null));};exports[_0xd391('0x53')]=function(_0x3a6643,_0x18cc1a,_0x303c3c){var _0x3f401e=[{'name':_0xd391('0x54'),'label':_0xd391('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 _0x409315='';return db[_0xd391('0x29')][_0xd391('0x55')]({'where':{'id':_0x3a6643[_0xd391('0x41')]['id']},'attributes':['id',_0xd391('0x56'),'authType',_0xd391('0x57'),'password',_0xd391('0x58'),'consumerSecret',_0xd391('0x59'),_0xd391('0x5a')]})[_0xd391('0x22')](handleEntityNotFound(_0x18cc1a,null))[_0xd391('0x22')](function(_0x383a84){if(_0x383a84){_0x409315=_0x383a84[_0xd391('0x56')];var _0x5b9a7c=_0x409315[_0xd391('0x5b')](-0x1);if(_0x5b9a7c==='/'){_0x409315=_0x409315[_0xd391('0x5c')](0x0,_0x409315[_0xd391('0x5d')](_0x5b9a7c));}var _0x3164d0={'method':_0xd391('0x5e'),'uri':util[_0xd391('0x5f')](_0xd391('0x60'),_0x409315),'headers':{'Content-Type':_0xd391('0x61'),'Accept':_0xd391('0x61')},'json':!![]};if(_0x383a84[_0xd391('0x62')]===_0xd391('0x63')){_0x3164d0[_0xd391('0x64')]['Authorization']=util[_0xd391('0x5f')](_0xd391('0x65'),new Buffer(util['format'](_0xd391('0x66'),_0x383a84[_0xd391('0x57')],_0x383a84[_0xd391('0x67')]))[_0xd391('0x68')](_0xd391('0x69')));}return rp(_0x3164d0)[_0xd391('0x22')](function(_0x29bf91){return _0x3f401e[_0xd391('0x6a')](_[_0xd391('0x28')](_0x29bf91['_embedded']['entries'],function(_0xa2e92b){return{'id':_0xa2e92b[_0xd391('0x26')],'name':_0xa2e92b[_0xd391('0x26')],'type':_0xa2e92b[_0xd391('0x4f')],'active':_0xa2e92b[_0xd391('0x6b')],'label':_0xa2e92b[_0xd391('0x6c')],'custom':!![]};}));});}})[_0xd391('0x22')](function(_0x544d6c){return{'count':_0x544d6c[_0xd391('0x33')],'rows':_0x544d6c};})['then'](respondWithResult(_0x18cc1a,null))[_0xd391('0x44')](function(_0x475263){var _0x4c3eeb=_0x3a6643[_0xd391('0x2e')][_0xd391('0x6d')]?0x1f4:_0x475263['statusCode']||0x1f4;logger[_0xd391('0x24')](_0xd391('0x6e'),'getFields',_0x4c3eeb,JSON['stringify'](_0x475263));delete _0x475263[_0xd391('0x26')];if(_0x4c3eeb===0x191){_0x4c3eeb=0x190;}_0x18cc1a[_0xd391('0x17')](_0x4c3eeb)[_0xd391('0x6f')](_0x3a6643[_0xd391('0x2e')][_0xd391('0x6d')]?{'message':_0xd391('0x70'),'statusCode':_0x475263[_0xd391('0x71')]}:_0x475263);});}; \ No newline at end of file +var _0xc155=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','DeskConfiguration','filter','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskField','getFields','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','application/json','Authorization','%s:%s','base64','concat','_embedded','active','label','stringify','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','map','DeskAccount','rawAttributes','fieldName','type','key'];(function(_0x347ec3,_0x20c6a5){var _0x4beb3a=function(_0x254a1e){while(--_0x254a1e){_0x347ec3['push'](_0x347ec3['shift']());}};_0x4beb3a(++_0x20c6a5);}(_0xc155,0x182));var _0x5c15=function(_0x5194c9,_0x10146f){_0x5194c9=_0x5194c9-0x0;var _0x34b94f=_0xc155[_0x5194c9];return _0x34b94f;};'use strict';var emlformat=require(_0x5c15('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c15('0x1'));var rp=require(_0x5c15('0x2'));var moment=require(_0x5c15('0x3'));var BPromise=require(_0x5c15('0x4'));var Mustache=require('mustache');var util=require(_0x5c15('0x5'));var path=require('path');var sox=require(_0x5c15('0x6'));var csv=require(_0x5c15('0x7'));var ejs=require(_0x5c15('0x8'));var fs=require('fs');var fs_extra=require(_0x5c15('0x9'));var _=require('lodash');var squel=require(_0x5c15('0xa'));var crypto=require('crypto');var jsforce=require(_0x5c15('0xb'));var deskjs=require(_0x5c15('0xc'));var toCsv=require(_0x5c15('0x7'));var querystring=require(_0x5c15('0xd'));var Papa=require(_0x5c15('0xe'));var Redis=require(_0x5c15('0xf'));var authService=require(_0x5c15('0x10'));var qs=require(_0x5c15('0x11'));var as=require(_0x5c15('0x12'));var hardwareService=require(_0x5c15('0x13'));var logger=require('../../config/logger')(_0x5c15('0x14'));var utils=require(_0x5c15('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5c15('0x16'));var db=require(_0x5c15('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x93e44d,_0xa57418){_0xa57418=_0xa57418||0xcc;return function(_0x4d7ac4){if(_0x4d7ac4){return _0x93e44d['sendStatus'](_0xa57418);}return _0x93e44d[_0x5c15('0x18')](_0xa57418)['end']();};}function respondWithResult(_0x49d518,_0x4851a7){_0x4851a7=_0x4851a7||0xc8;return function(_0x3faa4a){if(_0x3faa4a){return _0x49d518[_0x5c15('0x18')](_0x4851a7)[_0x5c15('0x19')](_0x3faa4a);}};}function respondWithFilteredResult(_0x109125,_0x33f45b){return function(_0x56ad55){if(_0x56ad55){var _0xd10f69=typeof _0x33f45b[_0x5c15('0x1a')]===_0x5c15('0x1b')&&typeof _0x33f45b[_0x5c15('0x1c')]==='undefined';var _0x5c39f9=_0x56ad55[_0x5c15('0x1d')];var _0x19fa58=_0xd10f69?0x0:_0x33f45b[_0x5c15('0x1a')];var _0x1f6d1a=_0xd10f69?_0x56ad55[_0x5c15('0x1d')]:_0x33f45b[_0x5c15('0x1a')]+_0x33f45b[_0x5c15('0x1c')];var _0x44f233;if(_0x1f6d1a>=_0x5c39f9){_0x1f6d1a=_0x5c39f9;_0x44f233=0xc8;}else{_0x44f233=0xce;}_0x109125['status'](_0x44f233);return _0x109125['set'](_0x5c15('0x1e'),_0x19fa58+'-'+_0x1f6d1a+'/'+_0x5c39f9)[_0x5c15('0x19')](_0x56ad55);}return null;};}function patchUpdates(_0x10e82b){return function(_0x5da10c){try{jsonpatch[_0x5c15('0x1f')](_0x5da10c,_0x10e82b,!![]);}catch(_0x9d4dcd){return BPromise[_0x5c15('0x20')](_0x9d4dcd);}return _0x5da10c[_0x5c15('0x21')]();};}function saveUpdates(_0x678777,_0x52ca4b){return function(_0x4babd0){if(_0x4babd0){return _0x4babd0[_0x5c15('0x22')](_0x678777)['then'](function(_0x5d6c01){return _0x5d6c01;});}return null;};}function removeEntity(_0x2386a3,_0x506e43){return function(_0x319463){if(_0x319463){return _0x319463['destroy']()[_0x5c15('0x23')](function(){_0x2386a3[_0x5c15('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ebffb,_0x2fd404){return function(_0x524b0c){if(!_0x524b0c){_0x1ebffb[_0x5c15('0x24')](0x194);}return _0x524b0c;};}function handleError(_0x34b28d,_0x363922){_0x363922=_0x363922||0x1f4;return function(_0x2ea2d6){logger[_0x5c15('0x25')](_0x2ea2d6['stack']);if(_0x2ea2d6[_0x5c15('0x26')]){delete _0x2ea2d6[_0x5c15('0x26')];}_0x34b28d['status'](_0x363922)[_0x5c15('0x27')](_0x2ea2d6);};}exports['index']=function(_0x3c1afc,_0x262239){var _0x486f00={},_0x47c0c1={},_0x3d84e1={'count':0x0,'rows':[]};var _0x1e556a=_[_0x5c15('0x28')](db[_0x5c15('0x29')][_0x5c15('0x2a')],function(_0x1a467b){return{'name':_0x1a467b[_0x5c15('0x2b')],'type':_0x1a467b[_0x5c15('0x2c')][_0x5c15('0x2d')]};});_0x47c0c1['model']=_['map'](_0x1e556a,'name');_0x47c0c1[_0x5c15('0x2e')]=_[_0x5c15('0x2f')](_0x3c1afc['query']);_0x47c0c1[_0x5c15('0x30')]=_[_0x5c15('0x31')](_0x47c0c1[_0x5c15('0x32')],_0x47c0c1[_0x5c15('0x2e')]);_0x486f00[_0x5c15('0x33')]=_[_0x5c15('0x31')](_0x47c0c1['model'],qs['fields'](_0x3c1afc[_0x5c15('0x2e')][_0x5c15('0x34')]));_0x486f00['attributes']=_0x486f00['attributes'][_0x5c15('0x35')]?_0x486f00['attributes']:_0x47c0c1['model'];if(!_0x3c1afc[_0x5c15('0x2e')][_0x5c15('0x36')](_0x5c15('0x37'))){_0x486f00['limit']=qs[_0x5c15('0x1c')](_0x3c1afc[_0x5c15('0x2e')][_0x5c15('0x1c')]);_0x486f00['offset']=qs['offset'](_0x3c1afc[_0x5c15('0x2e')]['offset']);}_0x486f00[_0x5c15('0x38')]=qs[_0x5c15('0x39')](_0x3c1afc[_0x5c15('0x2e')][_0x5c15('0x39')]);_0x486f00[_0x5c15('0x3a')]=qs[_0x5c15('0x30')](_[_0x5c15('0x3b')](_0x3c1afc[_0x5c15('0x2e')],_0x47c0c1[_0x5c15('0x30')]),_0x1e556a);if(_0x3c1afc['query']['filter']){_0x486f00['where']=_[_0x5c15('0x3c')](_0x486f00[_0x5c15('0x3a')],{'$or':_['map'](_0x1e556a,function(_0x1ed1cd){if(_0x1ed1cd[_0x5c15('0x2c')]!==_0x5c15('0x3d')){var _0x3db328={};_0x3db328[_0x1ed1cd[_0x5c15('0x26')]]={'$like':'%'+_0x3c1afc[_0x5c15('0x2e')]['filter']+'%'};return _0x3db328;}})});}_0x486f00=_[_0x5c15('0x3c')]({},_0x486f00,_0x3c1afc[_0x5c15('0x3e')]);var _0x6c5d9a={'where':_0x486f00[_0x5c15('0x3a')]};return db[_0x5c15('0x29')][_0x5c15('0x1d')](_0x6c5d9a)[_0x5c15('0x23')](function(_0x2a4b91){_0x3d84e1[_0x5c15('0x1d')]=_0x2a4b91;if(_0x3c1afc[_0x5c15('0x2e')][_0x5c15('0x3f')]){_0x486f00[_0x5c15('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x5c15('0x41')](_0x486f00);})[_0x5c15('0x23')](function(_0x3e6587){_0x3d84e1[_0x5c15('0x42')]=_0x3e6587;return _0x3d84e1;})[_0x5c15('0x23')](respondWithFilteredResult(_0x262239,_0x486f00))['catch'](handleError(_0x262239,null));};exports[_0x5c15('0x43')]=function(_0x5e0ca8,_0x3025d5){var _0x46a6e2={'raw':![],'where':{'id':_0x5e0ca8['params']['id']}},_0x34ca22={};_0x34ca22[_0x5c15('0x32')]=_[_0x5c15('0x2f')](db[_0x5c15('0x29')][_0x5c15('0x2a')]);_0x34ca22[_0x5c15('0x2e')]=_[_0x5c15('0x2f')](_0x5e0ca8['query']);_0x34ca22['filters']=_[_0x5c15('0x31')](_0x34ca22[_0x5c15('0x32')],_0x34ca22[_0x5c15('0x2e')]);_0x46a6e2[_0x5c15('0x33')]=_[_0x5c15('0x31')](_0x34ca22[_0x5c15('0x32')],qs[_0x5c15('0x34')](_0x5e0ca8[_0x5c15('0x2e')][_0x5c15('0x34')]));_0x46a6e2[_0x5c15('0x33')]=_0x46a6e2[_0x5c15('0x33')][_0x5c15('0x35')]?_0x46a6e2['attributes']:_0x34ca22['model'];if(_0x5e0ca8['query'][_0x5c15('0x3f')]){_0x46a6e2[_0x5c15('0x40')]=[{'all':!![]}];}_0x46a6e2=_[_0x5c15('0x3c')]({},_0x46a6e2,_0x5e0ca8['options']);return db[_0x5c15('0x29')][_0x5c15('0x44')](_0x46a6e2)['then'](handleEntityNotFound(_0x3025d5,null))[_0x5c15('0x23')](respondWithResult(_0x3025d5,null))[_0x5c15('0x45')](handleError(_0x3025d5,null));};exports[_0x5c15('0x46')]=function(_0x47f45a,_0x3945de){return db[_0x5c15('0x29')][_0x5c15('0x46')](_0x47f45a[_0x5c15('0x47')],{})['then'](respondWithResult(_0x3945de,0xc9))[_0x5c15('0x45')](handleError(_0x3945de,null));};exports['update']=function(_0x4637a1,_0x564c0b){if(_0x4637a1[_0x5c15('0x47')]['id']){delete _0x4637a1[_0x5c15('0x47')]['id'];}return db[_0x5c15('0x29')][_0x5c15('0x44')]({'where':{'id':_0x4637a1[_0x5c15('0x48')]['id']}})[_0x5c15('0x23')](handleEntityNotFound(_0x564c0b,null))['then'](saveUpdates(_0x4637a1[_0x5c15('0x47')],null))[_0x5c15('0x23')](respondWithResult(_0x564c0b,null))['catch'](handleError(_0x564c0b,null));};exports['destroy']=function(_0x3ddc2c,_0x1710c3){return db[_0x5c15('0x29')][_0x5c15('0x44')]({'where':{'id':_0x3ddc2c[_0x5c15('0x48')]['id']}})['then'](handleEntityNotFound(_0x1710c3,null))[_0x5c15('0x23')](removeEntity(_0x1710c3,null))['catch'](handleError(_0x1710c3,null));};exports[_0x5c15('0x49')]=function(_0x5db34d,_0x1ec4b7,_0x3fb04a){var _0x4e071e={};var _0x71e02d={};var _0x4e8f11;var _0x386b98;return db[_0x5c15('0x29')]['findOne']({'where':{'id':_0x5db34d[_0x5c15('0x48')]['id']}})[_0x5c15('0x23')](handleEntityNotFound(_0x1ec4b7,null))[_0x5c15('0x23')](function(_0x585250){if(_0x585250){_0x4e8f11=_0x585250;_0x71e02d[_0x5c15('0x32')]=_[_0x5c15('0x2f')](db[_0x5c15('0x4a')][_0x5c15('0x2a')]);_0x71e02d[_0x5c15('0x2e')]=_[_0x5c15('0x2f')](_0x5db34d[_0x5c15('0x2e')]);_0x71e02d[_0x5c15('0x30')]=_[_0x5c15('0x31')](_0x71e02d[_0x5c15('0x32')],_0x71e02d[_0x5c15('0x2e')]);_0x4e071e['attributes']=_[_0x5c15('0x31')](_0x71e02d['model'],qs[_0x5c15('0x34')](_0x5db34d[_0x5c15('0x2e')]['fields']));_0x4e071e[_0x5c15('0x33')]=_0x4e071e[_0x5c15('0x33')][_0x5c15('0x35')]?_0x4e071e[_0x5c15('0x33')]:_0x71e02d[_0x5c15('0x32')];_0x4e071e[_0x5c15('0x38')]=qs[_0x5c15('0x39')](_0x5db34d[_0x5c15('0x2e')][_0x5c15('0x39')]);_0x4e071e[_0x5c15('0x3a')]=qs[_0x5c15('0x30')](_[_0x5c15('0x3b')](_0x5db34d[_0x5c15('0x2e')],_0x71e02d[_0x5c15('0x30')]));if(_0x5db34d[_0x5c15('0x2e')][_0x5c15('0x4b')]){_0x4e071e[_0x5c15('0x3a')]=_[_0x5c15('0x3c')](_0x4e071e['where'],{'$or':_[_0x5c15('0x28')](_0x4e071e[_0x5c15('0x33')],function(_0x4dd349){var _0x2c23af={};_0x2c23af[_0x4dd349]={'$like':'%'+_0x5db34d[_0x5c15('0x2e')][_0x5c15('0x4b')]+'%'};return _0x2c23af;})});}_0x4e071e=_['merge']({},_0x4e071e,_0x5db34d[_0x5c15('0x3e')]);return _0x4e8f11[_0x5c15('0x49')](_0x4e071e);}})['then'](function(_0x1eeb79){if(_0x1eeb79){_0x386b98=_0x1eeb79[_0x5c15('0x35')];if(!_0x5db34d[_0x5c15('0x2e')][_0x5c15('0x36')](_0x5c15('0x37'))){_0x4e071e[_0x5c15('0x1c')]=qs[_0x5c15('0x1c')](_0x5db34d[_0x5c15('0x2e')][_0x5c15('0x1c')]);_0x4e071e['offset']=qs[_0x5c15('0x1a')](_0x5db34d[_0x5c15('0x2e')][_0x5c15('0x1a')]);}return _0x4e8f11[_0x5c15('0x49')](_0x4e071e);}})[_0x5c15('0x23')](function(_0x47b511){if(_0x47b511){return _0x47b511?{'count':_0x386b98,'rows':_0x47b511}:null;}})[_0x5c15('0x23')](respondWithResult(_0x1ec4b7,null))['catch'](handleError(_0x1ec4b7,null));};exports[_0x5c15('0x4c')]=function(_0x3df1db,_0x24454f,_0x5bbb06){if(_0x3df1db['body']['id']){delete _0x3df1db[_0x5c15('0x47')]['id'];}return db[_0x5c15('0x29')][_0x5c15('0x4d')]({'where':{'id':_0x3df1db[_0x5c15('0x48')]['id']}})[_0x5c15('0x23')](handleEntityNotFound(_0x24454f,null))['then'](function(_0x52ae7b){if(_0x52ae7b){_0x3df1db[_0x5c15('0x47')][_0x5c15('0x4e')]=_0x52ae7b['id'];_0x3df1db[_0x5c15('0x47')][_0x5c15('0x4f')]=integrations[_0x5c15('0x50')](_0x3df1db['body']['channel'],_0x3df1db['body'][_0x5c15('0x2c')]);_0x3df1db[_0x5c15('0x47')][_0x5c15('0x51')]=integrations[_0x5c15('0x52')](_0x3df1db[_0x5c15('0x47')]['channel'],_0x3df1db['body'][_0x5c15('0x2c')]);return db[_0x5c15('0x4a')][_0x5c15('0x46')](_0x3df1db[_0x5c15('0x47')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x5c15('0x53')],'as':_0x5c15('0x51')}]});}return null;})[_0x5c15('0x23')](respondWithResult(_0x24454f,null))[_0x5c15('0x45')](handleError(_0x24454f,null));};exports[_0x5c15('0x54')]=function(_0x460ab8,_0x9ca88e,_0x287c06){var _0x289131=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x104e46='';return db[_0x5c15('0x29')]['findOne']({'where':{'id':_0x460ab8[_0x5c15('0x48')]['id']},'attributes':['id',_0x5c15('0x55'),_0x5c15('0x56'),_0x5c15('0x57'),_0x5c15('0x58'),_0x5c15('0x59'),_0x5c15('0x5a'),_0x5c15('0x5b'),'tokenSecret']})[_0x5c15('0x23')](handleEntityNotFound(_0x9ca88e,null))[_0x5c15('0x23')](function(_0x4be905){if(_0x4be905){_0x104e46=_0x4be905['remoteUri'];var _0x5a6f8a=_0x104e46[_0x5c15('0x5c')](-0x1);if(_0x5a6f8a==='/'){_0x104e46=_0x104e46[_0x5c15('0x5d')](0x0,_0x104e46[_0x5c15('0x5e')](_0x5a6f8a));}var _0x1e60c9={'method':_0x5c15('0x5f'),'uri':util[_0x5c15('0x60')]('%s/custom_fields',_0x104e46),'headers':{'Content-Type':_0x5c15('0x61'),'Accept':_0x5c15('0x61')},'json':!![]};if(_0x4be905[_0x5c15('0x56')]==='basic'){_0x1e60c9['headers'][_0x5c15('0x62')]=util[_0x5c15('0x60')]('Basic\x20%s',new Buffer(util[_0x5c15('0x60')](_0x5c15('0x63'),_0x4be905[_0x5c15('0x57')],_0x4be905[_0x5c15('0x58')]))['toString'](_0x5c15('0x64')));}return rp(_0x1e60c9)['then'](function(_0x1ec140){return _0x289131[_0x5c15('0x65')](_[_0x5c15('0x28')](_0x1ec140[_0x5c15('0x66')]['entries'],function(_0x265bda){return{'id':_0x265bda[_0x5c15('0x26')],'name':_0x265bda[_0x5c15('0x26')],'type':_0x265bda[_0x5c15('0x2c')],'active':_0x265bda[_0x5c15('0x67')],'label':_0x265bda[_0x5c15('0x68')],'custom':!![]};}));});}})['then'](function(_0x1c16b8){return{'count':_0x1c16b8[_0x5c15('0x35')],'rows':_0x1c16b8};})[_0x5c15('0x23')](respondWithResult(_0x9ca88e,null))[_0x5c15('0x45')](function(_0x31af04){var _0x722b3f=_0x460ab8[_0x5c15('0x2e')]['test']?0x1f4:_0x31af04['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x5c15('0x54'),_0x722b3f,JSON[_0x5c15('0x69')](_0x31af04));delete _0x31af04[_0x5c15('0x26')];if(_0x722b3f===0x191){_0x722b3f=0x190;}_0x9ca88e[_0x5c15('0x18')](_0x722b3f)[_0x5c15('0x27')](_0x460ab8[_0x5c15('0x2e')]['test']?{'message':_0x5c15('0x6a'),'statusCode':_0x31af04[_0x5c15('0x6b')]}:_0x31af04);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2a2bfbd..70f87f2 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 _0xdab3=['path','rimraf','../../config/environment','./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x137d0c,_0x2b7de3){var _0x2c2efb=function(_0x4ac640){while(--_0x4ac640){_0x137d0c['push'](_0x137d0c['shift']());}};_0x2c2efb(++_0x2b7de3);}(_0xdab3,0x13f));var _0x3dab=function(_0x2e99b2,_0x112191){_0x2e99b2=_0x2e99b2-0x0;var _0x294107=_0xdab3[_0x2e99b2];return _0x294107;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var logger=require(_0x3dab('0x2'))(_0x3dab('0x3'));var moment=require('moment');var BPromise=require(_0x3dab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dab('0x5'));var rimraf=require(_0x3dab('0x6'));var config=require(_0x3dab('0x7'));var attributes=require(_0x3dab('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x24c9bf,_0x4af469){return _0x24c9bf[_0x3dab('0x9')](_0x3dab('0xa'),attributes,{'tableName':_0x3dab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f38=['util','../../config/logger','api','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x22c29e,_0x24337a){var _0x5d7e57=function(_0x3f990a){while(--_0x3f990a){_0x22c29e['push'](_0x22c29e['shift']());}};_0x5d7e57(++_0x24337a);}(_0x3f38,0xef));var _0x83f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3f38[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x83f3('0x0'));var util=require(_0x83f3('0x1'));var logger=require(_0x83f3('0x2'))(_0x83f3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x83f3('0x4'));var fs=require('fs');var path=require(_0x83f3('0x5'));var rimraf=require('rimraf');var config=require(_0x83f3('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x83f3('0x7'));module[_0x83f3('0x8')]=function(_0x2f939f,_0x4920cb){return _0x2f939f[_0x83f3('0x9')](_0x83f3('0xa'),attributes,{'tableName':_0x83f3('0xb'),'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 da8c497..16b397f 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 _0x0b01=['request\x20sent','result','catch','GetDeskAccount','findAll','options','raw','where','limit','include','attributes','map','model','DeskAccount','ShowDeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','DeskAccount,\x20%s,\x20%s','debug','error','code','message','info'];(function(_0x353c53,_0x2102c0){var _0x2c55da=function(_0x3fe2d5){while(--_0x3fe2d5){_0x353c53['push'](_0x353c53['shift']());}};_0x2c55da(++_0x2102c0);}(_0x0b01,0xfd));var _0x10b0=function(_0xd9fb1d,_0x122874){_0xd9fb1d=_0xd9fb1d-0x0;var _0x26ef43=_0x0b01[_0xd9fb1d];return _0x26ef43;};'use strict';var _=require(_0x10b0('0x0'));var util=require('util');var moment=require(_0x10b0('0x1'));var BPromise=require(_0x10b0('0x2'));var rs=require(_0x10b0('0x3'));var fs=require('fs');var Redis=require(_0x10b0('0x4'));var db=require(_0x10b0('0x5'))['db'];var utils=require(_0x10b0('0x6'));var logger=require(_0x10b0('0x7'))('rpc');var config=require(_0x10b0('0x8'));var jayson=require(_0x10b0('0x9'));var client=jayson[_0x10b0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22907e,_0x5be173,_0x27459c){return new BPromise(function(_0x27f8db,_0x5f3b18){return client[_0x10b0('0xb')](_0x22907e,_0x27459c)[_0x10b0('0xc')](function(_0x23b0bd){logger['info'](_0x10b0('0xd'),_0x5be173,'request\x20sent');logger[_0x10b0('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5be173,'request\x20sent',JSON['stringify'](_0x23b0bd));if(_0x23b0bd[_0x10b0('0xf')]){if(_0x23b0bd[_0x10b0('0xf')][_0x10b0('0x10')]===0x1f4){logger[_0x10b0('0xf')]('DeskAccount,\x20%s,\x20%s',_0x5be173,_0x23b0bd[_0x10b0('0xf')][_0x10b0('0x11')]);return _0x5f3b18(_0x23b0bd[_0x10b0('0xf')][_0x10b0('0x11')]);}logger[_0x10b0('0xf')](_0x10b0('0xd'),_0x5be173,_0x23b0bd[_0x10b0('0xf')][_0x10b0('0x11')]);return _0x27f8db(_0x23b0bd['error']['message']);}else{logger[_0x10b0('0x12')](_0x10b0('0xd'),_0x5be173,_0x10b0('0x13'));_0x27f8db(_0x23b0bd[_0x10b0('0x14')]['message']);}})[_0x10b0('0x15')](function(_0x41d6d6){logger[_0x10b0('0xf')](_0x10b0('0xd'),_0x5be173,_0x41d6d6);_0x5f3b18(_0x41d6d6);});});}exports[_0x10b0('0x16')]=function(_0x39a569){var _0x2546b6=this;return new Promise(function(_0x18dcab,_0x31acb7){return db['DeskAccount'][_0x10b0('0x17')]({'raw':_0x39a569[_0x10b0('0x18')]?_0x39a569[_0x10b0('0x18')][_0x10b0('0x19')]===undefined?!![]:![]:!![],'where':_0x39a569['options']?_0x39a569[_0x10b0('0x18')][_0x10b0('0x1a')]||null:null,'attributes':_0x39a569[_0x10b0('0x18')]?_0x39a569['options']['attributes']||null:null,'limit':_0x39a569[_0x10b0('0x18')]?_0x39a569[_0x10b0('0x18')][_0x10b0('0x1b')]||null:null,'include':_0x39a569[_0x10b0('0x18')]?_0x39a569[_0x10b0('0x18')][_0x10b0('0x1c')]?_['map'](_0x39a569[_0x10b0('0x18')][_0x10b0('0x1c')],function(_0x540364){return{'model':db[_0x540364['model']],'as':_0x540364['as'],'attributes':_0x540364[_0x10b0('0x1d')],'include':_0x540364[_0x10b0('0x1c')]?_[_0x10b0('0x1e')](_0x540364[_0x10b0('0x1c')],function(_0x431866){return{'model':db[_0x431866[_0x10b0('0x1f')]],'as':_0x431866['as'],'attributes':_0x431866[_0x10b0('0x1d')],'include':_0x431866[_0x10b0('0x1c')]?_['map'](_0x431866[_0x10b0('0x1c')],function(_0xe8b472){return{'model':db[_0xe8b472[_0x10b0('0x1f')]],'as':_0xe8b472['as'],'attributes':_0xe8b472[_0x10b0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x10b0('0xc')](function(_0x1cc173){logger[_0x10b0('0x12')](_0x10b0('0x16'),_0x39a569);logger[_0x10b0('0xe')](_0x10b0('0x16'),_0x39a569,JSON['stringify'](_0x1cc173));_0x18dcab(_0x1cc173);})['catch'](function(_0x341960){logger[_0x10b0('0xf')](_0x10b0('0x16'),_0x341960[_0x10b0('0x11')],_0x39a569);_0x31acb7(_0x2546b6[_0x10b0('0xf')](0x1f4,_0x341960[_0x10b0('0x11')]));});});};exports['ShowDeskAccount']=function(_0x160bce){var _0x18713d=this;return new Promise(function(_0x5e6a96,_0x3b997d){return db[_0x10b0('0x20')]['find']({'raw':_0x160bce['options']?_0x160bce['options'][_0x10b0('0x19')]===undefined?!![]:![]:!![],'where':_0x160bce[_0x10b0('0x18')]?_0x160bce[_0x10b0('0x18')][_0x10b0('0x1a')]||null:null,'attributes':_0x160bce['options']?_0x160bce[_0x10b0('0x18')][_0x10b0('0x1d')]||null:null,'include':_0x160bce[_0x10b0('0x18')]?_0x160bce[_0x10b0('0x18')]['include']?_[_0x10b0('0x1e')](_0x160bce[_0x10b0('0x18')][_0x10b0('0x1c')],function(_0xfbd8bf){return{'model':db[_0xfbd8bf['model']],'as':_0xfbd8bf['as'],'attributes':_0xfbd8bf[_0x10b0('0x1d')],'include':_0xfbd8bf['include']?_[_0x10b0('0x1e')](_0xfbd8bf['include'],function(_0x3fe700){return{'model':db[_0x3fe700[_0x10b0('0x1f')]],'as':_0x3fe700['as'],'attributes':_0x3fe700[_0x10b0('0x1d')],'include':_0x3fe700[_0x10b0('0x1c')]?_['map'](_0x3fe700['include'],function(_0x51f056){return{'model':db[_0x51f056['model']],'as':_0x51f056['as'],'attributes':_0x51f056[_0x10b0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x10b0('0xc')](function(_0x5b1bd9){logger['info']('ShowDeskAccount',_0x160bce);logger[_0x10b0('0xe')](_0x10b0('0x21'),_0x160bce,JSON['stringify'](_0x5b1bd9));_0x5e6a96(_0x5b1bd9);})[_0x10b0('0x15')](function(_0x46c292){logger[_0x10b0('0xf')](_0x10b0('0x21'),_0x46c292[_0x10b0('0x11')],_0x160bce);_0x3b997d(_0x18713d[_0x10b0('0xf')](0x1f4,_0x46c292[_0x10b0('0x11')]));});});}; \ No newline at end of file +var _0xf749=['debug','stringify','catch','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','model'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0xf749,0x178));var _0x9f74=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xf749[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x9f74('0x0'));var util=require(_0x9f74('0x1'));var moment=require(_0x9f74('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f74('0x3'));var fs=require('fs');var Redis=require(_0x9f74('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f74('0x5'))('rpc');var config=require(_0x9f74('0x6'));var jayson=require(_0x9f74('0x7'));var client=jayson[_0x9f74('0x8')][_0x9f74('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d09a5,_0x2beb51,_0x2715e6){return new BPromise(function(_0xa9084c,_0x4cddde){return client[_0x9f74('0xa')](_0x1d09a5,_0x2715e6)[_0x9f74('0xb')](function(_0x33a913){logger[_0x9f74('0xc')](_0x9f74('0xd'),_0x2beb51,'request\x20sent');logger['debug'](_0x9f74('0xe'),_0x2beb51,'request\x20sent',JSON['stringify'](_0x33a913));if(_0x33a913['error']){if(_0x33a913[_0x9f74('0xf')]['code']===0x1f4){logger[_0x9f74('0xf')](_0x9f74('0xd'),_0x2beb51,_0x33a913[_0x9f74('0xf')][_0x9f74('0x10')]);return _0x4cddde(_0x33a913[_0x9f74('0xf')][_0x9f74('0x10')]);}logger[_0x9f74('0xf')](_0x9f74('0xd'),_0x2beb51,_0x33a913['error'][_0x9f74('0x10')]);return _0xa9084c(_0x33a913['error'][_0x9f74('0x10')]);}else{logger[_0x9f74('0xc')](_0x9f74('0xd'),_0x2beb51,'request\x20sent');_0xa9084c(_0x33a913['result']['message']);}})['catch'](function(_0x3ad43d){logger[_0x9f74('0xf')](_0x9f74('0xd'),_0x2beb51,_0x3ad43d);_0x4cddde(_0x3ad43d);});});}exports[_0x9f74('0x11')]=function(_0x4b9fa1){var _0x570aea=this;return new Promise(function(_0xc5d37f,_0xaa40c4){return db[_0x9f74('0x12')][_0x9f74('0x13')]({'raw':_0x4b9fa1['options']?_0x4b9fa1[_0x9f74('0x14')][_0x9f74('0x15')]===undefined?!![]:![]:!![],'where':_0x4b9fa1[_0x9f74('0x14')]?_0x4b9fa1[_0x9f74('0x14')][_0x9f74('0x16')]||null:null,'attributes':_0x4b9fa1['options']?_0x4b9fa1[_0x9f74('0x14')][_0x9f74('0x17')]||null:null,'limit':_0x4b9fa1[_0x9f74('0x14')]?_0x4b9fa1['options']['limit']||null:null,'include':_0x4b9fa1[_0x9f74('0x14')]?_0x4b9fa1[_0x9f74('0x14')][_0x9f74('0x18')]?_[_0x9f74('0x19')](_0x4b9fa1[_0x9f74('0x14')][_0x9f74('0x18')],function(_0xac97b7){return{'model':db[_0xac97b7[_0x9f74('0x1a')]],'as':_0xac97b7['as'],'attributes':_0xac97b7[_0x9f74('0x17')],'include':_0xac97b7[_0x9f74('0x18')]?_[_0x9f74('0x19')](_0xac97b7[_0x9f74('0x18')],function(_0x26f459){return{'model':db[_0x26f459[_0x9f74('0x1a')]],'as':_0x26f459['as'],'attributes':_0x26f459[_0x9f74('0x17')],'include':_0x26f459['include']?_[_0x9f74('0x19')](_0x26f459[_0x9f74('0x18')],function(_0x10d7be){return{'model':db[_0x10d7be[_0x9f74('0x1a')]],'as':_0x10d7be['as'],'attributes':_0x10d7be[_0x9f74('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9f74('0xb')](function(_0x4b81de){logger[_0x9f74('0xc')](_0x9f74('0x11'),_0x4b9fa1);logger[_0x9f74('0x1b')]('GetDeskAccount',_0x4b9fa1,JSON[_0x9f74('0x1c')](_0x4b81de));_0xc5d37f(_0x4b81de);})[_0x9f74('0x1d')](function(_0x3f1a54){logger[_0x9f74('0xf')](_0x9f74('0x11'),_0x3f1a54['message'],_0x4b9fa1);_0xaa40c4(_0x570aea[_0x9f74('0xf')](0x1f4,_0x3f1a54['message']));});});};exports[_0x9f74('0x1e')]=function(_0xb087b5){var _0xb42b9=this;return new Promise(function(_0x1fd0bd,_0x1e3fb2){return db['DeskAccount']['find']({'raw':_0xb087b5[_0x9f74('0x14')]?_0xb087b5['options'][_0x9f74('0x15')]===undefined?!![]:![]:!![],'where':_0xb087b5[_0x9f74('0x14')]?_0xb087b5[_0x9f74('0x14')][_0x9f74('0x16')]||null:null,'attributes':_0xb087b5[_0x9f74('0x14')]?_0xb087b5['options'][_0x9f74('0x17')]||null:null,'include':_0xb087b5[_0x9f74('0x14')]?_0xb087b5[_0x9f74('0x14')]['include']?_[_0x9f74('0x19')](_0xb087b5[_0x9f74('0x14')]['include'],function(_0x3e65c9){return{'model':db[_0x3e65c9[_0x9f74('0x1a')]],'as':_0x3e65c9['as'],'attributes':_0x3e65c9[_0x9f74('0x17')],'include':_0x3e65c9[_0x9f74('0x18')]?_['map'](_0x3e65c9[_0x9f74('0x18')],function(_0x3e1274){return{'model':db[_0x3e1274['model']],'as':_0x3e1274['as'],'attributes':_0x3e1274[_0x9f74('0x17')],'include':_0x3e1274['include']?_[_0x9f74('0x19')](_0x3e1274[_0x9f74('0x18')],function(_0x8384dd){return{'model':db[_0x8384dd[_0x9f74('0x1a')]],'as':_0x8384dd['as'],'attributes':_0x8384dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f74('0xb')](function(_0x5b2565){logger[_0x9f74('0xc')]('ShowDeskAccount',_0xb087b5);logger[_0x9f74('0x1b')](_0x9f74('0x1e'),_0xb087b5,JSON['stringify'](_0x5b2565));_0x1fd0bd(_0x5b2565);})[_0x9f74('0x1d')](function(_0x3f4319){logger['error'](_0x9f74('0x1e'),_0x3f4319[_0x9f74('0x10')],_0xb087b5);_0x1e3fb2(_0xb42b9['error'](0x1f4,_0x3f4319['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4e5c8b6..93648e1 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(_0x50d5da,_0x3c9a6a){var _0x5cfacf=function(_0x415a6b){while(--_0x415a6b){_0x50d5da['push'](_0x50d5da['shift']());}};_0x5cfacf(++_0x3c9a6a);}(_0x34e8,0x12c));var _0x834e=function(_0x29c2a7,_0x298b2f){_0x29c2a7=_0x29c2a7-0x0;var _0x3f7dc3=_0x34e8[_0x29c2a7];return _0x3f7dc3;};'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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x4d085f,_0x3c7393){var _0x1ae582=function(_0x2fffce){while(--_0x2fffce){_0x4d085f['push'](_0x4d085f['shift']());}};_0x1ae582(++_0x3c7393);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',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/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 1aad02b..ae4939e 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 _0xc4ec=['STRING','sequelize','exports'];(function(_0x18be17,_0x3b0369){var _0x4950ba=function(_0x5bd6cf){while(--_0x5bd6cf){_0x18be17['push'](_0x18be17['shift']());}};_0x4950ba(++_0x3b0369);}(_0xc4ec,0x1cc));var _0xcc4e=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xc4ec[_0x2f5a22];return _0x326b70;};'use strict';var Sequelize=require(_0xcc4e('0x0'));module[_0xcc4e('0x1')]={'name':{'type':Sequelize[_0xcc4e('0x2')]},'description':{'type':Sequelize[_0xcc4e('0x2')]}}; \ No newline at end of file +var _0xffad=['exports','STRING'];(function(_0xda44d7,_0x5836b2){var _0x18cad9=function(_0x55d29f){while(--_0x55d29f){_0xda44d7['push'](_0xda44d7['shift']());}};_0x18cad9(++_0x5836b2);}(_0xffad,0x104));var _0xdffa=function(_0x17b29a,_0x331f99){_0x17b29a=_0x17b29a-0x0;var _0x2b0c69=_0xffad[_0x17b29a];return _0x2b0c69;};'use strict';var Sequelize=require('sequelize');module[_0xdffa('0x0')]={'name':{'type':Sequelize[_0xdffa('0x1')]},'description':{'type':Sequelize[_0xdffa('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ea3ff77..2535f51 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 _0xd86a=['crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','map','DeskConfiguration','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','destroy','getFields','findOne','hasOwnProperty','getSubjects','DeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x35c718,_0x33a696){var _0x5c3099=function(_0x2810cd){while(--_0x2810cd){_0x35c718['push'](_0x35c718['shift']());}};_0x5c3099(++_0x33a696);}(_0xd86a,0x98));var _0xad86=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0xd86a[_0xcda377];return _0x1c024f;};'use strict';var emlformat=require(_0xad86('0x0'));var rimraf=require(_0xad86('0x1'));var zipdir=require(_0xad86('0x2'));var jsonpatch=require(_0xad86('0x3'));var rp=require(_0xad86('0x4'));var moment=require(_0xad86('0x5'));var BPromise=require(_0xad86('0x6'));var Mustache=require(_0xad86('0x7'));var util=require(_0xad86('0x8'));var path=require(_0xad86('0x9'));var sox=require(_0xad86('0xa'));var csv=require(_0xad86('0xb'));var ejs=require(_0xad86('0xc'));var fs=require('fs');var fs_extra=require(_0xad86('0xd'));var _=require(_0xad86('0xe'));var squel=require(_0xad86('0xf'));var crypto=require(_0xad86('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xad86('0x11'));var toCsv=require(_0xad86('0xb'));var querystring=require('querystring');var Papa=require(_0xad86('0x12'));var Redis=require('ioredis');var authService=require(_0xad86('0x13'));var qs=require(_0xad86('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xad86('0x15'))(_0xad86('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xad86('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe27d,_0x1d2a4d){_0x1d2a4d=_0x1d2a4d||0xcc;return function(_0x8d2a5d){if(_0x8d2a5d){return _0x3fe27d[_0xad86('0x18')](_0x1d2a4d);}return _0x3fe27d['status'](_0x1d2a4d)[_0xad86('0x19')]();};}function respondWithResult(_0x1d1bd7,_0x329b52){_0x329b52=_0x329b52||0xc8;return function(_0x5d5728){if(_0x5d5728){return _0x1d1bd7[_0xad86('0x1a')](_0x329b52)[_0xad86('0x1b')](_0x5d5728);}};}function respondWithFilteredResult(_0x108935,_0x2607a){return function(_0x68fb7f){if(_0x68fb7f){var _0x1b17aa=typeof _0x2607a[_0xad86('0x1c')]===_0xad86('0x1d')&&typeof _0x2607a['limit']==='undefined';var _0x186be5=_0x68fb7f['count'];var _0x4f57f0=_0x1b17aa?0x0:_0x2607a[_0xad86('0x1c')];var _0xb4a6d=_0x1b17aa?_0x68fb7f[_0xad86('0x1e')]:_0x2607a['offset']+_0x2607a[_0xad86('0x1f')];var _0x51e4dc;if(_0xb4a6d>=_0x186be5){_0xb4a6d=_0x186be5;_0x51e4dc=0xc8;}else{_0x51e4dc=0xce;}_0x108935['status'](_0x51e4dc);return _0x108935[_0xad86('0x20')](_0xad86('0x21'),_0x4f57f0+'-'+_0xb4a6d+'/'+_0x186be5)[_0xad86('0x1b')](_0x68fb7f);}return null;};}function patchUpdates(_0x2250f7){return function(_0x4aeccf){try{jsonpatch[_0xad86('0x22')](_0x4aeccf,_0x2250f7,!![]);}catch(_0x597b85){return BPromise[_0xad86('0x23')](_0x597b85);}return _0x4aeccf['save']();};}function saveUpdates(_0x4bae5b,_0x3559f7){return function(_0x295f77){if(_0x295f77){return _0x295f77[_0xad86('0x24')](_0x4bae5b)[_0xad86('0x25')](function(_0x3ba1b1){return _0x3ba1b1;});}return null;};}function removeEntity(_0x4e793a,_0xef944d){return function(_0x9f5072){if(_0x9f5072){return _0x9f5072['destroy']()[_0xad86('0x25')](function(){_0x4e793a[_0xad86('0x1a')](0xcc)[_0xad86('0x19')]();});}};}function handleEntityNotFound(_0x303d64,_0x41f9cf){return function(_0x52f94d){if(!_0x52f94d){_0x303d64[_0xad86('0x18')](0x194);}return _0x52f94d;};}function handleError(_0x53045f,_0x120a4c){_0x120a4c=_0x120a4c||0x1f4;return function(_0x3a5dcd){logger[_0xad86('0x26')](_0x3a5dcd[_0xad86('0x27')]);if(_0x3a5dcd['name']){delete _0x3a5dcd['name'];}_0x53045f[_0xad86('0x1a')](_0x120a4c)['send'](_0x3a5dcd);};}exports['index']=function(_0x2571a6,_0x285d48){var _0x287a67={},_0x242094={},_0x22bdee={'count':0x0,'rows':[]};var _0x9422e0=_[_0xad86('0x28')](db[_0xad86('0x29')][_0xad86('0x2a')],function(_0x386eeb){return{'name':_0x386eeb['fieldName'],'type':_0x386eeb[_0xad86('0x2b')][_0xad86('0x2c')]};});_0x242094[_0xad86('0x2d')]=_[_0xad86('0x28')](_0x9422e0,_0xad86('0x2e'));_0x242094[_0xad86('0x2f')]=_['keys'](_0x2571a6['query']);_0x242094[_0xad86('0x30')]=_[_0xad86('0x31')](_0x242094['model'],_0x242094[_0xad86('0x2f')]);_0x287a67[_0xad86('0x32')]=_[_0xad86('0x31')](_0x242094[_0xad86('0x2d')],qs['fields'](_0x2571a6[_0xad86('0x2f')][_0xad86('0x33')]));_0x287a67[_0xad86('0x32')]=_0x287a67['attributes'][_0xad86('0x34')]?_0x287a67[_0xad86('0x32')]:_0x242094[_0xad86('0x2d')];if(!_0x2571a6[_0xad86('0x2f')]['hasOwnProperty'](_0xad86('0x35'))){_0x287a67[_0xad86('0x1f')]=qs[_0xad86('0x1f')](_0x2571a6[_0xad86('0x2f')][_0xad86('0x1f')]);_0x287a67[_0xad86('0x1c')]=qs[_0xad86('0x1c')](_0x2571a6[_0xad86('0x2f')][_0xad86('0x1c')]);}_0x287a67[_0xad86('0x36')]=qs[_0xad86('0x37')](_0x2571a6[_0xad86('0x2f')]['sort']);_0x287a67['where']=qs['filters'](_[_0xad86('0x38')](_0x2571a6[_0xad86('0x2f')],_0x242094[_0xad86('0x30')]),_0x9422e0);if(_0x2571a6[_0xad86('0x2f')][_0xad86('0x39')]){_0x287a67[_0xad86('0x3a')]=_[_0xad86('0x3b')](_0x287a67[_0xad86('0x3a')],{'$or':_[_0xad86('0x28')](_0x9422e0,function(_0x10c824){if(_0x10c824[_0xad86('0x2b')]!==_0xad86('0x3c')){var _0x16d091={};_0x16d091[_0x10c824[_0xad86('0x2e')]]={'$like':'%'+_0x2571a6[_0xad86('0x2f')][_0xad86('0x39')]+'%'};return _0x16d091;}})});}_0x287a67=_[_0xad86('0x3b')]({},_0x287a67,_0x2571a6[_0xad86('0x3d')]);var _0x536eed={'where':_0x287a67[_0xad86('0x3a')]};return db['DeskConfiguration'][_0xad86('0x1e')](_0x536eed)[_0xad86('0x25')](function(_0x1012d4){_0x22bdee[_0xad86('0x1e')]=_0x1012d4;if(_0x2571a6[_0xad86('0x2f')][_0xad86('0x3e')]){_0x287a67[_0xad86('0x3f')]=[{'all':!![]}];}return db[_0xad86('0x29')][_0xad86('0x40')](_0x287a67);})[_0xad86('0x25')](function(_0x15ff77){_0x22bdee[_0xad86('0x41')]=_0x15ff77;return _0x22bdee;})[_0xad86('0x25')](respondWithFilteredResult(_0x285d48,_0x287a67))[_0xad86('0x42')](handleError(_0x285d48,null));};exports[_0xad86('0x43')]=function(_0x97dfb7,_0x431626){var _0x165ba3={'raw':![],'where':{'id':_0x97dfb7['params']['id']}},_0x5dcfe3={};_0x5dcfe3['model']=_[_0xad86('0x44')](db[_0xad86('0x29')][_0xad86('0x2a')]);_0x5dcfe3[_0xad86('0x2f')]=_[_0xad86('0x44')](_0x97dfb7[_0xad86('0x2f')]);_0x5dcfe3[_0xad86('0x30')]=_[_0xad86('0x31')](_0x5dcfe3[_0xad86('0x2d')],_0x5dcfe3[_0xad86('0x2f')]);_0x165ba3[_0xad86('0x32')]=_[_0xad86('0x31')](_0x5dcfe3[_0xad86('0x2d')],qs['fields'](_0x97dfb7['query'][_0xad86('0x33')]));_0x165ba3['attributes']=_0x165ba3[_0xad86('0x32')][_0xad86('0x34')]?_0x165ba3[_0xad86('0x32')]:_0x5dcfe3[_0xad86('0x2d')];if(_0x97dfb7[_0xad86('0x2f')]['includeAll']){_0x165ba3[_0xad86('0x3f')]=[{'all':!![]}];}_0x165ba3=_[_0xad86('0x3b')]({},_0x165ba3,_0x97dfb7[_0xad86('0x3d')]);return db[_0xad86('0x29')][_0xad86('0x45')](_0x165ba3)[_0xad86('0x25')](handleEntityNotFound(_0x431626,null))[_0xad86('0x25')](respondWithResult(_0x431626,null))[_0xad86('0x42')](handleError(_0x431626,null));};exports[_0xad86('0x46')]=function(_0x47f0cb,_0x1190db){return db[_0xad86('0x29')]['create'](_0x47f0cb[_0xad86('0x47')],{})[_0xad86('0x25')](respondWithResult(_0x1190db,0xc9))[_0xad86('0x42')](handleError(_0x1190db,null));};exports[_0xad86('0x24')]=function(_0x43cee4,_0x3a5a34){if(_0x43cee4[_0xad86('0x47')]['id']){delete _0x43cee4[_0xad86('0x47')]['id'];}return db[_0xad86('0x29')][_0xad86('0x45')]({'where':{'id':_0x43cee4[_0xad86('0x48')]['id']}})[_0xad86('0x25')](handleEntityNotFound(_0x3a5a34,null))[_0xad86('0x25')](saveUpdates(_0x43cee4[_0xad86('0x47')],null))[_0xad86('0x25')](respondWithResult(_0x3a5a34,null))['catch'](handleError(_0x3a5a34,null));};exports[_0xad86('0x49')]=function(_0xfde7bf,_0x487596){return db['DeskConfiguration'][_0xad86('0x45')]({'where':{'id':_0xfde7bf[_0xad86('0x48')]['id']}})['then'](handleEntityNotFound(_0x487596,null))[_0xad86('0x25')](removeEntity(_0x487596,null))[_0xad86('0x42')](handleError(_0x487596,null));};exports[_0xad86('0x4a')]=function(_0x4c6666,_0x408a5f,_0x3bdb90){var _0x19e8f3={};var _0x49a241={};var _0x766841;var _0x52233d;return db[_0xad86('0x29')][_0xad86('0x4b')]({'where':{'id':_0x4c6666[_0xad86('0x48')]['id']}})['then'](handleEntityNotFound(_0x408a5f,null))[_0xad86('0x25')](function(_0x2d6511){if(_0x2d6511){_0x766841=_0x2d6511;_0x49a241[_0xad86('0x2d')]=_[_0xad86('0x44')](db['DeskField']['rawAttributes']);_0x49a241[_0xad86('0x2f')]=_[_0xad86('0x44')](_0x4c6666[_0xad86('0x2f')]);_0x49a241[_0xad86('0x30')]=_[_0xad86('0x31')](_0x49a241[_0xad86('0x2d')],_0x49a241[_0xad86('0x2f')]);_0x19e8f3[_0xad86('0x32')]=_['intersection'](_0x49a241[_0xad86('0x2d')],qs['fields'](_0x4c6666[_0xad86('0x2f')][_0xad86('0x33')]));_0x19e8f3[_0xad86('0x32')]=_0x19e8f3[_0xad86('0x32')][_0xad86('0x34')]?_0x19e8f3[_0xad86('0x32')]:_0x49a241[_0xad86('0x2d')];_0x19e8f3[_0xad86('0x36')]=qs[_0xad86('0x37')](_0x4c6666[_0xad86('0x2f')][_0xad86('0x37')]);_0x19e8f3[_0xad86('0x3a')]=qs[_0xad86('0x30')](_[_0xad86('0x38')](_0x4c6666['query'],_0x49a241['filters']));if(_0x4c6666[_0xad86('0x2f')][_0xad86('0x39')]){_0x19e8f3[_0xad86('0x3a')]=_[_0xad86('0x3b')](_0x19e8f3['where'],{'$or':_[_0xad86('0x28')](_0x19e8f3[_0xad86('0x32')],function(_0x4e1e9b){var _0x2278c5={};_0x2278c5[_0x4e1e9b]={'$like':'%'+_0x4c6666[_0xad86('0x2f')][_0xad86('0x39')]+'%'};return _0x2278c5;})});}_0x19e8f3=_['merge']({},_0x19e8f3,_0x4c6666[_0xad86('0x3d')]);return _0x766841['getFields'](_0x19e8f3);}})[_0xad86('0x25')](function(_0x311c80){if(_0x311c80){_0x52233d=_0x311c80['length'];if(!_0x4c6666[_0xad86('0x2f')][_0xad86('0x4c')]('nolimit')){_0x19e8f3[_0xad86('0x1f')]=qs[_0xad86('0x1f')](_0x4c6666[_0xad86('0x2f')][_0xad86('0x1f')]);_0x19e8f3['offset']=qs[_0xad86('0x1c')](_0x4c6666[_0xad86('0x2f')][_0xad86('0x1c')]);}return _0x766841[_0xad86('0x4a')](_0x19e8f3);}})[_0xad86('0x25')](function(_0x78243f){if(_0x78243f){return _0x78243f?{'count':_0x52233d,'rows':_0x78243f}:null;}})[_0xad86('0x25')](respondWithResult(_0x408a5f,null))[_0xad86('0x42')](handleError(_0x408a5f,null));};exports[_0xad86('0x4d')]=function(_0xe254d4,_0x3f403b,_0x1eb37e){var _0x3bf2ce={};var _0xfbb2a8={};var _0x5f3062;var _0x4633aa;return db['DeskConfiguration'][_0xad86('0x4b')]({'where':{'id':_0xe254d4['params']['id']}})[_0xad86('0x25')](handleEntityNotFound(_0x3f403b,null))['then'](function(_0x15b0b2){if(_0x15b0b2){_0x5f3062=_0x15b0b2;_0xfbb2a8[_0xad86('0x2d')]=_[_0xad86('0x44')](db[_0xad86('0x4e')][_0xad86('0x2a')]);_0xfbb2a8[_0xad86('0x2f')]=_['keys'](_0xe254d4[_0xad86('0x2f')]);_0xfbb2a8[_0xad86('0x30')]=_[_0xad86('0x31')](_0xfbb2a8[_0xad86('0x2d')],_0xfbb2a8[_0xad86('0x2f')]);_0x3bf2ce[_0xad86('0x32')]=_['intersection'](_0xfbb2a8[_0xad86('0x2d')],qs[_0xad86('0x33')](_0xe254d4[_0xad86('0x2f')][_0xad86('0x33')]));_0x3bf2ce[_0xad86('0x32')]=_0x3bf2ce[_0xad86('0x32')][_0xad86('0x34')]?_0x3bf2ce['attributes']:_0xfbb2a8[_0xad86('0x2d')];_0x3bf2ce[_0xad86('0x36')]=qs[_0xad86('0x37')](_0xe254d4[_0xad86('0x2f')][_0xad86('0x37')]);_0x3bf2ce[_0xad86('0x3a')]=qs[_0xad86('0x30')](_[_0xad86('0x38')](_0xe254d4[_0xad86('0x2f')],_0xfbb2a8[_0xad86('0x30')]));if(_0xe254d4[_0xad86('0x2f')][_0xad86('0x39')]){_0x3bf2ce[_0xad86('0x3a')]=_['merge'](_0x3bf2ce['where'],{'$or':_[_0xad86('0x28')](_0x3bf2ce['attributes'],function(_0x404ff2){var _0x38ebe0={};_0x38ebe0[_0x404ff2]={'$like':'%'+_0xe254d4[_0xad86('0x2f')][_0xad86('0x39')]+'%'};return _0x38ebe0;})});}_0x3bf2ce=_[_0xad86('0x3b')]({},_0x3bf2ce,_0xe254d4['options']);return _0x5f3062['getSubjects'](_0x3bf2ce);}})[_0xad86('0x25')](function(_0x5da610){if(_0x5da610){_0x4633aa=_0x5da610[_0xad86('0x34')];if(!_0xe254d4[_0xad86('0x2f')][_0xad86('0x4c')]('nolimit')){_0x3bf2ce['limit']=qs[_0xad86('0x1f')](_0xe254d4['query'][_0xad86('0x1f')]);_0x3bf2ce[_0xad86('0x1c')]=qs[_0xad86('0x1c')](_0xe254d4['query'][_0xad86('0x1c')]);}return _0x5f3062[_0xad86('0x4d')](_0x3bf2ce);}})[_0xad86('0x25')](function(_0x296e3d){if(_0x296e3d){return _0x296e3d?{'count':_0x4633aa,'rows':_0x296e3d}:null;}})['then'](respondWithResult(_0x3f403b,null))[_0xad86('0x42')](handleError(_0x3f403b,null));};exports['getDescriptions']=function(_0x3ccbd2,_0x3bebf9,_0x2c8349){var _0x272b69={};var _0x4d2c6a={};var _0x3ed1a1;var _0x585e9b;return db['DeskConfiguration'][_0xad86('0x4b')]({'where':{'id':_0x3ccbd2[_0xad86('0x48')]['id']}})['then'](handleEntityNotFound(_0x3bebf9,null))[_0xad86('0x25')](function(_0x57f527){if(_0x57f527){_0x3ed1a1=_0x57f527;_0x4d2c6a[_0xad86('0x2d')]=_[_0xad86('0x44')](db[_0xad86('0x4e')][_0xad86('0x2a')]);_0x4d2c6a[_0xad86('0x2f')]=_['keys'](_0x3ccbd2['query']);_0x4d2c6a[_0xad86('0x30')]=_['intersection'](_0x4d2c6a[_0xad86('0x2d')],_0x4d2c6a['query']);_0x272b69['attributes']=_[_0xad86('0x31')](_0x4d2c6a[_0xad86('0x2d')],qs[_0xad86('0x33')](_0x3ccbd2[_0xad86('0x2f')][_0xad86('0x33')]));_0x272b69[_0xad86('0x32')]=_0x272b69[_0xad86('0x32')][_0xad86('0x34')]?_0x272b69[_0xad86('0x32')]:_0x4d2c6a[_0xad86('0x2d')];_0x272b69[_0xad86('0x36')]=qs[_0xad86('0x37')](_0x3ccbd2[_0xad86('0x2f')][_0xad86('0x37')]);_0x272b69['where']=qs[_0xad86('0x30')](_['pick'](_0x3ccbd2['query'],_0x4d2c6a[_0xad86('0x30')]));if(_0x3ccbd2[_0xad86('0x2f')][_0xad86('0x39')]){_0x272b69[_0xad86('0x3a')]=_[_0xad86('0x3b')](_0x272b69[_0xad86('0x3a')],{'$or':_[_0xad86('0x28')](_0x272b69['attributes'],function(_0x3daa83){var _0x561b5c={};_0x561b5c[_0x3daa83]={'$like':'%'+_0x3ccbd2[_0xad86('0x2f')][_0xad86('0x39')]+'%'};return _0x561b5c;})});}_0x272b69=_[_0xad86('0x3b')]({},_0x272b69,_0x3ccbd2[_0xad86('0x3d')]);return _0x3ed1a1[_0xad86('0x4f')](_0x272b69);}})[_0xad86('0x25')](function(_0x163a53){if(_0x163a53){_0x585e9b=_0x163a53[_0xad86('0x34')];if(!_0x3ccbd2[_0xad86('0x2f')][_0xad86('0x4c')](_0xad86('0x35'))){_0x272b69[_0xad86('0x1f')]=qs[_0xad86('0x1f')](_0x3ccbd2[_0xad86('0x2f')][_0xad86('0x1f')]);_0x272b69[_0xad86('0x1c')]=qs['offset'](_0x3ccbd2[_0xad86('0x2f')]['offset']);}return _0x3ed1a1['getDescriptions'](_0x272b69);}})[_0xad86('0x25')](function(_0x2a834f){if(_0x2a834f){return _0x2a834f?{'count':_0x585e9b,'rows':_0x2a834f}:null;}})[_0xad86('0x25')](respondWithResult(_0x3bebf9,null))[_0xad86('0x42')](handleError(_0x3bebf9,null));};exports['getTags']=function(_0x1d2b17,_0x4869a2,_0x26e996){var _0x41fec9={};var _0x5f9b8d={};var _0x59c484;var _0xbc2508;return db[_0xad86('0x29')]['findOne']({'where':{'id':_0x1d2b17['params']['id']}})['then'](handleEntityNotFound(_0x4869a2,null))[_0xad86('0x25')](function(_0x339d38){if(_0x339d38){_0x59c484=_0x339d38;_0x5f9b8d[_0xad86('0x2d')]=_[_0xad86('0x44')](db[_0xad86('0x50')][_0xad86('0x2a')]);_0x5f9b8d[_0xad86('0x2f')]=_[_0xad86('0x44')](_0x1d2b17[_0xad86('0x2f')]);_0x5f9b8d['filters']=_[_0xad86('0x31')](_0x5f9b8d[_0xad86('0x2d')],_0x5f9b8d[_0xad86('0x2f')]);_0x41fec9[_0xad86('0x32')]=_[_0xad86('0x31')](_0x5f9b8d[_0xad86('0x2d')],qs['fields'](_0x1d2b17[_0xad86('0x2f')][_0xad86('0x33')]));_0x41fec9[_0xad86('0x32')]=_0x41fec9[_0xad86('0x32')][_0xad86('0x34')]?_0x41fec9[_0xad86('0x32')]:_0x5f9b8d[_0xad86('0x2d')];_0x41fec9[_0xad86('0x36')]=qs[_0xad86('0x37')](_0x1d2b17[_0xad86('0x2f')][_0xad86('0x37')]);_0x41fec9['where']=qs[_0xad86('0x30')](_[_0xad86('0x38')](_0x1d2b17[_0xad86('0x2f')],_0x5f9b8d[_0xad86('0x30')]));if(_0x1d2b17[_0xad86('0x2f')][_0xad86('0x39')]){_0x41fec9[_0xad86('0x3a')]=_['merge'](_0x41fec9['where'],{'$or':_['map'](_0x41fec9[_0xad86('0x32')],function(_0x19e4c8){var _0x8d2a5c={};_0x8d2a5c[_0x19e4c8]={'$like':'%'+_0x1d2b17[_0xad86('0x2f')][_0xad86('0x39')]+'%'};return _0x8d2a5c;})});}_0x41fec9=_[_0xad86('0x3b')]({},_0x41fec9,_0x1d2b17[_0xad86('0x3d')]);return _0x59c484[_0xad86('0x51')](_0x41fec9);}})[_0xad86('0x25')](function(_0x3199ea){if(_0x3199ea){_0xbc2508=_0x3199ea['length'];if(!_0x1d2b17[_0xad86('0x2f')][_0xad86('0x4c')](_0xad86('0x35'))){_0x41fec9['limit']=qs[_0xad86('0x1f')](_0x1d2b17[_0xad86('0x2f')][_0xad86('0x1f')]);_0x41fec9[_0xad86('0x1c')]=qs['offset'](_0x1d2b17[_0xad86('0x2f')][_0xad86('0x1c')]);}return _0x59c484[_0xad86('0x51')](_0x41fec9);}})[_0xad86('0x25')](function(_0x3a6696){if(_0x3a6696){return _0x3a6696?{'count':_0xbc2508,'rows':_0x3a6696}:null;}})[_0xad86('0x25')](respondWithResult(_0x4869a2,null))[_0xad86('0x42')](handleError(_0x4869a2,null));};exports[_0xad86('0x52')]=function(_0x5b69ed,_0x3dcb59,_0x162c2a){if(_0x5b69ed['body']['id']){delete _0x5b69ed[_0xad86('0x47')]['id'];}return db[_0xad86('0x29')][_0xad86('0x4b')]({'where':{'id':_0x5b69ed['params']['id']}})[_0xad86('0x25')](handleEntityNotFound(_0x3dcb59,null))['then'](function(_0x5a760d){if(_0x5a760d){return _0x5a760d[_0xad86('0x52')](_0x5b69ed['body'][_0xad86('0x53')]||[]);}return null;})[_0xad86('0x25')](respondWithResult(_0x3dcb59,null))[_0xad86('0x42')](handleError(_0x3dcb59,null));}; \ No newline at end of file +var _0x3c52=['index','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','show','include','options','DeskConfiguration','find','create','body','params','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','end','error','stack','name'];(function(_0x4d821c,_0x22bd0e){var _0x15dd5b=function(_0x20e8f2){while(--_0x20e8f2){_0x4d821c['push'](_0x4d821c['shift']());}};_0x15dd5b(++_0x22bd0e);}(_0x3c52,0xd2));var _0x23c5=function(_0x461685,_0x154c7b){_0x461685=_0x461685-0x0;var _0x441392=_0x3c52[_0x461685];return _0x441392;};'use strict';var emlformat=require(_0x23c5('0x0'));var rimraf=require(_0x23c5('0x1'));var zipdir=require(_0x23c5('0x2'));var jsonpatch=require(_0x23c5('0x3'));var rp=require('request-promise');var moment=require(_0x23c5('0x4'));var BPromise=require(_0x23c5('0x5'));var Mustache=require(_0x23c5('0x6'));var util=require('util');var path=require(_0x23c5('0x7'));var sox=require('sox');var csv=require(_0x23c5('0x8'));var ejs=require(_0x23c5('0x9'));var fs=require('fs');var fs_extra=require(_0x23c5('0xa'));var _=require(_0x23c5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x23c5('0xc'));var deskjs=require(_0x23c5('0xd'));var toCsv=require(_0x23c5('0x8'));var querystring=require('querystring');var Papa=require(_0x23c5('0xe'));var Redis=require(_0x23c5('0xf'));var authService=require(_0x23c5('0x10'));var qs=require(_0x23c5('0x11'));var as=require(_0x23c5('0x12'));var hardwareService=require(_0x23c5('0x13'));var logger=require(_0x23c5('0x14'))(_0x23c5('0x15'));var utils=require(_0x23c5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x23c5('0x17'));var db=require(_0x23c5('0x18'))['db'];function respondWithStatusCode(_0x4939e8,_0x18f73a){_0x18f73a=_0x18f73a||0xcc;return function(_0x4cba11){if(_0x4cba11){return _0x4939e8[_0x23c5('0x19')](_0x18f73a);}return _0x4939e8[_0x23c5('0x1a')](_0x18f73a)['end']();};}function respondWithResult(_0x388e34,_0x1b8d50){_0x1b8d50=_0x1b8d50||0xc8;return function(_0x5ce82e){if(_0x5ce82e){return _0x388e34[_0x23c5('0x1a')](_0x1b8d50)[_0x23c5('0x1b')](_0x5ce82e);}};}function respondWithFilteredResult(_0x3a896f,_0x114f54){return function(_0x3bacf2){if(_0x3bacf2){var _0x273bfb=typeof _0x114f54[_0x23c5('0x1c')]===_0x23c5('0x1d')&&typeof _0x114f54[_0x23c5('0x1e')]===_0x23c5('0x1d');var _0x1c1d2c=_0x3bacf2[_0x23c5('0x1f')];var _0x244bf1=_0x273bfb?0x0:_0x114f54[_0x23c5('0x1c')];var _0xc9a8f3=_0x273bfb?_0x3bacf2[_0x23c5('0x1f')]:_0x114f54[_0x23c5('0x1c')]+_0x114f54[_0x23c5('0x1e')];var _0x363782;if(_0xc9a8f3>=_0x1c1d2c){_0xc9a8f3=_0x1c1d2c;_0x363782=0xc8;}else{_0x363782=0xce;}_0x3a896f[_0x23c5('0x1a')](_0x363782);return _0x3a896f[_0x23c5('0x20')](_0x23c5('0x21'),_0x244bf1+'-'+_0xc9a8f3+'/'+_0x1c1d2c)[_0x23c5('0x1b')](_0x3bacf2);}return null;};}function patchUpdates(_0x4eae04){return function(_0x4b9b36){try{jsonpatch['apply'](_0x4b9b36,_0x4eae04,!![]);}catch(_0x254459){return BPromise[_0x23c5('0x22')](_0x254459);}return _0x4b9b36['save']();};}function saveUpdates(_0x5b92f4,_0x4f5f2b){return function(_0x3c3dfc){if(_0x3c3dfc){return _0x3c3dfc[_0x23c5('0x23')](_0x5b92f4)['then'](function(_0x39758d){return _0x39758d;});}return null;};}function removeEntity(_0x29facc,_0x16ebdc){return function(_0xd56817){if(_0xd56817){return _0xd56817[_0x23c5('0x24')]()[_0x23c5('0x25')](function(){_0x29facc['status'](0xcc)[_0x23c5('0x26')]();});}};}function handleEntityNotFound(_0x23c06f,_0x50f13c){return function(_0x4f0a0e){if(!_0x4f0a0e){_0x23c06f[_0x23c5('0x19')](0x194);}return _0x4f0a0e;};}function handleError(_0x29f72a,_0x1967aa){_0x1967aa=_0x1967aa||0x1f4;return function(_0x1e56e2){logger[_0x23c5('0x27')](_0x1e56e2[_0x23c5('0x28')]);if(_0x1e56e2[_0x23c5('0x29')]){delete _0x1e56e2[_0x23c5('0x29')];}_0x29f72a[_0x23c5('0x1a')](_0x1967aa)['send'](_0x1e56e2);};}exports[_0x23c5('0x2a')]=function(_0xe2e5b0,_0x35a246){var _0x22b1fc={},_0x92a5ef={},_0x297d79={'count':0x0,'rows':[]};var _0xa6eafa=_['map'](db['DeskConfiguration'][_0x23c5('0x2b')],function(_0x20b1e4){return{'name':_0x20b1e4[_0x23c5('0x2c')],'type':_0x20b1e4[_0x23c5('0x2d')]['key']};});_0x92a5ef['model']=_[_0x23c5('0x2e')](_0xa6eafa,_0x23c5('0x29'));_0x92a5ef['query']=_[_0x23c5('0x2f')](_0xe2e5b0[_0x23c5('0x30')]);_0x92a5ef[_0x23c5('0x31')]=_[_0x23c5('0x32')](_0x92a5ef[_0x23c5('0x33')],_0x92a5ef[_0x23c5('0x30')]);_0x22b1fc[_0x23c5('0x34')]=_['intersection'](_0x92a5ef[_0x23c5('0x33')],qs[_0x23c5('0x35')](_0xe2e5b0[_0x23c5('0x30')]['fields']));_0x22b1fc[_0x23c5('0x34')]=_0x22b1fc['attributes'][_0x23c5('0x36')]?_0x22b1fc[_0x23c5('0x34')]:_0x92a5ef[_0x23c5('0x33')];if(!_0xe2e5b0[_0x23c5('0x30')][_0x23c5('0x37')](_0x23c5('0x38'))){_0x22b1fc[_0x23c5('0x1e')]=qs[_0x23c5('0x1e')](_0xe2e5b0['query'][_0x23c5('0x1e')]);_0x22b1fc[_0x23c5('0x1c')]=qs[_0x23c5('0x1c')](_0xe2e5b0['query']['offset']);}_0x22b1fc[_0x23c5('0x39')]=qs[_0x23c5('0x3a')](_0xe2e5b0[_0x23c5('0x30')][_0x23c5('0x3a')]);_0x22b1fc[_0x23c5('0x3b')]=qs[_0x23c5('0x31')](_[_0x23c5('0x3c')](_0xe2e5b0['query'],_0x92a5ef[_0x23c5('0x31')]),_0xa6eafa);if(_0xe2e5b0[_0x23c5('0x30')]['filter']){_0x22b1fc[_0x23c5('0x3b')]=_[_0x23c5('0x3d')](_0x22b1fc[_0x23c5('0x3b')],{'$or':_['map'](_0xa6eafa,function(_0x123200){if(_0x123200[_0x23c5('0x2d')]!==_0x23c5('0x3e')){var _0x273177={};_0x273177[_0x123200[_0x23c5('0x29')]]={'$like':'%'+_0xe2e5b0['query'][_0x23c5('0x3f')]+'%'};return _0x273177;}})});}_0x22b1fc=_[_0x23c5('0x3d')]({},_0x22b1fc,_0xe2e5b0['options']);var _0x64bfc7={'where':_0x22b1fc[_0x23c5('0x3b')]};return db['DeskConfiguration'][_0x23c5('0x1f')](_0x64bfc7)[_0x23c5('0x25')](function(_0x178d39){_0x297d79[_0x23c5('0x1f')]=_0x178d39;if(_0xe2e5b0[_0x23c5('0x30')][_0x23c5('0x40')]){_0x22b1fc['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x23c5('0x41')](_0x22b1fc);})['then'](function(_0x475a96){_0x297d79['rows']=_0x475a96;return _0x297d79;})[_0x23c5('0x25')](respondWithFilteredResult(_0x35a246,_0x22b1fc))[_0x23c5('0x42')](handleError(_0x35a246,null));};exports[_0x23c5('0x43')]=function(_0x23411e,_0x2c8b1b){var _0x17fb12={'raw':![],'where':{'id':_0x23411e['params']['id']}},_0x3c98ec={};_0x3c98ec[_0x23c5('0x33')]=_[_0x23c5('0x2f')](db['DeskConfiguration'][_0x23c5('0x2b')]);_0x3c98ec[_0x23c5('0x30')]=_[_0x23c5('0x2f')](_0x23411e[_0x23c5('0x30')]);_0x3c98ec[_0x23c5('0x31')]=_[_0x23c5('0x32')](_0x3c98ec[_0x23c5('0x33')],_0x3c98ec[_0x23c5('0x30')]);_0x17fb12['attributes']=_[_0x23c5('0x32')](_0x3c98ec[_0x23c5('0x33')],qs[_0x23c5('0x35')](_0x23411e[_0x23c5('0x30')]['fields']));_0x17fb12['attributes']=_0x17fb12['attributes']['length']?_0x17fb12['attributes']:_0x3c98ec[_0x23c5('0x33')];if(_0x23411e[_0x23c5('0x30')][_0x23c5('0x40')]){_0x17fb12[_0x23c5('0x44')]=[{'all':!![]}];}_0x17fb12=_[_0x23c5('0x3d')]({},_0x17fb12,_0x23411e[_0x23c5('0x45')]);return db[_0x23c5('0x46')][_0x23c5('0x47')](_0x17fb12)[_0x23c5('0x25')](handleEntityNotFound(_0x2c8b1b,null))[_0x23c5('0x25')](respondWithResult(_0x2c8b1b,null))['catch'](handleError(_0x2c8b1b,null));};exports['create']=function(_0x11a623,_0x2a0255){return db[_0x23c5('0x46')][_0x23c5('0x48')](_0x11a623[_0x23c5('0x49')],{})[_0x23c5('0x25')](respondWithResult(_0x2a0255,0xc9))[_0x23c5('0x42')](handleError(_0x2a0255,null));};exports[_0x23c5('0x23')]=function(_0x577184,_0x1f48b4){if(_0x577184[_0x23c5('0x49')]['id']){delete _0x577184[_0x23c5('0x49')]['id'];}return db[_0x23c5('0x46')]['find']({'where':{'id':_0x577184['params']['id']}})[_0x23c5('0x25')](handleEntityNotFound(_0x1f48b4,null))[_0x23c5('0x25')](saveUpdates(_0x577184[_0x23c5('0x49')],null))['then'](respondWithResult(_0x1f48b4,null))[_0x23c5('0x42')](handleError(_0x1f48b4,null));};exports[_0x23c5('0x24')]=function(_0xddcad7,_0x4098e1){return db['DeskConfiguration'][_0x23c5('0x47')]({'where':{'id':_0xddcad7[_0x23c5('0x4a')]['id']}})[_0x23c5('0x25')](handleEntityNotFound(_0x4098e1,null))[_0x23c5('0x25')](removeEntity(_0x4098e1,null))[_0x23c5('0x42')](handleError(_0x4098e1,null));};exports[_0x23c5('0x4b')]=function(_0x4a1851,_0x2bc08f,_0x537589){var _0xdef26={};var _0x347c9c={};var _0x20290d;var _0x2cee15;return db[_0x23c5('0x46')]['findOne']({'where':{'id':_0x4a1851[_0x23c5('0x4a')]['id']}})[_0x23c5('0x25')](handleEntityNotFound(_0x2bc08f,null))['then'](function(_0x5b7f59){if(_0x5b7f59){_0x20290d=_0x5b7f59;_0x347c9c[_0x23c5('0x33')]=_[_0x23c5('0x2f')](db[_0x23c5('0x4c')][_0x23c5('0x2b')]);_0x347c9c[_0x23c5('0x30')]=_[_0x23c5('0x2f')](_0x4a1851[_0x23c5('0x30')]);_0x347c9c[_0x23c5('0x31')]=_['intersection'](_0x347c9c[_0x23c5('0x33')],_0x347c9c[_0x23c5('0x30')]);_0xdef26[_0x23c5('0x34')]=_[_0x23c5('0x32')](_0x347c9c[_0x23c5('0x33')],qs['fields'](_0x4a1851[_0x23c5('0x30')][_0x23c5('0x35')]));_0xdef26['attributes']=_0xdef26[_0x23c5('0x34')][_0x23c5('0x36')]?_0xdef26[_0x23c5('0x34')]:_0x347c9c[_0x23c5('0x33')];_0xdef26[_0x23c5('0x39')]=qs[_0x23c5('0x3a')](_0x4a1851[_0x23c5('0x30')][_0x23c5('0x3a')]);_0xdef26[_0x23c5('0x3b')]=qs[_0x23c5('0x31')](_[_0x23c5('0x3c')](_0x4a1851[_0x23c5('0x30')],_0x347c9c[_0x23c5('0x31')]));if(_0x4a1851[_0x23c5('0x30')][_0x23c5('0x3f')]){_0xdef26['where']=_[_0x23c5('0x3d')](_0xdef26['where'],{'$or':_[_0x23c5('0x2e')](_0xdef26['attributes'],function(_0x1fac20){var _0x3d5380={};_0x3d5380[_0x1fac20]={'$like':'%'+_0x4a1851[_0x23c5('0x30')][_0x23c5('0x3f')]+'%'};return _0x3d5380;})});}_0xdef26=_[_0x23c5('0x3d')]({},_0xdef26,_0x4a1851[_0x23c5('0x45')]);return _0x20290d[_0x23c5('0x4b')](_0xdef26);}})[_0x23c5('0x25')](function(_0x1756c5){if(_0x1756c5){_0x2cee15=_0x1756c5[_0x23c5('0x36')];if(!_0x4a1851['query'][_0x23c5('0x37')](_0x23c5('0x38'))){_0xdef26['limit']=qs[_0x23c5('0x1e')](_0x4a1851[_0x23c5('0x30')][_0x23c5('0x1e')]);_0xdef26[_0x23c5('0x1c')]=qs[_0x23c5('0x1c')](_0x4a1851['query'][_0x23c5('0x1c')]);}return _0x20290d['getFields'](_0xdef26);}})[_0x23c5('0x25')](function(_0x3f015f){if(_0x3f015f){return _0x3f015f?{'count':_0x2cee15,'rows':_0x3f015f}:null;}})[_0x23c5('0x25')](respondWithResult(_0x2bc08f,null))['catch'](handleError(_0x2bc08f,null));};exports[_0x23c5('0x4d')]=function(_0x3e23d8,_0x3e1f73,_0x2a0382){var _0x467aa3={};var _0xaae51e={};var _0x1b3e7a;var _0x145824;return db[_0x23c5('0x46')][_0x23c5('0x4e')]({'where':{'id':_0x3e23d8[_0x23c5('0x4a')]['id']}})[_0x23c5('0x25')](handleEntityNotFound(_0x3e1f73,null))[_0x23c5('0x25')](function(_0x177669){if(_0x177669){_0x1b3e7a=_0x177669;_0xaae51e[_0x23c5('0x33')]=_['keys'](db['DeskField'][_0x23c5('0x2b')]);_0xaae51e['query']=_[_0x23c5('0x2f')](_0x3e23d8[_0x23c5('0x30')]);_0xaae51e[_0x23c5('0x31')]=_[_0x23c5('0x32')](_0xaae51e[_0x23c5('0x33')],_0xaae51e['query']);_0x467aa3[_0x23c5('0x34')]=_[_0x23c5('0x32')](_0xaae51e['model'],qs['fields'](_0x3e23d8[_0x23c5('0x30')][_0x23c5('0x35')]));_0x467aa3['attributes']=_0x467aa3['attributes']['length']?_0x467aa3[_0x23c5('0x34')]:_0xaae51e[_0x23c5('0x33')];_0x467aa3[_0x23c5('0x39')]=qs[_0x23c5('0x3a')](_0x3e23d8[_0x23c5('0x30')][_0x23c5('0x3a')]);_0x467aa3[_0x23c5('0x3b')]=qs[_0x23c5('0x31')](_[_0x23c5('0x3c')](_0x3e23d8[_0x23c5('0x30')],_0xaae51e['filters']));if(_0x3e23d8[_0x23c5('0x30')][_0x23c5('0x3f')]){_0x467aa3[_0x23c5('0x3b')]=_[_0x23c5('0x3d')](_0x467aa3[_0x23c5('0x3b')],{'$or':_[_0x23c5('0x2e')](_0x467aa3[_0x23c5('0x34')],function(_0x17a42a){var _0x1b85ab={};_0x1b85ab[_0x17a42a]={'$like':'%'+_0x3e23d8['query'][_0x23c5('0x3f')]+'%'};return _0x1b85ab;})});}_0x467aa3=_[_0x23c5('0x3d')]({},_0x467aa3,_0x3e23d8[_0x23c5('0x45')]);return _0x1b3e7a['getSubjects'](_0x467aa3);}})['then'](function(_0xc63c80){if(_0xc63c80){_0x145824=_0xc63c80[_0x23c5('0x36')];if(!_0x3e23d8['query'][_0x23c5('0x37')](_0x23c5('0x38'))){_0x467aa3[_0x23c5('0x1e')]=qs[_0x23c5('0x1e')](_0x3e23d8[_0x23c5('0x30')][_0x23c5('0x1e')]);_0x467aa3['offset']=qs['offset'](_0x3e23d8[_0x23c5('0x30')][_0x23c5('0x1c')]);}return _0x1b3e7a[_0x23c5('0x4d')](_0x467aa3);}})[_0x23c5('0x25')](function(_0x2e8635){if(_0x2e8635){return _0x2e8635?{'count':_0x145824,'rows':_0x2e8635}:null;}})['then'](respondWithResult(_0x3e1f73,null))[_0x23c5('0x42')](handleError(_0x3e1f73,null));};exports['getDescriptions']=function(_0x25e519,_0x5ee048,_0x3eae85){var _0x4fabb3={};var _0xa6b957={};var _0x7f32a8;var _0x16ea9c;return db['DeskConfiguration'][_0x23c5('0x4e')]({'where':{'id':_0x25e519[_0x23c5('0x4a')]['id']}})[_0x23c5('0x25')](handleEntityNotFound(_0x5ee048,null))[_0x23c5('0x25')](function(_0x4955b2){if(_0x4955b2){_0x7f32a8=_0x4955b2;_0xa6b957[_0x23c5('0x33')]=_[_0x23c5('0x2f')](db[_0x23c5('0x4c')][_0x23c5('0x2b')]);_0xa6b957[_0x23c5('0x30')]=_[_0x23c5('0x2f')](_0x25e519[_0x23c5('0x30')]);_0xa6b957[_0x23c5('0x31')]=_[_0x23c5('0x32')](_0xa6b957['model'],_0xa6b957[_0x23c5('0x30')]);_0x4fabb3['attributes']=_[_0x23c5('0x32')](_0xa6b957['model'],qs[_0x23c5('0x35')](_0x25e519['query'][_0x23c5('0x35')]));_0x4fabb3[_0x23c5('0x34')]=_0x4fabb3[_0x23c5('0x34')][_0x23c5('0x36')]?_0x4fabb3['attributes']:_0xa6b957[_0x23c5('0x33')];_0x4fabb3['order']=qs[_0x23c5('0x3a')](_0x25e519[_0x23c5('0x30')][_0x23c5('0x3a')]);_0x4fabb3[_0x23c5('0x3b')]=qs['filters'](_[_0x23c5('0x3c')](_0x25e519[_0x23c5('0x30')],_0xa6b957[_0x23c5('0x31')]));if(_0x25e519['query'][_0x23c5('0x3f')]){_0x4fabb3[_0x23c5('0x3b')]=_[_0x23c5('0x3d')](_0x4fabb3['where'],{'$or':_[_0x23c5('0x2e')](_0x4fabb3['attributes'],function(_0x807dea){var _0x558a35={};_0x558a35[_0x807dea]={'$like':'%'+_0x25e519[_0x23c5('0x30')][_0x23c5('0x3f')]+'%'};return _0x558a35;})});}_0x4fabb3=_[_0x23c5('0x3d')]({},_0x4fabb3,_0x25e519[_0x23c5('0x45')]);return _0x7f32a8[_0x23c5('0x4f')](_0x4fabb3);}})[_0x23c5('0x25')](function(_0x216612){if(_0x216612){_0x16ea9c=_0x216612[_0x23c5('0x36')];if(!_0x25e519[_0x23c5('0x30')][_0x23c5('0x37')](_0x23c5('0x38'))){_0x4fabb3['limit']=qs[_0x23c5('0x1e')](_0x25e519['query']['limit']);_0x4fabb3[_0x23c5('0x1c')]=qs[_0x23c5('0x1c')](_0x25e519[_0x23c5('0x30')][_0x23c5('0x1c')]);}return _0x7f32a8[_0x23c5('0x4f')](_0x4fabb3);}})[_0x23c5('0x25')](function(_0x143f49){if(_0x143f49){return _0x143f49?{'count':_0x16ea9c,'rows':_0x143f49}:null;}})['then'](respondWithResult(_0x5ee048,null))[_0x23c5('0x42')](handleError(_0x5ee048,null));};exports[_0x23c5('0x50')]=function(_0x55b144,_0x37e707,_0x52227f){var _0x34d41e={};var _0x32e3bb={};var _0x3dab68;var _0x559dd9;return db['DeskConfiguration'][_0x23c5('0x4e')]({'where':{'id':_0x55b144['params']['id']}})[_0x23c5('0x25')](handleEntityNotFound(_0x37e707,null))['then'](function(_0xcd81a){if(_0xcd81a){_0x3dab68=_0xcd81a;_0x32e3bb[_0x23c5('0x33')]=_[_0x23c5('0x2f')](db[_0x23c5('0x51')][_0x23c5('0x2b')]);_0x32e3bb[_0x23c5('0x30')]=_[_0x23c5('0x2f')](_0x55b144[_0x23c5('0x30')]);_0x32e3bb[_0x23c5('0x31')]=_[_0x23c5('0x32')](_0x32e3bb['model'],_0x32e3bb[_0x23c5('0x30')]);_0x34d41e[_0x23c5('0x34')]=_[_0x23c5('0x32')](_0x32e3bb['model'],qs[_0x23c5('0x35')](_0x55b144[_0x23c5('0x30')][_0x23c5('0x35')]));_0x34d41e[_0x23c5('0x34')]=_0x34d41e[_0x23c5('0x34')][_0x23c5('0x36')]?_0x34d41e[_0x23c5('0x34')]:_0x32e3bb[_0x23c5('0x33')];_0x34d41e['order']=qs[_0x23c5('0x3a')](_0x55b144[_0x23c5('0x30')][_0x23c5('0x3a')]);_0x34d41e[_0x23c5('0x3b')]=qs[_0x23c5('0x31')](_['pick'](_0x55b144[_0x23c5('0x30')],_0x32e3bb[_0x23c5('0x31')]));if(_0x55b144['query'][_0x23c5('0x3f')]){_0x34d41e['where']=_[_0x23c5('0x3d')](_0x34d41e[_0x23c5('0x3b')],{'$or':_[_0x23c5('0x2e')](_0x34d41e[_0x23c5('0x34')],function(_0x19908b){var _0x121f7f={};_0x121f7f[_0x19908b]={'$like':'%'+_0x55b144[_0x23c5('0x30')][_0x23c5('0x3f')]+'%'};return _0x121f7f;})});}_0x34d41e=_[_0x23c5('0x3d')]({},_0x34d41e,_0x55b144[_0x23c5('0x45')]);return _0x3dab68['getTags'](_0x34d41e);}})['then'](function(_0x3fa13e){if(_0x3fa13e){_0x559dd9=_0x3fa13e[_0x23c5('0x36')];if(!_0x55b144['query']['hasOwnProperty'](_0x23c5('0x38'))){_0x34d41e['limit']=qs[_0x23c5('0x1e')](_0x55b144['query'][_0x23c5('0x1e')]);_0x34d41e[_0x23c5('0x1c')]=qs['offset'](_0x55b144['query'][_0x23c5('0x1c')]);}return _0x3dab68[_0x23c5('0x50')](_0x34d41e);}})[_0x23c5('0x25')](function(_0x4f2509){if(_0x4f2509){return _0x4f2509?{'count':_0x559dd9,'rows':_0x4f2509}:null;}})[_0x23c5('0x25')](respondWithResult(_0x37e707,null))[_0x23c5('0x42')](handleError(_0x37e707,null));};exports['setTags']=function(_0x4aa388,_0x1c3a7a,_0x496163){if(_0x4aa388[_0x23c5('0x49')]['id']){delete _0x4aa388[_0x23c5('0x49')]['id'];}return db[_0x23c5('0x46')][_0x23c5('0x4e')]({'where':{'id':_0x4aa388[_0x23c5('0x4a')]['id']}})[_0x23c5('0x25')](handleEntityNotFound(_0x1c3a7a,null))[_0x23c5('0x25')](function(_0x543d9d){if(_0x543d9d){return _0x543d9d[_0x23c5('0x52')](_0x4aa388[_0x23c5('0x49')][_0x23c5('0x53')]||[]);}return null;})[_0x23c5('0x25')](respondWithResult(_0x1c3a7a,null))[_0x23c5('0x42')](handleError(_0x1c3a7a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index d223db9..0714fbe 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 _0x699a=['../../config/logger','api','bluebird','request-promise','path','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x603217,_0x308d49){var _0x373957=function(_0x431de6){while(--_0x431de6){_0x603217['push'](_0x603217['shift']());}};_0x373957(++_0x308d49);}(_0x699a,0x12a));var _0xa699=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x699a[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0xa699('0x0'));var util=require(_0xa699('0x1'));var logger=require(_0xa699('0x2'))(_0xa699('0x3'));var moment=require('moment');var BPromise=require(_0xa699('0x4'));var rp=require(_0xa699('0x5'));var fs=require('fs');var path=require(_0xa699('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa699('0x7'));module[_0xa699('0x8')]=function(_0x5e4564,_0x17e8e6){return _0x5e4564[_0xa699('0x9')](_0xa699('0xa'),attributes,{'tableName':_0xa699('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c09=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','lodash','../../config/logger'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x1c09,0x111));var _0x91c0=function(_0x505a0f,_0x8c4a1e){_0x505a0f=_0x505a0f-0x0;var _0x25f41b=_0x1c09[_0x505a0f];return _0x25f41b;};'use strict';var _=require(_0x91c0('0x0'));var util=require('util');var logger=require(_0x91c0('0x1'))(_0x91c0('0x2'));var moment=require(_0x91c0('0x3'));var BPromise=require(_0x91c0('0x4'));var rp=require(_0x91c0('0x5'));var fs=require('fs');var path=require(_0x91c0('0x6'));var rimraf=require(_0x91c0('0x7'));var config=require(_0x91c0('0x8'));var attributes=require(_0x91c0('0x9'));module['exports']=function(_0x428d8b,_0x563ae6){return _0x428d8b[_0x91c0('0xa')]('DeskConfiguration',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 fb863c2..b2b1171 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 _0x02fe=['error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2488c7,_0x21d448){var _0x3f811f=function(_0x30d73b){while(--_0x30d73b){_0x2488c7['push'](_0x2488c7['shift']());}};_0x3f811f(++_0x21d448);}(_0x02fe,0x1b8));var _0xe02f=function(_0x14f945,_0x56671f){_0x14f945=_0x14f945-0x0;var _0x154dd5=_0x02fe[_0x14f945];return _0x154dd5;};'use strict';var _=require('lodash');var util=require(_0xe02f('0x0'));var moment=require(_0xe02f('0x1'));var BPromise=require(_0xe02f('0x2'));var rs=require(_0xe02f('0x3'));var fs=require('fs');var Redis=require(_0xe02f('0x4'));var db=require(_0xe02f('0x5'))['db'];var utils=require(_0xe02f('0x6'));var logger=require(_0xe02f('0x7'))(_0xe02f('0x8'));var config=require(_0xe02f('0x9'));var jayson=require(_0xe02f('0xa'));var client=jayson[_0xe02f('0xb')][_0xe02f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b1150,_0x1106a4,_0x45f434){return new BPromise(function(_0x485ea1,_0x24fb5c){return client['request'](_0x3b1150,_0x45f434)[_0xe02f('0xd')](function(_0xe28b82){logger[_0xe02f('0xe')](_0xe02f('0xf'),_0x1106a4,'request\x20sent');logger[_0xe02f('0x10')](_0xe02f('0x11'),_0x1106a4,_0xe02f('0x12'),JSON[_0xe02f('0x13')](_0xe28b82));if(_0xe28b82[_0xe02f('0x14')]){if(_0xe28b82[_0xe02f('0x14')]['code']===0x1f4){logger[_0xe02f('0x14')](_0xe02f('0xf'),_0x1106a4,_0xe28b82[_0xe02f('0x14')][_0xe02f('0x15')]);return _0x24fb5c(_0xe28b82[_0xe02f('0x14')]['message']);}logger['error'](_0xe02f('0xf'),_0x1106a4,_0xe28b82[_0xe02f('0x14')][_0xe02f('0x15')]);return _0x485ea1(_0xe28b82['error']['message']);}else{logger[_0xe02f('0xe')](_0xe02f('0xf'),_0x1106a4,'request\x20sent');_0x485ea1(_0xe28b82['result']['message']);}})[_0xe02f('0x16')](function(_0x20d376){logger[_0xe02f('0x14')](_0xe02f('0xf'),_0x1106a4,_0x20d376);_0x24fb5c(_0x20d376);});});} \ No newline at end of file +var _0x6629=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x4f8c61,_0x5bab21){var _0x503e65=function(_0x7c1c6d){while(--_0x7c1c6d){_0x4f8c61['push'](_0x4f8c61['shift']());}};_0x503e65(++_0x5bab21);}(_0x6629,0x1c2));var _0x9662=function(_0x2ab1de,_0x1aef5d){_0x2ab1de=_0x2ab1de-0x0;var _0x3f903f=_0x6629[_0x2ab1de];return _0x3f903f;};'use strict';var _=require(_0x9662('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9662('0x1'));var rs=require(_0x9662('0x2'));var fs=require('fs');var Redis=require(_0x9662('0x3'));var db=require(_0x9662('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9662('0x5'))(_0x9662('0x6'));var config=require(_0x9662('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9662('0x8')][_0x9662('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x457681,_0x5ec533,_0x1a1809){return new BPromise(function(_0x58e45a,_0xa866f2){return client[_0x9662('0xa')](_0x457681,_0x1a1809)[_0x9662('0xb')](function(_0x11ae91){logger[_0x9662('0xc')](_0x9662('0xd'),_0x5ec533,_0x9662('0xe'));logger[_0x9662('0xf')](_0x9662('0x10'),_0x5ec533,_0x9662('0xe'),JSON[_0x9662('0x11')](_0x11ae91));if(_0x11ae91['error']){if(_0x11ae91[_0x9662('0x12')]['code']===0x1f4){logger[_0x9662('0x12')](_0x9662('0xd'),_0x5ec533,_0x11ae91['error'][_0x9662('0x13')]);return _0xa866f2(_0x11ae91[_0x9662('0x12')][_0x9662('0x13')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5ec533,_0x11ae91[_0x9662('0x12')]['message']);return _0x58e45a(_0x11ae91[_0x9662('0x12')][_0x9662('0x13')]);}else{logger[_0x9662('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x5ec533,'request\x20sent');_0x58e45a(_0x11ae91['result'][_0x9662('0x13')]);}})[_0x9662('0x14')](function(_0x4930c5){logger[_0x9662('0x12')](_0x9662('0xd'),_0x5ec533,_0x4930c5);_0xa866f2(_0x4930c5);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f223edc..2492d91 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 _0x1e5a=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','create','update','delete'];(function(_0x515da8,_0x3b69d2){var _0x10da36=function(_0x50e50b){while(--_0x50e50b){_0x515da8['push'](_0x515da8['shift']());}};_0x10da36(++_0x3b69d2);}(_0x1e5a,0xb5));var _0xa1e5=function(_0x5e1f4b,_0x50b208){_0x5e1f4b=_0x5e1f4b-0x0;var _0x5ce7b4=_0x1e5a[_0x5e1f4b];return _0x5ce7b4;};'use strict';var multer=require(_0xa1e5('0x0'));var util=require(_0xa1e5('0x1'));var path=require(_0xa1e5('0x2'));var timeout=require(_0xa1e5('0x3'));var express=require(_0xa1e5('0x4'));var router=express['Router']();var fs_extra=require(_0xa1e5('0x5'));var auth=require(_0xa1e5('0x6'));var interaction=require(_0xa1e5('0x7'));var config=require('../../config/environment');var controller=require(_0xa1e5('0x8'));router['get']('/',auth[_0xa1e5('0x9')](),controller[_0xa1e5('0xa')]);router[_0xa1e5('0xb')](_0xa1e5('0xc'),auth[_0xa1e5('0x9')](),controller[_0xa1e5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa1e5('0xe')]);router['put'](_0xa1e5('0xc'),auth[_0xa1e5('0x9')](),controller[_0xa1e5('0xf')]);router[_0xa1e5('0x10')](_0xa1e5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa1e5('0x11')]=router; \ No newline at end of file +var _0x3b68=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x583262,_0x58f9a5){var _0x3399ca=function(_0x9e8ea4){while(--_0x9e8ea4){_0x583262['push'](_0x583262['shift']());}};_0x3399ca(++_0x58f9a5);}(_0x3b68,0x1bd));var _0x83b6=function(_0x20acf7,_0x23202c){_0x20acf7=_0x20acf7-0x0;var _0x35bf0e=_0x3b68[_0x20acf7];return _0x35bf0e;};'use strict';var multer=require('multer');var util=require(_0x83b6('0x0'));var path=require(_0x83b6('0x1'));var timeout=require(_0x83b6('0x2'));var express=require(_0x83b6('0x3'));var router=express[_0x83b6('0x4')]();var fs_extra=require(_0x83b6('0x5'));var auth=require(_0x83b6('0x6'));var interaction=require(_0x83b6('0x7'));var config=require(_0x83b6('0x8'));var controller=require('./intDeskField.controller');router[_0x83b6('0x9')]('/',auth[_0x83b6('0xa')](),controller[_0x83b6('0xb')]);router['get'](_0x83b6('0xc'),auth[_0x83b6('0xa')](),controller[_0x83b6('0xd')]);router['post']('/',auth[_0x83b6('0xa')](),controller['create']);router[_0x83b6('0xe')](_0x83b6('0xc'),auth[_0x83b6('0xa')](),controller[_0x83b6('0xf')]);router['delete'](_0x83b6('0xc'),auth[_0x83b6('0xa')](),controller[_0x83b6('0x10')]);module[_0x83b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index b421d98..a65f6b7 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 _0x8886=['picklist','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8886,0x87));var _0x6888=function(_0x3a51b7,_0x423b97){_0x3a51b7=_0x3a51b7-0x0;var _0x8c807d=_0x8886[_0x3a51b7];return _0x8c807d;};'use strict';var Sequelize=require(_0x6888('0x0'));module[_0x6888('0x1')]={'type':{'type':Sequelize[_0x6888('0x2')]('string','variable',_0x6888('0x3'),_0x6888('0x4'),_0x6888('0x5')),'defaultValue':_0x6888('0x6')},'content':{'type':Sequelize[_0x6888('0x7')]},'key':{'type':Sequelize[_0x6888('0x7')]},'keyType':{'type':Sequelize[_0x6888('0x2')](_0x6888('0x6'),_0x6888('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x6888('0x7')]},'idField':{'type':Sequelize[_0x6888('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6888('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x57e4=['string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x50a5c1,_0x4e6f88){var _0x47b543=function(_0x1c8375){while(--_0x1c8375){_0x50a5c1['push'](_0x50a5c1['shift']());}};_0x47b543(++_0x4e6f88);}(_0x57e4,0x9e));var _0x457e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x57e4[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x457e('0x0'));module[_0x457e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x457e('0x2'),'variable',_0x457e('0x3'),_0x457e('0x4'),_0x457e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x457e('0x6')]},'key':{'type':Sequelize[_0x457e('0x6')]},'keyType':{'type':Sequelize[_0x457e('0x7')](_0x457e('0x2'),_0x457e('0x8'),_0x457e('0x3'))},'keyContent':{'type':Sequelize[_0x457e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x457e('0x6')]},'customField':{'type':Sequelize[_0x457e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x457e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1239755..e741ea2 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 _0xd1b5=['DeskField','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','params','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x586d28,_0x252dbc){var _0x1902e9=function(_0x1b3375){while(--_0x1b3375){_0x586d28['push'](_0x586d28['shift']());}};_0x1902e9(++_0x252dbc);}(_0xd1b5,0x67));var _0x5d1b=function(_0x141b8b,_0x2685fb){_0x141b8b=_0x141b8b-0x0;var _0x40eb31=_0xd1b5[_0x141b8b];return _0x40eb31;};'use strict';var emlformat=require(_0x5d1b('0x0'));var rimraf=require(_0x5d1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d1b('0x2'));var rp=require('request-promise');var moment=require(_0x5d1b('0x3'));var BPromise=require(_0x5d1b('0x4'));var Mustache=require(_0x5d1b('0x5'));var util=require(_0x5d1b('0x6'));var path=require(_0x5d1b('0x7'));var sox=require(_0x5d1b('0x8'));var csv=require(_0x5d1b('0x9'));var ejs=require(_0x5d1b('0xa'));var fs=require('fs');var fs_extra=require(_0x5d1b('0xb'));var _=require('lodash');var squel=require(_0x5d1b('0xc'));var crypto=require(_0x5d1b('0xd'));var jsforce=require(_0x5d1b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5d1b('0x9'));var querystring=require(_0x5d1b('0xf'));var Papa=require(_0x5d1b('0x10'));var Redis=require(_0x5d1b('0x11'));var authService=require(_0x5d1b('0x12'));var qs=require(_0x5d1b('0x13'));var as=require(_0x5d1b('0x14'));var hardwareService=require(_0x5d1b('0x15'));var logger=require(_0x5d1b('0x16'))(_0x5d1b('0x17'));var utils=require('../../config/utils');var config=require(_0x5d1b('0x18'));var licenseUtil=require(_0x5d1b('0x19'));var db=require(_0x5d1b('0x1a'))['db'];function respondWithStatusCode(_0x9d47c5,_0x4c4f46){_0x4c4f46=_0x4c4f46||0xcc;return function(_0x29d22f){if(_0x29d22f){return _0x9d47c5[_0x5d1b('0x1b')](_0x4c4f46);}return _0x9d47c5[_0x5d1b('0x1c')](_0x4c4f46)[_0x5d1b('0x1d')]();};}function respondWithResult(_0x5c24d9,_0x16714a){_0x16714a=_0x16714a||0xc8;return function(_0x3f5a88){if(_0x3f5a88){return _0x5c24d9['status'](_0x16714a)['json'](_0x3f5a88);}};}function respondWithFilteredResult(_0x5306d1,_0x571867){return function(_0x40acb8){if(_0x40acb8){var _0x18429f=typeof _0x571867[_0x5d1b('0x1e')]==='undefined'&&typeof _0x571867[_0x5d1b('0x1f')]===_0x5d1b('0x20');var _0x4fa02d=_0x40acb8[_0x5d1b('0x21')];var _0x565d58=_0x18429f?0x0:_0x571867[_0x5d1b('0x1e')];var _0x4aef24=_0x18429f?_0x40acb8[_0x5d1b('0x21')]:_0x571867[_0x5d1b('0x1e')]+_0x571867[_0x5d1b('0x1f')];var _0x281ae6;if(_0x4aef24>=_0x4fa02d){_0x4aef24=_0x4fa02d;_0x281ae6=0xc8;}else{_0x281ae6=0xce;}_0x5306d1['status'](_0x281ae6);return _0x5306d1[_0x5d1b('0x22')]('Content-Range',_0x565d58+'-'+_0x4aef24+'/'+_0x4fa02d)[_0x5d1b('0x23')](_0x40acb8);}return null;};}function patchUpdates(_0x18592d){return function(_0x3ece29){try{jsonpatch[_0x5d1b('0x24')](_0x3ece29,_0x18592d,!![]);}catch(_0x493a77){return BPromise[_0x5d1b('0x25')](_0x493a77);}return _0x3ece29['save']();};}function saveUpdates(_0x1d46c8,_0xff220b){return function(_0x2e367){if(_0x2e367){return _0x2e367[_0x5d1b('0x26')](_0x1d46c8)[_0x5d1b('0x27')](function(_0x247357){return _0x247357;});}return null;};}function removeEntity(_0xd6ffd8,_0x2229be){return function(_0x4ef949){if(_0x4ef949){return _0x4ef949[_0x5d1b('0x28')]()[_0x5d1b('0x27')](function(){_0xd6ffd8[_0x5d1b('0x1c')](0xcc)[_0x5d1b('0x1d')]();});}};}function handleEntityNotFound(_0x17a7d9,_0x403344){return function(_0x414ca0){if(!_0x414ca0){_0x17a7d9['sendStatus'](0x194);}return _0x414ca0;};}function handleError(_0x2e61f7,_0x27760e){_0x27760e=_0x27760e||0x1f4;return function(_0x118542){logger[_0x5d1b('0x29')](_0x118542[_0x5d1b('0x2a')]);if(_0x118542[_0x5d1b('0x2b')]){delete _0x118542[_0x5d1b('0x2b')];}_0x2e61f7['status'](_0x27760e)[_0x5d1b('0x2c')](_0x118542);};}exports[_0x5d1b('0x2d')]=function(_0x112f3a,_0x1e1941){var _0x2fc252={},_0x350981={},_0xc0e955={'count':0x0,'rows':[]};var _0x50f804=_[_0x5d1b('0x2e')](db[_0x5d1b('0x2f')][_0x5d1b('0x30')],function(_0x4ab682){return{'name':_0x4ab682[_0x5d1b('0x31')],'type':_0x4ab682[_0x5d1b('0x32')]['key']};});_0x350981[_0x5d1b('0x33')]=_[_0x5d1b('0x2e')](_0x50f804,_0x5d1b('0x2b'));_0x350981['query']=_[_0x5d1b('0x34')](_0x112f3a[_0x5d1b('0x35')]);_0x350981['filters']=_[_0x5d1b('0x36')](_0x350981[_0x5d1b('0x33')],_0x350981['query']);_0x2fc252['attributes']=_['intersection'](_0x350981[_0x5d1b('0x33')],qs[_0x5d1b('0x37')](_0x112f3a[_0x5d1b('0x35')][_0x5d1b('0x37')]));_0x2fc252['attributes']=_0x2fc252[_0x5d1b('0x38')]['length']?_0x2fc252[_0x5d1b('0x38')]:_0x350981[_0x5d1b('0x33')];if(!_0x112f3a[_0x5d1b('0x35')]['hasOwnProperty'](_0x5d1b('0x39'))){_0x2fc252[_0x5d1b('0x1f')]=qs['limit'](_0x112f3a[_0x5d1b('0x35')][_0x5d1b('0x1f')]);_0x2fc252[_0x5d1b('0x1e')]=qs[_0x5d1b('0x1e')](_0x112f3a[_0x5d1b('0x35')][_0x5d1b('0x1e')]);}_0x2fc252[_0x5d1b('0x3a')]=qs[_0x5d1b('0x3b')](_0x112f3a[_0x5d1b('0x35')][_0x5d1b('0x3b')]);_0x2fc252[_0x5d1b('0x3c')]=qs['filters'](_[_0x5d1b('0x3d')](_0x112f3a['query'],_0x350981[_0x5d1b('0x3e')]),_0x50f804);if(_0x112f3a['query'][_0x5d1b('0x3f')]){_0x2fc252[_0x5d1b('0x3c')]=_[_0x5d1b('0x40')](_0x2fc252[_0x5d1b('0x3c')],{'$or':_[_0x5d1b('0x2e')](_0x50f804,function(_0x38f46b){if(_0x38f46b[_0x5d1b('0x32')]!==_0x5d1b('0x41')){var _0x285494={};_0x285494[_0x38f46b[_0x5d1b('0x2b')]]={'$like':'%'+_0x112f3a[_0x5d1b('0x35')]['filter']+'%'};return _0x285494;}})});}_0x2fc252=_['merge']({},_0x2fc252,_0x112f3a[_0x5d1b('0x42')]);var _0x51c88d={'where':_0x2fc252[_0x5d1b('0x3c')]};return db[_0x5d1b('0x2f')]['count'](_0x51c88d)[_0x5d1b('0x27')](function(_0x25e546){_0xc0e955['count']=_0x25e546;if(_0x112f3a[_0x5d1b('0x35')]['includeAll']){_0x2fc252['include']=[{'all':!![]}];}return db['DeskField'][_0x5d1b('0x43')](_0x2fc252);})['then'](function(_0x441a10){_0xc0e955[_0x5d1b('0x44')]=_0x441a10;return _0xc0e955;})[_0x5d1b('0x27')](respondWithFilteredResult(_0x1e1941,_0x2fc252))[_0x5d1b('0x45')](handleError(_0x1e1941,null));};exports['show']=function(_0xa8ff40,_0x44c2e4){var _0xad3a43={'raw':!![],'where':{'id':_0xa8ff40[_0x5d1b('0x46')]['id']}},_0x5ec079={};_0x5ec079[_0x5d1b('0x33')]=_[_0x5d1b('0x34')](db[_0x5d1b('0x2f')][_0x5d1b('0x30')]);_0x5ec079[_0x5d1b('0x35')]=_['keys'](_0xa8ff40[_0x5d1b('0x35')]);_0x5ec079['filters']=_[_0x5d1b('0x36')](_0x5ec079[_0x5d1b('0x33')],_0x5ec079[_0x5d1b('0x35')]);_0xad3a43[_0x5d1b('0x38')]=_[_0x5d1b('0x36')](_0x5ec079[_0x5d1b('0x33')],qs['fields'](_0xa8ff40['query'][_0x5d1b('0x37')]));_0xad3a43[_0x5d1b('0x38')]=_0xad3a43[_0x5d1b('0x38')]['length']?_0xad3a43[_0x5d1b('0x38')]:_0x5ec079[_0x5d1b('0x33')];if(_0xa8ff40[_0x5d1b('0x35')]['includeAll']){_0xad3a43[_0x5d1b('0x47')]=[{'all':!![]}];}_0xad3a43=_['merge']({},_0xad3a43,_0xa8ff40['options']);return db[_0x5d1b('0x2f')][_0x5d1b('0x48')](_0xad3a43)[_0x5d1b('0x27')](handleEntityNotFound(_0x44c2e4,null))['then'](respondWithResult(_0x44c2e4,null))['catch'](handleError(_0x44c2e4,null));};exports[_0x5d1b('0x49')]=function(_0x498b41,_0x1a34d7){return db[_0x5d1b('0x2f')][_0x5d1b('0x49')](_0x498b41['body'],{})[_0x5d1b('0x27')](respondWithResult(_0x1a34d7,0xc9))[_0x5d1b('0x45')](handleError(_0x1a34d7,null));};exports['update']=function(_0x329182,_0x51fa65){if(_0x329182['body']['id']){delete _0x329182[_0x5d1b('0x4a')]['id'];}return db[_0x5d1b('0x2f')][_0x5d1b('0x48')]({'where':{'id':_0x329182['params']['id']}})[_0x5d1b('0x27')](handleEntityNotFound(_0x51fa65,null))[_0x5d1b('0x27')](saveUpdates(_0x329182['body'],null))[_0x5d1b('0x27')](respondWithResult(_0x51fa65,null))[_0x5d1b('0x45')](handleError(_0x51fa65,null));};exports['destroy']=function(_0x145ad6,_0x4b11ab){return db['DeskField'][_0x5d1b('0x48')]({'where':{'id':_0x145ad6[_0x5d1b('0x46')]['id']}})[_0x5d1b('0x27')](handleEntityNotFound(_0x4b11ab,null))['then'](removeEntity(_0x4b11ab,null))['catch'](handleError(_0x4b11ab,null));}; \ No newline at end of file +var _0x6075=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','offset','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x2ccb5b,_0x35eac4){var _0xa11bb3=function(_0x1b5983){while(--_0x1b5983){_0x2ccb5b['push'](_0x2ccb5b['shift']());}};_0xa11bb3(++_0x35eac4);}(_0x6075,0x126));var _0x5607=function(_0x545120,_0x3a0696){_0x545120=_0x545120-0x0;var _0x5162d3=_0x6075[_0x545120];return _0x5162d3;};'use strict';var emlformat=require(_0x5607('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5607('0x1'));var jsonpatch=require(_0x5607('0x2'));var rp=require('request-promise');var moment=require(_0x5607('0x3'));var BPromise=require(_0x5607('0x4'));var Mustache=require(_0x5607('0x5'));var util=require(_0x5607('0x6'));var path=require(_0x5607('0x7'));var sox=require(_0x5607('0x8'));var csv=require('to-csv');var ejs=require(_0x5607('0x9'));var fs=require('fs');var fs_extra=require(_0x5607('0xa'));var _=require(_0x5607('0xb'));var squel=require(_0x5607('0xc'));var crypto=require(_0x5607('0xd'));var jsforce=require(_0x5607('0xe'));var deskjs=require(_0x5607('0xf'));var toCsv=require(_0x5607('0x10'));var querystring=require('querystring');var Papa=require(_0x5607('0x11'));var Redis=require(_0x5607('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5607('0x13'));var as=require(_0x5607('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5607('0x15'))(_0x5607('0x16'));var utils=require(_0x5607('0x17'));var config=require(_0x5607('0x18'));var licenseUtil=require(_0x5607('0x19'));var db=require(_0x5607('0x1a'))['db'];function respondWithStatusCode(_0x79cb4e,_0x147fc6){_0x147fc6=_0x147fc6||0xcc;return function(_0x40c2a2){if(_0x40c2a2){return _0x79cb4e[_0x5607('0x1b')](_0x147fc6);}return _0x79cb4e[_0x5607('0x1c')](_0x147fc6)[_0x5607('0x1d')]();};}function respondWithResult(_0x3dd987,_0x564b08){_0x564b08=_0x564b08||0xc8;return function(_0x2c8352){if(_0x2c8352){return _0x3dd987['status'](_0x564b08)[_0x5607('0x1e')](_0x2c8352);}};}function respondWithFilteredResult(_0x41b92f,_0x274829){return function(_0x423507){if(_0x423507){var _0x8573c=typeof _0x274829['offset']===_0x5607('0x1f')&&typeof _0x274829[_0x5607('0x20')]===_0x5607('0x1f');var _0x3c73f2=_0x423507['count'];var _0x2bf04b=_0x8573c?0x0:_0x274829['offset'];var _0x4d9218=_0x8573c?_0x423507[_0x5607('0x21')]:_0x274829['offset']+_0x274829[_0x5607('0x20')];var _0x14862a;if(_0x4d9218>=_0x3c73f2){_0x4d9218=_0x3c73f2;_0x14862a=0xc8;}else{_0x14862a=0xce;}_0x41b92f['status'](_0x14862a);return _0x41b92f[_0x5607('0x22')]('Content-Range',_0x2bf04b+'-'+_0x4d9218+'/'+_0x3c73f2)[_0x5607('0x1e')](_0x423507);}return null;};}function patchUpdates(_0x259e32){return function(_0x35bd58){try{jsonpatch['apply'](_0x35bd58,_0x259e32,!![]);}catch(_0xd136ca){return BPromise[_0x5607('0x23')](_0xd136ca);}return _0x35bd58[_0x5607('0x24')]();};}function saveUpdates(_0x59367e,_0x1b87a3){return function(_0x62819b){if(_0x62819b){return _0x62819b[_0x5607('0x25')](_0x59367e)[_0x5607('0x26')](function(_0x2570fd){return _0x2570fd;});}return null;};}function removeEntity(_0x63e5a3,_0x5a913a){return function(_0x3e5d10){if(_0x3e5d10){return _0x3e5d10[_0x5607('0x27')]()[_0x5607('0x26')](function(){_0x63e5a3['status'](0xcc)[_0x5607('0x1d')]();});}};}function handleEntityNotFound(_0x24ca34,_0x29a71e){return function(_0x19715d){if(!_0x19715d){_0x24ca34[_0x5607('0x1b')](0x194);}return _0x19715d;};}function handleError(_0x46b787,_0x2468dc){_0x2468dc=_0x2468dc||0x1f4;return function(_0x4ff19d){logger[_0x5607('0x28')](_0x4ff19d[_0x5607('0x29')]);if(_0x4ff19d[_0x5607('0x2a')]){delete _0x4ff19d[_0x5607('0x2a')];}_0x46b787[_0x5607('0x1c')](_0x2468dc)[_0x5607('0x2b')](_0x4ff19d);};}exports[_0x5607('0x2c')]=function(_0xc5bf85,_0x4bb306){var _0x5622bb={},_0x395c18={},_0x5557ac={'count':0x0,'rows':[]};var _0x6dcbc4=_[_0x5607('0x2d')](db[_0x5607('0x2e')][_0x5607('0x2f')],function(_0x44fb99){return{'name':_0x44fb99[_0x5607('0x30')],'type':_0x44fb99['type'][_0x5607('0x31')]};});_0x395c18[_0x5607('0x32')]=_[_0x5607('0x2d')](_0x6dcbc4,_0x5607('0x2a'));_0x395c18[_0x5607('0x33')]=_[_0x5607('0x34')](_0xc5bf85[_0x5607('0x33')]);_0x395c18[_0x5607('0x35')]=_['intersection'](_0x395c18[_0x5607('0x32')],_0x395c18['query']);_0x5622bb['attributes']=_[_0x5607('0x36')](_0x395c18[_0x5607('0x32')],qs[_0x5607('0x37')](_0xc5bf85[_0x5607('0x33')][_0x5607('0x37')]));_0x5622bb['attributes']=_0x5622bb[_0x5607('0x38')][_0x5607('0x39')]?_0x5622bb[_0x5607('0x38')]:_0x395c18[_0x5607('0x32')];if(!_0xc5bf85[_0x5607('0x33')]['hasOwnProperty'](_0x5607('0x3a'))){_0x5622bb[_0x5607('0x20')]=qs[_0x5607('0x20')](_0xc5bf85[_0x5607('0x33')][_0x5607('0x20')]);_0x5622bb[_0x5607('0x3b')]=qs['offset'](_0xc5bf85[_0x5607('0x33')][_0x5607('0x3b')]);}_0x5622bb[_0x5607('0x3c')]=qs[_0x5607('0x3d')](_0xc5bf85['query'][_0x5607('0x3d')]);_0x5622bb[_0x5607('0x3e')]=qs['filters'](_[_0x5607('0x3f')](_0xc5bf85[_0x5607('0x33')],_0x395c18[_0x5607('0x35')]),_0x6dcbc4);if(_0xc5bf85[_0x5607('0x33')][_0x5607('0x40')]){_0x5622bb[_0x5607('0x3e')]=_[_0x5607('0x41')](_0x5622bb[_0x5607('0x3e')],{'$or':_[_0x5607('0x2d')](_0x6dcbc4,function(_0x30782e){if(_0x30782e[_0x5607('0x42')]!=='VIRTUAL'){var _0x1098ff={};_0x1098ff[_0x30782e[_0x5607('0x2a')]]={'$like':'%'+_0xc5bf85[_0x5607('0x33')][_0x5607('0x40')]+'%'};return _0x1098ff;}})});}_0x5622bb=_['merge']({},_0x5622bb,_0xc5bf85['options']);var _0x28e4f6={'where':_0x5622bb['where']};return db['DeskField'][_0x5607('0x21')](_0x28e4f6)[_0x5607('0x26')](function(_0x1f71ad){_0x5557ac[_0x5607('0x21')]=_0x1f71ad;if(_0xc5bf85[_0x5607('0x33')][_0x5607('0x43')]){_0x5622bb[_0x5607('0x44')]=[{'all':!![]}];}return db[_0x5607('0x2e')][_0x5607('0x45')](_0x5622bb);})[_0x5607('0x26')](function(_0x2054cc){_0x5557ac[_0x5607('0x46')]=_0x2054cc;return _0x5557ac;})['then'](respondWithFilteredResult(_0x4bb306,_0x5622bb))[_0x5607('0x47')](handleError(_0x4bb306,null));};exports[_0x5607('0x48')]=function(_0xec2767,_0x510da5){var _0x53515e={'raw':!![],'where':{'id':_0xec2767[_0x5607('0x49')]['id']}},_0x4b47b5={};_0x4b47b5[_0x5607('0x32')]=_[_0x5607('0x34')](db[_0x5607('0x2e')]['rawAttributes']);_0x4b47b5[_0x5607('0x33')]=_['keys'](_0xec2767['query']);_0x4b47b5[_0x5607('0x35')]=_[_0x5607('0x36')](_0x4b47b5['model'],_0x4b47b5['query']);_0x53515e['attributes']=_[_0x5607('0x36')](_0x4b47b5[_0x5607('0x32')],qs['fields'](_0xec2767[_0x5607('0x33')][_0x5607('0x37')]));_0x53515e[_0x5607('0x38')]=_0x53515e[_0x5607('0x38')][_0x5607('0x39')]?_0x53515e[_0x5607('0x38')]:_0x4b47b5['model'];if(_0xec2767[_0x5607('0x33')][_0x5607('0x43')]){_0x53515e[_0x5607('0x44')]=[{'all':!![]}];}_0x53515e=_[_0x5607('0x41')]({},_0x53515e,_0xec2767[_0x5607('0x4a')]);return db[_0x5607('0x2e')]['find'](_0x53515e)[_0x5607('0x26')](handleEntityNotFound(_0x510da5,null))['then'](respondWithResult(_0x510da5,null))[_0x5607('0x47')](handleError(_0x510da5,null));};exports[_0x5607('0x4b')]=function(_0x474550,_0xf44f43){return db[_0x5607('0x2e')][_0x5607('0x4b')](_0x474550[_0x5607('0x4c')],{})['then'](respondWithResult(_0xf44f43,0xc9))[_0x5607('0x47')](handleError(_0xf44f43,null));};exports['update']=function(_0x745d7b,_0x115c59){if(_0x745d7b[_0x5607('0x4c')]['id']){delete _0x745d7b[_0x5607('0x4c')]['id'];}return db[_0x5607('0x2e')][_0x5607('0x4d')]({'where':{'id':_0x745d7b['params']['id']}})[_0x5607('0x26')](handleEntityNotFound(_0x115c59,null))['then'](saveUpdates(_0x745d7b[_0x5607('0x4c')],null))[_0x5607('0x26')](respondWithResult(_0x115c59,null))[_0x5607('0x47')](handleError(_0x115c59,null));};exports[_0x5607('0x27')]=function(_0x2e0bc5,_0x8fbf03){return db[_0x5607('0x2e')][_0x5607('0x4d')]({'where':{'id':_0x2e0bc5[_0x5607('0x49')]['id']}})[_0x5607('0x26')](handleEntityNotFound(_0x8fbf03,null))[_0x5607('0x26')](removeEntity(_0x8fbf03,null))['catch'](handleError(_0x8fbf03,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 7711518..27b63ba 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 _0x928e=['rimraf','exports','DeskField','int_desk_fields','idField','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x48cec2,_0x474d65){var _0x3d5c22=function(_0x4e53e3){while(--_0x4e53e3){_0x48cec2['push'](_0x48cec2['shift']());}};_0x3d5c22(++_0x474d65);}(_0x928e,0x139));var _0xe928=function(_0x4220fc,_0x3143e9){_0x4220fc=_0x4220fc-0x0;var _0x2f5f05=_0x928e[_0x4220fc];return _0x2f5f05;};'use strict';var _=require(_0xe928('0x0'));var util=require(_0xe928('0x1'));var logger=require(_0xe928('0x2'))(_0xe928('0x3'));var moment=require('moment');var BPromise=require(_0xe928('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe928('0x5'));var rimraf=require(_0xe928('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xe928('0x7')]=function(_0x5e85aa,_0x167312){return _0x5e85aa['define'](_0xe928('0x8'),attributes,{'tableName':_0xe928('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xe928('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce0e=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','int_desk_fields','idField','lodash'];(function(_0x8b1e53,_0x4341d2){var _0x3df208=function(_0x2264bc){while(--_0x2264bc){_0x8b1e53['push'](_0x8b1e53['shift']());}};_0x3df208(++_0x4341d2);}(_0xce0e,0x167));var _0xece0=function(_0x57c17e,_0x2f2176){_0x57c17e=_0x57c17e-0x0;var _0x39b721=_0xce0e[_0x57c17e];return _0x39b721;};'use strict';var _=require(_0xece0('0x0'));var util=require(_0xece0('0x1'));var logger=require(_0xece0('0x2'))('api');var moment=require(_0xece0('0x3'));var BPromise=require(_0xece0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xece0('0x5'));var rimraf=require(_0xece0('0x6'));var config=require(_0xece0('0x7'));var attributes=require(_0xece0('0x8'));module[_0xece0('0x9')]=function(_0xe8ec97,_0x32202c){return _0xe8ec97['define']('DeskField',attributes,{'tableName':_0xece0('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xece0('0xb'),'FieldId'],'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 f6c0d38..035ecc4 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 _0x002b=['code','message','DeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x002b,0x191));var _0xb002=function(_0x23fd09,_0x51c74c){_0x23fd09=_0x23fd09-0x0;var _0x5d8176=_0x002b[_0x23fd09];return _0x5d8176;};'use strict';var _=require(_0xb002('0x0'));var util=require(_0xb002('0x1'));var moment=require(_0xb002('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb002('0x3'));var db=require(_0xb002('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb002('0x5'))(_0xb002('0x6'));var config=require(_0xb002('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb002('0x8')][_0xb002('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c83cd,_0x48facf,_0x10a442){return new BPromise(function(_0x4e6c19,_0x42a2f3){return client['request'](_0x2c83cd,_0x10a442)[_0xb002('0xa')](function(_0x440285){logger[_0xb002('0xb')]('DeskField,\x20%s,\x20%s',_0x48facf,_0xb002('0xc'));logger[_0xb002('0xd')](_0xb002('0xe'),_0x48facf,_0xb002('0xc'),JSON[_0xb002('0xf')](_0x440285));if(_0x440285[_0xb002('0x10')]){if(_0x440285[_0xb002('0x10')][_0xb002('0x11')]===0x1f4){logger[_0xb002('0x10')]('DeskField,\x20%s,\x20%s',_0x48facf,_0x440285[_0xb002('0x10')][_0xb002('0x12')]);return _0x42a2f3(_0x440285['error'][_0xb002('0x12')]);}logger[_0xb002('0x10')](_0xb002('0x13'),_0x48facf,_0x440285[_0xb002('0x10')]['message']);return _0x4e6c19(_0x440285['error'][_0xb002('0x12')]);}else{logger[_0xb002('0xb')](_0xb002('0x13'),_0x48facf,'request\x20sent');_0x4e6c19(_0x440285[_0xb002('0x14')]['message']);}})[_0xb002('0x15')](function(_0x4624b5){logger[_0xb002('0x10')](_0xb002('0x13'),_0x48facf,_0x4624b5);_0x42a2f3(_0x4624b5);});});} \ No newline at end of file +var _0xbcbd=['DeskField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e8706,_0x3943f7){var _0x3166b6=function(_0x380541){while(--_0x380541){_0x3e8706['push'](_0x3e8706['shift']());}};_0x3166b6(++_0x3943f7);}(_0xbcbd,0x1d0));var _0xdbcb=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0xbcbd[_0x380a3f];return _0x2b4eca;};'use strict';var _=require(_0xdbcb('0x0'));var util=require(_0xdbcb('0x1'));var moment=require('moment');var BPromise=require(_0xdbcb('0x2'));var rs=require(_0xdbcb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbcb('0x4'))['db'];var utils=require(_0xdbcb('0x5'));var logger=require(_0xdbcb('0x6'))(_0xdbcb('0x7'));var config=require(_0xdbcb('0x8'));var jayson=require(_0xdbcb('0x9'));var client=jayson['client'][_0xdbcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a156c,_0x29dfac,_0x2cae00){return new BPromise(function(_0x4a0fc4,_0x10b3c4){return client['request'](_0x1a156c,_0x2cae00)[_0xdbcb('0xb')](function(_0xa369f9){logger[_0xdbcb('0xc')](_0xdbcb('0xd'),_0x29dfac,_0xdbcb('0xe'));logger[_0xdbcb('0xf')](_0xdbcb('0x10'),_0x29dfac,_0xdbcb('0xe'),JSON['stringify'](_0xa369f9));if(_0xa369f9[_0xdbcb('0x11')]){if(_0xa369f9[_0xdbcb('0x11')]['code']===0x1f4){logger[_0xdbcb('0x11')](_0xdbcb('0xd'),_0x29dfac,_0xa369f9[_0xdbcb('0x11')]['message']);return _0x10b3c4(_0xa369f9[_0xdbcb('0x11')][_0xdbcb('0x12')]);}logger[_0xdbcb('0x11')](_0xdbcb('0xd'),_0x29dfac,_0xa369f9['error'][_0xdbcb('0x12')]);return _0x4a0fc4(_0xa369f9[_0xdbcb('0x11')][_0xdbcb('0x12')]);}else{logger[_0xdbcb('0xc')](_0xdbcb('0xd'),_0x29dfac,_0xdbcb('0xe'));_0x4a0fc4(_0xa369f9['result'][_0xdbcb('0x12')]);}})[_0xdbcb('0x13')](function(_0x3815bc){logger[_0xdbcb('0x11')]('DeskField,\x20%s,\x20%s',_0x29dfac,_0x3815bc);_0x10b3c4(_0x3815bc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index dd28380..c843bc8 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 _0xc54b=['getFields','create','post','addConfiguration','/:id','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x3ed9a8,_0x37eb61){var _0x57a1db=function(_0x43f330){while(--_0x43f330){_0x3ed9a8['push'](_0x3ed9a8['shift']());}};_0x57a1db(++_0x37eb61);}(_0xc54b,0x147));var _0xbc54=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xc54b[_0x439d59];return _0x3670c7;};'use strict';var multer=require(_0xbc54('0x0'));var util=require(_0xbc54('0x1'));var path=require(_0xbc54('0x2'));var timeout=require(_0xbc54('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbc54('0x4'));var auth=require(_0xbc54('0x5'));var interaction=require(_0xbc54('0x6'));var config=require('../../config/environment');var controller=require(_0xbc54('0x7'));router[_0xbc54('0x8')]('/',auth[_0xbc54('0x9')](),controller['index']);router[_0xbc54('0x8')]('/:id',auth[_0xbc54('0x9')](),controller['show']);router['get'](_0xbc54('0xa'),auth[_0xbc54('0x9')](),controller[_0xbc54('0xb')]);router[_0xbc54('0x8')](_0xbc54('0xc'),auth[_0xbc54('0x9')](),controller[_0xbc54('0xd')]);router['post']('/',auth[_0xbc54('0x9')](),controller[_0xbc54('0xe')]);router[_0xbc54('0xf')](_0xbc54('0xa'),auth[_0xbc54('0x9')](),controller[_0xbc54('0x10')]);router['put'](_0xbc54('0x11'),auth[_0xbc54('0x9')](),controller['update']);router[_0xbc54('0x12')](_0xbc54('0x11'),auth['isAuthenticated'](),controller[_0xbc54('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9c91=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','post','put','update'];(function(_0x3ced69,_0x23967b){var _0x5932b4=function(_0xf98af2){while(--_0xf98af2){_0x3ced69['push'](_0x3ced69['shift']());}};_0x5932b4(++_0x23967b);}(_0x9c91,0x87));var _0x19c9=function(_0x38fe96,_0x2fd576){_0x38fe96=_0x38fe96-0x0;var _0x4b12f2=_0x9c91[_0x38fe96];return _0x4b12f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x19c9('0x0'));var timeout=require(_0x19c9('0x1'));var express=require(_0x19c9('0x2'));var router=express[_0x19c9('0x3')]();var fs_extra=require(_0x19c9('0x4'));var auth=require(_0x19c9('0x5'));var interaction=require(_0x19c9('0x6'));var config=require(_0x19c9('0x7'));var controller=require(_0x19c9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x19c9('0x9')]);router['get'](_0x19c9('0xa'),auth[_0x19c9('0xb')](),controller[_0x19c9('0xc')]);router[_0x19c9('0xd')](_0x19c9('0xe'),auth[_0x19c9('0xb')](),controller[_0x19c9('0xf')]);router['get']('/:id/fields',auth[_0x19c9('0xb')](),controller['getFields']);router['post']('/',auth[_0x19c9('0xb')](),controller['create']);router[_0x19c9('0x10')]('/:id/configurations',auth[_0x19c9('0xb')](),controller['addConfiguration']);router[_0x19c9('0x11')](_0x19c9('0xa'),auth[_0x19c9('0xb')](),controller[_0x19c9('0x12')]);router[_0x19c9('0x13')](_0x19c9('0xa'),auth[_0x19c9('0xb')](),controller[_0x19c9('0x14')]);module[_0x19c9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 4567c43..07cd26d 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 _0x7217=['sequelize','STRING','BOOLEAN'];(function(_0x4cfade,_0x5b1ccc){var _0xa7aafd=function(_0x5cf9e4){while(--_0x5cf9e4){_0x4cfade['push'](_0x4cfade['shift']());}};_0xa7aafd(++_0x5b1ccc);}(_0x7217,0x19e));var _0x7721=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7217[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')]},'username':{'type':Sequelize[_0x7721('0x1')]},'password':{'type':Sequelize[_0x7721('0x1')]},'remoteUri':{'type':Sequelize[_0x7721('0x1')]},'tenantId':{'type':Sequelize[_0x7721('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'modernAuthentication':{'type':Sequelize[_0x7721('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7a3e=['STRING','sequelize','exports'];(function(_0x28d31d,_0x57a4e6){var _0x2df7c1=function(_0x52601d){while(--_0x52601d){_0x28d31d['push'](_0x28d31d['shift']());}};_0x2df7c1(++_0x57a4e6);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x429ee3,_0x337a13){_0x429ee3=_0x429ee3-0x0;var _0x5a6447=_0x7a3e[_0x429ee3];return _0x5a6447;};'use strict';var Sequelize=require(_0xe7a3('0x0'));module[_0xe7a3('0x1')]={'name':{'type':Sequelize[_0xe7a3('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe7a3('0x2')]},'remoteUri':{'type':Sequelize[_0xe7a3('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe7a3('0x2')]},'serverUrl':{'type':Sequelize[_0xe7a3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe7a3('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3626e09..35d5bcb 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 _0xe884=['createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','test','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','Label','true','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','getConfigurations','findOne','Dynamics365Configuration','sort','filter','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname'];(function(_0x1d5b9e,_0xd79a13){var _0x5695a5=function(_0xfa100b){while(--_0xfa100b){_0x1d5b9e['push'](_0x1d5b9e['shift']());}};_0x5695a5(++_0xd79a13);}(_0xe884,0x11f));var _0x4e88=function(_0x14e296,_0x4b28ac){_0x14e296=_0x14e296-0x0;var _0x4a2b13=_0xe884[_0x14e296];return _0x4a2b13;};'use strict';var rp=require('request-promise');var util=require(_0x4e88('0x0'));var _=require(_0x4e88('0x1'));var qs=require(_0x4e88('0x2'));var logger=require('../../config/logger')(_0x4e88('0x3'));var db=require(_0x4e88('0x4'))['db'];var integrations=require(_0x4e88('0x5'));function respondWithResult(_0xaf7b72,_0x26b9a2){_0x26b9a2=_0x26b9a2||0xc8;return function(_0xe0e2ce){if(_0xe0e2ce){return _0xaf7b72['status'](_0x26b9a2)[_0x4e88('0x6')](_0xe0e2ce);}};}function respondWithFilteredResult(_0x5b487c,_0x1e1897){return function(_0x4405b5){if(_0x4405b5){var _0x3b4279=typeof _0x1e1897[_0x4e88('0x7')]===_0x4e88('0x8')&&typeof _0x1e1897[_0x4e88('0x9')]===_0x4e88('0x8');var _0x368ea0=_0x4405b5[_0x4e88('0xa')];var _0xcdde5f=_0x3b4279?0x0:_0x1e1897[_0x4e88('0x7')];var _0x106fd8=_0x3b4279?_0x4405b5[_0x4e88('0xa')]:_0x1e1897[_0x4e88('0x7')]+_0x1e1897['limit'];var _0x3a2ae6;if(_0x106fd8>=_0x368ea0){_0x106fd8=_0x368ea0;_0x3a2ae6=0xc8;}else{_0x3a2ae6=0xce;}_0x5b487c[_0x4e88('0xb')](_0x3a2ae6);return _0x5b487c[_0x4e88('0xc')](_0x4e88('0xd'),_0xcdde5f+'-'+_0x106fd8+'/'+_0x368ea0)[_0x4e88('0x6')](_0x4405b5);}return null;};}function saveUpdates(_0x9065f8){return function(_0x42fe43){if(_0x42fe43){return _0x42fe43[_0x4e88('0xe')](_0x9065f8)[_0x4e88('0xf')](function(_0x454e21){return _0x454e21;});}return null;};}function removeEntity(_0x4eb737){return function(_0x63ca42){if(_0x63ca42){return _0x63ca42[_0x4e88('0x10')]()[_0x4e88('0xf')](function(){_0x4eb737[_0x4e88('0xb')](0xcc)[_0x4e88('0x11')]();});}};}function handleEntityNotFound(_0x26089d){return function(_0x4ea239){if(!_0x4ea239){_0x26089d['sendStatus'](0x194);}return _0x4ea239;};}function handleError(_0x5ad715,_0x56ab6a){_0x56ab6a=_0x56ab6a||0x1f4;return function(_0x57cd5c){logger[_0x4e88('0x12')](_0x57cd5c[_0x4e88('0x13')]);if(_0x57cd5c['name']){delete _0x57cd5c[_0x4e88('0x14')];}_0x5ad715[_0x4e88('0xb')](_0x56ab6a)[_0x4e88('0x15')](_0x57cd5c);};}exports['index']=function(_0x488fd9,_0x578719){var _0x496db7={},_0x178fdd={},_0x16b843={'count':0x0,'rows':[]};var _0x4694c3=_[_0x4e88('0x16')](db[_0x4e88('0x17')][_0x4e88('0x18')],function(_0x594c7e){return{'name':_0x594c7e[_0x4e88('0x19')],'type':_0x594c7e[_0x4e88('0x1a')]['key']};});_0x178fdd['model']=_[_0x4e88('0x16')](_0x4694c3,_0x4e88('0x14'));_0x178fdd[_0x4e88('0x1b')]=_['keys'](_0x488fd9[_0x4e88('0x1b')]);_0x178fdd[_0x4e88('0x1c')]=_[_0x4e88('0x1d')](_0x178fdd[_0x4e88('0x1e')],_0x178fdd[_0x4e88('0x1b')]);_0x496db7['attributes']=_[_0x4e88('0x1d')](_0x178fdd[_0x4e88('0x1e')],qs['fields'](_0x488fd9['query'][_0x4e88('0x1f')]));_0x496db7[_0x4e88('0x20')]=_0x496db7[_0x4e88('0x20')][_0x4e88('0x21')]?_0x496db7['attributes']:_0x178fdd['model'];if(!_0x488fd9['query'][_0x4e88('0x22')]('nolimit')){_0x496db7[_0x4e88('0x9')]=qs[_0x4e88('0x9')](_0x488fd9[_0x4e88('0x1b')][_0x4e88('0x9')]);_0x496db7['offset']=qs[_0x4e88('0x7')](_0x488fd9['query']['offset']);}_0x496db7[_0x4e88('0x23')]=qs['sort'](_0x488fd9[_0x4e88('0x1b')]['sort']);_0x496db7[_0x4e88('0x24')]=qs[_0x4e88('0x1c')](_[_0x4e88('0x25')](_0x488fd9[_0x4e88('0x1b')],_0x178fdd[_0x4e88('0x1c')]),_0x4694c3);if(_0x488fd9[_0x4e88('0x1b')]['filter']){_0x496db7[_0x4e88('0x24')]=_[_0x4e88('0x26')](_0x496db7[_0x4e88('0x24')],{'$or':_[_0x4e88('0x16')](_0x4694c3,function(_0x18748e){if(_0x18748e[_0x4e88('0x1a')]!==_0x4e88('0x27')){var _0x941c9a={};_0x941c9a[_0x18748e[_0x4e88('0x14')]]={'$like':'%'+_0x488fd9[_0x4e88('0x1b')]['filter']+'%'};return _0x941c9a;}})});}_0x496db7=_[_0x4e88('0x26')]({},_0x496db7,_0x488fd9[_0x4e88('0x28')]);var _0x41aa81={'where':_0x496db7[_0x4e88('0x24')]};return db['Dynamics365Account'][_0x4e88('0xa')](_0x41aa81)['then'](function(_0x4da854){_0x16b843[_0x4e88('0xa')]=_0x4da854;if(_0x488fd9[_0x4e88('0x1b')]['includeAll']){_0x496db7[_0x4e88('0x29')]=[{'all':!![]}];}return db[_0x4e88('0x17')][_0x4e88('0x2a')](_0x496db7);})[_0x4e88('0xf')](function(_0x4bd6b9){_0x16b843[_0x4e88('0x2b')]=_0x4bd6b9;return _0x16b843;})[_0x4e88('0xf')](respondWithFilteredResult(_0x578719,_0x496db7))['catch'](handleError(_0x578719,null));};exports[_0x4e88('0x2c')]=function(_0x26f5e9,_0x1d1f10){var _0xe6c283={'raw':![],'where':{'id':_0x26f5e9[_0x4e88('0x2d')]['id']}},_0x4807ab={};_0x4807ab[_0x4e88('0x1e')]=_['keys'](db[_0x4e88('0x17')][_0x4e88('0x18')]);_0x4807ab[_0x4e88('0x1b')]=_[_0x4e88('0x2e')](_0x26f5e9[_0x4e88('0x1b')]);_0x4807ab[_0x4e88('0x1c')]=_['intersection'](_0x4807ab[_0x4e88('0x1e')],_0x4807ab['query']);_0xe6c283[_0x4e88('0x20')]=_[_0x4e88('0x1d')](_0x4807ab['model'],qs['fields'](_0x26f5e9[_0x4e88('0x1b')][_0x4e88('0x1f')]));_0xe6c283['attributes']=_0xe6c283['attributes']['length']?_0xe6c283[_0x4e88('0x20')]:_0x4807ab[_0x4e88('0x1e')];if(_0x26f5e9[_0x4e88('0x1b')][_0x4e88('0x2f')]){_0xe6c283[_0x4e88('0x29')]=[{'all':!![]}];}_0xe6c283=_[_0x4e88('0x26')]({},_0xe6c283,_0x26f5e9[_0x4e88('0x28')]);return db['Dynamics365Account'][_0x4e88('0x30')](_0xe6c283)[_0x4e88('0xf')](handleEntityNotFound(_0x1d1f10,null))[_0x4e88('0xf')](respondWithResult(_0x1d1f10,null))['catch'](handleError(_0x1d1f10,null));};exports['create']=function(_0x4ce0d8,_0x2a0628){return db[_0x4e88('0x17')][_0x4e88('0x31')](_0x4ce0d8['body'],{})[_0x4e88('0xf')](respondWithResult(_0x2a0628,0xc9))['catch'](handleError(_0x2a0628,null));};exports[_0x4e88('0xe')]=function(_0x2b39ad,_0x5f05ed){if(_0x2b39ad[_0x4e88('0x32')]['id']){delete _0x2b39ad[_0x4e88('0x32')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x2b39ad['params']['id']}})[_0x4e88('0xf')](handleEntityNotFound(_0x5f05ed,null))[_0x4e88('0xf')](saveUpdates(_0x2b39ad['body'],null))[_0x4e88('0xf')](respondWithResult(_0x5f05ed,null))[_0x4e88('0x33')](handleError(_0x5f05ed,null));};exports[_0x4e88('0x10')]=function(_0xd49203,_0x34a332){return db['Dynamics365Account'][_0x4e88('0x30')]({'where':{'id':_0xd49203[_0x4e88('0x2d')]['id']}})[_0x4e88('0xf')](handleEntityNotFound(_0x34a332,null))[_0x4e88('0xf')](removeEntity(_0x34a332,null))['catch'](handleError(_0x34a332,null));};exports[_0x4e88('0x34')]=function(_0x5c6a0c,_0x53dc33){var _0xf327da={};var _0x25553c={};var _0x4a464d;var _0x27da46;return db['Dynamics365Account'][_0x4e88('0x35')]({'where':{'id':_0x5c6a0c['params']['id']}})['then'](handleEntityNotFound(_0x53dc33,null))[_0x4e88('0xf')](function(_0x1a8ec1){if(_0x1a8ec1){_0x4a464d=_0x1a8ec1;_0x25553c[_0x4e88('0x1e')]=_[_0x4e88('0x2e')](db[_0x4e88('0x36')][_0x4e88('0x18')]);_0x25553c[_0x4e88('0x1b')]=_[_0x4e88('0x2e')](_0x5c6a0c[_0x4e88('0x1b')]);_0x25553c[_0x4e88('0x1c')]=_[_0x4e88('0x1d')](_0x25553c[_0x4e88('0x1e')],_0x25553c[_0x4e88('0x1b')]);_0xf327da[_0x4e88('0x20')]=_[_0x4e88('0x1d')](_0x25553c['model'],qs[_0x4e88('0x1f')](_0x5c6a0c['query'][_0x4e88('0x1f')]));_0xf327da['attributes']=_0xf327da[_0x4e88('0x20')][_0x4e88('0x21')]?_0xf327da['attributes']:_0x25553c[_0x4e88('0x1e')];_0xf327da[_0x4e88('0x23')]=qs['sort'](_0x5c6a0c[_0x4e88('0x1b')][_0x4e88('0x37')]);_0xf327da['where']=qs[_0x4e88('0x1c')](_[_0x4e88('0x25')](_0x5c6a0c['query'],_0x25553c[_0x4e88('0x1c')]));if(_0x5c6a0c[_0x4e88('0x1b')][_0x4e88('0x38')]){_0xf327da[_0x4e88('0x24')]=_[_0x4e88('0x26')](_0xf327da[_0x4e88('0x24')],{'$or':_['map'](_0xf327da['attributes'],function(_0x2acafe){var _0x48ca06={};_0x48ca06[_0x2acafe]={'$like':'%'+_0x5c6a0c[_0x4e88('0x1b')]['filter']+'%'};return _0x48ca06;})});}_0xf327da=_[_0x4e88('0x26')]({},_0xf327da,_0x5c6a0c[_0x4e88('0x28')]);return _0x4a464d[_0x4e88('0x34')](_0xf327da);}})[_0x4e88('0xf')](function(_0x74d725){if(_0x74d725){_0x27da46=_0x74d725[_0x4e88('0x21')];if(!_0x5c6a0c[_0x4e88('0x1b')][_0x4e88('0x22')](_0x4e88('0x39'))){_0xf327da['limit']=qs['limit'](_0x5c6a0c['query']['limit']);_0xf327da[_0x4e88('0x7')]=qs[_0x4e88('0x7')](_0x5c6a0c[_0x4e88('0x1b')][_0x4e88('0x7')]);}return _0x4a464d[_0x4e88('0x34')](_0xf327da);}})[_0x4e88('0xf')](function(_0x152bca){if(_0x152bca){return _0x152bca?{'count':_0x27da46,'rows':_0x152bca}:null;}})[_0x4e88('0xf')](respondWithResult(_0x53dc33,null))['catch'](handleError(_0x53dc33,null));};exports[_0x4e88('0x3a')]=function(_0x1ccfeb,_0x16a16c){if(_0x1ccfeb[_0x4e88('0x32')]['id']){delete _0x1ccfeb['body']['id'];}return db[_0x4e88('0x17')][_0x4e88('0x35')]({'where':{'id':_0x1ccfeb[_0x4e88('0x2d')]['id']}})[_0x4e88('0xf')](handleEntityNotFound(_0x16a16c,null))[_0x4e88('0xf')](function(_0x56f4f7){if(_0x56f4f7){_0x1ccfeb[_0x4e88('0x32')]['AccountId']=_0x56f4f7['id'];_0x1ccfeb[_0x4e88('0x32')]['Subjects']=integrations[_0x4e88('0x3b')](_0x1ccfeb[_0x4e88('0x32')][_0x4e88('0x3c')],_0x1ccfeb[_0x4e88('0x32')]['type']);_0x1ccfeb[_0x4e88('0x32')][_0x4e88('0x3d')]=integrations[_0x4e88('0x3e')](_0x1ccfeb[_0x4e88('0x32')][_0x4e88('0x3c')],_0x1ccfeb[_0x4e88('0x32')]['type']);return db[_0x4e88('0x36')][_0x4e88('0x31')](_0x1ccfeb[_0x4e88('0x32')],{'include':[{'model':db[_0x4e88('0x3f')],'as':_0x4e88('0x40')},{'model':db[_0x4e88('0x3f')],'as':_0x4e88('0x3d')}]});}return null;})[_0x4e88('0xf')](respondWithResult(_0x16a16c,null))[_0x4e88('0x33')](handleError(_0x16a16c,null));};function sanitizeRemoteUri(_0x54cb55){var _0x4d1373=_0x54cb55[_0x4e88('0x41')](-0x1);if(_0x4d1373==='/')return _0x54cb55[_0x4e88('0x42')](0x0,_0x54cb55[_0x4e88('0x43')](_0x4d1373));return _0x54cb55;}function getWebApiUrl(_0x13c72a){return util['format'](_0x4e88('0x44'),_0x13c72a);}exports[_0x4e88('0x45')]=function(_0x16c52d,_0x2878ae){var _0x4284ec=_0x16c52d[_0x4e88('0x1b')][_0x4e88('0x46')];var _0x1e61b3=_0x4284ec===_0x4e88('0x47')?_0x4e88('0x48'):_0x4e88('0x49');var _0x54e64e='';var _0x52692d='';var _0x1af2a4='';var _0x338281='';var _0x4e90ff='';var _0x1e7caa='';var _0xbf728f='';var _0x1e6516='';var _0x33f55b=[_0x4e88('0x4a'),_0x4e88('0x4b'),_0x4e88('0x4c'),_0x4e88('0x4d'),'caseorigincode',_0x4e88('0x4e'),_0x4e88('0x4f'),_0x4e88('0x50'),_0x4e88('0x51'),'phonecall_activity_parties'];var _0x18ac48=['accountidname',_0x4e88('0x52'),_0x4e88('0x53'),_0x4e88('0x54'),_0x4e88('0x55'),_0x4e88('0x56'),_0x4e88('0x57'),_0x4e88('0x58'),'createdbyexternalpartyname',_0x4e88('0x59'),_0x4e88('0x5a'),_0x4e88('0x5b'),_0x4e88('0x5c'),'createdonbehalfbyname',_0x4e88('0x5d'),_0x4e88('0x5e'),_0x4e88('0x5f'),'customeridyominame',_0x4e88('0x60'),_0x4e88('0x61'),_0x4e88('0x62'),_0x4e88('0x63'),_0x4e88('0x64'),_0x4e88('0x65'),_0x4e88('0x66'),_0x4e88('0x67'),_0x4e88('0x68'),_0x4e88('0x69'),'kbarticleidname','lastonholdtime',_0x4e88('0x6a'),_0x4e88('0x6b'),'modifiedbyexternalpartyyominame',_0x4e88('0x6c'),_0x4e88('0x6d'),_0x4e88('0x6e'),_0x4e88('0x6f'),_0x4e88('0x70'),'msdyn_incidenttypename',_0x4e88('0x71'),'numberofchildincidents',_0x4e88('0x72'),'overriddencreatedon',_0x4e88('0x73'),_0x4e88('0x74'),_0x4e88('0x75'),_0x4e88('0x76'),_0x4e88('0x77'),'primarycontactidyominame',_0x4e88('0x78'),_0x4e88('0x79'),_0x4e88('0x7a'),'resolveby',_0x4e88('0x7b'),'responseby',_0x4e88('0x7c'),'responsiblecontactidyominame',_0x4e88('0x7d'),'slainvokedidname',_0x4e88('0x7e'),_0x4e88('0x7f'),'statecode',_0x4e88('0x80'),_0x4e88('0x81'),'ticketnumber',_0x4e88('0x82'),_0x4e88('0x83'),_0x4e88('0x84'),_0x4e88('0x85'),_0x4e88('0x86')];var _0x50e11d=_0x33f55b[_0x4e88('0x87')](_0x18ac48);return db[_0x4e88('0x17')][_0x4e88('0x35')]({'where':{'id':_0x16c52d['params']['id']},'attributes':['id',_0x4e88('0x88'),_0x4e88('0x89'),_0x4e88('0x8a'),_0x4e88('0x8b'),_0x4e88('0x8c'),_0x4e88('0x8d'),_0x4e88('0x8e')],'include':[{'model':db[_0x4e88('0x8f')],'as':_0x4e88('0x8f'),'attributes':['id',_0x4e88('0x90'),_0x4e88('0x91')]}]})[_0x4e88('0xf')](handleEntityNotFound(_0x2878ae,null))[_0x4e88('0xf')](function(_0x534cdb){if(_0x534cdb){if(_0x534cdb[_0x4e88('0x8e')]){_0x534cdb[_0x4e88('0x92')]=_0x534cdb[_0x4e88('0x8f')][_0x4e88('0x90')];_0x1e6516=sanitizeRemoteUri(_0x534cdb[_0x4e88('0x8f')]['data7']);_0xbf728f=getWebApiUrl(_0x1e6516);return _0x534cdb;}_0x1e6516=sanitizeRemoteUri(_0x534cdb[_0x4e88('0x8a')]);_0xbf728f=getWebApiUrl(_0x1e6516);var _0xc05b2c={'method':_0x4e88('0x93'),'uri':'https://login.microsoftonline.com/'+_0x534cdb[_0x4e88('0x8b')]+_0x4e88('0x94'),'form':{'client_id':_0x534cdb[_0x4e88('0x8c')],'resource':_0x1e6516,'username':_0x534cdb[_0x4e88('0x88')],'password':_0x534cdb[_0x4e88('0x89')],'grant_type':_0x4e88('0x89'),'client_secret':_0x534cdb[_0x4e88('0x8d')]},'json':!![]};return rp(_0xc05b2c);}})[_0x4e88('0xf')](function(_0x1d4b0c){_0x1e7caa=_0x1d4b0c[_0x4e88('0x92')];var _0x2f9652={'method':_0x4e88('0x95'),'uri':encodeURI(_0xbf728f+_0x4e88('0x96')+_0x1e61b3+'\x27'),'headers':{'Authorization':_0x4e88('0x97')+_0x1e7caa,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2f9652);})[_0x4e88('0xf')](function(_0x2c5534){var _0x5015fa=_0x2c5534[_0x4e88('0x98')][0x0];var _0x3bf463=_0x5015fa[_0x4e88('0x99')];var _0x55e193={'method':_0x4e88('0x95'),'uri':_0xbf728f+_0x4e88('0x9a')+_0x3bf463+_0x4e88('0x9b'),'headers':{'Authorization':'Bearer\x20'+_0x1e7caa,'If-None-Match':null,'OData-Version':_0x4e88('0x9c')},'json':!![]};return rp(_0x55e193);})['then'](function(_0x51c9ea){_0x54e64e=_0x51c9ea;_0x52692d=_0x54e64e[_0x4e88('0x9d')];_0x52692d=_['remove'](_0x52692d,function(_0x575ad1){return!_0x50e11d[_0x4e88('0x9e')](_0x575ad1[_0x4e88('0x9f')]);});var _0x204ee5=[];var _0x49e90b=[];_0x52692d[_0x4e88('0xa0')](function(_0x26923a){if(_0x26923a[_0x4e88('0xa1')]){var _0x454f44=_0x26923a[_0x4e88('0xa1')][_0x4e88('0x42')](_0x26923a[_0x4e88('0xa1')]['lastIndexOf']('.')+0x1);if(_0x454f44==='PicklistAttributeMetadata'){_0x204ee5[_0x4e88('0xa2')](getSelectList(_0xbf728f,_0x4284ec,_0x49e90b,_0x54e64e[_0x4e88('0x99')],_0x26923a[_0x4e88('0x99')],_0x1e7caa));}}});return Promise[_0x4e88('0xa3')](_0x204ee5);})['then'](function(_0x23412d){_0x1af2a4=_0x23412d[0x0];var _0x1a9e31=[];var _0x1212dd=[];_0x52692d[_0x4e88('0xa0')](function(_0x231a73){if(!_[_0x4e88('0xa4')](_0x231a73[_0x4e88('0xa1')])){var _0x5e9847=_0x231a73[_0x4e88('0xa1')][_0x4e88('0x42')](_0x231a73[_0x4e88('0xa1')][_0x4e88('0x43')]('.')+0x1);if(_0x5e9847===_0x4e88('0xa5')){_0x1a9e31[_0x4e88('0xa2')](getBooleanList(_0xbf728f,_0x4284ec,_0x1212dd,_0x54e64e[_0x4e88('0x99')],_0x231a73[_0x4e88('0x99')],_0x1e7caa));}}});return Promise[_0x4e88('0xa3')](_0x1a9e31);})[_0x4e88('0xf')](function(_0x84d916){_0x338281=_0x84d916[0x0];var _0x2c5ec7=[];var _0x827171=[];_0x52692d[_0x4e88('0xa0')](function(_0x5efbd1){if(_0x5efbd1[_0x4e88('0xa1')]){var _0x2cb12c=_0x5efbd1['@odata.type']['substring'](_0x5efbd1[_0x4e88('0xa1')][_0x4e88('0x43')]('.')+0x1);if(_0x2cb12c===_0x4e88('0xa6')||_0x2cb12c===_0x4e88('0xa7')||_0x2cb12c===_0x4e88('0xa8')||_0x2cb12c==='IntegerAttributeMetadata'||_0x2cb12c===_0x4e88('0xa9')||_0x2cb12c===_0x4e88('0xaa')||_0x2cb12c===_0x4e88('0xab')||_0x2cb12c==='EntityNameAttributeMetadata'||_0x2cb12c==='StateAttributeMetadata'||_0x2cb12c==='DecimalAttributeMetadata'){_0x2c5ec7[_0x4e88('0xa2')](getInputList(_0xbf728f,_0x4284ec,_0x2cb12c,_0x827171,_0x54e64e[_0x4e88('0x99')],_0x5efbd1['MetadataId'],_0x1e7caa));}}});return Promise[_0x4e88('0xa3')](_0x2c5ec7);})[_0x4e88('0xf')](function(_0x41647a){_0x4e90ff=_0x41647a[0x0];var _0x546293=_0x1af2a4[_0x4e88('0x87')](_0x338281)[_0x4e88('0x87')](_0x4e90ff);var _0x6bc176={'count':_0x546293[_0x4e88('0x21')],'rows':_0x546293};return _0x6bc176;})[_0x4e88('0xf')](respondWithResult(_0x2878ae,null))[_0x4e88('0x33')](function(_0x191f2d){var _0x55fce5=_0x16c52d[_0x4e88('0x1b')][_0x4e88('0xac')]?0x1f4:_0x191f2d[_0x4e88('0xad')]||0x1f4;logger[_0x4e88('0x12')](_0x191f2d[_0x4e88('0x13')]);delete _0x191f2d[_0x4e88('0x14')];if(_0x55fce5===0x191){_0x55fce5=0x190;}_0x2878ae[_0x4e88('0xb')](_0x55fce5)[_0x4e88('0x15')](_0x16c52d[_0x4e88('0x1b')][_0x4e88('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x191f2d[_0x4e88('0xad')]}:_0x191f2d);});};function getSelectList(_0x379957,_0x36b00d,_0x7acd92,_0x1c9edf,_0x2af2d0,_0x55f6db){var _0x1de710={'method':_0x4e88('0x95'),'uri':_0x379957+'EntityDefinitions('+_0x1c9edf+_0x4e88('0xae')+_0x2af2d0+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x4e88('0xaf'),'headers':{'Authorization':_0x4e88('0x97')+_0x55f6db,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1de710)[_0x4e88('0xf')](function(_0x40f65d){var _0x29d041=[];var _0x345102=_0x40f65d[_0x4e88('0xb0')][_0x4e88('0xb1')];_0x345102[_0x4e88('0xa0')](function(_0x56182d){_0x29d041['push']({'name':_0x56182d['Label']['UserLocalizedLabel']['Label'],'value':String(_0x56182d[_0x4e88('0xb2')])});});var _0x39ca93={'id':_0x36b00d+'_'+_0x40f65d[_0x4e88('0x9f')],'name':_0x40f65d['DisplayName'][_0x4e88('0xb3')]['Label'],'custom':![],'options':_0x29d041};_0x7acd92['push'](_0x39ca93);return _0x7acd92;});}function getBooleanList(_0x3ab0fc,_0x4f4747,_0x1f6631,_0x457b2a,_0x1a4b1f,_0x384944){var _0x75246c={'method':'GET','uri':_0x3ab0fc+_0x4e88('0x9a')+_0x457b2a+_0x4e88('0xae')+_0x1a4b1f+_0x4e88('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x384944,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x75246c)['then'](function(_0x5234b4){var _0x258ac5=[];_0x258ac5[_0x4e88('0xa2')]({'name':_0x5234b4[_0x4e88('0xb0')][_0x4e88('0xb5')]['Label'][_0x4e88('0xb3')][_0x4e88('0xb6')],'value':_0x4e88('0xb7')},{'name':_0x5234b4[_0x4e88('0xb0')][_0x4e88('0xb8')][_0x4e88('0xb6')][_0x4e88('0xb3')]['Label'],'value':_0x4e88('0xb9')});var _0x483a32={'id':_0x4f4747+'_'+_0x5234b4[_0x4e88('0x9f')],'name':_0x5234b4[_0x4e88('0xba')][_0x4e88('0xb3')][_0x4e88('0xb6')],'custom':![],'options':_0x258ac5};_0x1f6631['push'](_0x483a32);return _0x1f6631;});}function getInputList(_0x524753,_0xdffb3f,_0x1fef3f,_0x45b323,_0x57943d,_0x325e3b,_0x4d44f6){var _0x15c201={'method':_0x4e88('0x95'),'uri':_0x524753+_0x4e88('0x9a')+_0x57943d+_0x4e88('0xae')+_0x325e3b+')/Microsoft.Dynamics.CRM.'+_0x1fef3f+_0x4e88('0xbb'),'headers':{'Authorization':_0x4e88('0x97')+_0x4d44f6,'If-None-Match':null,'OData-Version':_0x4e88('0x9c')},'json':!![]};return rp(_0x15c201)['then'](function(_0x72bd81){var _0x40feb9={'id':_0xdffb3f+'_'+_0x72bd81['LogicalName'],'name':_0x72bd81[_0x4e88('0xba')][_0x4e88('0xb3')]?_0x72bd81[_0x4e88('0xba')]['UserLocalizedLabel']['Label']:_0x72bd81[_0x4e88('0x9f')],'custom':![],'options':[]};_0x45b323[_0x4e88('0xa2')](_0x40feb9);return _0x45b323;});} \ No newline at end of file +var _0x2964=['owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','data5','data7','access_token','CloudProvider','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','concat','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','params','keys','rawAttributes','find','catch','body','getConfigurations','findOne','Dynamics365Configuration','length','addConfiguration','Subjects','getSubjects','channel','getDescriptions','create','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidyominame','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','entitlementidname','entityimage_url','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon'];(function(_0x532af7,_0x34f52a){var _0x15fa83=function(_0xdf3fbc){while(--_0xdf3fbc){_0x532af7['push'](_0x532af7['shift']());}};_0x15fa83(++_0x34f52a);}(_0x2964,0x108));var _0x4296=function(_0x54cbc5,_0x54cca0){_0x54cbc5=_0x54cbc5-0x0;var _0x2b1a83=_0x2964[_0x54cbc5];return _0x2b1a83;};'use strict';var rp=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var _=require(_0x4296('0x2'));var qs=require(_0x4296('0x3'));var logger=require(_0x4296('0x4'))(_0x4296('0x5'));var db=require(_0x4296('0x6'))['db'];var integrations=require(_0x4296('0x7'));function respondWithResult(_0x155933,_0x4b5bad){_0x4b5bad=_0x4b5bad||0xc8;return function(_0x175352){if(_0x175352){return _0x155933[_0x4296('0x8')](_0x4b5bad)[_0x4296('0x9')](_0x175352);}};}function respondWithFilteredResult(_0x10a454,_0x15d705){return function(_0x273d90){if(_0x273d90){var _0x50a6c5=typeof _0x15d705[_0x4296('0xa')]===_0x4296('0xb')&&typeof _0x15d705[_0x4296('0xc')]===_0x4296('0xb');var _0x35a29a=_0x273d90[_0x4296('0xd')];var _0x3e826e=_0x50a6c5?0x0:_0x15d705[_0x4296('0xa')];var _0x1e3635=_0x50a6c5?_0x273d90[_0x4296('0xd')]:_0x15d705[_0x4296('0xa')]+_0x15d705[_0x4296('0xc')];var _0x5012c2;if(_0x1e3635>=_0x35a29a){_0x1e3635=_0x35a29a;_0x5012c2=0xc8;}else{_0x5012c2=0xce;}_0x10a454[_0x4296('0x8')](_0x5012c2);return _0x10a454[_0x4296('0xe')](_0x4296('0xf'),_0x3e826e+'-'+_0x1e3635+'/'+_0x35a29a)[_0x4296('0x9')](_0x273d90);}return null;};}function saveUpdates(_0x23ba5a){return function(_0x676674){if(_0x676674){return _0x676674[_0x4296('0x10')](_0x23ba5a)['then'](function(_0x302ac3){return _0x302ac3;});}return null;};}function removeEntity(_0x350b4b){return function(_0x3574da){if(_0x3574da){return _0x3574da['destroy']()[_0x4296('0x11')](function(){_0x350b4b[_0x4296('0x8')](0xcc)[_0x4296('0x12')]();});}};}function handleEntityNotFound(_0x53af4b){return function(_0x182910){if(!_0x182910){_0x53af4b[_0x4296('0x13')](0x194);}return _0x182910;};}function handleError(_0x1e7af8,_0x51ae32){_0x51ae32=_0x51ae32||0x1f4;return function(_0x3f5896){logger[_0x4296('0x14')](_0x3f5896[_0x4296('0x15')]);if(_0x3f5896[_0x4296('0x16')]){delete _0x3f5896[_0x4296('0x16')];}_0x1e7af8['status'](_0x51ae32)[_0x4296('0x17')](_0x3f5896);};}exports[_0x4296('0x18')]=function(_0x2d544c,_0x48cac6){var _0x13f40f={},_0x6c50b7={},_0x448f46={'count':0x0,'rows':[]};var _0x3d3b2e=_[_0x4296('0x19')](db[_0x4296('0x1a')]['rawAttributes'],function(_0x33839e){return{'name':_0x33839e[_0x4296('0x1b')],'type':_0x33839e['type'][_0x4296('0x1c')]};});_0x6c50b7[_0x4296('0x1d')]=_[_0x4296('0x19')](_0x3d3b2e,_0x4296('0x16'));_0x6c50b7['query']=_['keys'](_0x2d544c[_0x4296('0x1e')]);_0x6c50b7[_0x4296('0x1f')]=_['intersection'](_0x6c50b7[_0x4296('0x1d')],_0x6c50b7['query']);_0x13f40f[_0x4296('0x20')]=_[_0x4296('0x21')](_0x6c50b7[_0x4296('0x1d')],qs[_0x4296('0x22')](_0x2d544c['query'][_0x4296('0x22')]));_0x13f40f['attributes']=_0x13f40f[_0x4296('0x20')]['length']?_0x13f40f['attributes']:_0x6c50b7[_0x4296('0x1d')];if(!_0x2d544c[_0x4296('0x1e')][_0x4296('0x23')]('nolimit')){_0x13f40f[_0x4296('0xc')]=qs[_0x4296('0xc')](_0x2d544c['query'][_0x4296('0xc')]);_0x13f40f['offset']=qs['offset'](_0x2d544c[_0x4296('0x1e')][_0x4296('0xa')]);}_0x13f40f[_0x4296('0x24')]=qs[_0x4296('0x25')](_0x2d544c[_0x4296('0x1e')][_0x4296('0x25')]);_0x13f40f[_0x4296('0x26')]=qs[_0x4296('0x1f')](_['pick'](_0x2d544c[_0x4296('0x1e')],_0x6c50b7['filters']),_0x3d3b2e);if(_0x2d544c[_0x4296('0x1e')]['filter']){_0x13f40f['where']=_[_0x4296('0x27')](_0x13f40f['where'],{'$or':_[_0x4296('0x19')](_0x3d3b2e,function(_0x1dc461){if(_0x1dc461[_0x4296('0x28')]!==_0x4296('0x29')){var _0x11298f={};_0x11298f[_0x1dc461[_0x4296('0x16')]]={'$like':'%'+_0x2d544c[_0x4296('0x1e')][_0x4296('0x2a')]+'%'};return _0x11298f;}})});}_0x13f40f=_[_0x4296('0x27')]({},_0x13f40f,_0x2d544c[_0x4296('0x2b')]);var _0x13cc79={'where':_0x13f40f['where']};return db['Dynamics365Account'][_0x4296('0xd')](_0x13cc79)[_0x4296('0x11')](function(_0x22bc72){_0x448f46[_0x4296('0xd')]=_0x22bc72;if(_0x2d544c['query']['includeAll']){_0x13f40f[_0x4296('0x2c')]=[{'all':!![]}];}return db[_0x4296('0x1a')][_0x4296('0x2d')](_0x13f40f);})[_0x4296('0x11')](function(_0x5a9c15){_0x448f46[_0x4296('0x2e')]=_0x5a9c15;return _0x448f46;})[_0x4296('0x11')](respondWithFilteredResult(_0x48cac6,_0x13f40f))['catch'](handleError(_0x48cac6,null));};exports['show']=function(_0x583d33,_0xe9f20f){var _0x374054={'raw':![],'where':{'id':_0x583d33[_0x4296('0x2f')]['id']}},_0x4a9445={};_0x4a9445[_0x4296('0x1d')]=_[_0x4296('0x30')](db[_0x4296('0x1a')][_0x4296('0x31')]);_0x4a9445[_0x4296('0x1e')]=_[_0x4296('0x30')](_0x583d33[_0x4296('0x1e')]);_0x4a9445[_0x4296('0x1f')]=_[_0x4296('0x21')](_0x4a9445[_0x4296('0x1d')],_0x4a9445[_0x4296('0x1e')]);_0x374054[_0x4296('0x20')]=_['intersection'](_0x4a9445[_0x4296('0x1d')],qs[_0x4296('0x22')](_0x583d33[_0x4296('0x1e')][_0x4296('0x22')]));_0x374054[_0x4296('0x20')]=_0x374054[_0x4296('0x20')]['length']?_0x374054[_0x4296('0x20')]:_0x4a9445[_0x4296('0x1d')];if(_0x583d33[_0x4296('0x1e')]['includeAll']){_0x374054[_0x4296('0x2c')]=[{'all':!![]}];}_0x374054=_['merge']({},_0x374054,_0x583d33[_0x4296('0x2b')]);return db[_0x4296('0x1a')][_0x4296('0x32')](_0x374054)[_0x4296('0x11')](handleEntityNotFound(_0xe9f20f,null))[_0x4296('0x11')](respondWithResult(_0xe9f20f,null))[_0x4296('0x33')](handleError(_0xe9f20f,null));};exports['create']=function(_0x379f47,_0x19495d){return db['Dynamics365Account']['create'](_0x379f47[_0x4296('0x34')],{})[_0x4296('0x11')](respondWithResult(_0x19495d,0xc9))[_0x4296('0x33')](handleError(_0x19495d,null));};exports[_0x4296('0x10')]=function(_0x74bbd7,_0x592698){if(_0x74bbd7['body']['id']){delete _0x74bbd7[_0x4296('0x34')]['id'];}return db[_0x4296('0x1a')][_0x4296('0x32')]({'where':{'id':_0x74bbd7[_0x4296('0x2f')]['id']}})[_0x4296('0x11')](handleEntityNotFound(_0x592698,null))[_0x4296('0x11')](saveUpdates(_0x74bbd7[_0x4296('0x34')],null))[_0x4296('0x11')](respondWithResult(_0x592698,null))[_0x4296('0x33')](handleError(_0x592698,null));};exports['destroy']=function(_0xaffae0,_0x23a27c){return db[_0x4296('0x1a')]['find']({'where':{'id':_0xaffae0[_0x4296('0x2f')]['id']}})[_0x4296('0x11')](handleEntityNotFound(_0x23a27c,null))['then'](removeEntity(_0x23a27c,null))['catch'](handleError(_0x23a27c,null));};exports[_0x4296('0x35')]=function(_0x2b1aaa,_0x2865d8){var _0x4bd309={};var _0x562fc3={};var _0x54df55;var _0x2d2863;return db[_0x4296('0x1a')][_0x4296('0x36')]({'where':{'id':_0x2b1aaa['params']['id']}})['then'](handleEntityNotFound(_0x2865d8,null))[_0x4296('0x11')](function(_0x1ddb06){if(_0x1ddb06){_0x54df55=_0x1ddb06;_0x562fc3[_0x4296('0x1d')]=_[_0x4296('0x30')](db[_0x4296('0x37')][_0x4296('0x31')]);_0x562fc3[_0x4296('0x1e')]=_[_0x4296('0x30')](_0x2b1aaa['query']);_0x562fc3[_0x4296('0x1f')]=_[_0x4296('0x21')](_0x562fc3[_0x4296('0x1d')],_0x562fc3[_0x4296('0x1e')]);_0x4bd309[_0x4296('0x20')]=_[_0x4296('0x21')](_0x562fc3['model'],qs['fields'](_0x2b1aaa['query'][_0x4296('0x22')]));_0x4bd309[_0x4296('0x20')]=_0x4bd309[_0x4296('0x20')][_0x4296('0x38')]?_0x4bd309['attributes']:_0x562fc3[_0x4296('0x1d')];_0x4bd309[_0x4296('0x24')]=qs[_0x4296('0x25')](_0x2b1aaa[_0x4296('0x1e')][_0x4296('0x25')]);_0x4bd309[_0x4296('0x26')]=qs[_0x4296('0x1f')](_['pick'](_0x2b1aaa[_0x4296('0x1e')],_0x562fc3['filters']));if(_0x2b1aaa['query'][_0x4296('0x2a')]){_0x4bd309[_0x4296('0x26')]=_['merge'](_0x4bd309[_0x4296('0x26')],{'$or':_['map'](_0x4bd309['attributes'],function(_0x3ef143){var _0x41a71c={};_0x41a71c[_0x3ef143]={'$like':'%'+_0x2b1aaa['query']['filter']+'%'};return _0x41a71c;})});}_0x4bd309=_[_0x4296('0x27')]({},_0x4bd309,_0x2b1aaa[_0x4296('0x2b')]);return _0x54df55[_0x4296('0x35')](_0x4bd309);}})[_0x4296('0x11')](function(_0x44b665){if(_0x44b665){_0x2d2863=_0x44b665['length'];if(!_0x2b1aaa[_0x4296('0x1e')][_0x4296('0x23')]('nolimit')){_0x4bd309[_0x4296('0xc')]=qs[_0x4296('0xc')](_0x2b1aaa[_0x4296('0x1e')][_0x4296('0xc')]);_0x4bd309[_0x4296('0xa')]=qs[_0x4296('0xa')](_0x2b1aaa['query'][_0x4296('0xa')]);}return _0x54df55[_0x4296('0x35')](_0x4bd309);}})[_0x4296('0x11')](function(_0xc94881){if(_0xc94881){return _0xc94881?{'count':_0x2d2863,'rows':_0xc94881}:null;}})['then'](respondWithResult(_0x2865d8,null))['catch'](handleError(_0x2865d8,null));};exports[_0x4296('0x39')]=function(_0xf726d0,_0x5d1487){if(_0xf726d0[_0x4296('0x34')]['id']){delete _0xf726d0[_0x4296('0x34')]['id'];}return db[_0x4296('0x1a')][_0x4296('0x36')]({'where':{'id':_0xf726d0[_0x4296('0x2f')]['id']}})['then'](handleEntityNotFound(_0x5d1487,null))[_0x4296('0x11')](function(_0x4dc6c8){if(_0x4dc6c8){_0xf726d0[_0x4296('0x34')]['AccountId']=_0x4dc6c8['id'];_0xf726d0[_0x4296('0x34')][_0x4296('0x3a')]=integrations[_0x4296('0x3b')](_0xf726d0[_0x4296('0x34')][_0x4296('0x3c')],_0xf726d0[_0x4296('0x34')][_0x4296('0x28')]);_0xf726d0[_0x4296('0x34')]['Descriptions']=integrations[_0x4296('0x3d')](_0xf726d0[_0x4296('0x34')][_0x4296('0x3c')],_0xf726d0[_0x4296('0x34')]['type']);return db[_0x4296('0x37')][_0x4296('0x3e')](_0xf726d0[_0x4296('0x34')],{'include':[{'model':db[_0x4296('0x3f')],'as':_0x4296('0x3a')},{'model':db[_0x4296('0x3f')],'as':_0x4296('0x40')}]});}return null;})[_0x4296('0x11')](respondWithResult(_0x5d1487,null))[_0x4296('0x33')](handleError(_0x5d1487,null));};function sanitizeRemoteUri(_0x39d2ed){var _0x1dcee0=_0x39d2ed[_0x4296('0x41')](-0x1);if(_0x1dcee0==='/')return _0x39d2ed[_0x4296('0x42')](0x0,_0x39d2ed[_0x4296('0x43')](_0x1dcee0));return _0x39d2ed;}function getWebApiUrl(_0x896447){return util['format'](_0x4296('0x44'),_0x896447);}exports[_0x4296('0x45')]=function(_0xe4cf57,_0x3c3279){var _0x6e3e2e=_0xe4cf57['query']['ticketType'];var _0x7aacf3=_0x6e3e2e===_0x4296('0x46')?_0x4296('0x47'):_0x4296('0x48');var _0x36aee5='';var _0x43063b='';var _0x284da2='';var _0x538f19='';var _0x5bfef3='';var _0x50af4d='';var _0x14b54e='';var _0x338884='';var _0x139e5c=['title',_0x4296('0x49'),_0x4296('0x4a'),_0x4296('0x4b'),_0x4296('0x4c'),'subject',_0x4296('0x4d'),_0x4296('0x4e'),_0x4296('0x4f'),'phonecall_activity_parties'];var _0x2ca2d7=['accountidname',_0x4296('0x50'),'actualserviceunits','billedserviceunits',_0x4296('0x51'),'contactidyominame',_0x4296('0x52'),_0x4296('0x53'),_0x4296('0x54'),_0x4296('0x55'),_0x4296('0x56'),_0x4296('0x57'),_0x4296('0x58'),'createdonbehalfbyname',_0x4296('0x59'),'customeridname',_0x4296('0x5a'),'customeridyominame','emailaddress',_0x4296('0x5b'),'entityimage_timestamp',_0x4296('0x5c'),'escalatedon','exchangerate',_0x4296('0x5d'),_0x4296('0x5e'),'importsequencenumber',_0x4296('0x5f'),_0x4296('0x60'),'lastonholdtime',_0x4296('0x61'),_0x4296('0x62'),'modifiedbyexternalpartyyominame',_0x4296('0x63'),_0x4296('0x64'),_0x4296('0x65'),_0x4296('0x66'),_0x4296('0x67'),_0x4296('0x68'),'msdyn_iotalertname',_0x4296('0x69'),_0x4296('0x6a'),_0x4296('0x6b'),_0x4296('0x6c'),_0x4296('0x6d'),_0x4296('0x6e'),_0x4296('0x6f'),'primarycontactidname',_0x4296('0x70'),_0x4296('0x71'),_0x4296('0x72'),_0x4296('0x73'),_0x4296('0x74'),_0x4296('0x75'),_0x4296('0x76'),_0x4296('0x77'),_0x4296('0x78'),_0x4296('0x79'),_0x4296('0x7a'),'slaname',_0x4296('0x7b'),_0x4296('0x7c'),_0x4296('0x7d'),_0x4296('0x7e'),'ticketnumber',_0x4296('0x7f'),'transactioncurrencyidname',_0x4296('0x80'),_0x4296('0x81'),_0x4296('0x82')];var _0x57319b=_0x139e5c['concat'](_0x2ca2d7);return db[_0x4296('0x1a')]['findOne']({'where':{'id':_0xe4cf57['params']['id']},'attributes':['id',_0x4296('0x83'),_0x4296('0x84'),_0x4296('0x85'),_0x4296('0x86'),_0x4296('0x87'),_0x4296('0x88'),_0x4296('0x89')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x4296('0x8a'),_0x4296('0x8b')]}]})[_0x4296('0x11')](handleEntityNotFound(_0x3c3279,null))[_0x4296('0x11')](function(_0x532980){if(_0x532980){if(_0x532980[_0x4296('0x89')]){_0x532980[_0x4296('0x8c')]=_0x532980[_0x4296('0x8d')][_0x4296('0x8a')];_0x338884=sanitizeRemoteUri(_0x532980['CloudProvider'][_0x4296('0x8b')]);_0x14b54e=getWebApiUrl(_0x338884);return _0x532980;}_0x338884=sanitizeRemoteUri(_0x532980[_0x4296('0x85')]);_0x14b54e=getWebApiUrl(_0x338884);var _0x242be3={'method':_0x4296('0x8e'),'uri':_0x4296('0x8f')+_0x532980[_0x4296('0x86')]+_0x4296('0x90'),'form':{'client_id':_0x532980[_0x4296('0x87')],'resource':_0x338884,'username':_0x532980[_0x4296('0x83')],'password':_0x532980[_0x4296('0x84')],'grant_type':_0x4296('0x84'),'client_secret':_0x532980[_0x4296('0x88')]},'json':!![]};return rp(_0x242be3);}})[_0x4296('0x11')](function(_0x2190dd){_0x50af4d=_0x2190dd[_0x4296('0x8c')];var _0xde4bd5={'method':_0x4296('0x91'),'uri':encodeURI(_0x14b54e+_0x4296('0x92')+_0x7aacf3+'\x27'),'headers':{'Authorization':_0x4296('0x93')+_0x50af4d,'If-None-Match':null,'OData-Version':_0x4296('0x94')},'json':!![]};return rp(_0xde4bd5);})[_0x4296('0x11')](function(_0x41acef){var _0x4e6e45=_0x41acef['value'][0x0];var _0x4af67c=_0x4e6e45[_0x4296('0x95')];var _0x1adb32={'method':'GET','uri':_0x14b54e+_0x4296('0x96')+_0x4af67c+_0x4296('0x97'),'headers':{'Authorization':_0x4296('0x93')+_0x50af4d,'If-None-Match':null,'OData-Version':_0x4296('0x94')},'json':!![]};return rp(_0x1adb32);})['then'](function(_0x26bd3b){_0x36aee5=_0x26bd3b;_0x43063b=_0x36aee5[_0x4296('0x98')];_0x43063b=_['remove'](_0x43063b,function(_0x1b4984){return!_0x57319b[_0x4296('0x99')](_0x1b4984['LogicalName']);});var _0x435ef0=[];var _0x2ca1ef=[];_0x43063b[_0x4296('0x9a')](function(_0x4be975){if(_0x4be975[_0x4296('0x9b')]){var _0x27e017=_0x4be975[_0x4296('0x9b')][_0x4296('0x42')](_0x4be975[_0x4296('0x9b')]['lastIndexOf']('.')+0x1);if(_0x27e017===_0x4296('0x9c')){_0x435ef0[_0x4296('0x9d')](getSelectList(_0x14b54e,_0x6e3e2e,_0x2ca1ef,_0x36aee5['MetadataId'],_0x4be975[_0x4296('0x95')],_0x50af4d));}}});return Promise[_0x4296('0x9e')](_0x435ef0);})['then'](function(_0x49efab){_0x284da2=_0x49efab[0x0];var _0x12d001=[];var _0x46a875=[];_0x43063b['forEach'](function(_0x5c81c3){if(!_[_0x4296('0x9f')](_0x5c81c3['@odata.type'])){var _0x4ed167=_0x5c81c3[_0x4296('0x9b')]['substring'](_0x5c81c3[_0x4296('0x9b')]['lastIndexOf']('.')+0x1);if(_0x4ed167===_0x4296('0xa0')){_0x12d001[_0x4296('0x9d')](getBooleanList(_0x14b54e,_0x6e3e2e,_0x46a875,_0x36aee5['MetadataId'],_0x5c81c3[_0x4296('0x95')],_0x50af4d));}}});return Promise[_0x4296('0x9e')](_0x12d001);})[_0x4296('0x11')](function(_0xd2d03){_0x538f19=_0xd2d03[0x0];var _0x2c4917=[];var _0x43ee11=[];_0x43063b[_0x4296('0x9a')](function(_0x40f669){if(_0x40f669[_0x4296('0x9b')]){var _0x29d2dc=_0x40f669[_0x4296('0x9b')]['substring'](_0x40f669[_0x4296('0x9b')][_0x4296('0x43')]('.')+0x1);if(_0x29d2dc==='StringAttributeMetadata'||_0x29d2dc===_0x4296('0xa1')||_0x29d2dc===_0x4296('0xa2')||_0x29d2dc===_0x4296('0xa3')||_0x29d2dc===_0x4296('0xa4')||_0x29d2dc===_0x4296('0xa5')||_0x29d2dc==='StatusAttributeMetadata'||_0x29d2dc===_0x4296('0xa6')||_0x29d2dc==='StateAttributeMetadata'||_0x29d2dc==='DecimalAttributeMetadata'){_0x2c4917[_0x4296('0x9d')](getInputList(_0x14b54e,_0x6e3e2e,_0x29d2dc,_0x43ee11,_0x36aee5[_0x4296('0x95')],_0x40f669[_0x4296('0x95')],_0x50af4d));}}});return Promise[_0x4296('0x9e')](_0x2c4917);})[_0x4296('0x11')](function(_0x34f748){_0x5bfef3=_0x34f748[0x0];var _0x53c8f0=_0x284da2[_0x4296('0xa7')](_0x538f19)[_0x4296('0xa7')](_0x5bfef3);var _0x59fbc3={'count':_0x53c8f0[_0x4296('0x38')],'rows':_0x53c8f0};return _0x59fbc3;})[_0x4296('0x11')](respondWithResult(_0x3c3279,null))[_0x4296('0x33')](function(_0x5ee5a7){var _0x5e06e6=_0xe4cf57[_0x4296('0x1e')][_0x4296('0xa8')]?0x1f4:_0x5ee5a7['statusCode']||0x1f4;logger[_0x4296('0x14')](_0x5ee5a7[_0x4296('0x15')]);delete _0x5ee5a7['name'];if(_0x5e06e6===0x191){_0x5e06e6=0x190;}_0x3c3279['status'](_0x5e06e6)[_0x4296('0x17')](_0xe4cf57[_0x4296('0x1e')][_0x4296('0xa8')]?{'message':_0x4296('0xa9'),'statusCode':_0x5ee5a7['statusCode']}:_0x5ee5a7);});};function getSelectList(_0x1491b0,_0x3cb5e6,_0x5d3939,_0x29f3a7,_0x4e8540,_0x1dfd3a){var _0x465ce2={'method':_0x4296('0x91'),'uri':_0x1491b0+'EntityDefinitions('+_0x29f3a7+')/Attributes('+_0x4e8540+_0x4296('0xaa')+_0x4296('0xab'),'headers':{'Authorization':_0x4296('0x93')+_0x1dfd3a,'If-None-Match':null,'OData-Version':_0x4296('0x94')},'json':!![]};return rp(_0x465ce2)[_0x4296('0x11')](function(_0x3c50dc){var _0x859b54=[];var _0x4487bc=_0x3c50dc['OptionSet'][_0x4296('0xac')];_0x4487bc['forEach'](function(_0x141577){_0x859b54[_0x4296('0x9d')]({'name':_0x141577['Label'][_0x4296('0xad')][_0x4296('0xae')],'value':String(_0x141577['Value'])});});var _0x475949={'id':_0x3cb5e6+'_'+_0x3c50dc['LogicalName'],'name':_0x3c50dc[_0x4296('0xaf')][_0x4296('0xad')]['Label'],'custom':![],'options':_0x859b54};_0x5d3939[_0x4296('0x9d')](_0x475949);return _0x5d3939;});}function getBooleanList(_0x33009e,_0x161d7e,_0x404174,_0x1c55b6,_0xb5e199,_0x404703){var _0x2344dd={'method':_0x4296('0x91'),'uri':_0x33009e+'EntityDefinitions('+_0x1c55b6+_0x4296('0xb0')+_0xb5e199+_0x4296('0xb1'),'headers':{'Authorization':'Bearer\x20'+_0x404703,'If-None-Match':null,'OData-Version':_0x4296('0x94')},'json':!![]};return rp(_0x2344dd)['then'](function(_0x4ffb65){var _0x1dfc52=[];_0x1dfc52[_0x4296('0x9d')]({'name':_0x4ffb65[_0x4296('0xb2')][_0x4296('0xb3')]['Label'][_0x4296('0xad')][_0x4296('0xae')],'value':_0x4296('0xb4')},{'name':_0x4ffb65[_0x4296('0xb2')][_0x4296('0xb5')]['Label'][_0x4296('0xad')][_0x4296('0xae')],'value':_0x4296('0xb6')});var _0x2a1fb6={'id':_0x161d7e+'_'+_0x4ffb65['LogicalName'],'name':_0x4ffb65[_0x4296('0xaf')][_0x4296('0xad')][_0x4296('0xae')],'custom':![],'options':_0x1dfc52};_0x404174['push'](_0x2a1fb6);return _0x404174;});}function getInputList(_0x83f762,_0x2b2b6d,_0x1cf98,_0x4f5317,_0x6d36b9,_0x5b6f94,_0xe448e5){var _0x6b63e7={'method':_0x4296('0x91'),'uri':_0x83f762+_0x4296('0x96')+_0x6d36b9+_0x4296('0xb0')+_0x5b6f94+_0x4296('0xb7')+_0x1cf98+_0x4296('0xb8'),'headers':{'Authorization':_0x4296('0x93')+_0xe448e5,'If-None-Match':null,'OData-Version':_0x4296('0x94')},'json':!![]};return rp(_0x6b63e7)['then'](function(_0xbf35d5){var _0x39156f={'id':_0x2b2b6d+'_'+_0xbf35d5[_0x4296('0xb9')],'name':_0xbf35d5['DisplayName'][_0x4296('0xad')]?_0xbf35d5[_0x4296('0xaf')][_0x4296('0xad')]['Label']:_0xbf35d5['LogicalName'],'custom':![],'options':[]};_0x4f5317[_0x4296('0x9d')](_0x39156f);return _0x4f5317;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2af04f5..2fc9d29 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x386ef3,_0x5837e2){var _0x5e92af=function(_0x1c3bca){while(--_0x1c3bca){_0x386ef3['push'](_0x386ef3['shift']());}};_0x5e92af(++_0x5837e2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _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(_0x4f6274,_0x2b8f02){var _0x3a575b=function(_0x179bd4){while(--_0x179bd4){_0x4f6274['push'](_0x4f6274['shift']());}};_0x3a575b(++_0x2b8f02);}(_0xe706,0xa3));var _0x6e70=function(_0x482115,_0x5550f5){_0x482115=_0x482115-0x0;var _0x40afb4=_0xe706[_0x482115];return _0x40afb4;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 74d474d..e433297 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 _0xc7fa=['attributes','limit','map','include','model','ShowDynamics365Account','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where'];(function(_0x176671,_0x1127b0){var _0x46e12b=function(_0x49f910){while(--_0x49f910){_0x176671['push'](_0x176671['shift']());}};_0x46e12b(++_0x1127b0);}(_0xc7fa,0xf5));var _0xac7f=function(_0x25fd5d,_0x4fabf7){_0x25fd5d=_0x25fd5d-0x0;var _0x51d403=_0xc7fa[_0x25fd5d];return _0x51d403;};'use strict';var _=require(_0xac7f('0x0'));var util=require(_0xac7f('0x1'));var moment=require(_0xac7f('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7f('0x3'));var fs=require('fs');var Redis=require(_0xac7f('0x4'));var db=require(_0xac7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7f('0x6'))(_0xac7f('0x7'));var config=require(_0xac7f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xac7f('0x9')][_0xac7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef058,_0x452d71,_0x524162){return new BPromise(function(_0x3e5ea8,_0x2a6b80){return client[_0xac7f('0xb')](_0x5ef058,_0x524162)[_0xac7f('0xc')](function(_0x5aa411){logger[_0xac7f('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x452d71,'request\x20sent');logger[_0xac7f('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x452d71,_0xac7f('0xf'),JSON[_0xac7f('0x10')](_0x5aa411));if(_0x5aa411[_0xac7f('0x11')]){if(_0x5aa411[_0xac7f('0x11')]['code']===0x1f4){logger['error'](_0xac7f('0x12'),_0x452d71,_0x5aa411[_0xac7f('0x11')][_0xac7f('0x13')]);return _0x2a6b80(_0x5aa411[_0xac7f('0x11')][_0xac7f('0x13')]);}logger[_0xac7f('0x11')](_0xac7f('0x12'),_0x452d71,_0x5aa411[_0xac7f('0x11')][_0xac7f('0x13')]);return _0x3e5ea8(_0x5aa411[_0xac7f('0x11')][_0xac7f('0x13')]);}else{logger[_0xac7f('0xd')](_0xac7f('0x12'),_0x452d71,_0xac7f('0xf'));_0x3e5ea8(_0x5aa411[_0xac7f('0x14')][_0xac7f('0x13')]);}})['catch'](function(_0x1db548){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x452d71,_0x1db548);_0x2a6b80(_0x1db548);});});}exports[_0xac7f('0x15')]=function(_0x2c2ee0){var _0x61f885=this;return new Promise(function(_0x22b06b,_0x25f18e){return db[_0xac7f('0x16')][_0xac7f('0x17')]({'raw':_0x2c2ee0['options']?_0x2c2ee0[_0xac7f('0x18')][_0xac7f('0x19')]===undefined?!![]:![]:!![],'where':_0x2c2ee0['options']?_0x2c2ee0['options'][_0xac7f('0x1a')]||null:null,'attributes':_0x2c2ee0[_0xac7f('0x18')]?_0x2c2ee0[_0xac7f('0x18')][_0xac7f('0x1b')]||null:null,'limit':_0x2c2ee0[_0xac7f('0x18')]?_0x2c2ee0['options'][_0xac7f('0x1c')]||null:null,'include':_0x2c2ee0[_0xac7f('0x18')]?_0x2c2ee0['options']['include']?_[_0xac7f('0x1d')](_0x2c2ee0[_0xac7f('0x18')][_0xac7f('0x1e')],function(_0x3249d7){return{'model':db[_0x3249d7[_0xac7f('0x1f')]],'as':_0x3249d7['as'],'attributes':_0x3249d7[_0xac7f('0x1b')],'include':_0x3249d7[_0xac7f('0x1e')]?_[_0xac7f('0x1d')](_0x3249d7[_0xac7f('0x1e')],function(_0x4147e3){return{'model':db[_0x4147e3[_0xac7f('0x1f')]],'as':_0x4147e3['as'],'attributes':_0x4147e3['attributes'],'include':_0x4147e3[_0xac7f('0x1e')]?_[_0xac7f('0x1d')](_0x4147e3['include'],function(_0x48be4f){return{'model':db[_0x48be4f[_0xac7f('0x1f')]],'as':_0x48be4f['as'],'attributes':_0x48be4f[_0xac7f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac7f('0xc')](function(_0x16c62c){logger[_0xac7f('0xd')]('GetDynamics365Account',_0x2c2ee0);logger[_0xac7f('0xe')]('GetDynamics365Account',_0x2c2ee0,JSON[_0xac7f('0x10')](_0x16c62c));_0x22b06b(_0x16c62c);})['catch'](function(_0x485d7a){logger[_0xac7f('0x11')](_0xac7f('0x15'),_0x485d7a[_0xac7f('0x13')],_0x2c2ee0);_0x25f18e(_0x61f885[_0xac7f('0x11')](0x1f4,_0x485d7a['message']));});});};exports[_0xac7f('0x20')]=function(_0x26ab6b){var _0x543c49=this;return new Promise(function(_0x4fe45e,_0x3051b9){return db['Dynamics365Account']['find']({'raw':_0x26ab6b[_0xac7f('0x18')]?_0x26ab6b[_0xac7f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x26ab6b[_0xac7f('0x18')]?_0x26ab6b[_0xac7f('0x18')][_0xac7f('0x1a')]||null:null,'attributes':_0x26ab6b[_0xac7f('0x18')]?_0x26ab6b[_0xac7f('0x18')]['attributes']||null:null,'include':_0x26ab6b['options']?_0x26ab6b[_0xac7f('0x18')][_0xac7f('0x1e')]?_[_0xac7f('0x1d')](_0x26ab6b['options'][_0xac7f('0x1e')],function(_0x236b80){return{'model':db[_0x236b80[_0xac7f('0x1f')]],'as':_0x236b80['as'],'attributes':_0x236b80['attributes'],'include':_0x236b80['include']?_['map'](_0x236b80['include'],function(_0x2b52a5){return{'model':db[_0x2b52a5[_0xac7f('0x1f')]],'as':_0x2b52a5['as'],'attributes':_0x2b52a5[_0xac7f('0x1b')],'include':_0x2b52a5['include']?_['map'](_0x2b52a5[_0xac7f('0x1e')],function(_0x22bc5c){return{'model':db[_0x22bc5c['model']],'as':_0x22bc5c['as'],'attributes':_0x22bc5c['attributes']};}):[]};}):[]};}):[]:[]})[_0xac7f('0xc')](function(_0x5ddf04){logger[_0xac7f('0xd')](_0xac7f('0x20'),_0x26ab6b);logger[_0xac7f('0xe')]('ShowDynamics365Account',_0x26ab6b,JSON[_0xac7f('0x10')](_0x5ddf04));_0x4fe45e(_0x5ddf04);})[_0xac7f('0x21')](function(_0x3bbfb1){logger['error']('ShowDynamics365Account',_0x3bbfb1[_0xac7f('0x13')],_0x26ab6b);_0x3051b9(_0x543c49[_0xac7f('0x11')](0x1f4,_0x3bbfb1[_0xac7f('0x13')]));});});}; \ No newline at end of file +var _0x2d88=['ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','model','attributes','map'];(function(_0x75bc91,_0x1ed99d){var _0x9dddc6=function(_0x283fd8){while(--_0x283fd8){_0x75bc91['push'](_0x75bc91['shift']());}};_0x9dddc6(++_0x1ed99d);}(_0x2d88,0xec));var _0x82d8=function(_0x4c3f30,_0x419650){_0x4c3f30=_0x4c3f30-0x0;var _0x45e5ed=_0x2d88[_0x4c3f30];return _0x45e5ed;};'use strict';var _=require(_0x82d8('0x0'));var util=require(_0x82d8('0x1'));var moment=require(_0x82d8('0x2'));var BPromise=require(_0x82d8('0x3'));var rs=require(_0x82d8('0x4'));var fs=require('fs');var Redis=require(_0x82d8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x82d8('0x6'));var logger=require(_0x82d8('0x7'))(_0x82d8('0x8'));var config=require(_0x82d8('0x9'));var jayson=require(_0x82d8('0xa'));var client=jayson[_0x82d8('0xb')][_0x82d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44b2dd,_0x204862,_0x260459){return new BPromise(function(_0x139617,_0x37db01){return client[_0x82d8('0xd')](_0x44b2dd,_0x260459)[_0x82d8('0xe')](function(_0x40c43b){logger[_0x82d8('0xf')](_0x82d8('0x10'),_0x204862,_0x82d8('0x11'));logger[_0x82d8('0x12')](_0x82d8('0x13'),_0x204862,'request\x20sent',JSON[_0x82d8('0x14')](_0x40c43b));if(_0x40c43b['error']){if(_0x40c43b[_0x82d8('0x15')][_0x82d8('0x16')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x204862,_0x40c43b[_0x82d8('0x15')]['message']);return _0x37db01(_0x40c43b['error'][_0x82d8('0x17')]);}logger[_0x82d8('0x15')](_0x82d8('0x10'),_0x204862,_0x40c43b['error'][_0x82d8('0x17')]);return _0x139617(_0x40c43b[_0x82d8('0x15')][_0x82d8('0x17')]);}else{logger[_0x82d8('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x204862,_0x82d8('0x11'));_0x139617(_0x40c43b[_0x82d8('0x18')]['message']);}})[_0x82d8('0x19')](function(_0x378bbb){logger[_0x82d8('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x204862,_0x378bbb);_0x37db01(_0x378bbb);});});}exports[_0x82d8('0x1a')]=function(_0x28d895){var _0x1d96e5=this;return new Promise(function(_0x1181e8,_0x327023){return db[_0x82d8('0x1b')][_0x82d8('0x1c')]({'raw':_0x28d895[_0x82d8('0x1d')]?_0x28d895[_0x82d8('0x1d')][_0x82d8('0x1e')]===undefined?!![]:![]:!![],'where':_0x28d895[_0x82d8('0x1d')]?_0x28d895[_0x82d8('0x1d')][_0x82d8('0x1f')]||null:null,'attributes':_0x28d895[_0x82d8('0x1d')]?_0x28d895[_0x82d8('0x1d')]['attributes']||null:null,'limit':_0x28d895[_0x82d8('0x1d')]?_0x28d895[_0x82d8('0x1d')][_0x82d8('0x20')]||null:null,'include':_0x28d895[_0x82d8('0x1d')]?_0x28d895['options']['include']?_['map'](_0x28d895[_0x82d8('0x1d')][_0x82d8('0x21')],function(_0x222f06){return{'model':db[_0x222f06[_0x82d8('0x22')]],'as':_0x222f06['as'],'attributes':_0x222f06[_0x82d8('0x23')],'include':_0x222f06[_0x82d8('0x21')]?_['map'](_0x222f06[_0x82d8('0x21')],function(_0x3d24d9){return{'model':db[_0x3d24d9['model']],'as':_0x3d24d9['as'],'attributes':_0x3d24d9[_0x82d8('0x23')],'include':_0x3d24d9[_0x82d8('0x21')]?_[_0x82d8('0x24')](_0x3d24d9[_0x82d8('0x21')],function(_0x46b533){return{'model':db[_0x46b533[_0x82d8('0x22')]],'as':_0x46b533['as'],'attributes':_0x46b533[_0x82d8('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x348a54){logger[_0x82d8('0xf')]('GetDynamics365Account',_0x28d895);logger[_0x82d8('0x12')]('GetDynamics365Account',_0x28d895,JSON['stringify'](_0x348a54));_0x1181e8(_0x348a54);})[_0x82d8('0x19')](function(_0x2598fb){logger[_0x82d8('0x15')](_0x82d8('0x1a'),_0x2598fb[_0x82d8('0x17')],_0x28d895);_0x327023(_0x1d96e5[_0x82d8('0x15')](0x1f4,_0x2598fb[_0x82d8('0x17')]));});});};exports[_0x82d8('0x25')]=function(_0x4c51c2){var _0x42b1fa=this;return new Promise(function(_0x2230e3,_0x4460e6){return db[_0x82d8('0x1b')][_0x82d8('0x26')]({'raw':_0x4c51c2[_0x82d8('0x1d')]?_0x4c51c2['options'][_0x82d8('0x1e')]===undefined?!![]:![]:!![],'where':_0x4c51c2[_0x82d8('0x1d')]?_0x4c51c2['options'][_0x82d8('0x1f')]||null:null,'attributes':_0x4c51c2[_0x82d8('0x1d')]?_0x4c51c2[_0x82d8('0x1d')][_0x82d8('0x23')]||null:null,'include':_0x4c51c2[_0x82d8('0x1d')]?_0x4c51c2['options'][_0x82d8('0x21')]?_[_0x82d8('0x24')](_0x4c51c2[_0x82d8('0x1d')][_0x82d8('0x21')],function(_0x2ff150){return{'model':db[_0x2ff150[_0x82d8('0x22')]],'as':_0x2ff150['as'],'attributes':_0x2ff150[_0x82d8('0x23')],'include':_0x2ff150[_0x82d8('0x21')]?_[_0x82d8('0x24')](_0x2ff150[_0x82d8('0x21')],function(_0x23311a){return{'model':db[_0x23311a[_0x82d8('0x22')]],'as':_0x23311a['as'],'attributes':_0x23311a[_0x82d8('0x23')],'include':_0x23311a['include']?_['map'](_0x23311a['include'],function(_0x233657){return{'model':db[_0x233657[_0x82d8('0x22')]],'as':_0x233657['as'],'attributes':_0x233657[_0x82d8('0x23')]};}):[]};}):[]};}):[]:[]})[_0x82d8('0xe')](function(_0x4734e5){logger[_0x82d8('0xf')]('ShowDynamics365Account',_0x4c51c2);logger['debug']('ShowDynamics365Account',_0x4c51c2,JSON[_0x82d8('0x14')](_0x4734e5));_0x2230e3(_0x4734e5);})[_0x82d8('0x19')](function(_0x495a01){logger[_0x82d8('0x15')](_0x82d8('0x25'),_0x495a01['message'],_0x4c51c2);_0x4460e6(_0x42b1fa[_0x82d8('0x15')](0x1f4,_0x495a01[_0x82d8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6119e5b..24e084c 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 _0xf643=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','update'];(function(_0x4286ad,_0x5a99ed){var _0x4382d3=function(_0xdc43a8){while(--_0xdc43a8){_0x4286ad['push'](_0x4286ad['shift']());}};_0x4382d3(++_0x5a99ed);}(_0xf643,0x122));var _0x3f64=function(_0x18847a,_0xd6898e){_0x18847a=_0x18847a-0x0;var _0x5b68ca=_0xf643[_0x18847a];return _0x5b68ca;};'use strict';var multer=require(_0x3f64('0x0'));var util=require(_0x3f64('0x1'));var path=require(_0x3f64('0x2'));var timeout=require(_0x3f64('0x3'));var express=require('express');var router=express[_0x3f64('0x4')]();var fs_extra=require(_0x3f64('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3f64('0x6'));var config=require(_0x3f64('0x7'));var controller=require(_0x3f64('0x8'));router[_0x3f64('0x9')]('/',auth[_0x3f64('0xa')](),controller[_0x3f64('0xb')]);router[_0x3f64('0x9')](_0x3f64('0xc'),auth[_0x3f64('0xa')](),controller[_0x3f64('0xd')]);router[_0x3f64('0x9')](_0x3f64('0xe'),auth[_0x3f64('0xa')](),controller[_0x3f64('0xf')]);router[_0x3f64('0x9')]('/:id/subjects',auth[_0x3f64('0xa')](),controller[_0x3f64('0x10')]);router[_0x3f64('0x9')]('/:id/descriptions',auth[_0x3f64('0xa')](),controller[_0x3f64('0x11')]);router[_0x3f64('0x12')]('/',auth[_0x3f64('0xa')](),controller[_0x3f64('0x13')]);router[_0x3f64('0x14')](_0x3f64('0xc'),auth[_0x3f64('0xa')](),controller[_0x3f64('0x15')]);router[_0x3f64('0x16')](_0x3f64('0xc'),auth[_0x3f64('0xa')](),controller['destroy']);module[_0x3f64('0x17')]=router; \ No newline at end of file +var _0xe511=['create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','show','getFields','/:id/subjects','isAuthenticated','getSubjects','getDescriptions','post'];(function(_0x545ba4,_0x377a36){var _0x214e40=function(_0x4a4d0f){while(--_0x4a4d0f){_0x545ba4['push'](_0x545ba4['shift']());}};_0x214e40(++_0x377a36);}(_0xe511,0x16f));var _0x1e51=function(_0x543341,_0x25271a){_0x543341=_0x543341-0x0;var _0x59362b=_0xe511[_0x543341];return _0x59362b;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/descriptions',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x12')]('/:id',auth[_0x1e51('0xd')](),controller[_0x1e51('0x13')]);router[_0x1e51('0x14')](_0x1e51('0x15'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x16')]);module[_0x1e51('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 2f721a3..3567171 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 _0xc390=['STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN','sequelize','exports'];(function(_0x2b0464,_0x231a86){var _0x23992b=function(_0x23464e){while(--_0x23464e){_0x2b0464['push'](_0x2b0464['shift']());}};_0x23992b(++_0x231a86);}(_0xc390,0x85));var _0x0c39=function(_0xad132d,_0xe39bac){_0xad132d=_0xad132d-0x0;var _0x4e0963=_0xc390[_0xad132d];return _0x4e0963;};'use strict';var Sequelize=require(_0x0c39('0x0'));module[_0x0c39('0x1')]={'name':{'type':Sequelize[_0x0c39('0x2')]},'description':{'type':Sequelize[_0x0c39('0x2')]},'ticketType':{'type':Sequelize[_0x0c39('0x3')](_0x0c39('0x4'),_0x0c39('0x5')),'defaultValue':_0x0c39('0x4')},'moduleCreate':{'type':Sequelize[_0x0c39('0x3')](_0x0c39('0x6'),_0x0c39('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0c39('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0c39('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xad0f=['exports','STRING','incident','phonecall','ENUM','contact','nothing','sequelize'];(function(_0x3d8c76,_0x4bf40e){var _0x3de364=function(_0x3b87cc){while(--_0x3b87cc){_0x3d8c76['push'](_0x3d8c76['shift']());}};_0x3de364(++_0x4bf40e);}(_0xad0f,0x1d7));var _0xfad0=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xad0f[_0x59d89e];return _0x554e93;};'use strict';var Sequelize=require(_0xfad0('0x0'));module[_0xfad0('0x1')]={'name':{'type':Sequelize[_0xfad0('0x2')]},'description':{'type':Sequelize[_0xfad0('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xfad0('0x3'),_0xfad0('0x4')),'defaultValue':_0xfad0('0x3')},'moduleCreate':{'type':Sequelize[_0xfad0('0x5')](_0xfad0('0x6'),_0xfad0('0x7')),'defaultValue':_0xfad0('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xfad0('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 295378e..938bda9 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 _0x0140=['pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','find','catch','body','params','getFields','Dynamics365Field','rawAttributes','getSubjects','findOne','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','Dynamics365Configuration','fieldName','type','model','map','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x12bae4,_0x2b3a75){var _0x263880=function(_0x2cc494){while(--_0x2cc494){_0x12bae4['push'](_0x12bae4['shift']());}};_0x263880(++_0x2b3a75);}(_0x0140,0x64));var _0x0014=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x0140[_0x556bb1];return _0x45455f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0014('0x0'));var zipdir=require(_0x0014('0x1'));var jsonpatch=require(_0x0014('0x2'));var rp=require(_0x0014('0x3'));var moment=require(_0x0014('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0014('0x5'));var util=require(_0x0014('0x6'));var path=require(_0x0014('0x7'));var sox=require(_0x0014('0x8'));var csv=require('to-csv');var ejs=require(_0x0014('0x9'));var fs=require('fs');var fs_extra=require(_0x0014('0xa'));var _=require('lodash');var squel=require(_0x0014('0xb'));var crypto=require(_0x0014('0xc'));var jsforce=require(_0x0014('0xd'));var deskjs=require(_0x0014('0xe'));var toCsv=require(_0x0014('0xf'));var querystring=require('querystring');var Papa=require(_0x0014('0x10'));var Redis=require(_0x0014('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0014('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0014('0x13'));var logger=require('../../config/logger')(_0x0014('0x14'));var utils=require(_0x0014('0x15'));var config=require(_0x0014('0x16'));var licenseUtil=require(_0x0014('0x17'));var db=require(_0x0014('0x18'))['db'];function respondWithStatusCode(_0x2dd295,_0x14571a){_0x14571a=_0x14571a||0xcc;return function(_0x349769){if(_0x349769){return _0x2dd295[_0x0014('0x19')](_0x14571a);}return _0x2dd295[_0x0014('0x1a')](_0x14571a)[_0x0014('0x1b')]();};}function respondWithResult(_0xc889af,_0x2a2746){_0x2a2746=_0x2a2746||0xc8;return function(_0x52f4d0){if(_0x52f4d0){return _0xc889af[_0x0014('0x1a')](_0x2a2746)[_0x0014('0x1c')](_0x52f4d0);}};}function respondWithFilteredResult(_0x358624,_0x27ce23){return function(_0x1ba45d){if(_0x1ba45d){var _0x13ee16=typeof _0x27ce23[_0x0014('0x1d')]===_0x0014('0x1e')&&typeof _0x27ce23[_0x0014('0x1f')]===_0x0014('0x1e');var _0x2023df=_0x1ba45d[_0x0014('0x20')];var _0x1ccebe=_0x13ee16?0x0:_0x27ce23['offset'];var _0x4cf27d=_0x13ee16?_0x1ba45d[_0x0014('0x20')]:_0x27ce23[_0x0014('0x1d')]+_0x27ce23['limit'];var _0x3c2fb0;if(_0x4cf27d>=_0x2023df){_0x4cf27d=_0x2023df;_0x3c2fb0=0xc8;}else{_0x3c2fb0=0xce;}_0x358624['status'](_0x3c2fb0);return _0x358624[_0x0014('0x21')](_0x0014('0x22'),_0x1ccebe+'-'+_0x4cf27d+'/'+_0x2023df)['json'](_0x1ba45d);}return null;};}function patchUpdates(_0x57710f){return function(_0x27d4f0){try{jsonpatch[_0x0014('0x23')](_0x27d4f0,_0x57710f,!![]);}catch(_0x1da188){return BPromise[_0x0014('0x24')](_0x1da188);}return _0x27d4f0[_0x0014('0x25')]();};}function saveUpdates(_0x331926,_0x402226){return function(_0xe48f36){if(_0xe48f36){return _0xe48f36[_0x0014('0x26')](_0x331926)[_0x0014('0x27')](function(_0x4a91e3){return _0x4a91e3;});}return null;};}function removeEntity(_0x23ebb5,_0x12cbe5){return function(_0x14450b){if(_0x14450b){return _0x14450b[_0x0014('0x28')]()['then'](function(){_0x23ebb5['status'](0xcc)[_0x0014('0x1b')]();});}};}function handleEntityNotFound(_0x2c344d,_0x1e18e5){return function(_0x397c){if(!_0x397c){_0x2c344d['sendStatus'](0x194);}return _0x397c;};}function handleError(_0x1b5a1e,_0x2c191b){_0x2c191b=_0x2c191b||0x1f4;return function(_0x40e9ef){logger['error'](_0x40e9ef[_0x0014('0x29')]);if(_0x40e9ef['name']){delete _0x40e9ef['name'];}_0x1b5a1e[_0x0014('0x1a')](_0x2c191b)[_0x0014('0x2a')](_0x40e9ef);};}exports[_0x0014('0x2b')]=function(_0x4f9b3e,_0x527f49){var _0x4fe818={},_0x3fb48e={},_0x5ca3ea={'count':0x0,'rows':[]};var _0x525997=_['map'](db[_0x0014('0x2c')]['rawAttributes'],function(_0xe70489){return{'name':_0xe70489[_0x0014('0x2d')],'type':_0xe70489[_0x0014('0x2e')]['key']};});_0x3fb48e[_0x0014('0x2f')]=_[_0x0014('0x30')](_0x525997,_0x0014('0x31'));_0x3fb48e['query']=_[_0x0014('0x32')](_0x4f9b3e[_0x0014('0x33')]);_0x3fb48e[_0x0014('0x34')]=_[_0x0014('0x35')](_0x3fb48e[_0x0014('0x2f')],_0x3fb48e[_0x0014('0x33')]);_0x4fe818['attributes']=_[_0x0014('0x35')](_0x3fb48e[_0x0014('0x2f')],qs[_0x0014('0x36')](_0x4f9b3e[_0x0014('0x33')][_0x0014('0x36')]));_0x4fe818[_0x0014('0x37')]=_0x4fe818[_0x0014('0x37')][_0x0014('0x38')]?_0x4fe818[_0x0014('0x37')]:_0x3fb48e[_0x0014('0x2f')];if(!_0x4f9b3e['query']['hasOwnProperty'](_0x0014('0x39'))){_0x4fe818[_0x0014('0x1f')]=qs[_0x0014('0x1f')](_0x4f9b3e[_0x0014('0x33')][_0x0014('0x1f')]);_0x4fe818['offset']=qs[_0x0014('0x1d')](_0x4f9b3e['query'][_0x0014('0x1d')]);}_0x4fe818[_0x0014('0x3a')]=qs[_0x0014('0x3b')](_0x4f9b3e[_0x0014('0x33')][_0x0014('0x3b')]);_0x4fe818['where']=qs[_0x0014('0x34')](_[_0x0014('0x3c')](_0x4f9b3e[_0x0014('0x33')],_0x3fb48e[_0x0014('0x34')]),_0x525997);if(_0x4f9b3e[_0x0014('0x33')][_0x0014('0x3d')]){_0x4fe818[_0x0014('0x3e')]=_[_0x0014('0x3f')](_0x4fe818[_0x0014('0x3e')],{'$or':_['map'](_0x525997,function(_0x217d37){if(_0x217d37[_0x0014('0x2e')]!==_0x0014('0x40')){var _0x2c87b8={};_0x2c87b8[_0x217d37[_0x0014('0x31')]]={'$like':'%'+_0x4f9b3e['query']['filter']+'%'};return _0x2c87b8;}})});}_0x4fe818=_[_0x0014('0x3f')]({},_0x4fe818,_0x4f9b3e[_0x0014('0x41')]);var _0x58ce6d={'where':_0x4fe818[_0x0014('0x3e')]};return db['Dynamics365Configuration'][_0x0014('0x20')](_0x58ce6d)[_0x0014('0x27')](function(_0x5165a){_0x5ca3ea['count']=_0x5165a;if(_0x4f9b3e[_0x0014('0x33')][_0x0014('0x42')]){_0x4fe818['include']=[{'all':!![]}];}return db[_0x0014('0x2c')][_0x0014('0x43')](_0x4fe818);})['then'](function(_0x58e4fe){_0x5ca3ea['rows']=_0x58e4fe;return _0x5ca3ea;})[_0x0014('0x27')](respondWithFilteredResult(_0x527f49,_0x4fe818))['catch'](handleError(_0x527f49,null));};exports[_0x0014('0x44')]=function(_0x21be31,_0x4f2a21){var _0x1e43d9={'raw':![],'where':{'id':_0x21be31['params']['id']}},_0x56ecba={};_0x56ecba['model']=_[_0x0014('0x32')](db['Dynamics365Configuration']['rawAttributes']);_0x56ecba[_0x0014('0x33')]=_[_0x0014('0x32')](_0x21be31[_0x0014('0x33')]);_0x56ecba[_0x0014('0x34')]=_[_0x0014('0x35')](_0x56ecba[_0x0014('0x2f')],_0x56ecba[_0x0014('0x33')]);_0x1e43d9['attributes']=_[_0x0014('0x35')](_0x56ecba['model'],qs[_0x0014('0x36')](_0x21be31['query'][_0x0014('0x36')]));_0x1e43d9[_0x0014('0x37')]=_0x1e43d9[_0x0014('0x37')][_0x0014('0x38')]?_0x1e43d9['attributes']:_0x56ecba['model'];if(_0x21be31[_0x0014('0x33')][_0x0014('0x42')]){_0x1e43d9['include']=[{'all':!![]}];}_0x1e43d9=_[_0x0014('0x3f')]({},_0x1e43d9,_0x21be31['options']);return db[_0x0014('0x2c')][_0x0014('0x45')](_0x1e43d9)[_0x0014('0x27')](handleEntityNotFound(_0x4f2a21,null))['then'](respondWithResult(_0x4f2a21,null))[_0x0014('0x46')](handleError(_0x4f2a21,null));};exports['create']=function(_0x204abe,_0xc55717){return db[_0x0014('0x2c')]['create'](_0x204abe['body'],{})[_0x0014('0x27')](respondWithResult(_0xc55717,0xc9))[_0x0014('0x46')](handleError(_0xc55717,null));};exports['update']=function(_0x409612,_0x1039fc){if(_0x409612[_0x0014('0x47')]['id']){delete _0x409612['body']['id'];}return db[_0x0014('0x2c')][_0x0014('0x45')]({'where':{'id':_0x409612['params']['id']}})[_0x0014('0x27')](handleEntityNotFound(_0x1039fc,null))[_0x0014('0x27')](saveUpdates(_0x409612[_0x0014('0x47')],null))[_0x0014('0x27')](respondWithResult(_0x1039fc,null))[_0x0014('0x46')](handleError(_0x1039fc,null));};exports[_0x0014('0x28')]=function(_0x1d4488,_0x4aeb0e){return db['Dynamics365Configuration'][_0x0014('0x45')]({'where':{'id':_0x1d4488[_0x0014('0x48')]['id']}})[_0x0014('0x27')](handleEntityNotFound(_0x4aeb0e,null))['then'](removeEntity(_0x4aeb0e,null))[_0x0014('0x46')](handleError(_0x4aeb0e,null));};exports[_0x0014('0x49')]=function(_0xd0f348,_0x1b4ca1,_0x3a49d4){var _0x15a197={};var _0x4c14bd={};var _0x467612;var _0x48d782;return db[_0x0014('0x2c')]['findOne']({'where':{'id':_0xd0f348[_0x0014('0x48')]['id']}})[_0x0014('0x27')](handleEntityNotFound(_0x1b4ca1,null))['then'](function(_0x2de40b){if(_0x2de40b){_0x467612=_0x2de40b;_0x4c14bd['model']=_[_0x0014('0x32')](db[_0x0014('0x4a')][_0x0014('0x4b')]);_0x4c14bd[_0x0014('0x33')]=_['keys'](_0xd0f348['query']);_0x4c14bd['filters']=_['intersection'](_0x4c14bd['model'],_0x4c14bd[_0x0014('0x33')]);_0x15a197['attributes']=_[_0x0014('0x35')](_0x4c14bd[_0x0014('0x2f')],qs[_0x0014('0x36')](_0xd0f348[_0x0014('0x33')][_0x0014('0x36')]));_0x15a197[_0x0014('0x37')]=_0x15a197['attributes'][_0x0014('0x38')]?_0x15a197['attributes']:_0x4c14bd[_0x0014('0x2f')];_0x15a197[_0x0014('0x3a')]=qs[_0x0014('0x3b')](_0xd0f348[_0x0014('0x33')][_0x0014('0x3b')]);_0x15a197[_0x0014('0x3e')]=qs[_0x0014('0x34')](_[_0x0014('0x3c')](_0xd0f348[_0x0014('0x33')],_0x4c14bd[_0x0014('0x34')]));if(_0xd0f348[_0x0014('0x33')]['filter']){_0x15a197[_0x0014('0x3e')]=_[_0x0014('0x3f')](_0x15a197[_0x0014('0x3e')],{'$or':_[_0x0014('0x30')](_0x15a197[_0x0014('0x37')],function(_0x1f10d8){var _0x1b8d8a={};_0x1b8d8a[_0x1f10d8]={'$like':'%'+_0xd0f348[_0x0014('0x33')][_0x0014('0x3d')]+'%'};return _0x1b8d8a;})});}_0x15a197=_[_0x0014('0x3f')]({},_0x15a197,_0xd0f348['options']);return _0x467612[_0x0014('0x49')](_0x15a197);}})['then'](function(_0x2d3699){if(_0x2d3699){_0x48d782=_0x2d3699['length'];if(!_0xd0f348[_0x0014('0x33')]['hasOwnProperty'](_0x0014('0x39'))){_0x15a197[_0x0014('0x1f')]=qs[_0x0014('0x1f')](_0xd0f348[_0x0014('0x33')]['limit']);_0x15a197[_0x0014('0x1d')]=qs[_0x0014('0x1d')](_0xd0f348['query'][_0x0014('0x1d')]);}return _0x467612['getFields'](_0x15a197);}})['then'](function(_0x118830){if(_0x118830){return _0x118830?{'count':_0x48d782,'rows':_0x118830}:null;}})[_0x0014('0x27')](respondWithResult(_0x1b4ca1,null))[_0x0014('0x46')](handleError(_0x1b4ca1,null));};exports[_0x0014('0x4c')]=function(_0x29f39a,_0xe6ae9a,_0x13b11f){var _0x4f6870={};var _0x2c1c79={};var _0x195ef9;var _0x283205;return db[_0x0014('0x2c')][_0x0014('0x4d')]({'where':{'id':_0x29f39a[_0x0014('0x48')]['id']}})[_0x0014('0x27')](handleEntityNotFound(_0xe6ae9a,null))[_0x0014('0x27')](function(_0x1b201c){if(_0x1b201c){_0x195ef9=_0x1b201c;_0x2c1c79[_0x0014('0x2f')]=_['keys'](db[_0x0014('0x4a')][_0x0014('0x4b')]);_0x2c1c79[_0x0014('0x33')]=_[_0x0014('0x32')](_0x29f39a[_0x0014('0x33')]);_0x2c1c79[_0x0014('0x34')]=_[_0x0014('0x35')](_0x2c1c79['model'],_0x2c1c79['query']);_0x4f6870[_0x0014('0x37')]=_['intersection'](_0x2c1c79[_0x0014('0x2f')],qs[_0x0014('0x36')](_0x29f39a[_0x0014('0x33')]['fields']));_0x4f6870[_0x0014('0x37')]=_0x4f6870[_0x0014('0x37')]['length']?_0x4f6870['attributes']:_0x2c1c79[_0x0014('0x2f')];_0x4f6870['order']=qs['sort'](_0x29f39a[_0x0014('0x33')]['sort']);_0x4f6870['where']=qs[_0x0014('0x34')](_[_0x0014('0x3c')](_0x29f39a[_0x0014('0x33')],_0x2c1c79[_0x0014('0x34')]));if(_0x29f39a[_0x0014('0x33')][_0x0014('0x3d')]){_0x4f6870[_0x0014('0x3e')]=_[_0x0014('0x3f')](_0x4f6870[_0x0014('0x3e')],{'$or':_[_0x0014('0x30')](_0x4f6870[_0x0014('0x37')],function(_0x2590b7){var _0x402a6e={};_0x402a6e[_0x2590b7]={'$like':'%'+_0x29f39a[_0x0014('0x33')][_0x0014('0x3d')]+'%'};return _0x402a6e;})});}_0x4f6870=_[_0x0014('0x3f')]({},_0x4f6870,_0x29f39a['options']);return _0x195ef9[_0x0014('0x4c')](_0x4f6870);}})[_0x0014('0x27')](function(_0x4b6466){if(_0x4b6466){_0x283205=_0x4b6466['length'];if(!_0x29f39a[_0x0014('0x33')][_0x0014('0x4e')](_0x0014('0x39'))){_0x4f6870['limit']=qs[_0x0014('0x1f')](_0x29f39a[_0x0014('0x33')][_0x0014('0x1f')]);_0x4f6870[_0x0014('0x1d')]=qs[_0x0014('0x1d')](_0x29f39a[_0x0014('0x33')]['offset']);}return _0x195ef9[_0x0014('0x4c')](_0x4f6870);}})[_0x0014('0x27')](function(_0x5411b4){if(_0x5411b4){return _0x5411b4?{'count':_0x283205,'rows':_0x5411b4}:null;}})['then'](respondWithResult(_0xe6ae9a,null))[_0x0014('0x46')](handleError(_0xe6ae9a,null));};exports['getDescriptions']=function(_0x16f279,_0x2ca8dd,_0x47b70f){var _0x444246={};var _0x3e2e5b={};var _0xfe8625;var _0x7b9f;return db[_0x0014('0x2c')]['findOne']({'where':{'id':_0x16f279[_0x0014('0x48')]['id']}})[_0x0014('0x27')](handleEntityNotFound(_0x2ca8dd,null))[_0x0014('0x27')](function(_0x1e3f4a){if(_0x1e3f4a){_0xfe8625=_0x1e3f4a;_0x3e2e5b[_0x0014('0x2f')]=_[_0x0014('0x32')](db[_0x0014('0x4a')][_0x0014('0x4b')]);_0x3e2e5b['query']=_[_0x0014('0x32')](_0x16f279[_0x0014('0x33')]);_0x3e2e5b[_0x0014('0x34')]=_[_0x0014('0x35')](_0x3e2e5b[_0x0014('0x2f')],_0x3e2e5b['query']);_0x444246[_0x0014('0x37')]=_[_0x0014('0x35')](_0x3e2e5b[_0x0014('0x2f')],qs[_0x0014('0x36')](_0x16f279[_0x0014('0x33')]['fields']));_0x444246[_0x0014('0x37')]=_0x444246['attributes'][_0x0014('0x38')]?_0x444246['attributes']:_0x3e2e5b['model'];_0x444246[_0x0014('0x3a')]=qs['sort'](_0x16f279[_0x0014('0x33')][_0x0014('0x3b')]);_0x444246[_0x0014('0x3e')]=qs[_0x0014('0x34')](_[_0x0014('0x3c')](_0x16f279['query'],_0x3e2e5b['filters']));if(_0x16f279[_0x0014('0x33')]['filter']){_0x444246[_0x0014('0x3e')]=_['merge'](_0x444246['where'],{'$or':_[_0x0014('0x30')](_0x444246['attributes'],function(_0x21899e){var _0x3a7bae={};_0x3a7bae[_0x21899e]={'$like':'%'+_0x16f279[_0x0014('0x33')][_0x0014('0x3d')]+'%'};return _0x3a7bae;})});}_0x444246=_[_0x0014('0x3f')]({},_0x444246,_0x16f279['options']);return _0xfe8625[_0x0014('0x4f')](_0x444246);}})[_0x0014('0x27')](function(_0x2921e5){if(_0x2921e5){_0x7b9f=_0x2921e5[_0x0014('0x38')];if(!_0x16f279[_0x0014('0x33')][_0x0014('0x4e')](_0x0014('0x39'))){_0x444246[_0x0014('0x1f')]=qs[_0x0014('0x1f')](_0x16f279['query']['limit']);_0x444246[_0x0014('0x1d')]=qs[_0x0014('0x1d')](_0x16f279[_0x0014('0x33')][_0x0014('0x1d')]);}return _0xfe8625['getDescriptions'](_0x444246);}})[_0x0014('0x27')](function(_0x2826a5){if(_0x2826a5){return _0x2826a5?{'count':_0x7b9f,'rows':_0x2826a5}:null;}})[_0x0014('0x27')](respondWithResult(_0x2ca8dd,null))[_0x0014('0x46')](handleError(_0x2ca8dd,null));}; \ No newline at end of file +var _0x4378=['save','update','then','destroy','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','includeAll','findAll','rows','catch','show','include','find','create','body','params','getFields','findOne','Dynamics365Field','options','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject'];(function(_0x247d9a,_0x44b2af){var _0x282ff7=function(_0x2e4712){while(--_0x2e4712){_0x247d9a['push'](_0x247d9a['shift']());}};_0x282ff7(++_0x44b2af);}(_0x4378,0x80));var _0x8437=function(_0x2fa9b6,_0x265036){_0x2fa9b6=_0x2fa9b6-0x0;var _0x3d7adb=_0x4378[_0x2fa9b6];return _0x3d7adb;};'use strict';var emlformat=require(_0x8437('0x0'));var rimraf=require(_0x8437('0x1'));var zipdir=require(_0x8437('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8437('0x3'));var moment=require('moment');var BPromise=require(_0x8437('0x4'));var Mustache=require(_0x8437('0x5'));var util=require('util');var path=require(_0x8437('0x6'));var sox=require(_0x8437('0x7'));var csv=require(_0x8437('0x8'));var ejs=require(_0x8437('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8437('0xa'));var squel=require(_0x8437('0xb'));var crypto=require(_0x8437('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8437('0xd'));var toCsv=require(_0x8437('0x8'));var querystring=require('querystring');var Papa=require(_0x8437('0xe'));var Redis=require(_0x8437('0xf'));var authService=require(_0x8437('0x10'));var qs=require(_0x8437('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8437('0x12'));var logger=require(_0x8437('0x13'))(_0x8437('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8437('0x15'));var db=require(_0x8437('0x16'))['db'];function respondWithStatusCode(_0x275a1d,_0x1f63bf){_0x1f63bf=_0x1f63bf||0xcc;return function(_0x2eb326){if(_0x2eb326){return _0x275a1d[_0x8437('0x17')](_0x1f63bf);}return _0x275a1d['status'](_0x1f63bf)[_0x8437('0x18')]();};}function respondWithResult(_0x3015c7,_0x264af3){_0x264af3=_0x264af3||0xc8;return function(_0x39e732){if(_0x39e732){return _0x3015c7[_0x8437('0x19')](_0x264af3)[_0x8437('0x1a')](_0x39e732);}};}function respondWithFilteredResult(_0x22f010,_0x59160c){return function(_0x3c63f5){if(_0x3c63f5){var _0x2444c1=typeof _0x59160c['offset']===_0x8437('0x1b')&&typeof _0x59160c[_0x8437('0x1c')]===_0x8437('0x1b');var _0x454113=_0x3c63f5['count'];var _0x280b17=_0x2444c1?0x0:_0x59160c['offset'];var _0x182225=_0x2444c1?_0x3c63f5[_0x8437('0x1d')]:_0x59160c[_0x8437('0x1e')]+_0x59160c[_0x8437('0x1c')];var _0x5083f6;if(_0x182225>=_0x454113){_0x182225=_0x454113;_0x5083f6=0xc8;}else{_0x5083f6=0xce;}_0x22f010['status'](_0x5083f6);return _0x22f010[_0x8437('0x1f')](_0x8437('0x20'),_0x280b17+'-'+_0x182225+'/'+_0x454113)['json'](_0x3c63f5);}return null;};}function patchUpdates(_0x115842){return function(_0x3b6c9f){try{jsonpatch['apply'](_0x3b6c9f,_0x115842,!![]);}catch(_0x1a52e8){return BPromise[_0x8437('0x21')](_0x1a52e8);}return _0x3b6c9f[_0x8437('0x22')]();};}function saveUpdates(_0x34a0a7,_0x5bee32){return function(_0x25ac87){if(_0x25ac87){return _0x25ac87[_0x8437('0x23')](_0x34a0a7)[_0x8437('0x24')](function(_0x4f9e9f){return _0x4f9e9f;});}return null;};}function removeEntity(_0x1d4f4c,_0x374913){return function(_0x82a2d8){if(_0x82a2d8){return _0x82a2d8[_0x8437('0x25')]()['then'](function(){_0x1d4f4c[_0x8437('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32731a,_0x35c396){return function(_0x4df984){if(!_0x4df984){_0x32731a[_0x8437('0x17')](0x194);}return _0x4df984;};}function handleError(_0x4b766c,_0x47bd19){_0x47bd19=_0x47bd19||0x1f4;return function(_0x2f8705){logger[_0x8437('0x26')](_0x2f8705[_0x8437('0x27')]);if(_0x2f8705['name']){delete _0x2f8705[_0x8437('0x28')];}_0x4b766c[_0x8437('0x19')](_0x47bd19)[_0x8437('0x29')](_0x2f8705);};}exports[_0x8437('0x2a')]=function(_0xf5ea6d,_0x12f078){var _0x53ef82={},_0x58f1b8={},_0x2c1b71={'count':0x0,'rows':[]};var _0x1437d0=_['map'](db[_0x8437('0x2b')][_0x8437('0x2c')],function(_0x2260ac){return{'name':_0x2260ac[_0x8437('0x2d')],'type':_0x2260ac['type'][_0x8437('0x2e')]};});_0x58f1b8[_0x8437('0x2f')]=_['map'](_0x1437d0,_0x8437('0x28'));_0x58f1b8[_0x8437('0x30')]=_[_0x8437('0x31')](_0xf5ea6d[_0x8437('0x30')]);_0x58f1b8['filters']=_[_0x8437('0x32')](_0x58f1b8[_0x8437('0x2f')],_0x58f1b8[_0x8437('0x30')]);_0x53ef82[_0x8437('0x33')]=_[_0x8437('0x32')](_0x58f1b8['model'],qs[_0x8437('0x34')](_0xf5ea6d[_0x8437('0x30')][_0x8437('0x34')]));_0x53ef82[_0x8437('0x33')]=_0x53ef82[_0x8437('0x33')][_0x8437('0x35')]?_0x53ef82[_0x8437('0x33')]:_0x58f1b8['model'];if(!_0xf5ea6d[_0x8437('0x30')][_0x8437('0x36')]('nolimit')){_0x53ef82['limit']=qs[_0x8437('0x1c')](_0xf5ea6d[_0x8437('0x30')][_0x8437('0x1c')]);_0x53ef82[_0x8437('0x1e')]=qs[_0x8437('0x1e')](_0xf5ea6d['query'][_0x8437('0x1e')]);}_0x53ef82[_0x8437('0x37')]=qs[_0x8437('0x38')](_0xf5ea6d[_0x8437('0x30')][_0x8437('0x38')]);_0x53ef82['where']=qs[_0x8437('0x39')](_[_0x8437('0x3a')](_0xf5ea6d['query'],_0x58f1b8[_0x8437('0x39')]),_0x1437d0);if(_0xf5ea6d['query'][_0x8437('0x3b')]){_0x53ef82[_0x8437('0x3c')]=_[_0x8437('0x3d')](_0x53ef82[_0x8437('0x3c')],{'$or':_[_0x8437('0x3e')](_0x1437d0,function(_0x3c5204){if(_0x3c5204['type']!==_0x8437('0x3f')){var _0x1f451b={};_0x1f451b[_0x3c5204[_0x8437('0x28')]]={'$like':'%'+_0xf5ea6d['query'][_0x8437('0x3b')]+'%'};return _0x1f451b;}})});}_0x53ef82=_[_0x8437('0x3d')]({},_0x53ef82,_0xf5ea6d['options']);var _0x5854f3={'where':_0x53ef82[_0x8437('0x3c')]};return db['Dynamics365Configuration'][_0x8437('0x1d')](_0x5854f3)[_0x8437('0x24')](function(_0x5f3ab4){_0x2c1b71['count']=_0x5f3ab4;if(_0xf5ea6d[_0x8437('0x30')][_0x8437('0x40')]){_0x53ef82['include']=[{'all':!![]}];}return db[_0x8437('0x2b')][_0x8437('0x41')](_0x53ef82);})[_0x8437('0x24')](function(_0x16265f){_0x2c1b71[_0x8437('0x42')]=_0x16265f;return _0x2c1b71;})[_0x8437('0x24')](respondWithFilteredResult(_0x12f078,_0x53ef82))[_0x8437('0x43')](handleError(_0x12f078,null));};exports[_0x8437('0x44')]=function(_0x134d87,_0x3672bc){var _0x71cc01={'raw':![],'where':{'id':_0x134d87['params']['id']}},_0x4d48f3={};_0x4d48f3[_0x8437('0x2f')]=_[_0x8437('0x31')](db[_0x8437('0x2b')][_0x8437('0x2c')]);_0x4d48f3[_0x8437('0x30')]=_[_0x8437('0x31')](_0x134d87['query']);_0x4d48f3[_0x8437('0x39')]=_['intersection'](_0x4d48f3[_0x8437('0x2f')],_0x4d48f3['query']);_0x71cc01[_0x8437('0x33')]=_[_0x8437('0x32')](_0x4d48f3[_0x8437('0x2f')],qs[_0x8437('0x34')](_0x134d87[_0x8437('0x30')][_0x8437('0x34')]));_0x71cc01['attributes']=_0x71cc01[_0x8437('0x33')][_0x8437('0x35')]?_0x71cc01[_0x8437('0x33')]:_0x4d48f3['model'];if(_0x134d87[_0x8437('0x30')][_0x8437('0x40')]){_0x71cc01[_0x8437('0x45')]=[{'all':!![]}];}_0x71cc01=_[_0x8437('0x3d')]({},_0x71cc01,_0x134d87['options']);return db[_0x8437('0x2b')][_0x8437('0x46')](_0x71cc01)[_0x8437('0x24')](handleEntityNotFound(_0x3672bc,null))[_0x8437('0x24')](respondWithResult(_0x3672bc,null))[_0x8437('0x43')](handleError(_0x3672bc,null));};exports[_0x8437('0x47')]=function(_0x4dc026,_0x12a6f5){return db[_0x8437('0x2b')]['create'](_0x4dc026[_0x8437('0x48')],{})[_0x8437('0x24')](respondWithResult(_0x12a6f5,0xc9))[_0x8437('0x43')](handleError(_0x12a6f5,null));};exports[_0x8437('0x23')]=function(_0x5823e3,_0x46fa41){if(_0x5823e3['body']['id']){delete _0x5823e3[_0x8437('0x48')]['id'];}return db[_0x8437('0x2b')][_0x8437('0x46')]({'where':{'id':_0x5823e3[_0x8437('0x49')]['id']}})['then'](handleEntityNotFound(_0x46fa41,null))['then'](saveUpdates(_0x5823e3[_0x8437('0x48')],null))['then'](respondWithResult(_0x46fa41,null))[_0x8437('0x43')](handleError(_0x46fa41,null));};exports[_0x8437('0x25')]=function(_0x5646be,_0x1b9cbd){return db['Dynamics365Configuration'][_0x8437('0x46')]({'where':{'id':_0x5646be[_0x8437('0x49')]['id']}})[_0x8437('0x24')](handleEntityNotFound(_0x1b9cbd,null))[_0x8437('0x24')](removeEntity(_0x1b9cbd,null))[_0x8437('0x43')](handleError(_0x1b9cbd,null));};exports[_0x8437('0x4a')]=function(_0x27dea0,_0x5413eb,_0x40bba7){var _0x40f286={};var _0x43df68={};var _0x3b3113;var _0x358c2f;return db['Dynamics365Configuration'][_0x8437('0x4b')]({'where':{'id':_0x27dea0[_0x8437('0x49')]['id']}})[_0x8437('0x24')](handleEntityNotFound(_0x5413eb,null))[_0x8437('0x24')](function(_0x41cb75){if(_0x41cb75){_0x3b3113=_0x41cb75;_0x43df68['model']=_[_0x8437('0x31')](db[_0x8437('0x4c')][_0x8437('0x2c')]);_0x43df68[_0x8437('0x30')]=_[_0x8437('0x31')](_0x27dea0['query']);_0x43df68[_0x8437('0x39')]=_[_0x8437('0x32')](_0x43df68[_0x8437('0x2f')],_0x43df68[_0x8437('0x30')]);_0x40f286['attributes']=_[_0x8437('0x32')](_0x43df68['model'],qs[_0x8437('0x34')](_0x27dea0[_0x8437('0x30')][_0x8437('0x34')]));_0x40f286['attributes']=_0x40f286[_0x8437('0x33')][_0x8437('0x35')]?_0x40f286[_0x8437('0x33')]:_0x43df68[_0x8437('0x2f')];_0x40f286[_0x8437('0x37')]=qs['sort'](_0x27dea0[_0x8437('0x30')][_0x8437('0x38')]);_0x40f286[_0x8437('0x3c')]=qs[_0x8437('0x39')](_['pick'](_0x27dea0[_0x8437('0x30')],_0x43df68['filters']));if(_0x27dea0[_0x8437('0x30')][_0x8437('0x3b')]){_0x40f286['where']=_[_0x8437('0x3d')](_0x40f286[_0x8437('0x3c')],{'$or':_[_0x8437('0x3e')](_0x40f286[_0x8437('0x33')],function(_0x15d9c8){var _0x2ed5c7={};_0x2ed5c7[_0x15d9c8]={'$like':'%'+_0x27dea0[_0x8437('0x30')][_0x8437('0x3b')]+'%'};return _0x2ed5c7;})});}_0x40f286=_[_0x8437('0x3d')]({},_0x40f286,_0x27dea0[_0x8437('0x4d')]);return _0x3b3113[_0x8437('0x4a')](_0x40f286);}})[_0x8437('0x24')](function(_0xd5826f){if(_0xd5826f){_0x358c2f=_0xd5826f[_0x8437('0x35')];if(!_0x27dea0['query'][_0x8437('0x36')](_0x8437('0x4e'))){_0x40f286[_0x8437('0x1c')]=qs['limit'](_0x27dea0[_0x8437('0x30')]['limit']);_0x40f286[_0x8437('0x1e')]=qs['offset'](_0x27dea0[_0x8437('0x30')][_0x8437('0x1e')]);}return _0x3b3113['getFields'](_0x40f286);}})[_0x8437('0x24')](function(_0x233b22){if(_0x233b22){return _0x233b22?{'count':_0x358c2f,'rows':_0x233b22}:null;}})[_0x8437('0x24')](respondWithResult(_0x5413eb,null))[_0x8437('0x43')](handleError(_0x5413eb,null));};exports['getSubjects']=function(_0x2d996b,_0x2a5dba,_0x401179){var _0x4147f1={};var _0x51c81e={};var _0x59a37d;var _0x41cfc2;return db[_0x8437('0x2b')][_0x8437('0x4b')]({'where':{'id':_0x2d996b[_0x8437('0x49')]['id']}})[_0x8437('0x24')](handleEntityNotFound(_0x2a5dba,null))[_0x8437('0x24')](function(_0x3909a0){if(_0x3909a0){_0x59a37d=_0x3909a0;_0x51c81e[_0x8437('0x2f')]=_[_0x8437('0x31')](db[_0x8437('0x4c')][_0x8437('0x2c')]);_0x51c81e[_0x8437('0x30')]=_[_0x8437('0x31')](_0x2d996b[_0x8437('0x30')]);_0x51c81e['filters']=_[_0x8437('0x32')](_0x51c81e[_0x8437('0x2f')],_0x51c81e[_0x8437('0x30')]);_0x4147f1['attributes']=_[_0x8437('0x32')](_0x51c81e['model'],qs['fields'](_0x2d996b[_0x8437('0x30')][_0x8437('0x34')]));_0x4147f1['attributes']=_0x4147f1['attributes'][_0x8437('0x35')]?_0x4147f1[_0x8437('0x33')]:_0x51c81e['model'];_0x4147f1[_0x8437('0x37')]=qs[_0x8437('0x38')](_0x2d996b[_0x8437('0x30')][_0x8437('0x38')]);_0x4147f1['where']=qs['filters'](_[_0x8437('0x3a')](_0x2d996b['query'],_0x51c81e[_0x8437('0x39')]));if(_0x2d996b[_0x8437('0x30')][_0x8437('0x3b')]){_0x4147f1[_0x8437('0x3c')]=_[_0x8437('0x3d')](_0x4147f1['where'],{'$or':_[_0x8437('0x3e')](_0x4147f1[_0x8437('0x33')],function(_0x470529){var _0x4e50f9={};_0x4e50f9[_0x470529]={'$like':'%'+_0x2d996b['query'][_0x8437('0x3b')]+'%'};return _0x4e50f9;})});}_0x4147f1=_[_0x8437('0x3d')]({},_0x4147f1,_0x2d996b['options']);return _0x59a37d[_0x8437('0x4f')](_0x4147f1);}})['then'](function(_0x1ddd7d){if(_0x1ddd7d){_0x41cfc2=_0x1ddd7d[_0x8437('0x35')];if(!_0x2d996b[_0x8437('0x30')][_0x8437('0x36')]('nolimit')){_0x4147f1[_0x8437('0x1c')]=qs[_0x8437('0x1c')](_0x2d996b['query'][_0x8437('0x1c')]);_0x4147f1[_0x8437('0x1e')]=qs[_0x8437('0x1e')](_0x2d996b[_0x8437('0x30')][_0x8437('0x1e')]);}return _0x59a37d[_0x8437('0x4f')](_0x4147f1);}})[_0x8437('0x24')](function(_0x49edee){if(_0x49edee){return _0x49edee?{'count':_0x41cfc2,'rows':_0x49edee}:null;}})[_0x8437('0x24')](respondWithResult(_0x2a5dba,null))[_0x8437('0x43')](handleError(_0x2a5dba,null));};exports[_0x8437('0x50')]=function(_0x1aa92e,_0xcf372d,_0x5056cd){var _0x2258a5={};var _0x3b79eb={};var _0x35af3d;var _0x43e2f0;return db[_0x8437('0x2b')][_0x8437('0x4b')]({'where':{'id':_0x1aa92e[_0x8437('0x49')]['id']}})[_0x8437('0x24')](handleEntityNotFound(_0xcf372d,null))[_0x8437('0x24')](function(_0x358100){if(_0x358100){_0x35af3d=_0x358100;_0x3b79eb['model']=_['keys'](db[_0x8437('0x4c')][_0x8437('0x2c')]);_0x3b79eb[_0x8437('0x30')]=_[_0x8437('0x31')](_0x1aa92e['query']);_0x3b79eb[_0x8437('0x39')]=_['intersection'](_0x3b79eb[_0x8437('0x2f')],_0x3b79eb[_0x8437('0x30')]);_0x2258a5[_0x8437('0x33')]=_[_0x8437('0x32')](_0x3b79eb['model'],qs[_0x8437('0x34')](_0x1aa92e['query'][_0x8437('0x34')]));_0x2258a5['attributes']=_0x2258a5[_0x8437('0x33')][_0x8437('0x35')]?_0x2258a5['attributes']:_0x3b79eb[_0x8437('0x2f')];_0x2258a5[_0x8437('0x37')]=qs[_0x8437('0x38')](_0x1aa92e[_0x8437('0x30')][_0x8437('0x38')]);_0x2258a5[_0x8437('0x3c')]=qs['filters'](_[_0x8437('0x3a')](_0x1aa92e['query'],_0x3b79eb['filters']));if(_0x1aa92e['query'][_0x8437('0x3b')]){_0x2258a5[_0x8437('0x3c')]=_['merge'](_0x2258a5[_0x8437('0x3c')],{'$or':_[_0x8437('0x3e')](_0x2258a5[_0x8437('0x33')],function(_0x45be9f){var _0x3f9e92={};_0x3f9e92[_0x45be9f]={'$like':'%'+_0x1aa92e[_0x8437('0x30')][_0x8437('0x3b')]+'%'};return _0x3f9e92;})});}_0x2258a5=_[_0x8437('0x3d')]({},_0x2258a5,_0x1aa92e['options']);return _0x35af3d[_0x8437('0x50')](_0x2258a5);}})[_0x8437('0x24')](function(_0x3279e9){if(_0x3279e9){_0x43e2f0=_0x3279e9[_0x8437('0x35')];if(!_0x1aa92e['query']['hasOwnProperty']('nolimit')){_0x2258a5[_0x8437('0x1c')]=qs[_0x8437('0x1c')](_0x1aa92e[_0x8437('0x30')][_0x8437('0x1c')]);_0x2258a5[_0x8437('0x1e')]=qs['offset'](_0x1aa92e[_0x8437('0x30')][_0x8437('0x1e')]);}return _0x35af3d[_0x8437('0x50')](_0x2258a5);}})[_0x8437('0x24')](function(_0x3806e3){if(_0x3806e3){return _0x3806e3?{'count':_0x43e2f0,'rows':_0x3806e3}:null;}})[_0x8437('0x24')](respondWithResult(_0xcf372d,null))[_0x8437('0x43')](handleError(_0xcf372d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 54b8330..ac1c424 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 _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x26b3c7,_0x2741f5){var _0x1fae93=function(_0x5d93b6){while(--_0x5d93b6){_0x26b3c7['push'](_0x26b3c7['shift']());}};_0x1fae93(++_0x2741f5);}(_0x00bb,0x1d8));var _0xb00b=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x00bb[_0x411add];return _0x238242;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x4b4c3b,_0x121398){var _0x125d77=function(_0x3cdff5){while(--_0x3cdff5){_0x4b4c3b['push'](_0x4b4c3b['shift']());}};_0x125d77(++_0x121398);}(_0x3e74,0x175));var _0x43e7=function(_0x10b9f6,_0x503a09){_0x10b9f6=_0x10b9f6-0x0;var _0x386092=_0x3e74[_0x10b9f6];return _0x386092;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index f864e5e..df84e29 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 _0x4d2e=['../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1f42c6,_0x5ea87e){var _0x11fa9e=function(_0xe4d090){while(--_0xe4d090){_0x1f42c6['push'](_0x1f42c6['shift']());}};_0x11fa9e(++_0x5ea87e);}(_0x4d2e,0x7f));var _0xe4d2=function(_0x441f00,_0x1bbc37){_0x441f00=_0x441f00-0x0;var _0x9b6173=_0x4d2e[_0x441f00];return _0x9b6173;};'use strict';var _=require(_0xe4d2('0x0'));var util=require(_0xe4d2('0x1'));var moment=require(_0xe4d2('0x2'));var BPromise=require(_0xe4d2('0x3'));var rs=require(_0xe4d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4d2('0x5'))['db'];var utils=require(_0xe4d2('0x6'));var logger=require(_0xe4d2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe4d2('0x8')][_0xe4d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ed7c7,_0x31c89e,_0x2c33db){return new BPromise(function(_0x4a8106,_0x2c40db){return client[_0xe4d2('0xa')](_0x4ed7c7,_0x2c33db)[_0xe4d2('0xb')](function(_0x45492d){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x31c89e,'request\x20sent');logger[_0xe4d2('0xc')](_0xe4d2('0xd'),_0x31c89e,_0xe4d2('0xe'),JSON[_0xe4d2('0xf')](_0x45492d));if(_0x45492d['error']){if(_0x45492d[_0xe4d2('0x10')]['code']===0x1f4){logger[_0xe4d2('0x10')](_0xe4d2('0x11'),_0x31c89e,_0x45492d[_0xe4d2('0x10')][_0xe4d2('0x12')]);return _0x2c40db(_0x45492d[_0xe4d2('0x10')]['message']);}logger[_0xe4d2('0x10')](_0xe4d2('0x11'),_0x31c89e,_0x45492d[_0xe4d2('0x10')][_0xe4d2('0x12')]);return _0x4a8106(_0x45492d[_0xe4d2('0x10')][_0xe4d2('0x12')]);}else{logger[_0xe4d2('0x13')](_0xe4d2('0x11'),_0x31c89e,_0xe4d2('0xe'));_0x4a8106(_0x45492d[_0xe4d2('0x14')][_0xe4d2('0x12')]);}})[_0xe4d2('0x15')](function(_0x11831a){logger[_0xe4d2('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x31c89e,_0x11831a);_0x2c40db(_0x11831a);});});} \ No newline at end of file +var _0xa717=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa717,0x13e));var _0x7a71=function(_0x4d520d,_0x540526){_0x4d520d=_0x4d520d-0x0;var _0x5c375b=_0xa717[_0x4d520d];return _0x5c375b;};'use strict';var _=require(_0x7a71('0x0'));var util=require(_0x7a71('0x1'));var moment=require(_0x7a71('0x2'));var BPromise=require(_0x7a71('0x3'));var rs=require(_0x7a71('0x4'));var fs=require('fs');var Redis=require(_0x7a71('0x5'));var db=require(_0x7a71('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a71('0x7'))(_0x7a71('0x8'));var config=require(_0x7a71('0x9'));var jayson=require(_0x7a71('0xa'));var client=jayson[_0x7a71('0xb')][_0x7a71('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9adab,_0x2a4316,_0x20d7f1){return new BPromise(function(_0x5a3436,_0xf2b4ad){return client[_0x7a71('0xd')](_0x9adab,_0x20d7f1)[_0x7a71('0xe')](function(_0x1b7eef){logger[_0x7a71('0xf')](_0x7a71('0x10'),_0x2a4316,'request\x20sent');logger['debug'](_0x7a71('0x11'),_0x2a4316,'request\x20sent',JSON[_0x7a71('0x12')](_0x1b7eef));if(_0x1b7eef[_0x7a71('0x13')]){if(_0x1b7eef[_0x7a71('0x13')][_0x7a71('0x14')]===0x1f4){logger['error'](_0x7a71('0x10'),_0x2a4316,_0x1b7eef['error']['message']);return _0xf2b4ad(_0x1b7eef[_0x7a71('0x13')][_0x7a71('0x15')]);}logger[_0x7a71('0x13')](_0x7a71('0x10'),_0x2a4316,_0x1b7eef[_0x7a71('0x13')][_0x7a71('0x15')]);return _0x5a3436(_0x1b7eef[_0x7a71('0x13')][_0x7a71('0x15')]);}else{logger[_0x7a71('0xf')](_0x7a71('0x10'),_0x2a4316,'request\x20sent');_0x5a3436(_0x1b7eef['result']['message']);}})[_0x7a71('0x16')](function(_0x297b72){logger['error'](_0x7a71('0x10'),_0x2a4316,_0x297b72);_0xf2b4ad(_0x297b72);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f2eefcf..515db3f 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 _0x2690=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout','fs-extra'];(function(_0x411dac,_0x4263db){var _0x30e2d9=function(_0x5123bd){while(--_0x5123bd){_0x411dac['push'](_0x411dac['shift']());}};_0x30e2d9(++_0x4263db);}(_0x2690,0x7d));var _0x0269=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x2690[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0x0269('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0269('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0269('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x0269('0x3'));var config=require(_0x0269('0x4'));var controller=require(_0x0269('0x5'));router[_0x0269('0x6')]('/',auth[_0x0269('0x7')](),controller[_0x0269('0x8')]);router[_0x0269('0x6')](_0x0269('0x9'),auth[_0x0269('0x7')](),controller[_0x0269('0xa')]);router[_0x0269('0xb')]('/',auth[_0x0269('0x7')](),controller['create']);router[_0x0269('0xc')]('/:id',auth[_0x0269('0x7')](),controller[_0x0269('0xd')]);router[_0x0269('0xe')](_0x0269('0x9'),auth[_0x0269('0x7')](),controller[_0x0269('0xf')]);module['exports']=router; \ No newline at end of file +var _0xcdc9=['update','delete','destroy','exports','multer','path','express','../../components/auth/service','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xcdc9,0x1a4));var _0x9cdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdc9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9cdc('0x0'));var util=require('util');var path=require(_0x9cdc('0x1'));var timeout=require('connect-timeout');var express=require(_0x9cdc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9cdc('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x9cdc('0x4')](),controller[_0x9cdc('0x5')]);router[_0x9cdc('0x6')](_0x9cdc('0x7'),auth[_0x9cdc('0x4')](),controller[_0x9cdc('0x8')]);router[_0x9cdc('0x9')]('/',auth[_0x9cdc('0x4')](),controller[_0x9cdc('0xa')]);router[_0x9cdc('0xb')]('/:id',auth[_0x9cdc('0x4')](),controller[_0x9cdc('0xc')]);router[_0x9cdc('0xd')](_0x9cdc('0x7'),auth[_0x9cdc('0x4')](),controller[_0x9cdc('0xe')]);module[_0x9cdc('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2e8d2ec..3df54fb 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 _0xf586=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','variable'];(function(_0xfa0260,_0x75ecac){var _0x54e80d=function(_0x2bd794){while(--_0x2bd794){_0xfa0260['push'](_0xfa0260['shift']());}};_0x54e80d(++_0x75ecac);}(_0xf586,0x98));var _0x6f58=function(_0x32753a,_0x313eff){_0x32753a=_0x32753a-0x0;var _0x5cc638=_0xf586[_0x32753a];return _0x5cc638;};'use strict';var Sequelize=require(_0x6f58('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x6f58('0x1'),_0x6f58('0x2'),_0x6f58('0x3'),_0x6f58('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6f58('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6f58('0x1'),_0x6f58('0x2'))},'keyContent':{'type':Sequelize[_0x6f58('0x5')]},'idField':{'type':Sequelize[_0x6f58('0x5')]},'nameField':{'type':Sequelize[_0x6f58('0x5')]},'customField':{'type':Sequelize[_0x6f58('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x82ad=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x1127bf,_0x542714){var _0x5bdfce=function(_0x29b766){while(--_0x29b766){_0x1127bf['push'](_0x1127bf['shift']());}};_0x5bdfce(++_0x542714);}(_0x82ad,0x9f));var _0xd82a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82ad[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd82a('0x0')]={'type':{'type':Sequelize[_0xd82a('0x1')](_0xd82a('0x2'),_0xd82a('0x3'),_0xd82a('0x4'),_0xd82a('0x5'),_0xd82a('0x6')),'defaultValue':_0xd82a('0x2')},'content':{'type':Sequelize[_0xd82a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd82a('0x1')](_0xd82a('0x2'),_0xd82a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd82a('0x7')]},'idField':{'type':Sequelize[_0xd82a('0x7')]},'nameField':{'type':Sequelize[_0xd82a('0x7')]},'customField':{'type':Sequelize[_0xd82a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd82a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 864d107..7fa9719 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 _0x31e4=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','Dynamics365Field','fieldName','type','key','model','map','name'];(function(_0x218683,_0x23bc63){var _0xb9ef9b=function(_0x4ac51e){while(--_0x4ac51e){_0x218683['push'](_0x218683['shift']());}};_0xb9ef9b(++_0x23bc63);}(_0x31e4,0x107));var _0x431e=function(_0x4a397d,_0x5bab1f){_0x4a397d=_0x4a397d-0x0;var _0x316571=_0x31e4[_0x4a397d];return _0x316571;};'use strict';var emlformat=require(_0x431e('0x0'));var rimraf=require(_0x431e('0x1'));var zipdir=require(_0x431e('0x2'));var jsonpatch=require(_0x431e('0x3'));var rp=require(_0x431e('0x4'));var moment=require(_0x431e('0x5'));var BPromise=require(_0x431e('0x6'));var Mustache=require(_0x431e('0x7'));var util=require('util');var path=require(_0x431e('0x8'));var sox=require(_0x431e('0x9'));var csv=require(_0x431e('0xa'));var ejs=require(_0x431e('0xb'));var fs=require('fs');var fs_extra=require(_0x431e('0xc'));var _=require('lodash');var squel=require(_0x431e('0xd'));var crypto=require(_0x431e('0xe'));var jsforce=require(_0x431e('0xf'));var deskjs=require(_0x431e('0x10'));var toCsv=require(_0x431e('0xa'));var querystring=require(_0x431e('0x11'));var Papa=require(_0x431e('0x12'));var Redis=require('ioredis');var authService=require(_0x431e('0x13'));var qs=require(_0x431e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x431e('0x15'));var logger=require(_0x431e('0x16'))(_0x431e('0x17'));var utils=require(_0x431e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x431e('0x19'));var db=require(_0x431e('0x1a'))['db'];function respondWithStatusCode(_0x4e47de,_0x14eacf){_0x14eacf=_0x14eacf||0xcc;return function(_0x46cb9d){if(_0x46cb9d){return _0x4e47de['sendStatus'](_0x14eacf);}return _0x4e47de['status'](_0x14eacf)[_0x431e('0x1b')]();};}function respondWithResult(_0x20eb99,_0xf094ee){_0xf094ee=_0xf094ee||0xc8;return function(_0x316483){if(_0x316483){return _0x20eb99[_0x431e('0x1c')](_0xf094ee)[_0x431e('0x1d')](_0x316483);}};}function respondWithFilteredResult(_0x19122d,_0x31345b){return function(_0x4e1662){if(_0x4e1662){var _0x31fcb0=typeof _0x31345b[_0x431e('0x1e')]===_0x431e('0x1f')&&typeof _0x31345b[_0x431e('0x20')]===_0x431e('0x1f');var _0x53b0ed=_0x4e1662['count'];var _0x7326ba=_0x31fcb0?0x0:_0x31345b[_0x431e('0x1e')];var _0x511b11=_0x31fcb0?_0x4e1662[_0x431e('0x21')]:_0x31345b[_0x431e('0x1e')]+_0x31345b[_0x431e('0x20')];var _0x26b691;if(_0x511b11>=_0x53b0ed){_0x511b11=_0x53b0ed;_0x26b691=0xc8;}else{_0x26b691=0xce;}_0x19122d[_0x431e('0x1c')](_0x26b691);return _0x19122d[_0x431e('0x22')](_0x431e('0x23'),_0x7326ba+'-'+_0x511b11+'/'+_0x53b0ed)[_0x431e('0x1d')](_0x4e1662);}return null;};}function patchUpdates(_0x3987ca){return function(_0x3883a0){try{jsonpatch[_0x431e('0x24')](_0x3883a0,_0x3987ca,!![]);}catch(_0x2f615e){return BPromise[_0x431e('0x25')](_0x2f615e);}return _0x3883a0[_0x431e('0x26')]();};}function saveUpdates(_0x527237,_0x5c0f91){return function(_0x10ecfc){if(_0x10ecfc){return _0x10ecfc['update'](_0x527237)[_0x431e('0x27')](function(_0x5662aa){return _0x5662aa;});}return null;};}function removeEntity(_0x56acd9,_0x56aff8){return function(_0x32d46b){if(_0x32d46b){return _0x32d46b[_0x431e('0x28')]()[_0x431e('0x27')](function(){_0x56acd9['status'](0xcc)[_0x431e('0x1b')]();});}};}function handleEntityNotFound(_0x4fa82c,_0x692736){return function(_0x4b7c91){if(!_0x4b7c91){_0x4fa82c[_0x431e('0x29')](0x194);}return _0x4b7c91;};}function handleError(_0x2e33f6,_0x36f236){_0x36f236=_0x36f236||0x1f4;return function(_0x30cc79){logger[_0x431e('0x2a')](_0x30cc79[_0x431e('0x2b')]);if(_0x30cc79['name']){delete _0x30cc79['name'];}_0x2e33f6[_0x431e('0x1c')](_0x36f236)[_0x431e('0x2c')](_0x30cc79);};}exports[_0x431e('0x2d')]=function(_0x4f3137,_0x20f463){var _0x574e07={},_0x1a4210={},_0x2f809c={'count':0x0,'rows':[]};var _0x3368d6=_['map'](db[_0x431e('0x2e')]['rawAttributes'],function(_0x3eb1b7){return{'name':_0x3eb1b7[_0x431e('0x2f')],'type':_0x3eb1b7[_0x431e('0x30')][_0x431e('0x31')]};});_0x1a4210[_0x431e('0x32')]=_[_0x431e('0x33')](_0x3368d6,_0x431e('0x34'));_0x1a4210[_0x431e('0x35')]=_[_0x431e('0x36')](_0x4f3137[_0x431e('0x35')]);_0x1a4210[_0x431e('0x37')]=_[_0x431e('0x38')](_0x1a4210[_0x431e('0x32')],_0x1a4210[_0x431e('0x35')]);_0x574e07[_0x431e('0x39')]=_['intersection'](_0x1a4210[_0x431e('0x32')],qs[_0x431e('0x3a')](_0x4f3137[_0x431e('0x35')][_0x431e('0x3a')]));_0x574e07[_0x431e('0x39')]=_0x574e07[_0x431e('0x39')]['length']?_0x574e07[_0x431e('0x39')]:_0x1a4210[_0x431e('0x32')];if(!_0x4f3137['query'][_0x431e('0x3b')](_0x431e('0x3c'))){_0x574e07['limit']=qs[_0x431e('0x20')](_0x4f3137[_0x431e('0x35')][_0x431e('0x20')]);_0x574e07[_0x431e('0x1e')]=qs[_0x431e('0x1e')](_0x4f3137[_0x431e('0x35')][_0x431e('0x1e')]);}_0x574e07['order']=qs[_0x431e('0x3d')](_0x4f3137[_0x431e('0x35')]['sort']);_0x574e07['where']=qs[_0x431e('0x37')](_[_0x431e('0x3e')](_0x4f3137['query'],_0x1a4210['filters']),_0x3368d6);if(_0x4f3137[_0x431e('0x35')][_0x431e('0x3f')]){_0x574e07[_0x431e('0x40')]=_['merge'](_0x574e07[_0x431e('0x40')],{'$or':_['map'](_0x3368d6,function(_0x3f7d35){if(_0x3f7d35[_0x431e('0x30')]!=='VIRTUAL'){var _0x2c7648={};_0x2c7648[_0x3f7d35[_0x431e('0x34')]]={'$like':'%'+_0x4f3137[_0x431e('0x35')][_0x431e('0x3f')]+'%'};return _0x2c7648;}})});}_0x574e07=_[_0x431e('0x41')]({},_0x574e07,_0x4f3137[_0x431e('0x42')]);var _0x1d7e46={'where':_0x574e07['where']};return db[_0x431e('0x2e')]['count'](_0x1d7e46)[_0x431e('0x27')](function(_0x2ddff9){_0x2f809c[_0x431e('0x21')]=_0x2ddff9;if(_0x4f3137[_0x431e('0x35')][_0x431e('0x43')]){_0x574e07[_0x431e('0x44')]=[{'all':!![]}];}return db[_0x431e('0x2e')][_0x431e('0x45')](_0x574e07);})['then'](function(_0x4ccde2){_0x2f809c[_0x431e('0x46')]=_0x4ccde2;return _0x2f809c;})['then'](respondWithFilteredResult(_0x20f463,_0x574e07))[_0x431e('0x47')](handleError(_0x20f463,null));};exports[_0x431e('0x48')]=function(_0xc3bd83,_0x19d9e8){var _0x3ceac5={'raw':!![],'where':{'id':_0xc3bd83[_0x431e('0x49')]['id']}},_0x400a42={};_0x400a42[_0x431e('0x32')]=_[_0x431e('0x36')](db['Dynamics365Field'][_0x431e('0x4a')]);_0x400a42[_0x431e('0x35')]=_[_0x431e('0x36')](_0xc3bd83[_0x431e('0x35')]);_0x400a42[_0x431e('0x37')]=_['intersection'](_0x400a42[_0x431e('0x32')],_0x400a42['query']);_0x3ceac5['attributes']=_[_0x431e('0x38')](_0x400a42['model'],qs[_0x431e('0x3a')](_0xc3bd83[_0x431e('0x35')][_0x431e('0x3a')]));_0x3ceac5[_0x431e('0x39')]=_0x3ceac5[_0x431e('0x39')]['length']?_0x3ceac5[_0x431e('0x39')]:_0x400a42[_0x431e('0x32')];if(_0xc3bd83[_0x431e('0x35')][_0x431e('0x43')]){_0x3ceac5['include']=[{'all':!![]}];}_0x3ceac5=_['merge']({},_0x3ceac5,_0xc3bd83[_0x431e('0x42')]);return db[_0x431e('0x2e')][_0x431e('0x4b')](_0x3ceac5)[_0x431e('0x27')](handleEntityNotFound(_0x19d9e8,null))[_0x431e('0x27')](respondWithResult(_0x19d9e8,null))[_0x431e('0x47')](handleError(_0x19d9e8,null));};exports[_0x431e('0x4c')]=function(_0x5341dd,_0x480734){return db['Dynamics365Field'][_0x431e('0x4c')](_0x5341dd[_0x431e('0x4d')],{})[_0x431e('0x27')](respondWithResult(_0x480734,0xc9))[_0x431e('0x47')](handleError(_0x480734,null));};exports[_0x431e('0x4e')]=function(_0x5734ea,_0x3c9fd1){if(_0x5734ea['body']['id']){delete _0x5734ea[_0x431e('0x4d')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x5734ea[_0x431e('0x49')]['id']}})[_0x431e('0x27')](handleEntityNotFound(_0x3c9fd1,null))[_0x431e('0x27')](saveUpdates(_0x5734ea[_0x431e('0x4d')],null))['then'](respondWithResult(_0x3c9fd1,null))[_0x431e('0x47')](handleError(_0x3c9fd1,null));};exports[_0x431e('0x28')]=function(_0x5244fd,_0x5600b5){return db[_0x431e('0x2e')][_0x431e('0x4b')]({'where':{'id':_0x5244fd['params']['id']}})['then'](handleEntityNotFound(_0x5600b5,null))[_0x431e('0x27')](removeEntity(_0x5600b5,null))[_0x431e('0x47')](handleError(_0x5600b5,null));}; \ No newline at end of file +var _0xdb4b=['undefined','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','status','sendStatus','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','end','limit'];(function(_0x35a3c2,_0x556835){var _0x3dde7f=function(_0x554478){while(--_0x554478){_0x35a3c2['push'](_0x35a3c2['shift']());}};_0x3dde7f(++_0x556835);}(_0xdb4b,0x16e));var _0xbdb4=function(_0x34cc52,_0x5f0c7e){_0x34cc52=_0x34cc52-0x0;var _0x296404=_0xdb4b[_0x34cc52];return _0x296404;};'use strict';var emlformat=require(_0xbdb4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbdb4('0x1'));var jsonpatch=require(_0xbdb4('0x2'));var rp=require(_0xbdb4('0x3'));var moment=require(_0xbdb4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbdb4('0x5'));var util=require(_0xbdb4('0x6'));var path=require(_0xbdb4('0x7'));var sox=require(_0xbdb4('0x8'));var csv=require('to-csv');var ejs=require(_0xbdb4('0x9'));var fs=require('fs');var fs_extra=require(_0xbdb4('0xa'));var _=require('lodash');var squel=require(_0xbdb4('0xb'));var crypto=require('crypto');var jsforce=require(_0xbdb4('0xc'));var deskjs=require(_0xbdb4('0xd'));var toCsv=require(_0xbdb4('0xe'));var querystring=require(_0xbdb4('0xf'));var Papa=require(_0xbdb4('0x10'));var Redis=require(_0xbdb4('0x11'));var authService=require(_0xbdb4('0x12'));var qs=require(_0xbdb4('0x13'));var as=require(_0xbdb4('0x14'));var hardwareService=require(_0xbdb4('0x15'));var logger=require(_0xbdb4('0x16'))(_0xbdb4('0x17'));var utils=require('../../config/utils');var config=require(_0xbdb4('0x18'));var licenseUtil=require(_0xbdb4('0x19'));var db=require(_0xbdb4('0x1a'))['db'];function respondWithStatusCode(_0x1b8a69,_0x3f05ec){_0x3f05ec=_0x3f05ec||0xcc;return function(_0x60f6ce){if(_0x60f6ce){return _0x1b8a69['sendStatus'](_0x3f05ec);}return _0x1b8a69['status'](_0x3f05ec)[_0xbdb4('0x1b')]();};}function respondWithResult(_0x1b1f5d,_0x13d58f){_0x13d58f=_0x13d58f||0xc8;return function(_0x44ad8c){if(_0x44ad8c){return _0x1b1f5d['status'](_0x13d58f)['json'](_0x44ad8c);}};}function respondWithFilteredResult(_0x31b809,_0x18613a){return function(_0x5992f5){if(_0x5992f5){var _0x251b94=typeof _0x18613a['offset']==='undefined'&&typeof _0x18613a[_0xbdb4('0x1c')]===_0xbdb4('0x1d');var _0x5ad888=_0x5992f5['count'];var _0x237211=_0x251b94?0x0:_0x18613a['offset'];var _0x2ee8d8=_0x251b94?_0x5992f5[_0xbdb4('0x1e')]:_0x18613a[_0xbdb4('0x1f')]+_0x18613a['limit'];var _0x5ee349;if(_0x2ee8d8>=_0x5ad888){_0x2ee8d8=_0x5ad888;_0x5ee349=0xc8;}else{_0x5ee349=0xce;}_0x31b809['status'](_0x5ee349);return _0x31b809[_0xbdb4('0x20')](_0xbdb4('0x21'),_0x237211+'-'+_0x2ee8d8+'/'+_0x5ad888)[_0xbdb4('0x22')](_0x5992f5);}return null;};}function patchUpdates(_0x486485){return function(_0x43bfa6){try{jsonpatch[_0xbdb4('0x23')](_0x43bfa6,_0x486485,!![]);}catch(_0x27c89d){return BPromise[_0xbdb4('0x24')](_0x27c89d);}return _0x43bfa6[_0xbdb4('0x25')]();};}function saveUpdates(_0x3aa883,_0x1eabdc){return function(_0x16205d){if(_0x16205d){return _0x16205d['update'](_0x3aa883)['then'](function(_0x457e75){return _0x457e75;});}return null;};}function removeEntity(_0x536057,_0x1a2894){return function(_0x1d2417){if(_0x1d2417){return _0x1d2417[_0xbdb4('0x26')]()[_0xbdb4('0x27')](function(){_0x536057[_0xbdb4('0x28')](0xcc)[_0xbdb4('0x1b')]();});}};}function handleEntityNotFound(_0x124db5,_0x1e0d08){return function(_0x3df4d2){if(!_0x3df4d2){_0x124db5[_0xbdb4('0x29')](0x194);}return _0x3df4d2;};}function handleError(_0x2e3788,_0x36026b){_0x36026b=_0x36026b||0x1f4;return function(_0x224a7c){logger[_0xbdb4('0x2a')](_0x224a7c[_0xbdb4('0x2b')]);if(_0x224a7c[_0xbdb4('0x2c')]){delete _0x224a7c[_0xbdb4('0x2c')];}_0x2e3788[_0xbdb4('0x28')](_0x36026b)[_0xbdb4('0x2d')](_0x224a7c);};}exports[_0xbdb4('0x2e')]=function(_0x1dcc89,_0x3c1ff6){var _0x293e82={},_0x5d8c60={},_0x502b28={'count':0x0,'rows':[]};var _0x3c1fa7=_['map'](db[_0xbdb4('0x2f')][_0xbdb4('0x30')],function(_0x1f7a0c){return{'name':_0x1f7a0c[_0xbdb4('0x31')],'type':_0x1f7a0c[_0xbdb4('0x32')][_0xbdb4('0x33')]};});_0x5d8c60['model']=_[_0xbdb4('0x34')](_0x3c1fa7,'name');_0x5d8c60['query']=_[_0xbdb4('0x35')](_0x1dcc89[_0xbdb4('0x36')]);_0x5d8c60[_0xbdb4('0x37')]=_[_0xbdb4('0x38')](_0x5d8c60[_0xbdb4('0x39')],_0x5d8c60[_0xbdb4('0x36')]);_0x293e82['attributes']=_[_0xbdb4('0x38')](_0x5d8c60[_0xbdb4('0x39')],qs[_0xbdb4('0x3a')](_0x1dcc89[_0xbdb4('0x36')][_0xbdb4('0x3a')]));_0x293e82['attributes']=_0x293e82[_0xbdb4('0x3b')][_0xbdb4('0x3c')]?_0x293e82[_0xbdb4('0x3b')]:_0x5d8c60[_0xbdb4('0x39')];if(!_0x1dcc89[_0xbdb4('0x36')][_0xbdb4('0x3d')]('nolimit')){_0x293e82[_0xbdb4('0x1c')]=qs[_0xbdb4('0x1c')](_0x1dcc89['query']['limit']);_0x293e82[_0xbdb4('0x1f')]=qs[_0xbdb4('0x1f')](_0x1dcc89['query'][_0xbdb4('0x1f')]);}_0x293e82[_0xbdb4('0x3e')]=qs[_0xbdb4('0x3f')](_0x1dcc89['query'][_0xbdb4('0x3f')]);_0x293e82[_0xbdb4('0x40')]=qs[_0xbdb4('0x37')](_['pick'](_0x1dcc89[_0xbdb4('0x36')],_0x5d8c60[_0xbdb4('0x37')]),_0x3c1fa7);if(_0x1dcc89[_0xbdb4('0x36')][_0xbdb4('0x41')]){_0x293e82[_0xbdb4('0x40')]=_[_0xbdb4('0x42')](_0x293e82[_0xbdb4('0x40')],{'$or':_[_0xbdb4('0x34')](_0x3c1fa7,function(_0x4373a0){if(_0x4373a0[_0xbdb4('0x32')]!=='VIRTUAL'){var _0x4c1e02={};_0x4c1e02[_0x4373a0[_0xbdb4('0x2c')]]={'$like':'%'+_0x1dcc89[_0xbdb4('0x36')][_0xbdb4('0x41')]+'%'};return _0x4c1e02;}})});}_0x293e82=_['merge']({},_0x293e82,_0x1dcc89[_0xbdb4('0x43')]);var _0x5e6891={'where':_0x293e82[_0xbdb4('0x40')]};return db[_0xbdb4('0x2f')][_0xbdb4('0x1e')](_0x5e6891)['then'](function(_0x4b10af){_0x502b28['count']=_0x4b10af;if(_0x1dcc89[_0xbdb4('0x36')][_0xbdb4('0x44')]){_0x293e82[_0xbdb4('0x45')]=[{'all':!![]}];}return db[_0xbdb4('0x2f')][_0xbdb4('0x46')](_0x293e82);})[_0xbdb4('0x27')](function(_0x4ff548){_0x502b28[_0xbdb4('0x47')]=_0x4ff548;return _0x502b28;})['then'](respondWithFilteredResult(_0x3c1ff6,_0x293e82))[_0xbdb4('0x48')](handleError(_0x3c1ff6,null));};exports[_0xbdb4('0x49')]=function(_0x2428b8,_0x1b5da4){var _0x572d93={'raw':!![],'where':{'id':_0x2428b8['params']['id']}},_0x54bcec={};_0x54bcec[_0xbdb4('0x39')]=_[_0xbdb4('0x35')](db[_0xbdb4('0x2f')][_0xbdb4('0x30')]);_0x54bcec['query']=_[_0xbdb4('0x35')](_0x2428b8[_0xbdb4('0x36')]);_0x54bcec[_0xbdb4('0x37')]=_[_0xbdb4('0x38')](_0x54bcec[_0xbdb4('0x39')],_0x54bcec['query']);_0x572d93[_0xbdb4('0x3b')]=_[_0xbdb4('0x38')](_0x54bcec[_0xbdb4('0x39')],qs[_0xbdb4('0x3a')](_0x2428b8[_0xbdb4('0x36')][_0xbdb4('0x3a')]));_0x572d93['attributes']=_0x572d93[_0xbdb4('0x3b')][_0xbdb4('0x3c')]?_0x572d93[_0xbdb4('0x3b')]:_0x54bcec[_0xbdb4('0x39')];if(_0x2428b8[_0xbdb4('0x36')]['includeAll']){_0x572d93[_0xbdb4('0x45')]=[{'all':!![]}];}_0x572d93=_['merge']({},_0x572d93,_0x2428b8[_0xbdb4('0x43')]);return db[_0xbdb4('0x2f')]['find'](_0x572d93)[_0xbdb4('0x27')](handleEntityNotFound(_0x1b5da4,null))[_0xbdb4('0x27')](respondWithResult(_0x1b5da4,null))['catch'](handleError(_0x1b5da4,null));};exports['create']=function(_0x4c3094,_0x3fb928){return db[_0xbdb4('0x2f')][_0xbdb4('0x4a')](_0x4c3094[_0xbdb4('0x4b')],{})['then'](respondWithResult(_0x3fb928,0xc9))[_0xbdb4('0x48')](handleError(_0x3fb928,null));};exports[_0xbdb4('0x4c')]=function(_0x67e7b6,_0x4b86ef){if(_0x67e7b6[_0xbdb4('0x4b')]['id']){delete _0x67e7b6[_0xbdb4('0x4b')]['id'];}return db[_0xbdb4('0x2f')][_0xbdb4('0x4d')]({'where':{'id':_0x67e7b6[_0xbdb4('0x4e')]['id']}})[_0xbdb4('0x27')](handleEntityNotFound(_0x4b86ef,null))[_0xbdb4('0x27')](saveUpdates(_0x67e7b6[_0xbdb4('0x4b')],null))[_0xbdb4('0x27')](respondWithResult(_0x4b86ef,null))['catch'](handleError(_0x4b86ef,null));};exports['destroy']=function(_0x585804,_0x268e42){return db[_0xbdb4('0x2f')]['find']({'where':{'id':_0x585804['params']['id']}})[_0xbdb4('0x27')](handleEntityNotFound(_0x268e42,null))[_0xbdb4('0x27')](removeEntity(_0x268e42,null))[_0xbdb4('0x48')](handleError(_0x268e42,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f8ef612..4cc530b 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 _0xea9c=['bluebird','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','util'];(function(_0xd3c72,_0x9e8b23){var _0x3c1592=function(_0x35c9a4){while(--_0x35c9a4){_0xd3c72['push'](_0xd3c72['shift']());}};_0x3c1592(++_0x9e8b23);}(_0xea9c,0x17e));var _0xcea9=function(_0x2749fd,_0x2d469f){_0x2749fd=_0x2749fd-0x0;var _0x546220=_0xea9c[_0x2749fd];return _0x546220;};'use strict';var _=require(_0xcea9('0x0'));var util=require(_0xcea9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcea9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcea9('0x3'));module['exports']=function(_0x259df3,_0x121099){return _0x259df3[_0xcea9('0x4')](_0xcea9('0x5'),attributes,{'tableName':_0xcea9('0x6'),'paranoid':![],'indexes':[{'name':_0xcea9('0x7'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5ad=['lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x4d5c5b,_0x54b72a){var _0x479ed2=function(_0x2777ac){while(--_0x2777ac){_0x4d5c5b['push'](_0x4d5c5b['shift']());}};_0x479ed2(++_0x54b72a);}(_0xf5ad,0x1ce));var _0xdf5a=function(_0x12b090,_0x45cacb){_0x12b090=_0x12b090-0x0;var _0x524e92=_0xf5ad[_0x12b090];return _0x524e92;};'use strict';var _=require(_0xdf5a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdf5a('0x1'));var BPromise=require(_0xdf5a('0x2'));var rp=require(_0xdf5a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf5a('0x4'));var config=require(_0xdf5a('0x5'));var attributes=require(_0xdf5a('0x6'));module[_0xdf5a('0x7')]=function(_0x1c8c56,_0x5f2aff){return _0x1c8c56[_0xdf5a('0x8')](_0xdf5a('0x9'),attributes,{'tableName':_0xdf5a('0xa'),'paranoid':![],'indexes':[{'name':_0xdf5a('0xb'),'fields':[_0xdf5a('0xc'),_0xdf5a('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 4bbade6..d11143a 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 _0x68b8=['info','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x58836f,_0x5351e2){var _0x28f9b1=function(_0x30a6cc){while(--_0x30a6cc){_0x58836f['push'](_0x58836f['shift']());}};_0x28f9b1(++_0x5351e2);}(_0x68b8,0x168));var _0x868b=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x68b8[_0xa45395];return _0x3c83d2;};'use strict';var _=require(_0x868b('0x0'));var util=require('util');var moment=require(_0x868b('0x1'));var BPromise=require(_0x868b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x868b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x868b('0x4'))(_0x868b('0x5'));var config=require(_0x868b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x868b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c6f22,_0x4ab8d6,_0x518d1d){return new BPromise(function(_0x58f984,_0x27a2d8){return client[_0x868b('0x8')](_0x5c6f22,_0x518d1d)[_0x868b('0x9')](function(_0x1d8c02){logger['info'](_0x868b('0xa'),_0x4ab8d6,_0x868b('0xb'));logger[_0x868b('0xc')](_0x868b('0xd'),_0x4ab8d6,_0x868b('0xb'),JSON[_0x868b('0xe')](_0x1d8c02));if(_0x1d8c02[_0x868b('0xf')]){if(_0x1d8c02[_0x868b('0xf')][_0x868b('0x10')]===0x1f4){logger[_0x868b('0xf')](_0x868b('0xa'),_0x4ab8d6,_0x1d8c02[_0x868b('0xf')][_0x868b('0x11')]);return _0x27a2d8(_0x1d8c02[_0x868b('0xf')][_0x868b('0x11')]);}logger[_0x868b('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4ab8d6,_0x1d8c02[_0x868b('0xf')]['message']);return _0x58f984(_0x1d8c02[_0x868b('0xf')][_0x868b('0x11')]);}else{logger[_0x868b('0x12')](_0x868b('0xa'),_0x4ab8d6,_0x868b('0xb'));_0x58f984(_0x1d8c02[_0x868b('0x13')][_0x868b('0x11')]);}})[_0x868b('0x14')](function(_0x23d02f){logger[_0x868b('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4ab8d6,_0x23d02f);_0x27a2d8(_0x23d02f);});});} \ No newline at end of file +var _0x6f87=['debug','error','code','message','result','catch','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x3fa7ad,_0x182b55){var _0x59491f=function(_0x326b08){while(--_0x326b08){_0x3fa7ad['push'](_0x3fa7ad['shift']());}};_0x59491f(++_0x182b55);}(_0x6f87,0xc4));var _0x76f8=function(_0x51af32,_0x20e172){_0x51af32=_0x51af32-0x0;var _0x3040d3=_0x6f87[_0x51af32];return _0x3040d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x76f8('0x0'));var BPromise=require('bluebird');var rs=require(_0x76f8('0x1'));var fs=require('fs');var Redis=require(_0x76f8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x76f8('0x3'));var logger=require('../../config/logger')(_0x76f8('0x4'));var config=require(_0x76f8('0x5'));var jayson=require(_0x76f8('0x6'));var client=jayson['client'][_0x76f8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fe67d,_0x49a458,_0x2a9b8b){return new BPromise(function(_0x2d6618,_0x474d69){return client[_0x76f8('0x8')](_0x2fe67d,_0x2a9b8b)[_0x76f8('0x9')](function(_0x434d6f){logger[_0x76f8('0xa')](_0x76f8('0xb'),_0x49a458,_0x76f8('0xc'));logger[_0x76f8('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x49a458,_0x76f8('0xc'),JSON['stringify'](_0x434d6f));if(_0x434d6f[_0x76f8('0xe')]){if(_0x434d6f[_0x76f8('0xe')][_0x76f8('0xf')]===0x1f4){logger[_0x76f8('0xe')](_0x76f8('0xb'),_0x49a458,_0x434d6f[_0x76f8('0xe')][_0x76f8('0x10')]);return _0x474d69(_0x434d6f['error']['message']);}logger[_0x76f8('0xe')](_0x76f8('0xb'),_0x49a458,_0x434d6f[_0x76f8('0xe')]['message']);return _0x2d6618(_0x434d6f[_0x76f8('0xe')][_0x76f8('0x10')]);}else{logger[_0x76f8('0xa')](_0x76f8('0xb'),_0x49a458,_0x76f8('0xc'));_0x2d6618(_0x434d6f[_0x76f8('0x11')]['message']);}})[_0x76f8('0x12')](function(_0x35b48b){logger['error'](_0x76f8('0xb'),_0x49a458,_0x35b48b);_0x474d69(_0x35b48b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1cf9af3..d95e4bf 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 _0x2cb6=['/:id/fields','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations'];(function(_0xc22082,_0x185a14){var _0x18bc7c=function(_0x1181f4){while(--_0x1181f4){_0xc22082['push'](_0xc22082['shift']());}};_0x18bc7c(++_0x185a14);}(_0x2cb6,0x16b));var _0x62cb=function(_0x1bb931,_0x3e46d2){_0x1bb931=_0x1bb931-0x0;var _0x26601e=_0x2cb6[_0x1bb931];return _0x26601e;};'use strict';var multer=require(_0x62cb('0x0'));var util=require(_0x62cb('0x1'));var path=require(_0x62cb('0x2'));var timeout=require(_0x62cb('0x3'));var express=require(_0x62cb('0x4'));var router=express[_0x62cb('0x5')]();var fs_extra=require(_0x62cb('0x6'));var auth=require(_0x62cb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x62cb('0x8'));var controller=require(_0x62cb('0x9'));router[_0x62cb('0xa')]('/',auth[_0x62cb('0xb')](),controller['index']);router['get'](_0x62cb('0xc'),auth[_0x62cb('0xb')](),controller['show']);router['get'](_0x62cb('0xd'),auth[_0x62cb('0xb')](),controller[_0x62cb('0xe')]);router[_0x62cb('0xa')](_0x62cb('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x62cb('0x10')]('/',auth['isAuthenticated'](),controller[_0x62cb('0x11')]);router[_0x62cb('0x10')](_0x62cb('0xd'),auth[_0x62cb('0xb')](),controller['addConfiguration']);router[_0x62cb('0x12')](_0x62cb('0xc'),auth[_0x62cb('0xb')](),controller[_0x62cb('0x13')]);router['delete'](_0x62cb('0xc'),auth[_0x62cb('0xb')](),controller['destroy']);module[_0x62cb('0x14')]=router; \ No newline at end of file +var _0x963c=['/:id/configurations','update','multer','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','post'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0x963c,0xa7));var _0xc963=function(_0x3ee7a9,_0x548054){_0x3ee7a9=_0x3ee7a9-0x0;var _0x4c1219=_0x963c[_0x3ee7a9];return _0x4c1219;};'use strict';var multer=require(_0xc963('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc963('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xc963('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xc963('0x3'));var controller=require(_0xc963('0x4'));router[_0xc963('0x5')]('/',auth['isAuthenticated'](),controller[_0xc963('0x6')]);router['get'](_0xc963('0x7'),auth[_0xc963('0x8')](),controller[_0xc963('0x9')]);router[_0xc963('0x5')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xc963('0x5')](_0xc963('0xa'),auth[_0xc963('0x8')](),controller[_0xc963('0xb')]);router[_0xc963('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc963('0xc')](_0xc963('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xc963('0x7'),auth[_0xc963('0x8')](),controller[_0xc963('0xe')]);router['delete'](_0xc963('0x7'),auth[_0xc963('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 01a4732..d7c66d6 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 _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0xadb5,0xad));var _0x5adb=function(_0x9be14e,_0x3bcd4f){_0x9be14e=_0x9be14e-0x0;var _0x70e580=_0xadb5[_0x9be14e];return _0x70e580;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0598=['exports','STRING','sequelize'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x0598,0x92));var _0x8059=function(_0x3904fa,_0xa0d755){_0x3904fa=_0x3904fa-0x0;var _0x1d9d3b=_0x0598[_0x3904fa];return _0x1d9d3b;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 70ac443..16758ac 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 _0xb9be=['save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','FreshdeskAccount','includeAll','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','order','AccountId','getSubjects','type','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','Subjects','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','description','priority','group','source','ticket_type','default','custom_dropdown','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','reject'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb9be,0xc5));var _0xeb9b=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0xb9be[_0x1fa759];return _0x2da9f4;};'use strict';var emlformat=require(_0xeb9b('0x0'));var rimraf=require(_0xeb9b('0x1'));var zipdir=require(_0xeb9b('0x2'));var jsonpatch=require(_0xeb9b('0x3'));var rp=require(_0xeb9b('0x4'));var moment=require(_0xeb9b('0x5'));var BPromise=require(_0xeb9b('0x6'));var Mustache=require(_0xeb9b('0x7'));var util=require(_0xeb9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9b('0x9'));var ejs=require(_0xeb9b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9b('0xb'));var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0x9'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];var integrations=require(_0xeb9b('0x19'));function respondWithStatusCode(_0x2a01df,_0x51598f){_0x51598f=_0x51598f||0xcc;return function(_0x5e94e3){if(_0x5e94e3){return _0x2a01df['sendStatus'](_0x51598f);}return _0x2a01df[_0xeb9b('0x1a')](_0x51598f)[_0xeb9b('0x1b')]();};}function respondWithResult(_0x2674e6,_0x4ec46d){_0x4ec46d=_0x4ec46d||0xc8;return function(_0x5926e1){if(_0x5926e1){return _0x2674e6['status'](_0x4ec46d)[_0xeb9b('0x1c')](_0x5926e1);}};}function respondWithFilteredResult(_0x1a5f27,_0x406afd){return function(_0x3fa308){if(_0x3fa308){var _0x2c9aa6=typeof _0x406afd[_0xeb9b('0x1d')]===_0xeb9b('0x1e')&&typeof _0x406afd['limit']===_0xeb9b('0x1e');var _0x36e871=_0x3fa308[_0xeb9b('0x1f')];var _0x3a11e3=_0x2c9aa6?0x0:_0x406afd[_0xeb9b('0x1d')];var _0x1a140c=_0x2c9aa6?_0x3fa308[_0xeb9b('0x1f')]:_0x406afd[_0xeb9b('0x1d')]+_0x406afd[_0xeb9b('0x20')];var _0x26e312;if(_0x1a140c>=_0x36e871){_0x1a140c=_0x36e871;_0x26e312=0xc8;}else{_0x26e312=0xce;}_0x1a5f27['status'](_0x26e312);return _0x1a5f27[_0xeb9b('0x21')]('Content-Range',_0x3a11e3+'-'+_0x1a140c+'/'+_0x36e871)['json'](_0x3fa308);}return null;};}function patchUpdates(_0x580498){return function(_0x703f0b){try{jsonpatch['apply'](_0x703f0b,_0x580498,!![]);}catch(_0xbed5ce){return BPromise[_0xeb9b('0x22')](_0xbed5ce);}return _0x703f0b[_0xeb9b('0x23')]();};}function saveUpdates(_0x37d7e0,_0x3c8be7){return function(_0x43dab8){if(_0x43dab8){return _0x43dab8[_0xeb9b('0x24')](_0x37d7e0)[_0xeb9b('0x25')](function(_0x142d1c){return _0x142d1c;});}return null;};}function removeEntity(_0x46df93,_0x61c86d){return function(_0x296f95){if(_0x296f95){return _0x296f95[_0xeb9b('0x26')]()[_0xeb9b('0x25')](function(){_0x46df93[_0xeb9b('0x1a')](0xcc)[_0xeb9b('0x1b')]();});}};}function handleEntityNotFound(_0x4c997e,_0xd57390){return function(_0x4ed960){if(!_0x4ed960){_0x4c997e[_0xeb9b('0x27')](0x194);}return _0x4ed960;};}function handleError(_0x5d6846,_0x347ec1){_0x347ec1=_0x347ec1||0x1f4;return function(_0x4361b9){logger[_0xeb9b('0x28')](_0x4361b9[_0xeb9b('0x29')]);if(_0x4361b9['name']){delete _0x4361b9[_0xeb9b('0x2a')];}_0x5d6846[_0xeb9b('0x1a')](_0x347ec1)['send'](_0x4361b9);};}exports[_0xeb9b('0x2b')]=function(_0x33bb1d,_0x5ce745){var _0x2a4b51={},_0x2ea20f={},_0x4188d5={'count':0x0,'rows':[]};var _0x48c5f4=_[_0xeb9b('0x2c')](db['FreshdeskAccount'][_0xeb9b('0x2d')],function(_0x4c1331){return{'name':_0x4c1331[_0xeb9b('0x2e')],'type':_0x4c1331['type'][_0xeb9b('0x2f')]};});_0x2ea20f['model']=_[_0xeb9b('0x2c')](_0x48c5f4,'name');_0x2ea20f[_0xeb9b('0x30')]=_[_0xeb9b('0x31')](_0x33bb1d[_0xeb9b('0x30')]);_0x2ea20f[_0xeb9b('0x32')]=_[_0xeb9b('0x33')](_0x2ea20f[_0xeb9b('0x34')],_0x2ea20f[_0xeb9b('0x30')]);_0x2a4b51[_0xeb9b('0x35')]=_[_0xeb9b('0x33')](_0x2ea20f[_0xeb9b('0x34')],qs['fields'](_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x36')]));_0x2a4b51[_0xeb9b('0x35')]=_0x2a4b51[_0xeb9b('0x35')][_0xeb9b('0x37')]?_0x2a4b51[_0xeb9b('0x35')]:_0x2ea20f[_0xeb9b('0x34')];if(!_0x33bb1d['query'][_0xeb9b('0x38')](_0xeb9b('0x39'))){_0x2a4b51[_0xeb9b('0x20')]=qs['limit'](_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x20')]);_0x2a4b51[_0xeb9b('0x1d')]=qs[_0xeb9b('0x1d')](_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x1d')]);}_0x2a4b51['order']=qs[_0xeb9b('0x3a')](_0x33bb1d[_0xeb9b('0x30')]['sort']);_0x2a4b51[_0xeb9b('0x3b')]=qs[_0xeb9b('0x32')](_[_0xeb9b('0x3c')](_0x33bb1d[_0xeb9b('0x30')],_0x2ea20f[_0xeb9b('0x32')]),_0x48c5f4);if(_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x3d')]){_0x2a4b51['where']=_[_0xeb9b('0x3e')](_0x2a4b51[_0xeb9b('0x3b')],{'$or':_[_0xeb9b('0x2c')](_0x48c5f4,function(_0x53d2f7){if(_0x53d2f7['type']!=='VIRTUAL'){var _0x26dc71={};_0x26dc71[_0x53d2f7[_0xeb9b('0x2a')]]={'$like':'%'+_0x33bb1d[_0xeb9b('0x30')]['filter']+'%'};return _0x26dc71;}})});}_0x2a4b51=_[_0xeb9b('0x3e')]({},_0x2a4b51,_0x33bb1d[_0xeb9b('0x3f')]);var _0x240d8d={'where':_0x2a4b51[_0xeb9b('0x3b')]};return db[_0xeb9b('0x40')][_0xeb9b('0x1f')](_0x240d8d)[_0xeb9b('0x25')](function(_0x492122){_0x4188d5[_0xeb9b('0x1f')]=_0x492122;if(_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x41')]){_0x2a4b51['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0xeb9b('0x42')](_0x2a4b51);})[_0xeb9b('0x25')](function(_0x495998){_0x4188d5[_0xeb9b('0x43')]=_0x495998;return _0x4188d5;})['then'](respondWithFilteredResult(_0x5ce745,_0x2a4b51))[_0xeb9b('0x44')](handleError(_0x5ce745,null));};exports[_0xeb9b('0x45')]=function(_0x28b075,_0x300565){var _0xbee63e={'raw':![],'where':{'id':_0x28b075[_0xeb9b('0x46')]['id']}},_0x10f483={};_0x10f483[_0xeb9b('0x34')]=_[_0xeb9b('0x31')](db[_0xeb9b('0x40')][_0xeb9b('0x2d')]);_0x10f483[_0xeb9b('0x30')]=_['keys'](_0x28b075['query']);_0x10f483[_0xeb9b('0x32')]=_['intersection'](_0x10f483[_0xeb9b('0x34')],_0x10f483[_0xeb9b('0x30')]);_0xbee63e[_0xeb9b('0x35')]=_['intersection'](_0x10f483[_0xeb9b('0x34')],qs[_0xeb9b('0x36')](_0x28b075['query'][_0xeb9b('0x36')]));_0xbee63e[_0xeb9b('0x35')]=_0xbee63e[_0xeb9b('0x35')][_0xeb9b('0x37')]?_0xbee63e[_0xeb9b('0x35')]:_0x10f483[_0xeb9b('0x34')];if(_0x28b075[_0xeb9b('0x30')][_0xeb9b('0x41')]){_0xbee63e['include']=[{'all':!![]}];}_0xbee63e=_['merge']({},_0xbee63e,_0x28b075[_0xeb9b('0x3f')]);return db['FreshdeskAccount']['find'](_0xbee63e)[_0xeb9b('0x25')](handleEntityNotFound(_0x300565,null))[_0xeb9b('0x25')](respondWithResult(_0x300565,null))[_0xeb9b('0x44')](handleError(_0x300565,null));};exports[_0xeb9b('0x47')]=function(_0x45bc74,_0x2fd6ee){return db['FreshdeskAccount']['create'](_0x45bc74['body'],{})[_0xeb9b('0x25')](respondWithResult(_0x2fd6ee,0xc9))['catch'](handleError(_0x2fd6ee,null));};exports[_0xeb9b('0x24')]=function(_0x2ee59c,_0x2ae9bf){if(_0x2ee59c[_0xeb9b('0x48')]['id']){delete _0x2ee59c[_0xeb9b('0x48')]['id'];}return db[_0xeb9b('0x40')][_0xeb9b('0x49')]({'where':{'id':_0x2ee59c[_0xeb9b('0x46')]['id']}})[_0xeb9b('0x25')](handleEntityNotFound(_0x2ae9bf,null))[_0xeb9b('0x25')](saveUpdates(_0x2ee59c['body'],null))['then'](respondWithResult(_0x2ae9bf,null))[_0xeb9b('0x44')](handleError(_0x2ae9bf,null));};exports[_0xeb9b('0x26')]=function(_0x542ef4,_0x19bfe9){return db['FreshdeskAccount'][_0xeb9b('0x49')]({'where':{'id':_0x542ef4[_0xeb9b('0x46')]['id']}})['then'](handleEntityNotFound(_0x19bfe9,null))['then'](removeEntity(_0x19bfe9,null))['catch'](handleError(_0x19bfe9,null));};exports[_0xeb9b('0x4a')]=function(_0x32d8cd,_0x263453,_0x4fe9d0){var _0x4ded40={};var _0x471161={};var _0x1833c2;var _0x3e6e73;return db[_0xeb9b('0x40')][_0xeb9b('0x4b')]({'where':{'id':_0x32d8cd[_0xeb9b('0x46')]['id']}})['then'](handleEntityNotFound(_0x263453,null))[_0xeb9b('0x25')](function(_0x1fab7a){if(_0x1fab7a){_0x1833c2=_0x1fab7a;_0x471161['model']=_[_0xeb9b('0x31')](db['FreshdeskConfiguration'][_0xeb9b('0x2d')]);_0x471161[_0xeb9b('0x30')]=_['keys'](_0x32d8cd[_0xeb9b('0x30')]);_0x471161['filters']=_[_0xeb9b('0x33')](_0x471161[_0xeb9b('0x34')],_0x471161[_0xeb9b('0x30')]);_0x4ded40[_0xeb9b('0x35')]=_[_0xeb9b('0x33')](_0x471161['model'],qs[_0xeb9b('0x36')](_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x36')]));_0x4ded40['attributes']=_0x4ded40[_0xeb9b('0x35')][_0xeb9b('0x37')]?_0x4ded40[_0xeb9b('0x35')]:_0x471161[_0xeb9b('0x34')];_0x4ded40[_0xeb9b('0x4c')]=qs[_0xeb9b('0x3a')](_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x3a')]);_0x4ded40[_0xeb9b('0x3b')]=qs[_0xeb9b('0x32')](_[_0xeb9b('0x3c')](_0x32d8cd['query'],_0x471161['filters']));if(_0x32d8cd['query'][_0xeb9b('0x3d')]){_0x4ded40['where']=_[_0xeb9b('0x3e')](_0x4ded40[_0xeb9b('0x3b')],{'$or':_[_0xeb9b('0x2c')](_0x4ded40['attributes'],function(_0x27deea){var _0xb29d24={};_0xb29d24[_0x27deea]={'$like':'%'+_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x3d')]+'%'};return _0xb29d24;})});}_0x4ded40=_[_0xeb9b('0x3e')]({},_0x4ded40,_0x32d8cd[_0xeb9b('0x3f')]);return _0x1833c2[_0xeb9b('0x4a')](_0x4ded40);}})[_0xeb9b('0x25')](function(_0x58a3e2){if(_0x58a3e2){_0x3e6e73=_0x58a3e2['length'];if(!_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x38')](_0xeb9b('0x39'))){_0x4ded40['limit']=qs[_0xeb9b('0x20')](_0x32d8cd['query'][_0xeb9b('0x20')]);_0x4ded40['offset']=qs[_0xeb9b('0x1d')](_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x1d')]);}return _0x1833c2[_0xeb9b('0x4a')](_0x4ded40);}})[_0xeb9b('0x25')](function(_0x4be938){if(_0x4be938){return _0x4be938?{'count':_0x3e6e73,'rows':_0x4be938}:null;}})[_0xeb9b('0x25')](respondWithResult(_0x263453,null))[_0xeb9b('0x44')](handleError(_0x263453,null));};exports['addConfiguration']=function(_0x5a690a,_0x436470,_0x39c248){if(_0x5a690a['body']['id']){delete _0x5a690a[_0xeb9b('0x48')]['id'];}return db['FreshdeskAccount'][_0xeb9b('0x4b')]({'where':{'id':_0x5a690a['params']['id']}})[_0xeb9b('0x25')](handleEntityNotFound(_0x436470,null))[_0xeb9b('0x25')](function(_0x417221){if(_0x417221){_0x5a690a[_0xeb9b('0x48')][_0xeb9b('0x4d')]=_0x417221['id'];_0x5a690a[_0xeb9b('0x48')]['Subjects']=integrations[_0xeb9b('0x4e')](_0x5a690a[_0xeb9b('0x48')]['channel'],_0x5a690a[_0xeb9b('0x48')][_0xeb9b('0x4f')]);_0x5a690a[_0xeb9b('0x48')][_0xeb9b('0x50')]=integrations['getDescriptions'](_0x5a690a[_0xeb9b('0x48')][_0xeb9b('0x51')],_0x5a690a['body'][_0xeb9b('0x4f')]);return db[_0xeb9b('0x52')][_0xeb9b('0x47')](_0x5a690a[_0xeb9b('0x48')],{'include':[{'model':db[_0xeb9b('0x53')],'as':_0xeb9b('0x54')},{'model':db[_0xeb9b('0x53')],'as':'Descriptions'}]});}return null;})[_0xeb9b('0x25')](respondWithResult(_0x436470,null))[_0xeb9b('0x44')](handleError(_0x436470,null));};exports['getFields']=function(_0x289654,_0x6a85fd,_0x2fb07e){var _0x25398e='';return db['FreshdeskAccount'][_0xeb9b('0x4b')]({'where':{'id':_0x289654[_0xeb9b('0x46')]['id']},'attributes':['id',_0xeb9b('0x55'),_0xeb9b('0x56')]})[_0xeb9b('0x25')](handleEntityNotFound(_0x6a85fd,null))[_0xeb9b('0x25')](function(_0x46a070){if(_0x46a070){_0x25398e=_0x46a070[_0xeb9b('0x55')];var _0xdbb94f=_0x25398e[_0xeb9b('0x57')](-0x1);if(_0xdbb94f==='/'){_0x25398e=_0x25398e[_0xeb9b('0x58')](0x0,_0x25398e[_0xeb9b('0x59')](_0xdbb94f));}return rp({'method':_0xeb9b('0x5a'),'uri':util[_0xeb9b('0x5b')](_0xeb9b('0x5c'),_0x25398e,_0xeb9b('0x5d')),'headers':{'Authorization':util['format'](_0xeb9b('0x5e'),new Buffer(util[_0xeb9b('0x5b')](_0xeb9b('0x5f'),_0x46a070['apiKey']))['toString'](_0xeb9b('0x60')))},'json':!![]});}})['then'](function(_0x1e842f){if(_0x1e842f){var _0x463767=[_0xeb9b('0x61'),_0xeb9b('0x62'),_0xeb9b('0x63'),_0xeb9b('0x64'),_0xeb9b('0x1a'),_0xeb9b('0x65'),_0xeb9b('0x66'),_0xeb9b('0x67'),_0xeb9b('0x68'),_0xeb9b('0x66'),'company'];_['remove'](_0x1e842f,function(_0x2a47e1){return _0x463767['includes'](_0x2a47e1['name'])||!_0x2a47e1[_0xeb9b('0x69')]&&_0x2a47e1['type']!=='custom_text'&&_0x2a47e1['type']!==_0xeb9b('0x6a');});return{'count':_0x1e842f[_0xeb9b('0x37')],'rows':_[_0xeb9b('0x2c')](_0x1e842f,function(_0x37d1f5){return{'id':_0x37d1f5['name'],'name':_0x37d1f5[_0xeb9b('0x6b')],'custom':!_0x37d1f5[_0xeb9b('0x69')],'options':_0x37d1f5[_0xeb9b('0x6c')]?_['map'](_0x37d1f5['choices'],function(_0x3ea644){return{'name':_['capitalize'](_0x3ea644),'value':_0x3ea644};}):[]};})};}})[_0xeb9b('0x25')](respondWithResult(_0x6a85fd,null))['catch'](function(_0x4a18ef){var _0xa7e9c3=_0x289654['query'][_0xeb9b('0x6d')]?0x1f4:_0x4a18ef['statusCode']||0x1f4;logger['error'](_0xeb9b('0x6e'),_0xeb9b('0x6f'),_0xa7e9c3,JSON[_0xeb9b('0x70')](_0x4a18ef));delete _0x4a18ef[_0xeb9b('0x2a')];if(_0xa7e9c3===0x191){_0xa7e9c3=0x190;}_0x6a85fd['status'](_0xa7e9c3)[_0xeb9b('0x71')](_0x289654[_0xeb9b('0x30')][_0xeb9b('0x6d')]?{'message':_0xeb9b('0x72'),'statusCode':_0x4a18ef[_0xeb9b('0x73')]}:_0x4a18ef);});}; \ No newline at end of file +var _0x4b6c=['getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','status','send','index','FreshdeskAccount','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','include','show','params','rawAttributes','find','catch','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','options','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','source','group','remove','includes','default','label','capitalize'];(function(_0x5ef3a1,_0x3e6faf){var _0x9fce0f=function(_0x10f154){while(--_0x10f154){_0x5ef3a1['push'](_0x5ef3a1['shift']());}};_0x9fce0f(++_0x3e6faf);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc4b6('0x0'));var rimraf=require(_0xc4b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4b6('0x2'));var rp=require(_0xc4b6('0x3'));var moment=require(_0xc4b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc4b6('0x5'));var util=require(_0xc4b6('0x6'));var path=require(_0xc4b6('0x7'));var sox=require('sox');var csv=require(_0xc4b6('0x8'));var ejs=require(_0xc4b6('0x9'));var fs=require('fs');var fs_extra=require(_0xc4b6('0xa'));var _=require(_0xc4b6('0xb'));var squel=require('squel');var crypto=require(_0xc4b6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4b6('0x8'));var querystring=require(_0xc4b6('0xd'));var Papa=require(_0xc4b6('0xe'));var Redis=require(_0xc4b6('0xf'));var authService=require(_0xc4b6('0x10'));var qs=require(_0xc4b6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4b6('0x12'));var logger=require(_0xc4b6('0x13'))('api');var utils=require(_0xc4b6('0x14'));var config=require(_0xc4b6('0x15'));var licenseUtil=require(_0xc4b6('0x16'));var db=require(_0xc4b6('0x17'))['db'];var integrations=require(_0xc4b6('0x18'));function respondWithStatusCode(_0xd6208e,_0xf2a30e){_0xf2a30e=_0xf2a30e||0xcc;return function(_0x18991b){if(_0x18991b){return _0xd6208e[_0xc4b6('0x19')](_0xf2a30e);}return _0xd6208e['status'](_0xf2a30e)[_0xc4b6('0x1a')]();};}function respondWithResult(_0x2b7aab,_0x5d9008){_0x5d9008=_0x5d9008||0xc8;return function(_0x17b63b){if(_0x17b63b){return _0x2b7aab['status'](_0x5d9008)[_0xc4b6('0x1b')](_0x17b63b);}};}function respondWithFilteredResult(_0x408652,_0x20c517){return function(_0x23144b){if(_0x23144b){var _0x5f54fa=typeof _0x20c517['offset']===_0xc4b6('0x1c')&&typeof _0x20c517[_0xc4b6('0x1d')]===_0xc4b6('0x1c');var _0x32b425=_0x23144b[_0xc4b6('0x1e')];var _0x326600=_0x5f54fa?0x0:_0x20c517[_0xc4b6('0x1f')];var _0x784d54=_0x5f54fa?_0x23144b[_0xc4b6('0x1e')]:_0x20c517[_0xc4b6('0x1f')]+_0x20c517[_0xc4b6('0x1d')];var _0x19ad3f;if(_0x784d54>=_0x32b425){_0x784d54=_0x32b425;_0x19ad3f=0xc8;}else{_0x19ad3f=0xce;}_0x408652['status'](_0x19ad3f);return _0x408652[_0xc4b6('0x20')](_0xc4b6('0x21'),_0x326600+'-'+_0x784d54+'/'+_0x32b425)[_0xc4b6('0x1b')](_0x23144b);}return null;};}function patchUpdates(_0x15a3de){return function(_0x9b0780){try{jsonpatch[_0xc4b6('0x22')](_0x9b0780,_0x15a3de,!![]);}catch(_0x2ba273){return BPromise[_0xc4b6('0x23')](_0x2ba273);}return _0x9b0780['save']();};}function saveUpdates(_0x8fcdde,_0x41fedf){return function(_0x252cd3){if(_0x252cd3){return _0x252cd3[_0xc4b6('0x24')](_0x8fcdde)[_0xc4b6('0x25')](function(_0x214801){return _0x214801;});}return null;};}function removeEntity(_0x2c2d35,_0x81b146){return function(_0x187dac){if(_0x187dac){return _0x187dac['destroy']()['then'](function(){_0x2c2d35['status'](0xcc)[_0xc4b6('0x1a')]();});}};}function handleEntityNotFound(_0x31a69f,_0x4f5949){return function(_0x1c445b){if(!_0x1c445b){_0x31a69f[_0xc4b6('0x19')](0x194);}return _0x1c445b;};}function handleError(_0x50b946,_0x1209db){_0x1209db=_0x1209db||0x1f4;return function(_0x28fb10){logger[_0xc4b6('0x26')](_0x28fb10[_0xc4b6('0x27')]);if(_0x28fb10[_0xc4b6('0x28')]){delete _0x28fb10[_0xc4b6('0x28')];}_0x50b946[_0xc4b6('0x29')](_0x1209db)[_0xc4b6('0x2a')](_0x28fb10);};}exports[_0xc4b6('0x2b')]=function(_0x473e8d,_0x4a7b99){var _0x317924={},_0x17a744={},_0xb6ec64={'count':0x0,'rows':[]};var _0x5a98a1=_['map'](db[_0xc4b6('0x2c')]['rawAttributes'],function(_0x3ec5c1){return{'name':_0x3ec5c1[_0xc4b6('0x2d')],'type':_0x3ec5c1[_0xc4b6('0x2e')]['key']};});_0x17a744[_0xc4b6('0x2f')]=_[_0xc4b6('0x30')](_0x5a98a1,'name');_0x17a744[_0xc4b6('0x31')]=_[_0xc4b6('0x32')](_0x473e8d[_0xc4b6('0x31')]);_0x17a744['filters']=_['intersection'](_0x17a744[_0xc4b6('0x2f')],_0x17a744[_0xc4b6('0x31')]);_0x317924['attributes']=_[_0xc4b6('0x33')](_0x17a744['model'],qs[_0xc4b6('0x34')](_0x473e8d[_0xc4b6('0x31')][_0xc4b6('0x34')]));_0x317924[_0xc4b6('0x35')]=_0x317924[_0xc4b6('0x35')][_0xc4b6('0x36')]?_0x317924[_0xc4b6('0x35')]:_0x17a744['model'];if(!_0x473e8d['query']['hasOwnProperty'](_0xc4b6('0x37'))){_0x317924[_0xc4b6('0x1d')]=qs[_0xc4b6('0x1d')](_0x473e8d[_0xc4b6('0x31')]['limit']);_0x317924['offset']=qs[_0xc4b6('0x1f')](_0x473e8d[_0xc4b6('0x31')][_0xc4b6('0x1f')]);}_0x317924[_0xc4b6('0x38')]=qs[_0xc4b6('0x39')](_0x473e8d[_0xc4b6('0x31')][_0xc4b6('0x39')]);_0x317924['where']=qs[_0xc4b6('0x3a')](_[_0xc4b6('0x3b')](_0x473e8d['query'],_0x17a744[_0xc4b6('0x3a')]),_0x5a98a1);if(_0x473e8d[_0xc4b6('0x31')][_0xc4b6('0x3c')]){_0x317924[_0xc4b6('0x3d')]=_[_0xc4b6('0x3e')](_0x317924[_0xc4b6('0x3d')],{'$or':_[_0xc4b6('0x30')](_0x5a98a1,function(_0x36b744){if(_0x36b744[_0xc4b6('0x2e')]!=='VIRTUAL'){var _0x334af0={};_0x334af0[_0x36b744['name']]={'$like':'%'+_0x473e8d[_0xc4b6('0x31')][_0xc4b6('0x3c')]+'%'};return _0x334af0;}})});}_0x317924=_[_0xc4b6('0x3e')]({},_0x317924,_0x473e8d['options']);var _0x3e9f9c={'where':_0x317924[_0xc4b6('0x3d')]};return db[_0xc4b6('0x2c')][_0xc4b6('0x1e')](_0x3e9f9c)['then'](function(_0x532eff){_0xb6ec64[_0xc4b6('0x1e')]=_0x532eff;if(_0x473e8d[_0xc4b6('0x31')][_0xc4b6('0x3f')]){_0x317924[_0xc4b6('0x40')]=[{'all':!![]}];}return db[_0xc4b6('0x2c')]['findAll'](_0x317924);})[_0xc4b6('0x25')](function(_0x5d8473){_0xb6ec64['rows']=_0x5d8473;return _0xb6ec64;})[_0xc4b6('0x25')](respondWithFilteredResult(_0x4a7b99,_0x317924))['catch'](handleError(_0x4a7b99,null));};exports[_0xc4b6('0x41')]=function(_0x2f29e5,_0x2f709d){var _0x555acf={'raw':![],'where':{'id':_0x2f29e5[_0xc4b6('0x42')]['id']}},_0x1a47ad={};_0x1a47ad[_0xc4b6('0x2f')]=_[_0xc4b6('0x32')](db[_0xc4b6('0x2c')][_0xc4b6('0x43')]);_0x1a47ad['query']=_['keys'](_0x2f29e5[_0xc4b6('0x31')]);_0x1a47ad[_0xc4b6('0x3a')]=_['intersection'](_0x1a47ad['model'],_0x1a47ad['query']);_0x555acf[_0xc4b6('0x35')]=_[_0xc4b6('0x33')](_0x1a47ad[_0xc4b6('0x2f')],qs[_0xc4b6('0x34')](_0x2f29e5[_0xc4b6('0x31')][_0xc4b6('0x34')]));_0x555acf[_0xc4b6('0x35')]=_0x555acf['attributes'][_0xc4b6('0x36')]?_0x555acf[_0xc4b6('0x35')]:_0x1a47ad[_0xc4b6('0x2f')];if(_0x2f29e5[_0xc4b6('0x31')][_0xc4b6('0x3f')]){_0x555acf[_0xc4b6('0x40')]=[{'all':!![]}];}_0x555acf=_[_0xc4b6('0x3e')]({},_0x555acf,_0x2f29e5['options']);return db['FreshdeskAccount'][_0xc4b6('0x44')](_0x555acf)[_0xc4b6('0x25')](handleEntityNotFound(_0x2f709d,null))[_0xc4b6('0x25')](respondWithResult(_0x2f709d,null))[_0xc4b6('0x45')](handleError(_0x2f709d,null));};exports['create']=function(_0x5c7772,_0x2b65a2){return db[_0xc4b6('0x2c')][_0xc4b6('0x46')](_0x5c7772['body'],{})[_0xc4b6('0x25')](respondWithResult(_0x2b65a2,0xc9))['catch'](handleError(_0x2b65a2,null));};exports[_0xc4b6('0x24')]=function(_0x2f272f,_0x4f36b2){if(_0x2f272f[_0xc4b6('0x47')]['id']){delete _0x2f272f['body']['id'];}return db[_0xc4b6('0x2c')][_0xc4b6('0x44')]({'where':{'id':_0x2f272f[_0xc4b6('0x42')]['id']}})[_0xc4b6('0x25')](handleEntityNotFound(_0x4f36b2,null))[_0xc4b6('0x25')](saveUpdates(_0x2f272f['body'],null))[_0xc4b6('0x25')](respondWithResult(_0x4f36b2,null))[_0xc4b6('0x45')](handleError(_0x4f36b2,null));};exports[_0xc4b6('0x48')]=function(_0xd1643f,_0x3e94df){return db[_0xc4b6('0x2c')][_0xc4b6('0x44')]({'where':{'id':_0xd1643f[_0xc4b6('0x42')]['id']}})[_0xc4b6('0x25')](handleEntityNotFound(_0x3e94df,null))['then'](removeEntity(_0x3e94df,null))[_0xc4b6('0x45')](handleError(_0x3e94df,null));};exports[_0xc4b6('0x49')]=function(_0x41b113,_0x3c61b4,_0xb29c9){var _0x1f34d6={};var _0xad8b52={};var _0x3896e6;var _0x56d6d7;return db['FreshdeskAccount'][_0xc4b6('0x4a')]({'where':{'id':_0x41b113[_0xc4b6('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c61b4,null))[_0xc4b6('0x25')](function(_0x290cd4){if(_0x290cd4){_0x3896e6=_0x290cd4;_0xad8b52[_0xc4b6('0x2f')]=_[_0xc4b6('0x32')](db[_0xc4b6('0x4b')]['rawAttributes']);_0xad8b52[_0xc4b6('0x31')]=_[_0xc4b6('0x32')](_0x41b113['query']);_0xad8b52[_0xc4b6('0x3a')]=_[_0xc4b6('0x33')](_0xad8b52['model'],_0xad8b52['query']);_0x1f34d6[_0xc4b6('0x35')]=_['intersection'](_0xad8b52['model'],qs[_0xc4b6('0x34')](_0x41b113[_0xc4b6('0x31')]['fields']));_0x1f34d6[_0xc4b6('0x35')]=_0x1f34d6[_0xc4b6('0x35')]['length']?_0x1f34d6[_0xc4b6('0x35')]:_0xad8b52[_0xc4b6('0x2f')];_0x1f34d6[_0xc4b6('0x38')]=qs[_0xc4b6('0x39')](_0x41b113['query'][_0xc4b6('0x39')]);_0x1f34d6[_0xc4b6('0x3d')]=qs[_0xc4b6('0x3a')](_[_0xc4b6('0x3b')](_0x41b113[_0xc4b6('0x31')],_0xad8b52[_0xc4b6('0x3a')]));if(_0x41b113[_0xc4b6('0x31')][_0xc4b6('0x3c')]){_0x1f34d6[_0xc4b6('0x3d')]=_[_0xc4b6('0x3e')](_0x1f34d6[_0xc4b6('0x3d')],{'$or':_[_0xc4b6('0x30')](_0x1f34d6[_0xc4b6('0x35')],function(_0x2f0c5d){var _0x319af1={};_0x319af1[_0x2f0c5d]={'$like':'%'+_0x41b113[_0xc4b6('0x31')]['filter']+'%'};return _0x319af1;})});}_0x1f34d6=_[_0xc4b6('0x3e')]({},_0x1f34d6,_0x41b113[_0xc4b6('0x4c')]);return _0x3896e6['getConfigurations'](_0x1f34d6);}})[_0xc4b6('0x25')](function(_0x280437){if(_0x280437){_0x56d6d7=_0x280437[_0xc4b6('0x36')];if(!_0x41b113[_0xc4b6('0x31')][_0xc4b6('0x4d')](_0xc4b6('0x37'))){_0x1f34d6[_0xc4b6('0x1d')]=qs[_0xc4b6('0x1d')](_0x41b113[_0xc4b6('0x31')][_0xc4b6('0x1d')]);_0x1f34d6[_0xc4b6('0x1f')]=qs[_0xc4b6('0x1f')](_0x41b113[_0xc4b6('0x31')][_0xc4b6('0x1f')]);}return _0x3896e6[_0xc4b6('0x49')](_0x1f34d6);}})[_0xc4b6('0x25')](function(_0x16cd26){if(_0x16cd26){return _0x16cd26?{'count':_0x56d6d7,'rows':_0x16cd26}:null;}})[_0xc4b6('0x25')](respondWithResult(_0x3c61b4,null))[_0xc4b6('0x45')](handleError(_0x3c61b4,null));};exports[_0xc4b6('0x4e')]=function(_0x452cac,_0x3df53e,_0x11b241){if(_0x452cac[_0xc4b6('0x47')]['id']){delete _0x452cac[_0xc4b6('0x47')]['id'];}return db[_0xc4b6('0x2c')][_0xc4b6('0x4a')]({'where':{'id':_0x452cac[_0xc4b6('0x42')]['id']}})[_0xc4b6('0x25')](handleEntityNotFound(_0x3df53e,null))['then'](function(_0x38c984){if(_0x38c984){_0x452cac['body'][_0xc4b6('0x4f')]=_0x38c984['id'];_0x452cac[_0xc4b6('0x47')][_0xc4b6('0x50')]=integrations['getSubjects'](_0x452cac[_0xc4b6('0x47')][_0xc4b6('0x51')],_0x452cac[_0xc4b6('0x47')]['type']);_0x452cac[_0xc4b6('0x47')][_0xc4b6('0x52')]=integrations[_0xc4b6('0x53')](_0x452cac['body'][_0xc4b6('0x51')],_0x452cac[_0xc4b6('0x47')][_0xc4b6('0x2e')]);return db['FreshdeskConfiguration'][_0xc4b6('0x46')](_0x452cac[_0xc4b6('0x47')],{'include':[{'model':db['FreshdeskField'],'as':_0xc4b6('0x50')},{'model':db[_0xc4b6('0x54')],'as':_0xc4b6('0x52')}]});}return null;})[_0xc4b6('0x25')](respondWithResult(_0x3df53e,null))[_0xc4b6('0x45')](handleError(_0x3df53e,null));};exports[_0xc4b6('0x55')]=function(_0x7f1ba3,_0x276e33,_0x89be5d){var _0x3c30ee='';return db['FreshdeskAccount'][_0xc4b6('0x4a')]({'where':{'id':_0x7f1ba3[_0xc4b6('0x42')]['id']},'attributes':['id',_0xc4b6('0x56'),_0xc4b6('0x57')]})['then'](handleEntityNotFound(_0x276e33,null))[_0xc4b6('0x25')](function(_0xba7ae){if(_0xba7ae){_0x3c30ee=_0xba7ae[_0xc4b6('0x56')];var _0x3f51b7=_0x3c30ee['slice'](-0x1);if(_0x3f51b7==='/'){_0x3c30ee=_0x3c30ee['substring'](0x0,_0x3c30ee['lastIndexOf'](_0x3f51b7));}return rp({'method':'GET','uri':util['format'](_0xc4b6('0x58'),_0x3c30ee,_0xc4b6('0x59')),'headers':{'Authorization':util[_0xc4b6('0x5a')](_0xc4b6('0x5b'),new Buffer(util[_0xc4b6('0x5a')](_0xc4b6('0x5c'),_0xba7ae['apiKey']))[_0xc4b6('0x5d')](_0xc4b6('0x5e')))},'json':!![]});}})[_0xc4b6('0x25')](function(_0x1c57eb){if(_0x1c57eb){var _0x45f38f=[_0xc4b6('0x5f'),'subject',_0xc4b6('0x60'),_0xc4b6('0x61'),_0xc4b6('0x29'),_0xc4b6('0x62'),'group',_0xc4b6('0x63'),'ticket_type',_0xc4b6('0x64'),'company'];_[_0xc4b6('0x65')](_0x1c57eb,function(_0x4ef015){return _0x45f38f[_0xc4b6('0x66')](_0x4ef015[_0xc4b6('0x28')])||!_0x4ef015[_0xc4b6('0x67')]&&_0x4ef015[_0xc4b6('0x2e')]!=='custom_text'&&_0x4ef015['type']!=='custom_dropdown';});return{'count':_0x1c57eb[_0xc4b6('0x36')],'rows':_[_0xc4b6('0x30')](_0x1c57eb,function(_0x3ea8ea){return{'id':_0x3ea8ea['name'],'name':_0x3ea8ea[_0xc4b6('0x68')],'custom':!_0x3ea8ea['default'],'options':_0x3ea8ea['choices']?_['map'](_0x3ea8ea['choices'],function(_0x5df998){return{'name':_[_0xc4b6('0x69')](_0x5df998),'value':_0x5df998};}):[]};})};}})[_0xc4b6('0x25')](respondWithResult(_0x276e33,null))[_0xc4b6('0x45')](function(_0x2c2d37){var _0x3184d1=_0x7f1ba3[_0xc4b6('0x31')]['test']?0x1f4:_0x2c2d37['statusCode']||0x1f4;logger[_0xc4b6('0x26')](_0xc4b6('0x6a'),_0xc4b6('0x55'),_0x3184d1,JSON[_0xc4b6('0x6b')](_0x2c2d37));delete _0x2c2d37['name'];if(_0x3184d1===0x191){_0x3184d1=0x190;}_0x276e33[_0xc4b6('0x29')](_0x3184d1)[_0xc4b6('0x2a')](_0x7f1ba3[_0xc4b6('0x31')]['test']?{'message':_0xc4b6('0x6c'),'statusCode':_0x2c2d37['statusCode']}:_0x2c2d37);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index cbaae4b..c1db8c8 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 _0xf8bc=['request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x51cd7a,_0x5e42c2){var _0x16a584=function(_0x159230){while(--_0x159230){_0x51cd7a['push'](_0x51cd7a['shift']());}};_0x16a584(++_0x5e42c2);}(_0xf8bc,0xe9));var _0xcf8b=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0xf8bc[_0x453e2b];return _0x50f306;};'use strict';var _=require(_0xcf8b('0x0'));var util=require(_0xcf8b('0x1'));var logger=require(_0xcf8b('0x2'))(_0xcf8b('0x3'));var moment=require('moment');var BPromise=require(_0xcf8b('0x4'));var rp=require(_0xcf8b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf8b('0x6'));var config=require(_0xcf8b('0x7'));var attributes=require(_0xcf8b('0x8'));var integrations=require(_0xcf8b('0x9'));module[_0xcf8b('0xa')]=function(_0x272a8f,_0x259e82){return _0x272a8f[_0xcf8b('0xb')](_0xcf8b('0xc'),attributes,{'tableName':_0xcf8b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7d4=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xf7d4,0x107));var _0x4f7d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xf7d4[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x4f7d('0x0'));var util=require('util');var logger=require(_0x4f7d('0x1'))(_0x4f7d('0x2'));var moment=require('moment');var BPromise=require(_0x4f7d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7d('0x4'));var rimraf=require(_0x4f7d('0x5'));var config=require(_0x4f7d('0x6'));var attributes=require(_0x4f7d('0x7'));var integrations=require(_0x4f7d('0x8'));module[_0x4f7d('0x9')]=function(_0x436625,_0x3572f8){return _0x436625[_0x4f7d('0xa')](_0x4f7d('0xb'),attributes,{'tableName':'int_freshdesk_accounts','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 75e699d..90a3dd7 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 _0x1b66=['map','model','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options','raw','where','attributes','limit','include'];(function(_0x5a233b,_0x20c853){var _0x36c697=function(_0x4f25f0){while(--_0x4f25f0){_0x5a233b['push'](_0x5a233b['shift']());}};_0x36c697(++_0x20c853);}(_0x1b66,0xba));var _0x61b6=function(_0x10912e,_0x230c43){_0x10912e=_0x10912e-0x0;var _0x2dbf9e=_0x1b66[_0x10912e];return _0x2dbf9e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61b6('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61b6('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x61b6('0x2'))(_0x61b6('0x3'));var config=require(_0x61b6('0x4'));var jayson=require(_0x61b6('0x5'));var client=jayson['client'][_0x61b6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x501310,_0x577c74,_0x5c8b40){return new BPromise(function(_0x11d049,_0x34f688){return client['request'](_0x501310,_0x5c8b40)[_0x61b6('0x7')](function(_0x40c4dc){logger[_0x61b6('0x8')](_0x61b6('0x9'),_0x577c74,_0x61b6('0xa'));logger[_0x61b6('0xb')](_0x61b6('0xc'),_0x577c74,_0x61b6('0xa'),JSON[_0x61b6('0xd')](_0x40c4dc));if(_0x40c4dc[_0x61b6('0xe')]){if(_0x40c4dc[_0x61b6('0xe')]['code']===0x1f4){logger[_0x61b6('0xe')](_0x61b6('0x9'),_0x577c74,_0x40c4dc[_0x61b6('0xe')][_0x61b6('0xf')]);return _0x34f688(_0x40c4dc[_0x61b6('0xe')][_0x61b6('0xf')]);}logger[_0x61b6('0xe')](_0x61b6('0x9'),_0x577c74,_0x40c4dc['error']['message']);return _0x11d049(_0x40c4dc[_0x61b6('0xe')][_0x61b6('0xf')]);}else{logger['info'](_0x61b6('0x9'),_0x577c74,_0x61b6('0xa'));_0x11d049(_0x40c4dc['result'][_0x61b6('0xf')]);}})[_0x61b6('0x10')](function(_0x3a4f6a){logger[_0x61b6('0xe')](_0x61b6('0x9'),_0x577c74,_0x3a4f6a);_0x34f688(_0x3a4f6a);});});}exports['GetFreshdeskAccount']=function(_0x6535b7){var _0x2758e3=this;return new Promise(function(_0x197a06,_0x4c63a9){return db['FreshdeskAccount'][_0x61b6('0x11')]({'raw':_0x6535b7[_0x61b6('0x12')]?_0x6535b7['options'][_0x61b6('0x13')]===undefined?!![]:![]:!![],'where':_0x6535b7['options']?_0x6535b7[_0x61b6('0x12')][_0x61b6('0x14')]||null:null,'attributes':_0x6535b7['options']?_0x6535b7[_0x61b6('0x12')][_0x61b6('0x15')]||null:null,'limit':_0x6535b7[_0x61b6('0x12')]?_0x6535b7[_0x61b6('0x12')][_0x61b6('0x16')]||null:null,'include':_0x6535b7[_0x61b6('0x12')]?_0x6535b7[_0x61b6('0x12')][_0x61b6('0x17')]?_['map'](_0x6535b7['options']['include'],function(_0x2b5b6b){return{'model':db[_0x2b5b6b['model']],'as':_0x2b5b6b['as'],'attributes':_0x2b5b6b[_0x61b6('0x15')],'include':_0x2b5b6b['include']?_[_0x61b6('0x18')](_0x2b5b6b['include'],function(_0x1ffda7){return{'model':db[_0x1ffda7[_0x61b6('0x19')]],'as':_0x1ffda7['as'],'attributes':_0x1ffda7[_0x61b6('0x15')],'include':_0x1ffda7[_0x61b6('0x17')]?_['map'](_0x1ffda7['include'],function(_0x2d6e00){return{'model':db[_0x2d6e00[_0x61b6('0x19')]],'as':_0x2d6e00['as'],'attributes':_0x2d6e00[_0x61b6('0x15')]};}):[]};}):[]};}):[]:[]})[_0x61b6('0x7')](function(_0x1ec016){logger[_0x61b6('0x8')]('GetFreshdeskAccount',_0x6535b7);logger[_0x61b6('0xb')](_0x61b6('0x1a'),_0x6535b7,JSON[_0x61b6('0xd')](_0x1ec016));_0x197a06(_0x1ec016);})[_0x61b6('0x10')](function(_0x1e89ce){logger['error'](_0x61b6('0x1a'),_0x1e89ce[_0x61b6('0xf')],_0x6535b7);_0x4c63a9(_0x2758e3[_0x61b6('0xe')](0x1f4,_0x1e89ce['message']));});});};exports[_0x61b6('0x1b')]=function(_0x37d2cc){var _0x1e9d5a=this;return new Promise(function(_0x108423,_0x2f7c47){return db[_0x61b6('0x1c')][_0x61b6('0x1d')]({'raw':_0x37d2cc[_0x61b6('0x12')]?_0x37d2cc[_0x61b6('0x12')][_0x61b6('0x13')]===undefined?!![]:![]:!![],'where':_0x37d2cc[_0x61b6('0x12')]?_0x37d2cc['options'][_0x61b6('0x14')]||null:null,'attributes':_0x37d2cc[_0x61b6('0x12')]?_0x37d2cc[_0x61b6('0x12')][_0x61b6('0x15')]||null:null,'include':_0x37d2cc['options']?_0x37d2cc[_0x61b6('0x12')][_0x61b6('0x17')]?_[_0x61b6('0x18')](_0x37d2cc[_0x61b6('0x12')]['include'],function(_0x2189e3){return{'model':db[_0x2189e3[_0x61b6('0x19')]],'as':_0x2189e3['as'],'attributes':_0x2189e3[_0x61b6('0x15')],'include':_0x2189e3[_0x61b6('0x17')]?_[_0x61b6('0x18')](_0x2189e3[_0x61b6('0x17')],function(_0x3d0c73){return{'model':db[_0x3d0c73['model']],'as':_0x3d0c73['as'],'attributes':_0x3d0c73[_0x61b6('0x15')],'include':_0x3d0c73[_0x61b6('0x17')]?_[_0x61b6('0x18')](_0x3d0c73['include'],function(_0x1e18c8){return{'model':db[_0x1e18c8[_0x61b6('0x19')]],'as':_0x1e18c8['as'],'attributes':_0x1e18c8[_0x61b6('0x15')]};}):[]};}):[]};}):[]:[]})[_0x61b6('0x7')](function(_0x2dc443){logger[_0x61b6('0x8')](_0x61b6('0x1b'),_0x37d2cc);logger[_0x61b6('0xb')](_0x61b6('0x1b'),_0x37d2cc,JSON['stringify'](_0x2dc443));_0x108423(_0x2dc443);})[_0x61b6('0x10')](function(_0x40d8c9){logger[_0x61b6('0xe')](_0x61b6('0x1b'),_0x40d8c9[_0x61b6('0xf')],_0x37d2cc);_0x2f7c47(_0x1e9d5a[_0x61b6('0xe')](0x1f4,_0x40d8c9[_0x61b6('0xf')]));});});}; \ No newline at end of file +var _0x3f25=['../../config/logger','../../config/environment','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','limit','include','map','model','then','debug','ShowFreshdeskAccount','where','util','moment','bluebird','../../mysqldb'];(function(_0x55b608,_0x279b75){var _0x3af307=function(_0x9a794d){while(--_0x9a794d){_0x55b608['push'](_0x55b608['shift']());}};_0x3af307(++_0x279b75);}(_0x3f25,0xd5));var _0x53f2=function(_0x29e2d6,_0x561e4c){_0x29e2d6=_0x29e2d6-0x0;var _0x196ca1=_0x3f25[_0x29e2d6];return _0x196ca1;};'use strict';var _=require('lodash');var util=require(_0x53f2('0x0'));var moment=require(_0x53f2('0x1'));var BPromise=require(_0x53f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53f2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x53f2('0x4'))('rpc');var config=require(_0x53f2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x53f2('0x6')][_0x53f2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b678d,_0x567102,_0x40231a){return new BPromise(function(_0x4fbd09,_0x2472c1){return client['request'](_0x4b678d,_0x40231a)['then'](function(_0x3f9669){logger[_0x53f2('0x8')](_0x53f2('0x9'),_0x567102,_0x53f2('0xa'));logger['debug'](_0x53f2('0xb'),_0x567102,_0x53f2('0xa'),JSON[_0x53f2('0xc')](_0x3f9669));if(_0x3f9669['error']){if(_0x3f9669['error'][_0x53f2('0xd')]===0x1f4){logger['error'](_0x53f2('0x9'),_0x567102,_0x3f9669[_0x53f2('0xe')][_0x53f2('0xf')]);return _0x2472c1(_0x3f9669[_0x53f2('0xe')][_0x53f2('0xf')]);}logger[_0x53f2('0xe')](_0x53f2('0x9'),_0x567102,_0x3f9669['error']['message']);return _0x4fbd09(_0x3f9669['error'][_0x53f2('0xf')]);}else{logger[_0x53f2('0x8')](_0x53f2('0x9'),_0x567102,_0x53f2('0xa'));_0x4fbd09(_0x3f9669[_0x53f2('0x10')][_0x53f2('0xf')]);}})[_0x53f2('0x11')](function(_0x3f4042){logger['error'](_0x53f2('0x9'),_0x567102,_0x3f4042);_0x2472c1(_0x3f4042);});});}exports[_0x53f2('0x12')]=function(_0x31b89e){var _0xded86f=this;return new Promise(function(_0x45aefe,_0xbffbe6){return db[_0x53f2('0x13')][_0x53f2('0x14')]({'raw':_0x31b89e[_0x53f2('0x15')]?_0x31b89e[_0x53f2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x31b89e[_0x53f2('0x15')]?_0x31b89e[_0x53f2('0x15')]['where']||null:null,'attributes':_0x31b89e['options']?_0x31b89e['options'][_0x53f2('0x16')]||null:null,'limit':_0x31b89e[_0x53f2('0x15')]?_0x31b89e[_0x53f2('0x15')][_0x53f2('0x17')]||null:null,'include':_0x31b89e['options']?_0x31b89e[_0x53f2('0x15')][_0x53f2('0x18')]?_[_0x53f2('0x19')](_0x31b89e[_0x53f2('0x15')][_0x53f2('0x18')],function(_0x34895c){return{'model':db[_0x34895c[_0x53f2('0x1a')]],'as':_0x34895c['as'],'attributes':_0x34895c['attributes'],'include':_0x34895c[_0x53f2('0x18')]?_[_0x53f2('0x19')](_0x34895c['include'],function(_0x5330ef){return{'model':db[_0x5330ef['model']],'as':_0x5330ef['as'],'attributes':_0x5330ef[_0x53f2('0x16')],'include':_0x5330ef[_0x53f2('0x18')]?_[_0x53f2('0x19')](_0x5330ef[_0x53f2('0x18')],function(_0x326a45){return{'model':db[_0x326a45['model']],'as':_0x326a45['as'],'attributes':_0x326a45[_0x53f2('0x16')]};}):[]};}):[]};}):[]:[]})[_0x53f2('0x1b')](function(_0x231e92){logger['info'](_0x53f2('0x12'),_0x31b89e);logger[_0x53f2('0x1c')](_0x53f2('0x12'),_0x31b89e,JSON[_0x53f2('0xc')](_0x231e92));_0x45aefe(_0x231e92);})[_0x53f2('0x11')](function(_0x3e0476){logger['error'](_0x53f2('0x12'),_0x3e0476[_0x53f2('0xf')],_0x31b89e);_0xbffbe6(_0xded86f[_0x53f2('0xe')](0x1f4,_0x3e0476[_0x53f2('0xf')]));});});};exports[_0x53f2('0x1d')]=function(_0x1c690f){var _0x2574c0=this;return new Promise(function(_0x36f691,_0x25f0e8){return db[_0x53f2('0x13')]['find']({'raw':_0x1c690f[_0x53f2('0x15')]?_0x1c690f['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c690f[_0x53f2('0x15')]?_0x1c690f[_0x53f2('0x15')][_0x53f2('0x1e')]||null:null,'attributes':_0x1c690f[_0x53f2('0x15')]?_0x1c690f[_0x53f2('0x15')][_0x53f2('0x16')]||null:null,'include':_0x1c690f[_0x53f2('0x15')]?_0x1c690f[_0x53f2('0x15')][_0x53f2('0x18')]?_['map'](_0x1c690f[_0x53f2('0x15')][_0x53f2('0x18')],function(_0x5b82fd){return{'model':db[_0x5b82fd[_0x53f2('0x1a')]],'as':_0x5b82fd['as'],'attributes':_0x5b82fd[_0x53f2('0x16')],'include':_0x5b82fd[_0x53f2('0x18')]?_[_0x53f2('0x19')](_0x5b82fd[_0x53f2('0x18')],function(_0x57e5c7){return{'model':db[_0x57e5c7[_0x53f2('0x1a')]],'as':_0x57e5c7['as'],'attributes':_0x57e5c7[_0x53f2('0x16')],'include':_0x57e5c7[_0x53f2('0x18')]?_[_0x53f2('0x19')](_0x57e5c7[_0x53f2('0x18')],function(_0x241ef1){return{'model':db[_0x241ef1[_0x53f2('0x1a')]],'as':_0x241ef1['as'],'attributes':_0x241ef1[_0x53f2('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe3453e){logger[_0x53f2('0x8')](_0x53f2('0x1d'),_0x1c690f);logger['debug'](_0x53f2('0x1d'),_0x1c690f,JSON[_0x53f2('0xc')](_0xe3453e));_0x36f691(_0xe3453e);})['catch'](function(_0x3628dd){logger['error']('ShowFreshdeskAccount',_0x3628dd[_0x53f2('0xf')],_0x1c690f);_0x25f0e8(_0x2574c0[_0x53f2('0xe')](0x1f4,_0x3628dd[_0x53f2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index d880b96..0df7ca4 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 _0xd6c6=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x329a6b,_0x9bbc23){var _0x3eb2fc=function(_0x5d35e7){while(--_0x5d35e7){_0x329a6b['push'](_0x329a6b['shift']());}};_0x3eb2fc(++_0x9bbc23);}(_0xd6c6,0x1eb));var _0x6d6c=function(_0x2ce324,_0x3ec3a2){_0x2ce324=_0x2ce324-0x0;var _0xfe7b62=_0xd6c6[_0x2ce324];return _0xfe7b62;};'use strict';var multer=require(_0x6d6c('0x0'));var util=require(_0x6d6c('0x1'));var path=require(_0x6d6c('0x2'));var timeout=require(_0x6d6c('0x3'));var express=require(_0x6d6c('0x4'));var router=express['Router']();var fs_extra=require(_0x6d6c('0x5'));var auth=require(_0x6d6c('0x6'));var interaction=require(_0x6d6c('0x7'));var config=require(_0x6d6c('0x8'));var controller=require(_0x6d6c('0x9'));router[_0x6d6c('0xa')]('/',auth[_0x6d6c('0xb')](),controller[_0x6d6c('0xc')]);router['get']('/:id',auth[_0x6d6c('0xb')](),controller[_0x6d6c('0xd')]);router[_0x6d6c('0xa')](_0x6d6c('0xe'),auth['isAuthenticated'](),controller[_0x6d6c('0xf')]);router[_0x6d6c('0xa')]('/:id/subjects',auth[_0x6d6c('0xb')](),controller['getSubjects']);router[_0x6d6c('0xa')](_0x6d6c('0x10'),auth[_0x6d6c('0xb')](),controller[_0x6d6c('0x11')]);router[_0x6d6c('0xa')](_0x6d6c('0x12'),auth[_0x6d6c('0xb')](),controller[_0x6d6c('0x13')]);router[_0x6d6c('0x14')]('/',auth['isAuthenticated'](),controller[_0x6d6c('0x15')]);router[_0x6d6c('0x14')](_0x6d6c('0x12'),auth['isAuthenticated'](),controller[_0x6d6c('0x16')]);router[_0x6d6c('0x17')](_0x6d6c('0x18'),auth[_0x6d6c('0xb')](),controller[_0x6d6c('0x19')]);router[_0x6d6c('0x1a')](_0x6d6c('0x18'),auth['isAuthenticated'](),controller[_0x6d6c('0x1b')]);module[_0x6d6c('0x1c')]=router; \ No newline at end of file +var _0x0357=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/tags','getTags','post','setTags','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x0357,0x7c));var _0x7035=function(_0x2ad04c,_0x242b88){_0x2ad04c=_0x2ad04c-0x0;var _0x4164a8=_0x0357[_0x2ad04c];return _0x4164a8;};'use strict';var multer=require(_0x7035('0x0'));var util=require(_0x7035('0x1'));var path=require(_0x7035('0x2'));var timeout=require(_0x7035('0x3'));var express=require(_0x7035('0x4'));var router=express[_0x7035('0x5')]();var fs_extra=require(_0x7035('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7035('0x7'));var config=require(_0x7035('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x7035('0x9')]('/',auth[_0x7035('0xa')](),controller[_0x7035('0xb')]);router[_0x7035('0x9')](_0x7035('0xc'),auth[_0x7035('0xa')](),controller[_0x7035('0xd')]);router['get'](_0x7035('0xe'),auth[_0x7035('0xa')](),controller['getFields']);router['get'](_0x7035('0xf'),auth[_0x7035('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x7035('0xa')](),controller['getDescriptions']);router[_0x7035('0x9')](_0x7035('0x10'),auth[_0x7035('0xa')](),controller[_0x7035('0x11')]);router[_0x7035('0x12')]('/',auth[_0x7035('0xa')](),controller['create']);router['post'](_0x7035('0x10'),auth[_0x7035('0xa')](),controller[_0x7035('0x13')]);router['put'](_0x7035('0xc'),auth[_0x7035('0xa')](),controller[_0x7035('0x14')]);router['delete'](_0x7035('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7035('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d73d569..59836ce 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 _0x9ba7=['STRING','sequelize'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x9ba7,0x13b));var _0x79ba=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x9ba7[_0x46efd7];return _0x5637e4;};'use strict';var Sequelize=require(_0x79ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x79ba('0x1')]},'description':{'type':Sequelize[_0x79ba('0x1')]}}; \ No newline at end of file +var _0x25a4=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25a4,0x93));var _0x425a=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0x25a4[_0x127a60];return _0xc1f6a3;};'use strict';var Sequelize=require(_0x425a('0x0'));module[_0x425a('0x1')]={'name':{'type':Sequelize[_0x425a('0x2')]},'description':{'type':Sequelize[_0x425a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b6938c6..5bf9ce3 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 _0x3407=['then','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','includeAll','FreshdeskConfiguration','findAll','catch','show','params','keys','length','options','create','body','find','getFields','findOne','FreshdeskField','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x3407,0xd5));var _0x7340=function(_0x182c03,_0x32a560){_0x182c03=_0x182c03-0x0;var _0x1b6251=_0x3407[_0x182c03];return _0x1b6251;};'use strict';var emlformat=require(_0x7340('0x0'));var rimraf=require(_0x7340('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7340('0x2'));var rp=require('request-promise');var moment=require(_0x7340('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7340('0x4'));var util=require('util');var path=require(_0x7340('0x5'));var sox=require(_0x7340('0x6'));var csv=require(_0x7340('0x7'));var ejs=require(_0x7340('0x8'));var fs=require('fs');var fs_extra=require(_0x7340('0x9'));var _=require(_0x7340('0xa'));var squel=require(_0x7340('0xb'));var crypto=require(_0x7340('0xc'));var jsforce=require(_0x7340('0xd'));var deskjs=require(_0x7340('0xe'));var toCsv=require(_0x7340('0x7'));var querystring=require(_0x7340('0xf'));var Papa=require(_0x7340('0x10'));var Redis=require(_0x7340('0x11'));var authService=require(_0x7340('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7340('0x13'));var logger=require(_0x7340('0x14'))(_0x7340('0x15'));var utils=require(_0x7340('0x16'));var config=require(_0x7340('0x17'));var licenseUtil=require(_0x7340('0x18'));var db=require(_0x7340('0x19'))['db'];function respondWithStatusCode(_0x100d6f,_0x38bf88){_0x38bf88=_0x38bf88||0xcc;return function(_0x1f5509){if(_0x1f5509){return _0x100d6f[_0x7340('0x1a')](_0x38bf88);}return _0x100d6f['status'](_0x38bf88)[_0x7340('0x1b')]();};}function respondWithResult(_0x49eace,_0x14f3ab){_0x14f3ab=_0x14f3ab||0xc8;return function(_0x792a41){if(_0x792a41){return _0x49eace[_0x7340('0x1c')](_0x14f3ab)['json'](_0x792a41);}};}function respondWithFilteredResult(_0x30ace6,_0x59bd91){return function(_0x4fa3fb){if(_0x4fa3fb){var _0x441e3f=typeof _0x59bd91[_0x7340('0x1d')]===_0x7340('0x1e')&&typeof _0x59bd91[_0x7340('0x1f')]===_0x7340('0x1e');var _0x3a1fde=_0x4fa3fb['count'];var _0x5a7eaa=_0x441e3f?0x0:_0x59bd91[_0x7340('0x1d')];var _0x81f521=_0x441e3f?_0x4fa3fb[_0x7340('0x20')]:_0x59bd91['offset']+_0x59bd91[_0x7340('0x1f')];var _0x2ca8e9;if(_0x81f521>=_0x3a1fde){_0x81f521=_0x3a1fde;_0x2ca8e9=0xc8;}else{_0x2ca8e9=0xce;}_0x30ace6[_0x7340('0x1c')](_0x2ca8e9);return _0x30ace6[_0x7340('0x21')]('Content-Range',_0x5a7eaa+'-'+_0x81f521+'/'+_0x3a1fde)[_0x7340('0x22')](_0x4fa3fb);}return null;};}function patchUpdates(_0x5e30be){return function(_0x5c8c6f){try{jsonpatch[_0x7340('0x23')](_0x5c8c6f,_0x5e30be,!![]);}catch(_0x1d3f9b){return BPromise[_0x7340('0x24')](_0x1d3f9b);}return _0x5c8c6f[_0x7340('0x25')]();};}function saveUpdates(_0x10362d,_0x16ae42){return function(_0x444a84){if(_0x444a84){return _0x444a84[_0x7340('0x26')](_0x10362d)[_0x7340('0x27')](function(_0xe07ee5){return _0xe07ee5;});}return null;};}function removeEntity(_0x209023,_0x146b92){return function(_0xe57bcf){if(_0xe57bcf){return _0xe57bcf[_0x7340('0x28')]()[_0x7340('0x27')](function(){_0x209023[_0x7340('0x1c')](0xcc)[_0x7340('0x1b')]();});}};}function handleEntityNotFound(_0x43fe59,_0x326ee1){return function(_0x58a077){if(!_0x58a077){_0x43fe59['sendStatus'](0x194);}return _0x58a077;};}function handleError(_0x39322c,_0x1f6f3a){_0x1f6f3a=_0x1f6f3a||0x1f4;return function(_0x13f8c1){logger['error'](_0x13f8c1[_0x7340('0x29')]);if(_0x13f8c1[_0x7340('0x2a')]){delete _0x13f8c1[_0x7340('0x2a')];}_0x39322c['status'](_0x1f6f3a)['send'](_0x13f8c1);};}exports['index']=function(_0x2e8b74,_0x29ca71){var _0x249601={},_0x53a1c6={},_0x106e08={'count':0x0,'rows':[]};var _0x220fa0=_[_0x7340('0x2b')](db['FreshdeskConfiguration'][_0x7340('0x2c')],function(_0xb496b1){return{'name':_0xb496b1[_0x7340('0x2d')],'type':_0xb496b1[_0x7340('0x2e')][_0x7340('0x2f')]};});_0x53a1c6[_0x7340('0x30')]=_[_0x7340('0x2b')](_0x220fa0,_0x7340('0x2a'));_0x53a1c6[_0x7340('0x31')]=_['keys'](_0x2e8b74[_0x7340('0x31')]);_0x53a1c6[_0x7340('0x32')]=_[_0x7340('0x33')](_0x53a1c6[_0x7340('0x30')],_0x53a1c6[_0x7340('0x31')]);_0x249601[_0x7340('0x34')]=_[_0x7340('0x33')](_0x53a1c6[_0x7340('0x30')],qs[_0x7340('0x35')](_0x2e8b74['query'][_0x7340('0x35')]));_0x249601[_0x7340('0x34')]=_0x249601[_0x7340('0x34')]['length']?_0x249601['attributes']:_0x53a1c6[_0x7340('0x30')];if(!_0x2e8b74[_0x7340('0x31')][_0x7340('0x36')](_0x7340('0x37'))){_0x249601[_0x7340('0x1f')]=qs[_0x7340('0x1f')](_0x2e8b74[_0x7340('0x31')][_0x7340('0x1f')]);_0x249601[_0x7340('0x1d')]=qs['offset'](_0x2e8b74[_0x7340('0x31')][_0x7340('0x1d')]);}_0x249601['order']=qs[_0x7340('0x38')](_0x2e8b74[_0x7340('0x31')]['sort']);_0x249601[_0x7340('0x39')]=qs[_0x7340('0x32')](_[_0x7340('0x3a')](_0x2e8b74[_0x7340('0x31')],_0x53a1c6[_0x7340('0x32')]),_0x220fa0);if(_0x2e8b74[_0x7340('0x31')]['filter']){_0x249601['where']=_['merge'](_0x249601[_0x7340('0x39')],{'$or':_['map'](_0x220fa0,function(_0x350b9b){if(_0x350b9b[_0x7340('0x2e')]!==_0x7340('0x3b')){var _0x374536={};_0x374536[_0x350b9b[_0x7340('0x2a')]]={'$like':'%'+_0x2e8b74[_0x7340('0x31')][_0x7340('0x3c')]+'%'};return _0x374536;}})});}_0x249601=_[_0x7340('0x3d')]({},_0x249601,_0x2e8b74['options']);var _0x5ac696={'where':_0x249601[_0x7340('0x39')]};return db['FreshdeskConfiguration'][_0x7340('0x20')](_0x5ac696)[_0x7340('0x27')](function(_0x4a8573){_0x106e08[_0x7340('0x20')]=_0x4a8573;if(_0x2e8b74[_0x7340('0x31')][_0x7340('0x3e')]){_0x249601['include']=[{'all':!![]}];}return db[_0x7340('0x3f')][_0x7340('0x40')](_0x249601);})['then'](function(_0x56ecf9){_0x106e08['rows']=_0x56ecf9;return _0x106e08;})[_0x7340('0x27')](respondWithFilteredResult(_0x29ca71,_0x249601))[_0x7340('0x41')](handleError(_0x29ca71,null));};exports[_0x7340('0x42')]=function(_0x4545dd,_0x17d20f){var _0x5e2168={'raw':![],'where':{'id':_0x4545dd[_0x7340('0x43')]['id']}},_0x57978d={};_0x57978d[_0x7340('0x30')]=_[_0x7340('0x44')](db[_0x7340('0x3f')][_0x7340('0x2c')]);_0x57978d['query']=_[_0x7340('0x44')](_0x4545dd[_0x7340('0x31')]);_0x57978d[_0x7340('0x32')]=_[_0x7340('0x33')](_0x57978d['model'],_0x57978d[_0x7340('0x31')]);_0x5e2168[_0x7340('0x34')]=_[_0x7340('0x33')](_0x57978d['model'],qs[_0x7340('0x35')](_0x4545dd['query'][_0x7340('0x35')]));_0x5e2168[_0x7340('0x34')]=_0x5e2168[_0x7340('0x34')][_0x7340('0x45')]?_0x5e2168[_0x7340('0x34')]:_0x57978d[_0x7340('0x30')];if(_0x4545dd[_0x7340('0x31')][_0x7340('0x3e')]){_0x5e2168['include']=[{'all':!![]}];}_0x5e2168=_[_0x7340('0x3d')]({},_0x5e2168,_0x4545dd[_0x7340('0x46')]);return db[_0x7340('0x3f')]['find'](_0x5e2168)[_0x7340('0x27')](handleEntityNotFound(_0x17d20f,null))[_0x7340('0x27')](respondWithResult(_0x17d20f,null))[_0x7340('0x41')](handleError(_0x17d20f,null));};exports[_0x7340('0x47')]=function(_0x2af166,_0x4c1616){return db[_0x7340('0x3f')][_0x7340('0x47')](_0x2af166[_0x7340('0x48')],{})[_0x7340('0x27')](respondWithResult(_0x4c1616,0xc9))[_0x7340('0x41')](handleError(_0x4c1616,null));};exports['update']=function(_0x39a007,_0xd17da5){if(_0x39a007[_0x7340('0x48')]['id']){delete _0x39a007[_0x7340('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x7340('0x49')]({'where':{'id':_0x39a007['params']['id']}})['then'](handleEntityNotFound(_0xd17da5,null))[_0x7340('0x27')](saveUpdates(_0x39a007[_0x7340('0x48')],null))['then'](respondWithResult(_0xd17da5,null))[_0x7340('0x41')](handleError(_0xd17da5,null));};exports[_0x7340('0x28')]=function(_0x3d6b82,_0x510dba){return db[_0x7340('0x3f')]['find']({'where':{'id':_0x3d6b82[_0x7340('0x43')]['id']}})[_0x7340('0x27')](handleEntityNotFound(_0x510dba,null))[_0x7340('0x27')](removeEntity(_0x510dba,null))['catch'](handleError(_0x510dba,null));};exports[_0x7340('0x4a')]=function(_0x46f9a8,_0x3aa953,_0x5c4f72){var _0x4e52e9={};var _0xdbef41={};var _0x3af93d;var _0x5c80ee;return db[_0x7340('0x3f')][_0x7340('0x4b')]({'where':{'id':_0x46f9a8['params']['id']}})[_0x7340('0x27')](handleEntityNotFound(_0x3aa953,null))[_0x7340('0x27')](function(_0x3702ae){if(_0x3702ae){_0x3af93d=_0x3702ae;_0xdbef41[_0x7340('0x30')]=_[_0x7340('0x44')](db['FreshdeskField'][_0x7340('0x2c')]);_0xdbef41['query']=_[_0x7340('0x44')](_0x46f9a8[_0x7340('0x31')]);_0xdbef41[_0x7340('0x32')]=_[_0x7340('0x33')](_0xdbef41[_0x7340('0x30')],_0xdbef41[_0x7340('0x31')]);_0x4e52e9['attributes']=_[_0x7340('0x33')](_0xdbef41[_0x7340('0x30')],qs[_0x7340('0x35')](_0x46f9a8['query']['fields']));_0x4e52e9[_0x7340('0x34')]=_0x4e52e9[_0x7340('0x34')][_0x7340('0x45')]?_0x4e52e9[_0x7340('0x34')]:_0xdbef41[_0x7340('0x30')];_0x4e52e9['order']=qs['sort'](_0x46f9a8[_0x7340('0x31')][_0x7340('0x38')]);_0x4e52e9['where']=qs[_0x7340('0x32')](_['pick'](_0x46f9a8['query'],_0xdbef41['filters']));if(_0x46f9a8[_0x7340('0x31')][_0x7340('0x3c')]){_0x4e52e9['where']=_[_0x7340('0x3d')](_0x4e52e9[_0x7340('0x39')],{'$or':_[_0x7340('0x2b')](_0x4e52e9[_0x7340('0x34')],function(_0x552c43){var _0x39fbc1={};_0x39fbc1[_0x552c43]={'$like':'%'+_0x46f9a8['query'][_0x7340('0x3c')]+'%'};return _0x39fbc1;})});}_0x4e52e9=_[_0x7340('0x3d')]({},_0x4e52e9,_0x46f9a8[_0x7340('0x46')]);return _0x3af93d['getFields'](_0x4e52e9);}})[_0x7340('0x27')](function(_0x1e5ac4){if(_0x1e5ac4){_0x5c80ee=_0x1e5ac4[_0x7340('0x45')];if(!_0x46f9a8[_0x7340('0x31')]['hasOwnProperty'](_0x7340('0x37'))){_0x4e52e9[_0x7340('0x1f')]=qs[_0x7340('0x1f')](_0x46f9a8[_0x7340('0x31')]['limit']);_0x4e52e9[_0x7340('0x1d')]=qs['offset'](_0x46f9a8[_0x7340('0x31')]['offset']);}return _0x3af93d['getFields'](_0x4e52e9);}})[_0x7340('0x27')](function(_0x9649b4){if(_0x9649b4){return _0x9649b4?{'count':_0x5c80ee,'rows':_0x9649b4}:null;}})[_0x7340('0x27')](respondWithResult(_0x3aa953,null))[_0x7340('0x41')](handleError(_0x3aa953,null));};exports['getSubjects']=function(_0x5325b4,_0x16bd5b,_0x1cbbf8){var _0x2ed036={};var _0x5edb45={};var _0x1568d3;var _0x2b0dbf;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5325b4[_0x7340('0x43')]['id']}})[_0x7340('0x27')](handleEntityNotFound(_0x16bd5b,null))[_0x7340('0x27')](function(_0x2bad18){if(_0x2bad18){_0x1568d3=_0x2bad18;_0x5edb45['model']=_[_0x7340('0x44')](db[_0x7340('0x4c')]['rawAttributes']);_0x5edb45[_0x7340('0x31')]=_[_0x7340('0x44')](_0x5325b4[_0x7340('0x31')]);_0x5edb45['filters']=_[_0x7340('0x33')](_0x5edb45[_0x7340('0x30')],_0x5edb45[_0x7340('0x31')]);_0x2ed036[_0x7340('0x34')]=_[_0x7340('0x33')](_0x5edb45[_0x7340('0x30')],qs[_0x7340('0x35')](_0x5325b4[_0x7340('0x31')][_0x7340('0x35')]));_0x2ed036['attributes']=_0x2ed036['attributes'][_0x7340('0x45')]?_0x2ed036[_0x7340('0x34')]:_0x5edb45[_0x7340('0x30')];_0x2ed036['order']=qs[_0x7340('0x38')](_0x5325b4[_0x7340('0x31')][_0x7340('0x38')]);_0x2ed036[_0x7340('0x39')]=qs[_0x7340('0x32')](_[_0x7340('0x3a')](_0x5325b4[_0x7340('0x31')],_0x5edb45[_0x7340('0x32')]));if(_0x5325b4[_0x7340('0x31')][_0x7340('0x3c')]){_0x2ed036[_0x7340('0x39')]=_[_0x7340('0x3d')](_0x2ed036[_0x7340('0x39')],{'$or':_[_0x7340('0x2b')](_0x2ed036[_0x7340('0x34')],function(_0x3549e7){var _0x4fb6e2={};_0x4fb6e2[_0x3549e7]={'$like':'%'+_0x5325b4[_0x7340('0x31')]['filter']+'%'};return _0x4fb6e2;})});}_0x2ed036=_['merge']({},_0x2ed036,_0x5325b4[_0x7340('0x46')]);return _0x1568d3[_0x7340('0x4d')](_0x2ed036);}})['then'](function(_0x405f3d){if(_0x405f3d){_0x2b0dbf=_0x405f3d[_0x7340('0x45')];if(!_0x5325b4[_0x7340('0x31')][_0x7340('0x36')]('nolimit')){_0x2ed036[_0x7340('0x1f')]=qs[_0x7340('0x1f')](_0x5325b4[_0x7340('0x31')]['limit']);_0x2ed036[_0x7340('0x1d')]=qs[_0x7340('0x1d')](_0x5325b4['query']['offset']);}return _0x1568d3[_0x7340('0x4d')](_0x2ed036);}})[_0x7340('0x27')](function(_0x35e609){if(_0x35e609){return _0x35e609?{'count':_0x2b0dbf,'rows':_0x35e609}:null;}})[_0x7340('0x27')](respondWithResult(_0x16bd5b,null))[_0x7340('0x41')](handleError(_0x16bd5b,null));};exports['getDescriptions']=function(_0x2ed824,_0x822f55,_0x229d77){var _0x293065={};var _0x40cfae={};var _0x15d926;var _0x1ffbfc;return db[_0x7340('0x3f')]['findOne']({'where':{'id':_0x2ed824[_0x7340('0x43')]['id']}})[_0x7340('0x27')](handleEntityNotFound(_0x822f55,null))[_0x7340('0x27')](function(_0x11266c){if(_0x11266c){_0x15d926=_0x11266c;_0x40cfae[_0x7340('0x30')]=_[_0x7340('0x44')](db[_0x7340('0x4c')]['rawAttributes']);_0x40cfae[_0x7340('0x31')]=_['keys'](_0x2ed824[_0x7340('0x31')]);_0x40cfae[_0x7340('0x32')]=_['intersection'](_0x40cfae[_0x7340('0x30')],_0x40cfae[_0x7340('0x31')]);_0x293065[_0x7340('0x34')]=_[_0x7340('0x33')](_0x40cfae[_0x7340('0x30')],qs['fields'](_0x2ed824['query']['fields']));_0x293065[_0x7340('0x34')]=_0x293065[_0x7340('0x34')][_0x7340('0x45')]?_0x293065[_0x7340('0x34')]:_0x40cfae[_0x7340('0x30')];_0x293065[_0x7340('0x4e')]=qs['sort'](_0x2ed824[_0x7340('0x31')]['sort']);_0x293065['where']=qs['filters'](_[_0x7340('0x3a')](_0x2ed824['query'],_0x40cfae[_0x7340('0x32')]));if(_0x2ed824[_0x7340('0x31')][_0x7340('0x3c')]){_0x293065['where']=_['merge'](_0x293065[_0x7340('0x39')],{'$or':_['map'](_0x293065[_0x7340('0x34')],function(_0x1d406f){var _0x584c0a={};_0x584c0a[_0x1d406f]={'$like':'%'+_0x2ed824['query']['filter']+'%'};return _0x584c0a;})});}_0x293065=_[_0x7340('0x3d')]({},_0x293065,_0x2ed824[_0x7340('0x46')]);return _0x15d926[_0x7340('0x4f')](_0x293065);}})[_0x7340('0x27')](function(_0x1dd637){if(_0x1dd637){_0x1ffbfc=_0x1dd637[_0x7340('0x45')];if(!_0x2ed824[_0x7340('0x31')]['hasOwnProperty']('nolimit')){_0x293065['limit']=qs[_0x7340('0x1f')](_0x2ed824[_0x7340('0x31')][_0x7340('0x1f')]);_0x293065[_0x7340('0x1d')]=qs[_0x7340('0x1d')](_0x2ed824[_0x7340('0x31')]['offset']);}return _0x15d926['getDescriptions'](_0x293065);}})[_0x7340('0x27')](function(_0xca89e1){if(_0xca89e1){return _0xca89e1?{'count':_0x1ffbfc,'rows':_0xca89e1}:null;}})['then'](respondWithResult(_0x822f55,null))['catch'](handleError(_0x822f55,null));};exports[_0x7340('0x50')]=function(_0x18ffe3,_0x2889ff,_0x19ad47){var _0x29ed72={};var _0x392ce1={};var _0x225ecb;var _0x2873a2;return db['FreshdeskConfiguration'][_0x7340('0x4b')]({'where':{'id':_0x18ffe3[_0x7340('0x43')]['id']}})['then'](handleEntityNotFound(_0x2889ff,null))[_0x7340('0x27')](function(_0x17b692){if(_0x17b692){_0x225ecb=_0x17b692;_0x392ce1['model']=_[_0x7340('0x44')](db[_0x7340('0x51')][_0x7340('0x2c')]);_0x392ce1[_0x7340('0x31')]=_[_0x7340('0x44')](_0x18ffe3[_0x7340('0x31')]);_0x392ce1[_0x7340('0x32')]=_[_0x7340('0x33')](_0x392ce1['model'],_0x392ce1['query']);_0x29ed72[_0x7340('0x34')]=_['intersection'](_0x392ce1[_0x7340('0x30')],qs[_0x7340('0x35')](_0x18ffe3[_0x7340('0x31')][_0x7340('0x35')]));_0x29ed72[_0x7340('0x34')]=_0x29ed72['attributes']['length']?_0x29ed72[_0x7340('0x34')]:_0x392ce1[_0x7340('0x30')];_0x29ed72['order']=qs['sort'](_0x18ffe3['query'][_0x7340('0x38')]);_0x29ed72['where']=qs[_0x7340('0x32')](_[_0x7340('0x3a')](_0x18ffe3[_0x7340('0x31')],_0x392ce1[_0x7340('0x32')]));if(_0x18ffe3['query']['filter']){_0x29ed72['where']=_[_0x7340('0x3d')](_0x29ed72[_0x7340('0x39')],{'$or':_[_0x7340('0x2b')](_0x29ed72[_0x7340('0x34')],function(_0x5c72c7){var _0x165120={};_0x165120[_0x5c72c7]={'$like':'%'+_0x18ffe3['query']['filter']+'%'};return _0x165120;})});}_0x29ed72=_['merge']({},_0x29ed72,_0x18ffe3[_0x7340('0x46')]);return _0x225ecb[_0x7340('0x50')](_0x29ed72);}})[_0x7340('0x27')](function(_0x223b5b){if(_0x223b5b){_0x2873a2=_0x223b5b['length'];if(!_0x18ffe3[_0x7340('0x31')][_0x7340('0x36')]('nolimit')){_0x29ed72['limit']=qs['limit'](_0x18ffe3[_0x7340('0x31')]['limit']);_0x29ed72[_0x7340('0x1d')]=qs[_0x7340('0x1d')](_0x18ffe3[_0x7340('0x31')]['offset']);}return _0x225ecb[_0x7340('0x50')](_0x29ed72);}})[_0x7340('0x27')](function(_0x6cc9b8){if(_0x6cc9b8){return _0x6cc9b8?{'count':_0x2873a2,'rows':_0x6cc9b8}:null;}})[_0x7340('0x27')](respondWithResult(_0x2889ff,null))[_0x7340('0x41')](handleError(_0x2889ff,null));};exports[_0x7340('0x52')]=function(_0x5bcd02,_0x57154c,_0xf58269){if(_0x5bcd02[_0x7340('0x48')]['id']){delete _0x5bcd02[_0x7340('0x48')]['id'];}return db[_0x7340('0x3f')]['findOne']({'where':{'id':_0x5bcd02[_0x7340('0x43')]['id']}})['then'](handleEntityNotFound(_0x57154c,null))['then'](function(_0x491d5b){if(_0x491d5b){return _0x491d5b[_0x7340('0x52')](_0x5bcd02[_0x7340('0x48')][_0x7340('0x53')]||[]);}return null;})[_0x7340('0x27')](respondWithResult(_0x57154c,null))['catch'](handleError(_0x57154c,null));}; \ No newline at end of file +var _0x8d23=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','FreshdeskConfiguration','includeAll','include','findAll','rows','show','params','keys','length','options','catch','create','body','find','findOne','getFields','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs'];(function(_0x47b550,_0x55ef1e){var _0x22b260=function(_0x29effa){while(--_0x29effa){_0x47b550['push'](_0x47b550['shift']());}};_0x22b260(++_0x55ef1e);}(_0x8d23,0x1e8));var _0x38d2=function(_0x558be4,_0x1070a1){_0x558be4=_0x558be4-0x0;var _0xcebed3=_0x8d23[_0x558be4];return _0xcebed3;};'use strict';var emlformat=require(_0x38d2('0x0'));var rimraf=require(_0x38d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38d2('0x2'));var rp=require(_0x38d2('0x3'));var moment=require(_0x38d2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x38d2('0x5'));var util=require(_0x38d2('0x6'));var path=require(_0x38d2('0x7'));var sox=require(_0x38d2('0x8'));var csv=require(_0x38d2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38d2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x38d2('0xb'));var jsforce=require(_0x38d2('0xc'));var deskjs=require(_0x38d2('0xd'));var toCsv=require(_0x38d2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x38d2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x38d2('0xf'));var as=require(_0x38d2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x38d2('0x11'))(_0x38d2('0x12'));var utils=require(_0x38d2('0x13'));var config=require(_0x38d2('0x14'));var licenseUtil=require(_0x38d2('0x15'));var db=require(_0x38d2('0x16'))['db'];function respondWithStatusCode(_0x5abe9d,_0x294a0d){_0x294a0d=_0x294a0d||0xcc;return function(_0x3859b8){if(_0x3859b8){return _0x5abe9d[_0x38d2('0x17')](_0x294a0d);}return _0x5abe9d[_0x38d2('0x18')](_0x294a0d)[_0x38d2('0x19')]();};}function respondWithResult(_0x483ef3,_0x561d5e){_0x561d5e=_0x561d5e||0xc8;return function(_0xfa46ac){if(_0xfa46ac){return _0x483ef3[_0x38d2('0x18')](_0x561d5e)[_0x38d2('0x1a')](_0xfa46ac);}};}function respondWithFilteredResult(_0x1f087e,_0x538f4c){return function(_0x300a2c){if(_0x300a2c){var _0x2cd394=typeof _0x538f4c['offset']===_0x38d2('0x1b')&&typeof _0x538f4c[_0x38d2('0x1c')]==='undefined';var _0x255eb5=_0x300a2c[_0x38d2('0x1d')];var _0xe5b0fa=_0x2cd394?0x0:_0x538f4c[_0x38d2('0x1e')];var _0x22f557=_0x2cd394?_0x300a2c['count']:_0x538f4c[_0x38d2('0x1e')]+_0x538f4c[_0x38d2('0x1c')];var _0x55ae2d;if(_0x22f557>=_0x255eb5){_0x22f557=_0x255eb5;_0x55ae2d=0xc8;}else{_0x55ae2d=0xce;}_0x1f087e[_0x38d2('0x18')](_0x55ae2d);return _0x1f087e['set'](_0x38d2('0x1f'),_0xe5b0fa+'-'+_0x22f557+'/'+_0x255eb5)['json'](_0x300a2c);}return null;};}function patchUpdates(_0x2676ad){return function(_0x3ce9c8){try{jsonpatch[_0x38d2('0x20')](_0x3ce9c8,_0x2676ad,!![]);}catch(_0x47915e){return BPromise['reject'](_0x47915e);}return _0x3ce9c8[_0x38d2('0x21')]();};}function saveUpdates(_0x398328,_0x3e71be){return function(_0x348681){if(_0x348681){return _0x348681[_0x38d2('0x22')](_0x398328)[_0x38d2('0x23')](function(_0xffbdac){return _0xffbdac;});}return null;};}function removeEntity(_0x3c5e61,_0x9f0415){return function(_0xc0122a){if(_0xc0122a){return _0xc0122a[_0x38d2('0x24')]()[_0x38d2('0x23')](function(){_0x3c5e61['status'](0xcc)[_0x38d2('0x19')]();});}};}function handleEntityNotFound(_0x37b3f2,_0x316506){return function(_0x4b9cf0){if(!_0x4b9cf0){_0x37b3f2[_0x38d2('0x17')](0x194);}return _0x4b9cf0;};}function handleError(_0x5a72f6,_0x5b0fe3){_0x5b0fe3=_0x5b0fe3||0x1f4;return function(_0x2de138){logger[_0x38d2('0x25')](_0x2de138['stack']);if(_0x2de138[_0x38d2('0x26')]){delete _0x2de138[_0x38d2('0x26')];}_0x5a72f6[_0x38d2('0x18')](_0x5b0fe3)[_0x38d2('0x27')](_0x2de138);};}exports[_0x38d2('0x28')]=function(_0x2e7767,_0x712894){var _0x50e907={},_0x47cb81={},_0xb01fda={'count':0x0,'rows':[]};var _0x1c35a9=_[_0x38d2('0x29')](db['FreshdeskConfiguration'][_0x38d2('0x2a')],function(_0x154813){return{'name':_0x154813[_0x38d2('0x2b')],'type':_0x154813[_0x38d2('0x2c')][_0x38d2('0x2d')]};});_0x47cb81[_0x38d2('0x2e')]=_[_0x38d2('0x29')](_0x1c35a9,_0x38d2('0x26'));_0x47cb81['query']=_['keys'](_0x2e7767[_0x38d2('0x2f')]);_0x47cb81[_0x38d2('0x30')]=_['intersection'](_0x47cb81[_0x38d2('0x2e')],_0x47cb81[_0x38d2('0x2f')]);_0x50e907[_0x38d2('0x31')]=_[_0x38d2('0x32')](_0x47cb81[_0x38d2('0x2e')],qs[_0x38d2('0x33')](_0x2e7767[_0x38d2('0x2f')][_0x38d2('0x33')]));_0x50e907[_0x38d2('0x31')]=_0x50e907[_0x38d2('0x31')]['length']?_0x50e907[_0x38d2('0x31')]:_0x47cb81[_0x38d2('0x2e')];if(!_0x2e7767[_0x38d2('0x2f')][_0x38d2('0x34')](_0x38d2('0x35'))){_0x50e907['limit']=qs[_0x38d2('0x1c')](_0x2e7767['query'][_0x38d2('0x1c')]);_0x50e907['offset']=qs['offset'](_0x2e7767[_0x38d2('0x2f')][_0x38d2('0x1e')]);}_0x50e907[_0x38d2('0x36')]=qs[_0x38d2('0x37')](_0x2e7767[_0x38d2('0x2f')][_0x38d2('0x37')]);_0x50e907['where']=qs[_0x38d2('0x30')](_[_0x38d2('0x38')](_0x2e7767['query'],_0x47cb81['filters']),_0x1c35a9);if(_0x2e7767['query'][_0x38d2('0x39')]){_0x50e907[_0x38d2('0x3a')]=_[_0x38d2('0x3b')](_0x50e907['where'],{'$or':_['map'](_0x1c35a9,function(_0x503ae0){if(_0x503ae0[_0x38d2('0x2c')]!==_0x38d2('0x3c')){var _0x5138c4={};_0x5138c4[_0x503ae0[_0x38d2('0x26')]]={'$like':'%'+_0x2e7767[_0x38d2('0x2f')][_0x38d2('0x39')]+'%'};return _0x5138c4;}})});}_0x50e907=_[_0x38d2('0x3b')]({},_0x50e907,_0x2e7767['options']);var _0x3f681f={'where':_0x50e907[_0x38d2('0x3a')]};return db[_0x38d2('0x3d')][_0x38d2('0x1d')](_0x3f681f)[_0x38d2('0x23')](function(_0x4e97b7){_0xb01fda[_0x38d2('0x1d')]=_0x4e97b7;if(_0x2e7767['query'][_0x38d2('0x3e')]){_0x50e907[_0x38d2('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x38d2('0x40')](_0x50e907);})[_0x38d2('0x23')](function(_0x28bbd8){_0xb01fda[_0x38d2('0x41')]=_0x28bbd8;return _0xb01fda;})['then'](respondWithFilteredResult(_0x712894,_0x50e907))['catch'](handleError(_0x712894,null));};exports[_0x38d2('0x42')]=function(_0x264749,_0x154214){var _0x42f2ae={'raw':![],'where':{'id':_0x264749[_0x38d2('0x43')]['id']}},_0x480b22={};_0x480b22[_0x38d2('0x2e')]=_[_0x38d2('0x44')](db[_0x38d2('0x3d')][_0x38d2('0x2a')]);_0x480b22[_0x38d2('0x2f')]=_['keys'](_0x264749[_0x38d2('0x2f')]);_0x480b22[_0x38d2('0x30')]=_[_0x38d2('0x32')](_0x480b22['model'],_0x480b22[_0x38d2('0x2f')]);_0x42f2ae['attributes']=_['intersection'](_0x480b22[_0x38d2('0x2e')],qs[_0x38d2('0x33')](_0x264749['query'][_0x38d2('0x33')]));_0x42f2ae[_0x38d2('0x31')]=_0x42f2ae[_0x38d2('0x31')][_0x38d2('0x45')]?_0x42f2ae[_0x38d2('0x31')]:_0x480b22[_0x38d2('0x2e')];if(_0x264749[_0x38d2('0x2f')][_0x38d2('0x3e')]){_0x42f2ae[_0x38d2('0x3f')]=[{'all':!![]}];}_0x42f2ae=_['merge']({},_0x42f2ae,_0x264749[_0x38d2('0x46')]);return db[_0x38d2('0x3d')]['find'](_0x42f2ae)[_0x38d2('0x23')](handleEntityNotFound(_0x154214,null))[_0x38d2('0x23')](respondWithResult(_0x154214,null))[_0x38d2('0x47')](handleError(_0x154214,null));};exports[_0x38d2('0x48')]=function(_0x5e17d3,_0x46d400){return db['FreshdeskConfiguration']['create'](_0x5e17d3['body'],{})[_0x38d2('0x23')](respondWithResult(_0x46d400,0xc9))['catch'](handleError(_0x46d400,null));};exports[_0x38d2('0x22')]=function(_0x39f7c4,_0x418aaa){if(_0x39f7c4['body']['id']){delete _0x39f7c4[_0x38d2('0x49')]['id'];}return db[_0x38d2('0x3d')][_0x38d2('0x4a')]({'where':{'id':_0x39f7c4[_0x38d2('0x43')]['id']}})[_0x38d2('0x23')](handleEntityNotFound(_0x418aaa,null))[_0x38d2('0x23')](saveUpdates(_0x39f7c4[_0x38d2('0x49')],null))[_0x38d2('0x23')](respondWithResult(_0x418aaa,null))[_0x38d2('0x47')](handleError(_0x418aaa,null));};exports[_0x38d2('0x24')]=function(_0x31c4e7,_0x27a2d6){return db[_0x38d2('0x3d')][_0x38d2('0x4a')]({'where':{'id':_0x31c4e7[_0x38d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x27a2d6,null))[_0x38d2('0x23')](removeEntity(_0x27a2d6,null))[_0x38d2('0x47')](handleError(_0x27a2d6,null));};exports['getFields']=function(_0x19bc7c,_0x55652b,_0x1fae98){var _0x42de9c={};var _0x340756={};var _0xa90e80;var _0x419e98;return db['FreshdeskConfiguration'][_0x38d2('0x4b')]({'where':{'id':_0x19bc7c[_0x38d2('0x43')]['id']}})[_0x38d2('0x23')](handleEntityNotFound(_0x55652b,null))[_0x38d2('0x23')](function(_0x3be93c){if(_0x3be93c){_0xa90e80=_0x3be93c;_0x340756[_0x38d2('0x2e')]=_[_0x38d2('0x44')](db['FreshdeskField'][_0x38d2('0x2a')]);_0x340756[_0x38d2('0x2f')]=_[_0x38d2('0x44')](_0x19bc7c[_0x38d2('0x2f')]);_0x340756[_0x38d2('0x30')]=_[_0x38d2('0x32')](_0x340756[_0x38d2('0x2e')],_0x340756[_0x38d2('0x2f')]);_0x42de9c[_0x38d2('0x31')]=_[_0x38d2('0x32')](_0x340756[_0x38d2('0x2e')],qs['fields'](_0x19bc7c[_0x38d2('0x2f')]['fields']));_0x42de9c[_0x38d2('0x31')]=_0x42de9c['attributes'][_0x38d2('0x45')]?_0x42de9c['attributes']:_0x340756[_0x38d2('0x2e')];_0x42de9c[_0x38d2('0x36')]=qs['sort'](_0x19bc7c[_0x38d2('0x2f')][_0x38d2('0x37')]);_0x42de9c[_0x38d2('0x3a')]=qs[_0x38d2('0x30')](_[_0x38d2('0x38')](_0x19bc7c[_0x38d2('0x2f')],_0x340756[_0x38d2('0x30')]));if(_0x19bc7c[_0x38d2('0x2f')]['filter']){_0x42de9c[_0x38d2('0x3a')]=_[_0x38d2('0x3b')](_0x42de9c['where'],{'$or':_[_0x38d2('0x29')](_0x42de9c[_0x38d2('0x31')],function(_0x4c25f0){var _0x181ad8={};_0x181ad8[_0x4c25f0]={'$like':'%'+_0x19bc7c[_0x38d2('0x2f')][_0x38d2('0x39')]+'%'};return _0x181ad8;})});}_0x42de9c=_[_0x38d2('0x3b')]({},_0x42de9c,_0x19bc7c[_0x38d2('0x46')]);return _0xa90e80[_0x38d2('0x4c')](_0x42de9c);}})['then'](function(_0x5aa24f){if(_0x5aa24f){_0x419e98=_0x5aa24f['length'];if(!_0x19bc7c[_0x38d2('0x2f')][_0x38d2('0x34')](_0x38d2('0x35'))){_0x42de9c[_0x38d2('0x1c')]=qs['limit'](_0x19bc7c[_0x38d2('0x2f')][_0x38d2('0x1c')]);_0x42de9c[_0x38d2('0x1e')]=qs[_0x38d2('0x1e')](_0x19bc7c[_0x38d2('0x2f')]['offset']);}return _0xa90e80['getFields'](_0x42de9c);}})[_0x38d2('0x23')](function(_0x3200e4){if(_0x3200e4){return _0x3200e4?{'count':_0x419e98,'rows':_0x3200e4}:null;}})[_0x38d2('0x23')](respondWithResult(_0x55652b,null))[_0x38d2('0x47')](handleError(_0x55652b,null));};exports[_0x38d2('0x4d')]=function(_0x3d02e6,_0x24d47f,_0x1b7ce5){var _0x36e11a={};var _0x4fee77={};var _0x21b3c;var _0x1abed3;return db[_0x38d2('0x3d')][_0x38d2('0x4b')]({'where':{'id':_0x3d02e6[_0x38d2('0x43')]['id']}})[_0x38d2('0x23')](handleEntityNotFound(_0x24d47f,null))[_0x38d2('0x23')](function(_0x156d3b){if(_0x156d3b){_0x21b3c=_0x156d3b;_0x4fee77[_0x38d2('0x2e')]=_[_0x38d2('0x44')](db[_0x38d2('0x4e')]['rawAttributes']);_0x4fee77[_0x38d2('0x2f')]=_['keys'](_0x3d02e6[_0x38d2('0x2f')]);_0x4fee77[_0x38d2('0x30')]=_['intersection'](_0x4fee77[_0x38d2('0x2e')],_0x4fee77[_0x38d2('0x2f')]);_0x36e11a[_0x38d2('0x31')]=_[_0x38d2('0x32')](_0x4fee77[_0x38d2('0x2e')],qs[_0x38d2('0x33')](_0x3d02e6[_0x38d2('0x2f')][_0x38d2('0x33')]));_0x36e11a[_0x38d2('0x31')]=_0x36e11a['attributes'][_0x38d2('0x45')]?_0x36e11a[_0x38d2('0x31')]:_0x4fee77[_0x38d2('0x2e')];_0x36e11a[_0x38d2('0x36')]=qs['sort'](_0x3d02e6['query'][_0x38d2('0x37')]);_0x36e11a['where']=qs[_0x38d2('0x30')](_[_0x38d2('0x38')](_0x3d02e6[_0x38d2('0x2f')],_0x4fee77[_0x38d2('0x30')]));if(_0x3d02e6[_0x38d2('0x2f')]['filter']){_0x36e11a['where']=_[_0x38d2('0x3b')](_0x36e11a[_0x38d2('0x3a')],{'$or':_[_0x38d2('0x29')](_0x36e11a[_0x38d2('0x31')],function(_0x310abc){var _0x1924f1={};_0x1924f1[_0x310abc]={'$like':'%'+_0x3d02e6[_0x38d2('0x2f')][_0x38d2('0x39')]+'%'};return _0x1924f1;})});}_0x36e11a=_[_0x38d2('0x3b')]({},_0x36e11a,_0x3d02e6[_0x38d2('0x46')]);return _0x21b3c['getSubjects'](_0x36e11a);}})[_0x38d2('0x23')](function(_0x16e09e){if(_0x16e09e){_0x1abed3=_0x16e09e[_0x38d2('0x45')];if(!_0x3d02e6['query'][_0x38d2('0x34')](_0x38d2('0x35'))){_0x36e11a[_0x38d2('0x1c')]=qs[_0x38d2('0x1c')](_0x3d02e6['query'][_0x38d2('0x1c')]);_0x36e11a[_0x38d2('0x1e')]=qs[_0x38d2('0x1e')](_0x3d02e6[_0x38d2('0x2f')][_0x38d2('0x1e')]);}return _0x21b3c[_0x38d2('0x4d')](_0x36e11a);}})['then'](function(_0x5cfbba){if(_0x5cfbba){return _0x5cfbba?{'count':_0x1abed3,'rows':_0x5cfbba}:null;}})[_0x38d2('0x23')](respondWithResult(_0x24d47f,null))[_0x38d2('0x47')](handleError(_0x24d47f,null));};exports[_0x38d2('0x4f')]=function(_0xfc9c89,_0x5cf1e2,_0x49ee35){var _0x1ad7ee={};var _0x2fa9a0={};var _0x5d437c;var _0x256f86;return db[_0x38d2('0x3d')][_0x38d2('0x4b')]({'where':{'id':_0xfc9c89[_0x38d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x5cf1e2,null))[_0x38d2('0x23')](function(_0x18e454){if(_0x18e454){_0x5d437c=_0x18e454;_0x2fa9a0[_0x38d2('0x2e')]=_['keys'](db[_0x38d2('0x4e')][_0x38d2('0x2a')]);_0x2fa9a0[_0x38d2('0x2f')]=_[_0x38d2('0x44')](_0xfc9c89[_0x38d2('0x2f')]);_0x2fa9a0[_0x38d2('0x30')]=_['intersection'](_0x2fa9a0[_0x38d2('0x2e')],_0x2fa9a0[_0x38d2('0x2f')]);_0x1ad7ee[_0x38d2('0x31')]=_[_0x38d2('0x32')](_0x2fa9a0[_0x38d2('0x2e')],qs[_0x38d2('0x33')](_0xfc9c89[_0x38d2('0x2f')][_0x38d2('0x33')]));_0x1ad7ee[_0x38d2('0x31')]=_0x1ad7ee[_0x38d2('0x31')][_0x38d2('0x45')]?_0x1ad7ee['attributes']:_0x2fa9a0[_0x38d2('0x2e')];_0x1ad7ee[_0x38d2('0x36')]=qs[_0x38d2('0x37')](_0xfc9c89[_0x38d2('0x2f')][_0x38d2('0x37')]);_0x1ad7ee[_0x38d2('0x3a')]=qs[_0x38d2('0x30')](_[_0x38d2('0x38')](_0xfc9c89[_0x38d2('0x2f')],_0x2fa9a0[_0x38d2('0x30')]));if(_0xfc9c89[_0x38d2('0x2f')][_0x38d2('0x39')]){_0x1ad7ee[_0x38d2('0x3a')]=_[_0x38d2('0x3b')](_0x1ad7ee[_0x38d2('0x3a')],{'$or':_['map'](_0x1ad7ee[_0x38d2('0x31')],function(_0x55901e){var _0x2368a7={};_0x2368a7[_0x55901e]={'$like':'%'+_0xfc9c89[_0x38d2('0x2f')][_0x38d2('0x39')]+'%'};return _0x2368a7;})});}_0x1ad7ee=_[_0x38d2('0x3b')]({},_0x1ad7ee,_0xfc9c89[_0x38d2('0x46')]);return _0x5d437c[_0x38d2('0x4f')](_0x1ad7ee);}})[_0x38d2('0x23')](function(_0x4bdcbd){if(_0x4bdcbd){_0x256f86=_0x4bdcbd[_0x38d2('0x45')];if(!_0xfc9c89['query'][_0x38d2('0x34')]('nolimit')){_0x1ad7ee['limit']=qs[_0x38d2('0x1c')](_0xfc9c89['query'][_0x38d2('0x1c')]);_0x1ad7ee[_0x38d2('0x1e')]=qs[_0x38d2('0x1e')](_0xfc9c89[_0x38d2('0x2f')]['offset']);}return _0x5d437c[_0x38d2('0x4f')](_0x1ad7ee);}})[_0x38d2('0x23')](function(_0x38dea7){if(_0x38dea7){return _0x38dea7?{'count':_0x256f86,'rows':_0x38dea7}:null;}})[_0x38d2('0x23')](respondWithResult(_0x5cf1e2,null))['catch'](handleError(_0x5cf1e2,null));};exports[_0x38d2('0x50')]=function(_0x257d13,_0x3ccc76,_0x51c2a1){var _0x6a4b9e={};var _0x1f881c={};var _0x2d0158;var _0x1cc5bd;return db[_0x38d2('0x3d')][_0x38d2('0x4b')]({'where':{'id':_0x257d13['params']['id']}})[_0x38d2('0x23')](handleEntityNotFound(_0x3ccc76,null))[_0x38d2('0x23')](function(_0x4e09fc){if(_0x4e09fc){_0x2d0158=_0x4e09fc;_0x1f881c['model']=_[_0x38d2('0x44')](db[_0x38d2('0x51')]['rawAttributes']);_0x1f881c[_0x38d2('0x2f')]=_[_0x38d2('0x44')](_0x257d13[_0x38d2('0x2f')]);_0x1f881c['filters']=_[_0x38d2('0x32')](_0x1f881c[_0x38d2('0x2e')],_0x1f881c[_0x38d2('0x2f')]);_0x6a4b9e[_0x38d2('0x31')]=_[_0x38d2('0x32')](_0x1f881c[_0x38d2('0x2e')],qs[_0x38d2('0x33')](_0x257d13[_0x38d2('0x2f')][_0x38d2('0x33')]));_0x6a4b9e[_0x38d2('0x31')]=_0x6a4b9e['attributes'][_0x38d2('0x45')]?_0x6a4b9e['attributes']:_0x1f881c['model'];_0x6a4b9e['order']=qs[_0x38d2('0x37')](_0x257d13[_0x38d2('0x2f')][_0x38d2('0x37')]);_0x6a4b9e[_0x38d2('0x3a')]=qs[_0x38d2('0x30')](_[_0x38d2('0x38')](_0x257d13[_0x38d2('0x2f')],_0x1f881c[_0x38d2('0x30')]));if(_0x257d13[_0x38d2('0x2f')][_0x38d2('0x39')]){_0x6a4b9e[_0x38d2('0x3a')]=_['merge'](_0x6a4b9e[_0x38d2('0x3a')],{'$or':_[_0x38d2('0x29')](_0x6a4b9e[_0x38d2('0x31')],function(_0x342ccd){var _0x225cbf={};_0x225cbf[_0x342ccd]={'$like':'%'+_0x257d13[_0x38d2('0x2f')]['filter']+'%'};return _0x225cbf;})});}_0x6a4b9e=_['merge']({},_0x6a4b9e,_0x257d13[_0x38d2('0x46')]);return _0x2d0158['getTags'](_0x6a4b9e);}})[_0x38d2('0x23')](function(_0x21ba7f){if(_0x21ba7f){_0x1cc5bd=_0x21ba7f[_0x38d2('0x45')];if(!_0x257d13[_0x38d2('0x2f')][_0x38d2('0x34')](_0x38d2('0x35'))){_0x6a4b9e[_0x38d2('0x1c')]=qs[_0x38d2('0x1c')](_0x257d13[_0x38d2('0x2f')][_0x38d2('0x1c')]);_0x6a4b9e[_0x38d2('0x1e')]=qs[_0x38d2('0x1e')](_0x257d13['query'][_0x38d2('0x1e')]);}return _0x2d0158[_0x38d2('0x50')](_0x6a4b9e);}})[_0x38d2('0x23')](function(_0x5a6a49){if(_0x5a6a49){return _0x5a6a49?{'count':_0x1cc5bd,'rows':_0x5a6a49}:null;}})[_0x38d2('0x23')](respondWithResult(_0x3ccc76,null))[_0x38d2('0x47')](handleError(_0x3ccc76,null));};exports[_0x38d2('0x52')]=function(_0x4a7648,_0x1424f4,_0x5431c5){if(_0x4a7648[_0x38d2('0x49')]['id']){delete _0x4a7648['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4a7648[_0x38d2('0x43')]['id']}})[_0x38d2('0x23')](handleEntityNotFound(_0x1424f4,null))[_0x38d2('0x23')](function(_0x179d1d){if(_0x179d1d){return _0x179d1d[_0x38d2('0x52')](_0x4a7648[_0x38d2('0x49')][_0x38d2('0x53')]||[]);}return null;})['then'](respondWithResult(_0x1424f4,null))[_0x38d2('0x47')](handleError(_0x1424f4,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d509179..866df83 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 _0x52a0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x5a9841,_0x950566){var _0xb4f748=function(_0xdecea8){while(--_0xdecea8){_0x5a9841['push'](_0x5a9841['shift']());}};_0xb4f748(++_0x950566);}(_0x52a0,0xb3));var _0x052a=function(_0x43a8b9,_0x4ff1e0){_0x43a8b9=_0x43a8b9-0x0;var _0x39894b=_0x52a0[_0x43a8b9];return _0x39894b;};'use strict';var _=require(_0x052a('0x0'));var util=require(_0x052a('0x1'));var logger=require(_0x052a('0x2'))(_0x052a('0x3'));var moment=require(_0x052a('0x4'));var BPromise=require(_0x052a('0x5'));var rp=require(_0x052a('0x6'));var fs=require('fs');var path=require(_0x052a('0x7'));var rimraf=require(_0x052a('0x8'));var config=require(_0x052a('0x9'));var attributes=require(_0x052a('0xa'));module[_0x052a('0xb')]=function(_0x43349c,_0x4a8be7){return _0x43349c[_0x052a('0xc')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66fe=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','int_freshdesk_configurations'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x66fe,0x68));var _0xe66f=function(_0x8ba526,_0x506c5d){_0x8ba526=_0x8ba526-0x0;var _0x29cc3b=_0x66fe[_0x8ba526];return _0x29cc3b;};'use strict';var _=require(_0xe66f('0x0'));var util=require(_0xe66f('0x1'));var logger=require(_0xe66f('0x2'))(_0xe66f('0x3'));var moment=require(_0xe66f('0x4'));var BPromise=require(_0xe66f('0x5'));var rp=require(_0xe66f('0x6'));var fs=require('fs');var path=require(_0xe66f('0x7'));var rimraf=require(_0xe66f('0x8'));var config=require(_0xe66f('0x9'));var attributes=require(_0xe66f('0xa'));module['exports']=function(_0xcc0a4,_0x3bcced){return _0xcc0a4[_0xe66f('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0xe66f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 5162fe3..ce25fcb 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 _0x0543=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x387ff0,_0x5c8876){var _0x2aefd6=function(_0x350b60){while(--_0x350b60){_0x387ff0['push'](_0x387ff0['shift']());}};_0x2aefd6(++_0x5c8876);}(_0x0543,0x1c9));var _0x3054=function(_0x224ffa,_0x18bd58){_0x224ffa=_0x224ffa-0x0;var _0x528bf0=_0x0543[_0x224ffa];return _0x528bf0;};'use strict';var _=require('lodash');var util=require(_0x3054('0x0'));var moment=require('moment');var BPromise=require(_0x3054('0x1'));var rs=require(_0x3054('0x2'));var fs=require('fs');var Redis=require(_0x3054('0x3'));var db=require(_0x3054('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3054('0x5'))(_0x3054('0x6'));var config=require(_0x3054('0x7'));var jayson=require(_0x3054('0x8'));var client=jayson['client'][_0x3054('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28c1f6,_0x4aa8fb,_0xf8927b){return new BPromise(function(_0x24b504,_0x39fdad){return client[_0x3054('0xa')](_0x28c1f6,_0xf8927b)[_0x3054('0xb')](function(_0xfeb016){logger[_0x3054('0xc')](_0x3054('0xd'),_0x4aa8fb,'request\x20sent');logger[_0x3054('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4aa8fb,_0x3054('0xf'),JSON[_0x3054('0x10')](_0xfeb016));if(_0xfeb016[_0x3054('0x11')]){if(_0xfeb016['error'][_0x3054('0x12')]===0x1f4){logger[_0x3054('0x11')](_0x3054('0xd'),_0x4aa8fb,_0xfeb016[_0x3054('0x11')][_0x3054('0x13')]);return _0x39fdad(_0xfeb016[_0x3054('0x11')]['message']);}logger['error'](_0x3054('0xd'),_0x4aa8fb,_0xfeb016[_0x3054('0x11')][_0x3054('0x13')]);return _0x24b504(_0xfeb016[_0x3054('0x11')][_0x3054('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4aa8fb,'request\x20sent');_0x24b504(_0xfeb016[_0x3054('0x14')][_0x3054('0x13')]);}})['catch'](function(_0x20853c){logger[_0x3054('0x11')](_0x3054('0xd'),_0x4aa8fb,_0x20853c);_0x39fdad(_0x20853c);});});} \ No newline at end of file +var _0x1006=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x13c5a9,_0x547d90){var _0x25f7dc=function(_0x1fe88e){while(--_0x1fe88e){_0x13c5a9['push'](_0x13c5a9['shift']());}};_0x25f7dc(++_0x547d90);}(_0x1006,0x9b));var _0x6100=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x1006[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x6100('0x0'));var util=require(_0x6100('0x1'));var moment=require(_0x6100('0x2'));var BPromise=require(_0x6100('0x3'));var rs=require(_0x6100('0x4'));var fs=require('fs');var Redis=require(_0x6100('0x5'));var db=require(_0x6100('0x6'))['db'];var utils=require(_0x6100('0x7'));var logger=require(_0x6100('0x8'))(_0x6100('0x9'));var config=require(_0x6100('0xa'));var jayson=require(_0x6100('0xb'));var client=jayson['client'][_0x6100('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x184d42,_0x51adcd,_0x2c36b4){return new BPromise(function(_0x30f738,_0x343f23){return client['request'](_0x184d42,_0x2c36b4)[_0x6100('0xd')](function(_0x1b58cc){logger[_0x6100('0xe')](_0x6100('0xf'),_0x51adcd,'request\x20sent');logger[_0x6100('0x10')](_0x6100('0x11'),_0x51adcd,_0x6100('0x12'),JSON['stringify'](_0x1b58cc));if(_0x1b58cc['error']){if(_0x1b58cc[_0x6100('0x13')][_0x6100('0x14')]===0x1f4){logger[_0x6100('0x13')](_0x6100('0xf'),_0x51adcd,_0x1b58cc['error'][_0x6100('0x15')]);return _0x343f23(_0x1b58cc['error']['message']);}logger[_0x6100('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x51adcd,_0x1b58cc[_0x6100('0x13')][_0x6100('0x15')]);return _0x30f738(_0x1b58cc[_0x6100('0x13')][_0x6100('0x15')]);}else{logger[_0x6100('0xe')](_0x6100('0xf'),_0x51adcd,_0x6100('0x12'));_0x30f738(_0x1b58cc[_0x6100('0x16')][_0x6100('0x15')]);}})[_0x6100('0x17')](function(_0x506b6c){logger['error'](_0x6100('0xf'),_0x51adcd,_0x506b6c);_0x343f23(_0x506b6c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b3bb055..86f03ac 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 _0x96f2=['put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96f2,0x1f0));var _0x296f=function(_0x1cd9a5,_0x35f6cd){_0x1cd9a5=_0x1cd9a5-0x0;var _0x115c83=_0x96f2[_0x1cd9a5];return _0x115c83;};'use strict';var multer=require(_0x296f('0x0'));var util=require(_0x296f('0x1'));var path=require(_0x296f('0x2'));var timeout=require(_0x296f('0x3'));var express=require(_0x296f('0x4'));var router=express[_0x296f('0x5')]();var fs_extra=require(_0x296f('0x6'));var auth=require(_0x296f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x296f('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x296f('0x9')]('/',auth[_0x296f('0xa')](),controller['index']);router[_0x296f('0x9')](_0x296f('0xb'),auth[_0x296f('0xa')](),controller['show']);router[_0x296f('0xc')]('/',auth[_0x296f('0xa')](),controller[_0x296f('0xd')]);router[_0x296f('0xe')](_0x296f('0xb'),auth[_0x296f('0xa')](),controller[_0x296f('0xf')]);router['delete']('/:id',auth[_0x296f('0xa')](),controller[_0x296f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x393f=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','/:id','destroy','exports','util'];(function(_0x117f3c,_0x4ccecd){var _0x493180=function(_0x8bb7ef){while(--_0x8bb7ef){_0x117f3c['push'](_0x117f3c['shift']());}};_0x493180(++_0x4ccecd);}(_0x393f,0xa9));var _0xf393=function(_0x3c8fbf,_0x92e833){_0x3c8fbf=_0x3c8fbf-0x0;var _0x5b9ef5=_0x393f[_0x3c8fbf];return _0x5b9ef5;};'use strict';var multer=require('multer');var util=require(_0xf393('0x0'));var path=require(_0xf393('0x1'));var timeout=require(_0xf393('0x2'));var express=require('express');var router=express[_0xf393('0x3')]();var fs_extra=require(_0xf393('0x4'));var auth=require(_0xf393('0x5'));var interaction=require(_0xf393('0x6'));var config=require(_0xf393('0x7'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0xf393('0x8')](),controller[_0xf393('0x9')]);router[_0xf393('0xa')]('/:id',auth[_0xf393('0x8')](),controller[_0xf393('0xb')]);router[_0xf393('0xc')]('/',auth[_0xf393('0x8')](),controller[_0xf393('0xd')]);router['put'](_0xf393('0xe'),auth[_0xf393('0x8')](),controller['update']);router['delete']('/:id',auth[_0xf393('0x8')](),controller[_0xf393('0xf')]);module[_0xf393('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 71ddbac..86fb516 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 _0x3905=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x3905,0xf8));var _0x5390=function(_0x134764,_0x112da5){_0x134764=_0x134764-0x0;var _0x2fe527=_0x3905[_0x134764];return _0x2fe527;};'use strict';var Sequelize=require(_0x5390('0x0'));module[_0x5390('0x1')]={'type':{'type':Sequelize[_0x5390('0x2')](_0x5390('0x3'),_0x5390('0x4'),_0x5390('0x5'),_0x5390('0x6'),_0x5390('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5390('0x8')]},'key':{'type':Sequelize[_0x5390('0x8')]},'keyType':{'type':Sequelize[_0x5390('0x2')](_0x5390('0x3'),_0x5390('0x4'),_0x5390('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5390('0x8')]},'nameField':{'type':Sequelize[_0x5390('0x8')]},'customField':{'type':Sequelize[_0x5390('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5390('0x8')]}}; \ No newline at end of file +var _0xd00a=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x40e695,_0x366877){var _0x55a70e=function(_0x44cc1c){while(--_0x44cc1c){_0x40e695['push'](_0x40e695['shift']());}};_0x55a70e(++_0x366877);}(_0xd00a,0x196));var _0xad00=function(_0x127ed7,_0x18c2c5){_0x127ed7=_0x127ed7-0x0;var _0x17c7bb=_0xd00a[_0x127ed7];return _0x17c7bb;};'use strict';var Sequelize=require(_0xad00('0x0'));module['exports']={'type':{'type':Sequelize[_0xad00('0x1')](_0xad00('0x2'),_0xad00('0x3'),_0xad00('0x4'),'keyValue',_0xad00('0x5')),'defaultValue':_0xad00('0x2')},'content':{'type':Sequelize[_0xad00('0x6')]},'key':{'type':Sequelize[_0xad00('0x6')]},'keyType':{'type':Sequelize[_0xad00('0x1')]('string',_0xad00('0x3'),_0xad00('0x4'))},'keyContent':{'type':Sequelize[_0xad00('0x6')]},'idField':{'type':Sequelize[_0xad00('0x6')]},'nameField':{'type':Sequelize[_0xad00('0x6')]},'customField':{'type':Sequelize[_0xad00('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index db1ff99..db8487a 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 _0x9c2c=['VIRTUAL','filter','options','includeAll','FreshdeskField','findAll','rows','catch','show','params','keys','length','include','find','create','body','eml-format','rimraf','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge'];(function(_0x19f625,_0x15055b){var _0x5cc473=function(_0x24223c){while(--_0x24223c){_0x19f625['push'](_0x19f625['shift']());}};_0x5cc473(++_0x15055b);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc9c2('0x0'));var rimraf=require(_0xc9c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9c2('0x3'));var util=require(_0xc9c2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc9c2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9c2('0x6'));var _=require(_0xc9c2('0x7'));var squel=require(_0xc9c2('0x8'));var crypto=require(_0xc9c2('0x9'));var jsforce=require(_0xc9c2('0xa'));var deskjs=require(_0xc9c2('0xb'));var toCsv=require(_0xc9c2('0x5'));var querystring=require(_0xc9c2('0xc'));var Papa=require(_0xc9c2('0xd'));var Redis=require('ioredis');var authService=require(_0xc9c2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc9c2('0xf'));var hardwareService=require(_0xc9c2('0x10'));var logger=require(_0xc9c2('0x11'))(_0xc9c2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc9c2('0x13'));var db=require(_0xc9c2('0x14'))['db'];function respondWithStatusCode(_0x568f69,_0x7ec780){_0x7ec780=_0x7ec780||0xcc;return function(_0x1f08a7){if(_0x1f08a7){return _0x568f69[_0xc9c2('0x15')](_0x7ec780);}return _0x568f69[_0xc9c2('0x16')](_0x7ec780)[_0xc9c2('0x17')]();};}function respondWithResult(_0x3b0058,_0x33b288){_0x33b288=_0x33b288||0xc8;return function(_0x132702){if(_0x132702){return _0x3b0058[_0xc9c2('0x16')](_0x33b288)[_0xc9c2('0x18')](_0x132702);}};}function respondWithFilteredResult(_0xf94209,_0x383667){return function(_0x480d7c){if(_0x480d7c){var _0x27840d=typeof _0x383667[_0xc9c2('0x19')]===_0xc9c2('0x1a')&&typeof _0x383667[_0xc9c2('0x1b')]===_0xc9c2('0x1a');var _0x49413b=_0x480d7c[_0xc9c2('0x1c')];var _0x37c027=_0x27840d?0x0:_0x383667[_0xc9c2('0x19')];var _0x4e4ded=_0x27840d?_0x480d7c[_0xc9c2('0x1c')]:_0x383667[_0xc9c2('0x19')]+_0x383667[_0xc9c2('0x1b')];var _0x484ca3;if(_0x4e4ded>=_0x49413b){_0x4e4ded=_0x49413b;_0x484ca3=0xc8;}else{_0x484ca3=0xce;}_0xf94209[_0xc9c2('0x16')](_0x484ca3);return _0xf94209[_0xc9c2('0x1d')]('Content-Range',_0x37c027+'-'+_0x4e4ded+'/'+_0x49413b)['json'](_0x480d7c);}return null;};}function patchUpdates(_0x37e3){return function(_0x50f280){try{jsonpatch[_0xc9c2('0x1e')](_0x50f280,_0x37e3,!![]);}catch(_0x140c8a){return BPromise[_0xc9c2('0x1f')](_0x140c8a);}return _0x50f280[_0xc9c2('0x20')]();};}function saveUpdates(_0x3e1774,_0x53c460){return function(_0x1fbac4){if(_0x1fbac4){return _0x1fbac4[_0xc9c2('0x21')](_0x3e1774)[_0xc9c2('0x22')](function(_0x11cc07){return _0x11cc07;});}return null;};}function removeEntity(_0x32c372,_0x385030){return function(_0x56e515){if(_0x56e515){return _0x56e515[_0xc9c2('0x23')]()[_0xc9c2('0x22')](function(){_0x32c372['status'](0xcc)[_0xc9c2('0x17')]();});}};}function handleEntityNotFound(_0x4b3b97,_0xa18b32){return function(_0xd803e9){if(!_0xd803e9){_0x4b3b97[_0xc9c2('0x15')](0x194);}return _0xd803e9;};}function handleError(_0x2222e4,_0x484d55){_0x484d55=_0x484d55||0x1f4;return function(_0x2073ef){logger['error'](_0x2073ef[_0xc9c2('0x24')]);if(_0x2073ef[_0xc9c2('0x25')]){delete _0x2073ef[_0xc9c2('0x25')];}_0x2222e4[_0xc9c2('0x16')](_0x484d55)[_0xc9c2('0x26')](_0x2073ef);};}exports['index']=function(_0x3cedb5,_0xe2f93b){var _0x40033a={},_0x1554ae={},_0xa89cb8={'count':0x0,'rows':[]};var _0x460832=_[_0xc9c2('0x27')](db['FreshdeskField'][_0xc9c2('0x28')],function(_0x4a9fca){return{'name':_0x4a9fca[_0xc9c2('0x29')],'type':_0x4a9fca[_0xc9c2('0x2a')]['key']};});_0x1554ae[_0xc9c2('0x2b')]=_[_0xc9c2('0x27')](_0x460832,_0xc9c2('0x25'));_0x1554ae[_0xc9c2('0x2c')]=_['keys'](_0x3cedb5[_0xc9c2('0x2c')]);_0x1554ae[_0xc9c2('0x2d')]=_['intersection'](_0x1554ae['model'],_0x1554ae[_0xc9c2('0x2c')]);_0x40033a[_0xc9c2('0x2e')]=_[_0xc9c2('0x2f')](_0x1554ae['model'],qs['fields'](_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x30')]));_0x40033a['attributes']=_0x40033a[_0xc9c2('0x2e')]['length']?_0x40033a[_0xc9c2('0x2e')]:_0x1554ae[_0xc9c2('0x2b')];if(!_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x31')](_0xc9c2('0x32'))){_0x40033a[_0xc9c2('0x1b')]=qs[_0xc9c2('0x1b')](_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x1b')]);_0x40033a['offset']=qs[_0xc9c2('0x19')](_0x3cedb5['query'][_0xc9c2('0x19')]);}_0x40033a[_0xc9c2('0x33')]=qs['sort'](_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x34')]);_0x40033a['where']=qs[_0xc9c2('0x2d')](_[_0xc9c2('0x35')](_0x3cedb5[_0xc9c2('0x2c')],_0x1554ae['filters']),_0x460832);if(_0x3cedb5[_0xc9c2('0x2c')]['filter']){_0x40033a[_0xc9c2('0x36')]=_[_0xc9c2('0x37')](_0x40033a['where'],{'$or':_[_0xc9c2('0x27')](_0x460832,function(_0x3f718a){if(_0x3f718a[_0xc9c2('0x2a')]!==_0xc9c2('0x38')){var _0x3f9248={};_0x3f9248[_0x3f718a[_0xc9c2('0x25')]]={'$like':'%'+_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x39')]+'%'};return _0x3f9248;}})});}_0x40033a=_[_0xc9c2('0x37')]({},_0x40033a,_0x3cedb5[_0xc9c2('0x3a')]);var _0x8d6710={'where':_0x40033a['where']};return db['FreshdeskField'][_0xc9c2('0x1c')](_0x8d6710)[_0xc9c2('0x22')](function(_0x4507c9){_0xa89cb8[_0xc9c2('0x1c')]=_0x4507c9;if(_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x3b')]){_0x40033a['include']=[{'all':!![]}];}return db[_0xc9c2('0x3c')][_0xc9c2('0x3d')](_0x40033a);})[_0xc9c2('0x22')](function(_0x46c740){_0xa89cb8[_0xc9c2('0x3e')]=_0x46c740;return _0xa89cb8;})['then'](respondWithFilteredResult(_0xe2f93b,_0x40033a))[_0xc9c2('0x3f')](handleError(_0xe2f93b,null));};exports[_0xc9c2('0x40')]=function(_0x2126f8,_0x4f6bc9){var _0x3a05f8={'raw':!![],'where':{'id':_0x2126f8[_0xc9c2('0x41')]['id']}},_0xd3d946={};_0xd3d946[_0xc9c2('0x2b')]=_[_0xc9c2('0x42')](db['FreshdeskField']['rawAttributes']);_0xd3d946[_0xc9c2('0x2c')]=_[_0xc9c2('0x42')](_0x2126f8['query']);_0xd3d946[_0xc9c2('0x2d')]=_[_0xc9c2('0x2f')](_0xd3d946[_0xc9c2('0x2b')],_0xd3d946[_0xc9c2('0x2c')]);_0x3a05f8[_0xc9c2('0x2e')]=_[_0xc9c2('0x2f')](_0xd3d946[_0xc9c2('0x2b')],qs['fields'](_0x2126f8[_0xc9c2('0x2c')]['fields']));_0x3a05f8[_0xc9c2('0x2e')]=_0x3a05f8['attributes'][_0xc9c2('0x43')]?_0x3a05f8['attributes']:_0xd3d946[_0xc9c2('0x2b')];if(_0x2126f8['query'][_0xc9c2('0x3b')]){_0x3a05f8[_0xc9c2('0x44')]=[{'all':!![]}];}_0x3a05f8=_[_0xc9c2('0x37')]({},_0x3a05f8,_0x2126f8[_0xc9c2('0x3a')]);return db[_0xc9c2('0x3c')][_0xc9c2('0x45')](_0x3a05f8)[_0xc9c2('0x22')](handleEntityNotFound(_0x4f6bc9,null))['then'](respondWithResult(_0x4f6bc9,null))[_0xc9c2('0x3f')](handleError(_0x4f6bc9,null));};exports[_0xc9c2('0x46')]=function(_0x412df0,_0xad73d4){return db[_0xc9c2('0x3c')][_0xc9c2('0x46')](_0x412df0['body'],{})[_0xc9c2('0x22')](respondWithResult(_0xad73d4,0xc9))[_0xc9c2('0x3f')](handleError(_0xad73d4,null));};exports[_0xc9c2('0x21')]=function(_0x88fa84,_0x2e9925){if(_0x88fa84[_0xc9c2('0x47')]['id']){delete _0x88fa84[_0xc9c2('0x47')]['id'];}return db[_0xc9c2('0x3c')]['find']({'where':{'id':_0x88fa84[_0xc9c2('0x41')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x2e9925,null))[_0xc9c2('0x22')](saveUpdates(_0x88fa84[_0xc9c2('0x47')],null))[_0xc9c2('0x22')](respondWithResult(_0x2e9925,null))['catch'](handleError(_0x2e9925,null));};exports[_0xc9c2('0x23')]=function(_0x4e2589,_0xdedc7c){return db['FreshdeskField'][_0xc9c2('0x45')]({'where':{'id':_0x4e2589['params']['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0xdedc7c,null))['then'](removeEntity(_0xdedc7c,null))['catch'](handleError(_0xdedc7c,null));}; \ No newline at end of file +var _0xf403=['error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','catch','show','params','intersection','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy'];(function(_0x3f8282,_0x11b607){var _0x50f918=function(_0x3a37de){while(--_0x3a37de){_0x3f8282['push'](_0x3f8282['shift']());}};_0x50f918(++_0x11b607);}(_0xf403,0x1d3));var _0x3f40=function(_0x1d4a9c,_0x2f062b){_0x1d4a9c=_0x1d4a9c-0x0;var _0x208424=_0xf403[_0x1d4a9c];return _0x208424;};'use strict';var emlformat=require(_0x3f40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f40('0x1'));var jsonpatch=require(_0x3f40('0x2'));var rp=require(_0x3f40('0x3'));var moment=require(_0x3f40('0x4'));var BPromise=require(_0x3f40('0x5'));var Mustache=require(_0x3f40('0x6'));var util=require(_0x3f40('0x7'));var path=require(_0x3f40('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f40('0x9'));var fs=require('fs');var fs_extra=require(_0x3f40('0xa'));var _=require(_0x3f40('0xb'));var squel=require(_0x3f40('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f40('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f40('0xe'));var Papa=require(_0x3f40('0xf'));var Redis=require(_0x3f40('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f40('0x11'));var hardwareService=require(_0x3f40('0x12'));var logger=require(_0x3f40('0x13'))('api');var utils=require(_0x3f40('0x14'));var config=require(_0x3f40('0x15'));var licenseUtil=require(_0x3f40('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x332635,_0x509c02){_0x509c02=_0x509c02||0xcc;return function(_0x116460){if(_0x116460){return _0x332635[_0x3f40('0x17')](_0x509c02);}return _0x332635[_0x3f40('0x18')](_0x509c02)[_0x3f40('0x19')]();};}function respondWithResult(_0x569c6e,_0x2b2bfe){_0x2b2bfe=_0x2b2bfe||0xc8;return function(_0x308e97){if(_0x308e97){return _0x569c6e[_0x3f40('0x18')](_0x2b2bfe)[_0x3f40('0x1a')](_0x308e97);}};}function respondWithFilteredResult(_0x232241,_0x4e28b9){return function(_0x2e51ed){if(_0x2e51ed){var _0x3d11c9=typeof _0x4e28b9['offset']==='undefined'&&typeof _0x4e28b9['limit']===_0x3f40('0x1b');var _0x13b950=_0x2e51ed[_0x3f40('0x1c')];var _0x131e55=_0x3d11c9?0x0:_0x4e28b9[_0x3f40('0x1d')];var _0x5b4ebc=_0x3d11c9?_0x2e51ed[_0x3f40('0x1c')]:_0x4e28b9[_0x3f40('0x1d')]+_0x4e28b9[_0x3f40('0x1e')];var _0x29405a;if(_0x5b4ebc>=_0x13b950){_0x5b4ebc=_0x13b950;_0x29405a=0xc8;}else{_0x29405a=0xce;}_0x232241[_0x3f40('0x18')](_0x29405a);return _0x232241['set'](_0x3f40('0x1f'),_0x131e55+'-'+_0x5b4ebc+'/'+_0x13b950)['json'](_0x2e51ed);}return null;};}function patchUpdates(_0x12aabf){return function(_0x32b945){try{jsonpatch[_0x3f40('0x20')](_0x32b945,_0x12aabf,!![]);}catch(_0x113293){return BPromise[_0x3f40('0x21')](_0x113293);}return _0x32b945['save']();};}function saveUpdates(_0x27f5a5,_0x379b4e){return function(_0x117823){if(_0x117823){return _0x117823[_0x3f40('0x22')](_0x27f5a5)[_0x3f40('0x23')](function(_0xa1f39d){return _0xa1f39d;});}return null;};}function removeEntity(_0x4e1f47,_0x31fc91){return function(_0x59eb32){if(_0x59eb32){return _0x59eb32[_0x3f40('0x24')]()['then'](function(){_0x4e1f47[_0x3f40('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37b47e,_0x5ae235){return function(_0x4b206b){if(!_0x4b206b){_0x37b47e['sendStatus'](0x194);}return _0x4b206b;};}function handleError(_0x30a945,_0x26e46b){_0x26e46b=_0x26e46b||0x1f4;return function(_0x140044){logger[_0x3f40('0x25')](_0x140044['stack']);if(_0x140044[_0x3f40('0x26')]){delete _0x140044['name'];}_0x30a945[_0x3f40('0x18')](_0x26e46b)[_0x3f40('0x27')](_0x140044);};}exports[_0x3f40('0x28')]=function(_0x5e0f25,_0x287632){var _0x4b5ef7={},_0x1cab5c={},_0x5b9079={'count':0x0,'rows':[]};var _0x49057b=_[_0x3f40('0x29')](db[_0x3f40('0x2a')][_0x3f40('0x2b')],function(_0xb23186){return{'name':_0xb23186[_0x3f40('0x2c')],'type':_0xb23186[_0x3f40('0x2d')][_0x3f40('0x2e')]};});_0x1cab5c[_0x3f40('0x2f')]=_['map'](_0x49057b,_0x3f40('0x26'));_0x1cab5c[_0x3f40('0x30')]=_[_0x3f40('0x31')](_0x5e0f25[_0x3f40('0x30')]);_0x1cab5c[_0x3f40('0x32')]=_['intersection'](_0x1cab5c[_0x3f40('0x2f')],_0x1cab5c[_0x3f40('0x30')]);_0x4b5ef7[_0x3f40('0x33')]=_['intersection'](_0x1cab5c[_0x3f40('0x2f')],qs[_0x3f40('0x34')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x34')]));_0x4b5ef7[_0x3f40('0x33')]=_0x4b5ef7[_0x3f40('0x33')][_0x3f40('0x35')]?_0x4b5ef7[_0x3f40('0x33')]:_0x1cab5c[_0x3f40('0x2f')];if(!_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x36')](_0x3f40('0x37'))){_0x4b5ef7[_0x3f40('0x1e')]=qs[_0x3f40('0x1e')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x1e')]);_0x4b5ef7[_0x3f40('0x1d')]=qs[_0x3f40('0x1d')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x1d')]);}_0x4b5ef7[_0x3f40('0x38')]=qs[_0x3f40('0x39')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x39')]);_0x4b5ef7[_0x3f40('0x3a')]=qs[_0x3f40('0x32')](_[_0x3f40('0x3b')](_0x5e0f25[_0x3f40('0x30')],_0x1cab5c[_0x3f40('0x32')]),_0x49057b);if(_0x5e0f25[_0x3f40('0x30')]['filter']){_0x4b5ef7['where']=_[_0x3f40('0x3c')](_0x4b5ef7[_0x3f40('0x3a')],{'$or':_[_0x3f40('0x29')](_0x49057b,function(_0x4778ec){if(_0x4778ec[_0x3f40('0x2d')]!==_0x3f40('0x3d')){var _0x1ffa33={};_0x1ffa33[_0x4778ec['name']]={'$like':'%'+_0x5e0f25[_0x3f40('0x30')]['filter']+'%'};return _0x1ffa33;}})});}_0x4b5ef7=_[_0x3f40('0x3c')]({},_0x4b5ef7,_0x5e0f25[_0x3f40('0x3e')]);var _0xec24e4={'where':_0x4b5ef7['where']};return db[_0x3f40('0x2a')][_0x3f40('0x1c')](_0xec24e4)['then'](function(_0x1eb15c){_0x5b9079[_0x3f40('0x1c')]=_0x1eb15c;if(_0x5e0f25['query'][_0x3f40('0x3f')]){_0x4b5ef7['include']=[{'all':!![]}];}return db[_0x3f40('0x2a')]['findAll'](_0x4b5ef7);})['then'](function(_0x8e89a){_0x5b9079['rows']=_0x8e89a;return _0x5b9079;})[_0x3f40('0x23')](respondWithFilteredResult(_0x287632,_0x4b5ef7))[_0x3f40('0x40')](handleError(_0x287632,null));};exports[_0x3f40('0x41')]=function(_0x460237,_0x48b65e){var _0x237c91={'raw':!![],'where':{'id':_0x460237[_0x3f40('0x42')]['id']}},_0x5b0eaa={};_0x5b0eaa[_0x3f40('0x2f')]=_[_0x3f40('0x31')](db['FreshdeskField']['rawAttributes']);_0x5b0eaa[_0x3f40('0x30')]=_[_0x3f40('0x31')](_0x460237[_0x3f40('0x30')]);_0x5b0eaa[_0x3f40('0x32')]=_[_0x3f40('0x43')](_0x5b0eaa[_0x3f40('0x2f')],_0x5b0eaa[_0x3f40('0x30')]);_0x237c91[_0x3f40('0x33')]=_['intersection'](_0x5b0eaa[_0x3f40('0x2f')],qs['fields'](_0x460237['query'][_0x3f40('0x34')]));_0x237c91[_0x3f40('0x33')]=_0x237c91[_0x3f40('0x33')][_0x3f40('0x35')]?_0x237c91[_0x3f40('0x33')]:_0x5b0eaa[_0x3f40('0x2f')];if(_0x460237[_0x3f40('0x30')][_0x3f40('0x3f')]){_0x237c91[_0x3f40('0x44')]=[{'all':!![]}];}_0x237c91=_[_0x3f40('0x3c')]({},_0x237c91,_0x460237[_0x3f40('0x3e')]);return db[_0x3f40('0x2a')][_0x3f40('0x45')](_0x237c91)[_0x3f40('0x23')](handleEntityNotFound(_0x48b65e,null))['then'](respondWithResult(_0x48b65e,null))[_0x3f40('0x40')](handleError(_0x48b65e,null));};exports['create']=function(_0x2c1fa2,_0x2f16d6){return db['FreshdeskField'][_0x3f40('0x46')](_0x2c1fa2[_0x3f40('0x47')],{})[_0x3f40('0x23')](respondWithResult(_0x2f16d6,0xc9))[_0x3f40('0x40')](handleError(_0x2f16d6,null));};exports[_0x3f40('0x22')]=function(_0x268ae4,_0x851bfc){if(_0x268ae4[_0x3f40('0x47')]['id']){delete _0x268ae4[_0x3f40('0x47')]['id'];}return db[_0x3f40('0x2a')][_0x3f40('0x45')]({'where':{'id':_0x268ae4[_0x3f40('0x42')]['id']}})[_0x3f40('0x23')](handleEntityNotFound(_0x851bfc,null))[_0x3f40('0x23')](saveUpdates(_0x268ae4[_0x3f40('0x47')],null))[_0x3f40('0x23')](respondWithResult(_0x851bfc,null))[_0x3f40('0x40')](handleError(_0x851bfc,null));};exports[_0x3f40('0x24')]=function(_0x32bd05,_0x2d7e66){return db[_0x3f40('0x2a')]['find']({'where':{'id':_0x32bd05[_0x3f40('0x42')]['id']}})[_0x3f40('0x23')](handleEntityNotFound(_0x2d7e66,null))[_0x3f40('0x23')](removeEntity(_0x2d7e66,null))[_0x3f40('0x40')](handleError(_0x2d7e66,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a840f39..aad920e 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 _0xa863=['rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','FieldId','util','api','moment','path'];(function(_0x59f7b8,_0xb2ac21){var _0x7b28c5=function(_0x427d2d){while(--_0x427d2d){_0x59f7b8['push'](_0x59f7b8['shift']());}};_0x7b28c5(++_0xb2ac21);}(_0xa863,0x1d0));var _0x3a86=function(_0x55ffb5,_0x3bb935){_0x55ffb5=_0x55ffb5-0x0;var _0x1b9745=_0xa863[_0x55ffb5];return _0x1b9745;};'use strict';var _=require('lodash');var util=require(_0x3a86('0x0'));var logger=require('../../config/logger')(_0x3a86('0x1'));var moment=require(_0x3a86('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a86('0x3'));var rimraf=require(_0x3a86('0x4'));var config=require(_0x3a86('0x5'));var attributes=require(_0x3a86('0x6'));module[_0x3a86('0x7')]=function(_0x107486,_0x1fb484){return _0x107486[_0x3a86('0x8')](_0x3a86('0x9'),attributes,{'tableName':_0x3a86('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x3a86('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f47=['request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x41ab51,_0x150c64){var _0x20c52e=function(_0x238e30){while(--_0x238e30){_0x41ab51['push'](_0x41ab51['shift']());}};_0x20c52e(++_0x150c64);}(_0x7f47,0x12e));var _0x77f4=function(_0x5becd6,_0x13e651){_0x5becd6=_0x5becd6-0x0;var _0x3b7b78=_0x7f47[_0x5becd6];return _0x3b7b78;};'use strict';var _=require(_0x77f4('0x0'));var util=require(_0x77f4('0x1'));var logger=require(_0x77f4('0x2'))(_0x77f4('0x3'));var moment=require(_0x77f4('0x4'));var BPromise=require(_0x77f4('0x5'));var rp=require(_0x77f4('0x6'));var fs=require('fs');var path=require(_0x77f4('0x7'));var rimraf=require('rimraf');var config=require(_0x77f4('0x8'));var attributes=require(_0x77f4('0x9'));module[_0x77f4('0xa')]=function(_0x5f0951,_0x2cfdcf){return _0x5f0951['define'](_0x77f4('0xb'),attributes,{'tableName':_0x77f4('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x77f4('0xd'),'FieldId'],'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 8786f24..0adadc7 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 _0xbc04=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x228a28,_0x95bebb){var _0x4fc4c5=function(_0x4f0419){while(--_0x4f0419){_0x228a28['push'](_0x228a28['shift']());}};_0x4fc4c5(++_0x95bebb);}(_0xbc04,0x1e2));var _0x4bc0=function(_0x324bcf,_0x2d4e18){_0x324bcf=_0x324bcf-0x0;var _0x459574=_0xbc04[_0x324bcf];return _0x459574;};'use strict';var _=require('lodash');var util=require(_0x4bc0('0x0'));var moment=require(_0x4bc0('0x1'));var BPromise=require(_0x4bc0('0x2'));var rs=require(_0x4bc0('0x3'));var fs=require('fs');var Redis=require(_0x4bc0('0x4'));var db=require(_0x4bc0('0x5'))['db'];var utils=require(_0x4bc0('0x6'));var logger=require(_0x4bc0('0x7'))(_0x4bc0('0x8'));var config=require('../../config/environment');var jayson=require(_0x4bc0('0x9'));var client=jayson['client'][_0x4bc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b4a66,_0x1e4248,_0xe6ac66){return new BPromise(function(_0x5c09fa,_0x3a728e){return client[_0x4bc0('0xb')](_0x1b4a66,_0xe6ac66)['then'](function(_0x85d1d1){logger[_0x4bc0('0xc')](_0x4bc0('0xd'),_0x1e4248,'request\x20sent');logger[_0x4bc0('0xe')](_0x4bc0('0xf'),_0x1e4248,_0x4bc0('0x10'),JSON[_0x4bc0('0x11')](_0x85d1d1));if(_0x85d1d1[_0x4bc0('0x12')]){if(_0x85d1d1[_0x4bc0('0x12')][_0x4bc0('0x13')]===0x1f4){logger['error'](_0x4bc0('0xd'),_0x1e4248,_0x85d1d1[_0x4bc0('0x12')][_0x4bc0('0x14')]);return _0x3a728e(_0x85d1d1[_0x4bc0('0x12')]['message']);}logger[_0x4bc0('0x12')](_0x4bc0('0xd'),_0x1e4248,_0x85d1d1['error'][_0x4bc0('0x14')]);return _0x5c09fa(_0x85d1d1[_0x4bc0('0x12')][_0x4bc0('0x14')]);}else{logger[_0x4bc0('0xc')](_0x4bc0('0xd'),_0x1e4248,'request\x20sent');_0x5c09fa(_0x85d1d1[_0x4bc0('0x15')][_0x4bc0('0x14')]);}})[_0x4bc0('0x16')](function(_0xcd4b68){logger[_0x4bc0('0x12')](_0x4bc0('0xd'),_0x1e4248,_0xcd4b68);_0x3a728e(_0xcd4b68);});});} \ No newline at end of file +var _0x4733=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskField,\x20%s,\x20%s','catch'];(function(_0x3a85cc,_0x444e63){var _0x964321=function(_0x200b9a){while(--_0x200b9a){_0x3a85cc['push'](_0x3a85cc['shift']());}};_0x964321(++_0x444e63);}(_0x4733,0x142));var _0x3473=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0x4733[_0x200aa5];return _0x458200;};'use strict';var _=require(_0x3473('0x0'));var util=require(_0x3473('0x1'));var moment=require(_0x3473('0x2'));var BPromise=require(_0x3473('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3473('0x4'));var db=require(_0x3473('0x5'))['db'];var utils=require(_0x3473('0x6'));var logger=require(_0x3473('0x7'))('rpc');var config=require(_0x3473('0x8'));var jayson=require(_0x3473('0x9'));var client=jayson[_0x3473('0xa')][_0x3473('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x290a00,_0x2c5513,_0x681a15){return new BPromise(function(_0x3a638d,_0x166ff6){return client[_0x3473('0xc')](_0x290a00,_0x681a15)[_0x3473('0xd')](function(_0x37cd51){logger[_0x3473('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x2c5513,_0x3473('0xf'));logger[_0x3473('0x10')](_0x3473('0x11'),_0x2c5513,'request\x20sent',JSON[_0x3473('0x12')](_0x37cd51));if(_0x37cd51['error']){if(_0x37cd51[_0x3473('0x13')]['code']===0x1f4){logger[_0x3473('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x2c5513,_0x37cd51['error'][_0x3473('0x14')]);return _0x166ff6(_0x37cd51[_0x3473('0x13')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2c5513,_0x37cd51[_0x3473('0x13')]['message']);return _0x3a638d(_0x37cd51[_0x3473('0x13')]['message']);}else{logger[_0x3473('0xe')](_0x3473('0x15'),_0x2c5513,_0x3473('0xf'));_0x3a638d(_0x37cd51['result'][_0x3473('0x14')]);}})[_0x3473('0x16')](function(_0x60524){logger[_0x3473('0x13')](_0x3473('0x15'),_0x2c5513,_0x60524);_0x166ff6(_0x60524);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f2e3dec..2bc06fa 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc900=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x18704c,_0x4d28c8){var _0x57200a=function(_0x21cabf){while(--_0x21cabf){_0x18704c['push'](_0x18704c['shift']());}};_0x57200a(++_0x4d28c8);}(_0xc900,0xb3));var _0x0c90=function(_0x212eff,_0x19aec3){_0x212eff=_0x212eff-0x0;var _0x25f068=_0xc900[_0x212eff];return _0x25f068;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('0x16')]=router; \ No newline at end of file +var _0x0bb5=['./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x383553,_0x301570){var _0x510e88=function(_0x48b93d){while(--_0x48b93d){_0x383553['push'](_0x383553['shift']());}};_0x510e88(++_0x301570);}(_0x0bb5,0x148));var _0x50bb=function(_0x3a9d08,_0x28cee9){_0x3a9d08=_0x3a9d08-0x0;var _0x2325a7=_0x0bb5[_0x3a9d08];return _0x2325a7;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/configurations',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x10')]('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x10')](_0x50bb('0x12'),auth[_0x50bb('0xb')](),controller['addConfiguration']);router[_0x50bb('0x13')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);module[_0x50bb('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 dc7ad19..1e6073b 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 _0x5430=['STRING','username','remoteUri','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5430,0x10c));var _0x0543=function(_0x4f0336,_0xd1de23){_0x4f0336=_0x4f0336-0x0;var _0x5cbd9e=_0x5430[_0x4f0336];return _0x5cbd9e;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')]},'description':{'type':Sequelize[_0x0543('0x2')]},'username':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0543('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0120=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4d71bc,_0x4f2759){var _0xb529a8=function(_0x32daef){while(--_0x32daef){_0x4d71bc['push'](_0x4d71bc['shift']());}};_0xb529a8(++_0x4f2759);}(_0x0120,0x6f));var _0x0012=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0120[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'apiKey':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'serverUrl':{'type':Sequelize[_0x0012('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 13eb9a9..778ce8e 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 _0xd038=['map','FreshsalesAccount','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','GET','format','Token\x20token=','email','statusCode','stringify','test','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','reject','save','update','destroy','then','error','stack','name','send','index'];(function(_0x1b8f6f,_0x3dacc0){var _0x15410d=function(_0x1071d1){while(--_0x1071d1){_0x1b8f6f['push'](_0x1b8f6f['shift']());}};_0x15410d(++_0x3dacc0);}(_0xd038,0x151));var _0x8d03=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0xd038[_0x9c8b4a];return _0x198bef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8d03('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d03('0x1'));var moment=require(_0x8d03('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8d03('0x3'));var util=require(_0x8d03('0x4'));var path=require(_0x8d03('0x5'));var sox=require(_0x8d03('0x6'));var csv=require(_0x8d03('0x7'));var ejs=require(_0x8d03('0x8'));var fs=require('fs');var fs_extra=require(_0x8d03('0x9'));var _=require('lodash');var squel=require(_0x8d03('0xa'));var crypto=require(_0x8d03('0xb'));var jsforce=require(_0x8d03('0xc'));var deskjs=require(_0x8d03('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8d03('0xe'));var hardwareService=require(_0x8d03('0xf'));var logger=require(_0x8d03('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x8d03('0x11'));var licenseUtil=require(_0x8d03('0x12'));var db=require(_0x8d03('0x13'))['db'];var integrations=require(_0x8d03('0x14'));function respondWithStatusCode(_0x3e72b5,_0x152944){_0x152944=_0x152944||0xcc;return function(_0x2ccbe5){if(_0x2ccbe5){return _0x3e72b5[_0x8d03('0x15')](_0x152944);}return _0x3e72b5['status'](_0x152944)[_0x8d03('0x16')]();};}function respondWithResult(_0x17ae7e,_0x269409){_0x269409=_0x269409||0xc8;return function(_0x4bcdbe){if(_0x4bcdbe){return _0x17ae7e[_0x8d03('0x17')](_0x269409)[_0x8d03('0x18')](_0x4bcdbe);}};}function respondWithFilteredResult(_0xa4be9a,_0x5d6d61){return function(_0x5048e6){if(_0x5048e6){var _0x3370d4=typeof _0x5d6d61['offset']===_0x8d03('0x19')&&typeof _0x5d6d61[_0x8d03('0x1a')]===_0x8d03('0x19');var _0x38c116=_0x5048e6[_0x8d03('0x1b')];var _0x5eae34=_0x3370d4?0x0:_0x5d6d61[_0x8d03('0x1c')];var _0x4d8867=_0x3370d4?_0x5048e6[_0x8d03('0x1b')]:_0x5d6d61[_0x8d03('0x1c')]+_0x5d6d61[_0x8d03('0x1a')];var _0x3e5f5e;if(_0x4d8867>=_0x38c116){_0x4d8867=_0x38c116;_0x3e5f5e=0xc8;}else{_0x3e5f5e=0xce;}_0xa4be9a[_0x8d03('0x17')](_0x3e5f5e);return _0xa4be9a['set']('Content-Range',_0x5eae34+'-'+_0x4d8867+'/'+_0x38c116)['json'](_0x5048e6);}return null;};}function patchUpdates(_0x545fea){return function(_0x34376e){try{jsonpatch['apply'](_0x34376e,_0x545fea,!![]);}catch(_0x464f7c){return BPromise[_0x8d03('0x1d')](_0x464f7c);}return _0x34376e[_0x8d03('0x1e')]();};}function saveUpdates(_0x1182ed,_0x40174a){return function(_0x41055f){if(_0x41055f){return _0x41055f[_0x8d03('0x1f')](_0x1182ed)['then'](function(_0x47621e){return _0x47621e;});}return null;};}function removeEntity(_0x459f3c,_0x2752c8){return function(_0x17c23b){if(_0x17c23b){return _0x17c23b[_0x8d03('0x20')]()[_0x8d03('0x21')](function(){_0x459f3c[_0x8d03('0x17')](0xcc)[_0x8d03('0x16')]();});}};}function handleEntityNotFound(_0x3686e5,_0x551402){return function(_0x457d89){if(!_0x457d89){_0x3686e5['sendStatus'](0x194);}return _0x457d89;};}function handleError(_0x1e5a6e,_0x311ef5){_0x311ef5=_0x311ef5||0x1f4;return function(_0x56623b){logger[_0x8d03('0x22')](_0x56623b[_0x8d03('0x23')]);if(_0x56623b[_0x8d03('0x24')]){delete _0x56623b[_0x8d03('0x24')];}_0x1e5a6e[_0x8d03('0x17')](_0x311ef5)[_0x8d03('0x25')](_0x56623b);};}exports[_0x8d03('0x26')]=function(_0x2da423,_0x397e3b){var _0x12a3f9={},_0x241100={},_0x11bcb9={'count':0x0,'rows':[]};var _0x116eaa=_[_0x8d03('0x27')](db[_0x8d03('0x28')]['rawAttributes'],function(_0x56767f){return{'name':_0x56767f[_0x8d03('0x29')],'type':_0x56767f[_0x8d03('0x2a')]['key']};});_0x241100[_0x8d03('0x2b')]=_['map'](_0x116eaa,_0x8d03('0x24'));_0x241100[_0x8d03('0x2c')]=_[_0x8d03('0x2d')](_0x2da423[_0x8d03('0x2c')]);_0x241100['filters']=_[_0x8d03('0x2e')](_0x241100[_0x8d03('0x2b')],_0x241100[_0x8d03('0x2c')]);_0x12a3f9[_0x8d03('0x2f')]=_[_0x8d03('0x2e')](_0x241100['model'],qs[_0x8d03('0x30')](_0x2da423['query'][_0x8d03('0x30')]));_0x12a3f9['attributes']=_0x12a3f9[_0x8d03('0x2f')][_0x8d03('0x31')]?_0x12a3f9[_0x8d03('0x2f')]:_0x241100['model'];if(!_0x2da423['query']['hasOwnProperty'](_0x8d03('0x32'))){_0x12a3f9[_0x8d03('0x1a')]=qs['limit'](_0x2da423[_0x8d03('0x2c')]['limit']);_0x12a3f9[_0x8d03('0x1c')]=qs[_0x8d03('0x1c')](_0x2da423['query'][_0x8d03('0x1c')]);}_0x12a3f9[_0x8d03('0x33')]=qs[_0x8d03('0x34')](_0x2da423[_0x8d03('0x2c')]['sort']);_0x12a3f9[_0x8d03('0x35')]=qs[_0x8d03('0x36')](_[_0x8d03('0x37')](_0x2da423['query'],_0x241100['filters']),_0x116eaa);if(_0x2da423[_0x8d03('0x2c')][_0x8d03('0x38')]){_0x12a3f9[_0x8d03('0x35')]=_[_0x8d03('0x39')](_0x12a3f9[_0x8d03('0x35')],{'$or':_[_0x8d03('0x27')](_0x116eaa,function(_0x12bed3){if(_0x12bed3[_0x8d03('0x2a')]!==_0x8d03('0x3a')){var _0x8fa717={};_0x8fa717[_0x12bed3[_0x8d03('0x24')]]={'$like':'%'+_0x2da423[_0x8d03('0x2c')]['filter']+'%'};return _0x8fa717;}})});}_0x12a3f9=_[_0x8d03('0x39')]({},_0x12a3f9,_0x2da423[_0x8d03('0x3b')]);var _0x109cd4={'where':_0x12a3f9[_0x8d03('0x35')]};return db[_0x8d03('0x28')][_0x8d03('0x1b')](_0x109cd4)[_0x8d03('0x21')](function(_0x52273d){_0x11bcb9[_0x8d03('0x1b')]=_0x52273d;if(_0x2da423[_0x8d03('0x2c')][_0x8d03('0x3c')]){_0x12a3f9['include']=[{'all':!![]}];}return db[_0x8d03('0x28')][_0x8d03('0x3d')](_0x12a3f9);})[_0x8d03('0x21')](function(_0xea3685){_0x11bcb9['rows']=_0xea3685;return _0x11bcb9;})[_0x8d03('0x21')](respondWithFilteredResult(_0x397e3b,_0x12a3f9))[_0x8d03('0x3e')](handleError(_0x397e3b,null));};exports[_0x8d03('0x3f')]=function(_0x25c399,_0x262eba){var _0x4725aa={'raw':![],'where':{'id':_0x25c399[_0x8d03('0x40')]['id']}},_0x179437={};_0x179437[_0x8d03('0x2b')]=_['keys'](db[_0x8d03('0x28')][_0x8d03('0x41')]);_0x179437[_0x8d03('0x2c')]=_[_0x8d03('0x2d')](_0x25c399[_0x8d03('0x2c')]);_0x179437[_0x8d03('0x36')]=_[_0x8d03('0x2e')](_0x179437[_0x8d03('0x2b')],_0x179437['query']);_0x4725aa[_0x8d03('0x2f')]=_[_0x8d03('0x2e')](_0x179437[_0x8d03('0x2b')],qs['fields'](_0x25c399[_0x8d03('0x2c')][_0x8d03('0x30')]));_0x4725aa[_0x8d03('0x2f')]=_0x4725aa[_0x8d03('0x2f')][_0x8d03('0x31')]?_0x4725aa['attributes']:_0x179437[_0x8d03('0x2b')];if(_0x25c399[_0x8d03('0x2c')][_0x8d03('0x3c')]){_0x4725aa[_0x8d03('0x42')]=[{'all':!![]}];}_0x4725aa=_['merge']({},_0x4725aa,_0x25c399['options']);return db[_0x8d03('0x28')][_0x8d03('0x43')](_0x4725aa)[_0x8d03('0x21')](handleEntityNotFound(_0x262eba,null))[_0x8d03('0x21')](respondWithResult(_0x262eba,null))[_0x8d03('0x3e')](handleError(_0x262eba,null));};exports[_0x8d03('0x44')]=function(_0x495ddb,_0x5049e7){return db[_0x8d03('0x28')][_0x8d03('0x44')](_0x495ddb['body'],{})['then'](respondWithResult(_0x5049e7,0xc9))['catch'](handleError(_0x5049e7,null));};exports[_0x8d03('0x1f')]=function(_0x4b0cf9,_0x451946){if(_0x4b0cf9['body']['id']){delete _0x4b0cf9[_0x8d03('0x45')]['id'];}return db['FreshsalesAccount'][_0x8d03('0x43')]({'where':{'id':_0x4b0cf9[_0x8d03('0x40')]['id']}})[_0x8d03('0x21')](handleEntityNotFound(_0x451946,null))[_0x8d03('0x21')](saveUpdates(_0x4b0cf9[_0x8d03('0x45')],null))[_0x8d03('0x21')](respondWithResult(_0x451946,null))['catch'](handleError(_0x451946,null));};exports[_0x8d03('0x20')]=function(_0x565a4f,_0x161a46){return db[_0x8d03('0x28')][_0x8d03('0x43')]({'where':{'id':_0x565a4f[_0x8d03('0x40')]['id']}})[_0x8d03('0x21')](handleEntityNotFound(_0x161a46,null))[_0x8d03('0x21')](removeEntity(_0x161a46,null))['catch'](handleError(_0x161a46,null));};exports[_0x8d03('0x46')]=function(_0x3f53c3,_0x138b10,_0x568196){var _0x2cd268={};var _0x16d033={};var _0x4ab28e;var _0x19bb0f;return db['FreshsalesAccount'][_0x8d03('0x47')]({'where':{'id':_0x3f53c3[_0x8d03('0x40')]['id']}})[_0x8d03('0x21')](handleEntityNotFound(_0x138b10,null))[_0x8d03('0x21')](function(_0x1852e7){if(_0x1852e7){_0x4ab28e=_0x1852e7;_0x16d033[_0x8d03('0x2b')]=_['keys'](db[_0x8d03('0x48')][_0x8d03('0x41')]);_0x16d033[_0x8d03('0x2c')]=_[_0x8d03('0x2d')](_0x3f53c3[_0x8d03('0x2c')]);_0x16d033['filters']=_[_0x8d03('0x2e')](_0x16d033['model'],_0x16d033['query']);_0x2cd268['attributes']=_[_0x8d03('0x2e')](_0x16d033[_0x8d03('0x2b')],qs[_0x8d03('0x30')](_0x3f53c3[_0x8d03('0x2c')]['fields']));_0x2cd268[_0x8d03('0x2f')]=_0x2cd268[_0x8d03('0x2f')][_0x8d03('0x31')]?_0x2cd268[_0x8d03('0x2f')]:_0x16d033[_0x8d03('0x2b')];_0x2cd268[_0x8d03('0x33')]=qs[_0x8d03('0x34')](_0x3f53c3['query']['sort']);_0x2cd268['where']=qs[_0x8d03('0x36')](_['pick'](_0x3f53c3[_0x8d03('0x2c')],_0x16d033[_0x8d03('0x36')]));if(_0x3f53c3[_0x8d03('0x2c')][_0x8d03('0x38')]){_0x2cd268[_0x8d03('0x35')]=_[_0x8d03('0x39')](_0x2cd268[_0x8d03('0x35')],{'$or':_[_0x8d03('0x27')](_0x2cd268[_0x8d03('0x2f')],function(_0x2ea402){var _0x2046a0={};_0x2046a0[_0x2ea402]={'$like':'%'+_0x3f53c3[_0x8d03('0x2c')]['filter']+'%'};return _0x2046a0;})});}_0x2cd268=_[_0x8d03('0x39')]({},_0x2cd268,_0x3f53c3[_0x8d03('0x3b')]);return _0x4ab28e[_0x8d03('0x46')](_0x2cd268);}})[_0x8d03('0x21')](function(_0x38ba2c){if(_0x38ba2c){_0x19bb0f=_0x38ba2c[_0x8d03('0x31')];if(!_0x3f53c3['query'][_0x8d03('0x49')](_0x8d03('0x32'))){_0x2cd268[_0x8d03('0x1a')]=qs['limit'](_0x3f53c3[_0x8d03('0x2c')][_0x8d03('0x1a')]);_0x2cd268[_0x8d03('0x1c')]=qs['offset'](_0x3f53c3['query'][_0x8d03('0x1c')]);}return _0x4ab28e[_0x8d03('0x46')](_0x2cd268);}})[_0x8d03('0x21')](function(_0x5f474){if(_0x5f474){return _0x5f474?{'count':_0x19bb0f,'rows':_0x5f474}:null;}})[_0x8d03('0x21')](respondWithResult(_0x138b10,null))[_0x8d03('0x3e')](handleError(_0x138b10,null));};exports['addConfiguration']=function(_0x18ce64,_0x57ac19,_0x539907){if(_0x18ce64[_0x8d03('0x45')]['id']){delete _0x18ce64['body']['id'];}return db[_0x8d03('0x28')][_0x8d03('0x47')]({'where':{'id':_0x18ce64[_0x8d03('0x40')]['id']}})['then'](handleEntityNotFound(_0x57ac19,null))['then'](function(_0x4ff877){if(_0x4ff877){_0x18ce64[_0x8d03('0x45')][_0x8d03('0x4a')]=_0x4ff877['id'];_0x18ce64['body']['Subjects']=integrations[_0x8d03('0x4b')](_0x18ce64[_0x8d03('0x45')][_0x8d03('0x4c')],_0x18ce64[_0x8d03('0x45')]['type']);_0x18ce64[_0x8d03('0x45')][_0x8d03('0x4d')]=integrations[_0x8d03('0x4e')](_0x18ce64[_0x8d03('0x45')][_0x8d03('0x4c')],_0x18ce64[_0x8d03('0x45')][_0x8d03('0x2a')]);return db[_0x8d03('0x48')]['create'](_0x18ce64[_0x8d03('0x45')],{'include':[{'model':db[_0x8d03('0x4f')],'as':_0x8d03('0x50')},{'model':db['FreshsalesField'],'as':_0x8d03('0x4d')}]});}return null;})[_0x8d03('0x21')](respondWithResult(_0x57ac19,null))[_0x8d03('0x3e')](handleError(_0x57ac19,null));};exports[_0x8d03('0x51')]=function(_0x4ae66a,_0x115a91,_0x2f2e38){var _0x30b713='';var _0x2e8b50='';return db[_0x8d03('0x28')][_0x8d03('0x47')]({'where':{'id':_0x4ae66a[_0x8d03('0x40')]['id']},'attributes':['id',_0x8d03('0x52'),_0x8d03('0x53'),_0x8d03('0x54')]})[_0x8d03('0x21')](handleEntityNotFound(_0x115a91,null))[_0x8d03('0x21')](function(_0x269068){if(_0x269068){_0x2e8b50=_0x269068[_0x8d03('0x52')];_0x30b713=_0x269068[_0x8d03('0x53')];var _0x23edac=_0x269068['remoteUri'][_0x8d03('0x55')](-0x1);if(_0x23edac==='/'){_0x30b713=_0x30b713[_0x8d03('0x56')](0x0,_0x30b713['lastIndexOf'](_0x23edac));}return rp({'method':_0x8d03('0x57'),'uri':util[_0x8d03('0x58')]('%s%s',_0x30b713,'/api/selector/owners'),'headers':{'Authorization':_0x8d03('0x59')+_0x269068['apiKey']},'json':!![]});}})[_0x8d03('0x21')](function(_0xd96162){if(_0xd96162){var _0x17b304=_0xd96162['users'];var _0x43b158=![];var _0x5e448b=null;for(_0x5e448b=0x0;_0x5e448b<_0x17b304[_0x8d03('0x31')];_0x5e448b++){if(_0x17b304[_0x5e448b][_0x8d03('0x5a')]===_0x2e8b50){_0x43b158=!![];}}if(_0x43b158){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8d03('0x21')](respondWithResult(_0x115a91,null))[_0x8d03('0x3e')](function(_0x46c6e4){var _0x3941d6=_0x4ae66a[_0x8d03('0x2c')]['test']?0x1f4:_0x46c6e4[_0x8d03('0x5b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8d03('0x51'),_0x3941d6,JSON[_0x8d03('0x5c')](_0x46c6e4));delete _0x46c6e4['name'];if(_0x3941d6===0x191){_0x3941d6=0x190;}_0x115a91[_0x8d03('0x17')](_0x3941d6)[_0x8d03('0x25')](_0x4ae66a[_0x8d03('0x2c')][_0x8d03('0x5d')]?{'message':'Wrong\x20credentials','statusCode':_0x46c6e4[_0x8d03('0x5b')]}:_0x46c6e4);});}; \ No newline at end of file +var _0xabe5=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','pick','options','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','type','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','error','stringify','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0xabe5,0xc2));var _0x5abe=function(_0x4b2a00,_0x1692fc){_0x4b2a00=_0x4b2a00-0x0;var _0x5b692b=_0xabe5[_0x4b2a00];return _0x5b692b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5abe('0x0'));var zipdir=require(_0x5abe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5abe('0x2'));var moment=require(_0x5abe('0x3'));var BPromise=require(_0x5abe('0x4'));var Mustache=require(_0x5abe('0x5'));var util=require(_0x5abe('0x6'));var path=require(_0x5abe('0x7'));var sox=require(_0x5abe('0x8'));var csv=require(_0x5abe('0x9'));var ejs=require(_0x5abe('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5abe('0xb'));var squel=require(_0x5abe('0xc'));var crypto=require(_0x5abe('0xd'));var jsforce=require(_0x5abe('0xe'));var deskjs=require(_0x5abe('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5abe('0x10'));var Papa=require(_0x5abe('0x11'));var Redis=require(_0x5abe('0x12'));var authService=require(_0x5abe('0x13'));var qs=require(_0x5abe('0x14'));var as=require(_0x5abe('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5abe('0x16'));var utils=require(_0x5abe('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5abe('0x18'));var db=require(_0x5abe('0x19'))['db'];var integrations=require(_0x5abe('0x1a'));function respondWithStatusCode(_0x4762c5,_0x383584){_0x383584=_0x383584||0xcc;return function(_0x145c72){if(_0x145c72){return _0x4762c5[_0x5abe('0x1b')](_0x383584);}return _0x4762c5[_0x5abe('0x1c')](_0x383584)[_0x5abe('0x1d')]();};}function respondWithResult(_0x4b8386,_0x1c8cc3){_0x1c8cc3=_0x1c8cc3||0xc8;return function(_0x4a1be2){if(_0x4a1be2){return _0x4b8386[_0x5abe('0x1c')](_0x1c8cc3)[_0x5abe('0x1e')](_0x4a1be2);}};}function respondWithFilteredResult(_0x338b11,_0x46305b){return function(_0x509ed7){if(_0x509ed7){var _0x12d8e1=typeof _0x46305b[_0x5abe('0x1f')]===_0x5abe('0x20')&&typeof _0x46305b['limit']===_0x5abe('0x20');var _0x6d2284=_0x509ed7[_0x5abe('0x21')];var _0x5a9200=_0x12d8e1?0x0:_0x46305b[_0x5abe('0x1f')];var _0x319dac=_0x12d8e1?_0x509ed7[_0x5abe('0x21')]:_0x46305b['offset']+_0x46305b['limit'];var _0x2d3eca;if(_0x319dac>=_0x6d2284){_0x319dac=_0x6d2284;_0x2d3eca=0xc8;}else{_0x2d3eca=0xce;}_0x338b11[_0x5abe('0x1c')](_0x2d3eca);return _0x338b11[_0x5abe('0x22')]('Content-Range',_0x5a9200+'-'+_0x319dac+'/'+_0x6d2284)['json'](_0x509ed7);}return null;};}function patchUpdates(_0x59213d){return function(_0x2c6e08){try{jsonpatch[_0x5abe('0x23')](_0x2c6e08,_0x59213d,!![]);}catch(_0x5dd252){return BPromise[_0x5abe('0x24')](_0x5dd252);}return _0x2c6e08[_0x5abe('0x25')]();};}function saveUpdates(_0x4969a2,_0x5c1de0){return function(_0x18547d){if(_0x18547d){return _0x18547d['update'](_0x4969a2)[_0x5abe('0x26')](function(_0x20a02b){return _0x20a02b;});}return null;};}function removeEntity(_0x4993d4,_0x3bda8a){return function(_0x3f837d){if(_0x3f837d){return _0x3f837d['destroy']()[_0x5abe('0x26')](function(){_0x4993d4[_0x5abe('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14b57d,_0x250a37){return function(_0x167261){if(!_0x167261){_0x14b57d[_0x5abe('0x1b')](0x194);}return _0x167261;};}function handleError(_0x4d8f31,_0x38847c){_0x38847c=_0x38847c||0x1f4;return function(_0x2a6d07){logger['error'](_0x2a6d07[_0x5abe('0x27')]);if(_0x2a6d07[_0x5abe('0x28')]){delete _0x2a6d07[_0x5abe('0x28')];}_0x4d8f31[_0x5abe('0x1c')](_0x38847c)[_0x5abe('0x29')](_0x2a6d07);};}exports[_0x5abe('0x2a')]=function(_0x421fe1,_0x7d6e61){var _0x18477a={},_0x27062b={},_0x31994d={'count':0x0,'rows':[]};var _0x41ea19=_[_0x5abe('0x2b')](db[_0x5abe('0x2c')][_0x5abe('0x2d')],function(_0x73d8){return{'name':_0x73d8[_0x5abe('0x2e')],'type':_0x73d8['type'][_0x5abe('0x2f')]};});_0x27062b[_0x5abe('0x30')]=_['map'](_0x41ea19,_0x5abe('0x28'));_0x27062b[_0x5abe('0x31')]=_[_0x5abe('0x32')](_0x421fe1['query']);_0x27062b[_0x5abe('0x33')]=_[_0x5abe('0x34')](_0x27062b[_0x5abe('0x30')],_0x27062b['query']);_0x18477a[_0x5abe('0x35')]=_[_0x5abe('0x34')](_0x27062b[_0x5abe('0x30')],qs[_0x5abe('0x36')](_0x421fe1[_0x5abe('0x31')][_0x5abe('0x36')]));_0x18477a[_0x5abe('0x35')]=_0x18477a[_0x5abe('0x35')][_0x5abe('0x37')]?_0x18477a[_0x5abe('0x35')]:_0x27062b[_0x5abe('0x30')];if(!_0x421fe1[_0x5abe('0x31')]['hasOwnProperty']('nolimit')){_0x18477a[_0x5abe('0x38')]=qs['limit'](_0x421fe1[_0x5abe('0x31')][_0x5abe('0x38')]);_0x18477a[_0x5abe('0x1f')]=qs[_0x5abe('0x1f')](_0x421fe1[_0x5abe('0x31')]['offset']);}_0x18477a[_0x5abe('0x39')]=qs[_0x5abe('0x3a')](_0x421fe1[_0x5abe('0x31')][_0x5abe('0x3a')]);_0x18477a[_0x5abe('0x3b')]=qs[_0x5abe('0x33')](_['pick'](_0x421fe1[_0x5abe('0x31')],_0x27062b[_0x5abe('0x33')]),_0x41ea19);if(_0x421fe1[_0x5abe('0x31')][_0x5abe('0x3c')]){_0x18477a[_0x5abe('0x3b')]=_['merge'](_0x18477a[_0x5abe('0x3b')],{'$or':_['map'](_0x41ea19,function(_0x567b2e){if(_0x567b2e['type']!==_0x5abe('0x3d')){var _0x5c24d4={};_0x5c24d4[_0x567b2e[_0x5abe('0x28')]]={'$like':'%'+_0x421fe1[_0x5abe('0x31')][_0x5abe('0x3c')]+'%'};return _0x5c24d4;}})});}_0x18477a=_[_0x5abe('0x3e')]({},_0x18477a,_0x421fe1['options']);var _0x9007c9={'where':_0x18477a[_0x5abe('0x3b')]};return db[_0x5abe('0x2c')][_0x5abe('0x21')](_0x9007c9)[_0x5abe('0x26')](function(_0x4fd83e){_0x31994d[_0x5abe('0x21')]=_0x4fd83e;if(_0x421fe1[_0x5abe('0x31')][_0x5abe('0x3f')]){_0x18477a[_0x5abe('0x40')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x5abe('0x41')](_0x18477a);})['then'](function(_0x4c65e5){_0x31994d['rows']=_0x4c65e5;return _0x31994d;})[_0x5abe('0x26')](respondWithFilteredResult(_0x7d6e61,_0x18477a))[_0x5abe('0x42')](handleError(_0x7d6e61,null));};exports[_0x5abe('0x43')]=function(_0x2748f4,_0x1970af){var _0x249fdb={'raw':![],'where':{'id':_0x2748f4[_0x5abe('0x44')]['id']}},_0x48af78={};_0x48af78[_0x5abe('0x30')]=_[_0x5abe('0x32')](db[_0x5abe('0x2c')][_0x5abe('0x2d')]);_0x48af78[_0x5abe('0x31')]=_[_0x5abe('0x32')](_0x2748f4[_0x5abe('0x31')]);_0x48af78['filters']=_[_0x5abe('0x34')](_0x48af78[_0x5abe('0x30')],_0x48af78[_0x5abe('0x31')]);_0x249fdb[_0x5abe('0x35')]=_[_0x5abe('0x34')](_0x48af78[_0x5abe('0x30')],qs[_0x5abe('0x36')](_0x2748f4[_0x5abe('0x31')][_0x5abe('0x36')]));_0x249fdb[_0x5abe('0x35')]=_0x249fdb['attributes'][_0x5abe('0x37')]?_0x249fdb[_0x5abe('0x35')]:_0x48af78['model'];if(_0x2748f4[_0x5abe('0x31')][_0x5abe('0x3f')]){_0x249fdb[_0x5abe('0x40')]=[{'all':!![]}];}_0x249fdb=_['merge']({},_0x249fdb,_0x2748f4['options']);return db[_0x5abe('0x2c')][_0x5abe('0x45')](_0x249fdb)['then'](handleEntityNotFound(_0x1970af,null))['then'](respondWithResult(_0x1970af,null))[_0x5abe('0x42')](handleError(_0x1970af,null));};exports[_0x5abe('0x46')]=function(_0xfd2ed4,_0x19b5f8){return db[_0x5abe('0x2c')][_0x5abe('0x46')](_0xfd2ed4[_0x5abe('0x47')],{})[_0x5abe('0x26')](respondWithResult(_0x19b5f8,0xc9))['catch'](handleError(_0x19b5f8,null));};exports[_0x5abe('0x48')]=function(_0x44fe47,_0x3cfff1){if(_0x44fe47[_0x5abe('0x47')]['id']){delete _0x44fe47[_0x5abe('0x47')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x44fe47[_0x5abe('0x44')]['id']}})[_0x5abe('0x26')](handleEntityNotFound(_0x3cfff1,null))[_0x5abe('0x26')](saveUpdates(_0x44fe47[_0x5abe('0x47')],null))[_0x5abe('0x26')](respondWithResult(_0x3cfff1,null))[_0x5abe('0x42')](handleError(_0x3cfff1,null));};exports['destroy']=function(_0x413330,_0x456b93){return db[_0x5abe('0x2c')][_0x5abe('0x45')]({'where':{'id':_0x413330[_0x5abe('0x44')]['id']}})['then'](handleEntityNotFound(_0x456b93,null))['then'](removeEntity(_0x456b93,null))[_0x5abe('0x42')](handleError(_0x456b93,null));};exports[_0x5abe('0x49')]=function(_0x2f6d35,_0x282480,_0x25a17e){var _0x4306c2={};var _0x185329={};var _0x5de34b;var _0x5225ba;return db['FreshsalesAccount'][_0x5abe('0x4a')]({'where':{'id':_0x2f6d35[_0x5abe('0x44')]['id']}})[_0x5abe('0x26')](handleEntityNotFound(_0x282480,null))['then'](function(_0x2d564a){if(_0x2d564a){_0x5de34b=_0x2d564a;_0x185329[_0x5abe('0x30')]=_[_0x5abe('0x32')](db[_0x5abe('0x4b')]['rawAttributes']);_0x185329[_0x5abe('0x31')]=_[_0x5abe('0x32')](_0x2f6d35[_0x5abe('0x31')]);_0x185329[_0x5abe('0x33')]=_['intersection'](_0x185329[_0x5abe('0x30')],_0x185329[_0x5abe('0x31')]);_0x4306c2['attributes']=_[_0x5abe('0x34')](_0x185329['model'],qs[_0x5abe('0x36')](_0x2f6d35[_0x5abe('0x31')][_0x5abe('0x36')]));_0x4306c2['attributes']=_0x4306c2[_0x5abe('0x35')][_0x5abe('0x37')]?_0x4306c2[_0x5abe('0x35')]:_0x185329[_0x5abe('0x30')];_0x4306c2[_0x5abe('0x39')]=qs[_0x5abe('0x3a')](_0x2f6d35[_0x5abe('0x31')][_0x5abe('0x3a')]);_0x4306c2[_0x5abe('0x3b')]=qs[_0x5abe('0x33')](_[_0x5abe('0x4c')](_0x2f6d35[_0x5abe('0x31')],_0x185329[_0x5abe('0x33')]));if(_0x2f6d35['query'][_0x5abe('0x3c')]){_0x4306c2[_0x5abe('0x3b')]=_[_0x5abe('0x3e')](_0x4306c2['where'],{'$or':_['map'](_0x4306c2[_0x5abe('0x35')],function(_0x144754){var _0x8a64f4={};_0x8a64f4[_0x144754]={'$like':'%'+_0x2f6d35['query']['filter']+'%'};return _0x8a64f4;})});}_0x4306c2=_[_0x5abe('0x3e')]({},_0x4306c2,_0x2f6d35[_0x5abe('0x4d')]);return _0x5de34b[_0x5abe('0x49')](_0x4306c2);}})[_0x5abe('0x26')](function(_0x2a38db){if(_0x2a38db){_0x5225ba=_0x2a38db['length'];if(!_0x2f6d35['query'][_0x5abe('0x4e')]('nolimit')){_0x4306c2[_0x5abe('0x38')]=qs[_0x5abe('0x38')](_0x2f6d35[_0x5abe('0x31')][_0x5abe('0x38')]);_0x4306c2[_0x5abe('0x1f')]=qs['offset'](_0x2f6d35['query'][_0x5abe('0x1f')]);}return _0x5de34b['getConfigurations'](_0x4306c2);}})['then'](function(_0x4a1360){if(_0x4a1360){return _0x4a1360?{'count':_0x5225ba,'rows':_0x4a1360}:null;}})[_0x5abe('0x26')](respondWithResult(_0x282480,null))[_0x5abe('0x42')](handleError(_0x282480,null));};exports[_0x5abe('0x4f')]=function(_0x59f4d1,_0xbdaa3d,_0x14bb7c){if(_0x59f4d1[_0x5abe('0x47')]['id']){delete _0x59f4d1[_0x5abe('0x47')]['id'];}return db['FreshsalesAccount'][_0x5abe('0x4a')]({'where':{'id':_0x59f4d1[_0x5abe('0x44')]['id']}})['then'](handleEntityNotFound(_0xbdaa3d,null))['then'](function(_0x1a27a6){if(_0x1a27a6){_0x59f4d1[_0x5abe('0x47')][_0x5abe('0x50')]=_0x1a27a6['id'];_0x59f4d1[_0x5abe('0x47')][_0x5abe('0x51')]=integrations[_0x5abe('0x52')](_0x59f4d1['body'][_0x5abe('0x53')],_0x59f4d1[_0x5abe('0x47')][_0x5abe('0x54')]);_0x59f4d1[_0x5abe('0x47')]['Descriptions']=integrations['getDescriptions'](_0x59f4d1[_0x5abe('0x47')]['channel'],_0x59f4d1[_0x5abe('0x47')]['type']);return db[_0x5abe('0x4b')][_0x5abe('0x46')](_0x59f4d1[_0x5abe('0x47')],{'include':[{'model':db[_0x5abe('0x55')],'as':_0x5abe('0x51')},{'model':db[_0x5abe('0x55')],'as':_0x5abe('0x56')}]});}return null;})[_0x5abe('0x26')](respondWithResult(_0xbdaa3d,null))[_0x5abe('0x42')](handleError(_0xbdaa3d,null));};exports[_0x5abe('0x57')]=function(_0xee5655,_0x13e8d1,_0x4c1f4a){var _0x47b03c='';var _0x336640='';return db[_0x5abe('0x2c')][_0x5abe('0x4a')]({'where':{'id':_0xee5655[_0x5abe('0x44')]['id']},'attributes':['id',_0x5abe('0x58'),_0x5abe('0x59'),_0x5abe('0x5a')]})[_0x5abe('0x26')](handleEntityNotFound(_0x13e8d1,null))[_0x5abe('0x26')](function(_0x7522c6){if(_0x7522c6){_0x336640=_0x7522c6['username'];_0x47b03c=_0x7522c6['remoteUri'];var _0x14ea74=_0x7522c6[_0x5abe('0x59')][_0x5abe('0x5b')](-0x1);if(_0x14ea74==='/'){_0x47b03c=_0x47b03c['substring'](0x0,_0x47b03c[_0x5abe('0x5c')](_0x14ea74));}return rp({'method':_0x5abe('0x5d'),'uri':util[_0x5abe('0x5e')](_0x5abe('0x5f'),_0x47b03c,'/api/selector/owners'),'headers':{'Authorization':_0x5abe('0x60')+_0x7522c6['apiKey']},'json':!![]});}})['then'](function(_0x5e55e1){if(_0x5e55e1){var _0x3ba618=_0x5e55e1[_0x5abe('0x61')];var _0x30f9c1=![];var _0x2bcf39=null;for(_0x2bcf39=0x0;_0x2bcf39<_0x3ba618[_0x5abe('0x37')];_0x2bcf39++){if(_0x3ba618[_0x2bcf39][_0x5abe('0x62')]===_0x336640){_0x30f9c1=!![];}}if(_0x30f9c1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5abe('0x63')});}}})['then'](respondWithResult(_0x13e8d1,null))['catch'](function(_0x3e2ac5){var _0x1c12da=_0xee5655[_0x5abe('0x31')]['test']?0x1f4:_0x3e2ac5['statusCode']||0x1f4;logger[_0x5abe('0x64')]('getFields,\x20%s,\x20%s,\x20%s',_0x5abe('0x57'),_0x1c12da,JSON[_0x5abe('0x65')](_0x3e2ac5));delete _0x3e2ac5[_0x5abe('0x28')];if(_0x1c12da===0x191){_0x1c12da=0x190;}_0x13e8d1[_0x5abe('0x1c')](_0x1c12da)['send'](_0xee5655[_0x5abe('0x31')][_0x5abe('0x66')]?{'message':_0x5abe('0x67'),'statusCode':_0x3e2ac5[_0x5abe('0x68')]}:_0x3e2ac5);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f6c8351..483d0b9 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x1a37,0xb4));var _0x71a3=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x1a37[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x71a3('0xa'));module['exports']=function(_0xd09f7,_0x45050a){return _0xd09f7[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0xfcf0[_0x1562a2];return _0x39a636;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));var integrations=require(_0x0fcf('0x9'));module[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return _0x1a7b03[_0x0fcf('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x0fcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index be3b122..efa7159 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 _0x0598=['map','model','then','ShowFreshsalesAccount','find','where','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include'];(function(_0x574632,_0x3a9b4d){var _0x1c4b34=function(_0x33fecc){while(--_0x33fecc){_0x574632['push'](_0x574632['shift']());}};_0x1c4b34(++_0x3a9b4d);}(_0x0598,0x92));var _0x8059=function(_0x5a3658,_0x5d7a85){_0x5a3658=_0x5a3658-0x0;var _0x1498b8=_0x0598[_0x5a3658];return _0x1498b8;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['findAll']({'raw':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55['options'][_0x8059('0x12')]===undefined?!![]:![]:!![],'where':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x11')]['where']||null:null,'attributes':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55[_0x8059('0x11')][_0x8059('0x13')]||null:null,'limit':_0x4b6d55['options']?_0x4b6d55['options'][_0x8059('0x14')]||null:null,'include':_0x4b6d55[_0x8059('0x11')]?_0x4b6d55[_0x8059('0x11')][_0x8059('0x15')]?_['map'](_0x4b6d55[_0x8059('0x11')][_0x8059('0x15')],function(_0x3da080){return{'model':db[_0x3da080['model']],'as':_0x3da080['as'],'attributes':_0x3da080[_0x8059('0x13')],'include':_0x3da080[_0x8059('0x15')]?_[_0x8059('0x16')](_0x3da080[_0x8059('0x15')],function(_0x59d3a6){return{'model':db[_0x59d3a6[_0x8059('0x17')]],'as':_0x59d3a6['as'],'attributes':_0x59d3a6[_0x8059('0x13')],'include':_0x59d3a6[_0x8059('0x15')]?_[_0x8059('0x16')](_0x59d3a6[_0x8059('0x15')],function(_0x54b88b){return{'model':db[_0x54b88b[_0x8059('0x17')]],'as':_0x54b88b['as'],'attributes':_0x54b88b[_0x8059('0x13')]};}):[]};}):[]};}):[]:[]})[_0x8059('0x18')](function(_0x4a294f){logger['info']('GetFreshsalesAccount',_0x4b6d55);logger[_0x8059('0xa')](_0x8059('0xf'),_0x4b6d55,JSON[_0x8059('0xb')](_0x4a294f));_0x2bb670(_0x4a294f);})[_0x8059('0xe')](function(_0x59abe9){logger[_0x8059('0xc')]('GetFreshsalesAccount',_0x59abe9[_0x8059('0xd')],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x59abe9['message']));});});};exports[_0x8059('0x19')]=function(_0x1aead2){var _0x30aac2=this;return new Promise(function(_0x260ba8,_0x2799b7){return db[_0x8059('0x10')][_0x8059('0x1a')]({'raw':_0x1aead2[_0x8059('0x11')]?_0x1aead2['options'][_0x8059('0x12')]===undefined?!![]:![]:!![],'where':_0x1aead2[_0x8059('0x11')]?_0x1aead2[_0x8059('0x11')][_0x8059('0x1b')]||null:null,'attributes':_0x1aead2[_0x8059('0x11')]?_0x1aead2['options'][_0x8059('0x13')]||null:null,'include':_0x1aead2[_0x8059('0x11')]?_0x1aead2[_0x8059('0x11')][_0x8059('0x15')]?_[_0x8059('0x16')](_0x1aead2[_0x8059('0x11')][_0x8059('0x15')],function(_0x175d57){return{'model':db[_0x175d57[_0x8059('0x17')]],'as':_0x175d57['as'],'attributes':_0x175d57[_0x8059('0x13')],'include':_0x175d57['include']?_[_0x8059('0x16')](_0x175d57['include'],function(_0x24194d){return{'model':db[_0x24194d['model']],'as':_0x24194d['as'],'attributes':_0x24194d['attributes'],'include':_0x24194d[_0x8059('0x15')]?_['map'](_0x24194d[_0x8059('0x15')],function(_0x50c745){return{'model':db[_0x50c745[_0x8059('0x17')]],'as':_0x50c745['as'],'attributes':_0x50c745['attributes']};}):[]};}):[]};}):[]:[]})[_0x8059('0x18')](function(_0x5c4aa0){logger['info'](_0x8059('0x19'),_0x1aead2);logger[_0x8059('0xa')](_0x8059('0x19'),_0x1aead2,JSON['stringify'](_0x5c4aa0));_0x260ba8(_0x5c4aa0);})[_0x8059('0xe')](function(_0x4927c9){logger[_0x8059('0xc')]('ShowFreshsalesAccount',_0x4927c9[_0x8059('0xd')],_0x1aead2);_0x2799b7(_0x30aac2[_0x8059('0xc')](0x1f4,_0x4927c9[_0x8059('0xd')]));});});}; \ No newline at end of file +var _0x187d=['error','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','include','model','find','where','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x217603,_0x56a7da){var _0x3d8891=function(_0x14c664){while(--_0x14c664){_0x217603['push'](_0x217603['shift']());}};_0x3d8891(++_0x56a7da);}(_0x187d,0x93));var _0xd187=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x187d[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});}exports[_0xd187('0x15')]=function(_0x374fe0){var _0x10d9fd=this;return new Promise(function(_0x21df74,_0x253a7e){return db[_0xd187('0x16')][_0xd187('0x17')]({'raw':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![],'where':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')]['where']||null:null,'attributes':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'limit':_0x374fe0['options']?_0x374fe0['options']['limit']||null:null,'include':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x1b')]?_['map'](_0x374fe0[_0xd187('0x18')]['include'],function(_0x145771){return{'model':db[_0x145771['model']],'as':_0x145771['as'],'attributes':_0x145771[_0xd187('0x1a')],'include':_0x145771['include']?_['map'](_0x145771[_0xd187('0x1b')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x1c')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1a')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x1b')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x1c')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a20ed){logger[_0xd187('0xc')]('GetFreshsalesAccount',_0x374fe0);logger[_0xd187('0xf')](_0xd187('0x15'),_0x374fe0,JSON[_0xd187('0x11')](_0x2a20ed));_0x21df74(_0x2a20ed);})['catch'](function(_0x15e2e8){logger['error'](_0xd187('0x15'),_0x15e2e8[_0xd187('0x13')],_0x374fe0);_0x253a7e(_0x10d9fd[_0xd187('0x12')](0x1f4,_0x15e2e8[_0xd187('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x140e54){var _0xb38778=this;return new Promise(function(_0x5bba10,_0x4cc587){return db[_0xd187('0x16')][_0xd187('0x1d')]({'raw':_0x140e54[_0xd187('0x18')]?_0x140e54[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![],'where':_0x140e54[_0xd187('0x18')]?_0x140e54[_0xd187('0x18')][_0xd187('0x1e')]||null:null,'attributes':_0x140e54['options']?_0x140e54[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'include':_0x140e54[_0xd187('0x18')]?_0x140e54['options'][_0xd187('0x1b')]?_['map'](_0x140e54[_0xd187('0x18')][_0xd187('0x1b')],function(_0xf5b94e){return{'model':db[_0xf5b94e['model']],'as':_0xf5b94e['as'],'attributes':_0xf5b94e['attributes'],'include':_0xf5b94e[_0xd187('0x1b')]?_[_0xd187('0x1f')](_0xf5b94e['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x1c')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1a')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x1b')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31d7f4){logger['info'](_0xd187('0x20'),_0x140e54);logger[_0xd187('0xf')]('ShowFreshsalesAccount',_0x140e54,JSON[_0xd187('0x11')](_0x31d7f4));_0x5bba10(_0x31d7f4);})['catch'](function(_0x293ce9){logger[_0xd187('0x12')]('ShowFreshsalesAccount',_0x293ce9[_0xd187('0x13')],_0x140e54);_0x4cc587(_0xb38778[_0xd187('0x12')](0x1f4,_0x293ce9['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a2c50d4..fb6b3fa 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 _0x92ff=['create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','getSubjects','/:id/descriptions','/:id/fields','getFields','post'];(function(_0x124142,_0x1723a6){var _0x175d8d=function(_0x33acc2){while(--_0x33acc2){_0x124142['push'](_0x124142['shift']());}};_0x175d8d(++_0x1723a6);}(_0x92ff,0x9f));var _0xf92f=function(_0x51926c,_0x4c7ffe){_0x51926c=_0x51926c-0x0;var _0x2034ca=_0x92ff[_0x51926c];return _0x2034ca;};'use strict';var multer=require('multer');var util=require(_0xf92f('0x0'));var path=require(_0xf92f('0x1'));var timeout=require(_0xf92f('0x2'));var express=require(_0xf92f('0x3'));var router=express['Router']();var fs_extra=require(_0xf92f('0x4'));var auth=require(_0xf92f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf92f('0x6'));var controller=require(_0xf92f('0x7'));router[_0xf92f('0x8')]('/',auth[_0xf92f('0x9')](),controller['index']);router[_0xf92f('0x8')](_0xf92f('0xa'),auth[_0xf92f('0x9')](),controller[_0xf92f('0xb')]);router[_0xf92f('0x8')]('/:id/subjects',auth[_0xf92f('0x9')](),controller[_0xf92f('0xc')]);router[_0xf92f('0x8')](_0xf92f('0xd'),auth[_0xf92f('0x9')](),controller['getDescriptions']);router[_0xf92f('0x8')](_0xf92f('0xe'),auth['isAuthenticated'](),controller[_0xf92f('0xf')]);router[_0xf92f('0x10')]('/',auth[_0xf92f('0x9')](),controller[_0xf92f('0x11')]);router[_0xf92f('0x12')](_0xf92f('0xa'),auth[_0xf92f('0x9')](),controller['update']);router[_0xf92f('0x13')](_0xf92f('0xa'),auth[_0xf92f('0x9')](),controller[_0xf92f('0x14')]);module[_0xf92f('0x15')]=router; \ No newline at end of file +var _0xbe5a=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create'];(function(_0x8de415,_0x797f23){var _0x46b8fa=function(_0x3071a7){while(--_0x3071a7){_0x8de415['push'](_0x8de415['shift']());}};_0x46b8fa(++_0x797f23);}(_0xbe5a,0x130));var _0xabe5=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xbe5a[_0xd1c39b];return _0x58f5bc;};'use strict';var multer=require(_0xabe5('0x0'));var util=require(_0xabe5('0x1'));var path=require(_0xabe5('0x2'));var timeout=require(_0xabe5('0x3'));var express=require(_0xabe5('0x4'));var router=express[_0xabe5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xabe5('0x6'));var interaction=require(_0xabe5('0x7'));var config=require(_0xabe5('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xabe5('0x9')]('/',auth[_0xabe5('0xa')](),controller[_0xabe5('0xb')]);router['get'](_0xabe5('0xc'),auth[_0xabe5('0xa')](),controller[_0xabe5('0xd')]);router[_0xabe5('0x9')](_0xabe5('0xe'),auth[_0xabe5('0xa')](),controller[_0xabe5('0xf')]);router[_0xabe5('0x9')](_0xabe5('0x10'),auth[_0xabe5('0xa')](),controller['getDescriptions']);router[_0xabe5('0x9')](_0xabe5('0x11'),auth[_0xabe5('0xa')](),controller[_0xabe5('0x12')]);router[_0xabe5('0x13')]('/',auth[_0xabe5('0xa')](),controller[_0xabe5('0x14')]);router[_0xabe5('0x15')]('/:id',auth[_0xabe5('0xa')](),controller[_0xabe5('0x16')]);router[_0xabe5('0x17')](_0xabe5('0xc'),auth[_0xabe5('0xa')](),controller['destroy']);module[_0xabe5('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 65c0bc9..2f665dc 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 _0x23be=['STRING','sequelize'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0x23be,0xad));var _0xe23b=function(_0x3e1c59,_0x4eff25){_0x3e1c59=_0x3e1c59-0x0;var _0x42e558=_0x23be[_0x3e1c59];return _0x42e558;};'use strict';var Sequelize=require(_0xe23b('0x0'));module['exports']={'name':{'type':Sequelize[_0xe23b('0x1')]},'description':{'type':Sequelize[_0xe23b('0x1')]}}; \ No newline at end of file +var _0x9104=['STRING'];(function(_0x4f2a47,_0x5e2086){var _0xa5460d=function(_0x2f2be0){while(--_0x2f2be0){_0x4f2a47['push'](_0x4f2a47['shift']());}};_0xa5460d(++_0x5e2086);}(_0x9104,0x121));var _0x4910=function(_0x230202,_0x371c32){_0x230202=_0x230202-0x0;var _0x522289=_0x9104[_0x230202];return _0x522289;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4910('0x0')]},'description':{'type':Sequelize[_0x4910('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 46ea32e..ceeed84 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 _0xc9b8=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','FreshsalesConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','options','find','create','body','params','getSubjects','FreshsalesField','order','sort','getDescriptions','findOne','filter','getFields','rimraf'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc9b8,0x1eb));var _0x8c9b=function(_0xa1e7d7,_0x5714bb){_0xa1e7d7=_0xa1e7d7-0x0;var _0x287bee=_0xc9b8[_0xa1e7d7];return _0x287bee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c9b('0x0'));var zipdir=require(_0x8c9b('0x1'));var jsonpatch=require(_0x8c9b('0x2'));var rp=require(_0x8c9b('0x3'));var moment=require(_0x8c9b('0x4'));var BPromise=require(_0x8c9b('0x5'));var Mustache=require(_0x8c9b('0x6'));var util=require('util');var path=require(_0x8c9b('0x7'));var sox=require('sox');var csv=require(_0x8c9b('0x8'));var ejs=require(_0x8c9b('0x9'));var fs=require('fs');var fs_extra=require(_0x8c9b('0xa'));var _=require(_0x8c9b('0xb'));var squel=require(_0x8c9b('0xc'));var crypto=require(_0x8c9b('0xd'));var jsforce=require(_0x8c9b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8c9b('0x8'));var querystring=require(_0x8c9b('0xf'));var Papa=require(_0x8c9b('0x10'));var Redis=require(_0x8c9b('0x11'));var authService=require(_0x8c9b('0x12'));var qs=require(_0x8c9b('0x13'));var as=require(_0x8c9b('0x14'));var hardwareService=require(_0x8c9b('0x15'));var logger=require(_0x8c9b('0x16'))(_0x8c9b('0x17'));var utils=require(_0x8c9b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8c9b('0x19'))['db'];function respondWithStatusCode(_0x102735,_0x3d523d){_0x3d523d=_0x3d523d||0xcc;return function(_0x1cb0b1){if(_0x1cb0b1){return _0x102735[_0x8c9b('0x1a')](_0x3d523d);}return _0x102735[_0x8c9b('0x1b')](_0x3d523d)[_0x8c9b('0x1c')]();};}function respondWithResult(_0x54c161,_0x37e324){_0x37e324=_0x37e324||0xc8;return function(_0x54cff1){if(_0x54cff1){return _0x54c161[_0x8c9b('0x1b')](_0x37e324)[_0x8c9b('0x1d')](_0x54cff1);}};}function respondWithFilteredResult(_0x1e5999,_0x46bf25){return function(_0x58b00a){if(_0x58b00a){var _0x2484dd=typeof _0x46bf25[_0x8c9b('0x1e')]===_0x8c9b('0x1f')&&typeof _0x46bf25['limit']==='undefined';var _0x33b751=_0x58b00a[_0x8c9b('0x20')];var _0xe83e1d=_0x2484dd?0x0:_0x46bf25[_0x8c9b('0x1e')];var _0x361088=_0x2484dd?_0x58b00a[_0x8c9b('0x20')]:_0x46bf25[_0x8c9b('0x1e')]+_0x46bf25['limit'];var _0xcb06f8;if(_0x361088>=_0x33b751){_0x361088=_0x33b751;_0xcb06f8=0xc8;}else{_0xcb06f8=0xce;}_0x1e5999[_0x8c9b('0x1b')](_0xcb06f8);return _0x1e5999[_0x8c9b('0x21')](_0x8c9b('0x22'),_0xe83e1d+'-'+_0x361088+'/'+_0x33b751)[_0x8c9b('0x1d')](_0x58b00a);}return null;};}function patchUpdates(_0x21c7f4){return function(_0x24e9ef){try{jsonpatch[_0x8c9b('0x23')](_0x24e9ef,_0x21c7f4,!![]);}catch(_0x212e5b){return BPromise[_0x8c9b('0x24')](_0x212e5b);}return _0x24e9ef[_0x8c9b('0x25')]();};}function saveUpdates(_0x32bb29,_0x38423c){return function(_0x1385c9){if(_0x1385c9){return _0x1385c9[_0x8c9b('0x26')](_0x32bb29)[_0x8c9b('0x27')](function(_0xb06ebb){return _0xb06ebb;});}return null;};}function removeEntity(_0x28dc9e,_0x4da2df){return function(_0x27509b){if(_0x27509b){return _0x27509b[_0x8c9b('0x28')]()[_0x8c9b('0x27')](function(){_0x28dc9e['status'](0xcc)[_0x8c9b('0x1c')]();});}};}function handleEntityNotFound(_0x457146,_0x21d0d6){return function(_0x15b163){if(!_0x15b163){_0x457146['sendStatus'](0x194);}return _0x15b163;};}function handleError(_0x2a00c8,_0x864a50){_0x864a50=_0x864a50||0x1f4;return function(_0x31e596){logger[_0x8c9b('0x29')](_0x31e596[_0x8c9b('0x2a')]);if(_0x31e596[_0x8c9b('0x2b')]){delete _0x31e596[_0x8c9b('0x2b')];}_0x2a00c8[_0x8c9b('0x1b')](_0x864a50)['send'](_0x31e596);};}exports['index']=function(_0x5e2021,_0x339241){var _0xc0c861={},_0x18853a={},_0x3495f6={'count':0x0,'rows':[]};var _0x405470=_['map'](db[_0x8c9b('0x2c')][_0x8c9b('0x2d')],function(_0x1c4b8a){return{'name':_0x1c4b8a[_0x8c9b('0x2e')],'type':_0x1c4b8a[_0x8c9b('0x2f')][_0x8c9b('0x30')]};});_0x18853a['model']=_[_0x8c9b('0x31')](_0x405470,_0x8c9b('0x2b'));_0x18853a[_0x8c9b('0x32')]=_[_0x8c9b('0x33')](_0x5e2021[_0x8c9b('0x32')]);_0x18853a[_0x8c9b('0x34')]=_[_0x8c9b('0x35')](_0x18853a[_0x8c9b('0x36')],_0x18853a[_0x8c9b('0x32')]);_0xc0c861[_0x8c9b('0x37')]=_['intersection'](_0x18853a[_0x8c9b('0x36')],qs[_0x8c9b('0x38')](_0x5e2021['query'][_0x8c9b('0x38')]));_0xc0c861[_0x8c9b('0x37')]=_0xc0c861['attributes'][_0x8c9b('0x39')]?_0xc0c861[_0x8c9b('0x37')]:_0x18853a['model'];if(!_0x5e2021[_0x8c9b('0x32')][_0x8c9b('0x3a')](_0x8c9b('0x3b'))){_0xc0c861[_0x8c9b('0x3c')]=qs['limit'](_0x5e2021[_0x8c9b('0x32')][_0x8c9b('0x3c')]);_0xc0c861[_0x8c9b('0x1e')]=qs[_0x8c9b('0x1e')](_0x5e2021[_0x8c9b('0x32')][_0x8c9b('0x1e')]);}_0xc0c861['order']=qs['sort'](_0x5e2021[_0x8c9b('0x32')]['sort']);_0xc0c861[_0x8c9b('0x3d')]=qs['filters'](_[_0x8c9b('0x3e')](_0x5e2021[_0x8c9b('0x32')],_0x18853a[_0x8c9b('0x34')]),_0x405470);if(_0x5e2021['query']['filter']){_0xc0c861['where']=_[_0x8c9b('0x3f')](_0xc0c861[_0x8c9b('0x3d')],{'$or':_[_0x8c9b('0x31')](_0x405470,function(_0x11b1ed){if(_0x11b1ed[_0x8c9b('0x2f')]!==_0x8c9b('0x40')){var _0x402ae1={};_0x402ae1[_0x11b1ed[_0x8c9b('0x2b')]]={'$like':'%'+_0x5e2021['query']['filter']+'%'};return _0x402ae1;}})});}_0xc0c861=_[_0x8c9b('0x3f')]({},_0xc0c861,_0x5e2021['options']);var _0x4638b1={'where':_0xc0c861[_0x8c9b('0x3d')]};return db[_0x8c9b('0x2c')][_0x8c9b('0x20')](_0x4638b1)[_0x8c9b('0x27')](function(_0x4d7240){_0x3495f6[_0x8c9b('0x20')]=_0x4d7240;if(_0x5e2021[_0x8c9b('0x32')][_0x8c9b('0x41')]){_0xc0c861[_0x8c9b('0x42')]=[{'all':!![]}];}return db[_0x8c9b('0x2c')]['findAll'](_0xc0c861);})[_0x8c9b('0x27')](function(_0x139d63){_0x3495f6[_0x8c9b('0x43')]=_0x139d63;return _0x3495f6;})[_0x8c9b('0x27')](respondWithFilteredResult(_0x339241,_0xc0c861))[_0x8c9b('0x44')](handleError(_0x339241,null));};exports['show']=function(_0xe70fb4,_0x547533){var _0x36a9e8={'raw':![],'where':{'id':_0xe70fb4['params']['id']}},_0x5a0745={};_0x5a0745['model']=_[_0x8c9b('0x33')](db['FreshsalesConfiguration'][_0x8c9b('0x2d')]);_0x5a0745[_0x8c9b('0x32')]=_['keys'](_0xe70fb4[_0x8c9b('0x32')]);_0x5a0745[_0x8c9b('0x34')]=_['intersection'](_0x5a0745['model'],_0x5a0745[_0x8c9b('0x32')]);_0x36a9e8[_0x8c9b('0x37')]=_['intersection'](_0x5a0745['model'],qs[_0x8c9b('0x38')](_0xe70fb4['query'][_0x8c9b('0x38')]));_0x36a9e8[_0x8c9b('0x37')]=_0x36a9e8['attributes'][_0x8c9b('0x39')]?_0x36a9e8[_0x8c9b('0x37')]:_0x5a0745['model'];if(_0xe70fb4[_0x8c9b('0x32')][_0x8c9b('0x41')]){_0x36a9e8[_0x8c9b('0x42')]=[{'all':!![]}];}_0x36a9e8=_[_0x8c9b('0x3f')]({},_0x36a9e8,_0xe70fb4[_0x8c9b('0x45')]);return db['FreshsalesConfiguration'][_0x8c9b('0x46')](_0x36a9e8)['then'](handleEntityNotFound(_0x547533,null))[_0x8c9b('0x27')](respondWithResult(_0x547533,null))[_0x8c9b('0x44')](handleError(_0x547533,null));};exports[_0x8c9b('0x47')]=function(_0x528bc0,_0x5cc4ba){return db[_0x8c9b('0x2c')][_0x8c9b('0x47')](_0x528bc0[_0x8c9b('0x48')],{})[_0x8c9b('0x27')](respondWithResult(_0x5cc4ba,0xc9))['catch'](handleError(_0x5cc4ba,null));};exports[_0x8c9b('0x26')]=function(_0x1e1ecf,_0x14550a){if(_0x1e1ecf[_0x8c9b('0x48')]['id']){delete _0x1e1ecf[_0x8c9b('0x48')]['id'];}return db[_0x8c9b('0x2c')][_0x8c9b('0x46')]({'where':{'id':_0x1e1ecf[_0x8c9b('0x49')]['id']}})[_0x8c9b('0x27')](handleEntityNotFound(_0x14550a,null))['then'](saveUpdates(_0x1e1ecf[_0x8c9b('0x48')],null))[_0x8c9b('0x27')](respondWithResult(_0x14550a,null))[_0x8c9b('0x44')](handleError(_0x14550a,null));};exports[_0x8c9b('0x28')]=function(_0x38f224,_0x2205d4){return db[_0x8c9b('0x2c')][_0x8c9b('0x46')]({'where':{'id':_0x38f224['params']['id']}})[_0x8c9b('0x27')](handleEntityNotFound(_0x2205d4,null))[_0x8c9b('0x27')](removeEntity(_0x2205d4,null))[_0x8c9b('0x44')](handleError(_0x2205d4,null));};exports[_0x8c9b('0x4a')]=function(_0x5bc7be,_0x4baf03,_0xa25a58){var _0x3d1095={};var _0x10570d={};var _0x5c571c;var _0x22b250;return db[_0x8c9b('0x2c')]['findOne']({'where':{'id':_0x5bc7be[_0x8c9b('0x49')]['id']}})[_0x8c9b('0x27')](handleEntityNotFound(_0x4baf03,null))[_0x8c9b('0x27')](function(_0x9a5a4e){if(_0x9a5a4e){_0x5c571c=_0x9a5a4e;_0x10570d['model']=_[_0x8c9b('0x33')](db[_0x8c9b('0x4b')][_0x8c9b('0x2d')]);_0x10570d[_0x8c9b('0x32')]=_['keys'](_0x5bc7be[_0x8c9b('0x32')]);_0x10570d[_0x8c9b('0x34')]=_['intersection'](_0x10570d[_0x8c9b('0x36')],_0x10570d[_0x8c9b('0x32')]);_0x3d1095[_0x8c9b('0x37')]=_[_0x8c9b('0x35')](_0x10570d[_0x8c9b('0x36')],qs[_0x8c9b('0x38')](_0x5bc7be[_0x8c9b('0x32')]['fields']));_0x3d1095[_0x8c9b('0x37')]=_0x3d1095[_0x8c9b('0x37')][_0x8c9b('0x39')]?_0x3d1095[_0x8c9b('0x37')]:_0x10570d[_0x8c9b('0x36')];_0x3d1095[_0x8c9b('0x4c')]=qs[_0x8c9b('0x4d')](_0x5bc7be[_0x8c9b('0x32')][_0x8c9b('0x4d')]);_0x3d1095[_0x8c9b('0x3d')]=qs[_0x8c9b('0x34')](_[_0x8c9b('0x3e')](_0x5bc7be['query'],_0x10570d[_0x8c9b('0x34')]));if(_0x5bc7be[_0x8c9b('0x32')]['filter']){_0x3d1095[_0x8c9b('0x3d')]=_[_0x8c9b('0x3f')](_0x3d1095[_0x8c9b('0x3d')],{'$or':_[_0x8c9b('0x31')](_0x3d1095[_0x8c9b('0x37')],function(_0x495cc7){var _0x1f15eb={};_0x1f15eb[_0x495cc7]={'$like':'%'+_0x5bc7be[_0x8c9b('0x32')]['filter']+'%'};return _0x1f15eb;})});}_0x3d1095=_[_0x8c9b('0x3f')]({},_0x3d1095,_0x5bc7be[_0x8c9b('0x45')]);return _0x5c571c[_0x8c9b('0x4a')](_0x3d1095);}})[_0x8c9b('0x27')](function(_0x5298ee){if(_0x5298ee){_0x22b250=_0x5298ee[_0x8c9b('0x39')];if(!_0x5bc7be[_0x8c9b('0x32')][_0x8c9b('0x3a')](_0x8c9b('0x3b'))){_0x3d1095[_0x8c9b('0x3c')]=qs['limit'](_0x5bc7be['query']['limit']);_0x3d1095[_0x8c9b('0x1e')]=qs[_0x8c9b('0x1e')](_0x5bc7be['query'][_0x8c9b('0x1e')]);}return _0x5c571c[_0x8c9b('0x4a')](_0x3d1095);}})[_0x8c9b('0x27')](function(_0x147c8d){if(_0x147c8d){return _0x147c8d?{'count':_0x22b250,'rows':_0x147c8d}:null;}})[_0x8c9b('0x27')](respondWithResult(_0x4baf03,null))['catch'](handleError(_0x4baf03,null));};exports[_0x8c9b('0x4e')]=function(_0x2daea5,_0x5207f9,_0x41b6b0){var _0x138559={};var _0x314b81={};var _0x2ca645;var _0x3431c8;return db[_0x8c9b('0x2c')][_0x8c9b('0x4f')]({'where':{'id':_0x2daea5[_0x8c9b('0x49')]['id']}})['then'](handleEntityNotFound(_0x5207f9,null))[_0x8c9b('0x27')](function(_0x286582){if(_0x286582){_0x2ca645=_0x286582;_0x314b81['model']=_[_0x8c9b('0x33')](db[_0x8c9b('0x4b')][_0x8c9b('0x2d')]);_0x314b81[_0x8c9b('0x32')]=_[_0x8c9b('0x33')](_0x2daea5[_0x8c9b('0x32')]);_0x314b81['filters']=_[_0x8c9b('0x35')](_0x314b81[_0x8c9b('0x36')],_0x314b81[_0x8c9b('0x32')]);_0x138559[_0x8c9b('0x37')]=_[_0x8c9b('0x35')](_0x314b81['model'],qs[_0x8c9b('0x38')](_0x2daea5[_0x8c9b('0x32')][_0x8c9b('0x38')]));_0x138559['attributes']=_0x138559[_0x8c9b('0x37')][_0x8c9b('0x39')]?_0x138559[_0x8c9b('0x37')]:_0x314b81['model'];_0x138559[_0x8c9b('0x4c')]=qs[_0x8c9b('0x4d')](_0x2daea5[_0x8c9b('0x32')][_0x8c9b('0x4d')]);_0x138559[_0x8c9b('0x3d')]=qs['filters'](_['pick'](_0x2daea5['query'],_0x314b81['filters']));if(_0x2daea5[_0x8c9b('0x32')][_0x8c9b('0x50')]){_0x138559[_0x8c9b('0x3d')]=_[_0x8c9b('0x3f')](_0x138559['where'],{'$or':_[_0x8c9b('0x31')](_0x138559[_0x8c9b('0x37')],function(_0x169add){var _0x210842={};_0x210842[_0x169add]={'$like':'%'+_0x2daea5['query'][_0x8c9b('0x50')]+'%'};return _0x210842;})});}_0x138559=_[_0x8c9b('0x3f')]({},_0x138559,_0x2daea5[_0x8c9b('0x45')]);return _0x2ca645[_0x8c9b('0x4e')](_0x138559);}})[_0x8c9b('0x27')](function(_0x568c35){if(_0x568c35){_0x3431c8=_0x568c35['length'];if(!_0x2daea5[_0x8c9b('0x32')][_0x8c9b('0x3a')](_0x8c9b('0x3b'))){_0x138559['limit']=qs[_0x8c9b('0x3c')](_0x2daea5[_0x8c9b('0x32')][_0x8c9b('0x3c')]);_0x138559[_0x8c9b('0x1e')]=qs[_0x8c9b('0x1e')](_0x2daea5[_0x8c9b('0x32')][_0x8c9b('0x1e')]);}return _0x2ca645[_0x8c9b('0x4e')](_0x138559);}})[_0x8c9b('0x27')](function(_0xe50c3d){if(_0xe50c3d){return _0xe50c3d?{'count':_0x3431c8,'rows':_0xe50c3d}:null;}})[_0x8c9b('0x27')](respondWithResult(_0x5207f9,null))[_0x8c9b('0x44')](handleError(_0x5207f9,null));};exports[_0x8c9b('0x51')]=function(_0x5f05d4,_0x18ff75,_0x2c87ce){var _0x7c67a2={};var _0x422a35={};var _0x1a60fb;var _0x1cff2b;return db[_0x8c9b('0x2c')][_0x8c9b('0x4f')]({'where':{'id':_0x5f05d4[_0x8c9b('0x49')]['id']}})['then'](handleEntityNotFound(_0x18ff75,null))[_0x8c9b('0x27')](function(_0x16734e){if(_0x16734e){_0x1a60fb=_0x16734e;_0x422a35[_0x8c9b('0x36')]=_[_0x8c9b('0x33')](db[_0x8c9b('0x4b')][_0x8c9b('0x2d')]);_0x422a35[_0x8c9b('0x32')]=_[_0x8c9b('0x33')](_0x5f05d4['query']);_0x422a35[_0x8c9b('0x34')]=_['intersection'](_0x422a35[_0x8c9b('0x36')],_0x422a35[_0x8c9b('0x32')]);_0x7c67a2['attributes']=_['intersection'](_0x422a35[_0x8c9b('0x36')],qs[_0x8c9b('0x38')](_0x5f05d4[_0x8c9b('0x32')]['fields']));_0x7c67a2[_0x8c9b('0x37')]=_0x7c67a2[_0x8c9b('0x37')][_0x8c9b('0x39')]?_0x7c67a2['attributes']:_0x422a35[_0x8c9b('0x36')];_0x7c67a2[_0x8c9b('0x4c')]=qs[_0x8c9b('0x4d')](_0x5f05d4[_0x8c9b('0x32')][_0x8c9b('0x4d')]);_0x7c67a2['where']=qs[_0x8c9b('0x34')](_[_0x8c9b('0x3e')](_0x5f05d4[_0x8c9b('0x32')],_0x422a35['filters']));if(_0x5f05d4[_0x8c9b('0x32')]['filter']){_0x7c67a2[_0x8c9b('0x3d')]=_['merge'](_0x7c67a2[_0x8c9b('0x3d')],{'$or':_[_0x8c9b('0x31')](_0x7c67a2['attributes'],function(_0x40ade6){var _0x6a62d0={};_0x6a62d0[_0x40ade6]={'$like':'%'+_0x5f05d4[_0x8c9b('0x32')][_0x8c9b('0x50')]+'%'};return _0x6a62d0;})});}_0x7c67a2=_['merge']({},_0x7c67a2,_0x5f05d4[_0x8c9b('0x45')]);return _0x1a60fb[_0x8c9b('0x51')](_0x7c67a2);}})['then'](function(_0x59d644){if(_0x59d644){_0x1cff2b=_0x59d644[_0x8c9b('0x39')];if(!_0x5f05d4['query']['hasOwnProperty']('nolimit')){_0x7c67a2[_0x8c9b('0x3c')]=qs[_0x8c9b('0x3c')](_0x5f05d4[_0x8c9b('0x32')][_0x8c9b('0x3c')]);_0x7c67a2[_0x8c9b('0x1e')]=qs['offset'](_0x5f05d4[_0x8c9b('0x32')][_0x8c9b('0x1e')]);}return _0x1a60fb[_0x8c9b('0x51')](_0x7c67a2);}})[_0x8c9b('0x27')](function(_0xd4eea3){if(_0xd4eea3){return _0xd4eea3?{'count':_0x1cff2b,'rows':_0xd4eea3}:null;}})[_0x8c9b('0x27')](respondWithResult(_0x18ff75,null))[_0x8c9b('0x44')](handleError(_0x18ff75,null));}; \ No newline at end of file +var _0xd2f3=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','fields','includeAll','find','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir'];(function(_0xe85653,_0x1f8530){var _0x3833da=function(_0x1e13f5){while(--_0x1e13f5){_0xe85653['push'](_0xe85653['shift']());}};_0x3833da(++_0x1f8530);}(_0xd2f3,0x1b0));var _0x3d2f=function(_0x5ddebc,_0xae4141){_0x5ddebc=_0x5ddebc-0x0;var _0x1e3308=_0xd2f3[_0x5ddebc];return _0x1e3308;};'use strict';var emlformat=require(_0x3d2f('0x0'));var rimraf=require(_0x3d2f('0x1'));var zipdir=require(_0x3d2f('0x2'));var jsonpatch=require(_0x3d2f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d2f('0x4'));var Mustache=require(_0x3d2f('0x5'));var util=require(_0x3d2f('0x6'));var path=require(_0x3d2f('0x7'));var sox=require(_0x3d2f('0x8'));var csv=require(_0x3d2f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d2f('0xa'));var _=require('lodash');var squel=require(_0x3d2f('0xb'));var crypto=require(_0x3d2f('0xc'));var jsforce=require(_0x3d2f('0xd'));var deskjs=require(_0x3d2f('0xe'));var toCsv=require(_0x3d2f('0x9'));var querystring=require(_0x3d2f('0xf'));var Papa=require(_0x3d2f('0x10'));var Redis=require(_0x3d2f('0x11'));var authService=require(_0x3d2f('0x12'));var qs=require(_0x3d2f('0x13'));var as=require(_0x3d2f('0x14'));var hardwareService=require(_0x3d2f('0x15'));var logger=require(_0x3d2f('0x16'))(_0x3d2f('0x17'));var utils=require(_0x3d2f('0x18'));var config=require(_0x3d2f('0x19'));var licenseUtil=require(_0x3d2f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a7816,_0x40a829){_0x40a829=_0x40a829||0xcc;return function(_0x4b4437){if(_0x4b4437){return _0x5a7816[_0x3d2f('0x1b')](_0x40a829);}return _0x5a7816[_0x3d2f('0x1c')](_0x40a829)[_0x3d2f('0x1d')]();};}function respondWithResult(_0x55773d,_0x23af0f){_0x23af0f=_0x23af0f||0xc8;return function(_0x357f26){if(_0x357f26){return _0x55773d[_0x3d2f('0x1c')](_0x23af0f)[_0x3d2f('0x1e')](_0x357f26);}};}function respondWithFilteredResult(_0x13c96a,_0x2ff552){return function(_0x1bbab7){if(_0x1bbab7){var _0xecda34=typeof _0x2ff552[_0x3d2f('0x1f')]===_0x3d2f('0x20')&&typeof _0x2ff552[_0x3d2f('0x21')]===_0x3d2f('0x20');var _0x1c3e8f=_0x1bbab7[_0x3d2f('0x22')];var _0x1b4a03=_0xecda34?0x0:_0x2ff552[_0x3d2f('0x1f')];var _0x1b04da=_0xecda34?_0x1bbab7[_0x3d2f('0x22')]:_0x2ff552[_0x3d2f('0x1f')]+_0x2ff552[_0x3d2f('0x21')];var _0x335cbf;if(_0x1b04da>=_0x1c3e8f){_0x1b04da=_0x1c3e8f;_0x335cbf=0xc8;}else{_0x335cbf=0xce;}_0x13c96a[_0x3d2f('0x1c')](_0x335cbf);return _0x13c96a[_0x3d2f('0x23')](_0x3d2f('0x24'),_0x1b4a03+'-'+_0x1b04da+'/'+_0x1c3e8f)['json'](_0x1bbab7);}return null;};}function patchUpdates(_0x815b31){return function(_0x279c4d){try{jsonpatch[_0x3d2f('0x25')](_0x279c4d,_0x815b31,!![]);}catch(_0xfd9ae9){return BPromise[_0x3d2f('0x26')](_0xfd9ae9);}return _0x279c4d[_0x3d2f('0x27')]();};}function saveUpdates(_0x3ccb07,_0x1f0f9b){return function(_0x38f164){if(_0x38f164){return _0x38f164[_0x3d2f('0x28')](_0x3ccb07)[_0x3d2f('0x29')](function(_0x4eca7d){return _0x4eca7d;});}return null;};}function removeEntity(_0x4d62fa,_0x123e7d){return function(_0x5eecf7){if(_0x5eecf7){return _0x5eecf7[_0x3d2f('0x2a')]()['then'](function(){_0x4d62fa[_0x3d2f('0x1c')](0xcc)[_0x3d2f('0x1d')]();});}};}function handleEntityNotFound(_0x284302,_0x3cd1b3){return function(_0x3c4279){if(!_0x3c4279){_0x284302[_0x3d2f('0x1b')](0x194);}return _0x3c4279;};}function handleError(_0x538146,_0x13277b){_0x13277b=_0x13277b||0x1f4;return function(_0x1bf1c2){logger[_0x3d2f('0x2b')](_0x1bf1c2[_0x3d2f('0x2c')]);if(_0x1bf1c2[_0x3d2f('0x2d')]){delete _0x1bf1c2['name'];}_0x538146['status'](_0x13277b)[_0x3d2f('0x2e')](_0x1bf1c2);};}exports[_0x3d2f('0x2f')]=function(_0x237d58,_0x28b26c){var _0x19dce4={},_0x479623={},_0x1bd1fa={'count':0x0,'rows':[]};var _0x3fb4ec=_['map'](db[_0x3d2f('0x30')][_0x3d2f('0x31')],function(_0xdfb620){return{'name':_0xdfb620[_0x3d2f('0x32')],'type':_0xdfb620[_0x3d2f('0x33')][_0x3d2f('0x34')]};});_0x479623[_0x3d2f('0x35')]=_[_0x3d2f('0x36')](_0x3fb4ec,_0x3d2f('0x2d'));_0x479623['query']=_['keys'](_0x237d58[_0x3d2f('0x37')]);_0x479623[_0x3d2f('0x38')]=_[_0x3d2f('0x39')](_0x479623['model'],_0x479623[_0x3d2f('0x37')]);_0x19dce4['attributes']=_[_0x3d2f('0x39')](_0x479623[_0x3d2f('0x35')],qs['fields'](_0x237d58[_0x3d2f('0x37')]['fields']));_0x19dce4[_0x3d2f('0x3a')]=_0x19dce4[_0x3d2f('0x3a')][_0x3d2f('0x3b')]?_0x19dce4[_0x3d2f('0x3a')]:_0x479623['model'];if(!_0x237d58[_0x3d2f('0x37')][_0x3d2f('0x3c')](_0x3d2f('0x3d'))){_0x19dce4[_0x3d2f('0x21')]=qs[_0x3d2f('0x21')](_0x237d58[_0x3d2f('0x37')]['limit']);_0x19dce4[_0x3d2f('0x1f')]=qs[_0x3d2f('0x1f')](_0x237d58[_0x3d2f('0x37')][_0x3d2f('0x1f')]);}_0x19dce4[_0x3d2f('0x3e')]=qs['sort'](_0x237d58[_0x3d2f('0x37')][_0x3d2f('0x3f')]);_0x19dce4[_0x3d2f('0x40')]=qs[_0x3d2f('0x38')](_[_0x3d2f('0x41')](_0x237d58[_0x3d2f('0x37')],_0x479623['filters']),_0x3fb4ec);if(_0x237d58[_0x3d2f('0x37')][_0x3d2f('0x42')]){_0x19dce4[_0x3d2f('0x40')]=_[_0x3d2f('0x43')](_0x19dce4[_0x3d2f('0x40')],{'$or':_[_0x3d2f('0x36')](_0x3fb4ec,function(_0x4292b0){if(_0x4292b0[_0x3d2f('0x33')]!==_0x3d2f('0x44')){var _0x5f2308={};_0x5f2308[_0x4292b0[_0x3d2f('0x2d')]]={'$like':'%'+_0x237d58[_0x3d2f('0x37')][_0x3d2f('0x42')]+'%'};return _0x5f2308;}})});}_0x19dce4=_['merge']({},_0x19dce4,_0x237d58[_0x3d2f('0x45')]);var _0x3cc1b6={'where':_0x19dce4[_0x3d2f('0x40')]};return db[_0x3d2f('0x30')]['count'](_0x3cc1b6)[_0x3d2f('0x29')](function(_0x1b8f3b){_0x1bd1fa[_0x3d2f('0x22')]=_0x1b8f3b;if(_0x237d58[_0x3d2f('0x37')]['includeAll']){_0x19dce4[_0x3d2f('0x46')]=[{'all':!![]}];}return db[_0x3d2f('0x30')][_0x3d2f('0x47')](_0x19dce4);})[_0x3d2f('0x29')](function(_0x4ca33b){_0x1bd1fa[_0x3d2f('0x48')]=_0x4ca33b;return _0x1bd1fa;})[_0x3d2f('0x29')](respondWithFilteredResult(_0x28b26c,_0x19dce4))[_0x3d2f('0x49')](handleError(_0x28b26c,null));};exports[_0x3d2f('0x4a')]=function(_0x421a97,_0x43cb39){var _0x29fe78={'raw':![],'where':{'id':_0x421a97[_0x3d2f('0x4b')]['id']}},_0x57bd2a={};_0x57bd2a[_0x3d2f('0x35')]=_[_0x3d2f('0x4c')](db[_0x3d2f('0x30')]['rawAttributes']);_0x57bd2a[_0x3d2f('0x37')]=_[_0x3d2f('0x4c')](_0x421a97['query']);_0x57bd2a[_0x3d2f('0x38')]=_[_0x3d2f('0x39')](_0x57bd2a[_0x3d2f('0x35')],_0x57bd2a[_0x3d2f('0x37')]);_0x29fe78['attributes']=_['intersection'](_0x57bd2a['model'],qs[_0x3d2f('0x4d')](_0x421a97[_0x3d2f('0x37')][_0x3d2f('0x4d')]));_0x29fe78[_0x3d2f('0x3a')]=_0x29fe78[_0x3d2f('0x3a')][_0x3d2f('0x3b')]?_0x29fe78[_0x3d2f('0x3a')]:_0x57bd2a[_0x3d2f('0x35')];if(_0x421a97['query'][_0x3d2f('0x4e')]){_0x29fe78[_0x3d2f('0x46')]=[{'all':!![]}];}_0x29fe78=_[_0x3d2f('0x43')]({},_0x29fe78,_0x421a97[_0x3d2f('0x45')]);return db[_0x3d2f('0x30')][_0x3d2f('0x4f')](_0x29fe78)[_0x3d2f('0x29')](handleEntityNotFound(_0x43cb39,null))[_0x3d2f('0x29')](respondWithResult(_0x43cb39,null))['catch'](handleError(_0x43cb39,null));};exports[_0x3d2f('0x50')]=function(_0x2bbb8b,_0x841597){return db[_0x3d2f('0x30')][_0x3d2f('0x50')](_0x2bbb8b[_0x3d2f('0x51')],{})['then'](respondWithResult(_0x841597,0xc9))['catch'](handleError(_0x841597,null));};exports[_0x3d2f('0x28')]=function(_0x5467c7,_0x8345ca){if(_0x5467c7[_0x3d2f('0x51')]['id']){delete _0x5467c7[_0x3d2f('0x51')]['id'];}return db[_0x3d2f('0x30')][_0x3d2f('0x4f')]({'where':{'id':_0x5467c7['params']['id']}})[_0x3d2f('0x29')](handleEntityNotFound(_0x8345ca,null))['then'](saveUpdates(_0x5467c7['body'],null))[_0x3d2f('0x29')](respondWithResult(_0x8345ca,null))['catch'](handleError(_0x8345ca,null));};exports[_0x3d2f('0x2a')]=function(_0x4aeb4c,_0xb36e42){return db[_0x3d2f('0x30')]['find']({'where':{'id':_0x4aeb4c['params']['id']}})['then'](handleEntityNotFound(_0xb36e42,null))[_0x3d2f('0x29')](removeEntity(_0xb36e42,null))[_0x3d2f('0x49')](handleError(_0xb36e42,null));};exports[_0x3d2f('0x52')]=function(_0x47eac8,_0x25d505,_0x1a77a1){var _0x18e12b={};var _0x47fe82={};var _0x3f4ee3;var _0x15adef;return db[_0x3d2f('0x30')][_0x3d2f('0x53')]({'where':{'id':_0x47eac8[_0x3d2f('0x4b')]['id']}})[_0x3d2f('0x29')](handleEntityNotFound(_0x25d505,null))['then'](function(_0xa2a6c7){if(_0xa2a6c7){_0x3f4ee3=_0xa2a6c7;_0x47fe82['model']=_[_0x3d2f('0x4c')](db[_0x3d2f('0x54')]['rawAttributes']);_0x47fe82[_0x3d2f('0x37')]=_['keys'](_0x47eac8[_0x3d2f('0x37')]);_0x47fe82[_0x3d2f('0x38')]=_[_0x3d2f('0x39')](_0x47fe82[_0x3d2f('0x35')],_0x47fe82[_0x3d2f('0x37')]);_0x18e12b[_0x3d2f('0x3a')]=_[_0x3d2f('0x39')](_0x47fe82[_0x3d2f('0x35')],qs[_0x3d2f('0x4d')](_0x47eac8['query'][_0x3d2f('0x4d')]));_0x18e12b[_0x3d2f('0x3a')]=_0x18e12b[_0x3d2f('0x3a')][_0x3d2f('0x3b')]?_0x18e12b[_0x3d2f('0x3a')]:_0x47fe82[_0x3d2f('0x35')];_0x18e12b[_0x3d2f('0x3e')]=qs[_0x3d2f('0x3f')](_0x47eac8[_0x3d2f('0x37')][_0x3d2f('0x3f')]);_0x18e12b[_0x3d2f('0x40')]=qs[_0x3d2f('0x38')](_[_0x3d2f('0x41')](_0x47eac8['query'],_0x47fe82[_0x3d2f('0x38')]));if(_0x47eac8[_0x3d2f('0x37')][_0x3d2f('0x42')]){_0x18e12b['where']=_[_0x3d2f('0x43')](_0x18e12b[_0x3d2f('0x40')],{'$or':_[_0x3d2f('0x36')](_0x18e12b['attributes'],function(_0x51a684){var _0x1c147b={};_0x1c147b[_0x51a684]={'$like':'%'+_0x47eac8[_0x3d2f('0x37')]['filter']+'%'};return _0x1c147b;})});}_0x18e12b=_[_0x3d2f('0x43')]({},_0x18e12b,_0x47eac8[_0x3d2f('0x45')]);return _0x3f4ee3[_0x3d2f('0x52')](_0x18e12b);}})[_0x3d2f('0x29')](function(_0x29f2e9){if(_0x29f2e9){_0x15adef=_0x29f2e9[_0x3d2f('0x3b')];if(!_0x47eac8[_0x3d2f('0x37')][_0x3d2f('0x3c')](_0x3d2f('0x3d'))){_0x18e12b['limit']=qs[_0x3d2f('0x21')](_0x47eac8[_0x3d2f('0x37')]['limit']);_0x18e12b[_0x3d2f('0x1f')]=qs[_0x3d2f('0x1f')](_0x47eac8[_0x3d2f('0x37')][_0x3d2f('0x1f')]);}return _0x3f4ee3[_0x3d2f('0x52')](_0x18e12b);}})[_0x3d2f('0x29')](function(_0x11836a){if(_0x11836a){return _0x11836a?{'count':_0x15adef,'rows':_0x11836a}:null;}})[_0x3d2f('0x29')](respondWithResult(_0x25d505,null))[_0x3d2f('0x49')](handleError(_0x25d505,null));};exports[_0x3d2f('0x55')]=function(_0x231c5c,_0x4fb375,_0x1b6698){var _0x472d88={};var _0x54a2ca={};var _0x489d04;var _0xad4e46;return db[_0x3d2f('0x30')][_0x3d2f('0x53')]({'where':{'id':_0x231c5c[_0x3d2f('0x4b')]['id']}})[_0x3d2f('0x29')](handleEntityNotFound(_0x4fb375,null))['then'](function(_0x230db0){if(_0x230db0){_0x489d04=_0x230db0;_0x54a2ca[_0x3d2f('0x35')]=_[_0x3d2f('0x4c')](db[_0x3d2f('0x54')][_0x3d2f('0x31')]);_0x54a2ca[_0x3d2f('0x37')]=_['keys'](_0x231c5c[_0x3d2f('0x37')]);_0x54a2ca['filters']=_[_0x3d2f('0x39')](_0x54a2ca[_0x3d2f('0x35')],_0x54a2ca[_0x3d2f('0x37')]);_0x472d88[_0x3d2f('0x3a')]=_[_0x3d2f('0x39')](_0x54a2ca[_0x3d2f('0x35')],qs[_0x3d2f('0x4d')](_0x231c5c[_0x3d2f('0x37')][_0x3d2f('0x4d')]));_0x472d88[_0x3d2f('0x3a')]=_0x472d88[_0x3d2f('0x3a')][_0x3d2f('0x3b')]?_0x472d88['attributes']:_0x54a2ca['model'];_0x472d88[_0x3d2f('0x3e')]=qs[_0x3d2f('0x3f')](_0x231c5c['query'][_0x3d2f('0x3f')]);_0x472d88[_0x3d2f('0x40')]=qs[_0x3d2f('0x38')](_[_0x3d2f('0x41')](_0x231c5c[_0x3d2f('0x37')],_0x54a2ca[_0x3d2f('0x38')]));if(_0x231c5c[_0x3d2f('0x37')][_0x3d2f('0x42')]){_0x472d88[_0x3d2f('0x40')]=_['merge'](_0x472d88[_0x3d2f('0x40')],{'$or':_[_0x3d2f('0x36')](_0x472d88[_0x3d2f('0x3a')],function(_0x19c218){var _0x14f772={};_0x14f772[_0x19c218]={'$like':'%'+_0x231c5c['query']['filter']+'%'};return _0x14f772;})});}_0x472d88=_[_0x3d2f('0x43')]({},_0x472d88,_0x231c5c[_0x3d2f('0x45')]);return _0x489d04[_0x3d2f('0x55')](_0x472d88);}})['then'](function(_0x1d897d){if(_0x1d897d){_0xad4e46=_0x1d897d[_0x3d2f('0x3b')];if(!_0x231c5c[_0x3d2f('0x37')][_0x3d2f('0x3c')](_0x3d2f('0x3d'))){_0x472d88['limit']=qs[_0x3d2f('0x21')](_0x231c5c[_0x3d2f('0x37')][_0x3d2f('0x21')]);_0x472d88[_0x3d2f('0x1f')]=qs[_0x3d2f('0x1f')](_0x231c5c[_0x3d2f('0x37')]['offset']);}return _0x489d04[_0x3d2f('0x55')](_0x472d88);}})[_0x3d2f('0x29')](function(_0x4fa029){if(_0x4fa029){return _0x4fa029?{'count':_0xad4e46,'rows':_0x4fa029}:null;}})[_0x3d2f('0x29')](respondWithResult(_0x4fb375,null))[_0x3d2f('0x49')](handleError(_0x4fb375,null));};exports[_0x3d2f('0x56')]=function(_0x532640,_0x319b6b,_0x3fff53){var _0x190798={};var _0xdd7bb2={};var _0x13e50a;var _0x6e2b17;return db[_0x3d2f('0x30')][_0x3d2f('0x53')]({'where':{'id':_0x532640['params']['id']}})[_0x3d2f('0x29')](handleEntityNotFound(_0x319b6b,null))[_0x3d2f('0x29')](function(_0x552114){if(_0x552114){_0x13e50a=_0x552114;_0xdd7bb2[_0x3d2f('0x35')]=_['keys'](db['FreshsalesField'][_0x3d2f('0x31')]);_0xdd7bb2[_0x3d2f('0x37')]=_['keys'](_0x532640['query']);_0xdd7bb2[_0x3d2f('0x38')]=_[_0x3d2f('0x39')](_0xdd7bb2[_0x3d2f('0x35')],_0xdd7bb2['query']);_0x190798[_0x3d2f('0x3a')]=_['intersection'](_0xdd7bb2['model'],qs[_0x3d2f('0x4d')](_0x532640[_0x3d2f('0x37')][_0x3d2f('0x4d')]));_0x190798[_0x3d2f('0x3a')]=_0x190798[_0x3d2f('0x3a')][_0x3d2f('0x3b')]?_0x190798[_0x3d2f('0x3a')]:_0xdd7bb2[_0x3d2f('0x35')];_0x190798[_0x3d2f('0x3e')]=qs['sort'](_0x532640['query']['sort']);_0x190798['where']=qs['filters'](_['pick'](_0x532640[_0x3d2f('0x37')],_0xdd7bb2[_0x3d2f('0x38')]));if(_0x532640['query']['filter']){_0x190798[_0x3d2f('0x40')]=_[_0x3d2f('0x43')](_0x190798[_0x3d2f('0x40')],{'$or':_[_0x3d2f('0x36')](_0x190798[_0x3d2f('0x3a')],function(_0x2d4343){var _0xdd646a={};_0xdd646a[_0x2d4343]={'$like':'%'+_0x532640[_0x3d2f('0x37')][_0x3d2f('0x42')]+'%'};return _0xdd646a;})});}_0x190798=_[_0x3d2f('0x43')]({},_0x190798,_0x532640['options']);return _0x13e50a['getFields'](_0x190798);}})[_0x3d2f('0x29')](function(_0x3ded27){if(_0x3ded27){_0x6e2b17=_0x3ded27[_0x3d2f('0x3b')];if(!_0x532640[_0x3d2f('0x37')][_0x3d2f('0x3c')]('nolimit')){_0x190798[_0x3d2f('0x21')]=qs['limit'](_0x532640[_0x3d2f('0x37')]['limit']);_0x190798['offset']=qs[_0x3d2f('0x1f')](_0x532640[_0x3d2f('0x37')]['offset']);}return _0x13e50a[_0x3d2f('0x56')](_0x190798);}})[_0x3d2f('0x29')](function(_0x227faf){if(_0x227faf){return _0x227faf?{'count':_0x6e2b17,'rows':_0x227faf}:null;}})[_0x3d2f('0x29')](respondWithResult(_0x319b6b,null))['catch'](handleError(_0x319b6b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7adab77..9e9c4e1 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 _0xefe7=['path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','api','bluebird','request-promise'];(function(_0xc19697,_0x262eca){var _0x3bc68f=function(_0x59cebc){while(--_0x59cebc){_0xc19697['push'](_0xc19697['shift']());}};_0x3bc68f(++_0x262eca);}(_0xefe7,0x11a));var _0x7efe=function(_0x36ea95,_0x2e3792){_0x36ea95=_0x36ea95-0x0;var _0x355dcd=_0xefe7[_0x36ea95];return _0x355dcd;};'use strict';var _=require('lodash');var util=require(_0x7efe('0x0'));var logger=require('../../config/logger')(_0x7efe('0x1'));var moment=require('moment');var BPromise=require(_0x7efe('0x2'));var rp=require(_0x7efe('0x3'));var fs=require('fs');var path=require(_0x7efe('0x4'));var rimraf=require('rimraf');var config=require(_0x7efe('0x5'));var attributes=require(_0x7efe('0x6'));module[_0x7efe('0x7')]=function(_0x3e1d22,_0x5506a4){return _0x3e1d22[_0x7efe('0x8')](_0x7efe('0x9'),attributes,{'tableName':_0x7efe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7f4=['request-promise','path','rimraf','define','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x44aca2,_0x58bb64){var _0x1d7ee1=function(_0x562076){while(--_0x562076){_0x44aca2['push'](_0x44aca2['shift']());}};_0x1d7ee1(++_0x58bb64);}(_0xa7f4,0x9b));var _0x4a7f=function(_0x264436,_0x3a4d6a){_0x264436=_0x264436-0x0;var _0x1ddb3c=_0xa7f4[_0x264436];return _0x1ddb3c;};'use strict';var _=require(_0x4a7f('0x0'));var util=require(_0x4a7f('0x1'));var logger=require(_0x4a7f('0x2'))('api');var moment=require(_0x4a7f('0x3'));var BPromise=require(_0x4a7f('0x4'));var rp=require(_0x4a7f('0x5'));var fs=require('fs');var path=require(_0x4a7f('0x6'));var rimraf=require(_0x4a7f('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x67b88,_0x14f773){return _0x67b88[_0x4a7f('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x4a7f('0x9'),'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 d1b94e3..7a17e45 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 _0xd505=['request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2072b7,_0x21fb38){var _0x36a1b7=function(_0x19bb1e){while(--_0x19bb1e){_0x2072b7['push'](_0x2072b7['shift']());}};_0x36a1b7(++_0x21fb38);}(_0xd505,0xbe));var _0x5d50=function(_0x38ccdf,_0x9d5605){_0x38ccdf=_0x38ccdf-0x0;var _0x5b483c=_0xd505[_0x38ccdf];return _0x5b483c;};'use strict';var _=require('lodash');var util=require(_0x5d50('0x0'));var moment=require('moment');var BPromise=require(_0x5d50('0x1'));var rs=require(_0x5d50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d50('0x3'))['db'];var utils=require(_0x5d50('0x4'));var logger=require(_0x5d50('0x5'))(_0x5d50('0x6'));var config=require(_0x5d50('0x7'));var jayson=require(_0x5d50('0x8'));var client=jayson[_0x5d50('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39fd90,_0x1bd546,_0x419e1d){return new BPromise(function(_0x449df6,_0x6ae484){return client[_0x5d50('0xa')](_0x39fd90,_0x419e1d)[_0x5d50('0xb')](function(_0x58cfb8){logger[_0x5d50('0xc')](_0x5d50('0xd'),_0x1bd546,'request\x20sent');logger[_0x5d50('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x1bd546,_0x5d50('0xf'),JSON['stringify'](_0x58cfb8));if(_0x58cfb8[_0x5d50('0x10')]){if(_0x58cfb8[_0x5d50('0x10')][_0x5d50('0x11')]===0x1f4){logger['error'](_0x5d50('0xd'),_0x1bd546,_0x58cfb8[_0x5d50('0x10')][_0x5d50('0x12')]);return _0x6ae484(_0x58cfb8[_0x5d50('0x10')][_0x5d50('0x12')]);}logger[_0x5d50('0x10')](_0x5d50('0xd'),_0x1bd546,_0x58cfb8['error']['message']);return _0x449df6(_0x58cfb8[_0x5d50('0x10')]['message']);}else{logger[_0x5d50('0xc')](_0x5d50('0xd'),_0x1bd546,'request\x20sent');_0x449df6(_0x58cfb8['result'][_0x5d50('0x12')]);}})[_0x5d50('0x13')](function(_0x57b1dc){logger[_0x5d50('0x10')](_0x5d50('0xd'),_0x1bd546,_0x57b1dc);_0x6ae484(_0x57b1dc);});});} \ No newline at end of file +var _0x7e7e=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x41e33e,_0x19bfed){var _0x53f0ad=function(_0x2f530a){while(--_0x2f530a){_0x41e33e['push'](_0x41e33e['shift']());}};_0x53f0ad(++_0x19bfed);}(_0x7e7e,0x125));var _0xe7e7=function(_0x1a51e4,_0x37caab){_0x1a51e4=_0x1a51e4-0x0;var _0x595532=_0x7e7e[_0x1a51e4];return _0x595532;};'use strict';var _=require('lodash');var util=require(_0xe7e7('0x0'));var moment=require('moment');var BPromise=require(_0xe7e7('0x1'));var rs=require(_0xe7e7('0x2'));var fs=require('fs');var Redis=require(_0xe7e7('0x3'));var db=require(_0xe7e7('0x4'))['db'];var utils=require(_0xe7e7('0x5'));var logger=require(_0xe7e7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe7e7('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6db6,_0x1a412e,_0x12a6c5){return new BPromise(function(_0x2e7d4c,_0x421c2e){return client[_0xe7e7('0x8')](_0x1a6db6,_0x12a6c5)['then'](function(_0x1cfca8){logger[_0xe7e7('0x9')](_0xe7e7('0xa'),_0x1a412e,_0xe7e7('0xb'));logger[_0xe7e7('0xc')](_0xe7e7('0xd'),_0x1a412e,_0xe7e7('0xb'),JSON[_0xe7e7('0xe')](_0x1cfca8));if(_0x1cfca8['error']){if(_0x1cfca8[_0xe7e7('0xf')]['code']===0x1f4){logger[_0xe7e7('0xf')](_0xe7e7('0xa'),_0x1a412e,_0x1cfca8[_0xe7e7('0xf')][_0xe7e7('0x10')]);return _0x421c2e(_0x1cfca8[_0xe7e7('0xf')][_0xe7e7('0x10')]);}logger[_0xe7e7('0xf')](_0xe7e7('0xa'),_0x1a412e,_0x1cfca8[_0xe7e7('0xf')][_0xe7e7('0x10')]);return _0x2e7d4c(_0x1cfca8[_0xe7e7('0xf')][_0xe7e7('0x10')]);}else{logger[_0xe7e7('0x9')](_0xe7e7('0xa'),_0x1a412e,_0xe7e7('0xb'));_0x2e7d4c(_0x1cfca8['result'][_0xe7e7('0x10')]);}})[_0xe7e7('0x11')](function(_0x3c303a){logger[_0xe7e7('0xf')](_0xe7e7('0xa'),_0x1a412e,_0x3c303a);_0x421c2e(_0x3c303a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 25dad6d..8a0a29c 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 _0x324f=['../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x30b159,_0x3fbb50){var _0x23c3f9=function(_0xa21305){while(--_0xa21305){_0x30b159['push'](_0x30b159['shift']());}};_0x23c3f9(++_0x3fbb50);}(_0x324f,0x94));var _0xf324=function(_0x172445,_0xb3f0b0){_0x172445=_0x172445-0x0;var _0x246d78=_0x324f[_0x172445];return _0x246d78;};'use strict';var multer=require(_0xf324('0x0'));var util=require(_0xf324('0x1'));var path=require(_0xf324('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf324('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf324('0x4'));var interaction=require(_0xf324('0x5'));var config=require('../../config/environment');var controller=require(_0xf324('0x6'));router[_0xf324('0x7')]('/',auth['isAuthenticated'](),controller[_0xf324('0x8')]);router[_0xf324('0x7')](_0xf324('0x9'),auth[_0xf324('0xa')](),controller[_0xf324('0xb')]);router[_0xf324('0xc')]('/',auth[_0xf324('0xa')](),controller[_0xf324('0xd')]);router[_0xf324('0xe')]('/:id',auth[_0xf324('0xa')](),controller[_0xf324('0xf')]);router[_0xf324('0x10')](_0xf324('0x9'),auth['isAuthenticated'](),controller[_0xf324('0x11')]);module[_0xf324('0x12')]=router; \ No newline at end of file +var _0x2060=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','index','/:id','post','create'];(function(_0xc2e81b,_0x5e94c6){var _0x52dab5=function(_0x4449e9){while(--_0x4449e9){_0xc2e81b['push'](_0xc2e81b['shift']());}};_0x52dab5(++_0x5e94c6);}(_0x2060,0x1be));var _0x0206=function(_0x3311ab,_0x3aa1fa){_0x3311ab=_0x3311ab-0x0;var _0x1d6ec2=_0x2060[_0x3311ab];return _0x1d6ec2;};'use strict';var multer=require(_0x0206('0x0'));var util=require('util');var path=require(_0x0206('0x1'));var timeout=require(_0x0206('0x2'));var express=require(_0x0206('0x3'));var router=express[_0x0206('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0206('0x5'));var interaction=require(_0x0206('0x6'));var config=require('../../config/environment');var controller=require(_0x0206('0x7'));router['get']('/',auth[_0x0206('0x8')](),controller[_0x0206('0x9')]);router['get'](_0x0206('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0206('0xb')]('/',auth[_0x0206('0x8')](),controller[_0x0206('0xc')]);router[_0x0206('0xd')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0xe')]);router[_0x0206('0xf')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index bc57273..6814d79 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 _0xbff1=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4eae5a,_0x49fd68){var _0xc3420e=function(_0x282b2c){while(--_0x282b2c){_0x4eae5a['push'](_0x4eae5a['shift']());}};_0xc3420e(++_0x49fd68);}(_0xbff1,0x15c));var _0x1bff=function(_0x7f14eb,_0x293155){_0x7f14eb=_0x7f14eb-0x0;var _0x554bff=_0xbff1[_0x7f14eb];return _0x554bff;};'use strict';var Sequelize=require(_0x1bff('0x0'));module[_0x1bff('0x1')]={'type':{'type':Sequelize[_0x1bff('0x2')](_0x1bff('0x3'),_0x1bff('0x4'),_0x1bff('0x5'),'keyValue',_0x1bff('0x6')),'defaultValue':_0x1bff('0x3')},'content':{'type':Sequelize[_0x1bff('0x7')]},'key':{'type':Sequelize[_0x1bff('0x7')]},'keyType':{'type':Sequelize[_0x1bff('0x2')](_0x1bff('0x3'),_0x1bff('0x4'),_0x1bff('0x5'))},'keyContent':{'type':Sequelize[_0x1bff('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1bff('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1bff('0x7')]}}; \ No newline at end of file +var _0x3534=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3534,0x109));var _0x4353=function(_0x360f16,_0x1738aa){_0x360f16=_0x360f16-0x0;var _0x455284=_0x3534[_0x360f16];return _0x455284;};'use strict';var Sequelize=require(_0x4353('0x0'));module[_0x4353('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x4353('0x2'),_0x4353('0x3'),_0x4353('0x4'),'picklist'),'defaultValue':_0x4353('0x5')},'content':{'type':Sequelize[_0x4353('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4353('0x7')](_0x4353('0x5'),'variable',_0x4353('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4353('0x6')]},'nameField':{'type':Sequelize[_0x4353('0x6')]},'customField':{'type':Sequelize[_0x4353('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4353('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 9273165..ed37f05 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 _0xc35f=['error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','merge','where','filter','options','then','includeAll','findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0xc35f,0x17b));var _0xfc35=function(_0x27b914,_0x5ae1ff){_0x27b914=_0x27b914-0x0;var _0xdb7298=_0xc35f[_0x27b914];return _0xdb7298;};'use strict';var emlformat=require(_0xfc35('0x0'));var rimraf=require(_0xfc35('0x1'));var zipdir=require(_0xfc35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc35('0x3'));var moment=require(_0xfc35('0x4'));var BPromise=require(_0xfc35('0x5'));var Mustache=require(_0xfc35('0x6'));var util=require(_0xfc35('0x7'));var path=require(_0xfc35('0x8'));var sox=require(_0xfc35('0x9'));var csv=require(_0xfc35('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc35('0xb'));var _=require('lodash');var squel=require(_0xfc35('0xc'));var crypto=require('crypto');var jsforce=require(_0xfc35('0xd'));var deskjs=require(_0xfc35('0xe'));var toCsv=require(_0xfc35('0xa'));var querystring=require(_0xfc35('0xf'));var Papa=require(_0xfc35('0x10'));var Redis=require('ioredis');var authService=require(_0xfc35('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc35('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfc35('0x13'));var licenseUtil=require(_0xfc35('0x14'));var db=require(_0xfc35('0x15'))['db'];function respondWithStatusCode(_0x3d68e4,_0x347c5f){_0x347c5f=_0x347c5f||0xcc;return function(_0x599d58){if(_0x599d58){return _0x3d68e4[_0xfc35('0x16')](_0x347c5f);}return _0x3d68e4['status'](_0x347c5f)[_0xfc35('0x17')]();};}function respondWithResult(_0x916786,_0x1177fa){_0x1177fa=_0x1177fa||0xc8;return function(_0x56dc81){if(_0x56dc81){return _0x916786[_0xfc35('0x18')](_0x1177fa)[_0xfc35('0x19')](_0x56dc81);}};}function respondWithFilteredResult(_0x4bf259,_0x1a73c8){return function(_0x40614c){if(_0x40614c){var _0x4eb94d=typeof _0x1a73c8[_0xfc35('0x1a')]===_0xfc35('0x1b')&&typeof _0x1a73c8[_0xfc35('0x1c')]==='undefined';var _0x155e16=_0x40614c[_0xfc35('0x1d')];var _0x53f43f=_0x4eb94d?0x0:_0x1a73c8[_0xfc35('0x1a')];var _0x474169=_0x4eb94d?_0x40614c['count']:_0x1a73c8['offset']+_0x1a73c8['limit'];var _0xc99847;if(_0x474169>=_0x155e16){_0x474169=_0x155e16;_0xc99847=0xc8;}else{_0xc99847=0xce;}_0x4bf259[_0xfc35('0x18')](_0xc99847);return _0x4bf259[_0xfc35('0x1e')]('Content-Range',_0x53f43f+'-'+_0x474169+'/'+_0x155e16)[_0xfc35('0x19')](_0x40614c);}return null;};}function patchUpdates(_0x4f81b7){return function(_0x1fa138){try{jsonpatch[_0xfc35('0x1f')](_0x1fa138,_0x4f81b7,!![]);}catch(_0x5ba661){return BPromise[_0xfc35('0x20')](_0x5ba661);}return _0x1fa138[_0xfc35('0x21')]();};}function saveUpdates(_0x52febc,_0x4a95ad){return function(_0x1ca146){if(_0x1ca146){return _0x1ca146['update'](_0x52febc)['then'](function(_0x20ea58){return _0x20ea58;});}return null;};}function removeEntity(_0x6eeaee,_0x4669b8){return function(_0x24bebf){if(_0x24bebf){return _0x24bebf[_0xfc35('0x22')]()['then'](function(){_0x6eeaee[_0xfc35('0x18')](0xcc)[_0xfc35('0x17')]();});}};}function handleEntityNotFound(_0x7dfa74,_0x2328ea){return function(_0x3f065a){if(!_0x3f065a){_0x7dfa74[_0xfc35('0x16')](0x194);}return _0x3f065a;};}function handleError(_0x139f93,_0x250db2){_0x250db2=_0x250db2||0x1f4;return function(_0x25e1f3){logger[_0xfc35('0x23')](_0x25e1f3['stack']);if(_0x25e1f3[_0xfc35('0x24')]){delete _0x25e1f3[_0xfc35('0x24')];}_0x139f93['status'](_0x250db2)[_0xfc35('0x25')](_0x25e1f3);};}exports[_0xfc35('0x26')]=function(_0x219cf9,_0x122d6b){var _0x197f08={},_0x27b474={},_0x169219={'count':0x0,'rows':[]};var _0xbc2023=_[_0xfc35('0x27')](db[_0xfc35('0x28')][_0xfc35('0x29')],function(_0x48832b){return{'name':_0x48832b[_0xfc35('0x2a')],'type':_0x48832b[_0xfc35('0x2b')]['key']};});_0x27b474[_0xfc35('0x2c')]=_[_0xfc35('0x27')](_0xbc2023,'name');_0x27b474['query']=_[_0xfc35('0x2d')](_0x219cf9[_0xfc35('0x2e')]);_0x27b474[_0xfc35('0x2f')]=_['intersection'](_0x27b474[_0xfc35('0x2c')],_0x27b474['query']);_0x197f08['attributes']=_[_0xfc35('0x30')](_0x27b474[_0xfc35('0x2c')],qs[_0xfc35('0x31')](_0x219cf9[_0xfc35('0x2e')][_0xfc35('0x31')]));_0x197f08[_0xfc35('0x32')]=_0x197f08[_0xfc35('0x32')][_0xfc35('0x33')]?_0x197f08['attributes']:_0x27b474['model'];if(!_0x219cf9[_0xfc35('0x2e')][_0xfc35('0x34')](_0xfc35('0x35'))){_0x197f08[_0xfc35('0x1c')]=qs[_0xfc35('0x1c')](_0x219cf9['query'][_0xfc35('0x1c')]);_0x197f08[_0xfc35('0x1a')]=qs['offset'](_0x219cf9[_0xfc35('0x2e')][_0xfc35('0x1a')]);}_0x197f08[_0xfc35('0x36')]=qs['sort'](_0x219cf9[_0xfc35('0x2e')][_0xfc35('0x37')]);_0x197f08['where']=qs[_0xfc35('0x2f')](_['pick'](_0x219cf9[_0xfc35('0x2e')],_0x27b474[_0xfc35('0x2f')]),_0xbc2023);if(_0x219cf9[_0xfc35('0x2e')]['filter']){_0x197f08['where']=_[_0xfc35('0x38')](_0x197f08[_0xfc35('0x39')],{'$or':_[_0xfc35('0x27')](_0xbc2023,function(_0x4f9045){if(_0x4f9045[_0xfc35('0x2b')]!=='VIRTUAL'){var _0x5eb24b={};_0x5eb24b[_0x4f9045['name']]={'$like':'%'+_0x219cf9[_0xfc35('0x2e')][_0xfc35('0x3a')]+'%'};return _0x5eb24b;}})});}_0x197f08=_['merge']({},_0x197f08,_0x219cf9[_0xfc35('0x3b')]);var _0x567984={'where':_0x197f08[_0xfc35('0x39')]};return db[_0xfc35('0x28')][_0xfc35('0x1d')](_0x567984)[_0xfc35('0x3c')](function(_0x1ca4a7){_0x169219[_0xfc35('0x1d')]=_0x1ca4a7;if(_0x219cf9[_0xfc35('0x2e')][_0xfc35('0x3d')]){_0x197f08['include']=[{'all':!![]}];}return db['FreshsalesField'][_0xfc35('0x3e')](_0x197f08);})['then'](function(_0x3605b5){_0x169219[_0xfc35('0x3f')]=_0x3605b5;return _0x169219;})[_0xfc35('0x3c')](respondWithFilteredResult(_0x122d6b,_0x197f08))[_0xfc35('0x40')](handleError(_0x122d6b,null));};exports[_0xfc35('0x41')]=function(_0x4931ce,_0x41c9b5){var _0x4a96d9={'raw':!![],'where':{'id':_0x4931ce[_0xfc35('0x42')]['id']}},_0xd1e44a={};_0xd1e44a[_0xfc35('0x2c')]=_[_0xfc35('0x2d')](db[_0xfc35('0x28')]['rawAttributes']);_0xd1e44a[_0xfc35('0x2e')]=_[_0xfc35('0x2d')](_0x4931ce[_0xfc35('0x2e')]);_0xd1e44a[_0xfc35('0x2f')]=_[_0xfc35('0x30')](_0xd1e44a['model'],_0xd1e44a[_0xfc35('0x2e')]);_0x4a96d9['attributes']=_[_0xfc35('0x30')](_0xd1e44a['model'],qs[_0xfc35('0x31')](_0x4931ce[_0xfc35('0x2e')][_0xfc35('0x31')]));_0x4a96d9[_0xfc35('0x32')]=_0x4a96d9[_0xfc35('0x32')][_0xfc35('0x33')]?_0x4a96d9[_0xfc35('0x32')]:_0xd1e44a['model'];if(_0x4931ce[_0xfc35('0x2e')][_0xfc35('0x3d')]){_0x4a96d9['include']=[{'all':!![]}];}_0x4a96d9=_[_0xfc35('0x38')]({},_0x4a96d9,_0x4931ce[_0xfc35('0x3b')]);return db[_0xfc35('0x28')][_0xfc35('0x43')](_0x4a96d9)[_0xfc35('0x3c')](handleEntityNotFound(_0x41c9b5,null))[_0xfc35('0x3c')](respondWithResult(_0x41c9b5,null))['catch'](handleError(_0x41c9b5,null));};exports['create']=function(_0x11e88c,_0x52e2fa){return db[_0xfc35('0x28')]['create'](_0x11e88c[_0xfc35('0x44')],{})[_0xfc35('0x3c')](respondWithResult(_0x52e2fa,0xc9))[_0xfc35('0x40')](handleError(_0x52e2fa,null));};exports['update']=function(_0xf5b164,_0x395083){if(_0xf5b164[_0xfc35('0x44')]['id']){delete _0xf5b164[_0xfc35('0x44')]['id'];}return db[_0xfc35('0x28')][_0xfc35('0x43')]({'where':{'id':_0xf5b164[_0xfc35('0x42')]['id']}})['then'](handleEntityNotFound(_0x395083,null))['then'](saveUpdates(_0xf5b164[_0xfc35('0x44')],null))[_0xfc35('0x3c')](respondWithResult(_0x395083,null))[_0xfc35('0x40')](handleError(_0x395083,null));};exports[_0xfc35('0x22')]=function(_0x2acbe2,_0x144792){return db[_0xfc35('0x28')][_0xfc35('0x43')]({'where':{'id':_0x2acbe2['params']['id']}})[_0xfc35('0x3c')](handleEntityNotFound(_0x144792,null))[_0xfc35('0x3c')](removeEntity(_0x144792,null))['catch'](handleError(_0x144792,null));}; \ No newline at end of file +var _0xcd30=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','send','index','FreshsalesField','rawAttributes','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x51d0a8,_0x377fb8){var _0x8d0df4=function(_0xf4ee16){while(--_0xf4ee16){_0x51d0a8['push'](_0x51d0a8['shift']());}};_0x8d0df4(++_0x377fb8);}(_0xcd30,0x10b));var _0x0cd3=function(_0xd10d51,_0x37eb56){_0xd10d51=_0xd10d51-0x0;var _0x5e7b61=_0xcd30[_0xd10d51];return _0x5e7b61;};'use strict';var emlformat=require(_0x0cd3('0x0'));var rimraf=require(_0x0cd3('0x1'));var zipdir=require(_0x0cd3('0x2'));var jsonpatch=require(_0x0cd3('0x3'));var rp=require(_0x0cd3('0x4'));var moment=require('moment');var BPromise=require(_0x0cd3('0x5'));var Mustache=require(_0x0cd3('0x6'));var util=require('util');var path=require(_0x0cd3('0x7'));var sox=require(_0x0cd3('0x8'));var csv=require(_0x0cd3('0x9'));var ejs=require(_0x0cd3('0xa'));var fs=require('fs');var fs_extra=require(_0x0cd3('0xb'));var _=require(_0x0cd3('0xc'));var squel=require(_0x0cd3('0xd'));var crypto=require(_0x0cd3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0cd3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0cd3('0x10'));var Papa=require('papaparse');var Redis=require(_0x0cd3('0x11'));var authService=require(_0x0cd3('0x12'));var qs=require(_0x0cd3('0x13'));var as=require(_0x0cd3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0cd3('0x15'));var licenseUtil=require(_0x0cd3('0x16'));var db=require(_0x0cd3('0x17'))['db'];function respondWithStatusCode(_0x249817,_0x245910){_0x245910=_0x245910||0xcc;return function(_0x817413){if(_0x817413){return _0x249817[_0x0cd3('0x18')](_0x245910);}return _0x249817[_0x0cd3('0x19')](_0x245910)[_0x0cd3('0x1a')]();};}function respondWithResult(_0x33a9cf,_0x1ef98e){_0x1ef98e=_0x1ef98e||0xc8;return function(_0x583e3c){if(_0x583e3c){return _0x33a9cf[_0x0cd3('0x19')](_0x1ef98e)[_0x0cd3('0x1b')](_0x583e3c);}};}function respondWithFilteredResult(_0x146149,_0x59a344){return function(_0x2fe3a2){if(_0x2fe3a2){var _0x3523f0=typeof _0x59a344[_0x0cd3('0x1c')]==='undefined'&&typeof _0x59a344[_0x0cd3('0x1d')]===_0x0cd3('0x1e');var _0x12cdef=_0x2fe3a2['count'];var _0x5e791b=_0x3523f0?0x0:_0x59a344[_0x0cd3('0x1c')];var _0x55ebd3=_0x3523f0?_0x2fe3a2[_0x0cd3('0x1f')]:_0x59a344[_0x0cd3('0x1c')]+_0x59a344['limit'];var _0x5d6ade;if(_0x55ebd3>=_0x12cdef){_0x55ebd3=_0x12cdef;_0x5d6ade=0xc8;}else{_0x5d6ade=0xce;}_0x146149[_0x0cd3('0x19')](_0x5d6ade);return _0x146149[_0x0cd3('0x20')]('Content-Range',_0x5e791b+'-'+_0x55ebd3+'/'+_0x12cdef)[_0x0cd3('0x1b')](_0x2fe3a2);}return null;};}function patchUpdates(_0x20f01e){return function(_0x49f7e6){try{jsonpatch['apply'](_0x49f7e6,_0x20f01e,!![]);}catch(_0xe583e6){return BPromise[_0x0cd3('0x21')](_0xe583e6);}return _0x49f7e6[_0x0cd3('0x22')]();};}function saveUpdates(_0x9e81bf,_0x132fe9){return function(_0x351b83){if(_0x351b83){return _0x351b83[_0x0cd3('0x23')](_0x9e81bf)[_0x0cd3('0x24')](function(_0x264c0a){return _0x264c0a;});}return null;};}function removeEntity(_0x706fe2,_0x58081f){return function(_0x244875){if(_0x244875){return _0x244875[_0x0cd3('0x25')]()['then'](function(){_0x706fe2[_0x0cd3('0x19')](0xcc)[_0x0cd3('0x1a')]();});}};}function handleEntityNotFound(_0x5cd6a8,_0x284377){return function(_0xc6faf3){if(!_0xc6faf3){_0x5cd6a8[_0x0cd3('0x18')](0x194);}return _0xc6faf3;};}function handleError(_0x572925,_0x30b05d){_0x30b05d=_0x30b05d||0x1f4;return function(_0x49800c){logger[_0x0cd3('0x26')](_0x49800c[_0x0cd3('0x27')]);if(_0x49800c[_0x0cd3('0x28')]){delete _0x49800c[_0x0cd3('0x28')];}_0x572925[_0x0cd3('0x19')](_0x30b05d)[_0x0cd3('0x29')](_0x49800c);};}exports[_0x0cd3('0x2a')]=function(_0x4e3a15,_0x5a5971){var _0x10fb2d={},_0x1f3be6={},_0x3b4c01={'count':0x0,'rows':[]};var _0x36ef7a=_['map'](db[_0x0cd3('0x2b')][_0x0cd3('0x2c')],function(_0x58d248){return{'name':_0x58d248['fieldName'],'type':_0x58d248[_0x0cd3('0x2d')]['key']};});_0x1f3be6[_0x0cd3('0x2e')]=_[_0x0cd3('0x2f')](_0x36ef7a,_0x0cd3('0x28'));_0x1f3be6[_0x0cd3('0x30')]=_[_0x0cd3('0x31')](_0x4e3a15[_0x0cd3('0x30')]);_0x1f3be6['filters']=_[_0x0cd3('0x32')](_0x1f3be6[_0x0cd3('0x2e')],_0x1f3be6[_0x0cd3('0x30')]);_0x10fb2d['attributes']=_[_0x0cd3('0x32')](_0x1f3be6[_0x0cd3('0x2e')],qs[_0x0cd3('0x33')](_0x4e3a15[_0x0cd3('0x30')][_0x0cd3('0x33')]));_0x10fb2d[_0x0cd3('0x34')]=_0x10fb2d[_0x0cd3('0x34')][_0x0cd3('0x35')]?_0x10fb2d[_0x0cd3('0x34')]:_0x1f3be6[_0x0cd3('0x2e')];if(!_0x4e3a15[_0x0cd3('0x30')][_0x0cd3('0x36')](_0x0cd3('0x37'))){_0x10fb2d[_0x0cd3('0x1d')]=qs[_0x0cd3('0x1d')](_0x4e3a15['query'][_0x0cd3('0x1d')]);_0x10fb2d['offset']=qs['offset'](_0x4e3a15[_0x0cd3('0x30')]['offset']);}_0x10fb2d[_0x0cd3('0x38')]=qs['sort'](_0x4e3a15[_0x0cd3('0x30')]['sort']);_0x10fb2d[_0x0cd3('0x39')]=qs[_0x0cd3('0x3a')](_[_0x0cd3('0x3b')](_0x4e3a15[_0x0cd3('0x30')],_0x1f3be6[_0x0cd3('0x3a')]),_0x36ef7a);if(_0x4e3a15[_0x0cd3('0x30')][_0x0cd3('0x3c')]){_0x10fb2d[_0x0cd3('0x39')]=_[_0x0cd3('0x3d')](_0x10fb2d['where'],{'$or':_[_0x0cd3('0x2f')](_0x36ef7a,function(_0x54171e){if(_0x54171e[_0x0cd3('0x2d')]!=='VIRTUAL'){var _0x4952c7={};_0x4952c7[_0x54171e[_0x0cd3('0x28')]]={'$like':'%'+_0x4e3a15[_0x0cd3('0x30')][_0x0cd3('0x3c')]+'%'};return _0x4952c7;}})});}_0x10fb2d=_[_0x0cd3('0x3d')]({},_0x10fb2d,_0x4e3a15[_0x0cd3('0x3e')]);var _0x3d7406={'where':_0x10fb2d['where']};return db[_0x0cd3('0x2b')]['count'](_0x3d7406)[_0x0cd3('0x24')](function(_0x62e236){_0x3b4c01[_0x0cd3('0x1f')]=_0x62e236;if(_0x4e3a15[_0x0cd3('0x30')]['includeAll']){_0x10fb2d[_0x0cd3('0x3f')]=[{'all':!![]}];}return db[_0x0cd3('0x2b')][_0x0cd3('0x40')](_0x10fb2d);})[_0x0cd3('0x24')](function(_0x19c5fc){_0x3b4c01[_0x0cd3('0x41')]=_0x19c5fc;return _0x3b4c01;})['then'](respondWithFilteredResult(_0x5a5971,_0x10fb2d))[_0x0cd3('0x42')](handleError(_0x5a5971,null));};exports[_0x0cd3('0x43')]=function(_0x58e0ee,_0x286fad){var _0x362bd5={'raw':!![],'where':{'id':_0x58e0ee[_0x0cd3('0x44')]['id']}},_0x5de17d={};_0x5de17d[_0x0cd3('0x2e')]=_['keys'](db[_0x0cd3('0x2b')][_0x0cd3('0x2c')]);_0x5de17d[_0x0cd3('0x30')]=_[_0x0cd3('0x31')](_0x58e0ee[_0x0cd3('0x30')]);_0x5de17d[_0x0cd3('0x3a')]=_[_0x0cd3('0x32')](_0x5de17d[_0x0cd3('0x2e')],_0x5de17d[_0x0cd3('0x30')]);_0x362bd5[_0x0cd3('0x34')]=_[_0x0cd3('0x32')](_0x5de17d[_0x0cd3('0x2e')],qs[_0x0cd3('0x33')](_0x58e0ee['query'][_0x0cd3('0x33')]));_0x362bd5[_0x0cd3('0x34')]=_0x362bd5['attributes'][_0x0cd3('0x35')]?_0x362bd5[_0x0cd3('0x34')]:_0x5de17d[_0x0cd3('0x2e')];if(_0x58e0ee[_0x0cd3('0x30')]['includeAll']){_0x362bd5[_0x0cd3('0x3f')]=[{'all':!![]}];}_0x362bd5=_[_0x0cd3('0x3d')]({},_0x362bd5,_0x58e0ee['options']);return db['FreshsalesField']['find'](_0x362bd5)[_0x0cd3('0x24')](handleEntityNotFound(_0x286fad,null))[_0x0cd3('0x24')](respondWithResult(_0x286fad,null))[_0x0cd3('0x42')](handleError(_0x286fad,null));};exports[_0x0cd3('0x45')]=function(_0x1fc8d3,_0x3ecce3){return db['FreshsalesField'][_0x0cd3('0x45')](_0x1fc8d3[_0x0cd3('0x46')],{})['then'](respondWithResult(_0x3ecce3,0xc9))[_0x0cd3('0x42')](handleError(_0x3ecce3,null));};exports[_0x0cd3('0x23')]=function(_0x47f36d,_0x135781){if(_0x47f36d[_0x0cd3('0x46')]['id']){delete _0x47f36d[_0x0cd3('0x46')]['id'];}return db[_0x0cd3('0x2b')][_0x0cd3('0x47')]({'where':{'id':_0x47f36d[_0x0cd3('0x44')]['id']}})[_0x0cd3('0x24')](handleEntityNotFound(_0x135781,null))['then'](saveUpdates(_0x47f36d[_0x0cd3('0x46')],null))[_0x0cd3('0x24')](respondWithResult(_0x135781,null))[_0x0cd3('0x42')](handleError(_0x135781,null));};exports[_0x0cd3('0x25')]=function(_0x28e005,_0x2f8287){return db[_0x0cd3('0x2b')][_0x0cd3('0x47')]({'where':{'id':_0x28e005['params']['id']}})[_0x0cd3('0x24')](handleEntityNotFound(_0x2f8287,null))[_0x0cd3('0x24')](removeEntity(_0x2f8287,null))[_0x0cd3('0x42')](handleError(_0x2f8287,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 37292a1..40225f0 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 _0x63ef=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x63ef,0x11a));var _0xf63e=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x63ef[_0x29ce14];return _0x48f289;};'use strict';var _=require(_0xf63e('0x0'));var util=require(_0xf63e('0x1'));var logger=require(_0xf63e('0x2'))('api');var moment=require(_0xf63e('0x3'));var BPromise=require(_0xf63e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf63e('0x5'));var config=require(_0xf63e('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xf63e('0x7')]=function(_0x367f73,_0x519a33){return _0x367f73[_0xf63e('0x8')](_0xf63e('0x9'),attributes,{'tableName':_0xf63e('0xa'),'paranoid':![],'indexes':[{'name':_0xf63e('0xb'),'fields':[_0xf63e('0xc'),_0xf63e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b50=['exports','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x142cd8,_0x3dc7bf){var _0x1ecae5=function(_0x41150e){while(--_0x41150e){_0x142cd8['push'](_0x142cd8['shift']());}};_0x1ecae5(++_0x3dc7bf);}(_0x2b50,0x68));var _0x02b5=function(_0x4c689a,_0x5ef76e){_0x4c689a=_0x4c689a-0x0;var _0x46e149=_0x2b50[_0x4c689a];return _0x46e149;};'use strict';var _=require(_0x02b5('0x0'));var util=require('util');var logger=require(_0x02b5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x02b5('0x2'));var fs=require('fs');var path=require(_0x02b5('0x3'));var rimraf=require(_0x02b5('0x4'));var config=require(_0x02b5('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0x02b5('0x6')]=function(_0x1670e0,_0x5ac1d1){return _0x1670e0['define']('FreshsalesField',attributes,{'tableName':_0x02b5('0x7'),'paranoid':![],'indexes':[{'name':_0x02b5('0x8'),'fields':[_0x02b5('0x9'),_0x02b5('0xa')],'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 d27d7af..660160e 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 _0x2bd8=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3d8b8a,_0x39a5cd){var _0x2aa5f2=function(_0x3dfd60){while(--_0x3dfd60){_0x3d8b8a['push'](_0x3d8b8a['shift']());}};_0x2aa5f2(++_0x39a5cd);}(_0x2bd8,0x130));var _0x82bd=function(_0x2c818e,_0x48c9e1){_0x2c818e=_0x2c818e-0x0;var _0xe3f553=_0x2bd8[_0x2c818e];return _0xe3f553;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){return client[_0x82bd('0xb')](_0x19dbb1,_0x226f60)['then'](function(_0x4a9b2c){logger['info'](_0x82bd('0xc'),_0x77d7a9,'request\x20sent');logger['debug'](_0x82bd('0xd'),_0x77d7a9,'request\x20sent',JSON['stringify'](_0x4a9b2c));if(_0x4a9b2c[_0x82bd('0xe')]){if(_0x4a9b2c[_0x82bd('0xe')]['code']===0x1f4){logger[_0x82bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x4a9b2c[_0x82bd('0xe')]['message']);return _0x4dc3a6(_0x4a9b2c[_0x82bd('0xe')][_0x82bd('0xf')]);}logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x4a9b2c['error'][_0x82bd('0xf')]);return _0x1f7463(_0x4a9b2c[_0x82bd('0xe')]['message']);}else{logger[_0x82bd('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x82bd('0x11'));_0x1f7463(_0x4a9b2c[_0x82bd('0x12')][_0x82bd('0xf')]);}})[_0x82bd('0x13')](function(_0x209081){logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x209081);_0x4dc3a6(_0x209081);});});} \ No newline at end of file +var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2ef9cb,_0x11ec04){_0x2ef9cb=_0x2ef9cb-0x0;var _0x1ae5f4=_0x3f8a[_0x2ef9cb];return _0x1ae5f4;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('FreshsalesField,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 650a803..eeedbe3 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(_0x1eb1c8,_0x182556){var _0xa40819=function(_0xac8a6){while(--_0xac8a6){_0x1eb1c8['push'](_0x1eb1c8['shift']());}};_0xa40819(++_0x182556);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0xb8a9d9,_0x419509){var _0x5302f3=function(_0xc4607a){while(--_0xc4607a){_0xb8a9d9['push'](_0xb8a9d9['shift']());}};_0x5302f3(++_0x419509);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 0acc50d..0d51dae 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 _0x7bd0=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x5761d9,_0xa2fec){var _0x2b557b=function(_0x4b6c33){while(--_0x4b6c33){_0x5761d9['push'](_0x5761d9['shift']());}};_0x2b557b(++_0xa2fec);}(_0x7bd0,0x111));var _0x07bd=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x7bd0[_0xd22d95];return _0x15d7a3;};'use strict';var Sequelize=require(_0x07bd('0x0'));module[_0x07bd('0x1')]={'name':{'type':Sequelize[_0x07bd('0x2')]},'description':{'type':Sequelize[_0x07bd('0x2')]},'username':{'type':Sequelize[_0x07bd('0x2')],'unique':_0x07bd('0x3')},'remoteUri':{'type':Sequelize[_0x07bd('0x2')]},'password':{'type':Sequelize[_0x07bd('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x07bd('0x2')]},'securityToken':{'type':Sequelize[_0x07bd('0x2')]},'serverUrl':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x07bd('0x4')](_0x07bd('0x5'),_0x07bd('0x6')),'defaultValue':_0x07bd('0x5')}}; \ No newline at end of file +var _0xf643=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x59897b,_0x2ef26f){var _0x2367dd=function(_0x5d6ce3){while(--_0x5d6ce3){_0x59897b['push'](_0x59897b['shift']());}};_0x2367dd(++_0x2ef26f);}(_0xf643,0x122));var _0x3f64=function(_0x12156e,_0x550b21){_0x12156e=_0x12156e-0x0;var _0x55ada7=_0xf643[_0x12156e];return _0x55ada7;};'use strict';var Sequelize=require(_0x3f64('0x0'));module[_0x3f64('0x1')]={'name':{'type':Sequelize[_0x3f64('0x2')]},'description':{'type':Sequelize[_0x3f64('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3f64('0x3')},'remoteUri':{'type':Sequelize[_0x3f64('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x3f64('0x2')]},'clientSecret':{'type':Sequelize[_0x3f64('0x2')]},'securityToken':{'type':Sequelize[_0x3f64('0x2')]},'serverUrl':{'type':Sequelize[_0x3f64('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3f64('0x4')](_0x3f64('0x5'),_0x3f64('0x6')),'defaultValue':_0x3f64('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index ce1ab27..5b4f13c 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 _0x988a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','body','find','getConfigurations','findOne','SalesforceConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','Connection','username','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','true','False','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x47367b,_0x4688ac){var _0x493c30=function(_0x527527){while(--_0x527527){_0x47367b['push'](_0x47367b['shift']());}};_0x493c30(++_0x4688ac);}(_0x988a,0xe9));var _0xa988=function(_0x31174c,_0x1d42f1){_0x31174c=_0x31174c-0x0;var _0x2af0a4=_0x988a[_0x31174c];return _0x2af0a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa988('0x0'));var zipdir=require(_0xa988('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa988('0x2'));var moment=require(_0xa988('0x3'));var BPromise=require(_0xa988('0x4'));var Mustache=require(_0xa988('0x5'));var util=require('util');var path=require(_0xa988('0x6'));var sox=require('sox');var csv=require(_0xa988('0x7'));var ejs=require(_0xa988('0x8'));var fs=require('fs');var fs_extra=require(_0xa988('0x9'));var _=require(_0xa988('0xa'));var squel=require(_0xa988('0xb'));var crypto=require('crypto');var jsforce=require(_0xa988('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa988('0xd'));var Papa=require(_0xa988('0xe'));var Redis=require(_0xa988('0xf'));var authService=require(_0xa988('0x10'));var qs=require(_0xa988('0x11'));var as=require(_0xa988('0x12'));var hardwareService=require(_0xa988('0x13'));var logger=require(_0xa988('0x14'))(_0xa988('0x15'));var utils=require(_0xa988('0x16'));var config=require(_0xa988('0x17'));var licenseUtil=require(_0xa988('0x18'));var db=require(_0xa988('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x12ffd6,_0x16142d){_0x16142d=_0x16142d||0xcc;return function(_0x3e7bc9){if(_0x3e7bc9){return _0x12ffd6[_0xa988('0x1a')](_0x16142d);}return _0x12ffd6[_0xa988('0x1b')](_0x16142d)[_0xa988('0x1c')]();};}function respondWithResult(_0x5f550a,_0x215206){_0x215206=_0x215206||0xc8;return function(_0x3c8f55){if(_0x3c8f55){return _0x5f550a[_0xa988('0x1b')](_0x215206)[_0xa988('0x1d')](_0x3c8f55);}};}function respondWithFilteredResult(_0x20726c,_0x3e079e){return function(_0x21ecbd){if(_0x21ecbd){var _0x3963b9=typeof _0x3e079e[_0xa988('0x1e')]===_0xa988('0x1f')&&typeof _0x3e079e[_0xa988('0x20')]===_0xa988('0x1f');var _0x8fbe21=_0x21ecbd[_0xa988('0x21')];var _0x46ba86=_0x3963b9?0x0:_0x3e079e[_0xa988('0x1e')];var _0x50bb9e=_0x3963b9?_0x21ecbd[_0xa988('0x21')]:_0x3e079e[_0xa988('0x1e')]+_0x3e079e['limit'];var _0x2e1a65;if(_0x50bb9e>=_0x8fbe21){_0x50bb9e=_0x8fbe21;_0x2e1a65=0xc8;}else{_0x2e1a65=0xce;}_0x20726c['status'](_0x2e1a65);return _0x20726c['set'](_0xa988('0x22'),_0x46ba86+'-'+_0x50bb9e+'/'+_0x8fbe21)[_0xa988('0x1d')](_0x21ecbd);}return null;};}function patchUpdates(_0x3bdd3c){return function(_0x5d959c){try{jsonpatch[_0xa988('0x23')](_0x5d959c,_0x3bdd3c,!![]);}catch(_0x47ad73){return BPromise[_0xa988('0x24')](_0x47ad73);}return _0x5d959c[_0xa988('0x25')]();};}function saveUpdates(_0x56f0b,_0x397b59){return function(_0x58e08c){if(_0x58e08c){return _0x58e08c[_0xa988('0x26')](_0x56f0b)[_0xa988('0x27')](function(_0x5f4360){return _0x5f4360;});}return null;};}function removeEntity(_0x422752,_0x3f81c6){return function(_0x1bfb67){if(_0x1bfb67){return _0x1bfb67[_0xa988('0x28')]()[_0xa988('0x27')](function(){_0x422752[_0xa988('0x1b')](0xcc)[_0xa988('0x1c')]();});}};}function handleEntityNotFound(_0x573999,_0x369c7a){return function(_0xb24972){if(!_0xb24972){_0x573999['sendStatus'](0x194);}return _0xb24972;};}function handleError(_0x591f73,_0x3a2deb){_0x3a2deb=_0x3a2deb||0x1f4;return function(_0x293dd0){logger[_0xa988('0x29')](_0x293dd0[_0xa988('0x2a')]);if(_0x293dd0[_0xa988('0x2b')]){delete _0x293dd0[_0xa988('0x2b')];}_0x591f73[_0xa988('0x1b')](_0x3a2deb)[_0xa988('0x2c')](_0x293dd0);};}exports[_0xa988('0x2d')]=function(_0x436144,_0x56540f){var _0x7886e3={},_0x51a520={},_0x59cfb3={'count':0x0,'rows':[]};var _0x1fa36d=_[_0xa988('0x2e')](db[_0xa988('0x2f')]['rawAttributes'],function(_0x5c18db){return{'name':_0x5c18db[_0xa988('0x30')],'type':_0x5c18db[_0xa988('0x31')][_0xa988('0x32')]};});_0x51a520['model']=_[_0xa988('0x2e')](_0x1fa36d,_0xa988('0x2b'));_0x51a520[_0xa988('0x33')]=_[_0xa988('0x34')](_0x436144[_0xa988('0x33')]);_0x51a520[_0xa988('0x35')]=_[_0xa988('0x36')](_0x51a520['model'],_0x51a520[_0xa988('0x33')]);_0x7886e3[_0xa988('0x37')]=_[_0xa988('0x36')](_0x51a520['model'],qs[_0xa988('0x38')](_0x436144[_0xa988('0x33')][_0xa988('0x38')]));_0x7886e3[_0xa988('0x37')]=_0x7886e3[_0xa988('0x37')][_0xa988('0x39')]?_0x7886e3[_0xa988('0x37')]:_0x51a520[_0xa988('0x3a')];if(!_0x436144[_0xa988('0x33')][_0xa988('0x3b')]('nolimit')){_0x7886e3[_0xa988('0x20')]=qs[_0xa988('0x20')](_0x436144[_0xa988('0x33')][_0xa988('0x20')]);_0x7886e3[_0xa988('0x1e')]=qs[_0xa988('0x1e')](_0x436144[_0xa988('0x33')][_0xa988('0x1e')]);}_0x7886e3[_0xa988('0x3c')]=qs['sort'](_0x436144[_0xa988('0x33')][_0xa988('0x3d')]);_0x7886e3[_0xa988('0x3e')]=qs[_0xa988('0x35')](_[_0xa988('0x3f')](_0x436144['query'],_0x51a520[_0xa988('0x35')]),_0x1fa36d);if(_0x436144[_0xa988('0x33')]['filter']){_0x7886e3[_0xa988('0x3e')]=_[_0xa988('0x40')](_0x7886e3[_0xa988('0x3e')],{'$or':_[_0xa988('0x2e')](_0x1fa36d,function(_0x36b59f){if(_0x36b59f['type']!==_0xa988('0x41')){var _0xfedbb6={};_0xfedbb6[_0x36b59f[_0xa988('0x2b')]]={'$like':'%'+_0x436144['query'][_0xa988('0x42')]+'%'};return _0xfedbb6;}})});}_0x7886e3=_[_0xa988('0x40')]({},_0x7886e3,_0x436144[_0xa988('0x43')]);var _0x34e70d={'where':_0x7886e3['where']};return db['SalesforceAccount']['count'](_0x34e70d)[_0xa988('0x27')](function(_0x535599){_0x59cfb3['count']=_0x535599;if(_0x436144[_0xa988('0x33')][_0xa988('0x44')]){_0x7886e3[_0xa988('0x45')]=[{'all':!![]}];}return db[_0xa988('0x2f')][_0xa988('0x46')](_0x7886e3);})[_0xa988('0x27')](function(_0x39251f){_0x59cfb3['rows']=_0x39251f;return _0x59cfb3;})[_0xa988('0x27')](respondWithFilteredResult(_0x56540f,_0x7886e3))[_0xa988('0x47')](handleError(_0x56540f,null));};exports[_0xa988('0x48')]=function(_0x3eebe4,_0x328dd7){var _0x27e3c7={'raw':![],'where':{'id':_0x3eebe4[_0xa988('0x49')]['id']}},_0x30eca9={};_0x30eca9[_0xa988('0x3a')]=_[_0xa988('0x34')](db[_0xa988('0x2f')]['rawAttributes']);_0x30eca9[_0xa988('0x33')]=_[_0xa988('0x34')](_0x3eebe4[_0xa988('0x33')]);_0x30eca9['filters']=_[_0xa988('0x36')](_0x30eca9[_0xa988('0x3a')],_0x30eca9[_0xa988('0x33')]);_0x27e3c7[_0xa988('0x37')]=_['intersection'](_0x30eca9[_0xa988('0x3a')],qs[_0xa988('0x38')](_0x3eebe4[_0xa988('0x33')][_0xa988('0x38')]));_0x27e3c7[_0xa988('0x37')]=_0x27e3c7['attributes'][_0xa988('0x39')]?_0x27e3c7[_0xa988('0x37')]:_0x30eca9[_0xa988('0x3a')];if(_0x3eebe4[_0xa988('0x33')][_0xa988('0x44')]){_0x27e3c7[_0xa988('0x45')]=[{'all':!![]}];}_0x27e3c7=_[_0xa988('0x40')]({},_0x27e3c7,_0x3eebe4['options']);return db[_0xa988('0x2f')]['find'](_0x27e3c7)[_0xa988('0x27')](handleEntityNotFound(_0x328dd7,null))[_0xa988('0x27')](respondWithResult(_0x328dd7,null))[_0xa988('0x47')](handleError(_0x328dd7,null));};exports['create']=function(_0x1b1b3e,_0x153a28){return db[_0xa988('0x2f')]['create'](_0x1b1b3e[_0xa988('0x4a')],{})['then'](respondWithResult(_0x153a28,0xc9))[_0xa988('0x47')](handleError(_0x153a28,null));};exports['update']=function(_0x5b325f,_0x5b1de3){if(_0x5b325f[_0xa988('0x4a')]['id']){delete _0x5b325f[_0xa988('0x4a')]['id'];}return db[_0xa988('0x2f')][_0xa988('0x4b')]({'where':{'id':_0x5b325f[_0xa988('0x49')]['id']}})[_0xa988('0x27')](handleEntityNotFound(_0x5b1de3,null))[_0xa988('0x27')](saveUpdates(_0x5b325f[_0xa988('0x4a')],null))[_0xa988('0x27')](respondWithResult(_0x5b1de3,null))[_0xa988('0x47')](handleError(_0x5b1de3,null));};exports[_0xa988('0x28')]=function(_0x13a132,_0x686eda){return db[_0xa988('0x2f')]['find']({'where':{'id':_0x13a132[_0xa988('0x49')]['id']}})[_0xa988('0x27')](handleEntityNotFound(_0x686eda,null))[_0xa988('0x27')](removeEntity(_0x686eda,null))['catch'](handleError(_0x686eda,null));};exports[_0xa988('0x4c')]=function(_0x341a68,_0x4da1ce,_0x249936){var _0x4b75ed={};var _0xda0780={};var _0x274e85;var _0x1a5e7c;return db['SalesforceAccount'][_0xa988('0x4d')]({'where':{'id':_0x341a68[_0xa988('0x49')]['id']}})['then'](handleEntityNotFound(_0x4da1ce,null))['then'](function(_0xebd0fb){if(_0xebd0fb){_0x274e85=_0xebd0fb;_0xda0780[_0xa988('0x3a')]=_[_0xa988('0x34')](db[_0xa988('0x4e')][_0xa988('0x4f')]);_0xda0780[_0xa988('0x33')]=_['keys'](_0x341a68['query']);_0xda0780[_0xa988('0x35')]=_['intersection'](_0xda0780['model'],_0xda0780[_0xa988('0x33')]);_0x4b75ed[_0xa988('0x37')]=_[_0xa988('0x36')](_0xda0780['model'],qs[_0xa988('0x38')](_0x341a68[_0xa988('0x33')][_0xa988('0x38')]));_0x4b75ed[_0xa988('0x37')]=_0x4b75ed[_0xa988('0x37')][_0xa988('0x39')]?_0x4b75ed[_0xa988('0x37')]:_0xda0780[_0xa988('0x3a')];_0x4b75ed[_0xa988('0x3c')]=qs[_0xa988('0x3d')](_0x341a68[_0xa988('0x33')]['sort']);_0x4b75ed[_0xa988('0x3e')]=qs['filters'](_['pick'](_0x341a68[_0xa988('0x33')],_0xda0780[_0xa988('0x35')]));if(_0x341a68[_0xa988('0x33')][_0xa988('0x42')]){_0x4b75ed[_0xa988('0x3e')]=_[_0xa988('0x40')](_0x4b75ed['where'],{'$or':_[_0xa988('0x2e')](_0x4b75ed[_0xa988('0x37')],function(_0x3677cd){var _0xd183f2={};_0xd183f2[_0x3677cd]={'$like':'%'+_0x341a68['query']['filter']+'%'};return _0xd183f2;})});}_0x4b75ed=_[_0xa988('0x40')]({},_0x4b75ed,_0x341a68[_0xa988('0x43')]);return _0x274e85[_0xa988('0x4c')](_0x4b75ed);}})['then'](function(_0x46b515){if(_0x46b515){_0x1a5e7c=_0x46b515[_0xa988('0x39')];if(!_0x341a68[_0xa988('0x33')][_0xa988('0x3b')](_0xa988('0x50'))){_0x4b75ed[_0xa988('0x20')]=qs[_0xa988('0x20')](_0x341a68[_0xa988('0x33')][_0xa988('0x20')]);_0x4b75ed[_0xa988('0x1e')]=qs[_0xa988('0x1e')](_0x341a68[_0xa988('0x33')]['offset']);}return _0x274e85[_0xa988('0x4c')](_0x4b75ed);}})[_0xa988('0x27')](function(_0x52a030){if(_0x52a030){return _0x52a030?{'count':_0x1a5e7c,'rows':_0x52a030}:null;}})['then'](respondWithResult(_0x4da1ce,null))['catch'](handleError(_0x4da1ce,null));};exports[_0xa988('0x51')]=function(_0xf5bd2c,_0xa67c3a,_0x894a1){if(_0xf5bd2c[_0xa988('0x4a')]['id']){delete _0xf5bd2c[_0xa988('0x4a')]['id'];}return db[_0xa988('0x2f')]['findOne']({'where':{'id':_0xf5bd2c[_0xa988('0x49')]['id']}})[_0xa988('0x27')](handleEntityNotFound(_0xa67c3a,null))['then'](function(_0x5a1ab1){if(_0x5a1ab1){_0xf5bd2c[_0xa988('0x4a')][_0xa988('0x52')]=_0x5a1ab1['id'];_0xf5bd2c['body'][_0xa988('0x53')]=integrations[_0xa988('0x54')](_0xf5bd2c['body'][_0xa988('0x55')],_0xf5bd2c['body'][_0xa988('0x31')]);_0xf5bd2c['body'][_0xa988('0x56')]=integrations[_0xa988('0x57')](_0xf5bd2c['body'][_0xa988('0x55')],_0xf5bd2c[_0xa988('0x4a')]['type']);return db[_0xa988('0x4e')][_0xa988('0x58')](_0xf5bd2c[_0xa988('0x4a')],{'include':[{'model':db[_0xa988('0x59')],'as':_0xa988('0x53')},{'model':db[_0xa988('0x59')],'as':_0xa988('0x56')}]});}return null;})[_0xa988('0x27')](respondWithResult(_0xa67c3a,null))[_0xa988('0x47')](handleError(_0xa67c3a,null));};exports[_0xa988('0x5a')]=function(_0x372152,_0x5e75a1,_0x442a7c){var _0x3b1f62;var _0x17df49='';var _0x3138cb=_0xa988('0x5b');return db[_0xa988('0x2f')][_0xa988('0x4d')]({'where':{'id':_0x372152[_0xa988('0x49')]['id']},'attributes':['id',_0xa988('0x5c'),_0xa988('0x5d'),_0xa988('0x5e'),'username',_0xa988('0x5f'),_0xa988('0x60')]})['then'](handleEntityNotFound(_0x5e75a1,null))['then'](function(_0x32dd1b){if(_0x32dd1b){_0x17df49=_0x32dd1b[_0xa988('0x5c')];var _0x2102fd=_0x17df49['slice'](-0x1);if(_0x2102fd==='/'){_0x17df49=_0x17df49['substring'](0x0,_0x17df49['lastIndexOf'](_0x2102fd));}_0x3b1f62=new jsforce[(_0xa988('0x61'))]({'oauth2':{'loginUrl':_0x17df49,'clientId':_0x32dd1b[_0xa988('0x5d')],'clientSecret':_0x32dd1b['clientSecret']}});return _0x3b1f62['login'](_0x32dd1b[_0xa988('0x62')],_0x32dd1b[_0xa988('0x5f')]['concat'](_0x32dd1b[_0xa988('0x60')]));}})[_0xa988('0x27')](function(_0x26d22e){if(_0x26d22e){if(!_[_0xa988('0x63')](_0x372152[_0xa988('0x33')][_0xa988('0x64')])){_0x3138cb=_0x372152[_0xa988('0x33')][_0xa988('0x64')];}return _0x3b1f62[_0xa988('0x65')](_0x3138cb)[_0xa988('0x66')]();}})[_0xa988('0x27')](function(_0x35fd7b){var _0x24294c=[_0xa988('0x67'),_0xa988('0x68'),_0xa988('0x69'),_0xa988('0x6a'),_0xa988('0x6b'),'Description'];var _0x294f85=[_0xa988('0x6c'),'int',_0xa988('0x6d'),_0xa988('0x6e'),_0xa988('0x6f'),_0xa988('0x70'),_0xa988('0x71')];if(_0x35fd7b){_[_0xa988('0x72')](_0x35fd7b['fields'],function(_0x5a0111){return _0x24294c[_0xa988('0x73')](_0x5a0111[_0xa988('0x2b')])||!_0x294f85['includes'](_0x5a0111[_0xa988('0x31')]);});return{'count':_0x35fd7b['fields']['length'],'rows':_[_0xa988('0x2e')](_0x35fd7b[_0xa988('0x38')],function(_0x80ebc4){return{'id':_0x80ebc4[_0xa988('0x2b')],'name':_0x80ebc4[_0xa988('0x74')],'custom':_0x80ebc4['custom'],'options':_0x80ebc4['picklistValues'][_0xa988('0x39')]>0x0?_[_0xa988('0x2e')](_0x80ebc4[_0xa988('0x75')],function(_0x4c72eb){return{'name':_0x4c72eb[_0xa988('0x74')],'value':_0x4c72eb[_0xa988('0x76')]};}):_0x80ebc4[_0xa988('0x31')]==_0xa988('0x6e')?[{'name':'True','value':_0xa988('0x77')},{'name':_0xa988('0x78'),'value':'false'}]:[]};})};}})[_0xa988('0x27')](respondWithResult(_0x5e75a1,null))[_0xa988('0x47')](function(_0xb80dd0){var _0x3fede1=_0x372152[_0xa988('0x33')]['test']?0x1f4:_0xb80dd0['statusCode']||0x1f4;logger[_0xa988('0x29')](_0xa988('0x79'),_0xa988('0x5a'),_0x3fede1,JSON[_0xa988('0x7a')](_0xb80dd0));delete _0xb80dd0[_0xa988('0x2b')];if(_0x3fede1===0x191){_0x3fede1=0x190;}_0x5e75a1[_0xa988('0x1b')](_0x3fede1)[_0xa988('0x2c')](_0x372152[_0xa988('0x33')][_0xa988('0x7b')]?{'message':_0xa988('0x7c'),'statusCode':_0xb80dd0['statusCode']}:_0xb80dd0);});}; \ No newline at end of file +var _0xbe7d=['SalesforceConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','login','password','concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','false','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','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','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','getConfigurations','findOne'];(function(_0x3341b6,_0x338500){var _0x41491b=function(_0x267b91){while(--_0x267b91){_0x3341b6['push'](_0x3341b6['shift']());}};_0x41491b(++_0x338500);}(_0xbe7d,0x1b7));var _0xdbe7=function(_0x24502d,_0x3a7c6f){_0x24502d=_0x24502d-0x0;var _0xd3f48c=_0xbe7d[_0x24502d];return _0xd3f48c;};'use strict';var emlformat=require(_0xdbe7('0x0'));var rimraf=require(_0xdbe7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdbe7('0x2'));var moment=require(_0xdbe7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdbe7('0x4'));var util=require(_0xdbe7('0x5'));var path=require(_0xdbe7('0x6'));var sox=require(_0xdbe7('0x7'));var csv=require(_0xdbe7('0x8'));var ejs=require(_0xdbe7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdbe7('0xa'));var crypto=require(_0xdbe7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdbe7('0xc'));var Papa=require(_0xdbe7('0xd'));var Redis=require(_0xdbe7('0xe'));var authService=require(_0xdbe7('0xf'));var qs=require(_0xdbe7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbe7('0x11'));var logger=require(_0xdbe7('0x12'))(_0xdbe7('0x13'));var utils=require(_0xdbe7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdbe7('0x15'));var db=require(_0xdbe7('0x16'))['db'];var integrations=require(_0xdbe7('0x17'));function respondWithStatusCode(_0x2f9d12,_0x1657a4){_0x1657a4=_0x1657a4||0xcc;return function(_0xc84db7){if(_0xc84db7){return _0x2f9d12[_0xdbe7('0x18')](_0x1657a4);}return _0x2f9d12[_0xdbe7('0x19')](_0x1657a4)[_0xdbe7('0x1a')]();};}function respondWithResult(_0x5b07bb,_0x4e1d8d){_0x4e1d8d=_0x4e1d8d||0xc8;return function(_0x37a069){if(_0x37a069){return _0x5b07bb[_0xdbe7('0x19')](_0x4e1d8d)[_0xdbe7('0x1b')](_0x37a069);}};}function respondWithFilteredResult(_0x337083,_0x16ead1){return function(_0x14b205){if(_0x14b205){var _0xdc736a=typeof _0x16ead1['offset']===_0xdbe7('0x1c')&&typeof _0x16ead1[_0xdbe7('0x1d')]==='undefined';var _0xc8ad3=_0x14b205[_0xdbe7('0x1e')];var _0x2cd9f2=_0xdc736a?0x0:_0x16ead1[_0xdbe7('0x1f')];var _0x254159=_0xdc736a?_0x14b205[_0xdbe7('0x1e')]:_0x16ead1[_0xdbe7('0x1f')]+_0x16ead1[_0xdbe7('0x1d')];var _0x41e4d3;if(_0x254159>=_0xc8ad3){_0x254159=_0xc8ad3;_0x41e4d3=0xc8;}else{_0x41e4d3=0xce;}_0x337083[_0xdbe7('0x19')](_0x41e4d3);return _0x337083[_0xdbe7('0x20')](_0xdbe7('0x21'),_0x2cd9f2+'-'+_0x254159+'/'+_0xc8ad3)[_0xdbe7('0x1b')](_0x14b205);}return null;};}function patchUpdates(_0x2310a9){return function(_0x5da9f8){try{jsonpatch[_0xdbe7('0x22')](_0x5da9f8,_0x2310a9,!![]);}catch(_0x379743){return BPromise['reject'](_0x379743);}return _0x5da9f8[_0xdbe7('0x23')]();};}function saveUpdates(_0x146aa4,_0xe0db93){return function(_0x3f132d){if(_0x3f132d){return _0x3f132d[_0xdbe7('0x24')](_0x146aa4)['then'](function(_0x4e6ada){return _0x4e6ada;});}return null;};}function removeEntity(_0x180cf5,_0x45c640){return function(_0x1a07dd){if(_0x1a07dd){return _0x1a07dd[_0xdbe7('0x25')]()[_0xdbe7('0x26')](function(){_0x180cf5[_0xdbe7('0x19')](0xcc)[_0xdbe7('0x1a')]();});}};}function handleEntityNotFound(_0x49d65e,_0x2dfb2f){return function(_0x37cda5){if(!_0x37cda5){_0x49d65e[_0xdbe7('0x18')](0x194);}return _0x37cda5;};}function handleError(_0x59bcd8,_0x4e3de0){_0x4e3de0=_0x4e3de0||0x1f4;return function(_0x2164ba){logger['error'](_0x2164ba[_0xdbe7('0x27')]);if(_0x2164ba[_0xdbe7('0x28')]){delete _0x2164ba[_0xdbe7('0x28')];}_0x59bcd8[_0xdbe7('0x19')](_0x4e3de0)[_0xdbe7('0x29')](_0x2164ba);};}exports[_0xdbe7('0x2a')]=function(_0x303cea,_0x164dc3){var _0x3f0233={},_0x4b3d39={},_0x345600={'count':0x0,'rows':[]};var _0x38e3e3=_[_0xdbe7('0x2b')](db[_0xdbe7('0x2c')]['rawAttributes'],function(_0x2c7d88){return{'name':_0x2c7d88[_0xdbe7('0x2d')],'type':_0x2c7d88[_0xdbe7('0x2e')][_0xdbe7('0x2f')]};});_0x4b3d39[_0xdbe7('0x30')]=_[_0xdbe7('0x2b')](_0x38e3e3,'name');_0x4b3d39[_0xdbe7('0x31')]=_[_0xdbe7('0x32')](_0x303cea['query']);_0x4b3d39[_0xdbe7('0x33')]=_[_0xdbe7('0x34')](_0x4b3d39[_0xdbe7('0x30')],_0x4b3d39[_0xdbe7('0x31')]);_0x3f0233[_0xdbe7('0x35')]=_[_0xdbe7('0x34')](_0x4b3d39['model'],qs[_0xdbe7('0x36')](_0x303cea[_0xdbe7('0x31')][_0xdbe7('0x36')]));_0x3f0233['attributes']=_0x3f0233['attributes'][_0xdbe7('0x37')]?_0x3f0233[_0xdbe7('0x35')]:_0x4b3d39[_0xdbe7('0x30')];if(!_0x303cea[_0xdbe7('0x31')][_0xdbe7('0x38')](_0xdbe7('0x39'))){_0x3f0233[_0xdbe7('0x1d')]=qs[_0xdbe7('0x1d')](_0x303cea[_0xdbe7('0x31')][_0xdbe7('0x1d')]);_0x3f0233[_0xdbe7('0x1f')]=qs[_0xdbe7('0x1f')](_0x303cea[_0xdbe7('0x31')][_0xdbe7('0x1f')]);}_0x3f0233[_0xdbe7('0x3a')]=qs[_0xdbe7('0x3b')](_0x303cea[_0xdbe7('0x31')]['sort']);_0x3f0233[_0xdbe7('0x3c')]=qs['filters'](_[_0xdbe7('0x3d')](_0x303cea['query'],_0x4b3d39[_0xdbe7('0x33')]),_0x38e3e3);if(_0x303cea['query'][_0xdbe7('0x3e')]){_0x3f0233[_0xdbe7('0x3c')]=_['merge'](_0x3f0233[_0xdbe7('0x3c')],{'$or':_['map'](_0x38e3e3,function(_0xe4a3fe){if(_0xe4a3fe['type']!==_0xdbe7('0x3f')){var _0x54ae28={};_0x54ae28[_0xe4a3fe[_0xdbe7('0x28')]]={'$like':'%'+_0x303cea['query']['filter']+'%'};return _0x54ae28;}})});}_0x3f0233=_[_0xdbe7('0x40')]({},_0x3f0233,_0x303cea[_0xdbe7('0x41')]);var _0x466a36={'where':_0x3f0233[_0xdbe7('0x3c')]};return db[_0xdbe7('0x2c')][_0xdbe7('0x1e')](_0x466a36)['then'](function(_0x9d6534){_0x345600[_0xdbe7('0x1e')]=_0x9d6534;if(_0x303cea['query'][_0xdbe7('0x42')]){_0x3f0233[_0xdbe7('0x43')]=[{'all':!![]}];}return db[_0xdbe7('0x2c')][_0xdbe7('0x44')](_0x3f0233);})['then'](function(_0x4ac766){_0x345600[_0xdbe7('0x45')]=_0x4ac766;return _0x345600;})[_0xdbe7('0x26')](respondWithFilteredResult(_0x164dc3,_0x3f0233))[_0xdbe7('0x46')](handleError(_0x164dc3,null));};exports['show']=function(_0x4a7b3f,_0x516ca6){var _0x16fe1d={'raw':![],'where':{'id':_0x4a7b3f[_0xdbe7('0x47')]['id']}},_0xb884a1={};_0xb884a1[_0xdbe7('0x30')]=_[_0xdbe7('0x32')](db[_0xdbe7('0x2c')]['rawAttributes']);_0xb884a1['query']=_[_0xdbe7('0x32')](_0x4a7b3f[_0xdbe7('0x31')]);_0xb884a1[_0xdbe7('0x33')]=_[_0xdbe7('0x34')](_0xb884a1[_0xdbe7('0x30')],_0xb884a1['query']);_0x16fe1d[_0xdbe7('0x35')]=_[_0xdbe7('0x34')](_0xb884a1[_0xdbe7('0x30')],qs[_0xdbe7('0x36')](_0x4a7b3f['query'][_0xdbe7('0x36')]));_0x16fe1d[_0xdbe7('0x35')]=_0x16fe1d[_0xdbe7('0x35')][_0xdbe7('0x37')]?_0x16fe1d['attributes']:_0xb884a1[_0xdbe7('0x30')];if(_0x4a7b3f[_0xdbe7('0x31')][_0xdbe7('0x42')]){_0x16fe1d[_0xdbe7('0x43')]=[{'all':!![]}];}_0x16fe1d=_['merge']({},_0x16fe1d,_0x4a7b3f[_0xdbe7('0x41')]);return db[_0xdbe7('0x2c')]['find'](_0x16fe1d)['then'](handleEntityNotFound(_0x516ca6,null))['then'](respondWithResult(_0x516ca6,null))[_0xdbe7('0x46')](handleError(_0x516ca6,null));};exports[_0xdbe7('0x48')]=function(_0x36596e,_0x108274){return db['SalesforceAccount'][_0xdbe7('0x48')](_0x36596e[_0xdbe7('0x49')],{})[_0xdbe7('0x26')](respondWithResult(_0x108274,0xc9))['catch'](handleError(_0x108274,null));};exports[_0xdbe7('0x24')]=function(_0x855b78,_0x1bfd59){if(_0x855b78[_0xdbe7('0x49')]['id']){delete _0x855b78[_0xdbe7('0x49')]['id'];}return db[_0xdbe7('0x2c')][_0xdbe7('0x4a')]({'where':{'id':_0x855b78['params']['id']}})[_0xdbe7('0x26')](handleEntityNotFound(_0x1bfd59,null))['then'](saveUpdates(_0x855b78[_0xdbe7('0x49')],null))[_0xdbe7('0x26')](respondWithResult(_0x1bfd59,null))[_0xdbe7('0x46')](handleError(_0x1bfd59,null));};exports[_0xdbe7('0x25')]=function(_0x2d6727,_0x328f36){return db[_0xdbe7('0x2c')]['find']({'where':{'id':_0x2d6727[_0xdbe7('0x47')]['id']}})[_0xdbe7('0x26')](handleEntityNotFound(_0x328f36,null))['then'](removeEntity(_0x328f36,null))[_0xdbe7('0x46')](handleError(_0x328f36,null));};exports[_0xdbe7('0x4b')]=function(_0x3a382c,_0x4cfd2e,_0x2dcf39){var _0xbfe497={};var _0x2560a0={};var _0x1d7444;var _0x386d7f;return db[_0xdbe7('0x2c')][_0xdbe7('0x4c')]({'where':{'id':_0x3a382c[_0xdbe7('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cfd2e,null))[_0xdbe7('0x26')](function(_0x5596ec){if(_0x5596ec){_0x1d7444=_0x5596ec;_0x2560a0[_0xdbe7('0x30')]=_[_0xdbe7('0x32')](db[_0xdbe7('0x4d')][_0xdbe7('0x4e')]);_0x2560a0['query']=_[_0xdbe7('0x32')](_0x3a382c[_0xdbe7('0x31')]);_0x2560a0[_0xdbe7('0x33')]=_[_0xdbe7('0x34')](_0x2560a0[_0xdbe7('0x30')],_0x2560a0['query']);_0xbfe497['attributes']=_[_0xdbe7('0x34')](_0x2560a0[_0xdbe7('0x30')],qs[_0xdbe7('0x36')](_0x3a382c[_0xdbe7('0x31')][_0xdbe7('0x36')]));_0xbfe497[_0xdbe7('0x35')]=_0xbfe497[_0xdbe7('0x35')]['length']?_0xbfe497[_0xdbe7('0x35')]:_0x2560a0[_0xdbe7('0x30')];_0xbfe497[_0xdbe7('0x3a')]=qs[_0xdbe7('0x3b')](_0x3a382c[_0xdbe7('0x31')]['sort']);_0xbfe497[_0xdbe7('0x3c')]=qs['filters'](_[_0xdbe7('0x3d')](_0x3a382c[_0xdbe7('0x31')],_0x2560a0[_0xdbe7('0x33')]));if(_0x3a382c[_0xdbe7('0x31')][_0xdbe7('0x3e')]){_0xbfe497[_0xdbe7('0x3c')]=_['merge'](_0xbfe497['where'],{'$or':_[_0xdbe7('0x2b')](_0xbfe497[_0xdbe7('0x35')],function(_0x37e795){var _0x402203={};_0x402203[_0x37e795]={'$like':'%'+_0x3a382c[_0xdbe7('0x31')][_0xdbe7('0x3e')]+'%'};return _0x402203;})});}_0xbfe497=_['merge']({},_0xbfe497,_0x3a382c['options']);return _0x1d7444[_0xdbe7('0x4b')](_0xbfe497);}})[_0xdbe7('0x26')](function(_0x41643e){if(_0x41643e){_0x386d7f=_0x41643e[_0xdbe7('0x37')];if(!_0x3a382c[_0xdbe7('0x31')]['hasOwnProperty'](_0xdbe7('0x39'))){_0xbfe497[_0xdbe7('0x1d')]=qs[_0xdbe7('0x1d')](_0x3a382c[_0xdbe7('0x31')][_0xdbe7('0x1d')]);_0xbfe497[_0xdbe7('0x1f')]=qs[_0xdbe7('0x1f')](_0x3a382c[_0xdbe7('0x31')][_0xdbe7('0x1f')]);}return _0x1d7444['getConfigurations'](_0xbfe497);}})[_0xdbe7('0x26')](function(_0x2bc529){if(_0x2bc529){return _0x2bc529?{'count':_0x386d7f,'rows':_0x2bc529}:null;}})[_0xdbe7('0x26')](respondWithResult(_0x4cfd2e,null))[_0xdbe7('0x46')](handleError(_0x4cfd2e,null));};exports[_0xdbe7('0x4f')]=function(_0x2e4b7c,_0x4ac815,_0x431e2e){if(_0x2e4b7c[_0xdbe7('0x49')]['id']){delete _0x2e4b7c[_0xdbe7('0x49')]['id'];}return db[_0xdbe7('0x2c')][_0xdbe7('0x4c')]({'where':{'id':_0x2e4b7c[_0xdbe7('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ac815,null))[_0xdbe7('0x26')](function(_0x4d7f40){if(_0x4d7f40){_0x2e4b7c[_0xdbe7('0x49')][_0xdbe7('0x50')]=_0x4d7f40['id'];_0x2e4b7c[_0xdbe7('0x49')][_0xdbe7('0x51')]=integrations['getSubjects'](_0x2e4b7c['body'][_0xdbe7('0x52')],_0x2e4b7c[_0xdbe7('0x49')][_0xdbe7('0x2e')]);_0x2e4b7c[_0xdbe7('0x49')][_0xdbe7('0x53')]=integrations[_0xdbe7('0x54')](_0x2e4b7c[_0xdbe7('0x49')]['channel'],_0x2e4b7c['body']['type']);return db['SalesforceConfiguration'][_0xdbe7('0x48')](_0x2e4b7c[_0xdbe7('0x49')],{'include':[{'model':db[_0xdbe7('0x55')],'as':_0xdbe7('0x51')},{'model':db[_0xdbe7('0x55')],'as':'Descriptions'}]});}return null;})[_0xdbe7('0x26')](respondWithResult(_0x4ac815,null))[_0xdbe7('0x46')](handleError(_0x4ac815,null));};exports['getFields']=function(_0x1722e8,_0x253f37,_0x4c3114){var _0x4cd8dd;var _0x2e46df='';var _0x3b93f3=_0xdbe7('0x56');return db[_0xdbe7('0x2c')][_0xdbe7('0x4c')]({'where':{'id':_0x1722e8[_0xdbe7('0x47')]['id']},'attributes':['id',_0xdbe7('0x57'),_0xdbe7('0x58'),_0xdbe7('0x59'),_0xdbe7('0x5a'),'password',_0xdbe7('0x5b')]})[_0xdbe7('0x26')](handleEntityNotFound(_0x253f37,null))[_0xdbe7('0x26')](function(_0x5bc28f){if(_0x5bc28f){_0x2e46df=_0x5bc28f['remoteUri'];var _0x26b43a=_0x2e46df[_0xdbe7('0x5c')](-0x1);if(_0x26b43a==='/'){_0x2e46df=_0x2e46df[_0xdbe7('0x5d')](0x0,_0x2e46df[_0xdbe7('0x5e')](_0x26b43a));}_0x4cd8dd=new jsforce[(_0xdbe7('0x5f'))]({'oauth2':{'loginUrl':_0x2e46df,'clientId':_0x5bc28f[_0xdbe7('0x58')],'clientSecret':_0x5bc28f[_0xdbe7('0x59')]}});return _0x4cd8dd[_0xdbe7('0x60')](_0x5bc28f['username'],_0x5bc28f[_0xdbe7('0x61')][_0xdbe7('0x62')](_0x5bc28f['securityToken']));}})[_0xdbe7('0x26')](function(_0x1e27d5){if(_0x1e27d5){if(!_['isNil'](_0x1722e8[_0xdbe7('0x31')][_0xdbe7('0x63')])){_0x3b93f3=_0x1722e8[_0xdbe7('0x31')][_0xdbe7('0x63')];}return _0x4cd8dd[_0xdbe7('0x64')](_0x3b93f3)['describe']();}})[_0xdbe7('0x26')](function(_0x388d86){var _0x581885=[_0xdbe7('0x65'),_0xdbe7('0x66'),_0xdbe7('0x67'),_0xdbe7('0x68'),_0xdbe7('0x69'),_0xdbe7('0x6a')];var _0x52f659=[_0xdbe7('0x6b'),_0xdbe7('0x6c'),_0xdbe7('0x6d'),_0xdbe7('0x6e'),_0xdbe7('0x6f'),_0xdbe7('0x70'),_0xdbe7('0x71')];if(_0x388d86){_[_0xdbe7('0x72')](_0x388d86['fields'],function(_0x4165a3){return _0x581885[_0xdbe7('0x73')](_0x4165a3[_0xdbe7('0x28')])||!_0x52f659[_0xdbe7('0x73')](_0x4165a3[_0xdbe7('0x2e')]);});return{'count':_0x388d86[_0xdbe7('0x36')][_0xdbe7('0x37')],'rows':_[_0xdbe7('0x2b')](_0x388d86[_0xdbe7('0x36')],function(_0x23ddf9){return{'id':_0x23ddf9[_0xdbe7('0x28')],'name':_0x23ddf9[_0xdbe7('0x74')],'custom':_0x23ddf9[_0xdbe7('0x75')],'options':_0x23ddf9['picklistValues']['length']>0x0?_[_0xdbe7('0x2b')](_0x23ddf9[_0xdbe7('0x76')],function(_0x2e520d){return{'name':_0x2e520d[_0xdbe7('0x74')],'value':_0x2e520d[_0xdbe7('0x77')]};}):_0x23ddf9[_0xdbe7('0x2e')]==_0xdbe7('0x6e')?[{'name':_0xdbe7('0x78'),'value':_0xdbe7('0x79')},{'name':'False','value':_0xdbe7('0x7a')}]:[]};})};}})[_0xdbe7('0x26')](respondWithResult(_0x253f37,null))['catch'](function(_0x2c27c6){var _0xcfaafd=_0x1722e8[_0xdbe7('0x31')][_0xdbe7('0x7b')]?0x1f4:_0x2c27c6['statusCode']||0x1f4;logger['error'](_0xdbe7('0x7c'),_0xdbe7('0x7d'),_0xcfaafd,JSON[_0xdbe7('0x7e')](_0x2c27c6));delete _0x2c27c6[_0xdbe7('0x28')];if(_0xcfaafd===0x191){_0xcfaafd=0x190;}_0x253f37['status'](_0xcfaafd)[_0xdbe7('0x29')](_0x1722e8['query']['test']?{'message':_0xdbe7('0x7f'),'statusCode':_0x2c27c6[_0xdbe7('0x80')]}:_0x2c27c6);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b8ad0e0..886ffa5 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 _0xf975=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','util','../../config/logger','api','moment','path','rimraf'];(function(_0x337736,_0x4a117d){var _0x40a747=function(_0x13e9d3){while(--_0x13e9d3){_0x337736['push'](_0x337736['shift']());}};_0x40a747(++_0x4a117d);}(_0xf975,0x1c8));var _0x5f97=function(_0x312c87,_0x336076){_0x312c87=_0x312c87-0x0;var _0x3f4a1a=_0xf975[_0x312c87];return _0x3f4a1a;};'use strict';var _=require('lodash');var util=require(_0x5f97('0x0'));var logger=require(_0x5f97('0x1'))(_0x5f97('0x2'));var moment=require(_0x5f97('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f97('0x4'));var rimraf=require(_0x5f97('0x5'));var config=require(_0x5f97('0x6'));var attributes=require(_0x5f97('0x7'));var integrations=require(_0x5f97('0x8'));module['exports']=function(_0x33ef5e,_0x1e3731){return _0x33ef5e[_0x5f97('0x9')]('SalesforceAccount',attributes,{'tableName':_0x5f97('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aa7=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x34421e,_0xf309a2){var _0x5725d7=function(_0x367fbf){while(--_0x367fbf){_0x34421e['push'](_0x34421e['shift']());}};_0x5725d7(++_0xf309a2);}(_0x8aa7,0xb6));var _0x78aa=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x8aa7[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var logger=require(_0x78aa('0x1'))(_0x78aa('0x2'));var moment=require(_0x78aa('0x3'));var BPromise=require(_0x78aa('0x4'));var rp=require(_0x78aa('0x5'));var fs=require('fs');var path=require(_0x78aa('0x6'));var rimraf=require('rimraf');var config=require(_0x78aa('0x7'));var attributes=require(_0x78aa('0x8'));var integrations=require(_0x78aa('0x9'));module[_0x78aa('0xa')]=function(_0x2d17c2,_0x369ee7){return _0x2d17c2[_0x78aa('0xb')](_0x78aa('0xc'),attributes,{'tableName':_0x78aa('0xd'),'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 c2ab2ca..58277ec 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 _0x7939=['where','attributes','limit','map','model','include','then','debug','GetSalesforceAccount','catch','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','findAll','raw','options'];(function(_0x2340bd,_0x4aa281){var _0x233a59=function(_0x2b47e9){while(--_0x2b47e9){_0x2340bd['push'](_0x2340bd['shift']());}};_0x233a59(++_0x4aa281);}(_0x7939,0x11c));var _0x9793=function(_0x5272cf,_0x5460bb){_0x5272cf=_0x5272cf-0x0;var _0x5e5f62=_0x7939[_0x5272cf];return _0x5e5f62;};'use strict';var _=require('lodash');var util=require(_0x9793('0x0'));var moment=require(_0x9793('0x1'));var BPromise=require(_0x9793('0x2'));var rs=require(_0x9793('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9793('0x4'))(_0x9793('0x5'));var config=require(_0x9793('0x6'));var jayson=require(_0x9793('0x7'));var client=jayson[_0x9793('0x8')][_0x9793('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31ea17,_0x508f94,_0x1a2859){return new BPromise(function(_0x8ab0eb,_0x45bbff){return client[_0x9793('0xa')](_0x31ea17,_0x1a2859)['then'](function(_0x3901f3){logger['info'](_0x9793('0xb'),_0x508f94,_0x9793('0xc'));logger['debug'](_0x9793('0xd'),_0x508f94,_0x9793('0xc'),JSON[_0x9793('0xe')](_0x3901f3));if(_0x3901f3[_0x9793('0xf')]){if(_0x3901f3[_0x9793('0xf')]['code']===0x1f4){logger['error'](_0x9793('0xb'),_0x508f94,_0x3901f3[_0x9793('0xf')][_0x9793('0x10')]);return _0x45bbff(_0x3901f3[_0x9793('0xf')][_0x9793('0x10')]);}logger[_0x9793('0xf')](_0x9793('0xb'),_0x508f94,_0x3901f3[_0x9793('0xf')][_0x9793('0x10')]);return _0x8ab0eb(_0x3901f3[_0x9793('0xf')][_0x9793('0x10')]);}else{logger[_0x9793('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x508f94,_0x9793('0xc'));_0x8ab0eb(_0x3901f3[_0x9793('0x12')]['message']);}})['catch'](function(_0x16aa79){logger['error'](_0x9793('0xb'),_0x508f94,_0x16aa79);_0x45bbff(_0x16aa79);});});}exports['GetSalesforceAccount']=function(_0x372fd2){var _0x41617c=this;return new Promise(function(_0x3e7771,_0x5f02b3){return db['SalesforceAccount'][_0x9793('0x13')]({'raw':_0x372fd2['options']?_0x372fd2['options'][_0x9793('0x14')]===undefined?!![]:![]:!![],'where':_0x372fd2['options']?_0x372fd2[_0x9793('0x15')][_0x9793('0x16')]||null:null,'attributes':_0x372fd2[_0x9793('0x15')]?_0x372fd2[_0x9793('0x15')][_0x9793('0x17')]||null:null,'limit':_0x372fd2['options']?_0x372fd2[_0x9793('0x15')][_0x9793('0x18')]||null:null,'include':_0x372fd2['options']?_0x372fd2[_0x9793('0x15')]['include']?_[_0x9793('0x19')](_0x372fd2[_0x9793('0x15')]['include'],function(_0x4eacb2){return{'model':db[_0x4eacb2[_0x9793('0x1a')]],'as':_0x4eacb2['as'],'attributes':_0x4eacb2[_0x9793('0x17')],'include':_0x4eacb2[_0x9793('0x1b')]?_['map'](_0x4eacb2[_0x9793('0x1b')],function(_0xd94215){return{'model':db[_0xd94215[_0x9793('0x1a')]],'as':_0xd94215['as'],'attributes':_0xd94215[_0x9793('0x17')],'include':_0xd94215[_0x9793('0x1b')]?_[_0x9793('0x19')](_0xd94215[_0x9793('0x1b')],function(_0x38ddbf){return{'model':db[_0x38ddbf[_0x9793('0x1a')]],'as':_0x38ddbf['as'],'attributes':_0x38ddbf[_0x9793('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9793('0x1c')](function(_0xf8e48d){logger[_0x9793('0x11')]('GetSalesforceAccount',_0x372fd2);logger[_0x9793('0x1d')](_0x9793('0x1e'),_0x372fd2,JSON[_0x9793('0xe')](_0xf8e48d));_0x3e7771(_0xf8e48d);})[_0x9793('0x1f')](function(_0x481e8a){logger[_0x9793('0xf')](_0x9793('0x1e'),_0x481e8a['message'],_0x372fd2);_0x5f02b3(_0x41617c[_0x9793('0xf')](0x1f4,_0x481e8a[_0x9793('0x10')]));});});};exports[_0x9793('0x20')]=function(_0x53ba5f){var _0x3afde6=this;return new Promise(function(_0x3a8897,_0x35e785){return db['SalesforceAccount'][_0x9793('0x21')]({'raw':_0x53ba5f[_0x9793('0x15')]?_0x53ba5f['options'][_0x9793('0x14')]===undefined?!![]:![]:!![],'where':_0x53ba5f[_0x9793('0x15')]?_0x53ba5f['options'][_0x9793('0x16')]||null:null,'attributes':_0x53ba5f[_0x9793('0x15')]?_0x53ba5f[_0x9793('0x15')][_0x9793('0x17')]||null:null,'include':_0x53ba5f[_0x9793('0x15')]?_0x53ba5f[_0x9793('0x15')][_0x9793('0x1b')]?_[_0x9793('0x19')](_0x53ba5f[_0x9793('0x15')][_0x9793('0x1b')],function(_0x3e8a6f){return{'model':db[_0x3e8a6f[_0x9793('0x1a')]],'as':_0x3e8a6f['as'],'attributes':_0x3e8a6f['attributes'],'include':_0x3e8a6f[_0x9793('0x1b')]?_[_0x9793('0x19')](_0x3e8a6f[_0x9793('0x1b')],function(_0x56ec91){return{'model':db[_0x56ec91['model']],'as':_0x56ec91['as'],'attributes':_0x56ec91['attributes'],'include':_0x56ec91[_0x9793('0x1b')]?_['map'](_0x56ec91[_0x9793('0x1b')],function(_0x41d93a){return{'model':db[_0x41d93a[_0x9793('0x1a')]],'as':_0x41d93a['as'],'attributes':_0x41d93a[_0x9793('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9793('0x1c')](function(_0x74cd7){logger[_0x9793('0x11')](_0x9793('0x20'),_0x53ba5f);logger['debug'](_0x9793('0x20'),_0x53ba5f,JSON[_0x9793('0xe')](_0x74cd7));_0x3a8897(_0x74cd7);})[_0x9793('0x1f')](function(_0x1ff1c8){logger[_0x9793('0xf')]('ShowSalesforceAccount',_0x1ff1c8['message'],_0x53ba5f);_0x35e785(_0x3afde6[_0x9793('0xf')](0x1f4,_0x1ff1c8[_0x9793('0x10')]));});});}; \ No newline at end of file +var _0x03d3=['result','SalesforceAccount','options','raw','where','attributes','limit','map','model','include','debug','GetSalesforceAccount','ShowSalesforceAccount','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message'];(function(_0x538421,_0x3fb2ff){var _0x1d7e2d=function(_0x156ff5){while(--_0x156ff5){_0x538421['push'](_0x538421['shift']());}};_0x1d7e2d(++_0x3fb2ff);}(_0x03d3,0xda));var _0x303d=function(_0x22a714,_0x29bb8c){_0x22a714=_0x22a714-0x0;var _0x12e1f6=_0x03d3[_0x22a714];return _0x12e1f6;};'use strict';var _=require(_0x303d('0x0'));var util=require(_0x303d('0x1'));var moment=require(_0x303d('0x2'));var BPromise=require('bluebird');var rs=require(_0x303d('0x3'));var fs=require('fs');var Redis=require(_0x303d('0x4'));var db=require(_0x303d('0x5'))['db'];var utils=require(_0x303d('0x6'));var logger=require(_0x303d('0x7'))(_0x303d('0x8'));var config=require(_0x303d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x303d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18e81c,_0xc434d,_0x36dc3e){return new BPromise(function(_0x315adc,_0xfdbdde){return client[_0x303d('0xb')](_0x18e81c,_0x36dc3e)[_0x303d('0xc')](function(_0x1327e5){logger[_0x303d('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0xc434d,_0x303d('0xe'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xc434d,'request\x20sent',JSON[_0x303d('0xf')](_0x1327e5));if(_0x1327e5[_0x303d('0x10')]){if(_0x1327e5[_0x303d('0x10')][_0x303d('0x11')]===0x1f4){logger[_0x303d('0x10')](_0x303d('0x12'),_0xc434d,_0x1327e5['error']['message']);return _0xfdbdde(_0x1327e5[_0x303d('0x10')][_0x303d('0x13')]);}logger[_0x303d('0x10')](_0x303d('0x12'),_0xc434d,_0x1327e5[_0x303d('0x10')]['message']);return _0x315adc(_0x1327e5[_0x303d('0x10')][_0x303d('0x13')]);}else{logger[_0x303d('0xd')](_0x303d('0x12'),_0xc434d,'request\x20sent');_0x315adc(_0x1327e5[_0x303d('0x14')]['message']);}})['catch'](function(_0x53e162){logger[_0x303d('0x10')](_0x303d('0x12'),_0xc434d,_0x53e162);_0xfdbdde(_0x53e162);});});}exports['GetSalesforceAccount']=function(_0x5f3ada){var _0x1545d5=this;return new Promise(function(_0x415113,_0x2b83c1){return db[_0x303d('0x15')]['findAll']({'raw':_0x5f3ada['options']?_0x5f3ada[_0x303d('0x16')][_0x303d('0x17')]===undefined?!![]:![]:!![],'where':_0x5f3ada[_0x303d('0x16')]?_0x5f3ada[_0x303d('0x16')][_0x303d('0x18')]||null:null,'attributes':_0x5f3ada[_0x303d('0x16')]?_0x5f3ada[_0x303d('0x16')][_0x303d('0x19')]||null:null,'limit':_0x5f3ada['options']?_0x5f3ada[_0x303d('0x16')][_0x303d('0x1a')]||null:null,'include':_0x5f3ada[_0x303d('0x16')]?_0x5f3ada['options']['include']?_[_0x303d('0x1b')](_0x5f3ada[_0x303d('0x16')]['include'],function(_0x32cb7c){return{'model':db[_0x32cb7c[_0x303d('0x1c')]],'as':_0x32cb7c['as'],'attributes':_0x32cb7c[_0x303d('0x19')],'include':_0x32cb7c[_0x303d('0x1d')]?_[_0x303d('0x1b')](_0x32cb7c['include'],function(_0x7ee3d4){return{'model':db[_0x7ee3d4[_0x303d('0x1c')]],'as':_0x7ee3d4['as'],'attributes':_0x7ee3d4[_0x303d('0x19')],'include':_0x7ee3d4[_0x303d('0x1d')]?_['map'](_0x7ee3d4[_0x303d('0x1d')],function(_0x1cb3c5){return{'model':db[_0x1cb3c5[_0x303d('0x1c')]],'as':_0x1cb3c5['as'],'attributes':_0x1cb3c5[_0x303d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3352da){logger[_0x303d('0xd')]('GetSalesforceAccount',_0x5f3ada);logger[_0x303d('0x1e')](_0x303d('0x1f'),_0x5f3ada,JSON[_0x303d('0xf')](_0x3352da));_0x415113(_0x3352da);})['catch'](function(_0x270cd4){logger[_0x303d('0x10')](_0x303d('0x1f'),_0x270cd4[_0x303d('0x13')],_0x5f3ada);_0x2b83c1(_0x1545d5[_0x303d('0x10')](0x1f4,_0x270cd4['message']));});});};exports[_0x303d('0x20')]=function(_0x19407b){var _0x231f12=this;return new Promise(function(_0x362730,_0x51793d){return db['SalesforceAccount']['find']({'raw':_0x19407b[_0x303d('0x16')]?_0x19407b[_0x303d('0x16')][_0x303d('0x17')]===undefined?!![]:![]:!![],'where':_0x19407b[_0x303d('0x16')]?_0x19407b['options'][_0x303d('0x18')]||null:null,'attributes':_0x19407b[_0x303d('0x16')]?_0x19407b['options'][_0x303d('0x19')]||null:null,'include':_0x19407b[_0x303d('0x16')]?_0x19407b[_0x303d('0x16')][_0x303d('0x1d')]?_[_0x303d('0x1b')](_0x19407b[_0x303d('0x16')][_0x303d('0x1d')],function(_0x4ff6f7){return{'model':db[_0x4ff6f7['model']],'as':_0x4ff6f7['as'],'attributes':_0x4ff6f7[_0x303d('0x19')],'include':_0x4ff6f7[_0x303d('0x1d')]?_[_0x303d('0x1b')](_0x4ff6f7['include'],function(_0x2664e0){return{'model':db[_0x2664e0['model']],'as':_0x2664e0['as'],'attributes':_0x2664e0['attributes'],'include':_0x2664e0[_0x303d('0x1d')]?_[_0x303d('0x1b')](_0x2664e0[_0x303d('0x1d')],function(_0x1dd699){return{'model':db[_0x1dd699['model']],'as':_0x1dd699['as'],'attributes':_0x1dd699['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb114e8){logger[_0x303d('0xd')]('ShowSalesforceAccount',_0x19407b);logger['debug']('ShowSalesforceAccount',_0x19407b,JSON[_0x303d('0xf')](_0xb114e8));_0x362730(_0xb114e8);})[_0x303d('0x21')](function(_0x5739f4){logger[_0x303d('0x10')](_0x303d('0x20'),_0x5739f4[_0x303d('0x13')],_0x19407b);_0x51793d(_0x231f12[_0x303d('0x10')](0x1f4,_0x5739f4[_0x303d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1b9b7e7..33b550b 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x90a867,_0x4eccd2){var _0x290381=function(_0x2830f5){while(--_0x2830f5){_0x90a867['push'](_0x90a867['shift']());}};_0x290381(++_0x4eccd2);}(_0x2ef3,0xba));var _0x32ef=function(_0x2cc36e,_0x312139){_0x2cc36e=_0x2cc36e-0x0;var _0x5ed960=_0x2ef3[_0x2cc36e];return _0x5ed960;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x559be2,_0xefcf7c){var _0x8446e6=function(_0x141f3d){while(--_0x141f3d){_0x559be2['push'](_0x559be2['shift']());}};_0x8446e6(++_0xefcf7c);}(_0xadb5,0xad));var _0x5adb=function(_0x5ba8b6,_0x1a2e59){_0x5ba8b6=_0x5ba8b6-0x0;var _0x3f4bdf=_0xadb5[_0x5ba8b6];return _0x3f4bdf;};'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('./intSalesforceConfiguration.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('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 56944f4..eda87b1 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 _0xb4f4=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','sequelize','exports'];(function(_0x469607,_0x2185ca){var _0x216d2c=function(_0x247939){while(--_0x247939){_0x469607['push'](_0x469607['shift']());}};_0x216d2c(++_0x2185ca);}(_0xb4f4,0xda));var _0x4b4f=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb4f4[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0x4b4f('0x0'));module[_0x4b4f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b4f('0x2')]},'ticketType':{'type':Sequelize[_0x4b4f('0x3')](_0x4b4f('0x4'),_0x4b4f('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x4b4f('0x3')](_0x4b4f('0x6'),_0x4b4f('0x7'),_0x4b4f('0x8'),_0x4b4f('0x9'),_0x4b4f('0xa')),'defaultValue':_0x4b4f('0x6')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x4b4f('0x7'),_0x4b4f('0x8'),_0x4b4f('0xa')),'defaultValue':_0x4b4f('0x8')},'leadId':{'type':Sequelize[_0x4b4f('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x4b4f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x4b4f('0x2')]}}; \ No newline at end of file +var _0x38d8=['ENUM','Task','Case','contact','lead','account','nothing','exports','STRING'];(function(_0x57e25c,_0x2eafda){var _0x595b54=function(_0xfa7df8){while(--_0xfa7df8){_0x57e25c['push'](_0x57e25c['shift']());}};_0x595b54(++_0x2eafda);}(_0x38d8,0x14b));var _0x838d=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x38d8[_0x1bbc08];return _0x5d825b;};'use strict';var Sequelize=require('sequelize');module[_0x838d('0x0')]={'name':{'type':Sequelize[_0x838d('0x1')]},'description':{'type':Sequelize[_0x838d('0x1')]},'ticketType':{'type':Sequelize[_0x838d('0x2')](_0x838d('0x3'),_0x838d('0x4')),'defaultValue':_0x838d('0x3')},'moduleSearch':{'type':Sequelize[_0x838d('0x2')]('contact_lead',_0x838d('0x5'),_0x838d('0x6'),'account_contact_lead',_0x838d('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x838d('0x8'),_0x838d('0x5'),_0x838d('0x6'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x838d('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x838d('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x838d('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x838d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index a3bfc10..ae0e2f5 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 _0xc519=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','find','params','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xc519,0x11b));var _0x9c51=function(_0x247bf1,_0x841b04){_0x247bf1=_0x247bf1-0x0;var _0x30e6f5=_0xc519[_0x247bf1];return _0x30e6f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c51('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c51('0x1'));var moment=require(_0x9c51('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c51('0x3'));var path=require(_0x9c51('0x4'));var sox=require('sox');var csv=require(_0x9c51('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c51('0x6'));var _=require(_0x9c51('0x7'));var squel=require('squel');var crypto=require(_0x9c51('0x8'));var jsforce=require(_0x9c51('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x9c51('0x5'));var querystring=require(_0x9c51('0xa'));var Papa=require(_0x9c51('0xb'));var Redis=require(_0x9c51('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9c51('0xd'));var as=require(_0x9c51('0xe'));var hardwareService=require(_0x9c51('0xf'));var logger=require(_0x9c51('0x10'))(_0x9c51('0x11'));var utils=require(_0x9c51('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c51('0x13'))['db'];function respondWithStatusCode(_0x5cbed0,_0x3e6bd4){_0x3e6bd4=_0x3e6bd4||0xcc;return function(_0xd78aea){if(_0xd78aea){return _0x5cbed0[_0x9c51('0x14')](_0x3e6bd4);}return _0x5cbed0[_0x9c51('0x15')](_0x3e6bd4)[_0x9c51('0x16')]();};}function respondWithResult(_0x39bfc2,_0x44487c){_0x44487c=_0x44487c||0xc8;return function(_0x58375e){if(_0x58375e){return _0x39bfc2[_0x9c51('0x15')](_0x44487c)[_0x9c51('0x17')](_0x58375e);}};}function respondWithFilteredResult(_0x25a640,_0x4598ac){return function(_0x3064c4){if(_0x3064c4){var _0x11c33f=typeof _0x4598ac[_0x9c51('0x18')]==='undefined'&&typeof _0x4598ac[_0x9c51('0x19')]==='undefined';var _0x52d8b7=_0x3064c4[_0x9c51('0x1a')];var _0x5d9daf=_0x11c33f?0x0:_0x4598ac['offset'];var _0x691273=_0x11c33f?_0x3064c4[_0x9c51('0x1a')]:_0x4598ac[_0x9c51('0x18')]+_0x4598ac[_0x9c51('0x19')];var _0x3f0ad7;if(_0x691273>=_0x52d8b7){_0x691273=_0x52d8b7;_0x3f0ad7=0xc8;}else{_0x3f0ad7=0xce;}_0x25a640[_0x9c51('0x15')](_0x3f0ad7);return _0x25a640[_0x9c51('0x1b')](_0x9c51('0x1c'),_0x5d9daf+'-'+_0x691273+'/'+_0x52d8b7)[_0x9c51('0x17')](_0x3064c4);}return null;};}function patchUpdates(_0x483b37){return function(_0x432f16){try{jsonpatch[_0x9c51('0x1d')](_0x432f16,_0x483b37,!![]);}catch(_0x58a047){return BPromise[_0x9c51('0x1e')](_0x58a047);}return _0x432f16[_0x9c51('0x1f')]();};}function saveUpdates(_0x26a2b2,_0x16be2e){return function(_0x3a8693){if(_0x3a8693){return _0x3a8693[_0x9c51('0x20')](_0x26a2b2)[_0x9c51('0x21')](function(_0x104b30){return _0x104b30;});}return null;};}function removeEntity(_0x51ae02,_0x3c4253){return function(_0x3d8283){if(_0x3d8283){return _0x3d8283[_0x9c51('0x22')]()[_0x9c51('0x21')](function(){_0x51ae02[_0x9c51('0x15')](0xcc)[_0x9c51('0x16')]();});}};}function handleEntityNotFound(_0x574b68,_0x40a786){return function(_0x73dc43){if(!_0x73dc43){_0x574b68['sendStatus'](0x194);}return _0x73dc43;};}function handleError(_0x51863a,_0x4eb9d7){_0x4eb9d7=_0x4eb9d7||0x1f4;return function(_0x5e9c41){logger[_0x9c51('0x23')](_0x5e9c41[_0x9c51('0x24')]);if(_0x5e9c41[_0x9c51('0x25')]){delete _0x5e9c41[_0x9c51('0x25')];}_0x51863a[_0x9c51('0x15')](_0x4eb9d7)[_0x9c51('0x26')](_0x5e9c41);};}exports[_0x9c51('0x27')]=function(_0x48db4a,_0xe70cd6){var _0x394bc9={},_0x9a5705={},_0x9183f={'count':0x0,'rows':[]};var _0x57c998=_['map'](db[_0x9c51('0x28')][_0x9c51('0x29')],function(_0x5182b0){return{'name':_0x5182b0[_0x9c51('0x2a')],'type':_0x5182b0[_0x9c51('0x2b')][_0x9c51('0x2c')]};});_0x9a5705[_0x9c51('0x2d')]=_[_0x9c51('0x2e')](_0x57c998,_0x9c51('0x25'));_0x9a5705['query']=_['keys'](_0x48db4a[_0x9c51('0x2f')]);_0x9a5705[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x9a5705[_0x9c51('0x2d')],_0x9a5705[_0x9c51('0x2f')]);_0x394bc9[_0x9c51('0x32')]=_[_0x9c51('0x31')](_0x9a5705[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x48db4a['query']['fields']));_0x394bc9[_0x9c51('0x32')]=_0x394bc9[_0x9c51('0x32')][_0x9c51('0x34')]?_0x394bc9[_0x9c51('0x32')]:_0x9a5705[_0x9c51('0x2d')];if(!_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x394bc9['limit']=qs['limit'](_0x48db4a[_0x9c51('0x2f')]['limit']);_0x394bc9[_0x9c51('0x18')]=qs['offset'](_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x18')]);}_0x394bc9[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x48db4a[_0x9c51('0x2f')]['sort']);_0x394bc9[_0x9c51('0x39')]=qs[_0x9c51('0x30')](_['pick'](_0x48db4a[_0x9c51('0x2f')],_0x9a5705[_0x9c51('0x30')]),_0x57c998);if(_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x3a')]){_0x394bc9[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x394bc9['where'],{'$or':_[_0x9c51('0x2e')](_0x57c998,function(_0x1e5282){if(_0x1e5282[_0x9c51('0x2b')]!==_0x9c51('0x3c')){var _0x30a629={};_0x30a629[_0x1e5282[_0x9c51('0x25')]]={'$like':'%'+_0x48db4a[_0x9c51('0x2f')]['filter']+'%'};return _0x30a629;}})});}_0x394bc9=_[_0x9c51('0x3b')]({},_0x394bc9,_0x48db4a[_0x9c51('0x3d')]);var _0x34de73={'where':_0x394bc9[_0x9c51('0x39')]};return db['SalesforceConfiguration'][_0x9c51('0x1a')](_0x34de73)[_0x9c51('0x21')](function(_0x2170dd){_0x9183f[_0x9c51('0x1a')]=_0x2170dd;if(_0x48db4a['query'][_0x9c51('0x3e')]){_0x394bc9[_0x9c51('0x3f')]=[{'all':!![]}];}return db[_0x9c51('0x28')]['findAll'](_0x394bc9);})[_0x9c51('0x21')](function(_0x1a2f16){_0x9183f[_0x9c51('0x40')]=_0x1a2f16;return _0x9183f;})[_0x9c51('0x21')](respondWithFilteredResult(_0xe70cd6,_0x394bc9))[_0x9c51('0x41')](handleError(_0xe70cd6,null));};exports[_0x9c51('0x42')]=function(_0xaeda82,_0xe74e89){var _0x5c2c2e={'raw':![],'where':{'id':_0xaeda82['params']['id']}},_0x34a6d1={};_0x34a6d1[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db['SalesforceConfiguration'][_0x9c51('0x29')]);_0x34a6d1[_0x9c51('0x2f')]=_[_0x9c51('0x43')](_0xaeda82['query']);_0x34a6d1['filters']=_[_0x9c51('0x31')](_0x34a6d1[_0x9c51('0x2d')],_0x34a6d1['query']);_0x5c2c2e[_0x9c51('0x32')]=_['intersection'](_0x34a6d1[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0xaeda82['query']['fields']));_0x5c2c2e[_0x9c51('0x32')]=_0x5c2c2e[_0x9c51('0x32')][_0x9c51('0x34')]?_0x5c2c2e['attributes']:_0x34a6d1[_0x9c51('0x2d')];if(_0xaeda82[_0x9c51('0x2f')][_0x9c51('0x3e')]){_0x5c2c2e[_0x9c51('0x3f')]=[{'all':!![]}];}_0x5c2c2e=_['merge']({},_0x5c2c2e,_0xaeda82[_0x9c51('0x3d')]);return db[_0x9c51('0x28')]['find'](_0x5c2c2e)['then'](handleEntityNotFound(_0xe74e89,null))[_0x9c51('0x21')](respondWithResult(_0xe74e89,null))[_0x9c51('0x41')](handleError(_0xe74e89,null));};exports[_0x9c51('0x44')]=function(_0x2d2d0e,_0x5382a1){return db[_0x9c51('0x28')][_0x9c51('0x44')](_0x2d2d0e['body'],{})[_0x9c51('0x21')](respondWithResult(_0x5382a1,0xc9))['catch'](handleError(_0x5382a1,null));};exports['update']=function(_0x558b02,_0x5e40b4){if(_0x558b02['body']['id']){delete _0x558b02['body']['id'];}return db[_0x9c51('0x28')][_0x9c51('0x45')]({'where':{'id':_0x558b02[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x5e40b4,null))['then'](saveUpdates(_0x558b02['body'],null))[_0x9c51('0x21')](respondWithResult(_0x5e40b4,null))['catch'](handleError(_0x5e40b4,null));};exports[_0x9c51('0x22')]=function(_0x5e0a99,_0x4c057b){return db[_0x9c51('0x28')][_0x9c51('0x45')]({'where':{'id':_0x5e0a99['params']['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x4c057b,null))[_0x9c51('0x21')](removeEntity(_0x4c057b,null))[_0x9c51('0x41')](handleError(_0x4c057b,null));};exports[_0x9c51('0x47')]=function(_0x1f1b6e,_0x2f80a8,_0x129523){var _0x12d3aa={};var _0x21f79b={};var _0x328a53;var _0x4d78f8;return db[_0x9c51('0x28')][_0x9c51('0x48')]({'where':{'id':_0x1f1b6e[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x2f80a8,null))[_0x9c51('0x21')](function(_0x53ae7c){if(_0x53ae7c){_0x328a53=_0x53ae7c;_0x21f79b[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db[_0x9c51('0x49')]['rawAttributes']);_0x21f79b['query']=_['keys'](_0x1f1b6e['query']);_0x21f79b[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x21f79b[_0x9c51('0x2d')],_0x21f79b[_0x9c51('0x2f')]);_0x12d3aa['attributes']=_[_0x9c51('0x31')](_0x21f79b[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x1f1b6e[_0x9c51('0x2f')]['fields']));_0x12d3aa['attributes']=_0x12d3aa[_0x9c51('0x32')][_0x9c51('0x34')]?_0x12d3aa[_0x9c51('0x32')]:_0x21f79b[_0x9c51('0x2d')];_0x12d3aa[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x1f1b6e[_0x9c51('0x2f')]['sort']);_0x12d3aa[_0x9c51('0x39')]=qs['filters'](_[_0x9c51('0x4a')](_0x1f1b6e[_0x9c51('0x2f')],_0x21f79b['filters']));if(_0x1f1b6e[_0x9c51('0x2f')]['filter']){_0x12d3aa[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x12d3aa[_0x9c51('0x39')],{'$or':_[_0x9c51('0x2e')](_0x12d3aa[_0x9c51('0x32')],function(_0x545947){var _0x6d801={};_0x6d801[_0x545947]={'$like':'%'+_0x1f1b6e[_0x9c51('0x2f')][_0x9c51('0x3a')]+'%'};return _0x6d801;})});}_0x12d3aa=_[_0x9c51('0x3b')]({},_0x12d3aa,_0x1f1b6e['options']);return _0x328a53[_0x9c51('0x47')](_0x12d3aa);}})[_0x9c51('0x21')](function(_0x1296a8){if(_0x1296a8){_0x4d78f8=_0x1296a8[_0x9c51('0x34')];if(!_0x1f1b6e['query'][_0x9c51('0x35')]('nolimit')){_0x12d3aa[_0x9c51('0x19')]=qs[_0x9c51('0x19')](_0x1f1b6e[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x12d3aa[_0x9c51('0x18')]=qs[_0x9c51('0x18')](_0x1f1b6e['query'][_0x9c51('0x18')]);}return _0x328a53[_0x9c51('0x47')](_0x12d3aa);}})['then'](function(_0x15d406){if(_0x15d406){return _0x15d406?{'count':_0x4d78f8,'rows':_0x15d406}:null;}})[_0x9c51('0x21')](respondWithResult(_0x2f80a8,null))['catch'](handleError(_0x2f80a8,null));};exports[_0x9c51('0x4b')]=function(_0x1949d6,_0x10ad68,_0x29238f){var _0x4fe1c9={};var _0x48173e={};var _0x236d58;var _0x263f43;return db['SalesforceConfiguration'][_0x9c51('0x48')]({'where':{'id':_0x1949d6[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x10ad68,null))[_0x9c51('0x21')](function(_0x101b24){if(_0x101b24){_0x236d58=_0x101b24;_0x48173e['model']=_[_0x9c51('0x43')](db['SalesforceField'][_0x9c51('0x29')]);_0x48173e['query']=_['keys'](_0x1949d6[_0x9c51('0x2f')]);_0x48173e['filters']=_['intersection'](_0x48173e[_0x9c51('0x2d')],_0x48173e['query']);_0x4fe1c9[_0x9c51('0x32')]=_[_0x9c51('0x31')](_0x48173e[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x33')]));_0x4fe1c9[_0x9c51('0x32')]=_0x4fe1c9[_0x9c51('0x32')][_0x9c51('0x34')]?_0x4fe1c9[_0x9c51('0x32')]:_0x48173e[_0x9c51('0x2d')];_0x4fe1c9[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x38')]);_0x4fe1c9[_0x9c51('0x39')]=qs[_0x9c51('0x30')](_['pick'](_0x1949d6[_0x9c51('0x2f')],_0x48173e[_0x9c51('0x30')]));if(_0x1949d6['query'][_0x9c51('0x3a')]){_0x4fe1c9[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x4fe1c9['where'],{'$or':_[_0x9c51('0x2e')](_0x4fe1c9[_0x9c51('0x32')],function(_0x185fb9){var _0x458b70={};_0x458b70[_0x185fb9]={'$like':'%'+_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x3a')]+'%'};return _0x458b70;})});}_0x4fe1c9=_[_0x9c51('0x3b')]({},_0x4fe1c9,_0x1949d6[_0x9c51('0x3d')]);return _0x236d58['getSubjects'](_0x4fe1c9);}})[_0x9c51('0x21')](function(_0x376882){if(_0x376882){_0x263f43=_0x376882[_0x9c51('0x34')];if(!_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x4fe1c9[_0x9c51('0x19')]=qs[_0x9c51('0x19')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x4fe1c9[_0x9c51('0x18')]=qs['offset'](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x18')]);}return _0x236d58['getSubjects'](_0x4fe1c9);}})[_0x9c51('0x21')](function(_0x4ee03b){if(_0x4ee03b){return _0x4ee03b?{'count':_0x263f43,'rows':_0x4ee03b}:null;}})[_0x9c51('0x21')](respondWithResult(_0x10ad68,null))['catch'](handleError(_0x10ad68,null));};exports[_0x9c51('0x4c')]=function(_0x2da1c2,_0x8dcca4,_0x2c0c4b){var _0x4adec2={};var _0x144c4f={};var _0x4a20b9;var _0xcb0ac2;return db[_0x9c51('0x28')][_0x9c51('0x48')]({'where':{'id':_0x2da1c2[_0x9c51('0x46')]['id']}})['then'](handleEntityNotFound(_0x8dcca4,null))[_0x9c51('0x21')](function(_0xf4be83){if(_0xf4be83){_0x4a20b9=_0xf4be83;_0x144c4f[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db[_0x9c51('0x49')][_0x9c51('0x29')]);_0x144c4f['query']=_['keys'](_0x2da1c2[_0x9c51('0x2f')]);_0x144c4f[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x144c4f[_0x9c51('0x2d')],_0x144c4f[_0x9c51('0x2f')]);_0x4adec2[_0x9c51('0x32')]=_['intersection'](_0x144c4f[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x33')]));_0x4adec2[_0x9c51('0x32')]=_0x4adec2[_0x9c51('0x32')]['length']?_0x4adec2['attributes']:_0x144c4f[_0x9c51('0x2d')];_0x4adec2['order']=qs[_0x9c51('0x38')](_0x2da1c2['query'][_0x9c51('0x38')]);_0x4adec2[_0x9c51('0x39')]=qs['filters'](_[_0x9c51('0x4a')](_0x2da1c2[_0x9c51('0x2f')],_0x144c4f[_0x9c51('0x30')]));if(_0x2da1c2['query']['filter']){_0x4adec2[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x4adec2[_0x9c51('0x39')],{'$or':_[_0x9c51('0x2e')](_0x4adec2[_0x9c51('0x32')],function(_0x1524de){var _0x158ab0={};_0x158ab0[_0x1524de]={'$like':'%'+_0x2da1c2[_0x9c51('0x2f')]['filter']+'%'};return _0x158ab0;})});}_0x4adec2=_['merge']({},_0x4adec2,_0x2da1c2[_0x9c51('0x3d')]);return _0x4a20b9[_0x9c51('0x4c')](_0x4adec2);}})[_0x9c51('0x21')](function(_0x30304a){if(_0x30304a){_0xcb0ac2=_0x30304a['length'];if(!_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x4adec2[_0x9c51('0x19')]=qs['limit'](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x4adec2[_0x9c51('0x18')]=qs['offset'](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x18')]);}return _0x4a20b9['getDescriptions'](_0x4adec2);}})[_0x9c51('0x21')](function(_0x358a37){if(_0x358a37){return _0x358a37?{'count':_0xcb0ac2,'rows':_0x358a37}:null;}})[_0x9c51('0x21')](respondWithResult(_0x8dcca4,null))[_0x9c51('0x41')](handleError(_0x8dcca4,null));}; \ No newline at end of file +var _0xe661=['VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','rows','show','params','keys','find','create','body','catch','getFields','SalesforceField','nolimit','getSubjects','getDescriptions','findOne','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x80c735,_0x2e9fd4){var _0xd5b200=function(_0x1af766){while(--_0x1af766){_0x80c735['push'](_0x80c735['shift']());}};_0xd5b200(++_0x2e9fd4);}(_0xe661,0x64));var _0x1e66=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe661[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x1e66('0x0'));var rimraf=require(_0x1e66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e66('0x2'));var rp=require('request-promise');var moment=require(_0x1e66('0x3'));var BPromise=require(_0x1e66('0x4'));var Mustache=require(_0x1e66('0x5'));var util=require(_0x1e66('0x6'));var path=require(_0x1e66('0x7'));var sox=require(_0x1e66('0x8'));var csv=require(_0x1e66('0x9'));var ejs=require(_0x1e66('0xa'));var fs=require('fs');var fs_extra=require(_0x1e66('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e66('0xc'));var jsforce=require(_0x1e66('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e66('0xe'));var Redis=require('ioredis');var authService=require(_0x1e66('0xf'));var qs=require(_0x1e66('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e66('0x11'));var logger=require(_0x1e66('0x12'))(_0x1e66('0x13'));var utils=require(_0x1e66('0x14'));var config=require(_0x1e66('0x15'));var licenseUtil=require(_0x1e66('0x16'));var db=require(_0x1e66('0x17'))['db'];function respondWithStatusCode(_0x24bb4f,_0x4e4c33){_0x4e4c33=_0x4e4c33||0xcc;return function(_0x1c0335){if(_0x1c0335){return _0x24bb4f[_0x1e66('0x18')](_0x4e4c33);}return _0x24bb4f[_0x1e66('0x19')](_0x4e4c33)['end']();};}function respondWithResult(_0x23e03f,_0x3faadd){_0x3faadd=_0x3faadd||0xc8;return function(_0xcf1ef3){if(_0xcf1ef3){return _0x23e03f[_0x1e66('0x19')](_0x3faadd)['json'](_0xcf1ef3);}};}function respondWithFilteredResult(_0x31fe82,_0xe73dfb){return function(_0x4d2a4c){if(_0x4d2a4c){var _0x374557=typeof _0xe73dfb[_0x1e66('0x1a')]===_0x1e66('0x1b')&&typeof _0xe73dfb['limit']==='undefined';var _0x3418a0=_0x4d2a4c[_0x1e66('0x1c')];var _0x179f3f=_0x374557?0x0:_0xe73dfb[_0x1e66('0x1a')];var _0x1d0303=_0x374557?_0x4d2a4c[_0x1e66('0x1c')]:_0xe73dfb[_0x1e66('0x1a')]+_0xe73dfb[_0x1e66('0x1d')];var _0x49f4d3;if(_0x1d0303>=_0x3418a0){_0x1d0303=_0x3418a0;_0x49f4d3=0xc8;}else{_0x49f4d3=0xce;}_0x31fe82[_0x1e66('0x19')](_0x49f4d3);return _0x31fe82[_0x1e66('0x1e')](_0x1e66('0x1f'),_0x179f3f+'-'+_0x1d0303+'/'+_0x3418a0)['json'](_0x4d2a4c);}return null;};}function patchUpdates(_0x3719d9){return function(_0x3818f0){try{jsonpatch[_0x1e66('0x20')](_0x3818f0,_0x3719d9,!![]);}catch(_0x2d87ae){return BPromise['reject'](_0x2d87ae);}return _0x3818f0['save']();};}function saveUpdates(_0x112587,_0x78d26a){return function(_0x36ec16){if(_0x36ec16){return _0x36ec16[_0x1e66('0x21')](_0x112587)[_0x1e66('0x22')](function(_0x15c850){return _0x15c850;});}return null;};}function removeEntity(_0x555369,_0x1553c2){return function(_0x371a83){if(_0x371a83){return _0x371a83[_0x1e66('0x23')]()['then'](function(){_0x555369[_0x1e66('0x19')](0xcc)[_0x1e66('0x24')]();});}};}function handleEntityNotFound(_0x1257cb,_0x41232d){return function(_0x32be1a){if(!_0x32be1a){_0x1257cb[_0x1e66('0x18')](0x194);}return _0x32be1a;};}function handleError(_0x2e427b,_0x2b01f9){_0x2b01f9=_0x2b01f9||0x1f4;return function(_0x3cb7b4){logger[_0x1e66('0x25')](_0x3cb7b4['stack']);if(_0x3cb7b4[_0x1e66('0x26')]){delete _0x3cb7b4['name'];}_0x2e427b['status'](_0x2b01f9)[_0x1e66('0x27')](_0x3cb7b4);};}exports[_0x1e66('0x28')]=function(_0x11386f,_0x54114c){var _0x26a012={},_0x4ecb6b={},_0x67305f={'count':0x0,'rows':[]};var _0x5169f9=_[_0x1e66('0x29')](db['SalesforceConfiguration'][_0x1e66('0x2a')],function(_0x53271f){return{'name':_0x53271f[_0x1e66('0x2b')],'type':_0x53271f[_0x1e66('0x2c')][_0x1e66('0x2d')]};});_0x4ecb6b[_0x1e66('0x2e')]=_['map'](_0x5169f9,_0x1e66('0x26'));_0x4ecb6b['query']=_['keys'](_0x11386f[_0x1e66('0x2f')]);_0x4ecb6b[_0x1e66('0x30')]=_[_0x1e66('0x31')](_0x4ecb6b[_0x1e66('0x2e')],_0x4ecb6b[_0x1e66('0x2f')]);_0x26a012[_0x1e66('0x32')]=_['intersection'](_0x4ecb6b[_0x1e66('0x2e')],qs[_0x1e66('0x33')](_0x11386f['query'][_0x1e66('0x33')]));_0x26a012[_0x1e66('0x32')]=_0x26a012['attributes'][_0x1e66('0x34')]?_0x26a012[_0x1e66('0x32')]:_0x4ecb6b['model'];if(!_0x11386f[_0x1e66('0x2f')][_0x1e66('0x35')]('nolimit')){_0x26a012[_0x1e66('0x1d')]=qs[_0x1e66('0x1d')](_0x11386f[_0x1e66('0x2f')]['limit']);_0x26a012['offset']=qs['offset'](_0x11386f[_0x1e66('0x2f')][_0x1e66('0x1a')]);}_0x26a012[_0x1e66('0x36')]=qs[_0x1e66('0x37')](_0x11386f[_0x1e66('0x2f')][_0x1e66('0x37')]);_0x26a012[_0x1e66('0x38')]=qs[_0x1e66('0x30')](_[_0x1e66('0x39')](_0x11386f[_0x1e66('0x2f')],_0x4ecb6b['filters']),_0x5169f9);if(_0x11386f['query'][_0x1e66('0x3a')]){_0x26a012[_0x1e66('0x38')]=_[_0x1e66('0x3b')](_0x26a012['where'],{'$or':_['map'](_0x5169f9,function(_0x232d91){if(_0x232d91[_0x1e66('0x2c')]!==_0x1e66('0x3c')){var _0x5a8543={};_0x5a8543[_0x232d91[_0x1e66('0x26')]]={'$like':'%'+_0x11386f['query'][_0x1e66('0x3a')]+'%'};return _0x5a8543;}})});}_0x26a012=_[_0x1e66('0x3b')]({},_0x26a012,_0x11386f[_0x1e66('0x3d')]);var _0x3bc629={'where':_0x26a012[_0x1e66('0x38')]};return db['SalesforceConfiguration'][_0x1e66('0x1c')](_0x3bc629)[_0x1e66('0x22')](function(_0x329237){_0x67305f[_0x1e66('0x1c')]=_0x329237;if(_0x11386f[_0x1e66('0x2f')][_0x1e66('0x3e')]){_0x26a012[_0x1e66('0x3f')]=[{'all':!![]}];}return db[_0x1e66('0x40')][_0x1e66('0x41')](_0x26a012);})[_0x1e66('0x22')](function(_0x2244bf){_0x67305f[_0x1e66('0x42')]=_0x2244bf;return _0x67305f;})[_0x1e66('0x22')](respondWithFilteredResult(_0x54114c,_0x26a012))['catch'](handleError(_0x54114c,null));};exports[_0x1e66('0x43')]=function(_0x52e7a4,_0x33ab22){var _0x1c181c={'raw':![],'where':{'id':_0x52e7a4[_0x1e66('0x44')]['id']}},_0x5671c1={};_0x5671c1[_0x1e66('0x2e')]=_[_0x1e66('0x45')](db[_0x1e66('0x40')][_0x1e66('0x2a')]);_0x5671c1[_0x1e66('0x2f')]=_[_0x1e66('0x45')](_0x52e7a4[_0x1e66('0x2f')]);_0x5671c1[_0x1e66('0x30')]=_[_0x1e66('0x31')](_0x5671c1[_0x1e66('0x2e')],_0x5671c1[_0x1e66('0x2f')]);_0x1c181c['attributes']=_['intersection'](_0x5671c1[_0x1e66('0x2e')],qs[_0x1e66('0x33')](_0x52e7a4[_0x1e66('0x2f')][_0x1e66('0x33')]));_0x1c181c[_0x1e66('0x32')]=_0x1c181c[_0x1e66('0x32')][_0x1e66('0x34')]?_0x1c181c[_0x1e66('0x32')]:_0x5671c1['model'];if(_0x52e7a4['query'][_0x1e66('0x3e')]){_0x1c181c[_0x1e66('0x3f')]=[{'all':!![]}];}_0x1c181c=_['merge']({},_0x1c181c,_0x52e7a4['options']);return db[_0x1e66('0x40')][_0x1e66('0x46')](_0x1c181c)[_0x1e66('0x22')](handleEntityNotFound(_0x33ab22,null))[_0x1e66('0x22')](respondWithResult(_0x33ab22,null))['catch'](handleError(_0x33ab22,null));};exports[_0x1e66('0x47')]=function(_0x4b4803,_0xd6d285){return db[_0x1e66('0x40')][_0x1e66('0x47')](_0x4b4803[_0x1e66('0x48')],{})[_0x1e66('0x22')](respondWithResult(_0xd6d285,0xc9))[_0x1e66('0x49')](handleError(_0xd6d285,null));};exports[_0x1e66('0x21')]=function(_0x1e82f7,_0x588559){if(_0x1e82f7[_0x1e66('0x48')]['id']){delete _0x1e82f7[_0x1e66('0x48')]['id'];}return db[_0x1e66('0x40')][_0x1e66('0x46')]({'where':{'id':_0x1e82f7[_0x1e66('0x44')]['id']}})[_0x1e66('0x22')](handleEntityNotFound(_0x588559,null))[_0x1e66('0x22')](saveUpdates(_0x1e82f7[_0x1e66('0x48')],null))[_0x1e66('0x22')](respondWithResult(_0x588559,null))['catch'](handleError(_0x588559,null));};exports[_0x1e66('0x23')]=function(_0x36ced0,_0x90b974){return db[_0x1e66('0x40')][_0x1e66('0x46')]({'where':{'id':_0x36ced0[_0x1e66('0x44')]['id']}})[_0x1e66('0x22')](handleEntityNotFound(_0x90b974,null))[_0x1e66('0x22')](removeEntity(_0x90b974,null))[_0x1e66('0x49')](handleError(_0x90b974,null));};exports[_0x1e66('0x4a')]=function(_0x943792,_0x276249,_0x33d96a){var _0x37040c={};var _0x45c61c={};var _0x5eb342;var _0x5bafd4;return db[_0x1e66('0x40')]['findOne']({'where':{'id':_0x943792[_0x1e66('0x44')]['id']}})[_0x1e66('0x22')](handleEntityNotFound(_0x276249,null))['then'](function(_0x45a09c){if(_0x45a09c){_0x5eb342=_0x45a09c;_0x45c61c['model']=_[_0x1e66('0x45')](db[_0x1e66('0x4b')][_0x1e66('0x2a')]);_0x45c61c[_0x1e66('0x2f')]=_['keys'](_0x943792[_0x1e66('0x2f')]);_0x45c61c[_0x1e66('0x30')]=_['intersection'](_0x45c61c['model'],_0x45c61c[_0x1e66('0x2f')]);_0x37040c['attributes']=_[_0x1e66('0x31')](_0x45c61c[_0x1e66('0x2e')],qs[_0x1e66('0x33')](_0x943792['query']['fields']));_0x37040c[_0x1e66('0x32')]=_0x37040c[_0x1e66('0x32')][_0x1e66('0x34')]?_0x37040c[_0x1e66('0x32')]:_0x45c61c[_0x1e66('0x2e')];_0x37040c[_0x1e66('0x36')]=qs['sort'](_0x943792[_0x1e66('0x2f')][_0x1e66('0x37')]);_0x37040c[_0x1e66('0x38')]=qs[_0x1e66('0x30')](_[_0x1e66('0x39')](_0x943792[_0x1e66('0x2f')],_0x45c61c[_0x1e66('0x30')]));if(_0x943792['query']['filter']){_0x37040c[_0x1e66('0x38')]=_[_0x1e66('0x3b')](_0x37040c[_0x1e66('0x38')],{'$or':_[_0x1e66('0x29')](_0x37040c['attributes'],function(_0x39e043){var _0x59a7ba={};_0x59a7ba[_0x39e043]={'$like':'%'+_0x943792[_0x1e66('0x2f')][_0x1e66('0x3a')]+'%'};return _0x59a7ba;})});}_0x37040c=_[_0x1e66('0x3b')]({},_0x37040c,_0x943792[_0x1e66('0x3d')]);return _0x5eb342[_0x1e66('0x4a')](_0x37040c);}})[_0x1e66('0x22')](function(_0x30e9a2){if(_0x30e9a2){_0x5bafd4=_0x30e9a2['length'];if(!_0x943792[_0x1e66('0x2f')][_0x1e66('0x35')](_0x1e66('0x4c'))){_0x37040c[_0x1e66('0x1d')]=qs[_0x1e66('0x1d')](_0x943792['query'][_0x1e66('0x1d')]);_0x37040c[_0x1e66('0x1a')]=qs[_0x1e66('0x1a')](_0x943792[_0x1e66('0x2f')][_0x1e66('0x1a')]);}return _0x5eb342[_0x1e66('0x4a')](_0x37040c);}})['then'](function(_0x215434){if(_0x215434){return _0x215434?{'count':_0x5bafd4,'rows':_0x215434}:null;}})[_0x1e66('0x22')](respondWithResult(_0x276249,null))[_0x1e66('0x49')](handleError(_0x276249,null));};exports[_0x1e66('0x4d')]=function(_0x557856,_0x550592,_0x50d1bf){var _0x343dea={};var _0x173f2c={};var _0x38f9ec;var _0x2a7f1e;return db[_0x1e66('0x40')]['findOne']({'where':{'id':_0x557856[_0x1e66('0x44')]['id']}})[_0x1e66('0x22')](handleEntityNotFound(_0x550592,null))[_0x1e66('0x22')](function(_0x3fccf3){if(_0x3fccf3){_0x38f9ec=_0x3fccf3;_0x173f2c[_0x1e66('0x2e')]=_[_0x1e66('0x45')](db[_0x1e66('0x4b')]['rawAttributes']);_0x173f2c[_0x1e66('0x2f')]=_[_0x1e66('0x45')](_0x557856[_0x1e66('0x2f')]);_0x173f2c[_0x1e66('0x30')]=_['intersection'](_0x173f2c[_0x1e66('0x2e')],_0x173f2c['query']);_0x343dea[_0x1e66('0x32')]=_[_0x1e66('0x31')](_0x173f2c[_0x1e66('0x2e')],qs['fields'](_0x557856[_0x1e66('0x2f')][_0x1e66('0x33')]));_0x343dea[_0x1e66('0x32')]=_0x343dea[_0x1e66('0x32')][_0x1e66('0x34')]?_0x343dea[_0x1e66('0x32')]:_0x173f2c[_0x1e66('0x2e')];_0x343dea[_0x1e66('0x36')]=qs[_0x1e66('0x37')](_0x557856['query'][_0x1e66('0x37')]);_0x343dea['where']=qs[_0x1e66('0x30')](_[_0x1e66('0x39')](_0x557856['query'],_0x173f2c[_0x1e66('0x30')]));if(_0x557856[_0x1e66('0x2f')][_0x1e66('0x3a')]){_0x343dea['where']=_[_0x1e66('0x3b')](_0x343dea[_0x1e66('0x38')],{'$or':_['map'](_0x343dea['attributes'],function(_0x1dca4c){var _0x3bcef4={};_0x3bcef4[_0x1dca4c]={'$like':'%'+_0x557856['query'][_0x1e66('0x3a')]+'%'};return _0x3bcef4;})});}_0x343dea=_['merge']({},_0x343dea,_0x557856['options']);return _0x38f9ec[_0x1e66('0x4d')](_0x343dea);}})[_0x1e66('0x22')](function(_0x565238){if(_0x565238){_0x2a7f1e=_0x565238['length'];if(!_0x557856['query']['hasOwnProperty'](_0x1e66('0x4c'))){_0x343dea[_0x1e66('0x1d')]=qs[_0x1e66('0x1d')](_0x557856[_0x1e66('0x2f')][_0x1e66('0x1d')]);_0x343dea['offset']=qs[_0x1e66('0x1a')](_0x557856[_0x1e66('0x2f')]['offset']);}return _0x38f9ec[_0x1e66('0x4d')](_0x343dea);}})[_0x1e66('0x22')](function(_0x506e06){if(_0x506e06){return _0x506e06?{'count':_0x2a7f1e,'rows':_0x506e06}:null;}})[_0x1e66('0x22')](respondWithResult(_0x550592,null))[_0x1e66('0x49')](handleError(_0x550592,null));};exports[_0x1e66('0x4e')]=function(_0x2d0695,_0x3b17f1,_0x4e2a29){var _0x7110c2={};var _0x3f8d17={};var _0x49a151;var _0x9187ef;return db[_0x1e66('0x40')][_0x1e66('0x4f')]({'where':{'id':_0x2d0695['params']['id']}})['then'](handleEntityNotFound(_0x3b17f1,null))[_0x1e66('0x22')](function(_0x3d845e){if(_0x3d845e){_0x49a151=_0x3d845e;_0x3f8d17[_0x1e66('0x2e')]=_['keys'](db[_0x1e66('0x4b')]['rawAttributes']);_0x3f8d17[_0x1e66('0x2f')]=_[_0x1e66('0x45')](_0x2d0695['query']);_0x3f8d17[_0x1e66('0x30')]=_[_0x1e66('0x31')](_0x3f8d17[_0x1e66('0x2e')],_0x3f8d17['query']);_0x7110c2[_0x1e66('0x32')]=_['intersection'](_0x3f8d17[_0x1e66('0x2e')],qs['fields'](_0x2d0695[_0x1e66('0x2f')][_0x1e66('0x33')]));_0x7110c2['attributes']=_0x7110c2[_0x1e66('0x32')]['length']?_0x7110c2['attributes']:_0x3f8d17['model'];_0x7110c2['order']=qs[_0x1e66('0x37')](_0x2d0695[_0x1e66('0x2f')]['sort']);_0x7110c2[_0x1e66('0x38')]=qs[_0x1e66('0x30')](_[_0x1e66('0x39')](_0x2d0695['query'],_0x3f8d17[_0x1e66('0x30')]));if(_0x2d0695[_0x1e66('0x2f')][_0x1e66('0x3a')]){_0x7110c2[_0x1e66('0x38')]=_[_0x1e66('0x3b')](_0x7110c2['where'],{'$or':_[_0x1e66('0x29')](_0x7110c2['attributes'],function(_0x4aadf0){var _0x4dc030={};_0x4dc030[_0x4aadf0]={'$like':'%'+_0x2d0695['query'][_0x1e66('0x3a')]+'%'};return _0x4dc030;})});}_0x7110c2=_[_0x1e66('0x3b')]({},_0x7110c2,_0x2d0695[_0x1e66('0x3d')]);return _0x49a151['getDescriptions'](_0x7110c2);}})[_0x1e66('0x22')](function(_0x323291){if(_0x323291){_0x9187ef=_0x323291[_0x1e66('0x34')];if(!_0x2d0695[_0x1e66('0x2f')][_0x1e66('0x35')](_0x1e66('0x4c'))){_0x7110c2[_0x1e66('0x1d')]=qs[_0x1e66('0x1d')](_0x2d0695['query']['limit']);_0x7110c2[_0x1e66('0x1a')]=qs[_0x1e66('0x1a')](_0x2d0695['query'][_0x1e66('0x1a')]);}return _0x49a151['getDescriptions'](_0x7110c2);}})[_0x1e66('0x22')](function(_0x9bc6b0){if(_0x9bc6b0){return _0x9bc6b0?{'count':_0x9187ef,'rows':_0x9bc6b0}:null;}})[_0x1e66('0x22')](respondWithResult(_0x3b17f1,null))['catch'](handleError(_0x3b17f1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 3632cfc..7666595 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 _0x96ef=['./intSalesforceConfiguration.attributes','int_salesforce_configurations','util','api','moment','bluebird','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x96ef,0xd2));var _0xf96e=function(_0x5f1cfe,_0xeb0d23){_0x5f1cfe=_0x5f1cfe-0x0;var _0x23a983=_0x96ef[_0x5f1cfe];return _0x23a983;};'use strict';var _=require('lodash');var util=require(_0xf96e('0x0'));var logger=require('../../config/logger')(_0xf96e('0x1'));var moment=require(_0xf96e('0x2'));var BPromise=require(_0xf96e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf96e('0x4'));var rimraf=require(_0xf96e('0x5'));var config=require('../../config/environment');var attributes=require(_0xf96e('0x6'));module['exports']=function(_0x5c038d,_0x3d37c1){return _0x5c038d['define']('SalesforceConfiguration',attributes,{'tableName':_0xf96e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae46=['../../config/environment','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9718de,_0x17026c){var _0x10cd51=function(_0x14cf22){while(--_0x14cf22){_0x9718de['push'](_0x9718de['shift']());}};_0x10cd51(++_0x17026c);}(_0xae46,0xad));var _0x6ae4=function(_0x4366e1,_0x312378){_0x4366e1=_0x4366e1-0x0;var _0x265f9b=_0xae46[_0x4366e1];return _0x265f9b;};'use strict';var _=require(_0x6ae4('0x0'));var util=require(_0x6ae4('0x1'));var logger=require(_0x6ae4('0x2'))(_0x6ae4('0x3'));var moment=require(_0x6ae4('0x4'));var BPromise=require(_0x6ae4('0x5'));var rp=require(_0x6ae4('0x6'));var fs=require('fs');var path=require(_0x6ae4('0x7'));var rimraf=require(_0x6ae4('0x8'));var config=require(_0x6ae4('0x9'));var attributes=require(_0x6ae4('0xa'));module['exports']=function(_0x40e9e7,_0x36e396){return _0x40e9e7[_0x6ae4('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0x6ae4('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 2b6fb42..78f7341 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 _0x2a30=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x2a30,0xee));var _0x02a3=function(_0x5f091b,_0x1f8cb5){_0x5f091b=_0x5f091b-0x0;var _0x4f7f8c=_0x2a30[_0x5f091b];return _0x4f7f8c;};'use strict';var _=require('lodash');var util=require(_0x02a3('0x0'));var moment=require('moment');var BPromise=require(_0x02a3('0x1'));var rs=require(_0x02a3('0x2'));var fs=require('fs');var Redis=require(_0x02a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x02a3('0x4'))(_0x02a3('0x5'));var config=require(_0x02a3('0x6'));var jayson=require(_0x02a3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a40f7,_0x2d49aa,_0x34ca48){return new BPromise(function(_0x53da0d,_0x36ad84){return client[_0x02a3('0x8')](_0x4a40f7,_0x34ca48)['then'](function(_0xe3edbf){logger[_0x02a3('0x9')](_0x02a3('0xa'),_0x2d49aa,_0x02a3('0xb'));logger[_0x02a3('0xc')](_0x02a3('0xd'),_0x2d49aa,_0x02a3('0xb'),JSON['stringify'](_0xe3edbf));if(_0xe3edbf['error']){if(_0xe3edbf[_0x02a3('0xe')][_0x02a3('0xf')]===0x1f4){logger[_0x02a3('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2d49aa,_0xe3edbf[_0x02a3('0xe')]['message']);return _0x36ad84(_0xe3edbf['error'][_0x02a3('0x10')]);}logger[_0x02a3('0xe')](_0x02a3('0xa'),_0x2d49aa,_0xe3edbf[_0x02a3('0xe')][_0x02a3('0x10')]);return _0x53da0d(_0xe3edbf[_0x02a3('0xe')][_0x02a3('0x10')]);}else{logger[_0x02a3('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2d49aa,_0x02a3('0xb'));_0x53da0d(_0xe3edbf[_0x02a3('0x11')]['message']);}})[_0x02a3('0x12')](function(_0x5a101a){logger[_0x02a3('0xe')](_0x02a3('0xa'),_0x2d49aa,_0x5a101a);_0x36ad84(_0x5a101a);});});} \ No newline at end of file +var _0x1fc6=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','client','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x1fc6,0x77));var _0x61fc=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x1fc6[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0x61fc('0x0'));var util=require(_0x61fc('0x1'));var moment=require(_0x61fc('0x2'));var BPromise=require(_0x61fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61fc('0x5'))('rpc');var config=require(_0x61fc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x61fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x553020,_0x3e528e,_0x4f2db4){return new BPromise(function(_0x3ae497,_0xcbbdcf){return client['request'](_0x553020,_0x4f2db4)['then'](function(_0x592229){logger[_0x61fc('0x8')](_0x61fc('0x9'),_0x3e528e,_0x61fc('0xa'));logger[_0x61fc('0xb')](_0x61fc('0xc'),_0x3e528e,_0x61fc('0xa'),JSON[_0x61fc('0xd')](_0x592229));if(_0x592229['error']){if(_0x592229[_0x61fc('0xe')][_0x61fc('0xf')]===0x1f4){logger['error'](_0x61fc('0x9'),_0x3e528e,_0x592229[_0x61fc('0xe')][_0x61fc('0x10')]);return _0xcbbdcf(_0x592229[_0x61fc('0xe')][_0x61fc('0x10')]);}logger['error'](_0x61fc('0x9'),_0x3e528e,_0x592229[_0x61fc('0xe')][_0x61fc('0x10')]);return _0x3ae497(_0x592229[_0x61fc('0xe')][_0x61fc('0x10')]);}else{logger[_0x61fc('0x8')](_0x61fc('0x9'),_0x3e528e,'request\x20sent');_0x3ae497(_0x592229[_0x61fc('0x11')]['message']);}})[_0x61fc('0x12')](function(_0x289d05){logger[_0x61fc('0xe')](_0x61fc('0x9'),_0x3e528e,_0x289d05);_0xcbbdcf(_0x289d05);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 721201a..206eb38 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 _0xcc66=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update'];(function(_0x2ace30,_0x172089){var _0x24c292=function(_0x4fb949){while(--_0x4fb949){_0x2ace30['push'](_0x2ace30['shift']());}};_0x24c292(++_0x172089);}(_0xcc66,0xf0));var _0x6cc6=function(_0x44d6e2,_0x220aa1){_0x44d6e2=_0x44d6e2-0x0;var _0xc0707d=_0xcc66[_0x44d6e2];return _0xc0707d;};'use strict';var multer=require(_0x6cc6('0x0'));var util=require(_0x6cc6('0x1'));var path=require(_0x6cc6('0x2'));var timeout=require(_0x6cc6('0x3'));var express=require(_0x6cc6('0x4'));var router=express['Router']();var fs_extra=require(_0x6cc6('0x5'));var auth=require(_0x6cc6('0x6'));var interaction=require(_0x6cc6('0x7'));var config=require(_0x6cc6('0x8'));var controller=require('./intSalesforceField.controller');router[_0x6cc6('0x9')]('/',auth[_0x6cc6('0xa')](),controller['index']);router[_0x6cc6('0x9')](_0x6cc6('0xb'),auth[_0x6cc6('0xa')](),controller['show']);router[_0x6cc6('0xc')]('/',auth['isAuthenticated'](),controller[_0x6cc6('0xd')]);router['put'](_0x6cc6('0xb'),auth[_0x6cc6('0xa')](),controller[_0x6cc6('0xe')]);router['delete'](_0x6cc6('0xb'),auth[_0x6cc6('0xa')](),controller[_0x6cc6('0xf')]);module[_0x6cc6('0x10')]=router; \ No newline at end of file +var _0x56e5=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','put','delete'];(function(_0x25d846,_0x5eb082){var _0x242331=function(_0x4b6276){while(--_0x4b6276){_0x25d846['push'](_0x25d846['shift']());}};_0x242331(++_0x5eb082);}(_0x56e5,0xb6));var _0x556e=function(_0x3f5bc5,_0x378fde){_0x3f5bc5=_0x3f5bc5-0x0;var _0x25979c=_0x56e5[_0x3f5bc5];return _0x25979c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x556e('0x0'));var express=require('express');var router=express[_0x556e('0x1')]();var fs_extra=require(_0x556e('0x2'));var auth=require(_0x556e('0x3'));var interaction=require(_0x556e('0x4'));var config=require('../../config/environment');var controller=require(_0x556e('0x5'));router[_0x556e('0x6')]('/',auth[_0x556e('0x7')](),controller[_0x556e('0x8')]);router['get'](_0x556e('0x9'),auth[_0x556e('0x7')](),controller['show']);router[_0x556e('0xa')]('/',auth[_0x556e('0x7')](),controller['create']);router[_0x556e('0xb')](_0x556e('0x9'),auth[_0x556e('0x7')](),controller['update']);router[_0x556e('0xc')]('/:id',auth[_0x556e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e929e13..d9a05ab 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 _0x9a97=['string','variable','customVariable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x5c1b17,_0x4d91c7){var _0x3aea22=function(_0x4c0c4b){while(--_0x4c0c4b){_0x5c1b17['push'](_0x5c1b17['shift']());}};_0x3aea22(++_0x4d91c7);}(_0x9a97,0x65));var _0x79a9=function(_0x1c77b9,_0x4d291d){_0x1c77b9=_0x1c77b9-0x0;var _0x3b3dda=_0x9a97[_0x1c77b9];return _0x3b3dda;};'use strict';var Sequelize=require(_0x79a9('0x0'));module[_0x79a9('0x1')]={'type':{'type':Sequelize[_0x79a9('0x2')](_0x79a9('0x3'),_0x79a9('0x4'),_0x79a9('0x5'),'keyValue',_0x79a9('0x6')),'defaultValue':_0x79a9('0x3')},'content':{'type':Sequelize[_0x79a9('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x79a9('0x2')](_0x79a9('0x3'),'variable',_0x79a9('0x5'))},'keyContent':{'type':Sequelize[_0x79a9('0x7')]},'idField':{'type':Sequelize[_0x79a9('0x7')]},'variableName':{'type':Sequelize[_0x79a9('0x7')]}}; \ No newline at end of file +var _0x1126=['STRING','ENUM','sequelize','exports','variable','customVariable','keyValue','picklist','string'];(function(_0x2311ad,_0x43404f){var _0x4be13e=function(_0x14cf9d){while(--_0x14cf9d){_0x2311ad['push'](_0x2311ad['shift']());}};_0x4be13e(++_0x43404f);}(_0x1126,0xd1));var _0x6112=function(_0x7ecc0,_0x3c5cc5){_0x7ecc0=_0x7ecc0-0x0;var _0x5d016b=_0x1126[_0x7ecc0];return _0x5d016b;};'use strict';var Sequelize=require(_0x6112('0x0'));module[_0x6112('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6112('0x2'),_0x6112('0x3'),_0x6112('0x4'),_0x6112('0x5')),'defaultValue':_0x6112('0x6')},'content':{'type':Sequelize[_0x6112('0x7')]},'key':{'type':Sequelize[_0x6112('0x7')]},'keyType':{'type':Sequelize[_0x6112('0x8')](_0x6112('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6112('0x7')]},'idField':{'type':Sequelize[_0x6112('0x7')]},'variableName':{'type':Sequelize[_0x6112('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 59b4187..4a406ac 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 _0x79e3=['destroy','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SalesforceField','count','include','findAll','show','length','includeAll','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','apply','reject','save','update','then'];(function(_0x1807c5,_0x2759e6){var _0x2063aa=function(_0x6fb3a2){while(--_0x6fb3a2){_0x1807c5['push'](_0x1807c5['shift']());}};_0x2063aa(++_0x2759e6);}(_0x79e3,0x109));var _0x379e=function(_0x401508,_0x3e4e11){_0x401508=_0x401508-0x0;var _0x16544d=_0x79e3[_0x401508];return _0x16544d;};'use strict';var emlformat=require(_0x379e('0x0'));var rimraf=require(_0x379e('0x1'));var zipdir=require(_0x379e('0x2'));var jsonpatch=require(_0x379e('0x3'));var rp=require('request-promise');var moment=require(_0x379e('0x4'));var BPromise=require(_0x379e('0x5'));var Mustache=require(_0x379e('0x6'));var util=require(_0x379e('0x7'));var path=require(_0x379e('0x8'));var sox=require('sox');var csv=require(_0x379e('0x9'));var ejs=require(_0x379e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x379e('0xb'));var squel=require(_0x379e('0xc'));var crypto=require('crypto');var jsforce=require(_0x379e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x379e('0x9'));var querystring=require('querystring');var Papa=require(_0x379e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x379e('0xf'));var as=require(_0x379e('0x10'));var hardwareService=require(_0x379e('0x11'));var logger=require(_0x379e('0x12'))(_0x379e('0x13'));var utils=require(_0x379e('0x14'));var config=require(_0x379e('0x15'));var licenseUtil=require(_0x379e('0x16'));var db=require(_0x379e('0x17'))['db'];function respondWithStatusCode(_0x4b0693,_0x264670){_0x264670=_0x264670||0xcc;return function(_0x6464b){if(_0x6464b){return _0x4b0693['sendStatus'](_0x264670);}return _0x4b0693['status'](_0x264670)['end']();};}function respondWithResult(_0x5bb74a,_0x29fe0f){_0x29fe0f=_0x29fe0f||0xc8;return function(_0x26b76e){if(_0x26b76e){return _0x5bb74a[_0x379e('0x18')](_0x29fe0f)[_0x379e('0x19')](_0x26b76e);}};}function respondWithFilteredResult(_0x3e3b47,_0x4c126e){return function(_0x16817f){if(_0x16817f){var _0x4f156c=typeof _0x4c126e[_0x379e('0x1a')]===_0x379e('0x1b')&&typeof _0x4c126e[_0x379e('0x1c')]===_0x379e('0x1b');var _0x5159e9=_0x16817f['count'];var _0x11930c=_0x4f156c?0x0:_0x4c126e[_0x379e('0x1a')];var _0x269e8b=_0x4f156c?_0x16817f['count']:_0x4c126e[_0x379e('0x1a')]+_0x4c126e[_0x379e('0x1c')];var _0x3a37c8;if(_0x269e8b>=_0x5159e9){_0x269e8b=_0x5159e9;_0x3a37c8=0xc8;}else{_0x3a37c8=0xce;}_0x3e3b47['status'](_0x3a37c8);return _0x3e3b47[_0x379e('0x1d')]('Content-Range',_0x11930c+'-'+_0x269e8b+'/'+_0x5159e9)[_0x379e('0x19')](_0x16817f);}return null;};}function patchUpdates(_0x402b69){return function(_0x13721d){try{jsonpatch[_0x379e('0x1e')](_0x13721d,_0x402b69,!![]);}catch(_0x476829){return BPromise[_0x379e('0x1f')](_0x476829);}return _0x13721d[_0x379e('0x20')]();};}function saveUpdates(_0x189ebf,_0x293eef){return function(_0x2c3e94){if(_0x2c3e94){return _0x2c3e94[_0x379e('0x21')](_0x189ebf)[_0x379e('0x22')](function(_0x3f68a8){return _0x3f68a8;});}return null;};}function removeEntity(_0x2f5685,_0x5885f7){return function(_0x86234a){if(_0x86234a){return _0x86234a[_0x379e('0x23')]()[_0x379e('0x22')](function(){_0x2f5685[_0x379e('0x18')](0xcc)[_0x379e('0x24')]();});}};}function handleEntityNotFound(_0x448fd1,_0x553bff){return function(_0x4f9d40){if(!_0x4f9d40){_0x448fd1[_0x379e('0x25')](0x194);}return _0x4f9d40;};}function handleError(_0x2a4505,_0x7805a7){_0x7805a7=_0x7805a7||0x1f4;return function(_0x44ce49){logger[_0x379e('0x26')](_0x44ce49['stack']);if(_0x44ce49[_0x379e('0x27')]){delete _0x44ce49[_0x379e('0x27')];}_0x2a4505['status'](_0x7805a7)[_0x379e('0x28')](_0x44ce49);};}exports[_0x379e('0x29')]=function(_0x3656f3,_0x9f0eff){var _0x25dc1e={},_0x34ac92={},_0x76c041={'count':0x0,'rows':[]};var _0x4e2fe5=_[_0x379e('0x2a')](db['SalesforceField'][_0x379e('0x2b')],function(_0x4c3b6d){return{'name':_0x4c3b6d[_0x379e('0x2c')],'type':_0x4c3b6d['type']['key']};});_0x34ac92[_0x379e('0x2d')]=_['map'](_0x4e2fe5,_0x379e('0x27'));_0x34ac92[_0x379e('0x2e')]=_[_0x379e('0x2f')](_0x3656f3['query']);_0x34ac92[_0x379e('0x30')]=_[_0x379e('0x31')](_0x34ac92[_0x379e('0x2d')],_0x34ac92[_0x379e('0x2e')]);_0x25dc1e[_0x379e('0x32')]=_[_0x379e('0x31')](_0x34ac92[_0x379e('0x2d')],qs[_0x379e('0x33')](_0x3656f3['query'][_0x379e('0x33')]));_0x25dc1e[_0x379e('0x32')]=_0x25dc1e[_0x379e('0x32')]['length']?_0x25dc1e[_0x379e('0x32')]:_0x34ac92[_0x379e('0x2d')];if(!_0x3656f3[_0x379e('0x2e')][_0x379e('0x34')](_0x379e('0x35'))){_0x25dc1e['limit']=qs[_0x379e('0x1c')](_0x3656f3['query'][_0x379e('0x1c')]);_0x25dc1e[_0x379e('0x1a')]=qs[_0x379e('0x1a')](_0x3656f3[_0x379e('0x2e')][_0x379e('0x1a')]);}_0x25dc1e[_0x379e('0x36')]=qs[_0x379e('0x37')](_0x3656f3[_0x379e('0x2e')][_0x379e('0x37')]);_0x25dc1e[_0x379e('0x38')]=qs['filters'](_[_0x379e('0x39')](_0x3656f3[_0x379e('0x2e')],_0x34ac92[_0x379e('0x30')]),_0x4e2fe5);if(_0x3656f3['query'][_0x379e('0x3a')]){_0x25dc1e[_0x379e('0x38')]=_[_0x379e('0x3b')](_0x25dc1e[_0x379e('0x38')],{'$or':_['map'](_0x4e2fe5,function(_0x197d27){if(_0x197d27[_0x379e('0x3c')]!==_0x379e('0x3d')){var _0x37a665={};_0x37a665[_0x197d27['name']]={'$like':'%'+_0x3656f3['query']['filter']+'%'};return _0x37a665;}})});}_0x25dc1e=_[_0x379e('0x3b')]({},_0x25dc1e,_0x3656f3[_0x379e('0x3e')]);var _0x5531be={'where':_0x25dc1e[_0x379e('0x38')]};return db[_0x379e('0x3f')]['count'](_0x5531be)[_0x379e('0x22')](function(_0x346921){_0x76c041[_0x379e('0x40')]=_0x346921;if(_0x3656f3[_0x379e('0x2e')]['includeAll']){_0x25dc1e[_0x379e('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x379e('0x42')](_0x25dc1e);})[_0x379e('0x22')](function(_0x1c1165){_0x76c041['rows']=_0x1c1165;return _0x76c041;})[_0x379e('0x22')](respondWithFilteredResult(_0x9f0eff,_0x25dc1e))['catch'](handleError(_0x9f0eff,null));};exports[_0x379e('0x43')]=function(_0x564f5f,_0x5e0bf1){var _0x1dc67c={'raw':!![],'where':{'id':_0x564f5f['params']['id']}},_0x522804={};_0x522804[_0x379e('0x2d')]=_[_0x379e('0x2f')](db['SalesforceField'][_0x379e('0x2b')]);_0x522804[_0x379e('0x2e')]=_['keys'](_0x564f5f[_0x379e('0x2e')]);_0x522804[_0x379e('0x30')]=_['intersection'](_0x522804['model'],_0x522804[_0x379e('0x2e')]);_0x1dc67c[_0x379e('0x32')]=_['intersection'](_0x522804[_0x379e('0x2d')],qs[_0x379e('0x33')](_0x564f5f[_0x379e('0x2e')][_0x379e('0x33')]));_0x1dc67c[_0x379e('0x32')]=_0x1dc67c[_0x379e('0x32')][_0x379e('0x44')]?_0x1dc67c[_0x379e('0x32')]:_0x522804[_0x379e('0x2d')];if(_0x564f5f[_0x379e('0x2e')][_0x379e('0x45')]){_0x1dc67c[_0x379e('0x41')]=[{'all':!![]}];}_0x1dc67c=_[_0x379e('0x3b')]({},_0x1dc67c,_0x564f5f[_0x379e('0x3e')]);return db[_0x379e('0x3f')][_0x379e('0x46')](_0x1dc67c)[_0x379e('0x22')](handleEntityNotFound(_0x5e0bf1,null))[_0x379e('0x22')](respondWithResult(_0x5e0bf1,null))[_0x379e('0x47')](handleError(_0x5e0bf1,null));};exports[_0x379e('0x48')]=function(_0x12edd2,_0x48e5ce){return db['SalesforceField'][_0x379e('0x48')](_0x12edd2['body'],{})[_0x379e('0x22')](respondWithResult(_0x48e5ce,0xc9))['catch'](handleError(_0x48e5ce,null));};exports[_0x379e('0x21')]=function(_0x55cc48,_0x242b9e){if(_0x55cc48['body']['id']){delete _0x55cc48[_0x379e('0x49')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x55cc48[_0x379e('0x4a')]['id']}})[_0x379e('0x22')](handleEntityNotFound(_0x242b9e,null))[_0x379e('0x22')](saveUpdates(_0x55cc48[_0x379e('0x49')],null))['then'](respondWithResult(_0x242b9e,null))[_0x379e('0x47')](handleError(_0x242b9e,null));};exports[_0x379e('0x23')]=function(_0x59ef93,_0x161dad){return db['SalesforceField']['find']({'where':{'id':_0x59ef93[_0x379e('0x4a')]['id']}})[_0x379e('0x22')](handleEntityNotFound(_0x161dad,null))[_0x379e('0x22')](removeEntity(_0x161dad,null))[_0x379e('0x47')](handleError(_0x161dad,null));}; \ No newline at end of file +var _0x9c2a=['index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','SalesforceField','includeAll','include','rows','catch','show','params','keys','length','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','name'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9c2a,0xb5));var _0xa9c2=function(_0x2f2e0e,_0xbeb776){_0x2f2e0e=_0x2f2e0e-0x0;var _0x465367=_0x9c2a[_0x2f2e0e];return _0x465367;};'use strict';var emlformat=require(_0xa9c2('0x0'));var rimraf=require(_0xa9c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c2('0x2'));var rp=require(_0xa9c2('0x3'));var moment=require(_0xa9c2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa9c2('0x5'));var path=require('path');var sox=require(_0xa9c2('0x6'));var csv=require(_0xa9c2('0x7'));var ejs=require(_0xa9c2('0x8'));var fs=require('fs');var fs_extra=require(_0xa9c2('0x9'));var _=require(_0xa9c2('0xa'));var squel=require(_0xa9c2('0xb'));var crypto=require(_0xa9c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa9c2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa9c2('0xe'));var Papa=require(_0xa9c2('0xf'));var Redis=require(_0xa9c2('0x10'));var authService=require(_0xa9c2('0x11'));var qs=require(_0xa9c2('0x12'));var as=require(_0xa9c2('0x13'));var hardwareService=require(_0xa9c2('0x14'));var logger=require(_0xa9c2('0x15'))(_0xa9c2('0x16'));var utils=require(_0xa9c2('0x17'));var config=require(_0xa9c2('0x18'));var licenseUtil=require(_0xa9c2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e2467,_0x41b0bf){_0x41b0bf=_0x41b0bf||0xcc;return function(_0x5ce8a9){if(_0x5ce8a9){return _0x1e2467[_0xa9c2('0x1a')](_0x41b0bf);}return _0x1e2467[_0xa9c2('0x1b')](_0x41b0bf)[_0xa9c2('0x1c')]();};}function respondWithResult(_0x50ddf7,_0x581ec0){_0x581ec0=_0x581ec0||0xc8;return function(_0x5075c4){if(_0x5075c4){return _0x50ddf7[_0xa9c2('0x1b')](_0x581ec0)[_0xa9c2('0x1d')](_0x5075c4);}};}function respondWithFilteredResult(_0x31fc7a,_0x12d6b9){return function(_0x245769){if(_0x245769){var _0x5a9ee8=typeof _0x12d6b9['offset']===_0xa9c2('0x1e')&&typeof _0x12d6b9[_0xa9c2('0x1f')]===_0xa9c2('0x1e');var _0x3c62e0=_0x245769['count'];var _0x479b2a=_0x5a9ee8?0x0:_0x12d6b9['offset'];var _0x2be264=_0x5a9ee8?_0x245769[_0xa9c2('0x20')]:_0x12d6b9[_0xa9c2('0x21')]+_0x12d6b9[_0xa9c2('0x1f')];var _0x2fcdec;if(_0x2be264>=_0x3c62e0){_0x2be264=_0x3c62e0;_0x2fcdec=0xc8;}else{_0x2fcdec=0xce;}_0x31fc7a[_0xa9c2('0x1b')](_0x2fcdec);return _0x31fc7a['set']('Content-Range',_0x479b2a+'-'+_0x2be264+'/'+_0x3c62e0)[_0xa9c2('0x1d')](_0x245769);}return null;};}function patchUpdates(_0x12a573){return function(_0x1f4066){try{jsonpatch[_0xa9c2('0x22')](_0x1f4066,_0x12a573,!![]);}catch(_0x1ac17d){return BPromise[_0xa9c2('0x23')](_0x1ac17d);}return _0x1f4066[_0xa9c2('0x24')]();};}function saveUpdates(_0x5dbb28,_0x1d193d){return function(_0x1957cd){if(_0x1957cd){return _0x1957cd[_0xa9c2('0x25')](_0x5dbb28)[_0xa9c2('0x26')](function(_0x196816){return _0x196816;});}return null;};}function removeEntity(_0x393a8f,_0x4bd128){return function(_0x14d63c){if(_0x14d63c){return _0x14d63c[_0xa9c2('0x27')]()[_0xa9c2('0x26')](function(){_0x393a8f[_0xa9c2('0x1b')](0xcc)[_0xa9c2('0x1c')]();});}};}function handleEntityNotFound(_0x26069e,_0x3b6ca9){return function(_0x6dfec0){if(!_0x6dfec0){_0x26069e['sendStatus'](0x194);}return _0x6dfec0;};}function handleError(_0x35f2f8,_0x2ebc2c){_0x2ebc2c=_0x2ebc2c||0x1f4;return function(_0xd87a1e){logger['error'](_0xd87a1e['stack']);if(_0xd87a1e[_0xa9c2('0x28')]){delete _0xd87a1e[_0xa9c2('0x28')];}_0x35f2f8['status'](_0x2ebc2c)['send'](_0xd87a1e);};}exports[_0xa9c2('0x29')]=function(_0x4be27e,_0x115c7e){var _0x406d02={},_0x174358={},_0x212104={'count':0x0,'rows':[]};var _0x2fa3d6=_[_0xa9c2('0x2a')](db['SalesforceField'][_0xa9c2('0x2b')],function(_0x423c54){return{'name':_0x423c54[_0xa9c2('0x2c')],'type':_0x423c54[_0xa9c2('0x2d')]['key']};});_0x174358[_0xa9c2('0x2e')]=_[_0xa9c2('0x2a')](_0x2fa3d6,_0xa9c2('0x28'));_0x174358['query']=_['keys'](_0x4be27e[_0xa9c2('0x2f')]);_0x174358[_0xa9c2('0x30')]=_[_0xa9c2('0x31')](_0x174358[_0xa9c2('0x2e')],_0x174358[_0xa9c2('0x2f')]);_0x406d02[_0xa9c2('0x32')]=_[_0xa9c2('0x31')](_0x174358['model'],qs['fields'](_0x4be27e['query'][_0xa9c2('0x33')]));_0x406d02[_0xa9c2('0x32')]=_0x406d02[_0xa9c2('0x32')]['length']?_0x406d02[_0xa9c2('0x32')]:_0x174358[_0xa9c2('0x2e')];if(!_0x4be27e[_0xa9c2('0x2f')][_0xa9c2('0x34')](_0xa9c2('0x35'))){_0x406d02['limit']=qs[_0xa9c2('0x1f')](_0x4be27e[_0xa9c2('0x2f')][_0xa9c2('0x1f')]);_0x406d02[_0xa9c2('0x21')]=qs[_0xa9c2('0x21')](_0x4be27e[_0xa9c2('0x2f')]['offset']);}_0x406d02[_0xa9c2('0x36')]=qs[_0xa9c2('0x37')](_0x4be27e['query'][_0xa9c2('0x37')]);_0x406d02['where']=qs['filters'](_[_0xa9c2('0x38')](_0x4be27e['query'],_0x174358['filters']),_0x2fa3d6);if(_0x4be27e[_0xa9c2('0x2f')][_0xa9c2('0x39')]){_0x406d02['where']=_[_0xa9c2('0x3a')](_0x406d02[_0xa9c2('0x3b')],{'$or':_[_0xa9c2('0x2a')](_0x2fa3d6,function(_0x1d0944){if(_0x1d0944['type']!==_0xa9c2('0x3c')){var _0x25f8a6={};_0x25f8a6[_0x1d0944[_0xa9c2('0x28')]]={'$like':'%'+_0x4be27e[_0xa9c2('0x2f')][_0xa9c2('0x39')]+'%'};return _0x25f8a6;}})});}_0x406d02=_[_0xa9c2('0x3a')]({},_0x406d02,_0x4be27e[_0xa9c2('0x3d')]);var _0x440dc1={'where':_0x406d02[_0xa9c2('0x3b')]};return db[_0xa9c2('0x3e')][_0xa9c2('0x20')](_0x440dc1)[_0xa9c2('0x26')](function(_0x393c04){_0x212104[_0xa9c2('0x20')]=_0x393c04;if(_0x4be27e['query'][_0xa9c2('0x3f')]){_0x406d02[_0xa9c2('0x40')]=[{'all':!![]}];}return db[_0xa9c2('0x3e')]['findAll'](_0x406d02);})[_0xa9c2('0x26')](function(_0x1624f1){_0x212104[_0xa9c2('0x41')]=_0x1624f1;return _0x212104;})[_0xa9c2('0x26')](respondWithFilteredResult(_0x115c7e,_0x406d02))[_0xa9c2('0x42')](handleError(_0x115c7e,null));};exports[_0xa9c2('0x43')]=function(_0xf4f1c7,_0x33c5a1){var _0x490a43={'raw':!![],'where':{'id':_0xf4f1c7[_0xa9c2('0x44')]['id']}},_0x519f32={};_0x519f32[_0xa9c2('0x2e')]=_['keys'](db[_0xa9c2('0x3e')][_0xa9c2('0x2b')]);_0x519f32[_0xa9c2('0x2f')]=_[_0xa9c2('0x45')](_0xf4f1c7['query']);_0x519f32[_0xa9c2('0x30')]=_[_0xa9c2('0x31')](_0x519f32[_0xa9c2('0x2e')],_0x519f32[_0xa9c2('0x2f')]);_0x490a43[_0xa9c2('0x32')]=_[_0xa9c2('0x31')](_0x519f32[_0xa9c2('0x2e')],qs['fields'](_0xf4f1c7[_0xa9c2('0x2f')][_0xa9c2('0x33')]));_0x490a43['attributes']=_0x490a43[_0xa9c2('0x32')][_0xa9c2('0x46')]?_0x490a43[_0xa9c2('0x32')]:_0x519f32[_0xa9c2('0x2e')];if(_0xf4f1c7[_0xa9c2('0x2f')]['includeAll']){_0x490a43[_0xa9c2('0x40')]=[{'all':!![]}];}_0x490a43=_[_0xa9c2('0x3a')]({},_0x490a43,_0xf4f1c7[_0xa9c2('0x3d')]);return db['SalesforceField']['find'](_0x490a43)['then'](handleEntityNotFound(_0x33c5a1,null))[_0xa9c2('0x26')](respondWithResult(_0x33c5a1,null))[_0xa9c2('0x42')](handleError(_0x33c5a1,null));};exports[_0xa9c2('0x47')]=function(_0x218e86,_0x1eff7e){return db[_0xa9c2('0x3e')][_0xa9c2('0x47')](_0x218e86[_0xa9c2('0x48')],{})[_0xa9c2('0x26')](respondWithResult(_0x1eff7e,0xc9))[_0xa9c2('0x42')](handleError(_0x1eff7e,null));};exports['update']=function(_0x205010,_0x5eddcf){if(_0x205010['body']['id']){delete _0x205010[_0xa9c2('0x48')]['id'];}return db[_0xa9c2('0x3e')][_0xa9c2('0x49')]({'where':{'id':_0x205010[_0xa9c2('0x44')]['id']}})[_0xa9c2('0x26')](handleEntityNotFound(_0x5eddcf,null))[_0xa9c2('0x26')](saveUpdates(_0x205010[_0xa9c2('0x48')],null))['then'](respondWithResult(_0x5eddcf,null))[_0xa9c2('0x42')](handleError(_0x5eddcf,null));};exports[_0xa9c2('0x27')]=function(_0x2e08e2,_0x1382ca){return db[_0xa9c2('0x3e')][_0xa9c2('0x49')]({'where':{'id':_0x2e08e2[_0xa9c2('0x44')]['id']}})[_0xa9c2('0x26')](handleEntityNotFound(_0x1382ca,null))['then'](removeEntity(_0x1382ca,null))[_0xa9c2('0x42')](handleError(_0x1382ca,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f193bc3..3e08c49 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 _0xd4a7=['exports','define','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x4be961,_0x4448d6){var _0x3c6b91=function(_0x23cac0){while(--_0x23cac0){_0x4be961['push'](_0x4be961['shift']());}};_0x3c6b91(++_0x4448d6);}(_0xd4a7,0x7a));var _0x7d4a=function(_0x1c76b4,_0x1711fb){_0x1c76b4=_0x1c76b4-0x0;var _0x497eea=_0xd4a7[_0x1c76b4];return _0x497eea;};'use strict';var _=require(_0x7d4a('0x0'));var util=require('util');var logger=require(_0x7d4a('0x1'))('api');var moment=require(_0x7d4a('0x2'));var BPromise=require(_0x7d4a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d4a('0x4'));var rimraf=require(_0x7d4a('0x5'));var config=require(_0x7d4a('0x6'));var attributes=require(_0x7d4a('0x7'));module[_0x7d4a('0x8')]=function(_0x19e206,_0x5e9e04){return _0x19e206[_0x7d4a('0x9')]('SalesforceField',attributes,{'tableName':_0x7d4a('0xa'),'paranoid':![],'indexes':[{'name':_0x7d4a('0xb'),'fields':['idField',_0x7d4a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x044d=['request-promise','path','rimraf','exports','define','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','moment'];(function(_0x5f4126,_0x4173a2){var _0x3174ce=function(_0x10dc42){while(--_0x10dc42){_0x5f4126['push'](_0x5f4126['shift']());}};_0x3174ce(++_0x4173a2);}(_0x044d,0x1cb));var _0xd044=function(_0x4e2969,_0x5dfcda){_0x4e2969=_0x4e2969-0x0;var _0x5c4dd7=_0x044d[_0x4e2969];return _0x5c4dd7;};'use strict';var _=require(_0xd044('0x0'));var util=require('util');var logger=require(_0xd044('0x1'))('api');var moment=require(_0xd044('0x2'));var BPromise=require('bluebird');var rp=require(_0xd044('0x3'));var fs=require('fs');var path=require(_0xd044('0x4'));var rimraf=require(_0xd044('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xd044('0x6')]=function(_0x5ae087,_0x44e712){return _0x5ae087[_0xd044('0x7')]('SalesforceField',attributes,{'tableName':_0xd044('0x8'),'paranoid':![],'indexes':[{'name':_0xd044('0x9'),'fields':['idField',_0xd044('0xa')],'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 65d9090..ecb57f0 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 _0xbc25=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x48b49a,_0x19af12){var _0x3b2587=function(_0x7b66a1){while(--_0x7b66a1){_0x48b49a['push'](_0x48b49a['shift']());}};_0x3b2587(++_0x19af12);}(_0xbc25,0x185));var _0x5bc2=function(_0x2662e5,_0x3db3b1){_0x2662e5=_0x2662e5-0x0;var _0x2c9ca4=_0xbc25[_0x2662e5];return _0x2c9ca4;};'use strict';var _=require(_0x5bc2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5bc2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bc2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bc2('0x3'))(_0x5bc2('0x4'));var config=require(_0x5bc2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5bc2('0x6')][_0x5bc2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2edf0b,_0x5aae4a,_0x3adeb9){return new BPromise(function(_0x406b2e,_0x11a4a0){return client[_0x5bc2('0x8')](_0x2edf0b,_0x3adeb9)[_0x5bc2('0x9')](function(_0x25c4cc){logger['info'](_0x5bc2('0xa'),_0x5aae4a,_0x5bc2('0xb'));logger[_0x5bc2('0xc')](_0x5bc2('0xd'),_0x5aae4a,_0x5bc2('0xb'),JSON[_0x5bc2('0xe')](_0x25c4cc));if(_0x25c4cc[_0x5bc2('0xf')]){if(_0x25c4cc[_0x5bc2('0xf')][_0x5bc2('0x10')]===0x1f4){logger['error'](_0x5bc2('0xa'),_0x5aae4a,_0x25c4cc[_0x5bc2('0xf')][_0x5bc2('0x11')]);return _0x11a4a0(_0x25c4cc[_0x5bc2('0xf')][_0x5bc2('0x11')]);}logger['error'](_0x5bc2('0xa'),_0x5aae4a,_0x25c4cc[_0x5bc2('0xf')][_0x5bc2('0x11')]);return _0x406b2e(_0x25c4cc[_0x5bc2('0xf')][_0x5bc2('0x11')]);}else{logger['info'](_0x5bc2('0xa'),_0x5aae4a,_0x5bc2('0xb'));_0x406b2e(_0x25c4cc['result'][_0x5bc2('0x11')]);}})[_0x5bc2('0x12')](function(_0xc11d4c){logger[_0x5bc2('0xf')](_0x5bc2('0xa'),_0x5aae4a,_0xc11d4c);_0x11a4a0(_0xc11d4c);});});} \ No newline at end of file +var _0xb782=['../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xb782,0x9d));var _0x2b78=function(_0xb0a145,_0x408853){_0xb0a145=_0xb0a145-0x0;var _0x57de6f=_0xb782[_0xb0a145];return _0x57de6f;};'use strict';var _=require('lodash');var util=require(_0x2b78('0x0'));var moment=require('moment');var BPromise=require(_0x2b78('0x1'));var rs=require(_0x2b78('0x2'));var fs=require('fs');var Redis=require(_0x2b78('0x3'));var db=require(_0x2b78('0x4'))['db'];var utils=require(_0x2b78('0x5'));var logger=require('../../config/logger')(_0x2b78('0x6'));var config=require(_0x2b78('0x7'));var jayson=require(_0x2b78('0x8'));var client=jayson[_0x2b78('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a59e4,_0x4d25a7,_0x821501){return new BPromise(function(_0x55ffbb,_0x555ffa){return client['request'](_0x1a59e4,_0x821501)[_0x2b78('0xa')](function(_0x2693b3){logger[_0x2b78('0xb')](_0x2b78('0xc'),_0x4d25a7,_0x2b78('0xd'));logger['debug'](_0x2b78('0xe'),_0x4d25a7,_0x2b78('0xd'),JSON[_0x2b78('0xf')](_0x2693b3));if(_0x2693b3[_0x2b78('0x10')]){if(_0x2693b3[_0x2b78('0x10')]['code']===0x1f4){logger[_0x2b78('0x10')](_0x2b78('0xc'),_0x4d25a7,_0x2693b3[_0x2b78('0x10')][_0x2b78('0x11')]);return _0x555ffa(_0x2693b3['error'][_0x2b78('0x11')]);}logger[_0x2b78('0x10')](_0x2b78('0xc'),_0x4d25a7,_0x2693b3[_0x2b78('0x10')][_0x2b78('0x11')]);return _0x55ffbb(_0x2693b3['error']['message']);}else{logger[_0x2b78('0xb')]('SalesforceField,\x20%s,\x20%s',_0x4d25a7,'request\x20sent');_0x55ffbb(_0x2693b3['result']['message']);}})['catch'](function(_0x188de4){logger[_0x2b78('0x10')](_0x2b78('0xc'),_0x4d25a7,_0x188de4);_0x555ffa(_0x188de4);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e4ac290..9f5537f 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 _0xe07b=['addConfiguration','put','/:id','update','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x490e25,_0x2f6932){var _0x1358fb=function(_0x1d6f0a){while(--_0x1d6f0a){_0x490e25['push'](_0x490e25['shift']());}};_0x1358fb(++_0x2f6932);}(_0xe07b,0x181));var _0xbe07=function(_0x157661,_0x3bec27){_0x157661=_0x157661-0x0;var _0x5a2003=_0xe07b[_0x157661];return _0x5a2003;};'use strict';var multer=require(_0xbe07('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe07('0x1'));var router=express[_0xbe07('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbe07('0x3'));var interaction=require(_0xbe07('0x4'));var config=require(_0xbe07('0x5'));var controller=require('./intServicenowAccount.controller');router[_0xbe07('0x6')]('/',auth[_0xbe07('0x7')](),controller[_0xbe07('0x8')]);router[_0xbe07('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xbe07('0x9')]);router[_0xbe07('0x6')](_0xbe07('0xa'),auth[_0xbe07('0x7')](),controller[_0xbe07('0xb')]);router[_0xbe07('0x6')](_0xbe07('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xbe07('0xd')]('/',auth['isAuthenticated'](),controller[_0xbe07('0xe')]);router[_0xbe07('0xd')](_0xbe07('0xa'),auth[_0xbe07('0x7')](),controller[_0xbe07('0xf')]);router[_0xbe07('0x10')](_0xbe07('0x11'),auth[_0xbe07('0x7')](),controller[_0xbe07('0x12')]);router['delete']('/:id',auth[_0xbe07('0x7')](),controller[_0xbe07('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4d0b=['/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x4aa945,_0x2f6bf0){var _0x5679f8=function(_0x3adb00){while(--_0x3adb00){_0x4aa945['push'](_0x4aa945['shift']());}};_0x5679f8(++_0x2f6bf0);}(_0x4d0b,0x1d5));var _0xb4d0=function(_0x10b8d3,_0x26692a){_0x10b8d3=_0x10b8d3-0x0;var _0x8de4fd=_0x4d0b[_0x10b8d3];return _0x8de4fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb4d0('0x0'));var timeout=require(_0xb4d0('0x1'));var express=require(_0xb4d0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb4d0('0x3'));var interaction=require(_0xb4d0('0x4'));var config=require(_0xb4d0('0x5'));var controller=require(_0xb4d0('0x6'));router[_0xb4d0('0x7')]('/',auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x9')]);router[_0xb4d0('0x7')](_0xb4d0('0xa'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0xb')]);router['get'](_0xb4d0('0xc'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0xd')]);router['get'](_0xb4d0('0xe'),auth[_0xb4d0('0x8')](),controller['getFields']);router[_0xb4d0('0xf')]('/',auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x10')]);router[_0xb4d0('0xf')](_0xb4d0('0xc'),auth['isAuthenticated'](),controller[_0xb4d0('0x11')]);router[_0xb4d0('0x12')]('/:id',auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x13')]);router[_0xb4d0('0x14')](_0xb4d0('0xa'),auth[_0xb4d0('0x8')](),controller[_0xb4d0('0x15')]);module[_0xb4d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index cb1fed6..d75c0a6 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 _0xc57b=['username','remoteUri','sequelize','exports','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc57b,0x192));var _0xbc57=function(_0x163ecf,_0x5ba049){_0x163ecf=_0x163ecf-0x0;var _0x91c7af=_0xc57b[_0x163ecf];return _0x91c7af;};'use strict';var Sequelize=require(_0xbc57('0x0'));module[_0xbc57('0x1')]={'name':{'type':Sequelize[_0xbc57('0x2')]},'description':{'type':Sequelize[_0xbc57('0x2')]},'username':{'type':Sequelize[_0xbc57('0x2')],'unique':_0xbc57('0x3')},'password':{'type':Sequelize[_0xbc57('0x2')]},'email':{'type':Sequelize[_0xbc57('0x2')]},'remoteUri':{'type':Sequelize[_0xbc57('0x2')],'unique':_0xbc57('0x4')},'serverUrl':{'type':Sequelize[_0xbc57('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7fb8=['STRING','username','sequelize'];(function(_0x1a16c0,_0x4f47bc){var _0xfb99d3=function(_0x117d59){while(--_0x117d59){_0x1a16c0['push'](_0x1a16c0['shift']());}};_0xfb99d3(++_0x4f47bc);}(_0x7fb8,0xad));var _0x87fb=function(_0x11ad36,_0x4c98f6){_0x11ad36=_0x11ad36-0x0;var _0x5d7905=_0x7fb8[_0x11ad36];return _0x5d7905;};'use strict';var Sequelize=require(_0x87fb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x87fb('0x1')]},'username':{'type':Sequelize[_0x87fb('0x1')],'unique':_0x87fb('0x2')},'password':{'type':Sequelize[_0x87fb('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x87fb('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x87fb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 2df4e3a..87c2c4e 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 _0x3042=['getDescriptions','ServicenowField','Subjects','Descriptions','getFields','made_sla','knowledge','close_code','notify','incident_state','severity','watch_list','sys_updated_on','child_incidents','hold_reason','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','expected_start','opened_at','business_duration','work_end','reopened_time','approval_set','short_description','correlation_display','delivery_task','assignment_group','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','sys_mod_count','escalation','correlation_id','location','category','username','password','email','remoteUri','serverUrl','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','includeAll','rows','catch','params','include','options','find','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel'];(function(_0x1ffe86,_0x1f920c){var _0x44c631=function(_0x1c8bfa){while(--_0x1c8bfa){_0x1ffe86['push'](_0x1ffe86['shift']());}};_0x44c631(++_0x1f920c);}(_0x3042,0x1b7));var _0x2304=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x3042[_0x35ef6b];return _0x3ad145;};'use strict';var emlformat=require(_0x2304('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2304('0x1'));var rp=require(_0x2304('0x2'));var moment=require('moment');var BPromise=require(_0x2304('0x3'));var Mustache=require(_0x2304('0x4'));var util=require(_0x2304('0x5'));var path=require(_0x2304('0x6'));var sox=require('sox');var csv=require(_0x2304('0x7'));var ejs=require(_0x2304('0x8'));var fs=require('fs');var fs_extra=require(_0x2304('0x9'));var _=require(_0x2304('0xa'));var squel=require(_0x2304('0xb'));var crypto=require(_0x2304('0xc'));var jsforce=require(_0x2304('0xd'));var deskjs=require(_0x2304('0xe'));var toCsv=require(_0x2304('0x7'));var querystring=require(_0x2304('0xf'));var Papa=require(_0x2304('0x10'));var Redis=require(_0x2304('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2304('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2304('0x13'));var logger=require(_0x2304('0x14'))(_0x2304('0x15'));var utils=require('../../config/utils');var config=require(_0x2304('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x2304('0x17'));function respondWithStatusCode(_0x2cc6b7,_0x1ab829){_0x1ab829=_0x1ab829||0xcc;return function(_0x423874){if(_0x423874){return _0x2cc6b7[_0x2304('0x18')](_0x1ab829);}return _0x2cc6b7[_0x2304('0x19')](_0x1ab829)[_0x2304('0x1a')]();};}function respondWithResult(_0x47352a,_0x5662af){_0x5662af=_0x5662af||0xc8;return function(_0x34e21e){if(_0x34e21e){return _0x47352a[_0x2304('0x19')](_0x5662af)['json'](_0x34e21e);}};}function respondWithFilteredResult(_0x59cb30,_0x134268){return function(_0x4677ee){if(_0x4677ee){var _0x5a5470=typeof _0x134268[_0x2304('0x1b')]===_0x2304('0x1c')&&typeof _0x134268[_0x2304('0x1d')]===_0x2304('0x1c');var _0x34c4ff=_0x4677ee[_0x2304('0x1e')];var _0x250615=_0x5a5470?0x0:_0x134268[_0x2304('0x1b')];var _0x410b31=_0x5a5470?_0x4677ee[_0x2304('0x1e')]:_0x134268[_0x2304('0x1b')]+_0x134268['limit'];var _0x206b51;if(_0x410b31>=_0x34c4ff){_0x410b31=_0x34c4ff;_0x206b51=0xc8;}else{_0x206b51=0xce;}_0x59cb30[_0x2304('0x19')](_0x206b51);return _0x59cb30[_0x2304('0x1f')](_0x2304('0x20'),_0x250615+'-'+_0x410b31+'/'+_0x34c4ff)[_0x2304('0x21')](_0x4677ee);}return null;};}function patchUpdates(_0xaaea92){return function(_0x58bbf0){try{jsonpatch['apply'](_0x58bbf0,_0xaaea92,!![]);}catch(_0x28823b){return BPromise[_0x2304('0x22')](_0x28823b);}return _0x58bbf0[_0x2304('0x23')]();};}function saveUpdates(_0x7a4668,_0x281d17){return function(_0xcd2d){if(_0xcd2d){return _0xcd2d['update'](_0x7a4668)[_0x2304('0x24')](function(_0xa52c8f){return _0xa52c8f;});}return null;};}function removeEntity(_0x23994e,_0x14e294){return function(_0x47a655){if(_0x47a655){return _0x47a655[_0x2304('0x25')]()[_0x2304('0x24')](function(){_0x23994e[_0x2304('0x19')](0xcc)[_0x2304('0x1a')]();});}};}function handleEntityNotFound(_0x4bff75,_0x1b2ad6){return function(_0x206c46){if(!_0x206c46){_0x4bff75['sendStatus'](0x194);}return _0x206c46;};}function handleError(_0xc25b4b,_0x57460a){_0x57460a=_0x57460a||0x1f4;return function(_0x1153f7){logger[_0x2304('0x26')](_0x1153f7[_0x2304('0x27')]);if(_0x1153f7[_0x2304('0x28')]){delete _0x1153f7[_0x2304('0x28')];}_0xc25b4b[_0x2304('0x19')](_0x57460a)[_0x2304('0x29')](_0x1153f7);};}exports[_0x2304('0x2a')]=function(_0x13f830,_0x2de0c4){var _0x1506e7={},_0x283f29={},_0x3a5b7f={'count':0x0,'rows':[]};var _0x12f5fa=_[_0x2304('0x2b')](db[_0x2304('0x2c')][_0x2304('0x2d')],function(_0x249931){return{'name':_0x249931[_0x2304('0x2e')],'type':_0x249931[_0x2304('0x2f')]['key']};});_0x283f29[_0x2304('0x30')]=_[_0x2304('0x2b')](_0x12f5fa,_0x2304('0x28'));_0x283f29[_0x2304('0x31')]=_[_0x2304('0x32')](_0x13f830[_0x2304('0x31')]);_0x283f29['filters']=_[_0x2304('0x33')](_0x283f29[_0x2304('0x30')],_0x283f29[_0x2304('0x31')]);_0x1506e7['attributes']=_[_0x2304('0x33')](_0x283f29[_0x2304('0x30')],qs[_0x2304('0x34')](_0x13f830[_0x2304('0x31')][_0x2304('0x34')]));_0x1506e7['attributes']=_0x1506e7[_0x2304('0x35')][_0x2304('0x36')]?_0x1506e7['attributes']:_0x283f29[_0x2304('0x30')];if(!_0x13f830['query'][_0x2304('0x37')](_0x2304('0x38'))){_0x1506e7['limit']=qs[_0x2304('0x1d')](_0x13f830[_0x2304('0x31')][_0x2304('0x1d')]);_0x1506e7['offset']=qs['offset'](_0x13f830[_0x2304('0x31')][_0x2304('0x1b')]);}_0x1506e7[_0x2304('0x39')]=qs[_0x2304('0x3a')](_0x13f830[_0x2304('0x31')][_0x2304('0x3a')]);_0x1506e7['where']=qs[_0x2304('0x3b')](_[_0x2304('0x3c')](_0x13f830[_0x2304('0x31')],_0x283f29[_0x2304('0x3b')]),_0x12f5fa);if(_0x13f830['query']['filter']){_0x1506e7[_0x2304('0x3d')]=_['merge'](_0x1506e7[_0x2304('0x3d')],{'$or':_[_0x2304('0x2b')](_0x12f5fa,function(_0x46cd64){if(_0x46cd64['type']!=='VIRTUAL'){var _0x46b0af={};_0x46b0af[_0x46cd64[_0x2304('0x28')]]={'$like':'%'+_0x13f830[_0x2304('0x31')][_0x2304('0x3e')]+'%'};return _0x46b0af;}})});}_0x1506e7=_[_0x2304('0x3f')]({},_0x1506e7,_0x13f830['options']);var _0x59fbc6={'where':_0x1506e7[_0x2304('0x3d')]};return db[_0x2304('0x2c')][_0x2304('0x1e')](_0x59fbc6)['then'](function(_0x446829){_0x3a5b7f['count']=_0x446829;if(_0x13f830['query'][_0x2304('0x40')]){_0x1506e7['include']=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x1506e7);})[_0x2304('0x24')](function(_0xfc89fe){_0x3a5b7f[_0x2304('0x41')]=_0xfc89fe;return _0x3a5b7f;})[_0x2304('0x24')](respondWithFilteredResult(_0x2de0c4,_0x1506e7))[_0x2304('0x42')](handleError(_0x2de0c4,null));};exports['show']=function(_0xaf94a4,_0x3b4bcd){var _0x7bb686={'raw':![],'where':{'id':_0xaf94a4[_0x2304('0x43')]['id']}},_0x128510={};_0x128510[_0x2304('0x30')]=_[_0x2304('0x32')](db[_0x2304('0x2c')]['rawAttributes']);_0x128510[_0x2304('0x31')]=_[_0x2304('0x32')](_0xaf94a4[_0x2304('0x31')]);_0x128510[_0x2304('0x3b')]=_[_0x2304('0x33')](_0x128510[_0x2304('0x30')],_0x128510[_0x2304('0x31')]);_0x7bb686[_0x2304('0x35')]=_[_0x2304('0x33')](_0x128510[_0x2304('0x30')],qs[_0x2304('0x34')](_0xaf94a4[_0x2304('0x31')][_0x2304('0x34')]));_0x7bb686['attributes']=_0x7bb686['attributes']['length']?_0x7bb686[_0x2304('0x35')]:_0x128510[_0x2304('0x30')];if(_0xaf94a4[_0x2304('0x31')][_0x2304('0x40')]){_0x7bb686[_0x2304('0x44')]=[{'all':!![]}];}_0x7bb686=_[_0x2304('0x3f')]({},_0x7bb686,_0xaf94a4[_0x2304('0x45')]);return db[_0x2304('0x2c')][_0x2304('0x46')](_0x7bb686)['then'](handleEntityNotFound(_0x3b4bcd,null))['then'](respondWithResult(_0x3b4bcd,null))['catch'](handleError(_0x3b4bcd,null));};exports[_0x2304('0x47')]=function(_0x4b6e65,_0x13744f){return db['ServicenowAccount'][_0x2304('0x47')](_0x4b6e65[_0x2304('0x48')],{})['then'](respondWithResult(_0x13744f,0xc9))['catch'](handleError(_0x13744f,null));};exports['update']=function(_0x2bd585,_0x246a19){if(_0x2bd585[_0x2304('0x48')]['id']){delete _0x2bd585[_0x2304('0x48')]['id'];}return db[_0x2304('0x2c')][_0x2304('0x46')]({'where':{'id':_0x2bd585[_0x2304('0x43')]['id']}})[_0x2304('0x24')](handleEntityNotFound(_0x246a19,null))[_0x2304('0x24')](saveUpdates(_0x2bd585[_0x2304('0x48')],null))[_0x2304('0x24')](respondWithResult(_0x246a19,null))[_0x2304('0x42')](handleError(_0x246a19,null));};exports[_0x2304('0x25')]=function(_0x146c42,_0x5933d6){return db[_0x2304('0x2c')][_0x2304('0x46')]({'where':{'id':_0x146c42[_0x2304('0x43')]['id']}})[_0x2304('0x24')](handleEntityNotFound(_0x5933d6,null))['then'](removeEntity(_0x5933d6,null))['catch'](handleError(_0x5933d6,null));};exports['getConfigurations']=function(_0x2ba1fd,_0x5e5c0f,_0x3a84cc){var _0x5bcd8f={};var _0x127225={};var _0x2449f5;var _0x117ece;return db['ServicenowAccount'][_0x2304('0x49')]({'where':{'id':_0x2ba1fd[_0x2304('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e5c0f,null))[_0x2304('0x24')](function(_0x114279){if(_0x114279){_0x2449f5=_0x114279;_0x127225[_0x2304('0x30')]=_['keys'](db[_0x2304('0x4a')]['rawAttributes']);_0x127225['query']=_[_0x2304('0x32')](_0x2ba1fd[_0x2304('0x31')]);_0x127225[_0x2304('0x3b')]=_[_0x2304('0x33')](_0x127225[_0x2304('0x30')],_0x127225[_0x2304('0x31')]);_0x5bcd8f[_0x2304('0x35')]=_['intersection'](_0x127225[_0x2304('0x30')],qs[_0x2304('0x34')](_0x2ba1fd['query']['fields']));_0x5bcd8f[_0x2304('0x35')]=_0x5bcd8f['attributes'][_0x2304('0x36')]?_0x5bcd8f[_0x2304('0x35')]:_0x127225['model'];_0x5bcd8f[_0x2304('0x39')]=qs[_0x2304('0x3a')](_0x2ba1fd[_0x2304('0x31')][_0x2304('0x3a')]);_0x5bcd8f[_0x2304('0x3d')]=qs[_0x2304('0x3b')](_['pick'](_0x2ba1fd['query'],_0x127225[_0x2304('0x3b')]));if(_0x2ba1fd[_0x2304('0x31')][_0x2304('0x3e')]){_0x5bcd8f[_0x2304('0x3d')]=_[_0x2304('0x3f')](_0x5bcd8f[_0x2304('0x3d')],{'$or':_[_0x2304('0x2b')](_0x5bcd8f[_0x2304('0x35')],function(_0x46afe4){var _0x587a17={};_0x587a17[_0x46afe4]={'$like':'%'+_0x2ba1fd[_0x2304('0x31')]['filter']+'%'};return _0x587a17;})});}_0x5bcd8f=_[_0x2304('0x3f')]({},_0x5bcd8f,_0x2ba1fd[_0x2304('0x45')]);return _0x2449f5['getConfigurations'](_0x5bcd8f);}})[_0x2304('0x24')](function(_0x2cd5c5){if(_0x2cd5c5){_0x117ece=_0x2cd5c5[_0x2304('0x36')];if(!_0x2ba1fd[_0x2304('0x31')]['hasOwnProperty'](_0x2304('0x38'))){_0x5bcd8f[_0x2304('0x1d')]=qs[_0x2304('0x1d')](_0x2ba1fd[_0x2304('0x31')][_0x2304('0x1d')]);_0x5bcd8f[_0x2304('0x1b')]=qs[_0x2304('0x1b')](_0x2ba1fd[_0x2304('0x31')]['offset']);}return _0x2449f5[_0x2304('0x4b')](_0x5bcd8f);}})[_0x2304('0x24')](function(_0x300b81){if(_0x300b81){return _0x300b81?{'count':_0x117ece,'rows':_0x300b81}:null;}})[_0x2304('0x24')](respondWithResult(_0x5e5c0f,null))[_0x2304('0x42')](handleError(_0x5e5c0f,null));};exports[_0x2304('0x4c')]=function(_0xd552d5,_0x719a79,_0x236daf){if(_0xd552d5[_0x2304('0x48')]['id']){delete _0xd552d5['body']['id'];}return db[_0x2304('0x2c')][_0x2304('0x49')]({'where':{'id':_0xd552d5['params']['id']}})[_0x2304('0x24')](handleEntityNotFound(_0x719a79,null))[_0x2304('0x24')](function(_0x4bcd06){if(_0x4bcd06){_0xd552d5[_0x2304('0x48')][_0x2304('0x4d')]=_0x4bcd06['id'];_0xd552d5['body']['Subjects']=integrations[_0x2304('0x4e')](_0xd552d5['body'][_0x2304('0x4f')],_0xd552d5[_0x2304('0x48')][_0x2304('0x2f')]);_0xd552d5['body']['Descriptions']=integrations[_0x2304('0x50')](_0xd552d5[_0x2304('0x48')][_0x2304('0x4f')],_0xd552d5[_0x2304('0x48')]['type']);return db[_0x2304('0x4a')][_0x2304('0x47')](_0xd552d5[_0x2304('0x48')],{'include':[{'model':db[_0x2304('0x51')],'as':_0x2304('0x52')},{'model':db[_0x2304('0x51')],'as':_0x2304('0x53')}]});}return null;})[_0x2304('0x24')](respondWithResult(_0x719a79,null))['catch'](handleError(_0x719a79,null));};exports[_0x2304('0x54')]=function(_0x4bbdb6,_0x10686d,_0x592d2c){var _0x1b8f55=[_0x2304('0x55'),'hold_reason',_0x2304('0x56'),'subcategory',_0x2304('0x57'),_0x2304('0x58'),_0x2304('0x59'),_0x2304('0x5a'),'category'];var _0x1023d1=['parent',_0x2304('0x55'),'caused_by',_0x2304('0x5b'),'upon_reject',_0x2304('0x5c'),_0x2304('0x5d'),_0x2304('0x5e'),'approval_history','number',_0x2304('0x5f'),_0x2304('0x60'),_0x2304('0x61'),_0x2304('0x62'),_0x2304('0x63'),_0x2304('0x64'),_0x2304('0x65'),_0x2304('0x66'),_0x2304('0x56'),_0x2304('0x39'),_0x2304('0x67'),_0x2304('0x68'),_0x2304('0x69'),_0x2304('0x6a'),_0x2304('0x6b'),_0x2304('0x6c'),'work_notes_list',_0x2304('0x6d'),'priority',_0x2304('0x6e'),'rfc','time_worked',_0x2304('0x6f'),_0x2304('0x70'),_0x2304('0x71'),'group_list',_0x2304('0x72'),_0x2304('0x73'),'resolved_at','caller_id',_0x2304('0x74'),'subcategory','work_notes',_0x2304('0x75'),_0x2304('0x57'),_0x2304('0x76'),_0x2304('0x77'),'work_start',_0x2304('0x78'),'business_stc','additional_assignee_list',_0x2304('0x79'),_0x2304('0x7a'),_0x2304('0x58'),_0x2304('0x7b'),_0x2304('0x7c'),_0x2304('0x7d'),_0x2304('0x7e'),_0x2304('0x7f'),_0x2304('0x80'),_0x2304('0x81'),'reopened_by',_0x2304('0x59'),_0x2304('0x82'),_0x2304('0x83'),_0x2304('0x84'),_0x2304('0x85'),_0x2304('0x86'),'assigned_to',_0x2304('0x5a'),_0x2304('0x87'),_0x2304('0x88'),_0x2304('0x89'),'comments_and_work_notes','due_date',_0x2304('0x8a'),'reopen_count','sys_tags',_0x2304('0x8b'),'upon_approval',_0x2304('0x8c'),_0x2304('0x8d'),_0x2304('0x8e')];var _0x324780='';var _0x4a9f79='';var _0x5175cd=[];var _0xef854f='';var _0x4e0ec2='';var _0x250d23=[];var _0x49cd81='';var _0x348017='';var _0x50ccad={};var _0x22cbe8='';return db[_0x2304('0x2c')][_0x2304('0x49')]({'where':{'id':_0x4bbdb6[_0x2304('0x43')]['id']},'attributes':['id',_0x2304('0x8f'),_0x2304('0x90'),_0x2304('0x91'),_0x2304('0x92'),_0x2304('0x93')]})[_0x2304('0x24')](handleEntityNotFound(_0x10686d,null))[_0x2304('0x24')](function(_0x360c8f){if(_0x360c8f){_0x22cbe8=_0x360c8f[_0x2304('0x92')];var _0x314aae=_0x22cbe8['slice'](-0x1);if(_0x314aae==='/'){_0x22cbe8=_0x22cbe8['substring'](0x0,_0x22cbe8['lastIndexOf'](_0x314aae));}_0x348017=util['format']('%s/api/now/doc/table/schema/',_0x22cbe8);_0x49cd81=util[_0x2304('0x94')](_0x2304('0x95'),_0x22cbe8);_0x50ccad={'user':_0x360c8f['username'],'pass':_0x360c8f[_0x2304('0x90')]};var _0x6a33ad={'method':_0x2304('0x96'),'uri':_0x348017+_0x2304('0x97'),'auth':_0x50ccad,'json':!![]};return rp(_0x6a33ad);}})[_0x2304('0x24')](function(_0x44d559){if(_0x44d559[_0x2304('0x98')][_0x2304('0x36')]>0x0){_0x324780=_0x44d559['result'];}console[_0x2304('0x99')](_0x2304('0x9a'),_0x324780);_0x250d23=[];_0x4a9f79=Object[_0x2304('0x9b')]([],_0x324780);_[_0x2304('0x9c')](_0x4a9f79,function(_0x529790){return!_0x1b8f55[_0x2304('0x9d')](_0x529790[_0x2304('0x28')]);});_0x4a9f79[_0x2304('0x9e')](function(_0x473d2d){var _0x395112=createFieldObject(_0x49cd81,_0x50ccad,_0x473d2d[_0x2304('0x9f')],_0x473d2d[_0x2304('0x28')],_0x473d2d['label'],![]);_0x250d23[_0x2304('0xa0')](_0x395112);});return Promise[_0x2304('0xa1')](_0x250d23);})[_0x2304('0x24')](function(_0x34011c){_0x5175cd=_0x34011c;_0xef854f=Object[_0x2304('0x9b')]([],_0x324780);console[_0x2304('0x99')](_0x2304('0xa2'),_0x324780);_['remove'](_0xef854f,function(_0x5e51d3){return _0x1023d1[_0x2304('0x9d')](_0x5e51d3[_0x2304('0x28')]);});console[_0x2304('0x99')](_0x2304('0xa3'),_0xef854f);_0x250d23=[];_0xef854f[_0x2304('0x9e')](function(_0x3db6c3){var _0x20fd81=createFieldObject(_0x49cd81,_0x50ccad,_0x3db6c3[_0x2304('0x9f')],_0x3db6c3[_0x2304('0x28')],_0x3db6c3[_0x2304('0xa4')],!![]);_0x250d23['push'](_0x20fd81);});return Promise[_0x2304('0xa1')](_0x250d23);})[_0x2304('0x24')](function(_0x1b3f12){_0x4e0ec2=_0x1b3f12;var _0x4e5b73=_0x5175cd['concat'](_0x4e0ec2);return{'count':_0x4e5b73[_0x2304('0x36')],'rows':_0x4e5b73};})[_0x2304('0x24')](respondWithResult(_0x10686d,null))['catch'](function(_0x304fb5){console[_0x2304('0x99')](_0x2304('0xa5')+_0x304fb5);var _0x92cbdc=_0x4bbdb6[_0x2304('0x31')]['test']?0x1f4:_0x304fb5[_0x2304('0xa6')]||0x1f4;logger[_0x2304('0x26')](_0x304fb5[_0x2304('0x27')]);delete _0x304fb5[_0x2304('0x28')];if(_0x92cbdc===0x191){_0x92cbdc=0x190;}_0x10686d[_0x2304('0x19')](_0x92cbdc)[_0x2304('0x29')](_0x4bbdb6[_0x2304('0x31')]['test']?{'message':_0x2304('0xa7'),'statusCode':_0x304fb5['statusCode']}:_0x304fb5);});};function createFieldObject(_0x449216,_0x1947ce,_0x35443e,_0x40b650,_0x4b5b1a,_0x2b2c2f){return new Promise(function(_0x39a062,_0x24671d){var _0x1020bf={'id':_0x40b650,'name':_0x4b5b1a,'custom':_0x2b2c2f};if(_0x35443e==='boolean'){_0x1020bf['options']=[{'name':'True','value':_0x2304('0xa8')},{'name':_0x2304('0xa9'),'value':'false'}];_0x39a062(_0x1020bf);}else{var _0x26f8fe={'method':_0x2304('0x96'),'uri':_0x449216+_0x2304('0xaa')+_0x40b650,'auth':_0x1947ce,'json':!![]};return rp(_0x26f8fe)[_0x2304('0x24')](function(_0x21664d){var _0x5a0ac6=[];if(_0x21664d[_0x2304('0x98')][_0x2304('0x36')]>0x0){_0x21664d[_0x2304('0x98')]['forEach'](function(_0x5e17f1){if(_0x5e17f1[_0x2304('0xab')]===_0x2304('0xac')){var _0x514a85={'name':_0x5e17f1[_0x2304('0xa4')],'value':_0x5e17f1['value']};_0x5a0ac6['push'](_0x514a85);}});}_0x1020bf[_0x2304('0x45')]=_0x5a0ac6;if(_0x1020bf[_0x2304('0x45')][_0x2304('0x36')]>0x0){_0x39a062(_0x1020bf);}else{if(_0x2b2c2f==![]){_0x39a062();}else{_0x39a062(_0x1020bf);}}});}});} \ No newline at end of file +var _0xbcfb=['delivery_plan','impact','active','work_notes_list','expected_start','group_list','work_end','reopened_time','caller_id','work_notes','short_description','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','includes','forEach','label','all','TCL:\x20_object','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','concat','test','statusCode','error','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','update','destroy','stack','name','send','index','map','ServicenowAccount','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','getConfigurations','findOne','rawAttributes','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','sys_created_by','closed_at','cmdb_ci'];(function(_0x510431,_0x123086){var _0x52c04c=function(_0xfafb36){while(--_0xfafb36){_0x510431['push'](_0x510431['shift']());}};_0x52c04c(++_0x123086);}(_0xbcfb,0x1a6));var _0xbbcf=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xbcfb[_0x154192];return _0x3c2792;};'use strict';var emlformat=require(_0xbbcf('0x0'));var rimraf=require(_0xbbcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbcf('0x2'));var rp=require(_0xbbcf('0x3'));var moment=require(_0xbbcf('0x4'));var BPromise=require(_0xbbcf('0x5'));var Mustache=require(_0xbbcf('0x6'));var util=require(_0xbbcf('0x7'));var path=require('path');var sox=require(_0xbbcf('0x8'));var csv=require(_0xbbcf('0x9'));var ejs=require(_0xbbcf('0xa'));var fs=require('fs');var fs_extra=require(_0xbbcf('0xb'));var _=require(_0xbbcf('0xc'));var squel=require(_0xbbcf('0xd'));var crypto=require('crypto');var jsforce=require(_0xbbcf('0xe'));var deskjs=require(_0xbbcf('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbbcf('0x10'));var Papa=require(_0xbbcf('0x11'));var Redis=require(_0xbbcf('0x12'));var authService=require(_0xbbcf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbbcf('0x14'));var hardwareService=require(_0xbbcf('0x15'));var logger=require(_0xbbcf('0x16'))(_0xbbcf('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbbcf('0x18'));var db=require(_0xbbcf('0x19'))['db'];var integrations=require(_0xbbcf('0x1a'));function respondWithStatusCode(_0x302121,_0x18cede){_0x18cede=_0x18cede||0xcc;return function(_0x87f08c){if(_0x87f08c){return _0x302121[_0xbbcf('0x1b')](_0x18cede);}return _0x302121[_0xbbcf('0x1c')](_0x18cede)[_0xbbcf('0x1d')]();};}function respondWithResult(_0x1aaa9c,_0x32f039){_0x32f039=_0x32f039||0xc8;return function(_0x5c48f3){if(_0x5c48f3){return _0x1aaa9c['status'](_0x32f039)['json'](_0x5c48f3);}};}function respondWithFilteredResult(_0x1d1a76,_0xac86e6){return function(_0x41bdec){if(_0x41bdec){var _0x3d14ae=typeof _0xac86e6['offset']==='undefined'&&typeof _0xac86e6[_0xbbcf('0x1e')]===_0xbbcf('0x1f');var _0x48f572=_0x41bdec[_0xbbcf('0x20')];var _0xf2307d=_0x3d14ae?0x0:_0xac86e6[_0xbbcf('0x21')];var _0x597d6c=_0x3d14ae?_0x41bdec[_0xbbcf('0x20')]:_0xac86e6[_0xbbcf('0x21')]+_0xac86e6[_0xbbcf('0x1e')];var _0x88e6b4;if(_0x597d6c>=_0x48f572){_0x597d6c=_0x48f572;_0x88e6b4=0xc8;}else{_0x88e6b4=0xce;}_0x1d1a76[_0xbbcf('0x1c')](_0x88e6b4);return _0x1d1a76[_0xbbcf('0x22')](_0xbbcf('0x23'),_0xf2307d+'-'+_0x597d6c+'/'+_0x48f572)[_0xbbcf('0x24')](_0x41bdec);}return null;};}function patchUpdates(_0x224be7){return function(_0x20985c){try{jsonpatch['apply'](_0x20985c,_0x224be7,!![]);}catch(_0x1ee6a3){return BPromise[_0xbbcf('0x25')](_0x1ee6a3);}return _0x20985c['save']();};}function saveUpdates(_0x680ca3,_0x5ab3e5){return function(_0x54a368){if(_0x54a368){return _0x54a368[_0xbbcf('0x26')](_0x680ca3)['then'](function(_0x1089d3){return _0x1089d3;});}return null;};}function removeEntity(_0x15e2d4,_0x927189){return function(_0x46a832){if(_0x46a832){return _0x46a832[_0xbbcf('0x27')]()['then'](function(){_0x15e2d4[_0xbbcf('0x1c')](0xcc)[_0xbbcf('0x1d')]();});}};}function handleEntityNotFound(_0x20311e,_0x23fa01){return function(_0xef223d){if(!_0xef223d){_0x20311e[_0xbbcf('0x1b')](0x194);}return _0xef223d;};}function handleError(_0x509395,_0x34cdf7){_0x34cdf7=_0x34cdf7||0x1f4;return function(_0x3be372){logger['error'](_0x3be372[_0xbbcf('0x28')]);if(_0x3be372[_0xbbcf('0x29')]){delete _0x3be372['name'];}_0x509395[_0xbbcf('0x1c')](_0x34cdf7)[_0xbbcf('0x2a')](_0x3be372);};}exports[_0xbbcf('0x2b')]=function(_0x455132,_0xd02332){var _0x4218cc={},_0x2e8e26={},_0x2e5c12={'count':0x0,'rows':[]};var _0x419acf=_[_0xbbcf('0x2c')](db[_0xbbcf('0x2d')]['rawAttributes'],function(_0x1b1651){return{'name':_0x1b1651[_0xbbcf('0x2e')],'type':_0x1b1651[_0xbbcf('0x2f')]['key']};});_0x2e8e26[_0xbbcf('0x30')]=_[_0xbbcf('0x2c')](_0x419acf,_0xbbcf('0x29'));_0x2e8e26[_0xbbcf('0x31')]=_[_0xbbcf('0x32')](_0x455132[_0xbbcf('0x31')]);_0x2e8e26[_0xbbcf('0x33')]=_['intersection'](_0x2e8e26[_0xbbcf('0x30')],_0x2e8e26[_0xbbcf('0x31')]);_0x4218cc[_0xbbcf('0x34')]=_[_0xbbcf('0x35')](_0x2e8e26[_0xbbcf('0x30')],qs[_0xbbcf('0x36')](_0x455132['query'][_0xbbcf('0x36')]));_0x4218cc[_0xbbcf('0x34')]=_0x4218cc[_0xbbcf('0x34')]['length']?_0x4218cc[_0xbbcf('0x34')]:_0x2e8e26[_0xbbcf('0x30')];if(!_0x455132[_0xbbcf('0x31')][_0xbbcf('0x37')]('nolimit')){_0x4218cc['limit']=qs[_0xbbcf('0x1e')](_0x455132[_0xbbcf('0x31')][_0xbbcf('0x1e')]);_0x4218cc['offset']=qs[_0xbbcf('0x21')](_0x455132[_0xbbcf('0x31')][_0xbbcf('0x21')]);}_0x4218cc[_0xbbcf('0x38')]=qs['sort'](_0x455132['query'][_0xbbcf('0x39')]);_0x4218cc[_0xbbcf('0x3a')]=qs[_0xbbcf('0x33')](_[_0xbbcf('0x3b')](_0x455132[_0xbbcf('0x31')],_0x2e8e26['filters']),_0x419acf);if(_0x455132[_0xbbcf('0x31')][_0xbbcf('0x3c')]){_0x4218cc[_0xbbcf('0x3a')]=_[_0xbbcf('0x3d')](_0x4218cc[_0xbbcf('0x3a')],{'$or':_['map'](_0x419acf,function(_0xaf9183){if(_0xaf9183['type']!==_0xbbcf('0x3e')){var _0x4a4829={};_0x4a4829[_0xaf9183[_0xbbcf('0x29')]]={'$like':'%'+_0x455132[_0xbbcf('0x31')]['filter']+'%'};return _0x4a4829;}})});}_0x4218cc=_[_0xbbcf('0x3d')]({},_0x4218cc,_0x455132['options']);var _0x411557={'where':_0x4218cc[_0xbbcf('0x3a')]};return db['ServicenowAccount'][_0xbbcf('0x20')](_0x411557)[_0xbbcf('0x3f')](function(_0x1a3d1a){_0x2e5c12[_0xbbcf('0x20')]=_0x1a3d1a;if(_0x455132[_0xbbcf('0x31')][_0xbbcf('0x40')]){_0x4218cc[_0xbbcf('0x41')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xbbcf('0x42')](_0x4218cc);})['then'](function(_0x2be004){_0x2e5c12[_0xbbcf('0x43')]=_0x2be004;return _0x2e5c12;})[_0xbbcf('0x3f')](respondWithFilteredResult(_0xd02332,_0x4218cc))[_0xbbcf('0x44')](handleError(_0xd02332,null));};exports['show']=function(_0x2a4670,_0x23fcd8){var _0x5f21c8={'raw':![],'where':{'id':_0x2a4670[_0xbbcf('0x45')]['id']}},_0x181abd={};_0x181abd[_0xbbcf('0x30')]=_[_0xbbcf('0x32')](db[_0xbbcf('0x2d')]['rawAttributes']);_0x181abd[_0xbbcf('0x31')]=_[_0xbbcf('0x32')](_0x2a4670[_0xbbcf('0x31')]);_0x181abd[_0xbbcf('0x33')]=_[_0xbbcf('0x35')](_0x181abd['model'],_0x181abd[_0xbbcf('0x31')]);_0x5f21c8[_0xbbcf('0x34')]=_[_0xbbcf('0x35')](_0x181abd['model'],qs[_0xbbcf('0x36')](_0x2a4670[_0xbbcf('0x31')][_0xbbcf('0x36')]));_0x5f21c8[_0xbbcf('0x34')]=_0x5f21c8['attributes'][_0xbbcf('0x46')]?_0x5f21c8[_0xbbcf('0x34')]:_0x181abd['model'];if(_0x2a4670[_0xbbcf('0x31')][_0xbbcf('0x40')]){_0x5f21c8['include']=[{'all':!![]}];}_0x5f21c8=_[_0xbbcf('0x3d')]({},_0x5f21c8,_0x2a4670[_0xbbcf('0x47')]);return db[_0xbbcf('0x2d')][_0xbbcf('0x48')](_0x5f21c8)[_0xbbcf('0x3f')](handleEntityNotFound(_0x23fcd8,null))[_0xbbcf('0x3f')](respondWithResult(_0x23fcd8,null))[_0xbbcf('0x44')](handleError(_0x23fcd8,null));};exports[_0xbbcf('0x49')]=function(_0x2472c6,_0x24eabc){return db[_0xbbcf('0x2d')][_0xbbcf('0x49')](_0x2472c6[_0xbbcf('0x4a')],{})[_0xbbcf('0x3f')](respondWithResult(_0x24eabc,0xc9))['catch'](handleError(_0x24eabc,null));};exports[_0xbbcf('0x26')]=function(_0x3ce66f,_0x4430ae){if(_0x3ce66f[_0xbbcf('0x4a')]['id']){delete _0x3ce66f['body']['id'];}return db[_0xbbcf('0x2d')][_0xbbcf('0x48')]({'where':{'id':_0x3ce66f[_0xbbcf('0x45')]['id']}})[_0xbbcf('0x3f')](handleEntityNotFound(_0x4430ae,null))[_0xbbcf('0x3f')](saveUpdates(_0x3ce66f['body'],null))[_0xbbcf('0x3f')](respondWithResult(_0x4430ae,null))[_0xbbcf('0x44')](handleError(_0x4430ae,null));};exports[_0xbbcf('0x27')]=function(_0x210dce,_0x3cf28b){return db[_0xbbcf('0x2d')][_0xbbcf('0x48')]({'where':{'id':_0x210dce['params']['id']}})[_0xbbcf('0x3f')](handleEntityNotFound(_0x3cf28b,null))['then'](removeEntity(_0x3cf28b,null))['catch'](handleError(_0x3cf28b,null));};exports[_0xbbcf('0x4b')]=function(_0x530382,_0x197570,_0x10fcc5){var _0x39ea11={};var _0x244ef4={};var _0x10d0d1;var _0x30bc5d;return db[_0xbbcf('0x2d')][_0xbbcf('0x4c')]({'where':{'id':_0x530382['params']['id']}})[_0xbbcf('0x3f')](handleEntityNotFound(_0x197570,null))['then'](function(_0x172f1c){if(_0x172f1c){_0x10d0d1=_0x172f1c;_0x244ef4[_0xbbcf('0x30')]=_[_0xbbcf('0x32')](db['ServicenowConfiguration'][_0xbbcf('0x4d')]);_0x244ef4['query']=_[_0xbbcf('0x32')](_0x530382[_0xbbcf('0x31')]);_0x244ef4[_0xbbcf('0x33')]=_[_0xbbcf('0x35')](_0x244ef4['model'],_0x244ef4[_0xbbcf('0x31')]);_0x39ea11['attributes']=_[_0xbbcf('0x35')](_0x244ef4['model'],qs['fields'](_0x530382['query'][_0xbbcf('0x36')]));_0x39ea11[_0xbbcf('0x34')]=_0x39ea11[_0xbbcf('0x34')][_0xbbcf('0x46')]?_0x39ea11['attributes']:_0x244ef4[_0xbbcf('0x30')];_0x39ea11[_0xbbcf('0x38')]=qs['sort'](_0x530382[_0xbbcf('0x31')][_0xbbcf('0x39')]);_0x39ea11['where']=qs[_0xbbcf('0x33')](_[_0xbbcf('0x3b')](_0x530382[_0xbbcf('0x31')],_0x244ef4['filters']));if(_0x530382[_0xbbcf('0x31')][_0xbbcf('0x3c')]){_0x39ea11[_0xbbcf('0x3a')]=_[_0xbbcf('0x3d')](_0x39ea11[_0xbbcf('0x3a')],{'$or':_[_0xbbcf('0x2c')](_0x39ea11[_0xbbcf('0x34')],function(_0x79e35e){var _0x1120c8={};_0x1120c8[_0x79e35e]={'$like':'%'+_0x530382[_0xbbcf('0x31')]['filter']+'%'};return _0x1120c8;})});}_0x39ea11=_[_0xbbcf('0x3d')]({},_0x39ea11,_0x530382[_0xbbcf('0x47')]);return _0x10d0d1['getConfigurations'](_0x39ea11);}})[_0xbbcf('0x3f')](function(_0x1e2fa1){if(_0x1e2fa1){_0x30bc5d=_0x1e2fa1[_0xbbcf('0x46')];if(!_0x530382[_0xbbcf('0x31')][_0xbbcf('0x37')]('nolimit')){_0x39ea11[_0xbbcf('0x1e')]=qs[_0xbbcf('0x1e')](_0x530382['query'][_0xbbcf('0x1e')]);_0x39ea11['offset']=qs[_0xbbcf('0x21')](_0x530382[_0xbbcf('0x31')][_0xbbcf('0x21')]);}return _0x10d0d1[_0xbbcf('0x4b')](_0x39ea11);}})[_0xbbcf('0x3f')](function(_0x5f4776){if(_0x5f4776){return _0x5f4776?{'count':_0x30bc5d,'rows':_0x5f4776}:null;}})[_0xbbcf('0x3f')](respondWithResult(_0x197570,null))[_0xbbcf('0x44')](handleError(_0x197570,null));};exports[_0xbbcf('0x4e')]=function(_0x11fbf2,_0x25b26a,_0x389d47){if(_0x11fbf2['body']['id']){delete _0x11fbf2[_0xbbcf('0x4a')]['id'];}return db[_0xbbcf('0x2d')]['findOne']({'where':{'id':_0x11fbf2[_0xbbcf('0x45')]['id']}})[_0xbbcf('0x3f')](handleEntityNotFound(_0x25b26a,null))[_0xbbcf('0x3f')](function(_0x279b51){if(_0x279b51){_0x11fbf2[_0xbbcf('0x4a')][_0xbbcf('0x4f')]=_0x279b51['id'];_0x11fbf2['body'][_0xbbcf('0x50')]=integrations['getSubjects'](_0x11fbf2[_0xbbcf('0x4a')][_0xbbcf('0x51')],_0x11fbf2[_0xbbcf('0x4a')][_0xbbcf('0x2f')]);_0x11fbf2[_0xbbcf('0x4a')][_0xbbcf('0x52')]=integrations[_0xbbcf('0x53')](_0x11fbf2[_0xbbcf('0x4a')][_0xbbcf('0x51')],_0x11fbf2[_0xbbcf('0x4a')][_0xbbcf('0x2f')]);return db[_0xbbcf('0x54')][_0xbbcf('0x49')](_0x11fbf2[_0xbbcf('0x4a')],{'include':[{'model':db[_0xbbcf('0x55')],'as':_0xbbcf('0x50')},{'model':db[_0xbbcf('0x55')],'as':_0xbbcf('0x52')}]});}return null;})[_0xbbcf('0x3f')](respondWithResult(_0x25b26a,null))[_0xbbcf('0x44')](handleError(_0x25b26a,null));};exports[_0xbbcf('0x56')]=function(_0x2e9076,_0x582c9f,_0x4c3350){var _0x2fa724=[_0xbbcf('0x57'),_0xbbcf('0x58'),_0xbbcf('0x59'),_0xbbcf('0x5a'),_0xbbcf('0x5b'),'notify',_0xbbcf('0x5c'),_0xbbcf('0x5d'),_0xbbcf('0x5e')];var _0x1fb757=['parent','made_sla',_0xbbcf('0x5f'),_0xbbcf('0x60'),_0xbbcf('0x61'),_0xbbcf('0x62'),_0xbbcf('0x63'),_0xbbcf('0x58'),_0xbbcf('0x64'),_0xbbcf('0x65'),'resolved_by',_0xbbcf('0x66'),_0xbbcf('0x67'),_0xbbcf('0x68'),'sys_created_on',_0xbbcf('0x69'),'state',_0xbbcf('0x6a'),'knowledge','order','calendar_stc',_0xbbcf('0x6b'),_0xbbcf('0x6c'),_0xbbcf('0x6d'),_0xbbcf('0x6e'),_0xbbcf('0x6f'),_0xbbcf('0x70'),'business_service','priority','sys_domain_path','rfc','time_worked',_0xbbcf('0x71'),'opened_at','business_duration',_0xbbcf('0x72'),_0xbbcf('0x73'),_0xbbcf('0x74'),'resolved_at',_0xbbcf('0x75'),'approval_set',_0xbbcf('0x5a'),_0xbbcf('0x76'),_0xbbcf('0x77'),_0xbbcf('0x5b'),'correlation_display','delivery_task','work_start',_0xbbcf('0x78'),_0xbbcf('0x79'),_0xbbcf('0x7a'),'description',_0xbbcf('0x7b'),_0xbbcf('0x7c'),'sys_class_name',_0xbbcf('0x7d'),_0xbbcf('0x7e'),_0xbbcf('0x7f'),'parent_incident',_0xbbcf('0x80'),_0xbbcf('0x81'),_0xbbcf('0x82'),_0xbbcf('0x5c'),_0xbbcf('0x83'),'problem_id',_0xbbcf('0x84'),'reassignment_count',_0xbbcf('0x85'),_0xbbcf('0x86'),'severity',_0xbbcf('0x87'),_0xbbcf('0x88'),_0xbbcf('0x89'),_0xbbcf('0x8a'),'due_date','sys_mod_count','reopen_count',_0xbbcf('0x8b'),_0xbbcf('0x8c'),_0xbbcf('0x8d'),_0xbbcf('0x8e'),_0xbbcf('0x8f'),_0xbbcf('0x5e')];var _0x31a14d='';var _0x1bddb0='';var _0x4b12b6=[];var _0x58f0e7='';var _0x4cc03d='';var _0x48858f=[];var _0x5154e6='';var _0x16e42e='';var _0x561132={};var _0x1aecda='';return db['ServicenowAccount'][_0xbbcf('0x4c')]({'where':{'id':_0x2e9076[_0xbbcf('0x45')]['id']},'attributes':['id',_0xbbcf('0x90'),_0xbbcf('0x91'),_0xbbcf('0x92'),_0xbbcf('0x93'),_0xbbcf('0x94')]})[_0xbbcf('0x3f')](handleEntityNotFound(_0x582c9f,null))[_0xbbcf('0x3f')](function(_0x1c1b82){if(_0x1c1b82){_0x1aecda=_0x1c1b82[_0xbbcf('0x93')];var _0x728721=_0x1aecda['slice'](-0x1);if(_0x728721==='/'){_0x1aecda=_0x1aecda[_0xbbcf('0x95')](0x0,_0x1aecda[_0xbbcf('0x96')](_0x728721));}_0x16e42e=util['format']('%s/api/now/doc/table/schema/',_0x1aecda);_0x5154e6=util['format'](_0xbbcf('0x97'),_0x1aecda);_0x561132={'user':_0x1c1b82['username'],'pass':_0x1c1b82[_0xbbcf('0x91')]};var _0x5d513c={'method':_0xbbcf('0x98'),'uri':_0x16e42e+_0xbbcf('0x99'),'auth':_0x561132,'json':!![]};return rp(_0x5d513c);}})['then'](function(_0x109172){if(_0x109172[_0xbbcf('0x9a')][_0xbbcf('0x46')]>0x0){_0x31a14d=_0x109172[_0xbbcf('0x9a')];}console['log'](_0xbbcf('0x9b'),_0x31a14d);_0x48858f=[];_0x1bddb0=Object['assign']([],_0x31a14d);_['remove'](_0x1bddb0,function(_0x4a266f){return!_0x2fa724[_0xbbcf('0x9c')](_0x4a266f['name']);});_0x1bddb0[_0xbbcf('0x9d')](function(_0xdaddc3){var _0x35c4bd=createFieldObject(_0x5154e6,_0x561132,_0xdaddc3['internalType'],_0xdaddc3[_0xbbcf('0x29')],_0xdaddc3[_0xbbcf('0x9e')],![]);_0x48858f['push'](_0x35c4bd);});return Promise[_0xbbcf('0x9f')](_0x48858f);})['then'](function(_0x4429d6){_0x4b12b6=_0x4429d6;_0x58f0e7=Object['assign']([],_0x31a14d);console['log'](_0xbbcf('0xa0'),_0x31a14d);_['remove'](_0x58f0e7,function(_0x59a2d6){return _0x1fb757[_0xbbcf('0x9c')](_0x59a2d6[_0xbbcf('0x29')]);});console[_0xbbcf('0xa1')](_0xbbcf('0xa2'),_0x58f0e7);_0x48858f=[];_0x58f0e7['forEach'](function(_0x13c5f7){var _0xc7ba37=createFieldObject(_0x5154e6,_0x561132,_0x13c5f7[_0xbbcf('0xa3')],_0x13c5f7['name'],_0x13c5f7['label'],!![]);_0x48858f[_0xbbcf('0xa4')](_0xc7ba37);});return Promise[_0xbbcf('0x9f')](_0x48858f);})['then'](function(_0x4e7017){_0x4cc03d=_0x4e7017;var _0x4fba93=_0x4b12b6[_0xbbcf('0xa5')](_0x4cc03d);return{'count':_0x4fba93[_0xbbcf('0x46')],'rows':_0x4fba93};})[_0xbbcf('0x3f')](respondWithResult(_0x582c9f,null))[_0xbbcf('0x44')](function(_0x6edd96){console['log']('ServiceNow\x20error:\x20'+_0x6edd96);var _0x5ddc32=_0x2e9076[_0xbbcf('0x31')][_0xbbcf('0xa6')]?0x1f4:_0x6edd96[_0xbbcf('0xa7')]||0x1f4;logger[_0xbbcf('0xa8')](_0x6edd96['stack']);delete _0x6edd96['name'];if(_0x5ddc32===0x191){_0x5ddc32=0x190;}_0x582c9f[_0xbbcf('0x1c')](_0x5ddc32)[_0xbbcf('0x2a')](_0x2e9076[_0xbbcf('0x31')][_0xbbcf('0xa6')]?{'message':_0xbbcf('0xa9'),'statusCode':_0x6edd96['statusCode']}:_0x6edd96);});};function createFieldObject(_0x205f20,_0x42dac8,_0x4d0c96,_0x34e6c0,_0x136094,_0xc1f2d7){return new Promise(function(_0x3c27ff,_0x2b5f41){var _0x243330={'id':_0x34e6c0,'name':_0x136094,'custom':_0xc1f2d7};if(_0x4d0c96===_0xbbcf('0xaa')){_0x243330[_0xbbcf('0x47')]=[{'name':_0xbbcf('0xab'),'value':_0xbbcf('0xac')},{'name':_0xbbcf('0xad'),'value':_0xbbcf('0xae')}];_0x3c27ff(_0x243330);}else{var _0x334f5c={'method':_0xbbcf('0x98'),'uri':_0x205f20+_0xbbcf('0xaf')+_0x34e6c0,'auth':_0x42dac8,'json':!![]};return rp(_0x334f5c)[_0xbbcf('0x3f')](function(_0x183233){var _0x5c1699=[];if(_0x183233[_0xbbcf('0x9a')][_0xbbcf('0x46')]>0x0){_0x183233[_0xbbcf('0x9a')][_0xbbcf('0x9d')](function(_0x25b5a4){if(_0x25b5a4[_0xbbcf('0xb0')]===_0xbbcf('0xae')){var _0x17300a={'name':_0x25b5a4['label'],'value':_0x25b5a4['value']};_0x5c1699[_0xbbcf('0xa4')](_0x17300a);}});}_0x243330[_0xbbcf('0x47')]=_0x5c1699;if(_0x243330[_0xbbcf('0x47')]['length']>0x0){_0x3c27ff(_0x243330);}else{if(_0xc1f2d7==![]){_0x3c27ff();}else{_0x3c27ff(_0x243330);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f90d31e..45b78b0 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 _0x5d58=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','bluebird'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x5d58,0x187));var _0x85d5=function(_0x56de52,_0xf537aa){_0x56de52=_0x56de52-0x0;var _0x3bb011=_0x5d58[_0x56de52];return _0x3bb011;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x85d5('0x4'));module[_0x85d5('0x5')]=function(_0x578fad,_0x46e7b4){return _0x578fad['define'](_0x85d5('0x6'),attributes,{'tableName':_0x85d5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x424cc7,_0x47386f){var _0x180167=function(_0x4a0c13){while(--_0x4a0c13){_0x424cc7['push'](_0x424cc7['shift']());}};_0x180167(++_0x47386f);}(_0xba34,0x119));var _0x4ba3=function(_0x4aa954,_0x70a67b){_0x4aa954=_0x4aa954-0x0;var _0x3ea2cd=_0xba34[_0x4aa954];return _0x3ea2cd;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 7e5eabf..17ffc6a 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 _0x55e8=['ServicenowAccount','findAll','options','where','model','attributes','map','include','catch','find','raw','info','ShowServicenowAccount','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x55e8,0x1ef));var _0x855e=function(_0x386d41,_0x3f92c5){_0x386d41=_0x386d41-0x0;var _0x5da2e1=_0x55e8[_0x386d41];return _0x5da2e1;};'use strict';var _=require(_0x855e('0x0'));var util=require(_0x855e('0x1'));var moment=require(_0x855e('0x2'));var BPromise=require(_0x855e('0x3'));var rs=require(_0x855e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x855e('0x5'))['db'];var utils=require(_0x855e('0x6'));var logger=require('../../config/logger')(_0x855e('0x7'));var config=require(_0x855e('0x8'));var jayson=require(_0x855e('0x9'));var client=jayson[_0x855e('0xa')][_0x855e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b926f,_0x4d7db9,_0x3994e9){return new BPromise(function(_0x287370,_0xde2e13){return client[_0x855e('0xc')](_0x3b926f,_0x3994e9)[_0x855e('0xd')](function(_0x3b3805){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x4d7db9,'request\x20sent');logger[_0x855e('0xe')](_0x855e('0xf'),_0x4d7db9,_0x855e('0x10'),JSON['stringify'](_0x3b3805));if(_0x3b3805[_0x855e('0x11')]){if(_0x3b3805[_0x855e('0x11')][_0x855e('0x12')]===0x1f4){logger[_0x855e('0x11')](_0x855e('0x13'),_0x4d7db9,_0x3b3805['error'][_0x855e('0x14')]);return _0xde2e13(_0x3b3805[_0x855e('0x11')][_0x855e('0x14')]);}logger[_0x855e('0x11')](_0x855e('0x13'),_0x4d7db9,_0x3b3805[_0x855e('0x11')][_0x855e('0x14')]);return _0x287370(_0x3b3805['error'][_0x855e('0x14')]);}else{logger['info'](_0x855e('0x13'),_0x4d7db9,'request\x20sent');_0x287370(_0x3b3805[_0x855e('0x15')][_0x855e('0x14')]);}})['catch'](function(_0x4bc4b0){logger['error'](_0x855e('0x13'),_0x4d7db9,_0x4bc4b0);_0xde2e13(_0x4bc4b0);});});}exports[_0x855e('0x16')]=function(_0x4083d9){var _0x191ed9=this;return new Promise(function(_0x8ba6b1,_0x32b702){return db[_0x855e('0x17')][_0x855e('0x18')]({'raw':_0x4083d9[_0x855e('0x19')]?_0x4083d9[_0x855e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4083d9[_0x855e('0x19')]?_0x4083d9[_0x855e('0x19')][_0x855e('0x1a')]||null:null,'attributes':_0x4083d9['options']?_0x4083d9['options']['attributes']||null:null,'limit':_0x4083d9[_0x855e('0x19')]?_0x4083d9[_0x855e('0x19')]['limit']||null:null,'include':_0x4083d9['options']?_0x4083d9[_0x855e('0x19')]['include']?_['map'](_0x4083d9['options']['include'],function(_0x1da4e0){return{'model':db[_0x1da4e0[_0x855e('0x1b')]],'as':_0x1da4e0['as'],'attributes':_0x1da4e0[_0x855e('0x1c')],'include':_0x1da4e0['include']?_[_0x855e('0x1d')](_0x1da4e0[_0x855e('0x1e')],function(_0x51d96c){return{'model':db[_0x51d96c['model']],'as':_0x51d96c['as'],'attributes':_0x51d96c['attributes'],'include':_0x51d96c[_0x855e('0x1e')]?_['map'](_0x51d96c['include'],function(_0x5836f3){return{'model':db[_0x5836f3['model']],'as':_0x5836f3['as'],'attributes':_0x5836f3[_0x855e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f2ec){logger['info'](_0x855e('0x16'),_0x4083d9);logger[_0x855e('0xe')](_0x855e('0x16'),_0x4083d9,JSON['stringify'](_0x14f2ec));_0x8ba6b1(_0x14f2ec);})[_0x855e('0x1f')](function(_0x439bf3){logger[_0x855e('0x11')](_0x855e('0x16'),_0x439bf3['message'],_0x4083d9);_0x32b702(_0x191ed9[_0x855e('0x11')](0x1f4,_0x439bf3['message']));});});};exports['ShowServicenowAccount']=function(_0x6a3b81){var _0xf86b36=this;return new Promise(function(_0x4dcf2c,_0x496522){return db[_0x855e('0x17')][_0x855e('0x20')]({'raw':_0x6a3b81[_0x855e('0x19')]?_0x6a3b81[_0x855e('0x19')][_0x855e('0x21')]===undefined?!![]:![]:!![],'where':_0x6a3b81[_0x855e('0x19')]?_0x6a3b81[_0x855e('0x19')][_0x855e('0x1a')]||null:null,'attributes':_0x6a3b81[_0x855e('0x19')]?_0x6a3b81[_0x855e('0x19')][_0x855e('0x1c')]||null:null,'include':_0x6a3b81[_0x855e('0x19')]?_0x6a3b81[_0x855e('0x19')][_0x855e('0x1e')]?_[_0x855e('0x1d')](_0x6a3b81[_0x855e('0x19')][_0x855e('0x1e')],function(_0x57d47c){return{'model':db[_0x57d47c['model']],'as':_0x57d47c['as'],'attributes':_0x57d47c[_0x855e('0x1c')],'include':_0x57d47c[_0x855e('0x1e')]?_[_0x855e('0x1d')](_0x57d47c[_0x855e('0x1e')],function(_0x1d573a){return{'model':db[_0x1d573a[_0x855e('0x1b')]],'as':_0x1d573a['as'],'attributes':_0x1d573a[_0x855e('0x1c')],'include':_0x1d573a[_0x855e('0x1e')]?_['map'](_0x1d573a['include'],function(_0x12ccb0){return{'model':db[_0x12ccb0[_0x855e('0x1b')]],'as':_0x12ccb0['as'],'attributes':_0x12ccb0['attributes']};}):[]};}):[]};}):[]:[]})[_0x855e('0xd')](function(_0x40036f){logger[_0x855e('0x22')]('ShowServicenowAccount',_0x6a3b81);logger[_0x855e('0xe')](_0x855e('0x23'),_0x6a3b81,JSON[_0x855e('0x24')](_0x40036f));_0x4dcf2c(_0x40036f);})[_0x855e('0x1f')](function(_0x45b88d){logger[_0x855e('0x11')](_0x855e('0x23'),_0x45b88d[_0x855e('0x14')],_0x6a3b81);_0x496522(_0xf86b36[_0x855e('0x11')](0x1f4,_0x45b88d[_0x855e('0x14')]));});});}; \ No newline at end of file +var _0x7803=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ServicenowAccount','findAll','options','raw','attributes','include','map','model','GetServicenowAccount','debug','stringify','ShowServicenowAccount','find','where','util','bluebird'];(function(_0x3dc4d4,_0x1840ac){var _0x460917=function(_0x32e107){while(--_0x32e107){_0x3dc4d4['push'](_0x3dc4d4['shift']());}};_0x460917(++_0x1840ac);}(_0x7803,0x67));var _0x3780=function(_0xcb34ac,_0x3f7426){_0xcb34ac=_0xcb34ac-0x0;var _0x3b1a80=_0x7803[_0xcb34ac];return _0x3b1a80;};'use strict';var _=require('lodash');var util=require(_0x3780('0x0'));var moment=require('moment');var BPromise=require(_0x3780('0x1'));var rs=require(_0x3780('0x2'));var fs=require('fs');var Redis=require(_0x3780('0x3'));var db=require(_0x3780('0x4'))['db'];var utils=require(_0x3780('0x5'));var logger=require('../../config/logger')(_0x3780('0x6'));var config=require(_0x3780('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3780('0x8')][_0x3780('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a1be,_0x183e24,_0x12e1d1){return new BPromise(function(_0x5e1b24,_0x277eb1){return client[_0x3780('0xa')](_0x34a1be,_0x12e1d1)[_0x3780('0xb')](function(_0x240c8a){logger[_0x3780('0xc')](_0x3780('0xd'),_0x183e24,'request\x20sent');logger['debug'](_0x3780('0xe'),_0x183e24,_0x3780('0xf'),JSON['stringify'](_0x240c8a));if(_0x240c8a[_0x3780('0x10')]){if(_0x240c8a[_0x3780('0x10')][_0x3780('0x11')]===0x1f4){logger[_0x3780('0x10')](_0x3780('0xd'),_0x183e24,_0x240c8a[_0x3780('0x10')][_0x3780('0x12')]);return _0x277eb1(_0x240c8a[_0x3780('0x10')][_0x3780('0x12')]);}logger[_0x3780('0x10')](_0x3780('0xd'),_0x183e24,_0x240c8a[_0x3780('0x10')][_0x3780('0x12')]);return _0x5e1b24(_0x240c8a[_0x3780('0x10')][_0x3780('0x12')]);}else{logger['info'](_0x3780('0xd'),_0x183e24,_0x3780('0xf'));_0x5e1b24(_0x240c8a[_0x3780('0x13')][_0x3780('0x12')]);}})[_0x3780('0x14')](function(_0x182fe6){logger[_0x3780('0x10')](_0x3780('0xd'),_0x183e24,_0x182fe6);_0x277eb1(_0x182fe6);});});}exports['GetServicenowAccount']=function(_0xd64381){var _0x3cb503=this;return new Promise(function(_0x10ec43,_0x58363d){return db[_0x3780('0x15')][_0x3780('0x16')]({'raw':_0xd64381[_0x3780('0x17')]?_0xd64381[_0x3780('0x17')][_0x3780('0x18')]===undefined?!![]:![]:!![],'where':_0xd64381[_0x3780('0x17')]?_0xd64381[_0x3780('0x17')]['where']||null:null,'attributes':_0xd64381[_0x3780('0x17')]?_0xd64381[_0x3780('0x17')][_0x3780('0x19')]||null:null,'limit':_0xd64381[_0x3780('0x17')]?_0xd64381[_0x3780('0x17')]['limit']||null:null,'include':_0xd64381[_0x3780('0x17')]?_0xd64381[_0x3780('0x17')][_0x3780('0x1a')]?_[_0x3780('0x1b')](_0xd64381['options'][_0x3780('0x1a')],function(_0x117275){return{'model':db[_0x117275[_0x3780('0x1c')]],'as':_0x117275['as'],'attributes':_0x117275['attributes'],'include':_0x117275['include']?_[_0x3780('0x1b')](_0x117275[_0x3780('0x1a')],function(_0x3071ee){return{'model':db[_0x3071ee[_0x3780('0x1c')]],'as':_0x3071ee['as'],'attributes':_0x3071ee[_0x3780('0x19')],'include':_0x3071ee[_0x3780('0x1a')]?_['map'](_0x3071ee[_0x3780('0x1a')],function(_0x556fed){return{'model':db[_0x556fed['model']],'as':_0x556fed['as'],'attributes':_0x556fed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x34a84c){logger[_0x3780('0xc')](_0x3780('0x1d'),_0xd64381);logger[_0x3780('0x1e')]('GetServicenowAccount',_0xd64381,JSON[_0x3780('0x1f')](_0x34a84c));_0x10ec43(_0x34a84c);})[_0x3780('0x14')](function(_0x1ea61d){logger[_0x3780('0x10')](_0x3780('0x1d'),_0x1ea61d[_0x3780('0x12')],_0xd64381);_0x58363d(_0x3cb503[_0x3780('0x10')](0x1f4,_0x1ea61d[_0x3780('0x12')]));});});};exports[_0x3780('0x20')]=function(_0x53c8f8){var _0x161507=this;return new Promise(function(_0x3b83ba,_0x27acba){return db[_0x3780('0x15')][_0x3780('0x21')]({'raw':_0x53c8f8[_0x3780('0x17')]?_0x53c8f8['options'][_0x3780('0x18')]===undefined?!![]:![]:!![],'where':_0x53c8f8[_0x3780('0x17')]?_0x53c8f8[_0x3780('0x17')][_0x3780('0x22')]||null:null,'attributes':_0x53c8f8['options']?_0x53c8f8[_0x3780('0x17')][_0x3780('0x19')]||null:null,'include':_0x53c8f8[_0x3780('0x17')]?_0x53c8f8[_0x3780('0x17')][_0x3780('0x1a')]?_[_0x3780('0x1b')](_0x53c8f8[_0x3780('0x17')][_0x3780('0x1a')],function(_0x28b4ac){return{'model':db[_0x28b4ac[_0x3780('0x1c')]],'as':_0x28b4ac['as'],'attributes':_0x28b4ac[_0x3780('0x19')],'include':_0x28b4ac[_0x3780('0x1a')]?_[_0x3780('0x1b')](_0x28b4ac[_0x3780('0x1a')],function(_0x2a76ec){return{'model':db[_0x2a76ec[_0x3780('0x1c')]],'as':_0x2a76ec['as'],'attributes':_0x2a76ec[_0x3780('0x19')],'include':_0x2a76ec[_0x3780('0x1a')]?_[_0x3780('0x1b')](_0x2a76ec[_0x3780('0x1a')],function(_0x439e6a){return{'model':db[_0x439e6a[_0x3780('0x1c')]],'as':_0x439e6a['as'],'attributes':_0x439e6a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3780('0xb')](function(_0x36bd1b){logger[_0x3780('0xc')](_0x3780('0x20'),_0x53c8f8);logger[_0x3780('0x1e')]('ShowServicenowAccount',_0x53c8f8,JSON['stringify'](_0x36bd1b));_0x3b83ba(_0x36bd1b);})['catch'](function(_0x4556ad){logger[_0x3780('0x10')](_0x3780('0x20'),_0x4556ad[_0x3780('0x12')],_0x53c8f8);_0x27acba(_0x161507[_0x3780('0x10')](0x1f4,_0x4556ad[_0x3780('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 99db3cf..1e587f9 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 _0xb421=['create','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','post'];(function(_0x4717bf,_0x69a7ab){var _0x2ffe7c=function(_0x52a047){while(--_0x52a047){_0x4717bf['push'](_0x4717bf['shift']());}};_0x2ffe7c(++_0x69a7ab);}(_0xb421,0x155));var _0x1b42=function(_0x121b3a,_0x3706ab){_0x121b3a=_0x121b3a-0x0;var _0x3859f5=_0xb421[_0x121b3a];return _0x3859f5;};'use strict';var multer=require(_0x1b42('0x0'));var util=require(_0x1b42('0x1'));var path=require(_0x1b42('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b42('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1b42('0x4'));var interaction=require(_0x1b42('0x5'));var config=require('../../config/environment');var controller=require(_0x1b42('0x6'));router[_0x1b42('0x7')]('/',auth['isAuthenticated'](),controller[_0x1b42('0x8')]);router[_0x1b42('0x7')](_0x1b42('0x9'),auth[_0x1b42('0xa')](),controller['show']);router[_0x1b42('0x7')](_0x1b42('0xb'),auth[_0x1b42('0xa')](),controller[_0x1b42('0xc')]);router[_0x1b42('0x7')]('/:id/subjects',auth[_0x1b42('0xa')](),controller[_0x1b42('0xd')]);router[_0x1b42('0x7')](_0x1b42('0xe'),auth[_0x1b42('0xa')](),controller['getDescriptions']);router[_0x1b42('0xf')]('/',auth[_0x1b42('0xa')](),controller[_0x1b42('0x10')]);router[_0x1b42('0x11')](_0x1b42('0x9'),auth['isAuthenticated'](),controller[_0x1b42('0x12')]);router[_0x1b42('0x13')](_0x1b42('0x9'),auth[_0x1b42('0xa')](),controller[_0x1b42('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdb29=['/:id/fields','getFields','getDescriptions','create','put','delete','/:id','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','show'];(function(_0xa04b18,_0xbf67ec){var _0x5ac1af=function(_0x187d0b){while(--_0x187d0b){_0xa04b18['push'](_0xa04b18['shift']());}};_0x5ac1af(++_0xbf67ec);}(_0xdb29,0x7b));var _0x9db2=function(_0x10c7c1,_0x3f538c){_0x10c7c1=_0x10c7c1-0x0;var _0x16627b=_0xdb29[_0x10c7c1];return _0x16627b;};'use strict';var multer=require('multer');var util=require(_0x9db2('0x0'));var path=require(_0x9db2('0x1'));var timeout=require(_0x9db2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9db2('0x3'));var auth=require(_0x9db2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9db2('0x5'));var controller=require(_0x9db2('0x6'));router[_0x9db2('0x7')]('/',auth[_0x9db2('0x8')](),controller['index']);router[_0x9db2('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9db2('0x9')]);router[_0x9db2('0x7')](_0x9db2('0xa'),auth[_0x9db2('0x8')](),controller[_0x9db2('0xb')]);router[_0x9db2('0x7')]('/:id/subjects',auth[_0x9db2('0x8')](),controller['getSubjects']);router[_0x9db2('0x7')]('/:id/descriptions',auth[_0x9db2('0x8')](),controller[_0x9db2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9db2('0xd')]);router[_0x9db2('0xe')]('/:id',auth[_0x9db2('0x8')](),controller['update']);router[_0x9db2('0xf')](_0x9db2('0x10'),auth[_0x9db2('0x8')](),controller[_0x9db2('0x11')]);module[_0x9db2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index e37c9b0..f941724 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 _0x0950=['exports','STRING'];(function(_0x1eedff,_0x1a349b){var _0x4e760e=function(_0x4fa5b2){while(--_0x4fa5b2){_0x1eedff['push'](_0x1eedff['shift']());}};_0x4e760e(++_0x1a349b);}(_0x0950,0xd4));var _0x0095=function(_0x528bb5,_0x119c5b){_0x528bb5=_0x528bb5-0x0;var _0x58e8ca=_0x0950[_0x528bb5];return _0x58e8ca;};'use strict';var Sequelize=require('sequelize');module[_0x0095('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0095('0x1')]}}; \ No newline at end of file +var _0x2993=['exports','STRING','sequelize'];(function(_0x580c9d,_0x1031f3){var _0x24703a=function(_0x4f7744){while(--_0x4f7744){_0x580c9d['push'](_0x580c9d['shift']());}};_0x24703a(++_0x1031f3);}(_0x2993,0x158));var _0x3299=function(_0x292b7a,_0x442c41){_0x292b7a=_0x292b7a-0x0;var _0x4b0f45=_0x2993[_0x292b7a];return _0x4b0f45;};'use strict';var Sequelize=require(_0x3299('0x0'));module[_0x3299('0x1')]={'name':{'type':Sequelize[_0x3299('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 be15f67..44c4d02 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 _0x56b8=['reject','update','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x56b8,0x180));var _0x856b=function(_0x29a8f7,_0x2441f8){_0x29a8f7=_0x29a8f7-0x0;var _0x37a48c=_0x56b8[_0x29a8f7];return _0x37a48c;};'use strict';var emlformat=require(_0x856b('0x0'));var rimraf=require(_0x856b('0x1'));var zipdir=require(_0x856b('0x2'));var jsonpatch=require(_0x856b('0x3'));var rp=require('request-promise');var moment=require(_0x856b('0x4'));var BPromise=require(_0x856b('0x5'));var Mustache=require(_0x856b('0x6'));var util=require(_0x856b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x856b('0x8'));var ejs=require(_0x856b('0x9'));var fs=require('fs');var fs_extra=require(_0x856b('0xa'));var _=require(_0x856b('0xb'));var squel=require(_0x856b('0xc'));var crypto=require(_0x856b('0xd'));var jsforce=require(_0x856b('0xe'));var deskjs=require(_0x856b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x856b('0x10'));var Papa=require('papaparse');var Redis=require(_0x856b('0x11'));var authService=require(_0x856b('0x12'));var qs=require(_0x856b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x856b('0x14'));var logger=require(_0x856b('0x15'))(_0x856b('0x16'));var utils=require(_0x856b('0x17'));var config=require(_0x856b('0x18'));var licenseUtil=require(_0x856b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dc4af,_0x19e454){_0x19e454=_0x19e454||0xcc;return function(_0xfce9b5){if(_0xfce9b5){return _0x3dc4af[_0x856b('0x1a')](_0x19e454);}return _0x3dc4af['status'](_0x19e454)['end']();};}function respondWithResult(_0x565c32,_0x113a3d){_0x113a3d=_0x113a3d||0xc8;return function(_0x5c7614){if(_0x5c7614){return _0x565c32[_0x856b('0x1b')](_0x113a3d)['json'](_0x5c7614);}};}function respondWithFilteredResult(_0x21cecd,_0xb3456f){return function(_0x1d57f8){if(_0x1d57f8){var _0x26f015=typeof _0xb3456f['offset']===_0x856b('0x1c')&&typeof _0xb3456f['limit']===_0x856b('0x1c');var _0x143250=_0x1d57f8[_0x856b('0x1d')];var _0x5c8554=_0x26f015?0x0:_0xb3456f[_0x856b('0x1e')];var _0x5f166b=_0x26f015?_0x1d57f8['count']:_0xb3456f[_0x856b('0x1e')]+_0xb3456f[_0x856b('0x1f')];var _0x525671;if(_0x5f166b>=_0x143250){_0x5f166b=_0x143250;_0x525671=0xc8;}else{_0x525671=0xce;}_0x21cecd['status'](_0x525671);return _0x21cecd[_0x856b('0x20')](_0x856b('0x21'),_0x5c8554+'-'+_0x5f166b+'/'+_0x143250)[_0x856b('0x22')](_0x1d57f8);}return null;};}function patchUpdates(_0x148b12){return function(_0x2bc920){try{jsonpatch[_0x856b('0x23')](_0x2bc920,_0x148b12,!![]);}catch(_0x47937e){return BPromise[_0x856b('0x24')](_0x47937e);}return _0x2bc920['save']();};}function saveUpdates(_0xfbaeb3,_0x1d62ac){return function(_0x118d2e){if(_0x118d2e){return _0x118d2e[_0x856b('0x25')](_0xfbaeb3)['then'](function(_0x330be2){return _0x330be2;});}return null;};}function removeEntity(_0x3aa9bf,_0x292aa9){return function(_0x499701){if(_0x499701){return _0x499701['destroy']()['then'](function(){_0x3aa9bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e433d,_0xab06e9){return function(_0x398192){if(!_0x398192){_0x5e433d[_0x856b('0x1a')](0x194);}return _0x398192;};}function handleError(_0x3182d8,_0x42fd45){_0x42fd45=_0x42fd45||0x1f4;return function(_0x22c020){logger[_0x856b('0x26')](_0x22c020[_0x856b('0x27')]);if(_0x22c020[_0x856b('0x28')]){delete _0x22c020[_0x856b('0x28')];}_0x3182d8[_0x856b('0x1b')](_0x42fd45)[_0x856b('0x29')](_0x22c020);};}exports[_0x856b('0x2a')]=function(_0x8ed568,_0x541a8e){var _0x1c53fb={},_0xafd5e8={},_0x59a073={'count':0x0,'rows':[]};var _0x490497=_[_0x856b('0x2b')](db[_0x856b('0x2c')][_0x856b('0x2d')],function(_0x1db8a0){return{'name':_0x1db8a0[_0x856b('0x2e')],'type':_0x1db8a0[_0x856b('0x2f')][_0x856b('0x30')]};});_0xafd5e8[_0x856b('0x31')]=_['map'](_0x490497,'name');_0xafd5e8[_0x856b('0x32')]=_[_0x856b('0x33')](_0x8ed568[_0x856b('0x32')]);_0xafd5e8['filters']=_[_0x856b('0x34')](_0xafd5e8[_0x856b('0x31')],_0xafd5e8[_0x856b('0x32')]);_0x1c53fb[_0x856b('0x35')]=_[_0x856b('0x34')](_0xafd5e8['model'],qs[_0x856b('0x36')](_0x8ed568[_0x856b('0x32')][_0x856b('0x36')]));_0x1c53fb[_0x856b('0x35')]=_0x1c53fb['attributes'][_0x856b('0x37')]?_0x1c53fb[_0x856b('0x35')]:_0xafd5e8[_0x856b('0x31')];if(!_0x8ed568[_0x856b('0x32')][_0x856b('0x38')]('nolimit')){_0x1c53fb[_0x856b('0x1f')]=qs[_0x856b('0x1f')](_0x8ed568['query'][_0x856b('0x1f')]);_0x1c53fb[_0x856b('0x1e')]=qs[_0x856b('0x1e')](_0x8ed568['query'][_0x856b('0x1e')]);}_0x1c53fb[_0x856b('0x39')]=qs[_0x856b('0x3a')](_0x8ed568[_0x856b('0x32')]['sort']);_0x1c53fb['where']=qs[_0x856b('0x3b')](_[_0x856b('0x3c')](_0x8ed568['query'],_0xafd5e8[_0x856b('0x3b')]),_0x490497);if(_0x8ed568[_0x856b('0x32')][_0x856b('0x3d')]){_0x1c53fb[_0x856b('0x3e')]=_[_0x856b('0x3f')](_0x1c53fb[_0x856b('0x3e')],{'$or':_[_0x856b('0x2b')](_0x490497,function(_0x469ca7){if(_0x469ca7[_0x856b('0x2f')]!==_0x856b('0x40')){var _0x38967e={};_0x38967e[_0x469ca7[_0x856b('0x28')]]={'$like':'%'+_0x8ed568[_0x856b('0x32')][_0x856b('0x3d')]+'%'};return _0x38967e;}})});}_0x1c53fb=_[_0x856b('0x3f')]({},_0x1c53fb,_0x8ed568[_0x856b('0x41')]);var _0x6a3c20={'where':_0x1c53fb['where']};return db[_0x856b('0x2c')][_0x856b('0x1d')](_0x6a3c20)[_0x856b('0x42')](function(_0x1205b3){_0x59a073[_0x856b('0x1d')]=_0x1205b3;if(_0x8ed568['query'][_0x856b('0x43')]){_0x1c53fb[_0x856b('0x44')]=[{'all':!![]}];}return db[_0x856b('0x2c')][_0x856b('0x45')](_0x1c53fb);})[_0x856b('0x42')](function(_0x1d8f05){_0x59a073[_0x856b('0x46')]=_0x1d8f05;return _0x59a073;})[_0x856b('0x42')](respondWithFilteredResult(_0x541a8e,_0x1c53fb))['catch'](handleError(_0x541a8e,null));};exports[_0x856b('0x47')]=function(_0xe809aa,_0x189d36){var _0x2a9c53={'raw':![],'where':{'id':_0xe809aa[_0x856b('0x48')]['id']}},_0x2046dc={};_0x2046dc[_0x856b('0x31')]=_[_0x856b('0x33')](db[_0x856b('0x2c')][_0x856b('0x2d')]);_0x2046dc[_0x856b('0x32')]=_[_0x856b('0x33')](_0xe809aa['query']);_0x2046dc[_0x856b('0x3b')]=_['intersection'](_0x2046dc[_0x856b('0x31')],_0x2046dc[_0x856b('0x32')]);_0x2a9c53[_0x856b('0x35')]=_[_0x856b('0x34')](_0x2046dc[_0x856b('0x31')],qs[_0x856b('0x36')](_0xe809aa['query']['fields']));_0x2a9c53[_0x856b('0x35')]=_0x2a9c53['attributes'][_0x856b('0x37')]?_0x2a9c53['attributes']:_0x2046dc[_0x856b('0x31')];if(_0xe809aa[_0x856b('0x32')][_0x856b('0x43')]){_0x2a9c53[_0x856b('0x44')]=[{'all':!![]}];}_0x2a9c53=_[_0x856b('0x3f')]({},_0x2a9c53,_0xe809aa[_0x856b('0x41')]);return db['ServicenowConfiguration'][_0x856b('0x49')](_0x2a9c53)[_0x856b('0x42')](handleEntityNotFound(_0x189d36,null))[_0x856b('0x42')](respondWithResult(_0x189d36,null))[_0x856b('0x4a')](handleError(_0x189d36,null));};exports[_0x856b('0x4b')]=function(_0x351561,_0x24322c){return db[_0x856b('0x2c')][_0x856b('0x4b')](_0x351561[_0x856b('0x4c')],{})[_0x856b('0x42')](respondWithResult(_0x24322c,0xc9))[_0x856b('0x4a')](handleError(_0x24322c,null));};exports[_0x856b('0x25')]=function(_0x277eff,_0x347e06){if(_0x277eff[_0x856b('0x4c')]['id']){delete _0x277eff[_0x856b('0x4c')]['id'];}return db['ServicenowConfiguration'][_0x856b('0x49')]({'where':{'id':_0x277eff['params']['id']}})[_0x856b('0x42')](handleEntityNotFound(_0x347e06,null))[_0x856b('0x42')](saveUpdates(_0x277eff[_0x856b('0x4c')],null))[_0x856b('0x42')](respondWithResult(_0x347e06,null))[_0x856b('0x4a')](handleError(_0x347e06,null));};exports[_0x856b('0x4d')]=function(_0x1b40ed,_0x238a40){return db['ServicenowConfiguration'][_0x856b('0x49')]({'where':{'id':_0x1b40ed[_0x856b('0x48')]['id']}})['then'](handleEntityNotFound(_0x238a40,null))[_0x856b('0x42')](removeEntity(_0x238a40,null))[_0x856b('0x4a')](handleError(_0x238a40,null));};exports[_0x856b('0x4e')]=function(_0x3a6b48,_0x3494a2,_0x1635e8){var _0x1f6bff={};var _0x1fe62e={};var _0x2ece17;var _0x48a03a;return db[_0x856b('0x2c')][_0x856b('0x4f')]({'where':{'id':_0x3a6b48[_0x856b('0x48')]['id']}})[_0x856b('0x42')](handleEntityNotFound(_0x3494a2,null))[_0x856b('0x42')](function(_0x567fbe){if(_0x567fbe){_0x2ece17=_0x567fbe;_0x1fe62e[_0x856b('0x31')]=_['keys'](db[_0x856b('0x50')][_0x856b('0x2d')]);_0x1fe62e[_0x856b('0x32')]=_['keys'](_0x3a6b48[_0x856b('0x32')]);_0x1fe62e[_0x856b('0x3b')]=_[_0x856b('0x34')](_0x1fe62e[_0x856b('0x31')],_0x1fe62e[_0x856b('0x32')]);_0x1f6bff['attributes']=_[_0x856b('0x34')](_0x1fe62e[_0x856b('0x31')],qs[_0x856b('0x36')](_0x3a6b48['query'][_0x856b('0x36')]));_0x1f6bff[_0x856b('0x35')]=_0x1f6bff[_0x856b('0x35')][_0x856b('0x37')]?_0x1f6bff[_0x856b('0x35')]:_0x1fe62e['model'];_0x1f6bff[_0x856b('0x39')]=qs[_0x856b('0x3a')](_0x3a6b48[_0x856b('0x32')][_0x856b('0x3a')]);_0x1f6bff[_0x856b('0x3e')]=qs[_0x856b('0x3b')](_['pick'](_0x3a6b48[_0x856b('0x32')],_0x1fe62e[_0x856b('0x3b')]));if(_0x3a6b48[_0x856b('0x32')][_0x856b('0x3d')]){_0x1f6bff[_0x856b('0x3e')]=_[_0x856b('0x3f')](_0x1f6bff[_0x856b('0x3e')],{'$or':_[_0x856b('0x2b')](_0x1f6bff[_0x856b('0x35')],function(_0x145711){var _0x16861a={};_0x16861a[_0x145711]={'$like':'%'+_0x3a6b48[_0x856b('0x32')][_0x856b('0x3d')]+'%'};return _0x16861a;})});}_0x1f6bff=_['merge']({},_0x1f6bff,_0x3a6b48[_0x856b('0x41')]);return _0x2ece17[_0x856b('0x4e')](_0x1f6bff);}})[_0x856b('0x42')](function(_0xefb201){if(_0xefb201){_0x48a03a=_0xefb201[_0x856b('0x37')];if(!_0x3a6b48[_0x856b('0x32')][_0x856b('0x38')](_0x856b('0x51'))){_0x1f6bff['limit']=qs['limit'](_0x3a6b48['query'][_0x856b('0x1f')]);_0x1f6bff[_0x856b('0x1e')]=qs[_0x856b('0x1e')](_0x3a6b48[_0x856b('0x32')][_0x856b('0x1e')]);}return _0x2ece17[_0x856b('0x4e')](_0x1f6bff);}})[_0x856b('0x42')](function(_0xd414d4){if(_0xd414d4){return _0xd414d4?{'count':_0x48a03a,'rows':_0xd414d4}:null;}})[_0x856b('0x42')](respondWithResult(_0x3494a2,null))[_0x856b('0x4a')](handleError(_0x3494a2,null));};exports[_0x856b('0x52')]=function(_0x312e99,_0x1db1a8,_0x2de5e9){var _0x724bf6={};var _0x312f51={};var _0x3ccff9;var _0x42fa3e;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x312e99['params']['id']}})[_0x856b('0x42')](handleEntityNotFound(_0x1db1a8,null))[_0x856b('0x42')](function(_0x7eab1f){if(_0x7eab1f){_0x3ccff9=_0x7eab1f;_0x312f51[_0x856b('0x31')]=_[_0x856b('0x33')](db[_0x856b('0x50')]['rawAttributes']);_0x312f51['query']=_['keys'](_0x312e99[_0x856b('0x32')]);_0x312f51[_0x856b('0x3b')]=_[_0x856b('0x34')](_0x312f51['model'],_0x312f51[_0x856b('0x32')]);_0x724bf6[_0x856b('0x35')]=_[_0x856b('0x34')](_0x312f51[_0x856b('0x31')],qs[_0x856b('0x36')](_0x312e99[_0x856b('0x32')][_0x856b('0x36')]));_0x724bf6[_0x856b('0x35')]=_0x724bf6[_0x856b('0x35')]['length']?_0x724bf6['attributes']:_0x312f51[_0x856b('0x31')];_0x724bf6[_0x856b('0x39')]=qs[_0x856b('0x3a')](_0x312e99['query'][_0x856b('0x3a')]);_0x724bf6[_0x856b('0x3e')]=qs[_0x856b('0x3b')](_[_0x856b('0x3c')](_0x312e99['query'],_0x312f51[_0x856b('0x3b')]));if(_0x312e99[_0x856b('0x32')]['filter']){_0x724bf6[_0x856b('0x3e')]=_['merge'](_0x724bf6[_0x856b('0x3e')],{'$or':_[_0x856b('0x2b')](_0x724bf6[_0x856b('0x35')],function(_0x158c33){var _0x46a69f={};_0x46a69f[_0x158c33]={'$like':'%'+_0x312e99[_0x856b('0x32')][_0x856b('0x3d')]+'%'};return _0x46a69f;})});}_0x724bf6=_[_0x856b('0x3f')]({},_0x724bf6,_0x312e99[_0x856b('0x41')]);return _0x3ccff9[_0x856b('0x52')](_0x724bf6);}})[_0x856b('0x42')](function(_0x2d47b2){if(_0x2d47b2){_0x42fa3e=_0x2d47b2[_0x856b('0x37')];if(!_0x312e99['query']['hasOwnProperty'](_0x856b('0x51'))){_0x724bf6[_0x856b('0x1f')]=qs[_0x856b('0x1f')](_0x312e99[_0x856b('0x32')][_0x856b('0x1f')]);_0x724bf6[_0x856b('0x1e')]=qs[_0x856b('0x1e')](_0x312e99[_0x856b('0x32')][_0x856b('0x1e')]);}return _0x3ccff9[_0x856b('0x52')](_0x724bf6);}})[_0x856b('0x42')](function(_0x4e6c49){if(_0x4e6c49){return _0x4e6c49?{'count':_0x42fa3e,'rows':_0x4e6c49}:null;}})['then'](respondWithResult(_0x1db1a8,null))[_0x856b('0x4a')](handleError(_0x1db1a8,null));};exports[_0x856b('0x53')]=function(_0x3b59e5,_0xe8351,_0x58cc50){var _0xf408fd={};var _0x260a74={};var _0x59b296;var _0x4eed61;return db[_0x856b('0x2c')]['findOne']({'where':{'id':_0x3b59e5[_0x856b('0x48')]['id']}})[_0x856b('0x42')](handleEntityNotFound(_0xe8351,null))['then'](function(_0x48eb97){if(_0x48eb97){_0x59b296=_0x48eb97;_0x260a74['model']=_[_0x856b('0x33')](db[_0x856b('0x50')][_0x856b('0x2d')]);_0x260a74[_0x856b('0x32')]=_[_0x856b('0x33')](_0x3b59e5[_0x856b('0x32')]);_0x260a74[_0x856b('0x3b')]=_[_0x856b('0x34')](_0x260a74['model'],_0x260a74[_0x856b('0x32')]);_0xf408fd[_0x856b('0x35')]=_[_0x856b('0x34')](_0x260a74[_0x856b('0x31')],qs[_0x856b('0x36')](_0x3b59e5['query'][_0x856b('0x36')]));_0xf408fd['attributes']=_0xf408fd['attributes'][_0x856b('0x37')]?_0xf408fd['attributes']:_0x260a74[_0x856b('0x31')];_0xf408fd[_0x856b('0x39')]=qs[_0x856b('0x3a')](_0x3b59e5['query']['sort']);_0xf408fd[_0x856b('0x3e')]=qs[_0x856b('0x3b')](_[_0x856b('0x3c')](_0x3b59e5['query'],_0x260a74[_0x856b('0x3b')]));if(_0x3b59e5[_0x856b('0x32')][_0x856b('0x3d')]){_0xf408fd[_0x856b('0x3e')]=_[_0x856b('0x3f')](_0xf408fd[_0x856b('0x3e')],{'$or':_[_0x856b('0x2b')](_0xf408fd['attributes'],function(_0x460d96){var _0x2308ed={};_0x2308ed[_0x460d96]={'$like':'%'+_0x3b59e5[_0x856b('0x32')][_0x856b('0x3d')]+'%'};return _0x2308ed;})});}_0xf408fd=_[_0x856b('0x3f')]({},_0xf408fd,_0x3b59e5[_0x856b('0x41')]);return _0x59b296[_0x856b('0x53')](_0xf408fd);}})[_0x856b('0x42')](function(_0x34cc5c){if(_0x34cc5c){_0x4eed61=_0x34cc5c[_0x856b('0x37')];if(!_0x3b59e5[_0x856b('0x32')]['hasOwnProperty'](_0x856b('0x51'))){_0xf408fd['limit']=qs['limit'](_0x3b59e5[_0x856b('0x32')][_0x856b('0x1f')]);_0xf408fd[_0x856b('0x1e')]=qs[_0x856b('0x1e')](_0x3b59e5['query'][_0x856b('0x1e')]);}return _0x59b296[_0x856b('0x53')](_0xf408fd);}})[_0x856b('0x42')](function(_0x2f2f21){if(_0x2f2f21){return _0x2f2f21?{'count':_0x4eed61,'rows':_0x2f2f21}:null;}})[_0x856b('0x42')](respondWithResult(_0xe8351,null))[_0x856b('0x4a')](handleError(_0xe8351,null));}; \ No newline at end of file +var _0x2785=['undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','findOne','ServicenowField','pick','getFields','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit'];(function(_0x167c96,_0x56493c){var _0x575f47=function(_0x479847){while(--_0x479847){_0x167c96['push'](_0x167c96['shift']());}};_0x575f47(++_0x56493c);}(_0x2785,0xd1));var _0x5278=function(_0x487a72,_0x4ee2df){_0x487a72=_0x487a72-0x0;var _0xcd3559=_0x2785[_0x487a72];return _0xcd3559;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5278('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5278('0x1'));var rp=require(_0x5278('0x2'));var moment=require(_0x5278('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5278('0x4'));var util=require(_0x5278('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5278('0x6'));var ejs=require(_0x5278('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5278('0x8'));var deskjs=require(_0x5278('0x9'));var toCsv=require(_0x5278('0x6'));var querystring=require(_0x5278('0xa'));var Papa=require(_0x5278('0xb'));var Redis=require(_0x5278('0xc'));var authService=require(_0x5278('0xd'));var qs=require(_0x5278('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5278('0xf'));var logger=require(_0x5278('0x10'))(_0x5278('0x11'));var utils=require('../../config/utils');var config=require(_0x5278('0x12'));var licenseUtil=require(_0x5278('0x13'));var db=require(_0x5278('0x14'))['db'];function respondWithStatusCode(_0x22126d,_0x392987){_0x392987=_0x392987||0xcc;return function(_0xc311ef){if(_0xc311ef){return _0x22126d['sendStatus'](_0x392987);}return _0x22126d[_0x5278('0x15')](_0x392987)['end']();};}function respondWithResult(_0x2b5138,_0x8c7c0c){_0x8c7c0c=_0x8c7c0c||0xc8;return function(_0x56192d){if(_0x56192d){return _0x2b5138[_0x5278('0x15')](_0x8c7c0c)[_0x5278('0x16')](_0x56192d);}};}function respondWithFilteredResult(_0x19549c,_0x5a6bd4){return function(_0x58cb49){if(_0x58cb49){var _0x39f48a=typeof _0x5a6bd4[_0x5278('0x17')]==='undefined'&&typeof _0x5a6bd4[_0x5278('0x18')]===_0x5278('0x19');var _0x593694=_0x58cb49[_0x5278('0x1a')];var _0x30d475=_0x39f48a?0x0:_0x5a6bd4[_0x5278('0x17')];var _0x32ca99=_0x39f48a?_0x58cb49[_0x5278('0x1a')]:_0x5a6bd4[_0x5278('0x17')]+_0x5a6bd4['limit'];var _0x54a5f6;if(_0x32ca99>=_0x593694){_0x32ca99=_0x593694;_0x54a5f6=0xc8;}else{_0x54a5f6=0xce;}_0x19549c[_0x5278('0x15')](_0x54a5f6);return _0x19549c[_0x5278('0x1b')](_0x5278('0x1c'),_0x30d475+'-'+_0x32ca99+'/'+_0x593694)[_0x5278('0x16')](_0x58cb49);}return null;};}function patchUpdates(_0x9c2d0e){return function(_0x3f84ac){try{jsonpatch[_0x5278('0x1d')](_0x3f84ac,_0x9c2d0e,!![]);}catch(_0x9684dc){return BPromise[_0x5278('0x1e')](_0x9684dc);}return _0x3f84ac[_0x5278('0x1f')]();};}function saveUpdates(_0x2d3835,_0x5c57a1){return function(_0x5b8e2f){if(_0x5b8e2f){return _0x5b8e2f[_0x5278('0x20')](_0x2d3835)[_0x5278('0x21')](function(_0x172c64){return _0x172c64;});}return null;};}function removeEntity(_0x584452,_0x5c22e5){return function(_0x281a19){if(_0x281a19){return _0x281a19[_0x5278('0x22')]()['then'](function(){_0x584452['status'](0xcc)[_0x5278('0x23')]();});}};}function handleEntityNotFound(_0x5cdc1d,_0x493a55){return function(_0x3f45ba){if(!_0x3f45ba){_0x5cdc1d['sendStatus'](0x194);}return _0x3f45ba;};}function handleError(_0x5406f7,_0x159cf1){_0x159cf1=_0x159cf1||0x1f4;return function(_0x35ed6a){logger[_0x5278('0x24')](_0x35ed6a[_0x5278('0x25')]);if(_0x35ed6a[_0x5278('0x26')]){delete _0x35ed6a[_0x5278('0x26')];}_0x5406f7[_0x5278('0x15')](_0x159cf1)[_0x5278('0x27')](_0x35ed6a);};}exports[_0x5278('0x28')]=function(_0x2849c9,_0x225067){var _0x301a15={},_0x5bba5b={},_0x5e482a={'count':0x0,'rows':[]};var _0x3aab8f=_['map'](db[_0x5278('0x29')][_0x5278('0x2a')],function(_0x2f0f70){return{'name':_0x2f0f70[_0x5278('0x2b')],'type':_0x2f0f70[_0x5278('0x2c')][_0x5278('0x2d')]};});_0x5bba5b[_0x5278('0x2e')]=_[_0x5278('0x2f')](_0x3aab8f,_0x5278('0x26'));_0x5bba5b[_0x5278('0x30')]=_[_0x5278('0x31')](_0x2849c9[_0x5278('0x30')]);_0x5bba5b[_0x5278('0x32')]=_[_0x5278('0x33')](_0x5bba5b[_0x5278('0x2e')],_0x5bba5b['query']);_0x301a15[_0x5278('0x34')]=_[_0x5278('0x33')](_0x5bba5b[_0x5278('0x2e')],qs[_0x5278('0x35')](_0x2849c9[_0x5278('0x30')][_0x5278('0x35')]));_0x301a15[_0x5278('0x34')]=_0x301a15[_0x5278('0x34')][_0x5278('0x36')]?_0x301a15['attributes']:_0x5bba5b[_0x5278('0x2e')];if(!_0x2849c9['query'][_0x5278('0x37')](_0x5278('0x38'))){_0x301a15[_0x5278('0x18')]=qs['limit'](_0x2849c9[_0x5278('0x30')][_0x5278('0x18')]);_0x301a15[_0x5278('0x17')]=qs[_0x5278('0x17')](_0x2849c9[_0x5278('0x30')][_0x5278('0x17')]);}_0x301a15[_0x5278('0x39')]=qs[_0x5278('0x3a')](_0x2849c9['query'][_0x5278('0x3a')]);_0x301a15[_0x5278('0x3b')]=qs[_0x5278('0x32')](_['pick'](_0x2849c9[_0x5278('0x30')],_0x5bba5b[_0x5278('0x32')]),_0x3aab8f);if(_0x2849c9[_0x5278('0x30')][_0x5278('0x3c')]){_0x301a15[_0x5278('0x3b')]=_[_0x5278('0x3d')](_0x301a15[_0x5278('0x3b')],{'$or':_[_0x5278('0x2f')](_0x3aab8f,function(_0x27b8c7){if(_0x27b8c7[_0x5278('0x2c')]!==_0x5278('0x3e')){var _0x3423e6={};_0x3423e6[_0x27b8c7[_0x5278('0x26')]]={'$like':'%'+_0x2849c9[_0x5278('0x30')][_0x5278('0x3c')]+'%'};return _0x3423e6;}})});}_0x301a15=_['merge']({},_0x301a15,_0x2849c9['options']);var _0x12140c={'where':_0x301a15['where']};return db[_0x5278('0x29')][_0x5278('0x1a')](_0x12140c)[_0x5278('0x21')](function(_0x346a24){_0x5e482a[_0x5278('0x1a')]=_0x346a24;if(_0x2849c9['query'][_0x5278('0x3f')]){_0x301a15[_0x5278('0x40')]=[{'all':!![]}];}return db[_0x5278('0x29')]['findAll'](_0x301a15);})[_0x5278('0x21')](function(_0x42f84f){_0x5e482a[_0x5278('0x41')]=_0x42f84f;return _0x5e482a;})[_0x5278('0x21')](respondWithFilteredResult(_0x225067,_0x301a15))[_0x5278('0x42')](handleError(_0x225067,null));};exports['show']=function(_0x142958,_0x4f7586){var _0x294258={'raw':![],'where':{'id':_0x142958[_0x5278('0x43')]['id']}},_0x388a52={};_0x388a52[_0x5278('0x2e')]=_['keys'](db[_0x5278('0x29')][_0x5278('0x2a')]);_0x388a52[_0x5278('0x30')]=_['keys'](_0x142958['query']);_0x388a52['filters']=_[_0x5278('0x33')](_0x388a52['model'],_0x388a52[_0x5278('0x30')]);_0x294258[_0x5278('0x34')]=_['intersection'](_0x388a52['model'],qs[_0x5278('0x35')](_0x142958[_0x5278('0x30')][_0x5278('0x35')]));_0x294258[_0x5278('0x34')]=_0x294258[_0x5278('0x34')][_0x5278('0x36')]?_0x294258[_0x5278('0x34')]:_0x388a52[_0x5278('0x2e')];if(_0x142958[_0x5278('0x30')][_0x5278('0x3f')]){_0x294258[_0x5278('0x40')]=[{'all':!![]}];}_0x294258=_[_0x5278('0x3d')]({},_0x294258,_0x142958[_0x5278('0x44')]);return db[_0x5278('0x29')][_0x5278('0x45')](_0x294258)['then'](handleEntityNotFound(_0x4f7586,null))[_0x5278('0x21')](respondWithResult(_0x4f7586,null))['catch'](handleError(_0x4f7586,null));};exports[_0x5278('0x46')]=function(_0x421380,_0x25f1f0){return db[_0x5278('0x29')]['create'](_0x421380['body'],{})[_0x5278('0x21')](respondWithResult(_0x25f1f0,0xc9))[_0x5278('0x42')](handleError(_0x25f1f0,null));};exports[_0x5278('0x20')]=function(_0x104291,_0x1de699){if(_0x104291[_0x5278('0x47')]['id']){delete _0x104291['body']['id'];}return db[_0x5278('0x29')][_0x5278('0x45')]({'where':{'id':_0x104291[_0x5278('0x43')]['id']}})[_0x5278('0x21')](handleEntityNotFound(_0x1de699,null))[_0x5278('0x21')](saveUpdates(_0x104291[_0x5278('0x47')],null))['then'](respondWithResult(_0x1de699,null))[_0x5278('0x42')](handleError(_0x1de699,null));};exports[_0x5278('0x22')]=function(_0x532aaf,_0x5176a0){return db[_0x5278('0x29')][_0x5278('0x45')]({'where':{'id':_0x532aaf[_0x5278('0x43')]['id']}})[_0x5278('0x21')](handleEntityNotFound(_0x5176a0,null))[_0x5278('0x21')](removeEntity(_0x5176a0,null))[_0x5278('0x42')](handleError(_0x5176a0,null));};exports['getFields']=function(_0x129aec,_0x4f7f4c,_0x152cc2){var _0x2a19da={};var _0x3411d4={};var _0x5d622f;var _0x284f37;return db[_0x5278('0x29')][_0x5278('0x48')]({'where':{'id':_0x129aec['params']['id']}})[_0x5278('0x21')](handleEntityNotFound(_0x4f7f4c,null))[_0x5278('0x21')](function(_0x265b3f){if(_0x265b3f){_0x5d622f=_0x265b3f;_0x3411d4[_0x5278('0x2e')]=_['keys'](db[_0x5278('0x49')][_0x5278('0x2a')]);_0x3411d4[_0x5278('0x30')]=_[_0x5278('0x31')](_0x129aec[_0x5278('0x30')]);_0x3411d4[_0x5278('0x32')]=_[_0x5278('0x33')](_0x3411d4[_0x5278('0x2e')],_0x3411d4[_0x5278('0x30')]);_0x2a19da[_0x5278('0x34')]=_[_0x5278('0x33')](_0x3411d4[_0x5278('0x2e')],qs[_0x5278('0x35')](_0x129aec[_0x5278('0x30')]['fields']));_0x2a19da['attributes']=_0x2a19da['attributes'][_0x5278('0x36')]?_0x2a19da['attributes']:_0x3411d4['model'];_0x2a19da[_0x5278('0x39')]=qs[_0x5278('0x3a')](_0x129aec[_0x5278('0x30')]['sort']);_0x2a19da[_0x5278('0x3b')]=qs[_0x5278('0x32')](_[_0x5278('0x4a')](_0x129aec['query'],_0x3411d4[_0x5278('0x32')]));if(_0x129aec[_0x5278('0x30')][_0x5278('0x3c')]){_0x2a19da[_0x5278('0x3b')]=_[_0x5278('0x3d')](_0x2a19da['where'],{'$or':_['map'](_0x2a19da[_0x5278('0x34')],function(_0x331e50){var _0x302ffa={};_0x302ffa[_0x331e50]={'$like':'%'+_0x129aec['query'][_0x5278('0x3c')]+'%'};return _0x302ffa;})});}_0x2a19da=_['merge']({},_0x2a19da,_0x129aec['options']);return _0x5d622f[_0x5278('0x4b')](_0x2a19da);}})[_0x5278('0x21')](function(_0x995063){if(_0x995063){_0x284f37=_0x995063['length'];if(!_0x129aec['query'][_0x5278('0x37')](_0x5278('0x38'))){_0x2a19da[_0x5278('0x18')]=qs[_0x5278('0x18')](_0x129aec['query'][_0x5278('0x18')]);_0x2a19da['offset']=qs['offset'](_0x129aec[_0x5278('0x30')]['offset']);}return _0x5d622f['getFields'](_0x2a19da);}})[_0x5278('0x21')](function(_0x4d6cd5){if(_0x4d6cd5){return _0x4d6cd5?{'count':_0x284f37,'rows':_0x4d6cd5}:null;}})[_0x5278('0x21')](respondWithResult(_0x4f7f4c,null))[_0x5278('0x42')](handleError(_0x4f7f4c,null));};exports['getSubjects']=function(_0x30c73e,_0x3fcbe7,_0x57e3dd){var _0x4debe8={};var _0x55c9b4={};var _0x558b2c;var _0x353814;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x30c73e[_0x5278('0x43')]['id']}})[_0x5278('0x21')](handleEntityNotFound(_0x3fcbe7,null))['then'](function(_0x6f3346){if(_0x6f3346){_0x558b2c=_0x6f3346;_0x55c9b4[_0x5278('0x2e')]=_[_0x5278('0x31')](db[_0x5278('0x49')]['rawAttributes']);_0x55c9b4[_0x5278('0x30')]=_[_0x5278('0x31')](_0x30c73e[_0x5278('0x30')]);_0x55c9b4['filters']=_['intersection'](_0x55c9b4[_0x5278('0x2e')],_0x55c9b4[_0x5278('0x30')]);_0x4debe8[_0x5278('0x34')]=_['intersection'](_0x55c9b4['model'],qs['fields'](_0x30c73e[_0x5278('0x30')][_0x5278('0x35')]));_0x4debe8[_0x5278('0x34')]=_0x4debe8[_0x5278('0x34')][_0x5278('0x36')]?_0x4debe8[_0x5278('0x34')]:_0x55c9b4[_0x5278('0x2e')];_0x4debe8['order']=qs['sort'](_0x30c73e[_0x5278('0x30')]['sort']);_0x4debe8[_0x5278('0x3b')]=qs[_0x5278('0x32')](_['pick'](_0x30c73e[_0x5278('0x30')],_0x55c9b4[_0x5278('0x32')]));if(_0x30c73e[_0x5278('0x30')]['filter']){_0x4debe8[_0x5278('0x3b')]=_['merge'](_0x4debe8[_0x5278('0x3b')],{'$or':_[_0x5278('0x2f')](_0x4debe8['attributes'],function(_0x58f564){var _0x144df7={};_0x144df7[_0x58f564]={'$like':'%'+_0x30c73e['query']['filter']+'%'};return _0x144df7;})});}_0x4debe8=_[_0x5278('0x3d')]({},_0x4debe8,_0x30c73e[_0x5278('0x44')]);return _0x558b2c[_0x5278('0x4c')](_0x4debe8);}})[_0x5278('0x21')](function(_0x2f22e5){if(_0x2f22e5){_0x353814=_0x2f22e5[_0x5278('0x36')];if(!_0x30c73e[_0x5278('0x30')][_0x5278('0x37')]('nolimit')){_0x4debe8[_0x5278('0x18')]=qs[_0x5278('0x18')](_0x30c73e[_0x5278('0x30')][_0x5278('0x18')]);_0x4debe8[_0x5278('0x17')]=qs[_0x5278('0x17')](_0x30c73e[_0x5278('0x30')][_0x5278('0x17')]);}return _0x558b2c['getSubjects'](_0x4debe8);}})[_0x5278('0x21')](function(_0x4af3ea){if(_0x4af3ea){return _0x4af3ea?{'count':_0x353814,'rows':_0x4af3ea}:null;}})[_0x5278('0x21')](respondWithResult(_0x3fcbe7,null))[_0x5278('0x42')](handleError(_0x3fcbe7,null));};exports[_0x5278('0x4d')]=function(_0x191577,_0x2b1fcf,_0x5a0ec5){var _0x5f5874={};var _0x7ab5b6={};var _0x122bb6;var _0x47c201;return db[_0x5278('0x29')][_0x5278('0x48')]({'where':{'id':_0x191577[_0x5278('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b1fcf,null))[_0x5278('0x21')](function(_0x7f7289){if(_0x7f7289){_0x122bb6=_0x7f7289;_0x7ab5b6['model']=_[_0x5278('0x31')](db[_0x5278('0x49')][_0x5278('0x2a')]);_0x7ab5b6['query']=_[_0x5278('0x31')](_0x191577[_0x5278('0x30')]);_0x7ab5b6[_0x5278('0x32')]=_[_0x5278('0x33')](_0x7ab5b6[_0x5278('0x2e')],_0x7ab5b6['query']);_0x5f5874['attributes']=_[_0x5278('0x33')](_0x7ab5b6['model'],qs[_0x5278('0x35')](_0x191577[_0x5278('0x30')][_0x5278('0x35')]));_0x5f5874[_0x5278('0x34')]=_0x5f5874[_0x5278('0x34')][_0x5278('0x36')]?_0x5f5874[_0x5278('0x34')]:_0x7ab5b6['model'];_0x5f5874[_0x5278('0x39')]=qs[_0x5278('0x3a')](_0x191577[_0x5278('0x30')][_0x5278('0x3a')]);_0x5f5874[_0x5278('0x3b')]=qs[_0x5278('0x32')](_[_0x5278('0x4a')](_0x191577[_0x5278('0x30')],_0x7ab5b6[_0x5278('0x32')]));if(_0x191577['query'][_0x5278('0x3c')]){_0x5f5874[_0x5278('0x3b')]=_['merge'](_0x5f5874[_0x5278('0x3b')],{'$or':_['map'](_0x5f5874[_0x5278('0x34')],function(_0x5225c4){var _0x4b76d9={};_0x4b76d9[_0x5225c4]={'$like':'%'+_0x191577['query'][_0x5278('0x3c')]+'%'};return _0x4b76d9;})});}_0x5f5874=_[_0x5278('0x3d')]({},_0x5f5874,_0x191577['options']);return _0x122bb6[_0x5278('0x4d')](_0x5f5874);}})['then'](function(_0x296df1){if(_0x296df1){_0x47c201=_0x296df1[_0x5278('0x36')];if(!_0x191577[_0x5278('0x30')][_0x5278('0x37')]('nolimit')){_0x5f5874[_0x5278('0x18')]=qs[_0x5278('0x18')](_0x191577[_0x5278('0x30')][_0x5278('0x18')]);_0x5f5874['offset']=qs[_0x5278('0x17')](_0x191577[_0x5278('0x30')][_0x5278('0x17')]);}return _0x122bb6['getDescriptions'](_0x5f5874);}})[_0x5278('0x21')](function(_0x283ffd){if(_0x283ffd){return _0x283ffd?{'count':_0x47c201,'rows':_0x283ffd}:null;}})[_0x5278('0x21')](respondWithResult(_0x2b1fcf,null))['catch'](handleError(_0x2b1fcf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f8afac9..cca0980 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 _0x854f=['../../config/logger','api','moment','bluebird','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x585c4e,_0x25453f){var _0x458af1=function(_0x1893e3){while(--_0x1893e3){_0x585c4e['push'](_0x585c4e['shift']());}};_0x458af1(++_0x25453f);}(_0x854f,0xc1));var _0xf854=function(_0x4f6bd8,_0x3719ee){_0x4f6bd8=_0x4f6bd8-0x0;var _0x5f7c63=_0x854f[_0x4f6bd8];return _0x5f7c63;};'use strict';var _=require(_0xf854('0x0'));var util=require(_0xf854('0x1'));var logger=require(_0xf854('0x2'))(_0xf854('0x3'));var moment=require(_0xf854('0x4'));var BPromise=require(_0xf854('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf854('0x6'));var rimraf=require('rimraf');var config=require(_0xf854('0x7'));var attributes=require(_0xf854('0x8'));module[_0xf854('0x9')]=function(_0x1f5ec4,_0x4b1ca8){return _0x1f5ec4[_0xf854('0xa')](_0xf854('0xb'),attributes,{'tableName':_0xf854('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8383=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','api','moment','bluebird'];(function(_0x4beaaa,_0x5713b8){var _0x2da88b=function(_0x260c8d){while(--_0x260c8d){_0x4beaaa['push'](_0x4beaaa['shift']());}};_0x2da88b(++_0x5713b8);}(_0x8383,0x98));var _0x3838=function(_0xacbb4b,_0x10a45d){_0xacbb4b=_0xacbb4b-0x0;var _0x609c46=_0x8383[_0xacbb4b];return _0x609c46;};'use strict';var _=require(_0x3838('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3838('0x1'));var moment=require(_0x3838('0x2'));var BPromise=require(_0x3838('0x3'));var rp=require(_0x3838('0x4'));var fs=require('fs');var path=require(_0x3838('0x5'));var rimraf=require(_0x3838('0x6'));var config=require(_0x3838('0x7'));var attributes=require(_0x3838('0x8'));module[_0x3838('0x9')]=function(_0x7a4cc0,_0x509656){return _0x7a4cc0[_0x3838('0xa')](_0x3838('0xb'),attributes,{'tableName':'int_servicenow_configurations','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 185c466..da194bd 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 _0x2f1e=['result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0x2f1e,0xd9));var _0xe2f1=function(_0x31d06c,_0x2125a6){_0x31d06c=_0x31d06c-0x0;var _0x26b12c=_0x2f1e[_0x31d06c];return _0x26b12c;};'use strict';var _=require(_0xe2f1('0x0'));var util=require(_0xe2f1('0x1'));var moment=require(_0xe2f1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2f1('0x3'));var db=require(_0xe2f1('0x4'))['db'];var utils=require(_0xe2f1('0x5'));var logger=require(_0xe2f1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe2f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x445054,_0xc6dc70,_0x190f6e){return new BPromise(function(_0x576918,_0x4a6126){return client['request'](_0x445054,_0x190f6e)[_0xe2f1('0x8')](function(_0x49afa6){logger[_0xe2f1('0x9')](_0xe2f1('0xa'),_0xc6dc70,'request\x20sent');logger[_0xe2f1('0xb')](_0xe2f1('0xc'),_0xc6dc70,_0xe2f1('0xd'),JSON['stringify'](_0x49afa6));if(_0x49afa6['error']){if(_0x49afa6[_0xe2f1('0xe')][_0xe2f1('0xf')]===0x1f4){logger[_0xe2f1('0xe')](_0xe2f1('0xa'),_0xc6dc70,_0x49afa6['error']['message']);return _0x4a6126(_0x49afa6[_0xe2f1('0xe')][_0xe2f1('0x10')]);}logger[_0xe2f1('0xe')](_0xe2f1('0xa'),_0xc6dc70,_0x49afa6[_0xe2f1('0xe')]['message']);return _0x576918(_0x49afa6[_0xe2f1('0xe')][_0xe2f1('0x10')]);}else{logger[_0xe2f1('0x9')](_0xe2f1('0xa'),_0xc6dc70,_0xe2f1('0xd'));_0x576918(_0x49afa6[_0xe2f1('0x11')][_0xe2f1('0x10')]);}})['catch'](function(_0x386f2d){logger['error'](_0xe2f1('0xa'),_0xc6dc70,_0x386f2d);_0x4a6126(_0x386f2d);});});} \ No newline at end of file +var _0xf3d0=['http','request','then','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x5b40a7,_0xdaf7ce){var _0x18948f=function(_0x169645){while(--_0x169645){_0x5b40a7['push'](_0x5b40a7['shift']());}};_0x18948f(++_0xdaf7ce);}(_0xf3d0,0x18e));var _0x0f3d=function(_0x3778d2,_0x2e24dc){_0x3778d2=_0x3778d2-0x0;var _0x4cc1ed=_0xf3d0[_0x3778d2];return _0x4cc1ed;};'use strict';var _=require(_0x0f3d('0x0'));var util=require(_0x0f3d('0x1'));var moment=require('moment');var BPromise=require(_0x0f3d('0x2'));var rs=require(_0x0f3d('0x3'));var fs=require('fs');var Redis=require(_0x0f3d('0x4'));var db=require(_0x0f3d('0x5'))['db'];var utils=require(_0x0f3d('0x6'));var logger=require(_0x0f3d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0f3d('0x8'));var client=jayson[_0x0f3d('0x9')][_0x0f3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d14c5,_0x2e168c,_0x2dbd7c){return new BPromise(function(_0x4246a8,_0x3fb2f8){return client[_0x0f3d('0xb')](_0x1d14c5,_0x2dbd7c)[_0x0f3d('0xc')](function(_0x3e9a5a){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x2e168c,'request\x20sent');logger[_0x0f3d('0xd')](_0x0f3d('0xe'),_0x2e168c,_0x0f3d('0xf'),JSON[_0x0f3d('0x10')](_0x3e9a5a));if(_0x3e9a5a['error']){if(_0x3e9a5a[_0x0f3d('0x11')][_0x0f3d('0x12')]===0x1f4){logger[_0x0f3d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2e168c,_0x3e9a5a[_0x0f3d('0x11')]['message']);return _0x3fb2f8(_0x3e9a5a[_0x0f3d('0x11')]['message']);}logger[_0x0f3d('0x11')](_0x0f3d('0x13'),_0x2e168c,_0x3e9a5a[_0x0f3d('0x11')][_0x0f3d('0x14')]);return _0x4246a8(_0x3e9a5a[_0x0f3d('0x11')]['message']);}else{logger[_0x0f3d('0x15')](_0x0f3d('0x13'),_0x2e168c,_0x0f3d('0xf'));_0x4246a8(_0x3e9a5a[_0x0f3d('0x16')][_0x0f3d('0x14')]);}})[_0x0f3d('0x17')](function(_0x17500d){logger[_0x0f3d('0x11')](_0x0f3d('0x13'),_0x2e168c,_0x17500d);_0x3fb2f8(_0x17500d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index f4c8e3d..dd1c274 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 _0xaab4=['put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','index','get','/:id','show','post','isAuthenticated'];(function(_0x56f0b2,_0xdcf225){var _0x194f36=function(_0x640df6){while(--_0x640df6){_0x56f0b2['push'](_0x56f0b2['shift']());}};_0x194f36(++_0xdcf225);}(_0xaab4,0x1e9));var _0x4aab=function(_0x1ffd67,_0x52077d){_0x1ffd67=_0x1ffd67-0x0;var _0x51c64d=_0xaab4[_0x1ffd67];return _0x51c64d;};'use strict';var multer=require(_0x4aab('0x0'));var util=require('util');var path=require(_0x4aab('0x1'));var timeout=require(_0x4aab('0x2'));var express=require(_0x4aab('0x3'));var router=express[_0x4aab('0x4')]();var fs_extra=require(_0x4aab('0x5'));var auth=require(_0x4aab('0x6'));var interaction=require(_0x4aab('0x7'));var config=require('../../config/environment');var controller=require(_0x4aab('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4aab('0x9')]);router[_0x4aab('0xa')](_0x4aab('0xb'),auth['isAuthenticated'](),controller[_0x4aab('0xc')]);router[_0x4aab('0xd')]('/',auth[_0x4aab('0xe')](),controller['create']);router[_0x4aab('0xf')]('/:id',auth[_0x4aab('0xe')](),controller['update']);router[_0x4aab('0x10')](_0x4aab('0xb'),auth[_0x4aab('0xe')](),controller['destroy']);module[_0x4aab('0x11')]=router; \ No newline at end of file +var _0x26e3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x31dd97,_0x87c48){var _0x3d931f=function(_0x346085){while(--_0x346085){_0x31dd97['push'](_0x31dd97['shift']());}};_0x3d931f(++_0x87c48);}(_0x26e3,0xb7));var _0x326e=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x26e3[_0x36bff5];return _0x80ade5;};'use strict';var multer=require(_0x326e('0x0'));var util=require(_0x326e('0x1'));var path=require(_0x326e('0x2'));var timeout=require(_0x326e('0x3'));var express=require(_0x326e('0x4'));var router=express[_0x326e('0x5')]();var fs_extra=require(_0x326e('0x6'));var auth=require(_0x326e('0x7'));var interaction=require(_0x326e('0x8'));var config=require(_0x326e('0x9'));var controller=require(_0x326e('0xa'));router[_0x326e('0xb')]('/',auth[_0x326e('0xc')](),controller[_0x326e('0xd')]);router[_0x326e('0xb')]('/:id',auth[_0x326e('0xc')](),controller[_0x326e('0xe')]);router[_0x326e('0xf')]('/',auth[_0x326e('0xc')](),controller[_0x326e('0x10')]);router[_0x326e('0x11')](_0x326e('0x12'),auth[_0x326e('0xc')](),controller[_0x326e('0x13')]);router[_0x326e('0x14')]('/:id',auth[_0x326e('0xc')](),controller[_0x326e('0x15')]);module[_0x326e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9f6e09b..fda99a9 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 _0x8781=['ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8781,0x77));var _0x1878=function(_0xf2f611,_0x4fd95e){_0xf2f611=_0xf2f611-0x0;var _0x54fe31=_0x8781[_0xf2f611];return _0x54fe31;};'use strict';var Sequelize=require(_0x1878('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x1878('0x1'),_0x1878('0x2'),_0x1878('0x3'),_0x1878('0x4'),_0x1878('0x5')),'defaultValue':_0x1878('0x1')},'content':{'type':Sequelize[_0x1878('0x6')]},'key':{'type':Sequelize[_0x1878('0x6')]},'keyType':{'type':Sequelize[_0x1878('0x7')](_0x1878('0x1'),_0x1878('0x2'),_0x1878('0x3'))},'keyContent':{'type':Sequelize[_0x1878('0x6')]},'idField':{'type':Sequelize[_0x1878('0x6')]},'nameField':{'type':Sequelize[_0x1878('0x6')]},'customField':{'type':Sequelize[_0x1878('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1878('0x6')]}}; \ No newline at end of file +var _0xcea9=['exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string','sequelize'];(function(_0x4eb8cb,_0x38cf86){var _0xac8db9=function(_0xf3bbf2){while(--_0xf3bbf2){_0x4eb8cb['push'](_0x4eb8cb['shift']());}};_0xac8db9(++_0x38cf86);}(_0xcea9,0x179));var _0x9cea=function(_0xf10789,_0x557473){_0xf10789=_0xf10789-0x0;var _0x3b57d1=_0xcea9[_0xf10789];return _0x3b57d1;};'use strict';var Sequelize=require(_0x9cea('0x0'));module[_0x9cea('0x1')]={'type':{'type':Sequelize[_0x9cea('0x2')]('string',_0x9cea('0x3'),_0x9cea('0x4'),_0x9cea('0x5'),_0x9cea('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9cea('0x7')]},'key':{'type':Sequelize[_0x9cea('0x7')]},'keyType':{'type':Sequelize[_0x9cea('0x2')](_0x9cea('0x8'),_0x9cea('0x3'),_0x9cea('0x4'))},'keyContent':{'type':Sequelize[_0x9cea('0x7')]},'idField':{'type':Sequelize[_0x9cea('0x7')]},'nameField':{'type':Sequelize[_0x9cea('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ced2d62..a633925 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 _0x5ce6=['includeAll','include','rows','catch','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL'];(function(_0x5972dd,_0x26edae){var _0x35c353=function(_0x1b5a53){while(--_0x1b5a53){_0x5972dd['push'](_0x5972dd['shift']());}};_0x35c353(++_0x26edae);}(_0x5ce6,0x195));var _0x65ce=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x5ce6[_0x174ef5];return _0x1cc379;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65ce('0x0'));var zipdir=require(_0x65ce('0x1'));var jsonpatch=require(_0x65ce('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x65ce('0x3'));var Mustache=require('mustache');var util=require(_0x65ce('0x4'));var path=require(_0x65ce('0x5'));var sox=require(_0x65ce('0x6'));var csv=require(_0x65ce('0x7'));var ejs=require(_0x65ce('0x8'));var fs=require('fs');var fs_extra=require(_0x65ce('0x9'));var _=require(_0x65ce('0xa'));var squel=require('squel');var crypto=require(_0x65ce('0xb'));var jsforce=require(_0x65ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x65ce('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x65ce('0xd'));var authService=require(_0x65ce('0xe'));var qs=require(_0x65ce('0xf'));var as=require(_0x65ce('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x65ce('0x11'));var utils=require(_0x65ce('0x12'));var config=require(_0x65ce('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x443d20,_0x1f56cb){_0x1f56cb=_0x1f56cb||0xcc;return function(_0x1d3fa6){if(_0x1d3fa6){return _0x443d20[_0x65ce('0x14')](_0x1f56cb);}return _0x443d20[_0x65ce('0x15')](_0x1f56cb)[_0x65ce('0x16')]();};}function respondWithResult(_0x241900,_0x2fe274){_0x2fe274=_0x2fe274||0xc8;return function(_0xb28202){if(_0xb28202){return _0x241900[_0x65ce('0x15')](_0x2fe274)[_0x65ce('0x17')](_0xb28202);}};}function respondWithFilteredResult(_0xced544,_0x19d536){return function(_0x157240){if(_0x157240){var _0x1a5ccb=typeof _0x19d536[_0x65ce('0x18')]===_0x65ce('0x19')&&typeof _0x19d536['limit']==='undefined';var _0x1bbc23=_0x157240[_0x65ce('0x1a')];var _0xa516d3=_0x1a5ccb?0x0:_0x19d536[_0x65ce('0x18')];var _0x53994b=_0x1a5ccb?_0x157240[_0x65ce('0x1a')]:_0x19d536[_0x65ce('0x18')]+_0x19d536[_0x65ce('0x1b')];var _0x32e6f7;if(_0x53994b>=_0x1bbc23){_0x53994b=_0x1bbc23;_0x32e6f7=0xc8;}else{_0x32e6f7=0xce;}_0xced544[_0x65ce('0x15')](_0x32e6f7);return _0xced544[_0x65ce('0x1c')](_0x65ce('0x1d'),_0xa516d3+'-'+_0x53994b+'/'+_0x1bbc23)[_0x65ce('0x17')](_0x157240);}return null;};}function patchUpdates(_0x2441c3){return function(_0x388b3f){try{jsonpatch[_0x65ce('0x1e')](_0x388b3f,_0x2441c3,!![]);}catch(_0x1517fa){return BPromise['reject'](_0x1517fa);}return _0x388b3f['save']();};}function saveUpdates(_0x50503e,_0x28dcf6){return function(_0x166b46){if(_0x166b46){return _0x166b46[_0x65ce('0x1f')](_0x50503e)[_0x65ce('0x20')](function(_0x2f84e3){return _0x2f84e3;});}return null;};}function removeEntity(_0x37a27f,_0x2d62cf){return function(_0x5ac070){if(_0x5ac070){return _0x5ac070[_0x65ce('0x21')]()[_0x65ce('0x20')](function(){_0x37a27f[_0x65ce('0x15')](0xcc)[_0x65ce('0x16')]();});}};}function handleEntityNotFound(_0xcc6c4e,_0x215997){return function(_0x10694a){if(!_0x10694a){_0xcc6c4e[_0x65ce('0x14')](0x194);}return _0x10694a;};}function handleError(_0x52f3b8,_0x15e51b){_0x15e51b=_0x15e51b||0x1f4;return function(_0x102c5b){logger['error'](_0x102c5b[_0x65ce('0x22')]);if(_0x102c5b[_0x65ce('0x23')]){delete _0x102c5b[_0x65ce('0x23')];}_0x52f3b8['status'](_0x15e51b)[_0x65ce('0x24')](_0x102c5b);};}exports[_0x65ce('0x25')]=function(_0x2458e4,_0xd6964b){var _0x35fef0={},_0x2c7a20={},_0x4f2bbb={'count':0x0,'rows':[]};var _0x502e46=_[_0x65ce('0x26')](db[_0x65ce('0x27')][_0x65ce('0x28')],function(_0xd5d25d){return{'name':_0xd5d25d['fieldName'],'type':_0xd5d25d[_0x65ce('0x29')][_0x65ce('0x2a')]};});_0x2c7a20['model']=_[_0x65ce('0x26')](_0x502e46,_0x65ce('0x23'));_0x2c7a20[_0x65ce('0x2b')]=_[_0x65ce('0x2c')](_0x2458e4[_0x65ce('0x2b')]);_0x2c7a20[_0x65ce('0x2d')]=_[_0x65ce('0x2e')](_0x2c7a20[_0x65ce('0x2f')],_0x2c7a20['query']);_0x35fef0[_0x65ce('0x30')]=_[_0x65ce('0x2e')](_0x2c7a20['model'],qs[_0x65ce('0x31')](_0x2458e4['query'][_0x65ce('0x31')]));_0x35fef0[_0x65ce('0x30')]=_0x35fef0[_0x65ce('0x30')][_0x65ce('0x32')]?_0x35fef0[_0x65ce('0x30')]:_0x2c7a20['model'];if(!_0x2458e4[_0x65ce('0x2b')]['hasOwnProperty']('nolimit')){_0x35fef0['limit']=qs['limit'](_0x2458e4[_0x65ce('0x2b')][_0x65ce('0x1b')]);_0x35fef0['offset']=qs[_0x65ce('0x18')](_0x2458e4[_0x65ce('0x2b')][_0x65ce('0x18')]);}_0x35fef0[_0x65ce('0x33')]=qs[_0x65ce('0x34')](_0x2458e4[_0x65ce('0x2b')][_0x65ce('0x34')]);_0x35fef0[_0x65ce('0x35')]=qs['filters'](_['pick'](_0x2458e4[_0x65ce('0x2b')],_0x2c7a20[_0x65ce('0x2d')]),_0x502e46);if(_0x2458e4[_0x65ce('0x2b')][_0x65ce('0x36')]){_0x35fef0[_0x65ce('0x35')]=_[_0x65ce('0x37')](_0x35fef0[_0x65ce('0x35')],{'$or':_[_0x65ce('0x26')](_0x502e46,function(_0x22b753){if(_0x22b753[_0x65ce('0x29')]!==_0x65ce('0x38')){var _0x5c3eae={};_0x5c3eae[_0x22b753[_0x65ce('0x23')]]={'$like':'%'+_0x2458e4[_0x65ce('0x2b')][_0x65ce('0x36')]+'%'};return _0x5c3eae;}})});}_0x35fef0=_[_0x65ce('0x37')]({},_0x35fef0,_0x2458e4['options']);var _0x550018={'where':_0x35fef0['where']};return db[_0x65ce('0x27')]['count'](_0x550018)[_0x65ce('0x20')](function(_0x120f16){_0x4f2bbb[_0x65ce('0x1a')]=_0x120f16;if(_0x2458e4[_0x65ce('0x2b')][_0x65ce('0x39')]){_0x35fef0[_0x65ce('0x3a')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x35fef0);})[_0x65ce('0x20')](function(_0xefb10){_0x4f2bbb[_0x65ce('0x3b')]=_0xefb10;return _0x4f2bbb;})[_0x65ce('0x20')](respondWithFilteredResult(_0xd6964b,_0x35fef0))[_0x65ce('0x3c')](handleError(_0xd6964b,null));};exports['show']=function(_0x6a2769,_0x1c9ba8){var _0x1783c9={'raw':!![],'where':{'id':_0x6a2769[_0x65ce('0x3d')]['id']}},_0x17d1dc={};_0x17d1dc[_0x65ce('0x2f')]=_[_0x65ce('0x2c')](db[_0x65ce('0x27')][_0x65ce('0x28')]);_0x17d1dc[_0x65ce('0x2b')]=_[_0x65ce('0x2c')](_0x6a2769[_0x65ce('0x2b')]);_0x17d1dc[_0x65ce('0x2d')]=_[_0x65ce('0x2e')](_0x17d1dc[_0x65ce('0x2f')],_0x17d1dc[_0x65ce('0x2b')]);_0x1783c9[_0x65ce('0x30')]=_['intersection'](_0x17d1dc[_0x65ce('0x2f')],qs[_0x65ce('0x31')](_0x6a2769['query'][_0x65ce('0x31')]));_0x1783c9['attributes']=_0x1783c9['attributes'][_0x65ce('0x32')]?_0x1783c9[_0x65ce('0x30')]:_0x17d1dc[_0x65ce('0x2f')];if(_0x6a2769[_0x65ce('0x2b')][_0x65ce('0x39')]){_0x1783c9[_0x65ce('0x3a')]=[{'all':!![]}];}_0x1783c9=_[_0x65ce('0x37')]({},_0x1783c9,_0x6a2769[_0x65ce('0x3e')]);return db['ServicenowField'][_0x65ce('0x3f')](_0x1783c9)[_0x65ce('0x20')](handleEntityNotFound(_0x1c9ba8,null))[_0x65ce('0x20')](respondWithResult(_0x1c9ba8,null))['catch'](handleError(_0x1c9ba8,null));};exports[_0x65ce('0x40')]=function(_0x1212e9,_0x5c21e7){return db[_0x65ce('0x27')]['create'](_0x1212e9['body'],{})[_0x65ce('0x20')](respondWithResult(_0x5c21e7,0xc9))[_0x65ce('0x3c')](handleError(_0x5c21e7,null));};exports[_0x65ce('0x1f')]=function(_0x55d501,_0x22bf4a){if(_0x55d501['body']['id']){delete _0x55d501['body']['id'];}return db['ServicenowField']['find']({'where':{'id':_0x55d501[_0x65ce('0x3d')]['id']}})['then'](handleEntityNotFound(_0x22bf4a,null))[_0x65ce('0x20')](saveUpdates(_0x55d501[_0x65ce('0x41')],null))[_0x65ce('0x20')](respondWithResult(_0x22bf4a,null))['catch'](handleError(_0x22bf4a,null));};exports[_0x65ce('0x21')]=function(_0x4e1ec1,_0x1ffb25){return db[_0x65ce('0x27')][_0x65ce('0x3f')]({'where':{'id':_0x4e1ec1[_0x65ce('0x3d')]['id']}})[_0x65ce('0x20')](handleEntityNotFound(_0x1ffb25,null))[_0x65ce('0x20')](removeEntity(_0x1ffb25,null))[_0x65ce('0x3c')](handleError(_0x1ffb25,null));}; \ No newline at end of file +var _0xd008=['type','key','map','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','then','destroy','error','name','send','index','ServicenowField','rawAttributes','fieldName'];(function(_0x4ff5c6,_0x256275){var _0x53f112=function(_0x5310e5){while(--_0x5310e5){_0x4ff5c6['push'](_0x4ff5c6['shift']());}};_0x53f112(++_0x256275);}(_0xd008,0x103));var _0x8d00=function(_0x499db0,_0x216ff9){_0x499db0=_0x499db0-0x0;var _0x55bbdb=_0xd008[_0x499db0];return _0x55bbdb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d00('0x0'));var zipdir=require(_0x8d00('0x1'));var jsonpatch=require(_0x8d00('0x2'));var rp=require(_0x8d00('0x3'));var moment=require('moment');var BPromise=require(_0x8d00('0x4'));var Mustache=require(_0x8d00('0x5'));var util=require('util');var path=require(_0x8d00('0x6'));var sox=require(_0x8d00('0x7'));var csv=require(_0x8d00('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d00('0x9'));var _=require(_0x8d00('0xa'));var squel=require(_0x8d00('0xb'));var crypto=require(_0x8d00('0xc'));var jsforce=require(_0x8d00('0xd'));var deskjs=require(_0x8d00('0xe'));var toCsv=require(_0x8d00('0x8'));var querystring=require(_0x8d00('0xf'));var Papa=require(_0x8d00('0x10'));var Redis=require(_0x8d00('0x11'));var authService=require(_0x8d00('0x12'));var qs=require(_0x8d00('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d00('0x14'));var logger=require(_0x8d00('0x15'))('api');var utils=require(_0x8d00('0x16'));var config=require(_0x8d00('0x17'));var licenseUtil=require(_0x8d00('0x18'));var db=require(_0x8d00('0x19'))['db'];function respondWithStatusCode(_0xe1e2d,_0xcf1876){_0xcf1876=_0xcf1876||0xcc;return function(_0x203625){if(_0x203625){return _0xe1e2d[_0x8d00('0x1a')](_0xcf1876);}return _0xe1e2d[_0x8d00('0x1b')](_0xcf1876)[_0x8d00('0x1c')]();};}function respondWithResult(_0x3432c9,_0x148314){_0x148314=_0x148314||0xc8;return function(_0x1932c1){if(_0x1932c1){return _0x3432c9['status'](_0x148314)[_0x8d00('0x1d')](_0x1932c1);}};}function respondWithFilteredResult(_0x3d0146,_0x51b910){return function(_0x39bc33){if(_0x39bc33){var _0xd16482=typeof _0x51b910[_0x8d00('0x1e')]===_0x8d00('0x1f')&&typeof _0x51b910[_0x8d00('0x20')]===_0x8d00('0x1f');var _0x32b7ac=_0x39bc33['count'];var _0x3e3a1d=_0xd16482?0x0:_0x51b910[_0x8d00('0x1e')];var _0x43d9fd=_0xd16482?_0x39bc33[_0x8d00('0x21')]:_0x51b910[_0x8d00('0x1e')]+_0x51b910['limit'];var _0x3a1552;if(_0x43d9fd>=_0x32b7ac){_0x43d9fd=_0x32b7ac;_0x3a1552=0xc8;}else{_0x3a1552=0xce;}_0x3d0146['status'](_0x3a1552);return _0x3d0146['set']('Content-Range',_0x3e3a1d+'-'+_0x43d9fd+'/'+_0x32b7ac)['json'](_0x39bc33);}return null;};}function patchUpdates(_0x5421f4){return function(_0x423f60){try{jsonpatch[_0x8d00('0x22')](_0x423f60,_0x5421f4,!![]);}catch(_0x1bc6fc){return BPromise['reject'](_0x1bc6fc);}return _0x423f60['save']();};}function saveUpdates(_0x270b06,_0x23cf80){return function(_0x242370){if(_0x242370){return _0x242370[_0x8d00('0x23')](_0x270b06)[_0x8d00('0x24')](function(_0x303262){return _0x303262;});}return null;};}function removeEntity(_0x3d9488,_0x44802e){return function(_0x1fb500){if(_0x1fb500){return _0x1fb500[_0x8d00('0x25')]()['then'](function(){_0x3d9488[_0x8d00('0x1b')](0xcc)[_0x8d00('0x1c')]();});}};}function handleEntityNotFound(_0x562975,_0x420462){return function(_0x5dc569){if(!_0x5dc569){_0x562975['sendStatus'](0x194);}return _0x5dc569;};}function handleError(_0xa41c8e,_0x5e6ea6){_0x5e6ea6=_0x5e6ea6||0x1f4;return function(_0xf656db){logger[_0x8d00('0x26')](_0xf656db['stack']);if(_0xf656db[_0x8d00('0x27')]){delete _0xf656db[_0x8d00('0x27')];}_0xa41c8e['status'](_0x5e6ea6)[_0x8d00('0x28')](_0xf656db);};}exports[_0x8d00('0x29')]=function(_0x6ba5dc,_0x46568c){var _0x2541dd={},_0x45ce2a={},_0x28cd84={'count':0x0,'rows':[]};var _0x466a30=_['map'](db[_0x8d00('0x2a')][_0x8d00('0x2b')],function(_0x4fcb7a){return{'name':_0x4fcb7a[_0x8d00('0x2c')],'type':_0x4fcb7a[_0x8d00('0x2d')][_0x8d00('0x2e')]};});_0x45ce2a['model']=_[_0x8d00('0x2f')](_0x466a30,'name');_0x45ce2a[_0x8d00('0x30')]=_[_0x8d00('0x31')](_0x6ba5dc[_0x8d00('0x30')]);_0x45ce2a['filters']=_['intersection'](_0x45ce2a[_0x8d00('0x32')],_0x45ce2a[_0x8d00('0x30')]);_0x2541dd[_0x8d00('0x33')]=_['intersection'](_0x45ce2a['model'],qs[_0x8d00('0x34')](_0x6ba5dc[_0x8d00('0x30')]['fields']));_0x2541dd[_0x8d00('0x33')]=_0x2541dd[_0x8d00('0x33')][_0x8d00('0x35')]?_0x2541dd[_0x8d00('0x33')]:_0x45ce2a[_0x8d00('0x32')];if(!_0x6ba5dc[_0x8d00('0x30')][_0x8d00('0x36')](_0x8d00('0x37'))){_0x2541dd['limit']=qs[_0x8d00('0x20')](_0x6ba5dc['query'][_0x8d00('0x20')]);_0x2541dd[_0x8d00('0x1e')]=qs[_0x8d00('0x1e')](_0x6ba5dc[_0x8d00('0x30')]['offset']);}_0x2541dd[_0x8d00('0x38')]=qs[_0x8d00('0x39')](_0x6ba5dc[_0x8d00('0x30')][_0x8d00('0x39')]);_0x2541dd[_0x8d00('0x3a')]=qs[_0x8d00('0x3b')](_[_0x8d00('0x3c')](_0x6ba5dc[_0x8d00('0x30')],_0x45ce2a[_0x8d00('0x3b')]),_0x466a30);if(_0x6ba5dc[_0x8d00('0x30')][_0x8d00('0x3d')]){_0x2541dd[_0x8d00('0x3a')]=_['merge'](_0x2541dd[_0x8d00('0x3a')],{'$or':_[_0x8d00('0x2f')](_0x466a30,function(_0x33800c){if(_0x33800c[_0x8d00('0x2d')]!==_0x8d00('0x3e')){var _0x2f3411={};_0x2f3411[_0x33800c[_0x8d00('0x27')]]={'$like':'%'+_0x6ba5dc[_0x8d00('0x30')][_0x8d00('0x3d')]+'%'};return _0x2f3411;}})});}_0x2541dd=_[_0x8d00('0x3f')]({},_0x2541dd,_0x6ba5dc[_0x8d00('0x40')]);var _0x4259a6={'where':_0x2541dd[_0x8d00('0x3a')]};return db['ServicenowField'][_0x8d00('0x21')](_0x4259a6)['then'](function(_0x12a63e){_0x28cd84[_0x8d00('0x21')]=_0x12a63e;if(_0x6ba5dc[_0x8d00('0x30')][_0x8d00('0x41')]){_0x2541dd[_0x8d00('0x42')]=[{'all':!![]}];}return db[_0x8d00('0x2a')][_0x8d00('0x43')](_0x2541dd);})[_0x8d00('0x24')](function(_0x5cdb6b){_0x28cd84[_0x8d00('0x44')]=_0x5cdb6b;return _0x28cd84;})['then'](respondWithFilteredResult(_0x46568c,_0x2541dd))[_0x8d00('0x45')](handleError(_0x46568c,null));};exports[_0x8d00('0x46')]=function(_0x56aaa0,_0x48766d){var _0x3b6979={'raw':!![],'where':{'id':_0x56aaa0[_0x8d00('0x47')]['id']}},_0xb2e558={};_0xb2e558['model']=_[_0x8d00('0x31')](db[_0x8d00('0x2a')][_0x8d00('0x2b')]);_0xb2e558[_0x8d00('0x30')]=_['keys'](_0x56aaa0[_0x8d00('0x30')]);_0xb2e558[_0x8d00('0x3b')]=_[_0x8d00('0x48')](_0xb2e558[_0x8d00('0x32')],_0xb2e558[_0x8d00('0x30')]);_0x3b6979[_0x8d00('0x33')]=_['intersection'](_0xb2e558['model'],qs[_0x8d00('0x34')](_0x56aaa0[_0x8d00('0x30')][_0x8d00('0x34')]));_0x3b6979[_0x8d00('0x33')]=_0x3b6979[_0x8d00('0x33')][_0x8d00('0x35')]?_0x3b6979[_0x8d00('0x33')]:_0xb2e558[_0x8d00('0x32')];if(_0x56aaa0[_0x8d00('0x30')][_0x8d00('0x41')]){_0x3b6979[_0x8d00('0x42')]=[{'all':!![]}];}_0x3b6979=_[_0x8d00('0x3f')]({},_0x3b6979,_0x56aaa0['options']);return db[_0x8d00('0x2a')]['find'](_0x3b6979)['then'](handleEntityNotFound(_0x48766d,null))[_0x8d00('0x24')](respondWithResult(_0x48766d,null))[_0x8d00('0x45')](handleError(_0x48766d,null));};exports[_0x8d00('0x49')]=function(_0x4b567d,_0x3f1683){return db[_0x8d00('0x2a')]['create'](_0x4b567d[_0x8d00('0x4a')],{})[_0x8d00('0x24')](respondWithResult(_0x3f1683,0xc9))[_0x8d00('0x45')](handleError(_0x3f1683,null));};exports['update']=function(_0x43c79b,_0x6aea47){if(_0x43c79b[_0x8d00('0x4a')]['id']){delete _0x43c79b['body']['id'];}return db[_0x8d00('0x2a')][_0x8d00('0x4b')]({'where':{'id':_0x43c79b[_0x8d00('0x47')]['id']}})['then'](handleEntityNotFound(_0x6aea47,null))[_0x8d00('0x24')](saveUpdates(_0x43c79b[_0x8d00('0x4a')],null))[_0x8d00('0x24')](respondWithResult(_0x6aea47,null))['catch'](handleError(_0x6aea47,null));};exports[_0x8d00('0x25')]=function(_0x3c65f3,_0x4384fc){return db[_0x8d00('0x2a')]['find']({'where':{'id':_0x3c65f3[_0x8d00('0x47')]['id']}})['then'](handleEntityNotFound(_0x4384fc,null))[_0x8d00('0x24')](removeEntity(_0x4384fc,null))[_0x8d00('0x45')](handleError(_0x4384fc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 98758f2..5679200 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 _0xe1e0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','api'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xe1e0,0x169));var _0x0e1e=function(_0x9448d2,_0x2c41bb){_0x9448d2=_0x9448d2-0x0;var _0x2e499c=_0xe1e0[_0x9448d2];return _0x2e499c;};'use strict';var _=require(_0x0e1e('0x0'));var util=require(_0x0e1e('0x1'));var logger=require('../../config/logger')(_0x0e1e('0x2'));var moment=require(_0x0e1e('0x3'));var BPromise=require(_0x0e1e('0x4'));var rp=require(_0x0e1e('0x5'));var fs=require('fs');var path=require(_0x0e1e('0x6'));var rimraf=require(_0x0e1e('0x7'));var config=require(_0x0e1e('0x8'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x541a01,_0x417498){return _0x541a01['define'](_0x0e1e('0x9'),attributes,{'tableName':_0x0e1e('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x0e1e('0xb'),_0x0e1e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0347=['./intServicenowField.attributes','ServicenowField','int_servicenow_fields','idField','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x232a42,_0x5c9b1a){var _0x38b2dc=function(_0x41314f){while(--_0x41314f){_0x232a42['push'](_0x232a42['shift']());}};_0x38b2dc(++_0x5c9b1a);}(_0x0347,0x1f0));var _0x7034=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0347[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x7034('0x0'));var logger=require(_0x7034('0x1'))(_0x7034('0x2'));var moment=require(_0x7034('0x3'));var BPromise=require(_0x7034('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7034('0x5'));var rimraf=require(_0x7034('0x6'));var config=require(_0x7034('0x7'));var attributes=require(_0x7034('0x8'));module['exports']=function(_0x5c3c83,_0x381957){return _0x5c3c83['define'](_0x7034('0x9'),attributes,{'tableName':_0x7034('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x7034('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 9b73e58..8e4210d 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1eeca7,_0x40f7e4){var _0x2c7209=function(_0x1c74af){while(--_0x1c74af){_0x1eeca7['push'](_0x1eeca7['shift']());}};_0x2c7209(++_0x40f7e4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb7e7[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x22d927,_0x1fc288){var _0x5422fb=function(_0x2ab415){while(--_0x2ab415){_0x22d927['push'](_0x22d927['shift']());}};_0x5422fb(++_0x1fc288);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xcb91[_0x3cec8c];return _0x38032e;};'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')]('ServicenowField,\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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9d4877b..bccc0fb 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(_0x867b81,_0x1d0d1e){var _0x40445a=function(_0x486852){while(--_0x486852){_0x867b81['push'](_0x867b81['shift']());}};_0x40445a(++_0x1d0d1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x157e5e,_0x179639){var _0x2d692d=function(_0x359fb4){while(--_0x359fb4){_0x157e5e['push'](_0x157e5e['shift']());}};_0x2d692d(++_0x179639);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3308e67..de0ca15 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(_0x15ac30,_0xb3aa72){var _0x3a341a=function(_0x150a71){while(--_0x150a71){_0x15ac30['push'](_0x15ac30['shift']());}};_0x3a341a(++_0xb3aa72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x3af94f,_0x42b4e3){var _0x46cc4b=function(_0x4656c3){while(--_0x4656c3){_0x3af94f['push'](_0x3af94f['shift']());}};_0x46cc4b(++_0x42b4e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 9058350..c3ce8ed 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 _0x28f1=['SugarcrmConfiguration','create','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','show','include','find','catch','body','params','destroy','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions'];(function(_0x56e061,_0x19e774){var _0x433833=function(_0x27dc5f){while(--_0x27dc5f){_0x56e061['push'](_0x56e061['shift']());}};_0x433833(++_0x19e774);}(_0x28f1,0x196));var _0x128f=function(_0x4b99c7,_0x44b1b3){_0x4b99c7=_0x4b99c7-0x0;var _0x5d8f5b=_0x28f1[_0x4b99c7];return _0x5d8f5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x128f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x128f('0x1'));var moment=require(_0x128f('0x2'));var BPromise=require(_0x128f('0x3'));var Mustache=require(_0x128f('0x4'));var util=require(_0x128f('0x5'));var path=require(_0x128f('0x6'));var sox=require(_0x128f('0x7'));var csv=require(_0x128f('0x8'));var ejs=require(_0x128f('0x9'));var fs=require('fs');var fs_extra=require(_0x128f('0xa'));var _=require('lodash');var squel=require(_0x128f('0xb'));var crypto=require(_0x128f('0xc'));var jsforce=require(_0x128f('0xd'));var deskjs=require(_0x128f('0xe'));var toCsv=require(_0x128f('0x8'));var querystring=require(_0x128f('0xf'));var Papa=require('papaparse');var Redis=require(_0x128f('0x10'));var authService=require(_0x128f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x128f('0x12'));var hardwareService=require(_0x128f('0x13'));var logger=require(_0x128f('0x14'))(_0x128f('0x15'));var utils=require(_0x128f('0x16'));var config=require(_0x128f('0x17'));var licenseUtil=require(_0x128f('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x29e524,_0x382adc){_0x382adc=_0x382adc||0xcc;return function(_0x54d4b0){if(_0x54d4b0){return _0x29e524[_0x128f('0x19')](_0x382adc);}return _0x29e524[_0x128f('0x1a')](_0x382adc)[_0x128f('0x1b')]();};}function respondWithResult(_0x3e7349,_0x27e46d){_0x27e46d=_0x27e46d||0xc8;return function(_0x59b397){if(_0x59b397){return _0x3e7349[_0x128f('0x1a')](_0x27e46d)[_0x128f('0x1c')](_0x59b397);}};}function respondWithFilteredResult(_0x381b83,_0x49e8ad){return function(_0x2d6f3d){if(_0x2d6f3d){var _0x1da017=typeof _0x49e8ad[_0x128f('0x1d')]===_0x128f('0x1e')&&typeof _0x49e8ad[_0x128f('0x1f')]===_0x128f('0x1e');var _0x32f788=_0x2d6f3d['count'];var _0x1561a7=_0x1da017?0x0:_0x49e8ad[_0x128f('0x1d')];var _0x28a794=_0x1da017?_0x2d6f3d[_0x128f('0x20')]:_0x49e8ad[_0x128f('0x1d')]+_0x49e8ad[_0x128f('0x1f')];var _0x2a286d;if(_0x28a794>=_0x32f788){_0x28a794=_0x32f788;_0x2a286d=0xc8;}else{_0x2a286d=0xce;}_0x381b83[_0x128f('0x1a')](_0x2a286d);return _0x381b83['set'](_0x128f('0x21'),_0x1561a7+'-'+_0x28a794+'/'+_0x32f788)['json'](_0x2d6f3d);}return null;};}function patchUpdates(_0x209c7f){return function(_0x1351e3){try{jsonpatch[_0x128f('0x22')](_0x1351e3,_0x209c7f,!![]);}catch(_0x587abe){return BPromise[_0x128f('0x23')](_0x587abe);}return _0x1351e3['save']();};}function saveUpdates(_0x16d4bb,_0x5acb54){return function(_0x4cbc7d){if(_0x4cbc7d){return _0x4cbc7d[_0x128f('0x24')](_0x16d4bb)[_0x128f('0x25')](function(_0x4e6b19){return _0x4e6b19;});}return null;};}function removeEntity(_0x1615fe,_0x56066a){return function(_0x5b8d42){if(_0x5b8d42){return _0x5b8d42['destroy']()[_0x128f('0x25')](function(){_0x1615fe[_0x128f('0x1a')](0xcc)[_0x128f('0x1b')]();});}};}function handleEntityNotFound(_0x4b2d2d,_0x2ed282){return function(_0xbf4c12){if(!_0xbf4c12){_0x4b2d2d[_0x128f('0x19')](0x194);}return _0xbf4c12;};}function handleError(_0x233cdb,_0x43f2aa){_0x43f2aa=_0x43f2aa||0x1f4;return function(_0x136fe4){logger[_0x128f('0x26')](_0x136fe4[_0x128f('0x27')]);if(_0x136fe4[_0x128f('0x28')]){delete _0x136fe4[_0x128f('0x28')];}_0x233cdb['status'](_0x43f2aa)[_0x128f('0x29')](_0x136fe4);};}exports['index']=function(_0x34e2fa,_0x5b9807){var _0x54c9bd={},_0x18f252={},_0x3ffa08={'count':0x0,'rows':[]};var _0x5dfb59=_[_0x128f('0x2a')](db[_0x128f('0x2b')][_0x128f('0x2c')],function(_0x28e27c){return{'name':_0x28e27c[_0x128f('0x2d')],'type':_0x28e27c[_0x128f('0x2e')]['key']};});_0x18f252[_0x128f('0x2f')]=_[_0x128f('0x2a')](_0x5dfb59,'name');_0x18f252[_0x128f('0x30')]=_[_0x128f('0x31')](_0x34e2fa[_0x128f('0x30')]);_0x18f252['filters']=_[_0x128f('0x32')](_0x18f252['model'],_0x18f252[_0x128f('0x30')]);_0x54c9bd['attributes']=_[_0x128f('0x32')](_0x18f252['model'],qs['fields'](_0x34e2fa['query'][_0x128f('0x33')]));_0x54c9bd[_0x128f('0x34')]=_0x54c9bd[_0x128f('0x34')][_0x128f('0x35')]?_0x54c9bd[_0x128f('0x34')]:_0x18f252[_0x128f('0x2f')];if(!_0x34e2fa[_0x128f('0x30')][_0x128f('0x36')](_0x128f('0x37'))){_0x54c9bd[_0x128f('0x1f')]=qs['limit'](_0x34e2fa['query'][_0x128f('0x1f')]);_0x54c9bd['offset']=qs[_0x128f('0x1d')](_0x34e2fa[_0x128f('0x30')][_0x128f('0x1d')]);}_0x54c9bd['order']=qs[_0x128f('0x38')](_0x34e2fa[_0x128f('0x30')]['sort']);_0x54c9bd[_0x128f('0x39')]=qs['filters'](_[_0x128f('0x3a')](_0x34e2fa[_0x128f('0x30')],_0x18f252[_0x128f('0x3b')]),_0x5dfb59);if(_0x34e2fa['query'][_0x128f('0x3c')]){_0x54c9bd[_0x128f('0x39')]=_[_0x128f('0x3d')](_0x54c9bd[_0x128f('0x39')],{'$or':_[_0x128f('0x2a')](_0x5dfb59,function(_0xdd7032){if(_0xdd7032[_0x128f('0x2e')]!==_0x128f('0x3e')){var _0x6b55de={};_0x6b55de[_0xdd7032['name']]={'$like':'%'+_0x34e2fa[_0x128f('0x30')][_0x128f('0x3c')]+'%'};return _0x6b55de;}})});}_0x54c9bd=_[_0x128f('0x3d')]({},_0x54c9bd,_0x34e2fa[_0x128f('0x3f')]);var _0x4ff44c={'where':_0x54c9bd[_0x128f('0x39')]};return db['SugarcrmAccount']['count'](_0x4ff44c)['then'](function(_0xe4825){_0x3ffa08[_0x128f('0x20')]=_0xe4825;if(_0x34e2fa[_0x128f('0x30')][_0x128f('0x40')]){_0x54c9bd['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0x128f('0x41')](_0x54c9bd);})['then'](function(_0x4a66c2){_0x3ffa08['rows']=_0x4a66c2;return _0x3ffa08;})[_0x128f('0x25')](respondWithFilteredResult(_0x5b9807,_0x54c9bd))['catch'](handleError(_0x5b9807,null));};exports[_0x128f('0x42')]=function(_0x3d2d6b,_0x198d71){var _0x5c8da3={'raw':![],'where':{'id':_0x3d2d6b['params']['id']}},_0x2fae9e={};_0x2fae9e[_0x128f('0x2f')]=_[_0x128f('0x31')](db[_0x128f('0x2b')][_0x128f('0x2c')]);_0x2fae9e['query']=_[_0x128f('0x31')](_0x3d2d6b[_0x128f('0x30')]);_0x2fae9e[_0x128f('0x3b')]=_['intersection'](_0x2fae9e[_0x128f('0x2f')],_0x2fae9e[_0x128f('0x30')]);_0x5c8da3[_0x128f('0x34')]=_[_0x128f('0x32')](_0x2fae9e[_0x128f('0x2f')],qs[_0x128f('0x33')](_0x3d2d6b['query']['fields']));_0x5c8da3[_0x128f('0x34')]=_0x5c8da3[_0x128f('0x34')][_0x128f('0x35')]?_0x5c8da3['attributes']:_0x2fae9e[_0x128f('0x2f')];if(_0x3d2d6b[_0x128f('0x30')]['includeAll']){_0x5c8da3[_0x128f('0x43')]=[{'all':!![]}];}_0x5c8da3=_[_0x128f('0x3d')]({},_0x5c8da3,_0x3d2d6b[_0x128f('0x3f')]);return db[_0x128f('0x2b')][_0x128f('0x44')](_0x5c8da3)[_0x128f('0x25')](handleEntityNotFound(_0x198d71,null))['then'](respondWithResult(_0x198d71,null))[_0x128f('0x45')](handleError(_0x198d71,null));};exports['create']=function(_0x17fe8b,_0xe6afaa){return db['SugarcrmAccount']['create'](_0x17fe8b[_0x128f('0x46')],{})[_0x128f('0x25')](respondWithResult(_0xe6afaa,0xc9))['catch'](handleError(_0xe6afaa,null));};exports[_0x128f('0x24')]=function(_0x3da7e5,_0x25ebae){if(_0x3da7e5[_0x128f('0x46')]['id']){delete _0x3da7e5['body']['id'];}return db[_0x128f('0x2b')]['find']({'where':{'id':_0x3da7e5[_0x128f('0x47')]['id']}})['then'](handleEntityNotFound(_0x25ebae,null))[_0x128f('0x25')](saveUpdates(_0x3da7e5[_0x128f('0x46')],null))[_0x128f('0x25')](respondWithResult(_0x25ebae,null))[_0x128f('0x45')](handleError(_0x25ebae,null));};exports[_0x128f('0x48')]=function(_0x2f9072,_0x18c38d){return db[_0x128f('0x2b')][_0x128f('0x44')]({'where':{'id':_0x2f9072[_0x128f('0x47')]['id']}})[_0x128f('0x25')](handleEntityNotFound(_0x18c38d,null))['then'](removeEntity(_0x18c38d,null))['catch'](handleError(_0x18c38d,null));};exports[_0x128f('0x49')]=function(_0x2a1e1c,_0x3c6258,_0x5d7b0a){var _0x5161be={};var _0x55f4fb={};var _0x3e9e7d;var _0x22ac49;return db[_0x128f('0x2b')][_0x128f('0x4a')]({'where':{'id':_0x2a1e1c['params']['id']}})[_0x128f('0x25')](handleEntityNotFound(_0x3c6258,null))[_0x128f('0x25')](function(_0x3f07e0){if(_0x3f07e0){_0x3e9e7d=_0x3f07e0;_0x55f4fb[_0x128f('0x2f')]=_[_0x128f('0x31')](db['SugarcrmConfiguration']['rawAttributes']);_0x55f4fb[_0x128f('0x30')]=_[_0x128f('0x31')](_0x2a1e1c[_0x128f('0x30')]);_0x55f4fb['filters']=_[_0x128f('0x32')](_0x55f4fb['model'],_0x55f4fb[_0x128f('0x30')]);_0x5161be[_0x128f('0x34')]=_['intersection'](_0x55f4fb[_0x128f('0x2f')],qs['fields'](_0x2a1e1c['query'][_0x128f('0x33')]));_0x5161be[_0x128f('0x34')]=_0x5161be[_0x128f('0x34')][_0x128f('0x35')]?_0x5161be[_0x128f('0x34')]:_0x55f4fb[_0x128f('0x2f')];_0x5161be[_0x128f('0x4b')]=qs[_0x128f('0x38')](_0x2a1e1c[_0x128f('0x30')]['sort']);_0x5161be['where']=qs[_0x128f('0x3b')](_[_0x128f('0x3a')](_0x2a1e1c[_0x128f('0x30')],_0x55f4fb[_0x128f('0x3b')]));if(_0x2a1e1c[_0x128f('0x30')][_0x128f('0x3c')]){_0x5161be[_0x128f('0x39')]=_[_0x128f('0x3d')](_0x5161be[_0x128f('0x39')],{'$or':_['map'](_0x5161be['attributes'],function(_0x52a76c){var _0x3efc26={};_0x3efc26[_0x52a76c]={'$like':'%'+_0x2a1e1c[_0x128f('0x30')][_0x128f('0x3c')]+'%'};return _0x3efc26;})});}_0x5161be=_[_0x128f('0x3d')]({},_0x5161be,_0x2a1e1c[_0x128f('0x3f')]);return _0x3e9e7d[_0x128f('0x49')](_0x5161be);}})[_0x128f('0x25')](function(_0x22d310){if(_0x22d310){_0x22ac49=_0x22d310[_0x128f('0x35')];if(!_0x2a1e1c[_0x128f('0x30')][_0x128f('0x36')]('nolimit')){_0x5161be[_0x128f('0x1f')]=qs[_0x128f('0x1f')](_0x2a1e1c[_0x128f('0x30')][_0x128f('0x1f')]);_0x5161be[_0x128f('0x1d')]=qs[_0x128f('0x1d')](_0x2a1e1c['query']['offset']);}return _0x3e9e7d['getConfigurations'](_0x5161be);}})['then'](function(_0x3d6c86){if(_0x3d6c86){return _0x3d6c86?{'count':_0x22ac49,'rows':_0x3d6c86}:null;}})[_0x128f('0x25')](respondWithResult(_0x3c6258,null))[_0x128f('0x45')](handleError(_0x3c6258,null));};exports[_0x128f('0x4c')]=function(_0x42b2f6,_0x23e55b,_0x341be0){if(_0x42b2f6[_0x128f('0x46')]['id']){delete _0x42b2f6[_0x128f('0x46')]['id'];}return db['SugarcrmAccount'][_0x128f('0x4a')]({'where':{'id':_0x42b2f6[_0x128f('0x47')]['id']}})[_0x128f('0x25')](handleEntityNotFound(_0x23e55b,null))[_0x128f('0x25')](function(_0xaec81c){if(_0xaec81c){_0x42b2f6[_0x128f('0x46')][_0x128f('0x4d')]=_0xaec81c['id'];_0x42b2f6['body'][_0x128f('0x4e')]=integrations['getSubjects'](_0x42b2f6[_0x128f('0x46')][_0x128f('0x4f')],_0x42b2f6['body'][_0x128f('0x2e')]);_0x42b2f6[_0x128f('0x46')][_0x128f('0x50')]=integrations[_0x128f('0x51')](_0x42b2f6['body']['channel'],_0x42b2f6['body'][_0x128f('0x2e')]);return db[_0x128f('0x52')][_0x128f('0x53')](_0x42b2f6[_0x128f('0x46')],{'include':[{'model':db['SugarcrmField'],'as':_0x128f('0x4e')},{'model':db['SugarcrmField'],'as':_0x128f('0x50')}]});}return null;})['then'](respondWithResult(_0x23e55b,null))[_0x128f('0x45')](handleError(_0x23e55b,null));};exports[_0x128f('0x54')]=function(_0x4501fc,_0x4c1fe3,_0x46aa2c){var _0x302fb4='';var _0x20f0aa=['id','name',_0x128f('0x55'),'created_by',_0x128f('0x56'),_0x128f('0x57'),_0x128f('0x58'),_0x128f('0x59'),_0x128f('0x5a'),_0x128f('0x5b'),_0x128f('0x5c'),_0x128f('0x5d')];return db[_0x128f('0x2b')]['findOne']({'where':{'id':_0x4501fc[_0x128f('0x47')]['id']},'attributes':['id',_0x128f('0x5e'),_0x128f('0x5f'),_0x128f('0x60')]})[_0x128f('0x25')](handleEntityNotFound(_0x4c1fe3,null))[_0x128f('0x25')](function(_0x574fee){if(_0x574fee){_0x302fb4=_0x574fee[_0x128f('0x60')];var _0x5610eb=_0x302fb4[_0x128f('0x61')](-0x1);if(_0x5610eb==='/'){_0x302fb4=_0x302fb4[_0x128f('0x62')](0x0,_0x302fb4[_0x128f('0x63')](_0x5610eb));}return rp({'method':_0x128f('0x64'),'uri':util[_0x128f('0x65')](_0x128f('0x66'),_0x302fb4,_0x128f('0x67')),'json':!![],'form':{'method':_0x128f('0x68'),'input_type':_0x128f('0x69'),'response_type':'JSON','rest_data':JSON[_0x128f('0x6a')]({'user_auth':{'user_name':_0x574fee['username'],'password':_0x574fee[_0x128f('0x5f')],'encryption':_0x128f('0x6b')},'application':_0x128f('0x6c')})}});}})['then'](function(_0x5651f0){if(_0x5651f0&&_0x5651f0['name']!==_0x128f('0x6d')&&_0x5651f0[_0x128f('0x28')]!==_0x128f('0x6e')){return rp({'method':_0x128f('0x64'),'uri':util[_0x128f('0x65')](_0x128f('0x66'),_0x302fb4,_0x128f('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x128f('0x69'),'response_type':_0x128f('0x69'),'rest_data':JSON[_0x128f('0x6a')]({'session':_0x5651f0['id'],'module_name':_0x128f('0x6f')})}})[_0x128f('0x25')](function(_0x72d200){if(_0x72d200){var _0x96c339=_[_0x128f('0x70')](_0x72d200[_0x128f('0x71')]);_[_0x128f('0x72')](_0x96c339,function(_0x28d198){return _0x20f0aa[_0x128f('0x73')](_0x28d198[_0x128f('0x28')]);});return{'count':_0x96c339[_0x128f('0x35')],'rows':_['map'](_0x96c339,function(_0x16d563){return{'id':_0x16d563[_0x128f('0x28')],'name':_0x16d563['label'],'custom':_[_0x128f('0x74')](_0x16d563[_0x128f('0x28')],'_c')?!![]:![],'options':_0x16d563[_0x128f('0x3f')]?_[_0x128f('0x2a')](_['values'](_0x16d563[_0x128f('0x3f')]),function(_0x18439c){return{'name':_0x18439c[_0x128f('0x75')],'value':_0x18439c['name']};}):[]};})};}})[_0x128f('0x25')](respondWithResult(_0x4c1fe3,null))['catch'](function(_0x178c2a){var _0x1c9d19=_0x4501fc[_0x128f('0x30')][_0x128f('0x76')]?0x1f4:_0x178c2a['statusCode']||0x1f4;logger[_0x128f('0x26')](_0x128f('0x77'),_0x128f('0x54'),_0x1c9d19,JSON[_0x128f('0x6a')](_0x178c2a));delete _0x178c2a[_0x128f('0x28')];if(_0x1c9d19===0x191){_0x1c9d19=0x190;}_0x4c1fe3[_0x128f('0x1a')](_0x1c9d19)[_0x128f('0x29')](_0x4501fc[_0x128f('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x178c2a[_0x128f('0x78')]}:_0x178c2a);});}else{var _0x3092b5=0x1f4;_0x4c1fe3[_0x128f('0x1a')](_0x3092b5)[_0x128f('0x29')]({'message':_0x128f('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x41d8=['Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','fieldName','type','model','keys','query','filters','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','SugarcrmAccount','rawAttributes','intersection','create','body','find','params','getConfigurations','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_type','direction','findOne','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','test'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x41d8,0xed));var _0x841d=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x41d8[_0x3c22e0];return _0x215811;};'use strict';var emlformat=require(_0x841d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x841d('0x1'));var jsonpatch=require(_0x841d('0x2'));var rp=require(_0x841d('0x3'));var moment=require(_0x841d('0x4'));var BPromise=require(_0x841d('0x5'));var Mustache=require(_0x841d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x841d('0x7'));var csv=require(_0x841d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x841d('0x9'));var _=require(_0x841d('0xa'));var squel=require(_0x841d('0xb'));var crypto=require(_0x841d('0xc'));var jsforce=require(_0x841d('0xd'));var deskjs=require(_0x841d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x841d('0xf'));var Papa=require('papaparse');var Redis=require(_0x841d('0x10'));var authService=require(_0x841d('0x11'));var qs=require(_0x841d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x841d('0x13'))(_0x841d('0x14'));var utils=require('../../config/utils');var config=require(_0x841d('0x15'));var licenseUtil=require(_0x841d('0x16'));var db=require(_0x841d('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2f19d3,_0x3a9f8e){_0x3a9f8e=_0x3a9f8e||0xcc;return function(_0x45e7b5){if(_0x45e7b5){return _0x2f19d3[_0x841d('0x18')](_0x3a9f8e);}return _0x2f19d3[_0x841d('0x19')](_0x3a9f8e)['end']();};}function respondWithResult(_0xdbb836,_0xc866ac){_0xc866ac=_0xc866ac||0xc8;return function(_0x149e63){if(_0x149e63){return _0xdbb836['status'](_0xc866ac)[_0x841d('0x1a')](_0x149e63);}};}function respondWithFilteredResult(_0x165d6f,_0x4de9aa){return function(_0x4b25d8){if(_0x4b25d8){var _0x3d250e=typeof _0x4de9aa[_0x841d('0x1b')]==='undefined'&&typeof _0x4de9aa[_0x841d('0x1c')]==='undefined';var _0x1557ee=_0x4b25d8[_0x841d('0x1d')];var _0x2972c9=_0x3d250e?0x0:_0x4de9aa[_0x841d('0x1b')];var _0x2e5630=_0x3d250e?_0x4b25d8[_0x841d('0x1d')]:_0x4de9aa[_0x841d('0x1b')]+_0x4de9aa['limit'];var _0x543250;if(_0x2e5630>=_0x1557ee){_0x2e5630=_0x1557ee;_0x543250=0xc8;}else{_0x543250=0xce;}_0x165d6f[_0x841d('0x19')](_0x543250);return _0x165d6f[_0x841d('0x1e')](_0x841d('0x1f'),_0x2972c9+'-'+_0x2e5630+'/'+_0x1557ee)[_0x841d('0x1a')](_0x4b25d8);}return null;};}function patchUpdates(_0x466382){return function(_0x2ea791){try{jsonpatch[_0x841d('0x20')](_0x2ea791,_0x466382,!![]);}catch(_0x4b9b16){return BPromise[_0x841d('0x21')](_0x4b9b16);}return _0x2ea791['save']();};}function saveUpdates(_0x331577,_0x18e225){return function(_0x33001c){if(_0x33001c){return _0x33001c[_0x841d('0x22')](_0x331577)[_0x841d('0x23')](function(_0x5b727c){return _0x5b727c;});}return null;};}function removeEntity(_0x4b905f,_0x4005d9){return function(_0x303a9b){if(_0x303a9b){return _0x303a9b[_0x841d('0x24')]()[_0x841d('0x23')](function(){_0x4b905f[_0x841d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x193bd3,_0x1151cb){return function(_0x171f2b){if(!_0x171f2b){_0x193bd3[_0x841d('0x18')](0x194);}return _0x171f2b;};}function handleError(_0x82e139,_0x149c9e){_0x149c9e=_0x149c9e||0x1f4;return function(_0x566f43){logger['error'](_0x566f43[_0x841d('0x25')]);if(_0x566f43[_0x841d('0x26')]){delete _0x566f43['name'];}_0x82e139[_0x841d('0x19')](_0x149c9e)[_0x841d('0x27')](_0x566f43);};}exports[_0x841d('0x28')]=function(_0x3f452d,_0x31271a){var _0x5ab7e6={},_0x3ec158={},_0x28abb4={'count':0x0,'rows':[]};var _0x57ec81=_[_0x841d('0x29')](db['SugarcrmAccount']['rawAttributes'],function(_0x53fad3){return{'name':_0x53fad3[_0x841d('0x2a')],'type':_0x53fad3[_0x841d('0x2b')]['key']};});_0x3ec158[_0x841d('0x2c')]=_[_0x841d('0x29')](_0x57ec81,_0x841d('0x26'));_0x3ec158['query']=_[_0x841d('0x2d')](_0x3f452d[_0x841d('0x2e')]);_0x3ec158[_0x841d('0x2f')]=_['intersection'](_0x3ec158[_0x841d('0x2c')],_0x3ec158[_0x841d('0x2e')]);_0x5ab7e6['attributes']=_['intersection'](_0x3ec158[_0x841d('0x2c')],qs[_0x841d('0x30')](_0x3f452d[_0x841d('0x2e')][_0x841d('0x30')]));_0x5ab7e6[_0x841d('0x31')]=_0x5ab7e6['attributes'][_0x841d('0x32')]?_0x5ab7e6[_0x841d('0x31')]:_0x3ec158['model'];if(!_0x3f452d[_0x841d('0x2e')][_0x841d('0x33')]('nolimit')){_0x5ab7e6[_0x841d('0x1c')]=qs[_0x841d('0x1c')](_0x3f452d[_0x841d('0x2e')][_0x841d('0x1c')]);_0x5ab7e6['offset']=qs['offset'](_0x3f452d['query']['offset']);}_0x5ab7e6['order']=qs[_0x841d('0x34')](_0x3f452d[_0x841d('0x2e')][_0x841d('0x34')]);_0x5ab7e6['where']=qs[_0x841d('0x2f')](_[_0x841d('0x35')](_0x3f452d[_0x841d('0x2e')],_0x3ec158[_0x841d('0x2f')]),_0x57ec81);if(_0x3f452d[_0x841d('0x2e')][_0x841d('0x36')]){_0x5ab7e6[_0x841d('0x37')]=_[_0x841d('0x38')](_0x5ab7e6['where'],{'$or':_[_0x841d('0x29')](_0x57ec81,function(_0x21ed80){if(_0x21ed80[_0x841d('0x2b')]!==_0x841d('0x39')){var _0x4b3c46={};_0x4b3c46[_0x21ed80[_0x841d('0x26')]]={'$like':'%'+_0x3f452d['query'][_0x841d('0x36')]+'%'};return _0x4b3c46;}})});}_0x5ab7e6=_[_0x841d('0x38')]({},_0x5ab7e6,_0x3f452d[_0x841d('0x3a')]);var _0x5182d0={'where':_0x5ab7e6[_0x841d('0x37')]};return db['SugarcrmAccount'][_0x841d('0x1d')](_0x5182d0)[_0x841d('0x23')](function(_0x1e35e5){_0x28abb4[_0x841d('0x1d')]=_0x1e35e5;if(_0x3f452d[_0x841d('0x2e')][_0x841d('0x3b')]){_0x5ab7e6[_0x841d('0x3c')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x841d('0x3d')](_0x5ab7e6);})['then'](function(_0xf61427){_0x28abb4['rows']=_0xf61427;return _0x28abb4;})[_0x841d('0x23')](respondWithFilteredResult(_0x31271a,_0x5ab7e6))[_0x841d('0x3e')](handleError(_0x31271a,null));};exports[_0x841d('0x3f')]=function(_0x356191,_0xa1dcee){var _0x88a6b7={'raw':![],'where':{'id':_0x356191['params']['id']}},_0x5c0821={};_0x5c0821[_0x841d('0x2c')]=_['keys'](db[_0x841d('0x40')][_0x841d('0x41')]);_0x5c0821[_0x841d('0x2e')]=_['keys'](_0x356191[_0x841d('0x2e')]);_0x5c0821['filters']=_[_0x841d('0x42')](_0x5c0821[_0x841d('0x2c')],_0x5c0821[_0x841d('0x2e')]);_0x88a6b7['attributes']=_['intersection'](_0x5c0821[_0x841d('0x2c')],qs['fields'](_0x356191[_0x841d('0x2e')]['fields']));_0x88a6b7['attributes']=_0x88a6b7['attributes'][_0x841d('0x32')]?_0x88a6b7['attributes']:_0x5c0821['model'];if(_0x356191['query'][_0x841d('0x3b')]){_0x88a6b7['include']=[{'all':!![]}];}_0x88a6b7=_[_0x841d('0x38')]({},_0x88a6b7,_0x356191[_0x841d('0x3a')]);return db[_0x841d('0x40')]['find'](_0x88a6b7)[_0x841d('0x23')](handleEntityNotFound(_0xa1dcee,null))[_0x841d('0x23')](respondWithResult(_0xa1dcee,null))[_0x841d('0x3e')](handleError(_0xa1dcee,null));};exports[_0x841d('0x43')]=function(_0x338f1f,_0x9d4d1d){return db[_0x841d('0x40')][_0x841d('0x43')](_0x338f1f['body'],{})[_0x841d('0x23')](respondWithResult(_0x9d4d1d,0xc9))[_0x841d('0x3e')](handleError(_0x9d4d1d,null));};exports[_0x841d('0x22')]=function(_0x4ef8f3,_0x34b96b){if(_0x4ef8f3[_0x841d('0x44')]['id']){delete _0x4ef8f3[_0x841d('0x44')]['id'];}return db['SugarcrmAccount'][_0x841d('0x45')]({'where':{'id':_0x4ef8f3[_0x841d('0x46')]['id']}})[_0x841d('0x23')](handleEntityNotFound(_0x34b96b,null))['then'](saveUpdates(_0x4ef8f3[_0x841d('0x44')],null))[_0x841d('0x23')](respondWithResult(_0x34b96b,null))[_0x841d('0x3e')](handleError(_0x34b96b,null));};exports[_0x841d('0x24')]=function(_0x4e75b6,_0x277c23){return db[_0x841d('0x40')][_0x841d('0x45')]({'where':{'id':_0x4e75b6[_0x841d('0x46')]['id']}})[_0x841d('0x23')](handleEntityNotFound(_0x277c23,null))['then'](removeEntity(_0x277c23,null))[_0x841d('0x3e')](handleError(_0x277c23,null));};exports[_0x841d('0x47')]=function(_0xb79813,_0x258e28,_0x3e7604){var _0x303587={};var _0x48cc87={};var _0x146525;var _0x4e8069;return db[_0x841d('0x40')]['findOne']({'where':{'id':_0xb79813[_0x841d('0x46')]['id']}})[_0x841d('0x23')](handleEntityNotFound(_0x258e28,null))['then'](function(_0x4c1ee6){if(_0x4c1ee6){_0x146525=_0x4c1ee6;_0x48cc87[_0x841d('0x2c')]=_[_0x841d('0x2d')](db['SugarcrmConfiguration'][_0x841d('0x41')]);_0x48cc87['query']=_[_0x841d('0x2d')](_0xb79813[_0x841d('0x2e')]);_0x48cc87[_0x841d('0x2f')]=_[_0x841d('0x42')](_0x48cc87[_0x841d('0x2c')],_0x48cc87[_0x841d('0x2e')]);_0x303587['attributes']=_['intersection'](_0x48cc87[_0x841d('0x2c')],qs['fields'](_0xb79813[_0x841d('0x2e')][_0x841d('0x30')]));_0x303587['attributes']=_0x303587['attributes'][_0x841d('0x32')]?_0x303587[_0x841d('0x31')]:_0x48cc87['model'];_0x303587[_0x841d('0x48')]=qs[_0x841d('0x34')](_0xb79813[_0x841d('0x2e')][_0x841d('0x34')]);_0x303587['where']=qs[_0x841d('0x2f')](_[_0x841d('0x35')](_0xb79813[_0x841d('0x2e')],_0x48cc87[_0x841d('0x2f')]));if(_0xb79813['query'][_0x841d('0x36')]){_0x303587[_0x841d('0x37')]=_[_0x841d('0x38')](_0x303587[_0x841d('0x37')],{'$or':_[_0x841d('0x29')](_0x303587[_0x841d('0x31')],function(_0x75625d){var _0x3f7b7c={};_0x3f7b7c[_0x75625d]={'$like':'%'+_0xb79813[_0x841d('0x2e')]['filter']+'%'};return _0x3f7b7c;})});}_0x303587=_['merge']({},_0x303587,_0xb79813['options']);return _0x146525['getConfigurations'](_0x303587);}})[_0x841d('0x23')](function(_0x590080){if(_0x590080){_0x4e8069=_0x590080[_0x841d('0x32')];if(!_0xb79813[_0x841d('0x2e')][_0x841d('0x33')](_0x841d('0x49'))){_0x303587[_0x841d('0x1c')]=qs[_0x841d('0x1c')](_0xb79813[_0x841d('0x2e')][_0x841d('0x1c')]);_0x303587[_0x841d('0x1b')]=qs['offset'](_0xb79813['query'][_0x841d('0x1b')]);}return _0x146525[_0x841d('0x47')](_0x303587);}})[_0x841d('0x23')](function(_0x260987){if(_0x260987){return _0x260987?{'count':_0x4e8069,'rows':_0x260987}:null;}})['then'](respondWithResult(_0x258e28,null))[_0x841d('0x3e')](handleError(_0x258e28,null));};exports[_0x841d('0x4a')]=function(_0x17f5fc,_0x291a46,_0x14a206){if(_0x17f5fc['body']['id']){delete _0x17f5fc['body']['id'];}return db[_0x841d('0x40')]['findOne']({'where':{'id':_0x17f5fc['params']['id']}})[_0x841d('0x23')](handleEntityNotFound(_0x291a46,null))[_0x841d('0x23')](function(_0x24e135){if(_0x24e135){_0x17f5fc[_0x841d('0x44')][_0x841d('0x4b')]=_0x24e135['id'];_0x17f5fc[_0x841d('0x44')][_0x841d('0x4c')]=integrations[_0x841d('0x4d')](_0x17f5fc[_0x841d('0x44')][_0x841d('0x4e')],_0x17f5fc[_0x841d('0x44')]['type']);_0x17f5fc['body'][_0x841d('0x4f')]=integrations[_0x841d('0x50')](_0x17f5fc['body'][_0x841d('0x4e')],_0x17f5fc[_0x841d('0x44')][_0x841d('0x2b')]);return db['SugarcrmConfiguration'][_0x841d('0x43')](_0x17f5fc['body'],{'include':[{'model':db[_0x841d('0x51')],'as':_0x841d('0x4c')},{'model':db[_0x841d('0x51')],'as':_0x841d('0x4f')}]});}return null;})[_0x841d('0x23')](respondWithResult(_0x291a46,null))['catch'](handleError(_0x291a46,null));};exports[_0x841d('0x52')]=function(_0x147c79,_0xc11ce9,_0xc0d3ac){var _0x37ebe2='';var _0x232488=['id',_0x841d('0x26'),_0x841d('0x53'),_0x841d('0x54'),_0x841d('0x55'),_0x841d('0x56'),'duration_hours',_0x841d('0x57'),'parent_id',_0x841d('0x58'),'parent_name',_0x841d('0x59')];return db['SugarcrmAccount'][_0x841d('0x5a')]({'where':{'id':_0x147c79[_0x841d('0x46')]['id']},'attributes':['id','username',_0x841d('0x5b'),_0x841d('0x5c')]})['then'](handleEntityNotFound(_0xc11ce9,null))[_0x841d('0x23')](function(_0x20167a){if(_0x20167a){_0x37ebe2=_0x20167a[_0x841d('0x5c')];var _0x56d887=_0x37ebe2['slice'](-0x1);if(_0x56d887==='/'){_0x37ebe2=_0x37ebe2[_0x841d('0x5d')](0x0,_0x37ebe2[_0x841d('0x5e')](_0x56d887));}return rp({'method':_0x841d('0x5f'),'uri':util[_0x841d('0x60')](_0x841d('0x61'),_0x37ebe2,_0x841d('0x62')),'json':!![],'form':{'method':_0x841d('0x63'),'input_type':_0x841d('0x64'),'response_type':'JSON','rest_data':JSON[_0x841d('0x65')]({'user_auth':{'user_name':_0x20167a['username'],'password':_0x20167a['password'],'encryption':_0x841d('0x66')},'application':_0x841d('0x67')})}});}})[_0x841d('0x23')](function(_0x5fdb6a){if(_0x5fdb6a&&_0x5fdb6a['name']!=='Invalid\x20Login'&&_0x5fdb6a[_0x841d('0x26')]!==_0x841d('0x68')){return rp({'method':_0x841d('0x5f'),'uri':util[_0x841d('0x60')](_0x841d('0x61'),_0x37ebe2,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x841d('0x69'),'input_type':_0x841d('0x64'),'response_type':_0x841d('0x64'),'rest_data':JSON[_0x841d('0x65')]({'session':_0x5fdb6a['id'],'module_name':_0x841d('0x6a')})}})[_0x841d('0x23')](function(_0x51a802){if(_0x51a802){var _0x2c96b2=_[_0x841d('0x6b')](_0x51a802[_0x841d('0x6c')]);_[_0x841d('0x6d')](_0x2c96b2,function(_0x4210a4){return _0x232488[_0x841d('0x6e')](_0x4210a4['name']);});return{'count':_0x2c96b2['length'],'rows':_[_0x841d('0x29')](_0x2c96b2,function(_0x143a2c){return{'id':_0x143a2c[_0x841d('0x26')],'name':_0x143a2c[_0x841d('0x6f')],'custom':_[_0x841d('0x70')](_0x143a2c[_0x841d('0x26')],'_c')?!![]:![],'options':_0x143a2c[_0x841d('0x3a')]?_['map'](_[_0x841d('0x6b')](_0x143a2c[_0x841d('0x3a')]),function(_0x282fbf){return{'name':_0x282fbf['value'],'value':_0x282fbf[_0x841d('0x26')]};}):[]};})};}})[_0x841d('0x23')](respondWithResult(_0xc11ce9,null))[_0x841d('0x3e')](function(_0x19661c){var _0x14c71d=_0x147c79[_0x841d('0x2e')]['test']?0x1f4:_0x19661c[_0x841d('0x71')]||0x1f4;logger[_0x841d('0x72')](_0x841d('0x73'),_0x841d('0x52'),_0x14c71d,JSON[_0x841d('0x65')](_0x19661c));delete _0x19661c['name'];if(_0x14c71d===0x191){_0x14c71d=0x190;}_0xc11ce9[_0x841d('0x19')](_0x14c71d)['send'](_0x147c79['query'][_0x841d('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x19661c[_0x841d('0x71')]}:_0x19661c);});}else{var _0x3afd7b=0x1f4;_0xc11ce9[_0x841d('0x19')](_0x3afd7b)[_0x841d('0x27')]({'message':_0x841d('0x75'),'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 4d21d62..702ea0e 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 _0x151b=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','path','./intSugarcrmAccount.attributes'];(function(_0x566865,_0xad743b){var _0xf86a5d=function(_0x59d49f){while(--_0x59d49f){_0x566865['push'](_0x566865['shift']());}};_0xf86a5d(++_0xad743b);}(_0x151b,0x149));var _0xb151=function(_0x5adf01,_0x5049c0){_0x5adf01=_0x5adf01-0x0;var _0x40ab25=_0x151b[_0x5adf01];return _0x40ab25;};'use strict';var _=require(_0xb151('0x0'));var util=require(_0xb151('0x1'));var logger=require(_0xb151('0x2'))('api');var moment=require(_0xb151('0x3'));var BPromise=require(_0xb151('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb151('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb151('0x6'));var integrations=require(_0xb151('0x7'));module[_0xb151('0x8')]=function(_0x45ed62,_0x227611){return _0x45ed62[_0xb151('0x9')](_0xb151('0xa'),attributes,{'tableName':_0xb151('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf503=['moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api'];(function(_0x37cfee,_0x1ddc2e){var _0x1de0a1=function(_0x2a44ab){while(--_0x2a44ab){_0x37cfee['push'](_0x37cfee['shift']());}};_0x1de0a1(++_0x1ddc2e);}(_0xf503,0x11a));var _0x3f50=function(_0x14914a,_0x3eae81){_0x14914a=_0x14914a-0x0;var _0x3766ec=_0xf503[_0x14914a];return _0x3766ec;};'use strict';var _=require(_0x3f50('0x0'));var util=require(_0x3f50('0x1'));var logger=require(_0x3f50('0x2'))(_0x3f50('0x3'));var moment=require(_0x3f50('0x4'));var BPromise=require(_0x3f50('0x5'));var rp=require(_0x3f50('0x6'));var fs=require('fs');var path=require(_0x3f50('0x7'));var rimraf=require('rimraf');var config=require(_0x3f50('0x8'));var attributes=require(_0x3f50('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4afb1a,_0x1291b7){return _0x4afb1a[_0x3f50('0xa')](_0x3f50('0xb'),attributes,{'tableName':_0x3f50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 2b0bdb4..16bfe90 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 _0x0c00=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','include','map','model','stringify','find','where','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x8cb9a1,_0x27c769){var _0x3b7a07=function(_0x5a4eaa){while(--_0x5a4eaa){_0x8cb9a1['push'](_0x8cb9a1['shift']());}};_0x3b7a07(++_0x27c769);}(_0x0c00,0x1be));var _0x00c0=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0c00[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x00c0('0x0'));var util=require(_0x00c0('0x1'));var moment=require(_0x00c0('0x2'));var BPromise=require(_0x00c0('0x3'));var rs=require(_0x00c0('0x4'));var fs=require('fs');var Redis=require(_0x00c0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x00c0('0x6'));var logger=require(_0x00c0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x00c0('0x8'));var client=jayson['client'][_0x00c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5da5bb,_0x254dd2,_0x11625b){return new BPromise(function(_0x2cc2b9,_0x1de16e){return client[_0x00c0('0xa')](_0x5da5bb,_0x11625b)[_0x00c0('0xb')](function(_0x44fdc6){logger[_0x00c0('0xc')](_0x00c0('0xd'),_0x254dd2,_0x00c0('0xe'));logger[_0x00c0('0xf')](_0x00c0('0x10'),_0x254dd2,'request\x20sent',JSON['stringify'](_0x44fdc6));if(_0x44fdc6[_0x00c0('0x11')]){if(_0x44fdc6['error'][_0x00c0('0x12')]===0x1f4){logger[_0x00c0('0x11')](_0x00c0('0xd'),_0x254dd2,_0x44fdc6['error'][_0x00c0('0x13')]);return _0x1de16e(_0x44fdc6['error'][_0x00c0('0x13')]);}logger['error'](_0x00c0('0xd'),_0x254dd2,_0x44fdc6['error'][_0x00c0('0x13')]);return _0x2cc2b9(_0x44fdc6[_0x00c0('0x11')][_0x00c0('0x13')]);}else{logger['info'](_0x00c0('0xd'),_0x254dd2,'request\x20sent');_0x2cc2b9(_0x44fdc6['result'][_0x00c0('0x13')]);}})[_0x00c0('0x14')](function(_0x11f145){logger[_0x00c0('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x254dd2,_0x11f145);_0x1de16e(_0x11f145);});});}exports[_0x00c0('0x15')]=function(_0x308400){var _0x2ef2e3=this;return new Promise(function(_0x3c8221,_0x3ad8b4){return db[_0x00c0('0x16')]['findAll']({'raw':_0x308400[_0x00c0('0x17')]?_0x308400['options'][_0x00c0('0x18')]===undefined?!![]:![]:!![],'where':_0x308400[_0x00c0('0x17')]?_0x308400[_0x00c0('0x17')]['where']||null:null,'attributes':_0x308400[_0x00c0('0x17')]?_0x308400[_0x00c0('0x17')][_0x00c0('0x19')]||null:null,'limit':_0x308400[_0x00c0('0x17')]?_0x308400[_0x00c0('0x17')]['limit']||null:null,'include':_0x308400['options']?_0x308400[_0x00c0('0x17')][_0x00c0('0x1a')]?_[_0x00c0('0x1b')](_0x308400[_0x00c0('0x17')][_0x00c0('0x1a')],function(_0x27bd0e){return{'model':db[_0x27bd0e[_0x00c0('0x1c')]],'as':_0x27bd0e['as'],'attributes':_0x27bd0e[_0x00c0('0x19')],'include':_0x27bd0e[_0x00c0('0x1a')]?_[_0x00c0('0x1b')](_0x27bd0e[_0x00c0('0x1a')],function(_0x1565a9){return{'model':db[_0x1565a9[_0x00c0('0x1c')]],'as':_0x1565a9['as'],'attributes':_0x1565a9[_0x00c0('0x19')],'include':_0x1565a9['include']?_['map'](_0x1565a9[_0x00c0('0x1a')],function(_0x5a900c){return{'model':db[_0x5a900c['model']],'as':_0x5a900c['as'],'attributes':_0x5a900c[_0x00c0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x00c0('0xb')](function(_0x3072f5){logger[_0x00c0('0xc')](_0x00c0('0x15'),_0x308400);logger['debug']('GetSugarcrmAccount',_0x308400,JSON[_0x00c0('0x1d')](_0x3072f5));_0x3c8221(_0x3072f5);})[_0x00c0('0x14')](function(_0xaf1d52){logger['error'](_0x00c0('0x15'),_0xaf1d52[_0x00c0('0x13')],_0x308400);_0x3ad8b4(_0x2ef2e3[_0x00c0('0x11')](0x1f4,_0xaf1d52[_0x00c0('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x4f90de){var _0x2bd759=this;return new Promise(function(_0x4b8722,_0x25657d){return db['SugarcrmAccount'][_0x00c0('0x1e')]({'raw':_0x4f90de['options']?_0x4f90de[_0x00c0('0x17')][_0x00c0('0x18')]===undefined?!![]:![]:!![],'where':_0x4f90de[_0x00c0('0x17')]?_0x4f90de[_0x00c0('0x17')][_0x00c0('0x1f')]||null:null,'attributes':_0x4f90de[_0x00c0('0x17')]?_0x4f90de[_0x00c0('0x17')][_0x00c0('0x19')]||null:null,'include':_0x4f90de[_0x00c0('0x17')]?_0x4f90de[_0x00c0('0x17')][_0x00c0('0x1a')]?_[_0x00c0('0x1b')](_0x4f90de['options'][_0x00c0('0x1a')],function(_0x436eaa){return{'model':db[_0x436eaa[_0x00c0('0x1c')]],'as':_0x436eaa['as'],'attributes':_0x436eaa[_0x00c0('0x19')],'include':_0x436eaa[_0x00c0('0x1a')]?_[_0x00c0('0x1b')](_0x436eaa['include'],function(_0x437611){return{'model':db[_0x437611[_0x00c0('0x1c')]],'as':_0x437611['as'],'attributes':_0x437611[_0x00c0('0x19')],'include':_0x437611['include']?_[_0x00c0('0x1b')](_0x437611[_0x00c0('0x1a')],function(_0x4a39e6){return{'model':db[_0x4a39e6['model']],'as':_0x4a39e6['as'],'attributes':_0x4a39e6[_0x00c0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x00c0('0xb')](function(_0x191d98){logger[_0x00c0('0xc')](_0x00c0('0x20'),_0x4f90de);logger['debug']('ShowSugarcrmAccount',_0x4f90de,JSON[_0x00c0('0x1d')](_0x191d98));_0x4b8722(_0x191d98);})[_0x00c0('0x14')](function(_0xcdb878){logger[_0x00c0('0x11')](_0x00c0('0x20'),_0xcdb878['message'],_0x4f90de);_0x25657d(_0x2bd759[_0x00c0('0x11')](0x1f4,_0xcdb878[_0x00c0('0x13')]));});});}; \ No newline at end of file +var _0xe354=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','GetSugarcrmAccount','options','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','stringify','lodash','moment','bluebird'];(function(_0x44ce86,_0x370383){var _0x35be15=function(_0x3f3135){while(--_0x3f3135){_0x44ce86['push'](_0x44ce86['shift']());}};_0x35be15(++_0x370383);}(_0xe354,0x1d9));var _0x4e35=function(_0x25ddb1,_0x28caba){_0x25ddb1=_0x25ddb1-0x0;var _0x15f64b=_0xe354[_0x25ddb1];return _0x15f64b;};'use strict';var _=require(_0x4e35('0x0'));var util=require('util');var moment=require(_0x4e35('0x1'));var BPromise=require(_0x4e35('0x2'));var rs=require(_0x4e35('0x3'));var fs=require('fs');var Redis=require(_0x4e35('0x4'));var db=require(_0x4e35('0x5'))['db'];var utils=require(_0x4e35('0x6'));var logger=require(_0x4e35('0x7'))(_0x4e35('0x8'));var config=require(_0x4e35('0x9'));var jayson=require(_0x4e35('0xa'));var client=jayson[_0x4e35('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0e61,_0x55ccf6,_0x1a38a1){return new BPromise(function(_0x1579f8,_0x2f045d){return client['request'](_0x2f0e61,_0x1a38a1)[_0x4e35('0xc')](function(_0x27b632){logger['info'](_0x4e35('0xd'),_0x55ccf6,_0x4e35('0xe'));logger[_0x4e35('0xf')](_0x4e35('0x10'),_0x55ccf6,_0x4e35('0xe'),JSON['stringify'](_0x27b632));if(_0x27b632['error']){if(_0x27b632['error'][_0x4e35('0x11')]===0x1f4){logger[_0x4e35('0x12')](_0x4e35('0xd'),_0x55ccf6,_0x27b632['error'][_0x4e35('0x13')]);return _0x2f045d(_0x27b632[_0x4e35('0x12')]['message']);}logger[_0x4e35('0x12')](_0x4e35('0xd'),_0x55ccf6,_0x27b632[_0x4e35('0x12')][_0x4e35('0x13')]);return _0x1579f8(_0x27b632[_0x4e35('0x12')][_0x4e35('0x13')]);}else{logger[_0x4e35('0x14')](_0x4e35('0xd'),_0x55ccf6,_0x4e35('0xe'));_0x1579f8(_0x27b632[_0x4e35('0x15')]['message']);}})[_0x4e35('0x16')](function(_0x26d07c){logger['error'](_0x4e35('0xd'),_0x55ccf6,_0x26d07c);_0x2f045d(_0x26d07c);});});}exports[_0x4e35('0x17')]=function(_0x2cebcb){var _0x284d87=this;return new Promise(function(_0x172ec4,_0xb60503){return db['SugarcrmAccount']['findAll']({'raw':_0x2cebcb[_0x4e35('0x18')]?_0x2cebcb[_0x4e35('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2cebcb[_0x4e35('0x18')]?_0x2cebcb[_0x4e35('0x18')][_0x4e35('0x19')]||null:null,'attributes':_0x2cebcb['options']?_0x2cebcb[_0x4e35('0x18')][_0x4e35('0x1a')]||null:null,'limit':_0x2cebcb[_0x4e35('0x18')]?_0x2cebcb['options'][_0x4e35('0x1b')]||null:null,'include':_0x2cebcb[_0x4e35('0x18')]?_0x2cebcb[_0x4e35('0x18')][_0x4e35('0x1c')]?_[_0x4e35('0x1d')](_0x2cebcb['options'][_0x4e35('0x1c')],function(_0x28358f){return{'model':db[_0x28358f[_0x4e35('0x1e')]],'as':_0x28358f['as'],'attributes':_0x28358f[_0x4e35('0x1a')],'include':_0x28358f[_0x4e35('0x1c')]?_['map'](_0x28358f[_0x4e35('0x1c')],function(_0xadd9ba){return{'model':db[_0xadd9ba[_0x4e35('0x1e')]],'as':_0xadd9ba['as'],'attributes':_0xadd9ba[_0x4e35('0x1a')],'include':_0xadd9ba[_0x4e35('0x1c')]?_['map'](_0xadd9ba[_0x4e35('0x1c')],function(_0x1bb793){return{'model':db[_0x1bb793[_0x4e35('0x1e')]],'as':_0x1bb793['as'],'attributes':_0x1bb793[_0x4e35('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5397a2){logger[_0x4e35('0x14')](_0x4e35('0x17'),_0x2cebcb);logger[_0x4e35('0xf')](_0x4e35('0x17'),_0x2cebcb,JSON['stringify'](_0x5397a2));_0x172ec4(_0x5397a2);})[_0x4e35('0x16')](function(_0x554a22){logger[_0x4e35('0x12')]('GetSugarcrmAccount',_0x554a22[_0x4e35('0x13')],_0x2cebcb);_0xb60503(_0x284d87['error'](0x1f4,_0x554a22[_0x4e35('0x13')]));});});};exports[_0x4e35('0x1f')]=function(_0xf6a92b){var _0x24b989=this;return new Promise(function(_0x3469fd,_0x2b462e){return db['SugarcrmAccount'][_0x4e35('0x20')]({'raw':_0xf6a92b['options']?_0xf6a92b['options']['raw']===undefined?!![]:![]:!![],'where':_0xf6a92b[_0x4e35('0x18')]?_0xf6a92b['options'][_0x4e35('0x19')]||null:null,'attributes':_0xf6a92b['options']?_0xf6a92b[_0x4e35('0x18')][_0x4e35('0x1a')]||null:null,'include':_0xf6a92b[_0x4e35('0x18')]?_0xf6a92b[_0x4e35('0x18')][_0x4e35('0x1c')]?_[_0x4e35('0x1d')](_0xf6a92b[_0x4e35('0x18')][_0x4e35('0x1c')],function(_0x38a1cc){return{'model':db[_0x38a1cc['model']],'as':_0x38a1cc['as'],'attributes':_0x38a1cc[_0x4e35('0x1a')],'include':_0x38a1cc[_0x4e35('0x1c')]?_['map'](_0x38a1cc[_0x4e35('0x1c')],function(_0x520a86){return{'model':db[_0x520a86[_0x4e35('0x1e')]],'as':_0x520a86['as'],'attributes':_0x520a86[_0x4e35('0x1a')],'include':_0x520a86[_0x4e35('0x1c')]?_[_0x4e35('0x1d')](_0x520a86[_0x4e35('0x1c')],function(_0x32a9e0){return{'model':db[_0x32a9e0[_0x4e35('0x1e')]],'as':_0x32a9e0['as'],'attributes':_0x32a9e0[_0x4e35('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4e35('0xc')](function(_0x19658f){logger[_0x4e35('0x14')](_0x4e35('0x1f'),_0xf6a92b);logger[_0x4e35('0xf')](_0x4e35('0x1f'),_0xf6a92b,JSON[_0x4e35('0x21')](_0x19658f));_0x3469fd(_0x19658f);})[_0x4e35('0x16')](function(_0x1b3197){logger[_0x4e35('0x12')](_0x4e35('0x1f'),_0x1b3197[_0x4e35('0x13')],_0xf6a92b);_0x2b462e(_0x24b989[_0x4e35('0x12')](0x1f4,_0x1b3197[_0x4e35('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1b3ba42..9efa5c6 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 _0x97a0=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x551ece,_0x23d845){var _0x24ac88=function(_0x4d801a){while(--_0x4d801a){_0x551ece['push'](_0x551ece['shift']());}};_0x24ac88(++_0x23d845);}(_0x97a0,0x171));var _0x097a=function(_0x103ad4,_0x49c8c3){_0x103ad4=_0x103ad4-0x0;var _0x528267=_0x97a0[_0x103ad4];return _0x528267;};'use strict';var multer=require(_0x097a('0x0'));var util=require(_0x097a('0x1'));var path=require(_0x097a('0x2'));var timeout=require(_0x097a('0x3'));var express=require(_0x097a('0x4'));var router=express[_0x097a('0x5')]();var fs_extra=require(_0x097a('0x6'));var auth=require(_0x097a('0x7'));var interaction=require(_0x097a('0x8'));var config=require(_0x097a('0x9'));var controller=require(_0x097a('0xa'));router[_0x097a('0xb')]('/',auth[_0x097a('0xc')](),controller[_0x097a('0xd')]);router[_0x097a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x097a('0xe')]);router[_0x097a('0xb')](_0x097a('0xf'),auth[_0x097a('0xc')](),controller[_0x097a('0x10')]);router[_0x097a('0xb')]('/:id/subjects',auth[_0x097a('0xc')](),controller[_0x097a('0x11')]);router[_0x097a('0xb')](_0x097a('0x12'),auth[_0x097a('0xc')](),controller['getDescriptions']);router[_0x097a('0x13')]('/',auth[_0x097a('0xc')](),controller[_0x097a('0x14')]);router[_0x097a('0x15')]('/:id',auth[_0x097a('0xc')](),controller[_0x097a('0x16')]);router[_0x097a('0x17')](_0x097a('0x18'),auth[_0x097a('0xc')](),controller[_0x097a('0x19')]);module[_0x097a('0x1a')]=router; \ No newline at end of file +var _0xa04a=['isAuthenticated','index','show','get','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x5b0476,_0x279a92){var _0x497d47=function(_0x4d9bbd){while(--_0x4d9bbd){_0x5b0476['push'](_0x5b0476['shift']());}};_0x497d47(++_0x279a92);}(_0xa04a,0x1d8));var _0xaa04=function(_0x565836,_0xd9d455){_0x565836=_0x565836-0x0;var _0x5eb222=_0xa04a[_0x565836];return _0x5eb222;};'use strict';var multer=require(_0xaa04('0x0'));var util=require(_0xaa04('0x1'));var path=require(_0xaa04('0x2'));var timeout=require(_0xaa04('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaa04('0x4'));var interaction=require(_0xaa04('0x5'));var config=require(_0xaa04('0x6'));var controller=require(_0xaa04('0x7'));router['get']('/',auth[_0xaa04('0x8')](),controller[_0xaa04('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xaa04('0xa')]);router[_0xaa04('0xb')]('/:id/fields',auth[_0xaa04('0x8')](),controller[_0xaa04('0xc')]);router['get'](_0xaa04('0xd'),auth['isAuthenticated'](),controller[_0xaa04('0xe')]);router[_0xaa04('0xb')](_0xaa04('0xf'),auth[_0xaa04('0x8')](),controller[_0xaa04('0x10')]);router[_0xaa04('0x11')]('/',auth[_0xaa04('0x8')](),controller[_0xaa04('0x12')]);router[_0xaa04('0x13')](_0xaa04('0x14'),auth[_0xaa04('0x8')](),controller[_0xaa04('0x15')]);router['delete'](_0xaa04('0x14'),auth[_0xaa04('0x8')](),controller[_0xaa04('0x16')]);module[_0xaa04('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c4774d4..531ec9e 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 _0x6873=['STRING','exports'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x6873,0x8f));var _0x3687=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x6873[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require('sequelize');module[_0x3687('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3687('0x1')]}}; \ No newline at end of file +var _0x6973=['sequelize','exports'];(function(_0x458db5,_0xeca3b){var _0x3566de=function(_0x3b5bc0){while(--_0x3b5bc0){_0x458db5['push'](_0x458db5['shift']());}};_0x3566de(++_0xeca3b);}(_0x6973,0x1aa));var _0x3697=function(_0x44b978,_0x4eab9e){_0x44b978=_0x44b978-0x0;var _0xe3a299=_0x6973[_0x44b978];return _0xe3a299;};'use strict';var Sequelize=require(_0x3697('0x0'));module[_0x3697('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 399abc8..ea44697 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 _0xe3a5=['fast-json-patch','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','destroy','then','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','params','keys','merge','catch','create','body','update','find','findOne','SugarcrmField','getFields','getSubjects','nolimit','getDescriptions','rimraf'];(function(_0x532972,_0x23f2da){var _0x308435=function(_0x4d0ebc){while(--_0x4d0ebc){_0x532972['push'](_0x532972['shift']());}};_0x308435(++_0x23f2da);}(_0xe3a5,0xe6));var _0x5e3a=function(_0x1737a2,_0x5a6464){_0x1737a2=_0x1737a2-0x0;var _0x11c2a0=_0xe3a5[_0x1737a2];return _0x11c2a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e3a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e3a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5e3a('0x2'));var Mustache=require(_0x5e3a('0x3'));var util=require('util');var path=require(_0x5e3a('0x4'));var sox=require(_0x5e3a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e3a('0x6'));var _=require(_0x5e3a('0x7'));var squel=require(_0x5e3a('0x8'));var crypto=require(_0x5e3a('0x9'));var jsforce=require(_0x5e3a('0xa'));var deskjs=require(_0x5e3a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5e3a('0xc'));var Papa=require('papaparse');var Redis=require(_0x5e3a('0xd'));var authService=require(_0x5e3a('0xe'));var qs=require(_0x5e3a('0xf'));var as=require(_0x5e3a('0x10'));var hardwareService=require(_0x5e3a('0x11'));var logger=require(_0x5e3a('0x12'))(_0x5e3a('0x13'));var utils=require(_0x5e3a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5e3a('0x15'));var db=require(_0x5e3a('0x16'))['db'];function respondWithStatusCode(_0x4a1581,_0x510327){_0x510327=_0x510327||0xcc;return function(_0x506042){if(_0x506042){return _0x4a1581[_0x5e3a('0x17')](_0x510327);}return _0x4a1581[_0x5e3a('0x18')](_0x510327)['end']();};}function respondWithResult(_0x37d14a,_0x3ea4ae){_0x3ea4ae=_0x3ea4ae||0xc8;return function(_0x2235f3){if(_0x2235f3){return _0x37d14a[_0x5e3a('0x18')](_0x3ea4ae)['json'](_0x2235f3);}};}function respondWithFilteredResult(_0x2451c6,_0x56d8ed){return function(_0x2d8d30){if(_0x2d8d30){var _0x6fc10b=typeof _0x56d8ed[_0x5e3a('0x19')]===_0x5e3a('0x1a')&&typeof _0x56d8ed[_0x5e3a('0x1b')]===_0x5e3a('0x1a');var _0x20379c=_0x2d8d30[_0x5e3a('0x1c')];var _0x187056=_0x6fc10b?0x0:_0x56d8ed[_0x5e3a('0x19')];var _0x253a85=_0x6fc10b?_0x2d8d30[_0x5e3a('0x1c')]:_0x56d8ed[_0x5e3a('0x19')]+_0x56d8ed[_0x5e3a('0x1b')];var _0x1c9996;if(_0x253a85>=_0x20379c){_0x253a85=_0x20379c;_0x1c9996=0xc8;}else{_0x1c9996=0xce;}_0x2451c6[_0x5e3a('0x18')](_0x1c9996);return _0x2451c6[_0x5e3a('0x1d')]('Content-Range',_0x187056+'-'+_0x253a85+'/'+_0x20379c)[_0x5e3a('0x1e')](_0x2d8d30);}return null;};}function patchUpdates(_0x266505){return function(_0x37ef83){try{jsonpatch[_0x5e3a('0x1f')](_0x37ef83,_0x266505,!![]);}catch(_0x18de61){return BPromise[_0x5e3a('0x20')](_0x18de61);}return _0x37ef83[_0x5e3a('0x21')]();};}function saveUpdates(_0x172a37,_0x102e43){return function(_0x55a44b){if(_0x55a44b){return _0x55a44b['update'](_0x172a37)['then'](function(_0x52b13b){return _0x52b13b;});}return null;};}function removeEntity(_0x1af322,_0x4bc891){return function(_0x237d04){if(_0x237d04){return _0x237d04[_0x5e3a('0x22')]()[_0x5e3a('0x23')](function(){_0x1af322[_0x5e3a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3984c4,_0x68f983){return function(_0x43c588){if(!_0x43c588){_0x3984c4['sendStatus'](0x194);}return _0x43c588;};}function handleError(_0x858ae4,_0x5906a8){_0x5906a8=_0x5906a8||0x1f4;return function(_0x2484c9){logger['error'](_0x2484c9['stack']);if(_0x2484c9[_0x5e3a('0x24')]){delete _0x2484c9[_0x5e3a('0x24')];}_0x858ae4[_0x5e3a('0x18')](_0x5906a8)[_0x5e3a('0x25')](_0x2484c9);};}exports[_0x5e3a('0x26')]=function(_0x4fc02,_0x52bc0e){var _0x25e94d={},_0x276a7d={},_0x46dd94={'count':0x0,'rows':[]};var _0x12ef12=_[_0x5e3a('0x27')](db[_0x5e3a('0x28')][_0x5e3a('0x29')],function(_0x296b9f){return{'name':_0x296b9f[_0x5e3a('0x2a')],'type':_0x296b9f[_0x5e3a('0x2b')]['key']};});_0x276a7d[_0x5e3a('0x2c')]=_['map'](_0x12ef12,_0x5e3a('0x24'));_0x276a7d[_0x5e3a('0x2d')]=_['keys'](_0x4fc02[_0x5e3a('0x2d')]);_0x276a7d['filters']=_[_0x5e3a('0x2e')](_0x276a7d[_0x5e3a('0x2c')],_0x276a7d[_0x5e3a('0x2d')]);_0x25e94d[_0x5e3a('0x2f')]=_[_0x5e3a('0x2e')](_0x276a7d[_0x5e3a('0x2c')],qs[_0x5e3a('0x30')](_0x4fc02['query'][_0x5e3a('0x30')]));_0x25e94d[_0x5e3a('0x2f')]=_0x25e94d[_0x5e3a('0x2f')][_0x5e3a('0x31')]?_0x25e94d[_0x5e3a('0x2f')]:_0x276a7d[_0x5e3a('0x2c')];if(!_0x4fc02['query'][_0x5e3a('0x32')]('nolimit')){_0x25e94d[_0x5e3a('0x1b')]=qs[_0x5e3a('0x1b')](_0x4fc02[_0x5e3a('0x2d')][_0x5e3a('0x1b')]);_0x25e94d[_0x5e3a('0x19')]=qs[_0x5e3a('0x19')](_0x4fc02[_0x5e3a('0x2d')]['offset']);}_0x25e94d[_0x5e3a('0x33')]=qs[_0x5e3a('0x34')](_0x4fc02[_0x5e3a('0x2d')][_0x5e3a('0x34')]);_0x25e94d['where']=qs[_0x5e3a('0x35')](_[_0x5e3a('0x36')](_0x4fc02[_0x5e3a('0x2d')],_0x276a7d[_0x5e3a('0x35')]),_0x12ef12);if(_0x4fc02['query'][_0x5e3a('0x37')]){_0x25e94d[_0x5e3a('0x38')]=_['merge'](_0x25e94d[_0x5e3a('0x38')],{'$or':_[_0x5e3a('0x27')](_0x12ef12,function(_0x13f24d){if(_0x13f24d[_0x5e3a('0x2b')]!==_0x5e3a('0x39')){var _0x5ce107={};_0x5ce107[_0x13f24d[_0x5e3a('0x24')]]={'$like':'%'+_0x4fc02['query']['filter']+'%'};return _0x5ce107;}})});}_0x25e94d=_['merge']({},_0x25e94d,_0x4fc02[_0x5e3a('0x3a')]);var _0x5b8e3d={'where':_0x25e94d[_0x5e3a('0x38')]};return db['SugarcrmConfiguration'][_0x5e3a('0x1c')](_0x5b8e3d)[_0x5e3a('0x23')](function(_0x35fc87){_0x46dd94[_0x5e3a('0x1c')]=_0x35fc87;if(_0x4fc02[_0x5e3a('0x2d')][_0x5e3a('0x3b')]){_0x25e94d[_0x5e3a('0x3c')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x25e94d);})[_0x5e3a('0x23')](function(_0x4f4401){_0x46dd94[_0x5e3a('0x3d')]=_0x4f4401;return _0x46dd94;})[_0x5e3a('0x23')](respondWithFilteredResult(_0x52bc0e,_0x25e94d))['catch'](handleError(_0x52bc0e,null));};exports[_0x5e3a('0x3e')]=function(_0x5d582c,_0x49b662){var _0x373152={'raw':![],'where':{'id':_0x5d582c[_0x5e3a('0x3f')]['id']}},_0x1f5a91={};_0x1f5a91[_0x5e3a('0x2c')]=_[_0x5e3a('0x40')](db['SugarcrmConfiguration'][_0x5e3a('0x29')]);_0x1f5a91[_0x5e3a('0x2d')]=_['keys'](_0x5d582c[_0x5e3a('0x2d')]);_0x1f5a91[_0x5e3a('0x35')]=_[_0x5e3a('0x2e')](_0x1f5a91[_0x5e3a('0x2c')],_0x1f5a91[_0x5e3a('0x2d')]);_0x373152[_0x5e3a('0x2f')]=_[_0x5e3a('0x2e')](_0x1f5a91[_0x5e3a('0x2c')],qs['fields'](_0x5d582c['query'][_0x5e3a('0x30')]));_0x373152[_0x5e3a('0x2f')]=_0x373152[_0x5e3a('0x2f')][_0x5e3a('0x31')]?_0x373152['attributes']:_0x1f5a91[_0x5e3a('0x2c')];if(_0x5d582c['query']['includeAll']){_0x373152[_0x5e3a('0x3c')]=[{'all':!![]}];}_0x373152=_[_0x5e3a('0x41')]({},_0x373152,_0x5d582c[_0x5e3a('0x3a')]);return db[_0x5e3a('0x28')]['find'](_0x373152)[_0x5e3a('0x23')](handleEntityNotFound(_0x49b662,null))[_0x5e3a('0x23')](respondWithResult(_0x49b662,null))[_0x5e3a('0x42')](handleError(_0x49b662,null));};exports[_0x5e3a('0x43')]=function(_0x3494a2,_0x4893c2){return db[_0x5e3a('0x28')][_0x5e3a('0x43')](_0x3494a2[_0x5e3a('0x44')],{})['then'](respondWithResult(_0x4893c2,0xc9))[_0x5e3a('0x42')](handleError(_0x4893c2,null));};exports[_0x5e3a('0x45')]=function(_0x59abbe,_0x4f9a26){if(_0x59abbe[_0x5e3a('0x44')]['id']){delete _0x59abbe[_0x5e3a('0x44')]['id'];}return db[_0x5e3a('0x28')]['find']({'where':{'id':_0x59abbe['params']['id']}})[_0x5e3a('0x23')](handleEntityNotFound(_0x4f9a26,null))[_0x5e3a('0x23')](saveUpdates(_0x59abbe[_0x5e3a('0x44')],null))[_0x5e3a('0x23')](respondWithResult(_0x4f9a26,null))[_0x5e3a('0x42')](handleError(_0x4f9a26,null));};exports[_0x5e3a('0x22')]=function(_0x13b704,_0x19d285){return db['SugarcrmConfiguration'][_0x5e3a('0x46')]({'where':{'id':_0x13b704[_0x5e3a('0x3f')]['id']}})[_0x5e3a('0x23')](handleEntityNotFound(_0x19d285,null))[_0x5e3a('0x23')](removeEntity(_0x19d285,null))[_0x5e3a('0x42')](handleError(_0x19d285,null));};exports['getFields']=function(_0x2172ef,_0x587ebf,_0x189d31){var _0x4f811e={};var _0x530eb0={};var _0x373462;var _0x5d9337;return db['SugarcrmConfiguration'][_0x5e3a('0x47')]({'where':{'id':_0x2172ef[_0x5e3a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x587ebf,null))[_0x5e3a('0x23')](function(_0x3f3c95){if(_0x3f3c95){_0x373462=_0x3f3c95;_0x530eb0[_0x5e3a('0x2c')]=_[_0x5e3a('0x40')](db[_0x5e3a('0x48')][_0x5e3a('0x29')]);_0x530eb0[_0x5e3a('0x2d')]=_['keys'](_0x2172ef['query']);_0x530eb0[_0x5e3a('0x35')]=_[_0x5e3a('0x2e')](_0x530eb0[_0x5e3a('0x2c')],_0x530eb0[_0x5e3a('0x2d')]);_0x4f811e['attributes']=_[_0x5e3a('0x2e')](_0x530eb0[_0x5e3a('0x2c')],qs[_0x5e3a('0x30')](_0x2172ef[_0x5e3a('0x2d')][_0x5e3a('0x30')]));_0x4f811e[_0x5e3a('0x2f')]=_0x4f811e[_0x5e3a('0x2f')]['length']?_0x4f811e[_0x5e3a('0x2f')]:_0x530eb0['model'];_0x4f811e[_0x5e3a('0x33')]=qs['sort'](_0x2172ef[_0x5e3a('0x2d')][_0x5e3a('0x34')]);_0x4f811e['where']=qs[_0x5e3a('0x35')](_['pick'](_0x2172ef[_0x5e3a('0x2d')],_0x530eb0[_0x5e3a('0x35')]));if(_0x2172ef[_0x5e3a('0x2d')]['filter']){_0x4f811e[_0x5e3a('0x38')]=_[_0x5e3a('0x41')](_0x4f811e[_0x5e3a('0x38')],{'$or':_[_0x5e3a('0x27')](_0x4f811e[_0x5e3a('0x2f')],function(_0x56582e){var _0x1e43e7={};_0x1e43e7[_0x56582e]={'$like':'%'+_0x2172ef['query']['filter']+'%'};return _0x1e43e7;})});}_0x4f811e=_[_0x5e3a('0x41')]({},_0x4f811e,_0x2172ef[_0x5e3a('0x3a')]);return _0x373462[_0x5e3a('0x49')](_0x4f811e);}})['then'](function(_0x103876){if(_0x103876){_0x5d9337=_0x103876[_0x5e3a('0x31')];if(!_0x2172ef[_0x5e3a('0x2d')][_0x5e3a('0x32')]('nolimit')){_0x4f811e[_0x5e3a('0x1b')]=qs[_0x5e3a('0x1b')](_0x2172ef['query'][_0x5e3a('0x1b')]);_0x4f811e[_0x5e3a('0x19')]=qs[_0x5e3a('0x19')](_0x2172ef['query'][_0x5e3a('0x19')]);}return _0x373462[_0x5e3a('0x49')](_0x4f811e);}})[_0x5e3a('0x23')](function(_0x2f1514){if(_0x2f1514){return _0x2f1514?{'count':_0x5d9337,'rows':_0x2f1514}:null;}})[_0x5e3a('0x23')](respondWithResult(_0x587ebf,null))['catch'](handleError(_0x587ebf,null));};exports[_0x5e3a('0x4a')]=function(_0x175ed9,_0x4ba66c,_0x1e0197){var _0x2a0a61={};var _0x4837e2={};var _0x19669e;var _0xf5e989;return db['SugarcrmConfiguration'][_0x5e3a('0x47')]({'where':{'id':_0x175ed9[_0x5e3a('0x3f')]['id']}})[_0x5e3a('0x23')](handleEntityNotFound(_0x4ba66c,null))[_0x5e3a('0x23')](function(_0x3eaeb2){if(_0x3eaeb2){_0x19669e=_0x3eaeb2;_0x4837e2['model']=_['keys'](db[_0x5e3a('0x48')][_0x5e3a('0x29')]);_0x4837e2[_0x5e3a('0x2d')]=_[_0x5e3a('0x40')](_0x175ed9[_0x5e3a('0x2d')]);_0x4837e2['filters']=_['intersection'](_0x4837e2[_0x5e3a('0x2c')],_0x4837e2[_0x5e3a('0x2d')]);_0x2a0a61[_0x5e3a('0x2f')]=_['intersection'](_0x4837e2[_0x5e3a('0x2c')],qs[_0x5e3a('0x30')](_0x175ed9[_0x5e3a('0x2d')][_0x5e3a('0x30')]));_0x2a0a61[_0x5e3a('0x2f')]=_0x2a0a61[_0x5e3a('0x2f')][_0x5e3a('0x31')]?_0x2a0a61[_0x5e3a('0x2f')]:_0x4837e2[_0x5e3a('0x2c')];_0x2a0a61[_0x5e3a('0x33')]=qs['sort'](_0x175ed9[_0x5e3a('0x2d')][_0x5e3a('0x34')]);_0x2a0a61[_0x5e3a('0x38')]=qs['filters'](_[_0x5e3a('0x36')](_0x175ed9[_0x5e3a('0x2d')],_0x4837e2[_0x5e3a('0x35')]));if(_0x175ed9[_0x5e3a('0x2d')][_0x5e3a('0x37')]){_0x2a0a61[_0x5e3a('0x38')]=_[_0x5e3a('0x41')](_0x2a0a61['where'],{'$or':_[_0x5e3a('0x27')](_0x2a0a61[_0x5e3a('0x2f')],function(_0x2659ff){var _0xbeb390={};_0xbeb390[_0x2659ff]={'$like':'%'+_0x175ed9[_0x5e3a('0x2d')][_0x5e3a('0x37')]+'%'};return _0xbeb390;})});}_0x2a0a61=_['merge']({},_0x2a0a61,_0x175ed9['options']);return _0x19669e[_0x5e3a('0x4a')](_0x2a0a61);}})[_0x5e3a('0x23')](function(_0x5f3c98){if(_0x5f3c98){_0xf5e989=_0x5f3c98[_0x5e3a('0x31')];if(!_0x175ed9[_0x5e3a('0x2d')][_0x5e3a('0x32')](_0x5e3a('0x4b'))){_0x2a0a61[_0x5e3a('0x1b')]=qs[_0x5e3a('0x1b')](_0x175ed9[_0x5e3a('0x2d')][_0x5e3a('0x1b')]);_0x2a0a61[_0x5e3a('0x19')]=qs['offset'](_0x175ed9[_0x5e3a('0x2d')]['offset']);}return _0x19669e[_0x5e3a('0x4a')](_0x2a0a61);}})[_0x5e3a('0x23')](function(_0x5b0875){if(_0x5b0875){return _0x5b0875?{'count':_0xf5e989,'rows':_0x5b0875}:null;}})[_0x5e3a('0x23')](respondWithResult(_0x4ba66c,null))[_0x5e3a('0x42')](handleError(_0x4ba66c,null));};exports[_0x5e3a('0x4c')]=function(_0x38b749,_0x266769,_0x1e25d2){var _0x138a97={};var _0x6644a={};var _0x4c0c97;var _0x533beb;return db[_0x5e3a('0x28')]['findOne']({'where':{'id':_0x38b749[_0x5e3a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x266769,null))[_0x5e3a('0x23')](function(_0x4bbe53){if(_0x4bbe53){_0x4c0c97=_0x4bbe53;_0x6644a[_0x5e3a('0x2c')]=_[_0x5e3a('0x40')](db['SugarcrmField'][_0x5e3a('0x29')]);_0x6644a[_0x5e3a('0x2d')]=_[_0x5e3a('0x40')](_0x38b749[_0x5e3a('0x2d')]);_0x6644a['filters']=_['intersection'](_0x6644a['model'],_0x6644a[_0x5e3a('0x2d')]);_0x138a97[_0x5e3a('0x2f')]=_['intersection'](_0x6644a[_0x5e3a('0x2c')],qs[_0x5e3a('0x30')](_0x38b749[_0x5e3a('0x2d')][_0x5e3a('0x30')]));_0x138a97[_0x5e3a('0x2f')]=_0x138a97[_0x5e3a('0x2f')][_0x5e3a('0x31')]?_0x138a97['attributes']:_0x6644a[_0x5e3a('0x2c')];_0x138a97['order']=qs['sort'](_0x38b749[_0x5e3a('0x2d')][_0x5e3a('0x34')]);_0x138a97[_0x5e3a('0x38')]=qs[_0x5e3a('0x35')](_['pick'](_0x38b749[_0x5e3a('0x2d')],_0x6644a[_0x5e3a('0x35')]));if(_0x38b749[_0x5e3a('0x2d')][_0x5e3a('0x37')]){_0x138a97[_0x5e3a('0x38')]=_[_0x5e3a('0x41')](_0x138a97['where'],{'$or':_['map'](_0x138a97[_0x5e3a('0x2f')],function(_0xc8f409){var _0x1ff8bb={};_0x1ff8bb[_0xc8f409]={'$like':'%'+_0x38b749['query'][_0x5e3a('0x37')]+'%'};return _0x1ff8bb;})});}_0x138a97=_[_0x5e3a('0x41')]({},_0x138a97,_0x38b749[_0x5e3a('0x3a')]);return _0x4c0c97[_0x5e3a('0x4c')](_0x138a97);}})[_0x5e3a('0x23')](function(_0x818a3){if(_0x818a3){_0x533beb=_0x818a3[_0x5e3a('0x31')];if(!_0x38b749[_0x5e3a('0x2d')]['hasOwnProperty'](_0x5e3a('0x4b'))){_0x138a97[_0x5e3a('0x1b')]=qs[_0x5e3a('0x1b')](_0x38b749[_0x5e3a('0x2d')][_0x5e3a('0x1b')]);_0x138a97[_0x5e3a('0x19')]=qs[_0x5e3a('0x19')](_0x38b749[_0x5e3a('0x2d')][_0x5e3a('0x19')]);}return _0x4c0c97[_0x5e3a('0x4c')](_0x138a97);}})['then'](function(_0x27d288){if(_0x27d288){return _0x27d288?{'count':_0x533beb,'rows':_0x27d288}:null;}})[_0x5e3a('0x23')](respondWithResult(_0x266769,null))[_0x5e3a('0x42')](handleError(_0x266769,null));}; \ No newline at end of file +var _0xaac1=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','destroy','params','getFields','SugarcrmField','order','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4b9cef,_0x527a7d){var _0x2f2147=function(_0xac0a0a){while(--_0xac0a0a){_0x4b9cef['push'](_0x4b9cef['shift']());}};_0x2f2147(++_0x527a7d);}(_0xaac1,0x173));var _0x1aac=function(_0x55cd5c,_0xe45d1d){_0x55cd5c=_0x55cd5c-0x0;var _0x3e0643=_0xaac1[_0x55cd5c];return _0x3e0643;};'use strict';var emlformat=require(_0x1aac('0x0'));var rimraf=require(_0x1aac('0x1'));var zipdir=require(_0x1aac('0x2'));var jsonpatch=require(_0x1aac('0x3'));var rp=require(_0x1aac('0x4'));var moment=require('moment');var BPromise=require(_0x1aac('0x5'));var Mustache=require('mustache');var util=require(_0x1aac('0x6'));var path=require(_0x1aac('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1aac('0x8'));var fs=require('fs');var fs_extra=require(_0x1aac('0x9'));var _=require(_0x1aac('0xa'));var squel=require('squel');var crypto=require(_0x1aac('0xb'));var jsforce=require(_0x1aac('0xc'));var deskjs=require(_0x1aac('0xd'));var toCsv=require(_0x1aac('0xe'));var querystring=require('querystring');var Papa=require(_0x1aac('0xf'));var Redis=require(_0x1aac('0x10'));var authService=require(_0x1aac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1aac('0x12'));var hardwareService=require(_0x1aac('0x13'));var logger=require(_0x1aac('0x14'))(_0x1aac('0x15'));var utils=require(_0x1aac('0x16'));var config=require(_0x1aac('0x17'));var licenseUtil=require(_0x1aac('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c90bd,_0x557cca){_0x557cca=_0x557cca||0xcc;return function(_0x6743ac){if(_0x6743ac){return _0x1c90bd[_0x1aac('0x19')](_0x557cca);}return _0x1c90bd[_0x1aac('0x1a')](_0x557cca)[_0x1aac('0x1b')]();};}function respondWithResult(_0x1ccbd4,_0x913f6f){_0x913f6f=_0x913f6f||0xc8;return function(_0x489ba9){if(_0x489ba9){return _0x1ccbd4[_0x1aac('0x1a')](_0x913f6f)[_0x1aac('0x1c')](_0x489ba9);}};}function respondWithFilteredResult(_0x24c14c,_0x58d357){return function(_0x1653b8){if(_0x1653b8){var _0x39f502=typeof _0x58d357[_0x1aac('0x1d')]===_0x1aac('0x1e')&&typeof _0x58d357[_0x1aac('0x1f')]===_0x1aac('0x1e');var _0x51ac9c=_0x1653b8[_0x1aac('0x20')];var _0x305c22=_0x39f502?0x0:_0x58d357['offset'];var _0xaaf2ea=_0x39f502?_0x1653b8['count']:_0x58d357['offset']+_0x58d357[_0x1aac('0x1f')];var _0x11be51;if(_0xaaf2ea>=_0x51ac9c){_0xaaf2ea=_0x51ac9c;_0x11be51=0xc8;}else{_0x11be51=0xce;}_0x24c14c['status'](_0x11be51);return _0x24c14c[_0x1aac('0x21')](_0x1aac('0x22'),_0x305c22+'-'+_0xaaf2ea+'/'+_0x51ac9c)['json'](_0x1653b8);}return null;};}function patchUpdates(_0x101e43){return function(_0x53aac3){try{jsonpatch['apply'](_0x53aac3,_0x101e43,!![]);}catch(_0x247d0e){return BPromise['reject'](_0x247d0e);}return _0x53aac3['save']();};}function saveUpdates(_0x422cdf,_0xf0bcf0){return function(_0x189688){if(_0x189688){return _0x189688[_0x1aac('0x23')](_0x422cdf)[_0x1aac('0x24')](function(_0x30d031){return _0x30d031;});}return null;};}function removeEntity(_0x3d81be,_0x451c8b){return function(_0x3d3ff4){if(_0x3d3ff4){return _0x3d3ff4['destroy']()['then'](function(){_0x3d81be['status'](0xcc)[_0x1aac('0x1b')]();});}};}function handleEntityNotFound(_0x4a637c,_0x3f194e){return function(_0x5730e4){if(!_0x5730e4){_0x4a637c[_0x1aac('0x19')](0x194);}return _0x5730e4;};}function handleError(_0x518ec7,_0x52e07f){_0x52e07f=_0x52e07f||0x1f4;return function(_0x29192b){logger[_0x1aac('0x25')](_0x29192b['stack']);if(_0x29192b[_0x1aac('0x26')]){delete _0x29192b[_0x1aac('0x26')];}_0x518ec7['status'](_0x52e07f)[_0x1aac('0x27')](_0x29192b);};}exports['index']=function(_0x5ac48f,_0x3ee61d){var _0x98c82a={},_0x3983f3={},_0x2d6d41={'count':0x0,'rows':[]};var _0x2cbea5=_[_0x1aac('0x28')](db[_0x1aac('0x29')][_0x1aac('0x2a')],function(_0x118a97){return{'name':_0x118a97[_0x1aac('0x2b')],'type':_0x118a97[_0x1aac('0x2c')][_0x1aac('0x2d')]};});_0x3983f3[_0x1aac('0x2e')]=_[_0x1aac('0x28')](_0x2cbea5,_0x1aac('0x26'));_0x3983f3[_0x1aac('0x2f')]=_[_0x1aac('0x30')](_0x5ac48f[_0x1aac('0x2f')]);_0x3983f3['filters']=_['intersection'](_0x3983f3['model'],_0x3983f3[_0x1aac('0x2f')]);_0x98c82a[_0x1aac('0x31')]=_[_0x1aac('0x32')](_0x3983f3[_0x1aac('0x2e')],qs['fields'](_0x5ac48f[_0x1aac('0x2f')][_0x1aac('0x33')]));_0x98c82a['attributes']=_0x98c82a[_0x1aac('0x31')][_0x1aac('0x34')]?_0x98c82a['attributes']:_0x3983f3[_0x1aac('0x2e')];if(!_0x5ac48f['query'][_0x1aac('0x35')](_0x1aac('0x36'))){_0x98c82a['limit']=qs[_0x1aac('0x1f')](_0x5ac48f[_0x1aac('0x2f')][_0x1aac('0x1f')]);_0x98c82a['offset']=qs['offset'](_0x5ac48f[_0x1aac('0x2f')]['offset']);}_0x98c82a['order']=qs[_0x1aac('0x37')](_0x5ac48f[_0x1aac('0x2f')][_0x1aac('0x37')]);_0x98c82a[_0x1aac('0x38')]=qs['filters'](_[_0x1aac('0x39')](_0x5ac48f[_0x1aac('0x2f')],_0x3983f3[_0x1aac('0x3a')]),_0x2cbea5);if(_0x5ac48f['query'][_0x1aac('0x3b')]){_0x98c82a[_0x1aac('0x38')]=_[_0x1aac('0x3c')](_0x98c82a['where'],{'$or':_[_0x1aac('0x28')](_0x2cbea5,function(_0x251f97){if(_0x251f97['type']!=='VIRTUAL'){var _0x29c0c6={};_0x29c0c6[_0x251f97[_0x1aac('0x26')]]={'$like':'%'+_0x5ac48f['query'][_0x1aac('0x3b')]+'%'};return _0x29c0c6;}})});}_0x98c82a=_[_0x1aac('0x3c')]({},_0x98c82a,_0x5ac48f['options']);var _0xe352b1={'where':_0x98c82a['where']};return db[_0x1aac('0x29')][_0x1aac('0x20')](_0xe352b1)['then'](function(_0x1a8a35){_0x2d6d41[_0x1aac('0x20')]=_0x1a8a35;if(_0x5ac48f[_0x1aac('0x2f')][_0x1aac('0x3d')]){_0x98c82a[_0x1aac('0x3e')]=[{'all':!![]}];}return db[_0x1aac('0x29')][_0x1aac('0x3f')](_0x98c82a);})[_0x1aac('0x24')](function(_0x4b2da7){_0x2d6d41[_0x1aac('0x40')]=_0x4b2da7;return _0x2d6d41;})[_0x1aac('0x24')](respondWithFilteredResult(_0x3ee61d,_0x98c82a))[_0x1aac('0x41')](handleError(_0x3ee61d,null));};exports[_0x1aac('0x42')]=function(_0x3d65c2,_0x330f00){var _0x7787a2={'raw':![],'where':{'id':_0x3d65c2['params']['id']}},_0x40613f={};_0x40613f['model']=_[_0x1aac('0x30')](db['SugarcrmConfiguration']['rawAttributes']);_0x40613f['query']=_[_0x1aac('0x30')](_0x3d65c2[_0x1aac('0x2f')]);_0x40613f['filters']=_[_0x1aac('0x32')](_0x40613f[_0x1aac('0x2e')],_0x40613f[_0x1aac('0x2f')]);_0x7787a2[_0x1aac('0x31')]=_['intersection'](_0x40613f[_0x1aac('0x2e')],qs[_0x1aac('0x33')](_0x3d65c2[_0x1aac('0x2f')][_0x1aac('0x33')]));_0x7787a2[_0x1aac('0x31')]=_0x7787a2[_0x1aac('0x31')][_0x1aac('0x34')]?_0x7787a2['attributes']:_0x40613f[_0x1aac('0x2e')];if(_0x3d65c2[_0x1aac('0x2f')][_0x1aac('0x3d')]){_0x7787a2[_0x1aac('0x3e')]=[{'all':!![]}];}_0x7787a2=_[_0x1aac('0x3c')]({},_0x7787a2,_0x3d65c2[_0x1aac('0x43')]);return db[_0x1aac('0x29')][_0x1aac('0x44')](_0x7787a2)[_0x1aac('0x24')](handleEntityNotFound(_0x330f00,null))['then'](respondWithResult(_0x330f00,null))[_0x1aac('0x41')](handleError(_0x330f00,null));};exports[_0x1aac('0x45')]=function(_0x3b77ca,_0x2f43b1){return db[_0x1aac('0x29')][_0x1aac('0x45')](_0x3b77ca['body'],{})[_0x1aac('0x24')](respondWithResult(_0x2f43b1,0xc9))['catch'](handleError(_0x2f43b1,null));};exports[_0x1aac('0x23')]=function(_0x1e94f0,_0x1bfe44){if(_0x1e94f0[_0x1aac('0x46')]['id']){delete _0x1e94f0[_0x1aac('0x46')]['id'];}return db[_0x1aac('0x29')][_0x1aac('0x44')]({'where':{'id':_0x1e94f0['params']['id']}})[_0x1aac('0x24')](handleEntityNotFound(_0x1bfe44,null))[_0x1aac('0x24')](saveUpdates(_0x1e94f0[_0x1aac('0x46')],null))['then'](respondWithResult(_0x1bfe44,null))[_0x1aac('0x41')](handleError(_0x1bfe44,null));};exports[_0x1aac('0x47')]=function(_0x482b97,_0xfcb9d8){return db[_0x1aac('0x29')][_0x1aac('0x44')]({'where':{'id':_0x482b97[_0x1aac('0x48')]['id']}})[_0x1aac('0x24')](handleEntityNotFound(_0xfcb9d8,null))[_0x1aac('0x24')](removeEntity(_0xfcb9d8,null))[_0x1aac('0x41')](handleError(_0xfcb9d8,null));};exports[_0x1aac('0x49')]=function(_0x2210a2,_0x170a22,_0x52413d){var _0x392d05={};var _0x23f0e4={};var _0x4dea26;var _0x54f4d4;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2210a2[_0x1aac('0x48')]['id']}})[_0x1aac('0x24')](handleEntityNotFound(_0x170a22,null))[_0x1aac('0x24')](function(_0x33e8bb){if(_0x33e8bb){_0x4dea26=_0x33e8bb;_0x23f0e4[_0x1aac('0x2e')]=_[_0x1aac('0x30')](db[_0x1aac('0x4a')]['rawAttributes']);_0x23f0e4[_0x1aac('0x2f')]=_[_0x1aac('0x30')](_0x2210a2[_0x1aac('0x2f')]);_0x23f0e4['filters']=_[_0x1aac('0x32')](_0x23f0e4[_0x1aac('0x2e')],_0x23f0e4[_0x1aac('0x2f')]);_0x392d05[_0x1aac('0x31')]=_[_0x1aac('0x32')](_0x23f0e4[_0x1aac('0x2e')],qs['fields'](_0x2210a2['query'][_0x1aac('0x33')]));_0x392d05['attributes']=_0x392d05[_0x1aac('0x31')][_0x1aac('0x34')]?_0x392d05['attributes']:_0x23f0e4[_0x1aac('0x2e')];_0x392d05[_0x1aac('0x4b')]=qs[_0x1aac('0x37')](_0x2210a2[_0x1aac('0x2f')][_0x1aac('0x37')]);_0x392d05[_0x1aac('0x38')]=qs[_0x1aac('0x3a')](_[_0x1aac('0x39')](_0x2210a2[_0x1aac('0x2f')],_0x23f0e4['filters']));if(_0x2210a2[_0x1aac('0x2f')][_0x1aac('0x3b')]){_0x392d05[_0x1aac('0x38')]=_[_0x1aac('0x3c')](_0x392d05[_0x1aac('0x38')],{'$or':_[_0x1aac('0x28')](_0x392d05[_0x1aac('0x31')],function(_0x57b451){var _0x555ef2={};_0x555ef2[_0x57b451]={'$like':'%'+_0x2210a2[_0x1aac('0x2f')]['filter']+'%'};return _0x555ef2;})});}_0x392d05=_[_0x1aac('0x3c')]({},_0x392d05,_0x2210a2[_0x1aac('0x43')]);return _0x4dea26['getFields'](_0x392d05);}})[_0x1aac('0x24')](function(_0x126d8b){if(_0x126d8b){_0x54f4d4=_0x126d8b['length'];if(!_0x2210a2[_0x1aac('0x2f')][_0x1aac('0x35')](_0x1aac('0x36'))){_0x392d05[_0x1aac('0x1f')]=qs['limit'](_0x2210a2[_0x1aac('0x2f')][_0x1aac('0x1f')]);_0x392d05[_0x1aac('0x1d')]=qs[_0x1aac('0x1d')](_0x2210a2[_0x1aac('0x2f')]['offset']);}return _0x4dea26[_0x1aac('0x49')](_0x392d05);}})['then'](function(_0x1a5d18){if(_0x1a5d18){return _0x1a5d18?{'count':_0x54f4d4,'rows':_0x1a5d18}:null;}})[_0x1aac('0x24')](respondWithResult(_0x170a22,null))[_0x1aac('0x41')](handleError(_0x170a22,null));};exports[_0x1aac('0x4c')]=function(_0x429f4a,_0xaa18da,_0xc1cc24){var _0x4852a4={};var _0x499a32={};var _0x540599;var _0x42312a;return db[_0x1aac('0x29')]['findOne']({'where':{'id':_0x429f4a[_0x1aac('0x48')]['id']}})[_0x1aac('0x24')](handleEntityNotFound(_0xaa18da,null))[_0x1aac('0x24')](function(_0x1c4150){if(_0x1c4150){_0x540599=_0x1c4150;_0x499a32[_0x1aac('0x2e')]=_[_0x1aac('0x30')](db[_0x1aac('0x4a')][_0x1aac('0x2a')]);_0x499a32[_0x1aac('0x2f')]=_[_0x1aac('0x30')](_0x429f4a[_0x1aac('0x2f')]);_0x499a32[_0x1aac('0x3a')]=_[_0x1aac('0x32')](_0x499a32[_0x1aac('0x2e')],_0x499a32[_0x1aac('0x2f')]);_0x4852a4[_0x1aac('0x31')]=_[_0x1aac('0x32')](_0x499a32[_0x1aac('0x2e')],qs[_0x1aac('0x33')](_0x429f4a[_0x1aac('0x2f')][_0x1aac('0x33')]));_0x4852a4['attributes']=_0x4852a4['attributes'][_0x1aac('0x34')]?_0x4852a4[_0x1aac('0x31')]:_0x499a32[_0x1aac('0x2e')];_0x4852a4[_0x1aac('0x4b')]=qs[_0x1aac('0x37')](_0x429f4a[_0x1aac('0x2f')]['sort']);_0x4852a4[_0x1aac('0x38')]=qs[_0x1aac('0x3a')](_[_0x1aac('0x39')](_0x429f4a['query'],_0x499a32[_0x1aac('0x3a')]));if(_0x429f4a[_0x1aac('0x2f')][_0x1aac('0x3b')]){_0x4852a4['where']=_[_0x1aac('0x3c')](_0x4852a4[_0x1aac('0x38')],{'$or':_[_0x1aac('0x28')](_0x4852a4['attributes'],function(_0x231070){var _0x19ed26={};_0x19ed26[_0x231070]={'$like':'%'+_0x429f4a[_0x1aac('0x2f')][_0x1aac('0x3b')]+'%'};return _0x19ed26;})});}_0x4852a4=_[_0x1aac('0x3c')]({},_0x4852a4,_0x429f4a[_0x1aac('0x43')]);return _0x540599[_0x1aac('0x4c')](_0x4852a4);}})['then'](function(_0x57ad16){if(_0x57ad16){_0x42312a=_0x57ad16[_0x1aac('0x34')];if(!_0x429f4a[_0x1aac('0x2f')][_0x1aac('0x35')](_0x1aac('0x36'))){_0x4852a4[_0x1aac('0x1f')]=qs['limit'](_0x429f4a['query']['limit']);_0x4852a4[_0x1aac('0x1d')]=qs[_0x1aac('0x1d')](_0x429f4a[_0x1aac('0x2f')]['offset']);}return _0x540599[_0x1aac('0x4c')](_0x4852a4);}})[_0x1aac('0x24')](function(_0x433344){if(_0x433344){return _0x433344?{'count':_0x42312a,'rows':_0x433344}:null;}})[_0x1aac('0x24')](respondWithResult(_0xaa18da,null))[_0x1aac('0x41')](handleError(_0xaa18da,null));};exports[_0x1aac('0x4d')]=function(_0x5728fb,_0x140de1,_0xe2b2db){var _0x459d74={};var _0x89e1b7={};var _0x1d5ef4;var _0x55b210;return db[_0x1aac('0x29')][_0x1aac('0x4e')]({'where':{'id':_0x5728fb[_0x1aac('0x48')]['id']}})['then'](handleEntityNotFound(_0x140de1,null))['then'](function(_0x21b612){if(_0x21b612){_0x1d5ef4=_0x21b612;_0x89e1b7['model']=_[_0x1aac('0x30')](db[_0x1aac('0x4a')][_0x1aac('0x2a')]);_0x89e1b7[_0x1aac('0x2f')]=_['keys'](_0x5728fb[_0x1aac('0x2f')]);_0x89e1b7['filters']=_[_0x1aac('0x32')](_0x89e1b7['model'],_0x89e1b7[_0x1aac('0x2f')]);_0x459d74[_0x1aac('0x31')]=_['intersection'](_0x89e1b7[_0x1aac('0x2e')],qs['fields'](_0x5728fb[_0x1aac('0x2f')][_0x1aac('0x33')]));_0x459d74[_0x1aac('0x31')]=_0x459d74[_0x1aac('0x31')][_0x1aac('0x34')]?_0x459d74[_0x1aac('0x31')]:_0x89e1b7[_0x1aac('0x2e')];_0x459d74[_0x1aac('0x4b')]=qs[_0x1aac('0x37')](_0x5728fb['query']['sort']);_0x459d74[_0x1aac('0x38')]=qs[_0x1aac('0x3a')](_['pick'](_0x5728fb[_0x1aac('0x2f')],_0x89e1b7[_0x1aac('0x3a')]));if(_0x5728fb[_0x1aac('0x2f')][_0x1aac('0x3b')]){_0x459d74[_0x1aac('0x38')]=_['merge'](_0x459d74[_0x1aac('0x38')],{'$or':_[_0x1aac('0x28')](_0x459d74[_0x1aac('0x31')],function(_0xdee8d8){var _0x5c67f7={};_0x5c67f7[_0xdee8d8]={'$like':'%'+_0x5728fb['query']['filter']+'%'};return _0x5c67f7;})});}_0x459d74=_[_0x1aac('0x3c')]({},_0x459d74,_0x5728fb['options']);return _0x1d5ef4[_0x1aac('0x4d')](_0x459d74);}})['then'](function(_0x13c392){if(_0x13c392){_0x55b210=_0x13c392['length'];if(!_0x5728fb[_0x1aac('0x2f')][_0x1aac('0x35')](_0x1aac('0x36'))){_0x459d74[_0x1aac('0x1f')]=qs['limit'](_0x5728fb[_0x1aac('0x2f')][_0x1aac('0x1f')]);_0x459d74['offset']=qs[_0x1aac('0x1d')](_0x5728fb['query'][_0x1aac('0x1d')]);}return _0x1d5ef4[_0x1aac('0x4d')](_0x459d74);}})[_0x1aac('0x24')](function(_0x72d478){if(_0x72d478){return _0x72d478?{'count':_0x55b210,'rows':_0x72d478}:null;}})[_0x1aac('0x24')](respondWithResult(_0x140de1,null))[_0x1aac('0x41')](handleError(_0x140de1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0e75feb..e0d13be 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 _0x49fb=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x49fb,0x9c));var _0xb49f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x49fb[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xb49f('0x0'));var util=require(_0xb49f('0x1'));var logger=require('../../config/logger')(_0xb49f('0x2'));var moment=require(_0xb49f('0x3'));var BPromise=require('bluebird');var rp=require(_0xb49f('0x4'));var fs=require('fs');var path=require(_0xb49f('0x5'));var rimraf=require(_0xb49f('0x6'));var config=require(_0xb49f('0x7'));var attributes=require(_0xb49f('0x8'));module[_0xb49f('0x9')]=function(_0x257764,_0x10f002){return _0x257764[_0xb49f('0xa')](_0xb49f('0xb'),attributes,{'tableName':_0xb49f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9998=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1bfba8,_0x4cc896){var _0x3a9d66=function(_0x32aa6a){while(--_0x32aa6a){_0x1bfba8['push'](_0x1bfba8['shift']());}};_0x3a9d66(++_0x4cc896);}(_0x9998,0xf8));var _0x8999=function(_0x5e0d63,_0x321c2e){_0x5e0d63=_0x5e0d63-0x0;var _0x10a581=_0x9998[_0x5e0d63];return _0x10a581;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8999('0x0'))(_0x8999('0x1'));var moment=require(_0x8999('0x2'));var BPromise=require(_0x8999('0x3'));var rp=require(_0x8999('0x4'));var fs=require('fs');var path=require(_0x8999('0x5'));var rimraf=require(_0x8999('0x6'));var config=require(_0x8999('0x7'));var attributes=require(_0x8999('0x8'));module['exports']=function(_0x1d63a2,_0x46e6b0){return _0x1d63a2[_0x8999('0x9')](_0x8999('0xa'),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 13a9d1f..9495a3a 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 _0x08ca=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x254bb6,_0x28d0a8){var _0x32be0b=function(_0x1a2352){while(--_0x1a2352){_0x254bb6['push'](_0x254bb6['shift']());}};_0x32be0b(++_0x28d0a8);}(_0x08ca,0x6a));var _0xa08c=function(_0x4a44e4,_0x51bc71){_0x4a44e4=_0x4a44e4-0x0;var _0x3e0c33=_0x08ca[_0x4a44e4];return _0x3e0c33;};'use strict';var _=require(_0xa08c('0x0'));var util=require('util');var moment=require(_0xa08c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa08c('0x2'));var db=require(_0xa08c('0x3'))['db'];var utils=require(_0xa08c('0x4'));var logger=require(_0xa08c('0x5'))(_0xa08c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd1da,_0x225c33,_0x518b44){return new BPromise(function(_0x570eb1,_0x1f486d){return client[_0xa08c('0x7')](_0xd1da,_0x518b44)[_0xa08c('0x8')](function(_0x47e3da){logger[_0xa08c('0x9')](_0xa08c('0xa'),_0x225c33,_0xa08c('0xb'));logger['debug'](_0xa08c('0xc'),_0x225c33,_0xa08c('0xb'),JSON[_0xa08c('0xd')](_0x47e3da));if(_0x47e3da['error']){if(_0x47e3da[_0xa08c('0xe')]['code']===0x1f4){logger['error'](_0xa08c('0xa'),_0x225c33,_0x47e3da['error']['message']);return _0x1f486d(_0x47e3da[_0xa08c('0xe')][_0xa08c('0xf')]);}logger['error'](_0xa08c('0xa'),_0x225c33,_0x47e3da[_0xa08c('0xe')][_0xa08c('0xf')]);return _0x570eb1(_0x47e3da[_0xa08c('0xe')]['message']);}else{logger[_0xa08c('0x9')](_0xa08c('0xa'),_0x225c33,_0xa08c('0xb'));_0x570eb1(_0x47e3da[_0xa08c('0x10')][_0xa08c('0xf')]);}})[_0xa08c('0x11')](function(_0x63a31a){logger['error'](_0xa08c('0xa'),_0x225c33,_0x63a31a);_0x1f486d(_0x63a31a);});});} \ No newline at end of file +var _0x3444=['randomstring','../../config/utils','../../config/environment','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x21dd50,_0x921f70){var _0x1b7d5e=function(_0x317101){while(--_0x317101){_0x21dd50['push'](_0x21dd50['shift']());}};_0x1b7d5e(++_0x921f70);}(_0x3444,0x166));var _0x4344=function(_0x50a12c,_0x4784e4){_0x50a12c=_0x50a12c-0x0;var _0x476184=_0x3444[_0x50a12c];return _0x476184;};'use strict';var _=require(_0x4344('0x0'));var util=require('util');var moment=require(_0x4344('0x1'));var BPromise=require('bluebird');var rs=require(_0x4344('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4344('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x4344('0x4'));var jayson=require(_0x4344('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x70062d,_0x87e305,_0x377667){return new BPromise(function(_0x80835e,_0x439d54){return client[_0x4344('0x6')](_0x70062d,_0x377667)[_0x4344('0x7')](function(_0x250ff2){logger[_0x4344('0x8')](_0x4344('0x9'),_0x87e305,_0x4344('0xa'));logger[_0x4344('0xb')](_0x4344('0xc'),_0x87e305,_0x4344('0xa'),JSON[_0x4344('0xd')](_0x250ff2));if(_0x250ff2['error']){if(_0x250ff2['error']['code']===0x1f4){logger[_0x4344('0xe')](_0x4344('0x9'),_0x87e305,_0x250ff2[_0x4344('0xe')][_0x4344('0xf')]);return _0x439d54(_0x250ff2[_0x4344('0xe')][_0x4344('0xf')]);}logger[_0x4344('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x87e305,_0x250ff2['error'][_0x4344('0xf')]);return _0x80835e(_0x250ff2['error'][_0x4344('0xf')]);}else{logger[_0x4344('0x8')](_0x4344('0x9'),_0x87e305,_0x4344('0xa'));_0x80835e(_0x250ff2[_0x4344('0x10')][_0x4344('0xf')]);}})[_0x4344('0x11')](function(_0x597945){logger['error'](_0x4344('0x9'),_0x87e305,_0x597945);_0x439d54(_0x597945);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c986243..b3191b6 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 _0x041b=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x57abd0,_0x11171e){var _0x2dd0c3=function(_0x3df00e){while(--_0x3df00e){_0x57abd0['push'](_0x57abd0['shift']());}};_0x2dd0c3(++_0x11171e);}(_0x041b,0x13d));var _0xb041=function(_0x6f33f0,_0x39ae94){_0x6f33f0=_0x6f33f0-0x0;var _0x46b052=_0x041b[_0x6f33f0];return _0x46b052;};'use strict';var multer=require(_0xb041('0x0'));var util=require(_0xb041('0x1'));var path=require('path');var timeout=require(_0xb041('0x2'));var express=require('express');var router=express[_0xb041('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb041('0x4'));var config=require(_0xb041('0x5'));var controller=require(_0xb041('0x6'));router[_0xb041('0x7')]('/',auth[_0xb041('0x8')](),controller[_0xb041('0x9')]);router[_0xb041('0x7')](_0xb041('0xa'),auth['isAuthenticated'](),controller[_0xb041('0xb')]);router[_0xb041('0xc')]('/',auth[_0xb041('0x8')](),controller[_0xb041('0xd')]);router['put'](_0xb041('0xa'),auth[_0xb041('0x8')](),controller[_0xb041('0xe')]);router[_0xb041('0xf')](_0xb041('0xa'),auth[_0xb041('0x8')](),controller[_0xb041('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2f9f=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create','put','update','delete','exports'];(function(_0x33d8f5,_0x3c8786){var _0x4cce93=function(_0x57032d){while(--_0x57032d){_0x33d8f5['push'](_0x33d8f5['shift']());}};_0x4cce93(++_0x3c8786);}(_0x2f9f,0x165));var _0xf2f9=function(_0x178c2a,_0x517cf4){_0x178c2a=_0x178c2a-0x0;var _0x549c06=_0x2f9f[_0x178c2a];return _0x549c06;};'use strict';var multer=require(_0xf2f9('0x0'));var util=require(_0xf2f9('0x1'));var path=require(_0xf2f9('0x2'));var timeout=require(_0xf2f9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf2f9('0x4'));var auth=require(_0xf2f9('0x5'));var interaction=require(_0xf2f9('0x6'));var config=require(_0xf2f9('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf2f9('0x8')]('/',auth['isAuthenticated'](),controller[_0xf2f9('0x9')]);router[_0xf2f9('0x8')](_0xf2f9('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf2f9('0xb')](),controller[_0xf2f9('0xc')]);router[_0xf2f9('0xd')](_0xf2f9('0xa'),auth[_0xf2f9('0xb')](),controller[_0xf2f9('0xe')]);router[_0xf2f9('0xf')](_0xf2f9('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2f9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index bf2006b..17bab8f 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 _0x30e0=['customVariable','keyValue','STRING','ENUM','BOOLEAN','exports','string','variable'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x30e0,0x12d));var _0x030e=function(_0x3a6d3e,_0x4f0ac5){_0x3a6d3e=_0x3a6d3e-0x0;var _0x735896=_0x30e0[_0x3a6d3e];return _0x735896;};'use strict';var Sequelize=require('sequelize');module[_0x030e('0x0')]={'type':{'type':Sequelize['ENUM'](_0x030e('0x1'),_0x030e('0x2'),_0x030e('0x3'),_0x030e('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x030e('0x5')]},'key':{'type':Sequelize[_0x030e('0x5')]},'keyType':{'type':Sequelize[_0x030e('0x6')](_0x030e('0x1'),_0x030e('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x030e('0x5')]},'idField':{'type':Sequelize[_0x030e('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x030e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1af=['variable','customVariable','picklist','string','STRING','exports','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc1af,0xd0));var _0xfc1a=function(_0x82db70,_0x51d2b0){_0x82db70=_0x82db70-0x0;var _0x464eab=_0xc1af[_0x82db70];return _0x464eab;};'use strict';var Sequelize=require('sequelize');module[_0xfc1a('0x0')]={'type':{'type':Sequelize[_0xfc1a('0x1')]('string',_0xfc1a('0x2'),_0xfc1a('0x3'),'keyValue',_0xfc1a('0x4')),'defaultValue':_0xfc1a('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfc1a('0x6')]},'keyType':{'type':Sequelize[_0xfc1a('0x1')](_0xfc1a('0x5'),_0xfc1a('0x2'),_0xfc1a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfc1a('0x6')]},'nameField':{'type':Sequelize[_0xfc1a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc1a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4ad7b1f..a664449 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 _0x65dd=['includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','model','attributes','fields','length','nolimit','order','sort','filters','filter','merge','type','VIRTUAL','options','SugarcrmField'];(function(_0x55520f,_0xc39c6f){var _0xd1ca1f=function(_0x3ef02e){while(--_0x3ef02e){_0x55520f['push'](_0x55520f['shift']());}};_0xd1ca1f(++_0xc39c6f);}(_0x65dd,0x187));var _0xd65d=function(_0x284ee2,_0x2f1746){_0x284ee2=_0x284ee2-0x0;var _0x13e648=_0x65dd[_0x284ee2];return _0x13e648;};'use strict';var emlformat=require(_0xd65d('0x0'));var rimraf=require(_0xd65d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd65d('0x2'));var rp=require('request-promise');var moment=require(_0xd65d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd65d('0x4'));var util=require(_0xd65d('0x5'));var path=require(_0xd65d('0x6'));var sox=require(_0xd65d('0x7'));var csv=require(_0xd65d('0x8'));var ejs=require(_0xd65d('0x9'));var fs=require('fs');var fs_extra=require(_0xd65d('0xa'));var _=require(_0xd65d('0xb'));var squel=require(_0xd65d('0xc'));var crypto=require(_0xd65d('0xd'));var jsforce=require(_0xd65d('0xe'));var deskjs=require(_0xd65d('0xf'));var toCsv=require(_0xd65d('0x8'));var querystring=require(_0xd65d('0x10'));var Papa=require(_0xd65d('0x11'));var Redis=require('ioredis');var authService=require(_0xd65d('0x12'));var qs=require(_0xd65d('0x13'));var as=require(_0xd65d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd65d('0x15'))('api');var utils=require(_0xd65d('0x16'));var config=require(_0xd65d('0x17'));var licenseUtil=require(_0xd65d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27448f,_0x55092c){_0x55092c=_0x55092c||0xcc;return function(_0x248287){if(_0x248287){return _0x27448f['sendStatus'](_0x55092c);}return _0x27448f[_0xd65d('0x19')](_0x55092c)[_0xd65d('0x1a')]();};}function respondWithResult(_0x901cc1,_0x2476ce){_0x2476ce=_0x2476ce||0xc8;return function(_0x2b4935){if(_0x2b4935){return _0x901cc1[_0xd65d('0x19')](_0x2476ce)[_0xd65d('0x1b')](_0x2b4935);}};}function respondWithFilteredResult(_0x165941,_0x1b3781){return function(_0x2418de){if(_0x2418de){var _0x4e97cf=typeof _0x1b3781[_0xd65d('0x1c')]==='undefined'&&typeof _0x1b3781['limit']===_0xd65d('0x1d');var _0x3e0b6a=_0x2418de[_0xd65d('0x1e')];var _0x57cfa6=_0x4e97cf?0x0:_0x1b3781[_0xd65d('0x1c')];var _0x174e48=_0x4e97cf?_0x2418de[_0xd65d('0x1e')]:_0x1b3781[_0xd65d('0x1c')]+_0x1b3781[_0xd65d('0x1f')];var _0x5371bf;if(_0x174e48>=_0x3e0b6a){_0x174e48=_0x3e0b6a;_0x5371bf=0xc8;}else{_0x5371bf=0xce;}_0x165941[_0xd65d('0x19')](_0x5371bf);return _0x165941[_0xd65d('0x20')](_0xd65d('0x21'),_0x57cfa6+'-'+_0x174e48+'/'+_0x3e0b6a)[_0xd65d('0x1b')](_0x2418de);}return null;};}function patchUpdates(_0x26e27b){return function(_0x3c487b){try{jsonpatch[_0xd65d('0x22')](_0x3c487b,_0x26e27b,!![]);}catch(_0x325dfd){return BPromise[_0xd65d('0x23')](_0x325dfd);}return _0x3c487b[_0xd65d('0x24')]();};}function saveUpdates(_0x5e86d2,_0x184aea){return function(_0x5db560){if(_0x5db560){return _0x5db560[_0xd65d('0x25')](_0x5e86d2)[_0xd65d('0x26')](function(_0x1d6b5a){return _0x1d6b5a;});}return null;};}function removeEntity(_0x3f7f3a,_0x1fd2f0){return function(_0x201331){if(_0x201331){return _0x201331['destroy']()[_0xd65d('0x26')](function(){_0x3f7f3a[_0xd65d('0x19')](0xcc)[_0xd65d('0x1a')]();});}};}function handleEntityNotFound(_0x1b335d,_0x1b1bc7){return function(_0x78e70c){if(!_0x78e70c){_0x1b335d[_0xd65d('0x27')](0x194);}return _0x78e70c;};}function handleError(_0xf5883a,_0x1c43f8){_0x1c43f8=_0x1c43f8||0x1f4;return function(_0x515910){logger[_0xd65d('0x28')](_0x515910[_0xd65d('0x29')]);if(_0x515910[_0xd65d('0x2a')]){delete _0x515910[_0xd65d('0x2a')];}_0xf5883a['status'](_0x1c43f8)[_0xd65d('0x2b')](_0x515910);};}exports[_0xd65d('0x2c')]=function(_0x1053b1,_0xaa3c5f){var _0x4c5ed7={},_0x1c6e8f={},_0x110f64={'count':0x0,'rows':[]};var _0x2a95bd=_['map'](db['SugarcrmField'][_0xd65d('0x2d')],function(_0x12594b){return{'name':_0x12594b[_0xd65d('0x2e')],'type':_0x12594b['type'][_0xd65d('0x2f')]};});_0x1c6e8f['model']=_[_0xd65d('0x30')](_0x2a95bd,_0xd65d('0x2a'));_0x1c6e8f[_0xd65d('0x31')]=_[_0xd65d('0x32')](_0x1053b1[_0xd65d('0x31')]);_0x1c6e8f['filters']=_['intersection'](_0x1c6e8f[_0xd65d('0x33')],_0x1c6e8f['query']);_0x4c5ed7[_0xd65d('0x34')]=_['intersection'](_0x1c6e8f[_0xd65d('0x33')],qs[_0xd65d('0x35')](_0x1053b1[_0xd65d('0x31')][_0xd65d('0x35')]));_0x4c5ed7[_0xd65d('0x34')]=_0x4c5ed7[_0xd65d('0x34')][_0xd65d('0x36')]?_0x4c5ed7[_0xd65d('0x34')]:_0x1c6e8f['model'];if(!_0x1053b1[_0xd65d('0x31')]['hasOwnProperty'](_0xd65d('0x37'))){_0x4c5ed7[_0xd65d('0x1f')]=qs[_0xd65d('0x1f')](_0x1053b1['query'][_0xd65d('0x1f')]);_0x4c5ed7[_0xd65d('0x1c')]=qs[_0xd65d('0x1c')](_0x1053b1['query'][_0xd65d('0x1c')]);}_0x4c5ed7[_0xd65d('0x38')]=qs['sort'](_0x1053b1[_0xd65d('0x31')][_0xd65d('0x39')]);_0x4c5ed7['where']=qs[_0xd65d('0x3a')](_['pick'](_0x1053b1[_0xd65d('0x31')],_0x1c6e8f[_0xd65d('0x3a')]),_0x2a95bd);if(_0x1053b1[_0xd65d('0x31')][_0xd65d('0x3b')]){_0x4c5ed7['where']=_[_0xd65d('0x3c')](_0x4c5ed7['where'],{'$or':_[_0xd65d('0x30')](_0x2a95bd,function(_0x39cc8e){if(_0x39cc8e[_0xd65d('0x3d')]!==_0xd65d('0x3e')){var _0x4b7698={};_0x4b7698[_0x39cc8e['name']]={'$like':'%'+_0x1053b1['query'][_0xd65d('0x3b')]+'%'};return _0x4b7698;}})});}_0x4c5ed7=_[_0xd65d('0x3c')]({},_0x4c5ed7,_0x1053b1[_0xd65d('0x3f')]);var _0x1acc95={'where':_0x4c5ed7['where']};return db[_0xd65d('0x40')][_0xd65d('0x1e')](_0x1acc95)[_0xd65d('0x26')](function(_0x38b3ce){_0x110f64[_0xd65d('0x1e')]=_0x38b3ce;if(_0x1053b1[_0xd65d('0x31')][_0xd65d('0x41')]){_0x4c5ed7[_0xd65d('0x42')]=[{'all':!![]}];}return db[_0xd65d('0x40')][_0xd65d('0x43')](_0x4c5ed7);})[_0xd65d('0x26')](function(_0x5c1b5f){_0x110f64[_0xd65d('0x44')]=_0x5c1b5f;return _0x110f64;})[_0xd65d('0x26')](respondWithFilteredResult(_0xaa3c5f,_0x4c5ed7))[_0xd65d('0x45')](handleError(_0xaa3c5f,null));};exports[_0xd65d('0x46')]=function(_0x16598a,_0x126471){var _0x5d2040={'raw':!![],'where':{'id':_0x16598a[_0xd65d('0x47')]['id']}},_0xbe7a62={};_0xbe7a62[_0xd65d('0x33')]=_[_0xd65d('0x32')](db[_0xd65d('0x40')]['rawAttributes']);_0xbe7a62[_0xd65d('0x31')]=_['keys'](_0x16598a[_0xd65d('0x31')]);_0xbe7a62[_0xd65d('0x3a')]=_['intersection'](_0xbe7a62['model'],_0xbe7a62[_0xd65d('0x31')]);_0x5d2040[_0xd65d('0x34')]=_['intersection'](_0xbe7a62['model'],qs[_0xd65d('0x35')](_0x16598a[_0xd65d('0x31')][_0xd65d('0x35')]));_0x5d2040[_0xd65d('0x34')]=_0x5d2040[_0xd65d('0x34')][_0xd65d('0x36')]?_0x5d2040[_0xd65d('0x34')]:_0xbe7a62[_0xd65d('0x33')];if(_0x16598a['query']['includeAll']){_0x5d2040[_0xd65d('0x42')]=[{'all':!![]}];}_0x5d2040=_['merge']({},_0x5d2040,_0x16598a[_0xd65d('0x3f')]);return db['SugarcrmField'][_0xd65d('0x48')](_0x5d2040)[_0xd65d('0x26')](handleEntityNotFound(_0x126471,null))['then'](respondWithResult(_0x126471,null))[_0xd65d('0x45')](handleError(_0x126471,null));};exports[_0xd65d('0x49')]=function(_0x59bdb4,_0x145486){return db[_0xd65d('0x40')][_0xd65d('0x49')](_0x59bdb4[_0xd65d('0x4a')],{})[_0xd65d('0x26')](respondWithResult(_0x145486,0xc9))[_0xd65d('0x45')](handleError(_0x145486,null));};exports[_0xd65d('0x25')]=function(_0x3de4d5,_0x30e102){if(_0x3de4d5['body']['id']){delete _0x3de4d5['body']['id'];}return db[_0xd65d('0x40')][_0xd65d('0x48')]({'where':{'id':_0x3de4d5[_0xd65d('0x47')]['id']}})['then'](handleEntityNotFound(_0x30e102,null))[_0xd65d('0x26')](saveUpdates(_0x3de4d5[_0xd65d('0x4a')],null))['then'](respondWithResult(_0x30e102,null))[_0xd65d('0x45')](handleError(_0x30e102,null));};exports[_0xd65d('0x4b')]=function(_0x417b63,_0xdfa5cb){return db[_0xd65d('0x40')][_0xd65d('0x48')]({'where':{'id':_0x417b63[_0xd65d('0x47')]['id']}})[_0xd65d('0x26')](handleEntityNotFound(_0xdfa5cb,null))[_0xd65d('0x26')](removeEntity(_0xdfa5cb,null))[_0xd65d('0x45')](handleError(_0xdfa5cb,null));}; \ No newline at end of file +var _0xcf12=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','map','SugarcrmField','fieldName','key','model','intersection','attributes','fields','length','query','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x179d06,_0x13788d){var _0x52c18f=function(_0x4a90c9){while(--_0x4a90c9){_0x179d06['push'](_0x179d06['shift']());}};_0x52c18f(++_0x13788d);}(_0xcf12,0x1ab));var _0x2cf1=function(_0x3758bc,_0x40e87e){_0x3758bc=_0x3758bc-0x0;var _0x158922=_0xcf12[_0x3758bc];return _0x158922;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2cf1('0x0'));var zipdir=require(_0x2cf1('0x1'));var jsonpatch=require(_0x2cf1('0x2'));var rp=require(_0x2cf1('0x3'));var moment=require(_0x2cf1('0x4'));var BPromise=require(_0x2cf1('0x5'));var Mustache=require('mustache');var util=require(_0x2cf1('0x6'));var path=require(_0x2cf1('0x7'));var sox=require(_0x2cf1('0x8'));var csv=require(_0x2cf1('0x9'));var ejs=require(_0x2cf1('0xa'));var fs=require('fs');var fs_extra=require(_0x2cf1('0xb'));var _=require(_0x2cf1('0xc'));var squel=require(_0x2cf1('0xd'));var crypto=require(_0x2cf1('0xe'));var jsforce=require(_0x2cf1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2cf1('0x9'));var querystring=require(_0x2cf1('0x10'));var Papa=require(_0x2cf1('0x11'));var Redis=require(_0x2cf1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2cf1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cf1('0x14'));var logger=require(_0x2cf1('0x15'))(_0x2cf1('0x16'));var utils=require(_0x2cf1('0x17'));var config=require(_0x2cf1('0x18'));var licenseUtil=require(_0x2cf1('0x19'));var db=require(_0x2cf1('0x1a'))['db'];function respondWithStatusCode(_0x2f83a0,_0x560c28){_0x560c28=_0x560c28||0xcc;return function(_0x1510ee){if(_0x1510ee){return _0x2f83a0[_0x2cf1('0x1b')](_0x560c28);}return _0x2f83a0['status'](_0x560c28)[_0x2cf1('0x1c')]();};}function respondWithResult(_0x4e2be9,_0x470370){_0x470370=_0x470370||0xc8;return function(_0x3d9872){if(_0x3d9872){return _0x4e2be9[_0x2cf1('0x1d')](_0x470370)[_0x2cf1('0x1e')](_0x3d9872);}};}function respondWithFilteredResult(_0x53a654,_0x1185f1){return function(_0x3f5268){if(_0x3f5268){var _0x4b98af=typeof _0x1185f1[_0x2cf1('0x1f')]==='undefined'&&typeof _0x1185f1[_0x2cf1('0x20')]===_0x2cf1('0x21');var _0x58312b=_0x3f5268[_0x2cf1('0x22')];var _0x2c54a0=_0x4b98af?0x0:_0x1185f1['offset'];var _0x15f830=_0x4b98af?_0x3f5268[_0x2cf1('0x22')]:_0x1185f1[_0x2cf1('0x1f')]+_0x1185f1['limit'];var _0x2bdda1;if(_0x15f830>=_0x58312b){_0x15f830=_0x58312b;_0x2bdda1=0xc8;}else{_0x2bdda1=0xce;}_0x53a654['status'](_0x2bdda1);return _0x53a654[_0x2cf1('0x23')]('Content-Range',_0x2c54a0+'-'+_0x15f830+'/'+_0x58312b)['json'](_0x3f5268);}return null;};}function patchUpdates(_0x3965c0){return function(_0x10d4c3){try{jsonpatch[_0x2cf1('0x24')](_0x10d4c3,_0x3965c0,!![]);}catch(_0x2a97bd){return BPromise['reject'](_0x2a97bd);}return _0x10d4c3[_0x2cf1('0x25')]();};}function saveUpdates(_0x4b1abd,_0x37d70b){return function(_0x34b6c9){if(_0x34b6c9){return _0x34b6c9[_0x2cf1('0x26')](_0x4b1abd)[_0x2cf1('0x27')](function(_0x431290){return _0x431290;});}return null;};}function removeEntity(_0x52c613,_0x4890d0){return function(_0x14a6e6){if(_0x14a6e6){return _0x14a6e6[_0x2cf1('0x28')]()[_0x2cf1('0x27')](function(){_0x52c613[_0x2cf1('0x1d')](0xcc)[_0x2cf1('0x1c')]();});}};}function handleEntityNotFound(_0x403eb7,_0x6f0c6d){return function(_0x43eb21){if(!_0x43eb21){_0x403eb7[_0x2cf1('0x1b')](0x194);}return _0x43eb21;};}function handleError(_0xa07aec,_0x4dd84b){_0x4dd84b=_0x4dd84b||0x1f4;return function(_0x4c7aae){logger[_0x2cf1('0x29')](_0x4c7aae[_0x2cf1('0x2a')]);if(_0x4c7aae[_0x2cf1('0x2b')]){delete _0x4c7aae['name'];}_0xa07aec['status'](_0x4dd84b)[_0x2cf1('0x2c')](_0x4c7aae);};}exports['index']=function(_0x101be7,_0x40bd82){var _0x32b69e={},_0x1d5341={},_0x2891c5={'count':0x0,'rows':[]};var _0x45a067=_[_0x2cf1('0x2d')](db[_0x2cf1('0x2e')]['rawAttributes'],function(_0x16772b){return{'name':_0x16772b[_0x2cf1('0x2f')],'type':_0x16772b['type'][_0x2cf1('0x30')]};});_0x1d5341[_0x2cf1('0x31')]=_['map'](_0x45a067,_0x2cf1('0x2b'));_0x1d5341['query']=_['keys'](_0x101be7['query']);_0x1d5341['filters']=_[_0x2cf1('0x32')](_0x1d5341[_0x2cf1('0x31')],_0x1d5341['query']);_0x32b69e[_0x2cf1('0x33')]=_[_0x2cf1('0x32')](_0x1d5341[_0x2cf1('0x31')],qs['fields'](_0x101be7['query'][_0x2cf1('0x34')]));_0x32b69e[_0x2cf1('0x33')]=_0x32b69e[_0x2cf1('0x33')][_0x2cf1('0x35')]?_0x32b69e['attributes']:_0x1d5341[_0x2cf1('0x31')];if(!_0x101be7[_0x2cf1('0x36')]['hasOwnProperty']('nolimit')){_0x32b69e[_0x2cf1('0x20')]=qs['limit'](_0x101be7[_0x2cf1('0x36')][_0x2cf1('0x20')]);_0x32b69e[_0x2cf1('0x1f')]=qs[_0x2cf1('0x1f')](_0x101be7[_0x2cf1('0x36')][_0x2cf1('0x1f')]);}_0x32b69e[_0x2cf1('0x37')]=qs[_0x2cf1('0x38')](_0x101be7['query'][_0x2cf1('0x38')]);_0x32b69e[_0x2cf1('0x39')]=qs[_0x2cf1('0x3a')](_[_0x2cf1('0x3b')](_0x101be7['query'],_0x1d5341[_0x2cf1('0x3a')]),_0x45a067);if(_0x101be7['query'][_0x2cf1('0x3c')]){_0x32b69e[_0x2cf1('0x39')]=_[_0x2cf1('0x3d')](_0x32b69e['where'],{'$or':_[_0x2cf1('0x2d')](_0x45a067,function(_0x455a26){if(_0x455a26[_0x2cf1('0x3e')]!==_0x2cf1('0x3f')){var _0x311205={};_0x311205[_0x455a26[_0x2cf1('0x2b')]]={'$like':'%'+_0x101be7['query']['filter']+'%'};return _0x311205;}})});}_0x32b69e=_[_0x2cf1('0x3d')]({},_0x32b69e,_0x101be7[_0x2cf1('0x40')]);var _0x48494f={'where':_0x32b69e[_0x2cf1('0x39')]};return db[_0x2cf1('0x2e')][_0x2cf1('0x22')](_0x48494f)['then'](function(_0x30e2c2){_0x2891c5[_0x2cf1('0x22')]=_0x30e2c2;if(_0x101be7['query']['includeAll']){_0x32b69e[_0x2cf1('0x41')]=[{'all':!![]}];}return db['SugarcrmField'][_0x2cf1('0x42')](_0x32b69e);})[_0x2cf1('0x27')](function(_0x2d1d0a){_0x2891c5['rows']=_0x2d1d0a;return _0x2891c5;})[_0x2cf1('0x27')](respondWithFilteredResult(_0x40bd82,_0x32b69e))[_0x2cf1('0x43')](handleError(_0x40bd82,null));};exports[_0x2cf1('0x44')]=function(_0x5bccd3,_0x59b86b){var _0x12ff01={'raw':!![],'where':{'id':_0x5bccd3[_0x2cf1('0x45')]['id']}},_0x1aba6b={};_0x1aba6b[_0x2cf1('0x31')]=_['keys'](db[_0x2cf1('0x2e')][_0x2cf1('0x46')]);_0x1aba6b['query']=_['keys'](_0x5bccd3[_0x2cf1('0x36')]);_0x1aba6b[_0x2cf1('0x3a')]=_[_0x2cf1('0x32')](_0x1aba6b[_0x2cf1('0x31')],_0x1aba6b[_0x2cf1('0x36')]);_0x12ff01[_0x2cf1('0x33')]=_[_0x2cf1('0x32')](_0x1aba6b['model'],qs[_0x2cf1('0x34')](_0x5bccd3[_0x2cf1('0x36')]['fields']));_0x12ff01[_0x2cf1('0x33')]=_0x12ff01[_0x2cf1('0x33')][_0x2cf1('0x35')]?_0x12ff01['attributes']:_0x1aba6b[_0x2cf1('0x31')];if(_0x5bccd3['query'][_0x2cf1('0x47')]){_0x12ff01[_0x2cf1('0x41')]=[{'all':!![]}];}_0x12ff01=_[_0x2cf1('0x3d')]({},_0x12ff01,_0x5bccd3['options']);return db[_0x2cf1('0x2e')][_0x2cf1('0x48')](_0x12ff01)[_0x2cf1('0x27')](handleEntityNotFound(_0x59b86b,null))[_0x2cf1('0x27')](respondWithResult(_0x59b86b,null))[_0x2cf1('0x43')](handleError(_0x59b86b,null));};exports[_0x2cf1('0x49')]=function(_0x13fffa,_0x56f9ce){return db['SugarcrmField'][_0x2cf1('0x49')](_0x13fffa['body'],{})['then'](respondWithResult(_0x56f9ce,0xc9))[_0x2cf1('0x43')](handleError(_0x56f9ce,null));};exports[_0x2cf1('0x26')]=function(_0x3f9c54,_0x3a7aa6){if(_0x3f9c54[_0x2cf1('0x4a')]['id']){delete _0x3f9c54['body']['id'];}return db[_0x2cf1('0x2e')][_0x2cf1('0x48')]({'where':{'id':_0x3f9c54[_0x2cf1('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a7aa6,null))[_0x2cf1('0x27')](saveUpdates(_0x3f9c54[_0x2cf1('0x4a')],null))['then'](respondWithResult(_0x3a7aa6,null))[_0x2cf1('0x43')](handleError(_0x3a7aa6,null));};exports[_0x2cf1('0x28')]=function(_0x981952,_0xaf7f7a){return db[_0x2cf1('0x2e')][_0x2cf1('0x48')]({'where':{'id':_0x981952[_0x2cf1('0x45')]['id']}})[_0x2cf1('0x27')](handleEntityNotFound(_0xaf7f7a,null))['then'](removeEntity(_0xaf7f7a,null))['catch'](handleError(_0xaf7f7a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index fc40edb..dc495dc 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 _0x4e2d=['bluebird','../../config/environment','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x5451f9,_0x34b46c){var _0x21ba78=function(_0x1433fc){while(--_0x1433fc){_0x5451f9['push'](_0x5451f9['shift']());}};_0x21ba78(++_0x34b46c);}(_0x4e2d,0x76));var _0xd4e2=function(_0x3b2b7c,_0x10f7ad){_0x3b2b7c=_0x3b2b7c-0x0;var _0xb2158e=_0x4e2d[_0x3b2b7c];return _0xb2158e;};'use strict';var _=require(_0xd4e2('0x0'));var util=require('util');var logger=require(_0xd4e2('0x1'))('api');var moment=require(_0xd4e2('0x2'));var BPromise=require(_0xd4e2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd4e2('0x4'));var attributes=require('./intSugarcrmField.attributes');module[_0xd4e2('0x5')]=function(_0x2b4c91,_0xabb35c){return _0x2b4c91[_0xd4e2('0x6')]('SugarcrmField',attributes,{'tableName':_0xd4e2('0x7'),'paranoid':![],'indexes':[{'name':_0xd4e2('0x8'),'fields':[_0xd4e2('0x9'),_0xd4e2('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbd8=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0xfbd8,0xeb));var _0x8fbd=function(_0x7427dd,_0x14d109){_0x7427dd=_0x7427dd-0x0;var _0x34697b=_0xfbd8[_0x7427dd];return _0x34697b;};'use strict';var _=require(_0x8fbd('0x0'));var util=require(_0x8fbd('0x1'));var logger=require(_0x8fbd('0x2'))(_0x8fbd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8fbd('0x4'));var fs=require('fs');var path=require(_0x8fbd('0x5'));var rimraf=require(_0x8fbd('0x6'));var config=require(_0x8fbd('0x7'));var attributes=require(_0x8fbd('0x8'));module[_0x8fbd('0x9')]=function(_0x892c3f,_0x419546){return _0x892c3f[_0x8fbd('0xa')](_0x8fbd('0xb'),attributes,{'tableName':_0x8fbd('0xc'),'paranoid':![],'indexes':[{'name':_0x8fbd('0xd'),'fields':[_0x8fbd('0xe'),_0x8fbd('0xf')],'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 b68bbaa..a5e6b43 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 _0x4aad=['rpc','jayson/promise','client','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2656a4,_0x28dd1b){var _0x48ce85=function(_0x41d957){while(--_0x41d957){_0x2656a4['push'](_0x2656a4['shift']());}};_0x48ce85(++_0x28dd1b);}(_0x4aad,0x188));var _0xd4aa=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x4aad[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0xd4aa('0x0'));var moment=require(_0xd4aa('0x1'));var BPromise=require(_0xd4aa('0x2'));var rs=require(_0xd4aa('0x3'));var fs=require('fs');var Redis=require(_0xd4aa('0x4'));var db=require(_0xd4aa('0x5'))['db'];var utils=require(_0xd4aa('0x6'));var logger=require(_0xd4aa('0x7'))(_0xd4aa('0x8'));var config=require('../../config/environment');var jayson=require(_0xd4aa('0x9'));var client=jayson[_0xd4aa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17d51c,_0x1f5312,_0x48c57f){return new BPromise(function(_0x2753a8,_0x236cff){return client['request'](_0x17d51c,_0x48c57f)[_0xd4aa('0xb')](function(_0x5070b1){logger['info'](_0xd4aa('0xc'),_0x1f5312,_0xd4aa('0xd'));logger[_0xd4aa('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x1f5312,_0xd4aa('0xd'),JSON['stringify'](_0x5070b1));if(_0x5070b1[_0xd4aa('0xf')]){if(_0x5070b1[_0xd4aa('0xf')][_0xd4aa('0x10')]===0x1f4){logger[_0xd4aa('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x1f5312,_0x5070b1['error'][_0xd4aa('0x11')]);return _0x236cff(_0x5070b1[_0xd4aa('0xf')]['message']);}logger[_0xd4aa('0xf')](_0xd4aa('0xc'),_0x1f5312,_0x5070b1[_0xd4aa('0xf')][_0xd4aa('0x11')]);return _0x2753a8(_0x5070b1['error'][_0xd4aa('0x11')]);}else{logger[_0xd4aa('0x12')](_0xd4aa('0xc'),_0x1f5312,_0xd4aa('0xd'));_0x2753a8(_0x5070b1['result'][_0xd4aa('0x11')]);}})[_0xd4aa('0x13')](function(_0x365acd){logger[_0xd4aa('0xf')](_0xd4aa('0xc'),_0x1f5312,_0x365acd);_0x236cff(_0x365acd);});});} \ No newline at end of file +var _0x5d28=['jayson/promise','client','http','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0x5d28,0x19e));var _0x85d2=function(_0x2623af,_0x133623){_0x2623af=_0x2623af-0x0;var _0x37ed80=_0x5d28[_0x2623af];return _0x37ed80;};'use strict';var _=require(_0x85d2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d2('0x1'));var db=require(_0x85d2('0x2'))['db'];var utils=require(_0x85d2('0x3'));var logger=require(_0x85d2('0x4'))(_0x85d2('0x5'));var config=require('../../config/environment');var jayson=require(_0x85d2('0x6'));var client=jayson[_0x85d2('0x7')][_0x85d2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5545f0,_0x4cf098,_0x4a8afe){return new BPromise(function(_0x1871f4,_0x2a935b){return client['request'](_0x5545f0,_0x4a8afe)[_0x85d2('0x9')](function(_0x2e103d){logger[_0x85d2('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x4cf098,_0x85d2('0xb'));logger[_0x85d2('0xc')](_0x85d2('0xd'),_0x4cf098,_0x85d2('0xb'),JSON[_0x85d2('0xe')](_0x2e103d));if(_0x2e103d[_0x85d2('0xf')]){if(_0x2e103d['error'][_0x85d2('0x10')]===0x1f4){logger['error'](_0x85d2('0x11'),_0x4cf098,_0x2e103d['error'][_0x85d2('0x12')]);return _0x2a935b(_0x2e103d[_0x85d2('0xf')][_0x85d2('0x12')]);}logger[_0x85d2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x4cf098,_0x2e103d['error'][_0x85d2('0x12')]);return _0x1871f4(_0x2e103d['error']['message']);}else{logger[_0x85d2('0xa')](_0x85d2('0x11'),_0x4cf098,_0x85d2('0xb'));_0x1871f4(_0x2e103d[_0x85d2('0x13')]['message']);}})[_0x85d2('0x14')](function(_0x3a5881){logger[_0x85d2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x4cf098,_0x3a5881);_0x2a935b(_0x3a5881);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ed690eb..d97e0c3 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 _0xc770=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','isAuthenticated','/:id/configurations','/:id/fields','post','create','addConfiguration','put','/:id','destroy'];(function(_0x2682e5,_0xbeaa9b){var _0x3417bd=function(_0x497960){while(--_0x497960){_0x2682e5['push'](_0x2682e5['shift']());}};_0x3417bd(++_0xbeaa9b);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c77('0x2'));var router=express[_0x0c77('0x3')]();var fs_extra=require(_0x0c77('0x4'));var auth=require(_0x0c77('0x5'));var interaction=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var controller=require(_0x0c77('0x8'));router[_0x0c77('0x9')]('/',auth['isAuthenticated'](),controller[_0x0c77('0xa')]);router[_0x0c77('0x9')]('/:id',auth[_0x0c77('0xb')](),controller['show']);router[_0x0c77('0x9')](_0x0c77('0xc'),auth[_0x0c77('0xb')](),controller['getConfigurations']);router[_0x0c77('0x9')](_0x0c77('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x0c77('0xe')]('/',auth['isAuthenticated'](),controller[_0x0c77('0xf')]);router[_0x0c77('0xe')]('/:id/configurations',auth[_0x0c77('0xb')](),controller[_0x0c77('0x10')]);router[_0x0c77('0x11')](_0x0c77('0x12'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0c77('0x12'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x13')]);module[_0x0c77('0x14')]=router; \ No newline at end of file +var _0x30ff=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x4e27cc,_0x8eca75){var _0x5e2fac=function(_0x993d76){while(--_0x993d76){_0x4e27cc['push'](_0x4e27cc['shift']());}};_0x5e2fac(++_0x8eca75);}(_0x30ff,0x6a));var _0xf30f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x30ff[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0xf30f('0x0'));var path=require(_0xf30f('0x1'));var timeout=require(_0xf30f('0x2'));var express=require(_0xf30f('0x3'));var router=express[_0xf30f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf30f('0x5'));var interaction=require(_0xf30f('0x6'));var config=require('../../config/environment');var controller=require(_0xf30f('0x7'));router[_0xf30f('0x8')]('/',auth[_0xf30f('0x9')](),controller['index']);router[_0xf30f('0x8')](_0xf30f('0xa'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xb')]);router['get'](_0xf30f('0xc'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xd')]);router[_0xf30f('0x8')](_0xf30f('0xe'),auth[_0xf30f('0x9')](),controller[_0xf30f('0xf')]);router[_0xf30f('0x10')]('/',auth[_0xf30f('0x9')](),controller[_0xf30f('0x11')]);router[_0xf30f('0x10')](_0xf30f('0xc'),auth['isAuthenticated'](),controller[_0xf30f('0x12')]);router[_0xf30f('0x13')](_0xf30f('0xa'),auth['isAuthenticated'](),controller[_0xf30f('0x14')]);router[_0xf30f('0x15')](_0xf30f('0xa'),auth['isAuthenticated'](),controller[_0xf30f('0x16')]);module[_0xf30f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 4665746..7e5f58a 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 _0x5276=['STRING','HelpDesk','exports'];(function(_0x59240f,_0x52a159){var _0xcf2315=function(_0x93dbc5){while(--_0x93dbc5){_0x59240f['push'](_0x59240f['shift']());}};_0xcf2315(++_0x52a159);}(_0x5276,0x14c));var _0x6527=function(_0x305c2f,_0x306f52){_0x305c2f=_0x305c2f-0x0;var _0x1ad4fc=_0x5276[_0x305c2f];return _0x1ad4fc;};'use strict';var Sequelize=require('sequelize');module[_0x6527('0x0')]={'name':{'type':Sequelize[_0x6527('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6527('0x1')]},'username':{'type':Sequelize[_0x6527('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6527('0x1')],'allowNull':![],'defaultValue':_0x6527('0x2')},'remoteUri':{'type':Sequelize[_0x6527('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6527('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc61a=['STRING','HelpDesk','exports'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xc61a,0xdd));var _0xac61=function(_0x487cac,_0x492185){_0x487cac=_0x487cac-0x0;var _0x1256b0=_0xc61a[_0x487cac];return _0x1256b0;};'use strict';var Sequelize=require('sequelize');module[_0xac61('0x0')]={'name':{'type':Sequelize[_0xac61('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xac61('0x1')]},'username':{'type':Sequelize[_0xac61('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xac61('0x1')],'allowNull':![],'defaultValue':_0xac61('0x2')},'remoteUri':{'type':Sequelize[_0xac61('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xac61('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xac61('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 50230f7..cd98488 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 _0x16e6=['update','destroy','getConfigurations','VtigerConfiguration','order','pick','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','describe','result','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','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/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','then','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','body'];(function(_0x2726fe,_0x270860){var _0x37108e=function(_0x65dd65){while(--_0x65dd65){_0x2726fe['push'](_0x2726fe['shift']());}};_0x37108e(++_0x270860);}(_0x16e6,0x1ba));var _0x616e=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x16e6[_0x23ec06];return _0x2831d4;};'use strict';var emlformat=require(_0x616e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x616e('0x1'));var jsonpatch=require(_0x616e('0x2'));var rp=require(_0x616e('0x3'));var moment=require(_0x616e('0x4'));var BPromise=require(_0x616e('0x5'));var Mustache=require(_0x616e('0x6'));var util=require(_0x616e('0x7'));var path=require('path');var sox=require(_0x616e('0x8'));var csv=require(_0x616e('0x9'));var ejs=require(_0x616e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x616e('0xb'));var squel=require(_0x616e('0xc'));var crypto=require(_0x616e('0xd'));var jsforce=require(_0x616e('0xe'));var deskjs=require(_0x616e('0xf'));var toCsv=require(_0x616e('0x9'));var querystring=require(_0x616e('0x10'));var Papa=require('papaparse');var Redis=require(_0x616e('0x11'));var authService=require(_0x616e('0x12'));var qs=require(_0x616e('0x13'));var as=require(_0x616e('0x14'));var hardwareService=require(_0x616e('0x15'));var logger=require('../../config/logger')(_0x616e('0x16'));var utils=require('../../config/utils');var config=require(_0x616e('0x17'));var licenseUtil=require(_0x616e('0x18'));var db=require(_0x616e('0x19'))['db'];var integrations=require(_0x616e('0x1a'));function respondWithStatusCode(_0x3aa021,_0x34e5a9){_0x34e5a9=_0x34e5a9||0xcc;return function(_0x3cfbe9){if(_0x3cfbe9){return _0x3aa021[_0x616e('0x1b')](_0x34e5a9);}return _0x3aa021['status'](_0x34e5a9)[_0x616e('0x1c')]();};}function respondWithResult(_0xb5cd73,_0x37c1fc){_0x37c1fc=_0x37c1fc||0xc8;return function(_0xda2a20){if(_0xda2a20){return _0xb5cd73['status'](_0x37c1fc)['json'](_0xda2a20);}};}function respondWithFilteredResult(_0x2f7b31,_0x4315b7){return function(_0x274d7d){if(_0x274d7d){var _0x444be5=typeof _0x4315b7[_0x616e('0x1d')]===_0x616e('0x1e')&&typeof _0x4315b7[_0x616e('0x1f')]===_0x616e('0x1e');var _0x2c4a53=_0x274d7d[_0x616e('0x20')];var _0x136f60=_0x444be5?0x0:_0x4315b7[_0x616e('0x1d')];var _0x9bbded=_0x444be5?_0x274d7d['count']:_0x4315b7[_0x616e('0x1d')]+_0x4315b7[_0x616e('0x1f')];var _0x35406a;if(_0x9bbded>=_0x2c4a53){_0x9bbded=_0x2c4a53;_0x35406a=0xc8;}else{_0x35406a=0xce;}_0x2f7b31[_0x616e('0x21')](_0x35406a);return _0x2f7b31[_0x616e('0x22')](_0x616e('0x23'),_0x136f60+'-'+_0x9bbded+'/'+_0x2c4a53)[_0x616e('0x24')](_0x274d7d);}return null;};}function patchUpdates(_0x25c8ef){return function(_0x29c104){try{jsonpatch[_0x616e('0x25')](_0x29c104,_0x25c8ef,!![]);}catch(_0x3728c6){return BPromise[_0x616e('0x26')](_0x3728c6);}return _0x29c104['save']();};}function saveUpdates(_0x5cc71d,_0xd1cc1e){return function(_0x508338){if(_0x508338){return _0x508338['update'](_0x5cc71d)[_0x616e('0x27')](function(_0x1d9027){return _0x1d9027;});}return null;};}function removeEntity(_0x4ac358,_0x8a462e){return function(_0x2db737){if(_0x2db737){return _0x2db737['destroy']()['then'](function(){_0x4ac358[_0x616e('0x21')](0xcc)[_0x616e('0x1c')]();});}};}function handleEntityNotFound(_0x3c7e45,_0x599c20){return function(_0xc347a2){if(!_0xc347a2){_0x3c7e45[_0x616e('0x1b')](0x194);}return _0xc347a2;};}function handleError(_0x398463,_0x516aba){_0x516aba=_0x516aba||0x1f4;return function(_0x4c8908){logger[_0x616e('0x28')](_0x4c8908[_0x616e('0x29')]);if(_0x4c8908[_0x616e('0x2a')]){delete _0x4c8908[_0x616e('0x2a')];}_0x398463[_0x616e('0x21')](_0x516aba)[_0x616e('0x2b')](_0x4c8908);};}exports['index']=function(_0xdc386b,_0x127e29){var _0x501854={},_0x30127f={},_0x8d5630={'count':0x0,'rows':[]};var _0x444eba=_[_0x616e('0x2c')](db[_0x616e('0x2d')][_0x616e('0x2e')],function(_0x17f30b){return{'name':_0x17f30b[_0x616e('0x2f')],'type':_0x17f30b['type'][_0x616e('0x30')]};});_0x30127f[_0x616e('0x31')]=_[_0x616e('0x2c')](_0x444eba,_0x616e('0x2a'));_0x30127f[_0x616e('0x32')]=_[_0x616e('0x33')](_0xdc386b[_0x616e('0x32')]);_0x30127f[_0x616e('0x34')]=_[_0x616e('0x35')](_0x30127f[_0x616e('0x31')],_0x30127f['query']);_0x501854[_0x616e('0x36')]=_[_0x616e('0x35')](_0x30127f['model'],qs[_0x616e('0x37')](_0xdc386b[_0x616e('0x32')][_0x616e('0x37')]));_0x501854[_0x616e('0x36')]=_0x501854['attributes']['length']?_0x501854[_0x616e('0x36')]:_0x30127f['model'];if(!_0xdc386b[_0x616e('0x32')][_0x616e('0x38')](_0x616e('0x39'))){_0x501854[_0x616e('0x1f')]=qs[_0x616e('0x1f')](_0xdc386b[_0x616e('0x32')][_0x616e('0x1f')]);_0x501854['offset']=qs['offset'](_0xdc386b[_0x616e('0x32')][_0x616e('0x1d')]);}_0x501854['order']=qs[_0x616e('0x3a')](_0xdc386b[_0x616e('0x32')][_0x616e('0x3a')]);_0x501854['where']=qs[_0x616e('0x34')](_['pick'](_0xdc386b[_0x616e('0x32')],_0x30127f[_0x616e('0x34')]),_0x444eba);if(_0xdc386b[_0x616e('0x32')][_0x616e('0x3b')]){_0x501854['where']=_[_0x616e('0x3c')](_0x501854[_0x616e('0x3d')],{'$or':_[_0x616e('0x2c')](_0x444eba,function(_0x209af9){if(_0x209af9[_0x616e('0x3e')]!==_0x616e('0x3f')){var _0x706e30={};_0x706e30[_0x209af9[_0x616e('0x2a')]]={'$like':'%'+_0xdc386b[_0x616e('0x32')][_0x616e('0x3b')]+'%'};return _0x706e30;}})});}_0x501854=_[_0x616e('0x3c')]({},_0x501854,_0xdc386b[_0x616e('0x40')]);var _0x4f4696={'where':_0x501854[_0x616e('0x3d')]};return db[_0x616e('0x2d')][_0x616e('0x20')](_0x4f4696)['then'](function(_0x2235d1){_0x8d5630[_0x616e('0x20')]=_0x2235d1;if(_0xdc386b[_0x616e('0x32')][_0x616e('0x41')]){_0x501854[_0x616e('0x42')]=[{'all':!![]}];}return db['VtigerAccount'][_0x616e('0x43')](_0x501854);})[_0x616e('0x27')](function(_0x2067a9){_0x8d5630['rows']=_0x2067a9;return _0x8d5630;})[_0x616e('0x27')](respondWithFilteredResult(_0x127e29,_0x501854))[_0x616e('0x44')](handleError(_0x127e29,null));};exports[_0x616e('0x45')]=function(_0x7dda78,_0x1be928){var _0x7c6551={'raw':![],'where':{'id':_0x7dda78[_0x616e('0x46')]['id']}},_0x12ac9d={};_0x12ac9d['model']=_['keys'](db['VtigerAccount'][_0x616e('0x2e')]);_0x12ac9d[_0x616e('0x32')]=_['keys'](_0x7dda78[_0x616e('0x32')]);_0x12ac9d[_0x616e('0x34')]=_[_0x616e('0x35')](_0x12ac9d['model'],_0x12ac9d[_0x616e('0x32')]);_0x7c6551[_0x616e('0x36')]=_[_0x616e('0x35')](_0x12ac9d[_0x616e('0x31')],qs[_0x616e('0x37')](_0x7dda78[_0x616e('0x32')][_0x616e('0x37')]));_0x7c6551[_0x616e('0x36')]=_0x7c6551[_0x616e('0x36')][_0x616e('0x47')]?_0x7c6551[_0x616e('0x36')]:_0x12ac9d[_0x616e('0x31')];if(_0x7dda78['query'][_0x616e('0x41')]){_0x7c6551[_0x616e('0x42')]=[{'all':!![]}];}_0x7c6551=_[_0x616e('0x3c')]({},_0x7c6551,_0x7dda78[_0x616e('0x40')]);return db[_0x616e('0x2d')][_0x616e('0x48')](_0x7c6551)[_0x616e('0x27')](handleEntityNotFound(_0x1be928,null))[_0x616e('0x27')](respondWithResult(_0x1be928,null))[_0x616e('0x44')](handleError(_0x1be928,null));};exports['create']=function(_0x561c9c,_0x49769c){return db[_0x616e('0x2d')]['create'](_0x561c9c[_0x616e('0x49')],{})['then'](respondWithResult(_0x49769c,0xc9))['catch'](handleError(_0x49769c,null));};exports[_0x616e('0x4a')]=function(_0x49ee72,_0x4e6b3e){if(_0x49ee72[_0x616e('0x49')]['id']){delete _0x49ee72[_0x616e('0x49')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x49ee72[_0x616e('0x46')]['id']}})[_0x616e('0x27')](handleEntityNotFound(_0x4e6b3e,null))[_0x616e('0x27')](saveUpdates(_0x49ee72[_0x616e('0x49')],null))['then'](respondWithResult(_0x4e6b3e,null))[_0x616e('0x44')](handleError(_0x4e6b3e,null));};exports[_0x616e('0x4b')]=function(_0x121e12,_0x2c62f9){return db[_0x616e('0x2d')][_0x616e('0x48')]({'where':{'id':_0x121e12[_0x616e('0x46')]['id']}})[_0x616e('0x27')](handleEntityNotFound(_0x2c62f9,null))[_0x616e('0x27')](removeEntity(_0x2c62f9,null))['catch'](handleError(_0x2c62f9,null));};exports[_0x616e('0x4c')]=function(_0x251be3,_0x1db201,_0x32695a){var _0x452cdf={};var _0x107e4d={};var _0x10c46c;var _0x536540;return db['VtigerAccount']['findOne']({'where':{'id':_0x251be3['params']['id']}})['then'](handleEntityNotFound(_0x1db201,null))[_0x616e('0x27')](function(_0x2d35be){if(_0x2d35be){_0x10c46c=_0x2d35be;_0x107e4d[_0x616e('0x31')]=_[_0x616e('0x33')](db[_0x616e('0x4d')][_0x616e('0x2e')]);_0x107e4d[_0x616e('0x32')]=_[_0x616e('0x33')](_0x251be3[_0x616e('0x32')]);_0x107e4d['filters']=_[_0x616e('0x35')](_0x107e4d['model'],_0x107e4d[_0x616e('0x32')]);_0x452cdf[_0x616e('0x36')]=_['intersection'](_0x107e4d[_0x616e('0x31')],qs[_0x616e('0x37')](_0x251be3[_0x616e('0x32')][_0x616e('0x37')]));_0x452cdf[_0x616e('0x36')]=_0x452cdf[_0x616e('0x36')]['length']?_0x452cdf['attributes']:_0x107e4d[_0x616e('0x31')];_0x452cdf[_0x616e('0x4e')]=qs[_0x616e('0x3a')](_0x251be3[_0x616e('0x32')][_0x616e('0x3a')]);_0x452cdf[_0x616e('0x3d')]=qs[_0x616e('0x34')](_[_0x616e('0x4f')](_0x251be3[_0x616e('0x32')],_0x107e4d['filters']));if(_0x251be3[_0x616e('0x32')][_0x616e('0x3b')]){_0x452cdf[_0x616e('0x3d')]=_['merge'](_0x452cdf[_0x616e('0x3d')],{'$or':_[_0x616e('0x2c')](_0x452cdf[_0x616e('0x36')],function(_0x4faee8){var _0x54eda7={};_0x54eda7[_0x4faee8]={'$like':'%'+_0x251be3[_0x616e('0x32')][_0x616e('0x3b')]+'%'};return _0x54eda7;})});}_0x452cdf=_['merge']({},_0x452cdf,_0x251be3[_0x616e('0x40')]);return _0x10c46c[_0x616e('0x4c')](_0x452cdf);}})[_0x616e('0x27')](function(_0x3ac4fb){if(_0x3ac4fb){_0x536540=_0x3ac4fb[_0x616e('0x47')];if(!_0x251be3[_0x616e('0x32')][_0x616e('0x38')](_0x616e('0x39'))){_0x452cdf[_0x616e('0x1f')]=qs[_0x616e('0x1f')](_0x251be3['query'][_0x616e('0x1f')]);_0x452cdf[_0x616e('0x1d')]=qs[_0x616e('0x1d')](_0x251be3['query'][_0x616e('0x1d')]);}return _0x10c46c[_0x616e('0x4c')](_0x452cdf);}})['then'](function(_0x231e9b){if(_0x231e9b){return _0x231e9b?{'count':_0x536540,'rows':_0x231e9b}:null;}})['then'](respondWithResult(_0x1db201,null))['catch'](handleError(_0x1db201,null));};exports[_0x616e('0x50')]=function(_0xa27e63,_0x489ddf,_0xdf26df){if(_0xa27e63[_0x616e('0x49')]['id']){delete _0xa27e63['body']['id'];}return db[_0x616e('0x2d')][_0x616e('0x51')]({'where':{'id':_0xa27e63[_0x616e('0x46')]['id']}})[_0x616e('0x27')](handleEntityNotFound(_0x489ddf,null))[_0x616e('0x27')](function(_0x444473){if(_0x444473){_0xa27e63[_0x616e('0x49')][_0x616e('0x52')]=_0x444473['id'];_0xa27e63['body']['Subjects']=integrations[_0x616e('0x53')](_0xa27e63[_0x616e('0x49')][_0x616e('0x54')],_0xa27e63[_0x616e('0x49')][_0x616e('0x3e')]);_0xa27e63[_0x616e('0x49')][_0x616e('0x55')]=integrations[_0x616e('0x56')](_0xa27e63[_0x616e('0x49')][_0x616e('0x54')],_0xa27e63['body'][_0x616e('0x3e')]);return db['VtigerConfiguration']['create'](_0xa27e63['body'],{'include':[{'model':db[_0x616e('0x57')],'as':_0x616e('0x58')},{'model':db[_0x616e('0x57')],'as':_0x616e('0x55')}]});}return null;})[_0x616e('0x27')](respondWithResult(_0x489ddf,null))[_0x616e('0x44')](handleError(_0x489ddf,null));};var md5=require(_0x616e('0x59'));exports[_0x616e('0x5a')]=function(_0x2771d0,_0xd5ba2a,_0x26f0c0){var _0x425f4c=null;var _0x3df205=null;var _0x4fd381=null;var _0x28b4c0=null;var _0x122d41='';return db[_0x616e('0x2d')][_0x616e('0x51')]({'where':{'id':_0x2771d0[_0x616e('0x46')]['id']},'attributes':['id','name',_0x616e('0x5b'),_0x616e('0x5c'),_0x616e('0x5d'),_0x616e('0x5e'),_0x616e('0x5f'),_0x616e('0x60')]})[_0x616e('0x27')](handleEntityNotFound(_0xd5ba2a,null))[_0x616e('0x27')](function(_0x52bbcb){if(_0x52bbcb){_0x425f4c=_0x52bbcb[_0x616e('0x5b')];_0x3df205=_0x52bbcb[_0x616e('0x60')];_0x4fd381=_0x52bbcb[_0x616e('0x5d')];_0x122d41=_0x52bbcb[_0x616e('0x5e')];var _0x1b74b9=_0x122d41['slice'](-0x1);if(_0x1b74b9==='/'){_0x122d41=_0x122d41[_0x616e('0x61')](0x0,_0x122d41[_0x616e('0x62')](_0x1b74b9));}_0x28b4c0=util[_0x616e('0x63')](_0x616e('0x64'),_0x122d41);var _0x38d5e8={'method':_0x616e('0x65'),'uri':_0x28b4c0,'qs':{'operation':_0x616e('0x66'),'username':_0x52bbcb[_0x616e('0x5b')]},'json':!![]};return rp(_0x38d5e8);}})[_0x616e('0x27')](function(_0x4b9705){if(_0x4b9705['success']){var _0x5326da={'method':_0x616e('0x67'),'uri':_0x28b4c0,'form':{'operation':_0x616e('0x68'),'username':_0x425f4c,'accessKey':md5(_0x4b9705['result'][_0x616e('0x69')]+_0x3df205)},'json':!![]};return rp(_0x5326da);}})['then'](function(_0x647267){if(_0x647267[_0x616e('0x6a')]){var _0x2673e0={'method':'GET','uri':_0x28b4c0,'qs':{'operation':_0x616e('0x6b'),'username':_0x425f4c,'sessionName':_0x647267[_0x616e('0x6c')][_0x616e('0x6d')],'elementType':_0x4fd381},'json':!![]};return rp(_0x2673e0);}})[_0x616e('0x27')](function(_0x8373ff){if(_0x8373ff[_0x616e('0x6a')]){var _0x3387c8=[_0x616e('0x6e'),_0x616e('0x6f'),_0x616e('0x70')];_[_0x616e('0x71')](_0x8373ff[_0x616e('0x6c')][_0x616e('0x37')],function(_0x113022){return _0x3387c8[_0x616e('0x72')](_0x113022[_0x616e('0x3e')][_0x616e('0x2a')]);});_[_0x616e('0x71')](_0x8373ff[_0x616e('0x6c')]['fields'],function(_0x558793){return _0x558793[_0x616e('0x73')]===_0x616e('0x74');});return{'count':_0x8373ff[_0x616e('0x6c')][_0x616e('0x37')][_0x616e('0x47')],'rows':_[_0x616e('0x2c')](_0x8373ff[_0x616e('0x6c')][_0x616e('0x37')],function(_0x53b0e0){return{'id':_0x53b0e0[_0x616e('0x2a')],'name':_0x53b0e0[_0x616e('0x75')],'custom':_[_0x616e('0x76')](_0x53b0e0[_0x616e('0x2a')],_0x616e('0x77'))?!![]:![],'options':_0x53b0e0[_0x616e('0x3e')]['name']===_0x616e('0x78')&&_0x53b0e0['type']['picklistValues'][_0x616e('0x47')]>0x0?_[_0x616e('0x2c')](_0x53b0e0['type'][_0x616e('0x79')],function(_0x3e9ff3){return{'name':_0x3e9ff3[_0x616e('0x75')],'value':_0x3e9ff3['value']};}):[]};})};}})[_0x616e('0x27')](respondWithResult(_0xd5ba2a,null))[_0x616e('0x44')](function(_0x45e95b){console[_0x616e('0x7a')](_0x616e('0x7b')+_0x45e95b);var _0x12b1c9=_0x2771d0['query'][_0x616e('0x7c')]?0x1f4:_0x45e95b['statusCode']||0x1f4;logger[_0x616e('0x28')](_0x616e('0x7d'),_0x616e('0x5a'),_0x12b1c9,JSON[_0x616e('0x7e')](_0x45e95b));delete _0x45e95b['name'];if(_0x12b1c9===0x191){_0x12b1c9=0x190;}_0xd5ba2a[_0x616e('0x21')](_0x12b1c9)[_0x616e('0x2b')](_0x2771d0[_0x616e('0x32')][_0x616e('0x7c')]?{'message':_0x616e('0x7f'),'statusCode':_0x45e95b[_0x616e('0x80')]}:_0x45e95b);});}; \ No newline at end of file +var _0x812b=['%s/webservice.php','getchallenge','success','POST','token','describe','result','sessionName','autogenerated','includes','remove','editable','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VtigerAccount','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','rawAttributes','length','include','merge','create','body','params','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','accessKey','slice','substring','format'];(function(_0x211e44,_0x5bd301){var _0x26bee7=function(_0x29fcbc){while(--_0x29fcbc){_0x211e44['push'](_0x211e44['shift']());}};_0x26bee7(++_0x5bd301);}(_0x812b,0x1ea));var _0xb812=function(_0x1135b1,_0x644ab2){_0x1135b1=_0x1135b1-0x0;var _0x387f6b=_0x812b[_0x1135b1];return _0x387f6b;};'use strict';var emlformat=require(_0xb812('0x0'));var rimraf=require(_0xb812('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb812('0x2'));var rp=require(_0xb812('0x3'));var moment=require(_0xb812('0x4'));var BPromise=require(_0xb812('0x5'));var Mustache=require(_0xb812('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb812('0x7'));var ejs=require(_0xb812('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb812('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb812('0xa'));var toCsv=require(_0xb812('0x7'));var querystring=require(_0xb812('0xb'));var Papa=require(_0xb812('0xc'));var Redis=require('ioredis');var authService=require(_0xb812('0xd'));var qs=require(_0xb812('0xe'));var as=require(_0xb812('0xf'));var hardwareService=require(_0xb812('0x10'));var logger=require(_0xb812('0x11'))(_0xb812('0x12'));var utils=require(_0xb812('0x13'));var config=require(_0xb812('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb812('0x15'))['db'];var integrations=require(_0xb812('0x16'));function respondWithStatusCode(_0x908a2d,_0xfed6dc){_0xfed6dc=_0xfed6dc||0xcc;return function(_0x559713){if(_0x559713){return _0x908a2d['sendStatus'](_0xfed6dc);}return _0x908a2d[_0xb812('0x17')](_0xfed6dc)[_0xb812('0x18')]();};}function respondWithResult(_0x333d01,_0x352b0e){_0x352b0e=_0x352b0e||0xc8;return function(_0x5a637e){if(_0x5a637e){return _0x333d01[_0xb812('0x17')](_0x352b0e)[_0xb812('0x19')](_0x5a637e);}};}function respondWithFilteredResult(_0x51ddf5,_0x2b25d4){return function(_0x285122){if(_0x285122){var _0x27bbe5=typeof _0x2b25d4[_0xb812('0x1a')]===_0xb812('0x1b')&&typeof _0x2b25d4[_0xb812('0x1c')]===_0xb812('0x1b');var _0x52725b=_0x285122[_0xb812('0x1d')];var _0x12da53=_0x27bbe5?0x0:_0x2b25d4[_0xb812('0x1a')];var _0x239ecd=_0x27bbe5?_0x285122[_0xb812('0x1d')]:_0x2b25d4[_0xb812('0x1a')]+_0x2b25d4[_0xb812('0x1c')];var _0x2c3783;if(_0x239ecd>=_0x52725b){_0x239ecd=_0x52725b;_0x2c3783=0xc8;}else{_0x2c3783=0xce;}_0x51ddf5[_0xb812('0x17')](_0x2c3783);return _0x51ddf5[_0xb812('0x1e')]('Content-Range',_0x12da53+'-'+_0x239ecd+'/'+_0x52725b)['json'](_0x285122);}return null;};}function patchUpdates(_0x18502e){return function(_0x322c93){try{jsonpatch[_0xb812('0x1f')](_0x322c93,_0x18502e,!![]);}catch(_0x4ecc59){return BPromise[_0xb812('0x20')](_0x4ecc59);}return _0x322c93[_0xb812('0x21')]();};}function saveUpdates(_0x24c1f2,_0x183e74){return function(_0x1cda74){if(_0x1cda74){return _0x1cda74[_0xb812('0x22')](_0x24c1f2)[_0xb812('0x23')](function(_0x2c7ac7){return _0x2c7ac7;});}return null;};}function removeEntity(_0x35bd14,_0x3bd3b6){return function(_0x3d98f7){if(_0x3d98f7){return _0x3d98f7[_0xb812('0x24')]()[_0xb812('0x23')](function(){_0x35bd14['status'](0xcc)[_0xb812('0x18')]();});}};}function handleEntityNotFound(_0x211a9f,_0x41c594){return function(_0x17ca22){if(!_0x17ca22){_0x211a9f[_0xb812('0x25')](0x194);}return _0x17ca22;};}function handleError(_0x4f95d7,_0x4f7646){_0x4f7646=_0x4f7646||0x1f4;return function(_0x109ab0){logger[_0xb812('0x26')](_0x109ab0[_0xb812('0x27')]);if(_0x109ab0[_0xb812('0x28')]){delete _0x109ab0[_0xb812('0x28')];}_0x4f95d7[_0xb812('0x17')](_0x4f7646)[_0xb812('0x29')](_0x109ab0);};}exports[_0xb812('0x2a')]=function(_0x31f085,_0x2a3cc9){var _0xb6eee2={},_0x299ba0={},_0x2738f9={'count':0x0,'rows':[]};var _0x1fbaf5=_['map'](db[_0xb812('0x2b')]['rawAttributes'],function(_0x5c99c7){return{'name':_0x5c99c7[_0xb812('0x2c')],'type':_0x5c99c7[_0xb812('0x2d')]['key']};});_0x299ba0[_0xb812('0x2e')]=_[_0xb812('0x2f')](_0x1fbaf5,_0xb812('0x28'));_0x299ba0[_0xb812('0x30')]=_[_0xb812('0x31')](_0x31f085[_0xb812('0x30')]);_0x299ba0[_0xb812('0x32')]=_[_0xb812('0x33')](_0x299ba0[_0xb812('0x2e')],_0x299ba0[_0xb812('0x30')]);_0xb6eee2['attributes']=_['intersection'](_0x299ba0['model'],qs[_0xb812('0x34')](_0x31f085['query'][_0xb812('0x34')]));_0xb6eee2[_0xb812('0x35')]=_0xb6eee2[_0xb812('0x35')]['length']?_0xb6eee2[_0xb812('0x35')]:_0x299ba0['model'];if(!_0x31f085[_0xb812('0x30')][_0xb812('0x36')](_0xb812('0x37'))){_0xb6eee2[_0xb812('0x1c')]=qs[_0xb812('0x1c')](_0x31f085[_0xb812('0x30')][_0xb812('0x1c')]);_0xb6eee2['offset']=qs[_0xb812('0x1a')](_0x31f085['query'][_0xb812('0x1a')]);}_0xb6eee2[_0xb812('0x38')]=qs['sort'](_0x31f085[_0xb812('0x30')][_0xb812('0x39')]);_0xb6eee2[_0xb812('0x3a')]=qs[_0xb812('0x32')](_[_0xb812('0x3b')](_0x31f085[_0xb812('0x30')],_0x299ba0[_0xb812('0x32')]),_0x1fbaf5);if(_0x31f085[_0xb812('0x30')]['filter']){_0xb6eee2[_0xb812('0x3a')]=_['merge'](_0xb6eee2[_0xb812('0x3a')],{'$or':_[_0xb812('0x2f')](_0x1fbaf5,function(_0x22ab7a){if(_0x22ab7a[_0xb812('0x2d')]!==_0xb812('0x3c')){var _0x3d60c2={};_0x3d60c2[_0x22ab7a[_0xb812('0x28')]]={'$like':'%'+_0x31f085[_0xb812('0x30')][_0xb812('0x3d')]+'%'};return _0x3d60c2;}})});}_0xb6eee2=_['merge']({},_0xb6eee2,_0x31f085[_0xb812('0x3e')]);var _0x899900={'where':_0xb6eee2[_0xb812('0x3a')]};return db['VtigerAccount'][_0xb812('0x1d')](_0x899900)['then'](function(_0x104d64){_0x2738f9[_0xb812('0x1d')]=_0x104d64;if(_0x31f085[_0xb812('0x30')][_0xb812('0x3f')]){_0xb6eee2['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xb812('0x40')](_0xb6eee2);})[_0xb812('0x23')](function(_0x2e696e){_0x2738f9[_0xb812('0x41')]=_0x2e696e;return _0x2738f9;})['then'](respondWithFilteredResult(_0x2a3cc9,_0xb6eee2))[_0xb812('0x42')](handleError(_0x2a3cc9,null));};exports[_0xb812('0x43')]=function(_0x14190a,_0x5595eb){var _0x1c32f8={'raw':![],'where':{'id':_0x14190a['params']['id']}},_0x35c053={};_0x35c053[_0xb812('0x2e')]=_['keys'](db[_0xb812('0x2b')][_0xb812('0x44')]);_0x35c053[_0xb812('0x30')]=_[_0xb812('0x31')](_0x14190a[_0xb812('0x30')]);_0x35c053[_0xb812('0x32')]=_[_0xb812('0x33')](_0x35c053[_0xb812('0x2e')],_0x35c053[_0xb812('0x30')]);_0x1c32f8['attributes']=_[_0xb812('0x33')](_0x35c053[_0xb812('0x2e')],qs['fields'](_0x14190a[_0xb812('0x30')][_0xb812('0x34')]));_0x1c32f8[_0xb812('0x35')]=_0x1c32f8[_0xb812('0x35')][_0xb812('0x45')]?_0x1c32f8[_0xb812('0x35')]:_0x35c053[_0xb812('0x2e')];if(_0x14190a[_0xb812('0x30')][_0xb812('0x3f')]){_0x1c32f8[_0xb812('0x46')]=[{'all':!![]}];}_0x1c32f8=_[_0xb812('0x47')]({},_0x1c32f8,_0x14190a[_0xb812('0x3e')]);return db[_0xb812('0x2b')]['find'](_0x1c32f8)[_0xb812('0x23')](handleEntityNotFound(_0x5595eb,null))[_0xb812('0x23')](respondWithResult(_0x5595eb,null))[_0xb812('0x42')](handleError(_0x5595eb,null));};exports[_0xb812('0x48')]=function(_0xaf5add,_0xfc09ce){return db[_0xb812('0x2b')][_0xb812('0x48')](_0xaf5add['body'],{})[_0xb812('0x23')](respondWithResult(_0xfc09ce,0xc9))[_0xb812('0x42')](handleError(_0xfc09ce,null));};exports[_0xb812('0x22')]=function(_0x54b092,_0x5ea323){if(_0x54b092[_0xb812('0x49')]['id']){delete _0x54b092[_0xb812('0x49')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x54b092[_0xb812('0x4a')]['id']}})[_0xb812('0x23')](handleEntityNotFound(_0x5ea323,null))['then'](saveUpdates(_0x54b092['body'],null))[_0xb812('0x23')](respondWithResult(_0x5ea323,null))['catch'](handleError(_0x5ea323,null));};exports['destroy']=function(_0x37922e,_0x5884fd){return db['VtigerAccount'][_0xb812('0x4b')]({'where':{'id':_0x37922e[_0xb812('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5884fd,null))[_0xb812('0x23')](removeEntity(_0x5884fd,null))[_0xb812('0x42')](handleError(_0x5884fd,null));};exports[_0xb812('0x4c')]=function(_0x1b940f,_0x323618,_0x3f3175){var _0x5b6f0c={};var _0x2eeda9={};var _0x1985d0;var _0x3b312c;return db[_0xb812('0x2b')][_0xb812('0x4d')]({'where':{'id':_0x1b940f[_0xb812('0x4a')]['id']}})['then'](handleEntityNotFound(_0x323618,null))[_0xb812('0x23')](function(_0x241d59){if(_0x241d59){_0x1985d0=_0x241d59;_0x2eeda9[_0xb812('0x2e')]=_['keys'](db[_0xb812('0x4e')][_0xb812('0x44')]);_0x2eeda9[_0xb812('0x30')]=_[_0xb812('0x31')](_0x1b940f[_0xb812('0x30')]);_0x2eeda9[_0xb812('0x32')]=_[_0xb812('0x33')](_0x2eeda9['model'],_0x2eeda9[_0xb812('0x30')]);_0x5b6f0c['attributes']=_[_0xb812('0x33')](_0x2eeda9['model'],qs['fields'](_0x1b940f['query'][_0xb812('0x34')]));_0x5b6f0c[_0xb812('0x35')]=_0x5b6f0c[_0xb812('0x35')]['length']?_0x5b6f0c[_0xb812('0x35')]:_0x2eeda9[_0xb812('0x2e')];_0x5b6f0c[_0xb812('0x38')]=qs[_0xb812('0x39')](_0x1b940f[_0xb812('0x30')][_0xb812('0x39')]);_0x5b6f0c[_0xb812('0x3a')]=qs['filters'](_[_0xb812('0x3b')](_0x1b940f['query'],_0x2eeda9[_0xb812('0x32')]));if(_0x1b940f['query'][_0xb812('0x3d')]){_0x5b6f0c[_0xb812('0x3a')]=_[_0xb812('0x47')](_0x5b6f0c[_0xb812('0x3a')],{'$or':_[_0xb812('0x2f')](_0x5b6f0c[_0xb812('0x35')],function(_0x411e96){var _0x2e5b28={};_0x2e5b28[_0x411e96]={'$like':'%'+_0x1b940f['query'][_0xb812('0x3d')]+'%'};return _0x2e5b28;})});}_0x5b6f0c=_[_0xb812('0x47')]({},_0x5b6f0c,_0x1b940f['options']);return _0x1985d0[_0xb812('0x4c')](_0x5b6f0c);}})[_0xb812('0x23')](function(_0x1cc800){if(_0x1cc800){_0x3b312c=_0x1cc800[_0xb812('0x45')];if(!_0x1b940f[_0xb812('0x30')][_0xb812('0x36')](_0xb812('0x37'))){_0x5b6f0c[_0xb812('0x1c')]=qs[_0xb812('0x1c')](_0x1b940f[_0xb812('0x30')][_0xb812('0x1c')]);_0x5b6f0c['offset']=qs[_0xb812('0x1a')](_0x1b940f[_0xb812('0x30')][_0xb812('0x1a')]);}return _0x1985d0[_0xb812('0x4c')](_0x5b6f0c);}})[_0xb812('0x23')](function(_0x8b2e5b){if(_0x8b2e5b){return _0x8b2e5b?{'count':_0x3b312c,'rows':_0x8b2e5b}:null;}})[_0xb812('0x23')](respondWithResult(_0x323618,null))['catch'](handleError(_0x323618,null));};exports[_0xb812('0x4f')]=function(_0xf95f8b,_0x1a5e25,_0x38201e){if(_0xf95f8b[_0xb812('0x49')]['id']){delete _0xf95f8b['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0xf95f8b[_0xb812('0x4a')]['id']}})[_0xb812('0x23')](handleEntityNotFound(_0x1a5e25,null))[_0xb812('0x23')](function(_0xd48af2){if(_0xd48af2){_0xf95f8b[_0xb812('0x49')][_0xb812('0x50')]=_0xd48af2['id'];_0xf95f8b[_0xb812('0x49')][_0xb812('0x51')]=integrations[_0xb812('0x52')](_0xf95f8b[_0xb812('0x49')][_0xb812('0x53')],_0xf95f8b[_0xb812('0x49')][_0xb812('0x2d')]);_0xf95f8b['body'][_0xb812('0x54')]=integrations[_0xb812('0x55')](_0xf95f8b[_0xb812('0x49')][_0xb812('0x53')],_0xf95f8b[_0xb812('0x49')][_0xb812('0x2d')]);return db['VtigerConfiguration'][_0xb812('0x48')](_0xf95f8b[_0xb812('0x49')],{'include':[{'model':db[_0xb812('0x56')],'as':'Subjects'},{'model':db[_0xb812('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1a5e25,null))[_0xb812('0x42')](handleError(_0x1a5e25,null));};var md5=require('md5');exports[_0xb812('0x57')]=function(_0x3ca5fb,_0x2480bd,_0x160af3){var _0x1ada10=null;var _0x27b2b0=null;var _0x23ed45=null;var _0x565454=null;var _0x1a4f7e='';return db[_0xb812('0x2b')][_0xb812('0x4d')]({'where':{'id':_0x3ca5fb[_0xb812('0x4a')]['id']},'attributes':['id',_0xb812('0x28'),_0xb812('0x58'),_0xb812('0x59'),_0xb812('0x5a'),'remoteUri','serverUrl','accessKey']})[_0xb812('0x23')](handleEntityNotFound(_0x2480bd,null))[_0xb812('0x23')](function(_0x3df00d){if(_0x3df00d){_0x1ada10=_0x3df00d[_0xb812('0x58')];_0x27b2b0=_0x3df00d[_0xb812('0x5b')];_0x23ed45=_0x3df00d[_0xb812('0x5a')];_0x1a4f7e=_0x3df00d['remoteUri'];var _0x222445=_0x1a4f7e[_0xb812('0x5c')](-0x1);if(_0x222445==='/'){_0x1a4f7e=_0x1a4f7e[_0xb812('0x5d')](0x0,_0x1a4f7e['lastIndexOf'](_0x222445));}_0x565454=util[_0xb812('0x5e')](_0xb812('0x5f'),_0x1a4f7e);var _0x1332ac={'method':'GET','uri':_0x565454,'qs':{'operation':_0xb812('0x60'),'username':_0x3df00d[_0xb812('0x58')]},'json':!![]};return rp(_0x1332ac);}})[_0xb812('0x23')](function(_0x16fd29){if(_0x16fd29[_0xb812('0x61')]){var _0xd0990a={'method':_0xb812('0x62'),'uri':_0x565454,'form':{'operation':'login','username':_0x1ada10,'accessKey':md5(_0x16fd29['result'][_0xb812('0x63')]+_0x27b2b0)},'json':!![]};return rp(_0xd0990a);}})[_0xb812('0x23')](function(_0x443474){if(_0x443474['success']){var _0x4b2612={'method':'GET','uri':_0x565454,'qs':{'operation':_0xb812('0x64'),'username':_0x1ada10,'sessionName':_0x443474[_0xb812('0x65')][_0xb812('0x66')],'elementType':_0x23ed45},'json':!![]};return rp(_0x4b2612);}})[_0xb812('0x23')](function(_0x37a5a7){if(_0x37a5a7['success']){var _0x18222b=[_0xb812('0x67'),'reference','owner'];_['remove'](_0x37a5a7[_0xb812('0x65')][_0xb812('0x34')],function(_0x4f1e8e){return _0x18222b[_0xb812('0x68')](_0x4f1e8e[_0xb812('0x2d')][_0xb812('0x28')]);});_[_0xb812('0x69')](_0x37a5a7[_0xb812('0x65')][_0xb812('0x34')],function(_0xf713a6){return _0xf713a6[_0xb812('0x6a')]==='false';});return{'count':_0x37a5a7[_0xb812('0x65')]['fields'][_0xb812('0x45')],'rows':_[_0xb812('0x2f')](_0x37a5a7[_0xb812('0x65')][_0xb812('0x34')],function(_0x5d2992){return{'id':_0x5d2992[_0xb812('0x28')],'name':_0x5d2992[_0xb812('0x6b')],'custom':_[_0xb812('0x6c')](_0x5d2992[_0xb812('0x28')],_0xb812('0x6d'))?!![]:![],'options':_0x5d2992[_0xb812('0x2d')][_0xb812('0x28')]===_0xb812('0x6e')&&_0x5d2992['type'][_0xb812('0x6f')][_0xb812('0x45')]>0x0?_[_0xb812('0x2f')](_0x5d2992[_0xb812('0x2d')]['picklistValues'],function(_0xf2cb61){return{'name':_0xf2cb61[_0xb812('0x6b')],'value':_0xf2cb61[_0xb812('0x70')]};}):[]};})};}})[_0xb812('0x23')](respondWithResult(_0x2480bd,null))[_0xb812('0x42')](function(_0x6f19){console['log'](_0xb812('0x71')+_0x6f19);var _0x1cd60b=_0x3ca5fb[_0xb812('0x30')][_0xb812('0x72')]?0x1f4:_0x6f19['statusCode']||0x1f4;logger[_0xb812('0x26')](_0xb812('0x73'),_0xb812('0x57'),_0x1cd60b,JSON[_0xb812('0x74')](_0x6f19));delete _0x6f19[_0xb812('0x28')];if(_0x1cd60b===0x191){_0x1cd60b=0x190;}_0x2480bd[_0xb812('0x17')](_0x1cd60b)[_0xb812('0x29')](_0x3ca5fb['query'][_0xb812('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x6f19['statusCode']}:_0x6f19);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 449822b..2131f82 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 _0xfe29=['request-promise','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','../../config/logger','api','moment'];(function(_0x3d4cdb,_0x190628){var _0x27ea48=function(_0x4dbea0){while(--_0x4dbea0){_0x3d4cdb['push'](_0x3d4cdb['shift']());}};_0x27ea48(++_0x190628);}(_0xfe29,0xf9));var _0x9fe2=function(_0x50f9a0,_0x2ccdfb){_0x50f9a0=_0x50f9a0-0x0;var _0x233152=_0xfe29[_0x50f9a0];return _0x233152;};'use strict';var _=require(_0x9fe2('0x0'));var util=require('util');var logger=require(_0x9fe2('0x1'))(_0x9fe2('0x2'));var moment=require(_0x9fe2('0x3'));var BPromise=require('bluebird');var rp=require(_0x9fe2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fe2('0x5'));var config=require('../../config/environment');var attributes=require(_0x9fe2('0x6'));var integrations=require(_0x9fe2('0x7'));module[_0x9fe2('0x8')]=function(_0x14b0da,_0x475993){return _0x14b0da[_0x9fe2('0x9')](_0x9fe2('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0de7=['VtigerAccount','int_vtiger_accounts','lodash','api','request-promise','path','../../config/environment','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0de7,0x1a2));var _0x70de=function(_0x1222a4,_0x1e43a2){_0x1222a4=_0x1222a4-0x0;var _0x5dd787=_0x0de7[_0x1222a4];return _0x5dd787;};'use strict';var _=require(_0x70de('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x70de('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x70de('0x2'));var fs=require('fs');var path=require(_0x70de('0x3'));var rimraf=require('rimraf');var config=require(_0x70de('0x4'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x46ef44,_0x1c2392){return _0x46ef44[_0x70de('0x5')](_0x70de('0x6'),attributes,{'tableName':_0x70de('0x7'),'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 f90c564..2a9b5de 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 _0xf4eb=['VtigerAccount','findAll','options','where','attributes','limit','map','model','include','find','raw','ShowVtigerAccount','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount'];(function(_0x222608,_0x5ecde4){var _0x250b73=function(_0x3462be){while(--_0x3462be){_0x222608['push'](_0x222608['shift']());}};_0x250b73(++_0x5ecde4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4a0d5b,_0x23021a){_0x4a0d5b=_0x4a0d5b-0x0;var _0x3a1e35=_0xf4eb[_0x4a0d5b];return _0x3a1e35;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});}exports[_0xbf4e('0x13')]=function(_0x577c27){var _0x5db03f=this;return new Promise(function(_0x566ec3,_0x4f8762){return db[_0xbf4e('0x14')][_0xbf4e('0x15')]({'raw':_0x577c27[_0xbf4e('0x16')]?_0x577c27['options']['raw']===undefined?!![]:![]:!![],'where':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x18')]||null:null,'limit':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x19')]||null:null,'include':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')]['include']?_[_0xbf4e('0x1a')](_0x577c27[_0xbf4e('0x16')]['include'],function(_0x31e3f5){return{'model':db[_0x31e3f5[_0xbf4e('0x1b')]],'as':_0x31e3f5['as'],'attributes':_0x31e3f5[_0xbf4e('0x18')],'include':_0x31e3f5[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x31e3f5['include'],function(_0x90635e){return{'model':db[_0x90635e[_0xbf4e('0x1b')]],'as':_0x90635e['as'],'attributes':_0x90635e[_0xbf4e('0x18')],'include':_0x90635e['include']?_[_0xbf4e('0x1a')](_0x90635e['include'],function(_0x5bcf71){return{'model':db[_0x5bcf71[_0xbf4e('0x1b')]],'as':_0x5bcf71['as'],'attributes':_0x5bcf71['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf4e('0x9')](function(_0x315df3){logger[_0xbf4e('0xa')](_0xbf4e('0x13'),_0x577c27);logger['debug'](_0xbf4e('0x13'),_0x577c27,JSON[_0xbf4e('0xe')](_0x315df3));_0x566ec3(_0x315df3);})[_0xbf4e('0x12')](function(_0x4cd4a1){logger[_0xbf4e('0xf')]('GetVtigerAccount',_0x4cd4a1[_0xbf4e('0x11')],_0x577c27);_0x4f8762(_0x5db03f[_0xbf4e('0xf')](0x1f4,_0x4cd4a1[_0xbf4e('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x1d12e2){var _0x362716=this;return new Promise(function(_0x2f3cf8,_0xc7ca87){return db[_0xbf4e('0x14')][_0xbf4e('0x1d')]({'raw':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')]['attributes']||null:null,'include':_0x1d12e2[_0xbf4e('0x16')]?_0x1d12e2['options'][_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x1d12e2[_0xbf4e('0x16')]['include'],function(_0x2716b7){return{'model':db[_0x2716b7[_0xbf4e('0x1b')]],'as':_0x2716b7['as'],'attributes':_0x2716b7[_0xbf4e('0x18')],'include':_0x2716b7[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x2716b7[_0xbf4e('0x1c')],function(_0x5b8440){return{'model':db[_0x5b8440[_0xbf4e('0x1b')]],'as':_0x5b8440['as'],'attributes':_0x5b8440[_0xbf4e('0x18')],'include':_0x5b8440[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x5b8440[_0xbf4e('0x1c')],function(_0x5b7ea1){return{'model':db[_0x5b7ea1['model']],'as':_0x5b7ea1['as'],'attributes':_0x5b7ea1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x429c07){logger[_0xbf4e('0xa')](_0xbf4e('0x1f'),_0x1d12e2);logger[_0xbf4e('0xd')](_0xbf4e('0x1f'),_0x1d12e2,JSON[_0xbf4e('0xe')](_0x429c07));_0x2f3cf8(_0x429c07);})[_0xbf4e('0x12')](function(_0x467b74){logger[_0xbf4e('0xf')]('ShowVtigerAccount',_0x467b74['message'],_0x1d12e2);_0xc7ca87(_0x362716[_0xbf4e('0xf')](0x1f4,_0x467b74[_0xbf4e('0x11')]));});});}; \ No newline at end of file +var _0xda3f=['GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','ShowVtigerAccount','find','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1d3a3b,_0x49e405){var _0x59b26f=function(_0x386d32){while(--_0x386d32){_0x1d3a3b['push'](_0x1d3a3b['shift']());}};_0x59b26f(++_0x49e405);}(_0xda3f,0xec));var _0xfda3=function(_0x2d5ea0,_0x26ef8a){_0x2d5ea0=_0x2d5ea0-0x0;var _0x43e99a=_0xda3f[_0x2d5ea0];return _0x43e99a;};'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')]('VtigerAccount,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('VtigerAccount,\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);});});}exports[_0xfda3('0x14')]=function(_0x4680bf){var _0xc62ae6=this;return new Promise(function(_0x54a7c6,_0x15ddb9){return db[_0xfda3('0x15')][_0xfda3('0x16')]({'raw':_0x4680bf[_0xfda3('0x17')]?_0x4680bf['options'][_0xfda3('0x18')]===undefined?!![]:![]:!![],'where':_0x4680bf[_0xfda3('0x17')]?_0x4680bf[_0xfda3('0x17')]['where']||null:null,'attributes':_0x4680bf['options']?_0x4680bf[_0xfda3('0x17')][_0xfda3('0x19')]||null:null,'limit':_0x4680bf[_0xfda3('0x17')]?_0x4680bf['options'][_0xfda3('0x1a')]||null:null,'include':_0x4680bf[_0xfda3('0x17')]?_0x4680bf[_0xfda3('0x17')][_0xfda3('0x1b')]?_[_0xfda3('0x1c')](_0x4680bf[_0xfda3('0x17')][_0xfda3('0x1b')],function(_0xc6fb9a){return{'model':db[_0xc6fb9a[_0xfda3('0x1d')]],'as':_0xc6fb9a['as'],'attributes':_0xc6fb9a['attributes'],'include':_0xc6fb9a[_0xfda3('0x1b')]?_[_0xfda3('0x1c')](_0xc6fb9a[_0xfda3('0x1b')],function(_0x4ae9b9){return{'model':db[_0x4ae9b9[_0xfda3('0x1d')]],'as':_0x4ae9b9['as'],'attributes':_0x4ae9b9[_0xfda3('0x19')],'include':_0x4ae9b9[_0xfda3('0x1b')]?_[_0xfda3('0x1c')](_0x4ae9b9[_0xfda3('0x1b')],function(_0xad9f7b){return{'model':db[_0xad9f7b['model']],'as':_0xad9f7b['as'],'attributes':_0xad9f7b[_0xfda3('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfda3('0x8')](function(_0x2bef2b){logger[_0xfda3('0x9')](_0xfda3('0x14'),_0x4680bf);logger['debug'](_0xfda3('0x14'),_0x4680bf,JSON[_0xfda3('0xe')](_0x2bef2b));_0x54a7c6(_0x2bef2b);})[_0xfda3('0x13')](function(_0x474992){logger[_0xfda3('0xf')](_0xfda3('0x14'),_0x474992[_0xfda3('0x11')],_0x4680bf);_0x15ddb9(_0xc62ae6['error'](0x1f4,_0x474992['message']));});});};exports[_0xfda3('0x1e')]=function(_0x4fd277){var _0x4b9d90=this;return new Promise(function(_0x16b4a2,_0x2a5971){return db[_0xfda3('0x15')][_0xfda3('0x1f')]({'raw':_0x4fd277[_0xfda3('0x17')]?_0x4fd277[_0xfda3('0x17')][_0xfda3('0x18')]===undefined?!![]:![]:!![],'where':_0x4fd277[_0xfda3('0x17')]?_0x4fd277[_0xfda3('0x17')]['where']||null:null,'attributes':_0x4fd277[_0xfda3('0x17')]?_0x4fd277[_0xfda3('0x17')][_0xfda3('0x19')]||null:null,'include':_0x4fd277[_0xfda3('0x17')]?_0x4fd277[_0xfda3('0x17')][_0xfda3('0x1b')]?_[_0xfda3('0x1c')](_0x4fd277[_0xfda3('0x17')][_0xfda3('0x1b')],function(_0x59a1c9){return{'model':db[_0x59a1c9['model']],'as':_0x59a1c9['as'],'attributes':_0x59a1c9[_0xfda3('0x19')],'include':_0x59a1c9[_0xfda3('0x1b')]?_['map'](_0x59a1c9[_0xfda3('0x1b')],function(_0xc861d2){return{'model':db[_0xc861d2[_0xfda3('0x1d')]],'as':_0xc861d2['as'],'attributes':_0xc861d2['attributes'],'include':_0xc861d2[_0xfda3('0x1b')]?_[_0xfda3('0x1c')](_0xc861d2[_0xfda3('0x1b')],function(_0x3151e6){return{'model':db[_0x3151e6[_0xfda3('0x1d')]],'as':_0x3151e6['as'],'attributes':_0x3151e6['attributes']};}):[]};}):[]};}):[]:[]})[_0xfda3('0x8')](function(_0x2d2043){logger[_0xfda3('0x9')]('ShowVtigerAccount',_0x4fd277);logger[_0xfda3('0xc')]('ShowVtigerAccount',_0x4fd277,JSON[_0xfda3('0xe')](_0x2d2043));_0x16b4a2(_0x2d2043);})[_0xfda3('0x13')](function(_0x43a58a){logger[_0xfda3('0xf')](_0xfda3('0x1e'),_0x43a58a[_0xfda3('0x11')],_0x4fd277);_0x2a5971(_0x4b9d90[_0xfda3('0xf')](0x1f4,_0x43a58a[_0xfda3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 877f343..55fe9d5 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 _0xd5a1=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','multer','util'];(function(_0x116f7f,_0x4515ef){var _0xcefefb=function(_0x2ba183){while(--_0x2ba183){_0x116f7f['push'](_0x116f7f['shift']());}};_0xcefefb(++_0x4515ef);}(_0xd5a1,0x16a));var _0x1d5a=function(_0x1325c6,_0x69d973){_0x1325c6=_0x1325c6-0x0;var _0x202425=_0xd5a1[_0x1325c6];return _0x202425;};'use strict';var multer=require(_0x1d5a('0x0'));var util=require(_0x1d5a('0x1'));var path=require(_0x1d5a('0x2'));var timeout=require(_0x1d5a('0x3'));var express=require(_0x1d5a('0x4'));var router=express[_0x1d5a('0x5')]();var fs_extra=require(_0x1d5a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1d5a('0x7'));var config=require(_0x1d5a('0x8'));var controller=require(_0x1d5a('0x9'));router[_0x1d5a('0xa')]('/',auth[_0x1d5a('0xb')](),controller[_0x1d5a('0xc')]);router['get'](_0x1d5a('0xd'),auth[_0x1d5a('0xb')](),controller[_0x1d5a('0xe')]);router[_0x1d5a('0xa')](_0x1d5a('0xf'),auth[_0x1d5a('0xb')](),controller[_0x1d5a('0x10')]);router[_0x1d5a('0xa')](_0x1d5a('0x11'),auth['isAuthenticated'](),controller[_0x1d5a('0x12')]);router[_0x1d5a('0xa')](_0x1d5a('0x13'),auth['isAuthenticated'](),controller[_0x1d5a('0x14')]);router[_0x1d5a('0x15')]('/',auth[_0x1d5a('0xb')](),controller['create']);router['put'](_0x1d5a('0xd'),auth['isAuthenticated'](),controller[_0x1d5a('0x16')]);router[_0x1d5a('0x17')](_0x1d5a('0xd'),auth[_0x1d5a('0xb')](),controller[_0x1d5a('0x18')]);module[_0x1d5a('0x19')]=router; \ No newline at end of file +var _0x00bd=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','delete'];(function(_0x36b51c,_0x37fde0){var _0x1cbf02=function(_0x303b8c){while(--_0x303b8c){_0x36b51c['push'](_0x36b51c['shift']());}};_0x1cbf02(++_0x37fde0);}(_0x00bd,0x18e));var _0xd00b=function(_0x47c713,_0x3b819e){_0x47c713=_0x47c713-0x0;var _0x3e6b23=_0x00bd[_0x47c713];return _0x3e6b23;};'use strict';var multer=require(_0xd00b('0x0'));var util=require('util');var path=require(_0xd00b('0x1'));var timeout=require(_0xd00b('0x2'));var express=require('express');var router=express[_0xd00b('0x3')]();var fs_extra=require(_0xd00b('0x4'));var auth=require(_0xd00b('0x5'));var interaction=require(_0xd00b('0x6'));var config=require(_0xd00b('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0xd00b('0x8')]('/',auth[_0xd00b('0x9')](),controller[_0xd00b('0xa')]);router[_0xd00b('0x8')](_0xd00b('0xb'),auth[_0xd00b('0x9')](),controller['show']);router[_0xd00b('0x8')](_0xd00b('0xc'),auth[_0xd00b('0x9')](),controller[_0xd00b('0xd')]);router[_0xd00b('0x8')](_0xd00b('0xe'),auth[_0xd00b('0x9')](),controller[_0xd00b('0xf')]);router[_0xd00b('0x8')](_0xd00b('0x10'),auth[_0xd00b('0x9')](),controller[_0xd00b('0x11')]);router['post']('/',auth[_0xd00b('0x9')](),controller[_0xd00b('0x12')]);router['put'](_0xd00b('0xb'),auth[_0xd00b('0x9')](),controller['update']);router[_0xd00b('0x13')]('/:id',auth[_0xd00b('0x9')](),controller[_0xd00b('0x14')]);module[_0xd00b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index bc51af5..bd7c09e 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 _0x5f7b=['exports','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f7b,0x13b));var _0xb5f7=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x5f7b[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0xb5f7('0x0'));module[_0xb5f7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb662=['STRING'];(function(_0x123824,_0x52a5c7){var _0x1421eb=function(_0x37881){while(--_0x37881){_0x123824['push'](_0x123824['shift']());}};_0x1421eb(++_0x52a5c7);}(_0xb662,0x1e0));var _0x2b66=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xb662[_0x257495];return _0x3849aa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2b66('0x0')]},'description':{'type':Sequelize[_0x2b66('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 81072e8..9404fa7 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 _0x3fb7=['moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','options','VtigerConfiguration','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','VtigerField','keys','filter','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3d3696,_0x411325){var _0x389c45=function(_0x4062ed){while(--_0x4062ed){_0x3d3696['push'](_0x3d3696['shift']());}};_0x389c45(++_0x411325);}(_0x3fb7,0x187));var _0x73fb=function(_0x138406,_0x4d598c){_0x138406=_0x138406-0x0;var _0x9952cd=_0x3fb7[_0x138406];return _0x9952cd;};'use strict';var emlformat=require(_0x73fb('0x0'));var rimraf=require(_0x73fb('0x1'));var zipdir=require(_0x73fb('0x2'));var jsonpatch=require(_0x73fb('0x3'));var rp=require('request-promise');var moment=require(_0x73fb('0x4'));var BPromise=require(_0x73fb('0x5'));var Mustache=require(_0x73fb('0x6'));var util=require(_0x73fb('0x7'));var path=require('path');var sox=require(_0x73fb('0x8'));var csv=require(_0x73fb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73fb('0xa'));var _=require('lodash');var squel=require(_0x73fb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x73fb('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x73fb('0xd'));var Redis=require(_0x73fb('0xe'));var authService=require(_0x73fb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x73fb('0x10'));var hardwareService=require(_0x73fb('0x11'));var logger=require(_0x73fb('0x12'))(_0x73fb('0x13'));var utils=require(_0x73fb('0x14'));var config=require(_0x73fb('0x15'));var licenseUtil=require(_0x73fb('0x16'));var db=require(_0x73fb('0x17'))['db'];function respondWithStatusCode(_0x297ae4,_0x3ad47a){_0x3ad47a=_0x3ad47a||0xcc;return function(_0x568a82){if(_0x568a82){return _0x297ae4[_0x73fb('0x18')](_0x3ad47a);}return _0x297ae4[_0x73fb('0x19')](_0x3ad47a)['end']();};}function respondWithResult(_0x3b50df,_0x408d32){_0x408d32=_0x408d32||0xc8;return function(_0x191225){if(_0x191225){return _0x3b50df[_0x73fb('0x19')](_0x408d32)[_0x73fb('0x1a')](_0x191225);}};}function respondWithFilteredResult(_0x39f2ea,_0x944607){return function(_0x26a5b5){if(_0x26a5b5){var _0x2bf934=typeof _0x944607['offset']===_0x73fb('0x1b')&&typeof _0x944607[_0x73fb('0x1c')]==='undefined';var _0x3385f4=_0x26a5b5[_0x73fb('0x1d')];var _0x162f53=_0x2bf934?0x0:_0x944607[_0x73fb('0x1e')];var _0x407606=_0x2bf934?_0x26a5b5[_0x73fb('0x1d')]:_0x944607[_0x73fb('0x1e')]+_0x944607['limit'];var _0x4b9b69;if(_0x407606>=_0x3385f4){_0x407606=_0x3385f4;_0x4b9b69=0xc8;}else{_0x4b9b69=0xce;}_0x39f2ea[_0x73fb('0x19')](_0x4b9b69);return _0x39f2ea[_0x73fb('0x1f')](_0x73fb('0x20'),_0x162f53+'-'+_0x407606+'/'+_0x3385f4)[_0x73fb('0x1a')](_0x26a5b5);}return null;};}function patchUpdates(_0x582b57){return function(_0x166b8e){try{jsonpatch[_0x73fb('0x21')](_0x166b8e,_0x582b57,!![]);}catch(_0x1dbca4){return BPromise[_0x73fb('0x22')](_0x1dbca4);}return _0x166b8e['save']();};}function saveUpdates(_0x3dc160,_0x4d9b7a){return function(_0x59f520){if(_0x59f520){return _0x59f520[_0x73fb('0x23')](_0x3dc160)[_0x73fb('0x24')](function(_0x2661ce){return _0x2661ce;});}return null;};}function removeEntity(_0x3275ba,_0x871c49){return function(_0x49a3dc){if(_0x49a3dc){return _0x49a3dc[_0x73fb('0x25')]()[_0x73fb('0x24')](function(){_0x3275ba['status'](0xcc)[_0x73fb('0x26')]();});}};}function handleEntityNotFound(_0x22b597,_0xa494eb){return function(_0x4034f7){if(!_0x4034f7){_0x22b597[_0x73fb('0x18')](0x194);}return _0x4034f7;};}function handleError(_0x517e30,_0x1762ca){_0x1762ca=_0x1762ca||0x1f4;return function(_0x147a57){logger[_0x73fb('0x27')](_0x147a57['stack']);if(_0x147a57[_0x73fb('0x28')]){delete _0x147a57[_0x73fb('0x28')];}_0x517e30[_0x73fb('0x19')](_0x1762ca)['send'](_0x147a57);};}exports[_0x73fb('0x29')]=function(_0x5283b5,_0xa4e2bc){var _0x7d4387={},_0xa145ec={},_0x103075={'count':0x0,'rows':[]};var _0x261556=_[_0x73fb('0x2a')](db['VtigerConfiguration'][_0x73fb('0x2b')],function(_0x4397c7){return{'name':_0x4397c7[_0x73fb('0x2c')],'type':_0x4397c7[_0x73fb('0x2d')][_0x73fb('0x2e')]};});_0xa145ec['model']=_[_0x73fb('0x2a')](_0x261556,'name');_0xa145ec[_0x73fb('0x2f')]=_['keys'](_0x5283b5[_0x73fb('0x2f')]);_0xa145ec['filters']=_[_0x73fb('0x30')](_0xa145ec[_0x73fb('0x31')],_0xa145ec[_0x73fb('0x2f')]);_0x7d4387[_0x73fb('0x32')]=_[_0x73fb('0x30')](_0xa145ec['model'],qs[_0x73fb('0x33')](_0x5283b5[_0x73fb('0x2f')]['fields']));_0x7d4387[_0x73fb('0x32')]=_0x7d4387[_0x73fb('0x32')][_0x73fb('0x34')]?_0x7d4387['attributes']:_0xa145ec['model'];if(!_0x5283b5['query'][_0x73fb('0x35')]('nolimit')){_0x7d4387[_0x73fb('0x1c')]=qs[_0x73fb('0x1c')](_0x5283b5[_0x73fb('0x2f')][_0x73fb('0x1c')]);_0x7d4387[_0x73fb('0x1e')]=qs[_0x73fb('0x1e')](_0x5283b5[_0x73fb('0x2f')][_0x73fb('0x1e')]);}_0x7d4387[_0x73fb('0x36')]=qs[_0x73fb('0x37')](_0x5283b5[_0x73fb('0x2f')]['sort']);_0x7d4387[_0x73fb('0x38')]=qs[_0x73fb('0x39')](_[_0x73fb('0x3a')](_0x5283b5['query'],_0xa145ec[_0x73fb('0x39')]),_0x261556);if(_0x5283b5['query']['filter']){_0x7d4387[_0x73fb('0x38')]=_[_0x73fb('0x3b')](_0x7d4387[_0x73fb('0x38')],{'$or':_[_0x73fb('0x2a')](_0x261556,function(_0x27e3b7){if(_0x27e3b7[_0x73fb('0x2d')]!=='VIRTUAL'){var _0x7f98a2={};_0x7f98a2[_0x27e3b7[_0x73fb('0x28')]]={'$like':'%'+_0x5283b5[_0x73fb('0x2f')]['filter']+'%'};return _0x7f98a2;}})});}_0x7d4387=_[_0x73fb('0x3b')]({},_0x7d4387,_0x5283b5[_0x73fb('0x3c')]);var _0x1521fe={'where':_0x7d4387[_0x73fb('0x38')]};return db[_0x73fb('0x3d')][_0x73fb('0x1d')](_0x1521fe)[_0x73fb('0x24')](function(_0x3bb7b6){_0x103075[_0x73fb('0x1d')]=_0x3bb7b6;if(_0x5283b5[_0x73fb('0x2f')]['includeAll']){_0x7d4387[_0x73fb('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x73fb('0x3f')](_0x7d4387);})[_0x73fb('0x24')](function(_0x4d199a){_0x103075[_0x73fb('0x40')]=_0x4d199a;return _0x103075;})[_0x73fb('0x24')](respondWithFilteredResult(_0xa4e2bc,_0x7d4387))[_0x73fb('0x41')](handleError(_0xa4e2bc,null));};exports[_0x73fb('0x42')]=function(_0x121b55,_0x5f439a){var _0x10b02d={'raw':![],'where':{'id':_0x121b55[_0x73fb('0x43')]['id']}},_0x18cabd={};_0x18cabd['model']=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x18cabd[_0x73fb('0x2f')]=_['keys'](_0x121b55[_0x73fb('0x2f')]);_0x18cabd[_0x73fb('0x39')]=_[_0x73fb('0x30')](_0x18cabd[_0x73fb('0x31')],_0x18cabd[_0x73fb('0x2f')]);_0x10b02d[_0x73fb('0x32')]=_[_0x73fb('0x30')](_0x18cabd[_0x73fb('0x31')],qs[_0x73fb('0x33')](_0x121b55[_0x73fb('0x2f')]['fields']));_0x10b02d[_0x73fb('0x32')]=_0x10b02d[_0x73fb('0x32')]['length']?_0x10b02d[_0x73fb('0x32')]:_0x18cabd[_0x73fb('0x31')];if(_0x121b55['query']['includeAll']){_0x10b02d[_0x73fb('0x3e')]=[{'all':!![]}];}_0x10b02d=_[_0x73fb('0x3b')]({},_0x10b02d,_0x121b55['options']);return db[_0x73fb('0x3d')][_0x73fb('0x44')](_0x10b02d)['then'](handleEntityNotFound(_0x5f439a,null))[_0x73fb('0x24')](respondWithResult(_0x5f439a,null))[_0x73fb('0x41')](handleError(_0x5f439a,null));};exports[_0x73fb('0x45')]=function(_0x4783da,_0x3692a7){return db[_0x73fb('0x3d')]['create'](_0x4783da[_0x73fb('0x46')],{})[_0x73fb('0x24')](respondWithResult(_0x3692a7,0xc9))[_0x73fb('0x41')](handleError(_0x3692a7,null));};exports[_0x73fb('0x23')]=function(_0x165553,_0xda4628){if(_0x165553[_0x73fb('0x46')]['id']){delete _0x165553['body']['id'];}return db['VtigerConfiguration'][_0x73fb('0x44')]({'where':{'id':_0x165553[_0x73fb('0x43')]['id']}})[_0x73fb('0x24')](handleEntityNotFound(_0xda4628,null))[_0x73fb('0x24')](saveUpdates(_0x165553[_0x73fb('0x46')],null))['then'](respondWithResult(_0xda4628,null))[_0x73fb('0x41')](handleError(_0xda4628,null));};exports[_0x73fb('0x25')]=function(_0x18c4af,_0x39314e){return db[_0x73fb('0x3d')][_0x73fb('0x44')]({'where':{'id':_0x18c4af[_0x73fb('0x43')]['id']}})[_0x73fb('0x24')](handleEntityNotFound(_0x39314e,null))[_0x73fb('0x24')](removeEntity(_0x39314e,null))['catch'](handleError(_0x39314e,null));};exports[_0x73fb('0x47')]=function(_0x1e5279,_0x455351,_0x458ebe){var _0x42bad8={};var _0x1f8f17={};var _0x889973;var _0x50008b;return db[_0x73fb('0x3d')][_0x73fb('0x48')]({'where':{'id':_0x1e5279[_0x73fb('0x43')]['id']}})[_0x73fb('0x24')](handleEntityNotFound(_0x455351,null))[_0x73fb('0x24')](function(_0x310c47){if(_0x310c47){_0x889973=_0x310c47;_0x1f8f17[_0x73fb('0x31')]=_['keys'](db[_0x73fb('0x49')]['rawAttributes']);_0x1f8f17[_0x73fb('0x2f')]=_[_0x73fb('0x4a')](_0x1e5279[_0x73fb('0x2f')]);_0x1f8f17[_0x73fb('0x39')]=_['intersection'](_0x1f8f17[_0x73fb('0x31')],_0x1f8f17[_0x73fb('0x2f')]);_0x42bad8[_0x73fb('0x32')]=_[_0x73fb('0x30')](_0x1f8f17[_0x73fb('0x31')],qs['fields'](_0x1e5279[_0x73fb('0x2f')][_0x73fb('0x33')]));_0x42bad8[_0x73fb('0x32')]=_0x42bad8['attributes'][_0x73fb('0x34')]?_0x42bad8['attributes']:_0x1f8f17[_0x73fb('0x31')];_0x42bad8[_0x73fb('0x36')]=qs[_0x73fb('0x37')](_0x1e5279['query']['sort']);_0x42bad8[_0x73fb('0x38')]=qs[_0x73fb('0x39')](_[_0x73fb('0x3a')](_0x1e5279[_0x73fb('0x2f')],_0x1f8f17[_0x73fb('0x39')]));if(_0x1e5279['query'][_0x73fb('0x4b')]){_0x42bad8['where']=_['merge'](_0x42bad8[_0x73fb('0x38')],{'$or':_[_0x73fb('0x2a')](_0x42bad8[_0x73fb('0x32')],function(_0x57859b){var _0x475fcc={};_0x475fcc[_0x57859b]={'$like':'%'+_0x1e5279[_0x73fb('0x2f')][_0x73fb('0x4b')]+'%'};return _0x475fcc;})});}_0x42bad8=_[_0x73fb('0x3b')]({},_0x42bad8,_0x1e5279['options']);return _0x889973[_0x73fb('0x47')](_0x42bad8);}})['then'](function(_0x2a9332){if(_0x2a9332){_0x50008b=_0x2a9332['length'];if(!_0x1e5279[_0x73fb('0x2f')][_0x73fb('0x35')](_0x73fb('0x4c'))){_0x42bad8[_0x73fb('0x1c')]=qs[_0x73fb('0x1c')](_0x1e5279[_0x73fb('0x2f')][_0x73fb('0x1c')]);_0x42bad8[_0x73fb('0x1e')]=qs[_0x73fb('0x1e')](_0x1e5279[_0x73fb('0x2f')][_0x73fb('0x1e')]);}return _0x889973[_0x73fb('0x47')](_0x42bad8);}})[_0x73fb('0x24')](function(_0x238424){if(_0x238424){return _0x238424?{'count':_0x50008b,'rows':_0x238424}:null;}})[_0x73fb('0x24')](respondWithResult(_0x455351,null))[_0x73fb('0x41')](handleError(_0x455351,null));};exports[_0x73fb('0x4d')]=function(_0xaa6bd2,_0x4dabcf,_0x22c367){var _0x4d16d1={};var _0x120a15={};var _0x1f6b94;var _0x284be1;return db['VtigerConfiguration']['findOne']({'where':{'id':_0xaa6bd2[_0x73fb('0x43')]['id']}})['then'](handleEntityNotFound(_0x4dabcf,null))['then'](function(_0x482fcc){if(_0x482fcc){_0x1f6b94=_0x482fcc;_0x120a15[_0x73fb('0x31')]=_[_0x73fb('0x4a')](db[_0x73fb('0x49')][_0x73fb('0x2b')]);_0x120a15['query']=_['keys'](_0xaa6bd2[_0x73fb('0x2f')]);_0x120a15[_0x73fb('0x39')]=_[_0x73fb('0x30')](_0x120a15[_0x73fb('0x31')],_0x120a15[_0x73fb('0x2f')]);_0x4d16d1[_0x73fb('0x32')]=_[_0x73fb('0x30')](_0x120a15[_0x73fb('0x31')],qs[_0x73fb('0x33')](_0xaa6bd2[_0x73fb('0x2f')][_0x73fb('0x33')]));_0x4d16d1['attributes']=_0x4d16d1['attributes'][_0x73fb('0x34')]?_0x4d16d1[_0x73fb('0x32')]:_0x120a15['model'];_0x4d16d1[_0x73fb('0x36')]=qs[_0x73fb('0x37')](_0xaa6bd2[_0x73fb('0x2f')][_0x73fb('0x37')]);_0x4d16d1['where']=qs['filters'](_[_0x73fb('0x3a')](_0xaa6bd2[_0x73fb('0x2f')],_0x120a15[_0x73fb('0x39')]));if(_0xaa6bd2[_0x73fb('0x2f')][_0x73fb('0x4b')]){_0x4d16d1[_0x73fb('0x38')]=_[_0x73fb('0x3b')](_0x4d16d1[_0x73fb('0x38')],{'$or':_['map'](_0x4d16d1['attributes'],function(_0x2b92d3){var _0x12a88c={};_0x12a88c[_0x2b92d3]={'$like':'%'+_0xaa6bd2[_0x73fb('0x2f')]['filter']+'%'};return _0x12a88c;})});}_0x4d16d1=_['merge']({},_0x4d16d1,_0xaa6bd2['options']);return _0x1f6b94[_0x73fb('0x4d')](_0x4d16d1);}})['then'](function(_0x483132){if(_0x483132){_0x284be1=_0x483132[_0x73fb('0x34')];if(!_0xaa6bd2[_0x73fb('0x2f')][_0x73fb('0x35')](_0x73fb('0x4c'))){_0x4d16d1[_0x73fb('0x1c')]=qs[_0x73fb('0x1c')](_0xaa6bd2[_0x73fb('0x2f')]['limit']);_0x4d16d1[_0x73fb('0x1e')]=qs[_0x73fb('0x1e')](_0xaa6bd2['query'][_0x73fb('0x1e')]);}return _0x1f6b94['getSubjects'](_0x4d16d1);}})[_0x73fb('0x24')](function(_0x2fe385){if(_0x2fe385){return _0x2fe385?{'count':_0x284be1,'rows':_0x2fe385}:null;}})[_0x73fb('0x24')](respondWithResult(_0x4dabcf,null))['catch'](handleError(_0x4dabcf,null));};exports[_0x73fb('0x4e')]=function(_0x19e4fa,_0x243695,_0x329972){var _0x5a85e3={};var _0x1add77={};var _0x55edf1;var _0x5d1072;return db[_0x73fb('0x3d')][_0x73fb('0x48')]({'where':{'id':_0x19e4fa['params']['id']}})['then'](handleEntityNotFound(_0x243695,null))['then'](function(_0xfcd6e3){if(_0xfcd6e3){_0x55edf1=_0xfcd6e3;_0x1add77[_0x73fb('0x31')]=_[_0x73fb('0x4a')](db[_0x73fb('0x49')][_0x73fb('0x2b')]);_0x1add77['query']=_[_0x73fb('0x4a')](_0x19e4fa['query']);_0x1add77[_0x73fb('0x39')]=_['intersection'](_0x1add77[_0x73fb('0x31')],_0x1add77['query']);_0x5a85e3[_0x73fb('0x32')]=_[_0x73fb('0x30')](_0x1add77[_0x73fb('0x31')],qs[_0x73fb('0x33')](_0x19e4fa[_0x73fb('0x2f')][_0x73fb('0x33')]));_0x5a85e3[_0x73fb('0x32')]=_0x5a85e3['attributes'][_0x73fb('0x34')]?_0x5a85e3['attributes']:_0x1add77[_0x73fb('0x31')];_0x5a85e3['order']=qs['sort'](_0x19e4fa[_0x73fb('0x2f')][_0x73fb('0x37')]);_0x5a85e3[_0x73fb('0x38')]=qs[_0x73fb('0x39')](_['pick'](_0x19e4fa['query'],_0x1add77['filters']));if(_0x19e4fa[_0x73fb('0x2f')][_0x73fb('0x4b')]){_0x5a85e3[_0x73fb('0x38')]=_[_0x73fb('0x3b')](_0x5a85e3[_0x73fb('0x38')],{'$or':_['map'](_0x5a85e3[_0x73fb('0x32')],function(_0x1dea62){var _0x527e68={};_0x527e68[_0x1dea62]={'$like':'%'+_0x19e4fa[_0x73fb('0x2f')][_0x73fb('0x4b')]+'%'};return _0x527e68;})});}_0x5a85e3=_[_0x73fb('0x3b')]({},_0x5a85e3,_0x19e4fa['options']);return _0x55edf1['getDescriptions'](_0x5a85e3);}})['then'](function(_0x57a62c){if(_0x57a62c){_0x5d1072=_0x57a62c['length'];if(!_0x19e4fa[_0x73fb('0x2f')][_0x73fb('0x35')](_0x73fb('0x4c'))){_0x5a85e3[_0x73fb('0x1c')]=qs['limit'](_0x19e4fa[_0x73fb('0x2f')][_0x73fb('0x1c')]);_0x5a85e3[_0x73fb('0x1e')]=qs['offset'](_0x19e4fa[_0x73fb('0x2f')][_0x73fb('0x1e')]);}return _0x55edf1['getDescriptions'](_0x5a85e3);}})[_0x73fb('0x24')](function(_0x5c6896){if(_0x5c6896){return _0x5c6896?{'count':_0x5d1072,'rows':_0x5c6896}:null;}})['then'](respondWithResult(_0x243695,null))[_0x73fb('0x41')](handleError(_0x243695,null));}; \ No newline at end of file +var _0xfb3d=['merge','VIRTUAL','VtigerConfiguration','include','findAll','rows','catch','params','keys','rawAttributes','length','options','find','create','body','update','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','set','apply','reject','save','then','status','error','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x16dde4,_0x489b4b){var _0x56e6ce=function(_0x56fac6){while(--_0x56fac6){_0x16dde4['push'](_0x16dde4['shift']());}};_0x56e6ce(++_0x489b4b);}(_0xfb3d,0x1ef));var _0xdfb3=function(_0x21c49d,_0x2fac14){_0x21c49d=_0x21c49d-0x0;var _0x2e3468=_0xfb3d[_0x21c49d];return _0x2e3468;};'use strict';var emlformat=require(_0xdfb3('0x0'));var rimraf=require(_0xdfb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfb3('0x2'));var rp=require(_0xdfb3('0x3'));var moment=require('moment');var BPromise=require(_0xdfb3('0x4'));var Mustache=require(_0xdfb3('0x5'));var util=require(_0xdfb3('0x6'));var path=require(_0xdfb3('0x7'));var sox=require(_0xdfb3('0x8'));var csv=require(_0xdfb3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfb3('0xa'));var squel=require(_0xdfb3('0xb'));var crypto=require(_0xdfb3('0xc'));var jsforce=require(_0xdfb3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdfb3('0x9'));var querystring=require(_0xdfb3('0xe'));var Papa=require(_0xdfb3('0xf'));var Redis=require(_0xdfb3('0x10'));var authService=require(_0xdfb3('0x11'));var qs=require(_0xdfb3('0x12'));var as=require(_0xdfb3('0x13'));var hardwareService=require(_0xdfb3('0x14'));var logger=require(_0xdfb3('0x15'))(_0xdfb3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdfb3('0x17'))['db'];function respondWithStatusCode(_0x2a5711,_0x477ec4){_0x477ec4=_0x477ec4||0xcc;return function(_0xcbc593){if(_0xcbc593){return _0x2a5711[_0xdfb3('0x18')](_0x477ec4);}return _0x2a5711['status'](_0x477ec4)[_0xdfb3('0x19')]();};}function respondWithResult(_0x5aec2f,_0xfbb3ef){_0xfbb3ef=_0xfbb3ef||0xc8;return function(_0x58a613){if(_0x58a613){return _0x5aec2f['status'](_0xfbb3ef)[_0xdfb3('0x1a')](_0x58a613);}};}function respondWithFilteredResult(_0x40f33e,_0x443de3){return function(_0x43673f){if(_0x43673f){var _0x5c316f=typeof _0x443de3['offset']===_0xdfb3('0x1b')&&typeof _0x443de3['limit']===_0xdfb3('0x1b');var _0x2dc621=_0x43673f[_0xdfb3('0x1c')];var _0x302bc3=_0x5c316f?0x0:_0x443de3[_0xdfb3('0x1d')];var _0x139cd1=_0x5c316f?_0x43673f[_0xdfb3('0x1c')]:_0x443de3[_0xdfb3('0x1d')]+_0x443de3[_0xdfb3('0x1e')];var _0x573869;if(_0x139cd1>=_0x2dc621){_0x139cd1=_0x2dc621;_0x573869=0xc8;}else{_0x573869=0xce;}_0x40f33e['status'](_0x573869);return _0x40f33e[_0xdfb3('0x1f')]('Content-Range',_0x302bc3+'-'+_0x139cd1+'/'+_0x2dc621)[_0xdfb3('0x1a')](_0x43673f);}return null;};}function patchUpdates(_0x10ccab){return function(_0x25e6ed){try{jsonpatch[_0xdfb3('0x20')](_0x25e6ed,_0x10ccab,!![]);}catch(_0x4be837){return BPromise[_0xdfb3('0x21')](_0x4be837);}return _0x25e6ed[_0xdfb3('0x22')]();};}function saveUpdates(_0x1a1525,_0x248985){return function(_0x256cdb){if(_0x256cdb){return _0x256cdb['update'](_0x1a1525)[_0xdfb3('0x23')](function(_0x31816f){return _0x31816f;});}return null;};}function removeEntity(_0x5f53c8,_0x2cac20){return function(_0x1f7cfb){if(_0x1f7cfb){return _0x1f7cfb['destroy']()['then'](function(){_0x5f53c8[_0xdfb3('0x24')](0xcc)[_0xdfb3('0x19')]();});}};}function handleEntityNotFound(_0x375a01,_0x4a6be8){return function(_0x5b987f){if(!_0x5b987f){_0x375a01['sendStatus'](0x194);}return _0x5b987f;};}function handleError(_0x2d12eb,_0x9046f6){_0x9046f6=_0x9046f6||0x1f4;return function(_0x209921){logger[_0xdfb3('0x25')](_0x209921[_0xdfb3('0x26')]);if(_0x209921[_0xdfb3('0x27')]){delete _0x209921['name'];}_0x2d12eb[_0xdfb3('0x24')](_0x9046f6)['send'](_0x209921);};}exports[_0xdfb3('0x28')]=function(_0x19430f,_0x3c4f36){var _0x3e8240={},_0x762ac1={},_0x28d1c3={'count':0x0,'rows':[]};var _0x5952c8=_[_0xdfb3('0x29')](db['VtigerConfiguration']['rawAttributes'],function(_0x44cb6a){return{'name':_0x44cb6a[_0xdfb3('0x2a')],'type':_0x44cb6a[_0xdfb3('0x2b')][_0xdfb3('0x2c')]};});_0x762ac1[_0xdfb3('0x2d')]=_[_0xdfb3('0x29')](_0x5952c8,_0xdfb3('0x27'));_0x762ac1[_0xdfb3('0x2e')]=_['keys'](_0x19430f[_0xdfb3('0x2e')]);_0x762ac1[_0xdfb3('0x2f')]=_[_0xdfb3('0x30')](_0x762ac1[_0xdfb3('0x2d')],_0x762ac1[_0xdfb3('0x2e')]);_0x3e8240['attributes']=_[_0xdfb3('0x30')](_0x762ac1[_0xdfb3('0x2d')],qs[_0xdfb3('0x31')](_0x19430f[_0xdfb3('0x2e')]['fields']));_0x3e8240[_0xdfb3('0x32')]=_0x3e8240[_0xdfb3('0x32')]['length']?_0x3e8240[_0xdfb3('0x32')]:_0x762ac1[_0xdfb3('0x2d')];if(!_0x19430f[_0xdfb3('0x2e')][_0xdfb3('0x33')](_0xdfb3('0x34'))){_0x3e8240['limit']=qs[_0xdfb3('0x1e')](_0x19430f[_0xdfb3('0x2e')][_0xdfb3('0x1e')]);_0x3e8240[_0xdfb3('0x1d')]=qs[_0xdfb3('0x1d')](_0x19430f[_0xdfb3('0x2e')]['offset']);}_0x3e8240[_0xdfb3('0x35')]=qs[_0xdfb3('0x36')](_0x19430f[_0xdfb3('0x2e')][_0xdfb3('0x36')]);_0x3e8240[_0xdfb3('0x37')]=qs['filters'](_[_0xdfb3('0x38')](_0x19430f[_0xdfb3('0x2e')],_0x762ac1[_0xdfb3('0x2f')]),_0x5952c8);if(_0x19430f[_0xdfb3('0x2e')][_0xdfb3('0x39')]){_0x3e8240[_0xdfb3('0x37')]=_[_0xdfb3('0x3a')](_0x3e8240[_0xdfb3('0x37')],{'$or':_['map'](_0x5952c8,function(_0x9327a4){if(_0x9327a4[_0xdfb3('0x2b')]!==_0xdfb3('0x3b')){var _0x1b9d96={};_0x1b9d96[_0x9327a4[_0xdfb3('0x27')]]={'$like':'%'+_0x19430f[_0xdfb3('0x2e')][_0xdfb3('0x39')]+'%'};return _0x1b9d96;}})});}_0x3e8240=_[_0xdfb3('0x3a')]({},_0x3e8240,_0x19430f['options']);var _0x4a0980={'where':_0x3e8240[_0xdfb3('0x37')]};return db[_0xdfb3('0x3c')][_0xdfb3('0x1c')](_0x4a0980)['then'](function(_0x471527){_0x28d1c3[_0xdfb3('0x1c')]=_0x471527;if(_0x19430f['query']['includeAll']){_0x3e8240[_0xdfb3('0x3d')]=[{'all':!![]}];}return db[_0xdfb3('0x3c')][_0xdfb3('0x3e')](_0x3e8240);})[_0xdfb3('0x23')](function(_0x44c38c){_0x28d1c3[_0xdfb3('0x3f')]=_0x44c38c;return _0x28d1c3;})[_0xdfb3('0x23')](respondWithFilteredResult(_0x3c4f36,_0x3e8240))[_0xdfb3('0x40')](handleError(_0x3c4f36,null));};exports['show']=function(_0x51378,_0x5da24c){var _0x4411ac={'raw':![],'where':{'id':_0x51378[_0xdfb3('0x41')]['id']}},_0x4b847e={};_0x4b847e[_0xdfb3('0x2d')]=_[_0xdfb3('0x42')](db[_0xdfb3('0x3c')][_0xdfb3('0x43')]);_0x4b847e[_0xdfb3('0x2e')]=_[_0xdfb3('0x42')](_0x51378['query']);_0x4b847e[_0xdfb3('0x2f')]=_[_0xdfb3('0x30')](_0x4b847e[_0xdfb3('0x2d')],_0x4b847e[_0xdfb3('0x2e')]);_0x4411ac['attributes']=_[_0xdfb3('0x30')](_0x4b847e[_0xdfb3('0x2d')],qs[_0xdfb3('0x31')](_0x51378[_0xdfb3('0x2e')][_0xdfb3('0x31')]));_0x4411ac[_0xdfb3('0x32')]=_0x4411ac['attributes'][_0xdfb3('0x44')]?_0x4411ac[_0xdfb3('0x32')]:_0x4b847e[_0xdfb3('0x2d')];if(_0x51378['query']['includeAll']){_0x4411ac[_0xdfb3('0x3d')]=[{'all':!![]}];}_0x4411ac=_[_0xdfb3('0x3a')]({},_0x4411ac,_0x51378[_0xdfb3('0x45')]);return db[_0xdfb3('0x3c')][_0xdfb3('0x46')](_0x4411ac)['then'](handleEntityNotFound(_0x5da24c,null))[_0xdfb3('0x23')](respondWithResult(_0x5da24c,null))['catch'](handleError(_0x5da24c,null));};exports[_0xdfb3('0x47')]=function(_0x109962,_0x2c95be){return db[_0xdfb3('0x3c')][_0xdfb3('0x47')](_0x109962[_0xdfb3('0x48')],{})['then'](respondWithResult(_0x2c95be,0xc9))[_0xdfb3('0x40')](handleError(_0x2c95be,null));};exports[_0xdfb3('0x49')]=function(_0x413cba,_0x5322c9){if(_0x413cba['body']['id']){delete _0x413cba[_0xdfb3('0x48')]['id'];}return db[_0xdfb3('0x3c')][_0xdfb3('0x46')]({'where':{'id':_0x413cba[_0xdfb3('0x41')]['id']}})[_0xdfb3('0x23')](handleEntityNotFound(_0x5322c9,null))[_0xdfb3('0x23')](saveUpdates(_0x413cba[_0xdfb3('0x48')],null))[_0xdfb3('0x23')](respondWithResult(_0x5322c9,null))['catch'](handleError(_0x5322c9,null));};exports['destroy']=function(_0xc94254,_0x4021a3){return db[_0xdfb3('0x3c')][_0xdfb3('0x46')]({'where':{'id':_0xc94254[_0xdfb3('0x41')]['id']}})[_0xdfb3('0x23')](handleEntityNotFound(_0x4021a3,null))[_0xdfb3('0x23')](removeEntity(_0x4021a3,null))[_0xdfb3('0x40')](handleError(_0x4021a3,null));};exports[_0xdfb3('0x4a')]=function(_0x59bd39,_0x15ed91,_0x42c9ff){var _0x105f4e={};var _0x1ab4ce={};var _0x16585d;var _0x45571f;return db['VtigerConfiguration'][_0xdfb3('0x4b')]({'where':{'id':_0x59bd39['params']['id']}})[_0xdfb3('0x23')](handleEntityNotFound(_0x15ed91,null))['then'](function(_0x1da87c){if(_0x1da87c){_0x16585d=_0x1da87c;_0x1ab4ce[_0xdfb3('0x2d')]=_[_0xdfb3('0x42')](db[_0xdfb3('0x4c')][_0xdfb3('0x43')]);_0x1ab4ce['query']=_[_0xdfb3('0x42')](_0x59bd39[_0xdfb3('0x2e')]);_0x1ab4ce[_0xdfb3('0x2f')]=_[_0xdfb3('0x30')](_0x1ab4ce[_0xdfb3('0x2d')],_0x1ab4ce[_0xdfb3('0x2e')]);_0x105f4e[_0xdfb3('0x32')]=_[_0xdfb3('0x30')](_0x1ab4ce['model'],qs[_0xdfb3('0x31')](_0x59bd39[_0xdfb3('0x2e')][_0xdfb3('0x31')]));_0x105f4e[_0xdfb3('0x32')]=_0x105f4e[_0xdfb3('0x32')][_0xdfb3('0x44')]?_0x105f4e['attributes']:_0x1ab4ce['model'];_0x105f4e[_0xdfb3('0x35')]=qs[_0xdfb3('0x36')](_0x59bd39[_0xdfb3('0x2e')][_0xdfb3('0x36')]);_0x105f4e[_0xdfb3('0x37')]=qs[_0xdfb3('0x2f')](_[_0xdfb3('0x38')](_0x59bd39[_0xdfb3('0x2e')],_0x1ab4ce[_0xdfb3('0x2f')]));if(_0x59bd39[_0xdfb3('0x2e')]['filter']){_0x105f4e['where']=_[_0xdfb3('0x3a')](_0x105f4e[_0xdfb3('0x37')],{'$or':_[_0xdfb3('0x29')](_0x105f4e['attributes'],function(_0x23ed85){var _0x3ea62f={};_0x3ea62f[_0x23ed85]={'$like':'%'+_0x59bd39[_0xdfb3('0x2e')][_0xdfb3('0x39')]+'%'};return _0x3ea62f;})});}_0x105f4e=_[_0xdfb3('0x3a')]({},_0x105f4e,_0x59bd39[_0xdfb3('0x45')]);return _0x16585d[_0xdfb3('0x4a')](_0x105f4e);}})[_0xdfb3('0x23')](function(_0x3a1f93){if(_0x3a1f93){_0x45571f=_0x3a1f93['length'];if(!_0x59bd39['query']['hasOwnProperty']('nolimit')){_0x105f4e['limit']=qs[_0xdfb3('0x1e')](_0x59bd39[_0xdfb3('0x2e')][_0xdfb3('0x1e')]);_0x105f4e[_0xdfb3('0x1d')]=qs[_0xdfb3('0x1d')](_0x59bd39['query'][_0xdfb3('0x1d')]);}return _0x16585d[_0xdfb3('0x4a')](_0x105f4e);}})[_0xdfb3('0x23')](function(_0x2a04f2){if(_0x2a04f2){return _0x2a04f2?{'count':_0x45571f,'rows':_0x2a04f2}:null;}})[_0xdfb3('0x23')](respondWithResult(_0x15ed91,null))[_0xdfb3('0x40')](handleError(_0x15ed91,null));};exports['getSubjects']=function(_0x34a67b,_0x5d51b0,_0x35b845){var _0x276a4b={};var _0xf93f61={};var _0x12e56f;var _0x5c1017;return db['VtigerConfiguration'][_0xdfb3('0x4b')]({'where':{'id':_0x34a67b[_0xdfb3('0x41')]['id']}})[_0xdfb3('0x23')](handleEntityNotFound(_0x5d51b0,null))[_0xdfb3('0x23')](function(_0x1340e8){if(_0x1340e8){_0x12e56f=_0x1340e8;_0xf93f61[_0xdfb3('0x2d')]=_[_0xdfb3('0x42')](db[_0xdfb3('0x4c')]['rawAttributes']);_0xf93f61[_0xdfb3('0x2e')]=_[_0xdfb3('0x42')](_0x34a67b[_0xdfb3('0x2e')]);_0xf93f61[_0xdfb3('0x2f')]=_[_0xdfb3('0x30')](_0xf93f61['model'],_0xf93f61[_0xdfb3('0x2e')]);_0x276a4b['attributes']=_[_0xdfb3('0x30')](_0xf93f61[_0xdfb3('0x2d')],qs['fields'](_0x34a67b['query']['fields']));_0x276a4b[_0xdfb3('0x32')]=_0x276a4b[_0xdfb3('0x32')]['length']?_0x276a4b['attributes']:_0xf93f61[_0xdfb3('0x2d')];_0x276a4b[_0xdfb3('0x35')]=qs[_0xdfb3('0x36')](_0x34a67b['query'][_0xdfb3('0x36')]);_0x276a4b[_0xdfb3('0x37')]=qs[_0xdfb3('0x2f')](_['pick'](_0x34a67b['query'],_0xf93f61['filters']));if(_0x34a67b[_0xdfb3('0x2e')][_0xdfb3('0x39')]){_0x276a4b['where']=_[_0xdfb3('0x3a')](_0x276a4b[_0xdfb3('0x37')],{'$or':_[_0xdfb3('0x29')](_0x276a4b[_0xdfb3('0x32')],function(_0x35beb5){var _0x4391ad={};_0x4391ad[_0x35beb5]={'$like':'%'+_0x34a67b['query'][_0xdfb3('0x39')]+'%'};return _0x4391ad;})});}_0x276a4b=_[_0xdfb3('0x3a')]({},_0x276a4b,_0x34a67b[_0xdfb3('0x45')]);return _0x12e56f[_0xdfb3('0x4d')](_0x276a4b);}})['then'](function(_0x47792d){if(_0x47792d){_0x5c1017=_0x47792d[_0xdfb3('0x44')];if(!_0x34a67b['query'][_0xdfb3('0x33')](_0xdfb3('0x34'))){_0x276a4b[_0xdfb3('0x1e')]=qs['limit'](_0x34a67b[_0xdfb3('0x2e')][_0xdfb3('0x1e')]);_0x276a4b[_0xdfb3('0x1d')]=qs['offset'](_0x34a67b[_0xdfb3('0x2e')][_0xdfb3('0x1d')]);}return _0x12e56f['getSubjects'](_0x276a4b);}})['then'](function(_0x245f61){if(_0x245f61){return _0x245f61?{'count':_0x5c1017,'rows':_0x245f61}:null;}})[_0xdfb3('0x23')](respondWithResult(_0x5d51b0,null))[_0xdfb3('0x40')](handleError(_0x5d51b0,null));};exports['getDescriptions']=function(_0x5ef541,_0x4dd5e7,_0x50027d){var _0x115495={};var _0x1c23c9={};var _0x3659b2;var _0x31b35b;return db['VtigerConfiguration'][_0xdfb3('0x4b')]({'where':{'id':_0x5ef541[_0xdfb3('0x41')]['id']}})[_0xdfb3('0x23')](handleEntityNotFound(_0x4dd5e7,null))['then'](function(_0x500ad7){if(_0x500ad7){_0x3659b2=_0x500ad7;_0x1c23c9[_0xdfb3('0x2d')]=_[_0xdfb3('0x42')](db[_0xdfb3('0x4c')][_0xdfb3('0x43')]);_0x1c23c9[_0xdfb3('0x2e')]=_['keys'](_0x5ef541['query']);_0x1c23c9[_0xdfb3('0x2f')]=_['intersection'](_0x1c23c9['model'],_0x1c23c9[_0xdfb3('0x2e')]);_0x115495[_0xdfb3('0x32')]=_[_0xdfb3('0x30')](_0x1c23c9[_0xdfb3('0x2d')],qs[_0xdfb3('0x31')](_0x5ef541['query'][_0xdfb3('0x31')]));_0x115495[_0xdfb3('0x32')]=_0x115495[_0xdfb3('0x32')][_0xdfb3('0x44')]?_0x115495[_0xdfb3('0x32')]:_0x1c23c9['model'];_0x115495[_0xdfb3('0x35')]=qs[_0xdfb3('0x36')](_0x5ef541[_0xdfb3('0x2e')][_0xdfb3('0x36')]);_0x115495['where']=qs[_0xdfb3('0x2f')](_[_0xdfb3('0x38')](_0x5ef541[_0xdfb3('0x2e')],_0x1c23c9[_0xdfb3('0x2f')]));if(_0x5ef541[_0xdfb3('0x2e')]['filter']){_0x115495[_0xdfb3('0x37')]=_[_0xdfb3('0x3a')](_0x115495[_0xdfb3('0x37')],{'$or':_[_0xdfb3('0x29')](_0x115495['attributes'],function(_0x248c67){var _0x4ef778={};_0x4ef778[_0x248c67]={'$like':'%'+_0x5ef541[_0xdfb3('0x2e')][_0xdfb3('0x39')]+'%'};return _0x4ef778;})});}_0x115495=_[_0xdfb3('0x3a')]({},_0x115495,_0x5ef541[_0xdfb3('0x45')]);return _0x3659b2['getDescriptions'](_0x115495);}})['then'](function(_0x51f21c){if(_0x51f21c){_0x31b35b=_0x51f21c['length'];if(!_0x5ef541['query']['hasOwnProperty'](_0xdfb3('0x34'))){_0x115495['limit']=qs[_0xdfb3('0x1e')](_0x5ef541['query'][_0xdfb3('0x1e')]);_0x115495['offset']=qs['offset'](_0x5ef541['query'][_0xdfb3('0x1d')]);}return _0x3659b2[_0xdfb3('0x4e')](_0x115495);}})[_0xdfb3('0x23')](function(_0x2036fc){if(_0x2036fc){return _0x2036fc?{'count':_0x31b35b,'rows':_0x2036fc}:null;}})[_0xdfb3('0x23')](respondWithResult(_0x4dd5e7,null))['catch'](handleError(_0x4dd5e7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index fa9e8dd..03e0d0c 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 _0xd47d=['int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration'];(function(_0x55410b,_0x59e074){var _0x154f9a=function(_0x18d523){while(--_0x18d523){_0x55410b['push'](_0x55410b['shift']());}};_0x154f9a(++_0x59e074);}(_0xd47d,0xef));var _0xdd47=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0xd47d[_0x389832];return _0x59429e;};'use strict';var _=require(_0xdd47('0x0'));var util=require(_0xdd47('0x1'));var logger=require(_0xdd47('0x2'))(_0xdd47('0x3'));var moment=require(_0xdd47('0x4'));var BPromise=require(_0xdd47('0x5'));var rp=require(_0xdd47('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd47('0x7'));var config=require(_0xdd47('0x8'));var attributes=require(_0xdd47('0x9'));module[_0xdd47('0xa')]=function(_0x109a6b,_0x26edde){return _0x109a6b[_0xdd47('0xb')](_0xdd47('0xc'),attributes,{'tableName':_0xdd47('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19ac=['util','api','moment','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x2644f8,_0x40977c){var _0x233fea=function(_0x308f49){while(--_0x308f49){_0x2644f8['push'](_0x2644f8['shift']());}};_0x233fea(++_0x40977c);}(_0x19ac,0x134));var _0xc19a=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x19ac[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require(_0xc19a('0x0'));var logger=require('../../config/logger')(_0xc19a('0x1'));var moment=require(_0xc19a('0x2'));var BPromise=require('bluebird');var rp=require(_0xc19a('0x3'));var fs=require('fs');var path=require(_0xc19a('0x4'));var rimraf=require(_0xc19a('0x5'));var config=require('../../config/environment');var attributes=require(_0xc19a('0x6'));module[_0xc19a('0x7')]=function(_0x3fb44e,_0x4dc37e){return _0x3fb44e[_0xc19a('0x8')](_0xc19a('0x9'),attributes,{'tableName':_0xc19a('0xa'),'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 f8dbd47..5da3d6a 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 _0x76ec=['stringify','error','code','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3923ea,_0x19d953){var _0x1146cc=function(_0x1327e2){while(--_0x1327e2){_0x3923ea['push'](_0x3923ea['shift']());}};_0x1146cc(++_0x19d953);}(_0x76ec,0x1d1));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc76e('0x0'));var util=require(_0xc76e('0x1'));var moment=require(_0xc76e('0x2'));var BPromise=require('bluebird');var rs=require(_0xc76e('0x3'));var fs=require('fs');var Redis=require(_0xc76e('0x4'));var db=require(_0xc76e('0x5'))['db'];var utils=require(_0xc76e('0x6'));var logger=require(_0xc76e('0x7'))(_0xc76e('0x8'));var config=require(_0xc76e('0x9'));var jayson=require(_0xc76e('0xa'));var client=jayson[_0xc76e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba05f,_0x29e489,_0x21de64){return new BPromise(function(_0x5e6aca,_0x4d0480){return client[_0xc76e('0xc')](_0x4ba05f,_0x21de64)[_0xc76e('0xd')](function(_0x2c909f){logger['info'](_0xc76e('0xe'),_0x29e489,_0xc76e('0xf'));logger[_0xc76e('0x10')](_0xc76e('0x11'),_0x29e489,'request\x20sent',JSON[_0xc76e('0x12')](_0x2c909f));if(_0x2c909f[_0xc76e('0x13')]){if(_0x2c909f[_0xc76e('0x13')][_0xc76e('0x14')]===0x1f4){logger[_0xc76e('0x13')](_0xc76e('0xe'),_0x29e489,_0x2c909f[_0xc76e('0x13')]['message']);return _0x4d0480(_0x2c909f[_0xc76e('0x13')][_0xc76e('0x15')]);}logger[_0xc76e('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x29e489,_0x2c909f[_0xc76e('0x13')][_0xc76e('0x15')]);return _0x5e6aca(_0x2c909f['error']['message']);}else{logger[_0xc76e('0x16')]('VtigerConfiguration,\x20%s,\x20%s',_0x29e489,_0xc76e('0xf'));_0x5e6aca(_0x2c909f['result'][_0xc76e('0x15')]);}})['catch'](function(_0x456e30){logger[_0xc76e('0x13')](_0xc76e('0xe'),_0x29e489,_0x456e30);_0x4d0480(_0x456e30);});});} \ No newline at end of file +var _0x3924=['rpc','jayson/promise','client','http','request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x51d7a7,_0x3a1285){var _0x52dcba=function(_0x393ac2){while(--_0x393ac2){_0x51d7a7['push'](_0x51d7a7['shift']());}};_0x52dcba(++_0x3a1285);}(_0x3924,0xce));var _0x4392=function(_0x2451ff,_0x2681db){_0x2451ff=_0x2451ff-0x0;var _0x476a41=_0x3924[_0x2451ff];return _0x476a41;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4392('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4392('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x4392('0x2'));var logger=require(_0x4392('0x3'))(_0x4392('0x4'));var config=require('../../config/environment');var jayson=require(_0x4392('0x5'));var client=jayson[_0x4392('0x6')][_0x4392('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4dc631,_0x5f485e,_0x35b066){return new BPromise(function(_0x19f012,_0x3d6591){return client[_0x4392('0x8')](_0x4dc631,_0x35b066)[_0x4392('0x9')](function(_0x133a17){logger[_0x4392('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x5f485e,'request\x20sent');logger[_0x4392('0xb')](_0x4392('0xc'),_0x5f485e,_0x4392('0xd'),JSON[_0x4392('0xe')](_0x133a17));if(_0x133a17[_0x4392('0xf')]){if(_0x133a17[_0x4392('0xf')][_0x4392('0x10')]===0x1f4){logger[_0x4392('0xf')](_0x4392('0x11'),_0x5f485e,_0x133a17[_0x4392('0xf')][_0x4392('0x12')]);return _0x3d6591(_0x133a17[_0x4392('0xf')][_0x4392('0x12')]);}logger[_0x4392('0xf')](_0x4392('0x11'),_0x5f485e,_0x133a17[_0x4392('0xf')][_0x4392('0x12')]);return _0x19f012(_0x133a17[_0x4392('0xf')][_0x4392('0x12')]);}else{logger['info'](_0x4392('0x11'),_0x5f485e,_0x4392('0xd'));_0x19f012(_0x133a17[_0x4392('0x13')][_0x4392('0x12')]);}})[_0x4392('0x14')](function(_0x338776){logger[_0x4392('0xf')](_0x4392('0x11'),_0x5f485e,_0x338776);_0x3d6591(_0x338776);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ccc6fcc..c2199ab 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 _0x90a7=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','exports','multer','path','connect-timeout'];(function(_0x2fcb3b,_0x2b43a8){var _0x273e3d=function(_0x1b1d8a){while(--_0x1b1d8a){_0x2fcb3b['push'](_0x2fcb3b['shift']());}};_0x273e3d(++_0x2b43a8);}(_0x90a7,0x173));var _0x790a=function(_0x25a0b7,_0x1b9079){_0x25a0b7=_0x25a0b7-0x0;var _0x28d223=_0x90a7[_0x25a0b7];return _0x28d223;};'use strict';var multer=require(_0x790a('0x0'));var util=require('util');var path=require(_0x790a('0x1'));var timeout=require(_0x790a('0x2'));var express=require(_0x790a('0x3'));var router=express[_0x790a('0x4')]();var fs_extra=require(_0x790a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x790a('0x6'));var config=require(_0x790a('0x7'));var controller=require('./intVtigerField.controller');router[_0x790a('0x8')]('/',auth[_0x790a('0x9')](),controller[_0x790a('0xa')]);router[_0x790a('0x8')]('/:id',auth[_0x790a('0x9')](),controller[_0x790a('0xb')]);router[_0x790a('0xc')]('/',auth[_0x790a('0x9')](),controller[_0x790a('0xd')]);router[_0x790a('0xe')]('/:id',auth[_0x790a('0x9')](),controller[_0x790a('0xf')]);router['delete']('/:id',auth[_0x790a('0x9')](),controller['destroy']);module[_0x790a('0x10')]=router; \ No newline at end of file +var _0xd150=['destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x25fc5e,_0x3e5425){var _0x300001=function(_0x33e59e){while(--_0x33e59e){_0x25fc5e['push'](_0x25fc5e['shift']());}};_0x300001(++_0x3e5425);}(_0xd150,0x1f1));var _0x0d15=function(_0x56827a,_0x34b0d3){_0x56827a=_0x56827a-0x0;var _0x1629be=_0xd150[_0x56827a];return _0x1629be;};'use strict';var multer=require(_0x0d15('0x0'));var util=require(_0x0d15('0x1'));var path=require(_0x0d15('0x2'));var timeout=require(_0x0d15('0x3'));var express=require(_0x0d15('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0d15('0x5'));var config=require('../../config/environment');var controller=require(_0x0d15('0x6'));router[_0x0d15('0x7')]('/',auth[_0x0d15('0x8')](),controller['index']);router[_0x0d15('0x7')](_0x0d15('0x9'),auth['isAuthenticated'](),controller[_0x0d15('0xa')]);router['post']('/',auth[_0x0d15('0x8')](),controller[_0x0d15('0xb')]);router[_0x0d15('0xc')]('/:id',auth[_0x0d15('0x8')](),controller[_0x0d15('0xd')]);router[_0x0d15('0xe')]('/:id',auth[_0x0d15('0x8')](),controller[_0x0d15('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 9f65e8a..22e3aa2 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 _0xff02=['keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable'];(function(_0x248a7a,_0x184d92){var _0xf9c371=function(_0x5bd0f5){while(--_0x5bd0f5){_0x248a7a['push'](_0x248a7a['shift']());}};_0xf9c371(++_0x184d92);}(_0xff02,0x101));var _0x2ff0=function(_0x4990cd,_0xdf7383){_0x4990cd=_0x4990cd-0x0;var _0x5b038f=_0xff02[_0x4990cd];return _0x5b038f;};'use strict';var Sequelize=require('sequelize');module[_0x2ff0('0x0')]={'type':{'type':Sequelize['ENUM'](_0x2ff0('0x1'),_0x2ff0('0x2'),_0x2ff0('0x3'),_0x2ff0('0x4'),_0x2ff0('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2ff0('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2ff0('0x7')]('string',_0x2ff0('0x2'),_0x2ff0('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2ff0('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2ff0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ff0('0x6')]}}; \ No newline at end of file +var _0xe3d4=['sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x3d5cdc,_0x43ff0d){var _0x5c4aaa=function(_0x442b1a){while(--_0x442b1a){_0x3d5cdc['push'](_0x3d5cdc['shift']());}};_0x5c4aaa(++_0x43ff0d);}(_0xe3d4,0xe0));var _0x4e3d=function(_0x4f66c2,_0x47d4ed){_0x4f66c2=_0x4f66c2-0x0;var _0x447633=_0xe3d4[_0x4f66c2];return _0x447633;};'use strict';var Sequelize=require(_0x4e3d('0x0'));module[_0x4e3d('0x1')]={'type':{'type':Sequelize[_0x4e3d('0x2')](_0x4e3d('0x3'),_0x4e3d('0x4'),'customVariable',_0x4e3d('0x5'),'picklist'),'defaultValue':_0x4e3d('0x3')},'content':{'type':Sequelize[_0x4e3d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4e3d('0x2')](_0x4e3d('0x3'),_0x4e3d('0x4'),_0x4e3d('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4e3d('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4e3d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 4246b81..d6baf3f 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 _0x6f28=['jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','name','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel'];(function(_0x21ef65,_0x15f001){var _0x309f7b=function(_0x1bd40a){while(--_0x1bd40a){_0x21ef65['push'](_0x21ef65['shift']());}};_0x309f7b(++_0x15f001);}(_0x6f28,0x118));var _0x86f2=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x6f28[_0x1d1d09];return _0x8827e;};'use strict';var emlformat=require(_0x86f2('0x0'));var rimraf=require(_0x86f2('0x1'));var zipdir=require(_0x86f2('0x2'));var jsonpatch=require(_0x86f2('0x3'));var rp=require('request-promise');var moment=require(_0x86f2('0x4'));var BPromise=require(_0x86f2('0x5'));var Mustache=require(_0x86f2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x86f2('0x7'));var csv=require(_0x86f2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86f2('0x9'));var _=require(_0x86f2('0xa'));var squel=require(_0x86f2('0xb'));var crypto=require('crypto');var jsforce=require(_0x86f2('0xc'));var deskjs=require(_0x86f2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x86f2('0xe'));var Papa=require('papaparse');var Redis=require(_0x86f2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x86f2('0x10'));var as=require(_0x86f2('0x11'));var hardwareService=require(_0x86f2('0x12'));var logger=require(_0x86f2('0x13'))(_0x86f2('0x14'));var utils=require(_0x86f2('0x15'));var config=require(_0x86f2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x86f2('0x17'))['db'];function respondWithStatusCode(_0x42e35e,_0x8bc130){_0x8bc130=_0x8bc130||0xcc;return function(_0x4d46af){if(_0x4d46af){return _0x42e35e[_0x86f2('0x18')](_0x8bc130);}return _0x42e35e[_0x86f2('0x19')](_0x8bc130)['end']();};}function respondWithResult(_0x26ee59,_0x2d857f){_0x2d857f=_0x2d857f||0xc8;return function(_0x59bd05){if(_0x59bd05){return _0x26ee59[_0x86f2('0x19')](_0x2d857f)['json'](_0x59bd05);}};}function respondWithFilteredResult(_0x8dce02,_0x4ffe1a){return function(_0x3e3f9c){if(_0x3e3f9c){var _0x194129=typeof _0x4ffe1a[_0x86f2('0x1a')]===_0x86f2('0x1b')&&typeof _0x4ffe1a['limit']===_0x86f2('0x1b');var _0x1af596=_0x3e3f9c[_0x86f2('0x1c')];var _0x2cbe1d=_0x194129?0x0:_0x4ffe1a['offset'];var _0x1bcfef=_0x194129?_0x3e3f9c['count']:_0x4ffe1a['offset']+_0x4ffe1a[_0x86f2('0x1d')];var _0x51fd79;if(_0x1bcfef>=_0x1af596){_0x1bcfef=_0x1af596;_0x51fd79=0xc8;}else{_0x51fd79=0xce;}_0x8dce02['status'](_0x51fd79);return _0x8dce02[_0x86f2('0x1e')](_0x86f2('0x1f'),_0x2cbe1d+'-'+_0x1bcfef+'/'+_0x1af596)[_0x86f2('0x20')](_0x3e3f9c);}return null;};}function patchUpdates(_0x125d5e){return function(_0x252f91){try{jsonpatch[_0x86f2('0x21')](_0x252f91,_0x125d5e,!![]);}catch(_0x34779c){return BPromise['reject'](_0x34779c);}return _0x252f91[_0x86f2('0x22')]();};}function saveUpdates(_0x51b529,_0x2ca0ad){return function(_0x1a32df){if(_0x1a32df){return _0x1a32df[_0x86f2('0x23')](_0x51b529)[_0x86f2('0x24')](function(_0xf8dcfc){return _0xf8dcfc;});}return null;};}function removeEntity(_0x9f644a,_0x2a6e43){return function(_0x46c1e9){if(_0x46c1e9){return _0x46c1e9[_0x86f2('0x25')]()[_0x86f2('0x24')](function(){_0x9f644a['status'](0xcc)[_0x86f2('0x26')]();});}};}function handleEntityNotFound(_0x3f3ffd,_0x419cc6){return function(_0x3f7b12){if(!_0x3f7b12){_0x3f3ffd[_0x86f2('0x18')](0x194);}return _0x3f7b12;};}function handleError(_0x4d74e4,_0x2f53b3){_0x2f53b3=_0x2f53b3||0x1f4;return function(_0x798832){logger[_0x86f2('0x27')](_0x798832['stack']);if(_0x798832[_0x86f2('0x28')]){delete _0x798832['name'];}_0x4d74e4[_0x86f2('0x19')](_0x2f53b3)['send'](_0x798832);};}exports[_0x86f2('0x29')]=function(_0x58d2c9,_0x1be671){var _0x58f902={},_0x1cc20e={},_0x5b10d9={'count':0x0,'rows':[]};var _0x382ac7=_['map'](db[_0x86f2('0x2a')][_0x86f2('0x2b')],function(_0x334c05){return{'name':_0x334c05[_0x86f2('0x2c')],'type':_0x334c05[_0x86f2('0x2d')][_0x86f2('0x2e')]};});_0x1cc20e[_0x86f2('0x2f')]=_[_0x86f2('0x30')](_0x382ac7,'name');_0x1cc20e[_0x86f2('0x31')]=_[_0x86f2('0x32')](_0x58d2c9[_0x86f2('0x31')]);_0x1cc20e[_0x86f2('0x33')]=_['intersection'](_0x1cc20e[_0x86f2('0x2f')],_0x1cc20e[_0x86f2('0x31')]);_0x58f902[_0x86f2('0x34')]=_[_0x86f2('0x35')](_0x1cc20e[_0x86f2('0x2f')],qs[_0x86f2('0x36')](_0x58d2c9['query'][_0x86f2('0x36')]));_0x58f902[_0x86f2('0x34')]=_0x58f902['attributes'][_0x86f2('0x37')]?_0x58f902[_0x86f2('0x34')]:_0x1cc20e[_0x86f2('0x2f')];if(!_0x58d2c9[_0x86f2('0x31')][_0x86f2('0x38')]('nolimit')){_0x58f902['limit']=qs[_0x86f2('0x1d')](_0x58d2c9[_0x86f2('0x31')][_0x86f2('0x1d')]);_0x58f902[_0x86f2('0x1a')]=qs[_0x86f2('0x1a')](_0x58d2c9[_0x86f2('0x31')]['offset']);}_0x58f902[_0x86f2('0x39')]=qs['sort'](_0x58d2c9[_0x86f2('0x31')][_0x86f2('0x3a')]);_0x58f902[_0x86f2('0x3b')]=qs[_0x86f2('0x33')](_['pick'](_0x58d2c9[_0x86f2('0x31')],_0x1cc20e[_0x86f2('0x33')]),_0x382ac7);if(_0x58d2c9['query'][_0x86f2('0x3c')]){_0x58f902[_0x86f2('0x3b')]=_[_0x86f2('0x3d')](_0x58f902[_0x86f2('0x3b')],{'$or':_[_0x86f2('0x30')](_0x382ac7,function(_0x40f778){if(_0x40f778['type']!==_0x86f2('0x3e')){var _0x192392={};_0x192392[_0x40f778['name']]={'$like':'%'+_0x58d2c9[_0x86f2('0x31')][_0x86f2('0x3c')]+'%'};return _0x192392;}})});}_0x58f902=_[_0x86f2('0x3d')]({},_0x58f902,_0x58d2c9['options']);var _0x2a2913={'where':_0x58f902[_0x86f2('0x3b')]};return db[_0x86f2('0x2a')][_0x86f2('0x1c')](_0x2a2913)['then'](function(_0x209af3){_0x5b10d9[_0x86f2('0x1c')]=_0x209af3;if(_0x58d2c9[_0x86f2('0x31')][_0x86f2('0x3f')]){_0x58f902['include']=[{'all':!![]}];}return db[_0x86f2('0x2a')][_0x86f2('0x40')](_0x58f902);})[_0x86f2('0x24')](function(_0x4476bd){_0x5b10d9['rows']=_0x4476bd;return _0x5b10d9;})[_0x86f2('0x24')](respondWithFilteredResult(_0x1be671,_0x58f902))[_0x86f2('0x41')](handleError(_0x1be671,null));};exports[_0x86f2('0x42')]=function(_0x2d3608,_0x241404){var _0x4d410e={'raw':!![],'where':{'id':_0x2d3608[_0x86f2('0x43')]['id']}},_0x1347e6={};_0x1347e6[_0x86f2('0x2f')]=_[_0x86f2('0x32')](db[_0x86f2('0x2a')][_0x86f2('0x2b')]);_0x1347e6['query']=_[_0x86f2('0x32')](_0x2d3608['query']);_0x1347e6['filters']=_[_0x86f2('0x35')](_0x1347e6[_0x86f2('0x2f')],_0x1347e6[_0x86f2('0x31')]);_0x4d410e[_0x86f2('0x34')]=_[_0x86f2('0x35')](_0x1347e6[_0x86f2('0x2f')],qs['fields'](_0x2d3608[_0x86f2('0x31')]['fields']));_0x4d410e[_0x86f2('0x34')]=_0x4d410e['attributes'][_0x86f2('0x37')]?_0x4d410e[_0x86f2('0x34')]:_0x1347e6[_0x86f2('0x2f')];if(_0x2d3608[_0x86f2('0x31')][_0x86f2('0x3f')]){_0x4d410e[_0x86f2('0x44')]=[{'all':!![]}];}_0x4d410e=_['merge']({},_0x4d410e,_0x2d3608[_0x86f2('0x45')]);return db[_0x86f2('0x2a')]['find'](_0x4d410e)[_0x86f2('0x24')](handleEntityNotFound(_0x241404,null))[_0x86f2('0x24')](respondWithResult(_0x241404,null))[_0x86f2('0x41')](handleError(_0x241404,null));};exports['create']=function(_0x552471,_0x41ff08){return db[_0x86f2('0x2a')][_0x86f2('0x46')](_0x552471['body'],{})[_0x86f2('0x24')](respondWithResult(_0x41ff08,0xc9))[_0x86f2('0x41')](handleError(_0x41ff08,null));};exports[_0x86f2('0x23')]=function(_0x124efb,_0x258ccb){if(_0x124efb[_0x86f2('0x47')]['id']){delete _0x124efb[_0x86f2('0x47')]['id'];}return db[_0x86f2('0x2a')][_0x86f2('0x48')]({'where':{'id':_0x124efb[_0x86f2('0x43')]['id']}})['then'](handleEntityNotFound(_0x258ccb,null))[_0x86f2('0x24')](saveUpdates(_0x124efb[_0x86f2('0x47')],null))[_0x86f2('0x24')](respondWithResult(_0x258ccb,null))[_0x86f2('0x41')](handleError(_0x258ccb,null));};exports[_0x86f2('0x25')]=function(_0x4902e3,_0x2dc7d5){return db[_0x86f2('0x2a')][_0x86f2('0x48')]({'where':{'id':_0x4902e3[_0x86f2('0x43')]['id']}})[_0x86f2('0x24')](handleEntityNotFound(_0x2dc7d5,null))['then'](removeEntity(_0x2dc7d5,null))[_0x86f2('0x41')](handleError(_0x2dc7d5,null));}; \ No newline at end of file +var _0xb20c=['ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','reject','save','then','destroy','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv'];(function(_0x486a0f,_0x56a6ec){var _0xe3a726=function(_0x183ce7){while(--_0x183ce7){_0x486a0f['push'](_0x486a0f['shift']());}};_0xe3a726(++_0x56a6ec);}(_0xb20c,0xce));var _0xcb20=function(_0x29fb42,_0x4fbc0c){_0x29fb42=_0x29fb42-0x0;var _0x51188e=_0xb20c[_0x29fb42];return _0x51188e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb20('0x0'));var zipdir=require(_0xcb20('0x1'));var jsonpatch=require(_0xcb20('0x2'));var rp=require(_0xcb20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcb20('0x4'));var path=require(_0xcb20('0x5'));var sox=require('sox');var csv=require(_0xcb20('0x6'));var ejs=require(_0xcb20('0x7'));var fs=require('fs');var fs_extra=require(_0xcb20('0x8'));var _=require(_0xcb20('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcb20('0xa'));var toCsv=require('to-csv');var querystring=require(_0xcb20('0xb'));var Papa=require(_0xcb20('0xc'));var Redis=require(_0xcb20('0xd'));var authService=require(_0xcb20('0xe'));var qs=require(_0xcb20('0xf'));var as=require(_0xcb20('0x10'));var hardwareService=require(_0xcb20('0x11'));var logger=require('../../config/logger')(_0xcb20('0x12'));var utils=require(_0xcb20('0x13'));var config=require(_0xcb20('0x14'));var licenseUtil=require(_0xcb20('0x15'));var db=require(_0xcb20('0x16'))['db'];function respondWithStatusCode(_0x12550c,_0x55e51b){_0x55e51b=_0x55e51b||0xcc;return function(_0x405e64){if(_0x405e64){return _0x12550c[_0xcb20('0x17')](_0x55e51b);}return _0x12550c[_0xcb20('0x18')](_0x55e51b)[_0xcb20('0x19')]();};}function respondWithResult(_0x3c33d2,_0x908516){_0x908516=_0x908516||0xc8;return function(_0x356928){if(_0x356928){return _0x3c33d2[_0xcb20('0x18')](_0x908516)['json'](_0x356928);}};}function respondWithFilteredResult(_0x17a308,_0x485ebf){return function(_0x4ad36c){if(_0x4ad36c){var _0x231686=typeof _0x485ebf['offset']===_0xcb20('0x1a')&&typeof _0x485ebf[_0xcb20('0x1b')]===_0xcb20('0x1a');var _0x139b33=_0x4ad36c['count'];var _0x43e203=_0x231686?0x0:_0x485ebf[_0xcb20('0x1c')];var _0x51fa7a=_0x231686?_0x4ad36c['count']:_0x485ebf[_0xcb20('0x1c')]+_0x485ebf['limit'];var _0x20e807;if(_0x51fa7a>=_0x139b33){_0x51fa7a=_0x139b33;_0x20e807=0xc8;}else{_0x20e807=0xce;}_0x17a308[_0xcb20('0x18')](_0x20e807);return _0x17a308[_0xcb20('0x1d')](_0xcb20('0x1e'),_0x43e203+'-'+_0x51fa7a+'/'+_0x139b33)[_0xcb20('0x1f')](_0x4ad36c);}return null;};}function patchUpdates(_0x448234){return function(_0x5f226b){try{jsonpatch['apply'](_0x5f226b,_0x448234,!![]);}catch(_0x40b6f4){return BPromise[_0xcb20('0x20')](_0x40b6f4);}return _0x5f226b[_0xcb20('0x21')]();};}function saveUpdates(_0x20a301,_0x45bde7){return function(_0x17146c){if(_0x17146c){return _0x17146c['update'](_0x20a301)[_0xcb20('0x22')](function(_0x5aec79){return _0x5aec79;});}return null;};}function removeEntity(_0x20d335,_0x33c744){return function(_0x1706b7){if(_0x1706b7){return _0x1706b7[_0xcb20('0x23')]()['then'](function(){_0x20d335['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bb628,_0x216849){return function(_0x1fcac7){if(!_0x1fcac7){_0x3bb628[_0xcb20('0x17')](0x194);}return _0x1fcac7;};}function handleError(_0x31dcad,_0x17358f){_0x17358f=_0x17358f||0x1f4;return function(_0x26def3){logger['error'](_0x26def3['stack']);if(_0x26def3[_0xcb20('0x24')]){delete _0x26def3['name'];}_0x31dcad['status'](_0x17358f)[_0xcb20('0x25')](_0x26def3);};}exports[_0xcb20('0x26')]=function(_0x5e7725,_0x22678e){var _0x2e00cb={},_0x578423={},_0x3bc2f8={'count':0x0,'rows':[]};var _0x7b9be=_[_0xcb20('0x27')](db[_0xcb20('0x28')][_0xcb20('0x29')],function(_0x10b186){return{'name':_0x10b186[_0xcb20('0x2a')],'type':_0x10b186[_0xcb20('0x2b')][_0xcb20('0x2c')]};});_0x578423[_0xcb20('0x2d')]=_[_0xcb20('0x27')](_0x7b9be,'name');_0x578423['query']=_[_0xcb20('0x2e')](_0x5e7725[_0xcb20('0x2f')]);_0x578423[_0xcb20('0x30')]=_[_0xcb20('0x31')](_0x578423[_0xcb20('0x2d')],_0x578423['query']);_0x2e00cb[_0xcb20('0x32')]=_['intersection'](_0x578423[_0xcb20('0x2d')],qs[_0xcb20('0x33')](_0x5e7725[_0xcb20('0x2f')]['fields']));_0x2e00cb[_0xcb20('0x32')]=_0x2e00cb['attributes'][_0xcb20('0x34')]?_0x2e00cb['attributes']:_0x578423[_0xcb20('0x2d')];if(!_0x5e7725[_0xcb20('0x2f')]['hasOwnProperty'](_0xcb20('0x35'))){_0x2e00cb[_0xcb20('0x1b')]=qs[_0xcb20('0x1b')](_0x5e7725[_0xcb20('0x2f')]['limit']);_0x2e00cb[_0xcb20('0x1c')]=qs['offset'](_0x5e7725['query'][_0xcb20('0x1c')]);}_0x2e00cb['order']=qs[_0xcb20('0x36')](_0x5e7725[_0xcb20('0x2f')]['sort']);_0x2e00cb[_0xcb20('0x37')]=qs[_0xcb20('0x30')](_[_0xcb20('0x38')](_0x5e7725['query'],_0x578423[_0xcb20('0x30')]),_0x7b9be);if(_0x5e7725[_0xcb20('0x2f')]['filter']){_0x2e00cb[_0xcb20('0x37')]=_['merge'](_0x2e00cb['where'],{'$or':_[_0xcb20('0x27')](_0x7b9be,function(_0x2de426){if(_0x2de426[_0xcb20('0x2b')]!==_0xcb20('0x39')){var _0xe00b2f={};_0xe00b2f[_0x2de426[_0xcb20('0x24')]]={'$like':'%'+_0x5e7725['query'][_0xcb20('0x3a')]+'%'};return _0xe00b2f;}})});}_0x2e00cb=_['merge']({},_0x2e00cb,_0x5e7725[_0xcb20('0x3b')]);var _0x5055e3={'where':_0x2e00cb[_0xcb20('0x37')]};return db[_0xcb20('0x28')][_0xcb20('0x3c')](_0x5055e3)[_0xcb20('0x22')](function(_0x5d8357){_0x3bc2f8[_0xcb20('0x3c')]=_0x5d8357;if(_0x5e7725['query'][_0xcb20('0x3d')]){_0x2e00cb[_0xcb20('0x3e')]=[{'all':!![]}];}return db[_0xcb20('0x28')][_0xcb20('0x3f')](_0x2e00cb);})[_0xcb20('0x22')](function(_0x34b0eb){_0x3bc2f8[_0xcb20('0x40')]=_0x34b0eb;return _0x3bc2f8;})[_0xcb20('0x22')](respondWithFilteredResult(_0x22678e,_0x2e00cb))['catch'](handleError(_0x22678e,null));};exports[_0xcb20('0x41')]=function(_0x41ed83,_0x1dc093){var _0x363293={'raw':!![],'where':{'id':_0x41ed83[_0xcb20('0x42')]['id']}},_0x94b022={};_0x94b022[_0xcb20('0x2d')]=_[_0xcb20('0x2e')](db['VtigerField'][_0xcb20('0x29')]);_0x94b022[_0xcb20('0x2f')]=_[_0xcb20('0x2e')](_0x41ed83[_0xcb20('0x2f')]);_0x94b022[_0xcb20('0x30')]=_[_0xcb20('0x31')](_0x94b022[_0xcb20('0x2d')],_0x94b022[_0xcb20('0x2f')]);_0x363293[_0xcb20('0x32')]=_['intersection'](_0x94b022[_0xcb20('0x2d')],qs[_0xcb20('0x33')](_0x41ed83[_0xcb20('0x2f')][_0xcb20('0x33')]));_0x363293['attributes']=_0x363293['attributes'][_0xcb20('0x34')]?_0x363293['attributes']:_0x94b022['model'];if(_0x41ed83['query'][_0xcb20('0x3d')]){_0x363293['include']=[{'all':!![]}];}_0x363293=_['merge']({},_0x363293,_0x41ed83[_0xcb20('0x3b')]);return db['VtigerField'][_0xcb20('0x43')](_0x363293)['then'](handleEntityNotFound(_0x1dc093,null))[_0xcb20('0x22')](respondWithResult(_0x1dc093,null))[_0xcb20('0x44')](handleError(_0x1dc093,null));};exports[_0xcb20('0x45')]=function(_0x7f3761,_0x279d5d){return db[_0xcb20('0x28')][_0xcb20('0x45')](_0x7f3761['body'],{})[_0xcb20('0x22')](respondWithResult(_0x279d5d,0xc9))[_0xcb20('0x44')](handleError(_0x279d5d,null));};exports['update']=function(_0x45a434,_0x13e2d1){if(_0x45a434[_0xcb20('0x46')]['id']){delete _0x45a434[_0xcb20('0x46')]['id'];}return db[_0xcb20('0x28')][_0xcb20('0x43')]({'where':{'id':_0x45a434[_0xcb20('0x42')]['id']}})[_0xcb20('0x22')](handleEntityNotFound(_0x13e2d1,null))['then'](saveUpdates(_0x45a434['body'],null))['then'](respondWithResult(_0x13e2d1,null))[_0xcb20('0x44')](handleError(_0x13e2d1,null));};exports[_0xcb20('0x23')]=function(_0x4a169c,_0x59113d){return db[_0xcb20('0x28')][_0xcb20('0x43')]({'where':{'id':_0x4a169c[_0xcb20('0x42')]['id']}})[_0xcb20('0x22')](handleEntityNotFound(_0x59113d,null))[_0xcb20('0x22')](removeEntity(_0x59113d,null))[_0xcb20('0x44')](handleError(_0x59113d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9a4c905..7398312 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 _0x1181=['exports','define','VtigerField','vtiger_unique_index','FieldId','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x1181,0x7a));var _0x1118=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x1181[_0xfd9b19];return _0x514918;};'use strict';var _=require('lodash');var util=require(_0x1118('0x0'));var logger=require(_0x1118('0x1'))('api');var moment=require(_0x1118('0x2'));var BPromise=require(_0x1118('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1118('0x4'));var rimraf=require(_0x1118('0x5'));var config=require(_0x1118('0x6'));var attributes=require(_0x1118('0x7'));module[_0x1118('0x8')]=function(_0x4e2f45,_0x4c5342){return _0x4e2f45[_0x1118('0x9')](_0x1118('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x1118('0xb'),'fields':['idField',_0x1118('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ea=['idField','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_vtiger_fields','vtiger_unique_index'];(function(_0x8cc3e0,_0x5d04fc){var _0x5c7c7f=function(_0x396a06){while(--_0x396a06){_0x8cc3e0['push'](_0x8cc3e0['shift']());}};_0x5c7c7f(++_0x5d04fc);}(_0xe2ea,0xd3));var _0xae2e=function(_0x1a86f3,_0x21847a){_0x1a86f3=_0x1a86f3-0x0;var _0x399b06=_0xe2ea[_0x1a86f3];return _0x399b06;};'use strict';var _=require(_0xae2e('0x0'));var util=require(_0xae2e('0x1'));var logger=require('../../config/logger')(_0xae2e('0x2'));var moment=require(_0xae2e('0x3'));var BPromise=require(_0xae2e('0x4'));var rp=require(_0xae2e('0x5'));var fs=require('fs');var path=require(_0xae2e('0x6'));var rimraf=require(_0xae2e('0x7'));var config=require(_0xae2e('0x8'));var attributes=require('./intVtigerField.attributes');module[_0xae2e('0x9')]=function(_0x5421a9,_0xa3aa87){return _0x5421a9[_0xae2e('0xa')]('VtigerField',attributes,{'tableName':_0xae2e('0xb'),'paranoid':![],'indexes':[{'name':_0xae2e('0xc'),'fields':[_0xae2e('0xd'),'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 3ff351e..fc1ad31 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 _0xd5db=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring'];(function(_0x4618da,_0x27c024){var _0xede04a=function(_0x2bdf4c){while(--_0x2bdf4c){_0x4618da['push'](_0x4618da['shift']());}};_0xede04a(++_0x27c024);}(_0xd5db,0x176));var _0xbd5d=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xd5db[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0xbd5d('0x0'));var util=require(_0xbd5d('0x1'));var moment=require(_0xbd5d('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd5d('0x3'));var fs=require('fs');var Redis=require(_0xbd5d('0x4'));var db=require(_0xbd5d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd5d('0x6'))(_0xbd5d('0x7'));var config=require(_0xbd5d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd5d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x142cbf,_0x5ede7d,_0x510d7d){return new BPromise(function(_0x8d779d,_0x5b7022){return client['request'](_0x142cbf,_0x510d7d)[_0xbd5d('0xa')](function(_0x582778){logger[_0xbd5d('0xb')]('VtigerField,\x20%s,\x20%s',_0x5ede7d,_0xbd5d('0xc'));logger['debug'](_0xbd5d('0xd'),_0x5ede7d,_0xbd5d('0xc'),JSON[_0xbd5d('0xe')](_0x582778));if(_0x582778[_0xbd5d('0xf')]){if(_0x582778['error'][_0xbd5d('0x10')]===0x1f4){logger[_0xbd5d('0xf')]('VtigerField,\x20%s,\x20%s',_0x5ede7d,_0x582778[_0xbd5d('0xf')]['message']);return _0x5b7022(_0x582778['error'][_0xbd5d('0x11')]);}logger[_0xbd5d('0xf')](_0xbd5d('0x12'),_0x5ede7d,_0x582778[_0xbd5d('0xf')][_0xbd5d('0x11')]);return _0x8d779d(_0x582778['error'][_0xbd5d('0x11')]);}else{logger[_0xbd5d('0xb')](_0xbd5d('0x12'),_0x5ede7d,_0xbd5d('0xc'));_0x8d779d(_0x582778[_0xbd5d('0x13')][_0xbd5d('0x11')]);}})[_0xbd5d('0x14')](function(_0x9096d8){logger[_0xbd5d('0xf')](_0xbd5d('0x12'),_0x5ede7d,_0x9096d8);_0x5b7022(_0x9096d8);});});} \ No newline at end of file +var _0xcc6c=['error','code','message','VtigerField,\x20%s,\x20%s','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0xcc6c,0x1bc));var _0xccc6=function(_0x29fc74,_0xcc4da1){_0x29fc74=_0x29fc74-0x0;var _0x501db8=_0xcc6c[_0x29fc74];return _0x501db8;};'use strict';var _=require(_0xccc6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xccc6('0x1'));var rs=require(_0xccc6('0x2'));var fs=require('fs');var Redis=require(_0xccc6('0x3'));var db=require(_0xccc6('0x4'))['db'];var utils=require(_0xccc6('0x5'));var logger=require(_0xccc6('0x6'))(_0xccc6('0x7'));var config=require(_0xccc6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xccc6('0x9')][_0xccc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x335952,_0x29f43b,_0x33f69d){return new BPromise(function(_0x38ff1b,_0xf92d06){return client[_0xccc6('0xb')](_0x335952,_0x33f69d)['then'](function(_0x308d2b){logger[_0xccc6('0xc')]('VtigerField,\x20%s,\x20%s',_0x29f43b,_0xccc6('0xd'));logger[_0xccc6('0xe')](_0xccc6('0xf'),_0x29f43b,_0xccc6('0xd'),JSON['stringify'](_0x308d2b));if(_0x308d2b[_0xccc6('0x10')]){if(_0x308d2b['error'][_0xccc6('0x11')]===0x1f4){logger[_0xccc6('0x10')]('VtigerField,\x20%s,\x20%s',_0x29f43b,_0x308d2b[_0xccc6('0x10')][_0xccc6('0x12')]);return _0xf92d06(_0x308d2b[_0xccc6('0x10')][_0xccc6('0x12')]);}logger[_0xccc6('0x10')]('VtigerField,\x20%s,\x20%s',_0x29f43b,_0x308d2b[_0xccc6('0x10')][_0xccc6('0x12')]);return _0x38ff1b(_0x308d2b[_0xccc6('0x10')][_0xccc6('0x12')]);}else{logger[_0xccc6('0xc')]('VtigerField,\x20%s,\x20%s',_0x29f43b,'request\x20sent');_0x38ff1b(_0x308d2b['result'][_0xccc6('0x12')]);}})['catch'](function(_0x2d5972){logger[_0xccc6('0x10')](_0xccc6('0x13'),_0x29f43b,_0x2d5972);_0xf92d06(_0x2d5972);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 55ae3e8..477a4ad 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 _0xc9c5=['util','path','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xc9c5,0x1e3));var _0x5c9c=function(_0x48fcee,_0x431a8b){_0x48fcee=_0x48fcee-0x0;var _0x28d65a=_0xc9c5[_0x48fcee];return _0x28d65a;};'use strict';var multer=require(_0x5c9c('0x0'));var util=require(_0x5c9c('0x1'));var path=require(_0x5c9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5c9c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5c9c('0x4'));var config=require(_0x5c9c('0x5'));var controller=require(_0x5c9c('0x6'));router[_0x5c9c('0x7')]('/',auth[_0x5c9c('0x8')](),controller[_0x5c9c('0x9')]);router['get'](_0x5c9c('0xa'),auth[_0x5c9c('0x8')](),controller[_0x5c9c('0xb')]);router['get'](_0x5c9c('0xc'),auth['isAuthenticated'](),controller[_0x5c9c('0xd')]);router[_0x5c9c('0x7')](_0x5c9c('0xe'),auth['isAuthenticated'](),controller[_0x5c9c('0xf')]);router[_0x5c9c('0x10')]('/',auth['isAuthenticated'](),controller[_0x5c9c('0x11')]);router['post'](_0x5c9c('0xc'),auth[_0x5c9c('0x8')](),controller[_0x5c9c('0x12')]);router[_0x5c9c('0x13')](_0x5c9c('0xa'),auth[_0x5c9c('0x8')](),controller[_0x5c9c('0x14')]);router[_0x5c9c('0x15')]('/:id',auth[_0x5c9c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3576=['put','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x59ebe8,_0x39c0e7){var _0x5a38f6=function(_0x48ec40){while(--_0x48ec40){_0x59ebe8['push'](_0x59ebe8['shift']());}};_0x5a38f6(++_0x39c0e7);}(_0x3576,0xe9));var _0x6357=function(_0x1ba06a,_0x5ceee2){_0x1ba06a=_0x1ba06a-0x0;var _0x5ef678=_0x3576[_0x1ba06a];return _0x5ef678;};'use strict';var multer=require('multer');var util=require(_0x6357('0x0'));var path=require(_0x6357('0x1'));var timeout=require(_0x6357('0x2'));var express=require(_0x6357('0x3'));var router=express['Router']();var fs_extra=require(_0x6357('0x4'));var auth=require(_0x6357('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6357('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x6357('0x7')]('/',auth[_0x6357('0x8')](),controller[_0x6357('0x9')]);router[_0x6357('0x7')](_0x6357('0xa'),auth[_0x6357('0x8')](),controller[_0x6357('0xb')]);router['get']('/:id/configurations',auth[_0x6357('0x8')](),controller[_0x6357('0xc')]);router[_0x6357('0x7')](_0x6357('0xd'),auth['isAuthenticated'](),controller[_0x6357('0xe')]);router[_0x6357('0xf')]('/',auth[_0x6357('0x8')](),controller[_0x6357('0x10')]);router[_0x6357('0xf')](_0x6357('0x11'),auth[_0x6357('0x8')](),controller[_0x6357('0x12')]);router[_0x6357('0x13')]('/:id',auth[_0x6357('0x8')](),controller['update']);router[_0x6357('0x14')](_0x6357('0xa'),auth[_0x6357('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 442df06..b0b42ba 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 _0x9b0d=['STRING','remoteUri','password','token','ENUM','integrationTab','newTab','exports'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x5053df,_0x8b254a){_0x5053df=_0x5053df-0x0;var _0x3c2daf=_0x9b0d[_0x5053df];return _0x3c2daf;};'use strict';var Sequelize=require('sequelize');module[_0xd9b0('0x0')]={'name':{'type':Sequelize[_0xd9b0('0x1')]},'description':{'type':Sequelize[_0xd9b0('0x1')]},'username':{'type':Sequelize[_0xd9b0('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xd9b0('0x1')]},'token':{'type':Sequelize[_0xd9b0('0x1')]},'remoteUri':{'type':Sequelize[_0xd9b0('0x1')],'unique':_0xd9b0('0x2')},'authType':{'type':Sequelize['ENUM'](_0xd9b0('0x3'),_0xd9b0('0x4')),'defaultValue':_0xd9b0('0x3')},'serverUrl':{'type':Sequelize[_0xd9b0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd9b0('0x5')](_0xd9b0('0x6'),_0xd9b0('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfc46=['sequelize','STRING','remoteUri','password','token','ENUM','integrationTab'];(function(_0x212362,_0x3bfe87){var _0x3bdbec=function(_0x5261bc){while(--_0x5261bc){_0x212362['push'](_0x212362['shift']());}};_0x3bdbec(++_0x3bfe87);}(_0xfc46,0x9a));var _0x6fc4=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0xfc46[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require(_0x6fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fc4('0x1')]},'description':{'type':Sequelize[_0x6fc4('0x1')]},'username':{'type':Sequelize[_0x6fc4('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x6fc4('0x1')]},'token':{'type':Sequelize[_0x6fc4('0x1')]},'remoteUri':{'type':Sequelize[_0x6fc4('0x1')],'unique':_0x6fc4('0x2')},'authType':{'type':Sequelize['ENUM'](_0x6fc4('0x3'),_0x6fc4('0x4')),'defaultValue':_0x6fc4('0x3')},'serverUrl':{'type':Sequelize[_0x6fc4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6fc4('0x5')](_0x6fc4('0x6'),'newTab'),'defaultValue':_0x6fc4('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6b675f5..36c4a23 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 _0x3f8c=['%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','substring','lastIndexOf','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f8c,0x104));var _0xc3f8=function(_0x51db34,_0x1e5241){_0x51db34=_0x51db34-0x0;var _0x8ac68d=_0x3f8c[_0x51db34];return _0x8ac68d;};'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'];var integrations=require(_0xc3f8('0x16'));function respondWithStatusCode(_0x155c80,_0x511763){_0x511763=_0x511763||0xcc;return function(_0x84f489){if(_0x84f489){return _0x155c80[_0xc3f8('0x17')](_0x511763);}return _0x155c80[_0xc3f8('0x18')](_0x511763)[_0xc3f8('0x19')]();};}function respondWithResult(_0x6155e9,_0x47754c){_0x47754c=_0x47754c||0xc8;return function(_0x29e2b6){if(_0x29e2b6){return _0x6155e9[_0xc3f8('0x18')](_0x47754c)[_0xc3f8('0x1a')](_0x29e2b6);}};}function respondWithFilteredResult(_0x2fd8e8,_0x3cb28a){return function(_0x2a9f64){if(_0x2a9f64){var _0x29d031=typeof _0x3cb28a['offset']===_0xc3f8('0x1b')&&typeof _0x3cb28a['limit']==='undefined';var _0x3df137=_0x2a9f64[_0xc3f8('0x1c')];var _0x35500f=_0x29d031?0x0:_0x3cb28a[_0xc3f8('0x1d')];var _0x47a185=_0x29d031?_0x2a9f64[_0xc3f8('0x1c')]:_0x3cb28a[_0xc3f8('0x1d')]+_0x3cb28a['limit'];var _0xe14074;if(_0x47a185>=_0x3df137){_0x47a185=_0x3df137;_0xe14074=0xc8;}else{_0xe14074=0xce;}_0x2fd8e8['status'](_0xe14074);return _0x2fd8e8[_0xc3f8('0x1e')](_0xc3f8('0x1f'),_0x35500f+'-'+_0x47a185+'/'+_0x3df137)[_0xc3f8('0x1a')](_0x2a9f64);}return null;};}function patchUpdates(_0x53ada5){return function(_0x543dca){try{jsonpatch[_0xc3f8('0x20')](_0x543dca,_0x53ada5,!![]);}catch(_0x2a7096){return BPromise[_0xc3f8('0x21')](_0x2a7096);}return _0x543dca[_0xc3f8('0x22')]();};}function saveUpdates(_0x6522e9,_0x251bf7){return function(_0x43b2b4){if(_0x43b2b4){return _0x43b2b4[_0xc3f8('0x23')](_0x6522e9)['then'](function(_0x571f92){return _0x571f92;});}return null;};}function removeEntity(_0x4b83f0,_0x2559a4){return function(_0x5e1d14){if(_0x5e1d14){return _0x5e1d14[_0xc3f8('0x24')]()[_0xc3f8('0x25')](function(){_0x4b83f0['status'](0xcc)[_0xc3f8('0x19')]();});}};}function handleEntityNotFound(_0x327b2d,_0x2d237e){return function(_0xb883b5){if(!_0xb883b5){_0x327b2d[_0xc3f8('0x17')](0x194);}return _0xb883b5;};}function handleError(_0x9d43b4,_0xf1d460){_0xf1d460=_0xf1d460||0x1f4;return function(_0x7f14ad){logger[_0xc3f8('0x26')](_0x7f14ad[_0xc3f8('0x27')]);if(_0x7f14ad[_0xc3f8('0x28')]){delete _0x7f14ad[_0xc3f8('0x28')];}_0x9d43b4[_0xc3f8('0x18')](_0xf1d460)[_0xc3f8('0x29')](_0x7f14ad);};}exports['index']=function(_0x58b303,_0x2909f8){var _0x218029={},_0x5bf6e2={},_0x151bba={'count':0x0,'rows':[]};var _0x4d39a0=_[_0xc3f8('0x2a')](db[_0xc3f8('0x2b')]['rawAttributes'],function(_0x48b32e){return{'name':_0x48b32e[_0xc3f8('0x2c')],'type':_0x48b32e[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x5bf6e2[_0xc3f8('0x2f')]=_[_0xc3f8('0x2a')](_0x4d39a0,_0xc3f8('0x28'));_0x5bf6e2[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x58b303[_0xc3f8('0x30')]);_0x5bf6e2[_0xc3f8('0x32')]=_['intersection'](_0x5bf6e2[_0xc3f8('0x2f')],_0x5bf6e2[_0xc3f8('0x30')]);_0x218029[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x5bf6e2[_0xc3f8('0x2f')],qs['fields'](_0x58b303['query'][_0xc3f8('0x35')]));_0x218029[_0xc3f8('0x33')]=_0x218029[_0xc3f8('0x33')][_0xc3f8('0x36')]?_0x218029[_0xc3f8('0x33')]:_0x5bf6e2['model'];if(!_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x218029['limit']=qs[_0xc3f8('0x39')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x218029['offset']=qs[_0xc3f8('0x1d')](_0x58b303[_0xc3f8('0x30')]['offset']);}_0x218029[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3b')]);_0x218029[_0xc3f8('0x3c')]=qs[_0xc3f8('0x32')](_['pick'](_0x58b303[_0xc3f8('0x30')],_0x5bf6e2[_0xc3f8('0x32')]),_0x4d39a0);if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x3d')]){_0x218029[_0xc3f8('0x3c')]=_['merge'](_0x218029[_0xc3f8('0x3c')],{'$or':_[_0xc3f8('0x2a')](_0x4d39a0,function(_0xaa4c98){if(_0xaa4c98['type']!==_0xc3f8('0x3e')){var _0x83b7ab={};_0x83b7ab[_0xaa4c98[_0xc3f8('0x28')]]={'$like':'%'+_0x58b303[_0xc3f8('0x30')]['filter']+'%'};return _0x83b7ab;}})});}_0x218029=_[_0xc3f8('0x3f')]({},_0x218029,_0x58b303[_0xc3f8('0x40')]);var _0x2df096={'where':_0x218029[_0xc3f8('0x3c')]};return db['ZendeskAccount'][_0xc3f8('0x1c')](_0x2df096)['then'](function(_0x5d144b){_0x151bba[_0xc3f8('0x1c')]=_0x5d144b;if(_0x58b303[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x218029[_0xc3f8('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x218029);})[_0xc3f8('0x25')](function(_0x16805c){_0x151bba[_0xc3f8('0x43')]=_0x16805c;return _0x151bba;})[_0xc3f8('0x25')](respondWithFilteredResult(_0x2909f8,_0x218029))[_0xc3f8('0x44')](handleError(_0x2909f8,null));};exports[_0xc3f8('0x45')]=function(_0x3113b4,_0x45e6ea){var _0x13d8dc={'raw':![],'where':{'id':_0x3113b4[_0xc3f8('0x46')]['id']}},_0x34bccd={};_0x34bccd['model']=_[_0xc3f8('0x31')](db[_0xc3f8('0x2b')]['rawAttributes']);_0x34bccd[_0xc3f8('0x30')]=_[_0xc3f8('0x31')](_0x3113b4['query']);_0x34bccd[_0xc3f8('0x32')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],_0x34bccd[_0xc3f8('0x30')]);_0x13d8dc[_0xc3f8('0x33')]=_[_0xc3f8('0x34')](_0x34bccd[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x13d8dc[_0xc3f8('0x33')]=_0x13d8dc['attributes'][_0xc3f8('0x36')]?_0x13d8dc[_0xc3f8('0x33')]:_0x34bccd['model'];if(_0x3113b4[_0xc3f8('0x30')][_0xc3f8('0x41')]){_0x13d8dc[_0xc3f8('0x42')]=[{'all':!![]}];}_0x13d8dc=_[_0xc3f8('0x3f')]({},_0x13d8dc,_0x3113b4['options']);return db['ZendeskAccount'][_0xc3f8('0x47')](_0x13d8dc)[_0xc3f8('0x25')](handleEntityNotFound(_0x45e6ea,null))[_0xc3f8('0x25')](respondWithResult(_0x45e6ea,null))['catch'](handleError(_0x45e6ea,null));};exports[_0xc3f8('0x48')]=function(_0x3a665e,_0x418961){return db[_0xc3f8('0x2b')][_0xc3f8('0x48')](_0x3a665e['body'],{})[_0xc3f8('0x25')](respondWithResult(_0x418961,0xc9))[_0xc3f8('0x44')](handleError(_0x418961,null));};exports['update']=function(_0x1becae,_0x3fcb6a){if(_0x1becae[_0xc3f8('0x49')]['id']){delete _0x1becae[_0xc3f8('0x49')]['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x1becae[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fcb6a,null))[_0xc3f8('0x25')](saveUpdates(_0x1becae[_0xc3f8('0x49')],null))['then'](respondWithResult(_0x3fcb6a,null))[_0xc3f8('0x44')](handleError(_0x3fcb6a,null));};exports[_0xc3f8('0x24')]=function(_0x2448bf,_0x33e5c5){return db[_0xc3f8('0x2b')][_0xc3f8('0x47')]({'where':{'id':_0x2448bf[_0xc3f8('0x46')]['id']}})['then'](handleEntityNotFound(_0x33e5c5,null))[_0xc3f8('0x25')](removeEntity(_0x33e5c5,null))[_0xc3f8('0x44')](handleError(_0x33e5c5,null));};exports[_0xc3f8('0x4a')]=function(_0x267c95,_0x3e6c1d,_0x3d752a){var _0x97a88e={};var _0x920f4b={};var _0x4fc02c;var _0x51249a;return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x267c95['params']['id']}})['then'](handleEntityNotFound(_0x3e6c1d,null))[_0xc3f8('0x25')](function(_0x4b4adb){if(_0x4b4adb){_0x4fc02c=_0x4b4adb;_0x920f4b[_0xc3f8('0x2f')]=_[_0xc3f8('0x31')](db[_0xc3f8('0x4c')]['rawAttributes']);_0x920f4b[_0xc3f8('0x30')]=_['keys'](_0x267c95['query']);_0x920f4b[_0xc3f8('0x32')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],_0x920f4b[_0xc3f8('0x30')]);_0x97a88e[_0xc3f8('0x33')]=_['intersection'](_0x920f4b[_0xc3f8('0x2f')],qs[_0xc3f8('0x35')](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x35')]));_0x97a88e[_0xc3f8('0x33')]=_0x97a88e['attributes']['length']?_0x97a88e[_0xc3f8('0x33')]:_0x920f4b[_0xc3f8('0x2f')];_0x97a88e[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3b')](_0x267c95[_0xc3f8('0x30')]['sort']);_0x97a88e[_0xc3f8('0x3c')]=qs['filters'](_[_0xc3f8('0x4d')](_0x267c95[_0xc3f8('0x30')],_0x920f4b[_0xc3f8('0x32')]));if(_0x267c95[_0xc3f8('0x30')]['filter']){_0x97a88e[_0xc3f8('0x3c')]=_['merge'](_0x97a88e['where'],{'$or':_['map'](_0x97a88e['attributes'],function(_0x12df02){var _0x143d50={};_0x143d50[_0x12df02]={'$like':'%'+_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x3d')]+'%'};return _0x143d50;})});}_0x97a88e=_[_0xc3f8('0x3f')]({},_0x97a88e,_0x267c95[_0xc3f8('0x40')]);return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x5250df){if(_0x5250df){_0x51249a=_0x5250df[_0xc3f8('0x36')];if(!_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x37')](_0xc3f8('0x38'))){_0x97a88e[_0xc3f8('0x39')]=qs['limit'](_0x267c95[_0xc3f8('0x30')][_0xc3f8('0x39')]);_0x97a88e[_0xc3f8('0x1d')]=qs[_0xc3f8('0x1d')](_0x267c95[_0xc3f8('0x30')]['offset']);}return _0x4fc02c[_0xc3f8('0x4a')](_0x97a88e);}})[_0xc3f8('0x25')](function(_0x42b255){if(_0x42b255){return _0x42b255?{'count':_0x51249a,'rows':_0x42b255}:null;}})[_0xc3f8('0x25')](respondWithResult(_0x3e6c1d,null))[_0xc3f8('0x44')](handleError(_0x3e6c1d,null));};exports[_0xc3f8('0x4e')]=function(_0x56fd61,_0x2f199d,_0x4ca426){if(_0x56fd61[_0xc3f8('0x49')]['id']){delete _0x56fd61['body']['id'];}return db[_0xc3f8('0x2b')][_0xc3f8('0x4b')]({'where':{'id':_0x56fd61['params']['id']}})['then'](handleEntityNotFound(_0x2f199d,null))[_0xc3f8('0x25')](function(_0x2c7ab9){if(_0x2c7ab9){_0x56fd61['body'][_0xc3f8('0x4f')]=_0x2c7ab9['id'];_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x50')]=integrations[_0xc3f8('0x51')](_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x52')],_0x56fd61[_0xc3f8('0x49')][_0xc3f8('0x2d')]);_0x56fd61['body']['Descriptions']=integrations[_0xc3f8('0x53')](_0x56fd61['body']['channel'],_0x56fd61['body']['type']);return db['ZendeskConfiguration'][_0xc3f8('0x48')](_0x56fd61[_0xc3f8('0x49')],{'include':[{'model':db[_0xc3f8('0x54')],'as':_0xc3f8('0x50')},{'model':db['ZendeskField'],'as':_0xc3f8('0x55')}]});}return null;})[_0xc3f8('0x25')](respondWithResult(_0x2f199d,null))['catch'](handleError(_0x2f199d,null));};exports[_0xc3f8('0x56')]=function(_0x273faf,_0x104eec,_0x531de8){var _0xaedf89='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x273faf['params']['id']},'attributes':['id',_0xc3f8('0x57'),_0xc3f8('0x58'),'token',_0xc3f8('0x59'),_0xc3f8('0x5a')]})['then'](handleEntityNotFound(_0x104eec,null))[_0xc3f8('0x25')](function(_0x2f957a){if(_0x2f957a){_0xaedf89=_0x2f957a['remoteUri'];var _0x34edb9=_0xaedf89['slice'](-0x1);if(_0x34edb9==='/'){_0xaedf89=_0xaedf89[_0xc3f8('0x5b')](0x0,_0xaedf89[_0xc3f8('0x5c')](_0x34edb9));}var _0x4cc654={'method':'GET','uri':util[_0xc3f8('0x5d')](_0xc3f8('0x5e'),_0xaedf89,'ticket_fields'),'json':!![]};switch(_0x2f957a[_0xc3f8('0x59')]){case'password':_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x61'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x58')]))[_0xc3f8('0x62')](_0xc3f8('0x63')))};break;case _0xc3f8('0x64'):_0x4cc654[_0xc3f8('0x5f')]={'Authorization':util['format'](_0xc3f8('0x60'),new Buffer(util[_0xc3f8('0x5d')](_0xc3f8('0x65'),_0x2f957a[_0xc3f8('0x57')],_0x2f957a[_0xc3f8('0x64')]))['toString'](_0xc3f8('0x63')))};break;default:throw new db[(_0xc3f8('0x66'))][(_0xc3f8('0x67'))](_0xc3f8('0x68'));}return rp(_0x4cc654);}})[_0xc3f8('0x25')](function(_0x53c815){if(_0x53c815){var _0x2f69f7=[_0xc3f8('0x69'),_0xc3f8('0x6a'),'group','assignee'];_[_0xc3f8('0x6b')](_0x53c815[_0xc3f8('0x6c')],function(_0x1a9c33){return _0x2f69f7[_0xc3f8('0x6d')](_0x1a9c33['type']);});return{'count':_0x53c815[_0xc3f8('0x6c')][_0xc3f8('0x36')],'rows':_[_0xc3f8('0x2a')](_0x53c815['ticket_fields'],function(_0x2a29fa){return{'id':_0x2a29fa['id'],'name':_0x2a29fa[_0xc3f8('0x6e')]>0x7?_0x2a29fa['title']:_0x2a29fa['type'],'custom':_0x2a29fa[_0xc3f8('0x6e')]>0x7?!![]:![],'options':_0x2a29fa[_0xc3f8('0x6f')]?_0x2a29fa['system_field_options']:_0x2a29fa[_0xc3f8('0x70')]?_0x2a29fa[_0xc3f8('0x70')]:[]};})};}})['then'](respondWithResult(_0x104eec,null))[_0xc3f8('0x44')](function(_0x5f2d86){var _0x3d080a=_0x273faf['query'][_0xc3f8('0x71')]?0x1f4:_0x5f2d86[_0xc3f8('0x72')]||0x1f4;logger[_0xc3f8('0x26')](_0xc3f8('0x73'),_0xc3f8('0x56'),_0x3d080a,JSON[_0xc3f8('0x74')](_0x5f2d86));delete _0x5f2d86[_0xc3f8('0x28')];if(_0x3d080a===0x191){_0x3d080a=0x190;}_0x104eec[_0xc3f8('0x18')](_0x3d080a)[_0xc3f8('0x29')](_0x273faf['query']['test']?{'message':_0xc3f8('0x75'),'statusCode':_0x5f2d86['statusCode']}:_0x5f2d86);});}; \ No newline at end of file +var _0x2547=['Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','system_field_options','custom_field_options','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','ZendeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','create','catch','body','find','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','%s/token:%s'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x2547,0x1cd));var _0x7254=function(_0x17e170,_0x16fcf6){_0x17e170=_0x17e170-0x0;var _0x31f6d1=_0x2547[_0x17e170];return _0x31f6d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16c08e,_0x2bfff8){_0x2bfff8=_0x2bfff8||0xcc;return function(_0x348d4e){if(_0x348d4e){return _0x16c08e[_0x7254('0x17')](_0x2bfff8);}return _0x16c08e[_0x7254('0x18')](_0x2bfff8)[_0x7254('0x19')]();};}function respondWithResult(_0x124192,_0x21cecc){_0x21cecc=_0x21cecc||0xc8;return function(_0x1625ea){if(_0x1625ea){return _0x124192[_0x7254('0x18')](_0x21cecc)[_0x7254('0x1a')](_0x1625ea);}};}function respondWithFilteredResult(_0x1ee5cb,_0x163c8c){return function(_0x535065){if(_0x535065){var _0x265293=typeof _0x163c8c[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x163c8c[_0x7254('0x1d')]===_0x7254('0x1c');var _0x1e4aff=_0x535065[_0x7254('0x1e')];var _0x5dd23b=_0x265293?0x0:_0x163c8c[_0x7254('0x1b')];var _0x2283b7=_0x265293?_0x535065[_0x7254('0x1e')]:_0x163c8c[_0x7254('0x1b')]+_0x163c8c[_0x7254('0x1d')];var _0x301f00;if(_0x2283b7>=_0x1e4aff){_0x2283b7=_0x1e4aff;_0x301f00=0xc8;}else{_0x301f00=0xce;}_0x1ee5cb[_0x7254('0x18')](_0x301f00);return _0x1ee5cb[_0x7254('0x1f')](_0x7254('0x20'),_0x5dd23b+'-'+_0x2283b7+'/'+_0x1e4aff)[_0x7254('0x1a')](_0x535065);}return null;};}function patchUpdates(_0x2594b8){return function(_0x24bc73){try{jsonpatch[_0x7254('0x21')](_0x24bc73,_0x2594b8,!![]);}catch(_0x41ef72){return BPromise[_0x7254('0x22')](_0x41ef72);}return _0x24bc73[_0x7254('0x23')]();};}function saveUpdates(_0x2bb2fe,_0x46c0a2){return function(_0x195fd2){if(_0x195fd2){return _0x195fd2[_0x7254('0x24')](_0x2bb2fe)[_0x7254('0x25')](function(_0x50c34b){return _0x50c34b;});}return null;};}function removeEntity(_0x493bfd,_0x136ea3){return function(_0xd91c1f){if(_0xd91c1f){return _0xd91c1f[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x493bfd[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x133aee,_0x5d6df5){return function(_0x133287){if(!_0x133287){_0x133aee[_0x7254('0x17')](0x194);}return _0x133287;};}function handleError(_0x2b4f46,_0x494cdb){_0x494cdb=_0x494cdb||0x1f4;return function(_0x3c22d0){logger['error'](_0x3c22d0[_0x7254('0x27')]);if(_0x3c22d0[_0x7254('0x28')]){delete _0x3c22d0['name'];}_0x2b4f46[_0x7254('0x18')](_0x494cdb)[_0x7254('0x29')](_0x3c22d0);};}exports['index']=function(_0x14cbea,_0x6c4927){var _0x37cb5c={},_0xb9198b={},_0x43bf02={'count':0x0,'rows':[]};var _0xfe02ea=_['map'](db[_0x7254('0x2a')][_0x7254('0x2b')],function(_0x5569be){return{'name':_0x5569be[_0x7254('0x2c')],'type':_0x5569be[_0x7254('0x2d')][_0x7254('0x2e')]};});_0xb9198b['model']=_[_0x7254('0x2f')](_0xfe02ea,_0x7254('0x28'));_0xb9198b[_0x7254('0x30')]=_[_0x7254('0x31')](_0x14cbea[_0x7254('0x30')]);_0xb9198b[_0x7254('0x32')]=_[_0x7254('0x33')](_0xb9198b['model'],_0xb9198b[_0x7254('0x30')]);_0x37cb5c['attributes']=_['intersection'](_0xb9198b[_0x7254('0x34')],qs[_0x7254('0x35')](_0x14cbea[_0x7254('0x30')][_0x7254('0x35')]));_0x37cb5c[_0x7254('0x36')]=_0x37cb5c[_0x7254('0x36')][_0x7254('0x37')]?_0x37cb5c[_0x7254('0x36')]:_0xb9198b[_0x7254('0x34')];if(!_0x14cbea[_0x7254('0x30')][_0x7254('0x38')](_0x7254('0x39'))){_0x37cb5c[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x14cbea['query'][_0x7254('0x1d')]);_0x37cb5c[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x14cbea[_0x7254('0x30')][_0x7254('0x1b')]);}_0x37cb5c['order']=qs[_0x7254('0x3a')](_0x14cbea['query'][_0x7254('0x3a')]);_0x37cb5c[_0x7254('0x3b')]=qs[_0x7254('0x32')](_[_0x7254('0x3c')](_0x14cbea[_0x7254('0x30')],_0xb9198b['filters']),_0xfe02ea);if(_0x14cbea[_0x7254('0x30')]['filter']){_0x37cb5c[_0x7254('0x3b')]=_[_0x7254('0x3d')](_0x37cb5c['where'],{'$or':_[_0x7254('0x2f')](_0xfe02ea,function(_0x3c5bf4){if(_0x3c5bf4[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x14b625={};_0x14b625[_0x3c5bf4[_0x7254('0x28')]]={'$like':'%'+_0x14cbea['query'][_0x7254('0x3f')]+'%'};return _0x14b625;}})});}_0x37cb5c=_[_0x7254('0x3d')]({},_0x37cb5c,_0x14cbea[_0x7254('0x40')]);var _0x4eca7a={'where':_0x37cb5c[_0x7254('0x3b')]};return db[_0x7254('0x2a')][_0x7254('0x1e')](_0x4eca7a)['then'](function(_0xc09711){_0x43bf02[_0x7254('0x1e')]=_0xc09711;if(_0x14cbea[_0x7254('0x30')][_0x7254('0x41')]){_0x37cb5c[_0x7254('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x37cb5c);})[_0x7254('0x25')](function(_0x17bc29){_0x43bf02[_0x7254('0x43')]=_0x17bc29;return _0x43bf02;})[_0x7254('0x25')](respondWithFilteredResult(_0x6c4927,_0x37cb5c))['catch'](handleError(_0x6c4927,null));};exports['show']=function(_0x29821a,_0x565cd8){var _0x2ae22e={'raw':![],'where':{'id':_0x29821a[_0x7254('0x44')]['id']}},_0x3187b0={};_0x3187b0[_0x7254('0x34')]=_['keys'](db['ZendeskAccount'][_0x7254('0x2b')]);_0x3187b0[_0x7254('0x30')]=_[_0x7254('0x31')](_0x29821a[_0x7254('0x30')]);_0x3187b0[_0x7254('0x32')]=_['intersection'](_0x3187b0['model'],_0x3187b0[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x36')]=_[_0x7254('0x33')](_0x3187b0['model'],qs[_0x7254('0x35')](_0x29821a[_0x7254('0x30')]['fields']));_0x2ae22e[_0x7254('0x36')]=_0x2ae22e[_0x7254('0x36')][_0x7254('0x37')]?_0x2ae22e[_0x7254('0x36')]:_0x3187b0['model'];if(_0x29821a[_0x7254('0x30')][_0x7254('0x41')]){_0x2ae22e['include']=[{'all':!![]}];}_0x2ae22e=_[_0x7254('0x3d')]({},_0x2ae22e,_0x29821a[_0x7254('0x40')]);return db[_0x7254('0x2a')]['find'](_0x2ae22e)[_0x7254('0x25')](handleEntityNotFound(_0x565cd8,null))[_0x7254('0x25')](respondWithResult(_0x565cd8,null))['catch'](handleError(_0x565cd8,null));};exports['create']=function(_0x10b32f,_0x54c792){return db[_0x7254('0x2a')][_0x7254('0x45')](_0x10b32f['body'],{})['then'](respondWithResult(_0x54c792,0xc9))[_0x7254('0x46')](handleError(_0x54c792,null));};exports[_0x7254('0x24')]=function(_0x38bcd5,_0x104d98){if(_0x38bcd5[_0x7254('0x47')]['id']){delete _0x38bcd5[_0x7254('0x47')]['id'];}return db['ZendeskAccount'][_0x7254('0x48')]({'where':{'id':_0x38bcd5['params']['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x104d98,null))[_0x7254('0x25')](saveUpdates(_0x38bcd5[_0x7254('0x47')],null))['then'](respondWithResult(_0x104d98,null))[_0x7254('0x46')](handleError(_0x104d98,null));};exports[_0x7254('0x26')]=function(_0x252758,_0x5b3b6e){return db[_0x7254('0x2a')][_0x7254('0x48')]({'where':{'id':_0x252758[_0x7254('0x44')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x5b3b6e,null))[_0x7254('0x25')](removeEntity(_0x5b3b6e,null))['catch'](handleError(_0x5b3b6e,null));};exports['getConfigurations']=function(_0x24c532,_0x2cb7cd,_0x441d23){var _0x10e1cb={};var _0x3b0002={};var _0x4c6838;var _0x5a44fb;return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x24c532[_0x7254('0x44')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x2cb7cd,null))['then'](function(_0xaf6d3d){if(_0xaf6d3d){_0x4c6838=_0xaf6d3d;_0x3b0002[_0x7254('0x34')]=_['keys'](db[_0x7254('0x4a')]['rawAttributes']);_0x3b0002[_0x7254('0x30')]=_['keys'](_0x24c532[_0x7254('0x30')]);_0x3b0002['filters']=_['intersection'](_0x3b0002[_0x7254('0x34')],_0x3b0002[_0x7254('0x30')]);_0x10e1cb[_0x7254('0x36')]=_[_0x7254('0x33')](_0x3b0002['model'],qs[_0x7254('0x35')](_0x24c532['query'][_0x7254('0x35')]));_0x10e1cb[_0x7254('0x36')]=_0x10e1cb[_0x7254('0x36')][_0x7254('0x37')]?_0x10e1cb[_0x7254('0x36')]:_0x3b0002[_0x7254('0x34')];_0x10e1cb['order']=qs[_0x7254('0x3a')](_0x24c532[_0x7254('0x30')][_0x7254('0x3a')]);_0x10e1cb[_0x7254('0x3b')]=qs[_0x7254('0x32')](_[_0x7254('0x3c')](_0x24c532['query'],_0x3b0002[_0x7254('0x32')]));if(_0x24c532[_0x7254('0x30')][_0x7254('0x3f')]){_0x10e1cb[_0x7254('0x3b')]=_[_0x7254('0x3d')](_0x10e1cb[_0x7254('0x3b')],{'$or':_[_0x7254('0x2f')](_0x10e1cb['attributes'],function(_0x5dd108){var _0xac4d0={};_0xac4d0[_0x5dd108]={'$like':'%'+_0x24c532['query']['filter']+'%'};return _0xac4d0;})});}_0x10e1cb=_[_0x7254('0x3d')]({},_0x10e1cb,_0x24c532[_0x7254('0x40')]);return _0x4c6838[_0x7254('0x4b')](_0x10e1cb);}})['then'](function(_0x1821f0){if(_0x1821f0){_0x5a44fb=_0x1821f0['length'];if(!_0x24c532[_0x7254('0x30')][_0x7254('0x38')](_0x7254('0x39'))){_0x10e1cb[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x24c532['query'][_0x7254('0x1d')]);_0x10e1cb[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x24c532[_0x7254('0x30')]['offset']);}return _0x4c6838['getConfigurations'](_0x10e1cb);}})[_0x7254('0x25')](function(_0x41355e){if(_0x41355e){return _0x41355e?{'count':_0x5a44fb,'rows':_0x41355e}:null;}})[_0x7254('0x25')](respondWithResult(_0x2cb7cd,null))[_0x7254('0x46')](handleError(_0x2cb7cd,null));};exports[_0x7254('0x4c')]=function(_0x1cf028,_0x464680,_0x38cba1){if(_0x1cf028[_0x7254('0x47')]['id']){delete _0x1cf028[_0x7254('0x47')]['id'];}return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x1cf028[_0x7254('0x44')]['id']}})['then'](handleEntityNotFound(_0x464680,null))[_0x7254('0x25')](function(_0x4716a2){if(_0x4716a2){_0x1cf028[_0x7254('0x47')]['AccountId']=_0x4716a2['id'];_0x1cf028[_0x7254('0x47')][_0x7254('0x4d')]=integrations[_0x7254('0x4e')](_0x1cf028[_0x7254('0x47')]['channel'],_0x1cf028[_0x7254('0x47')]['type']);_0x1cf028[_0x7254('0x47')][_0x7254('0x4f')]=integrations[_0x7254('0x50')](_0x1cf028[_0x7254('0x47')]['channel'],_0x1cf028[_0x7254('0x47')]['type']);return db[_0x7254('0x4a')]['create'](_0x1cf028[_0x7254('0x47')],{'include':[{'model':db[_0x7254('0x51')],'as':_0x7254('0x4d')},{'model':db[_0x7254('0x51')],'as':_0x7254('0x4f')}]});}return null;})[_0x7254('0x25')](respondWithResult(_0x464680,null))[_0x7254('0x46')](handleError(_0x464680,null));};exports[_0x7254('0x52')]=function(_0x4e07c6,_0x37562a,_0x57c0a0){var _0x12c36e='';return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x4e07c6[_0x7254('0x44')]['id']},'attributes':['id',_0x7254('0x53'),_0x7254('0x54'),_0x7254('0x55'),_0x7254('0x56'),'remoteUri']})[_0x7254('0x25')](handleEntityNotFound(_0x37562a,null))['then'](function(_0x231184){if(_0x231184){_0x12c36e=_0x231184[_0x7254('0x57')];var _0x2399ef=_0x12c36e[_0x7254('0x58')](-0x1);if(_0x2399ef==='/'){_0x12c36e=_0x12c36e[_0x7254('0x59')](0x0,_0x12c36e[_0x7254('0x5a')](_0x2399ef));}var _0xb65570={'method':_0x7254('0x5b'),'uri':util[_0x7254('0x5c')](_0x7254('0x5d'),_0x12c36e,_0x7254('0x5e')),'json':!![]};switch(_0x231184[_0x7254('0x56')]){case _0x7254('0x54'):_0xb65570[_0x7254('0x5f')]={'Authorization':util[_0x7254('0x5c')](_0x7254('0x60'),new Buffer(util[_0x7254('0x5c')]('%s:%s',_0x231184['username'],_0x231184[_0x7254('0x54')]))[_0x7254('0x61')]('base64'))};break;case'token':_0xb65570['headers']={'Authorization':util[_0x7254('0x5c')](_0x7254('0x60'),new Buffer(util[_0x7254('0x5c')](_0x7254('0x62'),_0x231184['username'],_0x231184[_0x7254('0x55')]))[_0x7254('0x61')]('base64'))};break;default:throw new db[(_0x7254('0x63'))][(_0x7254('0x64'))](_0x7254('0x65'));}return rp(_0xb65570);}})['then'](function(_0x4aa036){if(_0x4aa036){var _0x220066=[_0x7254('0x66'),'description',_0x7254('0x67'),_0x7254('0x68')];_[_0x7254('0x69')](_0x4aa036[_0x7254('0x5e')],function(_0x24fcb1){return _0x220066['includes'](_0x24fcb1[_0x7254('0x2d')]);});return{'count':_0x4aa036[_0x7254('0x5e')][_0x7254('0x37')],'rows':_['map'](_0x4aa036[_0x7254('0x5e')],function(_0x4cf18d){return{'id':_0x4cf18d['id'],'name':_0x4cf18d['position']>0x7?_0x4cf18d['title']:_0x4cf18d[_0x7254('0x2d')],'custom':_0x4cf18d['position']>0x7?!![]:![],'options':_0x4cf18d['system_field_options']?_0x4cf18d[_0x7254('0x6a')]:_0x4cf18d[_0x7254('0x6b')]?_0x4cf18d[_0x7254('0x6b')]:[]};})};}})['then'](respondWithResult(_0x37562a,null))[_0x7254('0x46')](function(_0x5a0c41){var _0x175379=_0x4e07c6[_0x7254('0x30')]['test']?0x1f4:_0x5a0c41[_0x7254('0x6c')]||0x1f4;logger[_0x7254('0x6d')](_0x7254('0x6e'),_0x7254('0x52'),_0x175379,JSON[_0x7254('0x6f')](_0x5a0c41));delete _0x5a0c41[_0x7254('0x28')];if(_0x175379===0x191){_0x175379=0x190;}_0x37562a[_0x7254('0x18')](_0x175379)['send'](_0x4e07c6[_0x7254('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5a0c41[_0x7254('0x6c')]}:_0x5a0c41);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c2794ed..7b78099 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 _0xdfdb=['path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','moment','request-promise'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xdfdb,0xa4));var _0xbdfd=function(_0x303864,_0x1a0eaf){_0x303864=_0x303864-0x0;var _0x250c15=_0xdfdb[_0x303864];return _0x250c15;};'use strict';var _=require(_0xbdfd('0x0'));var util=require('util');var logger=require(_0xbdfd('0x1'))('api');var moment=require(_0xbdfd('0x2'));var BPromise=require('bluebird');var rp=require(_0xbdfd('0x3'));var fs=require('fs');var path=require(_0xbdfd('0x4'));var rimraf=require('rimraf');var config=require(_0xbdfd('0x5'));var attributes=require(_0xbdfd('0x6'));var integrations=require(_0xbdfd('0x7'));module[_0xbdfd('0x8')]=function(_0x5740ce,_0xfbe9b2){return _0x5740ce[_0xbdfd('0x9')](_0xbdfd('0xa'),attributes,{'tableName':_0xbdfd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe321=['../../components/integrations/configuration','exports','define','ZendeskAccount','util','../../config/logger','api','request-promise','../../config/environment','./intZendeskAccount.attributes'];(function(_0x158591,_0x702b2b){var _0x3c3edd=function(_0x451cca){while(--_0x451cca){_0x158591['push'](_0x158591['shift']());}};_0x3c3edd(++_0x702b2b);}(_0xe321,0x194));var _0x1e32=function(_0x3a45b3,_0x300baf){_0x3a45b3=_0x3a45b3-0x0;var _0x4aba5b=_0xe321[_0x3a45b3];return _0x4aba5b;};'use strict';var _=require('lodash');var util=require(_0x1e32('0x0'));var logger=require(_0x1e32('0x1'))(_0x1e32('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1e32('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e32('0x4'));var attributes=require(_0x1e32('0x5'));var integrations=require(_0x1e32('0x6'));module[_0x1e32('0x7')]=function(_0x28c16a,_0x1cff71){return _0x28c16a[_0x1e32('0x8')](_0x1e32('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index b66abdb..0bd6b76 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 _0x3187=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ZendeskAccount','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','lodash','util'];(function(_0x16af01,_0x980a1c){var _0x5bd20e=function(_0x4dcc09){while(--_0x4dcc09){_0x16af01['push'](_0x16af01['shift']());}};_0x5bd20e(++_0x980a1c);}(_0x3187,0xfa));var _0x7318=function(_0x48ccc4,_0x4045e4){_0x48ccc4=_0x48ccc4-0x0;var _0x49d8bd=_0x3187[_0x48ccc4];return _0x49d8bd;};'use strict';var _=require(_0x7318('0x0'));var util=require(_0x7318('0x1'));var moment=require('moment');var BPromise=require(_0x7318('0x2'));var rs=require(_0x7318('0x3'));var fs=require('fs');var Redis=require(_0x7318('0x4'));var db=require(_0x7318('0x5'))['db'];var utils=require(_0x7318('0x6'));var logger=require(_0x7318('0x7'))(_0x7318('0x8'));var config=require(_0x7318('0x9'));var jayson=require(_0x7318('0xa'));var client=jayson[_0x7318('0xb')][_0x7318('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f9a90,_0x729643,_0x55ed15){return new BPromise(function(_0x4d7409,_0x362e74){return client[_0x7318('0xd')](_0x4f9a90,_0x55ed15)[_0x7318('0xe')](function(_0x119d1d){logger[_0x7318('0xf')](_0x7318('0x10'),_0x729643,_0x7318('0x11'));logger[_0x7318('0x12')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x729643,_0x7318('0x11'),JSON['stringify'](_0x119d1d));if(_0x119d1d[_0x7318('0x13')]){if(_0x119d1d[_0x7318('0x13')][_0x7318('0x14')]===0x1f4){logger[_0x7318('0x13')](_0x7318('0x10'),_0x729643,_0x119d1d['error']['message']);return _0x362e74(_0x119d1d[_0x7318('0x13')][_0x7318('0x15')]);}logger[_0x7318('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x729643,_0x119d1d[_0x7318('0x13')][_0x7318('0x15')]);return _0x4d7409(_0x119d1d['error'][_0x7318('0x15')]);}else{logger[_0x7318('0xf')](_0x7318('0x10'),_0x729643,_0x7318('0x11'));_0x4d7409(_0x119d1d[_0x7318('0x16')][_0x7318('0x15')]);}})[_0x7318('0x17')](function(_0x307bb5){logger[_0x7318('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x729643,_0x307bb5);_0x362e74(_0x307bb5);});});}exports['GetZendeskAccount']=function(_0x5dfd17){var _0x1bb1ee=this;return new Promise(function(_0x1cd731,_0x6fcfcd){return db[_0x7318('0x18')]['findAll']({'raw':_0x5dfd17[_0x7318('0x19')]?_0x5dfd17[_0x7318('0x19')][_0x7318('0x1a')]===undefined?!![]:![]:!![],'where':_0x5dfd17[_0x7318('0x19')]?_0x5dfd17['options'][_0x7318('0x1b')]||null:null,'attributes':_0x5dfd17[_0x7318('0x19')]?_0x5dfd17[_0x7318('0x19')][_0x7318('0x1c')]||null:null,'limit':_0x5dfd17[_0x7318('0x19')]?_0x5dfd17[_0x7318('0x19')]['limit']||null:null,'include':_0x5dfd17['options']?_0x5dfd17['options'][_0x7318('0x1d')]?_[_0x7318('0x1e')](_0x5dfd17[_0x7318('0x19')][_0x7318('0x1d')],function(_0x5e43e5){return{'model':db[_0x5e43e5['model']],'as':_0x5e43e5['as'],'attributes':_0x5e43e5[_0x7318('0x1c')],'include':_0x5e43e5[_0x7318('0x1d')]?_[_0x7318('0x1e')](_0x5e43e5[_0x7318('0x1d')],function(_0x31ceb1){return{'model':db[_0x31ceb1[_0x7318('0x1f')]],'as':_0x31ceb1['as'],'attributes':_0x31ceb1['attributes'],'include':_0x31ceb1['include']?_['map'](_0x31ceb1['include'],function(_0x3e6de6){return{'model':db[_0x3e6de6[_0x7318('0x1f')]],'as':_0x3e6de6['as'],'attributes':_0x3e6de6[_0x7318('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7318('0xe')](function(_0x1fa578){logger[_0x7318('0xf')](_0x7318('0x20'),_0x5dfd17);logger['debug'](_0x7318('0x20'),_0x5dfd17,JSON[_0x7318('0x21')](_0x1fa578));_0x1cd731(_0x1fa578);})[_0x7318('0x17')](function(_0x209916){logger[_0x7318('0x13')]('GetZendeskAccount',_0x209916['message'],_0x5dfd17);_0x6fcfcd(_0x1bb1ee[_0x7318('0x13')](0x1f4,_0x209916[_0x7318('0x15')]));});});};exports[_0x7318('0x22')]=function(_0x7ac46b){var _0x4ac588=this;return new Promise(function(_0x15b970,_0x50755f){return db[_0x7318('0x18')][_0x7318('0x23')]({'raw':_0x7ac46b[_0x7318('0x19')]?_0x7ac46b[_0x7318('0x19')][_0x7318('0x1a')]===undefined?!![]:![]:!![],'where':_0x7ac46b['options']?_0x7ac46b['options'][_0x7318('0x1b')]||null:null,'attributes':_0x7ac46b[_0x7318('0x19')]?_0x7ac46b[_0x7318('0x19')][_0x7318('0x1c')]||null:null,'include':_0x7ac46b['options']?_0x7ac46b[_0x7318('0x19')][_0x7318('0x1d')]?_[_0x7318('0x1e')](_0x7ac46b['options'][_0x7318('0x1d')],function(_0x5ce0de){return{'model':db[_0x5ce0de['model']],'as':_0x5ce0de['as'],'attributes':_0x5ce0de[_0x7318('0x1c')],'include':_0x5ce0de['include']?_[_0x7318('0x1e')](_0x5ce0de[_0x7318('0x1d')],function(_0x2ffd65){return{'model':db[_0x2ffd65[_0x7318('0x1f')]],'as':_0x2ffd65['as'],'attributes':_0x2ffd65['attributes'],'include':_0x2ffd65[_0x7318('0x1d')]?_['map'](_0x2ffd65['include'],function(_0x36faa7){return{'model':db[_0x36faa7['model']],'as':_0x36faa7['as'],'attributes':_0x36faa7['attributes']};}):[]};}):[]};}):[]:[]})[_0x7318('0xe')](function(_0x2315e5){logger[_0x7318('0xf')]('ShowZendeskAccount',_0x7ac46b);logger['debug'](_0x7318('0x22'),_0x7ac46b,JSON['stringify'](_0x2315e5));_0x15b970(_0x2315e5);})['catch'](function(_0x54280){logger[_0x7318('0x13')](_0x7318('0x22'),_0x54280[_0x7318('0x15')],_0x7ac46b);_0x50755f(_0x4ac588[_0x7318('0x13')](0x1f4,_0x54280[_0x7318('0x15')]));});});}; \ No newline at end of file +var _0x8d93=['then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','findAll','options','raw','where','attributes','include','model','map','GetZendeskAccount','stringify','ZendeskAccount','find','ShowZendeskAccount','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x798ef0,_0x10e89a){var _0x5e77ee=function(_0x4700e6){while(--_0x4700e6){_0x798ef0['push'](_0x798ef0['shift']());}};_0x5e77ee(++_0x10e89a);}(_0x8d93,0x96));var _0x38d9=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x8d93[_0x45d3f0];return _0x314b79;};'use strict';var _=require('lodash');var util=require(_0x38d9('0x0'));var moment=require(_0x38d9('0x1'));var BPromise=require(_0x38d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38d9('0x3'))['db'];var utils=require(_0x38d9('0x4'));var logger=require(_0x38d9('0x5'))(_0x38d9('0x6'));var config=require('../../config/environment');var jayson=require(_0x38d9('0x7'));var client=jayson[_0x38d9('0x8')][_0x38d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x284f3f,_0x535ff3,_0x209235){return new BPromise(function(_0x1c4a96,_0xc23d60){return client['request'](_0x284f3f,_0x209235)[_0x38d9('0xa')](function(_0x205c85){logger[_0x38d9('0xb')](_0x38d9('0xc'),_0x535ff3,_0x38d9('0xd'));logger[_0x38d9('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x535ff3,_0x38d9('0xd'),JSON['stringify'](_0x205c85));if(_0x205c85['error']){if(_0x205c85['error']['code']===0x1f4){logger[_0x38d9('0xf')](_0x38d9('0xc'),_0x535ff3,_0x205c85[_0x38d9('0xf')][_0x38d9('0x10')]);return _0xc23d60(_0x205c85[_0x38d9('0xf')]['message']);}logger[_0x38d9('0xf')](_0x38d9('0xc'),_0x535ff3,_0x205c85[_0x38d9('0xf')][_0x38d9('0x10')]);return _0x1c4a96(_0x205c85[_0x38d9('0xf')][_0x38d9('0x10')]);}else{logger[_0x38d9('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x535ff3,_0x38d9('0xd'));_0x1c4a96(_0x205c85[_0x38d9('0x11')][_0x38d9('0x10')]);}})['catch'](function(_0x3c9f8d){logger[_0x38d9('0xf')](_0x38d9('0xc'),_0x535ff3,_0x3c9f8d);_0xc23d60(_0x3c9f8d);});});}exports['GetZendeskAccount']=function(_0xca6d43){var _0x48c69=this;return new Promise(function(_0x4ae582,_0x37ce35){return db['ZendeskAccount'][_0x38d9('0x12')]({'raw':_0xca6d43[_0x38d9('0x13')]?_0xca6d43[_0x38d9('0x13')][_0x38d9('0x14')]===undefined?!![]:![]:!![],'where':_0xca6d43[_0x38d9('0x13')]?_0xca6d43[_0x38d9('0x13')][_0x38d9('0x15')]||null:null,'attributes':_0xca6d43[_0x38d9('0x13')]?_0xca6d43[_0x38d9('0x13')][_0x38d9('0x16')]||null:null,'limit':_0xca6d43[_0x38d9('0x13')]?_0xca6d43[_0x38d9('0x13')]['limit']||null:null,'include':_0xca6d43['options']?_0xca6d43[_0x38d9('0x13')][_0x38d9('0x17')]?_['map'](_0xca6d43[_0x38d9('0x13')]['include'],function(_0x50729d){return{'model':db[_0x50729d[_0x38d9('0x18')]],'as':_0x50729d['as'],'attributes':_0x50729d[_0x38d9('0x16')],'include':_0x50729d[_0x38d9('0x17')]?_['map'](_0x50729d[_0x38d9('0x17')],function(_0x4c098c){return{'model':db[_0x4c098c[_0x38d9('0x18')]],'as':_0x4c098c['as'],'attributes':_0x4c098c[_0x38d9('0x16')],'include':_0x4c098c['include']?_[_0x38d9('0x19')](_0x4c098c[_0x38d9('0x17')],function(_0x5d2377){return{'model':db[_0x5d2377[_0x38d9('0x18')]],'as':_0x5d2377['as'],'attributes':_0x5d2377[_0x38d9('0x16')]};}):[]};}):[]};}):[]:[]})[_0x38d9('0xa')](function(_0xe75499){logger[_0x38d9('0xb')](_0x38d9('0x1a'),_0xca6d43);logger[_0x38d9('0xe')](_0x38d9('0x1a'),_0xca6d43,JSON[_0x38d9('0x1b')](_0xe75499));_0x4ae582(_0xe75499);})['catch'](function(_0x5398c4){logger[_0x38d9('0xf')](_0x38d9('0x1a'),_0x5398c4[_0x38d9('0x10')],_0xca6d43);_0x37ce35(_0x48c69[_0x38d9('0xf')](0x1f4,_0x5398c4[_0x38d9('0x10')]));});});};exports['ShowZendeskAccount']=function(_0x5e81f3){var _0x1c28b5=this;return new Promise(function(_0x470ced,_0x49d690){return db[_0x38d9('0x1c')][_0x38d9('0x1d')]({'raw':_0x5e81f3['options']?_0x5e81f3['options'][_0x38d9('0x14')]===undefined?!![]:![]:!![],'where':_0x5e81f3['options']?_0x5e81f3[_0x38d9('0x13')][_0x38d9('0x15')]||null:null,'attributes':_0x5e81f3[_0x38d9('0x13')]?_0x5e81f3[_0x38d9('0x13')][_0x38d9('0x16')]||null:null,'include':_0x5e81f3['options']?_0x5e81f3['options']['include']?_[_0x38d9('0x19')](_0x5e81f3[_0x38d9('0x13')][_0x38d9('0x17')],function(_0x444997){return{'model':db[_0x444997[_0x38d9('0x18')]],'as':_0x444997['as'],'attributes':_0x444997[_0x38d9('0x16')],'include':_0x444997[_0x38d9('0x17')]?_[_0x38d9('0x19')](_0x444997['include'],function(_0xebb98a){return{'model':db[_0xebb98a['model']],'as':_0xebb98a['as'],'attributes':_0xebb98a['attributes'],'include':_0xebb98a['include']?_[_0x38d9('0x19')](_0xebb98a[_0x38d9('0x17')],function(_0x585295){return{'model':db[_0x585295[_0x38d9('0x18')]],'as':_0x585295['as'],'attributes':_0x585295['attributes']};}):[]};}):[]};}):[]:[]})[_0x38d9('0xa')](function(_0x21f21b){logger[_0x38d9('0xb')](_0x38d9('0x1e'),_0x5e81f3);logger[_0x38d9('0xe')]('ShowZendeskAccount',_0x5e81f3,JSON['stringify'](_0x21f21b));_0x470ced(_0x21f21b);})[_0x38d9('0x1f')](function(_0x108b8a){logger[_0x38d9('0xf')](_0x38d9('0x1e'),_0x108b8a[_0x38d9('0x10')],_0x5e81f3);_0x49d690(_0x1c28b5[_0x38d9('0xf')](0x1f4,_0x108b8a[_0x38d9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 508c247..44adc43 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 _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x2298bd,_0x4595cd){var _0xd89269=function(_0x420e62){while(--_0x420e62){_0x2298bd['push'](_0x2298bd['shift']());}};_0xd89269(++_0x4595cd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file +var _0x153f=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x13d792,_0x2679ac){var _0x14b3f7=function(_0x56fd40){while(--_0x56fd40){_0x13d792['push'](_0x13d792['shift']());}};_0x14b3f7(++_0x2679ac);}(_0x153f,0x15b));var _0xf153=function(_0x57a80f,_0x1964cc){_0x57a80f=_0x57a80f-0x0;var _0x43a6cf=_0x153f[_0x57a80f];return _0x43a6cf;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['get'](_0xf153('0x11'),auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router['get'](_0xf153('0x13'),auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);router[_0xf153('0x15')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x16')]);router[_0xf153('0x15')](_0xf153('0x13'),auth[_0xf153('0xa')](),controller['setTags']);router[_0xf153('0x17')](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x19')]);router[_0xf153('0x1a')](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 2568a7f..0235b17 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 _0x6fc3=['exports','STRING','sequelize'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x6fc3,0x17f));var _0x36fc=function(_0x3a0f2a,_0x141715){_0x3a0f2a=_0x3a0f2a-0x0;var _0x4a3b11=_0x6fc3[_0x3a0f2a];return _0x4a3b11;};'use strict';var Sequelize=require(_0x36fc('0x0'));module[_0x36fc('0x1')]={'name':{'type':Sequelize[_0x36fc('0x2')]},'description':{'type':Sequelize[_0x36fc('0x2')]}}; \ No newline at end of file +var _0xc7ba=['exports','STRING'];(function(_0x625a73,_0x50ae08){var _0x3eceb5=function(_0x9e9500){while(--_0x9e9500){_0x625a73['push'](_0x625a73['shift']());}};_0x3eceb5(++_0x50ae08);}(_0xc7ba,0xae));var _0xac7b=function(_0x228429,_0x25e53f){_0x228429=_0x228429-0x0;var _0x224852=_0xc7ba[_0x228429];return _0x224852;};'use strict';var Sequelize=require('sequelize');module[_0xac7b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xac7b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index bd127af..d2673f7 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 _0x9062=['end','json','offset','undefined','count','limit','reject','save','update','then','destroy','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','length','find','create','body','params','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x332dbc,_0x2a80b2){var _0x4ed4e4=function(_0x3954af){while(--_0x3954af){_0x332dbc['push'](_0x332dbc['shift']());}};_0x4ed4e4(++_0x2a80b2);}(_0x9062,0x1e0));var _0x2906=function(_0x3ba8c4,_0x29b4cb){_0x3ba8c4=_0x3ba8c4-0x0;var _0x20d5ec=_0x9062[_0x3ba8c4];return _0x20d5ec;};'use strict';var emlformat=require(_0x2906('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2906('0x1'));var jsonpatch=require(_0x2906('0x2'));var rp=require(_0x2906('0x3'));var moment=require('moment');var BPromise=require(_0x2906('0x4'));var Mustache=require(_0x2906('0x5'));var util=require(_0x2906('0x6'));var path=require(_0x2906('0x7'));var sox=require(_0x2906('0x8'));var csv=require('to-csv');var ejs=require(_0x2906('0x9'));var fs=require('fs');var fs_extra=require(_0x2906('0xa'));var _=require(_0x2906('0xb'));var squel=require(_0x2906('0xc'));var crypto=require(_0x2906('0xd'));var jsforce=require(_0x2906('0xe'));var deskjs=require(_0x2906('0xf'));var toCsv=require(_0x2906('0x10'));var querystring=require(_0x2906('0x11'));var Papa=require(_0x2906('0x12'));var Redis=require(_0x2906('0x13'));var authService=require(_0x2906('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2906('0x15'));var hardwareService=require(_0x2906('0x16'));var logger=require(_0x2906('0x17'))(_0x2906('0x18'));var utils=require(_0x2906('0x19'));var config=require(_0x2906('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2906('0x1b'))['db'];function respondWithStatusCode(_0x3967d3,_0x38d3a4){_0x38d3a4=_0x38d3a4||0xcc;return function(_0x1d8693){if(_0x1d8693){return _0x3967d3[_0x2906('0x1c')](_0x38d3a4);}return _0x3967d3[_0x2906('0x1d')](_0x38d3a4)[_0x2906('0x1e')]();};}function respondWithResult(_0x536fa6,_0xe15717){_0xe15717=_0xe15717||0xc8;return function(_0x7ea8e3){if(_0x7ea8e3){return _0x536fa6['status'](_0xe15717)[_0x2906('0x1f')](_0x7ea8e3);}};}function respondWithFilteredResult(_0x43c800,_0x183ae7){return function(_0x3c8509){if(_0x3c8509){var _0x1741e3=typeof _0x183ae7[_0x2906('0x20')]===_0x2906('0x21')&&typeof _0x183ae7['limit']===_0x2906('0x21');var _0x2a1ab2=_0x3c8509['count'];var _0x5555e6=_0x1741e3?0x0:_0x183ae7[_0x2906('0x20')];var _0x49d7b0=_0x1741e3?_0x3c8509[_0x2906('0x22')]:_0x183ae7[_0x2906('0x20')]+_0x183ae7[_0x2906('0x23')];var _0x51218b;if(_0x49d7b0>=_0x2a1ab2){_0x49d7b0=_0x2a1ab2;_0x51218b=0xc8;}else{_0x51218b=0xce;}_0x43c800[_0x2906('0x1d')](_0x51218b);return _0x43c800['set']('Content-Range',_0x5555e6+'-'+_0x49d7b0+'/'+_0x2a1ab2)[_0x2906('0x1f')](_0x3c8509);}return null;};}function patchUpdates(_0x23e7f1){return function(_0x47427c){try{jsonpatch['apply'](_0x47427c,_0x23e7f1,!![]);}catch(_0x5cb7da){return BPromise[_0x2906('0x24')](_0x5cb7da);}return _0x47427c[_0x2906('0x25')]();};}function saveUpdates(_0x1ac265,_0x468c6d){return function(_0x449578){if(_0x449578){return _0x449578[_0x2906('0x26')](_0x1ac265)[_0x2906('0x27')](function(_0x4023a3){return _0x4023a3;});}return null;};}function removeEntity(_0x22a034,_0x7acf19){return function(_0x48b60a){if(_0x48b60a){return _0x48b60a[_0x2906('0x28')]()[_0x2906('0x27')](function(){_0x22a034['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39f6a9,_0x2f34ac){return function(_0x3a4929){if(!_0x3a4929){_0x39f6a9[_0x2906('0x1c')](0x194);}return _0x3a4929;};}function handleError(_0x98802d,_0x4bd7cc){_0x4bd7cc=_0x4bd7cc||0x1f4;return function(_0x322935){logger['error'](_0x322935[_0x2906('0x29')]);if(_0x322935['name']){delete _0x322935[_0x2906('0x2a')];}_0x98802d[_0x2906('0x1d')](_0x4bd7cc)['send'](_0x322935);};}exports[_0x2906('0x2b')]=function(_0x5d5241,_0x3d2f8f){var _0x4e7ecb={},_0x52d3f1={},_0x4fbeb5={'count':0x0,'rows':[]};var _0x1267e5=_[_0x2906('0x2c')](db[_0x2906('0x2d')][_0x2906('0x2e')],function(_0x5542a3){return{'name':_0x5542a3[_0x2906('0x2f')],'type':_0x5542a3[_0x2906('0x30')][_0x2906('0x31')]};});_0x52d3f1[_0x2906('0x32')]=_['map'](_0x1267e5,_0x2906('0x2a'));_0x52d3f1[_0x2906('0x33')]=_[_0x2906('0x34')](_0x5d5241[_0x2906('0x33')]);_0x52d3f1[_0x2906('0x35')]=_[_0x2906('0x36')](_0x52d3f1[_0x2906('0x32')],_0x52d3f1['query']);_0x4e7ecb['attributes']=_[_0x2906('0x36')](_0x52d3f1[_0x2906('0x32')],qs[_0x2906('0x37')](_0x5d5241[_0x2906('0x33')][_0x2906('0x37')]));_0x4e7ecb[_0x2906('0x38')]=_0x4e7ecb['attributes']['length']?_0x4e7ecb[_0x2906('0x38')]:_0x52d3f1[_0x2906('0x32')];if(!_0x5d5241[_0x2906('0x33')][_0x2906('0x39')]('nolimit')){_0x4e7ecb[_0x2906('0x23')]=qs[_0x2906('0x23')](_0x5d5241[_0x2906('0x33')]['limit']);_0x4e7ecb[_0x2906('0x20')]=qs[_0x2906('0x20')](_0x5d5241[_0x2906('0x33')]['offset']);}_0x4e7ecb[_0x2906('0x3a')]=qs[_0x2906('0x3b')](_0x5d5241[_0x2906('0x33')][_0x2906('0x3b')]);_0x4e7ecb[_0x2906('0x3c')]=qs[_0x2906('0x35')](_[_0x2906('0x3d')](_0x5d5241[_0x2906('0x33')],_0x52d3f1[_0x2906('0x35')]),_0x1267e5);if(_0x5d5241[_0x2906('0x33')][_0x2906('0x3e')]){_0x4e7ecb[_0x2906('0x3c')]=_[_0x2906('0x3f')](_0x4e7ecb[_0x2906('0x3c')],{'$or':_[_0x2906('0x2c')](_0x1267e5,function(_0x39a3b4){if(_0x39a3b4[_0x2906('0x30')]!=='VIRTUAL'){var _0x28048c={};_0x28048c[_0x39a3b4[_0x2906('0x2a')]]={'$like':'%'+_0x5d5241['query'][_0x2906('0x3e')]+'%'};return _0x28048c;}})});}_0x4e7ecb=_['merge']({},_0x4e7ecb,_0x5d5241[_0x2906('0x40')]);var _0x3e0764={'where':_0x4e7ecb[_0x2906('0x3c')]};return db[_0x2906('0x2d')]['count'](_0x3e0764)[_0x2906('0x27')](function(_0x152898){_0x4fbeb5[_0x2906('0x22')]=_0x152898;if(_0x5d5241['query'][_0x2906('0x41')]){_0x4e7ecb[_0x2906('0x42')]=[{'all':!![]}];}return db[_0x2906('0x2d')][_0x2906('0x43')](_0x4e7ecb);})[_0x2906('0x27')](function(_0x48ed04){_0x4fbeb5['rows']=_0x48ed04;return _0x4fbeb5;})[_0x2906('0x27')](respondWithFilteredResult(_0x3d2f8f,_0x4e7ecb))[_0x2906('0x44')](handleError(_0x3d2f8f,null));};exports[_0x2906('0x45')]=function(_0x4cb4fb,_0x441a06){var _0x3fc7db={'raw':![],'where':{'id':_0x4cb4fb['params']['id']}},_0x29c437={};_0x29c437[_0x2906('0x32')]=_[_0x2906('0x34')](db[_0x2906('0x2d')][_0x2906('0x2e')]);_0x29c437['query']=_[_0x2906('0x34')](_0x4cb4fb[_0x2906('0x33')]);_0x29c437[_0x2906('0x35')]=_[_0x2906('0x36')](_0x29c437[_0x2906('0x32')],_0x29c437[_0x2906('0x33')]);_0x3fc7db[_0x2906('0x38')]=_[_0x2906('0x36')](_0x29c437[_0x2906('0x32')],qs[_0x2906('0x37')](_0x4cb4fb[_0x2906('0x33')][_0x2906('0x37')]));_0x3fc7db[_0x2906('0x38')]=_0x3fc7db['attributes'][_0x2906('0x46')]?_0x3fc7db[_0x2906('0x38')]:_0x29c437[_0x2906('0x32')];if(_0x4cb4fb[_0x2906('0x33')][_0x2906('0x41')]){_0x3fc7db['include']=[{'all':!![]}];}_0x3fc7db=_[_0x2906('0x3f')]({},_0x3fc7db,_0x4cb4fb[_0x2906('0x40')]);return db[_0x2906('0x2d')][_0x2906('0x47')](_0x3fc7db)[_0x2906('0x27')](handleEntityNotFound(_0x441a06,null))[_0x2906('0x27')](respondWithResult(_0x441a06,null))['catch'](handleError(_0x441a06,null));};exports[_0x2906('0x48')]=function(_0x29d99c,_0x20599a){return db[_0x2906('0x2d')][_0x2906('0x48')](_0x29d99c[_0x2906('0x49')],{})['then'](respondWithResult(_0x20599a,0xc9))[_0x2906('0x44')](handleError(_0x20599a,null));};exports['update']=function(_0x1236d6,_0x29e752){if(_0x1236d6[_0x2906('0x49')]['id']){delete _0x1236d6[_0x2906('0x49')]['id'];}return db[_0x2906('0x2d')][_0x2906('0x47')]({'where':{'id':_0x1236d6[_0x2906('0x4a')]['id']}})[_0x2906('0x27')](handleEntityNotFound(_0x29e752,null))[_0x2906('0x27')](saveUpdates(_0x1236d6[_0x2906('0x49')],null))[_0x2906('0x27')](respondWithResult(_0x29e752,null))[_0x2906('0x44')](handleError(_0x29e752,null));};exports[_0x2906('0x28')]=function(_0x443647,_0x1f8f6e){return db[_0x2906('0x2d')]['find']({'where':{'id':_0x443647[_0x2906('0x4a')]['id']}})[_0x2906('0x27')](handleEntityNotFound(_0x1f8f6e,null))[_0x2906('0x27')](removeEntity(_0x1f8f6e,null))['catch'](handleError(_0x1f8f6e,null));};exports[_0x2906('0x4b')]=function(_0x419bf3,_0x899642,_0x45e644){var _0x49a418={};var _0xcce6d2={};var _0x18a598;var _0x22ae8e;return db[_0x2906('0x2d')][_0x2906('0x4c')]({'where':{'id':_0x419bf3[_0x2906('0x4a')]['id']}})['then'](handleEntityNotFound(_0x899642,null))[_0x2906('0x27')](function(_0x40c998){if(_0x40c998){_0x18a598=_0x40c998;_0xcce6d2[_0x2906('0x32')]=_[_0x2906('0x34')](db[_0x2906('0x4d')][_0x2906('0x2e')]);_0xcce6d2['query']=_[_0x2906('0x34')](_0x419bf3[_0x2906('0x33')]);_0xcce6d2[_0x2906('0x35')]=_[_0x2906('0x36')](_0xcce6d2[_0x2906('0x32')],_0xcce6d2[_0x2906('0x33')]);_0x49a418[_0x2906('0x38')]=_['intersection'](_0xcce6d2[_0x2906('0x32')],qs[_0x2906('0x37')](_0x419bf3[_0x2906('0x33')][_0x2906('0x37')]));_0x49a418[_0x2906('0x38')]=_0x49a418[_0x2906('0x38')][_0x2906('0x46')]?_0x49a418[_0x2906('0x38')]:_0xcce6d2[_0x2906('0x32')];_0x49a418['order']=qs[_0x2906('0x3b')](_0x419bf3[_0x2906('0x33')][_0x2906('0x3b')]);_0x49a418['where']=qs[_0x2906('0x35')](_[_0x2906('0x3d')](_0x419bf3[_0x2906('0x33')],_0xcce6d2[_0x2906('0x35')]));if(_0x419bf3[_0x2906('0x33')]['filter']){_0x49a418[_0x2906('0x3c')]=_[_0x2906('0x3f')](_0x49a418[_0x2906('0x3c')],{'$or':_[_0x2906('0x2c')](_0x49a418[_0x2906('0x38')],function(_0x26713c){var _0x3a5231={};_0x3a5231[_0x26713c]={'$like':'%'+_0x419bf3['query']['filter']+'%'};return _0x3a5231;})});}_0x49a418=_[_0x2906('0x3f')]({},_0x49a418,_0x419bf3['options']);return _0x18a598['getFields'](_0x49a418);}})[_0x2906('0x27')](function(_0x328ecf){if(_0x328ecf){_0x22ae8e=_0x328ecf[_0x2906('0x46')];if(!_0x419bf3[_0x2906('0x33')][_0x2906('0x39')](_0x2906('0x4e'))){_0x49a418[_0x2906('0x23')]=qs[_0x2906('0x23')](_0x419bf3[_0x2906('0x33')][_0x2906('0x23')]);_0x49a418[_0x2906('0x20')]=qs[_0x2906('0x20')](_0x419bf3[_0x2906('0x33')]['offset']);}return _0x18a598[_0x2906('0x4b')](_0x49a418);}})['then'](function(_0x5ea8d1){if(_0x5ea8d1){return _0x5ea8d1?{'count':_0x22ae8e,'rows':_0x5ea8d1}:null;}})[_0x2906('0x27')](respondWithResult(_0x899642,null))[_0x2906('0x44')](handleError(_0x899642,null));};exports['getSubjects']=function(_0x129865,_0x330cfd,_0xf63219){var _0x100a7b={};var _0x593ffb={};var _0x35245e;var _0x27dfcf;return db[_0x2906('0x2d')]['findOne']({'where':{'id':_0x129865['params']['id']}})[_0x2906('0x27')](handleEntityNotFound(_0x330cfd,null))[_0x2906('0x27')](function(_0x59ce3c){if(_0x59ce3c){_0x35245e=_0x59ce3c;_0x593ffb['model']=_[_0x2906('0x34')](db[_0x2906('0x4d')][_0x2906('0x2e')]);_0x593ffb[_0x2906('0x33')]=_[_0x2906('0x34')](_0x129865['query']);_0x593ffb[_0x2906('0x35')]=_['intersection'](_0x593ffb[_0x2906('0x32')],_0x593ffb['query']);_0x100a7b['attributes']=_[_0x2906('0x36')](_0x593ffb['model'],qs['fields'](_0x129865[_0x2906('0x33')][_0x2906('0x37')]));_0x100a7b[_0x2906('0x38')]=_0x100a7b[_0x2906('0x38')][_0x2906('0x46')]?_0x100a7b['attributes']:_0x593ffb[_0x2906('0x32')];_0x100a7b[_0x2906('0x3a')]=qs['sort'](_0x129865[_0x2906('0x33')][_0x2906('0x3b')]);_0x100a7b[_0x2906('0x3c')]=qs[_0x2906('0x35')](_[_0x2906('0x3d')](_0x129865['query'],_0x593ffb[_0x2906('0x35')]));if(_0x129865[_0x2906('0x33')][_0x2906('0x3e')]){_0x100a7b['where']=_[_0x2906('0x3f')](_0x100a7b[_0x2906('0x3c')],{'$or':_[_0x2906('0x2c')](_0x100a7b[_0x2906('0x38')],function(_0x54fd75){var _0x518f79={};_0x518f79[_0x54fd75]={'$like':'%'+_0x129865[_0x2906('0x33')][_0x2906('0x3e')]+'%'};return _0x518f79;})});}_0x100a7b=_[_0x2906('0x3f')]({},_0x100a7b,_0x129865[_0x2906('0x40')]);return _0x35245e[_0x2906('0x4f')](_0x100a7b);}})['then'](function(_0xb212d8){if(_0xb212d8){_0x27dfcf=_0xb212d8[_0x2906('0x46')];if(!_0x129865[_0x2906('0x33')][_0x2906('0x39')](_0x2906('0x4e'))){_0x100a7b[_0x2906('0x23')]=qs[_0x2906('0x23')](_0x129865[_0x2906('0x33')][_0x2906('0x23')]);_0x100a7b[_0x2906('0x20')]=qs[_0x2906('0x20')](_0x129865[_0x2906('0x33')][_0x2906('0x20')]);}return _0x35245e[_0x2906('0x4f')](_0x100a7b);}})[_0x2906('0x27')](function(_0x25895f){if(_0x25895f){return _0x25895f?{'count':_0x27dfcf,'rows':_0x25895f}:null;}})[_0x2906('0x27')](respondWithResult(_0x330cfd,null))[_0x2906('0x44')](handleError(_0x330cfd,null));};exports[_0x2906('0x50')]=function(_0x2d2c5d,_0x24abba,_0x5b12f3){var _0x40b7ab={};var _0x52d3f7={};var _0x3a81e8;var _0x1cf445;return db['ZendeskConfiguration'][_0x2906('0x4c')]({'where':{'id':_0x2d2c5d[_0x2906('0x4a')]['id']}})[_0x2906('0x27')](handleEntityNotFound(_0x24abba,null))[_0x2906('0x27')](function(_0x342011){if(_0x342011){_0x3a81e8=_0x342011;_0x52d3f7[_0x2906('0x32')]=_['keys'](db[_0x2906('0x4d')]['rawAttributes']);_0x52d3f7['query']=_[_0x2906('0x34')](_0x2d2c5d[_0x2906('0x33')]);_0x52d3f7[_0x2906('0x35')]=_[_0x2906('0x36')](_0x52d3f7[_0x2906('0x32')],_0x52d3f7[_0x2906('0x33')]);_0x40b7ab[_0x2906('0x38')]=_['intersection'](_0x52d3f7[_0x2906('0x32')],qs['fields'](_0x2d2c5d[_0x2906('0x33')][_0x2906('0x37')]));_0x40b7ab[_0x2906('0x38')]=_0x40b7ab[_0x2906('0x38')]['length']?_0x40b7ab[_0x2906('0x38')]:_0x52d3f7[_0x2906('0x32')];_0x40b7ab[_0x2906('0x3a')]=qs[_0x2906('0x3b')](_0x2d2c5d[_0x2906('0x33')][_0x2906('0x3b')]);_0x40b7ab[_0x2906('0x3c')]=qs[_0x2906('0x35')](_[_0x2906('0x3d')](_0x2d2c5d[_0x2906('0x33')],_0x52d3f7[_0x2906('0x35')]));if(_0x2d2c5d[_0x2906('0x33')][_0x2906('0x3e')]){_0x40b7ab[_0x2906('0x3c')]=_['merge'](_0x40b7ab['where'],{'$or':_[_0x2906('0x2c')](_0x40b7ab[_0x2906('0x38')],function(_0x3df8a7){var _0x3f3619={};_0x3f3619[_0x3df8a7]={'$like':'%'+_0x2d2c5d[_0x2906('0x33')][_0x2906('0x3e')]+'%'};return _0x3f3619;})});}_0x40b7ab=_['merge']({},_0x40b7ab,_0x2d2c5d[_0x2906('0x40')]);return _0x3a81e8[_0x2906('0x50')](_0x40b7ab);}})[_0x2906('0x27')](function(_0x54a1d0){if(_0x54a1d0){_0x1cf445=_0x54a1d0[_0x2906('0x46')];if(!_0x2d2c5d['query'][_0x2906('0x39')](_0x2906('0x4e'))){_0x40b7ab[_0x2906('0x23')]=qs[_0x2906('0x23')](_0x2d2c5d['query']['limit']);_0x40b7ab[_0x2906('0x20')]=qs[_0x2906('0x20')](_0x2d2c5d[_0x2906('0x33')][_0x2906('0x20')]);}return _0x3a81e8[_0x2906('0x50')](_0x40b7ab);}})[_0x2906('0x27')](function(_0x3edf22){if(_0x3edf22){return _0x3edf22?{'count':_0x1cf445,'rows':_0x3edf22}:null;}})[_0x2906('0x27')](respondWithResult(_0x24abba,null))[_0x2906('0x44')](handleError(_0x24abba,null));};exports[_0x2906('0x51')]=function(_0x3348f7,_0x101809,_0x2ca023){var _0x266ed7={};var _0x3d3245={};var _0x53a289;var _0x326053;return db[_0x2906('0x2d')]['findOne']({'where':{'id':_0x3348f7[_0x2906('0x4a')]['id']}})[_0x2906('0x27')](handleEntityNotFound(_0x101809,null))[_0x2906('0x27')](function(_0x9933d5){if(_0x9933d5){_0x53a289=_0x9933d5;_0x3d3245[_0x2906('0x32')]=_['keys'](db[_0x2906('0x52')][_0x2906('0x2e')]);_0x3d3245[_0x2906('0x33')]=_['keys'](_0x3348f7['query']);_0x3d3245[_0x2906('0x35')]=_['intersection'](_0x3d3245[_0x2906('0x32')],_0x3d3245[_0x2906('0x33')]);_0x266ed7[_0x2906('0x38')]=_[_0x2906('0x36')](_0x3d3245[_0x2906('0x32')],qs[_0x2906('0x37')](_0x3348f7[_0x2906('0x33')][_0x2906('0x37')]));_0x266ed7[_0x2906('0x38')]=_0x266ed7[_0x2906('0x38')][_0x2906('0x46')]?_0x266ed7[_0x2906('0x38')]:_0x3d3245[_0x2906('0x32')];_0x266ed7[_0x2906('0x3a')]=qs[_0x2906('0x3b')](_0x3348f7[_0x2906('0x33')]['sort']);_0x266ed7[_0x2906('0x3c')]=qs[_0x2906('0x35')](_[_0x2906('0x3d')](_0x3348f7[_0x2906('0x33')],_0x3d3245[_0x2906('0x35')]));if(_0x3348f7[_0x2906('0x33')][_0x2906('0x3e')]){_0x266ed7[_0x2906('0x3c')]=_['merge'](_0x266ed7['where'],{'$or':_[_0x2906('0x2c')](_0x266ed7['attributes'],function(_0x1778c2){var _0x3a1802={};_0x3a1802[_0x1778c2]={'$like':'%'+_0x3348f7[_0x2906('0x33')][_0x2906('0x3e')]+'%'};return _0x3a1802;})});}_0x266ed7=_[_0x2906('0x3f')]({},_0x266ed7,_0x3348f7[_0x2906('0x40')]);return _0x53a289[_0x2906('0x51')](_0x266ed7);}})['then'](function(_0x162d40){if(_0x162d40){_0x326053=_0x162d40['length'];if(!_0x3348f7['query']['hasOwnProperty'](_0x2906('0x4e'))){_0x266ed7[_0x2906('0x23')]=qs[_0x2906('0x23')](_0x3348f7[_0x2906('0x33')][_0x2906('0x23')]);_0x266ed7[_0x2906('0x20')]=qs[_0x2906('0x20')](_0x3348f7[_0x2906('0x33')]['offset']);}return _0x53a289['getTags'](_0x266ed7);}})[_0x2906('0x27')](function(_0x1436a5){if(_0x1436a5){return _0x1436a5?{'count':_0x326053,'rows':_0x1436a5}:null;}})[_0x2906('0x27')](respondWithResult(_0x101809,null))[_0x2906('0x44')](handleError(_0x101809,null));};exports[_0x2906('0x53')]=function(_0x4f26aa,_0x16166f,_0x1fa5c8){if(_0x4f26aa[_0x2906('0x49')]['id']){delete _0x4f26aa[_0x2906('0x49')]['id'];}return db[_0x2906('0x2d')][_0x2906('0x4c')]({'where':{'id':_0x4f26aa['params']['id']}})[_0x2906('0x27')](handleEntityNotFound(_0x16166f,null))[_0x2906('0x27')](function(_0x4022b7){if(_0x4022b7){return _0x4022b7[_0x2906('0x53')](_0x4f26aa['body'][_0x2906('0x54')]||[]);}return null;})[_0x2906('0x27')](respondWithResult(_0x16166f,null))[_0x2906('0x44')](handleError(_0x16166f,null));}; \ No newline at end of file +var _0x0dd7=['count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','ZendeskConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','body','getFields','findOne','ZendeskField','fields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','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','offset','undefined'];(function(_0x46712d,_0x24e525){var _0x10c2fb=function(_0x3b78d3){while(--_0x3b78d3){_0x46712d['push'](_0x46712d['shift']());}};_0x10c2fb(++_0x24e525);}(_0x0dd7,0x140));var _0x70dd=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0x0dd7[_0x56e0e8];return _0x2dab50;};'use strict';var emlformat=require(_0x70dd('0x0'));var rimraf=require(_0x70dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70dd('0x2'));var rp=require(_0x70dd('0x3'));var moment=require(_0x70dd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x70dd('0x5'));var util=require(_0x70dd('0x6'));var path=require(_0x70dd('0x7'));var sox=require(_0x70dd('0x8'));var csv=require(_0x70dd('0x9'));var ejs=require(_0x70dd('0xa'));var fs=require('fs');var fs_extra=require(_0x70dd('0xb'));var _=require(_0x70dd('0xc'));var squel=require('squel');var crypto=require(_0x70dd('0xd'));var jsforce=require(_0x70dd('0xe'));var deskjs=require(_0x70dd('0xf'));var toCsv=require(_0x70dd('0x9'));var querystring=require(_0x70dd('0x10'));var Papa=require(_0x70dd('0x11'));var Redis=require(_0x70dd('0x12'));var authService=require(_0x70dd('0x13'));var qs=require(_0x70dd('0x14'));var as=require(_0x70dd('0x15'));var hardwareService=require(_0x70dd('0x16'));var logger=require(_0x70dd('0x17'))('api');var utils=require(_0x70dd('0x18'));var config=require(_0x70dd('0x19'));var licenseUtil=require(_0x70dd('0x1a'));var db=require(_0x70dd('0x1b'))['db'];function respondWithStatusCode(_0x362f51,_0x25057d){_0x25057d=_0x25057d||0xcc;return function(_0x21673a){if(_0x21673a){return _0x362f51['sendStatus'](_0x25057d);}return _0x362f51[_0x70dd('0x1c')](_0x25057d)[_0x70dd('0x1d')]();};}function respondWithResult(_0x1ca794,_0x297a3c){_0x297a3c=_0x297a3c||0xc8;return function(_0x407805){if(_0x407805){return _0x1ca794[_0x70dd('0x1c')](_0x297a3c)['json'](_0x407805);}};}function respondWithFilteredResult(_0x2fb3cf,_0x29d04a){return function(_0x4c32e6){if(_0x4c32e6){var _0x224b8f=typeof _0x29d04a[_0x70dd('0x1e')]===_0x70dd('0x1f')&&typeof _0x29d04a['limit']===_0x70dd('0x1f');var _0x3bd4ef=_0x4c32e6['count'];var _0x4b3ba0=_0x224b8f?0x0:_0x29d04a['offset'];var _0x4c0ddb=_0x224b8f?_0x4c32e6[_0x70dd('0x20')]:_0x29d04a[_0x70dd('0x1e')]+_0x29d04a[_0x70dd('0x21')];var _0x2e0d1a;if(_0x4c0ddb>=_0x3bd4ef){_0x4c0ddb=_0x3bd4ef;_0x2e0d1a=0xc8;}else{_0x2e0d1a=0xce;}_0x2fb3cf['status'](_0x2e0d1a);return _0x2fb3cf[_0x70dd('0x22')]('Content-Range',_0x4b3ba0+'-'+_0x4c0ddb+'/'+_0x3bd4ef)[_0x70dd('0x23')](_0x4c32e6);}return null;};}function patchUpdates(_0x43c284){return function(_0x55e34b){try{jsonpatch[_0x70dd('0x24')](_0x55e34b,_0x43c284,!![]);}catch(_0x36281b){return BPromise[_0x70dd('0x25')](_0x36281b);}return _0x55e34b[_0x70dd('0x26')]();};}function saveUpdates(_0x229791,_0x290487){return function(_0x1c67be){if(_0x1c67be){return _0x1c67be[_0x70dd('0x27')](_0x229791)[_0x70dd('0x28')](function(_0x4217a4){return _0x4217a4;});}return null;};}function removeEntity(_0x13c079,_0x2ef56b){return function(_0x43829b){if(_0x43829b){return _0x43829b[_0x70dd('0x29')]()['then'](function(){_0x13c079[_0x70dd('0x1c')](0xcc)[_0x70dd('0x1d')]();});}};}function handleEntityNotFound(_0x4604af,_0xc7618d){return function(_0x33c7a3){if(!_0x33c7a3){_0x4604af['sendStatus'](0x194);}return _0x33c7a3;};}function handleError(_0x532717,_0x543367){_0x543367=_0x543367||0x1f4;return function(_0x170a0f){logger[_0x70dd('0x2a')](_0x170a0f[_0x70dd('0x2b')]);if(_0x170a0f[_0x70dd('0x2c')]){delete _0x170a0f[_0x70dd('0x2c')];}_0x532717[_0x70dd('0x1c')](_0x543367)[_0x70dd('0x2d')](_0x170a0f);};}exports['index']=function(_0x4740fb,_0x210545){var _0x1125de={},_0x4d3c92={},_0x47bcbd={'count':0x0,'rows':[]};var _0xb25f3b=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x58bdb8){return{'name':_0x58bdb8[_0x70dd('0x2e')],'type':_0x58bdb8[_0x70dd('0x2f')][_0x70dd('0x30')]};});_0x4d3c92['model']=_['map'](_0xb25f3b,_0x70dd('0x2c'));_0x4d3c92[_0x70dd('0x31')]=_['keys'](_0x4740fb['query']);_0x4d3c92[_0x70dd('0x32')]=_[_0x70dd('0x33')](_0x4d3c92[_0x70dd('0x34')],_0x4d3c92[_0x70dd('0x31')]);_0x1125de['attributes']=_[_0x70dd('0x33')](_0x4d3c92[_0x70dd('0x34')],qs['fields'](_0x4740fb[_0x70dd('0x31')]['fields']));_0x1125de[_0x70dd('0x35')]=_0x1125de['attributes'][_0x70dd('0x36')]?_0x1125de['attributes']:_0x4d3c92[_0x70dd('0x34')];if(!_0x4740fb[_0x70dd('0x31')][_0x70dd('0x37')](_0x70dd('0x38'))){_0x1125de[_0x70dd('0x21')]=qs['limit'](_0x4740fb['query'][_0x70dd('0x21')]);_0x1125de[_0x70dd('0x1e')]=qs[_0x70dd('0x1e')](_0x4740fb[_0x70dd('0x31')]['offset']);}_0x1125de[_0x70dd('0x39')]=qs[_0x70dd('0x3a')](_0x4740fb['query']['sort']);_0x1125de[_0x70dd('0x3b')]=qs[_0x70dd('0x32')](_[_0x70dd('0x3c')](_0x4740fb[_0x70dd('0x31')],_0x4d3c92[_0x70dd('0x32')]),_0xb25f3b);if(_0x4740fb[_0x70dd('0x31')][_0x70dd('0x3d')]){_0x1125de['where']=_[_0x70dd('0x3e')](_0x1125de[_0x70dd('0x3b')],{'$or':_[_0x70dd('0x3f')](_0xb25f3b,function(_0x5e820a){if(_0x5e820a['type']!==_0x70dd('0x40')){var _0x3827a5={};_0x3827a5[_0x5e820a[_0x70dd('0x2c')]]={'$like':'%'+_0x4740fb['query'][_0x70dd('0x3d')]+'%'};return _0x3827a5;}})});}_0x1125de=_['merge']({},_0x1125de,_0x4740fb[_0x70dd('0x41')]);var _0x3ec27a={'where':_0x1125de['where']};return db[_0x70dd('0x42')][_0x70dd('0x20')](_0x3ec27a)[_0x70dd('0x28')](function(_0x37de8d){_0x47bcbd[_0x70dd('0x20')]=_0x37de8d;if(_0x4740fb[_0x70dd('0x31')][_0x70dd('0x43')]){_0x1125de[_0x70dd('0x44')]=[{'all':!![]}];}return db[_0x70dd('0x42')][_0x70dd('0x45')](_0x1125de);})[_0x70dd('0x28')](function(_0x3dcbf1){_0x47bcbd[_0x70dd('0x46')]=_0x3dcbf1;return _0x47bcbd;})[_0x70dd('0x28')](respondWithFilteredResult(_0x210545,_0x1125de))[_0x70dd('0x47')](handleError(_0x210545,null));};exports[_0x70dd('0x48')]=function(_0x40dd70,_0x53d9f1){var _0xfbe581={'raw':![],'where':{'id':_0x40dd70[_0x70dd('0x49')]['id']}},_0x1551c1={};_0x1551c1[_0x70dd('0x34')]=_[_0x70dd('0x4a')](db[_0x70dd('0x42')][_0x70dd('0x4b')]);_0x1551c1[_0x70dd('0x31')]=_[_0x70dd('0x4a')](_0x40dd70[_0x70dd('0x31')]);_0x1551c1[_0x70dd('0x32')]=_[_0x70dd('0x33')](_0x1551c1[_0x70dd('0x34')],_0x1551c1[_0x70dd('0x31')]);_0xfbe581['attributes']=_[_0x70dd('0x33')](_0x1551c1[_0x70dd('0x34')],qs['fields'](_0x40dd70[_0x70dd('0x31')]['fields']));_0xfbe581[_0x70dd('0x35')]=_0xfbe581[_0x70dd('0x35')][_0x70dd('0x36')]?_0xfbe581['attributes']:_0x1551c1[_0x70dd('0x34')];if(_0x40dd70[_0x70dd('0x31')][_0x70dd('0x43')]){_0xfbe581[_0x70dd('0x44')]=[{'all':!![]}];}_0xfbe581=_[_0x70dd('0x3e')]({},_0xfbe581,_0x40dd70[_0x70dd('0x41')]);return db['ZendeskConfiguration'][_0x70dd('0x4c')](_0xfbe581)[_0x70dd('0x28')](handleEntityNotFound(_0x53d9f1,null))[_0x70dd('0x28')](respondWithResult(_0x53d9f1,null))[_0x70dd('0x47')](handleError(_0x53d9f1,null));};exports['create']=function(_0x356ac7,_0x3f89a0){return db[_0x70dd('0x42')]['create'](_0x356ac7[_0x70dd('0x4d')],{})[_0x70dd('0x28')](respondWithResult(_0x3f89a0,0xc9))['catch'](handleError(_0x3f89a0,null));};exports[_0x70dd('0x27')]=function(_0x2a923f,_0x4df7dd){if(_0x2a923f[_0x70dd('0x4d')]['id']){delete _0x2a923f['body']['id'];}return db[_0x70dd('0x42')]['find']({'where':{'id':_0x2a923f[_0x70dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x4df7dd,null))[_0x70dd('0x28')](saveUpdates(_0x2a923f['body'],null))[_0x70dd('0x28')](respondWithResult(_0x4df7dd,null))[_0x70dd('0x47')](handleError(_0x4df7dd,null));};exports[_0x70dd('0x29')]=function(_0x331a6d,_0x31bb09){return db['ZendeskConfiguration'][_0x70dd('0x4c')]({'where':{'id':_0x331a6d[_0x70dd('0x49')]['id']}})[_0x70dd('0x28')](handleEntityNotFound(_0x31bb09,null))[_0x70dd('0x28')](removeEntity(_0x31bb09,null))[_0x70dd('0x47')](handleError(_0x31bb09,null));};exports[_0x70dd('0x4e')]=function(_0x5a1c0f,_0x2ed25d,_0x1dc8eb){var _0x267a6e={};var _0x480795={};var _0x315935;var _0x5c37ce;return db['ZendeskConfiguration'][_0x70dd('0x4f')]({'where':{'id':_0x5a1c0f[_0x70dd('0x49')]['id']}})[_0x70dd('0x28')](handleEntityNotFound(_0x2ed25d,null))['then'](function(_0x22453e){if(_0x22453e){_0x315935=_0x22453e;_0x480795[_0x70dd('0x34')]=_[_0x70dd('0x4a')](db[_0x70dd('0x50')][_0x70dd('0x4b')]);_0x480795[_0x70dd('0x31')]=_[_0x70dd('0x4a')](_0x5a1c0f[_0x70dd('0x31')]);_0x480795[_0x70dd('0x32')]=_[_0x70dd('0x33')](_0x480795[_0x70dd('0x34')],_0x480795[_0x70dd('0x31')]);_0x267a6e[_0x70dd('0x35')]=_[_0x70dd('0x33')](_0x480795[_0x70dd('0x34')],qs[_0x70dd('0x51')](_0x5a1c0f[_0x70dd('0x31')][_0x70dd('0x51')]));_0x267a6e[_0x70dd('0x35')]=_0x267a6e['attributes'][_0x70dd('0x36')]?_0x267a6e[_0x70dd('0x35')]:_0x480795['model'];_0x267a6e[_0x70dd('0x39')]=qs[_0x70dd('0x3a')](_0x5a1c0f[_0x70dd('0x31')][_0x70dd('0x3a')]);_0x267a6e[_0x70dd('0x3b')]=qs[_0x70dd('0x32')](_[_0x70dd('0x3c')](_0x5a1c0f[_0x70dd('0x31')],_0x480795[_0x70dd('0x32')]));if(_0x5a1c0f[_0x70dd('0x31')]['filter']){_0x267a6e[_0x70dd('0x3b')]=_[_0x70dd('0x3e')](_0x267a6e[_0x70dd('0x3b')],{'$or':_['map'](_0x267a6e[_0x70dd('0x35')],function(_0x590194){var _0x414e49={};_0x414e49[_0x590194]={'$like':'%'+_0x5a1c0f[_0x70dd('0x31')]['filter']+'%'};return _0x414e49;})});}_0x267a6e=_[_0x70dd('0x3e')]({},_0x267a6e,_0x5a1c0f['options']);return _0x315935[_0x70dd('0x4e')](_0x267a6e);}})[_0x70dd('0x28')](function(_0x206a24){if(_0x206a24){_0x5c37ce=_0x206a24[_0x70dd('0x36')];if(!_0x5a1c0f[_0x70dd('0x31')][_0x70dd('0x37')](_0x70dd('0x38'))){_0x267a6e[_0x70dd('0x21')]=qs['limit'](_0x5a1c0f['query'][_0x70dd('0x21')]);_0x267a6e[_0x70dd('0x1e')]=qs[_0x70dd('0x1e')](_0x5a1c0f[_0x70dd('0x31')][_0x70dd('0x1e')]);}return _0x315935['getFields'](_0x267a6e);}})[_0x70dd('0x28')](function(_0xd3bf2f){if(_0xd3bf2f){return _0xd3bf2f?{'count':_0x5c37ce,'rows':_0xd3bf2f}:null;}})[_0x70dd('0x28')](respondWithResult(_0x2ed25d,null))['catch'](handleError(_0x2ed25d,null));};exports[_0x70dd('0x52')]=function(_0x27d653,_0xfbdba9,_0x177ee9){var _0x1eb31e={};var _0x5bd546={};var _0x297fc1;var _0x465ec7;return db[_0x70dd('0x42')]['findOne']({'where':{'id':_0x27d653[_0x70dd('0x49')]['id']}})[_0x70dd('0x28')](handleEntityNotFound(_0xfbdba9,null))['then'](function(_0x51f694){if(_0x51f694){_0x297fc1=_0x51f694;_0x5bd546[_0x70dd('0x34')]=_[_0x70dd('0x4a')](db[_0x70dd('0x50')][_0x70dd('0x4b')]);_0x5bd546[_0x70dd('0x31')]=_['keys'](_0x27d653[_0x70dd('0x31')]);_0x5bd546['filters']=_['intersection'](_0x5bd546['model'],_0x5bd546[_0x70dd('0x31')]);_0x1eb31e[_0x70dd('0x35')]=_[_0x70dd('0x33')](_0x5bd546[_0x70dd('0x34')],qs['fields'](_0x27d653[_0x70dd('0x31')][_0x70dd('0x51')]));_0x1eb31e['attributes']=_0x1eb31e[_0x70dd('0x35')]['length']?_0x1eb31e[_0x70dd('0x35')]:_0x5bd546[_0x70dd('0x34')];_0x1eb31e[_0x70dd('0x39')]=qs[_0x70dd('0x3a')](_0x27d653[_0x70dd('0x31')][_0x70dd('0x3a')]);_0x1eb31e['where']=qs[_0x70dd('0x32')](_['pick'](_0x27d653[_0x70dd('0x31')],_0x5bd546[_0x70dd('0x32')]));if(_0x27d653['query'][_0x70dd('0x3d')]){_0x1eb31e['where']=_[_0x70dd('0x3e')](_0x1eb31e[_0x70dd('0x3b')],{'$or':_[_0x70dd('0x3f')](_0x1eb31e[_0x70dd('0x35')],function(_0x2c018c){var _0x4071f8={};_0x4071f8[_0x2c018c]={'$like':'%'+_0x27d653[_0x70dd('0x31')][_0x70dd('0x3d')]+'%'};return _0x4071f8;})});}_0x1eb31e=_['merge']({},_0x1eb31e,_0x27d653['options']);return _0x297fc1['getSubjects'](_0x1eb31e);}})[_0x70dd('0x28')](function(_0x122f65){if(_0x122f65){_0x465ec7=_0x122f65[_0x70dd('0x36')];if(!_0x27d653['query']['hasOwnProperty']('nolimit')){_0x1eb31e['limit']=qs[_0x70dd('0x21')](_0x27d653[_0x70dd('0x31')][_0x70dd('0x21')]);_0x1eb31e[_0x70dd('0x1e')]=qs[_0x70dd('0x1e')](_0x27d653[_0x70dd('0x31')][_0x70dd('0x1e')]);}return _0x297fc1[_0x70dd('0x52')](_0x1eb31e);}})[_0x70dd('0x28')](function(_0x112547){if(_0x112547){return _0x112547?{'count':_0x465ec7,'rows':_0x112547}:null;}})[_0x70dd('0x28')](respondWithResult(_0xfbdba9,null))[_0x70dd('0x47')](handleError(_0xfbdba9,null));};exports[_0x70dd('0x53')]=function(_0x5c01f6,_0xf7310a,_0x134276){var _0xe423ad={};var _0x1488c6={};var _0x2d02bf;var _0x5d137d;return db[_0x70dd('0x42')]['findOne']({'where':{'id':_0x5c01f6[_0x70dd('0x49')]['id']}})[_0x70dd('0x28')](handleEntityNotFound(_0xf7310a,null))[_0x70dd('0x28')](function(_0x1e4256){if(_0x1e4256){_0x2d02bf=_0x1e4256;_0x1488c6[_0x70dd('0x34')]=_[_0x70dd('0x4a')](db[_0x70dd('0x50')]['rawAttributes']);_0x1488c6[_0x70dd('0x31')]=_[_0x70dd('0x4a')](_0x5c01f6[_0x70dd('0x31')]);_0x1488c6[_0x70dd('0x32')]=_['intersection'](_0x1488c6[_0x70dd('0x34')],_0x1488c6[_0x70dd('0x31')]);_0xe423ad['attributes']=_['intersection'](_0x1488c6[_0x70dd('0x34')],qs[_0x70dd('0x51')](_0x5c01f6[_0x70dd('0x31')]['fields']));_0xe423ad[_0x70dd('0x35')]=_0xe423ad[_0x70dd('0x35')][_0x70dd('0x36')]?_0xe423ad['attributes']:_0x1488c6[_0x70dd('0x34')];_0xe423ad[_0x70dd('0x39')]=qs[_0x70dd('0x3a')](_0x5c01f6[_0x70dd('0x31')]['sort']);_0xe423ad[_0x70dd('0x3b')]=qs[_0x70dd('0x32')](_[_0x70dd('0x3c')](_0x5c01f6['query'],_0x1488c6[_0x70dd('0x32')]));if(_0x5c01f6['query'][_0x70dd('0x3d')]){_0xe423ad[_0x70dd('0x3b')]=_[_0x70dd('0x3e')](_0xe423ad[_0x70dd('0x3b')],{'$or':_[_0x70dd('0x3f')](_0xe423ad['attributes'],function(_0x296ba3){var _0x15d4dc={};_0x15d4dc[_0x296ba3]={'$like':'%'+_0x5c01f6['query'][_0x70dd('0x3d')]+'%'};return _0x15d4dc;})});}_0xe423ad=_[_0x70dd('0x3e')]({},_0xe423ad,_0x5c01f6[_0x70dd('0x41')]);return _0x2d02bf[_0x70dd('0x53')](_0xe423ad);}})[_0x70dd('0x28')](function(_0x4553f4){if(_0x4553f4){_0x5d137d=_0x4553f4[_0x70dd('0x36')];if(!_0x5c01f6[_0x70dd('0x31')][_0x70dd('0x37')](_0x70dd('0x38'))){_0xe423ad[_0x70dd('0x21')]=qs[_0x70dd('0x21')](_0x5c01f6['query'][_0x70dd('0x21')]);_0xe423ad[_0x70dd('0x1e')]=qs[_0x70dd('0x1e')](_0x5c01f6[_0x70dd('0x31')]['offset']);}return _0x2d02bf[_0x70dd('0x53')](_0xe423ad);}})['then'](function(_0x5972cc){if(_0x5972cc){return _0x5972cc?{'count':_0x5d137d,'rows':_0x5972cc}:null;}})[_0x70dd('0x28')](respondWithResult(_0xf7310a,null))[_0x70dd('0x47')](handleError(_0xf7310a,null));};exports[_0x70dd('0x54')]=function(_0x3ee748,_0x2b29b3,_0x57a503){var _0x1b63b8={};var _0x163046={};var _0x212ff1;var _0x29f190;return db[_0x70dd('0x42')]['findOne']({'where':{'id':_0x3ee748['params']['id']}})['then'](handleEntityNotFound(_0x2b29b3,null))[_0x70dd('0x28')](function(_0x41acd8){if(_0x41acd8){_0x212ff1=_0x41acd8;_0x163046['model']=_[_0x70dd('0x4a')](db[_0x70dd('0x55')][_0x70dd('0x4b')]);_0x163046['query']=_[_0x70dd('0x4a')](_0x3ee748[_0x70dd('0x31')]);_0x163046[_0x70dd('0x32')]=_['intersection'](_0x163046[_0x70dd('0x34')],_0x163046[_0x70dd('0x31')]);_0x1b63b8[_0x70dd('0x35')]=_[_0x70dd('0x33')](_0x163046[_0x70dd('0x34')],qs[_0x70dd('0x51')](_0x3ee748['query']['fields']));_0x1b63b8[_0x70dd('0x35')]=_0x1b63b8['attributes'][_0x70dd('0x36')]?_0x1b63b8[_0x70dd('0x35')]:_0x163046[_0x70dd('0x34')];_0x1b63b8['order']=qs['sort'](_0x3ee748[_0x70dd('0x31')][_0x70dd('0x3a')]);_0x1b63b8[_0x70dd('0x3b')]=qs[_0x70dd('0x32')](_[_0x70dd('0x3c')](_0x3ee748[_0x70dd('0x31')],_0x163046[_0x70dd('0x32')]));if(_0x3ee748['query'][_0x70dd('0x3d')]){_0x1b63b8['where']=_['merge'](_0x1b63b8[_0x70dd('0x3b')],{'$or':_[_0x70dd('0x3f')](_0x1b63b8[_0x70dd('0x35')],function(_0x54eb94){var _0x20bd73={};_0x20bd73[_0x54eb94]={'$like':'%'+_0x3ee748[_0x70dd('0x31')][_0x70dd('0x3d')]+'%'};return _0x20bd73;})});}_0x1b63b8=_[_0x70dd('0x3e')]({},_0x1b63b8,_0x3ee748['options']);return _0x212ff1[_0x70dd('0x54')](_0x1b63b8);}})['then'](function(_0xf6a518){if(_0xf6a518){_0x29f190=_0xf6a518['length'];if(!_0x3ee748[_0x70dd('0x31')][_0x70dd('0x37')](_0x70dd('0x38'))){_0x1b63b8['limit']=qs[_0x70dd('0x21')](_0x3ee748['query'][_0x70dd('0x21')]);_0x1b63b8[_0x70dd('0x1e')]=qs[_0x70dd('0x1e')](_0x3ee748[_0x70dd('0x31')][_0x70dd('0x1e')]);}return _0x212ff1[_0x70dd('0x54')](_0x1b63b8);}})[_0x70dd('0x28')](function(_0x39a06c){if(_0x39a06c){return _0x39a06c?{'count':_0x29f190,'rows':_0x39a06c}:null;}})[_0x70dd('0x28')](respondWithResult(_0x2b29b3,null))[_0x70dd('0x47')](handleError(_0x2b29b3,null));};exports[_0x70dd('0x56')]=function(_0x279485,_0x5069f2,_0x4e4915){if(_0x279485[_0x70dd('0x4d')]['id']){delete _0x279485[_0x70dd('0x4d')]['id'];}return db[_0x70dd('0x42')]['findOne']({'where':{'id':_0x279485['params']['id']}})[_0x70dd('0x28')](handleEntityNotFound(_0x5069f2,null))[_0x70dd('0x28')](function(_0x2b0411){if(_0x2b0411){return _0x2b0411[_0x70dd('0x56')](_0x279485[_0x70dd('0x4d')][_0x70dd('0x57')]||[]);}return null;})[_0x70dd('0x28')](respondWithResult(_0x5069f2,null))['catch'](handleError(_0x5069f2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c95e59f..04cf785 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 _0xb62e=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7708=['../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','rimraf'];(function(_0x4d5dc7,_0x39e0d3){var _0x4aca09=function(_0x4d6d9b){while(--_0x4d6d9b){_0x4d5dc7['push'](_0x4d5dc7['shift']());}};_0x4aca09(++_0x39e0d3);}(_0x7708,0x188));var _0x8770=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x7708[_0x1fb1c1];return _0x1622df;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index d64f99d..1ea9564 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 _0x7632=['code','message','info','result','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7632,0xf4));var _0x2763=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x7632[_0x19d24c];return _0x2fae8d;};'use strict';var _=require(_0x2763('0x0'));var util=require(_0x2763('0x1'));var moment=require('moment');var BPromise=require(_0x2763('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2763('0x3'));var logger=require(_0x2763('0x4'))(_0x2763('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2763('0x6')][_0x2763('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fe082,_0x55db5a,_0x365608){return new BPromise(function(_0x36e226,_0x213959){return client[_0x2763('0x8')](_0x4fe082,_0x365608)[_0x2763('0x9')](function(_0x673d31){logger['info'](_0x2763('0xa'),_0x55db5a,_0x2763('0xb'));logger[_0x2763('0xc')](_0x2763('0xd'),_0x55db5a,_0x2763('0xb'),JSON[_0x2763('0xe')](_0x673d31));if(_0x673d31[_0x2763('0xf')]){if(_0x673d31[_0x2763('0xf')][_0x2763('0x10')]===0x1f4){logger[_0x2763('0xf')](_0x2763('0xa'),_0x55db5a,_0x673d31['error'][_0x2763('0x11')]);return _0x213959(_0x673d31[_0x2763('0xf')][_0x2763('0x11')]);}logger[_0x2763('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x55db5a,_0x673d31[_0x2763('0xf')][_0x2763('0x11')]);return _0x36e226(_0x673d31[_0x2763('0xf')]['message']);}else{logger[_0x2763('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x55db5a,_0x2763('0xb'));_0x36e226(_0x673d31[_0x2763('0x13')][_0x2763('0x11')]);}})['catch'](function(_0x108e48){logger[_0x2763('0xf')](_0x2763('0xa'),_0x55db5a,_0x108e48);_0x213959(_0x108e48);});});} \ No newline at end of file +var _0x28d8=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x28d8,0x1d0));var _0x828d=function(_0x237fb7,_0x89dde7){_0x237fb7=_0x237fb7-0x0;var _0x1e69a5=_0x28d8[_0x237fb7];return _0x1e69a5;};'use strict';var _=require(_0x828d('0x0'));var util=require('util');var moment=require(_0x828d('0x1'));var BPromise=require(_0x828d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x828d('0x3'));var db=require(_0x828d('0x4'))['db'];var utils=require(_0x828d('0x5'));var logger=require('../../config/logger')(_0x828d('0x6'));var config=require(_0x828d('0x7'));var jayson=require(_0x828d('0x8'));var client=jayson['client'][_0x828d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e148e,_0x45a063,_0x367223){return new BPromise(function(_0x57fb10,_0x17d35f){return client['request'](_0x2e148e,_0x367223)[_0x828d('0xa')](function(_0x4d46a9){logger[_0x828d('0xb')](_0x828d('0xc'),_0x45a063,_0x828d('0xd'));logger[_0x828d('0xe')](_0x828d('0xf'),_0x45a063,_0x828d('0xd'),JSON[_0x828d('0x10')](_0x4d46a9));if(_0x4d46a9[_0x828d('0x11')]){if(_0x4d46a9[_0x828d('0x11')][_0x828d('0x12')]===0x1f4){logger[_0x828d('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x45a063,_0x4d46a9[_0x828d('0x11')][_0x828d('0x13')]);return _0x17d35f(_0x4d46a9[_0x828d('0x11')]['message']);}logger[_0x828d('0x11')](_0x828d('0xc'),_0x45a063,_0x4d46a9[_0x828d('0x11')][_0x828d('0x13')]);return _0x57fb10(_0x4d46a9['error'][_0x828d('0x13')]);}else{logger[_0x828d('0xb')](_0x828d('0xc'),_0x45a063,_0x828d('0xd'));_0x57fb10(_0x4d46a9[_0x828d('0x14')][_0x828d('0x13')]);}})['catch'](function(_0x488138){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x45a063,_0x488138);_0x17d35f(_0x488138);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5820e75..0778b5f 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 _0xec7a=['post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskField.controller','index','get','isAuthenticated','show'];(function(_0x38a155,_0x2aa026){var _0x269403=function(_0x47263b){while(--_0x47263b){_0x38a155['push'](_0x38a155['shift']());}};_0x269403(++_0x2aa026);}(_0xec7a,0x1ce));var _0xaec7=function(_0x59f7b8,_0xb2ac21){_0x59f7b8=_0x59f7b8-0x0;var _0x7b28c5=_0xec7a[_0x59f7b8];return _0x7b28c5;};'use strict';var multer=require(_0xaec7('0x0'));var util=require(_0xaec7('0x1'));var path=require(_0xaec7('0x2'));var timeout=require(_0xaec7('0x3'));var express=require(_0xaec7('0x4'));var router=express[_0xaec7('0x5')]();var fs_extra=require(_0xaec7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaec7('0x7'));var controller=require(_0xaec7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xaec7('0x9')]);router[_0xaec7('0xa')]('/:id',auth[_0xaec7('0xb')](),controller[_0xaec7('0xc')]);router[_0xaec7('0xd')]('/',auth[_0xaec7('0xb')](),controller[_0xaec7('0xe')]);router[_0xaec7('0xf')](_0xaec7('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xaec7('0x10'),auth[_0xaec7('0xb')](),controller[_0xaec7('0x11')]);module[_0xaec7('0x12')]=router; \ No newline at end of file +var _0xeb8f=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x51b177,_0x545b8e){var _0x18e416=function(_0x46827d){while(--_0x46827d){_0x51b177['push'](_0x51b177['shift']());}};_0x18e416(++_0x545b8e);}(_0xeb8f,0x18f));var _0xfeb8=function(_0x554f89,_0x111bd0){_0x554f89=_0x554f89-0x0;var _0x1fa724=_0xeb8f[_0x554f89];return _0x1fa724;};'use strict';var multer=require(_0xfeb8('0x0'));var util=require(_0xfeb8('0x1'));var path=require(_0xfeb8('0x2'));var timeout=require(_0xfeb8('0x3'));var express=require(_0xfeb8('0x4'));var router=express['Router']();var fs_extra=require(_0xfeb8('0x5'));var auth=require(_0xfeb8('0x6'));var interaction=require(_0xfeb8('0x7'));var config=require(_0xfeb8('0x8'));var controller=require('./intZendeskField.controller');router[_0xfeb8('0x9')]('/',auth[_0xfeb8('0xa')](),controller['index']);router['get'](_0xfeb8('0xb'),auth[_0xfeb8('0xa')](),controller['show']);router[_0xfeb8('0xc')]('/',auth[_0xfeb8('0xa')](),controller[_0xfeb8('0xd')]);router[_0xfeb8('0xe')](_0xfeb8('0xb'),auth[_0xfeb8('0xa')](),controller[_0xfeb8('0xf')]);router[_0xfeb8('0x10')]('/:id',auth[_0xfeb8('0xa')](),controller[_0xfeb8('0x11')]);module[_0xfeb8('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6d10494..fe6453c 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 _0x85f6=['exports','string','variable','customVariable','STRING','ENUM'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x85f6,0x12c));var _0x685f=function(_0x1d3166,_0x2c05ed){_0x1d3166=_0x1d3166-0x0;var _0x5bdbc0=_0x85f6[_0x1d3166];return _0x5bdbc0;};'use strict';var Sequelize=require('sequelize');module[_0x685f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x685f('0x1'),_0x685f('0x2'),_0x685f('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x685f('0x4')]},'key':{'type':Sequelize[_0x685f('0x4')]},'keyType':{'type':Sequelize[_0x685f('0x5')]('string',_0x685f('0x2'),_0x685f('0x3'))},'keyContent':{'type':Sequelize[_0x685f('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc5eb=['STRING','string','variable','customVariable','ENUM'];(function(_0x3343d6,_0x5678d9){var _0x1cc8d2=function(_0x4408ee){while(--_0x4408ee){_0x3343d6['push'](_0x3343d6['shift']());}};_0x1cc8d2(++_0x5678d9);}(_0xc5eb,0x1dc));var _0xbc5e=function(_0x19bce8,_0x2299eb){_0x19bce8=_0x19bce8-0x0;var _0x563135=_0xc5eb[_0x19bce8];return _0x563135;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xbc5e('0x0'),_0xbc5e('0x1'),_0xbc5e('0x2'),'keyValue','picklist'),'defaultValue':_0xbc5e('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbc5e('0x3')]('string',_0xbc5e('0x1'),_0xbc5e('0x2'))},'keyContent':{'type':Sequelize[_0xbc5e('0x4')]},'idField':{'type':Sequelize[_0xbc5e('0x4')]},'nameField':{'type':Sequelize[_0xbc5e('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbc5e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 577bdaa..98ad293 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 _0xb40e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','intersection','length','includeAll','include','create','body','find','eml-format','zip-dir','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x427cde,_0x125958){var _0x5c0392=function(_0x1a3c9a){while(--_0x1a3c9a){_0x427cde['push'](_0x427cde['shift']());}};_0x5c0392(++_0x125958);}(_0xb40e,0x120));var _0xeb40=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0xb40e[_0x36b037];return _0x409194;};'use strict';var emlformat=require(_0xeb40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb40('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xeb40('0x3'));var util=require(_0xeb40('0x4'));var path=require('path');var sox=require(_0xeb40('0x5'));var csv=require(_0xeb40('0x6'));var ejs=require(_0xeb40('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb40('0x8'));var squel=require(_0xeb40('0x9'));var crypto=require(_0xeb40('0xa'));var jsforce=require(_0xeb40('0xb'));var deskjs=require(_0xeb40('0xc'));var toCsv=require(_0xeb40('0x6'));var querystring=require(_0xeb40('0xd'));var Papa=require(_0xeb40('0xe'));var Redis=require(_0xeb40('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb40('0x10'));var hardwareService=require(_0xeb40('0x11'));var logger=require(_0xeb40('0x12'))(_0xeb40('0x13'));var utils=require(_0xeb40('0x14'));var config=require(_0xeb40('0x15'));var licenseUtil=require(_0xeb40('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x222e09,_0x21171c){_0x21171c=_0x21171c||0xcc;return function(_0x127b76){if(_0x127b76){return _0x222e09[_0xeb40('0x17')](_0x21171c);}return _0x222e09[_0xeb40('0x18')](_0x21171c)[_0xeb40('0x19')]();};}function respondWithResult(_0xccbff3,_0x5139e2){_0x5139e2=_0x5139e2||0xc8;return function(_0x1926fa){if(_0x1926fa){return _0xccbff3[_0xeb40('0x18')](_0x5139e2)[_0xeb40('0x1a')](_0x1926fa);}};}function respondWithFilteredResult(_0x17f2e6,_0x4e3e0c){return function(_0x50e791){if(_0x50e791){var _0xc0a619=typeof _0x4e3e0c[_0xeb40('0x1b')]===_0xeb40('0x1c')&&typeof _0x4e3e0c['limit']===_0xeb40('0x1c');var _0x334ba7=_0x50e791[_0xeb40('0x1d')];var _0x4a9e36=_0xc0a619?0x0:_0x4e3e0c['offset'];var _0x4f20a0=_0xc0a619?_0x50e791[_0xeb40('0x1d')]:_0x4e3e0c[_0xeb40('0x1b')]+_0x4e3e0c[_0xeb40('0x1e')];var _0x5d2a28;if(_0x4f20a0>=_0x334ba7){_0x4f20a0=_0x334ba7;_0x5d2a28=0xc8;}else{_0x5d2a28=0xce;}_0x17f2e6[_0xeb40('0x18')](_0x5d2a28);return _0x17f2e6[_0xeb40('0x1f')](_0xeb40('0x20'),_0x4a9e36+'-'+_0x4f20a0+'/'+_0x334ba7)[_0xeb40('0x1a')](_0x50e791);}return null;};}function patchUpdates(_0x1f55fc){return function(_0x261a2e){try{jsonpatch[_0xeb40('0x21')](_0x261a2e,_0x1f55fc,!![]);}catch(_0x32d77e){return BPromise[_0xeb40('0x22')](_0x32d77e);}return _0x261a2e[_0xeb40('0x23')]();};}function saveUpdates(_0x50c497,_0x40c37a){return function(_0x2c104b){if(_0x2c104b){return _0x2c104b[_0xeb40('0x24')](_0x50c497)[_0xeb40('0x25')](function(_0x2ab11e){return _0x2ab11e;});}return null;};}function removeEntity(_0x4ca6d6,_0x477bb6){return function(_0x187329){if(_0x187329){return _0x187329[_0xeb40('0x26')]()[_0xeb40('0x25')](function(){_0x4ca6d6[_0xeb40('0x18')](0xcc)[_0xeb40('0x19')]();});}};}function handleEntityNotFound(_0x38aa92,_0x562d5b){return function(_0x122ec4){if(!_0x122ec4){_0x38aa92[_0xeb40('0x17')](0x194);}return _0x122ec4;};}function handleError(_0x2d6f78,_0x122a27){_0x122a27=_0x122a27||0x1f4;return function(_0x52b688){logger[_0xeb40('0x27')](_0x52b688[_0xeb40('0x28')]);if(_0x52b688['name']){delete _0x52b688[_0xeb40('0x29')];}_0x2d6f78['status'](_0x122a27)[_0xeb40('0x2a')](_0x52b688);};}exports[_0xeb40('0x2b')]=function(_0x33a21e,_0x24126e){var _0x4115d6={},_0x4154b1={},_0x7f7ee3={'count':0x0,'rows':[]};var _0x285f90=_['map'](db[_0xeb40('0x2c')][_0xeb40('0x2d')],function(_0x204b0a){return{'name':_0x204b0a['fieldName'],'type':_0x204b0a[_0xeb40('0x2e')][_0xeb40('0x2f')]};});_0x4154b1[_0xeb40('0x30')]=_[_0xeb40('0x31')](_0x285f90,_0xeb40('0x29'));_0x4154b1[_0xeb40('0x32')]=_[_0xeb40('0x33')](_0x33a21e['query']);_0x4154b1[_0xeb40('0x34')]=_['intersection'](_0x4154b1[_0xeb40('0x30')],_0x4154b1[_0xeb40('0x32')]);_0x4115d6[_0xeb40('0x35')]=_['intersection'](_0x4154b1[_0xeb40('0x30')],qs[_0xeb40('0x36')](_0x33a21e[_0xeb40('0x32')][_0xeb40('0x36')]));_0x4115d6[_0xeb40('0x35')]=_0x4115d6[_0xeb40('0x35')]['length']?_0x4115d6[_0xeb40('0x35')]:_0x4154b1['model'];if(!_0x33a21e['query'][_0xeb40('0x37')](_0xeb40('0x38'))){_0x4115d6[_0xeb40('0x1e')]=qs[_0xeb40('0x1e')](_0x33a21e[_0xeb40('0x32')]['limit']);_0x4115d6[_0xeb40('0x1b')]=qs[_0xeb40('0x1b')](_0x33a21e[_0xeb40('0x32')]['offset']);}_0x4115d6[_0xeb40('0x39')]=qs[_0xeb40('0x3a')](_0x33a21e['query'][_0xeb40('0x3a')]);_0x4115d6[_0xeb40('0x3b')]=qs[_0xeb40('0x34')](_[_0xeb40('0x3c')](_0x33a21e['query'],_0x4154b1[_0xeb40('0x34')]),_0x285f90);if(_0x33a21e[_0xeb40('0x32')][_0xeb40('0x3d')]){_0x4115d6['where']=_['merge'](_0x4115d6['where'],{'$or':_['map'](_0x285f90,function(_0x33f766){if(_0x33f766[_0xeb40('0x2e')]!=='VIRTUAL'){var _0x3a1a7c={};_0x3a1a7c[_0x33f766[_0xeb40('0x29')]]={'$like':'%'+_0x33a21e[_0xeb40('0x32')][_0xeb40('0x3d')]+'%'};return _0x3a1a7c;}})});}_0x4115d6=_[_0xeb40('0x3e')]({},_0x4115d6,_0x33a21e[_0xeb40('0x3f')]);var _0x5a6e71={'where':_0x4115d6['where']};return db[_0xeb40('0x2c')][_0xeb40('0x1d')](_0x5a6e71)['then'](function(_0x11df8b){_0x7f7ee3['count']=_0x11df8b;if(_0x33a21e[_0xeb40('0x32')]['includeAll']){_0x4115d6['include']=[{'all':!![]}];}return db[_0xeb40('0x2c')][_0xeb40('0x40')](_0x4115d6);})[_0xeb40('0x25')](function(_0x29b29b){_0x7f7ee3[_0xeb40('0x41')]=_0x29b29b;return _0x7f7ee3;})['then'](respondWithFilteredResult(_0x24126e,_0x4115d6))[_0xeb40('0x42')](handleError(_0x24126e,null));};exports[_0xeb40('0x43')]=function(_0x275646,_0x2afb04){var _0x7794a4={'raw':!![],'where':{'id':_0x275646[_0xeb40('0x44')]['id']}},_0x45858f={};_0x45858f[_0xeb40('0x30')]=_[_0xeb40('0x33')](db[_0xeb40('0x2c')]['rawAttributes']);_0x45858f[_0xeb40('0x32')]=_[_0xeb40('0x33')](_0x275646[_0xeb40('0x32')]);_0x45858f[_0xeb40('0x34')]=_[_0xeb40('0x45')](_0x45858f['model'],_0x45858f[_0xeb40('0x32')]);_0x7794a4[_0xeb40('0x35')]=_[_0xeb40('0x45')](_0x45858f[_0xeb40('0x30')],qs[_0xeb40('0x36')](_0x275646[_0xeb40('0x32')]['fields']));_0x7794a4[_0xeb40('0x35')]=_0x7794a4[_0xeb40('0x35')][_0xeb40('0x46')]?_0x7794a4[_0xeb40('0x35')]:_0x45858f[_0xeb40('0x30')];if(_0x275646['query'][_0xeb40('0x47')]){_0x7794a4[_0xeb40('0x48')]=[{'all':!![]}];}_0x7794a4=_['merge']({},_0x7794a4,_0x275646[_0xeb40('0x3f')]);return db[_0xeb40('0x2c')]['find'](_0x7794a4)[_0xeb40('0x25')](handleEntityNotFound(_0x2afb04,null))[_0xeb40('0x25')](respondWithResult(_0x2afb04,null))[_0xeb40('0x42')](handleError(_0x2afb04,null));};exports[_0xeb40('0x49')]=function(_0x1f544a,_0xd4eca2){return db['ZendeskField'][_0xeb40('0x49')](_0x1f544a[_0xeb40('0x4a')],{})['then'](respondWithResult(_0xd4eca2,0xc9))[_0xeb40('0x42')](handleError(_0xd4eca2,null));};exports[_0xeb40('0x24')]=function(_0x5430c1,_0x5914cd){if(_0x5430c1['body']['id']){delete _0x5430c1[_0xeb40('0x4a')]['id'];}return db[_0xeb40('0x2c')][_0xeb40('0x4b')]({'where':{'id':_0x5430c1[_0xeb40('0x44')]['id']}})[_0xeb40('0x25')](handleEntityNotFound(_0x5914cd,null))[_0xeb40('0x25')](saveUpdates(_0x5430c1[_0xeb40('0x4a')],null))[_0xeb40('0x25')](respondWithResult(_0x5914cd,null))[_0xeb40('0x42')](handleError(_0x5914cd,null));};exports[_0xeb40('0x26')]=function(_0x52b91e,_0x5b9a13){return db['ZendeskField'][_0xeb40('0x4b')]({'where':{'id':_0x52b91e['params']['id']}})[_0xeb40('0x25')](handleEntityNotFound(_0x5b9a13,null))[_0xeb40('0x25')](removeEntity(_0x5b9a13,null))['catch'](handleError(_0x5b9a13,null));}; \ No newline at end of file +var _0x4d56=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','status','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','ZendeskField','findAll','rows','show','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4d56,0x16a));var _0x64d5=function(_0x5038f7,_0x5cdb0e){_0x5038f7=_0x5038f7-0x0;var _0x436f6f=_0x4d56[_0x5038f7];return _0x436f6f;};'use strict';var emlformat=require(_0x64d5('0x0'));var rimraf=require(_0x64d5('0x1'));var zipdir=require(_0x64d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64d5('0x3'));var moment=require(_0x64d5('0x4'));var BPromise=require(_0x64d5('0x5'));var Mustache=require(_0x64d5('0x6'));var util=require(_0x64d5('0x7'));var path=require(_0x64d5('0x8'));var sox=require('sox');var csv=require(_0x64d5('0x9'));var ejs=require(_0x64d5('0xa'));var fs=require('fs');var fs_extra=require(_0x64d5('0xb'));var _=require('lodash');var squel=require(_0x64d5('0xc'));var crypto=require(_0x64d5('0xd'));var jsforce=require(_0x64d5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x64d5('0x9'));var querystring=require(_0x64d5('0xf'));var Papa=require(_0x64d5('0x10'));var Redis=require(_0x64d5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x64d5('0x12'));var as=require(_0x64d5('0x13'));var hardwareService=require(_0x64d5('0x14'));var logger=require(_0x64d5('0x15'))(_0x64d5('0x16'));var utils=require(_0x64d5('0x17'));var config=require(_0x64d5('0x18'));var licenseUtil=require(_0x64d5('0x19'));var db=require(_0x64d5('0x1a'))['db'];function respondWithStatusCode(_0x2416b3,_0x497c89){_0x497c89=_0x497c89||0xcc;return function(_0x290e5c){if(_0x290e5c){return _0x2416b3[_0x64d5('0x1b')](_0x497c89);}return _0x2416b3['status'](_0x497c89)[_0x64d5('0x1c')]();};}function respondWithResult(_0x5e3975,_0x480ee6){_0x480ee6=_0x480ee6||0xc8;return function(_0x3d1286){if(_0x3d1286){return _0x5e3975['status'](_0x480ee6)[_0x64d5('0x1d')](_0x3d1286);}};}function respondWithFilteredResult(_0x2777c5,_0x12a8be){return function(_0x5e642f){if(_0x5e642f){var _0x31c9ba=typeof _0x12a8be[_0x64d5('0x1e')]===_0x64d5('0x1f')&&typeof _0x12a8be['limit']==='undefined';var _0x2f4f8c=_0x5e642f[_0x64d5('0x20')];var _0x1aeb8b=_0x31c9ba?0x0:_0x12a8be[_0x64d5('0x1e')];var _0xa42b3a=_0x31c9ba?_0x5e642f[_0x64d5('0x20')]:_0x12a8be['offset']+_0x12a8be['limit'];var _0x2084c3;if(_0xa42b3a>=_0x2f4f8c){_0xa42b3a=_0x2f4f8c;_0x2084c3=0xc8;}else{_0x2084c3=0xce;}_0x2777c5['status'](_0x2084c3);return _0x2777c5[_0x64d5('0x21')](_0x64d5('0x22'),_0x1aeb8b+'-'+_0xa42b3a+'/'+_0x2f4f8c)[_0x64d5('0x1d')](_0x5e642f);}return null;};}function patchUpdates(_0x4477f7){return function(_0x190bf1){try{jsonpatch[_0x64d5('0x23')](_0x190bf1,_0x4477f7,!![]);}catch(_0x4961cc){return BPromise['reject'](_0x4961cc);}return _0x190bf1['save']();};}function saveUpdates(_0x58a98d,_0x18eb5b){return function(_0x1480b2){if(_0x1480b2){return _0x1480b2[_0x64d5('0x24')](_0x58a98d)[_0x64d5('0x25')](function(_0x30dcf7){return _0x30dcf7;});}return null;};}function removeEntity(_0xf93d8c,_0x1d9050){return function(_0x1444ec){if(_0x1444ec){return _0x1444ec[_0x64d5('0x26')]()[_0x64d5('0x25')](function(){_0xf93d8c[_0x64d5('0x27')](0xcc)[_0x64d5('0x1c')]();});}};}function handleEntityNotFound(_0x57f8ee,_0x312cf3){return function(_0x4f8466){if(!_0x4f8466){_0x57f8ee[_0x64d5('0x1b')](0x194);}return _0x4f8466;};}function handleError(_0x2fb4b9,_0x23d681){_0x23d681=_0x23d681||0x1f4;return function(_0x462cfc){logger[_0x64d5('0x28')](_0x462cfc[_0x64d5('0x29')]);if(_0x462cfc[_0x64d5('0x2a')]){delete _0x462cfc[_0x64d5('0x2a')];}_0x2fb4b9[_0x64d5('0x27')](_0x23d681)['send'](_0x462cfc);};}exports['index']=function(_0x389532,_0x2f6478){var _0x3ec062={},_0x1f186e={},_0x63cbcf={'count':0x0,'rows':[]};var _0x278d6e=_['map'](db['ZendeskField'][_0x64d5('0x2b')],function(_0x30a851){return{'name':_0x30a851[_0x64d5('0x2c')],'type':_0x30a851[_0x64d5('0x2d')][_0x64d5('0x2e')]};});_0x1f186e[_0x64d5('0x2f')]=_[_0x64d5('0x30')](_0x278d6e,_0x64d5('0x2a'));_0x1f186e[_0x64d5('0x31')]=_[_0x64d5('0x32')](_0x389532[_0x64d5('0x31')]);_0x1f186e[_0x64d5('0x33')]=_[_0x64d5('0x34')](_0x1f186e['model'],_0x1f186e['query']);_0x3ec062[_0x64d5('0x35')]=_['intersection'](_0x1f186e['model'],qs[_0x64d5('0x36')](_0x389532['query'][_0x64d5('0x36')]));_0x3ec062[_0x64d5('0x35')]=_0x3ec062[_0x64d5('0x35')][_0x64d5('0x37')]?_0x3ec062[_0x64d5('0x35')]:_0x1f186e['model'];if(!_0x389532[_0x64d5('0x31')][_0x64d5('0x38')](_0x64d5('0x39'))){_0x3ec062[_0x64d5('0x3a')]=qs[_0x64d5('0x3a')](_0x389532['query'][_0x64d5('0x3a')]);_0x3ec062[_0x64d5('0x1e')]=qs[_0x64d5('0x1e')](_0x389532[_0x64d5('0x31')][_0x64d5('0x1e')]);}_0x3ec062[_0x64d5('0x3b')]=qs[_0x64d5('0x3c')](_0x389532[_0x64d5('0x31')][_0x64d5('0x3c')]);_0x3ec062[_0x64d5('0x3d')]=qs['filters'](_[_0x64d5('0x3e')](_0x389532[_0x64d5('0x31')],_0x1f186e['filters']),_0x278d6e);if(_0x389532['query'][_0x64d5('0x3f')]){_0x3ec062['where']=_[_0x64d5('0x40')](_0x3ec062[_0x64d5('0x3d')],{'$or':_['map'](_0x278d6e,function(_0x50de07){if(_0x50de07[_0x64d5('0x2d')]!==_0x64d5('0x41')){var _0xca4950={};_0xca4950[_0x50de07['name']]={'$like':'%'+_0x389532[_0x64d5('0x31')][_0x64d5('0x3f')]+'%'};return _0xca4950;}})});}_0x3ec062=_[_0x64d5('0x40')]({},_0x3ec062,_0x389532['options']);var _0x35a8ae={'where':_0x3ec062[_0x64d5('0x3d')]};return db['ZendeskField'][_0x64d5('0x20')](_0x35a8ae)[_0x64d5('0x25')](function(_0x339504){_0x63cbcf[_0x64d5('0x20')]=_0x339504;if(_0x389532[_0x64d5('0x31')][_0x64d5('0x42')]){_0x3ec062['include']=[{'all':!![]}];}return db[_0x64d5('0x43')][_0x64d5('0x44')](_0x3ec062);})[_0x64d5('0x25')](function(_0xfec161){_0x63cbcf[_0x64d5('0x45')]=_0xfec161;return _0x63cbcf;})[_0x64d5('0x25')](respondWithFilteredResult(_0x2f6478,_0x3ec062))['catch'](handleError(_0x2f6478,null));};exports[_0x64d5('0x46')]=function(_0x5bfa16,_0x2c2d52){var _0x3d7e48={'raw':!![],'where':{'id':_0x5bfa16['params']['id']}},_0x233a54={};_0x233a54[_0x64d5('0x2f')]=_[_0x64d5('0x32')](db[_0x64d5('0x43')][_0x64d5('0x2b')]);_0x233a54[_0x64d5('0x31')]=_[_0x64d5('0x32')](_0x5bfa16[_0x64d5('0x31')]);_0x233a54[_0x64d5('0x33')]=_['intersection'](_0x233a54[_0x64d5('0x2f')],_0x233a54[_0x64d5('0x31')]);_0x3d7e48[_0x64d5('0x35')]=_[_0x64d5('0x34')](_0x233a54[_0x64d5('0x2f')],qs['fields'](_0x5bfa16[_0x64d5('0x31')][_0x64d5('0x36')]));_0x3d7e48[_0x64d5('0x35')]=_0x3d7e48[_0x64d5('0x35')][_0x64d5('0x37')]?_0x3d7e48[_0x64d5('0x35')]:_0x233a54[_0x64d5('0x2f')];if(_0x5bfa16[_0x64d5('0x31')][_0x64d5('0x42')]){_0x3d7e48['include']=[{'all':!![]}];}_0x3d7e48=_[_0x64d5('0x40')]({},_0x3d7e48,_0x5bfa16[_0x64d5('0x47')]);return db[_0x64d5('0x43')][_0x64d5('0x48')](_0x3d7e48)[_0x64d5('0x25')](handleEntityNotFound(_0x2c2d52,null))[_0x64d5('0x25')](respondWithResult(_0x2c2d52,null))[_0x64d5('0x49')](handleError(_0x2c2d52,null));};exports[_0x64d5('0x4a')]=function(_0x1f19f1,_0x2be82b){return db[_0x64d5('0x43')][_0x64d5('0x4a')](_0x1f19f1[_0x64d5('0x4b')],{})['then'](respondWithResult(_0x2be82b,0xc9))[_0x64d5('0x49')](handleError(_0x2be82b,null));};exports[_0x64d5('0x24')]=function(_0x2f0732,_0x36703d){if(_0x2f0732['body']['id']){delete _0x2f0732['body']['id'];}return db['ZendeskField'][_0x64d5('0x48')]({'where':{'id':_0x2f0732[_0x64d5('0x4c')]['id']}})[_0x64d5('0x25')](handleEntityNotFound(_0x36703d,null))[_0x64d5('0x25')](saveUpdates(_0x2f0732[_0x64d5('0x4b')],null))[_0x64d5('0x25')](respondWithResult(_0x36703d,null))[_0x64d5('0x49')](handleError(_0x36703d,null));};exports[_0x64d5('0x26')]=function(_0x9af4ee,_0x29a199){return db['ZendeskField'][_0x64d5('0x48')]({'where':{'id':_0x9af4ee[_0x64d5('0x4c')]['id']}})[_0x64d5('0x25')](handleEntityNotFound(_0x29a199,null))[_0x64d5('0x25')](removeEntity(_0x29a199,null))[_0x64d5('0x49')](handleError(_0x29a199,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c7ca151..1987b5f 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 _0xa8ef=['api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x23e2bb,_0xd82b6d){var _0x2dd8ed=function(_0x4af0ce){while(--_0x4af0ce){_0x23e2bb['push'](_0x23e2bb['shift']());}};_0x2dd8ed(++_0xd82b6d);}(_0xa8ef,0x10b));var _0xfa8e=function(_0x404ae1,_0x412917){_0x404ae1=_0x404ae1-0x0;var _0x270694=_0xa8ef[_0x404ae1];return _0x270694;};'use strict';var _=require(_0xfa8e('0x0'));var util=require(_0xfa8e('0x1'));var logger=require(_0xfa8e('0x2'))(_0xfa8e('0x3'));var moment=require('moment');var BPromise=require(_0xfa8e('0x4'));var rp=require(_0xfa8e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa8e('0x6'));var config=require(_0xfa8e('0x7'));var attributes=require(_0xfa8e('0x8'));module[_0xfa8e('0x9')]=function(_0x5e7f5d,_0x582635){return _0x5e7f5d[_0xfa8e('0xa')](_0xfa8e('0xb'),attributes,{'tableName':_0xfa8e('0xc'),'paranoid':![],'indexes':[{'name':_0xfa8e('0xd'),'fields':['idField',_0xfa8e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8540=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x36340b,_0x3a7b5c){var _0x4fc9f6=function(_0x373992){while(--_0x373992){_0x36340b['push'](_0x36340b['shift']());}};_0x4fc9f6(++_0x3a7b5c);}(_0x8540,0x1da));var _0x0854=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x8540[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require(_0x0854('0x0'));var util=require(_0x0854('0x1'));var logger=require(_0x0854('0x2'))('api');var moment=require(_0x0854('0x3'));var BPromise=require(_0x0854('0x4'));var rp=require(_0x0854('0x5'));var fs=require('fs');var path=require(_0x0854('0x6'));var rimraf=require(_0x0854('0x7'));var config=require(_0x0854('0x8'));var attributes=require(_0x0854('0x9'));module[_0x0854('0xa')]=function(_0x2d91d8,_0x490846){return _0x2d91d8[_0x0854('0xb')](_0x0854('0xc'),attributes,{'tableName':_0x0854('0xd'),'paranoid':![],'indexes':[{'name':_0x0854('0xe'),'fields':[_0x0854('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 2822dc3..3e64986 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 _0xf373=['message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xf373,0xbd));var _0x3f37=function(_0x4bbbb3,_0x454add){_0x4bbbb3=_0x4bbbb3-0x0;var _0x28bacb=_0xf373[_0x4bbbb3];return _0x28bacb;};'use strict';var _=require('lodash');var util=require(_0x3f37('0x0'));var moment=require(_0x3f37('0x1'));var BPromise=require(_0x3f37('0x2'));var rs=require(_0x3f37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f37('0x4'))['db'];var utils=require(_0x3f37('0x5'));var logger=require('../../config/logger')(_0x3f37('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f37('0x7')][_0x3f37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5998fc,_0x59b888,_0x1379f5){return new BPromise(function(_0xebc578,_0x23b1ea){return client[_0x3f37('0x9')](_0x5998fc,_0x1379f5)[_0x3f37('0xa')](function(_0x3e3bac){logger['info'](_0x3f37('0xb'),_0x59b888,_0x3f37('0xc'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x59b888,_0x3f37('0xc'),JSON[_0x3f37('0xd')](_0x3e3bac));if(_0x3e3bac[_0x3f37('0xe')]){if(_0x3e3bac[_0x3f37('0xe')]['code']===0x1f4){logger[_0x3f37('0xe')]('ZendeskField,\x20%s,\x20%s',_0x59b888,_0x3e3bac['error'][_0x3f37('0xf')]);return _0x23b1ea(_0x3e3bac[_0x3f37('0xe')]['message']);}logger[_0x3f37('0xe')](_0x3f37('0xb'),_0x59b888,_0x3e3bac[_0x3f37('0xe')]['message']);return _0xebc578(_0x3e3bac[_0x3f37('0xe')][_0x3f37('0xf')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x59b888,_0x3f37('0xc'));_0xebc578(_0x3e3bac['result']['message']);}})[_0x3f37('0x10')](function(_0x25f2eb){logger['error'](_0x3f37('0xb'),_0x59b888,_0x25f2eb);_0x23b1ea(_0x25f2eb);});});} \ No newline at end of file +var _0x819c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0xc37c8,_0x182df1){var _0x77188f=function(_0xfbdddc){while(--_0xfbdddc){_0xc37c8['push'](_0xc37c8['shift']());}};_0x77188f(++_0x182df1);}(_0x819c,0x1db));var _0xc819=function(_0x49af49,_0x56494b){_0x49af49=_0x49af49-0x0;var _0x57fb76=_0x819c[_0x49af49];return _0x57fb76;};'use strict';var _=require(_0xc819('0x0'));var util=require('util');var moment=require(_0xc819('0x1'));var BPromise=require(_0xc819('0x2'));var rs=require(_0xc819('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc819('0x4'))['db'];var utils=require(_0xc819('0x5'));var logger=require(_0xc819('0x6'))('rpc');var config=require(_0xc819('0x7'));var jayson=require(_0xc819('0x8'));var client=jayson[_0xc819('0x9')][_0xc819('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b0918,_0x1d3d59,_0x4f350d){return new BPromise(function(_0x392209,_0x2e97b8){return client[_0xc819('0xb')](_0x1b0918,_0x4f350d)[_0xc819('0xc')](function(_0x421b54){logger[_0xc819('0xd')](_0xc819('0xe'),_0x1d3d59,_0xc819('0xf'));logger[_0xc819('0x10')](_0xc819('0x11'),_0x1d3d59,'request\x20sent',JSON[_0xc819('0x12')](_0x421b54));if(_0x421b54[_0xc819('0x13')]){if(_0x421b54[_0xc819('0x13')][_0xc819('0x14')]===0x1f4){logger[_0xc819('0x13')]('ZendeskField,\x20%s,\x20%s',_0x1d3d59,_0x421b54[_0xc819('0x13')]['message']);return _0x2e97b8(_0x421b54[_0xc819('0x13')][_0xc819('0x15')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x1d3d59,_0x421b54['error'][_0xc819('0x15')]);return _0x392209(_0x421b54[_0xc819('0x13')]['message']);}else{logger[_0xc819('0xd')]('ZendeskField,\x20%s,\x20%s',_0x1d3d59,_0xc819('0xf'));_0x392209(_0x421b54[_0xc819('0x16')][_0xc819('0x15')]);}})[_0xc819('0x17')](function(_0x2c9ca3){logger[_0xc819('0x13')](_0xc819('0xe'),_0x1d3d59,_0x2c9ca3);_0x2e97b8(_0x2c9ca3);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index db4732c..3eaa36e 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 _0x452e=['/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','/:id','isAuthenticated','show'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x452e,0x1bc));var _0xe452=function(_0x44945c,_0x581341){_0x44945c=_0x44945c-0x0;var _0x23b333=_0x452e[_0x44945c];return _0x23b333;};'use strict';var multer=require(_0xe452('0x0'));var util=require(_0xe452('0x1'));var path=require(_0xe452('0x2'));var timeout=require(_0xe452('0x3'));var express=require(_0xe452('0x4'));var router=express[_0xe452('0x5')]();var fs_extra=require(_0xe452('0x6'));var auth=require(_0xe452('0x7'));var interaction=require(_0xe452('0x8'));var config=require(_0xe452('0x9'));var controller=require(_0xe452('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xe452('0xb')]);router[_0xe452('0xc')](_0xe452('0xd'),auth[_0xe452('0xe')](),controller[_0xe452('0xf')]);router[_0xe452('0xc')](_0xe452('0x10'),auth['isAuthenticated'](),controller[_0xe452('0x11')]);router[_0xe452('0xc')]('/:id/fields',auth[_0xe452('0xe')](),controller[_0xe452('0x12')]);router[_0xe452('0x13')]('/',auth[_0xe452('0xe')](),controller[_0xe452('0x14')]);router[_0xe452('0x13')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe452('0x15')]);router['put'](_0xe452('0xd'),auth[_0xe452('0xe')](),controller['update']);router['delete'](_0xe452('0xd'),auth[_0xe452('0xe')](),controller[_0xe452('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5fb2=['isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x5fb2,0xad));var _0x25fb=function(_0x25487d,_0x2235a4){_0x25487d=_0x25487d-0x0;var _0x581ee4=_0x5fb2[_0x25487d];return _0x581ee4;};'use strict';var multer=require(_0x25fb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x25fb('0x1'));var router=express[_0x25fb('0x2')]();var fs_extra=require(_0x25fb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x25fb('0x4'));var config=require(_0x25fb('0x5'));var controller=require(_0x25fb('0x6'));router['get']('/',auth[_0x25fb('0x7')](),controller[_0x25fb('0x8')]);router[_0x25fb('0x9')](_0x25fb('0xa'),auth[_0x25fb('0x7')](),controller['show']);router[_0x25fb('0x9')](_0x25fb('0xb'),auth[_0x25fb('0x7')](),controller[_0x25fb('0xc')]);router[_0x25fb('0x9')](_0x25fb('0xd'),auth[_0x25fb('0x7')](),controller['getFields']);router[_0x25fb('0xe')]('/',auth[_0x25fb('0x7')](),controller['create']);router['post'](_0x25fb('0xb'),auth[_0x25fb('0x7')](),controller[_0x25fb('0xf')]);router[_0x25fb('0x10')](_0x25fb('0xa'),auth[_0x25fb('0x7')](),controller[_0x25fb('0x11')]);router[_0x25fb('0x12')](_0x25fb('0xa'),auth[_0x25fb('0x7')](),controller['destroy']);module[_0x25fb('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 6e19e0a..e351ffc 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 _0x0a9a=['STRING','exports'];(function(_0x2aa3cf,_0xa10585){var _0x2bb607=function(_0x532399){while(--_0x532399){_0x2aa3cf['push'](_0x2aa3cf['shift']());}};_0x2bb607(++_0xa10585);}(_0x0a9a,0x183));var _0xa0a9=function(_0x32bae7,_0x5ac6a2){_0x32bae7=_0x32bae7-0x0;var _0x15afe6=_0x0a9a[_0x32bae7];return _0x15afe6;};'use strict';var Sequelize=require('sequelize');module[_0xa0a9('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa0a9('0x1')]},'host':{'type':Sequelize[_0xa0a9('0x1')]},'zone':{'type':Sequelize[_0xa0a9('0x1')]},'clientId':{'type':Sequelize[_0xa0a9('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa0a9('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xa0a9('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','STRING'];(function(_0x772b80,_0x39b2be){var _0x30b292=function(_0x599382){while(--_0x599382){_0x772b80['push'](_0x772b80['shift']());}};_0x30b292(++_0x39b2be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a183c58..3856f02 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 _0x0326=['undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','name','send','index','map','ZohoAccount','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','rawAttributes','find','catch','create','body','destroy','getConfigurations','findOne','order','nolimit','Subjects','type','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','code','host','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x0326,0xe1));var _0x6032=function(_0x1f1c17,_0x4ed89e){_0x1f1c17=_0x1f1c17-0x0;var _0x59109b=_0x0326[_0x1f1c17];return _0x59109b;};'use strict';var emlformat=require(_0x6032('0x0'));var rimraf=require(_0x6032('0x1'));var zipdir=require(_0x6032('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6032('0x3'));var moment=require(_0x6032('0x4'));var BPromise=require(_0x6032('0x5'));var Mustache=require(_0x6032('0x6'));var util=require(_0x6032('0x7'));var path=require(_0x6032('0x8'));var sox=require(_0x6032('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6032('0xa'));var _=require('lodash');var squel=require(_0x6032('0xb'));var crypto=require(_0x6032('0xc'));var jsforce=require(_0x6032('0xd'));var deskjs=require(_0x6032('0xe'));var toCsv=require(_0x6032('0xf'));var querystring=require(_0x6032('0x10'));var Papa=require(_0x6032('0x11'));var Redis=require(_0x6032('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6032('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6032('0x14'));var logger=require(_0x6032('0x15'))(_0x6032('0x16'));var utils=require(_0x6032('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6032('0x18'));var db=require(_0x6032('0x19'))['db'];var integrations=require(_0x6032('0x1a'));function respondWithStatusCode(_0x366b6d,_0x217de0){_0x217de0=_0x217de0||0xcc;return function(_0x556a48){if(_0x556a48){return _0x366b6d[_0x6032('0x1b')](_0x217de0);}return _0x366b6d[_0x6032('0x1c')](_0x217de0)[_0x6032('0x1d')]();};}function respondWithResult(_0x51e00c,_0x402427){_0x402427=_0x402427||0xc8;return function(_0x344024){if(_0x344024){return _0x51e00c[_0x6032('0x1c')](_0x402427)['json'](_0x344024);}};}function respondWithFilteredResult(_0x4d2145,_0x579066){return function(_0x4609ab){if(_0x4609ab){var _0x361e3c=typeof _0x579066[_0x6032('0x1e')]===_0x6032('0x1f')&&typeof _0x579066[_0x6032('0x20')]==='undefined';var _0x2b6c57=_0x4609ab[_0x6032('0x21')];var _0xa4f4d6=_0x361e3c?0x0:_0x579066[_0x6032('0x1e')];var _0x43a0ac=_0x361e3c?_0x4609ab[_0x6032('0x21')]:_0x579066[_0x6032('0x1e')]+_0x579066['limit'];var _0x880a6f;if(_0x43a0ac>=_0x2b6c57){_0x43a0ac=_0x2b6c57;_0x880a6f=0xc8;}else{_0x880a6f=0xce;}_0x4d2145[_0x6032('0x1c')](_0x880a6f);return _0x4d2145[_0x6032('0x22')](_0x6032('0x23'),_0xa4f4d6+'-'+_0x43a0ac+'/'+_0x2b6c57)[_0x6032('0x24')](_0x4609ab);}return null;};}function patchUpdates(_0x10e589){return function(_0x5bf370){try{jsonpatch['apply'](_0x5bf370,_0x10e589,!![]);}catch(_0x1018b6){return BPromise[_0x6032('0x25')](_0x1018b6);}return _0x5bf370[_0x6032('0x26')]();};}function saveUpdates(_0x2f9f64,_0xa67daa){return function(_0x4b2591){if(_0x4b2591){return _0x4b2591[_0x6032('0x27')](_0x2f9f64)[_0x6032('0x28')](function(_0x3e0993){return _0x3e0993;});}return null;};}function removeEntity(_0x55c33d,_0x57630e){return function(_0x403421){if(_0x403421){return _0x403421['destroy']()[_0x6032('0x28')](function(){_0x55c33d[_0x6032('0x1c')](0xcc)[_0x6032('0x1d')]();});}};}function handleEntityNotFound(_0x5b4de1,_0x593f80){return function(_0x26d357){if(!_0x26d357){_0x5b4de1[_0x6032('0x1b')](0x194);}return _0x26d357;};}function handleError(_0x468f02,_0x1aa872){_0x1aa872=_0x1aa872||0x1f4;return function(_0x4ed1e1){logger[_0x6032('0x29')](_0x4ed1e1['stack']);if(_0x4ed1e1[_0x6032('0x2a')]){delete _0x4ed1e1['name'];}_0x468f02[_0x6032('0x1c')](_0x1aa872)[_0x6032('0x2b')](_0x4ed1e1);};}exports[_0x6032('0x2c')]=function(_0x304887,_0x59e3c9){var _0x1fac8b={},_0x32bdb6={},_0x2a390e={'count':0x0,'rows':[]};var _0x14ba68=_[_0x6032('0x2d')](db[_0x6032('0x2e')]['rawAttributes'],function(_0x4ae3da){return{'name':_0x4ae3da[_0x6032('0x2f')],'type':_0x4ae3da['type']['key']};});_0x32bdb6[_0x6032('0x30')]=_['map'](_0x14ba68,'name');_0x32bdb6[_0x6032('0x31')]=_[_0x6032('0x32')](_0x304887[_0x6032('0x31')]);_0x32bdb6[_0x6032('0x33')]=_['intersection'](_0x32bdb6['model'],_0x32bdb6[_0x6032('0x31')]);_0x1fac8b[_0x6032('0x34')]=_[_0x6032('0x35')](_0x32bdb6[_0x6032('0x30')],qs[_0x6032('0x36')](_0x304887[_0x6032('0x31')][_0x6032('0x36')]));_0x1fac8b['attributes']=_0x1fac8b[_0x6032('0x34')][_0x6032('0x37')]?_0x1fac8b['attributes']:_0x32bdb6[_0x6032('0x30')];if(!_0x304887[_0x6032('0x31')][_0x6032('0x38')]('nolimit')){_0x1fac8b['limit']=qs[_0x6032('0x20')](_0x304887[_0x6032('0x31')][_0x6032('0x20')]);_0x1fac8b[_0x6032('0x1e')]=qs[_0x6032('0x1e')](_0x304887[_0x6032('0x31')]['offset']);}_0x1fac8b['order']=qs[_0x6032('0x39')](_0x304887[_0x6032('0x31')][_0x6032('0x39')]);_0x1fac8b[_0x6032('0x3a')]=qs[_0x6032('0x33')](_[_0x6032('0x3b')](_0x304887['query'],_0x32bdb6[_0x6032('0x33')]),_0x14ba68);if(_0x304887['query'][_0x6032('0x3c')]){_0x1fac8b['where']=_[_0x6032('0x3d')](_0x1fac8b['where'],{'$or':_[_0x6032('0x2d')](_0x14ba68,function(_0x4128e6){if(_0x4128e6['type']!=='VIRTUAL'){var _0x5e1fd9={};_0x5e1fd9[_0x4128e6['name']]={'$like':'%'+_0x304887[_0x6032('0x31')][_0x6032('0x3c')]+'%'};return _0x5e1fd9;}})});}_0x1fac8b=_[_0x6032('0x3d')]({},_0x1fac8b,_0x304887[_0x6032('0x3e')]);var _0x3c1b09={'where':_0x1fac8b[_0x6032('0x3a')]};return db['ZohoAccount'][_0x6032('0x21')](_0x3c1b09)[_0x6032('0x28')](function(_0x9a4dd2){_0x2a390e['count']=_0x9a4dd2;if(_0x304887['query'][_0x6032('0x3f')]){_0x1fac8b['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x6032('0x40')](_0x1fac8b);})[_0x6032('0x28')](function(_0x4f15a3){_0x2a390e[_0x6032('0x41')]=_0x4f15a3;return _0x2a390e;})[_0x6032('0x28')](respondWithFilteredResult(_0x59e3c9,_0x1fac8b))['catch'](handleError(_0x59e3c9,null));};exports['show']=function(_0x540f7c,_0x9d1917){var _0x512509={'raw':![],'where':{'id':_0x540f7c[_0x6032('0x42')]['id']}},_0x47a45d={};_0x47a45d[_0x6032('0x30')]=_[_0x6032('0x32')](db[_0x6032('0x2e')][_0x6032('0x43')]);_0x47a45d['query']=_['keys'](_0x540f7c[_0x6032('0x31')]);_0x47a45d[_0x6032('0x33')]=_[_0x6032('0x35')](_0x47a45d[_0x6032('0x30')],_0x47a45d[_0x6032('0x31')]);_0x512509['attributes']=_[_0x6032('0x35')](_0x47a45d[_0x6032('0x30')],qs['fields'](_0x540f7c[_0x6032('0x31')]['fields']));_0x512509['attributes']=_0x512509[_0x6032('0x34')][_0x6032('0x37')]?_0x512509['attributes']:_0x47a45d['model'];if(_0x540f7c[_0x6032('0x31')][_0x6032('0x3f')]){_0x512509['include']=[{'all':!![]}];}_0x512509=_['merge']({},_0x512509,_0x540f7c['options']);return db[_0x6032('0x2e')][_0x6032('0x44')](_0x512509)[_0x6032('0x28')](handleEntityNotFound(_0x9d1917,null))[_0x6032('0x28')](respondWithResult(_0x9d1917,null))[_0x6032('0x45')](handleError(_0x9d1917,null));};exports['create']=function(_0x3a79cb,_0x193c23){return db[_0x6032('0x2e')][_0x6032('0x46')](_0x3a79cb[_0x6032('0x47')],{})['then'](respondWithResult(_0x193c23,0xc9))[_0x6032('0x45')](handleError(_0x193c23,null));};exports['update']=function(_0x2803fe,_0x420815){if(_0x2803fe[_0x6032('0x47')]['id']){delete _0x2803fe[_0x6032('0x47')]['id'];}return db[_0x6032('0x2e')]['find']({'where':{'id':_0x2803fe[_0x6032('0x42')]['id']}})[_0x6032('0x28')](handleEntityNotFound(_0x420815,null))[_0x6032('0x28')](saveUpdates(_0x2803fe[_0x6032('0x47')],null))[_0x6032('0x28')](respondWithResult(_0x420815,null))['catch'](handleError(_0x420815,null));};exports[_0x6032('0x48')]=function(_0x2b581e,_0x49c589){return db[_0x6032('0x2e')][_0x6032('0x44')]({'where':{'id':_0x2b581e[_0x6032('0x42')]['id']}})[_0x6032('0x28')](handleEntityNotFound(_0x49c589,null))['then'](removeEntity(_0x49c589,null))[_0x6032('0x45')](handleError(_0x49c589,null));};exports[_0x6032('0x49')]=function(_0x536be6,_0x3f9017,_0x8b584e){var _0x36842d={};var _0x103a9c={};var _0x420791;var _0x52d72e;return db[_0x6032('0x2e')][_0x6032('0x4a')]({'where':{'id':_0x536be6[_0x6032('0x42')]['id']}})[_0x6032('0x28')](handleEntityNotFound(_0x3f9017,null))[_0x6032('0x28')](function(_0x188dd0){if(_0x188dd0){_0x420791=_0x188dd0;_0x103a9c[_0x6032('0x30')]=_[_0x6032('0x32')](db['ZohoConfiguration'][_0x6032('0x43')]);_0x103a9c[_0x6032('0x31')]=_[_0x6032('0x32')](_0x536be6[_0x6032('0x31')]);_0x103a9c['filters']=_[_0x6032('0x35')](_0x103a9c['model'],_0x103a9c['query']);_0x36842d[_0x6032('0x34')]=_['intersection'](_0x103a9c[_0x6032('0x30')],qs[_0x6032('0x36')](_0x536be6[_0x6032('0x31')][_0x6032('0x36')]));_0x36842d[_0x6032('0x34')]=_0x36842d['attributes'][_0x6032('0x37')]?_0x36842d[_0x6032('0x34')]:_0x103a9c[_0x6032('0x30')];_0x36842d[_0x6032('0x4b')]=qs[_0x6032('0x39')](_0x536be6[_0x6032('0x31')][_0x6032('0x39')]);_0x36842d[_0x6032('0x3a')]=qs[_0x6032('0x33')](_[_0x6032('0x3b')](_0x536be6['query'],_0x103a9c[_0x6032('0x33')]));if(_0x536be6['query']['filter']){_0x36842d[_0x6032('0x3a')]=_[_0x6032('0x3d')](_0x36842d[_0x6032('0x3a')],{'$or':_['map'](_0x36842d[_0x6032('0x34')],function(_0x2512f1){var _0x5e24e8={};_0x5e24e8[_0x2512f1]={'$like':'%'+_0x536be6[_0x6032('0x31')]['filter']+'%'};return _0x5e24e8;})});}_0x36842d=_[_0x6032('0x3d')]({},_0x36842d,_0x536be6['options']);return _0x420791[_0x6032('0x49')](_0x36842d);}})[_0x6032('0x28')](function(_0x5f5cdf){if(_0x5f5cdf){_0x52d72e=_0x5f5cdf[_0x6032('0x37')];if(!_0x536be6[_0x6032('0x31')][_0x6032('0x38')](_0x6032('0x4c'))){_0x36842d['limit']=qs[_0x6032('0x20')](_0x536be6[_0x6032('0x31')][_0x6032('0x20')]);_0x36842d['offset']=qs[_0x6032('0x1e')](_0x536be6['query'][_0x6032('0x1e')]);}return _0x420791[_0x6032('0x49')](_0x36842d);}})[_0x6032('0x28')](function(_0x546f5c){if(_0x546f5c){return _0x546f5c?{'count':_0x52d72e,'rows':_0x546f5c}:null;}})[_0x6032('0x28')](respondWithResult(_0x3f9017,null))[_0x6032('0x45')](handleError(_0x3f9017,null));};exports['addConfiguration']=function(_0xecacac,_0x1b4664,_0x1d3b94){if(_0xecacac[_0x6032('0x47')]['id']){delete _0xecacac['body']['id'];}return db[_0x6032('0x2e')][_0x6032('0x4a')]({'where':{'id':_0xecacac[_0x6032('0x42')]['id']}})[_0x6032('0x28')](handleEntityNotFound(_0x1b4664,null))['then'](function(_0x5d6934){if(_0x5d6934){_0xecacac[_0x6032('0x47')]['AccountId']=_0x5d6934['id'];_0xecacac[_0x6032('0x47')][_0x6032('0x4d')]=integrations['getSubjects'](_0xecacac[_0x6032('0x47')]['channel'],_0xecacac['body'][_0x6032('0x4e')]);_0xecacac['body'][_0x6032('0x4f')]=integrations[_0x6032('0x50')](_0xecacac[_0x6032('0x47')][_0x6032('0x51')],_0xecacac['body'][_0x6032('0x4e')]);return db['ZohoConfiguration'][_0x6032('0x46')](_0xecacac[_0x6032('0x47')],{'include':[{'model':db[_0x6032('0x52')],'as':_0x6032('0x4d')},{'model':db[_0x6032('0x52')],'as':_0x6032('0x4f')}]});}return null;})[_0x6032('0x28')](respondWithResult(_0x1b4664,null))['catch'](handleError(_0x1b4664,null));};function getAccessToken(_0x54b2bd){return new Promise(function(_0x2818c8,_0x21bff7){var _0x591274;switch(_0x54b2bd[_0x6032('0x53')]){case'US':_0x591274=_0x6032('0x54');break;case'AU':_0x591274=_0x6032('0x55');break;case'EU':_0x591274='https://accounts.zoho.eu';break;case'IN':_0x591274='https://accounts.zoho.in';break;case'CN':_0x591274=_0x6032('0x56');break;default:_0x591274=_0x6032('0x57');break;}var _0x4a74b8={'method':_0x6032('0x58'),'uri':_0x591274+'/oauth/v2/token','qs':{'refresh_token':_0x54b2bd[_0x6032('0x59')],'client_id':_0x54b2bd[_0x6032('0x5a')],'client_secret':_0x54b2bd[_0x6032('0x5b')],'grant_type':_0x6032('0x5c')},'json':!![]};return rp(_0x4a74b8)[_0x6032('0x28')](function(_0x256823){if(_0x256823[_0x6032('0x5d')]){_0x2818c8(_0x256823[_0x6032('0x5d')]);}else{_0x21bff7('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x6032('0x45')](function(_0x426aba){_0x21bff7(_0x426aba);});});}exports[_0x6032('0x5e')]=function(_0x5570b3,_0x2b0169,_0x2a8378){var _0x12b502,_0x18b4c0,_0x409bc9,_0x14b5f0,_0x4fa84a;return db['ZohoAccount']['findOne']({'where':{'id':_0x5570b3[_0x6032('0x42')]['id']},'attributes':['id','host',_0x6032('0x53'),_0x6032('0x5a'),_0x6032('0x5b'),_0x6032('0x5f'),_0x6032('0x60'),'refreshToken']})[_0x6032('0x28')](handleEntityNotFound(_0x2b0169,null))['then'](function(_0x2b8910){_0x4fa84a=_0x2b8910;_0x12b502=_0x4fa84a[_0x6032('0x61')];_0x18b4c0=_0x12b502===_0x6032('0x62')?'eu':'com';_0x409bc9=_0x4fa84a['serverUrl'];var _0x3bb71a=_0x409bc9[_0x6032('0x63')](-0x1);if(_0x3bb71a==='/'||_0x3bb71a==='\x5c'||_0x3bb71a===':'){_0x409bc9=_0x409bc9[_0x6032('0x64')](0x0,_0x409bc9[_0x6032('0x65')](_0x3bb71a));}if(!_0x4fa84a[_0x6032('0x59')]){throw new Error(_0x6032('0x66'));}return getAccessToken(_0x4fa84a);})[_0x6032('0x28')](function(_0x1fbc28){if(_0x1fbc28){return rp({'method':_0x6032('0x67'),'uri':util[_0x6032('0x68')](_0x6032('0x69'),_0x18b4c0),'qs':{'module':_0x6032('0x6a')},'headers':{'Authorization':_0x6032('0x6b')+_0x1fbc28},'json':!![]});}})[_0x6032('0x28')](function(_0x29549c){if(_0x29549c){if(_0x29549c[_0x6032('0x6c')]&&_0x29549c[_0x6032('0x6c')][_0x6032('0x29')]){throw new Error(_0x29549c['response'][_0x6032('0x29')]['message']);}var _0x5a2d5e=[];var _0x3f5317=[];var _0x14d654=['Owner',_0x6032('0x6d'),_0x6032('0x6e'),_0x6032('0x6f'),_0x6032('0x70'),'Call_Result',_0x6032('0x71'),_0x6032('0x72')];_0x3f5317=_[_0x6032('0x73')](_0x29549c[_0x6032('0x36')],function(_0x1d4cea){return _0x14d654[_0x6032('0x74')](_0x1d4cea[_0x6032('0x75')]);});for(var _0x3c8864=0x0;_0x3c8864<_0x3f5317[_0x6032('0x37')];_0x3c8864++){if(_0x3f5317[_0x3c8864][_0x6032('0x76')]===![]){_0x5a2d5e[_0x6032('0x77')]({'id':_0x3f5317[_0x3c8864]['id'],'name':_0x3f5317[_0x3c8864][_0x6032('0x78')],'custom':_0x3f5317[_0x3c8864]['custom_field'],'options':_0x3f5317[_0x3c8864][_0x6032('0x79')]===_0x6032('0x7a')&&_0x3f5317[_0x3c8864][_0x6032('0x7b')]['length']>-0x1?_[_0x6032('0x2d')](_0x3f5317[_0x3c8864][_0x6032('0x7b')],function(_0x45468a){return{'name':_0x45468a,'value':_0x45468a};}):[]});}}return{'count':_0x5a2d5e[_0x6032('0x37')],'rows':_0x5a2d5e};}else{return{'count':0x0,'rows':[]};}})[_0x6032('0x28')](respondWithResult(_0x2b0169,null))[_0x6032('0x45')](function(_0x3e8d76){var _0x3bc001=_0x5570b3[_0x6032('0x31')]['test']?0x1f4:_0x3e8d76[_0x6032('0x7c')]||0x1f4;logger[_0x6032('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3bc001,JSON[_0x6032('0x7d')](_0x3e8d76));delete _0x3e8d76[_0x6032('0x2a')];if(_0x3bc001===0x191){_0x3bc001=0x190;}_0x2b0169['status'](_0x3bc001)[_0x6032('0x2b')](_0x5570b3['query'][_0x6032('0x7e')]?{'message':_0x6032('0x7f'),'statusCode':_0x3e8d76['statusCode']}:_0x3e8d76);});}; \ No newline at end of file +var _0xf59f=['attributes','fields','length','model','hasOwnProperty','nolimit','order','pick','filter','merge','map','VIRTUAL','options','ZohoAccount','includeAll','include','rows','catch','show','params','keys','body','find','destroy','getConfigurations','findOne','ZohoConfiguration','sort','where','addConfiguration','AccountId','Subjects','getSubjects','channel','create','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','code','host','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Description','WhoId','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','stack','name','send','index','rawAttributes','fieldName','type','query','filters','intersection'];(function(_0x3edb6d,_0x4b0e4d){var _0x1b95f1=function(_0x2ff434){while(--_0x2ff434){_0x3edb6d['push'](_0x3edb6d['shift']());}};_0x1b95f1(++_0x4b0e4d);}(_0xf59f,0xd7));var _0xff59=function(_0x39ddab,_0x1bdf06){_0x39ddab=_0x39ddab-0x0;var _0x3dd5e9=_0xf59f[_0x39ddab];return _0x3dd5e9;};'use strict';var emlformat=require(_0xff59('0x0'));var rimraf=require(_0xff59('0x1'));var zipdir=require(_0xff59('0x2'));var jsonpatch=require(_0xff59('0x3'));var rp=require(_0xff59('0x4'));var moment=require(_0xff59('0x5'));var BPromise=require(_0xff59('0x6'));var Mustache=require(_0xff59('0x7'));var util=require(_0xff59('0x8'));var path=require(_0xff59('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff59('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff59('0xb'));var squel=require(_0xff59('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xff59('0xd'));var toCsv=require(_0xff59('0xe'));var querystring=require(_0xff59('0xf'));var Papa=require(_0xff59('0x10'));var Redis=require(_0xff59('0x11'));var authService=require(_0xff59('0x12'));var qs=require(_0xff59('0x13'));var as=require(_0xff59('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff59('0x15'))(_0xff59('0x16'));var utils=require(_0xff59('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xff59('0x18'));var db=require(_0xff59('0x19'))['db'];var integrations=require(_0xff59('0x1a'));function respondWithStatusCode(_0x304c66,_0x38a974){_0x38a974=_0x38a974||0xcc;return function(_0x3be670){if(_0x3be670){return _0x304c66[_0xff59('0x1b')](_0x38a974);}return _0x304c66[_0xff59('0x1c')](_0x38a974)[_0xff59('0x1d')]();};}function respondWithResult(_0x1f9ab3,_0x45e783){_0x45e783=_0x45e783||0xc8;return function(_0x525204){if(_0x525204){return _0x1f9ab3['status'](_0x45e783)[_0xff59('0x1e')](_0x525204);}};}function respondWithFilteredResult(_0x593ae4,_0x318268){return function(_0x431995){if(_0x431995){var _0x300494=typeof _0x318268['offset']==='undefined'&&typeof _0x318268[_0xff59('0x1f')]===_0xff59('0x20');var _0x10166c=_0x431995[_0xff59('0x21')];var _0x4e2365=_0x300494?0x0:_0x318268['offset'];var _0x4f5648=_0x300494?_0x431995[_0xff59('0x21')]:_0x318268[_0xff59('0x22')]+_0x318268[_0xff59('0x1f')];var _0x41fbf2;if(_0x4f5648>=_0x10166c){_0x4f5648=_0x10166c;_0x41fbf2=0xc8;}else{_0x41fbf2=0xce;}_0x593ae4['status'](_0x41fbf2);return _0x593ae4[_0xff59('0x23')](_0xff59('0x24'),_0x4e2365+'-'+_0x4f5648+'/'+_0x10166c)[_0xff59('0x1e')](_0x431995);}return null;};}function patchUpdates(_0x1f9fe5){return function(_0x4042c8){try{jsonpatch[_0xff59('0x25')](_0x4042c8,_0x1f9fe5,!![]);}catch(_0x59980c){return BPromise[_0xff59('0x26')](_0x59980c);}return _0x4042c8[_0xff59('0x27')]();};}function saveUpdates(_0x92fdfa,_0x39ad83){return function(_0x3ba1a6){if(_0x3ba1a6){return _0x3ba1a6['update'](_0x92fdfa)[_0xff59('0x28')](function(_0x2fbc8a){return _0x2fbc8a;});}return null;};}function removeEntity(_0x2e9287,_0x39ecab){return function(_0x1fa252){if(_0x1fa252){return _0x1fa252['destroy']()['then'](function(){_0x2e9287[_0xff59('0x1c')](0xcc)[_0xff59('0x1d')]();});}};}function handleEntityNotFound(_0xccef7e,_0x475b48){return function(_0x528b55){if(!_0x528b55){_0xccef7e[_0xff59('0x1b')](0x194);}return _0x528b55;};}function handleError(_0x5ab28d,_0x8871fe){_0x8871fe=_0x8871fe||0x1f4;return function(_0x2d5438){logger['error'](_0x2d5438[_0xff59('0x29')]);if(_0x2d5438[_0xff59('0x2a')]){delete _0x2d5438[_0xff59('0x2a')];}_0x5ab28d[_0xff59('0x1c')](_0x8871fe)[_0xff59('0x2b')](_0x2d5438);};}exports[_0xff59('0x2c')]=function(_0x280654,_0x3b4486){var _0x3c9848={},_0x3f52e3={},_0x4283bc={'count':0x0,'rows':[]};var _0x1332ba=_['map'](db['ZohoAccount'][_0xff59('0x2d')],function(_0x3a2719){return{'name':_0x3a2719[_0xff59('0x2e')],'type':_0x3a2719[_0xff59('0x2f')]['key']};});_0x3f52e3['model']=_['map'](_0x1332ba,_0xff59('0x2a'));_0x3f52e3[_0xff59('0x30')]=_['keys'](_0x280654[_0xff59('0x30')]);_0x3f52e3[_0xff59('0x31')]=_[_0xff59('0x32')](_0x3f52e3['model'],_0x3f52e3[_0xff59('0x30')]);_0x3c9848[_0xff59('0x33')]=_[_0xff59('0x32')](_0x3f52e3['model'],qs[_0xff59('0x34')](_0x280654[_0xff59('0x30')][_0xff59('0x34')]));_0x3c9848[_0xff59('0x33')]=_0x3c9848[_0xff59('0x33')][_0xff59('0x35')]?_0x3c9848[_0xff59('0x33')]:_0x3f52e3[_0xff59('0x36')];if(!_0x280654['query'][_0xff59('0x37')](_0xff59('0x38'))){_0x3c9848['limit']=qs[_0xff59('0x1f')](_0x280654[_0xff59('0x30')][_0xff59('0x1f')]);_0x3c9848[_0xff59('0x22')]=qs['offset'](_0x280654[_0xff59('0x30')][_0xff59('0x22')]);}_0x3c9848[_0xff59('0x39')]=qs['sort'](_0x280654[_0xff59('0x30')]['sort']);_0x3c9848['where']=qs[_0xff59('0x31')](_[_0xff59('0x3a')](_0x280654[_0xff59('0x30')],_0x3f52e3[_0xff59('0x31')]),_0x1332ba);if(_0x280654[_0xff59('0x30')][_0xff59('0x3b')]){_0x3c9848['where']=_[_0xff59('0x3c')](_0x3c9848['where'],{'$or':_[_0xff59('0x3d')](_0x1332ba,function(_0x49a6e3){if(_0x49a6e3[_0xff59('0x2f')]!==_0xff59('0x3e')){var _0xba7b20={};_0xba7b20[_0x49a6e3[_0xff59('0x2a')]]={'$like':'%'+_0x280654[_0xff59('0x30')][_0xff59('0x3b')]+'%'};return _0xba7b20;}})});}_0x3c9848=_[_0xff59('0x3c')]({},_0x3c9848,_0x280654[_0xff59('0x3f')]);var _0x34f61f={'where':_0x3c9848['where']};return db[_0xff59('0x40')][_0xff59('0x21')](_0x34f61f)[_0xff59('0x28')](function(_0x2d0836){_0x4283bc['count']=_0x2d0836;if(_0x280654[_0xff59('0x30')][_0xff59('0x41')]){_0x3c9848[_0xff59('0x42')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x3c9848);})[_0xff59('0x28')](function(_0x524bc7){_0x4283bc[_0xff59('0x43')]=_0x524bc7;return _0x4283bc;})[_0xff59('0x28')](respondWithFilteredResult(_0x3b4486,_0x3c9848))[_0xff59('0x44')](handleError(_0x3b4486,null));};exports[_0xff59('0x45')]=function(_0xfc2afb,_0x268ff0){var _0x15874f={'raw':![],'where':{'id':_0xfc2afb[_0xff59('0x46')]['id']}},_0x9a9d30={};_0x9a9d30[_0xff59('0x36')]=_[_0xff59('0x47')](db[_0xff59('0x40')][_0xff59('0x2d')]);_0x9a9d30[_0xff59('0x30')]=_[_0xff59('0x47')](_0xfc2afb[_0xff59('0x30')]);_0x9a9d30[_0xff59('0x31')]=_[_0xff59('0x32')](_0x9a9d30[_0xff59('0x36')],_0x9a9d30[_0xff59('0x30')]);_0x15874f['attributes']=_[_0xff59('0x32')](_0x9a9d30[_0xff59('0x36')],qs[_0xff59('0x34')](_0xfc2afb['query'][_0xff59('0x34')]));_0x15874f[_0xff59('0x33')]=_0x15874f[_0xff59('0x33')][_0xff59('0x35')]?_0x15874f[_0xff59('0x33')]:_0x9a9d30[_0xff59('0x36')];if(_0xfc2afb[_0xff59('0x30')][_0xff59('0x41')]){_0x15874f[_0xff59('0x42')]=[{'all':!![]}];}_0x15874f=_[_0xff59('0x3c')]({},_0x15874f,_0xfc2afb[_0xff59('0x3f')]);return db['ZohoAccount']['find'](_0x15874f)[_0xff59('0x28')](handleEntityNotFound(_0x268ff0,null))[_0xff59('0x28')](respondWithResult(_0x268ff0,null))['catch'](handleError(_0x268ff0,null));};exports['create']=function(_0x4c1647,_0x1bbaad){return db['ZohoAccount']['create'](_0x4c1647['body'],{})[_0xff59('0x28')](respondWithResult(_0x1bbaad,0xc9))['catch'](handleError(_0x1bbaad,null));};exports['update']=function(_0x827d72,_0x515478){if(_0x827d72[_0xff59('0x48')]['id']){delete _0x827d72[_0xff59('0x48')]['id'];}return db[_0xff59('0x40')][_0xff59('0x49')]({'where':{'id':_0x827d72[_0xff59('0x46')]['id']}})['then'](handleEntityNotFound(_0x515478,null))[_0xff59('0x28')](saveUpdates(_0x827d72['body'],null))[_0xff59('0x28')](respondWithResult(_0x515478,null))[_0xff59('0x44')](handleError(_0x515478,null));};exports[_0xff59('0x4a')]=function(_0x22fe56,_0xe5602f){return db[_0xff59('0x40')][_0xff59('0x49')]({'where':{'id':_0x22fe56[_0xff59('0x46')]['id']}})[_0xff59('0x28')](handleEntityNotFound(_0xe5602f,null))[_0xff59('0x28')](removeEntity(_0xe5602f,null))[_0xff59('0x44')](handleError(_0xe5602f,null));};exports[_0xff59('0x4b')]=function(_0x2a999f,_0x3c4a0,_0x49951d){var _0x145e4b={};var _0x5eed54={};var _0x37e23f;var _0x5b74e5;return db['ZohoAccount'][_0xff59('0x4c')]({'where':{'id':_0x2a999f[_0xff59('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c4a0,null))[_0xff59('0x28')](function(_0x284cd1){if(_0x284cd1){_0x37e23f=_0x284cd1;_0x5eed54[_0xff59('0x36')]=_[_0xff59('0x47')](db[_0xff59('0x4d')][_0xff59('0x2d')]);_0x5eed54['query']=_[_0xff59('0x47')](_0x2a999f[_0xff59('0x30')]);_0x5eed54[_0xff59('0x31')]=_[_0xff59('0x32')](_0x5eed54[_0xff59('0x36')],_0x5eed54[_0xff59('0x30')]);_0x145e4b['attributes']=_[_0xff59('0x32')](_0x5eed54['model'],qs['fields'](_0x2a999f['query'][_0xff59('0x34')]));_0x145e4b[_0xff59('0x33')]=_0x145e4b[_0xff59('0x33')]['length']?_0x145e4b[_0xff59('0x33')]:_0x5eed54[_0xff59('0x36')];_0x145e4b['order']=qs['sort'](_0x2a999f[_0xff59('0x30')][_0xff59('0x4e')]);_0x145e4b[_0xff59('0x4f')]=qs['filters'](_[_0xff59('0x3a')](_0x2a999f[_0xff59('0x30')],_0x5eed54[_0xff59('0x31')]));if(_0x2a999f['query'][_0xff59('0x3b')]){_0x145e4b['where']=_[_0xff59('0x3c')](_0x145e4b[_0xff59('0x4f')],{'$or':_[_0xff59('0x3d')](_0x145e4b[_0xff59('0x33')],function(_0x1b8515){var _0x4b32b6={};_0x4b32b6[_0x1b8515]={'$like':'%'+_0x2a999f[_0xff59('0x30')][_0xff59('0x3b')]+'%'};return _0x4b32b6;})});}_0x145e4b=_['merge']({},_0x145e4b,_0x2a999f['options']);return _0x37e23f[_0xff59('0x4b')](_0x145e4b);}})[_0xff59('0x28')](function(_0x5c4811){if(_0x5c4811){_0x5b74e5=_0x5c4811[_0xff59('0x35')];if(!_0x2a999f['query'][_0xff59('0x37')]('nolimit')){_0x145e4b[_0xff59('0x1f')]=qs[_0xff59('0x1f')](_0x2a999f[_0xff59('0x30')][_0xff59('0x1f')]);_0x145e4b[_0xff59('0x22')]=qs['offset'](_0x2a999f[_0xff59('0x30')]['offset']);}return _0x37e23f[_0xff59('0x4b')](_0x145e4b);}})[_0xff59('0x28')](function(_0x4555e4){if(_0x4555e4){return _0x4555e4?{'count':_0x5b74e5,'rows':_0x4555e4}:null;}})['then'](respondWithResult(_0x3c4a0,null))[_0xff59('0x44')](handleError(_0x3c4a0,null));};exports[_0xff59('0x50')]=function(_0x812d9c,_0x25ad57,_0xa4129b){if(_0x812d9c[_0xff59('0x48')]['id']){delete _0x812d9c[_0xff59('0x48')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x812d9c[_0xff59('0x46')]['id']}})[_0xff59('0x28')](handleEntityNotFound(_0x25ad57,null))[_0xff59('0x28')](function(_0x364475){if(_0x364475){_0x812d9c[_0xff59('0x48')][_0xff59('0x51')]=_0x364475['id'];_0x812d9c[_0xff59('0x48')][_0xff59('0x52')]=integrations[_0xff59('0x53')](_0x812d9c[_0xff59('0x48')][_0xff59('0x54')],_0x812d9c[_0xff59('0x48')]['type']);_0x812d9c[_0xff59('0x48')]['Descriptions']=integrations['getDescriptions'](_0x812d9c[_0xff59('0x48')][_0xff59('0x54')],_0x812d9c[_0xff59('0x48')][_0xff59('0x2f')]);return db['ZohoConfiguration'][_0xff59('0x55')](_0x812d9c['body'],{'include':[{'model':db[_0xff59('0x56')],'as':'Subjects'},{'model':db[_0xff59('0x56')],'as':_0xff59('0x57')}]});}return null;})[_0xff59('0x28')](respondWithResult(_0x25ad57,null))['catch'](handleError(_0x25ad57,null));};function getAccessToken(_0x4735c0){return new Promise(function(_0x1f3ea5,_0x3000cc){var _0x2c2961;switch(_0x4735c0[_0xff59('0x58')]){case'US':_0x2c2961=_0xff59('0x59');break;case'AU':_0x2c2961=_0xff59('0x5a');break;case'EU':_0x2c2961=_0xff59('0x5b');break;case'IN':_0x2c2961=_0xff59('0x5c');break;case'CN':_0x2c2961='https://accounts.zoho.com.cn';break;default:_0x2c2961=_0xff59('0x5b');break;}var _0x56bf2a={'method':_0xff59('0x5d'),'uri':_0x2c2961+'/oauth/v2/token','qs':{'refresh_token':_0x4735c0[_0xff59('0x5e')],'client_id':_0x4735c0[_0xff59('0x5f')],'client_secret':_0x4735c0[_0xff59('0x60')],'grant_type':_0xff59('0x61')},'json':!![]};return rp(_0x56bf2a)['then'](function(_0x448723){if(_0x448723['access_token']){_0x1f3ea5(_0x448723[_0xff59('0x62')]);}else{_0x3000cc('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xff59('0x44')](function(_0x33c6e3){_0x3000cc(_0x33c6e3);});});}exports[_0xff59('0x63')]=function(_0xbb38a,_0x2e1f57,_0x4005a1){var _0x36d47c,_0x5483d7,_0x4d16d9,_0x5b7c55,_0x1cda69;return db[_0xff59('0x40')][_0xff59('0x4c')]({'where':{'id':_0xbb38a['params']['id']},'attributes':['id','host','zone',_0xff59('0x5f'),_0xff59('0x60'),_0xff59('0x64'),_0xff59('0x65'),_0xff59('0x5e')]})[_0xff59('0x28')](handleEntityNotFound(_0x2e1f57,null))['then'](function(_0x17d106){_0x1cda69=_0x17d106;_0x36d47c=_0x1cda69[_0xff59('0x66')];_0x5483d7=_0x36d47c===_0xff59('0x67')?'eu':_0xff59('0x68');_0x4d16d9=_0x1cda69[_0xff59('0x64')];var _0xbafbe2=_0x4d16d9[_0xff59('0x69')](-0x1);if(_0xbafbe2==='/'||_0xbafbe2==='\x5c'||_0xbafbe2===':'){_0x4d16d9=_0x4d16d9['substring'](0x0,_0x4d16d9['lastIndexOf'](_0xbafbe2));}if(!_0x1cda69[_0xff59('0x5e')]){throw new Error(_0xff59('0x6a'));}return getAccessToken(_0x1cda69);})[_0xff59('0x28')](function(_0x2ac9b1){if(_0x2ac9b1){return rp({'method':_0xff59('0x6b'),'uri':util['format'](_0xff59('0x6c'),_0x5483d7),'qs':{'module':_0xff59('0x6d')},'headers':{'Authorization':_0xff59('0x6e')+_0x2ac9b1},'json':!![]});}})[_0xff59('0x28')](function(_0xb9add0){if(_0xb9add0){if(_0xb9add0[_0xff59('0x6f')]&&_0xb9add0[_0xff59('0x6f')]['error']){throw new Error(_0xb9add0[_0xff59('0x6f')][_0xff59('0x70')][_0xff59('0x71')]);}var _0x31164b=[];var _0x4173c6=[];var _0x2a0033=[_0xff59('0x72'),'Subject',_0xff59('0x73'),_0xff59('0x74'),'Call_Duration','Call_Result',_0xff59('0x75'),_0xff59('0x76')];_0x4173c6=_[_0xff59('0x77')](_0xb9add0[_0xff59('0x34')],function(_0x312ad3){return _0x2a0033[_0xff59('0x78')](_0x312ad3[_0xff59('0x79')]);});for(var _0x1524b8=0x0;_0x1524b8<_0x4173c6['length'];_0x1524b8++){if(_0x4173c6[_0x1524b8][_0xff59('0x7a')]===![]){_0x31164b[_0xff59('0x7b')]({'id':_0x4173c6[_0x1524b8]['id'],'name':_0x4173c6[_0x1524b8][_0xff59('0x7c')],'custom':_0x4173c6[_0x1524b8][_0xff59('0x7d')],'options':_0x4173c6[_0x1524b8][_0xff59('0x7e')]===_0xff59('0x7f')&&_0x4173c6[_0x1524b8][_0xff59('0x80')][_0xff59('0x35')]>-0x1?_[_0xff59('0x3d')](_0x4173c6[_0x1524b8][_0xff59('0x80')],function(_0x2d0de9){return{'name':_0x2d0de9,'value':_0x2d0de9};}):[]});}}return{'count':_0x31164b[_0xff59('0x35')],'rows':_0x31164b};}else{return{'count':0x0,'rows':[]};}})[_0xff59('0x28')](respondWithResult(_0x2e1f57,null))[_0xff59('0x44')](function(_0x185cc5){var _0x26b2ee=_0xbb38a['query'][_0xff59('0x81')]?0x1f4:_0x185cc5[_0xff59('0x82')]||0x1f4;logger[_0xff59('0x70')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x26b2ee,JSON[_0xff59('0x83')](_0x185cc5));delete _0x185cc5[_0xff59('0x2a')];if(_0x26b2ee===0x191){_0x26b2ee=0x190;}_0x2e1f57[_0xff59('0x1c')](_0x26b2ee)[_0xff59('0x2b')](_0xbb38a[_0xff59('0x30')][_0xff59('0x81')]?{'message':_0xff59('0x84'),'statusCode':_0x185cc5[_0xff59('0x82')]}:_0x185cc5);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d97c971..a24eafb 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 _0x9060=['int_zoho_accounts','changed','serverUrl','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','then','refresh_token','refreshToken','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','slice','zone','catch','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9060,0x1f1));var _0x0906=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x9060[_0x3740fe];return _0x55492b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0906('0x0'))(_0x0906('0x1'));var moment=require(_0x0906('0x2'));var BPromise=require(_0x0906('0x3'));var rp=require(_0x0906('0x4'));var fs=require('fs');var path=require(_0x0906('0x5'));var rimraf=require(_0x0906('0x6'));var config=require(_0x0906('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x0906('0x8'));module['exports']=function(_0x26208e,_0x4041b0){return _0x26208e[_0x0906('0x9')]('ZohoAccount',attributes,{'tableName':_0x0906('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x12d237,_0x260665,_0x32df01){if(_0x12d237[_0x0906('0xb')]('zone')||_0x12d237['changed'](_0x0906('0xc'))||_0x12d237[_0x0906('0xb')]('clientId')||_0x12d237[_0x0906('0xb')](_0x0906('0xd'))||_0x12d237[_0x0906('0xb')](_0x0906('0xe'))||_0x12d237[_0x0906('0xb')](_0x0906('0xf'))){var _0x4b0b5f,_0xc1815c;_0x4b0b5f=_0x12d237[_0x0906('0xc')];var _0x4c5a30=_0x4b0b5f['slice'](-0x1);if(_0x4c5a30==='/'||_0x4c5a30==='\x5c'||_0x4c5a30===':'){_0x4b0b5f=_0x4b0b5f[_0x0906('0x10')](0x0,_0x4b0b5f[_0x0906('0x11')](_0x4c5a30));}switch(_0x12d237['zone']){case'US':_0xc1815c=_0x0906('0x12');break;case'AU':_0xc1815c=_0x0906('0x13');break;case'IN':_0xc1815c='https://accounts.zoho.in';break;case'CN':_0xc1815c=_0x0906('0x14');break;default:_0xc1815c=_0x0906('0x15');break;}var _0x49c27b={'method':_0x0906('0x16'),'uri':_0xc1815c+_0x0906('0x17'),'form':{'grant_type':_0x0906('0x18'),'client_id':_0x12d237[_0x0906('0x19')],'client_secret':_0x12d237[_0x0906('0xd')],'redirect_uri':_0x12d237['serverUrl'],'code':_0x12d237['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x49c27b)[_0x0906('0x1a')](function(_0x43e126){var _0x3c7c28=JSON['parse'](_0x43e126);if(_0x3c7c28[_0x0906('0x1b')]){_0x12d237[_0x0906('0x1c')]=_0x3c7c28[_0x0906('0x1b')];logger[_0x0906('0x1d')](util[_0x0906('0x1e')](_0x0906('0x1f'),_0x12d237[_0x0906('0x20')],_0x12d237['id']));}else{logger[_0x0906('0x21')](util[_0x0906('0x1e')](_0x0906('0x22'),_0x12d237[_0x0906('0x20')],_0x12d237['id']),util[_0x0906('0x23')](_0x3c7c28,{'showHidden':![],'depth':null}));}return _0x32df01(null,_0x260665);})['catch'](function(_0x42bbf9){logger[_0x0906('0x21')](util[_0x0906('0x1e')](_0x0906('0x22'),_0x12d237[_0x0906('0x20')],_0x12d237['id']),util[_0x0906('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x32df01(_0x42bbf9);});}else{return _0x32df01(null,_0x260665);}},'beforeUpdate':function(_0x188a8b,_0xef0dd4,_0x55838b){if(_0x188a8b[_0x0906('0xb')]('zone')||_0x188a8b['changed'](_0x0906('0xc'))||_0x188a8b[_0x0906('0xb')]('clientId')||_0x188a8b[_0x0906('0xb')](_0x0906('0xd'))||_0x188a8b[_0x0906('0xb')](_0x0906('0xe'))||_0x188a8b[_0x0906('0xb')](_0x0906('0xf'))){var _0x35d1fb,_0x440612;_0x35d1fb=_0x188a8b['serverUrl'];var _0x4af439=_0x35d1fb[_0x0906('0x24')](-0x1);if(_0x4af439==='/'||_0x4af439==='\x5c'||_0x4af439===':'){_0x35d1fb=_0x35d1fb[_0x0906('0x10')](0x0,_0x35d1fb[_0x0906('0x11')](_0x4af439));}switch(_0x188a8b[_0x0906('0x25')]){case'US':_0x440612=_0x0906('0x12');break;case'AU':_0x440612=_0x0906('0x13');break;case'IN':_0x440612='https://accounts.zoho.in';break;case'CN':_0x440612=_0x0906('0x14');break;default:_0x440612=_0x0906('0x15');break;}var _0x4ad785={'method':'POST','uri':_0x440612+_0x0906('0x17'),'form':{'grant_type':_0x0906('0x18'),'client_id':_0x188a8b['clientId'],'client_secret':_0x188a8b['clientSecret'],'redirect_uri':_0x188a8b['serverUrl'],'code':_0x188a8b[_0x0906('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4ad785)[_0x0906('0x1a')](function(_0x3ecd30){var _0x1b8df2=JSON['parse'](_0x3ecd30);if(_0x1b8df2[_0x0906('0x1b')]){_0x188a8b['refreshToken']=_0x1b8df2['refresh_token'];logger[_0x0906('0x1d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x188a8b[_0x0906('0x20')],_0x188a8b['id']));}else{logger['error'](util[_0x0906('0x1e')](_0x0906('0x22'),_0x188a8b[_0x0906('0x20')],_0x188a8b['id']),util[_0x0906('0x23')](_0x1b8df2,{'showHidden':![],'depth':null}));}return _0x55838b(null,_0xef0dd4);})[_0x0906('0x26')](function(_0x5e98d7){logger[_0x0906('0x21')](util[_0x0906('0x1e')](_0x0906('0x22'),_0x188a8b[_0x0906('0x20')],_0x188a8b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x55838b(_0x5e98d7);});}else{return _0x55838b(null,_0xef0dd4);}}}});}; \ No newline at end of file +var _0x494a=['int_zoho_accounts','changed','clientId','clientSecret','host','serverUrl','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','then','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','lastIndexOf','https://accounts.zoho.com.au','authorization_code','application/x-www-form-urlencoded','info','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount'];(function(_0x35aed4,_0x1ee2ab){var _0x5a2cc0=function(_0x1f96f8){while(--_0x1f96f8){_0x35aed4['push'](_0x35aed4['shift']());}};_0x5a2cc0(++_0x1ee2ab);}(_0x494a,0x186));var _0xa494=function(_0x9d680d,_0x295c2f){_0x9d680d=_0x9d680d-0x0;var _0x2ff74d=_0x494a[_0x9d680d];return _0x2ff74d;};'use strict';var _=require(_0xa494('0x0'));var util=require('util');var logger=require(_0xa494('0x1'))(_0xa494('0x2'));var moment=require('moment');var BPromise=require(_0xa494('0x3'));var rp=require(_0xa494('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa494('0x5'));var config=require(_0xa494('0x6'));var attributes=require(_0xa494('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xa494('0x8')]=function(_0x15da0a,_0x1dc122){return _0x15da0a['define'](_0xa494('0x9'),attributes,{'tableName':_0xa494('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a71d5,_0x22eccc,_0x1e1faf){if(_0x2a71d5[_0xa494('0xb')]('zone')||_0x2a71d5['changed']('serverUrl')||_0x2a71d5[_0xa494('0xb')](_0xa494('0xc'))||_0x2a71d5[_0xa494('0xb')](_0xa494('0xd'))||_0x2a71d5[_0xa494('0xb')]('code')||_0x2a71d5[_0xa494('0xb')](_0xa494('0xe'))){var _0x491e2f,_0x5f1d4a;_0x491e2f=_0x2a71d5[_0xa494('0xf')];var _0x3080de=_0x491e2f[_0xa494('0x10')](-0x1);if(_0x3080de==='/'||_0x3080de==='\x5c'||_0x3080de===':'){_0x491e2f=_0x491e2f[_0xa494('0x11')](0x0,_0x491e2f['lastIndexOf'](_0x3080de));}switch(_0x2a71d5[_0xa494('0x12')]){case'US':_0x5f1d4a=_0xa494('0x13');break;case'AU':_0x5f1d4a='https://accounts.zoho.com.au';break;case'IN':_0x5f1d4a=_0xa494('0x14');break;case'CN':_0x5f1d4a='https://accounts.zoho.com.cn';break;default:_0x5f1d4a=_0xa494('0x15');break;}var _0x181b7a={'method':_0xa494('0x16'),'uri':_0x5f1d4a+_0xa494('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x2a71d5[_0xa494('0xc')],'client_secret':_0x2a71d5[_0xa494('0xd')],'redirect_uri':_0x2a71d5['serverUrl'],'code':_0x2a71d5['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x181b7a)[_0xa494('0x18')](function(_0x33b4e7){var _0x558d3b=JSON[_0xa494('0x19')](_0x33b4e7);if(_0x558d3b[_0xa494('0x1a')]){_0x2a71d5[_0xa494('0x1b')]=_0x558d3b[_0xa494('0x1a')];logger['info'](util['format'](_0xa494('0x1c'),_0x2a71d5[_0xa494('0x1d')],_0x2a71d5['id']));}else{logger['error'](util[_0xa494('0x1e')](_0xa494('0x1f'),_0x2a71d5[_0xa494('0x1d')],_0x2a71d5['id']),util[_0xa494('0x20')](_0x558d3b,{'showHidden':![],'depth':null}));}return _0x1e1faf(null,_0x22eccc);})[_0xa494('0x21')](function(_0xd9ec){logger[_0xa494('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2a71d5[_0xa494('0x1d')],_0x2a71d5['id']),util[_0xa494('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x1e1faf(_0xd9ec);});}else{return _0x1e1faf(null,_0x22eccc);}},'beforeUpdate':function(_0x18e1a7,_0x1eb9a3,_0x539142){if(_0x18e1a7[_0xa494('0xb')](_0xa494('0x12'))||_0x18e1a7['changed'](_0xa494('0xf'))||_0x18e1a7[_0xa494('0xb')](_0xa494('0xc'))||_0x18e1a7[_0xa494('0xb')](_0xa494('0xd'))||_0x18e1a7['changed']('code')||_0x18e1a7[_0xa494('0xb')]('host')){var _0x29eeeb,_0x12f14e;_0x29eeeb=_0x18e1a7[_0xa494('0xf')];var _0x2d1e09=_0x29eeeb[_0xa494('0x10')](-0x1);if(_0x2d1e09==='/'||_0x2d1e09==='\x5c'||_0x2d1e09===':'){_0x29eeeb=_0x29eeeb['substring'](0x0,_0x29eeeb[_0xa494('0x23')](_0x2d1e09));}switch(_0x18e1a7[_0xa494('0x12')]){case'US':_0x12f14e=_0xa494('0x13');break;case'AU':_0x12f14e=_0xa494('0x24');break;case'IN':_0x12f14e=_0xa494('0x14');break;case'CN':_0x12f14e='https://accounts.zoho.com.cn';break;default:_0x12f14e=_0xa494('0x15');break;}var _0x5c0862={'method':_0xa494('0x16'),'uri':_0x12f14e+'/oauth/v2/token','form':{'grant_type':_0xa494('0x25'),'client_id':_0x18e1a7[_0xa494('0xc')],'client_secret':_0x18e1a7[_0xa494('0xd')],'redirect_uri':_0x18e1a7[_0xa494('0xf')],'code':_0x18e1a7['code']},'headers':{'Content-Type':_0xa494('0x26')}};return rp(_0x5c0862)['then'](function(_0x1f7aff){var _0xcdf64b=JSON['parse'](_0x1f7aff);if(_0xcdf64b[_0xa494('0x1a')]){_0x18e1a7[_0xa494('0x1b')]=_0xcdf64b[_0xa494('0x1a')];logger[_0xa494('0x27')](util[_0xa494('0x1e')](_0xa494('0x1c'),_0x18e1a7[_0xa494('0x1d')],_0x18e1a7['id']));}else{logger['error'](util[_0xa494('0x1e')](_0xa494('0x1f'),_0x18e1a7['name'],_0x18e1a7['id']),util[_0xa494('0x20')](_0xcdf64b,{'showHidden':![],'depth':null}));}return _0x539142(null,_0x1eb9a3);})[_0xa494('0x21')](function(_0x405eb2){logger[_0xa494('0x22')](util[_0xa494('0x1e')](_0xa494('0x1f'),_0x18e1a7['name'],_0x18e1a7['id']),util[_0xa494('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x539142(_0x405eb2);});}else{return _0x539142(null,_0x1eb9a3);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index be90f71..f766fa6 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 _0x6829=['client','http','then','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','GetZohoAccount','catch','ShowZohoAccount','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x287d2a,_0x14e300){var _0x4d5869=function(_0x21b576){while(--_0x21b576){_0x287d2a['push'](_0x287d2a['shift']());}};_0x4d5869(++_0x14e300);}(_0x6829,0x14c));var _0x9682=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x6829[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9682('0x2'));var db=require(_0x9682('0x3'))['db'];var utils=require(_0x9682('0x4'));var logger=require(_0x9682('0x5'))(_0x9682('0x6'));var config=require(_0x9682('0x7'));var jayson=require(_0x9682('0x8'));var client=jayson[_0x9682('0x9')][_0x9682('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cec91,_0x37ab0a,_0x1cca2f){return new BPromise(function(_0x576a39,_0x519138){return client['request'](_0x4cec91,_0x1cca2f)[_0x9682('0xb')](function(_0x1b27c2){logger['info'](_0x9682('0xc'),_0x37ab0a,'request\x20sent');logger[_0x9682('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x37ab0a,_0x9682('0xe'),JSON[_0x9682('0xf')](_0x1b27c2));if(_0x1b27c2[_0x9682('0x10')]){if(_0x1b27c2['error']['code']===0x1f4){logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x1b27c2['error'][_0x9682('0x11')]);return _0x519138(_0x1b27c2['error'][_0x9682('0x11')]);}logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x1b27c2[_0x9682('0x10')][_0x9682('0x11')]);return _0x576a39(_0x1b27c2[_0x9682('0x10')][_0x9682('0x11')]);}else{logger[_0x9682('0x12')](_0x9682('0xc'),_0x37ab0a,_0x9682('0xe'));_0x576a39(_0x1b27c2['result'][_0x9682('0x11')]);}})['catch'](function(_0x23eef6){logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x23eef6);_0x519138(_0x23eef6);});});}exports['GetZohoAccount']=function(_0x1c73ee){var _0x4e0dfb=this;return new Promise(function(_0x107291,_0x51c1a8){return db[_0x9682('0x13')][_0x9682('0x14')]({'raw':_0x1c73ee[_0x9682('0x15')]?_0x1c73ee[_0x9682('0x15')][_0x9682('0x16')]===undefined?!![]:![]:!![],'where':_0x1c73ee['options']?_0x1c73ee['options']['where']||null:null,'attributes':_0x1c73ee[_0x9682('0x15')]?_0x1c73ee['options'][_0x9682('0x17')]||null:null,'limit':_0x1c73ee[_0x9682('0x15')]?_0x1c73ee['options'][_0x9682('0x18')]||null:null,'include':_0x1c73ee[_0x9682('0x15')]?_0x1c73ee[_0x9682('0x15')][_0x9682('0x19')]?_[_0x9682('0x1a')](_0x1c73ee[_0x9682('0x15')][_0x9682('0x19')],function(_0x40e927){return{'model':db[_0x40e927[_0x9682('0x1b')]],'as':_0x40e927['as'],'attributes':_0x40e927[_0x9682('0x17')],'include':_0x40e927['include']?_[_0x9682('0x1a')](_0x40e927[_0x9682('0x19')],function(_0x88419f){return{'model':db[_0x88419f[_0x9682('0x1b')]],'as':_0x88419f['as'],'attributes':_0x88419f[_0x9682('0x17')],'include':_0x88419f['include']?_[_0x9682('0x1a')](_0x88419f[_0x9682('0x19')],function(_0x44808c){return{'model':db[_0x44808c[_0x9682('0x1b')]],'as':_0x44808c['as'],'attributes':_0x44808c[_0x9682('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9682('0xb')](function(_0x48e821){logger[_0x9682('0x12')](_0x9682('0x1c'),_0x1c73ee);logger[_0x9682('0xd')](_0x9682('0x1c'),_0x1c73ee,JSON[_0x9682('0xf')](_0x48e821));_0x107291(_0x48e821);})[_0x9682('0x1d')](function(_0x176624){logger[_0x9682('0x10')]('GetZohoAccount',_0x176624[_0x9682('0x11')],_0x1c73ee);_0x51c1a8(_0x4e0dfb['error'](0x1f4,_0x176624[_0x9682('0x11')]));});});};exports[_0x9682('0x1e')]=function(_0x598248){var _0x54c860=this;return new Promise(function(_0x4b4c5d,_0x5a2ad3){return db[_0x9682('0x13')]['find']({'raw':_0x598248[_0x9682('0x15')]?_0x598248[_0x9682('0x15')][_0x9682('0x16')]===undefined?!![]:![]:!![],'where':_0x598248[_0x9682('0x15')]?_0x598248['options']['where']||null:null,'attributes':_0x598248[_0x9682('0x15')]?_0x598248[_0x9682('0x15')][_0x9682('0x17')]||null:null,'include':_0x598248[_0x9682('0x15')]?_0x598248[_0x9682('0x15')]['include']?_['map'](_0x598248[_0x9682('0x15')][_0x9682('0x19')],function(_0x76f489){return{'model':db[_0x76f489[_0x9682('0x1b')]],'as':_0x76f489['as'],'attributes':_0x76f489[_0x9682('0x17')],'include':_0x76f489[_0x9682('0x19')]?_[_0x9682('0x1a')](_0x76f489['include'],function(_0x27c9dd){return{'model':db[_0x27c9dd[_0x9682('0x1b')]],'as':_0x27c9dd['as'],'attributes':_0x27c9dd[_0x9682('0x17')],'include':_0x27c9dd[_0x9682('0x19')]?_[_0x9682('0x1a')](_0x27c9dd['include'],function(_0x194bda){return{'model':db[_0x194bda['model']],'as':_0x194bda['as'],'attributes':_0x194bda[_0x9682('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9682('0xb')](function(_0x43d782){logger[_0x9682('0x12')](_0x9682('0x1e'),_0x598248);logger[_0x9682('0xd')](_0x9682('0x1e'),_0x598248,JSON['stringify'](_0x43d782));_0x4b4c5d(_0x43d782);})[_0x9682('0x1d')](function(_0x555634){logger[_0x9682('0x10')]('ShowZohoAccount',_0x555634[_0x9682('0x11')],_0x598248);_0x5a2ad3(_0x54c860[_0x9682('0x10')](0x1f4,_0x555634[_0x9682('0x11')]));});});}; \ No newline at end of file +var _0xbc36=['error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x488dd9,_0x27203f){var _0xa1a4a7=function(_0x224337){while(--_0x224337){_0x488dd9['push'](_0x488dd9['shift']());}};_0xa1a4a7(++_0x27203f);}(_0xbc36,0x169));var _0x6bc3=function(_0x45a28a,_0x25fef3){_0x45a28a=_0x45a28a-0x0;var _0x5c0f22=_0xbc36[_0x45a28a];return _0x5c0f22;};'use strict';var _=require(_0x6bc3('0x0'));var util=require('util');var moment=require(_0x6bc3('0x1'));var BPromise=require(_0x6bc3('0x2'));var rs=require(_0x6bc3('0x3'));var fs=require('fs');var Redis=require(_0x6bc3('0x4'));var db=require(_0x6bc3('0x5'))['db'];var utils=require(_0x6bc3('0x6'));var logger=require(_0x6bc3('0x7'))(_0x6bc3('0x8'));var config=require(_0x6bc3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6bc3('0xa')][_0x6bc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5584a5,_0x33e11c,_0x1f894a){return new BPromise(function(_0xf07594,_0x4de32d){return client[_0x6bc3('0xc')](_0x5584a5,_0x1f894a)[_0x6bc3('0xd')](function(_0x33e8e0){logger[_0x6bc3('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x33e11c,_0x6bc3('0xf'));logger[_0x6bc3('0x10')](_0x6bc3('0x11'),_0x33e11c,_0x6bc3('0xf'),JSON[_0x6bc3('0x12')](_0x33e8e0));if(_0x33e8e0[_0x6bc3('0x13')]){if(_0x33e8e0[_0x6bc3('0x13')][_0x6bc3('0x14')]===0x1f4){logger[_0x6bc3('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x33e11c,_0x33e8e0[_0x6bc3('0x13')]['message']);return _0x4de32d(_0x33e8e0[_0x6bc3('0x13')]['message']);}logger[_0x6bc3('0x13')](_0x6bc3('0x15'),_0x33e11c,_0x33e8e0['error'][_0x6bc3('0x16')]);return _0xf07594(_0x33e8e0['error']['message']);}else{logger[_0x6bc3('0xe')](_0x6bc3('0x15'),_0x33e11c,_0x6bc3('0xf'));_0xf07594(_0x33e8e0[_0x6bc3('0x17')][_0x6bc3('0x16')]);}})[_0x6bc3('0x18')](function(_0xa1782){logger['error'](_0x6bc3('0x15'),_0x33e11c,_0xa1782);_0x4de32d(_0xa1782);});});}exports[_0x6bc3('0x19')]=function(_0x4c1894){var _0x426a16=this;return new Promise(function(_0x1d27db,_0x232496){return db[_0x6bc3('0x1a')][_0x6bc3('0x1b')]({'raw':_0x4c1894[_0x6bc3('0x1c')]?_0x4c1894[_0x6bc3('0x1c')][_0x6bc3('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c1894[_0x6bc3('0x1c')]?_0x4c1894[_0x6bc3('0x1c')][_0x6bc3('0x1e')]||null:null,'attributes':_0x4c1894[_0x6bc3('0x1c')]?_0x4c1894['options'][_0x6bc3('0x1f')]||null:null,'limit':_0x4c1894[_0x6bc3('0x1c')]?_0x4c1894['options'][_0x6bc3('0x20')]||null:null,'include':_0x4c1894['options']?_0x4c1894[_0x6bc3('0x1c')][_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0x4c1894[_0x6bc3('0x1c')][_0x6bc3('0x21')],function(_0x453ada){return{'model':db[_0x453ada[_0x6bc3('0x23')]],'as':_0x453ada['as'],'attributes':_0x453ada[_0x6bc3('0x1f')],'include':_0x453ada[_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0x453ada[_0x6bc3('0x21')],function(_0x1e9a9c){return{'model':db[_0x1e9a9c[_0x6bc3('0x23')]],'as':_0x1e9a9c['as'],'attributes':_0x1e9a9c['attributes'],'include':_0x1e9a9c[_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0x1e9a9c[_0x6bc3('0x21')],function(_0x1ab236){return{'model':db[_0x1ab236[_0x6bc3('0x23')]],'as':_0x1ab236['as'],'attributes':_0x1ab236['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e6365){logger['info'](_0x6bc3('0x19'),_0x4c1894);logger[_0x6bc3('0x10')](_0x6bc3('0x19'),_0x4c1894,JSON[_0x6bc3('0x12')](_0x3e6365));_0x1d27db(_0x3e6365);})['catch'](function(_0x66fb54){logger[_0x6bc3('0x13')](_0x6bc3('0x19'),_0x66fb54[_0x6bc3('0x16')],_0x4c1894);_0x232496(_0x426a16[_0x6bc3('0x13')](0x1f4,_0x66fb54['message']));});});};exports[_0x6bc3('0x24')]=function(_0xe5c34b){var _0x18cf51=this;return new Promise(function(_0x2815d9,_0x956c55){return db['ZohoAccount'][_0x6bc3('0x25')]({'raw':_0xe5c34b[_0x6bc3('0x1c')]?_0xe5c34b[_0x6bc3('0x1c')][_0x6bc3('0x1d')]===undefined?!![]:![]:!![],'where':_0xe5c34b[_0x6bc3('0x1c')]?_0xe5c34b[_0x6bc3('0x1c')][_0x6bc3('0x1e')]||null:null,'attributes':_0xe5c34b[_0x6bc3('0x1c')]?_0xe5c34b['options'][_0x6bc3('0x1f')]||null:null,'include':_0xe5c34b['options']?_0xe5c34b['options'][_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0xe5c34b['options'][_0x6bc3('0x21')],function(_0x675b93){return{'model':db[_0x675b93[_0x6bc3('0x23')]],'as':_0x675b93['as'],'attributes':_0x675b93[_0x6bc3('0x1f')],'include':_0x675b93[_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0x675b93[_0x6bc3('0x21')],function(_0xf0f900){return{'model':db[_0xf0f900[_0x6bc3('0x23')]],'as':_0xf0f900['as'],'attributes':_0xf0f900[_0x6bc3('0x1f')],'include':_0xf0f900[_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0xf0f900[_0x6bc3('0x21')],function(_0x104537){return{'model':db[_0x104537['model']],'as':_0x104537['as'],'attributes':_0x104537[_0x6bc3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6bc3('0xd')](function(_0x5d7bcd){logger[_0x6bc3('0xe')]('ShowZohoAccount',_0xe5c34b);logger[_0x6bc3('0x10')](_0x6bc3('0x24'),_0xe5c34b,JSON[_0x6bc3('0x12')](_0x5d7bcd));_0x2815d9(_0x5d7bcd);})[_0x6bc3('0x18')](function(_0x254946){logger[_0x6bc3('0x13')](_0x6bc3('0x24'),_0x254946[_0x6bc3('0x16')],_0xe5c34b);_0x956c55(_0x18cf51[_0x6bc3('0x13')](0x1f4,_0x254946[_0x6bc3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index af08574..e38dc7d 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 _0x5c62=['../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x41444f,_0x12a5ae){var _0x40250c=function(_0x3ead0c){while(--_0x3ead0c){_0x41444f['push'](_0x41444f['shift']());}};_0x40250c(++_0x12a5ae);}(_0x5c62,0x64));var _0x25c6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5c62[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x25c6('0x0'));var util=require('util');var path=require(_0x25c6('0x1'));var timeout=require(_0x25c6('0x2'));var express=require('express');var router=express[_0x25c6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x25c6('0x4'));var config=require(_0x25c6('0x5'));var controller=require(_0x25c6('0x6'));router[_0x25c6('0x7')]('/',auth[_0x25c6('0x8')](),controller[_0x25c6('0x9')]);router['get']('/:id',auth[_0x25c6('0x8')](),controller['show']);router[_0x25c6('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x25c6('0xa'),auth[_0x25c6('0x8')](),controller[_0x25c6('0xb')]);router[_0x25c6('0x7')](_0x25c6('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x25c6('0xd')]('/',auth['isAuthenticated'](),controller[_0x25c6('0xe')]);router[_0x25c6('0xf')]('/:id',auth[_0x25c6('0x8')](),controller[_0x25c6('0x10')]);router[_0x25c6('0x11')](_0x25c6('0x12'),auth['isAuthenticated'](),controller[_0x25c6('0x13')]);module[_0x25c6('0x14')]=router; \ No newline at end of file +var _0x7680=['get','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index'];(function(_0x3eca91,_0x37d7e5){var _0x5e79e3=function(_0x2b22d6){while(--_0x2b22d6){_0x3eca91['push'](_0x3eca91['shift']());}};_0x5e79e3(++_0x37d7e5);}(_0x7680,0x114));var _0x0768=function(_0x4a9771,_0x52429b){_0x4a9771=_0x4a9771-0x0;var _0x52e0ed=_0x7680[_0x4a9771];return _0x52e0ed;};'use strict';var multer=require(_0x0768('0x0'));var util=require(_0x0768('0x1'));var path=require(_0x0768('0x2'));var timeout=require(_0x0768('0x3'));var express=require(_0x0768('0x4'));var router=express[_0x0768('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0768('0x6'));var interaction=require(_0x0768('0x7'));var config=require(_0x0768('0x8'));var controller=require(_0x0768('0x9'));router['get']('/',auth[_0x0768('0xa')](),controller[_0x0768('0xb')]);router[_0x0768('0xc')](_0x0768('0xd'),auth[_0x0768('0xa')](),controller[_0x0768('0xe')]);router[_0x0768('0xc')](_0x0768('0xf'),auth[_0x0768('0xa')](),controller[_0x0768('0x10')]);router[_0x0768('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x0768('0xc')](_0x0768('0x11'),auth[_0x0768('0xa')](),controller[_0x0768('0x12')]);router[_0x0768('0x13')]('/',auth[_0x0768('0xa')](),controller['create']);router[_0x0768('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0768('0x15')]('/:id',auth[_0x0768('0xa')](),controller[_0x0768('0x16')]);module[_0x0768('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f7ac76a..2df5dcf 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 _0x4c22=['ENUM','lead','contact','nothing','contact_lead','STRING'];(function(_0x3d3fe5,_0x2fcf2b){var _0xb4ce88=function(_0x2fdb90){while(--_0x2fdb90){_0x3d3fe5['push'](_0x3d3fe5['shift']());}};_0xb4ce88(++_0x2fcf2b);}(_0x4c22,0x168));var _0x24c2=function(_0x41809b,_0x2fc9e9){_0x41809b=_0x41809b-0x0;var _0x2eb3d8=_0x4c22[_0x41809b];return _0x2eb3d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x24c2('0x0')](_0x24c2('0x1'),_0x24c2('0x2'),_0x24c2('0x3')),'defaultValue':_0x24c2('0x1')},'moduleSearch':{'type':Sequelize[_0x24c2('0x0')](_0x24c2('0x4'),_0x24c2('0x2'),_0x24c2('0x1')),'defaultValue':_0x24c2('0x4')},'description':{'type':Sequelize[_0x24c2('0x5')]}}; \ No newline at end of file +var _0x159f=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x154d79,_0x44cffc){var _0x147102=function(_0x5a1903){while(--_0x5a1903){_0x154d79['push'](_0x154d79['shift']());}};_0x147102(++_0x44cffc);}(_0x159f,0x10d));var _0xf159=function(_0x495ad4,_0x395df5){_0x495ad4=_0x495ad4-0x0;var _0x13b039=_0x159f[_0x495ad4];return _0x13b039;};'use strict';var Sequelize=require(_0xf159('0x0'));module[_0xf159('0x1')]={'name':{'type':Sequelize[_0xf159('0x2')]},'moduleCreate':{'type':Sequelize[_0xf159('0x3')](_0xf159('0x4'),_0xf159('0x5'),_0xf159('0x6')),'defaultValue':_0xf159('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xf159('0x7'),_0xf159('0x5'),'lead'),'defaultValue':_0xf159('0x7')},'description':{'type':Sequelize[_0xf159('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1ebb17d..e15c74b 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 _0x6e82=['find','destroy','getFields','ZohoField','pick','filter','nolimit','getSubjects','findOne','getDescriptions','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ZohoConfiguration','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','create','update','body'];(function(_0x5cc26b,_0x2d1c21){var _0x2d68e4=function(_0x5d2057){while(--_0x5d2057){_0x5cc26b['push'](_0x5cc26b['shift']());}};_0x2d68e4(++_0x2d1c21);}(_0x6e82,0x152));var _0x26e8=function(_0x2a5bb7,_0x3a0bf3){_0x2a5bb7=_0x2a5bb7-0x0;var _0x503330=_0x6e82[_0x2a5bb7];return _0x503330;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x26e8('0x0'));var jsonpatch=require(_0x26e8('0x1'));var rp=require('request-promise');var moment=require(_0x26e8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x26e8('0x3'));var util=require(_0x26e8('0x4'));var path=require(_0x26e8('0x5'));var sox=require(_0x26e8('0x6'));var csv=require(_0x26e8('0x7'));var ejs=require(_0x26e8('0x8'));var fs=require('fs');var fs_extra=require(_0x26e8('0x9'));var _=require(_0x26e8('0xa'));var squel=require(_0x26e8('0xb'));var crypto=require('crypto');var jsforce=require(_0x26e8('0xc'));var deskjs=require(_0x26e8('0xd'));var toCsv=require(_0x26e8('0x7'));var querystring=require('querystring');var Papa=require(_0x26e8('0xe'));var Redis=require(_0x26e8('0xf'));var authService=require(_0x26e8('0x10'));var qs=require(_0x26e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26e8('0x12'));var logger=require(_0x26e8('0x13'))(_0x26e8('0x14'));var utils=require(_0x26e8('0x15'));var config=require(_0x26e8('0x16'));var licenseUtil=require(_0x26e8('0x17'));var db=require(_0x26e8('0x18'))['db'];function respondWithStatusCode(_0x1c370f,_0x178396){_0x178396=_0x178396||0xcc;return function(_0xdb2213){if(_0xdb2213){return _0x1c370f[_0x26e8('0x19')](_0x178396);}return _0x1c370f[_0x26e8('0x1a')](_0x178396)[_0x26e8('0x1b')]();};}function respondWithResult(_0x150336,_0x2b57d0){_0x2b57d0=_0x2b57d0||0xc8;return function(_0x1fd5e1){if(_0x1fd5e1){return _0x150336[_0x26e8('0x1a')](_0x2b57d0)[_0x26e8('0x1c')](_0x1fd5e1);}};}function respondWithFilteredResult(_0x43601f,_0x4f5f10){return function(_0x1247dd){if(_0x1247dd){var _0x274d8f=typeof _0x4f5f10[_0x26e8('0x1d')]===_0x26e8('0x1e')&&typeof _0x4f5f10['limit']==='undefined';var _0x5f4d08=_0x1247dd[_0x26e8('0x1f')];var _0x565846=_0x274d8f?0x0:_0x4f5f10[_0x26e8('0x1d')];var _0x27af5f=_0x274d8f?_0x1247dd[_0x26e8('0x1f')]:_0x4f5f10[_0x26e8('0x1d')]+_0x4f5f10[_0x26e8('0x20')];var _0x40b191;if(_0x27af5f>=_0x5f4d08){_0x27af5f=_0x5f4d08;_0x40b191=0xc8;}else{_0x40b191=0xce;}_0x43601f[_0x26e8('0x1a')](_0x40b191);return _0x43601f[_0x26e8('0x21')](_0x26e8('0x22'),_0x565846+'-'+_0x27af5f+'/'+_0x5f4d08)[_0x26e8('0x1c')](_0x1247dd);}return null;};}function patchUpdates(_0x207248){return function(_0x35cf7c){try{jsonpatch[_0x26e8('0x23')](_0x35cf7c,_0x207248,!![]);}catch(_0x16f7dd){return BPromise[_0x26e8('0x24')](_0x16f7dd);}return _0x35cf7c[_0x26e8('0x25')]();};}function saveUpdates(_0x4550d2,_0x451f18){return function(_0x5264df){if(_0x5264df){return _0x5264df['update'](_0x4550d2)[_0x26e8('0x26')](function(_0x11b8b2){return _0x11b8b2;});}return null;};}function removeEntity(_0x13e15a,_0x16b8c3){return function(_0x1a0b2e){if(_0x1a0b2e){return _0x1a0b2e['destroy']()[_0x26e8('0x26')](function(){_0x13e15a[_0x26e8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4818b5,_0x3f192e){return function(_0x32c8b2){if(!_0x32c8b2){_0x4818b5[_0x26e8('0x19')](0x194);}return _0x32c8b2;};}function handleError(_0x533bba,_0x4a7b1c){_0x4a7b1c=_0x4a7b1c||0x1f4;return function(_0x293016){logger[_0x26e8('0x27')](_0x293016[_0x26e8('0x28')]);if(_0x293016[_0x26e8('0x29')]){delete _0x293016['name'];}_0x533bba[_0x26e8('0x1a')](_0x4a7b1c)[_0x26e8('0x2a')](_0x293016);};}exports[_0x26e8('0x2b')]=function(_0xace09d,_0xaf108e){var _0x34efb7={},_0x3cbf4f={},_0x1d7c46={'count':0x0,'rows':[]};var _0x57f033=_[_0x26e8('0x2c')](db[_0x26e8('0x2d')]['rawAttributes'],function(_0x436278){return{'name':_0x436278[_0x26e8('0x2e')],'type':_0x436278['type'][_0x26e8('0x2f')]};});_0x3cbf4f['model']=_[_0x26e8('0x2c')](_0x57f033,_0x26e8('0x29'));_0x3cbf4f[_0x26e8('0x30')]=_[_0x26e8('0x31')](_0xace09d['query']);_0x3cbf4f[_0x26e8('0x32')]=_[_0x26e8('0x33')](_0x3cbf4f[_0x26e8('0x34')],_0x3cbf4f[_0x26e8('0x30')]);_0x34efb7[_0x26e8('0x35')]=_[_0x26e8('0x33')](_0x3cbf4f[_0x26e8('0x34')],qs[_0x26e8('0x36')](_0xace09d[_0x26e8('0x30')][_0x26e8('0x36')]));_0x34efb7[_0x26e8('0x35')]=_0x34efb7['attributes'][_0x26e8('0x37')]?_0x34efb7['attributes']:_0x3cbf4f[_0x26e8('0x34')];if(!_0xace09d['query'][_0x26e8('0x38')]('nolimit')){_0x34efb7[_0x26e8('0x20')]=qs[_0x26e8('0x20')](_0xace09d[_0x26e8('0x30')][_0x26e8('0x20')]);_0x34efb7[_0x26e8('0x1d')]=qs[_0x26e8('0x1d')](_0xace09d[_0x26e8('0x30')][_0x26e8('0x1d')]);}_0x34efb7[_0x26e8('0x39')]=qs[_0x26e8('0x3a')](_0xace09d[_0x26e8('0x30')]['sort']);_0x34efb7[_0x26e8('0x3b')]=qs[_0x26e8('0x32')](_['pick'](_0xace09d[_0x26e8('0x30')],_0x3cbf4f[_0x26e8('0x32')]),_0x57f033);if(_0xace09d[_0x26e8('0x30')]['filter']){_0x34efb7['where']=_[_0x26e8('0x3c')](_0x34efb7['where'],{'$or':_[_0x26e8('0x2c')](_0x57f033,function(_0x92bef8){if(_0x92bef8['type']!==_0x26e8('0x3d')){var _0x4acc24={};_0x4acc24[_0x92bef8[_0x26e8('0x29')]]={'$like':'%'+_0xace09d[_0x26e8('0x30')]['filter']+'%'};return _0x4acc24;}})});}_0x34efb7=_[_0x26e8('0x3c')]({},_0x34efb7,_0xace09d[_0x26e8('0x3e')]);var _0x1fadaa={'where':_0x34efb7[_0x26e8('0x3b')]};return db[_0x26e8('0x2d')][_0x26e8('0x1f')](_0x1fadaa)[_0x26e8('0x26')](function(_0x5a8618){_0x1d7c46[_0x26e8('0x1f')]=_0x5a8618;if(_0xace09d[_0x26e8('0x30')][_0x26e8('0x3f')]){_0x34efb7['include']=[{'all':!![]}];}return db[_0x26e8('0x2d')][_0x26e8('0x40')](_0x34efb7);})['then'](function(_0x483e7f){_0x1d7c46['rows']=_0x483e7f;return _0x1d7c46;})[_0x26e8('0x26')](respondWithFilteredResult(_0xaf108e,_0x34efb7))[_0x26e8('0x41')](handleError(_0xaf108e,null));};exports[_0x26e8('0x42')]=function(_0x3f9995,_0x3bf458){var _0x325665={'raw':![],'where':{'id':_0x3f9995[_0x26e8('0x43')]['id']}},_0xfb6186={};_0xfb6186['model']=_[_0x26e8('0x31')](db['ZohoConfiguration'][_0x26e8('0x44')]);_0xfb6186[_0x26e8('0x30')]=_[_0x26e8('0x31')](_0x3f9995['query']);_0xfb6186[_0x26e8('0x32')]=_[_0x26e8('0x33')](_0xfb6186[_0x26e8('0x34')],_0xfb6186['query']);_0x325665['attributes']=_['intersection'](_0xfb6186[_0x26e8('0x34')],qs[_0x26e8('0x36')](_0x3f9995[_0x26e8('0x30')][_0x26e8('0x36')]));_0x325665[_0x26e8('0x35')]=_0x325665['attributes']['length']?_0x325665['attributes']:_0xfb6186['model'];if(_0x3f9995[_0x26e8('0x30')][_0x26e8('0x3f')]){_0x325665['include']=[{'all':!![]}];}_0x325665=_[_0x26e8('0x3c')]({},_0x325665,_0x3f9995[_0x26e8('0x3e')]);return db[_0x26e8('0x2d')]['find'](_0x325665)[_0x26e8('0x26')](handleEntityNotFound(_0x3bf458,null))[_0x26e8('0x26')](respondWithResult(_0x3bf458,null))['catch'](handleError(_0x3bf458,null));};exports['create']=function(_0x3acbed,_0x53d6c7){return db[_0x26e8('0x2d')][_0x26e8('0x45')](_0x3acbed['body'],{})[_0x26e8('0x26')](respondWithResult(_0x53d6c7,0xc9))[_0x26e8('0x41')](handleError(_0x53d6c7,null));};exports[_0x26e8('0x46')]=function(_0x571ea5,_0x24902f){if(_0x571ea5[_0x26e8('0x47')]['id']){delete _0x571ea5['body']['id'];}return db[_0x26e8('0x2d')][_0x26e8('0x48')]({'where':{'id':_0x571ea5[_0x26e8('0x43')]['id']}})[_0x26e8('0x26')](handleEntityNotFound(_0x24902f,null))[_0x26e8('0x26')](saveUpdates(_0x571ea5[_0x26e8('0x47')],null))[_0x26e8('0x26')](respondWithResult(_0x24902f,null))[_0x26e8('0x41')](handleError(_0x24902f,null));};exports[_0x26e8('0x49')]=function(_0x3afe06,_0x40523f){return db['ZohoConfiguration']['find']({'where':{'id':_0x3afe06[_0x26e8('0x43')]['id']}})[_0x26e8('0x26')](handleEntityNotFound(_0x40523f,null))['then'](removeEntity(_0x40523f,null))[_0x26e8('0x41')](handleError(_0x40523f,null));};exports[_0x26e8('0x4a')]=function(_0x4ad368,_0x2530e5,_0x4919f9){var _0x235176={};var _0x4a0a87={};var _0x18a061;var _0x49e039;return db[_0x26e8('0x2d')]['findOne']({'where':{'id':_0x4ad368[_0x26e8('0x43')]['id']}})[_0x26e8('0x26')](handleEntityNotFound(_0x2530e5,null))[_0x26e8('0x26')](function(_0x375628){if(_0x375628){_0x18a061=_0x375628;_0x4a0a87['model']=_['keys'](db[_0x26e8('0x4b')][_0x26e8('0x44')]);_0x4a0a87[_0x26e8('0x30')]=_[_0x26e8('0x31')](_0x4ad368[_0x26e8('0x30')]);_0x4a0a87['filters']=_[_0x26e8('0x33')](_0x4a0a87['model'],_0x4a0a87[_0x26e8('0x30')]);_0x235176[_0x26e8('0x35')]=_[_0x26e8('0x33')](_0x4a0a87[_0x26e8('0x34')],qs[_0x26e8('0x36')](_0x4ad368[_0x26e8('0x30')][_0x26e8('0x36')]));_0x235176[_0x26e8('0x35')]=_0x235176[_0x26e8('0x35')][_0x26e8('0x37')]?_0x235176[_0x26e8('0x35')]:_0x4a0a87[_0x26e8('0x34')];_0x235176[_0x26e8('0x39')]=qs[_0x26e8('0x3a')](_0x4ad368['query']['sort']);_0x235176[_0x26e8('0x3b')]=qs[_0x26e8('0x32')](_[_0x26e8('0x4c')](_0x4ad368[_0x26e8('0x30')],_0x4a0a87[_0x26e8('0x32')]));if(_0x4ad368[_0x26e8('0x30')][_0x26e8('0x4d')]){_0x235176[_0x26e8('0x3b')]=_[_0x26e8('0x3c')](_0x235176[_0x26e8('0x3b')],{'$or':_[_0x26e8('0x2c')](_0x235176['attributes'],function(_0x30c981){var _0x163672={};_0x163672[_0x30c981]={'$like':'%'+_0x4ad368[_0x26e8('0x30')]['filter']+'%'};return _0x163672;})});}_0x235176=_[_0x26e8('0x3c')]({},_0x235176,_0x4ad368['options']);return _0x18a061[_0x26e8('0x4a')](_0x235176);}})['then'](function(_0x50d05e){if(_0x50d05e){_0x49e039=_0x50d05e[_0x26e8('0x37')];if(!_0x4ad368[_0x26e8('0x30')][_0x26e8('0x38')](_0x26e8('0x4e'))){_0x235176[_0x26e8('0x20')]=qs[_0x26e8('0x20')](_0x4ad368[_0x26e8('0x30')]['limit']);_0x235176[_0x26e8('0x1d')]=qs[_0x26e8('0x1d')](_0x4ad368[_0x26e8('0x30')][_0x26e8('0x1d')]);}return _0x18a061[_0x26e8('0x4a')](_0x235176);}})[_0x26e8('0x26')](function(_0x23a55b){if(_0x23a55b){return _0x23a55b?{'count':_0x49e039,'rows':_0x23a55b}:null;}})[_0x26e8('0x26')](respondWithResult(_0x2530e5,null))[_0x26e8('0x41')](handleError(_0x2530e5,null));};exports[_0x26e8('0x4f')]=function(_0x11cc2c,_0x30be31,_0xbbfe31){var _0x54014c={};var _0x1a58d8={};var _0x2800de;var _0x4318f1;return db['ZohoConfiguration'][_0x26e8('0x50')]({'where':{'id':_0x11cc2c[_0x26e8('0x43')]['id']}})[_0x26e8('0x26')](handleEntityNotFound(_0x30be31,null))['then'](function(_0x172607){if(_0x172607){_0x2800de=_0x172607;_0x1a58d8[_0x26e8('0x34')]=_[_0x26e8('0x31')](db[_0x26e8('0x4b')][_0x26e8('0x44')]);_0x1a58d8['query']=_[_0x26e8('0x31')](_0x11cc2c['query']);_0x1a58d8[_0x26e8('0x32')]=_[_0x26e8('0x33')](_0x1a58d8[_0x26e8('0x34')],_0x1a58d8[_0x26e8('0x30')]);_0x54014c[_0x26e8('0x35')]=_[_0x26e8('0x33')](_0x1a58d8['model'],qs[_0x26e8('0x36')](_0x11cc2c[_0x26e8('0x30')][_0x26e8('0x36')]));_0x54014c[_0x26e8('0x35')]=_0x54014c[_0x26e8('0x35')]['length']?_0x54014c[_0x26e8('0x35')]:_0x1a58d8['model'];_0x54014c['order']=qs[_0x26e8('0x3a')](_0x11cc2c['query']['sort']);_0x54014c[_0x26e8('0x3b')]=qs[_0x26e8('0x32')](_[_0x26e8('0x4c')](_0x11cc2c['query'],_0x1a58d8[_0x26e8('0x32')]));if(_0x11cc2c[_0x26e8('0x30')][_0x26e8('0x4d')]){_0x54014c['where']=_[_0x26e8('0x3c')](_0x54014c['where'],{'$or':_[_0x26e8('0x2c')](_0x54014c[_0x26e8('0x35')],function(_0x18e0bb){var _0x5d2842={};_0x5d2842[_0x18e0bb]={'$like':'%'+_0x11cc2c[_0x26e8('0x30')][_0x26e8('0x4d')]+'%'};return _0x5d2842;})});}_0x54014c=_[_0x26e8('0x3c')]({},_0x54014c,_0x11cc2c['options']);return _0x2800de[_0x26e8('0x4f')](_0x54014c);}})[_0x26e8('0x26')](function(_0x14ff15){if(_0x14ff15){_0x4318f1=_0x14ff15[_0x26e8('0x37')];if(!_0x11cc2c[_0x26e8('0x30')]['hasOwnProperty'](_0x26e8('0x4e'))){_0x54014c[_0x26e8('0x20')]=qs[_0x26e8('0x20')](_0x11cc2c[_0x26e8('0x30')][_0x26e8('0x20')]);_0x54014c[_0x26e8('0x1d')]=qs['offset'](_0x11cc2c[_0x26e8('0x30')][_0x26e8('0x1d')]);}return _0x2800de[_0x26e8('0x4f')](_0x54014c);}})[_0x26e8('0x26')](function(_0x6b1cde){if(_0x6b1cde){return _0x6b1cde?{'count':_0x4318f1,'rows':_0x6b1cde}:null;}})[_0x26e8('0x26')](respondWithResult(_0x30be31,null))[_0x26e8('0x41')](handleError(_0x30be31,null));};exports['getDescriptions']=function(_0x5b994a,_0x14a0be,_0x388c77){var _0x4e9812={};var _0x370ec7={};var _0x206d71;var _0x3cd6d4;return db[_0x26e8('0x2d')][_0x26e8('0x50')]({'where':{'id':_0x5b994a[_0x26e8('0x43')]['id']}})[_0x26e8('0x26')](handleEntityNotFound(_0x14a0be,null))[_0x26e8('0x26')](function(_0x2220de){if(_0x2220de){_0x206d71=_0x2220de;_0x370ec7[_0x26e8('0x34')]=_[_0x26e8('0x31')](db[_0x26e8('0x4b')][_0x26e8('0x44')]);_0x370ec7[_0x26e8('0x30')]=_[_0x26e8('0x31')](_0x5b994a[_0x26e8('0x30')]);_0x370ec7[_0x26e8('0x32')]=_[_0x26e8('0x33')](_0x370ec7[_0x26e8('0x34')],_0x370ec7[_0x26e8('0x30')]);_0x4e9812[_0x26e8('0x35')]=_[_0x26e8('0x33')](_0x370ec7[_0x26e8('0x34')],qs[_0x26e8('0x36')](_0x5b994a[_0x26e8('0x30')]['fields']));_0x4e9812['attributes']=_0x4e9812[_0x26e8('0x35')][_0x26e8('0x37')]?_0x4e9812[_0x26e8('0x35')]:_0x370ec7[_0x26e8('0x34')];_0x4e9812[_0x26e8('0x39')]=qs['sort'](_0x5b994a[_0x26e8('0x30')][_0x26e8('0x3a')]);_0x4e9812['where']=qs[_0x26e8('0x32')](_[_0x26e8('0x4c')](_0x5b994a[_0x26e8('0x30')],_0x370ec7['filters']));if(_0x5b994a[_0x26e8('0x30')][_0x26e8('0x4d')]){_0x4e9812[_0x26e8('0x3b')]=_[_0x26e8('0x3c')](_0x4e9812['where'],{'$or':_['map'](_0x4e9812[_0x26e8('0x35')],function(_0x4ff30f){var _0x48eabb={};_0x48eabb[_0x4ff30f]={'$like':'%'+_0x5b994a[_0x26e8('0x30')][_0x26e8('0x4d')]+'%'};return _0x48eabb;})});}_0x4e9812=_[_0x26e8('0x3c')]({},_0x4e9812,_0x5b994a[_0x26e8('0x3e')]);return _0x206d71[_0x26e8('0x51')](_0x4e9812);}})['then'](function(_0x2931db){if(_0x2931db){_0x3cd6d4=_0x2931db[_0x26e8('0x37')];if(!_0x5b994a['query'][_0x26e8('0x38')](_0x26e8('0x4e'))){_0x4e9812[_0x26e8('0x20')]=qs['limit'](_0x5b994a[_0x26e8('0x30')]['limit']);_0x4e9812['offset']=qs[_0x26e8('0x1d')](_0x5b994a[_0x26e8('0x30')][_0x26e8('0x1d')]);}return _0x206d71[_0x26e8('0x51')](_0x4e9812);}})[_0x26e8('0x26')](function(_0x25f00b){if(_0x25f00b){return _0x25f00b?{'count':_0x3cd6d4,'rows':_0x25f00b}:null;}})[_0x26e8('0x26')](respondWithResult(_0x14a0be,null))[_0x26e8('0x41')](handleError(_0x14a0be,null));}; \ No newline at end of file +var _0x318e=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','ZohoConfiguration','findAll','catch','show','create','body','update','find','params','getFields','ZohoField','pick','nolimit','getSubjects','findOne','getDescriptions','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x112a22,_0x39cf24){var _0x3aeb98=function(_0x3235ee){while(--_0x3235ee){_0x112a22['push'](_0x112a22['shift']());}};_0x3aeb98(++_0x39cf24);}(_0x318e,0x112));var _0xe318=function(_0x483b1a,_0x157226){_0x483b1a=_0x483b1a-0x0;var _0x30eddd=_0x318e[_0x483b1a];return _0x30eddd;};'use strict';var emlformat=require(_0xe318('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe318('0x1'));var rp=require(_0xe318('0x2'));var moment=require('moment');var BPromise=require(_0xe318('0x3'));var Mustache=require('mustache');var util=require(_0xe318('0x4'));var path=require('path');var sox=require(_0xe318('0x5'));var csv=require(_0xe318('0x6'));var ejs=require(_0xe318('0x7'));var fs=require('fs');var fs_extra=require(_0xe318('0x8'));var _=require(_0xe318('0x9'));var squel=require(_0xe318('0xa'));var crypto=require(_0xe318('0xb'));var jsforce=require(_0xe318('0xc'));var deskjs=require(_0xe318('0xd'));var toCsv=require(_0xe318('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe318('0xe'));var qs=require(_0xe318('0xf'));var as=require(_0xe318('0x10'));var hardwareService=require(_0xe318('0x11'));var logger=require('../../config/logger')(_0xe318('0x12'));var utils=require(_0xe318('0x13'));var config=require(_0xe318('0x14'));var licenseUtil=require(_0xe318('0x15'));var db=require(_0xe318('0x16'))['db'];function respondWithStatusCode(_0x429a49,_0x3a3548){_0x3a3548=_0x3a3548||0xcc;return function(_0x48738c){if(_0x48738c){return _0x429a49['sendStatus'](_0x3a3548);}return _0x429a49[_0xe318('0x17')](_0x3a3548)[_0xe318('0x18')]();};}function respondWithResult(_0xb9c9b3,_0x354025){_0x354025=_0x354025||0xc8;return function(_0x492331){if(_0x492331){return _0xb9c9b3[_0xe318('0x17')](_0x354025)[_0xe318('0x19')](_0x492331);}};}function respondWithFilteredResult(_0x2c9f0b,_0x4df5f9){return function(_0x201b7c){if(_0x201b7c){var _0x1563f7=typeof _0x4df5f9['offset']==='undefined'&&typeof _0x4df5f9[_0xe318('0x1a')]===_0xe318('0x1b');var _0x25fe70=_0x201b7c[_0xe318('0x1c')];var _0x3a5f80=_0x1563f7?0x0:_0x4df5f9['offset'];var _0x48bab3=_0x1563f7?_0x201b7c[_0xe318('0x1c')]:_0x4df5f9[_0xe318('0x1d')]+_0x4df5f9[_0xe318('0x1a')];var _0xba21ed;if(_0x48bab3>=_0x25fe70){_0x48bab3=_0x25fe70;_0xba21ed=0xc8;}else{_0xba21ed=0xce;}_0x2c9f0b['status'](_0xba21ed);return _0x2c9f0b[_0xe318('0x1e')](_0xe318('0x1f'),_0x3a5f80+'-'+_0x48bab3+'/'+_0x25fe70)['json'](_0x201b7c);}return null;};}function patchUpdates(_0x6dbc0d){return function(_0x709910){try{jsonpatch[_0xe318('0x20')](_0x709910,_0x6dbc0d,!![]);}catch(_0x3a2ef5){return BPromise['reject'](_0x3a2ef5);}return _0x709910[_0xe318('0x21')]();};}function saveUpdates(_0x45e6bf,_0x46cb72){return function(_0x52468f){if(_0x52468f){return _0x52468f['update'](_0x45e6bf)[_0xe318('0x22')](function(_0xc16424){return _0xc16424;});}return null;};}function removeEntity(_0x4cb9af,_0x373135){return function(_0x4636b0){if(_0x4636b0){return _0x4636b0[_0xe318('0x23')]()[_0xe318('0x22')](function(){_0x4cb9af[_0xe318('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fba53,_0x1feba0){return function(_0xc73857){if(!_0xc73857){_0x1fba53[_0xe318('0x24')](0x194);}return _0xc73857;};}function handleError(_0x3f8937,_0x167376){_0x167376=_0x167376||0x1f4;return function(_0x315179){logger[_0xe318('0x25')](_0x315179[_0xe318('0x26')]);if(_0x315179[_0xe318('0x27')]){delete _0x315179[_0xe318('0x27')];}_0x3f8937[_0xe318('0x17')](_0x167376)[_0xe318('0x28')](_0x315179);};}exports[_0xe318('0x29')]=function(_0xf0059f,_0x425ee8){var _0x3d9dd4={},_0x132e76={},_0x30de45={'count':0x0,'rows':[]};var _0x50ee8b=_[_0xe318('0x2a')](db['ZohoConfiguration'][_0xe318('0x2b')],function(_0x12ccac){return{'name':_0x12ccac[_0xe318('0x2c')],'type':_0x12ccac[_0xe318('0x2d')]['key']};});_0x132e76['model']=_[_0xe318('0x2a')](_0x50ee8b,_0xe318('0x27'));_0x132e76[_0xe318('0x2e')]=_[_0xe318('0x2f')](_0xf0059f[_0xe318('0x2e')]);_0x132e76[_0xe318('0x30')]=_[_0xe318('0x31')](_0x132e76[_0xe318('0x32')],_0x132e76[_0xe318('0x2e')]);_0x3d9dd4[_0xe318('0x33')]=_[_0xe318('0x31')](_0x132e76[_0xe318('0x32')],qs[_0xe318('0x34')](_0xf0059f['query'][_0xe318('0x34')]));_0x3d9dd4[_0xe318('0x33')]=_0x3d9dd4[_0xe318('0x33')][_0xe318('0x35')]?_0x3d9dd4[_0xe318('0x33')]:_0x132e76[_0xe318('0x32')];if(!_0xf0059f[_0xe318('0x2e')][_0xe318('0x36')]('nolimit')){_0x3d9dd4[_0xe318('0x1a')]=qs[_0xe318('0x1a')](_0xf0059f['query'][_0xe318('0x1a')]);_0x3d9dd4[_0xe318('0x1d')]=qs['offset'](_0xf0059f['query'][_0xe318('0x1d')]);}_0x3d9dd4[_0xe318('0x37')]=qs[_0xe318('0x38')](_0xf0059f['query'][_0xe318('0x38')]);_0x3d9dd4[_0xe318('0x39')]=qs['filters'](_['pick'](_0xf0059f[_0xe318('0x2e')],_0x132e76[_0xe318('0x30')]),_0x50ee8b);if(_0xf0059f[_0xe318('0x2e')]['filter']){_0x3d9dd4[_0xe318('0x39')]=_[_0xe318('0x3a')](_0x3d9dd4[_0xe318('0x39')],{'$or':_['map'](_0x50ee8b,function(_0x1848fe){if(_0x1848fe[_0xe318('0x2d')]!==_0xe318('0x3b')){var _0x2b0dc8={};_0x2b0dc8[_0x1848fe[_0xe318('0x27')]]={'$like':'%'+_0xf0059f[_0xe318('0x2e')][_0xe318('0x3c')]+'%'};return _0x2b0dc8;}})});}_0x3d9dd4=_[_0xe318('0x3a')]({},_0x3d9dd4,_0xf0059f[_0xe318('0x3d')]);var _0x1a4e77={'where':_0x3d9dd4[_0xe318('0x39')]};return db['ZohoConfiguration']['count'](_0x1a4e77)[_0xe318('0x22')](function(_0x9969a1){_0x30de45['count']=_0x9969a1;if(_0xf0059f[_0xe318('0x2e')][_0xe318('0x3e')]){_0x3d9dd4[_0xe318('0x3f')]=[{'all':!![]}];}return db[_0xe318('0x40')][_0xe318('0x41')](_0x3d9dd4);})[_0xe318('0x22')](function(_0x37b0ef){_0x30de45['rows']=_0x37b0ef;return _0x30de45;})[_0xe318('0x22')](respondWithFilteredResult(_0x425ee8,_0x3d9dd4))[_0xe318('0x42')](handleError(_0x425ee8,null));};exports[_0xe318('0x43')]=function(_0x39506a,_0x5ec5ed){var _0x5e69b6={'raw':![],'where':{'id':_0x39506a['params']['id']}},_0x429b02={};_0x429b02[_0xe318('0x32')]=_[_0xe318('0x2f')](db[_0xe318('0x40')][_0xe318('0x2b')]);_0x429b02['query']=_['keys'](_0x39506a['query']);_0x429b02[_0xe318('0x30')]=_[_0xe318('0x31')](_0x429b02[_0xe318('0x32')],_0x429b02[_0xe318('0x2e')]);_0x5e69b6['attributes']=_[_0xe318('0x31')](_0x429b02[_0xe318('0x32')],qs['fields'](_0x39506a['query'][_0xe318('0x34')]));_0x5e69b6[_0xe318('0x33')]=_0x5e69b6['attributes'][_0xe318('0x35')]?_0x5e69b6[_0xe318('0x33')]:_0x429b02[_0xe318('0x32')];if(_0x39506a[_0xe318('0x2e')][_0xe318('0x3e')]){_0x5e69b6['include']=[{'all':!![]}];}_0x5e69b6=_[_0xe318('0x3a')]({},_0x5e69b6,_0x39506a[_0xe318('0x3d')]);return db[_0xe318('0x40')]['find'](_0x5e69b6)['then'](handleEntityNotFound(_0x5ec5ed,null))[_0xe318('0x22')](respondWithResult(_0x5ec5ed,null))[_0xe318('0x42')](handleError(_0x5ec5ed,null));};exports[_0xe318('0x44')]=function(_0x403484,_0x19d9a0){return db[_0xe318('0x40')][_0xe318('0x44')](_0x403484[_0xe318('0x45')],{})['then'](respondWithResult(_0x19d9a0,0xc9))[_0xe318('0x42')](handleError(_0x19d9a0,null));};exports[_0xe318('0x46')]=function(_0x1aef12,_0x42314f){if(_0x1aef12[_0xe318('0x45')]['id']){delete _0x1aef12[_0xe318('0x45')]['id'];}return db['ZohoConfiguration'][_0xe318('0x47')]({'where':{'id':_0x1aef12[_0xe318('0x48')]['id']}})['then'](handleEntityNotFound(_0x42314f,null))['then'](saveUpdates(_0x1aef12[_0xe318('0x45')],null))[_0xe318('0x22')](respondWithResult(_0x42314f,null))[_0xe318('0x42')](handleError(_0x42314f,null));};exports['destroy']=function(_0xb273f2,_0x5ab863){return db[_0xe318('0x40')][_0xe318('0x47')]({'where':{'id':_0xb273f2[_0xe318('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ab863,null))[_0xe318('0x22')](removeEntity(_0x5ab863,null))[_0xe318('0x42')](handleError(_0x5ab863,null));};exports[_0xe318('0x49')]=function(_0x11e565,_0x559646,_0x18cb7e){var _0x56a03e={};var _0x39f761={};var _0xac8da1;var _0x502e11;return db[_0xe318('0x40')]['findOne']({'where':{'id':_0x11e565['params']['id']}})[_0xe318('0x22')](handleEntityNotFound(_0x559646,null))[_0xe318('0x22')](function(_0x82c9f2){if(_0x82c9f2){_0xac8da1=_0x82c9f2;_0x39f761[_0xe318('0x32')]=_[_0xe318('0x2f')](db[_0xe318('0x4a')]['rawAttributes']);_0x39f761['query']=_[_0xe318('0x2f')](_0x11e565[_0xe318('0x2e')]);_0x39f761['filters']=_[_0xe318('0x31')](_0x39f761[_0xe318('0x32')],_0x39f761['query']);_0x56a03e[_0xe318('0x33')]=_[_0xe318('0x31')](_0x39f761[_0xe318('0x32')],qs[_0xe318('0x34')](_0x11e565[_0xe318('0x2e')][_0xe318('0x34')]));_0x56a03e['attributes']=_0x56a03e[_0xe318('0x33')][_0xe318('0x35')]?_0x56a03e['attributes']:_0x39f761['model'];_0x56a03e['order']=qs['sort'](_0x11e565['query'][_0xe318('0x38')]);_0x56a03e['where']=qs[_0xe318('0x30')](_[_0xe318('0x4b')](_0x11e565[_0xe318('0x2e')],_0x39f761[_0xe318('0x30')]));if(_0x11e565[_0xe318('0x2e')][_0xe318('0x3c')]){_0x56a03e[_0xe318('0x39')]=_[_0xe318('0x3a')](_0x56a03e[_0xe318('0x39')],{'$or':_[_0xe318('0x2a')](_0x56a03e[_0xe318('0x33')],function(_0x46de77){var _0x458fcb={};_0x458fcb[_0x46de77]={'$like':'%'+_0x11e565['query'][_0xe318('0x3c')]+'%'};return _0x458fcb;})});}_0x56a03e=_['merge']({},_0x56a03e,_0x11e565[_0xe318('0x3d')]);return _0xac8da1[_0xe318('0x49')](_0x56a03e);}})[_0xe318('0x22')](function(_0x14b19b){if(_0x14b19b){_0x502e11=_0x14b19b['length'];if(!_0x11e565[_0xe318('0x2e')]['hasOwnProperty'](_0xe318('0x4c'))){_0x56a03e[_0xe318('0x1a')]=qs[_0xe318('0x1a')](_0x11e565['query'][_0xe318('0x1a')]);_0x56a03e[_0xe318('0x1d')]=qs[_0xe318('0x1d')](_0x11e565[_0xe318('0x2e')]['offset']);}return _0xac8da1[_0xe318('0x49')](_0x56a03e);}})[_0xe318('0x22')](function(_0x1ed6c1){if(_0x1ed6c1){return _0x1ed6c1?{'count':_0x502e11,'rows':_0x1ed6c1}:null;}})[_0xe318('0x22')](respondWithResult(_0x559646,null))[_0xe318('0x42')](handleError(_0x559646,null));};exports[_0xe318('0x4d')]=function(_0x2b3c02,_0x18f92e,_0x4da71b){var _0x30a096={};var _0x5b337c={};var _0x3e7ec9;var _0x54f21e;return db[_0xe318('0x40')][_0xe318('0x4e')]({'where':{'id':_0x2b3c02[_0xe318('0x48')]['id']}})[_0xe318('0x22')](handleEntityNotFound(_0x18f92e,null))[_0xe318('0x22')](function(_0x32ec81){if(_0x32ec81){_0x3e7ec9=_0x32ec81;_0x5b337c[_0xe318('0x32')]=_[_0xe318('0x2f')](db[_0xe318('0x4a')][_0xe318('0x2b')]);_0x5b337c[_0xe318('0x2e')]=_['keys'](_0x2b3c02[_0xe318('0x2e')]);_0x5b337c[_0xe318('0x30')]=_['intersection'](_0x5b337c[_0xe318('0x32')],_0x5b337c[_0xe318('0x2e')]);_0x30a096[_0xe318('0x33')]=_[_0xe318('0x31')](_0x5b337c[_0xe318('0x32')],qs[_0xe318('0x34')](_0x2b3c02[_0xe318('0x2e')]['fields']));_0x30a096[_0xe318('0x33')]=_0x30a096[_0xe318('0x33')][_0xe318('0x35')]?_0x30a096[_0xe318('0x33')]:_0x5b337c[_0xe318('0x32')];_0x30a096[_0xe318('0x37')]=qs['sort'](_0x2b3c02[_0xe318('0x2e')][_0xe318('0x38')]);_0x30a096[_0xe318('0x39')]=qs['filters'](_[_0xe318('0x4b')](_0x2b3c02[_0xe318('0x2e')],_0x5b337c['filters']));if(_0x2b3c02[_0xe318('0x2e')][_0xe318('0x3c')]){_0x30a096[_0xe318('0x39')]=_['merge'](_0x30a096[_0xe318('0x39')],{'$or':_['map'](_0x30a096[_0xe318('0x33')],function(_0x361a5c){var _0x34d7eb={};_0x34d7eb[_0x361a5c]={'$like':'%'+_0x2b3c02[_0xe318('0x2e')][_0xe318('0x3c')]+'%'};return _0x34d7eb;})});}_0x30a096=_['merge']({},_0x30a096,_0x2b3c02[_0xe318('0x3d')]);return _0x3e7ec9[_0xe318('0x4d')](_0x30a096);}})[_0xe318('0x22')](function(_0x27fc1c){if(_0x27fc1c){_0x54f21e=_0x27fc1c['length'];if(!_0x2b3c02[_0xe318('0x2e')][_0xe318('0x36')](_0xe318('0x4c'))){_0x30a096[_0xe318('0x1a')]=qs['limit'](_0x2b3c02[_0xe318('0x2e')]['limit']);_0x30a096[_0xe318('0x1d')]=qs['offset'](_0x2b3c02[_0xe318('0x2e')][_0xe318('0x1d')]);}return _0x3e7ec9[_0xe318('0x4d')](_0x30a096);}})[_0xe318('0x22')](function(_0x174b61){if(_0x174b61){return _0x174b61?{'count':_0x54f21e,'rows':_0x174b61}:null;}})[_0xe318('0x22')](respondWithResult(_0x18f92e,null))['catch'](handleError(_0x18f92e,null));};exports[_0xe318('0x4f')]=function(_0x1f9c4b,_0x4da256,_0x16d09d){var _0x16b0a2={};var _0x280ca2={};var _0xee2289;var _0x1ad81b;return db[_0xe318('0x40')][_0xe318('0x4e')]({'where':{'id':_0x1f9c4b[_0xe318('0x48')]['id']}})[_0xe318('0x22')](handleEntityNotFound(_0x4da256,null))[_0xe318('0x22')](function(_0x49f4e6){if(_0x49f4e6){_0xee2289=_0x49f4e6;_0x280ca2[_0xe318('0x32')]=_[_0xe318('0x2f')](db[_0xe318('0x4a')][_0xe318('0x2b')]);_0x280ca2[_0xe318('0x2e')]=_[_0xe318('0x2f')](_0x1f9c4b[_0xe318('0x2e')]);_0x280ca2[_0xe318('0x30')]=_[_0xe318('0x31')](_0x280ca2[_0xe318('0x32')],_0x280ca2[_0xe318('0x2e')]);_0x16b0a2[_0xe318('0x33')]=_[_0xe318('0x31')](_0x280ca2[_0xe318('0x32')],qs[_0xe318('0x34')](_0x1f9c4b[_0xe318('0x2e')][_0xe318('0x34')]));_0x16b0a2[_0xe318('0x33')]=_0x16b0a2[_0xe318('0x33')][_0xe318('0x35')]?_0x16b0a2[_0xe318('0x33')]:_0x280ca2['model'];_0x16b0a2[_0xe318('0x37')]=qs['sort'](_0x1f9c4b[_0xe318('0x2e')][_0xe318('0x38')]);_0x16b0a2[_0xe318('0x39')]=qs[_0xe318('0x30')](_[_0xe318('0x4b')](_0x1f9c4b['query'],_0x280ca2[_0xe318('0x30')]));if(_0x1f9c4b[_0xe318('0x2e')][_0xe318('0x3c')]){_0x16b0a2['where']=_[_0xe318('0x3a')](_0x16b0a2[_0xe318('0x39')],{'$or':_[_0xe318('0x2a')](_0x16b0a2[_0xe318('0x33')],function(_0x19f8b2){var _0x67e0ea={};_0x67e0ea[_0x19f8b2]={'$like':'%'+_0x1f9c4b[_0xe318('0x2e')][_0xe318('0x3c')]+'%'};return _0x67e0ea;})});}_0x16b0a2=_[_0xe318('0x3a')]({},_0x16b0a2,_0x1f9c4b['options']);return _0xee2289[_0xe318('0x4f')](_0x16b0a2);}})['then'](function(_0x2ba23f){if(_0x2ba23f){_0x1ad81b=_0x2ba23f['length'];if(!_0x1f9c4b[_0xe318('0x2e')][_0xe318('0x36')](_0xe318('0x4c'))){_0x16b0a2[_0xe318('0x1a')]=qs['limit'](_0x1f9c4b[_0xe318('0x2e')]['limit']);_0x16b0a2['offset']=qs[_0xe318('0x1d')](_0x1f9c4b[_0xe318('0x2e')]['offset']);}return _0xee2289[_0xe318('0x4f')](_0x16b0a2);}})[_0xe318('0x22')](function(_0x178ad8){if(_0x178ad8){return _0x178ad8?{'count':_0x1ad81b,'rows':_0x178ad8}:null;}})[_0xe318('0x22')](respondWithResult(_0x4da256,null))[_0xe318('0x42')](handleError(_0x4da256,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 57bd112..659963c 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 _0xae4a=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4e61f1,_0x259acc){var _0x293660=function(_0x4844f3){while(--_0x4844f3){_0x4e61f1['push'](_0x4e61f1['shift']());}};_0x293660(++_0x259acc);}(_0xae4a,0x1b5));var _0xaae4=function(_0x25f5b8,_0x4de605){_0x25f5b8=_0x25f5b8-0x0;var _0x39779f=_0xae4a[_0x25f5b8];return _0x39779f;};'use strict';var _=require('lodash');var util=require(_0xaae4('0x0'));var logger=require(_0xaae4('0x1'))(_0xaae4('0x2'));var moment=require(_0xaae4('0x3'));var BPromise=require(_0xaae4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaae4('0x5'));var rimraf=require(_0xaae4('0x6'));var config=require('../../config/environment');var attributes=require(_0xaae4('0x7'));module[_0xaae4('0x8')]=function(_0x438fd9,_0x3ac318){return _0x438fd9[_0xaae4('0x9')](_0xaae4('0xa'),attributes,{'tableName':_0xaae4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd47=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','api','moment','bluebird','request-promise'];(function(_0x2745a7,_0x3f7774){var _0x310459=function(_0x5b875f){while(--_0x5b875f){_0x2745a7['push'](_0x2745a7['shift']());}};_0x310459(++_0x3f7774);}(_0xcd47,0x7d));var _0x7cd4=function(_0x1610a9,_0x12b812){_0x1610a9=_0x1610a9-0x0;var _0x33a66e=_0xcd47[_0x1610a9];return _0x33a66e;};'use strict';var _=require('lodash');var util=require(_0x7cd4('0x0'));var logger=require('../../config/logger')(_0x7cd4('0x1'));var moment=require(_0x7cd4('0x2'));var BPromise=require(_0x7cd4('0x3'));var rp=require(_0x7cd4('0x4'));var fs=require('fs');var path=require(_0x7cd4('0x5'));var rimraf=require(_0x7cd4('0x6'));var config=require(_0x7cd4('0x7'));var attributes=require(_0x7cd4('0x8'));module[_0x7cd4('0x9')]=function(_0xd2479d,_0x300823){return _0xd2479d[_0x7cd4('0xa')](_0x7cd4('0xb'),attributes,{'tableName':_0x7cd4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 62bb7cb..8f08979 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 _0x5405=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info'];(function(_0x1d0500,_0x395f37){var _0x145545=function(_0x3b5ab6){while(--_0x3b5ab6){_0x1d0500['push'](_0x1d0500['shift']());}};_0x145545(++_0x395f37);}(_0x5405,0x67));var _0x5540=function(_0x27787d,_0x3c832a){_0x27787d=_0x27787d-0x0;var _0x2ec19c=_0x5405[_0x27787d];return _0x2ec19c;};'use strict';var _=require(_0x5540('0x0'));var util=require(_0x5540('0x1'));var moment=require('moment');var BPromise=require(_0x5540('0x2'));var rs=require(_0x5540('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5540('0x4'))['db'];var utils=require(_0x5540('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5540('0x6'));var jayson=require(_0x5540('0x7'));var client=jayson['client'][_0x5540('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13611d,_0x57d44e,_0x47b753){return new BPromise(function(_0x2135e4,_0x1b8264){return client[_0x5540('0x9')](_0x13611d,_0x47b753)['then'](function(_0x15044b){logger[_0x5540('0xa')](_0x5540('0xb'),_0x57d44e,_0x5540('0xc'));logger[_0x5540('0xd')](_0x5540('0xe'),_0x57d44e,_0x5540('0xc'),JSON[_0x5540('0xf')](_0x15044b));if(_0x15044b[_0x5540('0x10')]){if(_0x15044b['error'][_0x5540('0x11')]===0x1f4){logger['error'](_0x5540('0xb'),_0x57d44e,_0x15044b[_0x5540('0x10')][_0x5540('0x12')]);return _0x1b8264(_0x15044b[_0x5540('0x10')][_0x5540('0x12')]);}logger['error'](_0x5540('0xb'),_0x57d44e,_0x15044b[_0x5540('0x10')][_0x5540('0x12')]);return _0x2135e4(_0x15044b[_0x5540('0x10')]['message']);}else{logger[_0x5540('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x57d44e,_0x5540('0xc'));_0x2135e4(_0x15044b['result']['message']);}})['catch'](function(_0x396a2c){logger[_0x5540('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x57d44e,_0x396a2c);_0x1b8264(_0x396a2c);});});} \ No newline at end of file +var _0x68b5=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x68b5,0x130));var _0x568b=function(_0xe1ded3,_0x1544ad){_0xe1ded3=_0xe1ded3-0x0;var _0xd51ced=_0x68b5[_0xe1ded3];return _0xd51ced;};'use strict';var _=require(_0x568b('0x0'));var util=require(_0x568b('0x1'));var moment=require(_0x568b('0x2'));var BPromise=require('bluebird');var rs=require(_0x568b('0x3'));var fs=require('fs');var Redis=require(_0x568b('0x4'));var db=require(_0x568b('0x5'))['db'];var utils=require(_0x568b('0x6'));var logger=require(_0x568b('0x7'))(_0x568b('0x8'));var config=require(_0x568b('0x9'));var jayson=require(_0x568b('0xa'));var client=jayson[_0x568b('0xb')][_0x568b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10bd76,_0x32e0b1,_0xcdcb6f){return new BPromise(function(_0x5108d8,_0x5da4c2){return client[_0x568b('0xd')](_0x10bd76,_0xcdcb6f)[_0x568b('0xe')](function(_0x2f5926){logger[_0x568b('0xf')](_0x568b('0x10'),_0x32e0b1,_0x568b('0x11'));logger[_0x568b('0x12')](_0x568b('0x13'),_0x32e0b1,_0x568b('0x11'),JSON['stringify'](_0x2f5926));if(_0x2f5926[_0x568b('0x14')]){if(_0x2f5926[_0x568b('0x14')]['code']===0x1f4){logger[_0x568b('0x14')](_0x568b('0x10'),_0x32e0b1,_0x2f5926[_0x568b('0x14')][_0x568b('0x15')]);return _0x5da4c2(_0x2f5926[_0x568b('0x14')][_0x568b('0x15')]);}logger[_0x568b('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x32e0b1,_0x2f5926[_0x568b('0x14')]['message']);return _0x5108d8(_0x2f5926[_0x568b('0x14')][_0x568b('0x15')]);}else{logger[_0x568b('0xf')](_0x568b('0x10'),_0x32e0b1,_0x568b('0x11'));_0x5108d8(_0x2f5926['result']['message']);}})[_0x568b('0x16')](function(_0x476753){logger['error'](_0x568b('0x10'),_0x32e0b1,_0x476753);_0x5da4c2(_0x476753);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index efd805d..6aa92fe 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 _0xe142=['put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create'];(function(_0x41270b,_0x5db444){var _0x2b6090=function(_0x23e7e0){while(--_0x23e7e0){_0x41270b['push'](_0x41270b['shift']());}};_0x2b6090(++_0x5db444);}(_0xe142,0xed));var _0x2e14=function(_0x505766,_0x4d4a04){_0x505766=_0x505766-0x0;var _0x429123=_0xe142[_0x505766];return _0x429123;};'use strict';var multer=require(_0x2e14('0x0'));var util=require(_0x2e14('0x1'));var path=require('path');var timeout=require(_0x2e14('0x2'));var express=require(_0x2e14('0x3'));var router=express[_0x2e14('0x4')]();var fs_extra=require(_0x2e14('0x5'));var auth=require(_0x2e14('0x6'));var interaction=require(_0x2e14('0x7'));var config=require(_0x2e14('0x8'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x2e14('0x9')](),controller['index']);router[_0x2e14('0xa')](_0x2e14('0xb'),auth[_0x2e14('0x9')](),controller[_0x2e14('0xc')]);router[_0x2e14('0xd')]('/',auth[_0x2e14('0x9')](),controller[_0x2e14('0xe')]);router[_0x2e14('0xf')](_0x2e14('0xb'),auth[_0x2e14('0x9')](),controller['update']);router[_0x2e14('0x10')](_0x2e14('0xb'),auth['isAuthenticated'](),controller[_0x2e14('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6d7a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','index','isAuthenticated','show','post','create','/:id','update','destroy','exports','util','path'];(function(_0x466c69,_0x3e0106){var _0x25b2c9=function(_0x2112d3){while(--_0x2112d3){_0x466c69['push'](_0x466c69['shift']());}};_0x25b2c9(++_0x3e0106);}(_0x6d7a,0x70));var _0xa6d7=function(_0x4b4756,_0x4fbd44){_0x4b4756=_0x4b4756-0x0;var _0x3bce27=_0x6d7a[_0x4b4756];return _0x3bce27;};'use strict';var multer=require('multer');var util=require(_0xa6d7('0x0'));var path=require(_0xa6d7('0x1'));var timeout=require(_0xa6d7('0x2'));var express=require(_0xa6d7('0x3'));var router=express[_0xa6d7('0x4')]();var fs_extra=require(_0xa6d7('0x5'));var auth=require(_0xa6d7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa6d7('0x7'));var controller=require(_0xa6d7('0x8'));router[_0xa6d7('0x9')]('/',auth['isAuthenticated'](),controller[_0xa6d7('0xa')]);router[_0xa6d7('0x9')]('/:id',auth[_0xa6d7('0xb')](),controller[_0xa6d7('0xc')]);router[_0xa6d7('0xd')]('/',auth[_0xa6d7('0xb')](),controller[_0xa6d7('0xe')]);router['put'](_0xa6d7('0xf'),auth[_0xa6d7('0xb')](),controller[_0xa6d7('0x10')]);router['delete'](_0xa6d7('0xf'),auth['isAuthenticated'](),controller[_0xa6d7('0x11')]);module[_0xa6d7('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 cff9227..cb53178 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 _0xc097=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x507a87,_0x11207d){var _0x5a1c9d=function(_0x4473ca){while(--_0x4473ca){_0x507a87['push'](_0x507a87['shift']());}};_0x5a1c9d(++_0x11207d);}(_0xc097,0xae));var _0x7c09=function(_0xf82f2b,_0x59e0bb){_0xf82f2b=_0xf82f2b-0x0;var _0x16415c=_0xc097[_0xf82f2b];return _0x16415c;};'use strict';var Sequelize=require('sequelize');module[_0x7c09('0x0')]={'type':{'type':Sequelize[_0x7c09('0x1')](_0x7c09('0x2'),_0x7c09('0x3'),_0x7c09('0x4'),_0x7c09('0x5'),_0x7c09('0x6')),'defaultValue':_0x7c09('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7c09('0x1')](_0x7c09('0x2'),_0x7c09('0x3'),_0x7c09('0x4'))},'keyContent':{'type':Sequelize[_0x7c09('0x7')]},'idField':{'type':Sequelize[_0x7c09('0x7')]},'nameField':{'type':Sequelize[_0x7c09('0x7')]},'customField':{'type':Sequelize[_0x7c09('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c09('0x7')]}}; \ No newline at end of file +var _0x7451=['STRING','customVariable','sequelize','ENUM','string','variable','keyValue','picklist'];(function(_0x47f072,_0x3393b2){var _0xd019b5=function(_0x3b2c90){while(--_0x3b2c90){_0x47f072['push'](_0x47f072['shift']());}};_0xd019b5(++_0x3393b2);}(_0x7451,0x14a));var _0x1745=function(_0xf4c51e,_0x2b404d){_0xf4c51e=_0xf4c51e-0x0;var _0x59c56d=_0x7451[_0xf4c51e];return _0x59c56d;};'use strict';var Sequelize=require(_0x1745('0x0'));module['exports']={'type':{'type':Sequelize[_0x1745('0x1')](_0x1745('0x2'),_0x1745('0x3'),'customVariable',_0x1745('0x4'),_0x1745('0x5')),'defaultValue':_0x1745('0x2')},'content':{'type':Sequelize[_0x1745('0x6')]},'key':{'type':Sequelize[_0x1745('0x6')]},'keyType':{'type':Sequelize[_0x1745('0x1')](_0x1745('0x2'),_0x1745('0x3'),_0x1745('0x7'))},'keyContent':{'type':Sequelize[_0x1745('0x6')]},'idField':{'type':Sequelize[_0x1745('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6fa4c6a..11cc8ea 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 _0x7647=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','name','merge','options','ZohoField','include','findAll','rows','catch','rawAttributes','includeAll','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3e81a6,_0xd4e7d7){var _0x3fc033=function(_0x3dc930){while(--_0x3dc930){_0x3e81a6['push'](_0x3e81a6['shift']());}};_0x3fc033(++_0xd4e7d7);}(_0x7647,0x12d));var _0x7764=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7647[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x7764('0x0'));var rimraf=require(_0x7764('0x1'));var zipdir=require(_0x7764('0x2'));var jsonpatch=require(_0x7764('0x3'));var rp=require(_0x7764('0x4'));var moment=require(_0x7764('0x5'));var BPromise=require(_0x7764('0x6'));var Mustache=require(_0x7764('0x7'));var util=require(_0x7764('0x8'));var path=require(_0x7764('0x9'));var sox=require(_0x7764('0xa'));var csv=require(_0x7764('0xb'));var ejs=require(_0x7764('0xc'));var fs=require('fs');var fs_extra=require(_0x7764('0xd'));var _=require(_0x7764('0xe'));var squel=require(_0x7764('0xf'));var crypto=require(_0x7764('0x10'));var jsforce=require(_0x7764('0x11'));var deskjs=require(_0x7764('0x12'));var toCsv=require('to-csv');var querystring=require(_0x7764('0x13'));var Papa=require(_0x7764('0x14'));var Redis=require(_0x7764('0x15'));var authService=require(_0x7764('0x16'));var qs=require(_0x7764('0x17'));var as=require(_0x7764('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7764('0x19'));var config=require(_0x7764('0x1a'));var licenseUtil=require(_0x7764('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x552656,_0x356aca){_0x356aca=_0x356aca||0xcc;return function(_0x20d42d){if(_0x20d42d){return _0x552656[_0x7764('0x1c')](_0x356aca);}return _0x552656['status'](_0x356aca)[_0x7764('0x1d')]();};}function respondWithResult(_0x4a9d67,_0x15827f){_0x15827f=_0x15827f||0xc8;return function(_0x450dea){if(_0x450dea){return _0x4a9d67[_0x7764('0x1e')](_0x15827f)[_0x7764('0x1f')](_0x450dea);}};}function respondWithFilteredResult(_0x1881ac,_0x150f54){return function(_0x291d3b){if(_0x291d3b){var _0x2c162e=typeof _0x150f54[_0x7764('0x20')]===_0x7764('0x21')&&typeof _0x150f54['limit']===_0x7764('0x21');var _0x51f8cc=_0x291d3b[_0x7764('0x22')];var _0x64509f=_0x2c162e?0x0:_0x150f54[_0x7764('0x20')];var _0x440b9d=_0x2c162e?_0x291d3b['count']:_0x150f54[_0x7764('0x20')]+_0x150f54['limit'];var _0x19a4f7;if(_0x440b9d>=_0x51f8cc){_0x440b9d=_0x51f8cc;_0x19a4f7=0xc8;}else{_0x19a4f7=0xce;}_0x1881ac[_0x7764('0x1e')](_0x19a4f7);return _0x1881ac['set'](_0x7764('0x23'),_0x64509f+'-'+_0x440b9d+'/'+_0x51f8cc)[_0x7764('0x1f')](_0x291d3b);}return null;};}function patchUpdates(_0x1652db){return function(_0x2917eb){try{jsonpatch['apply'](_0x2917eb,_0x1652db,!![]);}catch(_0x504f92){return BPromise[_0x7764('0x24')](_0x504f92);}return _0x2917eb[_0x7764('0x25')]();};}function saveUpdates(_0x53b96e,_0x39415f){return function(_0x235b99){if(_0x235b99){return _0x235b99[_0x7764('0x26')](_0x53b96e)[_0x7764('0x27')](function(_0x27df2b){return _0x27df2b;});}return null;};}function removeEntity(_0xa338f0,_0x59da12){return function(_0x2e4636){if(_0x2e4636){return _0x2e4636[_0x7764('0x28')]()[_0x7764('0x27')](function(){_0xa338f0['status'](0xcc)[_0x7764('0x1d')]();});}};}function handleEntityNotFound(_0x45d090,_0x1e93a5){return function(_0x2e8a2f){if(!_0x2e8a2f){_0x45d090[_0x7764('0x1c')](0x194);}return _0x2e8a2f;};}function handleError(_0x334c16,_0x39087d){_0x39087d=_0x39087d||0x1f4;return function(_0x56c2f7){logger[_0x7764('0x29')](_0x56c2f7[_0x7764('0x2a')]);if(_0x56c2f7['name']){delete _0x56c2f7['name'];}_0x334c16['status'](_0x39087d)[_0x7764('0x2b')](_0x56c2f7);};}exports[_0x7764('0x2c')]=function(_0x533c94,_0x212c42){var _0x33eee8={},_0x297cb1={},_0x43e6fb={'count':0x0,'rows':[]};var _0x5cf41a=_[_0x7764('0x2d')](db['ZohoField']['rawAttributes'],function(_0x419d14){return{'name':_0x419d14[_0x7764('0x2e')],'type':_0x419d14[_0x7764('0x2f')][_0x7764('0x30')]};});_0x297cb1[_0x7764('0x31')]=_[_0x7764('0x2d')](_0x5cf41a,'name');_0x297cb1['query']=_[_0x7764('0x32')](_0x533c94[_0x7764('0x33')]);_0x297cb1[_0x7764('0x34')]=_[_0x7764('0x35')](_0x297cb1[_0x7764('0x31')],_0x297cb1[_0x7764('0x33')]);_0x33eee8[_0x7764('0x36')]=_['intersection'](_0x297cb1[_0x7764('0x31')],qs[_0x7764('0x37')](_0x533c94[_0x7764('0x33')][_0x7764('0x37')]));_0x33eee8['attributes']=_0x33eee8[_0x7764('0x36')][_0x7764('0x38')]?_0x33eee8[_0x7764('0x36')]:_0x297cb1['model'];if(!_0x533c94[_0x7764('0x33')]['hasOwnProperty'](_0x7764('0x39'))){_0x33eee8[_0x7764('0x3a')]=qs[_0x7764('0x3a')](_0x533c94['query'][_0x7764('0x3a')]);_0x33eee8[_0x7764('0x20')]=qs[_0x7764('0x20')](_0x533c94[_0x7764('0x33')][_0x7764('0x20')]);}_0x33eee8[_0x7764('0x3b')]=qs[_0x7764('0x3c')](_0x533c94['query'][_0x7764('0x3c')]);_0x33eee8['where']=qs[_0x7764('0x34')](_[_0x7764('0x3d')](_0x533c94[_0x7764('0x33')],_0x297cb1[_0x7764('0x34')]),_0x5cf41a);if(_0x533c94[_0x7764('0x33')][_0x7764('0x3e')]){_0x33eee8[_0x7764('0x3f')]=_['merge'](_0x33eee8[_0x7764('0x3f')],{'$or':_[_0x7764('0x2d')](_0x5cf41a,function(_0x47d8bb){if(_0x47d8bb['type']!==_0x7764('0x40')){var _0x2f6818={};_0x2f6818[_0x47d8bb[_0x7764('0x41')]]={'$like':'%'+_0x533c94[_0x7764('0x33')]['filter']+'%'};return _0x2f6818;}})});}_0x33eee8=_[_0x7764('0x42')]({},_0x33eee8,_0x533c94[_0x7764('0x43')]);var _0x23f19d={'where':_0x33eee8['where']};return db[_0x7764('0x44')][_0x7764('0x22')](_0x23f19d)['then'](function(_0x339d68){_0x43e6fb[_0x7764('0x22')]=_0x339d68;if(_0x533c94[_0x7764('0x33')]['includeAll']){_0x33eee8[_0x7764('0x45')]=[{'all':!![]}];}return db[_0x7764('0x44')][_0x7764('0x46')](_0x33eee8);})[_0x7764('0x27')](function(_0x52de20){_0x43e6fb[_0x7764('0x47')]=_0x52de20;return _0x43e6fb;})[_0x7764('0x27')](respondWithFilteredResult(_0x212c42,_0x33eee8))[_0x7764('0x48')](handleError(_0x212c42,null));};exports['show']=function(_0x3533a5,_0x434605){var _0x2992fa={'raw':!![],'where':{'id':_0x3533a5['params']['id']}},_0x48d128={};_0x48d128['model']=_[_0x7764('0x32')](db[_0x7764('0x44')][_0x7764('0x49')]);_0x48d128[_0x7764('0x33')]=_['keys'](_0x3533a5[_0x7764('0x33')]);_0x48d128[_0x7764('0x34')]=_[_0x7764('0x35')](_0x48d128[_0x7764('0x31')],_0x48d128['query']);_0x2992fa[_0x7764('0x36')]=_[_0x7764('0x35')](_0x48d128['model'],qs[_0x7764('0x37')](_0x3533a5[_0x7764('0x33')]['fields']));_0x2992fa[_0x7764('0x36')]=_0x2992fa['attributes'][_0x7764('0x38')]?_0x2992fa[_0x7764('0x36')]:_0x48d128[_0x7764('0x31')];if(_0x3533a5[_0x7764('0x33')][_0x7764('0x4a')]){_0x2992fa[_0x7764('0x45')]=[{'all':!![]}];}_0x2992fa=_[_0x7764('0x42')]({},_0x2992fa,_0x3533a5[_0x7764('0x43')]);return db[_0x7764('0x44')]['find'](_0x2992fa)['then'](handleEntityNotFound(_0x434605,null))[_0x7764('0x27')](respondWithResult(_0x434605,null))[_0x7764('0x48')](handleError(_0x434605,null));};exports[_0x7764('0x4b')]=function(_0x166fe5,_0x260ba8){return db[_0x7764('0x44')]['create'](_0x166fe5[_0x7764('0x4c')],{})[_0x7764('0x27')](respondWithResult(_0x260ba8,0xc9))[_0x7764('0x48')](handleError(_0x260ba8,null));};exports[_0x7764('0x26')]=function(_0x24e742,_0x38dbd8){if(_0x24e742[_0x7764('0x4c')]['id']){delete _0x24e742[_0x7764('0x4c')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x24e742[_0x7764('0x4d')]['id']}})[_0x7764('0x27')](handleEntityNotFound(_0x38dbd8,null))[_0x7764('0x27')](saveUpdates(_0x24e742[_0x7764('0x4c')],null))[_0x7764('0x27')](respondWithResult(_0x38dbd8,null))[_0x7764('0x48')](handleError(_0x38dbd8,null));};exports[_0x7764('0x28')]=function(_0x1264ac,_0x5d364f){return db['ZohoField'][_0x7764('0x4e')]({'where':{'id':_0x1264ac[_0x7764('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d364f,null))[_0x7764('0x27')](removeEntity(_0x5d364f,null))[_0x7764('0x48')](handleError(_0x5d364f,null));}; \ No newline at end of file +var _0x6199=['to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','params','keys','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox'];(function(_0x418e01,_0x45d002){var _0x1af23c=function(_0x17706e){while(--_0x17706e){_0x418e01['push'](_0x418e01['shift']());}};_0x1af23c(++_0x45d002);}(_0x6199,0xc8));var _0x9619=function(_0x57d080,_0x4a3928){_0x57d080=_0x57d080-0x0;var _0x57339c=_0x6199[_0x57d080];return _0x57339c;};'use strict';var emlformat=require(_0x9619('0x0'));var rimraf=require(_0x9619('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9619('0x2'));var rp=require('request-promise');var moment=require(_0x9619('0x3'));var BPromise=require(_0x9619('0x4'));var Mustache=require(_0x9619('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9619('0x6'));var csv=require(_0x9619('0x7'));var ejs=require(_0x9619('0x8'));var fs=require('fs');var fs_extra=require(_0x9619('0x9'));var _=require(_0x9619('0xa'));var squel=require(_0x9619('0xb'));var crypto=require('crypto');var jsforce=require(_0x9619('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9619('0x7'));var querystring=require(_0x9619('0xd'));var Papa=require(_0x9619('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9619('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9619('0x10'));var config=require(_0x9619('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x9619('0x12'))['db'];function respondWithStatusCode(_0x327f62,_0x25bf7e){_0x25bf7e=_0x25bf7e||0xcc;return function(_0x1f936e){if(_0x1f936e){return _0x327f62['sendStatus'](_0x25bf7e);}return _0x327f62[_0x9619('0x13')](_0x25bf7e)[_0x9619('0x14')]();};}function respondWithResult(_0x45139f,_0xbdd5fe){_0xbdd5fe=_0xbdd5fe||0xc8;return function(_0x146d70){if(_0x146d70){return _0x45139f[_0x9619('0x13')](_0xbdd5fe)[_0x9619('0x15')](_0x146d70);}};}function respondWithFilteredResult(_0x2fd258,_0x29ad87){return function(_0x672a6a){if(_0x672a6a){var _0x599a7f=typeof _0x29ad87['offset']===_0x9619('0x16')&&typeof _0x29ad87[_0x9619('0x17')]===_0x9619('0x16');var _0x41be48=_0x672a6a[_0x9619('0x18')];var _0x5b61eb=_0x599a7f?0x0:_0x29ad87[_0x9619('0x19')];var _0x1b79bb=_0x599a7f?_0x672a6a[_0x9619('0x18')]:_0x29ad87[_0x9619('0x19')]+_0x29ad87[_0x9619('0x17')];var _0xb74522;if(_0x1b79bb>=_0x41be48){_0x1b79bb=_0x41be48;_0xb74522=0xc8;}else{_0xb74522=0xce;}_0x2fd258[_0x9619('0x13')](_0xb74522);return _0x2fd258[_0x9619('0x1a')]('Content-Range',_0x5b61eb+'-'+_0x1b79bb+'/'+_0x41be48)[_0x9619('0x15')](_0x672a6a);}return null;};}function patchUpdates(_0x4256d9){return function(_0x47c26b){try{jsonpatch[_0x9619('0x1b')](_0x47c26b,_0x4256d9,!![]);}catch(_0x78917){return BPromise[_0x9619('0x1c')](_0x78917);}return _0x47c26b[_0x9619('0x1d')]();};}function saveUpdates(_0x53f235,_0x5e52e2){return function(_0xd93e75){if(_0xd93e75){return _0xd93e75[_0x9619('0x1e')](_0x53f235)[_0x9619('0x1f')](function(_0x407f65){return _0x407f65;});}return null;};}function removeEntity(_0x552eed,_0x4e4523){return function(_0x26d159){if(_0x26d159){return _0x26d159[_0x9619('0x20')]()[_0x9619('0x1f')](function(){_0x552eed[_0x9619('0x13')](0xcc)[_0x9619('0x14')]();});}};}function handleEntityNotFound(_0x9eba09,_0x2fe8a9){return function(_0x6d51c0){if(!_0x6d51c0){_0x9eba09[_0x9619('0x21')](0x194);}return _0x6d51c0;};}function handleError(_0xdb1508,_0x2b69e7){_0x2b69e7=_0x2b69e7||0x1f4;return function(_0x295203){logger[_0x9619('0x22')](_0x295203['stack']);if(_0x295203[_0x9619('0x23')]){delete _0x295203['name'];}_0xdb1508[_0x9619('0x13')](_0x2b69e7)[_0x9619('0x24')](_0x295203);};}exports[_0x9619('0x25')]=function(_0x34412e,_0x27af18){var _0x1ca2d5={},_0x496db5={},_0x4a446b={'count':0x0,'rows':[]};var _0x4d3b4e=_[_0x9619('0x26')](db['ZohoField']['rawAttributes'],function(_0x3a73bb){return{'name':_0x3a73bb[_0x9619('0x27')],'type':_0x3a73bb[_0x9619('0x28')][_0x9619('0x29')]};});_0x496db5[_0x9619('0x2a')]=_[_0x9619('0x26')](_0x4d3b4e,_0x9619('0x23'));_0x496db5['query']=_['keys'](_0x34412e[_0x9619('0x2b')]);_0x496db5['filters']=_[_0x9619('0x2c')](_0x496db5[_0x9619('0x2a')],_0x496db5[_0x9619('0x2b')]);_0x1ca2d5['attributes']=_['intersection'](_0x496db5[_0x9619('0x2a')],qs[_0x9619('0x2d')](_0x34412e[_0x9619('0x2b')][_0x9619('0x2d')]));_0x1ca2d5['attributes']=_0x1ca2d5['attributes'][_0x9619('0x2e')]?_0x1ca2d5[_0x9619('0x2f')]:_0x496db5['model'];if(!_0x34412e[_0x9619('0x2b')][_0x9619('0x30')](_0x9619('0x31'))){_0x1ca2d5[_0x9619('0x17')]=qs['limit'](_0x34412e[_0x9619('0x2b')][_0x9619('0x17')]);_0x1ca2d5[_0x9619('0x19')]=qs[_0x9619('0x19')](_0x34412e[_0x9619('0x2b')][_0x9619('0x19')]);}_0x1ca2d5[_0x9619('0x32')]=qs[_0x9619('0x33')](_0x34412e[_0x9619('0x2b')][_0x9619('0x33')]);_0x1ca2d5[_0x9619('0x34')]=qs['filters'](_[_0x9619('0x35')](_0x34412e[_0x9619('0x2b')],_0x496db5[_0x9619('0x36')]),_0x4d3b4e);if(_0x34412e['query'][_0x9619('0x37')]){_0x1ca2d5['where']=_['merge'](_0x1ca2d5[_0x9619('0x34')],{'$or':_[_0x9619('0x26')](_0x4d3b4e,function(_0x39d4c5){if(_0x39d4c5['type']!==_0x9619('0x38')){var _0x22ce98={};_0x22ce98[_0x39d4c5[_0x9619('0x23')]]={'$like':'%'+_0x34412e['query'][_0x9619('0x37')]+'%'};return _0x22ce98;}})});}_0x1ca2d5=_['merge']({},_0x1ca2d5,_0x34412e[_0x9619('0x39')]);var _0x177e7e={'where':_0x1ca2d5[_0x9619('0x34')]};return db[_0x9619('0x3a')][_0x9619('0x18')](_0x177e7e)[_0x9619('0x1f')](function(_0x531c47){_0x4a446b[_0x9619('0x18')]=_0x531c47;if(_0x34412e[_0x9619('0x2b')][_0x9619('0x3b')]){_0x1ca2d5[_0x9619('0x3c')]=[{'all':!![]}];}return db[_0x9619('0x3a')][_0x9619('0x3d')](_0x1ca2d5);})[_0x9619('0x1f')](function(_0x146bd1){_0x4a446b[_0x9619('0x3e')]=_0x146bd1;return _0x4a446b;})[_0x9619('0x1f')](respondWithFilteredResult(_0x27af18,_0x1ca2d5))[_0x9619('0x3f')](handleError(_0x27af18,null));};exports['show']=function(_0x5a0268,_0x39a3c9){var _0x1e4507={'raw':!![],'where':{'id':_0x5a0268[_0x9619('0x40')]['id']}},_0x208854={};_0x208854[_0x9619('0x2a')]=_[_0x9619('0x41')](db[_0x9619('0x3a')]['rawAttributes']);_0x208854[_0x9619('0x2b')]=_['keys'](_0x5a0268[_0x9619('0x2b')]);_0x208854[_0x9619('0x36')]=_['intersection'](_0x208854['model'],_0x208854[_0x9619('0x2b')]);_0x1e4507[_0x9619('0x2f')]=_[_0x9619('0x2c')](_0x208854[_0x9619('0x2a')],qs[_0x9619('0x2d')](_0x5a0268['query'][_0x9619('0x2d')]));_0x1e4507['attributes']=_0x1e4507[_0x9619('0x2f')][_0x9619('0x2e')]?_0x1e4507[_0x9619('0x2f')]:_0x208854[_0x9619('0x2a')];if(_0x5a0268[_0x9619('0x2b')][_0x9619('0x3b')]){_0x1e4507[_0x9619('0x3c')]=[{'all':!![]}];}_0x1e4507=_['merge']({},_0x1e4507,_0x5a0268['options']);return db[_0x9619('0x3a')]['find'](_0x1e4507)[_0x9619('0x1f')](handleEntityNotFound(_0x39a3c9,null))[_0x9619('0x1f')](respondWithResult(_0x39a3c9,null))[_0x9619('0x3f')](handleError(_0x39a3c9,null));};exports[_0x9619('0x42')]=function(_0x29ad4b,_0x11bea2){return db['ZohoField'][_0x9619('0x42')](_0x29ad4b['body'],{})[_0x9619('0x1f')](respondWithResult(_0x11bea2,0xc9))[_0x9619('0x3f')](handleError(_0x11bea2,null));};exports[_0x9619('0x1e')]=function(_0x5809c0,_0x3c9e87){if(_0x5809c0[_0x9619('0x43')]['id']){delete _0x5809c0[_0x9619('0x43')]['id'];}return db[_0x9619('0x3a')][_0x9619('0x44')]({'where':{'id':_0x5809c0[_0x9619('0x40')]['id']}})['then'](handleEntityNotFound(_0x3c9e87,null))[_0x9619('0x1f')](saveUpdates(_0x5809c0[_0x9619('0x43')],null))[_0x9619('0x1f')](respondWithResult(_0x3c9e87,null))[_0x9619('0x3f')](handleError(_0x3c9e87,null));};exports[_0x9619('0x20')]=function(_0x1af934,_0x308724){return db[_0x9619('0x3a')][_0x9619('0x44')]({'where':{'id':_0x1af934['params']['id']}})[_0x9619('0x1f')](handleEntityNotFound(_0x308724,null))[_0x9619('0x1f')](removeEntity(_0x308724,null))[_0x9619('0x3f')](handleError(_0x308724,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 28bd7a9..2d7a365 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 _0xd046=['util','../../config/logger','api','bluebird','rimraf','./intZohoField.attributes','define','zoho_unique_index','idField'];(function(_0x19bfe9,_0x28c2da){var _0x3e4fee=function(_0x46ec88){while(--_0x46ec88){_0x19bfe9['push'](_0x19bfe9['shift']());}};_0x3e4fee(++_0x28c2da);}(_0xd046,0x129));var _0x6d04=function(_0x4faed3,_0x1fc8d4){_0x4faed3=_0x4faed3-0x0;var _0x4889bb=_0xd046[_0x4faed3];return _0x4889bb;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6d04('0x7'),'fields':[_0x6d04('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['path','rimraf','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','moment','request-promise'];(function(_0x1a75f1,_0x8737c4){var _0x1b05ef=function(_0x139e4c){while(--_0x139e4c){_0x1a75f1['push'](_0x1a75f1['shift']());}};_0x1b05ef(++_0x8737c4);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x44a17b,_0x5617c9){_0x44a17b=_0x44a17b-0x0;var _0x2baca9=_0xc1c6[_0x44a17b];return _0x2baca9;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 48e1310..4a75d0b 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 _0x80e3=['request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x80e3,0x75));var _0x380e=function(_0x40ba70,_0x31b4ce){_0x40ba70=_0x40ba70-0x0;var _0x5b31a5=_0x80e3[_0x40ba70];return _0x5b31a5;};'use strict';var _=require(_0x380e('0x0'));var util=require(_0x380e('0x1'));var moment=require('moment');var BPromise=require(_0x380e('0x2'));var rs=require(_0x380e('0x3'));var fs=require('fs');var Redis=require(_0x380e('0x4'));var db=require(_0x380e('0x5'))['db'];var utils=require(_0x380e('0x6'));var logger=require(_0x380e('0x7'))('rpc');var config=require(_0x380e('0x8'));var jayson=require(_0x380e('0x9'));var client=jayson[_0x380e('0xa')][_0x380e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54b021,_0x19df20,_0x166ff7){return new BPromise(function(_0x112998,_0x50698b){return client['request'](_0x54b021,_0x166ff7)[_0x380e('0xc')](function(_0x2cb24a){logger[_0x380e('0xd')](_0x380e('0xe'),_0x19df20,_0x380e('0xf'));logger['debug'](_0x380e('0x10'),_0x19df20,_0x380e('0xf'),JSON['stringify'](_0x2cb24a));if(_0x2cb24a[_0x380e('0x11')]){if(_0x2cb24a[_0x380e('0x11')][_0x380e('0x12')]===0x1f4){logger[_0x380e('0x11')](_0x380e('0xe'),_0x19df20,_0x2cb24a[_0x380e('0x11')][_0x380e('0x13')]);return _0x50698b(_0x2cb24a[_0x380e('0x11')]['message']);}logger[_0x380e('0x11')](_0x380e('0xe'),_0x19df20,_0x2cb24a[_0x380e('0x11')]['message']);return _0x112998(_0x2cb24a[_0x380e('0x11')][_0x380e('0x13')]);}else{logger['info'](_0x380e('0xe'),_0x19df20,_0x380e('0xf'));_0x112998(_0x2cb24a[_0x380e('0x14')]['message']);}})[_0x380e('0x15')](function(_0x69faa4){logger[_0x380e('0x11')](_0x380e('0xe'),_0x19df20,_0x69faa4);_0x50698b(_0x69faa4);});});} \ No newline at end of file +var _0x67b0=['ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x1a34ec,_0x2cbf5b){var _0x496954=function(_0x12b9c5){while(--_0x12b9c5){_0x1a34ec['push'](_0x1a34ec['shift']());}};_0x496954(++_0x2cbf5b);}(_0x67b0,0x157));var _0x067b=function(_0x2daad8,_0x37d518){_0x2daad8=_0x2daad8-0x0;var _0x13d2c7=_0x67b0[_0x2daad8];return _0x13d2c7;};'use strict';var _=require(_0x067b('0x0'));var util=require(_0x067b('0x1'));var moment=require(_0x067b('0x2'));var BPromise=require(_0x067b('0x3'));var rs=require(_0x067b('0x4'));var fs=require('fs');var Redis=require(_0x067b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x067b('0x6'));var logger=require(_0x067b('0x7'))(_0x067b('0x8'));var config=require('../../config/environment');var jayson=require(_0x067b('0x9'));var client=jayson[_0x067b('0xa')][_0x067b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e82d9,_0x47102f,_0x4d3011){return new BPromise(function(_0x531465,_0x2ecd23){return client[_0x067b('0xc')](_0x5e82d9,_0x4d3011)[_0x067b('0xd')](function(_0x4d4bc9){logger[_0x067b('0xe')](_0x067b('0xf'),_0x47102f,'request\x20sent');logger[_0x067b('0x10')](_0x067b('0x11'),_0x47102f,_0x067b('0x12'),JSON[_0x067b('0x13')](_0x4d4bc9));if(_0x4d4bc9[_0x067b('0x14')]){if(_0x4d4bc9[_0x067b('0x14')]['code']===0x1f4){logger[_0x067b('0x14')]('ZohoField,\x20%s,\x20%s',_0x47102f,_0x4d4bc9[_0x067b('0x14')][_0x067b('0x15')]);return _0x2ecd23(_0x4d4bc9['error'][_0x067b('0x15')]);}logger['error'](_0x067b('0xf'),_0x47102f,_0x4d4bc9[_0x067b('0x14')][_0x067b('0x15')]);return _0x531465(_0x4d4bc9['error'][_0x067b('0x15')]);}else{logger[_0x067b('0xe')](_0x067b('0xf'),_0x47102f,_0x067b('0x12'));_0x531465(_0x4d4bc9[_0x067b('0x16')][_0x067b('0x15')]);}})[_0x067b('0x17')](function(_0x29c22c){logger['error'](_0x067b('0xf'),_0x47102f,_0x29c22c);_0x2ecd23(_0x29c22c);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 985eea1..7e4667a 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1202a2,_0x2912d9){var _0x3a8ac6=function(_0x3fd5fe){while(--_0x3fd5fe){_0x1202a2['push'](_0x1202a2['shift']());}};_0x3a8ac6(++_0x2912d9);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2d0de6,_0x3a1468){var _0x49b8bf=function(_0xbb907b){while(--_0xbb907b){_0x2d0de6['push'](_0x2d0de6['shift']());}};_0x49b8bf(++_0x3a1468);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 072cae4..d7db771 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 _0x26dc=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x26dc,0x1b9));var _0xc26d=function(_0x1fcef5,_0x16eb6f){_0x1fcef5=_0x1fcef5-0x0;var _0x9e7c1b=_0x26dc[_0x1fcef5];return _0x9e7c1b;};'use strict';var Sequelize=require(_0xc26d('0x0'));module[_0xc26d('0x1')]={'name':{'type':Sequelize[_0xc26d('0x2')],'allowNull':![],'unique':_0xc26d('0x3')},'version':{'type':Sequelize[_0xc26d('0x2')],'allowNull':![],'unique':_0xc26d('0x3')},'main':{'type':Sequelize[_0xc26d('0x2')],'defaultValue':_0xc26d('0x4')},'filename':{'type':Sequelize[_0xc26d('0x2')]},'path':{'type':Sequelize[_0xc26d('0x2')]},'type':{'type':Sequelize[_0xc26d('0x2')]},'size':{'type':Sequelize[_0xc26d('0x5')]},'active':{'type':Sequelize[_0xc26d('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xc26d('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xc26d('0x7')},'description':{'type':Sequelize[_0xc26d('0x2')]},'title':{'type':Sequelize[_0xc26d('0x2')]},'remoteUri':{'type':Sequelize[_0xc26d('0x2')]},'link':{'type':Sequelize[_0xc26d('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x2236=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x1ff2ae,_0x58822b){var _0x6647d3=function(_0x2cb393){while(--_0x2cb393){_0x1ff2ae['push'](_0x1ff2ae['shift']());}};_0x6647d3(++_0x58822b);}(_0x2236,0x12e));var _0x6223=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x2236[_0x5a2d95];return _0x2c3986;};'use strict';var Sequelize=require(_0x6223('0x0'));module['exports']={'name':{'type':Sequelize[_0x6223('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x6223('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x6223('0x1')]},'path':{'type':Sequelize[_0x6223('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x6223('0x2')]},'active':{'type':Sequelize[_0x6223('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x6223('0x1')]},'logo':{'type':Sequelize[_0x6223('0x1')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x6223('0x1')]},'remoteUri':{'type':Sequelize[_0x6223('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 e443e58..af4636b 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['error','stack','name','send','index','Integration','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x580d88,_0x18a3b7){var _0x2ab01d=function(_0x2415ba){while(--_0x2415ba){_0x580d88['push'](_0x580d88['shift']());}};_0x2ab01d(++_0x18a3b7);}(_0xdb28,0x106));var _0x8db2=function(_0xfca0f,_0x4737b5){_0xfca0f=_0xfca0f-0x0;var _0x515631=_0xdb28[_0xfca0f];return _0x515631;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x1a37,0xb4));var _0x71a3=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x1a37[_0x494d1f];return _0x457b6e;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 39d8136..03560e4 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 _0x120b=['path','rimraf','../../config/environment','exports','Integration','integrations','util','api','moment','bluebird','request-promise'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x120b,0x8a));var _0xb120=function(_0x24cc49,_0x1ec295){_0x24cc49=_0x24cc49-0x0;var _0x5918a4=_0x120b[_0x24cc49];return _0x5918a4;};'use strict';var _=require('lodash');var util=require(_0xb120('0x0'));var logger=require('../../config/logger')(_0xb120('0x1'));var moment=require(_0xb120('0x2'));var BPromise=require(_0xb120('0x3'));var rp=require(_0xb120('0x4'));var fs=require('fs');var path=require(_0xb120('0x5'));var rimraf=require(_0xb120('0x6'));var config=require(_0xb120('0x7'));var attributes=require('./integration.attributes');module[_0xb120('0x8')]=function(_0x46f8d6,_0x244712){return _0x46f8d6['define'](_0xb120('0x9'),attributes,{'tableName':_0xb120('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15f0=['../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2b0a72,_0x32c2dc){var _0x2b18dc=function(_0xee2a04){while(--_0xee2a04){_0x2b0a72['push'](_0x2b0a72['shift']());}};_0x2b18dc(++_0x32c2dc);}(_0x15f0,0xd2));var _0x015f=function(_0x4c12a7,_0x4012ee){_0x4c12a7=_0x4c12a7-0x0;var _0x53c190=_0x15f0[_0x4c12a7];return _0x53c190;};'use strict';var _=require('lodash');var util=require(_0x015f('0x0'));var logger=require(_0x015f('0x1'))('api');var moment=require(_0x015f('0x2'));var BPromise=require(_0x015f('0x3'));var rp=require(_0x015f('0x4'));var fs=require('fs');var path=require(_0x015f('0x5'));var rimraf=require('rimraf');var config=require(_0x015f('0x6'));var attributes=require(_0x015f('0x7'));module[_0x015f('0x8')]=function(_0x5c52b7,_0x2868cc){return _0x5c52b7[_0x015f('0x9')](_0x015f('0xa'),attributes,{'tableName':_0x015f('0xb'),'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 a61649e..1d95e9e 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x2c3a47,_0x170687){var _0x1c04de=function(_0x367deb){while(--_0x367deb){_0x2c3a47['push'](_0x2c3a47['shift']());}};_0x1c04de(++_0x170687);}(_0xda2d,0x102));var _0xdda2=function(_0x372c3e,_0x4ebb70){_0x372c3e=_0x372c3e-0x0;var _0x4b5b54=_0xda2d[_0x372c3e];return _0x4b5b54;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x3bcf68,_0x939aa9){var _0x3895e9=function(_0x99804b){while(--_0x99804b){_0x3bcf68['push'](_0x3bcf68['shift']());}};_0x3895e9(++_0x939aa9);}(_0x66fa,0x117));var _0xa66f=function(_0x59df14,_0x17782a){_0x59df14=_0x59df14-0x0;var _0x47dca8=_0x66fa[_0x59df14];return _0x47dca8;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b1af24e..9f5f660 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'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('./integrationReport.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['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x470cdd,_0x4708cd){var _0x57fda7=function(_0x171462){while(--_0x171462){_0x470cdd['push'](_0x470cdd['shift']());}};_0x57fda7(++_0x4708cd);}(_0x66fa,0x117));var _0xa66f=function(_0x266fa7,_0x18a146){_0x266fa7=_0x266fa7-0x0;var _0x10cd97=_0x66fa[_0x266fa7];return _0x10cd97;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index a21c195..d587dc0 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 _0x1988=['STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','RECEIVED','FAILED','sequelize','exports'];(function(_0x502a54,_0x1498b7){var _0xc9a31c=function(_0x8ff578){while(--_0x8ff578){_0x502a54['push'](_0x502a54['shift']());}};_0xc9a31c(++_0x1498b7);}(_0x1988,0x17a));var _0x8198=function(_0x1da22f,_0xdc13dc){_0x1da22f=_0x1da22f-0x0;var _0x8ea9d8=_0x1988[_0x1da22f];return _0x8ea9d8;};'use strict';var Sequelize=require(_0x8198('0x0'));module[_0x8198('0x1')]={'integration':{'type':Sequelize[_0x8198('0x2')]},'eventChannel':{'type':Sequelize[_0x8198('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x8198('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8198('0x2')]},'calleridnum':{'type':Sequelize[_0x8198('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8198('0x2')]},'interface':{'type':Sequelize[_0x8198('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8198('0x4')]},'agentconnectAt':{'type':Sequelize[_0x8198('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8198('0x4')]},'talktime':{'type':Sequelize[_0x8198('0x3')]},'agentacw':{'type':Sequelize[_0x8198('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8198('0x3')]},'reason':{'type':Sequelize[_0x8198('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x8198('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8198('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8198('0x4')]},'lastevent':{'type':Sequelize[_0x8198('0x2')]},'channel':{'type':Sequelize[_0x8198('0x2')]},'channelstate':{'type':Sequelize[_0x8198('0x3')]},'channelstatedesc':{'type':Sequelize[_0x8198('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8198('0x2')]},'language':{'type':Sequelize[_0x8198('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8198('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8198('0x2')]},'destchannel':{'type':Sequelize[_0x8198('0x2')]},'destchannelstate':{'type':Sequelize[_0x8198('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x8198('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8198('0x2')]},'destcalleridname':{'type':Sequelize[_0x8198('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8198('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x8198('0x2')]},'destlanguage':{'type':Sequelize[_0x8198('0x2')]},'destaccountcode':{'type':Sequelize[_0x8198('0x2')]},'destcontext':{'type':Sequelize[_0x8198('0x2')]},'destexten':{'type':Sequelize[_0x8198('0x2')]},'destpriority':{'type':Sequelize[_0x8198('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x8198('0x2')]},'inReplyTo':{'type':Sequelize[_0x8198('0x2')]},'subject':{'type':Sequelize[_0x8198('0x2')]},'from':{'type':Sequelize[_0x8198('0x2')]},'to':{'type':Sequelize[_0x8198('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x8198('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x8198('0x6')]},'status':{'type':Sequelize['ENUM'](_0x8198('0x7'),'SENDING',_0x8198('0x8'),_0x8198('0x9'))},'url':{'type':Sequelize[_0x8198('0x2')]},'app':{'type':Sequelize[_0x8198('0x2')]},'appdata':{'type':Sequelize[_0x8198('0x2')]},'projectId':{'type':Sequelize[_0x8198('0x3')]}}; \ No newline at end of file +var _0xcf7e=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xcf7e,0x1e0));var _0xecf7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcf7e[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0xecf7('0x0')]={'integration':{'type':Sequelize[_0xecf7('0x1')]},'eventChannel':{'type':Sequelize[_0xecf7('0x1')]},'exitStatus':{'type':Sequelize[_0xecf7('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xecf7('0x2')]},'contacts':{'type':Sequelize[_0xecf7('0x1')]},'uniqueid':{'type':Sequelize[_0xecf7('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xecf7('0x1')]},'queue':{'type':Sequelize[_0xecf7('0x1')]},'interface':{'type':Sequelize[_0xecf7('0x1')]},'membername':{'type':Sequelize[_0xecf7('0x1')]},'agentcalledAt':{'type':Sequelize[_0xecf7('0x3')]},'agentconnectAt':{'type':Sequelize[_0xecf7('0x3')]},'holdtime':{'type':Sequelize[_0xecf7('0x2')]},'agentcomplete':{'type':Sequelize[_0xecf7('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xecf7('0x3')]},'talktime':{'type':Sequelize[_0xecf7('0x2')]},'agentacw':{'type':Sequelize[_0xecf7('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xecf7('0x2')]},'reason':{'type':Sequelize[_0xecf7('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xecf7('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xecf7('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xecf7('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xecf7('0x1')]},'channelstate':{'type':Sequelize[_0xecf7('0x2')]},'channelstatedesc':{'type':Sequelize[_0xecf7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xecf7('0x1')]},'language':{'type':Sequelize[_0xecf7('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xecf7('0x1')]},'exten':{'type':Sequelize[_0xecf7('0x1')]},'priority':{'type':Sequelize[_0xecf7('0x1')]},'destchannel':{'type':Sequelize[_0xecf7('0x1')]},'destchannelstate':{'type':Sequelize[_0xecf7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xecf7('0x1')]},'destcalleridnum':{'type':Sequelize[_0xecf7('0x1')]},'destcalleridname':{'type':Sequelize[_0xecf7('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xecf7('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xecf7('0x1')]},'destaccountcode':{'type':Sequelize[_0xecf7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xecf7('0x1')]},'destuniqueid':{'type':Sequelize[_0xecf7('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xecf7('0x1')]},'subject':{'type':Sequelize[_0xecf7('0x1')]},'from':{'type':Sequelize[_0xecf7('0x1')]},'to':{'type':Sequelize[_0xecf7('0x1')]},'cc':{'type':Sequelize[_0xecf7('0x1')]},'attachment':{'type':Sequelize[_0xecf7('0x5')]},'html':{'type':Sequelize[_0xecf7('0x5')]},'text':{'type':Sequelize[_0xecf7('0x5')]},'status':{'type':Sequelize['ENUM'](_0xecf7('0x6'),_0xecf7('0x7'),_0xecf7('0x8'),_0xecf7('0x9'))},'url':{'type':Sequelize[_0xecf7('0x1')]},'app':{'type':Sequelize[_0xecf7('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 2a374da..33f1a6e 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 _0x18e6=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','update','then','destroy','error','stack','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','IntegrationReport','findAll','rows','show','find','create','body','params','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x25426d,_0x15b9a4){var _0x22e1b4=function(_0x768880){while(--_0x768880){_0x25426d['push'](_0x25426d['shift']());}};_0x22e1b4(++_0x15b9a4);}(_0x18e6,0x123));var _0x618e=function(_0x2e3cf5,_0xd68ea0){_0x2e3cf5=_0x2e3cf5-0x0;var _0x389b3a=_0x18e6[_0x2e3cf5];return _0x389b3a;};'use strict';var emlformat=require(_0x618e('0x0'));var rimraf=require(_0x618e('0x1'));var zipdir=require(_0x618e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x618e('0x3'));var moment=require(_0x618e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x618e('0x5'));var path=require(_0x618e('0x6'));var sox=require(_0x618e('0x7'));var csv=require(_0x618e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x618e('0x9'));var _=require(_0x618e('0xa'));var squel=require(_0x618e('0xb'));var crypto=require(_0x618e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x618e('0xd'));var Redis=require(_0x618e('0xe'));var authService=require(_0x618e('0xf'));var qs=require(_0x618e('0x10'));var as=require(_0x618e('0x11'));var hardwareService=require(_0x618e('0x12'));var logger=require(_0x618e('0x13'))(_0x618e('0x14'));var utils=require(_0x618e('0x15'));var config=require(_0x618e('0x16'));var licenseUtil=require(_0x618e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x343e1d,_0x3dd5a9){_0x3dd5a9=_0x3dd5a9||0xcc;return function(_0x11d7fa){if(_0x11d7fa){return _0x343e1d['sendStatus'](_0x3dd5a9);}return _0x343e1d['status'](_0x3dd5a9)[_0x618e('0x18')]();};}function respondWithResult(_0x57acd7,_0x4a3733){_0x4a3733=_0x4a3733||0xc8;return function(_0x11a11f){if(_0x11a11f){return _0x57acd7[_0x618e('0x19')](_0x4a3733)['json'](_0x11a11f);}};}function respondWithFilteredResult(_0x431cda,_0x248989){return function(_0xffd894){if(_0xffd894){var _0x3a42ab=typeof _0x248989[_0x618e('0x1a')]==='undefined'&&typeof _0x248989[_0x618e('0x1b')]===_0x618e('0x1c');var _0x270d5c=_0xffd894[_0x618e('0x1d')];var _0x164fea=_0x3a42ab?0x0:_0x248989[_0x618e('0x1a')];var _0x134028=_0x3a42ab?_0xffd894['count']:_0x248989[_0x618e('0x1a')]+_0x248989[_0x618e('0x1b')];var _0x48379d;if(_0x134028>=_0x270d5c){_0x134028=_0x270d5c;_0x48379d=0xc8;}else{_0x48379d=0xce;}_0x431cda[_0x618e('0x19')](_0x48379d);return _0x431cda[_0x618e('0x1e')](_0x618e('0x1f'),_0x164fea+'-'+_0x134028+'/'+_0x270d5c)[_0x618e('0x20')](_0xffd894);}return null;};}function patchUpdates(_0x549ed0){return function(_0x49abfe){try{jsonpatch[_0x618e('0x21')](_0x49abfe,_0x549ed0,!![]);}catch(_0x3f0279){return BPromise['reject'](_0x3f0279);}return _0x49abfe['save']();};}function saveUpdates(_0x54c7e4,_0x534b79){return function(_0x42fab9){if(_0x42fab9){return _0x42fab9[_0x618e('0x22')](_0x54c7e4)[_0x618e('0x23')](function(_0xde5df9){return _0xde5df9;});}return null;};}function removeEntity(_0x453e69,_0x3419fe){return function(_0x5c01a8){if(_0x5c01a8){return _0x5c01a8[_0x618e('0x24')]()['then'](function(){_0x453e69[_0x618e('0x19')](0xcc)[_0x618e('0x18')]();});}};}function handleEntityNotFound(_0x136485,_0x535952){return function(_0x4657d2){if(!_0x4657d2){_0x136485['sendStatus'](0x194);}return _0x4657d2;};}function handleError(_0xe0b598,_0x3fac58){_0x3fac58=_0x3fac58||0x1f4;return function(_0x3266e1){logger[_0x618e('0x25')](_0x3266e1[_0x618e('0x26')]);if(_0x3266e1['name']){delete _0x3266e1['name'];}_0xe0b598[_0x618e('0x19')](_0x3fac58)[_0x618e('0x27')](_0x3266e1);};}exports[_0x618e('0x28')]=function(_0x1f06f5,_0x433b1f){var _0x3500cd={},_0x54a051={},_0x294585={'count':0x0,'rows':[]};var _0x2fab1c=_[_0x618e('0x29')](db['IntegrationReport'][_0x618e('0x2a')],function(_0x1737ed){return{'name':_0x1737ed['fieldName'],'type':_0x1737ed[_0x618e('0x2b')][_0x618e('0x2c')]};});_0x54a051[_0x618e('0x2d')]=_['map'](_0x2fab1c,_0x618e('0x2e'));_0x54a051[_0x618e('0x2f')]=_[_0x618e('0x30')](_0x1f06f5[_0x618e('0x2f')]);_0x54a051[_0x618e('0x31')]=_[_0x618e('0x32')](_0x54a051[_0x618e('0x2d')],_0x54a051['query']);_0x3500cd[_0x618e('0x33')]=_[_0x618e('0x32')](_0x54a051['model'],qs[_0x618e('0x34')](_0x1f06f5[_0x618e('0x2f')]['fields']));_0x3500cd[_0x618e('0x33')]=_0x3500cd[_0x618e('0x33')][_0x618e('0x35')]?_0x3500cd[_0x618e('0x33')]:_0x54a051[_0x618e('0x2d')];if(!_0x1f06f5[_0x618e('0x2f')][_0x618e('0x36')](_0x618e('0x37'))){_0x3500cd[_0x618e('0x1b')]=qs[_0x618e('0x1b')](_0x1f06f5[_0x618e('0x2f')]['limit']);_0x3500cd[_0x618e('0x1a')]=qs[_0x618e('0x1a')](_0x1f06f5['query']['offset']);}_0x3500cd[_0x618e('0x38')]=qs[_0x618e('0x39')](_0x1f06f5[_0x618e('0x2f')][_0x618e('0x39')]);_0x3500cd['where']=qs[_0x618e('0x31')](_[_0x618e('0x3a')](_0x1f06f5[_0x618e('0x2f')],_0x54a051[_0x618e('0x31')]),_0x2fab1c);if(_0x1f06f5[_0x618e('0x2f')][_0x618e('0x3b')]){_0x3500cd[_0x618e('0x3c')]=_[_0x618e('0x3d')](_0x3500cd[_0x618e('0x3c')],{'$or':_[_0x618e('0x29')](_0x2fab1c,function(_0x5c19e0){if(_0x5c19e0['type']!==_0x618e('0x3e')){var _0x216064={};_0x216064[_0x5c19e0['name']]={'$like':'%'+_0x1f06f5[_0x618e('0x2f')][_0x618e('0x3b')]+'%'};return _0x216064;}})});}_0x3500cd=_['merge']({},_0x3500cd,_0x1f06f5[_0x618e('0x3f')]);var _0x221458={'where':_0x3500cd['where']};return db['IntegrationReport'][_0x618e('0x1d')](_0x221458)['then'](function(_0x27bbdf){_0x294585[_0x618e('0x1d')]=_0x27bbdf;if(_0x1f06f5[_0x618e('0x2f')][_0x618e('0x40')]){_0x3500cd[_0x618e('0x41')]=[{'all':!![]}];}return db[_0x618e('0x42')][_0x618e('0x43')](_0x3500cd);})[_0x618e('0x23')](function(_0x428250){_0x294585[_0x618e('0x44')]=_0x428250;return _0x294585;})[_0x618e('0x23')](respondWithFilteredResult(_0x433b1f,_0x3500cd))['catch'](handleError(_0x433b1f,null));};exports[_0x618e('0x45')]=function(_0x2bbd5c,_0x229cc3){var _0x18f494={'raw':![],'where':{'id':_0x2bbd5c['params']['id']}},_0xaee18b={};_0xaee18b[_0x618e('0x2d')]=_[_0x618e('0x30')](db[_0x618e('0x42')]['rawAttributes']);_0xaee18b[_0x618e('0x2f')]=_[_0x618e('0x30')](_0x2bbd5c[_0x618e('0x2f')]);_0xaee18b[_0x618e('0x31')]=_[_0x618e('0x32')](_0xaee18b[_0x618e('0x2d')],_0xaee18b[_0x618e('0x2f')]);_0x18f494['attributes']=_['intersection'](_0xaee18b[_0x618e('0x2d')],qs[_0x618e('0x34')](_0x2bbd5c['query'][_0x618e('0x34')]));_0x18f494[_0x618e('0x33')]=_0x18f494[_0x618e('0x33')]['length']?_0x18f494['attributes']:_0xaee18b[_0x618e('0x2d')];if(_0x2bbd5c['query'][_0x618e('0x40')]){_0x18f494[_0x618e('0x41')]=[{'all':!![]}];}_0x18f494=_[_0x618e('0x3d')]({},_0x18f494,_0x2bbd5c[_0x618e('0x3f')]);return db[_0x618e('0x42')][_0x618e('0x46')](_0x18f494)[_0x618e('0x23')](handleEntityNotFound(_0x229cc3,null))[_0x618e('0x23')](respondWithResult(_0x229cc3,null))['catch'](handleError(_0x229cc3,null));};exports['create']=function(_0x597b03,_0xaadece){return db['IntegrationReport'][_0x618e('0x47')](_0x597b03[_0x618e('0x48')],{})['then'](respondWithResult(_0xaadece,0xc9))['catch'](handleError(_0xaadece,null));};exports[_0x618e('0x22')]=function(_0x589d04,_0x3c61fd){if(_0x589d04[_0x618e('0x48')]['id']){delete _0x589d04['body']['id'];}return db[_0x618e('0x42')][_0x618e('0x46')]({'where':{'id':_0x589d04[_0x618e('0x49')]['id']}})[_0x618e('0x23')](handleEntityNotFound(_0x3c61fd,null))[_0x618e('0x23')](saveUpdates(_0x589d04['body'],null))[_0x618e('0x23')](respondWithResult(_0x3c61fd,null))[_0x618e('0x4a')](handleError(_0x3c61fd,null));};exports[_0x618e('0x24')]=function(_0x3a842c,_0x5af804){return db[_0x618e('0x42')][_0x618e('0x46')]({'where':{'id':_0x3a842c['params']['id']}})['then'](handleEntityNotFound(_0x5af804,null))['then'](removeEntity(_0x5af804,null))[_0x618e('0x4a')](handleError(_0x5af804,null));};exports[_0x618e('0x4b')]=function(_0x3dae3f,_0x2e5a79){return db[_0x618e('0x42')][_0x618e('0x4b')]()[_0x618e('0x23')](respondWithResult(_0x2e5a79,null))['catch'](handleError(_0x2e5a79,null));}; \ No newline at end of file +var _0x18e3=['index','map','IntegrationReport','rawAttributes','fieldName','model','name','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','sendStatus','stack','send'];(function(_0x383fc8,_0x47bb81){var _0x50982a=function(_0x23249e){while(--_0x23249e){_0x383fc8['push'](_0x383fc8['shift']());}};_0x50982a(++_0x47bb81);}(_0x18e3,0x6d));var _0x318e=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0x18e3[_0x4c4042];return _0xbd10dc;};'use strict';var emlformat=require(_0x318e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x318e('0x1'));var jsonpatch=require(_0x318e('0x2'));var rp=require(_0x318e('0x3'));var moment=require(_0x318e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x318e('0x5'));var util=require(_0x318e('0x6'));var path=require(_0x318e('0x7'));var sox=require(_0x318e('0x8'));var csv=require('to-csv');var ejs=require(_0x318e('0x9'));var fs=require('fs');var fs_extra=require(_0x318e('0xa'));var _=require(_0x318e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x318e('0xc'));var deskjs=require(_0x318e('0xd'));var toCsv=require(_0x318e('0xe'));var querystring=require(_0x318e('0xf'));var Papa=require(_0x318e('0x10'));var Redis=require(_0x318e('0x11'));var authService=require(_0x318e('0x12'));var qs=require(_0x318e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x318e('0x14'));var logger=require(_0x318e('0x15'))('api');var utils=require(_0x318e('0x16'));var config=require(_0x318e('0x17'));var licenseUtil=require(_0x318e('0x18'));var db=require(_0x318e('0x19'))['db'];function respondWithStatusCode(_0x36de7d,_0x5924ae){_0x5924ae=_0x5924ae||0xcc;return function(_0x161280){if(_0x161280){return _0x36de7d['sendStatus'](_0x5924ae);}return _0x36de7d['status'](_0x5924ae)['end']();};}function respondWithResult(_0x5b3067,_0x3c5df9){_0x3c5df9=_0x3c5df9||0xc8;return function(_0xb746b9){if(_0xb746b9){return _0x5b3067[_0x318e('0x1a')](_0x3c5df9)[_0x318e('0x1b')](_0xb746b9);}};}function respondWithFilteredResult(_0xebcfea,_0xd5c169){return function(_0x4794a6){if(_0x4794a6){var _0x25ad6e=typeof _0xd5c169['offset']===_0x318e('0x1c')&&typeof _0xd5c169[_0x318e('0x1d')]==='undefined';var _0x5e07d4=_0x4794a6[_0x318e('0x1e')];var _0x41be21=_0x25ad6e?0x0:_0xd5c169[_0x318e('0x1f')];var _0x59c5d7=_0x25ad6e?_0x4794a6[_0x318e('0x1e')]:_0xd5c169[_0x318e('0x1f')]+_0xd5c169[_0x318e('0x1d')];var _0x335319;if(_0x59c5d7>=_0x5e07d4){_0x59c5d7=_0x5e07d4;_0x335319=0xc8;}else{_0x335319=0xce;}_0xebcfea[_0x318e('0x1a')](_0x335319);return _0xebcfea['set'](_0x318e('0x20'),_0x41be21+'-'+_0x59c5d7+'/'+_0x5e07d4)['json'](_0x4794a6);}return null;};}function patchUpdates(_0x2f5b19){return function(_0x155a6a){try{jsonpatch['apply'](_0x155a6a,_0x2f5b19,!![]);}catch(_0x2358cf){return BPromise['reject'](_0x2358cf);}return _0x155a6a['save']();};}function saveUpdates(_0x16cb7e,_0x6c7079){return function(_0x447b43){if(_0x447b43){return _0x447b43[_0x318e('0x21')](_0x16cb7e)[_0x318e('0x22')](function(_0x4c72d5){return _0x4c72d5;});}return null;};}function removeEntity(_0x1a15fe,_0x147dee){return function(_0xb72c94){if(_0xb72c94){return _0xb72c94[_0x318e('0x23')]()['then'](function(){_0x1a15fe[_0x318e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x500b5d,_0x439bbf){return function(_0x47c40f){if(!_0x47c40f){_0x500b5d[_0x318e('0x24')](0x194);}return _0x47c40f;};}function handleError(_0xceca03,_0x49be89){_0x49be89=_0x49be89||0x1f4;return function(_0x49f44a){logger['error'](_0x49f44a[_0x318e('0x25')]);if(_0x49f44a['name']){delete _0x49f44a['name'];}_0xceca03[_0x318e('0x1a')](_0x49be89)[_0x318e('0x26')](_0x49f44a);};}exports[_0x318e('0x27')]=function(_0x293b12,_0x576109){var _0xbbaa02={},_0x271ccb={},_0x33bc0c={'count':0x0,'rows':[]};var _0x48d371=_[_0x318e('0x28')](db[_0x318e('0x29')][_0x318e('0x2a')],function(_0x40c446){return{'name':_0x40c446[_0x318e('0x2b')],'type':_0x40c446['type']['key']};});_0x271ccb[_0x318e('0x2c')]=_[_0x318e('0x28')](_0x48d371,_0x318e('0x2d'));_0x271ccb['query']=_[_0x318e('0x2e')](_0x293b12[_0x318e('0x2f')]);_0x271ccb[_0x318e('0x30')]=_['intersection'](_0x271ccb[_0x318e('0x2c')],_0x271ccb[_0x318e('0x2f')]);_0xbbaa02[_0x318e('0x31')]=_['intersection'](_0x271ccb[_0x318e('0x2c')],qs[_0x318e('0x32')](_0x293b12[_0x318e('0x2f')]['fields']));_0xbbaa02[_0x318e('0x31')]=_0xbbaa02[_0x318e('0x31')][_0x318e('0x33')]?_0xbbaa02['attributes']:_0x271ccb[_0x318e('0x2c')];if(!_0x293b12[_0x318e('0x2f')][_0x318e('0x34')](_0x318e('0x35'))){_0xbbaa02[_0x318e('0x1d')]=qs['limit'](_0x293b12[_0x318e('0x2f')][_0x318e('0x1d')]);_0xbbaa02[_0x318e('0x1f')]=qs['offset'](_0x293b12[_0x318e('0x2f')][_0x318e('0x1f')]);}_0xbbaa02[_0x318e('0x36')]=qs[_0x318e('0x37')](_0x293b12['query'][_0x318e('0x37')]);_0xbbaa02[_0x318e('0x38')]=qs['filters'](_[_0x318e('0x39')](_0x293b12[_0x318e('0x2f')],_0x271ccb[_0x318e('0x30')]),_0x48d371);if(_0x293b12[_0x318e('0x2f')]['filter']){_0xbbaa02[_0x318e('0x38')]=_[_0x318e('0x3a')](_0xbbaa02[_0x318e('0x38')],{'$or':_[_0x318e('0x28')](_0x48d371,function(_0xfacc7d){if(_0xfacc7d['type']!==_0x318e('0x3b')){var _0x3a0eff={};_0x3a0eff[_0xfacc7d[_0x318e('0x2d')]]={'$like':'%'+_0x293b12[_0x318e('0x2f')][_0x318e('0x3c')]+'%'};return _0x3a0eff;}})});}_0xbbaa02=_[_0x318e('0x3a')]({},_0xbbaa02,_0x293b12[_0x318e('0x3d')]);var _0x51704c={'where':_0xbbaa02[_0x318e('0x38')]};return db[_0x318e('0x29')]['count'](_0x51704c)[_0x318e('0x22')](function(_0x29414f){_0x33bc0c[_0x318e('0x1e')]=_0x29414f;if(_0x293b12[_0x318e('0x2f')]['includeAll']){_0xbbaa02['include']=[{'all':!![]}];}return db[_0x318e('0x29')][_0x318e('0x3e')](_0xbbaa02);})[_0x318e('0x22')](function(_0xa76edc){_0x33bc0c[_0x318e('0x3f')]=_0xa76edc;return _0x33bc0c;})[_0x318e('0x22')](respondWithFilteredResult(_0x576109,_0xbbaa02))[_0x318e('0x40')](handleError(_0x576109,null));};exports[_0x318e('0x41')]=function(_0x916bb6,_0x2ca5e0){var _0x803673={'raw':![],'where':{'id':_0x916bb6[_0x318e('0x42')]['id']}},_0x14b90d={};_0x14b90d[_0x318e('0x2c')]=_[_0x318e('0x2e')](db['IntegrationReport']['rawAttributes']);_0x14b90d['query']=_['keys'](_0x916bb6['query']);_0x14b90d[_0x318e('0x30')]=_[_0x318e('0x43')](_0x14b90d[_0x318e('0x2c')],_0x14b90d[_0x318e('0x2f')]);_0x803673['attributes']=_[_0x318e('0x43')](_0x14b90d['model'],qs[_0x318e('0x32')](_0x916bb6[_0x318e('0x2f')][_0x318e('0x32')]));_0x803673[_0x318e('0x31')]=_0x803673['attributes'][_0x318e('0x33')]?_0x803673[_0x318e('0x31')]:_0x14b90d[_0x318e('0x2c')];if(_0x916bb6[_0x318e('0x2f')][_0x318e('0x44')]){_0x803673[_0x318e('0x45')]=[{'all':!![]}];}_0x803673=_['merge']({},_0x803673,_0x916bb6[_0x318e('0x3d')]);return db['IntegrationReport'][_0x318e('0x46')](_0x803673)[_0x318e('0x22')](handleEntityNotFound(_0x2ca5e0,null))['then'](respondWithResult(_0x2ca5e0,null))['catch'](handleError(_0x2ca5e0,null));};exports[_0x318e('0x47')]=function(_0x6eb3dc,_0x3b5ea7){return db[_0x318e('0x29')]['create'](_0x6eb3dc[_0x318e('0x48')],{})[_0x318e('0x22')](respondWithResult(_0x3b5ea7,0xc9))[_0x318e('0x40')](handleError(_0x3b5ea7,null));};exports[_0x318e('0x21')]=function(_0x381e57,_0x57c241){if(_0x381e57[_0x318e('0x48')]['id']){delete _0x381e57['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x381e57[_0x318e('0x42')]['id']}})[_0x318e('0x22')](handleEntityNotFound(_0x57c241,null))[_0x318e('0x22')](saveUpdates(_0x381e57[_0x318e('0x48')],null))[_0x318e('0x22')](respondWithResult(_0x57c241,null))[_0x318e('0x40')](handleError(_0x57c241,null));};exports[_0x318e('0x23')]=function(_0xe84249,_0x4ee692){return db[_0x318e('0x29')]['find']({'where':{'id':_0xe84249[_0x318e('0x42')]['id']}})[_0x318e('0x22')](handleEntityNotFound(_0x4ee692,null))[_0x318e('0x22')](removeEntity(_0x4ee692,null))['catch'](handleError(_0x4ee692,null));};exports[_0x318e('0x49')]=function(_0x167c89,_0x154e27){return db[_0x318e('0x29')][_0x318e('0x49')]()[_0x318e('0x22')](respondWithResult(_0x154e27,null))[_0x318e('0x40')](handleError(_0x154e27,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index bd49e48..c3b846e 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 _0x363a=['rimraf','define','IntegrationReport','report_integration','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x42b3e6,_0x17971d){var _0x159e9c=function(_0x2bc10d){while(--_0x2bc10d){_0x42b3e6['push'](_0x42b3e6['shift']());}};_0x159e9c(++_0x17971d);}(_0x363a,0x112));var _0xa363=function(_0x1eed52,_0x1bb3c1){_0x1eed52=_0x1eed52-0x0;var _0x57782a=_0x363a[_0x1eed52];return _0x57782a;};'use strict';var _=require(_0xa363('0x0'));var util=require('util');var logger=require(_0xa363('0x1'))('api');var moment=require(_0xa363('0x2'));var BPromise=require(_0xa363('0x3'));var rp=require(_0xa363('0x4'));var fs=require('fs');var path=require(_0xa363('0x5'));var rimraf=require(_0xa363('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x4c4f0f,_0x4728b4){return _0x4c4f0f[_0xa363('0x7')](_0xa363('0x8'),attributes,{'tableName':_0xa363('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61d0=['exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x646626,_0x25218b){var _0x199795=function(_0x448aac){while(--_0x448aac){_0x646626['push'](_0x646626['shift']());}};_0x199795(++_0x25218b);}(_0x61d0,0x74));var _0x061d=function(_0x2ce9c3,_0x20a165){_0x2ce9c3=_0x2ce9c3-0x0;var _0x109b3a=_0x61d0[_0x2ce9c3];return _0x109b3a;};'use strict';var _=require(_0x061d('0x0'));var util=require(_0x061d('0x1'));var logger=require(_0x061d('0x2'))(_0x061d('0x3'));var moment=require('moment');var BPromise=require(_0x061d('0x4'));var rp=require(_0x061d('0x5'));var fs=require('fs');var path=require(_0x061d('0x6'));var rimraf=require(_0x061d('0x7'));var config=require(_0x061d('0x8'));var attributes=require(_0x061d('0x9'));module[_0x061d('0xa')]=function(_0x378c8d,_0x54047b){return _0x378c8d[_0x061d('0xb')](_0x061d('0xc'),attributes,{'tableName':_0x061d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 1904512..7f00ff5 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0xf494,0x1c6));var _0x4f49=function(_0x1c0e09,_0x109a80){_0x1c0e09=_0x1c0e09-0x0;var _0x29363c=_0xf494[_0x1c0e09];return _0x29363c;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x326f=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x8634ef,_0x21ee99){var _0x17d77e=function(_0xeaa3a7){while(--_0xeaa3a7){_0x8634ef['push'](_0x8634ef['shift']());}};_0x17d77e(++_0x21ee99);}(_0x326f,0xd1));var _0xf326=function(_0x1486cc,_0x3fadaf){_0x1486cc=_0x1486cc-0x0;var _0x53c274=_0x326f[_0x1486cc];return _0x53c274;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index adaf744..542cbc5 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 _0x6363=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete'];(function(_0x34f1e7,_0x566996){var _0x8155d2=function(_0x5b59b6){while(--_0x5b59b6){_0x34f1e7['push'](_0x34f1e7['shift']());}};_0x8155d2(++_0x566996);}(_0x6363,0x13a));var _0x3636=function(_0x1e1dec,_0x663930){_0x1e1dec=_0x1e1dec-0x0;var _0x2b7c43=_0x6363[_0x1e1dec];return _0x2b7c43;};'use strict';var multer=require(_0x3636('0x0'));var util=require('util');var path=require(_0x3636('0x1'));var timeout=require(_0x3636('0x2'));var express=require(_0x3636('0x3'));var router=express[_0x3636('0x4')]();var fs_extra=require(_0x3636('0x5'));var auth=require(_0x3636('0x6'));var interaction=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var controller=require(_0x3636('0x9'));router[_0x3636('0xa')]('/',auth[_0x3636('0xb')](),controller[_0x3636('0xc')]);router[_0x3636('0xa')](_0x3636('0xd'),auth['isAuthenticated'](),controller[_0x3636('0xe')]);router['get'](_0x3636('0xf'),auth[_0x3636('0xb')](),controller[_0x3636('0x10')]);router[_0x3636('0x11')]('/',auth[_0x3636('0xb')](),controller[_0x3636('0x12')]);router[_0x3636('0x11')](_0x3636('0xf'),auth[_0x3636('0xb')](),controller['addInterval']);router['post'](_0x3636('0x13'),auth['isAuthenticated'](),controller[_0x3636('0x14')]);router[_0x3636('0x15')](_0x3636('0xd'),auth[_0x3636('0xb')](),controller[_0x3636('0x16')]);router[_0x3636('0x17')](_0x3636('0xd'),auth[_0x3636('0xb')](),controller[_0x3636('0x18')]);module[_0x3636('0x19')]=router; \ No newline at end of file +var _0xb97c=['get','isAuthenticated','/:id','show','/:id/sub_intervals','getIntervals','create','addInterval','post','/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x5a800f,_0xafc842){var _0x3ba58a=function(_0x43896b){while(--_0x43896b){_0x5a800f['push'](_0x5a800f['shift']());}};_0x3ba58a(++_0xafc842);}(_0xb97c,0x19b));var _0xcb97=function(_0x68cec5,_0x1701af){_0x68cec5=_0x68cec5-0x0;var _0x20aca8=_0xb97c[_0x68cec5];return _0x20aca8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcb97('0x0'));var timeout=require(_0xcb97('0x1'));var express=require(_0xcb97('0x2'));var router=express[_0xcb97('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcb97('0x4'));var config=require(_0xcb97('0x5'));var controller=require(_0xcb97('0x6'));router[_0xcb97('0x7')]('/',auth[_0xcb97('0x8')](),controller['index']);router[_0xcb97('0x7')](_0xcb97('0x9'),auth[_0xcb97('0x8')](),controller[_0xcb97('0xa')]);router[_0xcb97('0x7')](_0xcb97('0xb'),auth[_0xcb97('0x8')](),controller[_0xcb97('0xc')]);router['post']('/',auth[_0xcb97('0x8')](),controller[_0xcb97('0xd')]);router['post'](_0xcb97('0xb'),auth[_0xcb97('0x8')](),controller[_0xcb97('0xe')]);router[_0xcb97('0xf')](_0xcb97('0x10'),auth[_0xcb97('0x8')](),controller[_0xcb97('0x11')]);router['put'](_0xcb97('0x9'),auth[_0xcb97('0x8')](),controller[_0xcb97('0x12')]);router[_0xcb97('0x13')](_0xcb97('0x9'),auth['isAuthenticated'](),controller[_0xcb97('0x14')]);module[_0xcb97('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9ccf01d..6ea97fe 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 _0x2fcc=['STRING','exports'];(function(_0x117ec1,_0x533e8f){var _0x2a6c36=function(_0x373739){while(--_0x373739){_0x117ec1['push'](_0x117ec1['shift']());}};_0x2a6c36(++_0x533e8f);}(_0x2fcc,0x18b));var _0xc2fc=function(_0x8db3d4,_0xab1fdb){_0x8db3d4=_0x8db3d4-0x0;var _0x5e7882=_0x2fcc[_0x8db3d4];return _0x5e7882;};'use strict';var Sequelize=require('sequelize');module[_0xc2fc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc2fc('0x1')]},'interval':{'type':Sequelize[_0xc2fc('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x4a08=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a08,0x6c));var _0x84a0=function(_0x10a8cd,_0x105731){_0x10a8cd=_0x10a8cd-0x0;var _0x3291e7=_0x4a08[_0x10a8cd];return _0x3291e7;};'use strict';var Sequelize=require(_0x84a0('0x0'));module[_0x84a0('0x1')]={'name':{'type':Sequelize[_0x84a0('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x84a0('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 7f0ccef..b8b1a3a 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 _0x6c81=['options','include','findAll','rows','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','addInterval','IntervalId','getIntervals','findOne','rawAttributes','nolimit','sequelize','transaction','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','index','map','Interval','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge'];(function(_0x158cb9,_0x4c600f){var _0x100940=function(_0x445d36){while(--_0x445d36){_0x158cb9['push'](_0x158cb9['shift']());}};_0x100940(++_0x4c600f);}(_0x6c81,0x181));var _0x16c8=function(_0x506d2b,_0x51eba7){_0x506d2b=_0x506d2b-0x0;var _0x1198da=_0x6c81[_0x506d2b];return _0x1198da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x16c8('0x0'));var jsonpatch=require(_0x16c8('0x1'));var rp=require(_0x16c8('0x2'));var moment=require('moment');var BPromise=require(_0x16c8('0x3'));var Mustache=require(_0x16c8('0x4'));var util=require(_0x16c8('0x5'));var path=require(_0x16c8('0x6'));var sox=require('sox');var csv=require(_0x16c8('0x7'));var ejs=require(_0x16c8('0x8'));var fs=require('fs');var fs_extra=require(_0x16c8('0x9'));var _=require(_0x16c8('0xa'));var squel=require('squel');var crypto=require(_0x16c8('0xb'));var jsforce=require(_0x16c8('0xc'));var deskjs=require(_0x16c8('0xd'));var toCsv=require(_0x16c8('0x7'));var querystring=require('querystring');var Papa=require(_0x16c8('0xe'));var Redis=require(_0x16c8('0xf'));var authService=require(_0x16c8('0x10'));var qs=require(_0x16c8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16c8('0x12'));var utils=require('../../config/utils');var config=require(_0x16c8('0x13'));var licenseUtil=require(_0x16c8('0x14'));var db=require(_0x16c8('0x15'))['db'];var extensions=require(_0x16c8('0x16'));function respondWithStatusCode(_0x41adf7,_0x56ade6){_0x56ade6=_0x56ade6||0xcc;return function(_0x21b0b7){if(_0x21b0b7){return _0x41adf7['sendStatus'](_0x56ade6);}return _0x41adf7[_0x16c8('0x17')](_0x56ade6)[_0x16c8('0x18')]();};}function respondWithResult(_0x19aad5,_0x1bde2e){_0x1bde2e=_0x1bde2e||0xc8;return function(_0x23e611){if(_0x23e611){return _0x19aad5[_0x16c8('0x17')](_0x1bde2e)['json'](_0x23e611);}};}function respondWithFilteredResult(_0x3868d6,_0xc57411){return function(_0x18dfec){if(_0x18dfec){var _0x21c784=typeof _0xc57411[_0x16c8('0x19')]===_0x16c8('0x1a')&&typeof _0xc57411[_0x16c8('0x1b')]===_0x16c8('0x1a');var _0x5099c3=_0x18dfec['count'];var _0x9fab89=_0x21c784?0x0:_0xc57411[_0x16c8('0x19')];var _0x112736=_0x21c784?_0x18dfec[_0x16c8('0x1c')]:_0xc57411['offset']+_0xc57411['limit'];var _0x466a01;if(_0x112736>=_0x5099c3){_0x112736=_0x5099c3;_0x466a01=0xc8;}else{_0x466a01=0xce;}_0x3868d6[_0x16c8('0x17')](_0x466a01);return _0x3868d6[_0x16c8('0x1d')](_0x16c8('0x1e'),_0x9fab89+'-'+_0x112736+'/'+_0x5099c3)['json'](_0x18dfec);}return null;};}function patchUpdates(_0x3c595f){return function(_0x14b0ac){try{jsonpatch[_0x16c8('0x1f')](_0x14b0ac,_0x3c595f,!![]);}catch(_0x443bfc){return BPromise[_0x16c8('0x20')](_0x443bfc);}return _0x14b0ac[_0x16c8('0x21')]();};}function saveUpdates(_0x30e1a6,_0x25b694){return function(_0x46c58b){if(_0x46c58b){return _0x46c58b[_0x16c8('0x22')](_0x30e1a6)[_0x16c8('0x23')](function(_0x60e330){return _0x60e330;});}return null;};}function removeEntity(_0x5e8e82,_0x24aed5){return function(_0x11351b){if(_0x11351b){return _0x11351b[_0x16c8('0x24')]()[_0x16c8('0x23')](function(){var _0x4e9197=_0x11351b[_0x16c8('0x25')]({'plain':!![]});var _0x2a6b7d=_0x16c8('0x26');return db[_0x16c8('0x27')][_0x16c8('0x24')]({'where':{'type':_0x2a6b7d,'resourceId':_0x4e9197['id']}})[_0x16c8('0x23')](function(){return _0x11351b;});})[_0x16c8('0x23')](function(){_0x5e8e82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe80e44,_0x18bd5f){return function(_0x57b436){if(!_0x57b436){_0xe80e44[_0x16c8('0x28')](0x194);}return _0x57b436;};}function handleError(_0xa2e955,_0x2838cd){_0x2838cd=_0x2838cd||0x1f4;return function(_0x5924ba){logger[_0x16c8('0x29')](_0x5924ba[_0x16c8('0x2a')]);if(_0x5924ba[_0x16c8('0x2b')]){delete _0x5924ba[_0x16c8('0x2b')];}_0xa2e955[_0x16c8('0x17')](_0x2838cd)[_0x16c8('0x2c')](_0x5924ba);};}exports[_0x16c8('0x2d')]=function(_0x450b77,_0x459cbe){var _0x400215={},_0x5c056d={},_0x152909={'count':0x0,'rows':[]};var _0x16ed02=_[_0x16c8('0x2e')](db[_0x16c8('0x2f')]['rawAttributes'],function(_0x50cea5){return{'name':_0x50cea5[_0x16c8('0x30')],'type':_0x50cea5[_0x16c8('0x31')]['key']};});_0x5c056d['model']=_[_0x16c8('0x2e')](_0x16ed02,_0x16c8('0x2b'));_0x5c056d[_0x16c8('0x32')]=_[_0x16c8('0x33')](_0x450b77[_0x16c8('0x32')]);_0x5c056d['filters']=_['intersection'](_0x5c056d[_0x16c8('0x34')],_0x5c056d[_0x16c8('0x32')]);_0x400215[_0x16c8('0x35')]=_[_0x16c8('0x36')](_0x5c056d[_0x16c8('0x34')],qs[_0x16c8('0x37')](_0x450b77[_0x16c8('0x32')][_0x16c8('0x37')]));_0x400215[_0x16c8('0x35')]=_0x400215['attributes'][_0x16c8('0x38')]?_0x400215[_0x16c8('0x35')]:_0x5c056d['model'];if(!_0x450b77[_0x16c8('0x32')][_0x16c8('0x39')]('nolimit')){_0x400215[_0x16c8('0x1b')]=qs[_0x16c8('0x1b')](_0x450b77[_0x16c8('0x32')][_0x16c8('0x1b')]);_0x400215[_0x16c8('0x19')]=qs[_0x16c8('0x19')](_0x450b77[_0x16c8('0x32')][_0x16c8('0x19')]);}_0x400215[_0x16c8('0x3a')]=qs['sort'](_0x450b77[_0x16c8('0x32')][_0x16c8('0x3b')]);_0x400215[_0x16c8('0x3c')]=qs[_0x16c8('0x3d')](_[_0x16c8('0x3e')](_0x450b77[_0x16c8('0x32')],_0x5c056d[_0x16c8('0x3d')]),_0x16ed02);if(_0x450b77['query'][_0x16c8('0x3f')]){_0x400215[_0x16c8('0x3c')]=_[_0x16c8('0x40')](_0x400215['where'],{'$or':_[_0x16c8('0x2e')](_0x16ed02,function(_0x5b79b3){if(_0x5b79b3['type']!=='VIRTUAL'){var _0x100538={};_0x100538[_0x5b79b3['name']]={'$like':'%'+_0x450b77[_0x16c8('0x32')][_0x16c8('0x3f')]+'%'};return _0x100538;}})});}_0x400215=_['merge']({},_0x400215,_0x450b77[_0x16c8('0x41')]);var _0x27bd55={'where':_0x400215[_0x16c8('0x3c')]};return db[_0x16c8('0x2f')][_0x16c8('0x1c')](_0x27bd55)['then'](function(_0xfc6b21){_0x152909[_0x16c8('0x1c')]=_0xfc6b21;if(_0x450b77['query']['includeAll']){_0x400215[_0x16c8('0x42')]=[{'all':!![]}];}return db['Interval'][_0x16c8('0x43')](_0x400215);})[_0x16c8('0x23')](function(_0x4acb5b){_0x152909[_0x16c8('0x44')]=_0x4acb5b;return _0x152909;})[_0x16c8('0x23')](respondWithFilteredResult(_0x459cbe,_0x400215))['catch'](handleError(_0x459cbe,null));};exports[_0x16c8('0x45')]=function(_0x46a03a,_0x57fc7c){var _0x1189d4={'raw':!![],'where':{'id':_0x46a03a[_0x16c8('0x46')]['id']}},_0x5dbc50={};_0x5dbc50[_0x16c8('0x34')]=_[_0x16c8('0x33')](db[_0x16c8('0x2f')]['rawAttributes']);_0x5dbc50[_0x16c8('0x32')]=_['keys'](_0x46a03a[_0x16c8('0x32')]);_0x5dbc50[_0x16c8('0x3d')]=_['intersection'](_0x5dbc50[_0x16c8('0x34')],_0x5dbc50[_0x16c8('0x32')]);_0x1189d4[_0x16c8('0x35')]=_[_0x16c8('0x36')](_0x5dbc50[_0x16c8('0x34')],qs['fields'](_0x46a03a['query'][_0x16c8('0x37')]));_0x1189d4[_0x16c8('0x35')]=_0x1189d4[_0x16c8('0x35')][_0x16c8('0x38')]?_0x1189d4[_0x16c8('0x35')]:_0x5dbc50[_0x16c8('0x34')];if(_0x46a03a[_0x16c8('0x32')][_0x16c8('0x47')]){_0x1189d4[_0x16c8('0x42')]=[{'all':!![]}];}_0x1189d4=_['merge']({},_0x1189d4,_0x46a03a[_0x16c8('0x41')]);return db[_0x16c8('0x2f')][_0x16c8('0x48')](_0x1189d4)[_0x16c8('0x23')](handleEntityNotFound(_0x57fc7c,null))['then'](respondWithResult(_0x57fc7c,null))['catch'](handleError(_0x57fc7c,null));};exports[_0x16c8('0x49')]=function(_0x182bf0,_0x47a747){return db[_0x16c8('0x2f')][_0x16c8('0x49')](_0x182bf0[_0x16c8('0x4a')],{})['then'](function(_0x2f04f5){var _0x931df0=_0x182bf0[_0x16c8('0x4b')][_0x16c8('0x25')]({'plain':!![]});if(!_0x931df0)throw new Error(_0x16c8('0x4c'));if(_0x931df0[_0x16c8('0x4d')]===_0x16c8('0x4b')){var _0x48ca63=_0x2f04f5[_0x16c8('0x25')]({'plain':!![]});var _0x159ba2=_0x16c8('0x26');return db[_0x16c8('0x4e')][_0x16c8('0x48')]({'where':{'name':_0x159ba2,'userProfileId':_0x931df0[_0x16c8('0x4f')]},'raw':!![]})[_0x16c8('0x23')](function(_0x48917b){if(_0x48917b&&_0x48917b['autoAssociation']===0x0){return db[_0x16c8('0x27')][_0x16c8('0x49')]({'name':_0x48ca63[_0x16c8('0x2b')],'resourceId':_0x48ca63['id'],'type':_0x48917b['name'],'sectionId':_0x48917b['id']},{})[_0x16c8('0x23')](function(){return _0x2f04f5;});}else{return _0x2f04f5;}})['catch'](function(_0x245161){logger[_0x16c8('0x29')](_0x16c8('0x50'),_0x245161);throw _0x245161;});}return _0x2f04f5;})[_0x16c8('0x23')](respondWithResult(_0x47a747,0xc9))[_0x16c8('0x51')](handleError(_0x47a747,null));};exports[_0x16c8('0x22')]=function(_0x4c9cc2,_0x5d08d5){if(_0x4c9cc2[_0x16c8('0x4a')]['id']){delete _0x4c9cc2[_0x16c8('0x4a')]['id'];}return db[_0x16c8('0x2f')][_0x16c8('0x48')]({'where':{'id':_0x4c9cc2[_0x16c8('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d08d5,null))[_0x16c8('0x23')](saveUpdates(_0x4c9cc2[_0x16c8('0x4a')],null))[_0x16c8('0x23')](respondWithResult(_0x5d08d5,null))['catch'](handleError(_0x5d08d5,null));};exports[_0x16c8('0x24')]=function(_0x53d904,_0x35cab5){return db[_0x16c8('0x2f')][_0x16c8('0x48')]({'where':{'id':_0x53d904[_0x16c8('0x46')]['id']}})['then'](handleEntityNotFound(_0x35cab5,null))[_0x16c8('0x23')](removeEntity(_0x35cab5,null))[_0x16c8('0x51')](handleError(_0x35cab5,null));};exports[_0x16c8('0x52')]=function(_0x3d1faa,_0x4041ef,_0x415ede){if(_0x3d1faa[_0x16c8('0x4a')]['id']){delete _0x3d1faa[_0x16c8('0x4a')]['id'];}return db['Interval'][_0x16c8('0x48')]({'where':{'id':_0x3d1faa[_0x16c8('0x46')]['id']}})[_0x16c8('0x23')](handleEntityNotFound(_0x4041ef,null))[_0x16c8('0x23')](function(_0x36f4de){if(_0x36f4de){_0x3d1faa[_0x16c8('0x4a')][_0x16c8('0x53')]=_0x36f4de['id'];return db['Interval']['create'](_0x3d1faa['body']);}})[_0x16c8('0x23')](respondWithResult(_0x4041ef,null))[_0x16c8('0x51')](handleError(_0x4041ef,null));};exports[_0x16c8('0x54')]=function(_0x430687,_0x100928,_0x386b97){var _0x103b46={};var _0x1c1bf2={};var _0x206be6;var _0x1db863;return db['Interval'][_0x16c8('0x55')]({'where':{'id':_0x430687[_0x16c8('0x46')]['id']}})[_0x16c8('0x23')](handleEntityNotFound(_0x100928,null))['then'](function(_0x56c19b){if(_0x56c19b){_0x206be6=_0x56c19b;_0x1c1bf2[_0x16c8('0x34')]=_[_0x16c8('0x33')](db['Interval'][_0x16c8('0x56')]);_0x1c1bf2[_0x16c8('0x32')]=_[_0x16c8('0x33')](_0x430687[_0x16c8('0x32')]);_0x1c1bf2[_0x16c8('0x3d')]=_[_0x16c8('0x36')](_0x1c1bf2[_0x16c8('0x34')],_0x1c1bf2[_0x16c8('0x32')]);_0x103b46[_0x16c8('0x35')]=_[_0x16c8('0x36')](_0x1c1bf2['model'],qs[_0x16c8('0x37')](_0x430687[_0x16c8('0x32')]['fields']));_0x103b46[_0x16c8('0x35')]=_0x103b46['attributes'][_0x16c8('0x38')]?_0x103b46[_0x16c8('0x35')]:_0x1c1bf2['model'];_0x103b46['order']=qs[_0x16c8('0x3b')](_0x430687[_0x16c8('0x32')][_0x16c8('0x3b')]);_0x103b46[_0x16c8('0x3c')]=qs[_0x16c8('0x3d')](_['pick'](_0x430687[_0x16c8('0x32')],_0x1c1bf2[_0x16c8('0x3d')]));if(_0x430687[_0x16c8('0x32')]['filter']){_0x103b46[_0x16c8('0x3c')]=_[_0x16c8('0x40')](_0x103b46[_0x16c8('0x3c')],{'$or':_[_0x16c8('0x2e')](_0x103b46['attributes'],function(_0x228ccc){var _0x14e121={};_0x14e121[_0x228ccc]={'$like':'%'+_0x430687[_0x16c8('0x32')]['filter']+'%'};return _0x14e121;})});}_0x103b46=_[_0x16c8('0x40')]({},_0x103b46,_0x430687['options']);return _0x206be6[_0x16c8('0x54')](_0x103b46);}})[_0x16c8('0x23')](function(_0x2c782c){if(_0x2c782c){_0x1db863=_0x2c782c['length'];if(!_0x430687[_0x16c8('0x32')][_0x16c8('0x39')](_0x16c8('0x57'))){_0x103b46['limit']=qs['limit'](_0x430687[_0x16c8('0x32')][_0x16c8('0x1b')]);_0x103b46[_0x16c8('0x19')]=qs['offset'](_0x430687[_0x16c8('0x32')][_0x16c8('0x19')]);}return _0x206be6[_0x16c8('0x54')](_0x103b46);}})[_0x16c8('0x23')](function(_0x5ee751){if(_0x5ee751){return _0x5ee751?{'count':_0x1db863,'rows':_0x5ee751}:null;}})[_0x16c8('0x23')](respondWithResult(_0x100928,null))[_0x16c8('0x51')](handleError(_0x100928,null));};exports['addIntervals']=function(_0x123922,_0x3f5118,_0x461126){return db[_0x16c8('0x2f')][_0x16c8('0x55')]({'where':{'id':_0x123922[_0x16c8('0x46')]['id']}})[_0x16c8('0x23')](handleEntityNotFound(_0x3f5118,null))['then'](function(_0x38102d){if(_0x38102d){return db[_0x16c8('0x58')][_0x16c8('0x59')](function(_0x40aef1){return db[_0x16c8('0x2f')][_0x16c8('0x24')]({'where':{'IntervalId':_0x123922[_0x16c8('0x46')]['id']},'transaction':_0x40aef1})['then'](function(_0x1ba17a){var _0x1453f8=_[_0x16c8('0x2e')](_0x123922[_0x16c8('0x4a')],function(_0x52c056){delete _0x52c056['id'];_0x52c056['IntervalId']=_0x123922[_0x16c8('0x46')]['id'];return _0x52c056;});return db['Interval']['bulkCreate'](_0x1453f8,{'transaction':_0x40aef1});});})['then'](function(){return db[_0x16c8('0x2f')][_0x16c8('0x43')]({'where':{'IntervalId':_0x123922[_0x16c8('0x46')]['id']}});});}})[_0x16c8('0x23')](respondWithResult(_0x3f5118,null))[_0x16c8('0x51')](handleError(_0x3f5118,null));}; \ No newline at end of file +var _0xc826=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','sort','where','filters','merge','filter','options','include','findAll','rows','catch','params','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','pick','getIntervals','hasOwnProperty','sequelize','transaction','bulkCreate','eml-format'];(function(_0x4ec183,_0x7df02a){var _0x4c5595=function(_0x18e9ea){while(--_0x18e9ea){_0x4ec183['push'](_0x4ec183['shift']());}};_0x4c5595(++_0x7df02a);}(_0xc826,0x11c));var _0x6c82=function(_0x40ad96,_0x2b5151){_0x40ad96=_0x40ad96-0x0;var _0xe54d71=_0xc826[_0x40ad96];return _0xe54d71;};'use strict';var emlformat=require(_0x6c82('0x0'));var rimraf=require(_0x6c82('0x1'));var zipdir=require(_0x6c82('0x2'));var jsonpatch=require(_0x6c82('0x3'));var rp=require(_0x6c82('0x4'));var moment=require(_0x6c82('0x5'));var BPromise=require(_0x6c82('0x6'));var Mustache=require(_0x6c82('0x7'));var util=require(_0x6c82('0x8'));var path=require(_0x6c82('0x9'));var sox=require(_0x6c82('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c82('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c82('0xc'));var jsforce=require(_0x6c82('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c82('0xe'));var querystring=require(_0x6c82('0xf'));var Papa=require(_0x6c82('0x10'));var Redis=require(_0x6c82('0x11'));var authService=require(_0x6c82('0x12'));var qs=require(_0x6c82('0x13'));var as=require(_0x6c82('0x14'));var hardwareService=require(_0x6c82('0x15'));var logger=require(_0x6c82('0x16'))(_0x6c82('0x17'));var utils=require(_0x6c82('0x18'));var config=require(_0x6c82('0x19'));var licenseUtil=require(_0x6c82('0x1a'));var db=require(_0x6c82('0x1b'))['db'];var extensions=require(_0x6c82('0x1c'));function respondWithStatusCode(_0x19ccb1,_0x407a6f){_0x407a6f=_0x407a6f||0xcc;return function(_0x53e5a4){if(_0x53e5a4){return _0x19ccb1[_0x6c82('0x1d')](_0x407a6f);}return _0x19ccb1[_0x6c82('0x1e')](_0x407a6f)[_0x6c82('0x1f')]();};}function respondWithResult(_0x549fad,_0x3664f0){_0x3664f0=_0x3664f0||0xc8;return function(_0x1489b9){if(_0x1489b9){return _0x549fad[_0x6c82('0x1e')](_0x3664f0)['json'](_0x1489b9);}};}function respondWithFilteredResult(_0x590d56,_0x46e445){return function(_0x1caa78){if(_0x1caa78){var _0x19e3de=typeof _0x46e445[_0x6c82('0x20')]===_0x6c82('0x21')&&typeof _0x46e445[_0x6c82('0x22')]==='undefined';var _0x490608=_0x1caa78['count'];var _0x3ef90b=_0x19e3de?0x0:_0x46e445['offset'];var _0x362edb=_0x19e3de?_0x1caa78[_0x6c82('0x23')]:_0x46e445[_0x6c82('0x20')]+_0x46e445['limit'];var _0x78a6f9;if(_0x362edb>=_0x490608){_0x362edb=_0x490608;_0x78a6f9=0xc8;}else{_0x78a6f9=0xce;}_0x590d56[_0x6c82('0x1e')](_0x78a6f9);return _0x590d56[_0x6c82('0x24')](_0x6c82('0x25'),_0x3ef90b+'-'+_0x362edb+'/'+_0x490608)[_0x6c82('0x26')](_0x1caa78);}return null;};}function patchUpdates(_0x109293){return function(_0x95c27e){try{jsonpatch[_0x6c82('0x27')](_0x95c27e,_0x109293,!![]);}catch(_0x5bd987){return BPromise[_0x6c82('0x28')](_0x5bd987);}return _0x95c27e[_0x6c82('0x29')]();};}function saveUpdates(_0x47fb60,_0x794400){return function(_0x2e3406){if(_0x2e3406){return _0x2e3406[_0x6c82('0x2a')](_0x47fb60)[_0x6c82('0x2b')](function(_0x3922b1){return _0x3922b1;});}return null;};}function removeEntity(_0x472831,_0x55e670){return function(_0x3272fa){if(_0x3272fa){return _0x3272fa[_0x6c82('0x2c')]()[_0x6c82('0x2b')](function(){var _0x475209=_0x3272fa[_0x6c82('0x2d')]({'plain':!![]});var _0x57fe66=_0x6c82('0x2e');return db[_0x6c82('0x2f')]['destroy']({'where':{'type':_0x57fe66,'resourceId':_0x475209['id']}})[_0x6c82('0x2b')](function(){return _0x3272fa;});})['then'](function(){_0x472831[_0x6c82('0x1e')](0xcc)[_0x6c82('0x1f')]();});}};}function handleEntityNotFound(_0x4d6783,_0xb9c408){return function(_0x2bcd39){if(!_0x2bcd39){_0x4d6783[_0x6c82('0x1d')](0x194);}return _0x2bcd39;};}function handleError(_0x8a6e8f,_0x234e6c){_0x234e6c=_0x234e6c||0x1f4;return function(_0x28ed0a){logger['error'](_0x28ed0a[_0x6c82('0x30')]);if(_0x28ed0a['name']){delete _0x28ed0a[_0x6c82('0x31')];}_0x8a6e8f[_0x6c82('0x1e')](_0x234e6c)[_0x6c82('0x32')](_0x28ed0a);};}exports[_0x6c82('0x33')]=function(_0x203137,_0x2f8e01){var _0x5660e2={},_0x20bef0={},_0x2e2d23={'count':0x0,'rows':[]};var _0x48cb1b=_[_0x6c82('0x34')](db[_0x6c82('0x35')][_0x6c82('0x36')],function(_0x529d9b){return{'name':_0x529d9b[_0x6c82('0x37')],'type':_0x529d9b[_0x6c82('0x38')][_0x6c82('0x39')]};});_0x20bef0[_0x6c82('0x3a')]=_[_0x6c82('0x34')](_0x48cb1b,_0x6c82('0x31'));_0x20bef0[_0x6c82('0x3b')]=_[_0x6c82('0x3c')](_0x203137[_0x6c82('0x3b')]);_0x20bef0['filters']=_['intersection'](_0x20bef0[_0x6c82('0x3a')],_0x20bef0['query']);_0x5660e2[_0x6c82('0x3d')]=_['intersection'](_0x20bef0[_0x6c82('0x3a')],qs[_0x6c82('0x3e')](_0x203137['query'][_0x6c82('0x3e')]));_0x5660e2['attributes']=_0x5660e2[_0x6c82('0x3d')][_0x6c82('0x3f')]?_0x5660e2[_0x6c82('0x3d')]:_0x20bef0[_0x6c82('0x3a')];if(!_0x203137[_0x6c82('0x3b')]['hasOwnProperty'](_0x6c82('0x40'))){_0x5660e2[_0x6c82('0x22')]=qs[_0x6c82('0x22')](_0x203137['query'][_0x6c82('0x22')]);_0x5660e2[_0x6c82('0x20')]=qs[_0x6c82('0x20')](_0x203137[_0x6c82('0x3b')][_0x6c82('0x20')]);}_0x5660e2['order']=qs['sort'](_0x203137[_0x6c82('0x3b')][_0x6c82('0x41')]);_0x5660e2[_0x6c82('0x42')]=qs[_0x6c82('0x43')](_['pick'](_0x203137[_0x6c82('0x3b')],_0x20bef0[_0x6c82('0x43')]),_0x48cb1b);if(_0x203137[_0x6c82('0x3b')]['filter']){_0x5660e2[_0x6c82('0x42')]=_[_0x6c82('0x44')](_0x5660e2['where'],{'$or':_['map'](_0x48cb1b,function(_0x4a51b1){if(_0x4a51b1[_0x6c82('0x38')]!=='VIRTUAL'){var _0x4b5179={};_0x4b5179[_0x4a51b1[_0x6c82('0x31')]]={'$like':'%'+_0x203137[_0x6c82('0x3b')][_0x6c82('0x45')]+'%'};return _0x4b5179;}})});}_0x5660e2=_[_0x6c82('0x44')]({},_0x5660e2,_0x203137[_0x6c82('0x46')]);var _0xebda86={'where':_0x5660e2[_0x6c82('0x42')]};return db[_0x6c82('0x35')][_0x6c82('0x23')](_0xebda86)['then'](function(_0x1ebc62){_0x2e2d23[_0x6c82('0x23')]=_0x1ebc62;if(_0x203137[_0x6c82('0x3b')]['includeAll']){_0x5660e2[_0x6c82('0x47')]=[{'all':!![]}];}return db[_0x6c82('0x35')][_0x6c82('0x48')](_0x5660e2);})[_0x6c82('0x2b')](function(_0x48ac3c){_0x2e2d23[_0x6c82('0x49')]=_0x48ac3c;return _0x2e2d23;})[_0x6c82('0x2b')](respondWithFilteredResult(_0x2f8e01,_0x5660e2))[_0x6c82('0x4a')](handleError(_0x2f8e01,null));};exports['show']=function(_0x4e653a,_0x1d1a16){var _0x4a4740={'raw':!![],'where':{'id':_0x4e653a[_0x6c82('0x4b')]['id']}},_0x2afb4d={};_0x2afb4d[_0x6c82('0x3a')]=_[_0x6c82('0x3c')](db[_0x6c82('0x35')][_0x6c82('0x36')]);_0x2afb4d[_0x6c82('0x3b')]=_['keys'](_0x4e653a['query']);_0x2afb4d['filters']=_[_0x6c82('0x4c')](_0x2afb4d[_0x6c82('0x3a')],_0x2afb4d[_0x6c82('0x3b')]);_0x4a4740[_0x6c82('0x3d')]=_[_0x6c82('0x4c')](_0x2afb4d[_0x6c82('0x3a')],qs['fields'](_0x4e653a[_0x6c82('0x3b')][_0x6c82('0x3e')]));_0x4a4740[_0x6c82('0x3d')]=_0x4a4740[_0x6c82('0x3d')][_0x6c82('0x3f')]?_0x4a4740[_0x6c82('0x3d')]:_0x2afb4d['model'];if(_0x4e653a[_0x6c82('0x3b')]['includeAll']){_0x4a4740[_0x6c82('0x47')]=[{'all':!![]}];}_0x4a4740=_[_0x6c82('0x44')]({},_0x4a4740,_0x4e653a[_0x6c82('0x46')]);return db[_0x6c82('0x35')][_0x6c82('0x4d')](_0x4a4740)[_0x6c82('0x2b')](handleEntityNotFound(_0x1d1a16,null))['then'](respondWithResult(_0x1d1a16,null))[_0x6c82('0x4a')](handleError(_0x1d1a16,null));};exports['create']=function(_0x314db0,_0x4b3d6b){return db['Interval'][_0x6c82('0x4e')](_0x314db0[_0x6c82('0x4f')],{})[_0x6c82('0x2b')](function(_0x36888){var _0x11701b=_0x314db0['user'][_0x6c82('0x2d')]({'plain':!![]});if(!_0x11701b)throw new Error(_0x6c82('0x50'));if(_0x11701b[_0x6c82('0x51')]==='user'){var _0x3ea526=_0x36888[_0x6c82('0x2d')]({'plain':!![]});var _0x321329=_0x6c82('0x2e');return db[_0x6c82('0x52')][_0x6c82('0x4d')]({'where':{'name':_0x321329,'userProfileId':_0x11701b['userProfileId']},'raw':!![]})[_0x6c82('0x2b')](function(_0x48991f){if(_0x48991f&&_0x48991f[_0x6c82('0x53')]===0x0){return db['UserProfileResource'][_0x6c82('0x4e')]({'name':_0x3ea526[_0x6c82('0x31')],'resourceId':_0x3ea526['id'],'type':_0x48991f[_0x6c82('0x31')],'sectionId':_0x48991f['id']},{})['then'](function(){return _0x36888;});}else{return _0x36888;}})['catch'](function(_0x5364b9){logger[_0x6c82('0x54')](_0x6c82('0x55'),_0x5364b9);throw _0x5364b9;});}return _0x36888;})['then'](respondWithResult(_0x4b3d6b,0xc9))[_0x6c82('0x4a')](handleError(_0x4b3d6b,null));};exports['update']=function(_0x3c40aa,_0x1c79e0){if(_0x3c40aa[_0x6c82('0x4f')]['id']){delete _0x3c40aa[_0x6c82('0x4f')]['id'];}return db['Interval'][_0x6c82('0x4d')]({'where':{'id':_0x3c40aa[_0x6c82('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c79e0,null))[_0x6c82('0x2b')](saveUpdates(_0x3c40aa['body'],null))[_0x6c82('0x2b')](respondWithResult(_0x1c79e0,null))[_0x6c82('0x4a')](handleError(_0x1c79e0,null));};exports[_0x6c82('0x2c')]=function(_0x1a9318,_0x1ba817){return db[_0x6c82('0x35')]['find']({'where':{'id':_0x1a9318[_0x6c82('0x4b')]['id']}})[_0x6c82('0x2b')](handleEntityNotFound(_0x1ba817,null))['then'](removeEntity(_0x1ba817,null))[_0x6c82('0x4a')](handleError(_0x1ba817,null));};exports[_0x6c82('0x56')]=function(_0x26ad60,_0x315742,_0x292b97){if(_0x26ad60['body']['id']){delete _0x26ad60['body']['id'];}return db['Interval']['find']({'where':{'id':_0x26ad60[_0x6c82('0x4b')]['id']}})['then'](handleEntityNotFound(_0x315742,null))[_0x6c82('0x2b')](function(_0x32c262){if(_0x32c262){_0x26ad60[_0x6c82('0x4f')][_0x6c82('0x57')]=_0x32c262['id'];return db['Interval'][_0x6c82('0x4e')](_0x26ad60[_0x6c82('0x4f')]);}})[_0x6c82('0x2b')](respondWithResult(_0x315742,null))[_0x6c82('0x4a')](handleError(_0x315742,null));};exports['getIntervals']=function(_0x5c23e4,_0x4f2c9b,_0xf6a1a1){var _0x10eedc={};var _0x4bbeda={};var _0x5bdfda;var _0x26bbb7;return db['Interval'][_0x6c82('0x58')]({'where':{'id':_0x5c23e4[_0x6c82('0x4b')]['id']}})[_0x6c82('0x2b')](handleEntityNotFound(_0x4f2c9b,null))['then'](function(_0x24b32c){if(_0x24b32c){_0x5bdfda=_0x24b32c;_0x4bbeda['model']=_[_0x6c82('0x3c')](db[_0x6c82('0x35')]['rawAttributes']);_0x4bbeda[_0x6c82('0x3b')]=_[_0x6c82('0x3c')](_0x5c23e4[_0x6c82('0x3b')]);_0x4bbeda[_0x6c82('0x43')]=_['intersection'](_0x4bbeda[_0x6c82('0x3a')],_0x4bbeda[_0x6c82('0x3b')]);_0x10eedc[_0x6c82('0x3d')]=_[_0x6c82('0x4c')](_0x4bbeda[_0x6c82('0x3a')],qs['fields'](_0x5c23e4[_0x6c82('0x3b')]['fields']));_0x10eedc[_0x6c82('0x3d')]=_0x10eedc[_0x6c82('0x3d')][_0x6c82('0x3f')]?_0x10eedc[_0x6c82('0x3d')]:_0x4bbeda['model'];_0x10eedc['order']=qs['sort'](_0x5c23e4[_0x6c82('0x3b')][_0x6c82('0x41')]);_0x10eedc[_0x6c82('0x42')]=qs[_0x6c82('0x43')](_[_0x6c82('0x59')](_0x5c23e4[_0x6c82('0x3b')],_0x4bbeda[_0x6c82('0x43')]));if(_0x5c23e4[_0x6c82('0x3b')][_0x6c82('0x45')]){_0x10eedc[_0x6c82('0x42')]=_[_0x6c82('0x44')](_0x10eedc[_0x6c82('0x42')],{'$or':_[_0x6c82('0x34')](_0x10eedc['attributes'],function(_0x4f9a29){var _0xa72ec6={};_0xa72ec6[_0x4f9a29]={'$like':'%'+_0x5c23e4[_0x6c82('0x3b')][_0x6c82('0x45')]+'%'};return _0xa72ec6;})});}_0x10eedc=_[_0x6c82('0x44')]({},_0x10eedc,_0x5c23e4['options']);return _0x5bdfda[_0x6c82('0x5a')](_0x10eedc);}})[_0x6c82('0x2b')](function(_0x2708d4){if(_0x2708d4){_0x26bbb7=_0x2708d4[_0x6c82('0x3f')];if(!_0x5c23e4[_0x6c82('0x3b')][_0x6c82('0x5b')](_0x6c82('0x40'))){_0x10eedc[_0x6c82('0x22')]=qs['limit'](_0x5c23e4[_0x6c82('0x3b')][_0x6c82('0x22')]);_0x10eedc[_0x6c82('0x20')]=qs[_0x6c82('0x20')](_0x5c23e4['query']['offset']);}return _0x5bdfda[_0x6c82('0x5a')](_0x10eedc);}})[_0x6c82('0x2b')](function(_0x29ba0e){if(_0x29ba0e){return _0x29ba0e?{'count':_0x26bbb7,'rows':_0x29ba0e}:null;}})['then'](respondWithResult(_0x4f2c9b,null))[_0x6c82('0x4a')](handleError(_0x4f2c9b,null));};exports['addIntervals']=function(_0x4e94c7,_0x3a7180,_0x38e09b){return db[_0x6c82('0x35')]['findOne']({'where':{'id':_0x4e94c7[_0x6c82('0x4b')]['id']}})[_0x6c82('0x2b')](handleEntityNotFound(_0x3a7180,null))['then'](function(_0x3e1924){if(_0x3e1924){return db[_0x6c82('0x5c')][_0x6c82('0x5d')](function(_0x42d36f){return db['Interval']['destroy']({'where':{'IntervalId':_0x4e94c7[_0x6c82('0x4b')]['id']},'transaction':_0x42d36f})['then'](function(_0x25885a){var _0x3660c4=_[_0x6c82('0x34')](_0x4e94c7[_0x6c82('0x4f')],function(_0x324cd0){delete _0x324cd0['id'];_0x324cd0['IntervalId']=_0x4e94c7[_0x6c82('0x4b')]['id'];return _0x324cd0;});return db['Interval'][_0x6c82('0x5e')](_0x3660c4,{'transaction':_0x42d36f});});})['then'](function(){return db[_0x6c82('0x35')][_0x6c82('0x48')]({'where':{'IntervalId':_0x4e94c7[_0x6c82('0x4b')]['id']}});});}})[_0x6c82('0x2b')](respondWithResult(_0x3a7180,null))[_0x6c82('0x4a')](handleError(_0x3a7180,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 9bb507c..9f2db66 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 _0x8198=['getIntervals','then','all','map','ifTime','reduce','../../components/extensions/rewrite','iftime','exports','define','Interval','rewrite','string','interval'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x8198,0xca));var _0x8819=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x8198[_0xea343d];return _0x2c6e9c;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x8819('0x0'));var iftime=require('../../utils/iftime')[_0x8819('0x1')];module[_0x8819('0x2')]=function(_0x45e087){return _0x45e087[_0x8819('0x3')](_0x8819('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x57488c){extensions[_0x8819('0x5')](_0x45e087,_0x57488c);},'afterBulkCreate':function(_0xe8e652,_0x48d4fb,_0x529792){_0x529792();extensions[_0x8819('0x5')](_0x45e087,_0xe8e652[0x0]);},'afterUpdate':function(_0x392280){extensions[_0x8819('0x5')](_0x45e087,_0x392280);},'afterDestroy':function(_0x44e88b){extensions[_0x8819('0x5')](_0x45e087,_0x44e88b);}},'instanceMethods':{'ifTime':function(_0x5c5b18=undefined,_0x48d9a4=new Date()){if(typeof this['interval']===_0x8819('0x6')){return iftime(this[_0x8819('0x7')],_0x5c5b18,_0x48d9a4);}else{return this[_0x8819('0x8')]()[_0x8819('0x9')](function(_0x1cc214){return Promise[_0x8819('0xa')](_0x1cc214[_0x8819('0xb')](function(_0x13d440){return _0x13d440[_0x8819('0xc')](_0x5c5b18,_0x48d9a4);}));})['then'](function(_0x1697f2){return _0x1697f2[_0x8819('0xd')](function(_0x5ccce5,_0x40ad88){return _0x5ccce5||_0x40ad88;},![]);});}}}});}; \ No newline at end of file +var _0x6d25=['../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','then','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite'];(function(_0x5c8410,_0x39b891){var _0x440045=function(_0x5349db){while(--_0x5349db){_0x5c8410['push'](_0x5c8410['shift']());}};_0x440045(++_0x39b891);}(_0x6d25,0x98));var _0x56d2=function(_0x168b7e,_0x5e3322){_0x168b7e=_0x168b7e-0x0;var _0x12be52=_0x6d25[_0x168b7e];return _0x12be52;};'use strict';var attributes=require(_0x56d2('0x0'));var extensions=require(_0x56d2('0x1'));var iftime=require(_0x56d2('0x2'))['iftime'];module[_0x56d2('0x3')]=function(_0x594e8b){return _0x594e8b[_0x56d2('0x4')](_0x56d2('0x5'),attributes,{'tableName':_0x56d2('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c4896){extensions[_0x56d2('0x7')](_0x594e8b,_0x1c4896);},'afterBulkCreate':function(_0x16d054,_0x194b6c,_0x412e6a){_0x412e6a();extensions['rewrite'](_0x594e8b,_0x16d054[0x0]);},'afterUpdate':function(_0x29d40c){extensions['rewrite'](_0x594e8b,_0x29d40c);},'afterDestroy':function(_0x526864){extensions['rewrite'](_0x594e8b,_0x526864);}},'instanceMethods':{'ifTime':function(_0xff8f0b=undefined,_0x4390d9=new Date()){if(typeof this[_0x56d2('0x8')]==='string'){return iftime(this[_0x56d2('0x8')],_0xff8f0b,_0x4390d9);}else{return this[_0x56d2('0x9')]()[_0x56d2('0xa')](function(_0x137754){return Promise['all'](_0x137754[_0x56d2('0xb')](function(_0x1640b3){return _0x1640b3[_0x56d2('0xc')](_0xff8f0b,_0x4390d9);}));})[_0x56d2('0xa')](function(_0x4e8825){return _0x4e8825[_0x56d2('0xd')](function(_0x5f384c,_0x1377ed){return _0x5f384c||_0x1377ed;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ca92c27..d2a6eac 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 _0x4270=['isArray','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','raw','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','Interval','ShowInterval','findAll','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds'];(function(_0x53153f,_0x5b9a80){var _0x381bc1=function(_0x4423dc){while(--_0x4423dc){_0x53153f['push'](_0x53153f['shift']());}};_0x381bc1(++_0x5b9a80);}(_0x4270,0xe4));var _0x0427=function(_0x49ddcf,_0xd9451b){_0x49ddcf=_0x49ddcf-0x0;var _0x233053=_0x4270[_0x49ddcf];return _0x233053;};'use strict';var _=require(_0x0427('0x0'));var util=require('util');var db=require(_0x0427('0x1'))['db'];var iftime=require(_0x0427('0x2'))[_0x0427('0x3')];var logger=require(_0x0427('0x4'))(_0x0427('0x5'));exports[_0x0427('0x6')]=function(_0x4b3cdd){var _0x32345b=this;return new Promise(function(_0x5444c4,_0xa90c46){return db['Interval']['findAll']({'raw':_0x4b3cdd['options']?_0x4b3cdd['options'][_0x0427('0x7')]===undefined?!![]:![]:!![],'where':_0x4b3cdd[_0x0427('0x8')]?_0x4b3cdd[_0x0427('0x8')][_0x0427('0x9')]||null:null,'attributes':_0x4b3cdd['options']?_0x4b3cdd['options'][_0x0427('0xa')]||null:null,'limit':_0x4b3cdd[_0x0427('0x8')]?_0x4b3cdd[_0x0427('0x8')][_0x0427('0xb')]||null:null,'include':_0x4b3cdd[_0x0427('0x8')]?_0x4b3cdd[_0x0427('0x8')][_0x0427('0xc')]?_[_0x0427('0xd')](_0x4b3cdd[_0x0427('0x8')][_0x0427('0xc')],function(_0x3731ed){return{'model':db[_0x3731ed[_0x0427('0xe')]],'as':_0x3731ed['as'],'attributes':_0x3731ed['attributes'],'include':_0x3731ed['include']?_[_0x0427('0xd')](_0x3731ed['include'],function(_0x521f5a){return{'model':db[_0x521f5a[_0x0427('0xe')]],'as':_0x521f5a['as'],'attributes':_0x521f5a['attributes'],'include':_0x521f5a[_0x0427('0xc')]?_['map'](_0x521f5a['include'],function(_0x49c174){return{'model':db[_0x49c174['model']],'as':_0x49c174['as'],'attributes':_0x49c174['attributes']};}):[]};}):[]};}):[]:[]})[_0x0427('0xf')](function(_0x296e4f){logger[_0x0427('0x10')](_0x0427('0x6'),_0x4b3cdd);logger[_0x0427('0x11')]('GetInterval',_0x4b3cdd,JSON[_0x0427('0x12')](_0x296e4f));_0x5444c4(_0x296e4f);})[_0x0427('0x13')](function(_0x9f95f4){logger[_0x0427('0x14')](_0x0427('0x6'),_0x9f95f4[_0x0427('0x15')],_0x4b3cdd);_0xa90c46(_0x32345b[_0x0427('0x14')](0x1f4,_0x9f95f4[_0x0427('0x15')]));});});};exports['ShowInterval']=function(_0x41fb0b){var _0x2af28e=this;return new Promise(function(_0x59f884,_0xaefe5d){return db[_0x0427('0x16')]['find']({'raw':_0x41fb0b[_0x0427('0x8')]?_0x41fb0b[_0x0427('0x8')][_0x0427('0x7')]===undefined?!![]:![]:!![],'where':_0x41fb0b[_0x0427('0x8')]?_0x41fb0b['options']['where']||null:null,'attributes':_0x41fb0b[_0x0427('0x8')]?_0x41fb0b[_0x0427('0x8')][_0x0427('0xa')]||null:null,'include':_0x41fb0b[_0x0427('0x8')]?_0x41fb0b['options']['include']?_[_0x0427('0xd')](_0x41fb0b[_0x0427('0x8')][_0x0427('0xc')],function(_0x1d4788){return{'model':db[_0x1d4788[_0x0427('0xe')]],'as':_0x1d4788['as'],'attributes':_0x1d4788['attributes'],'include':_0x1d4788[_0x0427('0xc')]?_[_0x0427('0xd')](_0x1d4788[_0x0427('0xc')],function(_0x2119c5){return{'model':db[_0x2119c5[_0x0427('0xe')]],'as':_0x2119c5['as'],'attributes':_0x2119c5[_0x0427('0xa')],'include':_0x2119c5[_0x0427('0xc')]?_['map'](_0x2119c5['include'],function(_0x4744e2){return{'model':db[_0x4744e2['model']],'as':_0x4744e2['as'],'attributes':_0x4744e2[_0x0427('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0427('0xf')](function(_0x36c02e){logger[_0x0427('0x10')](_0x0427('0x17'),_0x41fb0b);logger[_0x0427('0x11')]('ShowInterval',_0x41fb0b,JSON[_0x0427('0x12')](_0x36c02e));_0x59f884(_0x36c02e);})[_0x0427('0x13')](function(_0x54c224){logger['error'](_0x0427('0x17'),_0x54c224[_0x0427('0x15')],_0x41fb0b);_0xaefe5d(_0x2af28e['error'](0x1f4,_0x54c224[_0x0427('0x15')]));});});};function checkArrayOfIntervals(_0x2ad61f,_0x102269){var _0x4dfcdf=[];return db[_0x0427('0x16')][_0x0427('0x18')]({'where':{'id':_0x2ad61f}})['then'](function(_0x16a165){_0x4dfcdf=_0x16a165;return Promise[_0x0427('0x19')](_0x4dfcdf['map'](function(_0x15e9c3){return _0x15e9c3['ifTime'](_0x102269);}));})[_0x0427('0xf')](function(_0x49f9d7){var _0x455ad8=_0x49f9d7[_0x0427('0x1a')](function(_0x54fbbc,_0x17a450){return _0x54fbbc||_0x17a450;},![]);logger['info'](util[_0x0427('0x1b')](_0x0427('0x1c'),_0x4dfcdf[_0x0427('0xd')](function(_0x5eb870){return _0x5eb870[_0x0427('0x1d')];})[_0x0427('0x1e')](',\x20'),_0x4dfcdf['map'](function(_0xc8f3cb){return _0xc8f3cb['id'];})[_0x0427('0x1e')](',\x20')));return _0x455ad8;});}function checkSingleInterval(_0x50691c,_0x50524b){return db['Interval'][_0x0427('0x1f')](_0x50691c)[_0x0427('0xf')](function(_0x3ece9b){if(_0x3ece9b){logger[_0x0427('0x10')](util[_0x0427('0x1b')](_0x0427('0x20'),_0x3ece9b[_0x0427('0x1d')],_0x3ece9b['id']));return _0x3ece9b[_0x0427('0x21')](_0x50524b);}});}exports[_0x0427('0x22')]=function(_0x3f4ea8){var _0xb2db5d=_0x3f4ea8[_0x0427('0x23')];var _0x5afca5=Array[_0x0427('0x24')](_0x3f4ea8[_0x0427('0x25')])?_0x3f4ea8['intervals']:typeof _0x3f4ea8[_0x0427('0x25')]===_0x0427('0x26')?[_0x3f4ea8['intervals']]:[];var _0x260839=_0x3f4ea8[_0x0427('0x27')]||undefined;var _0x482ad2=![];if(_0x5afca5[_0x0427('0x28')]){logger[_0x0427('0x10')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5afca5[_0x0427('0x1e')](';\x20')));}if(_0x260839){logger[_0x0427('0x10')](util[_0x0427('0x1b')](_0x0427('0x29'),_0x260839));}logger[_0x0427('0x11')]('Iftime',_0x482ad2);logger[_0x0427('0x2a')](_0x0427('0x22'),_0x3f4ea8);return Promise[_0x0427('0x2b')]()[_0x0427('0xf')](function(){if(Array[_0x0427('0x24')](_0xb2db5d)){return checkArrayOfIntervals(_0xb2db5d,_0x260839);}else if(_0xb2db5d){return checkSingleInterval(_0xb2db5d,_0x260839);}})[_0x0427('0xf')](function(_0x5eff75){var _0x36cd09=_0x5afca5[_0x0427('0x1a')](function(_0x5cd1ed,_0x590ea0){return _0x5cd1ed||iftime(_0x590ea0,_0x260839);},![]);_0x482ad2=_0x5eff75||_0x36cd09;return _0x482ad2;})[_0x0427('0x13')](function(_0x333f5c){logger[_0x0427('0x14')](_0x0427('0x22'),_0x3f4ea8,_0x333f5c);throw this[_0x0427('0x14')](0x1f4,_0x333f5c['message']);});}; \ No newline at end of file +var _0x2732=['error','ShowInterval','find','catch','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','reduce','util','../../mysqldb','../../utils/iftime','iftime','GetInterval','Interval','findAll','options','raw','where','attributes','limit','model','include','map','then','info','debug','stringify','message'];(function(_0x3212cc,_0x3bfe46){var _0x3ecd2c=function(_0x594465){while(--_0x594465){_0x3212cc['push'](_0x3212cc['shift']());}};_0x3ecd2c(++_0x3bfe46);}(_0x2732,0xee));var _0x2273=function(_0x3b2e32,_0x565c){_0x3b2e32=_0x3b2e32-0x0;var _0x5b84ee=_0x2732[_0x3b2e32];return _0x5b84ee;};'use strict';var _=require('lodash');var util=require(_0x2273('0x0'));var db=require(_0x2273('0x1'))['db'];var iftime=require(_0x2273('0x2'))[_0x2273('0x3')];var logger=require('../../config/logger')('rpc');exports[_0x2273('0x4')]=function(_0x53d991){var _0x96c6ff=this;return new Promise(function(_0x4b3a8e,_0x48d18e){return db[_0x2273('0x5')][_0x2273('0x6')]({'raw':_0x53d991['options']?_0x53d991[_0x2273('0x7')][_0x2273('0x8')]===undefined?!![]:![]:!![],'where':_0x53d991['options']?_0x53d991[_0x2273('0x7')][_0x2273('0x9')]||null:null,'attributes':_0x53d991['options']?_0x53d991[_0x2273('0x7')][_0x2273('0xa')]||null:null,'limit':_0x53d991[_0x2273('0x7')]?_0x53d991[_0x2273('0x7')][_0x2273('0xb')]||null:null,'include':_0x53d991['options']?_0x53d991[_0x2273('0x7')]['include']?_['map'](_0x53d991[_0x2273('0x7')]['include'],function(_0x3579bc){return{'model':db[_0x3579bc[_0x2273('0xc')]],'as':_0x3579bc['as'],'attributes':_0x3579bc[_0x2273('0xa')],'include':_0x3579bc[_0x2273('0xd')]?_['map'](_0x3579bc[_0x2273('0xd')],function(_0x2b467b){return{'model':db[_0x2b467b[_0x2273('0xc')]],'as':_0x2b467b['as'],'attributes':_0x2b467b['attributes'],'include':_0x2b467b[_0x2273('0xd')]?_[_0x2273('0xe')](_0x2b467b['include'],function(_0x4e9352){return{'model':db[_0x4e9352[_0x2273('0xc')]],'as':_0x4e9352['as'],'attributes':_0x4e9352['attributes']};}):[]};}):[]};}):[]:[]})[_0x2273('0xf')](function(_0x57894c){logger[_0x2273('0x10')](_0x2273('0x4'),_0x53d991);logger[_0x2273('0x11')](_0x2273('0x4'),_0x53d991,JSON[_0x2273('0x12')](_0x57894c));_0x4b3a8e(_0x57894c);})['catch'](function(_0x24546e){logger['error']('GetInterval',_0x24546e[_0x2273('0x13')],_0x53d991);_0x48d18e(_0x96c6ff[_0x2273('0x14')](0x1f4,_0x24546e[_0x2273('0x13')]));});});};exports[_0x2273('0x15')]=function(_0x5c7bf2){var _0x36b27b=this;return new Promise(function(_0x1a99ec,_0x11f1a4){return db['Interval'][_0x2273('0x16')]({'raw':_0x5c7bf2['options']?_0x5c7bf2[_0x2273('0x7')][_0x2273('0x8')]===undefined?!![]:![]:!![],'where':_0x5c7bf2['options']?_0x5c7bf2['options'][_0x2273('0x9')]||null:null,'attributes':_0x5c7bf2[_0x2273('0x7')]?_0x5c7bf2[_0x2273('0x7')][_0x2273('0xa')]||null:null,'include':_0x5c7bf2[_0x2273('0x7')]?_0x5c7bf2[_0x2273('0x7')][_0x2273('0xd')]?_['map'](_0x5c7bf2[_0x2273('0x7')]['include'],function(_0x532db3){return{'model':db[_0x532db3[_0x2273('0xc')]],'as':_0x532db3['as'],'attributes':_0x532db3['attributes'],'include':_0x532db3[_0x2273('0xd')]?_['map'](_0x532db3[_0x2273('0xd')],function(_0x2b8775){return{'model':db[_0x2b8775['model']],'as':_0x2b8775['as'],'attributes':_0x2b8775['attributes'],'include':_0x2b8775[_0x2273('0xd')]?_['map'](_0x2b8775[_0x2273('0xd')],function(_0x400614){return{'model':db[_0x400614[_0x2273('0xc')]],'as':_0x400614['as'],'attributes':_0x400614[_0x2273('0xa')]};}):[]};}):[]};}):[]:[]})[_0x2273('0xf')](function(_0x47a620){logger[_0x2273('0x10')](_0x2273('0x15'),_0x5c7bf2);logger['debug']('ShowInterval',_0x5c7bf2,JSON['stringify'](_0x47a620));_0x1a99ec(_0x47a620);})[_0x2273('0x17')](function(_0x1af52a){logger[_0x2273('0x14')](_0x2273('0x15'),_0x1af52a['message'],_0x5c7bf2);_0x11f1a4(_0x36b27b['error'](0x1f4,_0x1af52a[_0x2273('0x13')]));});});};function checkArrayOfIntervals(_0x545a01,_0x1127c4){var _0x388e9f=[];return db[_0x2273('0x5')][_0x2273('0x6')]({'where':{'id':_0x545a01}})[_0x2273('0xf')](function(_0x414614){_0x388e9f=_0x414614;return Promise['all'](_0x388e9f[_0x2273('0xe')](function(_0x4622db){return _0x4622db[_0x2273('0x18')](_0x1127c4);}));})[_0x2273('0xf')](function(_0x1e2fa6){var _0x47da4d=_0x1e2fa6['reduce'](function(_0x4cd13e,_0x3530be){return _0x4cd13e||_0x3530be;},![]);logger[_0x2273('0x10')](util['format'](_0x2273('0x19'),_0x388e9f[_0x2273('0xe')](function(_0x26eaa5){return _0x26eaa5[_0x2273('0x1a')];})[_0x2273('0x1b')](',\x20'),_0x388e9f[_0x2273('0xe')](function(_0x2708a5){return _0x2708a5['id'];})['join'](',\x20')));return _0x47da4d;});}function checkSingleInterval(_0x5607b5,_0x55284f){return db[_0x2273('0x5')][_0x2273('0x1c')](_0x5607b5)[_0x2273('0xf')](function(_0x5d6b16){if(_0x5d6b16){logger[_0x2273('0x10')](util[_0x2273('0x1d')](_0x2273('0x1e'),_0x5d6b16[_0x2273('0x1a')],_0x5d6b16['id']));return _0x5d6b16[_0x2273('0x18')](_0x55284f);}});}exports[_0x2273('0x1f')]=function(_0x218196){var _0x7f494c=_0x218196[_0x2273('0x20')];var _0x22aa17=Array[_0x2273('0x21')](_0x218196[_0x2273('0x22')])?_0x218196['intervals']:typeof _0x218196['intervals']==='string'?[_0x218196['intervals']]:[];var _0x1352ef=_0x218196[_0x2273('0x23')]||undefined;var _0x1090e5=![];if(_0x22aa17[_0x2273('0x24')]){logger[_0x2273('0x10')](util['format'](_0x2273('0x25'),_0x22aa17[_0x2273('0x1b')](';\x20')));}if(_0x1352ef){logger[_0x2273('0x10')](util['format'](_0x2273('0x26'),_0x1352ef));}logger[_0x2273('0x11')](_0x2273('0x27'),_0x1090e5);logger[_0x2273('0x28')](_0x2273('0x1f'),_0x218196);return Promise[_0x2273('0x29')]()[_0x2273('0xf')](function(){if(Array[_0x2273('0x21')](_0x7f494c)){return checkArrayOfIntervals(_0x7f494c,_0x1352ef);}else if(_0x7f494c){return checkSingleInterval(_0x7f494c,_0x1352ef);}})[_0x2273('0xf')](function(_0x1ea603){var _0x11f144=_0x22aa17[_0x2273('0x2a')](function(_0x2beca2,_0x2366db){return _0x2beca2||iftime(_0x2366db,_0x1352ef);},![]);_0x1090e5=_0x1ea603||_0x11f144;return _0x1090e5;})[_0x2273('0x17')](function(_0x4b29fb){logger['error']('IntervalIftime',_0x218196,_0x4b29fb);throw this[_0x2273('0x14')](0x1f4,_0x4b29fb[_0x2273('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 7a17b13..428c213 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x57a6f6,_0x263cc3){var _0x48dfb4=function(_0x3c9c09){while(--_0x3c9c09){_0x57a6f6['push'](_0x57a6f6['shift']());}};_0x48dfb4(++_0x263cc3);}(_0xadb5,0xad));var _0x5adb=function(_0x28c20f,_0x27ee55){_0x28c20f=_0x28c20f-0x0;var _0x2cbd15=_0xadb5[_0x28c20f];return _0x2cbd15;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x250c28,_0x1e9884){var _0x1a29be=function(_0x53500f){while(--_0x53500f){_0x250c28['push'](_0x250c28['shift']());}};_0x1a29be(++_0x1e9884);}(_0x2ef3,0xba));var _0x32ef=function(_0x1accc4,_0x3ac180){_0x1accc4=_0x1accc4-0x0;var _0x47ce7c=_0x2ef3[_0x1accc4];return _0x47ce7c;};'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 522603a..10ab940 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 _0xc049=['newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','end','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502'];(function(_0x46d2bc,_0x2a5d06){var _0x4b4e17=function(_0x5566f2){while(--_0x5566f2){_0x46d2bc['push'](_0x46d2bc['shift']());}};_0x4b4e17(++_0x2a5d06);}(_0xc049,0x1ba));var _0x9c04=function(_0x4d7d84,_0xeed454){_0x4d7d84=_0x4d7d84-0x0;var _0x444625=_0xc049[_0x4d7d84];return _0x444625;};'use strict';var BPromise=require(_0x9c04('0x0'));var https=require(_0x9c04('0x1'));var logger=require(_0x9c04('0x2'))(_0x9c04('0x3'));var USERNAME=_0x9c04('0x4');var PASSWORD=_0x9c04('0x5');function openIssue(_0x1a0d9f,_0x505dd6){var _0x282b0f={'fields':{'project':{'key':_0x1a0d9f[_0x9c04('0x6')]||_0x9c04('0x7')},'summary':(_0x1a0d9f[_0x9c04('0x8')]||_0x9c04('0x9'))+'\x20from\x20'+_0x1a0d9f['ip'],'description':_0x1a0d9f[_0x9c04('0xa')]||JSON[_0x9c04('0xb')](_0x1a0d9f),'issuetype':{'name':_0x1a0d9f['issuetype']||_0x9c04('0xc')}}};_0x282b0f[_0x9c04('0xd')][_0x9c04('0xe')]=_0x1a0d9f[_0x9c04('0xf')];_0x282b0f[_0x9c04('0xd')][_0x9c04('0x10')]=_0x1a0d9f['oldToken'];_0x282b0f[_0x9c04('0xd')][_0x9c04('0x11')]=_0x1a0d9f[_0x9c04('0x12')];_0x282b0f['fields'][_0x9c04('0x13')]=_0x1a0d9f[_0x9c04('0x14')];_0x282b0f[_0x9c04('0xd')]['customfield_11504']=_0x1a0d9f[_0x9c04('0x15')];_0x282b0f['fields'][_0x9c04('0x16')]=_0x1a0d9f['ip'];var _0x513880={'host':_0x9c04('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9c04('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x9c04('0x19'),'Authorization':_0x9c04('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x9c04('0x1b')]('base64')}};var _0x302679=JSON[_0x9c04('0xb')](_0x282b0f);var _0x779af3=https[_0x9c04('0x1c')](_0x513880,function(_0x4a19e1){_0x4a19e1[_0x9c04('0x1d')]('utf8');var _0x434a4d='';_0x4a19e1['on'](_0x9c04('0x1e'),function(_0x304f03){_0x434a4d+=_0x304f03;});_0x4a19e1['on']('end',function(){if(_0x505dd6){return _0x505dd6[_0x9c04('0x1f')](_0x4a19e1[_0x9c04('0x20')])[_0x9c04('0x21')](JSON[_0x9c04('0x22')](_0x434a4d));}});});_0x779af3['on'](_0x9c04('0x23'),function(_0x16bcca){if(_0x505dd6){return _0x505dd6['status'](0x1f4)[_0x9c04('0x21')]({'errors':[{'message':_0x9c04('0x24'),'type':_0x9c04('0x25')}]});}});_0x779af3['write'](_0x302679);_0x779af3[_0x9c04('0x26')]();}exports[_0x9c04('0x27')]=openIssue;exports[_0x9c04('0x28')]=function(_0x2fbb84,_0x361658){_0x2fbb84[_0x9c04('0x29')]['ip']=_0x2fbb84['headers'][_0x9c04('0x2a')]||_0x2fbb84[_0x9c04('0x2b')][_0x9c04('0x2c')]||_0x2fbb84[_0x9c04('0x2d')][_0x9c04('0x2c')]||_0x2fbb84['connection'][_0x9c04('0x2d')][_0x9c04('0x2c')];return openIssue(_0x2fbb84[_0x9c04('0x29')],_0x361658);}; \ No newline at end of file +var _0x99f6=['application/json','Basic\x20','toString','base64','request','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','headers','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','Report','\x20from\x20','description','stringify','issuetype','Bug','email','fields','customfield_11501','oldToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x28533c,_0x22673d){var _0x193454=function(_0x1bf202){while(--_0x1bf202){_0x28533c['push'](_0x28533c['shift']());}};_0x193454(++_0x22673d);}(_0x99f6,0x116));var _0x699f=function(_0x56ac85,_0x3b9f06){_0x56ac85=_0x56ac85-0x0;var _0x232bf5=_0x99f6[_0x56ac85];return _0x232bf5;};'use strict';var BPromise=require(_0x699f('0x0'));var https=require(_0x699f('0x1'));var logger=require(_0x699f('0x2'))(_0x699f('0x3'));var USERNAME=_0x699f('0x4');var PASSWORD=_0x699f('0x5');function openIssue(_0x10f49e,_0x477590){var _0x2d77c1={'fields':{'project':{'key':_0x10f49e[_0x699f('0x6')]||'MOTGUI'},'summary':(_0x10f49e['summary']||_0x699f('0x7'))+_0x699f('0x8')+_0x10f49e['ip'],'description':_0x10f49e[_0x699f('0x9')]||JSON[_0x699f('0xa')](_0x10f49e),'issuetype':{'name':_0x10f49e[_0x699f('0xb')]||_0x699f('0xc')}}};_0x2d77c1['fields']['customfield_11500']=_0x10f49e[_0x699f('0xd')];_0x2d77c1[_0x699f('0xe')][_0x699f('0xf')]=_0x10f49e[_0x699f('0x10')];_0x2d77c1[_0x699f('0xe')]['customfield_11502']=_0x10f49e['newToken'];_0x2d77c1[_0x699f('0xe')][_0x699f('0x11')]=_0x10f49e['name'];_0x2d77c1[_0x699f('0xe')][_0x699f('0x12')]=_0x10f49e[_0x699f('0x13')];_0x2d77c1[_0x699f('0xe')][_0x699f('0x14')]=_0x10f49e['ip'];var _0x4f2580={'host':_0x699f('0x15'),'port':0x1bb,'path':_0x699f('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x699f('0x17'),'Authorization':_0x699f('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x699f('0x19')](_0x699f('0x1a'))}};var _0x12e66d=JSON[_0x699f('0xa')](_0x2d77c1);var _0x583a58=https[_0x699f('0x1b')](_0x4f2580,function(_0x57ab16){_0x57ab16['setEncoding']('utf8');var _0x168871='';_0x57ab16['on'](_0x699f('0x1c'),function(_0x21504e){_0x168871+=_0x21504e;});_0x57ab16['on'](_0x699f('0x1d'),function(){if(_0x477590){return _0x477590[_0x699f('0x1e')](_0x57ab16[_0x699f('0x1f')])[_0x699f('0x20')](JSON['parse'](_0x168871));}});});_0x583a58['on'](_0x699f('0x21'),function(_0x50f502){if(_0x477590){return _0x477590[_0x699f('0x1e')](0x1f4)[_0x699f('0x20')]({'errors':[{'message':_0x699f('0x22'),'type':_0x699f('0x23')}]});}});_0x583a58['write'](_0x12e66d);_0x583a58[_0x699f('0x1d')]();}exports[_0x699f('0x24')]=openIssue;exports[_0x699f('0x25')]=function(_0x32d4bf,_0x23a12b){_0x32d4bf['body']['ip']=_0x32d4bf[_0x699f('0x26')]['x-forwarded-for']||_0x32d4bf[_0x699f('0x27')]['remoteAddress']||_0x32d4bf['socket'][_0x699f('0x28')]||_0x32d4bf['connection'][_0x699f('0x29')][_0x699f('0x28')];return openIssue(_0x32d4bf[_0x699f('0x2a')],_0x23a12b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 9286ea4..7fd5a28 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 _0xf109=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','exports','multer','util','path'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0xf109,0xce));var _0x9f10=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xf109[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f10('0x3'));var auth=require(_0x9f10('0x4'));var interaction=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var controller=require(_0x9f10('0x7'));router[_0x9f10('0x8')]('/',auth[_0x9f10('0x9')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x8')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),controller['describe']);router[_0x9f10('0x8')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xd')]);router[_0x9f10('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f10('0xf')]);router[_0x9f10('0x10')](_0x9f10('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9f10('0x11')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller['destroy']);module[_0x9f10('0x12')]=router; \ No newline at end of file +var _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f1068,_0x2d4f61){var _0x54c89c=function(_0x19e3aa){while(--_0x19e3aa){_0x3f1068['push'](_0x3f1068['shift']());}};_0x54c89c(++_0x2d4f61);}(_0x1339,0x1ed));var _0x9133=function(_0x9e80,_0x1104bf){_0x9e80=_0x9e80-0x0;var _0x38e562=_0x1339[_0x9e80];return _0x38e562;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5366efe..cc0d5c3 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x4cd1c2,_0x3c638e){_0x4cd1c2=_0x4cd1c2-0x0;var _0x8fbe29=_0x7a54[_0x4cd1c2];return _0x8fbe29;};'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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0x4cf53c,_0x149649){_0x4cf53c=_0x4cf53c-0x0;var _0x176261=_0x7a54[_0x4cf53c];return _0x176261;};'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 133cdf8..084be92 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 _0x950a=['end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x950a,0x111));var _0xa950=function(_0x30a191,_0x38b23b){_0x30a191=_0x30a191-0x0;var _0xf6f720=_0x950a[_0x30a191];return _0xf6f720;};'use strict';var emlformat=require(_0xa950('0x0'));var rimraf=require(_0xa950('0x1'));var zipdir=require(_0xa950('0x2'));var jsonpatch=require(_0xa950('0x3'));var rp=require('request-promise');var moment=require(_0xa950('0x4'));var BPromise=require(_0xa950('0x5'));var Mustache=require(_0xa950('0x6'));var util=require(_0xa950('0x7'));var path=require('path');var sox=require(_0xa950('0x8'));var csv=require(_0xa950('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa950('0xa'));var _=require(_0xa950('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa950('0xc'));var deskjs=require(_0xa950('0xd'));var toCsv=require(_0xa950('0x9'));var querystring=require(_0xa950('0xe'));var Papa=require(_0xa950('0xf'));var Redis=require(_0xa950('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa950('0x11'));var logger=require('../../config/logger')(_0xa950('0x12'));var utils=require(_0xa950('0x13'));var config=require(_0xa950('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa950('0x15'))['db'];function respondWithStatusCode(_0x4f9c04,_0x10e64a){_0x10e64a=_0x10e64a||0xcc;return function(_0x439097){if(_0x439097){return _0x4f9c04[_0xa950('0x16')](_0x10e64a);}return _0x4f9c04['status'](_0x10e64a)[_0xa950('0x17')]();};}function respondWithResult(_0x2aed6a,_0x1c7adb){_0x1c7adb=_0x1c7adb||0xc8;return function(_0x4ba74f){if(_0x4ba74f){return _0x2aed6a[_0xa950('0x18')](_0x1c7adb)[_0xa950('0x19')](_0x4ba74f);}};}function respondWithFilteredResult(_0x425201,_0x5d5f4c){return function(_0x31b25b){if(_0x31b25b){var _0x46fca7=typeof _0x5d5f4c[_0xa950('0x1a')]==='undefined'&&typeof _0x5d5f4c[_0xa950('0x1b')]===_0xa950('0x1c');var _0x162586=_0x31b25b[_0xa950('0x1d')];var _0x16aabc=_0x46fca7?0x0:_0x5d5f4c[_0xa950('0x1a')];var _0x2b0e44=_0x46fca7?_0x31b25b[_0xa950('0x1d')]:_0x5d5f4c[_0xa950('0x1a')]+_0x5d5f4c[_0xa950('0x1b')];var _0x28fedf;if(_0x2b0e44>=_0x162586){_0x2b0e44=_0x162586;_0x28fedf=0xc8;}else{_0x28fedf=0xce;}_0x425201[_0xa950('0x18')](_0x28fedf);return _0x425201[_0xa950('0x1e')]('Content-Range',_0x16aabc+'-'+_0x2b0e44+'/'+_0x162586)[_0xa950('0x19')](_0x31b25b);}return null;};}function patchUpdates(_0x1a10fe){return function(_0x50abe1){try{jsonpatch[_0xa950('0x1f')](_0x50abe1,_0x1a10fe,!![]);}catch(_0x41c405){return BPromise['reject'](_0x41c405);}return _0x50abe1[_0xa950('0x20')]();};}function saveUpdates(_0x5ad191,_0x2eda79){return function(_0x14ada5){if(_0x14ada5){return _0x14ada5[_0xa950('0x21')](_0x5ad191)[_0xa950('0x22')](function(_0x5617cd){return _0x5617cd;});}return null;};}function removeEntity(_0x11b8af,_0x3f4633){return function(_0x31c135){if(_0x31c135){return _0x31c135[_0xa950('0x23')]()[_0xa950('0x22')](function(){_0x11b8af[_0xa950('0x18')](0xcc)[_0xa950('0x17')]();});}};}function handleEntityNotFound(_0x23cb20,_0x12dcb8){return function(_0xc4894b){if(!_0xc4894b){_0x23cb20[_0xa950('0x16')](0x194);}return _0xc4894b;};}function handleError(_0x26f366,_0x43f8c8){_0x43f8c8=_0x43f8c8||0x1f4;return function(_0x5d82d8){logger[_0xa950('0x24')](_0x5d82d8[_0xa950('0x25')]);if(_0x5d82d8[_0xa950('0x26')]){delete _0x5d82d8[_0xa950('0x26')];}_0x26f366[_0xa950('0x18')](_0x43f8c8)[_0xa950('0x27')](_0x5d82d8);};}exports[_0xa950('0x28')]=function(_0x52e133,_0x19ad7a){var _0x442a94={},_0x5e4c94={},_0x44ee6e={'count':0x0,'rows':[]};var _0x2e7674=_[_0xa950('0x29')](db[_0xa950('0x2a')][_0xa950('0x2b')],function(_0x1945ca){return{'name':_0x1945ca[_0xa950('0x2c')],'type':_0x1945ca[_0xa950('0x2d')][_0xa950('0x2e')]};});_0x5e4c94[_0xa950('0x2f')]=_['map'](_0x2e7674,_0xa950('0x26'));_0x5e4c94['query']=_['keys'](_0x52e133[_0xa950('0x30')]);_0x5e4c94['filters']=_[_0xa950('0x31')](_0x5e4c94[_0xa950('0x2f')],_0x5e4c94[_0xa950('0x30')]);_0x442a94[_0xa950('0x32')]=_['intersection'](_0x5e4c94[_0xa950('0x2f')],qs['fields'](_0x52e133[_0xa950('0x30')][_0xa950('0x33')]));_0x442a94['attributes']=_0x442a94['attributes'][_0xa950('0x34')]?_0x442a94[_0xa950('0x32')]:_0x5e4c94[_0xa950('0x2f')];if(!_0x52e133[_0xa950('0x30')][_0xa950('0x35')](_0xa950('0x36'))){_0x442a94['limit']=qs['limit'](_0x52e133[_0xa950('0x30')]['limit']);_0x442a94[_0xa950('0x1a')]=qs[_0xa950('0x1a')](_0x52e133[_0xa950('0x30')][_0xa950('0x1a')]);}_0x442a94[_0xa950('0x37')]=qs[_0xa950('0x38')](_0x52e133[_0xa950('0x30')][_0xa950('0x38')]);_0x442a94[_0xa950('0x39')]=qs[_0xa950('0x3a')](_['pick'](_0x52e133[_0xa950('0x30')],_0x5e4c94['filters']),_0x2e7674);if(_0x52e133[_0xa950('0x30')][_0xa950('0x3b')]){_0x442a94['where']=_['merge'](_0x442a94[_0xa950('0x39')],{'$or':_[_0xa950('0x29')](_0x2e7674,function(_0x57e9cb){if(_0x57e9cb[_0xa950('0x2d')]!==_0xa950('0x3c')){var _0x4bf63b={};_0x4bf63b[_0x57e9cb[_0xa950('0x26')]]={'$like':'%'+_0x52e133[_0xa950('0x30')][_0xa950('0x3b')]+'%'};return _0x4bf63b;}})});}_0x442a94=_[_0xa950('0x3d')]({},_0x442a94,_0x52e133[_0xa950('0x3e')]);var _0x35cfcc={'where':_0x442a94[_0xa950('0x39')]};return db[_0xa950('0x2a')]['count'](_0x35cfcc)[_0xa950('0x22')](function(_0x1764b2){_0x44ee6e['count']=_0x1764b2;if(_0x52e133[_0xa950('0x30')][_0xa950('0x3f')]){_0x442a94[_0xa950('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa950('0x41')](_0x442a94);})[_0xa950('0x22')](function(_0x8bdd37){_0x44ee6e['rows']=_0x8bdd37;return _0x44ee6e;})['then'](respondWithFilteredResult(_0x19ad7a,_0x442a94))[_0xa950('0x42')](handleError(_0x19ad7a,null));};exports[_0xa950('0x43')]=function(_0x1f2572,_0x54dc62){var _0x49a235={'raw':!![],'where':{'id':_0x1f2572[_0xa950('0x44')]['id']}},_0x51f5a5={};_0x51f5a5[_0xa950('0x2f')]=_[_0xa950('0x45')](db[_0xa950('0x2a')][_0xa950('0x2b')]);_0x51f5a5['query']=_[_0xa950('0x45')](_0x1f2572[_0xa950('0x30')]);_0x51f5a5['filters']=_['intersection'](_0x51f5a5[_0xa950('0x2f')],_0x51f5a5[_0xa950('0x30')]);_0x49a235['attributes']=_['intersection'](_0x51f5a5['model'],qs['fields'](_0x1f2572[_0xa950('0x30')][_0xa950('0x33')]));_0x49a235['attributes']=_0x49a235['attributes'][_0xa950('0x34')]?_0x49a235['attributes']:_0x51f5a5[_0xa950('0x2f')];if(_0x1f2572[_0xa950('0x30')][_0xa950('0x3f')]){_0x49a235[_0xa950('0x40')]=[{'all':!![]}];}_0x49a235=_[_0xa950('0x3d')]({},_0x49a235,_0x1f2572[_0xa950('0x3e')]);return db[_0xa950('0x2a')][_0xa950('0x46')](_0x49a235)['then'](handleEntityNotFound(_0x54dc62,null))[_0xa950('0x22')](respondWithResult(_0x54dc62,null))['catch'](handleError(_0x54dc62,null));};exports[_0xa950('0x47')]=function(_0x42813e,_0x22675d){return db[_0xa950('0x2a')][_0xa950('0x47')](_0x42813e[_0xa950('0x48')],{})[_0xa950('0x22')](respondWithResult(_0x22675d,0xc9))[_0xa950('0x42')](handleError(_0x22675d,null));};exports[_0xa950('0x21')]=function(_0x4f777a,_0x3cf01c){if(_0x4f777a[_0xa950('0x48')]['id']){delete _0x4f777a[_0xa950('0x48')]['id'];}return db[_0xa950('0x2a')][_0xa950('0x46')]({'where':{'id':_0x4f777a['params']['id']}})[_0xa950('0x22')](handleEntityNotFound(_0x3cf01c,null))[_0xa950('0x22')](saveUpdates(_0x4f777a[_0xa950('0x48')],null))[_0xa950('0x22')](respondWithResult(_0x3cf01c,null))[_0xa950('0x42')](handleError(_0x3cf01c,null));};exports[_0xa950('0x23')]=function(_0x2752e7,_0x5dd6ce){return db[_0xa950('0x2a')][_0xa950('0x46')]({'where':{'id':_0x2752e7[_0xa950('0x44')]['id']}})['then'](handleEntityNotFound(_0x5dd6ce,null))['then'](removeEntity(_0x5dd6ce,null))[_0xa950('0x42')](handleError(_0x5dd6ce,null));};exports[_0xa950('0x49')]=function(_0x38c370,_0x16572e){return db[_0xa950('0x2a')][_0xa950('0x49')]()[_0xa950('0x22')](respondWithResult(_0x16572e,null))[_0xa950('0x42')](handleError(_0x16572e,null));}; \ No newline at end of file +var _0x038b=['lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','length','include','options','create','body','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x038b,0x114));var _0xb038=function(_0x3157b9,_0x57bc6e){_0x3157b9=_0x3157b9-0x0;var _0x400405=_0x038b[_0x3157b9];return _0x400405;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24'));_0xc387d[_0xb038('0x2d')]=_[_0xb038('0x2e')](_0x2855a6['query']);_0xc387d[_0xb038('0x2f')]=_['intersection'](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x2d')]);_0x12b3b6[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x32')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x32')]));_0x12b3b6[_0xb038('0x30')]=_0x12b3b6[_0xb038('0x30')]['length']?_0x12b3b6[_0xb038('0x30')]:_0xc387d[_0xb038('0x2c')];if(!_0x2855a6[_0xb038('0x2d')]['hasOwnProperty']('nolimit')){_0x12b3b6['limit']=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs[_0xb038('0x18')](_0x2855a6[_0xb038('0x2d')]['offset']);}_0x12b3b6[_0xb038('0x33')]=qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x34')]);_0x12b3b6['where']=qs[_0xb038('0x2f')](_[_0xb038('0x35')](_0x2855a6['query'],_0xc387d['filters']),_0x1783d4);if(_0x2855a6[_0xb038('0x2d')][_0xb038('0x36')]){_0x12b3b6[_0xb038('0x37')]=_[_0xb038('0x38')](_0x12b3b6[_0xb038('0x37')],{'$or':_['map'](_0x1783d4,function(_0x404f82){if(_0x404f82[_0xb038('0x2a')]!==_0xb038('0x39')){var _0x2d1e57={};_0x2d1e57[_0x404f82['name']]={'$like':'%'+_0x2855a6[_0xb038('0x2d')][_0xb038('0x36')]+'%'};return _0x2d1e57;}})});}_0x12b3b6=_[_0xb038('0x38')]({},_0x12b3b6,_0x2855a6['options']);var _0x412d71={'where':_0x12b3b6['where']};return db[_0xb038('0x27')][_0xb038('0x1a')](_0x412d71)[_0xb038('0x22')](function(_0x5ce40c){_0x551b55[_0xb038('0x1a')]=_0x5ce40c;if(_0x2855a6[_0xb038('0x2d')][_0xb038('0x3a')]){_0x12b3b6['include']=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3b')](_0x12b3b6);})[_0xb038('0x22')](function(_0x3c291e){_0x551b55['rows']=_0x3c291e;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x3c')](handleError(_0x28a6a9,null));};exports[_0xb038('0x3d')]=function(_0x2a0436,_0x52e1d6){var _0x19dc7b={'raw':!![],'where':{'id':_0x2a0436['params']['id']}},_0x269c7d={};_0x269c7d[_0xb038('0x2c')]=_[_0xb038('0x2e')](db[_0xb038('0x27')]['rawAttributes']);_0x269c7d[_0xb038('0x2d')]=_[_0xb038('0x2e')](_0x2a0436['query']);_0x269c7d['filters']=_[_0xb038('0x31')](_0x269c7d[_0xb038('0x2c')],_0x269c7d[_0xb038('0x2d')]);_0x19dc7b[_0xb038('0x30')]=_[_0xb038('0x31')](_0x269c7d[_0xb038('0x2c')],qs[_0xb038('0x32')](_0x2a0436[_0xb038('0x2d')]['fields']));_0x19dc7b['attributes']=_0x19dc7b['attributes'][_0xb038('0x3e')]?_0x19dc7b[_0xb038('0x30')]:_0x269c7d['model'];if(_0x2a0436[_0xb038('0x2d')][_0xb038('0x3a')]){_0x19dc7b[_0xb038('0x3f')]=[{'all':!![]}];}_0x19dc7b=_['merge']({},_0x19dc7b,_0x2a0436[_0xb038('0x40')]);return db['JscriptyAnswerReport']['find'](_0x19dc7b)[_0xb038('0x22')](handleEntityNotFound(_0x52e1d6,null))[_0xb038('0x22')](respondWithResult(_0x52e1d6,null))[_0xb038('0x3c')](handleError(_0x52e1d6,null));};exports[_0xb038('0x41')]=function(_0x304515,_0x3b09e3){return db[_0xb038('0x27')][_0xb038('0x41')](_0x304515[_0xb038('0x42')],{})[_0xb038('0x22')](respondWithResult(_0x3b09e3,0xc9))['catch'](handleError(_0x3b09e3,null));};exports[_0xb038('0x21')]=function(_0x3ed968,_0x5c11d7){if(_0x3ed968[_0xb038('0x42')]['id']){delete _0x3ed968[_0xb038('0x42')]['id'];}return db['JscriptyAnswerReport'][_0xb038('0x43')]({'where':{'id':_0x3ed968[_0xb038('0x44')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x5c11d7,null))[_0xb038('0x22')](saveUpdates(_0x3ed968[_0xb038('0x42')],null))[_0xb038('0x22')](respondWithResult(_0x5c11d7,null))[_0xb038('0x3c')](handleError(_0x5c11d7,null));};exports[_0xb038('0x45')]=function(_0x3a291d,_0x54a826){return db[_0xb038('0x27')][_0xb038('0x43')]({'where':{'id':_0x3a291d[_0xb038('0x44')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x54a826,null))[_0xb038('0x22')](removeEntity(_0x54a826,null))[_0xb038('0x3c')](handleError(_0x54a826,null));};exports['describe']=function(_0x1f4997,_0x2f3622){return db[_0xb038('0x27')][_0xb038('0x46')]()[_0xb038('0x22')](respondWithResult(_0x2f3622,null))[_0xb038('0x3c')](handleError(_0x2f3622,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 61804fd..79ab2d0 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 _0x87bf=['moment','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87bf,0x1a5));var _0xf87b=function(_0x4b043b,_0x598b17){_0x4b043b=_0x4b043b-0x0;var _0x398f5a=_0x87bf[_0x4b043b];return _0x398f5a;};'use strict';var _=require(_0xf87b('0x0'));var util=require(_0xf87b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf87b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf87b('0x3'));var rimraf=require(_0xf87b('0x4'));var config=require(_0xf87b('0x5'));var attributes=require(_0xf87b('0x6'));module[_0xf87b('0x7')]=function(_0x2ce6d7,_0x330296){return _0x2ce6d7['define'](_0xf87b('0x8'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbf3=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x37a4cc,_0x1531a8){var _0x4ffbbf=function(_0x5d7be5){while(--_0x5d7be5){_0x37a4cc['push'](_0x37a4cc['shift']());}};_0x4ffbbf(++_0x1531a8);}(_0xcbf3,0x18f));var _0x3cbf=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xcbf3[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x3cbf('0x0'));var util=require(_0x3cbf('0x1'));var logger=require('../../config/logger')(_0x3cbf('0x2'));var moment=require(_0x3cbf('0x3'));var BPromise=require(_0x3cbf('0x4'));var rp=require(_0x3cbf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cbf('0x6'));var attributes=require(_0x3cbf('0x7'));module['exports']=function(_0x23e8a7,_0x467ec6){return _0x23e8a7[_0x3cbf('0x8')](_0x3cbf('0x9'),attributes,{'tableName':_0x3cbf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index f1498a8..27834ca 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 _0x6515=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x58c86a,_0x602654){var _0x2bb374=function(_0x1302a9){while(--_0x1302a9){_0x58c86a['push'](_0x58c86a['shift']());}};_0x2bb374(++_0x602654);}(_0x6515,0x1e5));var _0x5651=function(_0x5212a5,_0x2ac58e){_0x5212a5=_0x5212a5-0x0;var _0x8fc8b=_0x6515[_0x5212a5];return _0x8fc8b;};'use strict';var _=require(_0x5651('0x0'));var util=require(_0x5651('0x1'));var moment=require(_0x5651('0x2'));var BPromise=require('bluebird');var rs=require(_0x5651('0x3'));var fs=require('fs');var Redis=require(_0x5651('0x4'));var db=require(_0x5651('0x5'))['db'];var utils=require(_0x5651('0x6'));var logger=require(_0x5651('0x7'))(_0x5651('0x8'));var config=require(_0x5651('0x9'));var jayson=require(_0x5651('0xa'));var client=jayson[_0x5651('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x358782,_0x89e216,_0x1482d9){return new BPromise(function(_0x3645d3,_0x1dc334){return client[_0x5651('0xc')](_0x358782,_0x1482d9)[_0x5651('0xd')](function(_0x384f42){logger[_0x5651('0xe')](_0x5651('0xf'),_0x89e216,_0x5651('0x10'));logger[_0x5651('0x11')](_0x5651('0x12'),_0x89e216,_0x5651('0x10'),JSON['stringify'](_0x384f42));if(_0x384f42['error']){if(_0x384f42[_0x5651('0x13')][_0x5651('0x14')]===0x1f4){logger[_0x5651('0x13')](_0x5651('0xf'),_0x89e216,_0x384f42['error']['message']);return _0x1dc334(_0x384f42[_0x5651('0x13')][_0x5651('0x15')]);}logger[_0x5651('0x13')](_0x5651('0xf'),_0x89e216,_0x384f42[_0x5651('0x13')][_0x5651('0x15')]);return _0x3645d3(_0x384f42[_0x5651('0x13')]['message']);}else{logger[_0x5651('0xe')](_0x5651('0xf'),_0x89e216,_0x5651('0x10'));_0x3645d3(_0x384f42[_0x5651('0x16')][_0x5651('0x15')]);}})[_0x5651('0x17')](function(_0x5dc0c3){logger[_0x5651('0x13')](_0x5651('0xf'),_0x89e216,_0x5dc0c3);_0x1dc334(_0x5dc0c3);});});} \ No newline at end of file +var _0x9bc4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9bc4,0x125));var _0x49bc=function(_0x2a6ca8,_0x34daee){_0x2a6ca8=_0x2a6ca8-0x0;var _0x76da82=_0x9bc4[_0x2a6ca8];return _0x76da82;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x49bc('0x0'));var rs=require(_0x49bc('0x1'));var fs=require('fs');var Redis=require(_0x49bc('0x2'));var db=require(_0x49bc('0x3'))['db'];var utils=require(_0x49bc('0x4'));var logger=require(_0x49bc('0x5'))(_0x49bc('0x6'));var config=require(_0x49bc('0x7'));var jayson=require(_0x49bc('0x8'));var client=jayson['client'][_0x49bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x475528,_0x4cdff8,_0x4912b3){return new BPromise(function(_0x31dac8,_0x152431){return client[_0x49bc('0xa')](_0x475528,_0x4912b3)[_0x49bc('0xb')](function(_0x3bd372){logger[_0x49bc('0xc')](_0x49bc('0xd'),_0x4cdff8,_0x49bc('0xe'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4cdff8,'request\x20sent',JSON[_0x49bc('0xf')](_0x3bd372));if(_0x3bd372['error']){if(_0x3bd372[_0x49bc('0x10')][_0x49bc('0x11')]===0x1f4){logger[_0x49bc('0x10')](_0x49bc('0xd'),_0x4cdff8,_0x3bd372[_0x49bc('0x10')][_0x49bc('0x12')]);return _0x152431(_0x3bd372[_0x49bc('0x10')]['message']);}logger['error'](_0x49bc('0xd'),_0x4cdff8,_0x3bd372[_0x49bc('0x10')][_0x49bc('0x12')]);return _0x31dac8(_0x3bd372['error'][_0x49bc('0x12')]);}else{logger['info'](_0x49bc('0xd'),_0x4cdff8,_0x49bc('0xe'));_0x31dac8(_0x3bd372[_0x49bc('0x13')]['message']);}})[_0x49bc('0x14')](function(_0x54ef49){logger[_0x49bc('0x10')](_0x49bc('0xd'),_0x4cdff8,_0x54ef49);_0x152431(_0x54ef49);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ad5d801..89d2adf 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 _0xf99c=['/:id/answers','/:id/summary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get','index','show','/:id/sessions','isAuthenticated','getSessions'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xf99c,0x17b));var _0xcf99=function(_0x4b0c3d,_0x5672f5){_0x4b0c3d=_0x4b0c3d-0x0;var _0x279b58=_0xf99c[_0x4b0c3d];return _0x279b58;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcf99('0x0'));var express=require(_0xcf99('0x1'));var router=express[_0xcf99('0x2')]();var fs_extra=require(_0xcf99('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcf99('0x4'));var controller=require(_0xcf99('0x5'));router[_0xcf99('0x6')]('/',auth['isAuthenticated'](),controller[_0xcf99('0x7')]);router[_0xcf99('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xcf99('0x8')]);router[_0xcf99('0x6')](_0xcf99('0x9'),auth[_0xcf99('0xa')](),controller[_0xcf99('0xb')]);router[_0xcf99('0x6')](_0xcf99('0xc'),auth[_0xcf99('0xa')](),controller['getAnswers']);router[_0xcf99('0x6')](_0xcf99('0xd'),auth[_0xcf99('0xa')](),timeout('30s'),controller['getSummary']);router[_0xcf99('0xe')]('/',auth[_0xcf99('0xa')](),controller[_0xcf99('0xf')]);router[_0xcf99('0xe')](_0xcf99('0x10'),auth[_0xcf99('0xa')](),controller[_0xcf99('0x11')]);router[_0xcf99('0x12')]('/:id',auth[_0xcf99('0xa')](),controller[_0xcf99('0x13')]);router[_0xcf99('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xcf99('0x15')]);module[_0xcf99('0x16')]=router; \ No newline at end of file +var _0xb521=['create','clone','put','/:id','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','show','/:id/answers','getAnswers','30s','post'];(function(_0xc831c6,_0x542b00){var _0x5063a7=function(_0x4600ee){while(--_0x4600ee){_0xc831c6['push'](_0xc831c6['shift']());}};_0x5063a7(++_0x542b00);}(_0xb521,0x91));var _0x1b52=function(_0xe5819f,_0x23d35a){_0xe5819f=_0xe5819f-0x0;var _0x4898bf=_0xb521[_0xe5819f];return _0x4898bf;};'use strict';var multer=require('multer');var util=require(_0x1b52('0x0'));var path=require('path');var timeout=require(_0x1b52('0x1'));var express=require(_0x1b52('0x2'));var router=express[_0x1b52('0x3')]();var fs_extra=require(_0x1b52('0x4'));var auth=require(_0x1b52('0x5'));var interaction=require(_0x1b52('0x6'));var config=require(_0x1b52('0x7'));var controller=require(_0x1b52('0x8'));router['get']('/',auth[_0x1b52('0x9')](),controller['index']);router[_0x1b52('0xa')]('/:id',auth[_0x1b52('0x9')](),controller[_0x1b52('0xb')]);router[_0x1b52('0xa')]('/:id/sessions',auth[_0x1b52('0x9')](),controller['getSessions']);router[_0x1b52('0xa')](_0x1b52('0xc'),auth[_0x1b52('0x9')](),controller[_0x1b52('0xd')]);router[_0x1b52('0xa')]('/:id/summary',auth[_0x1b52('0x9')](),timeout(_0x1b52('0xe')),controller['getSummary']);router[_0x1b52('0xf')]('/',auth[_0x1b52('0x9')](),controller[_0x1b52('0x10')]);router[_0x1b52('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0x1b52('0x11')]);router[_0x1b52('0x12')](_0x1b52('0x13'),auth[_0x1b52('0x9')](),controller[_0x1b52('0x14')]);router[_0x1b52('0x15')](_0x1b52('0x13'),auth[_0x1b52('0x9')](),controller[_0x1b52('0x16')]);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 2c58827..757bf52 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 _0xcee0=['stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','formData'];(function(_0x1ea691,_0x370196){var _0x5d479f=function(_0x5426f9){while(--_0x5426f9){_0x1ea691['push'](_0x1ea691['shift']());}};_0x5d479f(++_0x370196);}(_0xcee0,0x1a7));var _0x0cee=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xcee0[_0x40dd56];return _0x4f850f;};'use strict';var Sequelize=require(_0x0cee('0x0'));var _=require(_0x0cee('0x1'));var util=require(_0x0cee('0x2'));module[_0x0cee('0x3')]={'name':{'type':Sequelize[_0x0cee('0x4')],'unique':_0x0cee('0x5')},'description':{'type':Sequelize[_0x0cee('0x4')]},'formData':{'type':Sequelize[_0x0cee('0x6')](_0x0cee('0x7')),'set':function(_0x1ce8dd){if(_['isObjectLike'](_0x1ce8dd)){this['setDataValue'](_0x0cee('0x8'),JSON[_0x0cee('0x9')](_0x1ce8dd));}else if(_[_0x0cee('0xa')](_0x1ce8dd)){this['setDataValue']('formData',_0x1ce8dd);}else{this['setDataValue']('formData',util[_0x0cee('0xb')](_0x0cee('0xc'),this[_0x0cee('0xd')](_0x0cee('0x5'))||'',this['getDataValue'](_0x0cee('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0cee('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0cee('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x3e34=['STRING','name','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','exports'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x3e34,0x8d));var _0x43e3=function(_0x1499cf,_0x428afe){_0x1499cf=_0x1499cf-0x0;var _0x410333=_0x3e34[_0x1499cf];return _0x410333;};'use strict';var Sequelize=require(_0x43e3('0x0'));var _=require('lodash');var util=require(_0x43e3('0x1'));module[_0x43e3('0x2')]={'name':{'type':Sequelize[_0x43e3('0x3')],'unique':_0x43e3('0x4')},'description':{'type':Sequelize[_0x43e3('0x3')]},'formData':{'type':Sequelize[_0x43e3('0x5')](_0x43e3('0x6')),'set':function(_0x2c7778){if(_[_0x43e3('0x7')](_0x2c7778)){this['setDataValue'](_0x43e3('0x8'),JSON[_0x43e3('0x9')](_0x2c7778));}else if(_[_0x43e3('0xa')](_0x2c7778)){this[_0x43e3('0xb')](_0x43e3('0x8'),_0x2c7778);}else{this[_0x43e3('0xb')](_0x43e3('0x8'),util[_0x43e3('0xc')](_0x43e3('0xd'),this[_0x43e3('0xe')](_0x43e3('0x4'))||'',this[_0x43e3('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x43e3('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 f6f5bc9..a708519 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 _0x7275=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','UserProfileResource','destroy','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','create','UserProfileSection','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x35d21a,_0x82b92a){var _0x2eb565=function(_0x5bc084){while(--_0x5bc084){_0x35d21a['push'](_0x35d21a['shift']());}};_0x2eb565(++_0x82b92a);}(_0x7275,0x143));var _0x5727=function(_0x462d2f,_0x302f19){_0x462d2f=_0x462d2f-0x0;var _0x1cf62c=_0x7275[_0x462d2f];return _0x1cf62c;};'use strict';var emlformat=require(_0x5727('0x0'));var rimraf=require(_0x5727('0x1'));var zipdir=require(_0x5727('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5727('0x3'));var moment=require('moment');var BPromise=require(_0x5727('0x4'));var Mustache=require(_0x5727('0x5'));var util=require('util');var path=require(_0x5727('0x6'));var sox=require(_0x5727('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5727('0x8'));var squel=require('squel');var crypto=require(_0x5727('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5727('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5727('0xb'));var Papa=require(_0x5727('0xc'));var Redis=require('ioredis');var authService=require(_0x5727('0xd'));var qs=require(_0x5727('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5727('0xf'));var logger=require(_0x5727('0x10'))('api');var utils=require(_0x5727('0x11'));var config=require(_0x5727('0x12'));var licenseUtil=require(_0x5727('0x13'));var db=require(_0x5727('0x14'))['db'];function respondWithStatusCode(_0x362b0e,_0x45ec3c){_0x45ec3c=_0x45ec3c||0xcc;return function(_0x48c6f4){if(_0x48c6f4){return _0x362b0e[_0x5727('0x15')](_0x45ec3c);}return _0x362b0e[_0x5727('0x16')](_0x45ec3c)[_0x5727('0x17')]();};}function respondWithResult(_0x242b6a,_0x2a01df){_0x2a01df=_0x2a01df||0xc8;return function(_0x463721){if(_0x463721){return _0x242b6a[_0x5727('0x16')](_0x2a01df)['json'](_0x463721);}};}function respondWithFilteredResult(_0x24e514,_0x284633){return function(_0x1dcefc){if(_0x1dcefc){var _0x12b045=typeof _0x284633[_0x5727('0x18')]===_0x5727('0x19')&&typeof _0x284633[_0x5727('0x1a')]==='undefined';var _0x11d52c=_0x1dcefc['count'];var _0x360be0=_0x12b045?0x0:_0x284633[_0x5727('0x18')];var _0x55fc33=_0x12b045?_0x1dcefc[_0x5727('0x1b')]:_0x284633[_0x5727('0x18')]+_0x284633[_0x5727('0x1a')];var _0x35e30f;if(_0x55fc33>=_0x11d52c){_0x55fc33=_0x11d52c;_0x35e30f=0xc8;}else{_0x35e30f=0xce;}_0x24e514[_0x5727('0x16')](_0x35e30f);return _0x24e514['set']('Content-Range',_0x360be0+'-'+_0x55fc33+'/'+_0x11d52c)[_0x5727('0x1c')](_0x1dcefc);}return null;};}function patchUpdates(_0xb99c6e){return function(_0x84c9e2){try{jsonpatch[_0x5727('0x1d')](_0x84c9e2,_0xb99c6e,!![]);}catch(_0xf584e8){return BPromise[_0x5727('0x1e')](_0xf584e8);}return _0x84c9e2[_0x5727('0x1f')]();};}function saveUpdates(_0x5c63ef,_0x4aa3af){return function(_0x476a47){if(_0x476a47){return _0x476a47[_0x5727('0x20')](_0x5c63ef)['then'](function(_0x1cb06f){return _0x1cb06f;});}return null;};}function removeEntity(_0xb217a7,_0x3775b5){return function(_0x4a3e6b){if(_0x4a3e6b){return _0x4a3e6b['destroy']()[_0x5727('0x21')](function(){var _0x179e74=_0x4a3e6b['get']({'plain':!![]});var _0x41cd74='Projects';return db[_0x5727('0x22')][_0x5727('0x23')]({'where':{'type':_0x41cd74,'resourceId':_0x179e74['id']}})['then'](function(){return _0x4a3e6b;});})['then'](function(){_0xb217a7[_0x5727('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c5305,_0x3dd7d2){return function(_0x161f5){if(!_0x161f5){_0x4c5305[_0x5727('0x15')](0x194);}return _0x161f5;};}function handleError(_0xf82573,_0x3afd59){_0x3afd59=_0x3afd59||0x1f4;return function(_0x56e93d){logger['error'](_0x56e93d[_0x5727('0x24')]);if(_0x56e93d[_0x5727('0x25')]){delete _0x56e93d[_0x5727('0x25')];}_0xf82573[_0x5727('0x16')](_0x3afd59)['send'](_0x56e93d);};}exports[_0x5727('0x26')]=function(_0x4b8ce3,_0x1d81ab){var _0x4bdae7={},_0x19636b={},_0x5a6827={'count':0x0,'rows':[]};var _0xe3a786=_[_0x5727('0x27')](db[_0x5727('0x28')][_0x5727('0x29')],function(_0x58080b){return{'name':_0x58080b[_0x5727('0x2a')],'type':_0x58080b[_0x5727('0x2b')]['key']};});_0x19636b['model']=_[_0x5727('0x27')](_0xe3a786,_0x5727('0x25'));_0x19636b[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x4b8ce3[_0x5727('0x2c')]);_0x19636b['filters']=_[_0x5727('0x2e')](_0x19636b[_0x5727('0x2f')],_0x19636b[_0x5727('0x2c')]);_0x4bdae7[_0x5727('0x30')]=_[_0x5727('0x2e')](_0x19636b[_0x5727('0x2f')],qs[_0x5727('0x31')](_0x4b8ce3[_0x5727('0x2c')][_0x5727('0x31')]));_0x4bdae7[_0x5727('0x30')]=_0x4bdae7[_0x5727('0x30')][_0x5727('0x32')]?_0x4bdae7[_0x5727('0x30')]:_0x19636b[_0x5727('0x2f')];if(!_0x4b8ce3['query'][_0x5727('0x33')](_0x5727('0x34'))){_0x4bdae7[_0x5727('0x1a')]=qs[_0x5727('0x1a')](_0x4b8ce3[_0x5727('0x2c')]['limit']);_0x4bdae7[_0x5727('0x18')]=qs[_0x5727('0x18')](_0x4b8ce3[_0x5727('0x2c')]['offset']);}_0x4bdae7['order']=qs[_0x5727('0x35')](_0x4b8ce3['query']['sort']);_0x4bdae7['where']=qs['filters'](_[_0x5727('0x36')](_0x4b8ce3[_0x5727('0x2c')],_0x19636b[_0x5727('0x37')]),_0xe3a786);if(_0x4b8ce3['query'][_0x5727('0x38')]){_0x4bdae7[_0x5727('0x39')]=_[_0x5727('0x3a')](_0x4bdae7['where'],{'$or':_[_0x5727('0x27')](_0xe3a786,function(_0x1eeac5){if(_0x1eeac5[_0x5727('0x2b')]!=='VIRTUAL'){var _0xfa0b1e={};_0xfa0b1e[_0x1eeac5['name']]={'$like':'%'+_0x4b8ce3[_0x5727('0x2c')][_0x5727('0x38')]+'%'};return _0xfa0b1e;}})});}_0x4bdae7=_['merge']({},_0x4bdae7,_0x4b8ce3[_0x5727('0x3b')]);var _0xa8269b={'where':_0x4bdae7[_0x5727('0x39')]};return db[_0x5727('0x28')][_0x5727('0x1b')](_0xa8269b)[_0x5727('0x21')](function(_0x1e580f){_0x5a6827['count']=_0x1e580f;if(_0x4b8ce3[_0x5727('0x2c')][_0x5727('0x3c')]){_0x4bdae7[_0x5727('0x3d')]=[{'all':!![]}];}return db['JscriptyProject'][_0x5727('0x3e')](_0x4bdae7);})[_0x5727('0x21')](function(_0x47074e){_0x5a6827[_0x5727('0x3f')]=_0x47074e;return _0x5a6827;})[_0x5727('0x21')](respondWithFilteredResult(_0x1d81ab,_0x4bdae7))[_0x5727('0x40')](handleError(_0x1d81ab,null));};exports[_0x5727('0x41')]=function(_0x4da232,_0x91b888){var _0x245189={'raw':![],'where':{'id':_0x4da232[_0x5727('0x42')]['id']}},_0x7620cd={};_0x7620cd[_0x5727('0x2f')]=_[_0x5727('0x2d')](db[_0x5727('0x28')][_0x5727('0x29')]);_0x7620cd[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x4da232[_0x5727('0x2c')]);_0x7620cd[_0x5727('0x37')]=_[_0x5727('0x2e')](_0x7620cd[_0x5727('0x2f')],_0x7620cd[_0x5727('0x2c')]);_0x245189[_0x5727('0x30')]=_[_0x5727('0x2e')](_0x7620cd[_0x5727('0x2f')],qs['fields'](_0x4da232['query'][_0x5727('0x31')]));_0x245189[_0x5727('0x30')]=_0x245189['attributes'][_0x5727('0x32')]?_0x245189['attributes']:_0x7620cd[_0x5727('0x2f')];if(_0x4da232[_0x5727('0x2c')][_0x5727('0x3c')]){_0x245189[_0x5727('0x3d')]=[{'all':!![]}];}_0x245189=_['merge']({},_0x245189,_0x4da232['options']);return db[_0x5727('0x28')][_0x5727('0x43')](_0x245189)[_0x5727('0x21')](handleEntityNotFound(_0x91b888,null))[_0x5727('0x21')](respondWithResult(_0x91b888,null))[_0x5727('0x40')](handleError(_0x91b888,null));};exports['create']=function(_0x40887d,_0xb168c){return db[_0x5727('0x28')]['create'](_0x40887d[_0x5727('0x44')],{})[_0x5727('0x21')](function(_0x318c43){var _0x43cb66=_0x40887d[_0x5727('0x45')][_0x5727('0x46')]({'plain':!![]});if(!_0x43cb66)throw new Error(_0x5727('0x47'));if(_0x43cb66[_0x5727('0x48')]==='user'){var _0x9a3222=_0x318c43[_0x5727('0x46')]({'plain':!![]});var _0x4a7417=_0x5727('0x49');return db['UserProfileSection'][_0x5727('0x43')]({'where':{'name':_0x4a7417,'userProfileId':_0x43cb66[_0x5727('0x4a')]},'raw':!![]})[_0x5727('0x21')](function(_0x50e166){if(_0x50e166&&_0x50e166[_0x5727('0x4b')]===0x0){return db[_0x5727('0x22')]['create']({'name':_0x9a3222[_0x5727('0x25')],'resourceId':_0x9a3222['id'],'type':_0x50e166[_0x5727('0x25')],'sectionId':_0x50e166['id']},{})[_0x5727('0x21')](function(){return _0x318c43;});}else{return _0x318c43;}})[_0x5727('0x40')](function(_0xa68aa1){logger[_0x5727('0x4c')](_0x5727('0x4d'),_0xa68aa1);throw _0xa68aa1;});}return _0x318c43;})[_0x5727('0x21')](respondWithResult(_0xb168c,0xc9))[_0x5727('0x40')](handleError(_0xb168c,null));};exports[_0x5727('0x4e')]=function(_0x3151cd,_0x169d11){var _0x29cee7={'where':{'id':_0x3151cd[_0x5727('0x42')]['id']}},_0x273085={};_0x273085['model']=_['keys'](db[_0x5727('0x28')][_0x5727('0x29')]);_0x29cee7['attributes']=_['intersection'](_0x273085['model'],qs[_0x5727('0x31')](_0x3151cd[_0x5727('0x2c')][_0x5727('0x31')]));_0x29cee7[_0x5727('0x30')]=_0x29cee7[_0x5727('0x30')][_0x5727('0x32')]?_0x29cee7[_0x5727('0x30')]:_0x273085[_0x5727('0x2f')];if(_0x3151cd[_0x5727('0x2c')][_0x5727('0x3c')]){_0x29cee7[_0x5727('0x3d')]=[{'all':!![]}];}_0x29cee7=_[_0x5727('0x3a')]({},_0x29cee7,_0x3151cd['options']);return db[_0x5727('0x28')]['find'](_0x29cee7)[_0x5727('0x21')](handleEntityNotFound(_0x169d11,null))[_0x5727('0x21')](function(_0x21c1b1){if(_0x21c1b1){var _0x180f05=_0x21c1b1[_0x5727('0x46')]({'plain':!![]});_0x180f05=qs['omit'](_0x180f05,['id',_0x5727('0x4f'),_0x5727('0x50')]);_0x3151cd[_0x5727('0x44')]=_[_0x5727('0x51')](_0x3151cd['body'],['id',_0x5727('0x4f'),_0x5727('0x50')]);return db[_0x5727('0x28')][_0x5727('0x52')](_[_0x5727('0x3a')](_0x180f05,_0x3151cd[_0x5727('0x44')]),{'include':_0x3151cd['query'][_0x5727('0x3c')]?[{'all':!![]}]:undefined})[_0x5727('0x21')](function(_0x1ba6eb){var _0xfccdb7=_0x3151cd[_0x5727('0x45')]['get']({'plain':!![]});if(!_0xfccdb7)throw new Error(_0x5727('0x47'));if(_0xfccdb7[_0x5727('0x48')]===_0x5727('0x45')){var _0x324e95=_0x1ba6eb[_0x5727('0x46')]({'plain':!![]});var _0x5c90f0=_0x5727('0x49');return db[_0x5727('0x53')][_0x5727('0x43')]({'where':{'name':_0x5c90f0,'userProfileId':_0xfccdb7[_0x5727('0x4a')]},'raw':!![]})[_0x5727('0x21')](function(_0x433b09){if(_0x433b09&&_0x433b09['autoAssociation']===0x0){return db[_0x5727('0x22')][_0x5727('0x52')]({'name':_0x324e95[_0x5727('0x25')],'resourceId':_0x324e95['id'],'type':_0x433b09[_0x5727('0x25')],'sectionId':_0x433b09['id']},{})[_0x5727('0x21')](function(){return _0x1ba6eb;});}else{return _0x1ba6eb;}})[_0x5727('0x40')](function(_0x709762){logger['error'](_0x5727('0x4d'),_0x709762);throw _0x709762;});}return _0x1ba6eb;});}})[_0x5727('0x21')](respondWithResult(_0x169d11,0xc9))[_0x5727('0x40')](handleError(_0x169d11,null));};exports[_0x5727('0x20')]=function(_0x59bf27,_0x38c627){if(_0x59bf27[_0x5727('0x44')]['id']){delete _0x59bf27[_0x5727('0x44')]['id'];}return db[_0x5727('0x28')][_0x5727('0x43')]({'where':{'id':_0x59bf27['params']['id']}})[_0x5727('0x21')](handleEntityNotFound(_0x38c627,null))[_0x5727('0x21')](saveUpdates(_0x59bf27['body'],null))[_0x5727('0x21')](respondWithResult(_0x38c627,null))[_0x5727('0x40')](handleError(_0x38c627,null));};exports[_0x5727('0x23')]=function(_0x1e2f3b,_0xc37b31){return db['JscriptyProject'][_0x5727('0x43')]({'where':{'id':_0x1e2f3b[_0x5727('0x42')]['id']}})['then'](handleEntityNotFound(_0xc37b31,null))[_0x5727('0x21')](removeEntity(_0xc37b31,null))[_0x5727('0x40')](handleError(_0xc37b31,null));};exports[_0x5727('0x54')]=function(_0x4d78ba,_0x1c62be,_0x297d4e){var _0x370a65={'raw':!![],'where':{}};var _0x1b417b={};var _0x318b0d={'count':0x0,'rows':[]};return db[_0x5727('0x28')][_0x5727('0x55')]({'where':{'id':_0x4d78ba[_0x5727('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c62be,null))[_0x5727('0x21')](function(_0x261cc6){if(_0x261cc6){_0x1b417b[_0x5727('0x2f')]=_['keys'](db[_0x5727('0x56')]['rawAttributes']);_0x1b417b[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x4d78ba[_0x5727('0x2c')]);_0x1b417b[_0x5727('0x37')]=_['intersection'](_0x1b417b[_0x5727('0x2f')],_0x1b417b[_0x5727('0x2c')]);_0x370a65[_0x5727('0x30')]=_['intersection'](_0x1b417b[_0x5727('0x2f')],qs[_0x5727('0x31')](_0x4d78ba['query'][_0x5727('0x31')]));_0x370a65['attributes']=_0x370a65[_0x5727('0x30')][_0x5727('0x32')]?_0x370a65[_0x5727('0x30')]:_0x1b417b[_0x5727('0x2f')];if(!_0x4d78ba[_0x5727('0x2c')]['hasOwnProperty'](_0x5727('0x34'))){_0x370a65[_0x5727('0x1a')]=qs['limit'](_0x4d78ba[_0x5727('0x2c')][_0x5727('0x1a')]);_0x370a65['offset']=qs[_0x5727('0x18')](_0x4d78ba[_0x5727('0x2c')]['offset']);}_0x370a65[_0x5727('0x57')]=qs[_0x5727('0x35')](_0x4d78ba['query'][_0x5727('0x35')]);_0x370a65[_0x5727('0x39')]=qs[_0x5727('0x37')](_[_0x5727('0x36')](_0x4d78ba[_0x5727('0x2c')],_0x1b417b[_0x5727('0x37')]));_0x370a65[_0x5727('0x39')][_0x5727('0x58')]=_0x261cc6['id'];if(_0x4d78ba['query'][_0x5727('0x38')]){_0x370a65['where']=_[_0x5727('0x3a')](_0x370a65[_0x5727('0x39')],{'$or':_[_0x5727('0x27')](_0x370a65[_0x5727('0x30')],function(_0x424b5a){var _0x7f4b90={};_0x7f4b90[_0x424b5a]={'$like':'%'+_0x4d78ba[_0x5727('0x2c')][_0x5727('0x38')]+'%'};return _0x7f4b90;})});}_0x370a65=_[_0x5727('0x3a')]({},_0x370a65,_0x4d78ba['options']);return db[_0x5727('0x56')][_0x5727('0x1b')]({'where':_0x370a65[_0x5727('0x39')]})[_0x5727('0x21')](function(_0x394c48){_0x318b0d[_0x5727('0x1b')]=_0x394c48;if(_0x4d78ba[_0x5727('0x2c')][_0x5727('0x3c')]){_0x370a65['include']=[{'all':!![]}];}return db[_0x5727('0x56')][_0x5727('0x3e')](_0x370a65);})[_0x5727('0x21')](function(_0x4328d3){_0x318b0d[_0x5727('0x3f')]=_0x4328d3;return _0x318b0d;});}})[_0x5727('0x21')](respondWithFilteredResult(_0x1c62be,_0x370a65))[_0x5727('0x40')](handleError(_0x1c62be,null));};exports['getAnswers']=function(_0x1b10b7,_0x35de7b,_0x132879){var _0x3db853={'raw':!![],'where':{}};var _0x4abf7e={};var _0x28ee57={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x5727('0x55')]({'where':{'id':_0x1b10b7[_0x5727('0x42')]['id']}})['then'](handleEntityNotFound(_0x35de7b,null))['then'](function(_0x3ac017){if(_0x3ac017){_0x4abf7e[_0x5727('0x2f')]=_[_0x5727('0x2d')](db['JscriptyAnswerReport']['rawAttributes']);_0x4abf7e[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x1b10b7['query']);_0x4abf7e[_0x5727('0x37')]=_[_0x5727('0x2e')](_0x4abf7e[_0x5727('0x2f')],_0x4abf7e[_0x5727('0x2c')]);_0x3db853[_0x5727('0x30')]=_[_0x5727('0x2e')](_0x4abf7e[_0x5727('0x2f')],qs['fields'](_0x1b10b7[_0x5727('0x2c')]['fields']));_0x3db853[_0x5727('0x30')]=_0x3db853['attributes'][_0x5727('0x32')]?_0x3db853['attributes']:_0x4abf7e[_0x5727('0x2f')];if(!_0x1b10b7[_0x5727('0x2c')][_0x5727('0x33')](_0x5727('0x34'))){_0x3db853['limit']=qs[_0x5727('0x1a')](_0x1b10b7[_0x5727('0x2c')][_0x5727('0x1a')]);_0x3db853[_0x5727('0x18')]=qs[_0x5727('0x18')](_0x1b10b7[_0x5727('0x2c')][_0x5727('0x18')]);}_0x3db853[_0x5727('0x57')]=qs['sort'](_0x1b10b7[_0x5727('0x2c')][_0x5727('0x35')]);_0x3db853[_0x5727('0x39')]=qs[_0x5727('0x37')](_[_0x5727('0x36')](_0x1b10b7[_0x5727('0x2c')],_0x4abf7e['filters']));_0x3db853[_0x5727('0x39')][_0x5727('0x58')]=_0x3ac017['id'];if(_0x1b10b7[_0x5727('0x2c')]['filter']){_0x3db853[_0x5727('0x39')]=_[_0x5727('0x3a')](_0x3db853[_0x5727('0x39')],{'$or':_['map'](_0x3db853[_0x5727('0x30')],function(_0x54d139){var _0x6ec164={};_0x6ec164[_0x54d139]={'$like':'%'+_0x1b10b7[_0x5727('0x2c')]['filter']+'%'};return _0x6ec164;})});}_0x3db853=_[_0x5727('0x3a')]({},_0x3db853,_0x1b10b7['options']);return db[_0x5727('0x59')][_0x5727('0x1b')]({'where':_0x3db853[_0x5727('0x39')]})[_0x5727('0x21')](function(_0x316559){_0x28ee57[_0x5727('0x1b')]=_0x316559;if(_0x1b10b7[_0x5727('0x2c')]['includeAll']){_0x3db853[_0x5727('0x3d')]=[{'all':!![]}];}return db[_0x5727('0x59')]['findAll'](_0x3db853);})[_0x5727('0x21')](function(_0xd40492){_0x28ee57[_0x5727('0x3f')]=_0xd40492;return _0x28ee57;});}})['then'](respondWithFilteredResult(_0x35de7b,_0x3db853))['catch'](handleError(_0x35de7b,null));};function char(_0x45401c){return _0x5727('0x5a')===typeof _0x45401c?String['fromCharCode'][_0x5727('0x1d')](null,arguments):_0x45401c;}function needsEncapsulation(_0x582926){return!!_0x582926&&(_0x582926[_0x5727('0x5b')]()[_0x5727('0x5c')](char(0xd))>=0x0||_0x582926[_0x5727('0x5b')]()[_0x5727('0x5c')](char(0xa))>=0x0||_0x582926[_0x5727('0x5b')]()['indexOf'](char(0x2c))>=0x0||_0x582926[_0x5727('0x5b')]()[_0x5727('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x5cfe3b){var _0x3d4f89=char(0x22),_0x445b60='\x5c'+char(0x22),_0xa1c4dd=_0x5cfe3b[_0x5727('0x5b')]()[_0x5727('0x5d')](new RegExp(_0x3d4f89,'g'),_0x445b60);return _0x3d4f89+_0xa1c4dd+_0x3d4f89;}exports[_0x5727('0x5e')]=function(_0x270d00,_0xb8ba32,_0x447f54){var _0x172740,_0x2a6606;var _0x1160d5={'where':{'ProjectId':_0x270d00[_0x5727('0x42')]['id']}};if(_0x270d00[_0x5727('0x2c')][_0x5727('0x5f')]){_0x1160d5[_0x5727('0x39')][_0x5727('0x60')]=JSON[_0x5727('0x61')](_0x270d00[_0x5727('0x2c')][_0x5727('0x5f')]);}return db[_0x5727('0x56')][_0x5727('0x3e')](_0x1160d5)['then'](handleEntityNotFound(_0xb8ba32,null))['then'](function(_0x36c435){if(_0x36c435){_0x172740=_0x36c435;return db[_0x5727('0x62')][_0x5727('0x3e')]({'where':{'SessionId':{'$in':_[_0x5727('0x27')](_0x172740,'id')},'ProjectId':_0x270d00['params']['id']},'order':_0x5727('0x63')});}})[_0x5727('0x21')](handleEntityNotFound(_0xb8ba32,null))['then'](function(_0x360200){if(_0x360200){_0x2a6606=_0x360200;var _0x3952a1={};for(var _0x513bbe=0x0,_0x947570=_0x2a6606[_0x5727('0x32')];_0x513bbe<_0x947570;_0x513bbe++){if(!_0x3952a1[_0x5727('0x33')](_0x2a6606[_0x513bbe]['questionId'])){_0x3952a1[_0x2a6606[_0x513bbe][_0x5727('0x64')]]=needsEncapsulation(_0x2a6606[_0x513bbe]['question'])?encapsulate(_0x2a6606[_0x513bbe][_0x5727('0x65')]):_0x2a6606[_0x513bbe][_0x5727('0x65')];}}var _0x2890d8=[],_0x9dfca5={};for(var _0x5a6be0=0x0,_0x24ccd1=_0x172740[_0x5727('0x32')];_0x5a6be0<_0x24ccd1;_0x5a6be0++){_0x9dfca5={'ProjectId':_0x270d00[_0x5727('0x42')]['id'],'SessionId':_0x172740[_0x5a6be0]['id'],'StartTime':moment(_0x172740[_0x5a6be0][_0x5727('0x60')])[_0x5727('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3987d6=0x0,_0x368c44=_0x2a6606[_0x5727('0x32')];_0x3987d6<_0x368c44;_0x3987d6++){if(_0x2a6606[_0x3987d6][_0x5727('0x67')]==_0x172740[_0x5a6be0]['id']&&_0x3952a1[_0x5727('0x33')](_0x2a6606[_0x3987d6][_0x5727('0x64')])){_0x9dfca5[_0x3952a1[_0x2a6606[_0x3987d6][_0x5727('0x64')]]]=_0x2a6606[_0x3987d6][_0x5727('0x68')];}}for(var _0x249a2b in _0x3952a1){if(!_0x9dfca5['hasOwnProperty'](_0x3952a1[_0x249a2b])){_0x9dfca5[_0x3952a1[_0x249a2b]]=null;}}_0x2890d8[_0x5727('0x69')](_0x9dfca5);}return _0x2890d8;}})[_0x5727('0x21')](function(_0x41b41d){if(!_['isEmpty'](_0x41b41d)){var _0x4266df=toCsv(_0x41b41d);var _0xdd46ac=Date['now']();fs[_0x5727('0x6a')](util[_0x5727('0x66')](_0x5727('0x6b'),_0x270d00[_0x5727('0x42')]['id'],_0xdd46ac),_0x4266df);_0xb8ba32['setHeader'](_0x5727('0x6c'),_0x5727('0x6d')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x270d00[_0x5727('0x42')]['id'],_0xdd46ac));_0xb8ba32[_0x5727('0x6e')](_0x5727('0x6f'),_0x5727('0x70'));return _0xb8ba32[_0x5727('0x71')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x270d00['params']['id'],_0xdd46ac));}else{return _0xb8ba32[_0x5727('0x15')](0xcc);}})[_0x5727('0x40')](handleError(_0xb8ba32,null));}; \ No newline at end of file +var _0xca1d=['getSummary','startTime','starttime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','JscriptyProject','includeAll','include','findAll','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','rows','indexOf','toString','replace'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xca1d,0x1e6));var _0xdca1=function(_0x104375,_0x24a179){_0x104375=_0x104375-0x0;var _0xed44a1=_0xca1d[_0x104375];return _0xed44a1;};'use strict';var emlformat=require(_0xdca1('0x0'));var rimraf=require(_0xdca1('0x1'));var zipdir=require(_0xdca1('0x2'));var jsonpatch=require(_0xdca1('0x3'));var rp=require(_0xdca1('0x4'));var moment=require(_0xdca1('0x5'));var BPromise=require(_0xdca1('0x6'));var Mustache=require('mustache');var util=require(_0xdca1('0x7'));var path=require(_0xdca1('0x8'));var sox=require('sox');var csv=require(_0xdca1('0x9'));var ejs=require(_0xdca1('0xa'));var fs=require('fs');var fs_extra=require(_0xdca1('0xb'));var _=require('lodash');var squel=require(_0xdca1('0xc'));var crypto=require(_0xdca1('0xd'));var jsforce=require(_0xdca1('0xe'));var deskjs=require(_0xdca1('0xf'));var toCsv=require(_0xdca1('0x9'));var querystring=require('querystring');var Papa=require(_0xdca1('0x10'));var Redis=require(_0xdca1('0x11'));var authService=require(_0xdca1('0x12'));var qs=require(_0xdca1('0x13'));var as=require(_0xdca1('0x14'));var hardwareService=require(_0xdca1('0x15'));var logger=require('../../config/logger')(_0xdca1('0x16'));var utils=require(_0xdca1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdca1('0x18'));var db=require(_0xdca1('0x19'))['db'];function respondWithStatusCode(_0xb3c445,_0x7769ce){_0x7769ce=_0x7769ce||0xcc;return function(_0x1f0cc6){if(_0x1f0cc6){return _0xb3c445[_0xdca1('0x1a')](_0x7769ce);}return _0xb3c445['status'](_0x7769ce)[_0xdca1('0x1b')]();};}function respondWithResult(_0x5aa74c,_0x26bb58){_0x26bb58=_0x26bb58||0xc8;return function(_0x2874df){if(_0x2874df){return _0x5aa74c[_0xdca1('0x1c')](_0x26bb58)[_0xdca1('0x1d')](_0x2874df);}};}function respondWithFilteredResult(_0xd88192,_0xd65f29){return function(_0x375590){if(_0x375590){var _0x4ba1e9=typeof _0xd65f29['offset']===_0xdca1('0x1e')&&typeof _0xd65f29[_0xdca1('0x1f')]===_0xdca1('0x1e');var _0x363f75=_0x375590[_0xdca1('0x20')];var _0x1fad53=_0x4ba1e9?0x0:_0xd65f29[_0xdca1('0x21')];var _0x39aded=_0x4ba1e9?_0x375590[_0xdca1('0x20')]:_0xd65f29[_0xdca1('0x21')]+_0xd65f29[_0xdca1('0x1f')];var _0x44377f;if(_0x39aded>=_0x363f75){_0x39aded=_0x363f75;_0x44377f=0xc8;}else{_0x44377f=0xce;}_0xd88192[_0xdca1('0x1c')](_0x44377f);return _0xd88192[_0xdca1('0x22')](_0xdca1('0x23'),_0x1fad53+'-'+_0x39aded+'/'+_0x363f75)[_0xdca1('0x1d')](_0x375590);}return null;};}function patchUpdates(_0xe84014){return function(_0x52a930){try{jsonpatch[_0xdca1('0x24')](_0x52a930,_0xe84014,!![]);}catch(_0x366e00){return BPromise[_0xdca1('0x25')](_0x366e00);}return _0x52a930[_0xdca1('0x26')]();};}function saveUpdates(_0x46ec7c,_0x2f1d49){return function(_0xad5463){if(_0xad5463){return _0xad5463[_0xdca1('0x27')](_0x46ec7c)['then'](function(_0x45a2a8){return _0x45a2a8;});}return null;};}function removeEntity(_0x4068dd,_0x4a4682){return function(_0xd34c45){if(_0xd34c45){return _0xd34c45[_0xdca1('0x28')]()[_0xdca1('0x29')](function(){var _0x89cba8=_0xd34c45[_0xdca1('0x2a')]({'plain':!![]});var _0x363165=_0xdca1('0x2b');return db[_0xdca1('0x2c')][_0xdca1('0x28')]({'where':{'type':_0x363165,'resourceId':_0x89cba8['id']}})[_0xdca1('0x29')](function(){return _0xd34c45;});})['then'](function(){_0x4068dd[_0xdca1('0x1c')](0xcc)[_0xdca1('0x1b')]();});}};}function handleEntityNotFound(_0x33d8fe,_0x4a87af){return function(_0x23e342){if(!_0x23e342){_0x33d8fe[_0xdca1('0x1a')](0x194);}return _0x23e342;};}function handleError(_0x3da067,_0x202924){_0x202924=_0x202924||0x1f4;return function(_0x4c718b){logger[_0xdca1('0x2d')](_0x4c718b[_0xdca1('0x2e')]);if(_0x4c718b[_0xdca1('0x2f')]){delete _0x4c718b[_0xdca1('0x2f')];}_0x3da067[_0xdca1('0x1c')](_0x202924)['send'](_0x4c718b);};}exports[_0xdca1('0x30')]=function(_0x25bb64,_0x271e9d){var _0x2bc734={},_0x3c3b4f={},_0x156c4f={'count':0x0,'rows':[]};var _0xd7b1fd=_[_0xdca1('0x31')](db['JscriptyProject'][_0xdca1('0x32')],function(_0x4b33ed){return{'name':_0x4b33ed[_0xdca1('0x33')],'type':_0x4b33ed[_0xdca1('0x34')][_0xdca1('0x35')]};});_0x3c3b4f['model']=_['map'](_0xd7b1fd,_0xdca1('0x2f'));_0x3c3b4f[_0xdca1('0x36')]=_['keys'](_0x25bb64[_0xdca1('0x36')]);_0x3c3b4f['filters']=_[_0xdca1('0x37')](_0x3c3b4f['model'],_0x3c3b4f['query']);_0x2bc734[_0xdca1('0x38')]=_[_0xdca1('0x37')](_0x3c3b4f[_0xdca1('0x39')],qs['fields'](_0x25bb64[_0xdca1('0x36')][_0xdca1('0x3a')]));_0x2bc734['attributes']=_0x2bc734[_0xdca1('0x38')][_0xdca1('0x3b')]?_0x2bc734[_0xdca1('0x38')]:_0x3c3b4f[_0xdca1('0x39')];if(!_0x25bb64['query'][_0xdca1('0x3c')](_0xdca1('0x3d'))){_0x2bc734['limit']=qs[_0xdca1('0x1f')](_0x25bb64[_0xdca1('0x36')]['limit']);_0x2bc734[_0xdca1('0x21')]=qs['offset'](_0x25bb64[_0xdca1('0x36')][_0xdca1('0x21')]);}_0x2bc734[_0xdca1('0x3e')]=qs[_0xdca1('0x3f')](_0x25bb64[_0xdca1('0x36')][_0xdca1('0x3f')]);_0x2bc734[_0xdca1('0x40')]=qs[_0xdca1('0x41')](_[_0xdca1('0x42')](_0x25bb64['query'],_0x3c3b4f[_0xdca1('0x41')]),_0xd7b1fd);if(_0x25bb64['query'][_0xdca1('0x43')]){_0x2bc734[_0xdca1('0x40')]=_['merge'](_0x2bc734['where'],{'$or':_[_0xdca1('0x31')](_0xd7b1fd,function(_0x376458){if(_0x376458['type']!=='VIRTUAL'){var _0x32ab34={};_0x32ab34[_0x376458[_0xdca1('0x2f')]]={'$like':'%'+_0x25bb64[_0xdca1('0x36')][_0xdca1('0x43')]+'%'};return _0x32ab34;}})});}_0x2bc734=_[_0xdca1('0x44')]({},_0x2bc734,_0x25bb64[_0xdca1('0x45')]);var _0x832440={'where':_0x2bc734[_0xdca1('0x40')]};return db[_0xdca1('0x46')][_0xdca1('0x20')](_0x832440)[_0xdca1('0x29')](function(_0x4cacb2){_0x156c4f[_0xdca1('0x20')]=_0x4cacb2;if(_0x25bb64[_0xdca1('0x36')][_0xdca1('0x47')]){_0x2bc734[_0xdca1('0x48')]=[{'all':!![]}];}return db[_0xdca1('0x46')][_0xdca1('0x49')](_0x2bc734);})['then'](function(_0x1ed3d9){_0x156c4f['rows']=_0x1ed3d9;return _0x156c4f;})[_0xdca1('0x29')](respondWithFilteredResult(_0x271e9d,_0x2bc734))[_0xdca1('0x4a')](handleError(_0x271e9d,null));};exports['show']=function(_0x6120e5,_0x266b38){var _0x488c37={'raw':![],'where':{'id':_0x6120e5[_0xdca1('0x4b')]['id']}},_0x4ca8df={};_0x4ca8df[_0xdca1('0x39')]=_[_0xdca1('0x4c')](db[_0xdca1('0x46')][_0xdca1('0x32')]);_0x4ca8df[_0xdca1('0x36')]=_[_0xdca1('0x4c')](_0x6120e5[_0xdca1('0x36')]);_0x4ca8df[_0xdca1('0x41')]=_[_0xdca1('0x37')](_0x4ca8df[_0xdca1('0x39')],_0x4ca8df[_0xdca1('0x36')]);_0x488c37[_0xdca1('0x38')]=_['intersection'](_0x4ca8df[_0xdca1('0x39')],qs[_0xdca1('0x3a')](_0x6120e5[_0xdca1('0x36')][_0xdca1('0x3a')]));_0x488c37['attributes']=_0x488c37[_0xdca1('0x38')][_0xdca1('0x3b')]?_0x488c37[_0xdca1('0x38')]:_0x4ca8df['model'];if(_0x6120e5['query'][_0xdca1('0x47')]){_0x488c37[_0xdca1('0x48')]=[{'all':!![]}];}_0x488c37=_[_0xdca1('0x44')]({},_0x488c37,_0x6120e5[_0xdca1('0x45')]);return db[_0xdca1('0x46')][_0xdca1('0x4d')](_0x488c37)[_0xdca1('0x29')](handleEntityNotFound(_0x266b38,null))[_0xdca1('0x29')](respondWithResult(_0x266b38,null))[_0xdca1('0x4a')](handleError(_0x266b38,null));};exports[_0xdca1('0x4e')]=function(_0x1a6a02,_0x539ccf){return db[_0xdca1('0x46')][_0xdca1('0x4e')](_0x1a6a02[_0xdca1('0x4f')],{})['then'](function(_0xe09828){var _0x36f24f=_0x1a6a02[_0xdca1('0x50')][_0xdca1('0x2a')]({'plain':!![]});if(!_0x36f24f)throw new Error(_0xdca1('0x51'));if(_0x36f24f[_0xdca1('0x52')]===_0xdca1('0x50')){var _0x256a8a=_0xe09828[_0xdca1('0x2a')]({'plain':!![]});var _0x377cc6=_0xdca1('0x2b');return db[_0xdca1('0x53')]['find']({'where':{'name':_0x377cc6,'userProfileId':_0x36f24f['userProfileId']},'raw':!![]})[_0xdca1('0x29')](function(_0x2df360){if(_0x2df360&&_0x2df360[_0xdca1('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x256a8a['name'],'resourceId':_0x256a8a['id'],'type':_0x2df360[_0xdca1('0x2f')],'sectionId':_0x2df360['id']},{})[_0xdca1('0x29')](function(){return _0xe09828;});}else{return _0xe09828;}})['catch'](function(_0x57778e){logger[_0xdca1('0x2d')](_0xdca1('0x55'),_0x57778e);throw _0x57778e;});}return _0xe09828;})['then'](respondWithResult(_0x539ccf,0xc9))[_0xdca1('0x4a')](handleError(_0x539ccf,null));};exports[_0xdca1('0x56')]=function(_0x5593a9,_0x31d671){var _0x5424a2={'where':{'id':_0x5593a9[_0xdca1('0x4b')]['id']}},_0x1bc5dd={};_0x1bc5dd[_0xdca1('0x39')]=_[_0xdca1('0x4c')](db[_0xdca1('0x46')][_0xdca1('0x32')]);_0x5424a2[_0xdca1('0x38')]=_['intersection'](_0x1bc5dd[_0xdca1('0x39')],qs[_0xdca1('0x3a')](_0x5593a9[_0xdca1('0x36')]['fields']));_0x5424a2[_0xdca1('0x38')]=_0x5424a2['attributes'][_0xdca1('0x3b')]?_0x5424a2['attributes']:_0x1bc5dd[_0xdca1('0x39')];if(_0x5593a9[_0xdca1('0x36')]['includeAll']){_0x5424a2[_0xdca1('0x48')]=[{'all':!![]}];}_0x5424a2=_['merge']({},_0x5424a2,_0x5593a9['options']);return db['JscriptyProject'][_0xdca1('0x4d')](_0x5424a2)[_0xdca1('0x29')](handleEntityNotFound(_0x31d671,null))[_0xdca1('0x29')](function(_0x4a27b1){if(_0x4a27b1){var _0x399dec=_0x4a27b1[_0xdca1('0x2a')]({'plain':!![]});_0x399dec=qs[_0xdca1('0x57')](_0x399dec,['id',_0xdca1('0x58'),'updatedAt']);_0x5593a9[_0xdca1('0x4f')]=_[_0xdca1('0x57')](_0x5593a9[_0xdca1('0x4f')],['id','createdAt',_0xdca1('0x59')]);return db[_0xdca1('0x46')][_0xdca1('0x4e')](_[_0xdca1('0x44')](_0x399dec,_0x5593a9['body']),{'include':_0x5593a9[_0xdca1('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x560039){var _0x409427=_0x5593a9[_0xdca1('0x50')][_0xdca1('0x2a')]({'plain':!![]});if(!_0x409427)throw new Error(_0xdca1('0x51'));if(_0x409427['role']==='user'){var _0x1c97d0=_0x560039['get']({'plain':!![]});var _0x5cc8fe=_0xdca1('0x2b');return db[_0xdca1('0x53')][_0xdca1('0x4d')]({'where':{'name':_0x5cc8fe,'userProfileId':_0x409427[_0xdca1('0x5a')]},'raw':!![]})[_0xdca1('0x29')](function(_0x30c660){if(_0x30c660&&_0x30c660[_0xdca1('0x54')]===0x0){return db[_0xdca1('0x2c')][_0xdca1('0x4e')]({'name':_0x1c97d0['name'],'resourceId':_0x1c97d0['id'],'type':_0x30c660[_0xdca1('0x2f')],'sectionId':_0x30c660['id']},{})[_0xdca1('0x29')](function(){return _0x560039;});}else{return _0x560039;}})[_0xdca1('0x4a')](function(_0x351b81){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x351b81);throw _0x351b81;});}return _0x560039;});}})[_0xdca1('0x29')](respondWithResult(_0x31d671,0xc9))[_0xdca1('0x4a')](handleError(_0x31d671,null));};exports[_0xdca1('0x27')]=function(_0x4bdfde,_0x462ad9){if(_0x4bdfde[_0xdca1('0x4f')]['id']){delete _0x4bdfde['body']['id'];}return db[_0xdca1('0x46')][_0xdca1('0x4d')]({'where':{'id':_0x4bdfde['params']['id']}})[_0xdca1('0x29')](handleEntityNotFound(_0x462ad9,null))['then'](saveUpdates(_0x4bdfde[_0xdca1('0x4f')],null))[_0xdca1('0x29')](respondWithResult(_0x462ad9,null))[_0xdca1('0x4a')](handleError(_0x462ad9,null));};exports[_0xdca1('0x28')]=function(_0x503fdf,_0x5da413){return db[_0xdca1('0x46')][_0xdca1('0x4d')]({'where':{'id':_0x503fdf[_0xdca1('0x4b')]['id']}})[_0xdca1('0x29')](handleEntityNotFound(_0x5da413,null))[_0xdca1('0x29')](removeEntity(_0x5da413,null))[_0xdca1('0x4a')](handleError(_0x5da413,null));};exports['getSessions']=function(_0x571efb,_0x20594c,_0x358bbd){var _0x53f96e={'raw':!![],'where':{}};var _0x48a84f={};var _0x4b6470={'count':0x0,'rows':[]};return db[_0xdca1('0x46')]['findOne']({'where':{'id':_0x571efb[_0xdca1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x20594c,null))[_0xdca1('0x29')](function(_0x44fbf0){if(_0x44fbf0){_0x48a84f[_0xdca1('0x39')]=_[_0xdca1('0x4c')](db['JscriptySessionReport']['rawAttributes']);_0x48a84f[_0xdca1('0x36')]=_['keys'](_0x571efb[_0xdca1('0x36')]);_0x48a84f['filters']=_['intersection'](_0x48a84f[_0xdca1('0x39')],_0x48a84f[_0xdca1('0x36')]);_0x53f96e['attributes']=_[_0xdca1('0x37')](_0x48a84f[_0xdca1('0x39')],qs[_0xdca1('0x3a')](_0x571efb[_0xdca1('0x36')][_0xdca1('0x3a')]));_0x53f96e[_0xdca1('0x38')]=_0x53f96e['attributes'][_0xdca1('0x3b')]?_0x53f96e[_0xdca1('0x38')]:_0x48a84f['model'];if(!_0x571efb[_0xdca1('0x36')][_0xdca1('0x3c')](_0xdca1('0x3d'))){_0x53f96e['limit']=qs[_0xdca1('0x1f')](_0x571efb[_0xdca1('0x36')][_0xdca1('0x1f')]);_0x53f96e[_0xdca1('0x21')]=qs[_0xdca1('0x21')](_0x571efb[_0xdca1('0x36')][_0xdca1('0x21')]);}_0x53f96e[_0xdca1('0x3e')]=qs['sort'](_0x571efb['query'][_0xdca1('0x3f')]);_0x53f96e[_0xdca1('0x40')]=qs['filters'](_['pick'](_0x571efb[_0xdca1('0x36')],_0x48a84f[_0xdca1('0x41')]));_0x53f96e[_0xdca1('0x40')]['ProjectId']=_0x44fbf0['id'];if(_0x571efb['query'][_0xdca1('0x43')]){_0x53f96e[_0xdca1('0x40')]=_[_0xdca1('0x44')](_0x53f96e[_0xdca1('0x40')],{'$or':_[_0xdca1('0x31')](_0x53f96e[_0xdca1('0x38')],function(_0x28566a){var _0x56631b={};_0x56631b[_0x28566a]={'$like':'%'+_0x571efb['query'][_0xdca1('0x43')]+'%'};return _0x56631b;})});}_0x53f96e=_[_0xdca1('0x44')]({},_0x53f96e,_0x571efb[_0xdca1('0x45')]);return db[_0xdca1('0x5b')][_0xdca1('0x20')]({'where':_0x53f96e['where']})['then'](function(_0x5ca3b9){_0x4b6470['count']=_0x5ca3b9;if(_0x571efb[_0xdca1('0x36')][_0xdca1('0x47')]){_0x53f96e[_0xdca1('0x48')]=[{'all':!![]}];}return db[_0xdca1('0x5b')]['findAll'](_0x53f96e);})[_0xdca1('0x29')](function(_0x209f81){_0x4b6470['rows']=_0x209f81;return _0x4b6470;});}})[_0xdca1('0x29')](respondWithFilteredResult(_0x20594c,_0x53f96e))['catch'](handleError(_0x20594c,null));};exports[_0xdca1('0x5c')]=function(_0x59e56d,_0x5f2ff,_0x263825){var _0x4379e7={'raw':!![],'where':{}};var _0x1b0f7={};var _0x7e2ec6={'count':0x0,'rows':[]};return db[_0xdca1('0x46')][_0xdca1('0x5d')]({'where':{'id':_0x59e56d[_0xdca1('0x4b')]['id']}})[_0xdca1('0x29')](handleEntityNotFound(_0x5f2ff,null))[_0xdca1('0x29')](function(_0x555a42){if(_0x555a42){_0x1b0f7[_0xdca1('0x39')]=_[_0xdca1('0x4c')](db[_0xdca1('0x5e')][_0xdca1('0x32')]);_0x1b0f7['query']=_[_0xdca1('0x4c')](_0x59e56d[_0xdca1('0x36')]);_0x1b0f7[_0xdca1('0x41')]=_[_0xdca1('0x37')](_0x1b0f7[_0xdca1('0x39')],_0x1b0f7['query']);_0x4379e7[_0xdca1('0x38')]=_[_0xdca1('0x37')](_0x1b0f7[_0xdca1('0x39')],qs[_0xdca1('0x3a')](_0x59e56d['query']['fields']));_0x4379e7[_0xdca1('0x38')]=_0x4379e7[_0xdca1('0x38')]['length']?_0x4379e7['attributes']:_0x1b0f7[_0xdca1('0x39')];if(!_0x59e56d['query'][_0xdca1('0x3c')](_0xdca1('0x3d'))){_0x4379e7['limit']=qs[_0xdca1('0x1f')](_0x59e56d['query'][_0xdca1('0x1f')]);_0x4379e7['offset']=qs[_0xdca1('0x21')](_0x59e56d[_0xdca1('0x36')][_0xdca1('0x21')]);}_0x4379e7['order']=qs['sort'](_0x59e56d['query'][_0xdca1('0x3f')]);_0x4379e7[_0xdca1('0x40')]=qs[_0xdca1('0x41')](_[_0xdca1('0x42')](_0x59e56d[_0xdca1('0x36')],_0x1b0f7[_0xdca1('0x41')]));_0x4379e7['where']['ProjectId']=_0x555a42['id'];if(_0x59e56d['query']['filter']){_0x4379e7['where']=_[_0xdca1('0x44')](_0x4379e7[_0xdca1('0x40')],{'$or':_[_0xdca1('0x31')](_0x4379e7[_0xdca1('0x38')],function(_0x5ef442){var _0x3a69={};_0x3a69[_0x5ef442]={'$like':'%'+_0x59e56d['query']['filter']+'%'};return _0x3a69;})});}_0x4379e7=_[_0xdca1('0x44')]({},_0x4379e7,_0x59e56d[_0xdca1('0x45')]);return db['JscriptyAnswerReport']['count']({'where':_0x4379e7[_0xdca1('0x40')]})['then'](function(_0x7cba2){_0x7e2ec6[_0xdca1('0x20')]=_0x7cba2;if(_0x59e56d[_0xdca1('0x36')][_0xdca1('0x47')]){_0x4379e7[_0xdca1('0x48')]=[{'all':!![]}];}return db[_0xdca1('0x5e')][_0xdca1('0x49')](_0x4379e7);})[_0xdca1('0x29')](function(_0x2a04d1){_0x7e2ec6[_0xdca1('0x5f')]=_0x2a04d1;return _0x7e2ec6;});}})[_0xdca1('0x29')](respondWithFilteredResult(_0x5f2ff,_0x4379e7))[_0xdca1('0x4a')](handleError(_0x5f2ff,null));};function char(_0x1b0d4d){return'number'===typeof _0x1b0d4d?String['fromCharCode'][_0xdca1('0x24')](null,arguments):_0x1b0d4d;}function needsEncapsulation(_0x5f4b6e){return!!_0x5f4b6e&&(_0x5f4b6e['toString']()[_0xdca1('0x60')](char(0xd))>=0x0||_0x5f4b6e[_0xdca1('0x61')]()[_0xdca1('0x60')](char(0xa))>=0x0||_0x5f4b6e[_0xdca1('0x61')]()[_0xdca1('0x60')](char(0x2c))>=0x0||_0x5f4b6e[_0xdca1('0x61')]()[_0xdca1('0x60')](char(0x22))>=0x0);}function encapsulate(_0x727157){var _0x15a8a2=char(0x22),_0x14c25a='\x5c'+char(0x22),_0x4c3fda=_0x727157[_0xdca1('0x61')]()[_0xdca1('0x62')](new RegExp(_0x15a8a2,'g'),_0x14c25a);return _0x15a8a2+_0x4c3fda+_0x15a8a2;}exports[_0xdca1('0x63')]=function(_0x31af85,_0x9134c9,_0x417a24){var _0x567d29,_0x23c7f8;var _0x301875={'where':{'ProjectId':_0x31af85['params']['id']}};if(_0x31af85['query'][_0xdca1('0x64')]){_0x301875[_0xdca1('0x40')][_0xdca1('0x65')]=JSON['parse'](_0x31af85['query']['startTime']);}return db[_0xdca1('0x5b')]['findAll'](_0x301875)['then'](handleEntityNotFound(_0x9134c9,null))['then'](function(_0x5104d5){if(_0x5104d5){_0x567d29=_0x5104d5;return db['JscriptyQuestionReport'][_0xdca1('0x49')]({'where':{'SessionId':{'$in':_[_0xdca1('0x31')](_0x567d29,'id')},'ProjectId':_0x31af85['params']['id']},'order':_0xdca1('0x66')});}})[_0xdca1('0x29')](handleEntityNotFound(_0x9134c9,null))['then'](function(_0x5821ec){if(_0x5821ec){_0x23c7f8=_0x5821ec;var _0x194bbd={};for(var _0x1957d0=0x0,_0x366bc0=_0x23c7f8[_0xdca1('0x3b')];_0x1957d0<_0x366bc0;_0x1957d0++){if(!_0x194bbd[_0xdca1('0x3c')](_0x23c7f8[_0x1957d0]['questionId'])){_0x194bbd[_0x23c7f8[_0x1957d0][_0xdca1('0x67')]]=needsEncapsulation(_0x23c7f8[_0x1957d0][_0xdca1('0x68')])?encapsulate(_0x23c7f8[_0x1957d0]['question']):_0x23c7f8[_0x1957d0][_0xdca1('0x68')];}}var _0x2d187c=[],_0xc611f8={};for(var _0x2bc77e=0x0,_0x45f871=_0x567d29[_0xdca1('0x3b')];_0x2bc77e<_0x45f871;_0x2bc77e++){_0xc611f8={'ProjectId':_0x31af85[_0xdca1('0x4b')]['id'],'SessionId':_0x567d29[_0x2bc77e]['id'],'StartTime':moment(_0x567d29[_0x2bc77e]['starttime'])[_0xdca1('0x69')](_0xdca1('0x6a'))};for(var _0x557e08=0x0,_0x2bfd1c=_0x23c7f8[_0xdca1('0x3b')];_0x557e08<_0x2bfd1c;_0x557e08++){if(_0x23c7f8[_0x557e08]['SessionId']==_0x567d29[_0x2bc77e]['id']&&_0x194bbd['hasOwnProperty'](_0x23c7f8[_0x557e08][_0xdca1('0x67')])){_0xc611f8[_0x194bbd[_0x23c7f8[_0x557e08][_0xdca1('0x67')]]]=_0x23c7f8[_0x557e08][_0xdca1('0x6b')];}}for(var _0x460d51 in _0x194bbd){if(!_0xc611f8[_0xdca1('0x3c')](_0x194bbd[_0x460d51])){_0xc611f8[_0x194bbd[_0x460d51]]=null;}}_0x2d187c['push'](_0xc611f8);}return _0x2d187c;}})[_0xdca1('0x29')](function(_0x5a697c){if(!_[_0xdca1('0x6c')](_0x5a697c)){var _0x24c935=toCsv(_0x5a697c);var _0x4ba44d=Date['now']();fs[_0xdca1('0x6d')](util[_0xdca1('0x69')](_0xdca1('0x6e'),_0x31af85[_0xdca1('0x4b')]['id'],_0x4ba44d),_0x24c935);_0x9134c9[_0xdca1('0x6f')](_0xdca1('0x70'),_0xdca1('0x71')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x31af85[_0xdca1('0x4b')]['id'],_0x4ba44d));_0x9134c9[_0xdca1('0x6f')](_0xdca1('0x72'),_0xdca1('0x73'));return _0x9134c9[_0xdca1('0x74')](util[_0xdca1('0x69')](_0xdca1('0x6e'),_0x31af85['params']['id'],_0x4ba44d));}else{return _0x9134c9['sendStatus'](0xcc);}})['catch'](handleError(_0x9134c9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0d0c8a0..4bb7677 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 _0x9829=['./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x9829,0xc4));var _0x9982=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x9829[_0x531d15];return _0x271a18;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var logger=require(_0x9982('0x2'))(_0x9982('0x3'));var moment=require(_0x9982('0x4'));var BPromise=require('bluebird');var rp=require(_0x9982('0x5'));var fs=require('fs');var path=require(_0x9982('0x6'));var rimraf=require(_0x9982('0x7'));var config=require('../../config/environment');var attributes=require(_0x9982('0x8'));module[_0x9982('0x9')]=function(_0x58f8fe,_0x500dfd){return _0x58f8fe[_0x9982('0xa')](_0x9982('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee14=['JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define'];(function(_0x50c811,_0xfe7ff3){var _0x2b679c=function(_0x26e9fc){while(--_0x26e9fc){_0x50c811['push'](_0x50c811['shift']());}};_0x2b679c(++_0xfe7ff3);}(_0xee14,0x13a));var _0x4ee1=function(_0x4c854a,_0x5f1d33){_0x4c854a=_0x4c854a-0x0;var _0x5d71da=_0xee14[_0x4c854a];return _0x5d71da;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('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 544e21e..fd36101 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4d9443,_0xe0d01f){var _0x350586=function(_0x1e8783){while(--_0x1e8783){_0x4d9443['push'](_0x4d9443['shift']());}};_0x350586(++_0xe0d01f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2ddfb5,_0x13bd8a){_0x2ddfb5=_0x2ddfb5-0x0;var _0x8fd436=_0xf4eb[_0x2ddfb5];return _0x8fd436;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x769627,_0x10e1f8){var _0x5d67d2=function(_0x2c5f51){while(--_0x2c5f51){_0x769627['push'](_0x769627['shift']());}};_0x5d67d2(++_0x10e1f8);}(_0x70e0,0x17b));var _0x070e=function(_0x3157a9,_0x15b989){_0x3157a9=_0x3157a9-0x0;var _0x43457c=_0x70e0[_0x3157a9];return _0x43457c;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 217bc8d..82674dd 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 _0xcc10=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','/:id','show','post','put','delete','destroy','exports','path'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xcc10,0x1af));var _0x0cc1=function(_0x2050fa,_0x333772){_0x2050fa=_0x2050fa-0x0;var _0x40d603=_0xcc10[_0x2050fa];return _0x40d603;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0cc1('0x0'));var timeout=require('connect-timeout');var express=require(_0x0cc1('0x1'));var router=express[_0x0cc1('0x2')]();var fs_extra=require(_0x0cc1('0x3'));var auth=require(_0x0cc1('0x4'));var interaction=require(_0x0cc1('0x5'));var config=require(_0x0cc1('0x6'));var controller=require(_0x0cc1('0x7'));router[_0x0cc1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0cc1('0x9'),auth[_0x0cc1('0xa')](),controller['describe']);router[_0x0cc1('0x8')](_0x0cc1('0xb'),auth['isAuthenticated'](),controller[_0x0cc1('0xc')]);router[_0x0cc1('0xd')]('/',auth[_0x0cc1('0xa')](),controller['create']);router[_0x0cc1('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0cc1('0xf')](_0x0cc1('0xb'),auth['isAuthenticated'](),controller[_0x0cc1('0x10')]);module[_0x0cc1('0x11')]=router; \ No newline at end of file +var _0x7790=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x21cb7f,_0x3a64fe){var _0x1cbe94=function(_0x469011){while(--_0x469011){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x1cbe94(++_0x3a64fe);}(_0x7790,0x110));var _0x0779=function(_0x436cfc,_0x3ee7a3){_0x436cfc=_0x436cfc-0x0;var _0x2cac0e=_0x7790[_0x436cfc];return _0x2cac0e;};'use strict';var multer=require('multer');var util=require(_0x0779('0x0'));var path=require(_0x0779('0x1'));var timeout=require(_0x0779('0x2'));var express=require(_0x0779('0x3'));var router=express[_0x0779('0x4')]();var fs_extra=require(_0x0779('0x5'));var auth=require(_0x0779('0x6'));var interaction=require(_0x0779('0x7'));var config=require(_0x0779('0x8'));var controller=require(_0x0779('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0779('0xa')]);router[_0x0779('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x0779('0xc')]);router[_0x0779('0xb')]('/:id',auth[_0x0779('0xd')](),controller[_0x0779('0xe')]);router[_0x0779('0xf')]('/',auth[_0x0779('0xd')](),controller[_0x0779('0x10')]);router[_0x0779('0x11')](_0x0779('0x12'),auth[_0x0779('0xd')](),controller[_0x0779('0x13')]);router[_0x0779('0x14')](_0x0779('0x12'),auth[_0x0779('0xd')](),controller[_0x0779('0x15')]);module[_0x0779('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 0469dfe..5b41821 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0xa9d3c1,_0x3c141b){_0xa9d3c1=_0xa9d3c1-0x0;var _0x8c8ec=_0x7a54[_0xa9d3c1];return _0x8c8ec;};'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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x1130ec,_0x38eba3){_0x1130ec=_0x1130ec-0x0;var _0x27387c=_0x7a54[_0x1130ec];return _0x27387c;};'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 744ac26..6687a80 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 _0xc43c=['include','findAll','catch','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','reject','save','update','then','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','options','includeAll'];(function(_0xdec3d8,_0x54eb20){var _0xdf8b50=function(_0x619f78){while(--_0x619f78){_0xdec3d8['push'](_0xdec3d8['shift']());}};_0xdf8b50(++_0x54eb20);}(_0xc43c,0x1ec));var _0xcc43=function(_0x365d36,_0x56ed88){_0x365d36=_0x365d36-0x0;var _0x38d126=_0xc43c[_0x365d36];return _0x38d126;};'use strict';var emlformat=require(_0xcc43('0x0'));var rimraf=require(_0xcc43('0x1'));var zipdir=require(_0xcc43('0x2'));var jsonpatch=require(_0xcc43('0x3'));var rp=require(_0xcc43('0x4'));var moment=require('moment');var BPromise=require(_0xcc43('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcc43('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc43('0x7'));var _=require(_0xcc43('0x8'));var squel=require(_0xcc43('0x9'));var crypto=require(_0xcc43('0xa'));var jsforce=require(_0xcc43('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcc43('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc43('0xc'));var authService=require(_0xcc43('0xd'));var qs=require(_0xcc43('0xe'));var as=require(_0xcc43('0xf'));var hardwareService=require(_0xcc43('0x10'));var logger=require('../../config/logger')(_0xcc43('0x11'));var utils=require(_0xcc43('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xcc43('0x13'));var db=require(_0xcc43('0x14'))['db'];function respondWithStatusCode(_0x475567,_0x21387e){_0x21387e=_0x21387e||0xcc;return function(_0x225d12){if(_0x225d12){return _0x475567[_0xcc43('0x15')](_0x21387e);}return _0x475567['status'](_0x21387e)[_0xcc43('0x16')]();};}function respondWithResult(_0xf0514e,_0x513235){_0x513235=_0x513235||0xc8;return function(_0x10f90f){if(_0x10f90f){return _0xf0514e['status'](_0x513235)[_0xcc43('0x17')](_0x10f90f);}};}function respondWithFilteredResult(_0x40eb52,_0xd06de3){return function(_0x55058c){if(_0x55058c){var _0x401f48=typeof _0xd06de3[_0xcc43('0x18')]===_0xcc43('0x19')&&typeof _0xd06de3['limit']==='undefined';var _0x1102d9=_0x55058c[_0xcc43('0x1a')];var _0x4fbfbb=_0x401f48?0x0:_0xd06de3['offset'];var _0x2cb40c=_0x401f48?_0x55058c[_0xcc43('0x1a')]:_0xd06de3[_0xcc43('0x18')]+_0xd06de3['limit'];var _0x1e5043;if(_0x2cb40c>=_0x1102d9){_0x2cb40c=_0x1102d9;_0x1e5043=0xc8;}else{_0x1e5043=0xce;}_0x40eb52[_0xcc43('0x1b')](_0x1e5043);return _0x40eb52['set'](_0xcc43('0x1c'),_0x4fbfbb+'-'+_0x2cb40c+'/'+_0x1102d9)[_0xcc43('0x17')](_0x55058c);}return null;};}function patchUpdates(_0x2f2e71){return function(_0xf17b52){try{jsonpatch['apply'](_0xf17b52,_0x2f2e71,!![]);}catch(_0x4793f5){return BPromise[_0xcc43('0x1d')](_0x4793f5);}return _0xf17b52[_0xcc43('0x1e')]();};}function saveUpdates(_0x4c1d99,_0x4d724a){return function(_0x461d02){if(_0x461d02){return _0x461d02[_0xcc43('0x1f')](_0x4c1d99)['then'](function(_0x282009){return _0x282009;});}return null;};}function removeEntity(_0x2b761a,_0xcdaab1){return function(_0x5be555){if(_0x5be555){return _0x5be555['destroy']()[_0xcc43('0x20')](function(){_0x2b761a[_0xcc43('0x1b')](0xcc)[_0xcc43('0x16')]();});}};}function handleEntityNotFound(_0x499b24,_0x2cc685){return function(_0x2cc5a2){if(!_0x2cc5a2){_0x499b24[_0xcc43('0x15')](0x194);}return _0x2cc5a2;};}function handleError(_0x28197e,_0x5af371){_0x5af371=_0x5af371||0x1f4;return function(_0x280575){logger[_0xcc43('0x21')](_0x280575['stack']);if(_0x280575[_0xcc43('0x22')]){delete _0x280575[_0xcc43('0x22')];}_0x28197e[_0xcc43('0x1b')](_0x5af371)[_0xcc43('0x23')](_0x280575);};}exports[_0xcc43('0x24')]=function(_0x58946e,_0x58da42){var _0x473edf={},_0x5f2fa0={},_0x1acb4e={'count':0x0,'rows':[]};var _0x38582e=_[_0xcc43('0x25')](db[_0xcc43('0x26')][_0xcc43('0x27')],function(_0x26c9b0){return{'name':_0x26c9b0[_0xcc43('0x28')],'type':_0x26c9b0[_0xcc43('0x29')]['key']};});_0x5f2fa0['model']=_[_0xcc43('0x25')](_0x38582e,_0xcc43('0x22'));_0x5f2fa0[_0xcc43('0x2a')]=_[_0xcc43('0x2b')](_0x58946e[_0xcc43('0x2a')]);_0x5f2fa0[_0xcc43('0x2c')]=_[_0xcc43('0x2d')](_0x5f2fa0[_0xcc43('0x2e')],_0x5f2fa0[_0xcc43('0x2a')]);_0x473edf['attributes']=_[_0xcc43('0x2d')](_0x5f2fa0['model'],qs[_0xcc43('0x2f')](_0x58946e['query'][_0xcc43('0x2f')]));_0x473edf[_0xcc43('0x30')]=_0x473edf[_0xcc43('0x30')][_0xcc43('0x31')]?_0x473edf[_0xcc43('0x30')]:_0x5f2fa0['model'];if(!_0x58946e[_0xcc43('0x2a')][_0xcc43('0x32')](_0xcc43('0x33'))){_0x473edf[_0xcc43('0x34')]=qs[_0xcc43('0x34')](_0x58946e[_0xcc43('0x2a')][_0xcc43('0x34')]);_0x473edf['offset']=qs['offset'](_0x58946e[_0xcc43('0x2a')][_0xcc43('0x18')]);}_0x473edf[_0xcc43('0x35')]=qs['sort'](_0x58946e[_0xcc43('0x2a')]['sort']);_0x473edf['where']=qs[_0xcc43('0x2c')](_[_0xcc43('0x36')](_0x58946e[_0xcc43('0x2a')],_0x5f2fa0[_0xcc43('0x2c')]),_0x38582e);if(_0x58946e[_0xcc43('0x2a')][_0xcc43('0x37')]){_0x473edf[_0xcc43('0x38')]=_['merge'](_0x473edf[_0xcc43('0x38')],{'$or':_[_0xcc43('0x25')](_0x38582e,function(_0x34272d){if(_0x34272d[_0xcc43('0x29')]!=='VIRTUAL'){var _0x2d7690={};_0x2d7690[_0x34272d['name']]={'$like':'%'+_0x58946e[_0xcc43('0x2a')]['filter']+'%'};return _0x2d7690;}})});}_0x473edf=_[_0xcc43('0x39')]({},_0x473edf,_0x58946e[_0xcc43('0x3a')]);var _0x3b1256={'where':_0x473edf[_0xcc43('0x38')]};return db[_0xcc43('0x26')]['count'](_0x3b1256)[_0xcc43('0x20')](function(_0x4408e5){_0x1acb4e[_0xcc43('0x1a')]=_0x4408e5;if(_0x58946e[_0xcc43('0x2a')][_0xcc43('0x3b')]){_0x473edf[_0xcc43('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xcc43('0x3d')](_0x473edf);})[_0xcc43('0x20')](function(_0x5a6a84){_0x1acb4e['rows']=_0x5a6a84;return _0x1acb4e;})[_0xcc43('0x20')](respondWithFilteredResult(_0x58da42,_0x473edf))[_0xcc43('0x3e')](handleError(_0x58da42,null));};exports['show']=function(_0x490576,_0x4d0bb9){var _0x1ece91={'raw':!![],'where':{'id':_0x490576[_0xcc43('0x3f')]['id']}},_0x2a2c64={};_0x2a2c64[_0xcc43('0x2e')]=_[_0xcc43('0x2b')](db[_0xcc43('0x26')][_0xcc43('0x27')]);_0x2a2c64[_0xcc43('0x2a')]=_[_0xcc43('0x2b')](_0x490576[_0xcc43('0x2a')]);_0x2a2c64['filters']=_['intersection'](_0x2a2c64[_0xcc43('0x2e')],_0x2a2c64['query']);_0x1ece91['attributes']=_[_0xcc43('0x2d')](_0x2a2c64[_0xcc43('0x2e')],qs['fields'](_0x490576['query']['fields']));_0x1ece91[_0xcc43('0x30')]=_0x1ece91[_0xcc43('0x30')][_0xcc43('0x31')]?_0x1ece91['attributes']:_0x2a2c64['model'];if(_0x490576[_0xcc43('0x2a')][_0xcc43('0x3b')]){_0x1ece91[_0xcc43('0x3c')]=[{'all':!![]}];}_0x1ece91=_[_0xcc43('0x39')]({},_0x1ece91,_0x490576[_0xcc43('0x3a')]);return db[_0xcc43('0x26')][_0xcc43('0x40')](_0x1ece91)[_0xcc43('0x20')](handleEntityNotFound(_0x4d0bb9,null))[_0xcc43('0x20')](respondWithResult(_0x4d0bb9,null))[_0xcc43('0x3e')](handleError(_0x4d0bb9,null));};exports[_0xcc43('0x41')]=function(_0x23f260,_0x15fafa){return db[_0xcc43('0x26')][_0xcc43('0x41')](_0x23f260[_0xcc43('0x42')],{})[_0xcc43('0x20')](respondWithResult(_0x15fafa,0xc9))['catch'](handleError(_0x15fafa,null));};exports['update']=function(_0x37e680,_0x269420){if(_0x37e680[_0xcc43('0x42')]['id']){delete _0x37e680[_0xcc43('0x42')]['id'];}return db[_0xcc43('0x26')][_0xcc43('0x40')]({'where':{'id':_0x37e680[_0xcc43('0x3f')]['id']}})[_0xcc43('0x20')](handleEntityNotFound(_0x269420,null))[_0xcc43('0x20')](saveUpdates(_0x37e680[_0xcc43('0x42')],null))[_0xcc43('0x20')](respondWithResult(_0x269420,null))[_0xcc43('0x3e')](handleError(_0x269420,null));};exports[_0xcc43('0x43')]=function(_0xbc57bd,_0x1d14a2){return db[_0xcc43('0x26')][_0xcc43('0x40')]({'where':{'id':_0xbc57bd[_0xcc43('0x3f')]['id']}})[_0xcc43('0x20')](handleEntityNotFound(_0x1d14a2,null))[_0xcc43('0x20')](removeEntity(_0x1d14a2,null))[_0xcc43('0x3e')](handleError(_0x1d14a2,null));};exports[_0xcc43('0x44')]=function(_0x1d77fe,_0x2830a8){return db[_0xcc43('0x26')][_0xcc43('0x44')]()[_0xcc43('0x20')](respondWithResult(_0x2830a8,null))[_0xcc43('0x3e')](handleError(_0x2830a8,null));}; \ No newline at end of file +var _0x979a=['map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','index'];(function(_0x106487,_0x23de58){var _0xc1da08=function(_0x2b06db){while(--_0x2b06db){_0x106487['push'](_0x106487['shift']());}};_0xc1da08(++_0x23de58);}(_0x979a,0x6c));var _0xa979=function(_0xbcd604,_0x5c6862){_0xbcd604=_0xbcd604-0x0;var _0x16a71e=_0x979a[_0xbcd604];return _0x16a71e;};'use strict';var emlformat=require(_0xa979('0x0'));var rimraf=require(_0xa979('0x1'));var zipdir=require(_0xa979('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa979('0x3'));var BPromise=require(_0xa979('0x4'));var Mustache=require(_0xa979('0x5'));var util=require(_0xa979('0x6'));var path=require(_0xa979('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa979('0x8'));var fs=require('fs');var fs_extra=require(_0xa979('0x9'));var _=require('lodash');var squel=require(_0xa979('0xa'));var crypto=require('crypto');var jsforce=require(_0xa979('0xb'));var deskjs=require(_0xa979('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa979('0xd'));var Papa=require(_0xa979('0xe'));var Redis=require('ioredis');var authService=require(_0xa979('0xf'));var qs=require(_0xa979('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa979('0x11'));var logger=require(_0xa979('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa979('0x13'));var db=require(_0xa979('0x14'))['db'];function respondWithStatusCode(_0x1be004,_0x572d49){_0x572d49=_0x572d49||0xcc;return function(_0xe8b5a2){if(_0xe8b5a2){return _0x1be004[_0xa979('0x15')](_0x572d49);}return _0x1be004[_0xa979('0x16')](_0x572d49)[_0xa979('0x17')]();};}function respondWithResult(_0x3a9280,_0x41d775){_0x41d775=_0x41d775||0xc8;return function(_0x499780){if(_0x499780){return _0x3a9280['status'](_0x41d775)[_0xa979('0x18')](_0x499780);}};}function respondWithFilteredResult(_0x42f3c6,_0x4447f3){return function(_0x22e4a5){if(_0x22e4a5){var _0x1b5bfa=typeof _0x4447f3[_0xa979('0x19')]===_0xa979('0x1a')&&typeof _0x4447f3[_0xa979('0x1b')]===_0xa979('0x1a');var _0x1394ca=_0x22e4a5['count'];var _0x4d3df1=_0x1b5bfa?0x0:_0x4447f3[_0xa979('0x19')];var _0x4ffc3b=_0x1b5bfa?_0x22e4a5[_0xa979('0x1c')]:_0x4447f3[_0xa979('0x19')]+_0x4447f3['limit'];var _0x37c804;if(_0x4ffc3b>=_0x1394ca){_0x4ffc3b=_0x1394ca;_0x37c804=0xc8;}else{_0x37c804=0xce;}_0x42f3c6[_0xa979('0x16')](_0x37c804);return _0x42f3c6[_0xa979('0x1d')](_0xa979('0x1e'),_0x4d3df1+'-'+_0x4ffc3b+'/'+_0x1394ca)[_0xa979('0x18')](_0x22e4a5);}return null;};}function patchUpdates(_0x404055){return function(_0x21ed60){try{jsonpatch['apply'](_0x21ed60,_0x404055,!![]);}catch(_0x2f90b2){return BPromise[_0xa979('0x1f')](_0x2f90b2);}return _0x21ed60['save']();};}function saveUpdates(_0x1d682e,_0x1a5919){return function(_0x1aecc7){if(_0x1aecc7){return _0x1aecc7[_0xa979('0x20')](_0x1d682e)['then'](function(_0x59d803){return _0x59d803;});}return null;};}function removeEntity(_0x5a1092,_0x1b0688){return function(_0x4b4257){if(_0x4b4257){return _0x4b4257['destroy']()[_0xa979('0x21')](function(){_0x5a1092[_0xa979('0x16')](0xcc)[_0xa979('0x17')]();});}};}function handleEntityNotFound(_0x14b65d,_0x10476a){return function(_0x3c8346){if(!_0x3c8346){_0x14b65d[_0xa979('0x15')](0x194);}return _0x3c8346;};}function handleError(_0x4db81d,_0xbff58d){_0xbff58d=_0xbff58d||0x1f4;return function(_0x197217){logger[_0xa979('0x22')](_0x197217[_0xa979('0x23')]);if(_0x197217[_0xa979('0x24')]){delete _0x197217[_0xa979('0x24')];}_0x4db81d[_0xa979('0x16')](_0xbff58d)['send'](_0x197217);};}exports[_0xa979('0x25')]=function(_0x3ed822,_0x5e0a36){var _0x5b3a69={},_0x5ec071={},_0x4a0d8e={'count':0x0,'rows':[]};var _0x4917bd=_[_0xa979('0x26')](db[_0xa979('0x27')][_0xa979('0x28')],function(_0x3a6c70){return{'name':_0x3a6c70[_0xa979('0x29')],'type':_0x3a6c70[_0xa979('0x2a')][_0xa979('0x2b')]};});_0x5ec071[_0xa979('0x2c')]=_['map'](_0x4917bd,_0xa979('0x24'));_0x5ec071[_0xa979('0x2d')]=_[_0xa979('0x2e')](_0x3ed822[_0xa979('0x2d')]);_0x5ec071[_0xa979('0x2f')]=_[_0xa979('0x30')](_0x5ec071[_0xa979('0x2c')],_0x5ec071['query']);_0x5b3a69['attributes']=_['intersection'](_0x5ec071['model'],qs['fields'](_0x3ed822[_0xa979('0x2d')][_0xa979('0x31')]));_0x5b3a69[_0xa979('0x32')]=_0x5b3a69[_0xa979('0x32')][_0xa979('0x33')]?_0x5b3a69['attributes']:_0x5ec071[_0xa979('0x2c')];if(!_0x3ed822[_0xa979('0x2d')][_0xa979('0x34')](_0xa979('0x35'))){_0x5b3a69[_0xa979('0x1b')]=qs[_0xa979('0x1b')](_0x3ed822['query'][_0xa979('0x1b')]);_0x5b3a69[_0xa979('0x19')]=qs[_0xa979('0x19')](_0x3ed822[_0xa979('0x2d')][_0xa979('0x19')]);}_0x5b3a69[_0xa979('0x36')]=qs[_0xa979('0x37')](_0x3ed822[_0xa979('0x2d')][_0xa979('0x37')]);_0x5b3a69[_0xa979('0x38')]=qs[_0xa979('0x2f')](_[_0xa979('0x39')](_0x3ed822[_0xa979('0x2d')],_0x5ec071['filters']),_0x4917bd);if(_0x3ed822[_0xa979('0x2d')][_0xa979('0x3a')]){_0x5b3a69[_0xa979('0x38')]=_[_0xa979('0x3b')](_0x5b3a69[_0xa979('0x38')],{'$or':_[_0xa979('0x26')](_0x4917bd,function(_0xb64809){if(_0xb64809[_0xa979('0x2a')]!==_0xa979('0x3c')){var _0x3a1d16={};_0x3a1d16[_0xb64809['name']]={'$like':'%'+_0x3ed822[_0xa979('0x2d')]['filter']+'%'};return _0x3a1d16;}})});}_0x5b3a69=_[_0xa979('0x3b')]({},_0x5b3a69,_0x3ed822['options']);var _0x5cdebd={'where':_0x5b3a69[_0xa979('0x38')]};return db[_0xa979('0x27')]['count'](_0x5cdebd)['then'](function(_0x475071){_0x4a0d8e[_0xa979('0x1c')]=_0x475071;if(_0x3ed822[_0xa979('0x2d')][_0xa979('0x3d')]){_0x5b3a69[_0xa979('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xa979('0x3f')](_0x5b3a69);})[_0xa979('0x21')](function(_0x460bba){_0x4a0d8e[_0xa979('0x40')]=_0x460bba;return _0x4a0d8e;})[_0xa979('0x21')](respondWithFilteredResult(_0x5e0a36,_0x5b3a69))[_0xa979('0x41')](handleError(_0x5e0a36,null));};exports[_0xa979('0x42')]=function(_0x3751dc,_0x348974){var _0x22690c={'raw':!![],'where':{'id':_0x3751dc[_0xa979('0x43')]['id']}},_0x498be6={};_0x498be6[_0xa979('0x2c')]=_[_0xa979('0x2e')](db[_0xa979('0x27')][_0xa979('0x28')]);_0x498be6['query']=_[_0xa979('0x2e')](_0x3751dc[_0xa979('0x2d')]);_0x498be6[_0xa979('0x2f')]=_[_0xa979('0x30')](_0x498be6['model'],_0x498be6[_0xa979('0x2d')]);_0x22690c[_0xa979('0x32')]=_[_0xa979('0x30')](_0x498be6[_0xa979('0x2c')],qs[_0xa979('0x31')](_0x3751dc['query'][_0xa979('0x31')]));_0x22690c[_0xa979('0x32')]=_0x22690c[_0xa979('0x32')]['length']?_0x22690c[_0xa979('0x32')]:_0x498be6['model'];if(_0x3751dc[_0xa979('0x2d')][_0xa979('0x3d')]){_0x22690c[_0xa979('0x3e')]=[{'all':!![]}];}_0x22690c=_['merge']({},_0x22690c,_0x3751dc['options']);return db[_0xa979('0x27')][_0xa979('0x44')](_0x22690c)[_0xa979('0x21')](handleEntityNotFound(_0x348974,null))[_0xa979('0x21')](respondWithResult(_0x348974,null))[_0xa979('0x41')](handleError(_0x348974,null));};exports[_0xa979('0x45')]=function(_0x4f35bb,_0x2328f1){return db['JscriptyQuestionReport'][_0xa979('0x45')](_0x4f35bb[_0xa979('0x46')],{})[_0xa979('0x21')](respondWithResult(_0x2328f1,0xc9))[_0xa979('0x41')](handleError(_0x2328f1,null));};exports[_0xa979('0x20')]=function(_0x352d3c,_0x3d975f){if(_0x352d3c[_0xa979('0x46')]['id']){delete _0x352d3c[_0xa979('0x46')]['id'];}return db['JscriptyQuestionReport'][_0xa979('0x44')]({'where':{'id':_0x352d3c[_0xa979('0x43')]['id']}})[_0xa979('0x21')](handleEntityNotFound(_0x3d975f,null))[_0xa979('0x21')](saveUpdates(_0x352d3c[_0xa979('0x46')],null))[_0xa979('0x21')](respondWithResult(_0x3d975f,null))[_0xa979('0x41')](handleError(_0x3d975f,null));};exports[_0xa979('0x47')]=function(_0x2c2119,_0x296857){return db['JscriptyQuestionReport'][_0xa979('0x44')]({'where':{'id':_0x2c2119[_0xa979('0x43')]['id']}})['then'](handleEntityNotFound(_0x296857,null))[_0xa979('0x21')](removeEntity(_0x296857,null))[_0xa979('0x41')](handleError(_0x296857,null));};exports['describe']=function(_0x1a21d2,_0x401d33){return db[_0xa979('0x27')][_0xa979('0x48')]()['then'](respondWithResult(_0x401d33,null))['catch'](handleError(_0x401d33,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a6d1607..029ff84 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 _0x6d68=['request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','util','../../config/logger','api','moment','bluebird'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x6d68,0x193));var _0x86d6=function(_0x4fe1bb,_0x9b6bcb){_0x4fe1bb=_0x4fe1bb-0x0;var _0x37f838=_0x6d68[_0x4fe1bb];return _0x37f838;};'use strict';var _=require('lodash');var util=require(_0x86d6('0x0'));var logger=require(_0x86d6('0x1'))(_0x86d6('0x2'));var moment=require(_0x86d6('0x3'));var BPromise=require(_0x86d6('0x4'));var rp=require(_0x86d6('0x5'));var fs=require('fs');var path=require(_0x86d6('0x6'));var rimraf=require(_0x86d6('0x7'));var config=require('../../config/environment');var attributes=require(_0x86d6('0x8'));module[_0x86d6('0x9')]=function(_0x11f98b,_0x4afa03){return _0x11f98b[_0x86d6('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x86d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0370=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2fe15c,_0x48713a){var _0x26ec58=function(_0x3e475a){while(--_0x3e475a){_0x2fe15c['push'](_0x2fe15c['shift']());}};_0x26ec58(++_0x48713a);}(_0x0370,0x103));var _0x0037=function(_0x52d612,_0x229bd8){_0x52d612=_0x52d612-0x0;var _0x202b54=_0x0370[_0x52d612];return _0x202b54;};'use strict';var _=require(_0x0037('0x0'));var util=require(_0x0037('0x1'));var logger=require(_0x0037('0x2'))(_0x0037('0x3'));var moment=require(_0x0037('0x4'));var BPromise=require(_0x0037('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0037('0x6'));var rimraf=require(_0x0037('0x7'));var config=require(_0x0037('0x8'));var attributes=require(_0x0037('0x9'));module[_0x0037('0xa')]=function(_0x208f71,_0x1b012a){return _0x208f71[_0x0037('0xb')](_0x0037('0xc'),attributes,{'tableName':_0x0037('0xd'),'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 03c5720..a24ad6e 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 _0x5e75=['result','catch','JscriptyQuestionReport,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x3271db,_0x1679c8){var _0x21f4bb=function(_0xf45b0e){while(--_0xf45b0e){_0x3271db['push'](_0x3271db['shift']());}};_0x21f4bb(++_0x1679c8);}(_0x5e75,0x17d));var _0x55e7=function(_0x4e6a00,_0x51040d){_0x4e6a00=_0x4e6a00-0x0;var _0xaa0eb3=_0x5e75[_0x4e6a00];return _0xaa0eb3;};'use strict';var _=require(_0x55e7('0x0'));var util=require('util');var moment=require(_0x55e7('0x1'));var BPromise=require(_0x55e7('0x2'));var rs=require(_0x55e7('0x3'));var fs=require('fs');var Redis=require(_0x55e7('0x4'));var db=require(_0x55e7('0x5'))['db'];var utils=require(_0x55e7('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x55e7('0x7'));var client=jayson[_0x55e7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19cf74,_0x419d5a,_0x2b04ac){return new BPromise(function(_0x3ffc54,_0x510d45){return client[_0x55e7('0x9')](_0x19cf74,_0x2b04ac)[_0x55e7('0xa')](function(_0x2b19cf){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x419d5a,_0x55e7('0xb'));logger[_0x55e7('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x419d5a,_0x55e7('0xb'),JSON[_0x55e7('0xd')](_0x2b19cf));if(_0x2b19cf[_0x55e7('0xe')]){if(_0x2b19cf[_0x55e7('0xe')][_0x55e7('0xf')]===0x1f4){logger[_0x55e7('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x419d5a,_0x2b19cf[_0x55e7('0xe')][_0x55e7('0x10')]);return _0x510d45(_0x2b19cf[_0x55e7('0xe')][_0x55e7('0x10')]);}logger[_0x55e7('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x419d5a,_0x2b19cf[_0x55e7('0xe')][_0x55e7('0x10')]);return _0x3ffc54(_0x2b19cf['error'][_0x55e7('0x10')]);}else{logger[_0x55e7('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x419d5a,_0x55e7('0xb'));_0x3ffc54(_0x2b19cf[_0x55e7('0x12')]['message']);}})[_0x55e7('0x13')](function(_0x24fb32){logger[_0x55e7('0xe')](_0x55e7('0x14'),_0x419d5a,_0x24fb32);_0x510d45(_0x24fb32);});});} \ No newline at end of file +var _0xd85c=['info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','request','then'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd85c,0x114));var _0xcd85=function(_0x2e5f15,_0x5c62c0){_0x2e5f15=_0x2e5f15-0x0;var _0x4624b4=_0xd85c[_0x2e5f15];return _0x4624b4;};'use strict';var _=require(_0xcd85('0x0'));var util=require('util');var moment=require(_0xcd85('0x1'));var BPromise=require(_0xcd85('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd85('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd85('0x4'))(_0xcd85('0x5'));var config=require(_0xcd85('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ab78b,_0x22a3b7,_0xb60fb1){return new BPromise(function(_0x2401ee,_0x22d511){return client[_0xcd85('0x7')](_0x9ab78b,_0xb60fb1)[_0xcd85('0x8')](function(_0x37c045){logger[_0xcd85('0x9')](_0xcd85('0xa'),_0x22a3b7,'request\x20sent');logger[_0xcd85('0xb')](_0xcd85('0xc'),_0x22a3b7,_0xcd85('0xd'),JSON[_0xcd85('0xe')](_0x37c045));if(_0x37c045[_0xcd85('0xf')]){if(_0x37c045[_0xcd85('0xf')][_0xcd85('0x10')]===0x1f4){logger[_0xcd85('0xf')](_0xcd85('0xa'),_0x22a3b7,_0x37c045[_0xcd85('0xf')][_0xcd85('0x11')]);return _0x22d511(_0x37c045[_0xcd85('0xf')]['message']);}logger[_0xcd85('0xf')](_0xcd85('0xa'),_0x22a3b7,_0x37c045[_0xcd85('0xf')][_0xcd85('0x11')]);return _0x2401ee(_0x37c045[_0xcd85('0xf')]['message']);}else{logger[_0xcd85('0x9')](_0xcd85('0xa'),_0x22a3b7,_0xcd85('0xd'));_0x2401ee(_0x37c045['result']['message']);}})[_0xcd85('0x12')](function(_0x500ba2){logger['error'](_0xcd85('0xa'),_0x22a3b7,_0x500ba2);_0x22d511(_0x500ba2);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 04d4a0e..a4ffbcc 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 _0x4255=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4255,0xbb));var _0x5425=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4255[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x5425('0x0'));var util=require(_0x5425('0x1'));var path=require(_0x5425('0x2'));var timeout=require(_0x5425('0x3'));var express=require(_0x5425('0x4'));var router=express[_0x5425('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5425('0x6'));var interaction=require(_0x5425('0x7'));var config=require(_0x5425('0x8'));var controller=require(_0x5425('0x9'));router[_0x5425('0xa')]('/',auth[_0x5425('0xb')](),controller['index']);router[_0x5425('0xa')](_0x5425('0xc'),auth['isAuthenticated'](),controller[_0x5425('0xd')]);router[_0x5425('0xa')](_0x5425('0xe'),auth[_0x5425('0xb')](),controller[_0x5425('0xf')]);router[_0x5425('0xa')](_0x5425('0x10'),auth[_0x5425('0xb')](),controller['getQuestions']);router[_0x5425('0x11')]('/',auth['isAuthenticated'](),controller[_0x5425('0x12')]);router[_0x5425('0x13')](_0x5425('0xe'),auth[_0x5425('0xb')](),controller[_0x5425('0x14')]);router[_0x5425('0x15')](_0x5425('0xe'),auth[_0x5425('0xb')](),controller[_0x5425('0x16')]);module[_0x5425('0x17')]=router; \ No newline at end of file +var _0xc842=['show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x30cfe7,_0xe282c6){var _0x420734=function(_0x2e72ad){while(--_0x2e72ad){_0x30cfe7['push'](_0x30cfe7['shift']());}};_0x420734(++_0xe282c6);}(_0xc842,0xb9));var _0x2c84=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc842[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2c84('0x0'));var timeout=require('connect-timeout');var express=require(_0x2c84('0x1'));var router=express[_0x2c84('0x2')]();var fs_extra=require(_0x2c84('0x3'));var auth=require(_0x2c84('0x4'));var interaction=require(_0x2c84('0x5'));var config=require(_0x2c84('0x6'));var controller=require(_0x2c84('0x7'));router[_0x2c84('0x8')]('/',auth[_0x2c84('0x9')](),controller[_0x2c84('0xa')]);router[_0x2c84('0x8')](_0x2c84('0xb'),auth[_0x2c84('0x9')](),controller['describe']);router[_0x2c84('0x8')](_0x2c84('0xc'),auth['isAuthenticated'](),controller[_0x2c84('0xd')]);router[_0x2c84('0x8')](_0x2c84('0xe'),auth[_0x2c84('0x9')](),controller[_0x2c84('0xf')]);router[_0x2c84('0x10')]('/',auth['isAuthenticated'](),controller[_0x2c84('0x11')]);router[_0x2c84('0x12')](_0x2c84('0xc'),auth[_0x2c84('0x9')](),controller[_0x2c84('0x13')]);router[_0x2c84('0x14')](_0x2c84('0xc'),auth[_0x2c84('0x9')](),controller[_0x2c84('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index eb1b06e..ea94617 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 _0xcd3b=['STRING','BOOLEAN','moment','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3b1fa1,_0x254f7f){var _0x2fd10c=function(_0x25ba77){while(--_0x25ba77){_0x3b1fa1['push'](_0x3b1fa1['shift']());}};_0x2fd10c(++_0x254f7f);}(_0xcd3b,0x19c));var _0xbcd3=function(_0x6ce2c5,_0x412960){_0x6ce2c5=_0x6ce2c5-0x0;var _0x309bc9=_0xcd3b[_0x6ce2c5];return _0x309bc9;};'use strict';var moment=require(_0xbcd3('0x0'));var Sequelize=require('sequelize');module[_0xbcd3('0x1')]={'starttime':{'type':Sequelize[_0xbcd3('0x2')],'set':function(_0x35319d){this[_0xbcd3('0x3')](_0xbcd3('0x4'),_0x35319d);this['setDataValue'](_0xbcd3('0x5'),moment()[_0xbcd3('0x6')](_0xbcd3('0x7')));}},'endtime':{'type':Sequelize[_0xbcd3('0x2')]},'membername':{'type':Sequelize[_0xbcd3('0x8')]},'projectname':{'type':Sequelize[_0xbcd3('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbcd3('0x8')]},'calleridname':{'type':Sequelize[_0xbcd3('0x8')]},'calleridnum':{'type':Sequelize[_0xbcd3('0x8')]},'completed':{'type':Sequelize[_0xbcd3('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x87f1=['sequelize','exports','DATE','setDataValue','starttime','format','STRING','BOOLEAN'];(function(_0x44b7c0,_0x3ea096){var _0x16d381=function(_0x36d026){while(--_0x36d026){_0x44b7c0['push'](_0x44b7c0['shift']());}};_0x16d381(++_0x3ea096);}(_0x87f1,0x170));var _0x187f=function(_0x3c729b,_0x2a4146){_0x3c729b=_0x3c729b-0x0;var _0x55894c=_0x87f1[_0x3c729b];return _0x55894c;};'use strict';var moment=require('moment');var Sequelize=require(_0x187f('0x0'));module[_0x187f('0x1')]={'starttime':{'type':Sequelize[_0x187f('0x2')],'set':function(_0xbc0de1){this[_0x187f('0x3')](_0x187f('0x4'),_0xbc0de1);this[_0x187f('0x3')]('endtime',moment()[_0x187f('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x187f('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x187f('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x187f('0x6')]},'calleridname':{'type':Sequelize[_0x187f('0x6')]},'calleridnum':{'type':Sequelize[_0x187f('0x6')]},'completed':{'type':Sequelize[_0x187f('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7858a56..6a63473 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 _0xf1fa=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','show','keys','find','create','body','params','catch','destroy','describe','getQuestions','findOne','length','JscriptyQuestionReport','findAll','eml-format','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xf1fa,0x82));var _0xaf1f=function(_0x54afbe,_0x4aed33){_0x54afbe=_0x54afbe-0x0;var _0x496024=_0xf1fa[_0x54afbe];return _0x496024;};'use strict';var emlformat=require(_0xaf1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf1f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf1f('0x2'));var moment=require(_0xaf1f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaf1f('0x4'));var util=require(_0xaf1f('0x5'));var path=require(_0xaf1f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf1f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf1f('0x8'));var squel=require(_0xaf1f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf1f('0xa'));var toCsv=require(_0xaf1f('0xb'));var querystring=require(_0xaf1f('0xc'));var Papa=require(_0xaf1f('0xd'));var Redis=require(_0xaf1f('0xe'));var authService=require(_0xaf1f('0xf'));var qs=require(_0xaf1f('0x10'));var as=require(_0xaf1f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xaf1f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xaf1f('0x13'));var db=require(_0xaf1f('0x14'))['db'];function respondWithStatusCode(_0x35cf60,_0x2182f5){_0x2182f5=_0x2182f5||0xcc;return function(_0x512c01){if(_0x512c01){return _0x35cf60[_0xaf1f('0x15')](_0x2182f5);}return _0x35cf60[_0xaf1f('0x16')](_0x2182f5)[_0xaf1f('0x17')]();};}function respondWithResult(_0x2f3788,_0x5b8d62){_0x5b8d62=_0x5b8d62||0xc8;return function(_0x546f01){if(_0x546f01){return _0x2f3788[_0xaf1f('0x16')](_0x5b8d62)[_0xaf1f('0x18')](_0x546f01);}};}function respondWithFilteredResult(_0x508b7d,_0x190bff){return function(_0x25548a){if(_0x25548a){var _0x811550=typeof _0x190bff['offset']===_0xaf1f('0x19')&&typeof _0x190bff[_0xaf1f('0x1a')]==='undefined';var _0x2a93cf=_0x25548a[_0xaf1f('0x1b')];var _0x2e68fe=_0x811550?0x0:_0x190bff[_0xaf1f('0x1c')];var _0x18ea88=_0x811550?_0x25548a[_0xaf1f('0x1b')]:_0x190bff[_0xaf1f('0x1c')]+_0x190bff['limit'];var _0x171aaf;if(_0x18ea88>=_0x2a93cf){_0x18ea88=_0x2a93cf;_0x171aaf=0xc8;}else{_0x171aaf=0xce;}_0x508b7d[_0xaf1f('0x16')](_0x171aaf);return _0x508b7d[_0xaf1f('0x1d')]('Content-Range',_0x2e68fe+'-'+_0x18ea88+'/'+_0x2a93cf)['json'](_0x25548a);}return null;};}function patchUpdates(_0xc8d443){return function(_0x3a0291){try{jsonpatch['apply'](_0x3a0291,_0xc8d443,!![]);}catch(_0xb436a2){return BPromise[_0xaf1f('0x1e')](_0xb436a2);}return _0x3a0291[_0xaf1f('0x1f')]();};}function saveUpdates(_0xf95df,_0x1c4d74){return function(_0x57cad4){if(_0x57cad4){return _0x57cad4[_0xaf1f('0x20')](_0xf95df)[_0xaf1f('0x21')](function(_0x15f33b){return _0x15f33b;});}return null;};}function removeEntity(_0x4b3373,_0x5d0ecf){return function(_0x47ab12){if(_0x47ab12){return _0x47ab12['destroy']()['then'](function(){_0x4b3373[_0xaf1f('0x16')](0xcc)[_0xaf1f('0x17')]();});}};}function handleEntityNotFound(_0x5659d1,_0x400e75){return function(_0x344454){if(!_0x344454){_0x5659d1['sendStatus'](0x194);}return _0x344454;};}function handleError(_0x1eb42c,_0x3698a6){_0x3698a6=_0x3698a6||0x1f4;return function(_0x4fc963){logger[_0xaf1f('0x22')](_0x4fc963[_0xaf1f('0x23')]);if(_0x4fc963[_0xaf1f('0x24')]){delete _0x4fc963[_0xaf1f('0x24')];}_0x1eb42c[_0xaf1f('0x16')](_0x3698a6)[_0xaf1f('0x25')](_0x4fc963);};}exports[_0xaf1f('0x26')]=function(_0x3cd63e,_0x1af4a0){var _0x245ab3={},_0x92b70d={},_0x4832fe={'count':0x0,'rows':[]};var _0x2cc943=_[_0xaf1f('0x27')](db[_0xaf1f('0x28')][_0xaf1f('0x29')],function(_0x33ed6e){return{'name':_0x33ed6e[_0xaf1f('0x2a')],'type':_0x33ed6e[_0xaf1f('0x2b')]['key']};});_0x92b70d[_0xaf1f('0x2c')]=_[_0xaf1f('0x27')](_0x2cc943,_0xaf1f('0x24'));_0x92b70d[_0xaf1f('0x2d')]=_['keys'](_0x3cd63e[_0xaf1f('0x2d')]);_0x92b70d[_0xaf1f('0x2e')]=_[_0xaf1f('0x2f')](_0x92b70d['model'],_0x92b70d['query']);_0x245ab3[_0xaf1f('0x30')]=_['intersection'](_0x92b70d[_0xaf1f('0x2c')],qs[_0xaf1f('0x31')](_0x3cd63e['query']['fields']));_0x245ab3[_0xaf1f('0x30')]=_0x245ab3[_0xaf1f('0x30')]['length']?_0x245ab3[_0xaf1f('0x30')]:_0x92b70d[_0xaf1f('0x2c')];if(!_0x3cd63e['query'][_0xaf1f('0x32')](_0xaf1f('0x33'))){_0x245ab3[_0xaf1f('0x1a')]=qs[_0xaf1f('0x1a')](_0x3cd63e['query'][_0xaf1f('0x1a')]);_0x245ab3[_0xaf1f('0x1c')]=qs['offset'](_0x3cd63e['query']['offset']);}_0x245ab3[_0xaf1f('0x34')]=qs[_0xaf1f('0x35')](_0x3cd63e[_0xaf1f('0x2d')]['sort']);_0x245ab3['where']=qs[_0xaf1f('0x2e')](_[_0xaf1f('0x36')](_0x3cd63e[_0xaf1f('0x2d')],_0x92b70d['filters']),_0x2cc943);if(_0x3cd63e[_0xaf1f('0x2d')]['filter']){_0x245ab3[_0xaf1f('0x37')]=_[_0xaf1f('0x38')](_0x245ab3[_0xaf1f('0x37')],{'$or':_['map'](_0x2cc943,function(_0x3178fb){if(_0x3178fb[_0xaf1f('0x2b')]!=='VIRTUAL'){var _0x6679e5={};_0x6679e5[_0x3178fb[_0xaf1f('0x24')]]={'$like':'%'+_0x3cd63e['query'][_0xaf1f('0x39')]+'%'};return _0x6679e5;}})});}_0x245ab3=_['merge']({},_0x245ab3,_0x3cd63e[_0xaf1f('0x3a')]);var _0x3f849={'where':_0x245ab3['where']};return db[_0xaf1f('0x28')][_0xaf1f('0x1b')](_0x3f849)['then'](function(_0x1c6275){_0x4832fe[_0xaf1f('0x1b')]=_0x1c6275;if(_0x3cd63e[_0xaf1f('0x2d')][_0xaf1f('0x3b')]){_0x245ab3[_0xaf1f('0x3c')]=[{'all':!![]}];}return db[_0xaf1f('0x28')]['findAll'](_0x245ab3);})[_0xaf1f('0x21')](function(_0x570941){_0x4832fe['rows']=_0x570941;return _0x4832fe;})[_0xaf1f('0x21')](respondWithFilteredResult(_0x1af4a0,_0x245ab3))['catch'](handleError(_0x1af4a0,null));};exports[_0xaf1f('0x3d')]=function(_0x47cba8,_0x21d58d){var _0x319752={'raw':!![],'where':{'id':_0x47cba8['params']['id']}},_0x342ec0={};_0x342ec0['model']=_[_0xaf1f('0x3e')](db[_0xaf1f('0x28')][_0xaf1f('0x29')]);_0x342ec0[_0xaf1f('0x2d')]=_[_0xaf1f('0x3e')](_0x47cba8['query']);_0x342ec0[_0xaf1f('0x2e')]=_[_0xaf1f('0x2f')](_0x342ec0[_0xaf1f('0x2c')],_0x342ec0[_0xaf1f('0x2d')]);_0x319752[_0xaf1f('0x30')]=_[_0xaf1f('0x2f')](_0x342ec0['model'],qs['fields'](_0x47cba8[_0xaf1f('0x2d')][_0xaf1f('0x31')]));_0x319752[_0xaf1f('0x30')]=_0x319752[_0xaf1f('0x30')]['length']?_0x319752[_0xaf1f('0x30')]:_0x342ec0[_0xaf1f('0x2c')];if(_0x47cba8[_0xaf1f('0x2d')]['includeAll']){_0x319752['include']=[{'all':!![]}];}_0x319752=_[_0xaf1f('0x38')]({},_0x319752,_0x47cba8['options']);return db[_0xaf1f('0x28')][_0xaf1f('0x3f')](_0x319752)[_0xaf1f('0x21')](handleEntityNotFound(_0x21d58d,null))[_0xaf1f('0x21')](respondWithResult(_0x21d58d,null))['catch'](handleError(_0x21d58d,null));};exports[_0xaf1f('0x40')]=function(_0x1b9371,_0x38aaf0){return db[_0xaf1f('0x28')][_0xaf1f('0x40')](_0x1b9371[_0xaf1f('0x41')],{})[_0xaf1f('0x21')](respondWithResult(_0x38aaf0,0xc9))['catch'](handleError(_0x38aaf0,null));};exports['update']=function(_0x1d1582,_0x1bde3f){if(_0x1d1582[_0xaf1f('0x41')]['id']){delete _0x1d1582[_0xaf1f('0x41')]['id'];}return db[_0xaf1f('0x28')][_0xaf1f('0x3f')]({'where':{'id':_0x1d1582[_0xaf1f('0x42')]['id']}})['then'](handleEntityNotFound(_0x1bde3f,null))[_0xaf1f('0x21')](saveUpdates(_0x1d1582[_0xaf1f('0x41')],null))[_0xaf1f('0x21')](respondWithResult(_0x1bde3f,null))[_0xaf1f('0x43')](handleError(_0x1bde3f,null));};exports[_0xaf1f('0x44')]=function(_0x41364e,_0x36bd7a){return db[_0xaf1f('0x28')][_0xaf1f('0x3f')]({'where':{'id':_0x41364e[_0xaf1f('0x42')]['id']}})['then'](handleEntityNotFound(_0x36bd7a,null))['then'](removeEntity(_0x36bd7a,null))[_0xaf1f('0x43')](handleError(_0x36bd7a,null));};exports['describe']=function(_0x28c205,_0x3dd4df){return db['JscriptySessionReport'][_0xaf1f('0x45')]()['then'](respondWithResult(_0x3dd4df,null))['catch'](handleError(_0x3dd4df,null));};exports[_0xaf1f('0x46')]=function(_0x46628d,_0x2d188e,_0x32afff){var _0x32066d={'raw':!![],'where':{}};var _0x569043={};var _0x57d01a={'count':0x0,'rows':[]};return db[_0xaf1f('0x28')][_0xaf1f('0x47')]({'where':{'id':_0x46628d['params']['id']}})['then'](handleEntityNotFound(_0x2d188e,null))[_0xaf1f('0x21')](function(_0x1cdfab){if(_0x1cdfab){_0x569043[_0xaf1f('0x2c')]=_['keys'](db['JscriptyQuestionReport'][_0xaf1f('0x29')]);_0x569043[_0xaf1f('0x2d')]=_[_0xaf1f('0x3e')](_0x46628d[_0xaf1f('0x2d')]);_0x569043[_0xaf1f('0x2e')]=_[_0xaf1f('0x2f')](_0x569043['model'],_0x569043[_0xaf1f('0x2d')]);_0x32066d['attributes']=_[_0xaf1f('0x2f')](_0x569043['model'],qs[_0xaf1f('0x31')](_0x46628d['query']['fields']));_0x32066d[_0xaf1f('0x30')]=_0x32066d[_0xaf1f('0x30')][_0xaf1f('0x48')]?_0x32066d[_0xaf1f('0x30')]:_0x569043[_0xaf1f('0x2c')];if(!_0x46628d[_0xaf1f('0x2d')]['hasOwnProperty'](_0xaf1f('0x33'))){_0x32066d['limit']=qs[_0xaf1f('0x1a')](_0x46628d[_0xaf1f('0x2d')][_0xaf1f('0x1a')]);_0x32066d[_0xaf1f('0x1c')]=qs['offset'](_0x46628d[_0xaf1f('0x2d')][_0xaf1f('0x1c')]);}_0x32066d[_0xaf1f('0x34')]=qs[_0xaf1f('0x35')](_0x46628d['query'][_0xaf1f('0x35')]);_0x32066d[_0xaf1f('0x37')]=qs[_0xaf1f('0x2e')](_['pick'](_0x46628d['query'],_0x569043[_0xaf1f('0x2e')]));_0x32066d[_0xaf1f('0x37')]['SessionId']=_0x1cdfab['id'];if(_0x46628d[_0xaf1f('0x2d')][_0xaf1f('0x39')]){_0x32066d[_0xaf1f('0x37')]=_[_0xaf1f('0x38')](_0x32066d[_0xaf1f('0x37')],{'$or':_[_0xaf1f('0x27')](_0x32066d[_0xaf1f('0x30')],function(_0x2d49ea){var _0x59082d={};_0x59082d[_0x2d49ea]={'$like':'%'+_0x46628d[_0xaf1f('0x2d')][_0xaf1f('0x39')]+'%'};return _0x59082d;})});}_0x32066d=_['merge']({},_0x32066d,_0x46628d[_0xaf1f('0x3a')]);return db[_0xaf1f('0x49')]['count']({'where':_0x32066d[_0xaf1f('0x37')]})['then'](function(_0xbcb859){_0x57d01a['count']=_0xbcb859;if(_0x46628d[_0xaf1f('0x2d')]['includeAll']){_0x32066d[_0xaf1f('0x3c')]=[{'all':!![]}];}return db[_0xaf1f('0x49')][_0xaf1f('0x4a')](_0x32066d);})[_0xaf1f('0x21')](function(_0x5a8b5c){_0x57d01a['rows']=_0x5a8b5c;return _0x57d01a;});}})[_0xaf1f('0x21')](respondWithFilteredResult(_0x2d188e,_0x32066d))[_0xaf1f('0x43')](handleError(_0x2d188e,null));}; \ No newline at end of file +var _0x96f2=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','intersection','includeAll','find','create','update','body','params','describe','getQuestions','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x36b2a3,_0x51312a){var _0x291119=function(_0xeb85d5){while(--_0xeb85d5){_0x36b2a3['push'](_0x36b2a3['shift']());}};_0x291119(++_0x51312a);}(_0x96f2,0xb5));var _0x296f=function(_0x34bcee,_0x68d5e0){_0x34bcee=_0x34bcee-0x0;var _0xa3624e=_0x96f2[_0x34bcee];return _0xa3624e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x296f('0x0'));var zipdir=require(_0x296f('0x1'));var jsonpatch=require(_0x296f('0x2'));var rp=require(_0x296f('0x3'));var moment=require(_0x296f('0x4'));var BPromise=require(_0x296f('0x5'));var Mustache=require(_0x296f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x296f('0x7'));var ejs=require(_0x296f('0x8'));var fs=require('fs');var fs_extra=require(_0x296f('0x9'));var _=require(_0x296f('0xa'));var squel=require(_0x296f('0xb'));var crypto=require('crypto');var jsforce=require(_0x296f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x296f('0xd'));var Papa=require(_0x296f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x296f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x296f('0x10'));var logger=require(_0x296f('0x11'))(_0x296f('0x12'));var utils=require(_0x296f('0x13'));var config=require(_0x296f('0x14'));var licenseUtil=require(_0x296f('0x15'));var db=require(_0x296f('0x16'))['db'];function respondWithStatusCode(_0x261de6,_0x49bb54){_0x49bb54=_0x49bb54||0xcc;return function(_0x17a650){if(_0x17a650){return _0x261de6['sendStatus'](_0x49bb54);}return _0x261de6[_0x296f('0x17')](_0x49bb54)[_0x296f('0x18')]();};}function respondWithResult(_0x446048,_0x5f2376){_0x5f2376=_0x5f2376||0xc8;return function(_0x2e43bb){if(_0x2e43bb){return _0x446048[_0x296f('0x17')](_0x5f2376)[_0x296f('0x19')](_0x2e43bb);}};}function respondWithFilteredResult(_0x10da58,_0xdd8162){return function(_0x37ff32){if(_0x37ff32){var _0x3360ca=typeof _0xdd8162[_0x296f('0x1a')]===_0x296f('0x1b')&&typeof _0xdd8162['limit']===_0x296f('0x1b');var _0x2a745a=_0x37ff32[_0x296f('0x1c')];var _0x46e4e1=_0x3360ca?0x0:_0xdd8162[_0x296f('0x1a')];var _0xaa1969=_0x3360ca?_0x37ff32[_0x296f('0x1c')]:_0xdd8162[_0x296f('0x1a')]+_0xdd8162[_0x296f('0x1d')];var _0x283148;if(_0xaa1969>=_0x2a745a){_0xaa1969=_0x2a745a;_0x283148=0xc8;}else{_0x283148=0xce;}_0x10da58[_0x296f('0x17')](_0x283148);return _0x10da58[_0x296f('0x1e')](_0x296f('0x1f'),_0x46e4e1+'-'+_0xaa1969+'/'+_0x2a745a)[_0x296f('0x19')](_0x37ff32);}return null;};}function patchUpdates(_0x22bbd9){return function(_0x43f11c){try{jsonpatch[_0x296f('0x20')](_0x43f11c,_0x22bbd9,!![]);}catch(_0x446645){return BPromise[_0x296f('0x21')](_0x446645);}return _0x43f11c[_0x296f('0x22')]();};}function saveUpdates(_0x3612a5,_0x18a984){return function(_0x3fe972){if(_0x3fe972){return _0x3fe972['update'](_0x3612a5)[_0x296f('0x23')](function(_0x29c57f){return _0x29c57f;});}return null;};}function removeEntity(_0x2c96cc,_0x3f163c){return function(_0x126ebd){if(_0x126ebd){return _0x126ebd[_0x296f('0x24')]()[_0x296f('0x23')](function(){_0x2c96cc[_0x296f('0x17')](0xcc)[_0x296f('0x18')]();});}};}function handleEntityNotFound(_0x14cee9,_0x4297ce){return function(_0x5a32c3){if(!_0x5a32c3){_0x14cee9['sendStatus'](0x194);}return _0x5a32c3;};}function handleError(_0x1303b3,_0x46e475){_0x46e475=_0x46e475||0x1f4;return function(_0x116eab){logger[_0x296f('0x25')](_0x116eab['stack']);if(_0x116eab[_0x296f('0x26')]){delete _0x116eab[_0x296f('0x26')];}_0x1303b3[_0x296f('0x17')](_0x46e475)['send'](_0x116eab);};}exports['index']=function(_0x5a24f9,_0x4f1d85){var _0x3401a6={},_0x50a915={},_0x4cf419={'count':0x0,'rows':[]};var _0xe65d41=_[_0x296f('0x27')](db[_0x296f('0x28')][_0x296f('0x29')],function(_0x289bf0){return{'name':_0x289bf0[_0x296f('0x2a')],'type':_0x289bf0[_0x296f('0x2b')][_0x296f('0x2c')]};});_0x50a915[_0x296f('0x2d')]=_[_0x296f('0x27')](_0xe65d41,_0x296f('0x26'));_0x50a915[_0x296f('0x2e')]=_[_0x296f('0x2f')](_0x5a24f9[_0x296f('0x2e')]);_0x50a915[_0x296f('0x30')]=_['intersection'](_0x50a915[_0x296f('0x2d')],_0x50a915[_0x296f('0x2e')]);_0x3401a6[_0x296f('0x31')]=_['intersection'](_0x50a915[_0x296f('0x2d')],qs[_0x296f('0x32')](_0x5a24f9[_0x296f('0x2e')][_0x296f('0x32')]));_0x3401a6[_0x296f('0x31')]=_0x3401a6[_0x296f('0x31')][_0x296f('0x33')]?_0x3401a6[_0x296f('0x31')]:_0x50a915[_0x296f('0x2d')];if(!_0x5a24f9[_0x296f('0x2e')][_0x296f('0x34')](_0x296f('0x35'))){_0x3401a6['limit']=qs[_0x296f('0x1d')](_0x5a24f9[_0x296f('0x2e')][_0x296f('0x1d')]);_0x3401a6[_0x296f('0x1a')]=qs[_0x296f('0x1a')](_0x5a24f9[_0x296f('0x2e')][_0x296f('0x1a')]);}_0x3401a6[_0x296f('0x36')]=qs[_0x296f('0x37')](_0x5a24f9[_0x296f('0x2e')][_0x296f('0x37')]);_0x3401a6[_0x296f('0x38')]=qs[_0x296f('0x30')](_[_0x296f('0x39')](_0x5a24f9['query'],_0x50a915['filters']),_0xe65d41);if(_0x5a24f9[_0x296f('0x2e')][_0x296f('0x3a')]){_0x3401a6[_0x296f('0x38')]=_[_0x296f('0x3b')](_0x3401a6[_0x296f('0x38')],{'$or':_[_0x296f('0x27')](_0xe65d41,function(_0x154ef7){if(_0x154ef7[_0x296f('0x2b')]!==_0x296f('0x3c')){var _0x15942a={};_0x15942a[_0x154ef7[_0x296f('0x26')]]={'$like':'%'+_0x5a24f9['query'][_0x296f('0x3a')]+'%'};return _0x15942a;}})});}_0x3401a6=_[_0x296f('0x3b')]({},_0x3401a6,_0x5a24f9[_0x296f('0x3d')]);var _0x59b51e={'where':_0x3401a6['where']};return db[_0x296f('0x28')]['count'](_0x59b51e)[_0x296f('0x23')](function(_0x55f1e0){_0x4cf419[_0x296f('0x1c')]=_0x55f1e0;if(_0x5a24f9['query']['includeAll']){_0x3401a6[_0x296f('0x3e')]=[{'all':!![]}];}return db[_0x296f('0x28')][_0x296f('0x3f')](_0x3401a6);})['then'](function(_0x339d99){_0x4cf419[_0x296f('0x40')]=_0x339d99;return _0x4cf419;})[_0x296f('0x23')](respondWithFilteredResult(_0x4f1d85,_0x3401a6))[_0x296f('0x41')](handleError(_0x4f1d85,null));};exports[_0x296f('0x42')]=function(_0x4dc395,_0x496d58){var _0x2a1d61={'raw':!![],'where':{'id':_0x4dc395['params']['id']}},_0x1ca00a={};_0x1ca00a[_0x296f('0x2d')]=_[_0x296f('0x2f')](db[_0x296f('0x28')][_0x296f('0x29')]);_0x1ca00a[_0x296f('0x2e')]=_['keys'](_0x4dc395[_0x296f('0x2e')]);_0x1ca00a[_0x296f('0x30')]=_['intersection'](_0x1ca00a['model'],_0x1ca00a['query']);_0x2a1d61['attributes']=_[_0x296f('0x43')](_0x1ca00a[_0x296f('0x2d')],qs[_0x296f('0x32')](_0x4dc395[_0x296f('0x2e')][_0x296f('0x32')]));_0x2a1d61[_0x296f('0x31')]=_0x2a1d61['attributes'][_0x296f('0x33')]?_0x2a1d61[_0x296f('0x31')]:_0x1ca00a[_0x296f('0x2d')];if(_0x4dc395['query'][_0x296f('0x44')]){_0x2a1d61['include']=[{'all':!![]}];}_0x2a1d61=_[_0x296f('0x3b')]({},_0x2a1d61,_0x4dc395['options']);return db[_0x296f('0x28')][_0x296f('0x45')](_0x2a1d61)['then'](handleEntityNotFound(_0x496d58,null))['then'](respondWithResult(_0x496d58,null))[_0x296f('0x41')](handleError(_0x496d58,null));};exports[_0x296f('0x46')]=function(_0x4ae7f2,_0x18bed6){return db[_0x296f('0x28')][_0x296f('0x46')](_0x4ae7f2['body'],{})['then'](respondWithResult(_0x18bed6,0xc9))[_0x296f('0x41')](handleError(_0x18bed6,null));};exports[_0x296f('0x47')]=function(_0x44cb8c,_0x10a44e){if(_0x44cb8c[_0x296f('0x48')]['id']){delete _0x44cb8c[_0x296f('0x48')]['id'];}return db[_0x296f('0x28')][_0x296f('0x45')]({'where':{'id':_0x44cb8c[_0x296f('0x49')]['id']}})[_0x296f('0x23')](handleEntityNotFound(_0x10a44e,null))[_0x296f('0x23')](saveUpdates(_0x44cb8c[_0x296f('0x48')],null))[_0x296f('0x23')](respondWithResult(_0x10a44e,null))[_0x296f('0x41')](handleError(_0x10a44e,null));};exports[_0x296f('0x24')]=function(_0x164ddd,_0x1b3eac){return db['JscriptySessionReport'][_0x296f('0x45')]({'where':{'id':_0x164ddd[_0x296f('0x49')]['id']}})[_0x296f('0x23')](handleEntityNotFound(_0x1b3eac,null))[_0x296f('0x23')](removeEntity(_0x1b3eac,null))['catch'](handleError(_0x1b3eac,null));};exports[_0x296f('0x4a')]=function(_0x20fea2,_0x48e58c){return db[_0x296f('0x28')][_0x296f('0x4a')]()[_0x296f('0x23')](respondWithResult(_0x48e58c,null))['catch'](handleError(_0x48e58c,null));};exports[_0x296f('0x4b')]=function(_0x4afea8,_0x16146a,_0x20e9b0){var _0x4b8561={'raw':!![],'where':{}};var _0x608ff={};var _0x29da26={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x4afea8[_0x296f('0x49')]['id']}})[_0x296f('0x23')](handleEntityNotFound(_0x16146a,null))[_0x296f('0x23')](function(_0x40ea90){if(_0x40ea90){_0x608ff[_0x296f('0x2d')]=_['keys'](db['JscriptyQuestionReport'][_0x296f('0x29')]);_0x608ff[_0x296f('0x2e')]=_[_0x296f('0x2f')](_0x4afea8['query']);_0x608ff['filters']=_[_0x296f('0x43')](_0x608ff['model'],_0x608ff[_0x296f('0x2e')]);_0x4b8561[_0x296f('0x31')]=_[_0x296f('0x43')](_0x608ff['model'],qs[_0x296f('0x32')](_0x4afea8['query'][_0x296f('0x32')]));_0x4b8561[_0x296f('0x31')]=_0x4b8561[_0x296f('0x31')][_0x296f('0x33')]?_0x4b8561[_0x296f('0x31')]:_0x608ff[_0x296f('0x2d')];if(!_0x4afea8[_0x296f('0x2e')][_0x296f('0x34')](_0x296f('0x35'))){_0x4b8561[_0x296f('0x1d')]=qs['limit'](_0x4afea8['query'][_0x296f('0x1d')]);_0x4b8561[_0x296f('0x1a')]=qs[_0x296f('0x1a')](_0x4afea8[_0x296f('0x2e')][_0x296f('0x1a')]);}_0x4b8561['order']=qs[_0x296f('0x37')](_0x4afea8[_0x296f('0x2e')][_0x296f('0x37')]);_0x4b8561['where']=qs['filters'](_['pick'](_0x4afea8[_0x296f('0x2e')],_0x608ff[_0x296f('0x30')]));_0x4b8561[_0x296f('0x38')]['SessionId']=_0x40ea90['id'];if(_0x4afea8[_0x296f('0x2e')][_0x296f('0x3a')]){_0x4b8561[_0x296f('0x38')]=_[_0x296f('0x3b')](_0x4b8561[_0x296f('0x38')],{'$or':_[_0x296f('0x27')](_0x4b8561[_0x296f('0x31')],function(_0x4e542a){var _0x18453b={};_0x18453b[_0x4e542a]={'$like':'%'+_0x4afea8[_0x296f('0x2e')][_0x296f('0x3a')]+'%'};return _0x18453b;})});}_0x4b8561=_[_0x296f('0x3b')]({},_0x4b8561,_0x4afea8['options']);return db['JscriptyQuestionReport'][_0x296f('0x1c')]({'where':_0x4b8561[_0x296f('0x38')]})[_0x296f('0x23')](function(_0x1eedb1){_0x29da26[_0x296f('0x1c')]=_0x1eedb1;if(_0x4afea8[_0x296f('0x2e')][_0x296f('0x44')]){_0x4b8561[_0x296f('0x3e')]=[{'all':!![]}];}return db[_0x296f('0x4c')][_0x296f('0x3f')](_0x4b8561);})[_0x296f('0x23')](function(_0x3d3fc4){_0x29da26[_0x296f('0x40')]=_0x3d3fc4;return _0x29da26;});}})[_0x296f('0x23')](respondWithFilteredResult(_0x16146a,_0x4b8561))[_0x296f('0x41')](handleError(_0x16146a,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 6a0433a..4c47af5 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 _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xafc4,0x69));var _0x4afc=function(_0x25f115,_0x123022){_0x25f115=_0x25f115-0x0;var _0x1eda6b=_0xafc4[_0x25f115];return _0x1eda6b;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eea=['exports','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x15b36f,_0x514961){var _0x5dffdd=function(_0x5931e3){while(--_0x5931e3){_0x15b36f['push'](_0x15b36f['shift']());}};_0x5dffdd(++_0x514961);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x415773,_0x64f46c){_0x415773=_0x415773-0x0;var _0x7d2998=_0x3eea[_0x415773];return _0x7d2998;};'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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 0a4fc78..f737190 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 _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x251f42,_0x45cef2){var _0x406278=function(_0x2e1bbd){while(--_0x2e1bbd){_0x251f42['push'](_0x251f42['shift']());}};_0x406278(++_0x45cef2);}(_0x4c60,0xc1));var _0x04c6=function(_0x1c0b36,_0x45ee6b){_0x1c0b36=_0x1c0b36-0x0;var _0x598115=_0x4c60[_0x1c0b36];return _0x598115;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});} \ No newline at end of file +var _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x5d4aff,_0x4d58e9){var _0x28ef30=function(_0x3a5c03){while(--_0x3a5c03){_0x5d4aff['push'](_0x5d4aff['shift']());}};_0x28ef30(++_0x4d58e9);}(_0xdf55,0x83));var _0x5df5=function(_0x16b334,_0x58bd7f){_0x16b334=_0x16b334-0x0;var _0x54aff2=_0xdf55[_0x16b334];return _0x54aff2;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7081a7b..c19b2c1 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 _0x2029=['./license.controller','get','put','isAuthenticated','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2029,0x8e));var _0x9202=function(_0x255318,_0x40030b){_0x255318=_0x255318-0x0;var _0x46ed11=_0x2029[_0x255318];return _0x46ed11;};'use strict';var multer=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var path=require(_0x9202('0x2'));var timeout=require(_0x9202('0x3'));var express=require(_0x9202('0x4'));var router=express[_0x9202('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9202('0x6'));var config=require(_0x9202('0x7'));var controller=require(_0x9202('0x8'));router[_0x9202('0x9')]('/',controller['index']);router[_0x9202('0xa')]('/:id',auth[_0x9202('0xb')](),controller['update']);router[_0x9202('0x9')](_0x9202('0xc'),auth[_0x9202('0xb')](),controller[_0x9202('0xd')]);module[_0x9202('0xe')]=router; \ No newline at end of file +var _0x9f7c=['/:id','update','get','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','put'];(function(_0x2e12e4,_0x57ed3e){var _0x1ad7ff=function(_0x17fbdb){while(--_0x17fbdb){_0x2e12e4['push'](_0x2e12e4['shift']());}};_0x1ad7ff(++_0x57ed3e);}(_0x9f7c,0x1ba));var _0xc9f7=function(_0x25fb24,_0x432488){_0x25fb24=_0x25fb24-0x0;var _0x3f044c=_0x9f7c[_0x25fb24];return _0x3f044c;};'use strict';var multer=require(_0xc9f7('0x0'));var util=require(_0xc9f7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc9f7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc9f7('0x3'));var interaction=require(_0xc9f7('0x4'));var config=require(_0xc9f7('0x5'));var controller=require('./license.controller');router['get']('/',controller[_0xc9f7('0x6')]);router[_0xc9f7('0x7')](_0xc9f7('0x8'),auth['isAuthenticated'](),controller[_0xc9f7('0x9')]);router[_0xc9f7('0xa')](_0xc9f7('0xb'),auth[_0xc9f7('0xc')](),controller[_0xc9f7('0xd')]);module[_0xc9f7('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 1a88170..b504f1d 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 _0xc741=['sequelize','TEXT','INTEGER'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc741,0x1ef));var _0x1c74=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc741[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0x1c74('0x0'));module['exports']={'license':{'type':Sequelize[_0x1c74('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x1c74('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa669=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x233e9e,_0xf5ce1d){var _0x1a4aba=function(_0x586e6b){while(--_0x586e6b){_0x233e9e['push'](_0x233e9e['shift']());}};_0x1a4aba(++_0xf5ce1d);}(_0xa669,0x161));var _0x9a66=function(_0x17655f,_0x4130bb){_0x17655f=_0x17655f-0x0;var _0x50330f=_0xa669[_0x17655f];return _0x50330f;};'use strict';var Sequelize=require(_0x9a66('0x0'));module[_0x9a66('0x1')]={'license':{'type':Sequelize[_0x9a66('0x2')]},'data1':{'type':Sequelize[_0x9a66('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x9a66('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 a1dae91..8fad1ff 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 _0xfa7a=['text/plain','download','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','error','name','send','index','model','License','rawAttributes','query','intersection','fields','attributes','length','options','getLicense','body','find','params','get','checkLicense','key','catch','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type'];(function(_0x143ac0,_0x5242b1){var _0x590ebb=function(_0x2649e9){while(--_0x2649e9){_0x143ac0['push'](_0x143ac0['shift']());}};_0x590ebb(++_0x5242b1);}(_0xfa7a,0x11a));var _0xafa7=function(_0xfed0b8,_0x4cb13f){_0xfed0b8=_0xfed0b8-0x0;var _0x1f2000=_0xfa7a[_0xfed0b8];return _0x1f2000;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xafa7('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafa7('0x1'));var moment=require('moment');var BPromise=require(_0xafa7('0x2'));var Mustache=require(_0xafa7('0x3'));var util=require(_0xafa7('0x4'));var path=require(_0xafa7('0x5'));var sox=require(_0xafa7('0x6'));var csv=require('to-csv');var ejs=require(_0xafa7('0x7'));var fs=require('fs');var fs_extra=require(_0xafa7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xafa7('0x9'));var jsforce=require(_0xafa7('0xa'));var deskjs=require(_0xafa7('0xb'));var toCsv=require(_0xafa7('0xc'));var querystring=require(_0xafa7('0xd'));var Papa=require(_0xafa7('0xe'));var Redis=require('ioredis');var authService=require(_0xafa7('0xf'));var qs=require(_0xafa7('0x10'));var as=require(_0xafa7('0x11'));var hardwareService=require(_0xafa7('0x12'));var logger=require(_0xafa7('0x13'))(_0xafa7('0x14'));var utils=require(_0xafa7('0x15'));var config=require(_0xafa7('0x16'));var licenseUtil=require(_0xafa7('0x17'));var db=require(_0xafa7('0x18'))['db'];function respondWithStatusCode(_0x4796f1,_0x3e6e43){_0x3e6e43=_0x3e6e43||0xcc;return function(_0x4c0a42){if(_0x4c0a42){return _0x4796f1[_0xafa7('0x19')](_0x3e6e43);}return _0x4796f1[_0xafa7('0x1a')](_0x3e6e43)[_0xafa7('0x1b')]();};}function respondWithResult(_0xfb4c82,_0x4cc77c){_0x4cc77c=_0x4cc77c||0xc8;return function(_0x496753){if(_0x496753){return _0xfb4c82[_0xafa7('0x1a')](_0x4cc77c)[_0xafa7('0x1c')](_0x496753);}};}function respondWithFilteredResult(_0x1d10fa,_0x2a0da3){return function(_0x3be879){if(_0x3be879){var _0x44c3db=typeof _0x2a0da3[_0xafa7('0x1d')]==='undefined'&&typeof _0x2a0da3['limit']===_0xafa7('0x1e');var _0x126a8e=_0x3be879['count'];var _0x20c82a=_0x44c3db?0x0:_0x2a0da3[_0xafa7('0x1d')];var _0x180250=_0x44c3db?_0x3be879[_0xafa7('0x1f')]:_0x2a0da3[_0xafa7('0x1d')]+_0x2a0da3['limit'];var _0x1b0607;if(_0x180250>=_0x126a8e){_0x180250=_0x126a8e;_0x1b0607=0xc8;}else{_0x1b0607=0xce;}_0x1d10fa['status'](_0x1b0607);return _0x1d10fa['set'](_0xafa7('0x20'),_0x20c82a+'-'+_0x180250+'/'+_0x126a8e)['json'](_0x3be879);}return null;};}function patchUpdates(_0x4dfc49){return function(_0x3ebd69){try{jsonpatch[_0xafa7('0x21')](_0x3ebd69,_0x4dfc49,!![]);}catch(_0x146d59){return BPromise[_0xafa7('0x22')](_0x146d59);}return _0x3ebd69[_0xafa7('0x23')]();};}function saveUpdates(_0x1d7a69,_0x7bdc35){return function(_0x569604){if(_0x569604){return _0x569604[_0xafa7('0x24')](_0x1d7a69)[_0xafa7('0x25')](function(_0x501062){return _0x501062;});}return null;};}function removeEntity(_0x38948f,_0x44f2df){return function(_0x2969bd){if(_0x2969bd){return _0x2969bd['destroy']()[_0xafa7('0x25')](function(){_0x38948f[_0xafa7('0x1a')](0xcc)[_0xafa7('0x1b')]();});}};}function handleEntityNotFound(_0x5e8879,_0x2668e5){return function(_0x28b58b){if(!_0x28b58b){_0x5e8879[_0xafa7('0x19')](0x194);}return _0x28b58b;};}function handleError(_0x200b84,_0x27ad59){_0x27ad59=_0x27ad59||0x1f4;return function(_0x4677bd){logger[_0xafa7('0x26')](_0x4677bd['stack']);if(_0x4677bd[_0xafa7('0x27')]){delete _0x4677bd[_0xafa7('0x27')];}_0x200b84[_0xafa7('0x1a')](_0x27ad59)[_0xafa7('0x28')](_0x4677bd);};}var utilLicense=require(_0xafa7('0x17'));exports[_0xafa7('0x29')]=function(_0x537615,_0x4bb77b){var _0x5bd36d={'raw':!![],'where':{'id':0x1}},_0x33383d={};_0x33383d[_0xafa7('0x2a')]=_['keys'](db[_0xafa7('0x2b')][_0xafa7('0x2c')]);_0x33383d[_0xafa7('0x2d')]=_['keys'](_0x537615[_0xafa7('0x2d')]);_0x33383d['filters']=_[_0xafa7('0x2e')](_0x33383d['model'],_0x33383d[_0xafa7('0x2d')]);_0x5bd36d['attributes']=_[_0xafa7('0x2e')](_0x33383d['model'],qs['fields'](_0x537615[_0xafa7('0x2d')][_0xafa7('0x2f')]));_0x5bd36d[_0xafa7('0x30')]=_0x5bd36d[_0xafa7('0x30')][_0xafa7('0x31')]?_0x5bd36d[_0xafa7('0x30')]:_0x33383d['model'];_0x5bd36d=_['merge']({},_0x5bd36d,_0x537615[_0xafa7('0x32')]);return utilLicense[_0xafa7('0x33')](_0x5bd36d)['then'](respondWithResult(_0x4bb77b,null))['catch'](handleError(_0x4bb77b,null));};exports[_0xafa7('0x24')]=function(_0x4c8c80,_0x5be2f5){if(_0x4c8c80[_0xafa7('0x34')]['id']){delete _0x4c8c80['body']['id'];}return db['License'][_0xafa7('0x35')]({'where':{'id':_0x4c8c80[_0xafa7('0x36')]['id']}})[_0xafa7('0x25')](handleEntityNotFound(_0x5be2f5,null))[_0xafa7('0x25')](function(_0x58bb52){var _0x2c65d0=_0x58bb52[_0xafa7('0x37')]({'plain':!![]});return utilLicense[_0xafa7('0x38')](_0x2c65d0,_0x4c8c80[_0xafa7('0x34')][_0xafa7('0x39')]);})[_0xafa7('0x25')](function(_0x6bad62){if(!_0x6bad62['demo']){return saveUpdates(_0x4c8c80['body'],null);}return _0x6bad62;})[_0xafa7('0x25')](respondWithResult(_0x5be2f5,null))[_0xafa7('0x3a')](handleError(_0x5be2f5,null));};exports['downloadLogFile']=function(_0x1994ab,_0xa75d26){var _0x47d786='license-info.log';var _0x4c3358=path[_0xafa7('0x3b')](_0xafa7('0x3c'),_0xafa7('0x3d'),_0xafa7('0x3e'),_0x47d786);_0xa75d26[_0xafa7('0x3f')](_0xafa7('0x40'),_0xafa7('0x41')+_0x47d786);_0xa75d26[_0xafa7('0x42')](_0xafa7('0x43'),_0xafa7('0x44'));_0xa75d26[_0xafa7('0x45')](_0x4c3358);}; \ No newline at end of file +var _0xf32d=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','error','stack','name','send','index','keys','rawAttributes','query','filters','intersection','fields','attributes','length','model','merge','options','getLicense','then','body','License','params','get','checkLicense','key','demo','catch','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x41462a,_0x146947){var _0xa4642a=function(_0x1f6053){while(--_0x1f6053){_0x41462a['push'](_0x41462a['shift']());}};_0xa4642a(++_0x146947);}(_0xf32d,0x8a));var _0xdf32=function(_0x4cc39c,_0x456f4b){_0x4cc39c=_0x4cc39c-0x0;var _0x7b0c05=_0xf32d[_0x4cc39c];return _0x7b0c05;};'use strict';var emlformat=require(_0xdf32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf32('0x2'));var moment=require(_0xdf32('0x3'));var BPromise=require(_0xdf32('0x4'));var Mustache=require(_0xdf32('0x5'));var util=require(_0xdf32('0x6'));var path=require(_0xdf32('0x7'));var sox=require(_0xdf32('0x8'));var csv=require(_0xdf32('0x9'));var ejs=require(_0xdf32('0xa'));var fs=require('fs');var fs_extra=require(_0xdf32('0xb'));var _=require(_0xdf32('0xc'));var squel=require(_0xdf32('0xd'));var crypto=require('crypto');var jsforce=require(_0xdf32('0xe'));var deskjs=require(_0xdf32('0xf'));var toCsv=require(_0xdf32('0x9'));var querystring=require(_0xdf32('0x10'));var Papa=require(_0xdf32('0x11'));var Redis=require(_0xdf32('0x12'));var authService=require(_0xdf32('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdf32('0x14'));var hardwareService=require(_0xdf32('0x15'));var logger=require(_0xdf32('0x16'))(_0xdf32('0x17'));var utils=require(_0xdf32('0x18'));var config=require(_0xdf32('0x19'));var licenseUtil=require(_0xdf32('0x1a'));var db=require(_0xdf32('0x1b'))['db'];function respondWithStatusCode(_0x30a579,_0x2c7895){_0x2c7895=_0x2c7895||0xcc;return function(_0x1d78b6){if(_0x1d78b6){return _0x30a579[_0xdf32('0x1c')](_0x2c7895);}return _0x30a579[_0xdf32('0x1d')](_0x2c7895)[_0xdf32('0x1e')]();};}function respondWithResult(_0x313664,_0xeecfce){_0xeecfce=_0xeecfce||0xc8;return function(_0x576c80){if(_0x576c80){return _0x313664[_0xdf32('0x1d')](_0xeecfce)[_0xdf32('0x1f')](_0x576c80);}};}function respondWithFilteredResult(_0x4ceaf1,_0x5170c8){return function(_0x1073b2){if(_0x1073b2){var _0x56a622=typeof _0x5170c8[_0xdf32('0x20')]===_0xdf32('0x21')&&typeof _0x5170c8[_0xdf32('0x22')]==='undefined';var _0x2b2577=_0x1073b2['count'];var _0x2bb33a=_0x56a622?0x0:_0x5170c8[_0xdf32('0x20')];var _0x1c9595=_0x56a622?_0x1073b2[_0xdf32('0x23')]:_0x5170c8[_0xdf32('0x20')]+_0x5170c8[_0xdf32('0x22')];var _0x1781c1;if(_0x1c9595>=_0x2b2577){_0x1c9595=_0x2b2577;_0x1781c1=0xc8;}else{_0x1781c1=0xce;}_0x4ceaf1[_0xdf32('0x1d')](_0x1781c1);return _0x4ceaf1['set'](_0xdf32('0x24'),_0x2bb33a+'-'+_0x1c9595+'/'+_0x2b2577)[_0xdf32('0x1f')](_0x1073b2);}return null;};}function patchUpdates(_0x275ccc){return function(_0x5e6f5e){try{jsonpatch['apply'](_0x5e6f5e,_0x275ccc,!![]);}catch(_0x3d7417){return BPromise[_0xdf32('0x25')](_0x3d7417);}return _0x5e6f5e[_0xdf32('0x26')]();};}function saveUpdates(_0x14b510,_0x49e483){return function(_0x575f18){if(_0x575f18){return _0x575f18[_0xdf32('0x27')](_0x14b510)['then'](function(_0x46ec6c){return _0x46ec6c;});}return null;};}function removeEntity(_0x5b4813,_0x16833e){return function(_0x1758f4){if(_0x1758f4){return _0x1758f4[_0xdf32('0x28')]()['then'](function(){_0x5b4813[_0xdf32('0x1d')](0xcc)[_0xdf32('0x1e')]();});}};}function handleEntityNotFound(_0x345843,_0xa15545){return function(_0x85c3f4){if(!_0x85c3f4){_0x345843['sendStatus'](0x194);}return _0x85c3f4;};}function handleError(_0x67c1b9,_0x174737){_0x174737=_0x174737||0x1f4;return function(_0x38fd38){logger[_0xdf32('0x29')](_0x38fd38[_0xdf32('0x2a')]);if(_0x38fd38[_0xdf32('0x2b')]){delete _0x38fd38[_0xdf32('0x2b')];}_0x67c1b9[_0xdf32('0x1d')](_0x174737)[_0xdf32('0x2c')](_0x38fd38);};}var utilLicense=require(_0xdf32('0x1a'));exports[_0xdf32('0x2d')]=function(_0x1b9dee,_0x29690b){var _0x31a402={'raw':!![],'where':{'id':0x1}},_0x5ded2d={};_0x5ded2d['model']=_[_0xdf32('0x2e')](db['License'][_0xdf32('0x2f')]);_0x5ded2d[_0xdf32('0x30')]=_[_0xdf32('0x2e')](_0x1b9dee[_0xdf32('0x30')]);_0x5ded2d[_0xdf32('0x31')]=_['intersection'](_0x5ded2d['model'],_0x5ded2d[_0xdf32('0x30')]);_0x31a402['attributes']=_[_0xdf32('0x32')](_0x5ded2d['model'],qs[_0xdf32('0x33')](_0x1b9dee[_0xdf32('0x30')][_0xdf32('0x33')]));_0x31a402[_0xdf32('0x34')]=_0x31a402[_0xdf32('0x34')][_0xdf32('0x35')]?_0x31a402[_0xdf32('0x34')]:_0x5ded2d[_0xdf32('0x36')];_0x31a402=_[_0xdf32('0x37')]({},_0x31a402,_0x1b9dee[_0xdf32('0x38')]);return utilLicense[_0xdf32('0x39')](_0x31a402)[_0xdf32('0x3a')](respondWithResult(_0x29690b,null))['catch'](handleError(_0x29690b,null));};exports[_0xdf32('0x27')]=function(_0x271000,_0x3e0cc5){if(_0x271000[_0xdf32('0x3b')]['id']){delete _0x271000[_0xdf32('0x3b')]['id'];}return db[_0xdf32('0x3c')]['find']({'where':{'id':_0x271000[_0xdf32('0x3d')]['id']}})[_0xdf32('0x3a')](handleEntityNotFound(_0x3e0cc5,null))[_0xdf32('0x3a')](function(_0x2f7803){var _0x337af9=_0x2f7803[_0xdf32('0x3e')]({'plain':!![]});return utilLicense[_0xdf32('0x3f')](_0x337af9,_0x271000[_0xdf32('0x3b')][_0xdf32('0x40')]);})[_0xdf32('0x3a')](function(_0x2ded81){if(!_0x2ded81[_0xdf32('0x41')]){return saveUpdates(_0x271000[_0xdf32('0x3b')],null);}return _0x2ded81;})[_0xdf32('0x3a')](respondWithResult(_0x3e0cc5,null))[_0xdf32('0x42')](handleError(_0x3e0cc5,null));};exports[_0xdf32('0x43')]=function(_0x3af8a1,_0x370601){var _0x47e726='license-info.log';var _0x6a3b0a=path[_0xdf32('0x44')](_0xdf32('0x45'),_0xdf32('0x46'),_0xdf32('0x47'),_0x47e726);_0x370601[_0xdf32('0x48')](_0xdf32('0x49'),_0xdf32('0x4a')+_0x47e726);_0x370601[_0xdf32('0x4b')](_0xdf32('0x4c'),_0xdf32('0x4d'));_0x370601['download'](_0x6a3b0a);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 8246db5..74d5ced 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 _0x900c=['define','license','lodash','../../config/logger','api','moment','bluebird','../../config/environment','exports'];(function(_0x3873ab,_0x152776){var _0x42f6ed=function(_0x189425){while(--_0x189425){_0x3873ab['push'](_0x3873ab['shift']());}};_0x42f6ed(++_0x152776);}(_0x900c,0x134));var _0xc900=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x900c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc900('0x0'));var util=require('util');var logger=require(_0xc900('0x1'))(_0xc900('0x2'));var moment=require(_0xc900('0x3'));var BPromise=require(_0xc900('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc900('0x5'));var attributes=require('./license.attributes');module[_0xc900('0x6')]=function(_0x430f53,_0x1838fe){return _0x430f53[_0xc900('0x7')]('License',attributes,{'tableName':_0xc900('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c47=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','License','license'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c47,0x12c));var _0x77c4=function(_0x37aefd,_0x11670c){_0x37aefd=_0x37aefd-0x0;var _0x3afb9d=_0x7c47[_0x37aefd];return _0x3afb9d;};'use strict';var _=require('lodash');var util=require(_0x77c4('0x0'));var logger=require(_0x77c4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x77c4('0x2'));var rp=require(_0x77c4('0x3'));var fs=require('fs');var path=require(_0x77c4('0x4'));var rimraf=require(_0x77c4('0x5'));var config=require(_0x77c4('0x6'));var attributes=require('./license.attributes');module[_0x77c4('0x7')]=function(_0x52b0c5,_0xecb17d){return _0x52b0c5['define'](_0x77c4('0x8'),attributes,{'tableName':_0x77c4('0x9'),'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 8fbf962..f6e7b02 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 _0x424d=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x97ac1,_0x3478fe){var _0x12673e=function(_0x1d9c97){while(--_0x1d9c97){_0x97ac1['push'](_0x97ac1['shift']());}};_0x12673e(++_0x3478fe);}(_0x424d,0x9b));var _0xd424=function(_0x523615,_0x522ee8){_0x523615=_0x523615-0x0;var _0x9863eb=_0x424d[_0x523615];return _0x9863eb;};'use strict';var _=require(_0xd424('0x0'));var util=require(_0xd424('0x1'));var moment=require(_0xd424('0x2'));var BPromise=require(_0xd424('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd424('0x4'));var db=require(_0xd424('0x5'))['db'];var utils=require(_0xd424('0x6'));var logger=require(_0xd424('0x7'))(_0xd424('0x8'));var config=require('../../config/environment');var jayson=require(_0xd424('0x9'));var client=jayson[_0xd424('0xa')][_0xd424('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc55073,_0x2abcab,_0x3f5323){return new BPromise(function(_0x347c31,_0x29fb2c){return client[_0xd424('0xc')](_0xc55073,_0x3f5323)[_0xd424('0xd')](function(_0x21a7b2){logger['info']('License,\x20%s,\x20%s',_0x2abcab,_0xd424('0xe'));logger['debug'](_0xd424('0xf'),_0x2abcab,_0xd424('0xe'),JSON[_0xd424('0x10')](_0x21a7b2));if(_0x21a7b2[_0xd424('0x11')]){if(_0x21a7b2[_0xd424('0x11')][_0xd424('0x12')]===0x1f4){logger[_0xd424('0x11')](_0xd424('0x13'),_0x2abcab,_0x21a7b2[_0xd424('0x11')][_0xd424('0x14')]);return _0x29fb2c(_0x21a7b2[_0xd424('0x11')][_0xd424('0x14')]);}logger[_0xd424('0x11')](_0xd424('0x13'),_0x2abcab,_0x21a7b2[_0xd424('0x11')][_0xd424('0x14')]);return _0x347c31(_0x21a7b2[_0xd424('0x11')][_0xd424('0x14')]);}else{logger[_0xd424('0x15')](_0xd424('0x13'),_0x2abcab,'request\x20sent');_0x347c31(_0x21a7b2[_0xd424('0x16')][_0xd424('0x14')]);}})['catch'](function(_0x2be3d2){logger[_0xd424('0x11')](_0xd424('0x13'),_0x2abcab,_0x2be3d2);_0x29fb2c(_0x2be3d2);});});} \ No newline at end of file +var _0x3eab=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x743701,_0x3e67bb){var _0x5a141d=function(_0x4b198d){while(--_0x4b198d){_0x743701['push'](_0x743701['shift']());}};_0x5a141d(++_0x3e67bb);}(_0x3eab,0x1bc));var _0xb3ea=function(_0x247301,_0x153f6c){_0x247301=_0x247301-0x0;var _0x3390e6=_0x3eab[_0x247301];return _0x3390e6;};'use strict';var _=require(_0xb3ea('0x0'));var util=require(_0xb3ea('0x1'));var moment=require(_0xb3ea('0x2'));var BPromise=require(_0xb3ea('0x3'));var rs=require(_0xb3ea('0x4'));var fs=require('fs');var Redis=require(_0xb3ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3ea('0x6'));var logger=require('../../config/logger')(_0xb3ea('0x7'));var config=require(_0xb3ea('0x8'));var jayson=require(_0xb3ea('0x9'));var client=jayson['client'][_0xb3ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x191564,_0x496976,_0xaf3cbd){return new BPromise(function(_0x2ce321,_0x508703){return client['request'](_0x191564,_0xaf3cbd)[_0xb3ea('0xb')](function(_0xba5333){logger[_0xb3ea('0xc')](_0xb3ea('0xd'),_0x496976,_0xb3ea('0xe'));logger[_0xb3ea('0xf')](_0xb3ea('0x10'),_0x496976,_0xb3ea('0xe'),JSON[_0xb3ea('0x11')](_0xba5333));if(_0xba5333[_0xb3ea('0x12')]){if(_0xba5333[_0xb3ea('0x12')][_0xb3ea('0x13')]===0x1f4){logger[_0xb3ea('0x12')]('License,\x20%s,\x20%s',_0x496976,_0xba5333['error'][_0xb3ea('0x14')]);return _0x508703(_0xba5333[_0xb3ea('0x12')][_0xb3ea('0x14')]);}logger['error'](_0xb3ea('0xd'),_0x496976,_0xba5333[_0xb3ea('0x12')][_0xb3ea('0x14')]);return _0x2ce321(_0xba5333['error']['message']);}else{logger[_0xb3ea('0xc')](_0xb3ea('0xd'),_0x496976,_0xb3ea('0xe'));_0x2ce321(_0xba5333[_0xb3ea('0x15')][_0xb3ea('0x14')]);}})['catch'](function(_0x56eccd){logger[_0xb3ea('0x12')](_0xb3ea('0xd'),_0x496976,_0x56eccd);_0x508703(_0x56eccd);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c2b83dc..e34633d 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 _0xe450=['/:id/dispositions','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post'];(function(_0x47c071,_0x6c4ab7){var _0x1de017=function(_0x580473){while(--_0x580473){_0x47c071['push'](_0x47c071['shift']());}};_0x1de017(++_0x6c4ab7);}(_0xe450,0x168));var _0x0e45=function(_0x44dd32,_0x205f75){_0x44dd32=_0x44dd32-0x0;var _0x463d74=_0xe450[_0x44dd32];return _0x463d74;};'use strict';var multer=require(_0x0e45('0x0'));var util=require('util');var path=require(_0x0e45('0x1'));var timeout=require(_0x0e45('0x2'));var express=require(_0x0e45('0x3'));var router=express[_0x0e45('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0e45('0x5'));var config=require('../../config/environment');var controller=require(_0x0e45('0x6'));router[_0x0e45('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0e45('0x7')](_0x0e45('0x8'),auth[_0x0e45('0x9')](),controller[_0x0e45('0xa')]);router['get'](_0x0e45('0xb'),auth[_0x0e45('0x9')](),controller[_0x0e45('0xc')]);router[_0x0e45('0x7')]('/:id/dispositions',auth[_0x0e45('0x9')](),controller[_0x0e45('0xd')]);router[_0x0e45('0x7')]('/:id/canned_answers',auth[_0x0e45('0x9')](),controller['getAnswers']);router[_0x0e45('0x7')](_0x0e45('0xe'),auth[_0x0e45('0x9')](),controller[_0x0e45('0xf')]);router[_0x0e45('0x7')](_0x0e45('0x10'),auth['isAuthenticated'](),controller[_0x0e45('0x11')]);router[_0x0e45('0x7')](_0x0e45('0x12'),auth[_0x0e45('0x9')](),controller['getInteractions']);router[_0x0e45('0x7')](_0x0e45('0x13'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x0e45('0x14'),auth[_0x0e45('0x9')](),controller[_0x0e45('0x15')]);router['get'](_0x0e45('0x16'),auth['isAuthenticated'](),controller[_0x0e45('0x17')]);router[_0x0e45('0x7')](_0x0e45('0x18'),auth[_0x0e45('0x9')](),controller[_0x0e45('0x19')]);router[_0x0e45('0x1a')](_0x0e45('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x0e45('0x1a')]('/:id/canned_answers',auth[_0x0e45('0x9')](),controller[_0x0e45('0x1c')]);router[_0x0e45('0x1a')]('/',auth[_0x0e45('0x9')](),controller[_0x0e45('0x1d')]);router[_0x0e45('0x1a')](_0x0e45('0xe'),auth[_0x0e45('0x9')](),controller[_0x0e45('0x1e')]);router[_0x0e45('0x1a')]('/:id/out_servers',auth[_0x0e45('0x9')](),controller[_0x0e45('0x1f')]);router[_0x0e45('0x1a')](_0x0e45('0x12'),auth[_0x0e45('0x9')](),controller[_0x0e45('0x20')]);router['post'](_0x0e45('0x13'),auth[_0x0e45('0x9')](),controller[_0x0e45('0x21')]);router[_0x0e45('0x1a')](_0x0e45('0x22'),auth['isAuthenticated'](),controller[_0x0e45('0x23')]);router[_0x0e45('0x1a')](_0x0e45('0x18'),auth[_0x0e45('0x9')](),controller[_0x0e45('0x24')]);router['put'](_0x0e45('0xb'),auth[_0x0e45('0x9')](),controller['update']);router[_0x0e45('0x25')](_0x0e45('0x1b'),auth['isAuthenticated'](),controller[_0x0e45('0x26')]);router[_0x0e45('0x25')]('/:id/canned_answers',auth[_0x0e45('0x9')](),controller['removeAnswers']);router[_0x0e45('0x25')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0e45('0x27')]);router[_0x0e45('0x25')](_0x0e45('0x10'),auth[_0x0e45('0x9')](),controller[_0x0e45('0x28')]);router['delete'](_0x0e45('0xb'),auth[_0x0e45('0x9')](),controller['destroy']);router['delete'](_0x0e45('0x18'),auth['isAuthenticated'](),controller[_0x0e45('0x29')]);module[_0x0e45('0x2a')]=router; \ No newline at end of file +var _0xd9ec=['removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','get','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeAnswers','removeImap'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd9ec,0xee));var _0xcd9e=function(_0x5314f1,_0x2d4dc6){_0x5314f1=_0x5314f1-0x0;var _0x3d5023=_0xd9ec[_0x5314f1];return _0x3d5023;};'use strict';var multer=require(_0xcd9e('0x0'));var util=require(_0xcd9e('0x1'));var path=require(_0xcd9e('0x2'));var timeout=require(_0xcd9e('0x3'));var express=require(_0xcd9e('0x4'));var router=express['Router']();var fs_extra=require(_0xcd9e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcd9e('0x6'));var config=require(_0xcd9e('0x7'));var controller=require(_0xcd9e('0x8'));router['get']('/',auth[_0xcd9e('0x9')](),controller['index']);router[_0xcd9e('0xa')](_0xcd9e('0xb'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcd9e('0xd')]);router[_0xcd9e('0xa')](_0xcd9e('0xe'),auth[_0xcd9e('0x9')](),controller['getDispositions']);router[_0xcd9e('0xa')](_0xcd9e('0xf'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x10')]);router[_0xcd9e('0xa')](_0xcd9e('0x11'),auth[_0xcd9e('0x9')](),controller['getImap']);router[_0xcd9e('0xa')](_0xcd9e('0x12'),auth[_0xcd9e('0x9')](),controller['getSmtp']);router[_0xcd9e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xcd9e('0x13')]);router[_0xcd9e('0xa')](_0xcd9e('0x14'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x15')]);router[_0xcd9e('0xa')](_0xcd9e('0x16'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x17')]);router[_0xcd9e('0xa')]('/:id/verify',auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x18')]);router[_0xcd9e('0xa')](_0xcd9e('0x19'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x1a')]);router['post'](_0xcd9e('0xe'),auth[_0xcd9e('0x9')](),controller['addDisposition']);router[_0xcd9e('0x1b')](_0xcd9e('0xf'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd9e('0x1d')]);router['post'](_0xcd9e('0x11'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x1e')]);router[_0xcd9e('0x1b')](_0xcd9e('0x12'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x1f')]);router[_0xcd9e('0x1b')](_0xcd9e('0x20'),auth['isAuthenticated'](),controller[_0xcd9e('0x21')]);router[_0xcd9e('0x1b')](_0xcd9e('0x14'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x22')]);router[_0xcd9e('0x1b')](_0xcd9e('0x23'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x24')]);router[_0xcd9e('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0xcd9e('0x25')]);router[_0xcd9e('0x26')](_0xcd9e('0x27'),auth['isAuthenticated'](),controller[_0xcd9e('0x28')]);router[_0xcd9e('0x29')](_0xcd9e('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xcd9e('0x29')]('/:id/canned_answers',auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x2a')]);router['delete'](_0xcd9e('0x11'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x2b')]);router[_0xcd9e('0x29')](_0xcd9e('0x12'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x2c')]);router[_0xcd9e('0x29')]('/:id',auth[_0xcd9e('0x9')](),controller['destroy']);router['delete'](_0xcd9e('0x19'),auth[_0xcd9e('0x9')](),controller[_0xcd9e('0x2d')]);module[_0xcd9e('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3c6dd9c..04ec40a 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 _0xc587=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','STRING','TEXT','BOOLEAN'];(function(_0x1b50a6,_0x30a5fc){var _0x394b1f=function(_0x29112f){while(--_0x29112f){_0x1b50a6['push'](_0x1b50a6['shift']());}};_0x394b1f(++_0x30a5fc);}(_0xc587,0x1b6));var _0x7c58=function(_0xcecf36,_0x4e8811){_0xcecf36=_0xcecf36-0x0;var _0xe80f2e=_0xc587[_0xcecf36];return _0xe80f2e;};'use strict';var Sequelize=require(_0x7c58('0x0'));module['exports']={'description':{'type':Sequelize[_0x7c58('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7c58('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7c58('0x2')]},'markAsUnread':{'type':Sequelize[_0x7c58('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7c58('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x7c58('0x4')](0x2)[_0x7c58('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7c58('0x2')],'defaultValue':function(){return _0x7c58('0x6');}},'notificationSound':{'type':Sequelize[_0x7c58('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7c58('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7c58('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7c58('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7c58('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7c58('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7c58('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7c58('0x3')],'defaultValue':![],'comment':_0x7c58('0x7'),'set':function(_0x292f47){if(!_0x292f47)this[_0x7c58('0x8')](_0x7c58('0x9'),null);this['setDataValue'](_0x7c58('0xa'),_0x292f47);}},'provider':{'type':Sequelize['ENUM'](_0x7c58('0xb'),_0x7c58('0xc'),_0x7c58('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x7c58('0xe')](_0x7c58('0xf')))return _0x7c58('0x10');return this[_0x7c58('0xe')]('provider');},'set':function(_0x152d76){if(_0x152d76===_0x7c58('0x10'))_0x152d76=null;return this[_0x7c58('0x8')]('provider',_0x152d76);}}}; \ No newline at end of file +var _0xb577=['hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail'];(function(_0x3c1957,_0x39b1b0){var _0x25123a=function(_0x10c11e){while(--_0x10c11e){_0x3c1957['push'](_0x3c1957['shift']());}};_0x25123a(++_0x39b1b0);}(_0xb577,0x16f));var _0x7b57=function(_0x1a3bca,_0x34047c){_0x1a3bca=_0x1a3bca-0x0;var _0x3db2e6=_0xb577[_0x1a3bca];return _0x3db2e6;};'use strict';var Sequelize=require(_0x7b57('0x0'));module[_0x7b57('0x1')]={'description':{'type':Sequelize[_0x7b57('0x2')]},'name':{'type':Sequelize[_0x7b57('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7b57('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7b57('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x7b57('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7b57('0x4')]},'markAsUnread':{'type':Sequelize[_0x7b57('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7b57('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7b57('0x5');}},'notificationSound':{'type':Sequelize[_0x7b57('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7b57('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7b57('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b57('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b57('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b57('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b57('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7b57('0x3')],'defaultValue':![],'comment':_0x7b57('0x7'),'set':function(_0x152fb3){if(!_0x152fb3)this[_0x7b57('0x8')](_0x7b57('0x9'),null);this[_0x7b57('0x8')](_0x7b57('0xa'),_0x152fb3);}},'provider':{'type':Sequelize[_0x7b57('0xb')](_0x7b57('0xc'),_0x7b57('0xd'),_0x7b57('0xe'),_0x7b57('0xf')),'defaultValue':null,'get':function(){if(!this[_0x7b57('0x10')]('provider'))return'custom';return this[_0x7b57('0x10')](_0x7b57('0x11'));},'set':function(_0x31c261){if(_0x31c261===_0x7b57('0x12'))_0x31c261=null;return this[_0x7b57('0x8')](_0x7b57('0x11'),_0x31c261);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index aa04cc5..bf9d91e 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 _0xb1be=['socket.io-emitter','jayson/promise','http','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','update','destroy','get','MailAccounts','end','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','pass','password','modernAuthentication','CloudProviderId','port','host','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','body','custom','provider','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','pick','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','MailInteraction','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','from','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','addAgents','omit','removeAgents','emit','getAgents','User','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x34b011,_0xbd807b){var _0x2f5175=function(_0x40bcf0){while(--_0x40bcf0){_0x34b011['push'](_0x34b011['shift']());}};_0x2f5175(++_0xbd807b);}(_0xb1be,0xb1));var _0xeb1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1be[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var BPromise=require(_0xeb1b('0x0'));var util=require(_0xeb1b('0x1'));var path=require(_0xeb1b('0x2'));var _=require('lodash');var juice=require(_0xeb1b('0x3'));var Redis=require(_0xeb1b('0x4'));var qs=require(_0xeb1b('0x5'));var logger=require(_0xeb1b('0x6'))(_0xeb1b('0x7'));var config=require(_0xeb1b('0x8'));var db=require(_0xeb1b('0x9'))['db'];config[_0xeb1b('0xa')]=_[_0xeb1b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeb1b('0xc'))(new Redis(config[_0xeb1b('0xa')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0xeb1b('0xd'));var client=jayson['client'][_0xeb1b('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x2e4157,_0x58645b,_0x289616,_0x2794c8){return new BPromise(function(_0x5a69ed,_0x3797f6){var _0x49b014=_0x2794c8||client;return _0x49b014[_0xeb1b('0xf')](_0x2e4157,_0x289616)[_0xeb1b('0x10')](function(_0x3c6216){logger[_0xeb1b('0x11')]('MailAccount,\x20%s,\x20%s',_0x58645b,_0xeb1b('0x12'));logger['debug'](_0xeb1b('0x13'),_0x58645b,'request\x20sent',JSON[_0xeb1b('0x14')](_0x3c6216));if(_0x3c6216[_0xeb1b('0x15')]){if(_0x3c6216['error'][_0xeb1b('0x16')]===0x1f4){logger[_0xeb1b('0x15')](_0xeb1b('0x17'),_0x58645b,_0x3c6216[_0xeb1b('0x15')][_0xeb1b('0x18')]);return _0x3797f6(_0x3c6216[_0xeb1b('0x15')][_0xeb1b('0x18')]);}logger[_0xeb1b('0x15')](_0xeb1b('0x17'),_0x58645b,_0x3c6216['error'][_0xeb1b('0x18')]);return _0x5a69ed(_0x3c6216['error'][_0xeb1b('0x18')]);}else{logger[_0xeb1b('0x11')](_0xeb1b('0x17'),_0x58645b,'request\x20sent');_0x5a69ed(_0x3c6216[_0xeb1b('0x19')][_0xeb1b('0x18')]);}})[_0xeb1b('0x1a')](function(_0xc232cb){logger[_0xeb1b('0x15')](_0xeb1b('0x17'),_0x58645b,_0xc232cb);_0x3797f6(_0xc232cb);});});}function respondWithStatusCode(_0x4ca137,_0x132d81){_0x132d81=_0x132d81||0xcc;return function(_0x1eaf50){if(_0x1eaf50){return _0x4ca137[_0xeb1b('0x1b')](_0x132d81);}return _0x4ca137[_0xeb1b('0x1c')](_0x132d81)['end']();};}function respondWithResult(_0x343245,_0x5712ce){_0x5712ce=_0x5712ce||0xc8;return function(_0x2a3161){if(_0x2a3161){return _0x343245[_0xeb1b('0x1c')](_0x5712ce)[_0xeb1b('0x1d')](_0x2a3161);}};}function respondWithFilteredResult(_0x29ac19,_0x239ddb){return function(_0xa386e6){if(_0xa386e6){var _0x353f2f=typeof _0x239ddb['offset']===_0xeb1b('0x1e')&&typeof _0x239ddb[_0xeb1b('0x1f')]===_0xeb1b('0x1e');var _0x583c08=_0xa386e6['count'];var _0x427dd9=_0x353f2f?0x0:_0x239ddb[_0xeb1b('0x20')];var _0x4a4b0b=_0x353f2f?_0xa386e6['count']:_0x239ddb[_0xeb1b('0x20')]+_0x239ddb[_0xeb1b('0x1f')];var _0x15bfbd;if(_0x4a4b0b>=_0x583c08){_0x4a4b0b=_0x583c08;_0x15bfbd=0xc8;}else{_0x15bfbd=0xce;}_0x29ac19[_0xeb1b('0x1c')](_0x15bfbd);return _0x29ac19[_0xeb1b('0x21')](_0xeb1b('0x22'),_0x427dd9+'-'+_0x4a4b0b+'/'+_0x583c08)['json'](_0xa386e6);}return null;};}function saveUpdates(_0x499a34){return function(_0x45e632){if(_0x45e632){return _0x45e632[_0xeb1b('0x23')](_0x499a34)[_0xeb1b('0x10')](function(_0x5dd739){return _0x5dd739;});}return null;};}function removeEntity(_0x2c010b){return function(_0x13a8f0){if(_0x13a8f0){return _0x13a8f0[_0xeb1b('0x24')]()['then'](function(){var _0x1e7aa0=_0x13a8f0[_0xeb1b('0x25')]({'plain':!![]});var _0x56ba10=_0xeb1b('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x56ba10,'resourceId':_0x1e7aa0['id']}})['then'](function(){return _0x13a8f0;});})['then'](function(){_0x2c010b[_0xeb1b('0x1c')](0xcc)[_0xeb1b('0x27')]();});}};}function handleEntityNotFound(_0x22a4af){return function(_0x5df414){if(!_0x5df414){_0x22a4af['sendStatus'](0x194);}return _0x5df414;};}function handleError(_0x501265,_0x529116){_0x529116=_0x529116||0x1f4;return function(_0xfe8dbf){logger[_0xeb1b('0x15')](_0xfe8dbf[_0xeb1b('0x28')]);if(_0xfe8dbf[_0xeb1b('0x29')]){delete _0xfe8dbf[_0xeb1b('0x29')];}_0x501265[_0xeb1b('0x1c')](_0x529116)[_0xeb1b('0x2a')](_0xfe8dbf);};}function getImapHost(_0x5d0c50){switch(_0x5d0c50){case _0xeb1b('0x2b'):return _0xeb1b('0x2c');case _0xeb1b('0x2d'):return'imap.mail.yahoo.com';case _0xeb1b('0x2e'):return _0xeb1b('0x2f');case _0xeb1b('0x30'):return'outlook.office365.com';}throw new Error(_0xeb1b('0x31'),_0x5d0c50);}function getSmtpHost(_0x4bf660){switch(_0x4bf660){case _0xeb1b('0x2b'):return _0xeb1b('0x32');case'yahoo':return _0xeb1b('0x33');case _0xeb1b('0x2e'):return _0xeb1b('0x34');case _0xeb1b('0x30'):return _0xeb1b('0x35');}throw new Error(_0xeb1b('0x31'),_0x4bf660);}function getAuthenticationOptions(_0x9dfd8a,_0x260861){var _0x13309d={};var _0x41b838={};if(_0x9dfd8a){_0x13309d['user']=_0x41b838[_0xeb1b('0x36')]=_0x260861['username'];_0x13309d['password']=_0x41b838[_0xeb1b('0x37')]=_0x260861[_0xeb1b('0x38')];if(_0x260861[_0xeb1b('0x39')]){_0x13309d[_0xeb1b('0x39')]=_0x41b838[_0xeb1b('0x39')]=!![];_0x13309d[_0xeb1b('0x3a')]=_0x41b838['CloudProviderId']=_0x260861[_0xeb1b('0x3a')];_0x13309d[_0xeb1b('0x38')]=_0x41b838[_0xeb1b('0x37')]=null;}else{_0x13309d[_0xeb1b('0x3a')]=_0x41b838[_0xeb1b('0x3a')]=null;}_0x13309d['host']=getImapHost(_0x9dfd8a);_0x13309d[_0xeb1b('0x3b')]=0x3e1;_0x41b838[_0xeb1b('0x3c')]=getSmtpHost(_0x9dfd8a);_0x41b838[_0xeb1b('0x3b')]=0x24b;_0x41b838['secure']=![];_0x13309d[_0xeb1b('0x3d')]=_0x41b838[_0xeb1b('0x3d')]=null;}else{if(_0x260861[_0xeb1b('0x3e')]){_0x13309d['user']=_0x41b838[_0xeb1b('0x36')]=_0x260861['username'];_0x13309d[_0xeb1b('0x38')]=_0x41b838[_0xeb1b('0x37')]=_0x260861[_0xeb1b('0x38')];}else{_0x13309d[_0xeb1b('0x3e')]=_0x41b838[_0xeb1b('0x3e')]=![];_0x13309d['user']=_0x41b838[_0xeb1b('0x36')]=null;_0x13309d[_0xeb1b('0x38')]=_0x41b838['pass']=null;}_0x13309d['host']=_0x260861[_0xeb1b('0x3f')][_0xeb1b('0x3c')];_0x13309d[_0xeb1b('0x3b')]=_0x260861[_0xeb1b('0x3f')]['port'];_0x41b838[_0xeb1b('0x3c')]=_0x260861[_0xeb1b('0x40')][_0xeb1b('0x3c')];_0x41b838[_0xeb1b('0x3b')]=_0x260861[_0xeb1b('0x40')][_0xeb1b('0x3b')];}return{'Imap':_0x13309d,'Smtp':_0x41b838};}exports['index']=function(_0x45f664,_0x4bdc25){var _0xbd8175={'include':[{'model':db[_0xeb1b('0x41')],'as':_0xeb1b('0x3f')},{'model':db[_0xeb1b('0x42')],'as':_0xeb1b('0x40')},{'model':db[_0xeb1b('0x43')],'as':_0xeb1b('0x44')}]},_0x5421a2={},_0x3528bb={'count':0x0,'rows':[]};var _0x41882e=_[_0xeb1b('0x45')](db[_0xeb1b('0x46')][_0xeb1b('0x47')],function(_0x50b49e){return{'name':_0x50b49e['fieldName'],'type':_0x50b49e['type']['key']};});_0x5421a2['model']=_[_0xeb1b('0x45')](_0x41882e,_0xeb1b('0x29'));_0x5421a2['query']=_[_0xeb1b('0x48')](_0x45f664[_0xeb1b('0x49')]);_0x5421a2['filters']=_[_0xeb1b('0x4a')](_0x5421a2[_0xeb1b('0x4b')],_0x5421a2[_0xeb1b('0x49')]);_0xbd8175[_0xeb1b('0x4c')]=_[_0xeb1b('0x4a')](_0x5421a2[_0xeb1b('0x4b')],qs['fields'](_0x45f664[_0xeb1b('0x49')][_0xeb1b('0x4d')]));_0xbd8175[_0xeb1b('0x4c')]=_0xbd8175[_0xeb1b('0x4c')][_0xeb1b('0x4e')]?_0xbd8175[_0xeb1b('0x4c')]:_0x5421a2[_0xeb1b('0x4b')];if(!_0x45f664[_0xeb1b('0x49')][_0xeb1b('0x4f')](_0xeb1b('0x50'))){_0xbd8175[_0xeb1b('0x1f')]=qs[_0xeb1b('0x1f')](_0x45f664[_0xeb1b('0x49')][_0xeb1b('0x1f')]);_0xbd8175[_0xeb1b('0x20')]=qs[_0xeb1b('0x20')](_0x45f664[_0xeb1b('0x49')][_0xeb1b('0x20')]);}_0xbd8175[_0xeb1b('0x51')]=qs[_0xeb1b('0x52')](_0x45f664[_0xeb1b('0x49')][_0xeb1b('0x52')]);_0xbd8175[_0xeb1b('0x53')]=qs[_0xeb1b('0x54')](_['pick'](_0x45f664[_0xeb1b('0x49')],_0x5421a2[_0xeb1b('0x54')]),_0x41882e);if(_0x45f664[_0xeb1b('0x49')][_0xeb1b('0x55')]){_0xbd8175[_0xeb1b('0x53')]=_[_0xeb1b('0x56')](_0xbd8175[_0xeb1b('0x53')],{'$or':_[_0xeb1b('0x45')](_0x41882e,function(_0x5c7312){if(_0x5c7312[_0xeb1b('0x57')]!==_0xeb1b('0x58')){var _0x5f5556={};_0x5f5556[_0x5c7312[_0xeb1b('0x29')]]={'$like':'%'+_0x45f664[_0xeb1b('0x49')]['filter']+'%'};return _0x5f5556;}})});}_0xbd8175=_[_0xeb1b('0x56')]({},_0xbd8175,_0x45f664[_0xeb1b('0x59')]);var _0xb1838e={'where':_0xbd8175[_0xeb1b('0x53')]};return db[_0xeb1b('0x46')][_0xeb1b('0x5a')](_0xb1838e)[_0xeb1b('0x10')](function(_0x29c4fb){_0x3528bb[_0xeb1b('0x5a')]=_0x29c4fb;if(_0x45f664['query'][_0xeb1b('0x5b')]){_0xbd8175[_0xeb1b('0x5c')]=[{'all':!![]}];}return db['MailAccount'][_0xeb1b('0x5d')](_0xbd8175);})[_0xeb1b('0x10')](function(_0xcf410b){_0x3528bb[_0xeb1b('0x5e')]=_0xcf410b;return _0x3528bb;})[_0xeb1b('0x10')](respondWithFilteredResult(_0x4bdc25,_0xbd8175))[_0xeb1b('0x1a')](handleError(_0x4bdc25,null));};exports['show']=function(_0x5a1693,_0x1ee40b){var _0x58894e={'raw':![],'where':{'id':_0x5a1693[_0xeb1b('0x5f')]['id']},'include':[{'model':db[_0xeb1b('0x41')],'as':_0xeb1b('0x3f')},{'model':db[_0xeb1b('0x42')],'as':_0xeb1b('0x40')},{'model':db[_0xeb1b('0x43')],'as':_0xeb1b('0x44')}]},_0x2a9a90={};_0x2a9a90[_0xeb1b('0x4b')]=_[_0xeb1b('0x48')](db['MailAccount'][_0xeb1b('0x47')]);_0x2a9a90[_0xeb1b('0x49')]=_[_0xeb1b('0x48')](_0x5a1693[_0xeb1b('0x49')]);_0x2a9a90['filters']=_[_0xeb1b('0x4a')](_0x2a9a90[_0xeb1b('0x4b')],_0x2a9a90[_0xeb1b('0x49')]);_0x58894e['attributes']=_[_0xeb1b('0x4a')](_0x2a9a90[_0xeb1b('0x4b')],qs[_0xeb1b('0x4d')](_0x5a1693[_0xeb1b('0x49')]['fields']));_0x58894e['attributes']=_0x58894e[_0xeb1b('0x4c')][_0xeb1b('0x4e')]?_0x58894e[_0xeb1b('0x4c')]:_0x2a9a90[_0xeb1b('0x4b')];if(_0x5a1693[_0xeb1b('0x49')]['includeAll']){_0x58894e['include']=[{'all':!![]}];}_0x58894e=_[_0xeb1b('0x56')]({},_0x58894e,_0x5a1693[_0xeb1b('0x59')]);return db['MailAccount'][_0xeb1b('0x60')](_0x58894e)[_0xeb1b('0x10')](handleEntityNotFound(_0x1ee40b,null))[_0xeb1b('0x10')](respondWithResult(_0x1ee40b,null))[_0xeb1b('0x1a')](handleError(_0x1ee40b,null));};exports[_0xeb1b('0x23')]=function(_0x37ec30,_0x405448){if(_0x37ec30[_0xeb1b('0x61')]['id']){delete _0x37ec30['body']['id'];}var _0x158894=_0x37ec30[_0xeb1b('0x61')]['provider']===_0xeb1b('0x62')?null:_0x37ec30[_0xeb1b('0x61')][_0xeb1b('0x63')];var _0x2cd874=_0x37ec30[_0xeb1b('0x61')][_0xeb1b('0x3f')]||{};var _0x562acb=_0x37ec30['body']['Smtp']||{};if(_0x158894){_0x2cd874[_0xeb1b('0x3c')]=getImapHost(_0x158894);_0x2cd874[_0xeb1b('0x3b')]=0x3e1;_0x562acb[_0xeb1b('0x3c')]=getSmtpHost(_0x158894);_0x562acb[_0xeb1b('0x3b')]=0x24b;_0x562acb['secure']=![];}if(_0x562acb[_0xeb1b('0x39')]){_0x562acb[_0xeb1b('0x64')]=![];}else{_0x562acb[_0xeb1b('0x3a')]=null;}if(!_0x2cd874[_0xeb1b('0x39')])_0x2cd874[_0xeb1b('0x3a')]=null;_0x37ec30[_0xeb1b('0x61')][_0xeb1b('0x3f')]=_0x2cd874;_0x37ec30[_0xeb1b('0x61')][_0xeb1b('0x40')]=_0x562acb;return db[_0xeb1b('0x46')][_0xeb1b('0x60')]({'where':{'id':_0x37ec30[_0xeb1b('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xeb1b('0x42')],'as':_0xeb1b('0x40')},{'model':db['Pause'],'as':_0xeb1b('0x44')}]})[_0xeb1b('0x10')](handleEntityNotFound(_0x405448,null))['then'](function(_0x45b1ff){if(!_0x45b1ff)throw new Error(_0xeb1b('0x65'));if(_0x45b1ff[_0xeb1b('0x3d')])delete _0x37ec30[_0xeb1b('0x61')][_0xeb1b('0x3f')];return _0x45b1ff;})[_0xeb1b('0x10')](saveUpdates(_0x37ec30['body'],null))[_0xeb1b('0x10')](function(_0x530508){if(!_0x37ec30['body'][_0xeb1b('0x3f')])return _0x530508;return db[_0xeb1b('0x41')][_0xeb1b('0x23')](_0x37ec30['body']['Imap'],{'where':{'MailAccountId':_0x530508['id']}})['then'](function(){return _0x530508;});})[_0xeb1b('0x10')](function(_0x35470d){if(!_0x37ec30[_0xeb1b('0x61')][_0xeb1b('0x40')])return _0x35470d;return db[_0xeb1b('0x42')][_0xeb1b('0x23')](_0x37ec30[_0xeb1b('0x61')][_0xeb1b('0x40')],{'where':{'MailAccountId':_0x35470d['id']}})['then'](function(){return _0x35470d;});})[_0xeb1b('0x10')](respondWithResult(_0x405448,null))['catch'](handleError(_0x405448,null));};exports['describe']=function(_0x297c02,_0x589bb1){return db['MailAccount'][_0xeb1b('0x66')]()[_0xeb1b('0x10')](respondWithResult(_0x589bb1,null))[_0xeb1b('0x1a')](handleError(_0x589bb1,null));};exports[_0xeb1b('0x67')]=function(_0x114263,_0x26fe31){if(_0x114263[_0xeb1b('0x61')]['id']){delete _0x114263[_0xeb1b('0x61')]['id'];}return db['MailAccount'][_0xeb1b('0x60')]({'where':{'id':_0x114263[_0xeb1b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x26fe31,null))[_0xeb1b('0x10')](function(_0x40e42a){if(_0x40e42a){_0x114263[_0xeb1b('0x61')][_0xeb1b('0x68')]=_0x40e42a['id'];return db[_0xeb1b('0x69')][_0xeb1b('0x6a')](_0x114263[_0xeb1b('0x61')]);}})[_0xeb1b('0x10')](respondWithResult(_0x26fe31,null))['catch'](handleError(_0x26fe31,null));};exports[_0xeb1b('0x6b')]=function(_0x207238,_0x295774){var _0x3d470e={'raw':![],'where':{}};var _0x174fc3={};var _0x29d4f0={'count':0x0,'rows':[]};return db[_0xeb1b('0x46')][_0xeb1b('0x6c')]({'where':{'id':_0x207238[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x295774,null))[_0xeb1b('0x10')](function(_0x89f492){if(_0x89f492){_0x174fc3[_0xeb1b('0x4b')]=_['keys'](db[_0xeb1b('0x69')][_0xeb1b('0x47')]);_0x174fc3[_0xeb1b('0x49')]=_[_0xeb1b('0x48')](_0x207238[_0xeb1b('0x49')]);_0x174fc3['filters']=_[_0xeb1b('0x4a')](_0x174fc3[_0xeb1b('0x4b')],_0x174fc3['query']);_0x3d470e[_0xeb1b('0x4c')]=_[_0xeb1b('0x4a')](_0x174fc3[_0xeb1b('0x4b')],qs[_0xeb1b('0x4d')](_0x207238['query'][_0xeb1b('0x4d')]));_0x3d470e[_0xeb1b('0x4c')]=_0x3d470e[_0xeb1b('0x4c')][_0xeb1b('0x4e')]?_0x3d470e[_0xeb1b('0x4c')]:_0x174fc3[_0xeb1b('0x4b')];if(!_0x207238[_0xeb1b('0x49')]['hasOwnProperty'](_0xeb1b('0x50'))){_0x3d470e[_0xeb1b('0x1f')]=qs[_0xeb1b('0x1f')](_0x207238[_0xeb1b('0x49')][_0xeb1b('0x1f')]);_0x3d470e['offset']=qs[_0xeb1b('0x20')](_0x207238[_0xeb1b('0x49')]['offset']);}_0x3d470e[_0xeb1b('0x51')]=qs[_0xeb1b('0x52')](_0x207238[_0xeb1b('0x49')][_0xeb1b('0x52')]);_0x3d470e['where']=qs[_0xeb1b('0x54')](_['pick'](_0x207238[_0xeb1b('0x49')],_0x174fc3[_0xeb1b('0x54')]));_0x3d470e[_0xeb1b('0x53')][_0xeb1b('0x68')]=_0x89f492['id'];if(_0x207238[_0xeb1b('0x49')][_0xeb1b('0x55')]){_0x3d470e[_0xeb1b('0x53')]=_[_0xeb1b('0x56')](_0x3d470e[_0xeb1b('0x53')],{'$or':_['map'](_0x3d470e[_0xeb1b('0x4c')],function(_0x4ea454){var _0x1e536d={};_0x1e536d[_0x4ea454]={'$like':'%'+_0x207238['query']['filter']+'%'};return _0x1e536d;})});}_0x3d470e=_[_0xeb1b('0x56')]({},_0x3d470e,_0x207238[_0xeb1b('0x59')]);return db['Disposition'][_0xeb1b('0x5a')]({'where':_0x3d470e['where']})['then'](function(_0x3acdf5){_0x29d4f0[_0xeb1b('0x5a')]=_0x3acdf5;if(_0x207238[_0xeb1b('0x49')][_0xeb1b('0x5b')]){_0x3d470e[_0xeb1b('0x5c')]=[{'all':!![]}];}return db[_0xeb1b('0x69')][_0xeb1b('0x5d')](_0x3d470e);})[_0xeb1b('0x10')](function(_0x226425){_0x29d4f0[_0xeb1b('0x5e')]=_0x226425;return _0x29d4f0;});}})['then'](respondWithFilteredResult(_0x295774,_0x3d470e))[_0xeb1b('0x1a')](handleError(_0x295774,null));};exports['removeDispositions']=function(_0x451ba5,_0x57dcc6){return db[_0xeb1b('0x46')][_0xeb1b('0x60')]({'where':{'id':_0x451ba5[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x57dcc6,null))[_0xeb1b('0x10')](function(_0x189a1b){if(_0x189a1b){return _0x189a1b[_0xeb1b('0x6d')](_0x451ba5['query'][_0xeb1b('0x6e')]);}})[_0xeb1b('0x10')](respondWithStatusCode(_0x57dcc6,null))[_0xeb1b('0x1a')](handleError(_0x57dcc6,null));};exports[_0xeb1b('0x6f')]=function(_0x2bb375,_0x46ea71){if(_0x2bb375['body']['id']){delete _0x2bb375[_0xeb1b('0x61')]['id'];}return db[_0xeb1b('0x46')]['find']({'where':{'id':_0x2bb375[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x46ea71,null))[_0xeb1b('0x10')](function(_0x293f5c){if(_0x293f5c){_0x2bb375[_0xeb1b('0x61')][_0xeb1b('0x68')]=_0x293f5c['id'];return db['CannedAnswer'][_0xeb1b('0x6a')](_0x2bb375['body']);}})[_0xeb1b('0x10')](respondWithResult(_0x46ea71,null))[_0xeb1b('0x1a')](handleError(_0x46ea71,null));};exports['getAnswers']=function(_0x345522,_0x1aae8f){var _0x31eb56={'raw':![],'where':{}};var _0x275dbd={};var _0x2cbf37={'count':0x0,'rows':[]};return db['MailAccount'][_0xeb1b('0x6c')]({'where':{'id':_0x345522['params']['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x1aae8f,null))[_0xeb1b('0x10')](function(_0x58f080){if(_0x58f080){_0x275dbd['model']=_[_0xeb1b('0x48')](db['CannedAnswer'][_0xeb1b('0x47')]);_0x275dbd[_0xeb1b('0x49')]=_[_0xeb1b('0x48')](_0x345522[_0xeb1b('0x49')]);_0x275dbd[_0xeb1b('0x54')]=_['intersection'](_0x275dbd[_0xeb1b('0x4b')],_0x275dbd['query']);_0x31eb56[_0xeb1b('0x4c')]=_['intersection'](_0x275dbd[_0xeb1b('0x4b')],qs[_0xeb1b('0x4d')](_0x345522[_0xeb1b('0x49')][_0xeb1b('0x4d')]));_0x31eb56[_0xeb1b('0x4c')]=_0x31eb56[_0xeb1b('0x4c')][_0xeb1b('0x4e')]?_0x31eb56[_0xeb1b('0x4c')]:_0x275dbd[_0xeb1b('0x4b')];if(!_0x345522['query'][_0xeb1b('0x4f')]('nolimit')){_0x31eb56[_0xeb1b('0x1f')]=qs[_0xeb1b('0x1f')](_0x345522['query']['limit']);_0x31eb56[_0xeb1b('0x20')]=qs[_0xeb1b('0x20')](_0x345522[_0xeb1b('0x49')][_0xeb1b('0x20')]);}_0x31eb56[_0xeb1b('0x51')]=qs[_0xeb1b('0x52')](_0x345522[_0xeb1b('0x49')]['sort']);_0x31eb56[_0xeb1b('0x53')]=qs['filters'](_[_0xeb1b('0x70')](_0x345522[_0xeb1b('0x49')],_0x275dbd[_0xeb1b('0x54')]));_0x31eb56[_0xeb1b('0x53')][_0xeb1b('0x68')]=_0x58f080['id'];if(_0x345522[_0xeb1b('0x49')][_0xeb1b('0x55')]){_0x31eb56[_0xeb1b('0x53')]=_['merge'](_0x31eb56[_0xeb1b('0x53')],{'$or':_['map'](_0x31eb56[_0xeb1b('0x4c')],function(_0x35d283){var _0x32480f={};_0x32480f[_0x35d283]={'$like':'%'+_0x345522[_0xeb1b('0x49')][_0xeb1b('0x55')]+'%'};return _0x32480f;})});}_0x31eb56=_[_0xeb1b('0x56')]({},_0x31eb56,_0x345522['options']);return db[_0xeb1b('0x71')]['count']({'where':_0x31eb56[_0xeb1b('0x53')]})[_0xeb1b('0x10')](function(_0x39bbc6){_0x2cbf37[_0xeb1b('0x5a')]=_0x39bbc6;if(_0x345522[_0xeb1b('0x49')][_0xeb1b('0x5b')]){_0x31eb56[_0xeb1b('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xeb1b('0x5d')](_0x31eb56);})[_0xeb1b('0x10')](function(_0x5db47e){_0x2cbf37[_0xeb1b('0x5e')]=_0x5db47e;return _0x2cbf37;});}})[_0xeb1b('0x10')](respondWithFilteredResult(_0x1aae8f,_0x31eb56))['catch'](handleError(_0x1aae8f,null));};exports[_0xeb1b('0x72')]=function(_0x145bef,_0x5052ff){return db[_0xeb1b('0x46')][_0xeb1b('0x60')]({'where':{'id':_0x145bef[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x5052ff,null))[_0xeb1b('0x10')](function(_0x521f4a){if(_0x521f4a){return _0x521f4a[_0xeb1b('0x72')](_0x145bef[_0xeb1b('0x49')][_0xeb1b('0x6e')]);}})[_0xeb1b('0x10')](respondWithStatusCode(_0x5052ff,null))['catch'](handleError(_0x5052ff,null));};exports[_0xeb1b('0x6a')]=function(_0x2afacc,_0x2322cc){var _0x5c7492={'name':_0x2afacc['body'][_0xeb1b('0x29')],'key':_0x2afacc['body']['key'],'provider':_0x2afacc['body'][_0xeb1b('0x63')]===_0xeb1b('0x62')?null:_0x2afacc[_0xeb1b('0x61')]['provider'],'email':_0x2afacc[_0xeb1b('0x61')][_0xeb1b('0x73')],'ListId':_0x2afacc['body'][_0xeb1b('0x74')],'active':!_[_0xeb1b('0x75')](_0x2afacc[_0xeb1b('0x61')][_0xeb1b('0x76')])?_0x2afacc[_0xeb1b('0x61')][_0xeb1b('0x76')]:!![],'description':_0x2afacc['body'][_0xeb1b('0x77')]||null};var _0x17e66e=getAuthenticationOptions(_0x5c7492[_0xeb1b('0x63')],_0x2afacc[_0xeb1b('0x61')]);_0x5c7492['Imap']=_0x17e66e[_0xeb1b('0x3f')];_0x5c7492[_0xeb1b('0x40')]=_0x17e66e[_0xeb1b('0x40')];return db[_0xeb1b('0x46')][_0xeb1b('0x6a')](_0x5c7492,{'include':[{'model':db['MailServerOut'],'as':_0xeb1b('0x40')},{'model':db[_0xeb1b('0x41')],'as':'Imap'}]})['then'](function(_0x12e0f0){var _0x35f308=_0x2afacc[_0xeb1b('0x36')][_0xeb1b('0x25')]({'plain':!![]});if(!_0x35f308)throw new Error(_0xeb1b('0x78'));if(_0x35f308[_0xeb1b('0x79')]==='user'){var _0xc247d4=_0x12e0f0[_0xeb1b('0x25')]({'plain':!![]});return db[_0xeb1b('0x7a')][_0xeb1b('0x60')]({'where':{'name':'MailAccounts','userProfileId':_0x35f308[_0xeb1b('0x7b')]},'raw':!![]})[_0xeb1b('0x10')](function(_0x565f95){if(_0x565f95&&_0x565f95[_0xeb1b('0x7c')]===0x0){return db[_0xeb1b('0x7d')][_0xeb1b('0x6a')]({'name':_0xc247d4[_0xeb1b('0x29')],'resourceId':_0xc247d4['id'],'type':_0x565f95[_0xeb1b('0x29')],'sectionId':_0x565f95['id']},{})[_0xeb1b('0x10')](function(){return _0x12e0f0;});}else{return _0x12e0f0;}})[_0xeb1b('0x1a')](function(_0x4965e6){logger[_0xeb1b('0x15')](_0xeb1b('0x7e'),_0x4965e6);throw _0x4965e6;});}return _0x12e0f0;})['then'](respondWithResult(_0x2322cc,0xc9))['catch'](handleError(_0x2322cc,null));};exports['getImap']=function(_0x1ca3a8,_0x43dbff){return db['MailAccount'][_0xeb1b('0x6c')]({'where':{'id':_0x1ca3a8[_0xeb1b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x43dbff,null))[_0xeb1b('0x10')](function(_0x1c8a4d){if(_0x1c8a4d){return _0x1c8a4d[_0xeb1b('0x7f')]();}return null;})[_0xeb1b('0x10')](respondWithResult(_0x43dbff,null))['catch'](handleError(_0x43dbff,null));};exports[_0xeb1b('0x80')]=function(_0xda07dd,_0x16cfd6){if(_0xda07dd[_0xeb1b('0x61')]['id']){delete _0xda07dd[_0xeb1b('0x61')]['id'];}return db[_0xeb1b('0x46')][_0xeb1b('0x60')]({'where':{'id':_0xda07dd['params']['id']}})['then'](handleEntityNotFound(_0x16cfd6,null))[_0xeb1b('0x10')](function(_0x247eb5){if(_0x247eb5){_0xda07dd[_0xeb1b('0x61')][_0xeb1b('0x68')]=_0x247eb5['id'];return db[_0xeb1b('0x41')]['create'](_0xda07dd[_0xeb1b('0x61')]);}})['then'](respondWithResult(_0x16cfd6,null))[_0xeb1b('0x1a')](handleError(_0x16cfd6,null));};exports[_0xeb1b('0x81')]=function(_0x14da2d,_0x442797){return db['MailAccount'][_0xeb1b('0x6c')]({'where':{'id':_0x14da2d['params']['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x442797,null))[_0xeb1b('0x10')](function(_0x17303e){if(_0x17303e){return _0x17303e[_0xeb1b('0x82')](null);}return null;})[_0xeb1b('0x10')](respondWithStatusCode(_0x442797,null))['catch'](handleError(_0x442797,null));};exports[_0xeb1b('0x83')]=function(_0x36a3d5,_0x2688b8){return db[_0xeb1b('0x46')]['findOne']({'where':{'id':_0x36a3d5[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x2688b8,null))['then'](function(_0x3b5b59){if(_0x3b5b59){return _0x3b5b59['getSmtp']();}return null;})[_0xeb1b('0x10')](respondWithResult(_0x2688b8,null))[_0xeb1b('0x1a')](handleError(_0x2688b8,null));};exports['addSmtp']=function(_0x31b839,_0x5ea751){if(_0x31b839[_0xeb1b('0x61')]['id']){delete _0x31b839[_0xeb1b('0x61')]['id'];}return db['MailAccount'][_0xeb1b('0x60')]({'where':{'id':_0x31b839['params']['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x5ea751,null))[_0xeb1b('0x10')](function(_0x5e6d6a){if(_0x5e6d6a){_0x31b839[_0xeb1b('0x61')][_0xeb1b('0x68')]=_0x5e6d6a['id'];return db[_0xeb1b('0x42')][_0xeb1b('0x6a')](_0x31b839['body']);}})[_0xeb1b('0x10')](respondWithResult(_0x5ea751,null))[_0xeb1b('0x1a')](handleError(_0x5ea751,null));};exports[_0xeb1b('0x84')]=function(_0xc2814c,_0x4a38b8){return db[_0xeb1b('0x46')]['findOne']({'where':{'id':_0xc2814c[_0xeb1b('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4a38b8,null))['then'](function(_0x3b3363){if(_0x3b3363){return _0x3b3363['setSmtp'](null);}return null;})[_0xeb1b('0x10')](respondWithStatusCode(_0x4a38b8,null))['catch'](handleError(_0x4a38b8,null));};exports['addInteraction']=function(_0x3a1fbd,_0xa2bbfe){return db[_0xeb1b('0x85')][_0xeb1b('0x60')]({'where':{'id':_0x3a1fbd[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0xa2bbfe,null))[_0xeb1b('0x10')](function(_0x25743e){if(_0x25743e){return _0x25743e['addInteraction'](_0x3a1fbd[_0xeb1b('0x61')][_0xeb1b('0x6e')],_['omit'](_0x3a1fbd[_0xeb1b('0x61')],[_0xeb1b('0x6e'),'id'])||{});}})[_0xeb1b('0x10')](respondWithResult(_0xa2bbfe,null))[_0xeb1b('0x1a')](handleError(_0xa2bbfe,null));};exports[_0xeb1b('0x86')]=function(_0x494c25,_0x1f2bb0){var _0x50fa6d={'raw':![],'where':{}};var _0x5076eb={};var _0x3cc833={'count':0x0,'rows':[]};return db[_0xeb1b('0x46')][_0xeb1b('0x6c')]({'where':{'id':_0x494c25[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x1f2bb0,null))[_0xeb1b('0x10')](function(_0x36db07){if(_0x36db07){_0x5076eb[_0xeb1b('0x4b')]=_['keys'](db[_0xeb1b('0x85')][_0xeb1b('0x47')]);_0x5076eb[_0xeb1b('0x49')]=_['keys'](_0x494c25[_0xeb1b('0x49')]);_0x5076eb[_0xeb1b('0x54')]=_[_0xeb1b('0x4a')](_0x5076eb[_0xeb1b('0x4b')],_0x5076eb['query']);_0x50fa6d[_0xeb1b('0x4c')]=_['intersection'](_0x5076eb[_0xeb1b('0x4b')],qs[_0xeb1b('0x4d')](_0x494c25['query'][_0xeb1b('0x4d')]));_0x50fa6d[_0xeb1b('0x4c')]=_0x50fa6d['attributes'][_0xeb1b('0x4e')]?_0x50fa6d[_0xeb1b('0x4c')]:_0x5076eb[_0xeb1b('0x4b')];if(!_0x494c25['query']['hasOwnProperty'](_0xeb1b('0x50'))){_0x50fa6d['limit']=qs[_0xeb1b('0x1f')](_0x494c25['query'][_0xeb1b('0x1f')]);_0x50fa6d['offset']=qs[_0xeb1b('0x20')](_0x494c25[_0xeb1b('0x49')][_0xeb1b('0x20')]);}_0x50fa6d[_0xeb1b('0x51')]=qs[_0xeb1b('0x52')](_0x494c25[_0xeb1b('0x49')][_0xeb1b('0x52')]);_0x50fa6d[_0xeb1b('0x53')]=qs[_0xeb1b('0x54')](_[_0xeb1b('0x70')](_0x494c25['query'],_0x5076eb['filters']));_0x50fa6d[_0xeb1b('0x53')][_0xeb1b('0x68')]=_0x36db07['id'];if(_0x494c25[_0xeb1b('0x49')]['filter']){_0x50fa6d[_0xeb1b('0x53')]=_['merge'](_0x50fa6d['where'],{'$or':_[_0xeb1b('0x45')](_0x50fa6d[_0xeb1b('0x4c')],function(_0x5359ab){var _0x319f50={};_0x319f50[_0x5359ab]={'$like':'%'+_0x494c25[_0xeb1b('0x49')][_0xeb1b('0x55')]+'%'};return _0x319f50;})});}_0x50fa6d=_['merge']({},_0x50fa6d,_0x494c25['options']);return db[_0xeb1b('0x85')]['count']({'where':_0x50fa6d[_0xeb1b('0x53')]})[_0xeb1b('0x10')](function(_0xd1826c){_0x3cc833[_0xeb1b('0x5a')]=_0xd1826c;if(_0x494c25[_0xeb1b('0x49')][_0xeb1b('0x5b')]){_0x50fa6d['include']=[{'model':db[_0xeb1b('0x87')],'as':_0xeb1b('0x88'),'required':![]},{'model':db['User'],'as':_0xeb1b('0x89'),'attributes':[_0xeb1b('0x29'),_0xeb1b('0x8a'),_0xeb1b('0x8b')],'required':![]},{'model':db[_0xeb1b('0x8c')],'as':_0xeb1b('0x8d'),'attributes':['id',_0xeb1b('0x29'),'color'],'where':_0x494c25['query'][_0xeb1b('0x8e')]?{'id':_0x494c25['query'][_0xeb1b('0x8e')]}:undefined,'required':_0x494c25['query'][_0xeb1b('0x8e')]?!![]:![]}];}return db[_0xeb1b('0x85')]['findAll'](_0x50fa6d);})[_0xeb1b('0x10')](function(_0x2de46a){_0x3cc833[_0xeb1b('0x5e')]=_0x2de46a;return _0x3cc833;});}})[_0xeb1b('0x10')](respondWithFilteredResult(_0x1f2bb0,_0x50fa6d))['catch'](handleError(_0x1f2bb0,null));};exports[_0xeb1b('0x8f')]=function addApplications(_0x3096f6,_0x190b6c){var _0x564580=_0x3096f6[_0xeb1b('0x5f')]['id'];var _0x521689=_0x3096f6[_0xeb1b('0x61')];var _0x412eee=0xc8;var _0x5e11f0=null;return db[_0xeb1b('0x90')][_0xeb1b('0x91')]({'isolationLevel':db['sequelize']['Transaction'][_0xeb1b('0x92')][_0xeb1b('0x93')]},function(_0x3ed7f0){return db[_0xeb1b('0x46')][_0xeb1b('0x6c')]({'where':{'id':_0x564580},'transaction':_0x3ed7f0})[_0xeb1b('0x10')](function(_0x52c18d){if(_0x52c18d){return db[_0xeb1b('0x94')][_0xeb1b('0x24')]({'where':{'MailAccountId':_0x564580},'transaction':_0x3ed7f0})['then'](function(){var _0xb2c453=_[_0xeb1b('0x45')](_0x521689,function(_0x14222d){_0x14222d[_0xeb1b('0x68')]=_0x564580;return _0x14222d;});return db['MailApplication'][_0xeb1b('0x95')](_0xb2c453,{'transaction':_0x3ed7f0});});}else{_0x412eee=0x194;_0x5e11f0=[];}});})[_0xeb1b('0x10')](function(){if(_0x412eee!==0x194){return db['MailApplication'][_0xeb1b('0x96')]({'where':{'MailAccountId':_0x564580},'order':_0xeb1b('0x97')})[_0xeb1b('0x10')](function(_0x4bde7f){_0x5e11f0=_0x4bde7f;});}})[_0xeb1b('0x1a')](function(_0x11cee6){_0x412eee=0x1f4;logger[_0xeb1b('0x15')](_0x11cee6[_0xeb1b('0x28')]);if(_0x11cee6[_0xeb1b('0x29')]){delete _0x11cee6[_0xeb1b('0x29')];}_0x5e11f0=_0x11cee6;})[_0xeb1b('0x98')](function(){if(_0x5e11f0===null){_0x190b6c[_0xeb1b('0x1b')](_0x412eee);}else{if(_0x412eee===0x1f4){_0x190b6c['status'](_0x412eee)[_0xeb1b('0x2a')](_0x5e11f0);}else{_0x190b6c[_0xeb1b('0x1c')](_0x412eee)['json'](_0x5e11f0);}}});};exports[_0xeb1b('0x99')]=function(_0x299117,_0x554b47){var _0x549f2a={};var _0x186faf={};var _0x46f9b5;var _0x534fe2;return db[_0xeb1b('0x46')][_0xeb1b('0x6c')]({'where':{'id':_0x299117['params']['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x554b47,null))['then'](function(_0x4f1df1){if(_0x4f1df1){_0x46f9b5=_0x4f1df1;_0x186faf[_0xeb1b('0x4b')]=_['keys'](db[_0xeb1b('0x94')]['rawAttributes']);_0x186faf[_0xeb1b('0x49')]=_[_0xeb1b('0x48')](_0x299117[_0xeb1b('0x49')]);_0x186faf[_0xeb1b('0x54')]=_['intersection'](_0x186faf['model'],_0x186faf['query']);_0x549f2a['attributes']=_[_0xeb1b('0x4a')](_0x186faf[_0xeb1b('0x4b')],qs[_0xeb1b('0x4d')](_0x299117[_0xeb1b('0x49')][_0xeb1b('0x4d')]));_0x549f2a[_0xeb1b('0x4c')]=_0x549f2a[_0xeb1b('0x4c')][_0xeb1b('0x4e')]?_0x549f2a[_0xeb1b('0x4c')]:_0x186faf[_0xeb1b('0x4b')];_0x549f2a[_0xeb1b('0x51')]=qs[_0xeb1b('0x52')](_0x299117[_0xeb1b('0x49')][_0xeb1b('0x52')]);_0x549f2a[_0xeb1b('0x53')]=qs[_0xeb1b('0x54')](_[_0xeb1b('0x70')](_0x299117[_0xeb1b('0x49')],_0x186faf['filters']));if(_0x299117['query'][_0xeb1b('0x55')]){_0x549f2a[_0xeb1b('0x53')]=_['merge'](_0x549f2a[_0xeb1b('0x53')],{'$or':_[_0xeb1b('0x45')](_0x549f2a['attributes'],function(_0x435f4d){var _0x460aba={};_0x460aba[_0x435f4d]={'$like':'%'+_0x299117['query'][_0xeb1b('0x55')]+'%'};return _0x460aba;})});}_0x549f2a=_[_0xeb1b('0x56')]({},_0x549f2a,_0x299117[_0xeb1b('0x59')]);return _0x46f9b5[_0xeb1b('0x99')](_0x549f2a);}})[_0xeb1b('0x10')](function(_0x1164bf){if(_0x1164bf){_0x534fe2=_0x1164bf[_0xeb1b('0x4e')];if(!_0x299117['query'][_0xeb1b('0x4f')](_0xeb1b('0x50'))){_0x549f2a[_0xeb1b('0x1f')]=qs['limit'](_0x299117[_0xeb1b('0x49')][_0xeb1b('0x1f')]);_0x549f2a[_0xeb1b('0x20')]=qs[_0xeb1b('0x20')](_0x299117['query'][_0xeb1b('0x20')]);}return _0x46f9b5['getApplications'](_0x549f2a);}})[_0xeb1b('0x10')](function(_0x2e7c67){if(_0x2e7c67){return _0x2e7c67?{'count':_0x534fe2,'rows':_0x2e7c67}:null;}})[_0xeb1b('0x10')](respondWithResult(_0x554b47,null))[_0xeb1b('0x1a')](handleError(_0x554b47,null));};exports[_0xeb1b('0x9a')]=function(_0x3e718a,_0x438c08){var _0x191dee={'raw':!![],'where':{}};var _0x412892={};var _0x326544={'count':0x0,'rows':[]};return db[_0xeb1b('0x46')]['findOne']({'where':{'id':_0x3e718a[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x438c08,null))[_0xeb1b('0x10')](function(_0x1c80f7){if(_0x1c80f7){_0x412892[_0xeb1b('0x4b')]=_[_0xeb1b('0x48')](db['MailMessage']['rawAttributes']);_0x412892[_0xeb1b('0x49')]=_[_0xeb1b('0x48')](_0x3e718a[_0xeb1b('0x49')]);_0x412892[_0xeb1b('0x54')]=_['intersection'](_0x412892[_0xeb1b('0x4b')],_0x412892[_0xeb1b('0x49')]);_0x191dee['attributes']=_[_0xeb1b('0x4a')](_0x412892['model'],qs[_0xeb1b('0x4d')](_0x3e718a[_0xeb1b('0x49')][_0xeb1b('0x4d')]));_0x191dee[_0xeb1b('0x4c')]=_0x191dee[_0xeb1b('0x4c')][_0xeb1b('0x4e')]?_0x191dee['attributes']:_0x412892['model'];if(!_0x3e718a[_0xeb1b('0x49')][_0xeb1b('0x4f')](_0xeb1b('0x50'))){_0x191dee['limit']=qs[_0xeb1b('0x1f')](_0x3e718a['query']['limit']);_0x191dee[_0xeb1b('0x20')]=qs[_0xeb1b('0x20')](_0x3e718a[_0xeb1b('0x49')]['offset']);}_0x191dee[_0xeb1b('0x51')]=qs[_0xeb1b('0x52')](_0x3e718a[_0xeb1b('0x49')][_0xeb1b('0x52')]);_0x191dee[_0xeb1b('0x53')]=qs[_0xeb1b('0x54')](_[_0xeb1b('0x70')](_0x3e718a[_0xeb1b('0x49')],_0x412892[_0xeb1b('0x54')]));_0x191dee[_0xeb1b('0x53')][_0xeb1b('0x68')]=_0x1c80f7['id'];if(_0x3e718a['query']['filter']){_0x191dee[_0xeb1b('0x53')]=_[_0xeb1b('0x56')](_0x191dee['where'],{'$or':_[_0xeb1b('0x45')](_0x191dee[_0xeb1b('0x4c')],function(_0x32494d){var _0x39a08d={};_0x39a08d[_0x32494d]={'$like':'%'+_0x3e718a[_0xeb1b('0x49')][_0xeb1b('0x55')]+'%'};return _0x39a08d;})});}if(_0x3e718a[_0xeb1b('0x49')][_0xeb1b('0x9b')]){var _0x51909d=_0x3e718a[_0xeb1b('0x49')][_0xeb1b('0x9b')][_0xeb1b('0x9c')](',');var _0x1959cb={};_0x1959cb[_0x51909d[0x0]]={'$gte':moment(_0x51909d[0x1])[_0xeb1b('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x191dee['where']=_[_0xeb1b('0x56')](_0x191dee['where'],_0x1959cb);}_0x191dee=_[_0xeb1b('0x56')]({},_0x191dee,_0x3e718a[_0xeb1b('0x59')]);return db[_0xeb1b('0x9e')][_0xeb1b('0x5a')]({'where':_0x191dee[_0xeb1b('0x53')]})[_0xeb1b('0x10')](function(_0xc1fe24){_0x326544['count']=_0xc1fe24;if(_0x3e718a[_0xeb1b('0x49')][_0xeb1b('0x5b')]){_0x191dee[_0xeb1b('0x5c')]=[{'all':!![]}];}return db[_0xeb1b('0x9e')][_0xeb1b('0x5d')](_0x191dee);})[_0xeb1b('0x10')](function(_0x5ddbcd){if(_0x3e718a[_0xeb1b('0x49')][_0xeb1b('0x9f')]===_0xeb1b('0xa0')){for(var _0x2237ea=0x0;_0x2237ea<_0x5ddbcd[_0xeb1b('0x4e')];_0x2237ea++){_0x5ddbcd[_0x2237ea]['body']=juice(_0x5ddbcd[_0x2237ea][_0xeb1b('0x61')]);}}_0x326544[_0xeb1b('0x5e')]=_0x5ddbcd;return _0x326544;});}})['then'](respondWithFilteredResult(_0x438c08,_0x191dee))[_0xeb1b('0x1a')](handleError(_0x438c08,null));};exports[_0xeb1b('0x2a')]=function(_0x186c01,_0x4ff5fa){var _0x291aeb,_0x5a98b2={},_0x37bf4a;if(_0x186c01[_0xeb1b('0x61')]['to']){_0x37bf4a=_0x186c01['body']['to'][_0xeb1b('0x9c')](',')[0x0];}return db[_0xeb1b('0x46')][_0xeb1b('0x60')]({'where':{'id':_0x186c01[_0xeb1b('0x5f')]['id']},'include':[{'model':db[_0xeb1b('0xa1')],'as':_0xeb1b('0xa2'),'include':[{'model':db[_0xeb1b('0x87')],'as':_0xeb1b('0xa3'),'where':{'email':_0x37bf4a},'limit':0x1,'order':[[_0xeb1b('0xa4'),'DESC']]}]},{'model':db[_0xeb1b('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xeb1b('0xa5')],'as':_0xeb1b('0xa5'),'raw':!![]}]}]})[_0xeb1b('0x10')](handleEntityNotFound(_0x4ff5fa,null))[_0xeb1b('0x10')](function(_0x2bab8e){if(!_0x2bab8e)return;_0x291aeb=_0x2bab8e;if(!_0x2bab8e[_0xeb1b('0x40')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xeb1b('0x75')](_0x186c01['body'][_0xeb1b('0xa6')])){_0x186c01[_0xeb1b('0x61')][_0xeb1b('0xa6')]=util[_0xeb1b('0x9d')](_0xeb1b('0xa7'),_0x2bab8e[_0xeb1b('0x29')],_0x2bab8e[_0xeb1b('0x73')]||_0x2bab8e[_0xeb1b('0x40')]['user']);}if(_0x186c01['body'][_0xeb1b('0xa8')]&&_0x186c01[_0xeb1b('0x61')]['attachments'][_0xeb1b('0x4e')]){for(var _0x1c1aaa=0x0;_0x1c1aaa<_0x186c01['body']['attachments'][_0xeb1b('0x4e')];_0x1c1aaa+=0x1){_0x186c01['body'][_0xeb1b('0xa8')][_0x1c1aaa]={'filename':_0x186c01[_0xeb1b('0x61')][_0xeb1b('0xa8')][_0x1c1aaa][_0xeb1b('0x29')],'path':path['join'](config[_0xeb1b('0xa9')],_0xeb1b('0xaa'),_0x186c01[_0xeb1b('0x61')]['attachments'][_0x1c1aaa]['basename'])};}}var _0x477e04=_0x2bab8e[_0xeb1b('0xab')]();return respondWithRpcPromise(_0xeb1b('0xac'),_0xeb1b('0xad'),{'account':_0x477e04,'message':_0x186c01[_0xeb1b('0x61')]});})[_0xeb1b('0x10')](function(_0x110f8a){if(!_0x110f8a)return;_0x5a98b2=_0x110f8a;if(!_0x291aeb['List'])throw new Error(_0xeb1b('0xae'));if(_0x291aeb['List'][_0xeb1b('0xa3')][_0xeb1b('0x4e')])return _0x291aeb[_0xeb1b('0xa2')][_0xeb1b('0xa3')][0x0];return db['CmContact']['create'](_['defaults'](_0x186c01[_0xeb1b('0x61')],{'firstName':_0x186c01[_0xeb1b('0x61')]['to'],'email':_0x186c01['body']['to'],'phone':_0x186c01[_0xeb1b('0x61')]['to'],'ListId':_0x291aeb[_0xeb1b('0x74')]}));})[_0xeb1b('0x10')](function(_0x50f308){if(!_0x50f308)return;var _0x3a3cd3={'UserId':_0x186c01['user']['id'],'ContactId':_0x50f308['id'],'MailAccountId':_0x291aeb['id'],'inReplyTo':_0x5a98b2[_0xeb1b('0xaf')],'to':_0x186c01[_0xeb1b('0x61')][_0xeb1b('0xa6')],'cc':_0x186c01['body']['cc'],'subject':_0x186c01[_0xeb1b('0x61')][_0xeb1b('0xb0')],'attach':_0x186c01[_0xeb1b('0x61')]['attach'],'firstMsgDirection':_0xeb1b('0xb1'),'lastMsgAt':moment()[_0xeb1b('0x9d')](_0xeb1b('0xb2')),'lastMsgDirection':_0xeb1b('0xb1'),'Messages':[_[_0xeb1b('0x56')](_0x186c01[_0xeb1b('0x61')],{'messageId':_0x5a98b2['messageId'],'sentAt':moment()[_0xeb1b('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x291aeb['id'],'UserId':_0x186c01[_0xeb1b('0x36')]['id'],'ContactId':_0x50f308['id']})]};if(_0x186c01['body'][_0xeb1b('0xb3')]){_0x3a3cd3=_[_0xeb1b('0x56')](_0x3a3cd3,_0x186c01[_0xeb1b('0x61')]['Interaction']);}return db[_0xeb1b('0x85')][_0xeb1b('0x6a')](_0x3a3cd3,{'include':[{'model':db[_0xeb1b('0x9e')],'as':_0xeb1b('0xb4')}]});})[_0xeb1b('0x10')](respondWithResult(_0x4ff5fa,null))[_0xeb1b('0x1a')](handleError(_0x4ff5fa,null));};exports[_0xeb1b('0xb5')]=function(_0x309465,_0x2987bf){return db[_0xeb1b('0x46')][_0xeb1b('0x60')]({'where':{'id':_0x309465['params']['id']},'include':[{'model':db[_0xeb1b('0x42')],'as':_0xeb1b('0x40'),'raw':!![],'include':[{'model':db[_0xeb1b('0xa5')],'as':_0xeb1b('0xa5'),'raw':!![]}]}]})[_0xeb1b('0x10')](handleEntityNotFound(_0x2987bf,null))['then'](function(_0x5e660b){if(!_0x5e660b['Smtp'])return;var _0x14f048=_0x5e660b[_0xeb1b('0xab')]();return respondWithRpcPromise(_0xeb1b('0xb6'),'verifySmtp',{'account':_0x14f048});})['then'](respondWithResult(_0x2987bf,null))[_0xeb1b('0x1a')](handleError(_0x2987bf,null));};exports['destroy']=function(_0x5f81b6,_0x39cc18){return db[_0xeb1b('0x46')][_0xeb1b('0x60')]({'where':{'id':_0x5f81b6[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x39cc18,null))['then'](function(_0x3e660d){if(_0x3e660d&&_0x3e660d[_0xeb1b('0x3d')]){throw new db['Sequelize']['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3e660d;})[_0xeb1b('0x10')](removeEntity(_0x39cc18,null))['catch'](handleError(_0x39cc18,null));};exports[_0xeb1b('0xb7')]=function(_0x27ceb7,_0x55cd59){return db[_0xeb1b('0x46')][_0xeb1b('0x60')]({'where':{'id':_0x27ceb7[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x55cd59,null))[_0xeb1b('0x10')](function(_0x3ba708){if(_0x3ba708){return _0x3ba708[_0xeb1b('0xb7')](_0x27ceb7[_0xeb1b('0x61')][_0xeb1b('0x6e')],_[_0xeb1b('0xb8')](_0x27ceb7[_0xeb1b('0x61')],[_0xeb1b('0x6e'),'id'])||{})['spread'](function(_0x29affd){for(var _0x331315=0x0;_0x331315<_0x27ceb7[_0xeb1b('0x61')]['ids']['length'];_0x331315+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x27ceb7[_0xeb1b('0x61')]['ids'][_0x331315]),'MailAccountId':Number(_0x27ceb7[_0xeb1b('0x5f')]['id'])});}return _0x29affd;});}})['then'](respondWithResult(_0x55cd59,null))[_0xeb1b('0x1a')](handleError(_0x55cd59,null));};exports['removeAgents']=function(_0xfa3fcd,_0x155baa){return db[_0xeb1b('0x46')]['find']({'where':{'id':_0xfa3fcd[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x155baa,null))[_0xeb1b('0x10')](function(_0x363dd8){if(_0x363dd8){return _0x363dd8[_0xeb1b('0xb9')](_0xfa3fcd['query'][_0xeb1b('0x6e')])[_0xeb1b('0x10')](function(){if(_['isArray'](_0xfa3fcd['query'][_0xeb1b('0x6e')])){for(var _0xe1d938=0x0;_0xe1d938<_0xfa3fcd[_0xeb1b('0x49')][_0xeb1b('0x6e')][_0xeb1b('0x4e')];_0xe1d938+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0xfa3fcd['query'][_0xeb1b('0x6e')][_0xe1d938]),'MailAccountId':Number(_0xfa3fcd[_0xeb1b('0x5f')]['id'])});}}else{socket[_0xeb1b('0xba')]('userMailAccount:remove',{'UserId':Number(_0xfa3fcd[_0xeb1b('0x49')]['ids']),'MailAccountId':Number(_0xfa3fcd[_0xeb1b('0x5f')]['id'])});}});}})[_0xeb1b('0x10')](respondWithStatusCode(_0x155baa,null))[_0xeb1b('0x1a')](handleError(_0x155baa,null));};exports[_0xeb1b('0xbb')]=function(_0x1aaff5,_0x679d2a){var _0x289070={};var _0x3cf332={};var _0x59952f;var _0x5b984f;return db['MailAccount'][_0xeb1b('0x6c')]({'where':{'id':_0x1aaff5[_0xeb1b('0x5f')]['id']}})[_0xeb1b('0x10')](handleEntityNotFound(_0x679d2a,null))[_0xeb1b('0x10')](function(_0x337243){if(_0x337243){_0x59952f=_0x337243;_0x3cf332['model']=_[_0xeb1b('0x48')](db[_0xeb1b('0xbc')]['rawAttributes']);_0x3cf332['query']=_[_0xeb1b('0x48')](_0x1aaff5['query']);_0x3cf332[_0xeb1b('0x54')]=_['intersection'](_0x3cf332['model'],_0x3cf332['query']);_0x289070['attributes']=_[_0xeb1b('0x4a')](_0x3cf332[_0xeb1b('0x4b')],qs[_0xeb1b('0x4d')](_0x1aaff5[_0xeb1b('0x49')]['fields']));_0x289070[_0xeb1b('0x4c')]=_0x289070[_0xeb1b('0x4c')][_0xeb1b('0x4e')]?_0x289070[_0xeb1b('0x4c')]:_0x3cf332[_0xeb1b('0x4b')];_0x289070[_0xeb1b('0x51')]=qs[_0xeb1b('0x52')](_0x1aaff5[_0xeb1b('0x49')][_0xeb1b('0x52')]);_0x289070[_0xeb1b('0x53')]=qs[_0xeb1b('0x54')](_[_0xeb1b('0x70')](_0x1aaff5[_0xeb1b('0x49')],_0x3cf332[_0xeb1b('0x54')]));if(_0x1aaff5[_0xeb1b('0x49')][_0xeb1b('0x55')]){_0x289070[_0xeb1b('0x53')]=_[_0xeb1b('0x56')](_0x289070[_0xeb1b('0x53')],{'$or':_[_0xeb1b('0x45')](_0x289070[_0xeb1b('0x4c')],function(_0x3a7c65){var _0x201cf4={};_0x201cf4[_0x3a7c65]={'$like':'%'+_0x1aaff5[_0xeb1b('0x49')][_0xeb1b('0x55')]+'%'};return _0x201cf4;})});}_0x289070=_[_0xeb1b('0x56')]({},_0x289070,_0x1aaff5[_0xeb1b('0x59')]);return _0x59952f[_0xeb1b('0xbb')](_0x289070);}})[_0xeb1b('0x10')](function(_0x5c0bc2){if(_0x5c0bc2){_0x5b984f=_0x5c0bc2[_0xeb1b('0x4e')];if(!_0x1aaff5['query'][_0xeb1b('0x4f')](_0xeb1b('0x50'))){_0x289070[_0xeb1b('0x1f')]=qs[_0xeb1b('0x1f')](_0x1aaff5[_0xeb1b('0x49')][_0xeb1b('0x1f')]);_0x289070[_0xeb1b('0x20')]=qs[_0xeb1b('0x20')](_0x1aaff5[_0xeb1b('0x49')][_0xeb1b('0x20')]);}return _0x59952f['getAgents'](_0x289070);}})[_0xeb1b('0x10')](function(_0x325f0b){if(_0x325f0b){return _0x325f0b?{'count':_0x5b984f,'rows':_0x325f0b}:null;}})['then'](respondWithResult(_0x679d2a,null))[_0xeb1b('0x1a')](handleError(_0x679d2a,null));}; \ No newline at end of file +var _0xd6bc=['debug','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','UserProfileResource','end','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','user','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','MailAccount','rows','keys','find','body','custom','provider','Mail\x20Account\x20not\x20found','MailServerIn','describe','addDisposition','params','Disposition','create','getDispositions','findOne','MailAccountId','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','email','ListId','isNil','active','description','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','CmContact','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','defaults','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent'];(function(_0xd1855b,_0x359007){var _0x4992a2=function(_0x5e2f7a){while(--_0x5e2f7a){_0xd1855b['push'](_0xd1855b['shift']());}};_0x4992a2(++_0x359007);}(_0xd6bc,0x16e));var _0xcd6b=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd6bc[_0xaa0309];return _0x5de7ce;};'use strict';var moment=require('moment');var BPromise=require(_0xcd6b('0x0'));var util=require(_0xcd6b('0x1'));var path=require(_0xcd6b('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xcd6b('0x3'));var logger=require('../../config/logger')(_0xcd6b('0x4'));var config=require(_0xcd6b('0x5'));var db=require(_0xcd6b('0x6'))['db'];config[_0xcd6b('0x7')]=_['defaults'](config[_0xcd6b('0x7')],{'host':_0xcd6b('0x8'),'port':0x18eb});var socket=require(_0xcd6b('0x9'))(new Redis(config[_0xcd6b('0x7')]));require(_0xcd6b('0xa'))[_0xcd6b('0xb')](socket);var jayson=require(_0xcd6b('0xc'));var client=jayson[_0xcd6b('0xd')][_0xcd6b('0xe')]({'port':0x232b});function respondWithRpcPromise(_0xf9bbfa,_0x477ddc,_0x19727c,_0x23c1bc){return new BPromise(function(_0x2c5524,_0x2ac8ea){var _0x2028e8=_0x23c1bc||client;return _0x2028e8[_0xcd6b('0xf')](_0xf9bbfa,_0x19727c)[_0xcd6b('0x10')](function(_0x42038e){logger[_0xcd6b('0x11')](_0xcd6b('0x12'),_0x477ddc,_0xcd6b('0x13'));logger[_0xcd6b('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x477ddc,_0xcd6b('0x13'),JSON[_0xcd6b('0x15')](_0x42038e));if(_0x42038e[_0xcd6b('0x16')]){if(_0x42038e['error']['code']===0x1f4){logger[_0xcd6b('0x16')](_0xcd6b('0x12'),_0x477ddc,_0x42038e['error']['message']);return _0x2ac8ea(_0x42038e['error'][_0xcd6b('0x17')]);}logger[_0xcd6b('0x16')](_0xcd6b('0x12'),_0x477ddc,_0x42038e[_0xcd6b('0x16')][_0xcd6b('0x17')]);return _0x2c5524(_0x42038e[_0xcd6b('0x16')][_0xcd6b('0x17')]);}else{logger[_0xcd6b('0x11')](_0xcd6b('0x12'),_0x477ddc,_0xcd6b('0x13'));_0x2c5524(_0x42038e[_0xcd6b('0x18')][_0xcd6b('0x17')]);}})[_0xcd6b('0x19')](function(_0x2071a6){logger[_0xcd6b('0x16')](_0xcd6b('0x12'),_0x477ddc,_0x2071a6);_0x2ac8ea(_0x2071a6);});});}function respondWithStatusCode(_0x1fd877,_0x2e8497){_0x2e8497=_0x2e8497||0xcc;return function(_0x117772){if(_0x117772){return _0x1fd877[_0xcd6b('0x1a')](_0x2e8497);}return _0x1fd877[_0xcd6b('0x1b')](_0x2e8497)['end']();};}function respondWithResult(_0x4d9bc7,_0x1a064c){_0x1a064c=_0x1a064c||0xc8;return function(_0x715293){if(_0x715293){return _0x4d9bc7[_0xcd6b('0x1b')](_0x1a064c)[_0xcd6b('0x1c')](_0x715293);}};}function respondWithFilteredResult(_0x1fce15,_0x33427c){return function(_0x4b7a1d){if(_0x4b7a1d){var _0x27d0e1=typeof _0x33427c[_0xcd6b('0x1d')]==='undefined'&&typeof _0x33427c[_0xcd6b('0x1e')]===_0xcd6b('0x1f');var _0x30470a=_0x4b7a1d[_0xcd6b('0x20')];var _0x27acaa=_0x27d0e1?0x0:_0x33427c['offset'];var _0xa2b9c5=_0x27d0e1?_0x4b7a1d[_0xcd6b('0x20')]:_0x33427c['offset']+_0x33427c['limit'];var _0x2ad6d2;if(_0xa2b9c5>=_0x30470a){_0xa2b9c5=_0x30470a;_0x2ad6d2=0xc8;}else{_0x2ad6d2=0xce;}_0x1fce15[_0xcd6b('0x1b')](_0x2ad6d2);return _0x1fce15[_0xcd6b('0x21')](_0xcd6b('0x22'),_0x27acaa+'-'+_0xa2b9c5+'/'+_0x30470a)[_0xcd6b('0x1c')](_0x4b7a1d);}return null;};}function saveUpdates(_0x37d2de){return function(_0x12de51){if(_0x12de51){return _0x12de51[_0xcd6b('0x23')](_0x37d2de)[_0xcd6b('0x10')](function(_0x32e5ca){return _0x32e5ca;});}return null;};}function removeEntity(_0x239319){return function(_0x464ba7){if(_0x464ba7){return _0x464ba7[_0xcd6b('0x24')]()[_0xcd6b('0x10')](function(){var _0x1be13c=_0x464ba7[_0xcd6b('0x25')]({'plain':!![]});var _0x435230='MailAccounts';return db[_0xcd6b('0x26')][_0xcd6b('0x24')]({'where':{'type':_0x435230,'resourceId':_0x1be13c['id']}})['then'](function(){return _0x464ba7;});})[_0xcd6b('0x10')](function(){_0x239319[_0xcd6b('0x1b')](0xcc)[_0xcd6b('0x27')]();});}};}function handleEntityNotFound(_0x16613e){return function(_0x39c8cb){if(!_0x39c8cb){_0x16613e[_0xcd6b('0x1a')](0x194);}return _0x39c8cb;};}function handleError(_0x4fb876,_0x5ab2a7){_0x5ab2a7=_0x5ab2a7||0x1f4;return function(_0x120f1d){logger[_0xcd6b('0x16')](_0x120f1d[_0xcd6b('0x28')]);if(_0x120f1d['name']){delete _0x120f1d[_0xcd6b('0x29')];}_0x4fb876['status'](_0x5ab2a7)['send'](_0x120f1d);};}function getImapHost(_0x2e3361){switch(_0x2e3361){case _0xcd6b('0x2a'):return _0xcd6b('0x2b');case _0xcd6b('0x2c'):return _0xcd6b('0x2d');case _0xcd6b('0x2e'):return _0xcd6b('0x2f');case _0xcd6b('0x30'):return _0xcd6b('0x31');}throw new Error(_0xcd6b('0x32'),_0x2e3361);}function getSmtpHost(_0x4bb2e6){switch(_0x4bb2e6){case _0xcd6b('0x2a'):return _0xcd6b('0x33');case'yahoo':return _0xcd6b('0x34');case'hotmail':return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x4bb2e6);}function getAuthenticationOptions(_0x2b449b,_0x423938){var _0x231e7a={};var _0x43a51c={};if(_0x2b449b){_0x231e7a[_0xcd6b('0x35')]=_0x43a51c[_0xcd6b('0x35')]=_0x423938['username'];_0x231e7a['password']=_0x43a51c[_0xcd6b('0x36')]=_0x423938['password'];if(_0x423938[_0xcd6b('0x37')]){_0x231e7a[_0xcd6b('0x37')]=_0x43a51c[_0xcd6b('0x37')]=!![];_0x231e7a[_0xcd6b('0x38')]=_0x43a51c[_0xcd6b('0x38')]=_0x423938[_0xcd6b('0x38')];_0x231e7a[_0xcd6b('0x39')]=_0x43a51c[_0xcd6b('0x36')]=null;}else{_0x231e7a[_0xcd6b('0x38')]=_0x43a51c['CloudProviderId']=null;}_0x231e7a[_0xcd6b('0x3a')]=getImapHost(_0x2b449b);_0x231e7a[_0xcd6b('0x3b')]=0x3e1;_0x43a51c['host']=getSmtpHost(_0x2b449b);_0x43a51c[_0xcd6b('0x3b')]=0x24b;_0x43a51c[_0xcd6b('0x3c')]=![];_0x231e7a[_0xcd6b('0x3d')]=_0x43a51c['service']=null;}else{if(_0x423938[_0xcd6b('0x3e')]){_0x231e7a[_0xcd6b('0x35')]=_0x43a51c[_0xcd6b('0x35')]=_0x423938['username'];_0x231e7a[_0xcd6b('0x39')]=_0x43a51c['pass']=_0x423938[_0xcd6b('0x39')];}else{_0x231e7a[_0xcd6b('0x3e')]=_0x43a51c[_0xcd6b('0x3e')]=![];_0x231e7a[_0xcd6b('0x35')]=_0x43a51c[_0xcd6b('0x35')]=null;_0x231e7a[_0xcd6b('0x39')]=_0x43a51c[_0xcd6b('0x36')]=null;}_0x231e7a[_0xcd6b('0x3a')]=_0x423938[_0xcd6b('0x3f')][_0xcd6b('0x3a')];_0x231e7a['port']=_0x423938[_0xcd6b('0x3f')][_0xcd6b('0x3b')];_0x43a51c[_0xcd6b('0x3a')]=_0x423938[_0xcd6b('0x40')][_0xcd6b('0x3a')];_0x43a51c['port']=_0x423938['Smtp'][_0xcd6b('0x3b')];}return{'Imap':_0x231e7a,'Smtp':_0x43a51c};}exports[_0xcd6b('0x41')]=function(_0x5b84fe,_0x48970b){var _0x22fb74={'include':[{'model':db['MailServerIn'],'as':_0xcd6b('0x3f')},{'model':db[_0xcd6b('0x42')],'as':_0xcd6b('0x40')},{'model':db[_0xcd6b('0x43')],'as':_0xcd6b('0x44')}]},_0x52a2e1={},_0x2e3b37={'count':0x0,'rows':[]};var _0xb0f953=_[_0xcd6b('0x45')](db['MailAccount'][_0xcd6b('0x46')],function(_0x593dc3){return{'name':_0x593dc3['fieldName'],'type':_0x593dc3['type']['key']};});_0x52a2e1[_0xcd6b('0x47')]=_[_0xcd6b('0x45')](_0xb0f953,'name');_0x52a2e1[_0xcd6b('0x48')]=_['keys'](_0x5b84fe['query']);_0x52a2e1['filters']=_[_0xcd6b('0x49')](_0x52a2e1['model'],_0x52a2e1[_0xcd6b('0x48')]);_0x22fb74['attributes']=_[_0xcd6b('0x49')](_0x52a2e1[_0xcd6b('0x47')],qs[_0xcd6b('0x4a')](_0x5b84fe[_0xcd6b('0x48')][_0xcd6b('0x4a')]));_0x22fb74[_0xcd6b('0x4b')]=_0x22fb74[_0xcd6b('0x4b')][_0xcd6b('0x4c')]?_0x22fb74[_0xcd6b('0x4b')]:_0x52a2e1[_0xcd6b('0x47')];if(!_0x5b84fe[_0xcd6b('0x48')]['hasOwnProperty'](_0xcd6b('0x4d'))){_0x22fb74[_0xcd6b('0x1e')]=qs['limit'](_0x5b84fe[_0xcd6b('0x48')][_0xcd6b('0x1e')]);_0x22fb74[_0xcd6b('0x1d')]=qs[_0xcd6b('0x1d')](_0x5b84fe[_0xcd6b('0x48')][_0xcd6b('0x1d')]);}_0x22fb74[_0xcd6b('0x4e')]=qs[_0xcd6b('0x4f')](_0x5b84fe['query'][_0xcd6b('0x4f')]);_0x22fb74[_0xcd6b('0x50')]=qs[_0xcd6b('0x51')](_[_0xcd6b('0x52')](_0x5b84fe[_0xcd6b('0x48')],_0x52a2e1[_0xcd6b('0x51')]),_0xb0f953);if(_0x5b84fe[_0xcd6b('0x48')]['filter']){_0x22fb74[_0xcd6b('0x50')]=_[_0xcd6b('0x53')](_0x22fb74['where'],{'$or':_[_0xcd6b('0x45')](_0xb0f953,function(_0xc2b45){if(_0xc2b45[_0xcd6b('0x54')]!==_0xcd6b('0x55')){var _0xa15d54={};_0xa15d54[_0xc2b45[_0xcd6b('0x29')]]={'$like':'%'+_0x5b84fe[_0xcd6b('0x48')]['filter']+'%'};return _0xa15d54;}})});}_0x22fb74=_[_0xcd6b('0x53')]({},_0x22fb74,_0x5b84fe[_0xcd6b('0x56')]);var _0x2d7a12={'where':_0x22fb74[_0xcd6b('0x50')]};return db['MailAccount'][_0xcd6b('0x20')](_0x2d7a12)[_0xcd6b('0x10')](function(_0x56bb2e){_0x2e3b37[_0xcd6b('0x20')]=_0x56bb2e;if(_0x5b84fe[_0xcd6b('0x48')][_0xcd6b('0x57')]){_0x22fb74[_0xcd6b('0x58')]=[{'all':!![]}];}return db[_0xcd6b('0x59')]['findAll'](_0x22fb74);})[_0xcd6b('0x10')](function(_0x1966c9){_0x2e3b37[_0xcd6b('0x5a')]=_0x1966c9;return _0x2e3b37;})['then'](respondWithFilteredResult(_0x48970b,_0x22fb74))[_0xcd6b('0x19')](handleError(_0x48970b,null));};exports['show']=function(_0xcd2d96,_0x5d84d2){var _0x41b62f={'raw':![],'where':{'id':_0xcd2d96['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xcd6b('0x3f')},{'model':db[_0xcd6b('0x42')],'as':_0xcd6b('0x40')},{'model':db[_0xcd6b('0x43')],'as':_0xcd6b('0x44')}]},_0x1adb88={};_0x1adb88[_0xcd6b('0x47')]=_['keys'](db[_0xcd6b('0x59')][_0xcd6b('0x46')]);_0x1adb88[_0xcd6b('0x48')]=_[_0xcd6b('0x5b')](_0xcd2d96[_0xcd6b('0x48')]);_0x1adb88[_0xcd6b('0x51')]=_['intersection'](_0x1adb88[_0xcd6b('0x47')],_0x1adb88['query']);_0x41b62f[_0xcd6b('0x4b')]=_[_0xcd6b('0x49')](_0x1adb88['model'],qs[_0xcd6b('0x4a')](_0xcd2d96[_0xcd6b('0x48')]['fields']));_0x41b62f[_0xcd6b('0x4b')]=_0x41b62f[_0xcd6b('0x4b')]['length']?_0x41b62f[_0xcd6b('0x4b')]:_0x1adb88['model'];if(_0xcd2d96['query'][_0xcd6b('0x57')]){_0x41b62f['include']=[{'all':!![]}];}_0x41b62f=_[_0xcd6b('0x53')]({},_0x41b62f,_0xcd2d96[_0xcd6b('0x56')]);return db[_0xcd6b('0x59')][_0xcd6b('0x5c')](_0x41b62f)[_0xcd6b('0x10')](handleEntityNotFound(_0x5d84d2,null))[_0xcd6b('0x10')](respondWithResult(_0x5d84d2,null))[_0xcd6b('0x19')](handleError(_0x5d84d2,null));};exports[_0xcd6b('0x23')]=function(_0x5c4a71,_0x146ffa){if(_0x5c4a71[_0xcd6b('0x5d')]['id']){delete _0x5c4a71[_0xcd6b('0x5d')]['id'];}var _0xfea49c=_0x5c4a71['body']['provider']===_0xcd6b('0x5e')?null:_0x5c4a71[_0xcd6b('0x5d')][_0xcd6b('0x5f')];var _0x552ff4=_0x5c4a71[_0xcd6b('0x5d')][_0xcd6b('0x3f')]||{};var _0x274367=_0x5c4a71['body'][_0xcd6b('0x40')]||{};if(_0xfea49c){_0x552ff4[_0xcd6b('0x3a')]=getImapHost(_0xfea49c);_0x552ff4[_0xcd6b('0x3b')]=0x3e1;_0x274367[_0xcd6b('0x3a')]=getSmtpHost(_0xfea49c);_0x274367['port']=0x24b;_0x274367[_0xcd6b('0x3c')]=![];}if(_0x274367[_0xcd6b('0x37')]){_0x274367[_0xcd6b('0x3c')]=![];}else{_0x274367['CloudProviderId']=null;}if(!_0x552ff4[_0xcd6b('0x37')])_0x552ff4[_0xcd6b('0x38')]=null;_0x5c4a71[_0xcd6b('0x5d')][_0xcd6b('0x3f')]=_0x552ff4;_0x5c4a71[_0xcd6b('0x5d')]['Smtp']=_0x274367;return db['MailAccount'][_0xcd6b('0x5c')]({'where':{'id':_0x5c4a71['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xcd6b('0x3f')},{'model':db[_0xcd6b('0x42')],'as':_0xcd6b('0x40')},{'model':db[_0xcd6b('0x43')],'as':'mandatoryDispositionPause'}]})[_0xcd6b('0x10')](handleEntityNotFound(_0x146ffa,null))[_0xcd6b('0x10')](function(_0x5a8187){if(!_0x5a8187)throw new Error(_0xcd6b('0x60'));if(_0x5a8187[_0xcd6b('0x3d')])delete _0x5c4a71[_0xcd6b('0x5d')]['Imap'];return _0x5a8187;})['then'](saveUpdates(_0x5c4a71[_0xcd6b('0x5d')],null))[_0xcd6b('0x10')](function(_0x27c046){if(!_0x5c4a71[_0xcd6b('0x5d')][_0xcd6b('0x3f')])return _0x27c046;return db[_0xcd6b('0x61')]['update'](_0x5c4a71[_0xcd6b('0x5d')][_0xcd6b('0x3f')],{'where':{'MailAccountId':_0x27c046['id']}})[_0xcd6b('0x10')](function(){return _0x27c046;});})['then'](function(_0x46bd33){if(!_0x5c4a71[_0xcd6b('0x5d')][_0xcd6b('0x40')])return _0x46bd33;return db[_0xcd6b('0x42')][_0xcd6b('0x23')](_0x5c4a71[_0xcd6b('0x5d')][_0xcd6b('0x40')],{'where':{'MailAccountId':_0x46bd33['id']}})[_0xcd6b('0x10')](function(){return _0x46bd33;});})['then'](respondWithResult(_0x146ffa,null))[_0xcd6b('0x19')](handleError(_0x146ffa,null));};exports[_0xcd6b('0x62')]=function(_0x202ec4,_0x4d3dd7){return db[_0xcd6b('0x59')][_0xcd6b('0x62')]()['then'](respondWithResult(_0x4d3dd7,null))['catch'](handleError(_0x4d3dd7,null));};exports[_0xcd6b('0x63')]=function(_0xbf5f4c,_0x2e9276){if(_0xbf5f4c['body']['id']){delete _0xbf5f4c[_0xcd6b('0x5d')]['id'];}return db[_0xcd6b('0x59')][_0xcd6b('0x5c')]({'where':{'id':_0xbf5f4c[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x2e9276,null))[_0xcd6b('0x10')](function(_0x120f7f){if(_0x120f7f){_0xbf5f4c['body']['MailAccountId']=_0x120f7f['id'];return db[_0xcd6b('0x65')][_0xcd6b('0x66')](_0xbf5f4c[_0xcd6b('0x5d')]);}})[_0xcd6b('0x10')](respondWithResult(_0x2e9276,null))[_0xcd6b('0x19')](handleError(_0x2e9276,null));};exports[_0xcd6b('0x67')]=function(_0x4844e6,_0x150cc9){var _0x3453f8={'raw':![],'where':{}};var _0x2731e5={};var _0x531b35={'count':0x0,'rows':[]};return db[_0xcd6b('0x59')][_0xcd6b('0x68')]({'where':{'id':_0x4844e6[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x150cc9,null))[_0xcd6b('0x10')](function(_0x1b0430){if(_0x1b0430){_0x2731e5[_0xcd6b('0x47')]=_[_0xcd6b('0x5b')](db[_0xcd6b('0x65')]['rawAttributes']);_0x2731e5[_0xcd6b('0x48')]=_['keys'](_0x4844e6[_0xcd6b('0x48')]);_0x2731e5[_0xcd6b('0x51')]=_['intersection'](_0x2731e5[_0xcd6b('0x47')],_0x2731e5[_0xcd6b('0x48')]);_0x3453f8['attributes']=_['intersection'](_0x2731e5[_0xcd6b('0x47')],qs[_0xcd6b('0x4a')](_0x4844e6['query'][_0xcd6b('0x4a')]));_0x3453f8[_0xcd6b('0x4b')]=_0x3453f8[_0xcd6b('0x4b')]['length']?_0x3453f8[_0xcd6b('0x4b')]:_0x2731e5[_0xcd6b('0x47')];if(!_0x4844e6[_0xcd6b('0x48')]['hasOwnProperty']('nolimit')){_0x3453f8[_0xcd6b('0x1e')]=qs[_0xcd6b('0x1e')](_0x4844e6[_0xcd6b('0x48')]['limit']);_0x3453f8[_0xcd6b('0x1d')]=qs[_0xcd6b('0x1d')](_0x4844e6[_0xcd6b('0x48')][_0xcd6b('0x1d')]);}_0x3453f8['order']=qs[_0xcd6b('0x4f')](_0x4844e6[_0xcd6b('0x48')][_0xcd6b('0x4f')]);_0x3453f8['where']=qs['filters'](_[_0xcd6b('0x52')](_0x4844e6[_0xcd6b('0x48')],_0x2731e5[_0xcd6b('0x51')]));_0x3453f8[_0xcd6b('0x50')][_0xcd6b('0x69')]=_0x1b0430['id'];if(_0x4844e6[_0xcd6b('0x48')][_0xcd6b('0x6a')]){_0x3453f8[_0xcd6b('0x50')]=_[_0xcd6b('0x53')](_0x3453f8['where'],{'$or':_[_0xcd6b('0x45')](_0x3453f8[_0xcd6b('0x4b')],function(_0x50d4e5){var _0x55d81c={};_0x55d81c[_0x50d4e5]={'$like':'%'+_0x4844e6[_0xcd6b('0x48')][_0xcd6b('0x6a')]+'%'};return _0x55d81c;})});}_0x3453f8=_[_0xcd6b('0x53')]({},_0x3453f8,_0x4844e6[_0xcd6b('0x56')]);return db[_0xcd6b('0x65')][_0xcd6b('0x20')]({'where':_0x3453f8[_0xcd6b('0x50')]})[_0xcd6b('0x10')](function(_0x189c4a){_0x531b35[_0xcd6b('0x20')]=_0x189c4a;if(_0x4844e6[_0xcd6b('0x48')][_0xcd6b('0x57')]){_0x3453f8[_0xcd6b('0x58')]=[{'all':!![]}];}return db[_0xcd6b('0x65')][_0xcd6b('0x6b')](_0x3453f8);})['then'](function(_0x208894){_0x531b35[_0xcd6b('0x5a')]=_0x208894;return _0x531b35;});}})[_0xcd6b('0x10')](respondWithFilteredResult(_0x150cc9,_0x3453f8))[_0xcd6b('0x19')](handleError(_0x150cc9,null));};exports[_0xcd6b('0x6c')]=function(_0x576a03,_0x1b6326){return db[_0xcd6b('0x59')]['find']({'where':{'id':_0x576a03[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x1b6326,null))[_0xcd6b('0x10')](function(_0x112d5e){if(_0x112d5e){return _0x112d5e[_0xcd6b('0x6c')](_0x576a03[_0xcd6b('0x48')][_0xcd6b('0x6d')]);}})['then'](respondWithStatusCode(_0x1b6326,null))[_0xcd6b('0x19')](handleError(_0x1b6326,null));};exports[_0xcd6b('0x6e')]=function(_0x270555,_0x22aea5){if(_0x270555[_0xcd6b('0x5d')]['id']){delete _0x270555[_0xcd6b('0x5d')]['id'];}return db[_0xcd6b('0x59')][_0xcd6b('0x5c')]({'where':{'id':_0x270555[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x22aea5,null))['then'](function(_0x2793fa){if(_0x2793fa){_0x270555['body'][_0xcd6b('0x69')]=_0x2793fa['id'];return db[_0xcd6b('0x6f')][_0xcd6b('0x66')](_0x270555[_0xcd6b('0x5d')]);}})['then'](respondWithResult(_0x22aea5,null))[_0xcd6b('0x19')](handleError(_0x22aea5,null));};exports['getAnswers']=function(_0x20471e,_0x5d22a1){var _0x7b0807={'raw':![],'where':{}};var _0xfae57c={};var _0x2f1336={'count':0x0,'rows':[]};return db[_0xcd6b('0x59')]['findOne']({'where':{'id':_0x20471e[_0xcd6b('0x64')]['id']}})['then'](handleEntityNotFound(_0x5d22a1,null))['then'](function(_0x216b0e){if(_0x216b0e){_0xfae57c[_0xcd6b('0x47')]=_[_0xcd6b('0x5b')](db[_0xcd6b('0x6f')][_0xcd6b('0x46')]);_0xfae57c[_0xcd6b('0x48')]=_['keys'](_0x20471e[_0xcd6b('0x48')]);_0xfae57c[_0xcd6b('0x51')]=_[_0xcd6b('0x49')](_0xfae57c['model'],_0xfae57c[_0xcd6b('0x48')]);_0x7b0807[_0xcd6b('0x4b')]=_[_0xcd6b('0x49')](_0xfae57c[_0xcd6b('0x47')],qs[_0xcd6b('0x4a')](_0x20471e[_0xcd6b('0x48')][_0xcd6b('0x4a')]));_0x7b0807[_0xcd6b('0x4b')]=_0x7b0807[_0xcd6b('0x4b')][_0xcd6b('0x4c')]?_0x7b0807[_0xcd6b('0x4b')]:_0xfae57c['model'];if(!_0x20471e[_0xcd6b('0x48')][_0xcd6b('0x70')](_0xcd6b('0x4d'))){_0x7b0807[_0xcd6b('0x1e')]=qs[_0xcd6b('0x1e')](_0x20471e['query']['limit']);_0x7b0807[_0xcd6b('0x1d')]=qs[_0xcd6b('0x1d')](_0x20471e[_0xcd6b('0x48')][_0xcd6b('0x1d')]);}_0x7b0807[_0xcd6b('0x4e')]=qs[_0xcd6b('0x4f')](_0x20471e[_0xcd6b('0x48')][_0xcd6b('0x4f')]);_0x7b0807[_0xcd6b('0x50')]=qs[_0xcd6b('0x51')](_[_0xcd6b('0x52')](_0x20471e[_0xcd6b('0x48')],_0xfae57c[_0xcd6b('0x51')]));_0x7b0807[_0xcd6b('0x50')]['MailAccountId']=_0x216b0e['id'];if(_0x20471e[_0xcd6b('0x48')]['filter']){_0x7b0807[_0xcd6b('0x50')]=_[_0xcd6b('0x53')](_0x7b0807[_0xcd6b('0x50')],{'$or':_[_0xcd6b('0x45')](_0x7b0807[_0xcd6b('0x4b')],function(_0x4003a1){var _0xfd4a0d={};_0xfd4a0d[_0x4003a1]={'$like':'%'+_0x20471e[_0xcd6b('0x48')][_0xcd6b('0x6a')]+'%'};return _0xfd4a0d;})});}_0x7b0807=_['merge']({},_0x7b0807,_0x20471e[_0xcd6b('0x56')]);return db[_0xcd6b('0x6f')][_0xcd6b('0x20')]({'where':_0x7b0807[_0xcd6b('0x50')]})[_0xcd6b('0x10')](function(_0x4b45cc){_0x2f1336[_0xcd6b('0x20')]=_0x4b45cc;if(_0x20471e[_0xcd6b('0x48')][_0xcd6b('0x57')]){_0x7b0807[_0xcd6b('0x58')]=[{'all':!![]}];}return db[_0xcd6b('0x6f')]['findAll'](_0x7b0807);})['then'](function(_0xe007ee){_0x2f1336[_0xcd6b('0x5a')]=_0xe007ee;return _0x2f1336;});}})[_0xcd6b('0x10')](respondWithFilteredResult(_0x5d22a1,_0x7b0807))[_0xcd6b('0x19')](handleError(_0x5d22a1,null));};exports[_0xcd6b('0x71')]=function(_0xb795fc,_0x3539d3){return db[_0xcd6b('0x59')][_0xcd6b('0x5c')]({'where':{'id':_0xb795fc[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x3539d3,null))[_0xcd6b('0x10')](function(_0x515903){if(_0x515903){return _0x515903[_0xcd6b('0x71')](_0xb795fc[_0xcd6b('0x48')][_0xcd6b('0x6d')]);}})[_0xcd6b('0x10')](respondWithStatusCode(_0x3539d3,null))[_0xcd6b('0x19')](handleError(_0x3539d3,null));};exports[_0xcd6b('0x66')]=function(_0x4515eb,_0x31b177){var _0x226be6={'name':_0x4515eb[_0xcd6b('0x5d')][_0xcd6b('0x29')],'key':_0x4515eb[_0xcd6b('0x5d')]['key'],'provider':_0x4515eb[_0xcd6b('0x5d')][_0xcd6b('0x5f')]===_0xcd6b('0x5e')?null:_0x4515eb[_0xcd6b('0x5d')][_0xcd6b('0x5f')],'email':_0x4515eb['body'][_0xcd6b('0x72')],'ListId':_0x4515eb[_0xcd6b('0x5d')][_0xcd6b('0x73')],'active':!_[_0xcd6b('0x74')](_0x4515eb[_0xcd6b('0x5d')][_0xcd6b('0x75')])?_0x4515eb[_0xcd6b('0x5d')][_0xcd6b('0x75')]:!![],'description':_0x4515eb[_0xcd6b('0x5d')][_0xcd6b('0x76')]||null};var _0x173e95=getAuthenticationOptions(_0x226be6['provider'],_0x4515eb[_0xcd6b('0x5d')]);_0x226be6[_0xcd6b('0x3f')]=_0x173e95['Imap'];_0x226be6[_0xcd6b('0x40')]=_0x173e95[_0xcd6b('0x40')];return db[_0xcd6b('0x59')][_0xcd6b('0x66')](_0x226be6,{'include':[{'model':db[_0xcd6b('0x42')],'as':_0xcd6b('0x40')},{'model':db[_0xcd6b('0x61')],'as':_0xcd6b('0x3f')}]})[_0xcd6b('0x10')](function(_0x30f62d){var _0x54483f=_0x4515eb[_0xcd6b('0x35')][_0xcd6b('0x25')]({'plain':!![]});if(!_0x54483f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54483f['role']==='user'){var _0x521ca7=_0x30f62d['get']({'plain':!![]});return db['UserProfileSection'][_0xcd6b('0x5c')]({'where':{'name':_0xcd6b('0x77'),'userProfileId':_0x54483f[_0xcd6b('0x78')]},'raw':!![]})[_0xcd6b('0x10')](function(_0x559db8){if(_0x559db8&&_0x559db8[_0xcd6b('0x79')]===0x0){return db['UserProfileResource'][_0xcd6b('0x66')]({'name':_0x521ca7[_0xcd6b('0x29')],'resourceId':_0x521ca7['id'],'type':_0x559db8[_0xcd6b('0x29')],'sectionId':_0x559db8['id']},{})[_0xcd6b('0x10')](function(){return _0x30f62d;});}else{return _0x30f62d;}})[_0xcd6b('0x19')](function(_0x49f6e3){logger[_0xcd6b('0x16')](_0xcd6b('0x7a'),_0x49f6e3);throw _0x49f6e3;});}return _0x30f62d;})[_0xcd6b('0x10')](respondWithResult(_0x31b177,0xc9))['catch'](handleError(_0x31b177,null));};exports[_0xcd6b('0x7b')]=function(_0x2c5e3a,_0x255acc){return db[_0xcd6b('0x59')][_0xcd6b('0x68')]({'where':{'id':_0x2c5e3a[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x255acc,null))['then'](function(_0x3e9f31){if(_0x3e9f31){return _0x3e9f31[_0xcd6b('0x7b')]();}return null;})[_0xcd6b('0x10')](respondWithResult(_0x255acc,null))[_0xcd6b('0x19')](handleError(_0x255acc,null));};exports['addImap']=function(_0x5e77b4,_0x47c4df){if(_0x5e77b4[_0xcd6b('0x5d')]['id']){delete _0x5e77b4['body']['id'];}return db[_0xcd6b('0x59')][_0xcd6b('0x5c')]({'where':{'id':_0x5e77b4['params']['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x47c4df,null))[_0xcd6b('0x10')](function(_0x1e9573){if(_0x1e9573){_0x5e77b4[_0xcd6b('0x5d')][_0xcd6b('0x69')]=_0x1e9573['id'];return db[_0xcd6b('0x61')][_0xcd6b('0x66')](_0x5e77b4['body']);}})[_0xcd6b('0x10')](respondWithResult(_0x47c4df,null))[_0xcd6b('0x19')](handleError(_0x47c4df,null));};exports[_0xcd6b('0x7c')]=function(_0x239893,_0xc20ccd){return db[_0xcd6b('0x59')][_0xcd6b('0x68')]({'where':{'id':_0x239893[_0xcd6b('0x64')]['id']}})['then'](handleEntityNotFound(_0xc20ccd,null))[_0xcd6b('0x10')](function(_0x26681a){if(_0x26681a){return _0x26681a['setImap'](null);}return null;})[_0xcd6b('0x10')](respondWithStatusCode(_0xc20ccd,null))['catch'](handleError(_0xc20ccd,null));};exports[_0xcd6b('0x7d')]=function(_0x333240,_0x25087f){return db[_0xcd6b('0x59')][_0xcd6b('0x68')]({'where':{'id':_0x333240[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x25087f,null))[_0xcd6b('0x10')](function(_0x3336f8){if(_0x3336f8){return _0x3336f8[_0xcd6b('0x7d')]();}return null;})[_0xcd6b('0x10')](respondWithResult(_0x25087f,null))[_0xcd6b('0x19')](handleError(_0x25087f,null));};exports[_0xcd6b('0x7e')]=function(_0x2ebbc2,_0x102124){if(_0x2ebbc2[_0xcd6b('0x5d')]['id']){delete _0x2ebbc2[_0xcd6b('0x5d')]['id'];}return db[_0xcd6b('0x59')][_0xcd6b('0x5c')]({'where':{'id':_0x2ebbc2[_0xcd6b('0x64')]['id']}})['then'](handleEntityNotFound(_0x102124,null))[_0xcd6b('0x10')](function(_0x4da725){if(_0x4da725){_0x2ebbc2[_0xcd6b('0x5d')][_0xcd6b('0x69')]=_0x4da725['id'];return db[_0xcd6b('0x42')][_0xcd6b('0x66')](_0x2ebbc2[_0xcd6b('0x5d')]);}})['then'](respondWithResult(_0x102124,null))['catch'](handleError(_0x102124,null));};exports['removeSmtp']=function(_0x565f7b,_0x3be944){return db['MailAccount'][_0xcd6b('0x68')]({'where':{'id':_0x565f7b['params']['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x3be944,null))['then'](function(_0x18a429){if(_0x18a429){return _0x18a429[_0xcd6b('0x7f')](null);}return null;})[_0xcd6b('0x10')](respondWithStatusCode(_0x3be944,null))[_0xcd6b('0x19')](handleError(_0x3be944,null));};exports[_0xcd6b('0x80')]=function(_0x94c5ac,_0x406fe0){return db[_0xcd6b('0x81')]['find']({'where':{'id':_0x94c5ac['params']['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x406fe0,null))[_0xcd6b('0x10')](function(_0xbdf3e2){if(_0xbdf3e2){return _0xbdf3e2[_0xcd6b('0x80')](_0x94c5ac['body'][_0xcd6b('0x6d')],_['omit'](_0x94c5ac[_0xcd6b('0x5d')],[_0xcd6b('0x6d'),'id'])||{});}})[_0xcd6b('0x10')](respondWithResult(_0x406fe0,null))['catch'](handleError(_0x406fe0,null));};exports[_0xcd6b('0x82')]=function(_0x24ed49,_0x488068){var _0x41ae7b={'raw':![],'where':{}};var _0x5b7a4a={};var _0xbbc6ff={'count':0x0,'rows':[]};return db[_0xcd6b('0x59')]['findOne']({'where':{'id':_0x24ed49['params']['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x488068,null))[_0xcd6b('0x10')](function(_0x16f8e7){if(_0x16f8e7){_0x5b7a4a[_0xcd6b('0x47')]=_[_0xcd6b('0x5b')](db[_0xcd6b('0x81')][_0xcd6b('0x46')]);_0x5b7a4a[_0xcd6b('0x48')]=_['keys'](_0x24ed49['query']);_0x5b7a4a[_0xcd6b('0x51')]=_['intersection'](_0x5b7a4a['model'],_0x5b7a4a[_0xcd6b('0x48')]);_0x41ae7b[_0xcd6b('0x4b')]=_['intersection'](_0x5b7a4a[_0xcd6b('0x47')],qs[_0xcd6b('0x4a')](_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x4a')]));_0x41ae7b['attributes']=_0x41ae7b[_0xcd6b('0x4b')][_0xcd6b('0x4c')]?_0x41ae7b[_0xcd6b('0x4b')]:_0x5b7a4a[_0xcd6b('0x47')];if(!_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x70')](_0xcd6b('0x4d'))){_0x41ae7b[_0xcd6b('0x1e')]=qs[_0xcd6b('0x1e')](_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x1e')]);_0x41ae7b[_0xcd6b('0x1d')]=qs[_0xcd6b('0x1d')](_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x1d')]);}_0x41ae7b[_0xcd6b('0x4e')]=qs[_0xcd6b('0x4f')](_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x4f')]);_0x41ae7b['where']=qs[_0xcd6b('0x51')](_[_0xcd6b('0x52')](_0x24ed49[_0xcd6b('0x48')],_0x5b7a4a[_0xcd6b('0x51')]));_0x41ae7b[_0xcd6b('0x50')][_0xcd6b('0x69')]=_0x16f8e7['id'];if(_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x6a')]){_0x41ae7b[_0xcd6b('0x50')]=_[_0xcd6b('0x53')](_0x41ae7b[_0xcd6b('0x50')],{'$or':_[_0xcd6b('0x45')](_0x41ae7b[_0xcd6b('0x4b')],function(_0x5e778b){var _0x1c65c9={};_0x1c65c9[_0x5e778b]={'$like':'%'+_0x24ed49['query'][_0xcd6b('0x6a')]+'%'};return _0x1c65c9;})});}_0x41ae7b=_[_0xcd6b('0x53')]({},_0x41ae7b,_0x24ed49['options']);return db[_0xcd6b('0x81')]['count']({'where':_0x41ae7b[_0xcd6b('0x50')]})[_0xcd6b('0x10')](function(_0x1fdd7d){_0xbbc6ff[_0xcd6b('0x20')]=_0x1fdd7d;if(_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x57')]){_0x41ae7b[_0xcd6b('0x58')]=[{'model':db['CmContact'],'as':_0xcd6b('0x83'),'required':![]},{'model':db[_0xcd6b('0x84')],'as':_0xcd6b('0x85'),'attributes':['name',_0xcd6b('0x86'),_0xcd6b('0x87')],'required':![]},{'model':db[_0xcd6b('0x88')],'as':_0xcd6b('0x89'),'attributes':['id','name',_0xcd6b('0x8a')],'where':_0x24ed49[_0xcd6b('0x48')]['tag']?{'id':_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x8b')]}:undefined,'required':_0x24ed49[_0xcd6b('0x48')][_0xcd6b('0x8b')]?!![]:![]}];}return db[_0xcd6b('0x81')]['findAll'](_0x41ae7b);})['then'](function(_0x4036bb){_0xbbc6ff[_0xcd6b('0x5a')]=_0x4036bb;return _0xbbc6ff;});}})[_0xcd6b('0x10')](respondWithFilteredResult(_0x488068,_0x41ae7b))[_0xcd6b('0x19')](handleError(_0x488068,null));};exports[_0xcd6b('0x8c')]=function addApplications(_0x261610,_0x3b690e){var _0x48a0e5=_0x261610[_0xcd6b('0x64')]['id'];var _0x4f498d=_0x261610[_0xcd6b('0x5d')];var _0x1a03c3=0xc8;var _0x1635ee=null;return db[_0xcd6b('0x8d')][_0xcd6b('0x8e')]({'isolationLevel':db[_0xcd6b('0x8d')]['Transaction'][_0xcd6b('0x8f')][_0xcd6b('0x90')]},function(_0x29185d){return db[_0xcd6b('0x59')][_0xcd6b('0x68')]({'where':{'id':_0x48a0e5},'transaction':_0x29185d})[_0xcd6b('0x10')](function(_0x1600fd){if(_0x1600fd){return db['MailApplication'][_0xcd6b('0x24')]({'where':{'MailAccountId':_0x48a0e5},'transaction':_0x29185d})[_0xcd6b('0x10')](function(){var _0x5631c2=_['map'](_0x4f498d,function(_0x4e2bb7){_0x4e2bb7['MailAccountId']=_0x48a0e5;return _0x4e2bb7;});return db['MailApplication']['bulkCreate'](_0x5631c2,{'transaction':_0x29185d});});}else{_0x1a03c3=0x194;_0x1635ee=[];}});})[_0xcd6b('0x10')](function(){if(_0x1a03c3!==0x194){return db[_0xcd6b('0x91')][_0xcd6b('0x92')]({'where':{'MailAccountId':_0x48a0e5},'order':'priority'})['then'](function(_0x2311f2){_0x1635ee=_0x2311f2;});}})['catch'](function(_0x337e7c){_0x1a03c3=0x1f4;logger[_0xcd6b('0x16')](_0x337e7c['stack']);if(_0x337e7c['name']){delete _0x337e7c[_0xcd6b('0x29')];}_0x1635ee=_0x337e7c;})['finally'](function(){if(_0x1635ee===null){_0x3b690e[_0xcd6b('0x1a')](_0x1a03c3);}else{if(_0x1a03c3===0x1f4){_0x3b690e['status'](_0x1a03c3)[_0xcd6b('0x93')](_0x1635ee);}else{_0x3b690e[_0xcd6b('0x1b')](_0x1a03c3)[_0xcd6b('0x1c')](_0x1635ee);}}});};exports[_0xcd6b('0x94')]=function(_0x20ff99,_0x24f400){var _0x191e72={};var _0x235f84={};var _0x230a8c;var _0x23d506;return db[_0xcd6b('0x59')][_0xcd6b('0x68')]({'where':{'id':_0x20ff99[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x24f400,null))[_0xcd6b('0x10')](function(_0x44d3b9){if(_0x44d3b9){_0x230a8c=_0x44d3b9;_0x235f84[_0xcd6b('0x47')]=_['keys'](db[_0xcd6b('0x91')]['rawAttributes']);_0x235f84[_0xcd6b('0x48')]=_[_0xcd6b('0x5b')](_0x20ff99[_0xcd6b('0x48')]);_0x235f84[_0xcd6b('0x51')]=_[_0xcd6b('0x49')](_0x235f84[_0xcd6b('0x47')],_0x235f84[_0xcd6b('0x48')]);_0x191e72[_0xcd6b('0x4b')]=_['intersection'](_0x235f84[_0xcd6b('0x47')],qs['fields'](_0x20ff99['query'][_0xcd6b('0x4a')]));_0x191e72['attributes']=_0x191e72[_0xcd6b('0x4b')]['length']?_0x191e72[_0xcd6b('0x4b')]:_0x235f84[_0xcd6b('0x47')];_0x191e72[_0xcd6b('0x4e')]=qs[_0xcd6b('0x4f')](_0x20ff99[_0xcd6b('0x48')][_0xcd6b('0x4f')]);_0x191e72[_0xcd6b('0x50')]=qs['filters'](_['pick'](_0x20ff99[_0xcd6b('0x48')],_0x235f84[_0xcd6b('0x51')]));if(_0x20ff99['query']['filter']){_0x191e72['where']=_[_0xcd6b('0x53')](_0x191e72['where'],{'$or':_[_0xcd6b('0x45')](_0x191e72['attributes'],function(_0x376c09){var _0x4d0ae5={};_0x4d0ae5[_0x376c09]={'$like':'%'+_0x20ff99[_0xcd6b('0x48')][_0xcd6b('0x6a')]+'%'};return _0x4d0ae5;})});}_0x191e72=_['merge']({},_0x191e72,_0x20ff99['options']);return _0x230a8c[_0xcd6b('0x94')](_0x191e72);}})[_0xcd6b('0x10')](function(_0x434994){if(_0x434994){_0x23d506=_0x434994['length'];if(!_0x20ff99[_0xcd6b('0x48')][_0xcd6b('0x70')](_0xcd6b('0x4d'))){_0x191e72[_0xcd6b('0x1e')]=qs['limit'](_0x20ff99[_0xcd6b('0x48')][_0xcd6b('0x1e')]);_0x191e72[_0xcd6b('0x1d')]=qs[_0xcd6b('0x1d')](_0x20ff99[_0xcd6b('0x48')][_0xcd6b('0x1d')]);}return _0x230a8c['getApplications'](_0x191e72);}})[_0xcd6b('0x10')](function(_0x860a43){if(_0x860a43){return _0x860a43?{'count':_0x23d506,'rows':_0x860a43}:null;}})['then'](respondWithResult(_0x24f400,null))[_0xcd6b('0x19')](handleError(_0x24f400,null));};exports[_0xcd6b('0x95')]=function(_0x575b23,_0xfafe41){var _0x1e9682={'raw':!![],'where':{}};var _0xcfabd8={};var _0x400ee9={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x575b23[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0xfafe41,null))[_0xcd6b('0x10')](function(_0x276a8b){if(_0x276a8b){_0xcfabd8[_0xcd6b('0x47')]=_[_0xcd6b('0x5b')](db[_0xcd6b('0x96')][_0xcd6b('0x46')]);_0xcfabd8[_0xcd6b('0x48')]=_[_0xcd6b('0x5b')](_0x575b23[_0xcd6b('0x48')]);_0xcfabd8[_0xcd6b('0x51')]=_[_0xcd6b('0x49')](_0xcfabd8[_0xcd6b('0x47')],_0xcfabd8['query']);_0x1e9682['attributes']=_[_0xcd6b('0x49')](_0xcfabd8[_0xcd6b('0x47')],qs['fields'](_0x575b23[_0xcd6b('0x48')][_0xcd6b('0x4a')]));_0x1e9682['attributes']=_0x1e9682[_0xcd6b('0x4b')][_0xcd6b('0x4c')]?_0x1e9682[_0xcd6b('0x4b')]:_0xcfabd8[_0xcd6b('0x47')];if(!_0x575b23[_0xcd6b('0x48')][_0xcd6b('0x70')](_0xcd6b('0x4d'))){_0x1e9682[_0xcd6b('0x1e')]=qs[_0xcd6b('0x1e')](_0x575b23[_0xcd6b('0x48')]['limit']);_0x1e9682[_0xcd6b('0x1d')]=qs[_0xcd6b('0x1d')](_0x575b23['query'][_0xcd6b('0x1d')]);}_0x1e9682[_0xcd6b('0x4e')]=qs[_0xcd6b('0x4f')](_0x575b23['query'][_0xcd6b('0x4f')]);_0x1e9682[_0xcd6b('0x50')]=qs[_0xcd6b('0x51')](_[_0xcd6b('0x52')](_0x575b23['query'],_0xcfabd8[_0xcd6b('0x51')]));_0x1e9682[_0xcd6b('0x50')][_0xcd6b('0x69')]=_0x276a8b['id'];if(_0x575b23[_0xcd6b('0x48')]['filter']){_0x1e9682[_0xcd6b('0x50')]=_['merge'](_0x1e9682[_0xcd6b('0x50')],{'$or':_['map'](_0x1e9682[_0xcd6b('0x4b')],function(_0x224750){var _0x5df72d={};_0x5df72d[_0x224750]={'$like':'%'+_0x575b23[_0xcd6b('0x48')][_0xcd6b('0x6a')]+'%'};return _0x5df72d;})});}if(_0x575b23['query'][_0xcd6b('0x97')]){var _0x1c9ab5=_0x575b23[_0xcd6b('0x48')][_0xcd6b('0x97')][_0xcd6b('0x98')](',');var _0x452506={};_0x452506[_0x1c9ab5[0x0]]={'$gte':moment(_0x1c9ab5[0x1])[_0xcd6b('0x99')](_0xcd6b('0x9a'))};_0x1e9682[_0xcd6b('0x50')]=_['merge'](_0x1e9682['where'],_0x452506);}_0x1e9682=_[_0xcd6b('0x53')]({},_0x1e9682,_0x575b23[_0xcd6b('0x56')]);return db[_0xcd6b('0x96')][_0xcd6b('0x20')]({'where':_0x1e9682[_0xcd6b('0x50')]})[_0xcd6b('0x10')](function(_0x977282){_0x400ee9[_0xcd6b('0x20')]=_0x977282;if(_0x575b23[_0xcd6b('0x48')][_0xcd6b('0x57')]){_0x1e9682['include']=[{'all':!![]}];}return db[_0xcd6b('0x96')]['findAll'](_0x1e9682);})[_0xcd6b('0x10')](function(_0x186c97){if(_0x575b23[_0xcd6b('0x48')][_0xcd6b('0x9b')]===_0xcd6b('0x9c')){for(var _0x480558=0x0;_0x480558<_0x186c97['length'];_0x480558++){_0x186c97[_0x480558][_0xcd6b('0x5d')]=juice(_0x186c97[_0x480558][_0xcd6b('0x5d')]);}}_0x400ee9[_0xcd6b('0x5a')]=_0x186c97;return _0x400ee9;});}})[_0xcd6b('0x10')](respondWithFilteredResult(_0xfafe41,_0x1e9682))['catch'](handleError(_0xfafe41,null));};exports[_0xcd6b('0x93')]=function(_0x2bfd2e,_0x2fe940){var _0x4786c8,_0x1203d9={},_0x4fc104;if(_0x2bfd2e[_0xcd6b('0x5d')]['to']){_0x4fc104=_0x2bfd2e[_0xcd6b('0x5d')]['to'][_0xcd6b('0x98')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x2bfd2e['params']['id']},'include':[{'model':db['CmList'],'as':_0xcd6b('0x9d'),'include':[{'model':db[_0xcd6b('0x9e')],'as':_0xcd6b('0x9f'),'where':{'email':_0x4fc104},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xcd6b('0x42')],'as':_0xcd6b('0x40'),'raw':!![],'include':[{'model':db[_0xcd6b('0xa0')],'as':_0xcd6b('0xa0'),'raw':!![]}]}]})[_0xcd6b('0x10')](handleEntityNotFound(_0x2fe940,null))[_0xcd6b('0x10')](function(_0x5ebeb1){if(!_0x5ebeb1)return;_0x4786c8=_0x5ebeb1;if(!_0x5ebeb1[_0xcd6b('0x40')])throw new Error(_0xcd6b('0xa1'));if(_[_0xcd6b('0x74')](_0x2bfd2e['body']['from'])){_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xa2')]=util[_0xcd6b('0x99')](_0xcd6b('0xa3'),_0x5ebeb1[_0xcd6b('0x29')],_0x5ebeb1[_0xcd6b('0x72')]||_0x5ebeb1[_0xcd6b('0x40')][_0xcd6b('0x35')]);}if(_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xa4')]&&_0x2bfd2e['body'][_0xcd6b('0xa4')][_0xcd6b('0x4c')]){for(var _0x579538=0x0;_0x579538<_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xa4')]['length'];_0x579538+=0x1){_0x2bfd2e['body']['attachments'][_0x579538]={'filename':_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xa4')][_0x579538][_0xcd6b('0x29')],'path':path[_0xcd6b('0xa5')](config[_0xcd6b('0xa6')],_0xcd6b('0xa7'),_0x2bfd2e[_0xcd6b('0x5d')]['attachments'][_0x579538][_0xcd6b('0xa8')])};}}var _0x330008=_0x5ebeb1[_0xcd6b('0xa9')]();return respondWithRpcPromise(_0xcd6b('0xaa'),_0xcd6b('0xab'),{'account':_0x330008,'message':_0x2bfd2e['body']});})['then'](function(_0x15311b){if(!_0x15311b)return;_0x1203d9=_0x15311b;if(!_0x4786c8['List'])throw new Error('List\x20not\x20found');if(_0x4786c8['List'][_0xcd6b('0x9f')][_0xcd6b('0x4c')])return _0x4786c8[_0xcd6b('0x9d')][_0xcd6b('0x9f')][0x0];return db[_0xcd6b('0x9e')][_0xcd6b('0x66')](_[_0xcd6b('0xac')](_0x2bfd2e['body'],{'firstName':_0x2bfd2e['body']['to'],'email':_0x2bfd2e[_0xcd6b('0x5d')]['to'],'phone':_0x2bfd2e[_0xcd6b('0x5d')]['to'],'ListId':_0x4786c8[_0xcd6b('0x73')]}));})[_0xcd6b('0x10')](function(_0xfb4d13){if(!_0xfb4d13)return;var _0x1f96d5={'UserId':_0x2bfd2e[_0xcd6b('0x35')]['id'],'ContactId':_0xfb4d13['id'],'MailAccountId':_0x4786c8['id'],'inReplyTo':_0x1203d9['messageId'],'to':_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xa2')],'cc':_0x2bfd2e['body']['cc'],'subject':_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xad')],'attach':_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xae')],'firstMsgDirection':_0xcd6b('0xaf'),'lastMsgAt':moment()['format'](_0xcd6b('0x9a')),'lastMsgDirection':'out','Messages':[_['merge'](_0x2bfd2e[_0xcd6b('0x5d')],{'messageId':_0x1203d9[_0xcd6b('0xb0')],'sentAt':moment()['format'](_0xcd6b('0x9a')),'read':!![],'MailAccountId':_0x4786c8['id'],'UserId':_0x2bfd2e['user']['id'],'ContactId':_0xfb4d13['id']})]};if(_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xb1')]){_0x1f96d5=_[_0xcd6b('0x53')](_0x1f96d5,_0x2bfd2e[_0xcd6b('0x5d')][_0xcd6b('0xb1')]);}return db[_0xcd6b('0x81')][_0xcd6b('0x66')](_0x1f96d5,{'include':[{'model':db[_0xcd6b('0x96')],'as':_0xcd6b('0xb2')}]});})[_0xcd6b('0x10')](respondWithResult(_0x2fe940,null))['catch'](handleError(_0x2fe940,null));};exports[_0xcd6b('0xb3')]=function(_0x441bb5,_0x57f946){return db['MailAccount'][_0xcd6b('0x5c')]({'where':{'id':_0x441bb5[_0xcd6b('0x64')]['id']},'include':[{'model':db[_0xcd6b('0x42')],'as':_0xcd6b('0x40'),'raw':!![],'include':[{'model':db[_0xcd6b('0xa0')],'as':'CloudProvider','raw':!![]}]}]})[_0xcd6b('0x10')](handleEntityNotFound(_0x57f946,null))[_0xcd6b('0x10')](function(_0x4d6355){if(!_0x4d6355[_0xcd6b('0x40')])return;var _0x8b49d4=_0x4d6355[_0xcd6b('0xa9')]();return respondWithRpcPromise(_0xcd6b('0xb4'),_0xcd6b('0xb3'),{'account':_0x8b49d4});})[_0xcd6b('0x10')](respondWithResult(_0x57f946,null))[_0xcd6b('0x19')](handleError(_0x57f946,null));};exports[_0xcd6b('0x24')]=function(_0x5915b7,_0x1ff4d8){return db['MailAccount']['find']({'where':{'id':_0x5915b7[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x1ff4d8,null))[_0xcd6b('0x10')](function(_0x19dc8b){if(_0x19dc8b&&_0x19dc8b[_0xcd6b('0x3d')]){throw new db[(_0xcd6b('0xb5'))][(_0xcd6b('0xb6'))](_0xcd6b('0xb7'));}return _0x19dc8b;})[_0xcd6b('0x10')](removeEntity(_0x1ff4d8,null))[_0xcd6b('0x19')](handleError(_0x1ff4d8,null));};exports[_0xcd6b('0xb8')]=function(_0x3308b5,_0x33f079){return db[_0xcd6b('0x59')][_0xcd6b('0x5c')]({'where':{'id':_0x3308b5[_0xcd6b('0x64')]['id']}})['then'](handleEntityNotFound(_0x33f079,null))[_0xcd6b('0x10')](function(_0x144c47){if(_0x144c47){return _0x144c47['addAgents'](_0x3308b5[_0xcd6b('0x5d')][_0xcd6b('0x6d')],_[_0xcd6b('0xb9')](_0x3308b5[_0xcd6b('0x5d')],[_0xcd6b('0x6d'),'id'])||{})[_0xcd6b('0xba')](function(_0x4b9410){for(var _0x383b5e=0x0;_0x383b5e<_0x3308b5[_0xcd6b('0x5d')][_0xcd6b('0x6d')][_0xcd6b('0x4c')];_0x383b5e+=0x1){socket[_0xcd6b('0xbb')](_0xcd6b('0xbc'),{'UserId':Number(_0x3308b5[_0xcd6b('0x5d')]['ids'][_0x383b5e]),'MailAccountId':Number(_0x3308b5[_0xcd6b('0x64')]['id'])});}return _0x4b9410;});}})[_0xcd6b('0x10')](respondWithResult(_0x33f079,null))['catch'](handleError(_0x33f079,null));};exports[_0xcd6b('0xbd')]=function(_0x2af82b,_0x52f641){return db[_0xcd6b('0x59')][_0xcd6b('0x5c')]({'where':{'id':_0x2af82b[_0xcd6b('0x64')]['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x52f641,null))[_0xcd6b('0x10')](function(_0x366ea9){if(_0x366ea9){return _0x366ea9['removeAgents'](_0x2af82b[_0xcd6b('0x48')][_0xcd6b('0x6d')])[_0xcd6b('0x10')](function(){if(_[_0xcd6b('0xbe')](_0x2af82b[_0xcd6b('0x48')][_0xcd6b('0x6d')])){for(var _0x55a79b=0x0;_0x55a79b<_0x2af82b['query']['ids']['length'];_0x55a79b+=0x1){socket[_0xcd6b('0xbb')](_0xcd6b('0xbf'),{'UserId':Number(_0x2af82b[_0xcd6b('0x48')][_0xcd6b('0x6d')][_0x55a79b]),'MailAccountId':Number(_0x2af82b['params']['id'])});}}else{socket['emit'](_0xcd6b('0xbf'),{'UserId':Number(_0x2af82b[_0xcd6b('0x48')]['ids']),'MailAccountId':Number(_0x2af82b[_0xcd6b('0x64')]['id'])});}});}})[_0xcd6b('0x10')](respondWithStatusCode(_0x52f641,null))['catch'](handleError(_0x52f641,null));};exports[_0xcd6b('0xc0')]=function(_0x31ad50,_0x265eaa){var _0x3faa9e={};var _0x34f29d={};var _0x253712;var _0x222e1a;return db[_0xcd6b('0x59')]['findOne']({'where':{'id':_0x31ad50['params']['id']}})[_0xcd6b('0x10')](handleEntityNotFound(_0x265eaa,null))[_0xcd6b('0x10')](function(_0x260e54){if(_0x260e54){_0x253712=_0x260e54;_0x34f29d[_0xcd6b('0x47')]=_['keys'](db['User']['rawAttributes']);_0x34f29d[_0xcd6b('0x48')]=_[_0xcd6b('0x5b')](_0x31ad50[_0xcd6b('0x48')]);_0x34f29d[_0xcd6b('0x51')]=_[_0xcd6b('0x49')](_0x34f29d['model'],_0x34f29d['query']);_0x3faa9e[_0xcd6b('0x4b')]=_['intersection'](_0x34f29d[_0xcd6b('0x47')],qs[_0xcd6b('0x4a')](_0x31ad50['query'][_0xcd6b('0x4a')]));_0x3faa9e[_0xcd6b('0x4b')]=_0x3faa9e['attributes'][_0xcd6b('0x4c')]?_0x3faa9e[_0xcd6b('0x4b')]:_0x34f29d[_0xcd6b('0x47')];_0x3faa9e[_0xcd6b('0x4e')]=qs[_0xcd6b('0x4f')](_0x31ad50[_0xcd6b('0x48')][_0xcd6b('0x4f')]);_0x3faa9e[_0xcd6b('0x50')]=qs[_0xcd6b('0x51')](_[_0xcd6b('0x52')](_0x31ad50[_0xcd6b('0x48')],_0x34f29d['filters']));if(_0x31ad50[_0xcd6b('0x48')]['filter']){_0x3faa9e[_0xcd6b('0x50')]=_[_0xcd6b('0x53')](_0x3faa9e[_0xcd6b('0x50')],{'$or':_[_0xcd6b('0x45')](_0x3faa9e[_0xcd6b('0x4b')],function(_0xdd2e5f){var _0x17e3e9={};_0x17e3e9[_0xdd2e5f]={'$like':'%'+_0x31ad50[_0xcd6b('0x48')]['filter']+'%'};return _0x17e3e9;})});}_0x3faa9e=_[_0xcd6b('0x53')]({},_0x3faa9e,_0x31ad50[_0xcd6b('0x56')]);return _0x253712[_0xcd6b('0xc0')](_0x3faa9e);}})[_0xcd6b('0x10')](function(_0x2364b7){if(_0x2364b7){_0x222e1a=_0x2364b7[_0xcd6b('0x4c')];if(!_0x31ad50[_0xcd6b('0x48')][_0xcd6b('0x70')]('nolimit')){_0x3faa9e[_0xcd6b('0x1e')]=qs['limit'](_0x31ad50[_0xcd6b('0x48')][_0xcd6b('0x1e')]);_0x3faa9e[_0xcd6b('0x1d')]=qs[_0xcd6b('0x1d')](_0x31ad50[_0xcd6b('0x48')][_0xcd6b('0x1d')]);}return _0x253712[_0xcd6b('0xc0')](_0x3faa9e);}})['then'](function(_0x4d16b5){if(_0x4d16b5){return _0x4d16b5?{'count':_0x222e1a,'rows':_0x4d16b5}:null;}})[_0xcd6b('0x10')](respondWithResult(_0x265eaa,null))[_0xcd6b('0x19')](handleError(_0x265eaa,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 247835d..0dc966e 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 _0x565e=['MailAccount','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x3e4a56,_0x2cf0b0){var _0x3bb1b2=function(_0x1b933c){while(--_0x1b933c){_0x3e4a56['push'](_0x3e4a56['shift']());}};_0x3bb1b2(++_0x2cf0b0);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xe565('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xe565('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe565('0x2')](0x0);var events={'afterCreate':_0xe565('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x42e589){return function(_0x33fd83,_0x14f472,_0x1b6e64){MailAccountEvents[_0xe565('0x4')](_0x42e589+':'+_0x33fd83['id'],_0x33fd83);MailAccountEvents[_0xe565('0x4')](_0x42e589,_0x33fd83);_0x1b6e64(null);};}for(var e in events){if(events[_0xe565('0x5')](e)){var event=events[e];MailAccount[_0xe565('0x6')](e,emitEvent(event));}}module[_0xe565('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x9dfc=['update','remove','emit','hasOwnProperty','exports','events','save'];(function(_0x27f378,_0x4716d2){var _0xcf5395=function(_0x395bd5){while(--_0x395bd5){_0x27f378['push'](_0x27f378['shift']());}};_0xcf5395(++_0x4716d2);}(_0x9dfc,0x140));var _0xc9df=function(_0x4b96a1,_0x1284b6){_0x4b96a1=_0x4b96a1-0x0;var _0x1f0b0c=_0x9dfc[_0x4b96a1];return _0x1f0b0c;};'use strict';var EventEmitter=require(_0xc9df('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc9df('0x1'),'afterUpdate':_0xc9df('0x2'),'afterDestroy':_0xc9df('0x3')};function emitEvent(_0xf2621e){return function(_0x336c0a,_0x19b2c7,_0x147adf){MailAccountEvents[_0xc9df('0x4')](_0xf2621e+':'+_0x336c0a['id'],_0x336c0a);MailAccountEvents[_0xc9df('0x4')](_0xf2621e,_0x336c0a);_0x147adf(null);};}for(var e in events){if(events[_0xc9df('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xc9df('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index fb264de..644d708 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 _0x47ef=['auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','MailAccount','provider','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0xbebee7,_0x3fccca){var _0x1e5242=function(_0x5c259c){while(--_0x5c259c){_0xbebee7['push'](_0xbebee7['shift']());}};_0x1e5242(++_0x3fccca);}(_0x47ef,0x15b));var _0xf47e=function(_0x1b7ddb,_0x2bd622){_0x1b7ddb=_0x1b7ddb-0x0;var _0x31a891=_0x47ef[_0x1b7ddb];return _0x31a891;};'use strict';var attributes=require(_0xf47e('0x0'));module[_0xf47e('0x1')]=function(_0x49b756){return _0x49b756['define'](_0xf47e('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5203aa=this;var _0xf24ed7={'id':_0x5203aa['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5203aa[_0xf47e('0x3')]!=='custom'){_0xf24ed7[_0xf47e('0x4')]=_0x5203aa[_0xf47e('0x3')];}else{_0xf24ed7[_0xf47e('0x5')]=_0x5203aa[_0xf47e('0x6')]['host'];_0xf24ed7[_0xf47e('0x7')]=_0x5203aa[_0xf47e('0x6')]['port'];_0xf24ed7[_0xf47e('0x8')]=_0x5203aa[_0xf47e('0x6')][_0xf47e('0x8')];}if(_0x5203aa[_0xf47e('0x6')][_0xf47e('0x9')]){if(_0x5203aa[_0xf47e('0x6')][_0xf47e('0xa')]){if(!_0x5203aa[_0xf47e('0x6')][_0xf47e('0xb')])throw new Error(_0xf47e('0xc'));_0xf24ed7[_0xf47e('0xd')]={'type':_0xf47e('0xe'),'user':_0x5203aa[_0xf47e('0x6')][_0xf47e('0xf')],'accessToken':_0x5203aa[_0xf47e('0x6')][_0xf47e('0xb')][_0xf47e('0x10')]};}else{_0xf24ed7[_0xf47e('0xd')]={'user':_0x5203aa['Smtp']['user'],'pass':_0x5203aa[_0xf47e('0x6')][_0xf47e('0x11')]};}}return _0xf24ed7;}}});}; \ No newline at end of file +var _0x4033=['port','secure','CloudProvider','auth','OAuth2','user','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','provider','host','Smtp'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x4033,0xb1));var _0x3403=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0x4033[_0x29dda1];return _0x21b0ef;};'use strict';var attributes=require(_0x3403('0x0'));module[_0x3403('0x1')]=function(_0x45bf36){return _0x45bf36[_0x3403('0x2')](_0x3403('0x3'),attributes,{'tableName':_0x3403('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x58be13=this;var _0x531b6c={'id':_0x58be13['id'],'tls':{'rejectUnauthorized':![]}};if(_0x58be13['provider']!==_0x3403('0x5')){_0x531b6c[_0x3403('0x6')]=_0x58be13[_0x3403('0x7')];}else{_0x531b6c[_0x3403('0x8')]=_0x58be13[_0x3403('0x9')][_0x3403('0x8')];_0x531b6c[_0x3403('0xa')]=_0x58be13['Smtp']['port'];_0x531b6c[_0x3403('0xb')]=_0x58be13[_0x3403('0x9')][_0x3403('0xb')];}if(_0x58be13[_0x3403('0x9')]['authentication']){if(_0x58be13[_0x3403('0x9')]['modernAuthentication']){if(!_0x58be13['Smtp'][_0x3403('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x531b6c[_0x3403('0xd')]={'type':_0x3403('0xe'),'user':_0x58be13[_0x3403('0x9')][_0x3403('0xf')],'accessToken':_0x58be13[_0x3403('0x9')][_0x3403('0xc')]['data5']};}else{_0x531b6c['auth']={'user':_0x58be13[_0x3403('0x9')][_0x3403('0xf')],'pass':_0x58be13[_0x3403('0x9')][_0x3403('0x10')]};}}return _0x531b6c;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d8f1ca0..02fc8bf 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 _0x83d0=['ShowMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','List','omit','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','create','List\x20not\x20found','messageId','generate','subject','attach','format','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','defaults','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','attributes','limit','include','map','model','raw','where','smtpOptions','getSmtpOptions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x83d0,0xb7));var _0x083d=function(_0x3dadbd,_0x21561c){_0x3dadbd=_0x3dadbd-0x0;var _0x52bd28=_0x83d0[_0x3dadbd];return _0x52bd28;};'use strict';var _=require(_0x083d('0x0'));var moment=require(_0x083d('0x1'));var BPromise=require(_0x083d('0x2'));var rs=require(_0x083d('0x3'));var Redis=require(_0x083d('0x4'));var db=require(_0x083d('0x5'))['db'];var logger=require('../../config/logger')(_0x083d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x083d('0x7')][_0x083d('0x8')]({'port':0x232c});config[_0x083d('0x9')]=_[_0x083d('0xa')](config[_0x083d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x083d('0x9')]));require(_0x083d('0xb'))[_0x083d('0xc')](socket);function respondWithRpcPromise(_0x5528a4,_0x3ca407,_0x412ea9){return new BPromise(function(_0x40f5ed,_0xcf2319){return client['request'](_0x5528a4,_0x412ea9)[_0x083d('0xd')](function(_0x5be91f){logger[_0x083d('0xe')](_0x083d('0xf'),_0x3ca407,'request\x20sent');logger[_0x083d('0x10')](_0x083d('0x11'),_0x3ca407,_0x083d('0x12'),JSON[_0x083d('0x13')](_0x5be91f));if(_0x5be91f[_0x083d('0x14')]){if(_0x5be91f['error'][_0x083d('0x15')]===0x1f4){logger[_0x083d('0x14')]('MailAccount,\x20%s,\x20%s',_0x3ca407,_0x5be91f[_0x083d('0x14')]['message']);return _0xcf2319(_0x5be91f['error'][_0x083d('0x16')]);}logger[_0x083d('0x14')](_0x083d('0xf'),_0x3ca407,_0x5be91f[_0x083d('0x14')][_0x083d('0x16')]);return _0x40f5ed(_0x5be91f['error'][_0x083d('0x16')]);}else{logger['info'](_0x083d('0xf'),_0x3ca407,_0x083d('0x12'));_0x40f5ed(_0x5be91f[_0x083d('0x17')][_0x083d('0x16')]);}})[_0x083d('0x18')](function(_0x63c0b6){logger[_0x083d('0x14')](_0x083d('0xf'),_0x3ca407,_0x63c0b6);_0xcf2319(_0x63c0b6);});});}exports[_0x083d('0x19')]=function(_0x2cb79c){var _0x3ae260=this;return new Promise(function(_0xb8a16f,_0x5dd1ba){return db[_0x083d('0x1a')]['findAll']({'raw':_0x2cb79c[_0x083d('0x1b')]?_0x2cb79c[_0x083d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2cb79c[_0x083d('0x1b')]?_0x2cb79c['options']['where']||null:null,'attributes':_0x2cb79c['options']?_0x2cb79c[_0x083d('0x1b')][_0x083d('0x1c')]||null:null,'limit':_0x2cb79c[_0x083d('0x1b')]?_0x2cb79c[_0x083d('0x1b')][_0x083d('0x1d')]||null:null,'include':_0x2cb79c[_0x083d('0x1b')]?_0x2cb79c['options'][_0x083d('0x1e')]?_[_0x083d('0x1f')](_0x2cb79c['options'][_0x083d('0x1e')],function(_0x38ca23){return{'model':db[_0x38ca23[_0x083d('0x20')]],'as':_0x38ca23['as'],'attributes':_0x38ca23[_0x083d('0x1c')],'include':_0x38ca23[_0x083d('0x1e')]?_[_0x083d('0x1f')](_0x38ca23[_0x083d('0x1e')],function(_0x3923ff){return{'model':db[_0x3923ff['model']],'as':_0x3923ff['as'],'attributes':_0x3923ff[_0x083d('0x1c')],'include':_0x3923ff['include']?_[_0x083d('0x1f')](_0x3923ff[_0x083d('0x1e')],function(_0x252340){return{'model':db[_0x252340[_0x083d('0x20')]],'as':_0x252340['as'],'attributes':_0x252340[_0x083d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x083d('0xd')](function(_0x2b4825){logger[_0x083d('0xe')](_0x083d('0x19'),_0x2cb79c);logger[_0x083d('0x10')](_0x083d('0x19'),_0x2cb79c,JSON[_0x083d('0x13')](_0x2b4825));_0xb8a16f(_0x2b4825);})[_0x083d('0x18')](function(_0x2c7223){logger[_0x083d('0x14')]('GetMailAccount',_0x2c7223[_0x083d('0x16')],_0x2cb79c);_0x5dd1ba(_0x3ae260[_0x083d('0x14')](0x1f4,_0x2c7223['message']));});});};exports['ShowMailAccount']=function(_0x21a5d9){var _0x560cd0=this;return new Promise(function(_0x225c15,_0x49515c){return db[_0x083d('0x1a')]['find']({'raw':_0x21a5d9[_0x083d('0x1b')]?_0x21a5d9[_0x083d('0x1b')][_0x083d('0x21')]===undefined?!![]:![]:!![],'where':_0x21a5d9['options']?_0x21a5d9['options'][_0x083d('0x22')]||null:null,'attributes':_0x21a5d9['options']?_0x21a5d9[_0x083d('0x1b')][_0x083d('0x1c')]||null:null,'include':_0x21a5d9[_0x083d('0x1b')]?_0x21a5d9[_0x083d('0x1b')]['include']?_[_0x083d('0x1f')](_0x21a5d9[_0x083d('0x1b')][_0x083d('0x1e')],function(_0x30f4ad){return{'model':db[_0x30f4ad['model']],'as':_0x30f4ad['as'],'attributes':_0x30f4ad[_0x083d('0x1c')],'include':_0x30f4ad[_0x083d('0x1e')]?_[_0x083d('0x1f')](_0x30f4ad[_0x083d('0x1e')],function(_0x5d2836){return{'model':db[_0x5d2836['model']],'as':_0x5d2836['as'],'attributes':_0x5d2836[_0x083d('0x1c')],'include':_0x5d2836[_0x083d('0x1e')]?_[_0x083d('0x1f')](_0x5d2836[_0x083d('0x1e')],function(_0x1d75ef){return{'model':db[_0x1d75ef['model']],'as':_0x1d75ef['as'],'attributes':_0x1d75ef[_0x083d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x083d('0xd')](function(_0x48bafb){if(_0x21a5d9[_0x083d('0x1b')]['smtp']===!![])_0x48bafb['setDataValue'](_0x083d('0x23'),_0x48bafb[_0x083d('0x24')]());logger['info'](_0x083d('0x25'),_0x21a5d9);logger[_0x083d('0x10')](_0x083d('0x25'),_0x21a5d9,JSON['stringify'](_0x48bafb));_0x225c15(_0x48bafb);})['catch'](function(_0x48e297){logger['error'](_0x083d('0x25'),_0x48e297[_0x083d('0x16')],_0x21a5d9);_0x49515c(_0x560cd0[_0x083d('0x14')](0x1f4,_0x48e297[_0x083d('0x16')]));});});};exports['NotifyMailAccount']=function(_0x5ad9f2){var _0x1a99c9=this;return new Promise(function(_0x5706d1,_0x11a43f){var _0x368241={'body':_0x5ad9f2[_0x083d('0x26')],'channel':_0x083d('0x27')};var _0x177269=_[_0x083d('0x28')](_[_0x083d('0x29')](db[_0x083d('0x2a')]['rawAttributes']),[_0x083d('0x2b'),_0x083d('0x2c'),_0x083d('0x2d'),_0x083d('0x2e')]);var _0x2fd7cb=![];if(_0x5ad9f2[_0x083d('0x26')]['id']){delete _0x5ad9f2[_0x083d('0x26')]['id'];}if(_['isNil'](_0x5ad9f2[_0x083d('0x26')][_0x083d('0x2f')])){return _0x11a43f(_0x1a99c9['error'](0x1f4,_0x083d('0x30')));}if(_[_0x083d('0x31')](_0x5ad9f2[_0x083d('0x26')][_0x083d('0x26')])||_0x5ad9f2[_0x083d('0x26')]['body']===''){return _0x11a43f(_0x1a99c9[_0x083d('0x14')](0x1f4,_0x083d('0x32')));}if(_[_0x083d('0x31')](_0x5ad9f2[_0x083d('0x26')][_0x083d('0x33')])){return _0x11a43f(_0x1a99c9['error'](0x1f4,_0x083d('0x34')+_0x177269));}if(!_[_0x083d('0x35')](_0x177269,_0x5ad9f2[_0x083d('0x26')][_0x083d('0x33')])){return _0x11a43f(_0x1a99c9[_0x083d('0x14')](0x1f4,_0x083d('0x36')+_0x177269));}var _0x592d1a={};_0x592d1a[_0x5ad9f2[_0x083d('0x26')][_0x083d('0x33')]]=_0x5ad9f2[_0x083d('0x26')][_0x083d('0x2f')];return db[_0x083d('0x1a')][_0x083d('0x37')]({'where':{'id':_0x5ad9f2[_0x083d('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x083d('0x39'),'where':_0x592d1a,'limit':0x1,'order':[['updatedAt',_0x083d('0x3a')]]}]},{'model':db[_0x083d('0x3b')],'as':_0x083d('0x3c')},{'model':db[_0x083d('0x3d')],'as':'Smtp','include':[{'model':db[_0x083d('0x3e')],'as':_0x083d('0x3e')}]}]})[_0x083d('0xd')](function(_0x235998){if(_0x235998&&_0x235998[_0x083d('0x3f')]){var _0x5853d3=_0x235998['get']({'plain':!![]});_0x368241['account']=_[_0x083d('0x40')](_0x5853d3,[_0x083d('0x3c'),_0x083d('0x3f')]);_0x368241[_0x083d('0x38')][_0x083d('0x23')]=_0x235998[_0x083d('0x24')]();_0x368241[_0x083d('0x41')]=_0x5853d3[_0x083d('0x3c')];_0x368241[_0x083d('0x42')]=_0x5853d3['List'];_0x368241['applications']=_[_0x083d('0x43')](_0x368241['applications'],[_0x083d('0x44')],[_0x083d('0x45')]);if(_0x368241[_0x083d('0x38')]&&_0x368241[_0x083d('0x38')][_0x083d('0x46')]){_0x368241['applications'][_0x083d('0x47')]({'id':0x0,'priority':_0x368241['applications']['length']+0x1,'app':_0x083d('0x48'),'appdata':_0x083d('0x46'),'interval':_0x083d('0x49')});}if(_0x368241[_0x083d('0x38')][_0x083d('0x3c')]){delete _0x368241[_0x083d('0x38')][_0x083d('0x3c')];}if(_0x368241['account'][_0x083d('0x3f')]){delete _0x368241[_0x083d('0x38')][_0x083d('0x3f')];}if(_0x5853d3[_0x083d('0x3f')][_0x083d('0x39')][_0x083d('0x4a')]){return _0x5853d3[_0x083d('0x3f')][_0x083d('0x39')][0x0];}var _0x53b072=_[_0x083d('0xa')](_0x5ad9f2[_0x083d('0x26')],{'firstName':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x2f')],'ListId':_0x5853d3[_0x083d('0x2e')]});_0x53b072[_0x5ad9f2[_0x083d('0x26')][_0x083d('0x33')]]=_0x5ad9f2[_0x083d('0x26')][_0x083d('0x2f')];return db[_0x083d('0x2a')][_0x083d('0x4b')](_0x53b072);}else{throw new Error(_0x083d('0x4c'));}})[_0x083d('0xd')](function(_0x497598){_0x368241['contact']=_0x497598;if(_0x497598){if(!_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x4d')]){_0x5ad9f2[_0x083d('0x26')]['message'][_0x083d('0x4d')]=rs[_0x083d('0x4e')]()+'\x20'+_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x2f')];}var _0x48c6b3={'ContactId':_0x497598['id'],'MailAccountId':_0x5ad9f2['account']['id'],'inReplyTo':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x4d')],'to':_0x5ad9f2['body'][_0x083d('0x16')][_0x083d('0x2f')],'cc':_0x5ad9f2['body'][_0x083d('0x16')]['cc'],'subject':_0x5ad9f2[_0x083d('0x26')]['message'][_0x083d('0x4f')],'attach':_0x5ad9f2[_0x083d('0x26')]['message'][_0x083d('0x50')],'lastMsgAt':moment()[_0x083d('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x083d('0x37')]({'where':{'closed':![],'MailAccountId':_0x5ad9f2[_0x083d('0x38')]['id']},'include':[{'model':db[_0x083d('0x52')],'as':_0x083d('0x53'),'attributes':['messageId'],'where':{'messageId':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x54')]}}]})['then'](function(_0x15b8f7){if(_0x15b8f7){return[_0x15b8f7,![]];}return db[_0x083d('0x55')][_0x083d('0x4b')](_0x48c6b3)[_0x083d('0xd')](function(_0x56c903){return[_0x56c903,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x083d('0x56')](function(_0x38f1b8,_0x5acf5d){if(_0x38f1b8){_0x2fd7cb=_0x5acf5d;if(!_0x5acf5d){return _0x38f1b8[_0x083d('0x57')]({'inReplyTo':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x4d')],'to':_0x5ad9f2[_0x083d('0x26')]['message'][_0x083d('0x2f')],'cc':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')]['cc'],'subject':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x4f')],'attach':_0x38f1b8[_0x083d('0x50')]?_0x38f1b8[_0x083d('0x50')]:_0x5ad9f2['body'][_0x083d('0x16')][_0x083d('0x50')],'substatus':null,'substatusAt':moment()[_0x083d('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x083d('0x58')),'lastMsgDirection':'in'});}else{return _0x38f1b8;}}})[_0x083d('0xd')](function(_0x258905){_0x368241[_0x083d('0x59')]=_0x258905['get']({'plain':!![]});_0x368241[_0x083d('0x59')]['created']=_0x2fd7cb;return db['MailMessage'][_0x083d('0x4b')]({'body':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x26')],'MailAccountId':_0x5ad9f2[_0x083d('0x38')]['id'],'MailInteractionId':_0x258905['id'],'direction':'in','ContactId':_0x368241[_0x083d('0x5a')]['id'],'messageId':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x4d')],'from':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x2f')],'to':_0x5ad9f2['body'][_0x083d('0x16')]['to'],'cc':_0x5ad9f2['body']['message']['cc'],'subject':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x4f')],'attach':_0x5ad9f2[_0x083d('0x26')]['message']['attach'],'Attachments':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x5b')],'originTo':_0x5ad9f2['body'][_0x083d('0x16')][_0x083d('0x5c')],'originCc':_0x5ad9f2['body'][_0x083d('0x16')][_0x083d('0x5d')],'bcc':_0x5ad9f2[_0x083d('0x26')][_0x083d('0x16')][_0x083d('0x5e')],'ChatWebsiteId':_0x5ad9f2[_0x083d('0x26')]['message'][_0x083d('0x5f')]||null,'originChannel':_0x5ad9f2['body'][_0x083d('0x16')]['originChannel']||'Email','ChatOfflineMessageId':_0x5ad9f2[_0x083d('0x26')]['message'][_0x083d('0x60')]||null},{'include':[{'model':db[_0x083d('0x61')],'as':_0x083d('0x62')}]});})[_0x083d('0xd')](function(_0x495c48){_0x368241[_0x083d('0x16')]=_0x495c48;if(!_0x368241[_0x083d('0x59')][_0x083d('0x63')]){return;}return db[_0x083d('0x64')][_0x083d('0x37')]({'attributes':['id',_0x083d('0x65')],'where':{'id':_0x368241['interaction'][_0x083d('0x63')]}});})[_0x083d('0xd')](function(_0x3859c4){if(_0x3859c4){_0x368241['applications'][_0x083d('0x66')]({'id':0x0,'priority':0x0,'app':_0x083d('0x67'),'appdata':_0x3859c4[_0x083d('0x65')]+','+(_0x368241[_0x083d('0x38')][_0x083d('0x68')]||0xa),'interval':_0x083d('0x49')});}if(!_0x368241['interaction'][_0x083d('0x69')]){return;}return db[_0x083d('0x6a')]['find']({'attributes':['id',_0x083d('0x65')],'where':{'id':_0x368241[_0x083d('0x59')][_0x083d('0x69')]}});})['then'](function(_0x20957f){if(_0x20957f){_0x368241[_0x083d('0x41')]['unshift']({'id':0x0,'priority':0x1,'app':_0x083d('0x6b'),'appdata':_0x20957f['name']+','+(_0x368241[_0x083d('0x38')][_0x083d('0x6c')]||0x12c),'interval':_0x083d('0x49')});}return respondWithRpcPromise(_0x083d('0x6d'),'startRouting',_0x368241);})[_0x083d('0xd')](function(_0x497e38){_0x5706d1(_0x497e38);})[_0x083d('0x18')](function(_0x1502db){_0x11a43f(_0x1a99c9['error'](0x1f4,_0x1502db[_0x083d('0x16')]));});});}; \ No newline at end of file +var _0x9fe7=['length','List\x20not\x20found','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','interaction','created','create','attachments','originTo','originCc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','include','model','attributes','map','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','list','orderBy','applications','priority','asc','autoclose','*,*,*,*'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9fe7,0x1df));var _0x79fe=function(_0x555102,_0x1d5e79){_0x555102=_0x555102-0x0;var _0x40ef28=_0x9fe7[_0x555102];return _0x40ef28;};'use strict';var _=require(_0x79fe('0x0'));var moment=require(_0x79fe('0x1'));var BPromise=require('bluebird');var rs=require(_0x79fe('0x2'));var Redis=require('ioredis');var db=require(_0x79fe('0x3'))['db'];var logger=require(_0x79fe('0x4'))(_0x79fe('0x5'));var config=require('../../config/environment');var jayson=require(_0x79fe('0x6'));var client=jayson[_0x79fe('0x7')][_0x79fe('0x8')]({'port':0x232c});config['redis']=_[_0x79fe('0x9')](config[_0x79fe('0xa')],{'host':_0x79fe('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79fe('0xa')]));require(_0x79fe('0xc'))[_0x79fe('0xd')](socket);function respondWithRpcPromise(_0x26d723,_0xafc7cd,_0x5b914a){return new BPromise(function(_0x34c217,_0x253f7d){return client['request'](_0x26d723,_0x5b914a)[_0x79fe('0xe')](function(_0x3c79f8){logger[_0x79fe('0xf')](_0x79fe('0x10'),_0xafc7cd,'request\x20sent');logger[_0x79fe('0x11')](_0x79fe('0x12'),_0xafc7cd,_0x79fe('0x13'),JSON[_0x79fe('0x14')](_0x3c79f8));if(_0x3c79f8[_0x79fe('0x15')]){if(_0x3c79f8[_0x79fe('0x15')][_0x79fe('0x16')]===0x1f4){logger[_0x79fe('0x15')]('MailAccount,\x20%s,\x20%s',_0xafc7cd,_0x3c79f8[_0x79fe('0x15')][_0x79fe('0x17')]);return _0x253f7d(_0x3c79f8[_0x79fe('0x15')][_0x79fe('0x17')]);}logger[_0x79fe('0x15')](_0x79fe('0x10'),_0xafc7cd,_0x3c79f8['error'][_0x79fe('0x17')]);return _0x34c217(_0x3c79f8[_0x79fe('0x15')][_0x79fe('0x17')]);}else{logger[_0x79fe('0xf')]('MailAccount,\x20%s,\x20%s',_0xafc7cd,_0x79fe('0x13'));_0x34c217(_0x3c79f8[_0x79fe('0x18')][_0x79fe('0x17')]);}})[_0x79fe('0x19')](function(_0x536641){logger['error'](_0x79fe('0x10'),_0xafc7cd,_0x536641);_0x253f7d(_0x536641);});});}exports[_0x79fe('0x1a')]=function(_0x25e51f){var _0x4bca4d=this;return new Promise(function(_0x891611,_0x4141ec){return db[_0x79fe('0x1b')]['findAll']({'raw':_0x25e51f[_0x79fe('0x1c')]?_0x25e51f['options'][_0x79fe('0x1d')]===undefined?!![]:![]:!![],'where':_0x25e51f[_0x79fe('0x1c')]?_0x25e51f[_0x79fe('0x1c')][_0x79fe('0x1e')]||null:null,'attributes':_0x25e51f[_0x79fe('0x1c')]?_0x25e51f[_0x79fe('0x1c')]['attributes']||null:null,'limit':_0x25e51f['options']?_0x25e51f[_0x79fe('0x1c')]['limit']||null:null,'include':_0x25e51f[_0x79fe('0x1c')]?_0x25e51f[_0x79fe('0x1c')]['include']?_['map'](_0x25e51f[_0x79fe('0x1c')][_0x79fe('0x1f')],function(_0x59339b){return{'model':db[_0x59339b[_0x79fe('0x20')]],'as':_0x59339b['as'],'attributes':_0x59339b[_0x79fe('0x21')],'include':_0x59339b['include']?_['map'](_0x59339b['include'],function(_0x3720fa){return{'model':db[_0x3720fa[_0x79fe('0x20')]],'as':_0x3720fa['as'],'attributes':_0x3720fa[_0x79fe('0x21')],'include':_0x3720fa['include']?_[_0x79fe('0x22')](_0x3720fa[_0x79fe('0x1f')],function(_0x3bc5bc){return{'model':db[_0x3bc5bc['model']],'as':_0x3bc5bc['as'],'attributes':_0x3bc5bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x79fe('0xe')](function(_0x51200f){logger[_0x79fe('0xf')]('GetMailAccount',_0x25e51f);logger['debug']('GetMailAccount',_0x25e51f,JSON['stringify'](_0x51200f));_0x891611(_0x51200f);})[_0x79fe('0x19')](function(_0xd2ec88){logger['error'](_0x79fe('0x1a'),_0xd2ec88['message'],_0x25e51f);_0x4141ec(_0x4bca4d[_0x79fe('0x15')](0x1f4,_0xd2ec88[_0x79fe('0x17')]));});});};exports[_0x79fe('0x23')]=function(_0x3558f2){var _0x128ca3=this;return new Promise(function(_0x5ac1c4,_0x436279){return db[_0x79fe('0x1b')][_0x79fe('0x24')]({'raw':_0x3558f2[_0x79fe('0x1c')]?_0x3558f2[_0x79fe('0x1c')][_0x79fe('0x1d')]===undefined?!![]:![]:!![],'where':_0x3558f2['options']?_0x3558f2[_0x79fe('0x1c')][_0x79fe('0x1e')]||null:null,'attributes':_0x3558f2[_0x79fe('0x1c')]?_0x3558f2[_0x79fe('0x1c')][_0x79fe('0x21')]||null:null,'include':_0x3558f2[_0x79fe('0x1c')]?_0x3558f2['options'][_0x79fe('0x1f')]?_['map'](_0x3558f2[_0x79fe('0x1c')]['include'],function(_0x2a533b){return{'model':db[_0x2a533b['model']],'as':_0x2a533b['as'],'attributes':_0x2a533b[_0x79fe('0x21')],'include':_0x2a533b[_0x79fe('0x1f')]?_[_0x79fe('0x22')](_0x2a533b['include'],function(_0x174423){return{'model':db[_0x174423[_0x79fe('0x20')]],'as':_0x174423['as'],'attributes':_0x174423[_0x79fe('0x21')],'include':_0x174423[_0x79fe('0x1f')]?_[_0x79fe('0x22')](_0x174423['include'],function(_0x53957b){return{'model':db[_0x53957b[_0x79fe('0x20')]],'as':_0x53957b['as'],'attributes':_0x53957b['attributes']};}):[]};}):[]};}):[]:[]})[_0x79fe('0xe')](function(_0x44d97e){if(_0x3558f2['options'][_0x79fe('0x25')]===!![])_0x44d97e[_0x79fe('0x26')](_0x79fe('0x27'),_0x44d97e[_0x79fe('0x28')]());logger[_0x79fe('0xf')](_0x79fe('0x23'),_0x3558f2);logger['debug'](_0x79fe('0x23'),_0x3558f2,JSON[_0x79fe('0x14')](_0x44d97e));_0x5ac1c4(_0x44d97e);})[_0x79fe('0x19')](function(_0x2d2908){logger['error'](_0x79fe('0x23'),_0x2d2908['message'],_0x3558f2);_0x436279(_0x128ca3[_0x79fe('0x15')](0x1f4,_0x2d2908['message']));});});};exports[_0x79fe('0x29')]=function(_0x4ab42e){var _0x83737e=this;return new Promise(function(_0x132662,_0x577341){var _0x5e27bc={'body':_0x4ab42e[_0x79fe('0x2a')],'channel':_0x79fe('0x2b')};var _0x69ae72=_[_0x79fe('0x2c')](_['keys'](db['CmContact'][_0x79fe('0x2d')]),[_0x79fe('0x2e'),_0x79fe('0x2f'),_0x79fe('0x30'),_0x79fe('0x31')]);var _0x3feb46=![];if(_0x4ab42e[_0x79fe('0x2a')]['id']){delete _0x4ab42e[_0x79fe('0x2a')]['id'];}if(_['isNil'](_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x32')])){return _0x577341(_0x83737e[_0x79fe('0x15')](0x1f4,_0x79fe('0x33')));}if(_[_0x79fe('0x34')](_0x4ab42e[_0x79fe('0x2a')]['body'])||_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x2a')]===''){return _0x577341(_0x83737e[_0x79fe('0x15')](0x1f4,_0x79fe('0x35')));}if(_[_0x79fe('0x34')](_0x4ab42e[_0x79fe('0x2a')]['mapKey'])){return _0x577341(_0x83737e[_0x79fe('0x15')](0x1f4,_0x79fe('0x36')+_0x69ae72));}if(!_[_0x79fe('0x37')](_0x69ae72,_0x4ab42e['body'][_0x79fe('0x38')])){return _0x577341(_0x83737e['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x69ae72));}var _0x28068f={};_0x28068f[_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x38')]]=_0x4ab42e['body'][_0x79fe('0x32')];return db[_0x79fe('0x1b')][_0x79fe('0x24')]({'where':{'id':_0x4ab42e['account']['id']},'include':[{'model':db['CmList'],'as':_0x79fe('0x39'),'include':[{'model':db[_0x79fe('0x3a')],'as':_0x79fe('0x3b'),'where':_0x28068f,'limit':0x1,'order':[[_0x79fe('0x2f'),_0x79fe('0x3c')]]}]},{'model':db[_0x79fe('0x3d')],'as':_0x79fe('0x3e')},{'model':db[_0x79fe('0x3f')],'as':_0x79fe('0x40'),'include':[{'model':db['CloudProvider'],'as':_0x79fe('0x41')}]}]})[_0x79fe('0xe')](function(_0x496486){if(_0x496486&&_0x496486[_0x79fe('0x39')]){var _0x4bd648=_0x496486[_0x79fe('0x42')]({'plain':!![]});_0x5e27bc[_0x79fe('0x43')]=_[_0x79fe('0x44')](_0x4bd648,[_0x79fe('0x3e'),'List']);_0x5e27bc[_0x79fe('0x43')][_0x79fe('0x27')]=_0x496486[_0x79fe('0x28')]();_0x5e27bc['applications']=_0x4bd648['Applications'];_0x5e27bc[_0x79fe('0x45')]=_0x4bd648[_0x79fe('0x39')];_0x5e27bc['applications']=_[_0x79fe('0x46')](_0x5e27bc[_0x79fe('0x47')],[_0x79fe('0x48')],[_0x79fe('0x49')]);if(_0x5e27bc['account']&&_0x5e27bc[_0x79fe('0x43')][_0x79fe('0x4a')]){_0x5e27bc[_0x79fe('0x47')]['push']({'id':0x0,'priority':_0x5e27bc['applications']['length']+0x1,'app':'close','appdata':'autoclose','interval':_0x79fe('0x4b')});}if(_0x5e27bc[_0x79fe('0x43')]['Applications']){delete _0x5e27bc[_0x79fe('0x43')][_0x79fe('0x3e')];}if(_0x5e27bc[_0x79fe('0x43')]['List']){delete _0x5e27bc['account']['List'];}if(_0x4bd648[_0x79fe('0x39')]['Contacts'][_0x79fe('0x4c')]){return _0x4bd648[_0x79fe('0x39')][_0x79fe('0x3b')][0x0];}var _0x1ac188=_[_0x79fe('0x9')](_0x4ab42e[_0x79fe('0x2a')],{'firstName':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x32')],'ListId':_0x4bd648[_0x79fe('0x31')]});_0x1ac188[_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x38')]]=_0x4ab42e['body'][_0x79fe('0x32')];return db[_0x79fe('0x3a')]['create'](_0x1ac188);}else{throw new Error(_0x79fe('0x4d'));}})['then'](function(_0xc1ec58){_0x5e27bc[_0x79fe('0x4e')]=_0xc1ec58;if(_0xc1ec58){if(!_0x4ab42e['body'][_0x79fe('0x17')]['messageId']){_0x4ab42e[_0x79fe('0x2a')]['message']['messageId']=rs['generate']()+'\x20'+_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')][_0x79fe('0x32')];}var _0x350da0={'ContactId':_0xc1ec58['id'],'MailAccountId':_0x4ab42e[_0x79fe('0x43')]['id'],'inReplyTo':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')][_0x79fe('0x4f')],'to':_0x4ab42e[_0x79fe('0x2a')]['message'][_0x79fe('0x32')],'cc':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')]['cc'],'subject':_0x4ab42e[_0x79fe('0x2a')]['message'][_0x79fe('0x50')],'attach':_0x4ab42e['body'][_0x79fe('0x17')]['attach'],'lastMsgAt':moment()[_0x79fe('0x51')](_0x79fe('0x52')),'lastMsgDirection':'in'};return db[_0x79fe('0x53')][_0x79fe('0x24')]({'where':{'closed':![],'MailAccountId':_0x4ab42e['account']['id']},'include':[{'model':db[_0x79fe('0x54')],'as':_0x79fe('0x55'),'attributes':[_0x79fe('0x4f')],'where':{'messageId':_0x4ab42e[_0x79fe('0x2a')]['message'][_0x79fe('0x56')]}}]})[_0x79fe('0xe')](function(_0x50ed6c){if(_0x50ed6c){return[_0x50ed6c,![]];}return db[_0x79fe('0x53')]['create'](_0x350da0)['then'](function(_0x37ccea){return[_0x37ccea,!![]];});});}else{throw new Error(_0x79fe('0x57'));}})[_0x79fe('0x58')](function(_0x49de47,_0x58adb7){if(_0x49de47){_0x3feb46=_0x58adb7;if(!_0x58adb7){return _0x49de47[_0x79fe('0x59')]({'inReplyTo':_0x4ab42e['body']['message'][_0x79fe('0x4f')],'to':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')][_0x79fe('0x32')],'cc':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')]['cc'],'subject':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')][_0x79fe('0x50')],'attach':_0x49de47['attach']?_0x49de47[_0x79fe('0x5a')]:_0x4ab42e[_0x79fe('0x2a')]['message'][_0x79fe('0x5a')],'substatus':null,'substatusAt':moment()[_0x79fe('0x51')](_0x79fe('0x52')),'lastMsgAt':moment()[_0x79fe('0x51')](_0x79fe('0x52')),'lastMsgDirection':'in'});}else{return _0x49de47;}}})[_0x79fe('0xe')](function(_0x6cf38e){_0x5e27bc[_0x79fe('0x5b')]=_0x6cf38e[_0x79fe('0x42')]({'plain':!![]});_0x5e27bc[_0x79fe('0x5b')][_0x79fe('0x5c')]=_0x3feb46;return db['MailMessage'][_0x79fe('0x5d')]({'body':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x2a')],'MailAccountId':_0x4ab42e[_0x79fe('0x43')]['id'],'MailInteractionId':_0x6cf38e['id'],'direction':'in','ContactId':_0x5e27bc[_0x79fe('0x4e')]['id'],'messageId':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')]['messageId'],'from':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')][_0x79fe('0x32')],'to':_0x4ab42e['body']['message']['to'],'cc':_0x4ab42e['body']['message']['cc'],'subject':_0x4ab42e[_0x79fe('0x2a')]['message'][_0x79fe('0x50')],'attach':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')][_0x79fe('0x5a')],'Attachments':_0x4ab42e[_0x79fe('0x2a')]['message'][_0x79fe('0x5e')],'originTo':_0x4ab42e['body'][_0x79fe('0x17')][_0x79fe('0x5f')],'originCc':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')][_0x79fe('0x60')],'bcc':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')]['bcc'],'ChatWebsiteId':_0x4ab42e[_0x79fe('0x2a')]['message'][_0x79fe('0x61')]||null,'originChannel':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')]['originChannel']||_0x79fe('0x62'),'ChatOfflineMessageId':_0x4ab42e[_0x79fe('0x2a')][_0x79fe('0x17')][_0x79fe('0x63')]||null},{'include':[{'model':db['Attachment'],'as':_0x79fe('0x64')}]});})[_0x79fe('0xe')](function(_0x2d4bfa){_0x5e27bc['message']=_0x2d4bfa;if(!_0x5e27bc[_0x79fe('0x5b')][_0x79fe('0x65')]){return;}return db[_0x79fe('0x66')][_0x79fe('0x24')]({'attributes':['id',_0x79fe('0x67')],'where':{'id':_0x5e27bc[_0x79fe('0x5b')][_0x79fe('0x65')]}});})[_0x79fe('0xe')](function(_0x25edcd){if(_0x25edcd){_0x5e27bc['applications'][_0x79fe('0x68')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x25edcd[_0x79fe('0x67')]+','+(_0x5e27bc[_0x79fe('0x43')][_0x79fe('0x69')]||0xa),'interval':_0x79fe('0x4b')});}if(!_0x5e27bc[_0x79fe('0x5b')]['queueId']){return;}return db[_0x79fe('0x6a')]['find']({'attributes':['id',_0x79fe('0x67')],'where':{'id':_0x5e27bc[_0x79fe('0x5b')]['queueId']}});})[_0x79fe('0xe')](function(_0x3d7392){if(_0x3d7392){_0x5e27bc[_0x79fe('0x47')][_0x79fe('0x68')]({'id':0x0,'priority':0x1,'app':_0x79fe('0x6b'),'appdata':_0x3d7392['name']+','+(_0x5e27bc[_0x79fe('0x43')][_0x79fe('0x6c')]||0x12c),'interval':_0x79fe('0x4b')});}return respondWithRpcPromise(_0x79fe('0x6d'),_0x79fe('0x6e'),_0x5e27bc);})[_0x79fe('0xe')](function(_0x477c6f){_0x132662(_0x477c6f);})[_0x79fe('0x19')](function(_0x38fc15){_0x577341(_0x83737e[_0x79fe('0x15')](0x1f4,_0x38fc15['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9d81093..f8d49fe 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 _0x9a6d=['register','length','mailAccount:','./mailAccount.events','save','update','emit','removeListener'];(function(_0x14afda,_0x512394){var _0x1923af=function(_0x6919df){while(--_0x6919df){_0x14afda['push'](_0x14afda['shift']());}};_0x1923af(++_0x512394);}(_0x9a6d,0x10b));var _0xd9a6=function(_0x5d4aa0,_0x2d9fa3){_0x5d4aa0=_0x5d4aa0-0x0;var _0x4b03d2=_0x9a6d[_0x5d4aa0];return _0x4b03d2;};'use strict';var MailAccountEvents=require(_0xd9a6('0x0'));var events=[_0xd9a6('0x1'),'remove',_0xd9a6('0x2')];function createListener(_0x3e5806,_0x72f834){return function(_0xd4daec){_0x72f834[_0xd9a6('0x3')](_0x3e5806,_0xd4daec);};}function removeListener(_0x541d50,_0x45446e){return function(){MailAccountEvents[_0xd9a6('0x4')](_0x541d50,_0x45446e);};}exports[_0xd9a6('0x5')]=function(_0x583850){for(var _0x2326a3=0x0,_0x585700=events[_0xd9a6('0x6')];_0x2326a3<_0x585700;_0x2326a3++){var _0x5b7b19=events[_0x2326a3];var _0x176ffe=createListener(_0xd9a6('0x7')+_0x5b7b19,_0x583850);MailAccountEvents['on'](_0x5b7b19,_0x176ffe);}}; \ No newline at end of file +var _0x689b=['./mailAccount.events','remove','emit','removeListener','register','length','mailAccount:'];(function(_0x2d994a,_0x503797){var _0x15ec24=function(_0xa98bea){while(--_0xa98bea){_0x2d994a['push'](_0x2d994a['shift']());}};_0x15ec24(++_0x503797);}(_0x689b,0x142));var _0xb689=function(_0x5aa163,_0x28cc1a){_0x5aa163=_0x5aa163-0x0;var _0x55ca1d=_0x689b[_0x5aa163];return _0x55ca1d;};'use strict';var MailAccountEvents=require(_0xb689('0x0'));var events=['save',_0xb689('0x1'),'update'];function createListener(_0x5e98bb,_0x213562){return function(_0x2530a1){_0x213562[_0xb689('0x2')](_0x5e98bb,_0x2530a1);};}function removeListener(_0x4378a8,_0x2bcd76){return function(){MailAccountEvents[_0xb689('0x3')](_0x4378a8,_0x2bcd76);};}exports[_0xb689('0x4')]=function(_0x4bb98f){for(var _0x1b9fed=0x0,_0x5ee263=events[_0xb689('0x5')];_0x1b9fed<_0x5ee263;_0x1b9fed++){var _0x56c6ba=events[_0x1b9fed];var _0x6eaf58=createListener(_0xb689('0x6')+_0x56c6ba,_0x4bb98f);MailAccountEvents['on'](_0x56c6ba,_0x6eaf58);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 0513169..5b844bd 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 _0x0a33=['util','connect-timeout','Router','../../components/interaction/service','./mailApplication.controller','get','/:id','show','isAuthenticated','delete','exports','multer'];(function(_0x263cb4,_0x53ce57){var _0x32a04b=function(_0x31e87b){while(--_0x31e87b){_0x263cb4['push'](_0x263cb4['shift']());}};_0x32a04b(++_0x53ce57);}(_0x0a33,0x1af));var _0x30a3=function(_0x36db65,_0x2b4af1){_0x36db65=_0x36db65-0x0;var _0x5bea6a=_0x0a33[_0x36db65];return _0x5bea6a;};'use strict';var multer=require(_0x30a3('0x0'));var util=require(_0x30a3('0x1'));var path=require('path');var timeout=require(_0x30a3('0x2'));var express=require('express');var router=express[_0x30a3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x30a3('0x4'));var config=require('../../config/environment');var controller=require(_0x30a3('0x5'));router[_0x30a3('0x6')](_0x30a3('0x7'),auth['isAuthenticated'](),controller[_0x30a3('0x8')]);router['put'](_0x30a3('0x7'),auth[_0x30a3('0x9')](),controller['update']);router[_0x30a3('0xa')](_0x30a3('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x30a3('0xb')]=router; \ No newline at end of file +var _0xecb5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','destroy','exports','multer','util','path'];(function(_0x3d6011,_0x21f920){var _0x1bb655=function(_0x409c96){while(--_0x409c96){_0x3d6011['push'](_0x3d6011['shift']());}};_0x1bb655(++_0x21f920);}(_0xecb5,0x12f));var _0x5ecb=function(_0xda96,_0x35b043){_0xda96=_0xda96-0x0;var _0x394b20=_0xecb5[_0xda96];return _0x394b20;};'use strict';var multer=require(_0x5ecb('0x0'));var util=require(_0x5ecb('0x1'));var path=require(_0x5ecb('0x2'));var timeout=require(_0x5ecb('0x3'));var express=require(_0x5ecb('0x4'));var router=express[_0x5ecb('0x5')]();var fs_extra=require(_0x5ecb('0x6'));var auth=require(_0x5ecb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5ecb('0x8'));var controller=require(_0x5ecb('0x9'));router[_0x5ecb('0xa')](_0x5ecb('0xb'),auth['isAuthenticated'](),controller[_0x5ecb('0xc')]);router[_0x5ecb('0xd')](_0x5ecb('0xb'),auth[_0x5ecb('0xe')](),controller[_0x5ecb('0xf')]);router['delete'](_0x5ecb('0xb'),auth[_0x5ecb('0xe')](),controller[_0x5ecb('0x10')]);module[_0x5ecb('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a92502e..aa21b76 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 _0x8b86=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1ad110,_0x1d17b6){var _0x5ba3b3=function(_0x4dc8aa){while(--_0x4dc8aa){_0x1ad110['push'](_0x1ad110['shift']());}};_0x5ba3b3(++_0x1d17b6);}(_0x8b86,0x112));var _0x68b8=function(_0x1465e2,_0x7e5150){_0x1465e2=_0x1465e2-0x0;var _0x38f758=_0x8b86[_0x1465e2];return _0x38f758;};'use strict';var Sequelize=require(_0x68b8('0x0'));module[_0x68b8('0x1')]={'priority':{'type':Sequelize[_0x68b8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x68b8('0x3')],'allowNull':![],'defaultValue':_0x68b8('0x4')},'appdata':{'type':Sequelize[_0x68b8('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x68b8('0x6')}}; \ No newline at end of file +var _0xae53=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x544f38,_0x1be834){var _0x25165b=function(_0x300b3d){while(--_0x300b3d){_0x544f38['push'](_0x544f38['shift']());}};_0x25165b(++_0x1be834);}(_0xae53,0x1e6));var _0x3ae5=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xae53[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0x3ae5('0x0'));module[_0x3ae5('0x1')]={'priority':{'type':Sequelize[_0x3ae5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3ae5('0x3')],'allowNull':![],'defaultValue':_0x3ae5('0x4')},'appdata':{'type':Sequelize[_0x3ae5('0x5')]()},'description':{'type':Sequelize[_0x3ae5('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8228ca3..cf5bf02 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x49d51d,_0x503117){var _0x3326fa=function(_0x42b36f){while(--_0x42b36f){_0x49d51d['push'](_0x49d51d['shift']());}};_0x3326fa(++_0x503117);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x27ec21,_0x562e52){var _0x1513b6=function(_0x3557a0){while(--_0x3557a0){_0x27ec21['push'](_0x27ec21['shift']());}};_0x1513b6(++_0x562e52);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0xcb91[_0xe6e78c];return _0x2a09c8;};'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 c798256..5e9a9d7 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 _0xf09c=['rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2af627,_0x33d47f){var _0x14eda9=function(_0x38679a){while(--_0x38679a){_0x2af627['push'](_0x2af627['shift']());}};_0x14eda9(++_0x33d47f);}(_0xf09c,0x165));var _0xcf09=function(_0x2a041f,_0x124a26){_0x2a041f=_0x2a041f-0x0;var _0x1ed6c9=_0xf09c[_0x2a041f];return _0x1ed6c9;};'use strict';var _=require(_0xcf09('0x0'));var util=require(_0xcf09('0x1'));var logger=require(_0xcf09('0x2'))('api');var moment=require(_0xcf09('0x3'));var BPromise=require(_0xcf09('0x4'));var rp=require(_0xcf09('0x5'));var fs=require('fs');var path=require(_0xcf09('0x6'));var rimraf=require(_0xcf09('0x7'));var config=require(_0xcf09('0x8'));var attributes=require('./mailApplication.attributes');module[_0xcf09('0x9')]=function(_0x50fb36,_0x21a439){return _0x50fb36['define'](_0xcf09('0xa'),attributes,{'tableName':_0xcf09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcf09('0xc'),'collate':_0xcf09('0xd')});}; \ No newline at end of file +var _0x6ad7=['../../config/logger','api','moment','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x6ad7,0xb4));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ad('0x0'));var util=require(_0x76ad('0x1'));var logger=require(_0x76ad('0x2'))(_0x76ad('0x3'));var moment=require(_0x76ad('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x76ad('0x5'));var rimraf=require(_0x76ad('0x6'));var config=require(_0x76ad('0x7'));var attributes=require(_0x76ad('0x8'));module[_0x76ad('0x9')]=function(_0x59ca8a,_0x5c7bb3){return _0x59ca8a['define'](_0x76ad('0xa'),attributes,{'tableName':_0x76ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x76ad('0xc'),'collate':_0x76ad('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3a9947a..fc5fa62 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 _0xc84a=['where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw'];(function(_0x4d0c03,_0x3f0ade){var _0x4c3c5f=function(_0xc4b7){while(--_0xc4b7){_0x4d0c03['push'](_0x4d0c03['shift']());}};_0x4c3c5f(++_0x3f0ade);}(_0xc84a,0x106));var _0xac84=function(_0x257a76,_0x5f37a9){_0x257a76=_0x257a76-0x0;var _0xcca621=_0xc84a[_0x257a76];return _0xcca621;};'use strict';var _=require(_0xac84('0x0'));var util=require('util');var moment=require(_0xac84('0x1'));var BPromise=require(_0xac84('0x2'));var rs=require(_0xac84('0x3'));var fs=require('fs');var Redis=require(_0xac84('0x4'));var db=require(_0xac84('0x5'))['db'];var utils=require(_0xac84('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xac84('0x7'));var jayson=require(_0xac84('0x8'));var client=jayson[_0xac84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2812b6,_0x4845f5,_0x3297aa){return new BPromise(function(_0x4cb7e5,_0x1eeb8c){return client[_0xac84('0xa')](_0x2812b6,_0x3297aa)[_0xac84('0xb')](function(_0x47b853){logger[_0xac84('0xc')](_0xac84('0xd'),_0x4845f5,_0xac84('0xe'));logger[_0xac84('0xf')](_0xac84('0x10'),_0x4845f5,_0xac84('0xe'),JSON['stringify'](_0x47b853));if(_0x47b853[_0xac84('0x11')]){if(_0x47b853['error'][_0xac84('0x12')]===0x1f4){logger[_0xac84('0x11')]('MailApplication,\x20%s,\x20%s',_0x4845f5,_0x47b853[_0xac84('0x11')][_0xac84('0x13')]);return _0x1eeb8c(_0x47b853['error'][_0xac84('0x13')]);}logger[_0xac84('0x11')](_0xac84('0xd'),_0x4845f5,_0x47b853[_0xac84('0x11')][_0xac84('0x13')]);return _0x4cb7e5(_0x47b853[_0xac84('0x11')]['message']);}else{logger[_0xac84('0xc')](_0xac84('0xd'),_0x4845f5,_0xac84('0xe'));_0x4cb7e5(_0x47b853[_0xac84('0x14')][_0xac84('0x13')]);}})[_0xac84('0x15')](function(_0x3dd47d){logger[_0xac84('0x11')](_0xac84('0xd'),_0x4845f5,_0x3dd47d);_0x1eeb8c(_0x3dd47d);});});}exports[_0xac84('0x16')]=function(_0x2e1d54){var _0x4b4c26=this;return new Promise(function(_0x6913d,_0x5d40b9){return db[_0xac84('0x17')][_0xac84('0x18')](_0x2e1d54[_0xac84('0x19')],{'raw':_0x2e1d54[_0xac84('0x1a')]?_0x2e1d54[_0xac84('0x1a')][_0xac84('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1d54['options']?_0x2e1d54[_0xac84('0x1a')][_0xac84('0x1c')]||null:null,'attributes':_0x2e1d54[_0xac84('0x1a')]?_0x2e1d54['options']['attributes']||null:null,'limit':_0x2e1d54['options']?_0x2e1d54['options']['limit']||null:null})[_0xac84('0xb')](function(_0x5de81a){logger[_0xac84('0xc')](_0xac84('0x16'),_0x2e1d54);logger[_0xac84('0xf')](_0xac84('0x16'),_0x2e1d54,JSON['stringify'](_0x5de81a));_0x6913d(_0x5de81a);})[_0xac84('0x15')](function(_0x51420c){logger[_0xac84('0x11')]('UpdateMailApplication',_0x51420c['message'],_0x2e1d54);_0x5d40b9(_0x4b4c26[_0xac84('0x11')](0x1f4,_0x51420c[_0xac84('0x13')]));});});}; \ No newline at end of file +var _0x80c9=['request','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateMailApplication','body','options','where','limit','then','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5454e2,_0x576f66){var _0x5b9409=function(_0x52b3dd){while(--_0x52b3dd){_0x5454e2['push'](_0x5454e2['shift']());}};_0x5b9409(++_0x576f66);}(_0x80c9,0x1d1));var _0x980c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80c9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x980c('0x0'));var util=require(_0x980c('0x1'));var moment=require(_0x980c('0x2'));var BPromise=require(_0x980c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x980c('0x4'))['db'];var utils=require(_0x980c('0x5'));var logger=require(_0x980c('0x6'))(_0x980c('0x7'));var config=require('../../config/environment');var jayson=require(_0x980c('0x8'));var client=jayson[_0x980c('0x9')][_0x980c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e405a,_0xa8fbb5,_0x133fbd){return new BPromise(function(_0x2a66a5,_0x237b07){return client[_0x980c('0xb')](_0x3e405a,_0x133fbd)['then'](function(_0x3f5175){logger['info'](_0x980c('0xc'),_0xa8fbb5,_0x980c('0xd'));logger['debug'](_0x980c('0xe'),_0xa8fbb5,_0x980c('0xd'),JSON['stringify'](_0x3f5175));if(_0x3f5175[_0x980c('0xf')]){if(_0x3f5175['error'][_0x980c('0x10')]===0x1f4){logger[_0x980c('0xf')](_0x980c('0xc'),_0xa8fbb5,_0x3f5175[_0x980c('0xf')]['message']);return _0x237b07(_0x3f5175[_0x980c('0xf')][_0x980c('0x11')]);}logger[_0x980c('0xf')]('MailApplication,\x20%s,\x20%s',_0xa8fbb5,_0x3f5175[_0x980c('0xf')][_0x980c('0x11')]);return _0x2a66a5(_0x3f5175[_0x980c('0xf')]['message']);}else{logger[_0x980c('0x12')](_0x980c('0xc'),_0xa8fbb5,_0x980c('0xd'));_0x2a66a5(_0x3f5175[_0x980c('0x13')]['message']);}})['catch'](function(_0x359b05){logger['error'](_0x980c('0xc'),_0xa8fbb5,_0x359b05);_0x237b07(_0x359b05);});});}exports[_0x980c('0x14')]=function(_0x5759b0){var _0x248d92=this;return new Promise(function(_0x4db599,_0x31ad67){return db['MailApplication']['update'](_0x5759b0[_0x980c('0x15')],{'raw':_0x5759b0['options']?_0x5759b0[_0x980c('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5759b0[_0x980c('0x16')]?_0x5759b0[_0x980c('0x16')][_0x980c('0x17')]||null:null,'attributes':_0x5759b0[_0x980c('0x16')]?_0x5759b0[_0x980c('0x16')]['attributes']||null:null,'limit':_0x5759b0['options']?_0x5759b0[_0x980c('0x16')][_0x980c('0x18')]||null:null})[_0x980c('0x19')](function(_0x16e5e3){logger[_0x980c('0x12')]('UpdateMailApplication',_0x5759b0);logger['debug'](_0x980c('0x14'),_0x5759b0,JSON[_0x980c('0x1a')](_0x16e5e3));_0x4db599(_0x16e5e3);})[_0x980c('0x1b')](function(_0x2e5b14){logger['error'](_0x980c('0x14'),_0x2e5b14[_0x980c('0x11')],_0x5759b0);_0x31ad67(_0x248d92[_0x980c('0xf')](0x1f4,_0x2e5b14[_0x980c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 42fa779..b2bf681 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 _0xf3ba=['mailinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','/describe','isAuthenticated','describe','/:id','getMessages','/:id/download','post','create','/:id/messages','addMessage','tracked','mail','mailinteraction:addtags','addTags'];(function(_0x57ede1,_0x130326){var _0x203a00=function(_0x468a61){while(--_0x468a61){_0x57ede1['push'](_0x57ede1['shift']());}};_0x203a00(++_0x130326);}(_0xf3ba,0x1b7));var _0xaf3b=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xf3ba[_0x4394b6];return _0x360244;};'use strict';var express=require(_0xaf3b('0x0'));var router=express[_0xaf3b('0x1')]();var auth=require(_0xaf3b('0x2'));var interaction=require(_0xaf3b('0x3'));var controller=require(_0xaf3b('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaf3b('0x5')](_0xaf3b('0x6'),auth[_0xaf3b('0x7')](),controller[_0xaf3b('0x8')]);router['get'](_0xaf3b('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xaf3b('0xa')]);router[_0xaf3b('0x5')](_0xaf3b('0xb'),auth['isAuthenticated'](),controller['download']);router[_0xaf3b('0xc')]('/',auth[_0xaf3b('0x7')](),controller[_0xaf3b('0xd')]);router[_0xaf3b('0xc')](_0xaf3b('0xe'),auth[_0xaf3b('0x7')](),controller[_0xaf3b('0xf')]);router['post']('/:id/tags',auth[_0xaf3b('0x7')](),interaction[_0xaf3b('0x10')](_0xaf3b('0x11'),_0xaf3b('0x12')),controller[_0xaf3b('0x13')]);router['put'](_0xaf3b('0x9'),auth['isAuthenticated'](),interaction[_0xaf3b('0x10')](_0xaf3b('0x11'),_0xaf3b('0x14')),controller[_0xaf3b('0x15')]);router[_0xaf3b('0x16')](_0xaf3b('0x9'),auth[_0xaf3b('0x7')](),interaction[_0xaf3b('0x10')](_0xaf3b('0x11'),'mailinteraction:destroy'),controller[_0xaf3b('0x17')]);router[_0xaf3b('0x16')](_0xaf3b('0x18'),auth[_0xaf3b('0x7')](),controller[_0xaf3b('0x19')]);module[_0xaf3b('0x1a')]=router; \ No newline at end of file +var _0x3f11=['addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x3f11,0x184));var _0x13f1=function(_0x11f15e,_0x2cc181){_0x11f15e=_0x11f15e-0x0;var _0x27dad5=_0x3f11[_0x11f15e];return _0x27dad5;};'use strict';var express=require(_0x13f1('0x0'));var router=express[_0x13f1('0x1')]();var auth=require(_0x13f1('0x2'));var interaction=require(_0x13f1('0x3'));var controller=require(_0x13f1('0x4'));router['get']('/',auth[_0x13f1('0x5')](),controller[_0x13f1('0x6')]);router[_0x13f1('0x7')](_0x13f1('0x8'),auth['isAuthenticated'](),controller[_0x13f1('0x9')]);router[_0x13f1('0x7')](_0x13f1('0xa'),auth[_0x13f1('0x5')](),controller[_0x13f1('0xb')]);router['get'](_0x13f1('0xc'),auth[_0x13f1('0x5')](),controller[_0x13f1('0xd')]);router[_0x13f1('0x7')](_0x13f1('0xe'),auth[_0x13f1('0x5')](),controller[_0x13f1('0xf')]);router[_0x13f1('0x10')]('/',auth[_0x13f1('0x5')](),controller[_0x13f1('0x11')]);router['post'](_0x13f1('0xc'),auth['isAuthenticated'](),controller[_0x13f1('0x12')]);router[_0x13f1('0x10')](_0x13f1('0x13'),auth[_0x13f1('0x5')](),interaction[_0x13f1('0x14')](_0x13f1('0x15'),_0x13f1('0x16')),controller['addTags']);router[_0x13f1('0x17')](_0x13f1('0xa'),auth[_0x13f1('0x5')](),interaction[_0x13f1('0x14')](_0x13f1('0x15'),_0x13f1('0x18')),controller[_0x13f1('0x19')]);router['delete'](_0x13f1('0xa'),auth[_0x13f1('0x5')](),interaction[_0x13f1('0x14')](_0x13f1('0x15'),_0x13f1('0x1a')),controller[_0x13f1('0x1b')]);router['delete'](_0x13f1('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0x13f1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 955a654..a68844c 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 _0x4576=['out','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x4576,0xaa));var _0x6457=function(_0x199a37,_0xed1c57){_0x199a37=_0x199a37-0x0;var _0x53071c=_0x4576[_0x199a37];return _0x53071c;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6457('0x0')]},'disposition':{'type':Sequelize[_0x6457('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6457('0x1')]},'inReplyTo':{'type':Sequelize[_0x6457('0x1')](0x1fe)},'to':{'type':Sequelize[_0x6457('0x1')]},'cc':{'type':Sequelize[_0x6457('0x2')](_0x6457('0x3'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6457('0x0')]},'substatus':{'type':Sequelize[_0x6457('0x1')](0x3c)},'substatusAt':{'type':Sequelize[_0x6457('0x0')]},'firstMsgDirection':{'type':Sequelize[_0x6457('0x4')]('in',_0x6457('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6457('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x6457('0x4')]('in',_0x6457('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6457('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe5b9=['ENUM','out','INTEGER','sequelize','iconv','BOOLEAN','STRING','TEXT','DATE'];(function(_0xc7c028,_0x50607f){var _0x462ba3=function(_0x15586b){while(--_0x15586b){_0xc7c028['push'](_0xc7c028['shift']());}};_0x462ba3(++_0x50607f);}(_0xe5b9,0x78));var _0x9e5b=function(_0x21dc5c,_0x1beb44){_0x21dc5c=_0x21dc5c-0x0;var _0x409501=_0xe5b9[_0x21dc5c];return _0x409501;};'use strict';var Sequelize=require(_0x9e5b('0x0'));var iconv=require(_0x9e5b('0x1'));module['exports']={'closed':{'type':Sequelize[_0x9e5b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9e5b('0x3')]},'note':{'type':Sequelize[_0x9e5b('0x3')]},'inReplyTo':{'type':Sequelize[_0x9e5b('0x3')](0x1fe)},'to':{'type':Sequelize[_0x9e5b('0x3')]},'cc':{'type':Sequelize[_0x9e5b('0x4')]('long')},'subject':{'type':Sequelize[_0x9e5b('0x4')]()},'attach':{'type':Sequelize[_0x9e5b('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9e5b('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x9e5b('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x9e5b('0x6')]('in',_0x9e5b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9e5b('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x9e5b('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9e5b('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9e5b('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c12f082..f0ad736 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 _0xc26e=['params','describe','MailMessage','addMessage','ids','getMessages','findOne','sort','where','pick','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','inlineCss','true','rows','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','toString','root','join','server','files','attachments','Attachments','Messages','bcc','subject','createdAt','get','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','redis','localhost','./mailInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','update','then','end','error','name','send','index','map','rawAttributes','type','key','getOptions','user','catch','show','model','keys','MailInteraction','query','filters','attributes','intersection','fields','length','merge','options','find','create','body'];(function(_0x4b831b,_0xa6c4f2){var _0x4b63e5=function(_0xc71177){while(--_0xc71177){_0x4b831b['push'](_0x4b831b['shift']());}};_0x4b63e5(++_0xa6c4f2);}(_0xc26e,0x10b));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xec26('0x0'));var rimraf=require(_0xec26('0x1'));var zipdir=require(_0xec26('0x2'));var moment=require(_0xec26('0x3'));var BPromise=require(_0xec26('0x4'));var util=require(_0xec26('0x5'));var path=require(_0xec26('0x6'));var fs=require('fs');var _=require('lodash');var juice=require(_0xec26('0x7'));var Redis=require(_0xec26('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xec26('0x9'));var logger=require(_0xec26('0xa'))(_0xec26('0xb'));var config=require(_0xec26('0xc'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xec26('0xd'));config[_0xec26('0xe')]=_['defaults'](config['redis'],{'host':_0xec26('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec26('0xe')]));require(_0xec26('0x10'))['register'](socket);function respondWithStatusCode(_0x53ce76,_0x38e5de){_0x38e5de=_0x38e5de||0xcc;return function(_0x3dd5ad){if(_0x3dd5ad){return _0x53ce76[_0xec26('0x11')](_0x38e5de);}return _0x53ce76[_0xec26('0x12')](_0x38e5de)['end']();};}function respondWithResult(_0x41a110,_0x1c00d7){_0x1c00d7=_0x1c00d7||0xc8;return function(_0x451505){if(_0x451505){return _0x41a110['status'](_0x1c00d7)[_0xec26('0x13')](_0x451505);}};}function respondWithFilteredResult(_0x103b72,_0x28bbb5){return function(_0xe80d25){if(_0xe80d25){var _0x225de9=typeof _0x28bbb5[_0xec26('0x14')]===_0xec26('0x15')&&typeof _0x28bbb5[_0xec26('0x16')]===_0xec26('0x15');var _0x2ad3c8=_0xe80d25[_0xec26('0x17')];var _0x42099f=_0x225de9?0x0:_0x28bbb5[_0xec26('0x14')];var _0x45f404=_0x225de9?_0xe80d25[_0xec26('0x17')]:_0x28bbb5[_0xec26('0x14')]+_0x28bbb5['limit'];var _0x4eccff;if(_0x45f404>=_0x2ad3c8){_0x45f404=_0x2ad3c8;_0x4eccff=0xc8;}else{_0x4eccff=0xce;}_0x103b72['status'](_0x4eccff);return _0x103b72[_0xec26('0x18')]('Content-Range',_0x42099f+'-'+_0x45f404+'/'+_0x2ad3c8)[_0xec26('0x13')](_0xe80d25);}return null;};}function saveUpdates(_0x7a9326){return function(_0x44663d){if(_0x44663d){return _0x44663d[_0xec26('0x19')](_0x7a9326)[_0xec26('0x1a')](function(_0x186b22){return _0x186b22;});}return null;};}function removeEntity(_0x55884a){return function(_0x11c09d){if(_0x11c09d){return _0x11c09d['destroy']()['then'](function(){_0x55884a[_0xec26('0x12')](0xcc)[_0xec26('0x1b')]();});}};}function handleEntityNotFound(_0x345e10){return function(_0xeb2429){if(!_0xeb2429){_0x345e10[_0xec26('0x11')](0x194);}return _0xeb2429;};}function handleError(_0x7135c0,_0x3348e3){_0x3348e3=_0x3348e3||0x1f4;return function(_0x27e3e4){logger[_0xec26('0x1c')](_0x27e3e4['stack']);if(_0x27e3e4[_0xec26('0x1d')]){delete _0x27e3e4[_0xec26('0x1d')];}_0x7135c0[_0xec26('0x12')](_0x3348e3)[_0xec26('0x1e')](_0x27e3e4);};}exports[_0xec26('0x1f')]=function(_0xd74fbb,_0x553a48){var _0xb7635d={};var _0x301e03=_[_0xec26('0x20')](db['MailInteraction'][_0xec26('0x21')],function(_0x3af5f0){return{'name':_0x3af5f0['fieldName'],'type':_0x3af5f0[_0xec26('0x22')][_0xec26('0x23')]};});_0xb7635d=qs[_0xec26('0x24')](_0x301e03,_0xd74fbb);return interaction['findAll']('mail',_0xd74fbb['query'],_0xd74fbb[_0xec26('0x25')],_0xb7635d,_0x301e03)['then'](respondWithFilteredResult(_0x553a48,_0xb7635d))[_0xec26('0x26')](handleError(_0x553a48,null));};exports[_0xec26('0x27')]=function(_0x2d95e2,_0x5c0079){var _0x5c7127={'raw':![],'where':{'id':_0x2d95e2['params']['id']}},_0x16a8b1={};_0x16a8b1[_0xec26('0x28')]=_[_0xec26('0x29')](db[_0xec26('0x2a')][_0xec26('0x21')]);_0x16a8b1['query']=_[_0xec26('0x29')](_0x2d95e2[_0xec26('0x2b')]);_0x16a8b1[_0xec26('0x2c')]=_['intersection'](_0x16a8b1[_0xec26('0x28')],_0x16a8b1[_0xec26('0x2b')]);_0x5c7127[_0xec26('0x2d')]=_[_0xec26('0x2e')](_0x16a8b1[_0xec26('0x28')],qs[_0xec26('0x2f')](_0x2d95e2[_0xec26('0x2b')][_0xec26('0x2f')]));_0x5c7127[_0xec26('0x2d')]=_0x5c7127[_0xec26('0x2d')][_0xec26('0x30')]?_0x5c7127[_0xec26('0x2d')]:_0x16a8b1[_0xec26('0x28')];if(_0x2d95e2[_0xec26('0x2b')]['includeAll']){_0x5c7127['include']=[{'all':!![]}];}_0x5c7127=_[_0xec26('0x31')]({},_0x5c7127,_0x2d95e2[_0xec26('0x32')]);return db[_0xec26('0x2a')][_0xec26('0x33')](_0x5c7127)['then'](handleEntityNotFound(_0x5c0079,null))[_0xec26('0x1a')](respondWithResult(_0x5c0079,null))[_0xec26('0x26')](handleError(_0x5c0079,null));};exports[_0xec26('0x34')]=function(_0x477ff3,_0x5aa9ce){return db['MailInteraction'][_0xec26('0x34')](_0x477ff3['body'],{})[_0xec26('0x1a')](respondWithResult(_0x5aa9ce,0xc9))[_0xec26('0x26')](handleError(_0x5aa9ce,null));};exports[_0xec26('0x19')]=function(_0x29bab8,_0x1def93){if(_0x29bab8['body']['id']){delete _0x29bab8[_0xec26('0x35')]['id'];}return db[_0xec26('0x2a')][_0xec26('0x33')]({'where':{'id':_0x29bab8[_0xec26('0x36')]['id']}})[_0xec26('0x1a')](handleEntityNotFound(_0x1def93,null))[_0xec26('0x1a')](saveUpdates(_0x29bab8['body'],null))[_0xec26('0x1a')](respondWithResult(_0x1def93,null))[_0xec26('0x26')](handleError(_0x1def93,null));};exports['destroy']=function(_0x5b9c32,_0x5dd9af){return db[_0xec26('0x2a')][_0xec26('0x33')]({'where':{'id':_0x5b9c32['params']['id']}})['then'](handleEntityNotFound(_0x5dd9af,null))[_0xec26('0x1a')](removeEntity(_0x5dd9af,null))[_0xec26('0x26')](handleError(_0x5dd9af,null));};exports[_0xec26('0x37')]=function(_0x1eac1a,_0x5f2daa){return db[_0xec26('0x2a')][_0xec26('0x37')]()[_0xec26('0x1a')](respondWithResult(_0x5f2daa,null))[_0xec26('0x26')](handleError(_0x5f2daa,null));};exports['addMessage']=function(_0x4e9e7c,_0x2abdaf){return db[_0xec26('0x38')][_0xec26('0x33')]({'where':{'id':_0x4e9e7c[_0xec26('0x36')]['id']}})[_0xec26('0x1a')](handleEntityNotFound(_0x2abdaf,null))[_0xec26('0x1a')](function(_0x3b5924){if(_0x3b5924){return _0x3b5924[_0xec26('0x39')](_0x4e9e7c[_0xec26('0x35')][_0xec26('0x3a')],_['omit'](_0x4e9e7c[_0xec26('0x35')],[_0xec26('0x3a'),'id'])||{});}})[_0xec26('0x1a')](respondWithResult(_0x2abdaf,null))[_0xec26('0x26')](handleError(_0x2abdaf,null));};exports[_0xec26('0x3b')]=function(_0x167d68,_0x2ad9e7){var _0x1d9d55={'raw':![],'where':{}};var _0x246e69={};var _0x2e087c={'count':0x0,'rows':[]};return db[_0xec26('0x2a')][_0xec26('0x3c')]({'where':{'id':_0x167d68['params']['id']}})[_0xec26('0x1a')](handleEntityNotFound(_0x2ad9e7,null))[_0xec26('0x1a')](function(_0x4913c2){if(_0x4913c2){_0x246e69['model']=_[_0xec26('0x29')](db[_0xec26('0x38')][_0xec26('0x21')]);_0x246e69[_0xec26('0x2b')]=_[_0xec26('0x29')](_0x167d68['query']);_0x246e69[_0xec26('0x2c')]=_[_0xec26('0x2e')](_0x246e69['model'],_0x246e69[_0xec26('0x2b')]);_0x1d9d55[_0xec26('0x2d')]=_[_0xec26('0x2e')](_0x246e69[_0xec26('0x28')],qs['fields'](_0x167d68[_0xec26('0x2b')][_0xec26('0x2f')]));_0x1d9d55['attributes']=_0x1d9d55[_0xec26('0x2d')][_0xec26('0x30')]?_0x1d9d55[_0xec26('0x2d')]:_0x246e69[_0xec26('0x28')];if(!_0x167d68[_0xec26('0x2b')]['hasOwnProperty']('nolimit')){_0x1d9d55[_0xec26('0x16')]=qs[_0xec26('0x16')](_0x167d68[_0xec26('0x2b')][_0xec26('0x16')]);_0x1d9d55['offset']=qs[_0xec26('0x14')](_0x167d68[_0xec26('0x2b')][_0xec26('0x14')]);}_0x1d9d55['order']=qs[_0xec26('0x3d')](_0x167d68['query'][_0xec26('0x3d')]);_0x1d9d55[_0xec26('0x3e')]=qs['filters'](_[_0xec26('0x3f')](_0x167d68[_0xec26('0x2b')],_0x246e69[_0xec26('0x2c')]));_0x1d9d55[_0xec26('0x3e')][_0xec26('0x40')]=_0x4913c2['id'];if(_0x167d68[_0xec26('0x2b')][_0xec26('0x41')]){_0x1d9d55[_0xec26('0x3e')]=_[_0xec26('0x31')](_0x1d9d55[_0xec26('0x3e')],{'$or':_[_0xec26('0x20')](_0x1d9d55[_0xec26('0x2d')],function(_0x1c4c0e){var _0x22f8a6={};_0x22f8a6[_0x1c4c0e]={'$like':'%'+_0x167d68[_0xec26('0x2b')][_0xec26('0x41')]+'%'};return _0x22f8a6;})});}if(_0x167d68[_0xec26('0x2b')][_0xec26('0x42')]){var _0x5d9652=_0x167d68[_0xec26('0x2b')][_0xec26('0x42')]['split'](',');var _0x34c418={};_0x34c418[_0x5d9652[0x0]]={'$gte':moment(_0x5d9652[0x1])[_0xec26('0x43')](_0xec26('0x44'))};_0x1d9d55[_0xec26('0x3e')]=_[_0xec26('0x31')](_0x1d9d55[_0xec26('0x3e')],_0x34c418);}_0x1d9d55=_[_0xec26('0x31')]({},_0x1d9d55,_0x167d68['options']);return db[_0xec26('0x38')][_0xec26('0x17')]({'where':_0x1d9d55['where']})[_0xec26('0x1a')](function(_0x23e490){_0x2e087c[_0xec26('0x17')]=_0x23e490;if(_0x167d68['query'][_0xec26('0x45')]){_0x1d9d55[_0xec26('0x46')]=[{'all':!![]}];}return db[_0xec26('0x38')][_0xec26('0x47')](_0x1d9d55);})[_0xec26('0x1a')](function(_0xb5a932){if(_0x167d68['query'][_0xec26('0x48')]===_0xec26('0x49')){for(var _0x2f944e=0x0;_0x2f944e<_0xb5a932['length'];_0x2f944e++){_0xb5a932[_0x2f944e]['body']=juice(_0xb5a932[_0x2f944e][_0xec26('0x35')]);}}_0x2e087c[_0xec26('0x4a')]=_0xb5a932;return _0x2e087c;});}})[_0xec26('0x1a')](respondWithFilteredResult(_0x2ad9e7,_0x1d9d55))[_0xec26('0x26')](handleError(_0x2ad9e7,null));};exports['addTags']=function(_0x5281ce,_0x2a6b13){return db[_0xec26('0x2a')][_0xec26('0x33')]({'where':{'id':_0x5281ce[_0xec26('0x36')]['id']}})['then'](handleEntityNotFound(_0x2a6b13,null))[_0xec26('0x1a')](function(_0x8c97e){if(_0x8c97e){return _0x8c97e[_0xec26('0x4b')](_0x5281ce[_0xec26('0x35')]['ids'],_[_0xec26('0x4c')](_0x5281ce['body'],[_0xec26('0x3a'),'id'])||{})[_0xec26('0x4d')](function(){return db[_0xec26('0x4e')][_0xec26('0x47')]({'attributes':['id',_0xec26('0x1d'),_0xec26('0x4f')],'where':{'id':_0x5281ce['body'][_0xec26('0x3a')]}});})[_0xec26('0x1a')](function(_0xa9be79){socket[_0xec26('0x50')](_0xec26('0x51'),{'id':Number(_0x5281ce[_0xec26('0x36')]['id']),'tags':_0xa9be79||[]});return{'id':Number(_0x5281ce[_0xec26('0x36')]['id']),'tags':_0xa9be79||[]};});}})[_0xec26('0x1a')](respondWithResult(_0x2a6b13,null))['catch'](handleError(_0x2a6b13,null));};exports[_0xec26('0x52')]=function(_0x3c298f,_0xd807f4){return db[_0xec26('0x2a')][_0xec26('0x33')]({'where':{'id':_0x3c298f[_0xec26('0x36')]['id']}})[_0xec26('0x1a')](handleEntityNotFound(_0xd807f4,null))['then'](function(_0x58d065){if(_0x58d065){return _0x58d065[_0xec26('0x52')](_0x3c298f['query'][_0xec26('0x3a')]);}})[_0xec26('0x1a')](respondWithStatusCode(_0xd807f4,null))[_0xec26('0x26')](handleError(_0xd807f4,null));};exports['download']=function(_0x365666,_0x8bda5b){var _0x4a539d=moment()['unix']()[_0xec26('0x53')]();var _0x521226=path['join'](config[_0xec26('0x54')],'server','files','tmp');var _0xc1594f=path[_0xec26('0x55')](config[_0xec26('0x54')],_0xec26('0x56'),_0xec26('0x57'),'attachments');var _0x2e8bff=path[_0xec26('0x55')](_0x521226,_0x4a539d);var _0x514b94=util[_0xec26('0x43')]('transcript-%d-%s.zip',_0x365666['params']['id'],_0x4a539d);var _0x20217b=path[_0xec26('0x55')](_0x521226,_0x514b94);var _0x590452=[];if(_0x365666['query'][_0xec26('0x58')]){_0x590452['push']({'model':db['Attachment'],'as':_0xec26('0x59'),'raw':!![]});}var _0x37a0c9=[{'model':db[_0xec26('0x38')],'as':_0xec26('0x5a'),'attributes':['id',_0xec26('0x35'),'from','to','cc',_0xec26('0x5b'),_0xec26('0x5c'),_0xec26('0x5d')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x590452}];return db['MailInteraction'][_0xec26('0x33')]({'where':{'id':_0x365666[_0xec26('0x36')]['id']},'include':_0x37a0c9})[_0xec26('0x1a')](handleEntityNotFound(_0x8bda5b,null))[_0xec26('0x1a')](function(_0x7da894){if(_0x7da894&&_0x7da894['Messages']){var _0x16d1cc=_0x7da894[_0xec26('0x5e')]({'plain':!![]});fs['mkdirSync'](_0x2e8bff);return BPromise['each'](_0x16d1cc[_0xec26('0x5a')],function(_0x258e02,_0x21e5fd){var _0x3699d2={'from':_0x258e02[_0xec26('0x5f')],'to':_0x258e02['to']||_0xec26('0x60'),'subject':_0x258e02[_0xec26('0x5c')],'html':htmlEntities['decode'](_0x258e02['body']),'headers':{'Date':moment(_0x258e02['createdAt'])['format'](_0xec26('0x61'))},'attachments':[]};if(_0x258e02['cc']){_0x3699d2[_0xec26('0x62')]['Cc']=_0x258e02['cc'];}if(_0x258e02[_0xec26('0x5b')]){_0x3699d2[_0xec26('0x62')][_0xec26('0x63')]=_0x258e02[_0xec26('0x5b')];}return new BPromise(function(_0x3bce92,_0x1b152e){if(_0x258e02[_0xec26('0x59')]){for(var _0x4ae93e=0x0;_0x4ae93e<_0x258e02[_0xec26('0x59')][_0xec26('0x30')];_0x4ae93e++){var _0x1b953f=_0x258e02[_0xec26('0x59')][_0x4ae93e];var _0x1cb193=path[_0xec26('0x55')](_0xc1594f,_0x1b953f['basename']);if(fs['existsSync'](_0x1cb193)){_0x3699d2[_0xec26('0x58')][_0xec26('0x64')]({'name':_0x1b953f[_0xec26('0x1d')],'contentType':_0x1b953f[_0xec26('0x22')],'data':fs[_0xec26('0x65')](_0x1cb193)});}}}emlformat[_0xec26('0x66')](_0x3699d2,function(_0x15d2e3,_0x45f446){if(_0x15d2e3)return _0x1b152e(_0x15d2e3);fs[_0xec26('0x67')](path['join'](_0x2e8bff,util[_0xec26('0x43')](_0xec26('0x68'),_0x21e5fd)),_0x45f446);return _0x3bce92(_0x45f446);});});})['then'](function(){return new BPromise(function(_0x5a56d8,_0x128a0d){zipdir(_0x2e8bff,{'saveTo':_0x20217b},function(_0x1feefb,_0x38b96a){if(_0x1feefb)return _0x128a0d(_0x1feefb);return _0x5a56d8(_0x38b96a);});})[_0xec26('0x1a')](function(){return new BPromise(function(_0x4fde6a,_0x4bbf15){rimraf(_0x2e8bff,function(_0x3a37c7){if(_0x3a37c7)_0x4bbf15(_0x3a37c7);return _0x4fde6a();});});})[_0xec26('0x1a')](function(){return _0x8bda5b[_0xec26('0x69')](_0x20217b,_0x514b94,function(_0x363ff0){if(!_0x363ff0)fs[_0xec26('0x6a')](_0x20217b);});});});}else{return _0x8bda5b[_0xec26('0x11')](0xc8);}})['catch'](handleError(_0x8bda5b,null));}; \ No newline at end of file +var _0xd44b=['filters','intersection','attributes','fields','length','includeAll','include','merge','create','body','find','params','describe','ids','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','sort','pick','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','count','true','rows','addTags','setTags','omit','spread','color','removeTags','unix','toString','join','server','tmp','files','attachments','push','Attachment','Messages','bcc','createdAt','mkdirSync','each','from','missing.recipient@your.company.com','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','mail','user','catch','model','keys','MailInteraction','query'];(function(_0x19dcd6,_0x3880fb){var _0x111bc3=function(_0x214840){while(--_0x214840){_0x19dcd6['push'](_0x19dcd6['shift']());}};_0x111bc3(++_0x3880fb);}(_0xd44b,0x125));var _0xbd44=function(_0x19054f,_0x1bb86c){_0x19054f=_0x19054f-0x0;var _0x2ecd9d=_0xd44b[_0x19054f];return _0x2ecd9d;};'use strict';var emlformat=require(_0xbd44('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd44('0x1'));var moment=require(_0xbd44('0x2'));var BPromise=require(_0xbd44('0x3'));var util=require(_0xbd44('0x4'));var path=require(_0xbd44('0x5'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0xbd44('0x6'));var interaction=require(_0xbd44('0x7'));var qs=require(_0xbd44('0x8'));var logger=require(_0xbd44('0x9'))(_0xbd44('0xa'));var config=require(_0xbd44('0xb'));var db=require(_0xbd44('0xc'))['db'];var htmlEntities=require('html-entities');config[_0xbd44('0xd')]=_[_0xbd44('0xe')](config['redis'],{'host':_0xbd44('0xf'),'port':0x18eb});var socket=require(_0xbd44('0x10'))(new Redis(config[_0xbd44('0xd')]));require(_0xbd44('0x11'))[_0xbd44('0x12')](socket);function respondWithStatusCode(_0x3c5438,_0x328654){_0x328654=_0x328654||0xcc;return function(_0x354334){if(_0x354334){return _0x3c5438[_0xbd44('0x13')](_0x328654);}return _0x3c5438[_0xbd44('0x14')](_0x328654)[_0xbd44('0x15')]();};}function respondWithResult(_0x3ae631,_0x5962b8){_0x5962b8=_0x5962b8||0xc8;return function(_0xfe6266){if(_0xfe6266){return _0x3ae631['status'](_0x5962b8)[_0xbd44('0x16')](_0xfe6266);}};}function respondWithFilteredResult(_0x19b318,_0x3c1491){return function(_0x19994b){if(_0x19994b){var _0x5ecf80=typeof _0x3c1491[_0xbd44('0x17')]==='undefined'&&typeof _0x3c1491[_0xbd44('0x18')]===_0xbd44('0x19');var _0x2e9f94=_0x19994b['count'];var _0x46c68d=_0x5ecf80?0x0:_0x3c1491[_0xbd44('0x17')];var _0x369c4d=_0x5ecf80?_0x19994b['count']:_0x3c1491[_0xbd44('0x17')]+_0x3c1491[_0xbd44('0x18')];var _0x49dae9;if(_0x369c4d>=_0x2e9f94){_0x369c4d=_0x2e9f94;_0x49dae9=0xc8;}else{_0x49dae9=0xce;}_0x19b318['status'](_0x49dae9);return _0x19b318[_0xbd44('0x1a')](_0xbd44('0x1b'),_0x46c68d+'-'+_0x369c4d+'/'+_0x2e9f94)[_0xbd44('0x16')](_0x19994b);}return null;};}function saveUpdates(_0x2a0c9f){return function(_0x4e2f55){if(_0x4e2f55){return _0x4e2f55[_0xbd44('0x1c')](_0x2a0c9f)[_0xbd44('0x1d')](function(_0x4f8447){return _0x4f8447;});}return null;};}function removeEntity(_0x58ce84){return function(_0x5aee6f){if(_0x5aee6f){return _0x5aee6f[_0xbd44('0x1e')]()[_0xbd44('0x1d')](function(){_0x58ce84['status'](0xcc)[_0xbd44('0x15')]();});}};}function handleEntityNotFound(_0x53a448){return function(_0x40bc35){if(!_0x40bc35){_0x53a448['sendStatus'](0x194);}return _0x40bc35;};}function handleError(_0x360161,_0x973f5){_0x973f5=_0x973f5||0x1f4;return function(_0x352991){logger[_0xbd44('0x1f')](_0x352991[_0xbd44('0x20')]);if(_0x352991[_0xbd44('0x21')]){delete _0x352991[_0xbd44('0x21')];}_0x360161[_0xbd44('0x14')](_0x973f5)['send'](_0x352991);};}exports[_0xbd44('0x22')]=function(_0x3e81ed,_0x3a196f){var _0x523045={};var _0x2c3c3d=_[_0xbd44('0x23')](db['MailInteraction'][_0xbd44('0x24')],function(_0x3099a9){return{'name':_0x3099a9[_0xbd44('0x25')],'type':_0x3099a9[_0xbd44('0x26')][_0xbd44('0x27')]};});_0x523045=qs[_0xbd44('0x28')](_0x2c3c3d,_0x3e81ed);return interaction[_0xbd44('0x29')](_0xbd44('0x2a'),_0x3e81ed['query'],_0x3e81ed[_0xbd44('0x2b')],_0x523045,_0x2c3c3d)[_0xbd44('0x1d')](respondWithFilteredResult(_0x3a196f,_0x523045))[_0xbd44('0x2c')](handleError(_0x3a196f,null));};exports['show']=function(_0x3019d8,_0x3bc311){var _0x3cf3d6={'raw':![],'where':{'id':_0x3019d8['params']['id']}},_0xfc4dd7={};_0xfc4dd7[_0xbd44('0x2d')]=_[_0xbd44('0x2e')](db[_0xbd44('0x2f')]['rawAttributes']);_0xfc4dd7[_0xbd44('0x30')]=_[_0xbd44('0x2e')](_0x3019d8[_0xbd44('0x30')]);_0xfc4dd7[_0xbd44('0x31')]=_[_0xbd44('0x32')](_0xfc4dd7[_0xbd44('0x2d')],_0xfc4dd7['query']);_0x3cf3d6[_0xbd44('0x33')]=_['intersection'](_0xfc4dd7['model'],qs[_0xbd44('0x34')](_0x3019d8[_0xbd44('0x30')]['fields']));_0x3cf3d6[_0xbd44('0x33')]=_0x3cf3d6[_0xbd44('0x33')][_0xbd44('0x35')]?_0x3cf3d6['attributes']:_0xfc4dd7[_0xbd44('0x2d')];if(_0x3019d8[_0xbd44('0x30')][_0xbd44('0x36')]){_0x3cf3d6[_0xbd44('0x37')]=[{'all':!![]}];}_0x3cf3d6=_[_0xbd44('0x38')]({},_0x3cf3d6,_0x3019d8['options']);return db[_0xbd44('0x2f')]['find'](_0x3cf3d6)[_0xbd44('0x1d')](handleEntityNotFound(_0x3bc311,null))[_0xbd44('0x1d')](respondWithResult(_0x3bc311,null))['catch'](handleError(_0x3bc311,null));};exports[_0xbd44('0x39')]=function(_0x1ec553,_0x1b8b4a){return db[_0xbd44('0x2f')]['create'](_0x1ec553[_0xbd44('0x3a')],{})[_0xbd44('0x1d')](respondWithResult(_0x1b8b4a,0xc9))[_0xbd44('0x2c')](handleError(_0x1b8b4a,null));};exports[_0xbd44('0x1c')]=function(_0x264207,_0x3b15bb){if(_0x264207[_0xbd44('0x3a')]['id']){delete _0x264207[_0xbd44('0x3a')]['id'];}return db[_0xbd44('0x2f')][_0xbd44('0x3b')]({'where':{'id':_0x264207[_0xbd44('0x3c')]['id']}})[_0xbd44('0x1d')](handleEntityNotFound(_0x3b15bb,null))[_0xbd44('0x1d')](saveUpdates(_0x264207[_0xbd44('0x3a')],null))[_0xbd44('0x1d')](respondWithResult(_0x3b15bb,null))['catch'](handleError(_0x3b15bb,null));};exports[_0xbd44('0x1e')]=function(_0x1bfdb7,_0x41699b){return db['MailInteraction']['find']({'where':{'id':_0x1bfdb7[_0xbd44('0x3c')]['id']}})[_0xbd44('0x1d')](handleEntityNotFound(_0x41699b,null))[_0xbd44('0x1d')](removeEntity(_0x41699b,null))['catch'](handleError(_0x41699b,null));};exports['describe']=function(_0x39355a,_0x26d730){return db[_0xbd44('0x2f')][_0xbd44('0x3d')]()[_0xbd44('0x1d')](respondWithResult(_0x26d730,null))[_0xbd44('0x2c')](handleError(_0x26d730,null));};exports['addMessage']=function(_0x2ef671,_0x465ea4){return db['MailMessage'][_0xbd44('0x3b')]({'where':{'id':_0x2ef671[_0xbd44('0x3c')]['id']}})[_0xbd44('0x1d')](handleEntityNotFound(_0x465ea4,null))[_0xbd44('0x1d')](function(_0x213ddc){if(_0x213ddc){return _0x213ddc['addMessage'](_0x2ef671[_0xbd44('0x3a')][_0xbd44('0x3e')],_['omit'](_0x2ef671[_0xbd44('0x3a')],[_0xbd44('0x3e'),'id'])||{});}})[_0xbd44('0x1d')](respondWithResult(_0x465ea4,null))[_0xbd44('0x2c')](handleError(_0x465ea4,null));};exports[_0xbd44('0x3f')]=function(_0x5edaff,_0x1c7eaf){var _0x517cab={'raw':![],'where':{}};var _0x8904ef={};var _0x4ab2fd={'count':0x0,'rows':[]};return db['MailInteraction'][_0xbd44('0x40')]({'where':{'id':_0x5edaff['params']['id']}})[_0xbd44('0x1d')](handleEntityNotFound(_0x1c7eaf,null))[_0xbd44('0x1d')](function(_0x23caee){if(_0x23caee){_0x8904ef['model']=_[_0xbd44('0x2e')](db[_0xbd44('0x41')]['rawAttributes']);_0x8904ef['query']=_[_0xbd44('0x2e')](_0x5edaff['query']);_0x8904ef[_0xbd44('0x31')]=_['intersection'](_0x8904ef['model'],_0x8904ef[_0xbd44('0x30')]);_0x517cab[_0xbd44('0x33')]=_[_0xbd44('0x32')](_0x8904ef[_0xbd44('0x2d')],qs['fields'](_0x5edaff['query'][_0xbd44('0x34')]));_0x517cab['attributes']=_0x517cab[_0xbd44('0x33')][_0xbd44('0x35')]?_0x517cab[_0xbd44('0x33')]:_0x8904ef[_0xbd44('0x2d')];if(!_0x5edaff[_0xbd44('0x30')][_0xbd44('0x42')](_0xbd44('0x43'))){_0x517cab[_0xbd44('0x18')]=qs[_0xbd44('0x18')](_0x5edaff[_0xbd44('0x30')][_0xbd44('0x18')]);_0x517cab['offset']=qs['offset'](_0x5edaff['query'][_0xbd44('0x17')]);}_0x517cab['order']=qs[_0xbd44('0x44')](_0x5edaff[_0xbd44('0x30')][_0xbd44('0x44')]);_0x517cab['where']=qs['filters'](_[_0xbd44('0x45')](_0x5edaff['query'],_0x8904ef['filters']));_0x517cab[_0xbd44('0x46')]['MailInteractionId']=_0x23caee['id'];if(_0x5edaff[_0xbd44('0x30')]['filter']){_0x517cab[_0xbd44('0x46')]=_[_0xbd44('0x38')](_0x517cab[_0xbd44('0x46')],{'$or':_[_0xbd44('0x23')](_0x517cab[_0xbd44('0x33')],function(_0x386225){var _0x1f3118={};_0x1f3118[_0x386225]={'$like':'%'+_0x5edaff[_0xbd44('0x30')][_0xbd44('0x47')]+'%'};return _0x1f3118;})});}if(_0x5edaff[_0xbd44('0x30')][_0xbd44('0x48')]){var _0x367ab4=_0x5edaff['query'][_0xbd44('0x48')]['split'](',');var _0x4fc6ec={};_0x4fc6ec[_0x367ab4[0x0]]={'$gte':moment(_0x367ab4[0x1])[_0xbd44('0x49')](_0xbd44('0x4a'))};_0x517cab[_0xbd44('0x46')]=_[_0xbd44('0x38')](_0x517cab[_0xbd44('0x46')],_0x4fc6ec);}_0x517cab=_[_0xbd44('0x38')]({},_0x517cab,_0x5edaff[_0xbd44('0x4b')]);return db[_0xbd44('0x41')][_0xbd44('0x4c')]({'where':_0x517cab[_0xbd44('0x46')]})[_0xbd44('0x1d')](function(_0x45fac2){_0x4ab2fd[_0xbd44('0x4c')]=_0x45fac2;if(_0x5edaff[_0xbd44('0x30')]['includeAll']){_0x517cab[_0xbd44('0x37')]=[{'all':!![]}];}return db[_0xbd44('0x41')][_0xbd44('0x29')](_0x517cab);})['then'](function(_0x563fef){if(_0x5edaff['query']['inlineCss']===_0xbd44('0x4d')){for(var _0x583f28=0x0;_0x583f28<_0x563fef[_0xbd44('0x35')];_0x583f28++){_0x563fef[_0x583f28][_0xbd44('0x3a')]=juice(_0x563fef[_0x583f28][_0xbd44('0x3a')]);}}_0x4ab2fd[_0xbd44('0x4e')]=_0x563fef;return _0x4ab2fd;});}})[_0xbd44('0x1d')](respondWithFilteredResult(_0x1c7eaf,_0x517cab))[_0xbd44('0x2c')](handleError(_0x1c7eaf,null));};exports[_0xbd44('0x4f')]=function(_0x59eb3d,_0x4fa259){return db[_0xbd44('0x2f')][_0xbd44('0x3b')]({'where':{'id':_0x59eb3d[_0xbd44('0x3c')]['id']}})[_0xbd44('0x1d')](handleEntityNotFound(_0x4fa259,null))[_0xbd44('0x1d')](function(_0xea3cef){if(_0xea3cef){return _0xea3cef[_0xbd44('0x50')](_0x59eb3d[_0xbd44('0x3a')][_0xbd44('0x3e')],_[_0xbd44('0x51')](_0x59eb3d[_0xbd44('0x3a')],[_0xbd44('0x3e'),'id'])||{})[_0xbd44('0x52')](function(){return db['Tag']['findAll']({'attributes':['id',_0xbd44('0x21'),_0xbd44('0x53')],'where':{'id':_0x59eb3d[_0xbd44('0x3a')][_0xbd44('0x3e')]}});})[_0xbd44('0x1d')](function(_0x340880){socket['emit']('mailInteractionTags:save',{'id':Number(_0x59eb3d[_0xbd44('0x3c')]['id']),'tags':_0x340880||[]});return{'id':Number(_0x59eb3d[_0xbd44('0x3c')]['id']),'tags':_0x340880||[]};});}})[_0xbd44('0x1d')](respondWithResult(_0x4fa259,null))[_0xbd44('0x2c')](handleError(_0x4fa259,null));};exports[_0xbd44('0x54')]=function(_0x50005b,_0x48cd61){return db['MailInteraction']['find']({'where':{'id':_0x50005b[_0xbd44('0x3c')]['id']}})[_0xbd44('0x1d')](handleEntityNotFound(_0x48cd61,null))['then'](function(_0x294f85){if(_0x294f85){return _0x294f85['removeTags'](_0x50005b[_0xbd44('0x30')][_0xbd44('0x3e')]);}})['then'](respondWithStatusCode(_0x48cd61,null))[_0xbd44('0x2c')](handleError(_0x48cd61,null));};exports['download']=function(_0x216551,_0x2d2fee){var _0xde254f=moment()[_0xbd44('0x55')]()[_0xbd44('0x56')]();var _0x5d5ec2=path[_0xbd44('0x57')](config['root'],_0xbd44('0x58'),'files',_0xbd44('0x59'));var _0x34a90d=path[_0xbd44('0x57')](config['root'],_0xbd44('0x58'),_0xbd44('0x5a'),_0xbd44('0x5b'));var _0x1b76e5=path[_0xbd44('0x57')](_0x5d5ec2,_0xde254f);var _0x8c7b9b=util[_0xbd44('0x49')]('transcript-%d-%s.zip',_0x216551[_0xbd44('0x3c')]['id'],_0xde254f);var _0x338920=path[_0xbd44('0x57')](_0x5d5ec2,_0x8c7b9b);var _0x301286=[];if(_0x216551['query'][_0xbd44('0x5b')]){_0x301286[_0xbd44('0x5c')]({'model':db[_0xbd44('0x5d')],'as':'Attachments','raw':!![]});}var _0x3f2983=[{'model':db['MailMessage'],'as':_0xbd44('0x5e'),'attributes':['id',_0xbd44('0x3a'),'from','to','cc',_0xbd44('0x5f'),'subject',_0xbd44('0x60')],'where':{'secret':![]},'order':qs[_0xbd44('0x44')]('id'),'include':_0x301286}];return db[_0xbd44('0x2f')]['find']({'where':{'id':_0x216551[_0xbd44('0x3c')]['id']},'include':_0x3f2983})[_0xbd44('0x1d')](handleEntityNotFound(_0x2d2fee,null))[_0xbd44('0x1d')](function(_0x2af629){if(_0x2af629&&_0x2af629[_0xbd44('0x5e')]){var _0x2d42ab=_0x2af629['get']({'plain':!![]});fs[_0xbd44('0x61')](_0x1b76e5);return BPromise[_0xbd44('0x62')](_0x2d42ab[_0xbd44('0x5e')],function(_0x1f75a2,_0x45a8ee){var _0x29e9b0={'from':_0x1f75a2[_0xbd44('0x63')],'to':_0x1f75a2['to']||_0xbd44('0x64'),'subject':_0x1f75a2[_0xbd44('0x65')],'html':htmlEntities[_0xbd44('0x66')](_0x1f75a2[_0xbd44('0x3a')]),'headers':{'Date':moment(_0x1f75a2['createdAt'])['format'](_0xbd44('0x67'))},'attachments':[]};if(_0x1f75a2['cc']){_0x29e9b0[_0xbd44('0x68')]['Cc']=_0x1f75a2['cc'];}if(_0x1f75a2[_0xbd44('0x5f')]){_0x29e9b0[_0xbd44('0x68')][_0xbd44('0x69')]=_0x1f75a2['bcc'];}return new BPromise(function(_0x46370d,_0x224b66){if(_0x1f75a2['Attachments']){for(var _0x4cf71a=0x0;_0x4cf71a<_0x1f75a2[_0xbd44('0x6a')][_0xbd44('0x35')];_0x4cf71a++){var _0x3bb957=_0x1f75a2[_0xbd44('0x6a')][_0x4cf71a];var _0x108ebc=path[_0xbd44('0x57')](_0x34a90d,_0x3bb957[_0xbd44('0x6b')]);if(fs[_0xbd44('0x6c')](_0x108ebc)){_0x29e9b0[_0xbd44('0x5b')]['push']({'name':_0x3bb957[_0xbd44('0x21')],'contentType':_0x3bb957['type'],'data':fs[_0xbd44('0x6d')](_0x108ebc)});}}}emlformat[_0xbd44('0x6e')](_0x29e9b0,function(_0x37b347,_0x4cc7a5){if(_0x37b347)return _0x224b66(_0x37b347);fs['writeFileSync'](path[_0xbd44('0x57')](_0x1b76e5,util['format'](_0xbd44('0x6f'),_0x45a8ee)),_0x4cc7a5);return _0x46370d(_0x4cc7a5);});});})[_0xbd44('0x1d')](function(){return new BPromise(function(_0x2af13b,_0x414530){zipdir(_0x1b76e5,{'saveTo':_0x338920},function(_0x353142,_0x102db6){if(_0x353142)return _0x414530(_0x353142);return _0x2af13b(_0x102db6);});})['then'](function(){return new BPromise(function(_0x295b4b,_0x37b9f5){rimraf(_0x1b76e5,function(_0x15a177){if(_0x15a177)_0x37b9f5(_0x15a177);return _0x295b4b();});});})[_0xbd44('0x1d')](function(){return _0x2d2fee[_0xbd44('0x70')](_0x338920,_0x8c7b9b,function(_0x5a7b37){if(!_0x5a7b37)fs[_0xbd44('0x71')](_0x338920);});});});}else{return _0x2d2fee[_0xbd44('0x13')](0xc8);}})[_0xbd44('0x2c')](handleError(_0x2d2fee,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c83ae1a..3ce7aef 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 _0xdfe2=['MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x510237,_0x3a393e){var _0x55aa65=function(_0x119d9f){while(--_0x119d9f){_0x510237['push'](_0x510237['shift']());}};_0x55aa65(++_0x3a393e);}(_0xdfe2,0x7c));var _0x2dfe=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xdfe2[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require(_0x2dfe('0x0'));var MailInteraction=require(_0x2dfe('0x1'))['db'][_0x2dfe('0x2')];var MailMessage=require(_0x2dfe('0x1'))['db'][_0x2dfe('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x2dfe('0x4')](0x0);var events={'afterCreate':_0x2dfe('0x5'),'afterUpdate':_0x2dfe('0x6'),'afterDestroy':'remove'};function emitEvent(_0x35d250){return function(_0x3bbccb,_0x579991,_0x17bcaa){_0x3bbccb[_0x2dfe('0x7')]({'attributes':['id'],'raw':!![]})[_0x2dfe('0x8')](function(_0x1a23ae){_0x3bbccb[_0x2dfe('0x9')](_0x2dfe('0xa'),_0x1a23ae[_0x2dfe('0xb')](function(_0xd89edd){return{'id':_0xd89edd['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3bbccb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x28ac07){_0x3bbccb['setDataValue'](_0x2dfe('0xc'),_0x28ac07[_0x2dfe('0xd')]);MailInteractionEvents[_0x2dfe('0xe')](_0x35d250+':'+_0x3bbccb['id'],_0x3bbccb);MailInteractionEvents[_0x2dfe('0xe')](_0x35d250,_0x3bbccb);_0x17bcaa(null);})['catch'](_0x17bcaa(null));};}for(var e in events){if(events[_0x2dfe('0xf')](e)){var event=events[e];MailInteraction[_0x2dfe('0x10')](e,emitEvent(event));}}module[_0x2dfe('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x5225=['hasOwnProperty','hook','exports','events','MailInteraction','MailMessage','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch'];(function(_0x38b4b8,_0xafa866){var _0x5aee3b=function(_0x548b35){while(--_0x548b35){_0x38b4b8['push'](_0x38b4b8['shift']());}};_0x5aee3b(++_0xafa866);}(_0x5225,0x19b));var _0x5522=function(_0x4c825d,_0x10ec2b){_0x4c825d=_0x4c825d-0x0;var _0x43de87=_0x5225[_0x4c825d];return _0x43de87;};'use strict';var EventEmitter=require(_0x5522('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x5522('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x5522('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5522('0x3'),'afterDestroy':_0x5522('0x4')};function emitEvent(_0x2ea259){return function(_0x38583a,_0x1dc2b8,_0x40442c){_0x38583a[_0x5522('0x5')]({'attributes':['id'],'raw':!![]})[_0x5522('0x6')](function(_0x4afaeb){_0x38583a['setDataValue'](_0x5522('0x7'),_0x4afaeb[_0x5522('0x8')](function(_0x49fed8){return{'id':_0x49fed8['id']};}));return MailMessage[_0x5522('0x9')]({'where':{'MailInteractionId':_0x38583a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2865ed){_0x38583a[_0x5522('0xa')](_0x5522('0xb'),_0x2865ed['length']);MailInteractionEvents[_0x5522('0xc')](_0x2ea259+':'+_0x38583a['id'],_0x38583a);MailInteractionEvents['emit'](_0x2ea259,_0x38583a);_0x40442c(null);})[_0x5522('0xd')](_0x40442c(null));};}for(var e in events){if(events[_0x5522('0xe')](e)){var event=events[e];MailInteraction[_0x5522('0xf')](e,emitEvent(event));}}module[_0x5522('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4d771ea..7b2803d 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 _0x2e04=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger','moment'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x2e04,0x8d));var _0x42e0=function(_0xba5568,_0x192cd5){_0xba5568=_0xba5568-0x0;var _0x2f1bfc=_0x2e04[_0xba5568];return _0x2f1bfc;};'use strict';var _=require(_0x42e0('0x0'));var util=require('util');var logger=require(_0x42e0('0x1'))('api');var moment=require(_0x42e0('0x2'));var BPromise=require(_0x42e0('0x3'));var rp=require(_0x42e0('0x4'));var fs=require('fs');var path=require(_0x42e0('0x5'));var rimraf=require(_0x42e0('0x6'));var config=require(_0x42e0('0x7'));var attributes=require(_0x42e0('0x8'));module['exports']=function(_0x58732c,_0x4aaf15){return _0x58732c[_0x42e0('0x9')](_0x42e0('0xa'),attributes,{'tableName':_0x42e0('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x42e0('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28c8a1,_0x1c5f68,_0x280808){if(_0x28c8a1[_0x42e0('0xd')]){_0x28c8a1[_0x42e0('0xe')]=moment()[_0x42e0('0xf')](_0x42e0('0x10'));}if(_0x28c8a1[_0x42e0('0x11')]){_0x28c8a1[_0x42e0('0x12')]=moment()[_0x42e0('0xf')](_0x42e0('0x10'));}_0x280808(null,_0x1c5f68);},'beforeUpdate':function(_0x4f20e4,_0x6a9469,_0x4a43ae){if(_0x4f20e4[_0x42e0('0x13')](_0x42e0('0xd'))){_0x4f20e4[_0x42e0('0xe')]=_0x4f20e4[_0x42e0('0xd')]?moment()[_0x42e0('0xf')](_0x42e0('0x10')):null;}if(_0x4f20e4[_0x42e0('0x13')](_0x42e0('0x11'))){_0x4f20e4[_0x42e0('0x12')]=moment()[_0x42e0('0xf')](_0x42e0('0x10'));_0x4f20e4[_0x42e0('0xd')]=null;_0x4f20e4[_0x42e0('0xe')]=null;}_0x4a43ae(null,_0x4f20e4);},'afterUpdate':function(_0x55adcc,_0x21c299,_0x28e37d){var _0x2a4aeb=_0x58732c['models'];var _0x203fb2=_0x55adcc['get']({'plain':!![]});if(_0x203fb2[_0x42e0('0x11')]){return _0x2a4aeb[_0x42e0('0x14')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x203fb2['id']}})[_0x42e0('0x15')](function(){_0x28e37d();})[_0x42e0('0x16')](function(_0x13474f){_0x28e37d(_0x13474f);});}else{_0x28e37d();}}},'charset':'utf8mb4','collate':_0x42e0('0x17')});}; \ No newline at end of file +var _0x47df=['./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','format','closed','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','substatusAt','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xd9707c,_0x5dfc41){var _0x2e1593=function(_0x34b4b5){while(--_0x34b4b5){_0xd9707c['push'](_0xd9707c['shift']());}};_0x2e1593(++_0x5dfc41);}(_0x47df,0x70));var _0xf47d=function(_0x4587e6,_0x13c375){_0x4587e6=_0x4587e6-0x0;var _0x28fe8c=_0x47df[_0x4587e6];return _0x28fe8c;};'use strict';var _=require(_0xf47d('0x0'));var util=require(_0xf47d('0x1'));var logger=require('../../config/logger')(_0xf47d('0x2'));var moment=require(_0xf47d('0x3'));var BPromise=require(_0xf47d('0x4'));var rp=require(_0xf47d('0x5'));var fs=require('fs');var path=require(_0xf47d('0x6'));var rimraf=require(_0xf47d('0x7'));var config=require('../../config/environment');var attributes=require(_0xf47d('0x8'));module['exports']=function(_0xbd5b1,_0x1ae1ac){return _0xbd5b1[_0xf47d('0x9')](_0xf47d('0xa'),attributes,{'tableName':_0xf47d('0xb'),'paranoid':![],'indexes':[{'name':_0xf47d('0xc'),'fields':[_0xf47d('0xd'),'to'],'type':_0xf47d('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2b3949,_0x30f2b3,_0x5d72ea){if(_0x2b3949['substatus']){_0x2b3949['substatusAt']=moment()[_0xf47d('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2b3949[_0xf47d('0x10')]){_0x2b3949['closedAt']=moment()[_0xf47d('0xf')](_0xf47d('0x11'));}_0x5d72ea(null,_0x30f2b3);},'beforeUpdate':function(_0x247dab,_0x471451,_0x2c35bd){if(_0x247dab[_0xf47d('0x12')](_0xf47d('0x13'))){_0x247dab[_0xf47d('0x14')]=_0x247dab['substatus']?moment()[_0xf47d('0xf')](_0xf47d('0x11')):null;}if(_0x247dab[_0xf47d('0x12')](_0xf47d('0x10'))){_0x247dab[_0xf47d('0x15')]=moment()[_0xf47d('0xf')](_0xf47d('0x11'));_0x247dab[_0xf47d('0x13')]=null;_0x247dab[_0xf47d('0x14')]=null;}_0x2c35bd(null,_0x247dab);},'afterUpdate':function(_0x3123e3,_0x10378f,_0xbb76b2){var _0x420a0e=_0xbd5b1[_0xf47d('0x16')];var _0x63deed=_0x3123e3[_0xf47d('0x17')]({'plain':!![]});if(_0x63deed[_0xf47d('0x10')]){return _0x420a0e[_0xf47d('0x18')][_0xf47d('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x63deed['id']}})[_0xf47d('0x1a')](function(){_0xbb76b2();})[_0xf47d('0x1b')](function(_0x563328){_0xbb76b2(_0x563328);});}else{_0xbb76b2();}}},'charset':_0xf47d('0x1c'),'collate':_0xf47d('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ddc710f..4bffdc4 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 _0x0b99=['register','request','then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','catch','AddTagsToMailInteraction','body','omit','ids','spread','AddTags','lodash','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x4de0aa,_0x22628e){var _0x2214bb=function(_0x550863){while(--_0x550863){_0x4de0aa['push'](_0x4de0aa['shift']());}};_0x2214bb(++_0x22628e);}(_0x0b99,0xd9));var _0x90b9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0b99[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x90b9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x90b9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90b9('0x2'))['db'];var utils=require(_0x90b9('0x3'));var logger=require('../../config/logger')(_0x90b9('0x4'));var config=require(_0x90b9('0x5'));var jayson=require(_0x90b9('0x6'));var client=jayson['client'][_0x90b9('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x90b9('0x8')],{'host':_0x90b9('0x9'),'port':0x18eb});var socket=require(_0x90b9('0xa'))(new Redis(config[_0x90b9('0x8')]));require('./mailInteraction.socket')[_0x90b9('0xb')](socket);function respondWithRpcPromise(_0x2f2e62,_0x599251,_0x527a6e){return new BPromise(function(_0x1b0703,_0x272470){return client[_0x90b9('0xc')](_0x2f2e62,_0x527a6e)[_0x90b9('0xd')](function(_0x4cbb51){logger['info'](_0x90b9('0xe'),_0x599251,'request\x20sent');logger[_0x90b9('0xf')](_0x90b9('0x10'),_0x599251,_0x90b9('0x11'),JSON[_0x90b9('0x12')](_0x4cbb51));if(_0x4cbb51[_0x90b9('0x13')]){if(_0x4cbb51[_0x90b9('0x13')][_0x90b9('0x14')]===0x1f4){logger[_0x90b9('0x13')](_0x90b9('0xe'),_0x599251,_0x4cbb51[_0x90b9('0x13')][_0x90b9('0x15')]);return _0x272470(_0x4cbb51[_0x90b9('0x13')][_0x90b9('0x15')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x599251,_0x4cbb51[_0x90b9('0x13')][_0x90b9('0x15')]);return _0x1b0703(_0x4cbb51[_0x90b9('0x13')][_0x90b9('0x15')]);}else{logger[_0x90b9('0x16')](_0x90b9('0xe'),_0x599251,_0x90b9('0x11'));_0x1b0703(_0x4cbb51[_0x90b9('0x17')][_0x90b9('0x15')]);}})['catch'](function(_0x1e3d31){logger[_0x90b9('0x13')]('MailInteraction,\x20%s,\x20%s',_0x599251,_0x1e3d31);_0x272470(_0x1e3d31);});});}exports[_0x90b9('0x18')]=function(_0x379238){var _0x366461=this;return new Promise(function(_0x346e12,_0x3da9cc){return db[_0x90b9('0x19')][_0x90b9('0x1a')](_0x379238['body'],{'raw':_0x379238[_0x90b9('0x1b')]?_0x379238[_0x90b9('0x1b')][_0x90b9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x379238[_0x90b9('0x1b')]?_0x379238[_0x90b9('0x1b')][_0x90b9('0x1d')]||null:null,'attributes':_0x379238[_0x90b9('0x1b')]?_0x379238['options'][_0x90b9('0x1e')]||null:null,'limit':_0x379238[_0x90b9('0x1b')]?_0x379238[_0x90b9('0x1b')]['limit']||null:null})[_0x90b9('0xd')](function(_0x5cdb59){logger[_0x90b9('0x16')](_0x90b9('0x18'),_0x379238);logger[_0x90b9('0xf')](_0x90b9('0x18'),_0x379238,JSON['stringify'](_0x5cdb59));_0x346e12(_0x5cdb59);})[_0x90b9('0x1f')](function(_0x560a71){logger[_0x90b9('0x13')]('UpdateMailInteraction',_0x560a71[_0x90b9('0x15')],_0x379238);_0x3da9cc(_0x366461['error'](0x1f4,_0x560a71[_0x90b9('0x15')]));});});};exports[_0x90b9('0x20')]=function(_0x1d7019){return new Promise(function(_0x28d8a1,_0x48010e){return db[_0x90b9('0x19')]['find']({'where':_0x1d7019[_0x90b9('0x1b')]?_0x1d7019[_0x90b9('0x1b')][_0x90b9('0x1d')]||null:null})[_0x90b9('0xd')](function(_0x1094f0){if(_0x1094f0){return _0x1094f0['addTags'](_0x1d7019[_0x90b9('0x21')]['ids'],_[_0x90b9('0x22')](_0x1d7019[_0x90b9('0x21')],[_0x90b9('0x23'),'id'])||{});}})[_0x90b9('0x24')](function(_0x33e180){logger[_0x90b9('0x16')](_0x90b9('0x25'),_0x1d7019);logger[_0x90b9('0xf')](_0x90b9('0x25'),_0x1d7019,JSON['stringify'](_0x33e180));_0x28d8a1(_0x33e180);})[_0x90b9('0x1f')](function(_0x59cd75){logger[_0x90b9('0x13')](_0x90b9('0x25'),_0x59cd75['message'],_0x1d7019);_0x48010e(_this['error'](0x1f4,_0x59cd75[_0x90b9('0x15')]));});});}; \ No newline at end of file +var _0x91a7=['redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults'];(function(_0x227320,_0x4131cd){var _0x14ad6c=function(_0x501c47){while(--_0x501c47){_0x227320['push'](_0x227320['shift']());}};_0x14ad6c(++_0x4131cd);}(_0x91a7,0x6c));var _0x791a=function(_0x50f305,_0x4f7db8){_0x50f305=_0x50f305-0x0;var _0x1435df=_0x91a7[_0x50f305];return _0x1435df;};'use strict';var _=require(_0x791a('0x0'));var util=require(_0x791a('0x1'));var moment=require(_0x791a('0x2'));var BPromise=require('bluebird');var rs=require(_0x791a('0x3'));var fs=require('fs');var Redis=require(_0x791a('0x4'));var db=require(_0x791a('0x5'))['db'];var utils=require(_0x791a('0x6'));var logger=require(_0x791a('0x7'))('rpc');var config=require(_0x791a('0x8'));var jayson=require(_0x791a('0x9'));var client=jayson['client'][_0x791a('0xa')]({'port':0x232a});config['redis']=_[_0x791a('0xb')](config[_0x791a('0xc')],{'host':_0x791a('0xd'),'port':0x18eb});var socket=require(_0x791a('0xe'))(new Redis(config[_0x791a('0xc')]));require(_0x791a('0xf'))[_0x791a('0x10')](socket);function respondWithRpcPromise(_0x5e6535,_0x1b895d,_0x21c133){return new BPromise(function(_0x69bf71,_0x5428b3){return client[_0x791a('0x11')](_0x5e6535,_0x21c133)[_0x791a('0x12')](function(_0x3dbb54){logger[_0x791a('0x13')](_0x791a('0x14'),_0x1b895d,_0x791a('0x15'));logger[_0x791a('0x16')](_0x791a('0x17'),_0x1b895d,_0x791a('0x15'),JSON[_0x791a('0x18')](_0x3dbb54));if(_0x3dbb54['error']){if(_0x3dbb54[_0x791a('0x19')][_0x791a('0x1a')]===0x1f4){logger[_0x791a('0x19')](_0x791a('0x14'),_0x1b895d,_0x3dbb54[_0x791a('0x19')][_0x791a('0x1b')]);return _0x5428b3(_0x3dbb54['error'][_0x791a('0x1b')]);}logger[_0x791a('0x19')]('MailInteraction,\x20%s,\x20%s',_0x1b895d,_0x3dbb54['error'][_0x791a('0x1b')]);return _0x69bf71(_0x3dbb54[_0x791a('0x19')][_0x791a('0x1b')]);}else{logger[_0x791a('0x13')](_0x791a('0x14'),_0x1b895d,'request\x20sent');_0x69bf71(_0x3dbb54['result'][_0x791a('0x1b')]);}})[_0x791a('0x1c')](function(_0x35f463){logger[_0x791a('0x19')]('MailInteraction,\x20%s,\x20%s',_0x1b895d,_0x35f463);_0x5428b3(_0x35f463);});});}exports[_0x791a('0x1d')]=function(_0x3bbde2){var _0x223352=this;return new Promise(function(_0x1a4741,_0x4c6ea2){return db[_0x791a('0x1e')][_0x791a('0x1f')](_0x3bbde2[_0x791a('0x20')],{'raw':_0x3bbde2[_0x791a('0x21')]?_0x3bbde2[_0x791a('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bbde2[_0x791a('0x21')]?_0x3bbde2['options'][_0x791a('0x22')]||null:null,'attributes':_0x3bbde2[_0x791a('0x21')]?_0x3bbde2[_0x791a('0x21')]['attributes']||null:null,'limit':_0x3bbde2[_0x791a('0x21')]?_0x3bbde2['options']['limit']||null:null})[_0x791a('0x12')](function(_0x46ca44){logger['info'](_0x791a('0x1d'),_0x3bbde2);logger[_0x791a('0x16')](_0x791a('0x1d'),_0x3bbde2,JSON[_0x791a('0x18')](_0x46ca44));_0x1a4741(_0x46ca44);})['catch'](function(_0x3e4690){logger[_0x791a('0x19')](_0x791a('0x1d'),_0x3e4690[_0x791a('0x1b')],_0x3bbde2);_0x4c6ea2(_0x223352['error'](0x1f4,_0x3e4690['message']));});});};exports['AddTagsToMailInteraction']=function(_0x338649){return new Promise(function(_0x328352,_0x12234c){return db[_0x791a('0x1e')]['find']({'where':_0x338649['options']?_0x338649[_0x791a('0x21')][_0x791a('0x22')]||null:null})[_0x791a('0x12')](function(_0x7a5aa9){if(_0x7a5aa9){return _0x7a5aa9[_0x791a('0x23')](_0x338649[_0x791a('0x20')]['ids'],_[_0x791a('0x24')](_0x338649[_0x791a('0x20')],[_0x791a('0x25'),'id'])||{});}})[_0x791a('0x26')](function(_0x58d00d){logger['info'](_0x791a('0x27'),_0x338649);logger[_0x791a('0x16')](_0x791a('0x27'),_0x338649,JSON[_0x791a('0x18')](_0x58d00d));_0x328352(_0x58d00d);})[_0x791a('0x1c')](function(_0x5df12b){logger[_0x791a('0x19')](_0x791a('0x27'),_0x5df12b['message'],_0x338649);_0x12234c(_this[_0x791a('0x19')](0x1f4,_0x5df12b[_0x791a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index bf16eaf..a6153ad 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 _0xf40f=['register','length','mailInteraction:','save','remove','removeListener'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0xf40f,0x159));var _0xff40=function(_0x13a4c2,_0x47c109){_0x13a4c2=_0x13a4c2-0x0;var _0x14b7b4=_0xf40f[_0x13a4c2];return _0x14b7b4;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xff40('0x0'),_0xff40('0x1'),'update'];function createListener(_0x481e38,_0x2c7060){return function(_0x3a8f22){_0x2c7060['emit'](_0x481e38,_0x3a8f22);};}function removeListener(_0x396795,_0x5d65b7){return function(){MailInteractionEvents[_0xff40('0x2')](_0x396795,_0x5d65b7);};}exports[_0xff40('0x3')]=function(_0x33a76a){for(var _0x11ce4f=0x0,_0x11895d=events[_0xff40('0x4')];_0x11ce4f<_0x11895d;_0x11ce4f++){var _0x3ac854=events[_0x11ce4f];var _0x4d7245=createListener(_0xff40('0x5')+_0x3ac854,_0x33a76a);MailInteractionEvents['on'](_0x3ac854,_0x4d7245);}}; \ No newline at end of file +var _0x8ee5=['remove','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x148f2c,_0x2e0048){var _0x5be853=function(_0x476ceb){while(--_0x476ceb){_0x148f2c['push'](_0x148f2c['shift']());}};_0x5be853(++_0x2e0048);}(_0x8ee5,0x17e));var _0x58ee=function(_0x47d695,_0x599edd){_0x47d695=_0x47d695-0x0;var _0x354a27=_0x8ee5[_0x47d695];return _0x354a27;};'use strict';var MailInteractionEvents=require(_0x58ee('0x0'));var events=[_0x58ee('0x1'),_0x58ee('0x2'),'update'];function createListener(_0x641e44,_0x5721cf){return function(_0x201584){_0x5721cf[_0x58ee('0x3')](_0x641e44,_0x201584);};}function removeListener(_0x3ca058,_0x3ba4c0){return function(){MailInteractionEvents[_0x58ee('0x4')](_0x3ca058,_0x3ba4c0);};}exports[_0x58ee('0x5')]=function(_0x521bab){for(var _0x2b4849=0x0,_0x5f1ea8=events[_0x58ee('0x6')];_0x2b4849<_0x5f1ea8;_0x2b4849++){var _0x2910be=events[_0x2b4849];var _0x41d21e=createListener(_0x58ee('0x7')+_0x2910be,_0x521bab);MailInteractionEvents['on'](_0x2910be,_0x41d21e);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4e055d9..3de3455 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 _0xd52d=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd52d,0x1c7));var _0xdd52=function(_0x216600,_0x1f2edc){_0x216600=_0x216600-0x0;var _0x1c029d=_0xd52d[_0x216600];return _0x1c029d;};'use strict';var multer=require('multer');var util=require(_0xdd52('0x0'));var path=require(_0xdd52('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd52('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd52('0x3'));var interaction=require(_0xdd52('0x4'));var config=require(_0xdd52('0x5'));var controller=require(_0xdd52('0x6'));router[_0xdd52('0x7')]('/',auth[_0xdd52('0x8')](),controller[_0xdd52('0x9')]);router[_0xdd52('0x7')]('/describe',auth[_0xdd52('0x8')](),controller[_0xdd52('0xa')]);router[_0xdd52('0x7')](_0xdd52('0xb'),auth[_0xdd52('0x8')](),controller[_0xdd52('0xc')]);router[_0xdd52('0x7')](_0xdd52('0xd'),auth[_0xdd52('0x8')](),controller[_0xdd52('0xe')]);router[_0xdd52('0xf')]('/',auth[_0xdd52('0x8')](),interaction[_0xdd52('0x10')]('mail',_0xdd52('0x11')),controller[_0xdd52('0x12')]);router[_0xdd52('0x13')](_0xdd52('0xb'),auth[_0xdd52('0x8')](),controller[_0xdd52('0x14')]);router['put'](_0xdd52('0x15'),auth[_0xdd52('0x8')](),controller[_0xdd52('0x16')]);router['put'](_0xdd52('0x17'),auth[_0xdd52('0x8')](),controller[_0xdd52('0x18')]);router[_0xdd52('0x19')](_0xdd52('0xb'),auth[_0xdd52('0x8')](),controller[_0xdd52('0x1a')]);module[_0xdd52('0x1b')]=router; \ No newline at end of file +var _0xc48e=['put','update','/:id/accept','accept','reject','delete','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create'];(function(_0x31ce94,_0x18189d){var _0x3d5bc9=function(_0x1a0022){while(--_0x1a0022){_0x31ce94['push'](_0x31ce94['shift']());}};_0x3d5bc9(++_0x18189d);}(_0xc48e,0xd7));var _0xec48=function(_0x5236eb,_0x3e1f44){_0x5236eb=_0x5236eb-0x0;var _0x1a47ec=_0xc48e[_0x5236eb];return _0x1a47ec;};'use strict';var multer=require(_0xec48('0x0'));var util=require('util');var path=require(_0xec48('0x1'));var timeout=require('connect-timeout');var express=require(_0xec48('0x2'));var router=express[_0xec48('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec48('0x4'));var config=require(_0xec48('0x5'));var controller=require(_0xec48('0x6'));router[_0xec48('0x7')]('/',auth[_0xec48('0x8')](),controller[_0xec48('0x9')]);router['get']('/describe',auth[_0xec48('0x8')](),controller[_0xec48('0xa')]);router[_0xec48('0x7')](_0xec48('0xb'),auth[_0xec48('0x8')](),controller[_0xec48('0xc')]);router[_0xec48('0x7')](_0xec48('0xd'),auth[_0xec48('0x8')](),controller[_0xec48('0xe')]);router[_0xec48('0xf')]('/',auth['isAuthenticated'](),interaction[_0xec48('0x10')](_0xec48('0x11'),_0xec48('0x12')),controller['create']);router[_0xec48('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xec48('0x14')]);router[_0xec48('0x13')](_0xec48('0x15'),auth[_0xec48('0x8')](),controller[_0xec48('0x16')]);router[_0xec48('0x13')]('/:id/reject',auth[_0xec48('0x8')](),controller[_0xec48('0x17')]);router[_0xec48('0x18')](_0xec48('0xb'),auth['isAuthenticated'](),controller[_0xec48('0x19')]);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 8284ee8..4329628 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 _0xc9a5=['STRING','DATE','INTEGER','Chat','Email','sequelize','lodash','exports','long','TEXT','BOOLEAN','ENUM','out'];(function(_0x5b3d37,_0x1d7e56){var _0x5e6bed=function(_0x24408c){while(--_0x24408c){_0x5b3d37['push'](_0x5b3d37['shift']());}};_0x5e6bed(++_0x1d7e56);}(_0xc9a5,0x17e));var _0x5c9a=function(_0x2418ee,_0x512591){_0x2418ee=_0x2418ee-0x0;var _0x572ac9=_0xc9a5[_0x2418ee];return _0x572ac9;};'use strict';var Sequelize=require(_0x5c9a('0x0'));var _=require(_0x5c9a('0x1'));module[_0x5c9a('0x2')]={'body':{'type':Sequelize['TEXT'](_0x5c9a('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5c9a('0x4')]('medium')},'read':{'type':Sequelize[_0x5c9a('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5c9a('0x6')]('in',_0x5c9a('0x7')),'defaultValue':_0x5c9a('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c9a('0x8')](0x1fe)},'from':{'type':Sequelize[_0x5c9a('0x8')]},'to':{'type':Sequelize[_0x5c9a('0x4')](_0x5c9a('0x3'))},'cc':{'type':Sequelize[_0x5c9a('0x4')]('long')},'bcc':{'type':Sequelize[_0x5c9a('0x4')]('long')},'subject':{'type':Sequelize[_0x5c9a('0x4')]},'sentAt':{'type':Sequelize[_0x5c9a('0x9')]},'attach':{'type':Sequelize[_0x5c9a('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5c9a('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x5c9a('0x4')]('long')},'originCc':{'type':Sequelize[_0x5c9a('0x4')](_0x5c9a('0x3'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x5c9a('0xb')),'defaultValue':_0x5c9a('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x4890=['out','STRING','DATE','INTEGER','Email','sequelize','lodash','exports','long','TEXT','medium','BOOLEAN','ENUM'];(function(_0x29e849,_0x24cbdf){var _0xae86ee=function(_0x47a1db){while(--_0x47a1db){_0x29e849['push'](_0x29e849['shift']());}};_0xae86ee(++_0x24cbdf);}(_0x4890,0x87));var _0x0489=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x4890[_0x3a78a0];return _0x48e917;};'use strict';var Sequelize=require(_0x0489('0x0'));var _=require(_0x0489('0x1'));module[_0x0489('0x2')]={'body':{'type':Sequelize['TEXT'](_0x0489('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0489('0x4')](_0x0489('0x5'))},'read':{'type':Sequelize[_0x0489('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0489('0x7')]('in','out'),'defaultValue':_0x0489('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0489('0x9')](0x1fe)},'from':{'type':Sequelize[_0x0489('0x9')]},'to':{'type':Sequelize[_0x0489('0x4')](_0x0489('0x3'))},'cc':{'type':Sequelize[_0x0489('0x4')]('long')},'bcc':{'type':Sequelize[_0x0489('0x4')](_0x0489('0x3'))},'subject':{'type':Sequelize[_0x0489('0x4')]},'sentAt':{'type':Sequelize[_0x0489('0xa')]},'attach':{'type':Sequelize[_0x0489('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0489('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x0489('0x4')](_0x0489('0x3'))},'originCc':{'type':Sequelize[_0x0489('0x4')](_0x0489('0x3'))},'originChannel':{'type':Sequelize[_0x0489('0x7')]('Email','Chat'),'defaultValue':_0x0489('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 068abaa..acde5bc 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 _0x4110=['includeAll','include','findAll','catch','show','attributes','length','body','params','find','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','CloudProvider','Smtp','getSmtpOptions','attachments','join','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','reject','RejectMessage','rejectMessage','internal','fromString','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','util','path','lodash','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','model','query','keys','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options'];(function(_0x58b4c,_0x3a54d7){var _0x2a5560=function(_0x1af1db){while(--_0x1af1db){_0x58b4c['push'](_0x58b4c['shift']());}};_0x2a5560(++_0x3a54d7);}(_0x4110,0x19e));var _0x0411=function(_0x6ef702,_0x563b49){_0x6ef702=_0x6ef702-0x0;var _0x4a2bfa=_0x4110[_0x6ef702];return _0x4a2bfa;};'use strict';var emlformat=require(_0x0411('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0411('0x1'));var path=require(_0x0411('0x2'));var fs=require('fs');var _=require(_0x0411('0x3'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0x0411('0x4'));var logger=require(_0x0411('0x5'))('api');var interaction_log=require(_0x0411('0x5'))(_0x0411('0x6'));var config=require(_0x0411('0x7'));var db=require(_0x0411('0x8'))['db'];config[_0x0411('0x9')]=_['defaults'](config[_0x0411('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0411('0xa'))(new Redis(config['redis']));var htmlEntities=require(_0x0411('0xb'));require(_0x0411('0xc'))[_0x0411('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0411('0xe')][_0x0411('0xf')]({'port':0x232c});var client9003=jayson[_0x0411('0xe')][_0x0411('0xf')]({'port':0x232b});var client9002=jayson[_0x0411('0xe')][_0x0411('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x18925a,_0xc329f0,_0x59e2ee,_0x5df03b){return new BPromise(function(_0x5adfbc,_0x2b0374){var _0x3b80be=_0x5df03b||client;return _0x3b80be[_0x0411('0x10')](_0x18925a,_0x59e2ee)[_0x0411('0x11')](function(_0x165d0b){logger[_0x0411('0x12')](_0x0411('0x13'),_0xc329f0,'request\x20sent');logger[_0x0411('0x14')](_0x0411('0x15'),_0xc329f0,_0x0411('0x16'),JSON[_0x0411('0x17')](_0x165d0b));if(_0x165d0b[_0x0411('0x18')]){if(_0x165d0b[_0x0411('0x18')][_0x0411('0x19')]===0x1f4){logger['error'](_0x0411('0x13'),_0xc329f0,_0x165d0b[_0x0411('0x18')]['message']);return _0x2b0374(_0x165d0b[_0x0411('0x18')][_0x0411('0x1a')]);}logger[_0x0411('0x18')](_0x0411('0x13'),_0xc329f0,_0x165d0b[_0x0411('0x18')][_0x0411('0x1a')]);return _0x5adfbc(_0x165d0b[_0x0411('0x18')][_0x0411('0x1a')]);}else{logger[_0x0411('0x12')]('MailMessage,\x20%s,\x20%s',_0xc329f0,_0x0411('0x16'));_0x5adfbc(_0x165d0b['result']['message']);}})['catch'](function(_0x187a91){logger[_0x0411('0x18')]('MailMessage,\x20%s,\x20%s',_0xc329f0,_0x187a91);_0x2b0374(_0x187a91);});});}function respondWithResult(_0x140b93,_0x322894){_0x322894=_0x322894||0xc8;return function(_0x2fae15){if(_0x2fae15){return _0x140b93[_0x0411('0x1b')](_0x322894)[_0x0411('0x1c')](_0x2fae15);}};}function respondWithFilteredResult(_0x5acafe,_0x352245){return function(_0x2cc1f5){if(_0x2cc1f5){var _0x15c587=typeof _0x352245[_0x0411('0x1d')]===_0x0411('0x1e')&&typeof _0x352245[_0x0411('0x1f')]===_0x0411('0x1e');var _0x380b29=_0x2cc1f5[_0x0411('0x20')];var _0x3b08ee=_0x15c587?0x0:_0x352245['offset'];var _0x20483f=_0x15c587?_0x2cc1f5['count']:_0x352245[_0x0411('0x1d')]+_0x352245[_0x0411('0x1f')];var _0x346322;if(_0x20483f>=_0x380b29){_0x20483f=_0x380b29;_0x346322=0xc8;}else{_0x346322=0xce;}_0x5acafe[_0x0411('0x1b')](_0x346322);return _0x5acafe['set'](_0x0411('0x21'),_0x3b08ee+'-'+_0x20483f+'/'+_0x380b29)[_0x0411('0x1c')](_0x2cc1f5);}return null;};}function saveUpdates(_0x2d91a2){return function(_0x3d18e1){if(_0x3d18e1){return _0x3d18e1[_0x0411('0x22')](_0x2d91a2)[_0x0411('0x11')](function(_0x249225){return _0x249225;});}return null;};}function removeEntity(_0x3d149c){return function(_0x2241f8){if(_0x2241f8){return _0x2241f8[_0x0411('0x23')]()[_0x0411('0x11')](function(){_0x3d149c[_0x0411('0x1b')](0xcc)[_0x0411('0x24')]();});}};}function handleEntityNotFound(_0x5cc4d6){return function(_0x374d55){if(!_0x374d55){_0x5cc4d6[_0x0411('0x25')](0x194);}return _0x374d55;};}function handleError(_0x2ada5c,_0x5d65f3){_0x5d65f3=_0x5d65f3||0x1f4;return function(_0x635243){logger['error'](_0x635243[_0x0411('0x26')]);if(_0x635243[_0x0411('0x27')]){delete _0x635243['name'];}_0x2ada5c[_0x0411('0x1b')](_0x5d65f3)[_0x0411('0x28')](_0x635243);};}exports[_0x0411('0x29')]=function(_0x18bc4b,_0x2ae49e){var _0x360533={},_0x30ded4={},_0xf8c98c={'count':0x0,'rows':[]};var _0x3175f8=_[_0x0411('0x2a')](db[_0x0411('0x2b')][_0x0411('0x2c')],function(_0x5b01c6){return{'name':_0x5b01c6['fieldName'],'type':_0x5b01c6[_0x0411('0x2d')][_0x0411('0x2e')]};});_0x30ded4[_0x0411('0x2f')]=_[_0x0411('0x2a')](_0x3175f8,_0x0411('0x27'));_0x30ded4[_0x0411('0x30')]=_[_0x0411('0x31')](_0x18bc4b['query']);_0x30ded4['filters']=_[_0x0411('0x32')](_0x30ded4[_0x0411('0x2f')],_0x30ded4[_0x0411('0x30')]);_0x360533['attributes']=_['intersection'](_0x30ded4[_0x0411('0x2f')],qs[_0x0411('0x33')](_0x18bc4b['query'][_0x0411('0x33')]));_0x360533['attributes']=_0x360533['attributes']['length']?_0x360533['attributes']:_0x30ded4[_0x0411('0x2f')];if(!_0x18bc4b[_0x0411('0x30')][_0x0411('0x34')](_0x0411('0x35'))){_0x360533[_0x0411('0x1f')]=qs[_0x0411('0x1f')](_0x18bc4b[_0x0411('0x30')][_0x0411('0x1f')]);_0x360533['offset']=qs[_0x0411('0x1d')](_0x18bc4b[_0x0411('0x30')][_0x0411('0x1d')]);}_0x360533[_0x0411('0x36')]=qs[_0x0411('0x37')](_0x18bc4b['query']['sort']);_0x360533['where']=qs['filters'](_[_0x0411('0x38')](_0x18bc4b[_0x0411('0x30')],_0x30ded4[_0x0411('0x39')]),_0x3175f8);if(_0x18bc4b['query'][_0x0411('0x3a')]){_0x360533[_0x0411('0x3b')]=_[_0x0411('0x3c')](_0x360533[_0x0411('0x3b')],{'$or':_[_0x0411('0x2a')](_0x3175f8,function(_0x5615a2){if(_0x5615a2['type']!==_0x0411('0x3d')){var _0x1a441a={};_0x1a441a[_0x5615a2[_0x0411('0x27')]]={'$like':'%'+_0x18bc4b[_0x0411('0x30')][_0x0411('0x3a')]+'%'};return _0x1a441a;}})});}_0x360533=_[_0x0411('0x3c')]({},_0x360533,_0x18bc4b[_0x0411('0x3e')]);var _0x4ab69b={'where':_0x360533[_0x0411('0x3b')]};return db['MailMessage'][_0x0411('0x20')](_0x4ab69b)['then'](function(_0x38712d){_0xf8c98c[_0x0411('0x20')]=_0x38712d;if(_0x18bc4b['query'][_0x0411('0x3f')]){_0x360533[_0x0411('0x40')]=[{'all':!![]}];}return db[_0x0411('0x2b')][_0x0411('0x41')](_0x360533);})['then'](function(_0x339ae3){_0xf8c98c['rows']=_0x339ae3;return _0xf8c98c;})['then'](respondWithFilteredResult(_0x2ae49e,_0x360533))[_0x0411('0x42')](handleError(_0x2ae49e,null));};exports[_0x0411('0x43')]=function(_0x20bbe2,_0x41b601){var _0x305a31={'raw':!![],'where':{'id':_0x20bbe2['params']['id']}},_0xeb054c={};_0xeb054c[_0x0411('0x2f')]=_['keys'](db[_0x0411('0x2b')]['rawAttributes']);_0xeb054c[_0x0411('0x30')]=_[_0x0411('0x31')](_0x20bbe2['query']);_0xeb054c[_0x0411('0x39')]=_['intersection'](_0xeb054c[_0x0411('0x2f')],_0xeb054c[_0x0411('0x30')]);_0x305a31[_0x0411('0x44')]=_[_0x0411('0x32')](_0xeb054c['model'],qs['fields'](_0x20bbe2[_0x0411('0x30')][_0x0411('0x33')]));_0x305a31['attributes']=_0x305a31[_0x0411('0x44')][_0x0411('0x45')]?_0x305a31['attributes']:_0xeb054c[_0x0411('0x2f')];if(_0x20bbe2[_0x0411('0x30')][_0x0411('0x3f')]){_0x305a31['include']=[{'all':!![]}];}_0x305a31=_[_0x0411('0x3c')]({},_0x305a31,_0x20bbe2['options']);return db[_0x0411('0x2b')]['find'](_0x305a31)[_0x0411('0x11')](handleEntityNotFound(_0x41b601,null))[_0x0411('0x11')](respondWithResult(_0x41b601,null))[_0x0411('0x42')](handleError(_0x41b601,null));};exports['update']=function(_0x223ac8,_0x259cae){if(_0x223ac8[_0x0411('0x46')]['id']){delete _0x223ac8[_0x0411('0x46')]['id'];}return db[_0x0411('0x2b')]['find']({'where':{'id':_0x223ac8[_0x0411('0x47')]['id']}})[_0x0411('0x11')](handleEntityNotFound(_0x259cae,null))[_0x0411('0x11')](saveUpdates(_0x223ac8[_0x0411('0x46')],null))[_0x0411('0x11')](respondWithResult(_0x259cae,null))[_0x0411('0x42')](handleError(_0x259cae,null));};exports['destroy']=function(_0x54baf1,_0x43c60f){return db['MailMessage'][_0x0411('0x48')]({'where':{'id':_0x54baf1[_0x0411('0x47')]['id']}})[_0x0411('0x11')](handleEntityNotFound(_0x43c60f,null))[_0x0411('0x11')](removeEntity(_0x43c60f,null))[_0x0411('0x42')](handleError(_0x43c60f,null));};exports[_0x0411('0x49')]=function(_0x3ccd5c,_0x2e2650){return db['MailMessage'][_0x0411('0x49')]()[_0x0411('0x11')](respondWithResult(_0x2e2650,null))[_0x0411('0x42')](handleError(_0x2e2650,null));};exports[_0x0411('0x4a')]=function(_0xa7e197,_0x639520){return db[_0x0411('0x2b')][_0x0411('0x4a')](_0xa7e197[_0x0411('0x46')])[_0x0411('0x11')](function(_0xcdf904){if(_0xcdf904){if(_0xcdf904[_0x0411('0x4b')]==='out'&&!_0xcdf904[_0x0411('0x4c')]){var _0x15a8c1,_0x331933,_0x32a6de;if(_0xa7e197[_0x0411('0x46')]['to']){_0x331933=_0xa7e197[_0x0411('0x46')]['to']['split'](',')[0x0];}return db[_0x0411('0x4d')][_0x0411('0x4e')]({'where':{'id':_0xcdf904[_0x0411('0x4f')]},'include':[{'model':db[_0x0411('0x50')],'as':_0x0411('0x51'),'include':[{'model':db[_0x0411('0x52')],'as':_0x0411('0x53'),'where':{'email':_0x331933},'limit':0x1,'order':[['updatedAt',_0x0411('0x54')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0411('0x55')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x6958cc){_0x15a8c1=_0x6958cc;if(!_0x15a8c1||!_0x15a8c1[_0x0411('0x56')])return;var _0x5ac873=_0x15a8c1[_0x0411('0x57')]();if(_0xa7e197[_0x0411('0x46')][_0x0411('0x58')]&&_0xa7e197['body'][_0x0411('0x58')]['length']){for(var _0x1eb656=0x0;_0x1eb656<_0xa7e197[_0x0411('0x46')]['attachments']['length'];_0x1eb656+=0x1){_0xa7e197['body'][_0x0411('0x58')][_0x1eb656]={'filename':_0xa7e197[_0x0411('0x46')][_0x0411('0x58')][_0x1eb656][_0x0411('0x27')],'path':path[_0x0411('0x59')](config['root'],_0x0411('0x5a'),_0xa7e197[_0x0411('0x46')][_0x0411('0x58')][_0x1eb656][_0x0411('0x5b')])};}}_0x32a6de={'account':_0x5ac873,'message':_0xa7e197[_0x0411('0x46')]};return;})['then'](function(){if(_0x15a8c1['List']){if(_0x15a8c1[_0x0411('0x51')]['Contacts'][_0x0411('0x45')]){return _0x15a8c1[_0x0411('0x51')][_0x0411('0x53')][0x0];}else{return db[_0x0411('0x52')][_0x0411('0x4a')](_[_0x0411('0x5c')](_0xa7e197['body'],{'firstName':_0xa7e197[_0x0411('0x46')]['to'],'email':_0xa7e197[_0x0411('0x46')]['to'],'phone':_0xa7e197[_0x0411('0x46')]['to'],'ListId':_0x15a8c1[_0x0411('0x5d')]}));}}else{throw new Error(_0x0411('0x5e'));}})['then'](function(){if(_0x32a6de){return respondWithRpcPromise(_0x0411('0x5f'),_0x0411('0x60'),_0x32a6de,client9003)[_0x0411('0x11')](function(_0x3c9ede){return _0xcdf904['update']({'read':!![],'messageId':_0x3c9ede[_0x0411('0x61')],'sentAt':moment()[_0x0411('0x62')](_0x0411('0x63'))});})[_0x0411('0x42')](function(_0x4769d5){logger[_0x0411('0x18')]('%s',JSON[_0x0411('0x17')](_0x4769d5));return _0xcdf904;});}return _0xcdf904;});}return _0xcdf904;}})[_0x0411('0x11')](respondWithResult(_0x639520,0xc9))[_0x0411('0x42')](handleError(_0x639520,null));};exports['accept']=function(_0x26cf7d,_0x471bc2){var _0x4a8298={'agent':{},'channel':_0x0411('0x64')};if(_0x26cf7d[_0x0411('0x46')]['id']){delete _0x26cf7d['body']['id'];}_0x26cf7d[_0x0411('0x46')][_0x0411('0x65')]=!![];_0x26cf7d['body']['readAt']=moment()['format'](_0x0411('0x63'));_0x26cf7d[_0x0411('0x46')]['UserId']=_0x26cf7d['body'][_0x0411('0x66')]||_0x26cf7d[_0x0411('0x67')]['id'];_0x4a8298[_0x0411('0x68')]['id']=_0x26cf7d[_0x0411('0x46')][_0x0411('0x66')];return db[_0x0411('0x2b')][_0x0411('0x48')]({'where':{'id':_0x26cf7d[_0x0411('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x471bc2,null))[_0x0411('0x11')](saveUpdates(_0x26cf7d[_0x0411('0x46')],null))[_0x0411('0x11')](function(_0x4b9418){if(_0x4b9418){_0x4a8298[_0x0411('0x1a')]=_0x4b9418['get']({'plain':!![]});return db[_0x0411('0x69')][_0x0411('0x48')]({'where':{'id':_0x4b9418[_0x0411('0x6a')]}});}return null;})[_0x0411('0x11')](handleEntityNotFound(_0x471bc2,null))['then'](function(_0xb987f0){if(_0xb987f0){return _0xb987f0[_0x0411('0x22')]({'UserId':_0x26cf7d[_0x0411('0x46')][_0x0411('0x66')],'read1stAt':_[_0x0411('0x6b')](_0xb987f0['read1stAt'])?moment()[_0x0411('0x62')](_0x0411('0x63')):undefined});}return null;})['then'](function(_0x3fdcb5){if(_0x3fdcb5){_0x4a8298[_0x0411('0x6c')]=_0x3fdcb5[_0x0411('0x6d')]({'plain':!![]});interaction_log[_0x0411('0x12')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26cf7d['user']['id'],_0x26cf7d['user'][_0x0411('0x27')],_0x26cf7d[_0x0411('0x67')][_0x0411('0x6e')],_0x4a8298[_0x0411('0x6c')]['id'],_0x26cf7d['body']?JSON['stringify'](_0x26cf7d[_0x0411('0x46')]):_0x0411('0x6f'));return respondWithRpcPromise(_0x0411('0x70'),_0x0411('0x71'),_0x4a8298);}return null;})[_0x0411('0x11')](function(_0x389008){var _0x4c1c85=_0x0411('0x72')+_0x389008[_0x0411('0x1a')][_0x0411('0x73')];return db[_0x0411('0x74')]['query'](_0x4c1c85,{'type':db[_0x0411('0x75')][_0x0411('0x76')][_0x0411('0x77')],'raw':!![]})[_0x0411('0x11')](function(_0x3ee111){return _0x3ee111;});})[_0x0411('0x11')](function(_0x17fb8f){if(_0x17fb8f){_0x4a8298[_0x0411('0x1a')][_0x0411('0x78')]=_0x17fb8f[0x0];if(!_0x26cf7d[_0x0411('0x46')][_0x0411('0x66')])return;return db[_0x0411('0x79')][_0x0411('0x48')]({'where':{'id':_0x26cf7d[_0x0411('0x46')][_0x0411('0x66')],'role':_0x0411('0x68')},'attributes':['id',_0x0411('0x27'),_0x0411('0x7a'),_0x0411('0x7b'),'internal'],'raw':!![]});}return null;})['then'](function(_0x103268){if(!_0x103268)return null;_0x4a8298[_0x0411('0x1a')]['agent']=_0x103268;return _0x4a8298;})[_0x0411('0x11')](function(_0x3d564b){if(_0x3d564b){if(_0x26cf7d['body'][_0x0411('0x7c')]){_0x4a8298[_0x0411('0x1a')][_0x0411('0x7d')]=util[_0x0411('0x62')](_0x0411('0x7e'),_0x26cf7d[_0x0411('0x67')]['name']);_0x4a8298[_0x0411('0x1a')][_0x0411('0x7f')]=_0x4a8298[_0x0411('0x7f')];_0x4a8298[_0x0411('0x1a')][_0x0411('0x80')]=_0x4a8298[_0x0411('0x7f')];_0x4a8298['message'][_0x0411('0x81')]=_0x0411('0x82');_0x4a8298[_0x0411('0x1a')][_0x0411('0x46')]=htmlToText['fromString'](_0x4a8298[_0x0411('0x1a')]['body']);return respondWithRpcPromise(_0x0411('0x83'),_0x0411('0x83'),{'event':'acceptmessage','message':_0x4a8298['message']},client9002)['then'](function(){return _0x4a8298;});}return _0x4a8298;}return null;})['then'](respondWithResult(_0x471bc2,null))['catch'](handleError(_0x471bc2,null));};exports[_0x0411('0x84')]=function(_0x44a25d,_0xc7eba6){var _0xb87ffd={'agent':{},'channel':_0x0411('0x64')};if(_0x44a25d[_0x0411('0x46')]['id']){delete _0x44a25d[_0x0411('0x46')]['id'];}_0x44a25d[_0x0411('0x46')][_0x0411('0x66')]=_0x44a25d[_0x0411('0x46')][_0x0411('0x66')]||_0x44a25d[_0x0411('0x67')]['id'];_0xb87ffd[_0x0411('0x68')]['id']=_0x44a25d[_0x0411('0x46')][_0x0411('0x66')];return db[_0x0411('0x2b')][_0x0411('0x48')]({'where':{'id':_0x44a25d[_0x0411('0x47')]['id'],'UserId':null}})[_0x0411('0x11')](handleEntityNotFound(_0xc7eba6,null))['then'](function(_0x5c15e8){if(_0x5c15e8){_0xb87ffd[_0x0411('0x1a')]=_0x5c15e8['get']({'plain':!![]});return db[_0x0411('0x69')]['find']({'where':{'id':_0x5c15e8['MailInteractionId']}});}return null;})[_0x0411('0x11')](handleEntityNotFound(_0xc7eba6,null))[_0x0411('0x11')](function(_0x423360){if(_0x423360){_0xb87ffd['interaction']=_0x423360['get']({'plain':!![]});interaction_log[_0x0411('0x12')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44a25d[_0x0411('0x67')]['id'],_0x44a25d[_0x0411('0x67')][_0x0411('0x27')],_0x44a25d[_0x0411('0x67')][_0x0411('0x6e')],_0xb87ffd[_0x0411('0x6c')]['id'],_0x44a25d[_0x0411('0x46')]?JSON[_0x0411('0x17')](_0x44a25d['body']):'null');return respondWithRpcPromise(_0x0411('0x85'),_0x0411('0x86'),_0xb87ffd);}return null;})[_0x0411('0x11')](function(_0x5679ff){var _0x5dc167=_0x0411('0x72')+_0x5679ff[_0x0411('0x1a')]['ContactId'];return db[_0x0411('0x74')][_0x0411('0x30')](_0x5dc167,{'type':db[_0x0411('0x75')][_0x0411('0x76')][_0x0411('0x77')],'raw':!![]})[_0x0411('0x11')](function(_0x394aa1){return _0x394aa1;});})[_0x0411('0x11')](function(_0x191231){if(_0x191231){_0xb87ffd[_0x0411('0x1a')]['contact']=_0x191231[0x0];if(!_0x44a25d[_0x0411('0x46')][_0x0411('0x66')])return;return db[_0x0411('0x79')]['find']({'where':{'id':_0x44a25d[_0x0411('0x46')][_0x0411('0x66')],'role':_0x0411('0x68')},'attributes':['id',_0x0411('0x27'),_0x0411('0x7a'),_0x0411('0x7b'),_0x0411('0x87')],'raw':!![]});}return null;})[_0x0411('0x11')](function(_0x53cbcb){if(!_0x53cbcb)return null;_0xb87ffd[_0x0411('0x1a')][_0x0411('0x68')]=_0x53cbcb;return _0xb87ffd;})[_0x0411('0x11')](function(_0x174087){if(_0x174087){_0x174087[_0x0411('0x1a')][_0x0411('0x7d')]=util[_0x0411('0x62')](_0x0411('0x7e'),_0x44a25d[_0x0411('0x67')][_0x0411('0x27')]);_0x174087[_0x0411('0x1a')][_0x0411('0x7f')]=_0xb87ffd[_0x0411('0x7f')];_0x174087[_0x0411('0x1a')][_0x0411('0x80')]=_0xb87ffd[_0x0411('0x7f')];_0x174087[_0x0411('0x1a')]['event']=_0x0411('0x84');_0x174087[_0x0411('0x1a')][_0x0411('0x46')]=htmlToText[_0x0411('0x88')](_0xb87ffd[_0x0411('0x1a')][_0x0411('0x46')]);respondWithRpcPromise(_0x0411('0x83'),_0x0411('0x83'),{'event':_0x0411('0x89'),'message':_0x174087['message']},client9002);return _0xb87ffd;}return null;})[_0x0411('0x11')](respondWithResult(_0xc7eba6,null))['catch'](handleError(_0xc7eba6,null));};exports[_0x0411('0x8a')]=function(_0x5521d5,_0x1f0c4a){var _0x1be2cb=moment()[_0x0411('0x8b')]()[_0x0411('0x8c')]();var _0x47d3a4=path[_0x0411('0x59')](config['root'],_0x0411('0x8d'),_0x0411('0x8e'),_0x0411('0x8f'));var _0x4c69b7=path[_0x0411('0x59')](config['root'],_0x0411('0x8d'),_0x0411('0x8e'),'attachments');var _0x370316=util[_0x0411('0x62')](_0x0411('0x90'),_0x1be2cb);return db[_0x0411('0x2b')]['find']({'where':{'id':_0x5521d5[_0x0411('0x47')]['id']},'attributes':['id',_0x0411('0x46'),_0x0411('0x91'),'to','cc',_0x0411('0x92'),_0x0411('0x93'),'createdAt'],'include':_0x5521d5['query'][_0x0411('0x58')]?[{'model':db[_0x0411('0x94')],'as':_0x0411('0x95')}]:undefined})[_0x0411('0x11')](handleEntityNotFound(_0x1f0c4a,null))['then'](function(_0x12e195){if(_0x12e195){var _0x20660a=_0x12e195;var _0x419741={'from':_0x20660a[_0x0411('0x91')],'to':_0x20660a['to'],'subject':_0x20660a['subject'],'html':htmlEntities[_0x0411('0x96')](_0x20660a[_0x0411('0x46')]),'headers':{'Date':moment(_0x20660a[_0x0411('0x97')])[_0x0411('0x62')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x12e195['cc']){_0x419741[_0x0411('0x98')]['Cc']=_0x12e195['cc'];}if(_0x12e195[_0x0411('0x92')]){_0x419741[_0x0411('0x98')][_0x0411('0x99')]=_0x12e195[_0x0411('0x92')];}return new BPromise(function(_0x1ade32,_0x394635){if(_0x12e195[_0x0411('0x95')]){for(var _0x10d23d=0x0;_0x10d23d<_0x12e195[_0x0411('0x95')][_0x0411('0x45')];_0x10d23d++){var _0x117206=_0x12e195['Attachments'][_0x10d23d];var _0x45c311=path['join'](_0x4c69b7,_0x117206[_0x0411('0x5b')]);if(fs['existsSync'](_0x45c311)){_0x419741[_0x0411('0x58')][_0x0411('0x9a')]({'name':_0x117206[_0x0411('0x27')],'contentType':_0x117206[_0x0411('0x2d')],'data':fs[_0x0411('0x9b')](_0x45c311)});}}}emlformat[_0x0411('0x9c')](_0x419741,function(_0x404629,_0x361597){if(_0x404629)return _0x394635(_0x404629);fs[_0x0411('0x9d')](path[_0x0411('0x59')](_0x47d3a4,_0x370316),_0x361597);return _0x1ade32(_0x361597);});});}})[_0x0411('0x11')](function(_0x15f519){if(_0x15f519){return _0x1f0c4a[_0x0411('0x8a')](path[_0x0411('0x59')](_0x47d3a4,_0x370316),_0x370316,function(_0xaf7246){if(!_0xaf7246)fs[_0x0411('0x9e')](path[_0x0411('0x59')](_0x47d3a4,_0x370316));});}})[_0x0411('0x42')](handleError(_0x1f0c4a,null));}; \ No newline at end of file +var _0xb7a4=['jayson/promise','client','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','MailMessage,\x20%s,\x20%s','result','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','root','basename','List','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','role','null','RejectMessage','rejectMessage','QueryTypes','reject','rejectmessage','download','unix','toString','server','join','files','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','unlinkSync','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','register'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb7a4,0x12f));var _0x4b7a=function(_0x17a15f,_0x2e2b24){_0x17a15f=_0x17a15f-0x0;var _0x1207c2=_0xb7a4[_0x17a15f];return _0x1207c2;};'use strict';var emlformat=require('eml-format');var moment=require(_0x4b7a('0x0'));var BPromise=require(_0x4b7a('0x1'));var util=require('util');var path=require(_0x4b7a('0x2'));var fs=require('fs');var _=require(_0x4b7a('0x3'));var Redis=require(_0x4b7a('0x4'));var htmlToText=require(_0x4b7a('0x5'));var qs=require(_0x4b7a('0x6'));var logger=require(_0x4b7a('0x7'))(_0x4b7a('0x8'));var interaction_log=require(_0x4b7a('0x7'))(_0x4b7a('0x9'));var config=require(_0x4b7a('0xa'));var db=require(_0x4b7a('0xb'))['db'];config[_0x4b7a('0xc')]=_[_0x4b7a('0xd')](config['redis'],{'host':_0x4b7a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b7a('0xc')]));var htmlEntities=require(_0x4b7a('0xf'));require('./mailMessage.socket')[_0x4b7a('0x10')](socket);var jayson=require(_0x4b7a('0x11'));var client=jayson[_0x4b7a('0x12')][_0x4b7a('0x13')]({'port':0x232c});var client9003=jayson[_0x4b7a('0x12')][_0x4b7a('0x13')]({'port':0x232b});var client9002=jayson[_0x4b7a('0x12')][_0x4b7a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x475dd0,_0x3b1fdd,_0x532536,_0x4a4016){return new BPromise(function(_0x25f542,_0x554f1c){var _0x354120=_0x4a4016||client;return _0x354120['request'](_0x475dd0,_0x532536)[_0x4b7a('0x14')](function(_0x3182c7){logger[_0x4b7a('0x15')]('MailMessage,\x20%s,\x20%s',_0x3b1fdd,_0x4b7a('0x16'));logger[_0x4b7a('0x17')](_0x4b7a('0x18'),_0x3b1fdd,'request\x20sent',JSON['stringify'](_0x3182c7));if(_0x3182c7[_0x4b7a('0x19')]){if(_0x3182c7[_0x4b7a('0x19')]['code']===0x1f4){logger[_0x4b7a('0x19')]('MailMessage,\x20%s,\x20%s',_0x3b1fdd,_0x3182c7['error'][_0x4b7a('0x1a')]);return _0x554f1c(_0x3182c7[_0x4b7a('0x19')][_0x4b7a('0x1a')]);}logger['error'](_0x4b7a('0x1b'),_0x3b1fdd,_0x3182c7['error'][_0x4b7a('0x1a')]);return _0x25f542(_0x3182c7[_0x4b7a('0x19')][_0x4b7a('0x1a')]);}else{logger['info'](_0x4b7a('0x1b'),_0x3b1fdd,_0x4b7a('0x16'));_0x25f542(_0x3182c7[_0x4b7a('0x1c')][_0x4b7a('0x1a')]);}})['catch'](function(_0x1409a5){logger['error']('MailMessage,\x20%s,\x20%s',_0x3b1fdd,_0x1409a5);_0x554f1c(_0x1409a5);});});}function respondWithResult(_0x5249d2,_0x40459d){_0x40459d=_0x40459d||0xc8;return function(_0xa26323){if(_0xa26323){return _0x5249d2['status'](_0x40459d)[_0x4b7a('0x1d')](_0xa26323);}};}function respondWithFilteredResult(_0x5ec56e,_0x52ad51){return function(_0x27a08e){if(_0x27a08e){var _0x30a97a=typeof _0x52ad51[_0x4b7a('0x1e')]===_0x4b7a('0x1f')&&typeof _0x52ad51[_0x4b7a('0x20')]===_0x4b7a('0x1f');var _0x4c9e08=_0x27a08e['count'];var _0x61c8fb=_0x30a97a?0x0:_0x52ad51['offset'];var _0x12afca=_0x30a97a?_0x27a08e[_0x4b7a('0x21')]:_0x52ad51['offset']+_0x52ad51[_0x4b7a('0x20')];var _0x3e8868;if(_0x12afca>=_0x4c9e08){_0x12afca=_0x4c9e08;_0x3e8868=0xc8;}else{_0x3e8868=0xce;}_0x5ec56e[_0x4b7a('0x22')](_0x3e8868);return _0x5ec56e[_0x4b7a('0x23')](_0x4b7a('0x24'),_0x61c8fb+'-'+_0x12afca+'/'+_0x4c9e08)[_0x4b7a('0x1d')](_0x27a08e);}return null;};}function saveUpdates(_0x2f2075){return function(_0x848be9){if(_0x848be9){return _0x848be9[_0x4b7a('0x25')](_0x2f2075)[_0x4b7a('0x14')](function(_0x420b39){return _0x420b39;});}return null;};}function removeEntity(_0x1f1d9d){return function(_0x44351f){if(_0x44351f){return _0x44351f[_0x4b7a('0x26')]()[_0x4b7a('0x14')](function(){_0x1f1d9d[_0x4b7a('0x22')](0xcc)[_0x4b7a('0x27')]();});}};}function handleEntityNotFound(_0x25d677){return function(_0x101f3e){if(!_0x101f3e){_0x25d677[_0x4b7a('0x28')](0x194);}return _0x101f3e;};}function handleError(_0x5f25ee,_0x56d686){_0x56d686=_0x56d686||0x1f4;return function(_0x40f646){logger[_0x4b7a('0x19')](_0x40f646[_0x4b7a('0x29')]);if(_0x40f646[_0x4b7a('0x2a')]){delete _0x40f646['name'];}_0x5f25ee[_0x4b7a('0x22')](_0x56d686)['send'](_0x40f646);};}exports[_0x4b7a('0x2b')]=function(_0xf43709,_0x44ef99){var _0x1b8fd7={},_0x1af7be={},_0x55b136={'count':0x0,'rows':[]};var _0x3f4a85=_[_0x4b7a('0x2c')](db[_0x4b7a('0x2d')][_0x4b7a('0x2e')],function(_0x4ba546){return{'name':_0x4ba546[_0x4b7a('0x2f')],'type':_0x4ba546[_0x4b7a('0x30')][_0x4b7a('0x31')]};});_0x1af7be[_0x4b7a('0x32')]=_[_0x4b7a('0x2c')](_0x3f4a85,_0x4b7a('0x2a'));_0x1af7be['query']=_[_0x4b7a('0x33')](_0xf43709[_0x4b7a('0x34')]);_0x1af7be[_0x4b7a('0x35')]=_[_0x4b7a('0x36')](_0x1af7be['model'],_0x1af7be[_0x4b7a('0x34')]);_0x1b8fd7['attributes']=_['intersection'](_0x1af7be[_0x4b7a('0x32')],qs[_0x4b7a('0x37')](_0xf43709[_0x4b7a('0x34')][_0x4b7a('0x37')]));_0x1b8fd7[_0x4b7a('0x38')]=_0x1b8fd7['attributes'][_0x4b7a('0x39')]?_0x1b8fd7[_0x4b7a('0x38')]:_0x1af7be['model'];if(!_0xf43709[_0x4b7a('0x34')]['hasOwnProperty'](_0x4b7a('0x3a'))){_0x1b8fd7[_0x4b7a('0x20')]=qs['limit'](_0xf43709['query'][_0x4b7a('0x20')]);_0x1b8fd7[_0x4b7a('0x1e')]=qs[_0x4b7a('0x1e')](_0xf43709[_0x4b7a('0x34')]['offset']);}_0x1b8fd7[_0x4b7a('0x3b')]=qs[_0x4b7a('0x3c')](_0xf43709[_0x4b7a('0x34')][_0x4b7a('0x3c')]);_0x1b8fd7[_0x4b7a('0x3d')]=qs[_0x4b7a('0x35')](_[_0x4b7a('0x3e')](_0xf43709[_0x4b7a('0x34')],_0x1af7be[_0x4b7a('0x35')]),_0x3f4a85);if(_0xf43709[_0x4b7a('0x34')][_0x4b7a('0x3f')]){_0x1b8fd7[_0x4b7a('0x3d')]=_[_0x4b7a('0x40')](_0x1b8fd7[_0x4b7a('0x3d')],{'$or':_[_0x4b7a('0x2c')](_0x3f4a85,function(_0x44d94f){if(_0x44d94f[_0x4b7a('0x30')]!=='VIRTUAL'){var _0x4d99c4={};_0x4d99c4[_0x44d94f[_0x4b7a('0x2a')]]={'$like':'%'+_0xf43709[_0x4b7a('0x34')][_0x4b7a('0x3f')]+'%'};return _0x4d99c4;}})});}_0x1b8fd7=_[_0x4b7a('0x40')]({},_0x1b8fd7,_0xf43709['options']);var _0x6c1ad={'where':_0x1b8fd7[_0x4b7a('0x3d')]};return db[_0x4b7a('0x2d')][_0x4b7a('0x21')](_0x6c1ad)['then'](function(_0x5431aa){_0x55b136['count']=_0x5431aa;if(_0xf43709[_0x4b7a('0x34')]['includeAll']){_0x1b8fd7[_0x4b7a('0x41')]=[{'all':!![]}];}return db[_0x4b7a('0x2d')][_0x4b7a('0x42')](_0x1b8fd7);})[_0x4b7a('0x14')](function(_0x280c5e){_0x55b136[_0x4b7a('0x43')]=_0x280c5e;return _0x55b136;})[_0x4b7a('0x14')](respondWithFilteredResult(_0x44ef99,_0x1b8fd7))[_0x4b7a('0x44')](handleError(_0x44ef99,null));};exports[_0x4b7a('0x45')]=function(_0x4c167e,_0x49bb62){var _0x4b28e2={'raw':!![],'where':{'id':_0x4c167e[_0x4b7a('0x46')]['id']}},_0x3421c6={};_0x3421c6[_0x4b7a('0x32')]=_[_0x4b7a('0x33')](db[_0x4b7a('0x2d')][_0x4b7a('0x2e')]);_0x3421c6['query']=_[_0x4b7a('0x33')](_0x4c167e[_0x4b7a('0x34')]);_0x3421c6['filters']=_[_0x4b7a('0x36')](_0x3421c6[_0x4b7a('0x32')],_0x3421c6[_0x4b7a('0x34')]);_0x4b28e2['attributes']=_[_0x4b7a('0x36')](_0x3421c6['model'],qs[_0x4b7a('0x37')](_0x4c167e[_0x4b7a('0x34')][_0x4b7a('0x37')]));_0x4b28e2[_0x4b7a('0x38')]=_0x4b28e2['attributes'][_0x4b7a('0x39')]?_0x4b28e2[_0x4b7a('0x38')]:_0x3421c6[_0x4b7a('0x32')];if(_0x4c167e['query'][_0x4b7a('0x47')]){_0x4b28e2[_0x4b7a('0x41')]=[{'all':!![]}];}_0x4b28e2=_['merge']({},_0x4b28e2,_0x4c167e[_0x4b7a('0x48')]);return db[_0x4b7a('0x2d')][_0x4b7a('0x49')](_0x4b28e2)[_0x4b7a('0x14')](handleEntityNotFound(_0x49bb62,null))[_0x4b7a('0x14')](respondWithResult(_0x49bb62,null))[_0x4b7a('0x44')](handleError(_0x49bb62,null));};exports[_0x4b7a('0x25')]=function(_0x31f9fe,_0xb6c8f6){if(_0x31f9fe['body']['id']){delete _0x31f9fe[_0x4b7a('0x4a')]['id'];}return db[_0x4b7a('0x2d')][_0x4b7a('0x49')]({'where':{'id':_0x31f9fe[_0x4b7a('0x46')]['id']}})[_0x4b7a('0x14')](handleEntityNotFound(_0xb6c8f6,null))[_0x4b7a('0x14')](saveUpdates(_0x31f9fe[_0x4b7a('0x4a')],null))[_0x4b7a('0x14')](respondWithResult(_0xb6c8f6,null))[_0x4b7a('0x44')](handleError(_0xb6c8f6,null));};exports[_0x4b7a('0x26')]=function(_0x3ec25b,_0x5e0ff4){return db[_0x4b7a('0x2d')][_0x4b7a('0x49')]({'where':{'id':_0x3ec25b['params']['id']}})[_0x4b7a('0x14')](handleEntityNotFound(_0x5e0ff4,null))[_0x4b7a('0x14')](removeEntity(_0x5e0ff4,null))[_0x4b7a('0x44')](handleError(_0x5e0ff4,null));};exports[_0x4b7a('0x4b')]=function(_0x6d429,_0x1473a2){return db['MailMessage'][_0x4b7a('0x4b')]()[_0x4b7a('0x14')](respondWithResult(_0x1473a2,null))[_0x4b7a('0x44')](handleError(_0x1473a2,null));};exports[_0x4b7a('0x4c')]=function(_0x353d25,_0x1f9a61){return db[_0x4b7a('0x2d')][_0x4b7a('0x4c')](_0x353d25[_0x4b7a('0x4a')])['then'](function(_0x2e5e0b){if(_0x2e5e0b){if(_0x2e5e0b[_0x4b7a('0x4d')]===_0x4b7a('0x4e')&&!_0x2e5e0b[_0x4b7a('0x4f')]){var _0x534a43,_0x1d8224,_0x16fbc6;if(_0x353d25[_0x4b7a('0x4a')]['to']){_0x1d8224=_0x353d25[_0x4b7a('0x4a')]['to'][_0x4b7a('0x50')](',')[0x0];}return db[_0x4b7a('0x51')][_0x4b7a('0x52')]({'where':{'id':_0x2e5e0b['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4b7a('0x53')],'as':_0x4b7a('0x54'),'where':{'email':_0x1d8224},'limit':0x1,'order':[[_0x4b7a('0x55'),_0x4b7a('0x56')]]}]},{'model':db[_0x4b7a('0x57')],'as':_0x4b7a('0x58'),'raw':!![],'include':[{'model':db[_0x4b7a('0x59')],'as':'CloudProvider','raw':!![]}]}]})[_0x4b7a('0x14')](function(_0x2c7e6c){_0x534a43=_0x2c7e6c;if(!_0x534a43||!_0x534a43[_0x4b7a('0x58')])return;var _0x3ae438=_0x534a43['getSmtpOptions']();if(_0x353d25[_0x4b7a('0x4a')]['attachments']&&_0x353d25[_0x4b7a('0x4a')][_0x4b7a('0x5a')][_0x4b7a('0x39')]){for(var _0x3c14a3=0x0;_0x3c14a3<_0x353d25[_0x4b7a('0x4a')][_0x4b7a('0x5a')]['length'];_0x3c14a3+=0x1){_0x353d25[_0x4b7a('0x4a')]['attachments'][_0x3c14a3]={'filename':_0x353d25[_0x4b7a('0x4a')][_0x4b7a('0x5a')][_0x3c14a3][_0x4b7a('0x2a')],'path':path['join'](config[_0x4b7a('0x5b')],'server/files/attachments',_0x353d25['body'][_0x4b7a('0x5a')][_0x3c14a3][_0x4b7a('0x5c')])};}}_0x16fbc6={'account':_0x3ae438,'message':_0x353d25[_0x4b7a('0x4a')]};return;})[_0x4b7a('0x14')](function(){if(_0x534a43[_0x4b7a('0x5d')]){if(_0x534a43[_0x4b7a('0x5d')][_0x4b7a('0x54')][_0x4b7a('0x39')]){return _0x534a43[_0x4b7a('0x5d')]['Contacts'][0x0];}else{return db[_0x4b7a('0x53')][_0x4b7a('0x4c')](_['defaults'](_0x353d25[_0x4b7a('0x4a')],{'firstName':_0x353d25[_0x4b7a('0x4a')]['to'],'email':_0x353d25[_0x4b7a('0x4a')]['to'],'phone':_0x353d25[_0x4b7a('0x4a')]['to'],'ListId':_0x534a43[_0x4b7a('0x5e')]}));}}else{throw new Error(_0x4b7a('0x5f'));}})[_0x4b7a('0x14')](function(){if(_0x16fbc6){return respondWithRpcPromise('SendMail',_0x4b7a('0x60'),_0x16fbc6,client9003)[_0x4b7a('0x14')](function(_0x1da51c){return _0x2e5e0b[_0x4b7a('0x25')]({'read':!![],'messageId':_0x1da51c[_0x4b7a('0x61')],'sentAt':moment()[_0x4b7a('0x62')](_0x4b7a('0x63'))});})['catch'](function(_0x1a5728){logger[_0x4b7a('0x19')]('%s',JSON['stringify'](_0x1a5728));return _0x2e5e0b;});}return _0x2e5e0b;});}return _0x2e5e0b;}})[_0x4b7a('0x14')](respondWithResult(_0x1f9a61,0xc9))[_0x4b7a('0x44')](handleError(_0x1f9a61,null));};exports[_0x4b7a('0x64')]=function(_0x324d51,_0x4fdebb){var _0x25b73b={'agent':{},'channel':'mail'};if(_0x324d51['body']['id']){delete _0x324d51['body']['id'];}_0x324d51[_0x4b7a('0x4a')][_0x4b7a('0x65')]=!![];_0x324d51[_0x4b7a('0x4a')][_0x4b7a('0x66')]=moment()[_0x4b7a('0x62')](_0x4b7a('0x63'));_0x324d51[_0x4b7a('0x4a')]['UserId']=_0x324d51['body'][_0x4b7a('0x67')]||_0x324d51[_0x4b7a('0x68')]['id'];_0x25b73b[_0x4b7a('0x69')]['id']=_0x324d51['body'][_0x4b7a('0x67')];return db[_0x4b7a('0x2d')]['find']({'where':{'id':_0x324d51[_0x4b7a('0x46')]['id'],'UserId':null}})[_0x4b7a('0x14')](handleEntityNotFound(_0x4fdebb,null))[_0x4b7a('0x14')](saveUpdates(_0x324d51['body'],null))[_0x4b7a('0x14')](function(_0xbba0dd){if(_0xbba0dd){_0x25b73b[_0x4b7a('0x1a')]=_0xbba0dd['get']({'plain':!![]});return db[_0x4b7a('0x6a')][_0x4b7a('0x49')]({'where':{'id':_0xbba0dd[_0x4b7a('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x4fdebb,null))[_0x4b7a('0x14')](function(_0x567efe){if(_0x567efe){return _0x567efe['update']({'UserId':_0x324d51[_0x4b7a('0x4a')][_0x4b7a('0x67')],'read1stAt':_[_0x4b7a('0x6c')](_0x567efe[_0x4b7a('0x6d')])?moment()[_0x4b7a('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4b7a('0x14')](function(_0x5f56f3){if(_0x5f56f3){_0x25b73b[_0x4b7a('0x6e')]=_0x5f56f3[_0x4b7a('0x6f')]({'plain':!![]});interaction_log['info'](_0x4b7a('0x70'),_0x324d51[_0x4b7a('0x68')]['id'],_0x324d51[_0x4b7a('0x68')][_0x4b7a('0x2a')],_0x324d51[_0x4b7a('0x68')]['role'],_0x25b73b[_0x4b7a('0x6e')]['id'],_0x324d51[_0x4b7a('0x4a')]?JSON[_0x4b7a('0x71')](_0x324d51[_0x4b7a('0x4a')]):'null');return respondWithRpcPromise(_0x4b7a('0x72'),_0x4b7a('0x73'),_0x25b73b);}return null;})[_0x4b7a('0x14')](function(_0x3c3535){var _0x3c0a7a=_0x4b7a('0x74')+_0x3c3535[_0x4b7a('0x1a')][_0x4b7a('0x75')];return db[_0x4b7a('0x76')]['query'](_0x3c0a7a,{'type':db[_0x4b7a('0x77')]['QueryTypes'][_0x4b7a('0x78')],'raw':!![]})[_0x4b7a('0x14')](function(_0xf1504){return _0xf1504;});})[_0x4b7a('0x14')](function(_0x5a88ed){if(_0x5a88ed){_0x25b73b['message'][_0x4b7a('0x79')]=_0x5a88ed[0x0];if(!_0x324d51[_0x4b7a('0x4a')][_0x4b7a('0x67')])return;return db[_0x4b7a('0x7a')][_0x4b7a('0x49')]({'where':{'id':_0x324d51[_0x4b7a('0x4a')][_0x4b7a('0x67')],'role':_0x4b7a('0x69')},'attributes':['id',_0x4b7a('0x2a'),_0x4b7a('0x7b'),_0x4b7a('0x7c'),_0x4b7a('0x7d')],'raw':!![]});}return null;})[_0x4b7a('0x14')](function(_0x130029){if(!_0x130029)return null;_0x25b73b['message'][_0x4b7a('0x69')]=_0x130029;return _0x25b73b;})['then'](function(_0x30903f){if(_0x30903f){if(_0x324d51[_0x4b7a('0x4a')]['manual']){_0x25b73b[_0x4b7a('0x1a')][_0x4b7a('0x7e')]=util[_0x4b7a('0x62')]('SIP/%s',_0x324d51[_0x4b7a('0x68')][_0x4b7a('0x2a')]);_0x25b73b[_0x4b7a('0x1a')][_0x4b7a('0x7f')]=_0x25b73b[_0x4b7a('0x7f')];_0x25b73b[_0x4b7a('0x1a')][_0x4b7a('0x80')]=_0x25b73b[_0x4b7a('0x7f')];_0x25b73b[_0x4b7a('0x1a')][_0x4b7a('0x81')]=_0x4b7a('0x64');_0x25b73b[_0x4b7a('0x1a')][_0x4b7a('0x4a')]=htmlToText[_0x4b7a('0x82')](_0x25b73b['message']['body']);return respondWithRpcPromise('EventManager',_0x4b7a('0x83'),{'event':_0x4b7a('0x84'),'message':_0x25b73b['message']},client9002)['then'](function(){return _0x25b73b;});}return _0x25b73b;}return null;})['then'](respondWithResult(_0x4fdebb,null))[_0x4b7a('0x44')](handleError(_0x4fdebb,null));};exports['reject']=function(_0x29e0a0,_0x16679d){var _0x407713={'agent':{},'channel':'mail'};if(_0x29e0a0[_0x4b7a('0x4a')]['id']){delete _0x29e0a0[_0x4b7a('0x4a')]['id'];}_0x29e0a0[_0x4b7a('0x4a')][_0x4b7a('0x67')]=_0x29e0a0[_0x4b7a('0x4a')][_0x4b7a('0x67')]||_0x29e0a0[_0x4b7a('0x68')]['id'];_0x407713['agent']['id']=_0x29e0a0[_0x4b7a('0x4a')][_0x4b7a('0x67')];return db['MailMessage'][_0x4b7a('0x49')]({'where':{'id':_0x29e0a0['params']['id'],'UserId':null}})[_0x4b7a('0x14')](handleEntityNotFound(_0x16679d,null))[_0x4b7a('0x14')](function(_0x4f662b){if(_0x4f662b){_0x407713[_0x4b7a('0x1a')]=_0x4f662b[_0x4b7a('0x6f')]({'plain':!![]});return db[_0x4b7a('0x6a')][_0x4b7a('0x49')]({'where':{'id':_0x4f662b[_0x4b7a('0x6b')]}});}return null;})[_0x4b7a('0x14')](handleEntityNotFound(_0x16679d,null))[_0x4b7a('0x14')](function(_0x3aabe6){if(_0x3aabe6){_0x407713[_0x4b7a('0x6e')]=_0x3aabe6[_0x4b7a('0x6f')]({'plain':!![]});interaction_log[_0x4b7a('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x29e0a0[_0x4b7a('0x68')]['id'],_0x29e0a0[_0x4b7a('0x68')][_0x4b7a('0x2a')],_0x29e0a0[_0x4b7a('0x68')][_0x4b7a('0x85')],_0x407713['interaction']['id'],_0x29e0a0['body']?JSON[_0x4b7a('0x71')](_0x29e0a0[_0x4b7a('0x4a')]):_0x4b7a('0x86'));return respondWithRpcPromise(_0x4b7a('0x87'),_0x4b7a('0x88'),_0x407713);}return null;})[_0x4b7a('0x14')](function(_0x16fc0f){var _0x5714f2=_0x4b7a('0x74')+_0x16fc0f[_0x4b7a('0x1a')][_0x4b7a('0x75')];return db[_0x4b7a('0x76')][_0x4b7a('0x34')](_0x5714f2,{'type':db['Sequelize'][_0x4b7a('0x89')][_0x4b7a('0x78')],'raw':!![]})[_0x4b7a('0x14')](function(_0x45f0ae){return _0x45f0ae;});})[_0x4b7a('0x14')](function(_0x20c52c){if(_0x20c52c){_0x407713['message'][_0x4b7a('0x79')]=_0x20c52c[0x0];if(!_0x29e0a0[_0x4b7a('0x4a')]['UserId'])return;return db[_0x4b7a('0x7a')][_0x4b7a('0x49')]({'where':{'id':_0x29e0a0[_0x4b7a('0x4a')][_0x4b7a('0x67')],'role':_0x4b7a('0x69')},'attributes':['id',_0x4b7a('0x2a'),'fullname','email',_0x4b7a('0x7d')],'raw':!![]});}return null;})[_0x4b7a('0x14')](function(_0x1d4fc5){if(!_0x1d4fc5)return null;_0x407713['message'][_0x4b7a('0x69')]=_0x1d4fc5;return _0x407713;})['then'](function(_0x4b078a){if(_0x4b078a){_0x4b078a[_0x4b7a('0x1a')][_0x4b7a('0x7e')]=util[_0x4b7a('0x62')]('SIP/%s',_0x29e0a0['user'][_0x4b7a('0x2a')]);_0x4b078a[_0x4b7a('0x1a')][_0x4b7a('0x7f')]=_0x407713['channel'];_0x4b078a['message'][_0x4b7a('0x80')]=_0x407713[_0x4b7a('0x7f')];_0x4b078a[_0x4b7a('0x1a')][_0x4b7a('0x81')]=_0x4b7a('0x8a');_0x4b078a['message'][_0x4b7a('0x4a')]=htmlToText[_0x4b7a('0x82')](_0x407713[_0x4b7a('0x1a')][_0x4b7a('0x4a')]);respondWithRpcPromise(_0x4b7a('0x83'),'EventManager',{'event':_0x4b7a('0x8b'),'message':_0x4b078a[_0x4b7a('0x1a')]},client9002);return _0x407713;}return null;})[_0x4b7a('0x14')](respondWithResult(_0x16679d,null))[_0x4b7a('0x44')](handleError(_0x16679d,null));};exports[_0x4b7a('0x8c')]=function(_0x5bee55,_0xd609ce){var _0x5dc670=moment()[_0x4b7a('0x8d')]()[_0x4b7a('0x8e')]();var _0x1c6e92=path['join'](config['root'],_0x4b7a('0x8f'),'files','tmp');var _0x29fa4b=path[_0x4b7a('0x90')](config[_0x4b7a('0x5b')],'server',_0x4b7a('0x91'),_0x4b7a('0x5a'));var _0x656be3=util[_0x4b7a('0x62')]('message-%s.eml',_0x5dc670);return db['MailMessage'][_0x4b7a('0x49')]({'where':{'id':_0x5bee55[_0x4b7a('0x46')]['id']},'attributes':['id',_0x4b7a('0x4a'),_0x4b7a('0x92'),'to','cc',_0x4b7a('0x93'),_0x4b7a('0x94'),_0x4b7a('0x95')],'include':_0x5bee55[_0x4b7a('0x34')][_0x4b7a('0x5a')]?[{'model':db['Attachment'],'as':_0x4b7a('0x96')}]:undefined})['then'](handleEntityNotFound(_0xd609ce,null))[_0x4b7a('0x14')](function(_0xd4f178){if(_0xd4f178){var _0x25c4bc=_0xd4f178;var _0x2dce0d={'from':_0x25c4bc[_0x4b7a('0x92')],'to':_0x25c4bc['to'],'subject':_0x25c4bc[_0x4b7a('0x94')],'html':htmlEntities[_0x4b7a('0x97')](_0x25c4bc[_0x4b7a('0x4a')]),'headers':{'Date':moment(_0x25c4bc[_0x4b7a('0x95')])[_0x4b7a('0x62')](_0x4b7a('0x98'))},'attachments':[]};if(_0xd4f178['cc']){_0x2dce0d[_0x4b7a('0x99')]['Cc']=_0xd4f178['cc'];}if(_0xd4f178[_0x4b7a('0x93')]){_0x2dce0d[_0x4b7a('0x99')][_0x4b7a('0x9a')]=_0xd4f178[_0x4b7a('0x93')];}return new BPromise(function(_0x45a0af,_0x4d8d4d){if(_0xd4f178[_0x4b7a('0x96')]){for(var _0xead8c7=0x0;_0xead8c7<_0xd4f178[_0x4b7a('0x96')]['length'];_0xead8c7++){var _0xd7f9a7=_0xd4f178[_0x4b7a('0x96')][_0xead8c7];var _0x4ff959=path[_0x4b7a('0x90')](_0x29fa4b,_0xd7f9a7[_0x4b7a('0x5c')]);if(fs[_0x4b7a('0x9b')](_0x4ff959)){_0x2dce0d[_0x4b7a('0x5a')][_0x4b7a('0x9c')]({'name':_0xd7f9a7[_0x4b7a('0x2a')],'contentType':_0xd7f9a7[_0x4b7a('0x30')],'data':fs['readFileSync'](_0x4ff959)});}}}emlformat[_0x4b7a('0x9d')](_0x2dce0d,function(_0x1b2a40,_0x59e757){if(_0x1b2a40)return _0x4d8d4d(_0x1b2a40);fs[_0x4b7a('0x9e')](path[_0x4b7a('0x90')](_0x1c6e92,_0x656be3),_0x59e757);return _0x45a0af(_0x59e757);});});}})['then'](function(_0x23e973){if(_0x23e973){return _0xd609ce['download'](path[_0x4b7a('0x90')](_0x1c6e92,_0x656be3),_0x656be3,function(_0x35540f){if(!_0x35540f)fs[_0x4b7a('0x9f')](path['join'](_0x1c6e92,_0x656be3));});}})[_0x4b7a('0x44')](handleError(_0xd609ce,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 761b8bb..25744cc 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 _0x9199=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9199,0x7f));var _0x9919=function(_0x5a8315,_0x9ef47d){_0x5a8315=_0x5a8315-0x0;var _0x5cc037=_0x9199[_0x5a8315];return _0x5cc037;};'use strict';var EventEmitter=require(_0x9919('0x0'));var MailMessage=require(_0x9919('0x1'))['db'][_0x9919('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9919('0x3')](0x0);var events={'afterCreate':_0x9919('0x4'),'afterUpdate':_0x9919('0x5'),'afterDestroy':_0x9919('0x6')};function emitEvent(_0x5147e1){return function(_0x3a3a07,_0x238db1,_0x481322){MailMessageEvents['emit'](_0x5147e1+':'+_0x3a3a07['id'],_0x3a3a07);MailMessageEvents['emit'](_0x5147e1,_0x3a3a07);_0x481322(null);};}for(var e in events){if(events[_0x9919('0x7')](e)){var event=events[e];MailMessage[_0x9919('0x8')](e,emitEvent(event));}}module[_0x9919('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xec72=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','save'];(function(_0x84a238,_0x462910){var _0x22bee0=function(_0x26195b){while(--_0x26195b){_0x84a238['push'](_0x84a238['shift']());}};_0x22bee0(++_0x462910);}(_0xec72,0xd7));var _0x2ec7=function(_0x47181a,_0x59e13b){_0x47181a=_0x47181a-0x0;var _0x4fdc45=_0xec72[_0x47181a];return _0x4fdc45;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x2ec7('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2ec7('0x1'),'afterUpdate':_0x2ec7('0x2'),'afterDestroy':_0x2ec7('0x3')};function emitEvent(_0x8ef466){return function(_0x40489f,_0xaec10b,_0xab1e8d){MailMessageEvents[_0x2ec7('0x4')](_0x8ef466+':'+_0x40489f['id'],_0x40489f);MailMessageEvents[_0x2ec7('0x4')](_0x8ef466,_0x40489f);_0xab1e8d(null);};}for(var e in events){if(events[_0x2ec7('0x5')](e)){var event=events[e];MailMessage[_0x2ec7('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 47aeb5c..3049a45 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 _0x1fc5=['html-to-text','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x552b03,_0x48e023){var _0x14ab19=function(_0x58fb5e){while(--_0x58fb5e){_0x552b03['push'](_0x552b03['shift']());}};_0x14ab19(++_0x48e023);}(_0x1fc5,0x144));var _0x51fc=function(_0x446761,_0x267e15){_0x446761=_0x446761-0x0;var _0x380aba=_0x1fc5[_0x446761];return _0x380aba;};'use strict';var _=require(_0x51fc('0x0'));var util=require(_0x51fc('0x1'));var logger=require(_0x51fc('0x2'))('api');var moment=require(_0x51fc('0x3'));var BPromise=require(_0x51fc('0x4'));var rp=require(_0x51fc('0x5'));var htmlToText=require(_0x51fc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x51fc('0x7'));var attributes=require(_0x51fc('0x8'));module[_0x51fc('0x9')]=function(_0x23e9a9,_0x13f76e){return _0x23e9a9['define']('MailMessage',attributes,{'tableName':_0x51fc('0xa'),'paranoid':![],'indexes':[{'name':_0x51fc('0xb'),'fields':[_0x51fc('0xb')]},{'name':_0x51fc('0xc'),'fields':[_0x51fc('0xd'),_0x51fc('0xe')],'type':_0x51fc('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x51db39,_0x11a825,_0x2add36){if(_0x51db39[_0x51fc('0x10')]){_0x51db39['plainBody']=htmlToText['fromString'](_0x51db39[_0x51fc('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2add36(null,_0x11a825);},'afterCreate':function(_0x122849,_0x314268,_0x2f701c){var _0x48c10b=_0x23e9a9[_0x51fc('0x11')];var _0x3f0a2d=_0x122849[_0x51fc('0x12')]({'plain':!![]});if(_0x3f0a2d[_0x51fc('0x13')][_0x51fc('0x14')]()==='in'||_0x3f0a2d[_0x51fc('0x13')][_0x51fc('0x14')]()===_0x51fc('0x15')&&!_0x3f0a2d[_0x51fc('0x16')]&&!_[_0x51fc('0x17')](_0x3f0a2d[_0x51fc('0x18')])){_0x48c10b[_0x51fc('0x19')][_0x51fc('0x1a')]({'where':{'id':_0x3f0a2d[_0x51fc('0x1b')]}})[_0x51fc('0x1c')](function(_0x86cd){if(_0x86cd){_0x86cd[_0x51fc('0x1d')]({'lastMsgAt':_0x3f0a2d[_0x51fc('0x1e')],'lastMsgDirection':_0x3f0a2d['direction'][_0x51fc('0x14')]()});}})['catch'](function(_0x33296c){console[_0x51fc('0x1f')](_0x33296c);});}_0x2f701c();}},'charset':'utf8mb4','collate':_0x51fc('0x20')});}; \ No newline at end of file +var _0x2e23=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','plainBody','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x2e23,0x1b3));var _0x32e2=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x2e23[_0x411add];return _0x238242;};'use strict';var _=require(_0x32e2('0x0'));var util=require('util');var logger=require(_0x32e2('0x1'))(_0x32e2('0x2'));var moment=require(_0x32e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x32e2('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x32e2('0x5'));var config=require(_0x32e2('0x6'));var attributes=require('./mailMessage.attributes');module[_0x32e2('0x7')]=function(_0x520338,_0x1259e3){return _0x520338[_0x32e2('0x8')](_0x32e2('0x9'),attributes,{'tableName':_0x32e2('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x32e2('0xb'),'subject'],'type':_0x32e2('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1eb72f,_0x3358db,_0x1311ca){if(_0x1eb72f[_0x32e2('0xd')]){_0x1eb72f[_0x32e2('0xb')]=htmlToText['fromString'](_0x1eb72f[_0x32e2('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1311ca(null,_0x3358db);},'afterCreate':function(_0xbd8144,_0x9267aa,_0x295244){var _0x273ee5=_0x520338[_0x32e2('0xe')];var _0x1619de=_0xbd8144[_0x32e2('0xf')]({'plain':!![]});if(_0x1619de[_0x32e2('0x10')]['toLowerCase']()==='in'||_0x1619de[_0x32e2('0x10')][_0x32e2('0x11')]()===_0x32e2('0x12')&&!_0x1619de[_0x32e2('0x13')]&&!_[_0x32e2('0x14')](_0x1619de[_0x32e2('0x15')])){_0x273ee5['MailInteraction'][_0x32e2('0x16')]({'where':{'id':_0x1619de[_0x32e2('0x17')]}})[_0x32e2('0x18')](function(_0x20888a){if(_0x20888a){_0x20888a[_0x32e2('0x19')]({'lastMsgAt':_0x1619de[_0x32e2('0x1a')],'lastMsgDirection':_0x1619de[_0x32e2('0x10')]['toLowerCase']()});}})[_0x32e2('0x1b')](function(_0x5bae8c){console[_0x32e2('0x1c')](_0x5bae8c);});}_0x295244();}},'charset':_0x32e2('0x1d'),'collate':_0x32e2('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e4f15c9..db877b1 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 _0xbaf0=['request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x4ae89d,_0x2d5da1){var _0xd3a1a0=function(_0x1fb178){while(--_0x1fb178){_0x4ae89d['push'](_0x4ae89d['shift']());}};_0xd3a1a0(++_0x2d5da1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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});config[_0x0baf('0xc')]=_[_0x0baf('0xd')](config[_0x0baf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0xe'))(new Redis(config['redis']));require(_0x0baf('0xf'))[_0x0baf('0x10')](socket);function respondWithRpcPromise(_0x465528,_0x2f46e8,_0x7f54d4){return new BPromise(function(_0xf4c8ac,_0x41cead){return client[_0x0baf('0x11')](_0x465528,_0x7f54d4)[_0x0baf('0x12')](function(_0x1d60a2){logger[_0x0baf('0x13')]('MailMessage,\x20%s,\x20%s',_0x2f46e8,'request\x20sent');logger[_0x0baf('0x14')](_0x0baf('0x15'),_0x2f46e8,_0x0baf('0x16'),JSON[_0x0baf('0x17')](_0x1d60a2));if(_0x1d60a2['error']){if(_0x1d60a2[_0x0baf('0x18')]['code']===0x1f4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0x41cead(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0xf4c8ac(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}else{logger[_0x0baf('0x13')](_0x0baf('0x19'),_0x2f46e8,'request\x20sent');_0xf4c8ac(_0x1d60a2[_0x0baf('0x1b')][_0x0baf('0x1a')]);}})[_0x0baf('0x1c')](function(_0x3e9cb4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x3e9cb4);_0x41cead(_0x3e9cb4);});});}exports['CreateMailMessage']=function(_0x5cff5d){var _0x1410ec=this;return new Promise(function(_0x154f48,_0x32e839){return db[_0x0baf('0x1d')][_0x0baf('0x1e')](_0x5cff5d[_0x0baf('0x1f')],{'raw':_0x5cff5d[_0x0baf('0x20')]?_0x5cff5d[_0x0baf('0x20')][_0x0baf('0x21')]===undefined?!![]:![]:!![]})[_0x0baf('0x12')](function(_0x54f2fa){logger[_0x0baf('0x13')]('CreateMailMessage',_0x5cff5d);logger[_0x0baf('0x14')]('CreateMailMessage',_0x5cff5d,JSON['stringify'](_0x54f2fa));_0x154f48(_0x54f2fa);})[_0x0baf('0x1c')](function(_0x48a0e9){logger['error'](_0x0baf('0x22'),_0x48a0e9[_0x0baf('0x1a')],_0x5cff5d);_0x32e839(_0x1410ec[_0x0baf('0x18')](0x1f4,_0x48a0e9[_0x0baf('0x1a')]));});});}; \ No newline at end of file +var _0xb9be=['redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0xb9be,0xc5));var _0xeb9b=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xb9be[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});config['redis']=_[_0xeb9b('0xc')](config[_0xeb9b('0xd')],{'host':_0xeb9b('0xe'),'port':0x18eb});var socket=require(_0xeb9b('0xf'))(new Redis(config[_0xeb9b('0xd')]));require(_0xeb9b('0x10'))[_0xeb9b('0x11')](socket);function respondWithRpcPromise(_0x16761a,_0x32f0c4,_0x4f4952){return new BPromise(function(_0x20c855,_0x58d6a4){return client['request'](_0x16761a,_0x4f4952)[_0xeb9b('0x12')](function(_0x4236c0){logger['info'](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));logger[_0xeb9b('0x15')](_0xeb9b('0x16'),_0x32f0c4,'request\x20sent',JSON['stringify'](_0x4236c0));if(_0x4236c0['error']){if(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x18')]===0x1f4){logger[_0xeb9b('0x17')]('MailMessage,\x20%s,\x20%s',_0x32f0c4,_0x4236c0['error']['message']);return _0x58d6a4(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);}logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);return _0x20c855(_0x4236c0[_0xeb9b('0x17')]['message']);}else{logger[_0xeb9b('0x1a')](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));_0x20c855(_0x4236c0[_0xeb9b('0x1b')][_0xeb9b('0x19')]);}})[_0xeb9b('0x1c')](function(_0x21010e){logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x21010e);_0x58d6a4(_0x21010e);});});}exports[_0xeb9b('0x1d')]=function(_0x4f436e){var _0x43dc48=this;return new Promise(function(_0x5a7ffd,_0x5d5f54){return db[_0xeb9b('0x1e')][_0xeb9b('0x1f')](_0x4f436e['body'],{'raw':_0x4f436e[_0xeb9b('0x20')]?_0x4f436e[_0xeb9b('0x20')][_0xeb9b('0x21')]===undefined?!![]:![]:!![]})[_0xeb9b('0x12')](function(_0x3c8be7){logger[_0xeb9b('0x1a')](_0xeb9b('0x1d'),_0x4f436e);logger[_0xeb9b('0x15')](_0xeb9b('0x1d'),_0x4f436e,JSON[_0xeb9b('0x22')](_0x3c8be7));_0x5a7ffd(_0x3c8be7);})[_0xeb9b('0x1c')](function(_0x296f95){logger[_0xeb9b('0x17')](_0xeb9b('0x1d'),_0x296f95[_0xeb9b('0x19')],_0x4f436e);_0x5d5f54(_0x43dc48[_0xeb9b('0x17')](0x1f4,_0x296f95['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 457714c..1134483 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 _0x7b40=['remove','update','emit','removeListener','mailMessage:','./mailMessage.events','save'];(function(_0x15a732,_0x127338){var _0x3c8fdc=function(_0x62ae30){while(--_0x62ae30){_0x15a732['push'](_0x15a732['shift']());}};_0x3c8fdc(++_0x127338);}(_0x7b40,0x7c));var _0x07b4=function(_0x8c44aa,_0x2737d6){_0x8c44aa=_0x8c44aa-0x0;var _0x2a67d3=_0x7b40[_0x8c44aa];return _0x2a67d3;};'use strict';var MailMessageEvents=require(_0x07b4('0x0'));var events=[_0x07b4('0x1'),_0x07b4('0x2'),_0x07b4('0x3')];function createListener(_0x708cb5,_0x126dd2){return function(_0x3e3575){_0x126dd2[_0x07b4('0x4')](_0x708cb5,_0x3e3575);};}function removeListener(_0x396501,_0x4ab696){return function(){MailMessageEvents[_0x07b4('0x5')](_0x396501,_0x4ab696);};}exports['register']=function(_0x2e7f47){for(var _0xd45f4d=0x0,_0x415c99=events['length'];_0xd45f4d<_0x415c99;_0xd45f4d++){var _0x1351ab=events[_0xd45f4d];var _0x251677=createListener(_0x07b4('0x6')+_0x1351ab,_0x2e7f47);MailMessageEvents['on'](_0x1351ab,_0x251677);}}; \ No newline at end of file +var _0x5b56=['remove','update','emit','removeListener','./mailMessage.events','save'];(function(_0xb415fc,_0x5f4555){var _0x5d05ba=function(_0xab932e){while(--_0xab932e){_0xb415fc['push'](_0xb415fc['shift']());}};_0x5d05ba(++_0x5f4555);}(_0x5b56,0x9a));var _0x65b5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5b56[_0x2c91e9];return _0x13f0ff;};'use strict';var MailMessageEvents=require(_0x65b5('0x0'));var events=[_0x65b5('0x1'),_0x65b5('0x2'),_0x65b5('0x3')];function createListener(_0x5e8635,_0x225b26){return function(_0x100711){_0x225b26[_0x65b5('0x4')](_0x5e8635,_0x100711);};}function removeListener(_0x1cf1dc,_0x4eebee){return function(){MailMessageEvents[_0x65b5('0x5')](_0x1cf1dc,_0x4eebee);};}exports['register']=function(_0x274ed5){for(var _0x4560fb=0x0,_0x5d3621=events['length'];_0x4560fb<_0x5d3621;_0x4560fb++){var _0x2dcf47=events[_0x4560fb];var _0x11fdec=createListener('mailMessage:'+_0x2dcf47,_0x274ed5);MailMessageEvents['on'](_0x2dcf47,_0x11fdec);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0ef87e7..336093f 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 _0x8696=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeAgents'];(function(_0x24b46e,_0x294281){var _0x5a8e1c=function(_0x3c610c){while(--_0x3c610c){_0x24b46e['push'](_0x24b46e['shift']());}};_0x5a8e1c(++_0x294281);}(_0x8696,0x187));var _0x6869=function(_0x14389d,_0x18ca71){_0x14389d=_0x14389d-0x0;var _0x3d60e7=_0x8696[_0x14389d];return _0x3d60e7;};'use strict';var multer=require(_0x6869('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6869('0x1'));var express=require(_0x6869('0x2'));var router=express[_0x6869('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6869('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6869('0x5'));var controller=require(_0x6869('0x6'));router[_0x6869('0x7')]('/',auth[_0x6869('0x8')](),controller[_0x6869('0x9')]);router[_0x6869('0x7')]('/describe',auth[_0x6869('0x8')](),controller[_0x6869('0xa')]);router['get'](_0x6869('0xb'),auth[_0x6869('0x8')](),controller['show']);router[_0x6869('0x7')](_0x6869('0xc'),auth['isAuthenticated'](),controller[_0x6869('0xd')]);router[_0x6869('0x7')](_0x6869('0xe'),auth[_0x6869('0x8')](),controller[_0x6869('0xf')]);router[_0x6869('0x7')](_0x6869('0x10'),auth['isAuthenticated'](),controller[_0x6869('0x11')]);router[_0x6869('0x12')]('/',auth[_0x6869('0x8')](),controller[_0x6869('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x6869('0x14')]);router[_0x6869('0x12')](_0x6869('0x10'),auth[_0x6869('0x8')](),controller[_0x6869('0x15')]);router['put'](_0x6869('0xb'),auth['isAuthenticated'](),controller[_0x6869('0x16')]);router[_0x6869('0x17')](_0x6869('0xb'),auth[_0x6869('0x8')](),controller['destroy']);router[_0x6869('0x17')]('/:id/teams',auth[_0x6869('0x8')](),controller['removeTeams']);router[_0x6869('0x17')]('/:id/users',auth[_0x6869('0x8')](),controller[_0x6869('0x18')]);module[_0x6869('0x19')]=router; \ No newline at end of file +var _0x9d36=['index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x5edf0b,_0x7c0738){var _0x1e1da9=function(_0x170bc7){while(--_0x170bc7){_0x5edf0b['push'](_0x5edf0b['shift']());}};_0x1e1da9(++_0x7c0738);}(_0x9d36,0xa4));var _0x69d3=function(_0x53648e,_0x591e8d){_0x53648e=_0x53648e-0x0;var _0x5a747e=_0x9d36[_0x53648e];return _0x5a747e;};'use strict';var multer=require(_0x69d3('0x0'));var util=require('util');var path=require(_0x69d3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x69d3('0x2')]();var fs_extra=require(_0x69d3('0x3'));var auth=require(_0x69d3('0x4'));var interaction=require(_0x69d3('0x5'));var config=require(_0x69d3('0x6'));var controller=require(_0x69d3('0x7'));router[_0x69d3('0x8')]('/',auth[_0x69d3('0x9')](),controller[_0x69d3('0xa')]);router[_0x69d3('0x8')](_0x69d3('0xb'),auth[_0x69d3('0x9')](),controller['describe']);router[_0x69d3('0x8')](_0x69d3('0xc'),auth[_0x69d3('0x9')](),controller[_0x69d3('0xd')]);router[_0x69d3('0x8')]('/:id/members',auth[_0x69d3('0x9')](),controller[_0x69d3('0xe')]);router[_0x69d3('0x8')](_0x69d3('0xf'),auth[_0x69d3('0x9')](),controller[_0x69d3('0x10')]);router[_0x69d3('0x8')](_0x69d3('0x11'),auth[_0x69d3('0x9')](),controller[_0x69d3('0x12')]);router[_0x69d3('0x13')]('/',auth['isAuthenticated'](),controller[_0x69d3('0x14')]);router['post'](_0x69d3('0xf'),auth[_0x69d3('0x9')](),controller['addTeams']);router[_0x69d3('0x13')](_0x69d3('0x11'),auth[_0x69d3('0x9')](),controller[_0x69d3('0x15')]);router[_0x69d3('0x16')]('/:id',auth[_0x69d3('0x9')](),controller[_0x69d3('0x17')]);router[_0x69d3('0x18')]('/:id',auth[_0x69d3('0x9')](),controller[_0x69d3('0x19')]);router[_0x69d3('0x18')](_0x69d3('0xf'),auth[_0x69d3('0x9')](),controller[_0x69d3('0x1a')]);router[_0x69d3('0x18')](_0x69d3('0x11'),auth[_0x69d3('0x9')](),controller[_0x69d3('0x1b')]);module[_0x69d3('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 0f6a8ae..e0104fb 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 _0x0b78=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','name'];(function(_0x322d46,_0x5ebcca){var _0x34f8d9=function(_0x533291){while(--_0x533291){_0x322d46['push'](_0x322d46['shift']());}};_0x34f8d9(++_0x5ebcca);}(_0x0b78,0xd6));var _0x80b7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0b78[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x80b7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x80b7('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x80b7('0x2')]},'timeout':{'type':Sequelize[_0x80b7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x80b7('0x4')](_0x80b7('0x5'),_0x80b7('0x6'),_0x80b7('0x7'))}}; \ No newline at end of file +var _0x9d0c=['rrmemory','beepall','sequelize','exports','INTEGER','ENUM'];(function(_0x2a2693,_0x114b3d){var _0x4e1084=function(_0x2bbd18){while(--_0x2bbd18){_0x2a2693['push'](_0x2a2693['shift']());}};_0x4e1084(++_0x114b3d);}(_0x9d0c,0x19a));var _0xc9d0=function(_0x708c47,_0x6eaa1f){_0x708c47=_0x708c47-0x0;var _0x52a470=_0x9d0c[_0x708c47];return _0x52a470;};'use strict';var Sequelize=require(_0xc9d0('0x0'));module[_0xc9d0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc9d0('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc9d0('0x3')](_0xc9d0('0x4'),_0xc9d0('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1907a9e..835271e 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 _0x2a9d=['getOptions','where','include','query','findAll','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','nolimit','order','MailQueueId','filter','map','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','sort','pick','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','UserMailQueue','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','bluebird','util','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','MailQueues','UserProfileResource','destroy','sendStatus','error','name','send','index','MailQueue','rawAttributes','fieldName','type','key'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0x2a9d,0x147));var _0xd2a9=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x2a9d[_0x35f7f5];return _0x5567a4;};'use strict';var BPromise=require(_0xd2a9('0x0'));var util=require(_0xd2a9('0x1'));var _=require(_0xd2a9('0x2'));var squel=require('squel');var Redis=require(_0xd2a9('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xd2a9('0x4'))(_0xd2a9('0x5'));var config=require(_0xd2a9('0x6'));var db=require(_0xd2a9('0x7'))['db'];config[_0xd2a9('0x8')]=_['defaults'](config[_0xd2a9('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x1126d5,_0x517e7a){_0x517e7a=_0x517e7a||0xcc;return function(_0x4482b0){if(_0x4482b0){return _0x1126d5['sendStatus'](_0x517e7a);}return _0x1126d5[_0xd2a9('0x9')](_0x517e7a)[_0xd2a9('0xa')]();};}function respondWithResult(_0xb301b0,_0x35694d){_0x35694d=_0x35694d||0xc8;return function(_0x577aa4){if(_0x577aa4){return _0xb301b0[_0xd2a9('0x9')](_0x35694d)[_0xd2a9('0xb')](_0x577aa4);}};}function respondWithFilteredResult(_0xe34d71,_0x3a0441){return function(_0x23b7b7){if(_0x23b7b7){var _0x5a813b=typeof _0x3a0441[_0xd2a9('0xc')]===_0xd2a9('0xd')&&typeof _0x3a0441[_0xd2a9('0xe')]===_0xd2a9('0xd');var _0x36bd2c=_0x23b7b7['count'];var _0x57f87a=_0x5a813b?0x0:_0x3a0441['offset'];var _0x5287b6=_0x5a813b?_0x23b7b7[_0xd2a9('0xf')]:_0x3a0441[_0xd2a9('0xc')]+_0x3a0441[_0xd2a9('0xe')];var _0x4e206e;if(_0x5287b6>=_0x36bd2c){_0x5287b6=_0x36bd2c;_0x4e206e=0xc8;}else{_0x4e206e=0xce;}_0xe34d71[_0xd2a9('0x9')](_0x4e206e);return _0xe34d71[_0xd2a9('0x10')](_0xd2a9('0x11'),_0x57f87a+'-'+_0x5287b6+'/'+_0x36bd2c)['json'](_0x23b7b7);}return null;};}function saveUpdates(_0x253f74){return function(_0x511337){if(_0x511337){return _0x511337[_0xd2a9('0x12')](_0x253f74)[_0xd2a9('0x13')](function(_0x1909bb){return _0x1909bb;});}return null;};}function removeEntity(_0x1b886c){return function(_0x28d3dc){if(_0x28d3dc){return _0x28d3dc['destroy']()[_0xd2a9('0x13')](function(){var _0x4766a1=_0x28d3dc['get']({'plain':!![]});var _0x354469=_0xd2a9('0x14');return db[_0xd2a9('0x15')][_0xd2a9('0x16')]({'where':{'type':_0x354469,'resourceId':_0x4766a1['id']}})[_0xd2a9('0x13')](function(){return _0x28d3dc;});})[_0xd2a9('0x13')](function(){_0x1b886c[_0xd2a9('0x9')](0xcc)[_0xd2a9('0xa')]();});}};}function handleEntityNotFound(_0x4ee0da){return function(_0x1c19eb){if(!_0x1c19eb){_0x4ee0da[_0xd2a9('0x17')](0x194);}return _0x1c19eb;};}function handleError(_0xcff9f6,_0x40902b){_0x40902b=_0x40902b||0x1f4;return function(_0x59cbf1){logger[_0xd2a9('0x18')](_0x59cbf1['stack']);if(_0x59cbf1[_0xd2a9('0x19')]){delete _0x59cbf1[_0xd2a9('0x19')];}_0xcff9f6[_0xd2a9('0x9')](_0x40902b)[_0xd2a9('0x1a')](_0x59cbf1);};}exports[_0xd2a9('0x1b')]=function(_0x35453f,_0x1fb23d){var _0x36098e={};var _0x322fa3={'count':0x0,'rows':[]};var _0x5c27d4=_['map'](db[_0xd2a9('0x1c')][_0xd2a9('0x1d')],function(_0x4b7adc){return{'name':_0x4b7adc[_0xd2a9('0x1e')],'type':_0x4b7adc[_0xd2a9('0x1f')][_0xd2a9('0x20')]};});_0x36098e=qs[_0xd2a9('0x21')](_0x5c27d4,_0x35453f);var _0x518031={'where':_0x36098e[_0xd2a9('0x22')]};return db[_0xd2a9('0x1c')][_0xd2a9('0xf')](_0x518031)[_0xd2a9('0x13')](function(_0x105cb2){_0x322fa3[_0xd2a9('0xf')]=_0x105cb2;_0x36098e[_0xd2a9('0x23')]=qs[_0xd2a9('0x23')](_0x35453f[_0xd2a9('0x24')]);return db['MailQueue'][_0xd2a9('0x25')](_0x36098e);})[_0xd2a9('0x13')](function(_0x579a5c){_0x322fa3['rows']=_0x579a5c;return _0x322fa3;})[_0xd2a9('0x13')](respondWithFilteredResult(_0x1fb23d,_0x36098e))[_0xd2a9('0x26')](handleError(_0x1fb23d,null));};exports[_0xd2a9('0x27')]=function(_0x494e73,_0x3fe9ad){var _0xb3a07b={'raw':!![],'where':{'id':_0x494e73[_0xd2a9('0x28')]['id']}},_0x5a9300={};_0x5a9300[_0xd2a9('0x29')]=_[_0xd2a9('0x2a')](db[_0xd2a9('0x1c')][_0xd2a9('0x1d')]);_0x5a9300[_0xd2a9('0x24')]=_[_0xd2a9('0x2a')](_0x494e73['query']);_0x5a9300[_0xd2a9('0x2b')]=_[_0xd2a9('0x2c')](_0x5a9300[_0xd2a9('0x29')],_0x5a9300[_0xd2a9('0x24')]);_0xb3a07b['attributes']=_[_0xd2a9('0x2c')](_0x5a9300[_0xd2a9('0x29')],qs[_0xd2a9('0x2d')](_0x494e73['query'][_0xd2a9('0x2d')]));_0xb3a07b[_0xd2a9('0x2e')]=_0xb3a07b[_0xd2a9('0x2e')][_0xd2a9('0x2f')]?_0xb3a07b[_0xd2a9('0x2e')]:_0x5a9300[_0xd2a9('0x29')];if(_0x494e73['query'][_0xd2a9('0x30')]){_0xb3a07b['include']=[{'all':!![]}];}_0xb3a07b=_[_0xd2a9('0x31')]({},_0xb3a07b,_0x494e73[_0xd2a9('0x32')]);return db[_0xd2a9('0x1c')][_0xd2a9('0x33')](_0xb3a07b)[_0xd2a9('0x13')](handleEntityNotFound(_0x3fe9ad,null))[_0xd2a9('0x13')](respondWithResult(_0x3fe9ad,null))[_0xd2a9('0x26')](handleError(_0x3fe9ad,null));};exports[_0xd2a9('0x34')]=function(_0x19a218,_0x4e689f){return db[_0xd2a9('0x1c')]['create'](_0x19a218['body'],{})[_0xd2a9('0x13')](function(_0x20bb12){var _0x1266ee=_0x19a218[_0xd2a9('0x35')]['get']({'plain':!![]});if(!_0x1266ee)throw new Error(_0xd2a9('0x36'));if(_0x1266ee[_0xd2a9('0x37')]===_0xd2a9('0x35')){var _0x252cca=_0x20bb12[_0xd2a9('0x38')]({'plain':!![]});var _0x447c1f=_0xd2a9('0x14');return db[_0xd2a9('0x39')][_0xd2a9('0x33')]({'where':{'name':_0x447c1f,'userProfileId':_0x1266ee[_0xd2a9('0x3a')]},'raw':!![]})[_0xd2a9('0x13')](function(_0x254568){if(_0x254568&&_0x254568[_0xd2a9('0x3b')]===0x0){return db[_0xd2a9('0x15')][_0xd2a9('0x34')]({'name':_0x252cca[_0xd2a9('0x19')],'resourceId':_0x252cca['id'],'type':_0x254568[_0xd2a9('0x19')],'sectionId':_0x254568['id']},{})[_0xd2a9('0x13')](function(){return _0x20bb12;});}else{return _0x20bb12;}})['catch'](function(_0x4e9a36){logger['error'](_0xd2a9('0x3c'),_0x4e9a36);throw _0x4e9a36;});}return _0x20bb12;})[_0xd2a9('0x13')](respondWithResult(_0x4e689f,0xc9))[_0xd2a9('0x26')](handleError(_0x4e689f,null));};exports[_0xd2a9('0x12')]=function(_0x48cde8,_0x33c3aa){if(_0x48cde8[_0xd2a9('0x3d')]['id']){delete _0x48cde8[_0xd2a9('0x3d')]['id'];}return db['MailQueue'][_0xd2a9('0x33')]({'where':{'id':_0x48cde8[_0xd2a9('0x28')]['id']}})[_0xd2a9('0x13')](handleEntityNotFound(_0x33c3aa,null))[_0xd2a9('0x13')](saveUpdates(_0x48cde8[_0xd2a9('0x3d')],null))['then'](respondWithResult(_0x33c3aa,null))[_0xd2a9('0x26')](handleError(_0x33c3aa,null));};exports[_0xd2a9('0x16')]=function(_0x47b325,_0x2a3a07){return db['MailQueue'][_0xd2a9('0x33')]({'where':{'id':_0x47b325[_0xd2a9('0x28')]['id']}})[_0xd2a9('0x13')](handleEntityNotFound(_0x2a3a07,null))[_0xd2a9('0x13')](removeEntity(_0x2a3a07,null))['catch'](handleError(_0x2a3a07,null));};exports[_0xd2a9('0x3e')]=function(_0x15eb7c,_0x8efc53){return db[_0xd2a9('0x1c')]['describe']()[_0xd2a9('0x13')](respondWithResult(_0x8efc53,null))[_0xd2a9('0x26')](handleError(_0x8efc53,null));};exports['getMembers']=function(_0x2458bd,_0x1c6439){var _0x4555f9={'raw':!![],'where':{}},_0x28d7ef={},_0x1cbc67;return db[_0xd2a9('0x1c')]['findOne']({'where':{'id':_0x2458bd['params']['id']}})[_0xd2a9('0x13')](handleEntityNotFound(_0x1c6439,null))[_0xd2a9('0x13')](function(_0x46e3cd){if(_0x46e3cd){_0x1cbc67=_0x46e3cd[_0xd2a9('0x38')]({'plain':!![]});_0x28d7ef[_0xd2a9('0x29')]=_[_0xd2a9('0x2a')](db['UserMailQueue']['rawAttributes']);_0x28d7ef[_0xd2a9('0x24')]=_['keys'](_0x2458bd['query']);_0x28d7ef[_0xd2a9('0x2b')]=_[_0xd2a9('0x2c')](_0x28d7ef[_0xd2a9('0x29')],_0x28d7ef[_0xd2a9('0x24')]);_0x4555f9[_0xd2a9('0x2e')]=_[_0xd2a9('0x2c')](_0x28d7ef[_0xd2a9('0x29')],qs[_0xd2a9('0x2d')](_0x2458bd[_0xd2a9('0x24')][_0xd2a9('0x2d')]));_0x4555f9[_0xd2a9('0x2e')]=_0x4555f9[_0xd2a9('0x2e')][_0xd2a9('0x2f')]?_0x4555f9[_0xd2a9('0x2e')]:_0x28d7ef[_0xd2a9('0x29')];if(!_0x2458bd['query']['hasOwnProperty'](_0xd2a9('0x3f'))){_0x4555f9[_0xd2a9('0xe')]=qs[_0xd2a9('0xe')](_0x2458bd[_0xd2a9('0x24')][_0xd2a9('0xe')]);_0x4555f9[_0xd2a9('0xc')]=qs[_0xd2a9('0xc')](_0x2458bd[_0xd2a9('0x24')][_0xd2a9('0xc')]);}_0x4555f9[_0xd2a9('0x40')]=qs['sort'](_0x2458bd[_0xd2a9('0x24')]['sort']);_0x4555f9[_0xd2a9('0x22')]=qs[_0xd2a9('0x2b')](_['pick'](_0x2458bd[_0xd2a9('0x24')],_0x28d7ef[_0xd2a9('0x2b')]));_0x4555f9[_0xd2a9('0x22')][_0xd2a9('0x41')]=_0x46e3cd['id'];if(_0x2458bd[_0xd2a9('0x24')][_0xd2a9('0x42')]){_0x4555f9[_0xd2a9('0x22')]=_['merge'](_0x4555f9[_0xd2a9('0x22')],{'$or':_[_0xd2a9('0x43')](_0x4555f9['attributes'],function(_0x3d0ae2){var _0x2110de={};_0x2110de[_0x3d0ae2]={'$like':'%'+_0x2458bd['query']['filter']+'%'};return _0x2110de;})});}_0x4555f9=_['merge']({},_0x4555f9,_0x2458bd[_0xd2a9('0x32')]);return db['UserMailQueue'][_0xd2a9('0x25')](_0x4555f9);}})[_0xd2a9('0x13')](function(_0x2c3468){if(_0x2c3468){return db[_0xd2a9('0x44')][_0xd2a9('0x45')]({'where':{'id':_['map'](_0x2c3468,_0xd2a9('0x46')),'role':_0xd2a9('0x47')},'attributes':['id',_0xd2a9('0x19'),_0xd2a9('0x48'),_0xd2a9('0x49'),_0xd2a9('0x4a')]});}})[_0xd2a9('0x13')](function(_0x8c69f1){if(_0x8c69f1){return{'count':_0x8c69f1[_0xd2a9('0xf')],'rows':_[_0xd2a9('0x43')](_0x8c69f1['rows'],function(_0x3ad213){return{'membername':_0x3ad213[_0xd2a9('0x19')],'UserId':_0x3ad213['id'],'queue_name':_0x1cbc67[_0xd2a9('0x19')],'MailQueueId':_0x1cbc67['id'],'interface':util['format'](_0xd2a9('0x4b'),_0xd2a9('0x4c'),_0x3ad213[_0xd2a9('0x19')]),'penalty':0x0,'paused':_0x3ad213[_0xd2a9('0x48')],'createdAt':_0x3ad213[_0xd2a9('0x4a')],'updatedAt':_0x3ad213[_0xd2a9('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd2a9('0x13')](respondWithFilteredResult(_0x1c6439,_0x4555f9))['catch'](handleError(_0x1c6439,null));};exports[_0xd2a9('0x4d')]=function(_0x554104,_0x1bc3ef){var _0x1d6034={};var _0x3fb379={};var _0x48b969;var _0x4d02cd;return db[_0xd2a9('0x1c')]['findOne']({'where':{'id':_0x554104['params']['id']}})[_0xd2a9('0x13')](handleEntityNotFound(_0x1bc3ef,null))['then'](function(_0xcfc204){if(_0xcfc204){_0x48b969=_0xcfc204;_0x3fb379[_0xd2a9('0x29')]=_['keys'](db[_0xd2a9('0x4e')]['rawAttributes']);_0x3fb379[_0xd2a9('0x24')]=_[_0xd2a9('0x2a')](_0x554104[_0xd2a9('0x24')]);_0x3fb379['filters']=_['intersection'](_0x3fb379['model'],_0x3fb379[_0xd2a9('0x24')]);_0x1d6034[_0xd2a9('0x2e')]=_[_0xd2a9('0x2c')](_0x3fb379[_0xd2a9('0x29')],qs['fields'](_0x554104['query']['fields']));_0x1d6034[_0xd2a9('0x2e')]=_0x1d6034[_0xd2a9('0x2e')][_0xd2a9('0x2f')]?_0x1d6034[_0xd2a9('0x2e')]:_0x3fb379[_0xd2a9('0x29')];_0x1d6034[_0xd2a9('0x40')]=qs[_0xd2a9('0x4f')](_0x554104[_0xd2a9('0x24')][_0xd2a9('0x4f')]);_0x1d6034['where']=qs['filters'](_[_0xd2a9('0x50')](_0x554104[_0xd2a9('0x24')],_0x3fb379[_0xd2a9('0x2b')]));if(_0x554104[_0xd2a9('0x24')]['filter']){_0x1d6034[_0xd2a9('0x22')]=_[_0xd2a9('0x31')](_0x1d6034[_0xd2a9('0x22')],{'$or':_[_0xd2a9('0x43')](_0x1d6034[_0xd2a9('0x2e')],function(_0x181a9b){var _0x3bbbb4={};_0x3bbbb4[_0x181a9b]={'$like':'%'+_0x554104['query'][_0xd2a9('0x42')]+'%'};return _0x3bbbb4;})});}_0x1d6034=_[_0xd2a9('0x31')]({},_0x1d6034,_0x554104[_0xd2a9('0x32')]);return _0x48b969[_0xd2a9('0x4d')](_0x1d6034);}})[_0xd2a9('0x13')](function(_0x1fd269){if(_0x1fd269){_0x4d02cd=_0x1fd269['length'];if(!_0x554104['query']['hasOwnProperty'](_0xd2a9('0x3f'))){_0x1d6034[_0xd2a9('0xe')]=qs[_0xd2a9('0xe')](_0x554104[_0xd2a9('0x24')][_0xd2a9('0xe')]);_0x1d6034[_0xd2a9('0xc')]=qs[_0xd2a9('0xc')](_0x554104['query'][_0xd2a9('0xc')]);}return _0x48b969['getTeams'](_0x1d6034);}})['then'](function(_0x428495){if(_0x428495){return _0x428495?{'count':_0x4d02cd,'rows':_0x428495}:null;}})[_0xd2a9('0x13')](respondWithResult(_0x1bc3ef,null))[_0xd2a9('0x26')](handleError(_0x1bc3ef,null));};exports[_0xd2a9('0x51')]=function(_0x19b6d8,_0x42c25d){var _0x335e17=_0x19b6d8[_0xd2a9('0x3d')][_0xd2a9('0x52')];return db[_0xd2a9('0x4e')][_0xd2a9('0x25')]({'where':{'id':_0x335e17},'attributes':['id'],'include':[{'model':db[_0xd2a9('0x44')],'as':'Agents','attributes':['id','name',_0xd2a9('0x53'),_0xd2a9('0x54'),_0xd2a9('0x55')],'raw':!![]}]})[_0xd2a9('0x13')](function(_0x3c106d){if(_0x3c106d){var _0x20612f=_[_0xd2a9('0x56')](_0x3c106d,function(_0x4b24f0){var _0x11aa02=_0x4b24f0[_0xd2a9('0x38')]({'plain':!![]});return _0x11aa02[_0xd2a9('0x57')];});return db['MailQueue'][_0xd2a9('0x33')]({'where':{'id':_0x19b6d8[_0xd2a9('0x28')]['id']}})[_0xd2a9('0x13')](function(_0x489953){return db[_0xd2a9('0x58')][_0xd2a9('0x59')](function(_0x40df35){return _0x489953[_0xd2a9('0x51')](_0x335e17,{'transaction':_0x40df35})[_0xd2a9('0x13')](function(){return BPromise[_0xd2a9('0x5a')](_0x20612f,function(_0x4b268f){return db[_0xd2a9('0x5b')][_0xd2a9('0x5c')]({'where':{'UserId':_0x4b268f['id'],'MailQueueId':_0x19b6d8[_0xd2a9('0x28')]['id']},'transaction':_0x40df35});});})[_0xd2a9('0x13')](function(){_0x20612f[_0xd2a9('0x5d')](function(_0x2404b3){socket[_0xd2a9('0x5e')](_0xd2a9('0x5f'),{'UserId':_0x2404b3['id'],'MailQueueId':_0x489953['id']});});});});});}})['then'](respondWithStatusCode(_0x42c25d,null))['catch'](handleError(_0x42c25d,null));};exports[_0xd2a9('0x60')]=function(_0x2ecb45,_0x2f6ed7){return db[_0xd2a9('0x4e')][_0xd2a9('0x25')]({'where':{'id':_0x2ecb45[_0xd2a9('0x24')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd2a9('0x57'),'attributes':['id'],'raw':!![]}]})[_0xd2a9('0x13')](handleEntityNotFound(_0x2f6ed7,null))['then'](function(_0x41712d){var _0x348437=_[_0xd2a9('0x43')](_0x41712d,'id');var _0x267541=[];var _0x3d84b9=[];var _0x192a2c=squel[_0xd2a9('0x61')]();_0x192a2c[_0xd2a9('0x62')](_0xd2a9('0x63'))[_0xd2a9('0x64')]('team_has_mail_queues','tq')['join'](_0xd2a9('0x65'),'ut',_0xd2a9('0x66'))[_0xd2a9('0x22')]('MailQueueId\x20=\x20?',_0x2ecb45['params']['id']);for(var _0x3bdfb2=0x0;_0x3bdfb2<_0x41712d[_0xd2a9('0x2f')];_0x3bdfb2+=0x1){let _0x376db7=_0x41712d[_0x3bdfb2];for(var _0x377e9b=0x0;_0x377e9b<_0x376db7[_0xd2a9('0x57')][_0xd2a9('0x2f')];_0x377e9b+=0x1){let _0x310a01=_0x376db7['Agents'][_0x377e9b];var _0x4a7189=_0x192a2c[_0xd2a9('0x67')]();_0x4a7189[_0xd2a9('0x22')](_0xd2a9('0x68'),_0x310a01['id']);_0x3d84b9['push'](db['sequelize']['query'](_0x4a7189['toString'](),{'type':db[_0xd2a9('0x58')]['QueryTypes'][_0xd2a9('0x69')]})[_0xd2a9('0x13')](function(_0x2da5da){if(_0x2da5da[_0xd2a9('0x2f')]===0x1){return _0x310a01['id'];}else{var _0x4de456=_[_0xd2a9('0x6a')](_[_0xd2a9('0x43')](_0x2da5da,_0xd2a9('0x6b')),function(_0x508d7d){return _['includes'](_0x348437,_0x508d7d);});if(_0x4de456){return _0x310a01['id'];}}}));}}return BPromise[_0xd2a9('0x6c')](_0x3d84b9)[_0xd2a9('0x13')](function(_0x5a3198){_0x267541=_(_0x267541)['union'](_0x5a3198)[_0xd2a9('0x6d')]()[_0xd2a9('0x6e')]();return db[_0xd2a9('0x1c')][_0xd2a9('0x33')]({'where':{'id':_0x2ecb45[_0xd2a9('0x28')]['id']}})[_0xd2a9('0x13')](function(_0x4b7156){return db[_0xd2a9('0x58')]['transaction'](function(_0x2b150f){return _0x4b7156['removeTeams'](_0x2ecb45[_0xd2a9('0x24')][_0xd2a9('0x52')],{'transaction':_0x2b150f})['then'](function(){if(!_[_0xd2a9('0x6f')](_0x267541)){return _0x4b7156[_0xd2a9('0x70')](_0x267541,{'transaction':_0x2b150f});}})[_0xd2a9('0x13')](function(){_0x267541['forEach'](function(_0x3b4b50){socket['emit'](_0xd2a9('0x71'),{'UserId':_0x3b4b50,'MailQueueId':_0x4b7156['id']});});});});});});})[_0xd2a9('0x13')](respondWithStatusCode(_0x2f6ed7,null))[_0xd2a9('0x26')](handleError(_0x2f6ed7,null));};exports[_0xd2a9('0x72')]=function(_0x277d55,_0x5458d6){return db[_0xd2a9('0x1c')][_0xd2a9('0x33')]({'where':{'id':_0x277d55['params']['id']}})[_0xd2a9('0x13')](handleEntityNotFound(_0x5458d6,null))[_0xd2a9('0x13')](function(_0x143755){if(_0x143755){return _0x143755[_0xd2a9('0x72')](_0x277d55[_0xd2a9('0x3d')][_0xd2a9('0x52')],_[_0xd2a9('0x73')](_0x277d55[_0xd2a9('0x3d')],['ids','id'])||{})[_0xd2a9('0x74')](function(_0x267b71){for(var _0x53a630=0x0;_0x53a630<_0x277d55[_0xd2a9('0x3d')][_0xd2a9('0x52')][_0xd2a9('0x2f')];_0x53a630+=0x1){socket['emit'](_0xd2a9('0x5f'),{'UserId':Number(_0x277d55[_0xd2a9('0x3d')][_0xd2a9('0x52')][_0x53a630]),'MailQueueId':Number(_0x277d55['params']['id'])});}return _0x267b71;});}})['then'](respondWithResult(_0x5458d6,null))[_0xd2a9('0x26')](handleError(_0x5458d6,null));};exports[_0xd2a9('0x70')]=function(_0x2265be,_0x3ba19d){return db[_0xd2a9('0x1c')][_0xd2a9('0x33')]({'where':{'id':_0x2265be[_0xd2a9('0x28')]['id']}})[_0xd2a9('0x13')](handleEntityNotFound(_0x3ba19d,null))[_0xd2a9('0x13')](function(_0x5b39d9){if(_0x5b39d9){return _0x5b39d9[_0xd2a9('0x70')](_0x2265be['query'][_0xd2a9('0x52')])[_0xd2a9('0x13')](function(){if(_[_0xd2a9('0x75')](_0x2265be[_0xd2a9('0x24')][_0xd2a9('0x52')])){for(var _0x306df3=0x0;_0x306df3<_0x2265be[_0xd2a9('0x24')][_0xd2a9('0x52')]['length'];_0x306df3+=0x1){socket[_0xd2a9('0x5e')](_0xd2a9('0x71'),{'UserId':Number(_0x2265be[_0xd2a9('0x24')][_0xd2a9('0x52')][_0x306df3]),'MailQueueId':Number(_0x2265be[_0xd2a9('0x28')]['id'])});}}else{socket[_0xd2a9('0x5e')](_0xd2a9('0x71'),{'UserId':Number(_0x2265be[_0xd2a9('0x24')][_0xd2a9('0x52')]),'MailQueueId':Number(_0x2265be[_0xd2a9('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ba19d,null))[_0xd2a9('0x26')](handleError(_0x3ba19d,null));};exports[_0xd2a9('0x76')]=function(_0x517aaa,_0x4b5ec7){var _0x389636={};var _0x35d129={};var _0x24588f;var _0x4f4c35;return db[_0xd2a9('0x1c')][_0xd2a9('0x77')]({'where':{'id':_0x517aaa[_0xd2a9('0x28')]['id']}})[_0xd2a9('0x13')](handleEntityNotFound(_0x4b5ec7,null))[_0xd2a9('0x13')](function(_0x4bbcee){if(_0x4bbcee){_0x24588f=_0x4bbcee;_0x35d129['model']=_[_0xd2a9('0x2a')](db[_0xd2a9('0x44')][_0xd2a9('0x1d')]);_0x35d129[_0xd2a9('0x24')]=_[_0xd2a9('0x2a')](_0x517aaa[_0xd2a9('0x24')]);_0x35d129[_0xd2a9('0x2b')]=_[_0xd2a9('0x2c')](_0x35d129[_0xd2a9('0x29')],_0x35d129[_0xd2a9('0x24')]);_0x389636[_0xd2a9('0x2e')]=_[_0xd2a9('0x2c')](_0x35d129[_0xd2a9('0x29')],qs['fields'](_0x517aaa['query'][_0xd2a9('0x2d')]));_0x389636['attributes']=_0x389636[_0xd2a9('0x2e')][_0xd2a9('0x2f')]?_0x389636[_0xd2a9('0x2e')]:_0x35d129['model'];_0x389636[_0xd2a9('0x40')]=qs[_0xd2a9('0x4f')](_0x517aaa[_0xd2a9('0x24')]['sort']);_0x389636[_0xd2a9('0x22')]=qs[_0xd2a9('0x2b')](_['pick'](_0x517aaa[_0xd2a9('0x24')],_0x35d129[_0xd2a9('0x2b')]));if(_0x517aaa[_0xd2a9('0x24')][_0xd2a9('0x42')]){_0x389636['where']=_[_0xd2a9('0x31')](_0x389636[_0xd2a9('0x22')],{'$or':_[_0xd2a9('0x43')](_0x389636[_0xd2a9('0x2e')],function(_0x519f52){var _0x950ae3={};_0x950ae3[_0x519f52]={'$like':'%'+_0x517aaa[_0xd2a9('0x24')][_0xd2a9('0x42')]+'%'};return _0x950ae3;})});}_0x389636=_['merge']({},_0x389636,_0x517aaa['options']);return _0x24588f[_0xd2a9('0x76')](_0x389636);}})[_0xd2a9('0x13')](function(_0x26d69f){if(_0x26d69f){_0x4f4c35=_0x26d69f[_0xd2a9('0x2f')];if(!_0x517aaa[_0xd2a9('0x24')]['hasOwnProperty']('nolimit')){_0x389636[_0xd2a9('0xe')]=qs[_0xd2a9('0xe')](_0x517aaa[_0xd2a9('0x24')][_0xd2a9('0xe')]);_0x389636[_0xd2a9('0xc')]=qs[_0xd2a9('0xc')](_0x517aaa['query'][_0xd2a9('0xc')]);}return _0x24588f[_0xd2a9('0x76')](_0x389636);}})[_0xd2a9('0x13')](function(_0x31a137){if(_0x31a137){return _0x31a137?{'count':_0x4f4c35,'rows':_0x31a137}:null;}})[_0xd2a9('0x13')](respondWithResult(_0x4b5ec7,null))[_0xd2a9('0x26')](handleError(_0x4b5ec7,null));}; \ No newline at end of file +var _0x2f4c=['userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','value','isEmpty','removeAgents','userMailQueue:remove','omit','spread','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','MailQueue','type','key','getOptions','where','include','query','findAll','rows','catch','show','model','rawAttributes','keys','filters','intersection','attributes','fields','length','merge','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMembers','hasOwnProperty','limit','order','sort','MailQueueId','filter','map','options','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','pick','nolimit','getTeams','addTeams','online','voicePause','interface','flatMap','Agents','transaction','each','UserMailQueue','findOrCreate','forEach','emit'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2f4c,0x117));var _0xc2f4=function(_0x23b172,_0x18d3eb){_0x23b172=_0x23b172-0x0;var _0x5b2323=_0x2f4c[_0x23b172];return _0x5b2323;};'use strict';var BPromise=require('bluebird');var util=require(_0xc2f4('0x0'));var _=require('lodash');var squel=require(_0xc2f4('0x1'));var Redis=require(_0xc2f4('0x2'));var qs=require(_0xc2f4('0x3'));var logger=require(_0xc2f4('0x4'))('api');var config=require(_0xc2f4('0x5'));var db=require(_0xc2f4('0x6'))['db'];config[_0xc2f4('0x7')]=_[_0xc2f4('0x8')](config[_0xc2f4('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc2f4('0x7')]));require(_0xc2f4('0x9'))[_0xc2f4('0xa')](socket);function respondWithStatusCode(_0xd98c8c,_0x3fd11f){_0x3fd11f=_0x3fd11f||0xcc;return function(_0x9fcb80){if(_0x9fcb80){return _0xd98c8c[_0xc2f4('0xb')](_0x3fd11f);}return _0xd98c8c[_0xc2f4('0xc')](_0x3fd11f)[_0xc2f4('0xd')]();};}function respondWithResult(_0x49d5f6,_0x46aad9){_0x46aad9=_0x46aad9||0xc8;return function(_0x1c881f){if(_0x1c881f){return _0x49d5f6[_0xc2f4('0xc')](_0x46aad9)[_0xc2f4('0xe')](_0x1c881f);}};}function respondWithFilteredResult(_0x4232c8,_0x53b223){return function(_0x200938){if(_0x200938){var _0x21a784=typeof _0x53b223[_0xc2f4('0xf')]===_0xc2f4('0x10')&&typeof _0x53b223['limit']===_0xc2f4('0x10');var _0x13e694=_0x200938[_0xc2f4('0x11')];var _0x21efe5=_0x21a784?0x0:_0x53b223[_0xc2f4('0xf')];var _0xb6a620=_0x21a784?_0x200938[_0xc2f4('0x11')]:_0x53b223[_0xc2f4('0xf')]+_0x53b223['limit'];var _0x3f3a97;if(_0xb6a620>=_0x13e694){_0xb6a620=_0x13e694;_0x3f3a97=0xc8;}else{_0x3f3a97=0xce;}_0x4232c8[_0xc2f4('0xc')](_0x3f3a97);return _0x4232c8[_0xc2f4('0x12')](_0xc2f4('0x13'),_0x21efe5+'-'+_0xb6a620+'/'+_0x13e694)[_0xc2f4('0xe')](_0x200938);}return null;};}function saveUpdates(_0x5923ef){return function(_0x26071e){if(_0x26071e){return _0x26071e[_0xc2f4('0x14')](_0x5923ef)[_0xc2f4('0x15')](function(_0x38e2ed){return _0x38e2ed;});}return null;};}function removeEntity(_0x43e1e7){return function(_0x33c0b6){if(_0x33c0b6){return _0x33c0b6[_0xc2f4('0x16')]()[_0xc2f4('0x15')](function(){var _0x45fa28=_0x33c0b6['get']({'plain':!![]});var _0x277da6=_0xc2f4('0x17');return db[_0xc2f4('0x18')][_0xc2f4('0x16')]({'where':{'type':_0x277da6,'resourceId':_0x45fa28['id']}})[_0xc2f4('0x15')](function(){return _0x33c0b6;});})[_0xc2f4('0x15')](function(){_0x43e1e7[_0xc2f4('0xc')](0xcc)[_0xc2f4('0xd')]();});}};}function handleEntityNotFound(_0x2a58b2){return function(_0x1ebf6e){if(!_0x1ebf6e){_0x2a58b2[_0xc2f4('0xb')](0x194);}return _0x1ebf6e;};}function handleError(_0x25f6c4,_0xf4ca4f){_0xf4ca4f=_0xf4ca4f||0x1f4;return function(_0x256403){logger[_0xc2f4('0x19')](_0x256403[_0xc2f4('0x1a')]);if(_0x256403[_0xc2f4('0x1b')]){delete _0x256403[_0xc2f4('0x1b')];}_0x25f6c4[_0xc2f4('0xc')](_0xf4ca4f)[_0xc2f4('0x1c')](_0x256403);};}exports['index']=function(_0x5cd22c,_0x2d1e2a){var _0x1753a6={};var _0x1bc26a={'count':0x0,'rows':[]};var _0x4fdd29=_['map'](db[_0xc2f4('0x1d')]['rawAttributes'],function(_0x2357e9){return{'name':_0x2357e9['fieldName'],'type':_0x2357e9[_0xc2f4('0x1e')][_0xc2f4('0x1f')]};});_0x1753a6=qs[_0xc2f4('0x20')](_0x4fdd29,_0x5cd22c);var _0x538644={'where':_0x1753a6[_0xc2f4('0x21')]};return db[_0xc2f4('0x1d')][_0xc2f4('0x11')](_0x538644)[_0xc2f4('0x15')](function(_0x3a3890){_0x1bc26a[_0xc2f4('0x11')]=_0x3a3890;_0x1753a6[_0xc2f4('0x22')]=qs[_0xc2f4('0x22')](_0x5cd22c[_0xc2f4('0x23')]);return db[_0xc2f4('0x1d')][_0xc2f4('0x24')](_0x1753a6);})[_0xc2f4('0x15')](function(_0x27eac1){_0x1bc26a[_0xc2f4('0x25')]=_0x27eac1;return _0x1bc26a;})['then'](respondWithFilteredResult(_0x2d1e2a,_0x1753a6))[_0xc2f4('0x26')](handleError(_0x2d1e2a,null));};exports[_0xc2f4('0x27')]=function(_0x394b6d,_0xe14364){var _0x502d22={'raw':!![],'where':{'id':_0x394b6d['params']['id']}},_0x2bb6ab={};_0x2bb6ab[_0xc2f4('0x28')]=_['keys'](db[_0xc2f4('0x1d')][_0xc2f4('0x29')]);_0x2bb6ab[_0xc2f4('0x23')]=_[_0xc2f4('0x2a')](_0x394b6d[_0xc2f4('0x23')]);_0x2bb6ab[_0xc2f4('0x2b')]=_[_0xc2f4('0x2c')](_0x2bb6ab[_0xc2f4('0x28')],_0x2bb6ab['query']);_0x502d22[_0xc2f4('0x2d')]=_[_0xc2f4('0x2c')](_0x2bb6ab[_0xc2f4('0x28')],qs[_0xc2f4('0x2e')](_0x394b6d['query'][_0xc2f4('0x2e')]));_0x502d22[_0xc2f4('0x2d')]=_0x502d22[_0xc2f4('0x2d')][_0xc2f4('0x2f')]?_0x502d22[_0xc2f4('0x2d')]:_0x2bb6ab[_0xc2f4('0x28')];if(_0x394b6d['query']['includeAll']){_0x502d22[_0xc2f4('0x22')]=[{'all':!![]}];}_0x502d22=_[_0xc2f4('0x30')]({},_0x502d22,_0x394b6d['options']);return db[_0xc2f4('0x1d')]['find'](_0x502d22)[_0xc2f4('0x15')](handleEntityNotFound(_0xe14364,null))[_0xc2f4('0x15')](respondWithResult(_0xe14364,null))[_0xc2f4('0x26')](handleError(_0xe14364,null));};exports['create']=function(_0x1bda72,_0x40915d){return db[_0xc2f4('0x1d')][_0xc2f4('0x31')](_0x1bda72['body'],{})[_0xc2f4('0x15')](function(_0x249d03){var _0x316a14=_0x1bda72[_0xc2f4('0x32')][_0xc2f4('0x33')]({'plain':!![]});if(!_0x316a14)throw new Error(_0xc2f4('0x34'));if(_0x316a14[_0xc2f4('0x35')]===_0xc2f4('0x32')){var _0x51c64c=_0x249d03['get']({'plain':!![]});var _0x1ef148=_0xc2f4('0x17');return db[_0xc2f4('0x36')][_0xc2f4('0x37')]({'where':{'name':_0x1ef148,'userProfileId':_0x316a14[_0xc2f4('0x38')]},'raw':!![]})['then'](function(_0xc7d79f){if(_0xc7d79f&&_0xc7d79f[_0xc2f4('0x39')]===0x0){return db[_0xc2f4('0x18')][_0xc2f4('0x31')]({'name':_0x51c64c['name'],'resourceId':_0x51c64c['id'],'type':_0xc7d79f[_0xc2f4('0x1b')],'sectionId':_0xc7d79f['id']},{})['then'](function(){return _0x249d03;});}else{return _0x249d03;}})[_0xc2f4('0x26')](function(_0x5f4bf1){logger[_0xc2f4('0x19')](_0xc2f4('0x3a'),_0x5f4bf1);throw _0x5f4bf1;});}return _0x249d03;})[_0xc2f4('0x15')](respondWithResult(_0x40915d,0xc9))[_0xc2f4('0x26')](handleError(_0x40915d,null));};exports[_0xc2f4('0x14')]=function(_0x25fef6,_0x4c1c99){if(_0x25fef6[_0xc2f4('0x3b')]['id']){delete _0x25fef6[_0xc2f4('0x3b')]['id'];}return db[_0xc2f4('0x1d')][_0xc2f4('0x37')]({'where':{'id':_0x25fef6[_0xc2f4('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4c1c99,null))[_0xc2f4('0x15')](saveUpdates(_0x25fef6['body'],null))[_0xc2f4('0x15')](respondWithResult(_0x4c1c99,null))[_0xc2f4('0x26')](handleError(_0x4c1c99,null));};exports[_0xc2f4('0x16')]=function(_0x19b548,_0x5c9940){return db['MailQueue']['find']({'where':{'id':_0x19b548[_0xc2f4('0x3c')]['id']}})[_0xc2f4('0x15')](handleEntityNotFound(_0x5c9940,null))[_0xc2f4('0x15')](removeEntity(_0x5c9940,null))[_0xc2f4('0x26')](handleError(_0x5c9940,null));};exports['describe']=function(_0x5bb123,_0x57c5fc){return db[_0xc2f4('0x1d')]['describe']()[_0xc2f4('0x15')](respondWithResult(_0x57c5fc,null))[_0xc2f4('0x26')](handleError(_0x57c5fc,null));};exports[_0xc2f4('0x3d')]=function(_0x172279,_0x598a79){var _0x260537={'raw':!![],'where':{}},_0x111b15={},_0xf32714;return db[_0xc2f4('0x1d')]['findOne']({'where':{'id':_0x172279[_0xc2f4('0x3c')]['id']}})[_0xc2f4('0x15')](handleEntityNotFound(_0x598a79,null))[_0xc2f4('0x15')](function(_0x76fbe){if(_0x76fbe){_0xf32714=_0x76fbe['get']({'plain':!![]});_0x111b15[_0xc2f4('0x28')]=_[_0xc2f4('0x2a')](db['UserMailQueue'][_0xc2f4('0x29')]);_0x111b15[_0xc2f4('0x23')]=_[_0xc2f4('0x2a')](_0x172279[_0xc2f4('0x23')]);_0x111b15['filters']=_[_0xc2f4('0x2c')](_0x111b15[_0xc2f4('0x28')],_0x111b15[_0xc2f4('0x23')]);_0x260537[_0xc2f4('0x2d')]=_['intersection'](_0x111b15[_0xc2f4('0x28')],qs['fields'](_0x172279[_0xc2f4('0x23')][_0xc2f4('0x2e')]));_0x260537[_0xc2f4('0x2d')]=_0x260537[_0xc2f4('0x2d')][_0xc2f4('0x2f')]?_0x260537[_0xc2f4('0x2d')]:_0x111b15[_0xc2f4('0x28')];if(!_0x172279['query'][_0xc2f4('0x3e')]('nolimit')){_0x260537[_0xc2f4('0x3f')]=qs['limit'](_0x172279[_0xc2f4('0x23')]['limit']);_0x260537['offset']=qs[_0xc2f4('0xf')](_0x172279[_0xc2f4('0x23')][_0xc2f4('0xf')]);}_0x260537[_0xc2f4('0x40')]=qs[_0xc2f4('0x41')](_0x172279[_0xc2f4('0x23')][_0xc2f4('0x41')]);_0x260537['where']=qs[_0xc2f4('0x2b')](_['pick'](_0x172279[_0xc2f4('0x23')],_0x111b15[_0xc2f4('0x2b')]));_0x260537[_0xc2f4('0x21')][_0xc2f4('0x42')]=_0x76fbe['id'];if(_0x172279[_0xc2f4('0x23')][_0xc2f4('0x43')]){_0x260537['where']=_[_0xc2f4('0x30')](_0x260537[_0xc2f4('0x21')],{'$or':_[_0xc2f4('0x44')](_0x260537[_0xc2f4('0x2d')],function(_0x2d221f){var _0x5155a9={};_0x5155a9[_0x2d221f]={'$like':'%'+_0x172279['query'][_0xc2f4('0x43')]+'%'};return _0x5155a9;})});}_0x260537=_[_0xc2f4('0x30')]({},_0x260537,_0x172279[_0xc2f4('0x45')]);return db['UserMailQueue'][_0xc2f4('0x24')](_0x260537);}})['then'](function(_0x34f720){if(_0x34f720){return db[_0xc2f4('0x46')][_0xc2f4('0x47')]({'where':{'id':_[_0xc2f4('0x44')](_0x34f720,_0xc2f4('0x48')),'role':'agent'},'attributes':['id','name',_0xc2f4('0x49'),_0xc2f4('0x4a'),_0xc2f4('0x4b')]});}})[_0xc2f4('0x15')](function(_0x5c921c){if(_0x5c921c){return{'count':_0x5c921c[_0xc2f4('0x11')],'rows':_[_0xc2f4('0x44')](_0x5c921c[_0xc2f4('0x25')],function(_0x43de15){return{'membername':_0x43de15[_0xc2f4('0x1b')],'UserId':_0x43de15['id'],'queue_name':_0xf32714[_0xc2f4('0x1b')],'MailQueueId':_0xf32714['id'],'interface':util[_0xc2f4('0x4c')](_0xc2f4('0x4d'),_0xc2f4('0x4e'),_0x43de15[_0xc2f4('0x1b')]),'penalty':0x0,'paused':_0x43de15[_0xc2f4('0x49')],'createdAt':_0x43de15[_0xc2f4('0x4b')],'updatedAt':_0x43de15[_0xc2f4('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc2f4('0x15')](respondWithFilteredResult(_0x598a79,_0x260537))[_0xc2f4('0x26')](handleError(_0x598a79,null));};exports['getTeams']=function(_0x34de7b,_0x5037ba){var _0x528c21={};var _0x17fd65={};var _0x2e2651;var _0x2b1622;return db['MailQueue'][_0xc2f4('0x4f')]({'where':{'id':_0x34de7b['params']['id']}})['then'](handleEntityNotFound(_0x5037ba,null))[_0xc2f4('0x15')](function(_0x4f6bb6){if(_0x4f6bb6){_0x2e2651=_0x4f6bb6;_0x17fd65[_0xc2f4('0x28')]=_[_0xc2f4('0x2a')](db[_0xc2f4('0x50')]['rawAttributes']);_0x17fd65[_0xc2f4('0x23')]=_[_0xc2f4('0x2a')](_0x34de7b[_0xc2f4('0x23')]);_0x17fd65[_0xc2f4('0x2b')]=_[_0xc2f4('0x2c')](_0x17fd65[_0xc2f4('0x28')],_0x17fd65[_0xc2f4('0x23')]);_0x528c21[_0xc2f4('0x2d')]=_['intersection'](_0x17fd65[_0xc2f4('0x28')],qs[_0xc2f4('0x2e')](_0x34de7b[_0xc2f4('0x23')][_0xc2f4('0x2e')]));_0x528c21[_0xc2f4('0x2d')]=_0x528c21[_0xc2f4('0x2d')][_0xc2f4('0x2f')]?_0x528c21[_0xc2f4('0x2d')]:_0x17fd65[_0xc2f4('0x28')];_0x528c21[_0xc2f4('0x40')]=qs[_0xc2f4('0x41')](_0x34de7b[_0xc2f4('0x23')][_0xc2f4('0x41')]);_0x528c21[_0xc2f4('0x21')]=qs[_0xc2f4('0x2b')](_[_0xc2f4('0x51')](_0x34de7b[_0xc2f4('0x23')],_0x17fd65[_0xc2f4('0x2b')]));if(_0x34de7b['query'][_0xc2f4('0x43')]){_0x528c21[_0xc2f4('0x21')]=_['merge'](_0x528c21[_0xc2f4('0x21')],{'$or':_[_0xc2f4('0x44')](_0x528c21[_0xc2f4('0x2d')],function(_0x4972d6){var _0x36dc75={};_0x36dc75[_0x4972d6]={'$like':'%'+_0x34de7b[_0xc2f4('0x23')][_0xc2f4('0x43')]+'%'};return _0x36dc75;})});}_0x528c21=_[_0xc2f4('0x30')]({},_0x528c21,_0x34de7b['options']);return _0x2e2651['getTeams'](_0x528c21);}})['then'](function(_0x2f0f59){if(_0x2f0f59){_0x2b1622=_0x2f0f59[_0xc2f4('0x2f')];if(!_0x34de7b[_0xc2f4('0x23')][_0xc2f4('0x3e')](_0xc2f4('0x52'))){_0x528c21[_0xc2f4('0x3f')]=qs[_0xc2f4('0x3f')](_0x34de7b[_0xc2f4('0x23')][_0xc2f4('0x3f')]);_0x528c21['offset']=qs['offset'](_0x34de7b[_0xc2f4('0x23')][_0xc2f4('0xf')]);}return _0x2e2651[_0xc2f4('0x53')](_0x528c21);}})[_0xc2f4('0x15')](function(_0x271cfb){if(_0x271cfb){return _0x271cfb?{'count':_0x2b1622,'rows':_0x271cfb}:null;}})[_0xc2f4('0x15')](respondWithResult(_0x5037ba,null))[_0xc2f4('0x26')](handleError(_0x5037ba,null));};exports[_0xc2f4('0x54')]=function(_0x32a7d8,_0x375dc7){var _0x23b378=_0x32a7d8[_0xc2f4('0x3b')]['ids'];return db['Team'][_0xc2f4('0x24')]({'where':{'id':_0x23b378},'attributes':['id'],'include':[{'model':db[_0xc2f4('0x46')],'as':'Agents','attributes':['id','name',_0xc2f4('0x55'),_0xc2f4('0x56'),_0xc2f4('0x57')],'raw':!![]}]})[_0xc2f4('0x15')](function(_0x411e18){if(_0x411e18){var _0x5590cc=_[_0xc2f4('0x58')](_0x411e18,function(_0x5068ef){var _0x119280=_0x5068ef['get']({'plain':!![]});return _0x119280[_0xc2f4('0x59')];});return db[_0xc2f4('0x1d')][_0xc2f4('0x37')]({'where':{'id':_0x32a7d8[_0xc2f4('0x3c')]['id']}})[_0xc2f4('0x15')](function(_0x593934){return db['sequelize'][_0xc2f4('0x5a')](function(_0x287d40){return _0x593934[_0xc2f4('0x54')](_0x23b378,{'transaction':_0x287d40})[_0xc2f4('0x15')](function(){return BPromise[_0xc2f4('0x5b')](_0x5590cc,function(_0x10686e){return db[_0xc2f4('0x5c')][_0xc2f4('0x5d')]({'where':{'UserId':_0x10686e['id'],'MailQueueId':_0x32a7d8[_0xc2f4('0x3c')]['id']},'transaction':_0x287d40});});})[_0xc2f4('0x15')](function(){_0x5590cc[_0xc2f4('0x5e')](function(_0x3a8c85){socket[_0xc2f4('0x5f')](_0xc2f4('0x60'),{'UserId':_0x3a8c85['id'],'MailQueueId':_0x593934['id']});});});});});}})[_0xc2f4('0x15')](respondWithStatusCode(_0x375dc7,null))[_0xc2f4('0x26')](handleError(_0x375dc7,null));};exports[_0xc2f4('0x61')]=function(_0x3459f2,_0x709cff){return db[_0xc2f4('0x50')]['findAll']({'where':{'id':_0x3459f2[_0xc2f4('0x23')][_0xc2f4('0x62')]},'attributes':['id'],'include':[{'model':db[_0xc2f4('0x46')],'as':_0xc2f4('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x709cff,null))[_0xc2f4('0x15')](function(_0x56a6ed){var _0xbf36c0=_[_0xc2f4('0x44')](_0x56a6ed,'id');var _0x1e4704=[];var _0x5aa7a4=[];var _0x51a297=squel[_0xc2f4('0x63')]();_0x51a297[_0xc2f4('0x64')](_0xc2f4('0x65'))[_0xc2f4('0x66')](_0xc2f4('0x67'),'tq')[_0xc2f4('0x68')](_0xc2f4('0x69'),'ut',_0xc2f4('0x6a'))['where'](_0xc2f4('0x6b'),_0x3459f2[_0xc2f4('0x3c')]['id']);for(var _0x515169=0x0;_0x515169<_0x56a6ed['length'];_0x515169+=0x1){let _0x23e60e=_0x56a6ed[_0x515169];for(var _0x4df9c4=0x0;_0x4df9c4<_0x23e60e['Agents']['length'];_0x4df9c4+=0x1){let _0x55da03=_0x23e60e[_0xc2f4('0x59')][_0x4df9c4];var _0x44911d=_0x51a297[_0xc2f4('0x6c')]();_0x44911d[_0xc2f4('0x21')](_0xc2f4('0x6d'),_0x55da03['id']);_0x5aa7a4[_0xc2f4('0x6e')](db[_0xc2f4('0x6f')][_0xc2f4('0x23')](_0x44911d[_0xc2f4('0x70')](),{'type':db[_0xc2f4('0x6f')][_0xc2f4('0x71')][_0xc2f4('0x72')]})[_0xc2f4('0x15')](function(_0x33005d){if(_0x33005d[_0xc2f4('0x2f')]===0x1){return _0x55da03['id'];}else{var _0x59c6e0=_[_0xc2f4('0x73')](_['map'](_0x33005d,_0xc2f4('0x74')),function(_0x5478e6){return _[_0xc2f4('0x75')](_0xbf36c0,_0x5478e6);});if(_0x59c6e0){return _0x55da03['id'];}}}));}}return BPromise['all'](_0x5aa7a4)[_0xc2f4('0x15')](function(_0x506cb7){_0x1e4704=_(_0x1e4704)['union'](_0x506cb7)['compact']()[_0xc2f4('0x76')]();return db['MailQueue']['find']({'where':{'id':_0x3459f2['params']['id']}})[_0xc2f4('0x15')](function(_0x2419fb){return db[_0xc2f4('0x6f')][_0xc2f4('0x5a')](function(_0x55ee3e){return _0x2419fb[_0xc2f4('0x61')](_0x3459f2['query'][_0xc2f4('0x62')],{'transaction':_0x55ee3e})[_0xc2f4('0x15')](function(){if(!_[_0xc2f4('0x77')](_0x1e4704)){return _0x2419fb[_0xc2f4('0x78')](_0x1e4704,{'transaction':_0x55ee3e});}})[_0xc2f4('0x15')](function(){_0x1e4704['forEach'](function(_0x2bb49a){socket[_0xc2f4('0x5f')](_0xc2f4('0x79'),{'UserId':_0x2bb49a,'MailQueueId':_0x2419fb['id']});});});});});});})[_0xc2f4('0x15')](respondWithStatusCode(_0x709cff,null))[_0xc2f4('0x26')](handleError(_0x709cff,null));};exports['addAgents']=function(_0x860370,_0x166352){return db[_0xc2f4('0x1d')][_0xc2f4('0x37')]({'where':{'id':_0x860370[_0xc2f4('0x3c')]['id']}})[_0xc2f4('0x15')](handleEntityNotFound(_0x166352,null))[_0xc2f4('0x15')](function(_0x3a3fbf){if(_0x3a3fbf){return _0x3a3fbf['addAgents'](_0x860370[_0xc2f4('0x3b')][_0xc2f4('0x62')],_[_0xc2f4('0x7a')](_0x860370[_0xc2f4('0x3b')],['ids','id'])||{})[_0xc2f4('0x7b')](function(_0x48d944){for(var _0x20f434=0x0;_0x20f434<_0x860370[_0xc2f4('0x3b')][_0xc2f4('0x62')]['length'];_0x20f434+=0x1){socket[_0xc2f4('0x5f')](_0xc2f4('0x60'),{'UserId':Number(_0x860370[_0xc2f4('0x3b')]['ids'][_0x20f434]),'MailQueueId':Number(_0x860370[_0xc2f4('0x3c')]['id'])});}return _0x48d944;});}})['then'](respondWithResult(_0x166352,null))[_0xc2f4('0x26')](handleError(_0x166352,null));};exports[_0xc2f4('0x78')]=function(_0x3ec75b,_0x4fef41){return db['MailQueue']['find']({'where':{'id':_0x3ec75b[_0xc2f4('0x3c')]['id']}})[_0xc2f4('0x15')](handleEntityNotFound(_0x4fef41,null))[_0xc2f4('0x15')](function(_0x18ac99){if(_0x18ac99){return _0x18ac99[_0xc2f4('0x78')](_0x3ec75b[_0xc2f4('0x23')]['ids'])[_0xc2f4('0x15')](function(){if(_['isArray'](_0x3ec75b[_0xc2f4('0x23')][_0xc2f4('0x62')])){for(var _0x100dc7=0x0;_0x100dc7<_0x3ec75b[_0xc2f4('0x23')][_0xc2f4('0x62')][_0xc2f4('0x2f')];_0x100dc7+=0x1){socket[_0xc2f4('0x5f')]('userMailQueue:remove',{'UserId':Number(_0x3ec75b[_0xc2f4('0x23')][_0xc2f4('0x62')][_0x100dc7]),'MailQueueId':Number(_0x3ec75b['params']['id'])});}}else{socket[_0xc2f4('0x5f')](_0xc2f4('0x79'),{'UserId':Number(_0x3ec75b[_0xc2f4('0x23')]['ids']),'MailQueueId':Number(_0x3ec75b[_0xc2f4('0x3c')]['id'])});}});}})[_0xc2f4('0x15')](respondWithStatusCode(_0x4fef41,null))[_0xc2f4('0x26')](handleError(_0x4fef41,null));};exports[_0xc2f4('0x7c')]=function(_0x2c8a8b,_0x41e451){var _0x2a178c={};var _0xb96c89={};var _0x20550d;var _0x21e8de;return db[_0xc2f4('0x1d')][_0xc2f4('0x4f')]({'where':{'id':_0x2c8a8b[_0xc2f4('0x3c')]['id']}})[_0xc2f4('0x15')](handleEntityNotFound(_0x41e451,null))[_0xc2f4('0x15')](function(_0x2a48a6){if(_0x2a48a6){_0x20550d=_0x2a48a6;_0xb96c89[_0xc2f4('0x28')]=_[_0xc2f4('0x2a')](db[_0xc2f4('0x46')][_0xc2f4('0x29')]);_0xb96c89[_0xc2f4('0x23')]=_['keys'](_0x2c8a8b[_0xc2f4('0x23')]);_0xb96c89['filters']=_[_0xc2f4('0x2c')](_0xb96c89[_0xc2f4('0x28')],_0xb96c89[_0xc2f4('0x23')]);_0x2a178c['attributes']=_['intersection'](_0xb96c89['model'],qs[_0xc2f4('0x2e')](_0x2c8a8b[_0xc2f4('0x23')][_0xc2f4('0x2e')]));_0x2a178c[_0xc2f4('0x2d')]=_0x2a178c[_0xc2f4('0x2d')]['length']?_0x2a178c[_0xc2f4('0x2d')]:_0xb96c89[_0xc2f4('0x28')];_0x2a178c[_0xc2f4('0x40')]=qs[_0xc2f4('0x41')](_0x2c8a8b[_0xc2f4('0x23')][_0xc2f4('0x41')]);_0x2a178c[_0xc2f4('0x21')]=qs[_0xc2f4('0x2b')](_['pick'](_0x2c8a8b[_0xc2f4('0x23')],_0xb96c89[_0xc2f4('0x2b')]));if(_0x2c8a8b[_0xc2f4('0x23')]['filter']){_0x2a178c[_0xc2f4('0x21')]=_[_0xc2f4('0x30')](_0x2a178c[_0xc2f4('0x21')],{'$or':_['map'](_0x2a178c[_0xc2f4('0x2d')],function(_0x4711a2){var _0x57f5fb={};_0x57f5fb[_0x4711a2]={'$like':'%'+_0x2c8a8b['query'][_0xc2f4('0x43')]+'%'};return _0x57f5fb;})});}_0x2a178c=_['merge']({},_0x2a178c,_0x2c8a8b['options']);return _0x20550d['getAgents'](_0x2a178c);}})[_0xc2f4('0x15')](function(_0x22b2a1){if(_0x22b2a1){_0x21e8de=_0x22b2a1[_0xc2f4('0x2f')];if(!_0x2c8a8b['query'][_0xc2f4('0x3e')]('nolimit')){_0x2a178c[_0xc2f4('0x3f')]=qs[_0xc2f4('0x3f')](_0x2c8a8b[_0xc2f4('0x23')][_0xc2f4('0x3f')]);_0x2a178c[_0xc2f4('0xf')]=qs['offset'](_0x2c8a8b[_0xc2f4('0x23')][_0xc2f4('0xf')]);}return _0x20550d['getAgents'](_0x2a178c);}})['then'](function(_0x3155f3){if(_0x3155f3){return _0x3155f3?{'count':_0x21e8de,'rows':_0x3155f3}:null;}})['then'](respondWithResult(_0x41e451,null))[_0xc2f4('0x26')](handleError(_0x41e451,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 1caa183..dde4046 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 _0x87ab=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x87ab,0x13d));var _0xb87a=function(_0x500f2a,_0x1f4102){_0x500f2a=_0x500f2a-0x0;var _0x2b431c=_0x87ab[_0x500f2a];return _0x2b431c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xb87a('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb87a('0x1')](0x0);var events={'afterCreate':_0xb87a('0x2'),'afterUpdate':_0xb87a('0x3'),'afterDestroy':_0xb87a('0x4')};function emitEvent(_0x1b4737){return function(_0x134ee3,_0x40b315,_0x234f6a){MailQueueEvents[_0xb87a('0x5')](_0x1b4737+':'+_0x134ee3['id'],_0x134ee3);MailQueueEvents[_0xb87a('0x5')](_0x1b4737,_0x134ee3);_0x234f6a(null);};}for(var e in events){if(events[_0xb87a('0x6')](e)){var event=events[e];MailQueue[_0xb87a('0x7')](e,emitEvent(event));}}module[_0xb87a('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xf637=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners','save','remove'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf637,0x187));var _0x7f63=function(_0x38e1a4,_0x41fc3a){_0x38e1a4=_0x38e1a4-0x0;var _0x5504ec=_0xf637[_0x38e1a4];return _0x5504ec;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x7f63('0x0'))['db'][_0x7f63('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7f63('0x2')](0x0);var events={'afterCreate':_0x7f63('0x3'),'afterUpdate':'update','afterDestroy':_0x7f63('0x4')};function emitEvent(_0x42ef8e){return function(_0x1743c5,_0x2644c7,_0x4b1bc1){MailQueueEvents[_0x7f63('0x5')](_0x42ef8e+':'+_0x1743c5['id'],_0x1743c5);MailQueueEvents[_0x7f63('0x5')](_0x42ef8e,_0x1743c5);_0x4b1bc1(null);};}for(var e in events){if(events[_0x7f63('0x6')](e)){var event=events[e];MailQueue[_0x7f63('0x7')](e,emitEvent(event));}}module[_0x7f63('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 4820e8b..b0a6fa9 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 _0x647b=['moment','request-promise','../../config/environment','exports','mail_queues','lodash','../../config/logger'];(function(_0x745c75,_0x3ddc96){var _0x15d6c2=function(_0x14f803){while(--_0x14f803){_0x745c75['push'](_0x745c75['shift']());}};_0x15d6c2(++_0x3ddc96);}(_0x647b,0x140));var _0xb647=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x647b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb647('0x0'));var util=require('util');var logger=require(_0xb647('0x1'))('api');var moment=require(_0xb647('0x2'));var BPromise=require('bluebird');var rp=require(_0xb647('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb647('0x4'));var attributes=require('./mailQueue.attributes');module[_0xb647('0x5')]=function(_0x556cd6,_0x289798){return _0x556cd6['define']('MailQueue',attributes,{'tableName':_0xb647('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6c6=['path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird'];(function(_0x4a2718,_0x2b8edb){var _0x41cddf=function(_0x2924d7){while(--_0x2924d7){_0x4a2718['push'](_0x4a2718['shift']());}};_0x41cddf(++_0x2b8edb);}(_0xf6c6,0xd8));var _0x6f6c=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xf6c6[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x6f6c('0x0'));var util=require('util');var logger=require(_0x6f6c('0x1'))(_0x6f6c('0x2'));var moment=require('moment');var BPromise=require(_0x6f6c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f6c('0x4'));var rimraf=require('rimraf');var config=require(_0x6f6c('0x5'));var attributes=require(_0x6f6c('0x6'));module[_0x6f6c('0x7')]=function(_0x1be931,_0x570230){return _0x1be931[_0x6f6c('0x8')](_0x6f6c('0x9'),attributes,{'tableName':_0x6f6c('0xa'),'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 1dc6669..3ea594e 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 _0x8e87=['raw','attributes','include','map','model','ShowMailQueue','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options'];(function(_0x40601e,_0x3ee87e){var _0x3abf64=function(_0x4eaee3){while(--_0x4eaee3){_0x40601e['push'](_0x40601e['shift']());}};_0x3abf64(++_0x3ee87e);}(_0x8e87,0x1a2));var _0x78e8=function(_0x426c7d,_0x5ad443){_0x426c7d=_0x426c7d-0x0;var _0x26b055=_0x8e87[_0x426c7d];return _0x26b055;};'use strict';var _=require(_0x78e8('0x0'));var util=require(_0x78e8('0x1'));var moment=require(_0x78e8('0x2'));var BPromise=require('bluebird');var rs=require(_0x78e8('0x3'));var fs=require('fs');var Redis=require(_0x78e8('0x4'));var db=require(_0x78e8('0x5'))['db'];var utils=require(_0x78e8('0x6'));var logger=require(_0x78e8('0x7'))(_0x78e8('0x8'));var config=require(_0x78e8('0x9'));var jayson=require(_0x78e8('0xa'));var client=jayson['client'][_0x78e8('0xb')]({'port':0x232a});config[_0x78e8('0xc')]=_[_0x78e8('0xd')](config[_0x78e8('0xc')],{'host':_0x78e8('0xe'),'port':0x18eb});var socket=require(_0x78e8('0xf'))(new Redis(config[_0x78e8('0xc')]));require('./mailQueue.socket')[_0x78e8('0x10')](socket);function respondWithRpcPromise(_0x1d95a0,_0x2707eb,_0x563364){return new BPromise(function(_0x2617f3,_0x4ef3a9){return client[_0x78e8('0x11')](_0x1d95a0,_0x563364)[_0x78e8('0x12')](function(_0x26f931){logger[_0x78e8('0x13')](_0x78e8('0x14'),_0x2707eb,'request\x20sent');logger[_0x78e8('0x15')](_0x78e8('0x16'),_0x2707eb,_0x78e8('0x17'),JSON[_0x78e8('0x18')](_0x26f931));if(_0x26f931[_0x78e8('0x19')]){if(_0x26f931[_0x78e8('0x19')][_0x78e8('0x1a')]===0x1f4){logger[_0x78e8('0x19')](_0x78e8('0x14'),_0x2707eb,_0x26f931[_0x78e8('0x19')][_0x78e8('0x1b')]);return _0x4ef3a9(_0x26f931[_0x78e8('0x19')][_0x78e8('0x1b')]);}logger[_0x78e8('0x19')](_0x78e8('0x14'),_0x2707eb,_0x26f931[_0x78e8('0x19')]['message']);return _0x2617f3(_0x26f931[_0x78e8('0x19')]['message']);}else{logger[_0x78e8('0x13')](_0x78e8('0x14'),_0x2707eb,_0x78e8('0x17'));_0x2617f3(_0x26f931['result']['message']);}})[_0x78e8('0x1c')](function(_0x1624fc){logger[_0x78e8('0x19')]('MailQueue,\x20%s,\x20%s',_0x2707eb,_0x1624fc);_0x4ef3a9(_0x1624fc);});});}exports[_0x78e8('0x1d')]=function(_0x213b7f){var _0x38fe5a=this;return new Promise(function(_0x4269a7,_0x454b34){return db[_0x78e8('0x1e')][_0x78e8('0x1f')]({'raw':_0x213b7f[_0x78e8('0x20')]?_0x213b7f[_0x78e8('0x20')][_0x78e8('0x21')]===undefined?!![]:![]:!![],'where':_0x213b7f[_0x78e8('0x20')]?_0x213b7f['options']['where']||null:null,'attributes':_0x213b7f[_0x78e8('0x20')]?_0x213b7f[_0x78e8('0x20')][_0x78e8('0x22')]||null:null,'limit':_0x213b7f[_0x78e8('0x20')]?_0x213b7f['options']['limit']||null:null,'include':_0x213b7f['options']?_0x213b7f['options'][_0x78e8('0x23')]?_[_0x78e8('0x24')](_0x213b7f[_0x78e8('0x20')][_0x78e8('0x23')],function(_0x4816cd){return{'model':db[_0x4816cd['model']],'as':_0x4816cd['as'],'attributes':_0x4816cd[_0x78e8('0x22')],'include':_0x4816cd[_0x78e8('0x23')]?_['map'](_0x4816cd[_0x78e8('0x23')],function(_0x1eb689){return{'model':db[_0x1eb689['model']],'as':_0x1eb689['as'],'attributes':_0x1eb689[_0x78e8('0x22')],'include':_0x1eb689['include']?_[_0x78e8('0x24')](_0x1eb689['include'],function(_0x4c80b9){return{'model':db[_0x4c80b9[_0x78e8('0x25')]],'as':_0x4c80b9['as'],'attributes':_0x4c80b9[_0x78e8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x78e8('0x12')](function(_0x354a08){logger[_0x78e8('0x13')](_0x78e8('0x1d'),_0x213b7f);logger[_0x78e8('0x15')](_0x78e8('0x1d'),_0x213b7f,JSON[_0x78e8('0x18')](_0x354a08));_0x4269a7(_0x354a08);})[_0x78e8('0x1c')](function(_0x3905db){logger[_0x78e8('0x19')](_0x78e8('0x1d'),_0x3905db[_0x78e8('0x1b')],_0x213b7f);_0x454b34(_0x38fe5a[_0x78e8('0x19')](0x1f4,_0x3905db[_0x78e8('0x1b')]));});});};exports[_0x78e8('0x26')]=function(_0x42229f){var _0x3606bd=this;return new Promise(function(_0x1c195a,_0x1a4fd7){return db[_0x78e8('0x1e')][_0x78e8('0x27')]({'raw':_0x42229f[_0x78e8('0x20')]?_0x42229f[_0x78e8('0x20')][_0x78e8('0x21')]===undefined?!![]:![]:!![],'where':_0x42229f[_0x78e8('0x20')]?_0x42229f[_0x78e8('0x20')][_0x78e8('0x28')]||null:null,'attributes':_0x42229f['options']?_0x42229f[_0x78e8('0x20')][_0x78e8('0x22')]||null:null,'include':_0x42229f[_0x78e8('0x20')]?_0x42229f[_0x78e8('0x20')][_0x78e8('0x23')]?_['map'](_0x42229f['options'][_0x78e8('0x23')],function(_0x3a8b6a){return{'model':db[_0x3a8b6a['model']],'as':_0x3a8b6a['as'],'attributes':_0x3a8b6a[_0x78e8('0x22')],'include':_0x3a8b6a[_0x78e8('0x23')]?_[_0x78e8('0x24')](_0x3a8b6a['include'],function(_0x53a084){return{'model':db[_0x53a084[_0x78e8('0x25')]],'as':_0x53a084['as'],'attributes':_0x53a084[_0x78e8('0x22')],'include':_0x53a084['include']?_[_0x78e8('0x24')](_0x53a084[_0x78e8('0x23')],function(_0x2888e4){return{'model':db[_0x2888e4[_0x78e8('0x25')]],'as':_0x2888e4['as'],'attributes':_0x2888e4[_0x78e8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x78e8('0x12')](function(_0x404e9d){logger[_0x78e8('0x13')](_0x78e8('0x26'),_0x42229f);logger['debug'](_0x78e8('0x26'),_0x42229f,JSON[_0x78e8('0x18')](_0x404e9d));_0x1c195a(_0x404e9d);})[_0x78e8('0x1c')](function(_0x37aea3){logger[_0x78e8('0x19')](_0x78e8('0x26'),_0x37aea3['message'],_0x42229f);_0x1a4fd7(_0x3606bd[_0x78e8('0x19')](0x1f4,_0x37aea3[_0x78e8('0x1b')]));});});}; \ No newline at end of file +var _0xd4c9=['result','GetMailQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','catch','ShowMailQueue','find','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x5bbf6a,_0x29460a){var _0x5d051a=function(_0x2c76a7){while(--_0x2c76a7){_0x5bbf6a['push'](_0x5bbf6a['shift']());}};_0x5d051a(++_0x29460a);}(_0xd4c9,0x1bd));var _0x9d4c=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xd4c9[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x9d4c('0x0'));var util=require(_0x9d4c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d4c('0x2'));var fs=require('fs');var Redis=require(_0x9d4c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d4c('0x4'));var logger=require(_0x9d4c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9d4c('0x6'));var client=jayson[_0x9d4c('0x7')]['http']({'port':0x232a});config[_0x9d4c('0x8')]=_[_0x9d4c('0x9')](config[_0x9d4c('0x8')],{'host':_0x9d4c('0xa'),'port':0x18eb});var socket=require(_0x9d4c('0xb'))(new Redis(config[_0x9d4c('0x8')]));require(_0x9d4c('0xc'))[_0x9d4c('0xd')](socket);function respondWithRpcPromise(_0x59cd41,_0x16a890,_0x19b159){return new BPromise(function(_0x4f2da4,_0xf211e4){return client[_0x9d4c('0xe')](_0x59cd41,_0x19b159)['then'](function(_0x591920){logger['info'](_0x9d4c('0xf'),_0x16a890,_0x9d4c('0x10'));logger['debug'](_0x9d4c('0x11'),_0x16a890,_0x9d4c('0x10'),JSON[_0x9d4c('0x12')](_0x591920));if(_0x591920[_0x9d4c('0x13')]){if(_0x591920['error'][_0x9d4c('0x14')]===0x1f4){logger[_0x9d4c('0x13')](_0x9d4c('0xf'),_0x16a890,_0x591920['error'][_0x9d4c('0x15')]);return _0xf211e4(_0x591920[_0x9d4c('0x13')][_0x9d4c('0x15')]);}logger[_0x9d4c('0x13')](_0x9d4c('0xf'),_0x16a890,_0x591920[_0x9d4c('0x13')]['message']);return _0x4f2da4(_0x591920[_0x9d4c('0x13')][_0x9d4c('0x15')]);}else{logger[_0x9d4c('0x16')](_0x9d4c('0xf'),_0x16a890,_0x9d4c('0x10'));_0x4f2da4(_0x591920[_0x9d4c('0x17')][_0x9d4c('0x15')]);}})['catch'](function(_0x7abb02){logger[_0x9d4c('0x13')](_0x9d4c('0xf'),_0x16a890,_0x7abb02);_0xf211e4(_0x7abb02);});});}exports[_0x9d4c('0x18')]=function(_0x32dac7){var _0x468b16=this;return new Promise(function(_0x248339,_0x4bbbf0){return db['MailQueue'][_0x9d4c('0x19')]({'raw':_0x32dac7[_0x9d4c('0x1a')]?_0x32dac7[_0x9d4c('0x1a')][_0x9d4c('0x1b')]===undefined?!![]:![]:!![],'where':_0x32dac7[_0x9d4c('0x1a')]?_0x32dac7['options'][_0x9d4c('0x1c')]||null:null,'attributes':_0x32dac7[_0x9d4c('0x1a')]?_0x32dac7['options'][_0x9d4c('0x1d')]||null:null,'limit':_0x32dac7[_0x9d4c('0x1a')]?_0x32dac7[_0x9d4c('0x1a')][_0x9d4c('0x1e')]||null:null,'include':_0x32dac7['options']?_0x32dac7['options'][_0x9d4c('0x1f')]?_['map'](_0x32dac7[_0x9d4c('0x1a')][_0x9d4c('0x1f')],function(_0x173c83){return{'model':db[_0x173c83[_0x9d4c('0x20')]],'as':_0x173c83['as'],'attributes':_0x173c83[_0x9d4c('0x1d')],'include':_0x173c83[_0x9d4c('0x1f')]?_[_0x9d4c('0x21')](_0x173c83['include'],function(_0x3c0ea4){return{'model':db[_0x3c0ea4[_0x9d4c('0x20')]],'as':_0x3c0ea4['as'],'attributes':_0x3c0ea4[_0x9d4c('0x1d')],'include':_0x3c0ea4['include']?_[_0x9d4c('0x21')](_0x3c0ea4['include'],function(_0x5f26a1){return{'model':db[_0x5f26a1[_0x9d4c('0x20')]],'as':_0x5f26a1['as'],'attributes':_0x5f26a1[_0x9d4c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9d4c('0x22')](function(_0x202e48){logger['info']('GetMailQueue',_0x32dac7);logger[_0x9d4c('0x23')]('GetMailQueue',_0x32dac7,JSON['stringify'](_0x202e48));_0x248339(_0x202e48);})[_0x9d4c('0x24')](function(_0x2a3bc3){logger['error'](_0x9d4c('0x18'),_0x2a3bc3[_0x9d4c('0x15')],_0x32dac7);_0x4bbbf0(_0x468b16[_0x9d4c('0x13')](0x1f4,_0x2a3bc3[_0x9d4c('0x15')]));});});};exports[_0x9d4c('0x25')]=function(_0x2c930d){var _0x171637=this;return new Promise(function(_0x12ccb7,_0x5972a4){return db['MailQueue'][_0x9d4c('0x26')]({'raw':_0x2c930d[_0x9d4c('0x1a')]?_0x2c930d[_0x9d4c('0x1a')][_0x9d4c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c930d['options']?_0x2c930d[_0x9d4c('0x1a')][_0x9d4c('0x1c')]||null:null,'attributes':_0x2c930d[_0x9d4c('0x1a')]?_0x2c930d[_0x9d4c('0x1a')][_0x9d4c('0x1d')]||null:null,'include':_0x2c930d['options']?_0x2c930d[_0x9d4c('0x1a')]['include']?_[_0x9d4c('0x21')](_0x2c930d[_0x9d4c('0x1a')]['include'],function(_0x268b15){return{'model':db[_0x268b15[_0x9d4c('0x20')]],'as':_0x268b15['as'],'attributes':_0x268b15[_0x9d4c('0x1d')],'include':_0x268b15[_0x9d4c('0x1f')]?_['map'](_0x268b15[_0x9d4c('0x1f')],function(_0x17738b){return{'model':db[_0x17738b['model']],'as':_0x17738b['as'],'attributes':_0x17738b['attributes'],'include':_0x17738b[_0x9d4c('0x1f')]?_[_0x9d4c('0x21')](_0x17738b[_0x9d4c('0x1f')],function(_0x3fce81){return{'model':db[_0x3fce81[_0x9d4c('0x20')]],'as':_0x3fce81['as'],'attributes':_0x3fce81[_0x9d4c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9d4c('0x22')](function(_0x2ea799){logger['info']('ShowMailQueue',_0x2c930d);logger['debug'](_0x9d4c('0x25'),_0x2c930d,JSON[_0x9d4c('0x12')](_0x2ea799));_0x12ccb7(_0x2ea799);})[_0x9d4c('0x24')](function(_0x2e2984){logger['error'](_0x9d4c('0x25'),_0x2e2984[_0x9d4c('0x15')],_0x2c930d);_0x5972a4(_0x171637[_0x9d4c('0x13')](0x1f4,_0x2e2984[_0x9d4c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 074f2a7..eac0190 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 _0x122a=['update','emit','removeListener','register','./mailQueue.events','save','remove'];(function(_0x3d825a,_0x7ef0a5){var _0xbe1609=function(_0x572ac2){while(--_0x572ac2){_0x3d825a['push'](_0x3d825a['shift']());}};_0xbe1609(++_0x7ef0a5);}(_0x122a,0xba));var _0xa122=function(_0x387a4d,_0x371322){_0x387a4d=_0x387a4d-0x0;var _0x300c70=_0x122a[_0x387a4d];return _0x300c70;};'use strict';var MailQueueEvents=require(_0xa122('0x0'));var events=[_0xa122('0x1'),_0xa122('0x2'),_0xa122('0x3')];function createListener(_0x223434,_0x4db0d3){return function(_0x5cbed0){_0x4db0d3[_0xa122('0x4')](_0x223434,_0x5cbed0);};}function removeListener(_0x54d20a,_0x1c87aa){return function(){MailQueueEvents[_0xa122('0x5')](_0x54d20a,_0x1c87aa);};}exports[_0xa122('0x6')]=function(_0x3c8130){for(var _0x526272=0x0,_0x576d57=events['length'];_0x526272<_0x576d57;_0x526272++){var _0x23e139=events[_0x526272];var _0x190f74=createListener('mailQueue:'+_0x23e139,_0x3c8130);MailQueueEvents['on'](_0x23e139,_0x190f74);}}; \ No newline at end of file +var _0x537a=['length','save','remove','update','emit','removeListener','register'];(function(_0x70373b,_0x1acf73){var _0x2a9ca7=function(_0x13d67e){while(--_0x13d67e){_0x70373b['push'](_0x70373b['shift']());}};_0x2a9ca7(++_0x1acf73);}(_0x537a,0x1ac));var _0xa537=function(_0x2b6644,_0x24706e){_0x2b6644=_0x2b6644-0x0;var _0x2f9e8b=_0x537a[_0x2b6644];return _0x2f9e8b;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xa537('0x0'),_0xa537('0x1'),_0xa537('0x2')];function createListener(_0x42e462,_0xd5939f){return function(_0xf5edda){_0xd5939f[_0xa537('0x3')](_0x42e462,_0xf5edda);};}function removeListener(_0x2d83c4,_0x88b9ba){return function(){MailQueueEvents[_0xa537('0x4')](_0x2d83c4,_0x88b9ba);};}exports[_0xa537('0x5')]=function(_0x5e7487){for(var _0x1f8c26=0x0,_0x4ba363=events[_0xa537('0x6')];_0x1f8c26<_0x4ba363;_0x1f8c26++){var _0x12fd7f=events[_0x1f8c26];var _0x542260=createListener('mailQueue:'+_0x12fd7f,_0x5e7487);MailQueueEvents['on'](_0x12fd7f,_0x542260);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 54a46b5..729e989 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 _0xa739=['post','create','put','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x407451,_0x192803){var _0x5008b7=function(_0x1c61e0){while(--_0x1c61e0){_0x407451['push'](_0x407451['shift']());}};_0x5008b7(++_0x192803);}(_0xa739,0x136));var _0x9a73=function(_0x4415a7,_0x1c8454){_0x4415a7=_0x4415a7-0x0;var _0x325797=_0xa739[_0x4415a7];return _0x325797;};'use strict';var multer=require('multer');var util=require(_0x9a73('0x0'));var path=require(_0x9a73('0x1'));var timeout=require('connect-timeout');var express=require(_0x9a73('0x2'));var router=express[_0x9a73('0x3')]();var fs_extra=require(_0x9a73('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9a73('0x5'));var config=require(_0x9a73('0x6'));var controller=require('./mailQueueReport.controller');router[_0x9a73('0x7')]('/',auth[_0x9a73('0x8')](),controller[_0x9a73('0x9')]);router[_0x9a73('0x7')](_0x9a73('0xa'),auth[_0x9a73('0x8')](),controller[_0x9a73('0xb')]);router[_0x9a73('0x7')](_0x9a73('0xc'),auth['isAuthenticated'](),controller[_0x9a73('0xd')]);router[_0x9a73('0xe')]('/',auth[_0x9a73('0x8')](),controller[_0x9a73('0xf')]);router[_0x9a73('0x10')](_0x9a73('0xc'),auth[_0x9a73('0x8')](),controller['update']);router['delete']('/:id',auth[_0x9a73('0x8')](),controller[_0x9a73('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3466=['/describe','isAuthenticated','describe','get','show','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller'];(function(_0x3da3aa,_0xfbfa1f){var _0x1950ee=function(_0x302360){while(--_0x302360){_0x3da3aa['push'](_0x3da3aa['shift']());}};_0x1950ee(++_0xfbfa1f);}(_0x3466,0x11d));var _0x6346=function(_0x5b9cd1,_0x5338f2){_0x5b9cd1=_0x5b9cd1-0x0;var _0x108a3e=_0x3466[_0x5b9cd1];return _0x108a3e;};'use strict';var multer=require(_0x6346('0x0'));var util=require('util');var path=require(_0x6346('0x1'));var timeout=require(_0x6346('0x2'));var express=require(_0x6346('0x3'));var router=express[_0x6346('0x4')]();var fs_extra=require(_0x6346('0x5'));var auth=require(_0x6346('0x6'));var interaction=require(_0x6346('0x7'));var config=require('../../config/environment');var controller=require(_0x6346('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6346('0x9'),auth[_0x6346('0xa')](),controller[_0x6346('0xb')]);router[_0x6346('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x6346('0xd')]);router['post']('/',auth[_0x6346('0xa')](),controller[_0x6346('0xe')]);router[_0x6346('0xf')](_0x6346('0x10'),auth['isAuthenticated'](),controller[_0x6346('0x11')]);router[_0x6346('0x12')](_0x6346('0x10'),auth[_0x6346('0xa')](),controller[_0x6346('0x13')]);module[_0x6346('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 7781673..c7f7344 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 _0xded6=['DATE','moment','sequelize','exports','STRING'];(function(_0xef8198,_0x284916){var _0x26de91=function(_0x3dd046){while(--_0x3dd046){_0xef8198['push'](_0xef8198['shift']());}};_0x26de91(++_0x284916);}(_0xded6,0x1aa));var _0x6ded=function(_0x34ae5b,_0x30981f){_0x34ae5b=_0x34ae5b-0x0;var _0x2fe241=_0xded6[_0x34ae5b];return _0x2fe241;};'use strict';var moment=require(_0x6ded('0x0'));var Sequelize=require(_0x6ded('0x1'));module[_0x6ded('0x2')]={'uniqueid':{'type':Sequelize[_0x6ded('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6ded('0x4')]},'leaveAt':{'type':Sequelize[_0x6ded('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6ded('0x4')]},'reason':{'type':Sequelize[_0x6ded('0x3')]}}; \ No newline at end of file +var _0x8802=['STRING','DATE','moment','exports'];(function(_0x56c3ef,_0x3a7a3e){var _0x1bb5cb=function(_0x341013){while(--_0x341013){_0x56c3ef['push'](_0x56c3ef['shift']());}};_0x1bb5cb(++_0x3a7a3e);}(_0x8802,0x7e));var _0x2880=function(_0x59b533,_0x59fdcc){_0x59b533=_0x59b533-0x0;var _0x2beced=_0x8802[_0x59b533];return _0x2beced;};'use strict';var moment=require(_0x2880('0x0'));var Sequelize=require('sequelize');module[_0x2880('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2880('0x2')]},'joinAt':{'type':Sequelize[_0x2880('0x3')]},'leaveAt':{'type':Sequelize[_0x2880('0x3')]},'acceptAt':{'type':Sequelize[_0x2880('0x3')]},'exitAt':{'type':Sequelize[_0x2880('0x3')]},'reason':{'type':Sequelize[_0x2880('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f2e0bea..da8019e 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 _0x5c3c=['findAll','rows','params','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','MailQueueReport','includeAll','include'];(function(_0x5a2b96,_0x4d16b7){var _0x35787e=function(_0x5db484){while(--_0x5db484){_0x5a2b96['push'](_0x5a2b96['shift']());}};_0x35787e(++_0x4d16b7);}(_0x5c3c,0x132));var _0xc5c3=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x5c3c[_0x45f951];return _0x24756c;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){_0x52d638[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x19')]();});}};}function handleEntityNotFound(_0x38a3df,_0x52e54a){return function(_0x4af067){if(!_0x4af067){_0x38a3df[_0xc5c3('0x24')](0x194);}return _0x4af067;};}function handleError(_0x22f607,_0x20c506){_0x20c506=_0x20c506||0x1f4;return function(_0x29791c){logger['error'](_0x29791c[_0xc5c3('0x25')]);if(_0x29791c['name']){delete _0x29791c[_0xc5c3('0x26')];}_0x22f607['status'](_0x20c506)[_0xc5c3('0x27')](_0x29791c);};}exports[_0xc5c3('0x28')]=function(_0x4269eb,_0x4773c5){var _0x15361c={},_0x2d07e1={},_0x35a397={'count':0x0,'rows':[]};var _0x4b5a0c=_[_0xc5c3('0x29')](db['MailQueueReport'][_0xc5c3('0x2a')],function(_0x43ebfc){return{'name':_0x43ebfc['fieldName'],'type':_0x43ebfc['type'][_0xc5c3('0x2b')]};});_0x2d07e1[_0xc5c3('0x2c')]=_[_0xc5c3('0x29')](_0x4b5a0c,_0xc5c3('0x26'));_0x2d07e1['query']=_[_0xc5c3('0x2d')](_0x4269eb[_0xc5c3('0x2e')]);_0x2d07e1[_0xc5c3('0x2f')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],_0x2d07e1[_0xc5c3('0x2e')]);_0x15361c[_0xc5c3('0x31')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],qs['fields'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x32')]));_0x15361c[_0xc5c3('0x31')]=_0x15361c[_0xc5c3('0x31')][_0xc5c3('0x33')]?_0x15361c[_0xc5c3('0x31')]:_0x2d07e1[_0xc5c3('0x2c')];if(!_0x4269eb['query']['hasOwnProperty'](_0xc5c3('0x34'))){_0x15361c['limit']=qs[_0xc5c3('0x1a')](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);_0x15361c[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0x4269eb['query'][_0xc5c3('0x1c')]);}_0x15361c[_0xc5c3('0x35')]=qs['sort'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x36')]);_0x15361c[_0xc5c3('0x37')]=qs[_0xc5c3('0x2f')](_[_0xc5c3('0x38')](_0x4269eb[_0xc5c3('0x2e')],_0x2d07e1[_0xc5c3('0x2f')]),_0x4b5a0c);if(_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x39')]){_0x15361c[_0xc5c3('0x37')]=_['merge'](_0x15361c[_0xc5c3('0x37')],{'$or':_['map'](_0x4b5a0c,function(_0x4fdbe6){if(_0x4fdbe6[_0xc5c3('0x3a')]!==_0xc5c3('0x3b')){var _0x1b546e={};_0x1b546e[_0x4fdbe6[_0xc5c3('0x26')]]={'$like':'%'+_0x4269eb[_0xc5c3('0x2e')]['filter']+'%'};return _0x1b546e;}})});}_0x15361c=_['merge']({},_0x15361c,_0x4269eb[_0xc5c3('0x3c')]);var _0xa7cb91={'where':_0x15361c['where']};return db[_0xc5c3('0x3d')]['count'](_0xa7cb91)[_0xc5c3('0x23')](function(_0x2dfd19){_0x35a397[_0xc5c3('0x1b')]=_0x2dfd19;if(_0x4269eb['query'][_0xc5c3('0x3e')]){_0x15361c[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['MailQueueReport'][_0xc5c3('0x40')](_0x15361c);})['then'](function(_0x33936c){_0x35a397[_0xc5c3('0x41')]=_0x33936c;return _0x35a397;})['then'](respondWithFilteredResult(_0x4773c5,_0x15361c))['catch'](handleError(_0x4773c5,null));};exports['show']=function(_0xfb64bb,_0x2f02ab){var _0x49b1fc={'raw':!![],'where':{'id':_0xfb64bb[_0xc5c3('0x42')]['id']}},_0x1a8490={};_0x1a8490[_0xc5c3('0x2c')]=_[_0xc5c3('0x2d')](db['MailQueueReport'][_0xc5c3('0x2a')]);_0x1a8490['query']=_['keys'](_0xfb64bb[_0xc5c3('0x2e')]);_0x1a8490[_0xc5c3('0x2f')]=_['intersection'](_0x1a8490[_0xc5c3('0x2c')],_0x1a8490[_0xc5c3('0x2e')]);_0x49b1fc['attributes']=_[_0xc5c3('0x30')](_0x1a8490['model'],qs[_0xc5c3('0x32')](_0xfb64bb[_0xc5c3('0x2e')]['fields']));_0x49b1fc[_0xc5c3('0x31')]=_0x49b1fc['attributes'][_0xc5c3('0x33')]?_0x49b1fc[_0xc5c3('0x31')]:_0x1a8490['model'];if(_0xfb64bb[_0xc5c3('0x2e')][_0xc5c3('0x3e')]){_0x49b1fc[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x49b1fc=_[_0xc5c3('0x43')]({},_0x49b1fc,_0xfb64bb[_0xc5c3('0x3c')]);return db[_0xc5c3('0x3d')]['find'](_0x49b1fc)[_0xc5c3('0x23')](handleEntityNotFound(_0x2f02ab,null))[_0xc5c3('0x23')](respondWithResult(_0x2f02ab,null))[_0xc5c3('0x44')](handleError(_0x2f02ab,null));};exports[_0xc5c3('0x45')]=function(_0x23002b,_0x4a7330){return db['MailQueueReport'][_0xc5c3('0x45')](_0x23002b[_0xc5c3('0x46')],{})[_0xc5c3('0x23')](respondWithResult(_0x4a7330,0xc9))['catch'](handleError(_0x4a7330,null));};exports[_0xc5c3('0x22')]=function(_0x65f720,_0x3a901f){if(_0x65f720[_0xc5c3('0x46')]['id']){delete _0x65f720[_0xc5c3('0x46')]['id'];}return db[_0xc5c3('0x3d')][_0xc5c3('0x47')]({'where':{'id':_0x65f720['params']['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x3a901f,null))[_0xc5c3('0x23')](saveUpdates(_0x65f720[_0xc5c3('0x46')],null))['then'](respondWithResult(_0x3a901f,null))[_0xc5c3('0x44')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x48')]=function(_0x3b1bc2,_0x103bde){return db[_0xc5c3('0x3d')]['find']({'where':{'id':_0x3b1bc2[_0xc5c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x103bde,null))[_0xc5c3('0x23')](removeEntity(_0x103bde,null))['catch'](handleError(_0x103bde,null));};exports[_0xc5c3('0x49')]=function(_0x34a2c3,_0x4add6b){return db[_0xc5c3('0x3d')][_0xc5c3('0x49')]()['then'](respondWithResult(_0x4add6b,null))[_0xc5c3('0x44')](handleError(_0x4add6b,null));}; \ No newline at end of file +var _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5613ae,_0x405aea){var _0x41dd51=function(_0x3a096e){while(--_0x3a096e){_0x5613ae['push'](_0x5613ae['shift']());}};_0x41dd51(++_0x405aea);}(_0x524e,0x15e));var _0xe524=function(_0x11ea94,_0x547cc0){_0x11ea94=_0x11ea94-0x0;var _0x195915=_0x524e[_0x11ea94];return _0x195915;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['MailQueueReport'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['MailQueueReport'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['MailQueueReport'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f6021b7..0b57356 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 _0x9793=['rimraf','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','api','moment','bluebird','request-promise'];(function(_0x29b68d,_0x22601e){var _0x54f929=function(_0x1439c6){while(--_0x1439c6){_0x29b68d['push'](_0x29b68d['shift']());}};_0x54f929(++_0x22601e);}(_0x9793,0x1a3));var _0x3979=function(_0x33a35e,_0x1e9408){_0x33a35e=_0x33a35e-0x0;var _0x5245c4=_0x9793[_0x33a35e];return _0x5245c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3979('0x0'));var moment=require(_0x3979('0x1'));var BPromise=require(_0x3979('0x2'));var rp=require(_0x3979('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3979('0x4'));var config=require('../../config/environment');var attributes=require(_0x3979('0x5'));module['exports']=function(_0x51217c,_0x2ec000){return _0x51217c[_0x3979('0x6')](_0x3979('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x3979('0x8'),'fields':[_0x3979('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5dc=['report_mail_queue','uniqueid','lodash','util','api','bluebird','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0xb7f825,_0x263426){var _0x5a274d=function(_0xb8903f){while(--_0xb8903f){_0xb7f825['push'](_0xb7f825['shift']());}};_0x5a274d(++_0x263426);}(_0xf5dc,0x1be));var _0xcf5d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf5dc[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xcf5d('0x0'));var util=require(_0xcf5d('0x1'));var logger=require('../../config/logger')(_0xcf5d('0x2'));var moment=require('moment');var BPromise=require(_0xcf5d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf5d('0x4'));var rimraf=require(_0xcf5d('0x5'));var config=require('../../config/environment');var attributes=require(_0xcf5d('0x6'));module[_0xcf5d('0x7')]=function(_0x5e79d9,_0x354db6){return _0x5e79d9[_0xcf5d('0x8')](_0xcf5d('0x9'),attributes,{'tableName':_0xcf5d('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcf5d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 51a8cf9..88d75ab 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x1628b3,_0x5f1805){var _0x4bad95=function(_0x1afa12){while(--_0x1afa12){_0x1628b3['push'](_0x1628b3['shift']());}};_0x4bad95(++_0x5f1805);}(_0x2ef3,0xba));var _0x32ef=function(_0x538afc,_0x4d11fe){_0x538afc=_0x538afc-0x0;var _0x1aeb55=_0x2ef3[_0x538afc];return _0x1aeb55;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _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(_0x4acfd4,_0xf3985a){var _0x1f92a6=function(_0x4f3899){while(--_0x4f3899){_0x4acfd4['push'](_0x4acfd4['shift']());}};_0x1f92a6(++_0xf3985a);}(_0x1261,0x144));var _0x1126=function(_0x3a23d3,_0x4088d8){_0x3a23d3=_0x3a23d3-0x0;var _0x10803b=_0x1261[_0x3a23d3];return _0x10803b;};'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 ec07ade..da9be00 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x54afe3,_0x258ce5){var _0x3e76d6=function(_0x328441){while(--_0x328441){_0x54afe3['push'](_0x54afe3['shift']());}};_0x3e76d6(++_0x258ce5);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4838e3,_0x10a009){var _0x1b090f=function(_0x3c5ae1){while(--_0x3c5ae1){_0x4838e3['push'](_0x4838e3['shift']());}};_0x1b090f(++_0x10a009);}(_0x70e0,0x17b));var _0x070e=function(_0x2ef29c,_0x1c6248){_0x2ef29c=_0x2ef29c-0x0;var _0x19883e=_0x70e0[_0x2ef29c];return _0x19883e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 08a8b77..281d681 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 _0x3177=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x145a4d,_0x315b84){var _0x1753a5=function(_0x176bd2){while(--_0x176bd2){_0x145a4d['push'](_0x145a4d['shift']());}};_0x1753a5(++_0x315b84);}(_0x3177,0xda));var _0x7317=function(_0x44fc33,_0x480283){_0x44fc33=_0x44fc33-0x0;var _0x1e64a1=_0x3177[_0x44fc33];return _0x1e64a1;};'use strict';var Sequelize=require(_0x7317('0x0'));module[_0x7317('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7317('0x2')]},'authentication':{'type':Sequelize[_0x7317('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7317('0x2')]},'port':{'type':Sequelize[_0x7317('0x4')]},'tls':{'type':Sequelize[_0x7317('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7317('0x2')],'defaultValue':_0x7317('0x5')},'connTimeout':{'type':Sequelize[_0x7317('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x7317('0x2')]},'modernAuthentication':{'type':Sequelize[_0x7317('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4362=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x5ec140,_0x32f3aa){var _0x4c8230=function(_0x25f709){while(--_0x25f709){_0x5ec140['push'](_0x5ec140['shift']());}};_0x4c8230(++_0x32f3aa);}(_0x4362,0xdd));var _0x2436=function(_0xd8d7dd,_0x28c33f){_0xd8d7dd=_0xd8d7dd-0x0;var _0x27d8e9=_0x4362[_0xd8d7dd];return _0x27d8e9;};'use strict';var Sequelize=require(_0x2436('0x0'));module[_0x2436('0x1')]={'description':{'type':Sequelize[_0x2436('0x2')]},'host':{'type':Sequelize[_0x2436('0x2')]},'authentication':{'type':Sequelize[_0x2436('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2436('0x4')]},'tls':{'type':Sequelize[_0x2436('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2436('0x2')],'defaultValue':_0x2436('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x2436('0x2')]},'modernAuthentication':{'type':Sequelize[_0x2436('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0e6edfa..d5384a0 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 _0x15a7=['../../config/environment','exports','define','mail_servers_in','lodash','bluebird','request-promise','path','rimraf'];(function(_0x1aba4a,_0x727e00){var _0x10cbde=function(_0x3d985e){while(--_0x3d985e){_0x1aba4a['push'](_0x1aba4a['shift']());}};_0x10cbde(++_0x727e00);}(_0x15a7,0x79));var _0x715a=function(_0x2ba66e,_0x5a390d){_0x2ba66e=_0x2ba66e-0x0;var _0x48584b=_0x15a7[_0x2ba66e];return _0x48584b;};'use strict';var _=require(_0x715a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x715a('0x1'));var rp=require(_0x715a('0x2'));var fs=require('fs');var path=require(_0x715a('0x3'));var rimraf=require(_0x715a('0x4'));var config=require(_0x715a('0x5'));var attributes=require('./mailServerIn.attributes');module[_0x715a('0x6')]=function(_0x323cec,_0x4acabf){return _0x323cec[_0x715a('0x7')]('MailServerIn',attributes,{'tableName':_0x715a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf381=['../../config/logger','request-promise','rimraf','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf381,0x6a));var _0x1f38=function(_0xd75f21,_0x28dfcc){_0xd75f21=_0xd75f21-0x0;var _0x4e5f83=_0xf381[_0xd75f21];return _0x4e5f83;};'use strict';var _=require(_0x1f38('0x0'));var util=require(_0x1f38('0x1'));var logger=require(_0x1f38('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1f38('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f38('0x4'));var config=require('../../config/environment');var attributes=require(_0x1f38('0x5'));module[_0x1f38('0x6')]=function(_0x4aad0f,_0x5650da){return _0x4aad0f['define'](_0x1f38('0x7'),attributes,{'tableName':_0x1f38('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 27202c4..a967d63 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 _0x565c=['request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailServerIn','findAll','options','raw','where','limit','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x2c5d97,_0x490f3a){var _0x1976e0=function(_0x5e0713){while(--_0x5e0713){_0x2c5d97['push'](_0x2c5d97['shift']());}};_0x1976e0(++_0x490f3a);}(_0x565c,0x73));var _0xc565=function(_0x52bd69,_0x570765){_0x52bd69=_0x52bd69-0x0;var _0x281822=_0x565c[_0x52bd69];return _0x281822;};'use strict';var _=require(_0xc565('0x0'));var util=require(_0xc565('0x1'));var moment=require(_0xc565('0x2'));var BPromise=require(_0xc565('0x3'));var rs=require(_0xc565('0x4'));var fs=require('fs');var Redis=require(_0xc565('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc565('0x6'));var config=require(_0xc565('0x7'));var jayson=require(_0xc565('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x226477,_0x4959ff,_0x2d8278){return new BPromise(function(_0x228e36,_0x1c3147){return client[_0xc565('0x9')](_0x226477,_0x2d8278)[_0xc565('0xa')](function(_0x3841c7){logger['info'](_0xc565('0xb'),_0x4959ff,_0xc565('0xc'));logger['debug'](_0xc565('0xd'),_0x4959ff,_0xc565('0xc'),JSON[_0xc565('0xe')](_0x3841c7));if(_0x3841c7[_0xc565('0xf')]){if(_0x3841c7[_0xc565('0xf')][_0xc565('0x10')]===0x1f4){logger[_0xc565('0xf')](_0xc565('0xb'),_0x4959ff,_0x3841c7[_0xc565('0xf')]['message']);return _0x1c3147(_0x3841c7['error']['message']);}logger['error'](_0xc565('0xb'),_0x4959ff,_0x3841c7[_0xc565('0xf')]['message']);return _0x228e36(_0x3841c7[_0xc565('0xf')][_0xc565('0x11')]);}else{logger[_0xc565('0x12')](_0xc565('0xb'),_0x4959ff,_0xc565('0xc'));_0x228e36(_0x3841c7[_0xc565('0x13')][_0xc565('0x11')]);}})[_0xc565('0x14')](function(_0x2818bd){logger[_0xc565('0xf')](_0xc565('0xb'),_0x4959ff,_0x2818bd);_0x1c3147(_0x2818bd);});});}exports[_0xc565('0x15')]=function(_0x16cabe){var _0x368069=this;return new Promise(function(_0x275e7b,_0x4fbace){return db['MailServerIn'][_0xc565('0x16')]({'raw':_0x16cabe[_0xc565('0x17')]?_0x16cabe[_0xc565('0x17')][_0xc565('0x18')]===undefined?!![]:![]:!![],'where':_0x16cabe['options']?_0x16cabe[_0xc565('0x17')][_0xc565('0x19')]||null:null,'attributes':_0x16cabe[_0xc565('0x17')]?_0x16cabe[_0xc565('0x17')]['attributes']||null:null,'limit':_0x16cabe[_0xc565('0x17')]?_0x16cabe[_0xc565('0x17')][_0xc565('0x1a')]||null:null,'include':_0x16cabe[_0xc565('0x17')]?_0x16cabe[_0xc565('0x17')][_0xc565('0x1b')]?_['map'](_0x16cabe['options'][_0xc565('0x1b')],function(_0x422a6c){return{'model':db[_0x422a6c[_0xc565('0x1c')]],'as':_0x422a6c['as'],'attributes':_0x422a6c[_0xc565('0x1d')],'include':_0x422a6c[_0xc565('0x1b')]?_['map'](_0x422a6c['include'],function(_0x2d3961){return{'model':db[_0x2d3961[_0xc565('0x1c')]],'as':_0x2d3961['as'],'attributes':_0x2d3961[_0xc565('0x1d')],'include':_0x2d3961['include']?_[_0xc565('0x1e')](_0x2d3961[_0xc565('0x1b')],function(_0x39c49d){return{'model':db[_0x39c49d[_0xc565('0x1c')]],'as':_0x39c49d['as'],'attributes':_0x39c49d[_0xc565('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42a0c9){logger[_0xc565('0x12')](_0xc565('0x15'),_0x16cabe);logger['debug'](_0xc565('0x15'),_0x16cabe,JSON[_0xc565('0xe')](_0x42a0c9));_0x275e7b(_0x42a0c9);})[_0xc565('0x14')](function(_0xd8ea12){logger[_0xc565('0xf')](_0xc565('0x15'),_0xd8ea12[_0xc565('0x11')],_0x16cabe);_0x4fbace(_0x368069['error'](0x1f4,_0xd8ea12[_0xc565('0x11')]));});});}; \ No newline at end of file +var _0x6a98=['error','message','GetMailServerIn','MailServerIn','findAll','raw','options','attributes','limit','include','map','model','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x12b887,_0x1b3197){var _0x285c6f=function(_0x22ebcf){while(--_0x22ebcf){_0x12b887['push'](_0x12b887['shift']());}};_0x285c6f(++_0x1b3197);}(_0x6a98,0xc7));var _0x86a9=function(_0x2aeca6,_0x565154){_0x2aeca6=_0x2aeca6-0x0;var _0x48c8c9=_0x6a98[_0x2aeca6];return _0x48c8c9;};'use strict';var _=require('lodash');var util=require(_0x86a9('0x0'));var moment=require('moment');var BPromise=require(_0x86a9('0x1'));var rs=require(_0x86a9('0x2'));var fs=require('fs');var Redis=require(_0x86a9('0x3'));var db=require(_0x86a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x86a9('0x5'))('rpc');var config=require(_0x86a9('0x6'));var jayson=require(_0x86a9('0x7'));var client=jayson[_0x86a9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26afb9,_0x4856ce,_0x3d6fea){return new BPromise(function(_0x32452c,_0x41d624){return client[_0x86a9('0x9')](_0x26afb9,_0x3d6fea)[_0x86a9('0xa')](function(_0x5b1cfd){logger[_0x86a9('0xb')](_0x86a9('0xc'),_0x4856ce,_0x86a9('0xd'));logger[_0x86a9('0xe')](_0x86a9('0xf'),_0x4856ce,_0x86a9('0xd'),JSON[_0x86a9('0x10')](_0x5b1cfd));if(_0x5b1cfd['error']){if(_0x5b1cfd['error'][_0x86a9('0x11')]===0x1f4){logger[_0x86a9('0x12')](_0x86a9('0xc'),_0x4856ce,_0x5b1cfd['error']['message']);return _0x41d624(_0x5b1cfd['error'][_0x86a9('0x13')]);}logger[_0x86a9('0x12')]('MailServerIn,\x20%s,\x20%s',_0x4856ce,_0x5b1cfd[_0x86a9('0x12')][_0x86a9('0x13')]);return _0x32452c(_0x5b1cfd[_0x86a9('0x12')][_0x86a9('0x13')]);}else{logger[_0x86a9('0xb')](_0x86a9('0xc'),_0x4856ce,_0x86a9('0xd'));_0x32452c(_0x5b1cfd['result'][_0x86a9('0x13')]);}})['catch'](function(_0x3b6502){logger[_0x86a9('0x12')](_0x86a9('0xc'),_0x4856ce,_0x3b6502);_0x41d624(_0x3b6502);});});}exports[_0x86a9('0x14')]=function(_0x151b1b){var _0x4101cf=this;return new Promise(function(_0x1461c0,_0x2a292f){return db[_0x86a9('0x15')][_0x86a9('0x16')]({'raw':_0x151b1b['options']?_0x151b1b['options'][_0x86a9('0x17')]===undefined?!![]:![]:!![],'where':_0x151b1b[_0x86a9('0x18')]?_0x151b1b[_0x86a9('0x18')]['where']||null:null,'attributes':_0x151b1b[_0x86a9('0x18')]?_0x151b1b[_0x86a9('0x18')][_0x86a9('0x19')]||null:null,'limit':_0x151b1b['options']?_0x151b1b[_0x86a9('0x18')][_0x86a9('0x1a')]||null:null,'include':_0x151b1b['options']?_0x151b1b[_0x86a9('0x18')][_0x86a9('0x1b')]?_[_0x86a9('0x1c')](_0x151b1b[_0x86a9('0x18')][_0x86a9('0x1b')],function(_0xc53f0a){return{'model':db[_0xc53f0a['model']],'as':_0xc53f0a['as'],'attributes':_0xc53f0a[_0x86a9('0x19')],'include':_0xc53f0a['include']?_[_0x86a9('0x1c')](_0xc53f0a[_0x86a9('0x1b')],function(_0x4e3e83){return{'model':db[_0x4e3e83[_0x86a9('0x1d')]],'as':_0x4e3e83['as'],'attributes':_0x4e3e83[_0x86a9('0x19')],'include':_0x4e3e83['include']?_[_0x86a9('0x1c')](_0x4e3e83[_0x86a9('0x1b')],function(_0x284dbc){return{'model':db[_0x284dbc[_0x86a9('0x1d')]],'as':_0x284dbc['as'],'attributes':_0x284dbc[_0x86a9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86a9('0xa')](function(_0x49a322){logger[_0x86a9('0xb')](_0x86a9('0x14'),_0x151b1b);logger[_0x86a9('0xe')]('GetMailServerIn',_0x151b1b,JSON[_0x86a9('0x10')](_0x49a322));_0x1461c0(_0x49a322);})[_0x86a9('0x1e')](function(_0x218f5a){logger['error'](_0x86a9('0x14'),_0x218f5a[_0x86a9('0x13')],_0x151b1b);_0x2a292f(_0x4101cf['error'](0x1f4,_0x218f5a[_0x86a9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index bd02d7e..dc08cc0 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7a54,0x106));var _0x47a5=function(_0x260ff5,_0x4f6492){_0x260ff5=_0x260ff5-0x0;var _0x5593f3=_0x7a54[_0x260ff5];return _0x5593f3;};'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 cff157e..cabff9d 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 _0x0102=['exports','STRING','BOOLEAN'];(function(_0x2e2292,_0x1891b8){var _0x4f77ab=function(_0x3e5cb6){while(--_0x3e5cb6){_0x2e2292['push'](_0x2e2292['shift']());}};_0x4f77ab(++_0x1891b8);}(_0x0102,0x186));var _0x2010=function(_0x562e57,_0x1a262f){_0x562e57=_0x562e57-0x0;var _0x4bb191=_0x0102[_0x562e57];return _0x4bb191;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'description':{'type':Sequelize[_0x2010('0x1')]},'host':{'type':Sequelize[_0x2010('0x1')]},'user':{'type':Sequelize[_0x2010('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2010('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb78e=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb78e,0x1c9));var _0xeb78=function(_0x72a7aa,_0x197397){_0x72a7aa=_0x72a7aa-0x0;var _0x59bb4f=_0xb78e[_0x72a7aa];return _0x59bb4f;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeb78('0x2')]},'user':{'type':Sequelize[_0xeb78('0x2')]},'pass':{'type':Sequelize[_0xeb78('0x2')]},'port':{'type':Sequelize[_0xeb78('0x3')]},'secure':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb78('0x2')]},'authentication':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7a9b993..da2c613 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 _0x16e0=['catch','show','keys','length','include','find','create','body','params','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','destroy','then','end','error','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x16e0,0xe1));var _0x016e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16e0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x016e('0x0'));var jsonpatch=require(_0x016e('0x1'));var rp=require('request-promise');var moment=require(_0x016e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x016e('0x3'));var util=require(_0x016e('0x4'));var path=require(_0x016e('0x5'));var sox=require(_0x016e('0x6'));var csv=require(_0x016e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x016e('0x8'));var _=require(_0x016e('0x9'));var squel=require(_0x016e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x016e('0xb'));var toCsv=require(_0x016e('0x7'));var querystring=require(_0x016e('0xc'));var Papa=require(_0x016e('0xd'));var Redis=require(_0x016e('0xe'));var authService=require(_0x016e('0xf'));var qs=require(_0x016e('0x10'));var as=require(_0x016e('0x11'));var hardwareService=require(_0x016e('0x12'));var logger=require(_0x016e('0x13'))(_0x016e('0x14'));var utils=require(_0x016e('0x15'));var config=require(_0x016e('0x16'));var licenseUtil=require(_0x016e('0x17'));var db=require(_0x016e('0x18'))['db'];function respondWithStatusCode(_0x53d71e,_0x3d7f18){_0x3d7f18=_0x3d7f18||0xcc;return function(_0x5b916a){if(_0x5b916a){return _0x53d71e[_0x016e('0x19')](_0x3d7f18);}return _0x53d71e[_0x016e('0x1a')](_0x3d7f18)['end']();};}function respondWithResult(_0x16267c,_0x5b29bd){_0x5b29bd=_0x5b29bd||0xc8;return function(_0x2ad63f){if(_0x2ad63f){return _0x16267c[_0x016e('0x1a')](_0x5b29bd)[_0x016e('0x1b')](_0x2ad63f);}};}function respondWithFilteredResult(_0x394f8e,_0x242e38){return function(_0x1ae019){if(_0x1ae019){var _0x5cb8e8=typeof _0x242e38[_0x016e('0x1c')]===_0x016e('0x1d')&&typeof _0x242e38[_0x016e('0x1e')]===_0x016e('0x1d');var _0x41b1cc=_0x1ae019[_0x016e('0x1f')];var _0x30d8dd=_0x5cb8e8?0x0:_0x242e38[_0x016e('0x1c')];var _0x3d126d=_0x5cb8e8?_0x1ae019[_0x016e('0x1f')]:_0x242e38[_0x016e('0x1c')]+_0x242e38[_0x016e('0x1e')];var _0x1d26f1;if(_0x3d126d>=_0x41b1cc){_0x3d126d=_0x41b1cc;_0x1d26f1=0xc8;}else{_0x1d26f1=0xce;}_0x394f8e[_0x016e('0x1a')](_0x1d26f1);return _0x394f8e[_0x016e('0x20')]('Content-Range',_0x30d8dd+'-'+_0x3d126d+'/'+_0x41b1cc)[_0x016e('0x1b')](_0x1ae019);}return null;};}function patchUpdates(_0x1d7feb){return function(_0x4bde79){try{jsonpatch[_0x016e('0x21')](_0x4bde79,_0x1d7feb,!![]);}catch(_0x2964f5){return BPromise['reject'](_0x2964f5);}return _0x4bde79['save']();};}function saveUpdates(_0x24db6d,_0x5d258c){return function(_0x321b2f){if(_0x321b2f){return _0x321b2f[_0x016e('0x22')](_0x24db6d)['then'](function(_0xadec88){return _0xadec88;});}return null;};}function removeEntity(_0x15c7e0,_0x5c25cd){return function(_0xcc7365){if(_0xcc7365){return _0xcc7365[_0x016e('0x23')]()[_0x016e('0x24')](function(){_0x15c7e0[_0x016e('0x1a')](0xcc)[_0x016e('0x25')]();});}};}function handleEntityNotFound(_0x669388,_0x138a9b){return function(_0x1e9be4){if(!_0x1e9be4){_0x669388[_0x016e('0x19')](0x194);}return _0x1e9be4;};}function handleError(_0xe39d97,_0x182f83){_0x182f83=_0x182f83||0x1f4;return function(_0x774bc4){logger[_0x016e('0x26')](_0x774bc4['stack']);if(_0x774bc4[_0x016e('0x27')]){delete _0x774bc4[_0x016e('0x27')];}_0xe39d97[_0x016e('0x1a')](_0x182f83)[_0x016e('0x28')](_0x774bc4);};}exports['index']=function(_0x197d7c,_0x2cca4e){var _0x53967a={},_0x34e982={},_0x3b6096={'count':0x0,'rows':[]};var _0x22e1cd=_[_0x016e('0x29')](db[_0x016e('0x2a')][_0x016e('0x2b')],function(_0x4c6062){return{'name':_0x4c6062[_0x016e('0x2c')],'type':_0x4c6062[_0x016e('0x2d')][_0x016e('0x2e')]};});_0x34e982[_0x016e('0x2f')]=_[_0x016e('0x29')](_0x22e1cd,_0x016e('0x27'));_0x34e982[_0x016e('0x30')]=_['keys'](_0x197d7c[_0x016e('0x30')]);_0x34e982['filters']=_[_0x016e('0x31')](_0x34e982[_0x016e('0x2f')],_0x34e982[_0x016e('0x30')]);_0x53967a[_0x016e('0x32')]=_['intersection'](_0x34e982[_0x016e('0x2f')],qs[_0x016e('0x33')](_0x197d7c[_0x016e('0x30')][_0x016e('0x33')]));_0x53967a[_0x016e('0x32')]=_0x53967a['attributes']['length']?_0x53967a[_0x016e('0x32')]:_0x34e982[_0x016e('0x2f')];if(!_0x197d7c[_0x016e('0x30')]['hasOwnProperty'](_0x016e('0x34'))){_0x53967a[_0x016e('0x1e')]=qs[_0x016e('0x1e')](_0x197d7c[_0x016e('0x30')][_0x016e('0x1e')]);_0x53967a['offset']=qs[_0x016e('0x1c')](_0x197d7c[_0x016e('0x30')][_0x016e('0x1c')]);}_0x53967a[_0x016e('0x35')]=qs[_0x016e('0x36')](_0x197d7c[_0x016e('0x30')][_0x016e('0x36')]);_0x53967a[_0x016e('0x37')]=qs[_0x016e('0x38')](_['pick'](_0x197d7c['query'],_0x34e982[_0x016e('0x38')]),_0x22e1cd);if(_0x197d7c['query'][_0x016e('0x39')]){_0x53967a[_0x016e('0x37')]=_[_0x016e('0x3a')](_0x53967a['where'],{'$or':_[_0x016e('0x29')](_0x22e1cd,function(_0x10820c){if(_0x10820c[_0x016e('0x2d')]!==_0x016e('0x3b')){var _0x16fc7e={};_0x16fc7e[_0x10820c['name']]={'$like':'%'+_0x197d7c[_0x016e('0x30')][_0x016e('0x39')]+'%'};return _0x16fc7e;}})});}_0x53967a=_[_0x016e('0x3a')]({},_0x53967a,_0x197d7c[_0x016e('0x3c')]);var _0x22378e={'where':_0x53967a['where']};return db['MailServerOut'][_0x016e('0x1f')](_0x22378e)[_0x016e('0x24')](function(_0x262508){_0x3b6096['count']=_0x262508;if(_0x197d7c[_0x016e('0x30')][_0x016e('0x3d')]){_0x53967a['include']=[{'all':!![]}];}return db[_0x016e('0x2a')]['findAll'](_0x53967a);})[_0x016e('0x24')](function(_0x537941){_0x3b6096[_0x016e('0x3e')]=_0x537941;return _0x3b6096;})[_0x016e('0x24')](respondWithFilteredResult(_0x2cca4e,_0x53967a))[_0x016e('0x3f')](handleError(_0x2cca4e,null));};exports[_0x016e('0x40')]=function(_0x4ddfe1,_0x46a69b){var _0x2859bc={'raw':!![],'where':{'id':_0x4ddfe1['params']['id']}},_0xb56afb={};_0xb56afb['model']=_[_0x016e('0x41')](db['MailServerOut'][_0x016e('0x2b')]);_0xb56afb[_0x016e('0x30')]=_['keys'](_0x4ddfe1[_0x016e('0x30')]);_0xb56afb['filters']=_['intersection'](_0xb56afb['model'],_0xb56afb[_0x016e('0x30')]);_0x2859bc['attributes']=_[_0x016e('0x31')](_0xb56afb[_0x016e('0x2f')],qs[_0x016e('0x33')](_0x4ddfe1[_0x016e('0x30')][_0x016e('0x33')]));_0x2859bc[_0x016e('0x32')]=_0x2859bc[_0x016e('0x32')][_0x016e('0x42')]?_0x2859bc['attributes']:_0xb56afb[_0x016e('0x2f')];if(_0x4ddfe1['query'][_0x016e('0x3d')]){_0x2859bc[_0x016e('0x43')]=[{'all':!![]}];}_0x2859bc=_['merge']({},_0x2859bc,_0x4ddfe1[_0x016e('0x3c')]);return db[_0x016e('0x2a')][_0x016e('0x44')](_0x2859bc)['then'](handleEntityNotFound(_0x46a69b,null))[_0x016e('0x24')](respondWithResult(_0x46a69b,null))[_0x016e('0x3f')](handleError(_0x46a69b,null));};exports[_0x016e('0x45')]=function(_0x4b3c4a,_0x1a64d3){return db[_0x016e('0x2a')][_0x016e('0x45')](_0x4b3c4a[_0x016e('0x46')],{})['then'](respondWithResult(_0x1a64d3,0xc9))[_0x016e('0x3f')](handleError(_0x1a64d3,null));};exports[_0x016e('0x22')]=function(_0x39803f,_0x3da98b){if(_0x39803f[_0x016e('0x46')]['id']){delete _0x39803f[_0x016e('0x46')]['id'];}return db[_0x016e('0x2a')]['find']({'where':{'id':_0x39803f[_0x016e('0x47')]['id']}})[_0x016e('0x24')](handleEntityNotFound(_0x3da98b,null))[_0x016e('0x24')](saveUpdates(_0x39803f['body'],null))[_0x016e('0x24')](respondWithResult(_0x3da98b,null))['catch'](handleError(_0x3da98b,null));};exports[_0x016e('0x23')]=function(_0x288ca0,_0x2a30d4){return db[_0x016e('0x2a')][_0x016e('0x44')]({'where':{'id':_0x288ca0[_0x016e('0x47')]['id']}})[_0x016e('0x24')](handleEntityNotFound(_0x2a30d4,null))[_0x016e('0x24')](removeEntity(_0x2a30d4,null))[_0x016e('0x3f')](handleError(_0x2a30d4,null));}; \ No newline at end of file +var _0x9ff7=['VIRTUAL','filter','options','includeAll','include','MailServerOut','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../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','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge'];(function(_0xbf734e,_0x563ffc){var _0x25d851=function(_0x5a5098){while(--_0x5a5098){_0xbf734e['push'](_0xbf734e['shift']());}};_0x25d851(++_0x563ffc);}(_0x9ff7,0x136));var _0x79ff=function(_0x474bde,_0x198621){_0x474bde=_0x474bde-0x0;var _0x21aca4=_0x9ff7[_0x474bde];return _0x21aca4;};'use strict';var emlformat=require(_0x79ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79ff('0x1'));var jsonpatch=require(_0x79ff('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79ff('0x3'));var Mustache=require(_0x79ff('0x4'));var util=require('util');var path=require(_0x79ff('0x5'));var sox=require(_0x79ff('0x6'));var csv=require(_0x79ff('0x7'));var ejs=require(_0x79ff('0x8'));var fs=require('fs');var fs_extra=require(_0x79ff('0x9'));var _=require('lodash');var squel=require(_0x79ff('0xa'));var crypto=require(_0x79ff('0xb'));var jsforce=require(_0x79ff('0xc'));var deskjs=require(_0x79ff('0xd'));var toCsv=require(_0x79ff('0x7'));var querystring=require('querystring');var Papa=require(_0x79ff('0xe'));var Redis=require('ioredis');var authService=require(_0x79ff('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x79ff('0x10'));var hardwareService=require(_0x79ff('0x11'));var logger=require(_0x79ff('0x12'))(_0x79ff('0x13'));var utils=require(_0x79ff('0x14'));var config=require(_0x79ff('0x15'));var licenseUtil=require(_0x79ff('0x16'));var db=require(_0x79ff('0x17'))['db'];function respondWithStatusCode(_0x39f7b4,_0xfcf855){_0xfcf855=_0xfcf855||0xcc;return function(_0x2a5361){if(_0x2a5361){return _0x39f7b4[_0x79ff('0x18')](_0xfcf855);}return _0x39f7b4[_0x79ff('0x19')](_0xfcf855)['end']();};}function respondWithResult(_0x39fc4b,_0x381686){_0x381686=_0x381686||0xc8;return function(_0x40c219){if(_0x40c219){return _0x39fc4b[_0x79ff('0x19')](_0x381686)['json'](_0x40c219);}};}function respondWithFilteredResult(_0x60082f,_0x5f063f){return function(_0x478632){if(_0x478632){var _0x4a5af5=typeof _0x5f063f[_0x79ff('0x1a')]===_0x79ff('0x1b')&&typeof _0x5f063f[_0x79ff('0x1c')]==='undefined';var _0x2b3000=_0x478632[_0x79ff('0x1d')];var _0x2d632c=_0x4a5af5?0x0:_0x5f063f[_0x79ff('0x1a')];var _0x3afef6=_0x4a5af5?_0x478632['count']:_0x5f063f['offset']+_0x5f063f['limit'];var _0xb3ccf6;if(_0x3afef6>=_0x2b3000){_0x3afef6=_0x2b3000;_0xb3ccf6=0xc8;}else{_0xb3ccf6=0xce;}_0x60082f[_0x79ff('0x19')](_0xb3ccf6);return _0x60082f[_0x79ff('0x1e')](_0x79ff('0x1f'),_0x2d632c+'-'+_0x3afef6+'/'+_0x2b3000)[_0x79ff('0x20')](_0x478632);}return null;};}function patchUpdates(_0x521eb4){return function(_0x3bce9c){try{jsonpatch[_0x79ff('0x21')](_0x3bce9c,_0x521eb4,!![]);}catch(_0x598b2c){return BPromise[_0x79ff('0x22')](_0x598b2c);}return _0x3bce9c[_0x79ff('0x23')]();};}function saveUpdates(_0x2ec077,_0x39f8ae){return function(_0x505923){if(_0x505923){return _0x505923[_0x79ff('0x24')](_0x2ec077)[_0x79ff('0x25')](function(_0x127d0a){return _0x127d0a;});}return null;};}function removeEntity(_0x5d9dd1,_0x57a82f){return function(_0x3bf452){if(_0x3bf452){return _0x3bf452['destroy']()[_0x79ff('0x25')](function(){_0x5d9dd1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d9363,_0x5b44eb){return function(_0x510d3f){if(!_0x510d3f){_0x1d9363[_0x79ff('0x18')](0x194);}return _0x510d3f;};}function handleError(_0x29bad1,_0x118082){_0x118082=_0x118082||0x1f4;return function(_0x183cb7){logger[_0x79ff('0x26')](_0x183cb7[_0x79ff('0x27')]);if(_0x183cb7['name']){delete _0x183cb7[_0x79ff('0x28')];}_0x29bad1[_0x79ff('0x19')](_0x118082)[_0x79ff('0x29')](_0x183cb7);};}exports[_0x79ff('0x2a')]=function(_0x570fa8,_0x248829){var _0x23dfdd={},_0x19a060={},_0x42cb14={'count':0x0,'rows':[]};var _0x1f396c=_[_0x79ff('0x2b')](db['MailServerOut'][_0x79ff('0x2c')],function(_0x2b0410){return{'name':_0x2b0410[_0x79ff('0x2d')],'type':_0x2b0410[_0x79ff('0x2e')][_0x79ff('0x2f')]};});_0x19a060[_0x79ff('0x30')]=_[_0x79ff('0x2b')](_0x1f396c,_0x79ff('0x28'));_0x19a060[_0x79ff('0x31')]=_['keys'](_0x570fa8['query']);_0x19a060[_0x79ff('0x32')]=_[_0x79ff('0x33')](_0x19a060[_0x79ff('0x30')],_0x19a060[_0x79ff('0x31')]);_0x23dfdd['attributes']=_[_0x79ff('0x33')](_0x19a060[_0x79ff('0x30')],qs[_0x79ff('0x34')](_0x570fa8[_0x79ff('0x31')]['fields']));_0x23dfdd['attributes']=_0x23dfdd[_0x79ff('0x35')][_0x79ff('0x36')]?_0x23dfdd['attributes']:_0x19a060[_0x79ff('0x30')];if(!_0x570fa8[_0x79ff('0x31')]['hasOwnProperty'](_0x79ff('0x37'))){_0x23dfdd[_0x79ff('0x1c')]=qs[_0x79ff('0x1c')](_0x570fa8[_0x79ff('0x31')]['limit']);_0x23dfdd[_0x79ff('0x1a')]=qs[_0x79ff('0x1a')](_0x570fa8[_0x79ff('0x31')][_0x79ff('0x1a')]);}_0x23dfdd[_0x79ff('0x38')]=qs[_0x79ff('0x39')](_0x570fa8['query']['sort']);_0x23dfdd['where']=qs[_0x79ff('0x32')](_['pick'](_0x570fa8[_0x79ff('0x31')],_0x19a060[_0x79ff('0x32')]),_0x1f396c);if(_0x570fa8[_0x79ff('0x31')]['filter']){_0x23dfdd[_0x79ff('0x3a')]=_[_0x79ff('0x3b')](_0x23dfdd[_0x79ff('0x3a')],{'$or':_[_0x79ff('0x2b')](_0x1f396c,function(_0x147db5){if(_0x147db5[_0x79ff('0x2e')]!==_0x79ff('0x3c')){var _0x162b79={};_0x162b79[_0x147db5[_0x79ff('0x28')]]={'$like':'%'+_0x570fa8[_0x79ff('0x31')][_0x79ff('0x3d')]+'%'};return _0x162b79;}})});}_0x23dfdd=_[_0x79ff('0x3b')]({},_0x23dfdd,_0x570fa8[_0x79ff('0x3e')]);var _0x259a02={'where':_0x23dfdd[_0x79ff('0x3a')]};return db['MailServerOut']['count'](_0x259a02)['then'](function(_0x2b1477){_0x42cb14[_0x79ff('0x1d')]=_0x2b1477;if(_0x570fa8[_0x79ff('0x31')][_0x79ff('0x3f')]){_0x23dfdd[_0x79ff('0x40')]=[{'all':!![]}];}return db[_0x79ff('0x41')]['findAll'](_0x23dfdd);})[_0x79ff('0x25')](function(_0x548297){_0x42cb14[_0x79ff('0x42')]=_0x548297;return _0x42cb14;})[_0x79ff('0x25')](respondWithFilteredResult(_0x248829,_0x23dfdd))[_0x79ff('0x43')](handleError(_0x248829,null));};exports[_0x79ff('0x44')]=function(_0x5cea7b,_0xabe883){var _0x28a37b={'raw':!![],'where':{'id':_0x5cea7b[_0x79ff('0x45')]['id']}},_0x1d9db3={};_0x1d9db3[_0x79ff('0x30')]=_[_0x79ff('0x46')](db[_0x79ff('0x41')][_0x79ff('0x2c')]);_0x1d9db3[_0x79ff('0x31')]=_[_0x79ff('0x46')](_0x5cea7b[_0x79ff('0x31')]);_0x1d9db3[_0x79ff('0x32')]=_[_0x79ff('0x33')](_0x1d9db3[_0x79ff('0x30')],_0x1d9db3[_0x79ff('0x31')]);_0x28a37b['attributes']=_[_0x79ff('0x33')](_0x1d9db3[_0x79ff('0x30')],qs['fields'](_0x5cea7b[_0x79ff('0x31')]['fields']));_0x28a37b[_0x79ff('0x35')]=_0x28a37b[_0x79ff('0x35')]['length']?_0x28a37b[_0x79ff('0x35')]:_0x1d9db3[_0x79ff('0x30')];if(_0x5cea7b[_0x79ff('0x31')][_0x79ff('0x3f')]){_0x28a37b[_0x79ff('0x40')]=[{'all':!![]}];}_0x28a37b=_['merge']({},_0x28a37b,_0x5cea7b[_0x79ff('0x3e')]);return db[_0x79ff('0x41')][_0x79ff('0x47')](_0x28a37b)[_0x79ff('0x25')](handleEntityNotFound(_0xabe883,null))[_0x79ff('0x25')](respondWithResult(_0xabe883,null))[_0x79ff('0x43')](handleError(_0xabe883,null));};exports[_0x79ff('0x48')]=function(_0x3f2ff1,_0x61593d){return db[_0x79ff('0x41')][_0x79ff('0x48')](_0x3f2ff1[_0x79ff('0x49')],{})['then'](respondWithResult(_0x61593d,0xc9))[_0x79ff('0x43')](handleError(_0x61593d,null));};exports[_0x79ff('0x24')]=function(_0x2add7c,_0x737b4b){if(_0x2add7c[_0x79ff('0x49')]['id']){delete _0x2add7c[_0x79ff('0x49')]['id'];}return db[_0x79ff('0x41')][_0x79ff('0x47')]({'where':{'id':_0x2add7c[_0x79ff('0x45')]['id']}})[_0x79ff('0x25')](handleEntityNotFound(_0x737b4b,null))[_0x79ff('0x25')](saveUpdates(_0x2add7c[_0x79ff('0x49')],null))[_0x79ff('0x25')](respondWithResult(_0x737b4b,null))['catch'](handleError(_0x737b4b,null));};exports['destroy']=function(_0x85fd1,_0x4b08e9){return db['MailServerOut'][_0x79ff('0x47')]({'where':{'id':_0x85fd1[_0x79ff('0x45')]['id']}})[_0x79ff('0x25')](handleEntityNotFound(_0x4b08e9,null))['then'](removeEntity(_0x4b08e9,null))[_0x79ff('0x43')](handleError(_0x4b08e9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 88fe57b..823c221 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 _0xff91=['exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise','path','./mailServerOut.attributes'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xff91,0x10c));var _0x1ff9=function(_0x5bb9bb,_0x4b5fbb){_0x5bb9bb=_0x5bb9bb-0x0;var _0x3b6bdf=_0xff91[_0x5bb9bb];return _0x3b6bdf;};'use strict';var _=require(_0x1ff9('0x0'));var util=require(_0x1ff9('0x1'));var logger=require(_0x1ff9('0x2'))(_0x1ff9('0x3'));var moment=require('moment');var BPromise=require(_0x1ff9('0x4'));var rp=require(_0x1ff9('0x5'));var fs=require('fs');var path=require(_0x1ff9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ff9('0x7'));module[_0x1ff9('0x8')]=function(_0x8fe3e2,_0x1c68a0){return _0x8fe3e2[_0x1ff9('0x9')](_0x1ff9('0xa'),attributes,{'tableName':_0x1ff9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5244=['define','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0x5244,0xe2));var _0x4524=function(_0x1df591,_0x216efc){_0x1df591=_0x1df591-0x0;var _0x5bedc7=_0x5244[_0x1df591];return _0x5bedc7;};'use strict';var _=require(_0x4524('0x0'));var util=require(_0x4524('0x1'));var logger=require(_0x4524('0x2'))(_0x4524('0x3'));var moment=require(_0x4524('0x4'));var BPromise=require(_0x4524('0x5'));var rp=require(_0x4524('0x6'));var fs=require('fs');var path=require(_0x4524('0x7'));var rimraf=require(_0x4524('0x8'));var config=require(_0x4524('0x9'));var attributes=require(_0x4524('0xa'));module[_0x4524('0xb')]=function(_0x15139e,_0x113283){return _0x15139e[_0x4524('0xc')]('MailServerOut',attributes,{'tableName':_0x4524('0xd'),'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 9a99b95..066a2e9 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x3c2746,_0xfed187){var _0x18a686=function(_0x297271){while(--_0x297271){_0x3c2746['push'](_0x3c2746['shift']());}};_0x18a686(++_0xfed187);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\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(_0x11b7b3,_0x197a85){var _0x2e5e5f=function(_0x26becd){while(--_0x26becd){_0x11b7b3['push'](_0x11b7b3['shift']());}};_0x2e5e5f(++_0x197a85);}(_0x1261,0x144));var _0x1126=function(_0x3bc82d,_0x59187f){_0x3bc82d=_0x3bc82d-0x0;var _0x2cfb3d=_0x1261[_0x3bc82d];return _0x2cfb3d;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 028048a..8d347eb 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 _0xf4e2=['fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x3b6f35,_0x4c512f){var _0x35a800=function(_0x28d7c5){while(--_0x28d7c5){_0x3b6f35['push'](_0x3b6f35['shift']());}};_0x35a800(++_0x4c512f);}(_0xf4e2,0xa3));var _0x2f4e=function(_0x2a00dd,_0x10da34){_0x2a00dd=_0x2a00dd-0x0;var _0x54613f=_0xf4e2[_0x2a00dd];return _0x54613f;};'use strict';var multer=require(_0x2f4e('0x0'));var util=require(_0x2f4e('0x1'));var path=require('path');var timeout=require(_0x2f4e('0x2'));var express=require(_0x2f4e('0x3'));var router=express[_0x2f4e('0x4')]();var fs_extra=require(_0x2f4e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2f4e('0x6'));var config=require(_0x2f4e('0x7'));var controller=require(_0x2f4e('0x8'));router[_0x2f4e('0x9')]('/',auth[_0x2f4e('0xa')](),controller[_0x2f4e('0xb')]);router[_0x2f4e('0x9')]('/describe',auth[_0x2f4e('0xa')](),controller[_0x2f4e('0xc')]);router[_0x2f4e('0x9')](_0x2f4e('0xd'),auth[_0x2f4e('0xa')](),controller[_0x2f4e('0xe')]);router[_0x2f4e('0xf')]('/',auth['isAuthenticated'](),controller[_0x2f4e('0x10')]);router[_0x2f4e('0x11')](_0x2f4e('0xd'),auth[_0x2f4e('0xa')](),controller[_0x2f4e('0x12')]);router[_0x2f4e('0x13')](_0x2f4e('0xd'),auth[_0x2f4e('0xa')](),controller[_0x2f4e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe296=['get','isAuthenticated','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1cb7ee,_0x521c98){var _0x5764c1=function(_0x197731){while(--_0x197731){_0x1cb7ee['push'](_0x1cb7ee['shift']());}};_0x5764c1(++_0x521c98);}(_0xe296,0x186));var _0x6e29=function(_0x801bdb,_0x261b61){_0x801bdb=_0x801bdb-0x0;var _0xfe915c=_0xe296[_0x801bdb];return _0xfe915c;};'use strict';var multer=require(_0x6e29('0x0'));var util=require(_0x6e29('0x1'));var path=require(_0x6e29('0x2'));var timeout=require(_0x6e29('0x3'));var express=require('express');var router=express[_0x6e29('0x4')]();var fs_extra=require(_0x6e29('0x5'));var auth=require(_0x6e29('0x6'));var interaction=require(_0x6e29('0x7'));var config=require(_0x6e29('0x8'));var controller=require('./mailSubstatus.controller');router[_0x6e29('0x9')]('/',auth[_0x6e29('0xa')](),controller['index']);router[_0x6e29('0x9')](_0x6e29('0xb'),auth[_0x6e29('0xa')](),controller['describe']);router[_0x6e29('0x9')]('/:id',auth[_0x6e29('0xa')](),controller[_0x6e29('0xc')]);router[_0x6e29('0xd')]('/',auth[_0x6e29('0xa')](),controller[_0x6e29('0xe')]);router[_0x6e29('0xf')](_0x6e29('0x10'),auth[_0x6e29('0xa')](),controller[_0x6e29('0x11')]);router[_0x6e29('0x12')](_0x6e29('0x10'),auth['isAuthenticated'](),controller[_0x6e29('0x13')]);module[_0x6e29('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7caad41..dd43d4a 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 _0xda19=['STRING','exports'];(function(_0x1ce9a7,_0x3fc14d){var _0xc83e8f=function(_0x4a2620){while(--_0x4a2620){_0x1ce9a7['push'](_0x1ce9a7['shift']());}};_0xc83e8f(++_0x3fc14d);}(_0xda19,0xd5));var _0x9da1=function(_0x4b17aa,_0x2534d9){_0x4b17aa=_0x4b17aa-0x0;var _0x5a7e38=_0xda19[_0x4b17aa];return _0x5a7e38;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9da1('0x1')]}}; \ No newline at end of file +var _0xafdd=['STRING','name','sequelize','exports'];(function(_0x5abde5,_0x13be16){var _0x2933fd=function(_0x684e38){while(--_0x684e38){_0x5abde5['push'](_0x5abde5['shift']());}};_0x2933fd(++_0x13be16);}(_0xafdd,0x19a));var _0xdafd=function(_0x1ed28b,_0x51376f){_0x1ed28b=_0x1ed28b-0x0;var _0x2d7746=_0xafdd[_0x1ed28b];return _0x2d7746;};'use strict';var Sequelize=require(_0xdafd('0x0'));module[_0xdafd('0x1')]={'name':{'type':Sequelize[_0xdafd('0x2')],'unique':_0xdafd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdafd('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index ad43910..fde3886 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 _0xafb4=['type','VIRTUAL','filter','merge','include','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','reject','update','then','destroy','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0xafb4,0x124));var _0x4afb=function(_0x598965,_0xf1c449){_0x598965=_0x598965-0x0;var _0x37c71c=_0xafb4[_0x598965];return _0x37c71c;};'use strict';var emlformat=require(_0x4afb('0x0'));var rimraf=require(_0x4afb('0x1'));var zipdir=require(_0x4afb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4afb('0x3'));var Mustache=require(_0x4afb('0x4'));var util=require(_0x4afb('0x5'));var path=require(_0x4afb('0x6'));var sox=require('sox');var csv=require(_0x4afb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4afb('0x8'));var _=require('lodash');var squel=require(_0x4afb('0x9'));var crypto=require(_0x4afb('0xa'));var jsforce=require(_0x4afb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4afb('0x7'));var querystring=require(_0x4afb('0xc'));var Papa=require(_0x4afb('0xd'));var Redis=require(_0x4afb('0xe'));var authService=require(_0x4afb('0xf'));var qs=require(_0x4afb('0x10'));var as=require(_0x4afb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4afb('0x12'));var config=require(_0x4afb('0x13'));var licenseUtil=require(_0x4afb('0x14'));var db=require(_0x4afb('0x15'))['db'];function respondWithStatusCode(_0x4bcaa9,_0x16e655){_0x16e655=_0x16e655||0xcc;return function(_0x405813){if(_0x405813){return _0x4bcaa9['sendStatus'](_0x16e655);}return _0x4bcaa9[_0x4afb('0x16')](_0x16e655)[_0x4afb('0x17')]();};}function respondWithResult(_0x322e89,_0x564637){_0x564637=_0x564637||0xc8;return function(_0x11037c){if(_0x11037c){return _0x322e89['status'](_0x564637)[_0x4afb('0x18')](_0x11037c);}};}function respondWithFilteredResult(_0xae22c,_0x7b492b){return function(_0x3b14a0){if(_0x3b14a0){var _0x24a58f=typeof _0x7b492b['offset']===_0x4afb('0x19')&&typeof _0x7b492b['limit']==='undefined';var _0x4a9394=_0x3b14a0[_0x4afb('0x1a')];var _0x14b263=_0x24a58f?0x0:_0x7b492b[_0x4afb('0x1b')];var _0x4fad05=_0x24a58f?_0x3b14a0[_0x4afb('0x1a')]:_0x7b492b['offset']+_0x7b492b[_0x4afb('0x1c')];var _0x2aff51;if(_0x4fad05>=_0x4a9394){_0x4fad05=_0x4a9394;_0x2aff51=0xc8;}else{_0x2aff51=0xce;}_0xae22c[_0x4afb('0x16')](_0x2aff51);return _0xae22c['set'](_0x4afb('0x1d'),_0x14b263+'-'+_0x4fad05+'/'+_0x4a9394)[_0x4afb('0x18')](_0x3b14a0);}return null;};}function patchUpdates(_0xc8334c){return function(_0x25fe46){try{jsonpatch['apply'](_0x25fe46,_0xc8334c,!![]);}catch(_0x206df3){return BPromise[_0x4afb('0x1e')](_0x206df3);}return _0x25fe46['save']();};}function saveUpdates(_0x2cfd1f,_0x4ab2ce){return function(_0x606799){if(_0x606799){return _0x606799[_0x4afb('0x1f')](_0x2cfd1f)[_0x4afb('0x20')](function(_0x5c218d){return _0x5c218d;});}return null;};}function removeEntity(_0xc625ee,_0x597641){return function(_0x380d38){if(_0x380d38){return _0x380d38[_0x4afb('0x21')]()[_0x4afb('0x20')](function(){_0xc625ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7275,_0x119d43){return function(_0x20068e){if(!_0x20068e){_0x1c7275['sendStatus'](0x194);}return _0x20068e;};}function handleError(_0x9ec463,_0x754b6f){_0x754b6f=_0x754b6f||0x1f4;return function(_0x3f36ad){logger['error'](_0x3f36ad[_0x4afb('0x22')]);if(_0x3f36ad[_0x4afb('0x23')]){delete _0x3f36ad[_0x4afb('0x23')];}_0x9ec463[_0x4afb('0x16')](_0x754b6f)[_0x4afb('0x24')](_0x3f36ad);};}exports['index']=function(_0x512c5f,_0x3dfa46){var _0x467d9f={},_0x1bdf1f={},_0x244d74={'count':0x0,'rows':[]};var _0x3b3e55=_[_0x4afb('0x25')](db[_0x4afb('0x26')][_0x4afb('0x27')],function(_0x3a5741){return{'name':_0x3a5741[_0x4afb('0x28')],'type':_0x3a5741['type'][_0x4afb('0x29')]};});_0x1bdf1f[_0x4afb('0x2a')]=_[_0x4afb('0x25')](_0x3b3e55,_0x4afb('0x23'));_0x1bdf1f[_0x4afb('0x2b')]=_['keys'](_0x512c5f[_0x4afb('0x2b')]);_0x1bdf1f[_0x4afb('0x2c')]=_[_0x4afb('0x2d')](_0x1bdf1f['model'],_0x1bdf1f[_0x4afb('0x2b')]);_0x467d9f[_0x4afb('0x2e')]=_[_0x4afb('0x2d')](_0x1bdf1f[_0x4afb('0x2a')],qs[_0x4afb('0x2f')](_0x512c5f[_0x4afb('0x2b')]['fields']));_0x467d9f['attributes']=_0x467d9f[_0x4afb('0x2e')][_0x4afb('0x30')]?_0x467d9f[_0x4afb('0x2e')]:_0x1bdf1f['model'];if(!_0x512c5f[_0x4afb('0x2b')]['hasOwnProperty'](_0x4afb('0x31'))){_0x467d9f['limit']=qs[_0x4afb('0x1c')](_0x512c5f[_0x4afb('0x2b')]['limit']);_0x467d9f[_0x4afb('0x1b')]=qs[_0x4afb('0x1b')](_0x512c5f['query'][_0x4afb('0x1b')]);}_0x467d9f[_0x4afb('0x32')]=qs['sort'](_0x512c5f[_0x4afb('0x2b')][_0x4afb('0x33')]);_0x467d9f[_0x4afb('0x34')]=qs[_0x4afb('0x2c')](_['pick'](_0x512c5f[_0x4afb('0x2b')],_0x1bdf1f[_0x4afb('0x2c')]),_0x3b3e55);if(_0x512c5f[_0x4afb('0x2b')]['filter']){_0x467d9f[_0x4afb('0x34')]=_['merge'](_0x467d9f[_0x4afb('0x34')],{'$or':_['map'](_0x3b3e55,function(_0x3bf71b){if(_0x3bf71b[_0x4afb('0x35')]!==_0x4afb('0x36')){var _0x21f410={};_0x21f410[_0x3bf71b[_0x4afb('0x23')]]={'$like':'%'+_0x512c5f['query'][_0x4afb('0x37')]+'%'};return _0x21f410;}})});}_0x467d9f=_[_0x4afb('0x38')]({},_0x467d9f,_0x512c5f['options']);var _0x2f8ddf={'where':_0x467d9f['where']};return db[_0x4afb('0x26')][_0x4afb('0x1a')](_0x2f8ddf)['then'](function(_0x1550d8){_0x244d74[_0x4afb('0x1a')]=_0x1550d8;if(_0x512c5f['query']['includeAll']){_0x467d9f[_0x4afb('0x39')]=[{'all':!![]}];}return db[_0x4afb('0x26')]['findAll'](_0x467d9f);})[_0x4afb('0x20')](function(_0x46e968){_0x244d74[_0x4afb('0x3a')]=_0x46e968;return _0x244d74;})['then'](respondWithFilteredResult(_0x3dfa46,_0x467d9f))[_0x4afb('0x3b')](handleError(_0x3dfa46,null));};exports[_0x4afb('0x3c')]=function(_0x3dfa64,_0x24eace){var _0xd314b7={'raw':!![],'where':{'id':_0x3dfa64[_0x4afb('0x3d')]['id']}},_0x1ae66b={};_0x1ae66b[_0x4afb('0x2a')]=_[_0x4afb('0x3e')](db[_0x4afb('0x26')][_0x4afb('0x27')]);_0x1ae66b['query']=_['keys'](_0x3dfa64[_0x4afb('0x2b')]);_0x1ae66b[_0x4afb('0x2c')]=_['intersection'](_0x1ae66b[_0x4afb('0x2a')],_0x1ae66b[_0x4afb('0x2b')]);_0xd314b7[_0x4afb('0x2e')]=_['intersection'](_0x1ae66b[_0x4afb('0x2a')],qs['fields'](_0x3dfa64[_0x4afb('0x2b')][_0x4afb('0x2f')]));_0xd314b7[_0x4afb('0x2e')]=_0xd314b7[_0x4afb('0x2e')][_0x4afb('0x30')]?_0xd314b7[_0x4afb('0x2e')]:_0x1ae66b[_0x4afb('0x2a')];if(_0x3dfa64[_0x4afb('0x2b')][_0x4afb('0x3f')]){_0xd314b7[_0x4afb('0x39')]=[{'all':!![]}];}_0xd314b7=_[_0x4afb('0x38')]({},_0xd314b7,_0x3dfa64[_0x4afb('0x40')]);return db[_0x4afb('0x26')][_0x4afb('0x41')](_0xd314b7)[_0x4afb('0x20')](handleEntityNotFound(_0x24eace,null))['then'](respondWithResult(_0x24eace,null))[_0x4afb('0x3b')](handleError(_0x24eace,null));};exports[_0x4afb('0x42')]=function(_0x58fa5b,_0x4fd4ee){return db[_0x4afb('0x26')][_0x4afb('0x42')](_0x58fa5b[_0x4afb('0x43')],{})[_0x4afb('0x20')](respondWithResult(_0x4fd4ee,0xc9))['catch'](handleError(_0x4fd4ee,null));};exports[_0x4afb('0x1f')]=function(_0x409920,_0x15051c){if(_0x409920[_0x4afb('0x43')]['id']){delete _0x409920['body']['id'];}return db['MailSubstatus'][_0x4afb('0x41')]({'where':{'id':_0x409920['params']['id']}})['then'](handleEntityNotFound(_0x15051c,null))[_0x4afb('0x20')](saveUpdates(_0x409920['body'],null))[_0x4afb('0x20')](respondWithResult(_0x15051c,null))[_0x4afb('0x3b')](handleError(_0x15051c,null));};exports[_0x4afb('0x21')]=function(_0x41e7fa,_0xecfd87){return db[_0x4afb('0x26')][_0x4afb('0x41')]({'where':{'id':_0x41e7fa['params']['id']}})[_0x4afb('0x20')](handleEntityNotFound(_0xecfd87,null))[_0x4afb('0x20')](removeEntity(_0xecfd87,null))[_0x4afb('0x3b')](handleError(_0xecfd87,null));};exports[_0x4afb('0x44')]=function(_0x5314b6,_0x50251e){return db['MailSubstatus'][_0x4afb('0x44')]()[_0x4afb('0x20')](respondWithResult(_0x50251e,null))[_0x4afb('0x3b')](handleError(_0x50251e,null));}; \ No newline at end of file +var _0xea1b=['where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter'];(function(_0x2a8e1f,_0x53d9dd){var _0x3a965d=function(_0x5aab1a){while(--_0x5aab1a){_0x2a8e1f['push'](_0x2a8e1f['shift']());}};_0x3a965d(++_0x53d9dd);}(_0xea1b,0x144));var _0xbea1=function(_0xb38bae,_0x5d93a7){_0xb38bae=_0xb38bae-0x0;var _0x562e92=_0xea1b[_0xb38bae];return _0x562e92;};'use strict';var emlformat=require(_0xbea1('0x0'));var rimraf=require(_0xbea1('0x1'));var zipdir=require(_0xbea1('0x2'));var jsonpatch=require(_0xbea1('0x3'));var rp=require(_0xbea1('0x4'));var moment=require(_0xbea1('0x5'));var BPromise=require(_0xbea1('0x6'));var Mustache=require(_0xbea1('0x7'));var util=require(_0xbea1('0x8'));var path=require(_0xbea1('0x9'));var sox=require('sox');var csv=require(_0xbea1('0xa'));var ejs=require(_0xbea1('0xb'));var fs=require('fs');var fs_extra=require(_0xbea1('0xc'));var _=require(_0xbea1('0xd'));var squel=require(_0xbea1('0xe'));var crypto=require(_0xbea1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbea1('0x10'));var toCsv=require(_0xbea1('0xa'));var querystring=require(_0xbea1('0x11'));var Papa=require(_0xbea1('0x12'));var Redis=require(_0xbea1('0x13'));var authService=require(_0xbea1('0x14'));var qs=require(_0xbea1('0x15'));var as=require(_0xbea1('0x16'));var hardwareService=require(_0xbea1('0x17'));var logger=require('../../config/logger')(_0xbea1('0x18'));var utils=require('../../config/utils');var config=require(_0xbea1('0x19'));var licenseUtil=require(_0xbea1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c7638,_0x4d8058){_0x4d8058=_0x4d8058||0xcc;return function(_0x2cece8){if(_0x2cece8){return _0x5c7638['sendStatus'](_0x4d8058);}return _0x5c7638[_0xbea1('0x1b')](_0x4d8058)[_0xbea1('0x1c')]();};}function respondWithResult(_0x5650ec,_0x340da9){_0x340da9=_0x340da9||0xc8;return function(_0x2420d0){if(_0x2420d0){return _0x5650ec[_0xbea1('0x1b')](_0x340da9)['json'](_0x2420d0);}};}function respondWithFilteredResult(_0x2a9e38,_0x4225f8){return function(_0x14a4fd){if(_0x14a4fd){var _0x3c4d20=typeof _0x4225f8[_0xbea1('0x1d')]===_0xbea1('0x1e')&&typeof _0x4225f8['limit']===_0xbea1('0x1e');var _0x3e3c70=_0x14a4fd[_0xbea1('0x1f')];var _0x332b86=_0x3c4d20?0x0:_0x4225f8[_0xbea1('0x1d')];var _0x51bdea=_0x3c4d20?_0x14a4fd[_0xbea1('0x1f')]:_0x4225f8[_0xbea1('0x1d')]+_0x4225f8['limit'];var _0x4a5595;if(_0x51bdea>=_0x3e3c70){_0x51bdea=_0x3e3c70;_0x4a5595=0xc8;}else{_0x4a5595=0xce;}_0x2a9e38['status'](_0x4a5595);return _0x2a9e38[_0xbea1('0x20')](_0xbea1('0x21'),_0x332b86+'-'+_0x51bdea+'/'+_0x3e3c70)[_0xbea1('0x22')](_0x14a4fd);}return null;};}function patchUpdates(_0x2826c1){return function(_0x447fb6){try{jsonpatch[_0xbea1('0x23')](_0x447fb6,_0x2826c1,!![]);}catch(_0x333cd4){return BPromise[_0xbea1('0x24')](_0x333cd4);}return _0x447fb6['save']();};}function saveUpdates(_0x447a03,_0x1b6b03){return function(_0x441200){if(_0x441200){return _0x441200[_0xbea1('0x25')](_0x447a03)[_0xbea1('0x26')](function(_0x504602){return _0x504602;});}return null;};}function removeEntity(_0x339d98,_0x57ae6b){return function(_0xea8c8f){if(_0xea8c8f){return _0xea8c8f[_0xbea1('0x27')]()['then'](function(){_0x339d98[_0xbea1('0x1b')](0xcc)[_0xbea1('0x1c')]();});}};}function handleEntityNotFound(_0xbd2ad9,_0x198642){return function(_0xb3e4ff){if(!_0xb3e4ff){_0xbd2ad9[_0xbea1('0x28')](0x194);}return _0xb3e4ff;};}function handleError(_0x2c689b,_0x4955f7){_0x4955f7=_0x4955f7||0x1f4;return function(_0xa832fe){logger[_0xbea1('0x29')](_0xa832fe[_0xbea1('0x2a')]);if(_0xa832fe[_0xbea1('0x2b')]){delete _0xa832fe['name'];}_0x2c689b['status'](_0x4955f7)[_0xbea1('0x2c')](_0xa832fe);};}exports[_0xbea1('0x2d')]=function(_0x165155,_0x4716f8){var _0x1cf817={},_0x9c584b={},_0x2b25b2={'count':0x0,'rows':[]};var _0xe3aab2=_[_0xbea1('0x2e')](db[_0xbea1('0x2f')][_0xbea1('0x30')],function(_0x343b4e){return{'name':_0x343b4e[_0xbea1('0x31')],'type':_0x343b4e[_0xbea1('0x32')][_0xbea1('0x33')]};});_0x9c584b[_0xbea1('0x34')]=_['map'](_0xe3aab2,'name');_0x9c584b[_0xbea1('0x35')]=_[_0xbea1('0x36')](_0x165155[_0xbea1('0x35')]);_0x9c584b[_0xbea1('0x37')]=_[_0xbea1('0x38')](_0x9c584b[_0xbea1('0x34')],_0x9c584b[_0xbea1('0x35')]);_0x1cf817['attributes']=_['intersection'](_0x9c584b[_0xbea1('0x34')],qs[_0xbea1('0x39')](_0x165155[_0xbea1('0x35')][_0xbea1('0x39')]));_0x1cf817[_0xbea1('0x3a')]=_0x1cf817[_0xbea1('0x3a')][_0xbea1('0x3b')]?_0x1cf817['attributes']:_0x9c584b['model'];if(!_0x165155[_0xbea1('0x35')]['hasOwnProperty'](_0xbea1('0x3c'))){_0x1cf817[_0xbea1('0x3d')]=qs[_0xbea1('0x3d')](_0x165155['query'][_0xbea1('0x3d')]);_0x1cf817[_0xbea1('0x1d')]=qs['offset'](_0x165155[_0xbea1('0x35')]['offset']);}_0x1cf817[_0xbea1('0x3e')]=qs[_0xbea1('0x3f')](_0x165155['query'][_0xbea1('0x3f')]);_0x1cf817['where']=qs[_0xbea1('0x37')](_[_0xbea1('0x40')](_0x165155[_0xbea1('0x35')],_0x9c584b[_0xbea1('0x37')]),_0xe3aab2);if(_0x165155[_0xbea1('0x35')][_0xbea1('0x41')]){_0x1cf817[_0xbea1('0x42')]=_[_0xbea1('0x43')](_0x1cf817['where'],{'$or':_['map'](_0xe3aab2,function(_0x77e0bc){if(_0x77e0bc['type']!==_0xbea1('0x44')){var _0x19d5e3={};_0x19d5e3[_0x77e0bc['name']]={'$like':'%'+_0x165155[_0xbea1('0x35')][_0xbea1('0x41')]+'%'};return _0x19d5e3;}})});}_0x1cf817=_[_0xbea1('0x43')]({},_0x1cf817,_0x165155[_0xbea1('0x45')]);var _0x11e5dc={'where':_0x1cf817['where']};return db['MailSubstatus']['count'](_0x11e5dc)[_0xbea1('0x26')](function(_0xd64f38){_0x2b25b2['count']=_0xd64f38;if(_0x165155['query'][_0xbea1('0x46')]){_0x1cf817[_0xbea1('0x47')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x1cf817);})['then'](function(_0x243619){_0x2b25b2[_0xbea1('0x48')]=_0x243619;return _0x2b25b2;})[_0xbea1('0x26')](respondWithFilteredResult(_0x4716f8,_0x1cf817))['catch'](handleError(_0x4716f8,null));};exports[_0xbea1('0x49')]=function(_0x2a2aef,_0x220bf4){var _0x941cf0={'raw':!![],'where':{'id':_0x2a2aef[_0xbea1('0x4a')]['id']}},_0x2935f2={};_0x2935f2[_0xbea1('0x34')]=_['keys'](db[_0xbea1('0x2f')][_0xbea1('0x30')]);_0x2935f2['query']=_['keys'](_0x2a2aef[_0xbea1('0x35')]);_0x2935f2['filters']=_['intersection'](_0x2935f2[_0xbea1('0x34')],_0x2935f2[_0xbea1('0x35')]);_0x941cf0['attributes']=_['intersection'](_0x2935f2[_0xbea1('0x34')],qs[_0xbea1('0x39')](_0x2a2aef[_0xbea1('0x35')][_0xbea1('0x39')]));_0x941cf0[_0xbea1('0x3a')]=_0x941cf0[_0xbea1('0x3a')]['length']?_0x941cf0[_0xbea1('0x3a')]:_0x2935f2['model'];if(_0x2a2aef[_0xbea1('0x35')]['includeAll']){_0x941cf0[_0xbea1('0x47')]=[{'all':!![]}];}_0x941cf0=_['merge']({},_0x941cf0,_0x2a2aef['options']);return db[_0xbea1('0x2f')]['find'](_0x941cf0)['then'](handleEntityNotFound(_0x220bf4,null))[_0xbea1('0x26')](respondWithResult(_0x220bf4,null))[_0xbea1('0x4b')](handleError(_0x220bf4,null));};exports['create']=function(_0x3c12e0,_0x372d30){return db['MailSubstatus']['create'](_0x3c12e0[_0xbea1('0x4c')],{})[_0xbea1('0x26')](respondWithResult(_0x372d30,0xc9))[_0xbea1('0x4b')](handleError(_0x372d30,null));};exports[_0xbea1('0x25')]=function(_0x4c1d34,_0x37daac){if(_0x4c1d34[_0xbea1('0x4c')]['id']){delete _0x4c1d34[_0xbea1('0x4c')]['id'];}return db[_0xbea1('0x2f')]['find']({'where':{'id':_0x4c1d34[_0xbea1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x37daac,null))[_0xbea1('0x26')](saveUpdates(_0x4c1d34['body'],null))[_0xbea1('0x26')](respondWithResult(_0x37daac,null))[_0xbea1('0x4b')](handleError(_0x37daac,null));};exports['destroy']=function(_0x114077,_0xda2374){return db[_0xbea1('0x2f')]['find']({'where':{'id':_0x114077['params']['id']}})['then'](handleEntityNotFound(_0xda2374,null))[_0xbea1('0x26')](removeEntity(_0xda2374,null))[_0xbea1('0x4b')](handleError(_0xda2374,null));};exports[_0xbea1('0x4d')]=function(_0x149f08,_0x290f30){return db[_0xbea1('0x2f')][_0xbea1('0x4d')]()[_0xbea1('0x26')](respondWithResult(_0x290f30,null))[_0xbea1('0x4b')](handleError(_0x290f30,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ef172cb..ab4c092 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 _0x81a9=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x81a9,0x1c2));var _0x981a=function(_0x3cfe15,_0xbd391b){_0x3cfe15=_0x3cfe15-0x0;var _0x113904=_0x81a9[_0x3cfe15];return _0x113904;};'use strict';var EventEmitter=require(_0x981a('0x0'));var MailSubstatus=require(_0x981a('0x1'))['db'][_0x981a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x981a('0x3')](0x0);var events={'afterUpdate':_0x981a('0x4')};function emitEvent(_0x242841){return function(_0x32839a,_0x5d6a6a,_0x26a562){MailSubstatusEvents[_0x981a('0x5')](_0x242841+':'+_0x32839a['id'],_0x32839a);MailSubstatusEvents[_0x981a('0x5')](_0x242841,_0x32839a);_0x26a562(null);};}for(var e in events){if(events[_0x981a('0x6')](e)){var event=events[e];MailSubstatus[_0x981a('0x7')](e,emitEvent(event));}}module[_0x981a('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0xa2a5=['update','hasOwnProperty','exports','events','MailSubstatus','setMaxListeners'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2a5,0xa5));var _0x5a2a=function(_0x40c208,_0x3db7d8){_0x40c208=_0x40c208-0x0;var _0x38904e=_0xa2a5[_0x40c208];return _0x38904e;};'use strict';var EventEmitter=require(_0x5a2a('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x5a2a('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5a2a('0x2')](0x0);var events={'afterUpdate':_0x5a2a('0x3')};function emitEvent(_0x5b4ac5){return function(_0x500641,_0x1ac05b,_0x3baff2){MailSubstatusEvents['emit'](_0x5b4ac5+':'+_0x500641['id'],_0x500641);MailSubstatusEvents['emit'](_0x5b4ac5,_0x500641);_0x3baff2(null);};}for(var e in events){if(events[_0x5a2a('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x5a2a('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 88029e4..1aa1db9 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 _0x0e5a=['_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','mailSubstatus'];(function(_0x929683,_0x10a2db){var _0x601c27=function(_0x34cda5){while(--_0x34cda5){_0x929683['push'](_0x929683['shift']());}};_0x601c27(++_0x10a2db);}(_0x0e5a,0x70));var _0xa0e5=function(_0x2d1c84,_0xb44a74){_0x2d1c84=_0x2d1c84-0x0;var _0xa22c82=_0x0e5a[_0x2d1c84];return _0xa22c82;};'use strict';var attributes=require(_0xa0e5('0x0'));module[_0xa0e5('0x1')]=function(_0x497505){var _0x5151ea=_0x497505[_0xa0e5('0x2')];return _0x497505[_0xa0e5('0x3')](_0xa0e5('0x4'),attributes,{'tableName':_0xa0e5('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x522260,_0x238311,_0xd79f30){return _0x5151ea[_0xa0e5('0x6')]['update']({'value':_0x522260['name']},{'where':{'field':_0xa0e5('0x7'),'value':_0x522260[_0xa0e5('0x8')][_0xa0e5('0x9')]}})[_0xa0e5('0xa')](function(){_0xd79f30();})[_0xa0e5('0xb')](function(_0x2c2613){_0xd79f30(_0x2c2613);});}}});}; \ No newline at end of file +var _0xe8fd=['MailSubstatus','mail_substatuses','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe8fd,0xd5));var _0xde8f=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xe8fd[_0x47fd36];return _0x21a0fc;};'use strict';var attributes=require(_0xde8f('0x0'));module[_0xde8f('0x1')]=function(_0xcaf80){var _0x30ce8d=_0xcaf80[_0xde8f('0x2')];return _0xcaf80['define'](_0xde8f('0x3'),attributes,{'tableName':_0xde8f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x24bf67,_0x1b11e2,_0x21b219){return _0x30ce8d['Condition']['update']({'value':_0x24bf67[_0xde8f('0x5')]},{'where':{'field':_0xde8f('0x6'),'value':_0x24bf67['_previousDataValues']['name']}})[_0xde8f('0x7')](function(){_0x21b219();})[_0xde8f('0x8')](function(_0x319d67){_0x21b219(_0x319d67);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index efe1202..10a5793 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 _0xdd5b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x11a524,_0x27e0c9){var _0x3756b6=function(_0x320e1f){while(--_0x320e1f){_0x11a524['push'](_0x11a524['shift']());}};_0x3756b6(++_0x27e0c9);}(_0xdd5b,0x150));var _0xbdd5=function(_0x5b4742,_0x304b37){_0x5b4742=_0x5b4742-0x0;var _0x2c6b94=_0xdd5b[_0x5b4742];return _0x2c6b94;};'use strict';var _=require(_0xbdd5('0x0'));var util=require('util');var moment=require(_0xbdd5('0x1'));var BPromise=require(_0xbdd5('0x2'));var rs=require(_0xbdd5('0x3'));var fs=require('fs');var Redis=require(_0xbdd5('0x4'));var db=require(_0xbdd5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdd5('0x6'))('rpc');var config=require(_0xbdd5('0x7'));var jayson=require(_0xbdd5('0x8'));var client=jayson[_0xbdd5('0x9')][_0xbdd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x590b50,_0x372ef8,_0x2708a8){return new BPromise(function(_0x3d2b99,_0x172ee6){return client['request'](_0x590b50,_0x2708a8)['then'](function(_0x291e1d){logger[_0xbdd5('0xb')](_0xbdd5('0xc'),_0x372ef8,_0xbdd5('0xd'));logger['debug'](_0xbdd5('0xe'),_0x372ef8,_0xbdd5('0xd'),JSON[_0xbdd5('0xf')](_0x291e1d));if(_0x291e1d[_0xbdd5('0x10')]){if(_0x291e1d[_0xbdd5('0x10')][_0xbdd5('0x11')]===0x1f4){logger[_0xbdd5('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x372ef8,_0x291e1d[_0xbdd5('0x10')][_0xbdd5('0x12')]);return _0x172ee6(_0x291e1d[_0xbdd5('0x10')][_0xbdd5('0x12')]);}logger[_0xbdd5('0x10')](_0xbdd5('0xc'),_0x372ef8,_0x291e1d[_0xbdd5('0x10')][_0xbdd5('0x12')]);return _0x3d2b99(_0x291e1d[_0xbdd5('0x10')][_0xbdd5('0x12')]);}else{logger['info'](_0xbdd5('0xc'),_0x372ef8,_0xbdd5('0xd'));_0x3d2b99(_0x291e1d[_0xbdd5('0x13')]['message']);}})['catch'](function(_0x34a2c2){logger[_0xbdd5('0x10')](_0xbdd5('0xc'),_0x372ef8,_0x34a2c2);_0x172ee6(_0x34a2c2);});});} \ No newline at end of file +var _0x1b76=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x1b76,0x1be));var _0x61b7=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x1b76[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x61b7('0x0'));var moment=require(_0x61b7('0x1'));var BPromise=require('bluebird');var rs=require(_0x61b7('0x2'));var fs=require('fs');var Redis=require(_0x61b7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x61b7('0x4'));var logger=require(_0x61b7('0x5'))(_0x61b7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x61b7('0x7')][_0x61b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49de42,_0x4e128e,_0x490572){return new BPromise(function(_0x10c1d9,_0x60fff6){return client[_0x61b7('0x9')](_0x49de42,_0x490572)[_0x61b7('0xa')](function(_0x26d83c){logger[_0x61b7('0xb')](_0x61b7('0xc'),_0x4e128e,_0x61b7('0xd'));logger[_0x61b7('0xe')](_0x61b7('0xf'),_0x4e128e,'request\x20sent',JSON[_0x61b7('0x10')](_0x26d83c));if(_0x26d83c[_0x61b7('0x11')]){if(_0x26d83c[_0x61b7('0x11')][_0x61b7('0x12')]===0x1f4){logger[_0x61b7('0x11')](_0x61b7('0xc'),_0x4e128e,_0x26d83c[_0x61b7('0x11')]['message']);return _0x60fff6(_0x26d83c[_0x61b7('0x11')][_0x61b7('0x13')]);}logger[_0x61b7('0x11')](_0x61b7('0xc'),_0x4e128e,_0x26d83c[_0x61b7('0x11')][_0x61b7('0x13')]);return _0x10c1d9(_0x26d83c['error'][_0x61b7('0x13')]);}else{logger[_0x61b7('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x4e128e,_0x61b7('0xd'));_0x10c1d9(_0x26d83c[_0x61b7('0x14')][_0x61b7('0x13')]);}})[_0x61b7('0x15')](function(_0x28d955){logger[_0x61b7('0x11')](_0x61b7('0xc'),_0x4e128e,_0x28d955);_0x60fff6(_0x28d955);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c6ce6e6..89a52b6 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 _0x8abd=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x257e8f,_0xdc7fc9){var _0x2d8b1e=function(_0x24739a){while(--_0x24739a){_0x257e8f['push'](_0x257e8f['shift']());}};_0x2d8b1e(++_0xdc7fc9);}(_0x8abd,0x117));var _0xd8ab=function(_0x3df0e3,_0x3e5975){_0x3df0e3=_0x3df0e3-0x0;var _0x3a896f=_0x8abd[_0x3df0e3];return _0x3a896f;};'use strict';var multer=require(_0xd8ab('0x0'));var util=require(_0xd8ab('0x1'));var path=require(_0xd8ab('0x2'));var timeout=require(_0xd8ab('0x3'));var express=require('express');var router=express[_0xd8ab('0x4')]();var fs_extra=require(_0xd8ab('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd8ab('0x6'));var config=require(_0xd8ab('0x7'));var controller=require(_0xd8ab('0x8'));router[_0xd8ab('0x9')]('/',auth[_0xd8ab('0xa')](),controller[_0xd8ab('0xb')]);router[_0xd8ab('0x9')]('/describe',auth[_0xd8ab('0xa')](),controller[_0xd8ab('0xc')]);router[_0xd8ab('0x9')](_0xd8ab('0xd'),auth['isAuthenticated'](),controller[_0xd8ab('0xe')]);router[_0xd8ab('0xf')]('/',auth[_0xd8ab('0xa')](),controller['create']);router[_0xd8ab('0x10')](_0xd8ab('0xd'),auth[_0xd8ab('0xa')](),controller[_0xd8ab('0x11')]);router[_0xd8ab('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd8ab('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6afd=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x2332d3,_0x4db5a4){var _0x565848=function(_0x8a0adf){while(--_0x8a0adf){_0x2332d3['push'](_0x2332d3['shift']());}};_0x565848(++_0x4db5a4);}(_0x6afd,0x1d6));var _0xd6af=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x6afd[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0xd6af('0x0'));var util=require(_0xd6af('0x1'));var path=require(_0xd6af('0x2'));var timeout=require(_0xd6af('0x3'));var express=require(_0xd6af('0x4'));var router=express[_0xd6af('0x5')]();var fs_extra=require(_0xd6af('0x6'));var auth=require(_0xd6af('0x7'));var interaction=require(_0xd6af('0x8'));var config=require('../../config/environment');var controller=require(_0xd6af('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd6af('0xa')](_0xd6af('0xb'),auth[_0xd6af('0xc')](),controller[_0xd6af('0xd')]);router['get'](_0xd6af('0xe'),auth[_0xd6af('0xc')](),controller[_0xd6af('0xf')]);router[_0xd6af('0x10')]('/',auth['isAuthenticated'](),controller[_0xd6af('0x11')]);router['put'](_0xd6af('0xe'),auth[_0xd6af('0xc')](),controller[_0xd6af('0x12')]);router[_0xd6af('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xd6af('0x14')]);module[_0xd6af('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f6be163..f0a85ab 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x43edaa,_0xfbbb1b){var _0x103689=function(_0x20e808){while(--_0x20e808){_0x43edaa['push'](_0x43edaa['shift']());}};_0x103689(++_0xfbbb1b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b84[_0x3dd15e];return _0x231fd0;};'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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0cafeef..a43b506 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 _0xd8e0=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','query','intersection','model','attributes','fields','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','rows','catch','params','keys','length','find','create','body','describe','rimraf','request-promise','moment','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','count','limit','status','set','Content-Range','apply','reject'];(function(_0x1c38bf,_0x15aff7){var _0x205774=function(_0x121732){while(--_0x121732){_0x1c38bf['push'](_0x1c38bf['shift']());}};_0x205774(++_0x15aff7);}(_0xd8e0,0x13e));var _0x0d8e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xd8e0[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d8e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8e('0x1'));var moment=require(_0x0d8e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d8e('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8e('0x4'));var fs=require('fs');var fs_extra=require(_0x0d8e('0x5'));var _=require(_0x0d8e('0x6'));var squel=require(_0x0d8e('0x7'));var crypto=require('crypto');var jsforce=require(_0x0d8e('0x8'));var deskjs=require(_0x0d8e('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0d8e('0xa'));var Papa=require(_0x0d8e('0xb'));var Redis=require(_0x0d8e('0xc'));var authService=require(_0x0d8e('0xd'));var qs=require(_0x0d8e('0xe'));var as=require(_0x0d8e('0xf'));var hardwareService=require(_0x0d8e('0x10'));var logger=require('../../config/logger')(_0x0d8e('0x11'));var utils=require(_0x0d8e('0x12'));var config=require(_0x0d8e('0x13'));var licenseUtil=require(_0x0d8e('0x14'));var db=require(_0x0d8e('0x15'))['db'];function respondWithStatusCode(_0x439989,_0x3bd2c9){_0x3bd2c9=_0x3bd2c9||0xcc;return function(_0x2b9b11){if(_0x2b9b11){return _0x439989[_0x0d8e('0x16')](_0x3bd2c9);}return _0x439989['status'](_0x3bd2c9)[_0x0d8e('0x17')]();};}function respondWithResult(_0x82ba82,_0x2e3a4a){_0x2e3a4a=_0x2e3a4a||0xc8;return function(_0x223d36){if(_0x223d36){return _0x82ba82['status'](_0x2e3a4a)['json'](_0x223d36);}};}function respondWithFilteredResult(_0xcff6bc,_0x2b946a){return function(_0x33a23e){if(_0x33a23e){var _0x47664b=typeof _0x2b946a[_0x0d8e('0x18')]==='undefined'&&typeof _0x2b946a['limit']==='undefined';var _0x33f3ca=_0x33a23e['count'];var _0x3b26a3=_0x47664b?0x0:_0x2b946a[_0x0d8e('0x18')];var _0x58fade=_0x47664b?_0x33a23e[_0x0d8e('0x19')]:_0x2b946a[_0x0d8e('0x18')]+_0x2b946a[_0x0d8e('0x1a')];var _0x4ec5f0;if(_0x58fade>=_0x33f3ca){_0x58fade=_0x33f3ca;_0x4ec5f0=0xc8;}else{_0x4ec5f0=0xce;}_0xcff6bc[_0x0d8e('0x1b')](_0x4ec5f0);return _0xcff6bc[_0x0d8e('0x1c')](_0x0d8e('0x1d'),_0x3b26a3+'-'+_0x58fade+'/'+_0x33f3ca)['json'](_0x33a23e);}return null;};}function patchUpdates(_0x59959b){return function(_0x5787e9){try{jsonpatch[_0x0d8e('0x1e')](_0x5787e9,_0x59959b,!![]);}catch(_0x19c423){return BPromise[_0x0d8e('0x1f')](_0x19c423);}return _0x5787e9[_0x0d8e('0x20')]();};}function saveUpdates(_0x151d8b,_0x422957){return function(_0x2424d3){if(_0x2424d3){return _0x2424d3[_0x0d8e('0x21')](_0x151d8b)[_0x0d8e('0x22')](function(_0x344a30){return _0x344a30;});}return null;};}function removeEntity(_0x5db2e0,_0x20b866){return function(_0x435ca0){if(_0x435ca0){return _0x435ca0[_0x0d8e('0x23')]()['then'](function(){_0x5db2e0[_0x0d8e('0x1b')](0xcc)[_0x0d8e('0x17')]();});}};}function handleEntityNotFound(_0x49808f,_0x460b17){return function(_0x9acc62){if(!_0x9acc62){_0x49808f[_0x0d8e('0x16')](0x194);}return _0x9acc62;};}function handleError(_0x250a8b,_0x32e30b){_0x32e30b=_0x32e30b||0x1f4;return function(_0x4391a5){logger[_0x0d8e('0x24')](_0x4391a5[_0x0d8e('0x25')]);if(_0x4391a5[_0x0d8e('0x26')]){delete _0x4391a5[_0x0d8e('0x26')];}_0x250a8b[_0x0d8e('0x1b')](_0x32e30b)[_0x0d8e('0x27')](_0x4391a5);};}exports[_0x0d8e('0x28')]=function(_0x3f2563,_0x360d50){var _0x580df8={},_0x30a575={},_0x23e6e7={'count':0x0,'rows':[]};var _0x17417f=_[_0x0d8e('0x29')](db['MailTransferReport'][_0x0d8e('0x2a')],function(_0x34501e){return{'name':_0x34501e['fieldName'],'type':_0x34501e[_0x0d8e('0x2b')]['key']};});_0x30a575['model']=_['map'](_0x17417f,'name');_0x30a575[_0x0d8e('0x2c')]=_['keys'](_0x3f2563['query']);_0x30a575['filters']=_[_0x0d8e('0x2d')](_0x30a575[_0x0d8e('0x2e')],_0x30a575[_0x0d8e('0x2c')]);_0x580df8[_0x0d8e('0x2f')]=_['intersection'](_0x30a575[_0x0d8e('0x2e')],qs['fields'](_0x3f2563['query'][_0x0d8e('0x30')]));_0x580df8[_0x0d8e('0x2f')]=_0x580df8[_0x0d8e('0x2f')]['length']?_0x580df8['attributes']:_0x30a575[_0x0d8e('0x2e')];if(!_0x3f2563[_0x0d8e('0x2c')]['hasOwnProperty']('nolimit')){_0x580df8[_0x0d8e('0x1a')]=qs[_0x0d8e('0x1a')](_0x3f2563['query'][_0x0d8e('0x1a')]);_0x580df8['offset']=qs[_0x0d8e('0x18')](_0x3f2563[_0x0d8e('0x2c')][_0x0d8e('0x18')]);}_0x580df8[_0x0d8e('0x31')]=qs[_0x0d8e('0x32')](_0x3f2563['query'][_0x0d8e('0x32')]);_0x580df8[_0x0d8e('0x33')]=qs[_0x0d8e('0x34')](_['pick'](_0x3f2563['query'],_0x30a575[_0x0d8e('0x34')]),_0x17417f);if(_0x3f2563[_0x0d8e('0x2c')][_0x0d8e('0x35')]){_0x580df8[_0x0d8e('0x33')]=_[_0x0d8e('0x36')](_0x580df8[_0x0d8e('0x33')],{'$or':_[_0x0d8e('0x29')](_0x17417f,function(_0x557061){if(_0x557061[_0x0d8e('0x2b')]!==_0x0d8e('0x37')){var _0x3f1d35={};_0x3f1d35[_0x557061[_0x0d8e('0x26')]]={'$like':'%'+_0x3f2563[_0x0d8e('0x2c')][_0x0d8e('0x35')]+'%'};return _0x3f1d35;}})});}_0x580df8=_[_0x0d8e('0x36')]({},_0x580df8,_0x3f2563[_0x0d8e('0x38')]);var _0x53771d={'where':_0x580df8[_0x0d8e('0x33')]};return db['MailTransferReport'][_0x0d8e('0x19')](_0x53771d)[_0x0d8e('0x22')](function(_0x2b5deb){_0x23e6e7[_0x0d8e('0x19')]=_0x2b5deb;if(_0x3f2563['query'][_0x0d8e('0x39')]){_0x580df8[_0x0d8e('0x3a')]=[{'all':!![]}];}return db[_0x0d8e('0x3b')][_0x0d8e('0x3c')](_0x580df8);})[_0x0d8e('0x22')](function(_0x48b32e){_0x23e6e7[_0x0d8e('0x3d')]=_0x48b32e;return _0x23e6e7;})[_0x0d8e('0x22')](respondWithFilteredResult(_0x360d50,_0x580df8))[_0x0d8e('0x3e')](handleError(_0x360d50,null));};exports['show']=function(_0x3d205c,_0x5a46a9){var _0x5b73d2={'raw':!![],'where':{'id':_0x3d205c[_0x0d8e('0x3f')]['id']}},_0x3fa894={};_0x3fa894[_0x0d8e('0x2e')]=_[_0x0d8e('0x40')](db[_0x0d8e('0x3b')][_0x0d8e('0x2a')]);_0x3fa894[_0x0d8e('0x2c')]=_[_0x0d8e('0x40')](_0x3d205c['query']);_0x3fa894[_0x0d8e('0x34')]=_[_0x0d8e('0x2d')](_0x3fa894[_0x0d8e('0x2e')],_0x3fa894[_0x0d8e('0x2c')]);_0x5b73d2[_0x0d8e('0x2f')]=_['intersection'](_0x3fa894['model'],qs['fields'](_0x3d205c[_0x0d8e('0x2c')]['fields']));_0x5b73d2[_0x0d8e('0x2f')]=_0x5b73d2[_0x0d8e('0x2f')][_0x0d8e('0x41')]?_0x5b73d2[_0x0d8e('0x2f')]:_0x3fa894[_0x0d8e('0x2e')];if(_0x3d205c[_0x0d8e('0x2c')][_0x0d8e('0x39')]){_0x5b73d2[_0x0d8e('0x3a')]=[{'all':!![]}];}_0x5b73d2=_['merge']({},_0x5b73d2,_0x3d205c[_0x0d8e('0x38')]);return db[_0x0d8e('0x3b')][_0x0d8e('0x42')](_0x5b73d2)[_0x0d8e('0x22')](handleEntityNotFound(_0x5a46a9,null))[_0x0d8e('0x22')](respondWithResult(_0x5a46a9,null))['catch'](handleError(_0x5a46a9,null));};exports[_0x0d8e('0x43')]=function(_0x10c2ff,_0x6551d3){return db[_0x0d8e('0x3b')][_0x0d8e('0x43')](_0x10c2ff['body'],{})[_0x0d8e('0x22')](respondWithResult(_0x6551d3,0xc9))[_0x0d8e('0x3e')](handleError(_0x6551d3,null));};exports[_0x0d8e('0x21')]=function(_0x24a67c,_0x170d72){if(_0x24a67c[_0x0d8e('0x44')]['id']){delete _0x24a67c[_0x0d8e('0x44')]['id'];}return db[_0x0d8e('0x3b')][_0x0d8e('0x42')]({'where':{'id':_0x24a67c[_0x0d8e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x170d72,null))['then'](saveUpdates(_0x24a67c[_0x0d8e('0x44')],null))[_0x0d8e('0x22')](respondWithResult(_0x170d72,null))['catch'](handleError(_0x170d72,null));};exports['destroy']=function(_0x49efb2,_0x34c163){return db[_0x0d8e('0x3b')][_0x0d8e('0x42')]({'where':{'id':_0x49efb2['params']['id']}})['then'](handleEntityNotFound(_0x34c163,null))[_0x0d8e('0x22')](removeEntity(_0x34c163,null))[_0x0d8e('0x3e')](handleError(_0x34c163,null));};exports[_0x0d8e('0x45')]=function(_0x3b7650,_0x566b81){return db[_0x0d8e('0x3b')][_0x0d8e('0x45')]()[_0x0d8e('0x22')](respondWithResult(_0x566b81,null))[_0x0d8e('0x3e')](handleError(_0x566b81,null));}; \ No newline at end of file +var _0x5e5d=['send','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','catch','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','name'];(function(_0x4d5c2e,_0x46e44d){var _0x2b1e49=function(_0x47e549){while(--_0x47e549){_0x4d5c2e['push'](_0x4d5c2e['shift']());}};_0x2b1e49(++_0x46e44d);}(_0x5e5d,0x19d));var _0xd5e5=function(_0x42d857,_0x3f0f87){_0x42d857=_0x42d857-0x0;var _0x2899ba=_0x5e5d[_0x42d857];return _0x2899ba;};'use strict';var emlformat=require(_0xd5e5('0x0'));var rimraf=require(_0xd5e5('0x1'));var zipdir=require(_0xd5e5('0x2'));var jsonpatch=require(_0xd5e5('0x3'));var rp=require(_0xd5e5('0x4'));var moment=require(_0xd5e5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd5e5('0x6'));var util=require(_0xd5e5('0x7'));var path=require('path');var sox=require(_0xd5e5('0x8'));var csv=require(_0xd5e5('0x9'));var ejs=require(_0xd5e5('0xa'));var fs=require('fs');var fs_extra=require(_0xd5e5('0xb'));var _=require(_0xd5e5('0xc'));var squel=require(_0xd5e5('0xd'));var crypto=require(_0xd5e5('0xe'));var jsforce=require(_0xd5e5('0xf'));var deskjs=require(_0xd5e5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd5e5('0x11'));var Papa=require(_0xd5e5('0x12'));var Redis=require(_0xd5e5('0x13'));var authService=require(_0xd5e5('0x14'));var qs=require(_0xd5e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5e5('0x16'));var logger=require(_0xd5e5('0x17'))(_0xd5e5('0x18'));var utils=require('../../config/utils');var config=require(_0xd5e5('0x19'));var licenseUtil=require(_0xd5e5('0x1a'));var db=require(_0xd5e5('0x1b'))['db'];function respondWithStatusCode(_0x4f17a6,_0x5c304c){_0x5c304c=_0x5c304c||0xcc;return function(_0x4db035){if(_0x4db035){return _0x4f17a6['sendStatus'](_0x5c304c);}return _0x4f17a6[_0xd5e5('0x1c')](_0x5c304c)['end']();};}function respondWithResult(_0x5ce989,_0x19ac16){_0x19ac16=_0x19ac16||0xc8;return function(_0x5cc01d){if(_0x5cc01d){return _0x5ce989[_0xd5e5('0x1c')](_0x19ac16)[_0xd5e5('0x1d')](_0x5cc01d);}};}function respondWithFilteredResult(_0x48e57f,_0x4b5197){return function(_0x3947f2){if(_0x3947f2){var _0x54a36b=typeof _0x4b5197[_0xd5e5('0x1e')]===_0xd5e5('0x1f')&&typeof _0x4b5197[_0xd5e5('0x20')]===_0xd5e5('0x1f');var _0x5445b9=_0x3947f2[_0xd5e5('0x21')];var _0x22102e=_0x54a36b?0x0:_0x4b5197[_0xd5e5('0x1e')];var _0x4ffc3b=_0x54a36b?_0x3947f2[_0xd5e5('0x21')]:_0x4b5197[_0xd5e5('0x1e')]+_0x4b5197[_0xd5e5('0x20')];var _0x4e981a;if(_0x4ffc3b>=_0x5445b9){_0x4ffc3b=_0x5445b9;_0x4e981a=0xc8;}else{_0x4e981a=0xce;}_0x48e57f[_0xd5e5('0x1c')](_0x4e981a);return _0x48e57f['set'](_0xd5e5('0x22'),_0x22102e+'-'+_0x4ffc3b+'/'+_0x5445b9)['json'](_0x3947f2);}return null;};}function patchUpdates(_0x1d605a){return function(_0x2b08a){try{jsonpatch['apply'](_0x2b08a,_0x1d605a,!![]);}catch(_0x7da814){return BPromise[_0xd5e5('0x23')](_0x7da814);}return _0x2b08a['save']();};}function saveUpdates(_0x412023,_0x3ea003){return function(_0x5bda97){if(_0x5bda97){return _0x5bda97[_0xd5e5('0x24')](_0x412023)[_0xd5e5('0x25')](function(_0x301284){return _0x301284;});}return null;};}function removeEntity(_0x5729cb,_0x3b40bb){return function(_0x1e2ade){if(_0x1e2ade){return _0x1e2ade[_0xd5e5('0x26')]()['then'](function(){_0x5729cb[_0xd5e5('0x1c')](0xcc)[_0xd5e5('0x27')]();});}};}function handleEntityNotFound(_0x5aa7c1,_0x3b52d7){return function(_0x109929){if(!_0x109929){_0x5aa7c1['sendStatus'](0x194);}return _0x109929;};}function handleError(_0x57b984,_0x5090b2){_0x5090b2=_0x5090b2||0x1f4;return function(_0x49ec53){logger[_0xd5e5('0x28')](_0x49ec53[_0xd5e5('0x29')]);if(_0x49ec53['name']){delete _0x49ec53[_0xd5e5('0x2a')];}_0x57b984['status'](_0x5090b2)[_0xd5e5('0x2b')](_0x49ec53);};}exports['index']=function(_0x2e607e,_0x4ae860){var _0x77f601={},_0x1586bf={},_0x566bd7={'count':0x0,'rows':[]};var _0xa7c21c=_['map'](db[_0xd5e5('0x2c')][_0xd5e5('0x2d')],function(_0x28628a){return{'name':_0x28628a[_0xd5e5('0x2e')],'type':_0x28628a[_0xd5e5('0x2f')][_0xd5e5('0x30')]};});_0x1586bf[_0xd5e5('0x31')]=_[_0xd5e5('0x32')](_0xa7c21c,'name');_0x1586bf[_0xd5e5('0x33')]=_['keys'](_0x2e607e[_0xd5e5('0x33')]);_0x1586bf[_0xd5e5('0x34')]=_['intersection'](_0x1586bf['model'],_0x1586bf[_0xd5e5('0x33')]);_0x77f601[_0xd5e5('0x35')]=_[_0xd5e5('0x36')](_0x1586bf[_0xd5e5('0x31')],qs['fields'](_0x2e607e['query'][_0xd5e5('0x37')]));_0x77f601[_0xd5e5('0x35')]=_0x77f601[_0xd5e5('0x35')][_0xd5e5('0x38')]?_0x77f601[_0xd5e5('0x35')]:_0x1586bf[_0xd5e5('0x31')];if(!_0x2e607e[_0xd5e5('0x33')][_0xd5e5('0x39')](_0xd5e5('0x3a'))){_0x77f601['limit']=qs['limit'](_0x2e607e[_0xd5e5('0x33')][_0xd5e5('0x20')]);_0x77f601['offset']=qs[_0xd5e5('0x1e')](_0x2e607e[_0xd5e5('0x33')][_0xd5e5('0x1e')]);}_0x77f601[_0xd5e5('0x3b')]=qs[_0xd5e5('0x3c')](_0x2e607e[_0xd5e5('0x33')][_0xd5e5('0x3c')]);_0x77f601[_0xd5e5('0x3d')]=qs[_0xd5e5('0x34')](_['pick'](_0x2e607e['query'],_0x1586bf[_0xd5e5('0x34')]),_0xa7c21c);if(_0x2e607e[_0xd5e5('0x33')][_0xd5e5('0x3e')]){_0x77f601['where']=_['merge'](_0x77f601[_0xd5e5('0x3d')],{'$or':_[_0xd5e5('0x32')](_0xa7c21c,function(_0x419cb8){if(_0x419cb8[_0xd5e5('0x2f')]!==_0xd5e5('0x3f')){var _0x5c0da1={};_0x5c0da1[_0x419cb8['name']]={'$like':'%'+_0x2e607e[_0xd5e5('0x33')][_0xd5e5('0x3e')]+'%'};return _0x5c0da1;}})});}_0x77f601=_[_0xd5e5('0x40')]({},_0x77f601,_0x2e607e[_0xd5e5('0x41')]);var _0x4a428e={'where':_0x77f601['where']};return db['MailTransferReport'][_0xd5e5('0x21')](_0x4a428e)[_0xd5e5('0x25')](function(_0x36eff7){_0x566bd7[_0xd5e5('0x21')]=_0x36eff7;if(_0x2e607e[_0xd5e5('0x33')]['includeAll']){_0x77f601[_0xd5e5('0x42')]=[{'all':!![]}];}return db['MailTransferReport'][_0xd5e5('0x43')](_0x77f601);})[_0xd5e5('0x25')](function(_0x5c155f){_0x566bd7['rows']=_0x5c155f;return _0x566bd7;})[_0xd5e5('0x25')](respondWithFilteredResult(_0x4ae860,_0x77f601))[_0xd5e5('0x44')](handleError(_0x4ae860,null));};exports['show']=function(_0x2ebb74,_0x4bb703){var _0x35a5f2={'raw':!![],'where':{'id':_0x2ebb74[_0xd5e5('0x45')]['id']}},_0x584ff1={};_0x584ff1[_0xd5e5('0x31')]=_[_0xd5e5('0x46')](db['MailTransferReport']['rawAttributes']);_0x584ff1['query']=_[_0xd5e5('0x46')](_0x2ebb74[_0xd5e5('0x33')]);_0x584ff1[_0xd5e5('0x34')]=_[_0xd5e5('0x36')](_0x584ff1[_0xd5e5('0x31')],_0x584ff1['query']);_0x35a5f2[_0xd5e5('0x35')]=_[_0xd5e5('0x36')](_0x584ff1[_0xd5e5('0x31')],qs['fields'](_0x2ebb74[_0xd5e5('0x33')][_0xd5e5('0x37')]));_0x35a5f2[_0xd5e5('0x35')]=_0x35a5f2[_0xd5e5('0x35')][_0xd5e5('0x38')]?_0x35a5f2[_0xd5e5('0x35')]:_0x584ff1[_0xd5e5('0x31')];if(_0x2ebb74['query'][_0xd5e5('0x47')]){_0x35a5f2[_0xd5e5('0x42')]=[{'all':!![]}];}_0x35a5f2=_[_0xd5e5('0x40')]({},_0x35a5f2,_0x2ebb74['options']);return db[_0xd5e5('0x2c')][_0xd5e5('0x48')](_0x35a5f2)[_0xd5e5('0x25')](handleEntityNotFound(_0x4bb703,null))['then'](respondWithResult(_0x4bb703,null))[_0xd5e5('0x44')](handleError(_0x4bb703,null));};exports[_0xd5e5('0x49')]=function(_0x23c962,_0x3ab60c){return db['MailTransferReport']['create'](_0x23c962[_0xd5e5('0x4a')],{})[_0xd5e5('0x25')](respondWithResult(_0x3ab60c,0xc9))[_0xd5e5('0x44')](handleError(_0x3ab60c,null));};exports[_0xd5e5('0x24')]=function(_0x18d22f,_0x33ed9c){if(_0x18d22f[_0xd5e5('0x4a')]['id']){delete _0x18d22f[_0xd5e5('0x4a')]['id'];}return db[_0xd5e5('0x2c')]['find']({'where':{'id':_0x18d22f[_0xd5e5('0x45')]['id']}})[_0xd5e5('0x25')](handleEntityNotFound(_0x33ed9c,null))[_0xd5e5('0x25')](saveUpdates(_0x18d22f[_0xd5e5('0x4a')],null))[_0xd5e5('0x25')](respondWithResult(_0x33ed9c,null))[_0xd5e5('0x44')](handleError(_0x33ed9c,null));};exports[_0xd5e5('0x26')]=function(_0x2ace54,_0x2c1c5b){return db[_0xd5e5('0x2c')][_0xd5e5('0x48')]({'where':{'id':_0x2ace54[_0xd5e5('0x45')]['id']}})[_0xd5e5('0x25')](handleEntityNotFound(_0x2c1c5b,null))[_0xd5e5('0x25')](removeEntity(_0x2c1c5b,null))[_0xd5e5('0x44')](handleError(_0x2c1c5b,null));};exports[_0xd5e5('0x4b')]=function(_0x30d78f,_0x59b06b){return db[_0xd5e5('0x2c')][_0xd5e5('0x4b')]()[_0xd5e5('0x25')](respondWithResult(_0x59b06b,null))[_0xd5e5('0x44')](handleError(_0x59b06b,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a8da3c1..bea5fef 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 _0xc8e9=['path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','request-promise'];(function(_0x178619,_0x35734e){var _0x2a71e9=function(_0x32ca77){while(--_0x32ca77){_0x178619['push'](_0x178619['shift']());}};_0x2a71e9(++_0x35734e);}(_0xc8e9,0x1f4));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9c8e('0x0'));var logger=require(_0x9c8e('0x1'))(_0x9c8e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c8e('0x3'));var fs=require('fs');var path=require(_0x9c8e('0x4'));var rimraf=require(_0x9c8e('0x5'));var config=require(_0x9c8e('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x9c8e('0x7')]=function(_0x38c013,_0x241bea){return _0x38c013[_0x9c8e('0x8')](_0x9c8e('0x9'),attributes,{'tableName':_0x9c8e('0xa'),'paranoid':![],'indexes':[{'name':_0x9c8e('0xb'),'fields':[_0x9c8e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd1=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','MailTransferReport','uniqueid'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5fd1,0x155));var _0x15fd=function(_0x120aac,_0x36ee4f){_0x120aac=_0x120aac-0x0;var _0x10cd58=_0x5fd1[_0x120aac];return _0x10cd58;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x15fd('0xa'),'fields':[_0x15fd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index bef2699..b2f75a7 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 _0x92f8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','client','request','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x20e622,_0x4d19c2){var _0x30aac2=function(_0x33fd70){while(--_0x33fd70){_0x20e622['push'](_0x20e622['shift']());}};_0x30aac2(++_0x4d19c2);}(_0x92f8,0x109));var _0x892f=function(_0x17b2f0,_0x1f6e62){_0x17b2f0=_0x17b2f0-0x0;var _0x42372a=_0x92f8[_0x17b2f0];return _0x42372a;};'use strict';var _=require(_0x892f('0x0'));var util=require(_0x892f('0x1'));var moment=require(_0x892f('0x2'));var BPromise=require(_0x892f('0x3'));var rs=require(_0x892f('0x4'));var fs=require('fs');var Redis=require(_0x892f('0x5'));var db=require(_0x892f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x892f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cd9a,_0x370188,_0x3702b3){return new BPromise(function(_0x165bc4,_0x82fe60){return client[_0x892f('0x8')](_0x25cd9a,_0x3702b3)['then'](function(_0x5479d1){logger[_0x892f('0x9')](_0x892f('0xa'),_0x370188,'request\x20sent');logger[_0x892f('0xb')](_0x892f('0xc'),_0x370188,_0x892f('0xd'),JSON[_0x892f('0xe')](_0x5479d1));if(_0x5479d1['error']){if(_0x5479d1[_0x892f('0xf')][_0x892f('0x10')]===0x1f4){logger[_0x892f('0xf')](_0x892f('0xa'),_0x370188,_0x5479d1[_0x892f('0xf')]['message']);return _0x82fe60(_0x5479d1[_0x892f('0xf')]['message']);}logger['error'](_0x892f('0xa'),_0x370188,_0x5479d1[_0x892f('0xf')][_0x892f('0x11')]);return _0x165bc4(_0x5479d1['error'][_0x892f('0x11')]);}else{logger[_0x892f('0x9')](_0x892f('0xa'),_0x370188,_0x892f('0xd'));_0x165bc4(_0x5479d1['result'][_0x892f('0x11')]);}})[_0x892f('0x12')](function(_0x47c1b4){logger['error'](_0x892f('0xa'),_0x370188,_0x47c1b4);_0x82fe60(_0x47c1b4);});});} \ No newline at end of file +var _0x6649=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','stringify','error','message','info','request\x20sent'];(function(_0x3e2569,_0xb5c0d9){var _0x310f79=function(_0xcbe38e){while(--_0xcbe38e){_0x3e2569['push'](_0x3e2569['shift']());}};_0x310f79(++_0xb5c0d9);}(_0x6649,0x6a));var _0x9664=function(_0x33dd75,_0x3d1a40){_0x33dd75=_0x33dd75-0x0;var _0x37ee4e=_0x6649[_0x33dd75];return _0x37ee4e;};'use strict';var _=require(_0x9664('0x0'));var util=require(_0x9664('0x1'));var moment=require(_0x9664('0x2'));var BPromise=require(_0x9664('0x3'));var rs=require(_0x9664('0x4'));var fs=require('fs');var Redis=require(_0x9664('0x5'));var db=require(_0x9664('0x6'))['db'];var utils=require(_0x9664('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9664('0x8'));var jayson=require(_0x9664('0x9'));var client=jayson[_0x9664('0xa')][_0x9664('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x275394,_0xe418d7,_0x106f86){return new BPromise(function(_0x444374,_0x3ad680){return client[_0x9664('0xc')](_0x275394,_0x106f86)[_0x9664('0xd')](function(_0x556379){logger['info'](_0x9664('0xe'),_0xe418d7,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xe418d7,'request\x20sent',JSON[_0x9664('0xf')](_0x556379));if(_0x556379[_0x9664('0x10')]){if(_0x556379[_0x9664('0x10')]['code']===0x1f4){logger[_0x9664('0x10')](_0x9664('0xe'),_0xe418d7,_0x556379['error'][_0x9664('0x11')]);return _0x3ad680(_0x556379[_0x9664('0x10')][_0x9664('0x11')]);}logger['error'](_0x9664('0xe'),_0xe418d7,_0x556379[_0x9664('0x10')]['message']);return _0x444374(_0x556379[_0x9664('0x10')][_0x9664('0x11')]);}else{logger[_0x9664('0x12')](_0x9664('0xe'),_0xe418d7,_0x9664('0x13'));_0x444374(_0x556379[_0x9664('0x14')][_0x9664('0x11')]);}})['catch'](function(_0x210b5b){logger[_0x9664('0x10')](_0x9664('0xe'),_0xe418d7,_0x210b5b);_0x3ad680(_0x210b5b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 118adf4..f83fc05 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 _0xca58=['create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x3de63e,_0x2e80fd){var _0x1d25ef=function(_0x3e53f6){while(--_0x3e53f6){_0x3de63e['push'](_0x3de63e['shift']());}};_0x1d25ef(++_0x2e80fd);}(_0xca58,0x1b5));var _0x8ca5=function(_0x55c91d,_0x5802b5){_0x55c91d=_0x55c91d-0x0;var _0x50e614=_0xca58[_0x55c91d];return _0x50e614;};'use strict';var multer=require('multer');var util=require(_0x8ca5('0x0'));var path=require(_0x8ca5('0x1'));var timeout=require(_0x8ca5('0x2'));var express=require(_0x8ca5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8ca5('0x4'));var interaction=require(_0x8ca5('0x5'));var config=require('../../config/environment');var controller=require(_0x8ca5('0x6'));router[_0x8ca5('0x7')]('/',auth['isAuthenticated'](),controller[_0x8ca5('0x8')]);router['get']('/describe',auth[_0x8ca5('0x9')](),controller[_0x8ca5('0xa')]);router[_0x8ca5('0x7')](_0x8ca5('0xb'),auth['isAuthenticated'](),controller[_0x8ca5('0xc')]);router['post']('/',auth[_0x8ca5('0x9')](),controller[_0x8ca5('0xd')]);router[_0x8ca5('0xe')](_0x8ca5('0xb'),auth[_0x8ca5('0x9')](),controller['update']);router[_0x8ca5('0xf')](_0x8ca5('0xb'),auth[_0x8ca5('0x9')](),controller[_0x8ca5('0x10')]);module[_0x8ca5('0x11')]=router; \ No newline at end of file +var _0xad5c=['multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','show','post','put','update','delete','/:id','destroy','exports'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xad5c,0xa2));var _0xcad5=function(_0x45e8dc,_0x4247ee){_0x45e8dc=_0x45e8dc-0x0;var _0x1f7a0d=_0xad5c[_0x45e8dc];return _0x1f7a0d;};'use strict';var multer=require(_0xcad5('0x0'));var util=require(_0xcad5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcad5('0x2'));var auth=require(_0xcad5('0x3'));var interaction=require(_0xcad5('0x4'));var config=require(_0xcad5('0x5'));var controller=require(_0xcad5('0x6'));router[_0xcad5('0x7')]('/',auth[_0xcad5('0x8')](),controller['index']);router[_0xcad5('0x7')](_0xcad5('0x9'),auth[_0xcad5('0x8')](),controller['describe']);router[_0xcad5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xcad5('0xa')]);router[_0xcad5('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcad5('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xcad5('0xd')]);router[_0xcad5('0xe')](_0xcad5('0xf'),auth['isAuthenticated'](),controller[_0xcad5('0x10')]);module[_0xcad5('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 5ca1645..3ef4799 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 _0xacfe=['setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xacfe,0xe4));var _0xeacf=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xacfe[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0xeacf('0x0'));var moment=require(_0xeacf('0x1'));module['exports']={'channel':{'type':Sequelize[_0xeacf('0x2')]},'membername':{'type':Sequelize[_0xeacf('0x2')]},'interface':{'type':Sequelize[_0xeacf('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xeacf('0x3'),'comment':_0xeacf('0x4')},'duration':{'type':Sequelize[_0xeacf('0x5')]},'enterAt':{'type':Sequelize[_0xeacf('0x6')]},'exitAt':{'type':Sequelize[_0xeacf('0x6')],'set':function(_0x2d441b){var _0x33edb4=moment(_0x2d441b);var _0x387e7f=moment(this[_0xeacf('0x7')](_0xeacf('0x8')));var _0x4783dd=_0x33edb4[_0xeacf('0x9')](_0x387e7f,_0xeacf('0xa'));this['setDataValue'](_0xeacf('0xb'),_0x2d441b);this[_0xeacf('0xc')]('duration',_0x4783dd>=0x0?_0x4783dd:null);}},'data1':{'type':Sequelize[_0xeacf('0x2')],'comment':_0xeacf('0xd')},'data2':{'type':Sequelize[_0xeacf('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xeacf('0x2')],'comment':_0xeacf('0xe')},'data4':{'type':Sequelize[_0xeacf('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xeacf('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xeacf('0x5')]},'uniqueid':{'type':Sequelize[_0xeacf('0x2')]}}; \ No newline at end of file +var _0x3814=['getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x46e47b,_0x5cf0ff){var _0x5dc772=function(_0x295532){while(--_0x295532){_0x46e47b['push'](_0x46e47b['shift']());}};_0x5dc772(++_0x5cf0ff);}(_0x3814,0xb7));var _0x4381=function(_0x41580a,_0x5b52a2){_0x41580a=_0x41580a-0x0;var _0x3989ac=_0x3814[_0x41580a];return _0x3989ac;};'use strict';var Sequelize=require(_0x4381('0x0'));var moment=require('moment');module[_0x4381('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4381('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4381('0x2')],'defaultValue':_0x4381('0x3'),'comment':_0x4381('0x4')},'duration':{'type':Sequelize[_0x4381('0x5')]},'enterAt':{'type':Sequelize[_0x4381('0x6')]},'exitAt':{'type':Sequelize[_0x4381('0x6')],'set':function(_0x535e9e){var _0x3aa1e6=moment(_0x535e9e);var _0x2416d1=moment(this[_0x4381('0x7')](_0x4381('0x8')));var _0x4be075=_0x3aa1e6[_0x4381('0x9')](_0x2416d1,_0x4381('0xa'));this[_0x4381('0xb')](_0x4381('0xc'),_0x535e9e);this[_0x4381('0xb')](_0x4381('0xd'),_0x4be075>=0x0?_0x4be075:null);}},'data1':{'type':Sequelize[_0x4381('0x2')],'comment':_0x4381('0xe')},'data2':{'type':Sequelize[_0x4381('0x2')],'comment':_0x4381('0xf')},'data3':{'type':Sequelize[_0x4381('0x2')],'comment':_0x4381('0x10')},'data4':{'type':Sequelize[_0x4381('0x2')],'comment':_0x4381('0x11')},'data5':{'type':Sequelize[_0x4381('0x2')],'comment':_0x4381('0x12')},'role':{'type':Sequelize[_0x4381('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x4381('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e1183e0..68d3268 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x26df3e,_0x597419){var _0x259f32=function(_0x1167e5){while(--_0x1167e5){_0x26df3e['push'](_0x26df3e['shift']());}};_0x259f32(++_0x597419);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55ca,0x126));var _0xa55c=function(_0x2abd13,_0x501317){_0x2abd13=_0x2abd13-0x0;var _0x5ad645=_0x55ca[_0x2abd13];return _0x5ad645;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 80b4e8e..17184f9 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 _0xf1d6=['../../config/logger','api','moment','request-promise','path','rimraf','define','MemberReport','report_member','lodash','util'];(function(_0x2f88bf,_0x761a0e){var _0x1b451e=function(_0x1116fa){while(--_0x1116fa){_0x2f88bf['push'](_0x2f88bf['shift']());}};_0x1b451e(++_0x761a0e);}(_0xf1d6,0x195));var _0x6f1d=function(_0x349a13,_0x3cd835){_0x349a13=_0x349a13-0x0;var _0x47ddc0=_0xf1d6[_0x349a13];return _0x47ddc0;};'use strict';var _=require(_0x6f1d('0x0'));var util=require(_0x6f1d('0x1'));var logger=require(_0x6f1d('0x2'))(_0x6f1d('0x3'));var moment=require(_0x6f1d('0x4'));var BPromise=require('bluebird');var rp=require(_0x6f1d('0x5'));var fs=require('fs');var path=require(_0x6f1d('0x6'));var rimraf=require(_0x6f1d('0x7'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module['exports']=function(_0x309bb7,_0x3c52ec){return _0x309bb7[_0x6f1d('0x8')](_0x6f1d('0x9'),attributes,{'tableName':_0x6f1d('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e57=['./memberReport.attributes','define','MemberReport','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x445fa0,_0x18c7e6){var _0x450b6d=function(_0x2802e3){while(--_0x2802e3){_0x445fa0['push'](_0x445fa0['shift']());}};_0x450b6d(++_0x18c7e6);}(_0x2e57,0x1cc));var _0x72e5=function(_0x305bcc,_0x202993){_0x305bcc=_0x305bcc-0x0;var _0x1aac97=_0x2e57[_0x305bcc];return _0x1aac97;};'use strict';var _=require(_0x72e5('0x0'));var util=require(_0x72e5('0x1'));var logger=require(_0x72e5('0x2'))(_0x72e5('0x3'));var moment=require(_0x72e5('0x4'));var BPromise=require(_0x72e5('0x5'));var rp=require(_0x72e5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x72e5('0x7'));var attributes=require(_0x72e5('0x8'));module['exports']=function(_0x319691,_0x42682d){return _0x319691[_0x72e5('0x9')](_0x72e5('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x72e5('0xb'),'fields':['membername',_0x72e5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 93df07f..461ed8f 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 _0xa49e=['map','model','then','info','catch','CreateMemberReport','UpdateMemberReport','update','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','MemberReport','findAll','options','where','attributes','include'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xa49e,0x1de));var _0xea49=function(_0x17d82f,_0x5d9172){_0x17d82f=_0x17d82f-0x0;var _0x58137b=_0xa49e[_0x17d82f];return _0x58137b;};'use strict';var _=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var moment=require(_0xea49('0x2'));var BPromise=require(_0xea49('0x3'));var rs=require(_0xea49('0x4'));var fs=require('fs');var Redis=require(_0xea49('0x5'));var db=require(_0xea49('0x6'))['db'];var utils=require(_0xea49('0x7'));var logger=require('../../config/logger')(_0xea49('0x8'));var config=require(_0xea49('0x9'));var jayson=require(_0xea49('0xa'));var client=jayson['client'][_0xea49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x184e00,_0xc682a,_0x35c89e){return new BPromise(function(_0x304770,_0x4d4dee){return client[_0xea49('0xc')](_0x184e00,_0x35c89e)['then'](function(_0x1ab756){logger['info']('MemberReport,\x20%s,\x20%s',_0xc682a,'request\x20sent');logger[_0xea49('0xd')](_0xea49('0xe'),_0xc682a,_0xea49('0xf'),JSON[_0xea49('0x10')](_0x1ab756));if(_0x1ab756[_0xea49('0x11')]){if(_0x1ab756[_0xea49('0x11')][_0xea49('0x12')]===0x1f4){logger[_0xea49('0x11')](_0xea49('0x13'),_0xc682a,_0x1ab756[_0xea49('0x11')][_0xea49('0x14')]);return _0x4d4dee(_0x1ab756['error'][_0xea49('0x14')]);}logger[_0xea49('0x11')](_0xea49('0x13'),_0xc682a,_0x1ab756[_0xea49('0x11')]['message']);return _0x304770(_0x1ab756[_0xea49('0x11')][_0xea49('0x14')]);}else{logger['info'](_0xea49('0x13'),_0xc682a,_0xea49('0xf'));_0x304770(_0x1ab756[_0xea49('0x15')][_0xea49('0x14')]);}})['catch'](function(_0x538efa){logger[_0xea49('0x11')]('MemberReport,\x20%s,\x20%s',_0xc682a,_0x538efa);_0x4d4dee(_0x538efa);});});}exports[_0xea49('0x16')]=function(_0x2010a0){var _0x27d0a2=this;return new Promise(function(_0x5f2984,_0x2f0bf6){return db[_0xea49('0x17')][_0xea49('0x18')]({'raw':_0x2010a0['options']?_0x2010a0[_0xea49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2010a0[_0xea49('0x19')]?_0x2010a0[_0xea49('0x19')][_0xea49('0x1a')]||null:null,'attributes':_0x2010a0[_0xea49('0x19')]?_0x2010a0[_0xea49('0x19')][_0xea49('0x1b')]||null:null,'limit':_0x2010a0[_0xea49('0x19')]?_0x2010a0[_0xea49('0x19')]['limit']||null:null,'include':_0x2010a0[_0xea49('0x19')]?_0x2010a0['options'][_0xea49('0x1c')]?_[_0xea49('0x1d')](_0x2010a0[_0xea49('0x19')][_0xea49('0x1c')],function(_0x20c832){return{'model':db[_0x20c832['model']],'as':_0x20c832['as'],'attributes':_0x20c832[_0xea49('0x1b')],'include':_0x20c832[_0xea49('0x1c')]?_[_0xea49('0x1d')](_0x20c832[_0xea49('0x1c')],function(_0xb13981){return{'model':db[_0xb13981['model']],'as':_0xb13981['as'],'attributes':_0xb13981[_0xea49('0x1b')],'include':_0xb13981[_0xea49('0x1c')]?_[_0xea49('0x1d')](_0xb13981[_0xea49('0x1c')],function(_0x48deb4){return{'model':db[_0x48deb4[_0xea49('0x1e')]],'as':_0x48deb4['as'],'attributes':_0x48deb4[_0xea49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xea49('0x1f')](function(_0x180d2b){logger[_0xea49('0x20')]('GetMemberReport',_0x2010a0);logger[_0xea49('0xd')](_0xea49('0x16'),_0x2010a0,JSON[_0xea49('0x10')](_0x180d2b));_0x5f2984(_0x180d2b);})[_0xea49('0x21')](function(_0x1ed0d4){logger[_0xea49('0x11')](_0xea49('0x16'),_0x1ed0d4[_0xea49('0x14')],_0x2010a0);_0x2f0bf6(_0x27d0a2[_0xea49('0x11')](0x1f4,_0x1ed0d4['message']));});});};exports['CreateMemberReport']=function(_0x1e63a2){var _0x268266=this;return new Promise(function(_0x9d2618,_0x56d69c){return db[_0xea49('0x17')]['create'](_0x1e63a2['body'],{'raw':_0x1e63a2[_0xea49('0x19')]?_0x1e63a2[_0xea49('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xea49('0x1f')](function(_0x4cd235){logger[_0xea49('0x20')](_0xea49('0x22'),_0x1e63a2);logger[_0xea49('0xd')]('CreateMemberReport',_0x1e63a2,JSON[_0xea49('0x10')](_0x4cd235));_0x9d2618(_0x4cd235);})[_0xea49('0x21')](function(_0x3cf9cc){logger[_0xea49('0x11')](_0xea49('0x22'),_0x3cf9cc[_0xea49('0x14')],_0x1e63a2);_0x56d69c(_0x268266[_0xea49('0x11')](0x1f4,_0x3cf9cc[_0xea49('0x14')]));});});};exports[_0xea49('0x23')]=function(_0x502026){var _0x2c3fef=this;return new Promise(function(_0x40bbeb,_0x23ab88){return db['MemberReport'][_0xea49('0x24')](_0x502026[_0xea49('0x25')],{'raw':_0x502026[_0xea49('0x19')]?_0x502026[_0xea49('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502026[_0xea49('0x19')]?_0x502026[_0xea49('0x19')][_0xea49('0x1a')]||null:null,'attributes':_0x502026[_0xea49('0x19')]?_0x502026[_0xea49('0x19')][_0xea49('0x1b')]||null:null,'limit':_0x502026[_0xea49('0x19')]?_0x502026[_0xea49('0x19')][_0xea49('0x26')]||null:null})[_0xea49('0x1f')](function(_0x273a58){logger[_0xea49('0x20')](_0xea49('0x23'),_0x502026);logger['debug']('UpdateMemberReport',_0x502026,JSON[_0xea49('0x10')](_0x273a58));_0x40bbeb(_0x273a58);})[_0xea49('0x21')](function(_0x487c31){logger[_0xea49('0x11')](_0xea49('0x23'),_0x487c31['message'],_0x502026);_0x23ab88(_0x2c3fef['error'](0x1f4,_0x487c31['message']));});});}; \ No newline at end of file +var _0x05bc=['request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport','options','raw','attributes','limit','include','map','model','CreateMemberReport','create','body','where','then','UpdateMemberReport','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x26791f,_0x320046){var _0x5628cc=function(_0x2a4d78){while(--_0x2a4d78){_0x26791f['push'](_0x26791f['shift']());}};_0x5628cc(++_0x320046);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc05b('0x0'));var moment=require('moment');var BPromise=require(_0xc05b('0x1'));var rs=require(_0xc05b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc05b('0x3'))['db'];var utils=require(_0xc05b('0x4'));var logger=require(_0xc05b('0x5'))(_0xc05b('0x6'));var config=require(_0xc05b('0x7'));var jayson=require(_0xc05b('0x8'));var client=jayson[_0xc05b('0x9')][_0xc05b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9c6c57,_0x1b501a,_0x275f0f){return new BPromise(function(_0x143ba4,_0x45245b){return client[_0xc05b('0xb')](_0x9c6c57,_0x275f0f)['then'](function(_0x5d72b9){logger[_0xc05b('0xc')](_0xc05b('0xd'),_0x1b501a,_0xc05b('0xe'));logger[_0xc05b('0xf')](_0xc05b('0x10'),_0x1b501a,_0xc05b('0xe'),JSON[_0xc05b('0x11')](_0x5d72b9));if(_0x5d72b9[_0xc05b('0x12')]){if(_0x5d72b9[_0xc05b('0x12')]['code']===0x1f4){logger[_0xc05b('0x12')](_0xc05b('0xd'),_0x1b501a,_0x5d72b9[_0xc05b('0x12')][_0xc05b('0x13')]);return _0x45245b(_0x5d72b9[_0xc05b('0x12')][_0xc05b('0x13')]);}logger['error'](_0xc05b('0xd'),_0x1b501a,_0x5d72b9[_0xc05b('0x12')]['message']);return _0x143ba4(_0x5d72b9['error'][_0xc05b('0x13')]);}else{logger[_0xc05b('0xc')](_0xc05b('0xd'),_0x1b501a,_0xc05b('0xe'));_0x143ba4(_0x5d72b9[_0xc05b('0x14')][_0xc05b('0x13')]);}})[_0xc05b('0x15')](function(_0x5a33c1){logger[_0xc05b('0x12')](_0xc05b('0xd'),_0x1b501a,_0x5a33c1);_0x45245b(_0x5a33c1);});});}exports[_0xc05b('0x16')]=function(_0x421cb){var _0x1cba94=this;return new Promise(function(_0x403290,_0x58224d){return db[_0xc05b('0x17')]['findAll']({'raw':_0x421cb[_0xc05b('0x18')]?_0x421cb[_0xc05b('0x18')][_0xc05b('0x19')]===undefined?!![]:![]:!![],'where':_0x421cb[_0xc05b('0x18')]?_0x421cb[_0xc05b('0x18')]['where']||null:null,'attributes':_0x421cb[_0xc05b('0x18')]?_0x421cb[_0xc05b('0x18')][_0xc05b('0x1a')]||null:null,'limit':_0x421cb[_0xc05b('0x18')]?_0x421cb['options'][_0xc05b('0x1b')]||null:null,'include':_0x421cb[_0xc05b('0x18')]?_0x421cb[_0xc05b('0x18')][_0xc05b('0x1c')]?_[_0xc05b('0x1d')](_0x421cb[_0xc05b('0x18')]['include'],function(_0x585447){return{'model':db[_0x585447[_0xc05b('0x1e')]],'as':_0x585447['as'],'attributes':_0x585447[_0xc05b('0x1a')],'include':_0x585447['include']?_[_0xc05b('0x1d')](_0x585447['include'],function(_0x54b3a9){return{'model':db[_0x54b3a9[_0xc05b('0x1e')]],'as':_0x54b3a9['as'],'attributes':_0x54b3a9['attributes'],'include':_0x54b3a9['include']?_['map'](_0x54b3a9[_0xc05b('0x1c')],function(_0x4c133c){return{'model':db[_0x4c133c[_0xc05b('0x1e')]],'as':_0x4c133c['as'],'attributes':_0x4c133c[_0xc05b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x337cc1){logger[_0xc05b('0xc')](_0xc05b('0x16'),_0x421cb);logger[_0xc05b('0xf')](_0xc05b('0x16'),_0x421cb,JSON[_0xc05b('0x11')](_0x337cc1));_0x403290(_0x337cc1);})[_0xc05b('0x15')](function(_0x2ba6b4){logger[_0xc05b('0x12')](_0xc05b('0x16'),_0x2ba6b4[_0xc05b('0x13')],_0x421cb);_0x58224d(_0x1cba94[_0xc05b('0x12')](0x1f4,_0x2ba6b4['message']));});});};exports[_0xc05b('0x1f')]=function(_0x56cc4a){var _0x370d05=this;return new Promise(function(_0x54286a,_0x580d43){return db[_0xc05b('0x17')][_0xc05b('0x20')](_0x56cc4a[_0xc05b('0x21')],{'raw':_0x56cc4a['options']?_0x56cc4a[_0xc05b('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4f9c53){logger[_0xc05b('0xc')](_0xc05b('0x1f'),_0x56cc4a);logger[_0xc05b('0xf')]('CreateMemberReport',_0x56cc4a,JSON[_0xc05b('0x11')](_0x4f9c53));_0x54286a(_0x4f9c53);})[_0xc05b('0x15')](function(_0x3ca671){logger[_0xc05b('0x12')]('CreateMemberReport',_0x3ca671[_0xc05b('0x13')],_0x56cc4a);_0x580d43(_0x370d05[_0xc05b('0x12')](0x1f4,_0x3ca671[_0xc05b('0x13')]));});});};exports['UpdateMemberReport']=function(_0x3e3309){var _0x1b2e4d=this;return new Promise(function(_0x5b57d7,_0x185c98){return db[_0xc05b('0x17')]['update'](_0x3e3309['body'],{'raw':_0x3e3309[_0xc05b('0x18')]?_0x3e3309[_0xc05b('0x18')][_0xc05b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e3309[_0xc05b('0x18')]?_0x3e3309['options'][_0xc05b('0x22')]||null:null,'attributes':_0x3e3309['options']?_0x3e3309[_0xc05b('0x18')][_0xc05b('0x1a')]||null:null,'limit':_0x3e3309[_0xc05b('0x18')]?_0x3e3309[_0xc05b('0x18')]['limit']||null:null})[_0xc05b('0x23')](function(_0x37a454){logger['info']('UpdateMemberReport',_0x3e3309);logger[_0xc05b('0xf')](_0xc05b('0x24'),_0x3e3309,JSON[_0xc05b('0x11')](_0x37a454));_0x5b57d7(_0x37a454);})[_0xc05b('0x15')](function(_0x35ae2e){logger['error'](_0xc05b('0x24'),_0x35ae2e[_0xc05b('0x13')],_0x3e3309);_0x185c98(_0x1b2e4d[_0xc05b('0x12')](0x1f4,_0x35ae2e[_0xc05b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4c1e7fc..07f8298 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 _0xad1a=['get','index','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x445261,_0x320105){var _0xec00a2=function(_0x324634){while(--_0x324634){_0x445261['push'](_0x445261['shift']());}};_0xec00a2(++_0x320105);}(_0xad1a,0xff));var _0xaad1=function(_0x39f83e,_0x2d1370){_0x39f83e=_0x39f83e-0x0;var _0x8fe9ad=_0xad1a[_0x39f83e];return _0x8fe9ad;};'use strict';var multer=require(_0xaad1('0x0'));var util=require(_0xaad1('0x1'));var path=require(_0xaad1('0x2'));var timeout=require(_0xaad1('0x3'));var express=require(_0xaad1('0x4'));var router=express[_0xaad1('0x5')]();var fs_extra=require(_0xaad1('0x6'));var auth=require(_0xaad1('0x7'));var interaction=require(_0xaad1('0x8'));var config=require(_0xaad1('0x9'));var controller=require(_0xaad1('0xa'));router[_0xaad1('0xb')]('/',controller[_0xaad1('0xc')]);module[_0xaad1('0xd')]=router; \ No newline at end of file +var _0xb6af=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util','path','express','Router','fs-extra'];(function(_0x264a70,_0x57194a){var _0x3c8638=function(_0x2cc1ae){while(--_0x2cc1ae){_0x264a70['push'](_0x264a70['shift']());}};_0x3c8638(++_0x57194a);}(_0xb6af,0x1ce));var _0xfb6a=function(_0x144c0c,_0x113cfe){_0x144c0c=_0x144c0c-0x0;var _0x436221=_0xb6af[_0x144c0c];return _0x436221;};'use strict';var multer=require(_0xfb6a('0x0'));var util=require(_0xfb6a('0x1'));var path=require(_0xfb6a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb6a('0x3'));var router=express[_0xfb6a('0x4')]();var fs_extra=require(_0xfb6a('0x5'));var auth=require(_0xfb6a('0x6'));var interaction=require(_0xfb6a('0x7'));var config=require(_0xfb6a('0x8'));var controller=require(_0xfb6a('0x9'));router[_0xfb6a('0xa')]('/',controller[_0xfb6a('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 5fa4739..6d2dcdb 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 _0x7802=['STRING','version'];(function(_0x779c76,_0x2a1f6e){var _0x5de701=function(_0x13b41e){while(--_0x13b41e){_0x779c76['push'](_0x779c76['shift']());}};_0x5de701(++_0x2a1f6e);}(_0x7802,0x104));var _0x2780=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x7802[_0x31df6f];return _0x31e353;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x2780('0x0')],'unique':_0x2780('0x1')}}; \ No newline at end of file +var _0xe204=['version','sequelize','exports','STRING'];(function(_0xc79956,_0x1f5698){var _0x1b29dc=function(_0x5cffc3){while(--_0x5cffc3){_0xc79956['push'](_0xc79956['shift']());}};_0x1b29dc(++_0x1f5698);}(_0xe204,0xad));var _0x4e20=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe204[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x4e20('0x0'));module[_0x4e20('0x1')]={'version':{'type':Sequelize[_0x4e20('0x2')],'unique':_0x4e20('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 870e684..9c09ce8 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 _0xadbe=['options','Migration','includeAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0xfdedff,_0x959e24){var _0x429de9=function(_0x35f439){while(--_0x35f439){_0xfdedff['push'](_0xfdedff['shift']());}};_0x429de9(++_0x959e24);}(_0xadbe,0x1af));var _0xeadb=function(_0x1b0111,_0x27aa91){_0x1b0111=_0x1b0111-0x0;var _0x3ed76f=_0xadbe[_0x1b0111];return _0x3ed76f;};'use strict';var emlformat=require(_0xeadb('0x0'));var rimraf=require(_0xeadb('0x1'));var zipdir=require(_0xeadb('0x2'));var jsonpatch=require(_0xeadb('0x3'));var rp=require('request-promise');var moment=require(_0xeadb('0x4'));var BPromise=require(_0xeadb('0x5'));var Mustache=require(_0xeadb('0x6'));var util=require(_0xeadb('0x7'));var path=require(_0xeadb('0x8'));var sox=require(_0xeadb('0x9'));var csv=require('to-csv');var ejs=require(_0xeadb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeadb('0xb'));var squel=require(_0xeadb('0xc'));var crypto=require(_0xeadb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeadb('0xe'));var toCsv=require(_0xeadb('0xf'));var querystring=require(_0xeadb('0x10'));var Papa=require(_0xeadb('0x11'));var Redis=require(_0xeadb('0x12'));var authService=require(_0xeadb('0x13'));var qs=require(_0xeadb('0x14'));var as=require(_0xeadb('0x15'));var hardwareService=require(_0xeadb('0x16'));var logger=require(_0xeadb('0x17'))(_0xeadb('0x18'));var utils=require(_0xeadb('0x19'));var config=require(_0xeadb('0x1a'));var licenseUtil=require(_0xeadb('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16c809,_0x2e4229){_0x2e4229=_0x2e4229||0xcc;return function(_0x529707){if(_0x529707){return _0x16c809['sendStatus'](_0x2e4229);}return _0x16c809[_0xeadb('0x1c')](_0x2e4229)[_0xeadb('0x1d')]();};}function respondWithResult(_0x448fc3,_0x4e6642){_0x4e6642=_0x4e6642||0xc8;return function(_0x4b5887){if(_0x4b5887){return _0x448fc3['status'](_0x4e6642)[_0xeadb('0x1e')](_0x4b5887);}};}function respondWithFilteredResult(_0x567574,_0x39abd7){return function(_0x30551e){if(_0x30551e){var _0x248139=typeof _0x39abd7[_0xeadb('0x1f')]===_0xeadb('0x20')&&typeof _0x39abd7[_0xeadb('0x21')]===_0xeadb('0x20');var _0x4c696c=_0x30551e[_0xeadb('0x22')];var _0xfb4740=_0x248139?0x0:_0x39abd7['offset'];var _0x2f64e8=_0x248139?_0x30551e['count']:_0x39abd7['offset']+_0x39abd7[_0xeadb('0x21')];var _0x45d460;if(_0x2f64e8>=_0x4c696c){_0x2f64e8=_0x4c696c;_0x45d460=0xc8;}else{_0x45d460=0xce;}_0x567574[_0xeadb('0x1c')](_0x45d460);return _0x567574[_0xeadb('0x23')](_0xeadb('0x24'),_0xfb4740+'-'+_0x2f64e8+'/'+_0x4c696c)['json'](_0x30551e);}return null;};}function patchUpdates(_0x50779a){return function(_0x42ed60){try{jsonpatch[_0xeadb('0x25')](_0x42ed60,_0x50779a,!![]);}catch(_0x589a8c){return BPromise[_0xeadb('0x26')](_0x589a8c);}return _0x42ed60[_0xeadb('0x27')]();};}function saveUpdates(_0x29392a,_0x146a95){return function(_0x4c67f7){if(_0x4c67f7){return _0x4c67f7[_0xeadb('0x28')](_0x29392a)[_0xeadb('0x29')](function(_0x15a447){return _0x15a447;});}return null;};}function removeEntity(_0x3e5511,_0x4bf91a){return function(_0x16bf81){if(_0x16bf81){return _0x16bf81[_0xeadb('0x2a')]()[_0xeadb('0x29')](function(){_0x3e5511[_0xeadb('0x1c')](0xcc)[_0xeadb('0x1d')]();});}};}function handleEntityNotFound(_0x7c32ad,_0x1462cb){return function(_0x3d599f){if(!_0x3d599f){_0x7c32ad[_0xeadb('0x2b')](0x194);}return _0x3d599f;};}function handleError(_0x34c2f9,_0x70daab){_0x70daab=_0x70daab||0x1f4;return function(_0x14cece){logger['error'](_0x14cece['stack']);if(_0x14cece[_0xeadb('0x2c')]){delete _0x14cece['name'];}_0x34c2f9[_0xeadb('0x1c')](_0x70daab)[_0xeadb('0x2d')](_0x14cece);};}exports[_0xeadb('0x2e')]=function(_0x26dd4a,_0x25a5ee){var _0x9b55a={},_0x5de119={},_0x1b5000={'count':0x0,'rows':[]};var _0x325f19=_[_0xeadb('0x2f')](db['Migration'][_0xeadb('0x30')],function(_0x2f8f50){return{'name':_0x2f8f50[_0xeadb('0x31')],'type':_0x2f8f50[_0xeadb('0x32')]['key']};});_0x5de119[_0xeadb('0x33')]=_[_0xeadb('0x2f')](_0x325f19,_0xeadb('0x2c'));_0x5de119[_0xeadb('0x34')]=_['keys'](_0x26dd4a[_0xeadb('0x34')]);_0x5de119[_0xeadb('0x35')]=_[_0xeadb('0x36')](_0x5de119[_0xeadb('0x33')],_0x5de119['query']);_0x9b55a[_0xeadb('0x37')]=_[_0xeadb('0x36')](_0x5de119[_0xeadb('0x33')],qs[_0xeadb('0x38')](_0x26dd4a[_0xeadb('0x34')][_0xeadb('0x38')]));_0x9b55a[_0xeadb('0x37')]=_0x9b55a['attributes'][_0xeadb('0x39')]?_0x9b55a['attributes']:_0x5de119['model'];if(!_0x26dd4a['query'][_0xeadb('0x3a')](_0xeadb('0x3b'))){_0x9b55a[_0xeadb('0x21')]=qs[_0xeadb('0x21')](_0x26dd4a[_0xeadb('0x34')][_0xeadb('0x21')]);_0x9b55a[_0xeadb('0x1f')]=qs[_0xeadb('0x1f')](_0x26dd4a[_0xeadb('0x34')][_0xeadb('0x1f')]);}_0x9b55a[_0xeadb('0x3c')]=qs[_0xeadb('0x3d')](_0x26dd4a['query'][_0xeadb('0x3d')]);_0x9b55a[_0xeadb('0x3e')]=qs[_0xeadb('0x35')](_['pick'](_0x26dd4a['query'],_0x5de119[_0xeadb('0x35')]),_0x325f19);if(_0x26dd4a[_0xeadb('0x34')][_0xeadb('0x3f')]){_0x9b55a[_0xeadb('0x3e')]=_['merge'](_0x9b55a['where'],{'$or':_[_0xeadb('0x2f')](_0x325f19,function(_0x4b7525){if(_0x4b7525[_0xeadb('0x32')]!==_0xeadb('0x40')){var _0x4f2eff={};_0x4f2eff[_0x4b7525[_0xeadb('0x2c')]]={'$like':'%'+_0x26dd4a['query'][_0xeadb('0x3f')]+'%'};return _0x4f2eff;}})});}_0x9b55a=_[_0xeadb('0x41')]({},_0x9b55a,_0x26dd4a[_0xeadb('0x42')]);var _0x15f249={'where':_0x9b55a[_0xeadb('0x3e')]};return db[_0xeadb('0x43')][_0xeadb('0x22')](_0x15f249)['then'](function(_0x57b0fc){_0x1b5000[_0xeadb('0x22')]=_0x57b0fc;if(_0x26dd4a[_0xeadb('0x34')][_0xeadb('0x44')]){_0x9b55a['include']=[{'all':!![]}];}return db[_0xeadb('0x43')]['findAll'](_0x9b55a);})[_0xeadb('0x29')](function(_0x384bcf){_0x1b5000[_0xeadb('0x45')]=_0x384bcf;return _0x1b5000;})[_0xeadb('0x29')](respondWithFilteredResult(_0x25a5ee,_0x9b55a))[_0xeadb('0x46')](handleError(_0x25a5ee,null));}; \ No newline at end of file +var _0x6426=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','then','destroy','end','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','rimraf','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x434758,_0x59e4de){var _0x2203ef=function(_0x518998){while(--_0x518998){_0x434758['push'](_0x434758['shift']());}};_0x2203ef(++_0x59e4de);}(_0x6426,0x1eb));var _0x6642=function(_0x1cfc09,_0x33a5b5){_0x1cfc09=_0x1cfc09-0x0;var _0x2642ca=_0x6426[_0x1cfc09];return _0x2642ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6642('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6642('0x1'));var rp=require('request-promise');var moment=require(_0x6642('0x2'));var BPromise=require(_0x6642('0x3'));var Mustache=require(_0x6642('0x4'));var util=require(_0x6642('0x5'));var path=require(_0x6642('0x6'));var sox=require(_0x6642('0x7'));var csv=require(_0x6642('0x8'));var ejs=require(_0x6642('0x9'));var fs=require('fs');var fs_extra=require(_0x6642('0xa'));var _=require(_0x6642('0xb'));var squel=require('squel');var crypto=require(_0x6642('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6642('0xd'));var toCsv=require(_0x6642('0x8'));var querystring=require(_0x6642('0xe'));var Papa=require(_0x6642('0xf'));var Redis=require(_0x6642('0x10'));var authService=require(_0x6642('0x11'));var qs=require(_0x6642('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6642('0x13'));var logger=require(_0x6642('0x14'))(_0x6642('0x15'));var utils=require('../../config/utils');var config=require(_0x6642('0x16'));var licenseUtil=require(_0x6642('0x17'));var db=require(_0x6642('0x18'))['db'];function respondWithStatusCode(_0x5b4d88,_0x33ebc8){_0x33ebc8=_0x33ebc8||0xcc;return function(_0x53d83f){if(_0x53d83f){return _0x5b4d88[_0x6642('0x19')](_0x33ebc8);}return _0x5b4d88[_0x6642('0x1a')](_0x33ebc8)['end']();};}function respondWithResult(_0x4d1ee7,_0x5f4a58){_0x5f4a58=_0x5f4a58||0xc8;return function(_0x4dc136){if(_0x4dc136){return _0x4d1ee7[_0x6642('0x1a')](_0x5f4a58)[_0x6642('0x1b')](_0x4dc136);}};}function respondWithFilteredResult(_0x52a1e2,_0xa7ee7e){return function(_0x4e570f){if(_0x4e570f){var _0x4b41c1=typeof _0xa7ee7e[_0x6642('0x1c')]===_0x6642('0x1d')&&typeof _0xa7ee7e[_0x6642('0x1e')]==='undefined';var _0xd76ed1=_0x4e570f[_0x6642('0x1f')];var _0x50d2c1=_0x4b41c1?0x0:_0xa7ee7e[_0x6642('0x1c')];var _0x3844f8=_0x4b41c1?_0x4e570f[_0x6642('0x1f')]:_0xa7ee7e[_0x6642('0x1c')]+_0xa7ee7e[_0x6642('0x1e')];var _0x2cf34e;if(_0x3844f8>=_0xd76ed1){_0x3844f8=_0xd76ed1;_0x2cf34e=0xc8;}else{_0x2cf34e=0xce;}_0x52a1e2[_0x6642('0x1a')](_0x2cf34e);return _0x52a1e2[_0x6642('0x20')](_0x6642('0x21'),_0x50d2c1+'-'+_0x3844f8+'/'+_0xd76ed1)[_0x6642('0x1b')](_0x4e570f);}return null;};}function patchUpdates(_0x28d53a){return function(_0x399b0){try{jsonpatch[_0x6642('0x22')](_0x399b0,_0x28d53a,!![]);}catch(_0x58061f){return BPromise[_0x6642('0x23')](_0x58061f);}return _0x399b0[_0x6642('0x24')]();};}function saveUpdates(_0xdc7fbe,_0xee21e){return function(_0x1cbd26){if(_0x1cbd26){return _0x1cbd26['update'](_0xdc7fbe)[_0x6642('0x25')](function(_0x321722){return _0x321722;});}return null;};}function removeEntity(_0x168599,_0x4bbca0){return function(_0x384739){if(_0x384739){return _0x384739[_0x6642('0x26')]()[_0x6642('0x25')](function(){_0x168599[_0x6642('0x1a')](0xcc)[_0x6642('0x27')]();});}};}function handleEntityNotFound(_0x43f77f,_0x4d92c9){return function(_0x522490){if(!_0x522490){_0x43f77f[_0x6642('0x19')](0x194);}return _0x522490;};}function handleError(_0xe27271,_0x2b8510){_0x2b8510=_0x2b8510||0x1f4;return function(_0x1ca323){logger[_0x6642('0x28')](_0x1ca323[_0x6642('0x29')]);if(_0x1ca323[_0x6642('0x2a')]){delete _0x1ca323['name'];}_0xe27271['status'](_0x2b8510)[_0x6642('0x2b')](_0x1ca323);};}exports[_0x6642('0x2c')]=function(_0x562ecc,_0x2b76cc){var _0x10ccf6={},_0x412cdb={},_0x519d7d={'count':0x0,'rows':[]};var _0x2cbe2a=_[_0x6642('0x2d')](db[_0x6642('0x2e')][_0x6642('0x2f')],function(_0x5e24e5){return{'name':_0x5e24e5[_0x6642('0x30')],'type':_0x5e24e5['type'][_0x6642('0x31')]};});_0x412cdb['model']=_[_0x6642('0x2d')](_0x2cbe2a,_0x6642('0x2a'));_0x412cdb[_0x6642('0x32')]=_[_0x6642('0x33')](_0x562ecc[_0x6642('0x32')]);_0x412cdb[_0x6642('0x34')]=_[_0x6642('0x35')](_0x412cdb['model'],_0x412cdb[_0x6642('0x32')]);_0x10ccf6[_0x6642('0x36')]=_['intersection'](_0x412cdb[_0x6642('0x37')],qs[_0x6642('0x38')](_0x562ecc[_0x6642('0x32')][_0x6642('0x38')]));_0x10ccf6[_0x6642('0x36')]=_0x10ccf6[_0x6642('0x36')][_0x6642('0x39')]?_0x10ccf6[_0x6642('0x36')]:_0x412cdb[_0x6642('0x37')];if(!_0x562ecc['query'][_0x6642('0x3a')](_0x6642('0x3b'))){_0x10ccf6[_0x6642('0x1e')]=qs[_0x6642('0x1e')](_0x562ecc['query']['limit']);_0x10ccf6[_0x6642('0x1c')]=qs[_0x6642('0x1c')](_0x562ecc[_0x6642('0x32')][_0x6642('0x1c')]);}_0x10ccf6[_0x6642('0x3c')]=qs[_0x6642('0x3d')](_0x562ecc[_0x6642('0x32')][_0x6642('0x3d')]);_0x10ccf6[_0x6642('0x3e')]=qs['filters'](_[_0x6642('0x3f')](_0x562ecc['query'],_0x412cdb[_0x6642('0x34')]),_0x2cbe2a);if(_0x562ecc['query'][_0x6642('0x40')]){_0x10ccf6[_0x6642('0x3e')]=_[_0x6642('0x41')](_0x10ccf6['where'],{'$or':_[_0x6642('0x2d')](_0x2cbe2a,function(_0x4042de){if(_0x4042de[_0x6642('0x42')]!=='VIRTUAL'){var _0x89643f={};_0x89643f[_0x4042de[_0x6642('0x2a')]]={'$like':'%'+_0x562ecc['query'][_0x6642('0x40')]+'%'};return _0x89643f;}})});}_0x10ccf6=_['merge']({},_0x10ccf6,_0x562ecc[_0x6642('0x43')]);var _0x15a77a={'where':_0x10ccf6['where']};return db[_0x6642('0x2e')][_0x6642('0x1f')](_0x15a77a)['then'](function(_0x4f3191){_0x519d7d[_0x6642('0x1f')]=_0x4f3191;if(_0x562ecc[_0x6642('0x32')][_0x6642('0x44')]){_0x10ccf6[_0x6642('0x45')]=[{'all':!![]}];}return db[_0x6642('0x2e')]['findAll'](_0x10ccf6);})[_0x6642('0x25')](function(_0x57fffa){_0x519d7d['rows']=_0x57fffa;return _0x519d7d;})['then'](respondWithFilteredResult(_0x2b76cc,_0x10ccf6))[_0x6642('0x46')](handleError(_0x2b76cc,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 609b765..f4f1561 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 _0xb889=['api','moment','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','Migration','lodash','util'];(function(_0x41243e,_0x19b98c){var _0x540ef9=function(_0x4e6ccf){while(--_0x4e6ccf){_0x41243e['push'](_0x41243e['shift']());}};_0x540ef9(++_0x19b98c);}(_0xb889,0x1c1));var _0x9b88=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xb889[_0x35da42];return _0x370035;};'use strict';var _=require(_0x9b88('0x0'));var util=require(_0x9b88('0x1'));var logger=require('../../config/logger')(_0x9b88('0x2'));var moment=require(_0x9b88('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b88('0x4'));var fs=require('fs');var path=require(_0x9b88('0x5'));var rimraf=require(_0x9b88('0x6'));var config=require(_0x9b88('0x7'));var attributes=require(_0x9b88('0x8'));module['exports']=function(_0x2a0fe9,_0x137fc2){return _0x2a0fe9[_0x9b88('0x9')](_0x9b88('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88b4=['migrations','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','Migration'];(function(_0x496819,_0x2e3e5f){var _0x5d8095=function(_0x55afa3){while(--_0x55afa3){_0x496819['push'](_0x496819['shift']());}};_0x5d8095(++_0x2e3e5f);}(_0x88b4,0x7a));var _0x488b=function(_0xfbe06e,_0x2fb7ab){_0xfbe06e=_0xfbe06e-0x0;var _0x24e5b6=_0x88b4[_0xfbe06e];return _0x24e5b6;};'use strict';var _=require(_0x488b('0x0'));var util=require('util');var logger=require(_0x488b('0x1'))('api');var moment=require(_0x488b('0x2'));var BPromise=require(_0x488b('0x3'));var rp=require(_0x488b('0x4'));var fs=require('fs');var path=require(_0x488b('0x5'));var rimraf=require('rimraf');var config=require(_0x488b('0x6'));var attributes=require(_0x488b('0x7'));module[_0x488b('0x8')]=function(_0xb67bd2,_0x2256fa){return _0xb67bd2['define'](_0x488b('0x9'),attributes,{'tableName':_0x488b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 6446550..cde780c 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 _0x1be1=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x1be1,0x192));var _0x11be=function(_0x5587d5,_0x385034){_0x5587d5=_0x5587d5-0x0;var _0x5467e0=_0x1be1[_0x5587d5];return _0x5467e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('Migration,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('Migration,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});} \ No newline at end of file +var _0xd139=['../../config/logger','rpc','../../config/environment','client','http','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x119e57,_0x49a453){var _0xa89dc7=function(_0x2c6709){while(--_0x2c6709){_0x119e57['push'](_0x119e57['shift']());}};_0xa89dc7(++_0x49a453);}(_0xd139,0x14e));var _0x9d13=function(_0x210d57,_0x280153){_0x210d57=_0x210d57-0x0;var _0x32a96a=_0xd139[_0x210d57];return _0x32a96a;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d13('0x2'));var fs=require('fs');var Redis=require(_0x9d13('0x3'));var db=require(_0x9d13('0x4'))['db'];var utils=require(_0x9d13('0x5'));var logger=require(_0x9d13('0x6'))(_0x9d13('0x7'));var config=require(_0x9d13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d13('0x9')][_0x9d13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50294b,_0x198d7d,_0x4b3db0){return new BPromise(function(_0x434ef6,_0x524947){return client['request'](_0x50294b,_0x4b3db0)['then'](function(_0x3ccdf9){logger[_0x9d13('0xb')](_0x9d13('0xc'),_0x198d7d,_0x9d13('0xd'));logger[_0x9d13('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x198d7d,_0x9d13('0xd'),JSON[_0x9d13('0xf')](_0x3ccdf9));if(_0x3ccdf9[_0x9d13('0x10')]){if(_0x3ccdf9['error']['code']===0x1f4){logger[_0x9d13('0x10')](_0x9d13('0xc'),_0x198d7d,_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);return _0x524947(_0x3ccdf9[_0x9d13('0x10')]['message']);}logger['error'](_0x9d13('0xc'),_0x198d7d,_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);return _0x434ef6(_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);}else{logger[_0x9d13('0xb')](_0x9d13('0xc'),_0x198d7d,'request\x20sent');_0x434ef6(_0x3ccdf9[_0x9d13('0x12')][_0x9d13('0x11')]);}})[_0x9d13('0x13')](function(_0x250234){logger[_0x9d13('0x10')](_0x9d13('0xc'),_0x198d7d,_0x250234);_0x524947(_0x250234);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 53c897c..4bc9fb2 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 _0xf777=['isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','index','/:id','show','post'];(function(_0x279f85,_0x3935ee){var _0x1722d5=function(_0x158ba7){while(--_0x158ba7){_0x279f85['push'](_0x279f85['shift']());}};_0x1722d5(++_0x3935ee);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var path=require(_0x7f77('0x2'));var timeout=require(_0x7f77('0x3'));var express=require(_0x7f77('0x4'));var router=express[_0x7f77('0x5')]();var fs_extra=require(_0x7f77('0x6'));var auth=require(_0x7f77('0x7'));var interaction=require(_0x7f77('0x8'));var config=require('../../config/environment');var controller=require(_0x7f77('0x9'));router[_0x7f77('0xa')]('/',auth['isAuthenticated'](),controller[_0x7f77('0xb')]);router['get'](_0x7f77('0xc'),auth['isAuthenticated'](),controller[_0x7f77('0xd')]);router[_0x7f77('0xe')]('/',auth[_0x7f77('0xf')](),controller[_0x7f77('0x10')]);router[_0x7f77('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7f77('0x12')]);router[_0x7f77('0x13')](_0x7f77('0xc'),auth[_0x7f77('0xf')](),controller[_0x7f77('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6a58=['update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x3d7bab,_0x439da7){var _0x209859=function(_0x132190){while(--_0x132190){_0x3d7bab['push'](_0x3d7bab['shift']());}};_0x209859(++_0x439da7);}(_0x6a58,0x120));var _0x86a5=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x6a58[_0x368e09];return _0x14b7df;};'use strict';var multer=require(_0x86a5('0x0'));var util=require(_0x86a5('0x1'));var path=require('path');var timeout=require(_0x86a5('0x2'));var express=require('express');var router=express[_0x86a5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x86a5('0x4'));var interaction=require(_0x86a5('0x5'));var config=require(_0x86a5('0x6'));var controller=require(_0x86a5('0x7'));router[_0x86a5('0x8')]('/',auth['isAuthenticated'](),controller[_0x86a5('0x9')]);router[_0x86a5('0x8')]('/:id',auth[_0x86a5('0xa')](),controller[_0x86a5('0xb')]);router[_0x86a5('0xc')]('/',auth[_0x86a5('0xa')](),controller[_0x86a5('0xd')]);router[_0x86a5('0xe')](_0x86a5('0xf'),auth[_0x86a5('0xa')](),controller[_0x86a5('0x10')]);router[_0x86a5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x86a5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 0c354b3..3315f39 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 _0x90ca=['localnet','externip','stun','turn','STRING','sequelize'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x90ca,0xcb));var _0xa90c=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x90ca[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0xa90c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa90c('0x1'),_0xa90c('0x2'),_0xa90c('0x3'),_0xa90c('0x4'))},'value':{'type':Sequelize[_0xa90c('0x5')]},'username':{'type':Sequelize[_0xa90c('0x5')]},'password':{'type':Sequelize[_0xa90c('0x5')]}}; \ No newline at end of file +var _0x543f=['externip','stun','turn','STRING','ENUM'];(function(_0x69050,_0x4a5981){var _0x231d0b=function(_0x53837b){while(--_0x53837b){_0x69050['push'](_0x69050['shift']());}};_0x231d0b(++_0x4a5981);}(_0x543f,0x126));var _0xf543=function(_0x375421,_0x5b57fe){_0x375421=_0x375421-0x0;var _0x2da1a6=_0x543f[_0x375421];return _0x2da1a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf543('0x0')]('localnet',_0xf543('0x1'),_0xf543('0x2'),_0xf543('0x3'))},'value':{'type':Sequelize[_0xf543('0x4')]},'username':{'type':Sequelize[_0xf543('0x4')]},'password':{'type':Sequelize[_0xf543('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 76230f5..741bb83 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 _0x7276=['TURN','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','server/files/templates/turn_multiple.ejs','format','server/files/templates/network.ejs','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','info','result','json','offset','undefined','status','Content-Range','update','destroy','end','sendStatus','stack','name','send','Network','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf'];(function(_0x36af18,_0x46052a){var _0x55a4c1=function(_0x3675f6){while(--_0x3675f6){_0x36af18['push'](_0x36af18['shift']());}};_0x55a4c1(++_0x46052a);}(_0x7276,0x16e));var _0x6727=function(_0x3f06b8,_0x45c58c){_0x3f06b8=_0x3f06b8-0x0;var _0x5d2028=_0x7276[_0x3f06b8];return _0x5d2028;};'use strict';var util=require(_0x6727('0x0'));var path=require(_0x6727('0x1'));var ejs=require(_0x6727('0x2'));var fs=require('fs');var _=require(_0x6727('0x3'));var qs=require(_0x6727('0x4'));var logger=require(_0x6727('0x5'))(_0x6727('0x6'));var config=require(_0x6727('0x7'));var db=require(_0x6727('0x8'))['db'];var jayson=require(_0x6727('0x9'));var client=jayson['client'][_0x6727('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cb7d6,_0x56c17e,_0x5c6c29,_0x130a92){return new Promise(function(_0x421a97,_0x6fe7e7){var _0x4e8f22=_0x130a92||client;return _0x4e8f22[_0x6727('0xb')](_0x1cb7d6,_0x5c6c29)[_0x6727('0xc')](function(_0x29789f){logger['info']('Network,\x20%s,\x20%s',_0x56c17e,_0x6727('0xd'));logger[_0x6727('0xe')](_0x6727('0xf'),_0x56c17e,_0x6727('0xd'),JSON[_0x6727('0x10')](_0x29789f));if(_0x29789f[_0x6727('0x11')]){if(_0x29789f['error']['code']===0x1f4){logger['error'](_0x6727('0x12'),_0x56c17e,_0x29789f[_0x6727('0x11')][_0x6727('0x13')]);return _0x6fe7e7(_0x29789f[_0x6727('0x11')][_0x6727('0x13')]);}logger['error'](_0x6727('0x12'),_0x56c17e,_0x29789f['error'][_0x6727('0x13')]);return _0x421a97(_0x29789f['error'][_0x6727('0x13')]);}else{logger[_0x6727('0x14')](_0x6727('0x12'),_0x56c17e,'request\x20sent');_0x421a97(_0x29789f[_0x6727('0x15')][_0x6727('0x13')]);}})['catch'](function(_0x4e1c28){logger[_0x6727('0x11')](_0x6727('0x12'),_0x56c17e,_0x4e1c28);_0x6fe7e7(_0x4e1c28);});});}function respondWithResult(_0x4911bf,_0x5b4758){_0x5b4758=_0x5b4758||0xc8;return function(_0x409dc2){if(_0x409dc2){return _0x4911bf['status'](_0x5b4758)[_0x6727('0x16')](_0x409dc2);}};}function respondWithFilteredResult(_0x13f7fd,_0x19ea96){return function(_0x4c4350){if(_0x4c4350){var _0x504c5e=typeof _0x19ea96[_0x6727('0x17')]===_0x6727('0x18')&&typeof _0x19ea96['limit']===_0x6727('0x18');var _0x5a2377=_0x4c4350['count'];var _0x336203=_0x504c5e?0x0:_0x19ea96['offset'];var _0x4edfc1=_0x504c5e?_0x4c4350['count']:_0x19ea96[_0x6727('0x17')]+_0x19ea96['limit'];var _0x553b26;if(_0x4edfc1>=_0x5a2377){_0x4edfc1=_0x5a2377;_0x553b26=0xc8;}else{_0x553b26=0xce;}_0x13f7fd[_0x6727('0x19')](_0x553b26);return _0x13f7fd['set'](_0x6727('0x1a'),_0x336203+'-'+_0x4edfc1+'/'+_0x5a2377)['json'](_0x4c4350);}return null;};}function saveUpdates(_0x1bd03b){return function(_0x5e875f){if(_0x5e875f){return _0x5e875f[_0x6727('0x1b')](_0x1bd03b)[_0x6727('0xc')](function(_0x281087){return _0x281087;});}return null;};}function removeEntity(_0x35c641){return function(_0x4702de){if(_0x4702de){return _0x4702de[_0x6727('0x1c')]()[_0x6727('0xc')](function(){_0x35c641[_0x6727('0x19')](0xcc)[_0x6727('0x1d')]();});}};}function handleEntityNotFound(_0x35524b){return function(_0x4d5b3a){if(!_0x4d5b3a){_0x35524b[_0x6727('0x1e')](0x194);}return _0x4d5b3a;};}function handleError(_0x565f6e,_0x4f0295){_0x4f0295=_0x4f0295||0x1f4;return function(_0x55560a){logger['error'](_0x55560a[_0x6727('0x1f')]);if(_0x55560a[_0x6727('0x20')]){delete _0x55560a[_0x6727('0x20')];}_0x565f6e[_0x6727('0x19')](_0x4f0295)[_0x6727('0x21')](_0x55560a);};}exports['index']=function(_0x13cdb7,_0x539039){var _0x4200a0={},_0xc85522={},_0x5e105a={'count':0x0,'rows':[]};var _0x25b877=_['map'](db[_0x6727('0x22')][_0x6727('0x23')],function(_0x5d1017){return{'name':_0x5d1017[_0x6727('0x24')],'type':_0x5d1017['type'][_0x6727('0x25')]};});_0xc85522['model']=_[_0x6727('0x26')](_0x25b877,_0x6727('0x20'));_0xc85522[_0x6727('0x27')]=_[_0x6727('0x28')](_0x13cdb7[_0x6727('0x27')]);_0xc85522[_0x6727('0x29')]=_['intersection'](_0xc85522[_0x6727('0x2a')],_0xc85522[_0x6727('0x27')]);_0x4200a0[_0x6727('0x2b')]=_[_0x6727('0x2c')](_0xc85522['model'],qs[_0x6727('0x2d')](_0x13cdb7[_0x6727('0x27')][_0x6727('0x2d')]));_0x4200a0[_0x6727('0x2b')]=_0x4200a0[_0x6727('0x2b')][_0x6727('0x2e')]?_0x4200a0[_0x6727('0x2b')]:_0xc85522['model'];if(!_0x13cdb7[_0x6727('0x27')][_0x6727('0x2f')]('nolimit')){_0x4200a0[_0x6727('0x30')]=qs[_0x6727('0x30')](_0x13cdb7[_0x6727('0x27')]['limit']);_0x4200a0['offset']=qs[_0x6727('0x17')](_0x13cdb7['query'][_0x6727('0x17')]);}_0x4200a0[_0x6727('0x31')]=qs[_0x6727('0x32')](_0x13cdb7['query'][_0x6727('0x32')]);_0x4200a0[_0x6727('0x33')]=qs[_0x6727('0x29')](_[_0x6727('0x34')](_0x13cdb7[_0x6727('0x27')],_0xc85522['filters']),_0x25b877);if(_0x13cdb7[_0x6727('0x27')]['filter']){_0x4200a0[_0x6727('0x33')]=_[_0x6727('0x35')](_0x4200a0[_0x6727('0x33')],{'$or':_[_0x6727('0x26')](_0x25b877,function(_0x1c0109){if(_0x1c0109[_0x6727('0x36')]!==_0x6727('0x37')){var _0x4534e7={};_0x4534e7[_0x1c0109[_0x6727('0x20')]]={'$like':'%'+_0x13cdb7['query'][_0x6727('0x38')]+'%'};return _0x4534e7;}})});}_0x4200a0=_['merge']({},_0x4200a0,_0x13cdb7[_0x6727('0x39')]);var _0x3c1188={'where':_0x4200a0[_0x6727('0x33')]};return db[_0x6727('0x22')][_0x6727('0x3a')](_0x3c1188)['then'](function(_0x48792c){_0x5e105a[_0x6727('0x3a')]=_0x48792c;if(_0x13cdb7[_0x6727('0x27')][_0x6727('0x3b')]){_0x4200a0[_0x6727('0x3c')]=[{'all':!![]}];}return db[_0x6727('0x22')]['findAll'](_0x4200a0);})[_0x6727('0xc')](function(_0x3ac0e1){_0x5e105a[_0x6727('0x3d')]=_0x3ac0e1;return _0x5e105a;})[_0x6727('0xc')](respondWithFilteredResult(_0x539039,_0x4200a0))[_0x6727('0x3e')](handleError(_0x539039,null));};exports[_0x6727('0x3f')]=function(_0x2d0dca,_0x5b9921){var _0x4f8626={'raw':!![],'where':{'id':_0x2d0dca[_0x6727('0x40')]['id']}},_0x1222cd={};_0x1222cd[_0x6727('0x2a')]=_[_0x6727('0x28')](db['Network']['rawAttributes']);_0x1222cd[_0x6727('0x27')]=_[_0x6727('0x28')](_0x2d0dca[_0x6727('0x27')]);_0x1222cd[_0x6727('0x29')]=_[_0x6727('0x2c')](_0x1222cd['model'],_0x1222cd['query']);_0x4f8626[_0x6727('0x2b')]=_['intersection'](_0x1222cd['model'],qs[_0x6727('0x2d')](_0x2d0dca[_0x6727('0x27')][_0x6727('0x2d')]));_0x4f8626[_0x6727('0x2b')]=_0x4f8626[_0x6727('0x2b')]['length']?_0x4f8626[_0x6727('0x2b')]:_0x1222cd[_0x6727('0x2a')];if(_0x2d0dca[_0x6727('0x27')][_0x6727('0x3b')]){_0x4f8626[_0x6727('0x3c')]=[{'all':!![]}];}_0x4f8626=_[_0x6727('0x35')]({},_0x4f8626,_0x2d0dca['options']);return db['Network'][_0x6727('0x41')](_0x4f8626)[_0x6727('0xc')](handleEntityNotFound(_0x5b9921,null))['then'](respondWithResult(_0x5b9921,null))[_0x6727('0x3e')](handleError(_0x5b9921,null));};exports[_0x6727('0x42')]=function(_0x515ec1,_0x4f1bf4){var _0x3a218d;return db['Network'][_0x6727('0x42')](_0x515ec1[_0x6727('0x43')],{'raw':!![]})[_0x6727('0xc')](function(_0x3f83c1){_0x3a218d=_0x3f83c1;return db['Network'][_0x6727('0x44')]({'where':{'type':_0x515ec1[_0x6727('0x43')][_0x6727('0x36')]},'raw':!![]});})[_0x6727('0xc')](function(_0x5dadd5){if(_0x3a218d['type'][_0x6727('0x45')]()==_0x6727('0x46')){var _0x8ad26e=fs[_0x6727('0x47')](path[_0x6727('0x48')](config[_0x6727('0x49')],_0x6727('0x4a')),_0x6727('0x4b'));var _0x196110=ejs[_0x6727('0x4c')](_0x8ad26e,{'networks':_0x5dadd5||[]});fs[_0x6727('0x4d')](_0x6727('0x4e'),_0x196110);return respondWithRpcPromise('Reload',_0x6727('0x42'),{'module':'res_stun_monitor.so'});}else if(_0x3a218d[_0x6727('0x36')][_0x6727('0x45')]()==_0x6727('0x4f')){var _0x38ae08=fs[_0x6727('0x47')](path[_0x6727('0x48')](config[_0x6727('0x49')],'server/files/templates/turn_multiple.ejs'),_0x6727('0x4b'));var _0x2e9035=ejs['render'](_0x38ae08,{'networks':_0x5dadd5||[]});fs[_0x6727('0x4d')](_0x6727('0x50'),_0x2e9035);return respondWithRpcPromise('Reload',_0x6727('0x42'),{'module':_0x6727('0x51')});}else{var _0x264038=fs['readFileSync'](path[_0x6727('0x48')](config['root'],'server/files/templates/network.ejs'),_0x6727('0x4b'));var _0x5c782a=ejs[_0x6727('0x4c')](_0x264038,{'networks':_0x5dadd5||[]});fs[_0x6727('0x4d')](util['format'](_0x6727('0x52'),_0x515ec1[_0x6727('0x43')][_0x6727('0x36')][_0x6727('0x53')]()),_0x5c782a);return respondWithRpcPromise(_0x6727('0x54'),_0x6727('0x42'),{'module':_0x6727('0x55')});}})[_0x6727('0xc')](function(){return _0x3a218d;})[_0x6727('0xc')](respondWithResult(_0x4f1bf4,0xc9))[_0x6727('0x3e')](handleError(_0x4f1bf4,null));};exports[_0x6727('0x1b')]=function(_0x5d8f95,_0x349567){var _0x5275cc;return db[_0x6727('0x22')][_0x6727('0x41')]({'where':{'id':_0x5d8f95[_0x6727('0x40')]['id']}})[_0x6727('0xc')](handleEntityNotFound(_0x349567,null))[_0x6727('0xc')](saveUpdates(_0x5d8f95[_0x6727('0x43')],null))[_0x6727('0xc')](function(_0x4ffce5){if(_0x4ffce5){_0x5275cc=_0x4ffce5;return db[_0x6727('0x22')][_0x6727('0x44')]({'where':{'type':_0x5275cc[_0x6727('0x36')]},'raw':!![]});}return null;})[_0x6727('0xc')](function(_0x245d3d){if(_0x5275cc[_0x6727('0x36')][_0x6727('0x45')]()=='STUN'){var _0x607e60=fs['readFileSync'](path['join'](config['root'],_0x6727('0x4a')),_0x6727('0x4b'));var _0x5a7a59=ejs[_0x6727('0x4c')](_0x607e60,{'networks':_0x245d3d||[]});fs[_0x6727('0x4d')]('/etc/asterisk/stun_xcally.conf',_0x5a7a59);return respondWithRpcPromise('Reload','update',{'module':_0x6727('0x51')});}else if(_0x5275cc[_0x6727('0x36')][_0x6727('0x45')]()==_0x6727('0x4f')){var _0x4a7cb4=fs['readFileSync'](path[_0x6727('0x48')](config[_0x6727('0x49')],_0x6727('0x56')),'utf8');var _0x12cd37=ejs['render'](_0x4a7cb4,{'networks':_0x245d3d||[]});fs[_0x6727('0x4d')]('/etc/asterisk/turn_xcally.conf',_0x12cd37);return respondWithRpcPromise('Reload',_0x6727('0x1b'),{'module':_0x6727('0x51')});}else{var _0x139413=fs['readFileSync'](path[_0x6727('0x48')](config['root'],'server/files/templates/network.ejs'),_0x6727('0x4b'));var _0x2f7449=ejs['render'](_0x139413,{'networks':_0x245d3d||[]});fs[_0x6727('0x4d')](util[_0x6727('0x57')](_0x6727('0x52'),_0x5d8f95[_0x6727('0x43')][_0x6727('0x36')]['toLowerCase']()),_0x2f7449);return respondWithRpcPromise(_0x6727('0x54'),_0x6727('0x1b'),{'module':'chan_sip.so'});}})[_0x6727('0xc')](function(_0x5e64d6){if(_0x5e64d6){return _0x5275cc;}return null;})[_0x6727('0xc')](respondWithResult(_0x349567,null))[_0x6727('0x3e')](handleError(_0x349567,null));};exports[_0x6727('0x1c')]=function(_0x286a76,_0x247321){var _0x134df6;return db[_0x6727('0x22')]['find']({'where':{'id':_0x286a76['params']['id']}})[_0x6727('0xc')](function(_0x5c0b08){_0x134df6=_0x5c0b08;return _0x5c0b08;})[_0x6727('0xc')](handleEntityNotFound(_0x247321,null))[_0x6727('0xc')](removeEntity(_0x247321,null))[_0x6727('0xc')](function(){if(_0x134df6){return db[_0x6727('0x22')][_0x6727('0x44')]({'where':{'type':_0x134df6[_0x6727('0x36')]},'raw':!![]});}})[_0x6727('0xc')](function(_0x248146){if(_0x134df6[_0x6727('0x36')]['toUpperCase']()==_0x6727('0x46')){var _0x4c5319=fs[_0x6727('0x47')](path[_0x6727('0x48')](config[_0x6727('0x49')],_0x6727('0x4a')),'utf8');var _0x563fad=ejs[_0x6727('0x4c')](_0x4c5319,{'networks':_0x248146||[]});fs['writeFileSync'](_0x6727('0x4e'),_0x563fad);return respondWithRpcPromise('Reload','destroy',{'module':_0x6727('0x51')});}else if(_0x134df6[_0x6727('0x36')]['toUpperCase']()==_0x6727('0x4f')){var _0x5f0b09=fs[_0x6727('0x47')](path[_0x6727('0x48')](config[_0x6727('0x49')],_0x6727('0x56')),_0x6727('0x4b'));var _0x4a2a94=ejs[_0x6727('0x4c')](_0x5f0b09,{'networks':_0x248146||[]});fs[_0x6727('0x4d')]('/etc/asterisk/turn_xcally.conf',_0x4a2a94);return respondWithRpcPromise(_0x6727('0x54'),'destroy',{'module':_0x6727('0x51')});}else{var _0x7fb7a0=fs['readFileSync'](path['join'](config[_0x6727('0x49')],_0x6727('0x58')),_0x6727('0x4b'));var _0x1c4e52=ejs[_0x6727('0x4c')](_0x7fb7a0,{'networks':_0x248146||[]});fs[_0x6727('0x4d')](util[_0x6727('0x57')](_0x6727('0x52'),_0x134df6[_0x6727('0x36')][_0x6727('0x53')]()),_0x1c4e52);return respondWithRpcPromise(_0x6727('0x54'),'destroy',{'module':_0x6727('0x55')});}})['catch'](handleError(_0x247321,null));}; \ No newline at end of file +var _0x2255=['catch','body','type','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','create','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','toUpperCase','destroy','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','jayson/promise','http','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','stack','name','index','Network','rawAttributes','key','model','map','keys','intersection','query','fields','attributes','hasOwnProperty','order','sort','filters','filter','merge','VIRTUAL','options','where','include','findAll','rows','show','params','length'];(function(_0x4a6a8e,_0xd1dee2){var _0x198cb0=function(_0x3ba86f){while(--_0x3ba86f){_0x4a6a8e['push'](_0x4a6a8e['shift']());}};_0x198cb0(++_0xd1dee2);}(_0x2255,0xc0));var _0x5225=function(_0x292b68,_0x459471){_0x292b68=_0x292b68-0x0;var _0x4e92d7=_0x2255[_0x292b68];return _0x4e92d7;};'use strict';var util=require(_0x5225('0x0'));var path=require(_0x5225('0x1'));var ejs=require(_0x5225('0x2'));var fs=require('fs');var _=require(_0x5225('0x3'));var qs=require(_0x5225('0x4'));var logger=require('../../config/logger')(_0x5225('0x5'));var config=require(_0x5225('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5225('0x7'));var client=jayson['client'][_0x5225('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3738ee,_0x5dc094,_0x11778b,_0x2818f1){return new Promise(function(_0x428df7,_0x109fc6){var _0x7c7b4d=_0x2818f1||client;return _0x7c7b4d['request'](_0x3738ee,_0x11778b)['then'](function(_0x266800){logger[_0x5225('0x9')](_0x5225('0xa'),_0x5dc094,'request\x20sent');logger[_0x5225('0xb')](_0x5225('0xc'),_0x5dc094,_0x5225('0xd'),JSON[_0x5225('0xe')](_0x266800));if(_0x266800['error']){if(_0x266800[_0x5225('0xf')][_0x5225('0x10')]===0x1f4){logger['error'](_0x5225('0xa'),_0x5dc094,_0x266800[_0x5225('0xf')]['message']);return _0x109fc6(_0x266800[_0x5225('0xf')][_0x5225('0x11')]);}logger[_0x5225('0xf')](_0x5225('0xa'),_0x5dc094,_0x266800[_0x5225('0xf')][_0x5225('0x11')]);return _0x428df7(_0x266800[_0x5225('0xf')]['message']);}else{logger[_0x5225('0x9')]('Network,\x20%s,\x20%s',_0x5dc094,_0x5225('0xd'));_0x428df7(_0x266800['result'][_0x5225('0x11')]);}})['catch'](function(_0x24bce0){logger['error'](_0x5225('0xa'),_0x5dc094,_0x24bce0);_0x109fc6(_0x24bce0);});});}function respondWithResult(_0x371efe,_0x79033){_0x79033=_0x79033||0xc8;return function(_0x263ae0){if(_0x263ae0){return _0x371efe[_0x5225('0x12')](_0x79033)[_0x5225('0x13')](_0x263ae0);}};}function respondWithFilteredResult(_0x4831ea,_0x4454b3){return function(_0x300581){if(_0x300581){var _0x1f1a7a=typeof _0x4454b3[_0x5225('0x14')]===_0x5225('0x15')&&typeof _0x4454b3[_0x5225('0x16')]==='undefined';var _0x3627d2=_0x300581[_0x5225('0x17')];var _0x2f5712=_0x1f1a7a?0x0:_0x4454b3[_0x5225('0x14')];var _0x199e64=_0x1f1a7a?_0x300581[_0x5225('0x17')]:_0x4454b3[_0x5225('0x14')]+_0x4454b3['limit'];var _0x31a12e;if(_0x199e64>=_0x3627d2){_0x199e64=_0x3627d2;_0x31a12e=0xc8;}else{_0x31a12e=0xce;}_0x4831ea[_0x5225('0x12')](_0x31a12e);return _0x4831ea[_0x5225('0x18')](_0x5225('0x19'),_0x2f5712+'-'+_0x199e64+'/'+_0x3627d2)['json'](_0x300581);}return null;};}function saveUpdates(_0x15db9f){return function(_0x545def){if(_0x545def){return _0x545def[_0x5225('0x1a')](_0x15db9f)[_0x5225('0x1b')](function(_0x5034c4){return _0x5034c4;});}return null;};}function removeEntity(_0x1034b4){return function(_0x1667c9){if(_0x1667c9){return _0x1667c9['destroy']()[_0x5225('0x1b')](function(){_0x1034b4[_0x5225('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x540c6a){return function(_0x2ec7e3){if(!_0x2ec7e3){_0x540c6a[_0x5225('0x1c')](0x194);}return _0x2ec7e3;};}function handleError(_0x3f641b,_0x5742b3){_0x5742b3=_0x5742b3||0x1f4;return function(_0x2486f0){logger[_0x5225('0xf')](_0x2486f0[_0x5225('0x1d')]);if(_0x2486f0[_0x5225('0x1e')]){delete _0x2486f0[_0x5225('0x1e')];}_0x3f641b['status'](_0x5742b3)['send'](_0x2486f0);};}exports[_0x5225('0x1f')]=function(_0x530c39,_0x3db620){var _0x268aa1={},_0x3eb476={},_0x286c37={'count':0x0,'rows':[]};var _0x58565d=_['map'](db[_0x5225('0x20')][_0x5225('0x21')],function(_0x1e8d4c){return{'name':_0x1e8d4c['fieldName'],'type':_0x1e8d4c['type'][_0x5225('0x22')]};});_0x3eb476[_0x5225('0x23')]=_[_0x5225('0x24')](_0x58565d,_0x5225('0x1e'));_0x3eb476['query']=_[_0x5225('0x25')](_0x530c39['query']);_0x3eb476['filters']=_[_0x5225('0x26')](_0x3eb476['model'],_0x3eb476[_0x5225('0x27')]);_0x268aa1['attributes']=_[_0x5225('0x26')](_0x3eb476[_0x5225('0x23')],qs[_0x5225('0x28')](_0x530c39[_0x5225('0x27')][_0x5225('0x28')]));_0x268aa1[_0x5225('0x29')]=_0x268aa1['attributes']['length']?_0x268aa1['attributes']:_0x3eb476[_0x5225('0x23')];if(!_0x530c39[_0x5225('0x27')][_0x5225('0x2a')]('nolimit')){_0x268aa1[_0x5225('0x16')]=qs[_0x5225('0x16')](_0x530c39[_0x5225('0x27')]['limit']);_0x268aa1[_0x5225('0x14')]=qs[_0x5225('0x14')](_0x530c39[_0x5225('0x27')][_0x5225('0x14')]);}_0x268aa1[_0x5225('0x2b')]=qs['sort'](_0x530c39[_0x5225('0x27')][_0x5225('0x2c')]);_0x268aa1['where']=qs[_0x5225('0x2d')](_['pick'](_0x530c39[_0x5225('0x27')],_0x3eb476[_0x5225('0x2d')]),_0x58565d);if(_0x530c39[_0x5225('0x27')][_0x5225('0x2e')]){_0x268aa1['where']=_[_0x5225('0x2f')](_0x268aa1['where'],{'$or':_[_0x5225('0x24')](_0x58565d,function(_0x27e259){if(_0x27e259['type']!==_0x5225('0x30')){var _0x4d963a={};_0x4d963a[_0x27e259[_0x5225('0x1e')]]={'$like':'%'+_0x530c39[_0x5225('0x27')]['filter']+'%'};return _0x4d963a;}})});}_0x268aa1=_[_0x5225('0x2f')]({},_0x268aa1,_0x530c39[_0x5225('0x31')]);var _0x10f1e2={'where':_0x268aa1[_0x5225('0x32')]};return db[_0x5225('0x20')][_0x5225('0x17')](_0x10f1e2)[_0x5225('0x1b')](function(_0x2090e1){_0x286c37[_0x5225('0x17')]=_0x2090e1;if(_0x530c39[_0x5225('0x27')]['includeAll']){_0x268aa1[_0x5225('0x33')]=[{'all':!![]}];}return db[_0x5225('0x20')][_0x5225('0x34')](_0x268aa1);})[_0x5225('0x1b')](function(_0x41226a){_0x286c37[_0x5225('0x35')]=_0x41226a;return _0x286c37;})['then'](respondWithFilteredResult(_0x3db620,_0x268aa1))['catch'](handleError(_0x3db620,null));};exports[_0x5225('0x36')]=function(_0x3e402e,_0x5c83dd){var _0x25ba25={'raw':!![],'where':{'id':_0x3e402e[_0x5225('0x37')]['id']}},_0x23f7c0={};_0x23f7c0[_0x5225('0x23')]=_[_0x5225('0x25')](db[_0x5225('0x20')][_0x5225('0x21')]);_0x23f7c0['query']=_[_0x5225('0x25')](_0x3e402e['query']);_0x23f7c0['filters']=_[_0x5225('0x26')](_0x23f7c0['model'],_0x23f7c0[_0x5225('0x27')]);_0x25ba25[_0x5225('0x29')]=_[_0x5225('0x26')](_0x23f7c0[_0x5225('0x23')],qs[_0x5225('0x28')](_0x3e402e[_0x5225('0x27')][_0x5225('0x28')]));_0x25ba25[_0x5225('0x29')]=_0x25ba25['attributes'][_0x5225('0x38')]?_0x25ba25[_0x5225('0x29')]:_0x23f7c0[_0x5225('0x23')];if(_0x3e402e[_0x5225('0x27')]['includeAll']){_0x25ba25[_0x5225('0x33')]=[{'all':!![]}];}_0x25ba25=_[_0x5225('0x2f')]({},_0x25ba25,_0x3e402e[_0x5225('0x31')]);return db[_0x5225('0x20')]['find'](_0x25ba25)[_0x5225('0x1b')](handleEntityNotFound(_0x5c83dd,null))[_0x5225('0x1b')](respondWithResult(_0x5c83dd,null))[_0x5225('0x39')](handleError(_0x5c83dd,null));};exports['create']=function(_0x2bcadb,_0x3578f6){var _0x1f2763;return db['Network']['create'](_0x2bcadb[_0x5225('0x3a')],{'raw':!![]})[_0x5225('0x1b')](function(_0xbdc4f7){_0x1f2763=_0xbdc4f7;return db[_0x5225('0x20')][_0x5225('0x34')]({'where':{'type':_0x2bcadb[_0x5225('0x3a')][_0x5225('0x3b')]},'raw':!![]});})['then'](function(_0x232edf){if(_0x1f2763[_0x5225('0x3b')]['toUpperCase']()==_0x5225('0x3c')){var _0x1de345=fs[_0x5225('0x3d')](path[_0x5225('0x3e')](config[_0x5225('0x3f')],_0x5225('0x40')),_0x5225('0x41'));var _0x19128e=ejs[_0x5225('0x42')](_0x1de345,{'networks':_0x232edf||[]});fs[_0x5225('0x43')](_0x5225('0x44'),_0x19128e);return respondWithRpcPromise(_0x5225('0x45'),_0x5225('0x46'),{'module':'res_stun_monitor.so'});}else if(_0x1f2763[_0x5225('0x3b')]['toUpperCase']()==_0x5225('0x47')){var _0x53ed26=fs[_0x5225('0x3d')](path['join'](config['root'],_0x5225('0x48')),_0x5225('0x41'));var _0xe72932=ejs['render'](_0x53ed26,{'networks':_0x232edf||[]});fs[_0x5225('0x43')](_0x5225('0x49'),_0xe72932);return respondWithRpcPromise('Reload',_0x5225('0x46'),{'module':_0x5225('0x4a')});}else{var _0x46d9ab=fs[_0x5225('0x3d')](path[_0x5225('0x3e')](config[_0x5225('0x3f')],_0x5225('0x4b')),_0x5225('0x41'));var _0x4b6e7f=ejs[_0x5225('0x42')](_0x46d9ab,{'networks':_0x232edf||[]});fs['writeFileSync'](util[_0x5225('0x4c')](_0x5225('0x4d'),_0x2bcadb[_0x5225('0x3a')][_0x5225('0x3b')][_0x5225('0x4e')]()),_0x4b6e7f);return respondWithRpcPromise('Reload',_0x5225('0x46'),{'module':_0x5225('0x4f')});}})[_0x5225('0x1b')](function(){return _0x1f2763;})[_0x5225('0x1b')](respondWithResult(_0x3578f6,0xc9))['catch'](handleError(_0x3578f6,null));};exports['update']=function(_0x4dad73,_0x4523c2){var _0x29d5f4;return db[_0x5225('0x20')][_0x5225('0x50')]({'where':{'id':_0x4dad73[_0x5225('0x37')]['id']}})[_0x5225('0x1b')](handleEntityNotFound(_0x4523c2,null))[_0x5225('0x1b')](saveUpdates(_0x4dad73[_0x5225('0x3a')],null))[_0x5225('0x1b')](function(_0x348368){if(_0x348368){_0x29d5f4=_0x348368;return db[_0x5225('0x20')][_0x5225('0x34')]({'where':{'type':_0x29d5f4[_0x5225('0x3b')]},'raw':!![]});}return null;})[_0x5225('0x1b')](function(_0x463eef){if(_0x29d5f4['type'][_0x5225('0x51')]()==_0x5225('0x3c')){var _0x385056=fs[_0x5225('0x3d')](path['join'](config['root'],_0x5225('0x40')),'utf8');var _0x3b2a4b=ejs[_0x5225('0x42')](_0x385056,{'networks':_0x463eef||[]});fs[_0x5225('0x43')](_0x5225('0x44'),_0x3b2a4b);return respondWithRpcPromise(_0x5225('0x45'),_0x5225('0x1a'),{'module':'res_stun_monitor.so'});}else if(_0x29d5f4[_0x5225('0x3b')][_0x5225('0x51')]()=='TURN'){var _0x4cf5b6=fs[_0x5225('0x3d')](path['join'](config['root'],_0x5225('0x48')),'utf8');var _0x19fb2b=ejs[_0x5225('0x42')](_0x4cf5b6,{'networks':_0x463eef||[]});fs[_0x5225('0x43')](_0x5225('0x49'),_0x19fb2b);return respondWithRpcPromise(_0x5225('0x45'),_0x5225('0x1a'),{'module':_0x5225('0x4a')});}else{var _0x101353=fs['readFileSync'](path['join'](config[_0x5225('0x3f')],_0x5225('0x4b')),_0x5225('0x41'));var _0x1e4b65=ejs[_0x5225('0x42')](_0x101353,{'networks':_0x463eef||[]});fs[_0x5225('0x43')](util[_0x5225('0x4c')](_0x5225('0x4d'),_0x4dad73[_0x5225('0x3a')][_0x5225('0x3b')][_0x5225('0x4e')]()),_0x1e4b65);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}})[_0x5225('0x1b')](function(_0x30086d){if(_0x30086d){return _0x29d5f4;}return null;})[_0x5225('0x1b')](respondWithResult(_0x4523c2,null))[_0x5225('0x39')](handleError(_0x4523c2,null));};exports[_0x5225('0x52')]=function(_0xcca5ef,_0x2ab704){var _0x28483d;return db['Network'][_0x5225('0x50')]({'where':{'id':_0xcca5ef['params']['id']}})['then'](function(_0x3e2974){_0x28483d=_0x3e2974;return _0x3e2974;})[_0x5225('0x1b')](handleEntityNotFound(_0x2ab704,null))['then'](removeEntity(_0x2ab704,null))['then'](function(){if(_0x28483d){return db['Network'][_0x5225('0x34')]({'where':{'type':_0x28483d[_0x5225('0x3b')]},'raw':!![]});}})[_0x5225('0x1b')](function(_0xe90eff){if(_0x28483d[_0x5225('0x3b')][_0x5225('0x51')]()=='STUN'){var _0x4f392b=fs[_0x5225('0x3d')](path['join'](config[_0x5225('0x3f')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x147a9d=ejs['render'](_0x4f392b,{'networks':_0xe90eff||[]});fs[_0x5225('0x43')]('/etc/asterisk/stun_xcally.conf',_0x147a9d);return respondWithRpcPromise(_0x5225('0x45'),_0x5225('0x52'),{'module':_0x5225('0x4a')});}else if(_0x28483d[_0x5225('0x3b')][_0x5225('0x51')]()==_0x5225('0x47')){var _0x3aa6fa=fs[_0x5225('0x3d')](path[_0x5225('0x3e')](config[_0x5225('0x3f')],_0x5225('0x48')),_0x5225('0x41'));var _0x43b79a=ejs[_0x5225('0x42')](_0x3aa6fa,{'networks':_0xe90eff||[]});fs[_0x5225('0x43')](_0x5225('0x49'),_0x43b79a);return respondWithRpcPromise(_0x5225('0x45'),_0x5225('0x52'),{'module':_0x5225('0x4a')});}else{var _0x195320=fs[_0x5225('0x3d')](path[_0x5225('0x3e')](config[_0x5225('0x3f')],_0x5225('0x4b')),'utf8');var _0x3dd3f6=ejs[_0x5225('0x42')](_0x195320,{'networks':_0xe90eff||[]});fs[_0x5225('0x43')](util[_0x5225('0x4c')](_0x5225('0x4d'),_0x28483d['type']['toLowerCase']()),_0x3dd3f6);return respondWithRpcPromise('Reload',_0x5225('0x52'),{'module':_0x5225('0x4f')});}})['catch'](handleError(_0x2ab704,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7baa286..df7fbff 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 _0xac55=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5bcdf7,_0x101970){var _0x426e36=function(_0x248143){while(--_0x248143){_0x5bcdf7['push'](_0x5bcdf7['shift']());}};_0x426e36(++_0x101970);}(_0xac55,0x1c8));var _0x5ac5=function(_0x1804fe,_0x3c1ee9){_0x1804fe=_0x1804fe-0x0;var _0x4b765e=_0xac55[_0x1804fe];return _0x4b765e;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var logger=require(_0x5ac5('0x2'))(_0x5ac5('0x3'));var moment=require('moment');var BPromise=require(_0x5ac5('0x4'));var rp=require(_0x5ac5('0x5'));var fs=require('fs');var path=require(_0x5ac5('0x6'));var rimraf=require(_0x5ac5('0x7'));var config=require(_0x5ac5('0x8'));var attributes=require(_0x5ac5('0x9'));module[_0x5ac5('0xa')]=function(_0x52e117,_0x57f615){return _0x52e117[_0x5ac5('0xb')](_0x5ac5('0xc'),attributes,{'tableName':_0x5ac5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe205=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./network.attributes','exports','network','lodash'];(function(_0x1d8b10,_0x9603a6){var _0x123f31=function(_0x675fd8){while(--_0x675fd8){_0x1d8b10['push'](_0x1d8b10['shift']());}};_0x123f31(++_0x9603a6);}(_0xe205,0xa7));var _0x5e20=function(_0x181707,_0x47d753){_0x181707=_0x181707-0x0;var _0x1d2b7a=_0xe205[_0x181707];return _0x1d2b7a;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var logger=require(_0x5e20('0x2'))(_0x5e20('0x3'));var moment=require(_0x5e20('0x4'));var BPromise=require(_0x5e20('0x5'));var rp=require(_0x5e20('0x6'));var fs=require('fs');var path=require(_0x5e20('0x7'));var rimraf=require(_0x5e20('0x8'));var config=require('../../config/environment');var attributes=require(_0x5e20('0x9'));module[_0x5e20('0xa')]=function(_0x44dbb3,_0x3c4203){return _0x44dbb3['define']('Network',attributes,{'tableName':_0x5e20('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 7845a94..3c14835 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(_0x395f2c,_0x31140e){_0x395f2c=_0x395f2c-0x0;var _0x525dff=_0x7a54[_0x395f2c];return _0x525dff;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2870f9,_0x306749){var _0x4c1855=function(_0x5b9741){while(--_0x5b9741){_0x2870f9['push'](_0x2870f9['shift']());}};_0x4c1855(++_0x306749);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 154dc5d..b6cc617 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 _0xaf18=['get','describe','show','getDispositions','getAnswers','/:id/applications','/:id/interactions','/:id/users','getAgents','create','post','/:id/dispositions','/:id/canned_answers','addApplications','/:id/send','send','put','update','delete','/:id','destroy','removeDispositions','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated'];(function(_0x28e334,_0x419adf){var _0x5d65fa=function(_0x5040a6){while(--_0x5040a6){_0x28e334['push'](_0x28e334['shift']());}};_0x5d65fa(++_0x419adf);}(_0xaf18,0xcb));var _0x8af1=function(_0x390aaf,_0x119328){_0x390aaf=_0x390aaf-0x0;var _0x5ddab8=_0xaf18[_0x390aaf];return _0x5ddab8;};'use strict';var multer=require(_0x8af1('0x0'));var util=require(_0x8af1('0x1'));var path=require('path');var timeout=require(_0x8af1('0x2'));var express=require(_0x8af1('0x3'));var router=express['Router']();var fs_extra=require(_0x8af1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8af1('0x5'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x8af1('0x6')](),controller['index']);router[_0x8af1('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8af1('0x8')]);router['get']('/:id',auth[_0x8af1('0x6')](),controller[_0x8af1('0x9')]);router['get']('/:id/dispositions',auth[_0x8af1('0x6')](),controller[_0x8af1('0xa')]);router[_0x8af1('0x7')]('/:id/canned_answers',auth[_0x8af1('0x6')](),controller[_0x8af1('0xb')]);router[_0x8af1('0x7')](_0x8af1('0xc'),auth[_0x8af1('0x6')](),controller['getApplications']);router[_0x8af1('0x7')](_0x8af1('0xd'),auth[_0x8af1('0x6')](),controller['getInteractions']);router['get'](_0x8af1('0xe'),auth['isAuthenticated'](),controller[_0x8af1('0xf')]);router['post']('/',auth[_0x8af1('0x6')](),controller[_0x8af1('0x10')]);router[_0x8af1('0x11')](_0x8af1('0x12'),auth[_0x8af1('0x6')](),controller['addDisposition']);router[_0x8af1('0x11')](_0x8af1('0x13'),auth[_0x8af1('0x6')](),controller['addAnswer']);router[_0x8af1('0x11')]('/:id/notify',controller['notify']);router[_0x8af1('0x11')](_0x8af1('0xc'),auth[_0x8af1('0x6')](),controller[_0x8af1('0x14')]);router[_0x8af1('0x11')]('/:id/users',auth[_0x8af1('0x6')](),controller['addAgents']);router[_0x8af1('0x11')](_0x8af1('0x15'),auth[_0x8af1('0x6')](),controller[_0x8af1('0x16')]);router[_0x8af1('0x17')]('/:id',auth[_0x8af1('0x6')](),controller[_0x8af1('0x18')]);router[_0x8af1('0x19')](_0x8af1('0x1a'),auth[_0x8af1('0x6')](),controller[_0x8af1('0x1b')]);router[_0x8af1('0x19')](_0x8af1('0x12'),auth[_0x8af1('0x6')](),controller[_0x8af1('0x1c')]);router[_0x8af1('0x19')](_0x8af1('0x13'),auth[_0x8af1('0x6')](),controller['removeAnswers']);router[_0x8af1('0x19')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x8af1('0x1d')]=router; \ No newline at end of file +var _0x2cca=['post','create','/:id/notify','/:id/applications','/:id/users','/:id/send','put','update','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','getAgents'];(function(_0x1688f6,_0x41dfb2){var _0x15bca2=function(_0x4651bb){while(--_0x4651bb){_0x1688f6['push'](_0x1688f6['shift']());}};_0x15bca2(++_0x41dfb2);}(_0x2cca,0x198));var _0xa2cc=function(_0x2017b5,_0x1f3e71){_0x2017b5=_0x2017b5-0x0;var _0x33319c=_0x2cca[_0x2017b5];return _0x33319c;};'use strict';var multer=require(_0xa2cc('0x0'));var util=require('util');var path=require(_0xa2cc('0x1'));var timeout=require(_0xa2cc('0x2'));var express=require(_0xa2cc('0x3'));var router=express[_0xa2cc('0x4')]();var fs_extra=require(_0xa2cc('0x5'));var auth=require(_0xa2cc('0x6'));var interaction=require(_0xa2cc('0x7'));var config=require(_0xa2cc('0x8'));var controller=require('./openchannelAccount.controller');router[_0xa2cc('0x9')]('/',auth[_0xa2cc('0xa')](),controller[_0xa2cc('0xb')]);router[_0xa2cc('0x9')](_0xa2cc('0xc'),auth[_0xa2cc('0xa')](),controller['describe']);router[_0xa2cc('0x9')](_0xa2cc('0xd'),auth['isAuthenticated'](),controller[_0xa2cc('0xe')]);router[_0xa2cc('0x9')](_0xa2cc('0xf'),auth[_0xa2cc('0xa')](),controller['getDispositions']);router[_0xa2cc('0x9')](_0xa2cc('0x10'),auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x11')]);router['get']('/:id/applications',auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x12')]);router[_0xa2cc('0x9')]('/:id/interactions',auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x13')]);router['get']('/:id/users',auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x14')]);router[_0xa2cc('0x15')]('/',auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x16')]);router[_0xa2cc('0x15')]('/:id/dispositions',auth[_0xa2cc('0xa')](),controller['addDisposition']);router[_0xa2cc('0x15')](_0xa2cc('0x10'),auth[_0xa2cc('0xa')](),controller['addAnswer']);router['post'](_0xa2cc('0x17'),controller['notify']);router[_0xa2cc('0x15')](_0xa2cc('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0xa2cc('0x15')](_0xa2cc('0x19'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xa2cc('0x1a'),auth['isAuthenticated'](),controller['send']);router[_0xa2cc('0x1b')](_0xa2cc('0xd'),auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x1c')]);router[_0xa2cc('0x1d')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xa2cc('0x1d')](_0xa2cc('0xf'),auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x1e')]);router[_0xa2cc('0x1d')](_0xa2cc('0x10'),auth[_0xa2cc('0xa')](),controller['removeAnswers']);router[_0xa2cc('0x1d')](_0xa2cc('0x19'),auth[_0xa2cc('0xa')](),controller[_0xa2cc('0x1f')]);module[_0xa2cc('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index cc5b6a7..303310a 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 _0xf9a7=['INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','name','generate','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf9a7,0x10c));var _0x7f9a=function(_0x23f43e,_0xa002a9){_0x23f43e=_0x23f43e-0x0;var _0x2d0ae6=_0xf9a7[_0x23f43e];return _0x2d0ae6;};'use strict';var Sequelize=require(_0x7f9a('0x0'));var rs=require(_0x7f9a('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7f9a('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7f9a('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7f9a('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7f9a('0x5')],'defaultValue':function(){return _0x7f9a('0x6');}},'notificationSound':{'type':Sequelize[_0x7f9a('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7f9a('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7f9a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7f9a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7f9a('0x4')]},'queueTransfer':{'type':Sequelize[_0x7f9a('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7f9a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7f9a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7f9a('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7f9a('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x28023d){if(!_0x28023d)this['setDataValue'](_0x7f9a('0x9'),null);this[_0x7f9a('0xa')](_0x7f9a('0xb'),_0x28023d);}}}; \ No newline at end of file +var _0xe413=['randomstring','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x189cbc,_0x18aa5a){var _0x31d0db=function(_0x2d4280){while(--_0x2d4280){_0x189cbc['push'](_0x189cbc['shift']());}};_0x31d0db(++_0x18aa5a);}(_0xe413,0xdb));var _0x3e41=function(_0x5cd82f,_0x57cfcc){_0x5cd82f=_0x5cd82f-0x0;var _0x5b659e=_0xe413[_0x5cd82f];return _0x5b659e;};'use strict';var Sequelize=require(_0x3e41('0x0'));var rs=require(_0x3e41('0x1'));module['exports']={'name':{'type':Sequelize[_0x3e41('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3e41('0x2')]},'token':{'type':Sequelize[_0x3e41('0x2')],'defaultValue':function(){return rs[_0x3e41('0x3')]();}},'replyUri':{'type':Sequelize[_0x3e41('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3e41('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3e41('0x4')],'defaultValue':function(){return _0x3e41('0x5');}},'notificationSound':{'type':Sequelize[_0x3e41('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3e41('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3e41('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3e41('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3e41('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3e41('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3e41('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4acdaf){if(!_0x4acdaf)this[_0x3e41('0x8')](_0x3e41('0x9'),null);this['setDataValue'](_0x3e41('0xa'),_0x4acdaf);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 223ae19..c8b3f99 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 _0xff01=['eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','reject','update','destroy','get','stack','name','send','Pause','OpenchannelAccount','type','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','UserProfileResource','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','Contacts','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xff01,0xb7));var _0x1ff0=function(_0x1c2a22,_0x598ba5){_0x1c2a22=_0x1c2a22-0x0;var _0x4c48cb=_0xff01[_0x1c2a22];return _0x4c48cb;};'use strict';var emlformat=require(_0x1ff0('0x0'));var rimraf=require(_0x1ff0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ff0('0x2'));var rp=require('request-promise');var moment=require(_0x1ff0('0x3'));var BPromise=require(_0x1ff0('0x4'));var Mustache=require(_0x1ff0('0x5'));var util=require('util');var path=require(_0x1ff0('0x6'));var sox=require('sox');var csv=require(_0x1ff0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ff0('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ff0('0x9'));var jsforce=require(_0x1ff0('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1ff0('0x7'));var querystring=require(_0x1ff0('0xb'));var Papa=require(_0x1ff0('0xc'));var Redis=require(_0x1ff0('0xd'));var authService=require(_0x1ff0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1ff0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ff0('0x10'))(_0x1ff0('0x11'));var utils=require(_0x1ff0('0x12'));var config=require(_0x1ff0('0x13'));var licenseUtil=require(_0x1ff0('0x14'));var db=require(_0x1ff0('0x15'))['db'];config[_0x1ff0('0x16')]=_[_0x1ff0('0x17')](config[_0x1ff0('0x16')],{'host':_0x1ff0('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ff0('0x16')]));require(_0x1ff0('0x19'))[_0x1ff0('0x1a')](socket);var jayson=require(_0x1ff0('0x1b'));var client=jayson['client'][_0x1ff0('0x1c')]({'port':0x232c});var client9002=jayson[_0x1ff0('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b0565,_0xc53d05,_0x736afd,_0x49df7a){return new BPromise(function(_0x564940,_0x28624f){var _0x402adc=_0x49df7a||client;return _0x402adc['request'](_0x9b0565,_0x736afd)[_0x1ff0('0x1e')](function(_0x3b0b40){logger[_0x1ff0('0x1f')](_0x1ff0('0x20'),_0xc53d05,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xc53d05,'request\x20sent',JSON[_0x1ff0('0x21')](_0x3b0b40));if(_0x3b0b40[_0x1ff0('0x22')]){if(_0x3b0b40[_0x1ff0('0x22')]['code']===0x1f4){logger[_0x1ff0('0x22')](_0x1ff0('0x20'),_0xc53d05,_0x3b0b40[_0x1ff0('0x22')][_0x1ff0('0x23')]);return _0x28624f(_0x3b0b40[_0x1ff0('0x22')][_0x1ff0('0x23')]);}logger[_0x1ff0('0x22')](_0x1ff0('0x20'),_0xc53d05,_0x3b0b40[_0x1ff0('0x22')][_0x1ff0('0x23')]);return _0x564940(_0x3b0b40[_0x1ff0('0x22')]['message']);}else{logger[_0x1ff0('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0xc53d05,_0x1ff0('0x24'));_0x564940(_0x3b0b40['result'][_0x1ff0('0x23')]);}})[_0x1ff0('0x25')](function(_0x3c9e6e){logger[_0x1ff0('0x22')](_0x1ff0('0x20'),_0xc53d05,_0x3c9e6e);_0x28624f(_0x3c9e6e);});});}function respondWithStatusCode(_0x5f258e,_0x2c711a){_0x2c711a=_0x2c711a||0xcc;return function(_0x4635ca){if(_0x4635ca){return _0x5f258e[_0x1ff0('0x26')](_0x2c711a);}return _0x5f258e['status'](_0x2c711a)[_0x1ff0('0x27')]();};}function respondWithResult(_0x1bf3d0,_0x29fdb2){_0x29fdb2=_0x29fdb2||0xc8;return function(_0x21e703){if(_0x21e703){return _0x1bf3d0[_0x1ff0('0x28')](_0x29fdb2)['json'](_0x21e703);}};}function respondWithFilteredResult(_0xbd4cdd,_0x16cd1a){return function(_0x37c24){if(_0x37c24){var _0x16a084=typeof _0x16cd1a['offset']===_0x1ff0('0x29')&&typeof _0x16cd1a['limit']===_0x1ff0('0x29');var _0x1f8aab=_0x37c24['count'];var _0x5a3069=_0x16a084?0x0:_0x16cd1a['offset'];var _0x49218f=_0x16a084?_0x37c24[_0x1ff0('0x2a')]:_0x16cd1a[_0x1ff0('0x2b')]+_0x16cd1a[_0x1ff0('0x2c')];var _0x579c2c;if(_0x49218f>=_0x1f8aab){_0x49218f=_0x1f8aab;_0x579c2c=0xc8;}else{_0x579c2c=0xce;}_0xbd4cdd[_0x1ff0('0x28')](_0x579c2c);return _0xbd4cdd[_0x1ff0('0x2d')]('Content-Range',_0x5a3069+'-'+_0x49218f+'/'+_0x1f8aab)[_0x1ff0('0x2e')](_0x37c24);}return null;};}function patchUpdates(_0x42ca21){return function(_0x1a6bed){try{jsonpatch[_0x1ff0('0x2f')](_0x1a6bed,_0x42ca21,!![]);}catch(_0x5b3619){return BPromise[_0x1ff0('0x30')](_0x5b3619);}return _0x1a6bed['save']();};}function saveUpdates(_0x3d4749,_0x2cc0f2){return function(_0x2d3271){if(_0x2d3271){return _0x2d3271[_0x1ff0('0x31')](_0x3d4749)[_0x1ff0('0x1e')](function(_0x26e4f6){return _0x26e4f6;});}return null;};}function removeEntity(_0x3fbadb,_0x39eb11){return function(_0x54f324){if(_0x54f324){return _0x54f324[_0x1ff0('0x32')]()['then'](function(){var _0xbb539c=_0x54f324[_0x1ff0('0x33')]({'plain':!![]});var _0x27cf13='OpenchannelAccounts';return db['UserProfileResource'][_0x1ff0('0x32')]({'where':{'type':_0x27cf13,'resourceId':_0xbb539c['id']}})['then'](function(){return _0x54f324;});})[_0x1ff0('0x1e')](function(){_0x3fbadb[_0x1ff0('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x365eec,_0x16a76c){return function(_0x44cf72){if(!_0x44cf72){_0x365eec[_0x1ff0('0x26')](0x194);}return _0x44cf72;};}function handleError(_0x3a1642,_0x8d805c){_0x8d805c=_0x8d805c||0x1f4;return function(_0x5c272f){logger[_0x1ff0('0x22')](_0x5c272f[_0x1ff0('0x34')]);if(_0x5c272f[_0x1ff0('0x35')]){delete _0x5c272f['name'];}_0x3a1642['status'](_0x8d805c)[_0x1ff0('0x36')](_0x5c272f);};}exports['index']=function(_0x3e6f28,_0x2152ab){var _0x532f47={'include':[{'model':db[_0x1ff0('0x37')],'as':'mandatoryDispositionPause'}]},_0x52947e={},_0x3a4703={'count':0x0,'rows':[]};var _0x16e910=_['map'](db[_0x1ff0('0x38')]['rawAttributes'],function(_0x52ec8e){return{'name':_0x52ec8e['fieldName'],'type':_0x52ec8e[_0x1ff0('0x39')]['key']};});_0x52947e[_0x1ff0('0x3a')]=_[_0x1ff0('0x3b')](_0x16e910,'name');_0x52947e[_0x1ff0('0x3c')]=_[_0x1ff0('0x3d')](_0x3e6f28[_0x1ff0('0x3c')]);_0x52947e[_0x1ff0('0x3e')]=_['intersection'](_0x52947e[_0x1ff0('0x3a')],_0x52947e[_0x1ff0('0x3c')]);_0x532f47[_0x1ff0('0x3f')]=_[_0x1ff0('0x40')](_0x52947e[_0x1ff0('0x3a')],qs[_0x1ff0('0x41')](_0x3e6f28[_0x1ff0('0x3c')]['fields']));_0x532f47[_0x1ff0('0x3f')]=_0x532f47['attributes']['length']?_0x532f47[_0x1ff0('0x3f')]:_0x52947e[_0x1ff0('0x3a')];if(!_0x3e6f28[_0x1ff0('0x3c')]['hasOwnProperty'](_0x1ff0('0x42'))){_0x532f47[_0x1ff0('0x2c')]=qs[_0x1ff0('0x2c')](_0x3e6f28[_0x1ff0('0x3c')][_0x1ff0('0x2c')]);_0x532f47[_0x1ff0('0x2b')]=qs['offset'](_0x3e6f28['query'][_0x1ff0('0x2b')]);}_0x532f47[_0x1ff0('0x43')]=qs[_0x1ff0('0x44')](_0x3e6f28['query'][_0x1ff0('0x44')]);_0x532f47[_0x1ff0('0x45')]=qs[_0x1ff0('0x3e')](_[_0x1ff0('0x46')](_0x3e6f28[_0x1ff0('0x3c')],_0x52947e['filters']),_0x16e910);if(_0x3e6f28[_0x1ff0('0x3c')][_0x1ff0('0x47')]){_0x532f47['where']=_['merge'](_0x532f47['where'],{'$or':_[_0x1ff0('0x3b')](_0x16e910,function(_0x2c31dc){if(_0x2c31dc[_0x1ff0('0x39')]!==_0x1ff0('0x48')){var _0x36013b={};_0x36013b[_0x2c31dc['name']]={'$like':'%'+_0x3e6f28['query'][_0x1ff0('0x47')]+'%'};return _0x36013b;}})});}_0x532f47=_[_0x1ff0('0x49')]({},_0x532f47,_0x3e6f28[_0x1ff0('0x4a')]);var _0x4a381e={'where':_0x532f47[_0x1ff0('0x45')]};return db[_0x1ff0('0x38')][_0x1ff0('0x2a')](_0x4a381e)[_0x1ff0('0x1e')](function(_0x3c68cd){_0x3a4703['count']=_0x3c68cd;if(_0x3e6f28[_0x1ff0('0x3c')][_0x1ff0('0x4b')]){_0x532f47[_0x1ff0('0x4c')]=[{'all':!![]}];}return db[_0x1ff0('0x38')][_0x1ff0('0x4d')](_0x532f47);})['then'](function(_0x44774f){_0x3a4703[_0x1ff0('0x4e')]=_0x44774f;return _0x3a4703;})[_0x1ff0('0x1e')](respondWithFilteredResult(_0x2152ab,_0x532f47))[_0x1ff0('0x25')](handleError(_0x2152ab,null));};exports[_0x1ff0('0x4f')]=function(_0x455246,_0x3ad5d5){var _0x4e7e97={'raw':![],'where':{'id':_0x455246[_0x1ff0('0x50')]['id']},'include':[{'model':db[_0x1ff0('0x37')],'as':_0x1ff0('0x51')}]},_0x44dce6={};_0x44dce6[_0x1ff0('0x3a')]=_[_0x1ff0('0x3d')](db[_0x1ff0('0x38')][_0x1ff0('0x52')]);_0x44dce6[_0x1ff0('0x3c')]=_[_0x1ff0('0x3d')](_0x455246[_0x1ff0('0x3c')]);_0x44dce6[_0x1ff0('0x3e')]=_[_0x1ff0('0x40')](_0x44dce6['model'],_0x44dce6[_0x1ff0('0x3c')]);_0x4e7e97['attributes']=_[_0x1ff0('0x40')](_0x44dce6[_0x1ff0('0x3a')],qs[_0x1ff0('0x41')](_0x455246[_0x1ff0('0x3c')][_0x1ff0('0x41')]));_0x4e7e97[_0x1ff0('0x3f')]=_0x4e7e97[_0x1ff0('0x3f')][_0x1ff0('0x53')]?_0x4e7e97[_0x1ff0('0x3f')]:_0x44dce6[_0x1ff0('0x3a')];if(_0x455246[_0x1ff0('0x3c')][_0x1ff0('0x4b')]){_0x4e7e97['include']=[{'all':!![]}];}_0x4e7e97=_[_0x1ff0('0x49')]({},_0x4e7e97,_0x455246[_0x1ff0('0x4a')]);return db[_0x1ff0('0x38')][_0x1ff0('0x54')](_0x4e7e97)[_0x1ff0('0x1e')](handleEntityNotFound(_0x3ad5d5,null))[_0x1ff0('0x1e')](respondWithResult(_0x3ad5d5,null))[_0x1ff0('0x25')](handleError(_0x3ad5d5,null));};exports[_0x1ff0('0x55')]=function(_0x1bc613,_0x49c286){return db[_0x1ff0('0x38')][_0x1ff0('0x55')](_0x1bc613[_0x1ff0('0x56')],{})[_0x1ff0('0x1e')](function(_0x790d7a){var _0xc22df1=_0x1bc613[_0x1ff0('0x57')][_0x1ff0('0x33')]({'plain':!![]});if(!_0xc22df1)throw new Error(_0x1ff0('0x58'));if(_0xc22df1[_0x1ff0('0x59')]===_0x1ff0('0x57')){var _0xa5b83c=_0x790d7a[_0x1ff0('0x33')]({'plain':!![]});var _0x53d68c=_0x1ff0('0x5a');return db[_0x1ff0('0x5b')][_0x1ff0('0x54')]({'where':{'name':_0x53d68c,'userProfileId':_0xc22df1['userProfileId']},'raw':!![]})['then'](function(_0x40053d){if(_0x40053d&&_0x40053d[_0x1ff0('0x5c')]===0x0){return db[_0x1ff0('0x5d')]['create']({'name':_0xa5b83c['name'],'resourceId':_0xa5b83c['id'],'type':_0x40053d[_0x1ff0('0x35')],'sectionId':_0x40053d['id']},{})[_0x1ff0('0x1e')](function(){return _0x790d7a;});}else{return _0x790d7a;}})[_0x1ff0('0x25')](function(_0x1ae35e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ae35e);throw _0x1ae35e;});}return _0x790d7a;})[_0x1ff0('0x1e')](respondWithResult(_0x49c286,0xc9))[_0x1ff0('0x25')](handleError(_0x49c286,null));};exports[_0x1ff0('0x31')]=function(_0x11e0f2,_0x313ea1){if(_0x11e0f2[_0x1ff0('0x56')]['id']){delete _0x11e0f2[_0x1ff0('0x56')]['id'];}return db[_0x1ff0('0x38')][_0x1ff0('0x54')]({'where':{'id':_0x11e0f2[_0x1ff0('0x50')]['id']},'include':[{'model':db[_0x1ff0('0x37')],'as':_0x1ff0('0x51')}]})[_0x1ff0('0x1e')](handleEntityNotFound(_0x313ea1,null))[_0x1ff0('0x1e')](saveUpdates(_0x11e0f2[_0x1ff0('0x56')],null))[_0x1ff0('0x1e')](respondWithResult(_0x313ea1,null))[_0x1ff0('0x25')](handleError(_0x313ea1,null));};exports[_0x1ff0('0x32')]=function(_0x477828,_0x379ff3){return db[_0x1ff0('0x38')][_0x1ff0('0x54')]({'where':{'id':_0x477828[_0x1ff0('0x50')]['id']}})['then'](handleEntityNotFound(_0x379ff3,null))[_0x1ff0('0x1e')](removeEntity(_0x379ff3,null))[_0x1ff0('0x25')](handleError(_0x379ff3,null));};exports[_0x1ff0('0x5e')]=function(_0x2a6c4c,_0x332810){return db[_0x1ff0('0x38')][_0x1ff0('0x5e')]()[_0x1ff0('0x1e')](respondWithResult(_0x332810,null))[_0x1ff0('0x25')](handleError(_0x332810,null));};exports['addDisposition']=function(_0x45f19b,_0x2bbfa8,_0x256e4c){if(_0x45f19b[_0x1ff0('0x56')]['id']){delete _0x45f19b[_0x1ff0('0x56')]['id'];}return db[_0x1ff0('0x38')]['find']({'where':{'id':_0x45f19b[_0x1ff0('0x50')]['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x2bbfa8,null))[_0x1ff0('0x1e')](function(_0x37b67a){if(_0x37b67a){_0x45f19b[_0x1ff0('0x56')][_0x1ff0('0x5f')]=_0x37b67a['id'];return db[_0x1ff0('0x60')][_0x1ff0('0x55')](_0x45f19b['body']);}})[_0x1ff0('0x1e')](respondWithResult(_0x2bbfa8,null))[_0x1ff0('0x25')](handleError(_0x2bbfa8,null));};exports[_0x1ff0('0x61')]=function(_0x36df1e,_0x10c8a3,_0x4ca4c4){var _0x5a322d={'raw':![],'where':{}};var _0x346b34={};var _0x5e44e5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1ff0('0x62')]({'where':{'id':_0x36df1e[_0x1ff0('0x50')]['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x10c8a3,null))[_0x1ff0('0x1e')](function(_0x308fe7){if(_0x308fe7){_0x346b34[_0x1ff0('0x3a')]=_[_0x1ff0('0x3d')](db[_0x1ff0('0x60')][_0x1ff0('0x52')]);_0x346b34[_0x1ff0('0x3c')]=_['keys'](_0x36df1e[_0x1ff0('0x3c')]);_0x346b34[_0x1ff0('0x3e')]=_[_0x1ff0('0x40')](_0x346b34[_0x1ff0('0x3a')],_0x346b34[_0x1ff0('0x3c')]);_0x5a322d[_0x1ff0('0x3f')]=_[_0x1ff0('0x40')](_0x346b34[_0x1ff0('0x3a')],qs['fields'](_0x36df1e[_0x1ff0('0x3c')][_0x1ff0('0x41')]));_0x5a322d[_0x1ff0('0x3f')]=_0x5a322d['attributes'][_0x1ff0('0x53')]?_0x5a322d[_0x1ff0('0x3f')]:_0x346b34[_0x1ff0('0x3a')];if(!_0x36df1e['query'][_0x1ff0('0x63')](_0x1ff0('0x42'))){_0x5a322d[_0x1ff0('0x2c')]=qs['limit'](_0x36df1e[_0x1ff0('0x3c')][_0x1ff0('0x2c')]);_0x5a322d[_0x1ff0('0x2b')]=qs[_0x1ff0('0x2b')](_0x36df1e[_0x1ff0('0x3c')]['offset']);}_0x5a322d['order']=qs['sort'](_0x36df1e[_0x1ff0('0x3c')][_0x1ff0('0x44')]);_0x5a322d[_0x1ff0('0x45')]=qs[_0x1ff0('0x3e')](_[_0x1ff0('0x46')](_0x36df1e[_0x1ff0('0x3c')],_0x346b34[_0x1ff0('0x3e')]));_0x5a322d[_0x1ff0('0x45')][_0x1ff0('0x5f')]=_0x308fe7['id'];if(_0x36df1e[_0x1ff0('0x3c')][_0x1ff0('0x47')]){_0x5a322d[_0x1ff0('0x45')]=_[_0x1ff0('0x49')](_0x5a322d[_0x1ff0('0x45')],{'$or':_[_0x1ff0('0x3b')](_0x5a322d['attributes'],function(_0x43a16e){var _0x51d132={};_0x51d132[_0x43a16e]={'$like':'%'+_0x36df1e[_0x1ff0('0x3c')]['filter']+'%'};return _0x51d132;})});}_0x5a322d=_[_0x1ff0('0x49')]({},_0x5a322d,_0x36df1e[_0x1ff0('0x4a')]);return db[_0x1ff0('0x60')]['count']({'where':_0x5a322d[_0x1ff0('0x45')]})[_0x1ff0('0x1e')](function(_0x210ff8){_0x5e44e5[_0x1ff0('0x2a')]=_0x210ff8;if(_0x36df1e[_0x1ff0('0x3c')][_0x1ff0('0x4b')]){_0x5a322d[_0x1ff0('0x4c')]=[{'all':!![]}];}return db[_0x1ff0('0x60')][_0x1ff0('0x4d')](_0x5a322d);})[_0x1ff0('0x1e')](function(_0x4d9661){_0x5e44e5[_0x1ff0('0x4e')]=_0x4d9661;return _0x5e44e5;});}})[_0x1ff0('0x1e')](respondWithFilteredResult(_0x10c8a3,_0x5a322d))[_0x1ff0('0x25')](handleError(_0x10c8a3,null));};exports[_0x1ff0('0x64')]=function(_0x4a0502,_0x2b12cb,_0x4201d5){return db['OpenchannelAccount']['find']({'where':{'id':_0x4a0502['params']['id']}})['then'](handleEntityNotFound(_0x2b12cb,null))[_0x1ff0('0x1e')](function(_0x3be1db){if(_0x3be1db){return _0x3be1db['removeDispositions'](_0x4a0502[_0x1ff0('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x2b12cb,null))[_0x1ff0('0x25')](handleError(_0x2b12cb,null));};exports[_0x1ff0('0x65')]=function(_0x2f4c49,_0x4458f3,_0x43b01e){if(_0x2f4c49[_0x1ff0('0x56')]['id']){delete _0x2f4c49['body']['id'];}return db['OpenchannelAccount'][_0x1ff0('0x54')]({'where':{'id':_0x2f4c49[_0x1ff0('0x50')]['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x4458f3,null))['then'](function(_0x4782ea){if(_0x4782ea){_0x2f4c49['body'][_0x1ff0('0x5f')]=_0x4782ea['id'];return db['CannedAnswer'][_0x1ff0('0x55')](_0x2f4c49[_0x1ff0('0x56')]);}})[_0x1ff0('0x1e')](respondWithResult(_0x4458f3,null))[_0x1ff0('0x25')](handleError(_0x4458f3,null));};exports[_0x1ff0('0x66')]=function(_0x15d3c1,_0x46fe98,_0x5b4f8c){var _0x1409e0={'raw':![],'where':{}};var _0x3319eb={};var _0x11450b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1ff0('0x62')]({'where':{'id':_0x15d3c1[_0x1ff0('0x50')]['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x46fe98,null))[_0x1ff0('0x1e')](function(_0x2cd53d){if(_0x2cd53d){_0x3319eb[_0x1ff0('0x3a')]=_[_0x1ff0('0x3d')](db[_0x1ff0('0x67')][_0x1ff0('0x52')]);_0x3319eb[_0x1ff0('0x3c')]=_['keys'](_0x15d3c1[_0x1ff0('0x3c')]);_0x3319eb[_0x1ff0('0x3e')]=_[_0x1ff0('0x40')](_0x3319eb[_0x1ff0('0x3a')],_0x3319eb[_0x1ff0('0x3c')]);_0x1409e0['attributes']=_[_0x1ff0('0x40')](_0x3319eb[_0x1ff0('0x3a')],qs[_0x1ff0('0x41')](_0x15d3c1[_0x1ff0('0x3c')][_0x1ff0('0x41')]));_0x1409e0[_0x1ff0('0x3f')]=_0x1409e0['attributes'][_0x1ff0('0x53')]?_0x1409e0[_0x1ff0('0x3f')]:_0x3319eb[_0x1ff0('0x3a')];if(!_0x15d3c1[_0x1ff0('0x3c')][_0x1ff0('0x63')](_0x1ff0('0x42'))){_0x1409e0[_0x1ff0('0x2c')]=qs[_0x1ff0('0x2c')](_0x15d3c1[_0x1ff0('0x3c')]['limit']);_0x1409e0[_0x1ff0('0x2b')]=qs[_0x1ff0('0x2b')](_0x15d3c1[_0x1ff0('0x3c')][_0x1ff0('0x2b')]);}_0x1409e0[_0x1ff0('0x43')]=qs[_0x1ff0('0x44')](_0x15d3c1[_0x1ff0('0x3c')][_0x1ff0('0x44')]);_0x1409e0[_0x1ff0('0x45')]=qs[_0x1ff0('0x3e')](_[_0x1ff0('0x46')](_0x15d3c1[_0x1ff0('0x3c')],_0x3319eb[_0x1ff0('0x3e')]));_0x1409e0[_0x1ff0('0x45')][_0x1ff0('0x5f')]=_0x2cd53d['id'];if(_0x15d3c1[_0x1ff0('0x3c')]['filter']){_0x1409e0[_0x1ff0('0x45')]=_[_0x1ff0('0x49')](_0x1409e0['where'],{'$or':_[_0x1ff0('0x3b')](_0x1409e0[_0x1ff0('0x3f')],function(_0x18ba7d){var _0x44efd7={};_0x44efd7[_0x18ba7d]={'$like':'%'+_0x15d3c1[_0x1ff0('0x3c')]['filter']+'%'};return _0x44efd7;})});}_0x1409e0=_[_0x1ff0('0x49')]({},_0x1409e0,_0x15d3c1[_0x1ff0('0x4a')]);return db[_0x1ff0('0x67')][_0x1ff0('0x2a')]({'where':_0x1409e0[_0x1ff0('0x45')]})['then'](function(_0x21f80c){_0x11450b[_0x1ff0('0x2a')]=_0x21f80c;if(_0x15d3c1[_0x1ff0('0x3c')][_0x1ff0('0x4b')]){_0x1409e0['include']=[{'all':!![]}];}return db[_0x1ff0('0x67')]['findAll'](_0x1409e0);})['then'](function(_0x678910){_0x11450b[_0x1ff0('0x4e')]=_0x678910;return _0x11450b;});}})['then'](respondWithFilteredResult(_0x46fe98,_0x1409e0))[_0x1ff0('0x25')](handleError(_0x46fe98,null));};exports[_0x1ff0('0x68')]=function(_0x2d9fa0,_0x5965e0,_0x2e29ed){return db[_0x1ff0('0x38')]['find']({'where':{'id':_0x2d9fa0[_0x1ff0('0x50')]['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x5965e0,null))[_0x1ff0('0x1e')](function(_0xbf4605){if(_0xbf4605){return _0xbf4605[_0x1ff0('0x68')](_0x2d9fa0['query'][_0x1ff0('0x69')]);}})['then'](respondWithStatusCode(_0x5965e0,null))[_0x1ff0('0x25')](handleError(_0x5965e0,null));};exports['notify']=function(_0x3c2cf4,_0x5c5e08,_0x18f524){var _0x2fbbbe={'body':_0x3c2cf4[_0x1ff0('0x56')],'channel':_0x1ff0('0x6a')};var _0x36b76f=[];var _0x370f6e=[];var _0xd20d6={};var _0x3a0537=![];return db[_0x1ff0('0x6b')][_0x1ff0('0x5e')]()[_0x1ff0('0x1e')](function(_0x5e8401){if(!_0x5e8401){throw new db[(_0x1ff0('0x6c'))][(_0x1ff0('0x6d'))](_0x1ff0('0x6e'));}_0x36b76f=_[_0x1ff0('0x6f')](_[_0x1ff0('0x3d')](_0x5e8401),[_0x1ff0('0x70'),_0x1ff0('0x71')]);_0x370f6e=_[_0x1ff0('0x6f')](_['keys'](_0x5e8401),[_0x1ff0('0x70'),_0x1ff0('0x71'),_0x1ff0('0x72'),_0x1ff0('0x73')]);if(_0x3c2cf4[_0x1ff0('0x56')]['id']){delete _0x3c2cf4['body']['id'];}if(_[_0x1ff0('0x74')](_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x75')])){throw new db[(_0x1ff0('0x6c'))][(_0x1ff0('0x6d'))](_0x1ff0('0x76'));}if(_[_0x1ff0('0x74')](_0x3c2cf4['body'][_0x1ff0('0x56')])||_0x3c2cf4['body'][_0x1ff0('0x56')]===''){throw new db[(_0x1ff0('0x6c'))][(_0x1ff0('0x6d'))](_0x1ff0('0x77'));}if(_['isNil'](_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x78')])){throw new db[(_0x1ff0('0x6c'))][(_0x1ff0('0x6d'))](_0x1ff0('0x79')+_0x370f6e);}if(!_[_0x1ff0('0x7a')](_0x370f6e,_0x3c2cf4[_0x1ff0('0x56')]['mapKey'])){throw new db[(_0x1ff0('0x6c'))][(_0x1ff0('0x6d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x370f6e);}_0xd20d6[_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x78')]]=_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x75')];})['then'](function(){return db[_0x1ff0('0x38')][_0x1ff0('0x54')]({'where':{'id':_0x3c2cf4[_0x1ff0('0x50')]['id']},'include':[{'model':db[_0x1ff0('0x7b')],'as':_0x1ff0('0x7c'),'include':[{'model':db[_0x1ff0('0x6b')],'as':'Contacts','where':_0xd20d6,'limit':0x1,'order':[[_0x1ff0('0x71'),_0x1ff0('0x7d')]]}]},{'model':db[_0x1ff0('0x7e')],'as':_0x1ff0('0x7f')}]});})[_0x1ff0('0x1e')](handleEntityNotFound(_0x5c5e08,null))[_0x1ff0('0x1e')](function(_0x51efb5){if(_0x51efb5&&_0x51efb5['List']){_0x2fbbbe[_0x1ff0('0x80')]=_0x51efb5;_0x2fbbbe[_0x1ff0('0x81')]=_0x51efb5[_0x1ff0('0x7f')];_0x2fbbbe[_0x1ff0('0x82')]=_0x51efb5[_0x1ff0('0x7c')];_0x2fbbbe[_0x1ff0('0x81')]=_[_0x1ff0('0x83')](_0x2fbbbe[_0x1ff0('0x81')],[_0x1ff0('0x84')],['asc']);if(_0x2fbbbe[_0x1ff0('0x80')][_0x1ff0('0x7f')]){delete _0x2fbbbe[_0x1ff0('0x80')][_0x1ff0('0x7f')];}if(_0x2fbbbe[_0x1ff0('0x80')][_0x1ff0('0x7c')]&&_0x2fbbbe['account'][_0x1ff0('0x7c')][_0x1ff0('0x85')]['length']){return _0x2fbbbe[_0x1ff0('0x80')][_0x1ff0('0x7c')][_0x1ff0('0x85')][0x0];}var _0x17cb69=_[_0x1ff0('0x17')](_0x3c2cf4[_0x1ff0('0x56')],{'firstName':_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x75')],'ListId':_0x51efb5['ListId']});_0x17cb69[_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x78')]]=_0x3c2cf4[_0x1ff0('0x56')]['from'];return db[_0x1ff0('0x6b')][_0x1ff0('0x55')](_0x17cb69,{'fields':_0x36b76f,'raw':!![]});}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x5c5e08,null))[_0x1ff0('0x1e')](function(_0x32b9e0){_0x2fbbbe[_0x1ff0('0x86')]=_0x32b9e0;if(_0x32b9e0){var _0x566b5c={'ContactId':_0x32b9e0['id'],'OpenchannelAccountId':_0x3c2cf4[_0x1ff0('0x50')]['id'],'from':(_0x32b9e0[_0x1ff0('0x87')]||'')+'\x20'+(_0x32b9e0[_0x1ff0('0x88')]||'')};var _0x3221d1={'OpenchannelAccountId':_0x3c2cf4[_0x1ff0('0x50')]['id'],'closed':![]};if(_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x89')]){_0x3221d1[_0x1ff0('0x89')]=_0x3c2cf4['body'][_0x1ff0('0x89')];return db['OpenchannelInteraction'][_0x1ff0('0x54')]({'where':_0x3221d1})[_0x1ff0('0x1e')](function(_0x9ebe19){if(_0x9ebe19){return[_0x9ebe19,![]];}_0x566b5c['threadId']=_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x89')];_0x566b5c['externalUrl']=_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x8a')];return db[_0x1ff0('0x8b')][_0x1ff0('0x55')](_0x566b5c)['then'](function(_0x420046){return[_0x420046,!![]];});});}else{_0x3221d1[_0x1ff0('0x89')]=null;}_0x3221d1[_0x1ff0('0x8c')]=_0x32b9e0['id'];return db[_0x1ff0('0x8b')]['find']({'where':_0x3221d1})[_0x1ff0('0x1e')](function(_0x5324bb){if(_0x5324bb){return[_0x5324bb,![]];}return db[_0x1ff0('0x8b')][_0x1ff0('0x55')](_0x566b5c)[_0x1ff0('0x1e')](function(_0x29582a){return[_0x29582a,!![]];});});}})[_0x1ff0('0x8d')](function(_0x396be2,_0xbe4ff3){if(_0x396be2){_0x3a0537=_0xbe4ff3;if(!_0xbe4ff3){var _0x4bee35={'from':(_0x2fbbbe[_0x1ff0('0x86')]['firstName']||'')+'\x20'+(_0x2fbbbe[_0x1ff0('0x86')]['lastName']||'')};if(_0x3c2cf4[_0x1ff0('0x56')]['threadId']&&_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x8e')]&&_0x3c2cf4[_0x1ff0('0x56')]['threadId']!=_0x3c2cf4['body']['messageId']){_0x4bee35[_0x1ff0('0x89')]=_0x3c2cf4[_0x1ff0('0x56')]['messageId'];}return _0x396be2['update'](_0x4bee35);}else{return _0x396be2;}}})[_0x1ff0('0x1e')](function(_0x447399){_0x2fbbbe['interaction']=_0x447399['get']({'plain':!![]});_0x2fbbbe[_0x1ff0('0x8f')][_0x1ff0('0x90')]=_0x3a0537;if(_0x2fbbbe[_0x1ff0('0x8f')][_0x1ff0('0x90')]){if(_0x2fbbbe['account'][_0x1ff0('0x91')]){_0x2fbbbe[_0x1ff0('0x81')][_0x1ff0('0x92')]({'id':0x0,'priority':_0x2fbbbe['applications'][_0x1ff0('0x53')]+0x1,'app':'close','appdata':_0x1ff0('0x93'),'interval':_0x1ff0('0x94')});}}return db[_0x1ff0('0x95')][_0x1ff0('0x55')]({'body':_0x3c2cf4['body'][_0x1ff0('0x56')],'OpenchannelAccountId':_0x3c2cf4[_0x1ff0('0x50')]['id'],'OpenchannelInteractionId':_0x447399['id'],'direction':'in','ContactId':_0x2fbbbe['contact']['id'],'AttachmentId':_0x3c2cf4[_0x1ff0('0x56')][_0x1ff0('0x96')]});})[_0x1ff0('0x1e')](function(_0x41d26f){_0x2fbbbe[_0x1ff0('0x23')]=_0x41d26f;if(!_0x2fbbbe['interaction'][_0x1ff0('0x97')])return;return db[_0x1ff0('0x98')]['find']({'attributes':['id',_0x1ff0('0x35')],'where':{'id':_0x2fbbbe[_0x1ff0('0x8f')]['UserId']}});})['then'](function(_0x2b6c48){if(_0x2b6c48){_0x2fbbbe[_0x1ff0('0x81')][_0x1ff0('0x99')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2b6c48[_0x1ff0('0x35')]+','+(_0x2fbbbe[_0x1ff0('0x80')][_0x1ff0('0x9a')]||0xa),'interval':_0x1ff0('0x94')});}if(!_0x2fbbbe[_0x1ff0('0x8f')][_0x1ff0('0x9b')])return;return db['OpenchannelQueue'][_0x1ff0('0x54')]({'attributes':['id',_0x1ff0('0x35')],'where':{'id':_0x2fbbbe[_0x1ff0('0x8f')][_0x1ff0('0x9b')]}});})[_0x1ff0('0x1e')](function(_0xbbbf16){if(_0xbbbf16){_0x2fbbbe['applications'][_0x1ff0('0x99')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0xbbbf16[_0x1ff0('0x35')]+','+(_0x2fbbbe['account'][_0x1ff0('0x9c')]||0x12c),'interval':_0x1ff0('0x94')});}return respondWithRpcPromise(_0x1ff0('0x9d'),_0x1ff0('0x9e'),_0x2fbbbe);})[_0x1ff0('0x1e')](function(_0x417cbc){respondWithRpcPromise(_0x1ff0('0x9f'),_0x1ff0('0x9f'),{'event':'notify','message':_0x417cbc},client9002);return _0x417cbc;})['then'](respondWithResult(_0x5c5e08,null))[_0x1ff0('0x25')](handleError(_0x5c5e08,null));};exports[_0x1ff0('0xa0')]=function(_0x4c28c7,_0x32ab3d){var _0x4734f3=_0x4c28c7[_0x1ff0('0x50')]['id'];var _0x5a1034=_0x4c28c7[_0x1ff0('0x56')];var _0x2f757f=0xc8;var _0x50dea4=null;return db[_0x1ff0('0xa1')]['transaction']({'isolationLevel':db['sequelize'][_0x1ff0('0xa2')]['ISOLATION_LEVELS'][_0x1ff0('0xa3')]},function(_0x2d2127){return db[_0x1ff0('0x38')][_0x1ff0('0x62')]({'where':{'id':_0x4734f3},'transaction':_0x2d2127})['then'](function(_0x4c7435){if(_0x4c7435){return db['OpenchannelApplication'][_0x1ff0('0x32')]({'where':{'OpenchannelAccountId':_0x4734f3},'transaction':_0x2d2127})[_0x1ff0('0x1e')](function(){var _0xf5423b=_['map'](_0x5a1034,function(_0x367d3c){_0x367d3c[_0x1ff0('0x5f')]=_0x4734f3;return _0x367d3c;});return db['OpenchannelApplication'][_0x1ff0('0xa4')](_0xf5423b,{'transaction':_0x2d2127});});}else{_0x2f757f=0x194;_0x50dea4=[];}});})['then'](function(){if(_0x2f757f!==0x194){return db[_0x1ff0('0x7e')][_0x1ff0('0xa5')]({'where':{'OpenchannelAccountId':_0x4734f3},'order':_0x1ff0('0x84')})['then'](function(_0x1dcf6f){_0x50dea4=_0x1dcf6f;});}})[_0x1ff0('0x25')](function(_0x4e03af){_0x2f757f=0x1f4;logger['error'](_0x4e03af[_0x1ff0('0x34')]);if(_0x4e03af[_0x1ff0('0x35')]){delete _0x4e03af[_0x1ff0('0x35')];}_0x50dea4=_0x4e03af;})['finally'](function(){if(_0x50dea4===null){_0x32ab3d[_0x1ff0('0x26')](_0x2f757f);}else{if(_0x2f757f===0x1f4){_0x32ab3d['status'](_0x2f757f)[_0x1ff0('0x36')](_0x50dea4);}else{_0x32ab3d[_0x1ff0('0x28')](_0x2f757f)[_0x1ff0('0x2e')](_0x50dea4);}}});};exports['getApplications']=function(_0x2983af,_0x15c84a,_0x163e02){var _0x4b4adb={};var _0x503ebb={};var _0x3ce8a8;var _0xcfa669;return db[_0x1ff0('0x38')][_0x1ff0('0x62')]({'where':{'id':_0x2983af['params']['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x15c84a,null))[_0x1ff0('0x1e')](function(_0x4615d8){if(_0x4615d8){_0x3ce8a8=_0x4615d8;_0x503ebb[_0x1ff0('0x3a')]=_['keys'](db[_0x1ff0('0x7e')][_0x1ff0('0x52')]);_0x503ebb[_0x1ff0('0x3c')]=_[_0x1ff0('0x3d')](_0x2983af[_0x1ff0('0x3c')]);_0x503ebb['filters']=_['intersection'](_0x503ebb[_0x1ff0('0x3a')],_0x503ebb[_0x1ff0('0x3c')]);_0x4b4adb[_0x1ff0('0x3f')]=_[_0x1ff0('0x40')](_0x503ebb[_0x1ff0('0x3a')],qs['fields'](_0x2983af[_0x1ff0('0x3c')][_0x1ff0('0x41')]));_0x4b4adb['attributes']=_0x4b4adb[_0x1ff0('0x3f')][_0x1ff0('0x53')]?_0x4b4adb[_0x1ff0('0x3f')]:_0x503ebb[_0x1ff0('0x3a')];_0x4b4adb[_0x1ff0('0x43')]=qs['sort'](_0x2983af[_0x1ff0('0x3c')][_0x1ff0('0x44')]);_0x4b4adb[_0x1ff0('0x45')]=qs[_0x1ff0('0x3e')](_['pick'](_0x2983af[_0x1ff0('0x3c')],_0x503ebb['filters']));if(_0x2983af['query']['filter']){_0x4b4adb[_0x1ff0('0x45')]=_[_0x1ff0('0x49')](_0x4b4adb[_0x1ff0('0x45')],{'$or':_[_0x1ff0('0x3b')](_0x4b4adb[_0x1ff0('0x3f')],function(_0x4fab0e){var _0x394b30={};_0x394b30[_0x4fab0e]={'$like':'%'+_0x2983af[_0x1ff0('0x3c')][_0x1ff0('0x47')]+'%'};return _0x394b30;})});}_0x4b4adb=_[_0x1ff0('0x49')]({},_0x4b4adb,_0x2983af['options']);return _0x3ce8a8[_0x1ff0('0xa6')](_0x4b4adb);}})[_0x1ff0('0x1e')](function(_0x1fc3db){if(_0x1fc3db){_0xcfa669=_0x1fc3db['length'];if(!_0x2983af['query'][_0x1ff0('0x63')](_0x1ff0('0x42'))){_0x4b4adb[_0x1ff0('0x2c')]=qs[_0x1ff0('0x2c')](_0x2983af['query'][_0x1ff0('0x2c')]);_0x4b4adb['offset']=qs['offset'](_0x2983af[_0x1ff0('0x3c')]['offset']);}return _0x3ce8a8[_0x1ff0('0xa6')](_0x4b4adb);}})[_0x1ff0('0x1e')](function(_0x4e0615){if(_0x4e0615){return _0x4e0615?{'count':_0xcfa669,'rows':_0x4e0615}:null;}})[_0x1ff0('0x1e')](respondWithResult(_0x15c84a,null))['catch'](handleError(_0x15c84a,null));};exports[_0x1ff0('0xa7')]=function(_0x2c3098,_0xfddfb6,_0x378d5c){var _0x87e8c3={'raw':![],'where':{}};var _0x3fc15f={};var _0x5f0354={'count':0x0,'rows':[]};return db[_0x1ff0('0x38')][_0x1ff0('0x62')]({'where':{'id':_0x2c3098[_0x1ff0('0x50')]['id']}})['then'](handleEntityNotFound(_0xfddfb6,null))[_0x1ff0('0x1e')](function(_0x40e96){if(_0x40e96){_0x3fc15f['model']=_[_0x1ff0('0x3d')](db[_0x1ff0('0x8b')][_0x1ff0('0x52')]);_0x3fc15f['query']=_['keys'](_0x2c3098[_0x1ff0('0x3c')]);_0x3fc15f['filters']=_[_0x1ff0('0x40')](_0x3fc15f['model'],_0x3fc15f[_0x1ff0('0x3c')]);_0x87e8c3['attributes']=_[_0x1ff0('0x40')](_0x3fc15f[_0x1ff0('0x3a')],qs[_0x1ff0('0x41')](_0x2c3098[_0x1ff0('0x3c')][_0x1ff0('0x41')]));_0x87e8c3[_0x1ff0('0x3f')]=_0x87e8c3[_0x1ff0('0x3f')][_0x1ff0('0x53')]?_0x87e8c3[_0x1ff0('0x3f')]:_0x3fc15f[_0x1ff0('0x3a')];if(!_0x2c3098[_0x1ff0('0x3c')][_0x1ff0('0x63')](_0x1ff0('0x42'))){_0x87e8c3['limit']=qs['limit'](_0x2c3098[_0x1ff0('0x3c')]['limit']);_0x87e8c3[_0x1ff0('0x2b')]=qs['offset'](_0x2c3098[_0x1ff0('0x3c')]['offset']);}_0x87e8c3[_0x1ff0('0x43')]=qs[_0x1ff0('0x44')](_0x2c3098[_0x1ff0('0x3c')][_0x1ff0('0x44')]);_0x87e8c3[_0x1ff0('0x45')]=qs[_0x1ff0('0x3e')](_[_0x1ff0('0x46')](_0x2c3098[_0x1ff0('0x3c')],_0x3fc15f[_0x1ff0('0x3e')]));_0x87e8c3[_0x1ff0('0x45')][_0x1ff0('0x5f')]=_0x40e96['id'];if(_0x2c3098[_0x1ff0('0x3c')][_0x1ff0('0x47')]){_0x87e8c3['where']=_['merge'](_0x87e8c3['where'],{'$or':_[_0x1ff0('0x3b')](_0x87e8c3['attributes'],function(_0x4d295c){var _0x1766ae={};_0x1766ae[_0x4d295c]={'$like':'%'+_0x2c3098[_0x1ff0('0x3c')]['filter']+'%'};return _0x1766ae;})});}_0x87e8c3=_[_0x1ff0('0x49')]({},_0x87e8c3,_0x2c3098[_0x1ff0('0x4a')]);return db[_0x1ff0('0x8b')][_0x1ff0('0x2a')]({'where':_0x87e8c3[_0x1ff0('0x45')]})[_0x1ff0('0x1e')](function(_0xab448a){_0x5f0354[_0x1ff0('0x2a')]=_0xab448a;if(_0x2c3098[_0x1ff0('0x3c')][_0x1ff0('0x4b')]){_0x87e8c3[_0x1ff0('0x4c')]=[{'model':db[_0x1ff0('0x6b')],'as':'Contact','required':![]},{'model':db[_0x1ff0('0x98')],'as':_0x1ff0('0xa8'),'attributes':[_0x1ff0('0x35'),_0x1ff0('0xa9'),_0x1ff0('0xaa')],'required':![]},{'model':db[_0x1ff0('0xab')],'as':_0x1ff0('0xac'),'attributes':['id',_0x1ff0('0x35'),'color'],'where':_0x2c3098[_0x1ff0('0x3c')][_0x1ff0('0xad')]?{'id':_0x2c3098[_0x1ff0('0x3c')][_0x1ff0('0xad')]}:undefined,'required':_0x2c3098[_0x1ff0('0x3c')]['tag']?!![]:![]}];}return db[_0x1ff0('0x8b')][_0x1ff0('0x4d')](_0x87e8c3);})[_0x1ff0('0x1e')](function(_0xa0f3e2){_0x5f0354['rows']=_0xa0f3e2;return _0x5f0354;});}})[_0x1ff0('0x1e')](respondWithFilteredResult(_0xfddfb6,_0x87e8c3))[_0x1ff0('0x25')](handleError(_0xfddfb6,null));};exports['addAgents']=function(_0x5d92e2,_0x4c739c,_0x4b0af3){return db[_0x1ff0('0x38')][_0x1ff0('0x54')]({'where':{'id':_0x5d92e2[_0x1ff0('0x50')]['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x4c739c,null))['then'](function(_0x7771ec){if(_0x7771ec){return _0x7771ec[_0x1ff0('0xae')](_0x5d92e2['body'][_0x1ff0('0x69')],_['omit'](_0x5d92e2[_0x1ff0('0x56')],[_0x1ff0('0x69'),'id'])||{})['spread'](function(_0x4bd369){for(var _0x2b22f0=0x0;_0x2b22f0<_0x5d92e2['body']['ids'][_0x1ff0('0x53')];_0x2b22f0+=0x1){socket[_0x1ff0('0xaf')](_0x1ff0('0xb0'),{'UserId':Number(_0x5d92e2[_0x1ff0('0x56')][_0x1ff0('0x69')][_0x2b22f0]),'OpenchannelAccountId':Number(_0x5d92e2[_0x1ff0('0x50')]['id'])});}return _0x4bd369;});}})[_0x1ff0('0x1e')](respondWithResult(_0x4c739c,null))[_0x1ff0('0x25')](handleError(_0x4c739c,null));};exports[_0x1ff0('0xb1')]=function(_0x1d7f77,_0x14ffab,_0x52fb70){return db[_0x1ff0('0x38')][_0x1ff0('0x54')]({'where':{'id':_0x1d7f77['params']['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x14ffab,null))[_0x1ff0('0x1e')](function(_0x21415d){if(_0x21415d){return _0x21415d[_0x1ff0('0xb1')](_0x1d7f77[_0x1ff0('0x3c')]['ids'])[_0x1ff0('0x1e')](function(){if(_['isArray'](_0x1d7f77['query'][_0x1ff0('0x69')])){for(var _0xb6cf1=0x0;_0xb6cf1<_0x1d7f77[_0x1ff0('0x3c')]['ids'][_0x1ff0('0x53')];_0xb6cf1+=0x1){socket[_0x1ff0('0xaf')](_0x1ff0('0xb2'),{'UserId':Number(_0x1d7f77[_0x1ff0('0x3c')][_0x1ff0('0x69')][_0xb6cf1]),'OpenchannelAccountId':Number(_0x1d7f77['params']['id'])});}}else{socket[_0x1ff0('0xaf')](_0x1ff0('0xb2'),{'UserId':Number(_0x1d7f77[_0x1ff0('0x3c')][_0x1ff0('0x69')]),'OpenchannelAccountId':Number(_0x1d7f77[_0x1ff0('0x50')]['id'])});}});}})[_0x1ff0('0x1e')](respondWithStatusCode(_0x14ffab,null))[_0x1ff0('0x25')](handleError(_0x14ffab,null));};exports[_0x1ff0('0xb3')]=function(_0x4c63fd,_0x46a6e2,_0x2c54fd){var _0x389e59={};var _0x4a2295={};var _0x7cc41c;var _0x1a42c;return db[_0x1ff0('0x38')][_0x1ff0('0x62')]({'where':{'id':_0x4c63fd[_0x1ff0('0x50')]['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x46a6e2,null))[_0x1ff0('0x1e')](function(_0xe4919a){if(_0xe4919a){_0x7cc41c=_0xe4919a;_0x4a2295[_0x1ff0('0x3a')]=_[_0x1ff0('0x3d')](db[_0x1ff0('0x98')]['rawAttributes']);_0x4a2295[_0x1ff0('0x3c')]=_[_0x1ff0('0x3d')](_0x4c63fd[_0x1ff0('0x3c')]);_0x4a2295[_0x1ff0('0x3e')]=_['intersection'](_0x4a2295[_0x1ff0('0x3a')],_0x4a2295[_0x1ff0('0x3c')]);_0x389e59[_0x1ff0('0x3f')]=_[_0x1ff0('0x40')](_0x4a2295[_0x1ff0('0x3a')],qs[_0x1ff0('0x41')](_0x4c63fd[_0x1ff0('0x3c')][_0x1ff0('0x41')]));_0x389e59['attributes']=_0x389e59[_0x1ff0('0x3f')]['length']?_0x389e59[_0x1ff0('0x3f')]:_0x4a2295[_0x1ff0('0x3a')];_0x389e59[_0x1ff0('0x43')]=qs[_0x1ff0('0x44')](_0x4c63fd[_0x1ff0('0x3c')][_0x1ff0('0x44')]);_0x389e59[_0x1ff0('0x45')]=qs[_0x1ff0('0x3e')](_[_0x1ff0('0x46')](_0x4c63fd['query'],_0x4a2295[_0x1ff0('0x3e')]));if(_0x4c63fd['query']['filter']){_0x389e59[_0x1ff0('0x45')]=_[_0x1ff0('0x49')](_0x389e59[_0x1ff0('0x45')],{'$or':_[_0x1ff0('0x3b')](_0x389e59[_0x1ff0('0x3f')],function(_0x56cc19){var _0xf41395={};_0xf41395[_0x56cc19]={'$like':'%'+_0x4c63fd[_0x1ff0('0x3c')][_0x1ff0('0x47')]+'%'};return _0xf41395;})});}_0x389e59=_[_0x1ff0('0x49')]({},_0x389e59,_0x4c63fd['options']);return _0x7cc41c[_0x1ff0('0xb3')](_0x389e59);}})[_0x1ff0('0x1e')](function(_0x3d2d7f){if(_0x3d2d7f){_0x1a42c=_0x3d2d7f[_0x1ff0('0x53')];if(!_0x4c63fd[_0x1ff0('0x3c')][_0x1ff0('0x63')](_0x1ff0('0x42'))){_0x389e59[_0x1ff0('0x2c')]=qs[_0x1ff0('0x2c')](_0x4c63fd[_0x1ff0('0x3c')][_0x1ff0('0x2c')]);_0x389e59['offset']=qs[_0x1ff0('0x2b')](_0x4c63fd[_0x1ff0('0x3c')]['offset']);}return _0x7cc41c[_0x1ff0('0xb3')](_0x389e59);}})[_0x1ff0('0x1e')](function(_0x59f20e){if(_0x59f20e){return _0x59f20e?{'count':_0x1a42c,'rows':_0x59f20e}:null;}})[_0x1ff0('0x1e')](respondWithResult(_0x46a6e2,null))[_0x1ff0('0x25')](handleError(_0x46a6e2,null));};exports[_0x1ff0('0x36')]=function(_0x10ac79,_0x5518ab,_0x1fe5e2){var _0x3297fe,_0x260d8a,_0x3d1c9c;if(_[_0x1ff0('0x74')](_0x10ac79['body'][_0x1ff0('0x56')])||_0x10ac79['body'][_0x1ff0('0x56')]===''){throw new db[(_0x1ff0('0x6c'))][(_0x1ff0('0x6d'))](_0x1ff0('0x77'));}if(_[_0x1ff0('0x74')](_0x10ac79[_0x1ff0('0x56')]['to'])){}_0x3297fe=_0x10ac79[_0x1ff0('0x56')]['to'];return db[_0x1ff0('0x38')]['findOne']({'where':{'id':_0x10ac79[_0x1ff0('0x50')]['id']}})[_0x1ff0('0x1e')](handleEntityNotFound(_0x5518ab,null))[_0x1ff0('0x1e')](function(_0x560d11){if(_0x560d11){return db[_0x1ff0('0x38')][_0x1ff0('0x54')]({'where':{'id':_0x560d11['id']},'include':[{'model':db[_0x1ff0('0x7b')],'as':_0x1ff0('0x7c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x560d11['mapKey']]:_0x3297fe},'limit':0x1,'order':[[_0x1ff0('0x71'),_0x1ff0('0x7d')]]}]}]})['then'](handleEntityNotFound(_0x5518ab,null))[_0x1ff0('0x1e')](function(_0x44c589){if(_0x44c589&&_0x44c589[_0x1ff0('0x7c')]){_0x260d8a=_0x44c589['get']({'plain':!![]});if(_0x260d8a[_0x1ff0('0x7c')]&&_0x260d8a['List']['Contacts'][_0x1ff0('0x53')]){return _0x260d8a[_0x1ff0('0x7c')][_0x1ff0('0x85')][0x0];}return db['CmContact'][_0x1ff0('0x55')](_[_0x1ff0('0x17')](_0x10ac79[_0x1ff0('0x56')],{'firstName':_0x3297fe,[_0x44c589[_0x1ff0('0x78')]]:_0x3297fe,'phone':_0x3297fe,'ListId':_0x260d8a[_0x1ff0('0x73')]}));}})['then'](handleEntityNotFound(_0x5518ab,null))['then'](function(_0x213c19){if(_0x213c19){_0x3d1c9c=_0x213c19;return db['OpenchannelInteraction'][_0x1ff0('0x54')]({'where':{'ContactId':_0x3d1c9c['id'],'closed':![],'OpenchannelAccountId':_0x260d8a['id']}})[_0x1ff0('0x1e')](function(_0x31ad3a){if(_0x31ad3a){return[_0x31ad3a,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x10ac79['user']['id'],'ContactId':_0x3d1c9c['id'],'OpenchannelAccountId':_0x260d8a['id'],'lastMsgDirection':'out','firstMsgDirection':_0x1ff0('0xb4'),'Messages':[_['merge'](_0x10ac79[_0x1ff0('0x56')],{'read':![],'body':_0x10ac79[_0x1ff0('0x56')][_0x1ff0('0x56')],'OpenchannelAccountId':_0x260d8a['id'],'UserId':_0x10ac79[_0x1ff0('0x57')]['id'],'ContactId':_0x3d1c9c['id']})]},{'include':[{'model':db[_0x1ff0('0x95')],'as':_0x1ff0('0xb5')}]})[_0x1ff0('0x1e')](function(_0x31d132){return[_0x31d132,!![]];});});}})[_0x1ff0('0x8d')](function(_0x2e8d0f,_0x35585a){if(_0x35585a){return _0x2e8d0f;}return db[_0x1ff0('0x95')][_0x1ff0('0x55')](_['merge'](_0x10ac79[_0x1ff0('0x56')],{'read':![],'body':_0x10ac79[_0x1ff0('0x56')][_0x1ff0('0x56')],'OpenchannelAccountId':_0x260d8a['id'],'OpenchannelInteractionId':_0x2e8d0f['id'],'UserId':_0x10ac79[_0x1ff0('0x57')]['id'],'ContactId':_0x3d1c9c['id']}))[_0x1ff0('0x1e')](function(_0xf3aab7){_0x2e8d0f[_0x1ff0('0xb6')][_0x1ff0('0xb5')]=[];_0x2e8d0f[_0x1ff0('0xb6')][_0x1ff0('0xb5')][_0x1ff0('0x92')](_0xf3aab7[_0x1ff0('0xb6')]);return _0x2e8d0f;});});}})[_0x1ff0('0x1e')](respondWithResult(_0x5518ab,null))[_0x1ff0('0x25')](handleError(_0x5518ab,null));}; \ No newline at end of file +var _0x5a63=['UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','queue','waitForTheAssignedQueue','EventManager','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','dataValues','Messages','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','get','sendStatus','stack','name','send','Pause','map','OpenchannelAccount','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','mandatoryDispositionPause','create','body','user','role','OpenchannelAccounts','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','CannedAnswer','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5a63,0xe3));var _0x35a6=function(_0x5f2cc2,_0x104c52){_0x5f2cc2=_0x5f2cc2-0x0;var _0x30560b=_0x5a63[_0x5f2cc2];return _0x30560b;};'use strict';var emlformat=require(_0x35a6('0x0'));var rimraf=require(_0x35a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x35a6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x35a6('0x3'));var util=require(_0x35a6('0x4'));var path=require(_0x35a6('0x5'));var sox=require(_0x35a6('0x6'));var csv=require(_0x35a6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35a6('0x8'));var _=require('lodash');var squel=require(_0x35a6('0x9'));var crypto=require('crypto');var jsforce=require(_0x35a6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x35a6('0x7'));var querystring=require(_0x35a6('0xb'));var Papa=require(_0x35a6('0xc'));var Redis=require(_0x35a6('0xd'));var authService=require(_0x35a6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x35a6('0xf'));var hardwareService=require(_0x35a6('0x10'));var logger=require(_0x35a6('0x11'))('api');var utils=require(_0x35a6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x35a6('0x13'));var db=require(_0x35a6('0x14'))['db'];config[_0x35a6('0x15')]=_[_0x35a6('0x16')](config[_0x35a6('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x35a6('0x17'))(new Redis(config[_0x35a6('0x15')]));require(_0x35a6('0x18'))[_0x35a6('0x19')](socket);var jayson=require(_0x35a6('0x1a'));var client=jayson[_0x35a6('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x35a6('0x1b')][_0x35a6('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x313380,_0x474e34,_0x167245,_0x3f0da7){return new BPromise(function(_0x502b5e,_0x29c6d0){var _0x4047d2=_0x3f0da7||client;return _0x4047d2[_0x35a6('0x1d')](_0x313380,_0x167245)[_0x35a6('0x1e')](function(_0x20cbf9){logger[_0x35a6('0x1f')](_0x35a6('0x20'),_0x474e34,'request\x20sent');logger[_0x35a6('0x21')](_0x35a6('0x22'),_0x474e34,_0x35a6('0x23'),JSON['stringify'](_0x20cbf9));if(_0x20cbf9[_0x35a6('0x24')]){if(_0x20cbf9[_0x35a6('0x24')][_0x35a6('0x25')]===0x1f4){logger['error'](_0x35a6('0x20'),_0x474e34,_0x20cbf9[_0x35a6('0x24')]['message']);return _0x29c6d0(_0x20cbf9[_0x35a6('0x24')][_0x35a6('0x26')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x474e34,_0x20cbf9[_0x35a6('0x24')][_0x35a6('0x26')]);return _0x502b5e(_0x20cbf9[_0x35a6('0x24')][_0x35a6('0x26')]);}else{logger[_0x35a6('0x1f')](_0x35a6('0x20'),_0x474e34,_0x35a6('0x23'));_0x502b5e(_0x20cbf9[_0x35a6('0x27')][_0x35a6('0x26')]);}})[_0x35a6('0x28')](function(_0x32553e){logger[_0x35a6('0x24')](_0x35a6('0x20'),_0x474e34,_0x32553e);_0x29c6d0(_0x32553e);});});}function respondWithStatusCode(_0x361e8b,_0x3634f5){_0x3634f5=_0x3634f5||0xcc;return function(_0x4dbf73){if(_0x4dbf73){return _0x361e8b['sendStatus'](_0x3634f5);}return _0x361e8b[_0x35a6('0x29')](_0x3634f5)[_0x35a6('0x2a')]();};}function respondWithResult(_0x2680ef,_0x4d68cd){_0x4d68cd=_0x4d68cd||0xc8;return function(_0x3767c8){if(_0x3767c8){return _0x2680ef[_0x35a6('0x29')](_0x4d68cd)[_0x35a6('0x2b')](_0x3767c8);}};}function respondWithFilteredResult(_0x422ca0,_0x503648){return function(_0x12f2ec){if(_0x12f2ec){var _0x386235=typeof _0x503648[_0x35a6('0x2c')]===_0x35a6('0x2d')&&typeof _0x503648['limit']==='undefined';var _0x19bd13=_0x12f2ec[_0x35a6('0x2e')];var _0x47aa11=_0x386235?0x0:_0x503648[_0x35a6('0x2c')];var _0x88953f=_0x386235?_0x12f2ec[_0x35a6('0x2e')]:_0x503648[_0x35a6('0x2c')]+_0x503648[_0x35a6('0x2f')];var _0x202b52;if(_0x88953f>=_0x19bd13){_0x88953f=_0x19bd13;_0x202b52=0xc8;}else{_0x202b52=0xce;}_0x422ca0['status'](_0x202b52);return _0x422ca0[_0x35a6('0x30')](_0x35a6('0x31'),_0x47aa11+'-'+_0x88953f+'/'+_0x19bd13)[_0x35a6('0x2b')](_0x12f2ec);}return null;};}function patchUpdates(_0xf8f654){return function(_0x1d378b){try{jsonpatch['apply'](_0x1d378b,_0xf8f654,!![]);}catch(_0xf8ca3a){return BPromise[_0x35a6('0x32')](_0xf8ca3a);}return _0x1d378b['save']();};}function saveUpdates(_0xda028d,_0x1211d6){return function(_0x3a7270){if(_0x3a7270){return _0x3a7270[_0x35a6('0x33')](_0xda028d)[_0x35a6('0x1e')](function(_0x3a6d1b){return _0x3a6d1b;});}return null;};}function removeEntity(_0x1075ad,_0x4619d8){return function(_0x1eeb9e){if(_0x1eeb9e){return _0x1eeb9e[_0x35a6('0x34')]()[_0x35a6('0x1e')](function(){var _0x421847=_0x1eeb9e[_0x35a6('0x35')]({'plain':!![]});var _0x272c21='OpenchannelAccounts';return db['UserProfileResource'][_0x35a6('0x34')]({'where':{'type':_0x272c21,'resourceId':_0x421847['id']}})['then'](function(){return _0x1eeb9e;});})[_0x35a6('0x1e')](function(){_0x1075ad[_0x35a6('0x29')](0xcc)[_0x35a6('0x2a')]();});}};}function handleEntityNotFound(_0x5a1e4c,_0x4a9b9a){return function(_0x139b72){if(!_0x139b72){_0x5a1e4c[_0x35a6('0x36')](0x194);}return _0x139b72;};}function handleError(_0x458302,_0x206d19){_0x206d19=_0x206d19||0x1f4;return function(_0x217a42){logger[_0x35a6('0x24')](_0x217a42[_0x35a6('0x37')]);if(_0x217a42[_0x35a6('0x38')]){delete _0x217a42['name'];}_0x458302[_0x35a6('0x29')](_0x206d19)[_0x35a6('0x39')](_0x217a42);};}exports['index']=function(_0x5c431e,_0x266240){var _0x555884={'include':[{'model':db[_0x35a6('0x3a')],'as':'mandatoryDispositionPause'}]},_0x3c3e7d={},_0xd7e4db={'count':0x0,'rows':[]};var _0x3d62d7=_[_0x35a6('0x3b')](db[_0x35a6('0x3c')][_0x35a6('0x3d')],function(_0x208f90){return{'name':_0x208f90['fieldName'],'type':_0x208f90['type']['key']};});_0x3c3e7d['model']=_['map'](_0x3d62d7,_0x35a6('0x38'));_0x3c3e7d[_0x35a6('0x3e')]=_[_0x35a6('0x3f')](_0x5c431e[_0x35a6('0x3e')]);_0x3c3e7d[_0x35a6('0x40')]=_[_0x35a6('0x41')](_0x3c3e7d['model'],_0x3c3e7d[_0x35a6('0x3e')]);_0x555884['attributes']=_[_0x35a6('0x41')](_0x3c3e7d[_0x35a6('0x42')],qs[_0x35a6('0x43')](_0x5c431e[_0x35a6('0x3e')][_0x35a6('0x43')]));_0x555884[_0x35a6('0x44')]=_0x555884[_0x35a6('0x44')][_0x35a6('0x45')]?_0x555884[_0x35a6('0x44')]:_0x3c3e7d['model'];if(!_0x5c431e[_0x35a6('0x3e')][_0x35a6('0x46')](_0x35a6('0x47'))){_0x555884[_0x35a6('0x2f')]=qs[_0x35a6('0x2f')](_0x5c431e[_0x35a6('0x3e')][_0x35a6('0x2f')]);_0x555884[_0x35a6('0x2c')]=qs[_0x35a6('0x2c')](_0x5c431e['query'][_0x35a6('0x2c')]);}_0x555884[_0x35a6('0x48')]=qs[_0x35a6('0x49')](_0x5c431e[_0x35a6('0x3e')][_0x35a6('0x49')]);_0x555884[_0x35a6('0x4a')]=qs[_0x35a6('0x40')](_[_0x35a6('0x4b')](_0x5c431e[_0x35a6('0x3e')],_0x3c3e7d[_0x35a6('0x40')]),_0x3d62d7);if(_0x5c431e[_0x35a6('0x3e')][_0x35a6('0x4c')]){_0x555884[_0x35a6('0x4a')]=_[_0x35a6('0x4d')](_0x555884[_0x35a6('0x4a')],{'$or':_[_0x35a6('0x3b')](_0x3d62d7,function(_0xaf4028){if(_0xaf4028[_0x35a6('0x4e')]!==_0x35a6('0x4f')){var _0x3c36da={};_0x3c36da[_0xaf4028[_0x35a6('0x38')]]={'$like':'%'+_0x5c431e[_0x35a6('0x3e')]['filter']+'%'};return _0x3c36da;}})});}_0x555884=_[_0x35a6('0x4d')]({},_0x555884,_0x5c431e[_0x35a6('0x50')]);var _0x1ac050={'where':_0x555884[_0x35a6('0x4a')]};return db[_0x35a6('0x3c')][_0x35a6('0x2e')](_0x1ac050)[_0x35a6('0x1e')](function(_0x23bf9c){_0xd7e4db[_0x35a6('0x2e')]=_0x23bf9c;if(_0x5c431e[_0x35a6('0x3e')][_0x35a6('0x51')]){_0x555884[_0x35a6('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x35a6('0x53')](_0x555884);})['then'](function(_0x10dff){_0xd7e4db[_0x35a6('0x54')]=_0x10dff;return _0xd7e4db;})[_0x35a6('0x1e')](respondWithFilteredResult(_0x266240,_0x555884))[_0x35a6('0x28')](handleError(_0x266240,null));};exports['show']=function(_0x5e0941,_0x55753d){var _0x307c36={'raw':![],'where':{'id':_0x5e0941['params']['id']},'include':[{'model':db[_0x35a6('0x3a')],'as':_0x35a6('0x55')}]},_0x5820a5={};_0x5820a5[_0x35a6('0x42')]=_['keys'](db[_0x35a6('0x3c')][_0x35a6('0x3d')]);_0x5820a5[_0x35a6('0x3e')]=_['keys'](_0x5e0941['query']);_0x5820a5[_0x35a6('0x40')]=_[_0x35a6('0x41')](_0x5820a5[_0x35a6('0x42')],_0x5820a5[_0x35a6('0x3e')]);_0x307c36['attributes']=_[_0x35a6('0x41')](_0x5820a5[_0x35a6('0x42')],qs[_0x35a6('0x43')](_0x5e0941[_0x35a6('0x3e')]['fields']));_0x307c36[_0x35a6('0x44')]=_0x307c36['attributes']['length']?_0x307c36['attributes']:_0x5820a5['model'];if(_0x5e0941[_0x35a6('0x3e')][_0x35a6('0x51')]){_0x307c36[_0x35a6('0x52')]=[{'all':!![]}];}_0x307c36=_['merge']({},_0x307c36,_0x5e0941[_0x35a6('0x50')]);return db[_0x35a6('0x3c')]['find'](_0x307c36)[_0x35a6('0x1e')](handleEntityNotFound(_0x55753d,null))['then'](respondWithResult(_0x55753d,null))[_0x35a6('0x28')](handleError(_0x55753d,null));};exports['create']=function(_0x2e6c,_0x2ba409){return db[_0x35a6('0x3c')][_0x35a6('0x56')](_0x2e6c[_0x35a6('0x57')],{})[_0x35a6('0x1e')](function(_0x392eb9){var _0x4a7319=_0x2e6c[_0x35a6('0x58')][_0x35a6('0x35')]({'plain':!![]});if(!_0x4a7319)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a7319[_0x35a6('0x59')]===_0x35a6('0x58')){var _0x17a9f8=_0x392eb9[_0x35a6('0x35')]({'plain':!![]});var _0x25735d=_0x35a6('0x5a');return db[_0x35a6('0x5b')][_0x35a6('0x5c')]({'where':{'name':_0x25735d,'userProfileId':_0x4a7319['userProfileId']},'raw':!![]})[_0x35a6('0x1e')](function(_0x52f898){if(_0x52f898&&_0x52f898[_0x35a6('0x5d')]===0x0){return db[_0x35a6('0x5e')][_0x35a6('0x56')]({'name':_0x17a9f8[_0x35a6('0x38')],'resourceId':_0x17a9f8['id'],'type':_0x52f898[_0x35a6('0x38')],'sectionId':_0x52f898['id']},{})[_0x35a6('0x1e')](function(){return _0x392eb9;});}else{return _0x392eb9;}})[_0x35a6('0x28')](function(_0x1750e7){logger[_0x35a6('0x24')](_0x35a6('0x5f'),_0x1750e7);throw _0x1750e7;});}return _0x392eb9;})[_0x35a6('0x1e')](respondWithResult(_0x2ba409,0xc9))[_0x35a6('0x28')](handleError(_0x2ba409,null));};exports[_0x35a6('0x33')]=function(_0x5299fc,_0x5b029d){if(_0x5299fc[_0x35a6('0x57')]['id']){delete _0x5299fc[_0x35a6('0x57')]['id'];}return db[_0x35a6('0x3c')][_0x35a6('0x5c')]({'where':{'id':_0x5299fc[_0x35a6('0x60')]['id']},'include':[{'model':db[_0x35a6('0x3a')],'as':_0x35a6('0x55')}]})[_0x35a6('0x1e')](handleEntityNotFound(_0x5b029d,null))[_0x35a6('0x1e')](saveUpdates(_0x5299fc['body'],null))[_0x35a6('0x1e')](respondWithResult(_0x5b029d,null))[_0x35a6('0x28')](handleError(_0x5b029d,null));};exports['destroy']=function(_0x6ff7da,_0x31e664){return db[_0x35a6('0x3c')][_0x35a6('0x5c')]({'where':{'id':_0x6ff7da[_0x35a6('0x60')]['id']}})[_0x35a6('0x1e')](handleEntityNotFound(_0x31e664,null))['then'](removeEntity(_0x31e664,null))[_0x35a6('0x28')](handleError(_0x31e664,null));};exports[_0x35a6('0x61')]=function(_0x73d521,_0x2a2729){return db['OpenchannelAccount'][_0x35a6('0x61')]()[_0x35a6('0x1e')](respondWithResult(_0x2a2729,null))[_0x35a6('0x28')](handleError(_0x2a2729,null));};exports[_0x35a6('0x62')]=function(_0xcce5f4,_0x26d405,_0x282069){if(_0xcce5f4[_0x35a6('0x57')]['id']){delete _0xcce5f4['body']['id'];}return db[_0x35a6('0x3c')][_0x35a6('0x5c')]({'where':{'id':_0xcce5f4[_0x35a6('0x60')]['id']}})[_0x35a6('0x1e')](handleEntityNotFound(_0x26d405,null))[_0x35a6('0x1e')](function(_0x45acc0){if(_0x45acc0){_0xcce5f4[_0x35a6('0x57')][_0x35a6('0x63')]=_0x45acc0['id'];return db['Disposition'][_0x35a6('0x56')](_0xcce5f4[_0x35a6('0x57')]);}})[_0x35a6('0x1e')](respondWithResult(_0x26d405,null))['catch'](handleError(_0x26d405,null));};exports[_0x35a6('0x64')]=function(_0x3a9844,_0x12e978,_0x1276d7){var _0x2b9993={'raw':![],'where':{}};var _0x485f06={};var _0x479a5f={'count':0x0,'rows':[]};return db[_0x35a6('0x3c')][_0x35a6('0x65')]({'where':{'id':_0x3a9844[_0x35a6('0x60')]['id']}})[_0x35a6('0x1e')](handleEntityNotFound(_0x12e978,null))[_0x35a6('0x1e')](function(_0x27912d){if(_0x27912d){_0x485f06[_0x35a6('0x42')]=_[_0x35a6('0x3f')](db[_0x35a6('0x66')][_0x35a6('0x3d')]);_0x485f06[_0x35a6('0x3e')]=_[_0x35a6('0x3f')](_0x3a9844[_0x35a6('0x3e')]);_0x485f06[_0x35a6('0x40')]=_[_0x35a6('0x41')](_0x485f06[_0x35a6('0x42')],_0x485f06[_0x35a6('0x3e')]);_0x2b9993[_0x35a6('0x44')]=_['intersection'](_0x485f06[_0x35a6('0x42')],qs[_0x35a6('0x43')](_0x3a9844[_0x35a6('0x3e')][_0x35a6('0x43')]));_0x2b9993['attributes']=_0x2b9993['attributes'][_0x35a6('0x45')]?_0x2b9993[_0x35a6('0x44')]:_0x485f06[_0x35a6('0x42')];if(!_0x3a9844[_0x35a6('0x3e')][_0x35a6('0x46')](_0x35a6('0x47'))){_0x2b9993['limit']=qs['limit'](_0x3a9844[_0x35a6('0x3e')][_0x35a6('0x2f')]);_0x2b9993[_0x35a6('0x2c')]=qs[_0x35a6('0x2c')](_0x3a9844[_0x35a6('0x3e')][_0x35a6('0x2c')]);}_0x2b9993[_0x35a6('0x48')]=qs[_0x35a6('0x49')](_0x3a9844['query']['sort']);_0x2b9993[_0x35a6('0x4a')]=qs[_0x35a6('0x40')](_[_0x35a6('0x4b')](_0x3a9844['query'],_0x485f06[_0x35a6('0x40')]));_0x2b9993['where'][_0x35a6('0x63')]=_0x27912d['id'];if(_0x3a9844['query'][_0x35a6('0x4c')]){_0x2b9993[_0x35a6('0x4a')]=_['merge'](_0x2b9993[_0x35a6('0x4a')],{'$or':_[_0x35a6('0x3b')](_0x2b9993[_0x35a6('0x44')],function(_0x363ee2){var _0x38763c={};_0x38763c[_0x363ee2]={'$like':'%'+_0x3a9844[_0x35a6('0x3e')]['filter']+'%'};return _0x38763c;})});}_0x2b9993=_[_0x35a6('0x4d')]({},_0x2b9993,_0x3a9844[_0x35a6('0x50')]);return db[_0x35a6('0x66')]['count']({'where':_0x2b9993['where']})[_0x35a6('0x1e')](function(_0x6029ff){_0x479a5f[_0x35a6('0x2e')]=_0x6029ff;if(_0x3a9844['query'][_0x35a6('0x51')]){_0x2b9993['include']=[{'all':!![]}];}return db[_0x35a6('0x66')][_0x35a6('0x53')](_0x2b9993);})[_0x35a6('0x1e')](function(_0x439b06){_0x479a5f[_0x35a6('0x54')]=_0x439b06;return _0x479a5f;});}})['then'](respondWithFilteredResult(_0x12e978,_0x2b9993))[_0x35a6('0x28')](handleError(_0x12e978,null));};exports['removeDispositions']=function(_0x522a91,_0x45e77a,_0x3d25fb){return db[_0x35a6('0x3c')][_0x35a6('0x5c')]({'where':{'id':_0x522a91['params']['id']}})['then'](handleEntityNotFound(_0x45e77a,null))[_0x35a6('0x1e')](function(_0x2275de){if(_0x2275de){return _0x2275de[_0x35a6('0x67')](_0x522a91['query']['ids']);}})[_0x35a6('0x1e')](respondWithStatusCode(_0x45e77a,null))[_0x35a6('0x28')](handleError(_0x45e77a,null));};exports['addAnswer']=function(_0x179a22,_0x49614e,_0x19bba5){if(_0x179a22[_0x35a6('0x57')]['id']){delete _0x179a22[_0x35a6('0x57')]['id'];}return db[_0x35a6('0x3c')][_0x35a6('0x5c')]({'where':{'id':_0x179a22[_0x35a6('0x60')]['id']}})['then'](handleEntityNotFound(_0x49614e,null))[_0x35a6('0x1e')](function(_0x2d8406){if(_0x2d8406){_0x179a22[_0x35a6('0x57')][_0x35a6('0x63')]=_0x2d8406['id'];return db[_0x35a6('0x68')][_0x35a6('0x56')](_0x179a22[_0x35a6('0x57')]);}})[_0x35a6('0x1e')](respondWithResult(_0x49614e,null))[_0x35a6('0x28')](handleError(_0x49614e,null));};exports['getAnswers']=function(_0x5868c5,_0x309153,_0x2c6fdf){var _0x46eed3={'raw':![],'where':{}};var _0x1f33fe={};var _0x5c37e8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x35a6('0x65')]({'where':{'id':_0x5868c5[_0x35a6('0x60')]['id']}})[_0x35a6('0x1e')](handleEntityNotFound(_0x309153,null))[_0x35a6('0x1e')](function(_0x55c1dd){if(_0x55c1dd){_0x1f33fe['model']=_[_0x35a6('0x3f')](db[_0x35a6('0x68')][_0x35a6('0x3d')]);_0x1f33fe[_0x35a6('0x3e')]=_[_0x35a6('0x3f')](_0x5868c5['query']);_0x1f33fe[_0x35a6('0x40')]=_[_0x35a6('0x41')](_0x1f33fe['model'],_0x1f33fe[_0x35a6('0x3e')]);_0x46eed3['attributes']=_[_0x35a6('0x41')](_0x1f33fe['model'],qs[_0x35a6('0x43')](_0x5868c5[_0x35a6('0x3e')][_0x35a6('0x43')]));_0x46eed3['attributes']=_0x46eed3[_0x35a6('0x44')]['length']?_0x46eed3[_0x35a6('0x44')]:_0x1f33fe[_0x35a6('0x42')];if(!_0x5868c5[_0x35a6('0x3e')][_0x35a6('0x46')](_0x35a6('0x47'))){_0x46eed3['limit']=qs[_0x35a6('0x2f')](_0x5868c5[_0x35a6('0x3e')]['limit']);_0x46eed3[_0x35a6('0x2c')]=qs[_0x35a6('0x2c')](_0x5868c5[_0x35a6('0x3e')][_0x35a6('0x2c')]);}_0x46eed3[_0x35a6('0x48')]=qs[_0x35a6('0x49')](_0x5868c5[_0x35a6('0x3e')][_0x35a6('0x49')]);_0x46eed3['where']=qs[_0x35a6('0x40')](_[_0x35a6('0x4b')](_0x5868c5[_0x35a6('0x3e')],_0x1f33fe['filters']));_0x46eed3[_0x35a6('0x4a')][_0x35a6('0x63')]=_0x55c1dd['id'];if(_0x5868c5[_0x35a6('0x3e')][_0x35a6('0x4c')]){_0x46eed3[_0x35a6('0x4a')]=_[_0x35a6('0x4d')](_0x46eed3[_0x35a6('0x4a')],{'$or':_[_0x35a6('0x3b')](_0x46eed3[_0x35a6('0x44')],function(_0x3dee4b){var _0x5c4639={};_0x5c4639[_0x3dee4b]={'$like':'%'+_0x5868c5[_0x35a6('0x3e')][_0x35a6('0x4c')]+'%'};return _0x5c4639;})});}_0x46eed3=_[_0x35a6('0x4d')]({},_0x46eed3,_0x5868c5['options']);return db[_0x35a6('0x68')][_0x35a6('0x2e')]({'where':_0x46eed3[_0x35a6('0x4a')]})[_0x35a6('0x1e')](function(_0x46a24f){_0x5c37e8[_0x35a6('0x2e')]=_0x46a24f;if(_0x5868c5[_0x35a6('0x3e')][_0x35a6('0x51')]){_0x46eed3['include']=[{'all':!![]}];}return db[_0x35a6('0x68')][_0x35a6('0x53')](_0x46eed3);})[_0x35a6('0x1e')](function(_0x5cf7a1){_0x5c37e8[_0x35a6('0x54')]=_0x5cf7a1;return _0x5c37e8;});}})['then'](respondWithFilteredResult(_0x309153,_0x46eed3))[_0x35a6('0x28')](handleError(_0x309153,null));};exports['removeAnswers']=function(_0x5b8855,_0x57dcac,_0x4c1234){return db[_0x35a6('0x3c')][_0x35a6('0x5c')]({'where':{'id':_0x5b8855['params']['id']}})[_0x35a6('0x1e')](handleEntityNotFound(_0x57dcac,null))[_0x35a6('0x1e')](function(_0x384f90){if(_0x384f90){return _0x384f90[_0x35a6('0x69')](_0x5b8855[_0x35a6('0x3e')][_0x35a6('0x6a')]);}})[_0x35a6('0x1e')](respondWithStatusCode(_0x57dcac,null))['catch'](handleError(_0x57dcac,null));};exports[_0x35a6('0x6b')]=function(_0x2b3a54,_0x22b697,_0x50deee){var _0x3484ad={'body':_0x2b3a54[_0x35a6('0x57')],'channel':_0x35a6('0x6c')};var _0x3a73a6=[];var _0xe4d01d=[];var _0x4c0202={};var _0x15b60d=![];return db[_0x35a6('0x6d')][_0x35a6('0x61')]()[_0x35a6('0x1e')](function(_0x142e39){if(!_0x142e39){throw new db['Sequelize'][(_0x35a6('0x6e'))](_0x35a6('0x6f'));}_0x3a73a6=_[_0x35a6('0x70')](_[_0x35a6('0x3f')](_0x142e39),['createdAt',_0x35a6('0x71')]);_0xe4d01d=_['difference'](_[_0x35a6('0x3f')](_0x142e39),[_0x35a6('0x72'),_0x35a6('0x71'),_0x35a6('0x73'),_0x35a6('0x74')]);if(_0x2b3a54['body']['id']){delete _0x2b3a54['body']['id'];}if(_[_0x35a6('0x75')](_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x76')])){throw new db[(_0x35a6('0x77'))][(_0x35a6('0x6e'))](_0x35a6('0x78'));}if(_['isNil'](_0x2b3a54['body'][_0x35a6('0x57')])||_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x57')]===''){throw new db[(_0x35a6('0x77'))][(_0x35a6('0x6e'))](_0x35a6('0x79'));}if(_[_0x35a6('0x75')](_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x7a')])){throw new db[(_0x35a6('0x77'))][(_0x35a6('0x6e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe4d01d);}if(!_[_0x35a6('0x7b')](_0xe4d01d,_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x7a')])){throw new db[(_0x35a6('0x77'))][(_0x35a6('0x6e'))](_0x35a6('0x7c')+_0xe4d01d);}_0x4c0202[_0x2b3a54[_0x35a6('0x57')]['mapKey']]=_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x76')];})['then'](function(){return db[_0x35a6('0x3c')][_0x35a6('0x5c')]({'where':{'id':_0x2b3a54['params']['id']},'include':[{'model':db[_0x35a6('0x7d')],'as':_0x35a6('0x7e'),'include':[{'model':db[_0x35a6('0x6d')],'as':_0x35a6('0x7f'),'where':_0x4c0202,'limit':0x1,'order':[[_0x35a6('0x71'),'DESC']]}]},{'model':db[_0x35a6('0x80')],'as':_0x35a6('0x81')}]});})[_0x35a6('0x1e')](handleEntityNotFound(_0x22b697,null))['then'](function(_0x40d239){if(_0x40d239&&_0x40d239[_0x35a6('0x7e')]){_0x3484ad[_0x35a6('0x82')]=_0x40d239;_0x3484ad[_0x35a6('0x83')]=_0x40d239['Applications'];_0x3484ad[_0x35a6('0x84')]=_0x40d239['List'];_0x3484ad[_0x35a6('0x83')]=_[_0x35a6('0x85')](_0x3484ad[_0x35a6('0x83')],[_0x35a6('0x86')],[_0x35a6('0x87')]);if(_0x3484ad[_0x35a6('0x82')][_0x35a6('0x81')]){delete _0x3484ad[_0x35a6('0x82')][_0x35a6('0x81')];}if(_0x3484ad[_0x35a6('0x82')][_0x35a6('0x7e')]&&_0x3484ad['account'][_0x35a6('0x7e')]['Contacts'][_0x35a6('0x45')]){return _0x3484ad[_0x35a6('0x82')][_0x35a6('0x7e')][_0x35a6('0x7f')][0x0];}var _0x1e81b4=_[_0x35a6('0x16')](_0x2b3a54[_0x35a6('0x57')],{'firstName':_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x76')],'ListId':_0x40d239['ListId']});_0x1e81b4[_0x2b3a54[_0x35a6('0x57')]['mapKey']]=_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x76')];return db['CmContact'][_0x35a6('0x56')](_0x1e81b4,{'fields':_0x3a73a6,'raw':!![]});}})[_0x35a6('0x1e')](handleEntityNotFound(_0x22b697,null))[_0x35a6('0x1e')](function(_0x1c8040){_0x3484ad['contact']=_0x1c8040;if(_0x1c8040){var _0x4e4aea={'ContactId':_0x1c8040['id'],'OpenchannelAccountId':_0x2b3a54['params']['id'],'from':(_0x1c8040[_0x35a6('0x88')]||'')+'\x20'+(_0x1c8040['lastName']||'')};var _0x33d4e4={'OpenchannelAccountId':_0x2b3a54[_0x35a6('0x60')]['id'],'closed':![]};if(_0x2b3a54['body'][_0x35a6('0x89')]){_0x33d4e4['threadId']=_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x89')];return db[_0x35a6('0x8a')][_0x35a6('0x5c')]({'where':_0x33d4e4})[_0x35a6('0x1e')](function(_0xbe34dc){if(_0xbe34dc){return[_0xbe34dc,![]];}_0x4e4aea['threadId']=_0x2b3a54[_0x35a6('0x57')]['threadId'];_0x4e4aea['externalUrl']=_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x8b')];return db[_0x35a6('0x8a')][_0x35a6('0x56')](_0x4e4aea)[_0x35a6('0x1e')](function(_0x5ac478){return[_0x5ac478,!![]];});});}else{_0x33d4e4['threadId']=null;}_0x33d4e4[_0x35a6('0x8c')]=_0x1c8040['id'];return db[_0x35a6('0x8a')][_0x35a6('0x5c')]({'where':_0x33d4e4})[_0x35a6('0x1e')](function(_0x100f22){if(_0x100f22){return[_0x100f22,![]];}return db[_0x35a6('0x8a')]['create'](_0x4e4aea)[_0x35a6('0x1e')](function(_0x27e19a){return[_0x27e19a,!![]];});});}})[_0x35a6('0x8d')](function(_0x2bdc7e,_0xce3fef){if(_0x2bdc7e){_0x15b60d=_0xce3fef;if(!_0xce3fef){var _0x2af1d0={'from':(_0x3484ad[_0x35a6('0x8e')][_0x35a6('0x88')]||'')+'\x20'+(_0x3484ad['contact'][_0x35a6('0x8f')]||'')};if(_0x2b3a54[_0x35a6('0x57')]['threadId']&&_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x90')]&&_0x2b3a54['body'][_0x35a6('0x89')]!=_0x2b3a54[_0x35a6('0x57')]['messageId']){_0x2af1d0['threadId']=_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x90')];}return _0x2bdc7e[_0x35a6('0x33')](_0x2af1d0);}else{return _0x2bdc7e;}}})[_0x35a6('0x1e')](function(_0x528462){_0x3484ad[_0x35a6('0x91')]=_0x528462[_0x35a6('0x35')]({'plain':!![]});_0x3484ad[_0x35a6('0x91')][_0x35a6('0x92')]=_0x15b60d;if(_0x3484ad['interaction']['created']){if(_0x3484ad[_0x35a6('0x82')][_0x35a6('0x93')]){_0x3484ad[_0x35a6('0x83')][_0x35a6('0x94')]({'id':0x0,'priority':_0x3484ad['applications'][_0x35a6('0x45')]+0x1,'app':_0x35a6('0x95'),'appdata':_0x35a6('0x96'),'interval':'*,*,*,*'});}}return db[_0x35a6('0x97')][_0x35a6('0x56')]({'body':_0x2b3a54['body'][_0x35a6('0x57')],'OpenchannelAccountId':_0x2b3a54[_0x35a6('0x60')]['id'],'OpenchannelInteractionId':_0x528462['id'],'direction':'in','ContactId':_0x3484ad[_0x35a6('0x8e')]['id'],'AttachmentId':_0x2b3a54[_0x35a6('0x57')][_0x35a6('0x98')]});})[_0x35a6('0x1e')](function(_0x4ed2e3){_0x3484ad[_0x35a6('0x26')]=_0x4ed2e3;if(!_0x3484ad[_0x35a6('0x91')][_0x35a6('0x99')])return;return db[_0x35a6('0x9a')]['find']({'attributes':['id','name'],'where':{'id':_0x3484ad[_0x35a6('0x91')]['UserId']}});})[_0x35a6('0x1e')](function(_0x4407f9){if(_0x4407f9){_0x3484ad[_0x35a6('0x83')][_0x35a6('0x9b')]({'id':0x0,'priority':0x0,'app':_0x35a6('0x9c'),'appdata':_0x4407f9[_0x35a6('0x38')]+','+(_0x3484ad[_0x35a6('0x82')][_0x35a6('0x9d')]||0xa),'interval':_0x35a6('0x9e')});}if(!_0x3484ad[_0x35a6('0x91')][_0x35a6('0x9f')])return;return db['OpenchannelQueue']['find']({'attributes':['id','name'],'where':{'id':_0x3484ad[_0x35a6('0x91')][_0x35a6('0x9f')]}});})[_0x35a6('0x1e')](function(_0x58bddc){if(_0x58bddc){_0x3484ad[_0x35a6('0x83')][_0x35a6('0x9b')]({'id':0x0,'priority':0x1,'app':_0x35a6('0xa0'),'appdata':_0x58bddc[_0x35a6('0x38')]+','+(_0x3484ad[_0x35a6('0x82')][_0x35a6('0xa1')]||0x12c),'interval':_0x35a6('0x9e')});}return respondWithRpcPromise('Start','startRouting',_0x3484ad);})[_0x35a6('0x1e')](function(_0x52bbe4){respondWithRpcPromise(_0x35a6('0xa2'),_0x35a6('0xa2'),{'event':_0x35a6('0x6b'),'message':_0x52bbe4},client9002);return _0x52bbe4;})['then'](respondWithResult(_0x22b697,null))['catch'](handleError(_0x22b697,null));};exports[_0x35a6('0xa3')]=function(_0xd4120e,_0x27ec71){var _0x237251=_0xd4120e[_0x35a6('0x60')]['id'];var _0x44d9b1=_0xd4120e[_0x35a6('0x57')];var _0x24e74d=0xc8;var _0x1b926d=null;return db[_0x35a6('0xa4')][_0x35a6('0xa5')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x35a6('0xa6')]},function(_0x48469f){return db[_0x35a6('0x3c')][_0x35a6('0x65')]({'where':{'id':_0x237251},'transaction':_0x48469f})[_0x35a6('0x1e')](function(_0x5229ad){if(_0x5229ad){return db['OpenchannelApplication'][_0x35a6('0x34')]({'where':{'OpenchannelAccountId':_0x237251},'transaction':_0x48469f})['then'](function(){var _0x265a9e=_[_0x35a6('0x3b')](_0x44d9b1,function(_0xa46c63){_0xa46c63[_0x35a6('0x63')]=_0x237251;return _0xa46c63;});return db['OpenchannelApplication'][_0x35a6('0xa7')](_0x265a9e,{'transaction':_0x48469f});});}else{_0x24e74d=0x194;_0x1b926d=[];}});})[_0x35a6('0x1e')](function(){if(_0x24e74d!==0x194){return db[_0x35a6('0x80')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x237251},'order':'priority'})[_0x35a6('0x1e')](function(_0x450058){_0x1b926d=_0x450058;});}})[_0x35a6('0x28')](function(_0x535dca){_0x24e74d=0x1f4;logger[_0x35a6('0x24')](_0x535dca[_0x35a6('0x37')]);if(_0x535dca[_0x35a6('0x38')]){delete _0x535dca[_0x35a6('0x38')];}_0x1b926d=_0x535dca;})[_0x35a6('0xa8')](function(){if(_0x1b926d===null){_0x27ec71[_0x35a6('0x36')](_0x24e74d);}else{if(_0x24e74d===0x1f4){_0x27ec71[_0x35a6('0x29')](_0x24e74d)['send'](_0x1b926d);}else{_0x27ec71[_0x35a6('0x29')](_0x24e74d)[_0x35a6('0x2b')](_0x1b926d);}}});};exports[_0x35a6('0xa9')]=function(_0x161a35,_0x2899c8,_0x5efb74){var _0x34101b={};var _0x43cd64={};var _0x2a0e22;var _0x5805ac;return db[_0x35a6('0x3c')][_0x35a6('0x65')]({'where':{'id':_0x161a35[_0x35a6('0x60')]['id']}})[_0x35a6('0x1e')](handleEntityNotFound(_0x2899c8,null))['then'](function(_0x103425){if(_0x103425){_0x2a0e22=_0x103425;_0x43cd64[_0x35a6('0x42')]=_['keys'](db[_0x35a6('0x80')]['rawAttributes']);_0x43cd64['query']=_[_0x35a6('0x3f')](_0x161a35['query']);_0x43cd64[_0x35a6('0x40')]=_[_0x35a6('0x41')](_0x43cd64[_0x35a6('0x42')],_0x43cd64['query']);_0x34101b[_0x35a6('0x44')]=_[_0x35a6('0x41')](_0x43cd64[_0x35a6('0x42')],qs[_0x35a6('0x43')](_0x161a35['query'][_0x35a6('0x43')]));_0x34101b[_0x35a6('0x44')]=_0x34101b[_0x35a6('0x44')][_0x35a6('0x45')]?_0x34101b['attributes']:_0x43cd64[_0x35a6('0x42')];_0x34101b['order']=qs['sort'](_0x161a35[_0x35a6('0x3e')][_0x35a6('0x49')]);_0x34101b['where']=qs['filters'](_[_0x35a6('0x4b')](_0x161a35[_0x35a6('0x3e')],_0x43cd64[_0x35a6('0x40')]));if(_0x161a35[_0x35a6('0x3e')]['filter']){_0x34101b['where']=_['merge'](_0x34101b[_0x35a6('0x4a')],{'$or':_['map'](_0x34101b[_0x35a6('0x44')],function(_0x17cfd7){var _0x523445={};_0x523445[_0x17cfd7]={'$like':'%'+_0x161a35[_0x35a6('0x3e')][_0x35a6('0x4c')]+'%'};return _0x523445;})});}_0x34101b=_[_0x35a6('0x4d')]({},_0x34101b,_0x161a35[_0x35a6('0x50')]);return _0x2a0e22['getApplications'](_0x34101b);}})[_0x35a6('0x1e')](function(_0x2c64f3){if(_0x2c64f3){_0x5805ac=_0x2c64f3[_0x35a6('0x45')];if(!_0x161a35[_0x35a6('0x3e')][_0x35a6('0x46')](_0x35a6('0x47'))){_0x34101b[_0x35a6('0x2f')]=qs[_0x35a6('0x2f')](_0x161a35[_0x35a6('0x3e')][_0x35a6('0x2f')]);_0x34101b['offset']=qs[_0x35a6('0x2c')](_0x161a35[_0x35a6('0x3e')][_0x35a6('0x2c')]);}return _0x2a0e22[_0x35a6('0xa9')](_0x34101b);}})[_0x35a6('0x1e')](function(_0x22cabd){if(_0x22cabd){return _0x22cabd?{'count':_0x5805ac,'rows':_0x22cabd}:null;}})[_0x35a6('0x1e')](respondWithResult(_0x2899c8,null))['catch'](handleError(_0x2899c8,null));};exports[_0x35a6('0xaa')]=function(_0x4eccff,_0x17532f,_0x398c23){var _0x3f9b69={'raw':![],'where':{}};var _0x27f821={};var _0x5e87db={'count':0x0,'rows':[]};return db[_0x35a6('0x3c')][_0x35a6('0x65')]({'where':{'id':_0x4eccff[_0x35a6('0x60')]['id']}})[_0x35a6('0x1e')](handleEntityNotFound(_0x17532f,null))[_0x35a6('0x1e')](function(_0x22f99c){if(_0x22f99c){_0x27f821[_0x35a6('0x42')]=_[_0x35a6('0x3f')](db[_0x35a6('0x8a')]['rawAttributes']);_0x27f821[_0x35a6('0x3e')]=_[_0x35a6('0x3f')](_0x4eccff[_0x35a6('0x3e')]);_0x27f821[_0x35a6('0x40')]=_[_0x35a6('0x41')](_0x27f821[_0x35a6('0x42')],_0x27f821[_0x35a6('0x3e')]);_0x3f9b69[_0x35a6('0x44')]=_['intersection'](_0x27f821[_0x35a6('0x42')],qs[_0x35a6('0x43')](_0x4eccff[_0x35a6('0x3e')][_0x35a6('0x43')]));_0x3f9b69[_0x35a6('0x44')]=_0x3f9b69['attributes'][_0x35a6('0x45')]?_0x3f9b69['attributes']:_0x27f821[_0x35a6('0x42')];if(!_0x4eccff['query'][_0x35a6('0x46')]('nolimit')){_0x3f9b69[_0x35a6('0x2f')]=qs['limit'](_0x4eccff[_0x35a6('0x3e')][_0x35a6('0x2f')]);_0x3f9b69[_0x35a6('0x2c')]=qs[_0x35a6('0x2c')](_0x4eccff[_0x35a6('0x3e')]['offset']);}_0x3f9b69['order']=qs[_0x35a6('0x49')](_0x4eccff['query'][_0x35a6('0x49')]);_0x3f9b69[_0x35a6('0x4a')]=qs[_0x35a6('0x40')](_[_0x35a6('0x4b')](_0x4eccff['query'],_0x27f821[_0x35a6('0x40')]));_0x3f9b69[_0x35a6('0x4a')][_0x35a6('0x63')]=_0x22f99c['id'];if(_0x4eccff['query'][_0x35a6('0x4c')]){_0x3f9b69['where']=_[_0x35a6('0x4d')](_0x3f9b69['where'],{'$or':_[_0x35a6('0x3b')](_0x3f9b69['attributes'],function(_0x967d29){var _0x39fb0e={};_0x39fb0e[_0x967d29]={'$like':'%'+_0x4eccff[_0x35a6('0x3e')][_0x35a6('0x4c')]+'%'};return _0x39fb0e;})});}_0x3f9b69=_['merge']({},_0x3f9b69,_0x4eccff[_0x35a6('0x50')]);return db[_0x35a6('0x8a')]['count']({'where':_0x3f9b69[_0x35a6('0x4a')]})[_0x35a6('0x1e')](function(_0x38f056){_0x5e87db['count']=_0x38f056;if(_0x4eccff['query'][_0x35a6('0x51')]){_0x3f9b69[_0x35a6('0x52')]=[{'model':db['CmContact'],'as':_0x35a6('0xab'),'required':![]},{'model':db[_0x35a6('0x9a')],'as':'Owner','attributes':[_0x35a6('0x38'),_0x35a6('0xac'),_0x35a6('0xad')],'required':![]},{'model':db[_0x35a6('0xae')],'as':_0x35a6('0xaf'),'attributes':['id',_0x35a6('0x38'),_0x35a6('0xb0')],'where':_0x4eccff['query'][_0x35a6('0xb1')]?{'id':_0x4eccff['query']['tag']}:undefined,'required':_0x4eccff[_0x35a6('0x3e')][_0x35a6('0xb1')]?!![]:![]}];}return db[_0x35a6('0x8a')]['findAll'](_0x3f9b69);})[_0x35a6('0x1e')](function(_0x4b86ba){_0x5e87db[_0x35a6('0x54')]=_0x4b86ba;return _0x5e87db;});}})[_0x35a6('0x1e')](respondWithFilteredResult(_0x17532f,_0x3f9b69))['catch'](handleError(_0x17532f,null));};exports[_0x35a6('0xb2')]=function(_0x52d60e,_0x27a54a,_0x2bd405){return db[_0x35a6('0x3c')][_0x35a6('0x5c')]({'where':{'id':_0x52d60e[_0x35a6('0x60')]['id']}})['then'](handleEntityNotFound(_0x27a54a,null))[_0x35a6('0x1e')](function(_0x176b56){if(_0x176b56){return _0x176b56[_0x35a6('0xb2')](_0x52d60e[_0x35a6('0x57')][_0x35a6('0x6a')],_[_0x35a6('0xb3')](_0x52d60e[_0x35a6('0x57')],[_0x35a6('0x6a'),'id'])||{})[_0x35a6('0x8d')](function(_0x2f44c4){for(var _0x2fca54=0x0;_0x2fca54<_0x52d60e[_0x35a6('0x57')][_0x35a6('0x6a')][_0x35a6('0x45')];_0x2fca54+=0x1){socket[_0x35a6('0xb4')](_0x35a6('0xb5'),{'UserId':Number(_0x52d60e['body'][_0x35a6('0x6a')][_0x2fca54]),'OpenchannelAccountId':Number(_0x52d60e[_0x35a6('0x60')]['id'])});}return _0x2f44c4;});}})['then'](respondWithResult(_0x27a54a,null))['catch'](handleError(_0x27a54a,null));};exports[_0x35a6('0xb6')]=function(_0x96b420,_0x4b18b8,_0x76006c){return db['OpenchannelAccount']['find']({'where':{'id':_0x96b420[_0x35a6('0x60')]['id']}})['then'](handleEntityNotFound(_0x4b18b8,null))[_0x35a6('0x1e')](function(_0x4c7829){if(_0x4c7829){return _0x4c7829[_0x35a6('0xb6')](_0x96b420['query']['ids'])[_0x35a6('0x1e')](function(){if(_[_0x35a6('0xb7')](_0x96b420['query'][_0x35a6('0x6a')])){for(var _0x432dcc=0x0;_0x432dcc<_0x96b420[_0x35a6('0x3e')][_0x35a6('0x6a')]['length'];_0x432dcc+=0x1){socket[_0x35a6('0xb4')](_0x35a6('0xb8'),{'UserId':Number(_0x96b420[_0x35a6('0x3e')][_0x35a6('0x6a')][_0x432dcc]),'OpenchannelAccountId':Number(_0x96b420[_0x35a6('0x60')]['id'])});}}else{socket['emit'](_0x35a6('0xb8'),{'UserId':Number(_0x96b420['query'][_0x35a6('0x6a')]),'OpenchannelAccountId':Number(_0x96b420[_0x35a6('0x60')]['id'])});}});}})[_0x35a6('0x1e')](respondWithStatusCode(_0x4b18b8,null))[_0x35a6('0x28')](handleError(_0x4b18b8,null));};exports[_0x35a6('0xb9')]=function(_0x2eb149,_0x3f1001,_0x5e7c2b){var _0x5b3819={};var _0x4c4738={};var _0x5069b6;var _0x5357a9;return db[_0x35a6('0x3c')][_0x35a6('0x65')]({'where':{'id':_0x2eb149[_0x35a6('0x60')]['id']}})[_0x35a6('0x1e')](handleEntityNotFound(_0x3f1001,null))[_0x35a6('0x1e')](function(_0x47834f){if(_0x47834f){_0x5069b6=_0x47834f;_0x4c4738['model']=_[_0x35a6('0x3f')](db['User'][_0x35a6('0x3d')]);_0x4c4738[_0x35a6('0x3e')]=_[_0x35a6('0x3f')](_0x2eb149[_0x35a6('0x3e')]);_0x4c4738[_0x35a6('0x40')]=_[_0x35a6('0x41')](_0x4c4738[_0x35a6('0x42')],_0x4c4738[_0x35a6('0x3e')]);_0x5b3819[_0x35a6('0x44')]=_[_0x35a6('0x41')](_0x4c4738[_0x35a6('0x42')],qs[_0x35a6('0x43')](_0x2eb149[_0x35a6('0x3e')][_0x35a6('0x43')]));_0x5b3819[_0x35a6('0x44')]=_0x5b3819[_0x35a6('0x44')][_0x35a6('0x45')]?_0x5b3819[_0x35a6('0x44')]:_0x4c4738[_0x35a6('0x42')];_0x5b3819[_0x35a6('0x48')]=qs['sort'](_0x2eb149[_0x35a6('0x3e')][_0x35a6('0x49')]);_0x5b3819[_0x35a6('0x4a')]=qs[_0x35a6('0x40')](_[_0x35a6('0x4b')](_0x2eb149[_0x35a6('0x3e')],_0x4c4738['filters']));if(_0x2eb149[_0x35a6('0x3e')][_0x35a6('0x4c')]){_0x5b3819['where']=_['merge'](_0x5b3819[_0x35a6('0x4a')],{'$or':_[_0x35a6('0x3b')](_0x5b3819[_0x35a6('0x44')],function(_0x588414){var _0x1870ab={};_0x1870ab[_0x588414]={'$like':'%'+_0x2eb149[_0x35a6('0x3e')][_0x35a6('0x4c')]+'%'};return _0x1870ab;})});}_0x5b3819=_['merge']({},_0x5b3819,_0x2eb149[_0x35a6('0x50')]);return _0x5069b6[_0x35a6('0xb9')](_0x5b3819);}})[_0x35a6('0x1e')](function(_0x2b487a){if(_0x2b487a){_0x5357a9=_0x2b487a[_0x35a6('0x45')];if(!_0x2eb149[_0x35a6('0x3e')][_0x35a6('0x46')](_0x35a6('0x47'))){_0x5b3819['limit']=qs[_0x35a6('0x2f')](_0x2eb149[_0x35a6('0x3e')][_0x35a6('0x2f')]);_0x5b3819['offset']=qs[_0x35a6('0x2c')](_0x2eb149[_0x35a6('0x3e')][_0x35a6('0x2c')]);}return _0x5069b6['getAgents'](_0x5b3819);}})[_0x35a6('0x1e')](function(_0xbd3122){if(_0xbd3122){return _0xbd3122?{'count':_0x5357a9,'rows':_0xbd3122}:null;}})[_0x35a6('0x1e')](respondWithResult(_0x3f1001,null))[_0x35a6('0x28')](handleError(_0x3f1001,null));};exports[_0x35a6('0x39')]=function(_0x127378,_0x43ceb0,_0x389e3f){var _0x3caf1e,_0x25c731,_0x562a23;if(_[_0x35a6('0x75')](_0x127378[_0x35a6('0x57')][_0x35a6('0x57')])||_0x127378['body'][_0x35a6('0x57')]===''){throw new db[(_0x35a6('0x77'))][(_0x35a6('0x6e'))](_0x35a6('0x79'));}if(_[_0x35a6('0x75')](_0x127378[_0x35a6('0x57')]['to'])){}_0x3caf1e=_0x127378[_0x35a6('0x57')]['to'];return db[_0x35a6('0x3c')][_0x35a6('0x65')]({'where':{'id':_0x127378[_0x35a6('0x60')]['id']}})['then'](handleEntityNotFound(_0x43ceb0,null))[_0x35a6('0x1e')](function(_0x2957b9){if(_0x2957b9){return db[_0x35a6('0x3c')]['find']({'where':{'id':_0x2957b9['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x35a6('0x7f'),'where':{[_0x2957b9[_0x35a6('0x7a')]]:_0x3caf1e},'limit':0x1,'order':[[_0x35a6('0x71'),_0x35a6('0xba')]]}]}]})[_0x35a6('0x1e')](handleEntityNotFound(_0x43ceb0,null))['then'](function(_0x2f5b9f){if(_0x2f5b9f&&_0x2f5b9f[_0x35a6('0x7e')]){_0x25c731=_0x2f5b9f[_0x35a6('0x35')]({'plain':!![]});if(_0x25c731[_0x35a6('0x7e')]&&_0x25c731['List'][_0x35a6('0x7f')]['length']){return _0x25c731[_0x35a6('0x7e')]['Contacts'][0x0];}return db[_0x35a6('0x6d')][_0x35a6('0x56')](_[_0x35a6('0x16')](_0x127378[_0x35a6('0x57')],{'firstName':_0x3caf1e,[_0x2f5b9f[_0x35a6('0x7a')]]:_0x3caf1e,'phone':_0x3caf1e,'ListId':_0x25c731['ListId']}));}})[_0x35a6('0x1e')](handleEntityNotFound(_0x43ceb0,null))[_0x35a6('0x1e')](function(_0x2d1ecf){if(_0x2d1ecf){_0x562a23=_0x2d1ecf;return db[_0x35a6('0x8a')]['find']({'where':{'ContactId':_0x562a23['id'],'closed':![],'OpenchannelAccountId':_0x25c731['id']}})['then'](function(_0x5eaf5c){if(_0x5eaf5c){return[_0x5eaf5c,![]];}return db[_0x35a6('0x8a')][_0x35a6('0x56')]({'UserId':_0x127378[_0x35a6('0x58')]['id'],'ContactId':_0x562a23['id'],'OpenchannelAccountId':_0x25c731['id'],'lastMsgDirection':_0x35a6('0xbb'),'firstMsgDirection':_0x35a6('0xbb'),'Messages':[_[_0x35a6('0x4d')](_0x127378[_0x35a6('0x57')],{'read':![],'body':_0x127378[_0x35a6('0x57')][_0x35a6('0x57')],'OpenchannelAccountId':_0x25c731['id'],'UserId':_0x127378[_0x35a6('0x58')]['id'],'ContactId':_0x562a23['id']})]},{'include':[{'model':db[_0x35a6('0x97')],'as':'Messages'}]})[_0x35a6('0x1e')](function(_0x250b94){return[_0x250b94,!![]];});});}})[_0x35a6('0x8d')](function(_0x1278be,_0x1a510f){if(_0x1a510f){return _0x1278be;}return db['OpenchannelMessage']['create'](_[_0x35a6('0x4d')](_0x127378[_0x35a6('0x57')],{'read':![],'body':_0x127378[_0x35a6('0x57')][_0x35a6('0x57')],'OpenchannelAccountId':_0x25c731['id'],'OpenchannelInteractionId':_0x1278be['id'],'UserId':_0x127378['user']['id'],'ContactId':_0x562a23['id']}))[_0x35a6('0x1e')](function(_0x479988){_0x1278be[_0x35a6('0xbc')][_0x35a6('0xbd')]=[];_0x1278be['dataValues'][_0x35a6('0xbd')]['push'](_0x479988[_0x35a6('0xbc')]);return _0x1278be;});});}})[_0x35a6('0x1e')](respondWithResult(_0x43ceb0,null))[_0x35a6('0x28')](handleError(_0x43ceb0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 7d2cf38..32d216f 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 _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb903,0x185));var _0x3b90=function(_0x18080,_0x7c606a){_0x18080=_0x18080-0x0;var _0x43ece3=_0xb903[_0x18080];return _0x43ece3;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x0713=['exports','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x3071('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3071('0x1')](0x0);var events={'afterCreate':_0x3071('0x2'),'afterUpdate':_0x3071('0x3'),'afterDestroy':_0x3071('0x4')};function emitEvent(_0x52b5fb){return function(_0x2c547f,_0x7b18a4,_0x33a70c){OpenchannelAccountEvents[_0x3071('0x5')](_0x52b5fb+':'+_0x2c547f['id'],_0x2c547f);OpenchannelAccountEvents[_0x3071('0x5')](_0x52b5fb,_0x2c547f);_0x33a70c(null);};}for(var e in events){if(events[_0x3071('0x6')](e)){var event=events[e];OpenchannelAccount[_0x3071('0x7')](e,emitEvent(event));}}module[_0x3071('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 3aa288a..7358f0e 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(_0x4ee25d,_0x124ee0){var _0x3a9704=function(_0x473edb){while(--_0x473edb){_0x4ee25d['push'](_0x4ee25d['shift']());}};_0x3a9704(++_0x124ee0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x4889fa,_0x377c8a){var _0x3a91ac=function(_0x507f7a){while(--_0x507f7a){_0x4889fa['push'](_0x4889fa['shift']());}};_0x3a91ac(++_0x377c8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 3db70af..5a8fda0 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 _0x4ded=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x4ded,0x116));var _0xd4de=function(_0x1246a5,_0x560cac){_0x1246a5=_0x1246a5-0x0;var _0x5ad733=_0x4ded[_0x1246a5];return _0x5ad733;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});config[_0xd4de('0xd')]=_[_0xd4de('0xe')](config[_0xd4de('0xd')],{'host':_0xd4de('0xf'),'port':0x18eb});var socket=require(_0xd4de('0x10'))(new Redis(config['redis']));require(_0xd4de('0x11'))['register'](socket);function respondWithRpcPromise(_0x4ab822,_0x4b0876,_0x176b31){return new BPromise(function(_0x459a46,_0x4e5b10){return client['request'](_0x4ab822,_0x176b31)['then'](function(_0x29e265){logger['info'](_0xd4de('0x12'),_0x4b0876,_0xd4de('0x13'));logger[_0xd4de('0x14')](_0xd4de('0x15'),_0x4b0876,_0xd4de('0x13'),JSON[_0xd4de('0x16')](_0x29e265));if(_0x29e265[_0xd4de('0x17')]){if(_0x29e265[_0xd4de('0x17')][_0xd4de('0x18')]===0x1f4){logger[_0xd4de('0x17')](_0xd4de('0x12'),_0x4b0876,_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);return _0x4e5b10(_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);}logger[_0xd4de('0x17')](_0xd4de('0x12'),_0x4b0876,_0x29e265['error']['message']);return _0x459a46(_0x29e265[_0xd4de('0x17')][_0xd4de('0x19')]);}else{logger[_0xd4de('0x1a')](_0xd4de('0x12'),_0x4b0876,'request\x20sent');_0x459a46(_0x29e265['result'][_0xd4de('0x19')]);}})['catch'](function(_0xeaaefa){logger[_0xd4de('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b0876,_0xeaaefa);_0x4e5b10(_0xeaaefa);});});} \ No newline at end of file +var _0xb9a7=['catch','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x233675,_0xc6f7e0){var _0x15d123=function(_0x293327){while(--_0x293327){_0x233675['push'](_0x233675['shift']());}};_0x15d123(++_0xc6f7e0);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb9a7[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});config[_0x7b9a('0x9')]=_[_0x7b9a('0xa')](config[_0x7b9a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b9a('0xb'))(new Redis(config[_0x7b9a('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x47e220,_0x15bc5b,_0x31f3b7){return new BPromise(function(_0x4cf090,_0x32c85d){return client['request'](_0x47e220,_0x31f3b7)[_0x7b9a('0xc')](function(_0x597732){logger[_0x7b9a('0xd')](_0x7b9a('0xe'),_0x15bc5b,_0x7b9a('0xf'));logger['debug'](_0x7b9a('0x10'),_0x15bc5b,_0x7b9a('0xf'),JSON['stringify'](_0x597732));if(_0x597732[_0x7b9a('0x11')]){if(_0x597732[_0x7b9a('0x11')]['code']===0x1f4){logger[_0x7b9a('0x11')](_0x7b9a('0xe'),_0x15bc5b,_0x597732[_0x7b9a('0x11')][_0x7b9a('0x12')]);return _0x32c85d(_0x597732[_0x7b9a('0x11')][_0x7b9a('0x12')]);}logger[_0x7b9a('0x11')](_0x7b9a('0xe'),_0x15bc5b,_0x597732[_0x7b9a('0x11')]['message']);return _0x4cf090(_0x597732[_0x7b9a('0x11')]['message']);}else{logger[_0x7b9a('0xd')](_0x7b9a('0xe'),_0x15bc5b,_0x7b9a('0xf'));_0x4cf090(_0x597732[_0x7b9a('0x13')][_0x7b9a('0x12')]);}})[_0x7b9a('0x14')](function(_0x27ad55){logger[_0x7b9a('0x11')](_0x7b9a('0xe'),_0x15bc5b,_0x27ad55);_0x32c85d(_0x27ad55);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index f92174c..195a058 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 _0x195e=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x8aa169,_0x206565){var _0x12a7bb=function(_0x5e2a48){while(--_0x5e2a48){_0x8aa169['push'](_0x8aa169['shift']());}};_0x12a7bb(++_0x206565);}(_0x195e,0xfb));var _0xe195=function(_0x528841,_0x388489){_0x528841=_0x528841-0x0;var _0x9d01a8=_0x195e[_0x528841];return _0x9d01a8;};'use strict';var OpenchannelAccountEvents=require(_0xe195('0x0'));var events=[_0xe195('0x1'),_0xe195('0x2'),_0xe195('0x3')];function createListener(_0x40fe4d,_0x3975a9){return function(_0x31ca3b){_0x3975a9[_0xe195('0x4')](_0x40fe4d,_0x31ca3b);};}function removeListener(_0x2243e9,_0x30011c){return function(){OpenchannelAccountEvents[_0xe195('0x5')](_0x2243e9,_0x30011c);};}exports[_0xe195('0x6')]=function(_0x11cc55){for(var _0x595c13=0x0,_0x2a1acc=events[_0xe195('0x7')];_0x595c13<_0x2a1acc;_0x595c13++){var _0x2ead59=events[_0x595c13];var _0x28c1a9=createListener(_0xe195('0x8')+_0x2ead59,_0x11cc55);OpenchannelAccountEvents['on'](_0x2ead59,_0x28c1a9);}}; \ No newline at end of file +var _0x750a=['save','emit','removeListener','register','length'];(function(_0x1f65c2,_0x17cac2){var _0xfe68e1=function(_0x20e9a1){while(--_0x20e9a1){_0x1f65c2['push'](_0x1f65c2['shift']());}};_0xfe68e1(++_0x17cac2);}(_0x750a,0x140));var _0xa750=function(_0x4ba8f0,_0x4ea1ff){_0x4ba8f0=_0x4ba8f0-0x0;var _0x4f08ad=_0x750a[_0x4ba8f0];return _0x4f08ad;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xa750('0x0'),'remove','update'];function createListener(_0x139fa5,_0xeb020d){return function(_0x1b459c){_0xeb020d[_0xa750('0x1')](_0x139fa5,_0x1b459c);};}function removeListener(_0x457cae,_0x43d704){return function(){OpenchannelAccountEvents[_0xa750('0x2')](_0x457cae,_0x43d704);};}exports[_0xa750('0x3')]=function(_0x10b4d9){for(var _0x2497df=0x0,_0x197299=events[_0xa750('0x4')];_0x2497df<_0x197299;_0x2497df++){var _0x3d7c43=events[_0x2497df];var _0x47a4dd=createListener('openchannelAccount:'+_0x3d7c43,_0x10b4d9);OpenchannelAccountEvents['on'](_0x3d7c43,_0x47a4dd);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 57511c7..b1a81d1 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 _0x785c=['put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2cda78,_0x545368){var _0x2f33cd=function(_0x1d9549){while(--_0x1d9549){_0x2cda78['push'](_0x2cda78['shift']());}};_0x2f33cd(++_0x545368);}(_0x785c,0x16d));var _0xc785=function(_0x422acf,_0x3bb9bf){_0x422acf=_0x422acf-0x0;var _0x2d3527=_0x785c[_0x422acf];return _0x2d3527;};'use strict';var multer=require('multer');var util=require(_0xc785('0x0'));var path=require(_0xc785('0x1'));var timeout=require(_0xc785('0x2'));var express=require(_0xc785('0x3'));var router=express[_0xc785('0x4')]();var fs_extra=require(_0xc785('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc785('0x6'));var config=require(_0xc785('0x7'));var controller=require(_0xc785('0x8'));router[_0xc785('0x9')]('/',auth[_0xc785('0xa')](),controller[_0xc785('0xb')]);router[_0xc785('0x9')](_0xc785('0xc'),auth[_0xc785('0xa')](),controller[_0xc785('0xd')]);router[_0xc785('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc785('0xf')](_0xc785('0xc'),auth[_0xc785('0xa')](),controller[_0xc785('0x10')]);router['delete']('/:id',auth[_0xc785('0xa')](),controller[_0xc785('0x11')]);module[_0xc785('0x12')]=router; \ No newline at end of file +var _0x1584=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','exports','multer','express'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1584,0xfa));var _0x4158=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x1584[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0x4158('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4158('0x1'));var router=express[_0x4158('0x2')]();var fs_extra=require(_0x4158('0x3'));var auth=require(_0x4158('0x4'));var interaction=require(_0x4158('0x5'));var config=require(_0x4158('0x6'));var controller=require(_0x4158('0x7'));router[_0x4158('0x8')]('/',auth[_0x4158('0x9')](),controller[_0x4158('0xa')]);router[_0x4158('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4158('0xb')]);router[_0x4158('0xc')]('/',auth[_0x4158('0x9')](),controller[_0x4158('0xd')]);router[_0x4158('0xe')]('/:id',auth[_0x4158('0x9')](),controller[_0x4158('0xf')]);router['delete'](_0x4158('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x4158('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 73a4f39..c2ddfbc 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 _0xa09b=['INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x45fe28,_0x1c74a1){var _0x5bc0c1=function(_0x1a9023){while(--_0x1a9023){_0x45fe28['push'](_0x45fe28['shift']());}};_0x5bc0c1(++_0x1c74a1);}(_0xa09b,0x171));var _0xba09=function(_0x2e5733,_0x4a0d7a){_0x2e5733=_0x2e5733-0x0;var _0xafec34=_0xa09b[_0x2e5733];return _0xafec34;};'use strict';var Sequelize=require(_0xba09('0x0'));module['exports']={'priority':{'type':Sequelize[_0xba09('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba09('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xba09('0x3')]},'interval':{'type':Sequelize[_0xba09('0x3')],'defaultValue':_0xba09('0x4')}}; \ No newline at end of file +var _0xcd68=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1a5db6,_0x122d1f){var _0x46534b=function(_0x274b4e){while(--_0x274b4e){_0x1a5db6['push'](_0x1a5db6['shift']());}};_0x46534b(++_0x122d1f);}(_0xcd68,0x1ea));var _0x8cd6=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0xcd68[_0x389832];return _0x59429e;};'use strict';var Sequelize=require(_0x8cd6('0x0'));module[_0x8cd6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8cd6('0x2')],'allowNull':![],'defaultValue':_0x8cd6('0x3')},'appdata':{'type':Sequelize[_0x8cd6('0x4')]()},'description':{'type':Sequelize[_0x8cd6('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8cd6('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index ce386fd..aaaec49 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 _0xc273=['map','OpenchannelApplication','rawAttributes','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','catch','show','params','include','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index'];(function(_0x36f284,_0x24cbd1){var _0x4ea099=function(_0xea729e){while(--_0xea729e){_0x36f284['push'](_0x36f284['shift']());}};_0x4ea099(++_0x24cbd1);}(_0xc273,0x6e));var _0x3c27=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0xc273[_0x4314d7];return _0x5c599b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3c27('0x0'));var jsonpatch=require(_0x3c27('0x1'));var rp=require(_0x3c27('0x2'));var moment=require(_0x3c27('0x3'));var BPromise=require(_0x3c27('0x4'));var Mustache=require(_0x3c27('0x5'));var util=require(_0x3c27('0x6'));var path=require(_0x3c27('0x7'));var sox=require(_0x3c27('0x8'));var csv=require(_0x3c27('0x9'));var ejs=require(_0x3c27('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c27('0xb'));var squel=require(_0x3c27('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c27('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3c27('0xe'));var Papa=require(_0x3c27('0xf'));var Redis=require(_0x3c27('0x10'));var authService=require(_0x3c27('0x11'));var qs=require(_0x3c27('0x12'));var as=require(_0x3c27('0x13'));var hardwareService=require(_0x3c27('0x14'));var logger=require(_0x3c27('0x15'))(_0x3c27('0x16'));var utils=require(_0x3c27('0x17'));var config=require(_0x3c27('0x18'));var licenseUtil=require(_0x3c27('0x19'));var db=require(_0x3c27('0x1a'))['db'];function respondWithStatusCode(_0x217101,_0x2a6521){_0x2a6521=_0x2a6521||0xcc;return function(_0x376825){if(_0x376825){return _0x217101['sendStatus'](_0x2a6521);}return _0x217101[_0x3c27('0x1b')](_0x2a6521)[_0x3c27('0x1c')]();};}function respondWithResult(_0x4d3b30,_0x528f0a){_0x528f0a=_0x528f0a||0xc8;return function(_0x26c564){if(_0x26c564){return _0x4d3b30[_0x3c27('0x1b')](_0x528f0a)[_0x3c27('0x1d')](_0x26c564);}};}function respondWithFilteredResult(_0x4aaa58,_0xaef348){return function(_0x1755bd){if(_0x1755bd){var _0x3a88f7=typeof _0xaef348['offset']===_0x3c27('0x1e')&&typeof _0xaef348[_0x3c27('0x1f')]===_0x3c27('0x1e');var _0x1d1f61=_0x1755bd['count'];var _0x3e1ce8=_0x3a88f7?0x0:_0xaef348[_0x3c27('0x20')];var _0x531bdb=_0x3a88f7?_0x1755bd['count']:_0xaef348[_0x3c27('0x20')]+_0xaef348['limit'];var _0x3cd4f5;if(_0x531bdb>=_0x1d1f61){_0x531bdb=_0x1d1f61;_0x3cd4f5=0xc8;}else{_0x3cd4f5=0xce;}_0x4aaa58[_0x3c27('0x1b')](_0x3cd4f5);return _0x4aaa58[_0x3c27('0x21')](_0x3c27('0x22'),_0x3e1ce8+'-'+_0x531bdb+'/'+_0x1d1f61)[_0x3c27('0x1d')](_0x1755bd);}return null;};}function patchUpdates(_0x4604f4){return function(_0x147789){try{jsonpatch[_0x3c27('0x23')](_0x147789,_0x4604f4,!![]);}catch(_0x570a4e){return BPromise[_0x3c27('0x24')](_0x570a4e);}return _0x147789[_0x3c27('0x25')]();};}function saveUpdates(_0x16cd30,_0x29994e){return function(_0x177672){if(_0x177672){return _0x177672[_0x3c27('0x26')](_0x16cd30)[_0x3c27('0x27')](function(_0xecf3df){return _0xecf3df;});}return null;};}function removeEntity(_0x4db9ca,_0x2e55f5){return function(_0x3c1249){if(_0x3c1249){return _0x3c1249['destroy']()['then'](function(){_0x4db9ca[_0x3c27('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x445562,_0x4f2181){return function(_0x44885f){if(!_0x44885f){_0x445562[_0x3c27('0x28')](0x194);}return _0x44885f;};}function handleError(_0x44f19b,_0x374efa){_0x374efa=_0x374efa||0x1f4;return function(_0x40fe86){logger[_0x3c27('0x29')](_0x40fe86[_0x3c27('0x2a')]);if(_0x40fe86['name']){delete _0x40fe86[_0x3c27('0x2b')];}_0x44f19b[_0x3c27('0x1b')](_0x374efa)[_0x3c27('0x2c')](_0x40fe86);};}exports[_0x3c27('0x2d')]=function(_0x49beb1,_0x2fafaf){var _0x4c838c={},_0x16a198={},_0x38fa3f={'count':0x0,'rows':[]};var _0x55b2d7=_[_0x3c27('0x2e')](db[_0x3c27('0x2f')][_0x3c27('0x30')],function(_0x2b1970){return{'name':_0x2b1970['fieldName'],'type':_0x2b1970['type'][_0x3c27('0x31')]};});_0x16a198[_0x3c27('0x32')]=_[_0x3c27('0x2e')](_0x55b2d7,_0x3c27('0x2b'));_0x16a198['query']=_[_0x3c27('0x33')](_0x49beb1['query']);_0x16a198['filters']=_['intersection'](_0x16a198['model'],_0x16a198[_0x3c27('0x34')]);_0x4c838c['attributes']=_[_0x3c27('0x35')](_0x16a198[_0x3c27('0x32')],qs[_0x3c27('0x36')](_0x49beb1[_0x3c27('0x34')][_0x3c27('0x36')]));_0x4c838c[_0x3c27('0x37')]=_0x4c838c['attributes'][_0x3c27('0x38')]?_0x4c838c[_0x3c27('0x37')]:_0x16a198[_0x3c27('0x32')];if(!_0x49beb1[_0x3c27('0x34')][_0x3c27('0x39')](_0x3c27('0x3a'))){_0x4c838c['limit']=qs['limit'](_0x49beb1['query'][_0x3c27('0x1f')]);_0x4c838c['offset']=qs[_0x3c27('0x20')](_0x49beb1[_0x3c27('0x34')][_0x3c27('0x20')]);}_0x4c838c['order']=qs['sort'](_0x49beb1['query'][_0x3c27('0x3b')]);_0x4c838c[_0x3c27('0x3c')]=qs[_0x3c27('0x3d')](_['pick'](_0x49beb1[_0x3c27('0x34')],_0x16a198[_0x3c27('0x3d')]),_0x55b2d7);if(_0x49beb1[_0x3c27('0x34')][_0x3c27('0x3e')]){_0x4c838c[_0x3c27('0x3c')]=_[_0x3c27('0x3f')](_0x4c838c[_0x3c27('0x3c')],{'$or':_[_0x3c27('0x2e')](_0x55b2d7,function(_0x30a870){if(_0x30a870[_0x3c27('0x40')]!==_0x3c27('0x41')){var _0x43a797={};_0x43a797[_0x30a870[_0x3c27('0x2b')]]={'$like':'%'+_0x49beb1[_0x3c27('0x34')][_0x3c27('0x3e')]+'%'};return _0x43a797;}})});}_0x4c838c=_[_0x3c27('0x3f')]({},_0x4c838c,_0x49beb1[_0x3c27('0x42')]);var _0x4e7a40={'where':_0x4c838c['where']};return db[_0x3c27('0x2f')][_0x3c27('0x43')](_0x4e7a40)[_0x3c27('0x27')](function(_0x583862){_0x38fa3f['count']=_0x583862;if(_0x49beb1[_0x3c27('0x34')][_0x3c27('0x44')]){_0x4c838c['include']=[{'all':!![]}];}return db[_0x3c27('0x2f')][_0x3c27('0x45')](_0x4c838c);})[_0x3c27('0x27')](function(_0x24baee){_0x38fa3f['rows']=_0x24baee;return _0x38fa3f;})['then'](respondWithFilteredResult(_0x2fafaf,_0x4c838c))[_0x3c27('0x46')](handleError(_0x2fafaf,null));};exports[_0x3c27('0x47')]=function(_0x2b0b55,_0x17ac78){var _0x518458={'raw':!![],'where':{'id':_0x2b0b55[_0x3c27('0x48')]['id']}},_0x189cf5={};_0x189cf5[_0x3c27('0x32')]=_['keys'](db[_0x3c27('0x2f')][_0x3c27('0x30')]);_0x189cf5['query']=_[_0x3c27('0x33')](_0x2b0b55[_0x3c27('0x34')]);_0x189cf5[_0x3c27('0x3d')]=_['intersection'](_0x189cf5[_0x3c27('0x32')],_0x189cf5[_0x3c27('0x34')]);_0x518458[_0x3c27('0x37')]=_[_0x3c27('0x35')](_0x189cf5[_0x3c27('0x32')],qs['fields'](_0x2b0b55[_0x3c27('0x34')][_0x3c27('0x36')]));_0x518458[_0x3c27('0x37')]=_0x518458[_0x3c27('0x37')][_0x3c27('0x38')]?_0x518458[_0x3c27('0x37')]:_0x189cf5[_0x3c27('0x32')];if(_0x2b0b55[_0x3c27('0x34')][_0x3c27('0x44')]){_0x518458[_0x3c27('0x49')]=[{'all':!![]}];}_0x518458=_[_0x3c27('0x3f')]({},_0x518458,_0x2b0b55[_0x3c27('0x42')]);return db[_0x3c27('0x2f')][_0x3c27('0x4a')](_0x518458)[_0x3c27('0x27')](handleEntityNotFound(_0x17ac78,null))[_0x3c27('0x27')](respondWithResult(_0x17ac78,null))['catch'](handleError(_0x17ac78,null));};exports[_0x3c27('0x4b')]=function(_0x28031b,_0x3038a6){return db['OpenchannelApplication'][_0x3c27('0x4b')](_0x28031b[_0x3c27('0x4c')],{})[_0x3c27('0x27')](respondWithResult(_0x3038a6,0xc9))[_0x3c27('0x46')](handleError(_0x3038a6,null));};exports[_0x3c27('0x26')]=function(_0x46e676,_0x4f6e9a){if(_0x46e676['body']['id']){delete _0x46e676[_0x3c27('0x4c')]['id'];}return db[_0x3c27('0x2f')][_0x3c27('0x4a')]({'where':{'id':_0x46e676[_0x3c27('0x48')]['id']}})[_0x3c27('0x27')](handleEntityNotFound(_0x4f6e9a,null))['then'](saveUpdates(_0x46e676[_0x3c27('0x4c')],null))['then'](respondWithResult(_0x4f6e9a,null))['catch'](handleError(_0x4f6e9a,null));};exports[_0x3c27('0x4d')]=function(_0x409d68,_0x1f037c){return db['OpenchannelApplication'][_0x3c27('0x4a')]({'where':{'id':_0x409d68[_0x3c27('0x48')]['id']}})[_0x3c27('0x27')](handleEntityNotFound(_0x1f037c,null))['then'](removeEntity(_0x1f037c,null))[_0x3c27('0x46')](handleError(_0x1f037c,null));}; \ No newline at end of file +var _0x6fc8=['set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','params','length','merge','find','catch','create','body','eml-format','rimraf','zip-dir','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','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count'];(function(_0x2fb37b,_0x5c1a95){var _0x4d5040=function(_0x356e9f){while(--_0x356e9f){_0x2fb37b['push'](_0x2fb37b['shift']());}};_0x4d5040(++_0x5c1a95);}(_0x6fc8,0xc9));var _0x86fc=function(_0x75615e,_0xad9d15){_0x75615e=_0x75615e-0x0;var _0x3c086d=_0x6fc8[_0x75615e];return _0x3c086d;};'use strict';var emlformat=require(_0x86fc('0x0'));var rimraf=require(_0x86fc('0x1'));var zipdir=require(_0x86fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86fc('0x3'));var moment=require(_0x86fc('0x4'));var BPromise=require(_0x86fc('0x5'));var Mustache=require(_0x86fc('0x6'));var util=require(_0x86fc('0x7'));var path=require(_0x86fc('0x8'));var sox=require(_0x86fc('0x9'));var csv=require(_0x86fc('0xa'));var ejs=require(_0x86fc('0xb'));var fs=require('fs');var fs_extra=require(_0x86fc('0xc'));var _=require('lodash');var squel=require(_0x86fc('0xd'));var crypto=require(_0x86fc('0xe'));var jsforce=require(_0x86fc('0xf'));var deskjs=require(_0x86fc('0x10'));var toCsv=require(_0x86fc('0xa'));var querystring=require(_0x86fc('0x11'));var Papa=require(_0x86fc('0x12'));var Redis=require(_0x86fc('0x13'));var authService=require(_0x86fc('0x14'));var qs=require(_0x86fc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86fc('0x16'));var logger=require(_0x86fc('0x17'))(_0x86fc('0x18'));var utils=require('../../config/utils');var config=require(_0x86fc('0x19'));var licenseUtil=require(_0x86fc('0x1a'));var db=require(_0x86fc('0x1b'))['db'];function respondWithStatusCode(_0x16f3f0,_0x29b975){_0x29b975=_0x29b975||0xcc;return function(_0x497367){if(_0x497367){return _0x16f3f0[_0x86fc('0x1c')](_0x29b975);}return _0x16f3f0['status'](_0x29b975)[_0x86fc('0x1d')]();};}function respondWithResult(_0x20ab50,_0x4ff971){_0x4ff971=_0x4ff971||0xc8;return function(_0x530c02){if(_0x530c02){return _0x20ab50[_0x86fc('0x1e')](_0x4ff971)[_0x86fc('0x1f')](_0x530c02);}};}function respondWithFilteredResult(_0x141156,_0x5698a4){return function(_0x3c4112){if(_0x3c4112){var _0x3f1a9c=typeof _0x5698a4[_0x86fc('0x20')]==='undefined'&&typeof _0x5698a4[_0x86fc('0x21')]===_0x86fc('0x22');var _0x451d65=_0x3c4112[_0x86fc('0x23')];var _0x28b4c4=_0x3f1a9c?0x0:_0x5698a4[_0x86fc('0x20')];var _0x35fc8b=_0x3f1a9c?_0x3c4112['count']:_0x5698a4[_0x86fc('0x20')]+_0x5698a4[_0x86fc('0x21')];var _0x54e3aa;if(_0x35fc8b>=_0x451d65){_0x35fc8b=_0x451d65;_0x54e3aa=0xc8;}else{_0x54e3aa=0xce;}_0x141156[_0x86fc('0x1e')](_0x54e3aa);return _0x141156[_0x86fc('0x24')](_0x86fc('0x25'),_0x28b4c4+'-'+_0x35fc8b+'/'+_0x451d65)['json'](_0x3c4112);}return null;};}function patchUpdates(_0x2d0b76){return function(_0x56a2db){try{jsonpatch[_0x86fc('0x26')](_0x56a2db,_0x2d0b76,!![]);}catch(_0x48a502){return BPromise['reject'](_0x48a502);}return _0x56a2db['save']();};}function saveUpdates(_0x3a9bc1,_0x2c24d3){return function(_0x114b90){if(_0x114b90){return _0x114b90[_0x86fc('0x27')](_0x3a9bc1)['then'](function(_0xddc6bd){return _0xddc6bd;});}return null;};}function removeEntity(_0x26f24d,_0x534694){return function(_0xd538d2){if(_0xd538d2){return _0xd538d2[_0x86fc('0x28')]()[_0x86fc('0x29')](function(){_0x26f24d[_0x86fc('0x1e')](0xcc)[_0x86fc('0x1d')]();});}};}function handleEntityNotFound(_0x3090e3,_0x4a199f){return function(_0x15ed89){if(!_0x15ed89){_0x3090e3[_0x86fc('0x1c')](0x194);}return _0x15ed89;};}function handleError(_0x1dd02a,_0x4670b3){_0x4670b3=_0x4670b3||0x1f4;return function(_0x51fb46){logger[_0x86fc('0x2a')](_0x51fb46[_0x86fc('0x2b')]);if(_0x51fb46['name']){delete _0x51fb46[_0x86fc('0x2c')];}_0x1dd02a['status'](_0x4670b3)[_0x86fc('0x2d')](_0x51fb46);};}exports[_0x86fc('0x2e')]=function(_0x401a93,_0x4fa564){var _0x3bd871={},_0x3abc22={},_0x4341c7={'count':0x0,'rows':[]};var _0xe6d336=_['map'](db[_0x86fc('0x2f')][_0x86fc('0x30')],function(_0xf3df93){return{'name':_0xf3df93[_0x86fc('0x31')],'type':_0xf3df93[_0x86fc('0x32')][_0x86fc('0x33')]};});_0x3abc22[_0x86fc('0x34')]=_[_0x86fc('0x35')](_0xe6d336,_0x86fc('0x2c'));_0x3abc22[_0x86fc('0x36')]=_[_0x86fc('0x37')](_0x401a93[_0x86fc('0x36')]);_0x3abc22['filters']=_[_0x86fc('0x38')](_0x3abc22[_0x86fc('0x34')],_0x3abc22[_0x86fc('0x36')]);_0x3bd871['attributes']=_['intersection'](_0x3abc22['model'],qs['fields'](_0x401a93[_0x86fc('0x36')][_0x86fc('0x39')]));_0x3bd871[_0x86fc('0x3a')]=_0x3bd871[_0x86fc('0x3a')]['length']?_0x3bd871[_0x86fc('0x3a')]:_0x3abc22[_0x86fc('0x34')];if(!_0x401a93[_0x86fc('0x36')][_0x86fc('0x3b')](_0x86fc('0x3c'))){_0x3bd871['limit']=qs[_0x86fc('0x21')](_0x401a93[_0x86fc('0x36')][_0x86fc('0x21')]);_0x3bd871[_0x86fc('0x20')]=qs[_0x86fc('0x20')](_0x401a93['query'][_0x86fc('0x20')]);}_0x3bd871[_0x86fc('0x3d')]=qs[_0x86fc('0x3e')](_0x401a93[_0x86fc('0x36')][_0x86fc('0x3e')]);_0x3bd871[_0x86fc('0x3f')]=qs['filters'](_[_0x86fc('0x40')](_0x401a93[_0x86fc('0x36')],_0x3abc22[_0x86fc('0x41')]),_0xe6d336);if(_0x401a93[_0x86fc('0x36')][_0x86fc('0x42')]){_0x3bd871[_0x86fc('0x3f')]=_['merge'](_0x3bd871['where'],{'$or':_[_0x86fc('0x35')](_0xe6d336,function(_0xce9054){if(_0xce9054[_0x86fc('0x32')]!==_0x86fc('0x43')){var _0x185ddf={};_0x185ddf[_0xce9054[_0x86fc('0x2c')]]={'$like':'%'+_0x401a93[_0x86fc('0x36')]['filter']+'%'};return _0x185ddf;}})});}_0x3bd871=_['merge']({},_0x3bd871,_0x401a93[_0x86fc('0x44')]);var _0x592f51={'where':_0x3bd871[_0x86fc('0x3f')]};return db['OpenchannelApplication'][_0x86fc('0x23')](_0x592f51)[_0x86fc('0x29')](function(_0x5adc87){_0x4341c7[_0x86fc('0x23')]=_0x5adc87;if(_0x401a93[_0x86fc('0x36')][_0x86fc('0x45')]){_0x3bd871[_0x86fc('0x46')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x86fc('0x47')](_0x3bd871);})[_0x86fc('0x29')](function(_0xa2969){_0x4341c7['rows']=_0xa2969;return _0x4341c7;})['then'](respondWithFilteredResult(_0x4fa564,_0x3bd871))['catch'](handleError(_0x4fa564,null));};exports['show']=function(_0x20e303,_0x50b28f){var _0x3f6c1e={'raw':!![],'where':{'id':_0x20e303[_0x86fc('0x48')]['id']}},_0x980958={};_0x980958[_0x86fc('0x34')]=_['keys'](db['OpenchannelApplication'][_0x86fc('0x30')]);_0x980958[_0x86fc('0x36')]=_[_0x86fc('0x37')](_0x20e303['query']);_0x980958['filters']=_[_0x86fc('0x38')](_0x980958['model'],_0x980958[_0x86fc('0x36')]);_0x3f6c1e['attributes']=_['intersection'](_0x980958[_0x86fc('0x34')],qs[_0x86fc('0x39')](_0x20e303['query'][_0x86fc('0x39')]));_0x3f6c1e['attributes']=_0x3f6c1e[_0x86fc('0x3a')][_0x86fc('0x49')]?_0x3f6c1e[_0x86fc('0x3a')]:_0x980958[_0x86fc('0x34')];if(_0x20e303['query'][_0x86fc('0x45')]){_0x3f6c1e[_0x86fc('0x46')]=[{'all':!![]}];}_0x3f6c1e=_[_0x86fc('0x4a')]({},_0x3f6c1e,_0x20e303[_0x86fc('0x44')]);return db[_0x86fc('0x2f')][_0x86fc('0x4b')](_0x3f6c1e)[_0x86fc('0x29')](handleEntityNotFound(_0x50b28f,null))[_0x86fc('0x29')](respondWithResult(_0x50b28f,null))[_0x86fc('0x4c')](handleError(_0x50b28f,null));};exports[_0x86fc('0x4d')]=function(_0x5c50c8,_0x1c6591){return db[_0x86fc('0x2f')][_0x86fc('0x4d')](_0x5c50c8[_0x86fc('0x4e')],{})[_0x86fc('0x29')](respondWithResult(_0x1c6591,0xc9))['catch'](handleError(_0x1c6591,null));};exports['update']=function(_0x5ab926,_0x494d9b){if(_0x5ab926[_0x86fc('0x4e')]['id']){delete _0x5ab926['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x5ab926[_0x86fc('0x48')]['id']}})['then'](handleEntityNotFound(_0x494d9b,null))['then'](saveUpdates(_0x5ab926[_0x86fc('0x4e')],null))['then'](respondWithResult(_0x494d9b,null))['catch'](handleError(_0x494d9b,null));};exports[_0x86fc('0x28')]=function(_0x68cd28,_0x476e4f){return db['OpenchannelApplication'][_0x86fc('0x4b')]({'where':{'id':_0x68cd28['params']['id']}})[_0x86fc('0x29')](handleEntityNotFound(_0x476e4f,null))[_0x86fc('0x29')](removeEntity(_0x476e4f,null))[_0x86fc('0x4c')](handleError(_0x476e4f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 5d91832..2fee598 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 _0xe951=['request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x22b772,_0x86ba59){var _0x444e9b=function(_0x759042){while(--_0x759042){_0x22b772['push'](_0x22b772['shift']());}};_0x444e9b(++_0x86ba59);}(_0xe951,0x136));var _0x1e95=function(_0x11c7d3,_0x47fe03){_0x11c7d3=_0x11c7d3-0x0;var _0x351767=_0xe951[_0x11c7d3];return _0x351767;};'use strict';var _=require(_0x1e95('0x0'));var util=require(_0x1e95('0x1'));var logger=require(_0x1e95('0x2'))(_0x1e95('0x3'));var moment=require('moment');var BPromise=require(_0x1e95('0x4'));var rp=require(_0x1e95('0x5'));var fs=require('fs');var path=require(_0x1e95('0x6'));var rimraf=require(_0x1e95('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e95('0x8'));module[_0x1e95('0x9')]=function(_0x535891,_0x1321c5){return _0x535891[_0x1e95('0xa')](_0x1e95('0xb'),attributes,{'tableName':_0x1e95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1e95('0xd'),'collate':_0x1e95('0xe')});}; \ No newline at end of file +var _0x3571=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x3571,0x13a));var _0x1357=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x3571[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x1357('0x0'));var util=require('util');var logger=require(_0x1357('0x1'))(_0x1357('0x2'));var moment=require(_0x1357('0x3'));var BPromise=require(_0x1357('0x4'));var rp=require(_0x1357('0x5'));var fs=require('fs');var path=require(_0x1357('0x6'));var rimraf=require('rimraf');var config=require(_0x1357('0x7'));var attributes=require(_0x1357('0x8'));module[_0x1357('0x9')]=function(_0x5e605e,_0x3c1322){return _0x5e605e[_0x1357('0xa')](_0x1357('0xb'),attributes,{'tableName':_0x1357('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1357('0xd'),'collate':_0x1357('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index bf5c0d4..532270d 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 _0xbefe=['options','raw','where','attributes','limit','then','debug','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error','code','message','catch','OpenchannelApplication'];(function(_0x33e326,_0x53a184){var _0x18505e=function(_0x51848a){while(--_0x51848a){_0x33e326['push'](_0x33e326['shift']());}};_0x18505e(++_0x53a184);}(_0xbefe,0x1b8));var _0xebef=function(_0x4cc588,_0x4a9bc4){_0x4cc588=_0x4cc588-0x0;var _0x36619d=_0xbefe[_0x4cc588];return _0x36619d;};'use strict';var _=require(_0xebef('0x0'));var util=require(_0xebef('0x1'));var moment=require(_0xebef('0x2'));var BPromise=require(_0xebef('0x3'));var rs=require(_0xebef('0x4'));var fs=require('fs');var Redis=require(_0xebef('0x5'));var db=require(_0xebef('0x6'))['db'];var utils=require(_0xebef('0x7'));var logger=require('../../config/logger')(_0xebef('0x8'));var config=require(_0xebef('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xebef('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dc57e,_0x2c1ff4,_0x330a16){return new BPromise(function(_0x2c39f8,_0x441a24){return client[_0xebef('0xb')](_0x2dc57e,_0x330a16)['then'](function(_0x315807){logger['info'](_0xebef('0xc'),_0x2c1ff4,_0xebef('0xd'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x2c1ff4,_0xebef('0xd'),JSON['stringify'](_0x315807));if(_0x315807[_0xebef('0xe')]){if(_0x315807[_0xebef('0xe')][_0xebef('0xf')]===0x1f4){logger[_0xebef('0xe')](_0xebef('0xc'),_0x2c1ff4,_0x315807[_0xebef('0xe')][_0xebef('0x10')]);return _0x441a24(_0x315807[_0xebef('0xe')][_0xebef('0x10')]);}logger['error'](_0xebef('0xc'),_0x2c1ff4,_0x315807[_0xebef('0xe')][_0xebef('0x10')]);return _0x2c39f8(_0x315807[_0xebef('0xe')][_0xebef('0x10')]);}else{logger['info'](_0xebef('0xc'),_0x2c1ff4,_0xebef('0xd'));_0x2c39f8(_0x315807['result'][_0xebef('0x10')]);}})[_0xebef('0x11')](function(_0x1e7735){logger[_0xebef('0xe')](_0xebef('0xc'),_0x2c1ff4,_0x1e7735);_0x441a24(_0x1e7735);});});}exports['UpdateOpenchannelApplication']=function(_0x4590db){var _0x881844=this;return new Promise(function(_0x50bb16,_0x3d07d5){return db[_0xebef('0x12')]['update'](_0x4590db['body'],{'raw':_0x4590db['options']?_0x4590db[_0xebef('0x13')][_0xebef('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4590db[_0xebef('0x13')]?_0x4590db[_0xebef('0x13')][_0xebef('0x15')]||null:null,'attributes':_0x4590db[_0xebef('0x13')]?_0x4590db['options'][_0xebef('0x16')]||null:null,'limit':_0x4590db[_0xebef('0x13')]?_0x4590db['options'][_0xebef('0x17')]||null:null})[_0xebef('0x18')](function(_0x369907){logger['info']('UpdateOpenchannelApplication',_0x4590db);logger[_0xebef('0x19')](_0xebef('0x1a'),_0x4590db,JSON['stringify'](_0x369907));_0x50bb16(_0x369907);})['catch'](function(_0x16bef0){logger['error']('UpdateOpenchannelApplication',_0x16bef0['message'],_0x4590db);_0x3d07d5(_0x881844[_0xebef('0xe')](0x1f4,_0x16bef0[_0xebef('0x10')]));});});}; \ No newline at end of file +var _0xd6aa=['error','code','message','result','catch','update','body','raw','options','where','limit','UpdateOpenchannelApplication','lodash','util','bluebird','randomstring','rpc','../../config/environment','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x31b829,_0x6c11d9){var _0xf5fe25=function(_0x509ecd){while(--_0x509ecd){_0x31b829['push'](_0x31b829['shift']());}};_0xf5fe25(++_0x6c11d9);}(_0xd6aa,0x183));var _0xad6a=function(_0x577683,_0x36165f){_0x577683=_0x577683-0x0;var _0x59119c=_0xd6aa[_0x577683];return _0x59119c;};'use strict';var _=require(_0xad6a('0x0'));var util=require(_0xad6a('0x1'));var moment=require('moment');var BPromise=require(_0xad6a('0x2'));var rs=require(_0xad6a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad6a('0x4'));var config=require(_0xad6a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xad6a('0x6')][_0xad6a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdc1113,_0x3e3393,_0x153cf6){return new BPromise(function(_0x4b1567,_0x14788e){return client[_0xad6a('0x8')](_0xdc1113,_0x153cf6)[_0xad6a('0x9')](function(_0x52f6aa){logger['info'](_0xad6a('0xa'),_0x3e3393,'request\x20sent');logger[_0xad6a('0xb')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3e3393,'request\x20sent',JSON[_0xad6a('0xc')](_0x52f6aa));if(_0x52f6aa[_0xad6a('0xd')]){if(_0x52f6aa['error'][_0xad6a('0xe')]===0x1f4){logger['error'](_0xad6a('0xa'),_0x3e3393,_0x52f6aa[_0xad6a('0xd')][_0xad6a('0xf')]);return _0x14788e(_0x52f6aa[_0xad6a('0xd')][_0xad6a('0xf')]);}logger[_0xad6a('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x3e3393,_0x52f6aa[_0xad6a('0xd')][_0xad6a('0xf')]);return _0x4b1567(_0x52f6aa['error'][_0xad6a('0xf')]);}else{logger['info'](_0xad6a('0xa'),_0x3e3393,'request\x20sent');_0x4b1567(_0x52f6aa[_0xad6a('0x10')][_0xad6a('0xf')]);}})[_0xad6a('0x11')](function(_0x50cb69){logger[_0xad6a('0xd')](_0xad6a('0xa'),_0x3e3393,_0x50cb69);_0x14788e(_0x50cb69);});});}exports['UpdateOpenchannelApplication']=function(_0x231e43){var _0x3ed070=this;return new Promise(function(_0x26e160,_0x422f30){return db['OpenchannelApplication'][_0xad6a('0x12')](_0x231e43[_0xad6a('0x13')],{'raw':_0x231e43['options']?_0x231e43['options'][_0xad6a('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x231e43[_0xad6a('0x15')]?_0x231e43[_0xad6a('0x15')][_0xad6a('0x16')]||null:null,'attributes':_0x231e43[_0xad6a('0x15')]?_0x231e43[_0xad6a('0x15')]['attributes']||null:null,'limit':_0x231e43[_0xad6a('0x15')]?_0x231e43['options'][_0xad6a('0x17')]||null:null})[_0xad6a('0x9')](function(_0x2792f6){logger['info'](_0xad6a('0x18'),_0x231e43);logger[_0xad6a('0xb')]('UpdateOpenchannelApplication',_0x231e43,JSON[_0xad6a('0xc')](_0x2792f6));_0x26e160(_0x2792f6);})[_0xad6a('0x11')](function(_0x5c949f){logger[_0xad6a('0xd')]('UpdateOpenchannelApplication',_0x5c949f[_0xad6a('0xf')],_0x231e43);_0x422f30(_0x3ed070['error'](0x1f4,_0x5c949f[_0xad6a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 29d8be1..289062d 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 _0x7ce7=['/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','tracked','removeTags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage'];(function(_0x3a4b9a,_0x1fd412){var _0x42aba4=function(_0x1c854a){while(--_0x1c854a){_0x3a4b9a['push'](_0x3a4b9a['shift']());}};_0x42aba4(++_0x1fd412);}(_0x7ce7,0x175));var _0x77ce=function(_0x47a3e8,_0x3c6161){_0x47a3e8=_0x47a3e8-0x0;var _0x12c045=_0x7ce7[_0x47a3e8];return _0x12c045;};'use strict';var multer=require(_0x77ce('0x0'));var util=require(_0x77ce('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77ce('0x2'));var router=express[_0x77ce('0x3')]();var fs_extra=require(_0x77ce('0x4'));var auth=require(_0x77ce('0x5'));var interaction=require(_0x77ce('0x6'));var config=require(_0x77ce('0x7'));var controller=require(_0x77ce('0x8'));router[_0x77ce('0x9')]('/',auth[_0x77ce('0xa')](),controller[_0x77ce('0xb')]);router[_0x77ce('0x9')](_0x77ce('0xc'),auth[_0x77ce('0xa')](),controller[_0x77ce('0xd')]);router[_0x77ce('0x9')](_0x77ce('0xe'),auth[_0x77ce('0xa')](),controller[_0x77ce('0xf')]);router['get']('/:id/messages',auth[_0x77ce('0xa')](),controller[_0x77ce('0x10')]);router['get'](_0x77ce('0x11'),auth[_0x77ce('0xa')](),controller[_0x77ce('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x77ce('0x13')]);router[_0x77ce('0x14')](_0x77ce('0x15'),auth[_0x77ce('0xa')](),controller[_0x77ce('0x16')]);router[_0x77ce('0x14')](_0x77ce('0x17'),auth[_0x77ce('0xa')](),interaction['tracked'](_0x77ce('0x18'),_0x77ce('0x19')),controller[_0x77ce('0x1a')]);router[_0x77ce('0x1b')]('/:id',auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x77ce('0x1c')),controller['update']);router[_0x77ce('0x1d')]('/:id',auth[_0x77ce('0xa')](),interaction[_0x77ce('0x1e')](_0x77ce('0x18'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x77ce('0x1d')](_0x77ce('0x17'),auth[_0x77ce('0xa')](),controller[_0x77ce('0x1f')]);module[_0x77ce('0x20')]=router; \ No newline at end of file +var _0x4cd1=['destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id','/:id/messages','/:id/download','download','post','create','addMessage','tracked','openchannelinteraction:addtags','put','openchannelinteraction:update','delete','openchannel','openchannelinteraction:destroy'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x4cd1,0x197));var _0x14cd=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x4cd1[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x14cd('0x0'));var util=require(_0x14cd('0x1'));var path=require('path');var timeout=require(_0x14cd('0x2'));var express=require(_0x14cd('0x3'));var router=express[_0x14cd('0x4')]();var fs_extra=require(_0x14cd('0x5'));var auth=require(_0x14cd('0x6'));var interaction=require(_0x14cd('0x7'));var config=require('../../config/environment');var controller=require(_0x14cd('0x8'));router[_0x14cd('0x9')]('/',auth['isAuthenticated'](),controller[_0x14cd('0xa')]);router[_0x14cd('0x9')](_0x14cd('0xb'),auth[_0x14cd('0xc')](),controller['describe']);router['get'](_0x14cd('0xd'),auth[_0x14cd('0xc')](),controller['show']);router[_0x14cd('0x9')](_0x14cd('0xe'),auth[_0x14cd('0xc')](),controller['getMessages']);router[_0x14cd('0x9')](_0x14cd('0xf'),auth[_0x14cd('0xc')](),controller[_0x14cd('0x10')]);router[_0x14cd('0x11')]('/',auth[_0x14cd('0xc')](),controller[_0x14cd('0x12')]);router[_0x14cd('0x11')](_0x14cd('0xe'),auth[_0x14cd('0xc')](),controller[_0x14cd('0x13')]);router[_0x14cd('0x11')]('/:id/tags',auth[_0x14cd('0xc')](),interaction[_0x14cd('0x14')]('openchannel',_0x14cd('0x15')),controller['addTags']);router[_0x14cd('0x16')](_0x14cd('0xd'),auth[_0x14cd('0xc')](),interaction[_0x14cd('0x14')]('openchannel',_0x14cd('0x17')),controller['update']);router[_0x14cd('0x18')]('/:id',auth[_0x14cd('0xc')](),interaction[_0x14cd('0x14')](_0x14cd('0x19'),_0x14cd('0x1a')),controller[_0x14cd('0x1b')]);router[_0x14cd('0x18')](_0x14cd('0x1c'),auth[_0x14cd('0xc')](),controller[_0x14cd('0x1d')]);module[_0x14cd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9b291d5..029c5e8 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 _0x8e44=['DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','STRING'];(function(_0x2e147f,_0x5869f0){var _0x2d02b4=function(_0x1844ec){while(--_0x1844ec){_0x2e147f['push'](_0x2e147f['shift']());}};_0x2d02b4(++_0x5869f0);}(_0x8e44,0x1ac));var _0x48e4=function(_0x309f90,_0x25c101){_0x309f90=_0x309f90-0x0;var _0x458db7=_0x8e44[_0x309f90];return _0x458db7;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'closed':{'type':Sequelize[_0x48e4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x48e4('0x3')]},'thirdDisposition':{'type':Sequelize[_0x48e4('0x3')]},'note':{'type':Sequelize[_0x48e4('0x3')]},'read1stAt':{'type':Sequelize[_0x48e4('0x4')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x48e4('0x3')]},'lastMsgAt':{'type':Sequelize[_0x48e4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x48e4('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x48e4('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x48e4('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x48e4('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x48e4('0x7')]}}; \ No newline at end of file +var _0x24e9=['sequelize','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x45aa0c,_0x3b1092){var _0x51b6a5=function(_0x54b824){while(--_0x54b824){_0x45aa0c['push'](_0x45aa0c['shift']());}};_0x51b6a5(++_0x3b1092);}(_0x24e9,0x85));var _0x924e=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x24e9[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x924e('0x0'));module['exports']={'closed':{'type':Sequelize[_0x924e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x924e('0x2')]},'disposition':{'type':Sequelize[_0x924e('0x3')]},'secondDisposition':{'type':Sequelize[_0x924e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x924e('0x3')]},'note':{'type':Sequelize[_0x924e('0x3')]},'read1stAt':{'type':Sequelize[_0x924e('0x2')]},'threadId':{'type':Sequelize[_0x924e('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x924e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x924e('0x4')]('in',_0x924e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x924e('0x4')]('in',_0x924e('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x924e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 123dc38..ef5802e 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 _0xbe8c=['count','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','map','OpenchannelInteraction','type','key','findAll','openchannel','query','user','catch','from','params','keys','rawAttributes','filters','attributes','intersection','model','fields','length','includeAll','include','merge','options','body','find','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','toString','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','out','System','read','value','views','downloadInteraction.ejs','transcript-','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined'];(function(_0x5526cd,_0x3810bc){var _0x15324a=function(_0x100b4d){while(--_0x100b4d){_0x5526cd['push'](_0x5526cd['shift']());}};_0x15324a(++_0x3810bc);}(_0xbe8c,0x16a));var _0xcbe8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbe8c[_0x3ab51d];return _0x29a04e;};'use strict';var rimraf=require(_0xcbe8('0x0'));var zipdir=require('zip-dir');var moment=require(_0xcbe8('0x1'));var util=require(_0xcbe8('0x2'));var path=require(_0xcbe8('0x3'));var ejs=require(_0xcbe8('0x4'));var fs=require('fs');var _=require(_0xcbe8('0x5'));var Redis=require(_0xcbe8('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xcbe8('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xcbe8('0x8'))(_0xcbe8('0x9'));var config=require(_0xcbe8('0xa'));var db=require(_0xcbe8('0xb'))['db'];config[_0xcbe8('0xc')]=_[_0xcbe8('0xd')](config[_0xcbe8('0xc')],{'host':_0xcbe8('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbe8('0xc')]));require(_0xcbe8('0xf'))[_0xcbe8('0x10')](socket);function respondWithStatusCode(_0x3b61bd,_0x12343c){_0x12343c=_0x12343c||0xcc;return function(_0x171802){if(_0x171802){return _0x3b61bd[_0xcbe8('0x11')](_0x12343c);}return _0x3b61bd[_0xcbe8('0x12')](_0x12343c)[_0xcbe8('0x13')]();};}function respondWithResult(_0x488a33,_0x4d8d25){_0x4d8d25=_0x4d8d25||0xc8;return function(_0xe18567){if(_0xe18567){return _0x488a33[_0xcbe8('0x12')](_0x4d8d25)[_0xcbe8('0x14')](_0xe18567);}};}function respondWithFilteredResult(_0x29498b,_0x219d72){return function(_0x4250f5){if(_0x4250f5){var _0x909b9=typeof _0x219d72['offset']===_0xcbe8('0x15')&&typeof _0x219d72['limit']===_0xcbe8('0x15');var _0x28aa58=_0x4250f5[_0xcbe8('0x16')];var _0x381708=_0x909b9?0x0:_0x219d72[_0xcbe8('0x17')];var _0x2749cd=_0x909b9?_0x4250f5[_0xcbe8('0x16')]:_0x219d72[_0xcbe8('0x17')]+_0x219d72[_0xcbe8('0x18')];var _0x4461aa;if(_0x2749cd>=_0x28aa58){_0x2749cd=_0x28aa58;_0x4461aa=0xc8;}else{_0x4461aa=0xce;}_0x29498b[_0xcbe8('0x12')](_0x4461aa);return _0x29498b[_0xcbe8('0x19')](_0xcbe8('0x1a'),_0x381708+'-'+_0x2749cd+'/'+_0x28aa58)['json'](_0x4250f5);}return null;};}function saveUpdates(_0x18c520){return function(_0x1c997d){if(_0x1c997d){return _0x1c997d[_0xcbe8('0x1b')](_0x18c520)[_0xcbe8('0x1c')](function(_0x3e27af){return _0x3e27af;});}return null;};}function removeEntity(_0x49835d){return function(_0x1357ab){if(_0x1357ab){return _0x1357ab[_0xcbe8('0x1d')]()[_0xcbe8('0x1c')](function(){_0x49835d[_0xcbe8('0x12')](0xcc)[_0xcbe8('0x13')]();});}};}function handleEntityNotFound(_0x4263a2){return function(_0xb187f2){if(!_0xb187f2){_0x4263a2[_0xcbe8('0x11')](0x194);}return _0xb187f2;};}function handleError(_0x2e4694,_0x391e69){_0x391e69=_0x391e69||0x1f4;return function(_0x42e654){logger[_0xcbe8('0x1e')](_0x42e654[_0xcbe8('0x1f')]);if(_0x42e654['name']){delete _0x42e654[_0xcbe8('0x20')];}_0x2e4694[_0xcbe8('0x12')](_0x391e69)['send'](_0x42e654);};}exports['index']=function(_0x348a49,_0x481f18){var _0x1dd7dc={};var _0x39c929=_[_0xcbe8('0x21')](db[_0xcbe8('0x22')]['rawAttributes'],function(_0x3fd71f){return{'name':_0x3fd71f['fieldName'],'type':_0x3fd71f[_0xcbe8('0x23')][_0xcbe8('0x24')]};});_0x1dd7dc=qs['getOptions'](_0x39c929,_0x348a49);return interaction[_0xcbe8('0x25')](_0xcbe8('0x26'),_0x348a49[_0xcbe8('0x27')],_0x348a49[_0xcbe8('0x28')],_0x1dd7dc,_0x39c929)[_0xcbe8('0x1c')](respondWithFilteredResult(_0x481f18,_0x1dd7dc))[_0xcbe8('0x29')](handleError(_0x481f18,null));};exports['show']=function(_0x500a35,_0x10c279){var _0x2e3066={};if(_0x500a35[_0xcbe8('0x27')][_0xcbe8('0x23')]&&_0x500a35[_0xcbe8('0x27')]['type']===_0xcbe8('0x2a')){_0x2e3066['from']=_0x500a35[_0xcbe8('0x2b')]['id'];}else{_0x2e3066['id']=_0x500a35[_0xcbe8('0x2b')]['id'];}var _0x146d43={'raw':![],'where':_0x2e3066},_0x1700c4={};_0x1700c4['model']=_[_0xcbe8('0x2c')](db[_0xcbe8('0x22')][_0xcbe8('0x2d')]);_0x1700c4['query']=_['keys'](_0x500a35[_0xcbe8('0x27')]);_0x1700c4[_0xcbe8('0x2e')]=_['intersection'](_0x1700c4['model'],_0x1700c4[_0xcbe8('0x27')]);_0x146d43[_0xcbe8('0x2f')]=_[_0xcbe8('0x30')](_0x1700c4[_0xcbe8('0x31')],qs[_0xcbe8('0x32')](_0x500a35[_0xcbe8('0x27')][_0xcbe8('0x32')]));_0x146d43[_0xcbe8('0x2f')]=_0x146d43[_0xcbe8('0x2f')][_0xcbe8('0x33')]?_0x146d43['attributes']:_0x1700c4[_0xcbe8('0x31')];if(_0x500a35[_0xcbe8('0x27')][_0xcbe8('0x34')]){_0x146d43[_0xcbe8('0x35')]=[{'all':!![]}];}_0x146d43=_[_0xcbe8('0x36')]({},_0x146d43,_0x500a35[_0xcbe8('0x37')]);return db[_0xcbe8('0x22')]['find'](_0x146d43)[_0xcbe8('0x1c')](handleEntityNotFound(_0x10c279,null))[_0xcbe8('0x1c')](respondWithResult(_0x10c279,null))['catch'](handleError(_0x10c279,null));};exports['create']=function(_0x12536d,_0x28f7c3){return db['OpenchannelInteraction']['create'](_0x12536d['body'],{})[_0xcbe8('0x1c')](respondWithResult(_0x28f7c3,0xc9))[_0xcbe8('0x29')](handleError(_0x28f7c3,null));};exports[_0xcbe8('0x1b')]=function(_0x34b593,_0x42b96c){if(_0x34b593['body']['id']){delete _0x34b593[_0xcbe8('0x38')]['id'];}return db[_0xcbe8('0x22')][_0xcbe8('0x39')]({'where':{'id':_0x34b593[_0xcbe8('0x2b')]['id']}})[_0xcbe8('0x1c')](handleEntityNotFound(_0x42b96c,null))[_0xcbe8('0x1c')](saveUpdates(_0x34b593['body'],null))['then'](respondWithResult(_0x42b96c,null))[_0xcbe8('0x29')](handleError(_0x42b96c,null));};exports['destroy']=function(_0x2326f1,_0x519b19){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2326f1['params']['id']}})[_0xcbe8('0x1c')](handleEntityNotFound(_0x519b19,null))[_0xcbe8('0x1c')](removeEntity(_0x519b19,null))['catch'](handleError(_0x519b19,null));};exports[_0xcbe8('0x3a')]=function(_0x5eda14,_0x19a796){return db[_0xcbe8('0x22')]['describe']()[_0xcbe8('0x1c')](respondWithResult(_0x19a796,null))['catch'](handleError(_0x19a796,null));};exports[_0xcbe8('0x3b')]=function(_0x216f28,_0x2f13cb){return db[_0xcbe8('0x3c')][_0xcbe8('0x39')]({'where':{'id':_0x216f28['params']['id']}})['then'](handleEntityNotFound(_0x2f13cb,null))[_0xcbe8('0x1c')](function(_0x4c9408){if(_0x4c9408){return _0x4c9408[_0xcbe8('0x3b')](_0x216f28[_0xcbe8('0x38')][_0xcbe8('0x3d')],_[_0xcbe8('0x3e')](_0x216f28['body'],[_0xcbe8('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x2f13cb,null))[_0xcbe8('0x29')](handleError(_0x2f13cb,null));};exports[_0xcbe8('0x3f')]=function(_0x47be35,_0x14632c){var _0x14631a={'raw':![],'where':{}};var _0xbeb120={};var _0x27652d={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x47be35[_0xcbe8('0x2b')]['id']}})[_0xcbe8('0x1c')](handleEntityNotFound(_0x14632c,null))[_0xcbe8('0x1c')](function(_0x30efc2){if(_0x30efc2){_0xbeb120[_0xcbe8('0x31')]=_['keys'](db[_0xcbe8('0x3c')]['rawAttributes']);_0xbeb120['query']=_['keys'](_0x47be35[_0xcbe8('0x27')]);_0xbeb120[_0xcbe8('0x2e')]=_['intersection'](_0xbeb120['model'],_0xbeb120[_0xcbe8('0x27')]);_0x14631a[_0xcbe8('0x2f')]=_[_0xcbe8('0x30')](_0xbeb120[_0xcbe8('0x31')],qs[_0xcbe8('0x32')](_0x47be35[_0xcbe8('0x27')][_0xcbe8('0x32')]));_0x14631a[_0xcbe8('0x2f')]=_0x14631a['attributes']['length']?_0x14631a[_0xcbe8('0x2f')]:_0xbeb120[_0xcbe8('0x31')];if(!_0x47be35['query'][_0xcbe8('0x40')](_0xcbe8('0x41'))){_0x14631a[_0xcbe8('0x18')]=qs['limit'](_0x47be35[_0xcbe8('0x27')][_0xcbe8('0x18')]);_0x14631a[_0xcbe8('0x17')]=qs['offset'](_0x47be35[_0xcbe8('0x27')][_0xcbe8('0x17')]);}_0x14631a[_0xcbe8('0x42')]=qs[_0xcbe8('0x43')](_0x47be35[_0xcbe8('0x27')][_0xcbe8('0x43')]);_0x14631a['where']=qs['filters'](_[_0xcbe8('0x44')](_0x47be35[_0xcbe8('0x27')],_0xbeb120[_0xcbe8('0x2e')]));_0x14631a[_0xcbe8('0x45')]['OpenchannelInteractionId']=_0x30efc2['id'];if(_0x47be35[_0xcbe8('0x27')][_0xcbe8('0x46')]){_0x14631a[_0xcbe8('0x45')]=_[_0xcbe8('0x36')](_0x14631a[_0xcbe8('0x45')],{'$or':_[_0xcbe8('0x21')](_0x14631a['attributes'],function(_0x4d77a7){var _0x195e3f={};_0x195e3f[_0x4d77a7]={'$like':'%'+_0x47be35[_0xcbe8('0x27')][_0xcbe8('0x46')]+'%'};return _0x195e3f;})});}if(_0x47be35[_0xcbe8('0x27')][_0xcbe8('0x47')]){var _0x363774=_0x47be35[_0xcbe8('0x27')]['$gte'][_0xcbe8('0x48')](',');var _0x20dbc4={};_0x20dbc4[_0x363774[0x0]]={'$gte':moment(_0x363774[0x1])[_0xcbe8('0x49')](_0xcbe8('0x4a'))};_0x14631a[_0xcbe8('0x45')]=_[_0xcbe8('0x36')](_0x14631a[_0xcbe8('0x45')],_0x20dbc4);}_0x14631a=_[_0xcbe8('0x36')]({},_0x14631a,_0x47be35[_0xcbe8('0x37')]);return db['OpenchannelMessage'][_0xcbe8('0x16')]({'where':_0x14631a[_0xcbe8('0x45')]})[_0xcbe8('0x1c')](function(_0x2ab26c){_0x27652d[_0xcbe8('0x16')]=_0x2ab26c;if(_0x47be35['query'][_0xcbe8('0x34')]){_0x14631a[_0xcbe8('0x35')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xcbe8('0x25')](_0x14631a);})[_0xcbe8('0x1c')](function(_0x134c4a){_0x27652d[_0xcbe8('0x4b')]=_0x134c4a;return _0x27652d;});}})[_0xcbe8('0x1c')](respondWithFilteredResult(_0x14632c,_0x14631a))[_0xcbe8('0x29')](handleError(_0x14632c,null));};exports['addTags']=function(_0x19c44f,_0x4b3c02){return db[_0xcbe8('0x22')][_0xcbe8('0x39')]({'where':{'id':_0x19c44f[_0xcbe8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4b3c02,null))['then'](function(_0x2a8e4a){if(_0x2a8e4a){return _0x2a8e4a[_0xcbe8('0x4c')](_0x19c44f['body']['ids'],_['omit'](_0x19c44f['body'],['ids','id'])||{})[_0xcbe8('0x4d')](function(){return db[_0xcbe8('0x4e')][_0xcbe8('0x25')]({'attributes':['id','name',_0xcbe8('0x4f')],'where':{'id':_0x19c44f['body']['ids']}});})[_0xcbe8('0x1c')](function(_0x5136b8){socket[_0xcbe8('0x50')](_0xcbe8('0x51'),{'id':Number(_0x19c44f[_0xcbe8('0x2b')]['id']),'tags':_0x5136b8||[]});return{'id':Number(_0x19c44f[_0xcbe8('0x2b')]['id']),'tags':_0x5136b8||[]};});}})['then'](respondWithResult(_0x4b3c02,null))[_0xcbe8('0x29')](handleError(_0x4b3c02,null));};exports[_0xcbe8('0x52')]=function(_0x1077cb,_0x25ffb8){return db[_0xcbe8('0x22')][_0xcbe8('0x39')]({'where':{'id':_0x1077cb[_0xcbe8('0x2b')]['id']}})[_0xcbe8('0x1c')](handleEntityNotFound(_0x25ffb8,null))[_0xcbe8('0x1c')](function(_0x5eb810){if(_0x5eb810){return _0x5eb810[_0xcbe8('0x52')](_0x1077cb[_0xcbe8('0x27')]['ids']);}})[_0xcbe8('0x1c')](respondWithStatusCode(_0x25ffb8,null))[_0xcbe8('0x29')](handleError(_0x25ffb8,null));};exports[_0xcbe8('0x53')]=function(_0x28d6c6,_0xc1a85b){var _0x5e7820=moment()[_0xcbe8('0x54')]()['toString']();var _0x5c73c3=path['join'](config[_0xcbe8('0x55')],_0xcbe8('0x56'),'files',_0xcbe8('0x57'));var _0x191e98=path[_0xcbe8('0x58')](config[_0xcbe8('0x55')],_0xcbe8('0x56'),_0xcbe8('0x59'),'attachments');var _0x32122b=path[_0xcbe8('0x58')](_0x5c73c3,_0x5e7820);var _0x43a243=util[_0xcbe8('0x49')](_0xcbe8('0x5a'),_0x28d6c6[_0xcbe8('0x2b')]['id'],_0x5e7820);var _0x1f66a7=path[_0xcbe8('0x58')](_0x5c73c3,_0x43a243);var _0x39c29f=[];_0x39c29f[_0xcbe8('0x5b')]({'model':db[_0xcbe8('0x5c')],'as':_0xcbe8('0x5c'),'attributes':['id',_0xcbe8('0x5d')],'raw':!![]});_0x39c29f['push']({'model':db[_0xcbe8('0x5e')],'as':_0xcbe8('0x5f'),'attributes':['id',_0xcbe8('0x60'),_0xcbe8('0x61')],'raw':!![]});if(_0x28d6c6['query']['attachments']){_0x39c29f[_0xcbe8('0x5b')]({'model':db[_0xcbe8('0x62')],'as':_0xcbe8('0x62'),'raw':!![]});}var _0x20b28a=[{'model':db[_0xcbe8('0x3c')],'as':'Messages','attributes':['id',_0xcbe8('0x38'),'createdAt',_0xcbe8('0x63'),_0xcbe8('0x64'),'read'],'include':_0x39c29f}];_0x20b28a[_0xcbe8('0x5b')]({'model':db[_0xcbe8('0x65')],'as':_0xcbe8('0x66'),'attributes':['id',_0xcbe8('0x20')]});_0x20b28a[_0xcbe8('0x5b')]({'model':db[_0xcbe8('0x5c')],'as':_0xcbe8('0x67'),'attributes':['id',_0xcbe8('0x5d')]});return db[_0xcbe8('0x22')][_0xcbe8('0x39')]({'where':{'id':_0x28d6c6[_0xcbe8('0x2b')]['id']},'include':_0x20b28a})[_0xcbe8('0x1c')](handleEntityNotFound(_0xc1a85b,null))['then'](function(_0x18684d){if(_0x18684d){var _0x2d728f=_0x18684d['get']({'plain':!![]});fs[_0xcbe8('0x68')](_0x32122b);var _0x5edbce={'channel':_0xcbe8('0x69'),'account':_0x2d728f[_0xcbe8('0x66')][_0xcbe8('0x20')],'agent':_0x2d728f[_0xcbe8('0x67')]?_0x2d728f[_0xcbe8('0x67')][_0xcbe8('0x5d')]:_0xcbe8('0x6a'),'createdAt':moment(_0x2d728f['createdAt'])[_0xcbe8('0x49')](_0xcbe8('0x4a'))[_0xcbe8('0x6b')](),'closedAt':_0x2d728f[_0xcbe8('0x6c')]?moment(_0x2d728f[_0xcbe8('0x6d')])[_0xcbe8('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcbe8('0x6b')]():'','disposition':_0x2d728f[_0xcbe8('0x6e')],'visibility':_0x2d728f[_0xcbe8('0x6f')]?'Public':_0xcbe8('0x70'),'messages':_(_0x2d728f['Messages'])['filter']({'secret':![]})[_0xcbe8('0x21')](function(_0x2737f3){if(_0x2737f3['Attachment']){var _0x1a4572=path[_0xcbe8('0x58')](_0x191e98,_0x2737f3[_0xcbe8('0x62')][_0xcbe8('0x71')]);if(fs[_0xcbe8('0x72')](_0x1a4572)){fs[_0xcbe8('0x73')](_0x1a4572)[_0xcbe8('0x74')](fs[_0xcbe8('0x75')](path[_0xcbe8('0x58')](_0x32122b,_0x2737f3[_0xcbe8('0x62')][_0xcbe8('0x71')])));}}return{'date':moment(_0x2737f3[_0xcbe8('0x76')])[_0xcbe8('0x49')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2737f3[_0xcbe8('0x63')]===_0xcbe8('0x77')?_0x2737f3[_0xcbe8('0x5c')]?_0x2737f3[_0xcbe8('0x5c')][_0xcbe8('0x5d')]:_0xcbe8('0x78'):_0x2737f3[_0xcbe8('0x5f')][_0xcbe8('0x60')]+(_0x2737f3['Contact']['lastName']?'\x20'+_0x2737f3[_0xcbe8('0x5f')][_0xcbe8('0x61')]:''),'body':_0x2737f3['Attachment']?_0x2737f3['Attachment']['basename']:_0x2737f3['body'],'direction':_0x2737f3[_0xcbe8('0x63')]===_0xcbe8('0x77')?'A':'C','secret':_0x2737f3['secret'],'read':_0x2737f3[_0xcbe8('0x79')],'attachment':_0x2737f3[_0xcbe8('0x62')]};})[_0xcbe8('0x7a')]()};return ejs['renderFile'](path[_0xcbe8('0x58')](config[_0xcbe8('0x55')],_0xcbe8('0x56'),_0xcbe8('0x7b'),_0xcbe8('0x7c')),{'interaction':_0x5edbce})[_0xcbe8('0x1c')](function(_0x261193){var _0x4e9348=path[_0xcbe8('0x58')](_0x32122b,_0xcbe8('0x7d')+_0x2d728f['id']+'-'+_0x5e7820+'.pdf');var _0x13802f={'path':_0x4e9348,'channel':'Openchannel','interactionId':_0x2d728f['id']};return pdf['createPdfFromHTML'](_0x261193,_0x13802f);})[_0xcbe8('0x1c')](function(){return new Promise(function(_0x5ce48c,_0x3f1080){zipdir(_0x32122b,{'saveTo':_0x1f66a7},function(_0x128bdd,_0x392027){if(_0x128bdd)return _0x3f1080(_0x128bdd);return _0x5ce48c(_0x392027);});})[_0xcbe8('0x1c')](function(){return new Promise(function(_0x44d943,_0x35eebb){rimraf(_0x32122b,function(_0x789405){if(_0x789405)_0x35eebb(_0x789405);return _0x44d943();});});})[_0xcbe8('0x1c')](function(){return _0xc1a85b[_0xcbe8('0x53')](_0x1f66a7,_0x43a243,function(_0x47ce08){if(_0x47ce08){logger['error'](_0xcbe8('0x7e'),_0x47ce08);}else{fs[_0xcbe8('0x7f')](_0x1f66a7);}});});});}else{return _0xc1a85b[_0xcbe8('0x11')](0xc8);}})[_0xcbe8('0x29')](handleError(_0xc1a85b,null));}; \ No newline at end of file +var _0x5106=['moment','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','index','map','OpenchannelInteraction','rawAttributes','fieldName','getOptions','findAll','openchannel','query','user','catch','show','type','from','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','files','attachments','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','threadId','Public','basename','existsSync','pipe','createWriteStream','out','System','Contact','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x5106,0x184));var _0x6510=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5106[_0x40a045];return _0x1a687c;};'use strict';var rimraf=require(_0x6510('0x0'));var zipdir=require(_0x6510('0x1'));var moment=require(_0x6510('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x6510('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x6510('0x4'));var interaction=require(_0x6510('0x5'));var qs=require(_0x6510('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x6510('0x7'))(_0x6510('0x8'));var config=require(_0x6510('0x9'));var db=require(_0x6510('0xa'))['db'];config['redis']=_['defaults'](config[_0x6510('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6510('0xc'))(new Redis(config['redis']));require(_0x6510('0xd'))[_0x6510('0xe')](socket);function respondWithStatusCode(_0x346190,_0x3a8a1b){_0x3a8a1b=_0x3a8a1b||0xcc;return function(_0x3faa56){if(_0x3faa56){return _0x346190[_0x6510('0xf')](_0x3a8a1b);}return _0x346190['status'](_0x3a8a1b)['end']();};}function respondWithResult(_0x5e5bdd,_0x464620){_0x464620=_0x464620||0xc8;return function(_0x4456ad){if(_0x4456ad){return _0x5e5bdd[_0x6510('0x10')](_0x464620)[_0x6510('0x11')](_0x4456ad);}};}function respondWithFilteredResult(_0x3deaf8,_0x31bec3){return function(_0x9daa71){if(_0x9daa71){var _0x5124eb=typeof _0x31bec3[_0x6510('0x12')]===_0x6510('0x13')&&typeof _0x31bec3[_0x6510('0x14')]===_0x6510('0x13');var _0x2e6380=_0x9daa71['count'];var _0x1ca41=_0x5124eb?0x0:_0x31bec3[_0x6510('0x12')];var _0x5cae88=_0x5124eb?_0x9daa71[_0x6510('0x15')]:_0x31bec3[_0x6510('0x12')]+_0x31bec3['limit'];var _0x9c8e5f;if(_0x5cae88>=_0x2e6380){_0x5cae88=_0x2e6380;_0x9c8e5f=0xc8;}else{_0x9c8e5f=0xce;}_0x3deaf8[_0x6510('0x10')](_0x9c8e5f);return _0x3deaf8[_0x6510('0x16')](_0x6510('0x17'),_0x1ca41+'-'+_0x5cae88+'/'+_0x2e6380)[_0x6510('0x11')](_0x9daa71);}return null;};}function saveUpdates(_0x327608){return function(_0x4bd5a8){if(_0x4bd5a8){return _0x4bd5a8[_0x6510('0x18')](_0x327608)[_0x6510('0x19')](function(_0x1b4e14){return _0x1b4e14;});}return null;};}function removeEntity(_0x57536d){return function(_0x322fca){if(_0x322fca){return _0x322fca[_0x6510('0x1a')]()['then'](function(){_0x57536d[_0x6510('0x10')](0xcc)[_0x6510('0x1b')]();});}};}function handleEntityNotFound(_0x217ab3){return function(_0x386915){if(!_0x386915){_0x217ab3[_0x6510('0xf')](0x194);}return _0x386915;};}function handleError(_0x17cc87,_0x112693){_0x112693=_0x112693||0x1f4;return function(_0x2b5b67){logger[_0x6510('0x1c')](_0x2b5b67[_0x6510('0x1d')]);if(_0x2b5b67[_0x6510('0x1e')]){delete _0x2b5b67[_0x6510('0x1e')];}_0x17cc87[_0x6510('0x10')](_0x112693)['send'](_0x2b5b67);};}exports[_0x6510('0x1f')]=function(_0x510229,_0x1a075c){var _0x5e8261={};var _0x464673=_[_0x6510('0x20')](db[_0x6510('0x21')][_0x6510('0x22')],function(_0x28f30d){return{'name':_0x28f30d[_0x6510('0x23')],'type':_0x28f30d['type']['key']};});_0x5e8261=qs[_0x6510('0x24')](_0x464673,_0x510229);return interaction[_0x6510('0x25')](_0x6510('0x26'),_0x510229[_0x6510('0x27')],_0x510229[_0x6510('0x28')],_0x5e8261,_0x464673)[_0x6510('0x19')](respondWithFilteredResult(_0x1a075c,_0x5e8261))[_0x6510('0x29')](handleError(_0x1a075c,null));};exports[_0x6510('0x2a')]=function(_0x50a3fc,_0x3c8b0b){var _0x1f9f4f={};if(_0x50a3fc[_0x6510('0x27')][_0x6510('0x2b')]&&_0x50a3fc[_0x6510('0x27')][_0x6510('0x2b')]===_0x6510('0x2c')){_0x1f9f4f['from']=_0x50a3fc[_0x6510('0x2d')]['id'];}else{_0x1f9f4f['id']=_0x50a3fc['params']['id'];}var _0x4221a0={'raw':![],'where':_0x1f9f4f},_0xf9f1b8={};_0xf9f1b8[_0x6510('0x2e')]=_[_0x6510('0x2f')](db[_0x6510('0x21')][_0x6510('0x22')]);_0xf9f1b8[_0x6510('0x27')]=_[_0x6510('0x2f')](_0x50a3fc[_0x6510('0x27')]);_0xf9f1b8[_0x6510('0x30')]=_[_0x6510('0x31')](_0xf9f1b8[_0x6510('0x2e')],_0xf9f1b8[_0x6510('0x27')]);_0x4221a0[_0x6510('0x32')]=_[_0x6510('0x31')](_0xf9f1b8[_0x6510('0x2e')],qs[_0x6510('0x33')](_0x50a3fc['query'][_0x6510('0x33')]));_0x4221a0[_0x6510('0x32')]=_0x4221a0[_0x6510('0x32')]['length']?_0x4221a0[_0x6510('0x32')]:_0xf9f1b8[_0x6510('0x2e')];if(_0x50a3fc[_0x6510('0x27')][_0x6510('0x34')]){_0x4221a0[_0x6510('0x35')]=[{'all':!![]}];}_0x4221a0=_[_0x6510('0x36')]({},_0x4221a0,_0x50a3fc[_0x6510('0x37')]);return db[_0x6510('0x21')][_0x6510('0x38')](_0x4221a0)[_0x6510('0x19')](handleEntityNotFound(_0x3c8b0b,null))[_0x6510('0x19')](respondWithResult(_0x3c8b0b,null))[_0x6510('0x29')](handleError(_0x3c8b0b,null));};exports[_0x6510('0x39')]=function(_0x541a8f,_0x3d845c){return db[_0x6510('0x21')]['create'](_0x541a8f[_0x6510('0x3a')],{})[_0x6510('0x19')](respondWithResult(_0x3d845c,0xc9))[_0x6510('0x29')](handleError(_0x3d845c,null));};exports[_0x6510('0x18')]=function(_0x27e3f3,_0x54f3a2){if(_0x27e3f3[_0x6510('0x3a')]['id']){delete _0x27e3f3['body']['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x27e3f3[_0x6510('0x2d')]['id']}})[_0x6510('0x19')](handleEntityNotFound(_0x54f3a2,null))[_0x6510('0x19')](saveUpdates(_0x27e3f3['body'],null))[_0x6510('0x19')](respondWithResult(_0x54f3a2,null))['catch'](handleError(_0x54f3a2,null));};exports['destroy']=function(_0x1253be,_0x4ade0d){return db[_0x6510('0x21')][_0x6510('0x38')]({'where':{'id':_0x1253be[_0x6510('0x2d')]['id']}})[_0x6510('0x19')](handleEntityNotFound(_0x4ade0d,null))[_0x6510('0x19')](removeEntity(_0x4ade0d,null))[_0x6510('0x29')](handleError(_0x4ade0d,null));};exports[_0x6510('0x3b')]=function(_0x17e64b,_0x9cea9b){return db['OpenchannelInteraction']['describe']()[_0x6510('0x19')](respondWithResult(_0x9cea9b,null))[_0x6510('0x29')](handleError(_0x9cea9b,null));};exports['addMessage']=function(_0x2bd017,_0x4f0920){return db[_0x6510('0x3c')][_0x6510('0x38')]({'where':{'id':_0x2bd017['params']['id']}})['then'](handleEntityNotFound(_0x4f0920,null))[_0x6510('0x19')](function(_0x4a2240){if(_0x4a2240){return _0x4a2240[_0x6510('0x3d')](_0x2bd017[_0x6510('0x3a')][_0x6510('0x3e')],_[_0x6510('0x3f')](_0x2bd017['body'],[_0x6510('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x4f0920,null))[_0x6510('0x29')](handleError(_0x4f0920,null));};exports[_0x6510('0x40')]=function(_0x326caf,_0x4269f7){var _0x3eef76={'raw':![],'where':{}};var _0x29673f={};var _0x4b9a4f={'count':0x0,'rows':[]};return db[_0x6510('0x21')][_0x6510('0x41')]({'where':{'id':_0x326caf['params']['id']}})[_0x6510('0x19')](handleEntityNotFound(_0x4269f7,null))[_0x6510('0x19')](function(_0x1bde85){if(_0x1bde85){_0x29673f[_0x6510('0x2e')]=_[_0x6510('0x2f')](db[_0x6510('0x3c')][_0x6510('0x22')]);_0x29673f[_0x6510('0x27')]=_[_0x6510('0x2f')](_0x326caf[_0x6510('0x27')]);_0x29673f[_0x6510('0x30')]=_[_0x6510('0x31')](_0x29673f[_0x6510('0x2e')],_0x29673f[_0x6510('0x27')]);_0x3eef76[_0x6510('0x32')]=_[_0x6510('0x31')](_0x29673f[_0x6510('0x2e')],qs[_0x6510('0x33')](_0x326caf[_0x6510('0x27')][_0x6510('0x33')]));_0x3eef76[_0x6510('0x32')]=_0x3eef76[_0x6510('0x32')][_0x6510('0x42')]?_0x3eef76[_0x6510('0x32')]:_0x29673f[_0x6510('0x2e')];if(!_0x326caf[_0x6510('0x27')][_0x6510('0x43')](_0x6510('0x44'))){_0x3eef76[_0x6510('0x14')]=qs[_0x6510('0x14')](_0x326caf[_0x6510('0x27')][_0x6510('0x14')]);_0x3eef76[_0x6510('0x12')]=qs[_0x6510('0x12')](_0x326caf['query'][_0x6510('0x12')]);}_0x3eef76[_0x6510('0x45')]=qs[_0x6510('0x46')](_0x326caf[_0x6510('0x27')][_0x6510('0x46')]);_0x3eef76[_0x6510('0x47')]=qs[_0x6510('0x30')](_[_0x6510('0x48')](_0x326caf[_0x6510('0x27')],_0x29673f[_0x6510('0x30')]));_0x3eef76[_0x6510('0x47')]['OpenchannelInteractionId']=_0x1bde85['id'];if(_0x326caf[_0x6510('0x27')]['filter']){_0x3eef76[_0x6510('0x47')]=_[_0x6510('0x36')](_0x3eef76[_0x6510('0x47')],{'$or':_[_0x6510('0x20')](_0x3eef76['attributes'],function(_0x3837d2){var _0x4a926b={};_0x4a926b[_0x3837d2]={'$like':'%'+_0x326caf['query'][_0x6510('0x49')]+'%'};return _0x4a926b;})});}if(_0x326caf[_0x6510('0x27')]['$gte']){var _0x58ad5a=_0x326caf[_0x6510('0x27')][_0x6510('0x4a')][_0x6510('0x4b')](',');var _0xcdae9e={};_0xcdae9e[_0x58ad5a[0x0]]={'$gte':moment(_0x58ad5a[0x1])[_0x6510('0x4c')](_0x6510('0x4d'))};_0x3eef76['where']=_['merge'](_0x3eef76['where'],_0xcdae9e);}_0x3eef76=_['merge']({},_0x3eef76,_0x326caf['options']);return db[_0x6510('0x3c')]['count']({'where':_0x3eef76['where']})['then'](function(_0x488a87){_0x4b9a4f[_0x6510('0x15')]=_0x488a87;if(_0x326caf[_0x6510('0x27')][_0x6510('0x34')]){_0x3eef76[_0x6510('0x35')]=[{'all':!![]}];}return db[_0x6510('0x3c')]['findAll'](_0x3eef76);})[_0x6510('0x19')](function(_0x479316){_0x4b9a4f[_0x6510('0x4e')]=_0x479316;return _0x4b9a4f;});}})[_0x6510('0x19')](respondWithFilteredResult(_0x4269f7,_0x3eef76))[_0x6510('0x29')](handleError(_0x4269f7,null));};exports[_0x6510('0x4f')]=function(_0x1bd919,_0x447d73){return db[_0x6510('0x21')]['find']({'where':{'id':_0x1bd919[_0x6510('0x2d')]['id']}})['then'](handleEntityNotFound(_0x447d73,null))[_0x6510('0x19')](function(_0x693185){if(_0x693185){return _0x693185['setTags'](_0x1bd919['body'][_0x6510('0x3e')],_[_0x6510('0x3f')](_0x1bd919[_0x6510('0x3a')],[_0x6510('0x3e'),'id'])||{})[_0x6510('0x50')](function(){return db[_0x6510('0x51')]['findAll']({'attributes':['id',_0x6510('0x1e'),_0x6510('0x52')],'where':{'id':_0x1bd919[_0x6510('0x3a')][_0x6510('0x3e')]}});})[_0x6510('0x19')](function(_0x418c0e){socket[_0x6510('0x53')](_0x6510('0x54'),{'id':Number(_0x1bd919[_0x6510('0x2d')]['id']),'tags':_0x418c0e||[]});return{'id':Number(_0x1bd919['params']['id']),'tags':_0x418c0e||[]};});}})[_0x6510('0x19')](respondWithResult(_0x447d73,null))['catch'](handleError(_0x447d73,null));};exports[_0x6510('0x55')]=function(_0x2facdf,_0x2ee0f9){return db[_0x6510('0x21')][_0x6510('0x38')]({'where':{'id':_0x2facdf['params']['id']}})[_0x6510('0x19')](handleEntityNotFound(_0x2ee0f9,null))[_0x6510('0x19')](function(_0x4a7a8a){if(_0x4a7a8a){return _0x4a7a8a[_0x6510('0x55')](_0x2facdf[_0x6510('0x27')][_0x6510('0x3e')]);}})[_0x6510('0x19')](respondWithStatusCode(_0x2ee0f9,null))['catch'](handleError(_0x2ee0f9,null));};exports['download']=function(_0x45ae23,_0x236706){var _0x5acadd=moment()[_0x6510('0x56')]()[_0x6510('0x57')]();var _0x3067a3=path[_0x6510('0x58')](config[_0x6510('0x59')],_0x6510('0x5a'),'files',_0x6510('0x5b'));var _0x3673f7=path[_0x6510('0x58')](config[_0x6510('0x59')],_0x6510('0x5a'),_0x6510('0x5c'),_0x6510('0x5d'));var _0x4eadd0=path[_0x6510('0x58')](_0x3067a3,_0x5acadd);var _0x3d619f=util['format']('transcript-%d-%s.zip',_0x45ae23[_0x6510('0x2d')]['id'],_0x5acadd);var _0x3a8838=path['join'](_0x3067a3,_0x3d619f);var _0x207ead=[];_0x207ead[_0x6510('0x5e')]({'model':db[_0x6510('0x5f')],'as':_0x6510('0x5f'),'attributes':['id',_0x6510('0x60')],'raw':!![]});_0x207ead[_0x6510('0x5e')]({'model':db[_0x6510('0x61')],'as':'Contact','attributes':['id',_0x6510('0x62'),_0x6510('0x63')],'raw':!![]});if(_0x45ae23[_0x6510('0x27')][_0x6510('0x5d')]){_0x207ead[_0x6510('0x5e')]({'model':db['Attachment'],'as':_0x6510('0x64'),'raw':!![]});}var _0x3a35ec=[{'model':db['OpenchannelMessage'],'as':_0x6510('0x65'),'attributes':['id',_0x6510('0x3a'),_0x6510('0x66'),_0x6510('0x67'),'secret',_0x6510('0x68')],'include':_0x207ead}];_0x3a35ec[_0x6510('0x5e')]({'model':db[_0x6510('0x69')],'as':_0x6510('0x6a'),'attributes':['id',_0x6510('0x1e')]});_0x3a35ec['push']({'model':db['User'],'as':_0x6510('0x6b'),'attributes':['id','fullname']});return db[_0x6510('0x21')][_0x6510('0x38')]({'where':{'id':_0x45ae23[_0x6510('0x2d')]['id']},'include':_0x3a35ec})[_0x6510('0x19')](handleEntityNotFound(_0x236706,null))['then'](function(_0xa6d3a7){if(_0xa6d3a7){var _0x1f075e=_0xa6d3a7['get']({'plain':!![]});fs[_0x6510('0x6c')](_0x4eadd0);var _0x32686c={'channel':_0x6510('0x6d'),'account':_0x1f075e[_0x6510('0x6a')][_0x6510('0x1e')],'agent':_0x1f075e[_0x6510('0x6b')]?_0x1f075e[_0x6510('0x6b')][_0x6510('0x60')]:_0x6510('0x6e'),'createdAt':moment(_0x1f075e[_0x6510('0x66')])[_0x6510('0x4c')](_0x6510('0x4d'))[_0x6510('0x57')](),'closedAt':_0x1f075e[_0x6510('0x6f')]?moment(_0x1f075e[_0x6510('0x70')])[_0x6510('0x4c')](_0x6510('0x4d'))[_0x6510('0x57')]():'','disposition':_0x1f075e[_0x6510('0x71')],'visibility':_0x1f075e[_0x6510('0x72')]?_0x6510('0x73'):'Private','messages':_(_0x1f075e[_0x6510('0x65')])[_0x6510('0x49')]({'secret':![]})['map'](function(_0x223536){if(_0x223536[_0x6510('0x64')]){var _0x642da4=path[_0x6510('0x58')](_0x3673f7,_0x223536[_0x6510('0x64')][_0x6510('0x74')]);if(fs[_0x6510('0x75')](_0x642da4)){fs['createReadStream'](_0x642da4)[_0x6510('0x76')](fs[_0x6510('0x77')](path[_0x6510('0x58')](_0x4eadd0,_0x223536[_0x6510('0x64')][_0x6510('0x74')])));}}return{'date':moment(_0x223536[_0x6510('0x66')])['format'](_0x6510('0x4d'))[_0x6510('0x57')](),'sender':_0x223536[_0x6510('0x67')]===_0x6510('0x78')?_0x223536[_0x6510('0x5f')]?_0x223536['User'][_0x6510('0x60')]:_0x6510('0x79'):_0x223536[_0x6510('0x7a')][_0x6510('0x62')]+(_0x223536[_0x6510('0x7a')][_0x6510('0x63')]?'\x20'+_0x223536[_0x6510('0x7a')][_0x6510('0x63')]:''),'body':_0x223536[_0x6510('0x64')]?_0x223536[_0x6510('0x64')]['basename']:_0x223536[_0x6510('0x3a')],'direction':_0x223536[_0x6510('0x67')]===_0x6510('0x78')?'A':'C','secret':_0x223536['secret'],'read':_0x223536[_0x6510('0x68')],'attachment':_0x223536[_0x6510('0x64')]};})[_0x6510('0x7b')]()};return ejs[_0x6510('0x7c')](path[_0x6510('0x58')](config[_0x6510('0x59')],_0x6510('0x5a'),_0x6510('0x7d'),'downloadInteraction.ejs'),{'interaction':_0x32686c})[_0x6510('0x19')](function(_0x301500){var _0x673d71=path[_0x6510('0x58')](_0x4eadd0,_0x6510('0x7e')+_0x1f075e['id']+'-'+_0x5acadd+_0x6510('0x7f'));var _0x3f1eb8={'path':_0x673d71,'channel':_0x6510('0x6d'),'interactionId':_0x1f075e['id']};return pdf[_0x6510('0x80')](_0x301500,_0x3f1eb8);})[_0x6510('0x19')](function(){return new Promise(function(_0x3606a5,_0x281a05){zipdir(_0x4eadd0,{'saveTo':_0x3a8838},function(_0x478e6c,_0x19423a){if(_0x478e6c)return _0x281a05(_0x478e6c);return _0x3606a5(_0x19423a);});})[_0x6510('0x19')](function(){return new Promise(function(_0x230917,_0x49172c){rimraf(_0x4eadd0,function(_0x3de07b){if(_0x3de07b)_0x49172c(_0x3de07b);return _0x230917();});});})[_0x6510('0x19')](function(){return _0x236706['download'](_0x3a8838,_0x3d619f,function(_0x30729f){if(_0x30729f){logger[_0x6510('0x1c')](_0x6510('0x81'),_0x30729f);}else{fs['unlinkSync'](_0x3a8838);}});});});}else{return _0x236706['sendStatus'](0xc8);}})[_0x6510('0x29')](handleError(_0x236706,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 1522529..a1a9d7e 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 _0xe481=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x45f870,_0xf9f9fc){var _0x303cf0=function(_0x5e86d6){while(--_0x5e86d6){_0x45f870['push'](_0x45f870['shift']());}};_0x303cf0(++_0xf9f9fc);}(_0xe481,0x7c));var _0x1e48=function(_0x2042ee,_0x1a1e0a){_0x2042ee=_0x2042ee-0x0;var _0xe57ee7=_0xe481[_0x2042ee];return _0xe57ee7;};'use strict';var EventEmitter=require(_0x1e48('0x0'));var OpenchannelInteraction=require(_0x1e48('0x1'))['db'][_0x1e48('0x2')];var OpenchannelMessage=require(_0x1e48('0x1'))['db'][_0x1e48('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1e48('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e48('0x5'),'afterDestroy':_0x1e48('0x6')};function emitEvent(_0x2d4a2a){return function(_0x592672,_0x3e5a75,_0x2aad3c){_0x592672['getUsers']({'attributes':['id'],'raw':!![]})[_0x1e48('0x7')](function(_0x53618c){_0x592672['setDataValue'](_0x1e48('0x8'),_0x53618c[_0x1e48('0x9')](function(_0x53fb2f){return{'id':_0x53fb2f['id']};}));return OpenchannelMessage[_0x1e48('0xa')]({'where':{'OpenchannelInteractionId':_0x592672['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e48('0x7')](function(_0x21eb21){_0x592672[_0x1e48('0xb')](_0x1e48('0xc'),_0x21eb21[_0x1e48('0xd')]);OpenchannelInteractionEvents[_0x1e48('0xe')](_0x2d4a2a+':'+_0x592672['id'],_0x592672);OpenchannelInteractionEvents[_0x1e48('0xe')](_0x2d4a2a,_0x592672);_0x2aad3c(null);})[_0x1e48('0xf')](_0x2aad3c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x1e48('0x10')](e,emitEvent(event));}}module[_0x1e48('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x56a3=['exports','events','OpenchannelInteraction','OpenchannelMessage','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x3b12bf,_0x16d6b4){var _0x320dfd=function(_0x57c7f2){while(--_0x57c7f2){_0x3b12bf['push'](_0x3b12bf['shift']());}};_0x320dfd(++_0x16d6b4);}(_0x56a3,0xef));var _0x356a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56a3[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x356a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x356a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x356a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x356a('0x3'),'afterDestroy':_0x356a('0x4')};function emitEvent(_0x1dca1e){return function(_0x23cd18,_0x23fb13,_0x5d065b){_0x23cd18['getUsers']({'attributes':['id'],'raw':!![]})[_0x356a('0x5')](function(_0x239f4e){_0x23cd18[_0x356a('0x6')](_0x356a('0x7'),_0x239f4e[_0x356a('0x8')](function(_0xb64824){return{'id':_0xb64824['id']};}));return OpenchannelMessage[_0x356a('0x9')]({'where':{'OpenchannelInteractionId':_0x23cd18['id'],'direction':'in','read':![]},'raw':!![]});})[_0x356a('0x5')](function(_0x291c1b){_0x23cd18[_0x356a('0x6')](_0x356a('0xa'),_0x291c1b[_0x356a('0xb')]);OpenchannelInteractionEvents['emit'](_0x1dca1e+':'+_0x23cd18['id'],_0x23cd18);OpenchannelInteractionEvents[_0x356a('0xc')](_0x1dca1e,_0x23cd18);_0x5d065b(null);})[_0x356a('0xd')](_0x5d065b(null));};}for(var e in events){if(events[_0x356a('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x356a('0xf')](e,emitEvent(event));}}module[_0x356a('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 875fc9e..65adcc0 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 _0xeb39=['path','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x20f060,_0xe160c9){var _0x46077c=function(_0x3c615a){while(--_0x3c615a){_0x20f060['push'](_0x20f060['shift']());}};_0x46077c(++_0xe160c9);}(_0xeb39,0x1a4));var _0x9eb3=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xeb39[_0xcfd89f];return _0x59acd4;};'use strict';var _=require(_0x9eb3('0x0'));var util=require(_0x9eb3('0x1'));var logger=require(_0x9eb3('0x2'))('api');var moment=require(_0x9eb3('0x3'));var BPromise=require(_0x9eb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9eb3('0x5'));var rimraf=require('rimraf');var config=require(_0x9eb3('0x6'));var attributes=require(_0x9eb3('0x7'));module[_0x9eb3('0x8')]=function(_0x55dd5e,_0x2ff8b6){return _0x55dd5e[_0x9eb3('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x9eb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9eb3('0xb'),'collate':_0x9eb3('0xc'),'hooks':{'beforeUpdate':function(_0x287fde,_0x1182d0,_0x3cce64){if(_0x287fde['changed'](_0x9eb3('0xd'))){_0x287fde[_0x9eb3('0xe')]=moment()[_0x9eb3('0xf')](_0x9eb3('0x10'));}_0x3cce64(null,_0x287fde);}}});}; \ No newline at end of file +var _0x0880=['utf8mb4_unicode_ci','closed','closedAt','lodash','../../config/logger','moment','rimraf','define','OpenchannelInteraction','openchannel_interactions','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0880,0x7c));var _0x0088=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x0880[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0x0088('0x0'));var util=require('util');var logger=require(_0x0088('0x1'))('api');var moment=require(_0x0088('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0088('0x3'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x57f679,_0x53bf5d){return _0x57f679[_0x0088('0x4')](_0x0088('0x5'),attributes,{'tableName':_0x0088('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0088('0x7'),'collate':_0x0088('0x8'),'hooks':{'beforeUpdate':function(_0x5ccfb8,_0xe44674,_0x30201b){if(_0x5ccfb8['changed'](_0x0088('0x9'))){_0x5ccfb8[_0x0088('0xa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x30201b(null,_0x5ccfb8);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4aa9712..0cc5950 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 _0x625c=['UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x2bf9ae,_0x270fda){var _0x23c251=function(_0x3be086){while(--_0x3be086){_0x2bf9ae['push'](_0x2bf9ae['shift']());}};_0x23c251(++_0x270fda);}(_0x625c,0x19c));var _0xc625=function(_0x37ad24,_0x20a62f){_0x37ad24=_0x37ad24-0x0;var _0x49335b=_0x625c[_0x37ad24];return _0x49335b;};'use strict';var _=require(_0xc625('0x0'));var util=require(_0xc625('0x1'));var moment=require(_0xc625('0x2'));var BPromise=require(_0xc625('0x3'));var rs=require(_0xc625('0x4'));var fs=require('fs');var Redis=require(_0xc625('0x5'));var db=require(_0xc625('0x6'))['db'];var utils=require(_0xc625('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc625('0x8'));var client=jayson[_0xc625('0x9')][_0xc625('0xa')]({'port':0x232a});config[_0xc625('0xb')]=_[_0xc625('0xc')](config['redis'],{'host':_0xc625('0xd'),'port':0x18eb});var socket=require(_0xc625('0xe'))(new Redis(config[_0xc625('0xb')]));require(_0xc625('0xf'))[_0xc625('0x10')](socket);function respondWithRpcPromise(_0x1b3906,_0x1f5806,_0x554b19){return new BPromise(function(_0xb3d76,_0x492858){return client[_0xc625('0x11')](_0x1b3906,_0x554b19)[_0xc625('0x12')](function(_0x3e8ce5){logger[_0xc625('0x13')](_0xc625('0x14'),_0x1f5806,_0xc625('0x15'));logger['debug'](_0xc625('0x16'),_0x1f5806,_0xc625('0x15'),JSON[_0xc625('0x17')](_0x3e8ce5));if(_0x3e8ce5[_0xc625('0x18')]){if(_0x3e8ce5[_0xc625('0x18')][_0xc625('0x19')]===0x1f4){logger[_0xc625('0x18')](_0xc625('0x14'),_0x1f5806,_0x3e8ce5[_0xc625('0x18')][_0xc625('0x1a')]);return _0x492858(_0x3e8ce5['error'][_0xc625('0x1a')]);}logger[_0xc625('0x18')](_0xc625('0x14'),_0x1f5806,_0x3e8ce5['error'][_0xc625('0x1a')]);return _0xb3d76(_0x3e8ce5[_0xc625('0x18')][_0xc625('0x1a')]);}else{logger['info'](_0xc625('0x14'),_0x1f5806,_0xc625('0x15'));_0xb3d76(_0x3e8ce5['result'][_0xc625('0x1a')]);}})[_0xc625('0x1b')](function(_0x42bbfe){logger[_0xc625('0x18')](_0xc625('0x14'),_0x1f5806,_0x42bbfe);_0x492858(_0x42bbfe);});});}exports[_0xc625('0x1c')]=function(_0x2c7422){var _0x422e4f=this;return new Promise(function(_0x522855,_0x352235){return db[_0xc625('0x1d')][_0xc625('0x1e')](_0x2c7422[_0xc625('0x1f')],{'raw':_0x2c7422[_0xc625('0x20')]?_0x2c7422[_0xc625('0x20')][_0xc625('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c7422['options']?_0x2c7422[_0xc625('0x20')][_0xc625('0x22')]||null:null,'attributes':_0x2c7422[_0xc625('0x20')]?_0x2c7422[_0xc625('0x20')][_0xc625('0x23')]||null:null,'limit':_0x2c7422['options']?_0x2c7422['options'][_0xc625('0x24')]||null:null})[_0xc625('0x12')](function(_0x6f3f67){logger[_0xc625('0x13')]('UpdateOpenchannelInteraction',_0x2c7422);logger['debug']('UpdateOpenchannelInteraction',_0x2c7422,JSON[_0xc625('0x17')](_0x6f3f67));_0x522855(_0x6f3f67);})[_0xc625('0x1b')](function(_0x1086e6){logger['error'](_0xc625('0x1c'),_0x1086e6[_0xc625('0x1a')],_0x2c7422);_0x352235(_0x422e4f[_0xc625('0x18')](0x1f4,_0x1086e6[_0xc625('0x1a')]));});});};exports[_0xc625('0x25')]=function(_0x57b94a){return new Promise(function(_0x9b1ccd,_0x34a1f2){return db[_0xc625('0x1d')]['find']({'where':_0x57b94a[_0xc625('0x20')]?_0x57b94a[_0xc625('0x20')][_0xc625('0x22')]||null:null})[_0xc625('0x12')](function(_0x2a9402){if(_0x2a9402){return _0x2a9402[_0xc625('0x26')](_0x57b94a[_0xc625('0x1f')][_0xc625('0x27')],_[_0xc625('0x28')](_0x57b94a[_0xc625('0x1f')],[_0xc625('0x27'),'id'])||{});}})[_0xc625('0x29')](function(_0x8d6dd4){logger[_0xc625('0x13')](_0xc625('0x2a'),_0x57b94a);logger[_0xc625('0x2b')](_0xc625('0x2a'),_0x57b94a,JSON[_0xc625('0x17')](_0x8d6dd4));_0x9b1ccd(_0x8d6dd4);})[_0xc625('0x1b')](function(_0xde71bc){logger['error'](_0xc625('0x2a'),_0xde71bc[_0xc625('0x1a')],_0x57b94a);_0x34a1f2(_this[_0xc625('0x18')](0x1f4,_0xde71bc[_0xc625('0x1a')]));});});}; \ No newline at end of file +var _0x5fe0=['omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','OpenchannelInteraction','update','body','options','raw','where','limit','UpdateOpenchannelInteraction','catch','find','addTags','ids'];(function(_0x20f877,_0x5c32af){var _0x5de151=function(_0x4d44de){while(--_0x4d44de){_0x20f877['push'](_0x20f877['shift']());}};_0x5de151(++_0x5c32af);}(_0x5fe0,0x133));var _0x05fe=function(_0x5d792d,_0x52d15d){_0x5d792d=_0x5d792d-0x0;var _0x10a206=_0x5fe0[_0x5d792d];return _0x10a206;};'use strict';var _=require(_0x05fe('0x0'));var util=require(_0x05fe('0x1'));var moment=require('moment');var BPromise=require(_0x05fe('0x2'));var rs=require(_0x05fe('0x3'));var fs=require('fs');var Redis=require(_0x05fe('0x4'));var db=require(_0x05fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x05fe('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x05fe('0x7'));var client=jayson[_0x05fe('0x8')]['http']({'port':0x232a});config[_0x05fe('0x9')]=_[_0x05fe('0xa')](config[_0x05fe('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x05fe('0xb'))(new Redis(config[_0x05fe('0x9')]));require(_0x05fe('0xc'))[_0x05fe('0xd')](socket);function respondWithRpcPromise(_0x1f9bad,_0x465f1a,_0x5b65a6){return new BPromise(function(_0xdd99bb,_0x505417){return client['request'](_0x1f9bad,_0x5b65a6)[_0x05fe('0xe')](function(_0x140676){logger['info'](_0x05fe('0xf'),_0x465f1a,_0x05fe('0x10'));logger[_0x05fe('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x465f1a,_0x05fe('0x10'),JSON[_0x05fe('0x12')](_0x140676));if(_0x140676[_0x05fe('0x13')]){if(_0x140676['error']['code']===0x1f4){logger[_0x05fe('0x13')](_0x05fe('0xf'),_0x465f1a,_0x140676[_0x05fe('0x13')][_0x05fe('0x14')]);return _0x505417(_0x140676[_0x05fe('0x13')][_0x05fe('0x14')]);}logger[_0x05fe('0x13')](_0x05fe('0xf'),_0x465f1a,_0x140676['error']['message']);return _0xdd99bb(_0x140676[_0x05fe('0x13')][_0x05fe('0x14')]);}else{logger[_0x05fe('0x15')](_0x05fe('0xf'),_0x465f1a,_0x05fe('0x10'));_0xdd99bb(_0x140676[_0x05fe('0x16')][_0x05fe('0x14')]);}})['catch'](function(_0xf8d7ac){logger[_0x05fe('0x13')](_0x05fe('0xf'),_0x465f1a,_0xf8d7ac);_0x505417(_0xf8d7ac);});});}exports['UpdateOpenchannelInteraction']=function(_0x317ebc){var _0x2d8d7b=this;return new Promise(function(_0x4dbf5e,_0x50ba2c){return db[_0x05fe('0x17')][_0x05fe('0x18')](_0x317ebc[_0x05fe('0x19')],{'raw':_0x317ebc[_0x05fe('0x1a')]?_0x317ebc['options'][_0x05fe('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x317ebc[_0x05fe('0x1a')]?_0x317ebc[_0x05fe('0x1a')][_0x05fe('0x1c')]||null:null,'attributes':_0x317ebc[_0x05fe('0x1a')]?_0x317ebc[_0x05fe('0x1a')]['attributes']||null:null,'limit':_0x317ebc['options']?_0x317ebc[_0x05fe('0x1a')][_0x05fe('0x1d')]||null:null})[_0x05fe('0xe')](function(_0x19bf60){logger[_0x05fe('0x15')]('UpdateOpenchannelInteraction',_0x317ebc);logger[_0x05fe('0x11')](_0x05fe('0x1e'),_0x317ebc,JSON[_0x05fe('0x12')](_0x19bf60));_0x4dbf5e(_0x19bf60);})[_0x05fe('0x1f')](function(_0x2b1410){logger[_0x05fe('0x13')](_0x05fe('0x1e'),_0x2b1410[_0x05fe('0x14')],_0x317ebc);_0x50ba2c(_0x2d8d7b[_0x05fe('0x13')](0x1f4,_0x2b1410[_0x05fe('0x14')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x130156){return new Promise(function(_0x3940e8,_0x390c03){return db[_0x05fe('0x17')][_0x05fe('0x20')]({'where':_0x130156[_0x05fe('0x1a')]?_0x130156[_0x05fe('0x1a')][_0x05fe('0x1c')]||null:null})[_0x05fe('0xe')](function(_0x4c5876){if(_0x4c5876){return _0x4c5876[_0x05fe('0x21')](_0x130156['body'][_0x05fe('0x22')],_[_0x05fe('0x23')](_0x130156[_0x05fe('0x19')],[_0x05fe('0x22'),'id'])||{});}})[_0x05fe('0x24')](function(_0x5ddbc0){logger[_0x05fe('0x15')](_0x05fe('0x25'),_0x130156);logger[_0x05fe('0x11')](_0x05fe('0x25'),_0x130156,JSON['stringify'](_0x5ddbc0));_0x3940e8(_0x5ddbc0);})[_0x05fe('0x1f')](function(_0x15e53e){logger[_0x05fe('0x13')](_0x05fe('0x25'),_0x15e53e[_0x05fe('0x14')],_0x130156);_0x390c03(_this[_0x05fe('0x13')](0x1f4,_0x15e53e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3f9a530..6fe0886 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 _0x0029=['remove','update','emit','removeListener','register','length','openchannelInteraction:','save'];(function(_0x21dbe7,_0x22f166){var _0x195133=function(_0x386076){while(--_0x386076){_0x21dbe7['push'](_0x21dbe7['shift']());}};_0x195133(++_0x22f166);}(_0x0029,0xcf));var _0x9002=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x0029[_0x20c9b2];return _0x2c6030;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x9002('0x0'),_0x9002('0x1'),_0x9002('0x2')];function createListener(_0x47014b,_0x22e8fd){return function(_0x6ff2bf){_0x22e8fd[_0x9002('0x3')](_0x47014b,_0x6ff2bf);};}function removeListener(_0x4a7669,_0x5742f4){return function(){OpenchannelInteractionEvents[_0x9002('0x4')](_0x4a7669,_0x5742f4);};}exports[_0x9002('0x5')]=function(_0x4522d1){for(var _0x40f171=0x0,_0xf71c=events[_0x9002('0x6')];_0x40f171<_0xf71c;_0x40f171++){var _0x14dc5b=events[_0x40f171];var _0x54d708=createListener(_0x9002('0x7')+_0x14dc5b,_0x4522d1);OpenchannelInteractionEvents['on'](_0x14dc5b,_0x54d708);}}; \ No newline at end of file +var _0x44b7=['update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0x44b7,0x1d1));var _0x744b=function(_0x5c586b,_0x5b8b3b){_0x5c586b=_0x5c586b-0x0;var _0x518867=_0x44b7[_0x5c586b];return _0x518867;};'use strict';var OpenchannelInteractionEvents=require(_0x744b('0x0'));var events=[_0x744b('0x1'),_0x744b('0x2'),_0x744b('0x3')];function createListener(_0x2164a1,_0x25595e){return function(_0x4a62b0){_0x25595e[_0x744b('0x4')](_0x2164a1,_0x4a62b0);};}function removeListener(_0x40ee1f,_0x3af4a){return function(){OpenchannelInteractionEvents[_0x744b('0x5')](_0x40ee1f,_0x3af4a);};}exports[_0x744b('0x6')]=function(_0x226b49){for(var _0x5da967=0x0,_0x3d2af3=events[_0x744b('0x7')];_0x5da967<_0x3d2af3;_0x5da967++){var _0x4f9512=events[_0x5da967];var _0x560554=createListener(_0x744b('0x8')+_0x4f9512,_0x226b49);OpenchannelInteractionEvents['on'](_0x4f9512,_0x560554);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8656078..e7a7e83 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(_0x7efe31,_0x1b42d3){var _0x59ea5a=function(_0x299f73){while(--_0x299f73){_0x7efe31['push'](_0x7efe31['shift']());}};_0x59ea5a(++_0x1b42d3);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x41614c,_0xd072c0){_0x41614c=_0x41614c-0x0;var _0x253308=_0x70e0[_0x41614c];return _0x253308;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3916f51..e72659b 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 _0x0b0e=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x15797a,_0x16274f){var _0x3e2618=function(_0x2b6e99){while(--_0x2b6e99){_0x15797a['push'](_0x15797a['shift']());}};_0x3e2618(++_0x16274f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x92d580,_0x4928fb){_0x92d580=_0x92d580-0x0;var _0x4ee344=_0x0b0e[_0x92d580];return _0x4ee344;};'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 _0x8130=['BOOLEAN','ENUM','out','STRING','sequelize','exports','medium'];(function(_0x5ac137,_0xcfe00a){var _0x58e835=function(_0x389aed){while(--_0x389aed){_0x5ac137['push'](_0x5ac137['shift']());}};_0x58e835(++_0xcfe00a);}(_0x8130,0x146));var _0x0813=function(_0x37e319,_0x62c8c3){_0x37e319=_0x37e319-0x0;var _0x48a785=_0x8130[_0x37e319];return _0x48a785;};'use strict';var Sequelize=require(_0x0813('0x0'));module[_0x0813('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0813('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0813('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0813('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0813('0x4')]('in',_0x0813('0x5')),'defaultValue':_0x0813('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0813('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index ac71a2c..a2e60fb 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 _0x282f=['send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelMessage','rows','catch','show','params','keys','fields','create','body','find','destroy','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','ContactId','QueryTypes','rejectmessage','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','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','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','undefined','offset','count','limit','set','reject','save','update','then','stack','name'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x282f,0x153));var _0xf282=function(_0x41f99d,_0x4659fe){_0x41f99d=_0x41f99d-0x0;var _0x33d65a=_0x282f[_0x41f99d];return _0x33d65a;};'use strict';var emlformat=require(_0xf282('0x0'));var rimraf=require(_0xf282('0x1'));var zipdir=require(_0xf282('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf282('0x3'));var moment=require('moment');var BPromise=require(_0xf282('0x4'));var Mustache=require(_0xf282('0x5'));var util=require(_0xf282('0x6'));var path=require(_0xf282('0x7'));var sox=require('sox');var csv=require(_0xf282('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf282('0x9'));var _=require(_0xf282('0xa'));var squel=require(_0xf282('0xb'));var crypto=require(_0xf282('0xc'));var jsforce=require(_0xf282('0xd'));var deskjs=require(_0xf282('0xe'));var toCsv=require(_0xf282('0x8'));var querystring=require(_0xf282('0xf'));var Papa=require('papaparse');var Redis=require(_0xf282('0x10'));var authService=require(_0xf282('0x11'));var qs=require(_0xf282('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf282('0x13'));var logger=require(_0xf282('0x14'))(_0xf282('0x15'));var utils=require(_0xf282('0x16'));var config=require(_0xf282('0x17'));var licenseUtil=require(_0xf282('0x18'));var db=require(_0xf282('0x19'))['db'];config[_0xf282('0x1a')]=_[_0xf282('0x1b')](config[_0xf282('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf282('0x1c'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xf282('0x1d')](socket);var jayson=require(_0xf282('0x1e'));var client=jayson[_0xf282('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xf282('0x1f')][_0xf282('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5afb51,_0x161d7c,_0x1c6628,_0x4065f0){return new BPromise(function(_0x5054be,_0x3c9710){var _0x3c44d3=_0x4065f0||client;return _0x3c44d3[_0xf282('0x21')](_0x5afb51,_0x1c6628)['then'](function(_0x209931){logger[_0xf282('0x22')](_0xf282('0x23'),_0x161d7c,_0xf282('0x24'));logger[_0xf282('0x25')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x161d7c,'request\x20sent',JSON['stringify'](_0x209931));if(_0x209931[_0xf282('0x26')]){if(_0x209931[_0xf282('0x26')][_0xf282('0x27')]===0x1f4){logger['error'](_0xf282('0x23'),_0x161d7c,_0x209931[_0xf282('0x26')][_0xf282('0x28')]);return _0x3c9710(_0x209931[_0xf282('0x26')][_0xf282('0x28')]);}logger[_0xf282('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x161d7c,_0x209931[_0xf282('0x26')]['message']);return _0x5054be(_0x209931[_0xf282('0x26')][_0xf282('0x28')]);}else{logger[_0xf282('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x161d7c,_0xf282('0x24'));_0x5054be(_0x209931[_0xf282('0x29')][_0xf282('0x28')]);}})['catch'](function(_0x590dd9){logger[_0xf282('0x26')](_0xf282('0x23'),_0x161d7c,_0x590dd9);_0x3c9710(_0x590dd9);});});}function respondWithStatusCode(_0x4823c5,_0xc55e6d){_0xc55e6d=_0xc55e6d||0xcc;return function(_0x2ea486){if(_0x2ea486){return _0x4823c5[_0xf282('0x2a')](_0xc55e6d);}return _0x4823c5[_0xf282('0x2b')](_0xc55e6d)[_0xf282('0x2c')]();};}function respondWithResult(_0x1d31d1,_0x538808){_0x538808=_0x538808||0xc8;return function(_0x3c99aa){if(_0x3c99aa){return _0x1d31d1['status'](_0x538808)[_0xf282('0x2d')](_0x3c99aa);}};}function respondWithFilteredResult(_0x30e4dc,_0x231424){return function(_0x69b2db){if(_0x69b2db){var _0x195c7c=typeof _0x231424['offset']===_0xf282('0x2e')&&typeof _0x231424['limit']===_0xf282('0x2e');var _0x2b1c6f=_0x69b2db['count'];var _0x219d75=_0x195c7c?0x0:_0x231424[_0xf282('0x2f')];var _0x4aee21=_0x195c7c?_0x69b2db[_0xf282('0x30')]:_0x231424[_0xf282('0x2f')]+_0x231424[_0xf282('0x31')];var _0x18bf47;if(_0x4aee21>=_0x2b1c6f){_0x4aee21=_0x2b1c6f;_0x18bf47=0xc8;}else{_0x18bf47=0xce;}_0x30e4dc[_0xf282('0x2b')](_0x18bf47);return _0x30e4dc[_0xf282('0x32')]('Content-Range',_0x219d75+'-'+_0x4aee21+'/'+_0x2b1c6f)[_0xf282('0x2d')](_0x69b2db);}return null;};}function patchUpdates(_0x39b6d3){return function(_0x462102){try{jsonpatch['apply'](_0x462102,_0x39b6d3,!![]);}catch(_0x12a96e){return BPromise[_0xf282('0x33')](_0x12a96e);}return _0x462102[_0xf282('0x34')]();};}function saveUpdates(_0x4ac378,_0x44ff35){return function(_0x11f432){if(_0x11f432){return _0x11f432[_0xf282('0x35')](_0x4ac378)[_0xf282('0x36')](function(_0x443cf4){return _0x443cf4;});}return null;};}function removeEntity(_0x179554,_0x51160a){return function(_0x5065be){if(_0x5065be){return _0x5065be['destroy']()['then'](function(){_0x179554[_0xf282('0x2b')](0xcc)[_0xf282('0x2c')]();});}};}function handleEntityNotFound(_0x5f508e,_0x852122){return function(_0xb3a69c){if(!_0xb3a69c){_0x5f508e[_0xf282('0x2a')](0x194);}return _0xb3a69c;};}function handleError(_0x306e31,_0xf6af28){_0xf6af28=_0xf6af28||0x1f4;return function(_0x42ca93){logger[_0xf282('0x26')](_0x42ca93[_0xf282('0x37')]);if(_0x42ca93[_0xf282('0x38')]){delete _0x42ca93[_0xf282('0x38')];}_0x306e31['status'](_0xf6af28)[_0xf282('0x39')](_0x42ca93);};}exports[_0xf282('0x3a')]=function(_0x167981,_0x1aaa77){var _0x4e8540={},_0x463bcd={},_0x5818be={'count':0x0,'rows':[]};var _0x1f370f=_[_0xf282('0x3b')](db['OpenchannelMessage']['rawAttributes'],function(_0x59424d){return{'name':_0x59424d[_0xf282('0x3c')],'type':_0x59424d[_0xf282('0x3d')][_0xf282('0x3e')]};});_0x463bcd[_0xf282('0x3f')]=_[_0xf282('0x3b')](_0x1f370f,_0xf282('0x38'));_0x463bcd[_0xf282('0x40')]=_['keys'](_0x167981[_0xf282('0x40')]);_0x463bcd[_0xf282('0x41')]=_['intersection'](_0x463bcd[_0xf282('0x3f')],_0x463bcd['query']);_0x4e8540['attributes']=_[_0xf282('0x42')](_0x463bcd[_0xf282('0x3f')],qs['fields'](_0x167981[_0xf282('0x40')]['fields']));_0x4e8540[_0xf282('0x43')]=_0x4e8540['attributes'][_0xf282('0x44')]?_0x4e8540['attributes']:_0x463bcd[_0xf282('0x3f')];if(!_0x167981[_0xf282('0x40')]['hasOwnProperty'](_0xf282('0x45'))){_0x4e8540[_0xf282('0x31')]=qs[_0xf282('0x31')](_0x167981[_0xf282('0x40')][_0xf282('0x31')]);_0x4e8540[_0xf282('0x2f')]=qs['offset'](_0x167981[_0xf282('0x40')][_0xf282('0x2f')]);}_0x4e8540[_0xf282('0x46')]=qs[_0xf282('0x47')](_0x167981[_0xf282('0x40')]['sort']);_0x4e8540[_0xf282('0x48')]=qs['filters'](_[_0xf282('0x49')](_0x167981[_0xf282('0x40')],_0x463bcd['filters']),_0x1f370f);if(_0x167981['query'][_0xf282('0x4a')]){_0x4e8540[_0xf282('0x48')]=_[_0xf282('0x4b')](_0x4e8540[_0xf282('0x48')],{'$or':_[_0xf282('0x3b')](_0x1f370f,function(_0x37d30b){if(_0x37d30b[_0xf282('0x3d')]!==_0xf282('0x4c')){var _0x385635={};_0x385635[_0x37d30b[_0xf282('0x38')]]={'$like':'%'+_0x167981[_0xf282('0x40')]['filter']+'%'};return _0x385635;}})});}_0x4e8540=_['merge']({},_0x4e8540,_0x167981[_0xf282('0x4d')]);var _0x577b36={'where':_0x4e8540['where']};return db['OpenchannelMessage'][_0xf282('0x30')](_0x577b36)[_0xf282('0x36')](function(_0x51df64){_0x5818be[_0xf282('0x30')]=_0x51df64;if(_0x167981[_0xf282('0x40')][_0xf282('0x4e')]){_0x4e8540[_0xf282('0x4f')]=[{'all':!![]}];}return db[_0xf282('0x50')]['findAll'](_0x4e8540);})[_0xf282('0x36')](function(_0x310c02){_0x5818be[_0xf282('0x51')]=_0x310c02;return _0x5818be;})['then'](respondWithFilteredResult(_0x1aaa77,_0x4e8540))[_0xf282('0x52')](handleError(_0x1aaa77,null));};exports[_0xf282('0x53')]=function(_0x2ac0ce,_0x46f035){var _0x422a55={'raw':!![],'where':{'id':_0x2ac0ce[_0xf282('0x54')]['id']}},_0x595230={};_0x595230[_0xf282('0x3f')]=_['keys'](db[_0xf282('0x50')]['rawAttributes']);_0x595230['query']=_[_0xf282('0x55')](_0x2ac0ce[_0xf282('0x40')]);_0x595230[_0xf282('0x41')]=_[_0xf282('0x42')](_0x595230[_0xf282('0x3f')],_0x595230['query']);_0x422a55['attributes']=_[_0xf282('0x42')](_0x595230[_0xf282('0x3f')],qs[_0xf282('0x56')](_0x2ac0ce[_0xf282('0x40')][_0xf282('0x56')]));_0x422a55[_0xf282('0x43')]=_0x422a55[_0xf282('0x43')][_0xf282('0x44')]?_0x422a55[_0xf282('0x43')]:_0x595230['model'];if(_0x2ac0ce['query'][_0xf282('0x4e')]){_0x422a55[_0xf282('0x4f')]=[{'all':!![]}];}_0x422a55=_['merge']({},_0x422a55,_0x2ac0ce[_0xf282('0x4d')]);return db[_0xf282('0x50')]['find'](_0x422a55)['then'](handleEntityNotFound(_0x46f035,null))[_0xf282('0x36')](respondWithResult(_0x46f035,null))[_0xf282('0x52')](handleError(_0x46f035,null));};exports[_0xf282('0x57')]=function(_0x253751,_0x5ee46c){return db[_0xf282('0x50')]['create'](_0x253751[_0xf282('0x58')],{})[_0xf282('0x36')](respondWithResult(_0x5ee46c,0xc9))['catch'](handleError(_0x5ee46c,null));};exports[_0xf282('0x35')]=function(_0x534716,_0x237fe0){if(_0x534716[_0xf282('0x58')]['id']){delete _0x534716[_0xf282('0x58')]['id'];}return db[_0xf282('0x50')][_0xf282('0x59')]({'where':{'id':_0x534716['params']['id']}})[_0xf282('0x36')](handleEntityNotFound(_0x237fe0,null))[_0xf282('0x36')](saveUpdates(_0x534716[_0xf282('0x58')],null))['then'](respondWithResult(_0x237fe0,null))[_0xf282('0x52')](handleError(_0x237fe0,null));};exports[_0xf282('0x5a')]=function(_0x30711c,_0x1982f8){return db[_0xf282('0x50')][_0xf282('0x59')]({'where':{'id':_0x30711c[_0xf282('0x54')]['id']}})['then'](handleEntityNotFound(_0x1982f8,null))[_0xf282('0x36')](removeEntity(_0x1982f8,null))[_0xf282('0x52')](handleError(_0x1982f8,null));};exports['describe']=function(_0x5bacb0,_0x1377d7){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x1377d7,null))[_0xf282('0x52')](handleError(_0x1377d7,null));};var interaction_log=require(_0xf282('0x14'))(_0xf282('0x5b'));exports[_0xf282('0x5c')]=function(_0x5d28cc,_0x5bad22,_0x21c596){var _0x30c7a5={'agent':{},'channel':_0xf282('0x5d')};if(_0x5d28cc[_0xf282('0x58')]['id']){delete _0x5d28cc['body']['id'];}_0x5d28cc['body'][_0xf282('0x5e')]=!![];_0x5d28cc[_0xf282('0x58')][_0xf282('0x5f')]=moment()['format'](_0xf282('0x60'));_0x5d28cc['body'][_0xf282('0x61')]=_0x5d28cc[_0xf282('0x58')][_0xf282('0x61')]||_0x5d28cc[_0xf282('0x62')]['id'];_0x30c7a5[_0xf282('0x63')]['id']=_0x5d28cc['body'][_0xf282('0x61')];return db[_0xf282('0x50')][_0xf282('0x59')]({'where':{'id':_0x5d28cc[_0xf282('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5bad22,null))[_0xf282('0x36')](saveUpdates(_0x5d28cc[_0xf282('0x58')],null))[_0xf282('0x36')](function(_0x5f55d9){if(_0x5f55d9){_0x30c7a5[_0xf282('0x28')]=_0x5f55d9[_0xf282('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0xf282('0x59')]({'where':{'id':_0x5f55d9['OpenchannelInteractionId']}});}return null;})[_0xf282('0x36')](handleEntityNotFound(_0x5bad22,null))[_0xf282('0x36')](function(_0x358f20){if(_0x358f20){return _0x358f20[_0xf282('0x35')]({'UserId':_0x5d28cc['body'][_0xf282('0x61')],'read1stAt':_[_0xf282('0x65')](_0x358f20[_0xf282('0x66')])?moment()['format'](_0xf282('0x60')):undefined});}return null;})[_0xf282('0x36')](function(_0x3021b9){if(_0x3021b9){_0x30c7a5[_0xf282('0x67')]=_0x3021b9[_0xf282('0x64')]({'plain':!![]});interaction_log[_0xf282('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d28cc['user']['id'],_0x5d28cc[_0xf282('0x62')][_0xf282('0x38')],_0x5d28cc[_0xf282('0x62')][_0xf282('0x68')],_0x30c7a5[_0xf282('0x67')]['id'],_0x5d28cc[_0xf282('0x58')]?JSON['stringify'](_0x5d28cc[_0xf282('0x58')]):_0xf282('0x69'));return respondWithRpcPromise(_0xf282('0x6a'),_0xf282('0x6b'),_0x30c7a5);}return null;})[_0xf282('0x36')](function(_0x22f2f6){var _0x33a92e=_0xf282('0x6c')+_0x22f2f6[_0xf282('0x28')]['ContactId'];return db[_0xf282('0x6d')][_0xf282('0x40')](_0x33a92e,{'type':db[_0xf282('0x6e')]['QueryTypes'][_0xf282('0x6f')],'raw':!![]})[_0xf282('0x36')](function(_0x1ce78b){return _0x1ce78b;});})[_0xf282('0x36')](function(_0xf5bca){if(_0xf5bca){_0x30c7a5[_0xf282('0x28')][_0xf282('0x70')]=_0xf5bca[0x0];if(!_0x5d28cc[_0xf282('0x58')][_0xf282('0x61')])return;return db[_0xf282('0x71')]['find']({'where':{'id':_0x5d28cc['body'][_0xf282('0x61')],'role':_0xf282('0x63')},'attributes':['id',_0xf282('0x38'),_0xf282('0x72'),_0xf282('0x73'),_0xf282('0x74')],'raw':!![]});}return null;})[_0xf282('0x36')](function(_0x3f874a){if(!_0x3f874a)return null;_0x30c7a5[_0xf282('0x28')]['agent']=_0x3f874a;return _0x30c7a5;})['then'](function(_0xd1796f){if(_0xd1796f){if(_0x5d28cc[_0xf282('0x58')]['manual']){_0x30c7a5[_0xf282('0x28')][_0xf282('0x75')]=util[_0xf282('0x76')](_0xf282('0x77'),_0x5d28cc[_0xf282('0x62')][_0xf282('0x38')]);_0x30c7a5['message'][_0xf282('0x78')]=_0x30c7a5[_0xf282('0x78')];_0x30c7a5[_0xf282('0x28')][_0xf282('0x79')]=_0x30c7a5[_0xf282('0x78')];_0x30c7a5[_0xf282('0x28')][_0xf282('0x7a')]=_0xf282('0x5c');return respondWithRpcPromise(_0xf282('0x7b'),_0xf282('0x7b'),{'event':_0xf282('0x7c'),'message':_0x30c7a5[_0xf282('0x28')]},client9002)[_0xf282('0x36')](function(){return _0x30c7a5;});}return _0x30c7a5;}return null;})[_0xf282('0x36')](respondWithResult(_0x5bad22,null))[_0xf282('0x52')](handleError(_0x5bad22,null));};var interaction_log=require('../../config/logger')(_0xf282('0x5b'));exports[_0xf282('0x33')]=function(_0xc7a03b,_0x2f9a8c,_0x4043d5){var _0x39e03a={'agent':{},'channel':_0xf282('0x5d')};if(_0xc7a03b[_0xf282('0x58')]['id']){delete _0xc7a03b[_0xf282('0x58')]['id'];}_0xc7a03b['body'][_0xf282('0x61')]=_0xc7a03b[_0xf282('0x58')][_0xf282('0x61')]||_0xc7a03b[_0xf282('0x62')]['id'];_0x39e03a[_0xf282('0x63')]['id']=_0xc7a03b[_0xf282('0x58')][_0xf282('0x61')];return db[_0xf282('0x50')][_0xf282('0x59')]({'where':{'id':_0xc7a03b[_0xf282('0x54')]['id'],'UserId':null}})[_0xf282('0x36')](handleEntityNotFound(_0x2f9a8c,null))[_0xf282('0x36')](function(_0x7ffd84){if(_0x7ffd84){_0x39e03a[_0xf282('0x28')]=_0x7ffd84[_0xf282('0x64')]({'plain':!![]});return db[_0xf282('0x7d')]['find']({'where':{'id':_0x7ffd84['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2f9a8c,null))[_0xf282('0x36')](function(_0x48790e){if(_0x48790e){_0x39e03a['interaction']=_0x48790e[_0xf282('0x64')]({'plain':!![]});interaction_log[_0xf282('0x22')](_0xf282('0x7e'),_0xc7a03b['user']['id'],_0xc7a03b[_0xf282('0x62')][_0xf282('0x38')],_0xc7a03b[_0xf282('0x62')][_0xf282('0x68')],_0x39e03a['interaction']['id'],_0xc7a03b['body']?JSON[_0xf282('0x7f')](_0xc7a03b['body']):_0xf282('0x69'));return respondWithRpcPromise('RejectMessage',_0xf282('0x80'),_0x39e03a);}return null;})[_0xf282('0x36')](function(_0x5d1016){var _0x19683f=_0xf282('0x6c')+_0x5d1016[_0xf282('0x28')][_0xf282('0x81')];return db['sequelize'][_0xf282('0x40')](_0x19683f,{'type':db[_0xf282('0x6e')][_0xf282('0x82')][_0xf282('0x6f')],'raw':!![]})['then'](function(_0x28acb5){return _0x28acb5;});})[_0xf282('0x36')](function(_0xadf06f){if(_0xadf06f){_0x39e03a['message']['contact']=_0xadf06f[0x0];if(!_0xc7a03b[_0xf282('0x58')][_0xf282('0x61')])return;return db[_0xf282('0x71')][_0xf282('0x59')]({'where':{'id':_0xc7a03b[_0xf282('0x58')][_0xf282('0x61')],'role':_0xf282('0x63')},'attributes':['id',_0xf282('0x38'),_0xf282('0x72'),_0xf282('0x73'),_0xf282('0x74')],'raw':!![]});}return null;})['then'](function(_0x5249af){if(!_0x5249af)return null;_0x39e03a[_0xf282('0x28')]['agent']=_0x5249af;return _0x39e03a;})['then'](function(_0x365111){if(_0x365111){_0x365111['message'][_0xf282('0x75')]=util[_0xf282('0x76')]('SIP/%s',_0xc7a03b[_0xf282('0x62')]['name']);_0x365111[_0xf282('0x28')][_0xf282('0x78')]=_0x39e03a[_0xf282('0x78')];_0x365111[_0xf282('0x28')][_0xf282('0x79')]=_0x39e03a[_0xf282('0x78')];_0x365111[_0xf282('0x28')][_0xf282('0x7a')]=_0xf282('0x33');respondWithRpcPromise(_0xf282('0x7b'),_0xf282('0x7b'),{'event':_0xf282('0x83'),'message':_0x365111[_0xf282('0x28')]},client9002);return _0x39e03a;}return null;})[_0xf282('0x36')](respondWithResult(_0x2f9a8c,null))[_0xf282('0x52')](handleError(_0x2f9a8c,null));}; \ No newline at end of file +var _0xbe25=['agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','manual','interface','format','SIP/%s','channel','event','openchannel-interactions','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','email','internal','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','save','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','keys','rawAttributes','create','body','update','find','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x550e4f,_0x17adb7){var _0x2c18e5=function(_0xed6cd3){while(--_0xed6cd3){_0x550e4f['push'](_0x550e4f['shift']());}};_0x2c18e5(++_0x17adb7);}(_0xbe25,0x1ab));var _0x5be2=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xbe25[_0x42bdad];return _0x122626;};'use strict';var emlformat=require(_0x5be2('0x0'));var rimraf=require(_0x5be2('0x1'));var zipdir=require(_0x5be2('0x2'));var jsonpatch=require(_0x5be2('0x3'));var rp=require(_0x5be2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5be2('0x5'));var sox=require(_0x5be2('0x6'));var csv=require(_0x5be2('0x7'));var ejs=require(_0x5be2('0x8'));var fs=require('fs');var fs_extra=require(_0x5be2('0x9'));var _=require(_0x5be2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5be2('0xb'));var deskjs=require(_0x5be2('0xc'));var toCsv=require(_0x5be2('0x7'));var querystring=require(_0x5be2('0xd'));var Papa=require(_0x5be2('0xe'));var Redis=require(_0x5be2('0xf'));var authService=require(_0x5be2('0x10'));var qs=require(_0x5be2('0x11'));var as=require(_0x5be2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5be2('0x13'))(_0x5be2('0x14'));var utils=require(_0x5be2('0x15'));var config=require(_0x5be2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5be2('0x17')]=_['defaults'](config[_0x5be2('0x17')],{'host':_0x5be2('0x18'),'port':0x18eb});var socket=require(_0x5be2('0x19'))(new Redis(config['redis']));require(_0x5be2('0x1a'))[_0x5be2('0x1b')](socket);var jayson=require(_0x5be2('0x1c'));var client=jayson['client'][_0x5be2('0x1d')]({'port':0x232c});var client9002=jayson[_0x5be2('0x1e')][_0x5be2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2e1367,_0x4f24bc,_0x14b52d,_0x2560d5){return new BPromise(function(_0x13ce13,_0x3d130a){var _0xc6e1cb=_0x2560d5||client;return _0xc6e1cb[_0x5be2('0x1f')](_0x2e1367,_0x14b52d)[_0x5be2('0x20')](function(_0x44e8aa){logger[_0x5be2('0x21')](_0x5be2('0x22'),_0x4f24bc,_0x5be2('0x23'));logger[_0x5be2('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4f24bc,_0x5be2('0x23'),JSON[_0x5be2('0x25')](_0x44e8aa));if(_0x44e8aa['error']){if(_0x44e8aa[_0x5be2('0x26')][_0x5be2('0x27')]===0x1f4){logger[_0x5be2('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f24bc,_0x44e8aa[_0x5be2('0x26')][_0x5be2('0x28')]);return _0x3d130a(_0x44e8aa[_0x5be2('0x26')][_0x5be2('0x28')]);}logger[_0x5be2('0x26')](_0x5be2('0x22'),_0x4f24bc,_0x44e8aa[_0x5be2('0x26')][_0x5be2('0x28')]);return _0x13ce13(_0x44e8aa['error'][_0x5be2('0x28')]);}else{logger[_0x5be2('0x21')](_0x5be2('0x22'),_0x4f24bc,_0x5be2('0x23'));_0x13ce13(_0x44e8aa[_0x5be2('0x29')][_0x5be2('0x28')]);}})[_0x5be2('0x2a')](function(_0x1bac18){logger[_0x5be2('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f24bc,_0x1bac18);_0x3d130a(_0x1bac18);});});}function respondWithStatusCode(_0x570a42,_0x25c727){_0x25c727=_0x25c727||0xcc;return function(_0x556c42){if(_0x556c42){return _0x570a42[_0x5be2('0x2b')](_0x25c727);}return _0x570a42[_0x5be2('0x2c')](_0x25c727)[_0x5be2('0x2d')]();};}function respondWithResult(_0x13afa8,_0x44d4e7){_0x44d4e7=_0x44d4e7||0xc8;return function(_0x574de3){if(_0x574de3){return _0x13afa8[_0x5be2('0x2c')](_0x44d4e7)['json'](_0x574de3);}};}function respondWithFilteredResult(_0x2b0f27,_0x4712cb){return function(_0xefbe02){if(_0xefbe02){var _0x4c3016=typeof _0x4712cb['offset']===_0x5be2('0x2e')&&typeof _0x4712cb[_0x5be2('0x2f')]===_0x5be2('0x2e');var _0x34a022=_0xefbe02['count'];var _0x410a13=_0x4c3016?0x0:_0x4712cb[_0x5be2('0x30')];var _0xd120a5=_0x4c3016?_0xefbe02['count']:_0x4712cb[_0x5be2('0x30')]+_0x4712cb[_0x5be2('0x2f')];var _0x4cd8a1;if(_0xd120a5>=_0x34a022){_0xd120a5=_0x34a022;_0x4cd8a1=0xc8;}else{_0x4cd8a1=0xce;}_0x2b0f27['status'](_0x4cd8a1);return _0x2b0f27[_0x5be2('0x31')](_0x5be2('0x32'),_0x410a13+'-'+_0xd120a5+'/'+_0x34a022)['json'](_0xefbe02);}return null;};}function patchUpdates(_0x1d5864){return function(_0x2061b4){try{jsonpatch[_0x5be2('0x33')](_0x2061b4,_0x1d5864,!![]);}catch(_0x21c2a2){return BPromise['reject'](_0x21c2a2);}return _0x2061b4[_0x5be2('0x34')]();};}function saveUpdates(_0x5761b9,_0x1f2e9c){return function(_0x152f17){if(_0x152f17){return _0x152f17['update'](_0x5761b9)['then'](function(_0x5ca899){return _0x5ca899;});}return null;};}function removeEntity(_0x295eb9,_0x105a67){return function(_0x2e4aec){if(_0x2e4aec){return _0x2e4aec[_0x5be2('0x35')]()[_0x5be2('0x20')](function(){_0x295eb9[_0x5be2('0x2c')](0xcc)[_0x5be2('0x2d')]();});}};}function handleEntityNotFound(_0x5d07c7,_0x6f6b93){return function(_0x18fc7a){if(!_0x18fc7a){_0x5d07c7['sendStatus'](0x194);}return _0x18fc7a;};}function handleError(_0xffe3a8,_0x3369d3){_0x3369d3=_0x3369d3||0x1f4;return function(_0x3d8cb9){logger[_0x5be2('0x26')](_0x3d8cb9[_0x5be2('0x36')]);if(_0x3d8cb9['name']){delete _0x3d8cb9[_0x5be2('0x37')];}_0xffe3a8[_0x5be2('0x2c')](_0x3369d3)[_0x5be2('0x38')](_0x3d8cb9);};}exports[_0x5be2('0x39')]=function(_0x3518a1,_0x49dcef){var _0x392ce9={},_0xd3168={},_0x364cbd={'count':0x0,'rows':[]};var _0x29d76a=_[_0x5be2('0x3a')](db[_0x5be2('0x3b')]['rawAttributes'],function(_0x368a21){return{'name':_0x368a21[_0x5be2('0x3c')],'type':_0x368a21[_0x5be2('0x3d')][_0x5be2('0x3e')]};});_0xd3168[_0x5be2('0x3f')]=_[_0x5be2('0x3a')](_0x29d76a,'name');_0xd3168[_0x5be2('0x40')]=_['keys'](_0x3518a1[_0x5be2('0x40')]);_0xd3168[_0x5be2('0x41')]=_[_0x5be2('0x42')](_0xd3168[_0x5be2('0x3f')],_0xd3168[_0x5be2('0x40')]);_0x392ce9[_0x5be2('0x43')]=_[_0x5be2('0x42')](_0xd3168['model'],qs[_0x5be2('0x44')](_0x3518a1[_0x5be2('0x40')]['fields']));_0x392ce9[_0x5be2('0x43')]=_0x392ce9['attributes'][_0x5be2('0x45')]?_0x392ce9[_0x5be2('0x43')]:_0xd3168[_0x5be2('0x3f')];if(!_0x3518a1[_0x5be2('0x40')][_0x5be2('0x46')](_0x5be2('0x47'))){_0x392ce9[_0x5be2('0x2f')]=qs['limit'](_0x3518a1[_0x5be2('0x40')][_0x5be2('0x2f')]);_0x392ce9[_0x5be2('0x30')]=qs[_0x5be2('0x30')](_0x3518a1[_0x5be2('0x40')][_0x5be2('0x30')]);}_0x392ce9['order']=qs[_0x5be2('0x48')](_0x3518a1[_0x5be2('0x40')][_0x5be2('0x48')]);_0x392ce9['where']=qs['filters'](_['pick'](_0x3518a1[_0x5be2('0x40')],_0xd3168[_0x5be2('0x41')]),_0x29d76a);if(_0x3518a1[_0x5be2('0x40')][_0x5be2('0x49')]){_0x392ce9[_0x5be2('0x4a')]=_['merge'](_0x392ce9['where'],{'$or':_[_0x5be2('0x3a')](_0x29d76a,function(_0x13aa85){if(_0x13aa85[_0x5be2('0x3d')]!==_0x5be2('0x4b')){var _0x49a538={};_0x49a538[_0x13aa85[_0x5be2('0x37')]]={'$like':'%'+_0x3518a1[_0x5be2('0x40')][_0x5be2('0x49')]+'%'};return _0x49a538;}})});}_0x392ce9=_[_0x5be2('0x4c')]({},_0x392ce9,_0x3518a1[_0x5be2('0x4d')]);var _0x1cef72={'where':_0x392ce9[_0x5be2('0x4a')]};return db[_0x5be2('0x3b')][_0x5be2('0x4e')](_0x1cef72)[_0x5be2('0x20')](function(_0x8b159f){_0x364cbd[_0x5be2('0x4e')]=_0x8b159f;if(_0x3518a1[_0x5be2('0x40')][_0x5be2('0x4f')]){_0x392ce9[_0x5be2('0x50')]=[{'all':!![]}];}return db[_0x5be2('0x3b')]['findAll'](_0x392ce9);})['then'](function(_0x10bfd3){_0x364cbd[_0x5be2('0x51')]=_0x10bfd3;return _0x364cbd;})[_0x5be2('0x20')](respondWithFilteredResult(_0x49dcef,_0x392ce9))[_0x5be2('0x2a')](handleError(_0x49dcef,null));};exports[_0x5be2('0x52')]=function(_0x325733,_0x198959){var _0x379164={'raw':!![],'where':{'id':_0x325733[_0x5be2('0x53')]['id']}},_0x4ab1f7={};_0x4ab1f7['model']=_[_0x5be2('0x54')](db[_0x5be2('0x3b')][_0x5be2('0x55')]);_0x4ab1f7[_0x5be2('0x40')]=_['keys'](_0x325733[_0x5be2('0x40')]);_0x4ab1f7[_0x5be2('0x41')]=_[_0x5be2('0x42')](_0x4ab1f7['model'],_0x4ab1f7[_0x5be2('0x40')]);_0x379164[_0x5be2('0x43')]=_[_0x5be2('0x42')](_0x4ab1f7[_0x5be2('0x3f')],qs[_0x5be2('0x44')](_0x325733[_0x5be2('0x40')][_0x5be2('0x44')]));_0x379164['attributes']=_0x379164['attributes']['length']?_0x379164[_0x5be2('0x43')]:_0x4ab1f7[_0x5be2('0x3f')];if(_0x325733['query'][_0x5be2('0x4f')]){_0x379164[_0x5be2('0x50')]=[{'all':!![]}];}_0x379164=_[_0x5be2('0x4c')]({},_0x379164,_0x325733['options']);return db[_0x5be2('0x3b')]['find'](_0x379164)['then'](handleEntityNotFound(_0x198959,null))[_0x5be2('0x20')](respondWithResult(_0x198959,null))[_0x5be2('0x2a')](handleError(_0x198959,null));};exports['create']=function(_0x51396e,_0x488786){return db[_0x5be2('0x3b')][_0x5be2('0x56')](_0x51396e[_0x5be2('0x57')],{})[_0x5be2('0x20')](respondWithResult(_0x488786,0xc9))['catch'](handleError(_0x488786,null));};exports[_0x5be2('0x58')]=function(_0x3f5754,_0x3d491d){if(_0x3f5754[_0x5be2('0x57')]['id']){delete _0x3f5754[_0x5be2('0x57')]['id'];}return db[_0x5be2('0x3b')][_0x5be2('0x59')]({'where':{'id':_0x3f5754[_0x5be2('0x53')]['id']}})[_0x5be2('0x20')](handleEntityNotFound(_0x3d491d,null))[_0x5be2('0x20')](saveUpdates(_0x3f5754[_0x5be2('0x57')],null))[_0x5be2('0x20')](respondWithResult(_0x3d491d,null))['catch'](handleError(_0x3d491d,null));};exports['destroy']=function(_0x28fec7,_0x2729b5){return db[_0x5be2('0x3b')][_0x5be2('0x59')]({'where':{'id':_0x28fec7[_0x5be2('0x53')]['id']}})[_0x5be2('0x20')](handleEntityNotFound(_0x2729b5,null))[_0x5be2('0x20')](removeEntity(_0x2729b5,null))[_0x5be2('0x2a')](handleError(_0x2729b5,null));};exports['describe']=function(_0x3c583,_0x2e962c){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x2e962c,null))[_0x5be2('0x2a')](handleError(_0x2e962c,null));};var interaction_log=require(_0x5be2('0x13'))('openchannel-interactions');exports[_0x5be2('0x5a')]=function(_0x37c734,_0x456640,_0x5c4266){var _0x2a54ef={'agent':{},'channel':_0x5be2('0x5b')};if(_0x37c734['body']['id']){delete _0x37c734[_0x5be2('0x57')]['id'];}_0x37c734[_0x5be2('0x57')][_0x5be2('0x5c')]=!![];_0x37c734[_0x5be2('0x57')][_0x5be2('0x5d')]=moment()['format'](_0x5be2('0x5e'));_0x37c734[_0x5be2('0x57')][_0x5be2('0x5f')]=_0x37c734[_0x5be2('0x57')][_0x5be2('0x5f')]||_0x37c734[_0x5be2('0x60')]['id'];_0x2a54ef[_0x5be2('0x61')]['id']=_0x37c734['body'][_0x5be2('0x5f')];return db['OpenchannelMessage'][_0x5be2('0x59')]({'where':{'id':_0x37c734['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x456640,null))[_0x5be2('0x20')](saveUpdates(_0x37c734[_0x5be2('0x57')],null))[_0x5be2('0x20')](function(_0xcd8756){if(_0xcd8756){_0x2a54ef[_0x5be2('0x28')]=_0xcd8756[_0x5be2('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x5be2('0x59')]({'where':{'id':_0xcd8756[_0x5be2('0x63')]}});}return null;})[_0x5be2('0x20')](handleEntityNotFound(_0x456640,null))[_0x5be2('0x20')](function(_0x30265d){if(_0x30265d){return _0x30265d[_0x5be2('0x58')]({'UserId':_0x37c734[_0x5be2('0x57')][_0x5be2('0x5f')],'read1stAt':_[_0x5be2('0x64')](_0x30265d[_0x5be2('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5be2('0x20')](function(_0x50748e){if(_0x50748e){_0x2a54ef[_0x5be2('0x66')]=_0x50748e['get']({'plain':!![]});interaction_log['info'](_0x5be2('0x67'),_0x37c734[_0x5be2('0x60')]['id'],_0x37c734['user'][_0x5be2('0x37')],_0x37c734[_0x5be2('0x60')][_0x5be2('0x68')],_0x2a54ef[_0x5be2('0x66')]['id'],_0x37c734[_0x5be2('0x57')]?JSON['stringify'](_0x37c734[_0x5be2('0x57')]):_0x5be2('0x69'));return respondWithRpcPromise(_0x5be2('0x6a'),'acceptMessage',_0x2a54ef);}return null;})[_0x5be2('0x20')](function(_0x18ae93){var _0x5a2950=_0x5be2('0x6b')+_0x18ae93['message'][_0x5be2('0x6c')];return db[_0x5be2('0x6d')][_0x5be2('0x40')](_0x5a2950,{'type':db[_0x5be2('0x6e')][_0x5be2('0x6f')][_0x5be2('0x70')],'raw':!![]})[_0x5be2('0x20')](function(_0x561600){return _0x561600;});})[_0x5be2('0x20')](function(_0x5197a7){if(_0x5197a7){_0x2a54ef['message'][_0x5be2('0x71')]=_0x5197a7[0x0];if(!_0x37c734[_0x5be2('0x57')][_0x5be2('0x5f')])return;return db['User'][_0x5be2('0x59')]({'where':{'id':_0x37c734[_0x5be2('0x57')]['UserId'],'role':_0x5be2('0x61')},'attributes':['id',_0x5be2('0x37'),_0x5be2('0x72'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x2f0ec2){if(!_0x2f0ec2)return null;_0x2a54ef[_0x5be2('0x28')][_0x5be2('0x61')]=_0x2f0ec2;return _0x2a54ef;})[_0x5be2('0x20')](function(_0x493999){if(_0x493999){if(_0x37c734[_0x5be2('0x57')][_0x5be2('0x73')]){_0x2a54ef[_0x5be2('0x28')][_0x5be2('0x74')]=util[_0x5be2('0x75')](_0x5be2('0x76'),_0x37c734[_0x5be2('0x60')][_0x5be2('0x37')]);_0x2a54ef[_0x5be2('0x28')]['channel']=_0x2a54ef[_0x5be2('0x77')];_0x2a54ef[_0x5be2('0x28')]['motionChannel']=_0x2a54ef['channel'];_0x2a54ef[_0x5be2('0x28')][_0x5be2('0x78')]=_0x5be2('0x5a');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x2a54ef[_0x5be2('0x28')]},client9002)[_0x5be2('0x20')](function(){return _0x2a54ef;});}return _0x2a54ef;}return null;})[_0x5be2('0x20')](respondWithResult(_0x456640,null))[_0x5be2('0x2a')](handleError(_0x456640,null));};var interaction_log=require(_0x5be2('0x13'))(_0x5be2('0x79'));exports[_0x5be2('0x7a')]=function(_0x18cf6c,_0x15c221,_0x1610ef){var _0xfc1585={'agent':{},'channel':'openchannel'};if(_0x18cf6c[_0x5be2('0x57')]['id']){delete _0x18cf6c[_0x5be2('0x57')]['id'];}_0x18cf6c[_0x5be2('0x57')][_0x5be2('0x5f')]=_0x18cf6c['body'][_0x5be2('0x5f')]||_0x18cf6c[_0x5be2('0x60')]['id'];_0xfc1585[_0x5be2('0x61')]['id']=_0x18cf6c[_0x5be2('0x57')][_0x5be2('0x5f')];return db['OpenchannelMessage'][_0x5be2('0x59')]({'where':{'id':_0x18cf6c['params']['id'],'UserId':null}})[_0x5be2('0x20')](handleEntityNotFound(_0x15c221,null))[_0x5be2('0x20')](function(_0x4bc69c){if(_0x4bc69c){_0xfc1585['message']=_0x4bc69c[_0x5be2('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x5be2('0x59')]({'where':{'id':_0x4bc69c[_0x5be2('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x15c221,null))['then'](function(_0x31e79f){if(_0x31e79f){_0xfc1585[_0x5be2('0x66')]=_0x31e79f['get']({'plain':!![]});interaction_log[_0x5be2('0x21')](_0x5be2('0x7b'),_0x18cf6c[_0x5be2('0x60')]['id'],_0x18cf6c[_0x5be2('0x60')][_0x5be2('0x37')],_0x18cf6c[_0x5be2('0x60')]['role'],_0xfc1585[_0x5be2('0x66')]['id'],_0x18cf6c[_0x5be2('0x57')]?JSON['stringify'](_0x18cf6c['body']):_0x5be2('0x69'));return respondWithRpcPromise(_0x5be2('0x7c'),_0x5be2('0x7d'),_0xfc1585);}return null;})[_0x5be2('0x20')](function(_0x28c541){var _0x51ad36=_0x5be2('0x6b')+_0x28c541[_0x5be2('0x28')][_0x5be2('0x6c')];return db['sequelize'][_0x5be2('0x40')](_0x51ad36,{'type':db['Sequelize'][_0x5be2('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x1aed4f){return _0x1aed4f;});})[_0x5be2('0x20')](function(_0x1cdf70){if(_0x1cdf70){_0xfc1585['message']['contact']=_0x1cdf70[0x0];if(!_0x18cf6c[_0x5be2('0x57')][_0x5be2('0x5f')])return;return db[_0x5be2('0x7e')][_0x5be2('0x59')]({'where':{'id':_0x18cf6c[_0x5be2('0x57')]['UserId'],'role':_0x5be2('0x61')},'attributes':['id',_0x5be2('0x37'),_0x5be2('0x72'),_0x5be2('0x7f'),_0x5be2('0x80')],'raw':!![]});}return null;})[_0x5be2('0x20')](function(_0x2cc3a1){if(!_0x2cc3a1)return null;_0xfc1585[_0x5be2('0x28')][_0x5be2('0x61')]=_0x2cc3a1;return _0xfc1585;})[_0x5be2('0x20')](function(_0x2e8c80){if(_0x2e8c80){_0x2e8c80[_0x5be2('0x28')][_0x5be2('0x74')]=util[_0x5be2('0x75')](_0x5be2('0x76'),_0x18cf6c['user'][_0x5be2('0x37')]);_0x2e8c80['message'][_0x5be2('0x77')]=_0xfc1585[_0x5be2('0x77')];_0x2e8c80[_0x5be2('0x28')]['motionChannel']=_0xfc1585['channel'];_0x2e8c80['message']['event']=_0x5be2('0x7a');respondWithRpcPromise('EventManager',_0x5be2('0x81'),{'event':_0x5be2('0x82'),'message':_0x2e8c80[_0x5be2('0x28')]},client9002);return _0xfc1585;}return null;})['then'](respondWithResult(_0x15c221,null))[_0x5be2('0x2a')](handleError(_0x15c221,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 474f857..d4e9799 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 _0x8f39=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x41a60a,_0x3c6c89){var _0x3b7964=function(_0x2fcd0c){while(--_0x2fcd0c){_0x41a60a['push'](_0x41a60a['shift']());}};_0x3b7964(++_0x3c6c89);}(_0x8f39,0x1cb));var _0x98f3=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x8f39[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x98f3('0x0'))['db'][_0x98f3('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x98f3('0x2')](0x0);var events={'afterCreate':_0x98f3('0x3'),'afterUpdate':_0x98f3('0x4'),'afterDestroy':_0x98f3('0x5')};function emitEvent(_0x275647){return function(_0x39a3af,_0xd52d51,_0x5f1469){OpenchannelMessageEvents['emit'](_0x275647+':'+_0x39a3af['id'],_0x39a3af);OpenchannelMessageEvents[_0x98f3('0x6')](_0x275647,_0x39a3af);_0x5f1469(null);};}for(var e in events){if(events[_0x98f3('0x7')](e)){var event=events[e];OpenchannelMessage[_0x98f3('0x8')](e,emitEvent(event));}}module[_0x98f3('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6c02=['remove','emit','../../mysqldb','setMaxListeners','save','update'];(function(_0x4ae191,_0x3f68a2){var _0x2e0158=function(_0x89f4a6){while(--_0x89f4a6){_0x4ae191['push'](_0x4ae191['shift']());}};_0x2e0158(++_0x3f68a2);}(_0x6c02,0xec));var _0x26c0=function(_0x1faf0a,_0x31fd54){_0x1faf0a=_0x1faf0a-0x0;var _0x2c1046=_0x6c02[_0x1faf0a];return _0x2c1046;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x26c0('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x26c0('0x1')](0x0);var events={'afterCreate':_0x26c0('0x2'),'afterUpdate':_0x26c0('0x3'),'afterDestroy':_0x26c0('0x4')};function emitEvent(_0x2275a5){return function(_0x50af54,_0x3fe25c,_0x103523){OpenchannelMessageEvents['emit'](_0x2275a5+':'+_0x50af54['id'],_0x50af54);OpenchannelMessageEvents[_0x26c0('0x5')](_0x2275a5,_0x50af54);_0x103523(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4246bec..905930d 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 _0xc132=['CmContact','describe','find','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','replyUri','Interaction','omit','POST','method','GET','body','format','threadId','OpenchannelInteraction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','error'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xc132,0x1d9));var _0x2c13=function(_0x1fa8e8,_0x40ba7f){_0x1fa8e8=_0x1fa8e8-0x0;var _0x11b333=_0xc132[_0x1fa8e8];return _0x11b333;};'use strict';var _=require(_0x2c13('0x0'));var util=require(_0x2c13('0x1'));var logger=require(_0x2c13('0x2'))(_0x2c13('0x3'));var moment=require(_0x2c13('0x4'));var BPromise=require(_0x2c13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c13('0x6'));var rimraf=require(_0x2c13('0x7'));var config=require(_0x2c13('0x8'));var attributes=require(_0x2c13('0x9'));module[_0x2c13('0xa')]=function(_0x2a0547,_0x4f1b21){return _0x2a0547['define'](_0x2c13('0xb'),attributes,{'tableName':_0x2c13('0xc'),'paranoid':![],'indexes':[{'name':_0x2c13('0xd'),'fields':['body'],'type':_0x2c13('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21c4d0,_0x558cbb,_0x4a91bf){var _0x514fcd=_0x2a0547['models'];var _0x1e7df3=_0x21c4d0[_0x2c13('0xf')]({'plain':!![]});if(_0x1e7df3[_0x2c13('0x10')][_0x2c13('0x11')]()==='in'||_0x1e7df3[_0x2c13('0x10')][_0x2c13('0x11')]()===_0x2c13('0x12')&&!_0x1e7df3['secret']&&!_[_0x2c13('0x13')](_0x1e7df3[_0x2c13('0x14')])){_0x514fcd['OpenchannelInteraction'][_0x2c13('0x15')]({'where':{'id':_0x1e7df3[_0x2c13('0x16')]}})[_0x2c13('0x17')](function(_0x1d5b1f){if(_0x1d5b1f){_0x1d5b1f[_0x2c13('0x18')]({'lastMsgAt':_0x1e7df3[_0x2c13('0x19')],'lastMsgDirection':_0x1e7df3['direction']['toLowerCase']()});}})['catch'](function(_0x2a1ac7){console[_0x2c13('0x1a')](_0x2a1ac7);});}if(_0x1e7df3['direction']===_0x2c13('0x12')&&!_0x1e7df3['secret']){var _0x52fbd2;_0x514fcd[_0x2c13('0x1b')][_0x2c13('0x1c')]()[_0x2c13('0x17')](function(_0x565243){return _0x514fcd['OpenchannelAccount'][_0x2c13('0x1d')]({'where':{'id':_0x1e7df3['OpenchannelAccountId']},'include':[{'model':_0x514fcd['OpenchannelInteraction'],'as':_0x2c13('0x1e'),'where':{'id':_0x1e7df3['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x514fcd[_0x2c13('0x1b')],'as':_0x2c13('0x1f'),'attributes':_[_0x2c13('0x20')](_0x565243)}]}]});})[_0x2c13('0x17')](function(_0x4bd863){_0x52fbd2=_0x4bd863[_0x2c13('0xf')]({'plain':!![]});if(_0x52fbd2&&_0x52fbd2['replyUri']){logger[_0x2c13('0x21')](_0x2c13('0x22'),_0x2c13('0x23'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1e7df3['id'],_0x52fbd2[_0x2c13('0x24')]));if(_0x52fbd2['Interactions']&&_0x52fbd2[_0x2c13('0x1e')]['length']){_0x1e7df3[_0x2c13('0x25')]=_[_0x2c13('0x26')](_0x52fbd2[_0x2c13('0x1e')][0x0],'Contact');_0x1e7df3[_0x2c13('0x1f')]=_0x52fbd2[_0x2c13('0x1e')][0x0][_0x2c13('0x1f')];}var _0x558cbb={'method':_0x2c13('0x27'),'uri':encodeURI(_0x52fbd2['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x558cbb[_0x2c13('0x28')]){case _0x2c13('0x29'):_0x558cbb['qs']=_0x1e7df3;break;case _0x2c13('0x27'):_0x558cbb[_0x2c13('0x2a')]=_0x1e7df3;break;}return rp(_0x558cbb)[_0x2c13('0x17')](function(_0x3dea00){logger[_0x2c13('0x21')](_0x2c13('0x22'),_0x2c13('0x23'),util[_0x2c13('0x2b')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1e7df3['id'],_0x52fbd2[_0x2c13('0x24')]));if(_0x3dea00[_0x2c13('0x2a')][_0x2c13('0x2c')]&&_0x3dea00['body'][_0x2c13('0x2c')]!=_0x1e7df3['Interaction'][_0x2c13('0x2c')]){return _0x514fcd[_0x2c13('0x2d')][_0x2c13('0x18')]({'threadId':_0x3dea00[_0x2c13('0x2a')][_0x2c13('0x2c')]},{'where':{'id':_0x1e7df3[_0x2c13('0x25')]['id']}});}else{return;}})[_0x2c13('0x17')](function(){return _0x21c4d0[_0x2c13('0x18')]({'read':!![]});})[_0x2c13('0x2e')](function(_0x31282e){logger[_0x2c13('0x1a')](_0x2c13('0x22'),_0x2c13('0x23'),util[_0x2c13('0x2f')](_0x31282e,{'showHidden':![],'depth':null}));_0x4a91bf();});}else{_0x4a91bf();}})['finally'](function(){_0x4a91bf();});}else{_0x4a91bf();}}},'charset':_0x2c13('0x30'),'collate':_0x2c13('0x31')});}; \ No newline at end of file +var _0x6ddb=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','update','createdAt','catch','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','then'];(function(_0x5ba495,_0x578628){var _0x45b8d9=function(_0x197e8a){while(--_0x197e8a){_0x5ba495['push'](_0x5ba495['shift']());}};_0x45b8d9(++_0x578628);}(_0x6ddb,0x156));var _0xb6dd=function(_0x355b81,_0xc59903){_0x355b81=_0x355b81-0x0;var _0x46b92c=_0x6ddb[_0x355b81];return _0x46b92c;};'use strict';var _=require(_0xb6dd('0x0'));var util=require(_0xb6dd('0x1'));var logger=require(_0xb6dd('0x2'))(_0xb6dd('0x3'));var moment=require(_0xb6dd('0x4'));var BPromise=require(_0xb6dd('0x5'));var rp=require(_0xb6dd('0x6'));var fs=require('fs');var path=require(_0xb6dd('0x7'));var rimraf=require(_0xb6dd('0x8'));var config=require(_0xb6dd('0x9'));var attributes=require(_0xb6dd('0xa'));module[_0xb6dd('0xb')]=function(_0x3aaef7,_0xe539eb){return _0x3aaef7[_0xb6dd('0xc')]('OpenchannelMessage',attributes,{'tableName':_0xb6dd('0xd'),'paranoid':![],'indexes':[{'name':_0xb6dd('0xe'),'fields':[_0xb6dd('0xf')],'type':_0xb6dd('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f7c07,_0x1c13ca,_0x4a05f5){var _0x10faa8=_0x3aaef7[_0xb6dd('0x11')];var _0x431bb0=_0x1f7c07[_0xb6dd('0x12')]({'plain':!![]});if(_0x431bb0[_0xb6dd('0x13')][_0xb6dd('0x14')]()==='in'||_0x431bb0[_0xb6dd('0x13')][_0xb6dd('0x14')]()===_0xb6dd('0x15')&&!_0x431bb0[_0xb6dd('0x16')]&&!_[_0xb6dd('0x17')](_0x431bb0[_0xb6dd('0x18')])){_0x10faa8['OpenchannelInteraction'][_0xb6dd('0x19')]({'where':{'id':_0x431bb0[_0xb6dd('0x1a')]}})['then'](function(_0x1366f9){if(_0x1366f9){_0x1366f9[_0xb6dd('0x1b')]({'lastMsgAt':_0x431bb0[_0xb6dd('0x1c')],'lastMsgDirection':_0x431bb0[_0xb6dd('0x13')][_0xb6dd('0x14')]()});}})[_0xb6dd('0x1d')](function(_0x5593d5){console['error'](_0x5593d5);});}if(_0x431bb0[_0xb6dd('0x13')]===_0xb6dd('0x15')&&!_0x431bb0['secret']){var _0x73664e;_0x10faa8['CmContact'][_0xb6dd('0x1e')]()['then'](function(_0x319b2d){return _0x10faa8[_0xb6dd('0x1f')][_0xb6dd('0x20')]({'where':{'id':_0x431bb0[_0xb6dd('0x21')]},'include':[{'model':_0x10faa8[_0xb6dd('0x22')],'as':_0xb6dd('0x23'),'where':{'id':_0x431bb0['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x10faa8['CmContact'],'as':_0xb6dd('0x24'),'attributes':_['keys'](_0x319b2d)}]}]});})['then'](function(_0x52ce1b){_0x73664e=_0x52ce1b[_0xb6dd('0x12')]({'plain':!![]});if(_0x73664e&&_0x73664e[_0xb6dd('0x25')]){logger[_0xb6dd('0x26')](_0xb6dd('0x27'),_0xb6dd('0x28'),util[_0xb6dd('0x29')](_0xb6dd('0x2a'),_0x431bb0['id'],_0x73664e[_0xb6dd('0x25')]));if(_0x73664e[_0xb6dd('0x23')]&&_0x73664e[_0xb6dd('0x23')][_0xb6dd('0x2b')]){_0x431bb0[_0xb6dd('0x2c')]=_[_0xb6dd('0x2d')](_0x73664e[_0xb6dd('0x23')][0x0],'Contact');_0x431bb0['Contact']=_0x73664e[_0xb6dd('0x23')][0x0][_0xb6dd('0x24')];}var _0x1c13ca={'method':_0xb6dd('0x2e'),'uri':encodeURI(_0x73664e[_0xb6dd('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1c13ca[_0xb6dd('0x2f')]){case _0xb6dd('0x30'):_0x1c13ca['qs']=_0x431bb0;break;case _0xb6dd('0x2e'):_0x1c13ca['body']=_0x431bb0;break;}return rp(_0x1c13ca)[_0xb6dd('0x31')](function(_0x15ac44){logger[_0xb6dd('0x26')](_0xb6dd('0x27'),_0xb6dd('0x28'),util[_0xb6dd('0x29')](_0xb6dd('0x32'),_0x431bb0['id'],_0x73664e[_0xb6dd('0x25')]));if(_0x15ac44[_0xb6dd('0xf')][_0xb6dd('0x33')]&&_0x15ac44['body'][_0xb6dd('0x33')]!=_0x431bb0[_0xb6dd('0x2c')][_0xb6dd('0x33')]){return _0x10faa8[_0xb6dd('0x22')][_0xb6dd('0x1b')]({'threadId':_0x15ac44[_0xb6dd('0xf')][_0xb6dd('0x33')]},{'where':{'id':_0x431bb0[_0xb6dd('0x2c')]['id']}});}else{return;}})[_0xb6dd('0x31')](function(){return _0x1f7c07['update']({'read':!![]});})[_0xb6dd('0x1d')](function(_0x27ce0e){logger[_0xb6dd('0x34')](_0xb6dd('0x27'),'afterCreate',util[_0xb6dd('0x35')](_0x27ce0e,{'showHidden':![],'depth':null}));_0x4a05f5();});}else{_0x4a05f5();}})['finally'](function(){_0x4a05f5();});}else{_0x4a05f5();}}},'charset':_0xb6dd('0x36'),'collate':_0xb6dd('0x37')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c3ab91a..9fbb0d6 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x37c0f6,_0x2ca911){var _0x533eb1=function(_0x4921c9){while(--_0x4921c9){_0x37c0f6['push'](_0x37c0f6['shift']());}};_0x533eb1(++_0x2ca911);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x5d64f3,_0x374d1a){var _0x2e5c81=function(_0x1de19d){while(--_0x1de19d){_0x5d64f3['push'](_0x5d64f3['shift']());}};_0x2e5c81(++_0x374d1a);}(_0xdb28,0x106));var _0x8db2=function(_0x8c7563,_0x3e74d6){_0x8c7563=_0x8c7563-0x0;var _0x20461a=_0xdb28[_0x8c7563];return _0x20461a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a624507..e107bd2 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 _0xaa9d=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','removeListener','register'];(function(_0xa0ed9f,_0x4f90f7){var _0x50c7b2=function(_0x235d29){while(--_0x235d29){_0xa0ed9f['push'](_0xa0ed9f['shift']());}};_0x50c7b2(++_0x4f90f7);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x458310,_0x1b3e42){_0x458310=_0x458310-0x0;var _0x167665=_0xaa9d[_0x458310];return _0x167665;};'use strict';var OpenchannelMessageEvents=require(_0xdaa9('0x0'));var events=[_0xdaa9('0x1'),_0xdaa9('0x2'),_0xdaa9('0x3')];function createListener(_0x1672d7,_0x47edb9){return function(_0x5de669){_0x47edb9['emit'](_0x1672d7,_0x5de669);};}function removeListener(_0x5cd202,_0x3579e6){return function(){OpenchannelMessageEvents[_0xdaa9('0x4')](_0x5cd202,_0x3579e6);};}exports[_0xdaa9('0x5')]=function(_0x1472da){for(var _0x49ff8d=0x0,_0x548aee=events[_0xdaa9('0x6')];_0x49ff8d<_0x548aee;_0x49ff8d++){var _0x389004=events[_0x49ff8d];var _0x394817=createListener(_0xdaa9('0x7')+_0x389004,_0x1472da);OpenchannelMessageEvents['on'](_0x389004,_0x394817);}}; \ No newline at end of file +var _0x9c50=['update','register','length','openchannelMessage:'];(function(_0x49a435,_0x11b120){var _0x5345e4=function(_0x4d1e83){while(--_0x4d1e83){_0x49a435['push'](_0x49a435['shift']());}};_0x5345e4(++_0x11b120);}(_0x9c50,0xec));var _0x09c5=function(_0x22f00e,_0x204e4f){_0x22f00e=_0x22f00e-0x0;var _0x2425fb=_0x9c50[_0x22f00e];return _0x2425fb;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save','remove',_0x09c5('0x0')];function createListener(_0x5ec6dd,_0xec826c){return function(_0x493887){_0xec826c['emit'](_0x5ec6dd,_0x493887);};}function removeListener(_0x23513c,_0x1e2992){return function(){OpenchannelMessageEvents['removeListener'](_0x23513c,_0x1e2992);};}exports[_0x09c5('0x1')]=function(_0x58a451){for(var _0x8987f6=0x0,_0x2830e5=events[_0x09c5('0x2')];_0x8987f6<_0x2830e5;_0x8987f6++){var _0x51ff47=events[_0x8987f6];var _0x27d297=createListener(_0x09c5('0x3')+_0x51ff47,_0x58a451);OpenchannelMessageEvents['on'](_0x51ff47,_0x27d297);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 67e5358..94c7b5f 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 _0x5462=['isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','create','addTeams','addAgents','put','delete','/:id/teams','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get'];(function(_0x399bbc,_0x41010d){var _0x491c8a=function(_0x246f8b){while(--_0x246f8b){_0x399bbc['push'](_0x399bbc['shift']());}};_0x491c8a(++_0x41010d);}(_0x5462,0x19a));var _0x2546=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x5462[_0x5ef905];return _0x367808;};'use strict';var multer=require(_0x2546('0x0'));var util=require(_0x2546('0x1'));var path=require(_0x2546('0x2'));var timeout=require(_0x2546('0x3'));var express=require('express');var router=express[_0x2546('0x4')]();var fs_extra=require(_0x2546('0x5'));var auth=require(_0x2546('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2546('0x7'));var controller=require(_0x2546('0x8'));router[_0x2546('0x9')]('/',auth[_0x2546('0xa')](),controller[_0x2546('0xb')]);router[_0x2546('0x9')](_0x2546('0xc'),auth[_0x2546('0xa')](),controller[_0x2546('0xd')]);router[_0x2546('0x9')](_0x2546('0xe'),auth[_0x2546('0xa')](),controller['show']);router[_0x2546('0x9')](_0x2546('0xf'),auth[_0x2546('0xa')](),controller[_0x2546('0x10')]);router['get']('/:id/teams',auth[_0x2546('0xa')](),controller[_0x2546('0x11')]);router[_0x2546('0x9')]('/:id/users',auth[_0x2546('0xa')](),controller[_0x2546('0x12')]);router[_0x2546('0x13')]('/',auth[_0x2546('0xa')](),controller[_0x2546('0x14')]);router['post']('/:id/teams',auth[_0x2546('0xa')](),controller[_0x2546('0x15')]);router[_0x2546('0x13')]('/:id/users',auth[_0x2546('0xa')](),controller[_0x2546('0x16')]);router[_0x2546('0x17')](_0x2546('0xe'),auth[_0x2546('0xa')](),controller['update']);router[_0x2546('0x18')](_0x2546('0xe'),auth[_0x2546('0xa')](),controller['destroy']);router['delete'](_0x2546('0x19'),auth[_0x2546('0xa')](),controller[_0x2546('0x1a')]);router[_0x2546('0x18')](_0x2546('0x1b'),auth['isAuthenticated'](),controller[_0x2546('0x1c')]);module[_0x2546('0x1d')]=router; \ No newline at end of file +var _0x8cff=['./openchannelQueue.controller','get','isAuthenticated','index','describe','show','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xea7023,_0x124a17){var _0x57f456=function(_0x17803c){while(--_0x17803c){_0xea7023['push'](_0xea7023['shift']());}};_0x57f456(++_0x124a17);}(_0x8cff,0x13d));var _0xf8cf=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8cff[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xf8cf('0x0'));var util=require(_0xf8cf('0x1'));var path=require(_0xf8cf('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8cf('0x3'));var router=express[_0xf8cf('0x4')]();var fs_extra=require(_0xf8cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf8cf('0x6'));var config=require(_0xf8cf('0x7'));var controller=require(_0xf8cf('0x8'));router[_0xf8cf('0x9')]('/',auth[_0xf8cf('0xa')](),controller[_0xf8cf('0xb')]);router[_0xf8cf('0x9')]('/describe',auth[_0xf8cf('0xa')](),controller[_0xf8cf('0xc')]);router['get']('/:id',auth[_0xf8cf('0xa')](),controller[_0xf8cf('0xd')]);router['get']('/:id/members',auth[_0xf8cf('0xa')](),controller[_0xf8cf('0xe')]);router[_0xf8cf('0x9')](_0xf8cf('0xf'),auth[_0xf8cf('0xa')](),controller['getTeams']);router[_0xf8cf('0x9')](_0xf8cf('0x10'),auth[_0xf8cf('0xa')](),controller[_0xf8cf('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf8cf('0x12')](_0xf8cf('0xf'),auth[_0xf8cf('0xa')](),controller[_0xf8cf('0x13')]);router[_0xf8cf('0x12')](_0xf8cf('0x10'),auth['isAuthenticated'](),controller[_0xf8cf('0x14')]);router['put'](_0xf8cf('0x15'),auth[_0xf8cf('0xa')](),controller[_0xf8cf('0x16')]);router[_0xf8cf('0x17')](_0xf8cf('0x15'),auth[_0xf8cf('0xa')](),controller[_0xf8cf('0x18')]);router[_0xf8cf('0x17')](_0xf8cf('0xf'),auth[_0xf8cf('0xa')](),controller['removeTeams']);router[_0xf8cf('0x17')](_0xf8cf('0x10'),auth[_0xf8cf('0xa')](),controller['removeAgents']);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 1e9093a..115b57c 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 _0x35bc=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35bc,0x139));var _0xc35b=function(_0x1a51db,_0x2eecdc){_0x1a51db=_0x1a51db-0x0;var _0xea0473=_0x35bc[_0x1a51db];return _0xea0473;};'use strict';var Sequelize=require(_0xc35b('0x0'));module[_0xc35b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc35b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc35b('0x3')](_0xc35b('0x4'),_0xc35b('0x5'),_0xc35b('0x6'))}}; \ No newline at end of file +var _0xc1a9=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x226cad,_0x262e18){var _0x2f73a1=function(_0x403844){while(--_0x403844){_0x226cad['push'](_0x226cad['shift']());}};_0x2f73a1(++_0x262e18);}(_0xc1a9,0x13f));var _0x9c1a=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xc1a9[_0x22e47a];return _0x15a12a;};'use strict';var Sequelize=require(_0x9c1a('0x0'));module[_0x9c1a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c1a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9c1a('0x3')]},'timeout':{'type':Sequelize[_0x9c1a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c1a('0x5')](_0x9c1a('0x6'),_0x9c1a('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 041d556..a67469d 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 _0xe2cd=['Content-Range','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','getOptions','where','OpenchannelQueue','include','findAll','show','params','keys','query','intersection','attributes','model','fields','length','includeAll','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','filters','OpenchannelQueueId','filter','options','User','findAndCountAll','UserId','agent','openchannelPause','rows','format','%s/%s','createdAt','updatedAt','findOne','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','squel','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x300bcb,_0x59a0f2){var _0x50fdca=function(_0xe91b21){while(--_0xe91b21){_0x300bcb['push'](_0x300bcb['shift']());}};_0x50fdca(++_0x59a0f2);}(_0xe2cd,0x158));var _0xde2c=function(_0x2e7666,_0x55d9b3){_0x2e7666=_0x2e7666-0x0;var _0x4c11bd=_0xe2cd[_0x2e7666];return _0x4c11bd;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var squel=require(_0xde2c('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xde2c('0x1'))('api');var config=require(_0xde2c('0x2'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xde2c('0x3')](config[_0xde2c('0x4')],{'host':_0xde2c('0x5'),'port':0x18eb});var socket=require(_0xde2c('0x6'))(new Redis(config[_0xde2c('0x4')]));require(_0xde2c('0x7'))['register'](socket);function respondWithStatusCode(_0x3c68c9,_0x416a15){_0x416a15=_0x416a15||0xcc;return function(_0x20e274){if(_0x20e274){return _0x3c68c9[_0xde2c('0x8')](_0x416a15);}return _0x3c68c9[_0xde2c('0x9')](_0x416a15)[_0xde2c('0xa')]();};}function respondWithResult(_0x198567,_0x2e711e){_0x2e711e=_0x2e711e||0xc8;return function(_0x280f12){if(_0x280f12){return _0x198567['status'](_0x2e711e)[_0xde2c('0xb')](_0x280f12);}};}function respondWithFilteredResult(_0x2b23d8,_0x55850a){return function(_0x184c2f){if(_0x184c2f){var _0xb854e=typeof _0x55850a['offset']===_0xde2c('0xc')&&typeof _0x55850a[_0xde2c('0xd')]===_0xde2c('0xc');var _0x5a339b=_0x184c2f['count'];var _0x80e455=_0xb854e?0x0:_0x55850a['offset'];var _0x291e30=_0xb854e?_0x184c2f[_0xde2c('0xe')]:_0x55850a[_0xde2c('0xf')]+_0x55850a['limit'];var _0x1ba52d;if(_0x291e30>=_0x5a339b){_0x291e30=_0x5a339b;_0x1ba52d=0xc8;}else{_0x1ba52d=0xce;}_0x2b23d8[_0xde2c('0x9')](_0x1ba52d);return _0x2b23d8['set'](_0xde2c('0x10'),_0x80e455+'-'+_0x291e30+'/'+_0x5a339b)[_0xde2c('0xb')](_0x184c2f);}return null;};}function saveUpdates(_0xbecd12){return function(_0x1add8c){if(_0x1add8c){return _0x1add8c[_0xde2c('0x11')](_0xbecd12)[_0xde2c('0x12')](function(_0x310d43){return _0x310d43;});}return null;};}function removeEntity(_0x4121a5){return function(_0x1b0f84){if(_0x1b0f84){return _0x1b0f84[_0xde2c('0x13')]()[_0xde2c('0x12')](function(){var _0x1b1ecc=_0x1b0f84['get']({'plain':!![]});var _0x3ed379=_0xde2c('0x14');return db[_0xde2c('0x15')][_0xde2c('0x13')]({'where':{'type':_0x3ed379,'resourceId':_0x1b1ecc['id']}})[_0xde2c('0x12')](function(){return _0x1b0f84;});})['then'](function(){_0x4121a5[_0xde2c('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8f0f9){return function(_0x3f8068){if(!_0x3f8068){_0xe8f0f9['sendStatus'](0x194);}return _0x3f8068;};}function handleError(_0x51f505,_0x6f0f01){_0x6f0f01=_0x6f0f01||0x1f4;return function(_0x371cfe){logger[_0xde2c('0x16')](_0x371cfe[_0xde2c('0x17')]);if(_0x371cfe[_0xde2c('0x18')]){delete _0x371cfe[_0xde2c('0x18')];}_0x51f505['status'](_0x6f0f01)[_0xde2c('0x19')](_0x371cfe);};}exports['index']=function(_0x2d15b5,_0x47cd3e){var _0x14b00c={};var _0x2e5ac4={'count':0x0,'rows':[]};var _0x2544ed=_[_0xde2c('0x1a')](db['OpenchannelQueue'][_0xde2c('0x1b')],function(_0x35b376){return{'name':_0x35b376[_0xde2c('0x1c')],'type':_0x35b376['type'][_0xde2c('0x1d')]};});_0x14b00c=qs[_0xde2c('0x1e')](_0x2544ed,_0x2d15b5);var _0x3b1b89={'where':_0x14b00c[_0xde2c('0x1f')]};return db[_0xde2c('0x20')][_0xde2c('0xe')](_0x3b1b89)[_0xde2c('0x12')](function(_0x523f4b){_0x2e5ac4['count']=_0x523f4b;_0x14b00c[_0xde2c('0x21')]=qs[_0xde2c('0x21')](_0x2d15b5['query']);return db['OpenchannelQueue'][_0xde2c('0x22')](_0x14b00c);})[_0xde2c('0x12')](function(_0x18ec7a){_0x2e5ac4['rows']=_0x18ec7a;return _0x2e5ac4;})[_0xde2c('0x12')](respondWithFilteredResult(_0x47cd3e,_0x14b00c))['catch'](handleError(_0x47cd3e,null));};exports[_0xde2c('0x23')]=function(_0x120afe,_0x134d9b){var _0x439ed2={'raw':!![],'where':{'id':_0x120afe[_0xde2c('0x24')]['id']}},_0x492415={};_0x492415['model']=_[_0xde2c('0x25')](db[_0xde2c('0x20')][_0xde2c('0x1b')]);_0x492415[_0xde2c('0x26')]=_['keys'](_0x120afe['query']);_0x492415['filters']=_[_0xde2c('0x27')](_0x492415['model'],_0x492415[_0xde2c('0x26')]);_0x439ed2[_0xde2c('0x28')]=_['intersection'](_0x492415[_0xde2c('0x29')],qs['fields'](_0x120afe[_0xde2c('0x26')][_0xde2c('0x2a')]));_0x439ed2[_0xde2c('0x28')]=_0x439ed2[_0xde2c('0x28')][_0xde2c('0x2b')]?_0x439ed2[_0xde2c('0x28')]:_0x492415['model'];if(_0x120afe['query'][_0xde2c('0x2c')]){_0x439ed2[_0xde2c('0x21')]=[{'all':!![]}];}_0x439ed2=_[_0xde2c('0x2d')]({},_0x439ed2,_0x120afe['options']);return db[_0xde2c('0x20')][_0xde2c('0x2e')](_0x439ed2)[_0xde2c('0x12')](handleEntityNotFound(_0x134d9b,null))[_0xde2c('0x12')](respondWithResult(_0x134d9b,null))[_0xde2c('0x2f')](handleError(_0x134d9b,null));};exports[_0xde2c('0x30')]=function(_0x9d7d53,_0x530451){return db[_0xde2c('0x20')][_0xde2c('0x30')](_0x9d7d53[_0xde2c('0x31')],{})[_0xde2c('0x12')](function(_0x5a8754){var _0x19da6e=_0x9d7d53[_0xde2c('0x32')][_0xde2c('0x33')]({'plain':!![]});if(!_0x19da6e)throw new Error(_0xde2c('0x34'));if(_0x19da6e['role']===_0xde2c('0x32')){var _0x29c15d=_0x5a8754['get']({'plain':!![]});var _0x3abd29=_0xde2c('0x14');return db[_0xde2c('0x35')]['find']({'where':{'name':_0x3abd29,'userProfileId':_0x19da6e['userProfileId']},'raw':!![]})['then'](function(_0x146e02){if(_0x146e02&&_0x146e02[_0xde2c('0x36')]===0x0){return db['UserProfileResource']['create']({'name':_0x29c15d[_0xde2c('0x18')],'resourceId':_0x29c15d['id'],'type':_0x146e02[_0xde2c('0x18')],'sectionId':_0x146e02['id']},{})[_0xde2c('0x12')](function(){return _0x5a8754;});}else{return _0x5a8754;}})[_0xde2c('0x2f')](function(_0x4c5e3b){logger['error'](_0xde2c('0x37'),_0x4c5e3b);throw _0x4c5e3b;});}return _0x5a8754;})[_0xde2c('0x12')](respondWithResult(_0x530451,0xc9))[_0xde2c('0x2f')](handleError(_0x530451,null));};exports[_0xde2c('0x11')]=function(_0x270c2f,_0x3737b1){if(_0x270c2f['body']['id']){delete _0x270c2f['body']['id'];}return db[_0xde2c('0x20')][_0xde2c('0x2e')]({'where':{'id':_0x270c2f['params']['id']}})[_0xde2c('0x12')](handleEntityNotFound(_0x3737b1,null))[_0xde2c('0x12')](saveUpdates(_0x270c2f[_0xde2c('0x31')],null))[_0xde2c('0x12')](respondWithResult(_0x3737b1,null))[_0xde2c('0x2f')](handleError(_0x3737b1,null));};exports['destroy']=function(_0x4b26c9,_0x5f2762){return db[_0xde2c('0x20')][_0xde2c('0x2e')]({'where':{'id':_0x4b26c9[_0xde2c('0x24')]['id']}})[_0xde2c('0x12')](handleEntityNotFound(_0x5f2762,null))[_0xde2c('0x12')](removeEntity(_0x5f2762,null))[_0xde2c('0x2f')](handleError(_0x5f2762,null));};exports[_0xde2c('0x38')]=function(_0x46f284,_0x16589c){return db[_0xde2c('0x20')][_0xde2c('0x38')]()['then'](respondWithResult(_0x16589c,null))[_0xde2c('0x2f')](handleError(_0x16589c,null));};exports[_0xde2c('0x39')]=function(_0x4c0976,_0x507ed5){var _0x5be9ef={'raw':!![],'where':{}},_0x41dce3={},_0x237f34;return db[_0xde2c('0x20')]['findOne']({'where':{'id':_0x4c0976[_0xde2c('0x24')]['id']}})[_0xde2c('0x12')](handleEntityNotFound(_0x507ed5,null))[_0xde2c('0x12')](function(_0x1f1fc7){if(_0x1f1fc7){_0x237f34=_0x1f1fc7[_0xde2c('0x33')]({'plain':!![]});_0x41dce3['model']=_[_0xde2c('0x25')](db[_0xde2c('0x3a')][_0xde2c('0x1b')]);_0x41dce3[_0xde2c('0x26')]=_[_0xde2c('0x25')](_0x4c0976[_0xde2c('0x26')]);_0x41dce3['filters']=_[_0xde2c('0x27')](_0x41dce3[_0xde2c('0x29')],_0x41dce3[_0xde2c('0x26')]);_0x5be9ef[_0xde2c('0x28')]=_['intersection'](_0x41dce3[_0xde2c('0x29')],qs[_0xde2c('0x2a')](_0x4c0976[_0xde2c('0x26')][_0xde2c('0x2a')]));_0x5be9ef[_0xde2c('0x28')]=_0x5be9ef[_0xde2c('0x28')]['length']?_0x5be9ef[_0xde2c('0x28')]:_0x41dce3['model'];if(!_0x4c0976[_0xde2c('0x26')][_0xde2c('0x3b')](_0xde2c('0x3c'))){_0x5be9ef['limit']=qs[_0xde2c('0xd')](_0x4c0976[_0xde2c('0x26')]['limit']);_0x5be9ef['offset']=qs['offset'](_0x4c0976['query']['offset']);}_0x5be9ef[_0xde2c('0x3d')]=qs[_0xde2c('0x3e')](_0x4c0976['query'][_0xde2c('0x3e')]);_0x5be9ef['where']=qs['filters'](_[_0xde2c('0x3f')](_0x4c0976[_0xde2c('0x26')],_0x41dce3[_0xde2c('0x40')]));_0x5be9ef[_0xde2c('0x1f')][_0xde2c('0x41')]=_0x1f1fc7['id'];if(_0x4c0976[_0xde2c('0x26')][_0xde2c('0x42')]){_0x5be9ef[_0xde2c('0x1f')]=_[_0xde2c('0x2d')](_0x5be9ef[_0xde2c('0x1f')],{'$or':_[_0xde2c('0x1a')](_0x5be9ef[_0xde2c('0x28')],function(_0x7e43e4){var _0xf62d61={};_0xf62d61[_0x7e43e4]={'$like':'%'+_0x4c0976[_0xde2c('0x26')][_0xde2c('0x42')]+'%'};return _0xf62d61;})});}_0x5be9ef=_[_0xde2c('0x2d')]({},_0x5be9ef,_0x4c0976[_0xde2c('0x43')]);return db[_0xde2c('0x3a')][_0xde2c('0x22')](_0x5be9ef);}})[_0xde2c('0x12')](function(_0x7da61c){if(_0x7da61c){return db[_0xde2c('0x44')][_0xde2c('0x45')]({'where':{'id':_[_0xde2c('0x1a')](_0x7da61c,_0xde2c('0x46')),'role':_0xde2c('0x47')},'attributes':['id',_0xde2c('0x18'),_0xde2c('0x48'),'updatedAt','createdAt']});}})[_0xde2c('0x12')](function(_0x120e6d){if(_0x120e6d){return{'count':_0x120e6d[_0xde2c('0xe')],'rows':_[_0xde2c('0x1a')](_0x120e6d[_0xde2c('0x49')],function(_0x1582b2){return{'membername':_0x1582b2[_0xde2c('0x18')],'UserId':_0x1582b2['id'],'queue_name':_0x237f34[_0xde2c('0x18')],'OpenchannelQueueId':_0x237f34['id'],'interface':util[_0xde2c('0x4a')](_0xde2c('0x4b'),'SIP',_0x1582b2[_0xde2c('0x18')]),'penalty':0x0,'paused':_0x1582b2['openchannelPause'],'createdAt':_0x1582b2[_0xde2c('0x4c')],'updatedAt':_0x1582b2[_0xde2c('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xde2c('0x12')](respondWithFilteredResult(_0x507ed5,_0x5be9ef))[_0xde2c('0x2f')](handleError(_0x507ed5,null));};exports['getTeams']=function(_0x3ba0f6,_0x56430e){var _0xae3514={};var _0x1d670b={};var _0x5e649c;var _0x4b5c4d;return db[_0xde2c('0x20')][_0xde2c('0x4e')]({'where':{'id':_0x3ba0f6[_0xde2c('0x24')]['id']}})[_0xde2c('0x12')](handleEntityNotFound(_0x56430e,null))[_0xde2c('0x12')](function(_0x5245c3){if(_0x5245c3){_0x5e649c=_0x5245c3;_0x1d670b[_0xde2c('0x29')]=_['keys'](db[_0xde2c('0x4f')][_0xde2c('0x1b')]);_0x1d670b[_0xde2c('0x26')]=_['keys'](_0x3ba0f6['query']);_0x1d670b[_0xde2c('0x40')]=_[_0xde2c('0x27')](_0x1d670b[_0xde2c('0x29')],_0x1d670b['query']);_0xae3514[_0xde2c('0x28')]=_[_0xde2c('0x27')](_0x1d670b['model'],qs['fields'](_0x3ba0f6[_0xde2c('0x26')]['fields']));_0xae3514[_0xde2c('0x28')]=_0xae3514[_0xde2c('0x28')][_0xde2c('0x2b')]?_0xae3514[_0xde2c('0x28')]:_0x1d670b['model'];_0xae3514['order']=qs[_0xde2c('0x3e')](_0x3ba0f6[_0xde2c('0x26')][_0xde2c('0x3e')]);_0xae3514['where']=qs[_0xde2c('0x40')](_[_0xde2c('0x3f')](_0x3ba0f6[_0xde2c('0x26')],_0x1d670b[_0xde2c('0x40')]));if(_0x3ba0f6[_0xde2c('0x26')][_0xde2c('0x42')]){_0xae3514[_0xde2c('0x1f')]=_[_0xde2c('0x2d')](_0xae3514[_0xde2c('0x1f')],{'$or':_[_0xde2c('0x1a')](_0xae3514['attributes'],function(_0x5e3a9a){var _0x5bb698={};_0x5bb698[_0x5e3a9a]={'$like':'%'+_0x3ba0f6[_0xde2c('0x26')][_0xde2c('0x42')]+'%'};return _0x5bb698;})});}_0xae3514=_[_0xde2c('0x2d')]({},_0xae3514,_0x3ba0f6[_0xde2c('0x43')]);return _0x5e649c[_0xde2c('0x50')](_0xae3514);}})[_0xde2c('0x12')](function(_0x471c8e){if(_0x471c8e){_0x4b5c4d=_0x471c8e[_0xde2c('0x2b')];if(!_0x3ba0f6[_0xde2c('0x26')][_0xde2c('0x3b')](_0xde2c('0x3c'))){_0xae3514[_0xde2c('0xd')]=qs[_0xde2c('0xd')](_0x3ba0f6[_0xde2c('0x26')][_0xde2c('0xd')]);_0xae3514['offset']=qs['offset'](_0x3ba0f6[_0xde2c('0x26')][_0xde2c('0xf')]);}return _0x5e649c[_0xde2c('0x50')](_0xae3514);}})[_0xde2c('0x12')](function(_0x1299e4){if(_0x1299e4){return _0x1299e4?{'count':_0x4b5c4d,'rows':_0x1299e4}:null;}})[_0xde2c('0x12')](respondWithResult(_0x56430e,null))[_0xde2c('0x2f')](handleError(_0x56430e,null));};exports[_0xde2c('0x51')]=function(_0x3e11a3,_0x55858c){var _0xdbf200=_0x3e11a3[_0xde2c('0x31')][_0xde2c('0x52')];return db[_0xde2c('0x4f')][_0xde2c('0x22')]({'where':{'id':_0xdbf200},'attributes':['id'],'include':[{'model':db[_0xde2c('0x44')],'as':_0xde2c('0x53'),'attributes':['id',_0xde2c('0x18'),_0xde2c('0x54'),'voicePause',_0xde2c('0x55')],'raw':!![]}]})[_0xde2c('0x12')](function(_0x226f4d){if(_0x226f4d){var _0x4ac5b6=_[_0xde2c('0x56')](_0x226f4d,function(_0x170f93){var _0x101d94=_0x170f93[_0xde2c('0x33')]({'plain':!![]});return _0x101d94[_0xde2c('0x53')];});return db[_0xde2c('0x20')][_0xde2c('0x2e')]({'where':{'id':_0x3e11a3[_0xde2c('0x24')]['id']}})[_0xde2c('0x12')](function(_0x13d948){return db[_0xde2c('0x57')][_0xde2c('0x58')](function(_0x52c0a7){return _0x13d948['addTeams'](_0xdbf200,{'transaction':_0x52c0a7})[_0xde2c('0x12')](function(){return BPromise[_0xde2c('0x59')](_0x4ac5b6,function(_0x420c9b){return db[_0xde2c('0x3a')][_0xde2c('0x5a')]({'where':{'UserId':_0x420c9b['id'],'OpenchannelQueueId':_0x3e11a3[_0xde2c('0x24')]['id']},'transaction':_0x52c0a7});});})[_0xde2c('0x12')](function(){_0x4ac5b6[_0xde2c('0x5b')](function(_0x524969){socket['emit'](_0xde2c('0x5c'),{'UserId':_0x524969['id'],'OpenchannelQueueId':_0x13d948['id']});});});});});}})[_0xde2c('0x12')](respondWithStatusCode(_0x55858c,null))[_0xde2c('0x2f')](handleError(_0x55858c,null));};exports[_0xde2c('0x5d')]=function(_0x11a9ba,_0xadf70d){return db[_0xde2c('0x4f')]['findAll']({'where':{'id':_0x11a9ba[_0xde2c('0x26')][_0xde2c('0x52')]},'attributes':['id'],'include':[{'model':db[_0xde2c('0x44')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xde2c('0x12')](handleEntityNotFound(_0xadf70d,null))[_0xde2c('0x12')](function(_0x41f5c8){var _0x1a02be=_[_0xde2c('0x1a')](_0x41f5c8,'id');var _0x32789e=[];var _0x45b2e9=[];var _0x52353c=squel[_0xde2c('0x5e')]();_0x52353c[_0xde2c('0x5f')](_0xde2c('0x60'))['from'](_0xde2c('0x61'),'tq')[_0xde2c('0x62')](_0xde2c('0x63'),'ut',_0xde2c('0x64'))[_0xde2c('0x1f')](_0xde2c('0x65'),_0x11a9ba[_0xde2c('0x24')]['id']);for(var _0x4522a2=0x0;_0x4522a2<_0x41f5c8['length'];_0x4522a2+=0x1){let _0x56d11f=_0x41f5c8[_0x4522a2];for(var _0x31063d=0x0;_0x31063d<_0x56d11f[_0xde2c('0x53')][_0xde2c('0x2b')];_0x31063d+=0x1){let _0xdab3d4=_0x56d11f['Agents'][_0x31063d];var _0x4c6543=_0x52353c['clone']();_0x4c6543[_0xde2c('0x1f')](_0xde2c('0x66'),_0xdab3d4['id']);_0x45b2e9[_0xde2c('0x67')](db['sequelize'][_0xde2c('0x26')](_0x4c6543[_0xde2c('0x68')](),{'type':db['sequelize'][_0xde2c('0x69')]['SELECT']})[_0xde2c('0x12')](function(_0x195e38){if(_0x195e38['length']===0x1){return _0xdab3d4['id'];}else{var _0x42c052=_[_0xde2c('0x6a')](_[_0xde2c('0x1a')](_0x195e38,_0xde2c('0x6b')),function(_0x4fe09b){return _[_0xde2c('0x6c')](_0x1a02be,_0x4fe09b);});if(_0x42c052){return _0xdab3d4['id'];}}}));}}return BPromise[_0xde2c('0x6d')](_0x45b2e9)[_0xde2c('0x12')](function(_0x18ce2f){_0x32789e=_(_0x32789e)['union'](_0x18ce2f)['compact']()[_0xde2c('0x6e')]();return db[_0xde2c('0x20')][_0xde2c('0x2e')]({'where':{'id':_0x11a9ba[_0xde2c('0x24')]['id']}})[_0xde2c('0x12')](function(_0x3b2e6a){return db['sequelize']['transaction'](function(_0x4b77b1){return _0x3b2e6a[_0xde2c('0x5d')](_0x11a9ba[_0xde2c('0x26')][_0xde2c('0x52')],{'transaction':_0x4b77b1})[_0xde2c('0x12')](function(){if(!_[_0xde2c('0x6f')](_0x32789e)){return _0x3b2e6a[_0xde2c('0x70')](_0x32789e,{'transaction':_0x4b77b1});}})[_0xde2c('0x12')](function(){_0x32789e[_0xde2c('0x5b')](function(_0xa1f518){socket[_0xde2c('0x71')](_0xde2c('0x72'),{'UserId':_0xa1f518,'OpenchannelQueueId':_0x3b2e6a['id']});});});});});});})['then'](respondWithStatusCode(_0xadf70d,null))[_0xde2c('0x2f')](handleError(_0xadf70d,null));};exports[_0xde2c('0x73')]=function(_0x376bb4,_0x11a7a1){return db[_0xde2c('0x20')][_0xde2c('0x2e')]({'where':{'id':_0x376bb4[_0xde2c('0x24')]['id']}})['then'](handleEntityNotFound(_0x11a7a1,null))[_0xde2c('0x12')](function(_0xffd3b2){if(_0xffd3b2){return _0xffd3b2[_0xde2c('0x73')](_0x376bb4[_0xde2c('0x31')][_0xde2c('0x52')],_[_0xde2c('0x74')](_0x376bb4[_0xde2c('0x31')],['ids','id'])||{})[_0xde2c('0x75')](function(_0x4bfcd6){for(var _0x1e225d=0x0;_0x1e225d<_0x376bb4['body'][_0xde2c('0x52')]['length'];_0x1e225d+=0x1){socket[_0xde2c('0x71')](_0xde2c('0x5c'),{'UserId':Number(_0x376bb4[_0xde2c('0x31')][_0xde2c('0x52')][_0x1e225d]),'OpenchannelQueueId':Number(_0x376bb4[_0xde2c('0x24')]['id'])});}return _0x4bfcd6;});}})[_0xde2c('0x12')](respondWithResult(_0x11a7a1,null))['catch'](handleError(_0x11a7a1,null));};exports[_0xde2c('0x70')]=function(_0x4e4b76,_0x210307){return db[_0xde2c('0x20')]['find']({'where':{'id':_0x4e4b76[_0xde2c('0x24')]['id']}})[_0xde2c('0x12')](handleEntityNotFound(_0x210307,null))[_0xde2c('0x12')](function(_0x556dcd){if(_0x556dcd){return _0x556dcd[_0xde2c('0x70')](_0x4e4b76['query']['ids'])[_0xde2c('0x12')](function(){if(_[_0xde2c('0x76')](_0x4e4b76[_0xde2c('0x26')][_0xde2c('0x52')])){for(var _0x35fd4b=0x0;_0x35fd4b<_0x4e4b76['query'][_0xde2c('0x52')]['length'];_0x35fd4b+=0x1){socket[_0xde2c('0x71')](_0xde2c('0x72'),{'UserId':Number(_0x4e4b76['query'][_0xde2c('0x52')][_0x35fd4b]),'OpenchannelQueueId':Number(_0x4e4b76['params']['id'])});}}else{socket[_0xde2c('0x71')](_0xde2c('0x72'),{'UserId':Number(_0x4e4b76['query'][_0xde2c('0x52')]),'OpenchannelQueueId':Number(_0x4e4b76['params']['id'])});}});}})[_0xde2c('0x12')](respondWithStatusCode(_0x210307,null))[_0xde2c('0x2f')](handleError(_0x210307,null));};exports[_0xde2c('0x77')]=function(_0x119622,_0x14892d){var _0x5ec44c={};var _0x2e6c3e={};var _0xc47dbe;var _0xac71fd;return db[_0xde2c('0x20')]['findOne']({'where':{'id':_0x119622[_0xde2c('0x24')]['id']}})['then'](handleEntityNotFound(_0x14892d,null))[_0xde2c('0x12')](function(_0x4b0d93){if(_0x4b0d93){_0xc47dbe=_0x4b0d93;_0x2e6c3e[_0xde2c('0x29')]=_[_0xde2c('0x25')](db[_0xde2c('0x44')][_0xde2c('0x1b')]);_0x2e6c3e[_0xde2c('0x26')]=_[_0xde2c('0x25')](_0x119622[_0xde2c('0x26')]);_0x2e6c3e[_0xde2c('0x40')]=_[_0xde2c('0x27')](_0x2e6c3e[_0xde2c('0x29')],_0x2e6c3e[_0xde2c('0x26')]);_0x5ec44c['attributes']=_[_0xde2c('0x27')](_0x2e6c3e[_0xde2c('0x29')],qs['fields'](_0x119622['query'][_0xde2c('0x2a')]));_0x5ec44c[_0xde2c('0x28')]=_0x5ec44c['attributes'][_0xde2c('0x2b')]?_0x5ec44c['attributes']:_0x2e6c3e[_0xde2c('0x29')];_0x5ec44c[_0xde2c('0x3d')]=qs[_0xde2c('0x3e')](_0x119622['query'][_0xde2c('0x3e')]);_0x5ec44c[_0xde2c('0x1f')]=qs[_0xde2c('0x40')](_['pick'](_0x119622['query'],_0x2e6c3e['filters']));if(_0x119622[_0xde2c('0x26')][_0xde2c('0x42')]){_0x5ec44c[_0xde2c('0x1f')]=_[_0xde2c('0x2d')](_0x5ec44c['where'],{'$or':_[_0xde2c('0x1a')](_0x5ec44c['attributes'],function(_0x54f66){var _0x27b2d3={};_0x27b2d3[_0x54f66]={'$like':'%'+_0x119622['query']['filter']+'%'};return _0x27b2d3;})});}_0x5ec44c=_[_0xde2c('0x2d')]({},_0x5ec44c,_0x119622[_0xde2c('0x43')]);return _0xc47dbe['getAgents'](_0x5ec44c);}})[_0xde2c('0x12')](function(_0x413504){if(_0x413504){_0xac71fd=_0x413504[_0xde2c('0x2b')];if(!_0x119622['query']['hasOwnProperty']('nolimit')){_0x5ec44c[_0xde2c('0xd')]=qs[_0xde2c('0xd')](_0x119622['query'][_0xde2c('0xd')]);_0x5ec44c[_0xde2c('0xf')]=qs['offset'](_0x119622[_0xde2c('0x26')][_0xde2c('0xf')]);}return _0xc47dbe[_0xde2c('0x77')](_0x5ec44c);}})[_0xde2c('0x12')](function(_0x27d1b1){if(_0x27d1b1){return _0x27d1b1?{'count':_0xac71fd,'rows':_0x27d1b1}:null;}})[_0xde2c('0x12')](respondWithResult(_0x14892d,null))['catch'](handleError(_0x14892d,null));}; \ No newline at end of file +var _0x08cb=['TeamId','includes','all','union','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','User','findAndCountAll','map','UserId','agent','openchannelPause','updatedAt','%s/%s','createdAt','findOne','Team','getTeams','ids','online','voicePause','interface','Agents','sequelize','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','findAll','select','from','team_has_openchannel_queues','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every'];(function(_0x4d79ca,_0x413286){var _0x57af1f=function(_0x5df6f3){while(--_0x5df6f3){_0x4d79ca['push'](_0x4d79ca['shift']());}};_0x57af1f(++_0x413286);}(_0x08cb,0x86));var _0xb08c=function(_0x128d33,_0x1a3013){_0x128d33=_0x128d33-0x0;var _0x476785=_0x08cb[_0x128d33];return _0x476785;};'use strict';var BPromise=require(_0xb08c('0x0'));var util=require('util');var _=require(_0xb08c('0x1'));var squel=require(_0xb08c('0x2'));var Redis=require('ioredis');var qs=require(_0xb08c('0x3'));var logger=require(_0xb08c('0x4'))(_0xb08c('0x5'));var config=require(_0xb08c('0x6'));var db=require(_0xb08c('0x7'))['db'];config[_0xb08c('0x8')]=_[_0xb08c('0x9')](config[_0xb08c('0x8')],{'host':_0xb08c('0xa'),'port':0x18eb});var socket=require(_0xb08c('0xb'))(new Redis(config['redis']));require(_0xb08c('0xc'))[_0xb08c('0xd')](socket);function respondWithStatusCode(_0x8e3613,_0x4a5580){_0x4a5580=_0x4a5580||0xcc;return function(_0x4855e6){if(_0x4855e6){return _0x8e3613[_0xb08c('0xe')](_0x4a5580);}return _0x8e3613[_0xb08c('0xf')](_0x4a5580)[_0xb08c('0x10')]();};}function respondWithResult(_0x5a5278,_0x5921e2){_0x5921e2=_0x5921e2||0xc8;return function(_0x714877){if(_0x714877){return _0x5a5278[_0xb08c('0xf')](_0x5921e2)['json'](_0x714877);}};}function respondWithFilteredResult(_0x5d5bdb,_0x2f0720){return function(_0xb23c0e){if(_0xb23c0e){var _0x1ce220=typeof _0x2f0720['offset']===_0xb08c('0x11')&&typeof _0x2f0720['limit']===_0xb08c('0x11');var _0x3f7e39=_0xb23c0e[_0xb08c('0x12')];var _0x1e6e20=_0x1ce220?0x0:_0x2f0720[_0xb08c('0x13')];var _0x24ab43=_0x1ce220?_0xb23c0e['count']:_0x2f0720[_0xb08c('0x13')]+_0x2f0720[_0xb08c('0x14')];var _0x48ede6;if(_0x24ab43>=_0x3f7e39){_0x24ab43=_0x3f7e39;_0x48ede6=0xc8;}else{_0x48ede6=0xce;}_0x5d5bdb[_0xb08c('0xf')](_0x48ede6);return _0x5d5bdb[_0xb08c('0x15')](_0xb08c('0x16'),_0x1e6e20+'-'+_0x24ab43+'/'+_0x3f7e39)[_0xb08c('0x17')](_0xb23c0e);}return null;};}function saveUpdates(_0x102073){return function(_0x58d79e){if(_0x58d79e){return _0x58d79e[_0xb08c('0x18')](_0x102073)['then'](function(_0x454efb){return _0x454efb;});}return null;};}function removeEntity(_0x334bcc){return function(_0x4e68de){if(_0x4e68de){return _0x4e68de['destroy']()[_0xb08c('0x19')](function(){var _0x2bba4c=_0x4e68de[_0xb08c('0x1a')]({'plain':!![]});var _0x147ab9='OpenchannelQueues';return db[_0xb08c('0x1b')][_0xb08c('0x1c')]({'where':{'type':_0x147ab9,'resourceId':_0x2bba4c['id']}})['then'](function(){return _0x4e68de;});})[_0xb08c('0x19')](function(){_0x334bcc[_0xb08c('0xf')](0xcc)[_0xb08c('0x10')]();});}};}function handleEntityNotFound(_0x555cc1){return function(_0x1af9d8){if(!_0x1af9d8){_0x555cc1[_0xb08c('0xe')](0x194);}return _0x1af9d8;};}function handleError(_0x33c781,_0x387a9f){_0x387a9f=_0x387a9f||0x1f4;return function(_0x514df6){logger[_0xb08c('0x1d')](_0x514df6[_0xb08c('0x1e')]);if(_0x514df6[_0xb08c('0x1f')]){delete _0x514df6[_0xb08c('0x1f')];}_0x33c781[_0xb08c('0xf')](_0x387a9f)[_0xb08c('0x20')](_0x514df6);};}exports[_0xb08c('0x21')]=function(_0x192600,_0x42fdbf){var _0x2ba4d8={};var _0x5730e9={'count':0x0,'rows':[]};var _0xae348e=_['map'](db[_0xb08c('0x22')][_0xb08c('0x23')],function(_0x3ef6ab){return{'name':_0x3ef6ab[_0xb08c('0x24')],'type':_0x3ef6ab[_0xb08c('0x25')][_0xb08c('0x26')]};});_0x2ba4d8=qs[_0xb08c('0x27')](_0xae348e,_0x192600);var _0x928f4f={'where':_0x2ba4d8[_0xb08c('0x28')]};return db[_0xb08c('0x22')][_0xb08c('0x12')](_0x928f4f)[_0xb08c('0x19')](function(_0x2d6420){_0x5730e9['count']=_0x2d6420;_0x2ba4d8['include']=qs['include'](_0x192600[_0xb08c('0x29')]);return db[_0xb08c('0x22')]['findAll'](_0x2ba4d8);})[_0xb08c('0x19')](function(_0x51ea61){_0x5730e9[_0xb08c('0x2a')]=_0x51ea61;return _0x5730e9;})['then'](respondWithFilteredResult(_0x42fdbf,_0x2ba4d8))[_0xb08c('0x2b')](handleError(_0x42fdbf,null));};exports[_0xb08c('0x2c')]=function(_0x1e3627,_0x4c9ca7){var _0x29bda7={'raw':!![],'where':{'id':_0x1e3627[_0xb08c('0x2d')]['id']}},_0x43c1bc={};_0x43c1bc[_0xb08c('0x2e')]=_[_0xb08c('0x2f')](db[_0xb08c('0x22')][_0xb08c('0x23')]);_0x43c1bc[_0xb08c('0x29')]=_['keys'](_0x1e3627[_0xb08c('0x29')]);_0x43c1bc[_0xb08c('0x30')]=_[_0xb08c('0x31')](_0x43c1bc[_0xb08c('0x2e')],_0x43c1bc['query']);_0x29bda7[_0xb08c('0x32')]=_[_0xb08c('0x31')](_0x43c1bc[_0xb08c('0x2e')],qs[_0xb08c('0x33')](_0x1e3627['query'][_0xb08c('0x33')]));_0x29bda7[_0xb08c('0x32')]=_0x29bda7['attributes'][_0xb08c('0x34')]?_0x29bda7[_0xb08c('0x32')]:_0x43c1bc[_0xb08c('0x2e')];if(_0x1e3627[_0xb08c('0x29')][_0xb08c('0x35')]){_0x29bda7[_0xb08c('0x36')]=[{'all':!![]}];}_0x29bda7=_[_0xb08c('0x37')]({},_0x29bda7,_0x1e3627[_0xb08c('0x38')]);return db[_0xb08c('0x22')][_0xb08c('0x39')](_0x29bda7)['then'](handleEntityNotFound(_0x4c9ca7,null))[_0xb08c('0x19')](respondWithResult(_0x4c9ca7,null))[_0xb08c('0x2b')](handleError(_0x4c9ca7,null));};exports[_0xb08c('0x3a')]=function(_0x1acb12,_0x135852){return db[_0xb08c('0x22')][_0xb08c('0x3a')](_0x1acb12[_0xb08c('0x3b')],{})['then'](function(_0x478dd3){var _0x116e67=_0x1acb12['user'][_0xb08c('0x1a')]({'plain':!![]});if(!_0x116e67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x116e67['role']===_0xb08c('0x3c')){var _0x3dc396=_0x478dd3[_0xb08c('0x1a')]({'plain':!![]});var _0x3cc72d=_0xb08c('0x3d');return db[_0xb08c('0x3e')]['find']({'where':{'name':_0x3cc72d,'userProfileId':_0x116e67[_0xb08c('0x3f')]},'raw':!![]})[_0xb08c('0x19')](function(_0x32b41e){if(_0x32b41e&&_0x32b41e[_0xb08c('0x40')]===0x0){return db[_0xb08c('0x1b')][_0xb08c('0x3a')]({'name':_0x3dc396['name'],'resourceId':_0x3dc396['id'],'type':_0x32b41e[_0xb08c('0x1f')],'sectionId':_0x32b41e['id']},{})[_0xb08c('0x19')](function(){return _0x478dd3;});}else{return _0x478dd3;}})[_0xb08c('0x2b')](function(_0x3d61c5){logger[_0xb08c('0x1d')](_0xb08c('0x41'),_0x3d61c5);throw _0x3d61c5;});}return _0x478dd3;})[_0xb08c('0x19')](respondWithResult(_0x135852,0xc9))[_0xb08c('0x2b')](handleError(_0x135852,null));};exports[_0xb08c('0x18')]=function(_0x3b6171,_0x36b523){if(_0x3b6171[_0xb08c('0x3b')]['id']){delete _0x3b6171['body']['id'];}return db[_0xb08c('0x22')][_0xb08c('0x39')]({'where':{'id':_0x3b6171[_0xb08c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x36b523,null))[_0xb08c('0x19')](saveUpdates(_0x3b6171[_0xb08c('0x3b')],null))[_0xb08c('0x19')](respondWithResult(_0x36b523,null))[_0xb08c('0x2b')](handleError(_0x36b523,null));};exports[_0xb08c('0x1c')]=function(_0x196c02,_0x1859b5){return db[_0xb08c('0x22')]['find']({'where':{'id':_0x196c02[_0xb08c('0x2d')]['id']}})[_0xb08c('0x19')](handleEntityNotFound(_0x1859b5,null))[_0xb08c('0x19')](removeEntity(_0x1859b5,null))[_0xb08c('0x2b')](handleError(_0x1859b5,null));};exports[_0xb08c('0x42')]=function(_0x234b92,_0x5bbf12){return db[_0xb08c('0x22')][_0xb08c('0x42')]()[_0xb08c('0x19')](respondWithResult(_0x5bbf12,null))[_0xb08c('0x2b')](handleError(_0x5bbf12,null));};exports[_0xb08c('0x43')]=function(_0x53c065,_0x4fbe2d){var _0x2e7883={'raw':!![],'where':{}},_0x404645={},_0x316c82;return db[_0xb08c('0x22')]['findOne']({'where':{'id':_0x53c065[_0xb08c('0x2d')]['id']}})[_0xb08c('0x19')](handleEntityNotFound(_0x4fbe2d,null))['then'](function(_0x222580){if(_0x222580){_0x316c82=_0x222580[_0xb08c('0x1a')]({'plain':!![]});_0x404645[_0xb08c('0x2e')]=_[_0xb08c('0x2f')](db[_0xb08c('0x44')][_0xb08c('0x23')]);_0x404645[_0xb08c('0x29')]=_[_0xb08c('0x2f')](_0x53c065[_0xb08c('0x29')]);_0x404645[_0xb08c('0x30')]=_[_0xb08c('0x31')](_0x404645[_0xb08c('0x2e')],_0x404645[_0xb08c('0x29')]);_0x2e7883[_0xb08c('0x32')]=_[_0xb08c('0x31')](_0x404645[_0xb08c('0x2e')],qs[_0xb08c('0x33')](_0x53c065['query'][_0xb08c('0x33')]));_0x2e7883[_0xb08c('0x32')]=_0x2e7883[_0xb08c('0x32')][_0xb08c('0x34')]?_0x2e7883[_0xb08c('0x32')]:_0x404645['model'];if(!_0x53c065[_0xb08c('0x29')][_0xb08c('0x45')](_0xb08c('0x46'))){_0x2e7883[_0xb08c('0x14')]=qs['limit'](_0x53c065[_0xb08c('0x29')]['limit']);_0x2e7883[_0xb08c('0x13')]=qs[_0xb08c('0x13')](_0x53c065[_0xb08c('0x29')][_0xb08c('0x13')]);}_0x2e7883[_0xb08c('0x47')]=qs[_0xb08c('0x48')](_0x53c065[_0xb08c('0x29')]['sort']);_0x2e7883['where']=qs['filters'](_[_0xb08c('0x49')](_0x53c065[_0xb08c('0x29')],_0x404645['filters']));_0x2e7883['where'][_0xb08c('0x4a')]=_0x222580['id'];if(_0x53c065[_0xb08c('0x29')][_0xb08c('0x4b')]){_0x2e7883[_0xb08c('0x28')]=_[_0xb08c('0x37')](_0x2e7883[_0xb08c('0x28')],{'$or':_['map'](_0x2e7883[_0xb08c('0x32')],function(_0x3acfbd){var _0x34df2d={};_0x34df2d[_0x3acfbd]={'$like':'%'+_0x53c065[_0xb08c('0x29')]['filter']+'%'};return _0x34df2d;})});}_0x2e7883=_[_0xb08c('0x37')]({},_0x2e7883,_0x53c065[_0xb08c('0x38')]);return db[_0xb08c('0x44')]['findAll'](_0x2e7883);}})[_0xb08c('0x19')](function(_0x476fc1){if(_0x476fc1){return db[_0xb08c('0x4c')][_0xb08c('0x4d')]({'where':{'id':_[_0xb08c('0x4e')](_0x476fc1,_0xb08c('0x4f')),'role':_0xb08c('0x50')},'attributes':['id',_0xb08c('0x1f'),_0xb08c('0x51'),_0xb08c('0x52'),'createdAt']});}})[_0xb08c('0x19')](function(_0xa09147){if(_0xa09147){return{'count':_0xa09147['count'],'rows':_[_0xb08c('0x4e')](_0xa09147[_0xb08c('0x2a')],function(_0x3455d3){return{'membername':_0x3455d3['name'],'UserId':_0x3455d3['id'],'queue_name':_0x316c82['name'],'OpenchannelQueueId':_0x316c82['id'],'interface':util['format'](_0xb08c('0x53'),'SIP',_0x3455d3['name']),'penalty':0x0,'paused':_0x3455d3[_0xb08c('0x51')],'createdAt':_0x3455d3[_0xb08c('0x54')],'updatedAt':_0x3455d3[_0xb08c('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb08c('0x19')](respondWithFilteredResult(_0x4fbe2d,_0x2e7883))[_0xb08c('0x2b')](handleError(_0x4fbe2d,null));};exports['getTeams']=function(_0x380708,_0x2c6435){var _0x371f12={};var _0x12a167={};var _0x49482c;var _0x530091;return db[_0xb08c('0x22')][_0xb08c('0x55')]({'where':{'id':_0x380708['params']['id']}})[_0xb08c('0x19')](handleEntityNotFound(_0x2c6435,null))[_0xb08c('0x19')](function(_0x114a2d){if(_0x114a2d){_0x49482c=_0x114a2d;_0x12a167['model']=_[_0xb08c('0x2f')](db[_0xb08c('0x56')]['rawAttributes']);_0x12a167[_0xb08c('0x29')]=_[_0xb08c('0x2f')](_0x380708[_0xb08c('0x29')]);_0x12a167['filters']=_[_0xb08c('0x31')](_0x12a167[_0xb08c('0x2e')],_0x12a167[_0xb08c('0x29')]);_0x371f12['attributes']=_['intersection'](_0x12a167['model'],qs[_0xb08c('0x33')](_0x380708['query'][_0xb08c('0x33')]));_0x371f12['attributes']=_0x371f12[_0xb08c('0x32')][_0xb08c('0x34')]?_0x371f12[_0xb08c('0x32')]:_0x12a167[_0xb08c('0x2e')];_0x371f12[_0xb08c('0x47')]=qs['sort'](_0x380708[_0xb08c('0x29')][_0xb08c('0x48')]);_0x371f12[_0xb08c('0x28')]=qs[_0xb08c('0x30')](_[_0xb08c('0x49')](_0x380708[_0xb08c('0x29')],_0x12a167['filters']));if(_0x380708['query'][_0xb08c('0x4b')]){_0x371f12[_0xb08c('0x28')]=_[_0xb08c('0x37')](_0x371f12[_0xb08c('0x28')],{'$or':_[_0xb08c('0x4e')](_0x371f12['attributes'],function(_0x56dd4c){var _0xeb9725={};_0xeb9725[_0x56dd4c]={'$like':'%'+_0x380708[_0xb08c('0x29')]['filter']+'%'};return _0xeb9725;})});}_0x371f12=_[_0xb08c('0x37')]({},_0x371f12,_0x380708[_0xb08c('0x38')]);return _0x49482c[_0xb08c('0x57')](_0x371f12);}})['then'](function(_0x198337){if(_0x198337){_0x530091=_0x198337[_0xb08c('0x34')];if(!_0x380708[_0xb08c('0x29')][_0xb08c('0x45')](_0xb08c('0x46'))){_0x371f12[_0xb08c('0x14')]=qs[_0xb08c('0x14')](_0x380708[_0xb08c('0x29')][_0xb08c('0x14')]);_0x371f12[_0xb08c('0x13')]=qs[_0xb08c('0x13')](_0x380708[_0xb08c('0x29')][_0xb08c('0x13')]);}return _0x49482c[_0xb08c('0x57')](_0x371f12);}})['then'](function(_0x5af1c7){if(_0x5af1c7){return _0x5af1c7?{'count':_0x530091,'rows':_0x5af1c7}:null;}})['then'](respondWithResult(_0x2c6435,null))['catch'](handleError(_0x2c6435,null));};exports['addTeams']=function(_0x511968,_0x2060b7){var _0x235e6b=_0x511968[_0xb08c('0x3b')][_0xb08c('0x58')];return db[_0xb08c('0x56')]['findAll']({'where':{'id':_0x235e6b},'attributes':['id'],'include':[{'model':db[_0xb08c('0x4c')],'as':'Agents','attributes':['id',_0xb08c('0x1f'),_0xb08c('0x59'),_0xb08c('0x5a'),_0xb08c('0x5b')],'raw':!![]}]})[_0xb08c('0x19')](function(_0x4b9a7c){if(_0x4b9a7c){var _0x2a608e=_['flatMap'](_0x4b9a7c,function(_0x2b7f6d){var _0x499bd1=_0x2b7f6d[_0xb08c('0x1a')]({'plain':!![]});return _0x499bd1[_0xb08c('0x5c')];});return db[_0xb08c('0x22')][_0xb08c('0x39')]({'where':{'id':_0x511968['params']['id']}})[_0xb08c('0x19')](function(_0x4f6671){return db[_0xb08c('0x5d')]['transaction'](function(_0x3fe8a1){return _0x4f6671[_0xb08c('0x5e')](_0x235e6b,{'transaction':_0x3fe8a1})[_0xb08c('0x19')](function(){return BPromise['each'](_0x2a608e,function(_0x2a332e){return db[_0xb08c('0x44')][_0xb08c('0x5f')]({'where':{'UserId':_0x2a332e['id'],'OpenchannelQueueId':_0x511968[_0xb08c('0x2d')]['id']},'transaction':_0x3fe8a1});});})[_0xb08c('0x19')](function(){_0x2a608e[_0xb08c('0x60')](function(_0x558d9d){socket[_0xb08c('0x61')](_0xb08c('0x62'),{'UserId':_0x558d9d['id'],'OpenchannelQueueId':_0x4f6671['id']});});});});});}})[_0xb08c('0x19')](respondWithStatusCode(_0x2060b7,null))[_0xb08c('0x2b')](handleError(_0x2060b7,null));};exports[_0xb08c('0x63')]=function(_0x14fb9e,_0xc09715){return db[_0xb08c('0x56')][_0xb08c('0x64')]({'where':{'id':_0x14fb9e['query'][_0xb08c('0x58')]},'attributes':['id'],'include':[{'model':db[_0xb08c('0x4c')],'as':_0xb08c('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xb08c('0x19')](handleEntityNotFound(_0xc09715,null))[_0xb08c('0x19')](function(_0x1ea0de){var _0x143b5a=_[_0xb08c('0x4e')](_0x1ea0de,'id');var _0x2d27ed=[];var _0xedc512=[];var _0x1d0b41=squel[_0xb08c('0x65')]();_0x1d0b41['field']('tq.TeamId')[_0xb08c('0x66')](_0xb08c('0x67'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb08c('0x28')](_0xb08c('0x68'),_0x14fb9e[_0xb08c('0x2d')]['id']);for(var _0x4e260b=0x0;_0x4e260b<_0x1ea0de[_0xb08c('0x34')];_0x4e260b+=0x1){let _0x5a69a2=_0x1ea0de[_0x4e260b];for(var _0x3956ca=0x0;_0x3956ca<_0x5a69a2[_0xb08c('0x5c')]['length'];_0x3956ca+=0x1){let _0xc2ac65=_0x5a69a2['Agents'][_0x3956ca];var _0x20cc6b=_0x1d0b41[_0xb08c('0x69')]();_0x20cc6b[_0xb08c('0x28')](_0xb08c('0x6a'),_0xc2ac65['id']);_0xedc512[_0xb08c('0x6b')](db[_0xb08c('0x5d')]['query'](_0x20cc6b[_0xb08c('0x6c')](),{'type':db[_0xb08c('0x5d')][_0xb08c('0x6d')][_0xb08c('0x6e')]})[_0xb08c('0x19')](function(_0x576e8e){if(_0x576e8e['length']===0x1){return _0xc2ac65['id'];}else{var _0xa3b78b=_[_0xb08c('0x6f')](_[_0xb08c('0x4e')](_0x576e8e,_0xb08c('0x70')),function(_0x5ab8b9){return _[_0xb08c('0x71')](_0x143b5a,_0x5ab8b9);});if(_0xa3b78b){return _0xc2ac65['id'];}}}));}}return BPromise[_0xb08c('0x72')](_0xedc512)[_0xb08c('0x19')](function(_0x3cd965){_0x2d27ed=_(_0x2d27ed)[_0xb08c('0x73')](_0x3cd965)['compact']()['value']();return db[_0xb08c('0x22')][_0xb08c('0x39')]({'where':{'id':_0x14fb9e[_0xb08c('0x2d')]['id']}})[_0xb08c('0x19')](function(_0x3df374){return db['sequelize']['transaction'](function(_0x49cc59){return _0x3df374['removeTeams'](_0x14fb9e[_0xb08c('0x29')][_0xb08c('0x58')],{'transaction':_0x49cc59})[_0xb08c('0x19')](function(){if(!_[_0xb08c('0x74')](_0x2d27ed)){return _0x3df374[_0xb08c('0x75')](_0x2d27ed,{'transaction':_0x49cc59});}})[_0xb08c('0x19')](function(){_0x2d27ed[_0xb08c('0x60')](function(_0xa33f50){socket[_0xb08c('0x61')](_0xb08c('0x76'),{'UserId':_0xa33f50,'OpenchannelQueueId':_0x3df374['id']});});});});});});})[_0xb08c('0x19')](respondWithStatusCode(_0xc09715,null))[_0xb08c('0x2b')](handleError(_0xc09715,null));};exports[_0xb08c('0x77')]=function(_0x1868fa,_0x153c85){return db[_0xb08c('0x22')]['find']({'where':{'id':_0x1868fa[_0xb08c('0x2d')]['id']}})[_0xb08c('0x19')](handleEntityNotFound(_0x153c85,null))[_0xb08c('0x19')](function(_0x4309f2){if(_0x4309f2){return _0x4309f2[_0xb08c('0x77')](_0x1868fa['body'][_0xb08c('0x58')],_[_0xb08c('0x78')](_0x1868fa[_0xb08c('0x3b')],['ids','id'])||{})[_0xb08c('0x79')](function(_0x1318e1){for(var _0x2dbe68=0x0;_0x2dbe68<_0x1868fa[_0xb08c('0x3b')]['ids'][_0xb08c('0x34')];_0x2dbe68+=0x1){socket['emit'](_0xb08c('0x62'),{'UserId':Number(_0x1868fa[_0xb08c('0x3b')][_0xb08c('0x58')][_0x2dbe68]),'OpenchannelQueueId':Number(_0x1868fa[_0xb08c('0x2d')]['id'])});}return _0x1318e1;});}})[_0xb08c('0x19')](respondWithResult(_0x153c85,null))[_0xb08c('0x2b')](handleError(_0x153c85,null));};exports[_0xb08c('0x75')]=function(_0x2661ef,_0x50b3b7){return db['OpenchannelQueue']['find']({'where':{'id':_0x2661ef['params']['id']}})[_0xb08c('0x19')](handleEntityNotFound(_0x50b3b7,null))[_0xb08c('0x19')](function(_0x3b8425){if(_0x3b8425){return _0x3b8425[_0xb08c('0x75')](_0x2661ef['query'][_0xb08c('0x58')])[_0xb08c('0x19')](function(){if(_[_0xb08c('0x7a')](_0x2661ef[_0xb08c('0x29')]['ids'])){for(var _0x44156b=0x0;_0x44156b<_0x2661ef[_0xb08c('0x29')][_0xb08c('0x58')][_0xb08c('0x34')];_0x44156b+=0x1){socket[_0xb08c('0x61')](_0xb08c('0x76'),{'UserId':Number(_0x2661ef[_0xb08c('0x29')][_0xb08c('0x58')][_0x44156b]),'OpenchannelQueueId':Number(_0x2661ef[_0xb08c('0x2d')]['id'])});}}else{socket[_0xb08c('0x61')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2661ef[_0xb08c('0x29')][_0xb08c('0x58')]),'OpenchannelQueueId':Number(_0x2661ef['params']['id'])});}});}})[_0xb08c('0x19')](respondWithStatusCode(_0x50b3b7,null))[_0xb08c('0x2b')](handleError(_0x50b3b7,null));};exports['getAgents']=function(_0x921707,_0xd65b40){var _0x27149c={};var _0x16205d={};var _0x4ab374;var _0x434e69;return db['OpenchannelQueue'][_0xb08c('0x55')]({'where':{'id':_0x921707[_0xb08c('0x2d')]['id']}})[_0xb08c('0x19')](handleEntityNotFound(_0xd65b40,null))[_0xb08c('0x19')](function(_0x1f1c38){if(_0x1f1c38){_0x4ab374=_0x1f1c38;_0x16205d[_0xb08c('0x2e')]=_[_0xb08c('0x2f')](db['User'][_0xb08c('0x23')]);_0x16205d[_0xb08c('0x29')]=_[_0xb08c('0x2f')](_0x921707['query']);_0x16205d[_0xb08c('0x30')]=_['intersection'](_0x16205d[_0xb08c('0x2e')],_0x16205d['query']);_0x27149c['attributes']=_[_0xb08c('0x31')](_0x16205d[_0xb08c('0x2e')],qs[_0xb08c('0x33')](_0x921707['query'][_0xb08c('0x33')]));_0x27149c[_0xb08c('0x32')]=_0x27149c[_0xb08c('0x32')]['length']?_0x27149c[_0xb08c('0x32')]:_0x16205d['model'];_0x27149c[_0xb08c('0x47')]=qs[_0xb08c('0x48')](_0x921707['query']['sort']);_0x27149c[_0xb08c('0x28')]=qs['filters'](_[_0xb08c('0x49')](_0x921707[_0xb08c('0x29')],_0x16205d[_0xb08c('0x30')]));if(_0x921707[_0xb08c('0x29')]['filter']){_0x27149c[_0xb08c('0x28')]=_[_0xb08c('0x37')](_0x27149c[_0xb08c('0x28')],{'$or':_[_0xb08c('0x4e')](_0x27149c[_0xb08c('0x32')],function(_0x281959){var _0xb5f700={};_0xb5f700[_0x281959]={'$like':'%'+_0x921707[_0xb08c('0x29')][_0xb08c('0x4b')]+'%'};return _0xb5f700;})});}_0x27149c=_['merge']({},_0x27149c,_0x921707[_0xb08c('0x38')]);return _0x4ab374['getAgents'](_0x27149c);}})[_0xb08c('0x19')](function(_0x29270e){if(_0x29270e){_0x434e69=_0x29270e[_0xb08c('0x34')];if(!_0x921707[_0xb08c('0x29')]['hasOwnProperty']('nolimit')){_0x27149c[_0xb08c('0x14')]=qs[_0xb08c('0x14')](_0x921707[_0xb08c('0x29')][_0xb08c('0x14')]);_0x27149c[_0xb08c('0x13')]=qs[_0xb08c('0x13')](_0x921707[_0xb08c('0x29')][_0xb08c('0x13')]);}return _0x4ab374['getAgents'](_0x27149c);}})[_0xb08c('0x19')](function(_0x76f68e){if(_0x76f68e){return _0x76f68e?{'count':_0x434e69,'rows':_0x76f68e}:null;}})[_0xb08c('0x19')](respondWithResult(_0xd65b40,null))[_0xb08c('0x2b')](handleError(_0xd65b40,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 9d2ca35..e373ce0 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 _0x4b8b=['events','save','update','remove','emit'];(function(_0xc67084,_0x3e2efc){var _0x4d06c6=function(_0x2eb951){while(--_0x2eb951){_0xc67084['push'](_0xc67084['shift']());}};_0x4d06c6(++_0x3e2efc);}(_0x4b8b,0x14a));var _0xb4b8=function(_0x28cda9,_0x52e9d1){_0x28cda9=_0x28cda9-0x0;var _0x5019fb=_0x4b8b[_0x28cda9];return _0x5019fb;};'use strict';var EventEmitter=require(_0xb4b8('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb4b8('0x1'),'afterUpdate':_0xb4b8('0x2'),'afterDestroy':_0xb4b8('0x3')};function emitEvent(_0x5a90bb){return function(_0x4bf320,_0x592cf8,_0x1bc335){OpenchannelQueueEvents[_0xb4b8('0x4')](_0x5a90bb+':'+_0x4bf320['id'],_0x4bf320);OpenchannelQueueEvents['emit'](_0x5a90bb,_0x4bf320);_0x1bc335(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x9a0e=['update','remove','emit','hook','events','../../mysqldb','OpenchannelQueue','save'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x9a0e,0x15c));var _0xe9a0=function(_0x577f12,_0x4449b0){_0x577f12=_0x577f12-0x0;var _0x370083=_0x9a0e[_0x577f12];return _0x370083;};'use strict';var EventEmitter=require(_0xe9a0('0x0'));var OpenchannelQueue=require(_0xe9a0('0x1'))['db'][_0xe9a0('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe9a0('0x3'),'afterUpdate':_0xe9a0('0x4'),'afterDestroy':_0xe9a0('0x5')};function emitEvent(_0x3c47ca){return function(_0x41af93,_0x36b977,_0x41c5c3){OpenchannelQueueEvents['emit'](_0x3c47ca+':'+_0x41af93['id'],_0x41af93);OpenchannelQueueEvents[_0xe9a0('0x6')](_0x3c47ca,_0x41af93);_0x41c5c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xe9a0('0x7')](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 cafe3a5..f9b555a 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 _0x54d8=['openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue'];(function(_0x5c468f,_0x2e5c25){var _0x2136b0=function(_0x56b8a4){while(--_0x56b8a4){_0x5c468f['push'](_0x5c468f['shift']());}};_0x2136b0(++_0x2e5c25);}(_0x54d8,0xd2));var _0x854d=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x54d8[_0x17406a];return _0x1501ff;};'use strict';var _=require('lodash');var util=require(_0x854d('0x0'));var logger=require(_0x854d('0x1'))(_0x854d('0x2'));var moment=require(_0x854d('0x3'));var BPromise=require(_0x854d('0x4'));var rp=require(_0x854d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x854d('0x6'));var attributes=require(_0x854d('0x7'));module[_0x854d('0x8')]=function(_0x3eb13d,_0x305fc4){return _0x3eb13d['define'](_0x854d('0x9'),attributes,{'tableName':_0x854d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f0f=['rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','api','moment','bluebird'];(function(_0x11a89e,_0x166edb){var _0x56b94b=function(_0x49946d){while(--_0x49946d){_0x11a89e['push'](_0x11a89e['shift']());}};_0x56b94b(++_0x166edb);}(_0x7f0f,0x1e6));var _0xf7f0=function(_0x8d5838,_0x3261c4){_0x8d5838=_0x8d5838-0x0;var _0x5c036a=_0x7f0f[_0x8d5838];return _0x5c036a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf7f0('0x0'))(_0xf7f0('0x1'));var moment=require(_0xf7f0('0x2'));var BPromise=require(_0xf7f0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf7f0('0x4'));var config=require('../../config/environment');var attributes=require(_0xf7f0('0x5'));module[_0xf7f0('0x6')]=function(_0x14aa6c,_0x1907a3){return _0x14aa6c[_0xf7f0('0x7')](_0xf7f0('0x8'),attributes,{'tableName':_0xf7f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 8446e49..2614424 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 _0x6ab7=['defaults','localhost','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x6ab7,0x95));var _0x76ab=function(_0x579953,_0x524d25){_0x579953=_0x579953-0x0;var _0xe81976=_0x6ab7[_0x579953];return _0xe81976;};'use strict';var _=require(_0x76ab('0x0'));var util=require('util');var moment=require(_0x76ab('0x1'));var BPromise=require(_0x76ab('0x2'));var rs=require(_0x76ab('0x3'));var fs=require('fs');var Redis=require(_0x76ab('0x4'));var db=require(_0x76ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x76ab('0x6'))(_0x76ab('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76ab('0x8')][_0x76ab('0x9')]({'port':0x232a});config[_0x76ab('0xa')]=_[_0x76ab('0xb')](config[_0x76ab('0xa')],{'host':_0x76ab('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76ab('0xa')]));require(_0x76ab('0xd'))[_0x76ab('0xe')](socket);function respondWithRpcPromise(_0x5b63e9,_0x4134c9,_0x15a245){return new BPromise(function(_0x288162,_0x31e4b0){return client[_0x76ab('0xf')](_0x5b63e9,_0x15a245)['then'](function(_0x3fc108){logger['info'](_0x76ab('0x10'),_0x4134c9,'request\x20sent');logger[_0x76ab('0x11')](_0x76ab('0x12'),_0x4134c9,_0x76ab('0x13'),JSON[_0x76ab('0x14')](_0x3fc108));if(_0x3fc108[_0x76ab('0x15')]){if(_0x3fc108['error']['code']===0x1f4){logger[_0x76ab('0x15')](_0x76ab('0x10'),_0x4134c9,_0x3fc108[_0x76ab('0x15')][_0x76ab('0x16')]);return _0x31e4b0(_0x3fc108['error'][_0x76ab('0x16')]);}logger['error'](_0x76ab('0x10'),_0x4134c9,_0x3fc108[_0x76ab('0x15')][_0x76ab('0x16')]);return _0x288162(_0x3fc108[_0x76ab('0x15')]['message']);}else{logger[_0x76ab('0x17')](_0x76ab('0x10'),_0x4134c9,_0x76ab('0x13'));_0x288162(_0x3fc108[_0x76ab('0x18')]['message']);}})['catch'](function(_0x358de9){logger[_0x76ab('0x15')](_0x76ab('0x10'),_0x4134c9,_0x358de9);_0x31e4b0(_0x358de9);});});}exports[_0x76ab('0x19')]=function(_0x3c1e7c){var _0x422783=this;return new Promise(function(_0x52e799,_0x550cbd){return db[_0x76ab('0x1a')][_0x76ab('0x1b')]({'raw':_0x3c1e7c[_0x76ab('0x1c')]?_0x3c1e7c[_0x76ab('0x1c')][_0x76ab('0x1d')]===undefined?!![]:![]:!![],'where':_0x3c1e7c[_0x76ab('0x1c')]?_0x3c1e7c[_0x76ab('0x1c')][_0x76ab('0x1e')]||null:null,'attributes':_0x3c1e7c[_0x76ab('0x1c')]?_0x3c1e7c[_0x76ab('0x1c')][_0x76ab('0x1f')]||null:null,'limit':_0x3c1e7c[_0x76ab('0x1c')]?_0x3c1e7c[_0x76ab('0x1c')][_0x76ab('0x20')]||null:null,'include':_0x3c1e7c[_0x76ab('0x1c')]?_0x3c1e7c[_0x76ab('0x1c')][_0x76ab('0x21')]?_[_0x76ab('0x22')](_0x3c1e7c[_0x76ab('0x1c')][_0x76ab('0x21')],function(_0x107afc){return{'model':db[_0x107afc[_0x76ab('0x23')]],'as':_0x107afc['as'],'attributes':_0x107afc[_0x76ab('0x1f')],'include':_0x107afc['include']?_[_0x76ab('0x22')](_0x107afc[_0x76ab('0x21')],function(_0x12643e){return{'model':db[_0x12643e[_0x76ab('0x23')]],'as':_0x12643e['as'],'attributes':_0x12643e[_0x76ab('0x1f')],'include':_0x12643e['include']?_[_0x76ab('0x22')](_0x12643e[_0x76ab('0x21')],function(_0x255dc5){return{'model':db[_0x255dc5['model']],'as':_0x255dc5['as'],'attributes':_0x255dc5['attributes']};}):[]};}):[]};}):[]:[]})[_0x76ab('0x24')](function(_0x2cfebe){logger[_0x76ab('0x17')](_0x76ab('0x19'),_0x3c1e7c);logger[_0x76ab('0x11')](_0x76ab('0x19'),_0x3c1e7c,JSON[_0x76ab('0x14')](_0x2cfebe));_0x52e799(_0x2cfebe);})[_0x76ab('0x25')](function(_0x2d31e1){logger['error'](_0x76ab('0x19'),_0x2d31e1['message'],_0x3c1e7c);_0x550cbd(_0x422783[_0x76ab('0x15')](0x1f4,_0x2d31e1['message']));});});};exports[_0x76ab('0x26')]=function(_0x253b34){var _0x139963=this;return new Promise(function(_0x371ef0,_0x1035e9){return db['OpenchannelQueue'][_0x76ab('0x27')]({'raw':_0x253b34[_0x76ab('0x1c')]?_0x253b34[_0x76ab('0x1c')][_0x76ab('0x1d')]===undefined?!![]:![]:!![],'where':_0x253b34[_0x76ab('0x1c')]?_0x253b34['options'][_0x76ab('0x1e')]||null:null,'attributes':_0x253b34['options']?_0x253b34['options'][_0x76ab('0x1f')]||null:null,'include':_0x253b34[_0x76ab('0x1c')]?_0x253b34[_0x76ab('0x1c')]['include']?_[_0x76ab('0x22')](_0x253b34['options'][_0x76ab('0x21')],function(_0x967f27){return{'model':db[_0x967f27['model']],'as':_0x967f27['as'],'attributes':_0x967f27[_0x76ab('0x1f')],'include':_0x967f27[_0x76ab('0x21')]?_['map'](_0x967f27[_0x76ab('0x21')],function(_0x5cc148){return{'model':db[_0x5cc148['model']],'as':_0x5cc148['as'],'attributes':_0x5cc148[_0x76ab('0x1f')],'include':_0x5cc148[_0x76ab('0x21')]?_[_0x76ab('0x22')](_0x5cc148[_0x76ab('0x21')],function(_0x26f873){return{'model':db[_0x26f873[_0x76ab('0x23')]],'as':_0x26f873['as'],'attributes':_0x26f873[_0x76ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x370261){logger['info'](_0x76ab('0x26'),_0x253b34);logger[_0x76ab('0x11')](_0x76ab('0x26'),_0x253b34,JSON['stringify'](_0x370261));_0x371ef0(_0x370261);})[_0x76ab('0x25')](function(_0xc464e1){logger[_0x76ab('0x15')](_0x76ab('0x26'),_0xc464e1[_0x76ab('0x16')],_0x253b34);_0x1035e9(_0x139963[_0x76ab('0x15')](0x1f4,_0xc464e1[_0x76ab('0x16')]));});});}; \ No newline at end of file +var _0x3cb4=['limit','include','map','model','GetOpenchannelQueue','find','raw','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','where','attributes'];(function(_0x22a16e,_0x2ca090){var _0x4acc97=function(_0x375b55){while(--_0x375b55){_0x22a16e['push'](_0x22a16e['shift']());}};_0x4acc97(++_0x2ca090);}(_0x3cb4,0x1f4));var _0x43cb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3cb4[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x43cb('0x0'));var moment=require(_0x43cb('0x1'));var BPromise=require(_0x43cb('0x2'));var rs=require(_0x43cb('0x3'));var fs=require('fs');var Redis=require(_0x43cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x43cb('0x5'))(_0x43cb('0x6'));var config=require(_0x43cb('0x7'));var jayson=require(_0x43cb('0x8'));var client=jayson[_0x43cb('0x9')][_0x43cb('0xa')]({'port':0x232a});config[_0x43cb('0xb')]=_['defaults'](config[_0x43cb('0xb')],{'host':_0x43cb('0xc'),'port':0x18eb});var socket=require(_0x43cb('0xd'))(new Redis(config['redis']));require(_0x43cb('0xe'))[_0x43cb('0xf')](socket);function respondWithRpcPromise(_0xf7841b,_0x5e34e9,_0x48ddb3){return new BPromise(function(_0x2f277e,_0x4d8625){return client[_0x43cb('0x10')](_0xf7841b,_0x48ddb3)[_0x43cb('0x11')](function(_0xaf6cac){logger[_0x43cb('0x12')](_0x43cb('0x13'),_0x5e34e9,_0x43cb('0x14'));logger[_0x43cb('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5e34e9,_0x43cb('0x14'),JSON[_0x43cb('0x16')](_0xaf6cac));if(_0xaf6cac[_0x43cb('0x17')]){if(_0xaf6cac[_0x43cb('0x17')][_0x43cb('0x18')]===0x1f4){logger[_0x43cb('0x17')](_0x43cb('0x13'),_0x5e34e9,_0xaf6cac[_0x43cb('0x17')][_0x43cb('0x19')]);return _0x4d8625(_0xaf6cac[_0x43cb('0x17')][_0x43cb('0x19')]);}logger[_0x43cb('0x17')](_0x43cb('0x13'),_0x5e34e9,_0xaf6cac['error']['message']);return _0x2f277e(_0xaf6cac[_0x43cb('0x17')][_0x43cb('0x19')]);}else{logger[_0x43cb('0x12')](_0x43cb('0x13'),_0x5e34e9,_0x43cb('0x14'));_0x2f277e(_0xaf6cac[_0x43cb('0x1a')][_0x43cb('0x19')]);}})[_0x43cb('0x1b')](function(_0x320cef){logger['error'](_0x43cb('0x13'),_0x5e34e9,_0x320cef);_0x4d8625(_0x320cef);});});}exports['GetOpenchannelQueue']=function(_0x519b6f){var _0x54545f=this;return new Promise(function(_0x2b4d3d,_0x1c956c){return db[_0x43cb('0x1c')][_0x43cb('0x1d')]({'raw':_0x519b6f[_0x43cb('0x1e')]?_0x519b6f[_0x43cb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x519b6f[_0x43cb('0x1e')]?_0x519b6f[_0x43cb('0x1e')][_0x43cb('0x1f')]||null:null,'attributes':_0x519b6f[_0x43cb('0x1e')]?_0x519b6f[_0x43cb('0x1e')][_0x43cb('0x20')]||null:null,'limit':_0x519b6f['options']?_0x519b6f['options'][_0x43cb('0x21')]||null:null,'include':_0x519b6f[_0x43cb('0x1e')]?_0x519b6f['options'][_0x43cb('0x22')]?_[_0x43cb('0x23')](_0x519b6f['options']['include'],function(_0x593688){return{'model':db[_0x593688['model']],'as':_0x593688['as'],'attributes':_0x593688[_0x43cb('0x20')],'include':_0x593688[_0x43cb('0x22')]?_[_0x43cb('0x23')](_0x593688[_0x43cb('0x22')],function(_0x145b59){return{'model':db[_0x145b59[_0x43cb('0x24')]],'as':_0x145b59['as'],'attributes':_0x145b59['attributes'],'include':_0x145b59[_0x43cb('0x22')]?_[_0x43cb('0x23')](_0x145b59['include'],function(_0x187550){return{'model':db[_0x187550['model']],'as':_0x187550['as'],'attributes':_0x187550['attributes']};}):[]};}):[]};}):[]:[]})[_0x43cb('0x11')](function(_0x2ef3e4){logger[_0x43cb('0x12')](_0x43cb('0x25'),_0x519b6f);logger[_0x43cb('0x15')]('GetOpenchannelQueue',_0x519b6f,JSON[_0x43cb('0x16')](_0x2ef3e4));_0x2b4d3d(_0x2ef3e4);})[_0x43cb('0x1b')](function(_0x5f02c8){logger[_0x43cb('0x17')]('GetOpenchannelQueue',_0x5f02c8[_0x43cb('0x19')],_0x519b6f);_0x1c956c(_0x54545f[_0x43cb('0x17')](0x1f4,_0x5f02c8[_0x43cb('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x1d0ed0){var _0x520cdf=this;return new Promise(function(_0x44529f,_0x35cd70){return db[_0x43cb('0x1c')][_0x43cb('0x26')]({'raw':_0x1d0ed0[_0x43cb('0x1e')]?_0x1d0ed0['options'][_0x43cb('0x27')]===undefined?!![]:![]:!![],'where':_0x1d0ed0['options']?_0x1d0ed0[_0x43cb('0x1e')]['where']||null:null,'attributes':_0x1d0ed0[_0x43cb('0x1e')]?_0x1d0ed0[_0x43cb('0x1e')][_0x43cb('0x20')]||null:null,'include':_0x1d0ed0[_0x43cb('0x1e')]?_0x1d0ed0[_0x43cb('0x1e')][_0x43cb('0x22')]?_[_0x43cb('0x23')](_0x1d0ed0['options'][_0x43cb('0x22')],function(_0x51695f){return{'model':db[_0x51695f[_0x43cb('0x24')]],'as':_0x51695f['as'],'attributes':_0x51695f[_0x43cb('0x20')],'include':_0x51695f[_0x43cb('0x22')]?_['map'](_0x51695f[_0x43cb('0x22')],function(_0x21ca87){return{'model':db[_0x21ca87[_0x43cb('0x24')]],'as':_0x21ca87['as'],'attributes':_0x21ca87[_0x43cb('0x20')],'include':_0x21ca87[_0x43cb('0x22')]?_[_0x43cb('0x23')](_0x21ca87['include'],function(_0x12a995){return{'model':db[_0x12a995[_0x43cb('0x24')]],'as':_0x12a995['as'],'attributes':_0x12a995[_0x43cb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x931d3b){logger[_0x43cb('0x12')](_0x43cb('0x28'),_0x1d0ed0);logger['debug'](_0x43cb('0x28'),_0x1d0ed0,JSON[_0x43cb('0x16')](_0x931d3b));_0x44529f(_0x931d3b);})[_0x43cb('0x1b')](function(_0x544692){logger[_0x43cb('0x17')](_0x43cb('0x28'),_0x544692['message'],_0x1d0ed0);_0x35cd70(_0x520cdf[_0x43cb('0x17')](0x1f4,_0x544692[_0x43cb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e572be0..bf5944a 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 _0x38fb=['update','emit','removeListener','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x38fb,0x74));var _0xb38f=function(_0x3d5db9,_0x2dbe0a){_0x3d5db9=_0x3d5db9-0x0;var _0x3c114c=_0x38fb[_0x3d5db9];return _0x3c114c;};'use strict';var OpenchannelQueueEvents=require(_0xb38f('0x0'));var events=[_0xb38f('0x1'),_0xb38f('0x2'),_0xb38f('0x3')];function createListener(_0x2ef691,_0x349c4d){return function(_0x4d5608){_0x349c4d[_0xb38f('0x4')](_0x2ef691,_0x4d5608);};}function removeListener(_0x4a40e8,_0x56c968){return function(){OpenchannelQueueEvents[_0xb38f('0x5')](_0x4a40e8,_0x56c968);};}exports['register']=function(_0xd8d792){for(var _0x387c03=0x0,_0x50ab33=events['length'];_0x387c03<_0x50ab33;_0x387c03++){var _0x4f5164=events[_0x387c03];var _0x158bad=createListener(_0xb38f('0x6')+_0x4f5164,_0xd8d792);OpenchannelQueueEvents['on'](_0x4f5164,_0x158bad);}}; \ No newline at end of file +var _0xa5a4=['update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','remove'];(function(_0x4b6ff4,_0x54815c){var _0x34321e=function(_0x579cb3){while(--_0x579cb3){_0x4b6ff4['push'](_0x4b6ff4['shift']());}};_0x34321e(++_0x54815c);}(_0xa5a4,0x14e));var _0x4a5a=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xa5a4[_0x1a89a1];return _0x3d5b46;};'use strict';var OpenchannelQueueEvents=require(_0x4a5a('0x0'));var events=['save',_0x4a5a('0x1'),_0x4a5a('0x2')];function createListener(_0x2d9ccd,_0x2fba4e){return function(_0x718ab){_0x2fba4e[_0x4a5a('0x3')](_0x2d9ccd,_0x718ab);};}function removeListener(_0x102a7a,_0x4a3124){return function(){OpenchannelQueueEvents[_0x4a5a('0x4')](_0x102a7a,_0x4a3124);};}exports[_0x4a5a('0x5')]=function(_0x3b9961){for(var _0x52f505=0x0,_0x3cb869=events['length'];_0x52f505<_0x3cb869;_0x52f505++){var _0x1f20d0=events[_0x52f505];var _0x44914b=createListener(_0x4a5a('0x6')+_0x1f20d0,_0x3b9961);OpenchannelQueueEvents['on'](_0x1f20d0,_0x44914b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 68e2c86..edc9285 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 _0x6f02=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x29a377,_0x811d72){var _0x65568d=function(_0x525823){while(--_0x525823){_0x29a377['push'](_0x29a377['shift']());}};_0x65568d(++_0x811d72);}(_0x6f02,0x1f3));var _0x26f0=function(_0x1987f8,_0x5adaac){_0x1987f8=_0x1987f8-0x0;var _0x5545b1=_0x6f02[_0x1987f8];return _0x5545b1;};'use strict';var multer=require(_0x26f0('0x0'));var util=require(_0x26f0('0x1'));var path=require(_0x26f0('0x2'));var timeout=require('connect-timeout');var express=require(_0x26f0('0x3'));var router=express[_0x26f0('0x4')]();var fs_extra=require(_0x26f0('0x5'));var auth=require(_0x26f0('0x6'));var interaction=require(_0x26f0('0x7'));var config=require(_0x26f0('0x8'));var controller=require(_0x26f0('0x9'));router['get']('/',auth[_0x26f0('0xa')](),controller[_0x26f0('0xb')]);router[_0x26f0('0xc')]('/describe',auth[_0x26f0('0xa')](),controller[_0x26f0('0xd')]);router['get'](_0x26f0('0xe'),auth['isAuthenticated'](),controller[_0x26f0('0xf')]);router[_0x26f0('0x10')]('/',auth[_0x26f0('0xa')](),controller[_0x26f0('0x11')]);router[_0x26f0('0x12')]('/:id',auth[_0x26f0('0xa')](),controller[_0x26f0('0x13')]);router['delete'](_0x26f0('0xe'),auth[_0x26f0('0xa')](),controller[_0x26f0('0x14')]);module[_0x26f0('0x15')]=router; \ No newline at end of file +var _0x76a8=['update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x76a8,0x1e7));var _0x876a=function(_0x2071bf,_0x4f6ef8){_0x2071bf=_0x2071bf-0x0;var _0x1f416d=_0x76a8[_0x2071bf];return _0x1f416d;};'use strict';var multer=require(_0x876a('0x0'));var util=require(_0x876a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x876a('0x2'));var router=express[_0x876a('0x3')]();var fs_extra=require(_0x876a('0x4'));var auth=require(_0x876a('0x5'));var interaction=require(_0x876a('0x6'));var config=require(_0x876a('0x7'));var controller=require(_0x876a('0x8'));router[_0x876a('0x9')]('/',auth['isAuthenticated'](),controller[_0x876a('0xa')]);router[_0x876a('0x9')](_0x876a('0xb'),auth['isAuthenticated'](),controller[_0x876a('0xc')]);router[_0x876a('0x9')](_0x876a('0xd'),auth[_0x876a('0xe')](),controller[_0x876a('0xf')]);router[_0x876a('0x10')]('/',auth[_0x876a('0xe')](),controller[_0x876a('0x11')]);router[_0x876a('0x12')]('/:id',auth[_0x876a('0xe')](),controller[_0x876a('0x13')]);router[_0x876a('0x14')](_0x876a('0xd'),auth[_0x876a('0xe')](),controller[_0x876a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index f9cdd7e..c6dcde4 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 _0xbdb1=['exports','STRING','DATE','moment','sequelize'];(function(_0x2b0245,_0x9270b1){var _0x50c5e8=function(_0x62bca){while(--_0x62bca){_0x2b0245['push'](_0x2b0245['shift']());}};_0x50c5e8(++_0x9270b1);}(_0xbdb1,0x12a));var _0x1bdb=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0xbdb1[_0x379799];return _0x46e431;};'use strict';var moment=require(_0x1bdb('0x0'));var Sequelize=require(_0x1bdb('0x1'));module[_0x1bdb('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1bdb('0x3')]},'joinAt':{'type':Sequelize[_0x1bdb('0x4')]},'leaveAt':{'type':Sequelize[_0x1bdb('0x4')]},'acceptAt':{'type':Sequelize[_0x1bdb('0x4')]},'exitAt':{'type':Sequelize[_0x1bdb('0x4')]},'reason':{'type':Sequelize[_0x1bdb('0x3')]}}; \ No newline at end of file +var _0x2c2b=['DATE','moment','STRING'];(function(_0x2bc4a6,_0x5550e7){var _0x4e3019=function(_0x533aab){while(--_0x533aab){_0x2bc4a6['push'](_0x2bc4a6['shift']());}};_0x4e3019(++_0x5550e7);}(_0x2c2b,0x11b));var _0xb2c2=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x2c2b[_0x122096];return _0x3d1966;};'use strict';var moment=require(_0xb2c2('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb2c2('0x1')]},'joinAt':{'type':Sequelize[_0xb2c2('0x2')]},'leaveAt':{'type':Sequelize[_0xb2c2('0x2')]},'acceptAt':{'type':Sequelize[_0xb2c2('0x2')]},'exitAt':{'type':Sequelize[_0xb2c2('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 76ec403..5ee115b 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 _0x321c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3e84d8,_0x4049ec){var _0xd0cab3=function(_0x76b341){while(--_0x76b341){_0x3e84d8['push'](_0x3e84d8['shift']());}};_0xd0cab3(++_0x4049ec);}(_0x321c,0x1a5));var _0xc321=function(_0x2b39e4,_0x104d9b){_0x2b39e4=_0x2b39e4-0x0;var _0x28bf8c=_0x321c[_0x2b39e4];return _0x28bf8c;};'use strict';var emlformat=require(_0xc321('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc321('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc321('0x2'));var moment=require(_0xc321('0x3'));var BPromise=require(_0xc321('0x4'));var Mustache=require('mustache');var util=require(_0xc321('0x5'));var path=require(_0xc321('0x6'));var sox=require(_0xc321('0x7'));var csv=require('to-csv');var ejs=require(_0xc321('0x8'));var fs=require('fs');var fs_extra=require(_0xc321('0x9'));var _=require('lodash');var squel=require(_0xc321('0xa'));var crypto=require(_0xc321('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc321('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc321('0xd'));var Papa=require(_0xc321('0xe'));var Redis=require(_0xc321('0xf'));var authService=require(_0xc321('0x10'));var qs=require(_0xc321('0x11'));var as=require(_0xc321('0x12'));var hardwareService=require(_0xc321('0x13'));var logger=require(_0xc321('0x14'))('api');var utils=require(_0xc321('0x15'));var config=require(_0xc321('0x16'));var licenseUtil=require(_0xc321('0x17'));var db=require(_0xc321('0x18'))['db'];function respondWithStatusCode(_0x39a30d,_0x1a9f96){_0x1a9f96=_0x1a9f96||0xcc;return function(_0x3a3b96){if(_0x3a3b96){return _0x39a30d[_0xc321('0x19')](_0x1a9f96);}return _0x39a30d[_0xc321('0x1a')](_0x1a9f96)[_0xc321('0x1b')]();};}function respondWithResult(_0x34f979,_0x1056e4){_0x1056e4=_0x1056e4||0xc8;return function(_0x1c98d1){if(_0x1c98d1){return _0x34f979[_0xc321('0x1a')](_0x1056e4)[_0xc321('0x1c')](_0x1c98d1);}};}function respondWithFilteredResult(_0x52b6f0,_0x2b9b94){return function(_0x32c2fd){if(_0x32c2fd){var _0x4a6b9c=typeof _0x2b9b94['offset']===_0xc321('0x1d')&&typeof _0x2b9b94['limit']===_0xc321('0x1d');var _0x4e7be6=_0x32c2fd[_0xc321('0x1e')];var _0x31739a=_0x4a6b9c?0x0:_0x2b9b94[_0xc321('0x1f')];var _0x385c37=_0x4a6b9c?_0x32c2fd[_0xc321('0x1e')]:_0x2b9b94[_0xc321('0x1f')]+_0x2b9b94[_0xc321('0x20')];var _0x176715;if(_0x385c37>=_0x4e7be6){_0x385c37=_0x4e7be6;_0x176715=0xc8;}else{_0x176715=0xce;}_0x52b6f0['status'](_0x176715);return _0x52b6f0[_0xc321('0x21')](_0xc321('0x22'),_0x31739a+'-'+_0x385c37+'/'+_0x4e7be6)[_0xc321('0x1c')](_0x32c2fd);}return null;};}function patchUpdates(_0x5611c7){return function(_0x1600ca){try{jsonpatch['apply'](_0x1600ca,_0x5611c7,!![]);}catch(_0x40b5a7){return BPromise[_0xc321('0x23')](_0x40b5a7);}return _0x1600ca[_0xc321('0x24')]();};}function saveUpdates(_0x360eab,_0x52df88){return function(_0x2426c3){if(_0x2426c3){return _0x2426c3[_0xc321('0x25')](_0x360eab)[_0xc321('0x26')](function(_0x3af2a4){return _0x3af2a4;});}return null;};}function removeEntity(_0xa7d6fc,_0x5a7e0f){return function(_0x1b5125){if(_0x1b5125){return _0x1b5125[_0xc321('0x27')]()[_0xc321('0x26')](function(){_0xa7d6fc[_0xc321('0x1a')](0xcc)[_0xc321('0x1b')]();});}};}function handleEntityNotFound(_0x5ddec6,_0x2f89db){return function(_0x3f98c8){if(!_0x3f98c8){_0x5ddec6['sendStatus'](0x194);}return _0x3f98c8;};}function handleError(_0x3beb40,_0x3a3291){_0x3a3291=_0x3a3291||0x1f4;return function(_0x1f01d3){logger['error'](_0x1f01d3[_0xc321('0x28')]);if(_0x1f01d3[_0xc321('0x29')]){delete _0x1f01d3[_0xc321('0x29')];}_0x3beb40['status'](_0x3a3291)['send'](_0x1f01d3);};}exports['index']=function(_0xdc8444,_0x3e8771){var _0x380982={},_0x1d744e={},_0x2314b4={'count':0x0,'rows':[]};var _0xefde12=_[_0xc321('0x2a')](db[_0xc321('0x2b')][_0xc321('0x2c')],function(_0x2eb97f){return{'name':_0x2eb97f[_0xc321('0x2d')],'type':_0x2eb97f[_0xc321('0x2e')][_0xc321('0x2f')]};});_0x1d744e['model']=_[_0xc321('0x2a')](_0xefde12,'name');_0x1d744e[_0xc321('0x30')]=_[_0xc321('0x31')](_0xdc8444[_0xc321('0x30')]);_0x1d744e[_0xc321('0x32')]=_['intersection'](_0x1d744e[_0xc321('0x33')],_0x1d744e[_0xc321('0x30')]);_0x380982[_0xc321('0x34')]=_[_0xc321('0x35')](_0x1d744e['model'],qs[_0xc321('0x36')](_0xdc8444[_0xc321('0x30')][_0xc321('0x36')]));_0x380982[_0xc321('0x34')]=_0x380982[_0xc321('0x34')][_0xc321('0x37')]?_0x380982['attributes']:_0x1d744e[_0xc321('0x33')];if(!_0xdc8444[_0xc321('0x30')]['hasOwnProperty'](_0xc321('0x38'))){_0x380982['limit']=qs['limit'](_0xdc8444[_0xc321('0x30')][_0xc321('0x20')]);_0x380982['offset']=qs[_0xc321('0x1f')](_0xdc8444[_0xc321('0x30')][_0xc321('0x1f')]);}_0x380982[_0xc321('0x39')]=qs[_0xc321('0x3a')](_0xdc8444['query'][_0xc321('0x3a')]);_0x380982[_0xc321('0x3b')]=qs[_0xc321('0x32')](_['pick'](_0xdc8444['query'],_0x1d744e[_0xc321('0x32')]),_0xefde12);if(_0xdc8444['query'][_0xc321('0x3c')]){_0x380982[_0xc321('0x3b')]=_['merge'](_0x380982[_0xc321('0x3b')],{'$or':_[_0xc321('0x2a')](_0xefde12,function(_0x5d04c3){if(_0x5d04c3[_0xc321('0x2e')]!==_0xc321('0x3d')){var _0x9b3c9={};_0x9b3c9[_0x5d04c3['name']]={'$like':'%'+_0xdc8444[_0xc321('0x30')]['filter']+'%'};return _0x9b3c9;}})});}_0x380982=_[_0xc321('0x3e')]({},_0x380982,_0xdc8444[_0xc321('0x3f')]);var _0x886d7b={'where':_0x380982['where']};return db[_0xc321('0x2b')][_0xc321('0x1e')](_0x886d7b)['then'](function(_0x5a30cf){_0x2314b4['count']=_0x5a30cf;if(_0xdc8444['query'][_0xc321('0x40')]){_0x380982['include']=[{'all':!![]}];}return db[_0xc321('0x2b')][_0xc321('0x41')](_0x380982);})['then'](function(_0x150b79){_0x2314b4[_0xc321('0x42')]=_0x150b79;return _0x2314b4;})[_0xc321('0x26')](respondWithFilteredResult(_0x3e8771,_0x380982))[_0xc321('0x43')](handleError(_0x3e8771,null));};exports['show']=function(_0x5736cb,_0x1d0e4f){var _0x122e77={'raw':!![],'where':{'id':_0x5736cb[_0xc321('0x44')]['id']}},_0x4119d2={};_0x4119d2[_0xc321('0x33')]=_['keys'](db[_0xc321('0x2b')]['rawAttributes']);_0x4119d2[_0xc321('0x30')]=_[_0xc321('0x31')](_0x5736cb[_0xc321('0x30')]);_0x4119d2[_0xc321('0x32')]=_['intersection'](_0x4119d2[_0xc321('0x33')],_0x4119d2[_0xc321('0x30')]);_0x122e77[_0xc321('0x34')]=_[_0xc321('0x35')](_0x4119d2[_0xc321('0x33')],qs[_0xc321('0x36')](_0x5736cb[_0xc321('0x30')]['fields']));_0x122e77[_0xc321('0x34')]=_0x122e77[_0xc321('0x34')][_0xc321('0x37')]?_0x122e77['attributes']:_0x4119d2[_0xc321('0x33')];if(_0x5736cb[_0xc321('0x30')][_0xc321('0x40')]){_0x122e77['include']=[{'all':!![]}];}_0x122e77=_[_0xc321('0x3e')]({},_0x122e77,_0x5736cb[_0xc321('0x3f')]);return db['OpenchannelQueueReport'][_0xc321('0x45')](_0x122e77)[_0xc321('0x26')](handleEntityNotFound(_0x1d0e4f,null))['then'](respondWithResult(_0x1d0e4f,null))[_0xc321('0x43')](handleError(_0x1d0e4f,null));};exports[_0xc321('0x46')]=function(_0x6f8f90,_0x2c6d18){return db[_0xc321('0x2b')][_0xc321('0x46')](_0x6f8f90[_0xc321('0x47')],{})[_0xc321('0x26')](respondWithResult(_0x2c6d18,0xc9))[_0xc321('0x43')](handleError(_0x2c6d18,null));};exports['update']=function(_0x462a65,_0xa65e7){if(_0x462a65['body']['id']){delete _0x462a65['body']['id'];}return db[_0xc321('0x2b')]['find']({'where':{'id':_0x462a65[_0xc321('0x44')]['id']}})[_0xc321('0x26')](handleEntityNotFound(_0xa65e7,null))['then'](saveUpdates(_0x462a65[_0xc321('0x47')],null))[_0xc321('0x26')](respondWithResult(_0xa65e7,null))[_0xc321('0x43')](handleError(_0xa65e7,null));};exports[_0xc321('0x27')]=function(_0x2f06df,_0x3dfdb0){return db[_0xc321('0x2b')][_0xc321('0x45')]({'where':{'id':_0x2f06df['params']['id']}})['then'](handleEntityNotFound(_0x3dfdb0,null))['then'](removeEntity(_0x3dfdb0,null))[_0xc321('0x43')](handleError(_0x3dfdb0,null));};exports[_0xc321('0x48')]=function(_0x194774,_0x221be5){return db[_0xc321('0x2b')][_0xc321('0x48')]()[_0xc321('0x26')](respondWithResult(_0x221be5,null))[_0xc321('0x43')](handleError(_0x221be5,null));}; \ No newline at end of file +var _0x1b45=['OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x1b45,0x6c));var _0x51b4=function(_0x279f6d,_0x122316){_0x279f6d=_0x279f6d-0x0;var _0x5874a5=_0x1b45[_0x279f6d];return _0x5874a5;};'use strict';var emlformat=require(_0x51b4('0x0'));var rimraf=require(_0x51b4('0x1'));var zipdir=require(_0x51b4('0x2'));var jsonpatch=require(_0x51b4('0x3'));var rp=require('request-promise');var moment=require(_0x51b4('0x4'));var BPromise=require(_0x51b4('0x5'));var Mustache=require(_0x51b4('0x6'));var util=require(_0x51b4('0x7'));var path=require(_0x51b4('0x8'));var sox=require(_0x51b4('0x9'));var csv=require(_0x51b4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51b4('0xb'));var _=require(_0x51b4('0xc'));var squel=require(_0x51b4('0xd'));var crypto=require(_0x51b4('0xe'));var jsforce=require(_0x51b4('0xf'));var deskjs=require(_0x51b4('0x10'));var toCsv=require(_0x51b4('0xa'));var querystring=require(_0x51b4('0x11'));var Papa=require(_0x51b4('0x12'));var Redis=require('ioredis');var authService=require(_0x51b4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x51b4('0x14'));var hardwareService=require(_0x51b4('0x15'));var logger=require('../../config/logger')(_0x51b4('0x16'));var utils=require(_0x51b4('0x17'));var config=require(_0x51b4('0x18'));var licenseUtil=require(_0x51b4('0x19'));var db=require(_0x51b4('0x1a'))['db'];function respondWithStatusCode(_0x1403da,_0x319cd8){_0x319cd8=_0x319cd8||0xcc;return function(_0x259b8e){if(_0x259b8e){return _0x1403da[_0x51b4('0x1b')](_0x319cd8);}return _0x1403da[_0x51b4('0x1c')](_0x319cd8)[_0x51b4('0x1d')]();};}function respondWithResult(_0x503309,_0x3647c2){_0x3647c2=_0x3647c2||0xc8;return function(_0x4b7e58){if(_0x4b7e58){return _0x503309[_0x51b4('0x1c')](_0x3647c2)['json'](_0x4b7e58);}};}function respondWithFilteredResult(_0x5dd713,_0xd9aea6){return function(_0x172aea){if(_0x172aea){var _0x395ad8=typeof _0xd9aea6[_0x51b4('0x1e')]===_0x51b4('0x1f')&&typeof _0xd9aea6[_0x51b4('0x20')]==='undefined';var _0x331c4d=_0x172aea[_0x51b4('0x21')];var _0x210638=_0x395ad8?0x0:_0xd9aea6[_0x51b4('0x1e')];var _0x13a284=_0x395ad8?_0x172aea[_0x51b4('0x21')]:_0xd9aea6[_0x51b4('0x1e')]+_0xd9aea6['limit'];var _0x50c570;if(_0x13a284>=_0x331c4d){_0x13a284=_0x331c4d;_0x50c570=0xc8;}else{_0x50c570=0xce;}_0x5dd713['status'](_0x50c570);return _0x5dd713[_0x51b4('0x22')](_0x51b4('0x23'),_0x210638+'-'+_0x13a284+'/'+_0x331c4d)[_0x51b4('0x24')](_0x172aea);}return null;};}function patchUpdates(_0x31f13d){return function(_0x262c88){try{jsonpatch[_0x51b4('0x25')](_0x262c88,_0x31f13d,!![]);}catch(_0x767a46){return BPromise['reject'](_0x767a46);}return _0x262c88[_0x51b4('0x26')]();};}function saveUpdates(_0x16f3e2,_0x39d2f6){return function(_0xaa425f){if(_0xaa425f){return _0xaa425f[_0x51b4('0x27')](_0x16f3e2)[_0x51b4('0x28')](function(_0x2aae04){return _0x2aae04;});}return null;};}function removeEntity(_0x12a8fc,_0x30a715){return function(_0x5c5069){if(_0x5c5069){return _0x5c5069[_0x51b4('0x29')]()['then'](function(){_0x12a8fc[_0x51b4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eb011,_0x5e87a7){return function(_0x433523){if(!_0x433523){_0x4eb011[_0x51b4('0x1b')](0x194);}return _0x433523;};}function handleError(_0x37bf9d,_0x5cec54){_0x5cec54=_0x5cec54||0x1f4;return function(_0x49ccbd){logger[_0x51b4('0x2a')](_0x49ccbd[_0x51b4('0x2b')]);if(_0x49ccbd[_0x51b4('0x2c')]){delete _0x49ccbd[_0x51b4('0x2c')];}_0x37bf9d['status'](_0x5cec54)[_0x51b4('0x2d')](_0x49ccbd);};}exports[_0x51b4('0x2e')]=function(_0x5f5338,_0x167809){var _0x197bb5={},_0x46a631={},_0x26b2b1={'count':0x0,'rows':[]};var _0x267e3d=_[_0x51b4('0x2f')](db[_0x51b4('0x30')][_0x51b4('0x31')],function(_0x1641e7){return{'name':_0x1641e7[_0x51b4('0x32')],'type':_0x1641e7[_0x51b4('0x33')][_0x51b4('0x34')]};});_0x46a631[_0x51b4('0x35')]=_[_0x51b4('0x2f')](_0x267e3d,'name');_0x46a631[_0x51b4('0x36')]=_[_0x51b4('0x37')](_0x5f5338['query']);_0x46a631[_0x51b4('0x38')]=_[_0x51b4('0x39')](_0x46a631['model'],_0x46a631[_0x51b4('0x36')]);_0x197bb5[_0x51b4('0x3a')]=_[_0x51b4('0x39')](_0x46a631[_0x51b4('0x35')],qs['fields'](_0x5f5338[_0x51b4('0x36')][_0x51b4('0x3b')]));_0x197bb5[_0x51b4('0x3a')]=_0x197bb5['attributes'][_0x51b4('0x3c')]?_0x197bb5['attributes']:_0x46a631[_0x51b4('0x35')];if(!_0x5f5338[_0x51b4('0x36')][_0x51b4('0x3d')](_0x51b4('0x3e'))){_0x197bb5[_0x51b4('0x20')]=qs[_0x51b4('0x20')](_0x5f5338[_0x51b4('0x36')][_0x51b4('0x20')]);_0x197bb5[_0x51b4('0x1e')]=qs[_0x51b4('0x1e')](_0x5f5338[_0x51b4('0x36')][_0x51b4('0x1e')]);}_0x197bb5[_0x51b4('0x3f')]=qs['sort'](_0x5f5338[_0x51b4('0x36')]['sort']);_0x197bb5['where']=qs[_0x51b4('0x38')](_['pick'](_0x5f5338[_0x51b4('0x36')],_0x46a631['filters']),_0x267e3d);if(_0x5f5338[_0x51b4('0x36')][_0x51b4('0x40')]){_0x197bb5[_0x51b4('0x41')]=_['merge'](_0x197bb5['where'],{'$or':_['map'](_0x267e3d,function(_0x1f9bf4){if(_0x1f9bf4[_0x51b4('0x33')]!==_0x51b4('0x42')){var _0x36fba0={};_0x36fba0[_0x1f9bf4[_0x51b4('0x2c')]]={'$like':'%'+_0x5f5338[_0x51b4('0x36')]['filter']+'%'};return _0x36fba0;}})});}_0x197bb5=_[_0x51b4('0x43')]({},_0x197bb5,_0x5f5338[_0x51b4('0x44')]);var _0x5da81e={'where':_0x197bb5['where']};return db[_0x51b4('0x30')][_0x51b4('0x21')](_0x5da81e)['then'](function(_0x1225de){_0x26b2b1[_0x51b4('0x21')]=_0x1225de;if(_0x5f5338[_0x51b4('0x36')][_0x51b4('0x45')]){_0x197bb5[_0x51b4('0x46')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x197bb5);})[_0x51b4('0x28')](function(_0x3e936e){_0x26b2b1[_0x51b4('0x47')]=_0x3e936e;return _0x26b2b1;})[_0x51b4('0x28')](respondWithFilteredResult(_0x167809,_0x197bb5))[_0x51b4('0x48')](handleError(_0x167809,null));};exports['show']=function(_0x3c99ad,_0x206347){var _0x38d229={'raw':!![],'where':{'id':_0x3c99ad[_0x51b4('0x49')]['id']}},_0x502375={};_0x502375[_0x51b4('0x35')]=_[_0x51b4('0x37')](db[_0x51b4('0x30')][_0x51b4('0x31')]);_0x502375['query']=_[_0x51b4('0x37')](_0x3c99ad[_0x51b4('0x36')]);_0x502375[_0x51b4('0x38')]=_[_0x51b4('0x39')](_0x502375['model'],_0x502375['query']);_0x38d229['attributes']=_[_0x51b4('0x39')](_0x502375['model'],qs[_0x51b4('0x3b')](_0x3c99ad[_0x51b4('0x36')][_0x51b4('0x3b')]));_0x38d229['attributes']=_0x38d229[_0x51b4('0x3a')][_0x51b4('0x3c')]?_0x38d229['attributes']:_0x502375[_0x51b4('0x35')];if(_0x3c99ad[_0x51b4('0x36')]['includeAll']){_0x38d229[_0x51b4('0x46')]=[{'all':!![]}];}_0x38d229=_[_0x51b4('0x43')]({},_0x38d229,_0x3c99ad[_0x51b4('0x44')]);return db[_0x51b4('0x30')][_0x51b4('0x4a')](_0x38d229)[_0x51b4('0x28')](handleEntityNotFound(_0x206347,null))[_0x51b4('0x28')](respondWithResult(_0x206347,null))['catch'](handleError(_0x206347,null));};exports[_0x51b4('0x4b')]=function(_0x1d9b67,_0x4b7e4c){return db[_0x51b4('0x30')]['create'](_0x1d9b67['body'],{})[_0x51b4('0x28')](respondWithResult(_0x4b7e4c,0xc9))[_0x51b4('0x48')](handleError(_0x4b7e4c,null));};exports[_0x51b4('0x27')]=function(_0xcd4dc,_0x5aba72){if(_0xcd4dc[_0x51b4('0x4c')]['id']){delete _0xcd4dc['body']['id'];}return db[_0x51b4('0x30')][_0x51b4('0x4a')]({'where':{'id':_0xcd4dc[_0x51b4('0x49')]['id']}})[_0x51b4('0x28')](handleEntityNotFound(_0x5aba72,null))[_0x51b4('0x28')](saveUpdates(_0xcd4dc[_0x51b4('0x4c')],null))[_0x51b4('0x28')](respondWithResult(_0x5aba72,null))[_0x51b4('0x48')](handleError(_0x5aba72,null));};exports['destroy']=function(_0x8f9399,_0x578e26){return db[_0x51b4('0x30')][_0x51b4('0x4a')]({'where':{'id':_0x8f9399[_0x51b4('0x49')]['id']}})[_0x51b4('0x28')](handleEntityNotFound(_0x578e26,null))[_0x51b4('0x28')](removeEntity(_0x578e26,null))[_0x51b4('0x48')](handleError(_0x578e26,null));};exports['describe']=function(_0x2a2aa9,_0x5f4f42){return db[_0x51b4('0x30')][_0x51b4('0x4d')]()['then'](respondWithResult(_0x5f4f42,null))[_0x51b4('0x48')](handleError(_0x5f4f42,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a1f60d0..62a0816 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x46c134,_0x1ce3a8){var _0x1f2e9b=function(_0x3e688f){while(--_0x3e688f){_0x46c134['push'](_0x46c134['shift']());}};_0x1f2e9b(++_0x1ce3a8);}(_0x1261,0x144));var _0x1126=function(_0x5c1930,_0x1b15e7){_0x5c1930=_0x5c1930-0x0;var _0x163a34=_0x1261[_0x5c1930];return _0x163a34;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x36e89f,_0x111165){var _0x465dc3=function(_0x59b136){while(--_0x59b136){_0x36e89f['push'](_0x36e89f['shift']());}};_0x465dc3(++_0x111165);}(_0x7a54,0x106));var _0x47a5=function(_0x5bb9cf,_0xe96120){_0x5bb9cf=_0x5bb9cf-0x0;var _0x1652a2=_0x7a54[_0x5bb9cf];return _0x1652a2;};'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 9b27391..c165a07 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 _0x8cda=['catch','create','body','options','raw','then','CreateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent'];(function(_0x282916,_0x29c453){var _0x317b39=function(_0x52a106){while(--_0x52a106){_0x282916['push'](_0x282916['shift']());}};_0x317b39(++_0x29c453);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa8cd('0x0'));var moment=require(_0xa8cd('0x1'));var BPromise=require(_0xa8cd('0x2'));var rs=require(_0xa8cd('0x3'));var fs=require('fs');var Redis=require(_0xa8cd('0x4'));var db=require(_0xa8cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8cd('0x6'))(_0xa8cd('0x7'));var config=require(_0xa8cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8cd('0x9')][_0xa8cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1362c3,_0x273d2f,_0x2b9b51){return new BPromise(function(_0x2481ba,_0x13f394){return client[_0xa8cd('0xb')](_0x1362c3,_0x2b9b51)['then'](function(_0x50b8ee){logger['info'](_0xa8cd('0xc'),_0x273d2f,'request\x20sent');logger[_0xa8cd('0xd')](_0xa8cd('0xe'),_0x273d2f,'request\x20sent',JSON[_0xa8cd('0xf')](_0x50b8ee));if(_0x50b8ee[_0xa8cd('0x10')]){if(_0x50b8ee['error']['code']===0x1f4){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x50b8ee[_0xa8cd('0x10')][_0xa8cd('0x11')]);return _0x13f394(_0x50b8ee[_0xa8cd('0x10')]['message']);}logger[_0xa8cd('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x273d2f,_0x50b8ee[_0xa8cd('0x10')]['message']);return _0x2481ba(_0x50b8ee[_0xa8cd('0x10')]['message']);}else{logger[_0xa8cd('0x12')](_0xa8cd('0xc'),_0x273d2f,_0xa8cd('0x13'));_0x2481ba(_0x50b8ee['result']['message']);}})[_0xa8cd('0x14')](function(_0x6d5f40){logger[_0xa8cd('0x10')](_0xa8cd('0xc'),_0x273d2f,_0x6d5f40);_0x13f394(_0x6d5f40);});});}exports['CreateOpenchannelQueueReport']=function(_0x128a90){var _0x52252b=this;return new Promise(function(_0x1cacd5,_0x2ef224){return db['OpenchannelQueueReport'][_0xa8cd('0x15')](_0x128a90[_0xa8cd('0x16')],{'raw':_0x128a90['options']?_0x128a90[_0xa8cd('0x17')][_0xa8cd('0x18')]===undefined?!![]:![]:!![]})[_0xa8cd('0x19')](function(_0x289cb6){logger[_0xa8cd('0x12')]('CreateOpenchannelQueueReport',_0x128a90);logger[_0xa8cd('0xd')](_0xa8cd('0x1a'),_0x128a90,JSON[_0xa8cd('0xf')](_0x289cb6));_0x1cacd5(_0x289cb6);})[_0xa8cd('0x14')](function(_0x4f4093){logger[_0xa8cd('0x10')]('CreateOpenchannelQueueReport',_0x4f4093['message'],_0x128a90);_0x2ef224(_0x52252b[_0xa8cd('0x10')](0x1f4,_0x4f4093[_0xa8cd('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1c7b31){var _0x26d35a=this;return new Promise(function(_0xfd170,_0x43462d){return db[_0xa8cd('0x1b')][_0xa8cd('0x1c')](_0x1c7b31[_0xa8cd('0x16')],{'raw':_0x1c7b31['options']?_0x1c7b31[_0xa8cd('0x17')][_0xa8cd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7b31[_0xa8cd('0x17')]?_0x1c7b31[_0xa8cd('0x17')][_0xa8cd('0x1d')]||null:null,'attributes':_0x1c7b31[_0xa8cd('0x17')]?_0x1c7b31['options'][_0xa8cd('0x1e')]||null:null,'limit':_0x1c7b31[_0xa8cd('0x17')]?_0x1c7b31[_0xa8cd('0x17')][_0xa8cd('0x1f')]||null:null})[_0xa8cd('0x19')](function(_0x2241f8){logger[_0xa8cd('0x12')](_0xa8cd('0x20'),_0x1c7b31);logger[_0xa8cd('0xd')](_0xa8cd('0x20'),_0x1c7b31,JSON[_0xa8cd('0xf')](_0x2241f8));_0xfd170(_0x2241f8);})[_0xa8cd('0x14')](function(_0x471052){logger[_0xa8cd('0x10')](_0xa8cd('0x20'),_0x471052[_0xa8cd('0x11')],_0x1c7b31);_0x43462d(_0x26d35a['error'](0x1f4,_0x471052['message']));});});}; \ No newline at end of file +var _0xeb3b=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','raw','debug','stringify','UpdateOpenchannelQueueReport','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0xeb3b[_0x3eff21];return _0x1945bb;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));var BPromise=require(_0xbeb3('0x3'));var rs=require(_0xbeb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbeb3('0x5'));var logger=require('../../config/logger')(_0xbeb3('0x6'));var config=require('../../config/environment');var jayson=require(_0xbeb3('0x7'));var client=jayson[_0xbeb3('0x8')][_0xbeb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x294cc9,_0x406927,_0x143255){return new BPromise(function(_0x5a6a06,_0x241dbb){return client[_0xbeb3('0xa')](_0x294cc9,_0x143255)[_0xbeb3('0xb')](function(_0x3b61ac){logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,_0xbeb3('0xe'));logger['debug'](_0xbeb3('0xf'),_0x406927,_0xbeb3('0xe'),JSON['stringify'](_0x3b61ac));if(_0x3b61ac[_0xbeb3('0x10')]){if(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x11')]===0x1f4){logger[_0xbeb3('0x10')](_0xbeb3('0xd'),_0x406927,_0x3b61ac[_0xbeb3('0x10')]['message']);return _0x241dbb(_0x3b61ac['error'][_0xbeb3('0x12')]);}logger[_0xbeb3('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x406927,_0x3b61ac['error'][_0xbeb3('0x12')]);return _0x5a6a06(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x12')]);}else{logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,'request\x20sent');_0x5a6a06(_0x3b61ac[_0xbeb3('0x13')]['message']);}})[_0xbeb3('0x14')](function(_0x4e7d99){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x406927,_0x4e7d99);_0x241dbb(_0x4e7d99);});});}exports[_0xbeb3('0x15')]=function(_0x44a4bb){var _0x32275b=this;return new Promise(function(_0x10b15d,_0x5d0689){return db[_0xbeb3('0x16')][_0xbeb3('0x17')](_0x44a4bb[_0xbeb3('0x18')],{'raw':_0x44a4bb['options']?_0x44a4bb['options'][_0xbeb3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1d917b){logger['info']('CreateOpenchannelQueueReport',_0x44a4bb);logger[_0xbeb3('0x1a')](_0xbeb3('0x15'),_0x44a4bb,JSON[_0xbeb3('0x1b')](_0x1d917b));_0x10b15d(_0x1d917b);})['catch'](function(_0x301899){logger[_0xbeb3('0x10')]('CreateOpenchannelQueueReport',_0x301899[_0xbeb3('0x12')],_0x44a4bb);_0x5d0689(_0x32275b[_0xbeb3('0x10')](0x1f4,_0x301899['message']));});});};exports[_0xbeb3('0x1c')]=function(_0x278fe4){var _0x16b079=this;return new Promise(function(_0x42c6c3,_0x2bc188){return db[_0xbeb3('0x16')][_0xbeb3('0x1d')](_0x278fe4[_0xbeb3('0x18')],{'raw':_0x278fe4[_0xbeb3('0x1e')]?_0x278fe4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x278fe4[_0xbeb3('0x1e')]?_0x278fe4['options'][_0xbeb3('0x1f')]||null:null,'attributes':_0x278fe4[_0xbeb3('0x1e')]?_0x278fe4[_0xbeb3('0x1e')][_0xbeb3('0x20')]||null:null,'limit':_0x278fe4['options']?_0x278fe4[_0xbeb3('0x1e')]['limit']||null:null})[_0xbeb3('0xb')](function(_0xab301c){logger['info']('UpdateOpenchannelQueueReport',_0x278fe4);logger[_0xbeb3('0x1a')]('UpdateOpenchannelQueueReport',_0x278fe4,JSON['stringify'](_0xab301c));_0x42c6c3(_0xab301c);})['catch'](function(_0x5bfef7){logger[_0xbeb3('0x10')]('UpdateOpenchannelQueueReport',_0x5bfef7[_0xbeb3('0x12')],_0x278fe4);_0x2bc188(_0x16b079[_0xbeb3('0x10')](0x1f4,_0x5bfef7[_0xbeb3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c720c7d..5e1a3fd 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 _0x1958=['util','path','express','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x23c6f4,_0x12a43d){var _0x4de71b=function(_0x24ff3d){while(--_0x24ff3d){_0x23c6f4['push'](_0x23c6f4['shift']());}};_0x4de71b(++_0x12a43d);}(_0x1958,0xfb));var _0x8195=function(_0x4d453c,_0x311b8c){_0x4d453c=_0x4d453c-0x0;var _0x4c80ac=_0x1958[_0x4d453c];return _0x4c80ac;};'use strict';var multer=require(_0x8195('0x0'));var util=require(_0x8195('0x1'));var path=require(_0x8195('0x2'));var timeout=require('connect-timeout');var express=require(_0x8195('0x3'));var router=express[_0x8195('0x4')]();var fs_extra=require(_0x8195('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8195('0x6'));var controller=require(_0x8195('0x7'));router[_0x8195('0x8')]('/',auth['isAuthenticated'](),controller[_0x8195('0x9')]);router[_0x8195('0x8')](_0x8195('0xa'),auth[_0x8195('0xb')](),controller[_0x8195('0xc')]);router['get'](_0x8195('0xd'),auth[_0x8195('0xb')](),controller[_0x8195('0xe')]);router[_0x8195('0xf')]('/',auth[_0x8195('0xb')](),controller[_0x8195('0x10')]);router[_0x8195('0x11')]('/:id',auth[_0x8195('0xb')](),controller['update']);router[_0x8195('0x12')](_0x8195('0xd'),auth['isAuthenticated'](),controller[_0x8195('0x13')]);module[_0x8195('0x14')]=router; \ No newline at end of file +var _0x7e84=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','Router'];(function(_0x5ae0cb,_0x4e2965){var _0x405664=function(_0x5e4b8d){while(--_0x5e4b8d){_0x5ae0cb['push'](_0x5ae0cb['shift']());}};_0x405664(++_0x4e2965);}(_0x7e84,0xeb));var _0x47e8=function(_0x4936fe,_0x36693a){_0x4936fe=_0x4936fe-0x0;var _0x4238c8=_0x7e84[_0x4936fe];return _0x4238c8;};'use strict';var multer=require(_0x47e8('0x0'));var util=require(_0x47e8('0x1'));var path=require(_0x47e8('0x2'));var timeout=require(_0x47e8('0x3'));var express=require('express');var router=express[_0x47e8('0x4')]();var fs_extra=require(_0x47e8('0x5'));var auth=require(_0x47e8('0x6'));var interaction=require(_0x47e8('0x7'));var config=require(_0x47e8('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x47e8('0x9')]('/',auth[_0x47e8('0xa')](),controller['index']);router[_0x47e8('0x9')](_0x47e8('0xb'),auth[_0x47e8('0xa')](),controller[_0x47e8('0xc')]);router['get'](_0x47e8('0xd'),auth[_0x47e8('0xa')](),controller[_0x47e8('0xe')]);router[_0x47e8('0xf')]('/',auth[_0x47e8('0xa')](),controller[_0x47e8('0x10')]);router[_0x47e8('0x11')](_0x47e8('0xd'),auth['isAuthenticated'](),controller[_0x47e8('0x12')]);router[_0x47e8('0x13')](_0x47e8('0xd'),auth[_0x47e8('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 c4c7cd0..cd52f3e 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3eefc4,_0x13da29){var _0x390870=function(_0x3236fe){while(--_0x3236fe){_0x3eefc4['push'](_0x3eefc4['shift']());}};_0x390870(++_0x13da29);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xfad1a7,_0x2e3b8d){var _0x571012=function(_0x33255d){while(--_0x33255d){_0xfad1a7['push'](_0xfad1a7['shift']());}};_0x571012(++_0x2e3b8d);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f06feed..f2ce11e 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 _0x6ddb=['json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ddb,0x16b));var _0xb6dd=function(_0x35318e,_0x518d31){_0x35318e=_0x35318e-0x0;var _0x1ad6ed=_0x6ddb[_0x35318e];return _0x1ad6ed;};'use strict';var emlformat=require(_0xb6dd('0x0'));var rimraf=require(_0xb6dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb6dd('0x2'));var rp=require(_0xb6dd('0x3'));var moment=require(_0xb6dd('0x4'));var BPromise=require(_0xb6dd('0x5'));var Mustache=require(_0xb6dd('0x6'));var util=require(_0xb6dd('0x7'));var path=require(_0xb6dd('0x8'));var sox=require(_0xb6dd('0x9'));var csv=require(_0xb6dd('0xa'));var ejs=require(_0xb6dd('0xb'));var fs=require('fs');var fs_extra=require(_0xb6dd('0xc'));var _=require(_0xb6dd('0xd'));var squel=require(_0xb6dd('0xe'));var crypto=require(_0xb6dd('0xf'));var jsforce=require(_0xb6dd('0x10'));var deskjs=require(_0xb6dd('0x11'));var toCsv=require(_0xb6dd('0xa'));var querystring=require(_0xb6dd('0x12'));var Papa=require(_0xb6dd('0x13'));var Redis=require(_0xb6dd('0x14'));var authService=require(_0xb6dd('0x15'));var qs=require(_0xb6dd('0x16'));var as=require(_0xb6dd('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6dd('0x18'))(_0xb6dd('0x19'));var utils=require(_0xb6dd('0x1a'));var config=require(_0xb6dd('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xb6dd('0x1c'))['db'];function respondWithStatusCode(_0x2c9b09,_0x405388){_0x405388=_0x405388||0xcc;return function(_0x242fde){if(_0x242fde){return _0x2c9b09['sendStatus'](_0x405388);}return _0x2c9b09[_0xb6dd('0x1d')](_0x405388)[_0xb6dd('0x1e')]();};}function respondWithResult(_0x47bcea,_0x361060){_0x361060=_0x361060||0xc8;return function(_0x527502){if(_0x527502){return _0x47bcea[_0xb6dd('0x1d')](_0x361060)['json'](_0x527502);}};}function respondWithFilteredResult(_0x571f06,_0x149474){return function(_0x25a9b0){if(_0x25a9b0){var _0x113a1d=typeof _0x149474['offset']===_0xb6dd('0x1f')&&typeof _0x149474[_0xb6dd('0x20')]===_0xb6dd('0x1f');var _0x33bfd7=_0x25a9b0[_0xb6dd('0x21')];var _0x594e50=_0x113a1d?0x0:_0x149474[_0xb6dd('0x22')];var _0x3395dd=_0x113a1d?_0x25a9b0[_0xb6dd('0x21')]:_0x149474[_0xb6dd('0x22')]+_0x149474[_0xb6dd('0x20')];var _0x3487f9;if(_0x3395dd>=_0x33bfd7){_0x3395dd=_0x33bfd7;_0x3487f9=0xc8;}else{_0x3487f9=0xce;}_0x571f06[_0xb6dd('0x1d')](_0x3487f9);return _0x571f06[_0xb6dd('0x23')](_0xb6dd('0x24'),_0x594e50+'-'+_0x3395dd+'/'+_0x33bfd7)[_0xb6dd('0x25')](_0x25a9b0);}return null;};}function patchUpdates(_0x93a122){return function(_0x1ff421){try{jsonpatch[_0xb6dd('0x26')](_0x1ff421,_0x93a122,!![]);}catch(_0x3008a0){return BPromise[_0xb6dd('0x27')](_0x3008a0);}return _0x1ff421[_0xb6dd('0x28')]();};}function saveUpdates(_0x36994d,_0x209ac0){return function(_0x171ed2){if(_0x171ed2){return _0x171ed2[_0xb6dd('0x29')](_0x36994d)[_0xb6dd('0x2a')](function(_0x4355dc){return _0x4355dc;});}return null;};}function removeEntity(_0x55c3ee,_0x5e8e7d){return function(_0x40e615){if(_0x40e615){return _0x40e615[_0xb6dd('0x2b')]()[_0xb6dd('0x2a')](function(){_0x55c3ee[_0xb6dd('0x1d')](0xcc)[_0xb6dd('0x1e')]();});}};}function handleEntityNotFound(_0x58ab2a,_0x402249){return function(_0x495ac8){if(!_0x495ac8){_0x58ab2a[_0xb6dd('0x2c')](0x194);}return _0x495ac8;};}function handleError(_0x38c606,_0x48c75f){_0x48c75f=_0x48c75f||0x1f4;return function(_0x3968ef){logger[_0xb6dd('0x2d')](_0x3968ef[_0xb6dd('0x2e')]);if(_0x3968ef[_0xb6dd('0x2f')]){delete _0x3968ef[_0xb6dd('0x2f')];}_0x38c606[_0xb6dd('0x1d')](_0x48c75f)[_0xb6dd('0x30')](_0x3968ef);};}exports[_0xb6dd('0x31')]=function(_0x54fb89,_0x223a73){var _0x37ed9c={},_0x1101c1={},_0x340f8a={'count':0x0,'rows':[]};var _0x2feddf=_[_0xb6dd('0x32')](db[_0xb6dd('0x33')]['rawAttributes'],function(_0x1422ec){return{'name':_0x1422ec[_0xb6dd('0x34')],'type':_0x1422ec['type'][_0xb6dd('0x35')]};});_0x1101c1[_0xb6dd('0x36')]=_[_0xb6dd('0x32')](_0x2feddf,_0xb6dd('0x2f'));_0x1101c1[_0xb6dd('0x37')]=_[_0xb6dd('0x38')](_0x54fb89[_0xb6dd('0x37')]);_0x1101c1[_0xb6dd('0x39')]=_[_0xb6dd('0x3a')](_0x1101c1[_0xb6dd('0x36')],_0x1101c1[_0xb6dd('0x37')]);_0x37ed9c[_0xb6dd('0x3b')]=_[_0xb6dd('0x3a')](_0x1101c1[_0xb6dd('0x36')],qs['fields'](_0x54fb89[_0xb6dd('0x37')][_0xb6dd('0x3c')]));_0x37ed9c[_0xb6dd('0x3b')]=_0x37ed9c['attributes'][_0xb6dd('0x3d')]?_0x37ed9c[_0xb6dd('0x3b')]:_0x1101c1[_0xb6dd('0x36')];if(!_0x54fb89['query'][_0xb6dd('0x3e')]('nolimit')){_0x37ed9c[_0xb6dd('0x20')]=qs[_0xb6dd('0x20')](_0x54fb89[_0xb6dd('0x37')][_0xb6dd('0x20')]);_0x37ed9c[_0xb6dd('0x22')]=qs[_0xb6dd('0x22')](_0x54fb89[_0xb6dd('0x37')][_0xb6dd('0x22')]);}_0x37ed9c[_0xb6dd('0x3f')]=qs[_0xb6dd('0x40')](_0x54fb89[_0xb6dd('0x37')]['sort']);_0x37ed9c[_0xb6dd('0x41')]=qs['filters'](_[_0xb6dd('0x42')](_0x54fb89[_0xb6dd('0x37')],_0x1101c1['filters']),_0x2feddf);if(_0x54fb89[_0xb6dd('0x37')][_0xb6dd('0x43')]){_0x37ed9c[_0xb6dd('0x41')]=_[_0xb6dd('0x44')](_0x37ed9c[_0xb6dd('0x41')],{'$or':_[_0xb6dd('0x32')](_0x2feddf,function(_0x10036f){if(_0x10036f['type']!=='VIRTUAL'){var _0x4a9181={};_0x4a9181[_0x10036f[_0xb6dd('0x2f')]]={'$like':'%'+_0x54fb89[_0xb6dd('0x37')][_0xb6dd('0x43')]+'%'};return _0x4a9181;}})});}_0x37ed9c=_[_0xb6dd('0x44')]({},_0x37ed9c,_0x54fb89[_0xb6dd('0x45')]);var _0x1794c9={'where':_0x37ed9c[_0xb6dd('0x41')]};return db['OpenchannelTransferReport'][_0xb6dd('0x21')](_0x1794c9)[_0xb6dd('0x2a')](function(_0x3c5249){_0x340f8a[_0xb6dd('0x21')]=_0x3c5249;if(_0x54fb89['query'][_0xb6dd('0x46')]){_0x37ed9c[_0xb6dd('0x47')]=[{'all':!![]}];}return db[_0xb6dd('0x33')][_0xb6dd('0x48')](_0x37ed9c);})[_0xb6dd('0x2a')](function(_0x3b3751){_0x340f8a[_0xb6dd('0x49')]=_0x3b3751;return _0x340f8a;})['then'](respondWithFilteredResult(_0x223a73,_0x37ed9c))[_0xb6dd('0x4a')](handleError(_0x223a73,null));};exports['show']=function(_0x3470be,_0x58b967){var _0x296c0b={'raw':!![],'where':{'id':_0x3470be['params']['id']}},_0x3cc114={};_0x3cc114[_0xb6dd('0x36')]=_[_0xb6dd('0x38')](db['OpenchannelTransferReport']['rawAttributes']);_0x3cc114[_0xb6dd('0x37')]=_[_0xb6dd('0x38')](_0x3470be[_0xb6dd('0x37')]);_0x3cc114[_0xb6dd('0x39')]=_[_0xb6dd('0x3a')](_0x3cc114[_0xb6dd('0x36')],_0x3cc114[_0xb6dd('0x37')]);_0x296c0b[_0xb6dd('0x3b')]=_[_0xb6dd('0x3a')](_0x3cc114[_0xb6dd('0x36')],qs[_0xb6dd('0x3c')](_0x3470be[_0xb6dd('0x37')]['fields']));_0x296c0b['attributes']=_0x296c0b['attributes'][_0xb6dd('0x3d')]?_0x296c0b['attributes']:_0x3cc114['model'];if(_0x3470be[_0xb6dd('0x37')][_0xb6dd('0x46')]){_0x296c0b['include']=[{'all':!![]}];}_0x296c0b=_[_0xb6dd('0x44')]({},_0x296c0b,_0x3470be[_0xb6dd('0x45')]);return db[_0xb6dd('0x33')][_0xb6dd('0x4b')](_0x296c0b)[_0xb6dd('0x2a')](handleEntityNotFound(_0x58b967,null))[_0xb6dd('0x2a')](respondWithResult(_0x58b967,null))[_0xb6dd('0x4a')](handleError(_0x58b967,null));};exports[_0xb6dd('0x4c')]=function(_0x98cb7e,_0x3cc77f){return db['OpenchannelTransferReport'][_0xb6dd('0x4c')](_0x98cb7e[_0xb6dd('0x4d')],{})[_0xb6dd('0x2a')](respondWithResult(_0x3cc77f,0xc9))[_0xb6dd('0x4a')](handleError(_0x3cc77f,null));};exports['update']=function(_0x3baf13,_0x16b5fa){if(_0x3baf13['body']['id']){delete _0x3baf13[_0xb6dd('0x4d')]['id'];}return db[_0xb6dd('0x33')]['find']({'where':{'id':_0x3baf13[_0xb6dd('0x4e')]['id']}})[_0xb6dd('0x2a')](handleEntityNotFound(_0x16b5fa,null))[_0xb6dd('0x2a')](saveUpdates(_0x3baf13[_0xb6dd('0x4d')],null))[_0xb6dd('0x2a')](respondWithResult(_0x16b5fa,null))['catch'](handleError(_0x16b5fa,null));};exports[_0xb6dd('0x2b')]=function(_0x3e1448,_0x157371){return db[_0xb6dd('0x33')][_0xb6dd('0x4b')]({'where':{'id':_0x3e1448['params']['id']}})[_0xb6dd('0x2a')](handleEntityNotFound(_0x157371,null))[_0xb6dd('0x2a')](removeEntity(_0x157371,null))[_0xb6dd('0x4a')](handleError(_0x157371,null));};exports[_0xb6dd('0x4f')]=function(_0x4b1140,_0x102bb5){return db[_0xb6dd('0x33')][_0xb6dd('0x4f')]()[_0xb6dd('0x2a')](respondWithResult(_0x102bb5,null))[_0xb6dd('0x4a')](handleError(_0x102bb5,null));}; \ No newline at end of file +var _0x35c1=['OpenchannelTransferReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x35c1,0x104));var _0x135c=function(_0x26f499,_0x2359ef){_0x26f499=_0x26f499-0x0;var _0xccb39=_0x35c1[_0x26f499];return _0xccb39;};'use strict';var emlformat=require(_0x135c('0x0'));var rimraf=require(_0x135c('0x1'));var zipdir=require(_0x135c('0x2'));var jsonpatch=require(_0x135c('0x3'));var rp=require(_0x135c('0x4'));var moment=require(_0x135c('0x5'));var BPromise=require(_0x135c('0x6'));var Mustache=require(_0x135c('0x7'));var util=require(_0x135c('0x8'));var path=require(_0x135c('0x9'));var sox=require(_0x135c('0xa'));var csv=require(_0x135c('0xb'));var ejs=require(_0x135c('0xc'));var fs=require('fs');var fs_extra=require(_0x135c('0xd'));var _=require('lodash');var squel=require(_0x135c('0xe'));var crypto=require('crypto');var jsforce=require(_0x135c('0xf'));var deskjs=require(_0x135c('0x10'));var toCsv=require(_0x135c('0xb'));var querystring=require(_0x135c('0x11'));var Papa=require('papaparse');var Redis=require(_0x135c('0x12'));var authService=require(_0x135c('0x13'));var qs=require(_0x135c('0x14'));var as=require(_0x135c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x135c('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x135c('0x17'));var db=require(_0x135c('0x18'))['db'];function respondWithStatusCode(_0x2e1fd9,_0x175d3b){_0x175d3b=_0x175d3b||0xcc;return function(_0x168dff){if(_0x168dff){return _0x2e1fd9[_0x135c('0x19')](_0x175d3b);}return _0x2e1fd9['status'](_0x175d3b)[_0x135c('0x1a')]();};}function respondWithResult(_0x4ef49a,_0x436f3e){_0x436f3e=_0x436f3e||0xc8;return function(_0x4baaff){if(_0x4baaff){return _0x4ef49a[_0x135c('0x1b')](_0x436f3e)[_0x135c('0x1c')](_0x4baaff);}};}function respondWithFilteredResult(_0x512819,_0x151fdf){return function(_0x3c3bb7){if(_0x3c3bb7){var _0x5057a5=typeof _0x151fdf[_0x135c('0x1d')]===_0x135c('0x1e')&&typeof _0x151fdf[_0x135c('0x1f')]===_0x135c('0x1e');var _0x3de602=_0x3c3bb7[_0x135c('0x20')];var _0x24b4d6=_0x5057a5?0x0:_0x151fdf[_0x135c('0x1d')];var _0x3235f2=_0x5057a5?_0x3c3bb7[_0x135c('0x20')]:_0x151fdf[_0x135c('0x1d')]+_0x151fdf['limit'];var _0x73d252;if(_0x3235f2>=_0x3de602){_0x3235f2=_0x3de602;_0x73d252=0xc8;}else{_0x73d252=0xce;}_0x512819[_0x135c('0x1b')](_0x73d252);return _0x512819[_0x135c('0x21')]('Content-Range',_0x24b4d6+'-'+_0x3235f2+'/'+_0x3de602)[_0x135c('0x1c')](_0x3c3bb7);}return null;};}function patchUpdates(_0x8b2e81){return function(_0x1107a3){try{jsonpatch['apply'](_0x1107a3,_0x8b2e81,!![]);}catch(_0x5e92e3){return BPromise[_0x135c('0x22')](_0x5e92e3);}return _0x1107a3[_0x135c('0x23')]();};}function saveUpdates(_0x2799d2,_0x130e65){return function(_0xbe1306){if(_0xbe1306){return _0xbe1306[_0x135c('0x24')](_0x2799d2)[_0x135c('0x25')](function(_0x57dd5c){return _0x57dd5c;});}return null;};}function removeEntity(_0x3de1be,_0x4786f6){return function(_0x37c4d3){if(_0x37c4d3){return _0x37c4d3[_0x135c('0x26')]()['then'](function(){_0x3de1be[_0x135c('0x1b')](0xcc)[_0x135c('0x1a')]();});}};}function handleEntityNotFound(_0x10d1c1,_0x8bff40){return function(_0x459a10){if(!_0x459a10){_0x10d1c1[_0x135c('0x19')](0x194);}return _0x459a10;};}function handleError(_0x51acbd,_0x2593d0){_0x2593d0=_0x2593d0||0x1f4;return function(_0x464174){logger[_0x135c('0x27')](_0x464174[_0x135c('0x28')]);if(_0x464174[_0x135c('0x29')]){delete _0x464174[_0x135c('0x29')];}_0x51acbd[_0x135c('0x1b')](_0x2593d0)[_0x135c('0x2a')](_0x464174);};}exports['index']=function(_0xc1e62b,_0x45857e){var _0x12da92={},_0x5e0f83={},_0x44e81={'count':0x0,'rows':[]};var _0x1adb6b=_[_0x135c('0x2b')](db[_0x135c('0x2c')][_0x135c('0x2d')],function(_0x6fb83e){return{'name':_0x6fb83e[_0x135c('0x2e')],'type':_0x6fb83e['type']['key']};});_0x5e0f83[_0x135c('0x2f')]=_['map'](_0x1adb6b,_0x135c('0x29'));_0x5e0f83['query']=_[_0x135c('0x30')](_0xc1e62b[_0x135c('0x31')]);_0x5e0f83[_0x135c('0x32')]=_['intersection'](_0x5e0f83[_0x135c('0x2f')],_0x5e0f83[_0x135c('0x31')]);_0x12da92['attributes']=_[_0x135c('0x33')](_0x5e0f83['model'],qs[_0x135c('0x34')](_0xc1e62b[_0x135c('0x31')][_0x135c('0x34')]));_0x12da92['attributes']=_0x12da92['attributes']['length']?_0x12da92[_0x135c('0x35')]:_0x5e0f83['model'];if(!_0xc1e62b['query'][_0x135c('0x36')](_0x135c('0x37'))){_0x12da92[_0x135c('0x1f')]=qs['limit'](_0xc1e62b[_0x135c('0x31')][_0x135c('0x1f')]);_0x12da92[_0x135c('0x1d')]=qs[_0x135c('0x1d')](_0xc1e62b[_0x135c('0x31')]['offset']);}_0x12da92[_0x135c('0x38')]=qs[_0x135c('0x39')](_0xc1e62b['query'][_0x135c('0x39')]);_0x12da92[_0x135c('0x3a')]=qs[_0x135c('0x32')](_[_0x135c('0x3b')](_0xc1e62b['query'],_0x5e0f83[_0x135c('0x32')]),_0x1adb6b);if(_0xc1e62b[_0x135c('0x31')][_0x135c('0x3c')]){_0x12da92['where']=_[_0x135c('0x3d')](_0x12da92[_0x135c('0x3a')],{'$or':_[_0x135c('0x2b')](_0x1adb6b,function(_0x2937f3){if(_0x2937f3[_0x135c('0x3e')]!==_0x135c('0x3f')){var _0x4a8a56={};_0x4a8a56[_0x2937f3[_0x135c('0x29')]]={'$like':'%'+_0xc1e62b[_0x135c('0x31')][_0x135c('0x3c')]+'%'};return _0x4a8a56;}})});}_0x12da92=_[_0x135c('0x3d')]({},_0x12da92,_0xc1e62b[_0x135c('0x40')]);var _0x3f0aa8={'where':_0x12da92[_0x135c('0x3a')]};return db[_0x135c('0x2c')][_0x135c('0x20')](_0x3f0aa8)['then'](function(_0x470486){_0x44e81[_0x135c('0x20')]=_0x470486;if(_0xc1e62b['query'][_0x135c('0x41')]){_0x12da92[_0x135c('0x42')]=[{'all':!![]}];}return db[_0x135c('0x2c')]['findAll'](_0x12da92);})[_0x135c('0x25')](function(_0x2c0500){_0x44e81[_0x135c('0x43')]=_0x2c0500;return _0x44e81;})[_0x135c('0x25')](respondWithFilteredResult(_0x45857e,_0x12da92))['catch'](handleError(_0x45857e,null));};exports[_0x135c('0x44')]=function(_0x47bcb6,_0x309d68){var _0x27ccf7={'raw':!![],'where':{'id':_0x47bcb6[_0x135c('0x45')]['id']}},_0x4e878a={};_0x4e878a[_0x135c('0x2f')]=_[_0x135c('0x30')](db[_0x135c('0x2c')]['rawAttributes']);_0x4e878a[_0x135c('0x31')]=_[_0x135c('0x30')](_0x47bcb6[_0x135c('0x31')]);_0x4e878a[_0x135c('0x32')]=_[_0x135c('0x33')](_0x4e878a[_0x135c('0x2f')],_0x4e878a[_0x135c('0x31')]);_0x27ccf7['attributes']=_[_0x135c('0x33')](_0x4e878a['model'],qs[_0x135c('0x34')](_0x47bcb6[_0x135c('0x31')][_0x135c('0x34')]));_0x27ccf7[_0x135c('0x35')]=_0x27ccf7['attributes'][_0x135c('0x46')]?_0x27ccf7[_0x135c('0x35')]:_0x4e878a['model'];if(_0x47bcb6[_0x135c('0x31')]['includeAll']){_0x27ccf7[_0x135c('0x42')]=[{'all':!![]}];}_0x27ccf7=_[_0x135c('0x3d')]({},_0x27ccf7,_0x47bcb6[_0x135c('0x40')]);return db[_0x135c('0x2c')]['find'](_0x27ccf7)['then'](handleEntityNotFound(_0x309d68,null))[_0x135c('0x25')](respondWithResult(_0x309d68,null))[_0x135c('0x47')](handleError(_0x309d68,null));};exports['create']=function(_0x4aedc4,_0x25d9a2){return db[_0x135c('0x2c')][_0x135c('0x48')](_0x4aedc4[_0x135c('0x49')],{})['then'](respondWithResult(_0x25d9a2,0xc9))[_0x135c('0x47')](handleError(_0x25d9a2,null));};exports[_0x135c('0x24')]=function(_0x5a5a82,_0x3a2e3f){if(_0x5a5a82[_0x135c('0x49')]['id']){delete _0x5a5a82['body']['id'];}return db['OpenchannelTransferReport'][_0x135c('0x4a')]({'where':{'id':_0x5a5a82[_0x135c('0x45')]['id']}})[_0x135c('0x25')](handleEntityNotFound(_0x3a2e3f,null))[_0x135c('0x25')](saveUpdates(_0x5a5a82[_0x135c('0x49')],null))[_0x135c('0x25')](respondWithResult(_0x3a2e3f,null))[_0x135c('0x47')](handleError(_0x3a2e3f,null));};exports['destroy']=function(_0x16950a,_0x34818e){return db[_0x135c('0x2c')][_0x135c('0x4a')]({'where':{'id':_0x16950a[_0x135c('0x45')]['id']}})[_0x135c('0x25')](handleEntityNotFound(_0x34818e,null))[_0x135c('0x25')](removeEntity(_0x34818e,null))[_0x135c('0x47')](handleError(_0x34818e,null));};exports[_0x135c('0x4b')]=function(_0x7a188f,_0x298b15){return db[_0x135c('0x2c')][_0x135c('0x4b')]()[_0x135c('0x25')](respondWithResult(_0x298b15,null))[_0x135c('0x47')](handleError(_0x298b15,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e7a71c0..a05409c 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 _0xd5b1=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x3650e0,_0xda0f52){var _0x6841fb=function(_0x1e7cc0){while(--_0x1e7cc0){_0x3650e0['push'](_0x3650e0['shift']());}};_0x6841fb(++_0xda0f52);}(_0xd5b1,0x1eb));var _0x1d5b=function(_0x4acfb9,_0x157698){_0x4acfb9=_0x4acfb9-0x0;var _0x23554d=_0xd5b1[_0x4acfb9];return _0x23554d;};'use strict';var _=require(_0x1d5b('0x0'));var util=require(_0x1d5b('0x1'));var logger=require(_0x1d5b('0x2'))(_0x1d5b('0x3'));var moment=require(_0x1d5b('0x4'));var BPromise=require(_0x1d5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d5b('0x6'));var rimraf=require(_0x1d5b('0x7'));var config=require(_0x1d5b('0x8'));var attributes=require(_0x1d5b('0x9'));module['exports']=function(_0x369d48,_0x2f1a3e){return _0x369d48[_0x1d5b('0xa')](_0x1d5b('0xb'),attributes,{'tableName':_0x1d5b('0xc'),'paranoid':![],'indexes':[{'name':_0x1d5b('0xd'),'fields':[_0x1d5b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09e0=['../../config/logger','moment','request-promise','path','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0xd5bab0,_0x39fc72){var _0x434e42=function(_0x22fc4f){while(--_0x22fc4f){_0xd5bab0['push'](_0xd5bab0['shift']());}};_0x434e42(++_0x39fc72);}(_0x09e0,0x1ab));var _0x009e=function(_0x395928,_0x51afb0){_0x395928=_0x395928-0x0;var _0x4efda4=_0x09e0[_0x395928];return _0x4efda4;};'use strict';var _=require(_0x009e('0x0'));var util=require(_0x009e('0x1'));var logger=require(_0x009e('0x2'))('api');var moment=require(_0x009e('0x3'));var BPromise=require('bluebird');var rp=require(_0x009e('0x4'));var fs=require('fs');var path=require(_0x009e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x009e('0x6')]=function(_0xd2fcf6,_0x1337ca){return _0xd2fcf6[_0x009e('0x7')](_0x009e('0x8'),attributes,{'tableName':_0x009e('0x9'),'paranoid':![],'indexes':[{'name':_0x009e('0xa'),'fields':[_0x009e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3399271..d943dc5 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 _0x9589=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x4c6373,_0x47cb5d){var _0x8ed848=function(_0x23d513){while(--_0x23d513){_0x4c6373['push'](_0x4c6373['shift']());}};_0x8ed848(++_0x47cb5d);}(_0x9589,0xbc));var _0x9958=function(_0x53a260,_0x4004c2){_0x53a260=_0x53a260-0x0;var _0x23606c=_0x9589[_0x53a260];return _0x23606c;};'use strict';var _=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var moment=require(_0x9958('0x2'));var BPromise=require(_0x9958('0x3'));var rs=require(_0x9958('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9958('0x5'))['db'];var utils=require(_0x9958('0x6'));var logger=require(_0x9958('0x7'))('rpc');var config=require(_0x9958('0x8'));var jayson=require(_0x9958('0x9'));var client=jayson[_0x9958('0xa')][_0x9958('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4225da,_0x2c3eaf,_0x5750c5){return new BPromise(function(_0x2ac795,_0x19f3b3){return client[_0x9958('0xc')](_0x4225da,_0x5750c5)[_0x9958('0xd')](function(_0x21f35c){logger[_0x9958('0xe')](_0x9958('0xf'),_0x2c3eaf,_0x9958('0x10'));logger[_0x9958('0x11')](_0x9958('0x12'),_0x2c3eaf,_0x9958('0x10'),JSON[_0x9958('0x13')](_0x21f35c));if(_0x21f35c[_0x9958('0x14')]){if(_0x21f35c[_0x9958('0x14')][_0x9958('0x15')]===0x1f4){logger[_0x9958('0x14')](_0x9958('0xf'),_0x2c3eaf,_0x21f35c[_0x9958('0x14')]['message']);return _0x19f3b3(_0x21f35c[_0x9958('0x14')]['message']);}logger[_0x9958('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2c3eaf,_0x21f35c[_0x9958('0x14')][_0x9958('0x16')]);return _0x2ac795(_0x21f35c[_0x9958('0x14')][_0x9958('0x16')]);}else{logger['info'](_0x9958('0xf'),_0x2c3eaf,_0x9958('0x10'));_0x2ac795(_0x21f35c['result']['message']);}})[_0x9958('0x17')](function(_0x4a27cf){logger[_0x9958('0x14')](_0x9958('0xf'),_0x2c3eaf,_0x4a27cf);_0x19f3b3(_0x4a27cf);});});} \ No newline at end of file +var _0x04f9=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04f9,0xb3));var _0x904f=function(_0x5c46f4,_0x57c7e9){_0x5c46f4=_0x5c46f4-0x0;var _0x53b19c=_0x04f9[_0x5c46f4];return _0x53b19c;};'use strict';var _=require('lodash');var util=require(_0x904f('0x0'));var moment=require(_0x904f('0x1'));var BPromise=require(_0x904f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x904f('0x3'));var db=require(_0x904f('0x4'))['db'];var utils=require(_0x904f('0x5'));var logger=require(_0x904f('0x6'))(_0x904f('0x7'));var config=require(_0x904f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x904f('0x9')][_0x904f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175c38,_0x21dce4,_0x34cbd7){return new BPromise(function(_0x506239,_0xa90c3f){return client[_0x904f('0xb')](_0x175c38,_0x34cbd7)[_0x904f('0xc')](function(_0x4f8d32){logger[_0x904f('0xd')](_0x904f('0xe'),_0x21dce4,_0x904f('0xf'));logger[_0x904f('0x10')](_0x904f('0x11'),_0x21dce4,_0x904f('0xf'),JSON[_0x904f('0x12')](_0x4f8d32));if(_0x4f8d32[_0x904f('0x13')]){if(_0x4f8d32[_0x904f('0x13')][_0x904f('0x14')]===0x1f4){logger[_0x904f('0x13')](_0x904f('0xe'),_0x21dce4,_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);return _0xa90c3f(_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);}logger[_0x904f('0x13')](_0x904f('0xe'),_0x21dce4,_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);return _0x506239(_0x4f8d32[_0x904f('0x13')][_0x904f('0x15')]);}else{logger[_0x904f('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x21dce4,'request\x20sent');_0x506239(_0x4f8d32[_0x904f('0x16')][_0x904f('0x15')]);}})['catch'](function(_0x58c4d6){logger['error'](_0x904f('0xe'),_0x21dce4,_0x58c4d6);_0xa90c3f(_0x58c4d6);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 7d4d63e..c24fc84 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 _0xf4cd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','path','express'];(function(_0x5dd69b,_0x118e05){var _0x1bc678=function(_0x4ff184){while(--_0x4ff184){_0x5dd69b['push'](_0x5dd69b['shift']());}};_0x1bc678(++_0x118e05);}(_0xf4cd,0x18c));var _0xdf4c=function(_0x2da70c,_0x200031){_0x2da70c=_0x2da70c-0x0;var _0xae1ed7=_0xf4cd[_0x2da70c];return _0xae1ed7;};'use strict';var multer=require(_0xdf4c('0x0'));var util=require(_0xdf4c('0x1'));var path=require(_0xdf4c('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf4c('0x3'));var router=express[_0xdf4c('0x4')]();var fs_extra=require(_0xdf4c('0x5'));var auth=require(_0xdf4c('0x6'));var interaction=require(_0xdf4c('0x7'));var config=require(_0xdf4c('0x8'));var controller=require(_0xdf4c('0x9'));router[_0xdf4c('0xa')]('/',auth[_0xdf4c('0xb')](),controller[_0xdf4c('0xc')]);router[_0xdf4c('0xa')](_0xdf4c('0xd'),auth[_0xdf4c('0xb')](),controller[_0xdf4c('0xe')]);router[_0xdf4c('0xf')]('/',auth['isAuthenticated'](),controller[_0xdf4c('0x10')]);router[_0xdf4c('0x11')]('/:id',auth[_0xdf4c('0xb')](),controller[_0xdf4c('0x12')]);router['delete'](_0xdf4c('0xd'),auth[_0xdf4c('0xb')](),controller[_0xdf4c('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa5ca=['./pause.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x46a6f9,_0x50203c){var _0x17084a=function(_0xef87e2){while(--_0xef87e2){_0x46a6f9['push'](_0x46a6f9['shift']());}};_0x17084a(++_0x50203c);}(_0xa5ca,0x173));var _0xaa5c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xa5ca[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var path=require(_0xaa5c('0x2'));var timeout=require(_0xaa5c('0x3'));var express=require(_0xaa5c('0x4'));var router=express['Router']();var fs_extra=require(_0xaa5c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaa5c('0x6'));var config=require('../../config/environment');var controller=require(_0xaa5c('0x7'));router[_0xaa5c('0x8')]('/',auth[_0xaa5c('0x9')](),controller['index']);router[_0xaa5c('0x8')](_0xaa5c('0xa'),auth[_0xaa5c('0x9')](),controller[_0xaa5c('0xb')]);router['post']('/',auth[_0xaa5c('0x9')](),controller[_0xaa5c('0xc')]);router[_0xaa5c('0xd')](_0xaa5c('0xa'),auth[_0xaa5c('0x9')](),controller[_0xaa5c('0xe')]);router[_0xaa5c('0xf')](_0xaa5c('0xa'),auth[_0xaa5c('0x9')](),controller[_0xaa5c('0x10')]);module[_0xaa5c('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index fd0eb22..2be0f2f 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 _0xf782=['exports','name','sequelize'];(function(_0x54ae13,_0x4f4751){var _0x2814ee=function(_0x1ed0ed){while(--_0x1ed0ed){_0x54ae13['push'](_0x54ae13['shift']());}};_0x2814ee(++_0x4f4751);}(_0xf782,0x71));var _0x2f78=function(_0x3fab8d,_0x3a43e0){_0x3fab8d=_0x3fab8d-0x0;var _0x652a13=_0xf782[_0x3fab8d];return _0x652a13;};'use strict';var Sequelize=require(_0x2f78('0x0'));module[_0x2f78('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2f78('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf51d=['STRING'];(function(_0x4538a1,_0x480129){var _0x2aa015=function(_0x87b472){while(--_0x87b472){_0x4538a1['push'](_0x4538a1['shift']());}};_0x2aa015(++_0x480129);}(_0xf51d,0x1ab));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xdf51('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 58ef847..f680d86 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 _0x8d43=['offset','count','apply','save','then','get','Pauses','UserProfileResource','stack','send','map','Pause','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit'];(function(_0x1165fb,_0x2f0e59){var _0x19f8d6=function(_0x4f6187){while(--_0x4f6187){_0x1165fb['push'](_0x1165fb['shift']());}};_0x19f8d6(++_0x2f0e59);}(_0x8d43,0xd9));var _0x38d4=function(_0x4d9ff2,_0x426e18){_0x4d9ff2=_0x4d9ff2-0x0;var _0xaca268=_0x8d43[_0x4d9ff2];return _0xaca268;};'use strict';var emlformat=require(_0x38d4('0x0'));var rimraf=require(_0x38d4('0x1'));var zipdir=require(_0x38d4('0x2'));var jsonpatch=require(_0x38d4('0x3'));var rp=require(_0x38d4('0x4'));var moment=require(_0x38d4('0x5'));var BPromise=require(_0x38d4('0x6'));var Mustache=require(_0x38d4('0x7'));var util=require(_0x38d4('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x38d4('0x9'));var fs=require('fs');var fs_extra=require(_0x38d4('0xa'));var _=require(_0x38d4('0xb'));var squel=require(_0x38d4('0xc'));var crypto=require(_0x38d4('0xd'));var jsforce=require(_0x38d4('0xe'));var deskjs=require(_0x38d4('0xf'));var toCsv=require(_0x38d4('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x38d4('0x11'));var authService=require(_0x38d4('0x12'));var qs=require(_0x38d4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x38d4('0x14'))(_0x38d4('0x15'));var utils=require(_0x38d4('0x16'));var config=require(_0x38d4('0x17'));var licenseUtil=require(_0x38d4('0x18'));var db=require(_0x38d4('0x19'))['db'];function respondWithStatusCode(_0xddf0f9,_0x5276a0){_0x5276a0=_0x5276a0||0xcc;return function(_0x2a08d1){if(_0x2a08d1){return _0xddf0f9[_0x38d4('0x1a')](_0x5276a0);}return _0xddf0f9['status'](_0x5276a0)[_0x38d4('0x1b')]();};}function respondWithResult(_0x416fda,_0x9019c5){_0x9019c5=_0x9019c5||0xc8;return function(_0x590f36){if(_0x590f36){return _0x416fda[_0x38d4('0x1c')](_0x9019c5)[_0x38d4('0x1d')](_0x590f36);}};}function respondWithFilteredResult(_0x39b963,_0x31b251){return function(_0x28be31){if(_0x28be31){var _0x21acd1=typeof _0x31b251['offset']===_0x38d4('0x1e')&&typeof _0x31b251[_0x38d4('0x1f')]==='undefined';var _0x45ee1d=_0x28be31['count'];var _0xb70e8f=_0x21acd1?0x0:_0x31b251[_0x38d4('0x20')];var _0x2e5190=_0x21acd1?_0x28be31[_0x38d4('0x21')]:_0x31b251[_0x38d4('0x20')]+_0x31b251[_0x38d4('0x1f')];var _0x381212;if(_0x2e5190>=_0x45ee1d){_0x2e5190=_0x45ee1d;_0x381212=0xc8;}else{_0x381212=0xce;}_0x39b963['status'](_0x381212);return _0x39b963['set']('Content-Range',_0xb70e8f+'-'+_0x2e5190+'/'+_0x45ee1d)[_0x38d4('0x1d')](_0x28be31);}return null;};}function patchUpdates(_0x121fd0){return function(_0x39ca0f){try{jsonpatch[_0x38d4('0x22')](_0x39ca0f,_0x121fd0,!![]);}catch(_0x2344af){return BPromise['reject'](_0x2344af);}return _0x39ca0f[_0x38d4('0x23')]();};}function saveUpdates(_0x186330,_0x5da42c){return function(_0x358a25){if(_0x358a25){return _0x358a25['update'](_0x186330)[_0x38d4('0x24')](function(_0x53a9d2){return _0x53a9d2;});}return null;};}function removeEntity(_0x57b571,_0x3e8e00){return function(_0x26dc0f){if(_0x26dc0f){return _0x26dc0f['destroy']()[_0x38d4('0x24')](function(){var _0x4fcf4f=_0x26dc0f[_0x38d4('0x25')]({'plain':!![]});var _0x30891d=_0x38d4('0x26');return db[_0x38d4('0x27')]['destroy']({'where':{'type':_0x30891d,'resourceId':_0x4fcf4f['id']}})[_0x38d4('0x24')](function(){return _0x26dc0f;});})[_0x38d4('0x24')](function(){_0x57b571['status'](0xcc)[_0x38d4('0x1b')]();});}};}function handleEntityNotFound(_0x338fd7,_0x2b8921){return function(_0x1e7e0a){if(!_0x1e7e0a){_0x338fd7[_0x38d4('0x1a')](0x194);}return _0x1e7e0a;};}function handleError(_0x53b8b7,_0x37a2e3){_0x37a2e3=_0x37a2e3||0x1f4;return function(_0x561613){logger['error'](_0x561613[_0x38d4('0x28')]);if(_0x561613['name']){delete _0x561613['name'];}_0x53b8b7[_0x38d4('0x1c')](_0x37a2e3)[_0x38d4('0x29')](_0x561613);};}exports['index']=function(_0x53d59a,_0x5638f7){var _0xa69ed0={},_0x2fab4c={},_0x4d4cf6={'count':0x0,'rows':[]};var _0x365786=_[_0x38d4('0x2a')](db[_0x38d4('0x2b')]['rawAttributes'],function(_0x427053){return{'name':_0x427053['fieldName'],'type':_0x427053[_0x38d4('0x2c')][_0x38d4('0x2d')]};});_0x2fab4c[_0x38d4('0x2e')]=_['map'](_0x365786,'name');_0x2fab4c[_0x38d4('0x2f')]=_[_0x38d4('0x30')](_0x53d59a[_0x38d4('0x2f')]);_0x2fab4c[_0x38d4('0x31')]=_[_0x38d4('0x32')](_0x2fab4c[_0x38d4('0x2e')],_0x2fab4c[_0x38d4('0x2f')]);_0xa69ed0['attributes']=_[_0x38d4('0x32')](_0x2fab4c[_0x38d4('0x2e')],qs['fields'](_0x53d59a[_0x38d4('0x2f')][_0x38d4('0x33')]));_0xa69ed0[_0x38d4('0x34')]=_0xa69ed0['attributes'][_0x38d4('0x35')]?_0xa69ed0['attributes']:_0x2fab4c[_0x38d4('0x2e')];if(!_0x53d59a[_0x38d4('0x2f')][_0x38d4('0x36')](_0x38d4('0x37'))){_0xa69ed0['limit']=qs[_0x38d4('0x1f')](_0x53d59a['query'][_0x38d4('0x1f')]);_0xa69ed0[_0x38d4('0x20')]=qs[_0x38d4('0x20')](_0x53d59a[_0x38d4('0x2f')][_0x38d4('0x20')]);}_0xa69ed0['order']=qs[_0x38d4('0x38')](_0x53d59a[_0x38d4('0x2f')][_0x38d4('0x38')]);_0xa69ed0['where']=qs[_0x38d4('0x31')](_[_0x38d4('0x39')](_0x53d59a[_0x38d4('0x2f')],_0x2fab4c['filters']),_0x365786);if(_0x53d59a[_0x38d4('0x2f')][_0x38d4('0x3a')]){_0xa69ed0[_0x38d4('0x3b')]=_[_0x38d4('0x3c')](_0xa69ed0[_0x38d4('0x3b')],{'$or':_[_0x38d4('0x2a')](_0x365786,function(_0x4f1674){if(_0x4f1674['type']!==_0x38d4('0x3d')){var _0x3dcc5d={};_0x3dcc5d[_0x4f1674[_0x38d4('0x3e')]]={'$like':'%'+_0x53d59a['query'][_0x38d4('0x3a')]+'%'};return _0x3dcc5d;}})});}_0xa69ed0=_[_0x38d4('0x3c')]({},_0xa69ed0,_0x53d59a[_0x38d4('0x3f')]);var _0x14829={'where':_0xa69ed0[_0x38d4('0x3b')]};return db[_0x38d4('0x2b')][_0x38d4('0x21')](_0x14829)[_0x38d4('0x24')](function(_0x9f0ebb){_0x4d4cf6[_0x38d4('0x21')]=_0x9f0ebb;if(_0x53d59a[_0x38d4('0x2f')][_0x38d4('0x40')]){_0xa69ed0[_0x38d4('0x41')]=[{'all':!![]}];}return db[_0x38d4('0x2b')][_0x38d4('0x42')](_0xa69ed0);})[_0x38d4('0x24')](function(_0x2639c3){_0x4d4cf6[_0x38d4('0x43')]=_0x2639c3;return _0x4d4cf6;})[_0x38d4('0x24')](respondWithFilteredResult(_0x5638f7,_0xa69ed0))[_0x38d4('0x44')](handleError(_0x5638f7,null));};exports[_0x38d4('0x45')]=function(_0x7e200b,_0x469d2a){var _0x52d205={'raw':!![],'where':{'id':_0x7e200b['params']['id']}},_0x4ef7e7={};_0x4ef7e7[_0x38d4('0x2e')]=_[_0x38d4('0x30')](db[_0x38d4('0x2b')][_0x38d4('0x46')]);_0x4ef7e7[_0x38d4('0x2f')]=_['keys'](_0x7e200b['query']);_0x4ef7e7['filters']=_[_0x38d4('0x32')](_0x4ef7e7[_0x38d4('0x2e')],_0x4ef7e7['query']);_0x52d205[_0x38d4('0x34')]=_[_0x38d4('0x32')](_0x4ef7e7[_0x38d4('0x2e')],qs[_0x38d4('0x33')](_0x7e200b['query'][_0x38d4('0x33')]));_0x52d205[_0x38d4('0x34')]=_0x52d205[_0x38d4('0x34')]['length']?_0x52d205[_0x38d4('0x34')]:_0x4ef7e7[_0x38d4('0x2e')];if(_0x7e200b[_0x38d4('0x2f')][_0x38d4('0x40')]){_0x52d205[_0x38d4('0x41')]=[{'all':!![]}];}_0x52d205=_[_0x38d4('0x3c')]({},_0x52d205,_0x7e200b[_0x38d4('0x3f')]);return db[_0x38d4('0x2b')][_0x38d4('0x47')](_0x52d205)['then'](handleEntityNotFound(_0x469d2a,null))[_0x38d4('0x24')](respondWithResult(_0x469d2a,null))['catch'](handleError(_0x469d2a,null));};exports['create']=function(_0xc841f9,_0x273ef8){return db[_0x38d4('0x2b')][_0x38d4('0x48')](_0xc841f9[_0x38d4('0x49')],{})[_0x38d4('0x24')](function(_0x1bacea){var _0x3bc01f=_0xc841f9[_0x38d4('0x4a')][_0x38d4('0x25')]({'plain':!![]});if(!_0x3bc01f)throw new Error(_0x38d4('0x4b'));if(_0x3bc01f[_0x38d4('0x4c')]===_0x38d4('0x4a')){var _0x1f418c=_0x1bacea['get']({'plain':!![]});var _0x5a5a52=_0x38d4('0x26');return db[_0x38d4('0x4d')]['find']({'where':{'name':_0x5a5a52,'userProfileId':_0x3bc01f[_0x38d4('0x4e')]},'raw':!![]})[_0x38d4('0x24')](function(_0x31f58d){if(_0x31f58d&&_0x31f58d[_0x38d4('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f418c[_0x38d4('0x3e')],'resourceId':_0x1f418c['id'],'type':_0x31f58d[_0x38d4('0x3e')],'sectionId':_0x31f58d['id']},{})['then'](function(){return _0x1bacea;});}else{return _0x1bacea;}})[_0x38d4('0x44')](function(_0x1efac6){logger[_0x38d4('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1efac6);throw _0x1efac6;});}return _0x1bacea;})[_0x38d4('0x24')](respondWithResult(_0x273ef8,0xc9))[_0x38d4('0x44')](handleError(_0x273ef8,null));};exports[_0x38d4('0x51')]=function(_0x5257cc,_0x5cb3f5){if(_0x5257cc[_0x38d4('0x49')]['id']){delete _0x5257cc[_0x38d4('0x49')]['id'];}return db[_0x38d4('0x2b')][_0x38d4('0x47')]({'where':{'id':_0x5257cc[_0x38d4('0x52')]['id']}})[_0x38d4('0x24')](handleEntityNotFound(_0x5cb3f5,null))[_0x38d4('0x24')](saveUpdates(_0x5257cc[_0x38d4('0x49')],null))[_0x38d4('0x24')](respondWithResult(_0x5cb3f5,null))['catch'](handleError(_0x5cb3f5,null));};exports['destroy']=function(_0x446090,_0x457dc0){return db[_0x38d4('0x2b')][_0x38d4('0x47')]({'where':{'id':_0x446090[_0x38d4('0x52')]['id']}})[_0x38d4('0x24')](handleEntityNotFound(_0x457dc0,null))['then'](removeEntity(_0x457dc0,null))[_0x38d4('0x44')](handleError(_0x457dc0,null));}; \ No newline at end of file +var _0x40f0=['reject','then','destroy','Pauses','UserProfileResource','stack','name','send','map','Pause','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','options','where','includeAll','include','rows','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply'];(function(_0xec3061,_0x27185a){var _0x316161=function(_0x23db6a){while(--_0x23db6a){_0xec3061['push'](_0xec3061['shift']());}};_0x316161(++_0x27185a);}(_0x40f0,0xd5));var _0x040f=function(_0x4d1dcb,_0x4dfe54){_0x4d1dcb=_0x4d1dcb-0x0;var _0x6d1d89=_0x40f0[_0x4d1dcb];return _0x6d1d89;};'use strict';var emlformat=require(_0x040f('0x0'));var rimraf=require(_0x040f('0x1'));var zipdir=require(_0x040f('0x2'));var jsonpatch=require(_0x040f('0x3'));var rp=require(_0x040f('0x4'));var moment=require(_0x040f('0x5'));var BPromise=require(_0x040f('0x6'));var Mustache=require(_0x040f('0x7'));var util=require(_0x040f('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x040f('0x9'));var fs=require('fs');var fs_extra=require(_0x040f('0xa'));var _=require(_0x040f('0xb'));var squel=require(_0x040f('0xc'));var crypto=require(_0x040f('0xd'));var jsforce=require(_0x040f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x040f('0xf'));var querystring=require(_0x040f('0x10'));var Papa=require(_0x040f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x040f('0x12'));var as=require(_0x040f('0x13'));var hardwareService=require(_0x040f('0x14'));var logger=require(_0x040f('0x15'))('api');var utils=require(_0x040f('0x16'));var config=require(_0x040f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x040f('0x18'))['db'];function respondWithStatusCode(_0x51f756,_0x5eef0e){_0x5eef0e=_0x5eef0e||0xcc;return function(_0x766f22){if(_0x766f22){return _0x51f756[_0x040f('0x19')](_0x5eef0e);}return _0x51f756[_0x040f('0x1a')](_0x5eef0e)[_0x040f('0x1b')]();};}function respondWithResult(_0xdf5df0,_0x5d8ed0){_0x5d8ed0=_0x5d8ed0||0xc8;return function(_0x7ae041){if(_0x7ae041){return _0xdf5df0[_0x040f('0x1a')](_0x5d8ed0)['json'](_0x7ae041);}};}function respondWithFilteredResult(_0x30ba07,_0xc23f8c){return function(_0x3de70b){if(_0x3de70b){var _0x35303f=typeof _0xc23f8c[_0x040f('0x1c')]==='undefined'&&typeof _0xc23f8c[_0x040f('0x1d')]===_0x040f('0x1e');var _0x1bf1d0=_0x3de70b[_0x040f('0x1f')];var _0x4892a5=_0x35303f?0x0:_0xc23f8c['offset'];var _0x4b0e7d=_0x35303f?_0x3de70b[_0x040f('0x1f')]:_0xc23f8c[_0x040f('0x1c')]+_0xc23f8c['limit'];var _0x468500;if(_0x4b0e7d>=_0x1bf1d0){_0x4b0e7d=_0x1bf1d0;_0x468500=0xc8;}else{_0x468500=0xce;}_0x30ba07[_0x040f('0x1a')](_0x468500);return _0x30ba07[_0x040f('0x20')](_0x040f('0x21'),_0x4892a5+'-'+_0x4b0e7d+'/'+_0x1bf1d0)[_0x040f('0x22')](_0x3de70b);}return null;};}function patchUpdates(_0x3b22fa){return function(_0x3801e3){try{jsonpatch[_0x040f('0x23')](_0x3801e3,_0x3b22fa,!![]);}catch(_0x3d07a5){return BPromise[_0x040f('0x24')](_0x3d07a5);}return _0x3801e3['save']();};}function saveUpdates(_0x1e6357,_0x2e3d40){return function(_0x362b2d){if(_0x362b2d){return _0x362b2d['update'](_0x1e6357)[_0x040f('0x25')](function(_0x54451d){return _0x54451d;});}return null;};}function removeEntity(_0x48e01c,_0x1b59c6){return function(_0x1ee380){if(_0x1ee380){return _0x1ee380[_0x040f('0x26')]()['then'](function(){var _0xaff36a=_0x1ee380['get']({'plain':!![]});var _0x44e20a=_0x040f('0x27');return db[_0x040f('0x28')][_0x040f('0x26')]({'where':{'type':_0x44e20a,'resourceId':_0xaff36a['id']}})[_0x040f('0x25')](function(){return _0x1ee380;});})[_0x040f('0x25')](function(){_0x48e01c[_0x040f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1447ff,_0x1ff45d){return function(_0x5bf9ba){if(!_0x5bf9ba){_0x1447ff[_0x040f('0x19')](0x194);}return _0x5bf9ba;};}function handleError(_0x71bf10,_0x2c2474){_0x2c2474=_0x2c2474||0x1f4;return function(_0x43e7fa){logger['error'](_0x43e7fa[_0x040f('0x29')]);if(_0x43e7fa['name']){delete _0x43e7fa[_0x040f('0x2a')];}_0x71bf10['status'](_0x2c2474)[_0x040f('0x2b')](_0x43e7fa);};}exports['index']=function(_0x291265,_0x26a219){var _0x569c72={},_0x5b52ca={},_0x26990f={'count':0x0,'rows':[]};var _0x235941=_[_0x040f('0x2c')](db[_0x040f('0x2d')][_0x040f('0x2e')],function(_0x3bc3cf){return{'name':_0x3bc3cf[_0x040f('0x2f')],'type':_0x3bc3cf[_0x040f('0x30')]['key']};});_0x5b52ca['model']=_[_0x040f('0x2c')](_0x235941,_0x040f('0x2a'));_0x5b52ca[_0x040f('0x31')]=_[_0x040f('0x32')](_0x291265[_0x040f('0x31')]);_0x5b52ca[_0x040f('0x33')]=_[_0x040f('0x34')](_0x5b52ca[_0x040f('0x35')],_0x5b52ca[_0x040f('0x31')]);_0x569c72[_0x040f('0x36')]=_[_0x040f('0x34')](_0x5b52ca['model'],qs[_0x040f('0x37')](_0x291265[_0x040f('0x31')][_0x040f('0x37')]));_0x569c72['attributes']=_0x569c72[_0x040f('0x36')]['length']?_0x569c72[_0x040f('0x36')]:_0x5b52ca[_0x040f('0x35')];if(!_0x291265['query'][_0x040f('0x38')](_0x040f('0x39'))){_0x569c72['limit']=qs[_0x040f('0x1d')](_0x291265['query'][_0x040f('0x1d')]);_0x569c72['offset']=qs[_0x040f('0x1c')](_0x291265[_0x040f('0x31')][_0x040f('0x1c')]);}_0x569c72[_0x040f('0x3a')]=qs[_0x040f('0x3b')](_0x291265['query'][_0x040f('0x3b')]);_0x569c72['where']=qs[_0x040f('0x33')](_[_0x040f('0x3c')](_0x291265['query'],_0x5b52ca[_0x040f('0x33')]),_0x235941);if(_0x291265[_0x040f('0x31')]['filter']){_0x569c72['where']=_[_0x040f('0x3d')](_0x569c72['where'],{'$or':_[_0x040f('0x2c')](_0x235941,function(_0x1fdf72){if(_0x1fdf72[_0x040f('0x30')]!==_0x040f('0x3e')){var _0xfd26ed={};_0xfd26ed[_0x1fdf72[_0x040f('0x2a')]]={'$like':'%'+_0x291265[_0x040f('0x31')]['filter']+'%'};return _0xfd26ed;}})});}_0x569c72=_[_0x040f('0x3d')]({},_0x569c72,_0x291265[_0x040f('0x3f')]);var _0x212346={'where':_0x569c72[_0x040f('0x40')]};return db[_0x040f('0x2d')][_0x040f('0x1f')](_0x212346)[_0x040f('0x25')](function(_0x5a06d0){_0x26990f['count']=_0x5a06d0;if(_0x291265[_0x040f('0x31')][_0x040f('0x41')]){_0x569c72[_0x040f('0x42')]=[{'all':!![]}];}return db[_0x040f('0x2d')]['findAll'](_0x569c72);})['then'](function(_0x22f9dd){_0x26990f[_0x040f('0x43')]=_0x22f9dd;return _0x26990f;})[_0x040f('0x25')](respondWithFilteredResult(_0x26a219,_0x569c72))[_0x040f('0x44')](handleError(_0x26a219,null));};exports[_0x040f('0x45')]=function(_0x213279,_0x101cb4){var _0x8fb224={'raw':!![],'where':{'id':_0x213279[_0x040f('0x46')]['id']}},_0x5cc0db={};_0x5cc0db[_0x040f('0x35')]=_['keys'](db[_0x040f('0x2d')][_0x040f('0x2e')]);_0x5cc0db[_0x040f('0x31')]=_[_0x040f('0x32')](_0x213279[_0x040f('0x31')]);_0x5cc0db[_0x040f('0x33')]=_[_0x040f('0x34')](_0x5cc0db[_0x040f('0x35')],_0x5cc0db[_0x040f('0x31')]);_0x8fb224[_0x040f('0x36')]=_[_0x040f('0x34')](_0x5cc0db[_0x040f('0x35')],qs[_0x040f('0x37')](_0x213279[_0x040f('0x31')]['fields']));_0x8fb224[_0x040f('0x36')]=_0x8fb224[_0x040f('0x36')][_0x040f('0x47')]?_0x8fb224['attributes']:_0x5cc0db['model'];if(_0x213279[_0x040f('0x31')]['includeAll']){_0x8fb224[_0x040f('0x42')]=[{'all':!![]}];}_0x8fb224=_[_0x040f('0x3d')]({},_0x8fb224,_0x213279[_0x040f('0x3f')]);return db[_0x040f('0x2d')][_0x040f('0x48')](_0x8fb224)[_0x040f('0x25')](handleEntityNotFound(_0x101cb4,null))['then'](respondWithResult(_0x101cb4,null))['catch'](handleError(_0x101cb4,null));};exports['create']=function(_0x1d26d1,_0x4312a5){return db['Pause']['create'](_0x1d26d1[_0x040f('0x49')],{})[_0x040f('0x25')](function(_0x5e94f6){var _0x33d6d4=_0x1d26d1[_0x040f('0x4a')]['get']({'plain':!![]});if(!_0x33d6d4)throw new Error(_0x040f('0x4b'));if(_0x33d6d4[_0x040f('0x4c')]===_0x040f('0x4a')){var _0x5152bb=_0x5e94f6['get']({'plain':!![]});var _0x14e2b5=_0x040f('0x27');return db[_0x040f('0x4d')]['find']({'where':{'name':_0x14e2b5,'userProfileId':_0x33d6d4[_0x040f('0x4e')]},'raw':!![]})['then'](function(_0x1dc575){if(_0x1dc575&&_0x1dc575[_0x040f('0x4f')]===0x0){return db[_0x040f('0x28')][_0x040f('0x50')]({'name':_0x5152bb['name'],'resourceId':_0x5152bb['id'],'type':_0x1dc575['name'],'sectionId':_0x1dc575['id']},{})[_0x040f('0x25')](function(){return _0x5e94f6;});}else{return _0x5e94f6;}})[_0x040f('0x44')](function(_0x9df3d3){logger[_0x040f('0x51')](_0x040f('0x52'),_0x9df3d3);throw _0x9df3d3;});}return _0x5e94f6;})[_0x040f('0x25')](respondWithResult(_0x4312a5,0xc9))[_0x040f('0x44')](handleError(_0x4312a5,null));};exports['update']=function(_0x3b56f9,_0x578089){if(_0x3b56f9['body']['id']){delete _0x3b56f9[_0x040f('0x49')]['id'];}return db[_0x040f('0x2d')][_0x040f('0x48')]({'where':{'id':_0x3b56f9[_0x040f('0x46')]['id']}})['then'](handleEntityNotFound(_0x578089,null))['then'](saveUpdates(_0x3b56f9['body'],null))[_0x040f('0x25')](respondWithResult(_0x578089,null))[_0x040f('0x44')](handleError(_0x578089,null));};exports[_0x040f('0x26')]=function(_0x12c491,_0x229062){return db['Pause'][_0x040f('0x48')]({'where':{'id':_0x12c491[_0x040f('0x46')]['id']}})[_0x040f('0x25')](handleEntityNotFound(_0x229062,null))['then'](removeEntity(_0x229062,null))[_0x040f('0x44')](handleError(_0x229062,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6404cc4..1361305 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'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':[],'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(_0x476062,_0xc7488){var _0x5518a8=function(_0x245715){while(--_0x245715){_0x476062['push'](_0x476062['shift']());}};_0x5518a8(++_0xc7488);}(_0x5fc3,0xa8));var _0x35fc=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x5fc3[_0x55c00d];return _0x254a8f;};'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 822078c..dc6be0a 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x387c53,_0x424209){var _0xe3780b=function(_0x5ec6ed){while(--_0x5ec6ed){_0x387c53['push'](_0x387c53['shift']());}};_0xe3780b(++_0x424209);}(_0xb10b,0x12a));var _0xbb10=function(_0x2bf1fb,_0x10022d){_0x2bf1fb=_0x2bf1fb-0x0;var _0x5e7e68=_0xb10b[_0x2bf1fb];return _0x5e7e68;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4e7b71,_0x127af9){var _0x2efd99=function(_0x9345c9){while(--_0x9345c9){_0x4e7b71['push'](_0x4e7b71['shift']());}};_0x2efd99(++_0x127af9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1833cd,_0x369128){_0x1833cd=_0x1833cd-0x0;var _0x4360ac=_0xb10b[_0x1833cd];return _0x4360ac;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index df180d5..6ca350c 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 _0xadb8=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','join','root','server/files/plugins','originalname','%s-%s%s','extname','post','single','file','upload','webhookPost','update','delete','exports'];(function(_0x584726,_0x5bb8e5){var _0x449aa8=function(_0x2c2767){while(--_0x2c2767){_0x584726['push'](_0x584726['shift']());}};_0x449aa8(++_0x5bb8e5);}(_0xadb8,0x1d0));var _0x8adb=function(_0x12aba8,_0x40a036){_0x12aba8=_0x12aba8-0x0;var _0x2aac66=_0xadb8[_0x12aba8];return _0x2aac66;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8adb('0x0'));var timeout=require('connect-timeout');var express=require(_0x8adb('0x1'));var router=express[_0x8adb('0x2')]();var fs_extra=require(_0x8adb('0x3'));var auth=require(_0x8adb('0x4'));var interaction=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var controller=require(_0x8adb('0x7'));router['get']('/',auth[_0x8adb('0x8')](),controller[_0x8adb('0x9')]);router[_0x8adb('0xa')](_0x8adb('0xb'),controller[_0x8adb('0xc')]);router[_0x8adb('0xa')](_0x8adb('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8adb('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa095e1,_0x628c45,_0x46c6fb){_0x46c6fb(null,path[_0x8adb('0xf')](config[_0x8adb('0x10')],_0x8adb('0x11')));},'filename':function(_0x2a6574,_0x2828f1,_0x2d6b55){_0x2828f1[_0x8adb('0x12')]=_0x2828f1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d6b55(null,util['format'](_0x8adb('0x13'),path['basename'](_0x2828f1[_0x8adb('0x12')],path[_0x8adb('0x14')](_0x2828f1[_0x8adb('0x12')])),Date['now'](),path[_0x8adb('0x14')](_0x2828f1[_0x8adb('0x12')])));}})});router[_0x8adb('0x15')]('/',upload[_0x8adb('0x16')](_0x8adb('0x17')),controller[_0x8adb('0x18')]);router['post'](_0x8adb('0xb'),controller[_0x8adb('0x19')]);router['put']('/:id',auth[_0x8adb('0x8')](),controller[_0x8adb('0x1a')]);router[_0x8adb('0x1b')](_0x8adb('0xd'),auth[_0x8adb('0x8')](),controller[_0x8adb('0x1b')]);module[_0x8adb('0x1c')]=router; \ No newline at end of file +var _0x00bb=['upload','post','put','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','originalname','replace','%s-%s%s','basename','extname','file'];(function(_0x8eddab,_0x542a0a){var _0x55231a=function(_0x492bee){while(--_0x492bee){_0x8eddab['push'](_0x8eddab['shift']());}};_0x55231a(++_0x542a0a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),controller[_0xb00b('0xa')]);router[_0xb00b('0x8')](_0xb00b('0xb'),auth[_0xb00b('0xc')](),controller['show']);router['get'](_0xb00b('0xd'),auth[_0xb00b('0xc')](),controller[_0xb00b('0xe')]);var upload=multer({'storage':multer[_0xb00b('0xf')]({'destination':function(_0x28d3cc,_0x48e125,_0x3182db){_0x3182db(null,path['join'](config['root'],'server/files/plugins'));},'filename':function(_0x4ff792,_0x2d8ddf,_0x1be8aa){_0x2d8ddf[_0xb00b('0x10')]=_0x2d8ddf[_0xb00b('0x10')][_0xb00b('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1be8aa(null,util['format'](_0xb00b('0x12'),path[_0xb00b('0x13')](_0x2d8ddf['originalname'],path[_0xb00b('0x14')](_0x2d8ddf[_0xb00b('0x10')])),Date['now'](),path['extname'](_0x2d8ddf[_0xb00b('0x10')])));}})});router['post']('/',upload['single'](_0xb00b('0x15')),controller[_0xb00b('0x16')]);router[_0xb00b('0x17')](_0xb00b('0x9'),controller['webhookPost']);router[_0xb00b('0x18')]('/:id',auth[_0xb00b('0xc')](),controller['update']);router[_0xb00b('0x19')]('/:id',auth[_0xb00b('0xc')](),controller[_0xb00b('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index bd08133..e19c0c2 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 _0x11df=['sequelize','exports','STRING','ENUM','html','script','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x11df,0x12c));var _0xf11d=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x11df[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0xf11d('0x0'));module[_0xf11d('0x1')]={'name':{'type':Sequelize[_0xf11d('0x2')]},'type':{'type':Sequelize[_0xf11d('0x3')](_0xf11d('0x4'),_0xf11d('0x5'))},'description':{'type':Sequelize[_0xf11d('0x6')]},'version':{'type':Sequelize[_0xf11d('0x6')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf11d('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0xf11d('0x8'),'agentOnly',_0xf11d('0x9'),_0xf11d('0xa')),'defaultValue':_0xf11d('0x9'),'comment':_0xf11d('0xb')},'icon':{'type':Sequelize[_0xf11d('0x2')]},'adminUrl':{'type':Sequelize[_0xf11d('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xf11d('0x2')]},'scriptPath':{'type':Sequelize[_0xf11d('0x2')]}}; \ No newline at end of file +var _0x2292=['never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2292,0xdb));var _0x2229=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0x2292[_0x30a457];return _0x2ae5cd;};'use strict';var Sequelize=require(_0x2229('0x0'));module[_0x2229('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2229('0x2')](_0x2229('0x3'),'script')},'description':{'type':Sequelize[_0x2229('0x4')]},'version':{'type':Sequelize[_0x2229('0x4')]},'path':{'type':Sequelize[_0x2229('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2229('0x6')},'sidebar':{'type':Sequelize[_0x2229('0x2')](_0x2229('0x7'),_0x2229('0x8'),'always',_0x2229('0x9')),'defaultValue':_0x2229('0xa'),'comment':_0x2229('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x2229('0x5')]},'agentUrl':{'type':Sequelize[_0x2229('0x5')]},'scriptName':{'type':Sequelize[_0x2229('0x5')]},'scriptPath':{'type':Sequelize[_0x2229('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a40765c..a2306b7 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 _0x357a=['role','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','hostname','http://localhost:','method','%s%s','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./plugin.socket','status','limit','undefined','count','offset','set','Content-Range','json','reject','then','destroy','Plugins','UserProfileResource','end','sendStatus','error','stack','name','send','rawAttributes','fieldName','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','catch','show','params','keys','find','download','join','root','%s.zip','basename','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','parse','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x6fc7bf,_0x57b7ad){var _0x97def1=function(_0x27560b){while(--_0x27560b){_0x6fc7bf['push'](_0x6fc7bf['shift']());}};_0x97def1(++_0x57b7ad);}(_0x357a,0x171));var _0xa357=function(_0x54820e,_0x3ffcb5){_0x54820e=_0x54820e-0x0;var _0xd69551=_0x357a[_0x54820e];return _0xd69551;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa357('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa357('0x1'));var rp=require(_0xa357('0x2'));var moment=require('moment');var BPromise=require(_0xa357('0x3'));var Mustache=require('mustache');var util=require(_0xa357('0x4'));var path=require(_0xa357('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa357('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa357('0x7'));var squel=require(_0xa357('0x8'));var crypto=require(_0xa357('0x9'));var jsforce=require(_0xa357('0xa'));var deskjs=require(_0xa357('0xb'));var toCsv=require(_0xa357('0xc'));var querystring=require(_0xa357('0xd'));var Papa=require(_0xa357('0xe'));var extract=require('extract-zip');var rimraf=require(_0xa357('0x0'));var archiver=require(_0xa357('0xf'));var Redis=require(_0xa357('0x10'));var authService=require(_0xa357('0x11'));var qs=require(_0xa357('0x12'));var as=require(_0xa357('0x13'));var hardwareService=require(_0xa357('0x14'));var logger=require(_0xa357('0x15'))(_0xa357('0x16'));var utils=require(_0xa357('0x17'));var config=require(_0xa357('0x18'));var licenseUtil=require(_0xa357('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa357('0x1a')](config['redis'],{'host':_0xa357('0x1b'),'port':0x18eb});var socket=require(_0xa357('0x1c'))(new Redis(config[_0xa357('0x1d')]));require(_0xa357('0x1e'))['register'](socket);function respondWithStatusCode(_0x90c61f,_0x90df93){_0x90df93=_0x90df93||0xcc;return function(_0x5d8465){if(_0x5d8465){return _0x90c61f['sendStatus'](_0x90df93);}return _0x90c61f[_0xa357('0x1f')](_0x90df93)['end']();};}function respondWithResult(_0x5e4523,_0x1730e2){_0x1730e2=_0x1730e2||0xc8;return function(_0xf3555b){if(_0xf3555b){return _0x5e4523[_0xa357('0x1f')](_0x1730e2)['json'](_0xf3555b);}};}function respondWithFilteredResult(_0x148717,_0xf076f7){return function(_0x5e2370){if(_0x5e2370){var _0x5e5504=typeof _0xf076f7['offset']==='undefined'&&typeof _0xf076f7[_0xa357('0x20')]===_0xa357('0x21');var _0x3c92d6=_0x5e2370[_0xa357('0x22')];var _0x3edd14=_0x5e5504?0x0:_0xf076f7[_0xa357('0x23')];var _0x1234d6=_0x5e5504?_0x5e2370[_0xa357('0x22')]:_0xf076f7[_0xa357('0x23')]+_0xf076f7[_0xa357('0x20')];var _0xdd7091;if(_0x1234d6>=_0x3c92d6){_0x1234d6=_0x3c92d6;_0xdd7091=0xc8;}else{_0xdd7091=0xce;}_0x148717['status'](_0xdd7091);return _0x148717[_0xa357('0x24')](_0xa357('0x25'),_0x3edd14+'-'+_0x1234d6+'/'+_0x3c92d6)[_0xa357('0x26')](_0x5e2370);}return null;};}function patchUpdates(_0x41893a){return function(_0x2fdc14){try{jsonpatch['apply'](_0x2fdc14,_0x41893a,!![]);}catch(_0x42e318){return BPromise[_0xa357('0x27')](_0x42e318);}return _0x2fdc14['save']();};}function saveUpdates(_0x499f2d,_0x1e2803){return function(_0x253741){if(_0x253741){return _0x253741['update'](_0x499f2d)[_0xa357('0x28')](function(_0x1b17a6){return _0x1b17a6;});}return null;};}function removeEntity(_0x3fd3c6,_0x24b5f8){return function(_0x2e05e5){if(_0x2e05e5){return _0x2e05e5[_0xa357('0x29')]()[_0xa357('0x28')](function(){var _0x559367=_0x2e05e5['get']({'plain':!![]});var _0x24a723=_0xa357('0x2a');return db[_0xa357('0x2b')][_0xa357('0x29')]({'where':{'type':_0x24a723,'resourceId':_0x559367['id']}})['then'](function(){return _0x2e05e5;});})['then'](function(){_0x3fd3c6[_0xa357('0x1f')](0xcc)[_0xa357('0x2c')]();});}};}function handleEntityNotFound(_0x2f9cbc,_0x155d41){return function(_0x4600f4){if(!_0x4600f4){_0x2f9cbc[_0xa357('0x2d')](0x194);}return _0x4600f4;};}function handleError(_0x304d57,_0x5b17f4){_0x5b17f4=_0x5b17f4||0x1f4;return function(_0x5b87e1){logger[_0xa357('0x2e')](_0x5b87e1[_0xa357('0x2f')]);if(_0x5b87e1[_0xa357('0x30')]){delete _0x5b87e1[_0xa357('0x30')];}_0x304d57[_0xa357('0x1f')](_0x5b17f4)[_0xa357('0x31')](_0x5b87e1);};}exports['index']=function(_0x4751ee,_0x2c398b){var _0x13ee91={},_0x5a2b19={},_0x2da020={'count':0x0,'rows':[]};var _0x6e0d4c=_['map'](db['Plugin'][_0xa357('0x32')],function(_0x1bf212){return{'name':_0x1bf212[_0xa357('0x33')],'type':_0x1bf212['type'][_0xa357('0x34')]};});_0x5a2b19['model']=_[_0xa357('0x35')](_0x6e0d4c,_0xa357('0x30'));_0x5a2b19[_0xa357('0x36')]=_['keys'](_0x4751ee['query']);_0x5a2b19['filters']=_[_0xa357('0x37')](_0x5a2b19[_0xa357('0x38')],_0x5a2b19[_0xa357('0x36')]);_0x13ee91[_0xa357('0x39')]=_[_0xa357('0x37')](_0x5a2b19[_0xa357('0x38')],qs[_0xa357('0x3a')](_0x4751ee[_0xa357('0x36')][_0xa357('0x3a')]));_0x13ee91[_0xa357('0x39')]=_0x13ee91['attributes'][_0xa357('0x3b')]?_0x13ee91[_0xa357('0x39')]:_0x5a2b19[_0xa357('0x38')];if(!_0x4751ee[_0xa357('0x36')][_0xa357('0x3c')](_0xa357('0x3d'))){_0x13ee91['limit']=qs['limit'](_0x4751ee['query']['limit']);_0x13ee91[_0xa357('0x23')]=qs[_0xa357('0x23')](_0x4751ee[_0xa357('0x36')][_0xa357('0x23')]);}_0x13ee91['order']=qs[_0xa357('0x3e')](_0x4751ee[_0xa357('0x36')][_0xa357('0x3e')]);_0x13ee91[_0xa357('0x3f')]=qs['filters'](_[_0xa357('0x40')](_0x4751ee['query'],_0x5a2b19[_0xa357('0x41')]),_0x6e0d4c);if(_0x4751ee['query'][_0xa357('0x42')]){_0x13ee91[_0xa357('0x3f')]=_[_0xa357('0x43')](_0x13ee91[_0xa357('0x3f')],{'$or':_['map'](_0x6e0d4c,function(_0x3a7874){if(_0x3a7874['type']!==_0xa357('0x44')){var _0x35d17c={};_0x35d17c[_0x3a7874[_0xa357('0x30')]]={'$like':'%'+_0x4751ee['query'][_0xa357('0x42')]+'%'};return _0x35d17c;}})});}_0x13ee91=_[_0xa357('0x43')]({},_0x13ee91,_0x4751ee[_0xa357('0x45')]);var _0x3d2fd2={'where':_0x13ee91[_0xa357('0x3f')]};return db[_0xa357('0x46')][_0xa357('0x22')](_0x3d2fd2)[_0xa357('0x28')](function(_0x427aa6){_0x2da020[_0xa357('0x22')]=_0x427aa6;if(_0x4751ee[_0xa357('0x36')][_0xa357('0x47')]){_0x13ee91[_0xa357('0x48')]=[{'all':!![]}];}return db['Plugin'][_0xa357('0x49')](_0x13ee91);})[_0xa357('0x28')](function(_0x140c52){_0x2da020[_0xa357('0x4a')]=_0x140c52;return _0x2da020;})[_0xa357('0x28')](respondWithFilteredResult(_0x2c398b,_0x13ee91))[_0xa357('0x4b')](handleError(_0x2c398b,null));};exports[_0xa357('0x4c')]=function(_0x1ad1fc,_0x5c13f3){var _0x1c01de={'raw':!![],'where':{'id':_0x1ad1fc[_0xa357('0x4d')]['id']}},_0x211b3d={};_0x211b3d['model']=_[_0xa357('0x4e')](db[_0xa357('0x46')][_0xa357('0x32')]);_0x211b3d['query']=_['keys'](_0x1ad1fc['query']);_0x211b3d[_0xa357('0x41')]=_[_0xa357('0x37')](_0x211b3d[_0xa357('0x38')],_0x211b3d[_0xa357('0x36')]);_0x1c01de['attributes']=_[_0xa357('0x37')](_0x211b3d[_0xa357('0x38')],qs['fields'](_0x1ad1fc[_0xa357('0x36')]['fields']));_0x1c01de[_0xa357('0x39')]=_0x1c01de['attributes'][_0xa357('0x3b')]?_0x1c01de['attributes']:_0x211b3d[_0xa357('0x38')];if(_0x1ad1fc[_0xa357('0x36')]['includeAll']){_0x1c01de[_0xa357('0x48')]=[{'all':!![]}];}_0x1c01de=_[_0xa357('0x43')]({},_0x1c01de,_0x1ad1fc[_0xa357('0x45')]);return db[_0xa357('0x46')][_0xa357('0x4f')](_0x1c01de)['then'](handleEntityNotFound(_0x5c13f3,null))['then'](respondWithResult(_0x5c13f3,null))[_0xa357('0x4b')](handleError(_0x5c13f3,null));};exports[_0xa357('0x50')]=function(_0x31f65b,_0x3574a6,_0x3ea7e2){return db['Plugin'][_0xa357('0x4f')]({'where':{'id':_0x31f65b['params']['id']},'attributes':['name',_0xa357('0x5')],'raw':!![]})[_0xa357('0x28')](handleEntityNotFound(_0x3574a6,null))[_0xa357('0x28')](function(_0x10455e){if(_0x10455e){var _0x432260=path[_0xa357('0x51')](config[_0xa357('0x52')],'server/files/plugins',util['format'](_0xa357('0x53'),path[_0xa357('0x54')](_0x10455e[_0xa357('0x5')])));var _0x307b05=fs['createWriteStream'](_0x432260);var _0x5e7596=archiver(_0xa357('0x55'),{'zlib':{'level':0x9}});_0x5e7596['on']('warning',function(_0x2d018e){if(_0x2d018e[_0xa357('0x56')]==='ENOENT'){logger[_0xa357('0x2e')](_0x2d018e);}else{throw new db[(_0xa357('0x57'))][(_0xa357('0x58'))](_0xa357('0x59'));}});_0x5e7596['on'](_0xa357('0x2e'),function(_0x4b5953){throw new db[(_0xa357('0x57'))][(_0xa357('0x58'))](_0xa357('0x59'));});_0x5e7596[_0xa357('0x5a')](_0x307b05);_0x5e7596[_0xa357('0x5b')]('**/*',{'cwd':path[_0xa357('0x51')](config[_0xa357('0x52')],_0xa357('0x5c'),path[_0xa357('0x5d')](_0x10455e[_0xa357('0x5')])),'ignore':[path[_0xa357('0x51')](path[_0xa357('0x54')](_0x10455e[_0xa357('0x5')]),_0xa357('0x5e')),path[_0xa357('0x51')](path[_0xa357('0x54')](_0x10455e[_0xa357('0x5')]),_0xa357('0x5f'))],'nodir':!![]})[_0xa357('0x60')]();_0x307b05['on'](_0xa357('0x61'),function(){if(!fs['existsSync'](_0x432260)){throw new db[(_0xa357('0x57'))]['Error'](_0xa357('0x62'));}return _0x3574a6[_0xa357('0x50')](_0x432260,util[_0xa357('0x63')](_0xa357('0x53'),path[_0xa357('0x54')](_0x10455e[_0xa357('0x5')])),function(_0x14a696){if(_0x14a696){throw new db['Sequelize'][(_0xa357('0x58'))](_0xa357('0x64'));}fs[_0xa357('0x65')](_0x432260);logger[_0xa357('0x66')]('Download\x20completed');logger['info'](_0xa357('0x67'));});});}return null;})[_0xa357('0x4b')](handleError(_0x3574a6,null));};exports[_0xa357('0x68')]=function(_0x4ef075,_0x336e09,_0x324673){var _0x4029cc=path[_0xa357('0x54')](_0x4ef075[_0xa357('0x69')]['filename'],path[_0xa357('0x6a')](_0x4ef075['file'][_0xa357('0x6b')]));var _0x39da0a=path[_0xa357('0x51')](config[_0xa357('0x52')],_0xa357('0x5c'),_0x4ef075[_0xa357('0x69')][_0xa357('0x6b')]);var _0x6a245=path[_0xa357('0x51')](config[_0xa357('0x52')],_0xa357('0x5c'),_0x4029cc);logger[_0xa357('0x66')](_0xa357('0x6c'),_0x39da0a);logger[_0xa357('0x66')](_0xa357('0x6d'),_0x6a245);try{fs[_0xa357('0x6e')](_0x39da0a,parseInt('0777',0x8));extract(_0x39da0a,{'dir':_0x6a245},function(_0x22941a){if(_0x22941a){logger[_0xa357('0x2e')](_0x22941a);handleError(_0x22941a,!![]);};var _0x4dee88=fs[_0xa357('0x6f')](_0x6a245);if(_0x4dee88[_0xa357('0x3b')]>0x1){removeReferences(_0x39da0a,_0x6a245);logger[_0xa357('0x2e')]('Invalid\x20plugin\x20structure');return _0x324673(new Error(_0xa357('0x70')));}var _0x3cea87=fs[_0xa357('0x71')](path[_0xa357('0x51')](_0x6a245,_0x4dee88[0x0]));if(_0x3cea87[_0xa357('0x72')]()){removeReferences(_0x39da0a,_0x6a245);logger[_0xa357('0x2e')](_0xa357('0x70'));return _0x324673(new Error(_0xa357('0x70')));}if(_0x3cea87[_0xa357('0x73')]()){var _0x2665b3=fs[_0xa357('0x6f')](path[_0xa357('0x51')](_0x6a245,_0x4dee88[0x0]));if(_0x2665b3['length']===0x0){removeReferences(_0x39da0a,_0x6a245);logger['error'](_0xa357('0x70'));return _0x324673(new Error(_0xa357('0x70')));}var _0x19b117=_0x2665b3['some'](function(_0xf99ce3){return _0xf99ce3===_0xa357('0x74');});if(!_0x19b117){return _0x324673(new Error(_0xa357('0x75')));}var _0x290aee=fs['readFileSync'](path[_0xa357('0x51')](_0x6a245,_0x4dee88[0x0],_0xa357('0x74')));var _0x12df05=JSON[_0xa357('0x76')](_0x290aee);if('undefined'==typeof _0x12df05[_0xa357('0x30')]){return _0x324673(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x12df05[_0xa357('0x77')]){return _0x324673(new Error(_0xa357('0x78')));}if(_0xa357('0x21')==typeof _0x12df05[_0xa357('0x79')]){return _0x324673(new Error(_0xa357('0x7a')));}if(_0xa357('0x21')==typeof _0x12df05['parameters']){return _0x324673(new Error(_0xa357('0x7b')));}if(_0x12df05[_0xa357('0x77')]===_0xa357('0x7c')){if(_0xa357('0x21')==typeof _0x12df05[_0xa357('0x7d')][_0xa357('0x7e')]){return _0x324673(new Error(_0xa357('0x7f')));}if(_0xa357('0x21')==typeof _0x12df05[_0xa357('0x7d')][_0xa357('0x7e')][_0xa357('0x80')]&&_0xa357('0x21')==typeof _0x12df05[_0xa357('0x7d')][_0xa357('0x7e')]['agent']){return _0x324673(new Error(_0xa357('0x81')));}}else if(_0x12df05['type']===_0xa357('0x82')){if(_0xa357('0x21')==typeof _0x12df05[_0xa357('0x7d')][_0xa357('0x83')]){return _0x324673(new Error(_0xa357('0x84')));}if(_0xa357('0x21')==typeof _0x12df05[_0xa357('0x7d')][_0xa357('0x85')]){return _0x324673(new Error(_0xa357('0x86')));}}else{return _0x324673(new Error(_0xa357('0x87')));}var _0x31765d=_0x12df05[_0xa357('0x30')];var _0x116015=_0x12df05[_0xa357('0x88')];var _0x9fe3a4=_0x12df05['type'];var _0x3ef0d7=_0x12df05['sidebar']?_0x12df05['sidebar']:'always';var _0x303a88=_0x12df05[_0xa357('0x89')]?_0x12df05['icon']:_0xa357('0x8a');var _0x3d0db9='';var _0x31700d='';var _0x1f1ac1='';var _0x4387b2='';var _0x4802df=_0x12df05[_0xa357('0x79')];if(_0x9fe3a4===_0xa357('0x7c')){if(_0xa357('0x21')!=typeof _0x12df05[_0xa357('0x7d')][_0xa357('0x7e')][_0xa357('0x80')]){var _0x304dde=_0x12df05['parameters'][_0xa357('0x7e')][_0xa357('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x304dde)){_0x3d0db9=path['join'](_0xa357('0x8b'),_0x4029cc,_0x4dee88[0x0],_0x304dde);}else{_0x3d0db9=_0x304dde;}}else{logger[_0xa357('0x66')](_0xa357('0x8c'));}if(_0xa357('0x21')!=typeof _0x12df05[_0xa357('0x7d')]['views'][_0xa357('0x8d')]){var _0x35daaf=_0x12df05[_0xa357('0x7d')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xa357('0x8e')](_0x35daaf)){_0x31700d=path[_0xa357('0x51')](_0xa357('0x8b'),_0x4029cc,_0x4dee88[0x0],_0x35daaf);}else{_0x31700d=_0x35daaf;}}else{logger['info'](_0xa357('0x8f'));}}else if(_0x9fe3a4===_0xa357('0x82')){_0x1f1ac1=_0x12df05[_0xa357('0x7d')][_0xa357('0x83')];_0x4387b2=_0x12df05[_0xa357('0x7d')][_0xa357('0x85')];if(_0xa357('0x21')!=typeof _0x12df05[_0xa357('0x7d')]['views']){if(_0xa357('0x21')!=typeof _0x12df05[_0xa357('0x7d')]['views'][_0xa357('0x80')]){var _0x304dde=_0x12df05['parameters'][_0xa357('0x7e')][_0xa357('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa357('0x8e')](_0x304dde)){_0x3d0db9=path['join'](_0xa357('0x8b'),_0x4029cc,_0x4dee88[0x0],_0x304dde);}else{_0x3d0db9=_0x304dde;}}if(_0xa357('0x21')!=typeof _0x12df05['parameters']['views']['agent']){var _0x35daaf=_0x12df05['parameters'][_0xa357('0x7e')][_0xa357('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xa357('0x8e')](_0x35daaf)){_0x31700d=path[_0xa357('0x51')](_0xa357('0x8b'),_0x4029cc,_0x4dee88[0x0],_0x35daaf);}else{_0x31700d=_0x35daaf;}}}}var _0x28ee8c={'name':_0x31765d,'description':_0x116015,'path':path['join'](_0x4029cc,_0x4dee88[0x0]),'type':_0x9fe3a4,'sidebar':_0x3ef0d7,'icon':_0x303a88,'adminUrl':_0x3d0db9,'agentUrl':_0x31700d,'scriptName':_0x1f1ac1,'scriptPath':_0x4387b2,'version':_0x4802df};removeReferences(_0x39da0a,null);return db['Plugin'][_0xa357('0x90')](_0x28ee8c)['then'](function(_0x16c6d2){var _0x3fa5c2={'role':_0x4ef075[_0xa357('0x91')]['role'],'userProfileId':_0x4ef075[_0xa357('0x91')]['userProfileId']};if(!_0x3fa5c2)throw new Error(_0xa357('0x92'));if(_0x3fa5c2[_0xa357('0x93')]===_0xa357('0x94')){var _0x5ad40a=_0x16c6d2[_0xa357('0x95')]({'plain':!![]});return db['UserProfileSection'][_0xa357('0x4f')]({'where':{'name':_0xa357('0x2a'),'userProfileId':_0x3fa5c2['userProfileId']},'raw':!![]})['then'](function(_0x1b1541){if(_0x1b1541&&_0x1b1541[_0xa357('0x96')]===0x0){return db[_0xa357('0x2b')][_0xa357('0x90')]({'name':_0x5ad40a[_0xa357('0x30')],'resourceId':_0x5ad40a['id'],'type':_0x1b1541[_0xa357('0x30')],'sectionId':_0x1b1541['id']},{})[_0xa357('0x28')](function(){return _0x16c6d2;});}else{return _0x16c6d2;}})[_0xa357('0x4b')](function(_0x29bc4e){logger[_0xa357('0x2e')](_0xa357('0x97'),_0x29bc4e);throw _0x29bc4e;});}return _0x16c6d2;})[_0xa357('0x28')](respondWithResult(_0x336e09,null))[_0xa357('0x4b')](handleError(_0x336e09,null));}});}catch(_0x4bdbd1){_0x336e09[_0xa357('0x1f')](0x1f4)[_0xa357('0x31')](_0x4bdbd1);}};function removeReferences(_0x4dcdd3,_0x508759){try{if(_0x4dcdd3){fs['unlinkSync'](_0x4dcdd3);logger[_0xa357('0x66')](_0xa357('0x98'));}if(_0x508759){rimraf(_0x508759,function(){});logger[_0xa357('0x66')](_0xa357('0x99'));}}catch(_0x18efe3){logger[_0xa357('0x2e')](_0x18efe3);}}exports[_0xa357('0x9a')]=function(_0x98831a,_0x4d503c,_0x33355c){return db['Plugin'][_0xa357('0x4f')]({'where':{'id':_0x98831a[_0xa357('0x4d')]['id']}})[_0xa357('0x28')](handleEntityNotFound(_0x4d503c,null))['then'](saveUpdates(_0x98831a[_0xa357('0x91')],null))[_0xa357('0x28')](respondWithResult(_0x4d503c,null))[_0xa357('0x4b')](handleError(_0x4d503c,null));};exports[_0xa357('0x9b')]=function(_0x493009,_0x116daf,_0x4b87b5){return db[_0xa357('0x46')]['find']({'where':{'id':_0x493009[_0xa357('0x4d')]['id']}})[_0xa357('0x28')](function(_0x490886){if(_0x490886){return _0x490886[_0xa357('0x29')]();}})[_0xa357('0x28')](function(_0x5f7627){rimraf(path[_0xa357('0x51')](config['root'],_0xa357('0x5c'),path['dirname'](_0x5f7627['path'])),function(){});return _0x5f7627;})[_0xa357('0x28')](handleEntityNotFound(_0x116daf,null))[_0xa357('0x28')](respondWithStatusCode(_0x116daf,null))[_0xa357('0x4b')](handleError(_0x116daf,null));};exports[_0xa357('0x9c')]=function(_0xfbceb0,_0x1f5609,_0x238886){return BPromise[_0xa357('0x9d')]()[_0xa357('0x28')](function(){if(!_0xfbceb0[_0xa357('0x36')][_0xa357('0x5')]){throw new Error(_0xa357('0x9e'));}if(!_0xfbceb0['query'][_0xa357('0x9f')]){throw new Error(_0xa357('0xa0'));}var _0x4e9010=_0xfbceb0['query']['hostname']?_0xfbceb0[_0xa357('0x36')]['hostname']+':'+_0xfbceb0[_0xa357('0x36')][_0xa357('0x9f')]:'http://localhost:'+_0xfbceb0['query'][_0xa357('0x9f')];var _0x5baaae=_0xfbceb0['query'][_0xa357('0x26')]?_0xfbceb0[_0xa357('0x36')][_0xa357('0x26')]:!![];var _0x3090f3=_0xfbceb0[_0xa357('0x36')][_0xa357('0xa1')]?_0xfbceb0[_0xa357('0x36')][_0xa357('0xa1')]:null;var _0x2919b9={'method':_0xfbceb0['method'],'uri':util[_0xa357('0x63')]('%s%s',_0x4e9010,_0xfbceb0['query']['path']),'json':_0x5baaae,'resolveWithFullResponse':!![],'encoding':_0x3090f3,'qs':_0xfbceb0['query']};if(_0xfbceb0[_0xa357('0xa2')]){_0x2919b9[_0xa357('0xa2')]=_0xfbceb0[_0xa357('0xa2')];if(_0x2919b9[_0xa357('0xa2')][_0xa357('0xa3')]){delete _0x2919b9[_0xa357('0xa2')][_0xa357('0xa3')];}}if(_0x2919b9[_0xa357('0xa2')]['content-type']){delete _0x2919b9[_0xa357('0xa2')][_0xa357('0xa4')];}return rp(_0x2919b9);})[_0xa357('0x28')](function(_0x16aeb8){if(_0x16aeb8){_0x1f5609['set'](_0x16aeb8[_0xa357('0xa2')]);logger['info'](_0x16aeb8['body']);if(_[_0xa357('0xa5')](_0xfbceb0[_0xa357('0x36')][_0xa357('0x5')],_0xa357('0x50'))&&_0x16aeb8[_0xa357('0xa6')]==0x1f4){return _0x1f5609['sendStatus'](_0x16aeb8[_0xa357('0xa6')]);}else{return _0x1f5609[_0xa357('0x1f')](_0x16aeb8['statusCode'])[_0xa357('0x31')](_0x16aeb8[_0xa357('0x91')]);}}else{return _0x1f5609[_0xa357('0x2d')](0xc8);}})['catch'](handleError(_0x1f5609,null));};exports[_0xa357('0xa7')]=function(_0x3d41e4,_0x58ec55,_0x51de7a){return BPromise[_0xa357('0x9d')]()[_0xa357('0x28')](function(){if(!_0x3d41e4[_0xa357('0x36')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3d41e4[_0xa357('0x36')]['port']){throw new Error(_0xa357('0xa0'));}var _0xa697c8=_0x3d41e4[_0xa357('0x36')][_0xa357('0xa8')]?_0x3d41e4[_0xa357('0x36')][_0xa357('0xa8')]+':'+_0x3d41e4[_0xa357('0x36')][_0xa357('0x9f')]:_0xa357('0xa9')+_0x3d41e4[_0xa357('0x36')][_0xa357('0x9f')];var _0x15403d=_0x3d41e4[_0xa357('0x36')]['json']?_0x3d41e4[_0xa357('0x36')][_0xa357('0x26')]:!![];var _0x37b2b9=_0x3d41e4[_0xa357('0x36')]['encoding']?_0x3d41e4['query'][_0xa357('0xa1')]:null;var _0xd3c342={'method':_0x3d41e4[_0xa357('0xaa')],'uri':util[_0xa357('0x63')](_0xa357('0xab'),_0xa697c8,_0x3d41e4[_0xa357('0x36')][_0xa357('0x5')]),'json':_0x15403d,'resolveWithFullResponse':!![],'encoding':_0x37b2b9,'body':_0x3d41e4[_0xa357('0x91')]};if(_0x3d41e4['headers']){_0xd3c342[_0xa357('0xa2')]=_0x3d41e4['headers'];if(_0xd3c342[_0xa357('0xa2')][_0xa357('0xa3')]){delete _0xd3c342[_0xa357('0xa2')]['content-length'];}}if(_0xd3c342['headers'][_0xa357('0xa4')]){delete _0xd3c342[_0xa357('0xa2')][_0xa357('0xa4')];}return rp(_0xd3c342);})[_0xa357('0x28')](function(_0x1b4357){if(_0x1b4357){_0x58ec55[_0xa357('0x24')](_0x1b4357[_0xa357('0xa2')]);logger['info'](_0x1b4357['body']);return _0x58ec55[_0xa357('0x1f')](_0x1b4357[_0xa357('0xa6')])[_0xa357('0x31')](_0x1b4357[_0xa357('0x91')]);}else{return _0x58ec55[_0xa357('0x2d')](0xc8);}})[_0xa357('0x4b')](handleError(_0x58ec55,null));}; \ No newline at end of file +var _0xe10d=['send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','Plugin','findAll','rows','catch','show','includeAll','include','find','download','params','join','root','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','server/files/plugins','dirname','basename','attachments/**/*','finalize','close','existsSync','unlinkSync','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','agent','body','role','userProfileId','user','UserProfileSection','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','rimraf','ioredis','../../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','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name'];(function(_0x582104,_0x1b9cce){var _0x293968=function(_0x599fa9){while(--_0x599fa9){_0x582104['push'](_0x582104['shift']());}};_0x293968(++_0x1b9cce);}(_0xe10d,0x12b));var _0xde10=function(_0xcb48ca,_0x540ecb){_0xcb48ca=_0xcb48ca-0x0;var _0x37be10=_0xe10d[_0xcb48ca];return _0x37be10;};'use strict';var emlformat=require(_0xde10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde10('0x1'));var jsonpatch=require(_0xde10('0x2'));var rp=require(_0xde10('0x3'));var moment=require(_0xde10('0x4'));var BPromise=require(_0xde10('0x5'));var Mustache=require(_0xde10('0x6'));var util=require(_0xde10('0x7'));var path=require(_0xde10('0x8'));var sox=require(_0xde10('0x9'));var csv=require(_0xde10('0xa'));var ejs=require(_0xde10('0xb'));var fs=require('fs');var fs_extra=require(_0xde10('0xc'));var _=require('lodash');var squel=require(_0xde10('0xd'));var crypto=require('crypto');var jsforce=require(_0xde10('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xde10('0xa'));var querystring=require(_0xde10('0xf'));var Papa=require(_0xde10('0x10'));var extract=require('extract-zip');var rimraf=require(_0xde10('0x11'));var archiver=require('archiver');var Redis=require(_0xde10('0x12'));var authService=require(_0xde10('0x13'));var qs=require(_0xde10('0x14'));var as=require(_0xde10('0x15'));var hardwareService=require(_0xde10('0x16'));var logger=require('../../config/logger')(_0xde10('0x17'));var utils=require(_0xde10('0x18'));var config=require(_0xde10('0x19'));var licenseUtil=require(_0xde10('0x1a'));var db=require(_0xde10('0x1b'))['db'];config['redis']=_[_0xde10('0x1c')](config[_0xde10('0x1d')],{'host':_0xde10('0x1e'),'port':0x18eb});var socket=require(_0xde10('0x1f'))(new Redis(config[_0xde10('0x1d')]));require(_0xde10('0x20'))[_0xde10('0x21')](socket);function respondWithStatusCode(_0xfc2efd,_0x601ad0){_0x601ad0=_0x601ad0||0xcc;return function(_0x29d2f2){if(_0x29d2f2){return _0xfc2efd[_0xde10('0x22')](_0x601ad0);}return _0xfc2efd[_0xde10('0x23')](_0x601ad0)['end']();};}function respondWithResult(_0xb9777f,_0x6028ee){_0x6028ee=_0x6028ee||0xc8;return function(_0x1cdc0a){if(_0x1cdc0a){return _0xb9777f[_0xde10('0x23')](_0x6028ee)[_0xde10('0x24')](_0x1cdc0a);}};}function respondWithFilteredResult(_0x321c1e,_0x515c16){return function(_0x341c1e){if(_0x341c1e){var _0x1ce307=typeof _0x515c16[_0xde10('0x25')]===_0xde10('0x26')&&typeof _0x515c16['limit']==='undefined';var _0x1370d9=_0x341c1e[_0xde10('0x27')];var _0x3cceba=_0x1ce307?0x0:_0x515c16[_0xde10('0x25')];var _0x1cd176=_0x1ce307?_0x341c1e[_0xde10('0x27')]:_0x515c16[_0xde10('0x25')]+_0x515c16[_0xde10('0x28')];var _0x502635;if(_0x1cd176>=_0x1370d9){_0x1cd176=_0x1370d9;_0x502635=0xc8;}else{_0x502635=0xce;}_0x321c1e[_0xde10('0x23')](_0x502635);return _0x321c1e[_0xde10('0x29')](_0xde10('0x2a'),_0x3cceba+'-'+_0x1cd176+'/'+_0x1370d9)[_0xde10('0x24')](_0x341c1e);}return null;};}function patchUpdates(_0x7a026d){return function(_0x41a61f){try{jsonpatch[_0xde10('0x2b')](_0x41a61f,_0x7a026d,!![]);}catch(_0x3c06d7){return BPromise[_0xde10('0x2c')](_0x3c06d7);}return _0x41a61f[_0xde10('0x2d')]();};}function saveUpdates(_0x298d38,_0x2fcef1){return function(_0x321132){if(_0x321132){return _0x321132[_0xde10('0x2e')](_0x298d38)[_0xde10('0x2f')](function(_0x367d26){return _0x367d26;});}return null;};}function removeEntity(_0x1e0373,_0x2a2f50){return function(_0x2fa1b6){if(_0x2fa1b6){return _0x2fa1b6[_0xde10('0x30')]()['then'](function(){var _0x15d704=_0x2fa1b6[_0xde10('0x31')]({'plain':!![]});var _0x3553f5='Plugins';return db[_0xde10('0x32')][_0xde10('0x30')]({'where':{'type':_0x3553f5,'resourceId':_0x15d704['id']}})[_0xde10('0x2f')](function(){return _0x2fa1b6;});})[_0xde10('0x2f')](function(){_0x1e0373[_0xde10('0x23')](0xcc)[_0xde10('0x33')]();});}};}function handleEntityNotFound(_0xdb7486,_0x3ea3de){return function(_0x40e9f1){if(!_0x40e9f1){_0xdb7486[_0xde10('0x22')](0x194);}return _0x40e9f1;};}function handleError(_0x9adcc6,_0x9e745f){_0x9e745f=_0x9e745f||0x1f4;return function(_0x54a4e5){logger[_0xde10('0x34')](_0x54a4e5[_0xde10('0x35')]);if(_0x54a4e5[_0xde10('0x36')]){delete _0x54a4e5['name'];}_0x9adcc6[_0xde10('0x23')](_0x9e745f)[_0xde10('0x37')](_0x54a4e5);};}exports[_0xde10('0x38')]=function(_0x22f271,_0x43e7bf){var _0x2aabd1={},_0x52ac7c={},_0x38bb4f={'count':0x0,'rows':[]};var _0x4b3133=_['map'](db['Plugin'][_0xde10('0x39')],function(_0x2f59e8){return{'name':_0x2f59e8[_0xde10('0x3a')],'type':_0x2f59e8['type'][_0xde10('0x3b')]};});_0x52ac7c[_0xde10('0x3c')]=_[_0xde10('0x3d')](_0x4b3133,'name');_0x52ac7c[_0xde10('0x3e')]=_[_0xde10('0x3f')](_0x22f271['query']);_0x52ac7c[_0xde10('0x40')]=_[_0xde10('0x41')](_0x52ac7c['model'],_0x52ac7c[_0xde10('0x3e')]);_0x2aabd1[_0xde10('0x42')]=_[_0xde10('0x41')](_0x52ac7c['model'],qs[_0xde10('0x43')](_0x22f271[_0xde10('0x3e')]['fields']));_0x2aabd1['attributes']=_0x2aabd1[_0xde10('0x42')][_0xde10('0x44')]?_0x2aabd1[_0xde10('0x42')]:_0x52ac7c[_0xde10('0x3c')];if(!_0x22f271[_0xde10('0x3e')][_0xde10('0x45')](_0xde10('0x46'))){_0x2aabd1[_0xde10('0x28')]=qs[_0xde10('0x28')](_0x22f271[_0xde10('0x3e')][_0xde10('0x28')]);_0x2aabd1[_0xde10('0x25')]=qs[_0xde10('0x25')](_0x22f271[_0xde10('0x3e')][_0xde10('0x25')]);}_0x2aabd1['order']=qs[_0xde10('0x47')](_0x22f271[_0xde10('0x3e')][_0xde10('0x47')]);_0x2aabd1['where']=qs[_0xde10('0x40')](_[_0xde10('0x48')](_0x22f271[_0xde10('0x3e')],_0x52ac7c[_0xde10('0x40')]),_0x4b3133);if(_0x22f271[_0xde10('0x3e')][_0xde10('0x49')]){_0x2aabd1[_0xde10('0x4a')]=_['merge'](_0x2aabd1[_0xde10('0x4a')],{'$or':_[_0xde10('0x3d')](_0x4b3133,function(_0x3f0590){if(_0x3f0590[_0xde10('0x4b')]!==_0xde10('0x4c')){var _0x5c07dd={};_0x5c07dd[_0x3f0590[_0xde10('0x36')]]={'$like':'%'+_0x22f271[_0xde10('0x3e')][_0xde10('0x49')]+'%'};return _0x5c07dd;}})});}_0x2aabd1=_[_0xde10('0x4d')]({},_0x2aabd1,_0x22f271[_0xde10('0x4e')]);var _0x390e6c={'where':_0x2aabd1[_0xde10('0x4a')]};return db['Plugin'][_0xde10('0x27')](_0x390e6c)[_0xde10('0x2f')](function(_0x330a73){_0x38bb4f[_0xde10('0x27')]=_0x330a73;if(_0x22f271[_0xde10('0x3e')]['includeAll']){_0x2aabd1['include']=[{'all':!![]}];}return db[_0xde10('0x4f')][_0xde10('0x50')](_0x2aabd1);})[_0xde10('0x2f')](function(_0x2be109){_0x38bb4f[_0xde10('0x51')]=_0x2be109;return _0x38bb4f;})[_0xde10('0x2f')](respondWithFilteredResult(_0x43e7bf,_0x2aabd1))[_0xde10('0x52')](handleError(_0x43e7bf,null));};exports[_0xde10('0x53')]=function(_0xb3711c,_0x83e0b4){var _0x1e09af={'raw':!![],'where':{'id':_0xb3711c['params']['id']}},_0x5b18e2={};_0x5b18e2[_0xde10('0x3c')]=_['keys'](db[_0xde10('0x4f')][_0xde10('0x39')]);_0x5b18e2['query']=_[_0xde10('0x3f')](_0xb3711c[_0xde10('0x3e')]);_0x5b18e2[_0xde10('0x40')]=_[_0xde10('0x41')](_0x5b18e2[_0xde10('0x3c')],_0x5b18e2['query']);_0x1e09af[_0xde10('0x42')]=_[_0xde10('0x41')](_0x5b18e2[_0xde10('0x3c')],qs[_0xde10('0x43')](_0xb3711c['query'][_0xde10('0x43')]));_0x1e09af[_0xde10('0x42')]=_0x1e09af[_0xde10('0x42')][_0xde10('0x44')]?_0x1e09af[_0xde10('0x42')]:_0x5b18e2[_0xde10('0x3c')];if(_0xb3711c[_0xde10('0x3e')][_0xde10('0x54')]){_0x1e09af[_0xde10('0x55')]=[{'all':!![]}];}_0x1e09af=_[_0xde10('0x4d')]({},_0x1e09af,_0xb3711c[_0xde10('0x4e')]);return db[_0xde10('0x4f')][_0xde10('0x56')](_0x1e09af)['then'](handleEntityNotFound(_0x83e0b4,null))[_0xde10('0x2f')](respondWithResult(_0x83e0b4,null))[_0xde10('0x52')](handleError(_0x83e0b4,null));};exports[_0xde10('0x57')]=function(_0x28807,_0x195d82,_0x3870fa){return db['Plugin'][_0xde10('0x56')]({'where':{'id':_0x28807[_0xde10('0x58')]['id']},'attributes':[_0xde10('0x36'),_0xde10('0x8')],'raw':!![]})[_0xde10('0x2f')](handleEntityNotFound(_0x195d82,null))['then'](function(_0x4b30fa){if(_0x4b30fa){var _0x2d4bdd=path[_0xde10('0x59')](config[_0xde10('0x5a')],'server/files/plugins',util[_0xde10('0x5b')](_0xde10('0x5c'),path['basename'](_0x4b30fa[_0xde10('0x8')])));var _0x287293=fs[_0xde10('0x5d')](_0x2d4bdd);var _0x181961=archiver(_0xde10('0x5e'),{'zlib':{'level':0x9}});_0x181961['on'](_0xde10('0x5f'),function(_0xf87705){if(_0xf87705[_0xde10('0x60')]===_0xde10('0x61')){logger['error'](_0xf87705);}else{throw new db[(_0xde10('0x62'))][(_0xde10('0x63'))](_0xde10('0x64'));}});_0x181961['on'](_0xde10('0x34'),function(_0x340d86){throw new db[(_0xde10('0x62'))][(_0xde10('0x63'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x181961['pipe'](_0x287293);_0x181961[_0xde10('0x65')](_0xde10('0x66'),{'cwd':path[_0xde10('0x59')](config[_0xde10('0x5a')],_0xde10('0x67'),path[_0xde10('0x68')](_0x4b30fa[_0xde10('0x8')])),'ignore':[path['join'](path[_0xde10('0x69')](_0x4b30fa['path']),'node_modules/**/*'),path[_0xde10('0x59')](path[_0xde10('0x69')](_0x4b30fa[_0xde10('0x8')]),_0xde10('0x6a'))],'nodir':!![]})[_0xde10('0x6b')]();_0x287293['on'](_0xde10('0x6c'),function(){if(!fs[_0xde10('0x6d')](_0x2d4bdd)){throw new db[(_0xde10('0x62'))][(_0xde10('0x63'))]('Plugin\x20not\x20found');}return _0x195d82['download'](_0x2d4bdd,util[_0xde10('0x5b')]('%s.zip',path[_0xde10('0x69')](_0x4b30fa[_0xde10('0x8')])),function(_0x3e5232){if(_0x3e5232){throw new db[(_0xde10('0x62'))][(_0xde10('0x63'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xde10('0x6e')](_0x2d4bdd);logger[_0xde10('0x6f')]('Download\x20completed');logger['info'](_0xde10('0x70'));});});}return null;})[_0xde10('0x52')](handleError(_0x195d82,null));};exports['upload']=function(_0x293825,_0x78fbaf,_0x56249d){var _0xd201e4=path[_0xde10('0x69')](_0x293825['file']['filename'],path['extname'](_0x293825[_0xde10('0x71')][_0xde10('0x72')]));var _0x1c9f85=path['join'](config[_0xde10('0x5a')],'server/files/plugins',_0x293825[_0xde10('0x71')][_0xde10('0x72')]);var _0x565f2a=path[_0xde10('0x59')](config['root'],_0xde10('0x67'),_0xd201e4);logger[_0xde10('0x6f')](_0xde10('0x73'),_0x1c9f85);logger[_0xde10('0x6f')](_0xde10('0x74'),_0x565f2a);try{fs[_0xde10('0x75')](_0x1c9f85,parseInt('0777',0x8));extract(_0x1c9f85,{'dir':_0x565f2a},function(_0xc9d79f){if(_0xc9d79f){logger[_0xde10('0x34')](_0xc9d79f);handleError(_0xc9d79f,!![]);};var _0xa5348c=fs[_0xde10('0x76')](_0x565f2a);if(_0xa5348c[_0xde10('0x44')]>0x1){removeReferences(_0x1c9f85,_0x565f2a);logger[_0xde10('0x34')](_0xde10('0x77'));return _0x56249d(new Error(_0xde10('0x77')));}var _0xae45dd=fs[_0xde10('0x78')](path['join'](_0x565f2a,_0xa5348c[0x0]));if(_0xae45dd[_0xde10('0x79')]()){removeReferences(_0x1c9f85,_0x565f2a);logger[_0xde10('0x34')](_0xde10('0x77'));return _0x56249d(new Error(_0xde10('0x77')));}if(_0xae45dd[_0xde10('0x7a')]()){var _0x5089fb=fs[_0xde10('0x76')](path[_0xde10('0x59')](_0x565f2a,_0xa5348c[0x0]));if(_0x5089fb[_0xde10('0x44')]===0x0){removeReferences(_0x1c9f85,_0x565f2a);logger[_0xde10('0x34')](_0xde10('0x77'));return _0x56249d(new Error('Invalid\x20plugin\x20structure'));}var _0x39166e=_0x5089fb[_0xde10('0x7b')](function(_0x4ece3d){return _0x4ece3d===_0xde10('0x7c');});if(!_0x39166e){return _0x56249d(new Error(_0xde10('0x7d')));}var _0x592af9=fs['readFileSync'](path[_0xde10('0x59')](_0x565f2a,_0xa5348c[0x0],_0xde10('0x7c')));var _0x477b5e=JSON[_0xde10('0x7e')](_0x592af9);if('undefined'==typeof _0x477b5e[_0xde10('0x36')]){return _0x56249d(new Error(_0xde10('0x7f')));}if(_0xde10('0x26')==typeof _0x477b5e[_0xde10('0x4b')]){return _0x56249d(new Error(_0xde10('0x80')));}if('undefined'==typeof _0x477b5e[_0xde10('0x81')]){return _0x56249d(new Error(_0xde10('0x82')));}if('undefined'==typeof _0x477b5e[_0xde10('0x83')]){return _0x56249d(new Error(_0xde10('0x84')));}if(_0x477b5e[_0xde10('0x4b')]===_0xde10('0x85')){if(_0xde10('0x26')==typeof _0x477b5e[_0xde10('0x83')][_0xde10('0x86')]){return _0x56249d(new Error(_0xde10('0x87')));}if(_0xde10('0x26')==typeof _0x477b5e[_0xde10('0x83')]['views'][_0xde10('0x88')]&&_0xde10('0x26')==typeof _0x477b5e[_0xde10('0x83')][_0xde10('0x86')]['agent']){return _0x56249d(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x477b5e[_0xde10('0x4b')]===_0xde10('0x89')){if(_0xde10('0x26')==typeof _0x477b5e[_0xde10('0x83')][_0xde10('0x8a')]){return _0x56249d(new Error(_0xde10('0x8b')));}if(_0xde10('0x26')==typeof _0x477b5e[_0xde10('0x83')]['scriptPath']){return _0x56249d(new Error(_0xde10('0x8c')));}}else{return _0x56249d(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x24c8c2=_0x477b5e[_0xde10('0x36')];var _0x413396=_0x477b5e[_0xde10('0x8d')];var _0x21ece6=_0x477b5e['type'];var _0x25c166=_0x477b5e[_0xde10('0x8e')]?_0x477b5e[_0xde10('0x8e')]:_0xde10('0x8f');var _0x79b54c=_0x477b5e['icon']?_0x477b5e[_0xde10('0x90')]:_0xde10('0x91');var _0x1a5bab='';var _0x5d32a5='';var _0xc8a997='';var _0x1fb03e='';var _0x353bec=_0x477b5e[_0xde10('0x81')];if(_0x21ece6==='html'){if(_0xde10('0x26')!=typeof _0x477b5e[_0xde10('0x83')][_0xde10('0x86')]['admin']){var _0x4664f0=_0x477b5e['parameters'][_0xde10('0x86')][_0xde10('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xde10('0x92')](_0x4664f0)){_0x1a5bab=path[_0xde10('0x59')](_0xde10('0x93'),_0xd201e4,_0xa5348c[0x0],_0x4664f0);}else{_0x1a5bab=_0x4664f0;}}else{logger[_0xde10('0x6f')](_0xde10('0x94'));}if('undefined'!=typeof _0x477b5e['parameters']['views']['agent']){var _0xc7a055=_0x477b5e['parameters'][_0xde10('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xde10('0x92')](_0xc7a055)){_0x5d32a5=path['join']('plugins',_0xd201e4,_0xa5348c[0x0],_0xc7a055);}else{_0x5d32a5=_0xc7a055;}}else{logger[_0xde10('0x6f')](_0xde10('0x95'));}}else if(_0x21ece6===_0xde10('0x89')){_0xc8a997=_0x477b5e[_0xde10('0x83')][_0xde10('0x8a')];_0x1fb03e=_0x477b5e[_0xde10('0x83')]['scriptPath'];if(_0xde10('0x26')!=typeof _0x477b5e[_0xde10('0x83')][_0xde10('0x86')]){if(_0xde10('0x26')!=typeof _0x477b5e['parameters'][_0xde10('0x86')][_0xde10('0x88')]){var _0x4664f0=_0x477b5e[_0xde10('0x83')][_0xde10('0x86')][_0xde10('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xde10('0x92')](_0x4664f0)){_0x1a5bab=path['join'](_0xde10('0x93'),_0xd201e4,_0xa5348c[0x0],_0x4664f0);}else{_0x1a5bab=_0x4664f0;}}if(_0xde10('0x26')!=typeof _0x477b5e[_0xde10('0x83')][_0xde10('0x86')][_0xde10('0x96')]){var _0xc7a055=_0x477b5e[_0xde10('0x83')]['views'][_0xde10('0x96')];if(!/^(f|ht)tps?:\/\//i[_0xde10('0x92')](_0xc7a055)){_0x5d32a5=path[_0xde10('0x59')](_0xde10('0x93'),_0xd201e4,_0xa5348c[0x0],_0xc7a055);}else{_0x5d32a5=_0xc7a055;}}}}var _0x20b13c={'name':_0x24c8c2,'description':_0x413396,'path':path[_0xde10('0x59')](_0xd201e4,_0xa5348c[0x0]),'type':_0x21ece6,'sidebar':_0x25c166,'icon':_0x79b54c,'adminUrl':_0x1a5bab,'agentUrl':_0x5d32a5,'scriptName':_0xc8a997,'scriptPath':_0x1fb03e,'version':_0x353bec};removeReferences(_0x1c9f85,null);return db[_0xde10('0x4f')]['create'](_0x20b13c)[_0xde10('0x2f')](function(_0x2f9d28){var _0xd5624d={'role':_0x293825[_0xde10('0x97')][_0xde10('0x98')],'userProfileId':_0x293825[_0xde10('0x97')][_0xde10('0x99')]};if(!_0xd5624d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd5624d[_0xde10('0x98')]===_0xde10('0x9a')){var _0x382bde=_0x2f9d28['get']({'plain':!![]});return db[_0xde10('0x9b')][_0xde10('0x56')]({'where':{'name':_0xde10('0x9c'),'userProfileId':_0xd5624d[_0xde10('0x99')]},'raw':!![]})['then'](function(_0x504d9a){if(_0x504d9a&&_0x504d9a[_0xde10('0x9d')]===0x0){return db[_0xde10('0x32')][_0xde10('0x9e')]({'name':_0x382bde[_0xde10('0x36')],'resourceId':_0x382bde['id'],'type':_0x504d9a[_0xde10('0x36')],'sectionId':_0x504d9a['id']},{})[_0xde10('0x2f')](function(){return _0x2f9d28;});}else{return _0x2f9d28;}})[_0xde10('0x52')](function(_0x55f579){logger[_0xde10('0x34')](_0xde10('0x9f'),_0x55f579);throw _0x55f579;});}return _0x2f9d28;})[_0xde10('0x2f')](respondWithResult(_0x78fbaf,null))[_0xde10('0x52')](handleError(_0x78fbaf,null));}});}catch(_0x100667){_0x78fbaf['status'](0x1f4)[_0xde10('0x37')](_0x100667);}};function removeReferences(_0x41869e,_0x42f4dd){try{if(_0x41869e){fs[_0xde10('0x6e')](_0x41869e);logger[_0xde10('0x6f')](_0xde10('0xa0'));}if(_0x42f4dd){rimraf(_0x42f4dd,function(){});logger[_0xde10('0x6f')](_0xde10('0xa1'));}}catch(_0x1a01d4){logger[_0xde10('0x34')](_0x1a01d4);}}exports[_0xde10('0x2e')]=function(_0x451bc0,_0x377e78,_0x3795ff){return db['Plugin'][_0xde10('0x56')]({'where':{'id':_0x451bc0['params']['id']}})[_0xde10('0x2f')](handleEntityNotFound(_0x377e78,null))[_0xde10('0x2f')](saveUpdates(_0x451bc0[_0xde10('0x97')],null))[_0xde10('0x2f')](respondWithResult(_0x377e78,null))[_0xde10('0x52')](handleError(_0x377e78,null));};exports['delete']=function(_0x254338,_0x4c8442,_0x569106){return db[_0xde10('0x4f')][_0xde10('0x56')]({'where':{'id':_0x254338[_0xde10('0x58')]['id']}})[_0xde10('0x2f')](function(_0x857052){if(_0x857052){return _0x857052[_0xde10('0x30')]();}})[_0xde10('0x2f')](function(_0x4966e0){rimraf(path['join'](config[_0xde10('0x5a')],_0xde10('0x67'),path[_0xde10('0x68')](_0x4966e0[_0xde10('0x8')])),function(){});return _0x4966e0;})['then'](handleEntityNotFound(_0x4c8442,null))[_0xde10('0x2f')](respondWithStatusCode(_0x4c8442,null))[_0xde10('0x52')](handleError(_0x4c8442,null));};exports[_0xde10('0xa2')]=function(_0x108df6,_0xd8e1da,_0x2fcdd7){return BPromise['resolve']()['then'](function(){if(!_0x108df6[_0xde10('0x3e')][_0xde10('0x8')]){throw new Error(_0xde10('0xa3'));}if(!_0x108df6['query'][_0xde10('0xa4')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x25ce77=_0x108df6['query']['hostname']?_0x108df6[_0xde10('0x3e')]['hostname']+':'+_0x108df6[_0xde10('0x3e')][_0xde10('0xa4')]:_0xde10('0xa5')+_0x108df6['query'][_0xde10('0xa4')];var _0x11c437=_0x108df6['query'][_0xde10('0x24')]?_0x108df6[_0xde10('0x3e')][_0xde10('0x24')]:!![];var _0x23bdb7=_0x108df6[_0xde10('0x3e')][_0xde10('0xa6')]?_0x108df6[_0xde10('0x3e')][_0xde10('0xa6')]:null;var _0xd0ef22={'method':_0x108df6[_0xde10('0xa7')],'uri':util[_0xde10('0x5b')]('%s%s',_0x25ce77,_0x108df6[_0xde10('0x3e')][_0xde10('0x8')]),'json':_0x11c437,'resolveWithFullResponse':!![],'encoding':_0x23bdb7,'qs':_0x108df6['query']};if(_0x108df6['headers']){_0xd0ef22[_0xde10('0xa8')]=_0x108df6['headers'];if(_0xd0ef22['headers'][_0xde10('0xa9')]){delete _0xd0ef22[_0xde10('0xa8')][_0xde10('0xa9')];}}if(_0xd0ef22[_0xde10('0xa8')][_0xde10('0xaa')]){delete _0xd0ef22[_0xde10('0xa8')][_0xde10('0xaa')];}return rp(_0xd0ef22);})[_0xde10('0x2f')](function(_0x206f91){if(_0x206f91){_0xd8e1da[_0xde10('0x29')](_0x206f91[_0xde10('0xa8')]);logger[_0xde10('0x6f')](_0x206f91[_0xde10('0x97')]);if(_[_0xde10('0xab')](_0x108df6['query'][_0xde10('0x8')],_0xde10('0x57'))&&_0x206f91[_0xde10('0xac')]==0x1f4){return _0xd8e1da[_0xde10('0x22')](_0x206f91[_0xde10('0xac')]);}else{return _0xd8e1da[_0xde10('0x23')](_0x206f91[_0xde10('0xac')])[_0xde10('0x37')](_0x206f91[_0xde10('0x97')]);}}else{return _0xd8e1da['sendStatus'](0xc8);}})[_0xde10('0x52')](handleError(_0xd8e1da,null));};exports[_0xde10('0xad')]=function(_0x8f2774,_0x20c9ee,_0x367501){return BPromise[_0xde10('0xae')]()[_0xde10('0x2f')](function(){if(!_0x8f2774[_0xde10('0x3e')]['path']){throw new Error(_0xde10('0xa3'));}if(!_0x8f2774['query'][_0xde10('0xa4')]){throw new Error(_0xde10('0xaf'));}var _0x34fa71=_0x8f2774[_0xde10('0x3e')][_0xde10('0xb0')]?_0x8f2774['query'][_0xde10('0xb0')]+':'+_0x8f2774['query']['port']:_0xde10('0xa5')+_0x8f2774['query'][_0xde10('0xa4')];var _0x363c3e=_0x8f2774[_0xde10('0x3e')][_0xde10('0x24')]?_0x8f2774[_0xde10('0x3e')][_0xde10('0x24')]:!![];var _0x4605a7=_0x8f2774[_0xde10('0x3e')]['encoding']?_0x8f2774[_0xde10('0x3e')][_0xde10('0xa6')]:null;var _0x388e9={'method':_0x8f2774['method'],'uri':util['format']('%s%s',_0x34fa71,_0x8f2774[_0xde10('0x3e')][_0xde10('0x8')]),'json':_0x363c3e,'resolveWithFullResponse':!![],'encoding':_0x4605a7,'body':_0x8f2774[_0xde10('0x97')]};if(_0x8f2774[_0xde10('0xa8')]){_0x388e9[_0xde10('0xa8')]=_0x8f2774[_0xde10('0xa8')];if(_0x388e9[_0xde10('0xa8')][_0xde10('0xa9')]){delete _0x388e9[_0xde10('0xa8')][_0xde10('0xa9')];}}if(_0x388e9[_0xde10('0xa8')][_0xde10('0xaa')]){delete _0x388e9['headers'][_0xde10('0xaa')];}return rp(_0x388e9);})[_0xde10('0x2f')](function(_0x37ff27){if(_0x37ff27){_0x20c9ee[_0xde10('0x29')](_0x37ff27[_0xde10('0xa8')]);logger[_0xde10('0x6f')](_0x37ff27[_0xde10('0x97')]);return _0x20c9ee[_0xde10('0x23')](_0x37ff27['statusCode'])[_0xde10('0x37')](_0x37ff27[_0xde10('0x97')]);}else{return _0x20c9ee['sendStatus'](0xc8);}})[_0xde10('0x52')](handleError(_0x20c9ee,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b30289b..0c3ab38 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 _0x022a=['hasOwnProperty','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x53945a,_0xbcedf3){var _0x21f8e1=function(_0x25ff60){while(--_0x25ff60){_0x53945a['push'](_0x53945a['shift']());}};_0x21f8e1(++_0xbcedf3);}(_0x022a,0x1f0));var _0xa022=function(_0x12d121,_0x1ef59d){_0x12d121=_0x12d121-0x0;var _0x1af836=_0x022a[_0x12d121];return _0x1af836;};'use strict';var EventEmitter=require(_0xa022('0x0'));var Plugin=require(_0xa022('0x1'))['db'][_0xa022('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xa022('0x3')](0x0);var events={'afterCreate':_0xa022('0x4'),'afterUpdate':_0xa022('0x5'),'afterDestroy':_0xa022('0x6')};function emitEvent(_0x23dd57){return function(_0x16516a,_0x233c8d,_0x395b24){PluginEvents[_0xa022('0x7')](_0x23dd57+':'+_0x16516a['id'],_0x16516a);PluginEvents['emit'](_0x23dd57,_0x16516a);_0x395b24(null);};}for(var e in events){if(events[_0xa022('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xf446=['setMaxListeners','update','hook','events','Plugin'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xf446,0x1c0));var _0x6f44=function(_0xefd80e,_0x488ebd){_0xefd80e=_0xefd80e-0x0;var _0x48d2e8=_0xf446[_0xefd80e];return _0x48d2e8;};'use strict';var EventEmitter=require(_0x6f44('0x0'));var Plugin=require('../../mysqldb')['db'][_0x6f44('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x6f44('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f44('0x3'),'afterDestroy':'remove'};function emitEvent(_0x13b43d){return function(_0x477db7,_0x5b59aa,_0x41bcac){PluginEvents['emit'](_0x13b43d+':'+_0x477db7['id'],_0x477db7);PluginEvents['emit'](_0x13b43d,_0x477db7);_0x41bcac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x6f44('0x4')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 45b323a..85c5526 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 _0xc0e1=['./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b496f,_0x1682d4){var _0x4fab34=function(_0x12c608){while(--_0x12c608){_0x2b496f['push'](_0x2b496f['shift']());}};_0x4fab34(++_0x1682d4);}(_0xc0e1,0x147));var _0x1c0e=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0xc0e1[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require(_0x1c0e('0x0'));var util=require(_0x1c0e('0x1'));var logger=require(_0x1c0e('0x2'))('api');var moment=require(_0x1c0e('0x3'));var BPromise=require(_0x1c0e('0x4'));var rp=require(_0x1c0e('0x5'));var fs=require('fs');var path=require(_0x1c0e('0x6'));var rimraf=require(_0x1c0e('0x7'));var config=require(_0x1c0e('0x8'));var attributes=require(_0x1c0e('0x9'));module[_0x1c0e('0xa')]=function(_0xa392c3,_0xd121a0){return _0xa392c3[_0x1c0e('0xb')](_0x1c0e('0xc'),attributes,{'tableName':_0x1c0e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4974=['api','moment','request-promise','path','../../config/environment','./plugin.attributes','exports','define','plugins','lodash','../../config/logger'];(function(_0x127778,_0x2547f0){var _0x473529=function(_0xe83d51){while(--_0xe83d51){_0x127778['push'](_0x127778['shift']());}};_0x473529(++_0x2547f0);}(_0x4974,0x127));var _0x4497=function(_0x165a48,_0x44bc9d){_0x165a48=_0x165a48-0x0;var _0x6f6735=_0x4974[_0x165a48];return _0x6f6735;};'use strict';var _=require(_0x4497('0x0'));var util=require('util');var logger=require(_0x4497('0x1'))(_0x4497('0x2'));var moment=require(_0x4497('0x3'));var BPromise=require('bluebird');var rp=require(_0x4497('0x4'));var fs=require('fs');var path=require(_0x4497('0x5'));var rimraf=require('rimraf');var config=require(_0x4497('0x6'));var attributes=require(_0x4497('0x7'));module[_0x4497('0x8')]=function(_0x4bc5e7,_0x16880a){return _0x4bc5e7[_0x4497('0x9')]('Plugin',attributes,{'tableName':_0x4497('0xa'),'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 a728994..64f89ee 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 _0xe516=['catch','CreatePlugin','Plugin','create','body','options','raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe516,0x17a));var _0x6e51=function(_0x39f9f2,_0x37fc06){_0x39f9f2=_0x39f9f2-0x0;var _0x3febf8=_0xe516[_0x39f9f2];return _0x3febf8;};'use strict';var _=require(_0x6e51('0x0'));var util=require(_0x6e51('0x1'));var moment=require(_0x6e51('0x2'));var BPromise=require(_0x6e51('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e51('0x4'));var db=require(_0x6e51('0x5'))['db'];var utils=require(_0x6e51('0x6'));var logger=require(_0x6e51('0x7'))(_0x6e51('0x8'));var config=require(_0x6e51('0x9'));var jayson=require(_0x6e51('0xa'));var client=jayson[_0x6e51('0xb')][_0x6e51('0xc')]({'port':0x232a});config[_0x6e51('0xd')]=_[_0x6e51('0xe')](config[_0x6e51('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e51('0xf'))(new Redis(config[_0x6e51('0xd')]));require(_0x6e51('0x10'))[_0x6e51('0x11')](socket);function respondWithRpcPromise(_0x29387e,_0x5f4373,_0x537ec0){return new BPromise(function(_0x3c8cf1,_0x46ac5c){return client[_0x6e51('0x12')](_0x29387e,_0x537ec0)[_0x6e51('0x13')](function(_0x178ac9){logger[_0x6e51('0x14')](_0x6e51('0x15'),_0x5f4373,_0x6e51('0x16'));logger['debug'](_0x6e51('0x17'),_0x5f4373,_0x6e51('0x16'),JSON[_0x6e51('0x18')](_0x178ac9));if(_0x178ac9[_0x6e51('0x19')]){if(_0x178ac9[_0x6e51('0x19')][_0x6e51('0x1a')]===0x1f4){logger[_0x6e51('0x19')](_0x6e51('0x15'),_0x5f4373,_0x178ac9['error'][_0x6e51('0x1b')]);return _0x46ac5c(_0x178ac9[_0x6e51('0x19')][_0x6e51('0x1b')]);}logger[_0x6e51('0x19')]('Plugin,\x20%s,\x20%s',_0x5f4373,_0x178ac9['error'][_0x6e51('0x1b')]);return _0x3c8cf1(_0x178ac9[_0x6e51('0x19')]['message']);}else{logger['info'](_0x6e51('0x15'),_0x5f4373,_0x6e51('0x16'));_0x3c8cf1(_0x178ac9[_0x6e51('0x1c')][_0x6e51('0x1b')]);}})[_0x6e51('0x1d')](function(_0x21578a){logger[_0x6e51('0x19')](_0x6e51('0x15'),_0x5f4373,_0x21578a);_0x46ac5c(_0x21578a);});});}exports[_0x6e51('0x1e')]=function(_0x36f4ef){var _0x5cd74f=this;return new Promise(function(_0x5cdc4d,_0x35cfcb){return db[_0x6e51('0x1f')][_0x6e51('0x20')](_0x36f4ef[_0x6e51('0x21')],{'raw':_0x36f4ef[_0x6e51('0x22')]?_0x36f4ef[_0x6e51('0x22')][_0x6e51('0x23')]===undefined?!![]:![]:!![]})[_0x6e51('0x13')](function(_0x4b8f9f){logger['info'](_0x6e51('0x1e'),_0x36f4ef);logger[_0x6e51('0x24')](_0x6e51('0x1e'),_0x36f4ef,JSON[_0x6e51('0x18')](_0x4b8f9f));_0x5cdc4d(_0x4b8f9f);})['catch'](function(_0x39e892){logger['error'](_0x6e51('0x1e'),_0x39e892[_0x6e51('0x1b')],_0x36f4ef);_0x35cfcb(_0x5cd74f[_0x6e51('0x19')](0x1f4,_0x39e892[_0x6e51('0x1b')]));});});}; \ No newline at end of file +var _0xd751=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./plugin.socket','register'];(function(_0x43b3e5,_0x29bd76){var _0x9cbaa5=function(_0x497350){while(--_0x497350){_0x43b3e5['push'](_0x43b3e5['shift']());}};_0x9cbaa5(++_0x29bd76);}(_0xd751,0x13b));var _0x1d75=function(_0x17777a,_0x31b31d){_0x17777a=_0x17777a-0x0;var _0x2c89f6=_0xd751[_0x17777a];return _0x2c89f6;};'use strict';var _=require(_0x1d75('0x0'));var util=require('util');var moment=require(_0x1d75('0x1'));var BPromise=require(_0x1d75('0x2'));var rs=require(_0x1d75('0x3'));var fs=require('fs');var Redis=require(_0x1d75('0x4'));var db=require(_0x1d75('0x5'))['db'];var utils=require(_0x1d75('0x6'));var logger=require(_0x1d75('0x7'))(_0x1d75('0x8'));var config=require(_0x1d75('0x9'));var jayson=require(_0x1d75('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x1d75('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d75('0xc'))(new Redis(config['redis']));require(_0x1d75('0xd'))[_0x1d75('0xe')](socket);function respondWithRpcPromise(_0x636bac,_0x113f10,_0xac1930){return new BPromise(function(_0x337a66,_0x187383){return client['request'](_0x636bac,_0xac1930)[_0x1d75('0xf')](function(_0x191f69){logger[_0x1d75('0x10')](_0x1d75('0x11'),_0x113f10,_0x1d75('0x12'));logger[_0x1d75('0x13')](_0x1d75('0x14'),_0x113f10,'request\x20sent',JSON[_0x1d75('0x15')](_0x191f69));if(_0x191f69[_0x1d75('0x16')]){if(_0x191f69[_0x1d75('0x16')][_0x1d75('0x17')]===0x1f4){logger[_0x1d75('0x16')](_0x1d75('0x11'),_0x113f10,_0x191f69[_0x1d75('0x16')]['message']);return _0x187383(_0x191f69['error']['message']);}logger[_0x1d75('0x16')](_0x1d75('0x11'),_0x113f10,_0x191f69[_0x1d75('0x16')]['message']);return _0x337a66(_0x191f69[_0x1d75('0x16')][_0x1d75('0x18')]);}else{logger[_0x1d75('0x10')](_0x1d75('0x11'),_0x113f10,'request\x20sent');_0x337a66(_0x191f69[_0x1d75('0x19')][_0x1d75('0x18')]);}})[_0x1d75('0x1a')](function(_0x458765){logger['error']('Plugin,\x20%s,\x20%s',_0x113f10,_0x458765);_0x187383(_0x458765);});});}exports[_0x1d75('0x1b')]=function(_0x5dc583){var _0x3e1b78=this;return new Promise(function(_0x259641,_0x10a86c){return db[_0x1d75('0x1c')][_0x1d75('0x1d')](_0x5dc583[_0x1d75('0x1e')],{'raw':_0x5dc583[_0x1d75('0x1f')]?_0x5dc583[_0x1d75('0x1f')][_0x1d75('0x20')]===undefined?!![]:![]:!![]})[_0x1d75('0xf')](function(_0x2afe93){logger['info']('CreatePlugin',_0x5dc583);logger[_0x1d75('0x13')](_0x1d75('0x1b'),_0x5dc583,JSON['stringify'](_0x2afe93));_0x259641(_0x2afe93);})[_0x1d75('0x1a')](function(_0x55e4c7){logger[_0x1d75('0x16')](_0x1d75('0x1b'),_0x55e4c7['message'],_0x5dc583);_0x10a86c(_0x3e1b78['error'](0x1f4,_0x55e4c7['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index e80ac1a..c28c422 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 _0x191d=['register','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x33c979,_0x228c90){var _0x9ef6=function(_0x2189e5){while(--_0x2189e5){_0x33c979['push'](_0x33c979['shift']());}};_0x9ef6(++_0x228c90);}(_0x191d,0x15a));var _0xd191=function(_0x3a5413,_0x203d1c){_0x3a5413=_0x3a5413-0x0;var _0x2fad3a=_0x191d[_0x3a5413];return _0x2fad3a;};'use strict';var PluginEvents=require(_0xd191('0x0'));var events=[_0xd191('0x1'),_0xd191('0x2'),_0xd191('0x3')];function createListener(_0x48912a,_0x268a7b){return function(_0x52a810){_0x268a7b[_0xd191('0x4')](_0x48912a,_0x52a810);};}function removeListener(_0xa00889,_0x36c3de){return function(){PluginEvents[_0xd191('0x5')](_0xa00889,_0x36c3de);};}exports[_0xd191('0x6')]=function(_0xf29640){for(var _0x1793da=0x0,_0x32a203=events['length'];_0x1793da<_0x32a203;_0x1793da++){var _0x19865d=events[_0x1793da];var _0x2b29e6=createListener(_0xd191('0x7')+_0x19865d,_0xf29640);PluginEvents['on'](_0x19865d,_0x2b29e6);}}; \ No newline at end of file +var _0xe78c=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x434743,_0x396d7f){var _0x48128e=function(_0x9e7fd7){while(--_0x9e7fd7){_0x434743['push'](_0x434743['shift']());}};_0x48128e(++_0x396d7f);}(_0xe78c,0xdd));var _0xce78=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe78c[_0x57b54c];return _0x59cc19;};'use strict';var PluginEvents=require(_0xce78('0x0'));var events=[_0xce78('0x1'),_0xce78('0x2'),_0xce78('0x3')];function createListener(_0x204064,_0xb46ac6){return function(_0x4c07be){_0xb46ac6[_0xce78('0x4')](_0x204064,_0x4c07be);};}function removeListener(_0x156dca,_0x1bc7f1){return function(){PluginEvents[_0xce78('0x5')](_0x156dca,_0x1bc7f1);};}exports[_0xce78('0x6')]=function(_0x4c4799){for(var _0x3fbd72=0x0,_0xf60927=events[_0xce78('0x7')];_0x3fbd72<_0xf60927;_0x3fbd72++){var _0x39ef7b=events[_0x3fbd72];var _0x47c466=createListener(_0xce78('0x8')+_0x39ef7b,_0x4c4799);PluginEvents['on'](_0x39ef7b,_0x47c466);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8cef398..88aa984 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(_0xc17317,_0x34b637){var _0x47fd11=function(_0x2c2412){while(--_0x2c2412){_0xc17317['push'](_0xc17317['shift']());}};_0x47fd11(++_0x34b637);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x2117c5,_0x4c0e99){var _0x4a8746=function(_0x1b5a18){while(--_0x1b5a18){_0x2117c5['push'](_0x2117c5['shift']());}};_0x4a8746(++_0x4c0e99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 599a9cc..f552aaa 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 _0x1be1=['stop','hasOwnProperty','status','destroy','delete','Unknown\x20id','../../config/logger','api','child_process','exec','bluebird','sendStatus','json','error','name','send','npm\x20install','info','index','express','motion2','length','then','catch','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart'];(function(_0x22aaa2,_0x1034d7){var _0x364fe7=function(_0xf48c41){while(--_0xf48c41){_0x22aaa2['push'](_0x22aaa2['shift']());}};_0x364fe7(++_0x1034d7);}(_0x1be1,0x192));var _0x11be=function(_0x2024bf,_0x5e1f78){_0x2024bf=_0x2024bf-0x0;var _0x5ea24e=_0x1be1[_0x2024bf];return _0x5ea24e;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x11be('0x0'))(_0x11be('0x1'));var path=require('path');var exec=require(_0x11be('0x2'))[_0x11be('0x3')];var BPromise=require(_0x11be('0x4'));function handleEntityNotFound(_0x318d41,_0x504d3a){return function(_0x3ce56d){if(!_0x3ce56d){_0x318d41[_0x11be('0x5')](0x194);;}return _0x3ce56d;};}function respondWithResult(_0x11f793,_0x479719){_0x479719=_0x479719||0xc8;return function(_0xfe8c62){if(_0xfe8c62){return _0x11f793['status'](_0x479719)[_0x11be('0x6')](_0xfe8c62);}return null;};}function handleError(_0x11fc15,_0x246772){_0x246772=_0x246772||0x1f4;return function(_0x461e17){logger[_0x11be('0x7')](_0x461e17['stack']);if(_0x461e17[_0x11be('0x8')]){delete _0x461e17[_0x11be('0x8')];}_0x11fc15['status'](_0x246772)[_0x11be('0x9')](_0x461e17);};}function execChildProcess(){return new BPromise(function(_0x2cd786,_0x40f0d1){exec(_0x11be('0xa'),function(_0x4e013c,_0x447e88,_0xcb8120){logger[_0x11be('0xb')](_0x447e88);logger['info'](_0xcb8120);if(_0x4e013c){logger[_0x11be('0x7')](_0x4e013c);return _0x40f0d1(_0x4e013c);}return _0x2cd786(_0x447e88);});});}exports[_0x11be('0xc')]=function(_0x4ce3ae,_0x44eff2){return pm2['list']()['then'](function(_0x569842){if(_0x569842){var _0x4b6e7e=_['reject'](_0x569842,function(_0x5aa444){return _0x5aa444['name']===_0x11be('0xd')||_0x5aa444['name']===_0x11be('0xe');});return{'rows':_0x4b6e7e,'count':_0x4b6e7e[_0x11be('0xf')]};}return null;})[_0x11be('0x10')](respondWithResult(_0x44eff2,null))[_0x11be('0x11')](handleError(_0x44eff2,null));};exports['show']=function(_0x2ed725,_0x403d7a){return pm2['describe'](_0x2ed725[_0x11be('0x12')]['id'])[_0x11be('0x10')](respondWithResult(_0x403d7a,null))[_0x11be('0x10')](handleEntityNotFound(_0x403d7a,null))['catch'](handleError(_0x403d7a,null));};exports['create']=function(_0x141391,_0x976e51){if(_0x141391[_0x11be('0x13')][_0x11be('0x8')]&&_0x141391['body'][_0x11be('0x14')]){var _0x45136f=path[_0x11be('0x15')](__dirname,_0x11be('0x16'),_0x141391[_0x11be('0x13')][_0x11be('0x14')]);var _0xa944ac=process[_0x11be('0x17')]();process[_0x11be('0x18')](path[_0x11be('0x19')](_0x45136f));return execChildProcess()['then'](function(_0xfe3737){process[_0x11be('0x18')](_0xa944ac);return pm2[_0x11be('0x1a')]({'name':_0x141391['body']['name'],'script':_0x45136f});})[_0x11be('0x10')](function(_0x10ce04){pm2[_0x11be('0x1b')]();return _0x10ce04[0x0];})['then'](respondWithResult(_0x976e51,0xc9))[_0x11be('0x11')](handleError(_0x976e51,null));}else{return _0x976e51['status'](0x1f4)[_0x11be('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x11be('0x1c')]=function(_0xb11f3d,_0x5002d7){if(_0xb11f3d[_0x11be('0x13')]['id']){delete _0xb11f3d[_0x11be('0x13')]['id'];}var _0x1d3b5c={'online':_0x11be('0x1d'),'stopped':_0x11be('0x1e')};if(_0x1d3b5c[_0x11be('0x1f')](_0xb11f3d[_0x11be('0x13')][_0x11be('0x20')])){return pm2[_0x1d3b5c[_0xb11f3d[_0x11be('0x13')]['status']]](_0xb11f3d[_0x11be('0x12')]['id'])['then'](respondWithResult(_0x5002d7,0xc8))[_0x11be('0x11')](handleError(_0x5002d7,null));}else{return _0x5002d7[_0x11be('0x20')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x11be('0x21')]=function(_0x265fc9,_0x5e8f9a){if(_0x265fc9[_0x11be('0x13')]['id']){delete _0x265fc9[_0x11be('0x13')]['id'];}if(_0x265fc9[_0x11be('0x12')]['id']){return pm2[_0x11be('0x22')](_0x265fc9[_0x11be('0x12')]['id'])[_0x11be('0x10')](function(_0x4b527e){pm2[_0x11be('0x1b')]();return _0x4b527e[0x0];})[_0x11be('0x10')](respondWithResult(_0x5e8f9a,null))[_0x11be('0x11')](handleError(_0x5e8f9a,null));}else{return _0x5e8f9a[_0x11be('0x20')](0x1f4)[_0x11be('0x9')]({'message':_0x11be('0x23')});}}; \ No newline at end of file +var _0xcb91=['describe','create','body','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','path','child_process','bluebird','sendStatus','json','name','status','send','npm\x20install','info','list','then','reject','express','length','catch','show'];(function(_0x28ef79,_0x4f77e1){var _0x2d15ab=function(_0x311ccf){while(--_0x311ccf){_0x28ef79['push'](_0x28ef79['shift']());}};_0x2d15ab(++_0x4f77e1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0xcb91[_0x3c4e4c];return _0x144a87;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var path=require(_0x1cb9('0x2'));var exec=require(_0x1cb9('0x3'))['exec'];var BPromise=require(_0x1cb9('0x4'));function handleEntityNotFound(_0x2c17b8,_0x545a34){return function(_0x13d5fd){if(!_0x13d5fd){_0x2c17b8[_0x1cb9('0x5')](0x194);;}return _0x13d5fd;};}function respondWithResult(_0x53ffbd,_0x226b69){_0x226b69=_0x226b69||0xc8;return function(_0x3f7deb){if(_0x3f7deb){return _0x53ffbd['status'](_0x226b69)[_0x1cb9('0x6')](_0x3f7deb);}return null;};}function handleError(_0x12567c,_0x59d1be){_0x59d1be=_0x59d1be||0x1f4;return function(_0x3ae0f1){logger['error'](_0x3ae0f1['stack']);if(_0x3ae0f1[_0x1cb9('0x7')]){delete _0x3ae0f1[_0x1cb9('0x7')];}_0x12567c[_0x1cb9('0x8')](_0x59d1be)[_0x1cb9('0x9')](_0x3ae0f1);};}function execChildProcess(){return new BPromise(function(_0x2fc627,_0x50ce71){exec(_0x1cb9('0xa'),function(_0x44a6b4,_0x3af35f,_0x3fdd83){logger[_0x1cb9('0xb')](_0x3af35f);logger['info'](_0x3fdd83);if(_0x44a6b4){logger['error'](_0x44a6b4);return _0x50ce71(_0x44a6b4);}return _0x2fc627(_0x3af35f);});});}exports['index']=function(_0x358866,_0x282bc6){return pm2[_0x1cb9('0xc')]()[_0x1cb9('0xd')](function(_0x56884d){if(_0x56884d){var _0x397727=_[_0x1cb9('0xe')](_0x56884d,function(_0x1b3cd7){return _0x1b3cd7[_0x1cb9('0x7')]===_0x1cb9('0xf')||_0x1b3cd7['name']==='motion2';});return{'rows':_0x397727,'count':_0x397727[_0x1cb9('0x10')]};}return null;})[_0x1cb9('0xd')](respondWithResult(_0x282bc6,null))[_0x1cb9('0x11')](handleError(_0x282bc6,null));};exports[_0x1cb9('0x12')]=function(_0x3e21e0,_0xf22920){return pm2[_0x1cb9('0x13')](_0x3e21e0['params']['id'])['then'](respondWithResult(_0xf22920,null))[_0x1cb9('0xd')](handleEntityNotFound(_0xf22920,null))[_0x1cb9('0x11')](handleError(_0xf22920,null));};exports[_0x1cb9('0x14')]=function(_0x31481a,_0x280a84){if(_0x31481a[_0x1cb9('0x15')][_0x1cb9('0x7')]&&_0x31481a['body']['script']){var _0x1a5a72=path['join'](__dirname,_0x1cb9('0x16'),_0x31481a[_0x1cb9('0x15')]['script']);var _0x599275=process[_0x1cb9('0x17')]();process[_0x1cb9('0x18')](path[_0x1cb9('0x19')](_0x1a5a72));return execChildProcess()[_0x1cb9('0xd')](function(_0x45b8d3){process[_0x1cb9('0x18')](_0x599275);return pm2['start']({'name':_0x31481a['body'][_0x1cb9('0x7')],'script':_0x1a5a72});})['then'](function(_0x10a419){pm2[_0x1cb9('0x1a')]();return _0x10a419[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x280a84,0xc9))[_0x1cb9('0x11')](handleError(_0x280a84,null));}else{return _0x280a84[_0x1cb9('0x8')](0x1f4)['send']({'message':_0x1cb9('0x1b')});}};exports[_0x1cb9('0x1c')]=function(_0x4c8d76,_0xd6891c){if(_0x4c8d76[_0x1cb9('0x15')]['id']){delete _0x4c8d76[_0x1cb9('0x15')]['id'];}var _0x1804fd={'online':_0x1cb9('0x1d'),'stopped':_0x1cb9('0x1e')};if(_0x1804fd[_0x1cb9('0x1f')](_0x4c8d76[_0x1cb9('0x15')][_0x1cb9('0x8')])){return pm2[_0x1804fd[_0x4c8d76[_0x1cb9('0x15')]['status']]](_0x4c8d76[_0x1cb9('0x20')]['id'])['then'](respondWithResult(_0xd6891c,0xc8))[_0x1cb9('0x11')](handleError(_0xd6891c,null));}else{return _0xd6891c['status'](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x21')});}};exports[_0x1cb9('0x22')]=function(_0x2038aa,_0x561d89){if(_0x2038aa[_0x1cb9('0x15')]['id']){delete _0x2038aa['body']['id'];}if(_0x2038aa[_0x1cb9('0x20')]['id']){return pm2[_0x1cb9('0x23')](_0x2038aa[_0x1cb9('0x20')]['id'])['then'](function(_0xae4c7a){pm2['dump']();return _0xae4c7a[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x561d89,null))['catch'](handleError(_0x561d89,null));}else{return _0x561d89[_0x1cb9('0x8')](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 4291657..2e3ac5a 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 _0xbfde=['getQueues','exports','Router','./realtime.controller','/agents','isAuthenticated','getAgents','get','/queues'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbfde,0x1c4));var _0xebfd=function(_0x362b3f,_0x2edbdb){_0x362b3f=_0x362b3f-0x0;var _0x111108=_0xbfde[_0x362b3f];return _0x111108;};'use strict';var express=require('express');var router=express[_0xebfd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xebfd('0x1'));router['get'](_0xebfd('0x2'),auth[_0xebfd('0x3')](),controller[_0xebfd('0x4')]);router[_0xebfd('0x5')](_0xebfd('0x6'),auth[_0xebfd('0x3')](),controller[_0xebfd('0x7')]);module[_0xebfd('0x8')]=router; \ No newline at end of file +var _0x6213=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','exports','Router'];(function(_0x3c8071,_0x1495f9){var _0x1e0932=function(_0x101b9d){while(--_0x101b9d){_0x3c8071['push'](_0x3c8071['shift']());}};_0x1e0932(++_0x1495f9);}(_0x6213,0x179));var _0x3621=function(_0x47fbba,_0x579870){_0x47fbba=_0x47fbba-0x0;var _0x1d766e=_0x6213[_0x47fbba];return _0x1d766e;};'use strict';var express=require('express');var router=express[_0x3621('0x0')]();var auth=require(_0x3621('0x1'));var controller=require(_0x3621('0x2'));router[_0x3621('0x3')](_0x3621('0x4'),auth[_0x3621('0x5')](),controller[_0x3621('0x6')]);router[_0x3621('0x3')](_0x3621('0x7'),auth[_0x3621('0x5')](),controller['getQueues']);module[_0x3621('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 924ffda..e9f7d89 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 _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x49edf3,_0xc5f778){var _0xcb0f17=function(_0x3c81e1){while(--_0x3c81e1){_0x49edf3['push'](_0x49edf3['shift']());}};_0xcb0f17(++_0xc5f778);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x10791c,_0x48adef){var _0x19432c=function(_0x225b0f){while(--_0x225b0f){_0x10791c['push'](_0x10791c['shift']());}};_0x19432c(++_0x48adef);}(_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 rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b2a9d7e..e99ea36 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x206b7,_0x1ef444){var _0x3e9d63=function(_0x1225f6){while(--_0x1225f6){_0x206b7['push'](_0x206b7['shift']());}};_0x3e9d63(++_0x1ef444);}(_0x70e0,0x17b));var _0x070e=function(_0x872a88,_0x4a3a74){_0x872a88=_0x872a88-0x0;var _0xaacdfb=_0x70e0[_0x872a88];return _0xaacdfb;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x25201e,_0xc781ec){var _0x4b2d85=function(_0x23da2a){while(--_0x23da2a){_0x25201e['push'](_0x25201e['shift']());}};_0x4b2d85(++_0xc781ec);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xcb91[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5e58e5e..a114657 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 _0x2706=['INTEGER','STRING','DATE','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x2706,0x107));var _0x6270=function(_0x26979c,_0x5daeda){_0x26979c=_0x26979c-0x0;var _0x460ffb=_0x2706[_0x26979c];return _0x460ffb;};'use strict';var Sequelize=require('sequelize');module[_0x6270('0x0')]={'state':{'type':Sequelize[_0x6270('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6270('0x2')]},'scheduledat':{'type':Sequelize[_0x6270('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6270('0x3')]},'responsetime':{'type':Sequelize[_0x6270('0x3')]},'ringtime':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6270('0x2')]},'campaigntype':{'type':Sequelize[_0x6270('0x2')]},'membername':{'type':Sequelize[_0x6270('0x2')]}}; \ No newline at end of file +var _0x0650=['DATE','sequelize','INTEGER','STRING'];(function(_0x422a55,_0x178bb){var _0x5a7921=function(_0x46c0a6){while(--_0x46c0a6){_0x422a55['push'](_0x422a55['shift']());}};_0x5a7921(++_0x178bb);}(_0x0650,0xed));var _0x0065=function(_0x8b885,_0x31740b){_0x8b885=_0x8b885-0x0;var _0x122eb8=_0x0650[_0x8b885];return _0x122eb8;};'use strict';var Sequelize=require(_0x0065('0x0'));module['exports']={'state':{'type':Sequelize[_0x0065('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0065('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x0065('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0065('0x3')]},'ringtime':{'type':Sequelize[_0x0065('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0065('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0065('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 2b03dbb..96ef498 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 _0x5449=['../../config/logger','api','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x5449,0x170));var _0x9544=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x5449[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9544('0x0'))(_0x9544('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9544('0x2'));var config=require(_0x9544('0x3'));var attributes=require(_0x9544('0x4'));module[_0x9544('0x5')]=function(_0x331586,_0x16f12d){return _0x331586['define'](_0x9544('0x6'),attributes,{'tableName':_0x9544('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cdb=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x5cdb,0x162));var _0xb5cd=function(_0x2fcd14,_0x18e41e){_0x2fcd14=_0x2fcd14-0x0;var _0x115a04=_0x5cdb[_0x2fcd14];return _0x115a04;};'use strict';var _=require(_0xb5cd('0x0'));var util=require(_0xb5cd('0x1'));var logger=require(_0xb5cd('0x2'))(_0xb5cd('0x3'));var moment=require(_0xb5cd('0x4'));var BPromise=require(_0xb5cd('0x5'));var rp=require(_0xb5cd('0x6'));var fs=require('fs');var path=require(_0xb5cd('0x7'));var rimraf=require(_0xb5cd('0x8'));var config=require(_0xb5cd('0x9'));var attributes=require(_0xb5cd('0xa'));module[_0xb5cd('0xb')]=function(_0x339efb,_0x278f73){return _0x339efb[_0xb5cd('0xc')](_0xb5cd('0xd'),attributes,{'tableName':_0xb5cd('0xe'),'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 55e37cb..b088e24 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 _0xcbb6=['moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','util'];(function(_0x194f6d,_0x6f6222){var _0x572280=function(_0x5d1af9){while(--_0x5d1af9){_0x194f6d['push'](_0x194f6d['shift']());}};_0x572280(++_0x6f6222);}(_0xcbb6,0x18f));var _0x6cbb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcbb6[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x6cbb('0x0'));var moment=require(_0x6cbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x6cbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cbb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6cbb('0x4'))(_0x6cbb('0x5'));var config=require('../../config/environment');var jayson=require(_0x6cbb('0x6'));var client=jayson[_0x6cbb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338ed7,_0x2c3bf9,_0x55f962){return new BPromise(function(_0x42fc65,_0x3e538f){return client[_0x6cbb('0x8')](_0x338ed7,_0x55f962)[_0x6cbb('0x9')](function(_0x346c61){logger[_0x6cbb('0xa')](_0x6cbb('0xb'),_0x2c3bf9,'request\x20sent');logger[_0x6cbb('0xc')](_0x6cbb('0xd'),_0x2c3bf9,'request\x20sent',JSON[_0x6cbb('0xe')](_0x346c61));if(_0x346c61[_0x6cbb('0xf')]){if(_0x346c61[_0x6cbb('0xf')][_0x6cbb('0x10')]===0x1f4){logger['error'](_0x6cbb('0xb'),_0x2c3bf9,_0x346c61[_0x6cbb('0xf')][_0x6cbb('0x11')]);return _0x3e538f(_0x346c61[_0x6cbb('0xf')]['message']);}logger[_0x6cbb('0xf')](_0x6cbb('0xb'),_0x2c3bf9,_0x346c61[_0x6cbb('0xf')][_0x6cbb('0x11')]);return _0x42fc65(_0x346c61[_0x6cbb('0xf')]['message']);}else{logger[_0x6cbb('0xa')](_0x6cbb('0xb'),_0x2c3bf9,'request\x20sent');_0x42fc65(_0x346c61[_0x6cbb('0x12')][_0x6cbb('0x11')]);}})[_0x6cbb('0x13')](function(_0x547228){logger[_0x6cbb('0xf')](_0x6cbb('0xb'),_0x2c3bf9,_0x547228);_0x3e538f(_0x547228);});});}exports[_0x6cbb('0x14')]=function(_0x1c7d08){var _0x3482f9=this;return new Promise(function(_0x2072b4,_0x3e8928){return db[_0x6cbb('0x15')][_0x6cbb('0x16')](_0x1c7d08['body'],{'raw':_0x1c7d08[_0x6cbb('0x17')]?_0x1c7d08[_0x6cbb('0x17')][_0x6cbb('0x18')]===undefined?!![]:![]:!![]})[_0x6cbb('0x9')](function(_0x515799){logger[_0x6cbb('0xa')](_0x6cbb('0x14'),_0x1c7d08);logger[_0x6cbb('0xc')](_0x6cbb('0x14'),_0x1c7d08,JSON[_0x6cbb('0xe')](_0x515799));_0x2072b4(_0x515799);})[_0x6cbb('0x13')](function(_0x539106){logger['error'](_0x6cbb('0x14'),_0x539106[_0x6cbb('0x11')],_0x1c7d08);_0x3e8928(_0x3482f9[_0x6cbb('0xf')](0x1f4,_0x539106[_0x6cbb('0x11')]));});});}; \ No newline at end of file +var _0x83e1=['http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x5d8ad5,_0x2e0fd6){var _0x27ca1e=function(_0x5ccde5){while(--_0x5ccde5){_0x5d8ad5['push'](_0x5d8ad5['shift']());}};_0x27ca1e(++_0x2e0fd6);}(_0x83e1,0x1da));var _0x183e=function(_0x5591df,_0x98bf25){_0x5591df=_0x5591df-0x0;var _0x3b4fc6=_0x83e1[_0x5591df];return _0x3b4fc6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x183e('0x0'));var rs=require(_0x183e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x183e('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x183e('0x3'));var jayson=require(_0x183e('0x4'));var client=jayson[_0x183e('0x5')][_0x183e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x528068,_0x5f4aaf,_0x36b4c0){return new BPromise(function(_0x8c0814,_0x56c08a){return client['request'](_0x528068,_0x36b4c0)[_0x183e('0x7')](function(_0x22aff7){logger['info'](_0x183e('0x8'),_0x5f4aaf,_0x183e('0x9'));logger[_0x183e('0xa')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5f4aaf,'request\x20sent',JSON[_0x183e('0xb')](_0x22aff7));if(_0x22aff7[_0x183e('0xc')]){if(_0x22aff7[_0x183e('0xc')][_0x183e('0xd')]===0x1f4){logger[_0x183e('0xc')](_0x183e('0x8'),_0x5f4aaf,_0x22aff7['error'][_0x183e('0xe')]);return _0x56c08a(_0x22aff7[_0x183e('0xc')][_0x183e('0xe')]);}logger[_0x183e('0xc')](_0x183e('0x8'),_0x5f4aaf,_0x22aff7[_0x183e('0xc')][_0x183e('0xe')]);return _0x8c0814(_0x22aff7[_0x183e('0xc')][_0x183e('0xe')]);}else{logger[_0x183e('0xf')](_0x183e('0x8'),_0x5f4aaf,_0x183e('0x9'));_0x8c0814(_0x22aff7[_0x183e('0x10')][_0x183e('0xe')]);}})[_0x183e('0x11')](function(_0x3f6a97){logger[_0x183e('0xc')](_0x183e('0x8'),_0x5f4aaf,_0x3f6a97);_0x56c08a(_0x3f6a97);});});}exports[_0x183e('0x12')]=function(_0x4b4fdf){var _0x152207=this;return new Promise(function(_0x3bac8d,_0x189473){return db[_0x183e('0x13')][_0x183e('0x14')](_0x4b4fdf[_0x183e('0x15')],{'raw':_0x4b4fdf['options']?_0x4b4fdf[_0x183e('0x16')][_0x183e('0x17')]===undefined?!![]:![]:!![]})[_0x183e('0x7')](function(_0xbb8f45){logger['info'](_0x183e('0x12'),_0x4b4fdf);logger['debug']('CreateReportAgentPreview',_0x4b4fdf,JSON[_0x183e('0xb')](_0xbb8f45));_0x3bac8d(_0xbb8f45);})['catch'](function(_0x415e0e){logger[_0x183e('0xc')](_0x183e('0x12'),_0x415e0e['message'],_0x4b4fdf);_0x189473(_0x152207[_0x183e('0xc')](0x1f4,_0x415e0e[_0x183e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 9d62e2a..9c91cdb 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 _0x95f6=['/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/trunks','trunks','/campaigns','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post'];(function(_0x56a265,_0x4bc181){var _0xd42e80=function(_0x2c8a87){while(--_0x2c8a87){_0x56a265['push'](_0x56a265['shift']());}};_0xd42e80(++_0x4bc181);}(_0x95f6,0xb8));var _0x695f=function(_0x32814c,_0x2a68f5){_0x32814c=_0x32814c-0x0;var _0x394c8d=_0x95f6[_0x32814c];return _0x394c8d;};'use strict';var multer=require(_0x695f('0x0'));var util=require(_0x695f('0x1'));var path=require(_0x695f('0x2'));var express=require('express');var router=express[_0x695f('0x3')]();var auth=require(_0x695f('0x4'));var controller=require(_0x695f('0x5'));router[_0x695f('0x6')](_0x695f('0x7'),auth[_0x695f('0x8')](),controller[_0x695f('0x9')]);router[_0x695f('0x6')](_0x695f('0xa'),auth[_0x695f('0x8')](),controller[_0x695f('0xb')]);router[_0x695f('0x6')](_0x695f('0xc'),auth[_0x695f('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x695f('0x6')](_0x695f('0xd'),auth[_0x695f('0x8')](),controller[_0x695f('0xe')]);router[_0x695f('0x6')](_0x695f('0xf'),auth[_0x695f('0x8')](),controller[_0x695f('0x10')]);router[_0x695f('0x6')](_0x695f('0x11'),auth[_0x695f('0x8')](),controller[_0x695f('0x12')]);router[_0x695f('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x695f('0x13')]);router[_0x695f('0x6')](_0x695f('0x14'),auth[_0x695f('0x8')](),controller['openchannelQueues']);router[_0x695f('0x6')]('/sms/queues',auth[_0x695f('0x8')](),controller[_0x695f('0x15')]);router['get']('/whatsapp/queues',auth[_0x695f('0x8')](),controller[_0x695f('0x16')]);router[_0x695f('0x6')]('/fax/queues',auth[_0x695f('0x8')](),controller[_0x695f('0x17')]);router[_0x695f('0x6')](_0x695f('0x18'),auth[_0x695f('0x8')](),controller[_0x695f('0x19')]);router[_0x695f('0x6')](_0x695f('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x695f('0x6')](_0x695f('0x1b'),auth[_0x695f('0x8')](),controller[_0x695f('0x1c')]);router['get'](_0x695f('0x1d'),auth[_0x695f('0x8')](),controller[_0x695f('0x1e')]);router[_0x695f('0x6')](_0x695f('0x1f'),auth[_0x695f('0x8')](),controller[_0x695f('0x20')]);router[_0x695f('0x6')](_0x695f('0x21'),auth[_0x695f('0x8')](),controller[_0x695f('0x22')]);router[_0x695f('0x23')]('/voice/queues/:id',auth[_0x695f('0x8')](),controller[_0x695f('0x24')]);router[_0x695f('0x6')](_0x695f('0x25'),auth[_0x695f('0x8')](),controller['outbound']);router['get'](_0x695f('0x26'),auth[_0x695f('0x8')](),controller[_0x695f('0x27')]);router[_0x695f('0x6')]('/agents',auth[_0x695f('0x8')](),controller[_0x695f('0x28')]);router[_0x695f('0x23')](_0x695f('0x29'),auth[_0x695f('0x8')](),controller[_0x695f('0x2a')]);router[_0x695f('0x6')]('/telephones',auth[_0x695f('0x8')](),controller['telephones']);router['get'](_0x695f('0x2b'),auth[_0x695f('0x8')](),controller[_0x695f('0x2c')]);router[_0x695f('0x6')](_0x695f('0x2d'),auth[_0x695f('0x8')](),controller[_0x695f('0x2e')]);router['get'](_0x695f('0x2f'),auth[_0x695f('0x8')](),controller['faxAccounts']);router[_0x695f('0x6')]('/chat/queues/waitinginteractions',auth[_0x695f('0x8')](),controller[_0x695f('0x30')]);router[_0x695f('0x6')](_0x695f('0x31'),auth['isAuthenticated'](),controller[_0x695f('0x32')]);router['get'](_0x695f('0x33'),auth[_0x695f('0x8')](),controller[_0x695f('0x34')]);router[_0x695f('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x695f('0x8')](),controller[_0x695f('0x35')]);router[_0x695f('0x6')](_0x695f('0x36'),auth[_0x695f('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x695f('0x6')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x695f('0x37')]);router[_0x695f('0x6')](_0x695f('0x38'),auth[_0x695f('0x8')](),controller[_0x695f('0x39')]);router[_0x695f('0x3a')](_0x695f('0x3b'),auth[_0x695f('0x8')](),controller[_0x695f('0x3c')](_0x695f('0x3d')));router[_0x695f('0x6')](_0x695f('0x3e'),auth[_0x695f('0x8')](),controller['showMailQueues']);router[_0x695f('0x3a')](_0x695f('0x3f'),auth['isAuthenticated'](),controller[_0x695f('0x3c')](_0x695f('0x40')));router[_0x695f('0x6')](_0x695f('0x41'),auth[_0x695f('0x8')](),controller['showChatQueues']);router[_0x695f('0x3a')]('/fax/queues/:id/notify',auth[_0x695f('0x8')](),controller[_0x695f('0x3c')](_0x695f('0x42')));router['get'](_0x695f('0x43'),auth[_0x695f('0x8')](),controller[_0x695f('0x44')]);router[_0x695f('0x3a')]('/openchannel/queues/:id/notify',auth[_0x695f('0x8')](),controller[_0x695f('0x3c')](_0x695f('0x45')));router[_0x695f('0x6')](_0x695f('0x46'),auth[_0x695f('0x8')](),controller[_0x695f('0x47')]);router['post'](_0x695f('0x48'),auth['isAuthenticated'](),controller[_0x695f('0x3c')](_0x695f('0x49')));router[_0x695f('0x3a')](_0x695f('0x4a'),auth[_0x695f('0x8')](),controller[_0x695f('0x3c')](_0x695f('0x4b')));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x695f('0x4c')]);router[_0x695f('0x6')](_0x695f('0x4d'),auth['isAuthenticated'](),controller[_0x695f('0x4e')]);router[_0x695f('0x3a')](_0x695f('0x4f'),auth[_0x695f('0x8')](),controller['agentNotify']);module[_0x695f('0x50')]=router; \ No newline at end of file +var _0x9eb1=['/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','express','Router','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions'];(function(_0x392ccc,_0x444e1e){var _0x2df583=function(_0x3d2b52){while(--_0x3d2b52){_0x392ccc['push'](_0x392ccc['shift']());}};_0x2df583(++_0x444e1e);}(_0x9eb1,0x65));var _0x19eb=function(_0x49dba5,_0x1086fd){_0x49dba5=_0x49dba5-0x0;var _0x495fc6=_0x9eb1[_0x49dba5];return _0x495fc6;};'use strict';var multer=require(_0x19eb('0x0'));var util=require('util');var path=require('path');var express=require(_0x19eb('0x1'));var router=express[_0x19eb('0x2')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x19eb('0x3')](_0x19eb('0x4'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x6')]);router[_0x19eb('0x3')](_0x19eb('0x7'),auth[_0x19eb('0x5')](),controller['voiceChannelMixMonitor']);router[_0x19eb('0x3')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x19eb('0x5')](),controller[_0x19eb('0x8')]);router['get'](_0x19eb('0x9'),auth[_0x19eb('0x5')](),controller[_0x19eb('0xa')]);router[_0x19eb('0x3')](_0x19eb('0xb'),auth[_0x19eb('0x5')](),controller[_0x19eb('0xc')]);router[_0x19eb('0x3')]('/mail/queues',auth[_0x19eb('0x5')](),controller['mailQueues']);router[_0x19eb('0x3')](_0x19eb('0xd'),auth[_0x19eb('0x5')](),controller[_0x19eb('0xe')]);router['get'](_0x19eb('0xf'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x10')]);router[_0x19eb('0x3')](_0x19eb('0x11'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x12')]);router[_0x19eb('0x3')]('/whatsapp/queues',auth[_0x19eb('0x5')](),controller['whatsappQueues']);router[_0x19eb('0x3')](_0x19eb('0x13'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x14')]);router['get'](_0x19eb('0x15'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x16')]);router['get'](_0x19eb('0x17'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x18')]);router[_0x19eb('0x3')](_0x19eb('0x19'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x1a')]);router[_0x19eb('0x3')](_0x19eb('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x19eb('0x3')](_0x19eb('0x1c'),auth[_0x19eb('0x5')](),controller['voiceQueuesChannelRedirect']);router[_0x19eb('0x3')](_0x19eb('0x1d'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x1e')]);router[_0x19eb('0x1f')](_0x19eb('0x1d'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x20')]);router[_0x19eb('0x3')](_0x19eb('0x21'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x22')]);router[_0x19eb('0x3')](_0x19eb('0x23'),auth['isAuthenticated'](),controller[_0x19eb('0x24')]);router[_0x19eb('0x3')](_0x19eb('0x25'),auth['isAuthenticated'](),controller[_0x19eb('0x26')]);router[_0x19eb('0x1f')]('/agents/:id/capacity',auth[_0x19eb('0x5')](),controller['agentCapacity']);router[_0x19eb('0x3')](_0x19eb('0x27'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x28')]);router[_0x19eb('0x3')](_0x19eb('0x29'),auth[_0x19eb('0x5')](),controller['trunks']);router[_0x19eb('0x3')](_0x19eb('0x2a'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x2b')]);router[_0x19eb('0x3')](_0x19eb('0x2c'),auth['isAuthenticated'](),controller[_0x19eb('0x2d')]);router[_0x19eb('0x3')](_0x19eb('0x2e'),auth['isAuthenticated'](),controller[_0x19eb('0x2f')]);router[_0x19eb('0x3')]('/mail/queues/waitinginteractions',auth[_0x19eb('0x5')](),controller[_0x19eb('0x30')]);router[_0x19eb('0x3')]('/openchannel/queues/waitinginteractions',auth[_0x19eb('0x5')](),controller[_0x19eb('0x31')]);router['get'](_0x19eb('0x32'),auth[_0x19eb('0x5')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x19eb('0x3')]('/sms/queues/waitinginteractions',auth[_0x19eb('0x5')](),controller[_0x19eb('0x33')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x19eb('0x5')](),controller[_0x19eb('0x34')]);router[_0x19eb('0x3')](_0x19eb('0x35'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x36')]);router[_0x19eb('0x37')](_0x19eb('0x38'),auth['isAuthenticated'](),controller[_0x19eb('0x39')](_0x19eb('0x3a')));router['get'](_0x19eb('0x3b'),auth[_0x19eb('0x5')](),controller['showMailQueues']);router[_0x19eb('0x37')](_0x19eb('0x3c'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x39')](_0x19eb('0x3d')));router[_0x19eb('0x3')](_0x19eb('0x3e'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x3f')]);router[_0x19eb('0x37')](_0x19eb('0x40'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x39')](_0x19eb('0x41')));router[_0x19eb('0x3')](_0x19eb('0x42'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x19eb('0x37')](_0x19eb('0x43'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x39')](_0x19eb('0x44')));router[_0x19eb('0x3')]('/openchannel/queues/:id',auth[_0x19eb('0x5')](),controller['showOpenchannelQueues']);router[_0x19eb('0x37')](_0x19eb('0x45'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x39')](_0x19eb('0x46')));router[_0x19eb('0x37')](_0x19eb('0x47'),auth[_0x19eb('0x5')](),controller[_0x19eb('0x39')](_0x19eb('0x48')));router[_0x19eb('0x3')]('/sms/queues/:id',auth[_0x19eb('0x5')](),controller['showSmsQueues']);router[_0x19eb('0x3')](_0x19eb('0x49'),auth['isAuthenticated'](),controller[_0x19eb('0x4a')]);router[_0x19eb('0x37')](_0x19eb('0x4b'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x19eb('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 91821fa..4c245aa 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 _0xee50=['jayson/promise','http','client','request','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','updateAttributes','MemberReport','findOrCreate','interface','format','SIP/%s','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','User','agent','Agent\x20not\x20found','MessageId','Start','bluebird','util','../../mysqldb','../../config/logger','api'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xee50,0xff));var _0x0ee5=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xee50[_0x21549c];return _0x426cbd;};'use strict';var BPromise=require(_0x0ee5('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x0ee5('0x1'));var db=require(_0x0ee5('0x2'))['db'];var logger=require(_0x0ee5('0x3'))(_0x0ee5('0x4'));var jayson=require(_0x0ee5('0x5'));var amiClient=jayson['client'][_0x0ee5('0x6')]({'port':0x232a});var mailClient=jayson[_0x0ee5('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x0ee5('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1ca27f,_0x511583,_0x13f02a){return new BPromise(function(_0x45f084,_0x27827e){var _0x439ff7=_0x13f02a?_0x13f02a:amiClient;return _0x439ff7[_0x0ee5('0x8')](_0x1ca27f,_0x511583)['then'](function(_0x541cd3){if(_0x541cd3[_0x0ee5('0x9')]){if(_0x541cd3[_0x0ee5('0x9')][_0x0ee5('0xa')]===0x1f4){return _0x27827e(_0x541cd3['error']['message']);}return _0x45f084(_0x541cd3[_0x0ee5('0x9')][_0x0ee5('0xb')]);}else{_0x45f084(_0x541cd3[_0x0ee5('0xc')]);}})[_0x0ee5('0xd')](function(_0x53662c){_0x27827e(_0x53662c);});});}function respondWithResult(_0x166413,_0x3f3aa8){_0x3f3aa8=_0x3f3aa8||0xc8;return function(_0x501006){if(_0x501006){return _0x166413[_0x0ee5('0xe')](_0x3f3aa8)[_0x0ee5('0xf')](_0x501006);}return _0x166413[_0x0ee5('0x10')](0x194);};}function handleError(_0xbe6363,_0x19418d){_0x19418d=_0x19418d||0x1f4;return function(_0x24983c){logger[_0x0ee5('0x9')](_0x24983c[_0x0ee5('0x11')]);if(_0x24983c[_0x0ee5('0x12')]){delete _0x24983c[_0x0ee5('0x12')];}_0xbe6363[_0x0ee5('0xe')](_0x19418d)[_0x0ee5('0x13')](_0x24983c);};}function findById(_0x5e2e73){return function(_0x3cb6d9){if(!_[_0x0ee5('0x14')](_0x5e2e73)&&!_[_0x0ee5('0x14')](_0x3cb6d9)&&!_[_0x0ee5('0x14')](_0x3cb6d9[_0x0ee5('0x15')])){return _[_0x0ee5('0x16')](_0x3cb6d9[_0x0ee5('0x15')],function(_0x80c231){return _0x80c231['id']==_0x5e2e73;});}return null;};}exports[_0x0ee5('0x17')]=function(_0x4acf47,_0x2a5430){return respondWithRpcPromise(_0x0ee5('0x18'),_0x4acf47['query'])[_0x0ee5('0x19')](respondWithResult(_0x2a5430,null))[_0x0ee5('0xd')](handleError(_0x2a5430,null));};exports[_0x0ee5('0x1a')]=function(_0x34637e,_0x181226){return respondWithRpcPromise(_0x0ee5('0x1b'),_[_0x0ee5('0x1c')](_0x34637e[_0x0ee5('0x1d')],_0x34637e[_0x0ee5('0x1e')]))['then'](respondWithResult(_0x181226,null))[_0x0ee5('0xd')](handleError(_0x181226,null));};exports[_0x0ee5('0x1f')]=function(_0x314a9a,_0x358e31){return respondWithRpcPromise(_0x0ee5('0x20'),_[_0x0ee5('0x1c')](_0x314a9a['query'],_0x314a9a[_0x0ee5('0x1e')]))[_0x0ee5('0x19')](respondWithResult(_0x358e31,null))[_0x0ee5('0xd')](handleError(_0x358e31,null));};exports['voiceQueues']=function(_0xef38db,_0x1c9413){return respondWithRpcPromise('VoiceQueues',_0xef38db[_0x0ee5('0x1d')])[_0x0ee5('0x19')](respondWithResult(_0x1c9413,null))['catch'](handleError(_0x1c9413,null));};exports['showVoiceQueues']=function(_0x4bfdba,_0x2cfe94){return respondWithRpcPromise(_0x0ee5('0x21'),_0x4bfdba[_0x0ee5('0x1d')])['then'](findById(_0x4bfdba[_0x0ee5('0x1e')]['id']))[_0x0ee5('0x19')](respondWithResult(_0x2cfe94,null))[_0x0ee5('0xd')](handleError(_0x2cfe94,null));};exports[_0x0ee5('0x22')]=function(_0x1b27ff,_0x5e22f0){return respondWithRpcPromise(_0x0ee5('0x23'),_[_0x0ee5('0x1c')](_0x1b27ff[_0x0ee5('0x24')],_0x1b27ff['params']))[_0x0ee5('0x19')](respondWithResult(_0x5e22f0,null))['catch'](handleError(_0x5e22f0,null));};exports[_0x0ee5('0x25')]=function(_0x2c4f7b,_0x30fd00){return respondWithRpcPromise(_0x0ee5('0x26'),_[_0x0ee5('0x1c')](_0x2c4f7b['query'],_0x2c4f7b['params']))[_0x0ee5('0x19')](respondWithResult(_0x30fd00,null))[_0x0ee5('0xd')](handleError(_0x30fd00,null));};exports['voiceQueuesChannels']=function(_0x3b65d6,_0x20c56b){return respondWithRpcPromise(_0x0ee5('0x27'),_0x3b65d6[_0x0ee5('0x1d')])['then'](respondWithResult(_0x20c56b,null))[_0x0ee5('0xd')](handleError(_0x20c56b,null));};exports[_0x0ee5('0x28')]=function(_0x552239,_0x521861){return respondWithRpcPromise(_0x0ee5('0x29'),_[_0x0ee5('0x1c')](_0x552239['query'],_0x552239[_0x0ee5('0x1e')]))[_0x0ee5('0x19')](respondWithResult(_0x521861,null))[_0x0ee5('0xd')](handleError(_0x521861,null));};exports[_0x0ee5('0x2a')]=function(_0x2349a3,_0x2d2433){return respondWithRpcPromise(_0x0ee5('0x2b'),_['merge'](_0x2349a3[_0x0ee5('0x1d')],_0x2349a3[_0x0ee5('0x1e')]))[_0x0ee5('0x19')](respondWithResult(_0x2d2433,null))[_0x0ee5('0xd')](handleError(_0x2d2433,null));};exports[_0x0ee5('0x2c')]=function(_0x4b0a60,_0x2e2772){return respondWithRpcPromise(_0x0ee5('0x2d'),_[_0x0ee5('0x1c')](_0x4b0a60[_0x0ee5('0x1d')],_0x4b0a60[_0x0ee5('0x1e')]))['then'](respondWithResult(_0x2e2772,null))['catch'](handleError(_0x2e2772,null));};exports[_0x0ee5('0x2e')]=function(_0x579662,_0x4b2f35){return respondWithRpcPromise(_0x0ee5('0x2f'),_0x579662['query'])[_0x0ee5('0x19')](respondWithResult(_0x4b2f35,null))[_0x0ee5('0xd')](handleError(_0x4b2f35,null));};exports[_0x0ee5('0x30')]=function(_0x5b927b,_0x213d50){return respondWithRpcPromise(_0x0ee5('0x31'),_0x5b927b['query'])[_0x0ee5('0x19')](respondWithResult(_0x213d50,null))[_0x0ee5('0xd')](handleError(_0x213d50,null));};exports['agents']=function(_0x553043,_0x4f6980){var _0x41a9e5;return respondWithRpcPromise(_0x0ee5('0x32'),_0x553043[_0x0ee5('0x1d')])[_0x0ee5('0x19')](function(_0x335291){_0x41a9e5=_0x335291;return respondWithRpcPromise('Agents',_0x553043[_0x0ee5('0x1d')],routingClient);})['then'](function(_0x590e6a){return _[_0x0ee5('0x1c')]({},_0x590e6a,_0x41a9e5);})[_0x0ee5('0x19')](respondWithResult(_0x4f6980,null))[_0x0ee5('0xd')](handleError(_0x4f6980,null));};exports[_0x0ee5('0x33')]=function(_0x3476e2,_0x173cd5){if(_0x3476e2[_0x0ee5('0x24')]&&_0x3476e2[_0x0ee5('0x24')][_0x0ee5('0x34')]&&_0x3476e2[_0x0ee5('0x35')]&&_0x3476e2[_0x0ee5('0x35')][_0x0ee5('0x12')]){for(var _0x3394f7 in _0x3476e2[_0x0ee5('0x24')][_0x0ee5('0x34')]){if(_0x3476e2[_0x0ee5('0x24')]['interaction'][_0x0ee5('0x36')](_0x3394f7)){db['MemberReport'][_0x0ee5('0x37')]({'where':{'channel':_0x3394f7,'membername':_0x3476e2[_0x0ee5('0x35')][_0x0ee5('0x12')],'type':_0x0ee5('0x38'),'exitAt':null,'uniqueid':_0x3476e2['body'][_0x0ee5('0x34')][_0x3394f7]&&_0x3476e2[_0x0ee5('0x24')]['interaction'][_0x3394f7][_0x0ee5('0x39')]?{'$notIn':_0x3476e2['body']['interaction'][_0x3394f7]}:{'$ne':null}}})[_0x0ee5('0x19')](function(_0x28d6e3){var _0x18f278=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1111ac=0x0,_0x410429=_0x28d6e3[_0x0ee5('0x39')];_0x1111ac<_0x410429;_0x1111ac+=0x1){_0x28d6e3[_0x1111ac][_0x0ee5('0x3a')]({'exitAt':_0x18f278});}});for(var _0x38f1ec=0x0;_0x38f1ec<_0x3476e2[_0x0ee5('0x24')][_0x0ee5('0x34')][_0x3394f7]['length'];_0x38f1ec+=0x1){db[_0x0ee5('0x3b')][_0x0ee5('0x3c')]({'where':{'channel':_0x3394f7,'membername':_0x3476e2['user'][_0x0ee5('0x12')],'type':_0x0ee5('0x38'),'uniqueid':_0x3476e2[_0x0ee5('0x24')][_0x0ee5('0x34')][_0x3394f7][_0x38f1ec],'exitAt':null},'defaults':{'channel':_0x3394f7,'membername':_0x3476e2[_0x0ee5('0x35')][_0x0ee5('0x12')],'interface':_[_0x0ee5('0x14')](_0x3476e2[_0x0ee5('0x35')][_0x0ee5('0x3d')])?util[_0x0ee5('0x3e')](_0x0ee5('0x3f'),_0x3476e2[_0x0ee5('0x35')]['name']):_0x3476e2[_0x0ee5('0x35')][_0x0ee5('0x3d')],'type':_0x0ee5('0x38'),'enterAt':moment()[_0x0ee5('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3476e2[_0x0ee5('0x35')]['internal'],'uniqueid':_0x3476e2['body'][_0x0ee5('0x34')][_0x3394f7][_0x38f1ec]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3476e2[_0x0ee5('0x1e')]['id'],'capacity':_0x3476e2[_0x0ee5('0x24')][_0x0ee5('0x40')]},routingClient)[_0x0ee5('0x19')](respondWithResult(_0x173cd5,null))[_0x0ee5('0xd')](handleError(_0x173cd5,null));};exports[_0x0ee5('0x41')]=function(_0x317eb5,_0x3359a4){return respondWithRpcPromise(_0x0ee5('0x42'),_0x317eb5[_0x0ee5('0x1d')])[_0x0ee5('0x19')](respondWithResult(_0x3359a4,null))['catch'](handleError(_0x3359a4,null));};exports[_0x0ee5('0x43')]=function(_0x4402ac,_0x20577f){return respondWithRpcPromise(_0x0ee5('0x44'),_0x4402ac[_0x0ee5('0x1d')])['then'](respondWithResult(_0x20577f,null))[_0x0ee5('0xd')](handleError(_0x20577f,null));};exports['campaigns']=function(_0x3a2713,_0xe3749c){return respondWithRpcPromise(_0x0ee5('0x45'),_0x3a2713['query'])['then'](respondWithResult(_0xe3749c,null))[_0x0ee5('0xd')](handleError(_0xe3749c,null));};exports[_0x0ee5('0x46')]=function(_0x146120,_0x195d62){return respondWithRpcPromise(_0x0ee5('0x47'),_0x146120[_0x0ee5('0x1d')],routingClient)['then'](respondWithResult(_0x195d62,null))[_0x0ee5('0xd')](handleError(_0x195d62,null));};exports['showChatQueues']=function(_0x34d78e,_0x3104a9){return respondWithRpcPromise('ChatQueues',_0x34d78e[_0x0ee5('0x1d')],routingClient)['then'](findById(_0x34d78e[_0x0ee5('0x1e')]['id']))[_0x0ee5('0x19')](respondWithResult(_0x3104a9,null))['catch'](handleError(_0x3104a9,null));};exports[_0x0ee5('0x48')]=function(_0x4cfab5,_0x3404f9){return respondWithRpcPromise(_0x0ee5('0x49'),_0x4cfab5['query'],routingClient)[_0x0ee5('0x19')](respondWithResult(_0x3404f9,null))[_0x0ee5('0xd')](handleError(_0x3404f9,null));};exports['showMailQueues']=function(_0x44a1fd,_0x27e1c5){return respondWithRpcPromise(_0x0ee5('0x49'),_0x44a1fd[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](findById(_0x44a1fd[_0x0ee5('0x1e')]['id']))[_0x0ee5('0x19')](respondWithResult(_0x27e1c5,null))[_0x0ee5('0xd')](handleError(_0x27e1c5,null));};exports[_0x0ee5('0x4a')]=function(_0x1f5eaf,_0x2ec966){return respondWithRpcPromise('MailAccounts',_0x1f5eaf[_0x0ee5('0x1d')],mailClient)['then'](respondWithResult(_0x2ec966,null))['catch'](handleError(_0x2ec966,null));};exports[_0x0ee5('0x4b')]=function(_0x3c7292,_0xdecc95){return respondWithRpcPromise(_0x0ee5('0x4c'),_0x3c7292[_0x0ee5('0x1d')],routingClient)['then'](respondWithResult(_0xdecc95,null))[_0x0ee5('0xd')](handleError(_0xdecc95,null));};exports[_0x0ee5('0x4d')]=function(_0x35e20a,_0x13bb6e){return respondWithRpcPromise(_0x0ee5('0x4c'),_0x35e20a['query'],routingClient)[_0x0ee5('0x19')](findById(_0x35e20a[_0x0ee5('0x1e')]['id']))[_0x0ee5('0x19')](respondWithResult(_0x13bb6e,null))['catch'](handleError(_0x13bb6e,null));};exports['smsQueues']=function(_0x3308df,_0x3adfee){return respondWithRpcPromise(_0x0ee5('0x4e'),_0x3308df[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](respondWithResult(_0x3adfee,null))[_0x0ee5('0xd')](handleError(_0x3adfee,null));};exports[_0x0ee5('0x4f')]=function(_0x2d1c6a,_0x3d24ac){return respondWithRpcPromise(_0x0ee5('0x4e'),_0x2d1c6a['query'],routingClient)['then'](findById(_0x2d1c6a['params']['id']))[_0x0ee5('0x19')](respondWithResult(_0x3d24ac,null))[_0x0ee5('0xd')](handleError(_0x3d24ac,null));};exports[_0x0ee5('0x50')]=function(_0x2409c6,_0xaa0cd1){return respondWithRpcPromise(_0x0ee5('0x51'),_0x2409c6['query'],routingClient)['then'](respondWithResult(_0xaa0cd1,null))[_0x0ee5('0xd')](handleError(_0xaa0cd1,null));};exports[_0x0ee5('0x52')]=function(_0x2ad8a1,_0x4f7d2c){return respondWithRpcPromise(_0x0ee5('0x51'),_0x2ad8a1[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](findById(_0x2ad8a1[_0x0ee5('0x1e')]['id']))[_0x0ee5('0x19')](respondWithResult(_0x4f7d2c,null))[_0x0ee5('0xd')](handleError(_0x4f7d2c,null));};exports[_0x0ee5('0x53')]=function(_0x3e9ae6,_0x564b89){return respondWithRpcPromise(_0x0ee5('0x54'),_0x3e9ae6[_0x0ee5('0x1d')],routingClient)['then'](respondWithResult(_0x564b89,null))[_0x0ee5('0xd')](handleError(_0x564b89,null));};exports[_0x0ee5('0x55')]=function(_0x473483,_0x440833){return respondWithRpcPromise(_0x0ee5('0x54'),_0x473483[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](findById(_0x473483[_0x0ee5('0x1e')]['id']))['then'](respondWithResult(_0x440833,null))[_0x0ee5('0xd')](handleError(_0x440833,null));};exports[_0x0ee5('0x56')]=function(_0x1b7ab4,_0x5078a8){return respondWithRpcPromise(_0x0ee5('0x57'),_0x1b7ab4['query'])[_0x0ee5('0x19')](respondWithResult(_0x5078a8,null))[_0x0ee5('0xd')](handleError(_0x5078a8,null));};exports[_0x0ee5('0x58')]=function(_0x233f3b,_0x3fb342){return respondWithRpcPromise(_0x0ee5('0x59'),_0x233f3b[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](respondWithResult(_0x3fb342,null))[_0x0ee5('0xd')](handleError(_0x3fb342,null));};exports[_0x0ee5('0x5a')]=function(_0x29241b,_0x435a9c){return respondWithRpcPromise(_0x0ee5('0x5b'),_0x29241b[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](respondWithResult(_0x435a9c,null))[_0x0ee5('0xd')](handleError(_0x435a9c,null));};exports[_0x0ee5('0x5c')]=function(_0x22cba3,_0x3a51d1){return respondWithRpcPromise(_0x0ee5('0x5d'),_0x22cba3[_0x0ee5('0x1d')],routingClient)['then'](respondWithResult(_0x3a51d1,null))['catch'](handleError(_0x3a51d1,null));};exports[_0x0ee5('0x5e')]=function(_0x384984,_0x52b525){return respondWithRpcPromise(_0x0ee5('0x5d'),_0x384984[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](function(_0x55ab4c){if(_0x384984[_0x0ee5('0x1d')][_0x0ee5('0x5f')]!==undefined){var _0x3850b6=_(_0x55ab4c[_0x0ee5('0x15')])[_0x0ee5('0x60')]([_0x384984['query'][_0x0ee5('0x5f')],_0x384984[_0x0ee5('0x1e')]['id']])['map'](_0x0ee5('0x61'))['uniq']()[_0x0ee5('0x62')]();return _0x55ab4c['rows'][_0x0ee5('0x60')](function(_0x594039){return _0x3850b6['indexOf'](_0x594039[_0x0ee5('0x61')])>-0x1;});}else{return _0x55ab4c[_0x0ee5('0x15')][_0x0ee5('0x60')](function(_0x5d3eaa){return _0x5d3eaa[_0x0ee5('0x61')]===parseInt(_0x384984[_0x0ee5('0x1e')]['id']);});}})[_0x0ee5('0x19')](respondWithResult(_0x52b525,null))[_0x0ee5('0xd')](handleError(_0x52b525,null));};exports[_0x0ee5('0x63')]=function(_0x5ec531,_0x1449b4){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5ec531[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](respondWithResult(_0x1449b4,null))[_0x0ee5('0xd')](handleError(_0x1449b4,null));};exports[_0x0ee5('0x64')]=function(_0xab76e4,_0xca032c){return respondWithRpcPromise(_0x0ee5('0x65'),_0xab76e4[_0x0ee5('0x1d')],routingClient)[_0x0ee5('0x19')](respondWithResult(_0xca032c,null))[_0x0ee5('0xd')](handleError(_0xca032c,null));};exports[_0x0ee5('0x66')]=function(_0x21c41a,_0x44da48){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x21c41a[_0x0ee5('0x1d')],routingClient)['then'](respondWithResult(_0x44da48,null))[_0x0ee5('0xd')](handleError(_0x44da48,null));};exports[_0x0ee5('0x67')]=function(_0x102c91){return function(_0x2cbbe1,_0x50cf00){var _0x8caa80,_0x399838;var _0x50caea=_[_0x0ee5('0x68')](_0x102c91);var _0x2e1d7d=_0x102c91===_0x0ee5('0x69')?_0x0ee5('0x6a'):'Account';return db[_0x50caea+_0x0ee5('0x6b')][_0x0ee5('0x6c')]({'raw':!![],'where':{'id':_0x2cbbe1[_0x0ee5('0x1e')]['id']}})[_0x0ee5('0x19')](function(_0x5a0a0b){if(_['isNil'](_0x5a0a0b)){throw new Error(_0x50caea+_0x0ee5('0x6d'));}_0x8caa80=_0x5a0a0b;return db[_0x50caea+_0x0ee5('0x6e')][_0x0ee5('0x6c')]({'where':{'id':_0x2cbbe1[_0x0ee5('0x24')][_0x0ee5('0x6f')]},'include':[{'model':db[_0x50caea+_0x0ee5('0x70')],'as':'Interaction'},{'model':db[_0x50caea+_0x2e1d7d],'as':_0x0ee5('0x71')}]});})[_0x0ee5('0x19')](function(_0x4bcb21){if(_[_0x0ee5('0x14')](_0x4bcb21)){throw new Error(_0x50caea+_0x0ee5('0x72'));}_0x399838=_0x4bcb21;return _0x4bcb21[_0x0ee5('0x73')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0ee5('0x19')](function(){var _0x2e9d25={'uniqueid':_0x102c91+'.'+_0x399838['id']+'.'+_0x399838[_0x0ee5('0x70')]['id'],'FromUserId':_0x2cbbe1[_0x0ee5('0x35')]['id'],'type':_0x0ee5('0x74')};_0x2e9d25[_0x50caea+'MessageId']=_0x399838['id'];_0x2e9d25[_0x50caea+_0x0ee5('0x75')]=_0x399838[_0x0ee5('0x70')]['id'];_0x2e9d25[_0x0ee5('0x76')+_0x50caea+_0x2e1d7d+'Id']=_0x399838['Account']['id'];_0x2e9d25['To'+_0x50caea+_0x0ee5('0x77')]=_0x8caa80['id'];return db[_0x50caea+_0x0ee5('0x78')][_0x0ee5('0x79')](_0x2e9d25);})[_0x0ee5('0x19')](function(){return respondWithRpcPromise('Start',{'channel':_0x102c91,'interaction':_0x399838[_0x0ee5('0x70')],'message':_0x399838,'account':_0x399838['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x0ee5('0x74'),'appdata':_0x8caa80['name']+','+(_0x399838[_0x0ee5('0x71')]['queueTransferTimeout']||0x12c),'interval':_0x0ee5('0x7a')}]},routingClient);})[_0x0ee5('0x19')](respondWithResult(_0x50cf00,null))['catch'](handleError(_0x50cf00,null));};};exports[_0x0ee5('0x7b')]=function(_0x2bd4b0,_0x1faf71){var _0x4dcc9f,_0x18fd82;if(_['isNil'](_0x2bd4b0[_0x0ee5('0x24')][_0x0ee5('0x7c')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x220e2b=_0x2bd4b0['body'][_0x0ee5('0x7c')];var _0x178ec1=_[_0x0ee5('0x68')](_0x220e2b);var _0x26dfc7=_0x220e2b===_0x0ee5('0x69')?_0x0ee5('0x6a'):_0x0ee5('0x71');return db[_0x0ee5('0x7d')][_0x0ee5('0x6c')]({'raw':!![],'where':{'id':_0x2bd4b0[_0x0ee5('0x1e')]['id'],'role':_0x0ee5('0x7e')}})[_0x0ee5('0x19')](function(_0x4ed95c){if(_['isNil'](_0x4ed95c)){throw new Error(_0x0ee5('0x7f'));}_0x4dcc9f=_0x4ed95c;return db[_0x178ec1+_0x0ee5('0x6e')][_0x0ee5('0x6c')]({'where':{'id':_0x2bd4b0[_0x0ee5('0x24')]['messageId']},'include':[{'model':db[_0x178ec1+_0x0ee5('0x70')],'as':'Interaction'},{'model':db[_0x178ec1+_0x26dfc7],'as':_0x0ee5('0x71')}]});})[_0x0ee5('0x19')](function(_0x1d8b4b){if(_['isNil'](_0x1d8b4b)){throw new Error(_0x178ec1+_0x0ee5('0x72'));}_0x18fd82=_0x1d8b4b;return _0x1d8b4b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0ee5('0x19')](function(){var _0xff56cd={'uniqueid':_0x220e2b+'.'+_0x18fd82['id']+'.'+_0x18fd82[_0x0ee5('0x70')]['id'],'FromUserId':_0x2bd4b0[_0x0ee5('0x35')]['id'],'type':_0x0ee5('0x7e'),'ToUserId':_0x4dcc9f['id']};_0xff56cd[_0x178ec1+_0x0ee5('0x80')]=_0x18fd82['id'];_0xff56cd[_0x178ec1+_0x0ee5('0x75')]=_0x18fd82[_0x0ee5('0x70')]['id'];_0xff56cd[_0x0ee5('0x76')+_0x178ec1+_0x26dfc7+'Id']=_0x18fd82[_0x0ee5('0x71')]['id'];return db[_0x178ec1+'TransferReport']['create'](_0xff56cd);})[_0x0ee5('0x19')](function(){return respondWithRpcPromise(_0x0ee5('0x81'),{'channel':_0x220e2b,'interaction':_0x18fd82['Interaction'],'message':_0x18fd82,'account':_0x18fd82[_0x0ee5('0x71')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0ee5('0x7e'),'appdata':_0x4dcc9f[_0x0ee5('0x12')]+','+(_0x18fd82[_0x0ee5('0x71')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x0ee5('0x19')](respondWithResult(_0x1faf71,null))[_0x0ee5('0xd')](handleError(_0x1faf71,null));}; \ No newline at end of file +var _0x5c0b=['mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','uniq','value','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','findOne','Message','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','messageId','From','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','jayson/promise','client','http','request','then','error','code','message','catch','sendStatus','stack','name','status','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','capacity','telephones','Trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5c0b,0x12a));var _0xb5c0=function(_0xf6ea6f,_0x2afef5){_0xf6ea6f=_0xf6ea6f-0x0;var _0x5c2515=_0x5c0b[_0xf6ea6f];return _0x5c2515;};'use strict';var BPromise=require(_0xb5c0('0x0'));var moment=require('moment');var _=require(_0xb5c0('0x1'));var util=require(_0xb5c0('0x2'));var db=require(_0xb5c0('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xb5c0('0x4'));var amiClient=jayson[_0xb5c0('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xb5c0('0x5')][_0xb5c0('0x6')]({'port':0x232b});var routingClient=jayson[_0xb5c0('0x5')][_0xb5c0('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x5391c4,_0x3341ac,_0x10071d){return new BPromise(function(_0x1e89f5,_0x2edf38){var _0x1a51e3=_0x10071d?_0x10071d:amiClient;return _0x1a51e3[_0xb5c0('0x7')](_0x5391c4,_0x3341ac)[_0xb5c0('0x8')](function(_0x97a2c9){if(_0x97a2c9[_0xb5c0('0x9')]){if(_0x97a2c9[_0xb5c0('0x9')][_0xb5c0('0xa')]===0x1f4){return _0x2edf38(_0x97a2c9[_0xb5c0('0x9')][_0xb5c0('0xb')]);}return _0x1e89f5(_0x97a2c9['error'][_0xb5c0('0xb')]);}else{_0x1e89f5(_0x97a2c9['result']);}})[_0xb5c0('0xc')](function(_0x18ade1){_0x2edf38(_0x18ade1);});});}function respondWithResult(_0x565d62,_0x5a2319){_0x5a2319=_0x5a2319||0xc8;return function(_0x337c61){if(_0x337c61){return _0x565d62['status'](_0x5a2319)['json'](_0x337c61);}return _0x565d62[_0xb5c0('0xd')](0x194);};}function handleError(_0x1f3334,_0x8ab22b){_0x8ab22b=_0x8ab22b||0x1f4;return function(_0x20d3f6){logger['error'](_0x20d3f6[_0xb5c0('0xe')]);if(_0x20d3f6[_0xb5c0('0xf')]){delete _0x20d3f6[_0xb5c0('0xf')];}_0x1f3334[_0xb5c0('0x10')](_0x8ab22b)[_0xb5c0('0x11')](_0x20d3f6);};}function findById(_0x413eef){return function(_0x1c404b){if(!_[_0xb5c0('0x12')](_0x413eef)&&!_[_0xb5c0('0x12')](_0x1c404b)&&!_[_0xb5c0('0x12')](_0x1c404b[_0xb5c0('0x13')])){return _['find'](_0x1c404b[_0xb5c0('0x13')],function(_0x5c5951){return _0x5c5951['id']==_0x413eef;});}return null;};}exports[_0xb5c0('0x14')]=function(_0x465325,_0x5cd8d0){return respondWithRpcPromise(_0xb5c0('0x15'),_0x465325[_0xb5c0('0x16')])['then'](respondWithResult(_0x5cd8d0,null))['catch'](handleError(_0x5cd8d0,null));};exports[_0xb5c0('0x17')]=function(_0x8e8aef,_0x101821){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xb5c0('0x18')](_0x8e8aef[_0xb5c0('0x16')],_0x8e8aef['params']))[_0xb5c0('0x8')](respondWithResult(_0x101821,null))[_0xb5c0('0xc')](handleError(_0x101821,null));};exports[_0xb5c0('0x19')]=function(_0x32a07d,_0x3c5c00){return respondWithRpcPromise(_0xb5c0('0x1a'),_[_0xb5c0('0x18')](_0x32a07d[_0xb5c0('0x16')],_0x32a07d[_0xb5c0('0x1b')]))[_0xb5c0('0x8')](respondWithResult(_0x3c5c00,null))['catch'](handleError(_0x3c5c00,null));};exports[_0xb5c0('0x1c')]=function(_0x5679c0,_0x56f62a){return respondWithRpcPromise(_0xb5c0('0x1d'),_0x5679c0[_0xb5c0('0x16')])['then'](respondWithResult(_0x56f62a,null))[_0xb5c0('0xc')](handleError(_0x56f62a,null));};exports[_0xb5c0('0x1e')]=function(_0x2f8924,_0x39c8b2){return respondWithRpcPromise('VoiceQueues',_0x2f8924['query'])[_0xb5c0('0x8')](findById(_0x2f8924[_0xb5c0('0x1b')]['id']))[_0xb5c0('0x8')](respondWithResult(_0x39c8b2,null))[_0xb5c0('0xc')](handleError(_0x39c8b2,null));};exports[_0xb5c0('0x1f')]=function(_0x5efab5,_0x5249ca){return respondWithRpcPromise(_0xb5c0('0x20'),_[_0xb5c0('0x18')](_0x5efab5[_0xb5c0('0x21')],_0x5efab5[_0xb5c0('0x1b')]))[_0xb5c0('0x8')](respondWithResult(_0x5249ca,null))[_0xb5c0('0xc')](handleError(_0x5249ca,null));};exports['voiceQueuesPreview']=function(_0x4eba1b,_0x44a54e){return respondWithRpcPromise(_0xb5c0('0x22'),_[_0xb5c0('0x18')](_0x4eba1b[_0xb5c0('0x16')],_0x4eba1b[_0xb5c0('0x1b')]))[_0xb5c0('0x8')](respondWithResult(_0x44a54e,null))[_0xb5c0('0xc')](handleError(_0x44a54e,null));};exports['voiceQueuesChannels']=function(_0x46c511,_0xa2e4d4){return respondWithRpcPromise('VoiceQueuesChannels',_0x46c511[_0xb5c0('0x16')])[_0xb5c0('0x8')](respondWithResult(_0xa2e4d4,null))[_0xb5c0('0xc')](handleError(_0xa2e4d4,null));};exports[_0xb5c0('0x23')]=function(_0x2938b1,_0xafbe47){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x2938b1[_0xb5c0('0x16')],_0x2938b1[_0xb5c0('0x1b')]))[_0xb5c0('0x8')](respondWithResult(_0xafbe47,null))[_0xb5c0('0xc')](handleError(_0xafbe47,null));};exports[_0xb5c0('0x24')]=function(_0x1a1aab,_0x98a2f){return respondWithRpcPromise(_0xb5c0('0x25'),_[_0xb5c0('0x18')](_0x1a1aab[_0xb5c0('0x16')],_0x1a1aab['params']))[_0xb5c0('0x8')](respondWithResult(_0x98a2f,null))[_0xb5c0('0xc')](handleError(_0x98a2f,null));};exports[_0xb5c0('0x26')]=function(_0x4dbe77,_0xa86f7a){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xb5c0('0x18')](_0x4dbe77['query'],_0x4dbe77[_0xb5c0('0x1b')]))['then'](respondWithResult(_0xa86f7a,null))['catch'](handleError(_0xa86f7a,null));};exports[_0xb5c0('0x27')]=function(_0x2c39a4,_0xa8a01e){return respondWithRpcPromise(_0xb5c0('0x28'),_0x2c39a4[_0xb5c0('0x16')])[_0xb5c0('0x8')](respondWithResult(_0xa8a01e,null))[_0xb5c0('0xc')](handleError(_0xa8a01e,null));};exports['outboundChannels']=function(_0x5f1cec,_0x553f25){return respondWithRpcPromise(_0xb5c0('0x29'),_0x5f1cec[_0xb5c0('0x16')])['then'](respondWithResult(_0x553f25,null))['catch'](handleError(_0x553f25,null));};exports[_0xb5c0('0x2a')]=function(_0x11873e,_0x45456b){var _0x8a7e92;return respondWithRpcPromise(_0xb5c0('0x2b'),_0x11873e[_0xb5c0('0x16')])[_0xb5c0('0x8')](function(_0x468d9f){_0x8a7e92=_0x468d9f;return respondWithRpcPromise(_0xb5c0('0x2b'),_0x11873e[_0xb5c0('0x16')],routingClient);})[_0xb5c0('0x8')](function(_0x529cdc){return _['merge']({},_0x529cdc,_0x8a7e92);})['then'](respondWithResult(_0x45456b,null))[_0xb5c0('0xc')](handleError(_0x45456b,null));};exports[_0xb5c0('0x2c')]=function(_0x12aa0a,_0x586ac0){if(_0x12aa0a[_0xb5c0('0x21')]&&_0x12aa0a[_0xb5c0('0x21')][_0xb5c0('0x2d')]&&_0x12aa0a[_0xb5c0('0x2e')]&&_0x12aa0a['user'][_0xb5c0('0xf')]){for(var _0x4a94e3 in _0x12aa0a['body']['interaction']){if(_0x12aa0a[_0xb5c0('0x21')][_0xb5c0('0x2d')]['hasOwnProperty'](_0x4a94e3)){db['MemberReport'][_0xb5c0('0x2f')]({'where':{'channel':_0x4a94e3,'membername':_0x12aa0a['user'][_0xb5c0('0xf')],'type':_0xb5c0('0x30'),'exitAt':null,'uniqueid':_0x12aa0a[_0xb5c0('0x21')]['interaction'][_0x4a94e3]&&_0x12aa0a[_0xb5c0('0x21')]['interaction'][_0x4a94e3][_0xb5c0('0x31')]?{'$notIn':_0x12aa0a[_0xb5c0('0x21')][_0xb5c0('0x2d')][_0x4a94e3]}:{'$ne':null}}})[_0xb5c0('0x8')](function(_0x380a90){var _0x19fdb9=moment()[_0xb5c0('0x32')](_0xb5c0('0x33'));for(var _0x42dc25=0x0,_0x26263e=_0x380a90[_0xb5c0('0x31')];_0x42dc25<_0x26263e;_0x42dc25+=0x1){_0x380a90[_0x42dc25][_0xb5c0('0x34')]({'exitAt':_0x19fdb9});}});for(var _0x17d334=0x0;_0x17d334<_0x12aa0a[_0xb5c0('0x21')][_0xb5c0('0x2d')][_0x4a94e3]['length'];_0x17d334+=0x1){db[_0xb5c0('0x35')][_0xb5c0('0x36')]({'where':{'channel':_0x4a94e3,'membername':_0x12aa0a[_0xb5c0('0x2e')][_0xb5c0('0xf')],'type':'INTERACTION','uniqueid':_0x12aa0a[_0xb5c0('0x21')][_0xb5c0('0x2d')][_0x4a94e3][_0x17d334],'exitAt':null},'defaults':{'channel':_0x4a94e3,'membername':_0x12aa0a[_0xb5c0('0x2e')][_0xb5c0('0xf')],'interface':_[_0xb5c0('0x12')](_0x12aa0a[_0xb5c0('0x2e')][_0xb5c0('0x37')])?util[_0xb5c0('0x32')](_0xb5c0('0x38'),_0x12aa0a['user'][_0xb5c0('0xf')]):_0x12aa0a[_0xb5c0('0x2e')][_0xb5c0('0x37')],'type':_0xb5c0('0x30'),'enterAt':moment()['format'](_0xb5c0('0x33')),'role':_0xb5c0('0x39'),'internal':_0x12aa0a[_0xb5c0('0x2e')][_0xb5c0('0x3a')],'uniqueid':_0x12aa0a['body'][_0xb5c0('0x2d')][_0x4a94e3][_0x17d334]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x12aa0a['params']['id'],'capacity':_0x12aa0a[_0xb5c0('0x21')][_0xb5c0('0x3b')]},routingClient)['then'](respondWithResult(_0x586ac0,null))['catch'](handleError(_0x586ac0,null));};exports[_0xb5c0('0x3c')]=function(_0x4733ef,_0x1f37c5){return respondWithRpcPromise('Telephones',_0x4733ef[_0xb5c0('0x16')])[_0xb5c0('0x8')](respondWithResult(_0x1f37c5,null))['catch'](handleError(_0x1f37c5,null));};exports['trunks']=function(_0x2a1796,_0x13f021){return respondWithRpcPromise(_0xb5c0('0x3d'),_0x2a1796['query'])[_0xb5c0('0x8')](respondWithResult(_0x13f021,null))['catch'](handleError(_0x13f021,null));};exports['campaigns']=function(_0x3e226e,_0x3eaef6){return respondWithRpcPromise(_0xb5c0('0x3e'),_0x3e226e['query'])[_0xb5c0('0x8')](respondWithResult(_0x3eaef6,null))[_0xb5c0('0xc')](handleError(_0x3eaef6,null));};exports[_0xb5c0('0x3f')]=function(_0x2faeee,_0x5b3b15){return respondWithRpcPromise(_0xb5c0('0x40'),_0x2faeee[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x5b3b15,null))[_0xb5c0('0xc')](handleError(_0x5b3b15,null));};exports['showChatQueues']=function(_0x3212d5,_0x4cc9b3){return respondWithRpcPromise(_0xb5c0('0x40'),_0x3212d5['query'],routingClient)[_0xb5c0('0x8')](findById(_0x3212d5[_0xb5c0('0x1b')]['id']))[_0xb5c0('0x8')](respondWithResult(_0x4cc9b3,null))[_0xb5c0('0xc')](handleError(_0x4cc9b3,null));};exports[_0xb5c0('0x41')]=function(_0x37b0ad,_0x153566){return respondWithRpcPromise(_0xb5c0('0x42'),_0x37b0ad[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x153566,null))['catch'](handleError(_0x153566,null));};exports[_0xb5c0('0x43')]=function(_0x10ba77,_0xcee7fd){return respondWithRpcPromise('MailQueues',_0x10ba77[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](findById(_0x10ba77[_0xb5c0('0x1b')]['id']))[_0xb5c0('0x8')](respondWithResult(_0xcee7fd,null))[_0xb5c0('0xc')](handleError(_0xcee7fd,null));};exports[_0xb5c0('0x44')]=function(_0x3a8d32,_0x1cba56){return respondWithRpcPromise(_0xb5c0('0x45'),_0x3a8d32[_0xb5c0('0x16')],mailClient)[_0xb5c0('0x8')](respondWithResult(_0x1cba56,null))[_0xb5c0('0xc')](handleError(_0x1cba56,null));};exports[_0xb5c0('0x46')]=function(_0x19086b,_0x2df3f3){return respondWithRpcPromise(_0xb5c0('0x47'),_0x19086b['query'],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x2df3f3,null))['catch'](handleError(_0x2df3f3,null));};exports[_0xb5c0('0x48')]=function(_0x50b8d5,_0x1da3c7){return respondWithRpcPromise('OpenchannelQueues',_0x50b8d5[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](findById(_0x50b8d5['params']['id']))[_0xb5c0('0x8')](respondWithResult(_0x1da3c7,null))[_0xb5c0('0xc')](handleError(_0x1da3c7,null));};exports['smsQueues']=function(_0x29017c,_0x5c5ca3){return respondWithRpcPromise(_0xb5c0('0x49'),_0x29017c[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x5c5ca3,null))[_0xb5c0('0xc')](handleError(_0x5c5ca3,null));};exports[_0xb5c0('0x4a')]=function(_0x46d852,_0xde46a9){return respondWithRpcPromise('SmsQueues',_0x46d852[_0xb5c0('0x16')],routingClient)['then'](findById(_0x46d852[_0xb5c0('0x1b')]['id']))[_0xb5c0('0x8')](respondWithResult(_0xde46a9,null))[_0xb5c0('0xc')](handleError(_0xde46a9,null));};exports['whatsappQueues']=function(_0x5887eb,_0x5000e4){return respondWithRpcPromise(_0xb5c0('0x4b'),_0x5887eb[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x5000e4,null))['catch'](handleError(_0x5000e4,null));};exports[_0xb5c0('0x4c')]=function(_0x30d578,_0x564239){return respondWithRpcPromise(_0xb5c0('0x4b'),_0x30d578[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](findById(_0x30d578[_0xb5c0('0x1b')]['id']))[_0xb5c0('0x8')](respondWithResult(_0x564239,null))[_0xb5c0('0xc')](handleError(_0x564239,null));};exports[_0xb5c0('0x4d')]=function(_0x48166a,_0x181d53){return respondWithRpcPromise('FaxQueues',_0x48166a[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x181d53,null))[_0xb5c0('0xc')](handleError(_0x181d53,null));};exports['showFaxQueues']=function(_0x2e176d,_0x5eda26){return respondWithRpcPromise(_0xb5c0('0x4e'),_0x2e176d[_0xb5c0('0x16')],routingClient)['then'](findById(_0x2e176d[_0xb5c0('0x1b')]['id']))['then'](respondWithResult(_0x5eda26,null))[_0xb5c0('0xc')](handleError(_0x5eda26,null));};exports[_0xb5c0('0x4f')]=function(_0xdda242,_0x53a045){return respondWithRpcPromise(_0xb5c0('0x50'),_0xdda242[_0xb5c0('0x16')])[_0xb5c0('0x8')](respondWithResult(_0x53a045,null))[_0xb5c0('0xc')](handleError(_0x53a045,null));};exports[_0xb5c0('0x51')]=function(_0x56dd55,_0x5f175a){return respondWithRpcPromise(_0xb5c0('0x52'),_0x56dd55[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x5f175a,null))[_0xb5c0('0xc')](handleError(_0x5f175a,null));};exports[_0xb5c0('0x53')]=function(_0x56d830,_0x535eda){return respondWithRpcPromise(_0xb5c0('0x54'),_0x56d830[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x535eda,null))[_0xb5c0('0xc')](handleError(_0x535eda,null));};exports[_0xb5c0('0x55')]=function(_0x123efa,_0x15bda6){return respondWithRpcPromise(_0xb5c0('0x56'),_0x123efa[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x15bda6,null))[_0xb5c0('0xc')](handleError(_0x15bda6,null));};exports[_0xb5c0('0x57')]=function(_0x32a50e,_0x19134d){return respondWithRpcPromise(_0xb5c0('0x56'),_0x32a50e[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](function(_0x5899d7){if(_0x32a50e['query'][_0xb5c0('0x58')]!==undefined){var _0x410740=_(_0x5899d7['rows'])[_0xb5c0('0x59')]([_0x32a50e['query'][_0xb5c0('0x58')],_0x32a50e[_0xb5c0('0x1b')]['id']])[_0xb5c0('0x5a')]('queue_id')[_0xb5c0('0x5b')]()[_0xb5c0('0x5c')]();return _0x5899d7['rows']['filter'](function(_0x2c17f4){return _0x410740['indexOf'](_0x2c17f4[_0xb5c0('0x5d')])>-0x1;});}else{return _0x5899d7['rows'][_0xb5c0('0x59')](function(_0x4893c6){return _0x4893c6[_0xb5c0('0x5d')]===parseInt(_0x32a50e[_0xb5c0('0x1b')]['id']);});}})['then'](respondWithResult(_0x19134d,null))[_0xb5c0('0xc')](handleError(_0x19134d,null));};exports[_0xb5c0('0x5e')]=function(_0x306b7d,_0x52ff9d){return respondWithRpcPromise(_0xb5c0('0x5f'),_0x306b7d[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0x52ff9d,null))['catch'](handleError(_0x52ff9d,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x28e68d,_0xb57608){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x28e68d['query'],routingClient)[_0xb5c0('0x8')](respondWithResult(_0xb57608,null))[_0xb5c0('0xc')](handleError(_0xb57608,null));};exports['faxQueuesWaitingInteractions']=function(_0x31f19f,_0xda18d3){return respondWithRpcPromise(_0xb5c0('0x60'),_0x31f19f[_0xb5c0('0x16')],routingClient)[_0xb5c0('0x8')](respondWithResult(_0xda18d3,null))['catch'](handleError(_0xda18d3,null));};exports[_0xb5c0('0x61')]=function(_0x2a543c){return function(_0x173efa,_0x5694e6){var _0xbf64e4,_0x57eedf;var _0x406ff6=_['capitalize'](_0x2a543c);var _0x186fc0=_0x2a543c===_0xb5c0('0x62')?_0xb5c0('0x63'):'Account';return db[_0x406ff6+'Queue'][_0xb5c0('0x64')]({'raw':!![],'where':{'id':_0x173efa['params']['id']}})['then'](function(_0x494c2e){if(_['isNil'](_0x494c2e)){throw new Error(_0x406ff6+'\x20Queue\x20not\x20found');}_0xbf64e4=_0x494c2e;return db[_0x406ff6+_0xb5c0('0x65')][_0xb5c0('0x64')]({'where':{'id':_0x173efa[_0xb5c0('0x21')]['messageId']},'include':[{'model':db[_0x406ff6+_0xb5c0('0x66')],'as':_0xb5c0('0x66')},{'model':db[_0x406ff6+_0x186fc0],'as':_0xb5c0('0x67')}]});})[_0xb5c0('0x8')](function(_0x17e31e){if(_['isNil'](_0x17e31e)){throw new Error(_0x406ff6+_0xb5c0('0x68'));}_0x57eedf=_0x17e31e;return _0x17e31e[_0xb5c0('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xd0be81={'uniqueid':_0x2a543c+'.'+_0x57eedf['id']+'.'+_0x57eedf[_0xb5c0('0x66')]['id'],'FromUserId':_0x173efa[_0xb5c0('0x2e')]['id'],'type':'queue'};_0xd0be81[_0x406ff6+_0xb5c0('0x6a')]=_0x57eedf['id'];_0xd0be81[_0x406ff6+_0xb5c0('0x6b')]=_0x57eedf[_0xb5c0('0x66')]['id'];_0xd0be81['From'+_0x406ff6+_0x186fc0+'Id']=_0x57eedf[_0xb5c0('0x67')]['id'];_0xd0be81['To'+_0x406ff6+'QueueId']=_0xbf64e4['id'];return db[_0x406ff6+_0xb5c0('0x6c')][_0xb5c0('0x6d')](_0xd0be81);})['then'](function(){return respondWithRpcPromise(_0xb5c0('0x6e'),{'channel':_0x2a543c,'interaction':_0x57eedf['Interaction'],'message':_0x57eedf,'account':_0x57eedf[_0xb5c0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb5c0('0x6f'),'appdata':_0xbf64e4[_0xb5c0('0xf')]+','+(_0x57eedf[_0xb5c0('0x67')][_0xb5c0('0x70')]||0x12c),'interval':_0xb5c0('0x71')}]},routingClient);})[_0xb5c0('0x8')](respondWithResult(_0x5694e6,null))[_0xb5c0('0xc')](handleError(_0x5694e6,null));};};exports['agentNotify']=function(_0x549f28,_0x46d68a){var _0x2873b7,_0x3d8dea;if(_[_0xb5c0('0x12')](_0x549f28[_0xb5c0('0x21')][_0xb5c0('0x72')])){throw new Error(_0xb5c0('0x73'));}var _0x36d6c0=_0x549f28[_0xb5c0('0x21')][_0xb5c0('0x72')];var _0x538184=_[_0xb5c0('0x74')](_0x36d6c0);var _0x211913=_0x36d6c0===_0xb5c0('0x62')?_0xb5c0('0x63'):_0xb5c0('0x67');return db[_0xb5c0('0x75')][_0xb5c0('0x64')]({'raw':!![],'where':{'id':_0x549f28[_0xb5c0('0x1b')]['id'],'role':'agent'}})[_0xb5c0('0x8')](function(_0x25848c){if(_['isNil'](_0x25848c)){throw new Error(_0xb5c0('0x76'));}_0x2873b7=_0x25848c;return db[_0x538184+_0xb5c0('0x65')][_0xb5c0('0x64')]({'where':{'id':_0x549f28[_0xb5c0('0x21')][_0xb5c0('0x77')]},'include':[{'model':db[_0x538184+_0xb5c0('0x66')],'as':_0xb5c0('0x66')},{'model':db[_0x538184+_0x211913],'as':_0xb5c0('0x67')}]});})[_0xb5c0('0x8')](function(_0x5e71a6){if(_[_0xb5c0('0x12')](_0x5e71a6)){throw new Error(_0x538184+'\x20Message\x20not\x20found');}_0x3d8dea=_0x5e71a6;return _0x5e71a6['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xb5c0('0x8')](function(){var _0x354994={'uniqueid':_0x36d6c0+'.'+_0x3d8dea['id']+'.'+_0x3d8dea[_0xb5c0('0x66')]['id'],'FromUserId':_0x549f28['user']['id'],'type':_0xb5c0('0x39'),'ToUserId':_0x2873b7['id']};_0x354994[_0x538184+_0xb5c0('0x6a')]=_0x3d8dea['id'];_0x354994[_0x538184+_0xb5c0('0x6b')]=_0x3d8dea[_0xb5c0('0x66')]['id'];_0x354994[_0xb5c0('0x78')+_0x538184+_0x211913+'Id']=_0x3d8dea['Account']['id'];return db[_0x538184+'TransferReport']['create'](_0x354994);})[_0xb5c0('0x8')](function(){return respondWithRpcPromise(_0xb5c0('0x6e'),{'channel':_0x36d6c0,'interaction':_0x3d8dea[_0xb5c0('0x66')],'message':_0x3d8dea,'account':_0x3d8dea[_0xb5c0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb5c0('0x39'),'appdata':_0x2873b7[_0xb5c0('0xf')]+','+(_0x3d8dea['Account'][_0xb5c0('0x79')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb5c0('0x8')](respondWithResult(_0x46d68a,null))[_0xb5c0('0xc')](handleError(_0x46d68a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 47bcbfd..7cc76df 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 _0xc0e2=['index','/:id','/:id/run','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x20e1e0,_0x418bb5){var _0x21954d=function(_0x3ea7f0){while(--_0x3ea7f0){_0x20e1e0['push'](_0x20e1e0['shift']());}};_0x21954d(++_0x418bb5);}(_0xc0e2,0x15c));var _0x2c0e=function(_0x335175,_0x2349bd){_0x335175=_0x335175-0x0;var _0x199fdc=_0xc0e2[_0x335175];return _0x199fdc;};'use strict';var multer=require(_0x2c0e('0x0'));var util=require('util');var path=require(_0x2c0e('0x1'));var timeout=require(_0x2c0e('0x2'));var express=require(_0x2c0e('0x3'));var router=express[_0x2c0e('0x4')]();var fs_extra=require(_0x2c0e('0x5'));var auth=require(_0x2c0e('0x6'));var interaction=require(_0x2c0e('0x7'));var config=require(_0x2c0e('0x8'));var controller=require(_0x2c0e('0x9'));router[_0x2c0e('0xa')]('/',auth[_0x2c0e('0xb')](),controller[_0x2c0e('0xc')]);router[_0x2c0e('0xa')](_0x2c0e('0xd'),auth[_0x2c0e('0xb')](),controller['show']);router[_0x2c0e('0xa')](_0x2c0e('0xe'),auth[_0x2c0e('0xb')](),controller['run']);router[_0x2c0e('0xf')]('/',auth[_0x2c0e('0xb')](),controller[_0x2c0e('0x10')]);router[_0x2c0e('0x11')](_0x2c0e('0xd'),auth['isAuthenticated'](),controller[_0x2c0e('0x12')]);router['delete']('/:id',auth[_0x2c0e('0xb')](),controller['destroy']);module[_0x2c0e('0x13')]=router; \ No newline at end of file +var _0xd637=['get','run','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','/:id','isAuthenticated','show'];(function(_0x990d10,_0x1256fe){var _0x5602bb=function(_0x1f758a){while(--_0x1f758a){_0x990d10['push'](_0x990d10['shift']());}};_0x5602bb(++_0x1256fe);}(_0xd637,0x111));var _0x7d63=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd637[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x7d63('0x0'));var util=require(_0x7d63('0x1'));var path=require('path');var timeout=require(_0x7d63('0x2'));var express=require(_0x7d63('0x3'));var router=express[_0x7d63('0x4')]();var fs_extra=require(_0x7d63('0x5'));var auth=require(_0x7d63('0x6'));var interaction=require(_0x7d63('0x7'));var config=require('../../config/environment');var controller=require(_0x7d63('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7d63('0x9'),auth[_0x7d63('0xa')](),controller[_0x7d63('0xb')]);router[_0x7d63('0xc')]('/:id/run',auth['isAuthenticated'](),controller[_0x7d63('0xd')]);router[_0x7d63('0xe')]('/',auth[_0x7d63('0xa')](),controller[_0x7d63('0xf')]);router['put'](_0x7d63('0x9'),auth['isAuthenticated'](),controller[_0x7d63('0x10')]);router[_0x7d63('0x11')]('/:id',auth[_0x7d63('0xa')](),controller['destroy']);module[_0x7d63('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 106abc7..41c8cf8 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 _0xbd00=['ENUM','years','months','weeks','days','minutes','csv','pdf','xlsx','custom','TEXT','sequelize','exports','BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE'];(function(_0x4cff28,_0x39ea1f){var _0xa08e9c=function(_0x3f1fb6){while(--_0x3f1fb6){_0x4cff28['push'](_0x4cff28['shift']());}};_0xa08e9c(++_0x39ea1f);}(_0xbd00,0x1e7));var _0x0bd0=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xbd00[_0x1ccbcc];return _0x1e873f;};'use strict';var Sequelize=require(_0x0bd0('0x0'));module[_0x0bd0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0bd0('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0bd0('0x3')],'allowNull':![],'defaultValue':_0x0bd0('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0bd0('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0bd0('0x6')](_0x0bd0('0x7'),'quarters',_0x0bd0('0x8'),_0x0bd0('0x9'),_0x0bd0('0xa'),'hours',_0x0bd0('0xb')),'allowNull':![],'defaultValue':_0x0bd0('0xa')},'output':{'type':Sequelize[_0x0bd0('0x6')](_0x0bd0('0xc'),_0x0bd0('0xd'),_0x0bd0('0xe')),'allowNull':![],'defaultValue':_0x0bd0('0xc')},'type':{'type':Sequelize[_0x0bd0('0x6')](_0x0bd0('0xf'),'default'),'allowNull':![],'defaultValue':_0x0bd0('0xf')},'sendMail':{'type':Sequelize[_0x0bd0('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0bd0('0x3')]},'cc':{'type':Sequelize[_0x0bd0('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x0bd0('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5fd7=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','months','weeks','minutes','days','xlsx','csv','ENUM','custom'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x5fd7,0x18e));var _0x75fd=function(_0x13f409,_0x34ec12){_0x13f409=_0x13f409-0x0;var _0x4560da=_0x5fd7[_0x13f409];return _0x4560da;};'use strict';var Sequelize=require(_0x75fd('0x0'));module[_0x75fd('0x1')]={'name':{'type':Sequelize[_0x75fd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x75fd('0x2')]},'active':{'type':Sequelize[_0x75fd('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x75fd('0x2')],'allowNull':![],'defaultValue':_0x75fd('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x75fd('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x75fd('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x75fd('0x7'),'quarters',_0x75fd('0x8'),_0x75fd('0x9'),'days','hours',_0x75fd('0xa')),'allowNull':![],'defaultValue':_0x75fd('0xb')},'output':{'type':Sequelize['ENUM']('csv','pdf',_0x75fd('0xc')),'allowNull':![],'defaultValue':_0x75fd('0xd')},'type':{'type':Sequelize[_0x75fd('0xe')](_0x75fd('0xf'),_0x75fd('0x10')),'allowNull':![],'defaultValue':_0x75fd('0xf')},'sendMail':{'type':Sequelize[_0x75fd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x75fd('0x2')]},'cc':{'type':Sequelize[_0x75fd('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x75fd('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index dc6ea6b..3760a00 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 _0x2e68=['mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','then','destroy','get','error','stack','name','send','Schedule','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3f7074,_0x44cd21){var _0x416965=function(_0x38cffe){while(--_0x38cffe){_0x3f7074['push'](_0x3f7074['shift']());}};_0x416965(++_0x44cd21);}(_0x2e68,0xfe));var _0x82e6=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2e68[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x82e6('0x0'));var rimraf=require(_0x82e6('0x1'));var zipdir=require(_0x82e6('0x2'));var jsonpatch=require(_0x82e6('0x3'));var rp=require(_0x82e6('0x4'));var moment=require(_0x82e6('0x5'));var BPromise=require(_0x82e6('0x6'));var Mustache=require(_0x82e6('0x7'));var util=require(_0x82e6('0x8'));var path=require(_0x82e6('0x9'));var sox=require(_0x82e6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82e6('0xb'));var _=require(_0x82e6('0xc'));var squel=require(_0x82e6('0xd'));var crypto=require(_0x82e6('0xe'));var jsforce=require(_0x82e6('0xf'));var deskjs=require(_0x82e6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x82e6('0x11'));var Papa=require(_0x82e6('0x12'));var Redis=require(_0x82e6('0x13'));var authService=require(_0x82e6('0x14'));var qs=require(_0x82e6('0x15'));var as=require(_0x82e6('0x16'));var hardwareService=require(_0x82e6('0x17'));var logger=require(_0x82e6('0x18'))(_0x82e6('0x19'));var utils=require(_0x82e6('0x1a'));var config=require(_0x82e6('0x1b'));var licenseUtil=require(_0x82e6('0x1c'));var db=require(_0x82e6('0x1d'))['db'];function respondWithStatusCode(_0x316868,_0x55136b){_0x55136b=_0x55136b||0xcc;return function(_0x35dc57){if(_0x35dc57){return _0x316868[_0x82e6('0x1e')](_0x55136b);}return _0x316868['status'](_0x55136b)[_0x82e6('0x1f')]();};}function respondWithResult(_0x3c4322,_0x534113){_0x534113=_0x534113||0xc8;return function(_0x21613a){if(_0x21613a){return _0x3c4322['status'](_0x534113)['json'](_0x21613a);}};}function respondWithFilteredResult(_0x250206,_0x10dc5a){return function(_0x38bff9){if(_0x38bff9){var _0x1e94f0=typeof _0x10dc5a[_0x82e6('0x20')]===_0x82e6('0x21')&&typeof _0x10dc5a[_0x82e6('0x22')]==='undefined';var _0x531b38=_0x38bff9[_0x82e6('0x23')];var _0x5cc071=_0x1e94f0?0x0:_0x10dc5a[_0x82e6('0x20')];var _0x368814=_0x1e94f0?_0x38bff9['count']:_0x10dc5a[_0x82e6('0x20')]+_0x10dc5a['limit'];var _0x2712be;if(_0x368814>=_0x531b38){_0x368814=_0x531b38;_0x2712be=0xc8;}else{_0x2712be=0xce;}_0x250206[_0x82e6('0x24')](_0x2712be);return _0x250206[_0x82e6('0x25')](_0x82e6('0x26'),_0x5cc071+'-'+_0x368814+'/'+_0x531b38)[_0x82e6('0x27')](_0x38bff9);}return null;};}function patchUpdates(_0x271b6f){return function(_0x44500d){try{jsonpatch[_0x82e6('0x28')](_0x44500d,_0x271b6f,!![]);}catch(_0x9ccc2e){return BPromise[_0x82e6('0x29')](_0x9ccc2e);}return _0x44500d['save']();};}function saveUpdates(_0x286d46,_0x140f47){return function(_0x233886){if(_0x233886){return _0x233886[_0x82e6('0x2a')](_0x286d46)[_0x82e6('0x2b')](function(_0x49d692){return _0x49d692;});}return null;};}function removeEntity(_0x39c482,_0x45d157){return function(_0x23661a){if(_0x23661a){return _0x23661a[_0x82e6('0x2c')]()['then'](function(){var _0x41f859=_0x23661a[_0x82e6('0x2d')]({'plain':!![]});var _0x2a6438='Scheduler';return db['UserProfileResource'][_0x82e6('0x2c')]({'where':{'type':_0x2a6438,'resourceId':_0x41f859['id']}})[_0x82e6('0x2b')](function(){return _0x23661a;});})[_0x82e6('0x2b')](function(){_0x39c482['status'](0xcc)[_0x82e6('0x1f')]();});}};}function handleEntityNotFound(_0x45675f,_0x59e778){return function(_0x1c6feb){if(!_0x1c6feb){_0x45675f['sendStatus'](0x194);}return _0x1c6feb;};}function handleError(_0x19f4cd,_0x30710d){_0x30710d=_0x30710d||0x1f4;return function(_0x14c0e5){logger[_0x82e6('0x2e')](_0x14c0e5[_0x82e6('0x2f')]);if(_0x14c0e5[_0x82e6('0x30')]){delete _0x14c0e5[_0x82e6('0x30')];}_0x19f4cd[_0x82e6('0x24')](_0x30710d)[_0x82e6('0x31')](_0x14c0e5);};}exports['index']=function(_0x537255,_0x5d3668){var _0x50f4d3={},_0x29756c={},_0x3b633c={'count':0x0,'rows':[]};var _0x55a5dd=_['map'](db[_0x82e6('0x32')][_0x82e6('0x33')],function(_0x22b13e){return{'name':_0x22b13e[_0x82e6('0x34')],'type':_0x22b13e['type']['key']};});_0x29756c[_0x82e6('0x35')]=_[_0x82e6('0x36')](_0x55a5dd,_0x82e6('0x30'));_0x29756c[_0x82e6('0x37')]=_[_0x82e6('0x38')](_0x537255[_0x82e6('0x37')]);_0x29756c[_0x82e6('0x39')]=_[_0x82e6('0x3a')](_0x29756c[_0x82e6('0x35')],_0x29756c[_0x82e6('0x37')]);_0x50f4d3['attributes']=_[_0x82e6('0x3a')](_0x29756c[_0x82e6('0x35')],qs['fields'](_0x537255[_0x82e6('0x37')][_0x82e6('0x3b')]));_0x50f4d3[_0x82e6('0x3c')]=_0x50f4d3[_0x82e6('0x3c')][_0x82e6('0x3d')]?_0x50f4d3[_0x82e6('0x3c')]:_0x29756c[_0x82e6('0x35')];if(!_0x537255[_0x82e6('0x37')]['hasOwnProperty']('nolimit')){_0x50f4d3[_0x82e6('0x22')]=qs[_0x82e6('0x22')](_0x537255[_0x82e6('0x37')][_0x82e6('0x22')]);_0x50f4d3[_0x82e6('0x20')]=qs['offset'](_0x537255[_0x82e6('0x37')][_0x82e6('0x20')]);}_0x50f4d3['order']=qs[_0x82e6('0x3e')](_0x537255[_0x82e6('0x37')][_0x82e6('0x3e')]);_0x50f4d3[_0x82e6('0x3f')]=qs[_0x82e6('0x39')](_[_0x82e6('0x40')](_0x537255[_0x82e6('0x37')],_0x29756c[_0x82e6('0x39')]),_0x55a5dd);if(_0x537255[_0x82e6('0x37')][_0x82e6('0x41')]){_0x50f4d3['where']=_[_0x82e6('0x42')](_0x50f4d3['where'],{'$or':_[_0x82e6('0x36')](_0x55a5dd,function(_0x49d8f4){if(_0x49d8f4[_0x82e6('0x43')]!==_0x82e6('0x44')){var _0x5152a5={};_0x5152a5[_0x49d8f4[_0x82e6('0x30')]]={'$like':'%'+_0x537255['query'][_0x82e6('0x41')]+'%'};return _0x5152a5;}})});}_0x50f4d3=_[_0x82e6('0x42')]({},_0x50f4d3,_0x537255['options']);var _0x46f7cd={'where':_0x50f4d3['where']};return db[_0x82e6('0x32')]['count'](_0x46f7cd)[_0x82e6('0x2b')](function(_0x2a33b0){_0x3b633c['count']=_0x2a33b0;if(_0x537255[_0x82e6('0x37')][_0x82e6('0x45')]){_0x50f4d3[_0x82e6('0x46')]=[{'all':!![]}];}return db['Schedule'][_0x82e6('0x47')](_0x50f4d3);})[_0x82e6('0x2b')](function(_0xbcd933){_0x3b633c['rows']=_0xbcd933;return _0x3b633c;})[_0x82e6('0x2b')](respondWithFilteredResult(_0x5d3668,_0x50f4d3))[_0x82e6('0x48')](handleError(_0x5d3668,null));};exports[_0x82e6('0x49')]=function(_0x4b08c8,_0x4b6192){var _0x4098b4={'raw':![],'where':{'id':_0x4b08c8[_0x82e6('0x4a')]['id']}},_0x291927={};_0x291927[_0x82e6('0x35')]=_[_0x82e6('0x38')](db['Schedule']['rawAttributes']);_0x291927[_0x82e6('0x37')]=_[_0x82e6('0x38')](_0x4b08c8[_0x82e6('0x37')]);_0x291927[_0x82e6('0x39')]=_[_0x82e6('0x3a')](_0x291927['model'],_0x291927['query']);_0x4098b4[_0x82e6('0x3c')]=_[_0x82e6('0x3a')](_0x291927['model'],qs[_0x82e6('0x3b')](_0x4b08c8[_0x82e6('0x37')][_0x82e6('0x3b')]));_0x4098b4[_0x82e6('0x3c')]=_0x4098b4[_0x82e6('0x3c')][_0x82e6('0x3d')]?_0x4098b4['attributes']:_0x291927[_0x82e6('0x35')];if(_0x4b08c8[_0x82e6('0x37')][_0x82e6('0x45')]){_0x4098b4[_0x82e6('0x46')]=[{'all':!![]}];}_0x4098b4=_[_0x82e6('0x42')]({},_0x4098b4,_0x4b08c8['options']);return db[_0x82e6('0x32')][_0x82e6('0x4b')](_0x4098b4)[_0x82e6('0x2b')](handleEntityNotFound(_0x4b6192,null))[_0x82e6('0x2b')](respondWithResult(_0x4b6192,null))[_0x82e6('0x48')](handleError(_0x4b6192,null));};exports['create']=function(_0x5af1ff,_0x5bb698){return db[_0x82e6('0x32')][_0x82e6('0x4c')](_0x5af1ff['body'],{})['then'](function(_0x4d7076){var _0x840b52=_0x5af1ff[_0x82e6('0x4d')][_0x82e6('0x2d')]({'plain':!![]});if(!_0x840b52)throw new Error(_0x82e6('0x4e'));if(_0x840b52[_0x82e6('0x4f')]==='user'){var _0x308009=_0x4d7076[_0x82e6('0x2d')]({'plain':!![]});var _0x442685=_0x82e6('0x50');return db[_0x82e6('0x51')][_0x82e6('0x4b')]({'where':{'name':_0x442685,'userProfileId':_0x840b52[_0x82e6('0x52')]},'raw':!![]})[_0x82e6('0x2b')](function(_0x1e4485){if(_0x1e4485&&_0x1e4485['autoAssociation']===0x0){return db[_0x82e6('0x53')]['create']({'name':_0x308009[_0x82e6('0x30')],'resourceId':_0x308009['id'],'type':_0x1e4485[_0x82e6('0x30')],'sectionId':_0x1e4485['id']},{})[_0x82e6('0x2b')](function(){return _0x4d7076;});}else{return _0x4d7076;}})[_0x82e6('0x48')](function(_0x5ecc21){logger['error'](_0x82e6('0x54'),_0x5ecc21);throw _0x5ecc21;});}return _0x4d7076;})[_0x82e6('0x2b')](respondWithResult(_0x5bb698,0xc9))[_0x82e6('0x48')](handleError(_0x5bb698,null));};exports[_0x82e6('0x2a')]=function(_0x2f114c,_0x2abbbe){if(_0x2f114c['body']['id']){delete _0x2f114c['body']['id'];}return db[_0x82e6('0x32')][_0x82e6('0x4b')]({'where':{'id':_0x2f114c['params']['id']}})[_0x82e6('0x2b')](handleEntityNotFound(_0x2abbbe,null))[_0x82e6('0x2b')](saveUpdates(_0x2f114c[_0x82e6('0x55')],null))[_0x82e6('0x2b')](respondWithResult(_0x2abbbe,null))['catch'](handleError(_0x2abbbe,null));};exports[_0x82e6('0x2c')]=function(_0x49bdee,_0x5ee8){return db[_0x82e6('0x32')][_0x82e6('0x4b')]({'where':{'id':_0x49bdee[_0x82e6('0x4a')]['id']}})[_0x82e6('0x2b')](handleEntityNotFound(_0x5ee8,null))[_0x82e6('0x2b')](removeEntity(_0x5ee8,null))['catch'](handleError(_0x5ee8,null));};exports[_0x82e6('0x56')]=function(_0x22e391,_0x566761,_0x1fd373){var _0x5000cd=require('../../config/schedule');return db[_0x82e6('0x32')][_0x82e6('0x4b')]({'where':{'id':_0x22e391[_0x82e6('0x4a')]['id']},'raw':!![]})[_0x82e6('0x2b')](handleEntityNotFound(_0x566761,null))[_0x82e6('0x2b')](function(){_0x5000cd[_0x82e6('0x56')](_0x22e391[_0x82e6('0x4a')]['id']);})[_0x82e6('0x2b')](respondWithStatusCode(_0x566761,null))[_0x82e6('0x48')](handleError(_0x566761,null));}; \ No newline at end of file +var _0x512f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','get','UserProfileResource','end','error','stack','name','send','index','map','Schedule','fieldName','model','query','keys','filters','attributes','intersection','fields','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','body','role','user','Scheduler','userProfileId','autoAssociation','create','update','params','destroy','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5ed4e5,_0x1ee795){var _0x58ca33=function(_0x20a47b){while(--_0x20a47b){_0x5ed4e5['push'](_0x5ed4e5['shift']());}};_0x58ca33(++_0x1ee795);}(_0x512f,0x134));var _0xf512=function(_0x4f75b5,_0x4db76d){_0x4f75b5=_0x4f75b5-0x0;var _0x5c263b=_0x512f[_0x4f75b5];return _0x5c263b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf512('0x0'));var zipdir=require(_0xf512('0x1'));var jsonpatch=require(_0xf512('0x2'));var rp=require(_0xf512('0x3'));var moment=require('moment');var BPromise=require(_0xf512('0x4'));var Mustache=require(_0xf512('0x5'));var util=require(_0xf512('0x6'));var path=require('path');var sox=require(_0xf512('0x7'));var csv=require(_0xf512('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf512('0x9'));var _=require(_0xf512('0xa'));var squel=require('squel');var crypto=require(_0xf512('0xb'));var jsforce=require(_0xf512('0xc'));var deskjs=require(_0xf512('0xd'));var toCsv=require(_0xf512('0x8'));var querystring=require(_0xf512('0xe'));var Papa=require(_0xf512('0xf'));var Redis=require(_0xf512('0x10'));var authService=require(_0xf512('0x11'));var qs=require(_0xf512('0x12'));var as=require(_0xf512('0x13'));var hardwareService=require(_0xf512('0x14'));var logger=require('../../config/logger')(_0xf512('0x15'));var utils=require('../../config/utils');var config=require(_0xf512('0x16'));var licenseUtil=require(_0xf512('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fba2f,_0x3f6d75){_0x3f6d75=_0x3f6d75||0xcc;return function(_0xf2be4){if(_0xf2be4){return _0x3fba2f[_0xf512('0x18')](_0x3f6d75);}return _0x3fba2f[_0xf512('0x19')](_0x3f6d75)['end']();};}function respondWithResult(_0x4fb2af,_0x20973f){_0x20973f=_0x20973f||0xc8;return function(_0xef66a2){if(_0xef66a2){return _0x4fb2af[_0xf512('0x19')](_0x20973f)[_0xf512('0x1a')](_0xef66a2);}};}function respondWithFilteredResult(_0x39b858,_0x3f204d){return function(_0x7fd413){if(_0x7fd413){var _0x33e9a5=typeof _0x3f204d[_0xf512('0x1b')]===_0xf512('0x1c')&&typeof _0x3f204d[_0xf512('0x1d')]===_0xf512('0x1c');var _0x3e06e4=_0x7fd413['count'];var _0x5ee41e=_0x33e9a5?0x0:_0x3f204d['offset'];var _0x503e4b=_0x33e9a5?_0x7fd413[_0xf512('0x1e')]:_0x3f204d[_0xf512('0x1b')]+_0x3f204d['limit'];var _0x3de6df;if(_0x503e4b>=_0x3e06e4){_0x503e4b=_0x3e06e4;_0x3de6df=0xc8;}else{_0x3de6df=0xce;}_0x39b858[_0xf512('0x19')](_0x3de6df);return _0x39b858[_0xf512('0x1f')]('Content-Range',_0x5ee41e+'-'+_0x503e4b+'/'+_0x3e06e4)['json'](_0x7fd413);}return null;};}function patchUpdates(_0x33a5e2){return function(_0xa5ec7a){try{jsonpatch[_0xf512('0x20')](_0xa5ec7a,_0x33a5e2,!![]);}catch(_0x27c63c){return BPromise[_0xf512('0x21')](_0x27c63c);}return _0xa5ec7a['save']();};}function saveUpdates(_0xc74a61,_0x25f989){return function(_0x280e48){if(_0x280e48){return _0x280e48['update'](_0xc74a61)[_0xf512('0x22')](function(_0x13d057){return _0x13d057;});}return null;};}function removeEntity(_0x39d7c9,_0x2f0ba4){return function(_0x354a11){if(_0x354a11){return _0x354a11['destroy']()[_0xf512('0x22')](function(){var _0x25052e=_0x354a11[_0xf512('0x23')]({'plain':!![]});var _0x501fda='Scheduler';return db[_0xf512('0x24')]['destroy']({'where':{'type':_0x501fda,'resourceId':_0x25052e['id']}})[_0xf512('0x22')](function(){return _0x354a11;});})[_0xf512('0x22')](function(){_0x39d7c9[_0xf512('0x19')](0xcc)[_0xf512('0x25')]();});}};}function handleEntityNotFound(_0x30c4f8,_0x470478){return function(_0x6f25cc){if(!_0x6f25cc){_0x30c4f8[_0xf512('0x18')](0x194);}return _0x6f25cc;};}function handleError(_0x1c7059,_0x3e34b3){_0x3e34b3=_0x3e34b3||0x1f4;return function(_0x530c7a){logger[_0xf512('0x26')](_0x530c7a[_0xf512('0x27')]);if(_0x530c7a['name']){delete _0x530c7a[_0xf512('0x28')];}_0x1c7059[_0xf512('0x19')](_0x3e34b3)[_0xf512('0x29')](_0x530c7a);};}exports[_0xf512('0x2a')]=function(_0x2bdca4,_0x3c3d88){var _0x57e300={},_0x11ff69={},_0x4f038e={'count':0x0,'rows':[]};var _0x55cb0e=_[_0xf512('0x2b')](db[_0xf512('0x2c')]['rawAttributes'],function(_0x111eb7){return{'name':_0x111eb7[_0xf512('0x2d')],'type':_0x111eb7['type']['key']};});_0x11ff69[_0xf512('0x2e')]=_[_0xf512('0x2b')](_0x55cb0e,_0xf512('0x28'));_0x11ff69[_0xf512('0x2f')]=_[_0xf512('0x30')](_0x2bdca4[_0xf512('0x2f')]);_0x11ff69[_0xf512('0x31')]=_['intersection'](_0x11ff69[_0xf512('0x2e')],_0x11ff69[_0xf512('0x2f')]);_0x57e300[_0xf512('0x32')]=_[_0xf512('0x33')](_0x11ff69[_0xf512('0x2e')],qs[_0xf512('0x34')](_0x2bdca4[_0xf512('0x2f')][_0xf512('0x34')]));_0x57e300[_0xf512('0x32')]=_0x57e300[_0xf512('0x32')]['length']?_0x57e300['attributes']:_0x11ff69['model'];if(!_0x2bdca4['query']['hasOwnProperty']('nolimit')){_0x57e300['limit']=qs[_0xf512('0x1d')](_0x2bdca4['query'][_0xf512('0x1d')]);_0x57e300[_0xf512('0x1b')]=qs[_0xf512('0x1b')](_0x2bdca4[_0xf512('0x2f')][_0xf512('0x1b')]);}_0x57e300[_0xf512('0x35')]=qs['sort'](_0x2bdca4[_0xf512('0x2f')][_0xf512('0x36')]);_0x57e300[_0xf512('0x37')]=qs[_0xf512('0x31')](_['pick'](_0x2bdca4[_0xf512('0x2f')],_0x11ff69[_0xf512('0x31')]),_0x55cb0e);if(_0x2bdca4[_0xf512('0x2f')][_0xf512('0x38')]){_0x57e300['where']=_[_0xf512('0x39')](_0x57e300[_0xf512('0x37')],{'$or':_[_0xf512('0x2b')](_0x55cb0e,function(_0x31cc0b){if(_0x31cc0b[_0xf512('0x3a')]!==_0xf512('0x3b')){var _0x549d26={};_0x549d26[_0x31cc0b['name']]={'$like':'%'+_0x2bdca4[_0xf512('0x2f')]['filter']+'%'};return _0x549d26;}})});}_0x57e300=_[_0xf512('0x39')]({},_0x57e300,_0x2bdca4[_0xf512('0x3c')]);var _0x104f48={'where':_0x57e300[_0xf512('0x37')]};return db['Schedule'][_0xf512('0x1e')](_0x104f48)[_0xf512('0x22')](function(_0x277be4){_0x4f038e['count']=_0x277be4;if(_0x2bdca4[_0xf512('0x2f')][_0xf512('0x3d')]){_0x57e300[_0xf512('0x3e')]=[{'all':!![]}];}return db[_0xf512('0x2c')][_0xf512('0x3f')](_0x57e300);})[_0xf512('0x22')](function(_0xc13fab){_0x4f038e[_0xf512('0x40')]=_0xc13fab;return _0x4f038e;})[_0xf512('0x22')](respondWithFilteredResult(_0x3c3d88,_0x57e300))[_0xf512('0x41')](handleError(_0x3c3d88,null));};exports[_0xf512('0x42')]=function(_0xf595b7,_0x48376b){var _0x1ad310={'raw':![],'where':{'id':_0xf595b7['params']['id']}},_0x5225aa={};_0x5225aa['model']=_[_0xf512('0x30')](db[_0xf512('0x2c')][_0xf512('0x43')]);_0x5225aa['query']=_[_0xf512('0x30')](_0xf595b7[_0xf512('0x2f')]);_0x5225aa[_0xf512('0x31')]=_[_0xf512('0x33')](_0x5225aa[_0xf512('0x2e')],_0x5225aa[_0xf512('0x2f')]);_0x1ad310['attributes']=_[_0xf512('0x33')](_0x5225aa[_0xf512('0x2e')],qs[_0xf512('0x34')](_0xf595b7['query']['fields']));_0x1ad310[_0xf512('0x32')]=_0x1ad310['attributes']['length']?_0x1ad310[_0xf512('0x32')]:_0x5225aa[_0xf512('0x2e')];if(_0xf595b7[_0xf512('0x2f')][_0xf512('0x3d')]){_0x1ad310[_0xf512('0x3e')]=[{'all':!![]}];}_0x1ad310=_[_0xf512('0x39')]({},_0x1ad310,_0xf595b7[_0xf512('0x3c')]);return db[_0xf512('0x2c')][_0xf512('0x44')](_0x1ad310)[_0xf512('0x22')](handleEntityNotFound(_0x48376b,null))[_0xf512('0x22')](respondWithResult(_0x48376b,null))['catch'](handleError(_0x48376b,null));};exports['create']=function(_0x9593dc,_0x16aea2){return db[_0xf512('0x2c')]['create'](_0x9593dc[_0xf512('0x45')],{})['then'](function(_0x3377c7){var _0x94267e=_0x9593dc['user'][_0xf512('0x23')]({'plain':!![]});if(!_0x94267e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x94267e[_0xf512('0x46')]===_0xf512('0x47')){var _0x3baf9e=_0x3377c7[_0xf512('0x23')]({'plain':!![]});var _0x95c95a=_0xf512('0x48');return db['UserProfileSection'][_0xf512('0x44')]({'where':{'name':_0x95c95a,'userProfileId':_0x94267e[_0xf512('0x49')]},'raw':!![]})[_0xf512('0x22')](function(_0x14a82a){if(_0x14a82a&&_0x14a82a[_0xf512('0x4a')]===0x0){return db[_0xf512('0x24')][_0xf512('0x4b')]({'name':_0x3baf9e[_0xf512('0x28')],'resourceId':_0x3baf9e['id'],'type':_0x14a82a[_0xf512('0x28')],'sectionId':_0x14a82a['id']},{})['then'](function(){return _0x3377c7;});}else{return _0x3377c7;}})[_0xf512('0x41')](function(_0x1f0ef7){logger[_0xf512('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f0ef7);throw _0x1f0ef7;});}return _0x3377c7;})[_0xf512('0x22')](respondWithResult(_0x16aea2,0xc9))[_0xf512('0x41')](handleError(_0x16aea2,null));};exports[_0xf512('0x4c')]=function(_0x754628,_0x5a9082){if(_0x754628[_0xf512('0x45')]['id']){delete _0x754628[_0xf512('0x45')]['id'];}return db[_0xf512('0x2c')][_0xf512('0x44')]({'where':{'id':_0x754628[_0xf512('0x4d')]['id']}})[_0xf512('0x22')](handleEntityNotFound(_0x5a9082,null))[_0xf512('0x22')](saveUpdates(_0x754628[_0xf512('0x45')],null))['then'](respondWithResult(_0x5a9082,null))['catch'](handleError(_0x5a9082,null));};exports[_0xf512('0x4e')]=function(_0x262a36,_0x20f985){return db[_0xf512('0x2c')][_0xf512('0x44')]({'where':{'id':_0x262a36['params']['id']}})[_0xf512('0x22')](handleEntityNotFound(_0x20f985,null))[_0xf512('0x22')](removeEntity(_0x20f985,null))[_0xf512('0x41')](handleError(_0x20f985,null));};exports[_0xf512('0x4f')]=function(_0x12ecc3,_0x52d45e,_0x1c4a23){var _0x30ffaf=require(_0xf512('0x50'));return db['Schedule'][_0xf512('0x44')]({'where':{'id':_0x12ecc3[_0xf512('0x4d')]['id']},'raw':!![]})[_0xf512('0x22')](handleEntityNotFound(_0x52d45e,null))[_0xf512('0x22')](function(){_0x30ffaf[_0xf512('0x4f')](_0x12ecc3['params']['id']);})[_0xf512('0x22')](respondWithStatusCode(_0x52d45e,null))[_0xf512('0x41')](handleError(_0x52d45e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 42ae305..3709671 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 _0x172f=['moment','request-promise','rimraf','./schedule.attributes','define','Schedule','lodash','util','../../config/logger','api'];(function(_0x3990c2,_0x216dc6){var _0x9fd09=function(_0xc2bb07){while(--_0xc2bb07){_0x3990c2['push'](_0x3990c2['shift']());}};_0x9fd09(++_0x216dc6);}(_0x172f,0x1d2));var _0xf172=function(_0x12123b,_0x562b58){_0x12123b=_0x12123b-0x0;var _0x1b2a48=_0x172f[_0x12123b];return _0x1b2a48;};'use strict';var _=require(_0xf172('0x0'));var util=require(_0xf172('0x1'));var logger=require(_0xf172('0x2'))(_0xf172('0x3'));var moment=require(_0xf172('0x4'));var BPromise=require('bluebird');var rp=require(_0xf172('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf172('0x6'));var config=require('../../config/environment');var attributes=require(_0xf172('0x7'));module['exports']=function(_0x104620,_0x2e9e64){return _0x104620[_0xf172('0x8')](_0xf172('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7614=['tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule'];(function(_0x2e52f3,_0x1121f0){var _0x424537=function(_0x1482dd){while(--_0x1482dd){_0x2e52f3['push'](_0x2e52f3['shift']());}};_0x424537(++_0x1121f0);}(_0x7614,0x119));var _0x4761=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x7614[_0x2265da];return _0x430c2b;};'use strict';var _=require(_0x4761('0x0'));var util=require(_0x4761('0x1'));var logger=require(_0x4761('0x2'))(_0x4761('0x3'));var moment=require(_0x4761('0x4'));var BPromise=require(_0x4761('0x5'));var rp=require(_0x4761('0x6'));var fs=require('fs');var path=require(_0x4761('0x7'));var rimraf=require(_0x4761('0x8'));var config=require(_0x4761('0x9'));var attributes=require(_0x4761('0xa'));module[_0x4761('0xb')]=function(_0x2ab00f,_0xc636ac){return _0x2ab00f['define'](_0x4761('0xc'),attributes,{'tableName':_0x4761('0xd'),'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 221d91f..db0b7b9 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 _0x3625=['../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1d6118,_0x203620){var _0xf062c7=function(_0x2b3a90){while(--_0x2b3a90){_0x1d6118['push'](_0x1d6118['shift']());}};_0xf062c7(++_0x203620);}(_0x3625,0x17f));var _0x5362=function(_0x62ea04,_0x5ac9ec){_0x62ea04=_0x62ea04-0x0;var _0x10c30d=_0x3625[_0x62ea04];return _0x10c30d;};'use strict';var _=require(_0x5362('0x0'));var util=require(_0x5362('0x1'));var moment=require('moment');var BPromise=require(_0x5362('0x2'));var rs=require(_0x5362('0x3'));var fs=require('fs');var Redis=require(_0x5362('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5362('0x5'));var logger=require(_0x5362('0x6'))(_0x5362('0x7'));var config=require(_0x5362('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5362('0x9')][_0x5362('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1697b5,_0x505433,_0x264d35){return new BPromise(function(_0x4034e1,_0x576c65){return client[_0x5362('0xb')](_0x1697b5,_0x264d35)[_0x5362('0xc')](function(_0x180c40){logger[_0x5362('0xd')](_0x5362('0xe'),_0x505433,_0x5362('0xf'));logger[_0x5362('0x10')](_0x5362('0x11'),_0x505433,'request\x20sent',JSON[_0x5362('0x12')](_0x180c40));if(_0x180c40['error']){if(_0x180c40[_0x5362('0x13')]['code']===0x1f4){logger[_0x5362('0x13')]('Schedule,\x20%s,\x20%s',_0x505433,_0x180c40[_0x5362('0x13')][_0x5362('0x14')]);return _0x576c65(_0x180c40['error'][_0x5362('0x14')]);}logger[_0x5362('0x13')]('Schedule,\x20%s,\x20%s',_0x505433,_0x180c40[_0x5362('0x13')][_0x5362('0x14')]);return _0x4034e1(_0x180c40[_0x5362('0x13')][_0x5362('0x14')]);}else{logger[_0x5362('0xd')](_0x5362('0xe'),_0x505433,_0x5362('0xf'));_0x4034e1(_0x180c40[_0x5362('0x15')][_0x5362('0x14')]);}})[_0x5362('0x16')](function(_0x11ebe8){logger[_0x5362('0x13')]('Schedule,\x20%s,\x20%s',_0x505433,_0x11ebe8);_0x576c65(_0x11ebe8);});});} \ No newline at end of file +var _0xe6bb=['error','message','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xe6bb,0x159));var _0xbe6b=function(_0x2d734c,_0x3d7bc6){_0x2d734c=_0x2d734c-0x0;var _0x573617=_0xe6bb[_0x2d734c];return _0x573617;};'use strict';var _=require(_0xbe6b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbe6b('0x1'));var rs=require(_0xbe6b('0x2'));var fs=require('fs');var Redis=require(_0xbe6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe6b('0x4'));var logger=require(_0xbe6b('0x5'))('rpc');var config=require(_0xbe6b('0x6'));var jayson=require(_0xbe6b('0x7'));var client=jayson[_0xbe6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a6834,_0x116bb9,_0xaeab80){return new BPromise(function(_0x47bdc7,_0x396654){return client[_0xbe6b('0x9')](_0x5a6834,_0xaeab80)[_0xbe6b('0xa')](function(_0x2438bb){logger[_0xbe6b('0xb')](_0xbe6b('0xc'),_0x116bb9,'request\x20sent');logger[_0xbe6b('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x116bb9,_0xbe6b('0xe'),JSON[_0xbe6b('0xf')](_0x2438bb));if(_0x2438bb[_0xbe6b('0x10')]){if(_0x2438bb[_0xbe6b('0x10')]['code']===0x1f4){logger[_0xbe6b('0x10')](_0xbe6b('0xc'),_0x116bb9,_0x2438bb['error'][_0xbe6b('0x11')]);return _0x396654(_0x2438bb['error']['message']);}logger[_0xbe6b('0x10')](_0xbe6b('0xc'),_0x116bb9,_0x2438bb[_0xbe6b('0x10')][_0xbe6b('0x11')]);return _0x47bdc7(_0x2438bb[_0xbe6b('0x10')]['message']);}else{logger[_0xbe6b('0xb')](_0xbe6b('0xc'),_0x116bb9,_0xbe6b('0xe'));_0x47bdc7(_0x2438bb[_0xbe6b('0x12')][_0xbe6b('0x11')]);}})['catch'](function(_0x32735f){logger[_0xbe6b('0x10')](_0xbe6b('0xc'),_0x116bb9,_0x32735f);_0x396654(_0x32735f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 49d364b..13c046d 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 _0x2b3b=['isAuthenticated','index','/describe','describe','/:id','show','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get'];(function(_0x331110,_0x4392ce){var _0x1681da=function(_0x1e1e41){while(--_0x1e1e41){_0x331110['push'](_0x331110['shift']());}};_0x1681da(++_0x4392ce);}(_0x2b3b,0x86));var _0xb2b3=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x2b3b[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0xb2b3('0x0'));var util=require(_0xb2b3('0x1'));var path=require(_0xb2b3('0x2'));var timeout=require(_0xb2b3('0x3'));var express=require(_0xb2b3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2b3('0x5'));var interaction=require(_0xb2b3('0x6'));var config=require(_0xb2b3('0x7'));var controller=require(_0xb2b3('0x8'));router[_0xb2b3('0x9')]('/',auth[_0xb2b3('0xa')](),controller[_0xb2b3('0xb')]);router[_0xb2b3('0x9')](_0xb2b3('0xc'),auth[_0xb2b3('0xa')](),controller[_0xb2b3('0xd')]);router[_0xb2b3('0x9')](_0xb2b3('0xe'),auth[_0xb2b3('0xa')](),controller[_0xb2b3('0xf')]);router[_0xb2b3('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xb2b3('0x10')]);router[_0xb2b3('0x11')]('/',auth[_0xb2b3('0xa')](),controller[_0xb2b3('0x12')]);router[_0xb2b3('0x13')](_0xb2b3('0xe'),auth['isAuthenticated'](),controller[_0xb2b3('0x14')]);router[_0xb2b3('0x15')](_0xb2b3('0xe'),auth['isAuthenticated'](),controller[_0xb2b3('0x16')]);module[_0xb2b3('0x17')]=router; \ No newline at end of file +var _0xa3e8=['index','describe','/:id','show','/:id/download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./screenRecording.controller','get','isAuthenticated'];(function(_0x1d9a63,_0x4a368f){var _0x5ccccf=function(_0x115dee){while(--_0x115dee){_0x1d9a63['push'](_0x1d9a63['shift']());}};_0x5ccccf(++_0x4a368f);}(_0xa3e8,0x1f0));var _0x8a3e=function(_0x2fc105,_0x4fdde7){_0x2fc105=_0x2fc105-0x0;var _0x1ce3ea=_0xa3e8[_0x2fc105];return _0x1ce3ea;};'use strict';var multer=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var path=require(_0x8a3e('0x2'));var timeout=require(_0x8a3e('0x3'));var express=require(_0x8a3e('0x4'));var router=express[_0x8a3e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8a3e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8a3e('0x7'));router[_0x8a3e('0x8')]('/',auth[_0x8a3e('0x9')](),controller[_0x8a3e('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8a3e('0xb')]);router[_0x8a3e('0x8')](_0x8a3e('0xc'),auth['isAuthenticated'](),controller[_0x8a3e('0xd')]);router[_0x8a3e('0x8')](_0x8a3e('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x8a3e('0xf')]('/',auth['isAuthenticated'](),controller[_0x8a3e('0x10')]);router[_0x8a3e('0x11')](_0x8a3e('0xc'),auth[_0x8a3e('0x9')](),controller[_0x8a3e('0x12')]);router[_0x8a3e('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8a3e('0x14')]);module[_0x8a3e('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 4b84229..4b96f0d 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 _0xb4e2=['replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','DATE','toString','updatedAt','sequelize','../../config/environment','value','extname','getDataValue','STRING'];(function(_0xfb8681,_0x4386ab){var _0x2d2d88=function(_0x1117cb){while(--_0x1117cb){_0xfb8681['push'](_0xfb8681['shift']());}};_0x2d2d88(++_0x4386ab);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x30c605,_0x1a3b7b){_0x30c605=_0x30c605-0x0;var _0x2c74f5=_0xb4e2[_0x30c605];return _0x2c74f5;};'use strict';var Sequelize=require(_0x2b4e('0x0'));var moment=require('moment');var path=require('path');var config=require(_0x2b4e('0x1'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x2b4e('0x2'))?path[_0x2b4e('0x3')](this[_0x2b4e('0x4')](_0x2b4e('0x2'))):undefined;}},'interactionid':{'type':Sequelize[_0x2b4e('0x5')]},'channel':{'type':Sequelize[_0x2b4e('0x5')]},'value':{'type':Sequelize[_0x2b4e('0x5')],'set':function(_0x4a84a9){var _0xc18f62=_0x4a84a9[_0x2b4e('0x6')](/\\/g,'/');this[_0x2b4e('0x7')](_0x2b4e('0x2'),_0xc18f62);}},'rating':{'type':Sequelize[_0x2b4e('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2b4e('0x8')],'set':function(_0x3fd14e){this[_0x2b4e('0x7')](_0x2b4e('0x9'),moment()[_0x2b4e('0xa')](_0x3fd14e,'ms'));this[_0x2b4e('0x7')](_0x2b4e('0xb'),moment());this[_0x2b4e('0x7')](_0x2b4e('0xc'),_0x3fd14e);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2b4e('0x4')](_0x2b4e('0x9')))[_0x2b4e('0xd')](_0x2b4e('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x2b4e('0xf')],'get':function(){return moment(this['getDataValue'](_0x2b4e('0xb')))[_0x2b4e('0xd')](_0x2b4e('0xe'))[_0x2b4e('0x10')]();}},'createdAt':{'type':Sequelize[_0x2b4e('0xf')],'get':function(){return moment(this[_0x2b4e('0x4')]('createdAt'))[_0x2b4e('0xd')](_0x2b4e('0xe'))[_0x2b4e('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2b4e('0x4')](_0x2b4e('0x11')))['format'](_0x2b4e('0xe'))['toString']();}}}; \ No newline at end of file +var _0x3da6=['MM-DD-YYYY\x20HH:mm','toString','format','createdAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','value','INTEGER','startedAt','closedAt','duration','DATE'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x3da6,0xc1));var _0x63da=function(_0xec4dc7,_0x345c4c){_0xec4dc7=_0xec4dc7-0x0;var _0x5e8142=_0x3da6[_0xec4dc7];return _0x5e8142;};'use strict';var Sequelize=require(_0x63da('0x0'));var moment=require(_0x63da('0x1'));var path=require(_0x63da('0x2'));var config=require(_0x63da('0x3'));module[_0x63da('0x4')]={'format':{'type':Sequelize[_0x63da('0x5')],'get':function(){return this[_0x63da('0x6')]('value')?path[_0x63da('0x7')](this[_0x63da('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x63da('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x63da('0x8')],'set':function(_0x519714){var _0x1e6160=_0x519714[_0x63da('0x9')](/\\/g,'/');this[_0x63da('0xa')](_0x63da('0xb'),_0x1e6160);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x63da('0xc')],'set':function(_0xdc10c4){this['setDataValue'](_0x63da('0xd'),moment()['subtract'](_0xdc10c4,'ms'));this[_0x63da('0xa')](_0x63da('0xe'),moment());this[_0x63da('0xa')](_0x63da('0xf'),_0xdc10c4);}},'startedAt':{'type':Sequelize[_0x63da('0x10')],'get':function(){return moment(this['getDataValue'](_0x63da('0xd')))['format'](_0x63da('0x11'))[_0x63da('0x12')]();}},'closedAt':{'type':Sequelize[_0x63da('0x10')],'get':function(){return moment(this[_0x63da('0x6')](_0x63da('0xe')))[_0x63da('0x13')](_0x63da('0x11'))[_0x63da('0x12')]();}},'createdAt':{'type':Sequelize[_0x63da('0x10')],'get':function(){return moment(this[_0x63da('0x6')](_0x63da('0x14')))[_0x63da('0x13')](_0x63da('0x11'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x63da('0x6')]('updatedAt'))[_0x63da('0x13')](_0x63da('0x11'))[_0x63da('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 6f735ac..9c20db8 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 _0x032e=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','rawAttributes','fieldName','type','model','differenceBy','map','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ScreenRecording','rows','catch','show','find','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x1980f6,_0x49a8ff){var _0xe98f57=function(_0x6411a2){while(--_0x6411a2){_0x1980f6['push'](_0x1980f6['shift']());}};_0xe98f57(++_0x49a8ff);}(_0x032e,0x124));var _0xe032=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x032e[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xe032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe032('0x1'));var jsonpatch=require(_0xe032('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe032('0x3'));var Mustache=require(_0xe032('0x4'));var util=require(_0xe032('0x5'));var path=require(_0xe032('0x6'));var sox=require(_0xe032('0x7'));var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xcc;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0x1b')](_0x266d71);}return _0x646979['status'](_0x266d71)[_0xe032('0x1c')]();};}function respondWithResult(_0x2e267b,_0x176547){_0x176547=_0x176547||0xc8;return function(_0x422e96){if(_0x422e96){return _0x2e267b[_0xe032('0x1d')](_0x176547)[_0xe032('0x1e')](_0x422e96);}};}function respondWithFilteredResult(_0x2bf528,_0x4da5b7){return function(_0x231c35){if(_0x231c35){var _0x749018=typeof _0x4da5b7[_0xe032('0x1f')]===_0xe032('0x20')&&typeof _0x4da5b7[_0xe032('0x21')]===_0xe032('0x20');var _0x4cdab3=_0x231c35[_0xe032('0x22')];var _0x25cedb=_0x749018?0x0:_0x4da5b7[_0xe032('0x1f')];var _0x41d2a5=_0x749018?_0x231c35[_0xe032('0x22')]:_0x4da5b7['offset']+_0x4da5b7['limit'];var _0x484e6c;if(_0x41d2a5>=_0x4cdab3){_0x41d2a5=_0x4cdab3;_0x484e6c=0xc8;}else{_0x484e6c=0xce;}_0x2bf528[_0xe032('0x1d')](_0x484e6c);return _0x2bf528['set'](_0xe032('0x23'),_0x25cedb+'-'+_0x41d2a5+'/'+_0x4cdab3)[_0xe032('0x1e')](_0x231c35);}return null;};}function patchUpdates(_0x3f0257){return function(_0x2aa342){try{jsonpatch[_0xe032('0x24')](_0x2aa342,_0x3f0257,!![]);}catch(_0x256f71){return BPromise[_0xe032('0x25')](_0x256f71);}return _0x2aa342['save']();};}function saveUpdates(_0x32f8b6,_0x866c81){return function(_0x232e8f){if(_0x232e8f){return _0x232e8f[_0xe032('0x26')](_0x32f8b6)[_0xe032('0x27')](function(_0x33d89a){return _0x33d89a;});}return null;};}function removeEntity(_0x22831a,_0xe89aa7){return function(_0x499da5){if(_0x499da5){return _0x499da5['destroy']()['then'](function(){_0x22831a[_0xe032('0x1d')](0xcc)[_0xe032('0x1c')]();});}};}function handleEntityNotFound(_0x302559,_0x2a56e5){return function(_0x2bfe8f){if(!_0x2bfe8f){_0x302559[_0xe032('0x1b')](0x194);}return _0x2bfe8f;};}function handleError(_0x36ece7,_0x2b6ffa){_0x2b6ffa=_0x2b6ffa||0x1f4;return function(_0x4dcbf1){logger[_0xe032('0x28')](_0x4dcbf1['stack']);if(_0x4dcbf1[_0xe032('0x29')]){delete _0x4dcbf1[_0xe032('0x29')];}_0x36ece7[_0xe032('0x1d')](_0x2b6ffa)[_0xe032('0x2a')](_0x4dcbf1);};}exports['index']=function(_0x5573e4,_0x3e2575){var _0x38e7ea={},_0x469290={},_0xae116e={'count':0x0,'rows':[]};var _0x4e8b72=_['map'](db['ScreenRecording'][_0xe032('0x2b')],function(_0x1dd34f){return{'name':_0x1dd34f[_0xe032('0x2c')],'type':_0x1dd34f[_0xe032('0x2d')]['key']};});_0x469290[_0xe032('0x2e')]=_[_0xe032('0x2f')](_[_0xe032('0x30')](_0x4e8b72,_0xe032('0x29')),[_0xe032('0x31')]);_0x469290['query']=_[_0xe032('0x32')](_0x5573e4[_0xe032('0x33')]);_0x469290[_0xe032('0x34')]=_[_0xe032('0x35')](_0x469290['model'],_0x469290[_0xe032('0x33')]);_0x38e7ea['attributes']=_[_0xe032('0x35')](_0x469290['model'],qs[_0xe032('0x36')](_0x5573e4['query'][_0xe032('0x36')]));_0x38e7ea['attributes']=_0x38e7ea[_0xe032('0x37')][_0xe032('0x38')]?_0x38e7ea['attributes']:_0x469290[_0xe032('0x2e')];if(!_0x5573e4[_0xe032('0x33')][_0xe032('0x39')](_0xe032('0x3a'))){_0x38e7ea['limit']=qs[_0xe032('0x21')](_0x5573e4['query'][_0xe032('0x21')]);_0x38e7ea[_0xe032('0x1f')]=qs['offset'](_0x5573e4[_0xe032('0x33')][_0xe032('0x1f')]);}_0x38e7ea['order']=qs[_0xe032('0x3b')](_0x5573e4[_0xe032('0x33')][_0xe032('0x3b')]);_0x38e7ea[_0xe032('0x3c')]=qs[_0xe032('0x34')](_[_0xe032('0x3d')](_0x5573e4[_0xe032('0x33')],_0x469290[_0xe032('0x34')]),_0x4e8b72);if(_0x5573e4[_0xe032('0x33')][_0xe032('0x3e')]){_0x38e7ea[_0xe032('0x3c')]=_[_0xe032('0x3f')](_0x38e7ea[_0xe032('0x3c')],{'$or':_[_0xe032('0x30')](_0x4e8b72,function(_0x39af44){if(_0x39af44[_0xe032('0x2d')]!==_0xe032('0x40')){var _0x555914={};_0x555914[_0x39af44[_0xe032('0x29')]]={'$like':'%'+_0x5573e4['query'][_0xe032('0x3e')]+'%'};return _0x555914;}})});}_0x38e7ea=_[_0xe032('0x3f')]({},_0x38e7ea,_0x5573e4[_0xe032('0x41')]);var _0x119790={'where':_0x38e7ea[_0xe032('0x3c')]};return db['ScreenRecording'][_0xe032('0x22')](_0x119790)['then'](function(_0x46ea84){_0xae116e['count']=_0x46ea84;if(_0x5573e4[_0xe032('0x33')][_0xe032('0x42')]){_0x38e7ea[_0xe032('0x43')]=[{'all':!![]}];}return db[_0xe032('0x44')]['findAll'](_0x38e7ea);})[_0xe032('0x27')](function(_0x5a6450){_0xae116e[_0xe032('0x45')]=_0x5a6450;return _0xae116e;})[_0xe032('0x27')](respondWithFilteredResult(_0x3e2575,_0x38e7ea))[_0xe032('0x46')](handleError(_0x3e2575,null));};exports[_0xe032('0x47')]=function(_0x4b58eb,_0x513b0c){var _0x45345d={'raw':![],'where':{'id':_0x4b58eb['params']['id']}},_0x203021={};_0x203021[_0xe032('0x2e')]=_[_0xe032('0x32')](db[_0xe032('0x44')][_0xe032('0x2b')]);_0x203021[_0xe032('0x33')]=_['keys'](_0x4b58eb[_0xe032('0x33')]);_0x203021[_0xe032('0x34')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],_0x203021[_0xe032('0x33')]);_0x45345d[_0xe032('0x37')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],qs['fields'](_0x4b58eb['query'][_0xe032('0x36')]));_0x45345d['attributes']=_0x45345d[_0xe032('0x37')][_0xe032('0x38')]?_0x45345d[_0xe032('0x37')]:_0x203021[_0xe032('0x2e')];if(_0x4b58eb[_0xe032('0x33')][_0xe032('0x42')]){_0x45345d[_0xe032('0x43')]=[{'all':!![]}];}_0x45345d=_[_0xe032('0x3f')]({},_0x45345d,_0x4b58eb[_0xe032('0x41')]);return db['ScreenRecording'][_0xe032('0x48')](_0x45345d)['then'](handleEntityNotFound(_0x513b0c,null))['then'](respondWithResult(_0x513b0c,null))[_0xe032('0x46')](handleError(_0x513b0c,null));};exports[_0xe032('0x49')]=function(_0x62bfc8,_0x1e54d3){return db['ScreenRecording'][_0xe032('0x49')](_0x62bfc8[_0xe032('0x4a')],{})[_0xe032('0x27')](respondWithResult(_0x1e54d3,0xc9))[_0xe032('0x46')](handleError(_0x1e54d3,null));};exports[_0xe032('0x26')]=function(_0x233d9e,_0x3774bc){if(_0x233d9e['body']['id']){delete _0x233d9e[_0xe032('0x4a')]['id'];}delete _0x233d9e[_0xe032('0x4a')]['duration'];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4b')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4c')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4d')];return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x233d9e[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](handleEntityNotFound(_0x3774bc,null))[_0xe032('0x27')](saveUpdates(_0x233d9e[_0xe032('0x4a')],null))[_0xe032('0x27')](respondWithResult(_0x3774bc,null))[_0xe032('0x46')](handleError(_0x3774bc,null));};exports['describe']=function(_0x1c8b32,_0x53c8b2){return db[_0xe032('0x44')][_0xe032('0x4f')]()[_0xe032('0x27')](respondWithResult(_0x53c8b2,null))[_0xe032('0x46')](handleError(_0x53c8b2,null));};exports[_0xe032('0x50')]=function(_0x1b7a91,_0x2e29d3,_0xa98ee6){var _0x16c91e=require(_0xe032('0x51'));var _0x1b9012=![];var _0x564fe0={};if(_0x1b7a91[_0xe032('0x33')][_0xe032('0x2d')]&&_0x1b7a91['query'][_0xe032('0x2d')]==='uniqueid'){_0x564fe0[_0xe032('0x52')]=_0x1b7a91[_0xe032('0x4e')]['id'];}else{_0x564fe0['id']=_0x1b7a91[_0xe032('0x4e')]['id'];}return db[_0xe032('0x44')][_0xe032('0x48')]({'where':_0x564fe0,'attributes':['id','value'],'raw':!![]})[_0xe032('0x27')](handleEntityNotFound(_0x2e29d3,null))[_0xe032('0x27')](function(_0x1e1277){if(_0x1e1277){var _0x21a32f=path[_0xe032('0x53')](config[_0xe032('0x54')],_0xe032('0x55'),_0x1e1277['value']);var _0x3f46c0=util[_0xe032('0x31')](_0xe032('0x56'),_0x21a32f);if(fs[_0xe032('0x57')](_0x3f46c0)){_0x1b9012=!![];return _0x16c91e[_0xe032('0x58')](_0x3f46c0,_0x21a32f,config[_0xe032('0x59')][_0xe032('0x5a')])[_0xe032('0x27')](function(){return _0x1e1277;});}return _0x1e1277;}})[_0xe032('0x27')](function(_0x54c0b0){if(_0x54c0b0){var _0x795a58=path[_0xe032('0x53')](config[_0xe032('0x54')],'server/files/screen_recordings',_0x54c0b0[_0xe032('0x4d')]);if(!fs[_0xe032('0x57')](_0x795a58)){throw new db['Sequelize'][(_0xe032('0x5b'))](_0xe032('0x5c'));}if(_0x54c0b0[_0xe032('0x5d')]){return _0x2e29d3[_0xe032('0x50')](_0x795a58,_0x54c0b0[_0xe032('0x5d')]+path[_0xe032('0x5e')](_0x795a58),function(){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}else{return _0x2e29d3[_0xe032('0x50')](_0x795a58,function(_0x1aa18e){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}}})[_0xe032('0x46')](function(_0x505986){if(_0x505986[_0xe032('0x60')]===_0xe032('0x5c')){_0x2e29d3[_0xe032('0x1d')](0x194)[_0xe032('0x2a')](_0xe032('0x61'));}else{return handleError(_0x2e29d3,null);}});};exports['destroy']=function(_0x2b6ef8,_0x55e6b0){return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x2b6ef8[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](function(_0x3c5eb8){if(_[_0xe032('0x62')](_0x3c5eb8)){throw new ReferenceError(_0xe032('0x63'));}return _0x3c5eb8;})[_0xe032('0x27')](function(_0x22fd01){var _0x536510=path['join'](config['root'],_0xe032('0x55'),_0x22fd01[_0xe032('0x4d')]);logger[_0xe032('0x64')](_0xe032('0x65'),_0x536510);if(!_[_0xe032('0x62')](_0x22fd01[_0xe032('0x4d')])&&fs['existsSync'](_0x536510)){logger[_0xe032('0x64')](_0xe032('0x66')+_0x536510+_0xe032('0x67'));fs['unlinkSync'](_0x536510);}_0x536510=_0x536510+_0xe032('0x68');if(!_['isNil'](_0x22fd01[_0xe032('0x4d')])&&fs[_0xe032('0x57')](_0x536510)){logger['info']('File:\x20\x22'+_0x536510+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe032('0x69')](_0x536510);}return _0x22fd01;})['then'](function(_0x5157f7){if(!_0x5157f7)throw new InternalError();return _0x5157f7[_0xe032('0x6a')]();})[_0xe032('0x27')](function(){_0x55e6b0[_0xe032('0x1d')](0xcc)['end']();})[_0xe032('0x46')](handleError(_0x55e6b0,null));}; \ No newline at end of file +var _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x181935,_0xf18548){_0x181935=_0x181935-0x0;var _0xfe276d=_0x9c5a[_0x181935];return _0xfe276d;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 087aca7..71b1b1c 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 _0xcf65=['request-promise','path','../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','../../config/logger'];(function(_0x2f1be0,_0x4d5903){var _0x438719=function(_0x18c726){while(--_0x18c726){_0x2f1be0['push'](_0x2f1be0['shift']());}};_0x438719(++_0x4d5903);}(_0xcf65,0xfa));var _0x5cf6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcf65[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5cf6('0x0'));var util=require('util');var logger=require(_0x5cf6('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5cf6('0x2'));var fs=require('fs');var path=require(_0x5cf6('0x3'));var rimraf=require('rimraf');var config=require(_0x5cf6('0x4'));var attributes=require(_0x5cf6('0x5'));module[_0x5cf6('0x6')]=function(_0x417503,_0x4a7aac){return _0x417503['define']('ScreenRecording',attributes,{'tableName':_0x5cf6('0x7'),'paranoid':![],'indexes':[{'name':_0x5cf6('0x8'),'fields':[_0x5cf6('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf86c=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf86c,0x146));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf86('0x0'));var util=require(_0xcf86('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcf86('0x2'));var BPromise=require(_0xcf86('0x3'));var rp=require(_0xcf86('0x4'));var fs=require('fs');var path=require(_0xcf86('0x5'));var rimraf=require(_0xcf86('0x6'));var config=require(_0xcf86('0x7'));var attributes=require(_0xcf86('0x8'));module[_0xcf86('0x9')]=function(_0x16e2c1,_0x1f3e66){return _0x16e2c1[_0xcf86('0xa')](_0xcf86('0xb'),attributes,{'tableName':_0xcf86('0xc'),'paranoid':![],'indexes':[{'name':_0xcf86('0xd'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index e3e8b94..4367b76 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 _0x544a=['ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x475734,_0xf9e523){var _0x5280ae=function(_0x491184){while(--_0x491184){_0x475734['push'](_0x475734['shift']());}};_0x5280ae(++_0xf9e523);}(_0x544a,0xb0));var _0xa544=function(_0x2af011,_0x4e5395){_0x2af011=_0x2af011-0x0;var _0x5df10e=_0x544a[_0x2af011];return _0x5df10e;};'use strict';var _=require('lodash');var util=require(_0xa544('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa544('0x1'));var fs=require('fs');var Redis=require(_0xa544('0x2'));var db=require(_0xa544('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa544('0x4'))('rpc');var config=require(_0xa544('0x5'));var jayson=require(_0xa544('0x6'));var client=jayson[_0xa544('0x7')][_0xa544('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x431ba0,_0x3e6fbf,_0x5d86e0){return new BPromise(function(_0x31a186,_0x42ac7f){return client['request'](_0x431ba0,_0x5d86e0)[_0xa544('0x9')](function(_0x440134){logger[_0xa544('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x3e6fbf,_0xa544('0xb'));logger[_0xa544('0xc')](_0xa544('0xd'),_0x3e6fbf,_0xa544('0xb'),JSON[_0xa544('0xe')](_0x440134));if(_0x440134[_0xa544('0xf')]){if(_0x440134[_0xa544('0xf')][_0xa544('0x10')]===0x1f4){logger[_0xa544('0xf')](_0xa544('0x11'),_0x3e6fbf,_0x440134[_0xa544('0xf')][_0xa544('0x12')]);return _0x42ac7f(_0x440134[_0xa544('0xf')][_0xa544('0x12')]);}logger[_0xa544('0xf')](_0xa544('0x11'),_0x3e6fbf,_0x440134[_0xa544('0xf')]['message']);return _0x31a186(_0x440134['error'][_0xa544('0x12')]);}else{logger[_0xa544('0xa')](_0xa544('0x11'),_0x3e6fbf,_0xa544('0xb'));_0x31a186(_0x440134[_0xa544('0x13')][_0xa544('0x12')]);}})[_0xa544('0x14')](function(_0x2af7ef){logger[_0xa544('0xf')](_0xa544('0x11'),_0x3e6fbf,_0x2af7ef);_0x42ac7f(_0x2af7ef);});});} \ No newline at end of file +var _0x6c2d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x6c2d,0x1cd));var _0xd6c2=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x6c2d[_0x1d5400];return _0x21d9fe;};'use strict';var _=require(_0xd6c2('0x0'));var util=require(_0xd6c2('0x1'));var moment=require(_0xd6c2('0x2'));var BPromise=require(_0xd6c2('0x3'));var rs=require(_0xd6c2('0x4'));var fs=require('fs');var Redis=require(_0xd6c2('0x5'));var db=require(_0xd6c2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6c2('0x7'))(_0xd6c2('0x8'));var config=require('../../config/environment');var jayson=require(_0xd6c2('0x9'));var client=jayson[_0xd6c2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c43a7,_0x38357b,_0x431161){return new BPromise(function(_0xce2b59,_0x3143f7){return client[_0xd6c2('0xb')](_0x3c43a7,_0x431161)[_0xd6c2('0xc')](function(_0x3ff7c6){logger[_0xd6c2('0xd')](_0xd6c2('0xe'),_0x38357b,'request\x20sent');logger['debug'](_0xd6c2('0xf'),_0x38357b,_0xd6c2('0x10'),JSON[_0xd6c2('0x11')](_0x3ff7c6));if(_0x3ff7c6[_0xd6c2('0x12')]){if(_0x3ff7c6[_0xd6c2('0x12')]['code']===0x1f4){logger[_0xd6c2('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x38357b,_0x3ff7c6[_0xd6c2('0x12')]['message']);return _0x3143f7(_0x3ff7c6[_0xd6c2('0x12')]['message']);}logger[_0xd6c2('0x12')](_0xd6c2('0xe'),_0x38357b,_0x3ff7c6[_0xd6c2('0x12')]['message']);return _0xce2b59(_0x3ff7c6[_0xd6c2('0x12')][_0xd6c2('0x13')]);}else{logger[_0xd6c2('0xd')](_0xd6c2('0xe'),_0x38357b,_0xd6c2('0x10'));_0xce2b59(_0x3ff7c6[_0xd6c2('0x14')][_0xd6c2('0x13')]);}})['catch'](function(_0x3b6556){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x38357b,_0x3b6556);_0x3143f7(_0x3b6556);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index ce1ca8c..dd4b0fb 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 _0xae25=['logologin','post','/:id/logo_login','addLogoLogin','server/files/images/logos/','%s%s','preferred','single','addPreferred','/:id/favicon','addFavicon','put','update','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','getLogoLogin','/:id/gdpr','/:id/preferred','getFavicon','diskStorage','join','format','logo','extname','originalname','file','addLogo','root'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xae25,0xe0));var _0x5ae2=function(_0x2e83ac,_0x48ec7f){_0x2e83ac=_0x2e83ac-0x0;var _0x11d9b1=_0xae25[_0x2e83ac];return _0x11d9b1;};'use strict';var multer=require(_0x5ae2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5ae2('0x1'));var router=express[_0x5ae2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5ae2('0x3'));var interaction=require(_0x5ae2('0x4'));var config=require(_0x5ae2('0x5'));var controller=require(_0x5ae2('0x6'));router['get']('/',auth[_0x5ae2('0x7')](),controller[_0x5ae2('0x8')]);router[_0x5ae2('0x9')](_0x5ae2('0xa'),controller[_0x5ae2('0xb')]);router['get'](_0x5ae2('0xc'),controller[_0x5ae2('0xd')]);router[_0x5ae2('0x9')](_0x5ae2('0xe'),controller['getLogo']);router[_0x5ae2('0x9')]('/:id/logo_login',controller[_0x5ae2('0xf')]);router[_0x5ae2('0x9')](_0x5ae2('0x10'),controller['gdpr']);router['get'](_0x5ae2('0x11'),controller['getPreferred']);router[_0x5ae2('0x9')]('/:id/favicon',controller[_0x5ae2('0x12')]);var upload=multer({'storage':multer[_0x5ae2('0x13')]({'destination':function(_0x2f456e,_0x27768b,_0x4e3489){_0x4e3489(null,path[_0x5ae2('0x14')](config['root'],'server/files/images/logos/'));},'filename':function(_0x2fa4ab,_0x270734,_0x5891b4){_0x5891b4(null,util[_0x5ae2('0x15')]('%s%s',_0x5ae2('0x16'),path[_0x5ae2('0x17')](_0x270734[_0x5ae2('0x18')])));}})});router['post'](_0x5ae2('0xe'),upload['single'](_0x5ae2('0x19')),controller[_0x5ae2('0x1a')]);var upload=multer({'storage':multer[_0x5ae2('0x13')]({'destination':function(_0x4fbc0b,_0x26b857,_0x139a96){_0x139a96(null,path[_0x5ae2('0x14')](config[_0x5ae2('0x1b')],'server/files/images/logos/'));},'filename':function(_0x3c1747,_0x55a82b,_0x35f1bb){_0x35f1bb(null,util[_0x5ae2('0x15')]('%s%s',_0x5ae2('0x1c'),path[_0x5ae2('0x17')](_0x55a82b['originalname'])));}})});router[_0x5ae2('0x1d')](_0x5ae2('0x1e'),upload['single']('file'),controller[_0x5ae2('0x1f')]);var upload=multer({'storage':multer[_0x5ae2('0x13')]({'destination':function(_0x540a7b,_0x486180,_0x217def){_0x217def(null,path[_0x5ae2('0x14')](config[_0x5ae2('0x1b')],_0x5ae2('0x20')));},'filename':function(_0x1a34c7,_0x3b7eef,_0x1fc2c8){_0x1fc2c8(null,util['format'](_0x5ae2('0x21'),_0x5ae2('0x22'),path[_0x5ae2('0x17')](_0x3b7eef[_0x5ae2('0x18')])));}})});router[_0x5ae2('0x1d')](_0x5ae2('0x11'),upload[_0x5ae2('0x23')](_0x5ae2('0x19')),controller[_0x5ae2('0x24')]);var upload=multer({'storage':multer[_0x5ae2('0x13')]({'destination':function(_0x417db0,_0x15ae9c,_0x44a8dc){_0x44a8dc(null,path[_0x5ae2('0x14')](config[_0x5ae2('0x1b')],'server/files/images/logos/'));},'filename':function(_0x20e8ce,_0x2bff2c,_0x315b66){_0x315b66(null,util[_0x5ae2('0x15')](_0x5ae2('0x21'),'favicon',path['extname'](_0x2bff2c[_0x5ae2('0x18')])));}})});router[_0x5ae2('0x1d')](_0x5ae2('0x25'),upload[_0x5ae2('0x23')](_0x5ae2('0x19')),controller[_0x5ae2('0x26')]);router[_0x5ae2('0x27')](_0x5ae2('0xc'),auth[_0x5ae2('0x7')](),controller[_0x5ae2('0x28')]);module[_0x5ae2('0x29')]=router; \ No newline at end of file +var _0x62de=['Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','server/files/images/logos/','%s%s','logo','extname','originalname','single','file','addLogo','root','format','logologin','addLogoLogin','join','preferred','post','addPreferred','favicon','addFavicon','put','update','exports','util','path','express'];(function(_0x390aad,_0xc3bad2){var _0x5e8dfb=function(_0x32b315){while(--_0x32b315){_0x390aad['push'](_0x390aad['shift']());}};_0x5e8dfb(++_0xc3bad2);}(_0x62de,0x10b));var _0xe62d=function(_0xf18701,_0x5c68d6){_0xf18701=_0xf18701-0x0;var _0x1e4498=_0x62de[_0xf18701];return _0x1e4498;};'use strict';var multer=require('multer');var util=require(_0xe62d('0x0'));var path=require(_0xe62d('0x1'));var timeout=require('connect-timeout');var express=require(_0xe62d('0x2'));var router=express[_0xe62d('0x3')]();var fs_extra=require(_0xe62d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe62d('0x5'));var config=require(_0xe62d('0x6'));var controller=require(_0xe62d('0x7'));router['get']('/',auth[_0xe62d('0x8')](),controller[_0xe62d('0x9')]);router[_0xe62d('0xa')]('/now',controller[_0xe62d('0xb')]);router[_0xe62d('0xa')](_0xe62d('0xc'),controller[_0xe62d('0xd')]);router[_0xe62d('0xa')](_0xe62d('0xe'),controller[_0xe62d('0xf')]);router['get'](_0xe62d('0x10'),controller[_0xe62d('0x11')]);router[_0xe62d('0xa')](_0xe62d('0x12'),controller[_0xe62d('0x13')]);router[_0xe62d('0xa')](_0xe62d('0x14'),controller[_0xe62d('0x15')]);router[_0xe62d('0xa')](_0xe62d('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0xe62d('0x17')]({'destination':function(_0x3d21d4,_0x5dcbf9,_0x435cf0){_0x435cf0(null,path['join'](config['root'],_0xe62d('0x18')));},'filename':function(_0x1fd793,_0x23ac2a,_0x31636e){_0x31636e(null,util['format'](_0xe62d('0x19'),_0xe62d('0x1a'),path[_0xe62d('0x1b')](_0x23ac2a[_0xe62d('0x1c')])));}})});router['post'](_0xe62d('0xe'),upload[_0xe62d('0x1d')](_0xe62d('0x1e')),controller[_0xe62d('0x1f')]);var upload=multer({'storage':multer[_0xe62d('0x17')]({'destination':function(_0x325f8b,_0x5df1be,_0x397486){_0x397486(null,path['join'](config[_0xe62d('0x20')],_0xe62d('0x18')));},'filename':function(_0x331c1b,_0x567ee0,_0x4f91a9){_0x4f91a9(null,util[_0xe62d('0x21')]('%s%s',_0xe62d('0x22'),path[_0xe62d('0x1b')](_0x567ee0[_0xe62d('0x1c')])));}})});router['post'](_0xe62d('0x10'),upload[_0xe62d('0x1d')](_0xe62d('0x1e')),controller[_0xe62d('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x9ac94c,_0x3140c4,_0xd618bd){_0xd618bd(null,path[_0xe62d('0x24')](config[_0xe62d('0x20')],_0xe62d('0x18')));},'filename':function(_0xb1122d,_0x2a5161,_0x1f7e30){_0x1f7e30(null,util[_0xe62d('0x21')]('%s%s',_0xe62d('0x25'),path[_0xe62d('0x1b')](_0x2a5161[_0xe62d('0x1c')])));}})});router[_0xe62d('0x26')](_0xe62d('0x14'),upload[_0xe62d('0x1d')](_0xe62d('0x1e')),controller[_0xe62d('0x27')]);var upload=multer({'storage':multer[_0xe62d('0x17')]({'destination':function(_0x5848bb,_0x1e0013,_0x17e6a2){_0x17e6a2(null,path['join'](config['root'],_0xe62d('0x18')));},'filename':function(_0x2e99f1,_0x2db5ec,_0x38fdb7){_0x38fdb7(null,util[_0xe62d('0x21')]('%s%s',_0xe62d('0x28'),path[_0xe62d('0x1b')](_0x2db5ec['originalname'])));}})});router['post'](_0xe62d('0x16'),upload[_0xe62d('0x1d')]('file'),controller[_0xe62d('0x29')]);router[_0xe62d('0x2a')](_0xe62d('0xc'),auth[_0xe62d('0x8')](),controller[_0xe62d('0x2b')]);module[_0xe62d('0x2c')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c5541b8..a02c98f 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3b7087,_0x471e7d){var _0x475ab8=function(_0x2415db){while(--_0x2415db){_0x3b7087['push'](_0x3b7087['shift']());}};_0x475ab8(++_0x471e7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x4bda2f,_0x1a3dd1){var _0x418568=function(_0x2bf08d){while(--_0x2bf08d){_0x4bda2f['push'](_0x4bda2f['shift']());}};_0x418568(++_0x1a3dd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0b40c8a..dac37c6 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 _0x707d=['index','map','Setting','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','../../config/license/util','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','defaultLogo','default_preferred.png','addFavicon','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','end','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x707d,0x12d));var _0xd707=function(_0x284084,_0x5119f3){_0x284084=_0x284084-0x0;var _0x5c5f11=_0x707d[_0x284084];return _0x5c5f11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd707('0x0'));var zipdir=require(_0xd707('0x1'));var jsonpatch=require(_0xd707('0x2'));var rp=require(_0xd707('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd707('0x4'));var path=require(_0xd707('0x5'));var sox=require('sox');var csv=require(_0xd707('0x6'));var ejs=require(_0xd707('0x7'));var fs=require('fs');var fs_extra=require(_0xd707('0x8'));var _=require('lodash');var squel=require(_0xd707('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd707('0xa'));var toCsv=require(_0xd707('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd707('0xb'));var authService=require(_0xd707('0xc'));var qs=require(_0xd707('0xd'));var as=require(_0xd707('0xe'));var hardwareService=require(_0xd707('0xf'));var logger=require(_0xd707('0x10'))(_0xd707('0x11'));var utils=require(_0xd707('0x12'));var config=require(_0xd707('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd707('0x14'))['db'];var jayson=require(_0xd707('0x15'));var client=jayson[_0xd707('0x16')][_0xd707('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2c542b,_0x1dd032,_0x43c099,_0x10d387){return new BPromise(function(_0x2f5095,_0x1a6cf3){var _0x1e1555=_0x10d387||client;return _0x1e1555[_0xd707('0x18')](_0x2c542b,_0x43c099)[_0xd707('0x19')](function(_0x45315a){logger[_0xd707('0x1a')](_0xd707('0x1b'),_0x1dd032,_0xd707('0x1c'));logger['debug'](_0xd707('0x1d'),_0x1dd032,_0xd707('0x1c'),JSON['stringify'](_0x45315a));if(_0x45315a[_0xd707('0x1e')]){if(_0x45315a[_0xd707('0x1e')]['code']===0x1f4){logger['error'](_0xd707('0x1b'),_0x1dd032,_0x45315a[_0xd707('0x1e')][_0xd707('0x1f')]);return _0x1a6cf3(_0x45315a['error']['message']);}logger['error'](_0xd707('0x1b'),_0x1dd032,_0x45315a[_0xd707('0x1e')][_0xd707('0x1f')]);return _0x2f5095(_0x45315a[_0xd707('0x1e')][_0xd707('0x1f')]);}else{logger[_0xd707('0x1a')](_0xd707('0x1b'),_0x1dd032,_0xd707('0x1c'));_0x2f5095(_0x45315a['result'][_0xd707('0x1f')]);}})['catch'](function(_0x2c565f){logger['error'](_0xd707('0x1b'),_0x1dd032,_0x2c565f);_0x1a6cf3(_0x2c565f);});});}function respondWithStatusCode(_0x1ebe0d,_0x359afb){_0x359afb=_0x359afb||0xcc;return function(_0x3b5a58){if(_0x3b5a58){return _0x1ebe0d[_0xd707('0x20')](_0x359afb);}return _0x1ebe0d[_0xd707('0x21')](_0x359afb)['end']();};}function respondWithResult(_0x4dba8d,_0x39ece1){_0x39ece1=_0x39ece1||0xc8;return function(_0x77f544){if(_0x77f544){return _0x4dba8d[_0xd707('0x21')](_0x39ece1)[_0xd707('0x22')](_0x77f544);}};}function respondWithFilteredResult(_0x34003a,_0x1d6a0e){return function(_0x2374c9){if(_0x2374c9){var _0x21db2a=typeof _0x1d6a0e[_0xd707('0x23')]===_0xd707('0x24')&&typeof _0x1d6a0e[_0xd707('0x25')]===_0xd707('0x24');var _0x27819f=_0x2374c9[_0xd707('0x26')];var _0x1b34da=_0x21db2a?0x0:_0x1d6a0e[_0xd707('0x23')];var _0x20a594=_0x21db2a?_0x2374c9[_0xd707('0x26')]:_0x1d6a0e[_0xd707('0x23')]+_0x1d6a0e[_0xd707('0x25')];var _0x4f063f;if(_0x20a594>=_0x27819f){_0x20a594=_0x27819f;_0x4f063f=0xc8;}else{_0x4f063f=0xce;}_0x34003a['status'](_0x4f063f);return _0x34003a['set'](_0xd707('0x27'),_0x1b34da+'-'+_0x20a594+'/'+_0x27819f)[_0xd707('0x22')](_0x2374c9);}return null;};}function patchUpdates(_0x36f883){return function(_0x554ff1){try{jsonpatch[_0xd707('0x28')](_0x554ff1,_0x36f883,!![]);}catch(_0x206def){return BPromise[_0xd707('0x29')](_0x206def);}return _0x554ff1[_0xd707('0x2a')]();};}function saveUpdates(_0xb1884b,_0x2be803){return function(_0x144728){if(_0x144728){return _0x144728['update'](_0xb1884b)[_0xd707('0x19')](function(_0x31406f){return _0x31406f;});}return null;};}function removeEntity(_0x55d73f,_0xf6ff08){return function(_0x3371e0){if(_0x3371e0){return _0x3371e0['destroy']()[_0xd707('0x19')](function(){_0x55d73f[_0xd707('0x21')](0xcc)[_0xd707('0x2b')]();});}};}function handleEntityNotFound(_0x1dc7af,_0x4d6ef4){return function(_0x37b0b0){if(!_0x37b0b0){_0x1dc7af[_0xd707('0x20')](0x194);}return _0x37b0b0;};}function handleError(_0x1773af,_0x1a0eda){_0x1a0eda=_0x1a0eda||0x1f4;return function(_0x43d6b9){logger['error'](_0x43d6b9[_0xd707('0x2c')]);if(_0x43d6b9[_0xd707('0x2d')]){delete _0x43d6b9[_0xd707('0x2d')];}_0x1773af['status'](_0x1a0eda)[_0xd707('0x2e')](_0x43d6b9);};}exports[_0xd707('0x2f')]=function(_0x3399cc,_0x4d27d6){var _0x5fe867={},_0x4f115e={},_0x1965d9={'count':0x0,'rows':[]};var _0x238f7c=_[_0xd707('0x30')](db[_0xd707('0x31')][_0xd707('0x32')],function(_0x2a0312){return{'name':_0x2a0312[_0xd707('0x33')],'type':_0x2a0312[_0xd707('0x34')]['key']};});_0x4f115e[_0xd707('0x35')]=_[_0xd707('0x30')](_0x238f7c,_0xd707('0x2d'));_0x4f115e['query']=_[_0xd707('0x36')](_0x3399cc[_0xd707('0x37')]);_0x4f115e[_0xd707('0x38')]=_['intersection'](_0x4f115e[_0xd707('0x35')],_0x4f115e[_0xd707('0x37')]);_0x5fe867[_0xd707('0x39')]=_[_0xd707('0x3a')](_0x4f115e[_0xd707('0x35')],qs['fields'](_0x3399cc[_0xd707('0x37')][_0xd707('0x3b')]));_0x5fe867['attributes']=_0x5fe867[_0xd707('0x39')][_0xd707('0x3c')]?_0x5fe867[_0xd707('0x39')]:_0x4f115e[_0xd707('0x35')];if(!_0x3399cc['query']['hasOwnProperty'](_0xd707('0x3d'))){_0x5fe867[_0xd707('0x25')]=qs[_0xd707('0x25')](_0x3399cc[_0xd707('0x37')][_0xd707('0x25')]);_0x5fe867[_0xd707('0x23')]=qs[_0xd707('0x23')](_0x3399cc[_0xd707('0x37')]['offset']);}_0x5fe867['order']=qs['sort'](_0x3399cc['query'][_0xd707('0x3e')]);_0x5fe867[_0xd707('0x3f')]=qs[_0xd707('0x38')](_[_0xd707('0x40')](_0x3399cc[_0xd707('0x37')],_0x4f115e[_0xd707('0x38')]),_0x238f7c);if(_0x3399cc[_0xd707('0x37')][_0xd707('0x41')]){_0x5fe867[_0xd707('0x3f')]=_[_0xd707('0x42')](_0x5fe867['where'],{'$or':_[_0xd707('0x30')](_0x238f7c,function(_0x50f592){if(_0x50f592[_0xd707('0x34')]!==_0xd707('0x43')){var _0x2ce558={};_0x2ce558[_0x50f592[_0xd707('0x2d')]]={'$like':'%'+_0x3399cc['query'][_0xd707('0x41')]+'%'};return _0x2ce558;}})});}_0x5fe867=_[_0xd707('0x42')]({},_0x5fe867,_0x3399cc[_0xd707('0x44')]);var _0x1cc8d9={'where':_0x5fe867['where']};return db[_0xd707('0x31')][_0xd707('0x26')](_0x1cc8d9)[_0xd707('0x19')](function(_0x1cda4c){_0x1965d9[_0xd707('0x26')]=_0x1cda4c;if(_0x3399cc[_0xd707('0x37')][_0xd707('0x45')]){_0x5fe867['include']=[{'all':!![]}];}return db[_0xd707('0x31')][_0xd707('0x46')](_0x5fe867);})[_0xd707('0x19')](function(_0x410160){_0x1965d9[_0xd707('0x47')]=_0x410160;return _0x1965d9;})[_0xd707('0x19')](respondWithFilteredResult(_0x4d27d6,_0x5fe867))[_0xd707('0x48')](handleError(_0x4d27d6,null));};exports['show']=function(_0x156c88,_0x2a3b7e){var _0x33c575={'raw':![],'where':{'id':_0x156c88[_0xd707('0x49')]['id']}},_0x1a8cd4={};_0x1a8cd4['model']=_[_0xd707('0x36')](db['Setting'][_0xd707('0x32')]);_0x1a8cd4[_0xd707('0x37')]=_[_0xd707('0x36')](_0x156c88[_0xd707('0x37')]);_0x1a8cd4[_0xd707('0x38')]=_[_0xd707('0x3a')](_0x1a8cd4[_0xd707('0x35')],_0x1a8cd4[_0xd707('0x37')]);_0x33c575[_0xd707('0x39')]=_[_0xd707('0x3a')](_0x1a8cd4[_0xd707('0x35')],qs[_0xd707('0x3b')](_0x156c88['query'][_0xd707('0x3b')]));_0x33c575[_0xd707('0x39')]=_0x33c575['attributes']['length']?_0x33c575[_0xd707('0x39')]:_0x1a8cd4['model'];if(_0x156c88[_0xd707('0x37')][_0xd707('0x45')]){_0x33c575[_0xd707('0x4a')]=[{'all':!![]}];}_0x33c575=_[_0xd707('0x42')]({},_0x33c575,_0x156c88[_0xd707('0x44')]);return db[_0xd707('0x31')][_0xd707('0x4b')](_0x33c575)[_0xd707('0x19')](handleEntityNotFound(_0x2a3b7e,null))['then'](respondWithResult(_0x2a3b7e,null))[_0xd707('0x48')](handleError(_0x2a3b7e,null));};exports['update']=function(_0x3b7c29,_0x2f812c){if(_0x3b7c29[_0xd707('0x4c')]['id']){delete _0x3b7c29[_0xd707('0x4c')]['id'];}return db['Setting'][_0xd707('0x4b')]({'where':{'id':_0x3b7c29[_0xd707('0x49')]['id']}})[_0xd707('0x19')](handleEntityNotFound(_0x2f812c,null))[_0xd707('0x19')](saveUpdates(_0x3b7c29[_0xd707('0x4c')],null))['then'](respondWithResult(_0x2f812c,null))[_0xd707('0x48')](handleError(_0x2f812c,null));};exports[_0xd707('0x4d')]=function(_0x35e46c,_0x45a23a,_0x2eafdf){if(_0x35e46c['file']&&_0x35e46c[_0xd707('0x4e')][_0xd707('0x4f')]){_0x35e46c[_0xd707('0x4c')][_0xd707('0x50')]=_0x35e46c['file'][_0xd707('0x4f')];}return db[_0xd707('0x31')][_0xd707('0x4b')]({'where':{'id':_0x35e46c[_0xd707('0x49')]['id']}})['then'](handleEntityNotFound(_0x45a23a,null))['then'](saveUpdates(_0x35e46c['body'],null))[_0xd707('0x19')](respondWithResult(_0x45a23a,null))[_0xd707('0x48')](handleError(_0x45a23a,null));};exports[_0xd707('0x51')]=function(_0x151c95,_0x1acdbf,_0x54bcb0){if(_0x151c95[_0xd707('0x4e')]&&_0x151c95[_0xd707('0x4e')][_0xd707('0x4f')]){_0x151c95[_0xd707('0x4c')][_0xd707('0x52')]=_0x151c95[_0xd707('0x4e')][_0xd707('0x4f')];}return db['Setting'][_0xd707('0x4b')]({'where':{'id':_0x151c95[_0xd707('0x49')]['id']}})[_0xd707('0x19')](handleEntityNotFound(_0x1acdbf,null))[_0xd707('0x19')](saveUpdates(_0x151c95[_0xd707('0x4c')],null))[_0xd707('0x19')](respondWithResult(_0x1acdbf,null))['catch'](handleError(_0x1acdbf,null));};var utilLicense=require('../../config/license/util');exports[_0xd707('0x53')]=function(_0x5cdc74,_0x5d570b,_0x36c974){var _0x29df18=_0xd707('0x54');var _0x120660={'custom':![]};return utilLicense[_0xd707('0x55')]()[_0xd707('0x19')](function(_0x1dbffa){if(_0x1dbffa){_0x120660=_0x1dbffa;}return db[_0xd707('0x31')][_0xd707('0x4b')]({'where':{'id':_0x5cdc74[_0xd707('0x49')]['id']},'attributes':[_0xd707('0x50'),_0xd707('0x52'),_0xd707('0x56'),_0xd707('0x57'),'defaultLogo',_0xd707('0x58'),_0xd707('0x59'),_0xd707('0x5a')],'raw':!![]});})[_0xd707('0x19')](handleEntityNotFound(_0x5d570b,null))[_0xd707('0x19')](function(_0x4c4f68){if(_0x4c4f68){var _0x44e3e0=_0x4c4f68['logo']&&fs[_0xd707('0x5b')](path[_0xd707('0x5c')](config['root'],_0x29df18,_[_0xd707('0x5d')](_0x4c4f68[_0xd707('0x50')])))?path[_0xd707('0x5c')](config[_0xd707('0x5e')],_0x29df18,_[_0xd707('0x5d')](_0x4c4f68[_0xd707('0x50')])):path['join'](config['root'],_0x29df18,_[_0xd707('0x5d')](_0xd707('0x5f')));var _0x4fcb39='default'+_[_0xd707('0x60')]('logo');if(_0x4c4f68[_0x4fcb39]||!_0x120660[_0xd707('0x61')]){_0x44e3e0=path['join'](config[_0xd707('0x5e')],_0x29df18,_[_0xd707('0x5d')](_0xd707('0x5f')));}if(!fs[_0xd707('0x5b')](_0x44e3e0)){throw new db[(_0xd707('0x62'))][(_0xd707('0x63'))](_[_0xd707('0x60')](_0xd707('0x50'))+_0xd707('0x64'));}return _0x5d570b[_0xd707('0x65')](_0x44e3e0);}})[_0xd707('0x48')](handleError(_0x5d570b,null));};var utilLicense=require(_0xd707('0x66'));exports[_0xd707('0x67')]=function(_0x45a95f,_0x54f7b0,_0x4e0fa6){var _0x49e1de=_0xd707('0x54');var _0x5f02dc={'custom':![]};return utilLicense[_0xd707('0x55')]()[_0xd707('0x19')](function(_0xb3d4a9){if(_0xb3d4a9){_0x5f02dc=_0xb3d4a9;}return db[_0xd707('0x31')][_0xd707('0x4b')]({'where':{'id':_0x45a95f[_0xd707('0x49')]['id']},'attributes':[_0xd707('0x50'),_0xd707('0x52'),_0xd707('0x56'),_0xd707('0x57'),'defaultLogo',_0xd707('0x58'),_0xd707('0x59'),_0xd707('0x5a')],'raw':!![]});})[_0xd707('0x19')](handleEntityNotFound(_0x54f7b0,null))[_0xd707('0x19')](function(_0x526d95){if(_0x526d95){var _0x2d9bae=_0x526d95[_0xd707('0x52')]&&fs['existsSync'](path['join'](config[_0xd707('0x5e')],_0x49e1de,_[_0xd707('0x5d')](_0x526d95[_0xd707('0x52')])))?path[_0xd707('0x5c')](config[_0xd707('0x5e')],_0x49e1de,_[_0xd707('0x5d')](_0x526d95[_0xd707('0x52')])):path[_0xd707('0x5c')](config[_0xd707('0x5e')],_0x49e1de,_[_0xd707('0x5d')](_0xd707('0x68')));var _0x1d3d31='default'+_[_0xd707('0x60')](_0xd707('0x52'));if(_0x526d95[_0x1d3d31]||!_0x5f02dc[_0xd707('0x61')]){_0x2d9bae=path['join'](config['root'],_0x49e1de,_[_0xd707('0x5d')](_0xd707('0x68')));}if(!fs[_0xd707('0x5b')](_0x2d9bae)){throw new db[(_0xd707('0x62'))][(_0xd707('0x63'))](_['upperFirst'](_0xd707('0x52'))+_0xd707('0x64'));}return _0x54f7b0[_0xd707('0x65')](_0x2d9bae);}})[_0xd707('0x48')](handleError(_0x54f7b0,null));};exports[_0xd707('0x69')]=function(_0x471a12,_0x449de){return db[_0xd707('0x31')]['find']({'where':{'id':_0x471a12['params']['id']},'attributes':[_0xd707('0x6a')]})[_0xd707('0x19')](respondWithResult(_0x449de,null))[_0xd707('0x48')](handleError(_0x449de,null));};exports[_0xd707('0x6b')]=function(_0x3fe6b6,_0x11e583,_0x520061){if(_0x3fe6b6[_0xd707('0x4e')]&&_0x3fe6b6[_0xd707('0x4e')][_0xd707('0x4f')]){_0x3fe6b6['body'][_0xd707('0x56')]=_0x3fe6b6[_0xd707('0x4e')][_0xd707('0x4f')];}return db[_0xd707('0x31')][_0xd707('0x4b')]({'where':{'id':_0x3fe6b6[_0xd707('0x49')]['id']}})[_0xd707('0x19')](handleEntityNotFound(_0x11e583,null))[_0xd707('0x19')](saveUpdates(_0x3fe6b6[_0xd707('0x4c')],null))['then'](respondWithResult(_0x11e583,null))[_0xd707('0x48')](handleError(_0x11e583,null));};var utilLicense=require(_0xd707('0x66'));exports[_0xd707('0x6c')]=function(_0xfa868b,_0xb9e5f2,_0x447461){var _0x588963='server/files/images/logos';var _0xfcfd41={'custom':![]};return utilLicense[_0xd707('0x55')]()[_0xd707('0x19')](function(_0x4b36ac){if(_0x4b36ac){_0xfcfd41=_0x4b36ac;}return db[_0xd707('0x31')][_0xd707('0x4b')]({'where':{'id':_0xfa868b[_0xd707('0x49')]['id']},'attributes':['logo','loginLogo',_0xd707('0x56'),_0xd707('0x57'),_0xd707('0x6d'),_0xd707('0x58'),_0xd707('0x59'),_0xd707('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0xb9e5f2,null))[_0xd707('0x19')](function(_0x58b527){if(_0x58b527){var _0x31f483=_0x58b527[_0xd707('0x56')]&&fs[_0xd707('0x5b')](path[_0xd707('0x5c')](config['root'],_0x588963,_[_0xd707('0x5d')](_0x58b527[_0xd707('0x56')])))?path[_0xd707('0x5c')](config['root'],_0x588963,_[_0xd707('0x5d')](_0x58b527['preferred'])):path['join'](config[_0xd707('0x5e')],_0x588963,_[_0xd707('0x5d')](_0xd707('0x6e')));var _0x10efa5='default'+_[_0xd707('0x60')](_0xd707('0x56'));if(_0x58b527[_0x10efa5]||!_0xfcfd41[_0xd707('0x61')]||!_0xfcfd41['preferred']){_0x31f483=path[_0xd707('0x5c')](config[_0xd707('0x5e')],_0x588963,_['toLower'](_0xd707('0x6e')));}if(!fs[_0xd707('0x5b')](_0x31f483)){throw new db['Sequelize']['ValidationError'](_[_0xd707('0x60')](_0xd707('0x56'))+'\x20not\x20found');}return _0xb9e5f2[_0xd707('0x65')](_0x31f483);}})[_0xd707('0x48')](handleError(_0xb9e5f2,null));};exports[_0xd707('0x6f')]=function(_0x4b3176,_0x52c06e,_0x33f6fa){if(_0x4b3176[_0xd707('0x4e')]&&_0x4b3176[_0xd707('0x4e')][_0xd707('0x4f')]){_0x4b3176['body'][_0xd707('0x57')]=_0x4b3176[_0xd707('0x4e')][_0xd707('0x4f')];}return db[_0xd707('0x31')]['find']({'where':{'id':_0x4b3176['params']['id']}})['then'](handleEntityNotFound(_0x52c06e,null))[_0xd707('0x19')](saveUpdates(_0x4b3176[_0xd707('0x4c')],null))[_0xd707('0x19')](respondWithResult(_0x52c06e,null))[_0xd707('0x48')](handleError(_0x52c06e,null));};var utilLicense=require(_0xd707('0x66'));exports['getFavicon']=function(_0x4c7444,_0x29b2b1,_0x18df55){var _0x4e6dab=_0xd707('0x54');var _0x5dc1fc={'custom':![]};return utilLicense['getLicense']()[_0xd707('0x19')](function(_0x501ee1){if(_0x501ee1){_0x5dc1fc=_0x501ee1;}return db[_0xd707('0x31')][_0xd707('0x4b')]({'where':{'id':_0x4c7444[_0xd707('0x49')]['id']},'attributes':[_0xd707('0x50'),_0xd707('0x52'),_0xd707('0x56'),_0xd707('0x57'),_0xd707('0x6d'),_0xd707('0x58'),_0xd707('0x59'),'defaultFavicon'],'raw':!![]});})[_0xd707('0x19')](handleEntityNotFound(_0x29b2b1,null))['then'](function(_0x54fbc9){if(_0x54fbc9){var _0x20c5e7=_0x54fbc9[_0xd707('0x57')]&&fs[_0xd707('0x5b')](path['join'](config[_0xd707('0x5e')],_0x4e6dab,_[_0xd707('0x5d')](_0x54fbc9[_0xd707('0x57')])))?path[_0xd707('0x5c')](config[_0xd707('0x5e')],_0x4e6dab,_[_0xd707('0x5d')](_0x54fbc9[_0xd707('0x57')])):path[_0xd707('0x5c')](config[_0xd707('0x5e')],_0x4e6dab,_[_0xd707('0x5d')]('default_favicon.ico'));var _0x1c357d='default'+_[_0xd707('0x60')](_0xd707('0x57'));if(_0x54fbc9[_0x1c357d]||!_0x5dc1fc['custom']){_0x20c5e7=path['join'](config[_0xd707('0x5e')],_0x4e6dab,_[_0xd707('0x5d')]('default_favicon.ico'));}if(!fs[_0xd707('0x5b')](_0x20c5e7)){throw new db[(_0xd707('0x62'))][(_0xd707('0x63'))](_[_0xd707('0x60')](_0xd707('0x57'))+_0xd707('0x64'));}return _0x29b2b1[_0xd707('0x65')](_0x20c5e7);}})[_0xd707('0x48')](handleError(_0x29b2b1,null));};exports[_0xd707('0x70')]=function(_0x26455d,_0x414a09){var _0x1fd286={'offset':moment()[_0xd707('0x71')]()};_0x1fd286['now']=moment()[_0xd707('0x71')](_0x1fd286[_0xd707('0x23')])[_0xd707('0x72')](_0xd707('0x73'));return _0x414a09[_0xd707('0x21')](0xc8)[_0xd707('0x2e')](_0x1fd286);}; \ No newline at end of file +var _0xa27b=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','Setting','findAll','find','body','params','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','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','jayson/promise','client','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xa27b,0x1b5));var _0xba27=function(_0x5af903,_0x258d63){_0x5af903=_0x5af903-0x0;var _0x6b0e75=_0xa27b[_0x5af903];return _0x6b0e75;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba27('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba27('0x1'));var moment=require('moment');var BPromise=require(_0xba27('0x2'));var Mustache=require(_0xba27('0x3'));var util=require('util');var path=require(_0xba27('0x4'));var sox=require('sox');var csv=require(_0xba27('0x5'));var ejs=require(_0xba27('0x6'));var fs=require('fs');var fs_extra=require(_0xba27('0x7'));var _=require(_0xba27('0x8'));var squel=require(_0xba27('0x9'));var crypto=require(_0xba27('0xa'));var jsforce=require(_0xba27('0xb'));var deskjs=require(_0xba27('0xc'));var toCsv=require(_0xba27('0x5'));var querystring=require(_0xba27('0xd'));var Papa=require('papaparse');var Redis=require(_0xba27('0xe'));var authService=require(_0xba27('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba27('0x10'));var hardwareService=require(_0xba27('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xba27('0x12'));var config=require(_0xba27('0x13'));var licenseUtil=require(_0xba27('0x14'));var db=require(_0xba27('0x15'))['db'];var jayson=require(_0xba27('0x16'));var client=jayson[_0xba27('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b71e0,_0x443022,_0x24afbf,_0x23cf61){return new BPromise(function(_0x142f52,_0x2859f8){var _0xc0936b=_0x23cf61||client;return _0xc0936b[_0xba27('0x18')](_0x2b71e0,_0x24afbf)[_0xba27('0x19')](function(_0x124f17){logger[_0xba27('0x1a')]('Setting,\x20%s,\x20%s',_0x443022,_0xba27('0x1b'));logger[_0xba27('0x1c')](_0xba27('0x1d'),_0x443022,'request\x20sent',JSON['stringify'](_0x124f17));if(_0x124f17['error']){if(_0x124f17[_0xba27('0x1e')]['code']===0x1f4){logger['error'](_0xba27('0x1f'),_0x443022,_0x124f17[_0xba27('0x1e')][_0xba27('0x20')]);return _0x2859f8(_0x124f17[_0xba27('0x1e')][_0xba27('0x20')]);}logger['error']('Setting,\x20%s,\x20%s',_0x443022,_0x124f17['error'][_0xba27('0x20')]);return _0x142f52(_0x124f17[_0xba27('0x1e')][_0xba27('0x20')]);}else{logger['info'](_0xba27('0x1f'),_0x443022,_0xba27('0x1b'));_0x142f52(_0x124f17[_0xba27('0x21')]['message']);}})[_0xba27('0x22')](function(_0x41a5ce){logger['error'](_0xba27('0x1f'),_0x443022,_0x41a5ce);_0x2859f8(_0x41a5ce);});});}function respondWithStatusCode(_0x36f838,_0x54c2b9){_0x54c2b9=_0x54c2b9||0xcc;return function(_0x548bba){if(_0x548bba){return _0x36f838[_0xba27('0x23')](_0x54c2b9);}return _0x36f838[_0xba27('0x24')](_0x54c2b9)[_0xba27('0x25')]();};}function respondWithResult(_0x259ec3,_0xf29a2a){_0xf29a2a=_0xf29a2a||0xc8;return function(_0x44cb98){if(_0x44cb98){return _0x259ec3[_0xba27('0x24')](_0xf29a2a)[_0xba27('0x26')](_0x44cb98);}};}function respondWithFilteredResult(_0x5ea3bd,_0x5d80dc){return function(_0x29d1c1){if(_0x29d1c1){var _0x5c8393=typeof _0x5d80dc[_0xba27('0x27')]===_0xba27('0x28')&&typeof _0x5d80dc[_0xba27('0x29')]===_0xba27('0x28');var _0x10066a=_0x29d1c1[_0xba27('0x2a')];var _0x505a63=_0x5c8393?0x0:_0x5d80dc[_0xba27('0x27')];var _0x53c9d3=_0x5c8393?_0x29d1c1['count']:_0x5d80dc[_0xba27('0x27')]+_0x5d80dc[_0xba27('0x29')];var _0x15ca41;if(_0x53c9d3>=_0x10066a){_0x53c9d3=_0x10066a;_0x15ca41=0xc8;}else{_0x15ca41=0xce;}_0x5ea3bd[_0xba27('0x24')](_0x15ca41);return _0x5ea3bd[_0xba27('0x2b')](_0xba27('0x2c'),_0x505a63+'-'+_0x53c9d3+'/'+_0x10066a)[_0xba27('0x26')](_0x29d1c1);}return null;};}function patchUpdates(_0x51e97c){return function(_0x3118ab){try{jsonpatch[_0xba27('0x2d')](_0x3118ab,_0x51e97c,!![]);}catch(_0x936589){return BPromise[_0xba27('0x2e')](_0x936589);}return _0x3118ab[_0xba27('0x2f')]();};}function saveUpdates(_0xde5b8c,_0x4bb18b){return function(_0x2dc7a0){if(_0x2dc7a0){return _0x2dc7a0[_0xba27('0x30')](_0xde5b8c)['then'](function(_0x3ffc0c){return _0x3ffc0c;});}return null;};}function removeEntity(_0x58a68e,_0x19b835){return function(_0x1d4ca2){if(_0x1d4ca2){return _0x1d4ca2[_0xba27('0x31')]()['then'](function(){_0x58a68e[_0xba27('0x24')](0xcc)[_0xba27('0x25')]();});}};}function handleEntityNotFound(_0x33273d,_0x29397a){return function(_0x19d37a){if(!_0x19d37a){_0x33273d[_0xba27('0x23')](0x194);}return _0x19d37a;};}function handleError(_0x2b8752,_0x188fcd){_0x188fcd=_0x188fcd||0x1f4;return function(_0x22cb76){logger[_0xba27('0x1e')](_0x22cb76['stack']);if(_0x22cb76[_0xba27('0x32')]){delete _0x22cb76[_0xba27('0x32')];}_0x2b8752[_0xba27('0x24')](_0x188fcd)['send'](_0x22cb76);};}exports[_0xba27('0x33')]=function(_0x16da6c,_0x1e2ffb){var _0x169382={},_0x2a4447={},_0x58da2b={'count':0x0,'rows':[]};var _0x326bd9=_['map'](db['Setting'][_0xba27('0x34')],function(_0x2faf31){return{'name':_0x2faf31[_0xba27('0x35')],'type':_0x2faf31[_0xba27('0x36')]['key']};});_0x2a4447[_0xba27('0x37')]=_[_0xba27('0x38')](_0x326bd9,_0xba27('0x32'));_0x2a4447[_0xba27('0x39')]=_[_0xba27('0x3a')](_0x16da6c[_0xba27('0x39')]);_0x2a4447[_0xba27('0x3b')]=_[_0xba27('0x3c')](_0x2a4447[_0xba27('0x37')],_0x2a4447[_0xba27('0x39')]);_0x169382[_0xba27('0x3d')]=_[_0xba27('0x3c')](_0x2a4447[_0xba27('0x37')],qs[_0xba27('0x3e')](_0x16da6c[_0xba27('0x39')][_0xba27('0x3e')]));_0x169382['attributes']=_0x169382[_0xba27('0x3d')][_0xba27('0x3f')]?_0x169382[_0xba27('0x3d')]:_0x2a4447[_0xba27('0x37')];if(!_0x16da6c[_0xba27('0x39')]['hasOwnProperty'](_0xba27('0x40'))){_0x169382['limit']=qs[_0xba27('0x29')](_0x16da6c[_0xba27('0x39')]['limit']);_0x169382[_0xba27('0x27')]=qs[_0xba27('0x27')](_0x16da6c[_0xba27('0x39')][_0xba27('0x27')]);}_0x169382[_0xba27('0x41')]=qs[_0xba27('0x42')](_0x16da6c[_0xba27('0x39')][_0xba27('0x42')]);_0x169382['where']=qs[_0xba27('0x3b')](_[_0xba27('0x43')](_0x16da6c[_0xba27('0x39')],_0x2a4447[_0xba27('0x3b')]),_0x326bd9);if(_0x16da6c[_0xba27('0x39')]['filter']){_0x169382['where']=_[_0xba27('0x44')](_0x169382[_0xba27('0x45')],{'$or':_[_0xba27('0x38')](_0x326bd9,function(_0x4fd97e){if(_0x4fd97e[_0xba27('0x36')]!==_0xba27('0x46')){var _0x168101={};_0x168101[_0x4fd97e['name']]={'$like':'%'+_0x16da6c[_0xba27('0x39')][_0xba27('0x47')]+'%'};return _0x168101;}})});}_0x169382=_[_0xba27('0x44')]({},_0x169382,_0x16da6c[_0xba27('0x48')]);var _0x55375d={'where':_0x169382[_0xba27('0x45')]};return db['Setting'][_0xba27('0x2a')](_0x55375d)['then'](function(_0xbe7c23){_0x58da2b[_0xba27('0x2a')]=_0xbe7c23;if(_0x16da6c[_0xba27('0x39')][_0xba27('0x49')]){_0x169382[_0xba27('0x4a')]=[{'all':!![]}];}return db[_0xba27('0x4b')][_0xba27('0x4c')](_0x169382);})[_0xba27('0x19')](function(_0x3c896c){_0x58da2b['rows']=_0x3c896c;return _0x58da2b;})[_0xba27('0x19')](respondWithFilteredResult(_0x1e2ffb,_0x169382))[_0xba27('0x22')](handleError(_0x1e2ffb,null));};exports['show']=function(_0x41078a,_0x50a2d3){var _0xee30a2={'raw':![],'where':{'id':_0x41078a['params']['id']}},_0x5e902d={};_0x5e902d[_0xba27('0x37')]=_[_0xba27('0x3a')](db[_0xba27('0x4b')][_0xba27('0x34')]);_0x5e902d['query']=_[_0xba27('0x3a')](_0x41078a['query']);_0x5e902d[_0xba27('0x3b')]=_[_0xba27('0x3c')](_0x5e902d[_0xba27('0x37')],_0x5e902d[_0xba27('0x39')]);_0xee30a2['attributes']=_['intersection'](_0x5e902d[_0xba27('0x37')],qs[_0xba27('0x3e')](_0x41078a['query'][_0xba27('0x3e')]));_0xee30a2['attributes']=_0xee30a2[_0xba27('0x3d')][_0xba27('0x3f')]?_0xee30a2[_0xba27('0x3d')]:_0x5e902d[_0xba27('0x37')];if(_0x41078a[_0xba27('0x39')][_0xba27('0x49')]){_0xee30a2[_0xba27('0x4a')]=[{'all':!![]}];}_0xee30a2=_[_0xba27('0x44')]({},_0xee30a2,_0x41078a[_0xba27('0x48')]);return db[_0xba27('0x4b')][_0xba27('0x4d')](_0xee30a2)[_0xba27('0x19')](handleEntityNotFound(_0x50a2d3,null))[_0xba27('0x19')](respondWithResult(_0x50a2d3,null))[_0xba27('0x22')](handleError(_0x50a2d3,null));};exports[_0xba27('0x30')]=function(_0x443fa7,_0x344f97){if(_0x443fa7[_0xba27('0x4e')]['id']){delete _0x443fa7[_0xba27('0x4e')]['id'];}return db[_0xba27('0x4b')]['find']({'where':{'id':_0x443fa7[_0xba27('0x4f')]['id']}})[_0xba27('0x19')](handleEntityNotFound(_0x344f97,null))['then'](saveUpdates(_0x443fa7[_0xba27('0x4e')],null))[_0xba27('0x19')](respondWithResult(_0x344f97,null))[_0xba27('0x22')](handleError(_0x344f97,null));};exports['addLogo']=function(_0x557003,_0x162eef,_0x20d695){if(_0x557003[_0xba27('0x50')]&&_0x557003['file'][_0xba27('0x51')]){_0x557003[_0xba27('0x4e')][_0xba27('0x52')]=_0x557003['file'][_0xba27('0x51')];}return db['Setting'][_0xba27('0x4d')]({'where':{'id':_0x557003[_0xba27('0x4f')]['id']}})[_0xba27('0x19')](handleEntityNotFound(_0x162eef,null))[_0xba27('0x19')](saveUpdates(_0x557003['body'],null))['then'](respondWithResult(_0x162eef,null))[_0xba27('0x22')](handleError(_0x162eef,null));};exports[_0xba27('0x53')]=function(_0x241028,_0x361b45,_0x2136ed){if(_0x241028[_0xba27('0x50')]&&_0x241028[_0xba27('0x50')][_0xba27('0x51')]){_0x241028[_0xba27('0x4e')][_0xba27('0x54')]=_0x241028[_0xba27('0x50')]['filename'];}return db['Setting']['find']({'where':{'id':_0x241028[_0xba27('0x4f')]['id']}})[_0xba27('0x19')](handleEntityNotFound(_0x361b45,null))['then'](saveUpdates(_0x241028[_0xba27('0x4e')],null))[_0xba27('0x19')](respondWithResult(_0x361b45,null))['catch'](handleError(_0x361b45,null));};var utilLicense=require(_0xba27('0x14'));exports['getLogo']=function(_0x311dec,_0x20395c,_0x3346b6){var _0x36f185=_0xba27('0x55');var _0x35dc03={'custom':![]};return utilLicense[_0xba27('0x56')]()['then'](function(_0x3b9b3c){if(_0x3b9b3c){_0x35dc03=_0x3b9b3c;}return db[_0xba27('0x4b')]['find']({'where':{'id':_0x311dec[_0xba27('0x4f')]['id']},'attributes':['logo',_0xba27('0x54'),_0xba27('0x57'),_0xba27('0x58'),'defaultLogo',_0xba27('0x59'),_0xba27('0x5a'),_0xba27('0x5b')],'raw':!![]});})[_0xba27('0x19')](handleEntityNotFound(_0x20395c,null))[_0xba27('0x19')](function(_0x229ec1){if(_0x229ec1){var _0xa2c527=_0x229ec1[_0xba27('0x52')]&&fs[_0xba27('0x5c')](path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x36f185,_[_0xba27('0x5f')](_0x229ec1[_0xba27('0x52')])))?path[_0xba27('0x5d')](config['root'],_0x36f185,_[_0xba27('0x5f')](_0x229ec1['logo'])):path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x36f185,_['toLower'](_0xba27('0x60')));var _0x2cc768=_0xba27('0x61')+_[_0xba27('0x62')](_0xba27('0x52'));if(_0x229ec1[_0x2cc768]||!_0x35dc03[_0xba27('0x63')]){_0xa2c527=path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x36f185,_[_0xba27('0x5f')]('default_logo.svg'));}if(!fs[_0xba27('0x5c')](_0xa2c527)){throw new db[(_0xba27('0x64'))]['ValidationError'](_[_0xba27('0x62')](_0xba27('0x52'))+_0xba27('0x65'));}return _0x20395c[_0xba27('0x66')](_0xa2c527);}})[_0xba27('0x22')](handleError(_0x20395c,null));};var utilLicense=require(_0xba27('0x14'));exports[_0xba27('0x67')]=function(_0x14c4ab,_0x2c9802,_0xb5840c){var _0x946a3f=_0xba27('0x55');var _0x5ebddd={'custom':![]};return utilLicense[_0xba27('0x56')]()[_0xba27('0x19')](function(_0x5cdaf6){if(_0x5cdaf6){_0x5ebddd=_0x5cdaf6;}return db[_0xba27('0x4b')]['find']({'where':{'id':_0x14c4ab[_0xba27('0x4f')]['id']},'attributes':[_0xba27('0x52'),'loginLogo',_0xba27('0x57'),_0xba27('0x58'),_0xba27('0x68'),_0xba27('0x59'),_0xba27('0x5a'),_0xba27('0x5b')],'raw':!![]});})[_0xba27('0x19')](handleEntityNotFound(_0x2c9802,null))[_0xba27('0x19')](function(_0xe6ba13){if(_0xe6ba13){var _0x598ded=_0xe6ba13[_0xba27('0x54')]&&fs[_0xba27('0x5c')](path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x946a3f,_[_0xba27('0x5f')](_0xe6ba13[_0xba27('0x54')])))?path['join'](config['root'],_0x946a3f,_['toLower'](_0xe6ba13[_0xba27('0x54')])):path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x946a3f,_[_0xba27('0x5f')]('default_loginLogo.svg'));var _0x610963=_0xba27('0x61')+_[_0xba27('0x62')](_0xba27('0x54'));if(_0xe6ba13[_0x610963]||!_0x5ebddd[_0xba27('0x63')]){_0x598ded=path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x946a3f,_['toLower'](_0xba27('0x69')));}if(!fs['existsSync'](_0x598ded)){throw new db[(_0xba27('0x64'))][(_0xba27('0x6a'))](_['upperFirst']('loginLogo')+'\x20not\x20found');}return _0x2c9802[_0xba27('0x66')](_0x598ded);}})[_0xba27('0x22')](handleError(_0x2c9802,null));};exports[_0xba27('0x6b')]=function(_0x1c78a9,_0x40fbb7){return db['Setting'][_0xba27('0x4d')]({'where':{'id':_0x1c78a9[_0xba27('0x4f')]['id']},'attributes':[_0xba27('0x6c')]})[_0xba27('0x19')](respondWithResult(_0x40fbb7,null))['catch'](handleError(_0x40fbb7,null));};exports[_0xba27('0x6d')]=function(_0x46a00e,_0x4c7003,_0x41767d){if(_0x46a00e[_0xba27('0x50')]&&_0x46a00e[_0xba27('0x50')][_0xba27('0x51')]){_0x46a00e['body'][_0xba27('0x57')]=_0x46a00e[_0xba27('0x50')]['filename'];}return db[_0xba27('0x4b')][_0xba27('0x4d')]({'where':{'id':_0x46a00e[_0xba27('0x4f')]['id']}})[_0xba27('0x19')](handleEntityNotFound(_0x4c7003,null))[_0xba27('0x19')](saveUpdates(_0x46a00e[_0xba27('0x4e')],null))[_0xba27('0x19')](respondWithResult(_0x4c7003,null))[_0xba27('0x22')](handleError(_0x4c7003,null));};var utilLicense=require(_0xba27('0x14'));exports['getPreferred']=function(_0x36bebf,_0x475a24,_0x11d4cb){var _0x26879f='server/files/images/logos';var _0x57b56f={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x14ddfa){if(_0x14ddfa){_0x57b56f=_0x14ddfa;}return db[_0xba27('0x4b')]['find']({'where':{'id':_0x36bebf[_0xba27('0x4f')]['id']},'attributes':[_0xba27('0x52'),_0xba27('0x54'),_0xba27('0x57'),_0xba27('0x58'),_0xba27('0x68'),_0xba27('0x59'),_0xba27('0x5a'),_0xba27('0x5b')],'raw':!![]});})[_0xba27('0x19')](handleEntityNotFound(_0x475a24,null))[_0xba27('0x19')](function(_0x5cb939){if(_0x5cb939){var _0x50ade6=_0x5cb939['preferred']&&fs['existsSync'](path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x26879f,_[_0xba27('0x5f')](_0x5cb939[_0xba27('0x57')])))?path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x26879f,_[_0xba27('0x5f')](_0x5cb939[_0xba27('0x57')])):path['join'](config[_0xba27('0x5e')],_0x26879f,_[_0xba27('0x5f')](_0xba27('0x6e')));var _0x197bde='default'+_[_0xba27('0x62')](_0xba27('0x57'));if(_0x5cb939[_0x197bde]||!_0x57b56f[_0xba27('0x63')]||!_0x57b56f['preferred']){_0x50ade6=path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x26879f,_[_0xba27('0x5f')]('default_preferred.png'));}if(!fs[_0xba27('0x5c')](_0x50ade6)){throw new db[(_0xba27('0x64'))][(_0xba27('0x6a'))](_[_0xba27('0x62')](_0xba27('0x57'))+_0xba27('0x65'));}return _0x475a24[_0xba27('0x66')](_0x50ade6);}})[_0xba27('0x22')](handleError(_0x475a24,null));};exports[_0xba27('0x6f')]=function(_0x55d053,_0xa01c3e,_0x9f2711){if(_0x55d053[_0xba27('0x50')]&&_0x55d053[_0xba27('0x50')][_0xba27('0x51')]){_0x55d053[_0xba27('0x4e')][_0xba27('0x58')]=_0x55d053[_0xba27('0x50')][_0xba27('0x51')];}return db[_0xba27('0x4b')][_0xba27('0x4d')]({'where':{'id':_0x55d053[_0xba27('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa01c3e,null))[_0xba27('0x19')](saveUpdates(_0x55d053[_0xba27('0x4e')],null))['then'](respondWithResult(_0xa01c3e,null))[_0xba27('0x22')](handleError(_0xa01c3e,null));};var utilLicense=require(_0xba27('0x14'));exports[_0xba27('0x70')]=function(_0x723f27,_0x473a0e,_0x3ade7c){var _0x469f89='server/files/images/logos';var _0x474647={'custom':![]};return utilLicense[_0xba27('0x56')]()[_0xba27('0x19')](function(_0x386373){if(_0x386373){_0x474647=_0x386373;}return db['Setting'][_0xba27('0x4d')]({'where':{'id':_0x723f27['params']['id']},'attributes':[_0xba27('0x52'),_0xba27('0x54'),_0xba27('0x57'),_0xba27('0x58'),'defaultLogo',_0xba27('0x59'),_0xba27('0x5a'),_0xba27('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x473a0e,null))[_0xba27('0x19')](function(_0x4a4358){if(_0x4a4358){var _0xf33acd=_0x4a4358['favicon']&&fs[_0xba27('0x5c')](path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x469f89,_[_0xba27('0x5f')](_0x4a4358[_0xba27('0x58')])))?path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x469f89,_[_0xba27('0x5f')](_0x4a4358[_0xba27('0x58')])):path['join'](config[_0xba27('0x5e')],_0x469f89,_[_0xba27('0x5f')](_0xba27('0x71')));var _0x1952fa=_0xba27('0x61')+_[_0xba27('0x62')](_0xba27('0x58'));if(_0x4a4358[_0x1952fa]||!_0x474647['custom']){_0xf33acd=path[_0xba27('0x5d')](config[_0xba27('0x5e')],_0x469f89,_['toLower'](_0xba27('0x71')));}if(!fs[_0xba27('0x5c')](_0xf33acd)){throw new db['Sequelize']['ValidationError'](_[_0xba27('0x62')](_0xba27('0x58'))+_0xba27('0x65'));}return _0x473a0e['download'](_0xf33acd);}})['catch'](handleError(_0x473a0e,null));};exports[_0xba27('0x72')]=function(_0x8bac4c,_0x5a6386){var _0x4885ce={'offset':moment()['utcOffset']()};_0x4885ce[_0xba27('0x73')]=moment()['utcOffset'](_0x4885ce[_0xba27('0x27')])[_0xba27('0x74')](_0xba27('0x75'));return _0x5a6386[_0xba27('0x24')](0xc8)[_0xba27('0x76')](_0x4885ce);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index fe07298..a0f8acc 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(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0x008c,0x188));var _0xc008=function(_0x581bc7,_0x2ce3c5){_0x581bc7=_0x581bc7-0x0;var _0x2d951d=_0x008c[_0x581bc7];return _0x2d951d;};'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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x3e74,0x175));var _0x43e7=function(_0x564270,_0x315e44){_0x564270=_0x564270-0x0;var _0x5c3ee=_0x3e74[_0x564270];return _0x5c3ee;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f7c9569..63d62b1 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 _0x8467=['model','then','info','lodash','util','randomstring','ioredis','rpc','../../config/environment','client','http','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSetting','Setting','options','where','attributes','include','map'];(function(_0xd06d7d,_0x2b0dc2){var _0x31db07=function(_0x286ec8){while(--_0x286ec8){_0xd06d7d['push'](_0xd06d7d['shift']());}};_0x31db07(++_0x2b0dc2);}(_0x8467,0x9f));var _0x7846=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x8467[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0x7846('0x0'));var util=require(_0x7846('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7846('0x2'));var fs=require('fs');var Redis=require(_0x7846('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7846('0x4'));var config=require(_0x7846('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7846('0x6')][_0x7846('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17b210,_0x24eb59,_0x442537){return new BPromise(function(_0x307526,_0x37e4f5){return client['request'](_0x17b210,_0x442537)['then'](function(_0x4cb3c7){logger['info'](_0x7846('0x8'),_0x24eb59,_0x7846('0x9'));logger[_0x7846('0xa')]('Setting,\x20%s,\x20%s,\x20%s',_0x24eb59,_0x7846('0x9'),JSON[_0x7846('0xb')](_0x4cb3c7));if(_0x4cb3c7[_0x7846('0xc')]){if(_0x4cb3c7[_0x7846('0xc')][_0x7846('0xd')]===0x1f4){logger[_0x7846('0xc')](_0x7846('0x8'),_0x24eb59,_0x4cb3c7[_0x7846('0xc')][_0x7846('0xe')]);return _0x37e4f5(_0x4cb3c7[_0x7846('0xc')]['message']);}logger[_0x7846('0xc')](_0x7846('0x8'),_0x24eb59,_0x4cb3c7[_0x7846('0xc')][_0x7846('0xe')]);return _0x307526(_0x4cb3c7['error'][_0x7846('0xe')]);}else{logger['info'](_0x7846('0x8'),_0x24eb59,_0x7846('0x9'));_0x307526(_0x4cb3c7[_0x7846('0xf')][_0x7846('0xe')]);}})['catch'](function(_0x4f4992){logger[_0x7846('0xc')](_0x7846('0x8'),_0x24eb59,_0x4f4992);_0x37e4f5(_0x4f4992);});});}exports[_0x7846('0x10')]=function(_0x59b64d){var _0x4e6376=this;return new Promise(function(_0x537b46,_0x4de60f){return db[_0x7846('0x11')]['find']({'raw':_0x59b64d[_0x7846('0x12')]?_0x59b64d['options']['raw']===undefined?!![]:![]:!![],'where':_0x59b64d['options']?_0x59b64d['options'][_0x7846('0x13')]||null:null,'attributes':_0x59b64d[_0x7846('0x12')]?_0x59b64d['options'][_0x7846('0x14')]||null:null,'include':_0x59b64d[_0x7846('0x12')]?_0x59b64d[_0x7846('0x12')][_0x7846('0x15')]?_[_0x7846('0x16')](_0x59b64d['options'][_0x7846('0x15')],function(_0x13976d){return{'model':db[_0x13976d['model']],'as':_0x13976d['as'],'attributes':_0x13976d[_0x7846('0x14')],'include':_0x13976d[_0x7846('0x15')]?_[_0x7846('0x16')](_0x13976d['include'],function(_0x35f657){return{'model':db[_0x35f657[_0x7846('0x17')]],'as':_0x35f657['as'],'attributes':_0x35f657['attributes'],'include':_0x35f657[_0x7846('0x15')]?_[_0x7846('0x16')](_0x35f657[_0x7846('0x15')],function(_0x51735c){return{'model':db[_0x51735c[_0x7846('0x17')]],'as':_0x51735c['as'],'attributes':_0x51735c[_0x7846('0x14')]};}):[]};}):[]};}):[]:[]})[_0x7846('0x18')](function(_0x117fe5){logger[_0x7846('0x19')](_0x7846('0x10'),_0x59b64d);logger[_0x7846('0xa')](_0x7846('0x10'),_0x59b64d,JSON[_0x7846('0xb')](_0x117fe5));_0x537b46(_0x117fe5);})['catch'](function(_0x387f73){logger['error'](_0x7846('0x10'),_0x387f73[_0x7846('0xe')],_0x59b64d);_0x4de60f(_0x4e6376[_0x7846('0xc')](0x1f4,_0x387f73[_0x7846('0xe')]));});});}; \ No newline at end of file +var _0x3d97=['error','code','message','result','catch','ShowSetting','Setting','find','options','raw','attributes','map','include','model','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x429e53,_0x1571a){var _0x1e8736=function(_0x3fd009){while(--_0x3fd009){_0x429e53['push'](_0x429e53['shift']());}};_0x1e8736(++_0x1571a);}(_0x3d97,0x19b));var _0x73d9=function(_0x6a8660,_0xdee20f){_0x6a8660=_0x6a8660-0x0;var _0x25eef7=_0x3d97[_0x6a8660];return _0x25eef7;};'use strict';var _=require(_0x73d9('0x0'));var util=require('util');var moment=require(_0x73d9('0x1'));var BPromise=require(_0x73d9('0x2'));var rs=require(_0x73d9('0x3'));var fs=require('fs');var Redis=require(_0x73d9('0x4'));var db=require(_0x73d9('0x5'))['db'];var utils=require(_0x73d9('0x6'));var logger=require('../../config/logger')(_0x73d9('0x7'));var config=require('../../config/environment');var jayson=require(_0x73d9('0x8'));var client=jayson[_0x73d9('0x9')][_0x73d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x468b3e,_0x4f465e,_0x518d53){return new BPromise(function(_0x427278,_0x25d37e){return client[_0x73d9('0xb')](_0x468b3e,_0x518d53)[_0x73d9('0xc')](function(_0x3aff53){logger['info'](_0x73d9('0xd'),_0x4f465e,_0x73d9('0xe'));logger[_0x73d9('0xf')](_0x73d9('0x10'),_0x4f465e,_0x73d9('0xe'),JSON[_0x73d9('0x11')](_0x3aff53));if(_0x3aff53[_0x73d9('0x12')]){if(_0x3aff53[_0x73d9('0x12')][_0x73d9('0x13')]===0x1f4){logger[_0x73d9('0x12')](_0x73d9('0xd'),_0x4f465e,_0x3aff53['error'][_0x73d9('0x14')]);return _0x25d37e(_0x3aff53[_0x73d9('0x12')][_0x73d9('0x14')]);}logger['error'](_0x73d9('0xd'),_0x4f465e,_0x3aff53[_0x73d9('0x12')][_0x73d9('0x14')]);return _0x427278(_0x3aff53['error']['message']);}else{logger['info'](_0x73d9('0xd'),_0x4f465e,_0x73d9('0xe'));_0x427278(_0x3aff53[_0x73d9('0x15')][_0x73d9('0x14')]);}})[_0x73d9('0x16')](function(_0x3ac2c0){logger[_0x73d9('0x12')]('Setting,\x20%s,\x20%s',_0x4f465e,_0x3ac2c0);_0x25d37e(_0x3ac2c0);});});}exports[_0x73d9('0x17')]=function(_0x1b7290){var _0x30fe2c=this;return new Promise(function(_0x36913f,_0x583a11){return db[_0x73d9('0x18')][_0x73d9('0x19')]({'raw':_0x1b7290[_0x73d9('0x1a')]?_0x1b7290[_0x73d9('0x1a')][_0x73d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b7290[_0x73d9('0x1a')]?_0x1b7290['options']['where']||null:null,'attributes':_0x1b7290[_0x73d9('0x1a')]?_0x1b7290[_0x73d9('0x1a')][_0x73d9('0x1c')]||null:null,'include':_0x1b7290['options']?_0x1b7290[_0x73d9('0x1a')]['include']?_[_0x73d9('0x1d')](_0x1b7290[_0x73d9('0x1a')][_0x73d9('0x1e')],function(_0x320ca8){return{'model':db[_0x320ca8[_0x73d9('0x1f')]],'as':_0x320ca8['as'],'attributes':_0x320ca8[_0x73d9('0x1c')],'include':_0x320ca8[_0x73d9('0x1e')]?_['map'](_0x320ca8[_0x73d9('0x1e')],function(_0x426dd8){return{'model':db[_0x426dd8['model']],'as':_0x426dd8['as'],'attributes':_0x426dd8[_0x73d9('0x1c')],'include':_0x426dd8[_0x73d9('0x1e')]?_[_0x73d9('0x1d')](_0x426dd8[_0x73d9('0x1e')],function(_0x30867d){return{'model':db[_0x30867d[_0x73d9('0x1f')]],'as':_0x30867d['as'],'attributes':_0x30867d[_0x73d9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x73d9('0xc')](function(_0x5b4026){logger[_0x73d9('0x20')](_0x73d9('0x17'),_0x1b7290);logger[_0x73d9('0xf')](_0x73d9('0x17'),_0x1b7290,JSON[_0x73d9('0x11')](_0x5b4026));_0x36913f(_0x5b4026);})[_0x73d9('0x16')](function(_0x4eb906){logger['error'](_0x73d9('0x17'),_0x4eb906[_0x73d9('0x14')],_0x1b7290);_0x583a11(_0x30fe2c[_0x73d9('0x12')](0x1f4,_0x4eb906[_0x73d9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 0793ea5..15e4a33 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x6bf4d9,_0x39f6a0){var _0x47bc5c=function(_0x55b37e){while(--_0x55b37e){_0x6bf4d9['push'](_0x6bf4d9['shift']());}};_0x47bc5c(++_0x39f6a0);}(_0x7a54,0x106));var _0x47a5=function(_0x18d999,_0x49c3f7){_0x18d999=_0x18d999-0x0;var _0x162838=_0x7a54[_0x18d999];return _0x162838;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x13620b,_0x18fbef){var _0x7b097a=function(_0x168bd8){while(--_0x168bd8){_0x13620b['push'](_0x13620b['shift']());}};_0x7b097a(++_0x18fbef);}(_0x7a54,0x106));var _0x47a5=function(_0x46fab1,_0x1c1b62){_0x46fab1=_0x46fab1-0x0;var _0x283797=_0x7a54[_0x46fab1];return _0x283797;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('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 7007504..7326254 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 _0x7662=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT'];(function(_0x5138ac,_0x5dd557){var _0x4d91e1=function(_0x4f4d9e){while(--_0x4f4d9e){_0x5138ac['push'](_0x5138ac['shift']());}};_0x4d91e1(++_0x5dd557);}(_0x7662,0xec));var _0x2766=function(_0xa205c,_0x2693af){_0xa205c=_0xa205c-0x0;var _0x1ab019=_0x7662[_0xa205c];return _0x1ab019;};'use strict';var Sequelize=require(_0x2766('0x0'));var rs=require(_0x2766('0x1'));module[_0x2766('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x2766('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x2766('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x2766('0x4')],'defaultValue':function(){return rs[_0x2766('0x5')]();}},'phone':{'type':Sequelize[_0x2766('0x4')]},'type':{'type':Sequelize[_0x2766('0x6')](_0x2766('0x7'),'skebby','connectel',_0x2766('0x8'),_0x2766('0x9'),_0x2766('0xa'),_0x2766('0xb'),_0x2766('0xc'),'infobip',_0x2766('0xd'))},'accountSid':{'type':Sequelize[_0x2766('0x4')]},'authId':{'type':Sequelize[_0x2766('0x4')]},'authToken':{'type':Sequelize[_0x2766('0x4')]},'smsMethod':{'type':Sequelize[_0x2766('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2766('0x4')]},'password':{'type':Sequelize[_0x2766('0x4')]},'apiKey':{'type':Sequelize[_0x2766('0x4')]},'applicationId':{'type':Sequelize[_0x2766('0x4')]},'accountId':{'type':Sequelize[_0x2766('0x4')]},'senderString':{'type':Sequelize[_0x2766('0x4')]},'deliveryReport':{'type':Sequelize[_0x2766('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x2766('0x4')]},'notificationTemplate':{'type':Sequelize[_0x2766('0xf')],'defaultValue':function(){return _0x2766('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2766('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2766('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2766('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2766('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2766('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2766('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2766('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2766('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2766('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x38af13){if(!_0x38af13)this[_0x2766('0x12')](_0x2766('0x13'),null);this['setDataValue'](_0x2766('0x14'),_0x38af13);}}}; \ No newline at end of file +var _0x7439=['clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','skebby','connectel'];(function(_0x123e70,_0x11d93d){var _0x323900=function(_0x5a959f){while(--_0x5a959f){_0x123e70['push'](_0x123e70['shift']());}};_0x323900(++_0x11d93d);}(_0x7439,0x8b));var _0x9743=function(_0xc10208,_0x4e9203){_0xc10208=_0xc10208-0x0;var _0x288a10=_0x7439[_0xc10208];return _0x288a10;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9743('0x0'));module[_0x9743('0x1')]={'name':{'type':Sequelize[_0x9743('0x2')],'unique':_0x9743('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9743('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9743('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9743('0x2')],'defaultValue':function(){return rs[_0x9743('0x4')]();}},'phone':{'type':Sequelize[_0x9743('0x2')]},'type':{'type':Sequelize[_0x9743('0x5')]('twilio',_0x9743('0x6'),_0x9743('0x7'),_0x9743('0x8'),_0x9743('0x9'),_0x9743('0xa'),'bandwidth',_0x9743('0xb'),_0x9743('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x9743('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9743('0x2')]},'smsMethod':{'type':Sequelize[_0x9743('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9743('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x9743('0x2')]},'applicationId':{'type':Sequelize[_0x9743('0x2')]},'accountId':{'type':Sequelize[_0x9743('0x2')]},'senderString':{'type':Sequelize[_0x9743('0x2')]},'deliveryReport':{'type':Sequelize[_0x9743('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x9743('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9743('0xe')],'defaultValue':function(){return _0x9743('0xf');}},'notificationSound':{'type':Sequelize[_0x9743('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9743('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9743('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9743('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9743('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9743('0x10')],'comment':_0x9743('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x9743('0xd')],'defaultValue':![],'comment':_0x9743('0x12'),'set':function(_0x34f32a){if(!_0x34f32a)this[_0x9743('0x13')]('mandatoryDispositionPauseId',null);this[_0x9743('0x13')](_0x9743('0x14'),_0x34f32a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index bda651b..f50332a 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 _0xd722=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','code','error','SmsAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','SmsAccounts','UserProfileResource','destroy','end','name','send','Pause','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','SmsAccount','findAll','catch','show','params','keys','include','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','length','pick','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','Body','messageId','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','list','omit','Contacts','contact','SmsInteraction','interaction','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','push','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','DELIVERED','inspect','infobip','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','csc','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xd722,0xe4));var _0x2d72=function(_0xe47cfd,_0x3e5333){_0xe47cfd=_0xe47cfd-0x0;var _0xd866e4=_0xd722[_0xe47cfd];return _0xd866e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d72('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d72('0x1'));var rp=require(_0x2d72('0x2'));var moment=require(_0x2d72('0x3'));var BPromise=require(_0x2d72('0x4'));var Mustache=require(_0x2d72('0x5'));var util=require(_0x2d72('0x6'));var path=require('path');var sox=require(_0x2d72('0x7'));var csv=require(_0x2d72('0x8'));var ejs=require(_0x2d72('0x9'));var fs=require('fs');var fs_extra=require(_0x2d72('0xa'));var _=require(_0x2d72('0xb'));var squel=require(_0x2d72('0xc'));var crypto=require(_0x2d72('0xd'));var jsforce=require(_0x2d72('0xe'));var deskjs=require(_0x2d72('0xf'));var toCsv=require(_0x2d72('0x8'));var querystring=require(_0x2d72('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2d72('0x11'));var qs=require(_0x2d72('0x12'));var as=require(_0x2d72('0x13'));var hardwareService=require(_0x2d72('0x14'));var logger=require(_0x2d72('0x15'))('api');var utils=require(_0x2d72('0x16'));var config=require(_0x2d72('0x17'));var licenseUtil=require(_0x2d72('0x18'));var db=require(_0x2d72('0x19'))['db'];config[_0x2d72('0x1a')]=_[_0x2d72('0x1b')](config[_0x2d72('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d72('0x1c'))(new Redis(config[_0x2d72('0x1a')]));require(_0x2d72('0x1d'))[_0x2d72('0x1e')](socket);var jayson=require(_0x2d72('0x1f'));var client=jayson[_0x2d72('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2144ad,_0x166ca1,_0x54c371,_0x5e84fc){return new BPromise(function(_0xe57d,_0x4a595e){var _0xf4eb7a=_0x5e84fc||client;return _0xf4eb7a[_0x2d72('0x21')](_0x2144ad,_0x54c371)[_0x2d72('0x22')](function(_0x35d44d){logger['info']('SmsAccount,\x20%s,\x20%s',_0x166ca1,_0x2d72('0x23'));logger['debug'](_0x2d72('0x24'),_0x166ca1,_0x2d72('0x23'),JSON['stringify'](_0x35d44d));if(_0x35d44d['error']){if(_0x35d44d['error'][_0x2d72('0x25')]===0x1f4){logger[_0x2d72('0x26')](_0x2d72('0x27'),_0x166ca1,_0x35d44d['error'][_0x2d72('0x28')]);return _0x4a595e(_0x35d44d['error']['message']);}logger[_0x2d72('0x26')](_0x2d72('0x27'),_0x166ca1,_0x35d44d[_0x2d72('0x26')][_0x2d72('0x28')]);return _0xe57d(_0x35d44d['error'][_0x2d72('0x28')]);}else{logger[_0x2d72('0x29')](_0x2d72('0x27'),_0x166ca1,_0x2d72('0x23'));_0xe57d(_0x35d44d[_0x2d72('0x2a')][_0x2d72('0x28')]);}})['catch'](function(_0x4e1161){logger['error'](_0x2d72('0x27'),_0x166ca1,_0x4e1161);_0x4a595e(_0x4e1161);});});}function respondWithStatusCode(_0x5bee96,_0x5bd5a4){_0x5bd5a4=_0x5bd5a4||0xcc;return function(_0x3743c5){if(_0x3743c5){return _0x5bee96[_0x2d72('0x2b')](_0x5bd5a4);}return _0x5bee96[_0x2d72('0x2c')](_0x5bd5a4)['end']();};}function respondWithResult(_0x4a6010,_0x5ac865){_0x5ac865=_0x5ac865||0xc8;return function(_0x109ff7){if(_0x109ff7){return _0x4a6010['status'](_0x5ac865)['json'](_0x109ff7);}};}function respondWithFilteredResult(_0x9ac378,_0x20cbcb){return function(_0xda9fc5){if(_0xda9fc5){var _0x4b9ddd=typeof _0x20cbcb[_0x2d72('0x2d')]===_0x2d72('0x2e')&&typeof _0x20cbcb[_0x2d72('0x2f')]===_0x2d72('0x2e');var _0x3f3d84=_0xda9fc5['count'];var _0x87cd89=_0x4b9ddd?0x0:_0x20cbcb['offset'];var _0x4eae52=_0x4b9ddd?_0xda9fc5[_0x2d72('0x30')]:_0x20cbcb[_0x2d72('0x2d')]+_0x20cbcb[_0x2d72('0x2f')];var _0x51fe1a;if(_0x4eae52>=_0x3f3d84){_0x4eae52=_0x3f3d84;_0x51fe1a=0xc8;}else{_0x51fe1a=0xce;}_0x9ac378[_0x2d72('0x2c')](_0x51fe1a);return _0x9ac378['set']('Content-Range',_0x87cd89+'-'+_0x4eae52+'/'+_0x3f3d84)[_0x2d72('0x31')](_0xda9fc5);}return null;};}function patchUpdates(_0x948d64){return function(_0x4bf2c3){try{jsonpatch[_0x2d72('0x32')](_0x4bf2c3,_0x948d64,!![]);}catch(_0x27390f){return BPromise[_0x2d72('0x33')](_0x27390f);}return _0x4bf2c3[_0x2d72('0x34')]();};}function saveUpdates(_0x292519,_0x243e3a){return function(_0x5e5f27){if(_0x5e5f27){return _0x5e5f27[_0x2d72('0x35')](_0x292519)[_0x2d72('0x22')](function(_0x24bb0c){return _0x24bb0c;});}return null;};}function removeEntity(_0xb56e13,_0x42b5e7){return function(_0x3df0ff){if(_0x3df0ff){return _0x3df0ff['destroy']()[_0x2d72('0x22')](function(){var _0x118082=_0x3df0ff['get']({'plain':!![]});var _0x2c1e47=_0x2d72('0x36');return db[_0x2d72('0x37')][_0x2d72('0x38')]({'where':{'type':_0x2c1e47,'resourceId':_0x118082['id']}})['then'](function(){return _0x3df0ff;});})['then'](function(){_0xb56e13[_0x2d72('0x2c')](0xcc)[_0x2d72('0x39')]();});}};}function handleEntityNotFound(_0x1cc840,_0x4dc0f7){return function(_0x504939){if(!_0x504939){_0x1cc840[_0x2d72('0x2b')](0x194);}return _0x504939;};}function handleError(_0xb7b6d7,_0x5c6a05){_0x5c6a05=_0x5c6a05||0x1f4;return function(_0x468f53){logger[_0x2d72('0x26')](_0x468f53['stack']);if(_0x468f53[_0x2d72('0x3a')]){delete _0x468f53[_0x2d72('0x3a')];}_0xb7b6d7[_0x2d72('0x2c')](_0x5c6a05)[_0x2d72('0x3b')](_0x468f53);};}exports['index']=function(_0x484b1a,_0xcd6e){var _0x210c4f={'include':[{'model':db[_0x2d72('0x3c')],'as':'mandatoryDispositionPause'}]},_0x1ac933={},_0x514180={'count':0x0,'rows':[]};var _0x473a18=_[_0x2d72('0x3d')](db['SmsAccount'][_0x2d72('0x3e')],function(_0xdcf09e){return{'name':_0xdcf09e[_0x2d72('0x3f')],'type':_0xdcf09e['type']['key']};});_0x1ac933[_0x2d72('0x40')]=_['map'](_0x473a18,_0x2d72('0x3a'));_0x1ac933[_0x2d72('0x41')]=_['keys'](_0x484b1a[_0x2d72('0x41')]);_0x1ac933[_0x2d72('0x42')]=_[_0x2d72('0x43')](_0x1ac933[_0x2d72('0x40')],_0x1ac933[_0x2d72('0x41')]);_0x210c4f[_0x2d72('0x44')]=_[_0x2d72('0x43')](_0x1ac933[_0x2d72('0x40')],qs[_0x2d72('0x45')](_0x484b1a[_0x2d72('0x41')]['fields']));_0x210c4f[_0x2d72('0x44')]=_0x210c4f['attributes']['length']?_0x210c4f[_0x2d72('0x44')]:_0x1ac933['model'];if(!_0x484b1a[_0x2d72('0x41')][_0x2d72('0x46')](_0x2d72('0x47'))){_0x210c4f[_0x2d72('0x2f')]=qs[_0x2d72('0x2f')](_0x484b1a[_0x2d72('0x41')][_0x2d72('0x2f')]);_0x210c4f[_0x2d72('0x2d')]=qs[_0x2d72('0x2d')](_0x484b1a[_0x2d72('0x41')][_0x2d72('0x2d')]);}_0x210c4f[_0x2d72('0x48')]=qs[_0x2d72('0x49')](_0x484b1a[_0x2d72('0x41')][_0x2d72('0x49')]);_0x210c4f[_0x2d72('0x4a')]=qs['filters'](_['pick'](_0x484b1a[_0x2d72('0x41')],_0x1ac933[_0x2d72('0x42')]),_0x473a18);if(_0x484b1a['query'][_0x2d72('0x4b')]){_0x210c4f['where']=_[_0x2d72('0x4c')](_0x210c4f[_0x2d72('0x4a')],{'$or':_[_0x2d72('0x3d')](_0x473a18,function(_0x4ec351){if(_0x4ec351[_0x2d72('0x4d')]!==_0x2d72('0x4e')){var _0x527a26={};_0x527a26[_0x4ec351[_0x2d72('0x3a')]]={'$like':'%'+_0x484b1a[_0x2d72('0x41')][_0x2d72('0x4b')]+'%'};return _0x527a26;}})});}_0x210c4f=_[_0x2d72('0x4c')]({},_0x210c4f,_0x484b1a['options']);var _0xbe60ec={'where':_0x210c4f[_0x2d72('0x4a')]};return db['SmsAccount'][_0x2d72('0x30')](_0xbe60ec)['then'](function(_0x2198d8){_0x514180[_0x2d72('0x30')]=_0x2198d8;if(_0x484b1a['query'][_0x2d72('0x4f')]){_0x210c4f['include']=[{'all':!![]}];}return db[_0x2d72('0x50')][_0x2d72('0x51')](_0x210c4f);})[_0x2d72('0x22')](function(_0x41f7f5){_0x514180['rows']=_0x41f7f5;return _0x514180;})[_0x2d72('0x22')](respondWithFilteredResult(_0xcd6e,_0x210c4f))[_0x2d72('0x52')](handleError(_0xcd6e,null));};exports[_0x2d72('0x53')]=function(_0x5de805,_0x4135f9){var _0x14763d={'raw':![],'where':{'id':_0x5de805[_0x2d72('0x54')]['id']},'include':[{'model':db[_0x2d72('0x3c')],'as':'mandatoryDispositionPause'}]},_0x168a64={};_0x168a64[_0x2d72('0x40')]=_['keys'](db['SmsAccount'][_0x2d72('0x3e')]);_0x168a64[_0x2d72('0x41')]=_[_0x2d72('0x55')](_0x5de805[_0x2d72('0x41')]);_0x168a64['filters']=_['intersection'](_0x168a64[_0x2d72('0x40')],_0x168a64[_0x2d72('0x41')]);_0x14763d['attributes']=_[_0x2d72('0x43')](_0x168a64[_0x2d72('0x40')],qs['fields'](_0x5de805['query']['fields']));_0x14763d[_0x2d72('0x44')]=_0x14763d[_0x2d72('0x44')]['length']?_0x14763d[_0x2d72('0x44')]:_0x168a64[_0x2d72('0x40')];if(_0x5de805[_0x2d72('0x41')]['includeAll']){_0x14763d[_0x2d72('0x56')]=[{'all':!![]}];}_0x14763d=_[_0x2d72('0x4c')]({},_0x14763d,_0x5de805[_0x2d72('0x57')]);return db[_0x2d72('0x50')][_0x2d72('0x58')](_0x14763d)[_0x2d72('0x22')](handleEntityNotFound(_0x4135f9,null))[_0x2d72('0x22')](respondWithResult(_0x4135f9,null))['catch'](handleError(_0x4135f9,null));};exports[_0x2d72('0x59')]=function(_0x8bd547,_0x349582){return db[_0x2d72('0x50')][_0x2d72('0x59')](_0x8bd547['body'],{})[_0x2d72('0x22')](function(_0x5e4791){var _0x571852=_0x8bd547[_0x2d72('0x5a')][_0x2d72('0x5b')]({'plain':!![]});if(!_0x571852)throw new Error(_0x2d72('0x5c'));if(_0x571852['role']==='user'){var _0x571800=_0x5e4791[_0x2d72('0x5b')]({'plain':!![]});var _0x5589fc=_0x2d72('0x36');return db[_0x2d72('0x5d')][_0x2d72('0x58')]({'where':{'name':_0x5589fc,'userProfileId':_0x571852[_0x2d72('0x5e')]},'raw':!![]})[_0x2d72('0x22')](function(_0x5f33f9){if(_0x5f33f9&&_0x5f33f9['autoAssociation']===0x0){return db[_0x2d72('0x37')][_0x2d72('0x59')]({'name':_0x571800[_0x2d72('0x3a')],'resourceId':_0x571800['id'],'type':_0x5f33f9[_0x2d72('0x3a')],'sectionId':_0x5f33f9['id']},{})['then'](function(){return _0x5e4791;});}else{return _0x5e4791;}})['catch'](function(_0x3b7831){logger[_0x2d72('0x26')](_0x2d72('0x5f'),_0x3b7831);throw _0x3b7831;});}return _0x5e4791;})['then'](respondWithResult(_0x349582,0xc9))[_0x2d72('0x52')](handleError(_0x349582,null));};exports[_0x2d72('0x35')]=function(_0x1c78b3,_0x2e31e7){if(_0x1c78b3[_0x2d72('0x60')]['id']){delete _0x1c78b3[_0x2d72('0x60')]['id'];}return db[_0x2d72('0x50')]['find']({'where':{'id':_0x1c78b3[_0x2d72('0x54')]['id']},'include':[{'model':db[_0x2d72('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x2d72('0x22')](handleEntityNotFound(_0x2e31e7,null))[_0x2d72('0x22')](saveUpdates(_0x1c78b3['body'],null))['then'](respondWithResult(_0x2e31e7,null))[_0x2d72('0x52')](handleError(_0x2e31e7,null));};exports[_0x2d72('0x38')]=function(_0x192c51,_0x125587){return db['SmsAccount'][_0x2d72('0x58')]({'where':{'id':_0x192c51[_0x2d72('0x54')]['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x125587,null))[_0x2d72('0x22')](removeEntity(_0x125587,null))[_0x2d72('0x52')](handleError(_0x125587,null));};exports[_0x2d72('0x61')]=function(_0x42ea3d,_0x57d53a){return db[_0x2d72('0x50')]['describe']()[_0x2d72('0x22')](respondWithResult(_0x57d53a,null))[_0x2d72('0x52')](handleError(_0x57d53a,null));};exports[_0x2d72('0x62')]=function(_0x203e46,_0x9c3e21,_0x4a6161){if(_0x203e46[_0x2d72('0x60')]['id']){delete _0x203e46[_0x2d72('0x60')]['id'];}return db[_0x2d72('0x50')][_0x2d72('0x58')]({'where':{'id':_0x203e46['params']['id']}})['then'](handleEntityNotFound(_0x9c3e21,null))['then'](function(_0x3584ed){if(_0x3584ed){_0x203e46['body'][_0x2d72('0x63')]=_0x3584ed['id'];return db[_0x2d72('0x64')][_0x2d72('0x59')](_0x203e46['body']);}})[_0x2d72('0x22')](respondWithResult(_0x9c3e21,null))[_0x2d72('0x52')](handleError(_0x9c3e21,null));};exports[_0x2d72('0x65')]=function(_0x50f7ca,_0x281f83,_0x57c2ba){var _0x1cdab7={'raw':![],'where':{}};var _0x41a176={};var _0x7a2a6e={'count':0x0,'rows':[]};return db[_0x2d72('0x50')][_0x2d72('0x66')]({'where':{'id':_0x50f7ca[_0x2d72('0x54')]['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x281f83,null))[_0x2d72('0x22')](function(_0x2ff7a0){if(_0x2ff7a0){_0x41a176['model']=_[_0x2d72('0x55')](db[_0x2d72('0x64')][_0x2d72('0x3e')]);_0x41a176[_0x2d72('0x41')]=_[_0x2d72('0x55')](_0x50f7ca[_0x2d72('0x41')]);_0x41a176[_0x2d72('0x42')]=_['intersection'](_0x41a176[_0x2d72('0x40')],_0x41a176[_0x2d72('0x41')]);_0x1cdab7[_0x2d72('0x44')]=_[_0x2d72('0x43')](_0x41a176[_0x2d72('0x40')],qs[_0x2d72('0x45')](_0x50f7ca[_0x2d72('0x41')][_0x2d72('0x45')]));_0x1cdab7['attributes']=_0x1cdab7[_0x2d72('0x44')][_0x2d72('0x67')]?_0x1cdab7[_0x2d72('0x44')]:_0x41a176[_0x2d72('0x40')];if(!_0x50f7ca[_0x2d72('0x41')][_0x2d72('0x46')](_0x2d72('0x47'))){_0x1cdab7[_0x2d72('0x2f')]=qs[_0x2d72('0x2f')](_0x50f7ca[_0x2d72('0x41')]['limit']);_0x1cdab7[_0x2d72('0x2d')]=qs[_0x2d72('0x2d')](_0x50f7ca[_0x2d72('0x41')][_0x2d72('0x2d')]);}_0x1cdab7['order']=qs['sort'](_0x50f7ca[_0x2d72('0x41')][_0x2d72('0x49')]);_0x1cdab7[_0x2d72('0x4a')]=qs[_0x2d72('0x42')](_[_0x2d72('0x68')](_0x50f7ca[_0x2d72('0x41')],_0x41a176[_0x2d72('0x42')]));_0x1cdab7['where']['SmsAccountId']=_0x2ff7a0['id'];if(_0x50f7ca[_0x2d72('0x41')][_0x2d72('0x4b')]){_0x1cdab7[_0x2d72('0x4a')]=_[_0x2d72('0x4c')](_0x1cdab7[_0x2d72('0x4a')],{'$or':_['map'](_0x1cdab7['attributes'],function(_0x3bb1ab){var _0x4e6969={};_0x4e6969[_0x3bb1ab]={'$like':'%'+_0x50f7ca['query']['filter']+'%'};return _0x4e6969;})});}_0x1cdab7=_[_0x2d72('0x4c')]({},_0x1cdab7,_0x50f7ca[_0x2d72('0x57')]);return db[_0x2d72('0x64')][_0x2d72('0x30')]({'where':_0x1cdab7['where']})[_0x2d72('0x22')](function(_0x2ec3c7){_0x7a2a6e[_0x2d72('0x30')]=_0x2ec3c7;if(_0x50f7ca['query'][_0x2d72('0x4f')]){_0x1cdab7[_0x2d72('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x2d72('0x51')](_0x1cdab7);})[_0x2d72('0x22')](function(_0x51966f){_0x7a2a6e[_0x2d72('0x69')]=_0x51966f;return _0x7a2a6e;});}})[_0x2d72('0x22')](respondWithFilteredResult(_0x281f83,_0x1cdab7))[_0x2d72('0x52')](handleError(_0x281f83,null));};exports[_0x2d72('0x6a')]=function(_0x1f5bc6,_0x31797b,_0x65efaa){return db[_0x2d72('0x50')][_0x2d72('0x58')]({'where':{'id':_0x1f5bc6[_0x2d72('0x54')]['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x31797b,null))[_0x2d72('0x22')](function(_0x494977){if(_0x494977){return _0x494977['removeDispositions'](_0x1f5bc6[_0x2d72('0x41')][_0x2d72('0x6b')]);}})[_0x2d72('0x22')](respondWithStatusCode(_0x31797b,null))[_0x2d72('0x52')](handleError(_0x31797b,null));};exports[_0x2d72('0x6c')]=function(_0x29b3ec,_0x438a4f,_0xbfaadb){if(_0x29b3ec[_0x2d72('0x60')]['id']){delete _0x29b3ec[_0x2d72('0x60')]['id'];}return db['SmsAccount'][_0x2d72('0x58')]({'where':{'id':_0x29b3ec['params']['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x438a4f,null))['then'](function(_0x11feba){if(_0x11feba){_0x29b3ec['body'][_0x2d72('0x63')]=_0x11feba['id'];return db['CannedAnswer'][_0x2d72('0x59')](_0x29b3ec[_0x2d72('0x60')]);}})[_0x2d72('0x22')](respondWithResult(_0x438a4f,null))[_0x2d72('0x52')](handleError(_0x438a4f,null));};exports[_0x2d72('0x6d')]=function(_0x31e784,_0x5f2adf,_0x1bfd2b){var _0x463e87={'raw':![],'where':{}};var _0x44b978={};var _0x4a6494={'count':0x0,'rows':[]};return db[_0x2d72('0x50')]['findOne']({'where':{'id':_0x31e784[_0x2d72('0x54')]['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x5f2adf,null))[_0x2d72('0x22')](function(_0x409874){if(_0x409874){_0x44b978[_0x2d72('0x40')]=_['keys'](db[_0x2d72('0x6e')]['rawAttributes']);_0x44b978['query']=_[_0x2d72('0x55')](_0x31e784[_0x2d72('0x41')]);_0x44b978['filters']=_[_0x2d72('0x43')](_0x44b978[_0x2d72('0x40')],_0x44b978['query']);_0x463e87[_0x2d72('0x44')]=_[_0x2d72('0x43')](_0x44b978[_0x2d72('0x40')],qs[_0x2d72('0x45')](_0x31e784[_0x2d72('0x41')]['fields']));_0x463e87[_0x2d72('0x44')]=_0x463e87['attributes'][_0x2d72('0x67')]?_0x463e87[_0x2d72('0x44')]:_0x44b978[_0x2d72('0x40')];if(!_0x31e784[_0x2d72('0x41')][_0x2d72('0x46')](_0x2d72('0x47'))){_0x463e87[_0x2d72('0x2f')]=qs[_0x2d72('0x2f')](_0x31e784['query']['limit']);_0x463e87[_0x2d72('0x2d')]=qs['offset'](_0x31e784[_0x2d72('0x41')]['offset']);}_0x463e87['order']=qs[_0x2d72('0x49')](_0x31e784['query'][_0x2d72('0x49')]);_0x463e87[_0x2d72('0x4a')]=qs[_0x2d72('0x42')](_['pick'](_0x31e784[_0x2d72('0x41')],_0x44b978[_0x2d72('0x42')]));_0x463e87[_0x2d72('0x4a')][_0x2d72('0x63')]=_0x409874['id'];if(_0x31e784['query'][_0x2d72('0x4b')]){_0x463e87['where']=_['merge'](_0x463e87['where'],{'$or':_[_0x2d72('0x3d')](_0x463e87['attributes'],function(_0x543e9a){var _0x16d939={};_0x16d939[_0x543e9a]={'$like':'%'+_0x31e784['query']['filter']+'%'};return _0x16d939;})});}_0x463e87=_[_0x2d72('0x4c')]({},_0x463e87,_0x31e784['options']);return db[_0x2d72('0x6e')]['count']({'where':_0x463e87[_0x2d72('0x4a')]})['then'](function(_0x2721fa){_0x4a6494[_0x2d72('0x30')]=_0x2721fa;if(_0x31e784['query'][_0x2d72('0x4f')]){_0x463e87[_0x2d72('0x56')]=[{'all':!![]}];}return db[_0x2d72('0x6e')]['findAll'](_0x463e87);})[_0x2d72('0x22')](function(_0x3f07c2){_0x4a6494[_0x2d72('0x69')]=_0x3f07c2;return _0x4a6494;});}})['then'](respondWithFilteredResult(_0x5f2adf,_0x463e87))[_0x2d72('0x52')](handleError(_0x5f2adf,null));};exports[_0x2d72('0x6f')]=function(_0x40ae3b,_0x2025fc,_0x43c3b7){return db[_0x2d72('0x50')][_0x2d72('0x58')]({'where':{'id':_0x40ae3b[_0x2d72('0x54')]['id']}})['then'](handleEntityNotFound(_0x2025fc,null))[_0x2d72('0x22')](function(_0x39984c){if(_0x39984c){return _0x39984c[_0x2d72('0x6f')](_0x40ae3b[_0x2d72('0x41')][_0x2d72('0x6b')]);}})[_0x2d72('0x22')](respondWithStatusCode(_0x2025fc,null))['catch'](handleError(_0x2025fc,null));};exports[_0x2d72('0x70')]=function(_0x6d84d,_0x3cf6e5,_0xfb2b3f){var _0x389f02={'channel':'sms'};var _0x2f46d4=[];var _0x3f2d75=[];var _0x1d7ce2={};return db[_0x2d72('0x50')][_0x2d72('0x58')]({'where':{'id':_0x6d84d[_0x2d72('0x54')]['id']},'include':[{'model':db[_0x2d72('0x71')],'as':_0x2d72('0x72')}]})['then'](handleEntityNotFound(_0x3cf6e5,null))['then'](function(_0x26616d){_0x389f02[_0x2d72('0x73')]=_0x26616d;_0x389f02[_0x2d72('0x74')]=_['orderBy'](_0x26616d[_0x2d72('0x72')],['priority'],[_0x2d72('0x75')]);if(_0x389f02[_0x2d72('0x73')][_0x2d72('0x72')]){delete _0x389f02[_0x2d72('0x73')]['Applications'];}return db[_0x2d72('0x76')][_0x2d72('0x61')]();})[_0x2d72('0x22')](function(_0x2711ac){if(!_0x2711ac){throw new db[(_0x2d72('0x77'))][(_0x2d72('0x78'))](_0x2d72('0x79'));}_0x2f46d4=_[_0x2d72('0x7a')](_[_0x2d72('0x55')](_0x2711ac),[_0x2d72('0x7b'),'updatedAt']);_0x3f2d75=_[_0x2d72('0x7a')](_[_0x2d72('0x55')](_0x2711ac),[_0x2d72('0x7b'),_0x2d72('0x7c'),_0x2d72('0x7d'),'ListId']);_0x389f02['body']={'mapKey':_0x2d72('0x7e')};if(_0x389f02[_0x2d72('0x73')][_0x2d72('0x4d')]){switch(_0x389f02[_0x2d72('0x73')][_0x2d72('0x4d')]){case _0x2d72('0x7f'):_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x81')];_0x389f02[_0x2d72('0x60')][_0x2d72('0x60')]=_0x6d84d['body'][_0x2d72('0x82')];_0x389f02[_0x2d72('0x60')][_0x2d72('0x83')]=_0x6d84d['body']['MessageSid'];break;case'skebby':_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')]='+'+_0x6d84d[_0x2d72('0x60')]['sender'];_0x389f02[_0x2d72('0x60')][_0x2d72('0x60')]=_0x6d84d[_0x2d72('0x60')]['text'];break;case _0x2d72('0x84'):_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x80')];_0x389f02[_0x2d72('0x60')][_0x2d72('0x60')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x28')];break;case _0x2d72('0x85'):_0x389f02['body'][_0x2d72('0x80')]=_0x6d84d[_0x2d72('0x60')]['from'];_0x389f02[_0x2d72('0x60')]['body']=_0x6d84d['body'][_0x2d72('0x60')];_0x389f02['body']['messageId']=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x86')];break;case _0x2d72('0x87'):_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')]=_0x6d84d['body'][_0x2d72('0x81')];_0x389f02[_0x2d72('0x60')][_0x2d72('0x60')]=_0x6d84d['body'][_0x2d72('0x88')];_0x389f02['body'][_0x2d72('0x83')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x89')];break;case'infobip':_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')]='+'+_0x6d84d[_0x2d72('0x60')][_0x2d72('0x8a')][0x0][_0x2d72('0x80')];_0x389f02[_0x2d72('0x60')][_0x2d72('0x60')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x8a')][0x0]['text'];_0x389f02[_0x2d72('0x60')][_0x2d72('0x83')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x8a')][0x0][_0x2d72('0x83')];break;case'csc':_0x389f02['body'][_0x2d72('0x80')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x8b')];_0x389f02['body'][_0x2d72('0x60')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x8c')][_0x2d72('0x28')];break;case _0x2d72('0x8d'):_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x8e')];_0x389f02[_0x2d72('0x60')][_0x2d72('0x60')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x8f')];_0x389f02['body']['messageId']=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x90')];break;case _0x2d72('0x91'):_0x389f02[_0x2d72('0x60')][_0x2d72('0x83')]=_0x6d84d['body'][0x0][_0x2d72('0x28')]['id'];_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')]=_0x6d84d[_0x2d72('0x60')][0x0][_0x2d72('0x28')][_0x2d72('0x80')];_0x389f02[_0x2d72('0x60')]['body']=_0x6d84d[_0x2d72('0x60')][0x0][_0x2d72('0x28')][_0x2d72('0x8f')];break;case _0x2d72('0x92'):_0x389f02['body'][_0x2d72('0x80')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x80')];_0x389f02['body'][_0x2d72('0x60')]=_0x6d84d[_0x2d72('0x60')][_0x2d72('0x28')];_0x389f02[_0x2d72('0x60')][_0x2d72('0x83')]=_0x6d84d['body'][_0x2d72('0x93')];break;}}if(_0x389f02[_0x2d72('0x60')]['id']){delete _0x389f02[_0x2d72('0x60')]['id'];}if(_[_0x2d72('0x94')](_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')])){throw new db[(_0x2d72('0x77'))][(_0x2d72('0x78'))]('from\x20is\x20mandatory');}if(_[_0x2d72('0x94')](_0x389f02[_0x2d72('0x60')]['body'])||_0x389f02['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0x2d72('0x95'));}if(_[_0x2d72('0x94')](_0x389f02[_0x2d72('0x60')][_0x2d72('0x96')])){throw new db[(_0x2d72('0x77'))]['ValidationError'](_0x2d72('0x97')+_0x3f2d75);}if(!_[_0x2d72('0x98')](_0x3f2d75,_0x389f02['body'][_0x2d72('0x96')])){throw new db[(_0x2d72('0x77'))][(_0x2d72('0x78'))](_0x2d72('0x99')+_0x3f2d75);}_0x1d7ce2[_0x389f02[_0x2d72('0x60')][_0x2d72('0x96')]]=_0x389f02['body'][_0x2d72('0x80')];return db[_0x2d72('0x9a')][_0x2d72('0x58')]({'where':{'id':_0x389f02[_0x2d72('0x73')][_0x2d72('0x9b')]},'include':[{'model':db[_0x2d72('0x76')],'as':'Contacts','where':_0x1d7ce2,'limit':0x1,'order':[['updatedAt',_0x2d72('0x9c')]]}]});})['then'](handleEntityNotFound(_0x3cf6e5,null))[_0x2d72('0x22')](function(_0x58b865){if(_0x58b865){_0x389f02[_0x2d72('0x9d')]=_[_0x2d72('0x9e')](_0x58b865,[_0x2d72('0x9f')]);if(_0x58b865[_0x2d72('0x9f')]['length']){return _0x58b865[_0x2d72('0x9f')][0x0];}var _0x2d07c9=_['defaults'](_0x389f02['body'],{'firstName':_0x389f02['body'][_0x2d72('0x80')],'ListId':_0x58b865['id']});_0x2d07c9[_0x389f02['body']['mapKey']]=_0x389f02['body'][_0x2d72('0x80')];return db[_0x2d72('0x76')][_0x2d72('0x59')](_0x2d07c9,{'fields':_0x2f46d4,'raw':!![]});}})[_0x2d72('0x22')](handleEntityNotFound(_0x3cf6e5,null))[_0x2d72('0x22')](function(_0x51c987){if(_0x51c987){_0x389f02[_0x2d72('0xa0')]=_0x51c987;var _0xa3206={'ContactId':_0x51c987['id'],'phone':_0x389f02['body'][_0x2d72('0x80')],'SmsAccountId':_0x6d84d[_0x2d72('0x54')]['id']};var _0x2e58e={'ContactId':_0x51c987['id'],'SmsAccountId':_0x6d84d[_0x2d72('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0x2d72('0x58')]({'where':_0x2e58e})[_0x2d72('0x22')](function(_0x1f8896){if(_0x1f8896){return[_0x1f8896,![]];}return db[_0x2d72('0xa1')][_0x2d72('0x59')](_0xa3206)[_0x2d72('0x22')](function(_0xa4145d){return[_0xa4145d,!![]];});});}})['spread'](function(_0x5bc891,_0x237ea3){_0x389f02[_0x2d72('0xa2')]=_0x5bc891[_0x2d72('0x5b')]({'plain':!![]});_0x389f02[_0x2d72('0xa2')]['created']=![];if(_0x237ea3){if(_0x389f02[_0x2d72('0x73')]['autoclose']){_0x389f02[_0x2d72('0x74')]['push']({'id':0x0,'priority':_0x389f02[_0x2d72('0x74')]['length']+0x1,'app':_0x2d72('0xa3'),'appdata':_0x2d72('0xa4'),'interval':_0x2d72('0xa5')});}_0x389f02[_0x2d72('0xa2')][_0x2d72('0xa6')]=!![];}return db[_0x2d72('0xa7')][_0x2d72('0x59')]({'phone':_0x389f02[_0x2d72('0x60')][_0x2d72('0x80')],'messageId':_0x389f02[_0x2d72('0x60')][_0x2d72('0x83')],'body':_0x389f02[_0x2d72('0x60')][_0x2d72('0x60')],'SmsAccountId':_0x6d84d[_0x2d72('0x54')]['id'],'SmsInteractionId':_0x5bc891['id'],'direction':'in','ContactId':_0x5bc891[_0x2d72('0xa8')],'AttachmentId':_0x389f02[_0x2d72('0x60')][_0x2d72('0xa9')]});})[_0x2d72('0x22')](function(_0x483c3f){_0x389f02[_0x2d72('0x28')]=_0x483c3f;if(!_0x389f02[_0x2d72('0xa2')][_0x2d72('0xaa')])return;return db['User'][_0x2d72('0x58')]({'attributes':['id',_0x2d72('0x3a')],'where':{'id':_0x389f02['interaction']['UserId']}});})['then'](function(_0x467754){if(_0x467754){_0x389f02[_0x2d72('0x74')][_0x2d72('0xab')]({'id':0x0,'priority':0x0,'app':_0x2d72('0xac'),'appdata':_0x467754[_0x2d72('0x3a')]+','+(_0x389f02[_0x2d72('0x73')][_0x2d72('0xad')]||0xa),'interval':_0x2d72('0xa5')});}if(!_0x389f02[_0x2d72('0xa2')][_0x2d72('0xae')])return;return db[_0x2d72('0xaf')][_0x2d72('0x58')]({'attributes':['id',_0x2d72('0x3a')],'where':{'id':_0x389f02[_0x2d72('0xa2')]['queueId']}});})[_0x2d72('0x22')](function(_0x2a6a79){if(_0x2a6a79){_0x389f02['applications'][_0x2d72('0xab')]({'id':0x0,'priority':0x1,'app':_0x2d72('0xb0'),'appdata':_0x2a6a79[_0x2d72('0x3a')]+','+(_0x389f02['account'][_0x2d72('0xb1')]||0x12c),'interval':_0x2d72('0xa5')});}return respondWithRpcPromise(_0x2d72('0xb2'),_0x2d72('0xb3'),_0x389f02);})['then'](function(_0x53aff6){if(_0x53aff6){var _0x1b1322=0xc8;var _0x25c241=_0x2d72('0xb4');logger[_0x2d72('0x29')](_0x2d72('0x24'),_0x25c241,_0x1b1322,_0x2d72('0xb5'));logger[_0x2d72('0xb6')](_0x2d72('0xb7'),_0x25c241,_0x1b1322,_0x2d72('0xb5'),JSON[_0x2d72('0xb8')](_0x53aff6));if(_0x389f02[_0x2d72('0x73')][_0x2d72('0x4d')]==='twilio'){return _0x3cf6e5[_0x2d72('0x2c')](_0x1b1322)[_0x2d72('0xb9')](_0x2d72('0xba'),_0x2d72('0xbb'))[_0x2d72('0x3b')](_0x2d72('0xbc'));}else{return _0x3cf6e5[_0x2d72('0x2c')](_0x1b1322)[_0x2d72('0x31')](_0x53aff6);}}})[_0x2d72('0x52')](handleError(_0x3cf6e5,null));};exports[_0x2d72('0xbd')]=function(_0x489c7f,_0x6c37f){var _0x567973=_0x489c7f[_0x2d72('0x54')]['id'];var _0x417141=_0x489c7f['body'];var _0x288f8e=0xc8;var _0x494b64=null;return db[_0x2d72('0xbe')][_0x2d72('0xbf')]({'isolationLevel':db[_0x2d72('0xbe')]['Transaction'][_0x2d72('0xc0')][_0x2d72('0xc1')]},function(_0x55b547){return db[_0x2d72('0x50')][_0x2d72('0x66')]({'where':{'id':_0x567973},'transaction':_0x55b547})[_0x2d72('0x22')](function(_0x383ab2){if(_0x383ab2){return db['SmsApplication'][_0x2d72('0x38')]({'where':{'SmsAccountId':_0x567973},'transaction':_0x55b547})[_0x2d72('0x22')](function(){var _0x4ab1bb=_[_0x2d72('0x3d')](_0x417141,function(_0x1afc5b){_0x1afc5b[_0x2d72('0x63')]=_0x567973;return _0x1afc5b;});return db[_0x2d72('0x71')]['bulkCreate'](_0x4ab1bb,{'transaction':_0x55b547});});}else{_0x288f8e=0x194;_0x494b64=[];}});})['then'](function(){if(_0x288f8e!==0x194){return db[_0x2d72('0x71')][_0x2d72('0xc2')]({'where':{'SmsAccountId':_0x567973},'order':'priority'})['then'](function(_0x576222){_0x494b64=_0x576222;});}})[_0x2d72('0x52')](function(_0x28ff0e){_0x288f8e=0x1f4;logger[_0x2d72('0x26')](_0x28ff0e[_0x2d72('0xc3')]);if(_0x28ff0e[_0x2d72('0x3a')]){delete _0x28ff0e[_0x2d72('0x3a')];}_0x494b64=_0x28ff0e;})[_0x2d72('0xc4')](function(){if(_0x494b64===null){_0x6c37f[_0x2d72('0x2b')](_0x288f8e);}else{if(_0x288f8e===0x1f4){_0x6c37f['status'](_0x288f8e)[_0x2d72('0x3b')](_0x494b64);}else{_0x6c37f['status'](_0x288f8e)[_0x2d72('0x31')](_0x494b64);}}});};exports[_0x2d72('0xc5')]=function(_0x143291,_0x450fe7,_0x26d7c3){var _0x25a2c2={};var _0x1bf0c2={};var _0x3e9466;var _0x5ed459;return db['SmsAccount'][_0x2d72('0x66')]({'where':{'id':_0x143291[_0x2d72('0x54')]['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x450fe7,null))['then'](function(_0x57a60d){if(_0x57a60d){_0x3e9466=_0x57a60d;_0x1bf0c2[_0x2d72('0x40')]=_[_0x2d72('0x55')](db[_0x2d72('0x71')][_0x2d72('0x3e')]);_0x1bf0c2['query']=_[_0x2d72('0x55')](_0x143291[_0x2d72('0x41')]);_0x1bf0c2[_0x2d72('0x42')]=_[_0x2d72('0x43')](_0x1bf0c2[_0x2d72('0x40')],_0x1bf0c2[_0x2d72('0x41')]);_0x25a2c2['attributes']=_['intersection'](_0x1bf0c2[_0x2d72('0x40')],qs[_0x2d72('0x45')](_0x143291['query'][_0x2d72('0x45')]));_0x25a2c2[_0x2d72('0x44')]=_0x25a2c2[_0x2d72('0x44')][_0x2d72('0x67')]?_0x25a2c2[_0x2d72('0x44')]:_0x1bf0c2[_0x2d72('0x40')];_0x25a2c2['order']=qs[_0x2d72('0x49')](_0x143291[_0x2d72('0x41')][_0x2d72('0x49')]);_0x25a2c2['where']=qs[_0x2d72('0x42')](_['pick'](_0x143291[_0x2d72('0x41')],_0x1bf0c2[_0x2d72('0x42')]));if(_0x143291[_0x2d72('0x41')][_0x2d72('0x4b')]){_0x25a2c2['where']=_[_0x2d72('0x4c')](_0x25a2c2[_0x2d72('0x4a')],{'$or':_[_0x2d72('0x3d')](_0x25a2c2[_0x2d72('0x44')],function(_0xe03ae4){var _0x3d145a={};_0x3d145a[_0xe03ae4]={'$like':'%'+_0x143291[_0x2d72('0x41')][_0x2d72('0x4b')]+'%'};return _0x3d145a;})});}_0x25a2c2=_[_0x2d72('0x4c')]({},_0x25a2c2,_0x143291[_0x2d72('0x57')]);return _0x3e9466[_0x2d72('0xc5')](_0x25a2c2);}})[_0x2d72('0x22')](function(_0x5358a4){if(_0x5358a4){_0x5ed459=_0x5358a4[_0x2d72('0x67')];if(!_0x143291[_0x2d72('0x41')][_0x2d72('0x46')](_0x2d72('0x47'))){_0x25a2c2[_0x2d72('0x2f')]=qs[_0x2d72('0x2f')](_0x143291[_0x2d72('0x41')][_0x2d72('0x2f')]);_0x25a2c2[_0x2d72('0x2d')]=qs[_0x2d72('0x2d')](_0x143291['query'][_0x2d72('0x2d')]);}return _0x3e9466[_0x2d72('0xc5')](_0x25a2c2);}})[_0x2d72('0x22')](function(_0x58561d){if(_0x58561d){return _0x58561d?{'count':_0x5ed459,'rows':_0x58561d}:null;}})[_0x2d72('0x22')](respondWithResult(_0x450fe7,null))[_0x2d72('0x52')](handleError(_0x450fe7,null));};exports[_0x2d72('0xc6')]=function(_0x2065b3,_0x33f527,_0x1e9995){var _0x3016ae={'raw':![],'where':{}};var _0x5f65e6={};var _0x2fae0d={'count':0x0,'rows':[]};return db['SmsAccount'][_0x2d72('0x66')]({'where':{'id':_0x2065b3[_0x2d72('0x54')]['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x33f527,null))[_0x2d72('0x22')](function(_0x33f893){if(_0x33f893){_0x5f65e6[_0x2d72('0x40')]=_[_0x2d72('0x55')](db['SmsInteraction']['rawAttributes']);_0x5f65e6[_0x2d72('0x41')]=_[_0x2d72('0x55')](_0x2065b3[_0x2d72('0x41')]);_0x5f65e6['filters']=_[_0x2d72('0x43')](_0x5f65e6[_0x2d72('0x40')],_0x5f65e6[_0x2d72('0x41')]);_0x3016ae['attributes']=_[_0x2d72('0x43')](_0x5f65e6[_0x2d72('0x40')],qs[_0x2d72('0x45')](_0x2065b3[_0x2d72('0x41')][_0x2d72('0x45')]));_0x3016ae['attributes']=_0x3016ae[_0x2d72('0x44')][_0x2d72('0x67')]?_0x3016ae[_0x2d72('0x44')]:_0x5f65e6['model'];if(!_0x2065b3['query'][_0x2d72('0x46')](_0x2d72('0x47'))){_0x3016ae[_0x2d72('0x2f')]=qs['limit'](_0x2065b3[_0x2d72('0x41')][_0x2d72('0x2f')]);_0x3016ae[_0x2d72('0x2d')]=qs[_0x2d72('0x2d')](_0x2065b3['query'][_0x2d72('0x2d')]);}_0x3016ae[_0x2d72('0x48')]=qs[_0x2d72('0x49')](_0x2065b3[_0x2d72('0x41')][_0x2d72('0x49')]);_0x3016ae[_0x2d72('0x4a')]=qs['filters'](_[_0x2d72('0x68')](_0x2065b3['query'],_0x5f65e6[_0x2d72('0x42')]));_0x3016ae[_0x2d72('0x4a')][_0x2d72('0x63')]=_0x33f893['id'];if(_0x2065b3[_0x2d72('0x41')]['filter']){_0x3016ae['where']=_[_0x2d72('0x4c')](_0x3016ae[_0x2d72('0x4a')],{'$or':_[_0x2d72('0x3d')](_0x3016ae['attributes'],function(_0x5750ce){var _0x46d98d={};_0x46d98d[_0x5750ce]={'$like':'%'+_0x2065b3[_0x2d72('0x41')][_0x2d72('0x4b')]+'%'};return _0x46d98d;})});}_0x3016ae=_[_0x2d72('0x4c')]({},_0x3016ae,_0x2065b3['options']);return db['SmsInteraction'][_0x2d72('0x30')]({'where':_0x3016ae[_0x2d72('0x4a')]})[_0x2d72('0x22')](function(_0x3b0b07){_0x2fae0d[_0x2d72('0x30')]=_0x3b0b07;if(_0x2065b3['query'][_0x2d72('0x4f')]){_0x3016ae[_0x2d72('0x56')]=[{'model':db[_0x2d72('0x76')],'as':_0x2d72('0xc7'),'required':![]},{'model':db[_0x2d72('0xc8')],'as':_0x2d72('0xc9'),'attributes':[_0x2d72('0x3a'),_0x2d72('0xca'),'internal'],'required':![]},{'model':db[_0x2d72('0xcb')],'as':'Tags','attributes':['id','name',_0x2d72('0xcc')],'where':_0x2065b3[_0x2d72('0x41')][_0x2d72('0xcd')]?{'id':_0x2065b3[_0x2d72('0x41')]['tag']}:undefined,'required':_0x2065b3[_0x2d72('0x41')][_0x2d72('0xcd')]?!![]:![]}];}return db[_0x2d72('0xa1')][_0x2d72('0x51')](_0x3016ae);})['then'](function(_0x4e95d9){_0x2fae0d[_0x2d72('0x69')]=_0x4e95d9;return _0x2fae0d;});}})[_0x2d72('0x22')](respondWithFilteredResult(_0x33f527,_0x3016ae))[_0x2d72('0x52')](handleError(_0x33f527,null));};exports[_0x2d72('0x3b')]=function(_0x4cb00f,_0x1a2268,_0x5da758){var _0x338ae7,_0x3f36e5,_0x1b3c07;if(_['isNil'](_0x4cb00f['body'][_0x2d72('0x60')])||_0x4cb00f[_0x2d72('0x60')][_0x2d72('0x60')]===''){throw new db[(_0x2d72('0x77'))][(_0x2d72('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2d72('0x94')](_0x4cb00f[_0x2d72('0x60')]['to'])){throw new db[(_0x2d72('0x77'))][(_0x2d72('0x78'))](_0x2d72('0xce'));}_0x338ae7=_0x4cb00f['body']['to'];return db[_0x2d72('0x50')]['find']({'where':{'id':_0x4cb00f[_0x2d72('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x2d72('0xcf'),'include':[{'model':db[_0x2d72('0x76')],'as':'Contacts','where':{'mobile':_0x338ae7},'limit':0x1,'order':[[_0x2d72('0x7c'),_0x2d72('0x9c')]]}]}]})[_0x2d72('0x22')](handleEntityNotFound(_0x1a2268,null))[_0x2d72('0x22')](function(_0x224934){if(_0x224934&&_0x224934[_0x2d72('0xcf')]){_0x3f36e5=_0x224934[_0x2d72('0x5b')]({'plain':!![]});if(_0x3f36e5[_0x2d72('0xcf')]&&_0x3f36e5['List']['Contacts']['length']){return _0x3f36e5[_0x2d72('0xcf')][_0x2d72('0x9f')][0x0];}return db[_0x2d72('0x76')][_0x2d72('0x59')](_['defaults'](_0x4cb00f[_0x2d72('0x60')],{'firstName':_0x338ae7,'mobile':_0x338ae7,'phone':_0x338ae7,'ListId':_0x3f36e5[_0x2d72('0x9b')]}));}})[_0x2d72('0x22')](handleEntityNotFound(_0x1a2268,null))[_0x2d72('0x22')](function(_0x3dc3f2){if(_0x3dc3f2){_0x1b3c07=_0x3dc3f2;return db[_0x2d72('0xa1')][_0x2d72('0x58')]({'where':{'ContactId':_0x1b3c07['id'],'closed':![],'SmsAccountId':_0x3f36e5['id']}})[_0x2d72('0x22')](function(_0x3fd144){if(_0x3fd144){return[_0x3fd144,![]];}return db[_0x2d72('0xa1')][_0x2d72('0x59')]({'UserId':_0x4cb00f[_0x2d72('0x5a')]['id'],'ContactId':_0x1b3c07['id'],'SmsAccountId':_0x3f36e5['id'],'phone':_0x338ae7,'firstMsgDirection':_0x2d72('0xd0'),'Messages':[_[_0x2d72('0x4c')](_0x4cb00f['body'],{'read':![],'body':_0x4cb00f[_0x2d72('0x60')][_0x2d72('0x60')],'phone':_0x338ae7,'SmsAccountId':_0x3f36e5['id'],'UserId':_0x4cb00f['user']['id'],'ContactId':_0x1b3c07['id']})]},{'include':[{'model':db[_0x2d72('0xa7')],'as':_0x2d72('0xd1')}]})[_0x2d72('0x22')](function(_0x66c80a){return[_0x66c80a,!![]];});});}})['spread'](function(_0x29ceae,_0x4c5de2){if(_0x4c5de2){return _0x29ceae;}return db[_0x2d72('0xa7')][_0x2d72('0x59')](_[_0x2d72('0x4c')](_0x4cb00f[_0x2d72('0x60')],{'read':![],'body':_0x4cb00f[_0x2d72('0x60')][_0x2d72('0x60')],'phone':_0x338ae7,'SmsAccountId':_0x3f36e5['id'],'SmsInteractionId':_0x29ceae['id'],'UserId':_0x4cb00f[_0x2d72('0x5a')]['id'],'ContactId':_0x1b3c07['id']}))[_0x2d72('0x22')](function(_0x458ff7){_0x29ceae[_0x2d72('0xd2')]['Messages']=[];_0x29ceae[_0x2d72('0xd2')][_0x2d72('0xd1')][_0x2d72('0xd3')](_0x458ff7['dataValues']);return _0x29ceae;});})[_0x2d72('0x22')](respondWithResult(_0x1a2268,null))[_0x2d72('0x52')](handleError(_0x1a2268,null));};exports[_0x2d72('0x2c')]=function(_0x48c285,_0x5876f9,_0xa10d6c){if(_0x48c285[_0x2d72('0x60')]['id']){delete _0x48c285[_0x2d72('0x60')]['id'];}var _0x38a608,_0x1256db,_0x4335dc;return db[_0x2d72('0x50')]['find']({'where':{'id':_0x48c285['params']['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x5876f9,null))['then'](function(_0x1981a5){if(_0x1981a5){_0x4335dc=_0x1981a5;logger[_0x2d72('0xb6')](_0x2d72('0x24'),_0x2d72('0x2c'),'received\x20delivery\x20report\x20from',_0x1981a5[_0x2d72('0x4d')],util['inspect'](_0x48c285['body'],{'showHidden':![],'depth':null}));switch(_0x1981a5[_0x2d72('0x4d')]){case _0x2d72('0xd4'):if(_0x48c285['body'][_0x2d72('0xd5')]&&_0x48c285[_0x2d72('0x60')][_0x2d72('0x2c')]){_0x1256db=_0x48c285[_0x2d72('0x60')][_0x2d72('0x2c')];return db[_0x2d72('0xa7')][_0x2d72('0x58')]({'where':{'messageId':_0x48c285['body'][_0x2d72('0xd5')]}});}break;case _0x2d72('0x84'):if(_0x48c285[_0x2d72('0x60')][_0x2d72('0xd6')]&&_0x48c285['body'][_0x2d72('0xd7')]){_0x1256db=_0x48c285['body']['statusInt'];return db[_0x2d72('0xa7')][_0x2d72('0x58')]({'where':{'messageId':_0x48c285[_0x2d72('0x60')]['requestid']}});}break;case _0x2d72('0x85'):if(_0x48c285[_0x2d72('0x60')][_0x2d72('0x86')]&&_0x48c285[_0x2d72('0x60')][_0x2d72('0xd8')]){_0x1256db=_0x48c285[_0x2d72('0x60')][_0x2d72('0xd8')];return db[_0x2d72('0xa7')]['find']({'where':{'messageId':_0x48c285[_0x2d72('0x60')][_0x2d72('0x86')]}});}break;case'infobip':var _0x1be37c=_0x48c285[_0x2d72('0x60')][_0x2d72('0x8a')][0x0];if(_0x1be37c['messageId']&&_0x1be37c[_0x2d72('0x2c')][_0x2d72('0xd9')]==='DELIVERED'){_0x1256db=_0x1be37c[_0x2d72('0x2c')][_0x2d72('0xd9')];return db[_0x2d72('0xa7')]['find']({'where':{'messageId':_0x1be37c['messageId']}});}break;case'clickatell':if(_0x48c285[_0x2d72('0x60')][_0x2d72('0x83')]&&_0x48c285['body']['status']){_0x1256db=_0x48c285[_0x2d72('0x60')][_0x2d72('0x2c')];return db[_0x2d72('0xa7')][_0x2d72('0x58')]({'where':{'messageId':_0x48c285[_0x2d72('0x60')][_0x2d72('0x83')]}});}break;case'bandwidth':if(_0x48c285[_0x2d72('0x60')][0x0][_0x2d72('0x28')]['id']){_0x1256db=_0x48c285[_0x2d72('0x60')][0x0][_0x2d72('0x4d')];return db[_0x2d72('0xa7')][_0x2d72('0x58')]({'where':{'messageId':_0x48c285[_0x2d72('0x60')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x48c285[_0x2d72('0x60')][_0x2d72('0xda')]&&_0x48c285[_0x2d72('0x60')][_0x2d72('0x2c')]){_0x1256db=_0x48c285['body'][_0x2d72('0x2c')];return db[_0x2d72('0xa7')][_0x2d72('0x58')]({'where':{'messageId':_0x48c285[_0x2d72('0x60')][_0x2d72('0xda')]}});}break;}}})['then'](handleEntityNotFound(_0x5876f9,null))[_0x2d72('0x22')](function(_0x17cc06){if(_0x17cc06){_0x38a608=_0x17cc06;switch(_0x4335dc[_0x2d72('0x4d')]){case'skebby':if(_0x1256db===_0x2d72('0xdb')){return _0x38a608[_0x2d72('0x35')]({'read':!![]});}else{logger[_0x2d72('0x26')](_0x2d72('0x24'),'status',_0x2d72('0xd4'),util[_0x2d72('0xdc')](_0x48c285['body'],{'showHidden':![],'depth':null}));}break;case _0x2d72('0x84'):if(_0x1256db==='1'){return _0x38a608[_0x2d72('0x35')]({'read':!![]});}else{logger[_0x2d72('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d72('0x2c'),_0x2d72('0xd4'),util[_0x2d72('0xdc')](_0x48c285['body'],{'showHidden':![],'depth':null}));}break;case _0x2d72('0x85'):if(!_0x48c285['body']['error_code']&&_0x1256db>=0xc8&&_0x1256db<=0xce){return _0x38a608[_0x2d72('0x35')]({'read':!![]});}else{logger[_0x2d72('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d72('0x2c'),_0x2d72('0x85'),util[_0x2d72('0xdc')](_0x48c285[_0x2d72('0x60')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x15a024=_0x48c285[_0x2d72('0x60')]['results'][0x0];if(_0x15a024['status'][_0x2d72('0xd9')]==='DELIVERED'){return _0x38a608[_0x2d72('0x35')]({'read':!![]});}else{logger[_0x2d72('0x26')](_0x2d72('0x24'),_0x2d72('0x2c'),_0x2d72('0xdd'),util[_0x2d72('0xdc')](_0x48c285[_0x2d72('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x1256db=='DELIVERED_TO_GATEWAY'||_0x1256db==_0x2d72('0xde')){return _0x38a608[_0x2d72('0x35')]({'read':!![]});}else{logger[_0x2d72('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clickatell',util[_0x2d72('0xdc')](_0x48c285['body'],{'showHidden':![],'depth':null}));}break;case _0x2d72('0x91'):if(_0x1256db=='message-delivered'){return _0x38a608[_0x2d72('0x35')]({'read':!![]});}else{logger[_0x2d72('0x26')](_0x2d72('0x24'),_0x2d72('0x2c'),_0x2d72('0x91'),util[_0x2d72('0xdc')](_0x48c285[_0x2d72('0x60')],{'showHidden':![],'depth':null}));}break;case _0x2d72('0x92'):if(_0x1256db===_0x2d72('0xdf')||_0x1256db===_0x2d72('0xe0')){return _0x38a608[_0x2d72('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d72('0x2c'),_0x2d72('0x92'),util[_0x2d72('0xdc')](_0x48c285[_0x2d72('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x38a608;}})[_0x2d72('0x22')](respondWithResult(_0x5876f9,null))[_0x2d72('0x52')](handleError(_0x5876f9,null));};exports['statusGet']=function(_0x4c9a6b,_0x1f5f84,_0x385eba){var _0xc23768,_0x16ba1a,_0x347ef6;return db['SmsAccount']['find']({'where':{'id':_0x4c9a6b[_0x2d72('0x54')]['id']}})['then'](handleEntityNotFound(_0x1f5f84,null))[_0x2d72('0x22')](function(_0x157aa1){if(_0x157aa1){_0x347ef6=_0x157aa1;logger['debug'](_0x2d72('0x24'),'status',_0x2d72('0xe1'),_0x157aa1[_0x2d72('0x4d')],util[_0x2d72('0xdc')](_0x4c9a6b[_0x2d72('0x41')],{'showHidden':![],'depth':null}));switch(_0x157aa1[_0x2d72('0x4d')]){case _0x2d72('0xe2'):if(_0x4c9a6b[_0x2d72('0x41')]['message-id']&&_0x4c9a6b[_0x2d72('0x41')][_0x2d72('0xe3')]){_0x16ba1a=_0x4c9a6b[_0x2d72('0x41')][_0x2d72('0xe3')];return db[_0x2d72('0xa7')]['find']({'where':{'messageId':_0x4c9a6b[_0x2d72('0x41')][_0x2d72('0xe4')]}});}break;}}})[_0x2d72('0x22')](handleEntityNotFound(_0x1f5f84,null))['then'](function(_0x5b0626){if(_0x5b0626){_0xc23768=_0x5b0626;switch(_0x347ef6['type']){case _0x2d72('0xe2'):if(_0x16ba1a==='2'||_0x16ba1a==='6'){return _0xc23768[_0x2d72('0x35')]({'read':!![]});}else{logger[_0x2d72('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d72('0x2c'),_0x2d72('0xe2'),util[_0x2d72('0xdc')](_0x4c9a6b[_0x2d72('0x41')],{'showHidden':![],'depth':null}));};break;}return _0xc23768;}})[_0x2d72('0x22')](respondWithResult(_0x1f5f84,null))[_0x2d72('0x52')](handleError(_0x1f5f84,null));};exports[_0x2d72('0xe5')]=function(_0x3710f0,_0x31f081,_0x3457e9){return db[_0x2d72('0x50')][_0x2d72('0x58')]({'where':{'id':_0x3710f0['params']['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x31f081,null))['then'](function(_0x3cf9af){if(_0x3cf9af){return _0x3cf9af['addAgents'](_0x3710f0[_0x2d72('0x60')]['ids'],_[_0x2d72('0x9e')](_0x3710f0['body'],[_0x2d72('0x6b'),'id'])||{})['spread'](function(_0x13a42f){for(var _0x4c4cbd=0x0;_0x4c4cbd<_0x3710f0[_0x2d72('0x60')][_0x2d72('0x6b')][_0x2d72('0x67')];_0x4c4cbd+=0x1){socket[_0x2d72('0xe6')](_0x2d72('0xe7'),{'UserId':Number(_0x3710f0['body']['ids'][_0x4c4cbd]),'SmsAccountId':Number(_0x3710f0['params']['id'])});}return _0x13a42f;});}})[_0x2d72('0x22')](respondWithResult(_0x31f081,null))['catch'](handleError(_0x31f081,null));};exports['removeAgents']=function(_0x3db6f3,_0x4d567e,_0x581f9d){return db['SmsAccount'][_0x2d72('0x58')]({'where':{'id':_0x3db6f3['params']['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0x4d567e,null))[_0x2d72('0x22')](function(_0x3bc545){if(_0x3bc545){return _0x3bc545[_0x2d72('0xe8')](_0x3db6f3[_0x2d72('0x41')][_0x2d72('0x6b')])['then'](function(){if(_[_0x2d72('0xe9')](_0x3db6f3[_0x2d72('0x41')][_0x2d72('0x6b')])){for(var _0x431c0f=0x0;_0x431c0f<_0x3db6f3[_0x2d72('0x41')][_0x2d72('0x6b')][_0x2d72('0x67')];_0x431c0f+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x3db6f3[_0x2d72('0x41')][_0x2d72('0x6b')][_0x431c0f]),'SmsAccountId':Number(_0x3db6f3['params']['id'])});}}else{socket[_0x2d72('0xe6')](_0x2d72('0xea'),{'UserId':Number(_0x3db6f3['query']['ids']),'SmsAccountId':Number(_0x3db6f3[_0x2d72('0x54')]['id'])});}});}})[_0x2d72('0x22')](respondWithStatusCode(_0x4d567e,null))[_0x2d72('0x52')](handleError(_0x4d567e,null));};exports[_0x2d72('0xeb')]=function(_0x21acf2,_0xb107d1,_0x215f2c){var _0x2824a5={};var _0x138359={};var _0xf324c2;var _0x1f730f;return db['SmsAccount'][_0x2d72('0x66')]({'where':{'id':_0x21acf2[_0x2d72('0x54')]['id']}})[_0x2d72('0x22')](handleEntityNotFound(_0xb107d1,null))[_0x2d72('0x22')](function(_0x5162c3){if(_0x5162c3){_0xf324c2=_0x5162c3;_0x138359['model']=_[_0x2d72('0x55')](db[_0x2d72('0xc8')][_0x2d72('0x3e')]);_0x138359['query']=_[_0x2d72('0x55')](_0x21acf2['query']);_0x138359[_0x2d72('0x42')]=_[_0x2d72('0x43')](_0x138359[_0x2d72('0x40')],_0x138359[_0x2d72('0x41')]);_0x2824a5[_0x2d72('0x44')]=_[_0x2d72('0x43')](_0x138359[_0x2d72('0x40')],qs[_0x2d72('0x45')](_0x21acf2[_0x2d72('0x41')][_0x2d72('0x45')]));_0x2824a5[_0x2d72('0x44')]=_0x2824a5[_0x2d72('0x44')]['length']?_0x2824a5[_0x2d72('0x44')]:_0x138359['model'];_0x2824a5[_0x2d72('0x48')]=qs[_0x2d72('0x49')](_0x21acf2[_0x2d72('0x41')][_0x2d72('0x49')]);_0x2824a5[_0x2d72('0x4a')]=qs[_0x2d72('0x42')](_[_0x2d72('0x68')](_0x21acf2[_0x2d72('0x41')],_0x138359[_0x2d72('0x42')]));if(_0x21acf2[_0x2d72('0x41')][_0x2d72('0x4b')]){_0x2824a5[_0x2d72('0x4a')]=_[_0x2d72('0x4c')](_0x2824a5[_0x2d72('0x4a')],{'$or':_[_0x2d72('0x3d')](_0x2824a5[_0x2d72('0x44')],function(_0x42bd1c){var _0x5906cd={};_0x5906cd[_0x42bd1c]={'$like':'%'+_0x21acf2['query']['filter']+'%'};return _0x5906cd;})});}_0x2824a5=_[_0x2d72('0x4c')]({},_0x2824a5,_0x21acf2['options']);return _0xf324c2[_0x2d72('0xeb')](_0x2824a5);}})[_0x2d72('0x22')](function(_0x2297dc){if(_0x2297dc){_0x1f730f=_0x2297dc[_0x2d72('0x67')];if(!_0x21acf2[_0x2d72('0x41')][_0x2d72('0x46')](_0x2d72('0x47'))){_0x2824a5[_0x2d72('0x2f')]=qs[_0x2d72('0x2f')](_0x21acf2[_0x2d72('0x41')][_0x2d72('0x2f')]);_0x2824a5[_0x2d72('0x2d')]=qs[_0x2d72('0x2d')](_0x21acf2['query'][_0x2d72('0x2d')]);}return _0xf324c2[_0x2d72('0xeb')](_0x2824a5);}})['then'](function(_0x2da8ae){if(_0x2da8ae){return _0x2da8ae?{'count':_0x1f730f,'rows':_0x2da8ae}:null;}})[_0x2d72('0x22')](respondWithResult(_0xb107d1,null))[_0x2d72('0x52')](handleError(_0xb107d1,null));}; \ No newline at end of file +var _0x3745=['waitForTheAssignedQueue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','omit','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','offset','undefined','limit','count','set','json','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','messageId','skebby','sender','text','connectel','clicksend','message_id','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','SmsInteraction','interaction','created','autoclose','push','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','queueId','SmsQueue','queue'];(function(_0x85d56d,_0x37f5c1){var _0x51f613=function(_0x4927df){while(--_0x4927df){_0x85d56d['push'](_0x85d56d['shift']());}};_0x51f613(++_0x37f5c1);}(_0x3745,0x115));var _0x5374=function(_0x381dbb,_0x4a1419){_0x381dbb=_0x381dbb-0x0;var _0x301378=_0x3745[_0x381dbb];return _0x301378;};'use strict';var emlformat=require(_0x5374('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5374('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5374('0x2'));var moment=require('moment');var BPromise=require(_0x5374('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5374('0x4'));var sox=require(_0x5374('0x5'));var csv=require(_0x5374('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5374('0x7'));var _=require('lodash');var squel=require(_0x5374('0x8'));var crypto=require(_0x5374('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5374('0xa'));var Papa=require(_0x5374('0xb'));var Redis=require(_0x5374('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5374('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5374('0xe'));var logger=require(_0x5374('0xf'))('api');var utils=require(_0x5374('0x10'));var config=require(_0x5374('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x5374('0x12'))['db'];config[_0x5374('0x13')]=_[_0x5374('0x14')](config[_0x5374('0x13')],{'host':_0x5374('0x15'),'port':0x18eb});var socket=require(_0x5374('0x16'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x5374('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5374('0x18')][_0x5374('0x19')]({'port':0x232c});function respondWithRpcPromise(_0xa323,_0x7c4e,_0x3a9006,_0x4a5674){return new BPromise(function(_0xc36d8a,_0x30a0ff){var _0x2be2e6=_0x4a5674||client;return _0x2be2e6[_0x5374('0x1a')](_0xa323,_0x3a9006)[_0x5374('0x1b')](function(_0x11e19c){logger[_0x5374('0x1c')](_0x5374('0x1d'),_0x7c4e,_0x5374('0x1e'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7c4e,_0x5374('0x1e'),JSON[_0x5374('0x1f')](_0x11e19c));if(_0x11e19c[_0x5374('0x20')]){if(_0x11e19c[_0x5374('0x20')][_0x5374('0x21')]===0x1f4){logger[_0x5374('0x20')](_0x5374('0x1d'),_0x7c4e,_0x11e19c['error'][_0x5374('0x22')]);return _0x30a0ff(_0x11e19c['error'][_0x5374('0x22')]);}logger['error'](_0x5374('0x1d'),_0x7c4e,_0x11e19c[_0x5374('0x20')][_0x5374('0x22')]);return _0xc36d8a(_0x11e19c['error'][_0x5374('0x22')]);}else{logger[_0x5374('0x1c')](_0x5374('0x1d'),_0x7c4e,'request\x20sent');_0xc36d8a(_0x11e19c[_0x5374('0x23')][_0x5374('0x22')]);}})[_0x5374('0x24')](function(_0x1351e7){logger[_0x5374('0x20')]('SmsAccount,\x20%s,\x20%s',_0x7c4e,_0x1351e7);_0x30a0ff(_0x1351e7);});});}function respondWithStatusCode(_0x206635,_0x143661){_0x143661=_0x143661||0xcc;return function(_0xbdb250){if(_0xbdb250){return _0x206635['sendStatus'](_0x143661);}return _0x206635['status'](_0x143661)[_0x5374('0x25')]();};}function respondWithResult(_0x2cadf5,_0x208aec){_0x208aec=_0x208aec||0xc8;return function(_0x16b31a){if(_0x16b31a){return _0x2cadf5[_0x5374('0x26')](_0x208aec)['json'](_0x16b31a);}};}function respondWithFilteredResult(_0x1c05b4,_0x42dc72){return function(_0x4eeda6){if(_0x4eeda6){var _0x2fdf36=typeof _0x42dc72[_0x5374('0x27')]===_0x5374('0x28')&&typeof _0x42dc72[_0x5374('0x29')]===_0x5374('0x28');var _0x479216=_0x4eeda6[_0x5374('0x2a')];var _0x4543e6=_0x2fdf36?0x0:_0x42dc72[_0x5374('0x27')];var _0x1917e8=_0x2fdf36?_0x4eeda6[_0x5374('0x2a')]:_0x42dc72[_0x5374('0x27')]+_0x42dc72['limit'];var _0x72a26a;if(_0x1917e8>=_0x479216){_0x1917e8=_0x479216;_0x72a26a=0xc8;}else{_0x72a26a=0xce;}_0x1c05b4['status'](_0x72a26a);return _0x1c05b4[_0x5374('0x2b')]('Content-Range',_0x4543e6+'-'+_0x1917e8+'/'+_0x479216)[_0x5374('0x2c')](_0x4eeda6);}return null;};}function patchUpdates(_0x31c00f){return function(_0x1e8702){try{jsonpatch[_0x5374('0x2d')](_0x1e8702,_0x31c00f,!![]);}catch(_0x227ed4){return BPromise[_0x5374('0x2e')](_0x227ed4);}return _0x1e8702['save']();};}function saveUpdates(_0x2bee70,_0x55a5a7){return function(_0x2ce8cc){if(_0x2ce8cc){return _0x2ce8cc[_0x5374('0x2f')](_0x2bee70)['then'](function(_0x599ecb){return _0x599ecb;});}return null;};}function removeEntity(_0xbeaa2,_0xa6f1cc){return function(_0xc4f80){if(_0xc4f80){return _0xc4f80[_0x5374('0x30')]()[_0x5374('0x1b')](function(){var _0x39568f=_0xc4f80[_0x5374('0x31')]({'plain':!![]});var _0x4da3d2=_0x5374('0x32');return db[_0x5374('0x33')][_0x5374('0x30')]({'where':{'type':_0x4da3d2,'resourceId':_0x39568f['id']}})['then'](function(){return _0xc4f80;});})[_0x5374('0x1b')](function(){_0xbeaa2['status'](0xcc)[_0x5374('0x25')]();});}};}function handleEntityNotFound(_0x882d9e,_0x2310d2){return function(_0x5e9bab){if(!_0x5e9bab){_0x882d9e[_0x5374('0x34')](0x194);}return _0x5e9bab;};}function handleError(_0x51fb66,_0x1dfdd7){_0x1dfdd7=_0x1dfdd7||0x1f4;return function(_0x248cce){logger[_0x5374('0x20')](_0x248cce[_0x5374('0x35')]);if(_0x248cce[_0x5374('0x36')]){delete _0x248cce['name'];}_0x51fb66['status'](_0x1dfdd7)[_0x5374('0x37')](_0x248cce);};}exports[_0x5374('0x38')]=function(_0x45afaf,_0x81213d){var _0x1acc3f={'include':[{'model':db[_0x5374('0x39')],'as':'mandatoryDispositionPause'}]},_0x8857a={},_0xfe4fd6={'count':0x0,'rows':[]};var _0x4dc055=_[_0x5374('0x3a')](db[_0x5374('0x3b')][_0x5374('0x3c')],function(_0x2f815e){return{'name':_0x2f815e['fieldName'],'type':_0x2f815e[_0x5374('0x3d')]['key']};});_0x8857a[_0x5374('0x3e')]=_[_0x5374('0x3a')](_0x4dc055,'name');_0x8857a[_0x5374('0x3f')]=_[_0x5374('0x40')](_0x45afaf[_0x5374('0x3f')]);_0x8857a[_0x5374('0x41')]=_[_0x5374('0x42')](_0x8857a[_0x5374('0x3e')],_0x8857a['query']);_0x1acc3f[_0x5374('0x43')]=_[_0x5374('0x42')](_0x8857a[_0x5374('0x3e')],qs['fields'](_0x45afaf[_0x5374('0x3f')][_0x5374('0x44')]));_0x1acc3f[_0x5374('0x43')]=_0x1acc3f['attributes'][_0x5374('0x45')]?_0x1acc3f[_0x5374('0x43')]:_0x8857a[_0x5374('0x3e')];if(!_0x45afaf['query'][_0x5374('0x46')](_0x5374('0x47'))){_0x1acc3f[_0x5374('0x29')]=qs[_0x5374('0x29')](_0x45afaf[_0x5374('0x3f')]['limit']);_0x1acc3f[_0x5374('0x27')]=qs['offset'](_0x45afaf[_0x5374('0x3f')][_0x5374('0x27')]);}_0x1acc3f[_0x5374('0x48')]=qs[_0x5374('0x49')](_0x45afaf[_0x5374('0x3f')][_0x5374('0x49')]);_0x1acc3f['where']=qs[_0x5374('0x41')](_[_0x5374('0x4a')](_0x45afaf['query'],_0x8857a['filters']),_0x4dc055);if(_0x45afaf[_0x5374('0x3f')][_0x5374('0x4b')]){_0x1acc3f[_0x5374('0x4c')]=_[_0x5374('0x4d')](_0x1acc3f[_0x5374('0x4c')],{'$or':_[_0x5374('0x3a')](_0x4dc055,function(_0x54939c){if(_0x54939c['type']!=='VIRTUAL'){var _0x13f69a={};_0x13f69a[_0x54939c[_0x5374('0x36')]]={'$like':'%'+_0x45afaf[_0x5374('0x3f')][_0x5374('0x4b')]+'%'};return _0x13f69a;}})});}_0x1acc3f=_[_0x5374('0x4d')]({},_0x1acc3f,_0x45afaf[_0x5374('0x4e')]);var _0x25f568={'where':_0x1acc3f[_0x5374('0x4c')]};return db[_0x5374('0x3b')][_0x5374('0x2a')](_0x25f568)[_0x5374('0x1b')](function(_0x56fd10){_0xfe4fd6[_0x5374('0x2a')]=_0x56fd10;if(_0x45afaf[_0x5374('0x3f')][_0x5374('0x4f')]){_0x1acc3f[_0x5374('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0x5374('0x51')](_0x1acc3f);})[_0x5374('0x1b')](function(_0x98ed60){_0xfe4fd6[_0x5374('0x52')]=_0x98ed60;return _0xfe4fd6;})[_0x5374('0x1b')](respondWithFilteredResult(_0x81213d,_0x1acc3f))[_0x5374('0x24')](handleError(_0x81213d,null));};exports[_0x5374('0x53')]=function(_0x48f040,_0x4fb0de){var _0x10335e={'raw':![],'where':{'id':_0x48f040[_0x5374('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x5374('0x55')}]},_0x17de74={};_0x17de74[_0x5374('0x3e')]=_[_0x5374('0x40')](db[_0x5374('0x3b')][_0x5374('0x3c')]);_0x17de74[_0x5374('0x3f')]=_[_0x5374('0x40')](_0x48f040[_0x5374('0x3f')]);_0x17de74[_0x5374('0x41')]=_[_0x5374('0x42')](_0x17de74['model'],_0x17de74[_0x5374('0x3f')]);_0x10335e[_0x5374('0x43')]=_[_0x5374('0x42')](_0x17de74['model'],qs[_0x5374('0x44')](_0x48f040[_0x5374('0x3f')]['fields']));_0x10335e[_0x5374('0x43')]=_0x10335e[_0x5374('0x43')][_0x5374('0x45')]?_0x10335e[_0x5374('0x43')]:_0x17de74[_0x5374('0x3e')];if(_0x48f040[_0x5374('0x3f')][_0x5374('0x4f')]){_0x10335e[_0x5374('0x50')]=[{'all':!![]}];}_0x10335e=_[_0x5374('0x4d')]({},_0x10335e,_0x48f040[_0x5374('0x4e')]);return db['SmsAccount'][_0x5374('0x56')](_0x10335e)[_0x5374('0x1b')](handleEntityNotFound(_0x4fb0de,null))['then'](respondWithResult(_0x4fb0de,null))[_0x5374('0x24')](handleError(_0x4fb0de,null));};exports[_0x5374('0x57')]=function(_0x3d6de3,_0x51c4e3){return db[_0x5374('0x3b')][_0x5374('0x57')](_0x3d6de3[_0x5374('0x58')],{})[_0x5374('0x1b')](function(_0x548fa6){var _0x18444a=_0x3d6de3[_0x5374('0x59')]['get']({'plain':!![]});if(!_0x18444a)throw new Error(_0x5374('0x5a'));if(_0x18444a[_0x5374('0x5b')]==='user'){var _0x58ba7d=_0x548fa6[_0x5374('0x31')]({'plain':!![]});var _0x215409='SmsAccounts';return db[_0x5374('0x5c')][_0x5374('0x56')]({'where':{'name':_0x215409,'userProfileId':_0x18444a[_0x5374('0x5d')]},'raw':!![]})[_0x5374('0x1b')](function(_0x2f134a){if(_0x2f134a&&_0x2f134a[_0x5374('0x5e')]===0x0){return db[_0x5374('0x33')]['create']({'name':_0x58ba7d[_0x5374('0x36')],'resourceId':_0x58ba7d['id'],'type':_0x2f134a['name'],'sectionId':_0x2f134a['id']},{})['then'](function(){return _0x548fa6;});}else{return _0x548fa6;}})[_0x5374('0x24')](function(_0x3b7211){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b7211);throw _0x3b7211;});}return _0x548fa6;})[_0x5374('0x1b')](respondWithResult(_0x51c4e3,0xc9))[_0x5374('0x24')](handleError(_0x51c4e3,null));};exports[_0x5374('0x2f')]=function(_0x1bf39d,_0x27aefa){if(_0x1bf39d['body']['id']){delete _0x1bf39d[_0x5374('0x58')]['id'];}return db[_0x5374('0x3b')][_0x5374('0x56')]({'where':{'id':_0x1bf39d[_0x5374('0x54')]['id']},'include':[{'model':db[_0x5374('0x39')],'as':_0x5374('0x55')}]})[_0x5374('0x1b')](handleEntityNotFound(_0x27aefa,null))[_0x5374('0x1b')](saveUpdates(_0x1bf39d['body'],null))['then'](respondWithResult(_0x27aefa,null))[_0x5374('0x24')](handleError(_0x27aefa,null));};exports['destroy']=function(_0x468482,_0x4e137c){return db[_0x5374('0x3b')][_0x5374('0x56')]({'where':{'id':_0x468482[_0x5374('0x54')]['id']}})['then'](handleEntityNotFound(_0x4e137c,null))[_0x5374('0x1b')](removeEntity(_0x4e137c,null))[_0x5374('0x24')](handleError(_0x4e137c,null));};exports[_0x5374('0x5f')]=function(_0x81b489,_0x2b1104){return db['SmsAccount'][_0x5374('0x5f')]()[_0x5374('0x1b')](respondWithResult(_0x2b1104,null))[_0x5374('0x24')](handleError(_0x2b1104,null));};exports[_0x5374('0x60')]=function(_0x4672cf,_0x24b735,_0x3756f3){if(_0x4672cf[_0x5374('0x58')]['id']){delete _0x4672cf[_0x5374('0x58')]['id'];}return db[_0x5374('0x3b')][_0x5374('0x56')]({'where':{'id':_0x4672cf[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x24b735,null))['then'](function(_0x37deda){if(_0x37deda){_0x4672cf['body'][_0x5374('0x61')]=_0x37deda['id'];return db[_0x5374('0x62')][_0x5374('0x57')](_0x4672cf[_0x5374('0x58')]);}})[_0x5374('0x1b')](respondWithResult(_0x24b735,null))[_0x5374('0x24')](handleError(_0x24b735,null));};exports[_0x5374('0x63')]=function(_0x2ddf13,_0x2f9138,_0x4d5a7f){var _0xfa9cfb={'raw':![],'where':{}};var _0x561787={};var _0x5030a2={'count':0x0,'rows':[]};return db[_0x5374('0x3b')][_0x5374('0x64')]({'where':{'id':_0x2ddf13[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x2f9138,null))[_0x5374('0x1b')](function(_0x42f1bd){if(_0x42f1bd){_0x561787[_0x5374('0x3e')]=_['keys'](db['Disposition']['rawAttributes']);_0x561787[_0x5374('0x3f')]=_[_0x5374('0x40')](_0x2ddf13[_0x5374('0x3f')]);_0x561787['filters']=_['intersection'](_0x561787[_0x5374('0x3e')],_0x561787[_0x5374('0x3f')]);_0xfa9cfb['attributes']=_['intersection'](_0x561787[_0x5374('0x3e')],qs[_0x5374('0x44')](_0x2ddf13[_0x5374('0x3f')]['fields']));_0xfa9cfb[_0x5374('0x43')]=_0xfa9cfb['attributes'][_0x5374('0x45')]?_0xfa9cfb[_0x5374('0x43')]:_0x561787['model'];if(!_0x2ddf13[_0x5374('0x3f')]['hasOwnProperty']('nolimit')){_0xfa9cfb[_0x5374('0x29')]=qs['limit'](_0x2ddf13[_0x5374('0x3f')][_0x5374('0x29')]);_0xfa9cfb['offset']=qs['offset'](_0x2ddf13[_0x5374('0x3f')]['offset']);}_0xfa9cfb[_0x5374('0x48')]=qs[_0x5374('0x49')](_0x2ddf13[_0x5374('0x3f')][_0x5374('0x49')]);_0xfa9cfb['where']=qs[_0x5374('0x41')](_[_0x5374('0x4a')](_0x2ddf13['query'],_0x561787[_0x5374('0x41')]));_0xfa9cfb[_0x5374('0x4c')][_0x5374('0x61')]=_0x42f1bd['id'];if(_0x2ddf13['query'][_0x5374('0x4b')]){_0xfa9cfb['where']=_['merge'](_0xfa9cfb[_0x5374('0x4c')],{'$or':_[_0x5374('0x3a')](_0xfa9cfb['attributes'],function(_0x3be89d){var _0x2c5ec3={};_0x2c5ec3[_0x3be89d]={'$like':'%'+_0x2ddf13[_0x5374('0x3f')][_0x5374('0x4b')]+'%'};return _0x2c5ec3;})});}_0xfa9cfb=_['merge']({},_0xfa9cfb,_0x2ddf13[_0x5374('0x4e')]);return db[_0x5374('0x62')][_0x5374('0x2a')]({'where':_0xfa9cfb[_0x5374('0x4c')]})[_0x5374('0x1b')](function(_0x4e6d60){_0x5030a2[_0x5374('0x2a')]=_0x4e6d60;if(_0x2ddf13[_0x5374('0x3f')]['includeAll']){_0xfa9cfb[_0x5374('0x50')]=[{'all':!![]}];}return db[_0x5374('0x62')][_0x5374('0x51')](_0xfa9cfb);})[_0x5374('0x1b')](function(_0x4f98fc){_0x5030a2['rows']=_0x4f98fc;return _0x5030a2;});}})['then'](respondWithFilteredResult(_0x2f9138,_0xfa9cfb))[_0x5374('0x24')](handleError(_0x2f9138,null));};exports[_0x5374('0x65')]=function(_0x2e00e3,_0x55b308,_0x3ae408){return db['SmsAccount'][_0x5374('0x56')]({'where':{'id':_0x2e00e3[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x55b308,null))[_0x5374('0x1b')](function(_0x34c217){if(_0x34c217){return _0x34c217['removeDispositions'](_0x2e00e3[_0x5374('0x3f')][_0x5374('0x66')]);}})[_0x5374('0x1b')](respondWithStatusCode(_0x55b308,null))[_0x5374('0x24')](handleError(_0x55b308,null));};exports[_0x5374('0x67')]=function(_0xd22938,_0x50df91,_0x1958a2){if(_0xd22938[_0x5374('0x58')]['id']){delete _0xd22938['body']['id'];}return db[_0x5374('0x3b')][_0x5374('0x56')]({'where':{'id':_0xd22938[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x50df91,null))['then'](function(_0x45d1f2){if(_0x45d1f2){_0xd22938[_0x5374('0x58')][_0x5374('0x61')]=_0x45d1f2['id'];return db[_0x5374('0x68')][_0x5374('0x57')](_0xd22938['body']);}})['then'](respondWithResult(_0x50df91,null))[_0x5374('0x24')](handleError(_0x50df91,null));};exports[_0x5374('0x69')]=function(_0x2cc657,_0x25b607,_0x4f2c26){var _0xe9e114={'raw':![],'where':{}};var _0x119764={};var _0x114e24={'count':0x0,'rows':[]};return db[_0x5374('0x3b')][_0x5374('0x64')]({'where':{'id':_0x2cc657[_0x5374('0x54')]['id']}})['then'](handleEntityNotFound(_0x25b607,null))[_0x5374('0x1b')](function(_0x5ac071){if(_0x5ac071){_0x119764[_0x5374('0x3e')]=_['keys'](db['CannedAnswer'][_0x5374('0x3c')]);_0x119764['query']=_['keys'](_0x2cc657[_0x5374('0x3f')]);_0x119764[_0x5374('0x41')]=_['intersection'](_0x119764[_0x5374('0x3e')],_0x119764[_0x5374('0x3f')]);_0xe9e114[_0x5374('0x43')]=_[_0x5374('0x42')](_0x119764['model'],qs[_0x5374('0x44')](_0x2cc657[_0x5374('0x3f')]['fields']));_0xe9e114[_0x5374('0x43')]=_0xe9e114['attributes']['length']?_0xe9e114[_0x5374('0x43')]:_0x119764[_0x5374('0x3e')];if(!_0x2cc657['query'][_0x5374('0x46')](_0x5374('0x47'))){_0xe9e114[_0x5374('0x29')]=qs[_0x5374('0x29')](_0x2cc657[_0x5374('0x3f')][_0x5374('0x29')]);_0xe9e114[_0x5374('0x27')]=qs[_0x5374('0x27')](_0x2cc657[_0x5374('0x3f')]['offset']);}_0xe9e114[_0x5374('0x48')]=qs['sort'](_0x2cc657[_0x5374('0x3f')][_0x5374('0x49')]);_0xe9e114[_0x5374('0x4c')]=qs['filters'](_['pick'](_0x2cc657[_0x5374('0x3f')],_0x119764[_0x5374('0x41')]));_0xe9e114['where']['SmsAccountId']=_0x5ac071['id'];if(_0x2cc657['query'][_0x5374('0x4b')]){_0xe9e114[_0x5374('0x4c')]=_[_0x5374('0x4d')](_0xe9e114[_0x5374('0x4c')],{'$or':_[_0x5374('0x3a')](_0xe9e114[_0x5374('0x43')],function(_0x4b109d){var _0x1eaf95={};_0x1eaf95[_0x4b109d]={'$like':'%'+_0x2cc657[_0x5374('0x3f')][_0x5374('0x4b')]+'%'};return _0x1eaf95;})});}_0xe9e114=_[_0x5374('0x4d')]({},_0xe9e114,_0x2cc657[_0x5374('0x4e')]);return db[_0x5374('0x68')][_0x5374('0x2a')]({'where':_0xe9e114[_0x5374('0x4c')]})[_0x5374('0x1b')](function(_0x53e2af){_0x114e24[_0x5374('0x2a')]=_0x53e2af;if(_0x2cc657[_0x5374('0x3f')][_0x5374('0x4f')]){_0xe9e114[_0x5374('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5374('0x51')](_0xe9e114);})[_0x5374('0x1b')](function(_0x137645){_0x114e24['rows']=_0x137645;return _0x114e24;});}})['then'](respondWithFilteredResult(_0x25b607,_0xe9e114))['catch'](handleError(_0x25b607,null));};exports[_0x5374('0x6a')]=function(_0xc36543,_0x553082,_0x4ebd4e){return db[_0x5374('0x3b')][_0x5374('0x56')]({'where':{'id':_0xc36543[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x553082,null))['then'](function(_0x1b10f5){if(_0x1b10f5){return _0x1b10f5[_0x5374('0x6a')](_0xc36543['query'][_0x5374('0x66')]);}})[_0x5374('0x1b')](respondWithStatusCode(_0x553082,null))[_0x5374('0x24')](handleError(_0x553082,null));};exports[_0x5374('0x6b')]=function(_0x43739c,_0xd3adef,_0x179326){var _0x5c6f16={'channel':_0x5374('0x6c')};var _0xaad36=[];var _0x3d0e24=[];var _0x4e54d8={};return db['SmsAccount'][_0x5374('0x56')]({'where':{'id':_0x43739c[_0x5374('0x54')]['id']},'include':[{'model':db[_0x5374('0x6d')],'as':_0x5374('0x6e')}]})[_0x5374('0x1b')](handleEntityNotFound(_0xd3adef,null))[_0x5374('0x1b')](function(_0xf49f9a){_0x5c6f16[_0x5374('0x6f')]=_0xf49f9a;_0x5c6f16[_0x5374('0x70')]=_['orderBy'](_0xf49f9a[_0x5374('0x6e')],['priority'],[_0x5374('0x71')]);if(_0x5c6f16[_0x5374('0x6f')][_0x5374('0x6e')]){delete _0x5c6f16['account'][_0x5374('0x6e')];}return db[_0x5374('0x72')]['describe']();})[_0x5374('0x1b')](function(_0x3e5bac){if(!_0x3e5bac){throw new db['Sequelize'][(_0x5374('0x73'))](_0x5374('0x74'));}_0xaad36=_[_0x5374('0x75')](_[_0x5374('0x40')](_0x3e5bac),[_0x5374('0x76'),'updatedAt']);_0x3d0e24=_[_0x5374('0x75')](_[_0x5374('0x40')](_0x3e5bac),[_0x5374('0x76'),_0x5374('0x77'),_0x5374('0x78'),_0x5374('0x79')]);_0x5c6f16[_0x5374('0x58')]={'mapKey':_0x5374('0x7a')};if(_0x5c6f16[_0x5374('0x6f')][_0x5374('0x3d')]){switch(_0x5c6f16[_0x5374('0x6f')][_0x5374('0x3d')]){case _0x5374('0x7b'):_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')]=_0x43739c[_0x5374('0x58')]['From'];_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')]=_0x43739c['body']['Body'];_0x5c6f16[_0x5374('0x58')][_0x5374('0x7d')]=_0x43739c[_0x5374('0x58')]['MessageSid'];break;case _0x5374('0x7e'):_0x5c6f16[_0x5374('0x58')]['from']='+'+_0x43739c[_0x5374('0x58')][_0x5374('0x7f')];_0x5c6f16[_0x5374('0x58')]['body']=_0x43739c[_0x5374('0x58')][_0x5374('0x80')];break;case _0x5374('0x81'):_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')]=_0x43739c[_0x5374('0x58')]['from'];_0x5c6f16['body']['body']=_0x43739c[_0x5374('0x58')][_0x5374('0x22')];break;case _0x5374('0x82'):_0x5c6f16[_0x5374('0x58')]['from']=_0x43739c['body'][_0x5374('0x7c')];_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')]=_0x43739c[_0x5374('0x58')][_0x5374('0x58')];_0x5c6f16[_0x5374('0x58')]['messageId']=_0x43739c['body'][_0x5374('0x83')];break;case'plivo':_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')]=_0x43739c[_0x5374('0x58')][_0x5374('0x84')];_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')]=_0x43739c[_0x5374('0x58')][_0x5374('0x85')];_0x5c6f16[_0x5374('0x58')]['messageId']=_0x43739c[_0x5374('0x58')][_0x5374('0x86')];break;case _0x5374('0x87'):_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')]='+'+_0x43739c['body'][_0x5374('0x88')][0x0][_0x5374('0x7c')];_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')]=_0x43739c[_0x5374('0x58')]['results'][0x0]['text'];_0x5c6f16[_0x5374('0x58')][_0x5374('0x7d')]=_0x43739c[_0x5374('0x58')][_0x5374('0x88')][0x0][_0x5374('0x7d')];break;case _0x5374('0x89'):_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')]=_0x43739c['body'][_0x5374('0x8a')];_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')]=_0x43739c[_0x5374('0x58')][_0x5374('0x8b')][_0x5374('0x22')];break;case _0x5374('0x8c'):_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')]=_0x43739c[_0x5374('0x58')][_0x5374('0x8d')];_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')]=_0x43739c[_0x5374('0x58')]['text'];_0x5c6f16[_0x5374('0x58')][_0x5374('0x7d')]=_0x43739c[_0x5374('0x58')][_0x5374('0x8e')];break;case _0x5374('0x8f'):_0x5c6f16[_0x5374('0x58')][_0x5374('0x7d')]=_0x43739c[_0x5374('0x58')][0x0][_0x5374('0x22')]['id'];_0x5c6f16[_0x5374('0x58')]['from']=_0x43739c[_0x5374('0x58')][0x0][_0x5374('0x22')]['from'];_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')]=_0x43739c[_0x5374('0x58')][0x0][_0x5374('0x22')]['text'];break;case'intelepeer':_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')]=_0x43739c[_0x5374('0x58')][_0x5374('0x7c')];_0x5c6f16[_0x5374('0x58')]['body']=_0x43739c['body'][_0x5374('0x22')];_0x5c6f16[_0x5374('0x58')][_0x5374('0x7d')]=_0x43739c[_0x5374('0x58')]['refid'];break;}}if(_0x5c6f16[_0x5374('0x58')]['id']){delete _0x5c6f16[_0x5374('0x58')]['id'];}if(_[_0x5374('0x90')](_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')])){throw new db[(_0x5374('0x91'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x5374('0x90')](_0x5c6f16['body'][_0x5374('0x58')])||_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')]===''){throw new db[(_0x5374('0x91'))][(_0x5374('0x73'))](_0x5374('0x92'));}if(_[_0x5374('0x90')](_0x5c6f16['body'][_0x5374('0x93')])){throw new db['Sequelize'][(_0x5374('0x73'))](_0x5374('0x94')+_0x3d0e24);}if(!_['includes'](_0x3d0e24,_0x5c6f16[_0x5374('0x58')][_0x5374('0x93')])){throw new db[(_0x5374('0x91'))][(_0x5374('0x73'))](_0x5374('0x95')+_0x3d0e24);}_0x4e54d8[_0x5c6f16[_0x5374('0x58')][_0x5374('0x93')]]=_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')];return db[_0x5374('0x96')][_0x5374('0x56')]({'where':{'id':_0x5c6f16['account'][_0x5374('0x79')]},'include':[{'model':db[_0x5374('0x72')],'as':'Contacts','where':_0x4e54d8,'limit':0x1,'order':[['updatedAt',_0x5374('0x97')]]}]});})[_0x5374('0x1b')](handleEntityNotFound(_0xd3adef,null))[_0x5374('0x1b')](function(_0xa474d0){if(_0xa474d0){_0x5c6f16[_0x5374('0x98')]=_['omit'](_0xa474d0,[_0x5374('0x99')]);if(_0xa474d0[_0x5374('0x99')][_0x5374('0x45')]){return _0xa474d0['Contacts'][0x0];}var _0x2d1698=_['defaults'](_0x5c6f16['body'],{'firstName':_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')],'ListId':_0xa474d0['id']});_0x2d1698[_0x5c6f16['body'][_0x5374('0x93')]]=_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')];return db['CmContact']['create'](_0x2d1698,{'fields':_0xaad36,'raw':!![]});}})[_0x5374('0x1b')](handleEntityNotFound(_0xd3adef,null))['then'](function(_0x32eb7a){if(_0x32eb7a){_0x5c6f16[_0x5374('0x9a')]=_0x32eb7a;var _0x566606={'ContactId':_0x32eb7a['id'],'phone':_0x5c6f16[_0x5374('0x58')][_0x5374('0x7c')],'SmsAccountId':_0x43739c[_0x5374('0x54')]['id']};var _0x2c01a6={'ContactId':_0x32eb7a['id'],'SmsAccountId':_0x43739c[_0x5374('0x54')]['id'],'closed':![]};return db[_0x5374('0x9b')][_0x5374('0x56')]({'where':_0x2c01a6})[_0x5374('0x1b')](function(_0x50c8b4){if(_0x50c8b4){return[_0x50c8b4,![]];}return db['SmsInteraction'][_0x5374('0x57')](_0x566606)[_0x5374('0x1b')](function(_0x78fb84){return[_0x78fb84,!![]];});});}})['spread'](function(_0x24e66a,_0x2e0f3d){_0x5c6f16['interaction']=_0x24e66a['get']({'plain':!![]});_0x5c6f16[_0x5374('0x9c')][_0x5374('0x9d')]=![];if(_0x2e0f3d){if(_0x5c6f16[_0x5374('0x6f')][_0x5374('0x9e')]){_0x5c6f16[_0x5374('0x70')][_0x5374('0x9f')]({'id':0x0,'priority':_0x5c6f16['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x5374('0xa0')});}_0x5c6f16[_0x5374('0x9c')][_0x5374('0x9d')]=!![];}return db[_0x5374('0xa1')][_0x5374('0x57')]({'phone':_0x5c6f16['body']['from'],'messageId':_0x5c6f16['body'][_0x5374('0x7d')],'body':_0x5c6f16[_0x5374('0x58')][_0x5374('0x58')],'SmsAccountId':_0x43739c[_0x5374('0x54')]['id'],'SmsInteractionId':_0x24e66a['id'],'direction':'in','ContactId':_0x24e66a[_0x5374('0xa2')],'AttachmentId':_0x5c6f16[_0x5374('0x58')][_0x5374('0xa3')]});})[_0x5374('0x1b')](function(_0x24f4d7){_0x5c6f16[_0x5374('0x22')]=_0x24f4d7;if(!_0x5c6f16[_0x5374('0x9c')][_0x5374('0xa4')])return;return db[_0x5374('0xa5')][_0x5374('0x56')]({'attributes':['id',_0x5374('0x36')],'where':{'id':_0x5c6f16['interaction']['UserId']}});})['then'](function(_0x16324c){if(_0x16324c){_0x5c6f16[_0x5374('0x70')][_0x5374('0xa6')]({'id':0x0,'priority':0x0,'app':_0x5374('0xa7'),'appdata':_0x16324c['name']+','+(_0x5c6f16[_0x5374('0x6f')]['waitForTheAssignedAgent']||0xa),'interval':_0x5374('0xa0')});}if(!_0x5c6f16[_0x5374('0x9c')][_0x5374('0xa8')])return;return db[_0x5374('0xa9')]['find']({'attributes':['id',_0x5374('0x36')],'where':{'id':_0x5c6f16[_0x5374('0x9c')]['queueId']}});})[_0x5374('0x1b')](function(_0x30e28a){if(_0x30e28a){_0x5c6f16['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x5374('0xaa'),'appdata':_0x30e28a['name']+','+(_0x5c6f16[_0x5374('0x6f')][_0x5374('0xab')]||0x12c),'interval':_0x5374('0xa0')});}return respondWithRpcPromise(_0x5374('0xac'),_0x5374('0xad'),_0x5c6f16);})['then'](function(_0x1c28a1){if(_0x1c28a1){var _0x3cb999=0xc8;var _0x458285='receiveMessage';logger[_0x5374('0x1c')](_0x5374('0xae'),_0x458285,_0x3cb999,_0x5374('0xaf'));logger[_0x5374('0xb0')](_0x5374('0xb1'),_0x458285,_0x3cb999,_0x5374('0xaf'),JSON[_0x5374('0x1f')](_0x1c28a1));if(_0x5c6f16[_0x5374('0x6f')]['type']===_0x5374('0x7b')){return _0xd3adef[_0x5374('0x26')](_0x3cb999)['set'](_0x5374('0xb2'),'text/xml')[_0x5374('0x37')](_0x5374('0xb3'));}else{return _0xd3adef[_0x5374('0x26')](_0x3cb999)[_0x5374('0x2c')](_0x1c28a1);}}})['catch'](handleError(_0xd3adef,null));};exports[_0x5374('0xb4')]=function(_0x2d6d64,_0x40e436){var _0x512fd8=_0x2d6d64[_0x5374('0x54')]['id'];var _0x4e8014=_0x2d6d64[_0x5374('0x58')];var _0xd6549e=0xc8;var _0x15de0f=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x5374('0xb5')][_0x5374('0xb6')][_0x5374('0xb7')][_0x5374('0xb8')]},function(_0x1de7bd){return db[_0x5374('0x3b')][_0x5374('0x64')]({'where':{'id':_0x512fd8},'transaction':_0x1de7bd})[_0x5374('0x1b')](function(_0x28c31a){if(_0x28c31a){return db[_0x5374('0x6d')]['destroy']({'where':{'SmsAccountId':_0x512fd8},'transaction':_0x1de7bd})[_0x5374('0x1b')](function(){var _0x2a46ba=_[_0x5374('0x3a')](_0x4e8014,function(_0x1fdbc7){_0x1fdbc7[_0x5374('0x61')]=_0x512fd8;return _0x1fdbc7;});return db[_0x5374('0x6d')][_0x5374('0xb9')](_0x2a46ba,{'transaction':_0x1de7bd});});}else{_0xd6549e=0x194;_0x15de0f=[];}});})[_0x5374('0x1b')](function(){if(_0xd6549e!==0x194){return db[_0x5374('0x6d')]['findAndCountAll']({'where':{'SmsAccountId':_0x512fd8},'order':_0x5374('0xba')})[_0x5374('0x1b')](function(_0x1dceed){_0x15de0f=_0x1dceed;});}})[_0x5374('0x24')](function(_0x1eca51){_0xd6549e=0x1f4;logger[_0x5374('0x20')](_0x1eca51[_0x5374('0x35')]);if(_0x1eca51[_0x5374('0x36')]){delete _0x1eca51['name'];}_0x15de0f=_0x1eca51;})[_0x5374('0xbb')](function(){if(_0x15de0f===null){_0x40e436[_0x5374('0x34')](_0xd6549e);}else{if(_0xd6549e===0x1f4){_0x40e436[_0x5374('0x26')](_0xd6549e)['send'](_0x15de0f);}else{_0x40e436[_0x5374('0x26')](_0xd6549e)[_0x5374('0x2c')](_0x15de0f);}}});};exports[_0x5374('0xbc')]=function(_0x95c2c5,_0x154cc9,_0x4f2f00){var _0x1bb569={};var _0x311f86={};var _0x4b62c0;var _0x12bcbe;return db['SmsAccount'][_0x5374('0x64')]({'where':{'id':_0x95c2c5[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x154cc9,null))[_0x5374('0x1b')](function(_0x10bc49){if(_0x10bc49){_0x4b62c0=_0x10bc49;_0x311f86[_0x5374('0x3e')]=_[_0x5374('0x40')](db[_0x5374('0x6d')]['rawAttributes']);_0x311f86[_0x5374('0x3f')]=_[_0x5374('0x40')](_0x95c2c5['query']);_0x311f86[_0x5374('0x41')]=_[_0x5374('0x42')](_0x311f86[_0x5374('0x3e')],_0x311f86['query']);_0x1bb569[_0x5374('0x43')]=_[_0x5374('0x42')](_0x311f86[_0x5374('0x3e')],qs[_0x5374('0x44')](_0x95c2c5[_0x5374('0x3f')][_0x5374('0x44')]));_0x1bb569[_0x5374('0x43')]=_0x1bb569['attributes'][_0x5374('0x45')]?_0x1bb569['attributes']:_0x311f86[_0x5374('0x3e')];_0x1bb569['order']=qs['sort'](_0x95c2c5['query'][_0x5374('0x49')]);_0x1bb569[_0x5374('0x4c')]=qs[_0x5374('0x41')](_[_0x5374('0x4a')](_0x95c2c5[_0x5374('0x3f')],_0x311f86[_0x5374('0x41')]));if(_0x95c2c5[_0x5374('0x3f')][_0x5374('0x4b')]){_0x1bb569[_0x5374('0x4c')]=_[_0x5374('0x4d')](_0x1bb569[_0x5374('0x4c')],{'$or':_['map'](_0x1bb569[_0x5374('0x43')],function(_0x261aae){var _0x27517f={};_0x27517f[_0x261aae]={'$like':'%'+_0x95c2c5['query'][_0x5374('0x4b')]+'%'};return _0x27517f;})});}_0x1bb569=_[_0x5374('0x4d')]({},_0x1bb569,_0x95c2c5['options']);return _0x4b62c0[_0x5374('0xbc')](_0x1bb569);}})[_0x5374('0x1b')](function(_0x1fc344){if(_0x1fc344){_0x12bcbe=_0x1fc344[_0x5374('0x45')];if(!_0x95c2c5[_0x5374('0x3f')][_0x5374('0x46')]('nolimit')){_0x1bb569['limit']=qs[_0x5374('0x29')](_0x95c2c5[_0x5374('0x3f')]['limit']);_0x1bb569['offset']=qs[_0x5374('0x27')](_0x95c2c5[_0x5374('0x3f')]['offset']);}return _0x4b62c0['getApplications'](_0x1bb569);}})[_0x5374('0x1b')](function(_0x378a77){if(_0x378a77){return _0x378a77?{'count':_0x12bcbe,'rows':_0x378a77}:null;}})[_0x5374('0x1b')](respondWithResult(_0x154cc9,null))[_0x5374('0x24')](handleError(_0x154cc9,null));};exports[_0x5374('0xbd')]=function(_0x501e8c,_0x1628e3,_0x31a2d8){var _0x9ccd34={'raw':![],'where':{}};var _0x45d503={};var _0x159f4d={'count':0x0,'rows':[]};return db[_0x5374('0x3b')]['findOne']({'where':{'id':_0x501e8c['params']['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x1628e3,null))[_0x5374('0x1b')](function(_0x1be57f){if(_0x1be57f){_0x45d503[_0x5374('0x3e')]=_[_0x5374('0x40')](db[_0x5374('0x9b')]['rawAttributes']);_0x45d503['query']=_[_0x5374('0x40')](_0x501e8c['query']);_0x45d503[_0x5374('0x41')]=_['intersection'](_0x45d503[_0x5374('0x3e')],_0x45d503['query']);_0x9ccd34[_0x5374('0x43')]=_[_0x5374('0x42')](_0x45d503[_0x5374('0x3e')],qs[_0x5374('0x44')](_0x501e8c[_0x5374('0x3f')][_0x5374('0x44')]));_0x9ccd34[_0x5374('0x43')]=_0x9ccd34[_0x5374('0x43')][_0x5374('0x45')]?_0x9ccd34[_0x5374('0x43')]:_0x45d503['model'];if(!_0x501e8c[_0x5374('0x3f')][_0x5374('0x46')]('nolimit')){_0x9ccd34[_0x5374('0x29')]=qs[_0x5374('0x29')](_0x501e8c[_0x5374('0x3f')][_0x5374('0x29')]);_0x9ccd34[_0x5374('0x27')]=qs[_0x5374('0x27')](_0x501e8c[_0x5374('0x3f')][_0x5374('0x27')]);}_0x9ccd34[_0x5374('0x48')]=qs[_0x5374('0x49')](_0x501e8c[_0x5374('0x3f')][_0x5374('0x49')]);_0x9ccd34[_0x5374('0x4c')]=qs['filters'](_[_0x5374('0x4a')](_0x501e8c['query'],_0x45d503[_0x5374('0x41')]));_0x9ccd34[_0x5374('0x4c')][_0x5374('0x61')]=_0x1be57f['id'];if(_0x501e8c['query'][_0x5374('0x4b')]){_0x9ccd34['where']=_[_0x5374('0x4d')](_0x9ccd34[_0x5374('0x4c')],{'$or':_[_0x5374('0x3a')](_0x9ccd34[_0x5374('0x43')],function(_0x1f3db8){var _0x4eaea7={};_0x4eaea7[_0x1f3db8]={'$like':'%'+_0x501e8c[_0x5374('0x3f')][_0x5374('0x4b')]+'%'};return _0x4eaea7;})});}_0x9ccd34=_[_0x5374('0x4d')]({},_0x9ccd34,_0x501e8c['options']);return db[_0x5374('0x9b')]['count']({'where':_0x9ccd34[_0x5374('0x4c')]})[_0x5374('0x1b')](function(_0x38cf6f){_0x159f4d[_0x5374('0x2a')]=_0x38cf6f;if(_0x501e8c['query'][_0x5374('0x4f')]){_0x9ccd34[_0x5374('0x50')]=[{'model':db[_0x5374('0x72')],'as':_0x5374('0xbe'),'required':![]},{'model':db['User'],'as':_0x5374('0xbf'),'attributes':[_0x5374('0x36'),_0x5374('0xc0'),_0x5374('0xc1')],'required':![]},{'model':db['Tag'],'as':_0x5374('0xc2'),'attributes':['id','name',_0x5374('0xc3')],'where':_0x501e8c[_0x5374('0x3f')][_0x5374('0xc4')]?{'id':_0x501e8c[_0x5374('0x3f')]['tag']}:undefined,'required':_0x501e8c[_0x5374('0x3f')][_0x5374('0xc4')]?!![]:![]}];}return db['SmsInteraction'][_0x5374('0x51')](_0x9ccd34);})[_0x5374('0x1b')](function(_0x57338d){_0x159f4d[_0x5374('0x52')]=_0x57338d;return _0x159f4d;});}})[_0x5374('0x1b')](respondWithFilteredResult(_0x1628e3,_0x9ccd34))['catch'](handleError(_0x1628e3,null));};exports['send']=function(_0x1c819d,_0xc05c13,_0x552657){var _0x4a734d,_0x4014f8,_0x3ebddc;if(_[_0x5374('0x90')](_0x1c819d[_0x5374('0x58')]['body'])||_0x1c819d[_0x5374('0x58')][_0x5374('0x58')]===''){throw new db[(_0x5374('0x91'))][(_0x5374('0x73'))](_0x5374('0x92'));}if(_[_0x5374('0x90')](_0x1c819d['body']['to'])){throw new db[(_0x5374('0x91'))]['ValidationError'](_0x5374('0xc5'));}_0x4a734d=_0x1c819d[_0x5374('0x58')]['to'];return db[_0x5374('0x3b')][_0x5374('0x56')]({'where':{'id':_0x1c819d[_0x5374('0x54')]['id']},'include':[{'model':db[_0x5374('0x96')],'as':'List','include':[{'model':db[_0x5374('0x72')],'as':'Contacts','where':{'mobile':_0x4a734d},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0xc05c13,null))['then'](function(_0x1a7738){if(_0x1a7738&&_0x1a7738['List']){_0x4014f8=_0x1a7738[_0x5374('0x31')]({'plain':!![]});if(_0x4014f8[_0x5374('0xc6')]&&_0x4014f8[_0x5374('0xc6')][_0x5374('0x99')][_0x5374('0x45')]){return _0x4014f8['List']['Contacts'][0x0];}return db[_0x5374('0x72')]['create'](_[_0x5374('0x14')](_0x1c819d[_0x5374('0x58')],{'firstName':_0x4a734d,'mobile':_0x4a734d,'phone':_0x4a734d,'ListId':_0x4014f8[_0x5374('0x79')]}));}})['then'](handleEntityNotFound(_0xc05c13,null))['then'](function(_0x29b9af){if(_0x29b9af){_0x3ebddc=_0x29b9af;return db['SmsInteraction']['find']({'where':{'ContactId':_0x3ebddc['id'],'closed':![],'SmsAccountId':_0x4014f8['id']}})['then'](function(_0x4dbc58){if(_0x4dbc58){return[_0x4dbc58,![]];}return db[_0x5374('0x9b')][_0x5374('0x57')]({'UserId':_0x1c819d[_0x5374('0x59')]['id'],'ContactId':_0x3ebddc['id'],'SmsAccountId':_0x4014f8['id'],'phone':_0x4a734d,'firstMsgDirection':_0x5374('0xc7'),'Messages':[_[_0x5374('0x4d')](_0x1c819d[_0x5374('0x58')],{'read':![],'body':_0x1c819d[_0x5374('0x58')][_0x5374('0x58')],'phone':_0x4a734d,'SmsAccountId':_0x4014f8['id'],'UserId':_0x1c819d['user']['id'],'ContactId':_0x3ebddc['id']})]},{'include':[{'model':db[_0x5374('0xa1')],'as':'Messages'}]})['then'](function(_0x2be4ae){return[_0x2be4ae,!![]];});});}})['spread'](function(_0x1d7f8e,_0x10d5a3){if(_0x10d5a3){return _0x1d7f8e;}return db['SmsMessage'][_0x5374('0x57')](_['merge'](_0x1c819d[_0x5374('0x58')],{'read':![],'body':_0x1c819d[_0x5374('0x58')][_0x5374('0x58')],'phone':_0x4a734d,'SmsAccountId':_0x4014f8['id'],'SmsInteractionId':_0x1d7f8e['id'],'UserId':_0x1c819d['user']['id'],'ContactId':_0x3ebddc['id']}))[_0x5374('0x1b')](function(_0x4abef5){_0x1d7f8e[_0x5374('0xc8')][_0x5374('0xc9')]=[];_0x1d7f8e[_0x5374('0xc8')][_0x5374('0xc9')][_0x5374('0x9f')](_0x4abef5['dataValues']);return _0x1d7f8e;});})[_0x5374('0x1b')](respondWithResult(_0xc05c13,null))[_0x5374('0x24')](handleError(_0xc05c13,null));};exports[_0x5374('0x26')]=function(_0x4a8891,_0x5c03f5,_0x17afaf){if(_0x4a8891[_0x5374('0x58')]['id']){delete _0x4a8891[_0x5374('0x58')]['id'];}var _0x3dc6bc,_0x37663e,_0x462ce0;return db['SmsAccount']['find']({'where':{'id':_0x4a8891[_0x5374('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c03f5,null))[_0x5374('0x1b')](function(_0x37c046){if(_0x37c046){_0x462ce0=_0x37c046;logger[_0x5374('0xb0')](_0x5374('0xae'),_0x5374('0x26'),'received\x20delivery\x20report\x20from',_0x37c046[_0x5374('0x3d')],util[_0x5374('0xca')](_0x4a8891[_0x5374('0x58')],{'showHidden':![],'depth':null}));switch(_0x37c046[_0x5374('0x3d')]){case _0x5374('0x7e'):if(_0x4a8891[_0x5374('0x58')]['skebby_dispatch_id']&&_0x4a8891[_0x5374('0x58')][_0x5374('0x26')]){_0x37663e=_0x4a8891[_0x5374('0x58')][_0x5374('0x26')];return db[_0x5374('0xa1')][_0x5374('0x56')]({'where':{'messageId':_0x4a8891[_0x5374('0x58')][_0x5374('0xcb')]}});}break;case'connectel':if(_0x4a8891[_0x5374('0x58')][_0x5374('0xcc')]&&_0x4a8891['body'][_0x5374('0xcd')]){_0x37663e=_0x4a8891['body'][_0x5374('0xcd')];return db[_0x5374('0xa1')][_0x5374('0x56')]({'where':{'messageId':_0x4a8891[_0x5374('0x58')][_0x5374('0xcc')]}});}break;case _0x5374('0x82'):if(_0x4a8891['body'][_0x5374('0x83')]&&_0x4a8891[_0x5374('0x58')][_0x5374('0xce')]){_0x37663e=_0x4a8891[_0x5374('0x58')][_0x5374('0xce')];return db[_0x5374('0xa1')][_0x5374('0x56')]({'where':{'messageId':_0x4a8891[_0x5374('0x58')][_0x5374('0x83')]}});}break;case'infobip':var _0x1743ad=_0x4a8891[_0x5374('0x58')][_0x5374('0x88')][0x0];if(_0x1743ad[_0x5374('0x7d')]&&_0x1743ad[_0x5374('0x26')][_0x5374('0xcf')]===_0x5374('0xd0')){_0x37663e=_0x1743ad[_0x5374('0x26')][_0x5374('0xcf')];return db[_0x5374('0xa1')]['find']({'where':{'messageId':_0x1743ad[_0x5374('0x7d')]}});}break;case _0x5374('0x8c'):if(_0x4a8891[_0x5374('0x58')][_0x5374('0x7d')]&&_0x4a8891[_0x5374('0x58')][_0x5374('0x26')]){_0x37663e=_0x4a8891[_0x5374('0x58')][_0x5374('0x26')];return db[_0x5374('0xa1')][_0x5374('0x56')]({'where':{'messageId':_0x4a8891[_0x5374('0x58')][_0x5374('0x7d')]}});}break;case _0x5374('0x8f'):if(_0x4a8891[_0x5374('0x58')][0x0][_0x5374('0x22')]['id']){_0x37663e=_0x4a8891[_0x5374('0x58')][0x0][_0x5374('0x3d')];return db[_0x5374('0xa1')][_0x5374('0x56')]({'where':{'messageId':_0x4a8891[_0x5374('0x58')][0x0]['message']['id']}});}break;case _0x5374('0xd1'):if(_0x4a8891[_0x5374('0x58')][_0x5374('0xd2')]&&_0x4a8891[_0x5374('0x58')][_0x5374('0x26')]){_0x37663e=_0x4a8891['body'][_0x5374('0x26')];return db['SmsMessage']['find']({'where':{'messageId':_0x4a8891[_0x5374('0x58')][_0x5374('0xd2')]}});}break;}}})[_0x5374('0x1b')](handleEntityNotFound(_0x5c03f5,null))[_0x5374('0x1b')](function(_0x2a4cba){if(_0x2a4cba){_0x3dc6bc=_0x2a4cba;switch(_0x462ce0['type']){case _0x5374('0x7e'):if(_0x37663e===_0x5374('0xd0')){return _0x3dc6bc[_0x5374('0x2f')]({'read':!![]});}else{logger[_0x5374('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5374('0x26'),_0x5374('0x7e'),util[_0x5374('0xca')](_0x4a8891[_0x5374('0x58')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x37663e==='1'){return _0x3dc6bc['update']({'read':!![]});}else{logger[_0x5374('0x20')](_0x5374('0xae'),_0x5374('0x26'),_0x5374('0x7e'),util['inspect'](_0x4a8891[_0x5374('0x58')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4a8891['body'][_0x5374('0xd3')]&&_0x37663e>=0xc8&&_0x37663e<=0xce){return _0x3dc6bc[_0x5374('0x2f')]({'read':!![]});}else{logger[_0x5374('0x20')](_0x5374('0xae'),'status',_0x5374('0x82'),util[_0x5374('0xca')](_0x4a8891[_0x5374('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5374('0x87'):var _0x7c6616=_0x4a8891['body'][_0x5374('0x88')][0x0];if(_0x7c6616['status'][_0x5374('0xcf')]==='DELIVERED'){return _0x3dc6bc[_0x5374('0x2f')]({'read':!![]});}else{logger[_0x5374('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5374('0x26'),_0x5374('0x87'),util[_0x5374('0xca')](_0x4a8891['body'],{'showHidden':![],'depth':null}));}break;case _0x5374('0x8c'):if(_0x37663e==_0x5374('0xd4')||_0x37663e=='RECEIVED_BY_RECIPIENT'){return _0x3dc6bc['update']({'read':!![]});}else{logger[_0x5374('0x20')](_0x5374('0xae'),_0x5374('0x26'),_0x5374('0x8c'),util[_0x5374('0xca')](_0x4a8891['body'],{'showHidden':![],'depth':null}));}break;case _0x5374('0x8f'):if(_0x37663e==_0x5374('0xd5')){return _0x3dc6bc['update']({'read':!![]});}else{logger[_0x5374('0x20')](_0x5374('0xae'),_0x5374('0x26'),_0x5374('0x8f'),util[_0x5374('0xca')](_0x4a8891[_0x5374('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5374('0xd1'):if(_0x37663e===_0x5374('0xd6')||_0x37663e===_0x5374('0xd7')){return _0x3dc6bc[_0x5374('0x2f')]({'read':!![]});}else{logger[_0x5374('0x20')](_0x5374('0xae'),_0x5374('0x26'),'intelepeer',util[_0x5374('0xca')](_0x4a8891[_0x5374('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3dc6bc;}})[_0x5374('0x1b')](respondWithResult(_0x5c03f5,null))['catch'](handleError(_0x5c03f5,null));};exports['statusGet']=function(_0xd574e8,_0x4de23b,_0xb4fd93){var _0x2e09d4,_0x333664,_0x4263e8;return db['SmsAccount']['find']({'where':{'id':_0xd574e8[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x4de23b,null))[_0x5374('0x1b')](function(_0xf43ad0){if(_0xf43ad0){_0x4263e8=_0xf43ad0;logger[_0x5374('0xb0')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5374('0x26'),'received\x20delivery\x20report\x20from',_0xf43ad0[_0x5374('0x3d')],util['inspect'](_0xd574e8[_0x5374('0x3f')],{'showHidden':![],'depth':null}));switch(_0xf43ad0[_0x5374('0x3d')]){case _0x5374('0x89'):if(_0xd574e8['query'][_0x5374('0xd8')]&&_0xd574e8[_0x5374('0x3f')][_0x5374('0xd9')]){_0x333664=_0xd574e8[_0x5374('0x3f')][_0x5374('0xd9')];return db[_0x5374('0xa1')][_0x5374('0x56')]({'where':{'messageId':_0xd574e8[_0x5374('0x3f')][_0x5374('0xd8')]}});}break;}}})[_0x5374('0x1b')](handleEntityNotFound(_0x4de23b,null))['then'](function(_0x3ec245){if(_0x3ec245){_0x2e09d4=_0x3ec245;switch(_0x4263e8[_0x5374('0x3d')]){case _0x5374('0x89'):if(_0x333664==='2'||_0x333664==='6'){return _0x2e09d4[_0x5374('0x2f')]({'read':!![]});}else{logger[_0x5374('0x20')](_0x5374('0xae'),_0x5374('0x26'),_0x5374('0x89'),util['inspect'](_0xd574e8['query'],{'showHidden':![],'depth':null}));};break;}return _0x2e09d4;}})[_0x5374('0x1b')](respondWithResult(_0x4de23b,null))['catch'](handleError(_0x4de23b,null));};exports[_0x5374('0xda')]=function(_0x1b02bc,_0x44e63b,_0x33d73d){return db[_0x5374('0x3b')][_0x5374('0x56')]({'where':{'id':_0x1b02bc[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x44e63b,null))['then'](function(_0x546c68){if(_0x546c68){return _0x546c68[_0x5374('0xda')](_0x1b02bc[_0x5374('0x58')][_0x5374('0x66')],_[_0x5374('0xdb')](_0x1b02bc[_0x5374('0x58')],[_0x5374('0x66'),'id'])||{})['spread'](function(_0x3b22a1){for(var _0x419e57=0x0;_0x419e57<_0x1b02bc[_0x5374('0x58')][_0x5374('0x66')]['length'];_0x419e57+=0x1){socket[_0x5374('0xdc')]('userSmsAccount:save',{'UserId':Number(_0x1b02bc[_0x5374('0x58')]['ids'][_0x419e57]),'SmsAccountId':Number(_0x1b02bc[_0x5374('0x54')]['id'])});}return _0x3b22a1;});}})[_0x5374('0x1b')](respondWithResult(_0x44e63b,null))[_0x5374('0x24')](handleError(_0x44e63b,null));};exports[_0x5374('0xdd')]=function(_0x517013,_0x2b6ab2,_0x2ed5ac){return db[_0x5374('0x3b')][_0x5374('0x56')]({'where':{'id':_0x517013[_0x5374('0x54')]['id']}})[_0x5374('0x1b')](handleEntityNotFound(_0x2b6ab2,null))[_0x5374('0x1b')](function(_0xac3736){if(_0xac3736){return _0xac3736[_0x5374('0xdd')](_0x517013[_0x5374('0x3f')][_0x5374('0x66')])[_0x5374('0x1b')](function(){if(_['isArray'](_0x517013[_0x5374('0x3f')][_0x5374('0x66')])){for(var _0x1a42de=0x0;_0x1a42de<_0x517013['query'][_0x5374('0x66')]['length'];_0x1a42de+=0x1){socket[_0x5374('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x517013['query']['ids'][_0x1a42de]),'SmsAccountId':Number(_0x517013[_0x5374('0x54')]['id'])});}}else{socket[_0x5374('0xdc')](_0x5374('0xde'),{'UserId':Number(_0x517013['query'][_0x5374('0x66')]),'SmsAccountId':Number(_0x517013[_0x5374('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b6ab2,null))['catch'](handleError(_0x2b6ab2,null));};exports[_0x5374('0xdf')]=function(_0x341b3a,_0x48a5de,_0x5409a9){var _0x435a5e={};var _0x5bc63f={};var _0x5d8141;var _0x28ba4c;return db[_0x5374('0x3b')][_0x5374('0x64')]({'where':{'id':_0x341b3a['params']['id']}})['then'](handleEntityNotFound(_0x48a5de,null))[_0x5374('0x1b')](function(_0x32955b){if(_0x32955b){_0x5d8141=_0x32955b;_0x5bc63f[_0x5374('0x3e')]=_['keys'](db[_0x5374('0xa5')][_0x5374('0x3c')]);_0x5bc63f[_0x5374('0x3f')]=_[_0x5374('0x40')](_0x341b3a[_0x5374('0x3f')]);_0x5bc63f['filters']=_[_0x5374('0x42')](_0x5bc63f['model'],_0x5bc63f['query']);_0x435a5e[_0x5374('0x43')]=_[_0x5374('0x42')](_0x5bc63f[_0x5374('0x3e')],qs[_0x5374('0x44')](_0x341b3a[_0x5374('0x3f')][_0x5374('0x44')]));_0x435a5e[_0x5374('0x43')]=_0x435a5e[_0x5374('0x43')][_0x5374('0x45')]?_0x435a5e['attributes']:_0x5bc63f[_0x5374('0x3e')];_0x435a5e[_0x5374('0x48')]=qs[_0x5374('0x49')](_0x341b3a['query'][_0x5374('0x49')]);_0x435a5e[_0x5374('0x4c')]=qs[_0x5374('0x41')](_['pick'](_0x341b3a[_0x5374('0x3f')],_0x5bc63f[_0x5374('0x41')]));if(_0x341b3a['query'][_0x5374('0x4b')]){_0x435a5e[_0x5374('0x4c')]=_[_0x5374('0x4d')](_0x435a5e['where'],{'$or':_['map'](_0x435a5e[_0x5374('0x43')],function(_0x33a37c){var _0x42ac4b={};_0x42ac4b[_0x33a37c]={'$like':'%'+_0x341b3a[_0x5374('0x3f')]['filter']+'%'};return _0x42ac4b;})});}_0x435a5e=_[_0x5374('0x4d')]({},_0x435a5e,_0x341b3a['options']);return _0x5d8141['getAgents'](_0x435a5e);}})[_0x5374('0x1b')](function(_0x88563e){if(_0x88563e){_0x28ba4c=_0x88563e[_0x5374('0x45')];if(!_0x341b3a['query']['hasOwnProperty'](_0x5374('0x47'))){_0x435a5e[_0x5374('0x29')]=qs[_0x5374('0x29')](_0x341b3a[_0x5374('0x3f')][_0x5374('0x29')]);_0x435a5e[_0x5374('0x27')]=qs[_0x5374('0x27')](_0x341b3a['query'][_0x5374('0x27')]);}return _0x5d8141[_0x5374('0xdf')](_0x435a5e);}})[_0x5374('0x1b')](function(_0x1c2798){if(_0x1c2798){return _0x1c2798?{'count':_0x28ba4c,'rows':_0x1c2798}:null;}})[_0x5374('0x1b')](respondWithResult(_0x48a5de,null))[_0x5374('0x24')](handleError(_0x48a5de,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 190ec69..6a57637 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 _0x827d=['remove','emit','hasOwnProperty','exports','events','SmsAccount','save'];(function(_0x14032f,_0x5bf7b4){var _0x54a14d=function(_0x2752ad){while(--_0x2752ad){_0x14032f['push'](_0x14032f['shift']());}};_0x54a14d(++_0x5bf7b4);}(_0x827d,0x100));var _0xd827=function(_0x5e9155,_0x42b68b){_0x5e9155=_0x5e9155-0x0;var _0x5d7b6f=_0x827d[_0x5e9155];return _0x5d7b6f;};'use strict';var EventEmitter=require(_0xd827('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xd827('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd827('0x2'),'afterUpdate':'update','afterDestroy':_0xd827('0x3')};function emitEvent(_0x3a273c){return function(_0x347a4a,_0x339a96,_0x4545f1){SmsAccountEvents[_0xd827('0x4')](_0x3a273c+':'+_0x347a4a['id'],_0x347a4a);SmsAccountEvents[_0xd827('0x4')](_0x3a273c,_0x347a4a);_0x4545f1(null);};}for(var e in events){if(events[_0xd827('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xd827('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xba21=['exports','events','../../mysqldb','SmsAccount','save','update','remove','emit','hook'];(function(_0x40c5f0,_0x3ccd28){var _0x215d61=function(_0x48defe){while(--_0x48defe){_0x40c5f0['push'](_0x40c5f0['shift']());}};_0x215d61(++_0x3ccd28);}(_0xba21,0xf4));var _0x1ba2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xba21[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x1ba2('0x0'));var SmsAccount=require(_0x1ba2('0x1'))['db'][_0x1ba2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ba2('0x3'),'afterUpdate':_0x1ba2('0x4'),'afterDestroy':_0x1ba2('0x5')};function emitEvent(_0x54209d){return function(_0x279054,_0x588adb,_0x572993){SmsAccountEvents['emit'](_0x54209d+':'+_0x279054['id'],_0x279054);SmsAccountEvents[_0x1ba2('0x6')](_0x54209d,_0x279054);_0x572993(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x1ba2('0x7')](e,emitEvent(event));}}module[_0x1ba2('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3638441..57cc87c 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 _0x77bd=['SmsAccount','sms_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x588eb8,_0x312f67){var _0x418413=function(_0x1f586b){while(--_0x1f586b){_0x588eb8['push'](_0x588eb8['shift']());}};_0x418413(++_0x312f67);}(_0x77bd,0x19a));var _0xd77b=function(_0x4ddfe1,_0x35939d){_0x4ddfe1=_0x4ddfe1-0x0;var _0x4aaf51=_0x77bd[_0x4ddfe1];return _0x4aaf51;};'use strict';var _=require(_0xd77b('0x0'));var util=require('util');var logger=require(_0xd77b('0x1'))(_0xd77b('0x2'));var moment=require('moment');var BPromise=require(_0xd77b('0x3'));var rp=require(_0xd77b('0x4'));var fs=require('fs');var path=require(_0xd77b('0x5'));var rimraf=require(_0xd77b('0x6'));var config=require(_0xd77b('0x7'));var attributes=require('./smsAccount.attributes');module[_0xd77b('0x8')]=function(_0x52ad27,_0x51ac71){return _0x52ad27[_0xd77b('0x9')](_0xd77b('0xa'),attributes,{'tableName':_0xd77b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c52=['./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x465e46,_0x325a55){var _0x210296=function(_0x1080e7){while(--_0x1080e7){_0x465e46['push'](_0x465e46['shift']());}};_0x210296(++_0x325a55);}(_0x5c52,0x1d0));var _0x25c5=function(_0x231c4d,_0x514bfe){_0x231c4d=_0x231c4d-0x0;var _0x1458fe=_0x5c52[_0x231c4d];return _0x1458fe;};'use strict';var _=require(_0x25c5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x25c5('0x1'));var moment=require(_0x25c5('0x2'));var BPromise=require(_0x25c5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25c5('0x4'));var rimraf=require('rimraf');var config=require(_0x25c5('0x5'));var attributes=require(_0x25c5('0x6'));module[_0x25c5('0x7')]=function(_0x57eb72,_0x4b4a9d){return _0x57eb72['define'](_0x25c5('0x8'),attributes,{'tableName':_0x25c5('0x9'),'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 395e488..49724d8 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 _0xa558=['code','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','model','map','debug','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xa558,0xc7));var _0x8a55=function(_0x464e08,_0x5dc896){_0x464e08=_0x464e08-0x0;var _0x4c180f=_0xa558[_0x464e08];return _0x4c180f;};'use strict';var _=require(_0x8a55('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a55('0x1'));var rs=require(_0x8a55('0x2'));var fs=require('fs');var Redis=require(_0x8a55('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a55('0x4'));var logger=require(_0x8a55('0x5'))(_0x8a55('0x6'));var config=require(_0x8a55('0x7'));var jayson=require(_0x8a55('0x8'));var client=jayson['client'][_0x8a55('0x9')]({'port':0x232a});config[_0x8a55('0xa')]=_[_0x8a55('0xb')](config[_0x8a55('0xa')],{'host':_0x8a55('0xc'),'port':0x18eb});var socket=require(_0x8a55('0xd'))(new Redis(config[_0x8a55('0xa')]));require(_0x8a55('0xe'))[_0x8a55('0xf')](socket);function respondWithRpcPromise(_0x320253,_0x5e8a58,_0x47b27a){return new BPromise(function(_0x531ca2,_0x1848f5){return client['request'](_0x320253,_0x47b27a)[_0x8a55('0x10')](function(_0x4a69e2){logger[_0x8a55('0x11')](_0x8a55('0x12'),_0x5e8a58,_0x8a55('0x13'));logger['debug'](_0x8a55('0x14'),_0x5e8a58,'request\x20sent',JSON[_0x8a55('0x15')](_0x4a69e2));if(_0x4a69e2[_0x8a55('0x16')]){if(_0x4a69e2['error'][_0x8a55('0x17')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5e8a58,_0x4a69e2[_0x8a55('0x16')][_0x8a55('0x18')]);return _0x1848f5(_0x4a69e2[_0x8a55('0x16')]['message']);}logger[_0x8a55('0x16')](_0x8a55('0x12'),_0x5e8a58,_0x4a69e2[_0x8a55('0x16')][_0x8a55('0x18')]);return _0x531ca2(_0x4a69e2[_0x8a55('0x16')]['message']);}else{logger[_0x8a55('0x11')](_0x8a55('0x12'),_0x5e8a58,_0x8a55('0x13'));_0x531ca2(_0x4a69e2[_0x8a55('0x19')][_0x8a55('0x18')]);}})[_0x8a55('0x1a')](function(_0x1a3f5f){logger[_0x8a55('0x16')](_0x8a55('0x12'),_0x5e8a58,_0x1a3f5f);_0x1848f5(_0x1a3f5f);});});}exports[_0x8a55('0x1b')]=function(_0x5fc830){var _0x454dc5=this;return new Promise(function(_0x448256,_0x44a170){return db['SmsAccount'][_0x8a55('0x1c')]({'raw':_0x5fc830[_0x8a55('0x1d')]?_0x5fc830['options'][_0x8a55('0x1e')]===undefined?!![]:![]:!![],'where':_0x5fc830[_0x8a55('0x1d')]?_0x5fc830[_0x8a55('0x1d')][_0x8a55('0x1f')]||null:null,'attributes':_0x5fc830[_0x8a55('0x1d')]?_0x5fc830[_0x8a55('0x1d')][_0x8a55('0x20')]||null:null,'include':_0x5fc830['options']?_0x5fc830[_0x8a55('0x1d')][_0x8a55('0x21')]?_['map'](_0x5fc830[_0x8a55('0x1d')][_0x8a55('0x21')],function(_0x42a890){return{'model':db[_0x42a890[_0x8a55('0x22')]],'as':_0x42a890['as'],'attributes':_0x42a890[_0x8a55('0x20')],'include':_0x42a890[_0x8a55('0x21')]?_[_0x8a55('0x23')](_0x42a890[_0x8a55('0x21')],function(_0x50361a){return{'model':db[_0x50361a['model']],'as':_0x50361a['as'],'attributes':_0x50361a[_0x8a55('0x20')],'include':_0x50361a[_0x8a55('0x21')]?_['map'](_0x50361a[_0x8a55('0x21')],function(_0x108971){return{'model':db[_0x108971[_0x8a55('0x22')]],'as':_0x108971['as'],'attributes':_0x108971['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a55('0x10')](function(_0x5b3d05){logger[_0x8a55('0x11')]('ShowSmsAccount',_0x5fc830);logger[_0x8a55('0x24')](_0x8a55('0x1b'),_0x5fc830,JSON['stringify'](_0x5b3d05));_0x448256(_0x5b3d05);})['catch'](function(_0x35930e){logger[_0x8a55('0x16')](_0x8a55('0x1b'),_0x35930e[_0x8a55('0x18')],_0x5fc830);_0x44a170(_0x454dc5[_0x8a55('0x16')](0x1f4,_0x35930e['message']));});});}; \ No newline at end of file +var _0x82d0=['http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','include','model','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x82d0,0x1a3));var _0x082d=function(_0x4abab9,_0xde21a4){_0x4abab9=_0x4abab9-0x0;var _0x374eba=_0x82d0[_0x4abab9];return _0x374eba;};'use strict';var _=require(_0x082d('0x0'));var util=require(_0x082d('0x1'));var moment=require(_0x082d('0x2'));var BPromise=require('bluebird');var rs=require(_0x082d('0x3'));var fs=require('fs');var Redis=require(_0x082d('0x4'));var db=require(_0x082d('0x5'))['db'];var utils=require(_0x082d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x082d('0x7'));var jayson=require(_0x082d('0x8'));var client=jayson[_0x082d('0x9')][_0x082d('0xa')]({'port':0x232a});config[_0x082d('0xb')]=_[_0x082d('0xc')](config[_0x082d('0xb')],{'host':_0x082d('0xd'),'port':0x18eb});var socket=require(_0x082d('0xe'))(new Redis(config[_0x082d('0xb')]));require(_0x082d('0xf'))[_0x082d('0x10')](socket);function respondWithRpcPromise(_0x580e5b,_0xc8abfd,_0x919a2c){return new BPromise(function(_0x106fdf,_0x3e58bb){return client[_0x082d('0x11')](_0x580e5b,_0x919a2c)['then'](function(_0x3ea504){logger[_0x082d('0x12')](_0x082d('0x13'),_0xc8abfd,_0x082d('0x14'));logger[_0x082d('0x15')](_0x082d('0x16'),_0xc8abfd,_0x082d('0x14'),JSON[_0x082d('0x17')](_0x3ea504));if(_0x3ea504[_0x082d('0x18')]){if(_0x3ea504[_0x082d('0x18')]['code']===0x1f4){logger[_0x082d('0x18')](_0x082d('0x13'),_0xc8abfd,_0x3ea504[_0x082d('0x18')][_0x082d('0x19')]);return _0x3e58bb(_0x3ea504['error'][_0x082d('0x19')]);}logger[_0x082d('0x18')](_0x082d('0x13'),_0xc8abfd,_0x3ea504[_0x082d('0x18')][_0x082d('0x19')]);return _0x106fdf(_0x3ea504['error'][_0x082d('0x19')]);}else{logger[_0x082d('0x12')](_0x082d('0x13'),_0xc8abfd,_0x082d('0x14'));_0x106fdf(_0x3ea504[_0x082d('0x1a')][_0x082d('0x19')]);}})[_0x082d('0x1b')](function(_0x29cb08){logger['error']('SmsAccount,\x20%s,\x20%s',_0xc8abfd,_0x29cb08);_0x3e58bb(_0x29cb08);});});}exports[_0x082d('0x1c')]=function(_0x4c68f3){var _0x23ac59=this;return new Promise(function(_0x3146f8,_0x43fdfc){return db[_0x082d('0x1d')][_0x082d('0x1e')]({'raw':_0x4c68f3[_0x082d('0x1f')]?_0x4c68f3[_0x082d('0x1f')][_0x082d('0x20')]===undefined?!![]:![]:!![],'where':_0x4c68f3[_0x082d('0x1f')]?_0x4c68f3[_0x082d('0x1f')][_0x082d('0x21')]||null:null,'attributes':_0x4c68f3[_0x082d('0x1f')]?_0x4c68f3[_0x082d('0x1f')][_0x082d('0x22')]||null:null,'include':_0x4c68f3['options']?_0x4c68f3[_0x082d('0x1f')]['include']?_[_0x082d('0x23')](_0x4c68f3[_0x082d('0x1f')][_0x082d('0x24')],function(_0x18dd7f){return{'model':db[_0x18dd7f[_0x082d('0x25')]],'as':_0x18dd7f['as'],'attributes':_0x18dd7f['attributes'],'include':_0x18dd7f[_0x082d('0x24')]?_[_0x082d('0x23')](_0x18dd7f[_0x082d('0x24')],function(_0x3f87d7){return{'model':db[_0x3f87d7[_0x082d('0x25')]],'as':_0x3f87d7['as'],'attributes':_0x3f87d7[_0x082d('0x22')],'include':_0x3f87d7[_0x082d('0x24')]?_[_0x082d('0x23')](_0x3f87d7[_0x082d('0x24')],function(_0x41ff04){return{'model':db[_0x41ff04[_0x082d('0x25')]],'as':_0x41ff04['as'],'attributes':_0x41ff04[_0x082d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x082d('0x26')](function(_0x452f93){logger['info'](_0x082d('0x1c'),_0x4c68f3);logger[_0x082d('0x15')](_0x082d('0x1c'),_0x4c68f3,JSON[_0x082d('0x17')](_0x452f93));_0x3146f8(_0x452f93);})[_0x082d('0x1b')](function(_0x1b3104){logger[_0x082d('0x18')](_0x082d('0x1c'),_0x1b3104[_0x082d('0x19')],_0x4c68f3);_0x43fdfc(_0x23ac59[_0x082d('0x18')](0x1f4,_0x1b3104['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 88f8b7d..f144aa0 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index da3f63f..11de8b6 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 _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(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5394a2,_0x1e22df){var _0x46a796=function(_0x22ac1d){while(--_0x22ac1d){_0x5394a2['push'](_0x5394a2['shift']());}};_0x46a796(++_0x1e22df);}(_0x7217,0x19e));var _0x7721=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7217[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 3755823..34da401 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 _0x649b=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x649b,0xe4));var _0xb649=function(_0x10b9ab,_0x5c57f3){_0x10b9ab=_0x10b9ab-0x0;var _0x29c947=_0x649b[_0x10b9ab];return _0x29c947;};'use strict';var Sequelize=require(_0xb649('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb649('0x1')],'allowNull':![],'defaultValue':_0xb649('0x2')},'appdata':{'type':Sequelize[_0xb649('0x3')]()},'description':{'type':Sequelize[_0xb649('0x1')]},'interval':{'type':Sequelize[_0xb649('0x1')],'defaultValue':_0xb649('0x4')}}; \ No newline at end of file +var _0x67d7=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x9e74d5,_0x56b037){var _0x4374ed=function(_0x16b023){while(--_0x16b023){_0x9e74d5['push'](_0x9e74d5['shift']());}};_0x4374ed(++_0x56b037);}(_0x67d7,0xf7));var _0x767d=function(_0x896786,_0x11995d){_0x896786=_0x896786-0x0;var _0x41b274=_0x67d7[_0x896786];return _0x41b274;};'use strict';var Sequelize=require(_0x767d('0x0'));module[_0x767d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x767d('0x2')],'allowNull':![],'defaultValue':_0x767d('0x3')},'appdata':{'type':Sequelize[_0x767d('0x4')]()},'description':{'type':Sequelize[_0x767d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x767d('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 84ab668..31e8268 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 _0xd46b=['length','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SmsApplication','includeAll','include','findAll','catch','show'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0xd46b,0x147));var _0xbd46=function(_0x14eac5,_0x5d7549){_0x14eac5=_0x14eac5-0x0;var _0x223eb6=_0xd46b[_0x14eac5];return _0x223eb6;};'use strict';var emlformat=require(_0xbd46('0x0'));var rimraf=require(_0xbd46('0x1'));var zipdir=require(_0xbd46('0x2'));var jsonpatch=require(_0xbd46('0x3'));var rp=require(_0xbd46('0x4'));var moment=require(_0xbd46('0x5'));var BPromise=require(_0xbd46('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbd46('0x7'));var sox=require(_0xbd46('0x8'));var csv=require(_0xbd46('0x9'));var ejs=require(_0xbd46('0xa'));var fs=require('fs');var fs_extra=require(_0xbd46('0xb'));var _=require(_0xbd46('0xc'));var squel=require(_0xbd46('0xd'));var crypto=require(_0xbd46('0xe'));var jsforce=require(_0xbd46('0xf'));var deskjs=require(_0xbd46('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbd46('0x11'));var Papa=require('papaparse');var Redis=require(_0xbd46('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbd46('0x13'));var as=require(_0xbd46('0x14'));var hardwareService=require(_0xbd46('0x15'));var logger=require(_0xbd46('0x16'))(_0xbd46('0x17'));var utils=require(_0xbd46('0x18'));var config=require(_0xbd46('0x19'));var licenseUtil=require(_0xbd46('0x1a'));var db=require(_0xbd46('0x1b'))['db'];function respondWithStatusCode(_0x493b8f,_0x2557a0){_0x2557a0=_0x2557a0||0xcc;return function(_0x1a2fbb){if(_0x1a2fbb){return _0x493b8f['sendStatus'](_0x2557a0);}return _0x493b8f[_0xbd46('0x1c')](_0x2557a0)[_0xbd46('0x1d')]();};}function respondWithResult(_0x268a75,_0x1b22a3){_0x1b22a3=_0x1b22a3||0xc8;return function(_0x9d08a4){if(_0x9d08a4){return _0x268a75[_0xbd46('0x1c')](_0x1b22a3)[_0xbd46('0x1e')](_0x9d08a4);}};}function respondWithFilteredResult(_0x257a32,_0x2a2d4f){return function(_0x480a60){if(_0x480a60){var _0x574b28=typeof _0x2a2d4f[_0xbd46('0x1f')]===_0xbd46('0x20')&&typeof _0x2a2d4f['limit']===_0xbd46('0x20');var _0x37bbc6=_0x480a60['count'];var _0x26a8fa=_0x574b28?0x0:_0x2a2d4f[_0xbd46('0x1f')];var _0x515395=_0x574b28?_0x480a60[_0xbd46('0x21')]:_0x2a2d4f[_0xbd46('0x1f')]+_0x2a2d4f[_0xbd46('0x22')];var _0x3a1bdf;if(_0x515395>=_0x37bbc6){_0x515395=_0x37bbc6;_0x3a1bdf=0xc8;}else{_0x3a1bdf=0xce;}_0x257a32[_0xbd46('0x1c')](_0x3a1bdf);return _0x257a32[_0xbd46('0x23')](_0xbd46('0x24'),_0x26a8fa+'-'+_0x515395+'/'+_0x37bbc6)[_0xbd46('0x1e')](_0x480a60);}return null;};}function patchUpdates(_0x26dc0e){return function(_0x26fe53){try{jsonpatch[_0xbd46('0x25')](_0x26fe53,_0x26dc0e,!![]);}catch(_0x2c5add){return BPromise[_0xbd46('0x26')](_0x2c5add);}return _0x26fe53[_0xbd46('0x27')]();};}function saveUpdates(_0x376e54,_0x27220f){return function(_0x4c6f1d){if(_0x4c6f1d){return _0x4c6f1d['update'](_0x376e54)[_0xbd46('0x28')](function(_0x536f63){return _0x536f63;});}return null;};}function removeEntity(_0x21610c,_0x517f9d){return function(_0x366174){if(_0x366174){return _0x366174['destroy']()[_0xbd46('0x28')](function(){_0x21610c[_0xbd46('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e88e1,_0x1ceba1){return function(_0xbb39d3){if(!_0xbb39d3){_0x5e88e1[_0xbd46('0x29')](0x194);}return _0xbb39d3;};}function handleError(_0x4e75f5,_0x220cd9){_0x220cd9=_0x220cd9||0x1f4;return function(_0x55d053){logger[_0xbd46('0x2a')](_0x55d053[_0xbd46('0x2b')]);if(_0x55d053['name']){delete _0x55d053[_0xbd46('0x2c')];}_0x4e75f5[_0xbd46('0x1c')](_0x220cd9)['send'](_0x55d053);};}exports[_0xbd46('0x2d')]=function(_0x22e2d9,_0x4b4774){var _0x515382={},_0x1bb50f={},_0x53d8ee={'count':0x0,'rows':[]};var _0x3bed3f=_[_0xbd46('0x2e')](db['SmsApplication'][_0xbd46('0x2f')],function(_0x20ae13){return{'name':_0x20ae13[_0xbd46('0x30')],'type':_0x20ae13[_0xbd46('0x31')]['key']};});_0x1bb50f[_0xbd46('0x32')]=_[_0xbd46('0x2e')](_0x3bed3f,_0xbd46('0x2c'));_0x1bb50f['query']=_[_0xbd46('0x33')](_0x22e2d9[_0xbd46('0x34')]);_0x1bb50f['filters']=_[_0xbd46('0x35')](_0x1bb50f['model'],_0x1bb50f[_0xbd46('0x34')]);_0x515382['attributes']=_[_0xbd46('0x35')](_0x1bb50f[_0xbd46('0x32')],qs[_0xbd46('0x36')](_0x22e2d9['query'][_0xbd46('0x36')]));_0x515382['attributes']=_0x515382[_0xbd46('0x37')]['length']?_0x515382[_0xbd46('0x37')]:_0x1bb50f[_0xbd46('0x32')];if(!_0x22e2d9['query'][_0xbd46('0x38')](_0xbd46('0x39'))){_0x515382[_0xbd46('0x22')]=qs[_0xbd46('0x22')](_0x22e2d9[_0xbd46('0x34')][_0xbd46('0x22')]);_0x515382[_0xbd46('0x1f')]=qs['offset'](_0x22e2d9['query'][_0xbd46('0x1f')]);}_0x515382[_0xbd46('0x3a')]=qs[_0xbd46('0x3b')](_0x22e2d9[_0xbd46('0x34')]['sort']);_0x515382[_0xbd46('0x3c')]=qs[_0xbd46('0x3d')](_[_0xbd46('0x3e')](_0x22e2d9['query'],_0x1bb50f[_0xbd46('0x3d')]),_0x3bed3f);if(_0x22e2d9[_0xbd46('0x34')][_0xbd46('0x3f')]){_0x515382['where']=_['merge'](_0x515382['where'],{'$or':_[_0xbd46('0x2e')](_0x3bed3f,function(_0x33a872){if(_0x33a872['type']!==_0xbd46('0x40')){var _0x507b74={};_0x507b74[_0x33a872['name']]={'$like':'%'+_0x22e2d9[_0xbd46('0x34')]['filter']+'%'};return _0x507b74;}})});}_0x515382=_[_0xbd46('0x41')]({},_0x515382,_0x22e2d9[_0xbd46('0x42')]);var _0x27d08a={'where':_0x515382[_0xbd46('0x3c')]};return db[_0xbd46('0x43')][_0xbd46('0x21')](_0x27d08a)['then'](function(_0x179091){_0x53d8ee[_0xbd46('0x21')]=_0x179091;if(_0x22e2d9['query'][_0xbd46('0x44')]){_0x515382[_0xbd46('0x45')]=[{'all':!![]}];}return db[_0xbd46('0x43')][_0xbd46('0x46')](_0x515382);})[_0xbd46('0x28')](function(_0x13fddc){_0x53d8ee['rows']=_0x13fddc;return _0x53d8ee;})[_0xbd46('0x28')](respondWithFilteredResult(_0x4b4774,_0x515382))[_0xbd46('0x47')](handleError(_0x4b4774,null));};exports[_0xbd46('0x48')]=function(_0xe2fda0,_0x380c19){var _0x5201b6={'raw':!![],'where':{'id':_0xe2fda0['params']['id']}},_0x3957ad={};_0x3957ad['model']=_[_0xbd46('0x33')](db[_0xbd46('0x43')][_0xbd46('0x2f')]);_0x3957ad[_0xbd46('0x34')]=_[_0xbd46('0x33')](_0xe2fda0[_0xbd46('0x34')]);_0x3957ad[_0xbd46('0x3d')]=_[_0xbd46('0x35')](_0x3957ad[_0xbd46('0x32')],_0x3957ad[_0xbd46('0x34')]);_0x5201b6[_0xbd46('0x37')]=_[_0xbd46('0x35')](_0x3957ad[_0xbd46('0x32')],qs[_0xbd46('0x36')](_0xe2fda0[_0xbd46('0x34')][_0xbd46('0x36')]));_0x5201b6[_0xbd46('0x37')]=_0x5201b6[_0xbd46('0x37')][_0xbd46('0x49')]?_0x5201b6['attributes']:_0x3957ad[_0xbd46('0x32')];if(_0xe2fda0[_0xbd46('0x34')][_0xbd46('0x44')]){_0x5201b6[_0xbd46('0x45')]=[{'all':!![]}];}_0x5201b6=_[_0xbd46('0x41')]({},_0x5201b6,_0xe2fda0[_0xbd46('0x42')]);return db[_0xbd46('0x43')][_0xbd46('0x4a')](_0x5201b6)[_0xbd46('0x28')](handleEntityNotFound(_0x380c19,null))[_0xbd46('0x28')](respondWithResult(_0x380c19,null))[_0xbd46('0x47')](handleError(_0x380c19,null));};exports[_0xbd46('0x4b')]=function(_0x338136,_0x31431f){return db[_0xbd46('0x43')][_0xbd46('0x4b')](_0x338136[_0xbd46('0x4c')],{})['then'](respondWithResult(_0x31431f,0xc9))[_0xbd46('0x47')](handleError(_0x31431f,null));};exports[_0xbd46('0x4d')]=function(_0x43cefc,_0x28d854){if(_0x43cefc[_0xbd46('0x4c')]['id']){delete _0x43cefc[_0xbd46('0x4c')]['id'];}return db[_0xbd46('0x43')][_0xbd46('0x4a')]({'where':{'id':_0x43cefc[_0xbd46('0x4e')]['id']}})[_0xbd46('0x28')](handleEntityNotFound(_0x28d854,null))['then'](saveUpdates(_0x43cefc[_0xbd46('0x4c')],null))[_0xbd46('0x28')](respondWithResult(_0x28d854,null))[_0xbd46('0x47')](handleError(_0x28d854,null));};exports[_0xbd46('0x4f')]=function(_0x2525d3,_0x53ffbc){return db[_0xbd46('0x43')][_0xbd46('0x4a')]({'where':{'id':_0x2525d3[_0xbd46('0x4e')]['id']}})[_0xbd46('0x28')](handleEntityNotFound(_0x53ffbc,null))[_0xbd46('0x28')](removeEntity(_0x53ffbc,null))[_0xbd46('0x47')](handleError(_0x53ffbc,null));}; \ No newline at end of file +var _0x191b=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','show','includeAll','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x28d7fe,_0x3813d2){var _0x61e5ea=function(_0x3d8028){while(--_0x3d8028){_0x28d7fe['push'](_0x28d7fe['shift']());}};_0x61e5ea(++_0x3813d2);}(_0x191b,0x118));var _0xb191=function(_0x5652b0,_0x541b65){_0x5652b0=_0x5652b0-0x0;var _0x85b649=_0x191b[_0x5652b0];return _0x85b649;};'use strict';var emlformat=require(_0xb191('0x0'));var rimraf=require(_0xb191('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb191('0x2'));var rp=require(_0xb191('0x3'));var moment=require(_0xb191('0x4'));var BPromise=require(_0xb191('0x5'));var Mustache=require(_0xb191('0x6'));var util=require('util');var path=require(_0xb191('0x7'));var sox=require(_0xb191('0x8'));var csv=require(_0xb191('0x9'));var ejs=require(_0xb191('0xa'));var fs=require('fs');var fs_extra=require(_0xb191('0xb'));var _=require(_0xb191('0xc'));var squel=require(_0xb191('0xd'));var crypto=require(_0xb191('0xe'));var jsforce=require(_0xb191('0xf'));var deskjs=require(_0xb191('0x10'));var toCsv=require(_0xb191('0x9'));var querystring=require(_0xb191('0x11'));var Papa=require('papaparse');var Redis=require(_0xb191('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb191('0x13'));var hardwareService=require(_0xb191('0x14'));var logger=require(_0xb191('0x15'))(_0xb191('0x16'));var utils=require(_0xb191('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb191('0x18'));var db=require(_0xb191('0x19'))['db'];function respondWithStatusCode(_0x370e5b,_0x1bd6a9){_0x1bd6a9=_0x1bd6a9||0xcc;return function(_0x739fcd){if(_0x739fcd){return _0x370e5b[_0xb191('0x1a')](_0x1bd6a9);}return _0x370e5b[_0xb191('0x1b')](_0x1bd6a9)['end']();};}function respondWithResult(_0x5e8e15,_0x38da52){_0x38da52=_0x38da52||0xc8;return function(_0x1dd458){if(_0x1dd458){return _0x5e8e15[_0xb191('0x1b')](_0x38da52)[_0xb191('0x1c')](_0x1dd458);}};}function respondWithFilteredResult(_0x32a538,_0x30c30d){return function(_0x4cb9ea){if(_0x4cb9ea){var _0x14f667=typeof _0x30c30d[_0xb191('0x1d')]==='undefined'&&typeof _0x30c30d[_0xb191('0x1e')]==='undefined';var _0x1008e6=_0x4cb9ea['count'];var _0x537db1=_0x14f667?0x0:_0x30c30d['offset'];var _0x725a85=_0x14f667?_0x4cb9ea['count']:_0x30c30d[_0xb191('0x1d')]+_0x30c30d[_0xb191('0x1e')];var _0x10d7ed;if(_0x725a85>=_0x1008e6){_0x725a85=_0x1008e6;_0x10d7ed=0xc8;}else{_0x10d7ed=0xce;}_0x32a538[_0xb191('0x1b')](_0x10d7ed);return _0x32a538[_0xb191('0x1f')](_0xb191('0x20'),_0x537db1+'-'+_0x725a85+'/'+_0x1008e6)[_0xb191('0x1c')](_0x4cb9ea);}return null;};}function patchUpdates(_0x1a7a49){return function(_0x2459cd){try{jsonpatch[_0xb191('0x21')](_0x2459cd,_0x1a7a49,!![]);}catch(_0x2aab09){return BPromise[_0xb191('0x22')](_0x2aab09);}return _0x2459cd[_0xb191('0x23')]();};}function saveUpdates(_0x8863ed,_0x5c227c){return function(_0x4b5cb2){if(_0x4b5cb2){return _0x4b5cb2[_0xb191('0x24')](_0x8863ed)[_0xb191('0x25')](function(_0x4256ee){return _0x4256ee;});}return null;};}function removeEntity(_0x4b24ef,_0x1170ee){return function(_0x4ded0b){if(_0x4ded0b){return _0x4ded0b[_0xb191('0x26')]()['then'](function(){_0x4b24ef[_0xb191('0x1b')](0xcc)[_0xb191('0x27')]();});}};}function handleEntityNotFound(_0x5834f1,_0x3ef42a){return function(_0x249171){if(!_0x249171){_0x5834f1[_0xb191('0x1a')](0x194);}return _0x249171;};}function handleError(_0x380c65,_0x2d3aaa){_0x2d3aaa=_0x2d3aaa||0x1f4;return function(_0xbc3c0f){logger[_0xb191('0x28')](_0xbc3c0f[_0xb191('0x29')]);if(_0xbc3c0f[_0xb191('0x2a')]){delete _0xbc3c0f[_0xb191('0x2a')];}_0x380c65['status'](_0x2d3aaa)[_0xb191('0x2b')](_0xbc3c0f);};}exports[_0xb191('0x2c')]=function(_0x152f69,_0x36beb1){var _0x583e7f={},_0x491ed7={},_0x55f6c4={'count':0x0,'rows':[]};var _0x37f647=_[_0xb191('0x2d')](db[_0xb191('0x2e')][_0xb191('0x2f')],function(_0x296d26){return{'name':_0x296d26[_0xb191('0x30')],'type':_0x296d26[_0xb191('0x31')]['key']};});_0x491ed7[_0xb191('0x32')]=_[_0xb191('0x2d')](_0x37f647,_0xb191('0x2a'));_0x491ed7[_0xb191('0x33')]=_[_0xb191('0x34')](_0x152f69[_0xb191('0x33')]);_0x491ed7[_0xb191('0x35')]=_['intersection'](_0x491ed7[_0xb191('0x32')],_0x491ed7['query']);_0x583e7f[_0xb191('0x36')]=_[_0xb191('0x37')](_0x491ed7[_0xb191('0x32')],qs[_0xb191('0x38')](_0x152f69[_0xb191('0x33')]['fields']));_0x583e7f[_0xb191('0x36')]=_0x583e7f['attributes'][_0xb191('0x39')]?_0x583e7f[_0xb191('0x36')]:_0x491ed7[_0xb191('0x32')];if(!_0x152f69[_0xb191('0x33')]['hasOwnProperty']('nolimit')){_0x583e7f[_0xb191('0x1e')]=qs[_0xb191('0x1e')](_0x152f69[_0xb191('0x33')][_0xb191('0x1e')]);_0x583e7f[_0xb191('0x1d')]=qs['offset'](_0x152f69[_0xb191('0x33')][_0xb191('0x1d')]);}_0x583e7f[_0xb191('0x3a')]=qs[_0xb191('0x3b')](_0x152f69['query'][_0xb191('0x3b')]);_0x583e7f[_0xb191('0x3c')]=qs[_0xb191('0x35')](_[_0xb191('0x3d')](_0x152f69['query'],_0x491ed7[_0xb191('0x35')]),_0x37f647);if(_0x152f69[_0xb191('0x33')][_0xb191('0x3e')]){_0x583e7f[_0xb191('0x3c')]=_[_0xb191('0x3f')](_0x583e7f[_0xb191('0x3c')],{'$or':_[_0xb191('0x2d')](_0x37f647,function(_0x6a641a){if(_0x6a641a[_0xb191('0x31')]!=='VIRTUAL'){var _0x1687df={};_0x1687df[_0x6a641a[_0xb191('0x2a')]]={'$like':'%'+_0x152f69[_0xb191('0x33')]['filter']+'%'};return _0x1687df;}})});}_0x583e7f=_[_0xb191('0x3f')]({},_0x583e7f,_0x152f69[_0xb191('0x40')]);var _0x2f1805={'where':_0x583e7f['where']};return db[_0xb191('0x2e')][_0xb191('0x41')](_0x2f1805)[_0xb191('0x25')](function(_0x16c773){_0x55f6c4[_0xb191('0x41')]=_0x16c773;if(_0x152f69[_0xb191('0x33')]['includeAll']){_0x583e7f[_0xb191('0x42')]=[{'all':!![]}];}return db[_0xb191('0x2e')][_0xb191('0x43')](_0x583e7f);})[_0xb191('0x25')](function(_0x250925){_0x55f6c4[_0xb191('0x44')]=_0x250925;return _0x55f6c4;})[_0xb191('0x25')](respondWithFilteredResult(_0x36beb1,_0x583e7f))['catch'](handleError(_0x36beb1,null));};exports[_0xb191('0x45')]=function(_0x7c8231,_0xc976e5){var _0x5a4b93={'raw':!![],'where':{'id':_0x7c8231['params']['id']}},_0xe42c96={};_0xe42c96[_0xb191('0x32')]=_[_0xb191('0x34')](db[_0xb191('0x2e')]['rawAttributes']);_0xe42c96[_0xb191('0x33')]=_[_0xb191('0x34')](_0x7c8231[_0xb191('0x33')]);_0xe42c96[_0xb191('0x35')]=_[_0xb191('0x37')](_0xe42c96[_0xb191('0x32')],_0xe42c96[_0xb191('0x33')]);_0x5a4b93[_0xb191('0x36')]=_['intersection'](_0xe42c96[_0xb191('0x32')],qs[_0xb191('0x38')](_0x7c8231[_0xb191('0x33')][_0xb191('0x38')]));_0x5a4b93['attributes']=_0x5a4b93[_0xb191('0x36')][_0xb191('0x39')]?_0x5a4b93['attributes']:_0xe42c96[_0xb191('0x32')];if(_0x7c8231[_0xb191('0x33')][_0xb191('0x46')]){_0x5a4b93[_0xb191('0x42')]=[{'all':!![]}];}_0x5a4b93=_['merge']({},_0x5a4b93,_0x7c8231['options']);return db['SmsApplication'][_0xb191('0x47')](_0x5a4b93)[_0xb191('0x25')](handleEntityNotFound(_0xc976e5,null))[_0xb191('0x25')](respondWithResult(_0xc976e5,null))[_0xb191('0x48')](handleError(_0xc976e5,null));};exports['create']=function(_0x5268f4,_0x22d721){return db['SmsApplication'][_0xb191('0x49')](_0x5268f4[_0xb191('0x4a')],{})[_0xb191('0x25')](respondWithResult(_0x22d721,0xc9))[_0xb191('0x48')](handleError(_0x22d721,null));};exports['update']=function(_0x5013f5,_0x342cbd){if(_0x5013f5[_0xb191('0x4a')]['id']){delete _0x5013f5['body']['id'];}return db['SmsApplication'][_0xb191('0x47')]({'where':{'id':_0x5013f5[_0xb191('0x4b')]['id']}})[_0xb191('0x25')](handleEntityNotFound(_0x342cbd,null))[_0xb191('0x25')](saveUpdates(_0x5013f5['body'],null))[_0xb191('0x25')](respondWithResult(_0x342cbd,null))['catch'](handleError(_0x342cbd,null));};exports['destroy']=function(_0x577890,_0x3d9ab7){return db['SmsApplication']['find']({'where':{'id':_0x577890[_0xb191('0x4b')]['id']}})[_0xb191('0x25')](handleEntityNotFound(_0x3d9ab7,null))[_0xb191('0x25')](removeEntity(_0x3d9ab7,null))[_0xb191('0x48')](handleError(_0x3d9ab7,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 445fdf4..03a4215 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 _0x9800=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3a1a67,_0x4a9542){var _0x207c53=function(_0x2276c7){while(--_0x2276c7){_0x3a1a67['push'](_0x3a1a67['shift']());}};_0x207c53(++_0x4a9542);}(_0x9800,0x18e));var _0x0980=function(_0x825cbd,_0x3de63d){_0x825cbd=_0x825cbd-0x0;var _0x2a10b3=_0x9800[_0x825cbd];return _0x2a10b3;};'use strict';var _=require(_0x0980('0x0'));var util=require('util');var logger=require(_0x0980('0x1'))(_0x0980('0x2'));var moment=require(_0x0980('0x3'));var BPromise=require(_0x0980('0x4'));var rp=require(_0x0980('0x5'));var fs=require('fs');var path=require(_0x0980('0x6'));var rimraf=require(_0x0980('0x7'));var config=require(_0x0980('0x8'));var attributes=require(_0x0980('0x9'));module[_0x0980('0xa')]=function(_0x359a4c,_0x1e83f2){return _0x359a4c[_0x0980('0xb')](_0x0980('0xc'),attributes,{'tableName':_0x0980('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0980('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x049e=['../../config/environment','./smsApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf'];(function(_0x298064,_0x1d2bfb){var _0x2512ea=function(_0x3e5b28){while(--_0x3e5b28){_0x298064['push'](_0x298064['shift']());}};_0x2512ea(++_0x1d2bfb);}(_0x049e,0x72));var _0xe049=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x049e[_0x3c04ef];return _0x6a3a69;};'use strict';var _=require(_0xe049('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe049('0x1'));var moment=require(_0xe049('0x2'));var BPromise=require('bluebird');var rp=require(_0xe049('0x3'));var fs=require('fs');var path=require(_0xe049('0x4'));var rimraf=require(_0xe049('0x5'));var config=require(_0xe049('0x6'));var attributes=require(_0xe049('0x7'));module[_0xe049('0x8')]=function(_0x318f75,_0x3f7fc2){return _0x318f75[_0xe049('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe049('0xa'),'collate':_0xe049('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 1275bba..da413c9 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 _0xabad=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xabad,0x150));var _0xdaba=function(_0x3feec6,_0x4db012){_0x3feec6=_0x3feec6-0x0;var _0x56d5e2=_0xabad[_0x3feec6];return _0x56d5e2;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var moment=require(_0xdaba('0x1'));var BPromise=require(_0xdaba('0x2'));var rs=require(_0xdaba('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaba('0x4'))['db'];var utils=require(_0xdaba('0x5'));var logger=require('../../config/logger')(_0xdaba('0x6'));var config=require(_0xdaba('0x7'));var jayson=require(_0xdaba('0x8'));var client=jayson[_0xdaba('0x9')][_0xdaba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23ae0f,_0x4045f5,_0x352a74){return new BPromise(function(_0x5214dc,_0x2344d1){return client[_0xdaba('0xb')](_0x23ae0f,_0x352a74)[_0xdaba('0xc')](function(_0x1e22ba){logger['info'](_0xdaba('0xd'),_0x4045f5,_0xdaba('0xe'));logger[_0xdaba('0xf')](_0xdaba('0x10'),_0x4045f5,_0xdaba('0xe'),JSON[_0xdaba('0x11')](_0x1e22ba));if(_0x1e22ba[_0xdaba('0x12')]){if(_0x1e22ba[_0xdaba('0x12')][_0xdaba('0x13')]===0x1f4){logger['error'](_0xdaba('0xd'),_0x4045f5,_0x1e22ba['error'][_0xdaba('0x14')]);return _0x2344d1(_0x1e22ba[_0xdaba('0x12')][_0xdaba('0x14')]);}logger[_0xdaba('0x12')](_0xdaba('0xd'),_0x4045f5,_0x1e22ba[_0xdaba('0x12')][_0xdaba('0x14')]);return _0x5214dc(_0x1e22ba['error'][_0xdaba('0x14')]);}else{logger[_0xdaba('0x15')](_0xdaba('0xd'),_0x4045f5,_0xdaba('0xe'));_0x5214dc(_0x1e22ba[_0xdaba('0x16')][_0xdaba('0x14')]);}})[_0xdaba('0x17')](function(_0x5c4ec1){logger[_0xdaba('0x12')](_0xdaba('0xd'),_0x4045f5,_0x5c4ec1);_0x2344d1(_0x5c4ec1);});});} \ No newline at end of file +var _0x16a2=['error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x412f14,_0x33a6ec){var _0x5f2e57=function(_0x456f4a){while(--_0x456f4a){_0x412f14['push'](_0x412f14['shift']());}};_0x5f2e57(++_0x33a6ec);}(_0x16a2,0x1d0));var _0x216a=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x16a2[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x216a('0x0'));var util=require(_0x216a('0x1'));var moment=require(_0x216a('0x2'));var BPromise=require(_0x216a('0x3'));var rs=require(_0x216a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x216a('0x5'));var logger=require(_0x216a('0x6'))(_0x216a('0x7'));var config=require(_0x216a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x216a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6dbac7,_0x2dd88c,_0x55f347){return new BPromise(function(_0xf619f8,_0x20e3f7){return client[_0x216a('0xa')](_0x6dbac7,_0x55f347)[_0x216a('0xb')](function(_0x4ce00d){logger['info'](_0x216a('0xc'),_0x2dd88c,_0x216a('0xd'));logger['debug'](_0x216a('0xe'),_0x2dd88c,_0x216a('0xd'),JSON[_0x216a('0xf')](_0x4ce00d));if(_0x4ce00d[_0x216a('0x10')]){if(_0x4ce00d[_0x216a('0x10')]['code']===0x1f4){logger[_0x216a('0x10')](_0x216a('0xc'),_0x2dd88c,_0x4ce00d['error'][_0x216a('0x11')]);return _0x20e3f7(_0x4ce00d[_0x216a('0x10')]['message']);}logger[_0x216a('0x10')](_0x216a('0xc'),_0x2dd88c,_0x4ce00d['error'][_0x216a('0x11')]);return _0xf619f8(_0x4ce00d['error'][_0x216a('0x11')]);}else{logger[_0x216a('0x12')](_0x216a('0xc'),_0x2dd88c,_0x216a('0xd'));_0xf619f8(_0x4ce00d['result'][_0x216a('0x11')]);}})[_0x216a('0x13')](function(_0x4c1a4d){logger[_0x216a('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2dd88c,_0x4c1a4d);_0x20e3f7(_0x4c1a4d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 0cb4528..13deb11 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 _0x4483=['isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4483,0x1a3));var _0x3448=function(_0x3cea2d,_0x5133e4){_0x3cea2d=_0x3cea2d-0x0;var _0x550e57=_0x4483[_0x3cea2d];return _0x550e57;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3448('0x13')](_0x3448('0xf'),auth['isAuthenticated'](),controller[_0x3448('0x14')]);router[_0x3448('0x13')](_0x3448('0x15'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),'smsinteraction:addtags'),controller[_0x3448('0x18')]);router[_0x3448('0x19')](_0x3448('0x1a'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),_0x3448('0x1b')),controller[_0x3448('0x1c')]);router[_0x3448('0x1d')](_0x3448('0x1a'),auth[_0x3448('0xa')](),interaction[_0x3448('0x16')]('sms',_0x3448('0x1e')),controller['destroy']);router['delete']('/:id/tags',auth[_0x3448('0xa')](),controller[_0x3448('0x1f')]);module[_0x3448('0x20')]=router; \ No newline at end of file +var _0x0972=['tracked','sms','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x588685,_0x4ef83b){var _0x1aff13=function(_0x14271f){while(--_0x14271f){_0x588685['push'](_0x588685['shift']());}};_0x1aff13(++_0x4ef83b);}(_0x0972,0x64));var _0x2097=function(_0x13413b,_0x438ef7){_0x13413b=_0x13413b-0x0;var _0x19bd5f=_0x0972[_0x13413b];return _0x19bd5f;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var fs_extra=require(_0x2097('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var controller=require(_0x2097('0x6'));router[_0x2097('0x7')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0x7')]('/describe',auth[_0x2097('0x8')](),controller[_0x2097('0xa')]);router[_0x2097('0x7')](_0x2097('0xb'),auth[_0x2097('0x8')](),controller['show']);router[_0x2097('0x7')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0xd')]);router[_0x2097('0x7')](_0x2097('0xe'),auth[_0x2097('0x8')](),controller[_0x2097('0xf')]);router[_0x2097('0x10')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x11')]);router[_0x2097('0x10')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0x12')]);router[_0x2097('0x10')](_0x2097('0x13'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')](_0x2097('0x15'),'smsinteraction:addtags'),controller[_0x2097('0x16')]);router[_0x2097('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x2097('0x15'),'smsinteraction:update'),controller[_0x2097('0x18')]);router[_0x2097('0x19')](_0x2097('0xb'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')]('sms',_0x2097('0x1a')),controller[_0x2097('0x1b')]);router[_0x2097('0x19')](_0x2097('0x13'),auth[_0x2097('0x8')](),controller[_0x2097('0x1c')]);module[_0x2097('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 050d2e1..ab4a757 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 _0x6df9=['moment','BOOLEAN','STRING','DATE','out','INTEGER','sequelize'];(function(_0x35a85c,_0x48fb57){var _0x194713=function(_0x1f0fe9){while(--_0x1f0fe9){_0x35a85c['push'](_0x35a85c['shift']());}};_0x194713(++_0x48fb57);}(_0x6df9,0x84));var _0x96df=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6df9[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x96df('0x0'));var moment=require(_0x96df('0x1'));module['exports']={'closed':{'type':Sequelize[_0x96df('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x96df('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x96df('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x96df('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x96df('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x96df('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x96df('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x96df('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96df('0x6')]}}; \ No newline at end of file +var _0x3070=['DATE','STRING','ENUM','out','INTEGER','moment','BOOLEAN'];(function(_0x36ffee,_0xf8e8f7){var _0x43a33a=function(_0x18b1f6){while(--_0x18b1f6){_0x36ffee['push'](_0x36ffee['shift']());}};_0x43a33a(++_0xf8e8f7);}(_0x3070,0x75));var _0x0307=function(_0x3cd34b,_0x16e91a){_0x3cd34b=_0x3cd34b-0x0;var _0x2b7a72=_0x3070[_0x3cd34b];return _0x2b7a72;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0307('0x0'));module['exports']={'closed':{'type':Sequelize[_0x0307('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0307('0x2')]},'disposition':{'type':Sequelize[_0x0307('0x3')]},'secondDisposition':{'type':Sequelize[_0x0307('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0307('0x3')]},'note':{'type':Sequelize[_0x0307('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0307('0x4')]('in',_0x0307('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0307('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x0307('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0307('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0307('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 2f289df..094f9dc 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 _0x4718=['firstName','lastName','Messages','secret','read','SmsAccount','Account','Owner','fullname','get','mkdirSync','N.A.','toString','closedAt','disposition','createdAt','direction','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','download','err','unlinkSync','sendStatus','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','index','map','SmsInteraction','type','key','getOptions','findAll','sms','user','catch','show','params','keys','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','where','SmsInteractionId','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','color','emit','smsInteractionTags:save','root','server','files','tmp','join','User','push','Contact'];(function(_0x1572ad,_0x258d46){var _0xd8eb80=function(_0x4bd2c3){while(--_0x4bd2c3){_0x1572ad['push'](_0x1572ad['shift']());}};_0xd8eb80(++_0x258d46);}(_0x4718,0x18d));var _0x8471=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4718[_0xfae23b];return _0x200640;};'use strict';var rimraf=require(_0x8471('0x0'));var zipdir=require(_0x8471('0x1'));var moment=require(_0x8471('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x8471('0x3'));var ejs=require(_0x8471('0x4'));var fs=require('fs');var _=require(_0x8471('0x5'));var Redis=require(_0x8471('0x6'));var interaction=require(_0x8471('0x7'));var qs=require(_0x8471('0x8'));var pdf=require(_0x8471('0x9'));var logger=require(_0x8471('0xa'))(_0x8471('0xb'));var config=require('../../config/environment');var db=require(_0x8471('0xc'))['db'];config[_0x8471('0xd')]=_[_0x8471('0xe')](config[_0x8471('0xd')],{'host':_0x8471('0xf'),'port':0x18eb});var socket=require(_0x8471('0x10'))(new Redis(config[_0x8471('0xd')]));require(_0x8471('0x11'))[_0x8471('0x12')](socket);function respondWithStatusCode(_0x194b7e,_0x8a4af6){_0x8a4af6=_0x8a4af6||0xcc;return function(_0x367cc3){if(_0x367cc3){return _0x194b7e['sendStatus'](_0x8a4af6);}return _0x194b7e[_0x8471('0x13')](_0x8a4af6)[_0x8471('0x14')]();};}function respondWithResult(_0x158b39,_0x22d9a7){_0x22d9a7=_0x22d9a7||0xc8;return function(_0x4edc01){if(_0x4edc01){return _0x158b39['status'](_0x22d9a7)[_0x8471('0x15')](_0x4edc01);}};}function respondWithFilteredResult(_0xb08f7e,_0x20af6c){return function(_0x371432){if(_0x371432){var _0x30e13e=typeof _0x20af6c[_0x8471('0x16')]===_0x8471('0x17')&&typeof _0x20af6c[_0x8471('0x18')]==='undefined';var _0x140155=_0x371432[_0x8471('0x19')];var _0x28edfc=_0x30e13e?0x0:_0x20af6c[_0x8471('0x16')];var _0x5d5a87=_0x30e13e?_0x371432[_0x8471('0x19')]:_0x20af6c[_0x8471('0x16')]+_0x20af6c[_0x8471('0x18')];var _0x1ad655;if(_0x5d5a87>=_0x140155){_0x5d5a87=_0x140155;_0x1ad655=0xc8;}else{_0x1ad655=0xce;}_0xb08f7e[_0x8471('0x13')](_0x1ad655);return _0xb08f7e[_0x8471('0x1a')](_0x8471('0x1b'),_0x28edfc+'-'+_0x5d5a87+'/'+_0x140155)[_0x8471('0x15')](_0x371432);}return null;};}function saveUpdates(_0x6024c2){return function(_0x2b2391){if(_0x2b2391){return _0x2b2391['update'](_0x6024c2)[_0x8471('0x1c')](function(_0x4d5347){return _0x4d5347;});}return null;};}function removeEntity(_0x1d587a){return function(_0x29470b){if(_0x29470b){return _0x29470b[_0x8471('0x1d')]()[_0x8471('0x1c')](function(){_0x1d587a['status'](0xcc)[_0x8471('0x14')]();});}};}function handleEntityNotFound(_0x3da7f7){return function(_0x4da0e0){if(!_0x4da0e0){_0x3da7f7['sendStatus'](0x194);}return _0x4da0e0;};}function handleError(_0x216668,_0x36e702){_0x36e702=_0x36e702||0x1f4;return function(_0x1cc676){logger[_0x8471('0x1e')](_0x1cc676['stack']);if(_0x1cc676[_0x8471('0x1f')]){delete _0x1cc676[_0x8471('0x1f')];}_0x216668[_0x8471('0x13')](_0x36e702)['send'](_0x1cc676);};}exports[_0x8471('0x20')]=function(_0x45bb53,_0x2e9a5e){var _0x46eb7c={};var _0x26ede7=_[_0x8471('0x21')](db[_0x8471('0x22')]['rawAttributes'],function(_0x1ff0a8){return{'name':_0x1ff0a8['fieldName'],'type':_0x1ff0a8[_0x8471('0x23')][_0x8471('0x24')]};});_0x46eb7c=qs[_0x8471('0x25')](_0x26ede7,_0x45bb53);return interaction[_0x8471('0x26')](_0x8471('0x27'),_0x45bb53['query'],_0x45bb53[_0x8471('0x28')],_0x46eb7c,_0x26ede7)[_0x8471('0x1c')](respondWithFilteredResult(_0x2e9a5e,_0x46eb7c))[_0x8471('0x29')](handleError(_0x2e9a5e,null));};exports[_0x8471('0x2a')]=function(_0xd3e6a9,_0x4be426){var _0x266266={'raw':![],'where':{'id':_0xd3e6a9[_0x8471('0x2b')]['id']}},_0x430798={};_0x430798['model']=_[_0x8471('0x2c')](db[_0x8471('0x22')][_0x8471('0x2d')]);_0x430798['query']=_[_0x8471('0x2c')](_0xd3e6a9[_0x8471('0x2e')]);_0x430798[_0x8471('0x2f')]=_[_0x8471('0x30')](_0x430798['model'],_0x430798[_0x8471('0x2e')]);_0x266266[_0x8471('0x31')]=_['intersection'](_0x430798[_0x8471('0x32')],qs['fields'](_0xd3e6a9[_0x8471('0x2e')][_0x8471('0x33')]));_0x266266[_0x8471('0x31')]=_0x266266[_0x8471('0x31')][_0x8471('0x34')]?_0x266266[_0x8471('0x31')]:_0x430798['model'];if(_0xd3e6a9[_0x8471('0x2e')][_0x8471('0x35')]){_0x266266[_0x8471('0x36')]=[{'all':!![]}];}_0x266266=_[_0x8471('0x37')]({},_0x266266,_0xd3e6a9[_0x8471('0x38')]);return db[_0x8471('0x22')][_0x8471('0x39')](_0x266266)[_0x8471('0x1c')](handleEntityNotFound(_0x4be426,null))['then'](respondWithResult(_0x4be426,null))[_0x8471('0x29')](handleError(_0x4be426,null));};exports[_0x8471('0x3a')]=function(_0x1b8043,_0x41c0e8){return db[_0x8471('0x22')][_0x8471('0x3a')](_0x1b8043['body'],{})[_0x8471('0x1c')](respondWithResult(_0x41c0e8,0xc9))['catch'](handleError(_0x41c0e8,null));};exports['update']=function(_0x389f15,_0x1785e9){if(_0x389f15['body']['id']){delete _0x389f15[_0x8471('0x3b')]['id'];}return db['SmsInteraction'][_0x8471('0x39')]({'where':{'id':_0x389f15['params']['id']}})[_0x8471('0x1c')](handleEntityNotFound(_0x1785e9,null))[_0x8471('0x1c')](saveUpdates(_0x389f15[_0x8471('0x3b')],null))['then'](respondWithResult(_0x1785e9,null))[_0x8471('0x29')](handleError(_0x1785e9,null));};exports[_0x8471('0x1d')]=function(_0x437044,_0x122915){return db[_0x8471('0x22')]['find']({'where':{'id':_0x437044[_0x8471('0x2b')]['id']}})['then'](handleEntityNotFound(_0x122915,null))[_0x8471('0x1c')](removeEntity(_0x122915,null))[_0x8471('0x29')](handleError(_0x122915,null));};exports[_0x8471('0x3c')]=function(_0x489c22,_0x57d69c){return db['SmsInteraction'][_0x8471('0x3c')]()['then'](respondWithResult(_0x57d69c,null))[_0x8471('0x29')](handleError(_0x57d69c,null));};exports[_0x8471('0x3d')]=function(_0x2da16a,_0x4cb3a5){return db[_0x8471('0x3e')]['find']({'where':{'id':_0x2da16a['params']['id']}})[_0x8471('0x1c')](handleEntityNotFound(_0x4cb3a5,null))[_0x8471('0x1c')](function(_0x2acd60){if(_0x2acd60){return _0x2acd60['addMessage'](_0x2da16a[_0x8471('0x3b')]['ids'],_['omit'](_0x2da16a['body'],[_0x8471('0x3f'),'id'])||{});}})[_0x8471('0x1c')](respondWithResult(_0x4cb3a5,null))[_0x8471('0x29')](handleError(_0x4cb3a5,null));};exports[_0x8471('0x40')]=function(_0x47242c,_0x115e2c){var _0x540220={'raw':![],'where':{}};var _0x6fbc1c={};var _0x34df0d={'count':0x0,'rows':[]};return db[_0x8471('0x22')][_0x8471('0x41')]({'where':{'id':_0x47242c[_0x8471('0x2b')]['id']}})['then'](handleEntityNotFound(_0x115e2c,null))['then'](function(_0x3fbd7b){if(_0x3fbd7b){_0x6fbc1c['model']=_['keys'](db[_0x8471('0x3e')][_0x8471('0x2d')]);_0x6fbc1c[_0x8471('0x2e')]=_[_0x8471('0x2c')](_0x47242c[_0x8471('0x2e')]);_0x6fbc1c[_0x8471('0x2f')]=_[_0x8471('0x30')](_0x6fbc1c[_0x8471('0x32')],_0x6fbc1c[_0x8471('0x2e')]);_0x540220[_0x8471('0x31')]=_['intersection'](_0x6fbc1c[_0x8471('0x32')],qs['fields'](_0x47242c['query']['fields']));_0x540220[_0x8471('0x31')]=_0x540220[_0x8471('0x31')][_0x8471('0x34')]?_0x540220[_0x8471('0x31')]:_0x6fbc1c[_0x8471('0x32')];if(!_0x47242c[_0x8471('0x2e')][_0x8471('0x42')](_0x8471('0x43'))){_0x540220['limit']=qs['limit'](_0x47242c[_0x8471('0x2e')]['limit']);_0x540220[_0x8471('0x16')]=qs['offset'](_0x47242c[_0x8471('0x2e')]['offset']);}_0x540220['order']=qs['sort'](_0x47242c[_0x8471('0x2e')]['sort']);_0x540220[_0x8471('0x44')]=qs[_0x8471('0x2f')](_['pick'](_0x47242c[_0x8471('0x2e')],_0x6fbc1c[_0x8471('0x2f')]));_0x540220['where'][_0x8471('0x45')]=_0x3fbd7b['id'];if(_0x47242c[_0x8471('0x2e')][_0x8471('0x46')]){_0x540220['where']=_['merge'](_0x540220[_0x8471('0x44')],{'$or':_[_0x8471('0x21')](_0x540220[_0x8471('0x31')],function(_0x2e1079){var _0x2be6a6={};_0x2be6a6[_0x2e1079]={'$like':'%'+_0x47242c[_0x8471('0x2e')][_0x8471('0x46')]+'%'};return _0x2be6a6;})});}if(_0x47242c['query']['$gte']){var _0x49c511=_0x47242c[_0x8471('0x2e')]['$gte'][_0x8471('0x47')](',');var _0x383bcf={};_0x383bcf[_0x49c511[0x0]]={'$gte':moment(_0x49c511[0x1])[_0x8471('0x48')](_0x8471('0x49'))};_0x540220[_0x8471('0x44')]=_[_0x8471('0x37')](_0x540220[_0x8471('0x44')],_0x383bcf);}_0x540220=_[_0x8471('0x37')]({},_0x540220,_0x47242c[_0x8471('0x38')]);return db[_0x8471('0x3e')][_0x8471('0x19')]({'where':_0x540220[_0x8471('0x44')]})[_0x8471('0x1c')](function(_0x132e49){_0x34df0d[_0x8471('0x19')]=_0x132e49;if(_0x47242c[_0x8471('0x2e')][_0x8471('0x35')]){_0x540220[_0x8471('0x36')]=[{'all':!![]}];}return db[_0x8471('0x3e')][_0x8471('0x26')](_0x540220);})[_0x8471('0x1c')](function(_0x2cb4a1){_0x34df0d[_0x8471('0x4a')]=_0x2cb4a1;return _0x34df0d;});}})[_0x8471('0x1c')](respondWithFilteredResult(_0x115e2c,_0x540220))[_0x8471('0x29')](handleError(_0x115e2c,null));};exports[_0x8471('0x4b')]=function(_0x30be15,_0x23bbb3){return db[_0x8471('0x22')][_0x8471('0x39')]({'where':{'id':_0x30be15[_0x8471('0x2b')]['id']}})[_0x8471('0x1c')](handleEntityNotFound(_0x23bbb3,null))[_0x8471('0x1c')](function(_0x2915bb){if(_0x2915bb){return _0x2915bb[_0x8471('0x4c')](_0x30be15['body']['ids'],_[_0x8471('0x4d')](_0x30be15[_0x8471('0x3b')],[_0x8471('0x3f'),'id'])||{})[_0x8471('0x4e')](function(){return db[_0x8471('0x4f')][_0x8471('0x26')]({'attributes':['id','name',_0x8471('0x50')],'where':{'id':_0x30be15[_0x8471('0x3b')][_0x8471('0x3f')]}});})[_0x8471('0x1c')](function(_0x562c9f){socket[_0x8471('0x51')](_0x8471('0x52'),{'id':Number(_0x30be15['params']['id']),'tags':_0x562c9f||[]});return{'id':Number(_0x30be15[_0x8471('0x2b')]['id']),'tags':_0x562c9f||[]};});}})[_0x8471('0x1c')](respondWithResult(_0x23bbb3,null))[_0x8471('0x29')](handleError(_0x23bbb3,null));};exports['removeTags']=function(_0x37c811,_0x3a4280){return db[_0x8471('0x22')][_0x8471('0x39')]({'where':{'id':_0x37c811[_0x8471('0x2b')]['id']}})[_0x8471('0x1c')](handleEntityNotFound(_0x3a4280,null))[_0x8471('0x1c')](function(_0x432682){if(_0x432682){return _0x432682['removeTags'](_0x37c811[_0x8471('0x2e')][_0x8471('0x3f')]);}})[_0x8471('0x1c')](respondWithStatusCode(_0x3a4280,null))['catch'](handleError(_0x3a4280,null));};exports['download']=function(_0x18fc5c,_0x1e298d){var _0x954b97=moment()['unix']()['toString']();var _0x29b39d=path['join'](config[_0x8471('0x53')],_0x8471('0x54'),_0x8471('0x55'),_0x8471('0x56'));var _0x265512=path[_0x8471('0x57')](_0x29b39d,_0x954b97);var _0x5f54f1=util[_0x8471('0x48')]('transcript-%d-%s.zip',_0x18fc5c['params']['id'],_0x954b97);var _0x24dd2d=path[_0x8471('0x57')](_0x29b39d,_0x5f54f1);var _0x10a2e4=[];_0x10a2e4['push']({'model':db[_0x8471('0x58')],'as':_0x8471('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x10a2e4[_0x8471('0x59')]({'model':db['CmContact'],'as':_0x8471('0x5a'),'attributes':['id',_0x8471('0x5b'),_0x8471('0x5c')],'raw':!![]});var _0x2fa7f4=[{'model':db[_0x8471('0x3e')],'as':_0x8471('0x5d'),'attributes':['id',_0x8471('0x3b'),'createdAt','direction',_0x8471('0x5e'),_0x8471('0x5f')],'include':_0x10a2e4}];_0x2fa7f4[_0x8471('0x59')]({'model':db[_0x8471('0x60')],'as':_0x8471('0x61'),'attributes':['id','name']});_0x2fa7f4[_0x8471('0x59')]({'model':db['User'],'as':_0x8471('0x62'),'attributes':['id',_0x8471('0x63')]});return db[_0x8471('0x22')][_0x8471('0x39')]({'where':{'id':_0x18fc5c[_0x8471('0x2b')]['id']},'include':_0x2fa7f4})[_0x8471('0x1c')](handleEntityNotFound(_0x1e298d,null))['then'](function(_0x2d12a6){if(_0x2d12a6){var _0x2d7756=_0x2d12a6[_0x8471('0x64')]({'plain':!![]});fs[_0x8471('0x65')](_0x265512);var _0x44f847={'channel':'Sms','account':_0x2d7756['Account'][_0x8471('0x1f')],'agent':_0x2d7756[_0x8471('0x62')]?_0x2d7756[_0x8471('0x62')][_0x8471('0x63')]:_0x8471('0x66'),'createdAt':moment(_0x2d7756['createdAt'])['format'](_0x8471('0x49'))[_0x8471('0x67')](),'closedAt':_0x2d7756['closed']?moment(_0x2d7756[_0x8471('0x68')])[_0x8471('0x48')](_0x8471('0x49'))[_0x8471('0x67')]():'','disposition':_0x2d7756[_0x8471('0x69')],'messages':_(_0x2d7756[_0x8471('0x5d')])['filter']({'secret':![]})['map'](function(_0x5892ce){return{'date':moment(_0x5892ce[_0x8471('0x6a')])['format'](_0x8471('0x49'))['toString'](),'sender':_0x5892ce[_0x8471('0x6b')]===_0x8471('0x6c')?_0x5892ce[_0x8471('0x58')]?_0x5892ce[_0x8471('0x58')]['fullname']:_0x8471('0x6d'):_0x5892ce['Contact'][_0x8471('0x5b')]+(_0x5892ce[_0x8471('0x5a')][_0x8471('0x5c')]?'\x20'+_0x5892ce[_0x8471('0x5a')]['lastName']:''),'body':_0x5892ce[_0x8471('0x3b')],'direction':_0x5892ce['direction']===_0x8471('0x6c')?'A':'C','secret':_0x5892ce[_0x8471('0x5e')],'read':_0x5892ce[_0x8471('0x5f')]};})[_0x8471('0x6e')]()};return ejs[_0x8471('0x6f')](path['join'](config['root'],_0x8471('0x54'),_0x8471('0x70'),_0x8471('0x71')),{'interaction':_0x44f847})[_0x8471('0x1c')](function(_0x357631){var _0x125fd8=path[_0x8471('0x57')](_0x265512,_0x8471('0x72')+_0x2d7756['id']+'-'+_0x954b97+_0x8471('0x73'));var _0x2f9842={'path':_0x125fd8,'channel':_0x8471('0x74'),'interactionId':_0x2d7756['id']};return pdf[_0x8471('0x75')](_0x357631,_0x2f9842);})[_0x8471('0x1c')](function(){return new BPromise(function(_0x1fea14,_0x407413){zipdir(_0x265512,{'saveTo':_0x24dd2d},function(_0x900541,_0x30ee00){if(_0x900541)return _0x407413(_0x900541);return _0x1fea14(_0x30ee00);});})[_0x8471('0x1c')](function(){return new BPromise(function(_0x2d0afd,_0x856edd){rimraf(_0x265512,function(_0x166399){if(_0x166399)_0x856edd(_0x166399);return _0x2d0afd();});});})[_0x8471('0x1c')](function(){return _0x1e298d[_0x8471('0x76')](_0x24dd2d,_0x5f54f1,function(_0xbce051){if(_0xbce051){console['log'](_0x8471('0x77'),_0xbce051);}else{fs[_0x8471('0x78')](_0x24dd2d);}});});});}else{return _0x1e298d[_0x8471('0x79')](0xc8);}})[_0x8471('0x29')](handleError(_0x1e298d,null));}; \ No newline at end of file +var _0x5423=['ids','omit','getMessages','hasOwnProperty','nolimit','sort','where','pick','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','format','push','User','fullname','firstName','lastName','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','N.A.','closed','closedAt','disposition','out','System','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','rimraf','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','index','map','SmsInteraction','rawAttributes','fieldName','key','findAll','sms','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','update','body','describe','addMessage'];(function(_0x26d219,_0x595708){var _0x3128f2=function(_0x537834){while(--_0x537834){_0x26d219['push'](_0x26d219['shift']());}};_0x3128f2(++_0x595708);}(_0x5423,0x19c));var _0x3542=function(_0x35ef4c,_0x561012){_0x35ef4c=_0x35ef4c-0x0;var _0x46998b=_0x5423[_0x35ef4c];return _0x46998b;};'use strict';var rimraf=require(_0x3542('0x0'));var zipdir=require('zip-dir');var moment=require(_0x3542('0x1'));var BPromise=require(_0x3542('0x2'));var util=require(_0x3542('0x3'));var path=require(_0x3542('0x4'));var ejs=require(_0x3542('0x5'));var fs=require('fs');var _=require(_0x3542('0x6'));var Redis=require(_0x3542('0x7'));var interaction=require(_0x3542('0x8'));var qs=require(_0x3542('0x9'));var pdf=require(_0x3542('0xa'));var logger=require('../../config/logger')(_0x3542('0xb'));var config=require(_0x3542('0xc'));var db=require(_0x3542('0xd'))['db'];config[_0x3542('0xe')]=_[_0x3542('0xf')](config[_0x3542('0xe')],{'host':_0x3542('0x10'),'port':0x18eb});var socket=require(_0x3542('0x11'))(new Redis(config[_0x3542('0xe')]));require(_0x3542('0x12'))[_0x3542('0x13')](socket);function respondWithStatusCode(_0x3e0f4c,_0x4cdfe7){_0x4cdfe7=_0x4cdfe7||0xcc;return function(_0x417190){if(_0x417190){return _0x3e0f4c[_0x3542('0x14')](_0x4cdfe7);}return _0x3e0f4c[_0x3542('0x15')](_0x4cdfe7)[_0x3542('0x16')]();};}function respondWithResult(_0xb42657,_0x1ad16d){_0x1ad16d=_0x1ad16d||0xc8;return function(_0x29efa1){if(_0x29efa1){return _0xb42657[_0x3542('0x15')](_0x1ad16d)[_0x3542('0x17')](_0x29efa1);}};}function respondWithFilteredResult(_0x283d7d,_0x1819a8){return function(_0x244642){if(_0x244642){var _0x2fe399=typeof _0x1819a8[_0x3542('0x18')]===_0x3542('0x19')&&typeof _0x1819a8[_0x3542('0x1a')]===_0x3542('0x19');var _0x3c6835=_0x244642[_0x3542('0x1b')];var _0xcae25e=_0x2fe399?0x0:_0x1819a8['offset'];var _0x349d4b=_0x2fe399?_0x244642[_0x3542('0x1b')]:_0x1819a8['offset']+_0x1819a8['limit'];var _0x3dae83;if(_0x349d4b>=_0x3c6835){_0x349d4b=_0x3c6835;_0x3dae83=0xc8;}else{_0x3dae83=0xce;}_0x283d7d[_0x3542('0x15')](_0x3dae83);return _0x283d7d[_0x3542('0x1c')](_0x3542('0x1d'),_0xcae25e+'-'+_0x349d4b+'/'+_0x3c6835)[_0x3542('0x17')](_0x244642);}return null;};}function saveUpdates(_0x1e59b3){return function(_0x1555e6){if(_0x1555e6){return _0x1555e6['update'](_0x1e59b3)[_0x3542('0x1e')](function(_0x449cf0){return _0x449cf0;});}return null;};}function removeEntity(_0x31aac7){return function(_0x2dd095){if(_0x2dd095){return _0x2dd095[_0x3542('0x1f')]()[_0x3542('0x1e')](function(){_0x31aac7[_0x3542('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ed858){return function(_0x5f4ab0){if(!_0x5f4ab0){_0x5ed858['sendStatus'](0x194);}return _0x5f4ab0;};}function handleError(_0x5253e1,_0x30fbf7){_0x30fbf7=_0x30fbf7||0x1f4;return function(_0x405599){logger[_0x3542('0x20')](_0x405599[_0x3542('0x21')]);if(_0x405599['name']){delete _0x405599[_0x3542('0x22')];}_0x5253e1[_0x3542('0x15')](_0x30fbf7)['send'](_0x405599);};}exports[_0x3542('0x23')]=function(_0x47035c,_0x1dcb43){var _0x589aa1={};var _0x4ca952=_[_0x3542('0x24')](db[_0x3542('0x25')][_0x3542('0x26')],function(_0x59c12f){return{'name':_0x59c12f[_0x3542('0x27')],'type':_0x59c12f['type'][_0x3542('0x28')]};});_0x589aa1=qs['getOptions'](_0x4ca952,_0x47035c);return interaction[_0x3542('0x29')](_0x3542('0x2a'),_0x47035c['query'],_0x47035c['user'],_0x589aa1,_0x4ca952)['then'](respondWithFilteredResult(_0x1dcb43,_0x589aa1))[_0x3542('0x2b')](handleError(_0x1dcb43,null));};exports[_0x3542('0x2c')]=function(_0x4abaa9,_0x3694db){var _0x278477={'raw':![],'where':{'id':_0x4abaa9[_0x3542('0x2d')]['id']}},_0x3b47ed={};_0x3b47ed[_0x3542('0x2e')]=_[_0x3542('0x2f')](db['SmsInteraction']['rawAttributes']);_0x3b47ed[_0x3542('0x30')]=_['keys'](_0x4abaa9[_0x3542('0x30')]);_0x3b47ed[_0x3542('0x31')]=_[_0x3542('0x32')](_0x3b47ed[_0x3542('0x2e')],_0x3b47ed[_0x3542('0x30')]);_0x278477[_0x3542('0x33')]=_[_0x3542('0x32')](_0x3b47ed[_0x3542('0x2e')],qs['fields'](_0x4abaa9[_0x3542('0x30')][_0x3542('0x34')]));_0x278477[_0x3542('0x33')]=_0x278477[_0x3542('0x33')][_0x3542('0x35')]?_0x278477['attributes']:_0x3b47ed[_0x3542('0x2e')];if(_0x4abaa9['query'][_0x3542('0x36')]){_0x278477[_0x3542('0x37')]=[{'all':!![]}];}_0x278477=_[_0x3542('0x38')]({},_0x278477,_0x4abaa9[_0x3542('0x39')]);return db[_0x3542('0x25')][_0x3542('0x3a')](_0x278477)[_0x3542('0x1e')](handleEntityNotFound(_0x3694db,null))[_0x3542('0x1e')](respondWithResult(_0x3694db,null))[_0x3542('0x2b')](handleError(_0x3694db,null));};exports[_0x3542('0x3b')]=function(_0x522e14,_0x15d404){return db[_0x3542('0x25')]['create'](_0x522e14['body'],{})[_0x3542('0x1e')](respondWithResult(_0x15d404,0xc9))[_0x3542('0x2b')](handleError(_0x15d404,null));};exports[_0x3542('0x3c')]=function(_0x440f07,_0x48920c){if(_0x440f07['body']['id']){delete _0x440f07[_0x3542('0x3d')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x440f07['params']['id']}})[_0x3542('0x1e')](handleEntityNotFound(_0x48920c,null))[_0x3542('0x1e')](saveUpdates(_0x440f07[_0x3542('0x3d')],null))[_0x3542('0x1e')](respondWithResult(_0x48920c,null))['catch'](handleError(_0x48920c,null));};exports[_0x3542('0x1f')]=function(_0x1ef6b7,_0x3c13d5){return db['SmsInteraction'][_0x3542('0x3a')]({'where':{'id':_0x1ef6b7['params']['id']}})[_0x3542('0x1e')](handleEntityNotFound(_0x3c13d5,null))[_0x3542('0x1e')](removeEntity(_0x3c13d5,null))[_0x3542('0x2b')](handleError(_0x3c13d5,null));};exports[_0x3542('0x3e')]=function(_0x472c0b,_0xa83995){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0xa83995,null))['catch'](handleError(_0xa83995,null));};exports[_0x3542('0x3f')]=function(_0x24a2a0,_0x5df376){return db['SmsMessage']['find']({'where':{'id':_0x24a2a0['params']['id']}})[_0x3542('0x1e')](handleEntityNotFound(_0x5df376,null))[_0x3542('0x1e')](function(_0x191d5a){if(_0x191d5a){return _0x191d5a[_0x3542('0x3f')](_0x24a2a0['body'][_0x3542('0x40')],_[_0x3542('0x41')](_0x24a2a0[_0x3542('0x3d')],['ids','id'])||{});}})[_0x3542('0x1e')](respondWithResult(_0x5df376,null))[_0x3542('0x2b')](handleError(_0x5df376,null));};exports[_0x3542('0x42')]=function(_0x51dae3,_0x1e5bf9){var _0x3835ca={'raw':![],'where':{}};var _0x1599a1={};var _0x51a807={'count':0x0,'rows':[]};return db[_0x3542('0x25')]['findOne']({'where':{'id':_0x51dae3[_0x3542('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1e5bf9,null))[_0x3542('0x1e')](function(_0x39f4b1){if(_0x39f4b1){_0x1599a1['model']=_['keys'](db['SmsMessage'][_0x3542('0x26')]);_0x1599a1[_0x3542('0x30')]=_[_0x3542('0x2f')](_0x51dae3[_0x3542('0x30')]);_0x1599a1[_0x3542('0x31')]=_['intersection'](_0x1599a1[_0x3542('0x2e')],_0x1599a1['query']);_0x3835ca[_0x3542('0x33')]=_[_0x3542('0x32')](_0x1599a1[_0x3542('0x2e')],qs[_0x3542('0x34')](_0x51dae3['query'][_0x3542('0x34')]));_0x3835ca[_0x3542('0x33')]=_0x3835ca[_0x3542('0x33')][_0x3542('0x35')]?_0x3835ca[_0x3542('0x33')]:_0x1599a1[_0x3542('0x2e')];if(!_0x51dae3[_0x3542('0x30')][_0x3542('0x43')](_0x3542('0x44'))){_0x3835ca[_0x3542('0x1a')]=qs[_0x3542('0x1a')](_0x51dae3['query']['limit']);_0x3835ca['offset']=qs[_0x3542('0x18')](_0x51dae3['query'][_0x3542('0x18')]);}_0x3835ca['order']=qs['sort'](_0x51dae3[_0x3542('0x30')][_0x3542('0x45')]);_0x3835ca[_0x3542('0x46')]=qs['filters'](_[_0x3542('0x47')](_0x51dae3[_0x3542('0x30')],_0x1599a1[_0x3542('0x31')]));_0x3835ca[_0x3542('0x46')][_0x3542('0x48')]=_0x39f4b1['id'];if(_0x51dae3[_0x3542('0x30')][_0x3542('0x49')]){_0x3835ca[_0x3542('0x46')]=_[_0x3542('0x38')](_0x3835ca[_0x3542('0x46')],{'$or':_[_0x3542('0x24')](_0x3835ca[_0x3542('0x33')],function(_0xd9aded){var _0x37c172={};_0x37c172[_0xd9aded]={'$like':'%'+_0x51dae3[_0x3542('0x30')][_0x3542('0x49')]+'%'};return _0x37c172;})});}if(_0x51dae3[_0x3542('0x30')]['$gte']){var _0x1951a0=_0x51dae3[_0x3542('0x30')][_0x3542('0x4a')][_0x3542('0x4b')](',');var _0x2b6bdc={};_0x2b6bdc[_0x1951a0[0x0]]={'$gte':moment(_0x1951a0[0x1])['format'](_0x3542('0x4c'))};_0x3835ca[_0x3542('0x46')]=_['merge'](_0x3835ca['where'],_0x2b6bdc);}_0x3835ca=_['merge']({},_0x3835ca,_0x51dae3[_0x3542('0x39')]);return db['SmsMessage'][_0x3542('0x1b')]({'where':_0x3835ca[_0x3542('0x46')]})['then'](function(_0x27c79e){_0x51a807[_0x3542('0x1b')]=_0x27c79e;if(_0x51dae3[_0x3542('0x30')][_0x3542('0x36')]){_0x3835ca[_0x3542('0x37')]=[{'all':!![]}];}return db[_0x3542('0x4d')]['findAll'](_0x3835ca);})[_0x3542('0x1e')](function(_0x4519b8){_0x51a807['rows']=_0x4519b8;return _0x51a807;});}})[_0x3542('0x1e')](respondWithFilteredResult(_0x1e5bf9,_0x3835ca))[_0x3542('0x2b')](handleError(_0x1e5bf9,null));};exports['addTags']=function(_0x30104e,_0xb071ee){return db[_0x3542('0x25')][_0x3542('0x3a')]({'where':{'id':_0x30104e[_0x3542('0x2d')]['id']}})[_0x3542('0x1e')](handleEntityNotFound(_0xb071ee,null))[_0x3542('0x1e')](function(_0x432801){if(_0x432801){return _0x432801[_0x3542('0x4e')](_0x30104e[_0x3542('0x3d')]['ids'],_[_0x3542('0x41')](_0x30104e[_0x3542('0x3d')],[_0x3542('0x40'),'id'])||{})[_0x3542('0x4f')](function(){return db['Tag'][_0x3542('0x29')]({'attributes':['id',_0x3542('0x22'),_0x3542('0x50')],'where':{'id':_0x30104e[_0x3542('0x3d')][_0x3542('0x40')]}});})[_0x3542('0x1e')](function(_0x5252d2){socket[_0x3542('0x51')](_0x3542('0x52'),{'id':Number(_0x30104e['params']['id']),'tags':_0x5252d2||[]});return{'id':Number(_0x30104e[_0x3542('0x2d')]['id']),'tags':_0x5252d2||[]};});}})[_0x3542('0x1e')](respondWithResult(_0xb071ee,null))[_0x3542('0x2b')](handleError(_0xb071ee,null));};exports[_0x3542('0x53')]=function(_0x3eadfc,_0x405640){return db[_0x3542('0x25')]['find']({'where':{'id':_0x3eadfc[_0x3542('0x2d')]['id']}})['then'](handleEntityNotFound(_0x405640,null))[_0x3542('0x1e')](function(_0xae4cf){if(_0xae4cf){return _0xae4cf[_0x3542('0x53')](_0x3eadfc[_0x3542('0x30')][_0x3542('0x40')]);}})[_0x3542('0x1e')](respondWithStatusCode(_0x405640,null))['catch'](handleError(_0x405640,null));};exports[_0x3542('0x54')]=function(_0x5f1cec,_0x4285cd){var _0x3088af=moment()[_0x3542('0x55')]()[_0x3542('0x56')]();var _0x1563ed=path[_0x3542('0x57')](config[_0x3542('0x58')],_0x3542('0x59'),_0x3542('0x5a'),'tmp');var _0x274819=path['join'](_0x1563ed,_0x3088af);var _0x27abca=util[_0x3542('0x5b')]('transcript-%d-%s.zip',_0x5f1cec['params']['id'],_0x3088af);var _0x6b71db=path['join'](_0x1563ed,_0x27abca);var _0x8e9ac8=[];_0x8e9ac8[_0x3542('0x5c')]({'model':db[_0x3542('0x5d')],'as':_0x3542('0x5d'),'attributes':['id',_0x3542('0x5e')],'raw':!![]});_0x8e9ac8[_0x3542('0x5c')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x3542('0x5f'),_0x3542('0x60')],'raw':!![]});var _0x2933f0=[{'model':db[_0x3542('0x4d')],'as':'Messages','attributes':['id','body',_0x3542('0x61'),_0x3542('0x62'),_0x3542('0x63'),_0x3542('0x64')],'include':_0x8e9ac8}];_0x2933f0[_0x3542('0x5c')]({'model':db[_0x3542('0x65')],'as':_0x3542('0x66'),'attributes':['id',_0x3542('0x22')]});_0x2933f0[_0x3542('0x5c')]({'model':db['User'],'as':_0x3542('0x67'),'attributes':['id',_0x3542('0x5e')]});return db[_0x3542('0x25')][_0x3542('0x3a')]({'where':{'id':_0x5f1cec[_0x3542('0x2d')]['id']},'include':_0x2933f0})[_0x3542('0x1e')](handleEntityNotFound(_0x4285cd,null))[_0x3542('0x1e')](function(_0x3cc484){if(_0x3cc484){var _0x25bc19=_0x3cc484['get']({'plain':!![]});fs[_0x3542('0x68')](_0x274819);var _0x2f06e4={'channel':'Sms','account':_0x25bc19[_0x3542('0x66')][_0x3542('0x22')],'agent':_0x25bc19[_0x3542('0x67')]?_0x25bc19[_0x3542('0x67')][_0x3542('0x5e')]:_0x3542('0x69'),'createdAt':moment(_0x25bc19['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3542('0x56')](),'closedAt':_0x25bc19[_0x3542('0x6a')]?moment(_0x25bc19[_0x3542('0x6b')])[_0x3542('0x5b')](_0x3542('0x4c'))[_0x3542('0x56')]():'','disposition':_0x25bc19[_0x3542('0x6c')],'messages':_(_0x25bc19['Messages'])[_0x3542('0x49')]({'secret':![]})['map'](function(_0x26b92d){return{'date':moment(_0x26b92d[_0x3542('0x61')])[_0x3542('0x5b')](_0x3542('0x4c'))[_0x3542('0x56')](),'sender':_0x26b92d['direction']===_0x3542('0x6d')?_0x26b92d[_0x3542('0x5d')]?_0x26b92d[_0x3542('0x5d')][_0x3542('0x5e')]:_0x3542('0x6e'):_0x26b92d[_0x3542('0x6f')]['firstName']+(_0x26b92d[_0x3542('0x6f')][_0x3542('0x60')]?'\x20'+_0x26b92d[_0x3542('0x6f')]['lastName']:''),'body':_0x26b92d[_0x3542('0x3d')],'direction':_0x26b92d[_0x3542('0x62')]==='out'?'A':'C','secret':_0x26b92d[_0x3542('0x63')],'read':_0x26b92d[_0x3542('0x64')]};})[_0x3542('0x70')]()};return ejs[_0x3542('0x71')](path[_0x3542('0x57')](config[_0x3542('0x58')],_0x3542('0x59'),_0x3542('0x72'),_0x3542('0x73')),{'interaction':_0x2f06e4})['then'](function(_0x3b8776){var _0x377bce=path['join'](_0x274819,_0x3542('0x74')+_0x25bc19['id']+'-'+_0x3088af+_0x3542('0x75'));var _0x501277={'path':_0x377bce,'channel':'Sms','interactionId':_0x25bc19['id']};return pdf['createPdfFromHTML'](_0x3b8776,_0x501277);})['then'](function(){return new BPromise(function(_0x36119b,_0x148575){zipdir(_0x274819,{'saveTo':_0x6b71db},function(_0x51c9eb,_0x530aa5){if(_0x51c9eb)return _0x148575(_0x51c9eb);return _0x36119b(_0x530aa5);});})[_0x3542('0x1e')](function(){return new BPromise(function(_0x4e24dc,_0x29246e){rimraf(_0x274819,function(_0x442777){if(_0x442777)_0x29246e(_0x442777);return _0x4e24dc();});});})['then'](function(){return _0x4285cd[_0x3542('0x54')](_0x6b71db,_0x27abca,function(_0x8803d1){if(_0x8803d1){console['log'](_0x3542('0x76'),_0x8803d1);}else{fs['unlinkSync'](_0x6b71db);}});});});}else{return _0x4285cd[_0x3542('0x14')](0xc8);}})[_0x3542('0x2b')](handleError(_0x4285cd,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9165959..d579e27 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 _0xfef3=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0xe4a8c1,_0x40ca36){var _0x359e24=function(_0x4e8569){while(--_0x4e8569){_0xe4a8c1['push'](_0xe4a8c1['shift']());}};_0x359e24(++_0x40ca36);}(_0xfef3,0x118));var _0x3fef=function(_0x3d754d,_0x71aad){_0x3d754d=_0x3d754d-0x0;var _0x59f912=_0xfef3[_0x3d754d];return _0x59f912;};'use strict';var EventEmitter=require(_0x3fef('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x3fef('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x3fef('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3fef('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fef('0x4'),'afterDestroy':_0x3fef('0x5')};function emitEvent(_0x538f28){return function(_0x2f88b8,_0x1351b1,_0x5dd9fb){_0x2f88b8[_0x3fef('0x6')]({'attributes':['id'],'raw':!![]})[_0x3fef('0x7')](function(_0x800850){_0x2f88b8[_0x3fef('0x8')](_0x3fef('0x9'),_0x800850[_0x3fef('0xa')](function(_0x356ad8){return{'id':_0x356ad8['id']};}));return SmsMessage[_0x3fef('0xb')]({'where':{'SmsInteractionId':_0x2f88b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3fef('0x7')](function(_0x307586){_0x2f88b8[_0x3fef('0x8')](_0x3fef('0xc'),_0x307586[_0x3fef('0xd')]);SmsInteractionEvents[_0x3fef('0xe')](_0x538f28+':'+_0x2f88b8['id'],_0x2f88b8);SmsInteractionEvents['emit'](_0x538f28,_0x2f88b8);_0x5dd9fb(null);})[_0x3fef('0xf')](_0x5dd9fb(null));};}for(var e in events){if(events[_0x3fef('0x10')](e)){var event=events[e];SmsInteraction[_0x3fef('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x47c5=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x424bd3,_0x8760d8){var _0x1fdade=function(_0x510862){while(--_0x510862){_0x424bd3['push'](_0x424bd3['shift']());}};_0x1fdade(++_0x8760d8);}(_0x47c5,0x165));var _0x547c=function(_0xf3807a,_0x29e20e){_0xf3807a=_0xf3807a-0x0;var _0x562bf6=_0x47c5[_0xf3807a];return _0x562bf6;};'use strict';var EventEmitter=require(_0x547c('0x0'));var SmsInteraction=require(_0x547c('0x1'))['db'][_0x547c('0x2')];var SmsMessage=require(_0x547c('0x1'))['db'][_0x547c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x547c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x547c('0x5'),'afterDestroy':_0x547c('0x6')};function emitEvent(_0x5b48c9){return function(_0x3e827e,_0x468220,_0x51ab7f){_0x3e827e[_0x547c('0x7')]({'attributes':['id'],'raw':!![]})[_0x547c('0x8')](function(_0x381f2e){_0x3e827e[_0x547c('0x9')](_0x547c('0xa'),_0x381f2e[_0x547c('0xb')](function(_0x3e2279){return{'id':_0x3e2279['id']};}));return SmsMessage[_0x547c('0xc')]({'where':{'SmsInteractionId':_0x3e827e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x547c('0x8')](function(_0x44a581){_0x3e827e[_0x547c('0x9')](_0x547c('0xd'),_0x44a581[_0x547c('0xe')]);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9+':'+_0x3e827e['id'],_0x3e827e);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9,_0x3e827e);_0x51ab7f(null);})[_0x547c('0x10')](_0x51ab7f(null));};}for(var e in events){if(events[_0x547c('0x11')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x547c('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 95f7e0e..591177d 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 _0x4df3=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','SmsInteraction','sms_interactions','closedAt','format'];(function(_0x5b4f98,_0x4e2213){var _0x1f5022=function(_0x32b3f5){while(--_0x32b3f5){_0x5b4f98['push'](_0x5b4f98['shift']());}};_0x1f5022(++_0x4e2213);}(_0x4df3,0x155));var _0x34df=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x4df3[_0x40df5f];return _0x1573f1;};'use strict';var _=require(_0x34df('0x0'));var util=require(_0x34df('0x1'));var logger=require(_0x34df('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34df('0x4'));var rimraf=require(_0x34df('0x5'));var config=require(_0x34df('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3fe842,_0x1e4daf){return _0x3fe842['define'](_0x34df('0x7'),attributes,{'tableName':_0x34df('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3814b0,_0x5ce58d,_0x5628d2){if(_0x3814b0['changed']('closed')){_0x3814b0[_0x34df('0x9')]=moment()[_0x34df('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5628d2(null,_0x3814b0);}}});}; \ No newline at end of file +var _0x373b=['path','rimraf','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','util','moment','bluebird','request-promise'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x373b,0x154));var _0xb373=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x373b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb373('0x0'));var util=require(_0xb373('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb373('0x2'));var BPromise=require(_0xb373('0x3'));var rp=require(_0xb373('0x4'));var fs=require('fs');var path=require(_0xb373('0x5'));var rimraf=require(_0xb373('0x6'));var config=require('../../config/environment');var attributes=require(_0xb373('0x7'));module['exports']=function(_0x2f232e,_0x241d8e){return _0x2f232e[_0xb373('0x8')](_0xb373('0x9'),attributes,{'tableName':_0xb373('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x262d93,_0x1a3dff,_0xcc7d37){if(_0x262d93[_0xb373('0xb')](_0xb373('0xc'))){_0x262d93[_0xb373('0xd')]=moment()[_0xb373('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xcc7d37(null,_0x262d93);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 2a2397e..90c4973 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 _0x0ff9=['catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0x0ff9,0x182));var _0x90ff=function(_0x4fa07d,_0x3e23c8){_0x4fa07d=_0x4fa07d-0x0;var _0x582c26=_0x0ff9[_0x4fa07d];return _0x582c26;};'use strict';var _=require('lodash');var util=require(_0x90ff('0x0'));var moment=require('moment');var BPromise=require(_0x90ff('0x1'));var rs=require(_0x90ff('0x2'));var fs=require('fs');var Redis=require(_0x90ff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x90ff('0x4'));var logger=require(_0x90ff('0x5'))(_0x90ff('0x6'));var config=require(_0x90ff('0x7'));var jayson=require(_0x90ff('0x8'));var client=jayson[_0x90ff('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x90ff('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x90ff('0xb'))(new Redis(config[_0x90ff('0xa')]));require(_0x90ff('0xc'))['register'](socket);function respondWithRpcPromise(_0x2dfa20,_0x28e197,_0x3929a6){return new BPromise(function(_0x1b7678,_0x4745b9){return client[_0x90ff('0xd')](_0x2dfa20,_0x3929a6)[_0x90ff('0xe')](function(_0x2d713a){logger[_0x90ff('0xf')](_0x90ff('0x10'),_0x28e197,_0x90ff('0x11'));logger[_0x90ff('0x12')](_0x90ff('0x13'),_0x28e197,_0x90ff('0x11'),JSON['stringify'](_0x2d713a));if(_0x2d713a[_0x90ff('0x14')]){if(_0x2d713a[_0x90ff('0x14')][_0x90ff('0x15')]===0x1f4){logger['error'](_0x90ff('0x10'),_0x28e197,_0x2d713a[_0x90ff('0x14')]['message']);return _0x4745b9(_0x2d713a[_0x90ff('0x14')][_0x90ff('0x16')]);}logger[_0x90ff('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x28e197,_0x2d713a[_0x90ff('0x14')][_0x90ff('0x16')]);return _0x1b7678(_0x2d713a[_0x90ff('0x14')][_0x90ff('0x16')]);}else{logger['info'](_0x90ff('0x10'),_0x28e197,_0x90ff('0x11'));_0x1b7678(_0x2d713a[_0x90ff('0x17')]['message']);}})[_0x90ff('0x18')](function(_0x5cc98f){logger[_0x90ff('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x28e197,_0x5cc98f);_0x4745b9(_0x5cc98f);});});}exports[_0x90ff('0x19')]=function(_0x1e82af){var _0x3a20e1=this;return new Promise(function(_0x397ba6,_0x38669d){return db[_0x90ff('0x1a')][_0x90ff('0x1b')](_0x1e82af['body'],{'raw':_0x1e82af[_0x90ff('0x1c')]?_0x1e82af[_0x90ff('0x1c')][_0x90ff('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e82af[_0x90ff('0x1c')]?_0x1e82af[_0x90ff('0x1c')][_0x90ff('0x1e')]||null:null,'attributes':_0x1e82af[_0x90ff('0x1c')]?_0x1e82af[_0x90ff('0x1c')][_0x90ff('0x1f')]||null:null,'limit':_0x1e82af[_0x90ff('0x1c')]?_0x1e82af['options'][_0x90ff('0x20')]||null:null})[_0x90ff('0xe')](function(_0x236f77){logger['info'](_0x90ff('0x19'),_0x1e82af);logger[_0x90ff('0x12')](_0x90ff('0x19'),_0x1e82af,JSON['stringify'](_0x236f77));_0x397ba6(_0x236f77);})[_0x90ff('0x18')](function(_0x34709a){logger[_0x90ff('0x14')](_0x90ff('0x19'),_0x34709a[_0x90ff('0x16')],_0x1e82af);_0x38669d(_0x3a20e1['error'](0x1f4,_0x34709a[_0x90ff('0x16')]));});});};exports[_0x90ff('0x21')]=function(_0x54d672){return new Promise(function(_0x23550c,_0x27b956){return db[_0x90ff('0x1a')][_0x90ff('0x22')]({'where':_0x54d672[_0x90ff('0x1c')]?_0x54d672[_0x90ff('0x1c')][_0x90ff('0x1e')]||null:null})[_0x90ff('0xe')](function(_0x3a0a28){if(_0x3a0a28){return _0x3a0a28[_0x90ff('0x23')](_0x54d672[_0x90ff('0x24')][_0x90ff('0x25')],_[_0x90ff('0x26')](_0x54d672[_0x90ff('0x24')],[_0x90ff('0x25'),'id'])||{});}})[_0x90ff('0x27')](function(_0x4901b0){logger['info'](_0x90ff('0x28'),_0x54d672);logger[_0x90ff('0x12')]('AddTags',_0x54d672,JSON['stringify'](_0x4901b0));_0x23550c(_0x4901b0);})[_0x90ff('0x18')](function(_0x29faf1){logger['error'](_0x90ff('0x28'),_0x29faf1[_0x90ff('0x16')],_0x54d672);_0x27b956(_this[_0x90ff('0x14')](0x1f4,_0x29faf1['message']));});});}; \ No newline at end of file +var _0x4c0d=['UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','body','ids','spread','AddTags','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SmsInteraction,\x20%s,\x20%s','result','SmsInteraction','update','options','raw','where','attributes','then'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x4c0d,0x87));var _0xd4c0=function(_0x279a7a,_0x5dcfcc){_0x279a7a=_0x279a7a-0x0;var _0x276b65=_0x4c0d[_0x279a7a];return _0x276b65;};'use strict';var _=require(_0xd4c0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd4c0('0x1'));var rs=require(_0xd4c0('0x2'));var fs=require('fs');var Redis=require(_0xd4c0('0x3'));var db=require(_0xd4c0('0x4'))['db'];var utils=require(_0xd4c0('0x5'));var logger=require(_0xd4c0('0x6'))(_0xd4c0('0x7'));var config=require(_0xd4c0('0x8'));var jayson=require(_0xd4c0('0x9'));var client=jayson['client'][_0xd4c0('0xa')]({'port':0x232a});config[_0xd4c0('0xb')]=_[_0xd4c0('0xc')](config[_0xd4c0('0xb')],{'host':_0xd4c0('0xd'),'port':0x18eb});var socket=require(_0xd4c0('0xe'))(new Redis(config[_0xd4c0('0xb')]));require(_0xd4c0('0xf'))['register'](socket);function respondWithRpcPromise(_0x43cc4f,_0x617eb5,_0x477ff3){return new BPromise(function(_0x1218db,_0x221301){return client[_0xd4c0('0x10')](_0x43cc4f,_0x477ff3)['then'](function(_0x531f47){logger[_0xd4c0('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x617eb5,'request\x20sent');logger[_0xd4c0('0x12')](_0xd4c0('0x13'),_0x617eb5,_0xd4c0('0x14'),JSON['stringify'](_0x531f47));if(_0x531f47[_0xd4c0('0x15')]){if(_0x531f47['error'][_0xd4c0('0x16')]===0x1f4){logger[_0xd4c0('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x617eb5,_0x531f47[_0xd4c0('0x15')]['message']);return _0x221301(_0x531f47[_0xd4c0('0x15')][_0xd4c0('0x17')]);}logger[_0xd4c0('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x617eb5,_0x531f47[_0xd4c0('0x15')][_0xd4c0('0x17')]);return _0x1218db(_0x531f47[_0xd4c0('0x15')][_0xd4c0('0x17')]);}else{logger['info'](_0xd4c0('0x18'),_0x617eb5,_0xd4c0('0x14'));_0x1218db(_0x531f47[_0xd4c0('0x19')][_0xd4c0('0x17')]);}})['catch'](function(_0x2ed9f2){logger[_0xd4c0('0x15')](_0xd4c0('0x18'),_0x617eb5,_0x2ed9f2);_0x221301(_0x2ed9f2);});});}exports['UpdateSmsInteraction']=function(_0x54fbf8){var _0x4ddf34=this;return new Promise(function(_0x1487fb,_0x55f00a){return db[_0xd4c0('0x1a')][_0xd4c0('0x1b')](_0x54fbf8['body'],{'raw':_0x54fbf8[_0xd4c0('0x1c')]?_0x54fbf8[_0xd4c0('0x1c')][_0xd4c0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54fbf8[_0xd4c0('0x1c')]?_0x54fbf8[_0xd4c0('0x1c')][_0xd4c0('0x1e')]||null:null,'attributes':_0x54fbf8[_0xd4c0('0x1c')]?_0x54fbf8[_0xd4c0('0x1c')][_0xd4c0('0x1f')]||null:null,'limit':_0x54fbf8['options']?_0x54fbf8[_0xd4c0('0x1c')]['limit']||null:null})[_0xd4c0('0x20')](function(_0x23a741){logger['info'](_0xd4c0('0x21'),_0x54fbf8);logger[_0xd4c0('0x12')](_0xd4c0('0x21'),_0x54fbf8,JSON['stringify'](_0x23a741));_0x1487fb(_0x23a741);})[_0xd4c0('0x22')](function(_0x13ba48){logger[_0xd4c0('0x15')](_0xd4c0('0x21'),_0x13ba48['message'],_0x54fbf8);_0x55f00a(_0x4ddf34[_0xd4c0('0x15')](0x1f4,_0x13ba48[_0xd4c0('0x17')]));});});};exports[_0xd4c0('0x23')]=function(_0x41362e){return new Promise(function(_0x1076cf,_0x89c4a3){return db[_0xd4c0('0x1a')][_0xd4c0('0x24')]({'where':_0x41362e[_0xd4c0('0x1c')]?_0x41362e[_0xd4c0('0x1c')][_0xd4c0('0x1e')]||null:null})[_0xd4c0('0x20')](function(_0x53f858){if(_0x53f858){return _0x53f858['addTags'](_0x41362e[_0xd4c0('0x25')]['ids'],_['omit'](_0x41362e[_0xd4c0('0x25')],[_0xd4c0('0x26'),'id'])||{});}})[_0xd4c0('0x27')](function(_0x48b311){logger[_0xd4c0('0x11')](_0xd4c0('0x28'),_0x41362e);logger['debug'](_0xd4c0('0x28'),_0x41362e,JSON[_0xd4c0('0x29')](_0x48b311));_0x1076cf(_0x48b311);})[_0xd4c0('0x22')](function(_0x41f398){logger[_0xd4c0('0x15')](_0xd4c0('0x28'),_0x41f398[_0xd4c0('0x17')],_0x41362e);_0x89c4a3(_this['error'](0x1f4,_0x41f398[_0xd4c0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c7c03f8..8610f50 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 _0x8293=['update','removeListener','register','./smsInteraction.events','save'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x8293,0xd0));var _0x3829=function(_0x121239,_0x172a47){_0x121239=_0x121239-0x0;var _0x5c2485=_0x8293[_0x121239];return _0x5c2485;};'use strict';var SmsInteractionEvents=require(_0x3829('0x0'));var events=[_0x3829('0x1'),'remove',_0x3829('0x2')];function createListener(_0x3c7710,_0x48fa94){return function(_0x2bdcfc){_0x48fa94['emit'](_0x3c7710,_0x2bdcfc);};}function removeListener(_0x3a5f27,_0x58f9fe){return function(){SmsInteractionEvents[_0x3829('0x3')](_0x3a5f27,_0x58f9fe);};}exports[_0x3829('0x4')]=function(_0x37d9e5){for(var _0x30ced4=0x0,_0x151b0f=events['length'];_0x30ced4<_0x151b0f;_0x30ced4++){var _0x3891d8=events[_0x30ced4];var _0x5bd9f2=createListener('smsInteraction:'+_0x3891d8,_0x37d9e5);SmsInteractionEvents['on'](_0x3891d8,_0x5bd9f2);}}; \ No newline at end of file +var _0x172d=['smsInteraction:','./smsInteraction.events','save','remove','removeListener','register'];(function(_0x43ed38,_0x507af1){var _0x181497=function(_0x153d8e){while(--_0x153d8e){_0x43ed38['push'](_0x43ed38['shift']());}};_0x181497(++_0x507af1);}(_0x172d,0xfd));var _0xd172=function(_0x35e25c,_0x301f23){_0x35e25c=_0x35e25c-0x0;var _0x5266c6=_0x172d[_0x35e25c];return _0x5266c6;};'use strict';var SmsInteractionEvents=require(_0xd172('0x0'));var events=[_0xd172('0x1'),_0xd172('0x2'),'update'];function createListener(_0x2c1c2c,_0x3cce5a){return function(_0x489197){_0x3cce5a['emit'](_0x2c1c2c,_0x489197);};}function removeListener(_0x5883b6,_0x5f3f47){return function(){SmsInteractionEvents[_0xd172('0x3')](_0x5883b6,_0x5f3f47);};}exports[_0xd172('0x4')]=function(_0x20fcf6){for(var _0x50747c=0x0,_0x2eedb4=events['length'];_0x50747c<_0x2eedb4;_0x50747c++){var _0x5ec820=events[_0x50747c];var _0x29ccd7=createListener(_0xd172('0x5')+_0x5ec820,_0x20fcf6);SmsInteractionEvents['on'](_0x5ec820,_0x29ccd7);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 88335b8..939f304 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 _0x74e0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','delete','destroy','exports','util'];(function(_0x167153,_0x4e651c){var _0x329f71=function(_0x5b7327){while(--_0x5b7327){_0x167153['push'](_0x167153['shift']());}};_0x329f71(++_0x4e651c);}(_0x74e0,0x15e));var _0x074e=function(_0x31ab11,_0x59a7ee){_0x31ab11=_0x31ab11-0x0;var _0x2ecf7f=_0x74e0[_0x31ab11];return _0x2ecf7f;};'use strict';var multer=require('multer');var util=require(_0x074e('0x0'));var path=require('path');var timeout=require(_0x074e('0x1'));var express=require('express');var router=express[_0x074e('0x2')]();var fs_extra=require(_0x074e('0x3'));var auth=require(_0x074e('0x4'));var interaction=require(_0x074e('0x5'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth[_0x074e('0x6')](),controller[_0x074e('0x7')]);router[_0x074e('0x8')](_0x074e('0x9'),auth[_0x074e('0x6')](),controller[_0x074e('0xa')]);router[_0x074e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x074e('0xb')]);router[_0x074e('0xc')]('/',auth['isAuthenticated'](),interaction[_0x074e('0xd')](_0x074e('0xe'),_0x074e('0xf')),controller[_0x074e('0x10')]);router[_0x074e('0xc')](_0x074e('0x11'),controller[_0x074e('0x12')]);router[_0x074e('0x13')](_0x074e('0x14'),auth[_0x074e('0x6')](),controller[_0x074e('0x15')]);router[_0x074e('0x13')](_0x074e('0x16'),auth[_0x074e('0x6')](),controller[_0x074e('0x17')]);router[_0x074e('0x13')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x074e('0x18')](_0x074e('0x14'),auth[_0x074e('0x6')](),controller[_0x074e('0x19')]);module[_0x074e('0x1a')]=router; \ No newline at end of file +var _0x8bf1=['../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','post','tracked','create','/:id/status','put','update','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x72faab,_0x1007a1){var _0x383f3b=function(_0x13d927){while(--_0x13d927){_0x72faab['push'](_0x72faab['shift']());}};_0x383f3b(++_0x1007a1);}(_0x8bf1,0xd5));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x18bf('0x0'));var util=require(_0x18bf('0x1'));var path=require(_0x18bf('0x2'));var timeout=require(_0x18bf('0x3'));var express=require(_0x18bf('0x4'));var router=express[_0x18bf('0x5')]();var fs_extra=require(_0x18bf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x18bf('0x7'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x18bf('0x8')]('/',auth[_0x18bf('0x9')](),controller['index']);router[_0x18bf('0x8')](_0x18bf('0xa'),auth[_0x18bf('0x9')](),controller[_0x18bf('0xb')]);router['get'](_0x18bf('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x18bf('0xd')]('/',auth['isAuthenticated'](),interaction[_0x18bf('0xe')]('sms','smsmessage:create'),controller[_0x18bf('0xf')]);router[_0x18bf('0xd')](_0x18bf('0x10'),controller['status']);router[_0x18bf('0x11')](_0x18bf('0xc'),auth['isAuthenticated'](),controller[_0x18bf('0x12')]);router['put']('/:id/accept',auth[_0x18bf('0x9')](),controller['accept']);router[_0x18bf('0x11')](_0x18bf('0x13'),auth[_0x18bf('0x9')](),controller['reject']);router[_0x18bf('0x14')](_0x18bf('0xc'),auth[_0x18bf('0x9')](),controller[_0x18bf('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f8ec44a..e77505a 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 _0x30bc=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x30bc,0x149));var _0xc30b=function(_0x5a43b8,_0x2e0eb2){_0x5a43b8=_0x5a43b8-0x0;var _0x26eeef=_0x30bc[_0x5a43b8];return _0x26eeef;};'use strict';var Sequelize=require(_0xc30b('0x0'));module[_0xc30b('0x1')]={'body':{'type':Sequelize[_0xc30b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc30b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc30b('0x4')]('in',_0xc30b('0x5')),'defaultValue':_0xc30b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc30b('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc30b('0x6')]},'readAt':{'type':Sequelize[_0xc30b('0x7')]},'secret':{'type':Sequelize[_0xc30b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc30b('0x6')]},'providerResponse':{'type':Sequelize[_0xc30b('0x2')]}}; \ No newline at end of file +var _0x71af=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x11761b,_0x887202){var _0x55057e=function(_0x2955dd){while(--_0x2955dd){_0x11761b['push'](_0x11761b['shift']());}};_0x55057e(++_0x887202);}(_0x71af,0x17d));var _0xf71a=function(_0x4fb166,_0x7ffc6a){_0x4fb166=_0x4fb166-0x0;var _0xb757cf=_0x71af[_0x4fb166];return _0xb757cf;};'use strict';var Sequelize=require(_0xf71a('0x0'));module[_0xf71a('0x1')]={'body':{'type':Sequelize[_0xf71a('0x2')](_0xf71a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf71a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf71a('0x5')]('in',_0xf71a('0x6')),'defaultValue':_0xf71a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf71a('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf71a('0x8')]},'secret':{'type':Sequelize[_0xf71a('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf71a('0x7')]},'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 753a8f0..a6300fd 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 _0xa81d=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','find','create','body','update','describe','sms-interactions','sms','read','user','agent','UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','[SMSMESSAGE: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','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','motionChannel','SmsAccount','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','infobip','results','groupName','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x2d727d,_0x4e7f6c){var _0x4fa2f0=function(_0x128269){while(--_0x128269){_0x2d727d['push'](_0x2d727d['shift']());}};_0x4fa2f0(++_0x4e7f6c);}(_0xa81d,0x11e));var _0xda81=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0xa81d[_0x476c7];return _0x47ae56;};'use strict';var emlformat=require(_0xda81('0x0'));var rimraf=require(_0xda81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda81('0x2'));var rp=require('request-promise');var moment=require(_0xda81('0x3'));var BPromise=require(_0xda81('0x4'));var Mustache=require(_0xda81('0x5'));var util=require(_0xda81('0x6'));var path=require(_0xda81('0x7'));var sox=require(_0xda81('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda81('0x9'));var _=require('lodash');var squel=require(_0xda81('0xa'));var crypto=require(_0xda81('0xb'));var jsforce=require(_0xda81('0xc'));var deskjs=require(_0xda81('0xd'));var toCsv=require(_0xda81('0xe'));var querystring=require(_0xda81('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xda81('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xda81('0x11'));var hardwareService=require(_0xda81('0x12'));var logger=require(_0xda81('0x13'))(_0xda81('0x14'));var utils=require(_0xda81('0x15'));var config=require(_0xda81('0x16'));var licenseUtil=require(_0xda81('0x17'));var db=require(_0xda81('0x18'))['db'];config[_0xda81('0x19')]=_[_0xda81('0x1a')](config['redis'],{'host':_0xda81('0x1b'),'port':0x18eb});var socket=require(_0xda81('0x1c'))(new Redis(config['redis']));require(_0xda81('0x1d'))['register'](socket);var jayson=require(_0xda81('0x1e'));var client=jayson['client'][_0xda81('0x1f')]({'port':0x232c});var client9002=jayson[_0xda81('0x20')][_0xda81('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x27facb,_0xe2adb4,_0x1d3e0d,_0x57bab1){return new BPromise(function(_0x28ffff,_0x2425a6){var _0x46b4a0=_0x57bab1||client;return _0x46b4a0[_0xda81('0x21')](_0x27facb,_0x1d3e0d)[_0xda81('0x22')](function(_0x34d4c9){logger[_0xda81('0x23')](_0xda81('0x24'),_0xe2adb4,_0xda81('0x25'));logger[_0xda81('0x26')](_0xda81('0x27'),_0xe2adb4,'request\x20sent',JSON[_0xda81('0x28')](_0x34d4c9));if(_0x34d4c9['error']){if(_0x34d4c9[_0xda81('0x29')][_0xda81('0x2a')]===0x1f4){logger[_0xda81('0x29')](_0xda81('0x24'),_0xe2adb4,_0x34d4c9[_0xda81('0x29')][_0xda81('0x2b')]);return _0x2425a6(_0x34d4c9[_0xda81('0x29')][_0xda81('0x2b')]);}logger[_0xda81('0x29')](_0xda81('0x24'),_0xe2adb4,_0x34d4c9[_0xda81('0x29')][_0xda81('0x2b')]);return _0x28ffff(_0x34d4c9[_0xda81('0x29')][_0xda81('0x2b')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0xe2adb4,_0xda81('0x25'));_0x28ffff(_0x34d4c9[_0xda81('0x2c')][_0xda81('0x2b')]);}})[_0xda81('0x2d')](function(_0x431774){logger['error'](_0xda81('0x24'),_0xe2adb4,_0x431774);_0x2425a6(_0x431774);});});}function respondWithStatusCode(_0x8b7849,_0x283293){_0x283293=_0x283293||0xcc;return function(_0x4789b){if(_0x4789b){return _0x8b7849[_0xda81('0x2e')](_0x283293);}return _0x8b7849[_0xda81('0x2f')](_0x283293)[_0xda81('0x30')]();};}function respondWithResult(_0x1fef87,_0x472621){_0x472621=_0x472621||0xc8;return function(_0x1dae09){if(_0x1dae09){return _0x1fef87[_0xda81('0x2f')](_0x472621)['json'](_0x1dae09);}};}function respondWithFilteredResult(_0x3948af,_0x1e4492){return function(_0x369abf){if(_0x369abf){var _0x41ba8f=typeof _0x1e4492[_0xda81('0x31')]===_0xda81('0x32')&&typeof _0x1e4492[_0xda81('0x33')]===_0xda81('0x32');var _0x20c9ca=_0x369abf[_0xda81('0x34')];var _0x103322=_0x41ba8f?0x0:_0x1e4492[_0xda81('0x31')];var _0x36ef88=_0x41ba8f?_0x369abf[_0xda81('0x34')]:_0x1e4492['offset']+_0x1e4492[_0xda81('0x33')];var _0x2b2ce5;if(_0x36ef88>=_0x20c9ca){_0x36ef88=_0x20c9ca;_0x2b2ce5=0xc8;}else{_0x2b2ce5=0xce;}_0x3948af[_0xda81('0x2f')](_0x2b2ce5);return _0x3948af[_0xda81('0x35')](_0xda81('0x36'),_0x103322+'-'+_0x36ef88+'/'+_0x20c9ca)[_0xda81('0x37')](_0x369abf);}return null;};}function patchUpdates(_0x3d656c){return function(_0x34fa64){try{jsonpatch[_0xda81('0x38')](_0x34fa64,_0x3d656c,!![]);}catch(_0x1e51e1){return BPromise[_0xda81('0x39')](_0x1e51e1);}return _0x34fa64[_0xda81('0x3a')]();};}function saveUpdates(_0x5af239,_0x3c2805){return function(_0x33fa48){if(_0x33fa48){return _0x33fa48['update'](_0x5af239)['then'](function(_0x2e646f){return _0x2e646f;});}return null;};}function removeEntity(_0x4cdb53,_0x3951fd){return function(_0x2564ae){if(_0x2564ae){return _0x2564ae[_0xda81('0x3b')]()[_0xda81('0x22')](function(){_0x4cdb53[_0xda81('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf7dfd3,_0x3e40f0){return function(_0x4a6733){if(!_0x4a6733){_0xf7dfd3['sendStatus'](0x194);}return _0x4a6733;};}function handleError(_0x1d3ce2,_0x46b8b3){_0x46b8b3=_0x46b8b3||0x1f4;return function(_0x40f9f9){logger[_0xda81('0x29')](_0x40f9f9[_0xda81('0x3c')]);if(_0x40f9f9[_0xda81('0x3d')]){delete _0x40f9f9['name'];}_0x1d3ce2['status'](_0x46b8b3)[_0xda81('0x3e')](_0x40f9f9);};}exports['index']=function(_0xccad25,_0x3c8648){var _0x52ef88={},_0x188ff3={},_0x54fc3e={'count':0x0,'rows':[]};var _0x1b90c3=_[_0xda81('0x3f')](db[_0xda81('0x40')][_0xda81('0x41')],function(_0x10acb7){return{'name':_0x10acb7[_0xda81('0x42')],'type':_0x10acb7['type'][_0xda81('0x43')]};});_0x188ff3[_0xda81('0x44')]=_[_0xda81('0x3f')](_0x1b90c3,_0xda81('0x3d'));_0x188ff3[_0xda81('0x45')]=_[_0xda81('0x46')](_0xccad25[_0xda81('0x45')]);_0x188ff3[_0xda81('0x47')]=_[_0xda81('0x48')](_0x188ff3[_0xda81('0x44')],_0x188ff3[_0xda81('0x45')]);_0x52ef88[_0xda81('0x49')]=_['intersection'](_0x188ff3[_0xda81('0x44')],qs[_0xda81('0x4a')](_0xccad25[_0xda81('0x45')][_0xda81('0x4a')]));_0x52ef88[_0xda81('0x49')]=_0x52ef88[_0xda81('0x49')][_0xda81('0x4b')]?_0x52ef88['attributes']:_0x188ff3[_0xda81('0x44')];if(!_0xccad25['query'][_0xda81('0x4c')](_0xda81('0x4d'))){_0x52ef88[_0xda81('0x33')]=qs[_0xda81('0x33')](_0xccad25[_0xda81('0x45')]['limit']);_0x52ef88[_0xda81('0x31')]=qs[_0xda81('0x31')](_0xccad25['query'][_0xda81('0x31')]);}_0x52ef88['order']=qs[_0xda81('0x4e')](_0xccad25[_0xda81('0x45')][_0xda81('0x4e')]);_0x52ef88[_0xda81('0x4f')]=qs['filters'](_[_0xda81('0x50')](_0xccad25['query'],_0x188ff3['filters']),_0x1b90c3);if(_0xccad25[_0xda81('0x45')]['filter']){_0x52ef88[_0xda81('0x4f')]=_['merge'](_0x52ef88[_0xda81('0x4f')],{'$or':_[_0xda81('0x3f')](_0x1b90c3,function(_0x47d420){if(_0x47d420['type']!==_0xda81('0x51')){var _0x3d967b={};_0x3d967b[_0x47d420[_0xda81('0x3d')]]={'$like':'%'+_0xccad25[_0xda81('0x45')][_0xda81('0x52')]+'%'};return _0x3d967b;}})});}_0x52ef88=_[_0xda81('0x53')]({},_0x52ef88,_0xccad25[_0xda81('0x54')]);var _0x2ebab8={'where':_0x52ef88['where']};return db['SmsMessage']['count'](_0x2ebab8)[_0xda81('0x22')](function(_0x5437e4){_0x54fc3e[_0xda81('0x34')]=_0x5437e4;if(_0xccad25[_0xda81('0x45')][_0xda81('0x55')]){_0x52ef88[_0xda81('0x56')]=[{'all':!![]}];}return db[_0xda81('0x40')][_0xda81('0x57')](_0x52ef88);})['then'](function(_0x3531ed){_0x54fc3e[_0xda81('0x58')]=_0x3531ed;return _0x54fc3e;})['then'](respondWithFilteredResult(_0x3c8648,_0x52ef88))[_0xda81('0x2d')](handleError(_0x3c8648,null));};exports['show']=function(_0x1ac89c,_0x3a6a56){var _0x1be080={'raw':!![],'where':{'id':_0x1ac89c[_0xda81('0x59')]['id']}},_0x288d33={};_0x288d33[_0xda81('0x44')]=_['keys'](db[_0xda81('0x40')][_0xda81('0x41')]);_0x288d33[_0xda81('0x45')]=_[_0xda81('0x46')](_0x1ac89c[_0xda81('0x45')]);_0x288d33[_0xda81('0x47')]=_[_0xda81('0x48')](_0x288d33[_0xda81('0x44')],_0x288d33[_0xda81('0x45')]);_0x1be080[_0xda81('0x49')]=_[_0xda81('0x48')](_0x288d33[_0xda81('0x44')],qs[_0xda81('0x4a')](_0x1ac89c['query'][_0xda81('0x4a')]));_0x1be080[_0xda81('0x49')]=_0x1be080[_0xda81('0x49')][_0xda81('0x4b')]?_0x1be080['attributes']:_0x288d33[_0xda81('0x44')];if(_0x1ac89c[_0xda81('0x45')][_0xda81('0x55')]){_0x1be080[_0xda81('0x56')]=[{'all':!![]}];}_0x1be080=_['merge']({},_0x1be080,_0x1ac89c[_0xda81('0x54')]);return db['SmsMessage'][_0xda81('0x5a')](_0x1be080)[_0xda81('0x22')](handleEntityNotFound(_0x3a6a56,null))[_0xda81('0x22')](respondWithResult(_0x3a6a56,null))[_0xda81('0x2d')](handleError(_0x3a6a56,null));};exports[_0xda81('0x5b')]=function(_0x3709cc,_0x64bc75){return db[_0xda81('0x40')]['create'](_0x3709cc[_0xda81('0x5c')],{})[_0xda81('0x22')](respondWithResult(_0x64bc75,0xc9))[_0xda81('0x2d')](handleError(_0x64bc75,null));};exports[_0xda81('0x5d')]=function(_0x1a90cf,_0x463d86){if(_0x1a90cf[_0xda81('0x5c')]['id']){delete _0x1a90cf[_0xda81('0x5c')]['id'];}return db['SmsMessage'][_0xda81('0x5a')]({'where':{'id':_0x1a90cf[_0xda81('0x59')]['id']}})[_0xda81('0x22')](handleEntityNotFound(_0x463d86,null))['then'](saveUpdates(_0x1a90cf[_0xda81('0x5c')],null))['then'](respondWithResult(_0x463d86,null))[_0xda81('0x2d')](handleError(_0x463d86,null));};exports['destroy']=function(_0x159617,_0x58c76e){return db[_0xda81('0x40')]['find']({'where':{'id':_0x159617[_0xda81('0x59')]['id']}})[_0xda81('0x22')](handleEntityNotFound(_0x58c76e,null))[_0xda81('0x22')](removeEntity(_0x58c76e,null))['catch'](handleError(_0x58c76e,null));};exports[_0xda81('0x5e')]=function(_0x14c486,_0x2097f8){return db['SmsMessage']['describe']()[_0xda81('0x22')](respondWithResult(_0x2097f8,null))[_0xda81('0x2d')](handleError(_0x2097f8,null));};var interaction_log=require(_0xda81('0x13'))(_0xda81('0x5f'));exports['accept']=function(_0x239250,_0x588d1e,_0x1f18ff){var _0x942897={'agent':{},'channel':_0xda81('0x60')};if(_0x239250[_0xda81('0x5c')]['id']){delete _0x239250[_0xda81('0x5c')]['id'];}_0x239250[_0xda81('0x5c')][_0xda81('0x61')]=!![];_0x239250[_0xda81('0x5c')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x239250['body']['UserId']=_0x239250[_0xda81('0x5c')]['UserId']||_0x239250[_0xda81('0x62')]['id'];_0x942897[_0xda81('0x63')]['id']=_0x239250[_0xda81('0x5c')][_0xda81('0x64')];return db[_0xda81('0x40')][_0xda81('0x5a')]({'where':{'id':_0x239250['params']['id'],'UserId':null}})[_0xda81('0x22')](handleEntityNotFound(_0x588d1e,null))[_0xda81('0x22')](saveUpdates(_0x239250['body'],null))['then'](function(_0x3ee13b){if(_0x3ee13b){_0x942897['message']=_0x3ee13b[_0xda81('0x65')]({'plain':!![]});return db[_0xda81('0x66')][_0xda81('0x5a')]({'where':{'id':_0x3ee13b[_0xda81('0x67')]}});}return null;})[_0xda81('0x22')](handleEntityNotFound(_0x588d1e,null))[_0xda81('0x22')](function(_0x981a6d){if(_0x981a6d){return _0x981a6d[_0xda81('0x5d')]({'UserId':_0x239250[_0xda81('0x5c')][_0xda81('0x64')],'read1stAt':_[_0xda81('0x68')](_0x981a6d[_0xda81('0x69')])?moment()[_0xda81('0x6a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xda81('0x22')](function(_0xf8e37a){if(_0xf8e37a){_0x942897['interaction']=_0xf8e37a[_0xda81('0x65')]({'plain':!![]});interaction_log[_0xda81('0x23')](_0xda81('0x6b'),_0x239250[_0xda81('0x62')]['id'],_0x239250['user'][_0xda81('0x3d')],_0x239250[_0xda81('0x62')][_0xda81('0x6c')],_0x942897[_0xda81('0x6d')]['id'],_0x239250['body']?JSON[_0xda81('0x28')](_0x239250[_0xda81('0x5c')]):_0xda81('0x6e'));return respondWithRpcPromise(_0xda81('0x6f'),_0xda81('0x70'),_0x942897);}return null;})[_0xda81('0x22')](function(_0x1180ac){var _0x5e27c8=_0xda81('0x71')+_0x1180ac[_0xda81('0x2b')]['ContactId'];return db[_0xda81('0x72')][_0xda81('0x45')](_0x5e27c8,{'type':db[_0xda81('0x73')][_0xda81('0x74')][_0xda81('0x75')],'raw':!![]})['then'](function(_0x55c6ba){return _0x55c6ba;});})[_0xda81('0x22')](function(_0x599627){if(_0x599627){_0x942897[_0xda81('0x2b')][_0xda81('0x76')]=_0x599627[0x0];if(!_0x239250[_0xda81('0x5c')][_0xda81('0x64')])return;return db[_0xda81('0x77')][_0xda81('0x5a')]({'where':{'id':_0x239250[_0xda81('0x5c')]['UserId'],'role':_0xda81('0x63')},'attributes':['id',_0xda81('0x3d'),_0xda81('0x78'),_0xda81('0x79'),_0xda81('0x7a')],'raw':!![]});}return null;})['then'](function(_0x55a654){if(!_0x55a654)return null;_0x942897[_0xda81('0x2b')]['agent']=_0x55a654;return _0x942897;})[_0xda81('0x22')](function(_0x438ad5){if(_0x438ad5){if(_0x239250['body'][_0xda81('0x7b')]){_0x942897[_0xda81('0x2b')][_0xda81('0x7c')]=util[_0xda81('0x6a')](_0xda81('0x7d'),_0x239250[_0xda81('0x62')][_0xda81('0x3d')]);_0x942897[_0xda81('0x2b')]['channel']=_0x942897[_0xda81('0x7e')];_0x942897[_0xda81('0x2b')]['motionChannel']=_0x942897['channel'];_0x942897[_0xda81('0x2b')][_0xda81('0x7f')]=_0xda81('0x80');return respondWithRpcPromise(_0xda81('0x81'),'EventManager',{'event':_0xda81('0x82'),'message':_0x942897['message']},client9002)[_0xda81('0x22')](function(){return _0x942897;});}return _0x942897;}return null;})[_0xda81('0x22')](respondWithResult(_0x588d1e,null))['catch'](handleError(_0x588d1e,null));};var interaction_log=require(_0xda81('0x13'))(_0xda81('0x5f'));exports[_0xda81('0x39')]=function(_0x1aba8c,_0x3a1c5f,_0xc1ae0){var _0x487c6e={'agent':{},'channel':_0xda81('0x60')};if(_0x1aba8c[_0xda81('0x5c')]['id']){delete _0x1aba8c[_0xda81('0x5c')]['id'];}_0x1aba8c[_0xda81('0x5c')][_0xda81('0x64')]=_0x1aba8c[_0xda81('0x5c')]['UserId']||_0x1aba8c[_0xda81('0x62')]['id'];_0x487c6e[_0xda81('0x63')]['id']=_0x1aba8c['body'][_0xda81('0x64')];return db[_0xda81('0x40')][_0xda81('0x5a')]({'where':{'id':_0x1aba8c[_0xda81('0x59')]['id'],'UserId':null}})[_0xda81('0x22')](handleEntityNotFound(_0x3a1c5f,null))[_0xda81('0x22')](function(_0x14379e){if(_0x14379e){_0x487c6e['message']=_0x14379e[_0xda81('0x65')]({'plain':!![]});return db['SmsInteraction'][_0xda81('0x5a')]({'where':{'id':_0x14379e[_0xda81('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x3a1c5f,null))[_0xda81('0x22')](function(_0x3a96dc){if(_0x3a96dc){_0x487c6e[_0xda81('0x6d')]=_0x3a96dc[_0xda81('0x65')]({'plain':!![]});interaction_log['info'](_0xda81('0x83'),_0x1aba8c[_0xda81('0x62')]['id'],_0x1aba8c[_0xda81('0x62')]['name'],_0x1aba8c[_0xda81('0x62')][_0xda81('0x6c')],_0x487c6e['interaction']['id'],_0x1aba8c[_0xda81('0x5c')]?JSON[_0xda81('0x28')](_0x1aba8c['body']):'null');return respondWithRpcPromise(_0xda81('0x84'),_0xda81('0x85'),_0x487c6e);}return null;})[_0xda81('0x22')](function(_0x274184){var _0x3d7509=_0xda81('0x71')+_0x274184[_0xda81('0x2b')][_0xda81('0x86')];return db[_0xda81('0x72')][_0xda81('0x45')](_0x3d7509,{'type':db['Sequelize'][_0xda81('0x74')][_0xda81('0x75')],'raw':!![]})[_0xda81('0x22')](function(_0x5ab6a){return _0x5ab6a;});})[_0xda81('0x22')](function(_0x115cfd){if(_0x115cfd){_0x487c6e[_0xda81('0x2b')][_0xda81('0x76')]=_0x115cfd[0x0];if(!_0x1aba8c[_0xda81('0x5c')]['UserId'])return;return db[_0xda81('0x77')]['find']({'where':{'id':_0x1aba8c['body'][_0xda81('0x64')],'role':'agent'},'attributes':['id',_0xda81('0x3d'),'fullname',_0xda81('0x79'),'internal'],'raw':!![]});}return null;})[_0xda81('0x22')](function(_0x243306){if(!_0x243306)return null;_0x487c6e[_0xda81('0x2b')][_0xda81('0x63')]=_0x243306;return _0x487c6e;})['then'](function(_0x45152e){if(_0x45152e){_0x45152e[_0xda81('0x2b')][_0xda81('0x7c')]=util[_0xda81('0x6a')]('SIP/%s',_0x1aba8c[_0xda81('0x62')][_0xda81('0x3d')]);_0x45152e[_0xda81('0x2b')][_0xda81('0x7e')]=_0x487c6e['channel'];_0x45152e[_0xda81('0x2b')][_0xda81('0x87')]=_0x487c6e[_0xda81('0x7e')];_0x45152e[_0xda81('0x2b')][_0xda81('0x7f')]=_0xda81('0x39');respondWithRpcPromise(_0xda81('0x81'),_0xda81('0x81'),{'event':'rejectmessage','message':_0x45152e[_0xda81('0x2b')]},client9002);return _0x487c6e;}return null;})[_0xda81('0x22')](respondWithResult(_0x3a1c5f,null))[_0xda81('0x2d')](handleError(_0x3a1c5f,null));};exports['status']=function(_0x50c115,_0x292df2,_0x2b31d0){if(_0x50c115[_0xda81('0x5c')]['id']){delete _0x50c115[_0xda81('0x5c')]['id'];}var _0x25da1b;return db['SmsMessage'][_0xda81('0x5a')]({'where':{'id':_0x50c115[_0xda81('0x59')]['id']}})[_0xda81('0x22')](handleEntityNotFound(_0x292df2,null))[_0xda81('0x22')](function(_0x56cfe6){if(_0x56cfe6){_0x25da1b=_0x56cfe6;return db[_0xda81('0x88')]['find']({'where':{'id':_0x56cfe6['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x292df2,null))['then'](function(_0x250a73){if(_0x250a73){logger['debug'](_0xda81('0x27'),_0xda81('0x2f'),_0xda81('0x89'),_0x250a73[_0xda81('0x8a')],util[_0xda81('0x8b')](_0x50c115[_0xda81('0x5c')],{'showHidden':![],'depth':null}));switch(_0x250a73['type']){case _0xda81('0x8c'):if(_0x50c115[_0xda81('0x5c')][_0xda81('0x8d')]&&_0x50c115[_0xda81('0x5c')]['MessageSid']===_0x25da1b['messageId']){return _0x25da1b[_0xda81('0x5d')]({'read':!![]});}else{logger[_0xda81('0x29')](_0xda81('0x8e'),'status','twilio',util[_0xda81('0x8b')](_0x50c115[_0xda81('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xda81('0x8f'):if(_0x50c115[_0xda81('0x5c')][_0xda81('0x90')]&&_0x50c115[_0xda81('0x5c')][_0xda81('0x90')]===_0x25da1b['messageId']&&_[_0xda81('0x91')](['sent',_0xda81('0x92')],_0x50c115[_0xda81('0x5c')][_0xda81('0x93')])>=0x0){return _0x25da1b['update']({'read':!![]});}else{logger[_0xda81('0x29')](_0xda81('0x8e'),_0xda81('0x2f'),'plivio',util[_0xda81('0x8b')](_0x50c115[_0xda81('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xda81('0x94'):var _0x277d39=_0x50c115[_0xda81('0x5c')][_0xda81('0x95')][0x0];if(_0x277d39[_0xda81('0x2f')][_0xda81('0x96')]==='DELIVERED'){return _0x25da1b[_0xda81('0x5d')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xda81('0x2f'),_0xda81('0x94'),util[_0xda81('0x8b')](_0x50c115[_0xda81('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x25da1b;}})[_0xda81('0x22')](respondWithResult(_0x292df2,null))[_0xda81('0x2d')](handleError(_0x292df2,null));}; \ No newline at end of file +var _0x2678=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','isNil','read1stAt','user','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','null','RejectMessage','QueryTypes','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','sent','Status','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0xf98581,_0x41a58c){var _0x4a16a9=function(_0x30867e){while(--_0x30867e){_0xf98581['push'](_0xf98581['shift']());}};_0x4a16a9(++_0x41a58c);}(_0x2678,0x1bb));var _0x8267=function(_0x3096fd,_0x541ccd){_0x3096fd=_0x3096fd-0x0;var _0x159725=_0x2678[_0x3096fd];return _0x159725;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8267('0x0'));var zipdir=require(_0x8267('0x1'));var jsonpatch=require(_0x8267('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8267('0x3'));var util=require(_0x8267('0x4'));var path=require(_0x8267('0x5'));var sox=require('sox');var csv=require(_0x8267('0x6'));var ejs=require(_0x8267('0x7'));var fs=require('fs');var fs_extra=require(_0x8267('0x8'));var _=require(_0x8267('0x9'));var squel=require(_0x8267('0xa'));var crypto=require(_0x8267('0xb'));var jsforce=require(_0x8267('0xc'));var deskjs=require(_0x8267('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8267('0xe'));var Papa=require(_0x8267('0xf'));var Redis=require('ioredis');var authService=require(_0x8267('0x10'));var qs=require(_0x8267('0x11'));var as=require(_0x8267('0x12'));var hardwareService=require(_0x8267('0x13'));var logger=require(_0x8267('0x14'))('api');var utils=require(_0x8267('0x15'));var config=require(_0x8267('0x16'));var licenseUtil=require(_0x8267('0x17'));var db=require(_0x8267('0x18'))['db'];config[_0x8267('0x19')]=_[_0x8267('0x1a')](config[_0x8267('0x19')],{'host':_0x8267('0x1b'),'port':0x18eb});var socket=require(_0x8267('0x1c'))(new Redis(config[_0x8267('0x19')]));require(_0x8267('0x1d'))['register'](socket);var jayson=require(_0x8267('0x1e'));var client=jayson['client'][_0x8267('0x1f')]({'port':0x232c});var client9002=jayson[_0x8267('0x20')][_0x8267('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3cdf01,_0x5b182b,_0x583817,_0x59967e){return new BPromise(function(_0x3d2c1e,_0x455d26){var _0x55b9f9=_0x59967e||client;return _0x55b9f9['request'](_0x3cdf01,_0x583817)[_0x8267('0x21')](function(_0x39f8c8){logger[_0x8267('0x22')](_0x8267('0x23'),_0x5b182b,'request\x20sent');logger[_0x8267('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b182b,_0x8267('0x25'),JSON[_0x8267('0x26')](_0x39f8c8));if(_0x39f8c8[_0x8267('0x27')]){if(_0x39f8c8['error'][_0x8267('0x28')]===0x1f4){logger[_0x8267('0x27')](_0x8267('0x23'),_0x5b182b,_0x39f8c8[_0x8267('0x27')][_0x8267('0x29')]);return _0x455d26(_0x39f8c8[_0x8267('0x27')][_0x8267('0x29')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x5b182b,_0x39f8c8[_0x8267('0x27')][_0x8267('0x29')]);return _0x3d2c1e(_0x39f8c8[_0x8267('0x27')][_0x8267('0x29')]);}else{logger[_0x8267('0x22')](_0x8267('0x23'),_0x5b182b,'request\x20sent');_0x3d2c1e(_0x39f8c8[_0x8267('0x2a')][_0x8267('0x29')]);}})[_0x8267('0x2b')](function(_0x2903bb){logger[_0x8267('0x27')]('SmsMessage,\x20%s,\x20%s',_0x5b182b,_0x2903bb);_0x455d26(_0x2903bb);});});}function respondWithStatusCode(_0x2e8e7e,_0x4171f7){_0x4171f7=_0x4171f7||0xcc;return function(_0x458d06){if(_0x458d06){return _0x2e8e7e[_0x8267('0x2c')](_0x4171f7);}return _0x2e8e7e[_0x8267('0x2d')](_0x4171f7)[_0x8267('0x2e')]();};}function respondWithResult(_0x11fef5,_0x59cee3){_0x59cee3=_0x59cee3||0xc8;return function(_0x1b5133){if(_0x1b5133){return _0x11fef5[_0x8267('0x2d')](_0x59cee3)[_0x8267('0x2f')](_0x1b5133);}};}function respondWithFilteredResult(_0x3f2fbe,_0x398ebd){return function(_0x21fbe4){if(_0x21fbe4){var _0x2d75e1=typeof _0x398ebd[_0x8267('0x30')]===_0x8267('0x31')&&typeof _0x398ebd[_0x8267('0x32')]===_0x8267('0x31');var _0x5f5b0f=_0x21fbe4[_0x8267('0x33')];var _0x4f7377=_0x2d75e1?0x0:_0x398ebd[_0x8267('0x30')];var _0x4f4501=_0x2d75e1?_0x21fbe4['count']:_0x398ebd['offset']+_0x398ebd['limit'];var _0x4d43cd;if(_0x4f4501>=_0x5f5b0f){_0x4f4501=_0x5f5b0f;_0x4d43cd=0xc8;}else{_0x4d43cd=0xce;}_0x3f2fbe[_0x8267('0x2d')](_0x4d43cd);return _0x3f2fbe[_0x8267('0x34')]('Content-Range',_0x4f7377+'-'+_0x4f4501+'/'+_0x5f5b0f)[_0x8267('0x2f')](_0x21fbe4);}return null;};}function patchUpdates(_0x257787){return function(_0x54eb27){try{jsonpatch[_0x8267('0x35')](_0x54eb27,_0x257787,!![]);}catch(_0x459530){return BPromise[_0x8267('0x36')](_0x459530);}return _0x54eb27[_0x8267('0x37')]();};}function saveUpdates(_0x4efc8e,_0x116440){return function(_0x12a838){if(_0x12a838){return _0x12a838[_0x8267('0x38')](_0x4efc8e)['then'](function(_0x1bf027){return _0x1bf027;});}return null;};}function removeEntity(_0x253ff6,_0x3a6935){return function(_0x2323de){if(_0x2323de){return _0x2323de[_0x8267('0x39')]()[_0x8267('0x21')](function(){_0x253ff6['status'](0xcc)[_0x8267('0x2e')]();});}};}function handleEntityNotFound(_0x132092,_0x2cd525){return function(_0x31bd62){if(!_0x31bd62){_0x132092['sendStatus'](0x194);}return _0x31bd62;};}function handleError(_0x4ca6aa,_0x148120){_0x148120=_0x148120||0x1f4;return function(_0x3f8db6){logger[_0x8267('0x27')](_0x3f8db6[_0x8267('0x3a')]);if(_0x3f8db6[_0x8267('0x3b')]){delete _0x3f8db6[_0x8267('0x3b')];}_0x4ca6aa['status'](_0x148120)[_0x8267('0x3c')](_0x3f8db6);};}exports[_0x8267('0x3d')]=function(_0xa87476,_0x47d963){var _0x3df5f9={},_0x34b4e0={},_0x3bdb1c={'count':0x0,'rows':[]};var _0x4759e7=_[_0x8267('0x3e')](db[_0x8267('0x3f')]['rawAttributes'],function(_0x34335a){return{'name':_0x34335a[_0x8267('0x40')],'type':_0x34335a[_0x8267('0x41')][_0x8267('0x42')]};});_0x34b4e0[_0x8267('0x43')]=_['map'](_0x4759e7,_0x8267('0x3b'));_0x34b4e0[_0x8267('0x44')]=_[_0x8267('0x45')](_0xa87476[_0x8267('0x44')]);_0x34b4e0[_0x8267('0x46')]=_[_0x8267('0x47')](_0x34b4e0[_0x8267('0x43')],_0x34b4e0[_0x8267('0x44')]);_0x3df5f9[_0x8267('0x48')]=_[_0x8267('0x47')](_0x34b4e0['model'],qs[_0x8267('0x49')](_0xa87476[_0x8267('0x44')][_0x8267('0x49')]));_0x3df5f9['attributes']=_0x3df5f9[_0x8267('0x48')][_0x8267('0x4a')]?_0x3df5f9[_0x8267('0x48')]:_0x34b4e0[_0x8267('0x43')];if(!_0xa87476[_0x8267('0x44')][_0x8267('0x4b')](_0x8267('0x4c'))){_0x3df5f9[_0x8267('0x32')]=qs[_0x8267('0x32')](_0xa87476[_0x8267('0x44')]['limit']);_0x3df5f9[_0x8267('0x30')]=qs[_0x8267('0x30')](_0xa87476[_0x8267('0x44')][_0x8267('0x30')]);}_0x3df5f9['order']=qs[_0x8267('0x4d')](_0xa87476[_0x8267('0x44')][_0x8267('0x4d')]);_0x3df5f9[_0x8267('0x4e')]=qs[_0x8267('0x46')](_[_0x8267('0x4f')](_0xa87476[_0x8267('0x44')],_0x34b4e0[_0x8267('0x46')]),_0x4759e7);if(_0xa87476[_0x8267('0x44')][_0x8267('0x50')]){_0x3df5f9[_0x8267('0x4e')]=_[_0x8267('0x51')](_0x3df5f9['where'],{'$or':_['map'](_0x4759e7,function(_0xaa78af){if(_0xaa78af['type']!=='VIRTUAL'){var _0x167777={};_0x167777[_0xaa78af[_0x8267('0x3b')]]={'$like':'%'+_0xa87476[_0x8267('0x44')][_0x8267('0x50')]+'%'};return _0x167777;}})});}_0x3df5f9=_[_0x8267('0x51')]({},_0x3df5f9,_0xa87476[_0x8267('0x52')]);var _0x2fe927={'where':_0x3df5f9[_0x8267('0x4e')]};return db[_0x8267('0x3f')][_0x8267('0x33')](_0x2fe927)['then'](function(_0x4d47a4){_0x3bdb1c[_0x8267('0x33')]=_0x4d47a4;if(_0xa87476['query'][_0x8267('0x53')]){_0x3df5f9[_0x8267('0x54')]=[{'all':!![]}];}return db[_0x8267('0x3f')][_0x8267('0x55')](_0x3df5f9);})['then'](function(_0x3aabbd){_0x3bdb1c[_0x8267('0x56')]=_0x3aabbd;return _0x3bdb1c;})[_0x8267('0x21')](respondWithFilteredResult(_0x47d963,_0x3df5f9))[_0x8267('0x2b')](handleError(_0x47d963,null));};exports[_0x8267('0x57')]=function(_0xb0a41d,_0x3be4ed){var _0x272fe9={'raw':!![],'where':{'id':_0xb0a41d[_0x8267('0x58')]['id']}},_0x226079={};_0x226079[_0x8267('0x43')]=_[_0x8267('0x45')](db[_0x8267('0x3f')][_0x8267('0x59')]);_0x226079[_0x8267('0x44')]=_['keys'](_0xb0a41d[_0x8267('0x44')]);_0x226079[_0x8267('0x46')]=_[_0x8267('0x47')](_0x226079[_0x8267('0x43')],_0x226079[_0x8267('0x44')]);_0x272fe9['attributes']=_[_0x8267('0x47')](_0x226079['model'],qs[_0x8267('0x49')](_0xb0a41d[_0x8267('0x44')][_0x8267('0x49')]));_0x272fe9['attributes']=_0x272fe9[_0x8267('0x48')][_0x8267('0x4a')]?_0x272fe9[_0x8267('0x48')]:_0x226079[_0x8267('0x43')];if(_0xb0a41d[_0x8267('0x44')]['includeAll']){_0x272fe9['include']=[{'all':!![]}];}_0x272fe9=_[_0x8267('0x51')]({},_0x272fe9,_0xb0a41d[_0x8267('0x52')]);return db['SmsMessage'][_0x8267('0x5a')](_0x272fe9)['then'](handleEntityNotFound(_0x3be4ed,null))[_0x8267('0x21')](respondWithResult(_0x3be4ed,null))[_0x8267('0x2b')](handleError(_0x3be4ed,null));};exports[_0x8267('0x5b')]=function(_0x200272,_0x1de69f){return db[_0x8267('0x3f')][_0x8267('0x5b')](_0x200272[_0x8267('0x5c')],{})[_0x8267('0x21')](respondWithResult(_0x1de69f,0xc9))[_0x8267('0x2b')](handleError(_0x1de69f,null));};exports[_0x8267('0x38')]=function(_0x344d61,_0x314328){if(_0x344d61[_0x8267('0x5c')]['id']){delete _0x344d61[_0x8267('0x5c')]['id'];}return db[_0x8267('0x3f')]['find']({'where':{'id':_0x344d61[_0x8267('0x58')]['id']}})[_0x8267('0x21')](handleEntityNotFound(_0x314328,null))[_0x8267('0x21')](saveUpdates(_0x344d61['body'],null))[_0x8267('0x21')](respondWithResult(_0x314328,null))[_0x8267('0x2b')](handleError(_0x314328,null));};exports['destroy']=function(_0x12c084,_0x56c57b){return db[_0x8267('0x3f')][_0x8267('0x5a')]({'where':{'id':_0x12c084['params']['id']}})[_0x8267('0x21')](handleEntityNotFound(_0x56c57b,null))[_0x8267('0x21')](removeEntity(_0x56c57b,null))[_0x8267('0x2b')](handleError(_0x56c57b,null));};exports[_0x8267('0x5d')]=function(_0x231b54,_0x46b001){return db[_0x8267('0x3f')]['describe']()[_0x8267('0x21')](respondWithResult(_0x46b001,null))[_0x8267('0x2b')](handleError(_0x46b001,null));};var interaction_log=require(_0x8267('0x14'))(_0x8267('0x5e'));exports[_0x8267('0x5f')]=function(_0x3ed226,_0x1a41ca,_0x1426b8){var _0x9aa005={'agent':{},'channel':_0x8267('0x60')};if(_0x3ed226['body']['id']){delete _0x3ed226[_0x8267('0x5c')]['id'];}_0x3ed226[_0x8267('0x5c')][_0x8267('0x61')]=!![];_0x3ed226[_0x8267('0x5c')][_0x8267('0x62')]=moment()[_0x8267('0x63')](_0x8267('0x64'));_0x3ed226[_0x8267('0x5c')][_0x8267('0x65')]=_0x3ed226[_0x8267('0x5c')][_0x8267('0x65')]||_0x3ed226['user']['id'];_0x9aa005[_0x8267('0x66')]['id']=_0x3ed226[_0x8267('0x5c')]['UserId'];return db[_0x8267('0x3f')][_0x8267('0x5a')]({'where':{'id':_0x3ed226[_0x8267('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1a41ca,null))[_0x8267('0x21')](saveUpdates(_0x3ed226[_0x8267('0x5c')],null))[_0x8267('0x21')](function(_0x43b63e){if(_0x43b63e){_0x9aa005[_0x8267('0x29')]=_0x43b63e[_0x8267('0x67')]({'plain':!![]});return db['SmsInteraction'][_0x8267('0x5a')]({'where':{'id':_0x43b63e[_0x8267('0x68')]}});}return null;})[_0x8267('0x21')](handleEntityNotFound(_0x1a41ca,null))[_0x8267('0x21')](function(_0x3be2ba){if(_0x3be2ba){return _0x3be2ba['update']({'UserId':_0x3ed226[_0x8267('0x5c')]['UserId'],'read1stAt':_[_0x8267('0x69')](_0x3be2ba[_0x8267('0x6a')])?moment()[_0x8267('0x63')](_0x8267('0x64')):undefined});}return null;})[_0x8267('0x21')](function(_0x35f5d){if(_0x35f5d){_0x9aa005['interaction']=_0x35f5d[_0x8267('0x67')]({'plain':!![]});interaction_log[_0x8267('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ed226['user']['id'],_0x3ed226[_0x8267('0x6b')]['name'],_0x3ed226['user'][_0x8267('0x6c')],_0x9aa005[_0x8267('0x6d')]['id'],_0x3ed226[_0x8267('0x5c')]?JSON[_0x8267('0x26')](_0x3ed226[_0x8267('0x5c')]):'null');return respondWithRpcPromise(_0x8267('0x6e'),_0x8267('0x6f'),_0x9aa005);}return null;})[_0x8267('0x21')](function(_0x5e8bb4){var _0x230482=_0x8267('0x70')+_0x5e8bb4['message'][_0x8267('0x71')];return db[_0x8267('0x72')][_0x8267('0x44')](_0x230482,{'type':db[_0x8267('0x73')]['QueryTypes'][_0x8267('0x74')],'raw':!![]})[_0x8267('0x21')](function(_0x13cb34){return _0x13cb34;});})[_0x8267('0x21')](function(_0x4944e4){if(_0x4944e4){_0x9aa005[_0x8267('0x29')][_0x8267('0x75')]=_0x4944e4[0x0];if(!_0x3ed226[_0x8267('0x5c')][_0x8267('0x65')])return;return db[_0x8267('0x76')][_0x8267('0x5a')]({'where':{'id':_0x3ed226[_0x8267('0x5c')]['UserId'],'role':_0x8267('0x66')},'attributes':['id',_0x8267('0x3b'),_0x8267('0x77'),_0x8267('0x78'),_0x8267('0x79')],'raw':!![]});}return null;})['then'](function(_0x3e8342){if(!_0x3e8342)return null;_0x9aa005[_0x8267('0x29')][_0x8267('0x66')]=_0x3e8342;return _0x9aa005;})[_0x8267('0x21')](function(_0x2ee051){if(_0x2ee051){if(_0x3ed226[_0x8267('0x5c')][_0x8267('0x7a')]){_0x9aa005['message'][_0x8267('0x7b')]=util[_0x8267('0x63')](_0x8267('0x7c'),_0x3ed226['user']['name']);_0x9aa005[_0x8267('0x29')]['channel']=_0x9aa005[_0x8267('0x7d')];_0x9aa005[_0x8267('0x29')][_0x8267('0x7e')]=_0x9aa005[_0x8267('0x7d')];_0x9aa005[_0x8267('0x29')][_0x8267('0x7f')]='accept';return respondWithRpcPromise(_0x8267('0x80'),_0x8267('0x80'),{'event':_0x8267('0x81'),'message':_0x9aa005[_0x8267('0x29')]},client9002)['then'](function(){return _0x9aa005;});}return _0x9aa005;}return null;})[_0x8267('0x21')](respondWithResult(_0x1a41ca,null))[_0x8267('0x2b')](handleError(_0x1a41ca,null));};var interaction_log=require(_0x8267('0x14'))(_0x8267('0x5e'));exports[_0x8267('0x36')]=function(_0x51d294,_0xb580a6,_0x11373a){var _0x2b6407={'agent':{},'channel':_0x8267('0x60')};if(_0x51d294[_0x8267('0x5c')]['id']){delete _0x51d294[_0x8267('0x5c')]['id'];}_0x51d294['body'][_0x8267('0x65')]=_0x51d294[_0x8267('0x5c')][_0x8267('0x65')]||_0x51d294[_0x8267('0x6b')]['id'];_0x2b6407[_0x8267('0x66')]['id']=_0x51d294[_0x8267('0x5c')]['UserId'];return db[_0x8267('0x3f')]['find']({'where':{'id':_0x51d294[_0x8267('0x58')]['id'],'UserId':null}})[_0x8267('0x21')](handleEntityNotFound(_0xb580a6,null))[_0x8267('0x21')](function(_0x53bb62){if(_0x53bb62){_0x2b6407[_0x8267('0x29')]=_0x53bb62[_0x8267('0x67')]({'plain':!![]});return db[_0x8267('0x82')]['find']({'where':{'id':_0x53bb62[_0x8267('0x68')]}});}return null;})[_0x8267('0x21')](handleEntityNotFound(_0xb580a6,null))[_0x8267('0x21')](function(_0x378a45){if(_0x378a45){_0x2b6407['interaction']=_0x378a45[_0x8267('0x67')]({'plain':!![]});interaction_log[_0x8267('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51d294[_0x8267('0x6b')]['id'],_0x51d294[_0x8267('0x6b')][_0x8267('0x3b')],_0x51d294[_0x8267('0x6b')][_0x8267('0x6c')],_0x2b6407[_0x8267('0x6d')]['id'],_0x51d294[_0x8267('0x5c')]?JSON['stringify'](_0x51d294[_0x8267('0x5c')]):_0x8267('0x83'));return respondWithRpcPromise(_0x8267('0x84'),'rejectMessage',_0x2b6407);}return null;})[_0x8267('0x21')](function(_0x3a6d77){var _0x25b03c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3a6d77[_0x8267('0x29')][_0x8267('0x71')];return db['sequelize'][_0x8267('0x44')](_0x25b03c,{'type':db[_0x8267('0x73')][_0x8267('0x85')][_0x8267('0x74')],'raw':!![]})[_0x8267('0x21')](function(_0x2c00fa){return _0x2c00fa;});})[_0x8267('0x21')](function(_0x3521dd){if(_0x3521dd){_0x2b6407['message']['contact']=_0x3521dd[0x0];if(!_0x51d294[_0x8267('0x5c')][_0x8267('0x65')])return;return db[_0x8267('0x76')][_0x8267('0x5a')]({'where':{'id':_0x51d294['body'][_0x8267('0x65')],'role':_0x8267('0x66')},'attributes':['id',_0x8267('0x3b'),_0x8267('0x77'),_0x8267('0x78'),_0x8267('0x79')],'raw':!![]});}return null;})[_0x8267('0x21')](function(_0x85e1a6){if(!_0x85e1a6)return null;_0x2b6407['message'][_0x8267('0x66')]=_0x85e1a6;return _0x2b6407;})[_0x8267('0x21')](function(_0xfe43e5){if(_0xfe43e5){_0xfe43e5['message'][_0x8267('0x7b')]=util[_0x8267('0x63')](_0x8267('0x7c'),_0x51d294[_0x8267('0x6b')][_0x8267('0x3b')]);_0xfe43e5[_0x8267('0x29')][_0x8267('0x7d')]=_0x2b6407[_0x8267('0x7d')];_0xfe43e5[_0x8267('0x29')][_0x8267('0x7e')]=_0x2b6407[_0x8267('0x7d')];_0xfe43e5[_0x8267('0x29')][_0x8267('0x7f')]=_0x8267('0x36');respondWithRpcPromise(_0x8267('0x80'),_0x8267('0x80'),{'event':_0x8267('0x86'),'message':_0xfe43e5[_0x8267('0x29')]},client9002);return _0x2b6407;}return null;})['then'](respondWithResult(_0xb580a6,null))[_0x8267('0x2b')](handleError(_0xb580a6,null));};exports[_0x8267('0x2d')]=function(_0x5b82e9,_0x1dcea2,_0x30bc78){if(_0x5b82e9['body']['id']){delete _0x5b82e9[_0x8267('0x5c')]['id'];}var _0x1f8499;return db[_0x8267('0x3f')]['find']({'where':{'id':_0x5b82e9[_0x8267('0x58')]['id']}})['then'](handleEntityNotFound(_0x1dcea2,null))[_0x8267('0x21')](function(_0x135b88){if(_0x135b88){_0x1f8499=_0x135b88;return db['SmsAccount'][_0x8267('0x5a')]({'where':{'id':_0x135b88[_0x8267('0x87')]}});}})['then'](handleEntityNotFound(_0x1dcea2,null))[_0x8267('0x21')](function(_0x859e7){if(_0x859e7){logger[_0x8267('0x24')](_0x8267('0x88'),_0x8267('0x2d'),_0x8267('0x89'),_0x859e7[_0x8267('0x41')],util[_0x8267('0x8a')](_0x5b82e9[_0x8267('0x5c')],{'showHidden':![],'depth':null}));switch(_0x859e7[_0x8267('0x41')]){case'twilio':if(_0x5b82e9[_0x8267('0x5c')][_0x8267('0x8b')]&&_0x5b82e9[_0x8267('0x5c')]['MessageSid']===_0x1f8499[_0x8267('0x8c')]){return _0x1f8499[_0x8267('0x38')]({'read':!![]});}else{logger['error'](_0x8267('0x8d'),_0x8267('0x2d'),_0x8267('0x8e'),util[_0x8267('0x8a')](_0x5b82e9[_0x8267('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x8267('0x8f'):if(_0x5b82e9[_0x8267('0x5c')]['MessageUUID']&&_0x5b82e9[_0x8267('0x5c')][_0x8267('0x90')]===_0x1f8499[_0x8267('0x8c')]&&_['indexOf']([_0x8267('0x91'),'delivered'],_0x5b82e9[_0x8267('0x5c')][_0x8267('0x92')])>=0x0){return _0x1f8499[_0x8267('0x38')]({'read':!![]});}else{logger[_0x8267('0x27')](_0x8267('0x8d'),'status',_0x8267('0x93'),util[_0x8267('0x8a')](_0x5b82e9[_0x8267('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x8267('0x94'):var _0x33c93c=_0x5b82e9[_0x8267('0x5c')][_0x8267('0x95')][0x0];if(_0x33c93c[_0x8267('0x2d')][_0x8267('0x96')]===_0x8267('0x97')){return _0x1f8499[_0x8267('0x38')]({'read':!![]});}else{logger['error'](_0x8267('0x8d'),_0x8267('0x2d'),_0x8267('0x94'),util[_0x8267('0x8a')](_0x5b82e9[_0x8267('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x1f8499;}})[_0x8267('0x21')](respondWithResult(_0x1dcea2,null))[_0x8267('0x2b')](handleError(_0x1dcea2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 2340928..86e826e 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 _0xf1b7=['SmsMessage','save','update','remove','emit','hook','exports','events'];(function(_0x1d3577,_0x17a32e){var _0x277d9a=function(_0x4b4144){while(--_0x4b4144){_0x1d3577['push'](_0x1d3577['shift']());}};_0x277d9a(++_0x17a32e);}(_0xf1b7,0x127));var _0x7f1b=function(_0x56bff7,_0x10d3a6){_0x56bff7=_0x56bff7-0x0;var _0x3e396e=_0xf1b7[_0x56bff7];return _0x3e396e;};'use strict';var EventEmitter=require(_0x7f1b('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x7f1b('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7f1b('0x2'),'afterUpdate':_0x7f1b('0x3'),'afterDestroy':_0x7f1b('0x4')};function emitEvent(_0x33ccdb){return function(_0x436388,_0x2477c5,_0x2e6af3){SmsMessageEvents[_0x7f1b('0x5')](_0x33ccdb+':'+_0x436388['id'],_0x436388);SmsMessageEvents['emit'](_0x33ccdb,_0x436388);_0x2e6af3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7f1b('0x6')](e,emitEvent(event));}}module[_0x7f1b('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xd492=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd492,0x18d));var _0x2d49=function(_0x57e47a,_0x5257f8){_0x57e47a=_0x57e47a-0x0;var _0x56a66f=_0xd492[_0x57e47a];return _0x56a66f;};'use strict';var EventEmitter=require(_0x2d49('0x0'));var SmsMessage=require(_0x2d49('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2d49('0x2')](0x0);var events={'afterCreate':_0x2d49('0x3'),'afterUpdate':_0x2d49('0x4'),'afterDestroy':_0x2d49('0x5')};function emitEvent(_0x291682){return function(_0x23d415,_0x441072,_0x231dd8){SmsMessageEvents[_0x2d49('0x6')](_0x291682+':'+_0x23d415['id'],_0x23d415);SmsMessageEvents[_0x2d49('0x6')](_0x291682,_0x23d415);_0x231dd8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x2d49('0x7')](e,emitEvent(event));}}module[_0x2d49('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 60485ea..33c4544 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 _0xadc1=['Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','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','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','find','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','&password=','GET','split','POST','user_key','session_key','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','read','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','login','text','timestamp','keys','sort','length','apiKey','createHash','md5','hex','id_sms'];(function(_0x4499e9,_0x3255fa){var _0x6e3ce8=function(_0x5d331f){while(--_0x5d331f){_0x4499e9['push'](_0x4499e9['shift']());}};_0x6e3ce8(++_0x3255fa);}(_0xadc1,0x17f));var _0x1adc=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0xadc1[_0xed5f9c];return _0x3a1c43;};'use strict';var _=require('lodash');var util=require(_0x1adc('0x0'));var logger=require(_0x1adc('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1adc('0x2'));var rp=require(_0x1adc('0x3'));var fs=require('fs');var path=require(_0x1adc('0x4'));var rimraf=require(_0x1adc('0x5'));var config=require(_0x1adc('0x6'));var attributes=require(_0x1adc('0x7'));module[_0x1adc('0x8')]=function(_0x7ca90e,_0x31e124){return _0x7ca90e[_0x1adc('0x9')](_0x1adc('0xa'),attributes,{'tableName':_0x1adc('0xb'),'paranoid':![],'indexes':[{'name':_0x1adc('0xc'),'fields':[_0x1adc('0xc')]},{'name':_0x1adc('0xd'),'fields':[_0x1adc('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc2f9d0,_0x49a809,_0x30ea13){var _0x31b95d=_0x7ca90e[_0x1adc('0xf')];var _0x409733=_0xc2f9d0['get']({'plain':!![]});if(_0x409733[_0x1adc('0x10')]['toLowerCase']()==='in'||_0x409733[_0x1adc('0x10')][_0x1adc('0x11')]()===_0x1adc('0x12')&&!_0x409733[_0x1adc('0x13')]&&!_[_0x1adc('0x14')](_0x409733[_0x1adc('0x15')])&&!_[_0x1adc('0x14')](_0x409733['SmsInteractionId'])){_0x31b95d[_0x1adc('0x16')][_0x1adc('0x17')]({'where':{'id':_0x409733[_0x1adc('0x18')]}})[_0x1adc('0x19')](function(_0x14a94a){if(_0x14a94a){_0x14a94a[_0x1adc('0x1a')]({'lastMsgAt':_0x409733[_0x1adc('0x1b')],'lastMsgDirection':_0x409733[_0x1adc('0x10')]['toLowerCase']()});}})['catch'](function(_0x3d5897){console['error'](_0x3d5897);});}if(_0x409733['direction']===_0x1adc('0x12')&&!_0x409733['secret']){var _0x31442d;_0x31b95d['SmsAccount'][_0x1adc('0x1c')]({'where':{'id':_0x409733['SmsAccountId']},'raw':!![]})[_0x1adc('0x19')](function(_0x222055){_0x31442d=_0x222055;if(_0x31442d&&_0x31442d[_0x1adc('0x1d')]){switch(_0x31442d[_0x1adc('0x1d')]){case _0x1adc('0x1e'):var _0x45ccd3=require(_0x1adc('0x1e'));if(_0x31442d['accountSid']&&_0x31442d[_0x1adc('0x1f')]&&_0x31442d[_0x1adc('0x20')]){var _0x3913b5=new _0x45ccd3(_0x31442d[_0x1adc('0x21')],_0x31442d[_0x1adc('0x1f')]);_0x3913b5[_0x1adc('0x22')][_0x1adc('0x23')]({'body':_0x409733[_0x1adc('0xe')],'to':_0x409733[_0x1adc('0x20')],'from':_0x31442d[_0x1adc('0x20')],'statusCallback':_0x31442d[_0x1adc('0x24')]+_0x1adc('0x25')+_0x409733['id']+_0x1adc('0x26')+_0x31442d[_0x1adc('0x27')]})[_0x1adc('0x19')](function(_0x4e8c6b){if(_0x4e8c6b[_0x1adc('0x28')]){return _0xc2f9d0['update']({'messageId':_0x4e8c6b[_0x1adc('0x28')]});}})[_0x1adc('0x29')](function(_0x5f1374){logger[_0x1adc('0x2a')](_0x1adc('0x2b'),'afterCreate','twilio',util['inspect'](_0x5f1374,{'showHidden':![],'depth':null}));});}else{logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),'twilio',_0x1adc('0x2d'));}break;case _0x1adc('0x2e'):var _0x35d301='https://api.skebby.it/API/v1.0/REST/';if(_0x31442d[_0x1adc('0x2f')]&&_0x31442d[_0x1adc('0x30')]){var _0x34c4ac={'recipient':[_0x409733[_0x1adc('0x20')]],'message':_0x409733['body'],'message_type':_0x31442d[_0x1adc('0x31')]};if(_0x31442d[_0x1adc('0x31')]&&_0x31442d['smsMethod']!=='SI'){_0x34c4ac[_0x1adc('0x32')]=_0x31442d[_0x1adc('0x20')];}var _0x4c1d97={'url':_0x35d301+'login?username='+_0x31442d[_0x1adc('0x2f')]+_0x1adc('0x33')+_0x31442d[_0x1adc('0x30')],'method':_0x1adc('0x34')};rp(_0x4c1d97)[_0x1adc('0x19')](function(_0x169067){var _0x1040e8=_0x169067[_0x1adc('0x35')](';');var _0x16cafe={'user_key':_0x1040e8[0x0],'session_key':_0x1040e8[0x1]};_0x4c1d97={'url':_0x35d301+'sms','method':_0x1adc('0x36'),'headers':{'user_key':_0x16cafe[_0x1adc('0x37')],'Session_key':_0x16cafe[_0x1adc('0x38')]},'json':!![],'body':_0x34c4ac};return rp(_0x4c1d97);})[_0x1adc('0x19')](function(_0x1f5d24){if(_0x1f5d24['total_sent']>=0x1){var _0x4345d2={'messageId':_0x1f5d24[_0x1adc('0x39')]};if(_0x31442d[_0x1adc('0x31')]!=='GP'||!_0x31442d[_0x1adc('0x3a')]){_0x4345d2['read']=!![];}return _0xc2f9d0[_0x1adc('0x1a')](_0x4345d2);}else{return logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),'skebby',util[_0x1adc('0x3b')](_0x1f5d24,{'showHidden':![],'depth':null}));}})[_0x1adc('0x29')](function(_0x41599f){return logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),_0x1adc('0x2e'),util[_0x1adc('0x3b')](_0x41599f,{'showHidden':![],'depth':null}));});}else{logger[_0x1adc('0x2a')](_0x1adc('0x2b'),'afterCreate',_0x1adc('0x2e'),_0x1adc('0x3c'));}break;case _0x1adc('0x3d'):if(_0x31442d['authToken']){var _0x554c7b={'recipient':_0x409733[_0x1adc('0x20')],'message':_0x409733[_0x1adc('0xe')],'sender':_0x31442d[_0x1adc('0x3e')]||_0x31442d[_0x1adc('0x20')],'authorization':_0x31442d[_0x1adc('0x1f')]};var _0x49a809={'method':_0x1adc('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x554c7b,'json':!![]};rp(_0x49a809)[_0x1adc('0x19')](function(_0x14d7f8){var _0x56d5f9={'messageId':_0x14d7f8[_0x1adc('0x3f')]};if(!_0x31442d[_0x1adc('0x3a')]){_0x56d5f9['read']=!![];}return _0xc2f9d0[_0x1adc('0x1a')](_0x56d5f9);})[_0x1adc('0x29')](function(_0xfac5ac){logger[_0x1adc('0x2a')](_0x1adc('0x2b'),'afterCreate',_0x1adc('0x3d'),util[_0x1adc('0x3b')](_0xfac5ac,{'showHidden':![],'depth':null}));});}else{logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),_0x1adc('0x3d'),_0x1adc('0x40'));}break;case _0x1adc('0x41'):if(_0x31442d[_0x1adc('0x2f')]&&_0x31442d[_0x1adc('0x30')]){var _0x554c7b={'messages':[{'source':_0x1adc('0x42'),'to':_0x409733[_0x1adc('0x20')],'body':_0x409733[_0x1adc('0xe')],'from':_0x31442d['senderString']||_0x31442d[_0x1adc('0x20')]}]};var _0x23a3cb=util[_0x1adc('0x43')](_0x1adc('0x44'),_0x31442d[_0x1adc('0x2f')],_0x31442d[_0x1adc('0x30')]);var _0x49a809={'method':_0x1adc('0x36'),'uri':_0x1adc('0x45'),'body':_0x554c7b,'headers':{'Authorization':util['format'](_0x1adc('0x46'),new Buffer(_0x23a3cb)[_0x1adc('0x47')](_0x1adc('0x48')))},'json':!![]};rp(_0x49a809)[_0x1adc('0x19')](function(_0x2e9ae9){if(_0x2e9ae9[_0x1adc('0x49')]>=0xc8&&_0x2e9ae9['http_code']<=0xce){if(_0x2e9ae9[_0x1adc('0x4a')]&&_0x2e9ae9['data'][_0x1adc('0x4b')]>0x0){var _0x97cc7b=_['head'](_0x2e9ae9[_0x1adc('0x4a')][_0x1adc('0x22')]);var _0x4dc9f4={'messageId':_0x97cc7b[_0x1adc('0x4c')]};if(!_0x31442d[_0x1adc('0x3a')]){_0x4dc9f4[_0x1adc('0x4d')]=!![];}return _0xc2f9d0[_0x1adc('0x1a')](_0x4dc9f4);}else{logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),'clickSend',util[_0x1adc('0x3b')](_0x2e9ae9,{'showHidden':![],'depth':null}));}}else{logger[_0x1adc('0x2a')](_0x1adc('0x2b'),'afterCreate','clickSend',util['inspect'](_0x2e9ae9,{'showHidden':![],'depth':null}));}})[_0x1adc('0x29')](function(_0x1aa789){logger['error'](_0x1adc('0x2b'),_0x1adc('0x2c'),'clickSend',util[_0x1adc('0x3b')](_0x1aa789,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1adc('0x2b'),_0x1adc('0x2c'),'clickSend',_0x1adc('0x3c'));}break;case _0x1adc('0x4e'):if(_0x31442d[_0x1adc('0x4f')]&&_0x31442d[_0x1adc('0x1f')]){var _0x554c7b={'dst':_0x409733[_0x1adc('0x20')],'text':_0x409733['body'],'src':_0x31442d[_0x1adc('0x3e')]||_0x31442d['phone'],'url':_0x31442d[_0x1adc('0x24')]+_0x1adc('0x25')+_0x409733['id']+_0x1adc('0x26')+_0x31442d[_0x1adc('0x27')]};var _0x23a3cb=util[_0x1adc('0x43')](_0x1adc('0x44'),_0x31442d[_0x1adc('0x4f')],_0x31442d['authToken']);var _0x49a809={'method':_0x1adc('0x36'),'uri':util[_0x1adc('0x43')](_0x1adc('0x50'),_0x31442d[_0x1adc('0x4f')]),'body':_0x554c7b,'headers':{'Authorization':util[_0x1adc('0x43')]('Basic\x20%s',new Buffer(_0x23a3cb)['toString'](_0x1adc('0x48')))},'json':!![]};rp(_0x49a809)[_0x1adc('0x19')](function(_0x554a74){var _0x4da3a1={'messageId':_0x554a74[_0x1adc('0x51')][0x0]};return _0xc2f9d0['update'](_0x4da3a1);})[_0x1adc('0x29')](function(_0x1f1809){logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),'plivo',util['inspect'](_0x1f1809,{'showHidden':![],'depth':null}));});}else{logger[_0x1adc('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1adc('0x2c'),_0x1adc('0x4e'),_0x1adc('0x52'));}break;case _0x1adc('0x53'):if(_0x31442d['username']&&_0x31442d[_0x1adc('0x30')]){if(_0x31442d[_0x1adc('0x54')]){var _0x43360b={'method':_0x1adc('0x36'),'uri':_0x31442d[_0x1adc('0x54')]+_0x1adc('0x55'),'body':{'username':_0x31442d[_0x1adc('0x2f')],'password':_0x31442d[_0x1adc('0x30')]},'json':!![]};return rp(_0x43360b)[_0x1adc('0x19')](function(_0x3d64f3){var _0x14fac5={'method':_0x1adc('0x36'),'uri':_0x31442d[_0x1adc('0x54')]+_0x1adc('0x56'),'body':{'messages':[{'from':_0x31442d['phone'],'destinations':[{'to':_0x409733[_0x1adc('0x20')]}],'text':_0x409733[_0x1adc('0xe')],'notifyUrl':_0x31442d[_0x1adc('0x24')]+'/api/sms/messages/'+_0x409733['id']+_0x1adc('0x26')+_0x31442d[_0x1adc('0x27')],'notifyContentType':_0x1adc('0x57'),'callbackData':_0x31442d[_0x1adc('0x20')]+';'+_0x409733[_0x1adc('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x3d64f3[_0x1adc('0x27')]},'json':!![]};return rp(_0x14fac5)[_0x1adc('0x19')](function(_0x3e1c53){if(_0x3e1c53['messages']){var _0x37212b={'messageId':_0x3e1c53['messages'][0x0][_0x1adc('0xc')]};if(!_0x31442d['deliveryReport']){_0x37212b['read']=!![];}return _0xc2f9d0[_0x1adc('0x1a')](_0x37212b);}else{return logger['error'](_0x1adc('0x2b'),_0x1adc('0x2c'),_0x1adc('0x53'),util[_0x1adc('0x3b')](_0x3e1c53,{'showHidden':![],'depth':null}));}});})[_0x1adc('0x29')](function(_0x55ab32){return logger[_0x1adc('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1adc('0x53'),util[_0x1adc('0x3b')](_0x55ab32,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1adc('0x2b'),_0x1adc('0x2c'),_0x1adc('0x53'),_0x1adc('0x58'));}}else{logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),_0x1adc('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1adc('0x59'):var _0x17132d=require('crypto');if(_0x31442d['apiKey']){var _0x4a3280={};_0x4a3280[_0x1adc('0x5a')]=_0x31442d[_0x1adc('0x2f')];_0x4a3280[_0x1adc('0x20')]=_0x409733[_0x1adc('0x20')];_0x4a3280[_0x1adc('0x32')]=_0x31442d['phone'];_0x4a3280[_0x1adc('0x5b')]=_0x409733['body'];_0x4a3280[_0x1adc('0x5c')]=+new Date();var _0x2bf402='';var _0x5537cc='';var _0x2e0e3d=Object[_0x1adc('0x5d')](_0x4a3280);_0x2e0e3d[_0x1adc('0x5e')]();for(var _0x55d796=0x0;_0x55d796<_0x2e0e3d[_0x1adc('0x5f')];_0x55d796++){if(_0x2bf402!=''){_0x2bf402+='&';}_0x2bf402+=_0x2e0e3d[_0x55d796]+'='+encodeURIComponent(_0x4a3280[_0x2e0e3d[_0x55d796]]);_0x5537cc+=_0x4a3280[_0x2e0e3d[_0x55d796]];}_0x5537cc+=_0x31442d[_0x1adc('0x60')];_0x5537cc=_0x17132d[_0x1adc('0x61')](_0x1adc('0x62'))[_0x1adc('0x1a')](_0x5537cc)['digest'](_0x1adc('0x63'));if(_0x2bf402!==''){_0x2bf402+='&';}_0x2bf402+='signature='+_0x5537cc;var _0x4c1d97={'method':'GET','uri':_0x31442d[_0x1adc('0x54')]+'/external/get/send.php?'+_0x2bf402,'json':!![]};return rp(_0x4c1d97)[_0x1adc('0x19')](function(_0x4e1c16){var _0x5846b4=Object[_0x1adc('0x5d')](_0x4e1c16);if(_0x4e1c16[_0x5846b4[0x0]][_0x1adc('0x2a')]&&parseInt(_0x4e1c16[_0x5846b4[0x0]][_0x1adc('0x2a')])===0x0){var _0xc06a4={'messageId':_0x4e1c16[_0x5846b4[0x0]][_0x1adc('0x64')]};if(!_0x31442d[_0x1adc('0x3a')]){_0xc06a4[_0x1adc('0x4d')]=!![];}return _0xc2f9d0[_0x1adc('0x1a')](_0xc06a4);}else{return logger[_0x1adc('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1adc('0x2c'),'csc',util['inspect'](_0x4e1c16[_0x1adc('0x2a')],{'showHidden':![],'depth':null}));}})[_0x1adc('0x29')](function(_0x1f0449){return logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),_0x1adc('0x59'),util[_0x1adc('0x3b')](_0x1f0449,{'showHidden':![],'depth':null}));});}else{logger[_0x1adc('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1adc('0x2c'),'csc',_0x1adc('0x65'));}break;case _0x1adc('0x66'):if(_0x31442d[_0x1adc('0x60')]){var _0x58a71d={'method':_0x1adc('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x31442d[_0x1adc('0x60')]},'body':{'content':_0x409733[_0x1adc('0xe')],'to':[_0x409733[_0x1adc('0x20')]],'from':_0x31442d['phone'],'binary':![],'clientMessageId':_0x1adc('0x67'),'charset':_0x1adc('0x68')},'json':!![]};rp(_0x58a71d)['then'](function(_0xac1989){if(!_0xac1989[_0x1adc('0x2a')]){var _0x30d25a={'messageId':_0xac1989[_0x1adc('0x22')][0x0][_0x1adc('0x69')]};if(!_0x31442d[_0x1adc('0x3a')]){_0x30d25a['read']=!![];}return _0xc2f9d0[_0x1adc('0x1a')](_0x30d25a);}else{return logger[_0x1adc('0x2a')](_0x1adc('0x2b'),'afterCreate',_0x1adc('0x66'),util['inspect'](_0xac1989['error'],{'showHidden':![],'depth':null}));}})[_0x1adc('0x29')](function(_0x61d7b5){return logger['error'](_0x1adc('0x2b'),_0x1adc('0x2c'),_0x1adc('0x66'),util[_0x1adc('0x3b')](_0x61d7b5,{'showHidden':![],'depth':null}));});}else{logger[_0x1adc('0x2a')](_0x1adc('0x2b'),'afterCreate','clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x31442d[_0x1adc('0x2f')]&&_0x31442d[_0x1adc('0x30')]){var _0x23a3cb=util[_0x1adc('0x43')](_0x1adc('0x44'),_0x31442d[_0x1adc('0x2f')],_0x31442d[_0x1adc('0x30')]);var _0x49a809={'method':'POST','uri':_0x1adc('0x6a')+_0x31442d[_0x1adc('0x6b')]+_0x1adc('0x6c'),'body':{'to':[_0x409733[_0x1adc('0x20')]],'text':_0x409733[_0x1adc('0xe')],'from':_0x31442d[_0x1adc('0x20')],'applicationId':_0x31442d[_0x1adc('0x6d')]},'headers':{'Authorization':util[_0x1adc('0x43')](_0x1adc('0x46'),new Buffer(_0x23a3cb)['toString'](_0x1adc('0x48')))},'json':!![]};rp(_0x49a809)[_0x1adc('0x19')](function(_0x3da42d){if(_0x3da42d['id']){var _0x2c0822={'messageId':_0x3da42d['id']};return _0xc2f9d0[_0x1adc('0x1a')](_0x2c0822);}else{logger[_0x1adc('0x2a')](_0x1adc('0x2b'),'afterCreate',_0x1adc('0x6e'),util[_0x1adc('0x3b')](_0x3da42d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x554dfe){logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),'bandwidth',util[_0x1adc('0x3b')](_0x554dfe,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1adc('0x2b'),'afterCreate',_0x1adc('0x6e'),_0x1adc('0x3c'));}break;case _0x1adc('0x6f'):if(_0x31442d[_0x1adc('0x60')]){var _0x5af345={};var _0x4c1d97={'method':_0x1adc('0x36'),'uri':_0x1adc('0x70'),'headers':{'Authorization':_0x1adc('0x71')+_0x31442d['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x31442d[_0x1adc('0x20')],'to':_0x409733[_0x1adc('0x20')],'text':_0x409733[_0x1adc('0xe')]},'json':!![]};return rp(_0x4c1d97)[_0x1adc('0x19')](function(_0x579d27){if(_0x579d27[_0x1adc('0x72')]==0xca){_0x5af345[_0x1adc('0x73')]=_0x579d27;var _0x43d1f6={'method':_0x1adc('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x1adc('0x71')+_0x31442d[_0x1adc('0x60')],'Content-Type':_0x1adc('0x57')},'body':{'refid':_0x5af345[_0x1adc('0x73')][_0x1adc('0x74')]},'json':!![]};return rp(_0x43d1f6)[_0x1adc('0x19')](function(_0x5988fa){_0x5af345['status']=_0x5988fa;var _0x1d6fec={'messageId':_0x5af345['message'][_0x1adc('0x74')],'read':!![]};return _0xc2f9d0[_0x1adc('0x1a')](_0x1d6fec);});}else{return logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),_0x1adc('0x6f'),util['inspect'](_0x579d27,{'showHidden':![],'depth':null}));}})[_0x1adc('0x29')](function(_0x52e8a4){return logger[_0x1adc('0x2a')](_0x1adc('0x2b'),_0x1adc('0x2c'),'intelepeer',util[_0x1adc('0x3b')](_0x52e8a4,{'showHidden':![],'depth':null}));});}else{return logger[_0x1adc('0x2a')](_0x1adc('0x2b'),'afterCreate',_0x1adc('0x6f'),_0x1adc('0x75'));}break;}}})[_0x1adc('0x76')](function(){_0x30ea13();});}else{_0x30ea13();}}},'charset':_0x1adc('0x77'),'collate':_0x1adc('0x78')});}; \ No newline at end of file +var _0x04a5=['id_sms','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','/messages','applicationId','base64','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','intelepeer','Token\x20not\x20received','utf8mb4','lodash','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','direction','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/status?token=','token','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','username','&password=','GET','split','sms','user_key','session_key','internal_order_id','deliveryReport','read','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','format','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','keys','createHash','md5','digest','hex','signature=','/external/get/send.php?'];(function(_0x4f38a4,_0x3ed3a1){var _0x49e13d=function(_0x13fa96){while(--_0x13fa96){_0x4f38a4['push'](_0x4f38a4['shift']());}};_0x49e13d(++_0x3ed3a1);}(_0x04a5,0xfd));var _0x504a=function(_0x2dce9f,_0x1d1880){_0x2dce9f=_0x2dce9f-0x0;var _0x1cd454=_0x04a5[_0x2dce9f];return _0x1cd454;};'use strict';var _=require(_0x504a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x504a('0x1'));var BPromise=require(_0x504a('0x2'));var rp=require(_0x504a('0x3'));var fs=require('fs');var path=require(_0x504a('0x4'));var rimraf=require(_0x504a('0x5'));var config=require('../../config/environment');var attributes=require(_0x504a('0x6'));module['exports']=function(_0x1879d5,_0x3f10e0){return _0x1879d5[_0x504a('0x7')](_0x504a('0x8'),attributes,{'tableName':_0x504a('0x9'),'paranoid':![],'indexes':[{'name':_0x504a('0xa'),'fields':[_0x504a('0xa')]},{'name':'fti_sms_messages','fields':[_0x504a('0xb')],'type':_0x504a('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8239b2,_0x1e8309,_0x2e71bf){var _0x1735e1=_0x1879d5[_0x504a('0xd')];var _0x1ab621=_0x8239b2[_0x504a('0xe')]({'plain':!![]});if(_0x1ab621['direction'][_0x504a('0xf')]()==='in'||_0x1ab621['direction'][_0x504a('0xf')]()===_0x504a('0x10')&&!_0x1ab621[_0x504a('0x11')]&&!_[_0x504a('0x12')](_0x1ab621[_0x504a('0x13')])&&!_[_0x504a('0x12')](_0x1ab621['SmsInteractionId'])){_0x1735e1[_0x504a('0x14')][_0x504a('0x15')]({'where':{'id':_0x1ab621[_0x504a('0x16')]}})[_0x504a('0x17')](function(_0xa8e473){if(_0xa8e473){_0xa8e473[_0x504a('0x18')]({'lastMsgAt':_0x1ab621[_0x504a('0x19')],'lastMsgDirection':_0x1ab621[_0x504a('0x1a')]['toLowerCase']()});}})[_0x504a('0x1b')](function(_0x46fc32){console['error'](_0x46fc32);});}if(_0x1ab621['direction']===_0x504a('0x10')&&!_0x1ab621[_0x504a('0x11')]){var _0x29b6f6;_0x1735e1[_0x504a('0x1c')][_0x504a('0x1d')]({'where':{'id':_0x1ab621[_0x504a('0x1e')]},'raw':!![]})[_0x504a('0x17')](function(_0x5026c7){_0x29b6f6=_0x5026c7;if(_0x29b6f6&&_0x29b6f6['type']){switch(_0x29b6f6[_0x504a('0x1f')]){case _0x504a('0x20'):var _0x1fe632=require(_0x504a('0x20'));if(_0x29b6f6[_0x504a('0x21')]&&_0x29b6f6[_0x504a('0x22')]&&_0x29b6f6['phone']){var _0x382dbc=new _0x1fe632(_0x29b6f6['accountSid'],_0x29b6f6[_0x504a('0x22')]);_0x382dbc[_0x504a('0x23')][_0x504a('0x24')]({'body':_0x1ab621[_0x504a('0xb')],'to':_0x1ab621[_0x504a('0x25')],'from':_0x29b6f6['phone'],'statusCallback':_0x29b6f6[_0x504a('0x26')]+'/api/sms/messages/'+_0x1ab621['id']+_0x504a('0x27')+_0x29b6f6[_0x504a('0x28')]})[_0x504a('0x17')](function(_0x42beb9){if(_0x42beb9['sid']){return _0x8239b2[_0x504a('0x18')]({'messageId':_0x42beb9['sid']});}})[_0x504a('0x1b')](function(_0x322b0f){logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),'twilio',util[_0x504a('0x2c')](_0x322b0f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x504a('0x20'),_0x504a('0x2d'));}break;case _0x504a('0x2e'):var _0xf0da68='https://api.skebby.it/API/v1.0/REST/';if(_0x29b6f6['username']&&_0x29b6f6[_0x504a('0x2f')]){var _0x248b50={'recipient':[_0x1ab621[_0x504a('0x25')]],'message':_0x1ab621[_0x504a('0xb')],'message_type':_0x29b6f6[_0x504a('0x30')]};if(_0x29b6f6[_0x504a('0x30')]&&_0x29b6f6[_0x504a('0x30')]!=='SI'){_0x248b50[_0x504a('0x31')]=_0x29b6f6[_0x504a('0x25')];}var _0x105430={'url':_0xf0da68+'login?username='+_0x29b6f6[_0x504a('0x32')]+_0x504a('0x33')+_0x29b6f6[_0x504a('0x2f')],'method':_0x504a('0x34')};rp(_0x105430)[_0x504a('0x17')](function(_0x3b7d3a){var _0x452a9b=_0x3b7d3a[_0x504a('0x35')](';');var _0x40258d={'user_key':_0x452a9b[0x0],'session_key':_0x452a9b[0x1]};_0x105430={'url':_0xf0da68+_0x504a('0x36'),'method':'POST','headers':{'user_key':_0x40258d[_0x504a('0x37')],'Session_key':_0x40258d[_0x504a('0x38')]},'json':!![],'body':_0x248b50};return rp(_0x105430);})[_0x504a('0x17')](function(_0xe391b1){if(_0xe391b1['total_sent']>=0x1){var _0xbe7a1f={'messageId':_0xe391b1[_0x504a('0x39')]};if(_0x29b6f6[_0x504a('0x30')]!=='GP'||!_0x29b6f6[_0x504a('0x3a')]){_0xbe7a1f[_0x504a('0x3b')]=!![];}return _0x8239b2[_0x504a('0x18')](_0xbe7a1f);}else{return logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x2e'),util[_0x504a('0x2c')](_0xe391b1,{'showHidden':![],'depth':null}));}})[_0x504a('0x1b')](function(_0x4f5a5f){return logger[_0x504a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x504a('0x2b'),'skebby',util[_0x504a('0x2c')](_0x4f5a5f,{'showHidden':![],'depth':null}));});}else{logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x29b6f6[_0x504a('0x22')]){var _0x1d15b4={'recipient':_0x1ab621['phone'],'message':_0x1ab621[_0x504a('0xb')],'sender':_0x29b6f6[_0x504a('0x3c')]||_0x29b6f6[_0x504a('0x25')],'authorization':_0x29b6f6[_0x504a('0x22')]};var _0x1e8309={'method':_0x504a('0x3d'),'uri':_0x504a('0x3e'),'body':_0x1d15b4,'json':!![]};rp(_0x1e8309)[_0x504a('0x17')](function(_0x3943ad){var _0x2d9044={'messageId':_0x3943ad[_0x504a('0x3f')]};if(!_0x29b6f6['deliveryReport']){_0x2d9044[_0x504a('0x3b')]=!![];}return _0x8239b2[_0x504a('0x18')](_0x2d9044);})[_0x504a('0x1b')](function(_0x590462){logger['error'](_0x504a('0x2a'),_0x504a('0x2b'),'connectel',util[_0x504a('0x2c')](_0x590462,{'showHidden':![],'depth':null}));});}else{logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x40'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x29b6f6[_0x504a('0x32')]&&_0x29b6f6['password']){var _0x1d15b4={'messages':[{'source':_0x504a('0x41'),'to':_0x1ab621[_0x504a('0x25')],'body':_0x1ab621[_0x504a('0xb')],'from':_0x29b6f6[_0x504a('0x3c')]||_0x29b6f6['phone']}]};var _0x22b21a=util['format']('%s:%s',_0x29b6f6[_0x504a('0x32')],_0x29b6f6[_0x504a('0x2f')]);var _0x1e8309={'method':_0x504a('0x3d'),'uri':_0x504a('0x42'),'body':_0x1d15b4,'headers':{'Authorization':util[_0x504a('0x43')]('Basic\x20%s',new Buffer(_0x22b21a)['toString']('base64'))},'json':!![]};rp(_0x1e8309)[_0x504a('0x17')](function(_0x32d5bd){if(_0x32d5bd['http_code']>=0xc8&&_0x32d5bd[_0x504a('0x44')]<=0xce){if(_0x32d5bd[_0x504a('0x45')]&&_0x32d5bd[_0x504a('0x45')][_0x504a('0x46')]>0x0){var _0x13aca6=_[_0x504a('0x47')](_0x32d5bd[_0x504a('0x45')]['messages']);var _0xdb6d84={'messageId':_0x13aca6[_0x504a('0x48')]};if(!_0x29b6f6[_0x504a('0x3a')]){_0xdb6d84[_0x504a('0x3b')]=!![];}return _0x8239b2[_0x504a('0x18')](_0xdb6d84);}else{logger['error'](_0x504a('0x2a'),'afterCreate',_0x504a('0x49'),util[_0x504a('0x2c')](_0x32d5bd,{'showHidden':![],'depth':null}));}}else{logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),'clickSend',util[_0x504a('0x2c')](_0x32d5bd,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1a87f0){logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x49'),util['inspect'](_0x1a87f0,{'showHidden':![],'depth':null}));});}else{logger[_0x504a('0x29')](_0x504a('0x2a'),'afterCreate',_0x504a('0x49'),_0x504a('0x4a'));}break;case _0x504a('0x4b'):if(_0x29b6f6[_0x504a('0x4c')]&&_0x29b6f6[_0x504a('0x22')]){var _0x1d15b4={'dst':_0x1ab621[_0x504a('0x25')],'text':_0x1ab621['body'],'src':_0x29b6f6[_0x504a('0x3c')]||_0x29b6f6[_0x504a('0x25')],'url':_0x29b6f6[_0x504a('0x26')]+_0x504a('0x4d')+_0x1ab621['id']+_0x504a('0x27')+_0x29b6f6['token']};var _0x22b21a=util[_0x504a('0x43')](_0x504a('0x4e'),_0x29b6f6[_0x504a('0x4c')],_0x29b6f6['authToken']);var _0x1e8309={'method':_0x504a('0x3d'),'uri':util['format'](_0x504a('0x4f'),_0x29b6f6[_0x504a('0x4c')]),'body':_0x1d15b4,'headers':{'Authorization':util[_0x504a('0x43')](_0x504a('0x50'),new Buffer(_0x22b21a)[_0x504a('0x51')]('base64'))},'json':!![]};rp(_0x1e8309)[_0x504a('0x17')](function(_0x5c99b0){var _0x49ca7e={'messageId':_0x5c99b0[_0x504a('0x52')][0x0]};return _0x8239b2[_0x504a('0x18')](_0x49ca7e);})[_0x504a('0x1b')](function(_0x512307){logger[_0x504a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',util['inspect'](_0x512307,{'showHidden':![],'depth':null}));});}else{logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x4b'),_0x504a('0x53'));}break;case _0x504a('0x54'):if(_0x29b6f6[_0x504a('0x32')]&&_0x29b6f6[_0x504a('0x2f')]){if(_0x29b6f6[_0x504a('0x55')]){var _0x1852da={'method':_0x504a('0x3d'),'uri':_0x29b6f6[_0x504a('0x55')]+_0x504a('0x56'),'body':{'username':_0x29b6f6[_0x504a('0x32')],'password':_0x29b6f6['password']},'json':!![]};return rp(_0x1852da)[_0x504a('0x17')](function(_0x5bfa67){var _0x219102={'method':'POST','uri':_0x29b6f6[_0x504a('0x55')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x29b6f6['phone'],'destinations':[{'to':_0x1ab621[_0x504a('0x25')]}],'text':_0x1ab621['body'],'notifyUrl':_0x29b6f6[_0x504a('0x26')]+_0x504a('0x4d')+_0x1ab621['id']+'/status?token='+_0x29b6f6[_0x504a('0x28')],'notifyContentType':_0x504a('0x57'),'callbackData':_0x29b6f6[_0x504a('0x25')]+';'+_0x1ab621['body']}]},'headers':{'Authorization':_0x504a('0x58')+_0x5bfa67[_0x504a('0x28')]},'json':!![]};return rp(_0x219102)['then'](function(_0xcc1d07){if(_0xcc1d07[_0x504a('0x23')]){var _0x5e39d0={'messageId':_0xcc1d07[_0x504a('0x23')][0x0][_0x504a('0xa')]};if(!_0x29b6f6[_0x504a('0x3a')]){_0x5e39d0[_0x504a('0x3b')]=!![];}return _0x8239b2[_0x504a('0x18')](_0x5e39d0);}else{return logger['error'](_0x504a('0x2a'),'afterCreate',_0x504a('0x54'),util['inspect'](_0xcc1d07,{'showHidden':![],'depth':null}));}});})[_0x504a('0x1b')](function(_0x155caa){return logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),'infobip',util['inspect'](_0x155caa,{'showHidden':![],'depth':null}));});}else{logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x54'),_0x504a('0x59'));}}else{logger[_0x504a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x504a('0x54'),_0x504a('0x4a'));}break;case _0x504a('0x5a'):var _0x3d789b=require(_0x504a('0x5b'));if(_0x29b6f6[_0x504a('0x5c')]){var _0x49b67b={};_0x49b67b['login']=_0x29b6f6[_0x504a('0x32')];_0x49b67b[_0x504a('0x25')]=_0x1ab621['phone'];_0x49b67b[_0x504a('0x31')]=_0x29b6f6['phone'];_0x49b67b['text']=_0x1ab621[_0x504a('0xb')];_0x49b67b[_0x504a('0x5d')]=+new Date();var _0x16785c='';var _0x1939cb='';var _0x567108=Object[_0x504a('0x5e')](_0x49b67b);_0x567108['sort']();for(var _0x5402bd=0x0;_0x5402bd<_0x567108['length'];_0x5402bd++){if(_0x16785c!=''){_0x16785c+='&';}_0x16785c+=_0x567108[_0x5402bd]+'='+encodeURIComponent(_0x49b67b[_0x567108[_0x5402bd]]);_0x1939cb+=_0x49b67b[_0x567108[_0x5402bd]];}_0x1939cb+=_0x29b6f6[_0x504a('0x5c')];_0x1939cb=_0x3d789b[_0x504a('0x5f')](_0x504a('0x60'))['update'](_0x1939cb)[_0x504a('0x61')](_0x504a('0x62'));if(_0x16785c!==''){_0x16785c+='&';}_0x16785c+=_0x504a('0x63')+_0x1939cb;var _0x105430={'method':_0x504a('0x34'),'uri':_0x29b6f6[_0x504a('0x55')]+_0x504a('0x64')+_0x16785c,'json':!![]};return rp(_0x105430)[_0x504a('0x17')](function(_0x226e48){var _0x1e9d6a=Object[_0x504a('0x5e')](_0x226e48);if(_0x226e48[_0x1e9d6a[0x0]][_0x504a('0x29')]&&parseInt(_0x226e48[_0x1e9d6a[0x0]][_0x504a('0x29')])===0x0){var _0x1ea14e={'messageId':_0x226e48[_0x1e9d6a[0x0]][_0x504a('0x65')]};if(!_0x29b6f6[_0x504a('0x3a')]){_0x1ea14e[_0x504a('0x3b')]=!![];}return _0x8239b2[_0x504a('0x18')](_0x1ea14e);}else{return logger[_0x504a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x504a('0x2b'),_0x504a('0x5a'),util[_0x504a('0x2c')](_0x226e48[_0x504a('0x29')],{'showHidden':![],'depth':null}));}})[_0x504a('0x1b')](function(_0x372c89){return logger[_0x504a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x504a('0x2b'),_0x504a('0x5a'),util['inspect'](_0x372c89,{'showHidden':![],'depth':null}));});}else{logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),'csc','Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x29b6f6[_0x504a('0x5c')]){var _0x15ce21={'method':'POST','uri':_0x504a('0x66'),'headers':{'Authorization':_0x29b6f6['apiKey']},'body':{'content':_0x1ab621[_0x504a('0xb')],'to':[_0x1ab621[_0x504a('0x25')]],'from':_0x29b6f6[_0x504a('0x25')],'binary':![],'clientMessageId':_0x504a('0x67'),'charset':_0x504a('0x68')},'json':!![]};rp(_0x15ce21)[_0x504a('0x17')](function(_0x1d8dd9){if(!_0x1d8dd9[_0x504a('0x29')]){var _0x5da00e={'messageId':_0x1d8dd9['messages'][0x0][_0x504a('0x69')]};if(!_0x29b6f6[_0x504a('0x3a')]){_0x5da00e[_0x504a('0x3b')]=!![];}return _0x8239b2[_0x504a('0x18')](_0x5da00e);}else{return logger[_0x504a('0x29')](_0x504a('0x2a'),'afterCreate','clickatell',util[_0x504a('0x2c')](_0x1d8dd9[_0x504a('0x29')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4a1b7a){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x504a('0x2b'),'clickatell',util['inspect'](_0x4a1b7a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x6a'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x29b6f6['username']&&_0x29b6f6[_0x504a('0x2f')]){var _0x22b21a=util[_0x504a('0x43')]('%s:%s',_0x29b6f6[_0x504a('0x32')],_0x29b6f6[_0x504a('0x2f')]);var _0x1e8309={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x29b6f6['accountId']+_0x504a('0x6b'),'body':{'to':[_0x1ab621[_0x504a('0x25')]],'text':_0x1ab621[_0x504a('0xb')],'from':_0x29b6f6['phone'],'applicationId':_0x29b6f6[_0x504a('0x6c')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x22b21a)[_0x504a('0x51')](_0x504a('0x6d')))},'json':!![]};rp(_0x1e8309)[_0x504a('0x17')](function(_0x3341b4){if(_0x3341b4['id']){var _0x22198d={'messageId':_0x3341b4['id']};return _0x8239b2[_0x504a('0x18')](_0x22198d);}else{logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),'bandwidth',util[_0x504a('0x2c')](_0x3341b4,{'showHidden':![],'depth':null}));}})[_0x504a('0x1b')](function(_0x118b95){logger['error'](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x6e'),util['inspect'](_0x118b95,{'showHidden':![],'depth':null}));});}else{logger[_0x504a('0x29')](_0x504a('0x2a'),_0x504a('0x2b'),_0x504a('0x6e'),_0x504a('0x4a'));}break;case'intelepeer':if(_0x29b6f6[_0x504a('0x5c')]){var _0x33430c={};var _0x105430={'method':_0x504a('0x3d'),'uri':_0x504a('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x29b6f6[_0x504a('0x5c')],'Content-Type':_0x504a('0x57')},'body':{'from':_0x29b6f6[_0x504a('0x25')],'to':_0x1ab621[_0x504a('0x25')],'text':_0x1ab621[_0x504a('0xb')]},'json':!![]};return rp(_0x105430)['then'](function(_0x43f641){if(_0x43f641[_0x504a('0x70')]==0xca){_0x33430c[_0x504a('0x71')]=_0x43f641;var _0x4715b1={'method':'POST','uri':_0x504a('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x29b6f6['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x33430c['message']['refid']},'json':!![]};return rp(_0x4715b1)['then'](function(_0x50381c){_0x33430c['status']=_0x50381c;var _0x98da7f={'messageId':_0x33430c[_0x504a('0x71')]['refid'],'read':!![]};return _0x8239b2[_0x504a('0x18')](_0x98da7f);});}else{return logger[_0x504a('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x504a('0x2c')](_0x43f641,{'showHidden':![],'depth':null}));}})[_0x504a('0x1b')](function(_0x409f73){return logger['error'](_0x504a('0x2a'),_0x504a('0x2b'),'intelepeer',util[_0x504a('0x2c')](_0x409f73,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x504a('0x2a'),'afterCreate',_0x504a('0x73'),_0x504a('0x74'));}break;}}})['finally'](function(){_0x2e71bf();});}else{_0x2e71bf();}}},'charset':_0x504a('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 005992c..1b1d0e3 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 _0x8e8a=['error','code','message','info','catch','CreateSmsMessage','SmsMessage','create','options','raw','then','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x1bcd2a,_0x1f4f0e){var _0x4a14db=function(_0x2e0870){while(--_0x2e0870){_0x1bcd2a['push'](_0x1bcd2a['shift']());}};_0x4a14db(++_0x1f4f0e);}(_0x8e8a,0x88));var _0xa8e8=function(_0x31c536,_0x21a315){_0x31c536=_0x31c536-0x0;var _0x3b1e6e=_0x8e8a[_0x31c536];return _0x3b1e6e;};'use strict';var _=require(_0xa8e8('0x0'));var util=require(_0xa8e8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa8e8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8e8('0x3'))['db'];var utils=require(_0xa8e8('0x4'));var logger=require(_0xa8e8('0x5'))(_0xa8e8('0x6'));var config=require('../../config/environment');var jayson=require(_0xa8e8('0x7'));var client=jayson[_0xa8e8('0x8')][_0xa8e8('0x9')]({'port':0x232a});config['redis']=_[_0xa8e8('0xa')](config[_0xa8e8('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8e8('0xb')]));require(_0xa8e8('0xc'))[_0xa8e8('0xd')](socket);function respondWithRpcPromise(_0x2a920f,_0x2dc1b2,_0xc1d998){return new BPromise(function(_0x486f48,_0x37bcdf){return client[_0xa8e8('0xe')](_0x2a920f,_0xc1d998)['then'](function(_0x3211d6){logger['info'](_0xa8e8('0xf'),_0x2dc1b2,_0xa8e8('0x10'));logger[_0xa8e8('0x11')](_0xa8e8('0x12'),_0x2dc1b2,'request\x20sent',JSON['stringify'](_0x3211d6));if(_0x3211d6['error']){if(_0x3211d6[_0xa8e8('0x13')][_0xa8e8('0x14')]===0x1f4){logger['error'](_0xa8e8('0xf'),_0x2dc1b2,_0x3211d6['error']['message']);return _0x37bcdf(_0x3211d6['error'][_0xa8e8('0x15')]);}logger[_0xa8e8('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2dc1b2,_0x3211d6[_0xa8e8('0x13')]['message']);return _0x486f48(_0x3211d6[_0xa8e8('0x13')]['message']);}else{logger[_0xa8e8('0x16')](_0xa8e8('0xf'),_0x2dc1b2,_0xa8e8('0x10'));_0x486f48(_0x3211d6['result']['message']);}})[_0xa8e8('0x17')](function(_0x419f3e){logger['error'](_0xa8e8('0xf'),_0x2dc1b2,_0x419f3e);_0x37bcdf(_0x419f3e);});});}exports[_0xa8e8('0x18')]=function(_0x27242e){var _0x49297b=this;return new Promise(function(_0x643d94,_0x109058){return db[_0xa8e8('0x19')][_0xa8e8('0x1a')](_0x27242e['body'],{'raw':_0x27242e[_0xa8e8('0x1b')]?_0x27242e[_0xa8e8('0x1b')][_0xa8e8('0x1c')]===undefined?!![]:![]:!![]})[_0xa8e8('0x1d')](function(_0x23f754){logger[_0xa8e8('0x16')](_0xa8e8('0x18'),_0x27242e);logger[_0xa8e8('0x11')]('CreateSmsMessage',_0x27242e,JSON[_0xa8e8('0x1e')](_0x23f754));_0x643d94(_0x23f754);})[_0xa8e8('0x17')](function(_0x406474){logger[_0xa8e8('0x13')](_0xa8e8('0x18'),_0x406474[_0xa8e8('0x15')],_0x27242e);_0x109058(_0x49297b['error'](0x1f4,_0x406474[_0xa8e8('0x15')]));});});}; \ No newline at end of file +var _0x87ab=['defaults','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis'];(function(_0x191f0a,_0x2dc673){var _0x45aa85=function(_0x4022ab){while(--_0x4022ab){_0x191f0a['push'](_0x191f0a['shift']());}};_0x45aa85(++_0x2dc673);}(_0x87ab,0xf5));var _0xb87a=function(_0x416919,_0x350275){_0x416919=_0x416919-0x0;var _0xa6ba1a=_0x87ab[_0x416919];return _0xa6ba1a;};'use strict';var _=require(_0xb87a('0x0'));var util=require(_0xb87a('0x1'));var moment=require(_0xb87a('0x2'));var BPromise=require(_0xb87a('0x3'));var rs=require(_0xb87a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb87a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb87a('0x6'));var config=require(_0xb87a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb87a('0x8')][_0xb87a('0x9')]({'port':0x232a});config[_0xb87a('0xa')]=_[_0xb87a('0xb')](config[_0xb87a('0xa')],{'host':_0xb87a('0xc'),'port':0x18eb});var socket=require(_0xb87a('0xd'))(new Redis(config[_0xb87a('0xa')]));require(_0xb87a('0xe'))[_0xb87a('0xf')](socket);function respondWithRpcPromise(_0x11b151,_0x5111ff,_0x4f50a9){return new BPromise(function(_0x462d94,_0x108b33){return client['request'](_0x11b151,_0x4f50a9)[_0xb87a('0x10')](function(_0x2902d8){logger[_0xb87a('0x11')](_0xb87a('0x12'),_0x5111ff,_0xb87a('0x13'));logger[_0xb87a('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5111ff,_0xb87a('0x13'),JSON[_0xb87a('0x15')](_0x2902d8));if(_0x2902d8[_0xb87a('0x16')]){if(_0x2902d8[_0xb87a('0x16')][_0xb87a('0x17')]===0x1f4){logger[_0xb87a('0x16')]('SmsMessage,\x20%s,\x20%s',_0x5111ff,_0x2902d8[_0xb87a('0x16')][_0xb87a('0x18')]);return _0x108b33(_0x2902d8['error']['message']);}logger[_0xb87a('0x16')](_0xb87a('0x12'),_0x5111ff,_0x2902d8[_0xb87a('0x16')][_0xb87a('0x18')]);return _0x462d94(_0x2902d8[_0xb87a('0x16')][_0xb87a('0x18')]);}else{logger['info'](_0xb87a('0x12'),_0x5111ff,_0xb87a('0x13'));_0x462d94(_0x2902d8[_0xb87a('0x19')][_0xb87a('0x18')]);}})[_0xb87a('0x1a')](function(_0x59d902){logger[_0xb87a('0x16')](_0xb87a('0x12'),_0x5111ff,_0x59d902);_0x108b33(_0x59d902);});});}exports[_0xb87a('0x1b')]=function(_0xf3dcd1){var _0x22d1b3=this;return new Promise(function(_0x428f26,_0x472427){return db[_0xb87a('0x1c')][_0xb87a('0x1d')](_0xf3dcd1['body'],{'raw':_0xf3dcd1[_0xb87a('0x1e')]?_0xf3dcd1[_0xb87a('0x1e')][_0xb87a('0x1f')]===undefined?!![]:![]:!![]})[_0xb87a('0x10')](function(_0x50b78f){logger[_0xb87a('0x11')]('CreateSmsMessage',_0xf3dcd1);logger[_0xb87a('0x14')](_0xb87a('0x1b'),_0xf3dcd1,JSON[_0xb87a('0x15')](_0x50b78f));_0x428f26(_0x50b78f);})[_0xb87a('0x1a')](function(_0x58f32b){logger[_0xb87a('0x16')](_0xb87a('0x1b'),_0x58f32b[_0xb87a('0x18')],_0xf3dcd1);_0x472427(_0x22d1b3[_0xb87a('0x16')](0x1f4,_0x58f32b[_0xb87a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 2493ec3..e8a3399 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 _0x8584=['save','remove','update','emit','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x56e86f,_0x91eb2d){var _0x30df16=function(_0x216ac0){while(--_0x216ac0){_0x56e86f['push'](_0x56e86f['shift']());}};_0x30df16(++_0x91eb2d);}(_0x8584,0xbc));var _0x4858=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x8584[_0x2f5ac5];return _0x37c9a8;};'use strict';var SmsMessageEvents=require(_0x4858('0x0'));var events=[_0x4858('0x1'),_0x4858('0x2'),_0x4858('0x3')];function createListener(_0x20c646,_0x10a541){return function(_0x123113){_0x10a541[_0x4858('0x4')](_0x20c646,_0x123113);};}function removeListener(_0x1add97,_0x595042){return function(){SmsMessageEvents[_0x4858('0x5')](_0x1add97,_0x595042);};}exports[_0x4858('0x6')]=function(_0x295cc8){for(var _0x1293e8=0x0,_0x40ca26=events[_0x4858('0x7')];_0x1293e8<_0x40ca26;_0x1293e8++){var _0x4d03de=events[_0x1293e8];var _0x56b574=createListener(_0x4858('0x8')+_0x4d03de,_0x295cc8);SmsMessageEvents['on'](_0x4d03de,_0x56b574);}}; \ No newline at end of file +var _0xb6a9=['register','length','smsMessage:','./smsMessage.events','remove','update','removeListener'];(function(_0x5ec6b5,_0x4b8e00){var _0x21324e=function(_0x389bf9){while(--_0x389bf9){_0x5ec6b5['push'](_0x5ec6b5['shift']());}};_0x21324e(++_0x4b8e00);}(_0xb6a9,0x184));var _0x9b6a=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb6a9[_0xc67528];return _0x38e26d;};'use strict';var SmsMessageEvents=require(_0x9b6a('0x0'));var events=['save',_0x9b6a('0x1'),_0x9b6a('0x2')];function createListener(_0x460fcf,_0x24800c){return function(_0x52034b){_0x24800c['emit'](_0x460fcf,_0x52034b);};}function removeListener(_0x3904c0,_0x5a31fb){return function(){SmsMessageEvents[_0x9b6a('0x3')](_0x3904c0,_0x5a31fb);};}exports[_0x9b6a('0x4')]=function(_0x3425f0){for(var _0x5bb4b7=0x0,_0x56f3a3=events[_0x9b6a('0x5')];_0x5bb4b7<_0x56f3a3;_0x5bb4b7++){var _0x347b9c=events[_0x5bb4b7];var _0x467323=createListener(_0x9b6a('0x6')+_0x347b9c,_0x3425f0);SmsMessageEvents['on'](_0x347b9c,_0x467323);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5149857..62d96f5 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 _0x41eb=['./smsQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','path','Router','fs-extra','../../components/interaction/service'];(function(_0x3bbbdf,_0x22159c){var _0x133799=function(_0x5f5280){while(--_0x5f5280){_0x3bbbdf['push'](_0x3bbbdf['shift']());}};_0x133799(++_0x22159c);}(_0x41eb,0x7d));var _0xb41e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41eb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb41e('0x0'));var util=require('util');var path=require(_0xb41e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb41e('0x2')]();var fs_extra=require(_0xb41e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb41e('0x4'));var config=require('../../config/environment');var controller=require(_0xb41e('0x5'));router[_0xb41e('0x6')]('/',auth['isAuthenticated'](),controller[_0xb41e('0x7')]);router[_0xb41e('0x6')](_0xb41e('0x8'),auth['isAuthenticated'](),controller[_0xb41e('0x9')]);router[_0xb41e('0x6')](_0xb41e('0xa'),auth[_0xb41e('0xb')](),controller['show']);router['get'](_0xb41e('0xc'),auth['isAuthenticated'](),controller[_0xb41e('0xd')]);router[_0xb41e('0x6')](_0xb41e('0xe'),auth[_0xb41e('0xb')](),controller[_0xb41e('0xf')]);router[_0xb41e('0x6')](_0xb41e('0x10'),auth[_0xb41e('0xb')](),controller['getAgents']);router[_0xb41e('0x11')]('/',auth[_0xb41e('0xb')](),controller[_0xb41e('0x12')]);router['post'](_0xb41e('0xe'),auth[_0xb41e('0xb')](),controller[_0xb41e('0x13')]);router[_0xb41e('0x11')]('/:id/users',auth[_0xb41e('0xb')](),controller[_0xb41e('0x14')]);router[_0xb41e('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb41e('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xb41e('0x16')](_0xb41e('0xe'),auth[_0xb41e('0xb')](),controller[_0xb41e('0x17')]);router[_0xb41e('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xb41e('0x18')]);module[_0xb41e('0x19')]=router; \ No newline at end of file +var _0x88ac=['post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x57cb27,_0x2d53f0){var _0x4e73af=function(_0x4a6f3c){while(--_0x4a6f3c){_0x57cb27['push'](_0x57cb27['shift']());}};_0x4e73af(++_0x2d53f0);}(_0x88ac,0x1bd));var _0xc88a=function(_0x54f36e,_0x4e2f98){_0x54f36e=_0x54f36e-0x0;var _0x4c1d8e=_0x88ac[_0x54f36e];return _0x4c1d8e;};'use strict';var multer=require('multer');var util=require(_0xc88a('0x0'));var path=require(_0xc88a('0x1'));var timeout=require(_0xc88a('0x2'));var express=require(_0xc88a('0x3'));var router=express[_0xc88a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc88a('0x5'));var interaction=require(_0xc88a('0x6'));var config=require(_0xc88a('0x7'));var controller=require(_0xc88a('0x8'));router[_0xc88a('0x9')]('/',auth[_0xc88a('0xa')](),controller[_0xc88a('0xb')]);router[_0xc88a('0x9')](_0xc88a('0xc'),auth['isAuthenticated'](),controller[_0xc88a('0xd')]);router[_0xc88a('0x9')](_0xc88a('0xe'),auth[_0xc88a('0xa')](),controller['show']);router[_0xc88a('0x9')](_0xc88a('0xf'),auth[_0xc88a('0xa')](),controller['getMembers']);router[_0xc88a('0x9')](_0xc88a('0x10'),auth[_0xc88a('0xa')](),controller[_0xc88a('0x11')]);router['get'](_0xc88a('0x12'),auth[_0xc88a('0xa')](),controller['getAgents']);router[_0xc88a('0x13')]('/',auth['isAuthenticated'](),controller[_0xc88a('0x14')]);router[_0xc88a('0x13')](_0xc88a('0x10'),auth[_0xc88a('0xa')](),controller[_0xc88a('0x15')]);router[_0xc88a('0x13')]('/:id/users',auth[_0xc88a('0xa')](),controller[_0xc88a('0x16')]);router[_0xc88a('0x17')](_0xc88a('0xe'),auth[_0xc88a('0xa')](),controller[_0xc88a('0x18')]);router[_0xc88a('0x19')](_0xc88a('0xe'),auth[_0xc88a('0xa')](),controller['destroy']);router[_0xc88a('0x19')](_0xc88a('0x10'),auth[_0xc88a('0xa')](),controller[_0xc88a('0x1a')]);router[_0xc88a('0x19')](_0xc88a('0x12'),auth[_0xc88a('0xa')](),controller[_0xc88a('0x1b')]);module[_0xc88a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e023a26..e0cc2a2 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 _0x7780=['rrmemory','beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x5b1a59,_0x1901da){var _0x49eade=function(_0x1f92bc){while(--_0x1f92bc){_0x5b1a59['push'](_0x5b1a59['shift']());}};_0x49eade(++_0x1901da);}(_0x7780,0xc6));var _0x0778=function(_0x5d3306,_0x6e1379){_0x5d3306=_0x5d3306-0x0;var _0x6968f7=_0x7780[_0x5d3306];return _0x6968f7;};'use strict';var Sequelize=require(_0x0778('0x0'));module[_0x0778('0x1')]={'name':{'type':Sequelize[_0x0778('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0778('0x2')]},'timeout':{'type':Sequelize[_0x0778('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0778('0x4')](_0x0778('0x5'),_0x0778('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xe195=['name','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x176b19,_0x4cbac4){var _0x6353f4=function(_0x1d9eae){while(--_0x1d9eae){_0x176b19['push'](_0x176b19['shift']());}};_0x6353f4(++_0x4cbac4);}(_0xe195,0x11e));var _0x5e19=function(_0x4df78f,_0x3356b0){_0x4df78f=_0x4df78f-0x0;var _0xa47118=_0xe195[_0x4df78f];return _0xa47118;};'use strict';var Sequelize=require(_0x5e19('0x0'));module[_0x5e19('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5e19('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e19('0x3')]},'timeout':{'type':Sequelize[_0x5e19('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e19('0x5')](_0x5e19('0x6'),'beepall',_0x5e19('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 368b9dd..d4746b4 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 _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1c7b4c,_0x5b85b2){_0x1c7b4c=_0x1c7b4c-0x0;var _0x18daf6=_0x0b0e[_0x1c7b4c];return _0x18daf6;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x531f56,_0x334fcc){var _0x2cd1d4=function(_0x12a368){while(--_0x12a368){_0x531f56['push'](_0x531f56['shift']());}};_0x2cd1d4(++_0x334fcc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35781e,_0x4db7e8){_0x35781e=_0x35781e-0x0;var _0x5d24a2=_0x5f2f[_0x35781e];return _0x5d24a2;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 4d76fc3..ff94133 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 _0x5217=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x510b24,_0xbe3c5b){var _0x310de4=function(_0x2b95ef){while(--_0x2b95ef){_0x510b24['push'](_0x510b24['shift']());}};_0x310de4(++_0xbe3c5b);}(_0x5217,0x1ad));var _0x7521=function(_0x35d1bc,_0x38e666){_0x35d1bc=_0x35d1bc-0x0;var _0x4376fc=_0x5217[_0x35d1bc];return _0x4376fc;};'use strict';var EventEmitter=require(_0x7521('0x0'));var SmsQueue=require(_0x7521('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7521('0x2'),'afterUpdate':_0x7521('0x3'),'afterDestroy':'remove'};function emitEvent(_0x458745){return function(_0x21662f,_0x4ba85b,_0x5a78f7){SmsQueueEvents[_0x7521('0x4')](_0x458745+':'+_0x21662f['id'],_0x21662f);SmsQueueEvents['emit'](_0x458745,_0x21662f);_0x5a78f7(null);};}for(var e in events){if(events[_0x7521('0x5')](e)){var event=events[e];SmsQueue[_0x7521('0x6')](e,emitEvent(event));}}module[_0x7521('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xabe6=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3e6647,_0x2c0d09){var _0x46bddd=function(_0xad96c0){while(--_0xad96c0){_0x3e6647['push'](_0x3e6647['shift']());}};_0x46bddd(++_0x2c0d09);}(_0xabe6,0x163));var _0x6abe=function(_0x3d3845,_0x198036){_0x3d3845=_0x3d3845-0x0;var _0x27c984=_0xabe6[_0x3d3845];return _0x27c984;};'use strict';var EventEmitter=require(_0x6abe('0x0'));var SmsQueue=require(_0x6abe('0x1'))['db'][_0x6abe('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6abe('0x3')](0x0);var events={'afterCreate':_0x6abe('0x4'),'afterUpdate':_0x6abe('0x5'),'afterDestroy':_0x6abe('0x6')};function emitEvent(_0x494390){return function(_0x6481e2,_0x47fd1d,_0x3bab72){SmsQueueEvents['emit'](_0x494390+':'+_0x6481e2['id'],_0x6481e2);SmsQueueEvents[_0x6abe('0x7')](_0x494390,_0x6481e2);_0x3bab72(null);};}for(var e in events){if(events[_0x6abe('0x8')](e)){var event=events[e];SmsQueue[_0x6abe('0x9')](e,emitEvent(event));}}module[_0x6abe('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a1ca5b7..7df5041 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 _0x6c34=['path','rimraf','../../config/environment','exports','define','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x58176b,_0x1b4a62){var _0x2a89cd=function(_0x28e7ea){while(--_0x28e7ea){_0x58176b['push'](_0x58176b['shift']());}};_0x2a89cd(++_0x1b4a62);}(_0x6c34,0x10b));var _0x46c3=function(_0x3bf759,_0x4fad7d){_0x3bf759=_0x3bf759-0x0;var _0x24dd5b=_0x6c34[_0x3bf759];return _0x24dd5b;};'use strict';var _=require('lodash');var util=require(_0x46c3('0x0'));var logger=require(_0x46c3('0x1'))(_0x46c3('0x2'));var moment=require(_0x46c3('0x3'));var BPromise=require(_0x46c3('0x4'));var rp=require(_0x46c3('0x5'));var fs=require('fs');var path=require(_0x46c3('0x6'));var rimraf=require(_0x46c3('0x7'));var config=require(_0x46c3('0x8'));var attributes=require('./smsQueue.attributes');module[_0x46c3('0x9')]=function(_0x1dd932,_0x179369){return _0x1dd932[_0x46c3('0xa')](_0x46c3('0xb'),attributes,{'tableName':_0x46c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0532=['define','SmsQueue','sms_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x213283,_0x40ae6c){var _0x26ee9e=function(_0x3d7364){while(--_0x3d7364){_0x213283['push'](_0x213283['shift']());}};_0x26ee9e(++_0x40ae6c);}(_0x0532,0x107));var _0x2053=function(_0x30a869,_0xbc8362){_0x30a869=_0x30a869-0x0;var _0x364f75=_0x0532[_0x30a869];return _0x364f75;};'use strict';var _=require('lodash');var util=require(_0x2053('0x0'));var logger=require('../../config/logger')(_0x2053('0x1'));var moment=require(_0x2053('0x2'));var BPromise=require(_0x2053('0x3'));var rp=require(_0x2053('0x4'));var fs=require('fs');var path=require(_0x2053('0x5'));var rimraf=require(_0x2053('0x6'));var config=require(_0x2053('0x7'));var attributes=require(_0x2053('0x8'));module[_0x2053('0x9')]=function(_0x39d246,_0x8e73a4){return _0x39d246[_0x2053('0xa')](_0x2053('0xb'),attributes,{'tableName':_0x2053('0xc'),'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 26eb81a..5c88f38 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 _0xc724=['include','map','model','info','catch','ShowSmsQueue','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./smsQueue.socket','register','request','then','request\x20sent','debug','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','result','GetSmsQueue','SmsQueue','findAll','options','raw','attributes'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xc724,0x1c3));var _0x4c72=function(_0xff7b4,_0x3b7c59){_0xff7b4=_0xff7b4-0x0;var _0x211e69=_0xc724[_0xff7b4];return _0x211e69;};'use strict';var _=require(_0x4c72('0x0'));var util=require('util');var moment=require(_0x4c72('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c72('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c72('0x3'))['db'];var utils=require(_0x4c72('0x4'));var logger=require(_0x4c72('0x5'))(_0x4c72('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c72('0x7'));var client=jayson[_0x4c72('0x8')]['http']({'port':0x232a});config[_0x4c72('0x9')]=_[_0x4c72('0xa')](config[_0x4c72('0x9')],{'host':_0x4c72('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c72('0x9')]));require(_0x4c72('0xc'))[_0x4c72('0xd')](socket);function respondWithRpcPromise(_0x41f106,_0x145b62,_0x45b72c){return new BPromise(function(_0x487cbc,_0x147354){return client[_0x4c72('0xe')](_0x41f106,_0x45b72c)[_0x4c72('0xf')](function(_0x1aac4b){logger['info']('SmsQueue,\x20%s,\x20%s',_0x145b62,_0x4c72('0x10'));logger[_0x4c72('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x145b62,_0x4c72('0x10'),JSON[_0x4c72('0x12')](_0x1aac4b));if(_0x1aac4b[_0x4c72('0x13')]){if(_0x1aac4b[_0x4c72('0x13')][_0x4c72('0x14')]===0x1f4){logger[_0x4c72('0x13')]('SmsQueue,\x20%s,\x20%s',_0x145b62,_0x1aac4b[_0x4c72('0x13')][_0x4c72('0x15')]);return _0x147354(_0x1aac4b[_0x4c72('0x13')][_0x4c72('0x15')]);}logger[_0x4c72('0x13')](_0x4c72('0x16'),_0x145b62,_0x1aac4b[_0x4c72('0x13')][_0x4c72('0x15')]);return _0x487cbc(_0x1aac4b['error'][_0x4c72('0x15')]);}else{logger['info'](_0x4c72('0x16'),_0x145b62,_0x4c72('0x10'));_0x487cbc(_0x1aac4b[_0x4c72('0x17')][_0x4c72('0x15')]);}})['catch'](function(_0x5a9772){logger[_0x4c72('0x13')](_0x4c72('0x16'),_0x145b62,_0x5a9772);_0x147354(_0x5a9772);});});}exports[_0x4c72('0x18')]=function(_0x28865d){var _0x344e65=this;return new Promise(function(_0x1adb7d,_0x23886e){return db[_0x4c72('0x19')][_0x4c72('0x1a')]({'raw':_0x28865d[_0x4c72('0x1b')]?_0x28865d[_0x4c72('0x1b')][_0x4c72('0x1c')]===undefined?!![]:![]:!![],'where':_0x28865d[_0x4c72('0x1b')]?_0x28865d['options']['where']||null:null,'attributes':_0x28865d[_0x4c72('0x1b')]?_0x28865d[_0x4c72('0x1b')][_0x4c72('0x1d')]||null:null,'limit':_0x28865d[_0x4c72('0x1b')]?_0x28865d[_0x4c72('0x1b')]['limit']||null:null,'include':_0x28865d['options']?_0x28865d['options'][_0x4c72('0x1e')]?_[_0x4c72('0x1f')](_0x28865d[_0x4c72('0x1b')][_0x4c72('0x1e')],function(_0x2d4f3c){return{'model':db[_0x2d4f3c[_0x4c72('0x20')]],'as':_0x2d4f3c['as'],'attributes':_0x2d4f3c[_0x4c72('0x1d')],'include':_0x2d4f3c['include']?_[_0x4c72('0x1f')](_0x2d4f3c[_0x4c72('0x1e')],function(_0x447d6b){return{'model':db[_0x447d6b['model']],'as':_0x447d6b['as'],'attributes':_0x447d6b[_0x4c72('0x1d')],'include':_0x447d6b['include']?_[_0x4c72('0x1f')](_0x447d6b['include'],function(_0x21d75a){return{'model':db[_0x21d75a[_0x4c72('0x20')]],'as':_0x21d75a['as'],'attributes':_0x21d75a[_0x4c72('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x477f72){logger[_0x4c72('0x21')](_0x4c72('0x18'),_0x28865d);logger[_0x4c72('0x11')](_0x4c72('0x18'),_0x28865d,JSON[_0x4c72('0x12')](_0x477f72));_0x1adb7d(_0x477f72);})[_0x4c72('0x22')](function(_0x10b278){logger['error'](_0x4c72('0x18'),_0x10b278[_0x4c72('0x15')],_0x28865d);_0x23886e(_0x344e65[_0x4c72('0x13')](0x1f4,_0x10b278[_0x4c72('0x15')]));});});};exports[_0x4c72('0x23')]=function(_0x3f3e1e){var _0x30cbb0=this;return new Promise(function(_0x1f29ef,_0x4b89a7){return db['SmsQueue'][_0x4c72('0x24')]({'raw':_0x3f3e1e[_0x4c72('0x1b')]?_0x3f3e1e[_0x4c72('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f3e1e[_0x4c72('0x1b')]?_0x3f3e1e[_0x4c72('0x1b')]['where']||null:null,'attributes':_0x3f3e1e[_0x4c72('0x1b')]?_0x3f3e1e['options']['attributes']||null:null,'include':_0x3f3e1e[_0x4c72('0x1b')]?_0x3f3e1e[_0x4c72('0x1b')]['include']?_[_0x4c72('0x1f')](_0x3f3e1e['options'][_0x4c72('0x1e')],function(_0x5e5439){return{'model':db[_0x5e5439[_0x4c72('0x20')]],'as':_0x5e5439['as'],'attributes':_0x5e5439['attributes'],'include':_0x5e5439[_0x4c72('0x1e')]?_['map'](_0x5e5439[_0x4c72('0x1e')],function(_0x309be5){return{'model':db[_0x309be5[_0x4c72('0x20')]],'as':_0x309be5['as'],'attributes':_0x309be5[_0x4c72('0x1d')],'include':_0x309be5[_0x4c72('0x1e')]?_[_0x4c72('0x1f')](_0x309be5[_0x4c72('0x1e')],function(_0x5b2cd6){return{'model':db[_0x5b2cd6[_0x4c72('0x20')]],'as':_0x5b2cd6['as'],'attributes':_0x5b2cd6[_0x4c72('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c72('0xf')](function(_0x16cb93){logger[_0x4c72('0x21')]('ShowSmsQueue',_0x3f3e1e);logger[_0x4c72('0x11')](_0x4c72('0x23'),_0x3f3e1e,JSON['stringify'](_0x16cb93));_0x1f29ef(_0x16cb93);})[_0x4c72('0x22')](function(_0x2abdad){logger[_0x4c72('0x13')](_0x4c72('0x23'),_0x2abdad['message'],_0x3f3e1e);_0x4b89a7(_0x30cbb0['error'](0x1f4,_0x2abdad[_0x4c72('0x15')]));});});}; \ No newline at end of file +var _0x0578=['info','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','model','map','then','ShowSmsQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x27261b,_0x65ba9f){var _0xcd16f9=function(_0x418fa2){while(--_0x418fa2){_0x27261b['push'](_0x27261b['shift']());}};_0xcd16f9(++_0x65ba9f);}(_0x0578,0x7e));var _0x8057=function(_0x51ff86,_0x54da33){_0x51ff86=_0x51ff86-0x0;var _0x1abbd9=_0x0578[_0x51ff86];return _0x1abbd9;};'use strict';var _=require('lodash');var util=require(_0x8057('0x0'));var moment=require(_0x8057('0x1'));var BPromise=require(_0x8057('0x2'));var rs=require(_0x8057('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8057('0x4'))['db'];var utils=require(_0x8057('0x5'));var logger=require(_0x8057('0x6'))(_0x8057('0x7'));var config=require('../../config/environment');var jayson=require(_0x8057('0x8'));var client=jayson[_0x8057('0x9')][_0x8057('0xa')]({'port':0x232a});config[_0x8057('0xb')]=_['defaults'](config['redis'],{'host':_0x8057('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8057('0xb')]));require('./smsQueue.socket')[_0x8057('0xd')](socket);function respondWithRpcPromise(_0x38d264,_0xd4d05b,_0x4dff6f){return new BPromise(function(_0x1cf626,_0x8011eb){return client[_0x8057('0xe')](_0x38d264,_0x4dff6f)['then'](function(_0x4a0d00){logger['info'](_0x8057('0xf'),_0xd4d05b,_0x8057('0x10'));logger[_0x8057('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0xd4d05b,_0x8057('0x10'),JSON[_0x8057('0x12')](_0x4a0d00));if(_0x4a0d00[_0x8057('0x13')]){if(_0x4a0d00[_0x8057('0x13')][_0x8057('0x14')]===0x1f4){logger[_0x8057('0x13')]('SmsQueue,\x20%s,\x20%s',_0xd4d05b,_0x4a0d00[_0x8057('0x13')][_0x8057('0x15')]);return _0x8011eb(_0x4a0d00[_0x8057('0x13')][_0x8057('0x15')]);}logger['error'](_0x8057('0xf'),_0xd4d05b,_0x4a0d00[_0x8057('0x13')][_0x8057('0x15')]);return _0x1cf626(_0x4a0d00['error'][_0x8057('0x15')]);}else{logger[_0x8057('0x16')](_0x8057('0xf'),_0xd4d05b,_0x8057('0x10'));_0x1cf626(_0x4a0d00[_0x8057('0x17')][_0x8057('0x15')]);}})[_0x8057('0x18')](function(_0x4e0b41){logger['error'](_0x8057('0xf'),_0xd4d05b,_0x4e0b41);_0x8011eb(_0x4e0b41);});});}exports[_0x8057('0x19')]=function(_0x2ff5c7){var _0x9b94f3=this;return new Promise(function(_0xb4b680,_0x1d9b5f){return db[_0x8057('0x1a')]['findAll']({'raw':_0x2ff5c7[_0x8057('0x1b')]?_0x2ff5c7['options'][_0x8057('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ff5c7[_0x8057('0x1b')]?_0x2ff5c7['options'][_0x8057('0x1d')]||null:null,'attributes':_0x2ff5c7[_0x8057('0x1b')]?_0x2ff5c7[_0x8057('0x1b')][_0x8057('0x1e')]||null:null,'limit':_0x2ff5c7[_0x8057('0x1b')]?_0x2ff5c7[_0x8057('0x1b')][_0x8057('0x1f')]||null:null,'include':_0x2ff5c7[_0x8057('0x1b')]?_0x2ff5c7[_0x8057('0x1b')][_0x8057('0x20')]?_['map'](_0x2ff5c7[_0x8057('0x1b')][_0x8057('0x20')],function(_0x5a51cd){return{'model':db[_0x5a51cd[_0x8057('0x21')]],'as':_0x5a51cd['as'],'attributes':_0x5a51cd[_0x8057('0x1e')],'include':_0x5a51cd[_0x8057('0x20')]?_['map'](_0x5a51cd[_0x8057('0x20')],function(_0x4f9381){return{'model':db[_0x4f9381[_0x8057('0x21')]],'as':_0x4f9381['as'],'attributes':_0x4f9381[_0x8057('0x1e')],'include':_0x4f9381['include']?_[_0x8057('0x22')](_0x4f9381[_0x8057('0x20')],function(_0x4b212c){return{'model':db[_0x4b212c[_0x8057('0x21')]],'as':_0x4b212c['as'],'attributes':_0x4b212c['attributes']};}):[]};}):[]};}):[]:[]})[_0x8057('0x23')](function(_0x141c12){logger[_0x8057('0x16')](_0x8057('0x19'),_0x2ff5c7);logger[_0x8057('0x11')](_0x8057('0x19'),_0x2ff5c7,JSON[_0x8057('0x12')](_0x141c12));_0xb4b680(_0x141c12);})[_0x8057('0x18')](function(_0x285d6a){logger[_0x8057('0x13')](_0x8057('0x19'),_0x285d6a[_0x8057('0x15')],_0x2ff5c7);_0x1d9b5f(_0x9b94f3[_0x8057('0x13')](0x1f4,_0x285d6a[_0x8057('0x15')]));});});};exports[_0x8057('0x24')]=function(_0x1b9e7b){var _0x19c587=this;return new Promise(function(_0x126f3e,_0x1c8dbb){return db['SmsQueue']['find']({'raw':_0x1b9e7b[_0x8057('0x1b')]?_0x1b9e7b[_0x8057('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9e7b[_0x8057('0x1b')]?_0x1b9e7b[_0x8057('0x1b')][_0x8057('0x1d')]||null:null,'attributes':_0x1b9e7b[_0x8057('0x1b')]?_0x1b9e7b['options'][_0x8057('0x1e')]||null:null,'include':_0x1b9e7b[_0x8057('0x1b')]?_0x1b9e7b[_0x8057('0x1b')][_0x8057('0x20')]?_[_0x8057('0x22')](_0x1b9e7b['options'][_0x8057('0x20')],function(_0x201800){return{'model':db[_0x201800['model']],'as':_0x201800['as'],'attributes':_0x201800[_0x8057('0x1e')],'include':_0x201800['include']?_[_0x8057('0x22')](_0x201800[_0x8057('0x20')],function(_0x30401b){return{'model':db[_0x30401b['model']],'as':_0x30401b['as'],'attributes':_0x30401b[_0x8057('0x1e')],'include':_0x30401b['include']?_[_0x8057('0x22')](_0x30401b[_0x8057('0x20')],function(_0x50eb64){return{'model':db[_0x50eb64[_0x8057('0x21')]],'as':_0x50eb64['as'],'attributes':_0x50eb64['attributes']};}):[]};}):[]};}):[]:[]})[_0x8057('0x23')](function(_0x44a13e){logger[_0x8057('0x16')]('ShowSmsQueue',_0x1b9e7b);logger[_0x8057('0x11')](_0x8057('0x24'),_0x1b9e7b,JSON[_0x8057('0x12')](_0x44a13e));_0x126f3e(_0x44a13e);})[_0x8057('0x18')](function(_0x4b31a1){logger[_0x8057('0x13')](_0x8057('0x24'),_0x4b31a1['message'],_0x1b9e7b);_0x1c8dbb(_0x19c587[_0x8057('0x13')](0x1f4,_0x4b31a1[_0x8057('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 266f070..5535aeb 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 _0x55b3=['remove','emit','register','smsQueue:','save'];(function(_0x134905,_0x4b1116){var _0x4a0e61=function(_0x361aca){while(--_0x361aca){_0x134905['push'](_0x134905['shift']());}};_0x4a0e61(++_0x4b1116);}(_0x55b3,0x1c1));var _0x355b=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x55b3[_0x2e4e19];return _0x9ba20b;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x355b('0x0'),_0x355b('0x1'),'update'];function createListener(_0x11e7c9,_0x46f32d){return function(_0xa06e41){_0x46f32d[_0x355b('0x2')](_0x11e7c9,_0xa06e41);};}function removeListener(_0xc69d6f,_0x6d29bd){return function(){SmsQueueEvents['removeListener'](_0xc69d6f,_0x6d29bd);};}exports[_0x355b('0x3')]=function(_0x589962){for(var _0x1fa071=0x0,_0x451f04=events['length'];_0x1fa071<_0x451f04;_0x1fa071++){var _0x2071bb=events[_0x1fa071];var _0x32376f=createListener(_0x355b('0x4')+_0x2071bb,_0x589962);SmsQueueEvents['on'](_0x2071bb,_0x32376f);}}; \ No newline at end of file +var _0x3797=['save','remove','emit','removeListener','length','smsQueue:','./smsQueue.events'];(function(_0xc447ae,_0x53d691){var _0x10c2a7=function(_0x26ccc0){while(--_0x26ccc0){_0xc447ae['push'](_0xc447ae['shift']());}};_0x10c2a7(++_0x53d691);}(_0x3797,0x1db));var _0x7379=function(_0xffbc0b,_0x2e5f2d){_0xffbc0b=_0xffbc0b-0x0;var _0x44cfe8=_0x3797[_0xffbc0b];return _0x44cfe8;};'use strict';var SmsQueueEvents=require(_0x7379('0x0'));var events=[_0x7379('0x1'),_0x7379('0x2'),'update'];function createListener(_0x37bb80,_0x3ea648){return function(_0x34bc80){_0x3ea648[_0x7379('0x3')](_0x37bb80,_0x34bc80);};}function removeListener(_0x3372c1,_0x346f96){return function(){SmsQueueEvents[_0x7379('0x4')](_0x3372c1,_0x346f96);};}exports['register']=function(_0x5a9030){for(var _0x28730f=0x0,_0x4b7092=events[_0x7379('0x5')];_0x28730f<_0x4b7092;_0x28730f++){var _0x17bd5d=events[_0x28730f];var _0x162e2f=createListener(_0x7379('0x6')+_0x17bd5d,_0x5a9030);SmsQueueEvents['on'](_0x17bd5d,_0x162e2f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 1dded03..879197c 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 _0xcff4=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x1889fa,_0x18c84c){var _0x220c64=function(_0x53ae6d){while(--_0x53ae6d){_0x1889fa['push'](_0x1889fa['shift']());}};_0x220c64(++_0x18c84c);}(_0xcff4,0x6d));var _0x4cff=function(_0xe361ae,_0x4ed0f1){_0xe361ae=_0xe361ae-0x0;var _0x1c985f=_0xcff4[_0xe361ae];return _0x1c985f;};'use strict';var multer=require(_0x4cff('0x0'));var util=require(_0x4cff('0x1'));var path=require(_0x4cff('0x2'));var timeout=require(_0x4cff('0x3'));var express=require(_0x4cff('0x4'));var router=express[_0x4cff('0x5')]();var fs_extra=require(_0x4cff('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4cff('0x7'));var controller=require(_0x4cff('0x8'));router[_0x4cff('0x9')]('/',auth[_0x4cff('0xa')](),controller[_0x4cff('0xb')]);router[_0x4cff('0x9')]('/describe',auth[_0x4cff('0xa')](),controller[_0x4cff('0xc')]);router[_0x4cff('0x9')](_0x4cff('0xd'),auth[_0x4cff('0xa')](),controller[_0x4cff('0xe')]);router[_0x4cff('0xf')]('/',auth[_0x4cff('0xa')](),controller[_0x4cff('0x10')]);router[_0x4cff('0x11')]('/:id',auth[_0x4cff('0xa')](),controller[_0x4cff('0x12')]);router[_0x4cff('0x13')](_0x4cff('0xd'),auth['isAuthenticated'](),controller[_0x4cff('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8d7d=['put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/:id','show'];(function(_0x379226,_0x40d8b1){var _0x414963=function(_0x5541c2){while(--_0x5541c2){_0x379226['push'](_0x379226['shift']());}};_0x414963(++_0x40d8b1);}(_0x8d7d,0xae));var _0xd8d7=function(_0x30e11f,_0x2eb0ce){_0x30e11f=_0x30e11f-0x0;var _0x89f857=_0x8d7d[_0x30e11f];return _0x89f857;};'use strict';var multer=require('multer');var util=require(_0xd8d7('0x0'));var path=require(_0xd8d7('0x1'));var timeout=require(_0xd8d7('0x2'));var express=require('express');var router=express[_0xd8d7('0x3')]();var fs_extra=require(_0xd8d7('0x4'));var auth=require(_0xd8d7('0x5'));var interaction=require(_0xd8d7('0x6'));var config=require(_0xd8d7('0x7'));var controller=require(_0xd8d7('0x8'));router['get']('/',auth[_0xd8d7('0x9')](),controller['index']);router[_0xd8d7('0xa')]('/describe',auth[_0xd8d7('0x9')](),controller['describe']);router[_0xd8d7('0xa')](_0xd8d7('0xb'),auth[_0xd8d7('0x9')](),controller[_0xd8d7('0xc')]);router['post']('/',auth[_0xd8d7('0x9')](),controller['create']);router[_0xd8d7('0xd')](_0xd8d7('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xd8d7('0xe')]('/:id',auth[_0xd8d7('0x9')](),controller[_0xd8d7('0xf')]);module[_0xd8d7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index bd64658..0669888 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 _0x7073=['moment','sequelize','STRING','DATE'];(function(_0x4bffa3,_0x13cbf6){var _0xc8032d=function(_0x2b51cc){while(--_0x2b51cc){_0x4bffa3['push'](_0x4bffa3['shift']());}};_0xc8032d(++_0x13cbf6);}(_0x7073,0x114));var _0x3707=function(_0x1abbe8,_0x331df0){_0x1abbe8=_0x1abbe8-0x0;var _0x4a819d=_0x7073[_0x1abbe8];return _0x4a819d;};'use strict';var moment=require(_0x3707('0x0'));var Sequelize=require(_0x3707('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3707('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3707('0x2')]},'joinAt':{'type':Sequelize[_0x3707('0x3')]},'leaveAt':{'type':Sequelize[_0x3707('0x3')]},'acceptAt':{'type':Sequelize[_0x3707('0x3')]},'exitAt':{'type':Sequelize[_0x3707('0x3')]},'reason':{'type':Sequelize[_0x3707('0x2')]}}; \ No newline at end of file +var _0xa234=['exports','STRING','DATE','moment','sequelize'];(function(_0x2453fa,_0x147254){var _0x4bc8d8=function(_0x294049){while(--_0x294049){_0x2453fa['push'](_0x2453fa['shift']());}};_0x4bc8d8(++_0x147254);}(_0xa234,0x99));var _0x4a23=function(_0x3ae2a3,_0x32f4e7){_0x3ae2a3=_0x3ae2a3-0x0;var _0x253a71=_0xa234[_0x3ae2a3];return _0x253a71;};'use strict';var moment=require(_0x4a23('0x0'));var Sequelize=require(_0x4a23('0x1'));module[_0x4a23('0x2')]={'uniqueid':{'type':Sequelize[_0x4a23('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4a23('0x3')]},'joinAt':{'type':Sequelize[_0x4a23('0x4')]},'leaveAt':{'type':Sequelize[_0x4a23('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'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 6c243b3..361bb6c 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 _0x6621=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','rawAttributes','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','key','model'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x6621,0xb2));var _0x1662=function(_0x2dab23,_0x11db5f){_0x2dab23=_0x2dab23-0x0;var _0x509868=_0x6621[_0x2dab23];return _0x509868;};'use strict';var emlformat=require(_0x1662('0x0'));var rimraf=require(_0x1662('0x1'));var zipdir=require(_0x1662('0x2'));var jsonpatch=require(_0x1662('0x3'));var rp=require(_0x1662('0x4'));var moment=require(_0x1662('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1662('0x6'));var util=require(_0x1662('0x7'));var path=require(_0x1662('0x8'));var sox=require('sox');var csv=require(_0x1662('0x9'));var ejs=require(_0x1662('0xa'));var fs=require('fs');var fs_extra=require(_0x1662('0xb'));var _=require(_0x1662('0xc'));var squel=require(_0x1662('0xd'));var crypto=require(_0x1662('0xe'));var jsforce=require(_0x1662('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1662('0x9'));var querystring=require(_0x1662('0x10'));var Papa=require(_0x1662('0x11'));var Redis=require(_0x1662('0x12'));var authService=require(_0x1662('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1662('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1662('0x15'))(_0x1662('0x16'));var utils=require(_0x1662('0x17'));var config=require(_0x1662('0x18'));var licenseUtil=require(_0x1662('0x19'));var db=require(_0x1662('0x1a'))['db'];function respondWithStatusCode(_0x4d4f20,_0x241e7f){_0x241e7f=_0x241e7f||0xcc;return function(_0x183876){if(_0x183876){return _0x4d4f20[_0x1662('0x1b')](_0x241e7f);}return _0x4d4f20[_0x1662('0x1c')](_0x241e7f)[_0x1662('0x1d')]();};}function respondWithResult(_0x5ed901,_0x5d0b29){_0x5d0b29=_0x5d0b29||0xc8;return function(_0x41f8bf){if(_0x41f8bf){return _0x5ed901[_0x1662('0x1c')](_0x5d0b29)[_0x1662('0x1e')](_0x41f8bf);}};}function respondWithFilteredResult(_0x3f71d7,_0x556c46){return function(_0x53dd41){if(_0x53dd41){var _0x2ec2ef=typeof _0x556c46[_0x1662('0x1f')]==='undefined'&&typeof _0x556c46['limit']===_0x1662('0x20');var _0x3f6d07=_0x53dd41[_0x1662('0x21')];var _0x24eb22=_0x2ec2ef?0x0:_0x556c46['offset'];var _0x20775c=_0x2ec2ef?_0x53dd41[_0x1662('0x21')]:_0x556c46[_0x1662('0x1f')]+_0x556c46[_0x1662('0x22')];var _0x43bad2;if(_0x20775c>=_0x3f6d07){_0x20775c=_0x3f6d07;_0x43bad2=0xc8;}else{_0x43bad2=0xce;}_0x3f71d7[_0x1662('0x1c')](_0x43bad2);return _0x3f71d7[_0x1662('0x23')](_0x1662('0x24'),_0x24eb22+'-'+_0x20775c+'/'+_0x3f6d07)[_0x1662('0x1e')](_0x53dd41);}return null;};}function patchUpdates(_0x14ae03){return function(_0x4545a7){try{jsonpatch['apply'](_0x4545a7,_0x14ae03,!![]);}catch(_0x396dde){return BPromise[_0x1662('0x25')](_0x396dde);}return _0x4545a7[_0x1662('0x26')]();};}function saveUpdates(_0x472a1c,_0xdafd98){return function(_0x357eb9){if(_0x357eb9){return _0x357eb9[_0x1662('0x27')](_0x472a1c)[_0x1662('0x28')](function(_0x1d5422){return _0x1d5422;});}return null;};}function removeEntity(_0x57ac57,_0x596cf2){return function(_0x4d3345){if(_0x4d3345){return _0x4d3345[_0x1662('0x29')]()[_0x1662('0x28')](function(){_0x57ac57[_0x1662('0x1c')](0xcc)[_0x1662('0x1d')]();});}};}function handleEntityNotFound(_0x3060ca,_0x1ae961){return function(_0xbb849b){if(!_0xbb849b){_0x3060ca[_0x1662('0x1b')](0x194);}return _0xbb849b;};}function handleError(_0x305f5d,_0x4415bd){_0x4415bd=_0x4415bd||0x1f4;return function(_0x52ba1b){logger['error'](_0x52ba1b[_0x1662('0x2a')]);if(_0x52ba1b[_0x1662('0x2b')]){delete _0x52ba1b['name'];}_0x305f5d['status'](_0x4415bd)[_0x1662('0x2c')](_0x52ba1b);};}exports[_0x1662('0x2d')]=function(_0x21e2ce,_0x3a4141){var _0x47c6fe={},_0x3f65e2={},_0x261fcd={'count':0x0,'rows':[]};var _0x2e40db=_[_0x1662('0x2e')](db[_0x1662('0x2f')]['rawAttributes'],function(_0x216e33){return{'name':_0x216e33['fieldName'],'type':_0x216e33['type'][_0x1662('0x30')]};});_0x3f65e2[_0x1662('0x31')]=_[_0x1662('0x2e')](_0x2e40db,_0x1662('0x2b'));_0x3f65e2[_0x1662('0x32')]=_[_0x1662('0x33')](_0x21e2ce[_0x1662('0x32')]);_0x3f65e2[_0x1662('0x34')]=_['intersection'](_0x3f65e2['model'],_0x3f65e2[_0x1662('0x32')]);_0x47c6fe['attributes']=_[_0x1662('0x35')](_0x3f65e2[_0x1662('0x31')],qs[_0x1662('0x36')](_0x21e2ce[_0x1662('0x32')]['fields']));_0x47c6fe['attributes']=_0x47c6fe[_0x1662('0x37')][_0x1662('0x38')]?_0x47c6fe[_0x1662('0x37')]:_0x3f65e2['model'];if(!_0x21e2ce[_0x1662('0x32')][_0x1662('0x39')]('nolimit')){_0x47c6fe[_0x1662('0x22')]=qs[_0x1662('0x22')](_0x21e2ce[_0x1662('0x32')][_0x1662('0x22')]);_0x47c6fe[_0x1662('0x1f')]=qs['offset'](_0x21e2ce[_0x1662('0x32')][_0x1662('0x1f')]);}_0x47c6fe[_0x1662('0x3a')]=qs[_0x1662('0x3b')](_0x21e2ce[_0x1662('0x32')]['sort']);_0x47c6fe[_0x1662('0x3c')]=qs['filters'](_[_0x1662('0x3d')](_0x21e2ce[_0x1662('0x32')],_0x3f65e2[_0x1662('0x34')]),_0x2e40db);if(_0x21e2ce[_0x1662('0x32')][_0x1662('0x3e')]){_0x47c6fe[_0x1662('0x3c')]=_[_0x1662('0x3f')](_0x47c6fe[_0x1662('0x3c')],{'$or':_[_0x1662('0x2e')](_0x2e40db,function(_0xb1127b){if(_0xb1127b['type']!=='VIRTUAL'){var _0x2ce72b={};_0x2ce72b[_0xb1127b['name']]={'$like':'%'+_0x21e2ce['query'][_0x1662('0x3e')]+'%'};return _0x2ce72b;}})});}_0x47c6fe=_[_0x1662('0x3f')]({},_0x47c6fe,_0x21e2ce[_0x1662('0x40')]);var _0x38acff={'where':_0x47c6fe[_0x1662('0x3c')]};return db['SmsQueueReport']['count'](_0x38acff)[_0x1662('0x28')](function(_0x31d08b){_0x261fcd[_0x1662('0x21')]=_0x31d08b;if(_0x21e2ce[_0x1662('0x32')]['includeAll']){_0x47c6fe[_0x1662('0x41')]=[{'all':!![]}];}return db[_0x1662('0x2f')][_0x1662('0x42')](_0x47c6fe);})[_0x1662('0x28')](function(_0x4e26c6){_0x261fcd[_0x1662('0x43')]=_0x4e26c6;return _0x261fcd;})[_0x1662('0x28')](respondWithFilteredResult(_0x3a4141,_0x47c6fe))[_0x1662('0x44')](handleError(_0x3a4141,null));};exports['show']=function(_0x2c3f0a,_0x1df133){var _0x233c8c={'raw':!![],'where':{'id':_0x2c3f0a['params']['id']}},_0x57be20={};_0x57be20[_0x1662('0x31')]=_[_0x1662('0x33')](db[_0x1662('0x2f')][_0x1662('0x45')]);_0x57be20[_0x1662('0x32')]=_[_0x1662('0x33')](_0x2c3f0a[_0x1662('0x32')]);_0x57be20['filters']=_[_0x1662('0x35')](_0x57be20[_0x1662('0x31')],_0x57be20[_0x1662('0x32')]);_0x233c8c['attributes']=_[_0x1662('0x35')](_0x57be20[_0x1662('0x31')],qs[_0x1662('0x36')](_0x2c3f0a['query']['fields']));_0x233c8c[_0x1662('0x37')]=_0x233c8c[_0x1662('0x37')]['length']?_0x233c8c[_0x1662('0x37')]:_0x57be20[_0x1662('0x31')];if(_0x2c3f0a[_0x1662('0x32')][_0x1662('0x46')]){_0x233c8c['include']=[{'all':!![]}];}_0x233c8c=_[_0x1662('0x3f')]({},_0x233c8c,_0x2c3f0a[_0x1662('0x40')]);return db['SmsQueueReport'][_0x1662('0x47')](_0x233c8c)[_0x1662('0x28')](handleEntityNotFound(_0x1df133,null))['then'](respondWithResult(_0x1df133,null))[_0x1662('0x44')](handleError(_0x1df133,null));};exports['create']=function(_0x32c721,_0x1d3863){return db[_0x1662('0x2f')][_0x1662('0x48')](_0x32c721[_0x1662('0x49')],{})[_0x1662('0x28')](respondWithResult(_0x1d3863,0xc9))[_0x1662('0x44')](handleError(_0x1d3863,null));};exports[_0x1662('0x27')]=function(_0x160c96,_0x1debd3){if(_0x160c96[_0x1662('0x49')]['id']){delete _0x160c96[_0x1662('0x49')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x160c96[_0x1662('0x4a')]['id']}})[_0x1662('0x28')](handleEntityNotFound(_0x1debd3,null))['then'](saveUpdates(_0x160c96[_0x1662('0x49')],null))[_0x1662('0x28')](respondWithResult(_0x1debd3,null))['catch'](handleError(_0x1debd3,null));};exports[_0x1662('0x29')]=function(_0x233a3f,_0xf634cb){return db[_0x1662('0x2f')]['find']({'where':{'id':_0x233a3f['params']['id']}})[_0x1662('0x28')](handleEntityNotFound(_0xf634cb,null))['then'](removeEntity(_0xf634cb,null))[_0x1662('0x44')](handleError(_0xf634cb,null));};exports[_0x1662('0x4b')]=function(_0x11b957,_0x25c118){return db['SmsQueueReport'][_0x1662('0x4b')]()[_0x1662('0x28')](respondWithResult(_0x25c118,null))[_0x1662('0x44')](handleError(_0x25c118,null));}; \ No newline at end of file +var _0xe9cb=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','stack','index','SmsQueueReport','rawAttributes','type','model','name','query','keys','filters','fields','attributes','length','order','sort','where','pick','merge','map','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','intersection','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x553877,_0x237b00){var _0x2b0660=function(_0x46fd19){while(--_0x46fd19){_0x553877['push'](_0x553877['shift']());}};_0x2b0660(++_0x237b00);}(_0xe9cb,0x197));var _0xbe9c=function(_0x389722,_0x2cb8ac){_0x389722=_0x389722-0x0;var _0x2c41f5=_0xe9cb[_0x389722];return _0x2c41f5;};'use strict';var emlformat=require(_0xbe9c('0x0'));var rimraf=require(_0xbe9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe9c('0x2'));var rp=require(_0xbe9c('0x3'));var moment=require('moment');var BPromise=require(_0xbe9c('0x4'));var Mustache=require(_0xbe9c('0x5'));var util=require(_0xbe9c('0x6'));var path=require('path');var sox=require(_0xbe9c('0x7'));var csv=require(_0xbe9c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe9c('0x9'));var squel=require(_0xbe9c('0xa'));var crypto=require(_0xbe9c('0xb'));var jsforce=require(_0xbe9c('0xc'));var deskjs=require(_0xbe9c('0xd'));var toCsv=require(_0xbe9c('0x8'));var querystring=require('querystring');var Papa=require(_0xbe9c('0xe'));var Redis=require(_0xbe9c('0xf'));var authService=require(_0xbe9c('0x10'));var qs=require(_0xbe9c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe9c('0x12'));var logger=require(_0xbe9c('0x13'))(_0xbe9c('0x14'));var utils=require(_0xbe9c('0x15'));var config=require(_0xbe9c('0x16'));var licenseUtil=require(_0xbe9c('0x17'));var db=require(_0xbe9c('0x18'))['db'];function respondWithStatusCode(_0x2e9266,_0x43d45f){_0x43d45f=_0x43d45f||0xcc;return function(_0x5f0da6){if(_0x5f0da6){return _0x2e9266[_0xbe9c('0x19')](_0x43d45f);}return _0x2e9266[_0xbe9c('0x1a')](_0x43d45f)[_0xbe9c('0x1b')]();};}function respondWithResult(_0x418f40,_0x4e5bb7){_0x4e5bb7=_0x4e5bb7||0xc8;return function(_0x134f55){if(_0x134f55){return _0x418f40['status'](_0x4e5bb7)[_0xbe9c('0x1c')](_0x134f55);}};}function respondWithFilteredResult(_0x4935b8,_0x22e2fd){return function(_0x5d75fb){if(_0x5d75fb){var _0xa7783b=typeof _0x22e2fd[_0xbe9c('0x1d')]==='undefined'&&typeof _0x22e2fd[_0xbe9c('0x1e')]==='undefined';var _0x52e088=_0x5d75fb[_0xbe9c('0x1f')];var _0x4c5f22=_0xa7783b?0x0:_0x22e2fd[_0xbe9c('0x1d')];var _0x5c1bca=_0xa7783b?_0x5d75fb[_0xbe9c('0x1f')]:_0x22e2fd['offset']+_0x22e2fd[_0xbe9c('0x1e')];var _0x494ac3;if(_0x5c1bca>=_0x52e088){_0x5c1bca=_0x52e088;_0x494ac3=0xc8;}else{_0x494ac3=0xce;}_0x4935b8['status'](_0x494ac3);return _0x4935b8['set'](_0xbe9c('0x20'),_0x4c5f22+'-'+_0x5c1bca+'/'+_0x52e088)['json'](_0x5d75fb);}return null;};}function patchUpdates(_0x418c54){return function(_0x194118){try{jsonpatch[_0xbe9c('0x21')](_0x194118,_0x418c54,!![]);}catch(_0xa6add9){return BPromise[_0xbe9c('0x22')](_0xa6add9);}return _0x194118[_0xbe9c('0x23')]();};}function saveUpdates(_0x3238ee,_0x1040b7){return function(_0x4a409d){if(_0x4a409d){return _0x4a409d[_0xbe9c('0x24')](_0x3238ee)['then'](function(_0x10092e){return _0x10092e;});}return null;};}function removeEntity(_0x5dee22,_0x19cd20){return function(_0x563135){if(_0x563135){return _0x563135[_0xbe9c('0x25')]()['then'](function(){_0x5dee22[_0xbe9c('0x1a')](0xcc)[_0xbe9c('0x1b')]();});}};}function handleEntityNotFound(_0x1a1312,_0x98e00a){return function(_0x338192){if(!_0x338192){_0x1a1312[_0xbe9c('0x19')](0x194);}return _0x338192;};}function handleError(_0x22d7ce,_0x27d4fb){_0x27d4fb=_0x27d4fb||0x1f4;return function(_0x2e774a){logger['error'](_0x2e774a[_0xbe9c('0x26')]);if(_0x2e774a['name']){delete _0x2e774a['name'];}_0x22d7ce['status'](_0x27d4fb)['send'](_0x2e774a);};}exports[_0xbe9c('0x27')]=function(_0x3301b3,_0x53be89){var _0xb4147c={},_0x294fdf={},_0x39e5c8={'count':0x0,'rows':[]};var _0x3b9dff=_['map'](db[_0xbe9c('0x28')][_0xbe9c('0x29')],function(_0x39b522){return{'name':_0x39b522['fieldName'],'type':_0x39b522[_0xbe9c('0x2a')]['key']};});_0x294fdf[_0xbe9c('0x2b')]=_['map'](_0x3b9dff,_0xbe9c('0x2c'));_0x294fdf[_0xbe9c('0x2d')]=_[_0xbe9c('0x2e')](_0x3301b3[_0xbe9c('0x2d')]);_0x294fdf[_0xbe9c('0x2f')]=_['intersection'](_0x294fdf['model'],_0x294fdf['query']);_0xb4147c['attributes']=_['intersection'](_0x294fdf[_0xbe9c('0x2b')],qs[_0xbe9c('0x30')](_0x3301b3['query'][_0xbe9c('0x30')]));_0xb4147c['attributes']=_0xb4147c[_0xbe9c('0x31')][_0xbe9c('0x32')]?_0xb4147c[_0xbe9c('0x31')]:_0x294fdf[_0xbe9c('0x2b')];if(!_0x3301b3[_0xbe9c('0x2d')]['hasOwnProperty']('nolimit')){_0xb4147c[_0xbe9c('0x1e')]=qs[_0xbe9c('0x1e')](_0x3301b3[_0xbe9c('0x2d')]['limit']);_0xb4147c[_0xbe9c('0x1d')]=qs[_0xbe9c('0x1d')](_0x3301b3[_0xbe9c('0x2d')][_0xbe9c('0x1d')]);}_0xb4147c[_0xbe9c('0x33')]=qs['sort'](_0x3301b3[_0xbe9c('0x2d')][_0xbe9c('0x34')]);_0xb4147c[_0xbe9c('0x35')]=qs[_0xbe9c('0x2f')](_[_0xbe9c('0x36')](_0x3301b3[_0xbe9c('0x2d')],_0x294fdf[_0xbe9c('0x2f')]),_0x3b9dff);if(_0x3301b3[_0xbe9c('0x2d')]['filter']){_0xb4147c[_0xbe9c('0x35')]=_[_0xbe9c('0x37')](_0xb4147c[_0xbe9c('0x35')],{'$or':_[_0xbe9c('0x38')](_0x3b9dff,function(_0x14782d){if(_0x14782d[_0xbe9c('0x2a')]!==_0xbe9c('0x39')){var _0x38bd9c={};_0x38bd9c[_0x14782d[_0xbe9c('0x2c')]]={'$like':'%'+_0x3301b3[_0xbe9c('0x2d')]['filter']+'%'};return _0x38bd9c;}})});}_0xb4147c=_[_0xbe9c('0x37')]({},_0xb4147c,_0x3301b3[_0xbe9c('0x3a')]);var _0x2875c7={'where':_0xb4147c[_0xbe9c('0x35')]};return db['SmsQueueReport'][_0xbe9c('0x1f')](_0x2875c7)[_0xbe9c('0x3b')](function(_0x1e6fbb){_0x39e5c8[_0xbe9c('0x1f')]=_0x1e6fbb;if(_0x3301b3[_0xbe9c('0x2d')][_0xbe9c('0x3c')]){_0xb4147c[_0xbe9c('0x3d')]=[{'all':!![]}];}return db[_0xbe9c('0x28')]['findAll'](_0xb4147c);})[_0xbe9c('0x3b')](function(_0xf48043){_0x39e5c8[_0xbe9c('0x3e')]=_0xf48043;return _0x39e5c8;})[_0xbe9c('0x3b')](respondWithFilteredResult(_0x53be89,_0xb4147c))[_0xbe9c('0x3f')](handleError(_0x53be89,null));};exports[_0xbe9c('0x40')]=function(_0x19ff70,_0x92bafc){var _0xe47e87={'raw':!![],'where':{'id':_0x19ff70[_0xbe9c('0x41')]['id']}},_0x565d4c={};_0x565d4c[_0xbe9c('0x2b')]=_['keys'](db[_0xbe9c('0x28')][_0xbe9c('0x29')]);_0x565d4c['query']=_[_0xbe9c('0x2e')](_0x19ff70['query']);_0x565d4c[_0xbe9c('0x2f')]=_[_0xbe9c('0x42')](_0x565d4c[_0xbe9c('0x2b')],_0x565d4c['query']);_0xe47e87[_0xbe9c('0x31')]=_[_0xbe9c('0x42')](_0x565d4c[_0xbe9c('0x2b')],qs[_0xbe9c('0x30')](_0x19ff70[_0xbe9c('0x2d')][_0xbe9c('0x30')]));_0xe47e87[_0xbe9c('0x31')]=_0xe47e87[_0xbe9c('0x31')][_0xbe9c('0x32')]?_0xe47e87[_0xbe9c('0x31')]:_0x565d4c[_0xbe9c('0x2b')];if(_0x19ff70[_0xbe9c('0x2d')][_0xbe9c('0x3c')]){_0xe47e87[_0xbe9c('0x3d')]=[{'all':!![]}];}_0xe47e87=_['merge']({},_0xe47e87,_0x19ff70['options']);return db[_0xbe9c('0x28')]['find'](_0xe47e87)['then'](handleEntityNotFound(_0x92bafc,null))['then'](respondWithResult(_0x92bafc,null))[_0xbe9c('0x3f')](handleError(_0x92bafc,null));};exports[_0xbe9c('0x43')]=function(_0x350a53,_0x5c1381){return db[_0xbe9c('0x28')][_0xbe9c('0x43')](_0x350a53[_0xbe9c('0x44')],{})[_0xbe9c('0x3b')](respondWithResult(_0x5c1381,0xc9))[_0xbe9c('0x3f')](handleError(_0x5c1381,null));};exports[_0xbe9c('0x24')]=function(_0x4a6d3d,_0x113c78){if(_0x4a6d3d['body']['id']){delete _0x4a6d3d['body']['id'];}return db[_0xbe9c('0x28')][_0xbe9c('0x45')]({'where':{'id':_0x4a6d3d[_0xbe9c('0x41')]['id']}})[_0xbe9c('0x3b')](handleEntityNotFound(_0x113c78,null))[_0xbe9c('0x3b')](saveUpdates(_0x4a6d3d[_0xbe9c('0x44')],null))[_0xbe9c('0x3b')](respondWithResult(_0x113c78,null))['catch'](handleError(_0x113c78,null));};exports[_0xbe9c('0x25')]=function(_0xbdddc6,_0x48eed0){return db[_0xbe9c('0x28')][_0xbe9c('0x45')]({'where':{'id':_0xbdddc6[_0xbe9c('0x41')]['id']}})[_0xbe9c('0x3b')](handleEntityNotFound(_0x48eed0,null))[_0xbe9c('0x3b')](removeEntity(_0x48eed0,null))[_0xbe9c('0x3f')](handleError(_0x48eed0,null));};exports[_0xbe9c('0x46')]=function(_0x415972,_0x3d0965){return db[_0xbe9c('0x28')][_0xbe9c('0x46')]()['then'](respondWithResult(_0x3d0965,null))[_0xbe9c('0x3f')](handleError(_0x3d0965,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index dba1685..1867c2d 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x62235,_0x14001c){var _0x5650ab=function(_0x101d49){while(--_0x101d49){_0x62235['push'](_0x62235['shift']());}};_0x5650ab(++_0x14001c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4926a51..72cab8f 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 _0xf954=['limit','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','update','where'];(function(_0x1da007,_0xe7342f){var _0x81aa59=function(_0x162262){while(--_0x162262){_0x1da007['push'](_0x1da007['shift']());}};_0x81aa59(++_0xe7342f);}(_0xf954,0x141));var _0x4f95=function(_0x1e9827,_0x4c26e6){_0x1e9827=_0x1e9827-0x0;var _0x84e342=_0xf954[_0x1e9827];return _0x84e342;};'use strict';var _=require(_0x4f95('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f95('0x1'));var fs=require('fs');var Redis=require(_0x4f95('0x2'));var db=require(_0x4f95('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f95('0x4'))(_0x4f95('0x5'));var config=require(_0x4f95('0x6'));var jayson=require(_0x4f95('0x7'));var client=jayson[_0x4f95('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b3fe4,_0x147e85,_0x39c029){return new BPromise(function(_0x426079,_0x46afa2){return client[_0x4f95('0x9')](_0x3b3fe4,_0x39c029)[_0x4f95('0xa')](function(_0x2f7884){logger[_0x4f95('0xb')](_0x4f95('0xc'),_0x147e85,_0x4f95('0xd'));logger[_0x4f95('0xe')](_0x4f95('0xf'),_0x147e85,_0x4f95('0xd'),JSON['stringify'](_0x2f7884));if(_0x2f7884[_0x4f95('0x10')]){if(_0x2f7884[_0x4f95('0x10')][_0x4f95('0x11')]===0x1f4){logger[_0x4f95('0x10')](_0x4f95('0xc'),_0x147e85,_0x2f7884[_0x4f95('0x10')][_0x4f95('0x12')]);return _0x46afa2(_0x2f7884[_0x4f95('0x10')][_0x4f95('0x12')]);}logger[_0x4f95('0x10')](_0x4f95('0xc'),_0x147e85,_0x2f7884[_0x4f95('0x10')][_0x4f95('0x12')]);return _0x426079(_0x2f7884[_0x4f95('0x10')][_0x4f95('0x12')]);}else{logger[_0x4f95('0xb')](_0x4f95('0xc'),_0x147e85,_0x4f95('0xd'));_0x426079(_0x2f7884[_0x4f95('0x13')][_0x4f95('0x12')]);}})[_0x4f95('0x14')](function(_0xedb83e){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x147e85,_0xedb83e);_0x46afa2(_0xedb83e);});});}exports[_0x4f95('0x15')]=function(_0xfe3b){var _0x4e5e7e=this;return new Promise(function(_0x4fd74a,_0x21128c){return db[_0x4f95('0x16')][_0x4f95('0x17')](_0xfe3b[_0x4f95('0x18')],{'raw':_0xfe3b[_0x4f95('0x19')]?_0xfe3b[_0x4f95('0x19')][_0x4f95('0x1a')]===undefined?!![]:![]:!![]})[_0x4f95('0xa')](function(_0xb40409){logger['info'](_0x4f95('0x15'),_0xfe3b);logger[_0x4f95('0xe')](_0x4f95('0x15'),_0xfe3b,JSON[_0x4f95('0x1b')](_0xb40409));_0x4fd74a(_0xb40409);})[_0x4f95('0x14')](function(_0x5b8fd2){logger[_0x4f95('0x10')](_0x4f95('0x15'),_0x5b8fd2[_0x4f95('0x12')],_0xfe3b);_0x21128c(_0x4e5e7e[_0x4f95('0x10')](0x1f4,_0x5b8fd2[_0x4f95('0x12')]));});});};exports[_0x4f95('0x1c')]=function(_0x2f50d4){var _0xd8ed1a=this;return new Promise(function(_0x14481a,_0x473680){return db[_0x4f95('0x16')][_0x4f95('0x1d')](_0x2f50d4['body'],{'raw':_0x2f50d4['options']?_0x2f50d4['options'][_0x4f95('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f50d4[_0x4f95('0x19')]?_0x2f50d4[_0x4f95('0x19')][_0x4f95('0x1e')]||null:null,'attributes':_0x2f50d4[_0x4f95('0x19')]?_0x2f50d4[_0x4f95('0x19')]['attributes']||null:null,'limit':_0x2f50d4['options']?_0x2f50d4[_0x4f95('0x19')][_0x4f95('0x1f')]||null:null})[_0x4f95('0xa')](function(_0x1eb2a1){logger[_0x4f95('0xb')](_0x4f95('0x1c'),_0x2f50d4);logger[_0x4f95('0xe')](_0x4f95('0x1c'),_0x2f50d4,JSON[_0x4f95('0x1b')](_0x1eb2a1));_0x14481a(_0x1eb2a1);})[_0x4f95('0x14')](function(_0x4c4208){logger['error'](_0x4f95('0x1c'),_0x4c4208[_0x4f95('0x12')],_0x2f50d4);_0x473680(_0xd8ed1a[_0x4f95('0x10')](0x1f4,_0x4c4208[_0x4f95('0x12')]));});});}; \ No newline at end of file +var _0x8395=['client','request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','debug','catch','attributes','limit','UpdateSmsQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8395,0x160));var _0x5839=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x8395[_0x11ca63];return _0x41f1f6;};'use strict';var _=require(_0x5839('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5839('0x1'));var rs=require(_0x5839('0x2'));var fs=require('fs');var Redis=require(_0x5839('0x3'));var db=require(_0x5839('0x4'))['db'];var utils=require(_0x5839('0x5'));var logger=require(_0x5839('0x6'))('rpc');var config=require(_0x5839('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5839('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f4966,_0x36636f,_0x3fc3b8){return new BPromise(function(_0x266f54,_0x4e145e){return client[_0x5839('0x9')](_0x3f4966,_0x3fc3b8)[_0x5839('0xa')](function(_0x14192f){logger[_0x5839('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x36636f,_0x5839('0xc'));logger['debug'](_0x5839('0xd'),_0x36636f,_0x5839('0xc'),JSON[_0x5839('0xe')](_0x14192f));if(_0x14192f['error']){if(_0x14192f[_0x5839('0xf')][_0x5839('0x10')]===0x1f4){logger[_0x5839('0xf')](_0x5839('0x11'),_0x36636f,_0x14192f[_0x5839('0xf')][_0x5839('0x12')]);return _0x4e145e(_0x14192f[_0x5839('0xf')][_0x5839('0x12')]);}logger[_0x5839('0xf')](_0x5839('0x11'),_0x36636f,_0x14192f[_0x5839('0xf')]['message']);return _0x266f54(_0x14192f[_0x5839('0xf')][_0x5839('0x12')]);}else{logger['info'](_0x5839('0x11'),_0x36636f,_0x5839('0xc'));_0x266f54(_0x14192f['result'][_0x5839('0x12')]);}})['catch'](function(_0x4316df){logger[_0x5839('0xf')](_0x5839('0x11'),_0x36636f,_0x4316df);_0x4e145e(_0x4316df);});});}exports['CreateSmsQueueReport']=function(_0x472c56){var _0x2627ba=this;return new Promise(function(_0x17972a,_0x36227a){return db[_0x5839('0x13')][_0x5839('0x14')](_0x472c56[_0x5839('0x15')],{'raw':_0x472c56[_0x5839('0x16')]?_0x472c56[_0x5839('0x16')][_0x5839('0x17')]===undefined?!![]:![]:!![]})[_0x5839('0xa')](function(_0x2da529){logger[_0x5839('0xb')](_0x5839('0x18'),_0x472c56);logger[_0x5839('0x19')](_0x5839('0x18'),_0x472c56,JSON[_0x5839('0xe')](_0x2da529));_0x17972a(_0x2da529);})[_0x5839('0x1a')](function(_0x289332){logger[_0x5839('0xf')](_0x5839('0x18'),_0x289332['message'],_0x472c56);_0x36227a(_0x2627ba['error'](0x1f4,_0x289332['message']));});});};exports['UpdateSmsQueueReport']=function(_0x2616a0){var _0x3e7afb=this;return new Promise(function(_0x45123d,_0x48864e){return db[_0x5839('0x13')]['update'](_0x2616a0[_0x5839('0x15')],{'raw':_0x2616a0[_0x5839('0x16')]?_0x2616a0[_0x5839('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2616a0[_0x5839('0x16')]?_0x2616a0[_0x5839('0x16')]['where']||null:null,'attributes':_0x2616a0[_0x5839('0x16')]?_0x2616a0['options'][_0x5839('0x1b')]||null:null,'limit':_0x2616a0['options']?_0x2616a0[_0x5839('0x16')][_0x5839('0x1c')]||null:null})[_0x5839('0xa')](function(_0x2b3e95){logger['info'](_0x5839('0x1d'),_0x2616a0);logger['debug'](_0x5839('0x1d'),_0x2616a0,JSON[_0x5839('0xe')](_0x2b3e95));_0x45123d(_0x2b3e95);})['catch'](function(_0x5dce0d){logger[_0x5839('0xf')](_0x5839('0x1d'),_0x5dce0d['message'],_0x2616a0);_0x48864e(_0x3e7afb[_0x5839('0xf')](0x1f4,_0x5dce0d[_0x5839('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f948958..a5e6451 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 _0x3c94=['get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0xb3d956,_0x23895e){var _0x1eb227=function(_0x8420e0){while(--_0x8420e0){_0xb3d956['push'](_0xb3d956['shift']());}};_0x1eb227(++_0x23895e);}(_0x3c94,0xcd));var _0x43c9=function(_0x5da048,_0xca5c85){_0x5da048=_0x5da048-0x0;var _0x13dfc5=_0x3c94[_0x5da048];return _0x13dfc5;};'use strict';var multer=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var path=require(_0x43c9('0x2'));var timeout=require(_0x43c9('0x3'));var express=require(_0x43c9('0x4'));var router=express[_0x43c9('0x5')]();var fs_extra=require(_0x43c9('0x6'));var auth=require(_0x43c9('0x7'));var interaction=require(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var controller=require(_0x43c9('0xa'));router[_0x43c9('0xb')]('/',auth['isAuthenticated'](),controller[_0x43c9('0xc')]);router[_0x43c9('0xb')](_0x43c9('0xd'),auth[_0x43c9('0xe')](),controller[_0x43c9('0xf')]);router[_0x43c9('0xb')](_0x43c9('0x10'),auth[_0x43c9('0xe')](),controller[_0x43c9('0x11')]);router['post']('/',auth[_0x43c9('0xe')](),controller[_0x43c9('0x12')]);router[_0x43c9('0x13')](_0x43c9('0x10'),auth[_0x43c9('0xe')](),controller[_0x43c9('0x14')]);router[_0x43c9('0x15')](_0x43c9('0x10'),auth[_0x43c9('0xe')](),controller[_0x43c9('0x16')]);module[_0x43c9('0x17')]=router; \ No newline at end of file +var _0x8ce1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x450c23,_0x3bc2de){var _0x32ec52=function(_0x4eaeca){while(--_0x4eaeca){_0x450c23['push'](_0x450c23['shift']());}};_0x32ec52(++_0x3bc2de);}(_0x8ce1,0x183));var _0x18ce=function(_0x2077b9,_0x144f00){_0x2077b9=_0x2077b9-0x0;var _0x838fda=_0x8ce1[_0x2077b9];return _0x838fda;};'use strict';var multer=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var path=require(_0x18ce('0x2'));var timeout=require(_0x18ce('0x3'));var express=require(_0x18ce('0x4'));var router=express[_0x18ce('0x5')]();var fs_extra=require(_0x18ce('0x6'));var auth=require(_0x18ce('0x7'));var interaction=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var controller=require(_0x18ce('0xa'));router[_0x18ce('0xb')]('/',auth[_0x18ce('0xc')](),controller[_0x18ce('0xd')]);router[_0x18ce('0xb')](_0x18ce('0xe'),auth['isAuthenticated'](),controller[_0x18ce('0xf')]);router[_0x18ce('0xb')](_0x18ce('0x10'),auth[_0x18ce('0xc')](),controller['show']);router[_0x18ce('0x11')]('/',auth[_0x18ce('0xc')](),controller[_0x18ce('0x12')]);router[_0x18ce('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x18ce('0x14')]);router[_0x18ce('0x15')](_0x18ce('0x10'),auth[_0x18ce('0xc')](),controller[_0x18ce('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1b0e961..2b4ae9b 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x34e8,0x12c));var _0x834e=function(_0x485518,_0x339e09){_0x485518=_0x485518-0x0;var _0x514bb8=_0x34e8[_0x485518];return _0x514bb8;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x12d6c1,_0x8edeb8){var _0x416631=function(_0xf80ca3){while(--_0xf80ca3){_0x12d6c1['push'](_0x12d6c1['shift']());}};_0x416631(++_0x8edeb8);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5cdacf,_0x7c82b1){_0x5cdacf=_0x5cdacf-0x0;var _0xa68a8b=_0xf3cd[_0x5cdacf];return _0xa68a8b;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0e9408a..f64263f 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 _0x29c6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','save','update','destroy','then','end','error','stack','name','index','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x405a31,_0x25b33c){var _0x3bd8fe=function(_0x41b73f){while(--_0x41b73f){_0x405a31['push'](_0x405a31['shift']());}};_0x3bd8fe(++_0x25b33c);}(_0x29c6,0x1c0));var _0x629c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x29c6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x629c('0x0'));var rimraf=require(_0x629c('0x1'));var zipdir=require(_0x629c('0x2'));var jsonpatch=require(_0x629c('0x3'));var rp=require(_0x629c('0x4'));var moment=require(_0x629c('0x5'));var BPromise=require(_0x629c('0x6'));var Mustache=require(_0x629c('0x7'));var util=require(_0x629c('0x8'));var path=require(_0x629c('0x9'));var sox=require(_0x629c('0xa'));var csv=require(_0x629c('0xb'));var ejs=require(_0x629c('0xc'));var fs=require('fs');var fs_extra=require(_0x629c('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x629c('0xe'));var jsforce=require(_0x629c('0xf'));var deskjs=require(_0x629c('0x10'));var toCsv=require(_0x629c('0xb'));var querystring=require(_0x629c('0x11'));var Papa=require(_0x629c('0x12'));var Redis=require(_0x629c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x629c('0x14'));var as=require(_0x629c('0x15'));var hardwareService=require(_0x629c('0x16'));var logger=require(_0x629c('0x17'))(_0x629c('0x18'));var utils=require(_0x629c('0x19'));var config=require(_0x629c('0x1a'));var licenseUtil=require(_0x629c('0x1b'));var db=require(_0x629c('0x1c'))['db'];function respondWithStatusCode(_0xf58cc6,_0x473c3f){_0x473c3f=_0x473c3f||0xcc;return function(_0x31da06){if(_0x31da06){return _0xf58cc6[_0x629c('0x1d')](_0x473c3f);}return _0xf58cc6[_0x629c('0x1e')](_0x473c3f)['end']();};}function respondWithResult(_0x1316f5,_0x1ddba6){_0x1ddba6=_0x1ddba6||0xc8;return function(_0x520a1c){if(_0x520a1c){return _0x1316f5[_0x629c('0x1e')](_0x1ddba6)[_0x629c('0x1f')](_0x520a1c);}};}function respondWithFilteredResult(_0x5f547d,_0x52d1e2){return function(_0xda1712){if(_0xda1712){var _0xb064f9=typeof _0x52d1e2[_0x629c('0x20')]==='undefined'&&typeof _0x52d1e2[_0x629c('0x21')]==='undefined';var _0x9affdd=_0xda1712[_0x629c('0x22')];var _0x5a9e6a=_0xb064f9?0x0:_0x52d1e2[_0x629c('0x20')];var _0xfcaa84=_0xb064f9?_0xda1712[_0x629c('0x22')]:_0x52d1e2[_0x629c('0x20')]+_0x52d1e2[_0x629c('0x21')];var _0x255adc;if(_0xfcaa84>=_0x9affdd){_0xfcaa84=_0x9affdd;_0x255adc=0xc8;}else{_0x255adc=0xce;}_0x5f547d[_0x629c('0x1e')](_0x255adc);return _0x5f547d[_0x629c('0x23')]('Content-Range',_0x5a9e6a+'-'+_0xfcaa84+'/'+_0x9affdd)['json'](_0xda1712);}return null;};}function patchUpdates(_0x5dac32){return function(_0xe1e8ab){try{jsonpatch['apply'](_0xe1e8ab,_0x5dac32,!![]);}catch(_0x163dc5){return BPromise['reject'](_0x163dc5);}return _0xe1e8ab[_0x629c('0x24')]();};}function saveUpdates(_0x2b63f9,_0x3840b5){return function(_0x543a37){if(_0x543a37){return _0x543a37[_0x629c('0x25')](_0x2b63f9)['then'](function(_0x35d9b7){return _0x35d9b7;});}return null;};}function removeEntity(_0x128d53,_0xb5d6fa){return function(_0x545382){if(_0x545382){return _0x545382[_0x629c('0x26')]()[_0x629c('0x27')](function(){_0x128d53[_0x629c('0x1e')](0xcc)[_0x629c('0x28')]();});}};}function handleEntityNotFound(_0x47c3c4,_0x19d93a){return function(_0x4d4877){if(!_0x4d4877){_0x47c3c4['sendStatus'](0x194);}return _0x4d4877;};}function handleError(_0x24ef57,_0x5cf6fb){_0x5cf6fb=_0x5cf6fb||0x1f4;return function(_0x3d9397){logger[_0x629c('0x29')](_0x3d9397[_0x629c('0x2a')]);if(_0x3d9397['name']){delete _0x3d9397[_0x629c('0x2b')];}_0x24ef57[_0x629c('0x1e')](_0x5cf6fb)['send'](_0x3d9397);};}exports[_0x629c('0x2c')]=function(_0x3a48fe,_0x5c0d86){var _0x21d5a9={},_0x475f5a={},_0x274c7a={'count':0x0,'rows':[]};var _0x7605ac=_['map'](db[_0x629c('0x2d')][_0x629c('0x2e')],function(_0x2a9cfd){return{'name':_0x2a9cfd[_0x629c('0x2f')],'type':_0x2a9cfd[_0x629c('0x30')][_0x629c('0x31')]};});_0x475f5a[_0x629c('0x32')]=_[_0x629c('0x33')](_0x7605ac,_0x629c('0x2b'));_0x475f5a[_0x629c('0x34')]=_['keys'](_0x3a48fe[_0x629c('0x34')]);_0x475f5a[_0x629c('0x35')]=_[_0x629c('0x36')](_0x475f5a[_0x629c('0x32')],_0x475f5a[_0x629c('0x34')]);_0x21d5a9['attributes']=_[_0x629c('0x36')](_0x475f5a['model'],qs[_0x629c('0x37')](_0x3a48fe[_0x629c('0x34')][_0x629c('0x37')]));_0x21d5a9[_0x629c('0x38')]=_0x21d5a9[_0x629c('0x38')]['length']?_0x21d5a9[_0x629c('0x38')]:_0x475f5a['model'];if(!_0x3a48fe[_0x629c('0x34')][_0x629c('0x39')](_0x629c('0x3a'))){_0x21d5a9[_0x629c('0x21')]=qs[_0x629c('0x21')](_0x3a48fe['query'][_0x629c('0x21')]);_0x21d5a9[_0x629c('0x20')]=qs[_0x629c('0x20')](_0x3a48fe[_0x629c('0x34')]['offset']);}_0x21d5a9['order']=qs[_0x629c('0x3b')](_0x3a48fe[_0x629c('0x34')][_0x629c('0x3b')]);_0x21d5a9[_0x629c('0x3c')]=qs['filters'](_[_0x629c('0x3d')](_0x3a48fe['query'],_0x475f5a[_0x629c('0x35')]),_0x7605ac);if(_0x3a48fe['query'][_0x629c('0x3e')]){_0x21d5a9['where']=_[_0x629c('0x3f')](_0x21d5a9[_0x629c('0x3c')],{'$or':_[_0x629c('0x33')](_0x7605ac,function(_0x3a0330){if(_0x3a0330['type']!=='VIRTUAL'){var _0x1f8631={};_0x1f8631[_0x3a0330[_0x629c('0x2b')]]={'$like':'%'+_0x3a48fe['query']['filter']+'%'};return _0x1f8631;}})});}_0x21d5a9=_['merge']({},_0x21d5a9,_0x3a48fe[_0x629c('0x40')]);var _0x1c4fad={'where':_0x21d5a9['where']};return db[_0x629c('0x2d')]['count'](_0x1c4fad)[_0x629c('0x27')](function(_0x4463b6){_0x274c7a[_0x629c('0x22')]=_0x4463b6;if(_0x3a48fe[_0x629c('0x34')][_0x629c('0x41')]){_0x21d5a9['include']=[{'all':!![]}];}return db[_0x629c('0x2d')][_0x629c('0x42')](_0x21d5a9);})[_0x629c('0x27')](function(_0x1da06d){_0x274c7a[_0x629c('0x43')]=_0x1da06d;return _0x274c7a;})[_0x629c('0x27')](respondWithFilteredResult(_0x5c0d86,_0x21d5a9))[_0x629c('0x44')](handleError(_0x5c0d86,null));};exports[_0x629c('0x45')]=function(_0x2e347e,_0x18f0a3){var _0x4a1d38={'raw':!![],'where':{'id':_0x2e347e[_0x629c('0x46')]['id']}},_0x32b26c={};_0x32b26c['model']=_[_0x629c('0x47')](db['SmsTransferReport'][_0x629c('0x2e')]);_0x32b26c[_0x629c('0x34')]=_[_0x629c('0x47')](_0x2e347e[_0x629c('0x34')]);_0x32b26c['filters']=_[_0x629c('0x36')](_0x32b26c['model'],_0x32b26c[_0x629c('0x34')]);_0x4a1d38[_0x629c('0x38')]=_[_0x629c('0x36')](_0x32b26c[_0x629c('0x32')],qs[_0x629c('0x37')](_0x2e347e[_0x629c('0x34')][_0x629c('0x37')]));_0x4a1d38[_0x629c('0x38')]=_0x4a1d38[_0x629c('0x38')][_0x629c('0x48')]?_0x4a1d38['attributes']:_0x32b26c[_0x629c('0x32')];if(_0x2e347e[_0x629c('0x34')][_0x629c('0x41')]){_0x4a1d38[_0x629c('0x49')]=[{'all':!![]}];}_0x4a1d38=_['merge']({},_0x4a1d38,_0x2e347e[_0x629c('0x40')]);return db['SmsTransferReport']['find'](_0x4a1d38)[_0x629c('0x27')](handleEntityNotFound(_0x18f0a3,null))[_0x629c('0x27')](respondWithResult(_0x18f0a3,null))[_0x629c('0x44')](handleError(_0x18f0a3,null));};exports[_0x629c('0x4a')]=function(_0x199c31,_0x2f85ef){return db[_0x629c('0x2d')]['create'](_0x199c31[_0x629c('0x4b')],{})[_0x629c('0x27')](respondWithResult(_0x2f85ef,0xc9))[_0x629c('0x44')](handleError(_0x2f85ef,null));};exports[_0x629c('0x25')]=function(_0x3a98ed,_0x1aa27e){if(_0x3a98ed['body']['id']){delete _0x3a98ed[_0x629c('0x4b')]['id'];}return db[_0x629c('0x2d')]['find']({'where':{'id':_0x3a98ed[_0x629c('0x46')]['id']}})['then'](handleEntityNotFound(_0x1aa27e,null))[_0x629c('0x27')](saveUpdates(_0x3a98ed[_0x629c('0x4b')],null))[_0x629c('0x27')](respondWithResult(_0x1aa27e,null))[_0x629c('0x44')](handleError(_0x1aa27e,null));};exports['destroy']=function(_0x5ac2e1,_0x232c43){return db[_0x629c('0x2d')][_0x629c('0x4c')]({'where':{'id':_0x5ac2e1[_0x629c('0x46')]['id']}})[_0x629c('0x27')](handleEntityNotFound(_0x232c43,null))['then'](removeEntity(_0x232c43,null))['catch'](handleError(_0x232c43,null));};exports[_0x629c('0x4d')]=function(_0x1cf9d3,_0x4f729c){return db['SmsTransferReport'][_0x629c('0x4d')]()['then'](respondWithResult(_0x4f729c,null))[_0x629c('0x44')](handleError(_0x4f729c,null));}; \ No newline at end of file +var _0xaee9=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','count','limit','Content-Range','json','apply','reject','save','then','destroy','end','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','update','catch','describe'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xaee9,0x128));var _0x9aee=function(_0x1f91d0,_0x3b7077){_0x1f91d0=_0x1f91d0-0x0;var _0x152ccf=_0xaee9[_0x1f91d0];return _0x152ccf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9aee('0x0'));var jsonpatch=require(_0x9aee('0x1'));var rp=require(_0x9aee('0x2'));var moment=require('moment');var BPromise=require(_0x9aee('0x3'));var Mustache=require(_0x9aee('0x4'));var util=require(_0x9aee('0x5'));var path=require(_0x9aee('0x6'));var sox=require(_0x9aee('0x7'));var csv=require(_0x9aee('0x8'));var ejs=require(_0x9aee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9aee('0xa'));var squel=require('squel');var crypto=require(_0x9aee('0xb'));var jsforce=require(_0x9aee('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9aee('0xd'));var Redis=require('ioredis');var authService=require(_0x9aee('0xe'));var qs=require(_0x9aee('0xf'));var as=require(_0x9aee('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9aee('0x11'))(_0x9aee('0x12'));var utils=require(_0x9aee('0x13'));var config=require(_0x9aee('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45d94f,_0x2df79a){_0x2df79a=_0x2df79a||0xcc;return function(_0x3f4c5a){if(_0x3f4c5a){return _0x45d94f[_0x9aee('0x15')](_0x2df79a);}return _0x45d94f['status'](_0x2df79a)['end']();};}function respondWithResult(_0x2b97fc,_0x54a45e){_0x54a45e=_0x54a45e||0xc8;return function(_0x59276b){if(_0x59276b){return _0x2b97fc[_0x9aee('0x16')](_0x54a45e)['json'](_0x59276b);}};}function respondWithFilteredResult(_0x50b3b2,_0x30db72){return function(_0x557915){if(_0x557915){var _0x1254c9=typeof _0x30db72[_0x9aee('0x17')]==='undefined'&&typeof _0x30db72['limit']==='undefined';var _0x15d31e=_0x557915['count'];var _0x1969a9=_0x1254c9?0x0:_0x30db72[_0x9aee('0x17')];var _0x1aaab6=_0x1254c9?_0x557915[_0x9aee('0x18')]:_0x30db72['offset']+_0x30db72[_0x9aee('0x19')];var _0x2113b5;if(_0x1aaab6>=_0x15d31e){_0x1aaab6=_0x15d31e;_0x2113b5=0xc8;}else{_0x2113b5=0xce;}_0x50b3b2[_0x9aee('0x16')](_0x2113b5);return _0x50b3b2['set'](_0x9aee('0x1a'),_0x1969a9+'-'+_0x1aaab6+'/'+_0x15d31e)[_0x9aee('0x1b')](_0x557915);}return null;};}function patchUpdates(_0xd23935){return function(_0x35f032){try{jsonpatch[_0x9aee('0x1c')](_0x35f032,_0xd23935,!![]);}catch(_0x286883){return BPromise[_0x9aee('0x1d')](_0x286883);}return _0x35f032[_0x9aee('0x1e')]();};}function saveUpdates(_0x1a80eb,_0x2d9928){return function(_0x110e63){if(_0x110e63){return _0x110e63['update'](_0x1a80eb)[_0x9aee('0x1f')](function(_0x180bbc){return _0x180bbc;});}return null;};}function removeEntity(_0x30a16b,_0x56d42f){return function(_0x2924cc){if(_0x2924cc){return _0x2924cc[_0x9aee('0x20')]()[_0x9aee('0x1f')](function(){_0x30a16b[_0x9aee('0x16')](0xcc)[_0x9aee('0x21')]();});}};}function handleEntityNotFound(_0x2a9f7f,_0x518770){return function(_0x57396d){if(!_0x57396d){_0x2a9f7f[_0x9aee('0x15')](0x194);}return _0x57396d;};}function handleError(_0x2e59ac,_0x145e25){_0x145e25=_0x145e25||0x1f4;return function(_0x594770){logger['error'](_0x594770[_0x9aee('0x22')]);if(_0x594770['name']){delete _0x594770[_0x9aee('0x23')];}_0x2e59ac['status'](_0x145e25)[_0x9aee('0x24')](_0x594770);};}exports[_0x9aee('0x25')]=function(_0x317f81,_0x174b40){var _0x410407={},_0x5f4d77={},_0x4a0a25={'count':0x0,'rows':[]};var _0x16fcb0=_['map'](db[_0x9aee('0x26')][_0x9aee('0x27')],function(_0x12e2b3){return{'name':_0x12e2b3[_0x9aee('0x28')],'type':_0x12e2b3['type'][_0x9aee('0x29')]};});_0x5f4d77[_0x9aee('0x2a')]=_[_0x9aee('0x2b')](_0x16fcb0,_0x9aee('0x23'));_0x5f4d77['query']=_['keys'](_0x317f81[_0x9aee('0x2c')]);_0x5f4d77[_0x9aee('0x2d')]=_[_0x9aee('0x2e')](_0x5f4d77[_0x9aee('0x2a')],_0x5f4d77[_0x9aee('0x2c')]);_0x410407[_0x9aee('0x2f')]=_[_0x9aee('0x2e')](_0x5f4d77[_0x9aee('0x2a')],qs[_0x9aee('0x30')](_0x317f81[_0x9aee('0x2c')]['fields']));_0x410407[_0x9aee('0x2f')]=_0x410407[_0x9aee('0x2f')][_0x9aee('0x31')]?_0x410407['attributes']:_0x5f4d77[_0x9aee('0x2a')];if(!_0x317f81[_0x9aee('0x2c')][_0x9aee('0x32')](_0x9aee('0x33'))){_0x410407['limit']=qs[_0x9aee('0x19')](_0x317f81[_0x9aee('0x2c')]['limit']);_0x410407[_0x9aee('0x17')]=qs[_0x9aee('0x17')](_0x317f81['query'][_0x9aee('0x17')]);}_0x410407[_0x9aee('0x34')]=qs['sort'](_0x317f81[_0x9aee('0x2c')][_0x9aee('0x35')]);_0x410407[_0x9aee('0x36')]=qs[_0x9aee('0x2d')](_[_0x9aee('0x37')](_0x317f81[_0x9aee('0x2c')],_0x5f4d77[_0x9aee('0x2d')]),_0x16fcb0);if(_0x317f81[_0x9aee('0x2c')][_0x9aee('0x38')]){_0x410407['where']=_[_0x9aee('0x39')](_0x410407['where'],{'$or':_[_0x9aee('0x2b')](_0x16fcb0,function(_0x525590){if(_0x525590[_0x9aee('0x3a')]!==_0x9aee('0x3b')){var _0x4f4d38={};_0x4f4d38[_0x525590[_0x9aee('0x23')]]={'$like':'%'+_0x317f81[_0x9aee('0x2c')][_0x9aee('0x38')]+'%'};return _0x4f4d38;}})});}_0x410407=_[_0x9aee('0x39')]({},_0x410407,_0x317f81['options']);var _0x388933={'where':_0x410407['where']};return db[_0x9aee('0x26')][_0x9aee('0x18')](_0x388933)[_0x9aee('0x1f')](function(_0x37587c){_0x4a0a25[_0x9aee('0x18')]=_0x37587c;if(_0x317f81[_0x9aee('0x2c')][_0x9aee('0x3c')]){_0x410407[_0x9aee('0x3d')]=[{'all':!![]}];}return db[_0x9aee('0x26')][_0x9aee('0x3e')](_0x410407);})[_0x9aee('0x1f')](function(_0x11fbff){_0x4a0a25[_0x9aee('0x3f')]=_0x11fbff;return _0x4a0a25;})[_0x9aee('0x1f')](respondWithFilteredResult(_0x174b40,_0x410407))['catch'](handleError(_0x174b40,null));};exports[_0x9aee('0x40')]=function(_0x5a5844,_0x47764b){var _0x4cd331={'raw':!![],'where':{'id':_0x5a5844[_0x9aee('0x41')]['id']}},_0x359498={};_0x359498[_0x9aee('0x2a')]=_['keys'](db[_0x9aee('0x26')]['rawAttributes']);_0x359498['query']=_[_0x9aee('0x42')](_0x5a5844[_0x9aee('0x2c')]);_0x359498[_0x9aee('0x2d')]=_[_0x9aee('0x2e')](_0x359498['model'],_0x359498[_0x9aee('0x2c')]);_0x4cd331['attributes']=_[_0x9aee('0x2e')](_0x359498['model'],qs[_0x9aee('0x30')](_0x5a5844[_0x9aee('0x2c')][_0x9aee('0x30')]));_0x4cd331[_0x9aee('0x2f')]=_0x4cd331[_0x9aee('0x2f')][_0x9aee('0x31')]?_0x4cd331['attributes']:_0x359498[_0x9aee('0x2a')];if(_0x5a5844[_0x9aee('0x2c')]['includeAll']){_0x4cd331[_0x9aee('0x3d')]=[{'all':!![]}];}_0x4cd331=_[_0x9aee('0x39')]({},_0x4cd331,_0x5a5844[_0x9aee('0x43')]);return db['SmsTransferReport'][_0x9aee('0x44')](_0x4cd331)[_0x9aee('0x1f')](handleEntityNotFound(_0x47764b,null))[_0x9aee('0x1f')](respondWithResult(_0x47764b,null))['catch'](handleError(_0x47764b,null));};exports[_0x9aee('0x45')]=function(_0x5c6272,_0xd9618b){return db[_0x9aee('0x26')][_0x9aee('0x45')](_0x5c6272[_0x9aee('0x46')],{})[_0x9aee('0x1f')](respondWithResult(_0xd9618b,0xc9))['catch'](handleError(_0xd9618b,null));};exports[_0x9aee('0x47')]=function(_0x359d30,_0x2f54b8){if(_0x359d30[_0x9aee('0x46')]['id']){delete _0x359d30[_0x9aee('0x46')]['id'];}return db[_0x9aee('0x26')][_0x9aee('0x44')]({'where':{'id':_0x359d30[_0x9aee('0x41')]['id']}})[_0x9aee('0x1f')](handleEntityNotFound(_0x2f54b8,null))[_0x9aee('0x1f')](saveUpdates(_0x359d30[_0x9aee('0x46')],null))[_0x9aee('0x1f')](respondWithResult(_0x2f54b8,null))[_0x9aee('0x48')](handleError(_0x2f54b8,null));};exports['destroy']=function(_0x5202a5,_0x492382){return db[_0x9aee('0x26')]['find']({'where':{'id':_0x5202a5[_0x9aee('0x41')]['id']}})[_0x9aee('0x1f')](handleEntityNotFound(_0x492382,null))[_0x9aee('0x1f')](removeEntity(_0x492382,null))[_0x9aee('0x48')](handleError(_0x492382,null));};exports[_0x9aee('0x49')]=function(_0x5dbd3d,_0x11b77a){return db[_0x9aee('0x26')]['describe']()[_0x9aee('0x1f')](respondWithResult(_0x11b77a,null))['catch'](handleError(_0x11b77a,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e3ed4f3..6717af5 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 _0xb620=['api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','report_sms_transfer','uniqueid','lodash','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb620,0x1a0));var _0x0b62=function(_0x2ca110,_0x570b30){_0x2ca110=_0x2ca110-0x0;var _0x2fab1f=_0xb620[_0x2ca110];return _0x2fab1f;};'use strict';var _=require(_0x0b62('0x0'));var util=require('util');var logger=require(_0x0b62('0x1'))(_0x0b62('0x2'));var moment=require('moment');var BPromise=require(_0x0b62('0x3'));var rp=require(_0x0b62('0x4'));var fs=require('fs');var path=require(_0x0b62('0x5'));var rimraf=require(_0x0b62('0x6'));var config=require(_0x0b62('0x7'));var attributes=require(_0x0b62('0x8'));module['exports']=function(_0x4334b9,_0xee4338){return _0x4334b9['define']('SmsTransferReport',attributes,{'tableName':_0x0b62('0x9'),'paranoid':![],'indexes':[{'name':_0x0b62('0xa'),'fields':[_0x0b62('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf767=['uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0xf767,0x76));var _0x7f76=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0xf767[_0x2f227c];return _0x5032bc;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var logger=require(_0x7f76('0x1'))(_0x7f76('0x2'));var moment=require(_0x7f76('0x3'));var BPromise=require(_0x7f76('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f76('0x5'));var rimraf=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var attributes=require(_0x7f76('0x8'));module['exports']=function(_0x23c243,_0x2f2588){return _0x23c243[_0x7f76('0x9')](_0x7f76('0xa'),attributes,{'tableName':_0x7f76('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7f76('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 3f0f4a1..6031ffb 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 _0x29d4=['request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s'];(function(_0x42b768,_0x3f1862){var _0x4ccda8=function(_0x2d1250){while(--_0x2d1250){_0x42b768['push'](_0x42b768['shift']());}};_0x4ccda8(++_0x3f1862);}(_0x29d4,0x1a1));var _0x429d=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x29d4[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var moment=require(_0x429d('0x1'));var BPromise=require(_0x429d('0x2'));var rs=require(_0x429d('0x3'));var fs=require('fs');var Redis=require(_0x429d('0x4'));var db=require(_0x429d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x429d('0x6'))(_0x429d('0x7'));var config=require(_0x429d('0x8'));var jayson=require(_0x429d('0x9'));var client=jayson[_0x429d('0xa')][_0x429d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56aa2f,_0x1ede3f,_0x4befb9){return new BPromise(function(_0x9fc337,_0x47cb29){return client[_0x429d('0xc')](_0x56aa2f,_0x4befb9)[_0x429d('0xd')](function(_0xe6f5b4){logger['info'](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));logger['debug'](_0x429d('0x10'),_0x1ede3f,_0x429d('0xf'),JSON[_0x429d('0x11')](_0xe6f5b4));if(_0xe6f5b4['error']){if(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x13')]===0x1f4){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4['error'][_0x429d('0x14')]);return _0x47cb29(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}logger['error'](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4[_0x429d('0x12')]['message']);return _0x9fc337(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}else{logger[_0x429d('0x15')](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));_0x9fc337(_0xe6f5b4[_0x429d('0x16')]['message']);}})[_0x429d('0x17')](function(_0x53d19d){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0x53d19d);_0x47cb29(_0x53d19d);});});} \ No newline at end of file +var _0xaa48=['then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xaa48,0x15a));var _0x8aa4=function(_0x1c25d3,_0x4a39ea){_0x1c25d3=_0x1c25d3-0x0;var _0x39b0c0=_0xaa48[_0x1c25d3];return _0x39b0c0;};'use strict';var _=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var moment=require(_0x8aa4('0x2'));var BPromise=require(_0x8aa4('0x3'));var rs=require(_0x8aa4('0x4'));var fs=require('fs');var Redis=require(_0x8aa4('0x5'));var db=require(_0x8aa4('0x6'))['db'];var utils=require(_0x8aa4('0x7'));var logger=require(_0x8aa4('0x8'))(_0x8aa4('0x9'));var config=require(_0x8aa4('0xa'));var jayson=require(_0x8aa4('0xb'));var client=jayson[_0x8aa4('0xc')][_0x8aa4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x17bf06,_0x111c1d,_0x37498b){return new BPromise(function(_0xa5c92e,_0x17b04d){return client['request'](_0x17bf06,_0x37498b)[_0x8aa4('0xe')](function(_0x1e7e28){logger['info'](_0x8aa4('0xf'),_0x111c1d,_0x8aa4('0x10'));logger['debug'](_0x8aa4('0x11'),_0x111c1d,_0x8aa4('0x10'),JSON[_0x8aa4('0x12')](_0x1e7e28));if(_0x1e7e28[_0x8aa4('0x13')]){if(_0x1e7e28[_0x8aa4('0x13')][_0x8aa4('0x14')]===0x1f4){logger[_0x8aa4('0x13')](_0x8aa4('0xf'),_0x111c1d,_0x1e7e28[_0x8aa4('0x13')][_0x8aa4('0x15')]);return _0x17b04d(_0x1e7e28['error']['message']);}logger[_0x8aa4('0x13')](_0x8aa4('0xf'),_0x111c1d,_0x1e7e28[_0x8aa4('0x13')][_0x8aa4('0x15')]);return _0xa5c92e(_0x1e7e28[_0x8aa4('0x13')][_0x8aa4('0x15')]);}else{logger[_0x8aa4('0x16')](_0x8aa4('0xf'),_0x111c1d,_0x8aa4('0x10'));_0xa5c92e(_0x1e7e28[_0x8aa4('0x17')]['message']);}})['catch'](function(_0x5d1819){logger[_0x8aa4('0x13')](_0x8aa4('0xf'),_0x111c1d,_0x5d1819);_0x17b04d(_0x5d1819);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 7a56639..7a19891 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 _0x5ca0=['isAuthenticated','/:id','show','get','download','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x4195bc,_0x573a6c){var _0x14a2fd=function(_0xea1055){while(--_0xea1055){_0x4195bc['push'](_0x4195bc['shift']());}};_0x14a2fd(++_0x573a6c);}(_0x5ca0,0x148));var _0x05ca=function(_0x19e3b8,_0x4aa99b){_0x19e3b8=_0x19e3b8-0x0;var _0x31477a=_0x5ca0[_0x19e3b8];return _0x31477a;};'use strict';var multer=require('multer');var util=require(_0x05ca('0x0'));var path=require(_0x05ca('0x1'));var timeout=require('connect-timeout');var express=require(_0x05ca('0x2'));var router=express[_0x05ca('0x3')]();var fs_extra=require(_0x05ca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x05ca('0x5'));var config=require(_0x05ca('0x6'));var controller=require(_0x05ca('0x7'));router['get']('/',auth[_0x05ca('0x8')](),controller['index']);router['get'](_0x05ca('0x9'),auth['isAuthenticated'](),controller[_0x05ca('0xa')]);router[_0x05ca('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x05ca('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3bf7d7,_0x140ffb,_0x1b50eb){_0x1b50eb(null,path['join'](config['root'],_0x05ca('0xd')));},'filename':function(_0x2047b5,_0x2b9c54,_0x2429b5){_0x2b9c54[_0x05ca('0xe')]=_0x2b9c54[_0x05ca('0xe')][_0x05ca('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2429b5(null,util['format'](_0x05ca('0x10'),path[_0x05ca('0x11')](_0x2b9c54[_0x05ca('0xe')],path[_0x05ca('0x12')](_0x2b9c54[_0x05ca('0xe')])),Date[_0x05ca('0x13')](),path[_0x05ca('0x12')](_0x2b9c54[_0x05ca('0xe')])));}})});router[_0x05ca('0x14')]('/',upload[_0x05ca('0x15')](_0x05ca('0x16')),controller[_0x05ca('0x17')]);router[_0x05ca('0x18')](_0x05ca('0x9'),auth[_0x05ca('0x8')](),controller[_0x05ca('0x19')]);router[_0x05ca('0x1a')](_0x05ca('0x9'),auth[_0x05ca('0x8')](),controller['delete']);module[_0x05ca('0x1b')]=router; \ No newline at end of file +var _0x7728=['isAuthenticated','index','/:id/download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x3bbb92,_0x2f5d21){var _0x308f98=function(_0x5cec19){while(--_0x5cec19){_0x3bbb92['push'](_0x3bbb92['shift']());}};_0x308f98(++_0x2f5d21);}(_0x7728,0xc8));var _0x8772=function(_0x442f5b,_0x39d79d){_0x442f5b=_0x442f5b-0x0;var _0x19fd96=_0x7728[_0x442f5b];return _0x19fd96;};'use strict';var multer=require(_0x8772('0x0'));var util=require(_0x8772('0x1'));var path=require(_0x8772('0x2'));var timeout=require(_0x8772('0x3'));var express=require(_0x8772('0x4'));var router=express[_0x8772('0x5')]();var fs_extra=require(_0x8772('0x6'));var auth=require(_0x8772('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8772('0x8'));var controller=require('./sound.controller');router[_0x8772('0x9')]('/',auth[_0x8772('0xa')](),controller[_0x8772('0xb')]);router[_0x8772('0x9')]('/:id',auth[_0x8772('0xa')](),controller['show']);router[_0x8772('0x9')](_0x8772('0xc'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1159aa,_0x31f942,_0x5aca26){_0x5aca26(null,path[_0x8772('0xd')](config[_0x8772('0xe')],_0x8772('0xf')));},'filename':function(_0x484d45,_0x5c0c36,_0x256900){_0x5c0c36['originalname']=_0x5c0c36[_0x8772('0x10')][_0x8772('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x256900(null,util[_0x8772('0x12')](_0x8772('0x13'),path[_0x8772('0x14')](_0x5c0c36[_0x8772('0x10')],path[_0x8772('0x15')](_0x5c0c36[_0x8772('0x10')])),Date[_0x8772('0x16')](),path[_0x8772('0x15')](_0x5c0c36[_0x8772('0x10')])));}})});router[_0x8772('0x17')]('/',upload[_0x8772('0x18')](_0x8772('0x19')),controller[_0x8772('0x1a')]);router['put'](_0x8772('0x1b'),auth[_0x8772('0xa')](),controller['update']);router[_0x8772('0x1c')]('/:id',auth[_0x8772('0xa')](),controller[_0x8772('0x1c')]);module[_0x8772('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 06a68f7..f55ac7b 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 _0x50d0=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x50d0,0x101));var _0x050d=function(_0x32afa0,_0x5d1041){_0x32afa0=_0x32afa0-0x0;var _0x1b7c19=_0x50d0[_0x32afa0];return _0x1b7c19;};'use strict';var Sequelize=require(_0x050d('0x0'));module['exports']={'name':{'type':Sequelize[_0x050d('0x1')],'unique':_0x050d('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x050d('0x1')]},'display_name':{'type':Sequelize[_0x050d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x050d('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x050d('0x3')]},'original_sampleCount':{'type':Sequelize[_0x050d('0x4')]},'original_channelCount':{'type':Sequelize[_0x050d('0x5')]},'original_bitRate':{'type':Sequelize[_0x050d('0x4')]},'original_sampleRate':{'type':Sequelize[_0x050d('0x5')]},'converted_format':{'type':Sequelize[_0x050d('0x1')]},'converted_duration':{'type':Sequelize[_0x050d('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x050d('0x4')]},'converted_channelCount':{'type':Sequelize[_0x050d('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x050d('0x5')]}}; \ No newline at end of file +var _0x4972=['INTEGER','sequelize','exports','name','STRING','FLOAT','BIGINT'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x4972,0x1dd));var _0x2497=function(_0x1ce214,_0x2709ff){_0x1ce214=_0x1ce214-0x0;var _0x44814b=_0x4972[_0x1ce214];return _0x44814b;};'use strict';var Sequelize=require(_0x2497('0x0'));module[_0x2497('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2497('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2497('0x3')]},'display_name':{'type':Sequelize[_0x2497('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x2497('0x3')]},'original_format':{'type':Sequelize[_0x2497('0x3')]},'original_duration':{'type':Sequelize[_0x2497('0x4')]},'original_sampleCount':{'type':Sequelize[_0x2497('0x5')]},'original_channelCount':{'type':Sequelize[_0x2497('0x6')]},'original_bitRate':{'type':Sequelize[_0x2497('0x5')]},'original_sampleRate':{'type':Sequelize[_0x2497('0x6')]},'converted_format':{'type':Sequelize[_0x2497('0x3')]},'converted_duration':{'type':Sequelize[_0x2497('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x2497('0x6')]},'converted_bitRate':{'type':Sequelize[_0x2497('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x2497('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index fb3938d..54f0cff 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 _0x438b=['set','Content-Range','json','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','error','name','send','index','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','start','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count'];(function(_0x3051d9,_0x3de423){var _0xcc0a87=function(_0x588cee){while(--_0x588cee){_0x3051d9['push'](_0x3051d9['shift']());}};_0xcc0a87(++_0x3de423);}(_0x438b,0xe4));var _0xb438=function(_0x183e3f,_0x2380da){_0x183e3f=_0x183e3f-0x0;var _0x4da0e1=_0x438b[_0x183e3f];return _0x4da0e1;};'use strict';var emlformat=require(_0xb438('0x0'));var rimraf=require(_0xb438('0x1'));var zipdir=require(_0xb438('0x2'));var jsonpatch=require(_0xb438('0x3'));var rp=require(_0xb438('0x4'));var moment=require(_0xb438('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb438('0x6'));var util=require(_0xb438('0x7'));var path=require('path');var sox=require(_0xb438('0x8'));var csv=require(_0xb438('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb438('0xa'));var _=require(_0xb438('0xb'));var squel=require(_0xb438('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb438('0xd'));var toCsv=require(_0xb438('0x9'));var querystring=require('querystring');var Papa=require(_0xb438('0xe'));var Redis=require(_0xb438('0xf'));var authService=require(_0xb438('0x10'));var qs=require(_0xb438('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb438('0x12'));var logger=require(_0xb438('0x13'))(_0xb438('0x14'));var utils=require(_0xb438('0x15'));var config=require(_0xb438('0x16'));var licenseUtil=require(_0xb438('0x17'));var db=require(_0xb438('0x18'))['db'];function respondWithStatusCode(_0x2fcf6f,_0x10784e){_0x10784e=_0x10784e||0xcc;return function(_0xc8c4c2){if(_0xc8c4c2){return _0x2fcf6f[_0xb438('0x19')](_0x10784e);}return _0x2fcf6f[_0xb438('0x1a')](_0x10784e)[_0xb438('0x1b')]();};}function respondWithResult(_0x105784,_0x12708c){_0x12708c=_0x12708c||0xc8;return function(_0x565d07){if(_0x565d07){return _0x105784[_0xb438('0x1a')](_0x12708c)['json'](_0x565d07);}};}function respondWithFilteredResult(_0x4f0208,_0xbd8ae3){return function(_0x39ae33){if(_0x39ae33){var _0x59d77e=typeof _0xbd8ae3[_0xb438('0x1c')]==='undefined'&&typeof _0xbd8ae3[_0xb438('0x1d')]===_0xb438('0x1e');var _0x1d2558=_0x39ae33[_0xb438('0x1f')];var _0x573e56=_0x59d77e?0x0:_0xbd8ae3[_0xb438('0x1c')];var _0x411042=_0x59d77e?_0x39ae33['count']:_0xbd8ae3[_0xb438('0x1c')]+_0xbd8ae3[_0xb438('0x1d')];var _0xe1d4c0;if(_0x411042>=_0x1d2558){_0x411042=_0x1d2558;_0xe1d4c0=0xc8;}else{_0xe1d4c0=0xce;}_0x4f0208['status'](_0xe1d4c0);return _0x4f0208[_0xb438('0x20')](_0xb438('0x21'),_0x573e56+'-'+_0x411042+'/'+_0x1d2558)[_0xb438('0x22')](_0x39ae33);}return null;};}function patchUpdates(_0x5c7e1f){return function(_0x26562f){try{jsonpatch[_0xb438('0x23')](_0x26562f,_0x5c7e1f,!![]);}catch(_0x50e7be){return BPromise[_0xb438('0x24')](_0x50e7be);}return _0x26562f[_0xb438('0x25')]();};}function saveUpdates(_0x3472cb,_0x2c04aa){return function(_0x536f51){if(_0x536f51){return _0x536f51[_0xb438('0x26')](_0x3472cb)[_0xb438('0x27')](function(_0x5f5d0b){return _0x5f5d0b;});}return null;};}function removeEntity(_0x376cd2,_0x1bf34b){return function(_0x395e30){if(_0x395e30){return _0x395e30['destroy']()[_0xb438('0x27')](function(){var _0x533e3e=_0x395e30[_0xb438('0x28')]({'plain':!![]});var _0x13759c=_0xb438('0x29');return db[_0xb438('0x2a')][_0xb438('0x2b')]({'where':{'type':_0x13759c,'resourceId':_0x533e3e['id']}})[_0xb438('0x27')](function(){return _0x395e30;});})[_0xb438('0x27')](function(){_0x376cd2[_0xb438('0x1a')](0xcc)[_0xb438('0x1b')]();});}};}function handleEntityNotFound(_0x48ef55,_0x3519f1){return function(_0x580580){if(!_0x580580){_0x48ef55['sendStatus'](0x194);}return _0x580580;};}function handleError(_0x4c8d35,_0x22e2b7){_0x22e2b7=_0x22e2b7||0x1f4;return function(_0x19df0d){logger[_0xb438('0x2c')](_0x19df0d['stack']);if(_0x19df0d[_0xb438('0x2d')]){delete _0x19df0d[_0xb438('0x2d')];}_0x4c8d35['status'](_0x22e2b7)[_0xb438('0x2e')](_0x19df0d);};}exports[_0xb438('0x2f')]=function(_0x28da69,_0xb2fdde){var _0x13b291={},_0x4d8a2b={},_0x32d5f5={'count':0x0,'rows':[]};var _0x21a4b8=_[_0xb438('0x30')](db[_0xb438('0x31')]['rawAttributes'],function(_0x4beffc){return{'name':_0x4beffc[_0xb438('0x32')],'type':_0x4beffc[_0xb438('0x33')][_0xb438('0x34')]};});_0x4d8a2b[_0xb438('0x35')]=_[_0xb438('0x30')](_0x21a4b8,'name');_0x4d8a2b[_0xb438('0x36')]=_[_0xb438('0x37')](_0x28da69[_0xb438('0x36')]);_0x4d8a2b[_0xb438('0x38')]=_[_0xb438('0x39')](_0x4d8a2b['model'],_0x4d8a2b['query']);_0x13b291['attributes']=_[_0xb438('0x39')](_0x4d8a2b['model'],qs[_0xb438('0x3a')](_0x28da69[_0xb438('0x36')][_0xb438('0x3a')]));_0x13b291[_0xb438('0x3b')]=_0x13b291[_0xb438('0x3b')][_0xb438('0x3c')]?_0x13b291['attributes']:_0x4d8a2b[_0xb438('0x35')];if(!_0x28da69[_0xb438('0x36')][_0xb438('0x3d')](_0xb438('0x3e'))){_0x13b291[_0xb438('0x1d')]=qs[_0xb438('0x1d')](_0x28da69[_0xb438('0x36')]['limit']);_0x13b291[_0xb438('0x1c')]=qs[_0xb438('0x1c')](_0x28da69[_0xb438('0x36')][_0xb438('0x1c')]);}_0x13b291[_0xb438('0x3f')]=qs[_0xb438('0x40')](_0x28da69['query'][_0xb438('0x40')]);_0x13b291[_0xb438('0x41')]=qs['filters'](_[_0xb438('0x42')](_0x28da69[_0xb438('0x36')],_0x4d8a2b[_0xb438('0x38')]),_0x21a4b8);if(_0x28da69[_0xb438('0x36')][_0xb438('0x43')]){_0x13b291['where']=_[_0xb438('0x44')](_0x13b291['where'],{'$or':_['map'](_0x21a4b8,function(_0x19647b){if(_0x19647b[_0xb438('0x33')]!==_0xb438('0x45')){var _0x1253ce={};_0x1253ce[_0x19647b[_0xb438('0x2d')]]={'$like':'%'+_0x28da69[_0xb438('0x36')][_0xb438('0x43')]+'%'};return _0x1253ce;}})});}_0x13b291=_[_0xb438('0x44')]({},_0x13b291,_0x28da69[_0xb438('0x46')]);var _0x72909={'where':_0x13b291[_0xb438('0x41')]};return db['Sound'][_0xb438('0x1f')](_0x72909)[_0xb438('0x27')](function(_0x451b43){_0x32d5f5['count']=_0x451b43;if(_0x28da69[_0xb438('0x36')][_0xb438('0x47')]){_0x13b291['include']=[{'all':!![]}];}return db[_0xb438('0x31')][_0xb438('0x48')](_0x13b291);})['then'](function(_0x48b9f9){_0x32d5f5[_0xb438('0x49')]=_0x48b9f9;return _0x32d5f5;})[_0xb438('0x27')](respondWithFilteredResult(_0xb2fdde,_0x13b291))[_0xb438('0x4a')](handleError(_0xb2fdde,null));};exports[_0xb438('0x4b')]=function(_0x202815,_0x20a42d){var _0x49b511={'raw':!![],'where':{'id':_0x202815[_0xb438('0x4c')]['id']}},_0x5677f5={};_0x5677f5[_0xb438('0x35')]=_[_0xb438('0x37')](db[_0xb438('0x31')][_0xb438('0x4d')]);_0x5677f5[_0xb438('0x36')]=_[_0xb438('0x37')](_0x202815['query']);_0x5677f5[_0xb438('0x38')]=_[_0xb438('0x39')](_0x5677f5[_0xb438('0x35')],_0x5677f5['query']);_0x49b511[_0xb438('0x3b')]=_[_0xb438('0x39')](_0x5677f5['model'],qs['fields'](_0x202815['query'][_0xb438('0x3a')]));_0x49b511[_0xb438('0x3b')]=_0x49b511['attributes']['length']?_0x49b511[_0xb438('0x3b')]:_0x5677f5['model'];if(_0x202815[_0xb438('0x36')]['includeAll']){_0x49b511[_0xb438('0x4e')]=[{'all':!![]}];}_0x49b511=_[_0xb438('0x44')]({},_0x49b511,_0x202815[_0xb438('0x46')]);return db[_0xb438('0x31')][_0xb438('0x4f')](_0x49b511)[_0xb438('0x27')](handleEntityNotFound(_0x20a42d,null))[_0xb438('0x27')](respondWithResult(_0x20a42d,null))[_0xb438('0x4a')](handleError(_0x20a42d,null));};exports[_0xb438('0x50')]=function(_0x4a3b50,_0x4dc6ca,_0x153e28){return db[_0xb438('0x31')][_0xb438('0x4f')]({'where':{'id':_0x4a3b50[_0xb438('0x4c')]['id']},'attributes':[_0xb438('0x2d'),_0xb438('0x51'),'converted_format'],'raw':!![]})[_0xb438('0x27')](handleEntityNotFound(_0x4dc6ca,null))['then'](function(_0x22eb68){if(_0x22eb68){if(!fs[_0xb438('0x52')](path[_0xb438('0x53')](config[_0xb438('0x54')],_0xb438('0x55'),_0x22eb68['save_name']+'.'+_0x22eb68[_0xb438('0x56')]))){throw new db[(_0xb438('0x57'))][(_0xb438('0x58'))](_0xb438('0x59'));}return _0x4dc6ca[_0xb438('0x50')](path[_0xb438('0x53')](config[_0xb438('0x54')],_0xb438('0x55'),util[_0xb438('0x5a')](_0xb438('0x5b'),_0x22eb68[_0xb438('0x51')],_0x22eb68['converted_format'])),util[_0xb438('0x5a')](_0xb438('0x5b'),_0x22eb68[_0xb438('0x2d')],_0x22eb68[_0xb438('0x56')]));}return null;})[_0xb438('0x4a')](handleError(_0x4dc6ca,null));};exports[_0xb438('0x5c')]=function(_0x18448d,_0x7384a9,_0x3587e2){var _0x1926c8={'name':path[_0xb438('0x5d')](_0x18448d[_0xb438('0x5e')][_0xb438('0x5f')],path['extname'](_0x18448d[_0xb438('0x5e')][_0xb438('0x5f')])),'save_name':path[_0xb438('0x5d')](_0x18448d[_0xb438('0x5e')]['filename'],path[_0xb438('0x60')](_0x18448d['file'][_0xb438('0x61')])),'original_format':path['extname'](_0x18448d[_0xb438('0x5e')][_0xb438('0x5f')])[_0xb438('0x62')](0x1),'converted_format':_0xb438('0x63')};var _0xa2a820=path['join'](config[_0xb438('0x54')],_0xb438('0x64'),_0x18448d[_0xb438('0x5e')][_0xb438('0x61')]);var _0x1c6fa6=path[_0xb438('0x53')](config[_0xb438('0x54')],_0xb438('0x55'),util[_0xb438('0x5a')](_0xb438('0x5b'),path[_0xb438('0x5d')](_0x18448d['file'][_0xb438('0x61')],path[_0xb438('0x60')](_0x18448d[_0xb438('0x5e')]['filename'])),_0x1926c8['converted_format']));logger[_0xb438('0x65')](_0xb438('0x66'),_0xa2a820);logger['info'](_0xb438('0x67'),_0x1c6fa6);try{fs[_0xb438('0x68')](_0xa2a820,parseInt('0777',0x8));var _0xfca2ce=sox[_0xb438('0x69')](_0xa2a820,_0x1c6fa6,{'sampleRate':0x1f40,'format':_0xb438('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xfca2ce['on'](_0xb438('0x2c'),function(_0x30e2a0){fs[_0xb438('0x6a')](_0xa2a820);_0x7384a9[_0xb438('0x1a')](0x1f4)['send'](_0x30e2a0);});_0xfca2ce['on'](_0xb438('0x6b'),function(_0x1a954b){_0x1926c8[_0xb438('0x6c')]=isNaN(_0x1a954b[_0xb438('0x6d')])?null:_0x1a954b['duration']*0x3e8;_0x1926c8['original_sampleCount']=isNaN(_0x1a954b[_0xb438('0x6e')])?null:_0x1a954b['sampleCount'];_0x1926c8[_0xb438('0x6f')]=isNaN(_0x1a954b['channelCount'])?null:_0x1a954b[_0xb438('0x70')];_0x1926c8[_0xb438('0x71')]=isNaN(_0x1a954b['bitRate'])?null:_0x1a954b[_0xb438('0x72')];_0x1926c8[_0xb438('0x73')]=isNaN(_0x1a954b[_0xb438('0x74')])?null:_0x1a954b[_0xb438('0x74')];});_0xfca2ce['on'](_0xb438('0x75'),function(_0x3396b7){_0x1926c8[_0xb438('0x76')]=isNaN(_0x3396b7[_0xb438('0x6d')])?null:_0x3396b7['duration']*0x3e8;_0x1926c8['converted_sampleCount']=isNaN(_0x3396b7['sampleCount'])?null:_0x3396b7['sampleCount'];_0x1926c8[_0xb438('0x77')]=isNaN(_0x3396b7['channelCount'])?null:_0x3396b7['channelCount'];_0x1926c8[_0xb438('0x78')]=isNaN(_0x3396b7[_0xb438('0x72')])?null:_0x3396b7[_0xb438('0x72')];_0x1926c8['converted_sampleRate']=isNaN(_0x3396b7[_0xb438('0x74')])?null:_0x3396b7[_0xb438('0x74')];});_0xfca2ce['on'](_0xb438('0x1b'),function(){fs[_0xb438('0x68')](_0x1c6fa6,parseInt(_0xb438('0x79'),0x8));return db[_0xb438('0x31')]['create'](_0x1926c8)[_0xb438('0x27')](function(_0x1d9797){var _0x13e4e9={'role':_0x18448d[_0xb438('0x7a')][_0xb438('0x7b')],'userProfileId':_0x18448d[_0xb438('0x7a')][_0xb438('0x7c')]};if(!_0x13e4e9)throw new Error(_0xb438('0x7d'));if(_0x13e4e9['role']===_0xb438('0x7e')){var _0x657a45=_0x1d9797[_0xb438('0x28')]({'plain':!![]});return db['UserProfileSection'][_0xb438('0x4f')]({'where':{'name':'Sounds','userProfileId':_0x13e4e9[_0xb438('0x7c')]},'raw':!![]})[_0xb438('0x27')](function(_0x9ad300){if(_0x9ad300&&_0x9ad300[_0xb438('0x7f')]===0x0){return db[_0xb438('0x2a')][_0xb438('0x5c')]({'name':_0x657a45[_0xb438('0x2d')],'resourceId':_0x657a45['id'],'type':_0x9ad300['name'],'sectionId':_0x9ad300['id']},{})['then'](function(){return _0x1d9797;});}else{return _0x1d9797;}})['catch'](function(_0x520df8){logger[_0xb438('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x520df8);throw _0x520df8;});}return _0x1d9797;})[_0xb438('0x27')](respondWithResult(_0x7384a9,null))[_0xb438('0x4a')](handleError(_0x7384a9,null));});_0xfca2ce[_0xb438('0x80')]();}catch(_0x266bf4){_0x7384a9[_0xb438('0x1a')](0x1f4)[_0xb438('0x2e')](_0x266bf4);}};exports[_0xb438('0x26')]=function(_0x11a895,_0x386d26,_0x1aa36d){return db['Sound'][_0xb438('0x4f')]({'where':{'id':_0x11a895[_0xb438('0x4c')]['id']}})[_0xb438('0x27')](handleEntityNotFound(_0x386d26,null))[_0xb438('0x27')](saveUpdates(_[_0xb438('0x42')](_0x11a895[_0xb438('0x7a')],[_0xb438('0x2d'),'description']),null))[_0xb438('0x27')](respondWithResult(_0x386d26,null))[_0xb438('0x4a')](handleError(_0x386d26,null));};exports[_0xb438('0x81')]=function(_0x282fe0,_0x5987e5,_0xa44b87){return db[_0xb438('0x31')][_0xb438('0x4f')]({'where':{'id':_0x282fe0[_0xb438('0x4c')]['id']}})[_0xb438('0x27')](function(_0x23bd55){if(_0x23bd55){return _0x23bd55[_0xb438('0x2b')]();}})[_0xb438('0x27')](function(_0x4ebe31){var _0x4b3c25=path[_0xb438('0x53')](config[_0xb438('0x54')],'server/files/sounds/original',util[_0xb438('0x5a')](_0xb438('0x5b'),_0x4ebe31[_0xb438('0x51')],_0x4ebe31['original_format']));var _0x24ef5e=path[_0xb438('0x53')](config[_0xb438('0x54')],'server/files/sounds/converted',util[_0xb438('0x5a')](_0xb438('0x5b'),_0x4ebe31[_0xb438('0x51')],_0x4ebe31[_0xb438('0x56')]));fs[_0xb438('0x6a')](_0x4b3c25);fs[_0xb438('0x6a')](_0x24ef5e);return _0x4ebe31;})[_0xb438('0x27')](function(_0x25a986){if(_0x25a986){return _0x5987e5[_0xb438('0x1a')](0xcc)['end']();}})[_0xb438('0x27')](handleEntityNotFound(_0x5987e5,null))['catch'](handleError(_0x5987e5,null));}; \ No newline at end of file +var _0xba77=['attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','rows','catch','find','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','send','original_duration','duration','original_sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','name','map','Sound','rawAttributes','fieldName','key','model','keys','query','filters','intersection'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xba77,0x1cc));var _0x7ba7=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xba77[_0x2d34d6];return _0x1d3d12;};'use strict';var emlformat=require(_0x7ba7('0x0'));var rimraf=require(_0x7ba7('0x1'));var zipdir=require(_0x7ba7('0x2'));var jsonpatch=require(_0x7ba7('0x3'));var rp=require(_0x7ba7('0x4'));var moment=require('moment');var BPromise=require(_0x7ba7('0x5'));var Mustache=require(_0x7ba7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7ba7('0x7'));var csv=require(_0x7ba7('0x8'));var ejs=require(_0x7ba7('0x9'));var fs=require('fs');var fs_extra=require(_0x7ba7('0xa'));var _=require(_0x7ba7('0xb'));var squel=require(_0x7ba7('0xc'));var crypto=require(_0x7ba7('0xd'));var jsforce=require(_0x7ba7('0xe'));var deskjs=require(_0x7ba7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ba7('0x10'));var Redis=require('ioredis');var authService=require(_0x7ba7('0x11'));var qs=require(_0x7ba7('0x12'));var as=require(_0x7ba7('0x13'));var hardwareService=require(_0x7ba7('0x14'));var logger=require(_0x7ba7('0x15'))(_0x7ba7('0x16'));var utils=require(_0x7ba7('0x17'));var config=require(_0x7ba7('0x18'));var licenseUtil=require(_0x7ba7('0x19'));var db=require(_0x7ba7('0x1a'))['db'];function respondWithStatusCode(_0x58e268,_0x439fd3){_0x439fd3=_0x439fd3||0xcc;return function(_0x2b7e48){if(_0x2b7e48){return _0x58e268[_0x7ba7('0x1b')](_0x439fd3);}return _0x58e268[_0x7ba7('0x1c')](_0x439fd3)[_0x7ba7('0x1d')]();};}function respondWithResult(_0x51d201,_0x4996d1){_0x4996d1=_0x4996d1||0xc8;return function(_0x4464df){if(_0x4464df){return _0x51d201[_0x7ba7('0x1c')](_0x4996d1)[_0x7ba7('0x1e')](_0x4464df);}};}function respondWithFilteredResult(_0x50afe9,_0x1fe7ef){return function(_0x35b356){if(_0x35b356){var _0x5c21c0=typeof _0x1fe7ef[_0x7ba7('0x1f')]===_0x7ba7('0x20')&&typeof _0x1fe7ef[_0x7ba7('0x21')]===_0x7ba7('0x20');var _0x431a49=_0x35b356[_0x7ba7('0x22')];var _0x2c7176=_0x5c21c0?0x0:_0x1fe7ef[_0x7ba7('0x1f')];var _0x43ae68=_0x5c21c0?_0x35b356[_0x7ba7('0x22')]:_0x1fe7ef['offset']+_0x1fe7ef[_0x7ba7('0x21')];var _0x374649;if(_0x43ae68>=_0x431a49){_0x43ae68=_0x431a49;_0x374649=0xc8;}else{_0x374649=0xce;}_0x50afe9[_0x7ba7('0x1c')](_0x374649);return _0x50afe9[_0x7ba7('0x23')](_0x7ba7('0x24'),_0x2c7176+'-'+_0x43ae68+'/'+_0x431a49)['json'](_0x35b356);}return null;};}function patchUpdates(_0x2f3352){return function(_0x215da4){try{jsonpatch[_0x7ba7('0x25')](_0x215da4,_0x2f3352,!![]);}catch(_0x18c092){return BPromise[_0x7ba7('0x26')](_0x18c092);}return _0x215da4[_0x7ba7('0x27')]();};}function saveUpdates(_0x313f52,_0x13aa2f){return function(_0x3d26e0){if(_0x3d26e0){return _0x3d26e0[_0x7ba7('0x28')](_0x313f52)[_0x7ba7('0x29')](function(_0x1c99df){return _0x1c99df;});}return null;};}function removeEntity(_0x47750b,_0x5ecb3e){return function(_0x390e2a){if(_0x390e2a){return _0x390e2a[_0x7ba7('0x2a')]()[_0x7ba7('0x29')](function(){var _0x37640a=_0x390e2a[_0x7ba7('0x2b')]({'plain':!![]});var _0x26872d=_0x7ba7('0x2c');return db['UserProfileResource'][_0x7ba7('0x2a')]({'where':{'type':_0x26872d,'resourceId':_0x37640a['id']}})[_0x7ba7('0x29')](function(){return _0x390e2a;});})[_0x7ba7('0x29')](function(){_0x47750b['status'](0xcc)[_0x7ba7('0x1d')]();});}};}function handleEntityNotFound(_0x279e38,_0x45e6fb){return function(_0x43690e){if(!_0x43690e){_0x279e38[_0x7ba7('0x1b')](0x194);}return _0x43690e;};}function handleError(_0x1bb376,_0x422250){_0x422250=_0x422250||0x1f4;return function(_0x5f4674){logger['error'](_0x5f4674['stack']);if(_0x5f4674[_0x7ba7('0x2d')]){delete _0x5f4674[_0x7ba7('0x2d')];}_0x1bb376[_0x7ba7('0x1c')](_0x422250)['send'](_0x5f4674);};}exports['index']=function(_0x55e3cc,_0x463a78){var _0x76c7d5={},_0x2f3125={},_0xd8452e={'count':0x0,'rows':[]};var _0x1a4740=_[_0x7ba7('0x2e')](db[_0x7ba7('0x2f')][_0x7ba7('0x30')],function(_0x38273a){return{'name':_0x38273a[_0x7ba7('0x31')],'type':_0x38273a['type'][_0x7ba7('0x32')]};});_0x2f3125[_0x7ba7('0x33')]=_[_0x7ba7('0x2e')](_0x1a4740,_0x7ba7('0x2d'));_0x2f3125['query']=_[_0x7ba7('0x34')](_0x55e3cc[_0x7ba7('0x35')]);_0x2f3125[_0x7ba7('0x36')]=_[_0x7ba7('0x37')](_0x2f3125['model'],_0x2f3125[_0x7ba7('0x35')]);_0x76c7d5[_0x7ba7('0x38')]=_['intersection'](_0x2f3125['model'],qs['fields'](_0x55e3cc[_0x7ba7('0x35')][_0x7ba7('0x39')]));_0x76c7d5[_0x7ba7('0x38')]=_0x76c7d5[_0x7ba7('0x38')][_0x7ba7('0x3a')]?_0x76c7d5[_0x7ba7('0x38')]:_0x2f3125[_0x7ba7('0x33')];if(!_0x55e3cc[_0x7ba7('0x35')]['hasOwnProperty'](_0x7ba7('0x3b'))){_0x76c7d5[_0x7ba7('0x21')]=qs[_0x7ba7('0x21')](_0x55e3cc[_0x7ba7('0x35')]['limit']);_0x76c7d5[_0x7ba7('0x1f')]=qs[_0x7ba7('0x1f')](_0x55e3cc['query'][_0x7ba7('0x1f')]);}_0x76c7d5[_0x7ba7('0x3c')]=qs[_0x7ba7('0x3d')](_0x55e3cc[_0x7ba7('0x35')]['sort']);_0x76c7d5['where']=qs['filters'](_[_0x7ba7('0x3e')](_0x55e3cc[_0x7ba7('0x35')],_0x2f3125[_0x7ba7('0x36')]),_0x1a4740);if(_0x55e3cc[_0x7ba7('0x35')][_0x7ba7('0x3f')]){_0x76c7d5[_0x7ba7('0x40')]=_['merge'](_0x76c7d5[_0x7ba7('0x40')],{'$or':_[_0x7ba7('0x2e')](_0x1a4740,function(_0x3f6da3){if(_0x3f6da3[_0x7ba7('0x41')]!==_0x7ba7('0x42')){var _0x1e2d77={};_0x1e2d77[_0x3f6da3[_0x7ba7('0x2d')]]={'$like':'%'+_0x55e3cc['query']['filter']+'%'};return _0x1e2d77;}})});}_0x76c7d5=_[_0x7ba7('0x43')]({},_0x76c7d5,_0x55e3cc[_0x7ba7('0x44')]);var _0x3df77f={'where':_0x76c7d5[_0x7ba7('0x40')]};return db[_0x7ba7('0x2f')][_0x7ba7('0x22')](_0x3df77f)['then'](function(_0xbddbe2){_0xd8452e[_0x7ba7('0x22')]=_0xbddbe2;if(_0x55e3cc['query'][_0x7ba7('0x45')]){_0x76c7d5['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x76c7d5);})[_0x7ba7('0x29')](function(_0x5f584a){_0xd8452e[_0x7ba7('0x46')]=_0x5f584a;return _0xd8452e;})['then'](respondWithFilteredResult(_0x463a78,_0x76c7d5))[_0x7ba7('0x47')](handleError(_0x463a78,null));};exports['show']=function(_0x3143cf,_0x3d9410){var _0x23d3bb={'raw':!![],'where':{'id':_0x3143cf['params']['id']}},_0x58f092={};_0x58f092[_0x7ba7('0x33')]=_[_0x7ba7('0x34')](db['Sound'][_0x7ba7('0x30')]);_0x58f092['query']=_[_0x7ba7('0x34')](_0x3143cf[_0x7ba7('0x35')]);_0x58f092[_0x7ba7('0x36')]=_[_0x7ba7('0x37')](_0x58f092[_0x7ba7('0x33')],_0x58f092[_0x7ba7('0x35')]);_0x23d3bb['attributes']=_[_0x7ba7('0x37')](_0x58f092[_0x7ba7('0x33')],qs[_0x7ba7('0x39')](_0x3143cf[_0x7ba7('0x35')][_0x7ba7('0x39')]));_0x23d3bb[_0x7ba7('0x38')]=_0x23d3bb['attributes']['length']?_0x23d3bb[_0x7ba7('0x38')]:_0x58f092['model'];if(_0x3143cf['query'][_0x7ba7('0x45')]){_0x23d3bb['include']=[{'all':!![]}];}_0x23d3bb=_[_0x7ba7('0x43')]({},_0x23d3bb,_0x3143cf['options']);return db['Sound'][_0x7ba7('0x48')](_0x23d3bb)[_0x7ba7('0x29')](handleEntityNotFound(_0x3d9410,null))[_0x7ba7('0x29')](respondWithResult(_0x3d9410,null))['catch'](handleError(_0x3d9410,null));};exports[_0x7ba7('0x49')]=function(_0x594df2,_0x416b84,_0x4a07e5){return db[_0x7ba7('0x2f')]['find']({'where':{'id':_0x594df2[_0x7ba7('0x4a')]['id']},'attributes':[_0x7ba7('0x2d'),_0x7ba7('0x4b'),_0x7ba7('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x416b84,null))[_0x7ba7('0x29')](function(_0x5b12ee){if(_0x5b12ee){if(!fs[_0x7ba7('0x4d')](path[_0x7ba7('0x4e')](config[_0x7ba7('0x4f')],_0x7ba7('0x50'),_0x5b12ee[_0x7ba7('0x4b')]+'.'+_0x5b12ee[_0x7ba7('0x4c')]))){throw new db[(_0x7ba7('0x51'))][(_0x7ba7('0x52'))](_0x7ba7('0x53'));}return _0x416b84[_0x7ba7('0x49')](path['join'](config[_0x7ba7('0x4f')],'server/files/sounds/converted',util[_0x7ba7('0x54')](_0x7ba7('0x55'),_0x5b12ee[_0x7ba7('0x4b')],_0x5b12ee[_0x7ba7('0x4c')])),util[_0x7ba7('0x54')]('%s.%s',_0x5b12ee[_0x7ba7('0x2d')],_0x5b12ee[_0x7ba7('0x4c')]));}return null;})[_0x7ba7('0x47')](handleError(_0x416b84,null));};exports[_0x7ba7('0x56')]=function(_0x514d77,_0x1f681e,_0x2b36b5){var _0x3190c8={'name':path[_0x7ba7('0x57')](_0x514d77[_0x7ba7('0x58')]['originalname'],path[_0x7ba7('0x59')](_0x514d77[_0x7ba7('0x58')][_0x7ba7('0x5a')])),'save_name':path['basename'](_0x514d77['file'][_0x7ba7('0x5b')],path['extname'](_0x514d77[_0x7ba7('0x58')][_0x7ba7('0x5b')])),'original_format':path['extname'](_0x514d77['file'][_0x7ba7('0x5a')])[_0x7ba7('0x5c')](0x1),'converted_format':_0x7ba7('0x5d')};var _0x1412d4=path[_0x7ba7('0x4e')](config['root'],_0x7ba7('0x5e'),_0x514d77[_0x7ba7('0x58')][_0x7ba7('0x5b')]);var _0x3b2a77=path[_0x7ba7('0x4e')](config['root'],'server/files/sounds/converted',util[_0x7ba7('0x54')](_0x7ba7('0x55'),path[_0x7ba7('0x57')](_0x514d77['file'][_0x7ba7('0x5b')],path['extname'](_0x514d77['file'][_0x7ba7('0x5b')])),_0x3190c8['converted_format']));logger[_0x7ba7('0x5f')]('Sound\x20upload\x20filepath:\x20%s',_0x1412d4);logger['info'](_0x7ba7('0x60'),_0x3b2a77);try{fs[_0x7ba7('0x61')](_0x1412d4,parseInt(_0x7ba7('0x62'),0x8));var _0x5cda3c=sox[_0x7ba7('0x63')](_0x1412d4,_0x3b2a77,{'sampleRate':0x1f40,'format':_0x7ba7('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5cda3c['on'](_0x7ba7('0x64'),function(_0x10b9b0){fs[_0x7ba7('0x65')](_0x1412d4);_0x1f681e[_0x7ba7('0x1c')](0x1f4)[_0x7ba7('0x66')](_0x10b9b0);});_0x5cda3c['on']('src',function(_0x54c0e9){_0x3190c8[_0x7ba7('0x67')]=isNaN(_0x54c0e9[_0x7ba7('0x68')])?null:_0x54c0e9[_0x7ba7('0x68')]*0x3e8;_0x3190c8[_0x7ba7('0x69')]=isNaN(_0x54c0e9['sampleCount'])?null:_0x54c0e9['sampleCount'];_0x3190c8[_0x7ba7('0x6a')]=isNaN(_0x54c0e9['channelCount'])?null:_0x54c0e9[_0x7ba7('0x6b')];_0x3190c8[_0x7ba7('0x6c')]=isNaN(_0x54c0e9['bitRate'])?null:_0x54c0e9[_0x7ba7('0x6d')];_0x3190c8[_0x7ba7('0x6e')]=isNaN(_0x54c0e9[_0x7ba7('0x6f')])?null:_0x54c0e9[_0x7ba7('0x6f')];});_0x5cda3c['on'](_0x7ba7('0x70'),function(_0xddbd87){_0x3190c8[_0x7ba7('0x71')]=isNaN(_0xddbd87['duration'])?null:_0xddbd87[_0x7ba7('0x68')]*0x3e8;_0x3190c8[_0x7ba7('0x72')]=isNaN(_0xddbd87[_0x7ba7('0x73')])?null:_0xddbd87[_0x7ba7('0x73')];_0x3190c8[_0x7ba7('0x74')]=isNaN(_0xddbd87['channelCount'])?null:_0xddbd87[_0x7ba7('0x6b')];_0x3190c8[_0x7ba7('0x75')]=isNaN(_0xddbd87[_0x7ba7('0x6d')])?null:_0xddbd87[_0x7ba7('0x6d')];_0x3190c8[_0x7ba7('0x76')]=isNaN(_0xddbd87[_0x7ba7('0x6f')])?null:_0xddbd87['sampleRate'];});_0x5cda3c['on'](_0x7ba7('0x1d'),function(){fs[_0x7ba7('0x61')](_0x3b2a77,parseInt(_0x7ba7('0x62'),0x8));return db[_0x7ba7('0x2f')][_0x7ba7('0x56')](_0x3190c8)[_0x7ba7('0x29')](function(_0x4aa839){var _0x54c916={'role':_0x514d77['body'][_0x7ba7('0x77')],'userProfileId':_0x514d77[_0x7ba7('0x78')]['userProfileId']};if(!_0x54c916)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54c916[_0x7ba7('0x77')]===_0x7ba7('0x79')){var _0x4652fd=_0x4aa839[_0x7ba7('0x2b')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x7ba7('0x2c'),'userProfileId':_0x54c916[_0x7ba7('0x7a')]},'raw':!![]})[_0x7ba7('0x29')](function(_0x32ccbc){if(_0x32ccbc&&_0x32ccbc[_0x7ba7('0x7b')]===0x0){return db['UserProfileResource'][_0x7ba7('0x56')]({'name':_0x4652fd[_0x7ba7('0x2d')],'resourceId':_0x4652fd['id'],'type':_0x32ccbc[_0x7ba7('0x2d')],'sectionId':_0x32ccbc['id']},{})[_0x7ba7('0x29')](function(){return _0x4aa839;});}else{return _0x4aa839;}})[_0x7ba7('0x47')](function(_0x10dfd7){logger[_0x7ba7('0x64')](_0x7ba7('0x7c'),_0x10dfd7);throw _0x10dfd7;});}return _0x4aa839;})[_0x7ba7('0x29')](respondWithResult(_0x1f681e,null))[_0x7ba7('0x47')](handleError(_0x1f681e,null));});_0x5cda3c[_0x7ba7('0x7d')]();}catch(_0x156499){_0x1f681e[_0x7ba7('0x1c')](0x1f4)['send'](_0x156499);}};exports[_0x7ba7('0x28')]=function(_0x1323a3,_0x25aff4,_0x1f2b3f){return db[_0x7ba7('0x2f')][_0x7ba7('0x48')]({'where':{'id':_0x1323a3[_0x7ba7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x25aff4,null))['then'](saveUpdates(_[_0x7ba7('0x3e')](_0x1323a3[_0x7ba7('0x78')],['name',_0x7ba7('0x7e')]),null))[_0x7ba7('0x29')](respondWithResult(_0x25aff4,null))['catch'](handleError(_0x25aff4,null));};exports[_0x7ba7('0x7f')]=function(_0x5115bb,_0x23ac1e,_0x3523be){return db['Sound'][_0x7ba7('0x48')]({'where':{'id':_0x5115bb[_0x7ba7('0x4a')]['id']}})[_0x7ba7('0x29')](function(_0xd7c80c){if(_0xd7c80c){return _0xd7c80c[_0x7ba7('0x2a')]();}})['then'](function(_0x544043){var _0x4ec4ce=path[_0x7ba7('0x4e')](config[_0x7ba7('0x4f')],_0x7ba7('0x5e'),util[_0x7ba7('0x54')](_0x7ba7('0x55'),_0x544043['save_name'],_0x544043[_0x7ba7('0x80')]));var _0x5c1d1d=path['join'](config[_0x7ba7('0x4f')],_0x7ba7('0x50'),util[_0x7ba7('0x54')](_0x7ba7('0x55'),_0x544043[_0x7ba7('0x4b')],_0x544043[_0x7ba7('0x4c')]));fs['unlinkSync'](_0x4ec4ce);fs[_0x7ba7('0x65')](_0x5c1d1d);return _0x544043;})[_0x7ba7('0x29')](function(_0x53af87){if(_0x53af87){return _0x23ac1e['status'](0xcc)[_0x7ba7('0x1d')]();}})[_0x7ba7('0x29')](handleEntityNotFound(_0x23ac1e,null))[_0x7ba7('0x47')](handleError(_0x23ac1e,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 1731bbe..12eb5ee 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 _0xe171=['define','Sound','tools_sounds','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x53102b,_0xeb1d6e){var _0x4d7fae=function(_0x41efa5){while(--_0x41efa5){_0x53102b['push'](_0x53102b['shift']());}};_0x4d7fae(++_0xeb1d6e);}(_0xe171,0xd3));var _0x1e17=function(_0x1c2552,_0x573b75){_0x1c2552=_0x1c2552-0x0;var _0x2e9c08=_0xe171[_0x1c2552];return _0x2e9c08;};'use strict';var _=require('lodash');var util=require(_0x1e17('0x0'));var logger=require(_0x1e17('0x1'))(_0x1e17('0x2'));var moment=require(_0x1e17('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e17('0x4'));var fs=require('fs');var path=require(_0x1e17('0x5'));var rimraf=require(_0x1e17('0x6'));var config=require(_0x1e17('0x7'));var attributes=require(_0x1e17('0x8'));module[_0x1e17('0x9')]=function(_0x4521a4,_0x507d9b){return _0x4521a4[_0x1e17('0xa')](_0x1e17('0xb'),attributes,{'tableName':_0x1e17('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb47=['path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','api','bluebird'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0xeb47,0x7f));var _0x7eb4=function(_0x7aa7f7,_0x152acb){_0x7aa7f7=_0x7aa7f7-0x0;var _0x418266=_0xeb47[_0x7aa7f7];return _0x418266;};'use strict';var _=require(_0x7eb4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7eb4('0x1'));var moment=require('moment');var BPromise=require(_0x7eb4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7eb4('0x3'));var rimraf=require(_0x7eb4('0x4'));var config=require(_0x7eb4('0x5'));var attributes=require(_0x7eb4('0x6'));module[_0x7eb4('0x7')]=function(_0x2479cf,_0x467594){return _0x2479cf[_0x7eb4('0x8')](_0x7eb4('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 7088208..65e6af4 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 _0xae6c=['then','info','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSound','Sound','options','raw','where','attributes','include','model','map','debug','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2a56ce,_0x448f12){var _0x1f9977=function(_0x1feb57){while(--_0x1feb57){_0x2a56ce['push'](_0x2a56ce['shift']());}};_0x1f9977(++_0x448f12);}(_0xae6c,0x154));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xcae6('0x0'));var moment=require(_0xcae6('0x1'));var BPromise=require(_0xcae6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcae6('0x3'));var db=require(_0xcae6('0x4'))['db'];var utils=require(_0xcae6('0x5'));var logger=require('../../config/logger')(_0xcae6('0x6'));var config=require(_0xcae6('0x7'));var jayson=require(_0xcae6('0x8'));var client=jayson[_0xcae6('0x9')][_0xcae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46c5cf,_0x1ae411,_0x12c3e9){return new BPromise(function(_0x1d19f2,_0x20c1e2){return client[_0xcae6('0xb')](_0x46c5cf,_0x12c3e9)[_0xcae6('0xc')](function(_0x20f4f5){logger[_0xcae6('0xd')](_0xcae6('0xe'),_0x1ae411,_0xcae6('0xf'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x1ae411,_0xcae6('0xf'),JSON[_0xcae6('0x10')](_0x20f4f5));if(_0x20f4f5[_0xcae6('0x11')]){if(_0x20f4f5[_0xcae6('0x11')][_0xcae6('0x12')]===0x1f4){logger[_0xcae6('0x11')](_0xcae6('0xe'),_0x1ae411,_0x20f4f5[_0xcae6('0x11')][_0xcae6('0x13')]);return _0x20c1e2(_0x20f4f5['error'][_0xcae6('0x13')]);}logger[_0xcae6('0x11')]('Sound,\x20%s,\x20%s',_0x1ae411,_0x20f4f5[_0xcae6('0x11')]['message']);return _0x1d19f2(_0x20f4f5[_0xcae6('0x11')][_0xcae6('0x13')]);}else{logger[_0xcae6('0xd')](_0xcae6('0xe'),_0x1ae411,'request\x20sent');_0x1d19f2(_0x20f4f5[_0xcae6('0x14')][_0xcae6('0x13')]);}})['catch'](function(_0x380ccf){logger['error'](_0xcae6('0xe'),_0x1ae411,_0x380ccf);_0x20c1e2(_0x380ccf);});});}exports[_0xcae6('0x15')]=function(_0x133eb7){var _0x292bd7=this;return new Promise(function(_0x584a99,_0x59d1d6){return db[_0xcae6('0x16')]['find']({'raw':_0x133eb7[_0xcae6('0x17')]?_0x133eb7[_0xcae6('0x17')][_0xcae6('0x18')]===undefined?!![]:![]:!![],'where':_0x133eb7[_0xcae6('0x17')]?_0x133eb7['options'][_0xcae6('0x19')]||null:null,'attributes':_0x133eb7['options']?_0x133eb7[_0xcae6('0x17')][_0xcae6('0x1a')]||null:null,'include':_0x133eb7[_0xcae6('0x17')]?_0x133eb7[_0xcae6('0x17')][_0xcae6('0x1b')]?_['map'](_0x133eb7['options'][_0xcae6('0x1b')],function(_0x1d707d){return{'model':db[_0x1d707d[_0xcae6('0x1c')]],'as':_0x1d707d['as'],'attributes':_0x1d707d[_0xcae6('0x1a')],'include':_0x1d707d[_0xcae6('0x1b')]?_[_0xcae6('0x1d')](_0x1d707d[_0xcae6('0x1b')],function(_0x43fd9b){return{'model':db[_0x43fd9b[_0xcae6('0x1c')]],'as':_0x43fd9b['as'],'attributes':_0x43fd9b[_0xcae6('0x1a')],'include':_0x43fd9b['include']?_[_0xcae6('0x1d')](_0x43fd9b[_0xcae6('0x1b')],function(_0x33a6d9){return{'model':db[_0x33a6d9[_0xcae6('0x1c')]],'as':_0x33a6d9['as'],'attributes':_0x33a6d9[_0xcae6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ebe87){logger[_0xcae6('0xd')](_0xcae6('0x15'),_0x133eb7);logger[_0xcae6('0x1e')]('ShowSound',_0x133eb7,JSON[_0xcae6('0x10')](_0x4ebe87));_0x584a99(_0x4ebe87);})[_0xcae6('0x1f')](function(_0x23c248){logger[_0xcae6('0x11')](_0xcae6('0x15'),_0x23c248[_0xcae6('0x13')],_0x133eb7);_0x59d1d6(_0x292bd7[_0xcae6('0x11')](0x1f4,_0x23c248[_0xcae6('0x13')]));});});}; \ No newline at end of file +var _0xc8f2=['jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowSound','find','options','raw','where','attributes','map','include','model','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xab0515,_0x4b8ab2){var _0x443d59=function(_0xfd6c59){while(--_0xfd6c59){_0xab0515['push'](_0xab0515['shift']());}};_0x443d59(++_0x4b8ab2);}(_0xc8f2,0x1b7));var _0x2c8f=function(_0x282f1d,_0x3795b1){_0x282f1d=_0x282f1d-0x0;var _0x5ab27b=_0xc8f2[_0x282f1d];return _0x5ab27b;};'use strict';var _=require('lodash');var util=require(_0x2c8f('0x0'));var moment=require('moment');var BPromise=require(_0x2c8f('0x1'));var rs=require(_0x2c8f('0x2'));var fs=require('fs');var Redis=require(_0x2c8f('0x3'));var db=require(_0x2c8f('0x4'))['db'];var utils=require(_0x2c8f('0x5'));var logger=require(_0x2c8f('0x6'))(_0x2c8f('0x7'));var config=require(_0x2c8f('0x8'));var jayson=require(_0x2c8f('0x9'));var client=jayson[_0x2c8f('0xa')][_0x2c8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23602f,_0x2aa563,_0x1e77f6){return new BPromise(function(_0x3ac7ce,_0x5bc885){return client[_0x2c8f('0xc')](_0x23602f,_0x1e77f6)['then'](function(_0x25b81a){logger[_0x2c8f('0xd')](_0x2c8f('0xe'),_0x2aa563,_0x2c8f('0xf'));logger[_0x2c8f('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x2aa563,_0x2c8f('0xf'),JSON[_0x2c8f('0x11')](_0x25b81a));if(_0x25b81a[_0x2c8f('0x12')]){if(_0x25b81a['error']['code']===0x1f4){logger[_0x2c8f('0x12')](_0x2c8f('0xe'),_0x2aa563,_0x25b81a[_0x2c8f('0x12')]['message']);return _0x5bc885(_0x25b81a[_0x2c8f('0x12')]['message']);}logger['error'](_0x2c8f('0xe'),_0x2aa563,_0x25b81a['error'][_0x2c8f('0x13')]);return _0x3ac7ce(_0x25b81a['error'][_0x2c8f('0x13')]);}else{logger[_0x2c8f('0xd')](_0x2c8f('0xe'),_0x2aa563,'request\x20sent');_0x3ac7ce(_0x25b81a[_0x2c8f('0x14')]['message']);}})[_0x2c8f('0x15')](function(_0xbbbb4c){logger[_0x2c8f('0x12')](_0x2c8f('0xe'),_0x2aa563,_0xbbbb4c);_0x5bc885(_0xbbbb4c);});});}exports[_0x2c8f('0x16')]=function(_0x3c4907){var _0x37dd2e=this;return new Promise(function(_0x4d84a4,_0x5122d3){return db['Sound'][_0x2c8f('0x17')]({'raw':_0x3c4907[_0x2c8f('0x18')]?_0x3c4907[_0x2c8f('0x18')][_0x2c8f('0x19')]===undefined?!![]:![]:!![],'where':_0x3c4907[_0x2c8f('0x18')]?_0x3c4907[_0x2c8f('0x18')][_0x2c8f('0x1a')]||null:null,'attributes':_0x3c4907[_0x2c8f('0x18')]?_0x3c4907[_0x2c8f('0x18')][_0x2c8f('0x1b')]||null:null,'include':_0x3c4907['options']?_0x3c4907[_0x2c8f('0x18')]['include']?_[_0x2c8f('0x1c')](_0x3c4907[_0x2c8f('0x18')][_0x2c8f('0x1d')],function(_0x13ef3b){return{'model':db[_0x13ef3b['model']],'as':_0x13ef3b['as'],'attributes':_0x13ef3b['attributes'],'include':_0x13ef3b[_0x2c8f('0x1d')]?_[_0x2c8f('0x1c')](_0x13ef3b[_0x2c8f('0x1d')],function(_0x3a1454){return{'model':db[_0x3a1454['model']],'as':_0x3a1454['as'],'attributes':_0x3a1454[_0x2c8f('0x1b')],'include':_0x3a1454[_0x2c8f('0x1d')]?_[_0x2c8f('0x1c')](_0x3a1454[_0x2c8f('0x1d')],function(_0x397188){return{'model':db[_0x397188[_0x2c8f('0x1e')]],'as':_0x397188['as'],'attributes':_0x397188['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c8f('0x1f')](function(_0x36300b){logger[_0x2c8f('0xd')]('ShowSound',_0x3c4907);logger['debug']('ShowSound',_0x3c4907,JSON[_0x2c8f('0x11')](_0x36300b));_0x4d84a4(_0x36300b);})[_0x2c8f('0x15')](function(_0x3ca49f){logger[_0x2c8f('0x12')]('ShowSound',_0x3ca49f[_0x2c8f('0x13')],_0x3c4907);_0x5122d3(_0x37dd2e['error'](0x1f4,_0x3ca49f[_0x2c8f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e9d5a32..32ae5a8 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x253761,_0x314fc3){var _0x1f6202=function(_0x3d3f6c){while(--_0x3d3f6c){_0x253761['push'](_0x253761['shift']());}};_0x1f6202(++_0x314fc3);}(_0x5eb8,0xb0));var _0x85eb=function(_0x335a62,_0xfafea4){_0x335a62=_0x335a62-0x0;var _0x249a9a=_0x5eb8[_0x335a62];return _0x249a9a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +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(_0x2633c7,_0x4db8b3){var _0xbb644=function(_0x3b63e0){while(--_0x3b63e0){_0x2633c7['push'](_0x2633c7['shift']());}};_0xbb644(++_0x4db8b3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0x0b0e[_0x38c652];return _0x218a37;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index fa20c69..6a1c756 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 _0x4249=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x4249,0x1c2));var _0x9424=function(_0x2fdbbb,_0xd2977b){_0x2fdbbb=_0x2fdbbb-0x0;var _0x47664f=_0x4249[_0x2fdbbb];return _0x47664f;};'use strict';var Sequelize=require(_0x9424('0x0'));module[_0x9424('0x1')]={'uniqueid':{'type':Sequelize[_0x9424('0x2')]},'body':{'type':Sequelize[_0x9424('0x3')](_0x9424('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x9424('0x5')]('in',_0x9424('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9424('0x3')]}}; \ No newline at end of file +var _0x23c9=['TEXT','medium','ENUM','out','STRING','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x23c9,0x1da));var _0x923c=function(_0x578a80,_0x412698){_0x578a80=_0x578a80-0x0;var _0x4b4ba8=_0x23c9[_0x578a80];return _0x4b4ba8;};'use strict';var Sequelize=require(_0x923c('0x0'));module[_0x923c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x923c('0x2')](_0x923c('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x923c('0x4')]('in',_0x923c('0x5')),'defaultValue':_0x923c('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x923c('0x6')]},'providerResponse':{'type':Sequelize[_0x923c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5074fcf..61e34d7 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 _0xbd9f=['filters','filter','merge','VIRTUAL','options','SquareMessage','includeAll','include','findAll','rows','show','find','catch','create','body','params','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where'];(function(_0x11c6cd,_0x54ed63){var _0x2c7387=function(_0xda038d){while(--_0xda038d){_0x11c6cd['push'](_0x11c6cd['shift']());}};_0x2c7387(++_0x54ed63);}(_0xbd9f,0x98));var _0xfbd9=function(_0x3b469e,_0x5ac045){_0x3b469e=_0x3b469e-0x0;var _0x597136=_0xbd9f[_0x3b469e];return _0x597136;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfbd9('0x0'));var rp=require('request-promise');var moment=require(_0xfbd9('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xfbd9('0x2'));var util=require('util');var path=require(_0xfbd9('0x3'));var sox=require(_0xfbd9('0x4'));var csv=require(_0xfbd9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbd9('0x6'));var _=require('lodash');var squel=require(_0xfbd9('0x7'));var crypto=require(_0xfbd9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xfbd9('0x9'));var toCsv=require(_0xfbd9('0x5'));var querystring=require(_0xfbd9('0xa'));var Papa=require('papaparse');var Redis=require(_0xfbd9('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xfbd9('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbd9('0xd'));var logger=require(_0xfbd9('0xe'))('api');var utils=require(_0xfbd9('0xf'));var config=require(_0xfbd9('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbd9('0x11'))['db'];function respondWithStatusCode(_0x301770,_0x1a4a0e){_0x1a4a0e=_0x1a4a0e||0xcc;return function(_0x527707){if(_0x527707){return _0x301770[_0xfbd9('0x12')](_0x1a4a0e);}return _0x301770['status'](_0x1a4a0e)['end']();};}function respondWithResult(_0x36113b,_0x35adb1){_0x35adb1=_0x35adb1||0xc8;return function(_0x159743){if(_0x159743){return _0x36113b[_0xfbd9('0x13')](_0x35adb1)['json'](_0x159743);}};}function respondWithFilteredResult(_0x2fef54,_0x9f8390){return function(_0x2b9553){if(_0x2b9553){var _0x58d553=typeof _0x9f8390[_0xfbd9('0x14')]===_0xfbd9('0x15')&&typeof _0x9f8390['limit']===_0xfbd9('0x15');var _0x516dcf=_0x2b9553[_0xfbd9('0x16')];var _0x13918f=_0x58d553?0x0:_0x9f8390['offset'];var _0x3ed394=_0x58d553?_0x2b9553[_0xfbd9('0x16')]:_0x9f8390[_0xfbd9('0x14')]+_0x9f8390[_0xfbd9('0x17')];var _0x35bf78;if(_0x3ed394>=_0x516dcf){_0x3ed394=_0x516dcf;_0x35bf78=0xc8;}else{_0x35bf78=0xce;}_0x2fef54[_0xfbd9('0x13')](_0x35bf78);return _0x2fef54[_0xfbd9('0x18')](_0xfbd9('0x19'),_0x13918f+'-'+_0x3ed394+'/'+_0x516dcf)[_0xfbd9('0x1a')](_0x2b9553);}return null;};}function patchUpdates(_0x1b1eea){return function(_0x2d2c6e){try{jsonpatch[_0xfbd9('0x1b')](_0x2d2c6e,_0x1b1eea,!![]);}catch(_0x2fc10b){return BPromise[_0xfbd9('0x1c')](_0x2fc10b);}return _0x2d2c6e[_0xfbd9('0x1d')]();};}function saveUpdates(_0x32f9bb,_0x12140b){return function(_0x4d3020){if(_0x4d3020){return _0x4d3020[_0xfbd9('0x1e')](_0x32f9bb)[_0xfbd9('0x1f')](function(_0x175373){return _0x175373;});}return null;};}function removeEntity(_0x299dd2,_0x237313){return function(_0x39da76){if(_0x39da76){return _0x39da76[_0xfbd9('0x20')]()[_0xfbd9('0x1f')](function(){_0x299dd2[_0xfbd9('0x13')](0xcc)[_0xfbd9('0x21')]();});}};}function handleEntityNotFound(_0x1b0cc5,_0x4deb2e){return function(_0x1de422){if(!_0x1de422){_0x1b0cc5[_0xfbd9('0x12')](0x194);}return _0x1de422;};}function handleError(_0x33be84,_0x5c8857){_0x5c8857=_0x5c8857||0x1f4;return function(_0x4f2368){logger[_0xfbd9('0x22')](_0x4f2368['stack']);if(_0x4f2368[_0xfbd9('0x23')]){delete _0x4f2368['name'];}_0x33be84['status'](_0x5c8857)[_0xfbd9('0x24')](_0x4f2368);};}exports['index']=function(_0x303257,_0x1c920d){var _0xb06e9={},_0x3ad635={},_0x12f42a={'count':0x0,'rows':[]};var _0x3a8d39=_[_0xfbd9('0x25')](db['SquareMessage'][_0xfbd9('0x26')],function(_0x179b8e){return{'name':_0x179b8e[_0xfbd9('0x27')],'type':_0x179b8e[_0xfbd9('0x28')][_0xfbd9('0x29')]};});_0x3ad635[_0xfbd9('0x2a')]=_[_0xfbd9('0x25')](_0x3a8d39,_0xfbd9('0x23'));_0x3ad635[_0xfbd9('0x2b')]=_[_0xfbd9('0x2c')](_0x303257['query']);_0x3ad635['filters']=_[_0xfbd9('0x2d')](_0x3ad635[_0xfbd9('0x2a')],_0x3ad635[_0xfbd9('0x2b')]);_0xb06e9[_0xfbd9('0x2e')]=_[_0xfbd9('0x2d')](_0x3ad635['model'],qs[_0xfbd9('0x2f')](_0x303257[_0xfbd9('0x2b')][_0xfbd9('0x2f')]));_0xb06e9[_0xfbd9('0x2e')]=_0xb06e9[_0xfbd9('0x2e')][_0xfbd9('0x30')]?_0xb06e9[_0xfbd9('0x2e')]:_0x3ad635[_0xfbd9('0x2a')];if(!_0x303257['query'][_0xfbd9('0x31')]('nolimit')){_0xb06e9[_0xfbd9('0x17')]=qs['limit'](_0x303257['query'][_0xfbd9('0x17')]);_0xb06e9[_0xfbd9('0x14')]=qs['offset'](_0x303257[_0xfbd9('0x2b')][_0xfbd9('0x14')]);}_0xb06e9[_0xfbd9('0x32')]=qs['sort'](_0x303257[_0xfbd9('0x2b')]['sort']);_0xb06e9[_0xfbd9('0x33')]=qs[_0xfbd9('0x34')](_['pick'](_0x303257[_0xfbd9('0x2b')],_0x3ad635[_0xfbd9('0x34')]),_0x3a8d39);if(_0x303257[_0xfbd9('0x2b')][_0xfbd9('0x35')]){_0xb06e9[_0xfbd9('0x33')]=_[_0xfbd9('0x36')](_0xb06e9[_0xfbd9('0x33')],{'$or':_[_0xfbd9('0x25')](_0x3a8d39,function(_0x5376e5){if(_0x5376e5[_0xfbd9('0x28')]!==_0xfbd9('0x37')){var _0x7cedd7={};_0x7cedd7[_0x5376e5[_0xfbd9('0x23')]]={'$like':'%'+_0x303257[_0xfbd9('0x2b')]['filter']+'%'};return _0x7cedd7;}})});}_0xb06e9=_[_0xfbd9('0x36')]({},_0xb06e9,_0x303257[_0xfbd9('0x38')]);var _0x1041e1={'where':_0xb06e9['where']};return db[_0xfbd9('0x39')][_0xfbd9('0x16')](_0x1041e1)[_0xfbd9('0x1f')](function(_0x521da4){_0x12f42a[_0xfbd9('0x16')]=_0x521da4;if(_0x303257[_0xfbd9('0x2b')][_0xfbd9('0x3a')]){_0xb06e9[_0xfbd9('0x3b')]=[{'all':!![]}];}return db[_0xfbd9('0x39')][_0xfbd9('0x3c')](_0xb06e9);})[_0xfbd9('0x1f')](function(_0x55f3dc){_0x12f42a[_0xfbd9('0x3d')]=_0x55f3dc;return _0x12f42a;})[_0xfbd9('0x1f')](respondWithFilteredResult(_0x1c920d,_0xb06e9))['catch'](handleError(_0x1c920d,null));};exports[_0xfbd9('0x3e')]=function(_0x3b80a8,_0x294ddd){var _0x1d2a7a={'raw':!![],'where':{'id':_0x3b80a8['params']['id']}},_0x2eaa5d={};_0x2eaa5d[_0xfbd9('0x2a')]=_['keys'](db['SquareMessage'][_0xfbd9('0x26')]);_0x2eaa5d['query']=_[_0xfbd9('0x2c')](_0x3b80a8[_0xfbd9('0x2b')]);_0x2eaa5d[_0xfbd9('0x34')]=_[_0xfbd9('0x2d')](_0x2eaa5d[_0xfbd9('0x2a')],_0x2eaa5d[_0xfbd9('0x2b')]);_0x1d2a7a[_0xfbd9('0x2e')]=_['intersection'](_0x2eaa5d[_0xfbd9('0x2a')],qs[_0xfbd9('0x2f')](_0x3b80a8['query'][_0xfbd9('0x2f')]));_0x1d2a7a[_0xfbd9('0x2e')]=_0x1d2a7a[_0xfbd9('0x2e')][_0xfbd9('0x30')]?_0x1d2a7a['attributes']:_0x2eaa5d[_0xfbd9('0x2a')];if(_0x3b80a8[_0xfbd9('0x2b')][_0xfbd9('0x3a')]){_0x1d2a7a['include']=[{'all':!![]}];}_0x1d2a7a=_['merge']({},_0x1d2a7a,_0x3b80a8[_0xfbd9('0x38')]);return db[_0xfbd9('0x39')][_0xfbd9('0x3f')](_0x1d2a7a)[_0xfbd9('0x1f')](handleEntityNotFound(_0x294ddd,null))[_0xfbd9('0x1f')](respondWithResult(_0x294ddd,null))[_0xfbd9('0x40')](handleError(_0x294ddd,null));};exports[_0xfbd9('0x41')]=function(_0x275797,_0xfd06d4){return db[_0xfbd9('0x39')]['create'](_0x275797[_0xfbd9('0x42')],{})[_0xfbd9('0x1f')](respondWithResult(_0xfd06d4,0xc9))[_0xfbd9('0x40')](handleError(_0xfd06d4,null));};exports[_0xfbd9('0x1e')]=function(_0x4add02,_0x5d2576){if(_0x4add02['body']['id']){delete _0x4add02[_0xfbd9('0x42')]['id'];}return db[_0xfbd9('0x39')][_0xfbd9('0x3f')]({'where':{'id':_0x4add02[_0xfbd9('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d2576,null))['then'](saveUpdates(_0x4add02[_0xfbd9('0x42')],null))[_0xfbd9('0x1f')](respondWithResult(_0x5d2576,null))[_0xfbd9('0x40')](handleError(_0x5d2576,null));};exports['destroy']=function(_0x3e3d94,_0x1c2154){return db['SquareMessage'][_0xfbd9('0x3f')]({'where':{'id':_0x3e3d94[_0xfbd9('0x43')]['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0x1c2154,null))[_0xfbd9('0x1f')](removeEntity(_0x1c2154,null))[_0xfbd9('0x40')](handleError(_0x1c2154,null));}; \ No newline at end of file +var _0x556a=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','reject','update','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x556a,0x1dd));var _0xa556=function(_0x36be68,_0xf85191){_0x36be68=_0x36be68-0x0;var _0xbfe50c=_0x556a[_0x36be68];return _0xbfe50c;};'use strict';var emlformat=require(_0xa556('0x0'));var rimraf=require(_0xa556('0x1'));var zipdir=require(_0xa556('0x2'));var jsonpatch=require(_0xa556('0x3'));var rp=require(_0xa556('0x4'));var moment=require(_0xa556('0x5'));var BPromise=require(_0xa556('0x6'));var Mustache=require(_0xa556('0x7'));var util=require(_0xa556('0x8'));var path=require('path');var sox=require(_0xa556('0x9'));var csv=require(_0xa556('0xa'));var ejs=require(_0xa556('0xb'));var fs=require('fs');var fs_extra=require(_0xa556('0xc'));var _=require(_0xa556('0xd'));var squel=require('squel');var crypto=require(_0xa556('0xe'));var jsforce=require(_0xa556('0xf'));var deskjs=require(_0xa556('0x10'));var toCsv=require(_0xa556('0xa'));var querystring=require('querystring');var Papa=require(_0xa556('0x11'));var Redis=require(_0xa556('0x12'));var authService=require(_0xa556('0x13'));var qs=require(_0xa556('0x14'));var as=require(_0xa556('0x15'));var hardwareService=require(_0xa556('0x16'));var logger=require(_0xa556('0x17'))(_0xa556('0x18'));var utils=require('../../config/utils');var config=require(_0xa556('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa556('0x1a'))['db'];function respondWithStatusCode(_0x552788,_0x562211){_0x562211=_0x562211||0xcc;return function(_0x2de803){if(_0x2de803){return _0x552788[_0xa556('0x1b')](_0x562211);}return _0x552788[_0xa556('0x1c')](_0x562211)[_0xa556('0x1d')]();};}function respondWithResult(_0x59b04e,_0x2f20cb){_0x2f20cb=_0x2f20cb||0xc8;return function(_0x10f9bc){if(_0x10f9bc){return _0x59b04e[_0xa556('0x1c')](_0x2f20cb)[_0xa556('0x1e')](_0x10f9bc);}};}function respondWithFilteredResult(_0x1f8b7c,_0x570ed0){return function(_0x5cee6c){if(_0x5cee6c){var _0xbdb988=typeof _0x570ed0[_0xa556('0x1f')]==='undefined'&&typeof _0x570ed0[_0xa556('0x20')]==='undefined';var _0x47b96a=_0x5cee6c[_0xa556('0x21')];var _0x529879=_0xbdb988?0x0:_0x570ed0[_0xa556('0x1f')];var _0x46b205=_0xbdb988?_0x5cee6c[_0xa556('0x21')]:_0x570ed0[_0xa556('0x1f')]+_0x570ed0['limit'];var _0x452e6f;if(_0x46b205>=_0x47b96a){_0x46b205=_0x47b96a;_0x452e6f=0xc8;}else{_0x452e6f=0xce;}_0x1f8b7c[_0xa556('0x1c')](_0x452e6f);return _0x1f8b7c[_0xa556('0x22')]('Content-Range',_0x529879+'-'+_0x46b205+'/'+_0x47b96a)[_0xa556('0x1e')](_0x5cee6c);}return null;};}function patchUpdates(_0x11ab73){return function(_0x5bfa4d){try{jsonpatch['apply'](_0x5bfa4d,_0x11ab73,!![]);}catch(_0x31c8c6){return BPromise[_0xa556('0x23')](_0x31c8c6);}return _0x5bfa4d['save']();};}function saveUpdates(_0x22e9d0,_0x50bc16){return function(_0x22718a){if(_0x22718a){return _0x22718a[_0xa556('0x24')](_0x22e9d0)[_0xa556('0x25')](function(_0x39cae2){return _0x39cae2;});}return null;};}function removeEntity(_0x3e8628,_0xfb4dda){return function(_0x1bcecb){if(_0x1bcecb){return _0x1bcecb[_0xa556('0x26')]()[_0xa556('0x25')](function(){_0x3e8628[_0xa556('0x1c')](0xcc)[_0xa556('0x1d')]();});}};}function handleEntityNotFound(_0xec6fbb,_0x4bf442){return function(_0x2ca8b6){if(!_0x2ca8b6){_0xec6fbb[_0xa556('0x1b')](0x194);}return _0x2ca8b6;};}function handleError(_0x518557,_0x20ec86){_0x20ec86=_0x20ec86||0x1f4;return function(_0x169d01){logger['error'](_0x169d01[_0xa556('0x27')]);if(_0x169d01[_0xa556('0x28')]){delete _0x169d01[_0xa556('0x28')];}_0x518557['status'](_0x20ec86)[_0xa556('0x29')](_0x169d01);};}exports[_0xa556('0x2a')]=function(_0x19f1b8,_0x57da1a){var _0x25dab6={},_0x1f5ce4={},_0x20accc={'count':0x0,'rows':[]};var _0x385fb1=_[_0xa556('0x2b')](db[_0xa556('0x2c')][_0xa556('0x2d')],function(_0x4d0a30){return{'name':_0x4d0a30[_0xa556('0x2e')],'type':_0x4d0a30['type'][_0xa556('0x2f')]};});_0x1f5ce4[_0xa556('0x30')]=_[_0xa556('0x2b')](_0x385fb1,_0xa556('0x28'));_0x1f5ce4[_0xa556('0x31')]=_[_0xa556('0x32')](_0x19f1b8[_0xa556('0x31')]);_0x1f5ce4['filters']=_[_0xa556('0x33')](_0x1f5ce4[_0xa556('0x30')],_0x1f5ce4[_0xa556('0x31')]);_0x25dab6[_0xa556('0x34')]=_[_0xa556('0x33')](_0x1f5ce4[_0xa556('0x30')],qs[_0xa556('0x35')](_0x19f1b8[_0xa556('0x31')][_0xa556('0x35')]));_0x25dab6['attributes']=_0x25dab6[_0xa556('0x34')][_0xa556('0x36')]?_0x25dab6[_0xa556('0x34')]:_0x1f5ce4['model'];if(!_0x19f1b8[_0xa556('0x31')][_0xa556('0x37')](_0xa556('0x38'))){_0x25dab6[_0xa556('0x20')]=qs['limit'](_0x19f1b8[_0xa556('0x31')]['limit']);_0x25dab6[_0xa556('0x1f')]=qs['offset'](_0x19f1b8[_0xa556('0x31')][_0xa556('0x1f')]);}_0x25dab6[_0xa556('0x39')]=qs[_0xa556('0x3a')](_0x19f1b8[_0xa556('0x31')]['sort']);_0x25dab6['where']=qs[_0xa556('0x3b')](_[_0xa556('0x3c')](_0x19f1b8[_0xa556('0x31')],_0x1f5ce4[_0xa556('0x3b')]),_0x385fb1);if(_0x19f1b8[_0xa556('0x31')][_0xa556('0x3d')]){_0x25dab6[_0xa556('0x3e')]=_[_0xa556('0x3f')](_0x25dab6[_0xa556('0x3e')],{'$or':_[_0xa556('0x2b')](_0x385fb1,function(_0x1cd7e0){if(_0x1cd7e0[_0xa556('0x40')]!==_0xa556('0x41')){var _0x3a4d27={};_0x3a4d27[_0x1cd7e0[_0xa556('0x28')]]={'$like':'%'+_0x19f1b8['query'][_0xa556('0x3d')]+'%'};return _0x3a4d27;}})});}_0x25dab6=_[_0xa556('0x3f')]({},_0x25dab6,_0x19f1b8[_0xa556('0x42')]);var _0x2fc959={'where':_0x25dab6['where']};return db[_0xa556('0x2c')][_0xa556('0x21')](_0x2fc959)[_0xa556('0x25')](function(_0x41bc2e){_0x20accc[_0xa556('0x21')]=_0x41bc2e;if(_0x19f1b8['query'][_0xa556('0x43')]){_0x25dab6[_0xa556('0x44')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x25dab6);})[_0xa556('0x25')](function(_0x544579){_0x20accc[_0xa556('0x45')]=_0x544579;return _0x20accc;})['then'](respondWithFilteredResult(_0x57da1a,_0x25dab6))[_0xa556('0x46')](handleError(_0x57da1a,null));};exports['show']=function(_0x483475,_0x48f2dc){var _0x5b405c={'raw':!![],'where':{'id':_0x483475[_0xa556('0x47')]['id']}},_0x3c700e={};_0x3c700e['model']=_[_0xa556('0x32')](db[_0xa556('0x2c')]['rawAttributes']);_0x3c700e['query']=_[_0xa556('0x32')](_0x483475['query']);_0x3c700e['filters']=_['intersection'](_0x3c700e[_0xa556('0x30')],_0x3c700e[_0xa556('0x31')]);_0x5b405c['attributes']=_[_0xa556('0x33')](_0x3c700e[_0xa556('0x30')],qs[_0xa556('0x35')](_0x483475['query']['fields']));_0x5b405c[_0xa556('0x34')]=_0x5b405c[_0xa556('0x34')][_0xa556('0x36')]?_0x5b405c[_0xa556('0x34')]:_0x3c700e[_0xa556('0x30')];if(_0x483475[_0xa556('0x31')]['includeAll']){_0x5b405c['include']=[{'all':!![]}];}_0x5b405c=_['merge']({},_0x5b405c,_0x483475[_0xa556('0x42')]);return db[_0xa556('0x2c')]['find'](_0x5b405c)[_0xa556('0x25')](handleEntityNotFound(_0x48f2dc,null))['then'](respondWithResult(_0x48f2dc,null))[_0xa556('0x46')](handleError(_0x48f2dc,null));};exports[_0xa556('0x48')]=function(_0x213c4d,_0x3cd157){return db['SquareMessage'][_0xa556('0x48')](_0x213c4d[_0xa556('0x49')],{})[_0xa556('0x25')](respondWithResult(_0x3cd157,0xc9))[_0xa556('0x46')](handleError(_0x3cd157,null));};exports[_0xa556('0x24')]=function(_0x64781a,_0x41171c){if(_0x64781a['body']['id']){delete _0x64781a[_0xa556('0x49')]['id'];}return db[_0xa556('0x2c')]['find']({'where':{'id':_0x64781a[_0xa556('0x47')]['id']}})[_0xa556('0x25')](handleEntityNotFound(_0x41171c,null))[_0xa556('0x25')](saveUpdates(_0x64781a['body'],null))[_0xa556('0x25')](respondWithResult(_0x41171c,null))[_0xa556('0x46')](handleError(_0x41171c,null));};exports[_0xa556('0x26')]=function(_0x1256a6,_0x1536eb){return db[_0xa556('0x2c')][_0xa556('0x4a')]({'where':{'id':_0x1256a6[_0xa556('0x47')]['id']}})[_0xa556('0x25')](handleEntityNotFound(_0x1536eb,null))[_0xa556('0x25')](removeEntity(_0x1536eb,null))['catch'](handleError(_0x1536eb,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 75028f1..29be95f 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 _0xddaa=['rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x6905f6,_0x239244){var _0xe43aa=function(_0x4bcd30){while(--_0x4bcd30){_0x6905f6['push'](_0x6905f6['shift']());}};_0xe43aa(++_0x239244);}(_0xddaa,0x101));var _0xadda=function(_0x46b78f,_0x7e0898){_0x46b78f=_0x46b78f-0x0;var _0x4d1702=_0xddaa[_0x46b78f];return _0x4d1702;};'use strict';var _=require(_0xadda('0x0'));var util=require(_0xadda('0x1'));var logger=require(_0xadda('0x2'))('api');var moment=require(_0xadda('0x3'));var BPromise=require(_0xadda('0x4'));var rp=require(_0xadda('0x5'));var fs=require('fs');var path=require(_0xadda('0x6'));var rimraf=require(_0xadda('0x7'));var config=require(_0xadda('0x8'));var attributes=require(_0xadda('0x9'));module['exports']=function(_0x4aada1,_0x5dae82){return _0x4aada1['define'](_0xadda('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9b=['bluebird','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','api','moment'];(function(_0x137f8a,_0x3ac8f8){var _0x35baa8=function(_0x28ef45){while(--_0x28ef45){_0x137f8a['push'](_0x137f8a['shift']());}};_0x35baa8(++_0x3ac8f8);}(_0x8f9b,0xac));var _0xb8f9=function(_0x524461,_0x575f9d){_0x524461=_0x524461-0x0;var _0x1a1d91=_0x8f9b[_0x524461];return _0x1a1d91;};'use strict';var _=require(_0xb8f9('0x0'));var util=require(_0xb8f9('0x1'));var logger=require('../../config/logger')(_0xb8f9('0x2'));var moment=require(_0xb8f9('0x3'));var BPromise=require(_0xb8f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8f9('0x5'));var rimraf=require(_0xb8f9('0x6'));var config=require('../../config/environment');var attributes=require(_0xb8f9('0x7'));module[_0xb8f9('0x8')]=function(_0x179a71,_0x2d5b48){return _0x179a71[_0xb8f9('0x9')](_0xb8f9('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 11c1649..c0d306f 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 _0x82b0=['http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x5b083b,_0x145a9b){var _0x6c2225=function(_0xcc6435){while(--_0xcc6435){_0x5b083b['push'](_0x5b083b['shift']());}};_0x6c2225(++_0x145a9b);}(_0x82b0,0x18c));var _0x082b=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x82b0[_0x235482];return _0x5f5bea;};'use strict';var _=require(_0x082b('0x0'));var util=require('util');var moment=require(_0x082b('0x1'));var BPromise=require(_0x082b('0x2'));var rs=require(_0x082b('0x3'));var fs=require('fs');var Redis=require(_0x082b('0x4'));var db=require(_0x082b('0x5'))['db'];var utils=require(_0x082b('0x6'));var logger=require(_0x082b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x082b('0x8'));var client=jayson[_0x082b('0x9')][_0x082b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44b485,_0x42b5a0,_0x15bb3a){return new BPromise(function(_0x4866d0,_0x3da81e){return client[_0x082b('0xb')](_0x44b485,_0x15bb3a)[_0x082b('0xc')](function(_0x18f9cf){logger[_0x082b('0xd')](_0x082b('0xe'),_0x42b5a0,_0x082b('0xf'));logger[_0x082b('0x10')](_0x082b('0x11'),_0x42b5a0,_0x082b('0xf'),JSON['stringify'](_0x18f9cf));if(_0x18f9cf[_0x082b('0x12')]){if(_0x18f9cf[_0x082b('0x12')]['code']===0x1f4){logger[_0x082b('0x12')]('SquareMessage,\x20%s,\x20%s',_0x42b5a0,_0x18f9cf[_0x082b('0x12')][_0x082b('0x13')]);return _0x3da81e(_0x18f9cf[_0x082b('0x12')]['message']);}logger[_0x082b('0x12')]('SquareMessage,\x20%s,\x20%s',_0x42b5a0,_0x18f9cf[_0x082b('0x12')][_0x082b('0x13')]);return _0x4866d0(_0x18f9cf['error'][_0x082b('0x13')]);}else{logger[_0x082b('0xd')](_0x082b('0xe'),_0x42b5a0,_0x082b('0xf'));_0x4866d0(_0x18f9cf[_0x082b('0x14')][_0x082b('0x13')]);}})[_0x082b('0x15')](function(_0x225d91){logger[_0x082b('0x12')](_0x082b('0xe'),_0x42b5a0,_0x225d91);_0x3da81e(_0x225d91);});});}exports[_0x082b('0x16')]=function(_0x302c8b){var _0x1eab1b=this;return new Promise(function(_0x485afa,_0x598729){return db[_0x082b('0x17')][_0x082b('0x18')](_0x302c8b[_0x082b('0x19')],{'raw':_0x302c8b[_0x082b('0x1a')]?_0x302c8b[_0x082b('0x1a')][_0x082b('0x1b')]===undefined?!![]:![]:!![]})[_0x082b('0xc')](function(_0x149563){logger[_0x082b('0xd')](_0x082b('0x16'),_0x302c8b);logger[_0x082b('0x10')](_0x082b('0x16'),_0x302c8b,JSON[_0x082b('0x1c')](_0x149563));_0x485afa(_0x149563);})[_0x082b('0x15')](function(_0x27ebfd){logger['error'](_0x082b('0x16'),_0x27ebfd[_0x082b('0x13')],_0x302c8b);_0x598729(_0x1eab1b[_0x082b('0x12')](0x1f4,_0x27ebfd['message']));});});}; \ No newline at end of file +var _0x41f1=['result','CreateSquareMessage','SquareMessage','raw','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x41f1,0x126));var _0x141f=function(_0x73c130,_0x5f532f){_0x73c130=_0x73c130-0x0;var _0x3bd9b4=_0x41f1[_0x73c130];return _0x3bd9b4;};'use strict';var _=require(_0x141f('0x0'));var util=require(_0x141f('0x1'));var moment=require(_0x141f('0x2'));var BPromise=require(_0x141f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x141f('0x4'));var db=require(_0x141f('0x5'))['db'];var utils=require(_0x141f('0x6'));var logger=require('../../config/logger')(_0x141f('0x7'));var config=require(_0x141f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x141f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xba4c62,_0x2746f2,_0x3b44ef){return new BPromise(function(_0x461ca8,_0x5dc415){return client[_0x141f('0xa')](_0xba4c62,_0x3b44ef)['then'](function(_0x2b856f){logger[_0x141f('0xb')](_0x141f('0xc'),_0x2746f2,'request\x20sent');logger['debug'](_0x141f('0xd'),_0x2746f2,_0x141f('0xe'),JSON[_0x141f('0xf')](_0x2b856f));if(_0x2b856f['error']){if(_0x2b856f['error']['code']===0x1f4){logger['error'](_0x141f('0xc'),_0x2746f2,_0x2b856f[_0x141f('0x10')][_0x141f('0x11')]);return _0x5dc415(_0x2b856f['error'][_0x141f('0x11')]);}logger[_0x141f('0x10')](_0x141f('0xc'),_0x2746f2,_0x2b856f[_0x141f('0x10')][_0x141f('0x11')]);return _0x461ca8(_0x2b856f[_0x141f('0x10')][_0x141f('0x11')]);}else{logger[_0x141f('0xb')](_0x141f('0xc'),_0x2746f2,_0x141f('0xe'));_0x461ca8(_0x2b856f[_0x141f('0x12')][_0x141f('0x11')]);}})['catch'](function(_0x51b335){logger[_0x141f('0x10')](_0x141f('0xc'),_0x2746f2,_0x51b335);_0x5dc415(_0x51b335);});});}exports[_0x141f('0x13')]=function(_0x5df63f){var _0x431e8a=this;return new Promise(function(_0x583932,_0x293fc9){return db[_0x141f('0x14')]['create'](_0x5df63f['body'],{'raw':_0x5df63f['options']?_0x5df63f['options'][_0x141f('0x15')]===undefined?!![]:![]:!![]})[_0x141f('0x16')](function(_0x4b31d9){logger['info'](_0x141f('0x13'),_0x5df63f);logger['debug'](_0x141f('0x13'),_0x5df63f,JSON[_0x141f('0xf')](_0x4b31d9));_0x583932(_0x4b31d9);})[_0x141f('0x17')](function(_0x9e9ab1){logger[_0x141f('0x10')](_0x141f('0x13'),_0x9e9ab1[_0x141f('0x11')],_0x5df63f);_0x293fc9(_0x431e8a['error'](0x1f4,_0x9e9ab1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c808302..186ddc6 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 _0x1c7f=['update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','15s','test','post','create'];(function(_0x5e2aef,_0x73e9c2){var _0x21e98d=function(_0x3c02cd){while(--_0x3c02cd){_0x5e2aef['push'](_0x5e2aef['shift']());}};_0x21e98d(++_0x73e9c2);}(_0x1c7f,0x97));var _0xf1c7=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x1c7f[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require('multer');var util=require(_0xf1c7('0x0'));var path=require(_0xf1c7('0x1'));var timeout=require('connect-timeout');var express=require(_0xf1c7('0x2'));var router=express['Router']();var fs_extra=require(_0xf1c7('0x3'));var auth=require(_0xf1c7('0x4'));var interaction=require(_0xf1c7('0x5'));var config=require(_0xf1c7('0x6'));var controller=require(_0xf1c7('0x7'));router['get']('/',auth[_0xf1c7('0x8')](),controller[_0xf1c7('0x9')]);router[_0xf1c7('0xa')](_0xf1c7('0xb'),auth[_0xf1c7('0x8')](),controller[_0xf1c7('0xc')]);router['get']('/:id/test',auth[_0xf1c7('0x8')](),timeout(_0xf1c7('0xd')),controller[_0xf1c7('0xe')]);router[_0xf1c7('0xf')]('/',auth[_0xf1c7('0x8')](),controller[_0xf1c7('0x10')]);router['put'](_0xf1c7('0xb'),auth['isAuthenticated'](),controller[_0xf1c7('0x11')]);router[_0xf1c7('0x12')]('/:id',auth[_0xf1c7('0x8')](),controller[_0xf1c7('0x13')]);module[_0xf1c7('0x14')]=router; \ No newline at end of file +var _0xe64c=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','/:id','show','get','/:id/test','15s','test','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe64c,0x167));var _0xce64=function(_0x41b3b9,_0x3b1b25){_0x41b3b9=_0x41b3b9-0x0;var _0x132313=_0xe64c[_0x41b3b9];return _0x132313;};'use strict';var multer=require(_0xce64('0x0'));var util=require(_0xce64('0x1'));var path=require('path');var timeout=require(_0xce64('0x2'));var express=require(_0xce64('0x3'));var router=express[_0xce64('0x4')]();var fs_extra=require(_0xce64('0x5'));var auth=require(_0xce64('0x6'));var interaction=require(_0xce64('0x7'));var config=require(_0xce64('0x8'));var controller=require(_0xce64('0x9'));router['get']('/',auth[_0xce64('0xa')](),controller['index']);router['get'](_0xce64('0xb'),auth[_0xce64('0xa')](),controller[_0xce64('0xc')]);router[_0xce64('0xd')](_0xce64('0xe'),auth[_0xce64('0xa')](),timeout(_0xce64('0xf')),controller[_0xce64('0x10')]);router[_0xce64('0x11')]('/',auth[_0xce64('0xa')](),controller[_0xce64('0x12')]);router[_0xce64('0x13')](_0xce64('0xb'),auth[_0xce64('0xa')](),controller[_0xce64('0x14')]);router[_0xce64('0x15')](_0xce64('0xb'),auth['isAuthenticated'](),controller[_0xce64('0x16')]);module[_0xce64('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f880299..1e83960 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 _0xb9b2=['sequelize','STRING'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0xb9b2,0x13c));var _0x2b9b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xb9b2[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0x2b9b('0x0'));module['exports']={'name':{'type':Sequelize[_0x2b9b('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x2b9b('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc5af=['STRING','exports','name'];(function(_0x2378b3,_0x53dc09){var _0x2e2fcc=function(_0xf3d2e9){while(--_0xf3d2e9){_0x2378b3['push'](_0x2378b3['shift']());}};_0x2e2fcc(++_0x53dc09);}(_0xc5af,0x190));var _0xfc5a=function(_0x4c9ad2,_0x3bb687){_0x4c9ad2=_0x4c9ad2-0x0;var _0x507886=_0xc5af[_0x4c9ad2];return _0x507886;};'use strict';var Sequelize=require('sequelize');module[_0xfc5a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xfc5a('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xfc5a('0x2')]},'description':{'type':Sequelize[_0xfc5a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e044d64..efda422 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 _0x29ea=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','ODBC','UserProfileResource','then','end','stack','rawAttributes','fieldName','key','map','name','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareOdbc','includeAll','findAll','rows','catch','show','params','keys','intersection','include','find','create','body','user','get','role','UserProfileSection','autoAssociation','error','test','dsn','closeSync','fast-json-patch','bluebird'];(function(_0x5676d3,_0x582062){var _0x573736=function(_0x3760bc){while(--_0x3760bc){_0x5676d3['push'](_0x5676d3['shift']());}};_0x573736(++_0x582062);}(_0x29ea,0x14a));var _0xa29e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x29ea[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa29e('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa29e('0x1'));var Mustache=require(_0xa29e('0x2'));var util=require('util');var path=require(_0xa29e('0x3'));var sox=require(_0xa29e('0x4'));var csv=require(_0xa29e('0x5'));var ejs=require(_0xa29e('0x6'));var fs=require('fs');var fs_extra=require(_0xa29e('0x7'));var _=require(_0xa29e('0x8'));var squel=require(_0xa29e('0x9'));var crypto=require('crypto');var jsforce=require(_0xa29e('0xa'));var deskjs=require(_0xa29e('0xb'));var toCsv=require(_0xa29e('0x5'));var querystring=require(_0xa29e('0xc'));var Papa=require(_0xa29e('0xd'));var Redis=require(_0xa29e('0xe'));var authService=require(_0xa29e('0xf'));var qs=require(_0xa29e('0x10'));var as=require(_0xa29e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa29e('0x12'))(_0xa29e('0x13'));var utils=require(_0xa29e('0x14'));var config=require(_0xa29e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2752cb,_0x1625e1){_0x1625e1=_0x1625e1||0xcc;return function(_0x9346de){if(_0x9346de){return _0x2752cb[_0xa29e('0x16')](_0x1625e1);}return _0x2752cb[_0xa29e('0x17')](_0x1625e1)['end']();};}function respondWithResult(_0x489e00,_0x3f4cb0){_0x3f4cb0=_0x3f4cb0||0xc8;return function(_0xce4f77){if(_0xce4f77){return _0x489e00['status'](_0x3f4cb0)['json'](_0xce4f77);}};}function respondWithFilteredResult(_0x311a69,_0x742958){return function(_0x4265c7){if(_0x4265c7){var _0x1a8b07=typeof _0x742958[_0xa29e('0x18')]===_0xa29e('0x19')&&typeof _0x742958['limit']===_0xa29e('0x19');var _0x645be9=_0x4265c7[_0xa29e('0x1a')];var _0x1dbb81=_0x1a8b07?0x0:_0x742958[_0xa29e('0x18')];var _0x69372e=_0x1a8b07?_0x4265c7[_0xa29e('0x1a')]:_0x742958['offset']+_0x742958[_0xa29e('0x1b')];var _0x1b3377;if(_0x69372e>=_0x645be9){_0x69372e=_0x645be9;_0x1b3377=0xc8;}else{_0x1b3377=0xce;}_0x311a69[_0xa29e('0x17')](_0x1b3377);return _0x311a69[_0xa29e('0x1c')](_0xa29e('0x1d'),_0x1dbb81+'-'+_0x69372e+'/'+_0x645be9)[_0xa29e('0x1e')](_0x4265c7);}return null;};}function patchUpdates(_0x1f86d4){return function(_0x397b4e){try{jsonpatch[_0xa29e('0x1f')](_0x397b4e,_0x1f86d4,!![]);}catch(_0x3a15be){return BPromise[_0xa29e('0x20')](_0x3a15be);}return _0x397b4e['save']();};}function saveUpdates(_0x1ce2c0,_0x464a29){return function(_0x5e0c97){if(_0x5e0c97){return _0x5e0c97[_0xa29e('0x21')](_0x1ce2c0)['then'](function(_0x2995cf){return _0x2995cf;});}return null;};}function removeEntity(_0x25c074,_0x426ecd){return function(_0x4f5c37){if(_0x4f5c37){return _0x4f5c37[_0xa29e('0x22')]()['then'](function(){var _0x440da7=_0x4f5c37['get']({'plain':!![]});var _0x992cd0=_0xa29e('0x23');return db[_0xa29e('0x24')]['destroy']({'where':{'type':_0x992cd0,'resourceId':_0x440da7['id']}})[_0xa29e('0x25')](function(){return _0x4f5c37;});})[_0xa29e('0x25')](function(){_0x25c074['status'](0xcc)[_0xa29e('0x26')]();});}};}function handleEntityNotFound(_0xf9119a,_0x58638b){return function(_0x326abe){if(!_0x326abe){_0xf9119a['sendStatus'](0x194);}return _0x326abe;};}function handleError(_0x560696,_0x45fb84){_0x45fb84=_0x45fb84||0x1f4;return function(_0x54fc04){logger['error'](_0x54fc04[_0xa29e('0x27')]);if(_0x54fc04['name']){delete _0x54fc04['name'];}_0x560696['status'](_0x45fb84)['send'](_0x54fc04);};}exports['index']=function(_0xababe7,_0x51c3da){var _0x84f420={},_0x573dba={},_0x3ddeed={'count':0x0,'rows':[]};var _0x2cd25a=_['map'](db['SquareOdbc'][_0xa29e('0x28')],function(_0x5bd398){return{'name':_0x5bd398[_0xa29e('0x29')],'type':_0x5bd398['type'][_0xa29e('0x2a')]};});_0x573dba['model']=_[_0xa29e('0x2b')](_0x2cd25a,_0xa29e('0x2c'));_0x573dba[_0xa29e('0x2d')]=_['keys'](_0xababe7[_0xa29e('0x2d')]);_0x573dba[_0xa29e('0x2e')]=_['intersection'](_0x573dba[_0xa29e('0x2f')],_0x573dba[_0xa29e('0x2d')]);_0x84f420[_0xa29e('0x30')]=_['intersection'](_0x573dba[_0xa29e('0x2f')],qs[_0xa29e('0x31')](_0xababe7[_0xa29e('0x2d')][_0xa29e('0x31')]));_0x84f420[_0xa29e('0x30')]=_0x84f420[_0xa29e('0x30')][_0xa29e('0x32')]?_0x84f420[_0xa29e('0x30')]:_0x573dba['model'];if(!_0xababe7[_0xa29e('0x2d')][_0xa29e('0x33')](_0xa29e('0x34'))){_0x84f420['limit']=qs[_0xa29e('0x1b')](_0xababe7[_0xa29e('0x2d')][_0xa29e('0x1b')]);_0x84f420[_0xa29e('0x18')]=qs[_0xa29e('0x18')](_0xababe7['query'][_0xa29e('0x18')]);}_0x84f420[_0xa29e('0x35')]=qs['sort'](_0xababe7[_0xa29e('0x2d')][_0xa29e('0x36')]);_0x84f420[_0xa29e('0x37')]=qs[_0xa29e('0x2e')](_[_0xa29e('0x38')](_0xababe7['query'],_0x573dba['filters']),_0x2cd25a);if(_0xababe7['query'][_0xa29e('0x39')]){_0x84f420[_0xa29e('0x37')]=_[_0xa29e('0x3a')](_0x84f420[_0xa29e('0x37')],{'$or':_['map'](_0x2cd25a,function(_0x53e1e9){if(_0x53e1e9['type']!==_0xa29e('0x3b')){var _0x3af61b={};_0x3af61b[_0x53e1e9['name']]={'$like':'%'+_0xababe7[_0xa29e('0x2d')][_0xa29e('0x39')]+'%'};return _0x3af61b;}})});}_0x84f420=_[_0xa29e('0x3a')]({},_0x84f420,_0xababe7[_0xa29e('0x3c')]);var _0x33ad8e={'where':_0x84f420[_0xa29e('0x37')]};return db[_0xa29e('0x3d')][_0xa29e('0x1a')](_0x33ad8e)['then'](function(_0x4b14fc){_0x3ddeed['count']=_0x4b14fc;if(_0xababe7[_0xa29e('0x2d')][_0xa29e('0x3e')]){_0x84f420['include']=[{'all':!![]}];}return db[_0xa29e('0x3d')][_0xa29e('0x3f')](_0x84f420);})[_0xa29e('0x25')](function(_0x13ceb5){_0x3ddeed[_0xa29e('0x40')]=_0x13ceb5;return _0x3ddeed;})[_0xa29e('0x25')](respondWithFilteredResult(_0x51c3da,_0x84f420))[_0xa29e('0x41')](handleError(_0x51c3da,null));};exports[_0xa29e('0x42')]=function(_0x17c310,_0x4a575f){var _0x42e217={'raw':!![],'where':{'id':_0x17c310[_0xa29e('0x43')]['id']}},_0x117f88={};_0x117f88[_0xa29e('0x2f')]=_[_0xa29e('0x44')](db[_0xa29e('0x3d')][_0xa29e('0x28')]);_0x117f88[_0xa29e('0x2d')]=_[_0xa29e('0x44')](_0x17c310[_0xa29e('0x2d')]);_0x117f88['filters']=_[_0xa29e('0x45')](_0x117f88[_0xa29e('0x2f')],_0x117f88[_0xa29e('0x2d')]);_0x42e217['attributes']=_[_0xa29e('0x45')](_0x117f88[_0xa29e('0x2f')],qs['fields'](_0x17c310[_0xa29e('0x2d')][_0xa29e('0x31')]));_0x42e217['attributes']=_0x42e217[_0xa29e('0x30')]['length']?_0x42e217['attributes']:_0x117f88[_0xa29e('0x2f')];if(_0x17c310[_0xa29e('0x2d')][_0xa29e('0x3e')]){_0x42e217[_0xa29e('0x46')]=[{'all':!![]}];}_0x42e217=_['merge']({},_0x42e217,_0x17c310[_0xa29e('0x3c')]);return db['SquareOdbc'][_0xa29e('0x47')](_0x42e217)[_0xa29e('0x25')](handleEntityNotFound(_0x4a575f,null))[_0xa29e('0x25')](respondWithResult(_0x4a575f,null))[_0xa29e('0x41')](handleError(_0x4a575f,null));};exports[_0xa29e('0x48')]=function(_0x53cf87,_0x76122c){return db['SquareOdbc'][_0xa29e('0x48')](_0x53cf87[_0xa29e('0x49')],{})[_0xa29e('0x25')](function(_0x2cb7b6){var _0x2cddc0=_0x53cf87[_0xa29e('0x4a')][_0xa29e('0x4b')]({'plain':!![]});if(!_0x2cddc0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cddc0[_0xa29e('0x4c')]===_0xa29e('0x4a')){var _0x1ab7fa=_0x2cb7b6[_0xa29e('0x4b')]({'plain':!![]});var _0xf30f40='ODBC';return db[_0xa29e('0x4d')][_0xa29e('0x47')]({'where':{'name':_0xf30f40,'userProfileId':_0x2cddc0['userProfileId']},'raw':!![]})[_0xa29e('0x25')](function(_0x5422cc){if(_0x5422cc&&_0x5422cc[_0xa29e('0x4e')]===0x0){return db[_0xa29e('0x24')][_0xa29e('0x48')]({'name':_0x1ab7fa[_0xa29e('0x2c')],'resourceId':_0x1ab7fa['id'],'type':_0x5422cc[_0xa29e('0x2c')],'sectionId':_0x5422cc['id']},{})[_0xa29e('0x25')](function(){return _0x2cb7b6;});}else{return _0x2cb7b6;}})[_0xa29e('0x41')](function(_0x97dba7){logger[_0xa29e('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x97dba7);throw _0x97dba7;});}return _0x2cb7b6;})[_0xa29e('0x25')](respondWithResult(_0x76122c,0xc9))[_0xa29e('0x41')](handleError(_0x76122c,null));};exports[_0xa29e('0x21')]=function(_0x36d0c2,_0x35b491){if(_0x36d0c2['body']['id']){delete _0x36d0c2[_0xa29e('0x49')]['id'];}return db[_0xa29e('0x3d')][_0xa29e('0x47')]({'where':{'id':_0x36d0c2[_0xa29e('0x43')]['id']}})[_0xa29e('0x25')](handleEntityNotFound(_0x35b491,null))['then'](saveUpdates(_0x36d0c2[_0xa29e('0x49')],null))[_0xa29e('0x25')](respondWithResult(_0x35b491,null))[_0xa29e('0x41')](handleError(_0x35b491,null));};exports[_0xa29e('0x22')]=function(_0x127130,_0x30e3a8){return db['SquareOdbc'][_0xa29e('0x47')]({'where':{'id':_0x127130[_0xa29e('0x43')]['id']}})[_0xa29e('0x25')](handleEntityNotFound(_0x30e3a8,null))['then'](removeEntity(_0x30e3a8,null))[_0xa29e('0x41')](handleError(_0x30e3a8,null));};exports[_0xa29e('0x50')]=function(_0x28c9c0,_0x240732,_0x3cf85d){var _0x57af62;return db['SquareOdbc']['find']({'where':{'id':_0x28c9c0[_0xa29e('0x43')]['id']},'attributes':['id',_0xa29e('0x51')]})[_0xa29e('0x25')](handleEntityNotFound(_0x240732,null))[_0xa29e('0x25')](function(_0x2338f8){if(_0x2338f8){var _0x6fc15e=require('odbc')();_0x6fc15e['openSync'](_0x2338f8[_0xa29e('0x51')]);_0x6fc15e[_0xa29e('0x52')]();return _0x2338f8;}})[_0xa29e('0x25')](respondWithResult(_0x240732,null))['catch'](handleError(_0x240732,null));}; \ No newline at end of file +var _0xf5ab=['query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','openSync','dsn','closeSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','name'];(function(_0x1f9460,_0x12ac77){var _0x37d2f0=function(_0x2c016b){while(--_0x2c016b){_0x1f9460['push'](_0x1f9460['shift']());}};_0x37d2f0(++_0x12ac77);}(_0xf5ab,0xd7));var _0xbf5a=function(_0x76bfba,_0xa1469b){_0x76bfba=_0x76bfba-0x0;var _0x508ec2=_0xf5ab[_0x76bfba];return _0x508ec2;};'use strict';var emlformat=require(_0xbf5a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbf5a('0x1'));var rp=require(_0xbf5a('0x2'));var moment=require(_0xbf5a('0x3'));var BPromise=require(_0xbf5a('0x4'));var Mustache=require(_0xbf5a('0x5'));var util=require(_0xbf5a('0x6'));var path=require(_0xbf5a('0x7'));var sox=require(_0xbf5a('0x8'));var csv=require(_0xbf5a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf5a('0xa'));var _=require(_0xbf5a('0xb'));var squel=require(_0xbf5a('0xc'));var crypto=require(_0xbf5a('0xd'));var jsforce=require(_0xbf5a('0xe'));var deskjs=require(_0xbf5a('0xf'));var toCsv=require(_0xbf5a('0x9'));var querystring=require('querystring');var Papa=require(_0xbf5a('0x10'));var Redis=require(_0xbf5a('0x11'));var authService=require(_0xbf5a('0x12'));var qs=require(_0xbf5a('0x13'));var as=require(_0xbf5a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf5a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbf5a('0x16'));var licenseUtil=require(_0xbf5a('0x17'));var db=require(_0xbf5a('0x18'))['db'];function respondWithStatusCode(_0x168149,_0x272e8a){_0x272e8a=_0x272e8a||0xcc;return function(_0x3a3d88){if(_0x3a3d88){return _0x168149[_0xbf5a('0x19')](_0x272e8a);}return _0x168149[_0xbf5a('0x1a')](_0x272e8a)[_0xbf5a('0x1b')]();};}function respondWithResult(_0x10261d,_0x353d54){_0x353d54=_0x353d54||0xc8;return function(_0x4b0138){if(_0x4b0138){return _0x10261d[_0xbf5a('0x1a')](_0x353d54)[_0xbf5a('0x1c')](_0x4b0138);}};}function respondWithFilteredResult(_0x35de67,_0x3c12c2){return function(_0x21330e){if(_0x21330e){var _0x1d320b=typeof _0x3c12c2[_0xbf5a('0x1d')]==='undefined'&&typeof _0x3c12c2['limit']===_0xbf5a('0x1e');var _0x46720c=_0x21330e[_0xbf5a('0x1f')];var _0x68d064=_0x1d320b?0x0:_0x3c12c2['offset'];var _0x234740=_0x1d320b?_0x21330e[_0xbf5a('0x1f')]:_0x3c12c2[_0xbf5a('0x1d')]+_0x3c12c2[_0xbf5a('0x20')];var _0x4ad789;if(_0x234740>=_0x46720c){_0x234740=_0x46720c;_0x4ad789=0xc8;}else{_0x4ad789=0xce;}_0x35de67['status'](_0x4ad789);return _0x35de67[_0xbf5a('0x21')]('Content-Range',_0x68d064+'-'+_0x234740+'/'+_0x46720c)[_0xbf5a('0x1c')](_0x21330e);}return null;};}function patchUpdates(_0x54f809){return function(_0x4ba7d6){try{jsonpatch[_0xbf5a('0x22')](_0x4ba7d6,_0x54f809,!![]);}catch(_0x14297c){return BPromise[_0xbf5a('0x23')](_0x14297c);}return _0x4ba7d6[_0xbf5a('0x24')]();};}function saveUpdates(_0x415cb3,_0x3eaa46){return function(_0x47aa24){if(_0x47aa24){return _0x47aa24[_0xbf5a('0x25')](_0x415cb3)[_0xbf5a('0x26')](function(_0x35995b){return _0x35995b;});}return null;};}function removeEntity(_0x2426a6,_0x2ae135){return function(_0x2d5fbd){if(_0x2d5fbd){return _0x2d5fbd[_0xbf5a('0x27')]()['then'](function(){var _0x525ec5=_0x2d5fbd[_0xbf5a('0x28')]({'plain':!![]});var _0x3be280=_0xbf5a('0x29');return db[_0xbf5a('0x2a')][_0xbf5a('0x27')]({'where':{'type':_0x3be280,'resourceId':_0x525ec5['id']}})[_0xbf5a('0x26')](function(){return _0x2d5fbd;});})['then'](function(){_0x2426a6[_0xbf5a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xffb555,_0x406a64){return function(_0x24960c){if(!_0x24960c){_0xffb555[_0xbf5a('0x19')](0x194);}return _0x24960c;};}function handleError(_0x983150,_0x48fa95){_0x48fa95=_0x48fa95||0x1f4;return function(_0x49d42a){logger[_0xbf5a('0x2b')](_0x49d42a[_0xbf5a('0x2c')]);if(_0x49d42a['name']){delete _0x49d42a['name'];}_0x983150['status'](_0x48fa95)[_0xbf5a('0x2d')](_0x49d42a);};}exports[_0xbf5a('0x2e')]=function(_0x1c60cf,_0xc8c2c3){var _0x27e69b={},_0x430375={},_0x445fb4={'count':0x0,'rows':[]};var _0x2e0108=_[_0xbf5a('0x2f')](db[_0xbf5a('0x30')][_0xbf5a('0x31')],function(_0x437616){return{'name':_0x437616[_0xbf5a('0x32')],'type':_0x437616[_0xbf5a('0x33')][_0xbf5a('0x34')]};});_0x430375[_0xbf5a('0x35')]=_[_0xbf5a('0x2f')](_0x2e0108,_0xbf5a('0x36'));_0x430375[_0xbf5a('0x37')]=_[_0xbf5a('0x38')](_0x1c60cf[_0xbf5a('0x37')]);_0x430375['filters']=_[_0xbf5a('0x39')](_0x430375[_0xbf5a('0x35')],_0x430375[_0xbf5a('0x37')]);_0x27e69b['attributes']=_[_0xbf5a('0x39')](_0x430375[_0xbf5a('0x35')],qs['fields'](_0x1c60cf[_0xbf5a('0x37')][_0xbf5a('0x3a')]));_0x27e69b[_0xbf5a('0x3b')]=_0x27e69b[_0xbf5a('0x3b')][_0xbf5a('0x3c')]?_0x27e69b[_0xbf5a('0x3b')]:_0x430375[_0xbf5a('0x35')];if(!_0x1c60cf[_0xbf5a('0x37')]['hasOwnProperty'](_0xbf5a('0x3d'))){_0x27e69b['limit']=qs[_0xbf5a('0x20')](_0x1c60cf[_0xbf5a('0x37')][_0xbf5a('0x20')]);_0x27e69b[_0xbf5a('0x1d')]=qs[_0xbf5a('0x1d')](_0x1c60cf[_0xbf5a('0x37')][_0xbf5a('0x1d')]);}_0x27e69b[_0xbf5a('0x3e')]=qs[_0xbf5a('0x3f')](_0x1c60cf[_0xbf5a('0x37')]['sort']);_0x27e69b[_0xbf5a('0x40')]=qs[_0xbf5a('0x41')](_[_0xbf5a('0x42')](_0x1c60cf[_0xbf5a('0x37')],_0x430375[_0xbf5a('0x41')]),_0x2e0108);if(_0x1c60cf['query'][_0xbf5a('0x43')]){_0x27e69b[_0xbf5a('0x40')]=_[_0xbf5a('0x44')](_0x27e69b[_0xbf5a('0x40')],{'$or':_[_0xbf5a('0x2f')](_0x2e0108,function(_0x41c798){if(_0x41c798[_0xbf5a('0x33')]!==_0xbf5a('0x45')){var _0x306afd={};_0x306afd[_0x41c798['name']]={'$like':'%'+_0x1c60cf[_0xbf5a('0x37')][_0xbf5a('0x43')]+'%'};return _0x306afd;}})});}_0x27e69b=_['merge']({},_0x27e69b,_0x1c60cf[_0xbf5a('0x46')]);var _0x148acb={'where':_0x27e69b[_0xbf5a('0x40')]};return db[_0xbf5a('0x30')][_0xbf5a('0x1f')](_0x148acb)[_0xbf5a('0x26')](function(_0x5e9a84){_0x445fb4[_0xbf5a('0x1f')]=_0x5e9a84;if(_0x1c60cf[_0xbf5a('0x37')][_0xbf5a('0x47')]){_0x27e69b[_0xbf5a('0x48')]=[{'all':!![]}];}return db['SquareOdbc'][_0xbf5a('0x49')](_0x27e69b);})['then'](function(_0xb1302b){_0x445fb4[_0xbf5a('0x4a')]=_0xb1302b;return _0x445fb4;})[_0xbf5a('0x26')](respondWithFilteredResult(_0xc8c2c3,_0x27e69b))['catch'](handleError(_0xc8c2c3,null));};exports['show']=function(_0x118792,_0x53e161){var _0x199f49={'raw':!![],'where':{'id':_0x118792['params']['id']}},_0x5ef445={};_0x5ef445['model']=_[_0xbf5a('0x38')](db[_0xbf5a('0x30')][_0xbf5a('0x31')]);_0x5ef445[_0xbf5a('0x37')]=_['keys'](_0x118792['query']);_0x5ef445['filters']=_[_0xbf5a('0x39')](_0x5ef445['model'],_0x5ef445[_0xbf5a('0x37')]);_0x199f49[_0xbf5a('0x3b')]=_[_0xbf5a('0x39')](_0x5ef445['model'],qs[_0xbf5a('0x3a')](_0x118792[_0xbf5a('0x37')][_0xbf5a('0x3a')]));_0x199f49[_0xbf5a('0x3b')]=_0x199f49[_0xbf5a('0x3b')][_0xbf5a('0x3c')]?_0x199f49[_0xbf5a('0x3b')]:_0x5ef445[_0xbf5a('0x35')];if(_0x118792[_0xbf5a('0x37')]['includeAll']){_0x199f49[_0xbf5a('0x48')]=[{'all':!![]}];}_0x199f49=_[_0xbf5a('0x44')]({},_0x199f49,_0x118792[_0xbf5a('0x46')]);return db[_0xbf5a('0x30')][_0xbf5a('0x4b')](_0x199f49)[_0xbf5a('0x26')](handleEntityNotFound(_0x53e161,null))['then'](respondWithResult(_0x53e161,null))[_0xbf5a('0x4c')](handleError(_0x53e161,null));};exports[_0xbf5a('0x4d')]=function(_0xaf7252,_0x5b102d){return db[_0xbf5a('0x30')][_0xbf5a('0x4d')](_0xaf7252[_0xbf5a('0x4e')],{})[_0xbf5a('0x26')](function(_0x1d36fa){var _0x185346=_0xaf7252['user']['get']({'plain':!![]});if(!_0x185346)throw new Error(_0xbf5a('0x4f'));if(_0x185346[_0xbf5a('0x50')]==='user'){var _0x1c3dae=_0x1d36fa[_0xbf5a('0x28')]({'plain':!![]});var _0x15bee6=_0xbf5a('0x29');return db[_0xbf5a('0x51')][_0xbf5a('0x4b')]({'where':{'name':_0x15bee6,'userProfileId':_0x185346[_0xbf5a('0x52')]},'raw':!![]})[_0xbf5a('0x26')](function(_0x303ff7){if(_0x303ff7&&_0x303ff7[_0xbf5a('0x53')]===0x0){return db[_0xbf5a('0x2a')]['create']({'name':_0x1c3dae[_0xbf5a('0x36')],'resourceId':_0x1c3dae['id'],'type':_0x303ff7[_0xbf5a('0x36')],'sectionId':_0x303ff7['id']},{})[_0xbf5a('0x26')](function(){return _0x1d36fa;});}else{return _0x1d36fa;}})[_0xbf5a('0x4c')](function(_0x5ca636){logger[_0xbf5a('0x2b')](_0xbf5a('0x54'),_0x5ca636);throw _0x5ca636;});}return _0x1d36fa;})['then'](respondWithResult(_0x5b102d,0xc9))['catch'](handleError(_0x5b102d,null));};exports['update']=function(_0x54e1e6,_0x27800f){if(_0x54e1e6[_0xbf5a('0x4e')]['id']){delete _0x54e1e6[_0xbf5a('0x4e')]['id'];}return db[_0xbf5a('0x30')][_0xbf5a('0x4b')]({'where':{'id':_0x54e1e6[_0xbf5a('0x55')]['id']}})[_0xbf5a('0x26')](handleEntityNotFound(_0x27800f,null))[_0xbf5a('0x26')](saveUpdates(_0x54e1e6['body'],null))[_0xbf5a('0x26')](respondWithResult(_0x27800f,null))['catch'](handleError(_0x27800f,null));};exports[_0xbf5a('0x27')]=function(_0xb971c4,_0x34ef7f){return db[_0xbf5a('0x30')][_0xbf5a('0x4b')]({'where':{'id':_0xb971c4['params']['id']}})[_0xbf5a('0x26')](handleEntityNotFound(_0x34ef7f,null))['then'](removeEntity(_0x34ef7f,null))[_0xbf5a('0x4c')](handleError(_0x34ef7f,null));};exports[_0xbf5a('0x56')]=function(_0x3320ae,_0x5b2a8a,_0x16436e){var _0x33a993;return db[_0xbf5a('0x30')][_0xbf5a('0x4b')]({'where':{'id':_0x3320ae[_0xbf5a('0x55')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x5b2a8a,null))[_0xbf5a('0x26')](function(_0x516318){if(_0x516318){var _0x2f979f=require('odbc')();_0x2f979f[_0xbf5a('0x57')](_0x516318[_0xbf5a('0x58')]);_0x2f979f[_0xbf5a('0x59')]();return _0x516318;}})[_0xbf5a('0x26')](respondWithResult(_0x5b2a8a,null))['catch'](handleError(_0x5b2a8a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f3da6eb..f8852a0 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 _0x55e5=['moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','util','../../config/logger','api'];(function(_0x30bb57,_0x4ed3d8){var _0x5ad26c=function(_0x1ede46){while(--_0x1ede46){_0x30bb57['push'](_0x30bb57['shift']());}};_0x5ad26c(++_0x4ed3d8);}(_0x55e5,0x81));var _0x555e=function(_0x545e52,_0x46a243){_0x545e52=_0x545e52-0x0;var _0x24a6a0=_0x55e5[_0x545e52];return _0x24a6a0;};'use strict';var _=require('lodash');var util=require(_0x555e('0x0'));var logger=require(_0x555e('0x1'))(_0x555e('0x2'));var moment=require(_0x555e('0x3'));var BPromise=require('bluebird');var rp=require(_0x555e('0x4'));var fs=require('fs');var path=require(_0x555e('0x5'));var rimraf=require(_0x555e('0x6'));var config=require(_0x555e('0x7'));var attributes=require(_0x555e('0x8'));module['exports']=function(_0x18d449,_0x10a16c){return _0x18d449[_0x555e('0x9')](_0x555e('0xa'),attributes,{'tableName':_0x555e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3486=['define','square_odbc','../../config/logger','moment','bluebird','path','./squareOdbc.attributes','exports'];(function(_0x41885c,_0x594374){var _0x3ac698=function(_0x2e00b9){while(--_0x2e00b9){_0x41885c['push'](_0x41885c['shift']());}};_0x3ac698(++_0x594374);}(_0x3486,0xa2));var _0x6348=function(_0x22ed4b,_0x20609c){_0x22ed4b=_0x22ed4b-0x0;var _0x4e9cf6=_0x3486[_0x22ed4b];return _0x4e9cf6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6348('0x0'))('api');var moment=require(_0x6348('0x1'));var BPromise=require(_0x6348('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6348('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6348('0x4'));module[_0x6348('0x5')]=function(_0x13c666,_0x1b923b){return _0x13c666[_0x6348('0x6')]('SquareOdbc',attributes,{'tableName':_0x6348('0x7'),'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 c6b81d3..50e231e 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 _0xa759=['SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','SquareOdbc,\x20%s,\x20%s','catch','ShowSquareOdbc','SquareOdbc','options','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent'];(function(_0x3354d7,_0x5d00d7){var _0x1d548a=function(_0x52e89d){while(--_0x52e89d){_0x3354d7['push'](_0x3354d7['shift']());}};_0x1d548a(++_0x5d00d7);}(_0xa759,0x65));var _0x9a75=function(_0xb17208,_0x16f568){_0xb17208=_0xb17208-0x0;var _0x160444=_0xa759[_0xb17208];return _0x160444;};'use strict';var _=require(_0x9a75('0x0'));var util=require(_0x9a75('0x1'));var moment=require(_0x9a75('0x2'));var BPromise=require(_0x9a75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a75('0x4'));var db=require(_0x9a75('0x5'))['db'];var utils=require(_0x9a75('0x6'));var logger=require(_0x9a75('0x7'))(_0x9a75('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a75('0x9')][_0x9a75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x580ec5,_0x35e969,_0x2d36d3){return new BPromise(function(_0x3ca580,_0x2171ee){return client[_0x9a75('0xb')](_0x580ec5,_0x2d36d3)[_0x9a75('0xc')](function(_0x1f382e){logger[_0x9a75('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x35e969,_0x9a75('0xe'));logger['debug'](_0x9a75('0xf'),_0x35e969,'request\x20sent',JSON['stringify'](_0x1f382e));if(_0x1f382e['error']){if(_0x1f382e[_0x9a75('0x10')]['code']===0x1f4){logger[_0x9a75('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x35e969,_0x1f382e[_0x9a75('0x10')][_0x9a75('0x11')]);return _0x2171ee(_0x1f382e[_0x9a75('0x10')][_0x9a75('0x11')]);}logger[_0x9a75('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x35e969,_0x1f382e[_0x9a75('0x10')][_0x9a75('0x11')]);return _0x3ca580(_0x1f382e[_0x9a75('0x10')]['message']);}else{logger[_0x9a75('0xd')](_0x9a75('0x12'),_0x35e969,_0x9a75('0xe'));_0x3ca580(_0x1f382e['result'][_0x9a75('0x11')]);}})[_0x9a75('0x13')](function(_0x320459){logger[_0x9a75('0x10')](_0x9a75('0x12'),_0x35e969,_0x320459);_0x2171ee(_0x320459);});});}exports[_0x9a75('0x14')]=function(_0x331562){var _0x4a7319=this;return new Promise(function(_0xaaabe5,_0x3aaf50){return db[_0x9a75('0x15')]['find']({'raw':_0x331562[_0x9a75('0x16')]?_0x331562['options']['raw']===undefined?!![]:![]:!![],'where':_0x331562[_0x9a75('0x16')]?_0x331562['options'][_0x9a75('0x17')]||null:null,'attributes':_0x331562[_0x9a75('0x16')]?_0x331562[_0x9a75('0x16')][_0x9a75('0x18')]||null:null,'include':_0x331562[_0x9a75('0x16')]?_0x331562[_0x9a75('0x16')][_0x9a75('0x19')]?_['map'](_0x331562['options'][_0x9a75('0x19')],function(_0x539e0f){return{'model':db[_0x539e0f[_0x9a75('0x1a')]],'as':_0x539e0f['as'],'attributes':_0x539e0f[_0x9a75('0x18')],'include':_0x539e0f[_0x9a75('0x19')]?_[_0x9a75('0x1b')](_0x539e0f[_0x9a75('0x19')],function(_0x45461e){return{'model':db[_0x45461e[_0x9a75('0x1a')]],'as':_0x45461e['as'],'attributes':_0x45461e[_0x9a75('0x18')],'include':_0x45461e[_0x9a75('0x19')]?_[_0x9a75('0x1b')](_0x45461e['include'],function(_0xe9696d){return{'model':db[_0xe9696d['model']],'as':_0xe9696d['as'],'attributes':_0xe9696d[_0x9a75('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a75('0xc')](function(_0xd5b154){logger[_0x9a75('0xd')]('ShowSquareOdbc',_0x331562);logger['debug'](_0x9a75('0x14'),_0x331562,JSON[_0x9a75('0x1c')](_0xd5b154));_0xaaabe5(_0xd5b154);})[_0x9a75('0x13')](function(_0x23117a){logger['error'](_0x9a75('0x14'),_0x23117a[_0x9a75('0x11')],_0x331562);_0x3aaf50(_0x4a7319['error'](0x1f4,_0x23117a[_0x9a75('0x11')]));});});}; \ No newline at end of file +var _0xb12a=['code','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','map','include','model','debug','stringify','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5000b1,_0x71fbbc){var _0x4205e9=function(_0x800e95){while(--_0x800e95){_0x5000b1['push'](_0x5000b1['shift']());}};_0x4205e9(++_0x71fbbc);}(_0xb12a,0x14e));var _0xab12=function(_0x4c65c0,_0xc33bb0){_0x4c65c0=_0x4c65c0-0x0;var _0x1eb0a0=_0xb12a[_0x4c65c0];return _0x1eb0a0;};'use strict';var _=require(_0xab12('0x0'));var util=require('util');var moment=require(_0xab12('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab12('0x2'))['db'];var utils=require(_0xab12('0x3'));var logger=require(_0xab12('0x4'))(_0xab12('0x5'));var config=require(_0xab12('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xab12('0x7')][_0xab12('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b8dcb,_0x2a80ed,_0x4b8160){return new BPromise(function(_0x4cc517,_0x234654){return client['request'](_0x2b8dcb,_0x4b8160)[_0xab12('0x9')](function(_0x58eea8){logger[_0xab12('0xa')](_0xab12('0xb'),_0x2a80ed,_0xab12('0xc'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x2a80ed,'request\x20sent',JSON['stringify'](_0x58eea8));if(_0x58eea8[_0xab12('0xd')]){if(_0x58eea8[_0xab12('0xd')][_0xab12('0xe')]===0x1f4){logger[_0xab12('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x2a80ed,_0x58eea8[_0xab12('0xd')]['message']);return _0x234654(_0x58eea8['error'][_0xab12('0xf')]);}logger[_0xab12('0xd')](_0xab12('0xb'),_0x2a80ed,_0x58eea8[_0xab12('0xd')][_0xab12('0xf')]);return _0x4cc517(_0x58eea8['error'][_0xab12('0xf')]);}else{logger['info'](_0xab12('0xb'),_0x2a80ed,_0xab12('0xc'));_0x4cc517(_0x58eea8[_0xab12('0x10')][_0xab12('0xf')]);}})['catch'](function(_0x51fbe4){logger['error'](_0xab12('0xb'),_0x2a80ed,_0x51fbe4);_0x234654(_0x51fbe4);});});}exports[_0xab12('0x11')]=function(_0x167dd6){var _0x55a08e=this;return new Promise(function(_0x3915e4,_0x255600){return db[_0xab12('0x12')][_0xab12('0x13')]({'raw':_0x167dd6[_0xab12('0x14')]?_0x167dd6['options']['raw']===undefined?!![]:![]:!![],'where':_0x167dd6[_0xab12('0x14')]?_0x167dd6[_0xab12('0x14')][_0xab12('0x15')]||null:null,'attributes':_0x167dd6[_0xab12('0x14')]?_0x167dd6[_0xab12('0x14')][_0xab12('0x16')]||null:null,'include':_0x167dd6[_0xab12('0x14')]?_0x167dd6['options']['include']?_[_0xab12('0x17')](_0x167dd6[_0xab12('0x14')][_0xab12('0x18')],function(_0x444abf){return{'model':db[_0x444abf['model']],'as':_0x444abf['as'],'attributes':_0x444abf[_0xab12('0x16')],'include':_0x444abf[_0xab12('0x18')]?_[_0xab12('0x17')](_0x444abf[_0xab12('0x18')],function(_0x32082a){return{'model':db[_0x32082a['model']],'as':_0x32082a['as'],'attributes':_0x32082a['attributes'],'include':_0x32082a[_0xab12('0x18')]?_[_0xab12('0x17')](_0x32082a[_0xab12('0x18')],function(_0x40680e){return{'model':db[_0x40680e[_0xab12('0x19')]],'as':_0x40680e['as'],'attributes':_0x40680e['attributes']};}):[]};}):[]};}):[]:[]})[_0xab12('0x9')](function(_0x343d6f){logger['info'](_0xab12('0x11'),_0x167dd6);logger[_0xab12('0x1a')](_0xab12('0x11'),_0x167dd6,JSON[_0xab12('0x1b')](_0x343d6f));_0x3915e4(_0x343d6f);})[_0xab12('0x1c')](function(_0x1cd5cc){logger['error'](_0xab12('0x11'),_0x1cd5cc['message'],_0x167dd6);_0x255600(_0x55a08e['error'](0x1f4,_0x1cd5cc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 79426a4..0e4d7f7 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 _0xa401=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete'];(function(_0x2a7bd0,_0x444e77){var _0x436597=function(_0x50056e){while(--_0x50056e){_0x2a7bd0['push'](_0x2a7bd0['shift']());}};_0x436597(++_0x444e77);}(_0xa401,0x142));var _0x1a40=function(_0x538bdc,_0x2f0281){_0x538bdc=_0x538bdc-0x0;var _0x2c0f2a=_0xa401[_0x538bdc];return _0x2c0f2a;};'use strict';var multer=require(_0x1a40('0x0'));var util=require(_0x1a40('0x1'));var path=require(_0x1a40('0x2'));var timeout=require(_0x1a40('0x3'));var express=require(_0x1a40('0x4'));var router=express[_0x1a40('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1a40('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1a40('0x7'));var controller=require(_0x1a40('0x8'));router['get']('/',auth[_0x1a40('0x9')](),controller[_0x1a40('0xa')]);router[_0x1a40('0xb')]('/:id',auth[_0x1a40('0x9')](),controller['show']);router[_0x1a40('0xc')]('/',auth[_0x1a40('0x9')](),controller[_0x1a40('0xd')]);router[_0x1a40('0xe')](_0x1a40('0xf'),auth[_0x1a40('0x9')](),controller[_0x1a40('0x10')]);router[_0x1a40('0x11')](_0x1a40('0xf'),auth[_0x1a40('0x9')](),controller[_0x1a40('0x12')]);module[_0x1a40('0x13')]=router; \ No newline at end of file +var _0x9ebe=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','put','/:id','update','destroy','exports','multer','util'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x9ebe,0xfd));var _0xe9eb=function(_0x2646a0,_0x360c2d){_0x2646a0=_0x2646a0-0x0;var _0x374392=_0x9ebe[_0x2646a0];return _0x374392;};'use strict';var multer=require(_0xe9eb('0x0'));var util=require(_0xe9eb('0x1'));var path=require(_0xe9eb('0x2'));var timeout=require('connect-timeout');var express=require(_0xe9eb('0x3'));var router=express[_0xe9eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe9eb('0x5'));var interaction=require(_0xe9eb('0x6'));var config=require(_0xe9eb('0x7'));var controller=require('./squareProject.controller');router[_0xe9eb('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9eb('0x9')]);router['get']('/:id',auth[_0xe9eb('0xa')](),controller[_0xe9eb('0xb')]);router['post']('/',auth[_0xe9eb('0xa')](),controller['create']);router[_0xe9eb('0xc')](_0xe9eb('0xd'),auth[_0xe9eb('0xa')](),controller[_0xe9eb('0xe')]);router['delete'](_0xe9eb('0xd'),auth[_0xe9eb('0xa')](),controller[_0xe9eb('0xf')]);module[_0xe9eb('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index b1f9727..d4b238f 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 _0x7847=['toString','utf8','production','DATE','sequelize','exports','name','BLOB','long','preproduction','getDataValue'];(function(_0x136648,_0x2aef53){var _0x5b3352=function(_0x2b41a6){while(--_0x2b41a6){_0x136648['push'](_0x136648['shift']());}};_0x5b3352(++_0x2aef53);}(_0x7847,0xca));var _0x7784=function(_0x20e764,_0x19811d){_0x20e764=_0x20e764-0x0;var _0x4ebc22=_0x7847[_0x20e764];return _0x4ebc22;};'use strict';var Sequelize=require(_0x7784('0x0'));module[_0x7784('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7784('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x7784('0x3')](_0x7784('0x4')),'get':function(){if(this['getDataValue'](_0x7784('0x5'))){return this[_0x7784('0x6')](_0x7784('0x5'))[_0x7784('0x7')](_0x7784('0x8'));}}},'production':{'type':Sequelize[_0x7784('0x3')](_0x7784('0x4')),'get':function(){if(this['getDataValue'](_0x7784('0x9'))){return this[_0x7784('0x6')](_0x7784('0x9'))[_0x7784('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0x7784('0xa')]},'publishedAt':{'type':Sequelize[_0x7784('0xa')]}}; \ No newline at end of file +var _0xcc5f=['getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','BLOB','long'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0xcc5f,0x12f));var _0xfcc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfcc5('0x0'));module[_0xfcc5('0x1')]={'name':{'type':Sequelize[_0xfcc5('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xfcc5('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xfcc5('0x3')](_0xfcc5('0x4')),'get':function(){if(this[_0xfcc5('0x5')](_0xfcc5('0x6'))){return this['getDataValue']('preproduction')[_0xfcc5('0x7')](_0xfcc5('0x8'));}}},'production':{'type':Sequelize[_0xfcc5('0x3')]('long'),'get':function(){if(this[_0xfcc5('0x5')]('production')){return this[_0xfcc5('0x5')](_0xfcc5('0x9'))['toString'](_0xfcc5('0x8'));}}},'savedAt':{'type':Sequelize[_0xfcc5('0xa')]},'publishedAt':{'type':Sequelize[_0xfcc5('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 4347dc2..77e45e4 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 _0x752f=['offset','update','destroy','then','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','params','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','body','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count'];(function(_0x2b4ae1,_0x5caafe){var _0x10fe1a=function(_0x251ec4){while(--_0x251ec4){_0x2b4ae1['push'](_0x2b4ae1['shift']());}};_0x10fe1a(++_0x5caafe);}(_0x752f,0x140));var _0xf752=function(_0x11d5a5,_0x425fe5){_0x11d5a5=_0x11d5a5-0x0;var _0x1ad4e8=_0x752f[_0x11d5a5];return _0x1ad4e8;};'use strict';var _=require(_0xf752('0x0'));var Redis=require(_0xf752('0x1'));var qs=require(_0xf752('0x2'));var logger=require(_0xf752('0x3'))('api');var config=require('../../config/environment');var db=require(_0xf752('0x4'))['db'];config['redis']=_['defaults'](config[_0xf752('0x5')],{'host':_0xf752('0x6'),'port':0x18eb});var socket=require(_0xf752('0x7'))(new Redis(config[_0xf752('0x5')]));require(_0xf752('0x8'))[_0xf752('0x9')](socket);function respondWithResult(_0x598126,_0x14d39f){_0x14d39f=_0x14d39f||0xc8;return function(_0x4e3b96){if(_0x4e3b96){return _0x598126[_0xf752('0xa')](_0x14d39f)[_0xf752('0xb')](_0x4e3b96);}};}function respondWithFilteredResult(_0x1a44f1,_0x52c063){return function(_0x54d285){if(_0x54d285){var _0x48302e=typeof _0x52c063['offset']===_0xf752('0xc')&&typeof _0x52c063[_0xf752('0xd')]===_0xf752('0xc');var _0x5295ab=_0x54d285[_0xf752('0xe')];var _0x35d678=_0x48302e?0x0:_0x52c063[_0xf752('0xf')];var _0x329560=_0x48302e?_0x54d285[_0xf752('0xe')]:_0x52c063[_0xf752('0xf')]+_0x52c063['limit'];var _0xaaa4b9;if(_0x329560>=_0x5295ab){_0x329560=_0x5295ab;_0xaaa4b9=0xc8;}else{_0xaaa4b9=0xce;}_0x1a44f1[_0xf752('0xa')](_0xaaa4b9);return _0x1a44f1['set']('Content-Range',_0x35d678+'-'+_0x329560+'/'+_0x5295ab)['json'](_0x54d285);}return null;};}function saveUpdates(_0x468b2d){return function(_0x422da6){if(_0x422da6){return _0x422da6[_0xf752('0x10')](_0x468b2d)['then'](function(_0x284662){return _0x284662;});}return null;};}function removeEntity(_0x7846a8){return function(_0x2aab89){if(_0x2aab89){return _0x2aab89[_0xf752('0x11')]()[_0xf752('0x12')](function(){var _0x258e14=_0x2aab89['get']({'plain':!![]});var _0x597f4e=_0xf752('0x13');return db[_0xf752('0x14')][_0xf752('0x11')]({'where':{'type':_0x597f4e,'resourceId':_0x258e14['id']}})[_0xf752('0x12')](function(){return _0x2aab89;});})[_0xf752('0x12')](function(){var _0x2d0ff9=new Redis(config[_0xf752('0x5')]);_0x2d0ff9[_0xf752('0x15')]('agi',JSON[_0xf752('0x16')]({'id':_0x2aab89['id'],'deleted':!![]}));})['then'](function(){_0x7846a8[_0xf752('0xa')](0xcc)[_0xf752('0x17')]();});}};}function handleEntityNotFound(_0x1944d8){return function(_0xb11041){if(!_0xb11041){_0x1944d8[_0xf752('0x18')](0x194);}return _0xb11041;};}function handleError(_0x3c22e7,_0x280539){_0x280539=_0x280539||0x1f4;return function(_0x5d02cc){logger[_0xf752('0x19')](_0x5d02cc[_0xf752('0x1a')]);if(_0x5d02cc[_0xf752('0x1b')]){delete _0x5d02cc[_0xf752('0x1b')];}_0x3c22e7[_0xf752('0xa')](_0x280539)[_0xf752('0x1c')](_0x5d02cc);};}exports['index']=function(_0x1f632c,_0x2b2d93){var _0x384d4c={},_0x1dbca4={},_0x11f4e5={'count':0x0,'rows':[]};var _0xbb5d5a=_[_0xf752('0x1d')](db[_0xf752('0x1e')][_0xf752('0x1f')],function(_0x22a478){return{'name':_0x22a478[_0xf752('0x20')],'type':_0x22a478[_0xf752('0x21')][_0xf752('0x22')]};});_0x1dbca4[_0xf752('0x23')]=_[_0xf752('0x1d')](_0xbb5d5a,_0xf752('0x1b'));_0x1dbca4[_0xf752('0x24')]=_[_0xf752('0x25')](_0x1f632c[_0xf752('0x24')]);_0x1dbca4[_0xf752('0x26')]=_[_0xf752('0x27')](_0x1dbca4[_0xf752('0x23')],_0x1dbca4[_0xf752('0x24')]);_0x384d4c['attributes']=_['intersection'](_0x1dbca4[_0xf752('0x23')],qs[_0xf752('0x28')](_0x1f632c[_0xf752('0x24')]['fields']));_0x384d4c[_0xf752('0x29')]=_0x384d4c[_0xf752('0x29')][_0xf752('0x2a')]?_0x384d4c[_0xf752('0x29')]:_0x1dbca4[_0xf752('0x23')];if(!_0x1f632c[_0xf752('0x24')][_0xf752('0x2b')](_0xf752('0x2c'))){_0x384d4c['limit']=qs[_0xf752('0xd')](_0x1f632c['query']['limit']);_0x384d4c[_0xf752('0xf')]=qs[_0xf752('0xf')](_0x1f632c['query'][_0xf752('0xf')]);}_0x384d4c[_0xf752('0x2d')]=qs[_0xf752('0x2e')](_0x1f632c[_0xf752('0x24')][_0xf752('0x2e')]);_0x384d4c[_0xf752('0x2f')]=qs['filters'](_['pick'](_0x1f632c['query'],_0x1dbca4['filters']),_0xbb5d5a);if(_0x1f632c[_0xf752('0x24')][_0xf752('0x30')]){_0x384d4c[_0xf752('0x2f')]=_[_0xf752('0x31')](_0x384d4c[_0xf752('0x2f')],{'$or':_[_0xf752('0x1d')](_0xbb5d5a,function(_0x10d238){if(_0x10d238[_0xf752('0x21')]!==_0xf752('0x32')){var _0x3d018d={};_0x3d018d[_0x10d238['name']]={'$like':'%'+_0x1f632c[_0xf752('0x24')]['filter']+'%'};return _0x3d018d;}})});}_0x384d4c=_[_0xf752('0x31')]({},_0x384d4c,_0x1f632c['options']);var _0x1da063={'where':_0x384d4c['where']};return db[_0xf752('0x1e')][_0xf752('0xe')](_0x1da063)[_0xf752('0x12')](function(_0x20d146){_0x11f4e5['count']=_0x20d146;if(_0x1f632c[_0xf752('0x24')]['includeAll']){_0x384d4c[_0xf752('0x33')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x384d4c);})[_0xf752('0x12')](function(_0x5e6a9b){_0x11f4e5[_0xf752('0x34')]=_0x5e6a9b;return _0x11f4e5;})[_0xf752('0x12')](respondWithFilteredResult(_0x2b2d93,_0x384d4c))[_0xf752('0x35')](handleError(_0x2b2d93,null));};exports['show']=function(_0x52c213,_0x60577e){var _0x3d8d1e={'raw':![],'where':{'id':_0x52c213[_0xf752('0x36')]['id']}},_0x146d82={};_0x146d82[_0xf752('0x23')]=_[_0xf752('0x25')](db[_0xf752('0x1e')]['rawAttributes']);_0x146d82[_0xf752('0x24')]=_[_0xf752('0x25')](_0x52c213['query']);_0x146d82['filters']=_[_0xf752('0x27')](_0x146d82['model'],_0x146d82['query']);_0x3d8d1e[_0xf752('0x29')]=_[_0xf752('0x27')](_0x146d82['model'],qs[_0xf752('0x28')](_0x52c213[_0xf752('0x24')][_0xf752('0x28')]));_0x3d8d1e['attributes']=_0x3d8d1e[_0xf752('0x29')][_0xf752('0x2a')]?_0x3d8d1e[_0xf752('0x29')]:_0x146d82[_0xf752('0x23')];if(_0x52c213[_0xf752('0x24')]['includeAll']){_0x3d8d1e['include']=[{'all':!![]}];}_0x3d8d1e=_[_0xf752('0x31')]({},_0x3d8d1e,_0x52c213[_0xf752('0x37')]);return db[_0xf752('0x1e')][_0xf752('0x38')](_0x3d8d1e)[_0xf752('0x12')](handleEntityNotFound(_0x60577e,null))[_0xf752('0x12')](respondWithResult(_0x60577e,null))[_0xf752('0x35')](handleError(_0x60577e,null));};exports['create']=function(_0x42a739,_0x91dac5){return db['SquareProject']['create'](_0x42a739['body'],{})['then'](function(_0x211751){var _0x770578=_0x42a739[_0xf752('0x39')][_0xf752('0x3a')]({'plain':!![]});if(!_0x770578)throw new Error(_0xf752('0x3b'));if(_0x770578[_0xf752('0x3c')]===_0xf752('0x39')){var _0x3a2235=_0x211751['get']({'plain':!![]});var _0x2fbfbd=_0xf752('0x13');return db[_0xf752('0x3d')][_0xf752('0x38')]({'where':{'name':_0x2fbfbd,'userProfileId':_0x770578[_0xf752('0x3e')]},'raw':!![]})[_0xf752('0x12')](function(_0x5cb652){if(_0x5cb652&&_0x5cb652['autoAssociation']===0x0){return db[_0xf752('0x14')][_0xf752('0x3f')]({'name':_0x3a2235[_0xf752('0x1b')],'resourceId':_0x3a2235['id'],'type':_0x5cb652[_0xf752('0x1b')],'sectionId':_0x5cb652['id']},{})[_0xf752('0x12')](function(){return _0x211751;});}else{return _0x211751;}})[_0xf752('0x35')](function(_0x4c9439){logger[_0xf752('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c9439);throw _0x4c9439;});}return _0x211751;})['then'](respondWithResult(_0x91dac5,0xc9))['catch'](handleError(_0x91dac5,null));};exports[_0xf752('0x10')]=function(_0x3b4f72,_0x41d849){if(_0x3b4f72[_0xf752('0x40')]['id']){delete _0x3b4f72[_0xf752('0x40')]['id'];}return db[_0xf752('0x1e')][_0xf752('0x38')]({'where':{'id':_0x3b4f72['params']['id']}})[_0xf752('0x12')](handleEntityNotFound(_0x41d849,null))[_0xf752('0x12')](saveUpdates(_0x3b4f72['body'],null))[_0xf752('0x12')](function(_0x204979){if(!_0x204979)return;var _0x2af0f0=_0x204979[_0xf752('0x3a')]({'plain':!![]});return _0x2af0f0;})[_0xf752('0x12')](function(_0x2b1598){var _0x14e5f5=new Redis(config[_0xf752('0x5')]);_0x14e5f5[_0xf752('0x15')]('agi',JSON[_0xf752('0x16')](_[_0xf752('0x41')](_0x2b1598,['id',_0xf752('0x1b'),_0xf752('0x42')])));return _0x2b1598;})[_0xf752('0x12')](respondWithResult(_0x41d849,null))[_0xf752('0x35')](handleError(_0x41d849,null));};exports[_0xf752('0x11')]=function(_0x35c309,_0x325bd8){return db[_0xf752('0x1e')][_0xf752('0x38')]({'where':{'id':_0x35c309[_0xf752('0x36')]['id']}})[_0xf752('0x12')](handleEntityNotFound(_0x325bd8,null))[_0xf752('0x12')](removeEntity(_0x325bd8,null))[_0xf752('0x35')](handleError(_0x325bd8,null));}; \ No newline at end of file +var _0xc8e9=['VIRTUAL','filter','options','findAll','rows','show','params','keys','length','includeAll','find','catch','create','body','get','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','undefined','limit','count','offset','status','Content-Range','json','update','destroy','then','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge'];(function(_0x57ffc0,_0x50cc19){var _0x39342a=function(_0x5cbed1){while(--_0x5cbed1){_0x57ffc0['push'](_0x57ffc0['shift']());}};_0x39342a(++_0x50cc19);}(_0xc8e9,0x178));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9c8e('0x0'));var Redis=require('ioredis');var qs=require(_0x9c8e('0x1'));var logger=require(_0x9c8e('0x2'))(_0x9c8e('0x3'));var config=require(_0x9c8e('0x4'));var db=require(_0x9c8e('0x5'))['db'];config[_0x9c8e('0x6')]=_[_0x9c8e('0x7')](config[_0x9c8e('0x6')],{'host':_0x9c8e('0x8'),'port':0x18eb});var socket=require(_0x9c8e('0x9'))(new Redis(config[_0x9c8e('0x6')]));require('./squareProject.socket')[_0x9c8e('0xa')](socket);function respondWithResult(_0x4749a1,_0x531219){_0x531219=_0x531219||0xc8;return function(_0x48cf57){if(_0x48cf57){return _0x4749a1['status'](_0x531219)['json'](_0x48cf57);}};}function respondWithFilteredResult(_0x12ea2a,_0x105eca){return function(_0x14d61f){if(_0x14d61f){var _0x12b310=typeof _0x105eca['offset']===_0x9c8e('0xb')&&typeof _0x105eca[_0x9c8e('0xc')]==='undefined';var _0x473257=_0x14d61f[_0x9c8e('0xd')];var _0x155e22=_0x12b310?0x0:_0x105eca[_0x9c8e('0xe')];var _0x12c39f=_0x12b310?_0x14d61f[_0x9c8e('0xd')]:_0x105eca['offset']+_0x105eca[_0x9c8e('0xc')];var _0x151e44;if(_0x12c39f>=_0x473257){_0x12c39f=_0x473257;_0x151e44=0xc8;}else{_0x151e44=0xce;}_0x12ea2a[_0x9c8e('0xf')](_0x151e44);return _0x12ea2a['set'](_0x9c8e('0x10'),_0x155e22+'-'+_0x12c39f+'/'+_0x473257)[_0x9c8e('0x11')](_0x14d61f);}return null;};}function saveUpdates(_0x5a51c4){return function(_0x19351f){if(_0x19351f){return _0x19351f[_0x9c8e('0x12')](_0x5a51c4)['then'](function(_0x5eb178){return _0x5eb178;});}return null;};}function removeEntity(_0x4d26f4){return function(_0xc8e879){if(_0xc8e879){return _0xc8e879[_0x9c8e('0x13')]()[_0x9c8e('0x14')](function(){var _0x1394e3=_0xc8e879['get']({'plain':!![]});var _0x29983d=_0x9c8e('0x15');return db[_0x9c8e('0x16')][_0x9c8e('0x13')]({'where':{'type':_0x29983d,'resourceId':_0x1394e3['id']}})[_0x9c8e('0x14')](function(){return _0xc8e879;});})['then'](function(){var _0x48686d=new Redis(config[_0x9c8e('0x6')]);_0x48686d[_0x9c8e('0x17')](_0x9c8e('0x18'),JSON[_0x9c8e('0x19')]({'id':_0xc8e879['id'],'deleted':!![]}));})[_0x9c8e('0x14')](function(){_0x4d26f4[_0x9c8e('0xf')](0xcc)[_0x9c8e('0x1a')]();});}};}function handleEntityNotFound(_0x1fb07d){return function(_0x23f7ce){if(!_0x23f7ce){_0x1fb07d[_0x9c8e('0x1b')](0x194);}return _0x23f7ce;};}function handleError(_0x589b91,_0xff7a4b){_0xff7a4b=_0xff7a4b||0x1f4;return function(_0xe244ad){logger[_0x9c8e('0x1c')](_0xe244ad[_0x9c8e('0x1d')]);if(_0xe244ad[_0x9c8e('0x1e')]){delete _0xe244ad['name'];}_0x589b91[_0x9c8e('0xf')](_0xff7a4b)[_0x9c8e('0x1f')](_0xe244ad);};}exports[_0x9c8e('0x20')]=function(_0x4920e2,_0x388945){var _0x4f1b73={},_0x222318={},_0x53ee31={'count':0x0,'rows':[]};var _0x2c199d=_[_0x9c8e('0x21')](db[_0x9c8e('0x22')][_0x9c8e('0x23')],function(_0x3b399f){return{'name':_0x3b399f[_0x9c8e('0x24')],'type':_0x3b399f[_0x9c8e('0x25')][_0x9c8e('0x26')]};});_0x222318[_0x9c8e('0x27')]=_[_0x9c8e('0x21')](_0x2c199d,'name');_0x222318[_0x9c8e('0x28')]=_['keys'](_0x4920e2[_0x9c8e('0x28')]);_0x222318[_0x9c8e('0x29')]=_['intersection'](_0x222318[_0x9c8e('0x27')],_0x222318[_0x9c8e('0x28')]);_0x4f1b73['attributes']=_[_0x9c8e('0x2a')](_0x222318[_0x9c8e('0x27')],qs[_0x9c8e('0x2b')](_0x4920e2[_0x9c8e('0x28')][_0x9c8e('0x2b')]));_0x4f1b73[_0x9c8e('0x2c')]=_0x4f1b73[_0x9c8e('0x2c')]['length']?_0x4f1b73['attributes']:_0x222318[_0x9c8e('0x27')];if(!_0x4920e2[_0x9c8e('0x28')][_0x9c8e('0x2d')]('nolimit')){_0x4f1b73[_0x9c8e('0xc')]=qs[_0x9c8e('0xc')](_0x4920e2[_0x9c8e('0x28')][_0x9c8e('0xc')]);_0x4f1b73[_0x9c8e('0xe')]=qs[_0x9c8e('0xe')](_0x4920e2[_0x9c8e('0x28')][_0x9c8e('0xe')]);}_0x4f1b73[_0x9c8e('0x2e')]=qs[_0x9c8e('0x2f')](_0x4920e2['query']['sort']);_0x4f1b73[_0x9c8e('0x30')]=qs[_0x9c8e('0x29')](_['pick'](_0x4920e2[_0x9c8e('0x28')],_0x222318[_0x9c8e('0x29')]),_0x2c199d);if(_0x4920e2[_0x9c8e('0x28')]['filter']){_0x4f1b73[_0x9c8e('0x30')]=_[_0x9c8e('0x31')](_0x4f1b73[_0x9c8e('0x30')],{'$or':_[_0x9c8e('0x21')](_0x2c199d,function(_0xff5f5){if(_0xff5f5[_0x9c8e('0x25')]!==_0x9c8e('0x32')){var _0x23302b={};_0x23302b[_0xff5f5[_0x9c8e('0x1e')]]={'$like':'%'+_0x4920e2[_0x9c8e('0x28')][_0x9c8e('0x33')]+'%'};return _0x23302b;}})});}_0x4f1b73=_[_0x9c8e('0x31')]({},_0x4f1b73,_0x4920e2[_0x9c8e('0x34')]);var _0x43d25b={'where':_0x4f1b73[_0x9c8e('0x30')]};return db[_0x9c8e('0x22')][_0x9c8e('0xd')](_0x43d25b)[_0x9c8e('0x14')](function(_0x3be6de){_0x53ee31[_0x9c8e('0xd')]=_0x3be6de;if(_0x4920e2[_0x9c8e('0x28')]['includeAll']){_0x4f1b73['include']=[{'all':!![]}];}return db[_0x9c8e('0x22')][_0x9c8e('0x35')](_0x4f1b73);})[_0x9c8e('0x14')](function(_0x40379d){_0x53ee31[_0x9c8e('0x36')]=_0x40379d;return _0x53ee31;})[_0x9c8e('0x14')](respondWithFilteredResult(_0x388945,_0x4f1b73))['catch'](handleError(_0x388945,null));};exports[_0x9c8e('0x37')]=function(_0x31168e,_0x37a9a1){var _0x4aaec1={'raw':![],'where':{'id':_0x31168e[_0x9c8e('0x38')]['id']}},_0x1df53={};_0x1df53['model']=_[_0x9c8e('0x39')](db[_0x9c8e('0x22')][_0x9c8e('0x23')]);_0x1df53[_0x9c8e('0x28')]=_[_0x9c8e('0x39')](_0x31168e[_0x9c8e('0x28')]);_0x1df53[_0x9c8e('0x29')]=_['intersection'](_0x1df53[_0x9c8e('0x27')],_0x1df53[_0x9c8e('0x28')]);_0x4aaec1[_0x9c8e('0x2c')]=_[_0x9c8e('0x2a')](_0x1df53[_0x9c8e('0x27')],qs[_0x9c8e('0x2b')](_0x31168e['query'][_0x9c8e('0x2b')]));_0x4aaec1[_0x9c8e('0x2c')]=_0x4aaec1[_0x9c8e('0x2c')][_0x9c8e('0x3a')]?_0x4aaec1[_0x9c8e('0x2c')]:_0x1df53[_0x9c8e('0x27')];if(_0x31168e[_0x9c8e('0x28')][_0x9c8e('0x3b')]){_0x4aaec1['include']=[{'all':!![]}];}_0x4aaec1=_[_0x9c8e('0x31')]({},_0x4aaec1,_0x31168e[_0x9c8e('0x34')]);return db['SquareProject'][_0x9c8e('0x3c')](_0x4aaec1)[_0x9c8e('0x14')](handleEntityNotFound(_0x37a9a1,null))[_0x9c8e('0x14')](respondWithResult(_0x37a9a1,null))[_0x9c8e('0x3d')](handleError(_0x37a9a1,null));};exports[_0x9c8e('0x3e')]=function(_0x30ed79,_0x36c5c7){return db['SquareProject'][_0x9c8e('0x3e')](_0x30ed79[_0x9c8e('0x3f')],{})[_0x9c8e('0x14')](function(_0x335525){var _0x159eb0=_0x30ed79['user'][_0x9c8e('0x40')]({'plain':!![]});if(!_0x159eb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x159eb0['role']===_0x9c8e('0x41')){var _0x2e7dd5=_0x335525[_0x9c8e('0x40')]({'plain':!![]});var _0x1c131e=_0x9c8e('0x15');return db[_0x9c8e('0x42')][_0x9c8e('0x3c')]({'where':{'name':_0x1c131e,'userProfileId':_0x159eb0[_0x9c8e('0x43')]},'raw':!![]})[_0x9c8e('0x14')](function(_0x2109b1){if(_0x2109b1&&_0x2109b1[_0x9c8e('0x44')]===0x0){return db[_0x9c8e('0x16')]['create']({'name':_0x2e7dd5[_0x9c8e('0x1e')],'resourceId':_0x2e7dd5['id'],'type':_0x2109b1['name'],'sectionId':_0x2109b1['id']},{})[_0x9c8e('0x14')](function(){return _0x335525;});}else{return _0x335525;}})[_0x9c8e('0x3d')](function(_0x26b445){logger[_0x9c8e('0x1c')](_0x9c8e('0x45'),_0x26b445);throw _0x26b445;});}return _0x335525;})[_0x9c8e('0x14')](respondWithResult(_0x36c5c7,0xc9))[_0x9c8e('0x3d')](handleError(_0x36c5c7,null));};exports['update']=function(_0x13b7cc,_0x3b6666){if(_0x13b7cc[_0x9c8e('0x3f')]['id']){delete _0x13b7cc[_0x9c8e('0x3f')]['id'];}return db[_0x9c8e('0x22')]['find']({'where':{'id':_0x13b7cc[_0x9c8e('0x38')]['id']}})[_0x9c8e('0x14')](handleEntityNotFound(_0x3b6666,null))['then'](saveUpdates(_0x13b7cc[_0x9c8e('0x3f')],null))['then'](function(_0x212468){if(!_0x212468)return;var _0x44556d=_0x212468[_0x9c8e('0x40')]({'plain':!![]});return _0x44556d;})[_0x9c8e('0x14')](function(_0x853e71){var _0x1d6feb=new Redis(config[_0x9c8e('0x6')]);_0x1d6feb[_0x9c8e('0x17')](_0x9c8e('0x18'),JSON['stringify'](_['pick'](_0x853e71,['id','name',_0x9c8e('0x46')])));return _0x853e71;})['then'](respondWithResult(_0x3b6666,null))[_0x9c8e('0x3d')](handleError(_0x3b6666,null));};exports['destroy']=function(_0x3b00f6,_0x2f4b7a){return db['SquareProject']['find']({'where':{'id':_0x3b00f6[_0x9c8e('0x38')]['id']}})[_0x9c8e('0x14')](handleEntityNotFound(_0x2f4b7a,null))['then'](removeEntity(_0x2f4b7a,null))[_0x9c8e('0x3d')](handleError(_0x2f4b7a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index dd00dcb..8bcb65d 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 _0xe890=['events','../../mysqldb','SquareProject','save','update','emit','hook','exports'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xe890,0x188));var _0x0e89=function(_0x2466c9,_0x5e872c){_0x2466c9=_0x2466c9-0x0;var _0x503c9d=_0xe890[_0x2466c9];return _0x503c9d;};'use strict';var EventEmitter=require(_0x0e89('0x0'));var SquareProject=require(_0x0e89('0x1'))['db'][_0x0e89('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e89('0x3'),'afterUpdate':_0x0e89('0x4'),'afterDestroy':'remove'};function emitEvent(_0x17e169){return function(_0xe1a148,_0x24a0c8,_0x5aa3f0){SquareProjectEvents[_0x0e89('0x5')](_0x17e169+':'+_0xe1a148['id'],_0xe1a148);SquareProjectEvents[_0x0e89('0x5')](_0x17e169,_0xe1a148);_0x5aa3f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x0e89('0x6')](e,emitEvent(event));}}module[_0x0e89('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x90a9=['hook','exports','events','SquareProject','save','update','remove','emit','hasOwnProperty'];(function(_0x3dea47,_0x512e8d){var _0x18d67b=function(_0xf95344){while(--_0xf95344){_0x3dea47['push'](_0x3dea47['shift']());}};_0x18d67b(++_0x512e8d);}(_0x90a9,0xb6));var _0x990a=function(_0x12dad2,_0x25d7ea){_0x12dad2=_0x12dad2-0x0;var _0x3699f3=_0x90a9[_0x12dad2];return _0x3699f3;};'use strict';var EventEmitter=require(_0x990a('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x990a('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x990a('0x2'),'afterUpdate':_0x990a('0x3'),'afterDestroy':_0x990a('0x4')};function emitEvent(_0x3195db){return function(_0x15bcf2,_0x22d7f9,_0x2be368){SquareProjectEvents[_0x990a('0x5')](_0x3195db+':'+_0x15bcf2['id'],_0x15bcf2);SquareProjectEvents[_0x990a('0x5')](_0x3195db,_0x15bcf2);_0x2be368(null);};}for(var e in events){if(events[_0x990a('0x6')](e)){var event=events[e];SquareProject[_0x990a('0x7')](e,emitEvent(event));}}module[_0x990a('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 a6f6c1c..3f2b4b2 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 _0x212e=['square_projects','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./squareProject.attributes','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x212e,0x97));var _0xe212=function(_0x3db7ac,_0x4b9b9c){_0x3db7ac=_0x3db7ac-0x0;var _0x390337=_0x212e[_0x3db7ac];return _0x390337;};'use strict';var _=require(_0xe212('0x0'));var util=require(_0xe212('0x1'));var logger=require(_0xe212('0x2'))('api');var moment=require(_0xe212('0x3'));var BPromise=require(_0xe212('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe212('0x5'));var config=require(_0xe212('0x6'));var attributes=require(_0xe212('0x7'));module['exports']=function(_0x268b85,_0x595e1d){return _0x268b85[_0xe212('0x8')]('SquareProject',attributes,{'tableName':_0xe212('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12683e,_0x2a7a39,_0x47bf22){if(_0x12683e[_0xe212('0xa')](_0xe212('0xb'))){_0x12683e['savedAt']=moment()[_0xe212('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x12683e['changed'](_0xe212('0xd'))){_0x12683e[_0xe212('0xe')]=moment()[_0xe212('0xc')](_0xe212('0xf'));}_0x47bf22(null,_0x12683e);}}});}; \ No newline at end of file +var _0x626b=['../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','preproduction','savedAt','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x626b,0x12c));var _0xb626=function(_0xa05f4f,_0x2f3ebe){_0xa05f4f=_0xa05f4f-0x0;var _0x3a3d3b=_0x626b[_0xa05f4f];return _0x3a3d3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb626('0x0'));var moment=require(_0xb626('0x1'));var BPromise=require(_0xb626('0x2'));var rp=require(_0xb626('0x3'));var fs=require('fs');var path=require(_0xb626('0x4'));var rimraf=require(_0xb626('0x5'));var config=require(_0xb626('0x6'));var attributes=require(_0xb626('0x7'));module[_0xb626('0x8')]=function(_0x1b0417,_0x4ff967){return _0x1b0417[_0xb626('0x9')]('SquareProject',attributes,{'tableName':_0xb626('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x194dab,_0x58ef5f,_0x2ba9bf){if(_0x194dab[_0xb626('0xb')](_0xb626('0xc'))){_0x194dab[_0xb626('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x194dab[_0xb626('0xb')]('production')){_0x194dab[_0xb626('0xe')]=moment()[_0xb626('0xf')](_0xb626('0x10'));}_0x2ba9bf(null,_0x194dab);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 38374b6..9ce90a7 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 _0x3a08=['find','debug','stringify','lodash','../../mysqldb','rpc','redis','defaults','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetSquareProjects','catch','error','message','ShowSquareProject'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3a08,0xe3));var _0x83a0=function(_0x3d3b0a,_0x409c4b){_0x3d3b0a=_0x3d3b0a-0x0;var _0x16dff1=_0x3a08[_0x3d3b0a];return _0x16dff1;};'use strict';var _=require(_0x83a0('0x0'));var Redis=require('ioredis');var db=require(_0x83a0('0x1'))['db'];var logger=require('../../config/logger')(_0x83a0('0x2'));var config=require('../../config/environment');config[_0x83a0('0x3')]=_[_0x83a0('0x4')](config[_0x83a0('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0x83a0('0x5'))(new Redis(config[_0x83a0('0x3')]));require(_0x83a0('0x6'))[_0x83a0('0x7')](socket);exports['GetSquareProjects']=function(_0x3d26b9){var _0x880821=this;return new Promise(function(_0x386853,_0x409947){return db[_0x83a0('0x8')][_0x83a0('0x9')]({'raw':_0x3d26b9[_0x83a0('0xa')]?_0x3d26b9[_0x83a0('0xa')][_0x83a0('0xb')]===undefined?!![]:![]:!![],'where':_0x3d26b9[_0x83a0('0xa')]?_0x3d26b9['options'][_0x83a0('0xc')]||null:null,'attributes':_0x3d26b9[_0x83a0('0xa')]?_0x3d26b9[_0x83a0('0xa')][_0x83a0('0xd')]||null:null,'limit':_0x3d26b9['options']?_0x3d26b9[_0x83a0('0xa')][_0x83a0('0xe')]||null:null,'include':_0x3d26b9['options']?_0x3d26b9['options'][_0x83a0('0xf')]?_[_0x83a0('0x10')](_0x3d26b9[_0x83a0('0xa')][_0x83a0('0xf')],function(_0x19b913){return{'model':db[_0x19b913['model']],'as':_0x19b913['as'],'attributes':_0x19b913['attributes'],'include':_0x19b913['include']?_['map'](_0x19b913[_0x83a0('0xf')],function(_0x2d43cf){return{'model':db[_0x2d43cf['model']],'as':_0x2d43cf['as'],'attributes':_0x2d43cf[_0x83a0('0xd')],'include':_0x2d43cf[_0x83a0('0xf')]?_[_0x83a0('0x10')](_0x2d43cf['include'],function(_0x3083c1){return{'model':db[_0x3083c1[_0x83a0('0x11')]],'as':_0x3083c1['as'],'attributes':_0x3083c1[_0x83a0('0xd')]};}):[]};}):[]};}):[]:[]})[_0x83a0('0x12')](function(_0x19fced){logger[_0x83a0('0x13')]('GetSquareProjects',_0x3d26b9);logger['debug'](_0x83a0('0x14'),_0x3d26b9,JSON['stringify'](_0x19fced));_0x386853(_0x19fced);})[_0x83a0('0x15')](function(_0x5622c8){logger[_0x83a0('0x16')]('GetSquareProjects',_0x5622c8[_0x83a0('0x17')],_0x3d26b9);_0x409947(_0x880821[_0x83a0('0x16')](0x1f4,_0x5622c8[_0x83a0('0x17')]));});});};exports[_0x83a0('0x18')]=function(_0x864de0){var _0x1106b8=this;return new Promise(function(_0x21cf7e,_0x295256){return db['SquareProject'][_0x83a0('0x19')]({'raw':_0x864de0[_0x83a0('0xa')]?_0x864de0[_0x83a0('0xa')][_0x83a0('0xb')]===undefined?!![]:![]:!![],'where':_0x864de0[_0x83a0('0xa')]?_0x864de0['options'][_0x83a0('0xc')]||null:null,'attributes':_0x864de0['options']?_0x864de0[_0x83a0('0xa')][_0x83a0('0xd')]||null:null,'include':_0x864de0[_0x83a0('0xa')]?_0x864de0[_0x83a0('0xa')][_0x83a0('0xf')]?_['map'](_0x864de0[_0x83a0('0xa')]['include'],function(_0x3cf537){return{'model':db[_0x3cf537['model']],'as':_0x3cf537['as'],'attributes':_0x3cf537['attributes'],'include':_0x3cf537[_0x83a0('0xf')]?_[_0x83a0('0x10')](_0x3cf537[_0x83a0('0xf')],function(_0x1627f6){return{'model':db[_0x1627f6[_0x83a0('0x11')]],'as':_0x1627f6['as'],'attributes':_0x1627f6[_0x83a0('0xd')],'include':_0x1627f6[_0x83a0('0xf')]?_[_0x83a0('0x10')](_0x1627f6['include'],function(_0x372724){return{'model':db[_0x372724[_0x83a0('0x11')]],'as':_0x372724['as'],'attributes':_0x372724['attributes']};}):[]};}):[]};}):[]:[]})[_0x83a0('0x12')](function(_0x49b711){logger[_0x83a0('0x13')]('ShowSquareProject',_0x864de0);logger[_0x83a0('0x1a')](_0x83a0('0x18'),_0x864de0,JSON[_0x83a0('0x1b')](_0x49b711));_0x21cf7e(_0x49b711);})[_0x83a0('0x15')](function(_0x6c211c){logger['error'](_0x83a0('0x18'),_0x6c211c[_0x83a0('0x17')],_0x864de0);_0x295256(_0x1106b8[_0x83a0('0x16')](0x1f4,_0x6c211c['message']));});});}; \ No newline at end of file +var _0xc3a4=['../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetSquareProjects','options','raw','attributes','include','map','model','info','stringify','catch','error','message','ShowSquareProject','where','then','debug','lodash','ioredis'];(function(_0x471427,_0x230414){var _0x5a5bf7=function(_0x4576f3){while(--_0x4576f3){_0x471427['push'](_0x471427['shift']());}};_0x5a5bf7(++_0x230414);}(_0xc3a4,0x1e4));var _0x4c3a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc3a4[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4c3a('0x0'));var Redis=require(_0x4c3a('0x1'));var db=require(_0x4c3a('0x2'))['db'];var logger=require(_0x4c3a('0x3'))(_0x4c3a('0x4'));var config=require(_0x4c3a('0x5'));config[_0x4c3a('0x6')]=_[_0x4c3a('0x7')](config['redis'],{'host':_0x4c3a('0x8'),'port':0x18eb});var socket=require(_0x4c3a('0x9'))(new Redis(config['redis']));require('./squareProject.socket')[_0x4c3a('0xa')](socket);exports[_0x4c3a('0xb')]=function(_0x596327){var _0xbdca47=this;return new Promise(function(_0x3459b8,_0x1136a5){return db['SquareProject']['findAll']({'raw':_0x596327['options']?_0x596327[_0x4c3a('0xc')][_0x4c3a('0xd')]===undefined?!![]:![]:!![],'where':_0x596327['options']?_0x596327['options']['where']||null:null,'attributes':_0x596327[_0x4c3a('0xc')]?_0x596327[_0x4c3a('0xc')][_0x4c3a('0xe')]||null:null,'limit':_0x596327[_0x4c3a('0xc')]?_0x596327[_0x4c3a('0xc')]['limit']||null:null,'include':_0x596327['options']?_0x596327['options'][_0x4c3a('0xf')]?_[_0x4c3a('0x10')](_0x596327['options'][_0x4c3a('0xf')],function(_0x3f8399){return{'model':db[_0x3f8399[_0x4c3a('0x11')]],'as':_0x3f8399['as'],'attributes':_0x3f8399[_0x4c3a('0xe')],'include':_0x3f8399[_0x4c3a('0xf')]?_['map'](_0x3f8399['include'],function(_0x303914){return{'model':db[_0x303914[_0x4c3a('0x11')]],'as':_0x303914['as'],'attributes':_0x303914[_0x4c3a('0xe')],'include':_0x303914[_0x4c3a('0xf')]?_[_0x4c3a('0x10')](_0x303914[_0x4c3a('0xf')],function(_0xda7f23){return{'model':db[_0xda7f23[_0x4c3a('0x11')]],'as':_0xda7f23['as'],'attributes':_0xda7f23['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x519cab){logger[_0x4c3a('0x12')](_0x4c3a('0xb'),_0x596327);logger['debug'](_0x4c3a('0xb'),_0x596327,JSON[_0x4c3a('0x13')](_0x519cab));_0x3459b8(_0x519cab);})[_0x4c3a('0x14')](function(_0x50508a){logger[_0x4c3a('0x15')]('GetSquareProjects',_0x50508a[_0x4c3a('0x16')],_0x596327);_0x1136a5(_0xbdca47['error'](0x1f4,_0x50508a[_0x4c3a('0x16')]));});});};exports[_0x4c3a('0x17')]=function(_0x5154ff){var _0x5a8af1=this;return new Promise(function(_0x45e009,_0x47a4d2){return db['SquareProject']['find']({'raw':_0x5154ff[_0x4c3a('0xc')]?_0x5154ff[_0x4c3a('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x5154ff[_0x4c3a('0xc')]?_0x5154ff[_0x4c3a('0xc')][_0x4c3a('0x18')]||null:null,'attributes':_0x5154ff['options']?_0x5154ff['options']['attributes']||null:null,'include':_0x5154ff[_0x4c3a('0xc')]?_0x5154ff[_0x4c3a('0xc')][_0x4c3a('0xf')]?_[_0x4c3a('0x10')](_0x5154ff[_0x4c3a('0xc')][_0x4c3a('0xf')],function(_0x496439){return{'model':db[_0x496439[_0x4c3a('0x11')]],'as':_0x496439['as'],'attributes':_0x496439[_0x4c3a('0xe')],'include':_0x496439['include']?_[_0x4c3a('0x10')](_0x496439[_0x4c3a('0xf')],function(_0x176884){return{'model':db[_0x176884[_0x4c3a('0x11')]],'as':_0x176884['as'],'attributes':_0x176884[_0x4c3a('0xe')],'include':_0x176884[_0x4c3a('0xf')]?_[_0x4c3a('0x10')](_0x176884['include'],function(_0x5aed1a){return{'model':db[_0x5aed1a[_0x4c3a('0x11')]],'as':_0x5aed1a['as'],'attributes':_0x5aed1a[_0x4c3a('0xe')]};}):[]};}):[]};}):[]:[]})[_0x4c3a('0x19')](function(_0x22542d){logger[_0x4c3a('0x12')](_0x4c3a('0x17'),_0x5154ff);logger[_0x4c3a('0x1a')](_0x4c3a('0x17'),_0x5154ff,JSON['stringify'](_0x22542d));_0x45e009(_0x22542d);})[_0x4c3a('0x14')](function(_0x332a4f){logger[_0x4c3a('0x15')](_0x4c3a('0x17'),_0x332a4f[_0x4c3a('0x16')],_0x5154ff);_0x47a4d2(_0x5a8af1['error'](0x1f4,_0x332a4f[_0x4c3a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 521e124..0561897 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 _0xd38a=['squareProject:','./squareProject.events','remove','removeListener','register','length'];(function(_0x11160e,_0x9ec802){var _0x36c71c=function(_0x19c2e0){while(--_0x19c2e0){_0x11160e['push'](_0x11160e['shift']());}};_0x36c71c(++_0x9ec802);}(_0xd38a,0x18d));var _0xad38=function(_0x218e1e,_0x3a8521){_0x218e1e=_0x218e1e-0x0;var _0x75b79b=_0xd38a[_0x218e1e];return _0x75b79b;};'use strict';var SquareProjectEvents=require(_0xad38('0x0'));var events=['save',_0xad38('0x1'),'update'];function createListener(_0x21521e,_0xa39690){return function(_0x59e0ce){_0xa39690['emit'](_0x21521e,_0x59e0ce);};}function removeListener(_0x509f59,_0x5f59d1){return function(){SquareProjectEvents[_0xad38('0x2')](_0x509f59,_0x5f59d1);};}exports[_0xad38('0x3')]=function(_0x40e63f){for(var _0x31beb6=0x0,_0x293c0f=events[_0xad38('0x4')];_0x31beb6<_0x293c0f;_0x31beb6++){var _0xbf7f6e=events[_0x31beb6];var _0x343196=createListener(_0xad38('0x5')+_0xbf7f6e,_0x40e63f);SquareProjectEvents['on'](_0xbf7f6e,_0x343196);}}; \ No newline at end of file +var _0x90e8=['remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x189429,_0x57f267){var _0x374239=function(_0x560c84){while(--_0x560c84){_0x189429['push'](_0x189429['shift']());}};_0x374239(++_0x57f267);}(_0x90e8,0xdf));var _0x890e=function(_0x1fc18c,_0x52248e){_0x1fc18c=_0x1fc18c-0x0;var _0x3c3504=_0x90e8[_0x1fc18c];return _0x3c3504;};'use strict';var SquareProjectEvents=require(_0x890e('0x0'));var events=['save',_0x890e('0x1'),_0x890e('0x2')];function createListener(_0x173c6a,_0x4d74e0){return function(_0x5a0f96){_0x4d74e0[_0x890e('0x3')](_0x173c6a,_0x5a0f96);};}function removeListener(_0x3a83c2,_0x36c15a){return function(){SquareProjectEvents[_0x890e('0x4')](_0x3a83c2,_0x36c15a);};}exports[_0x890e('0x5')]=function(_0x18c49d){for(var _0x4b1377=0x0,_0x18625e=events[_0x890e('0x6')];_0x4b1377<_0x18625e;_0x4b1377++){var _0x529a96=events[_0x4b1377];var _0x5a2767=createListener(_0x890e('0x7')+_0x529a96,_0x18c49d);SquareProjectEvents['on'](_0x529a96,_0x5a2767);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 7e951b1..509f336 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1d3888,_0x2226ac){var _0x18304b=function(_0xed80bc){while(--_0xed80bc){_0x1d3888['push'](_0x1d3888['shift']());}};_0x18304b(++_0x2226ac);}(_0x7a54,0x106));var _0x47a5=function(_0x2d87a2,_0x43c3af){_0x2d87a2=_0x2d87a2-0x0;var _0x3c3693=_0x7a54[_0x2d87a2];return _0x3c3693;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x467256,_0x5b895b){var _0x3f9e46=function(_0x4b54e7){while(--_0x4b54e7){_0x467256['push'](_0x467256['shift']());}};_0x3f9e46(++_0x5b895b);}(_0x53ec,0x192));var _0xc53e=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x53ec[_0x15ec4e];return _0xb5e5dd;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 375cb29..8efe7b6 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 _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x445510,_0x171042){var _0x5043a3=function(_0x3f88b0){while(--_0x3f88b0){_0x445510['push'](_0x445510['shift']());}};_0x5043a3(++_0x171042);}(_0x6aa7,0x178));var _0x76aa=function(_0x1e38e0,_0x30fc7b){_0x1e38e0=_0x1e38e0-0x0;var _0x3c8bf2=_0x6aa7[_0x1e38e0];return _0x3c8bf2;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file +var _0x2d17=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d17,0x17e));var _0x72d1=function(_0xdf9b95,_0x56a193){_0xdf9b95=_0xdf9b95-0x0;var _0x3d2845=_0x2d17[_0xdf9b95];return _0x3d2845;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x72d1('0x2')]},'calleridname':{'type':Sequelize[_0x72d1('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x72d1('0x2')]},'priority':{'type':Sequelize[_0x72d1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x72d1('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x72d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x72d1('0x2')]},'format':{'type':Sequelize[_0x72d1('0x3')],'get':function(){var _0x5b40a9='';var _0x477264=this[_0x72d1('0x4')](_0x72d1('0x5'));if(_0x477264){_0x5b40a9=_0x477264['substring'](_0x477264[_0x72d1('0x6')]('.'));}return _0x5b40a9;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index dbf4709..f498a70 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 _0xc116=['SquareRecording','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','unlink','message','destroy','isNil','Entity\x20not\x20found','info','existsSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','error','name','send','map'];(function(_0x49d25b,_0x3c51d8){var _0x3b10b4=function(_0x53ca0b){while(--_0x53ca0b){_0x49d25b['push'](_0x49d25b['shift']());}};_0x3b10b4(++_0x3c51d8);}(_0xc116,0x159));var _0x6c11=function(_0x4b4a75,_0x2ddf5e){_0x4b4a75=_0x4b4a75-0x0;var _0x308f7e=_0xc116[_0x4b4a75];return _0x308f7e;};'use strict';var emlformat=require(_0x6c11('0x0'));var rimraf=require(_0x6c11('0x1'));var zipdir=require(_0x6c11('0x2'));var jsonpatch=require(_0x6c11('0x3'));var rp=require(_0x6c11('0x4'));var moment=require(_0x6c11('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6c11('0x6'));var util=require('util');var path=require(_0x6c11('0x7'));var sox=require(_0x6c11('0x8'));var csv=require(_0x6c11('0x9'));var ejs=require(_0x6c11('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c11('0xb'));var squel=require(_0x6c11('0xc'));var crypto=require('crypto');var jsforce=require(_0x6c11('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c11('0x9'));var querystring=require(_0x6c11('0xe'));var Papa=require(_0x6c11('0xf'));var Redis=require(_0x6c11('0x10'));var authService=require(_0x6c11('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6c11('0x12'));var hardwareService=require(_0x6c11('0x13'));var logger=require('../../config/logger')(_0x6c11('0x14'));var utils=require(_0x6c11('0x15'));var config=require(_0x6c11('0x16'));var licenseUtil=require(_0x6c11('0x17'));var db=require(_0x6c11('0x18'))['db'];function respondWithStatusCode(_0x261572,_0x2df6fd){_0x2df6fd=_0x2df6fd||0xcc;return function(_0x53f93b){if(_0x53f93b){return _0x261572[_0x6c11('0x19')](_0x2df6fd);}return _0x261572[_0x6c11('0x1a')](_0x2df6fd)[_0x6c11('0x1b')]();};}function respondWithResult(_0x5d0840,_0x438839){_0x438839=_0x438839||0xc8;return function(_0x455041){if(_0x455041){return _0x5d0840[_0x6c11('0x1a')](_0x438839)['json'](_0x455041);}};}function respondWithFilteredResult(_0x5ef4b8,_0xa34eee){return function(_0xe93c8f){if(_0xe93c8f){var _0x119fb1=typeof _0xa34eee[_0x6c11('0x1c')]===_0x6c11('0x1d')&&typeof _0xa34eee[_0x6c11('0x1e')]===_0x6c11('0x1d');var _0x1e454d=_0xe93c8f['count'];var _0x5f446b=_0x119fb1?0x0:_0xa34eee['offset'];var _0x4ef8e9=_0x119fb1?_0xe93c8f[_0x6c11('0x1f')]:_0xa34eee['offset']+_0xa34eee[_0x6c11('0x1e')];var _0x2b7255;if(_0x4ef8e9>=_0x1e454d){_0x4ef8e9=_0x1e454d;_0x2b7255=0xc8;}else{_0x2b7255=0xce;}_0x5ef4b8[_0x6c11('0x1a')](_0x2b7255);return _0x5ef4b8[_0x6c11('0x20')](_0x6c11('0x21'),_0x5f446b+'-'+_0x4ef8e9+'/'+_0x1e454d)[_0x6c11('0x22')](_0xe93c8f);}return null;};}function patchUpdates(_0x45d282){return function(_0x86827){try{jsonpatch[_0x6c11('0x23')](_0x86827,_0x45d282,!![]);}catch(_0x1378a4){return BPromise[_0x6c11('0x24')](_0x1378a4);}return _0x86827[_0x6c11('0x25')]();};}function saveUpdates(_0x61e659,_0xb70d76){return function(_0x1f3aac){if(_0x1f3aac){return _0x1f3aac[_0x6c11('0x26')](_0x61e659)['then'](function(_0x4c746a){return _0x4c746a;});}return null;};}function removeEntity(_0x304556,_0x47e22f){return function(_0x39707c){if(_0x39707c){return _0x39707c['destroy']()['then'](function(){_0x304556[_0x6c11('0x1a')](0xcc)[_0x6c11('0x1b')]();});}};}function handleEntityNotFound(_0x2c3c7e,_0x369929){return function(_0x442d32){if(!_0x442d32){_0x2c3c7e[_0x6c11('0x19')](0x194);}return _0x442d32;};}function handleError(_0x40e3bc,_0x5e8e7f){_0x5e8e7f=_0x5e8e7f||0x1f4;return function(_0x508849){logger[_0x6c11('0x27')](_0x508849['stack']);if(_0x508849[_0x6c11('0x28')]){delete _0x508849[_0x6c11('0x28')];}_0x40e3bc[_0x6c11('0x1a')](_0x5e8e7f)[_0x6c11('0x29')](_0x508849);};}exports['index']=function(_0x5da038,_0x43ca66){var _0x10f404={},_0x48899c={},_0x25a699={'count':0x0,'rows':[]};var _0x22b60c=_[_0x6c11('0x2a')](db[_0x6c11('0x2b')]['rawAttributes'],function(_0x3b0a43){return{'name':_0x3b0a43[_0x6c11('0x2c')],'type':_0x3b0a43[_0x6c11('0x2d')]['key']};});_0x48899c[_0x6c11('0x2e')]=_[_0x6c11('0x2a')](_0x22b60c,'name');_0x48899c[_0x6c11('0x2f')]=_[_0x6c11('0x30')](_0x5da038['query']);_0x48899c[_0x6c11('0x31')]=_['intersection'](_0x48899c[_0x6c11('0x2e')],_0x48899c[_0x6c11('0x2f')]);_0x10f404[_0x6c11('0x32')]=_[_0x6c11('0x33')](_0x48899c[_0x6c11('0x2e')],qs[_0x6c11('0x34')](_0x5da038[_0x6c11('0x2f')][_0x6c11('0x34')]));_0x10f404[_0x6c11('0x32')]=_0x10f404[_0x6c11('0x32')][_0x6c11('0x35')]?_0x10f404['attributes']:_0x48899c[_0x6c11('0x2e')];if(!_0x5da038[_0x6c11('0x2f')][_0x6c11('0x36')]('nolimit')){_0x10f404[_0x6c11('0x1e')]=qs[_0x6c11('0x1e')](_0x5da038['query']['limit']);_0x10f404[_0x6c11('0x1c')]=qs[_0x6c11('0x1c')](_0x5da038['query']['offset']);}_0x10f404[_0x6c11('0x37')]=qs[_0x6c11('0x38')](_0x5da038[_0x6c11('0x2f')][_0x6c11('0x38')]);_0x10f404[_0x6c11('0x39')]=qs[_0x6c11('0x31')](_[_0x6c11('0x3a')](_0x5da038[_0x6c11('0x2f')],_0x48899c['filters']),_0x22b60c);if(_0x5da038[_0x6c11('0x2f')][_0x6c11('0x3b')]){_0x10f404[_0x6c11('0x39')]=_['merge'](_0x10f404[_0x6c11('0x39')],{'$or':_[_0x6c11('0x2a')](_0x22b60c,function(_0x2253c9){if(_0x2253c9[_0x6c11('0x2d')]!==_0x6c11('0x3c')){var _0x10cbcc={};_0x10cbcc[_0x2253c9['name']]={'$like':'%'+_0x5da038[_0x6c11('0x2f')]['filter']+'%'};return _0x10cbcc;}})});}_0x10f404=_[_0x6c11('0x3d')]({},_0x10f404,_0x5da038[_0x6c11('0x3e')]);var _0x3618d3={'where':_0x10f404[_0x6c11('0x39')]};return db[_0x6c11('0x2b')][_0x6c11('0x1f')](_0x3618d3)[_0x6c11('0x3f')](function(_0x81b323){_0x25a699[_0x6c11('0x1f')]=_0x81b323;if(_0x5da038[_0x6c11('0x2f')][_0x6c11('0x40')]){_0x10f404[_0x6c11('0x41')]=[{'all':!![]}];}return db[_0x6c11('0x2b')][_0x6c11('0x42')](_0x10f404);})[_0x6c11('0x3f')](function(_0x3136b6){_0x25a699[_0x6c11('0x43')]=_0x3136b6;return _0x25a699;})[_0x6c11('0x3f')](respondWithFilteredResult(_0x43ca66,_0x10f404))[_0x6c11('0x44')](handleError(_0x43ca66,null));};exports[_0x6c11('0x45')]=function(_0x33b203,_0x339f4c){var _0x598fa7={'raw':!![],'where':{'id':_0x33b203['params']['id']}},_0xdcf933={};_0xdcf933[_0x6c11('0x2e')]=_[_0x6c11('0x30')](db['SquareRecording'][_0x6c11('0x46')]);_0xdcf933[_0x6c11('0x2f')]=_[_0x6c11('0x30')](_0x33b203['query']);_0xdcf933[_0x6c11('0x31')]=_[_0x6c11('0x33')](_0xdcf933[_0x6c11('0x2e')],_0xdcf933[_0x6c11('0x2f')]);_0x598fa7[_0x6c11('0x32')]=_[_0x6c11('0x33')](_0xdcf933[_0x6c11('0x2e')],qs[_0x6c11('0x34')](_0x33b203[_0x6c11('0x2f')][_0x6c11('0x34')]));_0x598fa7[_0x6c11('0x32')]=_0x598fa7[_0x6c11('0x32')][_0x6c11('0x35')]?_0x598fa7['attributes']:_0xdcf933[_0x6c11('0x2e')];if(_0x33b203[_0x6c11('0x2f')]['includeAll']){_0x598fa7['include']=[{'all':!![]}];}_0x598fa7=_[_0x6c11('0x3d')]({},_0x598fa7,_0x33b203[_0x6c11('0x3e')]);return db['SquareRecording'][_0x6c11('0x47')](_0x598fa7)[_0x6c11('0x3f')](handleEntityNotFound(_0x339f4c,null))[_0x6c11('0x3f')](respondWithResult(_0x339f4c,null))[_0x6c11('0x44')](handleError(_0x339f4c,null));};exports[_0x6c11('0x48')]=function(_0x1661e2,_0x334eff){return db[_0x6c11('0x2b')][_0x6c11('0x48')](_0x1661e2['body'],{})[_0x6c11('0x3f')](respondWithResult(_0x334eff,0xc9))['catch'](handleError(_0x334eff,null));};exports[_0x6c11('0x26')]=function(_0x40cb0d,_0x16bace){if(_0x40cb0d['body']['id']){delete _0x40cb0d[_0x6c11('0x49')]['id'];}return db[_0x6c11('0x2b')][_0x6c11('0x47')]({'where':{'id':_0x40cb0d[_0x6c11('0x4a')]['id']}})[_0x6c11('0x3f')](handleEntityNotFound(_0x16bace,null))['then'](saveUpdates(_0x40cb0d[_0x6c11('0x49')],null))[_0x6c11('0x3f')](respondWithResult(_0x16bace,null))[_0x6c11('0x44')](handleError(_0x16bace,null));};exports[_0x6c11('0x4b')]=function(_0x26c560,_0x514c10,_0xfb11c6){var _0x4968d9=require(_0x6c11('0x4c'));var _0xfcd624=![];var _0x3d68c6={};if(_0x26c560['query'][_0x6c11('0x2d')]&&_0x26c560[_0x6c11('0x2f')][_0x6c11('0x2d')]===_0x6c11('0x4d')){_0x3d68c6[_0x6c11('0x4d')]=_0x26c560[_0x6c11('0x4a')]['id'];}else{_0x3d68c6['id']=_0x26c560[_0x6c11('0x4a')]['id'];}return db[_0x6c11('0x2b')][_0x6c11('0x47')]({'where':_0x3d68c6,'attributes':['id','savePath',_0x6c11('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x514c10,null))['then'](function(_0x434553){if(_0x434553){var _0x1a7559=_0x434553[_0x6c11('0x4f')];var _0x39a919=util[_0x6c11('0x50')](_0x6c11('0x51'),_0x1a7559);if(fs['existsSync'](_0x39a919)){_0xfcd624=!![];return _0x4968d9[_0x6c11('0x52')](_0x39a919,_0x1a7559,config[_0x6c11('0x53')][_0x6c11('0x54')])['then'](function(){return _0x434553;});}return _0x434553;}})[_0x6c11('0x3f')](function(_0x12bbff){if(_0x12bbff){var _0x5f533b=_0x12bbff[_0x6c11('0x4f')];if(!fs['existsSync'](_0x5f533b)){throw new db[(_0x6c11('0x55'))][(_0x6c11('0x56'))]('SquareRecording\x20not\x20found');}if(_0x12bbff[_0x6c11('0x4e')]){return _0x514c10[_0x6c11('0x4b')](_0x5f533b,_0x12bbff[_0x6c11('0x4e')]+path['extname'](_0x5f533b),function(){if(_0xfcd624){fs[_0x6c11('0x57')](_0x5f533b);}});}else{return _0x514c10[_0x6c11('0x4b')](_0x5f533b,function(_0x2bf2bc){if(_0xfcd624){fs[_0x6c11('0x57')](_0x5f533b);}});}}})[_0x6c11('0x44')](function(_0x446147){if(_0x446147[_0x6c11('0x58')]==='SquareRecording\x20not\x20found'){_0x514c10[_0x6c11('0x1a')](0x194)[_0x6c11('0x29')]('Not\x20found');}else{return handleError(_0x514c10,null);}});};exports[_0x6c11('0x59')]=function(_0x511738,_0x26a491){return db['SquareRecording'][_0x6c11('0x47')]({'where':{'id':_0x511738['params']['id']}})[_0x6c11('0x3f')](function(_0x36d703){if(_[_0x6c11('0x5a')](_0x36d703)){throw new ReferenceError(_0x6c11('0x5b'));}return _0x36d703;})[_0x6c11('0x3f')](function(_0x173471){var _0xb85115=_0x173471['savePath'];logger[_0x6c11('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0xb85115);if(!_['isNil'](_0x173471[_0x6c11('0x4f')])&&fs[_0x6c11('0x5d')](_0xb85115)){logger[_0x6c11('0x5c')]('File:\x20\x22'+_0xb85115+_0x6c11('0x5e'));fs[_0x6c11('0x5f')](_0xb85115);}_0xb85115=_0xb85115+_0x6c11('0x60');if(!_[_0x6c11('0x5a')](_0x173471[_0x6c11('0x4f')])&&fs[_0x6c11('0x5d')](_0xb85115)){logger[_0x6c11('0x5c')]('File:\x20\x22'+_0xb85115+_0x6c11('0x5e'));fs[_0x6c11('0x5f')](_0xb85115);}return _0x173471;})[_0x6c11('0x3f')](function(_0x274e7d){if(!_0x274e7d)throw new InternalError();return _0x274e7d['destroy']();})[_0x6c11('0x3f')](function(){_0x26a491[_0x6c11('0x1a')](0xcc)[_0x6c11('0x1b')]();})[_0x6c11('0x44')](handleError(_0x26a491,null));}; \ No newline at end of file +var _0xfc46=['status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','uniqueid','savePath','filename','existsSync','secrets','recording','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3dedad,_0x435b1f){var _0x5470ba=function(_0x9268c4){while(--_0x9268c4){_0x3dedad['push'](_0x3dedad['shift']());}};_0x5470ba(++_0x435b1f);}(_0xfc46,0x109));var _0x6fc4=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0xfc46[_0x12aaee];return _0x37c350;};'use strict';var emlformat=require(_0x6fc4('0x0'));var rimraf=require(_0x6fc4('0x1'));var zipdir=require(_0x6fc4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fc4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6fc4('0x4'));var path=require(_0x6fc4('0x5'));var sox=require(_0x6fc4('0x6'));var csv=require(_0x6fc4('0x7'));var ejs=require(_0x6fc4('0x8'));var fs=require('fs');var fs_extra=require(_0x6fc4('0x9'));var _=require(_0x6fc4('0xa'));var squel=require(_0x6fc4('0xb'));var crypto=require(_0x6fc4('0xc'));var jsforce=require(_0x6fc4('0xd'));var deskjs=require(_0x6fc4('0xe'));var toCsv=require(_0x6fc4('0x7'));var querystring=require(_0x6fc4('0xf'));var Papa=require(_0x6fc4('0x10'));var Redis=require(_0x6fc4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6fc4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6fc4('0x13'));var config=require(_0x6fc4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fc4('0x15'))['db'];function respondWithStatusCode(_0x3fece7,_0x3c1f34){_0x3c1f34=_0x3c1f34||0xcc;return function(_0x106616){if(_0x106616){return _0x3fece7[_0x6fc4('0x16')](_0x3c1f34);}return _0x3fece7[_0x6fc4('0x17')](_0x3c1f34)['end']();};}function respondWithResult(_0xf382f2,_0x23e3e3){_0x23e3e3=_0x23e3e3||0xc8;return function(_0x10e068){if(_0x10e068){return _0xf382f2[_0x6fc4('0x17')](_0x23e3e3)[_0x6fc4('0x18')](_0x10e068);}};}function respondWithFilteredResult(_0x3368a6,_0x4b66dc){return function(_0x91b400){if(_0x91b400){var _0x437339=typeof _0x4b66dc[_0x6fc4('0x19')]===_0x6fc4('0x1a')&&typeof _0x4b66dc[_0x6fc4('0x1b')]===_0x6fc4('0x1a');var _0x198629=_0x91b400[_0x6fc4('0x1c')];var _0xa7fcc8=_0x437339?0x0:_0x4b66dc[_0x6fc4('0x19')];var _0x4c6a74=_0x437339?_0x91b400[_0x6fc4('0x1c')]:_0x4b66dc[_0x6fc4('0x19')]+_0x4b66dc[_0x6fc4('0x1b')];var _0x185e69;if(_0x4c6a74>=_0x198629){_0x4c6a74=_0x198629;_0x185e69=0xc8;}else{_0x185e69=0xce;}_0x3368a6[_0x6fc4('0x17')](_0x185e69);return _0x3368a6[_0x6fc4('0x1d')](_0x6fc4('0x1e'),_0xa7fcc8+'-'+_0x4c6a74+'/'+_0x198629)[_0x6fc4('0x18')](_0x91b400);}return null;};}function patchUpdates(_0x520671){return function(_0x2dcaa9){try{jsonpatch[_0x6fc4('0x1f')](_0x2dcaa9,_0x520671,!![]);}catch(_0x275f3d){return BPromise['reject'](_0x275f3d);}return _0x2dcaa9[_0x6fc4('0x20')]();};}function saveUpdates(_0x5e19c9,_0x2a77fc){return function(_0x49119f){if(_0x49119f){return _0x49119f[_0x6fc4('0x21')](_0x5e19c9)[_0x6fc4('0x22')](function(_0x37e76d){return _0x37e76d;});}return null;};}function removeEntity(_0x4563c5,_0x558557){return function(_0x576753){if(_0x576753){return _0x576753['destroy']()[_0x6fc4('0x22')](function(){_0x4563c5[_0x6fc4('0x17')](0xcc)[_0x6fc4('0x23')]();});}};}function handleEntityNotFound(_0x1776d5,_0x5ee61a){return function(_0x3619fc){if(!_0x3619fc){_0x1776d5[_0x6fc4('0x16')](0x194);}return _0x3619fc;};}function handleError(_0x4b21e4,_0x81d8a2){_0x81d8a2=_0x81d8a2||0x1f4;return function(_0x337a63){logger['error'](_0x337a63[_0x6fc4('0x24')]);if(_0x337a63[_0x6fc4('0x25')]){delete _0x337a63[_0x6fc4('0x25')];}_0x4b21e4[_0x6fc4('0x17')](_0x81d8a2)[_0x6fc4('0x26')](_0x337a63);};}exports[_0x6fc4('0x27')]=function(_0x5cb1c8,_0x20bf0f){var _0x2f1938={},_0x352ae7={},_0x12957d={'count':0x0,'rows':[]};var _0xf8e71f=_[_0x6fc4('0x28')](db[_0x6fc4('0x29')][_0x6fc4('0x2a')],function(_0x33b289){return{'name':_0x33b289[_0x6fc4('0x2b')],'type':_0x33b289['type'][_0x6fc4('0x2c')]};});_0x352ae7[_0x6fc4('0x2d')]=_[_0x6fc4('0x28')](_0xf8e71f,_0x6fc4('0x25'));_0x352ae7['query']=_[_0x6fc4('0x2e')](_0x5cb1c8[_0x6fc4('0x2f')]);_0x352ae7['filters']=_[_0x6fc4('0x30')](_0x352ae7[_0x6fc4('0x2d')],_0x352ae7['query']);_0x2f1938[_0x6fc4('0x31')]=_['intersection'](_0x352ae7[_0x6fc4('0x2d')],qs[_0x6fc4('0x32')](_0x5cb1c8[_0x6fc4('0x2f')]['fields']));_0x2f1938['attributes']=_0x2f1938[_0x6fc4('0x31')][_0x6fc4('0x33')]?_0x2f1938['attributes']:_0x352ae7['model'];if(!_0x5cb1c8[_0x6fc4('0x2f')][_0x6fc4('0x34')](_0x6fc4('0x35'))){_0x2f1938['limit']=qs[_0x6fc4('0x1b')](_0x5cb1c8[_0x6fc4('0x2f')][_0x6fc4('0x1b')]);_0x2f1938[_0x6fc4('0x19')]=qs[_0x6fc4('0x19')](_0x5cb1c8[_0x6fc4('0x2f')][_0x6fc4('0x19')]);}_0x2f1938[_0x6fc4('0x36')]=qs[_0x6fc4('0x37')](_0x5cb1c8[_0x6fc4('0x2f')][_0x6fc4('0x37')]);_0x2f1938[_0x6fc4('0x38')]=qs[_0x6fc4('0x39')](_[_0x6fc4('0x3a')](_0x5cb1c8[_0x6fc4('0x2f')],_0x352ae7[_0x6fc4('0x39')]),_0xf8e71f);if(_0x5cb1c8[_0x6fc4('0x2f')][_0x6fc4('0x3b')]){_0x2f1938['where']=_[_0x6fc4('0x3c')](_0x2f1938['where'],{'$or':_[_0x6fc4('0x28')](_0xf8e71f,function(_0x1c83ba){if(_0x1c83ba[_0x6fc4('0x3d')]!==_0x6fc4('0x3e')){var _0x3add48={};_0x3add48[_0x1c83ba['name']]={'$like':'%'+_0x5cb1c8[_0x6fc4('0x2f')]['filter']+'%'};return _0x3add48;}})});}_0x2f1938=_[_0x6fc4('0x3c')]({},_0x2f1938,_0x5cb1c8['options']);var _0x245f99={'where':_0x2f1938[_0x6fc4('0x38')]};return db[_0x6fc4('0x29')][_0x6fc4('0x1c')](_0x245f99)[_0x6fc4('0x22')](function(_0x26e41c){_0x12957d[_0x6fc4('0x1c')]=_0x26e41c;if(_0x5cb1c8['query'][_0x6fc4('0x3f')]){_0x2f1938['include']=[{'all':!![]}];}return db['SquareRecording'][_0x6fc4('0x40')](_0x2f1938);})[_0x6fc4('0x22')](function(_0x5148c2){_0x12957d['rows']=_0x5148c2;return _0x12957d;})[_0x6fc4('0x22')](respondWithFilteredResult(_0x20bf0f,_0x2f1938))[_0x6fc4('0x41')](handleError(_0x20bf0f,null));};exports[_0x6fc4('0x42')]=function(_0x26bd6e,_0x3bb285){var _0x44a6ba={'raw':!![],'where':{'id':_0x26bd6e[_0x6fc4('0x43')]['id']}},_0x53d18c={};_0x53d18c['model']=_[_0x6fc4('0x2e')](db[_0x6fc4('0x29')][_0x6fc4('0x2a')]);_0x53d18c[_0x6fc4('0x2f')]=_[_0x6fc4('0x2e')](_0x26bd6e[_0x6fc4('0x2f')]);_0x53d18c['filters']=_[_0x6fc4('0x30')](_0x53d18c[_0x6fc4('0x2d')],_0x53d18c[_0x6fc4('0x2f')]);_0x44a6ba[_0x6fc4('0x31')]=_['intersection'](_0x53d18c['model'],qs[_0x6fc4('0x32')](_0x26bd6e['query'][_0x6fc4('0x32')]));_0x44a6ba[_0x6fc4('0x31')]=_0x44a6ba[_0x6fc4('0x31')]['length']?_0x44a6ba['attributes']:_0x53d18c[_0x6fc4('0x2d')];if(_0x26bd6e[_0x6fc4('0x2f')][_0x6fc4('0x3f')]){_0x44a6ba[_0x6fc4('0x44')]=[{'all':!![]}];}_0x44a6ba=_[_0x6fc4('0x3c')]({},_0x44a6ba,_0x26bd6e[_0x6fc4('0x45')]);return db[_0x6fc4('0x29')][_0x6fc4('0x46')](_0x44a6ba)[_0x6fc4('0x22')](handleEntityNotFound(_0x3bb285,null))['then'](respondWithResult(_0x3bb285,null))[_0x6fc4('0x41')](handleError(_0x3bb285,null));};exports[_0x6fc4('0x47')]=function(_0x1b20be,_0x2de4dc){return db[_0x6fc4('0x29')]['create'](_0x1b20be['body'],{})[_0x6fc4('0x22')](respondWithResult(_0x2de4dc,0xc9))[_0x6fc4('0x41')](handleError(_0x2de4dc,null));};exports[_0x6fc4('0x21')]=function(_0x2a1d94,_0x5a3623){if(_0x2a1d94['body']['id']){delete _0x2a1d94['body']['id'];}return db['SquareRecording']['find']({'where':{'id':_0x2a1d94[_0x6fc4('0x43')]['id']}})[_0x6fc4('0x22')](handleEntityNotFound(_0x5a3623,null))['then'](saveUpdates(_0x2a1d94[_0x6fc4('0x48')],null))[_0x6fc4('0x22')](respondWithResult(_0x5a3623,null))[_0x6fc4('0x41')](handleError(_0x5a3623,null));};exports['download']=function(_0x1462e6,_0x13cbd4,_0x18c2b5){var _0x1980e9=require('../../components/encryptor');var _0x4fbd1d=![];var _0x594d7d={};if(_0x1462e6[_0x6fc4('0x2f')][_0x6fc4('0x3d')]&&_0x1462e6['query'][_0x6fc4('0x3d')]===_0x6fc4('0x49')){_0x594d7d[_0x6fc4('0x49')]=_0x1462e6[_0x6fc4('0x43')]['id'];}else{_0x594d7d['id']=_0x1462e6[_0x6fc4('0x43')]['id'];}return db[_0x6fc4('0x29')][_0x6fc4('0x46')]({'where':_0x594d7d,'attributes':['id',_0x6fc4('0x4a'),_0x6fc4('0x4b')],'raw':!![]})[_0x6fc4('0x22')](handleEntityNotFound(_0x13cbd4,null))[_0x6fc4('0x22')](function(_0xce348e){if(_0xce348e){var _0x381420=_0xce348e[_0x6fc4('0x4a')];var _0x5b7538=util['format']('%s.cypher',_0x381420);if(fs[_0x6fc4('0x4c')](_0x5b7538)){_0x4fbd1d=!![];return _0x1980e9['decryptFile'](_0x5b7538,_0x381420,config[_0x6fc4('0x4d')][_0x6fc4('0x4e')])[_0x6fc4('0x22')](function(){return _0xce348e;});}return _0xce348e;}})[_0x6fc4('0x22')](function(_0x1acd2c){if(_0x1acd2c){var _0x4cd234=_0x1acd2c[_0x6fc4('0x4a')];if(!fs[_0x6fc4('0x4c')](_0x4cd234)){throw new db[(_0x6fc4('0x4f'))][(_0x6fc4('0x50'))]('SquareRecording\x20not\x20found');}if(_0x1acd2c[_0x6fc4('0x4b')]){return _0x13cbd4[_0x6fc4('0x51')](_0x4cd234,_0x1acd2c['filename']+path[_0x6fc4('0x52')](_0x4cd234),function(){if(_0x4fbd1d){fs['unlink'](_0x4cd234);}});}else{return _0x13cbd4['download'](_0x4cd234,function(_0x5178a2){if(_0x4fbd1d){fs[_0x6fc4('0x53')](_0x4cd234);}});}}})[_0x6fc4('0x41')](function(_0x5a1072){if(_0x5a1072[_0x6fc4('0x54')]===_0x6fc4('0x55')){_0x13cbd4[_0x6fc4('0x17')](0x194)['send'](_0x6fc4('0x56'));}else{return handleError(_0x13cbd4,null);}});};exports[_0x6fc4('0x57')]=function(_0x23ad33,_0x4d021c){return db[_0x6fc4('0x29')]['find']({'where':{'id':_0x23ad33[_0x6fc4('0x43')]['id']}})['then'](function(_0x1d166c){if(_[_0x6fc4('0x58')](_0x1d166c)){throw new ReferenceError(_0x6fc4('0x59'));}return _0x1d166c;})[_0x6fc4('0x22')](function(_0x45e881){var _0x16d3c4=_0x45e881[_0x6fc4('0x4a')];logger[_0x6fc4('0x5a')](_0x6fc4('0x5b'),_0x16d3c4);if(!_[_0x6fc4('0x58')](_0x45e881[_0x6fc4('0x4a')])&&fs[_0x6fc4('0x4c')](_0x16d3c4)){logger[_0x6fc4('0x5a')](_0x6fc4('0x5c')+_0x16d3c4+_0x6fc4('0x5d'));fs[_0x6fc4('0x5e')](_0x16d3c4);}_0x16d3c4=_0x16d3c4+_0x6fc4('0x5f');if(!_[_0x6fc4('0x58')](_0x45e881[_0x6fc4('0x4a')])&&fs[_0x6fc4('0x4c')](_0x16d3c4)){logger[_0x6fc4('0x5a')](_0x6fc4('0x5c')+_0x16d3c4+_0x6fc4('0x5d'));fs[_0x6fc4('0x5e')](_0x16d3c4);}return _0x45e881;})[_0x6fc4('0x22')](function(_0x4b3226){if(!_0x4b3226)throw new InternalError();return _0x4b3226['destroy']();})['then'](function(){_0x4d021c[_0x6fc4('0x17')](0xcc)[_0x6fc4('0x23')]();})[_0x6fc4('0x41')](handleError(_0x4d021c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ea30db7..7252ad6 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 _0xe6e9=['define','square_recordings','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports'];(function(_0xe33b12,_0x2a9761){var _0x30699d=function(_0x209952){while(--_0x209952){_0xe33b12['push'](_0xe33b12['shift']());}};_0x30699d(++_0x2a9761);}(_0xe6e9,0x182));var _0x9e6e=function(_0x4c11a9,_0x2056d2){_0x4c11a9=_0x4c11a9-0x0;var _0x326b30=_0xe6e9[_0x4c11a9];return _0x326b30;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var logger=require(_0x9e6e('0x2'))('api');var moment=require(_0x9e6e('0x3'));var BPromise=require(_0x9e6e('0x4'));var rp=require(_0x9e6e('0x5'));var fs=require('fs');var path=require(_0x9e6e('0x6'));var rimraf=require(_0x9e6e('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e6e('0x8'));module[_0x9e6e('0x9')]=function(_0x206572,_0x1e8e5e){return _0x206572[_0x9e6e('0xa')]('SquareRecording',attributes,{'tableName':_0x9e6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f5=['../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x227316,_0x11e02a){var _0x10dca6=function(_0x451b17){while(--_0x451b17){_0x227316['push'](_0x227316['shift']());}};_0x10dca6(++_0x11e02a);}(_0xd2f5,0x144));var _0x5d2f=function(_0x57feb2,_0x531e10){_0x57feb2=_0x57feb2-0x0;var _0x55fa97=_0xd2f5[_0x57feb2];return _0x55fa97;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var logger=require(_0x5d2f('0x1'))('api');var moment=require(_0x5d2f('0x2'));var BPromise=require('bluebird');var rp=require(_0x5d2f('0x3'));var fs=require('fs');var path=require(_0x5d2f('0x4'));var rimraf=require(_0x5d2f('0x5'));var config=require(_0x5d2f('0x6'));var attributes=require(_0x5d2f('0x7'));module[_0x5d2f('0x8')]=function(_0x2392df,_0x16e9fa){return _0x2392df['define'](_0x5d2f('0x9'),attributes,{'tableName':_0x5d2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 3fb8cfb..b3afe4a 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 _0x1517=['error','code','message','SquareRecording,\x20%s,\x20%s','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1517,0xd6));var _0x7151=function(_0x55c947,_0x5e20a8){_0x55c947=_0x55c947-0x0;var _0x2556b3=_0x1517[_0x55c947];return _0x2556b3;};'use strict';var _=require(_0x7151('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7151('0x1'));var rs=require(_0x7151('0x2'));var fs=require('fs');var Redis=require(_0x7151('0x3'));var db=require(_0x7151('0x4'))['db'];var utils=require(_0x7151('0x5'));var logger=require(_0x7151('0x6'))(_0x7151('0x7'));var config=require(_0x7151('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7151('0x9')][_0x7151('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3232b7,_0x288725,_0x28f2c3){return new BPromise(function(_0x4caf48,_0x430924){return client[_0x7151('0xb')](_0x3232b7,_0x28f2c3)[_0x7151('0xc')](function(_0x483187){logger[_0x7151('0xd')]('SquareRecording,\x20%s,\x20%s',_0x288725,_0x7151('0xe'));logger[_0x7151('0xf')](_0x7151('0x10'),_0x288725,'request\x20sent',JSON[_0x7151('0x11')](_0x483187));if(_0x483187['error']){if(_0x483187[_0x7151('0x12')][_0x7151('0x13')]===0x1f4){logger[_0x7151('0x12')]('SquareRecording,\x20%s,\x20%s',_0x288725,_0x483187[_0x7151('0x12')][_0x7151('0x14')]);return _0x430924(_0x483187['error'][_0x7151('0x14')]);}logger[_0x7151('0x12')]('SquareRecording,\x20%s,\x20%s',_0x288725,_0x483187[_0x7151('0x12')][_0x7151('0x14')]);return _0x4caf48(_0x483187[_0x7151('0x12')][_0x7151('0x14')]);}else{logger[_0x7151('0xd')](_0x7151('0x15'),_0x288725,_0x7151('0xe'));_0x4caf48(_0x483187['result'][_0x7151('0x14')]);}})[_0x7151('0x16')](function(_0x49b0e3){logger[_0x7151('0x12')](_0x7151('0x15'),_0x288725,_0x49b0e3);_0x430924(_0x49b0e3);});});}exports['CreateSquareRecording']=function(_0x5ed8c9){var _0xea214b=this;return new Promise(function(_0x185e1f,_0x1c0f72){return db[_0x7151('0x17')][_0x7151('0x18')](_0x5ed8c9[_0x7151('0x19')],{'raw':_0x5ed8c9[_0x7151('0x1a')]?_0x5ed8c9[_0x7151('0x1a')][_0x7151('0x1b')]===undefined?!![]:![]:!![]})[_0x7151('0xc')](function(_0x390ee8){logger[_0x7151('0xd')]('CreateSquareRecording',_0x5ed8c9);logger[_0x7151('0xf')](_0x7151('0x1c'),_0x5ed8c9,JSON[_0x7151('0x11')](_0x390ee8));_0x185e1f(_0x390ee8);})[_0x7151('0x16')](function(_0x40a8b0){logger[_0x7151('0x12')](_0x7151('0x1c'),_0x40a8b0[_0x7151('0x14')],_0x5ed8c9);_0x1c0f72(_0xea214b[_0x7151('0x12')](0x1f4,_0x40a8b0['message']));});});}; \ No newline at end of file +var _0x6b4c=['then','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','SquareRecording,\x20%s,\x20%s','result','catch','SquareRecording','create','body','options','CreateSquareRecording','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2b05e7,_0x17c224){var _0x1ef921=function(_0x55edda){while(--_0x55edda){_0x2b05e7['push'](_0x2b05e7['shift']());}};_0x1ef921(++_0x17c224);}(_0x6b4c,0xb0));var _0xc6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6b4('0x0'));var util=require('util');var moment=require(_0xc6b4('0x1'));var BPromise=require(_0xc6b4('0x2'));var rs=require(_0xc6b4('0x3'));var fs=require('fs');var Redis=require(_0xc6b4('0x4'));var db=require(_0xc6b4('0x5'))['db'];var utils=require(_0xc6b4('0x6'));var logger=require(_0xc6b4('0x7'))(_0xc6b4('0x8'));var config=require(_0xc6b4('0x9'));var jayson=require(_0xc6b4('0xa'));var client=jayson[_0xc6b4('0xb')][_0xc6b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x142861,_0x30516d,_0x52dd34){return new BPromise(function(_0x420c38,_0x368e7c){return client['request'](_0x142861,_0x52dd34)[_0xc6b4('0xd')](function(_0x2a59a9){logger[_0xc6b4('0xe')]('SquareRecording,\x20%s,\x20%s',_0x30516d,_0xc6b4('0xf'));logger['debug'](_0xc6b4('0x10'),_0x30516d,'request\x20sent',JSON['stringify'](_0x2a59a9));if(_0x2a59a9['error']){if(_0x2a59a9[_0xc6b4('0x11')]['code']===0x1f4){logger[_0xc6b4('0x11')]('SquareRecording,\x20%s,\x20%s',_0x30516d,_0x2a59a9[_0xc6b4('0x11')][_0xc6b4('0x12')]);return _0x368e7c(_0x2a59a9[_0xc6b4('0x11')][_0xc6b4('0x12')]);}logger[_0xc6b4('0x11')](_0xc6b4('0x13'),_0x30516d,_0x2a59a9[_0xc6b4('0x11')][_0xc6b4('0x12')]);return _0x420c38(_0x2a59a9[_0xc6b4('0x11')][_0xc6b4('0x12')]);}else{logger[_0xc6b4('0xe')]('SquareRecording,\x20%s,\x20%s',_0x30516d,_0xc6b4('0xf'));_0x420c38(_0x2a59a9[_0xc6b4('0x14')]['message']);}})[_0xc6b4('0x15')](function(_0x293bfd){logger['error']('SquareRecording,\x20%s,\x20%s',_0x30516d,_0x293bfd);_0x368e7c(_0x293bfd);});});}exports['CreateSquareRecording']=function(_0x49f121){var _0x22f1f7=this;return new Promise(function(_0x2a1761,_0x2a3ae3){return db[_0xc6b4('0x16')][_0xc6b4('0x17')](_0x49f121[_0xc6b4('0x18')],{'raw':_0x49f121[_0xc6b4('0x19')]?_0x49f121['options']['raw']===undefined?!![]:![]:!![]})[_0xc6b4('0xd')](function(_0x242777){logger[_0xc6b4('0xe')](_0xc6b4('0x1a'),_0x49f121);logger['debug']('CreateSquareRecording',_0x49f121,JSON['stringify'](_0x242777));_0x2a1761(_0x242777);})[_0xc6b4('0x15')](function(_0x23b69d){logger[_0xc6b4('0x11')]('CreateSquareRecording',_0x23b69d[_0xc6b4('0x12')],_0x49f121);_0x2a3ae3(_0x22f1f7[_0xc6b4('0x11')](0x1f4,_0x23b69d[_0xc6b4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8e30739..77d6c71 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xe0c78,_0x163b0d){var _0xfec776=function(_0x22d42f){while(--_0x22d42f){_0xe0c78['push'](_0xe0c78['shift']());}};_0xfec776(++_0x163b0d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0xe1bdfa,_0x5371ce){var _0x28daee=function(_0x3d0cbb){while(--_0x3d0cbb){_0xe1bdfa['push'](_0xe1bdfa['shift']());}};_0x28daee(++_0x5371ce);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 6dfcdfa..40dc2d9 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 _0x8b6f=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2e1419,_0x17a7cf){var _0x114b36=function(_0x306713){while(--_0x306713){_0x2e1419['push'](_0x2e1419['shift']());}};_0x114b36(++_0x17a7cf);}(_0x8b6f,0x177));var _0xf8b6=function(_0x304d1f,_0x41e22f){_0x304d1f=_0x304d1f-0x0;var _0x3e3583=_0x8b6f[_0x304d1f];return _0x3e3583;};'use strict';var Sequelize=require(_0xf8b6('0x0'));module[_0xf8b6('0x1')]={'network':{'type':Sequelize[_0xf8b6('0x2')]},'network_script':{'type':Sequelize[_0xf8b6('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf8b6('0x2')]},'language':{'type':Sequelize[_0xf8b6('0x2')]},'type':{'type':Sequelize[_0xf8b6('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf8b6('0x2')]},'calleridname':{'type':Sequelize[_0xf8b6('0x2')]},'callingpres':{'type':Sequelize[_0xf8b6('0x2')]},'callingani2':{'type':Sequelize[_0xf8b6('0x2')]},'callington':{'type':Sequelize[_0xf8b6('0x2')]},'callingtns':{'type':Sequelize[_0xf8b6('0x2')]},'dnid':{'type':Sequelize[_0xf8b6('0x2')]},'rdnis':{'type':Sequelize[_0xf8b6('0x2')]},'context':{'type':Sequelize[_0xf8b6('0x2')]},'extension':{'type':Sequelize[_0xf8b6('0x2')]},'priority':{'type':Sequelize[_0xf8b6('0x2')]},'enhanced':{'type':Sequelize[_0xf8b6('0x2')]},'accountcode':{'type':Sequelize[_0xf8b6('0x2')]},'threadid':{'type':Sequelize[_0xf8b6('0x2')]},'project_name':{'type':Sequelize[_0xf8b6('0x2')]},'joinAt':{'type':Sequelize[_0xf8b6('0x3')]},'leaveAt':{'type':Sequelize[_0xf8b6('0x3')]},'bot':{'type':Sequelize[_0xf8b6('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6313=['BOOLEAN','exports','STRING','DATE'];(function(_0x2249db,_0x42ccd8){var _0x56adba=function(_0x5b85d9){while(--_0x5b85d9){_0x2249db['push'](_0x2249db['shift']());}};_0x56adba(++_0x42ccd8);}(_0x6313,0x89));var _0x3631=function(_0x20c3c2,_0x1b45e1){_0x20c3c2=_0x20c3c2-0x0;var _0x527149=_0x6313[_0x20c3c2];return _0x527149;};'use strict';var Sequelize=require('sequelize');module[_0x3631('0x0')]={'network':{'type':Sequelize[_0x3631('0x1')]},'network_script':{'type':Sequelize[_0x3631('0x1')]},'request':{'type':Sequelize[_0x3631('0x1')]},'channel':{'type':Sequelize[_0x3631('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3631('0x1')]},'uniqueid':{'type':Sequelize[_0x3631('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x3631('0x1')]},'callingani2':{'type':Sequelize[_0x3631('0x1')]},'callington':{'type':Sequelize[_0x3631('0x1')]},'callingtns':{'type':Sequelize[_0x3631('0x1')]},'dnid':{'type':Sequelize[_0x3631('0x1')]},'rdnis':{'type':Sequelize[_0x3631('0x1')]},'context':{'type':Sequelize[_0x3631('0x1')]},'extension':{'type':Sequelize[_0x3631('0x1')]},'priority':{'type':Sequelize[_0x3631('0x1')]},'enhanced':{'type':Sequelize[_0x3631('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x3631('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3631('0x2')]},'leaveAt':{'type':Sequelize[_0x3631('0x2')]},'bot':{'type':Sequelize[_0x3631('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 8252624..c7da3f4 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 _0x09d6=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','include','findAll','rows','catch','show','fields','includeAll','options','find','create','body','params','describe','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x203dd5,_0x396c3d){var _0xd6efa4=function(_0x4d8d99){while(--_0x4d8d99){_0x203dd5['push'](_0x203dd5['shift']());}};_0xd6efa4(++_0x396c3d);}(_0x09d6,0x1af));var _0x609d=function(_0x479d42,_0x246c87){_0x479d42=_0x479d42-0x0;var _0x5103f5=_0x09d6[_0x479d42];return _0x5103f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x609d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x609d('0x1'));var Mustache=require(_0x609d('0x2'));var util=require('util');var path=require(_0x609d('0x3'));var sox=require(_0x609d('0x4'));var csv=require(_0x609d('0x5'));var ejs=require(_0x609d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x609d('0x7'));var squel=require(_0x609d('0x8'));var crypto=require(_0x609d('0x9'));var jsforce=require(_0x609d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x609d('0x5'));var querystring=require(_0x609d('0xb'));var Papa=require(_0x609d('0xc'));var Redis=require(_0x609d('0xd'));var authService=require(_0x609d('0xe'));var qs=require(_0x609d('0xf'));var as=require(_0x609d('0x10'));var hardwareService=require(_0x609d('0x11'));var logger=require(_0x609d('0x12'))('api');var utils=require(_0x609d('0x13'));var config=require(_0x609d('0x14'));var licenseUtil=require(_0x609d('0x15'));var db=require(_0x609d('0x16'))['db'];function respondWithStatusCode(_0x1040cf,_0x4343f2){_0x4343f2=_0x4343f2||0xcc;return function(_0xc25fe1){if(_0xc25fe1){return _0x1040cf[_0x609d('0x17')](_0x4343f2);}return _0x1040cf[_0x609d('0x18')](_0x4343f2)[_0x609d('0x19')]();};}function respondWithResult(_0x175c64,_0x2a174f){_0x2a174f=_0x2a174f||0xc8;return function(_0x1dda54){if(_0x1dda54){return _0x175c64['status'](_0x2a174f)[_0x609d('0x1a')](_0x1dda54);}};}function respondWithFilteredResult(_0x4d6b9a,_0x276853){return function(_0x4eabb2){if(_0x4eabb2){var _0x1c5435=typeof _0x276853[_0x609d('0x1b')]===_0x609d('0x1c')&&typeof _0x276853[_0x609d('0x1d')]===_0x609d('0x1c');var _0x293f2c=_0x4eabb2['count'];var _0x2cb6b5=_0x1c5435?0x0:_0x276853['offset'];var _0x46517f=_0x1c5435?_0x4eabb2[_0x609d('0x1e')]:_0x276853[_0x609d('0x1b')]+_0x276853[_0x609d('0x1d')];var _0xbb82ba;if(_0x46517f>=_0x293f2c){_0x46517f=_0x293f2c;_0xbb82ba=0xc8;}else{_0xbb82ba=0xce;}_0x4d6b9a[_0x609d('0x18')](_0xbb82ba);return _0x4d6b9a[_0x609d('0x1f')](_0x609d('0x20'),_0x2cb6b5+'-'+_0x46517f+'/'+_0x293f2c)['json'](_0x4eabb2);}return null;};}function patchUpdates(_0x1b7f76){return function(_0x15a77a){try{jsonpatch[_0x609d('0x21')](_0x15a77a,_0x1b7f76,!![]);}catch(_0x3bcc69){return BPromise[_0x609d('0x22')](_0x3bcc69);}return _0x15a77a[_0x609d('0x23')]();};}function saveUpdates(_0x4b196a,_0x382496){return function(_0x4cbcd9){if(_0x4cbcd9){return _0x4cbcd9[_0x609d('0x24')](_0x4b196a)[_0x609d('0x25')](function(_0x2f3411){return _0x2f3411;});}return null;};}function removeEntity(_0x25d34e,_0x3489d8){return function(_0x546393){if(_0x546393){return _0x546393[_0x609d('0x26')]()[_0x609d('0x25')](function(){_0x25d34e['status'](0xcc)[_0x609d('0x19')]();});}};}function handleEntityNotFound(_0x201749,_0xe05143){return function(_0x433db9){if(!_0x433db9){_0x201749['sendStatus'](0x194);}return _0x433db9;};}function handleError(_0x10334f,_0x55fe25){_0x55fe25=_0x55fe25||0x1f4;return function(_0x34cc70){logger[_0x609d('0x27')](_0x34cc70[_0x609d('0x28')]);if(_0x34cc70['name']){delete _0x34cc70[_0x609d('0x29')];}_0x10334f[_0x609d('0x18')](_0x55fe25)[_0x609d('0x2a')](_0x34cc70);};}exports[_0x609d('0x2b')]=function(_0x3ec614,_0x5f39a0){var _0x1890c4={},_0x2cb3a0={},_0x379851={'count':0x0,'rows':[]};var _0x37107b=_[_0x609d('0x2c')](db[_0x609d('0x2d')]['rawAttributes'],function(_0x301892){return{'name':_0x301892[_0x609d('0x2e')],'type':_0x301892[_0x609d('0x2f')][_0x609d('0x30')]};});_0x2cb3a0[_0x609d('0x31')]=_[_0x609d('0x2c')](_0x37107b,_0x609d('0x29'));_0x2cb3a0[_0x609d('0x32')]=_[_0x609d('0x33')](_0x3ec614[_0x609d('0x32')]);_0x2cb3a0[_0x609d('0x34')]=_['intersection'](_0x2cb3a0[_0x609d('0x31')],_0x2cb3a0[_0x609d('0x32')]);_0x1890c4['attributes']=_[_0x609d('0x35')](_0x2cb3a0['model'],qs['fields'](_0x3ec614['query']['fields']));_0x1890c4[_0x609d('0x36')]=_0x1890c4['attributes'][_0x609d('0x37')]?_0x1890c4[_0x609d('0x36')]:_0x2cb3a0[_0x609d('0x31')];if(!_0x3ec614['query'][_0x609d('0x38')]('nolimit')){_0x1890c4['limit']=qs[_0x609d('0x1d')](_0x3ec614[_0x609d('0x32')][_0x609d('0x1d')]);_0x1890c4[_0x609d('0x1b')]=qs[_0x609d('0x1b')](_0x3ec614[_0x609d('0x32')][_0x609d('0x1b')]);}_0x1890c4[_0x609d('0x39')]=qs[_0x609d('0x3a')](_0x3ec614['query'][_0x609d('0x3a')]);_0x1890c4[_0x609d('0x3b')]=qs['filters'](_[_0x609d('0x3c')](_0x3ec614[_0x609d('0x32')],_0x2cb3a0['filters']),_0x37107b);if(_0x3ec614['query']['filter']){_0x1890c4['where']=_[_0x609d('0x3d')](_0x1890c4[_0x609d('0x3b')],{'$or':_[_0x609d('0x2c')](_0x37107b,function(_0x3580fd){if(_0x3580fd[_0x609d('0x2f')]!==_0x609d('0x3e')){var _0x511c01={};_0x511c01[_0x3580fd['name']]={'$like':'%'+_0x3ec614[_0x609d('0x32')]['filter']+'%'};return _0x511c01;}})});}_0x1890c4=_[_0x609d('0x3d')]({},_0x1890c4,_0x3ec614['options']);var _0x2f64b6={'where':_0x1890c4[_0x609d('0x3b')]};return db[_0x609d('0x2d')]['count'](_0x2f64b6)[_0x609d('0x25')](function(_0x428b58){_0x379851[_0x609d('0x1e')]=_0x428b58;if(_0x3ec614[_0x609d('0x32')]['includeAll']){_0x1890c4[_0x609d('0x3f')]=[{'all':!![]}];}return db[_0x609d('0x2d')][_0x609d('0x40')](_0x1890c4);})[_0x609d('0x25')](function(_0x5bb437){_0x379851[_0x609d('0x41')]=_0x5bb437;return _0x379851;})[_0x609d('0x25')](respondWithFilteredResult(_0x5f39a0,_0x1890c4))[_0x609d('0x42')](handleError(_0x5f39a0,null));};exports[_0x609d('0x43')]=function(_0x1750d7,_0x324bb0){var _0x54378f={'raw':!![],'where':{'id':_0x1750d7['params']['id']}},_0x468f59={};_0x468f59[_0x609d('0x31')]=_['keys'](db['SquareReport']['rawAttributes']);_0x468f59[_0x609d('0x32')]=_[_0x609d('0x33')](_0x1750d7[_0x609d('0x32')]);_0x468f59['filters']=_[_0x609d('0x35')](_0x468f59[_0x609d('0x31')],_0x468f59[_0x609d('0x32')]);_0x54378f[_0x609d('0x36')]=_[_0x609d('0x35')](_0x468f59[_0x609d('0x31')],qs['fields'](_0x1750d7['query'][_0x609d('0x44')]));_0x54378f[_0x609d('0x36')]=_0x54378f[_0x609d('0x36')][_0x609d('0x37')]?_0x54378f[_0x609d('0x36')]:_0x468f59[_0x609d('0x31')];if(_0x1750d7['query'][_0x609d('0x45')]){_0x54378f[_0x609d('0x3f')]=[{'all':!![]}];}_0x54378f=_[_0x609d('0x3d')]({},_0x54378f,_0x1750d7[_0x609d('0x46')]);return db[_0x609d('0x2d')][_0x609d('0x47')](_0x54378f)[_0x609d('0x25')](handleEntityNotFound(_0x324bb0,null))['then'](respondWithResult(_0x324bb0,null))[_0x609d('0x42')](handleError(_0x324bb0,null));};exports['create']=function(_0x5f32a8,_0x5bd5d9){return db['SquareReport'][_0x609d('0x48')](_0x5f32a8[_0x609d('0x49')],{})[_0x609d('0x25')](respondWithResult(_0x5bd5d9,0xc9))[_0x609d('0x42')](handleError(_0x5bd5d9,null));};exports[_0x609d('0x24')]=function(_0x53916b,_0x2faf65){if(_0x53916b[_0x609d('0x49')]['id']){delete _0x53916b[_0x609d('0x49')]['id'];}return db['SquareReport'][_0x609d('0x47')]({'where':{'id':_0x53916b[_0x609d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2faf65,null))[_0x609d('0x25')](saveUpdates(_0x53916b[_0x609d('0x49')],null))[_0x609d('0x25')](respondWithResult(_0x2faf65,null))['catch'](handleError(_0x2faf65,null));};exports[_0x609d('0x26')]=function(_0x4ba390,_0x48f72c){return db[_0x609d('0x2d')][_0x609d('0x47')]({'where':{'id':_0x4ba390[_0x609d('0x4a')]['id']}})[_0x609d('0x25')](handleEntityNotFound(_0x48f72c,null))[_0x609d('0x25')](removeEntity(_0x48f72c,null))[_0x609d('0x42')](handleError(_0x48f72c,null));};exports[_0x609d('0x4b')]=function(_0x23643d,_0x13d4a9){return db['SquareReport'][_0x609d('0x4b')]()[_0x609d('0x25')](respondWithResult(_0x13d4a9,null))['catch'](handleError(_0x13d4a9,null));}; \ No newline at end of file +var _0x4506=['query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','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','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model'];(function(_0x22d19b,_0x2ae63c){var _0x220d85=function(_0x268f8e){while(--_0x268f8e){_0x22d19b['push'](_0x22d19b['shift']());}};_0x220d85(++_0x2ae63c);}(_0x4506,0x1a6));var _0x6450=function(_0x375ea1,_0x17aab9){_0x375ea1=_0x375ea1-0x0;var _0x4fbc24=_0x4506[_0x375ea1];return _0x4fbc24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6450('0x0'));var zipdir=require(_0x6450('0x1'));var jsonpatch=require(_0x6450('0x2'));var rp=require(_0x6450('0x3'));var moment=require(_0x6450('0x4'));var BPromise=require(_0x6450('0x5'));var Mustache=require(_0x6450('0x6'));var util=require(_0x6450('0x7'));var path=require(_0x6450('0x8'));var sox=require(_0x6450('0x9'));var csv=require('to-csv');var ejs=require(_0x6450('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6450('0xb'));var squel=require(_0x6450('0xc'));var crypto=require('crypto');var jsforce=require(_0x6450('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6450('0xe'));var querystring=require(_0x6450('0xf'));var Papa=require(_0x6450('0x10'));var Redis=require(_0x6450('0x11'));var authService=require(_0x6450('0x12'));var qs=require(_0x6450('0x13'));var as=require(_0x6450('0x14'));var hardwareService=require(_0x6450('0x15'));var logger=require(_0x6450('0x16'))(_0x6450('0x17'));var utils=require('../../config/utils');var config=require(_0x6450('0x18'));var licenseUtil=require(_0x6450('0x19'));var db=require(_0x6450('0x1a'))['db'];function respondWithStatusCode(_0x29baa9,_0x359613){_0x359613=_0x359613||0xcc;return function(_0x2f42c1){if(_0x2f42c1){return _0x29baa9[_0x6450('0x1b')](_0x359613);}return _0x29baa9[_0x6450('0x1c')](_0x359613)[_0x6450('0x1d')]();};}function respondWithResult(_0x2a77ff,_0x2e8e8a){_0x2e8e8a=_0x2e8e8a||0xc8;return function(_0xc2abff){if(_0xc2abff){return _0x2a77ff[_0x6450('0x1c')](_0x2e8e8a)[_0x6450('0x1e')](_0xc2abff);}};}function respondWithFilteredResult(_0x38af47,_0x263acf){return function(_0x46d575){if(_0x46d575){var _0x26de96=typeof _0x263acf['offset']==='undefined'&&typeof _0x263acf[_0x6450('0x1f')]==='undefined';var _0x45eb42=_0x46d575[_0x6450('0x20')];var _0x3814c8=_0x26de96?0x0:_0x263acf['offset'];var _0x147074=_0x26de96?_0x46d575['count']:_0x263acf[_0x6450('0x21')]+_0x263acf[_0x6450('0x1f')];var _0x49ab76;if(_0x147074>=_0x45eb42){_0x147074=_0x45eb42;_0x49ab76=0xc8;}else{_0x49ab76=0xce;}_0x38af47[_0x6450('0x1c')](_0x49ab76);return _0x38af47[_0x6450('0x22')](_0x6450('0x23'),_0x3814c8+'-'+_0x147074+'/'+_0x45eb42)[_0x6450('0x1e')](_0x46d575);}return null;};}function patchUpdates(_0x41fc8d){return function(_0x5595f7){try{jsonpatch[_0x6450('0x24')](_0x5595f7,_0x41fc8d,!![]);}catch(_0x257008){return BPromise[_0x6450('0x25')](_0x257008);}return _0x5595f7[_0x6450('0x26')]();};}function saveUpdates(_0x1bc12e,_0x4bd3b6){return function(_0x424531){if(_0x424531){return _0x424531['update'](_0x1bc12e)['then'](function(_0x1bae7f){return _0x1bae7f;});}return null;};}function removeEntity(_0x330b48,_0x473576){return function(_0x2d3c3e){if(_0x2d3c3e){return _0x2d3c3e[_0x6450('0x27')]()[_0x6450('0x28')](function(){_0x330b48[_0x6450('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb773c6,_0x113eaf){return function(_0x17e0cd){if(!_0x17e0cd){_0xb773c6[_0x6450('0x1b')](0x194);}return _0x17e0cd;};}function handleError(_0xf9aacf,_0x36c6d6){_0x36c6d6=_0x36c6d6||0x1f4;return function(_0x428641){logger['error'](_0x428641[_0x6450('0x29')]);if(_0x428641[_0x6450('0x2a')]){delete _0x428641[_0x6450('0x2a')];}_0xf9aacf[_0x6450('0x1c')](_0x36c6d6)[_0x6450('0x2b')](_0x428641);};}exports[_0x6450('0x2c')]=function(_0x44b7a8,_0x58daa3){var _0x493513={},_0x9cbd9={},_0x5070aa={'count':0x0,'rows':[]};var _0x35b071=_[_0x6450('0x2d')](db[_0x6450('0x2e')][_0x6450('0x2f')],function(_0x319db5){return{'name':_0x319db5[_0x6450('0x30')],'type':_0x319db5[_0x6450('0x31')][_0x6450('0x32')]};});_0x9cbd9[_0x6450('0x33')]=_[_0x6450('0x2d')](_0x35b071,_0x6450('0x2a'));_0x9cbd9[_0x6450('0x34')]=_['keys'](_0x44b7a8[_0x6450('0x34')]);_0x9cbd9[_0x6450('0x35')]=_['intersection'](_0x9cbd9['model'],_0x9cbd9[_0x6450('0x34')]);_0x493513[_0x6450('0x36')]=_[_0x6450('0x37')](_0x9cbd9['model'],qs['fields'](_0x44b7a8['query'][_0x6450('0x38')]));_0x493513[_0x6450('0x36')]=_0x493513[_0x6450('0x36')][_0x6450('0x39')]?_0x493513['attributes']:_0x9cbd9[_0x6450('0x33')];if(!_0x44b7a8[_0x6450('0x34')][_0x6450('0x3a')]('nolimit')){_0x493513['limit']=qs[_0x6450('0x1f')](_0x44b7a8[_0x6450('0x34')][_0x6450('0x1f')]);_0x493513[_0x6450('0x21')]=qs[_0x6450('0x21')](_0x44b7a8[_0x6450('0x34')][_0x6450('0x21')]);}_0x493513[_0x6450('0x3b')]=qs[_0x6450('0x3c')](_0x44b7a8[_0x6450('0x34')]['sort']);_0x493513[_0x6450('0x3d')]=qs[_0x6450('0x35')](_[_0x6450('0x3e')](_0x44b7a8[_0x6450('0x34')],_0x9cbd9[_0x6450('0x35')]),_0x35b071);if(_0x44b7a8['query'][_0x6450('0x3f')]){_0x493513[_0x6450('0x3d')]=_[_0x6450('0x40')](_0x493513['where'],{'$or':_['map'](_0x35b071,function(_0x493637){if(_0x493637[_0x6450('0x31')]!==_0x6450('0x41')){var _0x6adae0={};_0x6adae0[_0x493637['name']]={'$like':'%'+_0x44b7a8[_0x6450('0x34')][_0x6450('0x3f')]+'%'};return _0x6adae0;}})});}_0x493513=_[_0x6450('0x40')]({},_0x493513,_0x44b7a8[_0x6450('0x42')]);var _0x14be10={'where':_0x493513[_0x6450('0x3d')]};return db[_0x6450('0x2e')][_0x6450('0x20')](_0x14be10)[_0x6450('0x28')](function(_0xe027c5){_0x5070aa[_0x6450('0x20')]=_0xe027c5;if(_0x44b7a8[_0x6450('0x34')]['includeAll']){_0x493513[_0x6450('0x43')]=[{'all':!![]}];}return db[_0x6450('0x2e')][_0x6450('0x44')](_0x493513);})[_0x6450('0x28')](function(_0x5dd54b){_0x5070aa[_0x6450('0x45')]=_0x5dd54b;return _0x5070aa;})[_0x6450('0x28')](respondWithFilteredResult(_0x58daa3,_0x493513))[_0x6450('0x46')](handleError(_0x58daa3,null));};exports[_0x6450('0x47')]=function(_0x1fdb6b,_0x2a94ca){var _0x2aaafb={'raw':!![],'where':{'id':_0x1fdb6b[_0x6450('0x48')]['id']}},_0x142cc9={};_0x142cc9['model']=_[_0x6450('0x49')](db[_0x6450('0x2e')]['rawAttributes']);_0x142cc9['query']=_[_0x6450('0x49')](_0x1fdb6b[_0x6450('0x34')]);_0x142cc9['filters']=_[_0x6450('0x37')](_0x142cc9[_0x6450('0x33')],_0x142cc9[_0x6450('0x34')]);_0x2aaafb[_0x6450('0x36')]=_[_0x6450('0x37')](_0x142cc9[_0x6450('0x33')],qs['fields'](_0x1fdb6b[_0x6450('0x34')]['fields']));_0x2aaafb[_0x6450('0x36')]=_0x2aaafb[_0x6450('0x36')][_0x6450('0x39')]?_0x2aaafb[_0x6450('0x36')]:_0x142cc9[_0x6450('0x33')];if(_0x1fdb6b[_0x6450('0x34')]['includeAll']){_0x2aaafb[_0x6450('0x43')]=[{'all':!![]}];}_0x2aaafb=_[_0x6450('0x40')]({},_0x2aaafb,_0x1fdb6b[_0x6450('0x42')]);return db[_0x6450('0x2e')][_0x6450('0x4a')](_0x2aaafb)[_0x6450('0x28')](handleEntityNotFound(_0x2a94ca,null))[_0x6450('0x28')](respondWithResult(_0x2a94ca,null))[_0x6450('0x46')](handleError(_0x2a94ca,null));};exports[_0x6450('0x4b')]=function(_0xa3e5af,_0xdfc664){return db[_0x6450('0x2e')][_0x6450('0x4b')](_0xa3e5af[_0x6450('0x4c')],{})['then'](respondWithResult(_0xdfc664,0xc9))[_0x6450('0x46')](handleError(_0xdfc664,null));};exports[_0x6450('0x4d')]=function(_0x1f736b,_0x4ebcff){if(_0x1f736b['body']['id']){delete _0x1f736b[_0x6450('0x4c')]['id'];}return db[_0x6450('0x2e')][_0x6450('0x4a')]({'where':{'id':_0x1f736b['params']['id']}})[_0x6450('0x28')](handleEntityNotFound(_0x4ebcff,null))[_0x6450('0x28')](saveUpdates(_0x1f736b[_0x6450('0x4c')],null))[_0x6450('0x28')](respondWithResult(_0x4ebcff,null))[_0x6450('0x46')](handleError(_0x4ebcff,null));};exports[_0x6450('0x27')]=function(_0x2e9f41,_0x8066db){return db[_0x6450('0x2e')]['find']({'where':{'id':_0x2e9f41['params']['id']}})[_0x6450('0x28')](handleEntityNotFound(_0x8066db,null))[_0x6450('0x28')](removeEntity(_0x8066db,null))[_0x6450('0x46')](handleError(_0x8066db,null));};exports[_0x6450('0x4e')]=function(_0x15bb5f,_0x25880e){return db['SquareReport'][_0x6450('0x4e')]()['then'](respondWithResult(_0x25880e,null))[_0x6450('0x46')](handleError(_0x25880e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 524bfa1..9a5b000 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 _0x38fc=['leaveAt','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uniqueid'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x38fc,0x127));var _0xc38f=function(_0x18ea02,_0x5895e3){_0x18ea02=_0x18ea02-0x0;var _0x47fd41=_0x38fc[_0x18ea02];return _0x47fd41;};'use strict';var _=require(_0xc38f('0x0'));var util=require('util');var logger=require(_0xc38f('0x1'))('api');var moment=require(_0xc38f('0x2'));var BPromise=require(_0xc38f('0x3'));var rp=require(_0xc38f('0x4'));var fs=require('fs');var path=require(_0xc38f('0x5'));var rimraf=require(_0xc38f('0x6'));var config=require(_0xc38f('0x7'));var attributes=require(_0xc38f('0x8'));module[_0xc38f('0x9')]=function(_0x9ce8f,_0x15bd3a){return _0x9ce8f[_0xc38f('0xa')]('SquareReport',attributes,{'tableName':_0xc38f('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xc38f('0xc'),'project_name']},{'name':_0xc38f('0xd'),'fields':[_0xc38f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8d6=['report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','api','bluebird','path','rimraf','./squareReport.attributes','exports','SquareReport'];(function(_0xddf1a6,_0x37ffb4){var _0x20ba4e=function(_0xfe4048){while(--_0xfe4048){_0xddf1a6['push'](_0xddf1a6['shift']());}};_0x20ba4e(++_0x37ffb4);}(_0xb8d6,0x1ef));var _0x6b8d=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xb8d6[_0x2cfb58];return _0xd99951;};'use strict';var _=require('lodash');var util=require(_0x6b8d('0x0'));var logger=require(_0x6b8d('0x1'))(_0x6b8d('0x2'));var moment=require('moment');var BPromise=require(_0x6b8d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b8d('0x4'));var rimraf=require(_0x6b8d('0x5'));var config=require('../../config/environment');var attributes=require(_0x6b8d('0x6'));module[_0x6b8d('0x7')]=function(_0x5490f3,_0x3589b1){return _0x5490f3['define'](_0x6b8d('0x8'),attributes,{'tableName':_0x6b8d('0x9'),'paranoid':![],'indexes':[{'name':_0x6b8d('0xa'),'fields':[_0x6b8d('0xb'),_0x6b8d('0xc')]},{'name':'leaveAt','fields':[_0x6b8d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5a7ac0b..8be42ef 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 _0xaba0=['jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareReport','SquareReport','create','options','update','body','raw','where','attributes','limit','UpdateSquareReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2856e6,_0x1558fb){var _0x12f8f9=function(_0xe920ca){while(--_0xe920ca){_0x2856e6['push'](_0x2856e6['shift']());}};_0x12f8f9(++_0x1558fb);}(_0xaba0,0x1d3));var _0x0aba=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaba0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0aba('0x0'));var util=require('util');var moment=require(_0x0aba('0x1'));var BPromise=require(_0x0aba('0x2'));var rs=require(_0x0aba('0x3'));var fs=require('fs');var Redis=require(_0x0aba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0aba('0x5'));var logger=require(_0x0aba('0x6'))(_0x0aba('0x7'));var config=require(_0x0aba('0x8'));var jayson=require(_0x0aba('0x9'));var client=jayson[_0x0aba('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f414f,_0xf50362,_0x351e38){return new BPromise(function(_0x1c4c7b,_0x58eb7f){return client[_0x0aba('0xb')](_0x4f414f,_0x351e38)[_0x0aba('0xc')](function(_0x407fad){logger['info'](_0x0aba('0xd'),_0xf50362,_0x0aba('0xe'));logger[_0x0aba('0xf')](_0x0aba('0x10'),_0xf50362,_0x0aba('0xe'),JSON[_0x0aba('0x11')](_0x407fad));if(_0x407fad[_0x0aba('0x12')]){if(_0x407fad['error'][_0x0aba('0x13')]===0x1f4){logger[_0x0aba('0x12')](_0x0aba('0xd'),_0xf50362,_0x407fad[_0x0aba('0x12')][_0x0aba('0x14')]);return _0x58eb7f(_0x407fad[_0x0aba('0x12')][_0x0aba('0x14')]);}logger[_0x0aba('0x12')](_0x0aba('0xd'),_0xf50362,_0x407fad[_0x0aba('0x12')]['message']);return _0x1c4c7b(_0x407fad[_0x0aba('0x12')][_0x0aba('0x14')]);}else{logger[_0x0aba('0x15')](_0x0aba('0xd'),_0xf50362,'request\x20sent');_0x1c4c7b(_0x407fad['result']['message']);}})[_0x0aba('0x16')](function(_0xbd60f){logger[_0x0aba('0x12')](_0x0aba('0xd'),_0xf50362,_0xbd60f);_0x58eb7f(_0xbd60f);});});}exports[_0x0aba('0x17')]=function(_0x4e8d4f){var _0x4a01f8=this;return new Promise(function(_0x5c5b6a,_0x8a8976){return db[_0x0aba('0x18')][_0x0aba('0x19')](_0x4e8d4f['body'],{'raw':_0x4e8d4f[_0x0aba('0x1a')]?_0x4e8d4f[_0x0aba('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x0aba('0xc')](function(_0x4ece7b){logger[_0x0aba('0x15')]('CreateSquareReport',_0x4e8d4f);logger[_0x0aba('0xf')]('CreateSquareReport',_0x4e8d4f,JSON['stringify'](_0x4ece7b));_0x5c5b6a(_0x4ece7b);})[_0x0aba('0x16')](function(_0x5d5341){logger['error'](_0x0aba('0x17'),_0x5d5341[_0x0aba('0x14')],_0x4e8d4f);_0x8a8976(_0x4a01f8[_0x0aba('0x12')](0x1f4,_0x5d5341['message']));});});};exports['UpdateSquareReport']=function(_0x5d9590){var _0x3fb74=this;return new Promise(function(_0x367489,_0x1640f1){return db['SquareReport'][_0x0aba('0x1b')](_0x5d9590[_0x0aba('0x1c')],{'raw':_0x5d9590[_0x0aba('0x1a')]?_0x5d9590[_0x0aba('0x1a')][_0x0aba('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d9590[_0x0aba('0x1a')]?_0x5d9590[_0x0aba('0x1a')][_0x0aba('0x1e')]||null:null,'attributes':_0x5d9590['options']?_0x5d9590['options'][_0x0aba('0x1f')]||null:null,'limit':_0x5d9590[_0x0aba('0x1a')]?_0x5d9590[_0x0aba('0x1a')][_0x0aba('0x20')]||null:null})[_0x0aba('0xc')](function(_0x3d27a8){logger[_0x0aba('0x15')](_0x0aba('0x21'),_0x5d9590);logger['debug']('UpdateSquareReport',_0x5d9590,JSON[_0x0aba('0x11')](_0x3d27a8));_0x367489(_0x3d27a8);})[_0x0aba('0x16')](function(_0x54cdbd){logger[_0x0aba('0x12')]('UpdateSquareReport',_0x54cdbd[_0x0aba('0x14')],_0x5d9590);_0x1640f1(_0x3fb74['error'](0x1f4,_0x54cdbd[_0x0aba('0x14')]));});});}; \ No newline at end of file +var _0x074d=['stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','where','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x074d,0x1a1));var _0xd074=function(_0x368e58,_0x202095){_0x368e58=_0x368e58-0x0;var _0xa52412=_0x074d[_0x368e58];return _0xa52412;};'use strict';var _=require(_0xd074('0x0'));var util=require(_0xd074('0x1'));var moment=require('moment');var BPromise=require(_0xd074('0x2'));var rs=require(_0xd074('0x3'));var fs=require('fs');var Redis=require(_0xd074('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd074('0x5'));var logger=require('../../config/logger')(_0xd074('0x6'));var config=require('../../config/environment');var jayson=require(_0xd074('0x7'));var client=jayson[_0xd074('0x8')][_0xd074('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x141d32,_0x2fc187,_0x18350a){return new BPromise(function(_0x20241d,_0x2201e0){return client[_0xd074('0xa')](_0x141d32,_0x18350a)[_0xd074('0xb')](function(_0x2f13dd){logger[_0xd074('0xc')](_0xd074('0xd'),_0x2fc187,_0xd074('0xe'));logger[_0xd074('0xf')](_0xd074('0x10'),_0x2fc187,'request\x20sent',JSON[_0xd074('0x11')](_0x2f13dd));if(_0x2f13dd[_0xd074('0x12')]){if(_0x2f13dd[_0xd074('0x12')][_0xd074('0x13')]===0x1f4){logger[_0xd074('0x12')](_0xd074('0xd'),_0x2fc187,_0x2f13dd[_0xd074('0x12')]['message']);return _0x2201e0(_0x2f13dd[_0xd074('0x12')][_0xd074('0x14')]);}logger[_0xd074('0x12')](_0xd074('0xd'),_0x2fc187,_0x2f13dd[_0xd074('0x12')][_0xd074('0x14')]);return _0x20241d(_0x2f13dd[_0xd074('0x12')]['message']);}else{logger[_0xd074('0xc')](_0xd074('0xd'),_0x2fc187,'request\x20sent');_0x20241d(_0x2f13dd[_0xd074('0x15')][_0xd074('0x14')]);}})[_0xd074('0x16')](function(_0x34ebf3){logger['error']('SquareReport,\x20%s,\x20%s',_0x2fc187,_0x34ebf3);_0x2201e0(_0x34ebf3);});});}exports[_0xd074('0x17')]=function(_0x57ccf5){var _0x170b7e=this;return new Promise(function(_0x226bcd,_0x49dbd9){return db[_0xd074('0x18')][_0xd074('0x19')](_0x57ccf5['body'],{'raw':_0x57ccf5[_0xd074('0x1a')]?_0x57ccf5[_0xd074('0x1a')][_0xd074('0x1b')]===undefined?!![]:![]:!![]})[_0xd074('0xb')](function(_0x2c88a0){logger[_0xd074('0xc')](_0xd074('0x17'),_0x57ccf5);logger['debug'](_0xd074('0x17'),_0x57ccf5,JSON[_0xd074('0x11')](_0x2c88a0));_0x226bcd(_0x2c88a0);})['catch'](function(_0x40c713){logger[_0xd074('0x12')](_0xd074('0x17'),_0x40c713[_0xd074('0x14')],_0x57ccf5);_0x49dbd9(_0x170b7e[_0xd074('0x12')](0x1f4,_0x40c713[_0xd074('0x14')]));});});};exports[_0xd074('0x1c')]=function(_0x272e71){var _0x52f7d7=this;return new Promise(function(_0x12d5c5,_0x72e131){return db[_0xd074('0x18')]['update'](_0x272e71['body'],{'raw':_0x272e71[_0xd074('0x1a')]?_0x272e71['options'][_0xd074('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272e71[_0xd074('0x1a')]?_0x272e71['options'][_0xd074('0x1d')]||null:null,'attributes':_0x272e71[_0xd074('0x1a')]?_0x272e71[_0xd074('0x1a')]['attributes']||null:null,'limit':_0x272e71['options']?_0x272e71[_0xd074('0x1a')][_0xd074('0x1e')]||null:null})[_0xd074('0xb')](function(_0x5ad661){logger[_0xd074('0xc')](_0xd074('0x1c'),_0x272e71);logger[_0xd074('0xf')]('UpdateSquareReport',_0x272e71,JSON['stringify'](_0x5ad661));_0x12d5c5(_0x5ad661);})[_0xd074('0x16')](function(_0x4670fb){logger[_0xd074('0x12')](_0xd074('0x1c'),_0x4670fb[_0xd074('0x14')],_0x272e71);_0x72e131(_0x52f7d7[_0xd074('0x12')](0x1f4,_0x4670fb[_0xd074('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4cd6e43..0c08309 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 _0x6098=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','post'];(function(_0x32917a,_0x3559ea){var _0x1881e1=function(_0x56730d){while(--_0x56730d){_0x32917a['push'](_0x32917a['shift']());}};_0x1881e1(++_0x3559ea);}(_0x6098,0x150));var _0x8609=function(_0x5bd4fc,_0x4fbd8c){_0x5bd4fc=_0x5bd4fc-0x0;var _0x14b56e=_0x6098[_0x5bd4fc];return _0x14b56e;};'use strict';var multer=require(_0x8609('0x0'));var util=require(_0x8609('0x1'));var path=require(_0x8609('0x2'));var timeout=require(_0x8609('0x3'));var express=require(_0x8609('0x4'));var router=express[_0x8609('0x5')]();var fs_extra=require(_0x8609('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8609('0x7'));var controller=require(_0x8609('0x8'));router['get']('/',auth[_0x8609('0x9')](),controller[_0x8609('0xa')]);router[_0x8609('0xb')](_0x8609('0xc'),auth[_0x8609('0x9')](),controller[_0x8609('0xd')]);router[_0x8609('0xb')](_0x8609('0xe'),auth[_0x8609('0x9')](),controller['show']);router[_0x8609('0xf')]('/',auth[_0x8609('0x9')](),controller[_0x8609('0x10')]);router[_0x8609('0x11')](_0x8609('0xe'),auth[_0x8609('0x9')](),controller[_0x8609('0x12')]);router[_0x8609('0x13')](_0x8609('0xe'),auth[_0x8609('0x9')](),controller[_0x8609('0x14')]);module[_0x8609('0x15')]=router; \ No newline at end of file +var _0x48d7=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x5bc8ca,_0x2d4a88){var _0x5a8fa1=function(_0x40bb74){while(--_0x40bb74){_0x5bc8ca['push'](_0x5bc8ca['shift']());}};_0x5a8fa1(++_0x2d4a88);}(_0x48d7,0xa6));var _0x748d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x48d7[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x748d('0x0'));var util=require(_0x748d('0x1'));var path=require(_0x748d('0x2'));var timeout=require(_0x748d('0x3'));var express=require('express');var router=express[_0x748d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x748d('0x5'));var interaction=require(_0x748d('0x6'));var config=require(_0x748d('0x7'));var controller=require('./squareReportDetail.controller');router[_0x748d('0x8')]('/',auth['isAuthenticated'](),controller[_0x748d('0x9')]);router[_0x748d('0x8')](_0x748d('0xa'),auth[_0x748d('0xb')](),controller[_0x748d('0xc')]);router[_0x748d('0x8')](_0x748d('0xd'),auth[_0x748d('0xb')](),controller[_0x748d('0xe')]);router['post']('/',auth[_0x748d('0xb')](),controller['create']);router[_0x748d('0xf')](_0x748d('0xd'),auth[_0x748d('0xb')](),controller[_0x748d('0x10')]);router[_0x748d('0x11')](_0x748d('0xd'),auth[_0x748d('0xb')](),controller[_0x748d('0x12')]);module[_0x748d('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6f49ea1..d0602ce 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 _0xc7a0=['STRING','sequelize','exports'];(function(_0x387335,_0x1dbb1a){var _0x18bb1c=function(_0x2fdc5a){while(--_0x2fdc5a){_0x387335['push'](_0x387335['shift']());}};_0x18bb1c(++_0x1dbb1a);}(_0xc7a0,0x142));var _0x0c7a=function(_0x49ec9a,_0x485690){_0x49ec9a=_0x49ec9a-0x0;var _0xf61c7a=_0xc7a0[_0x49ec9a];return _0xf61c7a;};'use strict';var Sequelize=require(_0x0c7a('0x0'));module[_0x0c7a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0c7a('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x0c7a('0x2')]},'callerid':{'type':Sequelize[_0x0c7a('0x2')]}}; \ No newline at end of file +var _0x0794=['exports','STRING','TEXT','sequelize'];(function(_0x1cd439,_0x4154ad){var _0x413696=function(_0x190bfc){while(--_0x190bfc){_0x1cd439['push'](_0x1cd439['shift']());}};_0x413696(++_0x4154ad);}(_0x0794,0x73));var _0x4079=function(_0x712575,_0x1cc897){_0x712575=_0x712575-0x0;var _0x40b83b=_0x0794[_0x712575];return _0x40b83b;};'use strict';var Sequelize=require(_0x4079('0x0'));module[_0x4079('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x4079('0x2')]},'application':{'type':Sequelize[_0x4079('0x2')]},'data':{'type':Sequelize[_0x4079('0x3')]},'project_name':{'type':Sequelize[_0x4079('0x2')]},'callerid':{'type':Sequelize[_0x4079('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2232aa7..fa9c175 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 _0x26c2=['Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','keys','attributes','intersection','query','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','fields','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x2474ac,_0x335d3a){var _0x384a8f=function(_0x402bf6){while(--_0x402bf6){_0x2474ac['push'](_0x2474ac['shift']());}};_0x384a8f(++_0x335d3a);}(_0x26c2,0x109));var _0x226c=function(_0xc3de12,_0x1fc588){_0xc3de12=_0xc3de12-0x0;var _0x44dd18=_0x26c2[_0xc3de12];return _0x44dd18;};'use strict';var emlformat=require(_0x226c('0x0'));var rimraf=require(_0x226c('0x1'));var zipdir=require(_0x226c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x226c('0x3'));var moment=require('moment');var BPromise=require(_0x226c('0x4'));var Mustache=require(_0x226c('0x5'));var util=require(_0x226c('0x6'));var path=require(_0x226c('0x7'));var sox=require(_0x226c('0x8'));var csv=require('to-csv');var ejs=require(_0x226c('0x9'));var fs=require('fs');var fs_extra=require(_0x226c('0xa'));var _=require(_0x226c('0xb'));var squel=require('squel');var crypto=require(_0x226c('0xc'));var jsforce=require(_0x226c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x226c('0xe'));var querystring=require(_0x226c('0xf'));var Papa=require(_0x226c('0x10'));var Redis=require(_0x226c('0x11'));var authService=require(_0x226c('0x12'));var qs=require(_0x226c('0x13'));var as=require(_0x226c('0x14'));var hardwareService=require(_0x226c('0x15'));var logger=require(_0x226c('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x226c('0x17'));var licenseUtil=require(_0x226c('0x18'));var db=require(_0x226c('0x19'))['db'];function respondWithStatusCode(_0x20f462,_0x3f2d8a){_0x3f2d8a=_0x3f2d8a||0xcc;return function(_0x2c1837){if(_0x2c1837){return _0x20f462[_0x226c('0x1a')](_0x3f2d8a);}return _0x20f462['status'](_0x3f2d8a)[_0x226c('0x1b')]();};}function respondWithResult(_0x54ae86,_0x1a9361){_0x1a9361=_0x1a9361||0xc8;return function(_0x15ac6e){if(_0x15ac6e){return _0x54ae86[_0x226c('0x1c')](_0x1a9361)[_0x226c('0x1d')](_0x15ac6e);}};}function respondWithFilteredResult(_0x29f60f,_0xe7203){return function(_0x4ba85d){if(_0x4ba85d){var _0xf8bcbc=typeof _0xe7203[_0x226c('0x1e')]===_0x226c('0x1f')&&typeof _0xe7203[_0x226c('0x20')]===_0x226c('0x1f');var _0x5647bb=_0x4ba85d[_0x226c('0x21')];var _0x5d5111=_0xf8bcbc?0x0:_0xe7203[_0x226c('0x1e')];var _0x16e6c8=_0xf8bcbc?_0x4ba85d[_0x226c('0x21')]:_0xe7203[_0x226c('0x1e')]+_0xe7203[_0x226c('0x20')];var _0xd97103;if(_0x16e6c8>=_0x5647bb){_0x16e6c8=_0x5647bb;_0xd97103=0xc8;}else{_0xd97103=0xce;}_0x29f60f[_0x226c('0x1c')](_0xd97103);return _0x29f60f[_0x226c('0x22')](_0x226c('0x23'),_0x5d5111+'-'+_0x16e6c8+'/'+_0x5647bb)[_0x226c('0x1d')](_0x4ba85d);}return null;};}function patchUpdates(_0x3eacce){return function(_0x1d723f){try{jsonpatch[_0x226c('0x24')](_0x1d723f,_0x3eacce,!![]);}catch(_0x1ac11c){return BPromise[_0x226c('0x25')](_0x1ac11c);}return _0x1d723f['save']();};}function saveUpdates(_0x19d8ef,_0x3b2bac){return function(_0x5e4c12){if(_0x5e4c12){return _0x5e4c12[_0x226c('0x26')](_0x19d8ef)[_0x226c('0x27')](function(_0xf4c25){return _0xf4c25;});}return null;};}function removeEntity(_0x40f519,_0x472740){return function(_0x1e85f9){if(_0x1e85f9){return _0x1e85f9['destroy']()[_0x226c('0x27')](function(){_0x40f519[_0x226c('0x1c')](0xcc)[_0x226c('0x1b')]();});}};}function handleEntityNotFound(_0x542d8f,_0x4b2e6f){return function(_0x5411fd){if(!_0x5411fd){_0x542d8f[_0x226c('0x1a')](0x194);}return _0x5411fd;};}function handleError(_0x54eb81,_0x347252){_0x347252=_0x347252||0x1f4;return function(_0xa929c8){logger[_0x226c('0x28')](_0xa929c8[_0x226c('0x29')]);if(_0xa929c8[_0x226c('0x2a')]){delete _0xa929c8[_0x226c('0x2a')];}_0x54eb81[_0x226c('0x1c')](_0x347252)[_0x226c('0x2b')](_0xa929c8);};}exports[_0x226c('0x2c')]=function(_0x3f9ce2,_0x15b130){var _0x2e1acf={},_0x58b270={},_0x471338={'count':0x0,'rows':[]};var _0x268e31=_[_0x226c('0x2d')](db[_0x226c('0x2e')][_0x226c('0x2f')],function(_0x49697a){return{'name':_0x49697a[_0x226c('0x30')],'type':_0x49697a['type'][_0x226c('0x31')]};});_0x58b270[_0x226c('0x32')]=_[_0x226c('0x2d')](_0x268e31,_0x226c('0x2a'));_0x58b270['query']=_[_0x226c('0x33')](_0x3f9ce2['query']);_0x58b270['filters']=_['intersection'](_0x58b270[_0x226c('0x32')],_0x58b270['query']);_0x2e1acf[_0x226c('0x34')]=_[_0x226c('0x35')](_0x58b270[_0x226c('0x32')],qs['fields'](_0x3f9ce2['query']['fields']));_0x2e1acf['attributes']=_0x2e1acf[_0x226c('0x34')]['length']?_0x2e1acf[_0x226c('0x34')]:_0x58b270[_0x226c('0x32')];if(!_0x3f9ce2[_0x226c('0x36')][_0x226c('0x37')]('nolimit')){_0x2e1acf[_0x226c('0x20')]=qs[_0x226c('0x20')](_0x3f9ce2[_0x226c('0x36')][_0x226c('0x20')]);_0x2e1acf[_0x226c('0x1e')]=qs[_0x226c('0x1e')](_0x3f9ce2[_0x226c('0x36')][_0x226c('0x1e')]);}_0x2e1acf['order']=qs[_0x226c('0x38')](_0x3f9ce2['query'][_0x226c('0x38')]);_0x2e1acf[_0x226c('0x39')]=qs[_0x226c('0x3a')](_[_0x226c('0x3b')](_0x3f9ce2[_0x226c('0x36')],_0x58b270[_0x226c('0x3a')]),_0x268e31);if(_0x3f9ce2[_0x226c('0x36')][_0x226c('0x3c')]){_0x2e1acf[_0x226c('0x39')]=_[_0x226c('0x3d')](_0x2e1acf[_0x226c('0x39')],{'$or':_['map'](_0x268e31,function(_0x291ce4){if(_0x291ce4['type']!==_0x226c('0x3e')){var _0x4af5b3={};_0x4af5b3[_0x291ce4[_0x226c('0x2a')]]={'$like':'%'+_0x3f9ce2[_0x226c('0x36')][_0x226c('0x3c')]+'%'};return _0x4af5b3;}})});}_0x2e1acf=_[_0x226c('0x3d')]({},_0x2e1acf,_0x3f9ce2['options']);var _0x3b0e6c={'where':_0x2e1acf[_0x226c('0x39')]};return db['SquareDetailsReport'][_0x226c('0x21')](_0x3b0e6c)[_0x226c('0x27')](function(_0x338739){_0x471338[_0x226c('0x21')]=_0x338739;if(_0x3f9ce2[_0x226c('0x36')][_0x226c('0x3f')]){_0x2e1acf[_0x226c('0x40')]=[{'all':!![]}];}return db[_0x226c('0x2e')][_0x226c('0x41')](_0x2e1acf);})[_0x226c('0x27')](function(_0x556a56){_0x471338[_0x226c('0x42')]=_0x556a56;return _0x471338;})[_0x226c('0x27')](respondWithFilteredResult(_0x15b130,_0x2e1acf))['catch'](handleError(_0x15b130,null));};exports[_0x226c('0x43')]=function(_0x14158b,_0x2c30f7){var _0x4bfdf6={'raw':!![],'where':{'id':_0x14158b['params']['id']}},_0x1d6063={};_0x1d6063['model']=_['keys'](db['SquareDetailsReport'][_0x226c('0x2f')]);_0x1d6063['query']=_[_0x226c('0x33')](_0x14158b[_0x226c('0x36')]);_0x1d6063[_0x226c('0x3a')]=_['intersection'](_0x1d6063[_0x226c('0x32')],_0x1d6063[_0x226c('0x36')]);_0x4bfdf6[_0x226c('0x34')]=_[_0x226c('0x35')](_0x1d6063[_0x226c('0x32')],qs[_0x226c('0x44')](_0x14158b[_0x226c('0x36')]['fields']));_0x4bfdf6[_0x226c('0x34')]=_0x4bfdf6[_0x226c('0x34')][_0x226c('0x45')]?_0x4bfdf6[_0x226c('0x34')]:_0x1d6063['model'];if(_0x14158b[_0x226c('0x36')][_0x226c('0x3f')]){_0x4bfdf6[_0x226c('0x40')]=[{'all':!![]}];}_0x4bfdf6=_['merge']({},_0x4bfdf6,_0x14158b['options']);return db[_0x226c('0x2e')]['find'](_0x4bfdf6)[_0x226c('0x27')](handleEntityNotFound(_0x2c30f7,null))['then'](respondWithResult(_0x2c30f7,null))[_0x226c('0x46')](handleError(_0x2c30f7,null));};exports[_0x226c('0x47')]=function(_0x49c6e1,_0x53b2a4){return db[_0x226c('0x2e')][_0x226c('0x47')](_0x49c6e1['body'],{})['then'](respondWithResult(_0x53b2a4,0xc9))[_0x226c('0x46')](handleError(_0x53b2a4,null));};exports[_0x226c('0x26')]=function(_0x5c9ac2,_0x1bc7a5){if(_0x5c9ac2[_0x226c('0x48')]['id']){delete _0x5c9ac2['body']['id'];}return db['SquareDetailsReport'][_0x226c('0x49')]({'where':{'id':_0x5c9ac2['params']['id']}})[_0x226c('0x27')](handleEntityNotFound(_0x1bc7a5,null))['then'](saveUpdates(_0x5c9ac2[_0x226c('0x48')],null))['then'](respondWithResult(_0x1bc7a5,null))[_0x226c('0x46')](handleError(_0x1bc7a5,null));};exports['destroy']=function(_0x17c220,_0x41c28f){return db[_0x226c('0x2e')][_0x226c('0x49')]({'where':{'id':_0x17c220['params']['id']}})[_0x226c('0x27')](handleEntityNotFound(_0x41c28f,null))[_0x226c('0x27')](removeEntity(_0x41c28f,null))[_0x226c('0x46')](handleError(_0x41c28f,null));};exports[_0x226c('0x4a')]=function(_0x5a2b71,_0x22e239){return db['SquareDetailsReport'][_0x226c('0x4a')]()[_0x226c('0x27')](respondWithResult(_0x22e239,null))[_0x226c('0x46')](handleError(_0x22e239,null));}; \ No newline at end of file +var _0x8ee6=['fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','end','error','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','options','SquareDetailsReport','include','findAll','rows','catch','show','params','includeAll','merge','create','body','find','describe','eml-format','rimraf','zip-dir'];(function(_0x2c93d8,_0x3c2566){var _0x8bd0f2=function(_0x14cd36){while(--_0x14cd36){_0x2c93d8['push'](_0x2c93d8['shift']());}};_0x8bd0f2(++_0x3c2566);}(_0x8ee6,0x16f));var _0x68ee=function(_0x15ff8c,_0x7e9ef7){_0x15ff8c=_0x15ff8c-0x0;var _0x4292e3=_0x8ee6[_0x15ff8c];return _0x4292e3;};'use strict';var emlformat=require(_0x68ee('0x0'));var rimraf=require(_0x68ee('0x1'));var zipdir=require(_0x68ee('0x2'));var jsonpatch=require(_0x68ee('0x3'));var rp=require(_0x68ee('0x4'));var moment=require(_0x68ee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x68ee('0x6'));var util=require('util');var path=require(_0x68ee('0x7'));var sox=require('sox');var csv=require(_0x68ee('0x8'));var ejs=require(_0x68ee('0x9'));var fs=require('fs');var fs_extra=require(_0x68ee('0xa'));var _=require(_0x68ee('0xb'));var squel=require(_0x68ee('0xc'));var crypto=require('crypto');var jsforce=require(_0x68ee('0xd'));var deskjs=require(_0x68ee('0xe'));var toCsv=require(_0x68ee('0x8'));var querystring=require(_0x68ee('0xf'));var Papa=require(_0x68ee('0x10'));var Redis=require(_0x68ee('0x11'));var authService=require(_0x68ee('0x12'));var qs=require(_0x68ee('0x13'));var as=require(_0x68ee('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68ee('0x15'))(_0x68ee('0x16'));var utils=require(_0x68ee('0x17'));var config=require(_0x68ee('0x18'));var licenseUtil=require(_0x68ee('0x19'));var db=require(_0x68ee('0x1a'))['db'];function respondWithStatusCode(_0x552137,_0x54757c){_0x54757c=_0x54757c||0xcc;return function(_0x370f96){if(_0x370f96){return _0x552137[_0x68ee('0x1b')](_0x54757c);}return _0x552137[_0x68ee('0x1c')](_0x54757c)['end']();};}function respondWithResult(_0x37c5df,_0x392ab4){_0x392ab4=_0x392ab4||0xc8;return function(_0x4f3b6f){if(_0x4f3b6f){return _0x37c5df[_0x68ee('0x1c')](_0x392ab4)[_0x68ee('0x1d')](_0x4f3b6f);}};}function respondWithFilteredResult(_0x218ef6,_0x5a5fe6){return function(_0x48aa3c){if(_0x48aa3c){var _0x373e9e=typeof _0x5a5fe6[_0x68ee('0x1e')]===_0x68ee('0x1f')&&typeof _0x5a5fe6['limit']===_0x68ee('0x1f');var _0x25d6b6=_0x48aa3c[_0x68ee('0x20')];var _0x326cfa=_0x373e9e?0x0:_0x5a5fe6['offset'];var _0x5ddf93=_0x373e9e?_0x48aa3c['count']:_0x5a5fe6['offset']+_0x5a5fe6[_0x68ee('0x21')];var _0x39c931;if(_0x5ddf93>=_0x25d6b6){_0x5ddf93=_0x25d6b6;_0x39c931=0xc8;}else{_0x39c931=0xce;}_0x218ef6[_0x68ee('0x1c')](_0x39c931);return _0x218ef6[_0x68ee('0x22')](_0x68ee('0x23'),_0x326cfa+'-'+_0x5ddf93+'/'+_0x25d6b6)[_0x68ee('0x1d')](_0x48aa3c);}return null;};}function patchUpdates(_0x358182){return function(_0x703bd9){try{jsonpatch['apply'](_0x703bd9,_0x358182,!![]);}catch(_0x477358){return BPromise[_0x68ee('0x24')](_0x477358);}return _0x703bd9[_0x68ee('0x25')]();};}function saveUpdates(_0x5a8093,_0xa6545c){return function(_0x230021){if(_0x230021){return _0x230021['update'](_0x5a8093)[_0x68ee('0x26')](function(_0x31911b){return _0x31911b;});}return null;};}function removeEntity(_0x5545eb,_0x10e51){return function(_0x555de0){if(_0x555de0){return _0x555de0[_0x68ee('0x27')]()[_0x68ee('0x26')](function(){_0x5545eb[_0x68ee('0x1c')](0xcc)[_0x68ee('0x28')]();});}};}function handleEntityNotFound(_0x1f6006,_0xc5c9b6){return function(_0x2bf398){if(!_0x2bf398){_0x1f6006[_0x68ee('0x1b')](0x194);}return _0x2bf398;};}function handleError(_0x48390f,_0x5d34a3){_0x5d34a3=_0x5d34a3||0x1f4;return function(_0x56abe8){logger[_0x68ee('0x29')](_0x56abe8['stack']);if(_0x56abe8['name']){delete _0x56abe8['name'];}_0x48390f['status'](_0x5d34a3)['send'](_0x56abe8);};}exports[_0x68ee('0x2a')]=function(_0x5144f6,_0x293012){var _0x456751={},_0xc1b67e={},_0x285f03={'count':0x0,'rows':[]};var _0x57dd5f=_[_0x68ee('0x2b')](db['SquareDetailsReport'][_0x68ee('0x2c')],function(_0x2bda36){return{'name':_0x2bda36['fieldName'],'type':_0x2bda36[_0x68ee('0x2d')][_0x68ee('0x2e')]};});_0xc1b67e[_0x68ee('0x2f')]=_[_0x68ee('0x2b')](_0x57dd5f,_0x68ee('0x30'));_0xc1b67e[_0x68ee('0x31')]=_[_0x68ee('0x32')](_0x5144f6[_0x68ee('0x31')]);_0xc1b67e[_0x68ee('0x33')]=_[_0x68ee('0x34')](_0xc1b67e['model'],_0xc1b67e[_0x68ee('0x31')]);_0x456751[_0x68ee('0x35')]=_[_0x68ee('0x34')](_0xc1b67e[_0x68ee('0x2f')],qs['fields'](_0x5144f6['query'][_0x68ee('0x36')]));_0x456751['attributes']=_0x456751['attributes'][_0x68ee('0x37')]?_0x456751['attributes']:_0xc1b67e['model'];if(!_0x5144f6['query']['hasOwnProperty']('nolimit')){_0x456751[_0x68ee('0x21')]=qs[_0x68ee('0x21')](_0x5144f6[_0x68ee('0x31')][_0x68ee('0x21')]);_0x456751['offset']=qs[_0x68ee('0x1e')](_0x5144f6[_0x68ee('0x31')][_0x68ee('0x1e')]);}_0x456751[_0x68ee('0x38')]=qs[_0x68ee('0x39')](_0x5144f6['query'][_0x68ee('0x39')]);_0x456751[_0x68ee('0x3a')]=qs[_0x68ee('0x33')](_['pick'](_0x5144f6[_0x68ee('0x31')],_0xc1b67e['filters']),_0x57dd5f);if(_0x5144f6[_0x68ee('0x31')][_0x68ee('0x3b')]){_0x456751['where']=_['merge'](_0x456751[_0x68ee('0x3a')],{'$or':_['map'](_0x57dd5f,function(_0xda1c90){if(_0xda1c90[_0x68ee('0x2d')]!=='VIRTUAL'){var _0x566ff1={};_0x566ff1[_0xda1c90['name']]={'$like':'%'+_0x5144f6['query'][_0x68ee('0x3b')]+'%'};return _0x566ff1;}})});}_0x456751=_['merge']({},_0x456751,_0x5144f6[_0x68ee('0x3c')]);var _0x11ef2d={'where':_0x456751[_0x68ee('0x3a')]};return db[_0x68ee('0x3d')][_0x68ee('0x20')](_0x11ef2d)['then'](function(_0x1f5e93){_0x285f03[_0x68ee('0x20')]=_0x1f5e93;if(_0x5144f6[_0x68ee('0x31')]['includeAll']){_0x456751[_0x68ee('0x3e')]=[{'all':!![]}];}return db[_0x68ee('0x3d')][_0x68ee('0x3f')](_0x456751);})[_0x68ee('0x26')](function(_0x1b5b0b){_0x285f03[_0x68ee('0x40')]=_0x1b5b0b;return _0x285f03;})[_0x68ee('0x26')](respondWithFilteredResult(_0x293012,_0x456751))[_0x68ee('0x41')](handleError(_0x293012,null));};exports[_0x68ee('0x42')]=function(_0x4dd2fd,_0x510d79){var _0x148a9b={'raw':!![],'where':{'id':_0x4dd2fd[_0x68ee('0x43')]['id']}},_0x17468f={};_0x17468f[_0x68ee('0x2f')]=_[_0x68ee('0x32')](db['SquareDetailsReport'][_0x68ee('0x2c')]);_0x17468f[_0x68ee('0x31')]=_[_0x68ee('0x32')](_0x4dd2fd[_0x68ee('0x31')]);_0x17468f['filters']=_[_0x68ee('0x34')](_0x17468f[_0x68ee('0x2f')],_0x17468f[_0x68ee('0x31')]);_0x148a9b[_0x68ee('0x35')]=_[_0x68ee('0x34')](_0x17468f['model'],qs[_0x68ee('0x36')](_0x4dd2fd['query'][_0x68ee('0x36')]));_0x148a9b['attributes']=_0x148a9b[_0x68ee('0x35')][_0x68ee('0x37')]?_0x148a9b['attributes']:_0x17468f[_0x68ee('0x2f')];if(_0x4dd2fd[_0x68ee('0x31')][_0x68ee('0x44')]){_0x148a9b[_0x68ee('0x3e')]=[{'all':!![]}];}_0x148a9b=_[_0x68ee('0x45')]({},_0x148a9b,_0x4dd2fd[_0x68ee('0x3c')]);return db[_0x68ee('0x3d')]['find'](_0x148a9b)['then'](handleEntityNotFound(_0x510d79,null))['then'](respondWithResult(_0x510d79,null))['catch'](handleError(_0x510d79,null));};exports[_0x68ee('0x46')]=function(_0x38a5d3,_0x41014a){return db['SquareDetailsReport'][_0x68ee('0x46')](_0x38a5d3[_0x68ee('0x47')],{})[_0x68ee('0x26')](respondWithResult(_0x41014a,0xc9))[_0x68ee('0x41')](handleError(_0x41014a,null));};exports['update']=function(_0x371cd5,_0x2313b3){if(_0x371cd5[_0x68ee('0x47')]['id']){delete _0x371cd5[_0x68ee('0x47')]['id'];}return db[_0x68ee('0x3d')][_0x68ee('0x48')]({'where':{'id':_0x371cd5['params']['id']}})[_0x68ee('0x26')](handleEntityNotFound(_0x2313b3,null))[_0x68ee('0x26')](saveUpdates(_0x371cd5['body'],null))['then'](respondWithResult(_0x2313b3,null))[_0x68ee('0x41')](handleError(_0x2313b3,null));};exports[_0x68ee('0x27')]=function(_0x218f2f,_0x3cfd29){return db[_0x68ee('0x3d')][_0x68ee('0x48')]({'where':{'id':_0x218f2f[_0x68ee('0x43')]['id']}})[_0x68ee('0x26')](handleEntityNotFound(_0x3cfd29,null))[_0x68ee('0x26')](removeEntity(_0x3cfd29,null))[_0x68ee('0x41')](handleError(_0x3cfd29,null));};exports[_0x68ee('0x49')]=function(_0x4b0155,_0xc8c888){return db[_0x68ee('0x3d')][_0x68ee('0x49')]()[_0x68ee('0x26')](respondWithResult(_0xc8c888,null))[_0x68ee('0x41')](handleError(_0xc8c888,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d65f447..a08d5a6 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 _0x97eb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','../../config/logger'];(function(_0x4ddef8,_0x3c78fe){var _0x456403=function(_0x439273){while(--_0x439273){_0x4ddef8['push'](_0x4ddef8['shift']());}};_0x456403(++_0x3c78fe);}(_0x97eb,0x15a));var _0xb97e=function(_0x1721e1,_0x1bf64f){_0x1721e1=_0x1721e1-0x0;var _0x85574=_0x97eb[_0x1721e1];return _0x85574;};'use strict';var _=require(_0xb97e('0x0'));var util=require('util');var logger=require(_0xb97e('0x1'))(_0xb97e('0x2'));var moment=require(_0xb97e('0x3'));var BPromise=require(_0xb97e('0x4'));var rp=require(_0xb97e('0x5'));var fs=require('fs');var path=require(_0xb97e('0x6'));var rimraf=require(_0xb97e('0x7'));var config=require(_0xb97e('0x8'));var attributes=require(_0xb97e('0x9'));module['exports']=function(_0xa4119c,_0x33b3a1){return _0xa4119c['define'](_0xb97e('0xa'),attributes,{'tableName':_0xb97e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5193=['request-promise','path','./squareReportDetail.attributes','exports','report_square_details','lodash','../../config/logger','api','bluebird'];(function(_0x985128,_0x291e5c){var _0x3eea66=function(_0xa9a27c){while(--_0xa9a27c){_0x985128['push'](_0x985128['shift']());}};_0x3eea66(++_0x291e5c);}(_0x5193,0xb9));var _0x3519=function(_0x4ae66,_0x29dd16){_0x4ae66=_0x4ae66-0x0;var _0xe5156a=_0x5193[_0x4ae66];return _0xe5156a;};'use strict';var _=require(_0x3519('0x0'));var util=require('util');var logger=require(_0x3519('0x1'))(_0x3519('0x2'));var moment=require('moment');var BPromise=require(_0x3519('0x3'));var rp=require(_0x3519('0x4'));var fs=require('fs');var path=require(_0x3519('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3519('0x6'));module[_0x3519('0x7')]=function(_0x4264a1,_0x1cea85){return _0x4264a1['define']('SquareDetailsReport',attributes,{'tableName':_0x3519('0x8'),'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 46f2549..0d14f00 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 _0x8a5c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareDetailsReport','create','options','lodash','util'];(function(_0x5c74ed,_0x35bc38){var _0x1d96bb=function(_0x1dedd3){while(--_0x1dedd3){_0x5c74ed['push'](_0x5c74ed['shift']());}};_0x1d96bb(++_0x35bc38);}(_0x8a5c,0x136));var _0xc8a5=function(_0x31dfdc,_0x560055){_0x31dfdc=_0x31dfdc-0x0;var _0xead416=_0x8a5c[_0x31dfdc];return _0xead416;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var moment=require(_0xc8a5('0x2'));var BPromise=require(_0xc8a5('0x3'));var rs=require(_0xc8a5('0x4'));var fs=require('fs');var Redis=require(_0xc8a5('0x5'));var db=require(_0xc8a5('0x6'))['db'];var utils=require(_0xc8a5('0x7'));var logger=require(_0xc8a5('0x8'))('rpc');var config=require(_0xc8a5('0x9'));var jayson=require(_0xc8a5('0xa'));var client=jayson['client'][_0xc8a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcee97e,_0xd6de78,_0xa9f42c){return new BPromise(function(_0x4d25e4,_0x3ecf08){return client[_0xc8a5('0xc')](_0xcee97e,_0xa9f42c)[_0xc8a5('0xd')](function(_0x2c1fe9){logger[_0xc8a5('0xe')](_0xc8a5('0xf'),_0xd6de78,_0xc8a5('0x10'));logger[_0xc8a5('0x11')](_0xc8a5('0x12'),_0xd6de78,'request\x20sent',JSON['stringify'](_0x2c1fe9));if(_0x2c1fe9[_0xc8a5('0x13')]){if(_0x2c1fe9['error'][_0xc8a5('0x14')]===0x1f4){logger[_0xc8a5('0x13')](_0xc8a5('0xf'),_0xd6de78,_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);return _0x3ecf08(_0x2c1fe9['error'][_0xc8a5('0x15')]);}logger[_0xc8a5('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0xd6de78,_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);return _0x4d25e4(_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);}else{logger[_0xc8a5('0xe')](_0xc8a5('0xf'),_0xd6de78,'request\x20sent');_0x4d25e4(_0x2c1fe9[_0xc8a5('0x16')][_0xc8a5('0x15')]);}})['catch'](function(_0x36a78b){logger[_0xc8a5('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0xd6de78,_0x36a78b);_0x3ecf08(_0x36a78b);});});}exports[_0xc8a5('0x17')]=function(_0x3ef8d3){var _0x12a441=this;return new Promise(function(_0x1326e2,_0x1ea105){return db['SquareDetailsReport'][_0xc8a5('0x18')](_0x3ef8d3['body'],{'raw':_0x3ef8d3[_0xc8a5('0x19')]?_0x3ef8d3[_0xc8a5('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x866737){logger[_0xc8a5('0xe')](_0xc8a5('0x17'),_0x3ef8d3);logger[_0xc8a5('0x11')](_0xc8a5('0x17'),_0x3ef8d3,JSON['stringify'](_0x866737));_0x1326e2(_0x866737);})['catch'](function(_0x3e2058){logger[_0xc8a5('0x13')](_0xc8a5('0x17'),_0x3e2058[_0xc8a5('0x15')],_0x3ef8d3);_0x1ea105(_0x12a441[_0xc8a5('0x13')](0x1f4,_0x3e2058[_0xc8a5('0x15')]));});});}; \ No newline at end of file +var _0x02ce=['message','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a7d5d,_0x13f98f){var _0x5d38e3=function(_0x3d765a){while(--_0x3d765a){_0x4a7d5d['push'](_0x4a7d5d['shift']());}};_0x5d38e3(++_0x13f98f);}(_0x02ce,0x1ac));var _0xe02c=function(_0xad21f6,_0x3dd8b5){_0xad21f6=_0xad21f6-0x0;var _0x15c9c4=_0x02ce[_0xad21f6];return _0x15c9c4;};'use strict';var _=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var moment=require(_0xe02c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe02c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe02c('0x4'))['db'];var utils=require(_0xe02c('0x5'));var logger=require(_0xe02c('0x6'))(_0xe02c('0x7'));var config=require(_0xe02c('0x8'));var jayson=require(_0xe02c('0x9'));var client=jayson[_0xe02c('0xa')][_0xe02c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a87f,_0x4fecb3,_0x5eabb0){return new BPromise(function(_0x3c757e,_0x2d85d7){return client[_0xe02c('0xc')](_0x36a87f,_0x5eabb0)[_0xe02c('0xd')](function(_0x2afbf5){logger[_0xe02c('0xe')](_0xe02c('0xf'),_0x4fecb3,_0xe02c('0x10'));logger[_0xe02c('0x11')](_0xe02c('0x12'),_0x4fecb3,_0xe02c('0x10'),JSON[_0xe02c('0x13')](_0x2afbf5));if(_0x2afbf5[_0xe02c('0x14')]){if(_0x2afbf5[_0xe02c('0x14')][_0xe02c('0x15')]===0x1f4){logger[_0xe02c('0x14')](_0xe02c('0xf'),_0x4fecb3,_0x2afbf5[_0xe02c('0x14')]['message']);return _0x2d85d7(_0x2afbf5[_0xe02c('0x14')]['message']);}logger['error'](_0xe02c('0xf'),_0x4fecb3,_0x2afbf5['error'][_0xe02c('0x16')]);return _0x3c757e(_0x2afbf5['error'][_0xe02c('0x16')]);}else{logger['info'](_0xe02c('0xf'),_0x4fecb3,_0xe02c('0x10'));_0x3c757e(_0x2afbf5['result'][_0xe02c('0x16')]);}})[_0xe02c('0x17')](function(_0x51676c){logger[_0xe02c('0x14')](_0xe02c('0xf'),_0x4fecb3,_0x51676c);_0x2d85d7(_0x51676c);});});}exports['CreateSquareDetailsReport']=function(_0x52917f){var _0x3e37bf=this;return new Promise(function(_0x49604a,_0x1f8f37){return db[_0xe02c('0x18')][_0xe02c('0x19')](_0x52917f[_0xe02c('0x1a')],{'raw':_0x52917f[_0xe02c('0x1b')]?_0x52917f['options'][_0xe02c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4ea9b5){logger[_0xe02c('0xe')](_0xe02c('0x1d'),_0x52917f);logger['debug'](_0xe02c('0x1d'),_0x52917f,JSON[_0xe02c('0x13')](_0x4ea9b5));_0x49604a(_0x4ea9b5);})['catch'](function(_0x38dce2){logger[_0xe02c('0x14')](_0xe02c('0x1d'),_0x38dce2[_0xe02c('0x16')],_0x52917f);_0x1f8f37(_0x3e37bf[_0xe02c('0x14')](0x1f4,_0x38dce2[_0xe02c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f04e0e5..057ca3f 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 _0x7bcd=['exports','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess'];(function(_0x1f4d8b,_0x4f1e64){var _0x372868=function(_0x671ea2){while(--_0x671ea2){_0x1f4d8b['push'](_0x1f4d8b['shift']());}};_0x372868(++_0x4f1e64);}(_0x7bcd,0x19e));var _0xd7bc=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x7bcd[_0x148879];return _0x4f7027;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xd7bc('0x0'));var controller=require(_0xd7bc('0x1'));router[_0xd7bc('0x2')]('/',auth[_0xd7bc('0x3')](),controller['index']);router[_0xd7bc('0x2')](_0xd7bc('0x4'),auth[_0xd7bc('0x3')](),controller[_0xd7bc('0x5')]);module[_0xd7bc('0x6')]=router; \ No newline at end of file +var _0x8126=['express','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','exports'];(function(_0x2bf40f,_0x36c9da){var _0x57c391=function(_0x1be4da){while(--_0x1be4da){_0x2bf40f['push'](_0x2bf40f['shift']());}};_0x57c391(++_0x36c9da);}(_0x8126,0xea));var _0x6812=function(_0x48da45,_0x259bea){_0x48da45=_0x48da45-0x0;var _0x5d5687=_0x8126[_0x48da45];return _0x5d5687;};'use strict';var express=require(_0x6812('0x0'));var router=express[_0x6812('0x1')]();var auth=require(_0x6812('0x2'));var controller=require(_0x6812('0x3'));router[_0x6812('0x4')]('/',auth['isAuthenticated'](),controller[_0x6812('0x5')]);router[_0x6812('0x4')](_0x6812('0x6'),auth[_0x6812('0x7')](),controller['killProcess']);module[_0x6812('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0c0731a..f1f02a6 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 _0xfdc5=['params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0xfdc5,0xbc));var _0x5fdc=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0xfdc5[_0xd39959];return _0x1ff69c;};'use strict';var info=require(_0x5fdc('0x0'));var exec=require(_0x5fdc('0x1'))['exec'];var logger=require(_0x5fdc('0x2'))(_0x5fdc('0x3'));var util=require(_0x5fdc('0x4'));var BPromise=require(_0x5fdc('0x5'));var _=require(_0x5fdc('0x6'));function handleError(_0x460592,_0xd2910b,_0x34fa58){_0xd2910b=_0xd2910b||0x1f4;return function(_0xec9ff0){logger[_0x5fdc('0x7')](_0x5fdc('0x8'),_0x34fa58,_0xd2910b,util[_0x5fdc('0x9')](_0xec9ff0,{'showHidden':![],'depth':null}));delete _0xec9ff0[_0x5fdc('0xa')];_0x460592[_0x5fdc('0xb')](_0xd2910b)[_0x5fdc('0xc')](_0xec9ff0);};}exports[_0x5fdc('0xd')]=function(_0x41a605,_0x2840aa){return info[_0x5fdc('0xe')]()[_0x5fdc('0xf')](function(_0x44f662){return _0x2840aa['status'](0xc8)[_0x5fdc('0x10')](_0x44f662);})[_0x5fdc('0x11')](function(_0x4cbdee){return _0x2840aa[_0x5fdc('0xb')](0x1f4)[_0x5fdc('0x10')](_0x4cbdee);});};exports[_0x5fdc('0x12')]=function(_0x5101c4,_0x23ae5c){var _0x5238dc=[_0x5fdc('0x13')];return new BPromise(function(_0x5aa87f,_0x395da1){return exec(util[_0x5fdc('0x14')](_0x5fdc('0x15'),_0x5101c4[_0x5fdc('0x16')][_0x5fdc('0x17')]),function(_0x2a490c,_0x33a89e,_0x1b9c69){if(_0x2a490c){return _0x395da1(_0x2a490c);}return _0x5aa87f(_0x33a89e);});})[_0x5fdc('0xf')](function(_0x4638a6){var _0x32560e=![];var _0x5f0c28=_0x4638a6['split'](/\n/);for(var _0x343ac9=0x0,_0x27cb09=_0x5238dc[_0x5fdc('0x18')];_0x343ac9<_0x27cb09,_0x32560e===![];_0x343ac9+=0x1){if(_0x4638a6[_0x5fdc('0x19')](_0x5238dc[_0x343ac9])>=0x0){_0x32560e=!![];}}if(!_0x32560e){throw new Error(util['format'](_0x5fdc('0x1a'),_0x5101c4[_0x5fdc('0x16')]['pid']));}process[_0x5fdc('0x1b')](_0x5101c4[_0x5fdc('0x16')][_0x5fdc('0x17')],_0x5fdc('0x1c'));return _0x23ae5c[_0x5fdc('0xb')](0xc8)[_0x5fdc('0x10')]({'message':util[_0x5fdc('0x14')](_0x5fdc('0x1d'),_0x5101c4['params'][_0x5fdc('0x17')])});})[_0x5fdc('0x11')](handleError(_0x23ae5c,null,'killProcess'));}; \ No newline at end of file +var _0x7fc7=['catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','then','json'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7fc7,0x16d));var _0x77fc=function(_0x2af772,_0x3fd540){_0x2af772=_0x2af772-0x0;var _0x5eeb58=_0x7fc7[_0x2af772];return _0x5eeb58;};'use strict';var info=require(_0x77fc('0x0'));var exec=require('child_process')[_0x77fc('0x1')];var logger=require(_0x77fc('0x2'))('api');var util=require('util');var BPromise=require(_0x77fc('0x3'));var _=require(_0x77fc('0x4'));function handleError(_0xdfe67a,_0x5173dd,_0x51cb4){_0x5173dd=_0x5173dd||0x1f4;return function(_0x3b71f4){logger[_0x77fc('0x5')](_0x77fc('0x6'),_0x51cb4,_0x5173dd,util[_0x77fc('0x7')](_0x3b71f4,{'showHidden':![],'depth':null}));delete _0x3b71f4[_0x77fc('0x8')];_0xdfe67a[_0x77fc('0x9')](_0x5173dd)['send'](_0x3b71f4);};}exports[_0x77fc('0xa')]=function(_0x5e0401,_0x4bcabd){return info['getAllData']()[_0x77fc('0xb')](function(_0x493fbf){return _0x4bcabd[_0x77fc('0x9')](0xc8)[_0x77fc('0xc')](_0x493fbf);})[_0x77fc('0xd')](function(_0x551a8e){return _0x4bcabd[_0x77fc('0x9')](0x1f4)[_0x77fc('0xc')](_0x551a8e);});};exports[_0x77fc('0xe')]=function(_0x11dc98,_0x4ff64b){var _0x2e3312=[_0x77fc('0xf')];return new BPromise(function(_0x1dbf25,_0x278e5f){return exec(util[_0x77fc('0x10')](_0x77fc('0x11'),_0x11dc98[_0x77fc('0x12')][_0x77fc('0x13')]),function(_0x33bb87,_0x15f97f,_0x439352){if(_0x33bb87){return _0x278e5f(_0x33bb87);}return _0x1dbf25(_0x15f97f);});})[_0x77fc('0xb')](function(_0x155a78){var _0x3f9874=![];var _0x5db184=_0x155a78[_0x77fc('0x14')](/\n/);for(var _0x31595c=0x0,_0x3af8cf=_0x2e3312[_0x77fc('0x15')];_0x31595c<_0x3af8cf,_0x3f9874===![];_0x31595c+=0x1){if(_0x155a78[_0x77fc('0x16')](_0x2e3312[_0x31595c])>=0x0){_0x3f9874=!![];}}if(!_0x3f9874){throw new Error(util['format'](_0x77fc('0x17'),_0x11dc98[_0x77fc('0x12')][_0x77fc('0x13')]));}process[_0x77fc('0x18')](_0x11dc98[_0x77fc('0x12')][_0x77fc('0x13')],_0x77fc('0x19'));return _0x4ff64b['status'](0xc8)[_0x77fc('0xc')]({'message':util[_0x77fc('0x10')](_0x77fc('0x1a'),_0x11dc98[_0x77fc('0x12')][_0x77fc('0x13')])});})[_0x77fc('0xd')](handleError(_0x4ff64b,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6425c2a..6d9403b 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 _0xfd49=['./tag.controller','isAuthenticated','index','get','show','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3d19ec,_0x5ca7de){var _0x416102=function(_0x14e2de){while(--_0x14e2de){_0x3d19ec['push'](_0x3d19ec['shift']());}};_0x416102(++_0x5ca7de);}(_0xfd49,0x91));var _0x9fd4=function(_0x2969e0,_0x298a10){_0x2969e0=_0x2969e0-0x0;var _0x55dea1=_0xfd49[_0x2969e0];return _0x55dea1;};'use strict';var multer=require(_0x9fd4('0x0'));var util=require(_0x9fd4('0x1'));var path=require(_0x9fd4('0x2'));var timeout=require(_0x9fd4('0x3'));var express=require(_0x9fd4('0x4'));var router=express[_0x9fd4('0x5')]();var fs_extra=require(_0x9fd4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9fd4('0x7'));router['get']('/',auth[_0x9fd4('0x8')](),controller[_0x9fd4('0x9')]);router[_0x9fd4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9fd4('0xb')]);router[_0x9fd4('0xc')]('/',auth[_0x9fd4('0x8')](),controller[_0x9fd4('0xd')]);router[_0x9fd4('0xe')]('/:id',auth[_0x9fd4('0x8')](),controller['update']);router[_0x9fd4('0xf')](_0x9fd4('0x10'),auth[_0x9fd4('0x8')](),controller[_0x9fd4('0x11')]);module[_0x9fd4('0x12')]=router; \ No newline at end of file +var _0xdc15=['create','put','exports','multer','path','connect-timeout','express','Router','fs-extra','./tag.controller','index','get','/:id','isAuthenticated','show','post'];(function(_0x1ca3dc,_0x1f4035){var _0x3f7364=function(_0x408420){while(--_0x408420){_0x1ca3dc['push'](_0x1ca3dc['shift']());}};_0x3f7364(++_0x1f4035);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0xdc15[_0x4191bc];return _0x1ffd4e;};'use strict';var multer=require(_0x5dc1('0x0'));var util=require('util');var path=require(_0x5dc1('0x1'));var timeout=require(_0x5dc1('0x2'));var express=require(_0x5dc1('0x3'));var router=express[_0x5dc1('0x4')]();var fs_extra=require(_0x5dc1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5dc1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5dc1('0x7')]);router[_0x5dc1('0x8')](_0x5dc1('0x9'),auth[_0x5dc1('0xa')](),controller[_0x5dc1('0xb')]);router[_0x5dc1('0xc')]('/',auth[_0x5dc1('0xa')](),controller[_0x5dc1('0xd')]);router[_0x5dc1('0xe')](_0x5dc1('0x9'),auth[_0x5dc1('0xa')](),controller['update']);router['delete'](_0x5dc1('0x9'),auth[_0x5dc1('0xa')](),controller['destroy']);module[_0x5dc1('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 3c559b8..005d545 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 _0xaa2d=['#0091EA','STRING','exports'];(function(_0x279df3,_0x820fcc){var _0xef8a1f=function(_0x4275f7){while(--_0x4275f7){_0x279df3['push'](_0x279df3['shift']());}};_0xef8a1f(++_0x820fcc);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdaa2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xdaa2('0x1')},'description':{'type':Sequelize[_0xdaa2('0x2')]}}; \ No newline at end of file +var _0xd84c=['STRING','name','#0091EA','sequelize','exports'];(function(_0x2dcaad,_0x11b802){var _0x4f339b=function(_0x160ac4){while(--_0x160ac4){_0x2dcaad['push'](_0x2dcaad['shift']());}};_0x4f339b(++_0x11b802);}(_0xd84c,0x102));var _0xcd84=function(_0x5d50f6,_0x2a0612){_0x5d50f6=_0x5d50f6-0x0;var _0x2c7088=_0xd84c[_0x5d50f6];return _0x2c7088;};'use strict';var Sequelize=require(_0xcd84('0x0'));module[_0xcd84('0x1')]={'name':{'type':Sequelize[_0xcd84('0x2')],'unique':_0xcd84('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':_0xcd84('0x4')},'description':{'type':Sequelize[_0xcd84('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 01e9c13..3eb39b4 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 _0xa588=['apply','reject','save','update','then','destroy','get','Tags','sendStatus','error','index','map','Tag','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x2fb045,_0x5631b2){var _0x3ecb22=function(_0x3f72f5){while(--_0x3f72f5){_0x2fb045['push'](_0x2fb045['shift']());}};_0x3ecb22(++_0x5631b2);}(_0xa588,0xe1));var _0x8a58=function(_0x4b2b5a,_0x3f7555){_0x4b2b5a=_0x4b2b5a-0x0;var _0x47f812=_0xa588[_0x4b2b5a];return _0x47f812;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a58('0x0'));var zipdir=require(_0x8a58('0x1'));var jsonpatch=require(_0x8a58('0x2'));var rp=require(_0x8a58('0x3'));var moment=require(_0x8a58('0x4'));var BPromise=require(_0x8a58('0x5'));var Mustache=require(_0x8a58('0x6'));var util=require(_0x8a58('0x7'));var path=require(_0x8a58('0x8'));var sox=require('sox');var csv=require(_0x8a58('0x9'));var ejs=require(_0x8a58('0xa'));var fs=require('fs');var fs_extra=require(_0x8a58('0xb'));var _=require(_0x8a58('0xc'));var squel=require(_0x8a58('0xd'));var crypto=require(_0x8a58('0xe'));var jsforce=require(_0x8a58('0xf'));var deskjs=require(_0x8a58('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a58('0x11'));var Papa=require(_0x8a58('0x12'));var Redis=require(_0x8a58('0x13'));var authService=require(_0x8a58('0x14'));var qs=require(_0x8a58('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a58('0x16'));var logger=require(_0x8a58('0x17'))(_0x8a58('0x18'));var utils=require(_0x8a58('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a58('0x1a'))['db'];function respondWithStatusCode(_0x5ec103,_0x21208d){_0x21208d=_0x21208d||0xcc;return function(_0xc5d2fa){if(_0xc5d2fa){return _0x5ec103['sendStatus'](_0x21208d);}return _0x5ec103[_0x8a58('0x1b')](_0x21208d)[_0x8a58('0x1c')]();};}function respondWithResult(_0x56a61d,_0x3d40a5){_0x3d40a5=_0x3d40a5||0xc8;return function(_0x268506){if(_0x268506){return _0x56a61d['status'](_0x3d40a5)[_0x8a58('0x1d')](_0x268506);}};}function respondWithFilteredResult(_0x18a33c,_0x3010ae){return function(_0x3ff39e){if(_0x3ff39e){var _0x26e3a8=typeof _0x3010ae[_0x8a58('0x1e')]===_0x8a58('0x1f')&&typeof _0x3010ae['limit']==='undefined';var _0x31de8d=_0x3ff39e[_0x8a58('0x20')];var _0x18a14d=_0x26e3a8?0x0:_0x3010ae['offset'];var _0x282f2d=_0x26e3a8?_0x3ff39e[_0x8a58('0x20')]:_0x3010ae['offset']+_0x3010ae[_0x8a58('0x21')];var _0x15b527;if(_0x282f2d>=_0x31de8d){_0x282f2d=_0x31de8d;_0x15b527=0xc8;}else{_0x15b527=0xce;}_0x18a33c[_0x8a58('0x1b')](_0x15b527);return _0x18a33c[_0x8a58('0x22')](_0x8a58('0x23'),_0x18a14d+'-'+_0x282f2d+'/'+_0x31de8d)[_0x8a58('0x1d')](_0x3ff39e);}return null;};}function patchUpdates(_0x284bb8){return function(_0x115e19){try{jsonpatch[_0x8a58('0x24')](_0x115e19,_0x284bb8,!![]);}catch(_0xbf556a){return BPromise[_0x8a58('0x25')](_0xbf556a);}return _0x115e19[_0x8a58('0x26')]();};}function saveUpdates(_0x3758fa,_0x34adb8){return function(_0x561a9a){if(_0x561a9a){return _0x561a9a[_0x8a58('0x27')](_0x3758fa)[_0x8a58('0x28')](function(_0x20a6c5){return _0x20a6c5;});}return null;};}function removeEntity(_0x3f07ab,_0x22c898){return function(_0x415946){if(_0x415946){return _0x415946[_0x8a58('0x29')]()['then'](function(){var _0x1ff181=_0x415946[_0x8a58('0x2a')]({'plain':!![]});var _0x30c96b=_0x8a58('0x2b');return db['UserProfileResource'][_0x8a58('0x29')]({'where':{'type':_0x30c96b,'resourceId':_0x1ff181['id']}})[_0x8a58('0x28')](function(){return _0x415946;});})[_0x8a58('0x28')](function(){_0x3f07ab['status'](0xcc)[_0x8a58('0x1c')]();});}};}function handleEntityNotFound(_0x31abcc,_0x4426ff){return function(_0x27d7c8){if(!_0x27d7c8){_0x31abcc[_0x8a58('0x2c')](0x194);}return _0x27d7c8;};}function handleError(_0x3e317f,_0x1a411a){_0x1a411a=_0x1a411a||0x1f4;return function(_0x4d5041){logger[_0x8a58('0x2d')](_0x4d5041['stack']);if(_0x4d5041['name']){delete _0x4d5041['name'];}_0x3e317f['status'](_0x1a411a)['send'](_0x4d5041);};}exports[_0x8a58('0x2e')]=function(_0x175235,_0x1b2d9e){var _0x205b41={},_0x5dc010={},_0x261096={'count':0x0,'rows':[]};var _0x2a20ad=_[_0x8a58('0x2f')](db[_0x8a58('0x30')][_0x8a58('0x31')],function(_0x8ab99c){return{'name':_0x8ab99c[_0x8a58('0x32')],'type':_0x8ab99c[_0x8a58('0x33')]['key']};});_0x5dc010[_0x8a58('0x34')]=_[_0x8a58('0x2f')](_0x2a20ad,_0x8a58('0x35'));_0x5dc010[_0x8a58('0x36')]=_[_0x8a58('0x37')](_0x175235[_0x8a58('0x36')]);_0x5dc010['filters']=_[_0x8a58('0x38')](_0x5dc010[_0x8a58('0x34')],_0x5dc010[_0x8a58('0x36')]);_0x205b41[_0x8a58('0x39')]=_[_0x8a58('0x38')](_0x5dc010[_0x8a58('0x34')],qs[_0x8a58('0x3a')](_0x175235['query'][_0x8a58('0x3a')]));_0x205b41[_0x8a58('0x39')]=_0x205b41[_0x8a58('0x39')]['length']?_0x205b41['attributes']:_0x5dc010['model'];if(!_0x175235[_0x8a58('0x36')][_0x8a58('0x3b')](_0x8a58('0x3c'))){_0x205b41[_0x8a58('0x21')]=qs['limit'](_0x175235[_0x8a58('0x36')][_0x8a58('0x21')]);_0x205b41[_0x8a58('0x1e')]=qs[_0x8a58('0x1e')](_0x175235['query'][_0x8a58('0x1e')]);}_0x205b41[_0x8a58('0x3d')]=qs['sort'](_0x175235[_0x8a58('0x36')][_0x8a58('0x3e')]);_0x205b41[_0x8a58('0x3f')]=qs[_0x8a58('0x40')](_[_0x8a58('0x41')](_0x175235[_0x8a58('0x36')],_0x5dc010['filters']),_0x2a20ad);if(_0x175235['query'][_0x8a58('0x42')]){_0x205b41[_0x8a58('0x3f')]=_['merge'](_0x205b41[_0x8a58('0x3f')],{'$or':_[_0x8a58('0x2f')](_0x2a20ad,function(_0x478454){if(_0x478454[_0x8a58('0x33')]!==_0x8a58('0x43')){var _0x4e9e04={};_0x4e9e04[_0x478454[_0x8a58('0x35')]]={'$like':'%'+_0x175235['query'][_0x8a58('0x42')]+'%'};return _0x4e9e04;}})});}_0x205b41=_[_0x8a58('0x44')]({},_0x205b41,_0x175235[_0x8a58('0x45')]);var _0x40ca09={'where':_0x205b41[_0x8a58('0x3f')]};return db[_0x8a58('0x30')][_0x8a58('0x20')](_0x40ca09)['then'](function(_0x5cd9d8){_0x261096[_0x8a58('0x20')]=_0x5cd9d8;if(_0x175235['query']['includeAll']){_0x205b41[_0x8a58('0x46')]=[{'all':!![]}];}return db[_0x8a58('0x30')][_0x8a58('0x47')](_0x205b41);})['then'](function(_0x56a410){_0x261096[_0x8a58('0x48')]=_0x56a410;return _0x261096;})['then'](respondWithFilteredResult(_0x1b2d9e,_0x205b41))[_0x8a58('0x49')](handleError(_0x1b2d9e,null));};exports[_0x8a58('0x4a')]=function(_0x3feec0,_0x3faae2){var _0x4c9c56={'raw':!![],'where':{'id':_0x3feec0[_0x8a58('0x4b')]['id']}},_0x417951={};_0x417951['model']=_[_0x8a58('0x37')](db[_0x8a58('0x30')][_0x8a58('0x31')]);_0x417951[_0x8a58('0x36')]=_['keys'](_0x3feec0[_0x8a58('0x36')]);_0x417951['filters']=_[_0x8a58('0x38')](_0x417951[_0x8a58('0x34')],_0x417951['query']);_0x4c9c56[_0x8a58('0x39')]=_['intersection'](_0x417951['model'],qs[_0x8a58('0x3a')](_0x3feec0[_0x8a58('0x36')][_0x8a58('0x3a')]));_0x4c9c56[_0x8a58('0x39')]=_0x4c9c56[_0x8a58('0x39')][_0x8a58('0x4c')]?_0x4c9c56['attributes']:_0x417951['model'];if(_0x3feec0[_0x8a58('0x36')][_0x8a58('0x4d')]){_0x4c9c56[_0x8a58('0x46')]=[{'all':!![]}];}_0x4c9c56=_[_0x8a58('0x44')]({},_0x4c9c56,_0x3feec0[_0x8a58('0x45')]);return db[_0x8a58('0x30')][_0x8a58('0x4e')](_0x4c9c56)[_0x8a58('0x28')](handleEntityNotFound(_0x3faae2,null))[_0x8a58('0x28')](respondWithResult(_0x3faae2,null))[_0x8a58('0x49')](handleError(_0x3faae2,null));};exports[_0x8a58('0x4f')]=function(_0x392c32,_0x1ea824){return db[_0x8a58('0x30')]['create'](_0x392c32[_0x8a58('0x50')],{})[_0x8a58('0x28')](function(_0xeb5231){var _0x409f9e=_0x392c32[_0x8a58('0x51')][_0x8a58('0x2a')]({'plain':!![]});if(!_0x409f9e)throw new Error(_0x8a58('0x52'));if(_0x409f9e['role']==='user'){var _0x5ab682=_0xeb5231[_0x8a58('0x2a')]({'plain':!![]});var _0xe0ed75=_0x8a58('0x2b');return db['UserProfileSection'][_0x8a58('0x4e')]({'where':{'name':_0xe0ed75,'userProfileId':_0x409f9e[_0x8a58('0x53')]},'raw':!![]})[_0x8a58('0x28')](function(_0x3ad78c){if(_0x3ad78c&&_0x3ad78c[_0x8a58('0x54')]===0x0){return db[_0x8a58('0x55')][_0x8a58('0x4f')]({'name':_0x5ab682[_0x8a58('0x35')],'resourceId':_0x5ab682['id'],'type':_0x3ad78c[_0x8a58('0x35')],'sectionId':_0x3ad78c['id']},{})[_0x8a58('0x28')](function(){return _0xeb5231;});}else{return _0xeb5231;}})[_0x8a58('0x49')](function(_0x130406){logger['error'](_0x8a58('0x56'),_0x130406);throw _0x130406;});}return _0xeb5231;})[_0x8a58('0x28')](respondWithResult(_0x1ea824,0xc9))['catch'](handleError(_0x1ea824,null));};exports[_0x8a58('0x27')]=function(_0xfab1e4,_0x1ce5e0){if(_0xfab1e4['body']['id']){delete _0xfab1e4[_0x8a58('0x50')]['id'];}return db['Tag'][_0x8a58('0x4e')]({'where':{'id':_0xfab1e4[_0x8a58('0x4b')]['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x1ce5e0,null))[_0x8a58('0x28')](saveUpdates(_0xfab1e4[_0x8a58('0x50')],null))[_0x8a58('0x28')](respondWithResult(_0x1ce5e0,null))[_0x8a58('0x49')](handleError(_0x1ce5e0,null));};exports[_0x8a58('0x29')]=function(_0x2c4a18,_0x53fbde){return db[_0x8a58('0x30')][_0x8a58('0x4e')]({'where':{'id':_0x2c4a18[_0x8a58('0x4b')]['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x53fbde,null))[_0x8a58('0x28')](removeEntity(_0x53fbde,null))['catch'](handleError(_0x53fbde,null));}; \ No newline at end of file +var _0xb43b=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','keys','include','options','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','sendStatus','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields'];(function(_0x15fcff,_0x1f261d){var _0x523532=function(_0x4d3cc5){while(--_0x4d3cc5){_0x15fcff['push'](_0x15fcff['shift']());}};_0x523532(++_0x1f261d);}(_0xb43b,0xbf));var _0xbb43=function(_0x26be9d,_0x2b441d){_0x26be9d=_0x26be9d-0x0;var _0x5068c0=_0xb43b[_0x26be9d];return _0x5068c0;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x1'));var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require(_0xbb43('0x9'));var csv=require(_0xbb43('0xa'));var ejs=require(_0xbb43('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xa'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2867fb,_0x5d0ccc){_0x5d0ccc=_0x5d0ccc||0xcc;return function(_0x6be368){if(_0x6be368){return _0x2867fb['sendStatus'](_0x5d0ccc);}return _0x2867fb[_0xbb43('0x17')](_0x5d0ccc)[_0xbb43('0x18')]();};}function respondWithResult(_0x3ce968,_0x3327bc){_0x3327bc=_0x3327bc||0xc8;return function(_0x2e2517){if(_0x2e2517){return _0x3ce968['status'](_0x3327bc)[_0xbb43('0x19')](_0x2e2517);}};}function respondWithFilteredResult(_0x4ac25c,_0x199726){return function(_0x32425c){if(_0x32425c){var _0x15182b=typeof _0x199726[_0xbb43('0x1a')]===_0xbb43('0x1b')&&typeof _0x199726[_0xbb43('0x1c')]===_0xbb43('0x1b');var _0x209c9c=_0x32425c[_0xbb43('0x1d')];var _0x4c223b=_0x15182b?0x0:_0x199726[_0xbb43('0x1a')];var _0x4cb0b2=_0x15182b?_0x32425c[_0xbb43('0x1d')]:_0x199726['offset']+_0x199726[_0xbb43('0x1c')];var _0x5f4b4f;if(_0x4cb0b2>=_0x209c9c){_0x4cb0b2=_0x209c9c;_0x5f4b4f=0xc8;}else{_0x5f4b4f=0xce;}_0x4ac25c[_0xbb43('0x17')](_0x5f4b4f);return _0x4ac25c[_0xbb43('0x1e')]('Content-Range',_0x4c223b+'-'+_0x4cb0b2+'/'+_0x209c9c)[_0xbb43('0x19')](_0x32425c);}return null;};}function patchUpdates(_0x6cdc26){return function(_0x398ce5){try{jsonpatch[_0xbb43('0x1f')](_0x398ce5,_0x6cdc26,!![]);}catch(_0x22c5d1){return BPromise[_0xbb43('0x20')](_0x22c5d1);}return _0x398ce5[_0xbb43('0x21')]();};}function saveUpdates(_0x1e83cd,_0x3409d0){return function(_0x3cb6d1){if(_0x3cb6d1){return _0x3cb6d1[_0xbb43('0x22')](_0x1e83cd)[_0xbb43('0x23')](function(_0x36992f){return _0x36992f;});}return null;};}function removeEntity(_0x37beb0,_0x500af4){return function(_0x28b3e4){if(_0x28b3e4){return _0x28b3e4[_0xbb43('0x24')]()['then'](function(){var _0x464b4a=_0x28b3e4[_0xbb43('0x25')]({'plain':!![]});var _0x25279b='Tags';return db['UserProfileResource'][_0xbb43('0x24')]({'where':{'type':_0x25279b,'resourceId':_0x464b4a['id']}})[_0xbb43('0x23')](function(){return _0x28b3e4;});})['then'](function(){_0x37beb0['status'](0xcc)[_0xbb43('0x18')]();});}};}function handleEntityNotFound(_0xb9fe3b,_0x268fb5){return function(_0x4bb859){if(!_0x4bb859){_0xb9fe3b[_0xbb43('0x26')](0x194);}return _0x4bb859;};}function handleError(_0x426cec,_0x2dcc60){_0x2dcc60=_0x2dcc60||0x1f4;return function(_0x1a6e2b){logger['error'](_0x1a6e2b[_0xbb43('0x27')]);if(_0x1a6e2b[_0xbb43('0x28')]){delete _0x1a6e2b[_0xbb43('0x28')];}_0x426cec[_0xbb43('0x17')](_0x2dcc60)[_0xbb43('0x29')](_0x1a6e2b);};}exports[_0xbb43('0x2a')]=function(_0x2860d8,_0x48986d){var _0x3b2290={},_0x209244={},_0x3c46c6={'count':0x0,'rows':[]};var _0x5b8a7d=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')],function(_0x168374){return{'name':_0x168374[_0xbb43('0x2e')],'type':_0x168374[_0xbb43('0x2f')][_0xbb43('0x30')]};});_0x209244[_0xbb43('0x31')]=_[_0xbb43('0x2b')](_0x5b8a7d,'name');_0x209244['query']=_['keys'](_0x2860d8['query']);_0x209244[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x209244[_0xbb43('0x31')],_0x209244[_0xbb43('0x34')]);_0x3b2290[_0xbb43('0x35')]=_[_0xbb43('0x33')](_0x209244[_0xbb43('0x31')],qs[_0xbb43('0x36')](_0x2860d8['query'][_0xbb43('0x36')]));_0x3b2290[_0xbb43('0x35')]=_0x3b2290[_0xbb43('0x35')][_0xbb43('0x37')]?_0x3b2290['attributes']:_0x209244[_0xbb43('0x31')];if(!_0x2860d8[_0xbb43('0x34')][_0xbb43('0x38')](_0xbb43('0x39'))){_0x3b2290['limit']=qs[_0xbb43('0x1c')](_0x2860d8['query'][_0xbb43('0x1c')]);_0x3b2290[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x2860d8[_0xbb43('0x34')][_0xbb43('0x1a')]);}_0x3b2290[_0xbb43('0x3a')]=qs[_0xbb43('0x3b')](_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3b')]);_0x3b2290[_0xbb43('0x3c')]=qs[_0xbb43('0x32')](_[_0xbb43('0x3d')](_0x2860d8['query'],_0x209244[_0xbb43('0x32')]),_0x5b8a7d);if(_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3e')]){_0x3b2290[_0xbb43('0x3c')]=_[_0xbb43('0x3f')](_0x3b2290[_0xbb43('0x3c')],{'$or':_[_0xbb43('0x2b')](_0x5b8a7d,function(_0x3d7d56){if(_0x3d7d56[_0xbb43('0x2f')]!==_0xbb43('0x40')){var _0x1fe204={};_0x1fe204[_0x3d7d56[_0xbb43('0x28')]]={'$like':'%'+_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3e')]+'%'};return _0x1fe204;}})});}_0x3b2290=_[_0xbb43('0x3f')]({},_0x3b2290,_0x2860d8['options']);var _0x4807a3={'where':_0x3b2290[_0xbb43('0x3c')]};return db[_0xbb43('0x2c')][_0xbb43('0x1d')](_0x4807a3)[_0xbb43('0x23')](function(_0x4b32c9){_0x3c46c6['count']=_0x4b32c9;if(_0x2860d8[_0xbb43('0x34')][_0xbb43('0x41')]){_0x3b2290['include']=[{'all':!![]}];}return db['Tag'][_0xbb43('0x42')](_0x3b2290);})[_0xbb43('0x23')](function(_0x26aa10){_0x3c46c6[_0xbb43('0x43')]=_0x26aa10;return _0x3c46c6;})[_0xbb43('0x23')](respondWithFilteredResult(_0x48986d,_0x3b2290))['catch'](handleError(_0x48986d,null));};exports['show']=function(_0x2ea37b,_0x41fed6){var _0x3f48a1={'raw':!![],'where':{'id':_0x2ea37b[_0xbb43('0x44')]['id']}},_0x2d1256={};_0x2d1256[_0xbb43('0x31')]=_[_0xbb43('0x45')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x2d1256[_0xbb43('0x34')]=_['keys'](_0x2ea37b['query']);_0x2d1256[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x2d1256['model'],_0x2d1256[_0xbb43('0x34')]);_0x3f48a1[_0xbb43('0x35')]=_[_0xbb43('0x33')](_0x2d1256[_0xbb43('0x31')],qs[_0xbb43('0x36')](_0x2ea37b[_0xbb43('0x34')][_0xbb43('0x36')]));_0x3f48a1['attributes']=_0x3f48a1[_0xbb43('0x35')][_0xbb43('0x37')]?_0x3f48a1['attributes']:_0x2d1256[_0xbb43('0x31')];if(_0x2ea37b[_0xbb43('0x34')]['includeAll']){_0x3f48a1[_0xbb43('0x46')]=[{'all':!![]}];}_0x3f48a1=_[_0xbb43('0x3f')]({},_0x3f48a1,_0x2ea37b[_0xbb43('0x47')]);return db[_0xbb43('0x2c')][_0xbb43('0x48')](_0x3f48a1)[_0xbb43('0x23')](handleEntityNotFound(_0x41fed6,null))[_0xbb43('0x23')](respondWithResult(_0x41fed6,null))[_0xbb43('0x49')](handleError(_0x41fed6,null));};exports[_0xbb43('0x4a')]=function(_0x2f044f,_0x38cc4d){return db[_0xbb43('0x2c')]['create'](_0x2f044f[_0xbb43('0x4b')],{})[_0xbb43('0x23')](function(_0x50096a){var _0x7089bb=_0x2f044f['user'][_0xbb43('0x25')]({'plain':!![]});if(!_0x7089bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7089bb[_0xbb43('0x4c')]==='user'){var _0x21f78b=_0x50096a[_0xbb43('0x25')]({'plain':!![]});var _0x26586c='Tags';return db[_0xbb43('0x4d')][_0xbb43('0x48')]({'where':{'name':_0x26586c,'userProfileId':_0x7089bb[_0xbb43('0x4e')]},'raw':!![]})['then'](function(_0xd485c7){if(_0xd485c7&&_0xd485c7[_0xbb43('0x4f')]===0x0){return db['UserProfileResource'][_0xbb43('0x4a')]({'name':_0x21f78b['name'],'resourceId':_0x21f78b['id'],'type':_0xd485c7[_0xbb43('0x28')],'sectionId':_0xd485c7['id']},{})[_0xbb43('0x23')](function(){return _0x50096a;});}else{return _0x50096a;}})['catch'](function(_0x13731d){logger[_0xbb43('0x50')](_0xbb43('0x51'),_0x13731d);throw _0x13731d;});}return _0x50096a;})['then'](respondWithResult(_0x38cc4d,0xc9))[_0xbb43('0x49')](handleError(_0x38cc4d,null));};exports['update']=function(_0x3433ff,_0x451007){if(_0x3433ff[_0xbb43('0x4b')]['id']){delete _0x3433ff['body']['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x3433ff['params']['id']}})['then'](handleEntityNotFound(_0x451007,null))[_0xbb43('0x23')](saveUpdates(_0x3433ff[_0xbb43('0x4b')],null))['then'](respondWithResult(_0x451007,null))['catch'](handleError(_0x451007,null));};exports[_0xbb43('0x24')]=function(_0x51ca4f,_0x30908e){return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x51ca4f['params']['id']}})['then'](handleEntityNotFound(_0x30908e,null))['then'](removeEntity(_0x30908e,null))['catch'](handleError(_0x30908e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 3181042..53e91e1 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 _0x65c2=['define','Tag','lodash','util','../../config/logger','api','rimraf','exports'];(function(_0x16e78c,_0x5088fa){var _0xbd7e=function(_0x1cefde){while(--_0x1cefde){_0x16e78c['push'](_0x16e78c['shift']());}};_0xbd7e(++_0x5088fa);}(_0x65c2,0x92));var _0x265c=function(_0x4b70a2,_0x5d0fbd){_0x4b70a2=_0x4b70a2-0x0;var _0x2170fa=_0x65c2[_0x4b70a2];return _0x2170fa;};'use strict';var _=require(_0x265c('0x0'));var util=require(_0x265c('0x1'));var logger=require(_0x265c('0x2'))(_0x265c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x265c('0x4'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x265c('0x5')]=function(_0x5f29d5,_0x3eaebd){return _0x5f29d5[_0x265c('0x6')](_0x265c('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94b6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Tag','tools_tags','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x94b6,0x143));var _0x694b=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x94b6[_0x18a436];return _0x5c2cf8;};'use strict';var _=require(_0x694b('0x0'));var util=require(_0x694b('0x1'));var logger=require('../../config/logger')(_0x694b('0x2'));var moment=require(_0x694b('0x3'));var BPromise=require(_0x694b('0x4'));var rp=require(_0x694b('0x5'));var fs=require('fs');var path=require(_0x694b('0x6'));var rimraf=require(_0x694b('0x7'));var config=require(_0x694b('0x8'));var attributes=require('./tag.attributes');module[_0x694b('0x9')]=function(_0x34dfb7,_0x3b6355){return _0x34dfb7[_0x694b('0xa')](_0x694b('0xb'),attributes,{'tableName':_0x694b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index ec31939..8532ad5 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 _0x0c6d=['code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x1f6fb0,_0x17555b){_0x1f6fb0=_0x1f6fb0-0x0;var _0x1e2464=_0x0c6d[_0x1f6fb0];return _0x1e2464;};'use strict';var _=require('lodash');var util=require(_0xd0c6('0x0'));var moment=require(_0xd0c6('0x1'));var BPromise=require(_0xd0c6('0x2'));var rs=require(_0xd0c6('0x3'));var fs=require('fs');var Redis=require(_0xd0c6('0x4'));var db=require(_0xd0c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0c6('0x7')][_0xd0c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4a64,_0x5de1cd,_0x16c6da){return new BPromise(function(_0x534412,_0x2a14f1){return client[_0xd0c6('0x9')](_0x2d4a64,_0x16c6da)[_0xd0c6('0xa')](function(_0x184f65){logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));logger[_0xd0c6('0xe')](_0xd0c6('0xf'),_0x5de1cd,'request\x20sent',JSON[_0xd0c6('0x10')](_0x184f65));if(_0x184f65['error']){if(_0x184f65['error'][_0xd0c6('0x11')]===0x1f4){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x2a14f1(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);return _0x534412(_0x184f65[_0xd0c6('0x12')][_0xd0c6('0x13')]);}else{logger[_0xd0c6('0xb')](_0xd0c6('0xc'),_0x5de1cd,_0xd0c6('0xd'));_0x534412(_0x184f65[_0xd0c6('0x14')][_0xd0c6('0x13')]);}})[_0xd0c6('0x15')](function(_0x19dd14){logger[_0xd0c6('0x12')](_0xd0c6('0xc'),_0x5de1cd,_0x19dd14);_0x2a14f1(_0x19dd14);});});} \ No newline at end of file +var _0xfa2b=['jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3cd644,_0x4f4fd2){var _0x218c3f=function(_0x4e702d){while(--_0x4e702d){_0x3cd644['push'](_0x3cd644['shift']());}};_0x218c3f(++_0x4f4fd2);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x4ed21e,_0x31c606){_0x4ed21e=_0x4ed21e-0x0;var _0x4597a0=_0xfa2b[_0x4ed21e];return _0x4597a0;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rs=require(_0xbfa2('0x4'));var fs=require('fs');var Redis=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];var utils=require(_0xbfa2('0x7'));var logger=require(_0xbfa2('0x8'))(_0xbfa2('0x9'));var config=require(_0xbfa2('0xa'));var jayson=require(_0xbfa2('0xb'));var client=jayson[_0xbfa2('0xc')][_0xbfa2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ed93,_0x26e9bf,_0x4cd9ae){return new BPromise(function(_0x46a151,_0x4f17e6){return client[_0xbfa2('0xe')](_0x26ed93,_0x4cd9ae)[_0xbfa2('0xf')](function(_0x1b1c13){logger[_0xbfa2('0x10')](_0xbfa2('0x11'),_0x26e9bf,_0xbfa2('0x12'));logger[_0xbfa2('0x13')](_0xbfa2('0x14'),_0x26e9bf,_0xbfa2('0x12'),JSON['stringify'](_0x1b1c13));if(_0x1b1c13['error']){if(_0x1b1c13['error'][_0xbfa2('0x15')]===0x1f4){logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x4f17e6(_0x1b1c13[_0xbfa2('0x16')]['message']);}logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x46a151(_0x1b1c13[_0xbfa2('0x16')]['message']);}else{logger[_0xbfa2('0x10')]('Tag,\x20%s,\x20%s',_0x26e9bf,'request\x20sent');_0x46a151(_0x1b1c13[_0xbfa2('0x18')]['message']);}})['catch'](function(_0xab2c91){logger[_0xbfa2('0x16')]('Tag,\x20%s,\x20%s',_0x26e9bf,_0xab2c91);_0x4f17e6(_0xab2c91);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9dfb065..7821b10 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(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_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'));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 34e325a..79a6c6b 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 64021c6..3794bce 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 _0x2196=['sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','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','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','send','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','add','ids','removeQueues','remove','Voice','Chat','Mail','Sms','Fax','Whatsapp','transaction','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','upsert','isNil','format','SIP/%s','all','VoicePrefixId','addAgents','spread','removeAgents','isArray','UserVoiceQueueRt','getAgents','nolimit','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','Team','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','autoAssociation','UserProfileResource'];(function(_0x560166,_0x509bcd){var _0x3fad6d=function(_0x2c6343){while(--_0x2c6343){_0x560166['push'](_0x560166['shift']());}};_0x3fad6d(++_0x509bcd);}(_0x2196,0x177));var _0x6219=function(_0xde4b85,_0x10c94e){_0xde4b85=_0xde4b85-0x0;var _0xf25b34=_0x2196[_0xde4b85];return _0xf25b34;};'use strict';var emlformat=require(_0x6219('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6219('0x1'));var jsonpatch=require(_0x6219('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6219('0x3'));var Mustache=require(_0x6219('0x4'));var util=require(_0x6219('0x5'));var path=require('path');var sox=require(_0x6219('0x6'));var csv=require(_0x6219('0x7'));var ejs=require(_0x6219('0x8'));var fs=require('fs');var fs_extra=require(_0x6219('0x9'));var _=require(_0x6219('0xa'));var squel=require(_0x6219('0xb'));var crypto=require(_0x6219('0xc'));var jsforce=require(_0x6219('0xd'));var deskjs=require(_0x6219('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6219('0xf'));var Redis=require(_0x6219('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6219('0x11'));var as=require(_0x6219('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6219('0x13'))(_0x6219('0x14'));var utils=require(_0x6219('0x15'));var config=require(_0x6219('0x16'));var licenseUtil=require(_0x6219('0x17'));var db=require(_0x6219('0x18'))['db'];config['redis']=_[_0x6219('0x19')](config[_0x6219('0x1a')],{'host':_0x6219('0x1b'),'port':0x18eb});var socket=require(_0x6219('0x1c'))(new Redis(config[_0x6219('0x1a')]));require(_0x6219('0x1d'))[_0x6219('0x1e')](socket);function respondWithStatusCode(_0x53378c,_0x5a49e5){_0x5a49e5=_0x5a49e5||0xcc;return function(_0x4326d6){if(_0x4326d6){return _0x53378c[_0x6219('0x1f')](_0x5a49e5);}return _0x53378c[_0x6219('0x20')](_0x5a49e5)[_0x6219('0x21')]();};}function respondWithResult(_0x457d5,_0x2911b5){_0x2911b5=_0x2911b5||0xc8;return function(_0x2d5523){if(_0x2d5523){return _0x457d5['status'](_0x2911b5)[_0x6219('0x22')](_0x2d5523);}};}function respondWithFilteredResult(_0x1349fa,_0x1f77ac){return function(_0x1a6a6f){if(_0x1a6a6f){var _0x565f05=typeof _0x1f77ac[_0x6219('0x23')]==='undefined'&&typeof _0x1f77ac[_0x6219('0x24')]===_0x6219('0x25');var _0x4ba026=_0x1a6a6f[_0x6219('0x26')];var _0x5be973=_0x565f05?0x0:_0x1f77ac['offset'];var _0x44308b=_0x565f05?_0x1a6a6f[_0x6219('0x26')]:_0x1f77ac[_0x6219('0x23')]+_0x1f77ac[_0x6219('0x24')];var _0x31a05f;if(_0x44308b>=_0x4ba026){_0x44308b=_0x4ba026;_0x31a05f=0xc8;}else{_0x31a05f=0xce;}_0x1349fa[_0x6219('0x20')](_0x31a05f);return _0x1349fa[_0x6219('0x27')](_0x6219('0x28'),_0x5be973+'-'+_0x44308b+'/'+_0x4ba026)['json'](_0x1a6a6f);}return null;};}function patchUpdates(_0x4049e9){return function(_0x4807a1){try{jsonpatch[_0x6219('0x29')](_0x4807a1,_0x4049e9,!![]);}catch(_0xd69342){return BPromise['reject'](_0xd69342);}return _0x4807a1['save']();};}function saveUpdates(_0x1665ef,_0x552be4){return function(_0x75ddf8){if(_0x75ddf8){return _0x75ddf8[_0x6219('0x2a')](_0x1665ef)[_0x6219('0x2b')](function(_0x4ae346){return _0x4ae346;});}return null;};}function handleEntityNotFound(_0x27051a,_0x17eb6a){return function(_0x39f491){if(!_0x39f491){_0x27051a[_0x6219('0x1f')](0x194);}return _0x39f491;};}function handleError(_0xb26f0c,_0x421ef3){_0x421ef3=_0x421ef3||0x1f4;return function(_0x429722){logger[_0x6219('0x2c')](_0x429722[_0x6219('0x2d')]);if(_0x429722[_0x6219('0x2e')]){delete _0x429722[_0x6219('0x2e')];}_0xb26f0c['status'](_0x421ef3)['send'](_0x429722);};}exports['index']=function(_0x299daf,_0x1dd39b){var _0x33101d={},_0x1819c8={},_0x47e2c0={'count':0x0,'rows':[]};var _0x9fe17f=_['map'](db[_0x6219('0x2f')]['rawAttributes'],function(_0x2a4264){return{'name':_0x2a4264[_0x6219('0x30')],'type':_0x2a4264[_0x6219('0x31')]['key']};});_0x1819c8[_0x6219('0x32')]=_[_0x6219('0x33')](_0x9fe17f,_0x6219('0x2e'));_0x1819c8['query']=_['keys'](_0x299daf[_0x6219('0x34')]);_0x1819c8[_0x6219('0x35')]=_[_0x6219('0x36')](_0x1819c8[_0x6219('0x32')],_0x1819c8['query']);_0x33101d[_0x6219('0x37')]=_['intersection'](_0x1819c8[_0x6219('0x32')],qs[_0x6219('0x38')](_0x299daf[_0x6219('0x34')][_0x6219('0x38')]));_0x33101d['attributes']=_0x33101d[_0x6219('0x37')][_0x6219('0x39')]?_0x33101d[_0x6219('0x37')]:_0x1819c8[_0x6219('0x32')];if(!_0x299daf['query']['hasOwnProperty']('nolimit')){_0x33101d['limit']=qs[_0x6219('0x24')](_0x299daf['query'][_0x6219('0x24')]);_0x33101d[_0x6219('0x23')]=qs[_0x6219('0x23')](_0x299daf[_0x6219('0x34')][_0x6219('0x23')]);}_0x33101d[_0x6219('0x3a')]=qs[_0x6219('0x3b')](_0x299daf[_0x6219('0x34')][_0x6219('0x3b')]);_0x33101d[_0x6219('0x3c')]=qs[_0x6219('0x35')](_[_0x6219('0x3d')](_0x299daf[_0x6219('0x34')],_0x1819c8[_0x6219('0x35')]),_0x9fe17f);if(_0x299daf[_0x6219('0x34')][_0x6219('0x3e')]){_0x33101d[_0x6219('0x3c')]=_[_0x6219('0x3f')](_0x33101d[_0x6219('0x3c')],{'$or':_['map'](_0x9fe17f,function(_0x47b1fa){if(_0x47b1fa[_0x6219('0x31')]!==_0x6219('0x40')){var _0x322134={};_0x322134[_0x47b1fa[_0x6219('0x2e')]]={'$like':'%'+_0x299daf[_0x6219('0x34')][_0x6219('0x3e')]+'%'};return _0x322134;}})});}_0x33101d=_[_0x6219('0x3f')]({},_0x33101d,_0x299daf[_0x6219('0x41')]);var _0x53a9f4={'where':_0x33101d['where']};return db[_0x6219('0x2f')][_0x6219('0x26')](_0x53a9f4)['then'](function(_0x457607){_0x47e2c0[_0x6219('0x26')]=_0x457607;if(_0x299daf['query'][_0x6219('0x42')]){_0x33101d['include']=[{'all':!![]}];}return db[_0x6219('0x2f')][_0x6219('0x43')](_0x33101d);})[_0x6219('0x2b')](function(_0x1f00af){_0x47e2c0[_0x6219('0x44')]=_0x1f00af;return _0x47e2c0;})[_0x6219('0x2b')](respondWithFilteredResult(_0x1dd39b,_0x33101d))[_0x6219('0x45')](handleError(_0x1dd39b,null));};exports['show']=function(_0x5dffba,_0xf1b34a){var _0x3fa7de={'raw':![],'where':{'id':_0x5dffba[_0x6219('0x46')]['id']}},_0x412036={};_0x412036[_0x6219('0x32')]=_[_0x6219('0x47')](db[_0x6219('0x2f')][_0x6219('0x48')]);_0x412036[_0x6219('0x34')]=_[_0x6219('0x47')](_0x5dffba[_0x6219('0x34')]);_0x412036[_0x6219('0x35')]=_['intersection'](_0x412036[_0x6219('0x32')],_0x412036[_0x6219('0x34')]);_0x3fa7de['attributes']=_[_0x6219('0x36')](_0x412036[_0x6219('0x32')],qs[_0x6219('0x38')](_0x5dffba['query'][_0x6219('0x38')]));_0x3fa7de[_0x6219('0x37')]=_0x3fa7de[_0x6219('0x37')]['length']?_0x3fa7de[_0x6219('0x37')]:_0x412036[_0x6219('0x32')];if(_0x5dffba['query'][_0x6219('0x42')]){_0x3fa7de['include']=[{'all':!![]}];}_0x3fa7de=_[_0x6219('0x3f')]({},_0x3fa7de,_0x5dffba[_0x6219('0x41')]);return db[_0x6219('0x2f')][_0x6219('0x49')](_0x3fa7de)['then'](handleEntityNotFound(_0xf1b34a,null))[_0x6219('0x2b')](respondWithResult(_0xf1b34a,null))[_0x6219('0x45')](handleError(_0xf1b34a,null));};exports['create']=function(_0x586e15,_0x471b2e){return db[_0x6219('0x2f')][_0x6219('0x4a')](_0x586e15[_0x6219('0x4b')],{})[_0x6219('0x2b')](function(_0x175f64){var _0x6251e3=_0x586e15[_0x6219('0x4c')]['get']({'plain':!![]});if(!_0x6251e3)throw new Error(_0x6219('0x4d'));if(_0x6251e3[_0x6219('0x4e')]===_0x6219('0x4c')){var _0xf4fd05=_0x175f64[_0x6219('0x4f')]({'plain':!![]});var _0x4e18df=_0x6219('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x4e18df,'userProfileId':_0x6251e3[_0x6219('0x51')]},'raw':!![]})[_0x6219('0x2b')](function(_0x454485){if(_0x454485&&_0x454485[_0x6219('0x52')]===0x0){return db[_0x6219('0x53')][_0x6219('0x4a')]({'name':_0xf4fd05[_0x6219('0x2e')],'resourceId':_0xf4fd05['id'],'type':_0x454485[_0x6219('0x2e')],'sectionId':_0x454485['id']},{})[_0x6219('0x2b')](function(){return _0x175f64;});}else{return _0x175f64;}})[_0x6219('0x45')](function(_0x1e5264){logger[_0x6219('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e5264);throw _0x1e5264;});}return _0x175f64;})[_0x6219('0x2b')](respondWithResult(_0x471b2e,0xc9))[_0x6219('0x45')](handleError(_0x471b2e,null));};exports[_0x6219('0x2a')]=function(_0x347309,_0x37d073){if(_0x347309[_0x6219('0x4b')]['id']){delete _0x347309[_0x6219('0x4b')]['id'];}return db[_0x6219('0x2f')]['find']({'where':{'id':_0x347309[_0x6219('0x46')]['id']}})[_0x6219('0x2b')](handleEntityNotFound(_0x37d073,null))['then'](saveUpdates(_0x347309[_0x6219('0x4b')],null))['then'](respondWithResult(_0x37d073,null))[_0x6219('0x45')](handleError(_0x37d073,null));};exports['destroy']=function(_0x7e7a0a,_0x4e5558){var _0x5631e4=_0x7e7a0a[_0x6219('0x46')]['id'];var _0x2a1b0f=[];return db[_0x6219('0x54')]['transaction'](function(_0x243a57){var _0x456b5f='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5631e4;return db[_0x6219('0x54')][_0x6219('0x34')](_0x456b5f,{'type':db[_0x6219('0x55')]['QueryTypes'][_0x6219('0x56')],'raw':!![],'transaction':_0x243a57})[_0x6219('0x2b')](function(_0x3dafe8){_0x2a1b0f=_['map'](_0x3dafe8,function(_0x370287){return Number(_0x370287[_0x6219('0x57')]);});})[_0x6219('0x2b')](function(){var _0x219e85=_0x6219('0x58')+_0x5631e4;return db['sequelize'][_0x6219('0x34')](_0x219e85,{'type':db[_0x6219('0x55')][_0x6219('0x59')]['SELECT'],'raw':!![],'transaction':_0x243a57});})['then'](function(_0x2df06a){var _0x42703d=_[_0x6219('0x33')](_0x2df06a,function(_0x26ad6b){return Number(_0x26ad6b['VoiceQueueId']);});return db[_0x6219('0x5a')]['destroy']({'where':{'UserId':{'$in':_0x2a1b0f},'VoiceQueueId':{'$in':_0x42703d}},'transaction':_0x243a57});})[_0x6219('0x2b')](function(){var _0x15e675=_0x6219('0x5b')+_0x5631e4;return db[_0x6219('0x54')]['query'](_0x15e675,{'type':db[_0x6219('0x55')][_0x6219('0x59')]['SELECT'],'raw':!![],'transaction':_0x243a57});})['then'](function(_0x47e963){var _0x598fe8=_[_0x6219('0x33')](_0x47e963,function(_0x125805){return Number(_0x125805[_0x6219('0x5c')]);});return db[_0x6219('0x5d')][_0x6219('0x5e')]({'where':{'UserId':{'$in':_0x2a1b0f},'MailQueueId':{'$in':_0x598fe8}},'transaction':_0x243a57});})[_0x6219('0x2b')](function(){var _0x3a51de=_0x6219('0x5f')+_0x5631e4;return db[_0x6219('0x54')][_0x6219('0x34')](_0x3a51de,{'type':db[_0x6219('0x55')]['QueryTypes'][_0x6219('0x56')],'raw':!![],'transaction':_0x243a57});})['then'](function(_0xc6402f){var _0x5d99ae=_[_0x6219('0x33')](_0xc6402f,function(_0x216420){return Number(_0x216420[_0x6219('0x60')]);});return db[_0x6219('0x61')][_0x6219('0x5e')]({'where':{'UserId':{'$in':_0x2a1b0f},'SmsQueueId':{'$in':_0x5d99ae}},'transaction':_0x243a57});})[_0x6219('0x2b')](function(){var _0x31001d=_0x6219('0x62')+_0x5631e4;return db[_0x6219('0x54')][_0x6219('0x34')](_0x31001d,{'type':db[_0x6219('0x55')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x243a57});})[_0x6219('0x2b')](function(_0x15f864){var _0x4206e6=_[_0x6219('0x33')](_0x15f864,function(_0x3fa68e){return Number(_0x3fa68e[_0x6219('0x63')]);});return db['UserChatQueue'][_0x6219('0x5e')]({'where':{'UserId':{'$in':_0x2a1b0f},'ChatQueueId':{'$in':_0x4206e6}},'transaction':_0x243a57});})[_0x6219('0x2b')](function(){var _0x11193d=_0x6219('0x64')+_0x5631e4;return db[_0x6219('0x54')]['query'](_0x11193d,{'type':db[_0x6219('0x55')][_0x6219('0x59')][_0x6219('0x56')],'raw':!![],'transaction':_0x243a57});})[_0x6219('0x2b')](function(_0x2de3ba){var _0x529e9a=_[_0x6219('0x33')](_0x2de3ba,function(_0x18be74){return Number(_0x18be74[_0x6219('0x65')]);});return db[_0x6219('0x66')][_0x6219('0x5e')]({'where':{'UserId':{'$in':_0x2a1b0f},'FaxQueueId':{'$in':_0x529e9a}},'transaction':_0x243a57});})[_0x6219('0x2b')](function(){var _0x760c43='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5631e4;return db['sequelize'][_0x6219('0x34')](_0x760c43,{'type':db[_0x6219('0x55')]['QueryTypes'][_0x6219('0x56')],'raw':!![],'transaction':_0x243a57});})[_0x6219('0x2b')](function(_0x337e6a){var _0x18bdb6=_[_0x6219('0x33')](_0x337e6a,function(_0xa341e7){return Number(_0xa341e7[_0x6219('0x67')]);});return db[_0x6219('0x68')][_0x6219('0x5e')]({'where':{'UserId':{'$in':_0x2a1b0f},'OpenchannelQueueId':{'$in':_0x18bdb6}},'transaction':_0x243a57});})[_0x6219('0x2b')](function(){var _0xb334b=_0x6219('0x69')+_0x5631e4;return db['sequelize'][_0x6219('0x34')](_0xb334b,{'type':db[_0x6219('0x55')][_0x6219('0x59')][_0x6219('0x56')],'raw':!![],'transaction':_0x243a57});})['then'](function(_0x396a1e){var _0xc887de=_[_0x6219('0x33')](_0x396a1e,function(_0x2393c1){return Number(_0x2393c1['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x2a1b0f},'WhatsappQueueId':{'$in':_0xc887de}},'transaction':_0x243a57});})['then'](function(){return db[_0x6219('0x6a')][_0x6219('0x49')]({'where':{'TeamId':_0x5631e4}});})[_0x6219('0x2b')](function(_0x337e43){if(_0x337e43===null){return;}return db[_0x6219('0x6b')][_0x6219('0x5e')]({'where':{'UserId':{'$in':_0x2a1b0f},'VoicePrefixId':_0x337e43['VoicePrefixId']},'transaction':_0x243a57});})['then'](function(){return db['Team'][_0x6219('0x5e')]({'where':{'id':_0x5631e4},'cascade':!![],'transaction':_0x243a57});})[_0x6219('0x2b')](function(_0xf97215){if(_0xf97215===0x0){_0x4e5558[_0x6219('0x1f')](0x194);}else{return db['UserProfileResource'][_0x6219('0x5e')]({'where':{'type':_0x6219('0x50'),'resourceId':_0x5631e4},'cascade':!![],'transaction':_0x243a57})['then'](function(){_0x4e5558['status'](0xcc)[_0x6219('0x21')]();});}})[_0x6219('0x45')](function(_0x219a80){_0x4e5558[_0x6219('0x20')](0x1f4)[_0x6219('0x6c')](_0x219a80);});});};exports['getQueues']=function(_0x52c89b,_0x245eb7,_0x1f572b){return db['Team'][_0x6219('0x6d')]({'where':{'id':_0x52c89b[_0x6219('0x46')]['id']}})[_0x6219('0x2b')](handleEntityNotFound(_0x245eb7,null))[_0x6219('0x2b')](function(_0x86e6e9){if(!_0x52c89b[_0x6219('0x34')]['channel']||!utils[_0x6219('0x6e')](_0x52c89b['query'][_0x6219('0x6f')])){throw new db[(_0x6219('0x55'))][(_0x6219('0x70'))](_0x6219('0x71'));}var _0x29d236={};var _0x3cebf0={};_0x3cebf0[_0x6219('0x32')]=_[_0x6219('0x47')](db[_[_0x6219('0x72')](_0x52c89b[_0x6219('0x34')][_0x6219('0x6f')][_0x6219('0x73')]())+_0x6219('0x74')]['rawAttributes']);_0x3cebf0['query']=_[_0x6219('0x47')](_0x52c89b['query']);_0x3cebf0[_0x6219('0x35')]=_[_0x6219('0x36')](_0x3cebf0[_0x6219('0x32')],_0x3cebf0[_0x6219('0x34')]);_0x29d236[_0x6219('0x37')]=_['intersection'](_0x3cebf0[_0x6219('0x32')],qs[_0x6219('0x38')](_0x52c89b[_0x6219('0x34')][_0x6219('0x38')]));_0x29d236[_0x6219('0x37')]=_0x29d236[_0x6219('0x37')][_0x6219('0x39')]?_0x29d236[_0x6219('0x37')]:_0x3cebf0['model'];_0x29d236['limit']=qs['limit'](_0x52c89b[_0x6219('0x34')][_0x6219('0x24')]);_0x29d236['offset']=qs['offset'](_0x52c89b['query'][_0x6219('0x23')]);_0x29d236[_0x6219('0x3a')]=qs['sort'](_0x52c89b[_0x6219('0x34')][_0x6219('0x3b')]);_0x29d236['where']=qs[_0x6219('0x35')](_[_0x6219('0x3d')](_0x52c89b[_0x6219('0x34')],_0x3cebf0['filters']));_0x29d236=_['merge']({},_0x29d236,_0x52c89b[_0x6219('0x41')]);return _0x86e6e9[_0x6219('0x4f')+_[_0x6219('0x72')](_0x52c89b['query']['channel']['toLowerCase']())+_0x6219('0x75')](_0x29d236);})[_0x6219('0x2b')](respondWithResult(_0x245eb7,null))['catch'](handleError(_0x245eb7,null));};exports['addQueues']=function(_0x48fdd5,_0x5ca815,_0x206fb8){return db[_0x6219('0x2f')][_0x6219('0x6d')]({'where':{'id':_0x48fdd5[_0x6219('0x46')]['id']}})['then'](function(_0x8ec4c0){if(_0x8ec4c0){if(!_0x48fdd5['body'][_0x6219('0x6f')]||!utils[_0x6219('0x6e')](_0x48fdd5[_0x6219('0x4b')][_0x6219('0x6f')])){throw new db[(_0x6219('0x55'))]['ValidationError']('Unknown\x20channel');}return _0x8ec4c0[_0x6219('0x76')+_[_0x6219('0x72')](_0x48fdd5[_0x6219('0x4b')][_0x6219('0x6f')][_0x6219('0x73')]())+_0x6219('0x75')](_0x48fdd5[_0x6219('0x4b')][_0x6219('0x77')]);}return null;})[_0x6219('0x2b')](handleEntityNotFound(_0x5ca815,null))[_0x6219('0x2b')](respondWithStatusCode(_0x5ca815,null))[_0x6219('0x45')](handleError(_0x5ca815,null));};exports[_0x6219('0x78')]=function(_0x33304a,_0x5e2bf1,_0x430817){return db['Team'][_0x6219('0x6d')]({'where':{'id':_0x33304a[_0x6219('0x46')]['id']}})[_0x6219('0x2b')](function(_0x1d3fc3){if(_0x1d3fc3){if(!_0x33304a[_0x6219('0x34')][_0x6219('0x6f')]||!utils[_0x6219('0x6e')](_0x33304a[_0x6219('0x34')][_0x6219('0x6f')])){throw new db[(_0x6219('0x55'))]['ValidationError'](_0x6219('0x71'));}return _0x1d3fc3[_0x6219('0x79')+_[_0x6219('0x72')](_0x33304a[_0x6219('0x34')]['channel'][_0x6219('0x73')]())+_0x6219('0x75')](_0x33304a[_0x6219('0x34')]['ids']);}return null;})[_0x6219('0x2b')](handleEntityNotFound(_0x5e2bf1,null))['then'](respondWithStatusCode(_0x5e2bf1,null))[_0x6219('0x45')](handleError(_0x5e2bf1,null));};exports['addAgents']=function(_0x4572d7,_0x7f63b4){var _0x137cd8=_['isArray'](_0x4572d7['body'][_0x6219('0x77')])?_0x4572d7['body']['ids']:[_0x4572d7[_0x6219('0x4b')][_0x6219('0x77')]];var _0x53a305=_0x4572d7[_0x6219('0x46')]['id'];return db[_0x6219('0x2f')][_0x6219('0x49')]({'where':{'id':_0x53a305}})[_0x6219('0x2b')](handleEntityNotFound(_0x7f63b4,null))[_0x6219('0x2b')](function(_0x3c7e75){if(_0x3c7e75){var _0x3a60f1=[_0x6219('0x7a'),_0x6219('0x7b'),_0x6219('0x7c'),_0x6219('0x7d'),_0x6219('0x7e'),'Openchannel',_0x6219('0x7f')];return db['sequelize'][_0x6219('0x80')](function(_0x1ff72c){var _0x2ce84a=_[_0x6219('0x33')](_0x3a60f1,function(_0x490798){var _0x4d7b4c={'attributes':['id','name']};if(_0x490798===_0x6219('0x7a')){_0x4d7b4c[_0x6219('0x81')]={'attributes':['penalty']};}return _0x3c7e75[_0x6219('0x4f')+_0x490798+_0x6219('0x75')](_0x4d7b4c)[_0x6219('0x2b')](function(_0x58518b){var _0x4e9480=_[_0x6219('0x33')](_0x58518b,function(_0x28382a){var _0x1e7ad5=_['map'](_0x137cd8,function(_0x2816e6){var _0x32e9e2={'where':{'UserId':_0x2816e6,[_0x490798+_0x6219('0x82')]:_0x28382a['id']},'transaction':_0x1ff72c};if(_0x490798===_0x6219('0x7a')){_0x32e9e2[_0x6219('0x19')]={'penalty':_0x28382a[_0x6219('0x83')][_0x6219('0x84')]};}return db[_0x6219('0x85')+_0x490798+_0x6219('0x74')][_0x6219('0x86')](_0x32e9e2)[_0x6219('0x2b')](function(){socket[_0x6219('0x87')]('user'+_0x490798+_0x6219('0x88'),{'UserId':_0x2816e6,[_0x490798+_0x6219('0x82')]:_0x28382a['id']});if(_0x490798!==_0x6219('0x7a')){return;}return db[_0x6219('0x85')][_0x6219('0x43')]({'where':{'id':_0x137cd8,'online':0x1},'attributes':['id',_0x6219('0x2e'),_0x6219('0x89'),_0x6219('0x8a'),_0x6219('0x8b')],'raw':!![]})[_0x6219('0x2b')](function(_0x2b6abd){var _0x311f4d=_[_0x6219('0x33')](_0x2b6abd,function(_0x2d4fe0){return db['UserVoiceQueueRt'][_0x6219('0x8c')]({'membername':_0x2d4fe0['name'],'UserId':_0x2d4fe0['id'],'queue_name':_0x28382a[_0x6219('0x2e')],'VoiceQueueId':_0x28382a['id'],'interface':_[_0x6219('0x8d')](_0x2d4fe0[_0x6219('0x8b')])?util[_0x6219('0x8e')](_0x6219('0x8f'),_0x2d4fe0['name']):_0x2d4fe0[_0x6219('0x8b')],'paused':_0x2d4fe0['voicePause']||![],'penalty':_0x28382a[_0x6219('0x83')][_0x6219('0x84')]},{'transaction':_0x1ff72c});});return Promise['all'](_0x311f4d);});});});return Promise['all'](_0x1e7ad5);});return Promise[_0x6219('0x90')](_0x4e9480);})[_0x6219('0x2b')](function(){return db[_0x6219('0x6a')][_0x6219('0x6d')]({'where':{'teamId':_0x53a305}})[_0x6219('0x2b')](function(_0x13c0af){if(_0x13c0af){var _0x5b9949=_[_0x6219('0x33')](_0x137cd8,function(_0x14bdbf){db['UserVoicePrefix'][_0x6219('0x8c')]({'UserId':_0x14bdbf,'VoicePrefixId':_0x13c0af[_0x6219('0x91')]});});return Promise['all'](_0x5b9949);}});});});return Promise[_0x6219('0x90')](_0x2ce84a)[_0x6219('0x2b')](function(){return _0x3c7e75[_0x6219('0x92')](_0x137cd8,{'transaction':_0x1ff72c})[_0x6219('0x93')](function(_0x5017a3){return _0x5017a3;});});});}})['then'](respondWithResult(_0x7f63b4,null))['catch'](handleError(_0x7f63b4,null));};exports[_0x6219('0x94')]=function(_0x47f728,_0x369351){var _0x53107d=_[_0x6219('0x95')](_0x47f728[_0x6219('0x34')]['ids'])?_0x47f728[_0x6219('0x34')][_0x6219('0x77')]:[_0x47f728['query'][_0x6219('0x77')]];var _0x264414=_0x47f728[_0x6219('0x46')]['id'];return db[_0x6219('0x2f')]['find']({'where':{'id':_0x264414}})[_0x6219('0x2b')](handleEntityNotFound(_0x369351,null))[_0x6219('0x2b')](function(_0x581311){if(_0x581311){var _0x3412e0=[_0x6219('0x7a'),_0x6219('0x7b'),_0x6219('0x7c'),_0x6219('0x7d'),_0x6219('0x7e'),'Openchannel',_0x6219('0x7f')];return db[_0x6219('0x54')][_0x6219('0x80')](function(_0x463dd2){var _0x5c0ec2=_[_0x6219('0x33')](_0x3412e0,function(_0x3ef410){var _0x5e4d77={'attributes':['id',_0x6219('0x2e')]};return _0x581311[_0x6219('0x4f')+_0x3ef410+'Queues'](_0x5e4d77)[_0x6219('0x2b')](function(_0x39ec47){var _0x5cd041=_[_0x6219('0x33')](_0x39ec47,function(_0x27a364){return _0x27a364[_0x6219('0x94')](_0x53107d,{'transaction':_0x463dd2})['then'](function(){var _0x3f7a66=_[_0x6219('0x33')](_0x53107d,function(_0x50184d){socket[_0x6219('0x87')](_0x6219('0x4c')+_0x3ef410+'Queue:remove',{'UserId':Number(_0x50184d),[_0x3ef410+'QueueId']:_0x27a364['id']});if(_0x3ef410!=='Voice'){return;}return db[_0x6219('0x96')]['destroy']({'where':{'VoiceQueueId':_0x27a364['id'],'UserId':_0x50184d},'transaction':_0x463dd2});});return Promise['all'](_0x3f7a66);});});return Promise['all'](_0x5cd041);});});return Promise['all'](_0x5c0ec2)[_0x6219('0x2b')](function(){return _0x581311['removeAgents'](_0x53107d,{'transaction':_0x463dd2});})[_0x6219('0x2b')](function(){return db[_0x6219('0x6a')][_0x6219('0x6d')]({'where':{'teamId':_0x264414}})[_0x6219('0x2b')](function(_0x353aba){if(_0x353aba){var _0x4b3ca8=_[_0x6219('0x33')](_0x53107d,function(_0x1ced7a){db[_0x6219('0x6b')][_0x6219('0x5e')]({'where':{'UserId':_0x1ced7a,'VoicePrefixId':_0x353aba[_0x6219('0x91')]}});});return Promise[_0x6219('0x90')](_0x4b3ca8);}});});});}})[_0x6219('0x2b')](respondWithStatusCode(_0x369351,null))[_0x6219('0x45')](handleError(_0x369351,null));};exports[_0x6219('0x97')]=function(_0x42e912,_0x14e08b,_0x19c467){var _0x585576={};var _0x1f8d6b={};var _0x3e7794;var _0x2a7530;return db[_0x6219('0x2f')][_0x6219('0x6d')]({'where':{'id':_0x42e912[_0x6219('0x46')]['id']}})['then'](handleEntityNotFound(_0x14e08b,null))[_0x6219('0x2b')](function(_0x5d0db2){if(_0x5d0db2){_0x3e7794=_0x5d0db2;_0x1f8d6b[_0x6219('0x32')]=_[_0x6219('0x47')](db['User'][_0x6219('0x48')]);_0x1f8d6b[_0x6219('0x34')]=_[_0x6219('0x47')](_0x42e912[_0x6219('0x34')]);_0x1f8d6b[_0x6219('0x35')]=_[_0x6219('0x36')](_0x1f8d6b['model'],_0x1f8d6b[_0x6219('0x34')]);_0x585576['attributes']=_[_0x6219('0x36')](_0x1f8d6b[_0x6219('0x32')],qs[_0x6219('0x38')](_0x42e912['query'][_0x6219('0x38')]));_0x585576[_0x6219('0x37')]=_0x585576['attributes'][_0x6219('0x39')]?_0x585576[_0x6219('0x37')]:_0x1f8d6b[_0x6219('0x32')];_0x585576['order']=qs[_0x6219('0x3b')](_0x42e912[_0x6219('0x34')][_0x6219('0x3b')]);_0x585576[_0x6219('0x3c')]=qs[_0x6219('0x35')](_[_0x6219('0x3d')](_0x42e912[_0x6219('0x34')],_0x1f8d6b['filters']));if(_0x42e912[_0x6219('0x34')][_0x6219('0x3e')]){_0x585576['where']=_['merge'](_0x585576['where'],{'$or':_[_0x6219('0x33')](_0x585576[_0x6219('0x37')],function(_0x55b403){var _0xac520={};_0xac520[_0x55b403]={'$like':'%'+_0x42e912[_0x6219('0x34')][_0x6219('0x3e')]+'%'};return _0xac520;})});}_0x585576=_[_0x6219('0x3f')]({},_0x585576,_0x42e912[_0x6219('0x41')]);return _0x3e7794[_0x6219('0x97')](_0x585576);}})[_0x6219('0x2b')](function(_0x6ac347){if(_0x6ac347){_0x2a7530=_0x6ac347[_0x6219('0x39')];if(!_0x42e912[_0x6219('0x34')]['hasOwnProperty'](_0x6219('0x98'))){_0x585576[_0x6219('0x24')]=qs['limit'](_0x42e912[_0x6219('0x34')][_0x6219('0x24')]);_0x585576[_0x6219('0x23')]=qs[_0x6219('0x23')](_0x42e912[_0x6219('0x34')][_0x6219('0x23')]);}return _0x3e7794[_0x6219('0x97')](_0x585576);}})[_0x6219('0x2b')](function(_0xa1bc52){if(_0xa1bc52){return _0xa1bc52?{'count':_0x2a7530,'rows':_0xa1bc52}:null;}})['then'](respondWithResult(_0x14e08b,null))[_0x6219('0x45')](handleError(_0x14e08b,null));}; \ No newline at end of file +var _0x8014=['Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','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','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','Teams','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','removeQueues','ids','addAgents','isArray','Voice','Mail','Sms','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','interface','UserVoiceQueueRt','SIP/%s','voicePause','all','UserVoicePrefix','upsert','spread','Chat','Fax','Openchannel','removeAgents','getAgents','User','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','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','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','attributes','intersection','fields','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','Team','includeAll','findAll','rows','catch','keys','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize'];(function(_0x2e8a76,_0xed0bec){var _0x1379b0=function(_0x4efd0c){while(--_0x4efd0c){_0x2e8a76['push'](_0x2e8a76['shift']());}};_0x1379b0(++_0xed0bec);}(_0x8014,0xdf));var _0x4801=function(_0x322bef,_0x4890d4){_0x322bef=_0x322bef-0x0;var _0x229e60=_0x8014[_0x322bef];return _0x229e60;};'use strict';var emlformat=require(_0x4801('0x0'));var rimraf=require(_0x4801('0x1'));var zipdir=require(_0x4801('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4801('0x3'));var moment=require(_0x4801('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4801('0x5'));var util=require('util');var path=require(_0x4801('0x6'));var sox=require('sox');var csv=require(_0x4801('0x7'));var ejs=require(_0x4801('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4801('0x9'));var squel=require('squel');var crypto=require(_0x4801('0xa'));var jsforce=require(_0x4801('0xb'));var deskjs=require(_0x4801('0xc'));var toCsv=require(_0x4801('0x7'));var querystring=require(_0x4801('0xd'));var Papa=require('papaparse');var Redis=require(_0x4801('0xe'));var authService=require(_0x4801('0xf'));var qs=require(_0x4801('0x10'));var as=require(_0x4801('0x11'));var hardwareService=require(_0x4801('0x12'));var logger=require('../../config/logger')(_0x4801('0x13'));var utils=require(_0x4801('0x14'));var config=require(_0x4801('0x15'));var licenseUtil=require(_0x4801('0x16'));var db=require(_0x4801('0x17'))['db'];config[_0x4801('0x18')]=_[_0x4801('0x19')](config[_0x4801('0x18')],{'host':_0x4801('0x1a'),'port':0x18eb});var socket=require(_0x4801('0x1b'))(new Redis(config['redis']));require(_0x4801('0x1c'))[_0x4801('0x1d')](socket);function respondWithStatusCode(_0x24dee4,_0x34783c){_0x34783c=_0x34783c||0xcc;return function(_0x37122b){if(_0x37122b){return _0x24dee4[_0x4801('0x1e')](_0x34783c);}return _0x24dee4[_0x4801('0x1f')](_0x34783c)['end']();};}function respondWithResult(_0x814676,_0x17ff40){_0x17ff40=_0x17ff40||0xc8;return function(_0x57b5d3){if(_0x57b5d3){return _0x814676[_0x4801('0x1f')](_0x17ff40)[_0x4801('0x20')](_0x57b5d3);}};}function respondWithFilteredResult(_0x54a3ec,_0x33f009){return function(_0x400b61){if(_0x400b61){var _0x204d1b=typeof _0x33f009[_0x4801('0x21')]===_0x4801('0x22')&&typeof _0x33f009['limit']===_0x4801('0x22');var _0x8525d1=_0x400b61[_0x4801('0x23')];var _0x218385=_0x204d1b?0x0:_0x33f009[_0x4801('0x21')];var _0x99aa12=_0x204d1b?_0x400b61['count']:_0x33f009[_0x4801('0x21')]+_0x33f009['limit'];var _0x3165c2;if(_0x99aa12>=_0x8525d1){_0x99aa12=_0x8525d1;_0x3165c2=0xc8;}else{_0x3165c2=0xce;}_0x54a3ec[_0x4801('0x1f')](_0x3165c2);return _0x54a3ec[_0x4801('0x24')](_0x4801('0x25'),_0x218385+'-'+_0x99aa12+'/'+_0x8525d1)[_0x4801('0x20')](_0x400b61);}return null;};}function patchUpdates(_0x180793){return function(_0x5a182b){try{jsonpatch[_0x4801('0x26')](_0x5a182b,_0x180793,!![]);}catch(_0x2b48a6){return BPromise[_0x4801('0x27')](_0x2b48a6);}return _0x5a182b[_0x4801('0x28')]();};}function saveUpdates(_0x2a518b,_0xabbf01){return function(_0xdf4cd5){if(_0xdf4cd5){return _0xdf4cd5[_0x4801('0x29')](_0x2a518b)[_0x4801('0x2a')](function(_0x55ed74){return _0x55ed74;});}return null;};}function handleEntityNotFound(_0x34cb5e,_0x54e03d){return function(_0x2c34be){if(!_0x2c34be){_0x34cb5e[_0x4801('0x1e')](0x194);}return _0x2c34be;};}function handleError(_0x31f658,_0x174ecc){_0x174ecc=_0x174ecc||0x1f4;return function(_0x23e58c){logger[_0x4801('0x2b')](_0x23e58c[_0x4801('0x2c')]);if(_0x23e58c['name']){delete _0x23e58c['name'];}_0x31f658[_0x4801('0x1f')](_0x174ecc)[_0x4801('0x2d')](_0x23e58c);};}exports[_0x4801('0x2e')]=function(_0x308eaf,_0x206761){var _0x3b1801={},_0x104ff6={},_0x2214c0={'count':0x0,'rows':[]};var _0x2cabb6=_['map'](db['Team'][_0x4801('0x2f')],function(_0x2d8947){return{'name':_0x2d8947[_0x4801('0x30')],'type':_0x2d8947[_0x4801('0x31')][_0x4801('0x32')]};});_0x104ff6[_0x4801('0x33')]=_[_0x4801('0x34')](_0x2cabb6,_0x4801('0x35'));_0x104ff6[_0x4801('0x36')]=_['keys'](_0x308eaf['query']);_0x104ff6['filters']=_['intersection'](_0x104ff6[_0x4801('0x33')],_0x104ff6['query']);_0x3b1801[_0x4801('0x37')]=_[_0x4801('0x38')](_0x104ff6[_0x4801('0x33')],qs[_0x4801('0x39')](_0x308eaf[_0x4801('0x36')][_0x4801('0x39')]));_0x3b1801[_0x4801('0x37')]=_0x3b1801[_0x4801('0x37')]['length']?_0x3b1801[_0x4801('0x37')]:_0x104ff6[_0x4801('0x33')];if(!_0x308eaf[_0x4801('0x36')]['hasOwnProperty'](_0x4801('0x3a'))){_0x3b1801['limit']=qs['limit'](_0x308eaf[_0x4801('0x36')][_0x4801('0x3b')]);_0x3b1801[_0x4801('0x21')]=qs['offset'](_0x308eaf[_0x4801('0x36')][_0x4801('0x21')]);}_0x3b1801[_0x4801('0x3c')]=qs[_0x4801('0x3d')](_0x308eaf[_0x4801('0x36')][_0x4801('0x3d')]);_0x3b1801[_0x4801('0x3e')]=qs[_0x4801('0x3f')](_[_0x4801('0x40')](_0x308eaf[_0x4801('0x36')],_0x104ff6[_0x4801('0x3f')]),_0x2cabb6);if(_0x308eaf['query'][_0x4801('0x41')]){_0x3b1801[_0x4801('0x3e')]=_[_0x4801('0x42')](_0x3b1801['where'],{'$or':_[_0x4801('0x34')](_0x2cabb6,function(_0x24af57){if(_0x24af57[_0x4801('0x31')]!=='VIRTUAL'){var _0x53c969={};_0x53c969[_0x24af57[_0x4801('0x35')]]={'$like':'%'+_0x308eaf[_0x4801('0x36')]['filter']+'%'};return _0x53c969;}})});}_0x3b1801=_[_0x4801('0x42')]({},_0x3b1801,_0x308eaf[_0x4801('0x43')]);var _0x367764={'where':_0x3b1801['where']};return db[_0x4801('0x44')]['count'](_0x367764)['then'](function(_0x592b70){_0x2214c0[_0x4801('0x23')]=_0x592b70;if(_0x308eaf[_0x4801('0x36')][_0x4801('0x45')]){_0x3b1801['include']=[{'all':!![]}];}return db[_0x4801('0x44')][_0x4801('0x46')](_0x3b1801);})['then'](function(_0x23eff8){_0x2214c0[_0x4801('0x47')]=_0x23eff8;return _0x2214c0;})[_0x4801('0x2a')](respondWithFilteredResult(_0x206761,_0x3b1801))[_0x4801('0x48')](handleError(_0x206761,null));};exports['show']=function(_0x4eb857,_0x642622){var _0x4f98ba={'raw':![],'where':{'id':_0x4eb857['params']['id']}},_0x4e4528={};_0x4e4528[_0x4801('0x33')]=_[_0x4801('0x49')](db['Team']['rawAttributes']);_0x4e4528[_0x4801('0x36')]=_[_0x4801('0x49')](_0x4eb857[_0x4801('0x36')]);_0x4e4528['filters']=_[_0x4801('0x38')](_0x4e4528['model'],_0x4e4528[_0x4801('0x36')]);_0x4f98ba[_0x4801('0x37')]=_[_0x4801('0x38')](_0x4e4528[_0x4801('0x33')],qs[_0x4801('0x39')](_0x4eb857[_0x4801('0x36')][_0x4801('0x39')]));_0x4f98ba[_0x4801('0x37')]=_0x4f98ba[_0x4801('0x37')][_0x4801('0x4a')]?_0x4f98ba['attributes']:_0x4e4528[_0x4801('0x33')];if(_0x4eb857[_0x4801('0x36')]['includeAll']){_0x4f98ba[_0x4801('0x4b')]=[{'all':!![]}];}_0x4f98ba=_['merge']({},_0x4f98ba,_0x4eb857['options']);return db[_0x4801('0x44')][_0x4801('0x4c')](_0x4f98ba)[_0x4801('0x2a')](handleEntityNotFound(_0x642622,null))[_0x4801('0x2a')](respondWithResult(_0x642622,null))[_0x4801('0x48')](handleError(_0x642622,null));};exports[_0x4801('0x4d')]=function(_0x5a7f99,_0xd656ca){return db[_0x4801('0x44')]['create'](_0x5a7f99[_0x4801('0x4e')],{})[_0x4801('0x2a')](function(_0x44d53b){var _0x30796a=_0x5a7f99['user'][_0x4801('0x4f')]({'plain':!![]});if(!_0x30796a)throw new Error(_0x4801('0x50'));if(_0x30796a[_0x4801('0x51')]===_0x4801('0x52')){var _0x2a16fc=_0x44d53b['get']({'plain':!![]});var _0x2373d7='Teams';return db[_0x4801('0x53')][_0x4801('0x4c')]({'where':{'name':_0x2373d7,'userProfileId':_0x30796a['userProfileId']},'raw':!![]})[_0x4801('0x2a')](function(_0x118140){if(_0x118140&&_0x118140['autoAssociation']===0x0){return db[_0x4801('0x54')][_0x4801('0x4d')]({'name':_0x2a16fc[_0x4801('0x35')],'resourceId':_0x2a16fc['id'],'type':_0x118140['name'],'sectionId':_0x118140['id']},{})[_0x4801('0x2a')](function(){return _0x44d53b;});}else{return _0x44d53b;}})[_0x4801('0x48')](function(_0x49475c){logger[_0x4801('0x2b')](_0x4801('0x55'),_0x49475c);throw _0x49475c;});}return _0x44d53b;})[_0x4801('0x2a')](respondWithResult(_0xd656ca,0xc9))[_0x4801('0x48')](handleError(_0xd656ca,null));};exports[_0x4801('0x29')]=function(_0x317463,_0x32e799){if(_0x317463[_0x4801('0x4e')]['id']){delete _0x317463[_0x4801('0x4e')]['id'];}return db[_0x4801('0x44')][_0x4801('0x4c')]({'where':{'id':_0x317463[_0x4801('0x56')]['id']}})['then'](handleEntityNotFound(_0x32e799,null))[_0x4801('0x2a')](saveUpdates(_0x317463[_0x4801('0x4e')],null))[_0x4801('0x2a')](respondWithResult(_0x32e799,null))[_0x4801('0x48')](handleError(_0x32e799,null));};exports[_0x4801('0x57')]=function(_0x9f4e46,_0x31ba40){var _0x55f989=_0x9f4e46[_0x4801('0x56')]['id'];var _0x3849ef=[];return db['sequelize'][_0x4801('0x58')](function(_0x4522bf){var _0x458651=_0x4801('0x59')+_0x55f989;return db[_0x4801('0x5a')][_0x4801('0x36')](_0x458651,{'type':db[_0x4801('0x5b')][_0x4801('0x5c')][_0x4801('0x5d')],'raw':!![],'transaction':_0x4522bf})[_0x4801('0x2a')](function(_0x356367){_0x3849ef=_[_0x4801('0x34')](_0x356367,function(_0x52c9a0){return Number(_0x52c9a0[_0x4801('0x5e')]);});})['then'](function(){var _0xfa833c=_0x4801('0x5f')+_0x55f989;return db[_0x4801('0x5a')][_0x4801('0x36')](_0xfa833c,{'type':db['Sequelize'][_0x4801('0x5c')][_0x4801('0x5d')],'raw':!![],'transaction':_0x4522bf});})[_0x4801('0x2a')](function(_0x3b514a){var _0x132a58=_[_0x4801('0x34')](_0x3b514a,function(_0xd2522f){return Number(_0xd2522f[_0x4801('0x60')]);});return db['UserVoiceQueue'][_0x4801('0x57')]({'where':{'UserId':{'$in':_0x3849ef},'VoiceQueueId':{'$in':_0x132a58}},'transaction':_0x4522bf});})[_0x4801('0x2a')](function(){var _0x1db974=_0x4801('0x61')+_0x55f989;return db[_0x4801('0x5a')][_0x4801('0x36')](_0x1db974,{'type':db[_0x4801('0x5b')][_0x4801('0x5c')][_0x4801('0x5d')],'raw':!![],'transaction':_0x4522bf});})[_0x4801('0x2a')](function(_0x22cdc7){var _0x288531=_[_0x4801('0x34')](_0x22cdc7,function(_0x4bbc3f){return Number(_0x4bbc3f['MailQueueId']);});return db[_0x4801('0x62')][_0x4801('0x57')]({'where':{'UserId':{'$in':_0x3849ef},'MailQueueId':{'$in':_0x288531}},'transaction':_0x4522bf});})[_0x4801('0x2a')](function(){var _0x1a416f='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x55f989;return db[_0x4801('0x5a')][_0x4801('0x36')](_0x1a416f,{'type':db[_0x4801('0x5b')]['QueryTypes'][_0x4801('0x5d')],'raw':!![],'transaction':_0x4522bf});})['then'](function(_0x334691){var _0x34d4f9=_[_0x4801('0x34')](_0x334691,function(_0xc07708){return Number(_0xc07708[_0x4801('0x63')]);});return db[_0x4801('0x64')][_0x4801('0x57')]({'where':{'UserId':{'$in':_0x3849ef},'SmsQueueId':{'$in':_0x34d4f9}},'transaction':_0x4522bf});})[_0x4801('0x2a')](function(){var _0x4da222=_0x4801('0x65')+_0x55f989;return db[_0x4801('0x5a')]['query'](_0x4da222,{'type':db[_0x4801('0x5b')][_0x4801('0x5c')][_0x4801('0x5d')],'raw':!![],'transaction':_0x4522bf});})['then'](function(_0x1510ab){var _0x1018f1=_[_0x4801('0x34')](_0x1510ab,function(_0x40763e){return Number(_0x40763e[_0x4801('0x66')]);});return db[_0x4801('0x67')][_0x4801('0x57')]({'where':{'UserId':{'$in':_0x3849ef},'ChatQueueId':{'$in':_0x1018f1}},'transaction':_0x4522bf});})[_0x4801('0x2a')](function(){var _0x32d9bd='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x55f989;return db[_0x4801('0x5a')][_0x4801('0x36')](_0x32d9bd,{'type':db['Sequelize'][_0x4801('0x5c')][_0x4801('0x5d')],'raw':!![],'transaction':_0x4522bf});})[_0x4801('0x2a')](function(_0x3882cc){var _0x13b400=_[_0x4801('0x34')](_0x3882cc,function(_0xc39b7b){return Number(_0xc39b7b['FaxQueueId']);});return db[_0x4801('0x68')][_0x4801('0x57')]({'where':{'UserId':{'$in':_0x3849ef},'FaxQueueId':{'$in':_0x13b400}},'transaction':_0x4522bf});})[_0x4801('0x2a')](function(){var _0x47581d=_0x4801('0x69')+_0x55f989;return db[_0x4801('0x5a')][_0x4801('0x36')](_0x47581d,{'type':db[_0x4801('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4522bf});})['then'](function(_0x3af98c){var _0x401e31=_[_0x4801('0x34')](_0x3af98c,function(_0x458d2a){return Number(_0x458d2a[_0x4801('0x6a')]);});return db[_0x4801('0x6b')][_0x4801('0x57')]({'where':{'UserId':{'$in':_0x3849ef},'OpenchannelQueueId':{'$in':_0x401e31}},'transaction':_0x4522bf});})[_0x4801('0x2a')](function(){var _0x225539=_0x4801('0x6c')+_0x55f989;return db[_0x4801('0x5a')][_0x4801('0x36')](_0x225539,{'type':db[_0x4801('0x5b')]['QueryTypes'][_0x4801('0x5d')],'raw':!![],'transaction':_0x4522bf});})[_0x4801('0x2a')](function(_0x578985){var _0x398533=_[_0x4801('0x34')](_0x578985,function(_0x93d057){return Number(_0x93d057[_0x4801('0x6d')]);});return db[_0x4801('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x3849ef},'WhatsappQueueId':{'$in':_0x398533}},'transaction':_0x4522bf});})[_0x4801('0x2a')](function(){return db[_0x4801('0x6f')][_0x4801('0x4c')]({'where':{'TeamId':_0x55f989}});})[_0x4801('0x2a')](function(_0xa4ed76){if(_0xa4ed76===null){return;}return db['UserVoicePrefix'][_0x4801('0x57')]({'where':{'UserId':{'$in':_0x3849ef},'VoicePrefixId':_0xa4ed76[_0x4801('0x70')]},'transaction':_0x4522bf});})[_0x4801('0x2a')](function(){return db['Team'][_0x4801('0x57')]({'where':{'id':_0x55f989},'cascade':!![],'transaction':_0x4522bf});})['then'](function(_0x28c87f){if(_0x28c87f===0x0){_0x31ba40[_0x4801('0x1e')](0x194);}else{return db[_0x4801('0x54')][_0x4801('0x57')]({'where':{'type':_0x4801('0x71'),'resourceId':_0x55f989},'cascade':!![],'transaction':_0x4522bf})[_0x4801('0x2a')](function(){_0x31ba40['status'](0xcc)[_0x4801('0x72')]();});}})['catch'](function(_0x5f9f64){_0x31ba40[_0x4801('0x1f')](0x1f4)[_0x4801('0x2d')](_0x5f9f64);});});};exports[_0x4801('0x73')]=function(_0x45f765,_0x125e14,_0x4f03ad){return db['Team'][_0x4801('0x74')]({'where':{'id':_0x45f765[_0x4801('0x56')]['id']}})[_0x4801('0x2a')](handleEntityNotFound(_0x125e14,null))[_0x4801('0x2a')](function(_0x3c15ff){if(!_0x45f765[_0x4801('0x36')][_0x4801('0x75')]||!utils[_0x4801('0x76')](_0x45f765[_0x4801('0x36')][_0x4801('0x75')])){throw new db['Sequelize'][(_0x4801('0x77'))](_0x4801('0x78'));}var _0x505ba8={};var _0x28402f={};_0x28402f['model']=_[_0x4801('0x49')](db[_[_0x4801('0x79')](_0x45f765[_0x4801('0x36')]['channel'][_0x4801('0x7a')]())+_0x4801('0x7b')][_0x4801('0x2f')]);_0x28402f['query']=_[_0x4801('0x49')](_0x45f765[_0x4801('0x36')]);_0x28402f[_0x4801('0x3f')]=_['intersection'](_0x28402f[_0x4801('0x33')],_0x28402f[_0x4801('0x36')]);_0x505ba8[_0x4801('0x37')]=_[_0x4801('0x38')](_0x28402f[_0x4801('0x33')],qs[_0x4801('0x39')](_0x45f765[_0x4801('0x36')]['fields']));_0x505ba8[_0x4801('0x37')]=_0x505ba8[_0x4801('0x37')][_0x4801('0x4a')]?_0x505ba8[_0x4801('0x37')]:_0x28402f[_0x4801('0x33')];_0x505ba8[_0x4801('0x3b')]=qs[_0x4801('0x3b')](_0x45f765[_0x4801('0x36')][_0x4801('0x3b')]);_0x505ba8[_0x4801('0x21')]=qs[_0x4801('0x21')](_0x45f765[_0x4801('0x36')][_0x4801('0x21')]);_0x505ba8[_0x4801('0x3c')]=qs['sort'](_0x45f765[_0x4801('0x36')]['sort']);_0x505ba8['where']=qs[_0x4801('0x3f')](_['pick'](_0x45f765[_0x4801('0x36')],_0x28402f['filters']));_0x505ba8=_[_0x4801('0x42')]({},_0x505ba8,_0x45f765[_0x4801('0x43')]);return _0x3c15ff[_0x4801('0x4f')+_[_0x4801('0x79')](_0x45f765['query'][_0x4801('0x75')][_0x4801('0x7a')]())+_0x4801('0x7c')](_0x505ba8);})['then'](respondWithResult(_0x125e14,null))['catch'](handleError(_0x125e14,null));};exports[_0x4801('0x7d')]=function(_0x245f88,_0x557068,_0x5e728f){return db['Team']['findOne']({'where':{'id':_0x245f88[_0x4801('0x56')]['id']}})[_0x4801('0x2a')](function(_0xdb3d97){if(_0xdb3d97){if(!_0x245f88[_0x4801('0x4e')]['channel']||!utils[_0x4801('0x76')](_0x245f88[_0x4801('0x4e')][_0x4801('0x75')])){throw new db[(_0x4801('0x5b'))]['ValidationError'](_0x4801('0x78'));}return _0xdb3d97[_0x4801('0x7e')+_[_0x4801('0x79')](_0x245f88[_0x4801('0x4e')][_0x4801('0x75')][_0x4801('0x7a')]())+_0x4801('0x7c')](_0x245f88[_0x4801('0x4e')]['ids']);}return null;})['then'](handleEntityNotFound(_0x557068,null))[_0x4801('0x2a')](respondWithStatusCode(_0x557068,null))[_0x4801('0x48')](handleError(_0x557068,null));};exports[_0x4801('0x7f')]=function(_0x2f4862,_0x37be11,_0x245aaa){return db[_0x4801('0x44')][_0x4801('0x74')]({'where':{'id':_0x2f4862[_0x4801('0x56')]['id']}})[_0x4801('0x2a')](function(_0x2242e2){if(_0x2242e2){if(!_0x2f4862[_0x4801('0x36')]['channel']||!utils['isValidChannel'](_0x2f4862[_0x4801('0x36')][_0x4801('0x75')])){throw new db['Sequelize'][(_0x4801('0x77'))](_0x4801('0x78'));}return _0x2242e2['remove'+_[_0x4801('0x79')](_0x2f4862[_0x4801('0x36')][_0x4801('0x75')][_0x4801('0x7a')]())+_0x4801('0x7c')](_0x2f4862[_0x4801('0x36')][_0x4801('0x80')]);}return null;})['then'](handleEntityNotFound(_0x37be11,null))[_0x4801('0x2a')](respondWithStatusCode(_0x37be11,null))[_0x4801('0x48')](handleError(_0x37be11,null));};exports[_0x4801('0x81')]=function(_0x2a16bd,_0x5d2ee3){var _0x50b0de=_[_0x4801('0x82')](_0x2a16bd[_0x4801('0x4e')][_0x4801('0x80')])?_0x2a16bd[_0x4801('0x4e')][_0x4801('0x80')]:[_0x2a16bd['body']['ids']];var _0x3de07c=_0x2a16bd[_0x4801('0x56')]['id'];return db['Team'][_0x4801('0x4c')]({'where':{'id':_0x3de07c}})[_0x4801('0x2a')](handleEntityNotFound(_0x5d2ee3,null))[_0x4801('0x2a')](function(_0x48be5c){if(_0x48be5c){var _0xc0e73e=[_0x4801('0x83'),'Chat',_0x4801('0x84'),_0x4801('0x85'),'Fax','Openchannel',_0x4801('0x86')];return db[_0x4801('0x5a')][_0x4801('0x58')](function(_0x139ac8){var _0x5e87e6=_['map'](_0xc0e73e,function(_0x5d64f8){var _0x267886={'attributes':['id','name']};if(_0x5d64f8===_0x4801('0x83')){_0x267886[_0x4801('0x87')]={'attributes':[_0x4801('0x88')]};}return _0x48be5c[_0x4801('0x4f')+_0x5d64f8+_0x4801('0x7c')](_0x267886)[_0x4801('0x2a')](function(_0x35e764){var _0x34bae1=_[_0x4801('0x34')](_0x35e764,function(_0x55e4cb){var _0x5e7d0e=_[_0x4801('0x34')](_0x50b0de,function(_0xc016bb){var _0x3667b5={'where':{'UserId':_0xc016bb,[_0x5d64f8+_0x4801('0x89')]:_0x55e4cb['id']},'transaction':_0x139ac8};if(_0x5d64f8===_0x4801('0x83')){_0x3667b5[_0x4801('0x19')]={'penalty':_0x55e4cb[_0x4801('0x8a')][_0x4801('0x88')]};}return db['User'+_0x5d64f8+_0x4801('0x7b')][_0x4801('0x8b')](_0x3667b5)['then'](function(){socket[_0x4801('0x8c')]('user'+_0x5d64f8+_0x4801('0x8d'),{'UserId':_0xc016bb,[_0x5d64f8+_0x4801('0x89')]:_0x55e4cb['id']});if(_0x5d64f8!==_0x4801('0x83')){return;}return db['User'][_0x4801('0x46')]({'where':{'id':_0x50b0de,'online':0x1},'attributes':['id',_0x4801('0x35'),'online','voicePause',_0x4801('0x8e')],'raw':!![]})['then'](function(_0x1d4a6a){var _0x2c6814=_['map'](_0x1d4a6a,function(_0x548bfb){return db[_0x4801('0x8f')]['upsert']({'membername':_0x548bfb[_0x4801('0x35')],'UserId':_0x548bfb['id'],'queue_name':_0x55e4cb[_0x4801('0x35')],'VoiceQueueId':_0x55e4cb['id'],'interface':_['isNil'](_0x548bfb[_0x4801('0x8e')])?util['format'](_0x4801('0x90'),_0x548bfb[_0x4801('0x35')]):_0x548bfb[_0x4801('0x8e')],'paused':_0x548bfb[_0x4801('0x91')]||![],'penalty':_0x55e4cb['TeamVoiceQueue'][_0x4801('0x88')]},{'transaction':_0x139ac8});});return Promise[_0x4801('0x92')](_0x2c6814);});});});return Promise[_0x4801('0x92')](_0x5e7d0e);});return Promise[_0x4801('0x92')](_0x34bae1);})[_0x4801('0x2a')](function(){return db['TeamVoicePrefix'][_0x4801('0x74')]({'where':{'teamId':_0x3de07c}})[_0x4801('0x2a')](function(_0x15a8f7){if(_0x15a8f7){var _0x10651a=_[_0x4801('0x34')](_0x50b0de,function(_0x19cbe8){db[_0x4801('0x93')][_0x4801('0x94')]({'UserId':_0x19cbe8,'VoicePrefixId':_0x15a8f7[_0x4801('0x70')]});});return Promise['all'](_0x10651a);}});});});return Promise[_0x4801('0x92')](_0x5e87e6)[_0x4801('0x2a')](function(){return _0x48be5c[_0x4801('0x81')](_0x50b0de,{'transaction':_0x139ac8})[_0x4801('0x95')](function(_0xab4841){return _0xab4841;});});});}})[_0x4801('0x2a')](respondWithResult(_0x5d2ee3,null))[_0x4801('0x48')](handleError(_0x5d2ee3,null));};exports['removeAgents']=function(_0x31c4b1,_0x25121b){var _0x1b1bff=_[_0x4801('0x82')](_0x31c4b1[_0x4801('0x36')][_0x4801('0x80')])?_0x31c4b1[_0x4801('0x36')]['ids']:[_0x31c4b1[_0x4801('0x36')][_0x4801('0x80')]];var _0x20c42c=_0x31c4b1['params']['id'];return db['Team'][_0x4801('0x4c')]({'where':{'id':_0x20c42c}})['then'](handleEntityNotFound(_0x25121b,null))['then'](function(_0x27d882){if(_0x27d882){var _0x2c261d=[_0x4801('0x83'),_0x4801('0x96'),_0x4801('0x84'),_0x4801('0x85'),_0x4801('0x97'),_0x4801('0x98'),_0x4801('0x86')];return db[_0x4801('0x5a')][_0x4801('0x58')](function(_0x405444){var _0x401a0d=_[_0x4801('0x34')](_0x2c261d,function(_0x578fbc){var _0x3e070c={'attributes':['id',_0x4801('0x35')]};return _0x27d882[_0x4801('0x4f')+_0x578fbc+_0x4801('0x7c')](_0x3e070c)['then'](function(_0x5b87f8){var _0x3b8d9b=_[_0x4801('0x34')](_0x5b87f8,function(_0x272887){return _0x272887[_0x4801('0x99')](_0x1b1bff,{'transaction':_0x405444})[_0x4801('0x2a')](function(){var _0x1d3544=_[_0x4801('0x34')](_0x1b1bff,function(_0x54aaea){socket[_0x4801('0x8c')](_0x4801('0x52')+_0x578fbc+'Queue:remove',{'UserId':Number(_0x54aaea),[_0x578fbc+'QueueId']:_0x272887['id']});if(_0x578fbc!=='Voice'){return;}return db[_0x4801('0x8f')][_0x4801('0x57')]({'where':{'VoiceQueueId':_0x272887['id'],'UserId':_0x54aaea},'transaction':_0x405444});});return Promise['all'](_0x1d3544);});});return Promise[_0x4801('0x92')](_0x3b8d9b);});});return Promise[_0x4801('0x92')](_0x401a0d)['then'](function(){return _0x27d882['removeAgents'](_0x1b1bff,{'transaction':_0x405444});})[_0x4801('0x2a')](function(){return db[_0x4801('0x6f')]['findOne']({'where':{'teamId':_0x20c42c}})[_0x4801('0x2a')](function(_0x13758e){if(_0x13758e){var _0x506ec9=_['map'](_0x1b1bff,function(_0x3d8f69){db['UserVoicePrefix'][_0x4801('0x57')]({'where':{'UserId':_0x3d8f69,'VoicePrefixId':_0x13758e[_0x4801('0x70')]}});});return Promise[_0x4801('0x92')](_0x506ec9);}});});});}})[_0x4801('0x2a')](respondWithStatusCode(_0x25121b,null))[_0x4801('0x48')](handleError(_0x25121b,null));};exports[_0x4801('0x9a')]=function(_0x481ad0,_0x12e9dd,_0x255b78){var _0x177278={};var _0x2ce298={};var _0x3711d0;var _0xad90fd;return db[_0x4801('0x44')][_0x4801('0x74')]({'where':{'id':_0x481ad0[_0x4801('0x56')]['id']}})[_0x4801('0x2a')](handleEntityNotFound(_0x12e9dd,null))[_0x4801('0x2a')](function(_0x21a8cd){if(_0x21a8cd){_0x3711d0=_0x21a8cd;_0x2ce298[_0x4801('0x33')]=_[_0x4801('0x49')](db[_0x4801('0x9b')][_0x4801('0x2f')]);_0x2ce298[_0x4801('0x36')]=_[_0x4801('0x49')](_0x481ad0[_0x4801('0x36')]);_0x2ce298[_0x4801('0x3f')]=_['intersection'](_0x2ce298[_0x4801('0x33')],_0x2ce298[_0x4801('0x36')]);_0x177278[_0x4801('0x37')]=_[_0x4801('0x38')](_0x2ce298[_0x4801('0x33')],qs['fields'](_0x481ad0[_0x4801('0x36')][_0x4801('0x39')]));_0x177278[_0x4801('0x37')]=_0x177278['attributes'][_0x4801('0x4a')]?_0x177278['attributes']:_0x2ce298[_0x4801('0x33')];_0x177278['order']=qs['sort'](_0x481ad0[_0x4801('0x36')][_0x4801('0x3d')]);_0x177278[_0x4801('0x3e')]=qs[_0x4801('0x3f')](_['pick'](_0x481ad0[_0x4801('0x36')],_0x2ce298[_0x4801('0x3f')]));if(_0x481ad0[_0x4801('0x36')]['filter']){_0x177278[_0x4801('0x3e')]=_[_0x4801('0x42')](_0x177278['where'],{'$or':_[_0x4801('0x34')](_0x177278[_0x4801('0x37')],function(_0x53deec){var _0x42751f={};_0x42751f[_0x53deec]={'$like':'%'+_0x481ad0['query'][_0x4801('0x41')]+'%'};return _0x42751f;})});}_0x177278=_[_0x4801('0x42')]({},_0x177278,_0x481ad0[_0x4801('0x43')]);return _0x3711d0[_0x4801('0x9a')](_0x177278);}})[_0x4801('0x2a')](function(_0x59d276){if(_0x59d276){_0xad90fd=_0x59d276[_0x4801('0x4a')];if(!_0x481ad0[_0x4801('0x36')][_0x4801('0x9c')](_0x4801('0x3a'))){_0x177278['limit']=qs[_0x4801('0x3b')](_0x481ad0[_0x4801('0x36')][_0x4801('0x3b')]);_0x177278[_0x4801('0x21')]=qs[_0x4801('0x21')](_0x481ad0[_0x4801('0x36')]['offset']);}return _0x3711d0['getAgents'](_0x177278);}})[_0x4801('0x2a')](function(_0x4cca4d){if(_0x4cca4d){return _0x4cca4d?{'count':_0xad90fd,'rows':_0x4cca4d}:null;}})[_0x4801('0x2a')](respondWithResult(_0x12e9dd,null))[_0x4801('0x48')](handleError(_0x12e9dd,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8578e0e..a22d764 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 _0xbb19=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x2ec65e,_0x19d9b8){var _0x3e4620=function(_0x1e817e){while(--_0x1e817e){_0x2ec65e['push'](_0x2ec65e['shift']());}};_0x3e4620(++_0x19d9b8);}(_0xbb19,0x1a3));var _0x9bb1=function(_0x10e888,_0x39a586){_0x10e888=_0x10e888-0x0;var _0x52c367=_0xbb19[_0x10e888];return _0x52c367;};'use strict';var EventEmitter=require(_0x9bb1('0x0'));var Team=require(_0x9bb1('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9bb1('0x2'),'afterUpdate':_0x9bb1('0x3'),'afterDestroy':_0x9bb1('0x4')};function emitEvent(_0x3814ea){return function(_0x170993,_0x284f15,_0x545828){TeamEvents['emit'](_0x3814ea+':'+_0x170993['id'],_0x170993);TeamEvents[_0x9bb1('0x5')](_0x3814ea,_0x170993);_0x545828(null);};}for(var e in events){if(events[_0x9bb1('0x6')](e)){var event=events[e];Team[_0x9bb1('0x7')](e,emitEvent(event));}}module[_0x9bb1('0x8')]=TeamEvents; \ No newline at end of file +var _0x74d7=['hasOwnProperty','hook','events','Team','setMaxListeners','save','update','remove','emit'];(function(_0x18026e,_0x4590f3){var _0x2af9e0=function(_0x59b5b3){while(--_0x59b5b3){_0x18026e['push'](_0x18026e['shift']());}};_0x2af9e0(++_0x4590f3);}(_0x74d7,0x1a0));var _0x774d=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x74d7[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0x774d('0x0'));var Team=require('../../mysqldb')['db'][_0x774d('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x774d('0x2')](0x0);var events={'afterCreate':_0x774d('0x3'),'afterUpdate':_0x774d('0x4'),'afterDestroy':_0x774d('0x5')};function emitEvent(_0x3b996d){return function(_0x16b302,_0x84ac94,_0x4b536f){TeamEvents[_0x774d('0x6')](_0x3b996d+':'+_0x16b302['id'],_0x16b302);TeamEvents[_0x774d('0x6')](_0x3b996d,_0x16b302);_0x4b536f(null);};}for(var e in events){if(events[_0x774d('0x7')](e)){var event=events[e];Team[_0x774d('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 165d7a9..c23a379 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 _0x007c=['setDataValue','channel','catch','exports','Team','Chat','Fax','Mail','Sms','Whatsapp','map','all','get','Queues','then'];(function(_0x3ca7a9,_0x4fc0c7){var _0x399428=function(_0x3f30b2){while(--_0x3f30b2){_0x3ca7a9['push'](_0x3ca7a9['shift']());}};_0x399428(++_0x4fc0c7);}(_0x007c,0x1bf));var _0xc007=function(_0x2be0ba,_0x32c3ec){_0x2be0ba=_0x2be0ba-0x0;var _0x49a175=_0x007c[_0x2be0ba];return _0x49a175;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x3c158b,_0x3afb14){var _0x4f4c29=_0xc007('0x0')+_0x3afb14+_0xc007('0x1');return _0x3c158b[_0x4f4c29]()[_0xc007('0x2')](function(_0x1d65b8){return _['map'](_0x1d65b8,function(_0x9eaa73){_0x9eaa73[_0xc007('0x3')](_0xc007('0x4'),_0x3afb14);return _0x9eaa73;});})[_0xc007('0x5')](function(_0x103bcf){throw _0x103bcf;});}module[_0xc007('0x6')]=function(_0x2596b5){return _0x2596b5['define'](_0xc007('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x9604de=this;var _0xb149d8=[_0xc007('0x8'),_0xc007('0x9'),_0xc007('0xa'),'Openchannel',_0xc007('0xb'),'Voice',_0xc007('0xc')];return Promise['resolve']()[_0xc007('0x2')](function(){var _0x13ed85=_[_0xc007('0xd')](_0xb149d8,function(_0x4f28f3){return getQueuesByChannel(_0x9604de,_0x4f28f3);});return Promise[_0xc007('0xe')](_0x13ed85);})[_0xc007('0x5')](function(_0x3f3d72){throw _0x3f3d72;});}}});}; \ No newline at end of file +var _0xdf3c=['define','Team','teams','Chat','Mail','Openchannel','Voice','resolve','lodash','./team.attributes','get','Queues','then','map','channel','catch','exports'];(function(_0x31f07b,_0x594b5f){var _0x444e38=function(_0x1e2a4e){while(--_0x1e2a4e){_0x31f07b['push'](_0x31f07b['shift']());}};_0x444e38(++_0x594b5f);}(_0xdf3c,0x107));var _0xcdf3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xdf3c[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xcdf3('0x0'));var attributes=require(_0xcdf3('0x1'));function getQueuesByChannel(_0x17698e,_0x5036ca){var _0x5c4a72=_0xcdf3('0x2')+_0x5036ca+_0xcdf3('0x3');return _0x17698e[_0x5c4a72]()[_0xcdf3('0x4')](function(_0x7dee3a){return _[_0xcdf3('0x5')](_0x7dee3a,function(_0x749076){_0x749076['setDataValue'](_0xcdf3('0x6'),_0x5036ca);return _0x749076;});})[_0xcdf3('0x7')](function(_0x143217){throw _0x143217;});}module[_0xcdf3('0x8')]=function(_0x44c1fc){return _0x44c1fc[_0xcdf3('0x9')](_0xcdf3('0xa'),attributes,{'tableName':_0xcdf3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x179d17=this;var _0x1635e0=[_0xcdf3('0xc'),'Fax',_0xcdf3('0xd'),_0xcdf3('0xe'),'Sms',_0xcdf3('0xf'),'Whatsapp'];return Promise[_0xcdf3('0x10')]()[_0xcdf3('0x4')](function(){var _0x54417d=_['map'](_0x1635e0,function(_0x5f5b02){return getQueuesByChannel(_0x179d17,_0x5f5b02);});return Promise['all'](_0x54417d);})['catch'](function(_0x1891a9){throw _0x1891a9;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index e779cd7..6065fe6 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 _0x5770=['redis','localhost','socket.io-emitter','./team.socket','register','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x57aa39,_0x5b7dd9){var _0x1d9f2e=function(_0xda8d8a){while(--_0xda8d8a){_0x57aa39['push'](_0x57aa39['shift']());}};_0x1d9f2e(++_0x5b7dd9);}(_0x5770,0x15f));var _0x0577=function(_0x18fd0b,_0xe0f9ed){_0x18fd0b=_0x18fd0b-0x0;var _0x3b19a3=_0x5770[_0x18fd0b];return _0x3b19a3;};'use strict';var _=require(_0x0577('0x0'));var util=require(_0x0577('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0577('0x2'));var fs=require('fs');var Redis=require(_0x0577('0x3'));var db=require(_0x0577('0x4'))['db'];var utils=require(_0x0577('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0577('0x6'));var jayson=require(_0x0577('0x7'));var client=jayson[_0x0577('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x0577('0x9')],{'host':_0x0577('0xa'),'port':0x18eb});var socket=require(_0x0577('0xb'))(new Redis(config[_0x0577('0x9')]));require(_0x0577('0xc'))[_0x0577('0xd')](socket);function respondWithRpcPromise(_0x180da0,_0x295afb,_0x1f0201){return new BPromise(function(_0x2528bd,_0x21c0ce){return client[_0x0577('0xe')](_0x180da0,_0x1f0201)['then'](function(_0x541915){logger['info'](_0x0577('0xf'),_0x295afb,_0x0577('0x10'));logger[_0x0577('0x11')](_0x0577('0x12'),_0x295afb,_0x0577('0x10'),JSON['stringify'](_0x541915));if(_0x541915[_0x0577('0x13')]){if(_0x541915[_0x0577('0x13')]['code']===0x1f4){logger[_0x0577('0x13')]('Team,\x20%s,\x20%s',_0x295afb,_0x541915['error'][_0x0577('0x14')]);return _0x21c0ce(_0x541915['error'][_0x0577('0x14')]);}logger['error'](_0x0577('0xf'),_0x295afb,_0x541915[_0x0577('0x13')][_0x0577('0x14')]);return _0x2528bd(_0x541915[_0x0577('0x13')][_0x0577('0x14')]);}else{logger[_0x0577('0x15')](_0x0577('0xf'),_0x295afb,_0x0577('0x10'));_0x2528bd(_0x541915[_0x0577('0x16')][_0x0577('0x14')]);}})[_0x0577('0x17')](function(_0x3cb13d){logger[_0x0577('0x13')](_0x0577('0xf'),_0x295afb,_0x3cb13d);_0x21c0ce(_0x3cb13d);});});} \ No newline at end of file +var _0x6c13=['jayson/promise','http','redis','defaults','socket.io-emitter','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c13,0x12f));var _0x36c1=function(_0x5a529b,_0x555ba9){_0x5a529b=_0x5a529b-0x0;var _0x3a1ab5=_0x6c13[_0x5a529b];return _0x3a1ab5;};'use strict';var _=require(_0x36c1('0x0'));var util=require(_0x36c1('0x1'));var moment=require(_0x36c1('0x2'));var BPromise=require(_0x36c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36c1('0x4'));var db=require(_0x36c1('0x5'))['db'];var utils=require(_0x36c1('0x6'));var logger=require('../../config/logger')(_0x36c1('0x7'));var config=require(_0x36c1('0x8'));var jayson=require(_0x36c1('0x9'));var client=jayson['client'][_0x36c1('0xa')]({'port':0x232a});config[_0x36c1('0xb')]=_[_0x36c1('0xc')](config[_0x36c1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x36c1('0xd'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x561fd7,_0x484f32,_0x1841ff){return new BPromise(function(_0x5427fa,_0xa05945){return client['request'](_0x561fd7,_0x1841ff)[_0x36c1('0xe')](function(_0x2badc9){logger[_0x36c1('0xf')](_0x36c1('0x10'),_0x484f32,_0x36c1('0x11'));logger['debug'](_0x36c1('0x12'),_0x484f32,_0x36c1('0x11'),JSON[_0x36c1('0x13')](_0x2badc9));if(_0x2badc9[_0x36c1('0x14')]){if(_0x2badc9[_0x36c1('0x14')][_0x36c1('0x15')]===0x1f4){logger[_0x36c1('0x14')]('Team,\x20%s,\x20%s',_0x484f32,_0x2badc9[_0x36c1('0x14')]['message']);return _0xa05945(_0x2badc9[_0x36c1('0x14')][_0x36c1('0x16')]);}logger[_0x36c1('0x14')](_0x36c1('0x10'),_0x484f32,_0x2badc9[_0x36c1('0x14')][_0x36c1('0x16')]);return _0x5427fa(_0x2badc9[_0x36c1('0x14')][_0x36c1('0x16')]);}else{logger[_0x36c1('0xf')](_0x36c1('0x10'),_0x484f32,_0x36c1('0x11'));_0x5427fa(_0x2badc9[_0x36c1('0x17')]['message']);}})['catch'](function(_0x1f7cab){logger[_0x36c1('0x14')](_0x36c1('0x10'),_0x484f32,_0x1f7cab);_0xa05945(_0x1f7cab);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 150335e..bfb7242 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 _0xe181=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xe181,0x17a));var _0x1e18=function(_0xf97eb0,_0x1578b7){_0xf97eb0=_0xf97eb0-0x0;var _0xea70f4=_0xe181[_0xf97eb0];return _0xea70f4;};'use strict';var TeamEvents=require(_0x1e18('0x0'));var events=[_0x1e18('0x1'),_0x1e18('0x2'),_0x1e18('0x3')];function createListener(_0x25dc7d,_0x839cff){return function(_0x9bd9e0){_0x839cff[_0x1e18('0x4')](_0x25dc7d,_0x9bd9e0);};}function removeListener(_0x277333,_0x4122ed){return function(){TeamEvents[_0x1e18('0x5')](_0x277333,_0x4122ed);};}exports[_0x1e18('0x6')]=function(_0x34f9c4){for(var _0x2bafc4=0x0,_0x57f607=events[_0x1e18('0x7')];_0x2bafc4<_0x57f607;_0x2bafc4++){var _0x1c5fe5=events[_0x2bafc4];var _0x5a6ebc=createListener(_0x1e18('0x8')+_0x1c5fe5,_0x34f9c4);TeamEvents['on'](_0x1c5fe5,_0x5a6ebc);}}; \ No newline at end of file +var _0x76d2=['./team.events','save','remove','emit','removeListener','register','length','team:'];(function(_0x5293b4,_0x5a07e7){var _0x1b71a7=function(_0x5d84e2){while(--_0x5d84e2){_0x5293b4['push'](_0x5293b4['shift']());}};_0x1b71a7(++_0x5a07e7);}(_0x76d2,0xf8));var _0x276d=function(_0x5490c5,_0x4f90cb){_0x5490c5=_0x5490c5-0x0;var _0x3ff2e7=_0x76d2[_0x5490c5];return _0x3ff2e7;};'use strict';var TeamEvents=require(_0x276d('0x0'));var events=[_0x276d('0x1'),_0x276d('0x2'),'update'];function createListener(_0x1d0b17,_0x125834){return function(_0x2d4d90){_0x125834[_0x276d('0x3')](_0x1d0b17,_0x2d4d90);};}function removeListener(_0x57422a,_0x5f21ff){return function(){TeamEvents[_0x276d('0x4')](_0x57422a,_0x5f21ff);};}exports[_0x276d('0x5')]=function(_0x27729d){for(var _0x1904bf=0x0,_0x138f9f=events[_0x276d('0x6')];_0x1904bf<_0x138f9f;_0x1904bf++){var _0x357d9a=events[_0x1904bf];var _0x233a6c=createListener(_0x276d('0x7')+_0x357d9a,_0x27729d);TeamEvents['on'](_0x357d9a,_0x233a6c);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4049b6b..cf0a52c 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 _0xfac4=['INTEGER'];(function(_0x2861d0,_0x5a9d6a){var _0x3e987a=function(_0x4094a6){while(--_0x4094a6){_0x2861d0['push'](_0x2861d0['shift']());}};_0x3e987a(++_0x5a9d6a);}(_0xfac4,0xb1));var _0x4fac=function(_0x4eac0c,_0x422cdc){_0x4eac0c=_0x4eac0c-0x0;var _0x2ed205=_0xfac4[_0x4eac0c];return _0x2ed205;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x4fac('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x4fac('0x0')]}}; \ No newline at end of file +var _0x43b1=['exports','INTEGER','sequelize'];(function(_0x283ec9,_0x38e48b){var _0x52d8cd=function(_0xc07c19){while(--_0xc07c19){_0x283ec9['push'](_0x283ec9['shift']());}};_0x52d8cd(++_0x38e48b);}(_0x43b1,0x7d));var _0x143b=function(_0xe590ca,_0x3eed96){_0xe590ca=_0xe590ca-0x0;var _0x124882=_0x43b1[_0xe590ca];return _0x124882;};'use strict';var Sequelize=require(_0x143b('0x0'));module[_0x143b('0x1')]={'TeamId':{'type':Sequelize[_0x143b('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 1c14e38..c10a5c0 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 _0x06ef=['path','rimraf','../../config/environment','exports','../../config/logger'];(function(_0x45dfc7,_0x32bfb8){var _0x27f020=function(_0x2d5480){while(--_0x2d5480){_0x45dfc7['push'](_0x45dfc7['shift']());}};_0x27f020(++_0x32bfb8);}(_0x06ef,0x185));var _0xf06e=function(_0x2af981,_0x59d094){_0x2af981=_0x2af981-0x0;var _0x5d30b9=_0x06ef[_0x2af981];return _0x5d30b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf06e('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf06e('0x1'));var rimraf=require(_0xf06e('0x2'));var config=require(_0xf06e('0x3'));var attributes=require('./teamVoicePrefix.attributes');module[_0xf06e('0x4')]=function(_0x71a36,_0x4be428){return _0x71a36['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd983=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0xb7acd4,_0x31ae1){var _0x1de12b=function(_0x14ad9d){while(--_0x14ad9d){_0xb7acd4['push'](_0xb7acd4['shift']());}};_0x1de12b(++_0x31ae1);}(_0xd983,0x1df));var _0x3d98=function(_0x26eea8,_0x5ae093){_0x26eea8=_0x26eea8-0x0;var _0x4c2b83=_0xd983[_0x26eea8];return _0x4c2b83;};'use strict';var _=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var logger=require(_0x3d98('0x2'))(_0x3d98('0x3'));var moment=require(_0x3d98('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d98('0x5'));var rimraf=require(_0x3d98('0x6'));var config=require(_0x3d98('0x7'));var attributes=require(_0x3d98('0x8'));module[_0x3d98('0x9')]=function(_0x3e32c6,_0x394587){return _0x3e32c6['define'](_0x3d98('0xa'),attributes,{'tableName':_0x3d98('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 d83d34c..90c51be 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x48ba26,_0x122ff3){var _0x1cb457=function(_0x294316){while(--_0x294316){_0x48ba26['push'](_0x48ba26['shift']());}};_0x1cb457(++_0x122ff3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4006b0,_0x22d412){var _0x40c042=function(_0x30c66f){while(--_0x30c66f){_0x4006b0['push'](_0x4006b0['shift']());}};_0x40c042(++_0x22d412);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xcb91[_0x374ada];return _0x449ed8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index ece3677..a3b07e5 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 _0x4bb6=['sequelize','exports'];(function(_0x555755,_0x37ac4a){var _0x342ab4=function(_0x2cb6d3){while(--_0x2cb6d3){_0x555755['push'](_0x555755['shift']());}};_0x342ab4(++_0x37ac4a);}(_0x4bb6,0x1f4));var _0x64bb=function(_0x5aa9bf,_0x343e9f){_0x5aa9bf=_0x5aa9bf-0x0;var _0x1feeb0=_0x4bb6[_0x5aa9bf];return _0x1feeb0;};'use strict';var Sequelize=require(_0x64bb('0x0'));module[_0x64bb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcff4=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcff4,0x7a));var _0x4cff=function(_0x1fbc85,_0x1ae169){_0x1fbc85=_0x1fbc85-0x0;var _0xd50bd6=_0xcff4[_0x1fbc85];return _0xd50bd6;};'use strict';var Sequelize=require(_0x4cff('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4cff('0x1')],'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 dd26863..6a697c5 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 _0x534d=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x534d,0x79));var _0xd534=function(_0x57dc45,_0x1eca2a){_0x57dc45=_0x57dc45-0x0;var _0x333680=_0x534d[_0x57dc45];return _0x333680;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var logger=require(_0xd534('0x2'))(_0xd534('0x3'));var moment=require(_0xd534('0x4'));var BPromise=require(_0xd534('0x5'));var rp=require(_0xd534('0x6'));var fs=require('fs');var path=require(_0xd534('0x7'));var rimraf=require(_0xd534('0x8'));var config=require(_0xd534('0x9'));var attributes=require(_0xd534('0xa'));module[_0xd534('0xb')]=function(_0x2e9c44,_0x2ebe36){return _0x2e9c44[_0xd534('0xc')](_0xd534('0xd'),attributes,{'tableName':_0xd534('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8135=['moment','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8135,0x99));var _0x5813=function(_0x3a529a,_0xdce6d5){_0x3a529a=_0x3a529a-0x0;var _0x42483f=_0x8135[_0x3a529a];return _0x42483f;};'use strict';var _=require('lodash');var util=require(_0x5813('0x0'));var logger=require(_0x5813('0x1'))(_0x5813('0x2'));var moment=require(_0x5813('0x3'));var BPromise=require('bluebird');var rp=require(_0x5813('0x4'));var fs=require('fs');var path=require(_0x5813('0x5'));var rimraf=require(_0x5813('0x6'));var config=require(_0x5813('0x7'));var attributes=require(_0x5813('0x8'));module['exports']=function(_0x57ac38,_0x27599d){return _0x57ac38[_0x5813('0x9')](_0x5813('0xa'),attributes,{'tableName':_0x5813('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 caaa6de..60d2a5d 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 _0xf4e5=['../../config/environment','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x1604b0,_0x48d196){var _0xf7ee7e=function(_0x368052){while(--_0x368052){_0x1604b0['push'](_0x1604b0['shift']());}};_0xf7ee7e(++_0x48d196);}(_0xf4e5,0xd4));var _0x5f4e=function(_0x117805,_0x5238e8){_0x117805=_0x117805-0x0;var _0x666b7=_0xf4e5[_0x117805];return _0x666b7;};'use strict';var _=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var moment=require(_0x5f4e('0x2'));var BPromise=require(_0x5f4e('0x3'));var rs=require(_0x5f4e('0x4'));var fs=require('fs');var Redis=require(_0x5f4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f4e('0x6'))(_0x5f4e('0x7'));var config=require(_0x5f4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f4e('0x9')][_0x5f4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3307df,_0xbb7fcc,_0x29199a){return new BPromise(function(_0x223ef1,_0x627bd9){return client[_0x5f4e('0xb')](_0x3307df,_0x29199a)[_0x5f4e('0xc')](function(_0x50767b){logger['info'](_0x5f4e('0xd'),_0xbb7fcc,_0x5f4e('0xe'));logger[_0x5f4e('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0xbb7fcc,_0x5f4e('0xe'),JSON[_0x5f4e('0x10')](_0x50767b));if(_0x50767b[_0x5f4e('0x11')]){if(_0x50767b[_0x5f4e('0x11')][_0x5f4e('0x12')]===0x1f4){logger[_0x5f4e('0x11')](_0x5f4e('0xd'),_0xbb7fcc,_0x50767b[_0x5f4e('0x11')][_0x5f4e('0x13')]);return _0x627bd9(_0x50767b[_0x5f4e('0x11')][_0x5f4e('0x13')]);}logger['error'](_0x5f4e('0xd'),_0xbb7fcc,_0x50767b[_0x5f4e('0x11')]['message']);return _0x223ef1(_0x50767b[_0x5f4e('0x11')][_0x5f4e('0x13')]);}else{logger[_0x5f4e('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0xbb7fcc,_0x5f4e('0xe'));_0x223ef1(_0x50767b[_0x5f4e('0x15')][_0x5f4e('0x13')]);}})['catch'](function(_0x1e62e5){logger[_0x5f4e('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0xbb7fcc,_0x1e62e5);_0x627bd9(_0x1e62e5);});});} \ No newline at end of file +var _0x53d1=['../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1b8b56,_0x14d6ab){var _0x27e26b=function(_0x35f262){while(--_0x35f262){_0x1b8b56['push'](_0x1b8b56['shift']());}};_0x27e26b(++_0x14d6ab);}(_0x53d1,0x174));var _0x153d=function(_0x5c3979,_0xd98781){_0x5c3979=_0x5c3979-0x0;var _0x427239=_0x53d1[_0x5c3979];return _0x427239;};'use strict';var _=require(_0x153d('0x0'));var util=require(_0x153d('0x1'));var moment=require('moment');var BPromise=require(_0x153d('0x2'));var rs=require(_0x153d('0x3'));var fs=require('fs');var Redis=require(_0x153d('0x4'));var db=require(_0x153d('0x5'))['db'];var utils=require(_0x153d('0x6'));var logger=require('../../config/logger')(_0x153d('0x7'));var config=require(_0x153d('0x8'));var jayson=require(_0x153d('0x9'));var client=jayson['client'][_0x153d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c91b7,_0x1e4c6a,_0x50c344){return new BPromise(function(_0x35667d,_0x502fb7){return client[_0x153d('0xb')](_0x1c91b7,_0x50c344)[_0x153d('0xc')](function(_0x5de3d6){logger[_0x153d('0xd')](_0x153d('0xe'),_0x1e4c6a,_0x153d('0xf'));logger['debug'](_0x153d('0x10'),_0x1e4c6a,_0x153d('0xf'),JSON[_0x153d('0x11')](_0x5de3d6));if(_0x5de3d6[_0x153d('0x12')]){if(_0x5de3d6['error']['code']===0x1f4){logger['error'](_0x153d('0xe'),_0x1e4c6a,_0x5de3d6[_0x153d('0x12')][_0x153d('0x13')]);return _0x502fb7(_0x5de3d6[_0x153d('0x12')][_0x153d('0x13')]);}logger[_0x153d('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1e4c6a,_0x5de3d6['error'][_0x153d('0x13')]);return _0x35667d(_0x5de3d6[_0x153d('0x12')][_0x153d('0x13')]);}else{logger[_0x153d('0xd')](_0x153d('0xe'),_0x1e4c6a,_0x153d('0xf'));_0x35667d(_0x5de3d6['result'][_0x153d('0x13')]);}})['catch'](function(_0x2f7871){logger[_0x153d('0x12')](_0x153d('0xe'),_0x1e4c6a,_0x2f7871);_0x502fb7(_0x2f7871);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 676b198..b3d2956 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 _0x5c3c=['post','create','put','update','/:id','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show'];(function(_0x348e46,_0x5187dc){var _0x58b74f=function(_0x5e2f00){while(--_0x5e2f00){_0x348e46['push'](_0x348e46['shift']());}};_0x58b74f(++_0x5187dc);}(_0x5c3c,0x132));var _0xc5c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5c3c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xe')]('/',auth['isAuthenticated'](),controller[_0xc5c3('0xf')]);router[_0xc5c3('0x10')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x11')]);router['delete'](_0xc5c3('0x12'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3c32=['get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./template.controller'];(function(_0x134af7,_0x4e2960){var _0x28ab74=function(_0x57a661){while(--_0x57a661){_0x134af7['push'](_0x134af7['shift']());}};_0x28ab74(++_0x4e2960);}(_0x3c32,0x161));var _0x23c3=function(_0x50e309,_0x37deb6){_0x50e309=_0x50e309-0x0;var _0x43d01d=_0x3c32[_0x50e309];return _0x43d01d;};'use strict';var multer=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var path=require(_0x23c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x23c3('0x3'));var router=express[_0x23c3('0x4')]();var fs_extra=require(_0x23c3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x23c3('0x6'));var config=require('../../config/environment');var controller=require(_0x23c3('0x7'));router[_0x23c3('0x8')]('/',auth[_0x23c3('0x9')](),controller[_0x23c3('0xa')]);router[_0x23c3('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x23c3('0xb')]('/',auth[_0x23c3('0x9')](),controller[_0x23c3('0xc')]);router[_0x23c3('0xd')](_0x23c3('0xe'),auth[_0x23c3('0x9')](),controller[_0x23c3('0xf')]);router[_0x23c3('0x10')](_0x23c3('0xe'),auth[_0x23c3('0x9')](),controller[_0x23c3('0x11')]);module[_0x23c3('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d486c97..c846460 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 _0x1b82=['sequelize','STRING','TEXT'];(function(_0x5d1631,_0x46e357){var _0x2c9872=function(_0x4530a1){while(--_0x4530a1){_0x5d1631['push'](_0x5d1631['shift']());}};_0x2c9872(++_0x46e357);}(_0x1b82,0x156));var _0x21b8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1b82[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x21b8('0x0'));module['exports']={'name':{'type':Sequelize[_0x21b8('0x1')]},'description':{'type':Sequelize[_0x21b8('0x1')]},'html':{'type':Sequelize[_0x21b8('0x2')]}}; \ No newline at end of file +var _0x6c9c=['sequelize','exports','STRING','TEXT'];(function(_0x379fd8,_0x1a8425){var _0x4b15cb=function(_0x4fcb51){while(--_0x4fcb51){_0x379fd8['push'](_0x379fd8['shift']());}};_0x4b15cb(++_0x1a8425);}(_0x6c9c,0xf4));var _0xc6c9=function(_0x277c7f,_0x26c59f){_0x277c7f=_0x277c7f-0x0;var _0xe124a=_0x6c9c[_0x277c7f];return _0xe124a;};'use strict';var Sequelize=require(_0xc6c9('0x0'));module[_0xc6c9('0x1')]={'name':{'type':Sequelize[_0xc6c9('0x2')]},'description':{'type':Sequelize[_0xc6c9('0x2')]},'html':{'type':Sequelize[_0xc6c9('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 009e8a9..afb047b 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 _0x39aa=['model','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','Template','findAll','rows','catch','show','params','include','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','map','rawAttributes','key','keys','query','filters','intersection'];(function(_0xea8509,_0x512cbc){var _0x39e573=function(_0x4fa97f){while(--_0x4fa97f){_0xea8509['push'](_0xea8509['shift']());}};_0x39e573(++_0x512cbc);}(_0x39aa,0x11b));var _0xa39a=function(_0x1aa6c4,_0x1ecfc7){_0x1aa6c4=_0x1aa6c4-0x0;var _0x3a522d=_0x39aa[_0x1aa6c4];return _0x3a522d;};'use strict';var emlformat=require(_0xa39a('0x0'));var rimraf=require(_0xa39a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa39a('0x2'));var rp=require(_0xa39a('0x3'));var moment=require(_0xa39a('0x4'));var BPromise=require(_0xa39a('0x5'));var Mustache=require(_0xa39a('0x6'));var util=require(_0xa39a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa39a('0x8'));var fs=require('fs');var fs_extra=require(_0xa39a('0x9'));var _=require(_0xa39a('0xa'));var squel=require(_0xa39a('0xb'));var crypto=require(_0xa39a('0xc'));var jsforce=require(_0xa39a('0xd'));var deskjs=require(_0xa39a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa39a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa39a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa39a('0x11'));var logger=require(_0xa39a('0x12'))(_0xa39a('0x13'));var utils=require(_0xa39a('0x14'));var config=require(_0xa39a('0x15'));var licenseUtil=require(_0xa39a('0x16'));var db=require(_0xa39a('0x17'))['db'];function respondWithStatusCode(_0x322920,_0x282180){_0x282180=_0x282180||0xcc;return function(_0x59a69d){if(_0x59a69d){return _0x322920['sendStatus'](_0x282180);}return _0x322920[_0xa39a('0x18')](_0x282180)[_0xa39a('0x19')]();};}function respondWithResult(_0x5dae72,_0x402117){_0x402117=_0x402117||0xc8;return function(_0x5a0f98){if(_0x5a0f98){return _0x5dae72[_0xa39a('0x18')](_0x402117)['json'](_0x5a0f98);}};}function respondWithFilteredResult(_0x901e2a,_0x4a94d2){return function(_0x1e1015){if(_0x1e1015){var _0x13c972=typeof _0x4a94d2[_0xa39a('0x1a')]===_0xa39a('0x1b')&&typeof _0x4a94d2[_0xa39a('0x1c')]===_0xa39a('0x1b');var _0x4d89cd=_0x1e1015[_0xa39a('0x1d')];var _0x3e9465=_0x13c972?0x0:_0x4a94d2[_0xa39a('0x1a')];var _0x1b7e2d=_0x13c972?_0x1e1015[_0xa39a('0x1d')]:_0x4a94d2[_0xa39a('0x1a')]+_0x4a94d2[_0xa39a('0x1c')];var _0x38a7e9;if(_0x1b7e2d>=_0x4d89cd){_0x1b7e2d=_0x4d89cd;_0x38a7e9=0xc8;}else{_0x38a7e9=0xce;}_0x901e2a[_0xa39a('0x18')](_0x38a7e9);return _0x901e2a[_0xa39a('0x1e')](_0xa39a('0x1f'),_0x3e9465+'-'+_0x1b7e2d+'/'+_0x4d89cd)[_0xa39a('0x20')](_0x1e1015);}return null;};}function patchUpdates(_0x5ac99f){return function(_0x555dfa){try{jsonpatch[_0xa39a('0x21')](_0x555dfa,_0x5ac99f,!![]);}catch(_0x562316){return BPromise[_0xa39a('0x22')](_0x562316);}return _0x555dfa[_0xa39a('0x23')]();};}function saveUpdates(_0x549967,_0x4ec627){return function(_0x1c689e){if(_0x1c689e){return _0x1c689e[_0xa39a('0x24')](_0x549967)[_0xa39a('0x25')](function(_0x58cf77){return _0x58cf77;});}return null;};}function removeEntity(_0x373c5f,_0x5f09c8){return function(_0x25cbe3){if(_0x25cbe3){return _0x25cbe3[_0xa39a('0x26')]()[_0xa39a('0x25')](function(){var _0x1fed5c=_0x25cbe3[_0xa39a('0x27')]({'plain':!![]});var _0x4e2117=_0xa39a('0x28');return db[_0xa39a('0x29')][_0xa39a('0x26')]({'where':{'type':_0x4e2117,'resourceId':_0x1fed5c['id']}})[_0xa39a('0x25')](function(){return _0x25cbe3;});})['then'](function(){_0x373c5f['status'](0xcc)[_0xa39a('0x19')]();});}};}function handleEntityNotFound(_0x1bef63,_0x4c16d9){return function(_0x1a2d1b){if(!_0x1a2d1b){_0x1bef63['sendStatus'](0x194);}return _0x1a2d1b;};}function handleError(_0x2125ed,_0x33a9dd){_0x33a9dd=_0x33a9dd||0x1f4;return function(_0x4ad695){logger[_0xa39a('0x2a')](_0x4ad695[_0xa39a('0x2b')]);if(_0x4ad695[_0xa39a('0x2c')]){delete _0x4ad695[_0xa39a('0x2c')];}_0x2125ed['status'](_0x33a9dd)[_0xa39a('0x2d')](_0x4ad695);};}exports['index']=function(_0x2352e8,_0x308bee){var _0x17f800={},_0x3424ed={},_0x4f7579={'count':0x0,'rows':[]};var _0x165ddb=_[_0xa39a('0x2e')](db['Template'][_0xa39a('0x2f')],function(_0x3c54ca){return{'name':_0x3c54ca['fieldName'],'type':_0x3c54ca['type'][_0xa39a('0x30')]};});_0x3424ed['model']=_[_0xa39a('0x2e')](_0x165ddb,_0xa39a('0x2c'));_0x3424ed['query']=_[_0xa39a('0x31')](_0x2352e8[_0xa39a('0x32')]);_0x3424ed[_0xa39a('0x33')]=_[_0xa39a('0x34')](_0x3424ed[_0xa39a('0x35')],_0x3424ed[_0xa39a('0x32')]);_0x17f800[_0xa39a('0x36')]=_[_0xa39a('0x34')](_0x3424ed[_0xa39a('0x35')],qs[_0xa39a('0x37')](_0x2352e8[_0xa39a('0x32')][_0xa39a('0x37')]));_0x17f800[_0xa39a('0x36')]=_0x17f800[_0xa39a('0x36')][_0xa39a('0x38')]?_0x17f800['attributes']:_0x3424ed['model'];if(!_0x2352e8[_0xa39a('0x32')]['hasOwnProperty'](_0xa39a('0x39'))){_0x17f800[_0xa39a('0x1c')]=qs['limit'](_0x2352e8[_0xa39a('0x32')][_0xa39a('0x1c')]);_0x17f800['offset']=qs[_0xa39a('0x1a')](_0x2352e8[_0xa39a('0x32')][_0xa39a('0x1a')]);}_0x17f800[_0xa39a('0x3a')]=qs[_0xa39a('0x3b')](_0x2352e8[_0xa39a('0x32')]['sort']);_0x17f800[_0xa39a('0x3c')]=qs['filters'](_[_0xa39a('0x3d')](_0x2352e8['query'],_0x3424ed[_0xa39a('0x33')]),_0x165ddb);if(_0x2352e8[_0xa39a('0x32')][_0xa39a('0x3e')]){_0x17f800[_0xa39a('0x3c')]=_['merge'](_0x17f800[_0xa39a('0x3c')],{'$or':_['map'](_0x165ddb,function(_0x58a24e){if(_0x58a24e[_0xa39a('0x3f')]!==_0xa39a('0x40')){var _0x3d13b1={};_0x3d13b1[_0x58a24e[_0xa39a('0x2c')]]={'$like':'%'+_0x2352e8[_0xa39a('0x32')][_0xa39a('0x3e')]+'%'};return _0x3d13b1;}})});}_0x17f800=_['merge']({},_0x17f800,_0x2352e8[_0xa39a('0x41')]);var _0x4677a4={'where':_0x17f800[_0xa39a('0x3c')]};return db[_0xa39a('0x42')]['count'](_0x4677a4)['then'](function(_0x132f8e){_0x4f7579[_0xa39a('0x1d')]=_0x132f8e;if(_0x2352e8[_0xa39a('0x32')]['includeAll']){_0x17f800['include']=[{'all':!![]}];}return db[_0xa39a('0x42')][_0xa39a('0x43')](_0x17f800);})[_0xa39a('0x25')](function(_0x14999d){_0x4f7579[_0xa39a('0x44')]=_0x14999d;return _0x4f7579;})[_0xa39a('0x25')](respondWithFilteredResult(_0x308bee,_0x17f800))[_0xa39a('0x45')](handleError(_0x308bee,null));};exports[_0xa39a('0x46')]=function(_0x40002b,_0x2c93b9){var _0x3af38e={'raw':!![],'where':{'id':_0x40002b[_0xa39a('0x47')]['id']}},_0x13d4ee={};_0x13d4ee[_0xa39a('0x35')]=_[_0xa39a('0x31')](db[_0xa39a('0x42')]['rawAttributes']);_0x13d4ee[_0xa39a('0x32')]=_['keys'](_0x40002b[_0xa39a('0x32')]);_0x13d4ee['filters']=_['intersection'](_0x13d4ee['model'],_0x13d4ee[_0xa39a('0x32')]);_0x3af38e[_0xa39a('0x36')]=_[_0xa39a('0x34')](_0x13d4ee[_0xa39a('0x35')],qs[_0xa39a('0x37')](_0x40002b[_0xa39a('0x32')]['fields']));_0x3af38e[_0xa39a('0x36')]=_0x3af38e[_0xa39a('0x36')][_0xa39a('0x38')]?_0x3af38e[_0xa39a('0x36')]:_0x13d4ee[_0xa39a('0x35')];if(_0x40002b[_0xa39a('0x32')]['includeAll']){_0x3af38e[_0xa39a('0x48')]=[{'all':!![]}];}_0x3af38e=_[_0xa39a('0x49')]({},_0x3af38e,_0x40002b['options']);return db[_0xa39a('0x42')][_0xa39a('0x4a')](_0x3af38e)[_0xa39a('0x25')](handleEntityNotFound(_0x2c93b9,null))['then'](respondWithResult(_0x2c93b9,null))[_0xa39a('0x45')](handleError(_0x2c93b9,null));};exports[_0xa39a('0x4b')]=function(_0xd77c77,_0x6c48cf){return db[_0xa39a('0x42')][_0xa39a('0x4b')](_0xd77c77['body'],{})['then'](function(_0x605c2c){var _0x6a6ab7=_0xd77c77[_0xa39a('0x4c')][_0xa39a('0x27')]({'plain':!![]});if(!_0x6a6ab7)throw new Error(_0xa39a('0x4d'));if(_0x6a6ab7[_0xa39a('0x4e')]==='user'){var _0x45bdf0=_0x605c2c[_0xa39a('0x27')]({'plain':!![]});var _0x5e9db3=_0xa39a('0x28');return db[_0xa39a('0x4f')][_0xa39a('0x4a')]({'where':{'name':_0x5e9db3,'userProfileId':_0x6a6ab7[_0xa39a('0x50')]},'raw':!![]})[_0xa39a('0x25')](function(_0x31d1f9){if(_0x31d1f9&&_0x31d1f9[_0xa39a('0x51')]===0x0){return db[_0xa39a('0x29')][_0xa39a('0x4b')]({'name':_0x45bdf0['name'],'resourceId':_0x45bdf0['id'],'type':_0x31d1f9[_0xa39a('0x2c')],'sectionId':_0x31d1f9['id']},{})[_0xa39a('0x25')](function(){return _0x605c2c;});}else{return _0x605c2c;}})['catch'](function(_0x2752fa){logger[_0xa39a('0x2a')](_0xa39a('0x52'),_0x2752fa);throw _0x2752fa;});}return _0x605c2c;})[_0xa39a('0x25')](respondWithResult(_0x6c48cf,0xc9))[_0xa39a('0x45')](handleError(_0x6c48cf,null));};exports[_0xa39a('0x24')]=function(_0x3ed777,_0x2afbd0){if(_0x3ed777[_0xa39a('0x53')]['id']){delete _0x3ed777[_0xa39a('0x53')]['id'];}return db[_0xa39a('0x42')][_0xa39a('0x4a')]({'where':{'id':_0x3ed777[_0xa39a('0x47')]['id']}})[_0xa39a('0x25')](handleEntityNotFound(_0x2afbd0,null))['then'](saveUpdates(_0x3ed777['body'],null))['then'](respondWithResult(_0x2afbd0,null))[_0xa39a('0x45')](handleError(_0x2afbd0,null));};exports[_0xa39a('0x26')]=function(_0xbb92a4,_0x27670f){return db['Template'][_0xa39a('0x4a')]({'where':{'id':_0xbb92a4['params']['id']}})[_0xa39a('0x25')](handleEntityNotFound(_0x27670f,null))[_0xa39a('0x25')](removeEntity(_0x27670f,null))[_0xa39a('0x45')](handleError(_0x27670f,null));}; \ No newline at end of file +var _0x1bb0=['map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Template','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1bb0,0x160));var _0x01bb=function(_0x40f703,_0x39fdcd){_0x40f703=_0x40f703-0x0;var _0x35db9d=_0x1bb0[_0x40f703];return _0x35db9d;};'use strict';var emlformat=require(_0x01bb('0x0'));var rimraf=require(_0x01bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x01bb('0x2'));var moment=require(_0x01bb('0x3'));var BPromise=require(_0x01bb('0x4'));var Mustache=require(_0x01bb('0x5'));var util=require(_0x01bb('0x6'));var path=require('path');var sox=require(_0x01bb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01bb('0x8'));var _=require(_0x01bb('0x9'));var squel=require(_0x01bb('0xa'));var crypto=require(_0x01bb('0xb'));var jsforce=require(_0x01bb('0xc'));var deskjs=require(_0x01bb('0xd'));var toCsv=require(_0x01bb('0xe'));var querystring=require(_0x01bb('0xf'));var Papa=require(_0x01bb('0x10'));var Redis=require(_0x01bb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x01bb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x01bb('0x13'));var utils=require('../../config/utils');var config=require(_0x01bb('0x14'));var licenseUtil=require(_0x01bb('0x15'));var db=require(_0x01bb('0x16'))['db'];function respondWithStatusCode(_0x5625be,_0x6081a1){_0x6081a1=_0x6081a1||0xcc;return function(_0x4e3096){if(_0x4e3096){return _0x5625be[_0x01bb('0x17')](_0x6081a1);}return _0x5625be[_0x01bb('0x18')](_0x6081a1)[_0x01bb('0x19')]();};}function respondWithResult(_0x204d52,_0x4aa80c){_0x4aa80c=_0x4aa80c||0xc8;return function(_0x35643c){if(_0x35643c){return _0x204d52[_0x01bb('0x18')](_0x4aa80c)[_0x01bb('0x1a')](_0x35643c);}};}function respondWithFilteredResult(_0x34f55f,_0x2e050d){return function(_0x23ceaa){if(_0x23ceaa){var _0x33fcf4=typeof _0x2e050d['offset']==='undefined'&&typeof _0x2e050d['limit']==='undefined';var _0x16083e=_0x23ceaa[_0x01bb('0x1b')];var _0x4594bb=_0x33fcf4?0x0:_0x2e050d['offset'];var _0x8d8cdf=_0x33fcf4?_0x23ceaa[_0x01bb('0x1b')]:_0x2e050d[_0x01bb('0x1c')]+_0x2e050d[_0x01bb('0x1d')];var _0x4beef5;if(_0x8d8cdf>=_0x16083e){_0x8d8cdf=_0x16083e;_0x4beef5=0xc8;}else{_0x4beef5=0xce;}_0x34f55f[_0x01bb('0x18')](_0x4beef5);return _0x34f55f['set']('Content-Range',_0x4594bb+'-'+_0x8d8cdf+'/'+_0x16083e)['json'](_0x23ceaa);}return null;};}function patchUpdates(_0x56d7b6){return function(_0x56ef77){try{jsonpatch[_0x01bb('0x1e')](_0x56ef77,_0x56d7b6,!![]);}catch(_0x2f1a9f){return BPromise[_0x01bb('0x1f')](_0x2f1a9f);}return _0x56ef77[_0x01bb('0x20')]();};}function saveUpdates(_0x37b1a0,_0x288957){return function(_0x9d4c0e){if(_0x9d4c0e){return _0x9d4c0e['update'](_0x37b1a0)[_0x01bb('0x21')](function(_0x53ef48){return _0x53ef48;});}return null;};}function removeEntity(_0x1799e4,_0x50ed1a){return function(_0x4484b8){if(_0x4484b8){return _0x4484b8[_0x01bb('0x22')]()[_0x01bb('0x21')](function(){var _0x4015cc=_0x4484b8[_0x01bb('0x23')]({'plain':!![]});var _0x5ea007=_0x01bb('0x24');return db[_0x01bb('0x25')][_0x01bb('0x22')]({'where':{'type':_0x5ea007,'resourceId':_0x4015cc['id']}})[_0x01bb('0x21')](function(){return _0x4484b8;});})[_0x01bb('0x21')](function(){_0x1799e4['status'](0xcc)[_0x01bb('0x19')]();});}};}function handleEntityNotFound(_0x5e176d,_0x3cd019){return function(_0x13e670){if(!_0x13e670){_0x5e176d[_0x01bb('0x17')](0x194);}return _0x13e670;};}function handleError(_0x3e11e2,_0x5aae5e){_0x5aae5e=_0x5aae5e||0x1f4;return function(_0x22426a){logger[_0x01bb('0x26')](_0x22426a[_0x01bb('0x27')]);if(_0x22426a[_0x01bb('0x28')]){delete _0x22426a['name'];}_0x3e11e2[_0x01bb('0x18')](_0x5aae5e)[_0x01bb('0x29')](_0x22426a);};}exports[_0x01bb('0x2a')]=function(_0x3d9fa2,_0x5a6dff){var _0x4d31f4={},_0x2c2a2f={},_0xe9a05e={'count':0x0,'rows':[]};var _0x11454c=_[_0x01bb('0x2b')](db['Template'][_0x01bb('0x2c')],function(_0x5224e3){return{'name':_0x5224e3['fieldName'],'type':_0x5224e3[_0x01bb('0x2d')][_0x01bb('0x2e')]};});_0x2c2a2f[_0x01bb('0x2f')]=_[_0x01bb('0x2b')](_0x11454c,'name');_0x2c2a2f[_0x01bb('0x30')]=_[_0x01bb('0x31')](_0x3d9fa2[_0x01bb('0x30')]);_0x2c2a2f[_0x01bb('0x32')]=_[_0x01bb('0x33')](_0x2c2a2f['model'],_0x2c2a2f['query']);_0x4d31f4[_0x01bb('0x34')]=_['intersection'](_0x2c2a2f[_0x01bb('0x2f')],qs['fields'](_0x3d9fa2['query'][_0x01bb('0x35')]));_0x4d31f4[_0x01bb('0x34')]=_0x4d31f4[_0x01bb('0x34')][_0x01bb('0x36')]?_0x4d31f4[_0x01bb('0x34')]:_0x2c2a2f[_0x01bb('0x2f')];if(!_0x3d9fa2[_0x01bb('0x30')][_0x01bb('0x37')](_0x01bb('0x38'))){_0x4d31f4['limit']=qs['limit'](_0x3d9fa2[_0x01bb('0x30')][_0x01bb('0x1d')]);_0x4d31f4['offset']=qs['offset'](_0x3d9fa2['query']['offset']);}_0x4d31f4[_0x01bb('0x39')]=qs['sort'](_0x3d9fa2[_0x01bb('0x30')][_0x01bb('0x3a')]);_0x4d31f4[_0x01bb('0x3b')]=qs[_0x01bb('0x32')](_['pick'](_0x3d9fa2[_0x01bb('0x30')],_0x2c2a2f[_0x01bb('0x32')]),_0x11454c);if(_0x3d9fa2['query'][_0x01bb('0x3c')]){_0x4d31f4['where']=_[_0x01bb('0x3d')](_0x4d31f4[_0x01bb('0x3b')],{'$or':_[_0x01bb('0x2b')](_0x11454c,function(_0x4cc171){if(_0x4cc171[_0x01bb('0x2d')]!=='VIRTUAL'){var _0x422404={};_0x422404[_0x4cc171[_0x01bb('0x28')]]={'$like':'%'+_0x3d9fa2[_0x01bb('0x30')]['filter']+'%'};return _0x422404;}})});}_0x4d31f4=_[_0x01bb('0x3d')]({},_0x4d31f4,_0x3d9fa2[_0x01bb('0x3e')]);var _0x32b5ec={'where':_0x4d31f4['where']};return db[_0x01bb('0x3f')][_0x01bb('0x1b')](_0x32b5ec)[_0x01bb('0x21')](function(_0x3f11f2){_0xe9a05e['count']=_0x3f11f2;if(_0x3d9fa2['query'][_0x01bb('0x40')]){_0x4d31f4['include']=[{'all':!![]}];}return db[_0x01bb('0x3f')][_0x01bb('0x41')](_0x4d31f4);})[_0x01bb('0x21')](function(_0xd1eec2){_0xe9a05e[_0x01bb('0x42')]=_0xd1eec2;return _0xe9a05e;})[_0x01bb('0x21')](respondWithFilteredResult(_0x5a6dff,_0x4d31f4))[_0x01bb('0x43')](handleError(_0x5a6dff,null));};exports[_0x01bb('0x44')]=function(_0x42de7d,_0x13056e){var _0x522737={'raw':!![],'where':{'id':_0x42de7d[_0x01bb('0x45')]['id']}},_0x45b67a={};_0x45b67a[_0x01bb('0x2f')]=_[_0x01bb('0x31')](db[_0x01bb('0x3f')][_0x01bb('0x2c')]);_0x45b67a['query']=_[_0x01bb('0x31')](_0x42de7d[_0x01bb('0x30')]);_0x45b67a[_0x01bb('0x32')]=_[_0x01bb('0x33')](_0x45b67a[_0x01bb('0x2f')],_0x45b67a[_0x01bb('0x30')]);_0x522737[_0x01bb('0x34')]=_['intersection'](_0x45b67a[_0x01bb('0x2f')],qs['fields'](_0x42de7d[_0x01bb('0x30')]['fields']));_0x522737[_0x01bb('0x34')]=_0x522737[_0x01bb('0x34')][_0x01bb('0x36')]?_0x522737[_0x01bb('0x34')]:_0x45b67a[_0x01bb('0x2f')];if(_0x42de7d['query'][_0x01bb('0x40')]){_0x522737['include']=[{'all':!![]}];}_0x522737=_[_0x01bb('0x3d')]({},_0x522737,_0x42de7d[_0x01bb('0x3e')]);return db[_0x01bb('0x3f')][_0x01bb('0x46')](_0x522737)[_0x01bb('0x21')](handleEntityNotFound(_0x13056e,null))[_0x01bb('0x21')](respondWithResult(_0x13056e,null))['catch'](handleError(_0x13056e,null));};exports[_0x01bb('0x47')]=function(_0x39582e,_0x5edf3c){return db[_0x01bb('0x3f')][_0x01bb('0x47')](_0x39582e[_0x01bb('0x48')],{})[_0x01bb('0x21')](function(_0x47128e){var _0x5bf265=_0x39582e[_0x01bb('0x49')]['get']({'plain':!![]});if(!_0x5bf265)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bf265[_0x01bb('0x4a')]===_0x01bb('0x49')){var _0x1bfb8c=_0x47128e[_0x01bb('0x23')]({'plain':!![]});var _0x2198d3=_0x01bb('0x24');return db[_0x01bb('0x4b')][_0x01bb('0x46')]({'where':{'name':_0x2198d3,'userProfileId':_0x5bf265['userProfileId']},'raw':!![]})['then'](function(_0x4068c1){if(_0x4068c1&&_0x4068c1[_0x01bb('0x4c')]===0x0){return db[_0x01bb('0x25')]['create']({'name':_0x1bfb8c[_0x01bb('0x28')],'resourceId':_0x1bfb8c['id'],'type':_0x4068c1[_0x01bb('0x28')],'sectionId':_0x4068c1['id']},{})[_0x01bb('0x21')](function(){return _0x47128e;});}else{return _0x47128e;}})[_0x01bb('0x43')](function(_0x128fc1){logger[_0x01bb('0x26')](_0x01bb('0x4d'),_0x128fc1);throw _0x128fc1;});}return _0x47128e;})[_0x01bb('0x21')](respondWithResult(_0x5edf3c,0xc9))['catch'](handleError(_0x5edf3c,null));};exports[_0x01bb('0x4e')]=function(_0x373189,_0x4a0a36){if(_0x373189[_0x01bb('0x48')]['id']){delete _0x373189['body']['id'];}return db[_0x01bb('0x3f')][_0x01bb('0x46')]({'where':{'id':_0x373189[_0x01bb('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a0a36,null))[_0x01bb('0x21')](saveUpdates(_0x373189[_0x01bb('0x48')],null))[_0x01bb('0x21')](respondWithResult(_0x4a0a36,null))[_0x01bb('0x43')](handleError(_0x4a0a36,null));};exports['destroy']=function(_0x25138b,_0x379c58){return db[_0x01bb('0x3f')][_0x01bb('0x46')]({'where':{'id':_0x25138b['params']['id']}})[_0x01bb('0x21')](handleEntityNotFound(_0x379c58,null))[_0x01bb('0x21')](removeEntity(_0x379c58,null))[_0x01bb('0x43')](handleError(_0x379c58,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 34c12cb..32313a6 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 _0x08f8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Template','lodash'];(function(_0x3afc75,_0x32dc5b){var _0x16f415=function(_0x405862){while(--_0x405862){_0x3afc75['push'](_0x3afc75['shift']());}};_0x16f415(++_0x32dc5b);}(_0x08f8,0x1ed));var _0x808f=function(_0x1015d1,_0x2a1acf){_0x1015d1=_0x1015d1-0x0;var _0x25e4ca=_0x08f8[_0x1015d1];return _0x25e4ca;};'use strict';var _=require(_0x808f('0x0'));var util=require(_0x808f('0x1'));var logger=require(_0x808f('0x2'))(_0x808f('0x3'));var moment=require(_0x808f('0x4'));var BPromise=require(_0x808f('0x5'));var rp=require(_0x808f('0x6'));var fs=require('fs');var path=require(_0x808f('0x7'));var rimraf=require(_0x808f('0x8'));var config=require(_0x808f('0x9'));var attributes=require('./template.attributes');module[_0x808f('0xa')]=function(_0x1bd4be,_0x551656){return _0x1bd4be[_0x808f('0xb')](_0x808f('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb65e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template'];(function(_0x3edcb4,_0x53da60){var _0x51bbca=function(_0x57631b){while(--_0x57631b){_0x3edcb4['push'](_0x3edcb4['shift']());}};_0x51bbca(++_0x53da60);}(_0xb65e,0x17a));var _0xeb65=function(_0x597408,_0x59d3b1){_0x597408=_0x597408-0x0;var _0xa9748b=_0xb65e[_0x597408];return _0xa9748b;};'use strict';var _=require(_0xeb65('0x0'));var util=require(_0xeb65('0x1'));var logger=require(_0xeb65('0x2'))(_0xeb65('0x3'));var moment=require(_0xeb65('0x4'));var BPromise=require(_0xeb65('0x5'));var rp=require(_0xeb65('0x6'));var fs=require('fs');var path=require(_0xeb65('0x7'));var rimraf=require(_0xeb65('0x8'));var config=require(_0xeb65('0x9'));var attributes=require(_0xeb65('0xa'));module[_0xeb65('0xb')]=function(_0xa11688,_0x4198af){return _0xa11688[_0xeb65('0xc')](_0xeb65('0xd'),attributes,{'tableName':'tools_templates','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 48ac67e..991313f 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 _0x9831=['raw','where','limit','include','model','attributes','map','GetTemplate','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9831,0xf8));var _0x1983=function(_0x3299ff,_0x92a72){_0x3299ff=_0x3299ff-0x0;var _0x3bcbba=_0x9831[_0x3299ff];return _0x3bcbba;};'use strict';var _=require(_0x1983('0x0'));var util=require(_0x1983('0x1'));var moment=require(_0x1983('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1983('0x3'));var db=require(_0x1983('0x4'))['db'];var utils=require(_0x1983('0x5'));var logger=require(_0x1983('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1983('0x7'));var client=jayson[_0x1983('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1885fa,_0x17337f,_0x45dc42){return new BPromise(function(_0x1054ce,_0x1f6289){return client['request'](_0x1885fa,_0x45dc42)['then'](function(_0x4ba2f3){logger[_0x1983('0x9')](_0x1983('0xa'),_0x17337f,'request\x20sent');logger[_0x1983('0xb')](_0x1983('0xc'),_0x17337f,_0x1983('0xd'),JSON[_0x1983('0xe')](_0x4ba2f3));if(_0x4ba2f3[_0x1983('0xf')]){if(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x10')]===0x1f4){logger[_0x1983('0xf')]('Template,\x20%s,\x20%s',_0x17337f,_0x4ba2f3['error'][_0x1983('0x11')]);return _0x1f6289(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);}logger['error'](_0x1983('0xa'),_0x17337f,_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);return _0x1054ce(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);}else{logger[_0x1983('0x9')](_0x1983('0xa'),_0x17337f,_0x1983('0xd'));_0x1054ce(_0x4ba2f3[_0x1983('0x12')][_0x1983('0x11')]);}})[_0x1983('0x13')](function(_0x297e42){logger[_0x1983('0xf')](_0x1983('0xa'),_0x17337f,_0x297e42);_0x1f6289(_0x297e42);});});}exports['GetTemplate']=function(_0xba2f09){var _0x22534=this;return new Promise(function(_0xc999f0,_0x25b19c){return db[_0x1983('0x14')]['findAll']({'raw':_0xba2f09[_0x1983('0x15')]?_0xba2f09['options'][_0x1983('0x16')]===undefined?!![]:![]:!![],'where':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')][_0x1983('0x17')]||null:null,'attributes':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')]['attributes']||null:null,'limit':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')][_0x1983('0x18')]||null:null,'include':_0xba2f09['options']?_0xba2f09[_0x1983('0x15')][_0x1983('0x19')]?_['map'](_0xba2f09[_0x1983('0x15')][_0x1983('0x19')],function(_0xfebaa9){return{'model':db[_0xfebaa9[_0x1983('0x1a')]],'as':_0xfebaa9['as'],'attributes':_0xfebaa9[_0x1983('0x1b')],'include':_0xfebaa9[_0x1983('0x19')]?_[_0x1983('0x1c')](_0xfebaa9[_0x1983('0x19')],function(_0xf740b0){return{'model':db[_0xf740b0[_0x1983('0x1a')]],'as':_0xf740b0['as'],'attributes':_0xf740b0[_0x1983('0x1b')],'include':_0xf740b0['include']?_[_0x1983('0x1c')](_0xf740b0[_0x1983('0x19')],function(_0x4d59f4){return{'model':db[_0x4d59f4[_0x1983('0x1a')]],'as':_0x4d59f4['as'],'attributes':_0x4d59f4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4837cd){logger[_0x1983('0x9')](_0x1983('0x1d'),_0xba2f09);logger[_0x1983('0xb')](_0x1983('0x1d'),_0xba2f09,JSON[_0x1983('0xe')](_0x4837cd));_0xc999f0(_0x4837cd);})[_0x1983('0x13')](function(_0x4f0d48){logger['error']('GetTemplate',_0x4f0d48['message'],_0xba2f09);_0x25b19c(_0x22534['error'](0x1f4,_0x4f0d48[_0x1983('0x11')]));});});}; \ No newline at end of file +var _0x8da8=['where','attributes','limit','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTemplate','findAll','options'];(function(_0x40b352,_0x45b570){var _0x3f4f93=function(_0x408804){while(--_0x408804){_0x40b352['push'](_0x40b352['shift']());}};_0x3f4f93(++_0x45b570);}(_0x8da8,0x187));var _0x88da=function(_0xa34bda,_0x34f584){_0xa34bda=_0xa34bda-0x0;var _0x37c970=_0x8da8[_0xa34bda];return _0x37c970;};'use strict';var _=require(_0x88da('0x0'));var util=require(_0x88da('0x1'));var moment=require(_0x88da('0x2'));var BPromise=require(_0x88da('0x3'));var rs=require(_0x88da('0x4'));var fs=require('fs');var Redis=require(_0x88da('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x88da('0x6'));var logger=require(_0x88da('0x7'))(_0x88da('0x8'));var config=require(_0x88da('0x9'));var jayson=require(_0x88da('0xa'));var client=jayson[_0x88da('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6baa96,_0x33e3be,_0x3de109){return new BPromise(function(_0x3b2868,_0x58a969){return client['request'](_0x6baa96,_0x3de109)[_0x88da('0xc')](function(_0x10db86){logger[_0x88da('0xd')](_0x88da('0xe'),_0x33e3be,_0x88da('0xf'));logger[_0x88da('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x33e3be,_0x88da('0xf'),JSON[_0x88da('0x11')](_0x10db86));if(_0x10db86['error']){if(_0x10db86[_0x88da('0x12')][_0x88da('0x13')]===0x1f4){logger[_0x88da('0x12')](_0x88da('0xe'),_0x33e3be,_0x10db86['error'][_0x88da('0x14')]);return _0x58a969(_0x10db86['error']['message']);}logger['error'](_0x88da('0xe'),_0x33e3be,_0x10db86[_0x88da('0x12')][_0x88da('0x14')]);return _0x3b2868(_0x10db86[_0x88da('0x12')]['message']);}else{logger[_0x88da('0xd')]('Template,\x20%s,\x20%s',_0x33e3be,'request\x20sent');_0x3b2868(_0x10db86[_0x88da('0x15')][_0x88da('0x14')]);}})['catch'](function(_0x4d9ffd){logger[_0x88da('0x12')](_0x88da('0xe'),_0x33e3be,_0x4d9ffd);_0x58a969(_0x4d9ffd);});});}exports[_0x88da('0x16')]=function(_0x5d1932){var _0x20b272=this;return new Promise(function(_0xa20d60,_0x31891f){return db['Template'][_0x88da('0x17')]({'raw':_0x5d1932[_0x88da('0x18')]?_0x5d1932['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d1932[_0x88da('0x18')]?_0x5d1932[_0x88da('0x18')][_0x88da('0x19')]||null:null,'attributes':_0x5d1932[_0x88da('0x18')]?_0x5d1932['options'][_0x88da('0x1a')]||null:null,'limit':_0x5d1932[_0x88da('0x18')]?_0x5d1932[_0x88da('0x18')][_0x88da('0x1b')]||null:null,'include':_0x5d1932[_0x88da('0x18')]?_0x5d1932[_0x88da('0x18')][_0x88da('0x1c')]?_[_0x88da('0x1d')](_0x5d1932[_0x88da('0x18')]['include'],function(_0x1e7624){return{'model':db[_0x1e7624[_0x88da('0x1e')]],'as':_0x1e7624['as'],'attributes':_0x1e7624[_0x88da('0x1a')],'include':_0x1e7624[_0x88da('0x1c')]?_['map'](_0x1e7624[_0x88da('0x1c')],function(_0x39ad71){return{'model':db[_0x39ad71[_0x88da('0x1e')]],'as':_0x39ad71['as'],'attributes':_0x39ad71[_0x88da('0x1a')],'include':_0x39ad71['include']?_['map'](_0x39ad71[_0x88da('0x1c')],function(_0x4d29b1){return{'model':db[_0x4d29b1[_0x88da('0x1e')]],'as':_0x4d29b1['as'],'attributes':_0x4d29b1[_0x88da('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x88da('0xc')](function(_0x9cb05f){logger[_0x88da('0xd')]('GetTemplate',_0x5d1932);logger[_0x88da('0x10')](_0x88da('0x16'),_0x5d1932,JSON[_0x88da('0x11')](_0x9cb05f));_0xa20d60(_0x9cb05f);})[_0x88da('0x1f')](function(_0x792c52){logger['error'](_0x88da('0x16'),_0x792c52[_0x88da('0x14')],_0x5d1932);_0x31891f(_0x20b272[_0x88da('0x12')](0x1f4,_0x792c52['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 5c6109f..9b954a3 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 _0xb0cb=['getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xb0cb,0x1d0));var _0xbb0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb0cb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xbb0c('0x0'));var util=require('util');var path=require(_0xbb0c('0x1'));var timeout=require(_0xbb0c('0x2'));var express=require(_0xbb0c('0x3'));var router=express[_0xbb0c('0x4')]();var fs_extra=require(_0xbb0c('0x5'));var auth=require(_0xbb0c('0x6'));var interaction=require(_0xbb0c('0x7'));var config=require(_0xbb0c('0x8'));var controller=require(_0xbb0c('0x9'));router[_0xbb0c('0xa')]('/',auth[_0xbb0c('0xb')](),controller[_0xbb0c('0xc')]);router[_0xbb0c('0xa')](_0xbb0c('0xd'),auth['isAuthenticated'](),controller[_0xbb0c('0xe')]);router[_0xbb0c('0xa')]('/:id/all_conditions',auth[_0xbb0c('0xb')](),controller[_0xbb0c('0xf')]);router[_0xbb0c('0xa')]('/:id/any_conditions',auth[_0xbb0c('0xb')](),controller[_0xbb0c('0x10')]);router['get'](_0xbb0c('0x11'),auth[_0xbb0c('0xb')](),controller[_0xbb0c('0x12')]);router[_0xbb0c('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbb0c('0x13')](_0xbb0c('0x14'),auth[_0xbb0c('0xb')](),controller[_0xbb0c('0x15')]);router[_0xbb0c('0x13')](_0xbb0c('0x16'),auth[_0xbb0c('0xb')](),controller[_0xbb0c('0x17')]);router[_0xbb0c('0x13')](_0xbb0c('0x11'),auth[_0xbb0c('0xb')](),controller[_0xbb0c('0x18')]);router[_0xbb0c('0x19')](_0xbb0c('0xd'),auth[_0xbb0c('0xb')](),controller[_0xbb0c('0x1a')]);router[_0xbb0c('0x1b')](_0xbb0c('0xd'),auth['isAuthenticated'](),controller[_0xbb0c('0x1c')]);module[_0xbb0c('0x1d')]=router; \ No newline at end of file +var _0x9e3a=['isAuthenticated','getAllConditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','/:id/any_conditions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','show','/:id/all_conditions'];(function(_0x130e4c,_0x43c577){var _0xd97ab7=function(_0xd9776e){while(--_0xd9776e){_0x130e4c['push'](_0x130e4c['shift']());}};_0xd97ab7(++_0x43c577);}(_0x9e3a,0x179));var _0xa9e3=function(_0x2877a2,_0xb6e49c){_0x2877a2=_0x2877a2-0x0;var _0x1eed6f=_0x9e3a[_0x2877a2];return _0x1eed6f;};'use strict';var multer=require(_0xa9e3('0x0'));var util=require(_0xa9e3('0x1'));var path=require(_0xa9e3('0x2'));var timeout=require(_0xa9e3('0x3'));var express=require(_0xa9e3('0x4'));var router=express[_0xa9e3('0x5')]();var fs_extra=require(_0xa9e3('0x6'));var auth=require(_0xa9e3('0x7'));var interaction=require(_0xa9e3('0x8'));var config=require(_0xa9e3('0x9'));var controller=require(_0xa9e3('0xa'));router[_0xa9e3('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa9e3('0xb')](_0xa9e3('0xc'),auth['isAuthenticated'](),controller[_0xa9e3('0xd')]);router['get'](_0xa9e3('0xe'),auth[_0xa9e3('0xf')](),controller[_0xa9e3('0x10')]);router['get']('/:id/any_conditions',auth[_0xa9e3('0xf')](),controller[_0xa9e3('0x11')]);router[_0xa9e3('0xb')](_0xa9e3('0x12'),auth[_0xa9e3('0xf')](),controller[_0xa9e3('0x13')]);router[_0xa9e3('0x14')]('/',auth[_0xa9e3('0xf')](),controller['create']);router[_0xa9e3('0x14')](_0xa9e3('0xe'),auth['isAuthenticated'](),controller[_0xa9e3('0x15')]);router[_0xa9e3('0x14')](_0xa9e3('0x16'),auth[_0xa9e3('0xf')](),controller['addAnyCondition']);router['post'](_0xa9e3('0x12'),auth['isAuthenticated'](),controller['addAction']);router[_0xa9e3('0x17')]('/:id',auth[_0xa9e3('0xf')](),controller[_0xa9e3('0x18')]);router[_0xa9e3('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xa9e3('0x1a')]);module[_0xa9e3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 34c766b..7f75e2f 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 _0x82a7=['STRING','BOOLEAN','exports'];(function(_0x3e4e79,_0x54cb15){var _0x53b9f1=function(_0x577644){while(--_0x577644){_0x3e4e79['push'](_0x3e4e79['shift']());}};_0x53b9f1(++_0x54cb15);}(_0x82a7,0x1c4));var _0x782a=function(_0x2a2786,_0x12efaf){_0x2a2786=_0x2a2786-0x0;var _0x45f1f6=_0x82a7[_0x2a2786];return _0x45f1f6;};'use strict';var Sequelize=require('sequelize');module[_0x782a('0x0')]={'name':{'type':Sequelize[_0x782a('0x1')]},'channel':{'type':Sequelize[_0x782a('0x1')]},'description':{'type':Sequelize[_0x782a('0x1')]},'status':{'type':Sequelize[_0x782a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x68ce=['exports','STRING'];(function(_0x8eae74,_0x2832b9){var _0x370105=function(_0x2552ca){while(--_0x2552ca){_0x8eae74['push'](_0x8eae74['shift']());}};_0x370105(++_0x2832b9);}(_0x68ce,0x124));var _0xe68c=function(_0x527733,_0x16051c){_0x527733=_0x527733-0x0;var _0x5400ba=_0x68ce[_0x527733];return _0x5400ba;};'use strict';var Sequelize=require('sequelize');module[_0xe68c('0x0')]={'name':{'type':Sequelize[_0xe68c('0x1')]},'channel':{'type':Sequelize[_0xe68c('0x1')]},'description':{'type':Sequelize[_0xe68c('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 0350397..31823e6 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 _0x744a=['includeAll','findAll','rows','catch','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','params','addAllCondition','TriggerAllId','TriggerAnyId','Condition','findOne','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','Triggers','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options'];(function(_0x1df26e,_0x5488e2){var _0x2c22e4=function(_0x503360){while(--_0x503360){_0x1df26e['push'](_0x1df26e['shift']());}};_0x2c22e4(++_0x5488e2);}(_0x744a,0xd0));var _0xa744=function(_0x5ddaca,_0x10d42f){_0x5ddaca=_0x5ddaca-0x0;var _0x2ed8e0=_0x744a[_0x5ddaca];return _0x2ed8e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa744('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa744('0x1'));var rp=require(_0xa744('0x2'));var moment=require(_0xa744('0x3'));var BPromise=require(_0xa744('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa744('0x5'));var sox=require(_0xa744('0x6'));var csv=require(_0xa744('0x7'));var ejs=require(_0xa744('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa744('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa744('0xa'));var deskjs=require(_0xa744('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa744('0xc'));var authService=require(_0xa744('0xd'));var qs=require(_0xa744('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa744('0xf'));var logger=require(_0xa744('0x10'))(_0xa744('0x11'));var utils=require(_0xa744('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa744('0x13'));var db=require(_0xa744('0x14'))['db'];function respondWithStatusCode(_0x2726ff,_0xb4d11d){_0xb4d11d=_0xb4d11d||0xcc;return function(_0x5c7096){if(_0x5c7096){return _0x2726ff['sendStatus'](_0xb4d11d);}return _0x2726ff['status'](_0xb4d11d)['end']();};}function respondWithResult(_0xd3b93d,_0x37e74b){_0x37e74b=_0x37e74b||0xc8;return function(_0x38876d){if(_0x38876d){return _0xd3b93d[_0xa744('0x15')](_0x37e74b)['json'](_0x38876d);}};}function respondWithFilteredResult(_0x366075,_0x3c0ee0){return function(_0x2a347f){if(_0x2a347f){var _0x3c1679=typeof _0x3c0ee0[_0xa744('0x16')]===_0xa744('0x17')&&typeof _0x3c0ee0[_0xa744('0x18')]===_0xa744('0x17');var _0x2c6115=_0x2a347f[_0xa744('0x19')];var _0x4a0721=_0x3c1679?0x0:_0x3c0ee0[_0xa744('0x16')];var _0x1b2636=_0x3c1679?_0x2a347f[_0xa744('0x19')]:_0x3c0ee0[_0xa744('0x16')]+_0x3c0ee0[_0xa744('0x18')];var _0x3ec9db;if(_0x1b2636>=_0x2c6115){_0x1b2636=_0x2c6115;_0x3ec9db=0xc8;}else{_0x3ec9db=0xce;}_0x366075[_0xa744('0x15')](_0x3ec9db);return _0x366075[_0xa744('0x1a')](_0xa744('0x1b'),_0x4a0721+'-'+_0x1b2636+'/'+_0x2c6115)[_0xa744('0x1c')](_0x2a347f);}return null;};}function patchUpdates(_0x3666a9){return function(_0x49c577){try{jsonpatch[_0xa744('0x1d')](_0x49c577,_0x3666a9,!![]);}catch(_0x41e658){return BPromise['reject'](_0x41e658);}return _0x49c577[_0xa744('0x1e')]();};}function saveUpdates(_0x6d9258,_0x2108a7){return function(_0x132009){if(_0x132009){return _0x132009[_0xa744('0x1f')](_0x6d9258)[_0xa744('0x20')](function(_0x1b7c56){return _0x1b7c56;});}return null;};}function removeEntity(_0xfc52da,_0x24bc10){return function(_0x269143){if(_0x269143){return _0x269143[_0xa744('0x21')]()['then'](function(){var _0x4125e9=_0x269143['get']({'plain':!![]});var _0x1d3870=_0xa744('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d3870,'resourceId':_0x4125e9['id']}})[_0xa744('0x20')](function(){return _0x269143;});})[_0xa744('0x20')](function(){_0xfc52da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e2be2,_0x249317){return function(_0x1eb53e){if(!_0x1eb53e){_0x4e2be2[_0xa744('0x23')](0x194);}return _0x1eb53e;};}function handleError(_0x46cae9,_0x118c1e){_0x118c1e=_0x118c1e||0x1f4;return function(_0x204348){logger[_0xa744('0x24')](_0x204348[_0xa744('0x25')]);if(_0x204348[_0xa744('0x26')]){delete _0x204348[_0xa744('0x26')];}_0x46cae9['status'](_0x118c1e)[_0xa744('0x27')](_0x204348);};}exports[_0xa744('0x28')]=function(_0x4ef1d5,_0x5ae926){var _0x3a38b8={},_0x5d7376={},_0x22ef46={'count':0x0,'rows':[]};var _0x2ec34c=_[_0xa744('0x29')](db[_0xa744('0x2a')][_0xa744('0x2b')],function(_0x20baba){return{'name':_0x20baba['fieldName'],'type':_0x20baba['type'][_0xa744('0x2c')]};});_0x5d7376['model']=_[_0xa744('0x29')](_0x2ec34c,'name');_0x5d7376['query']=_[_0xa744('0x2d')](_0x4ef1d5[_0xa744('0x2e')]);_0x5d7376[_0xa744('0x2f')]=_['intersection'](_0x5d7376[_0xa744('0x30')],_0x5d7376[_0xa744('0x2e')]);_0x3a38b8[_0xa744('0x31')]=_[_0xa744('0x32')](_0x5d7376[_0xa744('0x30')],qs['fields'](_0x4ef1d5[_0xa744('0x2e')][_0xa744('0x33')]));_0x3a38b8[_0xa744('0x31')]=_0x3a38b8[_0xa744('0x31')][_0xa744('0x34')]?_0x3a38b8[_0xa744('0x31')]:_0x5d7376['model'];if(!_0x4ef1d5['query']['hasOwnProperty'](_0xa744('0x35'))){_0x3a38b8[_0xa744('0x18')]=qs['limit'](_0x4ef1d5[_0xa744('0x2e')]['limit']);_0x3a38b8[_0xa744('0x16')]=qs[_0xa744('0x16')](_0x4ef1d5[_0xa744('0x2e')][_0xa744('0x16')]);}_0x3a38b8[_0xa744('0x36')]=qs[_0xa744('0x37')](_0x4ef1d5[_0xa744('0x2e')][_0xa744('0x37')]);_0x3a38b8[_0xa744('0x38')]=qs[_0xa744('0x2f')](_[_0xa744('0x39')](_0x4ef1d5[_0xa744('0x2e')],_0x5d7376['filters']),_0x2ec34c);if(_0x4ef1d5[_0xa744('0x2e')][_0xa744('0x3a')]){_0x3a38b8[_0xa744('0x38')]=_['merge'](_0x3a38b8[_0xa744('0x38')],{'$or':_[_0xa744('0x29')](_0x2ec34c,function(_0x9dbaad){if(_0x9dbaad[_0xa744('0x3b')]!==_0xa744('0x3c')){var _0x50f8d1={};_0x50f8d1[_0x9dbaad[_0xa744('0x26')]]={'$like':'%'+_0x4ef1d5[_0xa744('0x2e')][_0xa744('0x3a')]+'%'};return _0x50f8d1;}})});}_0x3a38b8=_['merge']({},_0x3a38b8,_0x4ef1d5[_0xa744('0x3d')]);var _0x12fc69={'where':_0x3a38b8[_0xa744('0x38')]};return db[_0xa744('0x2a')][_0xa744('0x19')](_0x12fc69)['then'](function(_0x36128d){_0x22ef46[_0xa744('0x19')]=_0x36128d;if(_0x4ef1d5['query'][_0xa744('0x3e')]){_0x3a38b8['include']=[{'all':!![]}];}return db[_0xa744('0x2a')][_0xa744('0x3f')](_0x3a38b8);})[_0xa744('0x20')](function(_0x145e71){_0x22ef46[_0xa744('0x40')]=_0x145e71;return _0x22ef46;})[_0xa744('0x20')](respondWithFilteredResult(_0x5ae926,_0x3a38b8))[_0xa744('0x41')](handleError(_0x5ae926,null));};exports['show']=function(_0xd892c9,_0x2bc5de){var _0x23a030={'raw':![],'where':{'id':_0xd892c9['params']['id']}},_0xbf16ea={};_0xbf16ea[_0xa744('0x30')]=_[_0xa744('0x2d')](db[_0xa744('0x2a')][_0xa744('0x2b')]);_0xbf16ea[_0xa744('0x2e')]=_[_0xa744('0x2d')](_0xd892c9['query']);_0xbf16ea[_0xa744('0x2f')]=_[_0xa744('0x32')](_0xbf16ea[_0xa744('0x30')],_0xbf16ea[_0xa744('0x2e')]);_0x23a030['attributes']=_[_0xa744('0x32')](_0xbf16ea[_0xa744('0x30')],qs[_0xa744('0x33')](_0xd892c9[_0xa744('0x2e')][_0xa744('0x33')]));_0x23a030[_0xa744('0x31')]=_0x23a030[_0xa744('0x31')]['length']?_0x23a030[_0xa744('0x31')]:_0xbf16ea[_0xa744('0x30')];if(_0xd892c9[_0xa744('0x2e')][_0xa744('0x3e')]){_0x23a030['include']=[{'all':!![]}];}_0x23a030=_[_0xa744('0x42')]({},_0x23a030,_0xd892c9[_0xa744('0x3d')]);return db[_0xa744('0x2a')][_0xa744('0x43')](_0x23a030)[_0xa744('0x20')](handleEntityNotFound(_0x2bc5de,null))['then'](respondWithResult(_0x2bc5de,null))[_0xa744('0x41')](handleError(_0x2bc5de,null));};exports[_0xa744('0x44')]=function(_0x2dfbb1,_0x348773){return db[_0xa744('0x2a')][_0xa744('0x44')](_0x2dfbb1[_0xa744('0x45')],{})[_0xa744('0x20')](function(_0x2c1ecf){var _0x512ae2=_0x2dfbb1[_0xa744('0x46')][_0xa744('0x47')]({'plain':!![]});if(!_0x512ae2)throw new Error(_0xa744('0x48'));if(_0x512ae2[_0xa744('0x49')]===_0xa744('0x46')){var _0x1c6745=_0x2c1ecf[_0xa744('0x47')]({'plain':!![]});var _0xbb5db3='Triggers';return db[_0xa744('0x4a')][_0xa744('0x43')]({'where':{'name':_0xbb5db3,'userProfileId':_0x512ae2[_0xa744('0x4b')]},'raw':!![]})[_0xa744('0x20')](function(_0x5c103b){if(_0x5c103b&&_0x5c103b['autoAssociation']===0x0){return db[_0xa744('0x4c')][_0xa744('0x44')]({'name':_0x1c6745[_0xa744('0x26')],'resourceId':_0x1c6745['id'],'type':_0x5c103b[_0xa744('0x26')],'sectionId':_0x5c103b['id']},{})[_0xa744('0x20')](function(){return _0x2c1ecf;});}else{return _0x2c1ecf;}})[_0xa744('0x41')](function(_0x20e44d){logger[_0xa744('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20e44d);throw _0x20e44d;});}return _0x2c1ecf;})[_0xa744('0x20')](respondWithResult(_0x348773,0xc9))[_0xa744('0x41')](handleError(_0x348773,null));};exports[_0xa744('0x1f')]=function(_0x2fa988,_0x3b68fd){if(_0x2fa988[_0xa744('0x45')]['id']){delete _0x2fa988[_0xa744('0x45')]['id'];}return db[_0xa744('0x2a')]['find']({'where':{'id':_0x2fa988[_0xa744('0x4d')]['id']}})[_0xa744('0x20')](handleEntityNotFound(_0x3b68fd,null))['then'](saveUpdates(_0x2fa988[_0xa744('0x45')],null))['then'](respondWithResult(_0x3b68fd,null))[_0xa744('0x41')](handleError(_0x3b68fd,null));};exports[_0xa744('0x21')]=function(_0x54a07c,_0xc34eb5){return db[_0xa744('0x2a')][_0xa744('0x43')]({'where':{'id':_0x54a07c[_0xa744('0x4d')]['id']}})[_0xa744('0x20')](handleEntityNotFound(_0xc34eb5,null))[_0xa744('0x20')](removeEntity(_0xc34eb5,null))[_0xa744('0x41')](handleError(_0xc34eb5,null));};exports[_0xa744('0x4e')]=function(_0x3ec9fb,_0xc17e3b,_0x40920a){if(_0x3ec9fb['body']['id']){delete _0x3ec9fb[_0xa744('0x45')]['id'];}return db[_0xa744('0x2a')][_0xa744('0x43')]({'where':{'id':_0x3ec9fb[_0xa744('0x4d')]['id']}})[_0xa744('0x20')](handleEntityNotFound(_0xc17e3b,null))['then'](function(_0xc73c4e){if(_0xc73c4e){_0x3ec9fb[_0xa744('0x45')][_0xa744('0x4f')]=_0xc73c4e['id'];return db['Condition'][_0xa744('0x44')](_0x3ec9fb[_0xa744('0x45')]);}})[_0xa744('0x20')](respondWithResult(_0xc17e3b,null))[_0xa744('0x41')](handleError(_0xc17e3b,null));};exports['addAnyCondition']=function(_0x1843f3,_0x3db3c2,_0x52c4ce){if(_0x1843f3[_0xa744('0x45')]['id']){delete _0x1843f3[_0xa744('0x45')]['id'];}return db[_0xa744('0x2a')][_0xa744('0x43')]({'where':{'id':_0x1843f3[_0xa744('0x4d')]['id']}})[_0xa744('0x20')](handleEntityNotFound(_0x3db3c2,null))[_0xa744('0x20')](function(_0x4576c8){if(_0x4576c8){_0x1843f3[_0xa744('0x45')][_0xa744('0x50')]=_0x4576c8['id'];return db[_0xa744('0x51')][_0xa744('0x44')](_0x1843f3[_0xa744('0x45')]);}})[_0xa744('0x20')](respondWithResult(_0x3db3c2,null))[_0xa744('0x41')](handleError(_0x3db3c2,null));};exports['getAllConditions']=function(_0x817245,_0x16744e,_0x537fec){var _0x320fbc={};var _0x26b140={};var _0x4e6854;var _0x2e3330;return db[_0xa744('0x2a')][_0xa744('0x52')]({'where':{'id':_0x817245[_0xa744('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16744e,null))['then'](function(_0x1b6051){if(_0x1b6051){_0x4e6854=_0x1b6051;_0x26b140[_0xa744('0x30')]=_[_0xa744('0x2d')](db[_0xa744('0x51')][_0xa744('0x2b')]);_0x26b140[_0xa744('0x2e')]=_[_0xa744('0x2d')](_0x817245[_0xa744('0x2e')]);_0x26b140[_0xa744('0x2f')]=_['intersection'](_0x26b140['model'],_0x26b140[_0xa744('0x2e')]);_0x320fbc['attributes']=_[_0xa744('0x32')](_0x26b140[_0xa744('0x30')],qs[_0xa744('0x33')](_0x817245['query'][_0xa744('0x33')]));_0x320fbc[_0xa744('0x31')]=_0x320fbc['attributes'][_0xa744('0x34')]?_0x320fbc['attributes']:_0x26b140[_0xa744('0x30')];_0x320fbc['order']=qs[_0xa744('0x37')](_0x817245[_0xa744('0x2e')][_0xa744('0x37')]);_0x320fbc[_0xa744('0x38')]=qs['filters'](_['pick'](_0x817245[_0xa744('0x2e')],_0x26b140[_0xa744('0x2f')]));if(_0x817245[_0xa744('0x2e')][_0xa744('0x3a')]){_0x320fbc[_0xa744('0x38')]=_['merge'](_0x320fbc[_0xa744('0x38')],{'$or':_[_0xa744('0x29')](_0x320fbc[_0xa744('0x31')],function(_0xe456ec){var _0x33033f={};_0x33033f[_0xe456ec]={'$like':'%'+_0x817245[_0xa744('0x2e')][_0xa744('0x3a')]+'%'};return _0x33033f;})});}_0x320fbc=_[_0xa744('0x42')]({},_0x320fbc,_0x817245[_0xa744('0x3d')]);return _0x4e6854[_0xa744('0x53')](_0x320fbc);}})['then'](function(_0x10bd98){if(_0x10bd98){_0x2e3330=_0x10bd98[_0xa744('0x34')];if(!_0x817245[_0xa744('0x2e')][_0xa744('0x54')](_0xa744('0x35'))){_0x320fbc[_0xa744('0x18')]=qs[_0xa744('0x18')](_0x817245[_0xa744('0x2e')][_0xa744('0x18')]);_0x320fbc[_0xa744('0x16')]=qs['offset'](_0x817245['query'][_0xa744('0x16')]);}return _0x4e6854[_0xa744('0x53')](_0x320fbc);}})[_0xa744('0x20')](function(_0x1a3e8a){if(_0x1a3e8a){return _0x1a3e8a?{'count':_0x2e3330,'rows':_0x1a3e8a}:null;}})[_0xa744('0x20')](respondWithResult(_0x16744e,null))[_0xa744('0x41')](handleError(_0x16744e,null));};exports[_0xa744('0x55')]=function(_0x4e5584,_0xe9e9f9,_0x52d8f0){var _0xf90ce9={};var _0x22ed2c={};var _0x442309;var _0x467250;return db[_0xa744('0x2a')][_0xa744('0x52')]({'where':{'id':_0x4e5584['params']['id']}})[_0xa744('0x20')](handleEntityNotFound(_0xe9e9f9,null))[_0xa744('0x20')](function(_0x2b5cd8){if(_0x2b5cd8){_0x442309=_0x2b5cd8;_0x22ed2c['model']=_[_0xa744('0x2d')](db['Condition'][_0xa744('0x2b')]);_0x22ed2c['query']=_[_0xa744('0x2d')](_0x4e5584[_0xa744('0x2e')]);_0x22ed2c['filters']=_[_0xa744('0x32')](_0x22ed2c[_0xa744('0x30')],_0x22ed2c['query']);_0xf90ce9['attributes']=_[_0xa744('0x32')](_0x22ed2c['model'],qs[_0xa744('0x33')](_0x4e5584['query'][_0xa744('0x33')]));_0xf90ce9[_0xa744('0x31')]=_0xf90ce9['attributes'][_0xa744('0x34')]?_0xf90ce9[_0xa744('0x31')]:_0x22ed2c[_0xa744('0x30')];_0xf90ce9[_0xa744('0x36')]=qs[_0xa744('0x37')](_0x4e5584[_0xa744('0x2e')]['sort']);_0xf90ce9[_0xa744('0x38')]=qs[_0xa744('0x2f')](_[_0xa744('0x39')](_0x4e5584[_0xa744('0x2e')],_0x22ed2c[_0xa744('0x2f')]));if(_0x4e5584[_0xa744('0x2e')][_0xa744('0x3a')]){_0xf90ce9[_0xa744('0x38')]=_[_0xa744('0x42')](_0xf90ce9[_0xa744('0x38')],{'$or':_['map'](_0xf90ce9[_0xa744('0x31')],function(_0x5cd45d){var _0x56d02c={};_0x56d02c[_0x5cd45d]={'$like':'%'+_0x4e5584['query']['filter']+'%'};return _0x56d02c;})});}_0xf90ce9=_[_0xa744('0x42')]({},_0xf90ce9,_0x4e5584[_0xa744('0x3d')]);return _0x442309[_0xa744('0x55')](_0xf90ce9);}})[_0xa744('0x20')](function(_0x382e40){if(_0x382e40){_0x467250=_0x382e40[_0xa744('0x34')];if(!_0x4e5584[_0xa744('0x2e')][_0xa744('0x54')](_0xa744('0x35'))){_0xf90ce9[_0xa744('0x18')]=qs[_0xa744('0x18')](_0x4e5584[_0xa744('0x2e')]['limit']);_0xf90ce9[_0xa744('0x16')]=qs[_0xa744('0x16')](_0x4e5584[_0xa744('0x2e')][_0xa744('0x16')]);}return _0x442309[_0xa744('0x55')](_0xf90ce9);}})[_0xa744('0x20')](function(_0x419faa){if(_0x419faa){return _0x419faa?{'count':_0x467250,'rows':_0x419faa}:null;}})[_0xa744('0x20')](respondWithResult(_0xe9e9f9,null))[_0xa744('0x41')](handleError(_0xe9e9f9,null));};exports[_0xa744('0x56')]=function(_0x4405e5,_0x2f54f9,_0x711c1e){if(_0x4405e5['body']['id']){delete _0x4405e5[_0xa744('0x45')]['id'];}return db['Trigger'][_0xa744('0x43')]({'where':{'id':_0x4405e5['params']['id']}})[_0xa744('0x20')](handleEntityNotFound(_0x2f54f9,null))[_0xa744('0x20')](function(_0x7c6fbd){if(_0x7c6fbd){_0x4405e5[_0xa744('0x45')][_0xa744('0x57')]=_0x7c6fbd['id'];return db[_0xa744('0x58')]['create'](_0x4405e5[_0xa744('0x45')]);}})[_0xa744('0x20')](respondWithResult(_0x2f54f9,null))[_0xa744('0x41')](handleError(_0x2f54f9,null));};exports[_0xa744('0x59')]=function(_0x417511,_0xcb50a7,_0x4cb13f){var _0x37a43e={};var _0x282344={};var _0x4a9b03;var _0x3d4206;return db[_0xa744('0x2a')]['findOne']({'where':{'id':_0x417511['params']['id']}})[_0xa744('0x20')](handleEntityNotFound(_0xcb50a7,null))['then'](function(_0x46671d){if(_0x46671d){_0x4a9b03=_0x46671d;_0x282344[_0xa744('0x30')]=_[_0xa744('0x2d')](db[_0xa744('0x58')][_0xa744('0x2b')]);_0x282344[_0xa744('0x2e')]=_[_0xa744('0x2d')](_0x417511[_0xa744('0x2e')]);_0x282344[_0xa744('0x2f')]=_['intersection'](_0x282344[_0xa744('0x30')],_0x282344[_0xa744('0x2e')]);_0x37a43e[_0xa744('0x31')]=_[_0xa744('0x32')](_0x282344['model'],qs['fields'](_0x417511[_0xa744('0x2e')][_0xa744('0x33')]));_0x37a43e['attributes']=_0x37a43e[_0xa744('0x31')][_0xa744('0x34')]?_0x37a43e[_0xa744('0x31')]:_0x282344[_0xa744('0x30')];_0x37a43e[_0xa744('0x36')]=qs[_0xa744('0x37')](_0x417511['query'][_0xa744('0x37')]);_0x37a43e[_0xa744('0x38')]=qs['filters'](_[_0xa744('0x39')](_0x417511[_0xa744('0x2e')],_0x282344[_0xa744('0x2f')]));if(_0x417511[_0xa744('0x2e')][_0xa744('0x3a')]){_0x37a43e[_0xa744('0x38')]=_[_0xa744('0x42')](_0x37a43e[_0xa744('0x38')],{'$or':_['map'](_0x37a43e['attributes'],function(_0x35afd3){var _0x25dd1e={};_0x25dd1e[_0x35afd3]={'$like':'%'+_0x417511['query']['filter']+'%'};return _0x25dd1e;})});}_0x37a43e=_['merge']({},_0x37a43e,_0x417511[_0xa744('0x3d')]);return _0x4a9b03[_0xa744('0x59')](_0x37a43e);}})[_0xa744('0x20')](function(_0x43b940){if(_0x43b940){_0x3d4206=_0x43b940[_0xa744('0x34')];if(!_0x417511[_0xa744('0x2e')][_0xa744('0x54')]('nolimit')){_0x37a43e[_0xa744('0x18')]=qs[_0xa744('0x18')](_0x417511['query'][_0xa744('0x18')]);_0x37a43e[_0xa744('0x16')]=qs[_0xa744('0x16')](_0x417511[_0xa744('0x2e')][_0xa744('0x16')]);}return _0x4a9b03[_0xa744('0x59')](_0x37a43e);}})['then'](function(_0x129467){if(_0x129467){return _0x129467?{'count':_0x3d4206,'rows':_0x129467}:null;}})[_0xa744('0x20')](respondWithResult(_0xcb50a7,null))[_0xa744('0x41')](handleError(_0xcb50a7,null));}; \ No newline at end of file +var _0x579c=['json','apply','save','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','stack','name','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','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','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','count','set'];(function(_0x2859bc,_0x2a4a74){var _0xaa4908=function(_0x2e34fc){while(--_0x2e34fc){_0x2859bc['push'](_0x2859bc['shift']());}};_0xaa4908(++_0x2a4a74);}(_0x579c,0x9b));var _0xc579=function(_0xa9e57c,_0x1e2e24){_0xa9e57c=_0xa9e57c-0x0;var _0x133fb4=_0x579c[_0xa9e57c];return _0x133fb4;};'use strict';var emlformat=require(_0xc579('0x0'));var rimraf=require(_0xc579('0x1'));var zipdir=require(_0xc579('0x2'));var jsonpatch=require(_0xc579('0x3'));var rp=require('request-promise');var moment=require(_0xc579('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc579('0x5'));var util=require(_0xc579('0x6'));var path=require(_0xc579('0x7'));var sox=require('sox');var csv=require(_0xc579('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc579('0x9'));var _=require(_0xc579('0xa'));var squel=require(_0xc579('0xb'));var crypto=require(_0xc579('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc579('0xd'));var toCsv=require(_0xc579('0x8'));var querystring=require(_0xc579('0xe'));var Papa=require(_0xc579('0xf'));var Redis=require(_0xc579('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc579('0x11'));var hardwareService=require(_0xc579('0x12'));var logger=require('../../config/logger')(_0xc579('0x13'));var utils=require(_0xc579('0x14'));var config=require(_0xc579('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc579('0x16'))['db'];function respondWithStatusCode(_0x4cfb53,_0x2b5a4c){_0x2b5a4c=_0x2b5a4c||0xcc;return function(_0x375f77){if(_0x375f77){return _0x4cfb53['sendStatus'](_0x2b5a4c);}return _0x4cfb53['status'](_0x2b5a4c)[_0xc579('0x17')]();};}function respondWithResult(_0x39cb05,_0x364e4a){_0x364e4a=_0x364e4a||0xc8;return function(_0x53ac7f){if(_0x53ac7f){return _0x39cb05[_0xc579('0x18')](_0x364e4a)['json'](_0x53ac7f);}};}function respondWithFilteredResult(_0x310975,_0x52882c){return function(_0x1b66fe){if(_0x1b66fe){var _0x482517=typeof _0x52882c[_0xc579('0x19')]==='undefined'&&typeof _0x52882c[_0xc579('0x1a')]==='undefined';var _0x242d62=_0x1b66fe[_0xc579('0x1b')];var _0x5153a1=_0x482517?0x0:_0x52882c[_0xc579('0x19')];var _0x38c1d9=_0x482517?_0x1b66fe[_0xc579('0x1b')]:_0x52882c[_0xc579('0x19')]+_0x52882c['limit'];var _0x14e604;if(_0x38c1d9>=_0x242d62){_0x38c1d9=_0x242d62;_0x14e604=0xc8;}else{_0x14e604=0xce;}_0x310975[_0xc579('0x18')](_0x14e604);return _0x310975[_0xc579('0x1c')]('Content-Range',_0x5153a1+'-'+_0x38c1d9+'/'+_0x242d62)[_0xc579('0x1d')](_0x1b66fe);}return null;};}function patchUpdates(_0x2fc56e){return function(_0x500564){try{jsonpatch[_0xc579('0x1e')](_0x500564,_0x2fc56e,!![]);}catch(_0x3493c2){return BPromise['reject'](_0x3493c2);}return _0x500564[_0xc579('0x1f')]();};}function saveUpdates(_0x2fe15f,_0x4bd717){return function(_0x2ef0fe){if(_0x2ef0fe){return _0x2ef0fe[_0xc579('0x20')](_0x2fe15f)[_0xc579('0x21')](function(_0x259b65){return _0x259b65;});}return null;};}function removeEntity(_0x2409ca,_0x4b9e8c){return function(_0x1f2c77){if(_0x1f2c77){return _0x1f2c77[_0xc579('0x22')]()[_0xc579('0x21')](function(){var _0xa85c9d=_0x1f2c77[_0xc579('0x23')]({'plain':!![]});var _0x102c86=_0xc579('0x24');return db[_0xc579('0x25')][_0xc579('0x22')]({'where':{'type':_0x102c86,'resourceId':_0xa85c9d['id']}})[_0xc579('0x21')](function(){return _0x1f2c77;});})[_0xc579('0x21')](function(){_0x2409ca[_0xc579('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57ae6f,_0x399747){return function(_0x263dd5){if(!_0x263dd5){_0x57ae6f[_0xc579('0x26')](0x194);}return _0x263dd5;};}function handleError(_0x2e39c6,_0x44bc8a){_0x44bc8a=_0x44bc8a||0x1f4;return function(_0x1c1985){logger['error'](_0x1c1985[_0xc579('0x27')]);if(_0x1c1985[_0xc579('0x28')]){delete _0x1c1985[_0xc579('0x28')];}_0x2e39c6[_0xc579('0x18')](_0x44bc8a)['send'](_0x1c1985);};}exports[_0xc579('0x29')]=function(_0x9b44b1,_0xdd1fd4){var _0x1413f8={},_0x25efc6={},_0x92394a={'count':0x0,'rows':[]};var _0x50f1e5=_[_0xc579('0x2a')](db[_0xc579('0x2b')][_0xc579('0x2c')],function(_0x14823e){return{'name':_0x14823e[_0xc579('0x2d')],'type':_0x14823e[_0xc579('0x2e')][_0xc579('0x2f')]};});_0x25efc6['model']=_[_0xc579('0x2a')](_0x50f1e5,_0xc579('0x28'));_0x25efc6[_0xc579('0x30')]=_[_0xc579('0x31')](_0x9b44b1['query']);_0x25efc6[_0xc579('0x32')]=_[_0xc579('0x33')](_0x25efc6[_0xc579('0x34')],_0x25efc6[_0xc579('0x30')]);_0x1413f8[_0xc579('0x35')]=_[_0xc579('0x33')](_0x25efc6['model'],qs['fields'](_0x9b44b1['query'][_0xc579('0x36')]));_0x1413f8[_0xc579('0x35')]=_0x1413f8[_0xc579('0x35')][_0xc579('0x37')]?_0x1413f8[_0xc579('0x35')]:_0x25efc6[_0xc579('0x34')];if(!_0x9b44b1[_0xc579('0x30')][_0xc579('0x38')](_0xc579('0x39'))){_0x1413f8[_0xc579('0x1a')]=qs[_0xc579('0x1a')](_0x9b44b1[_0xc579('0x30')][_0xc579('0x1a')]);_0x1413f8['offset']=qs[_0xc579('0x19')](_0x9b44b1[_0xc579('0x30')][_0xc579('0x19')]);}_0x1413f8[_0xc579('0x3a')]=qs[_0xc579('0x3b')](_0x9b44b1[_0xc579('0x30')][_0xc579('0x3b')]);_0x1413f8[_0xc579('0x3c')]=qs['filters'](_[_0xc579('0x3d')](_0x9b44b1[_0xc579('0x30')],_0x25efc6[_0xc579('0x32')]),_0x50f1e5);if(_0x9b44b1[_0xc579('0x30')][_0xc579('0x3e')]){_0x1413f8['where']=_['merge'](_0x1413f8['where'],{'$or':_['map'](_0x50f1e5,function(_0x5a9d7e){if(_0x5a9d7e[_0xc579('0x2e')]!==_0xc579('0x3f')){var _0x3f14a6={};_0x3f14a6[_0x5a9d7e['name']]={'$like':'%'+_0x9b44b1[_0xc579('0x30')]['filter']+'%'};return _0x3f14a6;}})});}_0x1413f8=_[_0xc579('0x40')]({},_0x1413f8,_0x9b44b1[_0xc579('0x41')]);var _0x41d24f={'where':_0x1413f8[_0xc579('0x3c')]};return db[_0xc579('0x2b')][_0xc579('0x1b')](_0x41d24f)[_0xc579('0x21')](function(_0x371e5a){_0x92394a['count']=_0x371e5a;if(_0x9b44b1[_0xc579('0x30')][_0xc579('0x42')]){_0x1413f8[_0xc579('0x43')]=[{'all':!![]}];}return db[_0xc579('0x2b')][_0xc579('0x44')](_0x1413f8);})[_0xc579('0x21')](function(_0x312bdb){_0x92394a['rows']=_0x312bdb;return _0x92394a;})[_0xc579('0x21')](respondWithFilteredResult(_0xdd1fd4,_0x1413f8))[_0xc579('0x45')](handleError(_0xdd1fd4,null));};exports[_0xc579('0x46')]=function(_0x15fc7d,_0x2955ef){var _0x375912={'raw':![],'where':{'id':_0x15fc7d[_0xc579('0x47')]['id']}},_0x155fc9={};_0x155fc9['model']=_[_0xc579('0x31')](db['Trigger'][_0xc579('0x2c')]);_0x155fc9[_0xc579('0x30')]=_['keys'](_0x15fc7d[_0xc579('0x30')]);_0x155fc9['filters']=_[_0xc579('0x33')](_0x155fc9[_0xc579('0x34')],_0x155fc9['query']);_0x375912['attributes']=_[_0xc579('0x33')](_0x155fc9[_0xc579('0x34')],qs[_0xc579('0x36')](_0x15fc7d[_0xc579('0x30')][_0xc579('0x36')]));_0x375912[_0xc579('0x35')]=_0x375912[_0xc579('0x35')][_0xc579('0x37')]?_0x375912[_0xc579('0x35')]:_0x155fc9[_0xc579('0x34')];if(_0x15fc7d['query'][_0xc579('0x42')]){_0x375912[_0xc579('0x43')]=[{'all':!![]}];}_0x375912=_[_0xc579('0x40')]({},_0x375912,_0x15fc7d['options']);return db[_0xc579('0x2b')][_0xc579('0x48')](_0x375912)[_0xc579('0x21')](handleEntityNotFound(_0x2955ef,null))[_0xc579('0x21')](respondWithResult(_0x2955ef,null))[_0xc579('0x45')](handleError(_0x2955ef,null));};exports[_0xc579('0x49')]=function(_0x325351,_0xde1d79){return db[_0xc579('0x2b')][_0xc579('0x49')](_0x325351[_0xc579('0x4a')],{})['then'](function(_0x4ba327){var _0x31a7dd=_0x325351[_0xc579('0x4b')][_0xc579('0x23')]({'plain':!![]});if(!_0x31a7dd)throw new Error(_0xc579('0x4c'));if(_0x31a7dd['role']===_0xc579('0x4b')){var _0xe6891c=_0x4ba327['get']({'plain':!![]});var _0x37a76a=_0xc579('0x24');return db[_0xc579('0x4d')]['find']({'where':{'name':_0x37a76a,'userProfileId':_0x31a7dd[_0xc579('0x4e')]},'raw':!![]})[_0xc579('0x21')](function(_0x141f90){if(_0x141f90&&_0x141f90['autoAssociation']===0x0){return db['UserProfileResource'][_0xc579('0x49')]({'name':_0xe6891c['name'],'resourceId':_0xe6891c['id'],'type':_0x141f90[_0xc579('0x28')],'sectionId':_0x141f90['id']},{})[_0xc579('0x21')](function(){return _0x4ba327;});}else{return _0x4ba327;}})[_0xc579('0x45')](function(_0x4e4980){logger[_0xc579('0x4f')](_0xc579('0x50'),_0x4e4980);throw _0x4e4980;});}return _0x4ba327;})['then'](respondWithResult(_0xde1d79,0xc9))[_0xc579('0x45')](handleError(_0xde1d79,null));};exports[_0xc579('0x20')]=function(_0x3470a0,_0x58399c){if(_0x3470a0[_0xc579('0x4a')]['id']){delete _0x3470a0[_0xc579('0x4a')]['id'];}return db['Trigger'][_0xc579('0x48')]({'where':{'id':_0x3470a0[_0xc579('0x47')]['id']}})[_0xc579('0x21')](handleEntityNotFound(_0x58399c,null))[_0xc579('0x21')](saveUpdates(_0x3470a0['body'],null))[_0xc579('0x21')](respondWithResult(_0x58399c,null))['catch'](handleError(_0x58399c,null));};exports[_0xc579('0x22')]=function(_0x3b7661,_0x401a77){return db['Trigger'][_0xc579('0x48')]({'where':{'id':_0x3b7661['params']['id']}})[_0xc579('0x21')](handleEntityNotFound(_0x401a77,null))[_0xc579('0x21')](removeEntity(_0x401a77,null))[_0xc579('0x45')](handleError(_0x401a77,null));};exports[_0xc579('0x51')]=function(_0x29bd98,_0x40b5b4,_0x51db18){if(_0x29bd98['body']['id']){delete _0x29bd98['body']['id'];}return db[_0xc579('0x2b')][_0xc579('0x48')]({'where':{'id':_0x29bd98[_0xc579('0x47')]['id']}})[_0xc579('0x21')](handleEntityNotFound(_0x40b5b4,null))['then'](function(_0x50772e){if(_0x50772e){_0x29bd98[_0xc579('0x4a')][_0xc579('0x52')]=_0x50772e['id'];return db[_0xc579('0x53')][_0xc579('0x49')](_0x29bd98[_0xc579('0x4a')]);}})[_0xc579('0x21')](respondWithResult(_0x40b5b4,null))[_0xc579('0x45')](handleError(_0x40b5b4,null));};exports[_0xc579('0x54')]=function(_0x47de68,_0x52fa74,_0x260560){if(_0x47de68['body']['id']){delete _0x47de68[_0xc579('0x4a')]['id'];}return db[_0xc579('0x2b')][_0xc579('0x48')]({'where':{'id':_0x47de68[_0xc579('0x47')]['id']}})[_0xc579('0x21')](handleEntityNotFound(_0x52fa74,null))['then'](function(_0x4dc3f5){if(_0x4dc3f5){_0x47de68['body'][_0xc579('0x55')]=_0x4dc3f5['id'];return db[_0xc579('0x53')][_0xc579('0x49')](_0x47de68[_0xc579('0x4a')]);}})['then'](respondWithResult(_0x52fa74,null))[_0xc579('0x45')](handleError(_0x52fa74,null));};exports[_0xc579('0x56')]=function(_0x579ba4,_0x594ff5,_0x31c43f){var _0x2b782d={};var _0x5dad6a={};var _0x47698d;var _0x10e2b0;return db['Trigger'][_0xc579('0x57')]({'where':{'id':_0x579ba4[_0xc579('0x47')]['id']}})[_0xc579('0x21')](handleEntityNotFound(_0x594ff5,null))['then'](function(_0x571d82){if(_0x571d82){_0x47698d=_0x571d82;_0x5dad6a['model']=_['keys'](db[_0xc579('0x53')]['rawAttributes']);_0x5dad6a[_0xc579('0x30')]=_['keys'](_0x579ba4[_0xc579('0x30')]);_0x5dad6a[_0xc579('0x32')]=_[_0xc579('0x33')](_0x5dad6a[_0xc579('0x34')],_0x5dad6a[_0xc579('0x30')]);_0x2b782d['attributes']=_[_0xc579('0x33')](_0x5dad6a[_0xc579('0x34')],qs[_0xc579('0x36')](_0x579ba4[_0xc579('0x30')][_0xc579('0x36')]));_0x2b782d['attributes']=_0x2b782d[_0xc579('0x35')][_0xc579('0x37')]?_0x2b782d['attributes']:_0x5dad6a['model'];_0x2b782d['order']=qs[_0xc579('0x3b')](_0x579ba4[_0xc579('0x30')][_0xc579('0x3b')]);_0x2b782d['where']=qs[_0xc579('0x32')](_[_0xc579('0x3d')](_0x579ba4[_0xc579('0x30')],_0x5dad6a['filters']));if(_0x579ba4[_0xc579('0x30')][_0xc579('0x3e')]){_0x2b782d[_0xc579('0x3c')]=_[_0xc579('0x40')](_0x2b782d[_0xc579('0x3c')],{'$or':_[_0xc579('0x2a')](_0x2b782d[_0xc579('0x35')],function(_0x30c222){var _0x4e4a74={};_0x4e4a74[_0x30c222]={'$like':'%'+_0x579ba4['query']['filter']+'%'};return _0x4e4a74;})});}_0x2b782d=_[_0xc579('0x40')]({},_0x2b782d,_0x579ba4['options']);return _0x47698d[_0xc579('0x56')](_0x2b782d);}})['then'](function(_0xcc7623){if(_0xcc7623){_0x10e2b0=_0xcc7623[_0xc579('0x37')];if(!_0x579ba4[_0xc579('0x30')][_0xc579('0x38')]('nolimit')){_0x2b782d['limit']=qs['limit'](_0x579ba4['query'][_0xc579('0x1a')]);_0x2b782d[_0xc579('0x19')]=qs[_0xc579('0x19')](_0x579ba4[_0xc579('0x30')]['offset']);}return _0x47698d[_0xc579('0x56')](_0x2b782d);}})[_0xc579('0x21')](function(_0x597316){if(_0x597316){return _0x597316?{'count':_0x10e2b0,'rows':_0x597316}:null;}})[_0xc579('0x21')](respondWithResult(_0x594ff5,null))[_0xc579('0x45')](handleError(_0x594ff5,null));};exports[_0xc579('0x58')]=function(_0x586729,_0x5c7f42,_0x1186bc){var _0x67909b={};var _0x42dde3={};var _0x48294f;var _0x5074a4;return db[_0xc579('0x2b')][_0xc579('0x57')]({'where':{'id':_0x586729[_0xc579('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c7f42,null))[_0xc579('0x21')](function(_0x22bc86){if(_0x22bc86){_0x48294f=_0x22bc86;_0x42dde3['model']=_[_0xc579('0x31')](db['Condition'][_0xc579('0x2c')]);_0x42dde3['query']=_[_0xc579('0x31')](_0x586729[_0xc579('0x30')]);_0x42dde3[_0xc579('0x32')]=_[_0xc579('0x33')](_0x42dde3['model'],_0x42dde3[_0xc579('0x30')]);_0x67909b[_0xc579('0x35')]=_[_0xc579('0x33')](_0x42dde3[_0xc579('0x34')],qs['fields'](_0x586729['query'][_0xc579('0x36')]));_0x67909b[_0xc579('0x35')]=_0x67909b[_0xc579('0x35')]['length']?_0x67909b['attributes']:_0x42dde3[_0xc579('0x34')];_0x67909b['order']=qs['sort'](_0x586729[_0xc579('0x30')][_0xc579('0x3b')]);_0x67909b[_0xc579('0x3c')]=qs[_0xc579('0x32')](_[_0xc579('0x3d')](_0x586729['query'],_0x42dde3['filters']));if(_0x586729[_0xc579('0x30')][_0xc579('0x3e')]){_0x67909b['where']=_['merge'](_0x67909b[_0xc579('0x3c')],{'$or':_['map'](_0x67909b[_0xc579('0x35')],function(_0x1bfc21){var _0x411c02={};_0x411c02[_0x1bfc21]={'$like':'%'+_0x586729[_0xc579('0x30')][_0xc579('0x3e')]+'%'};return _0x411c02;})});}_0x67909b=_['merge']({},_0x67909b,_0x586729['options']);return _0x48294f[_0xc579('0x58')](_0x67909b);}})[_0xc579('0x21')](function(_0x5924e9){if(_0x5924e9){_0x5074a4=_0x5924e9[_0xc579('0x37')];if(!_0x586729[_0xc579('0x30')]['hasOwnProperty']('nolimit')){_0x67909b[_0xc579('0x1a')]=qs[_0xc579('0x1a')](_0x586729['query'][_0xc579('0x1a')]);_0x67909b[_0xc579('0x19')]=qs[_0xc579('0x19')](_0x586729[_0xc579('0x30')][_0xc579('0x19')]);}return _0x48294f[_0xc579('0x58')](_0x67909b);}})[_0xc579('0x21')](function(_0x58f708){if(_0x58f708){return _0x58f708?{'count':_0x5074a4,'rows':_0x58f708}:null;}})['then'](respondWithResult(_0x5c7f42,null))[_0xc579('0x45')](handleError(_0x5c7f42,null));};exports[_0xc579('0x59')]=function(_0x347601,_0x474cf8,_0x29e289){if(_0x347601[_0xc579('0x4a')]['id']){delete _0x347601['body']['id'];}return db[_0xc579('0x2b')][_0xc579('0x48')]({'where':{'id':_0x347601[_0xc579('0x47')]['id']}})[_0xc579('0x21')](handleEntityNotFound(_0x474cf8,null))[_0xc579('0x21')](function(_0x16930a){if(_0x16930a){_0x347601[_0xc579('0x4a')]['TriggerId']=_0x16930a['id'];return db[_0xc579('0x5a')][_0xc579('0x49')](_0x347601['body']);}})[_0xc579('0x21')](respondWithResult(_0x474cf8,null))[_0xc579('0x45')](handleError(_0x474cf8,null));};exports[_0xc579('0x5b')]=function(_0x5afc7e,_0x38d9d4,_0x2b8ad4){var _0x2edad7={};var _0x179443={};var _0x484139;var _0x1fa264;return db[_0xc579('0x2b')][_0xc579('0x57')]({'where':{'id':_0x5afc7e[_0xc579('0x47')]['id']}})['then'](handleEntityNotFound(_0x38d9d4,null))[_0xc579('0x21')](function(_0x5b33c7){if(_0x5b33c7){_0x484139=_0x5b33c7;_0x179443[_0xc579('0x34')]=_[_0xc579('0x31')](db[_0xc579('0x5a')][_0xc579('0x2c')]);_0x179443[_0xc579('0x30')]=_[_0xc579('0x31')](_0x5afc7e[_0xc579('0x30')]);_0x179443[_0xc579('0x32')]=_[_0xc579('0x33')](_0x179443[_0xc579('0x34')],_0x179443[_0xc579('0x30')]);_0x2edad7[_0xc579('0x35')]=_[_0xc579('0x33')](_0x179443['model'],qs[_0xc579('0x36')](_0x5afc7e['query'][_0xc579('0x36')]));_0x2edad7[_0xc579('0x35')]=_0x2edad7[_0xc579('0x35')][_0xc579('0x37')]?_0x2edad7['attributes']:_0x179443[_0xc579('0x34')];_0x2edad7[_0xc579('0x3a')]=qs[_0xc579('0x3b')](_0x5afc7e[_0xc579('0x30')][_0xc579('0x3b')]);_0x2edad7[_0xc579('0x3c')]=qs[_0xc579('0x32')](_[_0xc579('0x3d')](_0x5afc7e[_0xc579('0x30')],_0x179443['filters']));if(_0x5afc7e[_0xc579('0x30')][_0xc579('0x3e')]){_0x2edad7[_0xc579('0x3c')]=_[_0xc579('0x40')](_0x2edad7[_0xc579('0x3c')],{'$or':_[_0xc579('0x2a')](_0x2edad7[_0xc579('0x35')],function(_0x51438a){var _0x3d7fbb={};_0x3d7fbb[_0x51438a]={'$like':'%'+_0x5afc7e['query']['filter']+'%'};return _0x3d7fbb;})});}_0x2edad7=_['merge']({},_0x2edad7,_0x5afc7e['options']);return _0x484139[_0xc579('0x5b')](_0x2edad7);}})['then'](function(_0x5eef87){if(_0x5eef87){_0x1fa264=_0x5eef87[_0xc579('0x37')];if(!_0x5afc7e[_0xc579('0x30')][_0xc579('0x38')](_0xc579('0x39'))){_0x2edad7[_0xc579('0x1a')]=qs[_0xc579('0x1a')](_0x5afc7e[_0xc579('0x30')]['limit']);_0x2edad7[_0xc579('0x19')]=qs[_0xc579('0x19')](_0x5afc7e[_0xc579('0x30')][_0xc579('0x19')]);}return _0x484139['getActions'](_0x2edad7);}})[_0xc579('0x21')](function(_0x553ed2){if(_0x553ed2){return _0x553ed2?{'count':_0x1fa264,'rows':_0x553ed2}:null;}})[_0xc579('0x21')](respondWithResult(_0x38d9d4,null))[_0xc579('0x45')](handleError(_0x38d9d4,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c1d319d..b5feee2 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 _0x0c2b=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers'];(function(_0x34f756,_0x1ea7ab){var _0x26e745=function(_0x165a65){while(--_0x165a65){_0x34f756['push'](_0x34f756['shift']());}};_0x26e745(++_0x1ea7ab);}(_0x0c2b,0x134));var _0xb0c2=function(_0x9d10b2,_0x32555e){_0x9d10b2=_0x9d10b2-0x0;var _0x1274e8=_0x0c2b[_0x9d10b2];return _0x1274e8;};'use strict';var _=require(_0xb0c2('0x0'));var util=require(_0xb0c2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb0c2('0x2'));var BPromise=require('bluebird');var rp=require(_0xb0c2('0x3'));var fs=require('fs');var path=require(_0xb0c2('0x4'));var rimraf=require(_0xb0c2('0x5'));var config=require(_0xb0c2('0x6'));var attributes=require(_0xb0c2('0x7'));module['exports']=function(_0x514b10,_0x1f0b7e){return _0x514b10[_0xb0c2('0x8')](_0xb0c2('0x9'),attributes,{'tableName':_0xb0c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0d9=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x480c74,_0x2d29b8){var _0x4a1214=function(_0x2cb75f){while(--_0x2cb75f){_0x480c74['push'](_0x480c74['shift']());}};_0x4a1214(++_0x2d29b8);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x283caf,_0xbb627b){_0x283caf=_0x283caf-0x0;var _0x599096=_0xb0d9[_0x283caf];return _0x599096;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var logger=require(_0x9b0d('0x2'))(_0x9b0d('0x3'));var moment=require(_0x9b0d('0x4'));var BPromise=require(_0x9b0d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b0d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x9b0d('0x7')]=function(_0x3994a1,_0x584dde){return _0x3994a1[_0x9b0d('0x8')](_0x9b0d('0x9'),attributes,{'tableName':_0x9b0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 252f504..2a5cb51 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 _0x9e34=['debug','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','where','limit','include','attributes','model','map','then','catch','find','raw','ShowTrigger','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','http','info','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x9e34,0xf5));var _0x49e3=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x9e34[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x49e3('0x0'));var util=require(_0x49e3('0x1'));var moment=require(_0x49e3('0x2'));var BPromise=require(_0x49e3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x49e3('0x5'));var jayson=require(_0x49e3('0x6'));var client=jayson['client'][_0x49e3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbb466a,_0x4297ae,_0x2d07fb){return new BPromise(function(_0x5e51e8,_0x1ef7a8){return client['request'](_0xbb466a,_0x2d07fb)['then'](function(_0xb1dc09){logger[_0x49e3('0x8')](_0x49e3('0x9'),_0x4297ae,_0x49e3('0xa'));logger[_0x49e3('0xb')]('Trigger,\x20%s,\x20%s,\x20%s',_0x4297ae,_0x49e3('0xa'),JSON[_0x49e3('0xc')](_0xb1dc09));if(_0xb1dc09[_0x49e3('0xd')]){if(_0xb1dc09[_0x49e3('0xd')][_0x49e3('0xe')]===0x1f4){logger['error'](_0x49e3('0x9'),_0x4297ae,_0xb1dc09[_0x49e3('0xd')][_0x49e3('0xf')]);return _0x1ef7a8(_0xb1dc09[_0x49e3('0xd')]['message']);}logger[_0x49e3('0xd')]('Trigger,\x20%s,\x20%s',_0x4297ae,_0xb1dc09[_0x49e3('0xd')][_0x49e3('0xf')]);return _0x5e51e8(_0xb1dc09[_0x49e3('0xd')][_0x49e3('0xf')]);}else{logger[_0x49e3('0x8')](_0x49e3('0x9'),_0x4297ae,_0x49e3('0xa'));_0x5e51e8(_0xb1dc09[_0x49e3('0x10')][_0x49e3('0xf')]);}})['catch'](function(_0x5a2a04){logger[_0x49e3('0xd')](_0x49e3('0x9'),_0x4297ae,_0x5a2a04);_0x1ef7a8(_0x5a2a04);});});}exports[_0x49e3('0x11')]=function(_0x139534){var _0xe89688=this;return new Promise(function(_0x665cd4,_0x30482c){return db[_0x49e3('0x12')][_0x49e3('0x13')]({'raw':_0x139534[_0x49e3('0x14')]?_0x139534[_0x49e3('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x139534['options']?_0x139534[_0x49e3('0x14')][_0x49e3('0x15')]||null:null,'attributes':_0x139534['options']?_0x139534[_0x49e3('0x14')]['attributes']||null:null,'limit':_0x139534[_0x49e3('0x14')]?_0x139534[_0x49e3('0x14')][_0x49e3('0x16')]||null:null,'include':_0x139534[_0x49e3('0x14')]?_0x139534[_0x49e3('0x14')][_0x49e3('0x17')]?_['map'](_0x139534[_0x49e3('0x14')][_0x49e3('0x17')],function(_0x30ab40){return{'model':db[_0x30ab40['model']],'as':_0x30ab40['as'],'attributes':_0x30ab40[_0x49e3('0x18')],'include':_0x30ab40[_0x49e3('0x17')]?_['map'](_0x30ab40[_0x49e3('0x17')],function(_0x77376b){return{'model':db[_0x77376b[_0x49e3('0x19')]],'as':_0x77376b['as'],'attributes':_0x77376b['attributes'],'include':_0x77376b[_0x49e3('0x17')]?_[_0x49e3('0x1a')](_0x77376b[_0x49e3('0x17')],function(_0xfff92d){return{'model':db[_0xfff92d[_0x49e3('0x19')]],'as':_0xfff92d['as'],'attributes':_0xfff92d[_0x49e3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x49e3('0x1b')](function(_0x54504b){logger[_0x49e3('0x8')]('GetTrigger',_0x139534);logger[_0x49e3('0xb')](_0x49e3('0x11'),_0x139534,JSON['stringify'](_0x54504b));_0x665cd4(_0x54504b);})[_0x49e3('0x1c')](function(_0x2491db){logger[_0x49e3('0xd')](_0x49e3('0x11'),_0x2491db[_0x49e3('0xf')],_0x139534);_0x30482c(_0xe89688['error'](0x1f4,_0x2491db[_0x49e3('0xf')]));});});};exports['ShowTrigger']=function(_0x433dcc){var _0x58bcbe=this;return new Promise(function(_0x150f82,_0x288616){return db[_0x49e3('0x12')][_0x49e3('0x1d')]({'raw':_0x433dcc[_0x49e3('0x14')]?_0x433dcc[_0x49e3('0x14')][_0x49e3('0x1e')]===undefined?!![]:![]:!![],'where':_0x433dcc[_0x49e3('0x14')]?_0x433dcc[_0x49e3('0x14')]['where']||null:null,'attributes':_0x433dcc[_0x49e3('0x14')]?_0x433dcc[_0x49e3('0x14')][_0x49e3('0x18')]||null:null,'include':_0x433dcc[_0x49e3('0x14')]?_0x433dcc['options'][_0x49e3('0x17')]?_[_0x49e3('0x1a')](_0x433dcc[_0x49e3('0x14')]['include'],function(_0x49230e){return{'model':db[_0x49230e[_0x49e3('0x19')]],'as':_0x49230e['as'],'attributes':_0x49230e[_0x49e3('0x18')],'include':_0x49230e['include']?_[_0x49e3('0x1a')](_0x49230e['include'],function(_0x4fdb80){return{'model':db[_0x4fdb80['model']],'as':_0x4fdb80['as'],'attributes':_0x4fdb80[_0x49e3('0x18')],'include':_0x4fdb80[_0x49e3('0x17')]?_['map'](_0x4fdb80['include'],function(_0x147419){return{'model':db[_0x147419['model']],'as':_0x147419['as'],'attributes':_0x147419[_0x49e3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x49e3('0x1b')](function(_0x4b9f3f){logger['info']('ShowTrigger',_0x433dcc);logger['debug'](_0x49e3('0x1f'),_0x433dcc,JSON[_0x49e3('0xc')](_0x4b9f3f));_0x150f82(_0x4b9f3f);})[_0x49e3('0x1c')](function(_0x6d140){logger[_0x49e3('0xd')](_0x49e3('0x1f'),_0x6d140[_0x49e3('0xf')],_0x433dcc);_0x288616(_0x58bcbe[_0x49e3('0xd')](0x1f4,_0x6d140[_0x49e3('0xf')]));});});}; \ No newline at end of file +var _0xbeeb=['raw','where','attributes','limit','include','map','model','ShowTrigger','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','Trigger','options'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0xbeeb,0x1c8));var _0xbbee=function(_0x4dca39,_0x4a5a3a){_0x4dca39=_0x4dca39-0x0;var _0x5e66c0=_0xbeeb[_0x4dca39];return _0x5e66c0;};'use strict';var _=require('lodash');var util=require(_0xbbee('0x0'));var moment=require(_0xbbee('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbee('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xbbee('0x4'));var jayson=require(_0xbbee('0x5'));var client=jayson[_0xbbee('0x6')][_0xbbee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19963a,_0x1f0c54,_0x3a51fa){return new BPromise(function(_0x164de3,_0x3a7507){return client[_0xbbee('0x8')](_0x19963a,_0x3a51fa)[_0xbbee('0x9')](function(_0x12b7e8){logger['info'](_0xbbee('0xa'),_0x1f0c54,_0xbbee('0xb'));logger[_0xbbee('0xc')](_0xbbee('0xd'),_0x1f0c54,'request\x20sent',JSON[_0xbbee('0xe')](_0x12b7e8));if(_0x12b7e8['error']){if(_0x12b7e8[_0xbbee('0xf')][_0xbbee('0x10')]===0x1f4){logger[_0xbbee('0xf')]('Trigger,\x20%s,\x20%s',_0x1f0c54,_0x12b7e8[_0xbbee('0xf')][_0xbbee('0x11')]);return _0x3a7507(_0x12b7e8[_0xbbee('0xf')][_0xbbee('0x11')]);}logger[_0xbbee('0xf')]('Trigger,\x20%s,\x20%s',_0x1f0c54,_0x12b7e8[_0xbbee('0xf')]['message']);return _0x164de3(_0x12b7e8[_0xbbee('0xf')][_0xbbee('0x11')]);}else{logger[_0xbbee('0x12')](_0xbbee('0xa'),_0x1f0c54,_0xbbee('0xb'));_0x164de3(_0x12b7e8[_0xbbee('0x13')][_0xbbee('0x11')]);}})[_0xbbee('0x14')](function(_0x182077){logger[_0xbbee('0xf')](_0xbbee('0xa'),_0x1f0c54,_0x182077);_0x3a7507(_0x182077);});});}exports[_0xbbee('0x15')]=function(_0x204c11){var _0x1a7162=this;return new Promise(function(_0x51f211,_0x517797){return db[_0xbbee('0x16')]['findAll']({'raw':_0x204c11[_0xbbee('0x17')]?_0x204c11[_0xbbee('0x17')][_0xbbee('0x18')]===undefined?!![]:![]:!![],'where':_0x204c11[_0xbbee('0x17')]?_0x204c11['options'][_0xbbee('0x19')]||null:null,'attributes':_0x204c11[_0xbbee('0x17')]?_0x204c11[_0xbbee('0x17')][_0xbbee('0x1a')]||null:null,'limit':_0x204c11[_0xbbee('0x17')]?_0x204c11[_0xbbee('0x17')][_0xbbee('0x1b')]||null:null,'include':_0x204c11[_0xbbee('0x17')]?_0x204c11[_0xbbee('0x17')][_0xbbee('0x1c')]?_[_0xbbee('0x1d')](_0x204c11[_0xbbee('0x17')][_0xbbee('0x1c')],function(_0x3621d2){return{'model':db[_0x3621d2[_0xbbee('0x1e')]],'as':_0x3621d2['as'],'attributes':_0x3621d2[_0xbbee('0x1a')],'include':_0x3621d2['include']?_[_0xbbee('0x1d')](_0x3621d2[_0xbbee('0x1c')],function(_0x4ec3ec){return{'model':db[_0x4ec3ec[_0xbbee('0x1e')]],'as':_0x4ec3ec['as'],'attributes':_0x4ec3ec[_0xbbee('0x1a')],'include':_0x4ec3ec[_0xbbee('0x1c')]?_['map'](_0x4ec3ec['include'],function(_0x94fc0b){return{'model':db[_0x94fc0b[_0xbbee('0x1e')]],'as':_0x94fc0b['as'],'attributes':_0x94fc0b[_0xbbee('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cfc3b){logger['info'](_0xbbee('0x15'),_0x204c11);logger['debug'](_0xbbee('0x15'),_0x204c11,JSON[_0xbbee('0xe')](_0x4cfc3b));_0x51f211(_0x4cfc3b);})[_0xbbee('0x14')](function(_0x5cec57){logger[_0xbbee('0xf')](_0xbbee('0x15'),_0x5cec57[_0xbbee('0x11')],_0x204c11);_0x517797(_0x1a7162['error'](0x1f4,_0x5cec57['message']));});});};exports[_0xbbee('0x1f')]=function(_0x3c3c09){var _0x563d4a=this;return new Promise(function(_0x34fdec,_0x33f867){return db[_0xbbee('0x16')]['find']({'raw':_0x3c3c09[_0xbbee('0x17')]?_0x3c3c09['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c3c09['options']?_0x3c3c09['options'][_0xbbee('0x19')]||null:null,'attributes':_0x3c3c09[_0xbbee('0x17')]?_0x3c3c09[_0xbbee('0x17')][_0xbbee('0x1a')]||null:null,'include':_0x3c3c09['options']?_0x3c3c09['options'][_0xbbee('0x1c')]?_[_0xbbee('0x1d')](_0x3c3c09['options'][_0xbbee('0x1c')],function(_0x395dd5){return{'model':db[_0x395dd5[_0xbbee('0x1e')]],'as':_0x395dd5['as'],'attributes':_0x395dd5['attributes'],'include':_0x395dd5[_0xbbee('0x1c')]?_[_0xbbee('0x1d')](_0x395dd5['include'],function(_0x5cacb1){return{'model':db[_0x5cacb1[_0xbbee('0x1e')]],'as':_0x5cacb1['as'],'attributes':_0x5cacb1[_0xbbee('0x1a')],'include':_0x5cacb1[_0xbbee('0x1c')]?_[_0xbbee('0x1d')](_0x5cacb1[_0xbbee('0x1c')],function(_0x5cde94){return{'model':db[_0x5cde94['model']],'as':_0x5cde94['as'],'attributes':_0x5cde94[_0xbbee('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbbee('0x9')](function(_0x138177){logger[_0xbbee('0x12')](_0xbbee('0x1f'),_0x3c3c09);logger[_0xbbee('0xc')]('ShowTrigger',_0x3c3c09,JSON['stringify'](_0x138177));_0x34fdec(_0x138177);})[_0xbbee('0x14')](function(_0x4d45ad){logger[_0xbbee('0xf')]('ShowTrigger',_0x4d45ad[_0xbbee('0x11')],_0x3c3c09);_0x33f867(_0x563d4a['error'](0x1f4,_0x4d45ad[_0xbbee('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1447e44..d7f5ff4 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 _0x7a38=['create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','post','/:id/clone','clone'];(function(_0x374954,_0x18dc36){var _0x42073e=function(_0x1cb45f){while(--_0x1cb45f){_0x374954['push'](_0x374954['shift']());}};_0x42073e(++_0x18dc36);}(_0x7a38,0x1f3));var _0x87a3=function(_0x3c66e6,_0x23433a){_0x3c66e6=_0x3c66e6-0x0;var _0x22f564=_0x7a38[_0x3c66e6];return _0x22f564;};'use strict';var multer=require('multer');var util=require(_0x87a3('0x0'));var path=require(_0x87a3('0x1'));var timeout=require(_0x87a3('0x2'));var express=require(_0x87a3('0x3'));var router=express[_0x87a3('0x4')]();var fs_extra=require(_0x87a3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x87a3('0x6'));var controller=require('./trunk.controller');router[_0x87a3('0x7')]('/',auth[_0x87a3('0x8')](),controller['index']);router[_0x87a3('0x7')](_0x87a3('0x9'),auth[_0x87a3('0x8')](),controller[_0x87a3('0xa')]);router[_0x87a3('0xb')](_0x87a3('0xc'),auth[_0x87a3('0x8')](),controller[_0x87a3('0xd')]);router[_0x87a3('0xb')]('/',auth[_0x87a3('0x8')](),controller[_0x87a3('0xe')]);router[_0x87a3('0xf')]('/:id',auth[_0x87a3('0x8')](),controller['update']);router[_0x87a3('0x10')](_0x87a3('0x9'),auth[_0x87a3('0x8')](),controller[_0x87a3('0x11')]);module[_0x87a3('0x12')]=router; \ No newline at end of file +var _0x2db5=['create','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','clone'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2db5,0x123));var _0x52db=function(_0xdad237,_0x361a1d){_0xdad237=_0xdad237-0x0;var _0x15c575=_0x2db5[_0xdad237];return _0x15c575;};'use strict';var multer=require(_0x52db('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x52db('0x1'));var express=require(_0x52db('0x2'));var router=express[_0x52db('0x3')]();var fs_extra=require(_0x52db('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x52db('0x5'));var config=require(_0x52db('0x6'));var controller=require('./trunk.controller');router[_0x52db('0x7')]('/',auth[_0x52db('0x8')](),controller[_0x52db('0x9')]);router['get']('/:id',auth[_0x52db('0x8')](),controller[_0x52db('0xa')]);router[_0x52db('0xb')]('/:id/clone',auth[_0x52db('0x8')](),controller[_0x52db('0xc')]);router[_0x52db('0xb')]('/',auth[_0x52db('0x8')](),controller[_0x52db('0xd')]);router[_0x52db('0xe')](_0x52db('0xf'),auth[_0x52db('0x8')](),controller['update']);router[_0x52db('0x10')](_0x52db('0xf'),auth[_0x52db('0x8')](),controller[_0x52db('0x11')]);module[_0x52db('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 39ea421..0c0649b 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 _0x11f7=['getDataValue','info','shortinfo','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','sequelize','exports','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','STRING','udp','setDataValue','transport'];(function(_0x2f4412,_0x86e2e9){var _0x7272b1=function(_0x3209b7){while(--_0x3209b7){_0x2f4412['push'](_0x2f4412['shift']());}};_0x7272b1(++_0x86e2e9);}(_0x11f7,0x1da));var _0x711f=function(_0x15a717,_0x22a830){_0x15a717=_0x15a717-0x0;var _0x158eaf=_0x11f7[_0x15a717];return _0x158eaf;};'use strict';var Sequelize=require(_0x711f('0x0'));module[_0x711f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x711f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x4'),_0x711f('0x5'),_0x711f('0x6')),'allowNull':![],'defaultValue':_0x711f('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x7'),_0x711f('0x8'),_0x711f('0x9'),'ALLOWED',_0x711f('0xa'),_0x711f('0xb'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x711f('0xc')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x711f('0xc')]},'md5secret':{'type':Sequelize[_0x711f('0xc')]},'remotesecret':{'type':Sequelize[_0x711f('0xc')]},'transport':{'type':Sequelize[_0x711f('0xc')],'defaultValue':_0x711f('0xd'),'set':function(_0xe836ef){this[_0x711f('0xe')](_0x711f('0xf'),_0xe836ef?_0xe836ef['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x711f('0x10')](_0x711f('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x711f('0x11'),_0x711f('0x12'),'inband',_0x711f('0x13')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no',_0x711f('0x15'),_0x711f('0x16'),_0x711f('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x711f('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x711f('0xc')]},'directmediadeny':{'type':Sequelize[_0x711f('0xc')]},'nat':{'type':Sequelize[_0x711f('0xc')],'defaultValue':'force_rport,comedia','set':function(_0x2ecaa9){this['setDataValue'](_0x711f('0x18'),_0x2ecaa9?_0x2ecaa9[_0x711f('0x19')](','):null);},'get':function(){return this[_0x711f('0x10')](_0x711f('0x18'))?this[_0x711f('0x10')](_0x711f('0x18'))['split'](','):null;},'comment':_0x711f('0x1a')},'callgroup':{'type':Sequelize[_0x711f('0xc')]},'namedcallgroup':{'type':Sequelize[_0x711f('0xc')]},'pickupgroup':{'type':Sequelize[_0x711f('0xc')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x711f('0xc')],'defaultValue':_0x711f('0x1b')},'allow':{'type':Sequelize[_0x711f('0xc')],'allowNull':![],'defaultValue':_0x711f('0x1c'),'set':function(_0x38c11d){this['setDataValue']('allow',_0x38c11d?_0x38c11d['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x711f('0x10')](_0x711f('0x1d'))?this[_0x711f('0x10')](_0x711f('0x1d'))[_0x711f('0x1e')](';'):null;},'comment':_0x711f('0x1f')},'autoframing':{'type':Sequelize[_0x711f('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x711f('0xc')],'defaultValue':_0x711f('0x20'),'set':function(_0xcf6ad0){this['setDataValue'](_0x711f('0x21'),_0xcf6ad0?_0xcf6ad0['join'](','):null);},'get':function(){return this[_0x711f('0x10')](_0x711f('0x21'))?this[_0x711f('0x10')]('insecure')[_0x711f('0x1e')](','):null;},'comment':_0x711f('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0x711f('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x711f('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x711f('0x3')]('yes','no',_0x711f('0x23'))},'promiscredir':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x711f('0x24')](0xb)},'setvar':{'type':Sequelize[_0x711f('0xc')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x711f('0x25')},'amaflags':{'type':Sequelize[_0x711f('0xc')]},'callcounter':{'type':Sequelize['ENUM'](_0x711f('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x711f('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x711f('0xc')]},'template':{'type':Sequelize[_0x711f('0xc')]},'videosupport':{'type':Sequelize[_0x711f('0x3')]('yes','no',_0x711f('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x711f('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'mailbox':{'type':Sequelize[_0x711f('0xc')]},'session_timers':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x27'),_0x711f('0x28'),_0x711f('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x711f('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x2a'),'uas'),'defaultValue':_0x711f('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x711f('0xc')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x711f('0xc')]},'fromuser':{'type':Sequelize[_0x711f('0xc')]},'port':{'type':Sequelize[_0x711f('0x24')](0x5)},'qualify':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x711f('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x711f('0xc')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x711f('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x711f('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x711f('0x3')]('yes','no',_0x711f('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x711f('0xc')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x711f('0x24')](0xb)},'timerb':{'type':Sequelize[_0x711f('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x711f('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x711f('0xc')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x711f('0xc')]},'unsolicited_mailbox':{'type':Sequelize[_0x711f('0xc')]},'use_q850_reason':{'type':Sequelize[_0x711f('0xc')]},'maxforwards':{'type':Sequelize[_0x711f('0x24')](0xb)},'encryption':{'type':Sequelize[_0x711f('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no',_0x711f('0x2d'),_0x711f('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x711f('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x711f('0xc')]},'dtlsprivatekey':{'type':Sequelize[_0x711f('0xc')]},'dtlscipher':{'type':Sequelize[_0x711f('0xc')]},'dtlscafile':{'type':Sequelize[_0x711f('0xc')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x711f('0x2f'),_0x711f('0x30'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x711f('0xc')]},'usereqphone':{'type':Sequelize[_0x711f('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x711f('0xc')]},'recordofffeature':{'type':Sequelize[_0x711f('0xc')]},'call_limit':{'type':Sequelize[_0x711f('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x711f('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x711f('0x3')](_0x711f('0x14'),'no')},'vmexten':{'type':Sequelize[_0x711f('0xc')]},'mohinterpret':{'type':Sequelize[_0x711f('0xc')]},'mohsuggest':{'type':Sequelize[_0x711f('0xc')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x711f('0xc')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x711f('0x3')]('yes','no',_0x711f('0x15'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x711f('0xc')]},'otherFields':{'type':Sequelize[_0x711f('0xc')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x711f('0xc')],'defaultValue':'no'}}; \ No newline at end of file +var _0x777d=['ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','pai','passive','actpass','update','update,nonat','sequelize','STRING','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x777d,0x185));var _0xd777=function(_0x2cff4f,_0x21e344){_0x2cff4f=_0x2cff4f-0x0;var _0x3df848=_0x777d[_0x2cff4f];return _0x3df848;};'use strict';var Sequelize=require(_0xd777('0x0'));module['exports']={'name':{'type':Sequelize[_0xd777('0x1')],'allowNull':![],'unique':_0xd777('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x4'),_0xd777('0x5'),'peer'),'allowNull':![],'defaultValue':_0xd777('0x4')},'context':{'type':Sequelize[_0xd777('0x1')],'allowNull':![],'defaultValue':_0xd777('0x6')},'callingpres':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x7'),_0xd777('0x8'),_0xd777('0x9'),_0xd777('0xa'),_0xd777('0xb'),_0xd777('0xc'),_0xd777('0xd'),_0xd777('0xe'))},'deny':{'type':Sequelize[_0xd777('0x1')]},'permit':{'type':Sequelize[_0xd777('0x1')]},'secret':{'type':Sequelize[_0xd777('0x1')]},'md5secret':{'type':Sequelize[_0xd777('0x1')]},'remotesecret':{'type':Sequelize[_0xd777('0x1')]},'transport':{'type':Sequelize[_0xd777('0x1')],'defaultValue':_0xd777('0xf'),'set':function(_0x156d8c){this[_0xd777('0x10')]('transport',_0x156d8c?_0x156d8c['join'](','):null);},'get':function(){return this[_0xd777('0x11')](_0xd777('0x12'))?this[_0xd777('0x11')]('transport')[_0xd777('0x13')](','):null;},'comment':_0xd777('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0xd777('0x15'),_0xd777('0x16'),_0xd777('0x17'),_0xd777('0x18'),'auto'),'defaultValue':_0xd777('0x15')},'directmedia':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no',_0xd777('0x1a'),'update',_0xd777('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd777('0x1')]},'directmediadeny':{'type':Sequelize[_0xd777('0x1')]},'nat':{'type':Sequelize[_0xd777('0x1')],'defaultValue':_0xd777('0x1c'),'set':function(_0x395c98){this[_0xd777('0x10')](_0xd777('0x1d'),_0x395c98?_0x395c98[_0xd777('0x1e')](','):null);},'get':function(){return this[_0xd777('0x11')](_0xd777('0x1d'))?this[_0xd777('0x11')](_0xd777('0x1d'))['split'](','):null;},'comment':_0xd777('0x1f')},'callgroup':{'type':Sequelize[_0xd777('0x1')]},'namedcallgroup':{'type':Sequelize[_0xd777('0x1')]},'pickupgroup':{'type':Sequelize[_0xd777('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xd777('0x1')]},'language':{'type':Sequelize[_0xd777('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd777('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd777('0x1')],'defaultValue':_0xd777('0x20')},'allow':{'type':Sequelize[_0xd777('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5e856d){this['setDataValue'](_0xd777('0x21'),_0x5e856d?_0x5e856d[_0xd777('0x1e')](';'):_0xd777('0x22'));},'get':function(){return this[_0xd777('0x11')](_0xd777('0x21'))?this[_0xd777('0x11')](_0xd777('0x21'))[_0xd777('0x13')](';'):null;},'comment':_0xd777('0x23')},'autoframing':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no')},'insecure':{'type':Sequelize[_0xd777('0x1')],'defaultValue':'port,invite','set':function(_0x1accf9){this[_0xd777('0x10')](_0xd777('0x24'),_0x1accf9?_0x1accf9[_0xd777('0x1e')](','):null);},'get':function(){return this['getDataValue'](_0xd777('0x24'))?this['getDataValue'](_0xd777('0x24'))[_0xd777('0x13')](','):null;},'comment':_0xd777('0x25')},'trustrpid':{'type':Sequelize['ENUM'](_0xd777('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xd777('0x26'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no')},'accountcode':{'type':Sequelize[_0xd777('0x27')](0xb)},'setvar':{'type':Sequelize[_0xd777('0x1')]},'callerid':{'type':Sequelize[_0xd777('0x1')],'defaultValue':_0xd777('0x28')},'amaflags':{'type':Sequelize[_0xd777('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xd777('0x19'),'no'),'defaultValue':_0xd777('0x19')},'busylevel':{'type':Sequelize[_0xd777('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xd777('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xd777('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xd777('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd777('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xd777('0x1')]},'videosupport':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no',_0xd777('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd777('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd777('0x19'),'no')},'mailbox':{'type':Sequelize[_0xd777('0x1')]},'session_timers':{'type':Sequelize[_0xd777('0x3')]('accept',_0xd777('0x2a'),_0xd777('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xd777('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0xd777('0x3')]('uac','uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xd777('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xd777('0x1')]},'fromuser':{'type':Sequelize[_0xd777('0x1')]},'port':{'type':Sequelize[_0xd777('0x27')](0x5)},'qualify':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no'),'defaultValue':_0xd777('0x19')},'keepalive':{'type':Sequelize[_0xd777('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xd777('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd777('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd777('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xd777('0x19'),'no',_0xd777('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd777('0x1')]},'callbackextension':{'type':Sequelize[_0xd777('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xd777('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd777('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xd777('0x1')]},'contactdeny':{'type':Sequelize[_0xd777('0x1')]},'contactacl':{'type':Sequelize[_0xd777('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xd777('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xd777('0x19'),'no')},'force_avp':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xd777('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xd777('0x3')]('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xd777('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd777('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xd777('0x1')]},'dtlscipher':{'type':Sequelize[_0xd777('0x1')]},'dtlscafile':{'type':Sequelize[_0xd777('0x1')]},'dtlscapath':{'type':Sequelize[_0xd777('0x1')]},'dtlssetup':{'type':Sequelize[_0xd777('0x3')]('active',_0xd777('0x2d'),_0xd777('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd777('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd777('0x1')]},'recordofffeature':{'type':Sequelize[_0xd777('0x1')]},'call_limit':{'type':Sequelize[_0xd777('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no')},'vmexten':{'type':Sequelize[_0xd777('0x1')]},'mohinterpret':{'type':Sequelize[_0xd777('0x1')]},'mohsuggest':{'type':Sequelize[_0xd777('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd777('0x1')]},'host':{'type':Sequelize[_0xd777('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xd777('0x3')](_0xd777('0x19'),'no',_0xd777('0x1a'),_0xd777('0x2f'),_0xd777('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd777('0x1')]},'otherFields':{'type':Sequelize[_0xd777('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd777('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 87d77ed..a04ee32 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 _0xf3cd=['length','limit','sort','where','filter','merge','options','Trunk','includeAll','include','findAll','show','find','clone','createdAt','updatedAt','omit','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','offset','count','json','reject','save','update','get','UserProfileResource','destroy','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1af2ee,_0xe68160){var _0x3c076f=function(_0x5bd903){while(--_0x5bd903){_0x1af2ee['push'](_0x1af2ee['shift']());}};_0x3c076f(++_0xe68160);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5df25b,_0x1bc928){_0x5df25b=_0x5df25b-0x0;var _0x19f252=_0xf3cd[_0x5df25b];return _0x19f252;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdf3c('0x1a'));var client=jayson[_0xdf3c('0x1b')][_0xdf3c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17319c,_0x59e431,_0x2ae4ad,_0x461079){return new BPromise(function(_0x13ea5f,_0x5e0047){var _0x18aafa=_0x461079||client;return _0x18aafa[_0xdf3c('0x1d')](_0x17319c,_0x2ae4ad)[_0xdf3c('0x1e')](function(_0x4274fd){logger[_0xdf3c('0x1f')](_0xdf3c('0x20'),_0x59e431,_0xdf3c('0x21'));logger[_0xdf3c('0x22')](_0xdf3c('0x23'),_0x59e431,_0xdf3c('0x21'),JSON['stringify'](_0x4274fd));if(_0x4274fd[_0xdf3c('0x24')]){if(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x25')]===0x1f4){logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x5e0047(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);}logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x13ea5f(_0x4274fd['error']['message']);}else{logger[_0xdf3c('0x1f')]('Trunk,\x20%s,\x20%s',_0x59e431,_0xdf3c('0x21'));_0x13ea5f(_0x4274fd[_0xdf3c('0x27')][_0xdf3c('0x26')]);}})[_0xdf3c('0x28')](function(_0x33652f){logger[_0xdf3c('0x24')]('Trunk,\x20%s,\x20%s',_0x59e431,_0x33652f);_0x5e0047(_0x33652f);});});}function respondWithStatusCode(_0x22a164,_0x213d75){_0x213d75=_0x213d75||0xcc;return function(_0x13e3ca){if(_0x13e3ca){return _0x22a164[_0xdf3c('0x29')](_0x213d75);}return _0x22a164[_0xdf3c('0x2a')](_0x213d75)[_0xdf3c('0x2b')]();};}function respondWithResult(_0xef54cb,_0x155f54){_0x155f54=_0x155f54||0xc8;return function(_0x18cb46){if(_0x18cb46){return _0xef54cb[_0xdf3c('0x2a')](_0x155f54)['json'](_0x18cb46);}};}function respondWithFilteredResult(_0xd284d7,_0x153daa){return function(_0x4b57a4){if(_0x4b57a4){var _0xdc8962=typeof _0x153daa['offset']==='undefined'&&typeof _0x153daa['limit']===_0xdf3c('0x2c');var _0x186bba=_0x4b57a4['count'];var _0x5c3b5a=_0xdc8962?0x0:_0x153daa[_0xdf3c('0x2d')];var _0x1f2ce4=_0xdc8962?_0x4b57a4[_0xdf3c('0x2e')]:_0x153daa[_0xdf3c('0x2d')]+_0x153daa['limit'];var _0x43ce06;if(_0x1f2ce4>=_0x186bba){_0x1f2ce4=_0x186bba;_0x43ce06=0xc8;}else{_0x43ce06=0xce;}_0xd284d7[_0xdf3c('0x2a')](_0x43ce06);return _0xd284d7['set']('Content-Range',_0x5c3b5a+'-'+_0x1f2ce4+'/'+_0x186bba)[_0xdf3c('0x2f')](_0x4b57a4);}return null;};}function patchUpdates(_0x46f0e3){return function(_0x36937e){try{jsonpatch['apply'](_0x36937e,_0x46f0e3,!![]);}catch(_0x2355f6){return BPromise[_0xdf3c('0x30')](_0x2355f6);}return _0x36937e[_0xdf3c('0x31')]();};}function saveUpdates(_0x10099e,_0x575ae1){return function(_0xda0de0){if(_0xda0de0){return _0xda0de0[_0xdf3c('0x32')](_0x10099e)['then'](function(_0x40ae3d){return _0x40ae3d;});}return null;};}function removeEntity(_0x3daeda,_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x1e')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x33')]({'plain':!![]});var _0x3b9ce8='Trunks';return db[_0xdf3c('0x34')][_0xdf3c('0x35')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x3daeda[_0xdf3c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115,_0x5e8130){return function(_0x57faba){if(!_0x57faba){_0x216115['sendStatus'](0x194);}return _0x57faba;};}function handleError(_0x44a478,_0x2ee9ad){_0x2ee9ad=_0x2ee9ad||0x1f4;return function(_0x1d0b8a){logger[_0xdf3c('0x24')](_0x1d0b8a['stack']);if(_0x1d0b8a['name']){delete _0x1d0b8a[_0xdf3c('0x36')];}_0x44a478['status'](_0x2ee9ad)[_0xdf3c('0x37')](_0x1d0b8a);};}exports[_0xdf3c('0x38')]=function(_0x3628ae,_0xcdd731){var _0x1004e9={},_0x1e0cf2={},_0x1c7335={'count':0x0,'rows':[]};var _0x809f3d=_[_0xdf3c('0x39')](db['Trunk'][_0xdf3c('0x3a')],function(_0x54e689){return{'name':_0x54e689['fieldName'],'type':_0x54e689[_0xdf3c('0x3b')]['key']};});_0x1e0cf2[_0xdf3c('0x3c')]=_['map'](_0x809f3d,_0xdf3c('0x36'));_0x1e0cf2[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x3628ae[_0xdf3c('0x3d')]);_0x1e0cf2[_0xdf3c('0x3f')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],_0x1e0cf2[_0xdf3c('0x3d')]);_0x1004e9[_0xdf3c('0x41')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x3628ae['query']['fields']));_0x1004e9[_0xdf3c('0x41')]=_0x1004e9['attributes'][_0xdf3c('0x43')]?_0x1004e9[_0xdf3c('0x41')]:_0x1e0cf2[_0xdf3c('0x3c')];if(!_0x3628ae[_0xdf3c('0x3d')]['hasOwnProperty']('nolimit')){_0x1004e9[_0xdf3c('0x44')]=qs[_0xdf3c('0x44')](_0x3628ae[_0xdf3c('0x3d')]['limit']);_0x1004e9[_0xdf3c('0x2d')]=qs[_0xdf3c('0x2d')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x2d')]);}_0x1004e9['order']=qs[_0xdf3c('0x45')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x45')]);_0x1004e9[_0xdf3c('0x46')]=qs[_0xdf3c('0x3f')](_['pick'](_0x3628ae[_0xdf3c('0x3d')],_0x1e0cf2[_0xdf3c('0x3f')]),_0x809f3d);if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]){_0x1004e9[_0xdf3c('0x46')]=_[_0xdf3c('0x48')](_0x1004e9['where'],{'$or':_['map'](_0x809f3d,function(_0x2c6c6d){if(_0x2c6c6d[_0xdf3c('0x3b')]!=='VIRTUAL'){var _0x5c9885={};_0x5c9885[_0x2c6c6d[_0xdf3c('0x36')]]={'$like':'%'+_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]+'%'};return _0x5c9885;}})});}_0x1004e9=_[_0xdf3c('0x48')]({},_0x1004e9,_0x3628ae[_0xdf3c('0x49')]);var _0x2dbf54={'where':_0x1004e9[_0xdf3c('0x46')]};return db[_0xdf3c('0x4a')][_0xdf3c('0x2e')](_0x2dbf54)['then'](function(_0x129c2a){_0x1c7335[_0xdf3c('0x2e')]=_0x129c2a;if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x1004e9[_0xdf3c('0x4c')]=[{'all':!![]}];}return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')](_0x1004e9);})['then'](function(_0x1751a8){_0x1c7335['rows']=_0x1751a8;return _0x1c7335;})[_0xdf3c('0x1e')](respondWithFilteredResult(_0xcdd731,_0x1004e9))['catch'](handleError(_0xcdd731,null));};exports[_0xdf3c('0x4e')]=function(_0x28144f,_0x2ec575){var _0x94c5b9={'raw':![],'where':{'id':_0x28144f['params']['id']}},_0x5eef94={};_0x5eef94['model']=_[_0xdf3c('0x3e')](db['Trunk'][_0xdf3c('0x3a')]);_0x5eef94[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x28144f[_0xdf3c('0x3d')]);_0x5eef94[_0xdf3c('0x3f')]=_['intersection'](_0x5eef94['model'],_0x5eef94[_0xdf3c('0x3d')]);_0x94c5b9[_0xdf3c('0x41')]=_['intersection'](_0x5eef94[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x94c5b9[_0xdf3c('0x41')]=_0x94c5b9[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x94c5b9['attributes']:_0x5eef94['model'];if(_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x94c5b9[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x94c5b9=_[_0xdf3c('0x48')]({},_0x94c5b9,_0x28144f[_0xdf3c('0x49')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x94c5b9)[_0xdf3c('0x1e')](handleEntityNotFound(_0x2ec575,null))[_0xdf3c('0x1e')](respondWithResult(_0x2ec575,null))[_0xdf3c('0x28')](handleError(_0x2ec575,null));};exports[_0xdf3c('0x50')]=function(_0x4cb28f,_0x1eebcf){var _0x47cb74={'where':{'id':_0x4cb28f['params']['id']}},_0x5e7247={};_0x5e7247['model']=_['keys'](db[_0xdf3c('0x4a')][_0xdf3c('0x3a')]);_0x47cb74['attributes']=_[_0xdf3c('0x40')](_0x5e7247[_0xdf3c('0x3c')],qs['fields'](_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x47cb74[_0xdf3c('0x41')]=_0x47cb74[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x47cb74[_0xdf3c('0x41')]:_0x5e7247[_0xdf3c('0x3c')];if(_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x47cb74[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x47cb74=_[_0xdf3c('0x48')]({},_0x47cb74,_0x4cb28f['options']);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x47cb74)[_0xdf3c('0x1e')](handleEntityNotFound(_0x1eebcf,null))['then'](function(_0x245c68){if(_0x245c68){var _0x3e327e=_0x245c68[_0xdf3c('0x33')]({'plain':!![]});_0x3e327e=qs['omit'](_0x3e327e,['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);_0x4cb28f['body']=_[_0xdf3c('0x53')](_0x4cb28f['body'],['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_[_0xdf3c('0x48')](_0x3e327e,_0x4cb28f[_0xdf3c('0x55')]),{'include':_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]?[{'all':!![]}]:undefined})[_0xdf3c('0x1e')](function(_0x330730){var _0x283be2=_0x4cb28f[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x283be2)throw new Error(_0xdf3c('0x57'));if(_0x283be2[_0xdf3c('0x58')]===_0xdf3c('0x56')){var _0xd7fb2d=_0x330730['get']({'plain':!![]});var _0x4dade5=_0xdf3c('0x59');return db[_0xdf3c('0x5a')][_0xdf3c('0x4f')]({'where':{'name':_0x4dade5,'userProfileId':_0x283be2['userProfileId']},'raw':!![]})[_0xdf3c('0x1e')](function(_0x5f2765){if(_0x5f2765&&_0x5f2765['autoAssociation']===0x0){return db[_0xdf3c('0x34')][_0xdf3c('0x54')]({'name':_0xd7fb2d[_0xdf3c('0x36')],'resourceId':_0xd7fb2d['id'],'type':_0x5f2765[_0xdf3c('0x36')],'sectionId':_0x5f2765['id']},{})[_0xdf3c('0x1e')](function(){return _0x330730;});}else{return _0x330730;}})[_0xdf3c('0x28')](function(_0x1a31d7){logger[_0xdf3c('0x24')](_0xdf3c('0x5b'),_0x1a31d7);throw _0x1a31d7;});}return _0x330730;});}})[_0xdf3c('0x1e')](respondWithResult(_0x1eebcf,0xc9))[_0xdf3c('0x28')](handleError(_0x1eebcf,null));};exports[_0xdf3c('0x54')]=function(_0x34000c,_0x4be79a,_0x3febac){var _0x2cb0f5;return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_0x34000c[_0xdf3c('0x55')],{'raw':!![]})['then'](function(_0x18bf4f){_0x2cb0f5=_0x18bf4f;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x1efa9c){var _0x50805c=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x5f')),'utf8');var _0xb867a1=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x19c851=ejs['render'](_0x50805c,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x19c851);if(_0x2cb0f5['registry']){var _0x52a2e1=ejs[_0xdf3c('0x64')](_0xb867a1,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x52a2e1);}})[_0xdf3c('0x1e')](function(){return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x54'),{'module':_0xdf3c('0x67')});})[_0xdf3c('0x1e')](function(){var _0x5e6606=_0x34000c[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x5e6606)throw new Error(_0xdf3c('0x57'));if(_0x5e6606['role']===_0xdf3c('0x56')){var _0x354ff4=_0x2cb0f5[_0xdf3c('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xdf3c('0x4f')]({'where':{'name':_0xdf3c('0x59'),'userProfileId':_0x5e6606[_0xdf3c('0x68')]},'raw':!![]})[_0xdf3c('0x1e')](function(_0xe01538){if(_0xe01538&&_0xe01538[_0xdf3c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x354ff4['name'],'resourceId':_0x354ff4['id'],'type':_0xe01538['name'],'sectionId':_0xe01538['id']},{})['then'](function(){return _0x2cb0f5;});}else{return _0x2cb0f5;}})[_0xdf3c('0x28')](function(_0x3f43a0){logger[_0xdf3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f43a0);throw _0x3f43a0;});}return _0x2cb0f5;})[_0xdf3c('0x1e')](respondWithResult(_0x4be79a,0xc9))[_0xdf3c('0x28')](handleError(_0x4be79a,null));};exports[_0xdf3c('0x32')]=function(_0x51e8c6,_0x591936,_0x233718){var _0x4e3517;return db[_0xdf3c('0x4a')]['find']({'where':{'id':_0x51e8c6[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x591936,null))[_0xdf3c('0x1e')](saveUpdates(_0x51e8c6[_0xdf3c('0x55')],null))['then'](function(_0x5148f6){if(_0x5148f6){_0x4e3517=_0x5148f6;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});}})[_0xdf3c('0x1e')](function(_0x12a7b0){if(_0x12a7b0){var _0x39d9f0=fs[_0xdf3c('0x5c')](path['join'](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x9c761a=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/registry.ejs'),_0xdf3c('0x61'));var _0x5c27cc=ejs[_0xdf3c('0x64')](_0x39d9f0,{'trunks':_0x12a7b0||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x5c27cc);var _0x53b0c3=ejs['render'](_0x9c761a,{'trunks':_0x12a7b0||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x53b0c3);return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x32'),{'module':_0xdf3c('0x67')});}return null;})[_0xdf3c('0x1e')](function(_0x5c8e5e){if(_0x5c8e5e){return _0x4e3517;}})[_0xdf3c('0x1e')](respondWithResult(_0x591936,null))['catch'](handleError(_0x591936,null));};exports[_0xdf3c('0x35')]=function(_0x389708,_0x2e5f82,_0x15a057){var _0x320452;return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')]({'where':{'id':_0x389708[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x2e5f82,null))[_0xdf3c('0x1e')](removeEntity(_0x2e5f82,null))[_0xdf3c('0x1e')](function(){return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x55fd73){var _0x118ab5=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x1c8fe4=fs['readFileSync'](path['join'](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x1aaf8b=ejs[_0xdf3c('0x64')](_0x118ab5,{'trunks':_0x55fd73});var _0x56fc77=ejs[_0xdf3c('0x64')](_0x1c8fe4,{'trunks':_0x55fd73});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x1aaf8b);fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x56fc77);return respondWithRpcPromise(_0xdf3c('0x66'),'destroy',{'module':_0xdf3c('0x67')});})[_0xdf3c('0x28')](handleError(_0x2e5f82,null));}; \ No newline at end of file +var _0xf2ca=['omit','createdAt','body','updatedAt','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','get','Trunks','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','Trunk','find','clone'];(function(_0x81b09f,_0x59649c){var _0x18d42d=function(_0x231339){while(--_0x231339){_0x81b09f['push'](_0x81b09f['shift']());}};_0x18d42d(++_0x59649c);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x5341ff,_0x1de6df){_0x5341ff=_0x5341ff-0x0;var _0x53be58=_0xf2ca[_0x5341ff];return _0x53be58;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];var jayson=require(_0xaf2c('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15ccb4,_0x8eaf9b,_0x935959,_0x18a8a5){return new BPromise(function(_0x293ca6,_0x152c73){var _0x214f47=_0x18a8a5||client;return _0x214f47[_0xaf2c('0x19')](_0x15ccb4,_0x935959)[_0xaf2c('0x1a')](function(_0x1d0633){logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,_0xaf2c('0x1d'));logger[_0xaf2c('0x1e')](_0xaf2c('0x1f'),_0x8eaf9b,'request\x20sent',JSON[_0xaf2c('0x20')](_0x1d0633));if(_0x1d0633['error']){if(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x22')]===0x1f4){logger[_0xaf2c('0x21')]('Trunk,\x20%s,\x20%s',_0x8eaf9b,_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);return _0x152c73(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}logger[_0xaf2c('0x21')](_0xaf2c('0x1c'),_0x8eaf9b,_0x1d0633['error'][_0xaf2c('0x23')]);return _0x293ca6(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}else{logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,'request\x20sent');_0x293ca6(_0x1d0633[_0xaf2c('0x24')][_0xaf2c('0x23')]);}})[_0xaf2c('0x25')](function(_0x4be6ed){logger['error'](_0xaf2c('0x1c'),_0x8eaf9b,_0x4be6ed);_0x152c73(_0x4be6ed);});});}function respondWithStatusCode(_0x303546,_0x1cafad){_0x1cafad=_0x1cafad||0xcc;return function(_0x99f78d){if(_0x99f78d){return _0x303546['sendStatus'](_0x1cafad);}return _0x303546[_0xaf2c('0x26')](_0x1cafad)[_0xaf2c('0x27')]();};}function respondWithResult(_0x3a0145,_0x3c1ae6){_0x3c1ae6=_0x3c1ae6||0xc8;return function(_0xe929b5){if(_0xe929b5){return _0x3a0145[_0xaf2c('0x26')](_0x3c1ae6)[_0xaf2c('0x28')](_0xe929b5);}};}function respondWithFilteredResult(_0x4a8dd8,_0x29f8b0){return function(_0x2051be){if(_0x2051be){var _0x36f37c=typeof _0x29f8b0[_0xaf2c('0x29')]==='undefined'&&typeof _0x29f8b0[_0xaf2c('0x2a')]==='undefined';var _0x38db1b=_0x2051be[_0xaf2c('0x2b')];var _0x15466b=_0x36f37c?0x0:_0x29f8b0['offset'];var _0x2747bb=_0x36f37c?_0x2051be[_0xaf2c('0x2b')]:_0x29f8b0[_0xaf2c('0x29')]+_0x29f8b0['limit'];var _0xe18ba7;if(_0x2747bb>=_0x38db1b){_0x2747bb=_0x38db1b;_0xe18ba7=0xc8;}else{_0xe18ba7=0xce;}_0x4a8dd8[_0xaf2c('0x26')](_0xe18ba7);return _0x4a8dd8[_0xaf2c('0x2c')](_0xaf2c('0x2d'),_0x15466b+'-'+_0x2747bb+'/'+_0x38db1b)['json'](_0x2051be);}return null;};}function patchUpdates(_0x3da072){return function(_0x4072ff){try{jsonpatch[_0xaf2c('0x2e')](_0x4072ff,_0x3da072,!![]);}catch(_0x51a49c){return BPromise['reject'](_0x51a49c);}return _0x4072ff[_0xaf2c('0x2f')]();};}function saveUpdates(_0x4c9b4f,_0x39c0ed){return function(_0x5e7247){if(_0x5e7247){return _0x5e7247[_0xaf2c('0x30')](_0x4c9b4f)[_0xaf2c('0x1a')](function(_0x4ffbb9){return _0x4ffbb9;});}return null;};}function removeEntity(_0x1408e3,_0x5403f8){return function(_0x54db57){if(_0x54db57){return _0x54db57[_0xaf2c('0x31')]()[_0xaf2c('0x1a')](function(){var _0x211a69=_0x54db57[_0xaf2c('0x32')]({'plain':!![]});var _0x2d6ed7=_0xaf2c('0x33');return db['UserProfileResource'][_0xaf2c('0x31')]({'where':{'type':_0x2d6ed7,'resourceId':_0x211a69['id']}})['then'](function(){return _0x54db57;});})[_0xaf2c('0x1a')](function(){_0x1408e3['status'](0xcc)[_0xaf2c('0x27')]();});}};}function handleEntityNotFound(_0x59f686,_0x2f3d16){return function(_0x4e877e){if(!_0x4e877e){_0x59f686[_0xaf2c('0x34')](0x194);}return _0x4e877e;};}function handleError(_0x4b9c6b,_0x30fd87){_0x30fd87=_0x30fd87||0x1f4;return function(_0x356402){logger[_0xaf2c('0x21')](_0x356402[_0xaf2c('0x35')]);if(_0x356402[_0xaf2c('0x36')]){delete _0x356402['name'];}_0x4b9c6b['status'](_0x30fd87)[_0xaf2c('0x37')](_0x356402);};}exports[_0xaf2c('0x38')]=function(_0x409700,_0xa44813){var _0x4eeecf={},_0x316238={},_0x573db3={'count':0x0,'rows':[]};var _0xa1248e=_[_0xaf2c('0x39')](db['Trunk'][_0xaf2c('0x3a')],function(_0x24668d){return{'name':_0x24668d[_0xaf2c('0x3b')],'type':_0x24668d[_0xaf2c('0x3c')][_0xaf2c('0x3d')]};});_0x316238[_0xaf2c('0x3e')]=_[_0xaf2c('0x39')](_0xa1248e,_0xaf2c('0x36'));_0x316238[_0xaf2c('0x3f')]=_[_0xaf2c('0x40')](_0x409700[_0xaf2c('0x3f')]);_0x316238[_0xaf2c('0x41')]=_[_0xaf2c('0x42')](_0x316238['model'],_0x316238['query']);_0x4eeecf['attributes']=_[_0xaf2c('0x42')](_0x316238[_0xaf2c('0x3e')],qs[_0xaf2c('0x43')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x4eeecf[_0xaf2c('0x44')]=_0x4eeecf['attributes'][_0xaf2c('0x45')]?_0x4eeecf[_0xaf2c('0x44')]:_0x316238[_0xaf2c('0x3e')];if(!_0x409700['query']['hasOwnProperty'](_0xaf2c('0x46'))){_0x4eeecf['limit']=qs[_0xaf2c('0x2a')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x2a')]);_0x4eeecf[_0xaf2c('0x29')]=qs['offset'](_0x409700[_0xaf2c('0x3f')]['offset']);}_0x4eeecf[_0xaf2c('0x47')]=qs[_0xaf2c('0x48')](_0x409700['query'][_0xaf2c('0x48')]);_0x4eeecf['where']=qs[_0xaf2c('0x41')](_[_0xaf2c('0x49')](_0x409700[_0xaf2c('0x3f')],_0x316238[_0xaf2c('0x41')]),_0xa1248e);if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]){_0x4eeecf[_0xaf2c('0x4b')]=_[_0xaf2c('0x4c')](_0x4eeecf[_0xaf2c('0x4b')],{'$or':_['map'](_0xa1248e,function(_0x51d751){if(_0x51d751[_0xaf2c('0x3c')]!=='VIRTUAL'){var _0x4ad36e={};_0x4ad36e[_0x51d751['name']]={'$like':'%'+_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]+'%'};return _0x4ad36e;}})});}_0x4eeecf=_[_0xaf2c('0x4c')]({},_0x4eeecf,_0x409700[_0xaf2c('0x4d')]);var _0x599b2d={'where':_0x4eeecf[_0xaf2c('0x4b')]};return db['Trunk'][_0xaf2c('0x2b')](_0x599b2d)['then'](function(_0x166c26){_0x573db3[_0xaf2c('0x2b')]=_0x166c26;if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x4eeecf[_0xaf2c('0x4f')]=[{'all':!![]}];}return db['Trunk'][_0xaf2c('0x50')](_0x4eeecf);})[_0xaf2c('0x1a')](function(_0x4b3ca4){_0x573db3['rows']=_0x4b3ca4;return _0x573db3;})[_0xaf2c('0x1a')](respondWithFilteredResult(_0xa44813,_0x4eeecf))['catch'](handleError(_0xa44813,null));};exports[_0xaf2c('0x51')]=function(_0x23642b,_0x17b9ec){var _0x315b9f={'raw':![],'where':{'id':_0x23642b[_0xaf2c('0x52')]['id']}},_0x367112={};_0x367112[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x367112[_0xaf2c('0x3f')]=_['keys'](_0x23642b[_0xaf2c('0x3f')]);_0x367112[_0xaf2c('0x41')]=_['intersection'](_0x367112['model'],_0x367112['query']);_0x315b9f[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x367112['model'],qs[_0xaf2c('0x43')](_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x315b9f[_0xaf2c('0x44')]=_0x315b9f[_0xaf2c('0x44')][_0xaf2c('0x45')]?_0x315b9f[_0xaf2c('0x44')]:_0x367112['model'];if(_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x315b9f['include']=[{'all':!![]}];}_0x315b9f=_[_0xaf2c('0x4c')]({},_0x315b9f,_0x23642b[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x315b9f)[_0xaf2c('0x1a')](handleEntityNotFound(_0x17b9ec,null))[_0xaf2c('0x1a')](respondWithResult(_0x17b9ec,null))[_0xaf2c('0x25')](handleError(_0x17b9ec,null));};exports[_0xaf2c('0x55')]=function(_0x19b82d,_0x300254){var _0x133678={'where':{'id':_0x19b82d[_0xaf2c('0x52')]['id']}},_0x10a270={};_0x10a270[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x133678[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x10a270[_0xaf2c('0x3e')],qs['fields'](_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x133678[_0xaf2c('0x44')]=_0x133678['attributes'][_0xaf2c('0x45')]?_0x133678['attributes']:_0x10a270[_0xaf2c('0x3e')];if(_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x133678[_0xaf2c('0x4f')]=[{'all':!![]}];}_0x133678=_[_0xaf2c('0x4c')]({},_0x133678,_0x19b82d[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x133678)[_0xaf2c('0x1a')](handleEntityNotFound(_0x300254,null))['then'](function(_0x41d08b){if(_0x41d08b){var _0x400dcd=_0x41d08b[_0xaf2c('0x32')]({'plain':!![]});_0x400dcd=qs[_0xaf2c('0x56')](_0x400dcd,['id',_0xaf2c('0x57'),'updatedAt']);_0x19b82d[_0xaf2c('0x58')]=_[_0xaf2c('0x56')](_0x19b82d['body'],['id',_0xaf2c('0x57'),_0xaf2c('0x59')]);return db['Trunk']['create'](_[_0xaf2c('0x4c')](_0x400dcd,_0x19b82d[_0xaf2c('0x58')]),{'include':_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x36b6f0){var _0x3f48f1=_0x19b82d['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3f48f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f48f1[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x16e9f4=_0x36b6f0[_0xaf2c('0x32')]({'plain':!![]});var _0x1a297e=_0xaf2c('0x33');return db[_0xaf2c('0x5c')][_0xaf2c('0x54')]({'where':{'name':_0x1a297e,'userProfileId':_0x3f48f1[_0xaf2c('0x5d')]},'raw':!![]})[_0xaf2c('0x1a')](function(_0x53ba41){if(_0x53ba41&&_0x53ba41[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')][_0xaf2c('0x60')]({'name':_0x16e9f4[_0xaf2c('0x36')],'resourceId':_0x16e9f4['id'],'type':_0x53ba41[_0xaf2c('0x36')],'sectionId':_0x53ba41['id']},{})['then'](function(){return _0x36b6f0;});}else{return _0x36b6f0;}})[_0xaf2c('0x25')](function(_0x28b09f){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x28b09f);throw _0x28b09f;});}return _0x36b6f0;});}})[_0xaf2c('0x1a')](respondWithResult(_0x300254,0xc9))['catch'](handleError(_0x300254,null));};exports['create']=function(_0x1166c9,_0x1ead61,_0x5849f8){var _0xf96361;return db[_0xaf2c('0x53')][_0xaf2c('0x60')](_0x1166c9['body'],{'raw':!![]})[_0xaf2c('0x1a')](function(_0x2bd845){_0xf96361=_0x2bd845;return db[_0xaf2c('0x53')][_0xaf2c('0x50')]({'raw':!![]});})['then'](function(_0x32d552){var _0x26129c=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2767c7=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x5d965c=ejs[_0xaf2c('0x67')](_0x26129c,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5d965c);if(_0xf96361[_0xaf2c('0x69')]){var _0x5a95ac=ejs['render'](_0x2767c7,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6a'),_0x5a95ac);}})[_0xaf2c('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xaf2c('0x1a')](function(){var _0x3e972c=_0x1166c9['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3e972c)throw new Error(_0xaf2c('0x6b'));if(_0x3e972c[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x6e1837=_0xf96361[_0xaf2c('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xaf2c('0x54')]({'where':{'name':_0xaf2c('0x33'),'userProfileId':_0x3e972c[_0xaf2c('0x5d')]},'raw':!![]})['then'](function(_0xc9dd21){if(_0xc9dd21&&_0xc9dd21[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')]['create']({'name':_0x6e1837[_0xaf2c('0x36')],'resourceId':_0x6e1837['id'],'type':_0xc9dd21[_0xaf2c('0x36')],'sectionId':_0xc9dd21['id']},{})[_0xaf2c('0x1a')](function(){return _0xf96361;});}else{return _0xf96361;}})[_0xaf2c('0x25')](function(_0x491160){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x491160);throw _0x491160;});}return _0xf96361;})[_0xaf2c('0x1a')](respondWithResult(_0x1ead61,0xc9))['catch'](handleError(_0x1ead61,null));};exports['update']=function(_0x427ece,_0x1b7dc1,_0x5571eb){var _0x3675d9;return db[_0xaf2c('0x53')]['find']({'where':{'id':_0x427ece[_0xaf2c('0x52')]['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1b7dc1,null))[_0xaf2c('0x1a')](saveUpdates(_0x427ece[_0xaf2c('0x58')],null))[_0xaf2c('0x1a')](function(_0x4af252){if(_0x4af252){_0x3675d9=_0x4af252;return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});}})[_0xaf2c('0x1a')](function(_0x55b568){if(_0x55b568){var _0x4f378e=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x4b9fdc=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x6c')),_0xaf2c('0x66'));var _0x41c707=ejs['render'](_0x4f378e,{'trunks':_0x55b568||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x41c707);var _0x483774=ejs['render'](_0x4b9fdc,{'trunks':_0x55b568||[]});fs['writeFileSync'](_0xaf2c('0x6a'),_0x483774);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x30'),{'module':_0xaf2c('0x6f')});}return null;})['then'](function(_0x19fbd5){if(_0x19fbd5){return _0x3675d9;}})[_0xaf2c('0x1a')](respondWithResult(_0x1b7dc1,null))[_0xaf2c('0x25')](handleError(_0x1b7dc1,null));};exports[_0xaf2c('0x31')]=function(_0x4ddf95,_0x1e8fc0,_0x23aeac){var _0x41590;return db[_0xaf2c('0x53')][_0xaf2c('0x54')]({'where':{'id':_0x4ddf95['params']['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1e8fc0,null))[_0xaf2c('0x1a')](removeEntity(_0x1e8fc0,null))['then'](function(){return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});})[_0xaf2c('0x1a')](function(_0x5bce65){var _0x1e6a12=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2a3cb4=fs[_0xaf2c('0x62')](path['join'](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x7724cc=ejs['render'](_0x1e6a12,{'trunks':_0x5bce65});var _0x4a9ea8=ejs[_0xaf2c('0x67')](_0x2a3cb4,{'trunks':_0x5bce65});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x7724cc);fs['writeFileSync'](_0xaf2c('0x6a'),_0x4a9ea8);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x1e8fc0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 202b5ec..8842a2e 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 _0x91e0=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','util','api','bluebird'];(function(_0x60c95d,_0x5474c7){var _0x482950=function(_0x36068a){while(--_0x36068a){_0x60c95d['push'](_0x60c95d['shift']());}};_0x482950(++_0x5474c7);}(_0x91e0,0x68));var _0x091e=function(_0x34dab7,_0xc4d698){_0x34dab7=_0x34dab7-0x0;var _0x39f93f=_0x91e0[_0x34dab7];return _0x39f93f;};'use strict';var _=require(_0x091e('0x0'));var util=require(_0x091e('0x1'));var logger=require('../../config/logger')(_0x091e('0x2'));var moment=require('moment');var BPromise=require(_0x091e('0x3'));var rp=require(_0x091e('0x4'));var fs=require('fs');var path=require(_0x091e('0x5'));var rimraf=require(_0x091e('0x6'));var config=require(_0x091e('0x7'));var attributes=require(_0x091e('0x8'));module[_0x091e('0x9')]=function(_0x169a03,_0x1b55a4){return _0x169a03[_0x091e('0xa')](_0x091e('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35aa=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','define','util','../../config/logger'];(function(_0x3b7ce9,_0x1f9066){var _0x23d0ba=function(_0x502701){while(--_0x502701){_0x3b7ce9['push'](_0x3b7ce9['shift']());}};_0x23d0ba(++_0x1f9066);}(_0x35aa,0xda));var _0xa35a=function(_0x5b162b,_0x6a91fe){_0x5b162b=_0x5b162b-0x0;var _0x2f2cbe=_0x35aa[_0x5b162b];return _0x2f2cbe;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var logger=require(_0xa35a('0x1'))(_0xa35a('0x2'));var moment=require(_0xa35a('0x3'));var BPromise=require(_0xa35a('0x4'));var rp=require(_0xa35a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var attributes=require(_0xa35a('0x8'));module['exports']=function(_0x253e6a,_0xf92926){return _0x253e6a[_0xa35a('0x9')]('Trunk',attributes,{'tableName':'tools_trunks','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 ced1716..c96e689 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 _0xb6f0=['debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','attributes','include','map','model','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s'];(function(_0x2285be,_0x39728b){var _0x59ce16=function(_0x24abea){while(--_0x24abea){_0x2285be['push'](_0x2285be['shift']());}};_0x59ce16(++_0x39728b);}(_0xb6f0,0xc2));var _0x0b6f=function(_0x1c4951,_0x2038ee){_0x1c4951=_0x1c4951-0x0;var _0x345e1b=_0xb6f0[_0x1c4951];return _0x345e1b;};'use strict';var _=require(_0x0b6f('0x0'));var util=require(_0x0b6f('0x1'));var moment=require(_0x0b6f('0x2'));var BPromise=require(_0x0b6f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b6f('0x4'));var db=require(_0x0b6f('0x5'))['db'];var utils=require(_0x0b6f('0x6'));var logger=require(_0x0b6f('0x7'))('rpc');var config=require(_0x0b6f('0x8'));var jayson=require(_0x0b6f('0x9'));var client=jayson[_0x0b6f('0xa')][_0x0b6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2db134,_0x690bcc,_0x41c1ba){return new BPromise(function(_0xf3f869,_0x4f2df8){return client[_0x0b6f('0xc')](_0x2db134,_0x41c1ba)[_0x0b6f('0xd')](function(_0x4a3841){logger[_0x0b6f('0xe')](_0x0b6f('0xf'),_0x690bcc,'request\x20sent');logger[_0x0b6f('0x10')](_0x0b6f('0x11'),_0x690bcc,_0x0b6f('0x12'),JSON[_0x0b6f('0x13')](_0x4a3841));if(_0x4a3841[_0x0b6f('0x14')]){if(_0x4a3841[_0x0b6f('0x14')][_0x0b6f('0x15')]===0x1f4){logger[_0x0b6f('0x14')](_0x0b6f('0xf'),_0x690bcc,_0x4a3841['error'][_0x0b6f('0x16')]);return _0x4f2df8(_0x4a3841[_0x0b6f('0x14')]['message']);}logger[_0x0b6f('0x14')](_0x0b6f('0xf'),_0x690bcc,_0x4a3841[_0x0b6f('0x14')][_0x0b6f('0x16')]);return _0xf3f869(_0x4a3841[_0x0b6f('0x14')][_0x0b6f('0x16')]);}else{logger[_0x0b6f('0xe')](_0x0b6f('0xf'),_0x690bcc,_0x0b6f('0x12'));_0xf3f869(_0x4a3841[_0x0b6f('0x17')][_0x0b6f('0x16')]);}})[_0x0b6f('0x18')](function(_0x44aad8){logger[_0x0b6f('0x14')](_0x0b6f('0xf'),_0x690bcc,_0x44aad8);_0x4f2df8(_0x44aad8);});});}exports[_0x0b6f('0x19')]=function(_0x4bb043){var _0x13dfce=this;return new Promise(function(_0x3c84d9,_0x6c9b6d){return db[_0x0b6f('0x1a')][_0x0b6f('0x1b')]({'raw':_0x4bb043[_0x0b6f('0x1c')]?_0x4bb043['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bb043[_0x0b6f('0x1c')]?_0x4bb043[_0x0b6f('0x1c')]['where']||null:null,'attributes':_0x4bb043[_0x0b6f('0x1c')]?_0x4bb043[_0x0b6f('0x1c')][_0x0b6f('0x1d')]||null:null,'limit':_0x4bb043[_0x0b6f('0x1c')]?_0x4bb043['options']['limit']||null:null,'include':_0x4bb043[_0x0b6f('0x1c')]?_0x4bb043[_0x0b6f('0x1c')][_0x0b6f('0x1e')]?_[_0x0b6f('0x1f')](_0x4bb043[_0x0b6f('0x1c')][_0x0b6f('0x1e')],function(_0x575fbf){return{'model':db[_0x575fbf[_0x0b6f('0x20')]],'as':_0x575fbf['as'],'attributes':_0x575fbf[_0x0b6f('0x1d')],'include':_0x575fbf[_0x0b6f('0x1e')]?_[_0x0b6f('0x1f')](_0x575fbf[_0x0b6f('0x1e')],function(_0x10d811){return{'model':db[_0x10d811[_0x0b6f('0x20')]],'as':_0x10d811['as'],'attributes':_0x10d811[_0x0b6f('0x1d')],'include':_0x10d811[_0x0b6f('0x1e')]?_[_0x0b6f('0x1f')](_0x10d811[_0x0b6f('0x1e')],function(_0x32e62b){return{'model':db[_0x32e62b[_0x0b6f('0x20')]],'as':_0x32e62b['as'],'attributes':_0x32e62b[_0x0b6f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0b6f('0xd')](function(_0x8a1f2c){logger[_0x0b6f('0xe')](_0x0b6f('0x19'),_0x4bb043);logger['debug'](_0x0b6f('0x19'),_0x4bb043,JSON[_0x0b6f('0x13')](_0x8a1f2c));_0x3c84d9(_0x8a1f2c);})[_0x0b6f('0x18')](function(_0x2dc00e){logger[_0x0b6f('0x14')]('GetTrunk',_0x2dc00e[_0x0b6f('0x16')],_0x4bb043);_0x6c9b6d(_0x13dfce[_0x0b6f('0x14')](0x1f4,_0x2dc00e[_0x0b6f('0x16')]));});});};exports['ShowTrunk']=function(_0x18e849){var _0x276dd6=this;return new Promise(function(_0xcaf23f,_0x21ef99){return db[_0x0b6f('0x1a')][_0x0b6f('0x21')]({'raw':_0x18e849[_0x0b6f('0x1c')]?_0x18e849[_0x0b6f('0x1c')][_0x0b6f('0x22')]===undefined?!![]:![]:!![],'where':_0x18e849[_0x0b6f('0x1c')]?_0x18e849[_0x0b6f('0x1c')]['where']||null:null,'attributes':_0x18e849['options']?_0x18e849[_0x0b6f('0x1c')]['attributes']||null:null,'include':_0x18e849[_0x0b6f('0x1c')]?_0x18e849['options'][_0x0b6f('0x1e')]?_['map'](_0x18e849[_0x0b6f('0x1c')][_0x0b6f('0x1e')],function(_0x24c0dd){return{'model':db[_0x24c0dd[_0x0b6f('0x20')]],'as':_0x24c0dd['as'],'attributes':_0x24c0dd[_0x0b6f('0x1d')],'include':_0x24c0dd[_0x0b6f('0x1e')]?_[_0x0b6f('0x1f')](_0x24c0dd[_0x0b6f('0x1e')],function(_0x44d662){return{'model':db[_0x44d662[_0x0b6f('0x20')]],'as':_0x44d662['as'],'attributes':_0x44d662[_0x0b6f('0x1d')],'include':_0x44d662[_0x0b6f('0x1e')]?_[_0x0b6f('0x1f')](_0x44d662[_0x0b6f('0x1e')],function(_0x343a4f){return{'model':db[_0x343a4f[_0x0b6f('0x20')]],'as':_0x343a4f['as'],'attributes':_0x343a4f[_0x0b6f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xad3be7){logger['info']('ShowTrunk',_0x18e849);logger[_0x0b6f('0x10')]('ShowTrunk',_0x18e849,JSON['stringify'](_0xad3be7));_0xcaf23f(_0xad3be7);})['catch'](function(_0x1afacc){logger[_0x0b6f('0x14')]('ShowTrunk',_0x1afacc[_0x0b6f('0x16')],_0x18e849);_0x21ef99(_0x276dd6[_0x0b6f('0x14')](0x1f4,_0x1afacc[_0x0b6f('0x16')]));});});}; \ No newline at end of file +var _0x3b75=['where','limit','include','map','model','attributes','GetTrunk','stringify','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','Trunk','findAll','options','raw'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3b75,0x144));var _0x53b7=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x3b75[_0x574ce3];return _0x3447a0;};'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(_0x53b7('0x5'));var db=require(_0x53b7('0x6'))['db'];var utils=require(_0x53b7('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x53b7('0x8'));var jayson=require(_0x53b7('0x9'));var client=jayson[_0x53b7('0xa')][_0x53b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e87d4,_0x4dd362,_0x13d9c7){return new BPromise(function(_0x42a770,_0x3eccbf){return client[_0x53b7('0xc')](_0x4e87d4,_0x13d9c7)[_0x53b7('0xd')](function(_0x4838a1){logger[_0x53b7('0xe')](_0x53b7('0xf'),_0x4dd362,_0x53b7('0x10'));logger[_0x53b7('0x11')](_0x53b7('0x12'),_0x4dd362,_0x53b7('0x10'),JSON['stringify'](_0x4838a1));if(_0x4838a1['error']){if(_0x4838a1[_0x53b7('0x13')]['code']===0x1f4){logger[_0x53b7('0x13')]('Trunk,\x20%s,\x20%s',_0x4dd362,_0x4838a1[_0x53b7('0x13')][_0x53b7('0x14')]);return _0x3eccbf(_0x4838a1[_0x53b7('0x13')]['message']);}logger[_0x53b7('0x13')](_0x53b7('0xf'),_0x4dd362,_0x4838a1['error']['message']);return _0x42a770(_0x4838a1[_0x53b7('0x13')][_0x53b7('0x14')]);}else{logger[_0x53b7('0xe')](_0x53b7('0xf'),_0x4dd362,_0x53b7('0x10'));_0x42a770(_0x4838a1['result'][_0x53b7('0x14')]);}})[_0x53b7('0x15')](function(_0x23bc46){logger[_0x53b7('0x13')](_0x53b7('0xf'),_0x4dd362,_0x23bc46);_0x3eccbf(_0x23bc46);});});}exports['GetTrunk']=function(_0x14f30f){var _0x47da7c=this;return new Promise(function(_0x5de2f6,_0x59734e){return db[_0x53b7('0x16')][_0x53b7('0x17')]({'raw':_0x14f30f[_0x53b7('0x18')]?_0x14f30f[_0x53b7('0x18')][_0x53b7('0x19')]===undefined?!![]:![]:!![],'where':_0x14f30f[_0x53b7('0x18')]?_0x14f30f[_0x53b7('0x18')][_0x53b7('0x1a')]||null:null,'attributes':_0x14f30f[_0x53b7('0x18')]?_0x14f30f[_0x53b7('0x18')]['attributes']||null:null,'limit':_0x14f30f[_0x53b7('0x18')]?_0x14f30f[_0x53b7('0x18')][_0x53b7('0x1b')]||null:null,'include':_0x14f30f[_0x53b7('0x18')]?_0x14f30f[_0x53b7('0x18')][_0x53b7('0x1c')]?_[_0x53b7('0x1d')](_0x14f30f[_0x53b7('0x18')][_0x53b7('0x1c')],function(_0x42063f){return{'model':db[_0x42063f[_0x53b7('0x1e')]],'as':_0x42063f['as'],'attributes':_0x42063f[_0x53b7('0x1f')],'include':_0x42063f['include']?_['map'](_0x42063f[_0x53b7('0x1c')],function(_0x3e70d8){return{'model':db[_0x3e70d8[_0x53b7('0x1e')]],'as':_0x3e70d8['as'],'attributes':_0x3e70d8[_0x53b7('0x1f')],'include':_0x3e70d8[_0x53b7('0x1c')]?_[_0x53b7('0x1d')](_0x3e70d8[_0x53b7('0x1c')],function(_0x10bede){return{'model':db[_0x10bede[_0x53b7('0x1e')]],'as':_0x10bede['as'],'attributes':_0x10bede['attributes']};}):[]};}):[]};}):[]:[]})[_0x53b7('0xd')](function(_0x8aa6a9){logger['info'](_0x53b7('0x20'),_0x14f30f);logger['debug'](_0x53b7('0x20'),_0x14f30f,JSON[_0x53b7('0x21')](_0x8aa6a9));_0x5de2f6(_0x8aa6a9);})[_0x53b7('0x15')](function(_0x13f5f6){logger['error'](_0x53b7('0x20'),_0x13f5f6[_0x53b7('0x14')],_0x14f30f);_0x59734e(_0x47da7c[_0x53b7('0x13')](0x1f4,_0x13f5f6['message']));});});};exports['ShowTrunk']=function(_0x23fd28){var _0xae77f6=this;return new Promise(function(_0x82dca,_0x560207){return db[_0x53b7('0x16')]['find']({'raw':_0x23fd28['options']?_0x23fd28[_0x53b7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23fd28[_0x53b7('0x18')]?_0x23fd28[_0x53b7('0x18')]['where']||null:null,'attributes':_0x23fd28[_0x53b7('0x18')]?_0x23fd28['options']['attributes']||null:null,'include':_0x23fd28[_0x53b7('0x18')]?_0x23fd28[_0x53b7('0x18')][_0x53b7('0x1c')]?_[_0x53b7('0x1d')](_0x23fd28['options'][_0x53b7('0x1c')],function(_0xf2fe8c){return{'model':db[_0xf2fe8c[_0x53b7('0x1e')]],'as':_0xf2fe8c['as'],'attributes':_0xf2fe8c[_0x53b7('0x1f')],'include':_0xf2fe8c[_0x53b7('0x1c')]?_[_0x53b7('0x1d')](_0xf2fe8c['include'],function(_0x397a85){return{'model':db[_0x397a85[_0x53b7('0x1e')]],'as':_0x397a85['as'],'attributes':_0x397a85['attributes'],'include':_0x397a85[_0x53b7('0x1c')]?_[_0x53b7('0x1d')](_0x397a85[_0x53b7('0x1c')],function(_0x3118c9){return{'model':db[_0x3118c9[_0x53b7('0x1e')]],'as':_0x3118c9['as'],'attributes':_0x3118c9[_0x53b7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dbc19){logger['info'](_0x53b7('0x22'),_0x23fd28);logger[_0x53b7('0x11')](_0x53b7('0x22'),_0x23fd28,JSON[_0x53b7('0x21')](_0x5dbc19));_0x82dca(_0x5dbc19);})[_0x53b7('0x15')](function(_0x5cdf32){logger['error']('ShowTrunk',_0x5cdf32[_0x53b7('0x14')],_0x23fd28);_0x560207(_0xae77f6[_0x53b7('0x13')](0x1f4,_0x5cdf32[_0x53b7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index d1a0ca1..5b35697 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 _0x9c78=['exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x9c78,0xac));var _0x89c7=function(_0x18c9dc,_0x22ca4d){_0x18c9dc=_0x18c9dc-0x0;var _0x2ce3c0=_0x9c78[_0x18c9dc];return _0x2ce3c0;};'use strict';var express=require(_0x89c7('0x0'));var router=express[_0x89c7('0x1')]();var auth=require(_0x89c7('0x2'));var controller=require(_0x89c7('0x3'));router[_0x89c7('0x4')](_0x89c7('0x5'),auth[_0x89c7('0x6')](),controller[_0x89c7('0x7')]);module[_0x89c7('0x8')]=router; \ No newline at end of file +var _0xf5c8=['update','express','Router','../../components/auth/service','./user-setting.controller','put','isAuthenticated'];(function(_0x134c70,_0x431800){var _0x4f7e39=function(_0x5f3a8b){while(--_0x5f3a8b){_0x134c70['push'](_0x134c70['shift']());}};_0x4f7e39(++_0x431800);}(_0xf5c8,0x127));var _0x8f5c=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xf5c8[_0x510b98];return _0x45e775;};'use strict';var express=require(_0x8f5c('0x0'));var router=express[_0x8f5c('0x1')]();var auth=require(_0x8f5c('0x2'));var controller=require(_0x8f5c('0x3'));router[_0x8f5c('0x4')]('/:id',auth[_0x8f5c('0x5')](),controller[_0x8f5c('0x6')]);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 35d4f95..20c48ce 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 _0x0fed=['exports','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','info'];(function(_0x33ee4d,_0x14c274){var _0x1a2de6=function(_0xda37){while(--_0xda37){_0x33ee4d['push'](_0x33ee4d['shift']());}};_0x1a2de6(++_0x14c274);}(_0x0fed,0xad));var _0xd0fe=function(_0x29dd82,_0x3f45c3){_0x29dd82=_0x29dd82-0x0;var _0x272a06=_0x0fed[_0x29dd82];return _0x272a06;};'use strict';var Sequelize=require(_0xd0fe('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xd0fe('0x1'),'warning',_0xd0fe('0x2'),'debug'];module[_0xd0fe('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd0fe('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd0fe('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd0fe('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd0fe('0x6')],'unique':_0xd0fe('0x7')}}; \ No newline at end of file +var _0xe750=['DATE','UserId','error','warning','info','exports','BOOLEAN','TEXT'];(function(_0x95d45,_0x4bb3f1){var _0x38086f=function(_0x344b59){while(--_0x344b59){_0x95d45['push'](_0x95d45['shift']());}};_0x38086f(++_0x4bb3f1);}(_0xe750,0x18a));var _0x0e75=function(_0x390915,_0x4cc6a0){_0x390915=_0x390915-0x0;var _0x1c7d8d=_0xe750[_0x390915];return _0x1c7d8d;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x0e75('0x0'),_0x0e75('0x1'),_0x0e75('0x2'),'debug'];module[_0x0e75('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0e75('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0e75('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x0e75('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0e75('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x0e75('0x7')}}; \ 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 faa6c3f..bb8e2ad 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 _0x7daf=['body','catch','ioredis','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','update','then','sendStatus','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x7daf,0xaa));var _0xf7da=function(_0x20f3a3,_0xe879a){_0x20f3a3=_0x20f3a3-0x0;var _0x4ecd05=_0x7daf[_0x20f3a3];return _0x4ecd05;};'use strict';var _=require('lodash');var Redis=require(_0xf7da('0x0'));var logger=require('../../config/logger')(_0xf7da('0x1'));var config=require(_0xf7da('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0xf7da('0x3'))(new Redis(config[_0xf7da('0x4')]));require(_0xf7da('0x5'))[_0xf7da('0x6')](socket);config[_0xf7da('0x4')]=_['defaults'](config[_0xf7da('0x4')],{'host':_0xf7da('0x7'),'port':0x18eb});function respondWithResult(_0x1b35ec,_0x110cad){_0x110cad=_0x110cad||0xc8;return function(_0x2c70ad){if(_0x2c70ad){return _0x1b35ec[_0xf7da('0x8')](_0x110cad)['json'](_0x2c70ad);}};}function saveUpdates(_0x3f0f80){return function(_0x3e00f1){if(_0x3e00f1){return _0x3e00f1[_0xf7da('0x9')](_0x3f0f80)[_0xf7da('0xa')](function(_0x305873){return _0x305873;});}return null;};}function handleEntityNotFound(_0x4667b6){return function(_0x209f37){if(!_0x209f37){_0x4667b6[_0xf7da('0xb')](0x194);}return _0x209f37;};}function handleError(_0x363233,_0x2ad574){_0x2ad574=_0x2ad574||0x1f4;return function(_0x514c1e){logger['error'](_0x514c1e[_0xf7da('0xc')]);if(_0x514c1e[_0xf7da('0xd')]){delete _0x514c1e[_0xf7da('0xd')];}_0x363233[_0xf7da('0x8')](_0x2ad574)[_0xf7da('0xe')](_0x514c1e);};}exports[_0xf7da('0x9')]=function(_0x5a1357,_0x2f3841){if(_0x5a1357[_0xf7da('0xf')]['role']!==_0xf7da('0x10'))throw new Error(_0xf7da('0x11'));if(isNaN(Number(_0x5a1357[_0xf7da('0x12')]['id'])))throw new Error(_0xf7da('0x13'));return db[_0xf7da('0x14')][_0xf7da('0x15')]({'where':{'id':_0x5a1357['params']['id']}})['then'](handleEntityNotFound(_0x2f3841,null))['then'](saveUpdates(_0x5a1357[_0xf7da('0x16')],null))[_0xf7da('0xa')](respondWithResult(_0x2f3841,null))[_0xf7da('0x17')](handleError(_0x2f3841,null));}; \ No newline at end of file +var _0x84ab=['status','json','then','error','stack','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','redis','register','defaults'];(function(_0x36caf5,_0x6f5e8){var _0x2d907b=function(_0x2a6984){while(--_0x2a6984){_0x36caf5['push'](_0x36caf5['shift']());}};_0x2d907b(++_0x6f5e8);}(_0x84ab,0x12f));var _0xb84a=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x84ab[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0xb84a('0x0'));var Redis=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var config=require(_0xb84a('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0xb84a('0x5'))(new Redis(config[_0xb84a('0x6')]));require('./user-setting.socket')[_0xb84a('0x7')](socket);config[_0xb84a('0x6')]=_[_0xb84a('0x8')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x4dc496,_0xd445b5){_0xd445b5=_0xd445b5||0xc8;return function(_0x4fac4d){if(_0x4fac4d){return _0x4dc496[_0xb84a('0x9')](_0xd445b5)[_0xb84a('0xa')](_0x4fac4d);}};}function saveUpdates(_0x4d9321){return function(_0x181c87){if(_0x181c87){return _0x181c87['update'](_0x4d9321)[_0xb84a('0xb')](function(_0x1886e0){return _0x1886e0;});}return null;};}function handleEntityNotFound(_0x42daf5){return function(_0x5d3b29){if(!_0x5d3b29){_0x42daf5['sendStatus'](0x194);}return _0x5d3b29;};}function handleError(_0x591de9,_0x1e0180){_0x1e0180=_0x1e0180||0x1f4;return function(_0x17379b){logger[_0xb84a('0xc')](_0x17379b[_0xb84a('0xd')]);if(_0x17379b[_0xb84a('0xe')]){delete _0x17379b['name'];}_0x591de9[_0xb84a('0x9')](_0x1e0180)[_0xb84a('0xf')](_0x17379b);};}exports[_0xb84a('0x10')]=function(_0x3c161c,_0x44b26b){if(_0x3c161c[_0xb84a('0x11')][_0xb84a('0x12')]!==_0xb84a('0x13'))throw new Error(_0xb84a('0x14'));if(isNaN(Number(_0x3c161c[_0xb84a('0x15')]['id'])))throw new Error(_0xb84a('0x16'));return db[_0xb84a('0x17')]['find']({'where':{'id':_0x3c161c[_0xb84a('0x15')]['id']}})[_0xb84a('0xb')](handleEntityNotFound(_0x44b26b,null))[_0xb84a('0xb')](saveUpdates(_0x3c161c[_0xb84a('0x18')],null))[_0xb84a('0xb')](respondWithResult(_0x44b26b,null))[_0xb84a('0x19')](handleError(_0x44b26b,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 bc3c352..2d5743c 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 _0x3701=['update','emit','hasOwnProperty','exports','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x560f77,_0x3de47c){var _0x2a05e7=function(_0x1c8e5f){while(--_0x1c8e5f){_0x560f77['push'](_0x560f77['shift']());}};_0x2a05e7(++_0x3de47c);}(_0x3701,0x144));var _0x1370=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3701[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x1370('0x0'));var UserSetting=require(_0x1370('0x1'))['db'][_0x1370('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1370('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1370('0x4'),'afterDestroy':'remove'};function emitEvent(_0x531913){return function(_0x1a595f,_0x12d128,_0x1b33e2){UserSettingEvents[_0x1370('0x5')](_0x531913+':'+_0x1a595f['id'],_0x1a595f);UserSettingEvents[_0x1370('0x5')](_0x531913,_0x1a595f);_0x1b33e2(null);};}for(var e in events){if(events[_0x1370('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x1370('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x2f24=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting'];(function(_0x2bd8a6,_0x5b9211){var _0x1e037a=function(_0x486e4b){while(--_0x486e4b){_0x2bd8a6['push'](_0x2bd8a6['shift']());}};_0x1e037a(++_0x5b9211);}(_0x2f24,0x1dd));var _0x42f2=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2f24[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x42f2('0x0'));var UserSetting=require(_0x42f2('0x1'))['db'][_0x42f2('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x42f2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x42f2('0x4'),'afterDestroy':_0x42f2('0x5')};function emitEvent(_0x495c4e){return function(_0xd21ac5,_0x258c1d,_0x397a80){UserSettingEvents[_0x42f2('0x6')](_0x495c4e+':'+_0xd21ac5['id'],_0xd21ac5);UserSettingEvents[_0x42f2('0x6')](_0x495c4e,_0xd21ac5);_0x397a80(null);};}for(var e in events){if(events[_0x42f2('0x7')](e)){var event=events[e];UserSetting[_0x42f2('0x8')](e,emitEvent(event));}}module[_0x42f2('0x9')]=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 3650a25..f5995bb 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 _0xe0c0=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x2410c1,_0x42f52d){_0x2410c1=_0x2410c1-0x0;var _0x1a4f5a=_0xe0c0[_0x2410c1];return _0x1a4f5a;};'use strict';var attributes=require(_0x0e0c('0x0'));module['exports']=function(_0x22d512){return _0x22d512[_0x0e0c('0x1')](_0x0e0c('0x2'),attributes,{'tableName':_0x0e0c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x491fc7){if(!_0x491fc7[_0x0e0c('0x4')])_0x491fc7[_0x0e0c('0x5')]=null;else if(_0x491fc7[_0x0e0c('0x5')]===null)_0x491fc7['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x2cae=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x2cae,0x16b));var _0xe2ca=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x2cae[_0x422905];return _0x33dc6c;};'use strict';var attributes=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]=function(_0x5d4b71){return _0x5d4b71['define'](_0xe2ca('0x2'),attributes,{'tableName':_0xe2ca('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x482b27){if(!_0x482b27[_0xe2ca('0x4')])_0x482b27[_0xe2ca('0x5')]=null;else if(_0x482b27[_0xe2ca('0x5')]===null)_0x482b27[_0xe2ca('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index cce041d..653028b 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 _0x315d=['register','length','remove','update','emit','user-setting:update','UserId'];(function(_0x3a78aa,_0x1f48cb){var _0x492af6=function(_0x1bdbdd){while(--_0x1bdbdd){_0x3a78aa['push'](_0x3a78aa['shift']());}};_0x492af6(++_0x1f48cb);}(_0x315d,0xb1));var _0xd315=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x315d[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0xd315('0x0'),_0xd315('0x1')];function createListener(_0x3606d7,_0x14a877){return function(_0x5c308e){_0x14a877[_0xd315('0x2')](_0x3606d7,_0x5c308e);if(_0x3606d7===_0xd315('0x3')){_0x14a877[_0xd315('0x2')]('user-setting:update:user-'+_0x5c308e[_0xd315('0x4')],_0x5c308e);}};}exports[_0xd315('0x5')]=function(_0x51b3cc){for(var _0x40354e=0x0,_0x4a5a2f=events[_0xd315('0x6')];_0x40354e<_0x4a5a2f;_0x40354e++){var _0x391ff6=events[_0x40354e];var _0x4754b1=createListener('user-setting:'+_0x391ff6,_0x51b3cc);UserSettingEvents['on'](_0x391ff6,_0x4754b1);}}; \ No newline at end of file +var _0x8f91=['length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','register'];(function(_0x2825ae,_0x47550e){var _0x4601fe=function(_0x5c2346){while(--_0x5c2346){_0x2825ae['push'](_0x2825ae['shift']());}};_0x4601fe(++_0x47550e);}(_0x8f91,0x188));var _0x18f9=function(_0x5cd934,_0x306544){_0x5cd934=_0x5cd934-0x0;var _0x437d94=_0x8f91[_0x5cd934];return _0x437d94;};'use strict';var UserSettingEvents=require(_0x18f9('0x0'));var events=[_0x18f9('0x1'),_0x18f9('0x2'),_0x18f9('0x3')];function createListener(_0x5c2c91,_0x5c2da3){return function(_0x1cee03){_0x5c2da3[_0x18f9('0x4')](_0x5c2c91,_0x1cee03);if(_0x5c2c91===_0x18f9('0x5')){_0x5c2da3[_0x18f9('0x4')](_0x18f9('0x6')+_0x1cee03['UserId'],_0x1cee03);}};}exports[_0x18f9('0x7')]=function(_0x51fcc0){for(var _0xa86b67=0x0,_0x4afe0d=events[_0x18f9('0x8')];_0xa86b67<_0x4afe0d;_0xa86b67++){var _0x43e0b4=events[_0xa86b67];var _0x1a7ceb=createListener(_0x18f9('0x9')+_0x43e0b4,_0x51fcc0);UserSettingEvents['on'](_0x43e0b4,_0x1a7ceb);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index ae836dc..0478239 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 _0x1186=['removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/presence','/:id/avatar','getAvatar','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','bulkCreate','/:id/queues','addQueues','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x1186,0x75));var _0x6118=function(_0x65931d,_0xfc99da){_0x65931d=_0x65931d-0x0;var _0x1c305f=_0x1186[_0x65931d];return _0x1c305f;};'use strict';var multer=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var path=require('path');var timeout=require(_0x6118('0x2'));var express=require(_0x6118('0x3'));var router=express['Router']();var fs_extra=require(_0x6118('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6118('0x5'));var config=require('../../config/environment');var controller=require(_0x6118('0x6'));router[_0x6118('0x7')]('/',auth[_0x6118('0x8')](),controller[_0x6118('0x9')]);router['get'](_0x6118('0xa'),auth[_0x6118('0x8')](),controller[_0x6118('0xb')]);router['get']('/whoami',auth[_0x6118('0x8')](),controller[_0x6118('0xc')]);router[_0x6118('0x7')](_0x6118('0xd'),auth[_0x6118('0x8')](),controller['getPresence']);router[_0x6118('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6118('0x7')](_0x6118('0xe'),controller[_0x6118('0xf')]);router['get']('/:id/open_tabs',auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x6118('0x7')]('/:id/contacts',auth[_0x6118('0x8')](),controller['getContacts']);router[_0x6118('0x7')]('/:id/queues',auth[_0x6118('0x8')](),controller[_0x6118('0x10')]);router[_0x6118('0x7')](_0x6118('0x11'),auth[_0x6118('0x8')](),controller[_0x6118('0x12')]);router[_0x6118('0x7')](_0x6118('0x13'),auth[_0x6118('0x8')](),controller[_0x6118('0x14')]);router[_0x6118('0x7')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x6118('0x15')]);router['get'](_0x6118('0x16'),auth['isAuthenticated'](),controller[_0x6118('0x17')]);router[_0x6118('0x7')](_0x6118('0x18'),auth[_0x6118('0x8')](),controller[_0x6118('0x19')]);router[_0x6118('0x7')](_0x6118('0x1a'),auth[_0x6118('0x8')](),controller[_0x6118('0x1b')]);router[_0x6118('0x7')](_0x6118('0x1c'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x6118('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x6118('0x7')]('/:id/fax/interactions',auth[_0x6118('0x8')](),controller[_0x6118('0x1d')]);router[_0x6118('0x7')](_0x6118('0x1e'),auth['isAuthenticated'](),controller[_0x6118('0x1f')]);router[_0x6118('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6118('0x20')]);router['get']('/:id/lists',auth[_0x6118('0x8')](),controller[_0x6118('0x21')]);router[_0x6118('0x7')]('/:id/agents',auth[_0x6118('0x8')](),controller[_0x6118('0x22')]);router[_0x6118('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x6118('0x23')]);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x6118('0x24')]);router[_0x6118('0x7')](_0x6118('0x25'),auth[_0x6118('0x8')](),controller['getMailAccounts']);router[_0x6118('0x7')](_0x6118('0x26'),auth[_0x6118('0x8')](),controller[_0x6118('0x27')]);router['get'](_0x6118('0x28'),auth[_0x6118('0x8')](),controller[_0x6118('0x29')]);router[_0x6118('0x7')](_0x6118('0x2a'),auth[_0x6118('0x8')](),controller[_0x6118('0x2b')]);router['get']('/:id/whatsapp_accounts',auth[_0x6118('0x8')](),controller[_0x6118('0x2c')]);router[_0x6118('0x7')](_0x6118('0x2d'),auth['isAuthenticated'](),controller[_0x6118('0x2e')]);router[_0x6118('0x7')](_0x6118('0x2f'),auth[_0x6118('0x8')](),controller['getApiKey']);router[_0x6118('0x30')](_0x6118('0x31'),auth[_0x6118('0x8')](),controller[_0x6118('0x32')]);router[_0x6118('0x30')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6118('0x30')]('/create_many',auth['isAuthenticated'](),controller[_0x6118('0x33')]);router['post'](_0x6118('0x34'),auth[_0x6118('0x8')](),controller[_0x6118('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c49ae,_0x57527b,_0x102de5){_0x102de5(null,path[_0x6118('0x36')](config[_0x6118('0x37')],'server/files/images/'));},'filename':function(_0x3bc816,_0x4b73a4,_0x4e6e60){_0x4e6e60(null,util[_0x6118('0x38')](_0x6118('0x39'),Date[_0x6118('0x3a')](),_0x4b73a4[_0x6118('0x3b')]));}})});router[_0x6118('0x30')]('/:id/avatar',upload[_0x6118('0x3c')](_0x6118('0x3d')),controller[_0x6118('0x3e')]);router['post'](_0x6118('0x3f'),auth[_0x6118('0x8')](),controller['login']);router[_0x6118('0x30')](_0x6118('0x40'),auth['isAuthenticated'](),controller[_0x6118('0x41')]);router[_0x6118('0x30')](_0x6118('0x42'),auth[_0x6118('0x8')](),controller['pause']);router['post'](_0x6118('0x43'),auth[_0x6118('0x8')](),controller[_0x6118('0x44')]);router[_0x6118('0x30')](_0x6118('0x45'),auth['isAuthenticated'](),controller[_0x6118('0x46')]);router[_0x6118('0x30')]('/:id/chat_interactions',auth[_0x6118('0x8')](),controller[_0x6118('0x47')]);router[_0x6118('0x30')](_0x6118('0x48'),auth[_0x6118('0x8')](),controller[_0x6118('0x49')]);router['post'](_0x6118('0x4a'),auth[_0x6118('0x8')](),controller['addFaxInteractions']);router[_0x6118('0x30')](_0x6118('0x4b'),auth[_0x6118('0x8')](),controller[_0x6118('0x4c')]);router[_0x6118('0x30')](_0x6118('0x4d'),auth[_0x6118('0x8')](),controller['addOpenchannelInteractions']);router['post'](_0x6118('0x4e'),auth[_0x6118('0x8')](),controller[_0x6118('0x4f')]);router[_0x6118('0x30')](_0x6118('0x50'),auth[_0x6118('0x8')](),controller[_0x6118('0x51')]);router[_0x6118('0x30')]('/:id/mail_accounts',auth[_0x6118('0x8')](),controller[_0x6118('0x52')]);router[_0x6118('0x30')](_0x6118('0x26'),auth[_0x6118('0x8')](),controller[_0x6118('0x53')]);router['post'](_0x6118('0x28'),auth[_0x6118('0x8')](),controller[_0x6118('0x54')]);router[_0x6118('0x30')](_0x6118('0x2a'),auth[_0x6118('0x8')](),controller[_0x6118('0x55')]);router[_0x6118('0x30')](_0x6118('0x56'),auth['isAuthenticated'](),controller[_0x6118('0x57')]);router['post'](_0x6118('0x2f'),auth['isAuthenticated'](),controller[_0x6118('0x58')]);router[_0x6118('0x59')](_0x6118('0x5a'),auth['isAuthenticated'](),controller[_0x6118('0x5b')]);router[_0x6118('0x59')](_0x6118('0x5c'),auth[_0x6118('0x8')](),controller['changePassword']);router['delete'](_0x6118('0x34'),auth[_0x6118('0x8')](),controller[_0x6118('0x5d')]);router[_0x6118('0x5e')]('/:id/teams',auth[_0x6118('0x8')](),controller[_0x6118('0x5f')]);router[_0x6118('0x5e')](_0x6118('0x5a'),auth['isAuthenticated'](),controller[_0x6118('0x60')]);router[_0x6118('0x5e')](_0x6118('0x61'),auth['isAuthenticated'](),controller[_0x6118('0x62')]);router['delete'](_0x6118('0x48'),auth[_0x6118('0x8')](),controller['removeMailInteractions']);router[_0x6118('0x5e')](_0x6118('0x4a'),auth['isAuthenticated'](),controller[_0x6118('0x63')]);router[_0x6118('0x5e')](_0x6118('0x4b'),auth[_0x6118('0x8')](),controller[_0x6118('0x64')]);router[_0x6118('0x5e')]('/:id/openchannel_interactions',auth[_0x6118('0x8')](),controller[_0x6118('0x65')]);router[_0x6118('0x5e')](_0x6118('0x4e'),auth[_0x6118('0x8')](),controller[_0x6118('0x66')]);router[_0x6118('0x5e')](_0x6118('0x50'),auth[_0x6118('0x8')](),controller[_0x6118('0x67')]);router['delete'](_0x6118('0x25'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x6118('0x5e')](_0x6118('0x26'),auth['isAuthenticated'](),controller[_0x6118('0x68')]);router[_0x6118('0x5e')](_0x6118('0x28'),auth[_0x6118('0x8')](),controller[_0x6118('0x69')]);router[_0x6118('0x5e')](_0x6118('0x2a'),auth[_0x6118('0x8')](),controller[_0x6118('0x6a')]);router[_0x6118('0x5e')](_0x6118('0x56'),auth[_0x6118('0x8')](),controller[_0x6118('0x6b')]);router[_0x6118('0x5e')](_0x6118('0x2f'),auth[_0x6118('0x8')](),controller['removeApiKey']);router[_0x6118('0x30')](_0x6118('0x6c'),auth[_0x6118('0x8')](),controller['messengerSoundNotification']);module[_0x6118('0x6d')]=router; \ No newline at end of file +var _0x47b1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','originalname','single','file','addAvatar','/:id/login','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','put','update','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeApiKey','exports','util','path','connect-timeout','express'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x47b1,0x143));var _0x147b=function(_0x30a318,_0x5697b9){_0x30a318=_0x30a318-0x0;var _0x6bf89f=_0x47b1[_0x30a318];return _0x6bf89f;};'use strict';var multer=require('multer');var util=require(_0x147b('0x0'));var path=require(_0x147b('0x1'));var timeout=require(_0x147b('0x2'));var express=require(_0x147b('0x3'));var router=express[_0x147b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x147b('0x5'));var interaction=require(_0x147b('0x6'));var config=require(_0x147b('0x7'));var controller=require(_0x147b('0x8'));router[_0x147b('0x9')]('/',auth[_0x147b('0xa')](),controller[_0x147b('0xb')]);router[_0x147b('0x9')](_0x147b('0xc'),auth[_0x147b('0xa')](),controller['describe']);router[_0x147b('0x9')](_0x147b('0xd'),auth[_0x147b('0xa')](),controller[_0x147b('0xe')]);router[_0x147b('0x9')]('/presence',auth[_0x147b('0xa')](),controller[_0x147b('0xf')]);router['get'](_0x147b('0x10'),auth['isAuthenticated'](),controller[_0x147b('0x11')]);router[_0x147b('0x9')](_0x147b('0x12'),controller[_0x147b('0x13')]);router[_0x147b('0x9')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x147b('0x14')]);router[_0x147b('0x9')](_0x147b('0x15'),auth[_0x147b('0xa')](),controller[_0x147b('0x16')]);router[_0x147b('0x9')]('/:id/queues',auth['isAuthenticated'](),controller[_0x147b('0x17')]);router[_0x147b('0x9')]('/:id/queues_rt',auth[_0x147b('0xa')](),controller[_0x147b('0x18')]);router[_0x147b('0x9')]('/:id/groups',auth[_0x147b('0xa')](),controller[_0x147b('0x19')]);router[_0x147b('0x9')](_0x147b('0x1a'),auth['isAuthenticated'](),controller[_0x147b('0x1b')]);router[_0x147b('0x9')]('/:id/screen_recordings',auth[_0x147b('0xa')](),controller[_0x147b('0x1c')]);router[_0x147b('0x9')](_0x147b('0x1d'),auth['isAuthenticated'](),controller[_0x147b('0x1e')]);router[_0x147b('0x9')](_0x147b('0x1f'),auth[_0x147b('0xa')](),controller['getOpenchannelInteractions']);router[_0x147b('0x9')](_0x147b('0x20'),auth[_0x147b('0xa')](),controller[_0x147b('0x21')]);router[_0x147b('0x9')](_0x147b('0x22'),auth[_0x147b('0xa')](),controller[_0x147b('0x23')]);router['get'](_0x147b('0x24'),auth['isAuthenticated'](),controller[_0x147b('0x25')]);router['get']('/:id/whatsapp/interactions',auth[_0x147b('0xa')](),controller['getWhatsappInteractions']);router[_0x147b('0x9')](_0x147b('0x26'),auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/lists',auth[_0x147b('0xa')](),controller[_0x147b('0x27')]);router[_0x147b('0x9')](_0x147b('0x28'),auth['isAuthenticated'](),controller[_0x147b('0x29')]);router[_0x147b('0x9')](_0x147b('0x2a'),auth[_0x147b('0xa')](),controller[_0x147b('0x2b')]);router[_0x147b('0x9')](_0x147b('0x2c'),auth[_0x147b('0xa')](),controller[_0x147b('0x2d')]);router[_0x147b('0x9')](_0x147b('0x2e'),auth[_0x147b('0xa')](),controller[_0x147b('0x2f')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0x147b('0x9')]('/:id/sms_accounts',auth[_0x147b('0xa')](),controller[_0x147b('0x30')]);router[_0x147b('0x9')](_0x147b('0x31'),auth['isAuthenticated'](),controller['getChatWebsites']);router['get'](_0x147b('0x32'),auth[_0x147b('0xa')](),controller[_0x147b('0x33')]);router[_0x147b('0x9')](_0x147b('0x34'),auth[_0x147b('0xa')](),controller[_0x147b('0x35')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0x147b('0x36')](_0x147b('0x15'),auth[_0x147b('0xa')](),controller[_0x147b('0x37')]);router[_0x147b('0x36')]('/',auth[_0x147b('0xa')](),controller[_0x147b('0x38')]);router[_0x147b('0x36')](_0x147b('0x39'),auth['isAuthenticated'](),controller[_0x147b('0x3a')]);router['post'](_0x147b('0x3b'),auth['isAuthenticated'](),controller[_0x147b('0x3c')]);var upload=multer({'storage':multer[_0x147b('0x3d')]({'destination':function(_0x672cad,_0x3ea7d0,_0x2b0c1b){_0x2b0c1b(null,path[_0x147b('0x3e')](config[_0x147b('0x3f')],_0x147b('0x40')));},'filename':function(_0x208eef,_0x40680c,_0x23cf19){_0x23cf19(null,util['format']('%s-%s',Date['now'](),_0x40680c[_0x147b('0x41')]));}})});router[_0x147b('0x36')](_0x147b('0x12'),upload[_0x147b('0x42')](_0x147b('0x43')),controller[_0x147b('0x44')]);router['post'](_0x147b('0x45'),auth['isAuthenticated'](),controller['login']);router['post']('/:id/logout',auth[_0x147b('0xa')](),controller[_0x147b('0x46')]);router[_0x147b('0x36')](_0x147b('0x47'),auth['isAuthenticated'](),controller['pause']);router[_0x147b('0x36')](_0x147b('0x48'),auth[_0x147b('0xa')](),controller[_0x147b('0x49')]);router[_0x147b('0x36')]('/:id/teams',auth[_0x147b('0xa')](),controller['addTeams']);router['post'](_0x147b('0x4a'),auth[_0x147b('0xa')](),controller[_0x147b('0x4b')]);router['post'](_0x147b('0x4c'),auth[_0x147b('0xa')](),controller['addMailInteractions']);router[_0x147b('0x36')](_0x147b('0x4d'),auth[_0x147b('0xa')](),controller[_0x147b('0x4e')]);router[_0x147b('0x36')](_0x147b('0x4f'),auth[_0x147b('0xa')](),controller[_0x147b('0x50')]);router[_0x147b('0x36')](_0x147b('0x51'),auth[_0x147b('0xa')](),controller[_0x147b('0x52')]);router[_0x147b('0x36')](_0x147b('0x53'),auth['isAuthenticated'](),controller[_0x147b('0x54')]);router[_0x147b('0x36')](_0x147b('0x2c'),auth[_0x147b('0xa')](),controller['addFaxAccounts']);router[_0x147b('0x36')](_0x147b('0x2e'),auth[_0x147b('0xa')](),controller['addMailAccounts']);router[_0x147b('0x36')](_0x147b('0x55'),auth[_0x147b('0xa')](),controller[_0x147b('0x56')]);router['post'](_0x147b('0x57'),auth[_0x147b('0xa')](),controller[_0x147b('0x58')]);router['post'](_0x147b('0x31'),auth[_0x147b('0xa')](),controller[_0x147b('0x59')]);router[_0x147b('0x36')](_0x147b('0x32'),auth[_0x147b('0xa')](),controller[_0x147b('0x5a')]);router['post'](_0x147b('0x5b'),auth[_0x147b('0xa')](),controller['createApiKey']);router[_0x147b('0x5c')](_0x147b('0x10'),auth[_0x147b('0xa')](),controller[_0x147b('0x5d')]);router[_0x147b('0x5c')]('/:id/password',auth['isAuthenticated'](),controller[_0x147b('0x5e')]);router[_0x147b('0x5f')](_0x147b('0x3b'),auth[_0x147b('0xa')](),controller['removeQueues']);router[_0x147b('0x5f')]('/:id/teams',auth[_0x147b('0xa')](),controller[_0x147b('0x60')]);router['delete'](_0x147b('0x10'),auth[_0x147b('0xa')](),controller[_0x147b('0x61')]);router[_0x147b('0x5f')]('/:id/chat_interactions',auth[_0x147b('0xa')](),controller[_0x147b('0x62')]);router[_0x147b('0x5f')]('/:id/mail_interactions',auth[_0x147b('0xa')](),controller[_0x147b('0x63')]);router[_0x147b('0x5f')](_0x147b('0x4d'),auth[_0x147b('0xa')](),controller['removeFaxInteractions']);router['delete'](_0x147b('0x4f'),auth[_0x147b('0xa')](),controller[_0x147b('0x64')]);router[_0x147b('0x5f')](_0x147b('0x51'),auth[_0x147b('0xa')](),controller[_0x147b('0x65')]);router[_0x147b('0x5f')](_0x147b('0x53'),auth[_0x147b('0xa')](),controller[_0x147b('0x66')]);router[_0x147b('0x5f')]('/:id/fax_accounts',auth[_0x147b('0xa')](),controller[_0x147b('0x67')]);router[_0x147b('0x5f')](_0x147b('0x2e'),auth['isAuthenticated'](),controller[_0x147b('0x68')]);router[_0x147b('0x5f')](_0x147b('0x55'),auth[_0x147b('0xa')](),controller[_0x147b('0x69')]);router[_0x147b('0x5f')](_0x147b('0x57'),auth[_0x147b('0xa')](),controller['removeSmsAccounts']);router[_0x147b('0x5f')]('/:id/chat_websites',auth[_0x147b('0xa')](),controller[_0x147b('0x6a')]);router[_0x147b('0x5f')]('/:id/whatsapp_accounts',auth[_0x147b('0xa')](),controller['removeWhatsappAccounts']);router[_0x147b('0x5f')](_0x147b('0x5b'),auth[_0x147b('0xa')](),controller[_0x147b('0x6b')]);router[_0x147b('0x36')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller['messengerSoundNotification']);module[_0x147b('0x6c')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0579149..ff08896 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 _0x4e07=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','actpass','update,nonat','showWebBar','wss','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','DATE','BOOLEAN','friend','peer','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x4e07,0x12d));var _0x74e0=function(_0x1509d4,_0x22863c){_0x1509d4=_0x1509d4-0x0;var _0x5edbbf=_0x4e07[_0x1509d4];return _0x5edbbf;};'use strict';var Sequelize=require(_0x74e0('0x0'));var moment=require(_0x74e0('0x1'));var util=require(_0x74e0('0x2'));var _=require(_0x74e0('0x3'));module[_0x74e0('0x4')]={'name':{'type':Sequelize[_0x74e0('0x5')],'allowNull':![],'unique':_0x74e0('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e4b20){this[_0x74e0('0x7')](_0x74e0('0x6'),_0x3e4b20);this[_0x74e0('0x7')]('defaultuser',_0x3e4b20);},'comment':_0x74e0('0x8')},'fullname':{'type':Sequelize[_0x74e0('0x5')],'allowNull':![],'set':function(_0x540c9f){this[_0x74e0('0x7')](_0x74e0('0x9'),_0x540c9f);this[_0x74e0('0x7')](_0x74e0('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x540c9f,this[_0x74e0('0xb')](_0x74e0('0xc'))));}},'alias':{'type':Sequelize[_0x74e0('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x74e0('0xd'),'validate':{'isEmail':!![]},'set':function(_0x32ad70){if(_0x32ad70){this[_0x74e0('0x7')]('email',_0x32ad70[_0x74e0('0xe')]());}}},'role':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x10'),_0x74e0('0x11'),_0x74e0('0x12'),_0x74e0('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x74e0('0x14')},'internal':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':![],'unique':_0x74e0('0xc'),'set':function(_0x56b3e9){this[_0x74e0('0x7')](_0x74e0('0xc'),_0x56b3e9);this['setDataValue'](_0x74e0('0x16'),_0x56b3e9);this[_0x74e0('0x7')](_0x74e0('0xa'),util[_0x74e0('0x17')](_0x74e0('0x18'),this['getDataValue'](_0x74e0('0x9')),_0x56b3e9));}},'salt':{'type':Sequelize[_0x74e0('0x5')]},'phone':{'type':Sequelize[_0x74e0('0x5')]},'mobile':{'type':Sequelize[_0x74e0('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x74e0('0x5')]},'userpic':{'type':Sequelize[_0x74e0('0x5')]},'city':{'type':Sequelize[_0x74e0('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x74e0('0x19')]},'voicePause':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x74e0('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x74e0('0x19')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x74e0('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x74e0('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'description':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x74e0('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x1b'),_0x74e0('0x11'),_0x74e0('0x1c')),'allowNull':!![],'defaultValue':_0x74e0('0x1b')},'context':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x74e0('0x1d'),_0x74e0('0x1e'),'PROHIB_NOT_SCREENED',_0x74e0('0x1f'),_0x74e0('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x74e0('0x21'),'set':function(_0x5c447a){this[_0x74e0('0x7')](_0x74e0('0x22'),_0x5c447a?_0x5c447a[_0x74e0('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x74e0('0x22'))?this[_0x74e0('0xb')](_0x74e0('0x22'))[_0x74e0('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x25'),_0x74e0('0x26'),_0x74e0('0x27'),_0x74e0('0x28'),_0x74e0('0x29')),'allowNull':!![],'defaultValue':_0x74e0('0x25')},'directmedia':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no',_0x74e0('0x2b'),_0x74e0('0x2c'),_0x74e0('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x74e0('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x45fa63){this[_0x74e0('0x7')](_0x74e0('0x2e'),_0x45fa63?_0x45fa63[_0x74e0('0x23')](','):null);},'get':function(){return this[_0x74e0('0xb')](_0x74e0('0x2e'))?this['getDataValue']('nat')[_0x74e0('0x24')](','):null;},'comment':_0x74e0('0x2f')},'callgroup':{'type':Sequelize[_0x74e0('0x5')]},'namedcallgroup':{'type':Sequelize[_0x74e0('0x5')]},'pickupgroup':{'type':Sequelize[_0x74e0('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x74e0('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x74e0('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x74e0('0x5')],'allowNull':![],'defaultValue':_0x74e0('0x30'),'set':function(_0x1db478){this[_0x74e0('0x7')](_0x74e0('0x31'),_0x1db478?_0x1db478[_0x74e0('0x23')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x74e0('0x31'))?this[_0x74e0('0xb')]('allow')[_0x74e0('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x74e0('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![],'set':function(_0x29be47){this[_0x74e0('0x7')]('insecure',_0x29be47?_0x29be47[_0x74e0('0x23')](','):null);},'get':function(){return this[_0x74e0('0xb')](_0x74e0('0x32'))?this['getDataValue']('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x74e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x74e0('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![],'defaultValue':_0x74e0('0x33')},'amaflags':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x74e0('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x74e0('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no',_0x74e0('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x74e0('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x35'),_0x74e0('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x74e0('0x37'),_0x74e0('0x38')),'allowNull':!![],'defaultValue':_0x74e0('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x74e0('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x74e0('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no',_0x74e0('0x39'),_0x74e0('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x3b'),'passive',_0x74e0('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x74e0('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x74e0('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x74e0('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x74e0('0x2a'),'no',_0x74e0('0x2b'),_0x74e0('0x2c'),_0x74e0('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x74e0('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x74e0('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0,'set':function(_0x2e4f62){this[_0x74e0('0x7')](_0x74e0('0x3e'),_0x2e4f62);var _0x2367b2=this['get']({'plain':!![]});switch(_0x2e4f62){case 0x0:case 0x1:var _0x22d30e=_0x2367b2[_0x74e0('0x22')]?_['isArray'](_0x2367b2[_0x74e0('0x22')])?_0x2367b2[_0x74e0('0x22')]['join']():_0x2367b2[_0x74e0('0x22')]:_0x74e0('0x21');if(_0x22d30e===_0x74e0('0x3f')){_0x22d30e='udp';}this[_0x74e0('0x7')](_0x74e0('0x22'),_0x22d30e);this['setDataValue']('encryption','no');this[_0x74e0('0x7')](_0x74e0('0x40'),null);this[_0x74e0('0x7')](_0x74e0('0x41'),null);this[_0x74e0('0x7')]('icesupport',null);this[_0x74e0('0x7')](_0x74e0('0x42'),null);this[_0x74e0('0x7')](_0x74e0('0x43'),null);this[_0x74e0('0x7')]('dtlssetup',null);this['setDataValue'](_0x74e0('0x44'),null);this[_0x74e0('0x7')](_0x74e0('0x45'),null);this[_0x74e0('0x7')](_0x74e0('0x46'),'no');break;case 0x2:this[_0x74e0('0x7')](_0x74e0('0x22'),_0x74e0('0x3f'));this['setDataValue'](_0x74e0('0x47'),_0x74e0('0x2a'));this[_0x74e0('0x7')](_0x74e0('0x40'),_0x74e0('0x2a'));this[_0x74e0('0x7')](_0x74e0('0x41'),_0x74e0('0x2a'));this['setDataValue'](_0x74e0('0x48'),_0x74e0('0x2a'));this[_0x74e0('0x7')](_0x74e0('0x42'),_0x74e0('0x2a'));this[_0x74e0('0x7')](_0x74e0('0x43'),'no');this[_0x74e0('0x7')](_0x74e0('0x49'),_0x74e0('0x3c'));this[_0x74e0('0x7')]('dtlscertfile',_0x2367b2[_0x74e0('0x44')]||_0x74e0('0x4a'));this['setDataValue'](_0x74e0('0x45'),_0x2367b2['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x74e0('0x46'),_0x74e0('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x74e0('0x4b')],'set':function(_0x25c4e0){this[_0x74e0('0x7')](_0x74e0('0x4c'),_0x25c4e0?_0x25c4e0['join'](','):[]);},'get':function(){return this[_0x74e0('0xb')](_0x74e0('0x4c'))?_[_0x74e0('0x4d')](this['getDataValue']('permissions')['split'](','),function(_0x589a40){return parseInt(_0x589a40,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x74e0('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x74e0('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x74e0('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x74e0('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x74e0('0xf')](_0x74e0('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x74e0('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x74e0('0x4e')],'get':function(){return this[_0x74e0('0xb')](_0x74e0('0x4f'))?this[_0x74e0('0xb')](_0x74e0('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'interface':{'type':Sequelize[_0x74e0('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x74e0('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![],'set':function(_0x7561c0){if(typeof _0x7561c0===_0x74e0('0x50')){var _0x28e18e=_0x7561c0==='1'?!![]:_0x7561c0==='0'?![]:_0x7561c0==='true'?!![]:_0x7561c0===_0x74e0('0x51')?![]:![];this[_0x74e0('0x7')](_0x74e0('0x52'),_0x28e18e);}else{this['setDataValue'](_0x74e0('0x52'),_0x7561c0);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5f0524){this[_0x74e0('0x7')](_0x74e0('0x53'),_0x5f0524);if(_0x5f0524===!![]){this[_0x74e0('0x7')](_0x74e0('0x54'),moment());this[_0x74e0('0x7')](_0x74e0('0x55'),0x0);}else{this[_0x74e0('0x7')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x74e0('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x74e0('0x15')](0x5)[_0x74e0('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x74e0('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x74e0('0x1a')],'defaultValue':![]}}; \ No newline at end of file +var _0xa16f=['transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','join','nat','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','active','actpass','update,nonat','DATE','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','internal','email','ENUM','user','agent','telephone','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB'];(function(_0x52b032,_0x2cd420){var _0x206171=function(_0x6bd1a9){while(--_0x6bd1a9){_0x52b032['push'](_0x52b032['shift']());}};_0x206171(++_0x2cd420);}(_0xa16f,0xe4));var _0xfa16=function(_0x6b072a,_0x137ab6){_0x6b072a=_0x6b072a-0x0;var _0x49b165=_0xa16f[_0x6b072a];return _0x49b165;};'use strict';var Sequelize=require(_0xfa16('0x0'));var moment=require('moment');var util=require(_0xfa16('0x1'));var _=require(_0xfa16('0x2'));module['exports']={'name':{'type':Sequelize[_0xfa16('0x3')],'allowNull':![],'unique':_0xfa16('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1c2016){this['setDataValue'](_0xfa16('0x4'),_0x1c2016);this[_0xfa16('0x5')](_0xfa16('0x6'),_0x1c2016);},'comment':_0xfa16('0x7')},'fullname':{'type':Sequelize[_0xfa16('0x3')],'allowNull':![],'set':function(_0x569854){this[_0xfa16('0x5')](_0xfa16('0x8'),_0x569854);this['setDataValue'](_0xfa16('0x9'),util['format']('\x22%s\x22\x20<%s>',_0x569854,this[_0xfa16('0xa')](_0xfa16('0xb'))));}},'alias':{'type':Sequelize[_0xfa16('0x3')]},'email':{'type':Sequelize[_0xfa16('0x3')],'allowNull':![],'unique':_0xfa16('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3270ad){if(_0x3270ad){this[_0xfa16('0x5')](_0xfa16('0xc'),_0x3270ad['toLowerCase']());}}},'role':{'type':Sequelize[_0xfa16('0xd')]('admin',_0xfa16('0xe'),_0xfa16('0xf'),_0xfa16('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xfa16('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xfa16('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xfa16('0xb'),'set':function(_0x5b2543){this[_0xfa16('0x5')](_0xfa16('0xb'),_0x5b2543);this['setDataValue'](_0xfa16('0x11'),_0x5b2543);this[_0xfa16('0x5')](_0xfa16('0x9'),util[_0xfa16('0x12')](_0xfa16('0x13'),this[_0xfa16('0xa')](_0xfa16('0x8')),_0x5b2543));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xfa16('0x3')]},'mobile':{'type':Sequelize[_0xfa16('0x3')]},'address':{'type':Sequelize[_0xfa16('0x3')]},'zipcode':{'type':Sequelize[_0xfa16('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfa16('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xfa16('0x3')],'defaultValue':_0xfa16('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xfa16('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xfa16('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xfa16('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x17'),_0xfa16('0xe'),'peer'),'allowNull':!![],'defaultValue':_0xfa16('0x17')},'context':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![],'defaultValue':_0xfa16('0x18')},'callingpres':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x19'),_0xfa16('0x1a'),_0xfa16('0x1b'),'ALLOWED','PROHIB_NOT_SCREENED',_0xfa16('0x1c'),'PROHIB_FAILED_SCREEN',_0xfa16('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3cff43){this[_0xfa16('0x5')](_0xfa16('0x1e'),_0x3cff43?_0x3cff43['join'](','):null);},'get':function(){return this[_0xfa16('0xa')](_0xfa16('0x1e'))?this[_0xfa16('0xa')](_0xfa16('0x1e'))[_0xfa16('0x1f')](','):null;},'comment':_0xfa16('0x20')},'dtmfmode':{'type':Sequelize[_0xfa16('0xd')]('rfc2833',_0xfa16('0x21'),_0xfa16('0x22'),_0xfa16('0x23'),_0xfa16('0x24')),'allowNull':!![],'defaultValue':_0xfa16('0x25')},'directmedia':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no',_0xfa16('0x27'),_0xfa16('0x28'),_0xfa16('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfa16('0x2a'),'set':function(_0x194f29){this[_0xfa16('0x5')]('nat',_0x194f29?_0x194f29[_0xfa16('0x2b')](','):null);},'get':function(){return this['getDataValue'](_0xfa16('0x2c'))?this['getDataValue'](_0xfa16('0x2c'))[_0xfa16('0x1f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xfa16('0x3')]},'language':{'type':Sequelize[_0xfa16('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfa16('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xfa16('0x3')],'allowNull':![],'defaultValue':_0xfa16('0x2d'),'set':function(_0x9ba0dd){this['setDataValue'](_0xfa16('0x2e'),_0x9ba0dd?_0x9ba0dd[_0xfa16('0x2b')](';'):_0xfa16('0x2d'));},'get':function(){return this[_0xfa16('0xa')](_0xfa16('0x2e'))?this['getDataValue'](_0xfa16('0x2e'))[_0xfa16('0x1f')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xfa16('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![],'set':function(_0x3e515a){this[_0xfa16('0x5')]('insecure',_0x3e515a?_0x3e515a['join'](','):null);},'get':function(){return this[_0xfa16('0xa')](_0xfa16('0x2f'))?this[_0xfa16('0xa')]('insecure')[_0xfa16('0x1f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no',_0xfa16('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xfa16('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![],'defaultValue':_0xfa16('0x31')},'amaflags':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xfa16('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no',_0xfa16('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x33'),_0xfa16('0x34'),_0xfa16('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xfa16('0x36'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfa16('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xfa16('0xd')]('yes','no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xfa16('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x37'),'passive',_0xfa16('0x38')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xfa16('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xfa16('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xfa16('0xd')](_0xfa16('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xfa16('0xd')]('yes','no',_0xfa16('0x27'),'update',_0xfa16('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xfa16('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xfa16('0x3a')]},'passwordResetAt':{'type':Sequelize[_0xfa16('0x3a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xfa16('0x3b')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x37ce35){this[_0xfa16('0x5')](_0xfa16('0x3c'),_0x37ce35);var _0x3737b9=this[_0xfa16('0x3d')]({'plain':!![]});switch(_0x37ce35){case 0x0:case 0x1:var _0x7cbb97=_0x3737b9[_0xfa16('0x1e')]?_[_0xfa16('0x3e')](_0x3737b9[_0xfa16('0x1e')])?_0x3737b9[_0xfa16('0x1e')][_0xfa16('0x2b')]():_0x3737b9[_0xfa16('0x1e')]:_0xfa16('0x3f');if(_0x7cbb97===_0xfa16('0x40')){_0x7cbb97=_0xfa16('0x3f');}this[_0xfa16('0x5')]('transport',_0x7cbb97);this['setDataValue'](_0xfa16('0x41'),'no');this[_0xfa16('0x5')](_0xfa16('0x42'),null);this['setDataValue'](_0xfa16('0x43'),null);this[_0xfa16('0x5')](_0xfa16('0x44'),null);this[_0xfa16('0x5')](_0xfa16('0x45'),null);this['setDataValue'](_0xfa16('0x46'),null);this[_0xfa16('0x5')]('dtlssetup',null);this[_0xfa16('0x5')](_0xfa16('0x47'),null);this[_0xfa16('0x5')](_0xfa16('0x48'),null);this[_0xfa16('0x5')](_0xfa16('0x49'),'no');break;case 0x2:this[_0xfa16('0x5')](_0xfa16('0x1e'),_0xfa16('0x40'));this['setDataValue'](_0xfa16('0x41'),_0xfa16('0x26'));this['setDataValue'](_0xfa16('0x42'),_0xfa16('0x26'));this[_0xfa16('0x5')](_0xfa16('0x43'),'yes');this['setDataValue']('icesupport',_0xfa16('0x26'));this[_0xfa16('0x5')](_0xfa16('0x45'),_0xfa16('0x26'));this[_0xfa16('0x5')](_0xfa16('0x46'),'no');this['setDataValue']('dtlssetup',_0xfa16('0x38'));this[_0xfa16('0x5')](_0xfa16('0x47'),_0x3737b9[_0xfa16('0x47')]||_0xfa16('0x4a'));this[_0xfa16('0x5')](_0xfa16('0x48'),_0x3737b9[_0xfa16('0x48')]||_0xfa16('0x4b'));this[_0xfa16('0x5')]('rtcp_mux',_0xfa16('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0xfa16('0x3b')],'set':function(_0x14a3e0){this[_0xfa16('0x5')](_0xfa16('0x4c'),_0x14a3e0?_0x14a3e0['join'](','):[]);},'get':function(){return this[_0xfa16('0xa')](_0xfa16('0x4c'))?_[_0xfa16('0x4d')](this[_0xfa16('0xa')](_0xfa16('0x4c'))['split'](','),function(_0x3516da){return parseInt(_0x3516da,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xfa16('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xfa16('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xfa16('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xfa16('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xfa16('0x4e')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0xfa16('0xa')](_0xfa16('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xfa16('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xfa16('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![],'set':function(_0x34d62e){if(typeof _0x34d62e===_0xfa16('0x50')){var _0x26de87=_0x34d62e==='1'?!![]:_0x34d62e==='0'?![]:_0x34d62e===_0xfa16('0x51')?!![]:_0x34d62e===_0xfa16('0x52')?![]:![];this[_0xfa16('0x5')](_0xfa16('0x53'),_0x26de87);}else{this['setDataValue'](_0xfa16('0x53'),_0x34d62e);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x302bbb){this[_0xfa16('0x5')]('blocked',_0x302bbb);if(_0x302bbb===!![]){this[_0xfa16('0x5')](_0xfa16('0x54'),moment());this[_0xfa16('0x5')]('loginAttempts',0x0);}else{this['setDataValue'](_0xfa16('0x54'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xfa16('0x16')](0x5)[_0xfa16('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xfa16('0x16')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xfa16('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 2615dff..fd5deb6 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 _0x5bfd=['$between','$notBetween','$notIn','$like','$iLike','$contains','$contained','$any','lastName','CmContact','Contact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','unknown','ringing','queues','inbound','flatten','toString','lower','col','asc','substring','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','path','ioredis','../../components/auth/service','../../components/contacts','../../components/realtime/agents','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','handleError','../../mysqldb','redis','./user.socket','register','defaults','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','role','agent','emit','destroy','then','get','admin','Users','user','Agents','Telephones','telephone','ignore','value','includes','find','name','error','stack','User','map','fieldName','type','key','filter','password','resetPasswordExpires','md5secret','index','getOptions','query','includeAll','include','true','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','length','dataValues','fax','mail','openchannel','whatsapp','all','catch','show','params','options','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','permissions','102','113','110','105','106','107','108','109','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','settingsEnabled','userProfileId','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','isEmpty','autoAssociation','compact','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','spread','QueueId','voice','VoiceQueue','format','SIP/%s','penalty','upsert','remove','Queues','isArray','Queue:remove','UserVoiceQueueRt','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','download','server/files/images/','getOpenTabs','sms','ChatOpenTabs','CHAT','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','Unknown\x20channel','model','keys','Queue','rawAttributes','intersection','order','sort','where','filters','pick','merge','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','fields','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','getLists','getAgents','getVoiceQueues','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$lte','$ne','$eq'];(function(_0x4be962,_0x1fb825){var _0x11d475=function(_0x24c2a1){while(--_0x24c2a1){_0x4be962['push'](_0x4be962['shift']());}};_0x11d475(++_0x1fb825);}(_0x5bfd,0x1b3));var _0xd5bf=function(_0x434996,_0x5a956c){_0x434996=_0x434996-0x0;var _0x9f3e63=_0x5bfd[_0x434996];return _0x9f3e63;};'use strict';var moment=require('moment');var util=require('util');var path=require(_0xd5bf('0x0'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require(_0xd5bf('0x1'));var authService=require(_0xd5bf('0x2'));var contacts=require(_0xd5bf('0x3'));var qs=require('../../components/parsers/qs');var rta=require(_0xd5bf('0x4'));var logger=require(_0xd5bf('0x5'))(_0xd5bf('0x6'));var utils=require('../../config/utils');var config=require(_0xd5bf('0x7'));var licenseUtil=require(_0xd5bf('0x8'));var APIBadRequestError=require(_0xd5bf('0x9'))['APIBadRequestError'];var APINotFoundError=require(_0xd5bf('0x9'))[_0xd5bf('0xa')];var APIHandleError=require('../../errors/api')[_0xd5bf('0xb')];var db=require(_0xd5bf('0xc'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xd5bf('0xd')]));require(_0xd5bf('0xe'))[_0xd5bf('0xf')](socket);config['redis']=_[_0xd5bf('0x10')](config[_0xd5bf('0xd')],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x56c4c8,_0x4d9aa0){_0x4d9aa0=_0x4d9aa0||0xcc;return function(_0x5d5d6a){if(_0x5d5d6a){return _0x56c4c8[_0xd5bf('0x11')](_0x4d9aa0);}return _0x56c4c8[_0xd5bf('0x12')](_0x4d9aa0)[_0xd5bf('0x13')]();};}function respondWithResult(_0x1719d9,_0x5dff47){_0x5dff47=_0x5dff47||0xc8;return function(_0xc95b56){if(_0xc95b56){return _0x1719d9[_0xd5bf('0x12')](_0x5dff47)[_0xd5bf('0x14')](_0xc95b56);}};}function respondWithFilteredResult(_0x106444,_0xc87a6b){return function(_0x22ea33){if(_0x22ea33){var _0x415aa1=typeof _0xc87a6b[_0xd5bf('0x15')]===_0xd5bf('0x16')&&typeof _0xc87a6b[_0xd5bf('0x17')]===_0xd5bf('0x16');var _0xd02f4e=_0x22ea33['count'];var _0x3dcc21=_0x415aa1?0x0:_0xc87a6b['offset'];var _0x3c71c7=_0x415aa1?_0x22ea33[_0xd5bf('0x18')]:_0xc87a6b['offset']+_0xc87a6b[_0xd5bf('0x17')];var _0x518021;if(_0x3c71c7>=_0xd02f4e){_0x3c71c7=_0xd02f4e;_0x518021=0xc8;}else{_0x518021=0xce;}_0x106444[_0xd5bf('0x12')](_0x518021);return _0x106444['set'](_0xd5bf('0x19'),_0x3dcc21+'-'+_0x3c71c7+'/'+_0xd02f4e)['json'](_0x22ea33);}return null;};}function saveUpdates(_0x5f47c5){return function(_0xd0a5d){if(_0xd0a5d){return _0xd0a5d[_0xd5bf('0x1a')](_0x5f47c5)['then'](function(_0x436e36){if(_0x436e36[_0xd5bf('0x1b')]===_0xd5bf('0x1c')){socket[_0xd5bf('0x1d')]('userNotification:recalc:'+_0x436e36['id'],_0x436e36);}return _0x436e36;});}return null;};}function removeEntity(_0x327599){return function(_0x432ca1){if(_0x432ca1){return _0x432ca1[_0xd5bf('0x1e')]()[_0xd5bf('0x1f')](function(){var _0x2a60d3=_0x432ca1[_0xd5bf('0x20')]({'plain':!![]});if(_0x2a60d3[_0xd5bf('0x1b')]===_0xd5bf('0x21'))return;var _0x1f1e0c=[{'name':_0xd5bf('0x22'),'value':_0xd5bf('0x23'),'ignore':!![]},{'name':_0xd5bf('0x24'),'value':_0xd5bf('0x1c'),'ignore':![]},{'name':_0xd5bf('0x25'),'value':_0xd5bf('0x26'),'ignore':![]}];var _0x4f26b4=_(_0x1f1e0c)['filter'](_0xd5bf('0x27'))['map']('value')[_0xd5bf('0x28')]();if(_[_0xd5bf('0x29')](_0x4f26b4,_0x2a60d3['role'])){return;}var _0x15ed18=_[_0xd5bf('0x2a')](_0x1f1e0c,['value',_0x2a60d3['role']])[_0xd5bf('0x2b')];return db['UserProfileResource'][_0xd5bf('0x1e')]({'where':{'type':_0x15ed18,'resourceId':_0x2a60d3['id']}})[_0xd5bf('0x1f')](function(){return _0x432ca1;});})[_0xd5bf('0x1f')](function(){_0x327599[_0xd5bf('0x12')](0xcc)[_0xd5bf('0x13')]();});}};}function handleEntityNotFound(_0x448b7e){return function(_0x3b5196){if(!_0x3b5196){_0x448b7e[_0xd5bf('0x11')](0x194);}return _0x3b5196;};}function handleError(_0x217383,_0x4dde54){_0x4dde54=_0x4dde54||0x1f4;return function(_0x33fe67){logger[_0xd5bf('0x2c')](_0x33fe67[_0xd5bf('0x2d')]);if(_0x33fe67[_0xd5bf('0x2b')]){delete _0x33fe67[_0xd5bf('0x2b')];}_0x217383[_0xd5bf('0x12')](_0x4dde54)['send'](_0x33fe67);};}function getUserAttributes(){return _(db[_0xd5bf('0x2e')]['rawAttributes'])[_0xd5bf('0x2f')](function(_0x335e64){return{'name':_0x335e64[_0xd5bf('0x30')],'type':_0x335e64[_0xd5bf('0x31')][_0xd5bf('0x32')]};})[_0xd5bf('0x33')](function(_0x3751bc){return![_0xd5bf('0x34'),'salt','previousPasswords','resetPasswordToken',_0xd5bf('0x35'),_0xd5bf('0x36')][_0xd5bf('0x29')](_0x3751bc[_0xd5bf('0x2b')]);})['value']();}exports[_0xd5bf('0x37')]=function(_0x107d61,_0x341325){var _0x256886={},_0x3b23a7={'count':0x0,'rows':[]};var _0x4b1004=getUserAttributes();_0x256886=qs[_0xd5bf('0x38')](_0x4b1004,_0x107d61);var _0x8a6406={'where':_0x256886['where']};return db['User'][_0xd5bf('0x18')](_0x8a6406)[_0xd5bf('0x1f')](function(_0x5f14b2){_0x3b23a7[_0xd5bf('0x18')]=_0x5f14b2;if(_0x107d61[_0xd5bf('0x39')][_0xd5bf('0x3a')]){_0x256886[_0xd5bf('0x3b')]=[{'all':!![]}];}if(_0x107d61[_0xd5bf('0x39')]['userSetting']===_0xd5bf('0x3c')){_0x256886[_0xd5bf('0x3b')]=[{'model':db[_0xd5bf('0x3d')],'as':_0xd5bf('0x3e')}];}if(!_[_0xd5bf('0x29')](_0x256886[_0xd5bf('0x3f')],'id')){_0x256886[_0xd5bf('0x3f')][_0xd5bf('0x40')]('id');}return db['User'][_0xd5bf('0x41')](_0x256886);})['then'](function(_0x178dea){_0x3b23a7[_0xd5bf('0x42')]=_0x178dea;if(_0x107d61[_0xd5bf('0x39')][_0xd5bf('0x43')]===_0xd5bf('0x3c')){var _0x9874aa=[];for(var _0x35893b=0x0;_0x35893b<_0x3b23a7[_0xd5bf('0x42')][_0xd5bf('0x44')];_0x35893b++){_0x9874aa[_0xd5bf('0x40')](get_open_tabs('chat',_0x3b23a7[_0xd5bf('0x42')][_0x35893b][_0xd5bf('0x45')]));_0x9874aa['push'](get_open_tabs('sms',_0x3b23a7[_0xd5bf('0x42')][_0x35893b][_0xd5bf('0x45')]));_0x9874aa[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x46'),_0x3b23a7[_0xd5bf('0x42')][_0x35893b][_0xd5bf('0x45')]));_0x9874aa[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x47'),_0x3b23a7[_0xd5bf('0x42')][_0x35893b][_0xd5bf('0x45')]));_0x9874aa[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x48'),_0x3b23a7[_0xd5bf('0x42')][_0x35893b][_0xd5bf('0x45')]));_0x9874aa[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x49'),_0x3b23a7[_0xd5bf('0x42')][_0x35893b][_0xd5bf('0x45')]));}return Promise[_0xd5bf('0x4a')](_0x9874aa)[_0xd5bf('0x1f')](function(){return _0x3b23a7;});}else{return _0x3b23a7;}})[_0xd5bf('0x1f')](respondWithFilteredResult(_0x341325,_0x256886))[_0xd5bf('0x4b')](handleError(_0x341325,null));};exports[_0xd5bf('0x4c')]=function(_0x4001a7,_0x4fe3ed){var _0x47d02c=getUserAttributes();_0x4001a7[_0xd5bf('0x39')]['id']=_0x4001a7[_0xd5bf('0x4d')]['id'];var _0x5cd61f=qs['getOptions'](_0x47d02c,_0x4001a7);if(_0x4001a7[_0xd5bf('0x39')][_0xd5bf('0x3a')]){_0x5cd61f[_0xd5bf('0x3b')]=[{'all':!![]}];}if(_0x4001a7['query'][_0xd5bf('0x3e')]===_0xd5bf('0x3c')){_0x5cd61f[_0xd5bf('0x3b')]=[{'model':db[_0xd5bf('0x3d')],'as':_0xd5bf('0x3e')}];}_0x5cd61f=_['merge']({},_0x5cd61f,_0x4001a7[_0xd5bf('0x4e')]);if(!_[_0xd5bf('0x29')](_0x5cd61f[_0xd5bf('0x3f')],'id')){_0x5cd61f['attributes'][_0xd5bf('0x40')]('id');}return db[_0xd5bf('0x2e')][_0xd5bf('0x2a')](_0x5cd61f)['then'](handleEntityNotFound(_0x4fe3ed,null))['then'](function(_0x5c1878){var _0x5a286b=[];values=_0x5c1878;if(_0x4001a7['query'][_0xd5bf('0x43')]===_0xd5bf('0x3c')){_0x5a286b['push'](get_open_tabs('chat',_0x5c1878['dataValues']));_0x5a286b[_0xd5bf('0x40')](get_open_tabs('sms',_0x5c1878[_0xd5bf('0x45')]));_0x5a286b['push'](get_open_tabs(_0xd5bf('0x48'),_0x5c1878[_0xd5bf('0x45')]));_0x5a286b[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x49'),_0x5c1878['dataValues']));_0x5a286b[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x46'),_0x5c1878[_0xd5bf('0x45')]));_0x5a286b[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x47'),_0x5c1878['dataValues']));return Promise[_0xd5bf('0x4a')](_0x5a286b);}else{return values;}})[_0xd5bf('0x1f')](function(){return values;})[_0xd5bf('0x1f')](respondWithResult(_0x4fe3ed,null))['catch'](handleError(_0x4fe3ed,null));};exports[_0xd5bf('0x1a')]=function(_0x47c831,_0x546de4){if(_0x47c831[_0xd5bf('0x4f')]['id']){delete _0x47c831[_0xd5bf('0x4f')]['id'];}delete _0x47c831[_0xd5bf('0x4f')][_0xd5bf('0x1b')];return db[_0xd5bf('0x2e')][_0xd5bf('0x2a')]({'where':{'id':_0x47c831['params']['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x546de4,null))[_0xd5bf('0x1f')](saveUpdates(_0x47c831[_0xd5bf('0x4f')],null))[_0xd5bf('0x1f')](respondWithResult(_0x546de4,null))[_0xd5bf('0x4b')](handleError(_0x546de4,null));};exports[_0xd5bf('0x50')]=function(_0x4aa9cd,_0x21284b){return db[_0xd5bf('0x2e')]['describe']()[_0xd5bf('0x1f')](respondWithResult(_0x21284b,null))[_0xd5bf('0x4b')](handleError(_0x21284b,null));};exports['addContacts']=function(_0x94caa4,_0x179bc3){return db[_0xd5bf('0x2e')][_0xd5bf('0x2a')]({'where':{'id':_0x94caa4[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x179bc3,null))['then'](function(_0x525c21){if(_0x525c21){return _0x525c21[_0xd5bf('0x51')](_0x94caa4[_0xd5bf('0x4f')][_0xd5bf('0x52')],_[_0xd5bf('0x53')](_0x94caa4[_0xd5bf('0x4f')],[_0xd5bf('0x52'),'id'])||{});}})['then'](respondWithResult(_0x179bc3,null))['catch'](handleError(_0x179bc3,null));};function validateUser(_0x1c5405){return new Promise(function(_0x264751,_0x549f9b){if(_0x1c5405[_0xd5bf('0x54')])return _0x264751(_0x1c5405);return db[_0xd5bf('0x55')]['findById'](0x1)[_0xd5bf('0x1f')](function(_0x55a114){if(_0x55a114[_0xd5bf('0x56')])authService[_0xd5bf('0x57')](_0x1c5405[_0xd5bf('0x34')]);db['User'][_0xd5bf('0x58')](_0xd5bf('0x54'))[_0xd5bf('0x1f')](function(_0x1252dc){if(_[_0xd5bf('0x59')](_0x1252dc)){_0x1c5405[_0xd5bf('0x54')]=_0x55a114[_0xd5bf('0x5a')]||0x1;return;}if(_['isNil'](_0x55a114[_0xd5bf('0x5a')])||_0x55a114[_0xd5bf('0x5a')]===_0x1252dc){_0x1c5405[_0xd5bf('0x54')]=_0x1252dc+0x1;return;}if(_0x55a114['min_internal']>_0x1252dc){_0x1c5405['internal']=_0x55a114[_0xd5bf('0x5a')];return;}return db[_0xd5bf('0x5b')][_0xd5bf('0x39')](_0xd5bf('0x5c'),{'type':db[_0xd5bf('0x5b')][_0xd5bf('0x5d')][_0xd5bf('0x5e')]})[_0xd5bf('0x1f')](function(_0x42d40b){if(_0x42d40b&&_0x42d40b[_0xd5bf('0x44')]){for(var _0x55f81e=0x0,_0x4d0b60=_0x42d40b[_0xd5bf('0x44')];_0x55f81e<_0x4d0b60&&_[_0xd5bf('0x59')](_0x1c5405[_0xd5bf('0x54')]);_0x55f81e++){if(_0x55a114[_0xd5bf('0x5a')]<=_0x42d40b[_0x55f81e][_0xd5bf('0x5f')]){_0x1c5405['internal']=_0x42d40b[_0x55f81e][_0xd5bf('0x5f')];}else if(_0x55a114[_0xd5bf('0x5a')]>_0x42d40b[_0x55f81e]['from']&&_0x55a114['min_internal']<=_0x42d40b[_0x55f81e]['to']){_0x1c5405[_0xd5bf('0x54')]=_0x55a114[_0xd5bf('0x5a')];}}}if(_[_0xd5bf('0x59')](_0x1c5405['internal'])){_0x1c5405['internal']=_0x1252dc+0x1;}return _0x264751(_0x1c5405);});});})['catch'](function(_0xaa38f7){_0x549f9b(_0xaa38f7);});});}function updateUser(_0x4b51dc){return new Promise(function(_0xc598c,_0x525ca9){try{if(_0x4b51dc[_0xd5bf('0x60')]){_0x4b51dc['mailbox']=_0x4b51dc['internal'];_0x4b51dc[_0xd5bf('0x61')]={'mailbox':_0x4b51dc[_0xd5bf('0x54')],'password':_0x4b51dc[_0xd5bf('0x34')],'fullname':_0x4b51dc[_0xd5bf('0x62')],'email':_0x4b51dc['email']};}if(_0x4b51dc[_0xd5bf('0x1b')]===_0xd5bf('0x1c')){if(!_0x4b51dc[_0xd5bf('0x63')])_0x4b51dc['permissions']=['101',_0xd5bf('0x64'),'103',_0xd5bf('0x65'),_0xd5bf('0x66'),'104',_0xd5bf('0x67'),_0xd5bf('0x68'),_0xd5bf('0x69'),_0xd5bf('0x6a'),_0xd5bf('0x6b'),_0xd5bf('0x6c'),_0xd5bf('0x6d'),_0xd5bf('0x6e'),_0xd5bf('0x6f')];}_0xc598c(_0x4b51dc);}catch(_0x51a576){_0x525ca9(_0x51a576);}});}exports[_0xd5bf('0x70')]=function(_0x21e7d9,_0x447c5a){if(_0x21e7d9[_0xd5bf('0x23')][_0xd5bf('0x1b')]===_0xd5bf('0x1c'))throw new Error('Unauthorized');if(_0x21e7d9[_0xd5bf('0x4f')][_0xd5bf('0x1b')]===_0xd5bf('0x23')&&_0x21e7d9['user'][_0xd5bf('0x1b')]!==_0xd5bf('0x21')){throw new Error(_0xd5bf('0x71'));}if(_0x21e7d9[_0xd5bf('0x4f')][_0xd5bf('0x1b')]===_0xd5bf('0x21')&&_0x21e7d9[_0xd5bf('0x23')][_0xd5bf('0x1b')]!==_0xd5bf('0x21')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x21e7d9[_0xd5bf('0x4f')]])['then'](function(){return validateUser(_0x21e7d9[_0xd5bf('0x4f')]);})[_0xd5bf('0x1f')](function(_0x47fb43){return updateUser(_0x47fb43)[_0xd5bf('0x1f')](function(_0x43107f){if(_0x43107f[_0xd5bf('0x1b')]===_0xd5bf('0x21')){_0x43107f[_0xd5bf('0x72')]=_0x21e7d9[_0xd5bf('0x23')][_0xd5bf('0x72')];delete _0x43107f[_0xd5bf('0x73')];}return _0x43107f;});})['then'](function(_0x5cf1af){return db[_0xd5bf('0x2e')][_0xd5bf('0x70')](_0x5cf1af,{'include':[{'model':db[_0xd5bf('0x61')],'as':_0xd5bf('0x61')}]});})[_0xd5bf('0x1f')](function(_0x41e0bb){if(_0x21e7d9[_0xd5bf('0x4f')][_0xd5bf('0x1b')]==='user')return _0x41e0bb;if(_0x21e7d9[_0xd5bf('0x23')][_0xd5bf('0x1b')]!==_0xd5bf('0x23'))return _0x41e0bb;return db[_0xd5bf('0x74')][_0xd5bf('0x2a')]({'where':{'name':_0x41e0bb[_0xd5bf('0x1b')]===_0xd5bf('0x1c')?_0xd5bf('0x24'):_0xd5bf('0x25'),'userProfileId':_0x21e7d9[_0xd5bf('0x23')][_0xd5bf('0x73')]},'raw':!![]})[_0xd5bf('0x1f')](function(_0xd08fd3){if(!_0xd08fd3||_0xd08fd3['autoAssociation']!=0x0)return _0x41e0bb;return db[_0xd5bf('0x75')]['create']({'name':_0x41e0bb[_0xd5bf('0x2b')],'resourceId':_0x41e0bb['id'],'type':_0xd08fd3['name'],'sectionId':_0xd08fd3['id']},{})['then'](function(){return _0x41e0bb;});})[_0xd5bf('0x4b')](function(_0xc9e002){logger[_0xd5bf('0x2c')](_0xd5bf('0x76'),_0xc9e002);throw _0xc9e002;});})['then'](respondWithResult(_0x447c5a,0xc9))[_0xd5bf('0x4b')](handleError(_0x447c5a,null));};exports['bulkCreate']=function(_0x2903db,_0x478f45){var _0x39abad=_0x2903db['body'];var _0x316f30=[];if(_0x2903db[_0xd5bf('0x23')]['role']==='agent')throw new Error(_0xd5bf('0x77'));if(_['some'](_0x39abad,[_0xd5bf('0x1b'),_0xd5bf('0x23')])&&_0x2903db[_0xd5bf('0x23')][_0xd5bf('0x1b')]!==_0xd5bf('0x21')){throw new Error(_0xd5bf('0x71'));}if(_[_0xd5bf('0x78')](_0x39abad,[_0xd5bf('0x1b'),_0xd5bf('0x21')])&&_0x2903db['user'][_0xd5bf('0x1b')]!==_0xd5bf('0x21')){throw new Error(_0xd5bf('0x79'));}return licenseUtil[_0xd5bf('0x7a')](_0x39abad)[_0xd5bf('0x1f')](function(){return validateUser(_0x39abad[0x0]);})[_0xd5bf('0x1f')](function(){for(var _0x5346a6=0x1;_0x5346a6<_0x39abad[_0xd5bf('0x44')];_0x5346a6++){var _0x3321b7=_0x39abad[_0x5346a6-0x1][_0xd5bf('0x54')];if(!_0x39abad[_0x5346a6]['internal'])_0x39abad[_0x5346a6]['internal']=_0x3321b7+0x1;_0x316f30[_0xd5bf('0x40')](validateUser(_0x39abad[_0x5346a6]));}return Promise[_0xd5bf('0x4a')](_0x316f30);})[_0xd5bf('0x1f')](function(){_0x316f30=[];for(var _0x4b9627=0x0;_0x4b9627<_0x39abad[_0xd5bf('0x44')];_0x4b9627++){_0x316f30[_0xd5bf('0x40')](updateUser(_0x39abad[_0x4b9627]));}return Promise[_0xd5bf('0x4a')](_0x316f30);})[_0xd5bf('0x1f')](function(){_0x316f30=_0x39abad[_0xd5bf('0x2f')](function(_0x2bba5a){return db[_0xd5bf('0x2e')][_0xd5bf('0x70')](_0x2bba5a,{'include':[{'model':db[_0xd5bf('0x61')],'as':'VoiceMail'}]})[_0xd5bf('0x1f')](function(_0x42ac6d){_0x2bba5a['id']=_0x42ac6d['id'];return _0x2bba5a;});});return Promise[_0xd5bf('0x4a')](_0x316f30);})[_0xd5bf('0x1f')](function(_0x493654){if(_0x2903db[_0xd5bf('0x4f')][_0xd5bf('0x1b')]===_0xd5bf('0x23'))return _0x493654;if(_0x2903db['user'][_0xd5bf('0x1b')]!=='user')return _0x493654;var _0x2ec0f2=_[_0xd5bf('0x78')](_0x493654,function(_0x397470){return _0x397470[_0xd5bf('0x1b')]==='agent'||_0x397470[_0xd5bf('0x1b')]===_0xd5bf('0x26');});if(!_0x2ec0f2)return _0x493654;return db[_0xd5bf('0x74')][_0xd5bf('0x41')]({'where':{'name':{'$or':[_0xd5bf('0x24'),_0xd5bf('0x25')]},'userProfileId':_0x2903db[_0xd5bf('0x23')]['userProfileId']},'raw':!![]})['then'](function(_0x308f5a){if(_[_0xd5bf('0x7b')](_0x308f5a)||!_[_0xd5bf('0x78')](_0x308f5a,[_0xd5bf('0x7c'),0x0]))return _0x493654;_0x316f30=[];var _0x7d14ed=_(_0x308f5a)[_0xd5bf('0x2f')](function(_0x56b6df){if(_0x56b6df[_0xd5bf('0x7c')]===0x1)return;return _0x56b6df[_0xd5bf('0x2b')]===_0xd5bf('0x24')?'agent':'telephone';})[_0xd5bf('0x7d')]()[_0xd5bf('0x28')]();for(var _0x45d360=0x0;_0x45d360<_0x493654['length'];_0x45d360++){if(!_[_0xd5bf('0x29')](_0x7d14ed,_0x493654[_0x45d360][_0xd5bf('0x1b')]))return;var _0x47ce89=_0x493654[_0x45d360]['role']===_0xd5bf('0x1c')?_0xd5bf('0x24'):'Telephones';_0x316f30[_0xd5bf('0x40')](db[_0xd5bf('0x75')][_0xd5bf('0x70')]({'name':_0x493654[_0x45d360][_0xd5bf('0x2b')],'resourceId':_0x493654[_0x45d360]['id'],'type':_0x47ce89,'sectionId':_[_0xd5bf('0x2a')](_0x308f5a,['name',_0x47ce89])['id']},{}));}return Promise[_0xd5bf('0x4a')](_0x316f30);});})[_0xd5bf('0x1f')](respondWithResult(_0x478f45,0xc9))[_0xd5bf('0x4b')](handleError(_0x478f45,null));};exports[_0xd5bf('0x7e')]=function(_0x14cc8b,_0x429d23){if(_0x14cc8b['body']['id']){delete _0x14cc8b['body']['id'];}return db[_0xd5bf('0x2e')]['find']({'where':{'id':_0x14cc8b[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](function(_0x160ad2){if(!_0x160ad2)return null;if(_0x160ad2['id']===_0x14cc8b[_0xd5bf('0x23')]['id']){if(!_0x14cc8b[_0xd5bf('0x4f')][_0xd5bf('0x7f')]||!_0x14cc8b['body']['newPassword']){throw new db[(_0xd5bf('0x80'))][(_0xd5bf('0x81'))](_0xd5bf('0x82'));}if(!_0x160ad2[_0xd5bf('0x83')](_0x14cc8b[_0xd5bf('0x4f')][_0xd5bf('0x7f')])){throw new db[(_0xd5bf('0x80'))]['ValidationError'](_0xd5bf('0x84'));}if(_0x14cc8b['body'][_0xd5bf('0x7f')]===_0x14cc8b['body']['newPassword']){throw new db[(_0xd5bf('0x80'))][(_0xd5bf('0x81'))](_0xd5bf('0x85'));}}else if(_0x14cc8b[_0xd5bf('0x23')]['role']==='admin'){if(!_0x14cc8b[_0xd5bf('0x4f')][_0xd5bf('0x86')]){throw new db[(_0xd5bf('0x80'))][(_0xd5bf('0x81'))](_0xd5bf('0x87'));}}else if(_0x14cc8b[_0xd5bf('0x23')][_0xd5bf('0x1b')]===_0xd5bf('0x23')){if(!_0x14cc8b[_0xd5bf('0x4f')][_0xd5bf('0x86')]){throw new db['Sequelize'][(_0xd5bf('0x81'))](_0xd5bf('0x87'));}if(_0x160ad2['role']!=='agent'){throw new db[(_0xd5bf('0x80'))][(_0xd5bf('0x81'))](_0xd5bf('0x77'));}}else{throw new db[(_0xd5bf('0x80'))][(_0xd5bf('0x81'))]('Unauthorized');}return _0x160ad2;})[_0xd5bf('0x1f')](handleEntityNotFound(_0x429d23,null))['then'](function(_0x537bab){return db[_0xd5bf('0x55')][_0xd5bf('0x88')]({'attributes':['id','securePassword',_0xd5bf('0x89'),_0xd5bf('0x8a')]})[_0xd5bf('0x1f')](function(_0x5ccc1f){if(_0x5ccc1f['securePassword'])authService[_0xd5bf('0x57')](_0x14cc8b[_0xd5bf('0x4f')][_0xd5bf('0x86')]);if(!_0x5ccc1f[_0xd5bf('0x89')]||!_0x537bab['previousPasswords'])return _0x537bab;authService[_0xd5bf('0x8b')](_0x14cc8b[_0xd5bf('0x4f')][_0xd5bf('0x86')],_0x537bab[_0xd5bf('0x8c')],_0x5ccc1f[_0xd5bf('0x8a')]);return _0x537bab;})['then'](saveUpdates({'password':_0x14cc8b['body'][_0xd5bf('0x86')],'passwordResetAt':_0x14cc8b[_0xd5bf('0x23')]['id']==_0x14cc8b[_0xd5bf('0x4d')]['id']?moment():null,'previousPasswords':authService[_0xd5bf('0x8d')](_0x14cc8b['body'][_0xd5bf('0x86')],_0x537bab[_0xd5bf('0x8c')])},null));})[_0xd5bf('0x1f')](respondWithResult(_0x429d23,null))[_0xd5bf('0x4b')](handleError(_0x429d23,null));};exports[_0xd5bf('0x8e')]=function(_0x12663e,_0x2de1f7){var _0x369827=_0x12663e['body'][_0xd5bf('0x8f')];return db['User']['find']({'where':{'id':_0x12663e[_0xd5bf('0x4d')]['id']},'attributes':['id',_0xd5bf('0x2b'),'role',_0xd5bf('0x90'),_0xd5bf('0x91'),_0xd5bf('0x92'),_0xd5bf('0x93')]})[_0xd5bf('0x1f')](handleEntityNotFound(_0x2de1f7,null))[_0xd5bf('0x1f')](function(_0x39c194){if(_0x39c194){if(!utils[_0xd5bf('0x94')](_0x369827)){throw new db[(_0xd5bf('0x80'))]['ValidationError']('Unknown\x20channel');}return _0x39c194[_0xd5bf('0x95')+_[_0xd5bf('0x96')](_0x369827[_0xd5bf('0x97')]())+'Queues'](_0x12663e[_0xd5bf('0x4f')][_0xd5bf('0x52')],{'penalty':_0x12663e['body']['penalty']||0x0})[_0xd5bf('0x98')](function(_0x5b7b27){for(var _0x520335=0x0;_0x520335<_0x12663e[_0xd5bf('0x4f')][_0xd5bf('0x52')][_0xd5bf('0x44')];_0x520335+=0x1){var _0x1a30a6={'UserId':Number(_0x12663e[_0xd5bf('0x4d')]['id'])};_0x1a30a6[_[_0xd5bf('0x96')](_0x369827[_0xd5bf('0x97')]())+_0xd5bf('0x99')]=Number(_0x12663e['body'][_0xd5bf('0x52')][_0x520335]);socket[_0xd5bf('0x1d')](_0xd5bf('0x23')+_[_0xd5bf('0x96')](_0x369827[_0xd5bf('0x97')]())+'Queue:save',_0x1a30a6);}return _0x5b7b27;})[_0xd5bf('0x1f')](function(){if(_0x369827===_0xd5bf('0x9a')){return db[_0xd5bf('0x9b')][_0xd5bf('0x41')]({'where':{'id':_0x12663e[_0xd5bf('0x4f')][_0xd5bf('0x52')]||[]},'raw':!![],'attributes':['id',_0xd5bf('0x2b')]});}})['then'](function(_0x2349ce){var _0x1f79ec=_0x39c194[_0xd5bf('0x20')]({'plain':!![]});var _0x136883=[];if(_0x369827===_0xd5bf('0x9a')&&_0x1f79ec[_0xd5bf('0x1b')]===_0xd5bf('0x1c')&&_0x1f79ec[_0xd5bf('0x90')]){for(let _0x178e71=0x0;_0x178e71<_0x2349ce[_0xd5bf('0x44')];_0x178e71+=0x1){_0x136883['push']({'membername':_0x1f79ec['name'],'UserId':_0x1f79ec['id'],'queue_name':_0x2349ce[_0x178e71][_0xd5bf('0x2b')],'VoiceQueueId':_0x2349ce[_0x178e71]['id'],'interface':_[_0xd5bf('0x59')](_0x1f79ec[_0xd5bf('0x93')])?util[_0xd5bf('0x9c')](_0xd5bf('0x9d'),_0x1f79ec[_0xd5bf('0x2b')]):_0x1f79ec[_0xd5bf('0x93')],'paused':_0x1f79ec[_0xd5bf('0x92')]||![],'penalty':_0x12663e['body'][_0xd5bf('0x9e')]||0x0});}return Promise['all'](_0x136883['map'](function(_0x325d53){return db['UserVoiceQueueRt'][_0xd5bf('0x9f')](_0x325d53);}));}return _0x39c194;});}})['then'](respondWithStatusCode(_0x2de1f7,null))[_0xd5bf('0x4b')](handleError(_0x2de1f7,null));};exports['removeQueues']=function(_0x11621c,_0x2f7b25){var _0xea7125,_0x3c77bf;return db[_0xd5bf('0x2e')][_0xd5bf('0x2a')]({'where':{'id':_0x11621c[_0xd5bf('0x4d')]['id']},'attributes':['id',_0xd5bf('0x2b'),_0xd5bf('0x1b')]})[_0xd5bf('0x1f')](handleEntityNotFound(_0x2f7b25,null))[_0xd5bf('0x1f')](function(_0x42a316){if(_0x42a316){_0xea7125=_0x42a316;if(!_0x11621c[_0xd5bf('0x39')][_0xd5bf('0x8f')]||!utils[_0xd5bf('0x94')](_0x11621c['query']['channel'])){throw new db[(_0xd5bf('0x80'))]['ValidationError']('Unknown\x20channel');}return _0x42a316[_0xd5bf('0xa0')+_['capitalize'](_0x11621c[_0xd5bf('0x39')][_0xd5bf('0x8f')][_0xd5bf('0x97')]())+_0xd5bf('0xa1')](_0x11621c['query']['ids']);}})[_0xd5bf('0x1f')](function(_0x4f5459){if(_[_0xd5bf('0xa2')](_0x11621c[_0xd5bf('0x39')]['ids'])){for(var _0x10afcb=0x0;_0x10afcb<_0x11621c[_0xd5bf('0x39')]['ids']['length'];_0x10afcb+=0x1){_0x3c77bf={'UserId':Number(_0x11621c[_0xd5bf('0x4d')]['id'])};_0x3c77bf[_[_0xd5bf('0x96')](_0x11621c['query'][_0xd5bf('0x8f')][_0xd5bf('0x97')]())+_0xd5bf('0x99')]=Number(_0x11621c[_0xd5bf('0x39')]['ids'][_0x10afcb]);socket[_0xd5bf('0x1d')](_0xd5bf('0x23')+_['capitalize'](_0x11621c['query'][_0xd5bf('0x8f')]['toLowerCase']())+_0xd5bf('0xa3'),_0x3c77bf);}}else{_0x3c77bf={'UserId':Number(_0x11621c[_0xd5bf('0x4d')]['id'])};_0x3c77bf[_['capitalize'](_0x11621c[_0xd5bf('0x39')][_0xd5bf('0x8f')][_0xd5bf('0x97')]())+_0xd5bf('0x99')]=Number(_0x11621c[_0xd5bf('0x39')][_0xd5bf('0x52')]);socket['emit']('user'+_[_0xd5bf('0x96')](_0x11621c[_0xd5bf('0x39')][_0xd5bf('0x8f')][_0xd5bf('0x97')]())+'Queue:remove',_0x3c77bf);}return _0x4f5459;})[_0xd5bf('0x1f')](function(){if(_0x11621c[_0xd5bf('0x39')][_0xd5bf('0x8f')]===_0xd5bf('0x9a')){return db[_0xd5bf('0xa4')][_0xd5bf('0x1e')]({'where':{'UserId':_0x11621c['params']['id'],'VoiceQueueId':_0x11621c[_0xd5bf('0x39')]['ids']},'individualHooks':!![]})[_0xd5bf('0x1f')](function(){return _0xea7125;});}return _0xea7125;})['then'](respondWithStatusCode(_0x2f7b25,null))[_0xd5bf('0x4b')](handleError(_0x2f7b25,null));};exports['addAvatar']=function(_0x422ef5,_0x3b2cc5){_0x422ef5[_0xd5bf('0x4f')][_0xd5bf('0xa5')]=_0x422ef5[_0xd5bf('0xa6')]['filename'];return db[_0xd5bf('0x2e')]['find']({'where':{'id':_0x422ef5['params']['id']}})['then'](handleEntityNotFound(_0x3b2cc5,null))['then'](saveUpdates(_0x422ef5['body'],null))[_0xd5bf('0x1f')](respondWithResult(_0x3b2cc5,null))[_0xd5bf('0x4b')](handleError(_0x3b2cc5,null));};exports[_0xd5bf('0xa7')]=function(_0x59483e,_0x207ddf){var _0x46b7be=path[_0xd5bf('0xa8')](config[_0xd5bf('0xa9')],_0xd5bf('0xaa'));return db['User'][_0xd5bf('0x2a')]({'where':{'id':_0x59483e[_0xd5bf('0x4d')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xd5bf('0x1f')](handleEntityNotFound(_0x207ddf,null))['then'](function(_0x45a2d1){if(_0x45a2d1){if(_[_0xd5bf('0x59')](_0x45a2d1[_0xd5bf('0xa5')])){return _0x207ddf['download'](_0x46b7be);}else{if(!fs[_0xd5bf('0xab')](path['join'](config[_0xd5bf('0xa9')],'server/files/images/',_0x45a2d1[_0xd5bf('0xa5')]))){return _0x207ddf[_0xd5bf('0xac')](_0x46b7be);}return _0x207ddf['download'](path[_0xd5bf('0xa8')](config[_0xd5bf('0xa9')],_0xd5bf('0xad'),_0x45a2d1[_0xd5bf('0xa5')]));}}})[_0xd5bf('0x4b')](handleError(_0x207ddf,null));};exports[_0xd5bf('0xae')]=function(_0x282bf2,_0x25926f){return db[_0xd5bf('0x2e')][_0xd5bf('0x2a')]({'where':{'id':_0x282bf2[_0xd5bf('0x4d')]['id']},'attributes':['id']})[_0xd5bf('0x1f')](handleEntityNotFound(_0x25926f,null))[_0xd5bf('0x1f')](function(_0x5a8428){var _0x4a7781=[];values=_0x5a8428[_0xd5bf('0x45')];_0x4a7781[_0xd5bf('0x40')](get_open_tabs('chat',_0x5a8428['dataValues']));_0x4a7781[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0xaf'),_0x5a8428[_0xd5bf('0x45')]));_0x4a7781[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x48'),_0x5a8428['dataValues']));_0x4a7781[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x49'),_0x5a8428[_0xd5bf('0x45')]));_0x4a7781[_0xd5bf('0x40')](get_open_tabs(_0xd5bf('0x46'),_0x5a8428[_0xd5bf('0x45')]));_0x4a7781['push'](get_open_tabs(_0xd5bf('0x47'),_0x5a8428[_0xd5bf('0x45')]));return Promise['all'](_0x4a7781);})[_0xd5bf('0x1f')](function(_0x2e998a){if(_0x2e998a){var _0x4b6b68=_[_0xd5bf('0x2f')](values[_0xd5bf('0xb0')],function(_0x28ecdd){return{'channel':_0xd5bf('0xb1'),'id':_0x28ecdd['id'],'createdAt':_0x28ecdd[_0xd5bf('0xb2')]};});var _0x200c20=_[_0xd5bf('0x2f')](values['FaxOpenTabs'],function(_0x318498){return{'channel':'FAX','id':_0x318498['id'],'createdAt':_0x318498[_0xd5bf('0xb2')]};});var _0x274bb4=_[_0xd5bf('0x2f')](values[_0xd5bf('0xb3')],function(_0x5a9187){return{'channel':_0xd5bf('0xb4'),'id':_0x5a9187['id'],'createdAt':_0x5a9187[_0xd5bf('0xb2')]};});var _0xad8df2=_[_0xd5bf('0x2f')](values[_0xd5bf('0xb5')],function(_0x13fb97){return{'channel':_0xd5bf('0xb6'),'id':_0x13fb97['id'],'createdAt':_0x13fb97[_0xd5bf('0xb2')]};});var _0x1f5835=_[_0xd5bf('0x2f')](values['SmsOpenTabs'],function(_0xa8a901){return{'channel':_0xd5bf('0xb7'),'id':_0xa8a901['id'],'createdAt':_0xa8a901[_0xd5bf('0xb2')]};});var _0x472ae8=_[_0xd5bf('0x2f')](values[_0xd5bf('0xb8')],function(_0x5609b2){return{'channel':_0xd5bf('0xb9'),'id':_0x5609b2['id'],'createdAt':_0x5609b2[_0xd5bf('0xb2')]};});var _0x32ba2d=_[_0xd5bf('0xba')](_0x4b6b68,_0x200c20,_0x274bb4,_0xad8df2,_0x1f5835,_0x472ae8);var _0x3af0a8={'count':_0x32ba2d[_0xd5bf('0x44')],'rows':_0x32ba2d};return _0x3af0a8;}else return null;})['then'](respondWithResult(_0x25926f,null))[_0xd5bf('0x4b')](handleError(_0x25926f,null));};exports['getContacts']=function(_0x2b8275,_0x37e5a9){var _0x513857={};return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x2b8275[_0xd5bf('0x4d')]['id']}})['then'](function(_0x30ce0e){if(!_0x30ce0e){throw new APINotFoundError(util[_0xd5bf('0x9c')](_0xd5bf('0xbb'),_0x2b8275['params']['id']));}return contacts['describe']();})[_0xd5bf('0x1f')](function(_0x2e74f2){_0x2b8275[_0xd5bf('0x39')][_0xd5bf('0x2e')]=_0x2b8275['params']['id'];_0x513857=qs[_0xd5bf('0x38')](_0x2e74f2,_0x2b8275);if(_0x2b8275['query'][_0xd5bf('0xbc')](_0xd5bf('0x3a'))){_0x513857[_0xd5bf('0x3b')]=[{'model':db[_0xd5bf('0xbd')],'as':_0xd5bf('0xbe'),'required':![]},{'model':db[_0xd5bf('0xbf')],'as':_0xd5bf('0xc0'),'attributes':['id',_0xd5bf('0x2b'),_0xd5bf('0xc1')],'where':_0x2b8275['query'][_0xd5bf('0xc2')]?{'id':_0x2b8275[_0xd5bf('0x39')]['tag']}:undefined,'required':_0x2b8275[_0xd5bf('0x39')]['tag']?!![]:![]}];}return contacts[_0xd5bf('0x41')](_0x2b8275['query'],_0x2b8275[_0xd5bf('0x23')],_0x513857,_0x2e74f2);})['then'](respondWithFilteredResult(_0x37e5a9,_0x513857))['catch'](APIHandleError(_0x37e5a9));};exports[_0xd5bf('0xc3')]=function(_0x499de6,_0x41026c){var _0x2e74bd;var _0x1641f2={};var _0x2ccfec;return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x499de6[_0xd5bf('0x4d')]['id']},'attributes':['id',_0xd5bf('0x2b'),_0xd5bf('0x1b')]})[_0xd5bf('0x1f')](handleEntityNotFound(_0x41026c,null))[_0xd5bf('0x1f')](function(_0x5f0b2c){if(!utils[_0xd5bf('0x94')](_0x499de6[_0xd5bf('0x39')][_0xd5bf('0x8f')])){throw new db[(_0xd5bf('0x80'))][(_0xd5bf('0x81'))](_0xd5bf('0xc4'));}_0x2e74bd=_0x5f0b2c;var _0x45304f={};_0x45304f[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_[_0xd5bf('0x96')](_0x499de6[_0xd5bf('0x39')][_0xd5bf('0x8f')])+_0xd5bf('0xc7')][_0xd5bf('0xc8')]);_0x45304f[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x499de6['query']);_0x45304f['filters']=_['intersection'](_0x45304f[_0xd5bf('0xc5')],_0x45304f[_0xd5bf('0x39')]);_0x1641f2[_0xd5bf('0x3f')]=_[_0xd5bf('0xc9')](_0x45304f[_0xd5bf('0xc5')],qs['fields'](_0x499de6[_0xd5bf('0x39')]['fields']));_0x1641f2[_0xd5bf('0x3f')]=_0x1641f2[_0xd5bf('0x3f')][_0xd5bf('0x44')]?_0x1641f2[_0xd5bf('0x3f')]:_0x45304f[_0xd5bf('0xc5')];_0x1641f2[_0xd5bf('0xca')]=qs[_0xd5bf('0xcb')](_0x499de6[_0xd5bf('0x39')][_0xd5bf('0xcb')]);_0x1641f2[_0xd5bf('0xcc')]=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x499de6[_0xd5bf('0x39')],_0x45304f[_0xd5bf('0xcd')]));if(_0x499de6[_0xd5bf('0x39')][_0xd5bf('0x33')]){_0x1641f2[_0xd5bf('0xcc')]=_['merge'](_0x1641f2[_0xd5bf('0xcc')],{'$or':_[_0xd5bf('0x2f')](_0x1641f2[_0xd5bf('0x3f')],function(_0x45b140){var _0x9e8d61={};_0x9e8d61[_0x45b140]={'$like':'%'+_0x499de6[_0xd5bf('0x39')][_0xd5bf('0x33')]+'%'};return _0x9e8d61;})});}_0x1641f2=_[_0xd5bf('0xcf')]({},_0x1641f2,_0x499de6[_0xd5bf('0x4e')]);switch(_0x2e74bd[_0xd5bf('0x1b')]){case _0xd5bf('0x21'):return db[_[_0xd5bf('0x96')](_0x499de6[_0xd5bf('0x39')]['channel'])+_0xd5bf('0xc7')][_0xd5bf('0x41')](_0x1641f2);case _0xd5bf('0x23'):case _0xd5bf('0x1c'):return _0x2e74bd[_0xd5bf('0x20')+_[_0xd5bf('0x96')](_0x499de6[_0xd5bf('0x39')][_0xd5bf('0x8f')])+_0xd5bf('0xa1')](_0x1641f2);default:throw new db[(_0xd5bf('0x80'))][(_0xd5bf('0x81'))](_0xd5bf('0xd0'));}})['then'](function(_0x14df7b){_0x2ccfec=_0x14df7b[_0xd5bf('0x44')];if(!_0x499de6[_0xd5bf('0x39')][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0x1641f2[_0xd5bf('0x17')]=qs[_0xd5bf('0x17')](_0x499de6['query'][_0xd5bf('0x17')]);_0x1641f2[_0xd5bf('0x15')]=qs[_0xd5bf('0x15')](_0x499de6[_0xd5bf('0x39')][_0xd5bf('0x15')]);}switch(_0x2e74bd[_0xd5bf('0x1b')]){case _0xd5bf('0x21'):return db[_[_0xd5bf('0x96')](_0x499de6[_0xd5bf('0x39')]['channel'])+_0xd5bf('0xc7')][_0xd5bf('0x41')](_0x1641f2);case _0xd5bf('0x23'):case _0xd5bf('0x1c'):return _0x2e74bd[_0xd5bf('0x20')+_[_0xd5bf('0x96')](_0x499de6[_0xd5bf('0x39')][_0xd5bf('0x8f')])+_0xd5bf('0xa1')](_0x1641f2);}})[_0xd5bf('0x1f')](function(_0x5adf09){return{'count':_0x2ccfec,'rows':_0x5adf09};})[_0xd5bf('0x1f')](respondWithResult(_0x41026c,null))[_0xd5bf('0x4b')](handleError(_0x41026c,null));};exports['getVoiceQueuesRt']=function(_0x56d2e6,_0xa95341){var _0x304519={};var _0x5afeed={};var _0x5d2c8f;var _0x270042;return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x56d2e6[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0xa95341,null))[_0xd5bf('0x1f')](function(_0x17fc5e){if(_0x17fc5e){_0x5d2c8f=_0x17fc5e;_0x5afeed[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db['UserVoiceQueueRt'][_0xd5bf('0xc8')]);_0x5afeed['query']=_[_0xd5bf('0xc6')](_0x56d2e6[_0xd5bf('0x39')]);_0x5afeed[_0xd5bf('0xcd')]=_[_0xd5bf('0xc9')](_0x5afeed[_0xd5bf('0xc5')],_0x5afeed[_0xd5bf('0x39')]);_0x304519[_0xd5bf('0x3f')]=_[_0xd5bf('0xc9')](_0x5afeed[_0xd5bf('0xc5')],qs['fields'](_0x56d2e6[_0xd5bf('0x39')]['fields']));_0x304519[_0xd5bf('0x3f')]=_0x304519[_0xd5bf('0x3f')]['length']?_0x304519[_0xd5bf('0x3f')]:_0x5afeed[_0xd5bf('0xc5')];_0x304519['order']=qs[_0xd5bf('0xcb')](_0x56d2e6['query'][_0xd5bf('0xcb')]);_0x304519[_0xd5bf('0xcc')]=qs['filters'](_['pick'](_0x56d2e6['query'],_0x5afeed[_0xd5bf('0xcd')]));if(_0x56d2e6[_0xd5bf('0x39')][_0xd5bf('0x33')]){_0x304519['where']=_[_0xd5bf('0xcf')](_0x304519[_0xd5bf('0xcc')],{'$or':_[_0xd5bf('0x2f')](_0x304519[_0xd5bf('0x3f')],function(_0x3d5850){var _0x486a82={};_0x486a82[_0x3d5850]={'$like':'%'+_0x56d2e6['query'][_0xd5bf('0x33')]+'%'};return _0x486a82;})});}_0x304519=_[_0xd5bf('0xcf')]({},_0x304519,_0x56d2e6['options']);return _0x5d2c8f[_0xd5bf('0xd2')](_0x304519);}})[_0xd5bf('0x1f')](function(_0x3ab84c){if(_0x3ab84c){_0x270042=_0x3ab84c[_0xd5bf('0x44')];if(!_0x56d2e6[_0xd5bf('0x39')][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0x304519[_0xd5bf('0x17')]=qs[_0xd5bf('0x17')](_0x56d2e6[_0xd5bf('0x39')][_0xd5bf('0x17')]);_0x304519[_0xd5bf('0x15')]=qs['offset'](_0x56d2e6[_0xd5bf('0x39')][_0xd5bf('0x15')]);}return _0x5d2c8f[_0xd5bf('0xd2')](_0x304519);}})['then'](function(_0x4e5c4d){if(_0x4e5c4d){return _0x4e5c4d?{'count':_0x270042,'rows':_0x4e5c4d}:null;}})['then'](respondWithResult(_0xa95341,null))[_0xd5bf('0x4b')](handleError(_0xa95341,null));};exports[_0xd5bf('0xd3')]=function(_0x103189,_0x23a1a1){var _0x49827d={};var _0x3dfa48={};var _0x59933c;var _0x20552a;return db['User']['findOne']({'where':{'id':_0x103189[_0xd5bf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23a1a1,null))[_0xd5bf('0x1f')](function(_0x4f51dd){if(_0x4f51dd){_0x59933c=_0x4f51dd;_0x3dfa48[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_0xd5bf('0xd4')][_0xd5bf('0xc8')]);_0x3dfa48[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x103189[_0xd5bf('0x39')]);_0x3dfa48[_0xd5bf('0xcd')]=_['intersection'](_0x3dfa48[_0xd5bf('0xc5')],_0x3dfa48['query']);_0x49827d[_0xd5bf('0x3f')]=_['intersection'](_0x3dfa48['model'],qs[_0xd5bf('0xd5')](_0x103189[_0xd5bf('0x39')]['fields']));_0x49827d[_0xd5bf('0x3f')]=_0x49827d[_0xd5bf('0x3f')]['length']?_0x49827d['attributes']:_0x3dfa48[_0xd5bf('0xc5')];_0x49827d[_0xd5bf('0xca')]=qs[_0xd5bf('0xcb')](_0x103189['query'][_0xd5bf('0xcb')]);_0x49827d[_0xd5bf('0xcc')]=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x103189['query'],_0x3dfa48[_0xd5bf('0xcd')]));if(_0x103189['query'][_0xd5bf('0x33')]){_0x49827d[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x49827d['where'],{'$or':_[_0xd5bf('0x2f')](_0x49827d[_0xd5bf('0x3f')],function(_0x946c80){var _0x55e164={};_0x55e164[_0x946c80]={'$like':'%'+_0x103189[_0xd5bf('0x39')][_0xd5bf('0x33')]+'%'};return _0x55e164;})});}_0x49827d=_[_0xd5bf('0xcf')]({},_0x49827d,_0x103189[_0xd5bf('0x4e')]);return _0x59933c[_0xd5bf('0xd3')](_0x49827d);}})['then'](function(_0x2e8bd6){if(_0x2e8bd6){_0x20552a=_0x2e8bd6['length'];if(!_0x103189[_0xd5bf('0x39')][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0x49827d[_0xd5bf('0x17')]=qs['limit'](_0x103189[_0xd5bf('0x39')][_0xd5bf('0x17')]);_0x49827d['offset']=qs[_0xd5bf('0x15')](_0x103189['query'][_0xd5bf('0x15')]);}return _0x59933c[_0xd5bf('0xd3')](_0x49827d);}})[_0xd5bf('0x1f')](function(_0x127d0a){if(_0x127d0a){return _0x127d0a?{'count':_0x20552a,'rows':_0x127d0a}:null;}})[_0xd5bf('0x1f')](respondWithResult(_0x23a1a1,null))[_0xd5bf('0x4b')](handleError(_0x23a1a1,null));};exports[_0xd5bf('0xd6')]=function(_0x488239,_0x4ac42d){var _0x21ccb5={'raw':!![],'where':{}};var _0x56b11e={};var _0x24a098={'count':0x0,'rows':[]};return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x488239[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x4ac42d,null))[_0xd5bf('0x1f')](function(_0x2b06a9){if(_0x2b06a9){_0x56b11e[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_0xd5bf('0xd7')][_0xd5bf('0xc8')]);_0x56b11e[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x488239[_0xd5bf('0x39')]);_0x56b11e[_0xd5bf('0xcd')]=_[_0xd5bf('0xc9')](_0x56b11e[_0xd5bf('0xc5')],_0x56b11e['query']);_0x21ccb5[_0xd5bf('0x3f')]=_[_0xd5bf('0xc9')](_0x56b11e[_0xd5bf('0xc5')],qs[_0xd5bf('0xd5')](_0x488239[_0xd5bf('0x39')]['fields']));_0x21ccb5['attributes']=_0x21ccb5['attributes']['length']?_0x21ccb5[_0xd5bf('0x3f')]:_0x56b11e[_0xd5bf('0xc5')];if(!_0x488239[_0xd5bf('0x39')][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0x21ccb5[_0xd5bf('0x17')]=qs[_0xd5bf('0x17')](_0x488239[_0xd5bf('0x39')][_0xd5bf('0x17')]);_0x21ccb5[_0xd5bf('0x15')]=qs['offset'](_0x488239[_0xd5bf('0x39')][_0xd5bf('0x15')]);}_0x21ccb5[_0xd5bf('0xca')]=qs['sort'](_0x488239[_0xd5bf('0x39')][_0xd5bf('0xcb')]);_0x21ccb5['where']=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x488239[_0xd5bf('0x39')],_0x56b11e[_0xd5bf('0xcd')]));_0x21ccb5[_0xd5bf('0xcc')][_0xd5bf('0xd8')]=_0x2b06a9['id'];if(_0x488239['query'][_0xd5bf('0x33')]){_0x21ccb5[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x21ccb5['where'],{'$or':_['map'](_0x21ccb5[_0xd5bf('0x3f')],function(_0x46050b){var _0x1d1867={};_0x1d1867[_0x46050b]={'$like':'%'+_0x488239[_0xd5bf('0x39')]['filter']+'%'};return _0x1d1867;})});}_0x21ccb5=_[_0xd5bf('0xcf')]({},_0x21ccb5,_0x488239[_0xd5bf('0x4e')]);return db[_0xd5bf('0xd7')][_0xd5bf('0x18')]({'where':_0x21ccb5[_0xd5bf('0xcc')]})[_0xd5bf('0x1f')](function(_0x148a2f){_0x24a098[_0xd5bf('0x18')]=_0x148a2f;if(_0x488239[_0xd5bf('0x39')][_0xd5bf('0x3a')]){_0x21ccb5[_0xd5bf('0x3b')]=[{'all':!![]}];}return db['VoiceRecording'][_0xd5bf('0x41')](_0x21ccb5);})['then'](function(_0x404b32){_0x24a098[_0xd5bf('0x42')]=_0x404b32;return _0x24a098;});}})['then'](respondWithFilteredResult(_0x4ac42d,_0x21ccb5))[_0xd5bf('0x4b')](handleError(_0x4ac42d,null));};exports[_0xd5bf('0xd9')]=function(_0x55711a,_0x2eec24){var _0x5ec6d3={'raw':!![],'where':{}};var _0x4ab6af={};var _0xcc328a={'count':0x0,'rows':[]};return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x55711a[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x2eec24,null))[_0xd5bf('0x1f')](function(_0xba9f1d){if(_0xba9f1d){_0x4ab6af['model']=_[_0xd5bf('0xc6')](db[_0xd5bf('0xda')][_0xd5bf('0xc8')]);_0x4ab6af['query']=_[_0xd5bf('0xc6')](_0x55711a[_0xd5bf('0x39')]);_0x4ab6af[_0xd5bf('0xcd')]=_[_0xd5bf('0xc9')](_0x4ab6af[_0xd5bf('0xc5')],_0x4ab6af[_0xd5bf('0x39')]);_0x5ec6d3[_0xd5bf('0x3f')]=_[_0xd5bf('0xc9')](_0x4ab6af[_0xd5bf('0xc5')],qs[_0xd5bf('0xd5')](_0x55711a[_0xd5bf('0x39')][_0xd5bf('0xd5')]));_0x5ec6d3['attributes']=_0x5ec6d3[_0xd5bf('0x3f')][_0xd5bf('0x44')]?_0x5ec6d3['attributes']:_0x4ab6af[_0xd5bf('0xc5')];if(!_0x55711a['query'][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0x5ec6d3['limit']=qs[_0xd5bf('0x17')](_0x55711a[_0xd5bf('0x39')][_0xd5bf('0x17')]);_0x5ec6d3[_0xd5bf('0x15')]=qs[_0xd5bf('0x15')](_0x55711a[_0xd5bf('0x39')]['offset']);}_0x5ec6d3[_0xd5bf('0xca')]=qs[_0xd5bf('0xcb')](_0x55711a[_0xd5bf('0x39')]['sort']);_0x5ec6d3[_0xd5bf('0xcc')]=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x55711a[_0xd5bf('0x39')],_0x4ab6af[_0xd5bf('0xcd')]));_0x5ec6d3[_0xd5bf('0xcc')][_0xd5bf('0xd8')]=_0xba9f1d['id'];if(_0x55711a['query'][_0xd5bf('0x33')]){_0x5ec6d3[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x5ec6d3[_0xd5bf('0xcc')],{'$or':_[_0xd5bf('0x2f')](_0x5ec6d3[_0xd5bf('0x3f')],function(_0x54fd1d){var _0x46398a={};_0x46398a[_0x54fd1d]={'$like':'%'+_0x55711a['query'][_0xd5bf('0x33')]+'%'};return _0x46398a;})});}_0x5ec6d3=_[_0xd5bf('0xcf')]({},_0x5ec6d3,_0x55711a[_0xd5bf('0x4e')]);return db['ScreenRecording'][_0xd5bf('0x18')]({'where':_0x5ec6d3[_0xd5bf('0xcc')]})[_0xd5bf('0x1f')](function(_0x265bca){_0xcc328a[_0xd5bf('0x18')]=_0x265bca;if(_0x55711a[_0xd5bf('0x39')][_0xd5bf('0x3a')]){_0x5ec6d3[_0xd5bf('0x3b')]=[{'all':!![]}];}return db[_0xd5bf('0xda')]['findAll'](_0x5ec6d3);})[_0xd5bf('0x1f')](function(_0x46588b){_0xcc328a[_0xd5bf('0x42')]=_0x46588b;return _0xcc328a;});}})[_0xd5bf('0x1f')](respondWithFilteredResult(_0x2eec24,_0x5ec6d3))[_0xd5bf('0x4b')](handleError(_0x2eec24,null));};exports['getChatInteractions']=function(_0x31c6a3,_0x25f9b2){var _0x300268={};var _0x4e85ce={};var _0x40c025;var _0x190ed0;return db['User']['findOne']({'where':{'id':_0x31c6a3['params']['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x25f9b2,null))[_0xd5bf('0x1f')](function(_0x512be9){if(_0x512be9){_0x40c025=_0x512be9;_0x4e85ce[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_0xd5bf('0xdb')]['rawAttributes']);_0x4e85ce['query']=_[_0xd5bf('0xc6')](_0x31c6a3[_0xd5bf('0x39')]);_0x4e85ce['filters']=_['intersection'](_0x4e85ce[_0xd5bf('0xc5')],_0x4e85ce[_0xd5bf('0x39')]);_0x300268[_0xd5bf('0x3f')]=_[_0xd5bf('0xc9')](_0x4e85ce['model'],qs[_0xd5bf('0xd5')](_0x31c6a3['query'][_0xd5bf('0xd5')]));_0x300268['attributes']=_0x300268['attributes'][_0xd5bf('0x44')]?_0x300268[_0xd5bf('0x3f')]:_0x4e85ce[_0xd5bf('0xc5')];_0x300268[_0xd5bf('0xca')]=qs[_0xd5bf('0xcb')](_0x31c6a3['query']['sort']);_0x300268[_0xd5bf('0xcc')]=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x31c6a3[_0xd5bf('0x39')],_0x4e85ce[_0xd5bf('0xcd')]));if(_0x31c6a3[_0xd5bf('0x39')]['filter']){_0x300268[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x300268[_0xd5bf('0xcc')],{'$or':_['map'](_0x300268['attributes'],function(_0x3486ee){var _0x2be74d={};_0x2be74d[_0x3486ee]={'$like':'%'+_0x31c6a3[_0xd5bf('0x39')][_0xd5bf('0x33')]+'%'};return _0x2be74d;})});}_0x300268=_[_0xd5bf('0xcf')]({},_0x300268,_0x31c6a3[_0xd5bf('0x4e')]);return _0x40c025[_0xd5bf('0xdc')](_0x300268);}})[_0xd5bf('0x1f')](function(_0x41a438){if(_0x41a438){_0x190ed0=_0x41a438[_0xd5bf('0x44')];if(!_0x31c6a3['query'][_0xd5bf('0xbc')]('nolimit')){_0x300268['limit']=qs[_0xd5bf('0x17')](_0x31c6a3[_0xd5bf('0x39')][_0xd5bf('0x17')]);_0x300268['offset']=qs['offset'](_0x31c6a3[_0xd5bf('0x39')][_0xd5bf('0x15')]);}return _0x40c025[_0xd5bf('0xdc')](_0x300268);}})[_0xd5bf('0x1f')](function(_0x1d0108){if(_0x1d0108){return _0x1d0108?{'count':_0x190ed0,'rows':_0x1d0108}:null;}})['then'](respondWithResult(_0x25f9b2,null))[_0xd5bf('0x4b')](handleError(_0x25f9b2,null));};exports[_0xd5bf('0xdd')]=function(_0x1bf9f0,_0x172c30){var _0x176b55={};var _0x51e3ae={};var _0x46f97c;var _0x587757;return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x1bf9f0[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x172c30,null))['then'](function(_0x126c6b){if(_0x126c6b){_0x46f97c=_0x126c6b;_0x51e3ae[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_0xd5bf('0xde')][_0xd5bf('0xc8')]);_0x51e3ae[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x1bf9f0[_0xd5bf('0x39')]);_0x51e3ae['filters']=_[_0xd5bf('0xc9')](_0x51e3ae[_0xd5bf('0xc5')],_0x51e3ae['query']);_0x176b55['attributes']=_[_0xd5bf('0xc9')](_0x51e3ae[_0xd5bf('0xc5')],qs[_0xd5bf('0xd5')](_0x1bf9f0['query'][_0xd5bf('0xd5')]));_0x176b55[_0xd5bf('0x3f')]=_0x176b55[_0xd5bf('0x3f')][_0xd5bf('0x44')]?_0x176b55['attributes']:_0x51e3ae[_0xd5bf('0xc5')];_0x176b55[_0xd5bf('0xca')]=qs['sort'](_0x1bf9f0['query'][_0xd5bf('0xcb')]);_0x176b55[_0xd5bf('0xcc')]=qs['filters'](_[_0xd5bf('0xce')](_0x1bf9f0[_0xd5bf('0x39')],_0x51e3ae['filters']));if(_0x1bf9f0[_0xd5bf('0x39')][_0xd5bf('0x33')]){_0x176b55['where']=_[_0xd5bf('0xcf')](_0x176b55[_0xd5bf('0xcc')],{'$or':_['map'](_0x176b55['attributes'],function(_0x45b7a8){var _0x15400e={};_0x15400e[_0x45b7a8]={'$like':'%'+_0x1bf9f0[_0xd5bf('0x39')][_0xd5bf('0x33')]+'%'};return _0x15400e;})});}_0x176b55=_['merge']({},_0x176b55,_0x1bf9f0[_0xd5bf('0x4e')]);return _0x46f97c[_0xd5bf('0xdd')](_0x176b55);}})['then'](function(_0x334d62){if(_0x334d62){_0x587757=_0x334d62[_0xd5bf('0x44')];if(!_0x1bf9f0[_0xd5bf('0x39')]['hasOwnProperty'](_0xd5bf('0xd1'))){_0x176b55[_0xd5bf('0x17')]=qs[_0xd5bf('0x17')](_0x1bf9f0['query'][_0xd5bf('0x17')]);_0x176b55['offset']=qs[_0xd5bf('0x15')](_0x1bf9f0[_0xd5bf('0x39')][_0xd5bf('0x15')]);}return _0x46f97c[_0xd5bf('0xdd')](_0x176b55);}})[_0xd5bf('0x1f')](function(_0x321448){if(_0x321448){return _0x321448?{'count':_0x587757,'rows':_0x321448}:null;}})[_0xd5bf('0x1f')](respondWithResult(_0x172c30,null))[_0xd5bf('0x4b')](handleError(_0x172c30,null));};exports['getMailInteractions']=function(_0x26dcc3,_0x4cffab){var _0x1d4fbd={'raw':!![],'where':{}};var _0x519edd={};var _0x40cd57={'count':0x0,'rows':[]};return db[_0xd5bf('0x2e')]['findOne']({'where':{'id':_0x26dcc3[_0xd5bf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4cffab,null))[_0xd5bf('0x1f')](function(_0x348afc){if(_0x348afc){_0x519edd[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_0xd5bf('0xdf')][_0xd5bf('0xc8')]);_0x519edd[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x26dcc3['query']);_0x519edd[_0xd5bf('0xcd')]=_[_0xd5bf('0xc9')](_0x519edd[_0xd5bf('0xc5')],_0x519edd[_0xd5bf('0x39')]);_0x1d4fbd[_0xd5bf('0x3f')]=_[_0xd5bf('0xc9')](_0x519edd[_0xd5bf('0xc5')],qs[_0xd5bf('0xd5')](_0x26dcc3['query'][_0xd5bf('0xd5')]));_0x1d4fbd['attributes']=_0x1d4fbd[_0xd5bf('0x3f')][_0xd5bf('0x44')]?_0x1d4fbd[_0xd5bf('0x3f')]:_0x519edd['model'];if(!_0x26dcc3['query'][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0x1d4fbd[_0xd5bf('0x17')]=qs[_0xd5bf('0x17')](_0x26dcc3[_0xd5bf('0x39')][_0xd5bf('0x17')]);_0x1d4fbd[_0xd5bf('0x15')]=qs['offset'](_0x26dcc3[_0xd5bf('0x39')][_0xd5bf('0x15')]);}_0x1d4fbd['order']=qs[_0xd5bf('0xcb')](_0x26dcc3[_0xd5bf('0x39')][_0xd5bf('0xcb')]);_0x1d4fbd[_0xd5bf('0xcc')]=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x26dcc3[_0xd5bf('0x39')],_0x519edd['filters']));_0x1d4fbd[_0xd5bf('0xcc')][_0xd5bf('0xd8')]=_0x348afc['id'];if(_0x26dcc3[_0xd5bf('0x39')][_0xd5bf('0x33')]){_0x1d4fbd[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x1d4fbd[_0xd5bf('0xcc')],{'$or':_['map'](_0x1d4fbd[_0xd5bf('0x3f')],function(_0x3080f5){var _0x8c12c1={};_0x8c12c1[_0x3080f5]={'$like':'%'+_0x26dcc3['query'][_0xd5bf('0x33')]+'%'};return _0x8c12c1;})});}_0x1d4fbd=_[_0xd5bf('0xcf')]({},_0x1d4fbd,_0x26dcc3['options']);return db['MailInteraction'][_0xd5bf('0x18')]({'where':_0x1d4fbd[_0xd5bf('0xcc')]})[_0xd5bf('0x1f')](function(_0x3cdab4){_0x40cd57[_0xd5bf('0x18')]=_0x3cdab4;if(_0x26dcc3['query']['includeAll']){_0x1d4fbd[_0xd5bf('0x3b')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x1d4fbd);})[_0xd5bf('0x1f')](function(_0x3dd62f){_0x40cd57[_0xd5bf('0x42')]=_0x3dd62f;return _0x40cd57;});}})[_0xd5bf('0x1f')](respondWithFilteredResult(_0x4cffab,_0x1d4fbd))[_0xd5bf('0x4b')](handleError(_0x4cffab,null));};exports[_0xd5bf('0xe0')]=function(_0x588151,_0x2f239c){var _0x3e57c5={};var _0x3688e6={};var _0x4fb4d7;var _0x29451b;return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x588151[_0xd5bf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f239c,null))['then'](function(_0x2a9736){if(_0x2a9736){_0x4fb4d7=_0x2a9736;_0x3688e6['model']=_[_0xd5bf('0xc6')](db[_0xd5bf('0xe1')][_0xd5bf('0xc8')]);_0x3688e6[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x588151[_0xd5bf('0x39')]);_0x3688e6['filters']=_['intersection'](_0x3688e6['model'],_0x3688e6[_0xd5bf('0x39')]);_0x3e57c5[_0xd5bf('0x3f')]=_[_0xd5bf('0xc9')](_0x3688e6['model'],qs[_0xd5bf('0xd5')](_0x588151[_0xd5bf('0x39')][_0xd5bf('0xd5')]));_0x3e57c5[_0xd5bf('0x3f')]=_0x3e57c5[_0xd5bf('0x3f')][_0xd5bf('0x44')]?_0x3e57c5['attributes']:_0x3688e6[_0xd5bf('0xc5')];_0x3e57c5[_0xd5bf('0xca')]=qs['sort'](_0x588151[_0xd5bf('0x39')][_0xd5bf('0xcb')]);_0x3e57c5['where']=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x588151[_0xd5bf('0x39')],_0x3688e6[_0xd5bf('0xcd')]));if(_0x588151[_0xd5bf('0x39')][_0xd5bf('0x33')]){_0x3e57c5[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x3e57c5['where'],{'$or':_[_0xd5bf('0x2f')](_0x3e57c5[_0xd5bf('0x3f')],function(_0x75effc){var _0x16f70e={};_0x16f70e[_0x75effc]={'$like':'%'+_0x588151[_0xd5bf('0x39')][_0xd5bf('0x33')]+'%'};return _0x16f70e;})});}_0x3e57c5=_[_0xd5bf('0xcf')]({},_0x3e57c5,_0x588151[_0xd5bf('0x4e')]);return _0x4fb4d7['getSmsInteractions'](_0x3e57c5);}})[_0xd5bf('0x1f')](function(_0x3e81a0){if(_0x3e81a0){_0x29451b=_0x3e81a0['length'];if(!_0x588151['query'][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0x3e57c5['limit']=qs[_0xd5bf('0x17')](_0x588151[_0xd5bf('0x39')][_0xd5bf('0x17')]);_0x3e57c5[_0xd5bf('0x15')]=qs[_0xd5bf('0x15')](_0x588151[_0xd5bf('0x39')][_0xd5bf('0x15')]);}return _0x4fb4d7['getSmsInteractions'](_0x3e57c5);}})[_0xd5bf('0x1f')](function(_0xdcd97e){if(_0xdcd97e){return _0xdcd97e?{'count':_0x29451b,'rows':_0xdcd97e}:null;}})[_0xd5bf('0x1f')](respondWithResult(_0x2f239c,null))[_0xd5bf('0x4b')](handleError(_0x2f239c,null));};exports[_0xd5bf('0xe2')]=function(_0x31ed73,_0x7ec485){var _0x589e16={};var _0x28b6b3={};var _0x210215;var _0x3da0fc;return db['User']['findOne']({'where':{'id':_0x31ed73['params']['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x7ec485,null))['then'](function(_0x4a7c58){if(_0x4a7c58){_0x210215=_0x4a7c58;_0x28b6b3[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db['FaxInteraction'][_0xd5bf('0xc8')]);_0x28b6b3[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x31ed73[_0xd5bf('0x39')]);_0x28b6b3[_0xd5bf('0xcd')]=_['intersection'](_0x28b6b3[_0xd5bf('0xc5')],_0x28b6b3[_0xd5bf('0x39')]);_0x589e16[_0xd5bf('0x3f')]=_['intersection'](_0x28b6b3[_0xd5bf('0xc5')],qs[_0xd5bf('0xd5')](_0x31ed73[_0xd5bf('0x39')][_0xd5bf('0xd5')]));_0x589e16[_0xd5bf('0x3f')]=_0x589e16[_0xd5bf('0x3f')]['length']?_0x589e16[_0xd5bf('0x3f')]:_0x28b6b3[_0xd5bf('0xc5')];_0x589e16['order']=qs[_0xd5bf('0xcb')](_0x31ed73[_0xd5bf('0x39')]['sort']);_0x589e16[_0xd5bf('0xcc')]=qs[_0xd5bf('0xcd')](_['pick'](_0x31ed73[_0xd5bf('0x39')],_0x28b6b3[_0xd5bf('0xcd')]));if(_0x31ed73['query'][_0xd5bf('0x33')]){_0x589e16[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x589e16[_0xd5bf('0xcc')],{'$or':_[_0xd5bf('0x2f')](_0x589e16[_0xd5bf('0x3f')],function(_0x47429b){var _0x11b279={};_0x11b279[_0x47429b]={'$like':'%'+_0x31ed73[_0xd5bf('0x39')]['filter']+'%'};return _0x11b279;})});}_0x589e16=_[_0xd5bf('0xcf')]({},_0x589e16,_0x31ed73['options']);return _0x210215[_0xd5bf('0xe2')](_0x589e16);}})[_0xd5bf('0x1f')](function(_0x2e8b11){if(_0x2e8b11){_0x3da0fc=_0x2e8b11['length'];if(!_0x31ed73['query'][_0xd5bf('0xbc')]('nolimit')){_0x589e16[_0xd5bf('0x17')]=qs[_0xd5bf('0x17')](_0x31ed73[_0xd5bf('0x39')][_0xd5bf('0x17')]);_0x589e16['offset']=qs['offset'](_0x31ed73[_0xd5bf('0x39')][_0xd5bf('0x15')]);}return _0x210215[_0xd5bf('0xe2')](_0x589e16);}})['then'](function(_0x399e71){if(_0x399e71){return _0x399e71?{'count':_0x3da0fc,'rows':_0x399e71}:null;}})[_0xd5bf('0x1f')](respondWithResult(_0x7ec485,null))[_0xd5bf('0x4b')](handleError(_0x7ec485,null));};exports[_0xd5bf('0xe3')]=function(_0x1d56b4,_0x240bb8){var _0x4ac881={};var _0x1131e2={};var _0x1fb68a;var _0x3efbce;return db['User']['findOne']({'where':{'id':_0x1d56b4['params']['id']}})['then'](handleEntityNotFound(_0x240bb8,null))['then'](function(_0x28aa7e){if(_0x28aa7e){_0x1fb68a=_0x28aa7e;_0x1131e2[_0xd5bf('0xc5')]=_['keys'](db[_0xd5bf('0xe4')][_0xd5bf('0xc8')]);_0x1131e2[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x1d56b4['query']);_0x1131e2[_0xd5bf('0xcd')]=_[_0xd5bf('0xc9')](_0x1131e2['model'],_0x1131e2[_0xd5bf('0x39')]);_0x4ac881[_0xd5bf('0x3f')]=_[_0xd5bf('0xc9')](_0x1131e2[_0xd5bf('0xc5')],qs[_0xd5bf('0xd5')](_0x1d56b4['query'][_0xd5bf('0xd5')]));_0x4ac881['attributes']=_0x4ac881[_0xd5bf('0x3f')][_0xd5bf('0x44')]?_0x4ac881['attributes']:_0x1131e2[_0xd5bf('0xc5')];_0x4ac881[_0xd5bf('0xca')]=qs['sort'](_0x1d56b4[_0xd5bf('0x39')]['sort']);_0x4ac881['where']=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x1d56b4[_0xd5bf('0x39')],_0x1131e2[_0xd5bf('0xcd')]));if(_0x1d56b4[_0xd5bf('0x39')]['filter']){_0x4ac881[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x4ac881[_0xd5bf('0xcc')],{'$or':_[_0xd5bf('0x2f')](_0x4ac881[_0xd5bf('0x3f')],function(_0xc9125b){var _0x863b42={};_0x863b42[_0xc9125b]={'$like':'%'+_0x1d56b4[_0xd5bf('0x39')]['filter']+'%'};return _0x863b42;})});}_0x4ac881=_[_0xd5bf('0xcf')]({},_0x4ac881,_0x1d56b4['options']);return _0x1fb68a[_0xd5bf('0xe3')](_0x4ac881);}})['then'](function(_0x47de74){if(_0x47de74){_0x3efbce=_0x47de74[_0xd5bf('0x44')];if(!_0x1d56b4['query'][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0x4ac881['limit']=qs['limit'](_0x1d56b4[_0xd5bf('0x39')]['limit']);_0x4ac881[_0xd5bf('0x15')]=qs[_0xd5bf('0x15')](_0x1d56b4['query'][_0xd5bf('0x15')]);}return _0x1fb68a[_0xd5bf('0xe3')](_0x4ac881);}})[_0xd5bf('0x1f')](function(_0x302e12){if(_0x302e12){return _0x302e12?{'count':_0x3efbce,'rows':_0x302e12}:null;}})[_0xd5bf('0x1f')](respondWithResult(_0x240bb8,null))[_0xd5bf('0x4b')](handleError(_0x240bb8,null));};exports[_0xd5bf('0xe5')]=function(_0x2d1a99,_0x18dd49,_0x12b856){var _0xc36324;var _0x24f7e0;var _0x174cce;var _0x530c0a=!_[_0xd5bf('0x59')](_0x2d1a99[_0xd5bf('0x4d')]['id'])?_0x2d1a99['params']['id']:!_[_0xd5bf('0x59')](_0x2d1a99[_0xd5bf('0x23')]['id'])?_0x2d1a99[_0xd5bf('0x23')]['id']:null;return db[_0xd5bf('0x2e')][_0xd5bf('0x2a')]({'where':{'id':_0x530c0a,'role':{'$or':[_0xd5bf('0x21'),_0xd5bf('0x23'),_0xd5bf('0x1c')]}},'attributes':['id',_0xd5bf('0x2b'),_0xd5bf('0xe6'),_0xd5bf('0xe7'),_0xd5bf('0x1b'),_0xd5bf('0x54'),_0xd5bf('0x91')]})[_0xd5bf('0x1f')](function(_0x4a7e7d){if(_0x4a7e7d){if(_0x4a7e7d[_0xd5bf('0x1b')]===_0xd5bf('0x1c')){_0xc36324=_0x4a7e7d;if(_0x2d1a99[_0xd5bf('0x4f')]['interface']){_0x174cce=util[_0xd5bf('0x9c')](_0xd5bf('0xe8'),_0xc36324[_0x2d1a99[_0xd5bf('0x4f')][_0xd5bf('0x93')]]);}else if(_0x2d1a99[_0xd5bf('0x4f')][_0xd5bf('0xe9')]){_0x174cce=util[_0xd5bf('0x9c')](_0xd5bf('0x9d'),_0x2d1a99['body'][_0xd5bf('0xe9')]);}else{_0x174cce=util[_0xd5bf('0x9c')](_0xd5bf('0x9d'),_0xc36324[_0xd5bf('0x2b')]);}socket['to'](util['format'](_0xd5bf('0xea'),_0xc36324['name']))['emit'](_0xd5bf('0xeb'),{'user':{'id':_0xc36324['id'],'name':_0xc36324['name']},'ip':_0x2d1a99[_0xd5bf('0xec')][_0xd5bf('0xed')]||_0x2d1a99[_0xd5bf('0xee')]['remoteAddress']||_0x2d1a99[_0xd5bf('0xef')]['remoteAddress']||_0x2d1a99[_0xd5bf('0xee')][_0xd5bf('0xef')]['remoteAddress']});return db[_0xd5bf('0xa4')][_0xd5bf('0x1e')]({'where':{'membername':_0xc36324[_0xd5bf('0x2b')]},'individualHooks':!![]});}}else{throw new db[(_0xd5bf('0x80'))]['ValidationError'](_0xd5bf('0xf0'));}})[_0xd5bf('0x1f')](function(){if(_0xc36324){return _0xc36324['getVoiceQueues']({'raw':!![]});}})[_0xd5bf('0x1f')](function(_0x4082a4){if(_0xc36324){if(_0x4082a4){_0x24f7e0=_0x4082a4;if(_0x24f7e0['length']){var _0xb8d0e1=_0x24f7e0[_0xd5bf('0x2f')](function(_0x4101d7){var _0x6d5bd7={'membername':_0xc36324[_0xd5bf('0x2b')],'UserId':_0xc36324['id'],'queue_name':_0x4101d7[_0xd5bf('0x2b')],'VoiceQueueId':_0x4101d7['id'],'interface':_0x174cce,'paused':_0xc36324[_0xd5bf('0x91')]||![],'penalty':_0x4101d7['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0xd5bf('0x9f')](_0x6d5bd7);});return Promise[_0xd5bf('0x4a')](_0xb8d0e1);}}}})[_0xd5bf('0x1f')](function(){if(_0xc36324){return db[_0xd5bf('0xf1')][_0xd5bf('0x41')]({'where':{'membername':_0xc36324[_0xd5bf('0x2b')],'exitAt':null}});}})[_0xd5bf('0x1f')](function(_0x4650da){if(_0xc36324){var _0x23f948=[];_0x4650da[_0xd5bf('0xf2')](function(_0xbd2ec3){_0x23f948['push'](_0xbd2ec3[_0xd5bf('0x1a')]({'exitAt':moment()[_0xd5bf('0x9c')](_0xd5bf('0xf3'))}));});return Promise[_0xd5bf('0x4a')](_0x23f948);}})[_0xd5bf('0x1f')](function(){if(_0xc36324){var _0x472aa7=[];var _0xb09f19=[];var _0x49b264=utils[_0xd5bf('0xf4')]();var _0x5b0aae={'membername':_0xc36324[_0xd5bf('0x2b')],'interface':_0x174cce,'enterAt':moment()[_0xd5bf('0x9c')](_0xd5bf('0xf3')),'role':_0xc36324['role'],'internal':_0xc36324[_0xd5bf('0x54')]};_0x49b264[_0xd5bf('0xf2')](function(_0x23842a){_0x472aa7['push'](_[_0xd5bf('0xcf')]({'channel':_0x23842a,'type':'LOGIN','data1':_0x2d1a99[_0xd5bf('0x4f')][_0xd5bf('0xf5')],'data2':_0x174cce},_0x5b0aae));if(_0xc36324[_0xd5bf('0x91')]){_0xb09f19[_0xd5bf('0x40')](_['merge']({'channel':_0x23842a,'type':_0xd5bf('0xf6'),'data1':_0xd5bf('0xf7')},_0x5b0aae));}});return db[_0xd5bf('0xf1')][_0xd5bf('0xf8')](_0x472aa7['concat'](_0xb09f19),{'individualHooks':!![]});}})['then'](function(){if(_0xc36324){return _0xc36324[_0xd5bf('0x1a')]({'online':!![],'lastLoginAt':moment()['format'](_0xd5bf('0xf3')),'voicePause':_0xc36324[_0xd5bf('0x91')]||![],'mailPause':_0xc36324[_0xd5bf('0x91')]||![],'chatPause':_0xc36324[_0xd5bf('0x91')]||![],'faxPause':_0xc36324['loginInPause']||![],'smsPause':_0xc36324[_0xd5bf('0x91')]||![],'openchannelPause':_0xc36324[_0xd5bf('0x91')]||![],'whatsappPause':_0xc36324['loginInPause']||![],'pauseType':_0xc36324[_0xd5bf('0x91')]?_0xd5bf('0xf7'):null,'interface':_0x174cce,'lastPauseAt':moment()[_0xd5bf('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xd5bf('0x1f')](function(_0x5927a8){if(_0x2d1a99[_0xd5bf('0xf9')]){return _0x12b856();}else{return Promise[_0xd5bf('0xfa')](_0x5927a8)[_0xd5bf('0x1f')](respondWithResult(_0x18dd49,null));}})[_0xd5bf('0x4b')](handleError(_0x18dd49,null));};exports[_0xd5bf('0xfb')]=function(_0x55b9c3,_0x148dd5){var _0x1a04d7;return db[_0xd5bf('0x2e')]['find']({'where':{'id':_0x55b9c3['params']['id'],'role':_0xd5bf('0x1c')},'attributes':['id',_0xd5bf('0x2b'),_0xd5bf('0x1b')]})[_0xd5bf('0x1f')](handleEntityNotFound(_0x148dd5,null))['then'](function(_0x59e543){if(_0x59e543){_0x1a04d7=_0x59e543;return db[_0xd5bf('0xa4')][_0xd5bf('0x1e')]({'where':{'membername':_0x1a04d7[_0xd5bf('0x2b')]},'individualHooks':!![]});}})[_0xd5bf('0x1f')](function(){return db[_0xd5bf('0xf1')][_0xd5bf('0x41')]({'where':{'membername':_0x1a04d7[_0xd5bf('0x2b')],'exitAt':null}});})[_0xd5bf('0x1f')](function(_0x2ce2f0){var _0xc1145f=[];_0x2ce2f0[_0xd5bf('0xf2')](function(_0x379531){_0xc1145f[_0xd5bf('0x40')](_0x379531[_0xd5bf('0x1a')]({'exitAt':moment()[_0xd5bf('0x9c')](_0xd5bf('0xf3'))}));});return Promise['all'](_0xc1145f);})[_0xd5bf('0x1f')](function(){return _0x1a04d7[_0xd5bf('0x1a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd5bf('0x1f')](respondWithResult(_0x148dd5,null))[_0xd5bf('0x4b')](handleError(_0x148dd5,null));};exports[_0xd5bf('0xfc')]=function(_0x526415,_0x121864){var _0x1422fb;return db[_0xd5bf('0xa4')]['update']({'paused':0x1},{'where':{'UserId':_0x526415['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xd5bf('0x2e')][_0xd5bf('0x2a')]({'where':{'id':_0x526415[_0xd5bf('0x4d')]['id'],'role':'agent'},'attributes':['id',_0xd5bf('0x2b'),'role','internal',_0xd5bf('0x93'),_0xd5bf('0x90')]});})[_0xd5bf('0x1f')](handleEntityNotFound(_0x121864,null))[_0xd5bf('0x1f')](function(_0x6bc705){if(_0x6bc705){_0x1422fb=_0x6bc705;return db[_0xd5bf('0xf1')][_0xd5bf('0x41')]({'where':{'membername':_0x1422fb[_0xd5bf('0x2b')],'type':_0xd5bf('0xf6'),'exitAt':null}});}})['then'](function(_0x5ed87f){if(_0x5ed87f[_0xd5bf('0x44')]){var _0x2c3177=moment()[_0xd5bf('0x9c')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x10b06b=0x0,_0x393f56=_0x5ed87f[_0xd5bf('0x44')];_0x10b06b<_0x393f56;_0x10b06b++){_0x5ed87f[_0x10b06b][_0xd5bf('0xfd')]({'exitAt':_0x2c3177});}}})[_0xd5bf('0x1f')](function(){var _0x336dc7=[];var _0x48a013=utils['getChannels']();_0x48a013[_0xd5bf('0xf2')](function(_0x1fee00){_0x336dc7[_0xd5bf('0x40')]({'channel':_0x1fee00,'membername':_0x1422fb[_0xd5bf('0x2b')],'interface':_[_0xd5bf('0x59')](_0x1422fb[_0xd5bf('0x93')])?util[_0xd5bf('0x9c')](_0xd5bf('0x9d'),_0x1422fb['name']):_0x1422fb[_0xd5bf('0x93')],'type':'PAUSE','enterAt':moment()['format'](_0xd5bf('0xf3')),'data1':_0x526415[_0xd5bf('0x4f')]['type']||_0xd5bf('0xfe'),'role':_0x1422fb['role'],'internal':_0x1422fb[_0xd5bf('0x54')]});});return db[_0xd5bf('0xf1')][_0xd5bf('0xf8')](_0x336dc7,{'individualHooks':!![]});})[_0xd5bf('0x1f')](function(){return _0x1422fb[_0xd5bf('0x1a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x526415[_0xd5bf('0x4f')][_0xd5bf('0x31')]||_0xd5bf('0xfe'),'lastPauseAt':moment()[_0xd5bf('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x121864,null))[_0xd5bf('0x4b')](handleError(_0x121864,null));};exports[_0xd5bf('0xff')]=function(_0xbb5b8d,_0x1d0fe2){if(_0xbb5b8d[_0xd5bf('0x4f')][_0xd5bf('0x8f')]&&!utils['isValidChannel'](_0xbb5b8d[_0xd5bf('0x4f')][_0xd5bf('0x8f')])){throw new APIBadRequestError(util[_0xd5bf('0x9c')](_0xd5bf('0x100'),_0xbb5b8d['body'][_0xd5bf('0x8f')]));}return db[_0xd5bf('0x2e')][_0xd5bf('0x2a')]({'where':{'id':_0xbb5b8d[_0xd5bf('0x4d')]['id']},'attributes':['id','name','role',_0xd5bf('0x54'),_0xd5bf('0x93'),_0xd5bf('0x90'),_0xd5bf('0x92'),'mailPause',_0xd5bf('0x101'),_0xd5bf('0x102'),'openchannelPause',_0xd5bf('0x103'),_0xd5bf('0x104'),_0xd5bf('0x105'),_0xd5bf('0x106')]})['then'](function(_0x2321c1){if(!_0x2321c1){throw new APINotFoundError(util['format'](_0xd5bf('0xbb'),_0xbb5b8d['params']['id']));}return _0x2321c1[_0xd5bf('0xff')](_0xbb5b8d['body'][_0xd5bf('0x8f')]);})[_0xd5bf('0x1f')](respondWithResult(_0x1d0fe2,null))[_0xd5bf('0x4b')](APIHandleError(_0x1d0fe2));};exports['getTeams']=function(_0xc15887,_0xb9bc61){var _0xcb834b={};var _0x241b43={};var _0x3d21c4;var _0x989ddf;return db[_0xd5bf('0x2e')]['findOne']({'where':{'id':_0xc15887[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0xb9bc61,null))['then'](function(_0x5f50cf){if(_0x5f50cf){_0x3d21c4=_0x5f50cf;_0x241b43[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_0xd5bf('0x107')][_0xd5bf('0xc8')]);_0x241b43[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0xc15887['query']);_0x241b43['filters']=_[_0xd5bf('0xc9')](_0x241b43[_0xd5bf('0xc5')],_0x241b43[_0xd5bf('0x39')]);_0xcb834b['attributes']=_['intersection'](_0x241b43[_0xd5bf('0xc5')],qs[_0xd5bf('0xd5')](_0xc15887[_0xd5bf('0x39')][_0xd5bf('0xd5')]));_0xcb834b[_0xd5bf('0x3f')]=_0xcb834b['attributes'][_0xd5bf('0x44')]?_0xcb834b['attributes']:_0x241b43[_0xd5bf('0xc5')];_0xcb834b[_0xd5bf('0xca')]=qs[_0xd5bf('0xcb')](_0xc15887['query'][_0xd5bf('0xcb')]);_0xcb834b[_0xd5bf('0xcc')]=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0xc15887[_0xd5bf('0x39')],_0x241b43[_0xd5bf('0xcd')]));if(_0xc15887[_0xd5bf('0x39')][_0xd5bf('0x33')]){_0xcb834b[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0xcb834b[_0xd5bf('0xcc')],{'$or':_['map'](_0xcb834b[_0xd5bf('0x3f')],function(_0x2ccd11){var _0x49bd3f={};_0x49bd3f[_0x2ccd11]={'$like':'%'+_0xc15887[_0xd5bf('0x39')][_0xd5bf('0x33')]+'%'};return _0x49bd3f;})});}_0xcb834b=_['merge']({},_0xcb834b,_0xc15887[_0xd5bf('0x4e')]);return _0x3d21c4[_0xd5bf('0x108')](_0xcb834b);}})[_0xd5bf('0x1f')](function(_0x39afa1){if(_0x39afa1){_0x989ddf=_0x39afa1[_0xd5bf('0x44')];if(!_0xc15887[_0xd5bf('0x39')][_0xd5bf('0xbc')](_0xd5bf('0xd1'))){_0xcb834b[_0xd5bf('0x17')]=qs[_0xd5bf('0x17')](_0xc15887['query']['limit']);_0xcb834b['offset']=qs[_0xd5bf('0x15')](_0xc15887['query'][_0xd5bf('0x15')]);}return _0x3d21c4[_0xd5bf('0x108')](_0xcb834b);}})[_0xd5bf('0x1f')](function(_0x4bd39e){if(_0x4bd39e){return _0x4bd39e?{'count':_0x989ddf,'rows':_0x4bd39e}:null;}})['then'](respondWithResult(_0xb9bc61,null))['catch'](handleError(_0xb9bc61,null));};exports[_0xd5bf('0x109')]=function(_0x4f20dd,_0x28a61a){var _0x56a958=_0x4f20dd[_0xd5bf('0x4d')]['id'];var _0xbc255d=_0x4f20dd['body']?_0x4f20dd[_0xd5bf('0x4f')][_0xd5bf('0x52')]:null;var _0x56fa89=[];return Promise[_0xd5bf('0xfa')]()[_0xd5bf('0x1f')](function(){if(!_0xbc255d)throw new APIBadRequestError(_0xd5bf('0x10a'));})[_0xd5bf('0x1f')](function(){return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x56a958}});})[_0xd5bf('0x1f')](function(_0x1e97c0){if(!_0x1e97c0)throw new APINotFoundError(util[_0xd5bf('0x9c')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4f20dd[_0xd5bf('0x4d')]['id']));return db[_0xd5bf('0x5b')][_0xd5bf('0x10b')](function(_0x15f57e){return _0x1e97c0[_0xd5bf('0x109')](_0xbc255d,{'transaction':_0x15f57e})[_0xd5bf('0x1f')](function(){return db[_0xd5bf('0x107')][_0xd5bf('0x41')]({'where':{'id':{'$in':_0xbc255d}}});})[_0xd5bf('0x1f')](function(_0x266b93){var _0x1760e4=_['map'](_0x266b93,function(_0x236d43){return _0x236d43[_0xd5bf('0x10c')]();});return Promise[_0xd5bf('0x4a')](_0x1760e4);})['then'](function(_0x24d6b3){_0x56fa89=_['flattenDeep'](_0x24d6b3);var _0x2e3aca=_[_0xd5bf('0x2f')](_0x56fa89,function(_0x3ebb3e){return _0x3ebb3e[_0xd5bf('0x10d')](_0x1e97c0['id'],{'transaction':_0x15f57e});});return Promise['all'](_0x2e3aca);})[_0xd5bf('0x1f')](function(){if(!_0x1e97c0['online'])return;var _0x2c09f0=_[_0xd5bf('0x33')](_0x56fa89,function(_0x4d48ce){return _0x4d48ce['getDataValue'](_0xd5bf('0x8f'))===_0xd5bf('0x10e');});var _0x4d8fee=_[_0xd5bf('0x2f')](_0x2c09f0,function(_0x4e11c6){return db[_0xd5bf('0xa4')][_0xd5bf('0x9f')]({'membername':_0x1e97c0['name'],'UserId':_0x1e97c0['id'],'queue_name':_0x4e11c6['name'],'VoiceQueueId':_0x4e11c6['id'],'interface':_['isNil'](_0x1e97c0[_0xd5bf('0x93')])?util['format'](_0xd5bf('0x9d'),_0x1e97c0[_0xd5bf('0x2b')]):_0x1e97c0[_0xd5bf('0x93')],'paused':_0x1e97c0[_0xd5bf('0x92')]||![],'penalty':_0x1e97c0[_0xd5bf('0x9e')]},{'transaction':_0x15f57e});});return Promise[_0xd5bf('0x4a')](_0x4d8fee);})[_0xd5bf('0x1f')](function(){return db[_0xd5bf('0x10f')][_0xd5bf('0x41')]({'where':{'teamId':{'$in':_0xbc255d}}});})[_0xd5bf('0x1f')](function(_0x3ab4e3){var _0x430840=_[_0xd5bf('0x2f')](_0x3ab4e3,function(_0x44b3ee){return db[_0xd5bf('0x110')][_0xd5bf('0x70')]({'UserId':_0x1e97c0['id'],'VoicePrefixId':_0x44b3ee[_0xd5bf('0x111')]},{'transaction':_0x15f57e});});return Promise[_0xd5bf('0x4a')](_0x430840);});});})['then'](function(){for(var _0x1f651f=0x0;_0x1f651f<_0x56fa89[_0xd5bf('0x44')];_0x1f651f++){var _0x2eff6c=_0x56fa89[_0x1f651f][_0xd5bf('0x112')](_0xd5bf('0x8f'));var _0x184a89=_0x2eff6c+_0xd5bf('0x99');socket[_0xd5bf('0x1d')]('user'+_0x2eff6c+_0xd5bf('0x113'),{'UserId':_0x56a958,['queueField']:_0x56fa89[_0x1f651f]['id']});}})['then'](respondWithStatusCode(_0x28a61a,null))[_0xd5bf('0x4b')](APIHandleError(_0x28a61a));};exports[_0xd5bf('0x114')]=function(_0x403719,_0x5745e7){var _0x35eef4=_0x403719['params']['id'];var _0x5bc847=null;if(_0x403719[_0xd5bf('0x39')][_0xd5bf('0x52')]){_0x5bc847=_[_0xd5bf('0xa2')](_0x403719[_0xd5bf('0x39')]['ids'])?_0x403719['query'][_0xd5bf('0x52')]:[_0x403719[_0xd5bf('0x39')][_0xd5bf('0x52')]];}var _0x31154d=[];return Promise['resolve']()['then'](function(){if(!_0x5bc847)throw new APIBadRequestError(_0xd5bf('0x115'));})[_0xd5bf('0x1f')](function(){return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x35eef4}});})['then'](function(_0x620ded){if(!_0x620ded)throw new APINotFoundError(util[_0xd5bf('0x9c')](_0xd5bf('0xbb'),_0x403719['params']['id']));return db[_0xd5bf('0x5b')][_0xd5bf('0x10b')](function(_0x2ab1bc){return _0x620ded['removeTeams'](_0x5bc847,{'transaction':_0x2ab1bc})['then'](function(){return db[_0xd5bf('0x107')][_0xd5bf('0x41')]({'where':{'id':{'$in':_0x5bc847}}});})['then'](function(_0x484872){var _0x3f7566=_[_0xd5bf('0x2f')](_0x484872,function(_0x1f0f11){return _0x1f0f11[_0xd5bf('0x10c')]();});return Promise[_0xd5bf('0x4a')](_0x3f7566);})['then'](function(_0x57646a){_0x31154d=_[_0xd5bf('0x116')](_0x57646a);var _0xab1f1c=_[_0xd5bf('0x2f')](_0x31154d,function(_0x1ce6d5){return _0x1ce6d5['removeAgent'](_0x620ded['id'],{'transaction':_0x2ab1bc});});return Promise['all'](_0xab1f1c);})[_0xd5bf('0x1f')](function(){if(!_0x620ded[_0xd5bf('0x90')])return;var _0x2be202=_['filter'](_0x31154d,function(_0x2ce840){return _0x2ce840['getDataValue'](_0xd5bf('0x8f'))==='Voice';});var _0x378844=_[_0xd5bf('0x2f')](_0x2be202,function(_0x49c06c){return db[_0xd5bf('0xa4')][_0xd5bf('0x1e')]({'where':{'VoiceQueueId':_0x49c06c['id'],'UserId':_0x620ded['id']},'transaction':_0x2ab1bc});});return Promise[_0xd5bf('0x4a')](_0x378844);})[_0xd5bf('0x1f')](function(){return db[_0xd5bf('0x10f')][_0xd5bf('0x41')]({'where':{'teamId':{'$in':_0x5bc847}}});})[_0xd5bf('0x1f')](function(_0x527fde){var _0x1c7178=_[_0xd5bf('0x2f')](_0x527fde,function(_0x1a85b6){return db[_0xd5bf('0x110')][_0xd5bf('0x1e')]({'where':{'UserId':_0x620ded['id'],'VoicePrefixId':_0x1a85b6[_0xd5bf('0x111')]}},{'transaction':_0x2ab1bc});});return Promise['all'](_0x1c7178);});});})[_0xd5bf('0x1f')](function(){for(var _0x4432be=0x0;_0x4432be<_0x31154d[_0xd5bf('0x44')];_0x4432be++){var _0x2cf833=_0x31154d[_0x4432be][_0xd5bf('0x112')](_0xd5bf('0x8f'));var _0x2652b2=_0x2cf833+_0xd5bf('0x99');socket[_0xd5bf('0x1d')](_0xd5bf('0x23')+_0x2cf833+_0xd5bf('0xa3'),{'UserId':_0x35eef4,['queueField']:_0x31154d[_0x4432be]['id']});}})['then'](respondWithStatusCode(_0x5745e7,null))[_0xd5bf('0x4b')](APIHandleError(_0x5745e7));};exports[_0xd5bf('0x117')]=function(_0x30e977,_0x42f5a7){var _0xbd1703={};var _0x4982bf={};var _0x25c50b;var _0x577950;return db[_0xd5bf('0x2e')][_0xd5bf('0x88')]({'where':{'id':_0x30e977[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x42f5a7,null))[_0xd5bf('0x1f')](function(_0x837532){if(_0x837532){_0x25c50b=_0x837532;_0x4982bf[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_0xd5bf('0xbd')]['rawAttributes']);_0x4982bf[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x30e977[_0xd5bf('0x39')]);_0x4982bf[_0xd5bf('0xcd')]=_['intersection'](_0x4982bf[_0xd5bf('0xc5')],_0x4982bf[_0xd5bf('0x39')]);_0xbd1703['attributes']=_[_0xd5bf('0xc9')](_0x4982bf[_0xd5bf('0xc5')],qs[_0xd5bf('0xd5')](_0x30e977[_0xd5bf('0x39')][_0xd5bf('0xd5')]));_0xbd1703['attributes']=_0xbd1703['attributes'][_0xd5bf('0x44')]?_0xbd1703[_0xd5bf('0x3f')]:_0x4982bf[_0xd5bf('0xc5')];_0xbd1703[_0xd5bf('0xca')]=qs[_0xd5bf('0xcb')](_0x30e977[_0xd5bf('0x39')][_0xd5bf('0xcb')]);_0xbd1703['where']=qs['filters'](_[_0xd5bf('0xce')](_0x30e977['query'],_0x4982bf[_0xd5bf('0xcd')]));if(_0x30e977['query'][_0xd5bf('0x33')]){_0xbd1703[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0xbd1703[_0xd5bf('0xcc')],{'$or':_[_0xd5bf('0x2f')](_0xbd1703['attributes'],function(_0x371e7e){var _0x21af48={};_0x21af48[_0x371e7e]={'$like':'%'+_0x30e977[_0xd5bf('0x39')][_0xd5bf('0x33')]+'%'};return _0x21af48;})});}_0xbd1703=_[_0xd5bf('0xcf')]({},_0xbd1703,_0x30e977[_0xd5bf('0x4e')]);return _0x25c50b['getLists'](_0xbd1703);}})[_0xd5bf('0x1f')](function(_0xddc260){if(_0xddc260){_0x577950=_0xddc260['length'];if(!_0x30e977[_0xd5bf('0x39')][_0xd5bf('0xbc')]('nolimit')){_0xbd1703[_0xd5bf('0x17')]=qs[_0xd5bf('0x17')](_0x30e977['query'][_0xd5bf('0x17')]);_0xbd1703['offset']=qs[_0xd5bf('0x15')](_0x30e977[_0xd5bf('0x39')]['offset']);}return _0x25c50b[_0xd5bf('0x117')](_0xbd1703);}})[_0xd5bf('0x1f')](function(_0x4d3ceb){if(_0x4d3ceb){return _0x4d3ceb?{'count':_0x577950,'rows':_0x4d3ceb}:null;}})[_0xd5bf('0x1f')](respondWithResult(_0x42f5a7,null))[_0xd5bf('0x4b')](handleError(_0x42f5a7,null));};exports[_0xd5bf('0x118')]=function(_0x520e98,_0x33f40c){var _0x4d5e02={};var _0x293208={};var _0x1a8c8f;return db['User']['findOne']({'where':{'id':_0x520e98[_0xd5bf('0x4d')]['id']}})[_0xd5bf('0x1f')](handleEntityNotFound(_0x33f40c,null))[_0xd5bf('0x1f')](function(_0x2b017b){if(_0x2b017b){_0x1a8c8f=_0x2b017b;_0x293208[_0xd5bf('0xc5')]=_[_0xd5bf('0xc6')](db[_0xd5bf('0x2e')][_0xd5bf('0xc8')]);_0x293208[_0xd5bf('0x39')]=_[_0xd5bf('0xc6')](_0x520e98[_0xd5bf('0x39')]);_0x293208[_0xd5bf('0xcd')]=_['intersection'](_0x293208['model'],_0x293208[_0xd5bf('0x39')]);_0x4d5e02['attributes']=_['intersection'](_0x293208['model'],qs[_0xd5bf('0xd5')](_0x520e98[_0xd5bf('0x39')][_0xd5bf('0xd5')]));_0x4d5e02[_0xd5bf('0x3f')]=_0x4d5e02[_0xd5bf('0x3f')][_0xd5bf('0x44')]?_0x4d5e02[_0xd5bf('0x3f')]:_0x293208[_0xd5bf('0xc5')];_0x4d5e02[_0xd5bf('0xca')]=qs['sort'](_0x520e98[_0xd5bf('0x39')][_0xd5bf('0xcb')]);_0x4d5e02[_0xd5bf('0xcc')]=qs[_0xd5bf('0xcd')](_[_0xd5bf('0xce')](_0x520e98['query'],_0x293208[_0xd5bf('0xcd')]));if(_0x520e98[_0xd5bf('0x39')][_0xd5bf('0x33')]){_0x4d5e02[_0xd5bf('0xcc')]=_[_0xd5bf('0xcf')](_0x4d5e02[_0xd5bf('0xcc')],{'$or':_[_0xd5bf('0x2f')](_0x4d5e02[_0xd5bf('0x3f')],function(_0x1e5c02){var _0x1f2938={};_0x1f2938[_0x1e5c02]={'$like':'%'+_0x520e98[_0xd5bf('0x39')][_0xd5bf('0x33')]+'%'};return _0x1f2938;})});}_0x4d5e02[_0xd5bf('0xc5')]=db[_0xd5bf('0x2e')];_0x4d5e02['as']=_0xd5bf('0x24');_0x4d5e02=_[_0xd5bf('0xcf')]({},_0x4d5e02,_0x520e98[_0xd5bf('0x4e')]);return _0x1a8c8f[_0xd5bf('0x119')]({'include':[_0x4d5e02]});}})['then'](function(_0x4afab5){if(_0x4afab5){var _0x2f9c87={},_0x16bdd0=[];for(var _0x72ef50=0x0;_0x72ef50<_0x4afab5[_0xd5bf('0x44')];_0x72ef50+=0x1){for(var _0x520e2a=0x0,_0x36ef91;_0x520e2a<_0x4afab5[_0x72ef50][_0xd5bf('0x24')]['length'];_0x520e2a+=0x1){_0x36ef91=_0x4afab5[_0x72ef50][_0xd5bf('0x24')][_0x520e2a][_0xd5bf('0x20')]({'plain':!![]});_0x2f9c87[_0x36ef91['id']]=_0x36ef91;}}_0x2f9c87=_[_0xd5bf('0x11a')](_0x2f9c87);for(var _0x178d63=qs[_0xd5bf('0x15')](_0x520e98[_0xd5bf('0x39')][_0xd5bf('0x15')]);_0x178d63<_0x2f9c87[_0xd5bf('0x44')]&&_0x16bdd0[_0xd5bf('0x44')]=_0x35695e){_0x413c81=_0x35695e;_0x108441=0xc8;}else{_0x108441=0xce;}_0x1cc930[_0x8de5('0x17')](_0x108441);return _0x1cc930[_0x8de5('0x1d')](_0x8de5('0x1e'),_0x50ae1d+'-'+_0x413c81+'/'+_0x35695e)[_0x8de5('0x18')](_0xcfe82a);}return null;};}function saveUpdates(_0x34dba6){return function(_0x2816e4){if(_0x2816e4){return _0x2816e4[_0x8de5('0x1f')](_0x34dba6)['then'](function(_0x4fac7a){if(_0x4fac7a[_0x8de5('0x20')]===_0x8de5('0x21')){socket['emit'](_0x8de5('0x22')+_0x4fac7a['id'],_0x4fac7a);}return _0x4fac7a;});}return null;};}function removeEntity(_0x5773a5){return function(_0x5e3c67){if(_0x5e3c67){return _0x5e3c67['destroy']()[_0x8de5('0x23')](function(){var _0x12aef0=_0x5e3c67[_0x8de5('0x24')]({'plain':!![]});if(_0x12aef0[_0x8de5('0x20')]==='admin')return;var _0x85fdbf=[{'name':'Users','value':_0x8de5('0x25'),'ignore':!![]},{'name':'Agents','value':_0x8de5('0x21'),'ignore':![]},{'name':_0x8de5('0x26'),'value':'telephone','ignore':![]}];var _0x33627b=_(_0x85fdbf)[_0x8de5('0x27')](_0x8de5('0x28'))['map'](_0x8de5('0x29'))['value']();if(_[_0x8de5('0x2a')](_0x33627b,_0x12aef0[_0x8de5('0x20')])){return;}var _0x52c8f0=_[_0x8de5('0x2b')](_0x85fdbf,[_0x8de5('0x29'),_0x12aef0[_0x8de5('0x20')]])[_0x8de5('0x2c')];return db[_0x8de5('0x2d')][_0x8de5('0x2e')]({'where':{'type':_0x52c8f0,'resourceId':_0x12aef0['id']}})[_0x8de5('0x23')](function(){return _0x5e3c67;});})[_0x8de5('0x23')](function(){_0x5773a5[_0x8de5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa872e8){return function(_0x3b34a4){if(!_0x3b34a4){_0xa872e8['sendStatus'](0x194);}return _0x3b34a4;};}function handleError(_0x208970,_0x3fb340){_0x3fb340=_0x3fb340||0x1f4;return function(_0x40018b){logger[_0x8de5('0x2f')](_0x40018b[_0x8de5('0x30')]);if(_0x40018b[_0x8de5('0x2c')]){delete _0x40018b[_0x8de5('0x2c')];}_0x208970['status'](_0x3fb340)[_0x8de5('0x31')](_0x40018b);};}function getUserAttributes(){return _(db[_0x8de5('0x32')][_0x8de5('0x33')])[_0x8de5('0x34')](function(_0x572214){return{'name':_0x572214[_0x8de5('0x35')],'type':_0x572214[_0x8de5('0x36')][_0x8de5('0x37')]};})[_0x8de5('0x27')](function(_0x15913b){return![_0x8de5('0x38'),'salt',_0x8de5('0x39'),_0x8de5('0x3a'),_0x8de5('0x3b'),_0x8de5('0x3c')]['includes'](_0x15913b['name']);})['value']();}exports[_0x8de5('0x3d')]=function(_0x40492c,_0x180d8c){var _0x46dcd3={},_0x5a4051={'count':0x0,'rows':[]};var _0x58586b=getUserAttributes();_0x46dcd3=qs[_0x8de5('0x3e')](_0x58586b,_0x40492c);var _0x443303={'where':_0x46dcd3[_0x8de5('0x3f')]};return db[_0x8de5('0x32')][_0x8de5('0x1c')](_0x443303)[_0x8de5('0x23')](function(_0xfe4194){_0x5a4051[_0x8de5('0x1c')]=_0xfe4194;if(_0x40492c[_0x8de5('0x40')]['includeAll']){_0x46dcd3[_0x8de5('0x41')]=[{'all':!![]}];}if(_0x40492c[_0x8de5('0x40')]['userSetting']===_0x8de5('0x42')){_0x46dcd3[_0x8de5('0x41')]=[{'model':db[_0x8de5('0x43')],'as':'userSetting'}];}if(!_[_0x8de5('0x2a')](_0x46dcd3[_0x8de5('0x44')],'id')){_0x46dcd3[_0x8de5('0x44')][_0x8de5('0x45')]('id');}return db['User'][_0x8de5('0x46')](_0x46dcd3);})[_0x8de5('0x23')](function(_0x1bb323){_0x5a4051[_0x8de5('0x47')]=_0x1bb323;if(_0x40492c[_0x8de5('0x40')][_0x8de5('0x48')]===_0x8de5('0x42')){var _0x385e7f=[];for(var _0x570a76=0x0;_0x570a76<_0x5a4051[_0x8de5('0x47')][_0x8de5('0x49')];_0x570a76++){_0x385e7f['push'](get_open_tabs(_0x8de5('0x4a'),_0x5a4051[_0x8de5('0x47')][_0x570a76][_0x8de5('0x4b')]));_0x385e7f[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x4c'),_0x5a4051[_0x8de5('0x47')][_0x570a76][_0x8de5('0x4b')]));_0x385e7f['push'](get_open_tabs(_0x8de5('0x4d'),_0x5a4051[_0x8de5('0x47')][_0x570a76][_0x8de5('0x4b')]));_0x385e7f[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x4e'),_0x5a4051[_0x8de5('0x47')][_0x570a76][_0x8de5('0x4b')]));_0x385e7f[_0x8de5('0x45')](get_open_tabs('openchannel',_0x5a4051['rows'][_0x570a76][_0x8de5('0x4b')]));_0x385e7f[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x4f'),_0x5a4051[_0x8de5('0x47')][_0x570a76][_0x8de5('0x4b')]));}return Promise['all'](_0x385e7f)[_0x8de5('0x23')](function(){return _0x5a4051;});}else{return _0x5a4051;}})[_0x8de5('0x23')](respondWithFilteredResult(_0x180d8c,_0x46dcd3))['catch'](handleError(_0x180d8c,null));};exports[_0x8de5('0x50')]=function(_0x2bc0ee,_0x3063f3){var _0x5e4c31=getUserAttributes();_0x2bc0ee[_0x8de5('0x40')]['id']=_0x2bc0ee[_0x8de5('0x51')]['id'];var _0x228d04=qs[_0x8de5('0x3e')](_0x5e4c31,_0x2bc0ee);if(_0x2bc0ee[_0x8de5('0x40')][_0x8de5('0x52')]){_0x228d04[_0x8de5('0x41')]=[{'all':!![]}];}if(_0x2bc0ee[_0x8de5('0x40')][_0x8de5('0x53')]===_0x8de5('0x42')){_0x228d04[_0x8de5('0x41')]=[{'model':db[_0x8de5('0x43')],'as':_0x8de5('0x53')}];}_0x228d04=_['merge']({},_0x228d04,_0x2bc0ee[_0x8de5('0x54')]);if(!_[_0x8de5('0x2a')](_0x228d04[_0x8de5('0x44')],'id')){_0x228d04[_0x8de5('0x44')][_0x8de5('0x45')]('id');}return db[_0x8de5('0x32')][_0x8de5('0x2b')](_0x228d04)['then'](handleEntityNotFound(_0x3063f3,null))[_0x8de5('0x23')](function(_0x5d03ce){var _0x123fcb=[];values=_0x5d03ce;if(_0x2bc0ee[_0x8de5('0x40')][_0x8de5('0x48')]===_0x8de5('0x42')){_0x123fcb[_0x8de5('0x45')](get_open_tabs('chat',_0x5d03ce['dataValues']));_0x123fcb['push'](get_open_tabs(_0x8de5('0x4c'),_0x5d03ce[_0x8de5('0x4b')]));_0x123fcb[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x55'),_0x5d03ce['dataValues']));_0x123fcb[_0x8de5('0x45')](get_open_tabs('whatsapp',_0x5d03ce[_0x8de5('0x4b')]));_0x123fcb[_0x8de5('0x45')](get_open_tabs('fax',_0x5d03ce[_0x8de5('0x4b')]));_0x123fcb[_0x8de5('0x45')](get_open_tabs('mail',_0x5d03ce[_0x8de5('0x4b')]));return Promise[_0x8de5('0x56')](_0x123fcb);}else{return values;}})[_0x8de5('0x23')](function(){return values;})[_0x8de5('0x23')](respondWithResult(_0x3063f3,null))['catch'](handleError(_0x3063f3,null));};exports[_0x8de5('0x1f')]=function(_0x2d5b88,_0x4a7cce){if(_0x2d5b88[_0x8de5('0x57')]['id']){delete _0x2d5b88['body']['id'];}delete _0x2d5b88[_0x8de5('0x57')]['role'];return db[_0x8de5('0x32')][_0x8de5('0x2b')]({'where':{'id':_0x2d5b88[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x4a7cce,null))[_0x8de5('0x23')](saveUpdates(_0x2d5b88[_0x8de5('0x57')],null))[_0x8de5('0x23')](respondWithResult(_0x4a7cce,null))[_0x8de5('0x58')](handleError(_0x4a7cce,null));};exports[_0x8de5('0x59')]=function(_0x3704ed,_0x5c07b6){return db[_0x8de5('0x32')][_0x8de5('0x59')]()[_0x8de5('0x23')](respondWithResult(_0x5c07b6,null))[_0x8de5('0x58')](handleError(_0x5c07b6,null));};exports[_0x8de5('0x5a')]=function(_0x295ce3,_0x1303cb){return db[_0x8de5('0x32')][_0x8de5('0x2b')]({'where':{'id':_0x295ce3['params']['id']}})['then'](handleEntityNotFound(_0x1303cb,null))['then'](function(_0x24a38e){if(_0x24a38e){return _0x24a38e['addContacts'](_0x295ce3[_0x8de5('0x57')]['ids'],_[_0x8de5('0x5b')](_0x295ce3[_0x8de5('0x57')],[_0x8de5('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x1303cb,null))['catch'](handleError(_0x1303cb,null));};function validateUser(_0x49580a){return new Promise(function(_0x25fab0,_0xafc1db){if(_0x49580a[_0x8de5('0x5d')])return _0x25fab0(_0x49580a);return db[_0x8de5('0x5e')][_0x8de5('0x5f')](0x1)[_0x8de5('0x23')](function(_0xbaaac1){if(_0xbaaac1[_0x8de5('0x60')])authService['validatePasswordPattern'](_0x49580a[_0x8de5('0x38')]);db['User'][_0x8de5('0x61')]('internal')['then'](function(_0xec9c07){if(_[_0x8de5('0x62')](_0xec9c07)){_0x49580a[_0x8de5('0x5d')]=_0xbaaac1[_0x8de5('0x63')]||0x1;return;}if(_['isNil'](_0xbaaac1[_0x8de5('0x63')])||_0xbaaac1[_0x8de5('0x63')]===_0xec9c07){_0x49580a[_0x8de5('0x5d')]=_0xec9c07+0x1;return;}if(_0xbaaac1[_0x8de5('0x63')]>_0xec9c07){_0x49580a[_0x8de5('0x5d')]=_0xbaaac1[_0x8de5('0x63')];return;}return db[_0x8de5('0x64')][_0x8de5('0x40')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x8de5('0x64')][_0x8de5('0x65')][_0x8de5('0x66')]})['then'](function(_0x2fb61c){if(_0x2fb61c&&_0x2fb61c[_0x8de5('0x49')]){for(var _0x207cb8=0x0,_0x485378=_0x2fb61c[_0x8de5('0x49')];_0x207cb8<_0x485378&&_[_0x8de5('0x62')](_0x49580a['internal']);_0x207cb8++){if(_0xbaaac1['min_internal']<=_0x2fb61c[_0x207cb8][_0x8de5('0x67')]){_0x49580a[_0x8de5('0x5d')]=_0x2fb61c[_0x207cb8][_0x8de5('0x67')];}else if(_0xbaaac1[_0x8de5('0x63')]>_0x2fb61c[_0x207cb8][_0x8de5('0x67')]&&_0xbaaac1[_0x8de5('0x63')]<=_0x2fb61c[_0x207cb8]['to']){_0x49580a[_0x8de5('0x5d')]=_0xbaaac1['min_internal'];}}}if(_[_0x8de5('0x62')](_0x49580a[_0x8de5('0x5d')])){_0x49580a['internal']=_0xec9c07+0x1;}return _0x25fab0(_0x49580a);});});})[_0x8de5('0x58')](function(_0x580faf){_0xafc1db(_0x580faf);});});}function updateUser(_0x4eeed0){return new Promise(function(_0x55afbb,_0x55f06a){try{if(_0x4eeed0[_0x8de5('0x68')]){_0x4eeed0[_0x8de5('0x69')]=_0x4eeed0[_0x8de5('0x5d')];_0x4eeed0[_0x8de5('0x6a')]={'mailbox':_0x4eeed0[_0x8de5('0x5d')],'password':_0x4eeed0[_0x8de5('0x38')],'fullname':_0x4eeed0[_0x8de5('0x6b')],'email':_0x4eeed0[_0x8de5('0x6c')]};}if(_0x4eeed0[_0x8de5('0x20')]===_0x8de5('0x21')){if(!_0x4eeed0[_0x8de5('0x6d')])_0x4eeed0[_0x8de5('0x6d')]=[_0x8de5('0x6e'),_0x8de5('0x6f'),_0x8de5('0x70'),'113','110','104',_0x8de5('0x71'),_0x8de5('0x72'),_0x8de5('0x73'),'108',_0x8de5('0x74'),_0x8de5('0x75'),_0x8de5('0x76'),'114','115'];}_0x55afbb(_0x4eeed0);}catch(_0x440584){_0x55f06a(_0x440584);}});}exports[_0x8de5('0x77')]=function(_0x36cd01,_0x258124){if(_0x36cd01[_0x8de5('0x25')][_0x8de5('0x20')]===_0x8de5('0x21'))throw new Error('Unauthorized');if(_0x36cd01[_0x8de5('0x57')][_0x8de5('0x20')]===_0x8de5('0x25')&&_0x36cd01[_0x8de5('0x25')][_0x8de5('0x20')]!==_0x8de5('0x78')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x36cd01[_0x8de5('0x57')]['role']==='admin'&&_0x36cd01['user'][_0x8de5('0x20')]!=='admin'){throw new Error(_0x8de5('0x79'));}return licenseUtil[_0x8de5('0x7a')]([_0x36cd01[_0x8de5('0x57')]])[_0x8de5('0x23')](function(){return validateUser(_0x36cd01[_0x8de5('0x57')]);})[_0x8de5('0x23')](function(_0xa51e22){return updateUser(_0xa51e22)[_0x8de5('0x23')](function(_0x1a63d6){if(_0x1a63d6[_0x8de5('0x20')]==='admin'){_0x1a63d6[_0x8de5('0x7b')]=_0x36cd01[_0x8de5('0x25')][_0x8de5('0x7b')];delete _0x1a63d6[_0x8de5('0x7c')];}return _0x1a63d6;});})[_0x8de5('0x23')](function(_0x3ad645){return db[_0x8de5('0x32')][_0x8de5('0x77')](_0x3ad645,{'include':[{'model':db['VoiceMail'],'as':_0x8de5('0x6a')}]});})[_0x8de5('0x23')](function(_0x53fd94){if(_0x36cd01['body'][_0x8de5('0x20')]===_0x8de5('0x25'))return _0x53fd94;if(_0x36cd01[_0x8de5('0x25')]['role']!==_0x8de5('0x25'))return _0x53fd94;return db['UserProfileSection'][_0x8de5('0x2b')]({'where':{'name':_0x53fd94['role']===_0x8de5('0x21')?_0x8de5('0x7d'):_0x8de5('0x26'),'userProfileId':_0x36cd01[_0x8de5('0x25')]['userProfileId']},'raw':!![]})[_0x8de5('0x23')](function(_0x13f07e){if(!_0x13f07e||_0x13f07e[_0x8de5('0x7e')]!=0x0)return _0x53fd94;return db[_0x8de5('0x2d')][_0x8de5('0x77')]({'name':_0x53fd94[_0x8de5('0x2c')],'resourceId':_0x53fd94['id'],'type':_0x13f07e[_0x8de5('0x2c')],'sectionId':_0x13f07e['id']},{})['then'](function(){return _0x53fd94;});})[_0x8de5('0x58')](function(_0x544c86){logger['error'](_0x8de5('0x7f'),_0x544c86);throw _0x544c86;});})['then'](respondWithResult(_0x258124,0xc9))['catch'](handleError(_0x258124,null));};exports[_0x8de5('0x80')]=function(_0x53b909,_0x336d7c){var _0x2a07ff=_0x53b909[_0x8de5('0x57')];var _0x15eb26=[];if(_0x53b909[_0x8de5('0x25')]['role']===_0x8de5('0x21'))throw new Error(_0x8de5('0x81'));if(_[_0x8de5('0x82')](_0x2a07ff,['role',_0x8de5('0x25')])&&_0x53b909[_0x8de5('0x25')][_0x8de5('0x20')]!==_0x8de5('0x78')){throw new Error(_0x8de5('0x83'));}if(_['some'](_0x2a07ff,[_0x8de5('0x20'),_0x8de5('0x78')])&&_0x53b909[_0x8de5('0x25')]['role']!==_0x8de5('0x78')){throw new Error(_0x8de5('0x84'));}return licenseUtil['checkUserLimits'](_0x2a07ff)[_0x8de5('0x23')](function(){return validateUser(_0x2a07ff[0x0]);})[_0x8de5('0x23')](function(){for(var _0x1400c1=0x1;_0x1400c1<_0x2a07ff[_0x8de5('0x49')];_0x1400c1++){var _0x32774e=_0x2a07ff[_0x1400c1-0x1]['internal'];if(!_0x2a07ff[_0x1400c1]['internal'])_0x2a07ff[_0x1400c1][_0x8de5('0x5d')]=_0x32774e+0x1;_0x15eb26[_0x8de5('0x45')](validateUser(_0x2a07ff[_0x1400c1]));}return Promise[_0x8de5('0x56')](_0x15eb26);})[_0x8de5('0x23')](function(){_0x15eb26=[];for(var _0x3d38c9=0x0;_0x3d38c9<_0x2a07ff[_0x8de5('0x49')];_0x3d38c9++){_0x15eb26['push'](updateUser(_0x2a07ff[_0x3d38c9]));}return Promise['all'](_0x15eb26);})[_0x8de5('0x23')](function(){_0x15eb26=_0x2a07ff[_0x8de5('0x34')](function(_0x14b96f){return db[_0x8de5('0x32')][_0x8de5('0x77')](_0x14b96f,{'include':[{'model':db[_0x8de5('0x6a')],'as':'VoiceMail'}]})[_0x8de5('0x23')](function(_0x20fc11){_0x14b96f['id']=_0x20fc11['id'];return _0x14b96f;});});return Promise[_0x8de5('0x56')](_0x15eb26);})[_0x8de5('0x23')](function(_0x16ae74){if(_0x53b909[_0x8de5('0x57')][_0x8de5('0x20')]===_0x8de5('0x25'))return _0x16ae74;if(_0x53b909[_0x8de5('0x25')][_0x8de5('0x20')]!=='user')return _0x16ae74;var _0x43333c=_[_0x8de5('0x82')](_0x16ae74,function(_0x1ce48c){return _0x1ce48c['role']==='agent'||_0x1ce48c['role']==='telephone';});if(!_0x43333c)return _0x16ae74;return db[_0x8de5('0x85')][_0x8de5('0x46')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x53b909[_0x8de5('0x25')]['userProfileId']},'raw':!![]})[_0x8de5('0x23')](function(_0x32419a){if(_['isEmpty'](_0x32419a)||!_['some'](_0x32419a,[_0x8de5('0x7e'),0x0]))return _0x16ae74;_0x15eb26=[];var _0x25df1a=_(_0x32419a)[_0x8de5('0x34')](function(_0x2d8873){if(_0x2d8873[_0x8de5('0x7e')]===0x1)return;return _0x2d8873[_0x8de5('0x2c')]===_0x8de5('0x7d')?'agent':_0x8de5('0x86');})[_0x8de5('0x87')]()['value']();for(var _0x1ff085=0x0;_0x1ff085<_0x16ae74[_0x8de5('0x49')];_0x1ff085++){if(!_['includes'](_0x25df1a,_0x16ae74[_0x1ff085][_0x8de5('0x20')]))return;var _0x47452f=_0x16ae74[_0x1ff085]['role']===_0x8de5('0x21')?_0x8de5('0x7d'):_0x8de5('0x26');_0x15eb26[_0x8de5('0x45')](db[_0x8de5('0x2d')]['create']({'name':_0x16ae74[_0x1ff085]['name'],'resourceId':_0x16ae74[_0x1ff085]['id'],'type':_0x47452f,'sectionId':_[_0x8de5('0x2b')](_0x32419a,['name',_0x47452f])['id']},{}));}return Promise['all'](_0x15eb26);});})[_0x8de5('0x23')](respondWithResult(_0x336d7c,0xc9))['catch'](handleError(_0x336d7c,null));};exports[_0x8de5('0x88')]=function(_0x3193b9,_0x18432e){if(_0x3193b9[_0x8de5('0x57')]['id']){delete _0x3193b9[_0x8de5('0x57')]['id'];}return db[_0x8de5('0x32')][_0x8de5('0x2b')]({'where':{'id':_0x3193b9[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](function(_0x26c19c){if(!_0x26c19c)return null;if(_0x26c19c['id']===_0x3193b9['user']['id']){if(!_0x3193b9[_0x8de5('0x57')]['oldPassword']||!_0x3193b9[_0x8de5('0x57')][_0x8de5('0x89')]){throw new db[(_0x8de5('0x8a'))]['ValidationError'](_0x8de5('0x8b'));}if(!_0x26c19c['authenticate'](_0x3193b9[_0x8de5('0x57')][_0x8de5('0x8c')])){throw new db[(_0x8de5('0x8a'))]['ValidationError'](_0x8de5('0x8d'));}if(_0x3193b9['body'][_0x8de5('0x8c')]===_0x3193b9[_0x8de5('0x57')][_0x8de5('0x89')]){throw new db[(_0x8de5('0x8a'))][(_0x8de5('0x8e'))](_0x8de5('0x8f'));}}else if(_0x3193b9[_0x8de5('0x25')][_0x8de5('0x20')]==='admin'){if(!_0x3193b9[_0x8de5('0x57')][_0x8de5('0x89')]){throw new db[(_0x8de5('0x8a'))][(_0x8de5('0x8e'))](_0x8de5('0x90'));}}else if(_0x3193b9[_0x8de5('0x25')]['role']===_0x8de5('0x25')){if(!_0x3193b9['body']['newPassword']){throw new db[(_0x8de5('0x8a'))][(_0x8de5('0x8e'))](_0x8de5('0x90'));}if(_0x26c19c[_0x8de5('0x20')]!==_0x8de5('0x21')){throw new db['Sequelize']['ValidationError'](_0x8de5('0x81'));}}else{throw new db[(_0x8de5('0x8a'))][(_0x8de5('0x8e'))](_0x8de5('0x81'));}return _0x26c19c;})[_0x8de5('0x23')](handleEntityNotFound(_0x18432e,null))[_0x8de5('0x23')](function(_0x4b0277){return db['Setting'][_0x8de5('0x91')]({'attributes':['id',_0x8de5('0x60'),'enforcePasswordHistory',_0x8de5('0x92')]})[_0x8de5('0x23')](function(_0x35cc5f){if(_0x35cc5f[_0x8de5('0x60')])authService[_0x8de5('0x93')](_0x3193b9['body']['newPassword']);if(!_0x35cc5f[_0x8de5('0x94')]||!_0x4b0277[_0x8de5('0x39')])return _0x4b0277;authService[_0x8de5('0x95')](_0x3193b9[_0x8de5('0x57')][_0x8de5('0x89')],_0x4b0277[_0x8de5('0x39')],_0x35cc5f['passwordHistoryLimit']);return _0x4b0277;})[_0x8de5('0x23')](saveUpdates({'password':_0x3193b9['body']['newPassword'],'passwordResetAt':_0x3193b9[_0x8de5('0x25')]['id']==_0x3193b9[_0x8de5('0x51')]['id']?moment():null,'previousPasswords':authService[_0x8de5('0x96')](_0x3193b9[_0x8de5('0x57')][_0x8de5('0x89')],_0x4b0277[_0x8de5('0x39')])},null));})['then'](respondWithResult(_0x18432e,null))[_0x8de5('0x58')](handleError(_0x18432e,null));};exports[_0x8de5('0x97')]=function(_0x135467,_0x330deb){var _0x5f01f7=_0x135467['body']['channel'];return db[_0x8de5('0x32')][_0x8de5('0x2b')]({'where':{'id':_0x135467[_0x8de5('0x51')]['id']},'attributes':['id',_0x8de5('0x2c'),_0x8de5('0x20'),_0x8de5('0x98'),_0x8de5('0x99'),'voicePause',_0x8de5('0x9a')]})[_0x8de5('0x23')](handleEntityNotFound(_0x330deb,null))[_0x8de5('0x23')](function(_0x19e1e2){if(_0x19e1e2){if(!utils[_0x8de5('0x9b')](_0x5f01f7)){throw new db[(_0x8de5('0x8a'))][(_0x8de5('0x8e'))](_0x8de5('0x9c'));}return _0x19e1e2[_0x8de5('0x9d')+_[_0x8de5('0x9e')](_0x5f01f7[_0x8de5('0x9f')]())+_0x8de5('0xa0')](_0x135467[_0x8de5('0x57')][_0x8de5('0x5c')],{'penalty':_0x135467[_0x8de5('0x57')][_0x8de5('0xa1')]||0x0})[_0x8de5('0xa2')](function(_0x3b0d69){for(var _0x7e6abd=0x0;_0x7e6abd<_0x135467[_0x8de5('0x57')][_0x8de5('0x5c')][_0x8de5('0x49')];_0x7e6abd+=0x1){var _0xa87bb5={'UserId':Number(_0x135467[_0x8de5('0x51')]['id'])};_0xa87bb5[_[_0x8de5('0x9e')](_0x5f01f7[_0x8de5('0x9f')]())+_0x8de5('0xa3')]=Number(_0x135467[_0x8de5('0x57')][_0x8de5('0x5c')][_0x7e6abd]);socket['emit'](_0x8de5('0x25')+_[_0x8de5('0x9e')](_0x5f01f7['toLowerCase']())+_0x8de5('0xa4'),_0xa87bb5);}return _0x3b0d69;})['then'](function(){if(_0x5f01f7===_0x8de5('0xa5')){return db[_0x8de5('0xa6')]['findAll']({'where':{'id':_0x135467[_0x8de5('0x57')]['ids']||[]},'raw':!![],'attributes':['id',_0x8de5('0x2c')]});}})[_0x8de5('0x23')](function(_0x3c6ff7){var _0x353699=_0x19e1e2['get']({'plain':!![]});var _0x342e13=[];if(_0x5f01f7===_0x8de5('0xa5')&&_0x353699[_0x8de5('0x20')]===_0x8de5('0x21')&&_0x353699['online']){for(let _0x11aa23=0x0;_0x11aa23<_0x3c6ff7[_0x8de5('0x49')];_0x11aa23+=0x1){_0x342e13['push']({'membername':_0x353699[_0x8de5('0x2c')],'UserId':_0x353699['id'],'queue_name':_0x3c6ff7[_0x11aa23][_0x8de5('0x2c')],'VoiceQueueId':_0x3c6ff7[_0x11aa23]['id'],'interface':_[_0x8de5('0x62')](_0x353699['interface'])?util['format'](_0x8de5('0xa7'),_0x353699[_0x8de5('0x2c')]):_0x353699[_0x8de5('0x9a')],'paused':_0x353699[_0x8de5('0xa8')]||![],'penalty':_0x135467[_0x8de5('0x57')][_0x8de5('0xa1')]||0x0});}return Promise[_0x8de5('0x56')](_0x342e13[_0x8de5('0x34')](function(_0x511f1b){return db[_0x8de5('0xa9')]['upsert'](_0x511f1b);}));}return _0x19e1e2;});}})[_0x8de5('0x23')](respondWithStatusCode(_0x330deb,null))[_0x8de5('0x58')](handleError(_0x330deb,null));};exports['removeQueues']=function(_0x57f9a7,_0x52e4a0){var _0x254f07,_0x1ce0d2;return db[_0x8de5('0x32')][_0x8de5('0x2b')]({'where':{'id':_0x57f9a7[_0x8de5('0x51')]['id']},'attributes':['id','name',_0x8de5('0x20')]})[_0x8de5('0x23')](handleEntityNotFound(_0x52e4a0,null))[_0x8de5('0x23')](function(_0x3dd51e){if(_0x3dd51e){_0x254f07=_0x3dd51e;if(!_0x57f9a7[_0x8de5('0x40')][_0x8de5('0xaa')]||!utils[_0x8de5('0x9b')](_0x57f9a7[_0x8de5('0x40')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x8de5('0x9c'));}return _0x3dd51e[_0x8de5('0xab')+_[_0x8de5('0x9e')](_0x57f9a7[_0x8de5('0x40')][_0x8de5('0xaa')][_0x8de5('0x9f')]())+_0x8de5('0xa0')](_0x57f9a7[_0x8de5('0x40')][_0x8de5('0x5c')]);}})[_0x8de5('0x23')](function(_0x560641){if(_[_0x8de5('0xac')](_0x57f9a7['query']['ids'])){for(var _0x2f3683=0x0;_0x2f3683<_0x57f9a7[_0x8de5('0x40')]['ids']['length'];_0x2f3683+=0x1){_0x1ce0d2={'UserId':Number(_0x57f9a7[_0x8de5('0x51')]['id'])};_0x1ce0d2[_[_0x8de5('0x9e')](_0x57f9a7[_0x8de5('0x40')]['channel'][_0x8de5('0x9f')]())+_0x8de5('0xa3')]=Number(_0x57f9a7[_0x8de5('0x40')][_0x8de5('0x5c')][_0x2f3683]);socket[_0x8de5('0xad')]('user'+_['capitalize'](_0x57f9a7[_0x8de5('0x40')][_0x8de5('0xaa')][_0x8de5('0x9f')]())+_0x8de5('0xae'),_0x1ce0d2);}}else{_0x1ce0d2={'UserId':Number(_0x57f9a7[_0x8de5('0x51')]['id'])};_0x1ce0d2[_[_0x8de5('0x9e')](_0x57f9a7['query']['channel'][_0x8de5('0x9f')]())+_0x8de5('0xa3')]=Number(_0x57f9a7[_0x8de5('0x40')][_0x8de5('0x5c')]);socket[_0x8de5('0xad')](_0x8de5('0x25')+_[_0x8de5('0x9e')](_0x57f9a7[_0x8de5('0x40')]['channel'][_0x8de5('0x9f')]())+'Queue:remove',_0x1ce0d2);}return _0x560641;})[_0x8de5('0x23')](function(){if(_0x57f9a7[_0x8de5('0x40')]['channel']==='voice'){return db[_0x8de5('0xa9')][_0x8de5('0x2e')]({'where':{'UserId':_0x57f9a7[_0x8de5('0x51')]['id'],'VoiceQueueId':_0x57f9a7[_0x8de5('0x40')]['ids']},'individualHooks':!![]})['then'](function(){return _0x254f07;});}return _0x254f07;})['then'](respondWithStatusCode(_0x52e4a0,null))['catch'](handleError(_0x52e4a0,null));};exports[_0x8de5('0xaf')]=function(_0x5c615a,_0x138971){_0x5c615a[_0x8de5('0x57')]['userpic']=_0x5c615a[_0x8de5('0xb0')]['filename'];return db['User']['find']({'where':{'id':_0x5c615a[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x138971,null))[_0x8de5('0x23')](saveUpdates(_0x5c615a[_0x8de5('0x57')],null))[_0x8de5('0x23')](respondWithResult(_0x138971,null))['catch'](handleError(_0x138971,null));};exports[_0x8de5('0xb1')]=function(_0x5b6d0e,_0x416ae2){var _0x19874d=path[_0x8de5('0xb2')](config[_0x8de5('0xb3')],_0x8de5('0xb4'));return db['User'][_0x8de5('0x2b')]({'where':{'id':_0x5b6d0e['params']['id']},'attributes':['id',_0x8de5('0xb5')],'raw':!![]})[_0x8de5('0x23')](handleEntityNotFound(_0x416ae2,null))[_0x8de5('0x23')](function(_0x1aab02){if(_0x1aab02){if(_[_0x8de5('0x62')](_0x1aab02[_0x8de5('0xb5')])){return _0x416ae2[_0x8de5('0xb6')](_0x19874d);}else{if(!fs[_0x8de5('0xb7')](path[_0x8de5('0xb2')](config[_0x8de5('0xb3')],_0x8de5('0xb8'),_0x1aab02[_0x8de5('0xb5')]))){return _0x416ae2[_0x8de5('0xb6')](_0x19874d);}return _0x416ae2['download'](path[_0x8de5('0xb2')](config[_0x8de5('0xb3')],_0x8de5('0xb8'),_0x1aab02['userpic']));}}})['catch'](handleError(_0x416ae2,null));};exports[_0x8de5('0xb9')]=function(_0x4dc564,_0x5313c8){return db[_0x8de5('0x32')]['find']({'where':{'id':_0x4dc564['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x5313c8,null))[_0x8de5('0x23')](function(_0x191360){var _0x21b451=[];values=_0x191360['dataValues'];_0x21b451[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x4a'),_0x191360[_0x8de5('0x4b')]));_0x21b451[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x4c'),_0x191360[_0x8de5('0x4b')]));_0x21b451[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x55'),_0x191360['dataValues']));_0x21b451[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x4f'),_0x191360[_0x8de5('0x4b')]));_0x21b451[_0x8de5('0x45')](get_open_tabs('fax',_0x191360[_0x8de5('0x4b')]));_0x21b451[_0x8de5('0x45')](get_open_tabs(_0x8de5('0x4e'),_0x191360[_0x8de5('0x4b')]));return Promise['all'](_0x21b451);})[_0x8de5('0x23')](function(_0x263b18){if(_0x263b18){var _0x15509a=_[_0x8de5('0x34')](values['ChatOpenTabs'],function(_0x200dc7){return{'channel':_0x8de5('0xba'),'id':_0x200dc7['id'],'createdAt':_0x200dc7[_0x8de5('0xbb')]};});var _0x1d44eb=_[_0x8de5('0x34')](values[_0x8de5('0xbc')],function(_0x59dfa9){return{'channel':'FAX','id':_0x59dfa9['id'],'createdAt':_0x59dfa9['createdAt']};});var _0x22315d=_[_0x8de5('0x34')](values[_0x8de5('0xbd')],function(_0x2b0d4b){return{'channel':'OPENCHANNEL','id':_0x2b0d4b['id'],'createdAt':_0x2b0d4b[_0x8de5('0xbb')]};});var _0x39dc4e=_[_0x8de5('0x34')](values['MailOpenTabs'],function(_0x2063f0){return{'channel':_0x8de5('0xbe'),'id':_0x2063f0['id'],'createdAt':_0x2063f0['createdAt']};});var _0x520d54=_[_0x8de5('0x34')](values['SmsOpenTabs'],function(_0x3b2f67){return{'channel':_0x8de5('0xbf'),'id':_0x3b2f67['id'],'createdAt':_0x3b2f67[_0x8de5('0xbb')]};});var _0xa6a017=_['map'](values['WhatsappOpenTabs'],function(_0x1bcf7e){return{'channel':_0x8de5('0xc0'),'id':_0x1bcf7e['id'],'createdAt':_0x1bcf7e[_0x8de5('0xbb')]};});var _0x5f9957=_['concat'](_0x15509a,_0x1d44eb,_0x22315d,_0x39dc4e,_0x520d54,_0xa6a017);var _0xa6bcd4={'count':_0x5f9957[_0x8de5('0x49')],'rows':_0x5f9957};return _0xa6bcd4;}else return null;})['then'](respondWithResult(_0x5313c8,null))[_0x8de5('0x58')](handleError(_0x5313c8,null));};exports[_0x8de5('0xc1')]=function(_0x42875f,_0xd90747){var _0x44267a={};return db['User']['findOne']({'where':{'id':_0x42875f[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](function(_0x33dc3c){if(!_0x33dc3c){throw new APINotFoundError(util[_0x8de5('0xc2')](_0x8de5('0xc3'),_0x42875f[_0x8de5('0x51')]['id']));}return contacts[_0x8de5('0x59')]();})[_0x8de5('0x23')](function(_0x3bd767){_0x42875f[_0x8de5('0x40')][_0x8de5('0x32')]=_0x42875f['params']['id'];_0x44267a=qs[_0x8de5('0x3e')](_0x3bd767,_0x42875f);if(_0x42875f[_0x8de5('0x40')][_0x8de5('0xc4')](_0x8de5('0x52'))){_0x44267a[_0x8de5('0x41')]=[{'model':db[_0x8de5('0xc5')],'as':_0x8de5('0xc6'),'required':![]},{'model':db[_0x8de5('0xc7')],'as':'Tags','attributes':['id',_0x8de5('0x2c'),'color'],'where':_0x42875f[_0x8de5('0x40')]['tag']?{'id':_0x42875f['query']['tag']}:undefined,'required':_0x42875f['query'][_0x8de5('0xc8')]?!![]:![]}];}return contacts['findAll'](_0x42875f[_0x8de5('0x40')],_0x42875f[_0x8de5('0x25')],_0x44267a,_0x3bd767);})['then'](respondWithFilteredResult(_0xd90747,_0x44267a))[_0x8de5('0x58')](APIHandleError(_0xd90747));};exports[_0x8de5('0xc9')]=function(_0x236530,_0x5de7af){var _0x516f6e;var _0x314796={};var _0x2a44df;return db[_0x8de5('0x32')][_0x8de5('0x91')]({'where':{'id':_0x236530[_0x8de5('0x51')]['id']},'attributes':['id',_0x8de5('0x2c'),'role']})['then'](handleEntityNotFound(_0x5de7af,null))[_0x8de5('0x23')](function(_0x144685){if(!utils['isValidChannel'](_0x236530[_0x8de5('0x40')][_0x8de5('0xaa')])){throw new db[(_0x8de5('0x8a'))][(_0x8de5('0x8e'))](_0x8de5('0x9c'));}_0x516f6e=_0x144685;var _0x2e407b={};_0x2e407b['model']=_['keys'](db[_[_0x8de5('0x9e')](_0x236530[_0x8de5('0x40')][_0x8de5('0xaa')])+_0x8de5('0xca')]['rawAttributes']);_0x2e407b['query']=_['keys'](_0x236530[_0x8de5('0x40')]);_0x2e407b['filters']=_['intersection'](_0x2e407b[_0x8de5('0xcb')],_0x2e407b[_0x8de5('0x40')]);_0x314796[_0x8de5('0x44')]=_[_0x8de5('0xcc')](_0x2e407b[_0x8de5('0xcb')],qs[_0x8de5('0xcd')](_0x236530[_0x8de5('0x40')]['fields']));_0x314796[_0x8de5('0x44')]=_0x314796['attributes'][_0x8de5('0x49')]?_0x314796[_0x8de5('0x44')]:_0x2e407b[_0x8de5('0xcb')];_0x314796[_0x8de5('0xce')]=qs['sort'](_0x236530[_0x8de5('0x40')][_0x8de5('0xcf')]);_0x314796['where']=qs[_0x8de5('0xd0')](_['pick'](_0x236530[_0x8de5('0x40')],_0x2e407b[_0x8de5('0xd0')]));if(_0x236530[_0x8de5('0x40')][_0x8de5('0x27')]){_0x314796['where']=_[_0x8de5('0xd1')](_0x314796[_0x8de5('0x3f')],{'$or':_['map'](_0x314796[_0x8de5('0x44')],function(_0x1474b2){var _0x40cc96={};_0x40cc96[_0x1474b2]={'$like':'%'+_0x236530[_0x8de5('0x40')][_0x8de5('0x27')]+'%'};return _0x40cc96;})});}_0x314796=_[_0x8de5('0xd1')]({},_0x314796,_0x236530[_0x8de5('0x54')]);switch(_0x516f6e[_0x8de5('0x20')]){case'admin':return db[_[_0x8de5('0x9e')](_0x236530[_0x8de5('0x40')][_0x8de5('0xaa')])+_0x8de5('0xca')][_0x8de5('0x46')](_0x314796);case _0x8de5('0x25'):case'agent':return _0x516f6e[_0x8de5('0x24')+_[_0x8de5('0x9e')](_0x236530['query'][_0x8de5('0xaa')])+_0x8de5('0xa0')](_0x314796);default:throw new db['Sequelize'][(_0x8de5('0x8e'))](_0x8de5('0xd2'));}})[_0x8de5('0x23')](function(_0x134a2b){_0x2a44df=_0x134a2b[_0x8de5('0x49')];if(!_0x236530[_0x8de5('0x40')]['hasOwnProperty'](_0x8de5('0xd3'))){_0x314796['limit']=qs[_0x8de5('0x1b')](_0x236530[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x314796['offset']=qs['offset'](_0x236530[_0x8de5('0x40')][_0x8de5('0x19')]);}switch(_0x516f6e[_0x8de5('0x20')]){case _0x8de5('0x78'):return db[_[_0x8de5('0x9e')](_0x236530[_0x8de5('0x40')][_0x8de5('0xaa')])+_0x8de5('0xca')]['findAll'](_0x314796);case'user':case'agent':return _0x516f6e[_0x8de5('0x24')+_[_0x8de5('0x9e')](_0x236530[_0x8de5('0x40')]['channel'])+_0x8de5('0xa0')](_0x314796);}})[_0x8de5('0x23')](function(_0x2a4454){return{'count':_0x2a44df,'rows':_0x2a4454};})[_0x8de5('0x23')](respondWithResult(_0x5de7af,null))[_0x8de5('0x58')](handleError(_0x5de7af,null));};exports[_0x8de5('0xd4')]=function(_0x3fcd7b,_0x58573c){var _0x40d382={};var _0x5ae2f8={};var _0x32ed8f;var _0x477e9d;return db['User']['findOne']({'where':{'id':_0x3fcd7b['params']['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x58573c,null))['then'](function(_0x3082bf){if(_0x3082bf){_0x32ed8f=_0x3082bf;_0x5ae2f8[_0x8de5('0xcb')]=_[_0x8de5('0xd5')](db[_0x8de5('0xa9')][_0x8de5('0x33')]);_0x5ae2f8[_0x8de5('0x40')]=_[_0x8de5('0xd5')](_0x3fcd7b[_0x8de5('0x40')]);_0x5ae2f8[_0x8de5('0xd0')]=_['intersection'](_0x5ae2f8['model'],_0x5ae2f8[_0x8de5('0x40')]);_0x40d382[_0x8de5('0x44')]=_['intersection'](_0x5ae2f8[_0x8de5('0xcb')],qs['fields'](_0x3fcd7b[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x40d382[_0x8de5('0x44')]=_0x40d382[_0x8de5('0x44')][_0x8de5('0x49')]?_0x40d382[_0x8de5('0x44')]:_0x5ae2f8[_0x8de5('0xcb')];_0x40d382['order']=qs['sort'](_0x3fcd7b['query'][_0x8de5('0xcf')]);_0x40d382[_0x8de5('0x3f')]=qs[_0x8de5('0xd0')](_['pick'](_0x3fcd7b[_0x8de5('0x40')],_0x5ae2f8[_0x8de5('0xd0')]));if(_0x3fcd7b['query'][_0x8de5('0x27')]){_0x40d382['where']=_[_0x8de5('0xd1')](_0x40d382[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x40d382[_0x8de5('0x44')],function(_0x323b6b){var _0x318ad9={};_0x318ad9[_0x323b6b]={'$like':'%'+_0x3fcd7b['query'][_0x8de5('0x27')]+'%'};return _0x318ad9;})});}_0x40d382=_[_0x8de5('0xd1')]({},_0x40d382,_0x3fcd7b[_0x8de5('0x54')]);return _0x32ed8f[_0x8de5('0xd4')](_0x40d382);}})[_0x8de5('0x23')](function(_0x109c72){if(_0x109c72){_0x477e9d=_0x109c72[_0x8de5('0x49')];if(!_0x3fcd7b[_0x8de5('0x40')][_0x8de5('0xc4')](_0x8de5('0xd3'))){_0x40d382[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x3fcd7b[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x40d382[_0x8de5('0x19')]=qs[_0x8de5('0x19')](_0x3fcd7b[_0x8de5('0x40')]['offset']);}return _0x32ed8f[_0x8de5('0xd4')](_0x40d382);}})['then'](function(_0x13ca1d){if(_0x13ca1d){return _0x13ca1d?{'count':_0x477e9d,'rows':_0x13ca1d}:null;}})[_0x8de5('0x23')](respondWithResult(_0x58573c,null))[_0x8de5('0x58')](handleError(_0x58573c,null));};exports[_0x8de5('0xd6')]=function(_0x2a169c,_0x2df0ba){var _0x5cb768={};var _0x65131f={};var _0x1403c6;var _0x1d479e;return db[_0x8de5('0x32')][_0x8de5('0x91')]({'where':{'id':_0x2a169c[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x2df0ba,null))['then'](function(_0x1831d4){if(_0x1831d4){_0x1403c6=_0x1831d4;_0x65131f[_0x8de5('0xcb')]=_['keys'](db['ChatGroup'][_0x8de5('0x33')]);_0x65131f[_0x8de5('0x40')]=_[_0x8de5('0xd5')](_0x2a169c['query']);_0x65131f[_0x8de5('0xd0')]=_['intersection'](_0x65131f['model'],_0x65131f['query']);_0x5cb768[_0x8de5('0x44')]=_[_0x8de5('0xcc')](_0x65131f[_0x8de5('0xcb')],qs[_0x8de5('0xcd')](_0x2a169c[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x5cb768[_0x8de5('0x44')]=_0x5cb768[_0x8de5('0x44')][_0x8de5('0x49')]?_0x5cb768[_0x8de5('0x44')]:_0x65131f[_0x8de5('0xcb')];_0x5cb768[_0x8de5('0xce')]=qs[_0x8de5('0xcf')](_0x2a169c[_0x8de5('0x40')][_0x8de5('0xcf')]);_0x5cb768[_0x8de5('0x3f')]=qs[_0x8de5('0xd0')](_['pick'](_0x2a169c[_0x8de5('0x40')],_0x65131f['filters']));if(_0x2a169c['query'][_0x8de5('0x27')]){_0x5cb768['where']=_[_0x8de5('0xd1')](_0x5cb768[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x5cb768[_0x8de5('0x44')],function(_0x2cf1ec){var _0x353cb7={};_0x353cb7[_0x2cf1ec]={'$like':'%'+_0x2a169c[_0x8de5('0x40')][_0x8de5('0x27')]+'%'};return _0x353cb7;})});}_0x5cb768=_['merge']({},_0x5cb768,_0x2a169c[_0x8de5('0x54')]);return _0x1403c6[_0x8de5('0xd6')](_0x5cb768);}})[_0x8de5('0x23')](function(_0x242eff){if(_0x242eff){_0x1d479e=_0x242eff[_0x8de5('0x49')];if(!_0x2a169c[_0x8de5('0x40')][_0x8de5('0xc4')]('nolimit')){_0x5cb768[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x2a169c['query'][_0x8de5('0x1b')]);_0x5cb768['offset']=qs['offset'](_0x2a169c[_0x8de5('0x40')]['offset']);}return _0x1403c6[_0x8de5('0xd6')](_0x5cb768);}})['then'](function(_0x189e1e){if(_0x189e1e){return _0x189e1e?{'count':_0x1d479e,'rows':_0x189e1e}:null;}})[_0x8de5('0x23')](respondWithResult(_0x2df0ba,null))['catch'](handleError(_0x2df0ba,null));};exports[_0x8de5('0xd7')]=function(_0x258adf,_0x2a3be5){var _0x4609e6={'raw':!![],'where':{}};var _0x57e6c0={};var _0x1d07c0={'count':0x0,'rows':[]};return db['User'][_0x8de5('0x91')]({'where':{'id':_0x258adf['params']['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x2a3be5,null))[_0x8de5('0x23')](function(_0x5b6f6c){if(_0x5b6f6c){_0x57e6c0[_0x8de5('0xcb')]=_['keys'](db[_0x8de5('0xd8')][_0x8de5('0x33')]);_0x57e6c0[_0x8de5('0x40')]=_['keys'](_0x258adf[_0x8de5('0x40')]);_0x57e6c0[_0x8de5('0xd0')]=_[_0x8de5('0xcc')](_0x57e6c0[_0x8de5('0xcb')],_0x57e6c0['query']);_0x4609e6['attributes']=_[_0x8de5('0xcc')](_0x57e6c0['model'],qs['fields'](_0x258adf['query'][_0x8de5('0xcd')]));_0x4609e6[_0x8de5('0x44')]=_0x4609e6[_0x8de5('0x44')][_0x8de5('0x49')]?_0x4609e6[_0x8de5('0x44')]:_0x57e6c0[_0x8de5('0xcb')];if(!_0x258adf[_0x8de5('0x40')]['hasOwnProperty']('nolimit')){_0x4609e6[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x258adf[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x4609e6['offset']=qs[_0x8de5('0x19')](_0x258adf['query'][_0x8de5('0x19')]);}_0x4609e6[_0x8de5('0xce')]=qs['sort'](_0x258adf[_0x8de5('0x40')][_0x8de5('0xcf')]);_0x4609e6[_0x8de5('0x3f')]=qs['filters'](_[_0x8de5('0xd9')](_0x258adf[_0x8de5('0x40')],_0x57e6c0[_0x8de5('0xd0')]));_0x4609e6[_0x8de5('0x3f')][_0x8de5('0xda')]=_0x5b6f6c['id'];if(_0x258adf[_0x8de5('0x40')]['filter']){_0x4609e6[_0x8de5('0x3f')]=_[_0x8de5('0xd1')](_0x4609e6[_0x8de5('0x3f')],{'$or':_['map'](_0x4609e6['attributes'],function(_0x1ed3ee){var _0x4a5b58={};_0x4a5b58[_0x1ed3ee]={'$like':'%'+_0x258adf[_0x8de5('0x40')][_0x8de5('0x27')]+'%'};return _0x4a5b58;})});}_0x4609e6=_[_0x8de5('0xd1')]({},_0x4609e6,_0x258adf[_0x8de5('0x54')]);return db[_0x8de5('0xd8')]['count']({'where':_0x4609e6[_0x8de5('0x3f')]})[_0x8de5('0x23')](function(_0x279c07){_0x1d07c0['count']=_0x279c07;if(_0x258adf[_0x8de5('0x40')]['includeAll']){_0x4609e6[_0x8de5('0x41')]=[{'all':!![]}];}return db[_0x8de5('0xd8')][_0x8de5('0x46')](_0x4609e6);})['then'](function(_0x1988c4){_0x1d07c0['rows']=_0x1988c4;return _0x1d07c0;});}})['then'](respondWithFilteredResult(_0x2a3be5,_0x4609e6))[_0x8de5('0x58')](handleError(_0x2a3be5,null));};exports[_0x8de5('0xdb')]=function(_0x2f77e3,_0x2e231a){var _0x252be3={'raw':!![],'where':{}};var _0x540406={};var _0x3399f9={'count':0x0,'rows':[]};return db[_0x8de5('0x32')][_0x8de5('0x91')]({'where':{'id':_0x2f77e3[_0x8de5('0x51')]['id']}})['then'](handleEntityNotFound(_0x2e231a,null))[_0x8de5('0x23')](function(_0x40a6d9){if(_0x40a6d9){_0x540406['model']=_[_0x8de5('0xd5')](db['ScreenRecording']['rawAttributes']);_0x540406[_0x8de5('0x40')]=_['keys'](_0x2f77e3[_0x8de5('0x40')]);_0x540406[_0x8de5('0xd0')]=_[_0x8de5('0xcc')](_0x540406['model'],_0x540406[_0x8de5('0x40')]);_0x252be3[_0x8de5('0x44')]=_[_0x8de5('0xcc')](_0x540406[_0x8de5('0xcb')],qs[_0x8de5('0xcd')](_0x2f77e3[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x252be3[_0x8de5('0x44')]=_0x252be3[_0x8de5('0x44')][_0x8de5('0x49')]?_0x252be3[_0x8de5('0x44')]:_0x540406[_0x8de5('0xcb')];if(!_0x2f77e3[_0x8de5('0x40')]['hasOwnProperty'](_0x8de5('0xd3'))){_0x252be3[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x2f77e3[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x252be3['offset']=qs[_0x8de5('0x19')](_0x2f77e3[_0x8de5('0x40')]['offset']);}_0x252be3['order']=qs[_0x8de5('0xcf')](_0x2f77e3[_0x8de5('0x40')]['sort']);_0x252be3[_0x8de5('0x3f')]=qs['filters'](_[_0x8de5('0xd9')](_0x2f77e3[_0x8de5('0x40')],_0x540406[_0x8de5('0xd0')]));_0x252be3['where']['UserId']=_0x40a6d9['id'];if(_0x2f77e3[_0x8de5('0x40')][_0x8de5('0x27')]){_0x252be3[_0x8de5('0x3f')]=_['merge'](_0x252be3[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x252be3[_0x8de5('0x44')],function(_0x389833){var _0x4ef63b={};_0x4ef63b[_0x389833]={'$like':'%'+_0x2f77e3['query'][_0x8de5('0x27')]+'%'};return _0x4ef63b;})});}_0x252be3=_[_0x8de5('0xd1')]({},_0x252be3,_0x2f77e3[_0x8de5('0x54')]);return db[_0x8de5('0xdc')][_0x8de5('0x1c')]({'where':_0x252be3[_0x8de5('0x3f')]})['then'](function(_0xe57b3c){_0x3399f9[_0x8de5('0x1c')]=_0xe57b3c;if(_0x2f77e3['query'][_0x8de5('0x52')]){_0x252be3[_0x8de5('0x41')]=[{'all':!![]}];}return db[_0x8de5('0xdc')][_0x8de5('0x46')](_0x252be3);})['then'](function(_0x147f40){_0x3399f9[_0x8de5('0x47')]=_0x147f40;return _0x3399f9;});}})['then'](respondWithFilteredResult(_0x2e231a,_0x252be3))[_0x8de5('0x58')](handleError(_0x2e231a,null));};exports['getChatInteractions']=function(_0x4c80ef,_0x216d7d){var _0x3e4c57={};var _0x400d4c={};var _0x379dfe;var _0x49f869;return db[_0x8de5('0x32')]['findOne']({'where':{'id':_0x4c80ef[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x216d7d,null))['then'](function(_0xc4a24d){if(_0xc4a24d){_0x379dfe=_0xc4a24d;_0x400d4c[_0x8de5('0xcb')]=_[_0x8de5('0xd5')](db['ChatInteraction'][_0x8de5('0x33')]);_0x400d4c[_0x8de5('0x40')]=_[_0x8de5('0xd5')](_0x4c80ef[_0x8de5('0x40')]);_0x400d4c[_0x8de5('0xd0')]=_[_0x8de5('0xcc')](_0x400d4c[_0x8de5('0xcb')],_0x400d4c[_0x8de5('0x40')]);_0x3e4c57[_0x8de5('0x44')]=_[_0x8de5('0xcc')](_0x400d4c['model'],qs[_0x8de5('0xcd')](_0x4c80ef[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x3e4c57[_0x8de5('0x44')]=_0x3e4c57[_0x8de5('0x44')][_0x8de5('0x49')]?_0x3e4c57[_0x8de5('0x44')]:_0x400d4c[_0x8de5('0xcb')];_0x3e4c57[_0x8de5('0xce')]=qs[_0x8de5('0xcf')](_0x4c80ef[_0x8de5('0x40')][_0x8de5('0xcf')]);_0x3e4c57['where']=qs[_0x8de5('0xd0')](_['pick'](_0x4c80ef[_0x8de5('0x40')],_0x400d4c[_0x8de5('0xd0')]));if(_0x4c80ef[_0x8de5('0x40')]['filter']){_0x3e4c57[_0x8de5('0x3f')]=_[_0x8de5('0xd1')](_0x3e4c57['where'],{'$or':_[_0x8de5('0x34')](_0x3e4c57[_0x8de5('0x44')],function(_0x2e9167){var _0x1e31ee={};_0x1e31ee[_0x2e9167]={'$like':'%'+_0x4c80ef['query']['filter']+'%'};return _0x1e31ee;})});}_0x3e4c57=_[_0x8de5('0xd1')]({},_0x3e4c57,_0x4c80ef[_0x8de5('0x54')]);return _0x379dfe[_0x8de5('0xdd')](_0x3e4c57);}})['then'](function(_0x17d0ca){if(_0x17d0ca){_0x49f869=_0x17d0ca['length'];if(!_0x4c80ef[_0x8de5('0x40')][_0x8de5('0xc4')](_0x8de5('0xd3'))){_0x3e4c57[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x4c80ef[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x3e4c57[_0x8de5('0x19')]=qs[_0x8de5('0x19')](_0x4c80ef['query'][_0x8de5('0x19')]);}return _0x379dfe[_0x8de5('0xdd')](_0x3e4c57);}})['then'](function(_0x9f1c7d){if(_0x9f1c7d){return _0x9f1c7d?{'count':_0x49f869,'rows':_0x9f1c7d}:null;}})[_0x8de5('0x23')](respondWithResult(_0x216d7d,null))[_0x8de5('0x58')](handleError(_0x216d7d,null));};exports[_0x8de5('0xde')]=function(_0x27c51e,_0x7e1161){var _0x434616={};var _0x9d38c0={};var _0xe6c22e;var _0x133949;return db['User'][_0x8de5('0x91')]({'where':{'id':_0x27c51e[_0x8de5('0x51')]['id']}})['then'](handleEntityNotFound(_0x7e1161,null))[_0x8de5('0x23')](function(_0x2190e5){if(_0x2190e5){_0xe6c22e=_0x2190e5;_0x9d38c0[_0x8de5('0xcb')]=_[_0x8de5('0xd5')](db['OpenchannelInteraction'][_0x8de5('0x33')]);_0x9d38c0['query']=_[_0x8de5('0xd5')](_0x27c51e[_0x8de5('0x40')]);_0x9d38c0[_0x8de5('0xd0')]=_['intersection'](_0x9d38c0['model'],_0x9d38c0['query']);_0x434616[_0x8de5('0x44')]=_['intersection'](_0x9d38c0[_0x8de5('0xcb')],qs[_0x8de5('0xcd')](_0x27c51e['query'][_0x8de5('0xcd')]));_0x434616[_0x8de5('0x44')]=_0x434616[_0x8de5('0x44')]['length']?_0x434616[_0x8de5('0x44')]:_0x9d38c0[_0x8de5('0xcb')];_0x434616['order']=qs[_0x8de5('0xcf')](_0x27c51e[_0x8de5('0x40')][_0x8de5('0xcf')]);_0x434616[_0x8de5('0x3f')]=qs[_0x8de5('0xd0')](_[_0x8de5('0xd9')](_0x27c51e[_0x8de5('0x40')],_0x9d38c0[_0x8de5('0xd0')]));if(_0x27c51e[_0x8de5('0x40')]['filter']){_0x434616[_0x8de5('0x3f')]=_[_0x8de5('0xd1')](_0x434616[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x434616[_0x8de5('0x44')],function(_0x4443cd){var _0x4a043f={};_0x4a043f[_0x4443cd]={'$like':'%'+_0x27c51e[_0x8de5('0x40')][_0x8de5('0x27')]+'%'};return _0x4a043f;})});}_0x434616=_[_0x8de5('0xd1')]({},_0x434616,_0x27c51e[_0x8de5('0x54')]);return _0xe6c22e[_0x8de5('0xde')](_0x434616);}})[_0x8de5('0x23')](function(_0x2880c9){if(_0x2880c9){_0x133949=_0x2880c9['length'];if(!_0x27c51e[_0x8de5('0x40')][_0x8de5('0xc4')](_0x8de5('0xd3'))){_0x434616[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x27c51e[_0x8de5('0x40')]['limit']);_0x434616[_0x8de5('0x19')]=qs[_0x8de5('0x19')](_0x27c51e[_0x8de5('0x40')][_0x8de5('0x19')]);}return _0xe6c22e[_0x8de5('0xde')](_0x434616);}})[_0x8de5('0x23')](function(_0x44c02b){if(_0x44c02b){return _0x44c02b?{'count':_0x133949,'rows':_0x44c02b}:null;}})[_0x8de5('0x23')](respondWithResult(_0x7e1161,null))[_0x8de5('0x58')](handleError(_0x7e1161,null));};exports['getMailInteractions']=function(_0x5bc9ee,_0x15226f){var _0x7c9ada={'raw':!![],'where':{}};var _0x329d71={};var _0x3ab080={'count':0x0,'rows':[]};return db[_0x8de5('0x32')]['findOne']({'where':{'id':_0x5bc9ee[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x15226f,null))[_0x8de5('0x23')](function(_0x18afdf){if(_0x18afdf){_0x329d71[_0x8de5('0xcb')]=_['keys'](db[_0x8de5('0xdf')]['rawAttributes']);_0x329d71['query']=_[_0x8de5('0xd5')](_0x5bc9ee[_0x8de5('0x40')]);_0x329d71[_0x8de5('0xd0')]=_[_0x8de5('0xcc')](_0x329d71[_0x8de5('0xcb')],_0x329d71[_0x8de5('0x40')]);_0x7c9ada[_0x8de5('0x44')]=_[_0x8de5('0xcc')](_0x329d71['model'],qs[_0x8de5('0xcd')](_0x5bc9ee[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x7c9ada[_0x8de5('0x44')]=_0x7c9ada[_0x8de5('0x44')][_0x8de5('0x49')]?_0x7c9ada[_0x8de5('0x44')]:_0x329d71[_0x8de5('0xcb')];if(!_0x5bc9ee[_0x8de5('0x40')]['hasOwnProperty']('nolimit')){_0x7c9ada[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x5bc9ee[_0x8de5('0x40')]['limit']);_0x7c9ada[_0x8de5('0x19')]=qs['offset'](_0x5bc9ee[_0x8de5('0x40')][_0x8de5('0x19')]);}_0x7c9ada[_0x8de5('0xce')]=qs[_0x8de5('0xcf')](_0x5bc9ee[_0x8de5('0x40')][_0x8de5('0xcf')]);_0x7c9ada[_0x8de5('0x3f')]=qs[_0x8de5('0xd0')](_['pick'](_0x5bc9ee[_0x8de5('0x40')],_0x329d71[_0x8de5('0xd0')]));_0x7c9ada[_0x8de5('0x3f')][_0x8de5('0xda')]=_0x18afdf['id'];if(_0x5bc9ee[_0x8de5('0x40')][_0x8de5('0x27')]){_0x7c9ada[_0x8de5('0x3f')]=_[_0x8de5('0xd1')](_0x7c9ada[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x7c9ada[_0x8de5('0x44')],function(_0x1bcdb0){var _0xf603b6={};_0xf603b6[_0x1bcdb0]={'$like':'%'+_0x5bc9ee['query']['filter']+'%'};return _0xf603b6;})});}_0x7c9ada=_[_0x8de5('0xd1')]({},_0x7c9ada,_0x5bc9ee['options']);return db[_0x8de5('0xdf')][_0x8de5('0x1c')]({'where':_0x7c9ada[_0x8de5('0x3f')]})['then'](function(_0x382f89){_0x3ab080['count']=_0x382f89;if(_0x5bc9ee[_0x8de5('0x40')]['includeAll']){_0x7c9ada[_0x8de5('0x41')]=[{'all':!![]}];}return db[_0x8de5('0xdf')][_0x8de5('0x46')](_0x7c9ada);})[_0x8de5('0x23')](function(_0x35b3e7){_0x3ab080[_0x8de5('0x47')]=_0x35b3e7;return _0x3ab080;});}})[_0x8de5('0x23')](respondWithFilteredResult(_0x15226f,_0x7c9ada))[_0x8de5('0x58')](handleError(_0x15226f,null));};exports[_0x8de5('0xe0')]=function(_0x4c4229,_0x52097c){var _0x321ddf={};var _0x1e8f08={};var _0x5a34f8;var _0x5a60bd;return db[_0x8de5('0x32')]['findOne']({'where':{'id':_0x4c4229[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x52097c,null))[_0x8de5('0x23')](function(_0x35fe7e){if(_0x35fe7e){_0x5a34f8=_0x35fe7e;_0x1e8f08[_0x8de5('0xcb')]=_[_0x8de5('0xd5')](db[_0x8de5('0xe1')][_0x8de5('0x33')]);_0x1e8f08[_0x8de5('0x40')]=_[_0x8de5('0xd5')](_0x4c4229[_0x8de5('0x40')]);_0x1e8f08['filters']=_[_0x8de5('0xcc')](_0x1e8f08[_0x8de5('0xcb')],_0x1e8f08[_0x8de5('0x40')]);_0x321ddf[_0x8de5('0x44')]=_[_0x8de5('0xcc')](_0x1e8f08[_0x8de5('0xcb')],qs[_0x8de5('0xcd')](_0x4c4229[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x321ddf[_0x8de5('0x44')]=_0x321ddf[_0x8de5('0x44')][_0x8de5('0x49')]?_0x321ddf['attributes']:_0x1e8f08[_0x8de5('0xcb')];_0x321ddf[_0x8de5('0xce')]=qs[_0x8de5('0xcf')](_0x4c4229['query']['sort']);_0x321ddf[_0x8de5('0x3f')]=qs[_0x8de5('0xd0')](_[_0x8de5('0xd9')](_0x4c4229[_0x8de5('0x40')],_0x1e8f08[_0x8de5('0xd0')]));if(_0x4c4229['query'][_0x8de5('0x27')]){_0x321ddf[_0x8de5('0x3f')]=_[_0x8de5('0xd1')](_0x321ddf[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x321ddf[_0x8de5('0x44')],function(_0x733e76){var _0x24d275={};_0x24d275[_0x733e76]={'$like':'%'+_0x4c4229[_0x8de5('0x40')][_0x8de5('0x27')]+'%'};return _0x24d275;})});}_0x321ddf=_['merge']({},_0x321ddf,_0x4c4229['options']);return _0x5a34f8[_0x8de5('0xe0')](_0x321ddf);}})['then'](function(_0x33a729){if(_0x33a729){_0x5a60bd=_0x33a729[_0x8de5('0x49')];if(!_0x4c4229[_0x8de5('0x40')][_0x8de5('0xc4')]('nolimit')){_0x321ddf[_0x8de5('0x1b')]=qs['limit'](_0x4c4229[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x321ddf[_0x8de5('0x19')]=qs[_0x8de5('0x19')](_0x4c4229[_0x8de5('0x40')]['offset']);}return _0x5a34f8[_0x8de5('0xe0')](_0x321ddf);}})['then'](function(_0x9587f0){if(_0x9587f0){return _0x9587f0?{'count':_0x5a60bd,'rows':_0x9587f0}:null;}})['then'](respondWithResult(_0x52097c,null))[_0x8de5('0x58')](handleError(_0x52097c,null));};exports[_0x8de5('0xe2')]=function(_0xb6fdea,_0x2a3a8e){var _0xc1d786={};var _0x7d01ac={};var _0x372138;var _0x36d040;return db[_0x8de5('0x32')][_0x8de5('0x91')]({'where':{'id':_0xb6fdea[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x2a3a8e,null))['then'](function(_0x4b080a){if(_0x4b080a){_0x372138=_0x4b080a;_0x7d01ac['model']=_[_0x8de5('0xd5')](db[_0x8de5('0xe3')]['rawAttributes']);_0x7d01ac['query']=_['keys'](_0xb6fdea[_0x8de5('0x40')]);_0x7d01ac[_0x8de5('0xd0')]=_['intersection'](_0x7d01ac[_0x8de5('0xcb')],_0x7d01ac[_0x8de5('0x40')]);_0xc1d786[_0x8de5('0x44')]=_[_0x8de5('0xcc')](_0x7d01ac['model'],qs[_0x8de5('0xcd')](_0xb6fdea[_0x8de5('0x40')]['fields']));_0xc1d786[_0x8de5('0x44')]=_0xc1d786['attributes'][_0x8de5('0x49')]?_0xc1d786['attributes']:_0x7d01ac['model'];_0xc1d786[_0x8de5('0xce')]=qs[_0x8de5('0xcf')](_0xb6fdea['query'][_0x8de5('0xcf')]);_0xc1d786['where']=qs[_0x8de5('0xd0')](_[_0x8de5('0xd9')](_0xb6fdea[_0x8de5('0x40')],_0x7d01ac['filters']));if(_0xb6fdea[_0x8de5('0x40')]['filter']){_0xc1d786[_0x8de5('0x3f')]=_['merge'](_0xc1d786[_0x8de5('0x3f')],{'$or':_['map'](_0xc1d786['attributes'],function(_0x8c3cdb){var _0x1ad1ea={};_0x1ad1ea[_0x8c3cdb]={'$like':'%'+_0xb6fdea[_0x8de5('0x40')]['filter']+'%'};return _0x1ad1ea;})});}_0xc1d786=_[_0x8de5('0xd1')]({},_0xc1d786,_0xb6fdea[_0x8de5('0x54')]);return _0x372138[_0x8de5('0xe2')](_0xc1d786);}})[_0x8de5('0x23')](function(_0x346929){if(_0x346929){_0x36d040=_0x346929[_0x8de5('0x49')];if(!_0xb6fdea[_0x8de5('0x40')]['hasOwnProperty'](_0x8de5('0xd3'))){_0xc1d786['limit']=qs['limit'](_0xb6fdea[_0x8de5('0x40')][_0x8de5('0x1b')]);_0xc1d786[_0x8de5('0x19')]=qs['offset'](_0xb6fdea['query'][_0x8de5('0x19')]);}return _0x372138[_0x8de5('0xe2')](_0xc1d786);}})[_0x8de5('0x23')](function(_0x273572){if(_0x273572){return _0x273572?{'count':_0x36d040,'rows':_0x273572}:null;}})[_0x8de5('0x23')](respondWithResult(_0x2a3a8e,null))['catch'](handleError(_0x2a3a8e,null));};exports['getWhatsappInteractions']=function(_0x39d55a,_0x39adc4){var _0x24a768={};var _0x3a859f={};var _0x4b7f48;var _0x5b1471;return db['User'][_0x8de5('0x91')]({'where':{'id':_0x39d55a[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x39adc4,null))[_0x8de5('0x23')](function(_0x9ac184){if(_0x9ac184){_0x4b7f48=_0x9ac184;_0x3a859f[_0x8de5('0xcb')]=_[_0x8de5('0xd5')](db['WhatsappInteraction']['rawAttributes']);_0x3a859f['query']=_[_0x8de5('0xd5')](_0x39d55a[_0x8de5('0x40')]);_0x3a859f[_0x8de5('0xd0')]=_[_0x8de5('0xcc')](_0x3a859f[_0x8de5('0xcb')],_0x3a859f['query']);_0x24a768['attributes']=_[_0x8de5('0xcc')](_0x3a859f[_0x8de5('0xcb')],qs['fields'](_0x39d55a[_0x8de5('0x40')]['fields']));_0x24a768[_0x8de5('0x44')]=_0x24a768[_0x8de5('0x44')][_0x8de5('0x49')]?_0x24a768[_0x8de5('0x44')]:_0x3a859f['model'];_0x24a768[_0x8de5('0xce')]=qs[_0x8de5('0xcf')](_0x39d55a[_0x8de5('0x40')][_0x8de5('0xcf')]);_0x24a768['where']=qs['filters'](_[_0x8de5('0xd9')](_0x39d55a[_0x8de5('0x40')],_0x3a859f[_0x8de5('0xd0')]));if(_0x39d55a[_0x8de5('0x40')][_0x8de5('0x27')]){_0x24a768[_0x8de5('0x3f')]=_['merge'](_0x24a768[_0x8de5('0x3f')],{'$or':_['map'](_0x24a768['attributes'],function(_0x4799ec){var _0x2d6d09={};_0x2d6d09[_0x4799ec]={'$like':'%'+_0x39d55a[_0x8de5('0x40')]['filter']+'%'};return _0x2d6d09;})});}_0x24a768=_['merge']({},_0x24a768,_0x39d55a[_0x8de5('0x54')]);return _0x4b7f48['getWhatsappInteractions'](_0x24a768);}})[_0x8de5('0x23')](function(_0x2553fc){if(_0x2553fc){_0x5b1471=_0x2553fc[_0x8de5('0x49')];if(!_0x39d55a[_0x8de5('0x40')][_0x8de5('0xc4')](_0x8de5('0xd3'))){_0x24a768[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x39d55a[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x24a768[_0x8de5('0x19')]=qs['offset'](_0x39d55a[_0x8de5('0x40')][_0x8de5('0x19')]);}return _0x4b7f48['getWhatsappInteractions'](_0x24a768);}})[_0x8de5('0x23')](function(_0x217193){if(_0x217193){return _0x217193?{'count':_0x5b1471,'rows':_0x217193}:null;}})[_0x8de5('0x23')](respondWithResult(_0x39adc4,null))[_0x8de5('0x58')](handleError(_0x39adc4,null));};exports['login']=function(_0x782a67,_0x21806b,_0x2fa6aa){var _0x3d50b0;var _0x3a5499;var _0x57e5c0;var _0x344e34=!_[_0x8de5('0x62')](_0x782a67[_0x8de5('0x51')]['id'])?_0x782a67[_0x8de5('0x51')]['id']:!_[_0x8de5('0x62')](_0x782a67[_0x8de5('0x25')]['id'])?_0x782a67[_0x8de5('0x25')]['id']:null;return db['User'][_0x8de5('0x2b')]({'where':{'id':_0x344e34,'role':{'$or':[_0x8de5('0x78'),_0x8de5('0x25'),_0x8de5('0x21')]}},'attributes':['id','name','phone',_0x8de5('0xe4'),_0x8de5('0x20'),_0x8de5('0x5d'),_0x8de5('0x99')]})['then'](function(_0x2c3846){if(_0x2c3846){if(_0x2c3846[_0x8de5('0x20')]===_0x8de5('0x21')){_0x3d50b0=_0x2c3846;if(_0x782a67[_0x8de5('0x57')]['interface']){_0x57e5c0=util[_0x8de5('0xc2')]('LOCAL/%s@from-sip/n',_0x3d50b0[_0x782a67[_0x8de5('0x57')]['interface']]);}else if(_0x782a67[_0x8de5('0x57')][_0x8de5('0xe5')]){_0x57e5c0=util['format'](_0x8de5('0xa7'),_0x782a67[_0x8de5('0x57')][_0x8de5('0xe5')]);}else{_0x57e5c0=util[_0x8de5('0xc2')](_0x8de5('0xa7'),_0x3d50b0['name']);}socket['to'](util[_0x8de5('0xc2')](_0x8de5('0xe6'),_0x3d50b0['name']))['emit'](_0x8de5('0xe7'),{'user':{'id':_0x3d50b0['id'],'name':_0x3d50b0[_0x8de5('0x2c')]},'ip':_0x782a67[_0x8de5('0xe8')][_0x8de5('0xe9')]||_0x782a67[_0x8de5('0xea')][_0x8de5('0xeb')]||_0x782a67['socket'][_0x8de5('0xeb')]||_0x782a67['connection'][_0x8de5('0xec')][_0x8de5('0xeb')]});return db[_0x8de5('0xa9')][_0x8de5('0x2e')]({'where':{'membername':_0x3d50b0[_0x8de5('0x2c')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x8de5('0x8e'))](_0x8de5('0xed'));}})['then'](function(){if(_0x3d50b0){return _0x3d50b0[_0x8de5('0xee')]({'raw':!![]});}})[_0x8de5('0x23')](function(_0x5e5445){if(_0x3d50b0){if(_0x5e5445){_0x3a5499=_0x5e5445;if(_0x3a5499[_0x8de5('0x49')]){var _0x654842=_0x3a5499[_0x8de5('0x34')](function(_0x3a51cc){var _0x573b10={'membername':_0x3d50b0['name'],'UserId':_0x3d50b0['id'],'queue_name':_0x3a51cc['name'],'VoiceQueueId':_0x3a51cc['id'],'interface':_0x57e5c0,'paused':_0x3d50b0[_0x8de5('0x99')]||![],'penalty':_0x3a51cc[_0x8de5('0xef')]||0x0};return db[_0x8de5('0xa9')]['upsert'](_0x573b10);});return Promise['all'](_0x654842);}}}})[_0x8de5('0x23')](function(){if(_0x3d50b0){return db['MemberReport'][_0x8de5('0x46')]({'where':{'membername':_0x3d50b0[_0x8de5('0x2c')],'exitAt':null}});}})['then'](function(_0x236d56){if(_0x3d50b0){var _0x4fca5a=[];_0x236d56['forEach'](function(_0x5ecaa3){_0x4fca5a[_0x8de5('0x45')](_0x5ecaa3[_0x8de5('0x1f')]({'exitAt':moment()[_0x8de5('0xc2')](_0x8de5('0xf0'))}));});return Promise[_0x8de5('0x56')](_0x4fca5a);}})[_0x8de5('0x23')](function(){if(_0x3d50b0){var _0x5d0258=[];var _0x5519fd=[];var _0x528d3a=utils[_0x8de5('0xf1')]();var _0x3e2bcd={'membername':_0x3d50b0[_0x8de5('0x2c')],'interface':_0x57e5c0,'enterAt':moment()[_0x8de5('0xc2')](_0x8de5('0xf0')),'role':_0x3d50b0['role'],'internal':_0x3d50b0[_0x8de5('0x5d')]};_0x528d3a['forEach'](function(_0x4dc03c){_0x5d0258['push'](_[_0x8de5('0xd1')]({'channel':_0x4dc03c,'type':'LOGIN','data1':_0x782a67['body']['device'],'data2':_0x57e5c0},_0x3e2bcd));if(_0x3d50b0[_0x8de5('0x99')]){_0x5519fd[_0x8de5('0x45')](_[_0x8de5('0xd1')]({'channel':_0x4dc03c,'type':_0x8de5('0xf2'),'data1':'LOGININPAUSE'},_0x3e2bcd));}});return db[_0x8de5('0xf3')][_0x8de5('0x80')](_0x5d0258[_0x8de5('0xf4')](_0x5519fd),{'individualHooks':!![]});}})['then'](function(){if(_0x3d50b0){return _0x3d50b0[_0x8de5('0x1f')]({'online':!![],'lastLoginAt':moment()[_0x8de5('0xc2')](_0x8de5('0xf0')),'voicePause':_0x3d50b0[_0x8de5('0x99')]||![],'mailPause':_0x3d50b0[_0x8de5('0x99')]||![],'chatPause':_0x3d50b0[_0x8de5('0x99')]||![],'faxPause':_0x3d50b0[_0x8de5('0x99')]||![],'smsPause':_0x3d50b0[_0x8de5('0x99')]||![],'openchannelPause':_0x3d50b0[_0x8de5('0x99')]||![],'whatsappPause':_0x3d50b0[_0x8de5('0x99')]||![],'pauseType':_0x3d50b0[_0x8de5('0x99')]?_0x8de5('0xf5'):null,'interface':_0x57e5c0,'lastPauseAt':moment()[_0x8de5('0xc2')](_0x8de5('0xf0'))});}})[_0x8de5('0x23')](function(_0x42e37e){if(_0x782a67[_0x8de5('0xf6')]){return _0x2fa6aa();}else{return Promise[_0x8de5('0xf7')](_0x42e37e)[_0x8de5('0x23')](respondWithResult(_0x21806b,null));}})[_0x8de5('0x58')](handleError(_0x21806b,null));};exports[_0x8de5('0xf8')]=function(_0x48b734,_0x24e474){var _0x41d16b;return db['User'][_0x8de5('0x2b')]({'where':{'id':_0x48b734['params']['id'],'role':_0x8de5('0x21')},'attributes':['id',_0x8de5('0x2c'),_0x8de5('0x20')]})[_0x8de5('0x23')](handleEntityNotFound(_0x24e474,null))[_0x8de5('0x23')](function(_0x440632){if(_0x440632){_0x41d16b=_0x440632;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x41d16b['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x8de5('0xf3')][_0x8de5('0x46')]({'where':{'membername':_0x41d16b[_0x8de5('0x2c')],'exitAt':null}});})[_0x8de5('0x23')](function(_0x247e19){var _0x13bd77=[];_0x247e19[_0x8de5('0xf9')](function(_0x7fa899){_0x13bd77[_0x8de5('0x45')](_0x7fa899[_0x8de5('0x1f')]({'exitAt':moment()[_0x8de5('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x8de5('0x56')](_0x13bd77);})[_0x8de5('0x23')](function(){return _0x41d16b[_0x8de5('0x1f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8de5('0x23')](respondWithResult(_0x24e474,null))[_0x8de5('0x58')](handleError(_0x24e474,null));};exports['pause']=function(_0x3ce836,_0xf457c){var _0x52526b;return db[_0x8de5('0xa9')][_0x8de5('0x1f')]({'paused':0x1},{'where':{'UserId':_0x3ce836[_0x8de5('0x51')]['id']},'individualHooks':!![]})[_0x8de5('0x23')](function(){return db[_0x8de5('0x32')][_0x8de5('0x2b')]({'where':{'id':_0x3ce836['params']['id'],'role':'agent'},'attributes':['id',_0x8de5('0x2c'),_0x8de5('0x20'),_0x8de5('0x5d'),_0x8de5('0x9a'),'online']});})[_0x8de5('0x23')](handleEntityNotFound(_0xf457c,null))[_0x8de5('0x23')](function(_0x23617a){if(_0x23617a){_0x52526b=_0x23617a;return db['MemberReport'][_0x8de5('0x46')]({'where':{'membername':_0x52526b['name'],'type':'PAUSE','exitAt':null}});}})[_0x8de5('0x23')](function(_0x16cf39){if(_0x16cf39['length']){var _0xbb70dd=moment()[_0x8de5('0xc2')](_0x8de5('0xf0'));for(var _0x147461=0x0,_0x27765d=_0x16cf39['length'];_0x147461<_0x27765d;_0x147461++){_0x16cf39[_0x147461][_0x8de5('0xfa')]({'exitAt':_0xbb70dd});}}})[_0x8de5('0x23')](function(){var _0x5a38a9=[];var _0x59631e=utils['getChannels']();_0x59631e[_0x8de5('0xf9')](function(_0x5edeac){_0x5a38a9[_0x8de5('0x45')]({'channel':_0x5edeac,'membername':_0x52526b[_0x8de5('0x2c')],'interface':_[_0x8de5('0x62')](_0x52526b[_0x8de5('0x9a')])?util[_0x8de5('0xc2')](_0x8de5('0xa7'),_0x52526b[_0x8de5('0x2c')]):_0x52526b[_0x8de5('0x9a')],'type':'PAUSE','enterAt':moment()[_0x8de5('0xc2')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3ce836[_0x8de5('0x57')][_0x8de5('0x36')]||_0x8de5('0xfb'),'role':_0x52526b[_0x8de5('0x20')],'internal':_0x52526b[_0x8de5('0x5d')]});});return db['MemberReport'][_0x8de5('0x80')](_0x5a38a9,{'individualHooks':!![]});})[_0x8de5('0x23')](function(){return _0x52526b[_0x8de5('0x1f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3ce836[_0x8de5('0x57')][_0x8de5('0x36')]||_0x8de5('0xfb'),'lastPauseAt':moment()[_0x8de5('0xc2')](_0x8de5('0xf0'))});})[_0x8de5('0x23')](respondWithResult(_0xf457c,null))[_0x8de5('0x58')](handleError(_0xf457c,null));};exports[_0x8de5('0xfc')]=function(_0x7748f4,_0x57cb11){if(_0x7748f4['body'][_0x8de5('0xaa')]&&!utils['isValidChannel'](_0x7748f4[_0x8de5('0x57')][_0x8de5('0xaa')])){throw new APIBadRequestError(util[_0x8de5('0xc2')](_0x8de5('0xfd'),_0x7748f4[_0x8de5('0x57')][_0x8de5('0xaa')]));}return db['User']['find']({'where':{'id':_0x7748f4[_0x8de5('0x51')]['id']},'attributes':['id',_0x8de5('0x2c'),'role',_0x8de5('0x5d'),_0x8de5('0x9a'),_0x8de5('0x98'),'voicePause',_0x8de5('0xfe'),_0x8de5('0xff'),_0x8de5('0x100'),_0x8de5('0x101'),_0x8de5('0x102'),'whatsappPause','pauseType','lastPauseAt']})[_0x8de5('0x23')](function(_0x55e804){if(!_0x55e804){throw new APINotFoundError(util[_0x8de5('0xc2')](_0x8de5('0xc3'),_0x7748f4[_0x8de5('0x51')]['id']));}return _0x55e804['unpause'](_0x7748f4['body'][_0x8de5('0xaa')]);})[_0x8de5('0x23')](respondWithResult(_0x57cb11,null))['catch'](APIHandleError(_0x57cb11));};exports['getTeams']=function(_0x12819d,_0x4e9f5b){var _0x3b6e74={};var _0x3e3aa8={};var _0x19e7b3;var _0xa4e1c5;return db[_0x8de5('0x32')]['findOne']({'where':{'id':_0x12819d[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x4e9f5b,null))['then'](function(_0x2ede44){if(_0x2ede44){_0x19e7b3=_0x2ede44;_0x3e3aa8[_0x8de5('0xcb')]=_[_0x8de5('0xd5')](db['Team'][_0x8de5('0x33')]);_0x3e3aa8[_0x8de5('0x40')]=_[_0x8de5('0xd5')](_0x12819d[_0x8de5('0x40')]);_0x3e3aa8[_0x8de5('0xd0')]=_[_0x8de5('0xcc')](_0x3e3aa8[_0x8de5('0xcb')],_0x3e3aa8[_0x8de5('0x40')]);_0x3b6e74['attributes']=_[_0x8de5('0xcc')](_0x3e3aa8['model'],qs[_0x8de5('0xcd')](_0x12819d[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x3b6e74[_0x8de5('0x44')]=_0x3b6e74[_0x8de5('0x44')][_0x8de5('0x49')]?_0x3b6e74[_0x8de5('0x44')]:_0x3e3aa8[_0x8de5('0xcb')];_0x3b6e74[_0x8de5('0xce')]=qs[_0x8de5('0xcf')](_0x12819d[_0x8de5('0x40')][_0x8de5('0xcf')]);_0x3b6e74[_0x8de5('0x3f')]=qs['filters'](_['pick'](_0x12819d[_0x8de5('0x40')],_0x3e3aa8[_0x8de5('0xd0')]));if(_0x12819d[_0x8de5('0x40')][_0x8de5('0x27')]){_0x3b6e74[_0x8de5('0x3f')]=_[_0x8de5('0xd1')](_0x3b6e74[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x3b6e74['attributes'],function(_0x6838f8){var _0x7e3d84={};_0x7e3d84[_0x6838f8]={'$like':'%'+_0x12819d[_0x8de5('0x40')][_0x8de5('0x27')]+'%'};return _0x7e3d84;})});}_0x3b6e74=_[_0x8de5('0xd1')]({},_0x3b6e74,_0x12819d[_0x8de5('0x54')]);return _0x19e7b3[_0x8de5('0x103')](_0x3b6e74);}})[_0x8de5('0x23')](function(_0xea101a){if(_0xea101a){_0xa4e1c5=_0xea101a[_0x8de5('0x49')];if(!_0x12819d[_0x8de5('0x40')][_0x8de5('0xc4')](_0x8de5('0xd3'))){_0x3b6e74[_0x8de5('0x1b')]=qs['limit'](_0x12819d[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x3b6e74[_0x8de5('0x19')]=qs['offset'](_0x12819d[_0x8de5('0x40')][_0x8de5('0x19')]);}return _0x19e7b3[_0x8de5('0x103')](_0x3b6e74);}})['then'](function(_0x4737de){if(_0x4737de){return _0x4737de?{'count':_0xa4e1c5,'rows':_0x4737de}:null;}})['then'](respondWithResult(_0x4e9f5b,null))['catch'](handleError(_0x4e9f5b,null));};exports[_0x8de5('0x104')]=function(_0x3e8e97,_0x391c63){var _0x4c687e=_0x3e8e97[_0x8de5('0x51')]['id'];var _0xeddd5=_0x3e8e97[_0x8de5('0x57')]?_0x3e8e97[_0x8de5('0x57')][_0x8de5('0x5c')]:null;var _0x2a5ada=[];return Promise['resolve']()['then'](function(){if(!_0xeddd5)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x8de5('0x23')](function(){return db[_0x8de5('0x32')]['findOne']({'where':{'id':_0x4c687e}});})['then'](function(_0x152f4b){if(!_0x152f4b)throw new APINotFoundError(util[_0x8de5('0xc2')](_0x8de5('0xc3'),_0x3e8e97[_0x8de5('0x51')]['id']));return db[_0x8de5('0x64')][_0x8de5('0x105')](function(_0x2b3dc4){return _0x152f4b[_0x8de5('0x104')](_0xeddd5,{'transaction':_0x2b3dc4})[_0x8de5('0x23')](function(){return db[_0x8de5('0x106')]['findAll']({'where':{'id':{'$in':_0xeddd5}}});})['then'](function(_0x2ebaa5){var _0x6da83f=_[_0x8de5('0x34')](_0x2ebaa5,function(_0xdc5b9){return _0xdc5b9[_0x8de5('0x107')]();});return Promise[_0x8de5('0x56')](_0x6da83f);})[_0x8de5('0x23')](function(_0x222ac7){_0x2a5ada=_[_0x8de5('0x108')](_0x222ac7);var _0x1a4fb9=_[_0x8de5('0x34')](_0x2a5ada,function(_0xcc79ab){return _0xcc79ab['addAgent'](_0x152f4b['id'],{'transaction':_0x2b3dc4});});return Promise[_0x8de5('0x56')](_0x1a4fb9);})['then'](function(){if(!_0x152f4b[_0x8de5('0x98')])return;var _0x24e9bc=_[_0x8de5('0x27')](_0x2a5ada,function(_0x211ecc){return _0x211ecc[_0x8de5('0x109')](_0x8de5('0xaa'))===_0x8de5('0x10a');});var _0xa1b769=_[_0x8de5('0x34')](_0x24e9bc,function(_0x7e0e40){return db['UserVoiceQueueRt'][_0x8de5('0x10b')]({'membername':_0x152f4b[_0x8de5('0x2c')],'UserId':_0x152f4b['id'],'queue_name':_0x7e0e40[_0x8de5('0x2c')],'VoiceQueueId':_0x7e0e40['id'],'interface':_[_0x8de5('0x62')](_0x152f4b[_0x8de5('0x9a')])?util[_0x8de5('0xc2')](_0x8de5('0xa7'),_0x152f4b[_0x8de5('0x2c')]):_0x152f4b['interface'],'paused':_0x152f4b['voicePause']||![],'penalty':_0x152f4b[_0x8de5('0xa1')]},{'transaction':_0x2b3dc4});});return Promise[_0x8de5('0x56')](_0xa1b769);})[_0x8de5('0x23')](function(){return db[_0x8de5('0x10c')][_0x8de5('0x46')]({'where':{'teamId':{'$in':_0xeddd5}}});})[_0x8de5('0x23')](function(_0x205897){var _0xce8c45=_[_0x8de5('0x34')](_0x205897,function(_0xb498ac){return db[_0x8de5('0x10d')][_0x8de5('0x77')]({'UserId':_0x152f4b['id'],'VoicePrefixId':_0xb498ac[_0x8de5('0x10e')]},{'transaction':_0x2b3dc4});});return Promise['all'](_0xce8c45);});});})[_0x8de5('0x23')](function(){for(var _0x51cddf=0x0;_0x51cddf<_0x2a5ada[_0x8de5('0x49')];_0x51cddf++){var _0x27a2a0=_0x2a5ada[_0x51cddf][_0x8de5('0x109')]('channel');var _0x40d3a9=_0x27a2a0+_0x8de5('0xa3');socket[_0x8de5('0xad')](_0x8de5('0x25')+_0x27a2a0+'Queue:save',{'UserId':_0x4c687e,['queueField']:_0x2a5ada[_0x51cddf]['id']});}})[_0x8de5('0x23')](respondWithStatusCode(_0x391c63,null))['catch'](APIHandleError(_0x391c63));};exports[_0x8de5('0x10f')]=function(_0x2090dd,_0x1da368){var _0x6d567c=_0x2090dd[_0x8de5('0x51')]['id'];var _0x4fc705=null;if(_0x2090dd[_0x8de5('0x40')][_0x8de5('0x5c')]){_0x4fc705=_[_0x8de5('0xac')](_0x2090dd[_0x8de5('0x40')]['ids'])?_0x2090dd[_0x8de5('0x40')]['ids']:[_0x2090dd[_0x8de5('0x40')][_0x8de5('0x5c')]];}var _0x5e86ea=[];return Promise[_0x8de5('0xf7')]()[_0x8de5('0x23')](function(){if(!_0x4fc705)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x8de5('0x23')](function(){return db['User'][_0x8de5('0x91')]({'where':{'id':_0x6d567c}});})[_0x8de5('0x23')](function(_0x21b433){if(!_0x21b433)throw new APINotFoundError(util['format'](_0x8de5('0xc3'),_0x2090dd[_0x8de5('0x51')]['id']));return db[_0x8de5('0x64')][_0x8de5('0x105')](function(_0x59a603){return _0x21b433[_0x8de5('0x10f')](_0x4fc705,{'transaction':_0x59a603})[_0x8de5('0x23')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x4fc705}}});})[_0x8de5('0x23')](function(_0x55cab8){var _0x4a5d8b=_[_0x8de5('0x34')](_0x55cab8,function(_0x2ddc43){return _0x2ddc43[_0x8de5('0x107')]();});return Promise[_0x8de5('0x56')](_0x4a5d8b);})[_0x8de5('0x23')](function(_0x1854f3){_0x5e86ea=_[_0x8de5('0x108')](_0x1854f3);var _0x26a2bf=_[_0x8de5('0x34')](_0x5e86ea,function(_0x1ef312){return _0x1ef312[_0x8de5('0x110')](_0x21b433['id'],{'transaction':_0x59a603});});return Promise[_0x8de5('0x56')](_0x26a2bf);})[_0x8de5('0x23')](function(){if(!_0x21b433[_0x8de5('0x98')])return;var _0x10d8c9=_[_0x8de5('0x27')](_0x5e86ea,function(_0xe922c3){return _0xe922c3[_0x8de5('0x109')]('channel')===_0x8de5('0x10a');});var _0x2b7957=_[_0x8de5('0x34')](_0x10d8c9,function(_0x192008){return db[_0x8de5('0xa9')][_0x8de5('0x2e')]({'where':{'VoiceQueueId':_0x192008['id'],'UserId':_0x21b433['id']},'transaction':_0x59a603});});return Promise[_0x8de5('0x56')](_0x2b7957);})[_0x8de5('0x23')](function(){return db[_0x8de5('0x10c')][_0x8de5('0x46')]({'where':{'teamId':{'$in':_0x4fc705}}});})[_0x8de5('0x23')](function(_0x17d3bb){var _0x4e42f4=_[_0x8de5('0x34')](_0x17d3bb,function(_0x343b11){return db[_0x8de5('0x10d')][_0x8de5('0x2e')]({'where':{'UserId':_0x21b433['id'],'VoicePrefixId':_0x343b11[_0x8de5('0x10e')]}},{'transaction':_0x59a603});});return Promise[_0x8de5('0x56')](_0x4e42f4);});});})['then'](function(){for(var _0x29162f=0x0;_0x29162f<_0x5e86ea[_0x8de5('0x49')];_0x29162f++){var _0x4b53e7=_0x5e86ea[_0x29162f][_0x8de5('0x109')]('channel');var _0x227a68=_0x4b53e7+_0x8de5('0xa3');socket[_0x8de5('0xad')](_0x8de5('0x25')+_0x4b53e7+'Queue:remove',{'UserId':_0x6d567c,['queueField']:_0x5e86ea[_0x29162f]['id']});}})[_0x8de5('0x23')](respondWithStatusCode(_0x1da368,null))[_0x8de5('0x58')](APIHandleError(_0x1da368));};exports[_0x8de5('0x111')]=function(_0x1a727c,_0x2bcbd6){var _0x40dc9d={};var _0x1a957f={};var _0x2645fd;var _0x3ea541;return db[_0x8de5('0x32')][_0x8de5('0x91')]({'where':{'id':_0x1a727c[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x2bcbd6,null))[_0x8de5('0x23')](function(_0x27ca72){if(_0x27ca72){_0x2645fd=_0x27ca72;_0x1a957f['model']=_[_0x8de5('0xd5')](db[_0x8de5('0xc5')][_0x8de5('0x33')]);_0x1a957f[_0x8de5('0x40')]=_[_0x8de5('0xd5')](_0x1a727c[_0x8de5('0x40')]);_0x1a957f[_0x8de5('0xd0')]=_[_0x8de5('0xcc')](_0x1a957f[_0x8de5('0xcb')],_0x1a957f[_0x8de5('0x40')]);_0x40dc9d[_0x8de5('0x44')]=_['intersection'](_0x1a957f[_0x8de5('0xcb')],qs[_0x8de5('0xcd')](_0x1a727c[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x40dc9d[_0x8de5('0x44')]=_0x40dc9d['attributes'][_0x8de5('0x49')]?_0x40dc9d[_0x8de5('0x44')]:_0x1a957f['model'];_0x40dc9d[_0x8de5('0xce')]=qs['sort'](_0x1a727c['query'][_0x8de5('0xcf')]);_0x40dc9d[_0x8de5('0x3f')]=qs['filters'](_[_0x8de5('0xd9')](_0x1a727c[_0x8de5('0x40')],_0x1a957f['filters']));if(_0x1a727c[_0x8de5('0x40')]['filter']){_0x40dc9d[_0x8de5('0x3f')]=_[_0x8de5('0xd1')](_0x40dc9d[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x40dc9d[_0x8de5('0x44')],function(_0x32eda5){var _0x5cf8eb={};_0x5cf8eb[_0x32eda5]={'$like':'%'+_0x1a727c[_0x8de5('0x40')][_0x8de5('0x27')]+'%'};return _0x5cf8eb;})});}_0x40dc9d=_[_0x8de5('0xd1')]({},_0x40dc9d,_0x1a727c['options']);return _0x2645fd[_0x8de5('0x111')](_0x40dc9d);}})[_0x8de5('0x23')](function(_0x19c2b5){if(_0x19c2b5){_0x3ea541=_0x19c2b5[_0x8de5('0x49')];if(!_0x1a727c[_0x8de5('0x40')][_0x8de5('0xc4')]('nolimit')){_0x40dc9d[_0x8de5('0x1b')]=qs[_0x8de5('0x1b')](_0x1a727c[_0x8de5('0x40')][_0x8de5('0x1b')]);_0x40dc9d[_0x8de5('0x19')]=qs[_0x8de5('0x19')](_0x1a727c['query'][_0x8de5('0x19')]);}return _0x2645fd[_0x8de5('0x111')](_0x40dc9d);}})['then'](function(_0x1e9a80){if(_0x1e9a80){return _0x1e9a80?{'count':_0x3ea541,'rows':_0x1e9a80}:null;}})['then'](respondWithResult(_0x2bcbd6,null))[_0x8de5('0x58')](handleError(_0x2bcbd6,null));};exports['getAgents']=function(_0x566465,_0x37da35){var _0x9c79a2={};var _0x2593df={};var _0x32460e;return db[_0x8de5('0x32')][_0x8de5('0x91')]({'where':{'id':_0x566465[_0x8de5('0x51')]['id']}})[_0x8de5('0x23')](handleEntityNotFound(_0x37da35,null))[_0x8de5('0x23')](function(_0x3bded3){if(_0x3bded3){_0x32460e=_0x3bded3;_0x2593df[_0x8de5('0xcb')]=_['keys'](db[_0x8de5('0x32')][_0x8de5('0x33')]);_0x2593df[_0x8de5('0x40')]=_[_0x8de5('0xd5')](_0x566465['query']);_0x2593df[_0x8de5('0xd0')]=_[_0x8de5('0xcc')](_0x2593df[_0x8de5('0xcb')],_0x2593df[_0x8de5('0x40')]);_0x9c79a2[_0x8de5('0x44')]=_[_0x8de5('0xcc')](_0x2593df[_0x8de5('0xcb')],qs[_0x8de5('0xcd')](_0x566465[_0x8de5('0x40')][_0x8de5('0xcd')]));_0x9c79a2[_0x8de5('0x44')]=_0x9c79a2[_0x8de5('0x44')][_0x8de5('0x49')]?_0x9c79a2[_0x8de5('0x44')]:_0x2593df[_0x8de5('0xcb')];_0x9c79a2[_0x8de5('0xce')]=qs[_0x8de5('0xcf')](_0x566465['query'][_0x8de5('0xcf')]);_0x9c79a2['where']=qs['filters'](_[_0x8de5('0xd9')](_0x566465[_0x8de5('0x40')],_0x2593df[_0x8de5('0xd0')]));if(_0x566465[_0x8de5('0x40')][_0x8de5('0x27')]){_0x9c79a2['where']=_[_0x8de5('0xd1')](_0x9c79a2[_0x8de5('0x3f')],{'$or':_[_0x8de5('0x34')](_0x9c79a2['attributes'],function(_0x95c71f){var _0x396c6a={};_0x396c6a[_0x95c71f]={'$like':'%'+_0x566465[_0x8de5('0x40')]['filter']+'%'};return _0x396c6a;})});}_0x9c79a2[_0x8de5('0xcb')]=db[_0x8de5('0x32')];_0x9c79a2['as']='Agents';_0x9c79a2=_[_0x8de5('0xd1')]({},_0x9c79a2,_0x566465[_0x8de5('0x54')]);return _0x32460e[_0x8de5('0xee')]({'include':[_0x9c79a2]});}})['then'](function(_0x2ba96d){if(_0x2ba96d){var _0x521e51={},_0x140d01=[];for(var _0x3ed78e=0x0;_0x3ed78e<_0x2ba96d[_0x8de5('0x49')];_0x3ed78e+=0x1){for(var _0x1b9e60=0x0,_0x59776a;_0x1b9e60<_0x2ba96d[_0x3ed78e][_0x8de5('0x7d')][_0x8de5('0x49')];_0x1b9e60+=0x1){_0x59776a=_0x2ba96d[_0x3ed78e][_0x8de5('0x7d')][_0x1b9e60]['get']({'plain':!![]});_0x521e51[_0x59776a['id']]=_0x59776a;}}_0x521e51=_[_0x8de5('0x112')](_0x521e51);for(var _0x25f12e=qs['offset'](_0x566465['query'][_0x8de5('0x19')]);_0x25f12e<_0x521e51[_0x8de5('0x49')]&&_0x140d01[_0x8de5('0x49')]=_0x31da08[_0xae86('0x47')]){throw new Error(_0xae86('0x48'));}})['then'](function(){if(_0x123b4f){return db['UserVoiceQueueRt'][_0xae86('0x3f')]({'where':{'membername':_0x123b4f[_0xae86('0x1c')]},'individualHooks':!![]});}})[_0xae86('0x11')](function(){if(_0x123b4f){return _0x123b4f[_0xae86('0x49')]({'raw':!![]});}})['then'](function(_0x544df8){if(_0x123b4f){if(_0x544df8){var _0x506aff=[];_0x2c6357=_0x544df8;if(_0x2c6357[_0xae86('0x25')]){for(var _0x49f46f=0x0;_0x49f46f<_0x2c6357[_0xae86('0x25')];_0x49f46f++){_0x506aff[_0xae86('0x29')](db['UserVoiceQueueRt'][_0xae86('0x4a')]({'membername':_0x123b4f['name'],'UserId':_0x123b4f['id'],'queue_name':_0x2c6357[_0x49f46f][_0xae86('0x1c')],'VoiceQueueId':_0x2c6357[_0x49f46f]['id'],'interface':_0x106e28,'paused':_0x123b4f[_0xae86('0x43')]||![],'penalty':_0x2c6357[_0x49f46f][_0xae86('0x4b')]||0x0}));}return BPromise['all'](_0x506aff);}}}})[_0xae86('0x11')](function(){if(_0x123b4f){return db['MemberReport'][_0xae86('0xa')]({'where':{'membername':_0x123b4f[_0xae86('0x1c')],'exitAt':null}});}})['then'](function(_0x53103d){if(_0x123b4f){if(_0x53103d&&_0x53103d['length']){var _0x3feb94=[];_0x53103d[_0xae86('0x4c')](function(_0x210828){_0x3feb94[_0xae86('0x29')](_0x210828[_0xae86('0x22')]({'exitAt':moment()[_0xae86('0x2b')](_0xae86('0x26'))}));});return BPromise['all'](_0x3feb94);}}})[_0xae86('0x11')](function(){if(_0x123b4f){var _0x5881c7=[];var _0x22c38c=[];var _0x55b64d=utils['getChannels']();var _0xd57d0f={'membername':_0x123b4f['name'],'interface':_0x106e28,'enterAt':moment()[_0xae86('0x2b')](_0xae86('0x26')),'role':_0x123b4f[_0xae86('0x2f')],'internal':_0x123b4f[_0xae86('0x1d')]};_0x55b64d['forEach'](function(_0x509096){_0x5881c7[_0xae86('0x29')](_[_0xae86('0x4d')]({'channel':_0x509096,'type':'LOGIN','data1':_0xae86('0x4e'),'data2':_0x106e28},_0xd57d0f));if(_0x123b4f['loginInPause']){_0x22c38c[_0xae86('0x29')](_['merge']({'channel':_0x509096,'type':'PAUSE','data1':_0xae86('0x4f')},_0xd57d0f));}});return db['MemberReport'][_0xae86('0x30')](_0x5881c7[_0xae86('0x50')](_0x22c38c),{'individualHooks':!![]});}})[_0xae86('0x11')](function(){if(_0x123b4f){return _0x123b4f['update']({'online':!![],'lastLoginAt':moment()[_0xae86('0x2b')](_0xae86('0x26')),'voicePause':_0x123b4f[_0xae86('0x43')]||![],'mailPause':_0x123b4f[_0xae86('0x43')]||![],'chatPause':_0x123b4f['loginInPause']||![],'faxPause':_0x123b4f[_0xae86('0x43')]||![],'smsPause':_0x123b4f[_0xae86('0x43')]||![],'openchannelPause':_0x123b4f['loginInPause']||![],'pauseType':_0x123b4f[_0xae86('0x43')]?_0xae86('0x4f'):null,'lastPauseAt':moment()['format'](_0xae86('0x26')),'interface':_0x106e28});}})[_0xae86('0x11')](function(_0x1fe737){_0x3cec78(_0x1fe737);})[_0xae86('0x13')](function(_0x5bc228){_0x8de8e6(_0x35a3b2[_0xae86('0x14')](0x1f4,_0x5bc228[_0xae86('0x15')]));});});}; \ No newline at end of file +var _0x0da4=['smsPause','pauseType','lastPauseAt','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','length','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','LOGININPAUSE','concat','lodash','util','moment','../../config/utils','../../config/logger','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','findAll','options','where','attributes','include','map','model','then','info','debug','error','message','User','raw','ShowUser','stringify','catch','PauseUser','find','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','SIP/%s','body','type','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','chatPause','faxPause'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x0da4,0xc3));var _0x40da=function(_0xa2871f,_0x3406fa){_0xa2871f=_0xa2871f-0x0;var _0x53687c=_0x0da4[_0xa2871f];return _0x53687c;};'use strict';var _=require(_0x40da('0x0'));var util=require(_0x40da('0x1'));var moment=require(_0x40da('0x2'));var BPromise=require('bluebird');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x40da('0x3'));var logger=require(_0x40da('0x4'))('rpc');var config=require('../../config/environment');config[_0x40da('0x5')]=_['defaults'](config[_0x40da('0x5')],{'host':_0x40da('0x6'),'port':0x18eb});var socket=require(_0x40da('0x7'))(new Redis(config['redis']));require(_0x40da('0x8'))[_0x40da('0x9')](socket);exports[_0x40da('0xa')]=function(_0x2ce62c){var _0x152cf0=this;return new Promise(function(_0x56be62,_0x241899){return db['User'][_0x40da('0xb')]({'raw':_0x2ce62c[_0x40da('0xc')]?_0x2ce62c[_0x40da('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x2ce62c['options']?_0x2ce62c['options'][_0x40da('0xd')]||null:null,'attributes':_0x2ce62c[_0x40da('0xc')]?_0x2ce62c[_0x40da('0xc')][_0x40da('0xe')]||null:null,'limit':_0x2ce62c[_0x40da('0xc')]?_0x2ce62c[_0x40da('0xc')]['limit']||null:null,'include':_0x2ce62c['options']?_0x2ce62c['options'][_0x40da('0xf')]?_[_0x40da('0x10')](_0x2ce62c[_0x40da('0xc')]['include'],function(_0x28c8a6){return{'model':db[_0x28c8a6[_0x40da('0x11')]],'as':_0x28c8a6['as'],'attributes':_0x28c8a6[_0x40da('0xe')],'include':_0x28c8a6[_0x40da('0xf')]?_[_0x40da('0x10')](_0x28c8a6['include'],function(_0x185c28){return{'model':db[_0x185c28[_0x40da('0x11')]],'as':_0x185c28['as'],'attributes':_0x185c28[_0x40da('0xe')],'include':_0x185c28[_0x40da('0xf')]?_[_0x40da('0x10')](_0x185c28['include'],function(_0x7bb412){return{'model':db[_0x7bb412[_0x40da('0x11')]],'as':_0x7bb412['as'],'attributes':_0x7bb412[_0x40da('0xe')]};}):[]};}):[]};}):[]:[]})[_0x40da('0x12')](function(_0x80576){logger[_0x40da('0x13')](_0x40da('0xa'),_0x2ce62c);logger[_0x40da('0x14')]('GetUser',_0x2ce62c,JSON['stringify'](_0x80576));_0x56be62(_0x80576);})['catch'](function(_0x1867b5){logger['error']('GetUser',_0x1867b5['message'],_0x2ce62c);_0x241899(_0x152cf0[_0x40da('0x15')](0x1f4,_0x1867b5[_0x40da('0x16')]));});});};exports['ShowUser']=function(_0x51ac10){var _0x47cce2=this;return new Promise(function(_0x185601,_0x2c499b){return db[_0x40da('0x17')]['find']({'raw':_0x51ac10[_0x40da('0xc')]?_0x51ac10[_0x40da('0xc')][_0x40da('0x18')]===undefined?!![]:![]:!![],'where':_0x51ac10['options']?_0x51ac10['options'][_0x40da('0xd')]||null:null,'attributes':_0x51ac10[_0x40da('0xc')]?_0x51ac10[_0x40da('0xc')]['attributes']||null:null,'include':_0x51ac10[_0x40da('0xc')]?_0x51ac10[_0x40da('0xc')]['include']?_[_0x40da('0x10')](_0x51ac10[_0x40da('0xc')][_0x40da('0xf')],function(_0x562ae7){return{'model':db[_0x562ae7[_0x40da('0x11')]],'as':_0x562ae7['as'],'attributes':_0x562ae7[_0x40da('0xe')],'include':_0x562ae7[_0x40da('0xf')]?_[_0x40da('0x10')](_0x562ae7['include'],function(_0x2c1a62){return{'model':db[_0x2c1a62[_0x40da('0x11')]],'as':_0x2c1a62['as'],'attributes':_0x2c1a62[_0x40da('0xe')],'include':_0x2c1a62['include']?_[_0x40da('0x10')](_0x2c1a62[_0x40da('0xf')],function(_0x54deaa){return{'model':db[_0x54deaa[_0x40da('0x11')]],'as':_0x54deaa['as'],'attributes':_0x54deaa['attributes']};}):[]};}):[]};}):[]:[]})[_0x40da('0x12')](function(_0x155833){logger[_0x40da('0x13')](_0x40da('0x19'),_0x51ac10);logger[_0x40da('0x14')](_0x40da('0x19'),_0x51ac10,JSON[_0x40da('0x1a')](_0x155833));_0x185601(_0x155833);})[_0x40da('0x1b')](function(_0x1c8078){logger['error']('ShowUser',_0x1c8078[_0x40da('0x16')],_0x51ac10);_0x2c499b(_0x47cce2[_0x40da('0x15')](0x1f4,_0x1c8078[_0x40da('0x16')]));});});};exports[_0x40da('0x1c')]=function(_0x6774db){var _0x197ba9;return db['User'][_0x40da('0x1d')]({'where':_0x6774db['options']['where']||{},'attributes':['id',_0x40da('0x1e'),_0x40da('0x1f'),_0x40da('0x20'),_0x40da('0x21')]})['then'](function(_0x416669){if(!_0x416669){throw new Error(util[_0x40da('0x22')](_0x40da('0x23'),_0x6774db[_0x40da('0x24')]['id']));}_0x197ba9=_0x416669;return db[_0x40da('0x25')][_0x40da('0x26')]({'paused':0x1},{'where':{'UserId':_0x197ba9['id']},'individualHooks':!![]});})[_0x40da('0x12')](function(){return db[_0x40da('0x27')][_0x40da('0xb')]({'where':{'membername':_0x197ba9[_0x40da('0x1e')],'type':_0x40da('0x28'),'exitAt':null}});})[_0x40da('0x12')](function(_0x33bcce){if(_0x33bcce&&_0x33bcce['length']){var _0x46579e=moment()[_0x40da('0x22')](_0x40da('0x29'));for(var _0x116b36=0x0,_0x30720e=_0x33bcce['length'];_0x116b36<_0x30720e;_0x116b36++){_0x33bcce[_0x116b36][_0x40da('0x2a')]({'exitAt':_0x46579e});}}})[_0x40da('0x12')](function(){var _0x203b3d=[];var _0x4233cf=utils['getChannels']();_0x4233cf[_0x40da('0x2b')](function(_0x4c953d){_0x203b3d[_0x40da('0x2c')]({'channel':_0x4c953d,'membername':_0x197ba9[_0x40da('0x1e')],'interface':_['isNil'](_0x197ba9['interface'])?util[_0x40da('0x22')](_0x40da('0x2d'),_0x197ba9[_0x40da('0x1e')]):_0x197ba9[_0x40da('0x21')],'type':'PAUSE','enterAt':moment()[_0x40da('0x22')](_0x40da('0x29')),'data1':_0x6774db[_0x40da('0x2e')][_0x40da('0x2f')]||_0x40da('0x30'),'role':_0x197ba9[_0x40da('0x1f')],'internal':_0x197ba9[_0x40da('0x20')],'uniqueid':_0x6774db[_0x40da('0x2e')]['uniqueid']||null});});return db[_0x40da('0x27')][_0x40da('0x31')](_0x203b3d,{'individualHooks':!![]});})['then'](function(){return _0x197ba9[_0x40da('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x6774db[_0x40da('0x2e')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x3cddb0){throw _0x3cddb0;});};exports[_0x40da('0x32')]=function(_0x500025){return Promise[_0x40da('0x33')]()['then'](function(){if(_0x500025[_0x40da('0x2e')][_0x40da('0x34')]&&!utils[_0x40da('0x35')](_0x500025[_0x40da('0x2e')]['channel'])){throw new Error(util[_0x40da('0x22')](_0x40da('0x36'),_0x500025[_0x40da('0x2e')][_0x40da('0x34')]));}return db[_0x40da('0x17')][_0x40da('0x37')]({'where':_0x500025[_0x40da('0xc')][_0x40da('0xd')]||{},'attributes':['id',_0x40da('0x1e'),_0x40da('0x1f'),'internal',_0x40da('0x21'),_0x40da('0x38'),'voicePause',_0x40da('0x39'),_0x40da('0x3a'),_0x40da('0x3b'),'openchannelPause',_0x40da('0x3c'),'whatsappPause',_0x40da('0x3d'),_0x40da('0x3e')]});})['then'](function(_0x2d2f69){if(!_0x2d2f69){throw new Error(util[_0x40da('0x22')]('User\x20with\x20id\x20%s\x20not\x20found',_0x500025[_0x40da('0x24')]['id']));}return _0x2d2f69[_0x40da('0x3f')](_0x500025[_0x40da('0x2e')]['channel'],_0x40da('0x40'));})[_0x40da('0x1b')](function(_0x1ff1ed){throw _0x1ff1ed;});};exports[_0x40da('0x41')]=function(_0x3610e4){var _0xefa299=this;return new Promise(function(_0x45ae32,_0x5be634){var _0x5fbb79;return db[_0x40da('0x17')][_0x40da('0x37')]({'where':_0x3610e4[_0x40da('0xc')][_0x40da('0xd')]||{},'attributes':['id',_0x40da('0x1e')]})['then'](function(_0x5e2db3){if(_0x5e2db3){_0x5fbb79=_0x5e2db3;return db[_0x40da('0x25')][_0x40da('0x42')]({'where':{'membername':_0x5fbb79[_0x40da('0x1e')]},'individualHooks':!![]});}})[_0x40da('0x12')](function(){if(_0x5fbb79){return db[_0x40da('0x27')][_0x40da('0xb')]({'where':{'membername':_0x5fbb79['name'],'exitAt':null}});}})[_0x40da('0x12')](function(_0x14c0c5){if(_0x5fbb79){if(_0x14c0c5&&_0x14c0c5['length']){var _0x50627d=[];_0x14c0c5[_0x40da('0x2b')](function(_0x5defee){_0x50627d['push'](_0x5defee[_0x40da('0x26')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x40da('0x43')](_0x50627d);}}})[_0x40da('0x12')](function(){if(_0x5fbb79){return _0x5fbb79[_0x40da('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x40da('0x12')](function(_0x4238e5){_0x45ae32(_0x4238e5);})[_0x40da('0x1b')](function(_0x452626){_0x5be634(_0xefa299['error'](0x1f4,_0x452626[_0x40da('0x16')]));});});};exports[_0x40da('0x44')]=function(_0x359785){var _0x267202=this;return new Promise(function(_0x47a4ce,_0x5506a8){var _0x153dd8;var _0x196b7d;var _0x2a40bd;var _0x3b6f55;return db[_0x40da('0x17')][_0x40da('0x37')]({'where':_0x359785['options'][_0x40da('0xd')]||{},'attributes':['id',_0x40da('0x1e'),'role',_0x40da('0x45'),'phone',_0x40da('0x20'),_0x40da('0x46'),'interface']})[_0x40da('0x12')](function(_0xea3af3){if(_0xea3af3){_0x153dd8=_0xea3af3;_0x3b6f55=_0x359785['body'][_0x40da('0x21')]?_0x359785[_0x40da('0x2e')][_0x40da('0x21')]:util[_0x40da('0x22')]('SIP/%s',_0x153dd8[_0x40da('0x1e')]);return db[_0x40da('0x17')][_0x40da('0x47')]({'where':{'role':_0x40da('0x48'),'online':!![],'id':{'$ne':_0x153dd8['id']}}});}})[_0x40da('0x12')](function(_0x475232){if(_0x475232){_0x2a40bd=_0x475232;return require(_0x40da('0x49'))['getLicense']();}})[_0x40da('0x12')](function(_0x437da6){if(_0x437da6&&_0x437da6[_0x40da('0x4a')]&&_0x2a40bd>=_0x437da6[_0x40da('0x4a')]){throw new Error(_0x40da('0x4b'));}})[_0x40da('0x12')](function(){if(_0x153dd8){return db[_0x40da('0x25')][_0x40da('0x42')]({'where':{'membername':_0x153dd8[_0x40da('0x1e')]},'individualHooks':!![]});}})['then'](function(){if(_0x153dd8){return _0x153dd8[_0x40da('0x4c')]({'raw':!![]});}})[_0x40da('0x12')](function(_0x5b0557){if(_0x153dd8){if(_0x5b0557){var _0x568c36=[];_0x196b7d=_0x5b0557;if(_0x196b7d['length']){for(var _0x1d16b0=0x0;_0x1d16b0<_0x196b7d[_0x40da('0x4d')];_0x1d16b0++){_0x568c36['push'](db[_0x40da('0x25')][_0x40da('0x4e')]({'membername':_0x153dd8[_0x40da('0x1e')],'UserId':_0x153dd8['id'],'queue_name':_0x196b7d[_0x1d16b0][_0x40da('0x1e')],'VoiceQueueId':_0x196b7d[_0x1d16b0]['id'],'interface':_0x3b6f55,'paused':_0x153dd8['loginInPause']||![],'penalty':_0x196b7d[_0x1d16b0][_0x40da('0x4f')]||0x0}));}return BPromise[_0x40da('0x43')](_0x568c36);}}}})[_0x40da('0x12')](function(){if(_0x153dd8){return db[_0x40da('0x27')][_0x40da('0xb')]({'where':{'membername':_0x153dd8[_0x40da('0x1e')],'exitAt':null}});}})[_0x40da('0x12')](function(_0x31a305){if(_0x153dd8){if(_0x31a305&&_0x31a305[_0x40da('0x4d')]){var _0x4b54f=[];_0x31a305[_0x40da('0x2b')](function(_0x45060a){_0x4b54f[_0x40da('0x2c')](_0x45060a[_0x40da('0x26')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x40da('0x43')](_0x4b54f);}}})[_0x40da('0x12')](function(){if(_0x153dd8){var _0x5517f3=[];var _0x2403bf=[];var _0x499cbb=utils[_0x40da('0x50')]();var _0xef10a2={'membername':_0x153dd8[_0x40da('0x1e')],'interface':_0x3b6f55,'enterAt':moment()[_0x40da('0x22')](_0x40da('0x29')),'role':_0x153dd8[_0x40da('0x1f')],'internal':_0x153dd8[_0x40da('0x20')]};_0x499cbb[_0x40da('0x2b')](function(_0x381842){_0x5517f3[_0x40da('0x2c')](_[_0x40da('0x51')]({'channel':_0x381842,'type':_0x40da('0x52'),'data1':'callysquare','data2':_0x3b6f55},_0xef10a2));if(_0x153dd8[_0x40da('0x46')]){_0x2403bf[_0x40da('0x2c')](_[_0x40da('0x51')]({'channel':_0x381842,'type':'PAUSE','data1':_0x40da('0x53')},_0xef10a2));}});return db[_0x40da('0x27')][_0x40da('0x31')](_0x5517f3[_0x40da('0x54')](_0x2403bf),{'individualHooks':!![]});}})[_0x40da('0x12')](function(){if(_0x153dd8){return _0x153dd8[_0x40da('0x26')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x153dd8[_0x40da('0x46')]||![],'mailPause':_0x153dd8[_0x40da('0x46')]||![],'chatPause':_0x153dd8[_0x40da('0x46')]||![],'faxPause':_0x153dd8[_0x40da('0x46')]||![],'smsPause':_0x153dd8[_0x40da('0x46')]||![],'openchannelPause':_0x153dd8['loginInPause']||![],'pauseType':_0x153dd8[_0x40da('0x46')]?_0x40da('0x53'):null,'lastPauseAt':moment()['format'](_0x40da('0x29')),'interface':_0x3b6f55});}})[_0x40da('0x12')](function(_0x1b937d){_0x47a4ce(_0x1b937d);})[_0x40da('0x1b')](function(_0x4912ce){_0x5506a8(_0x267202[_0x40da('0x15')](0x1f4,_0x4912ce['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index c8eca4d..3a5629f 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 _0x58fd=['save','update','removeListener','register','user:','./user.events'];(function(_0x5ed788,_0x1a6cd7){var _0x33c82f=function(_0x512cb9){while(--_0x512cb9){_0x5ed788['push'](_0x5ed788['shift']());}};_0x33c82f(++_0x1a6cd7);}(_0x58fd,0xe3));var _0xd58f=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x58fd[_0x29b609];return _0x54c952;};'use strict';var UserEvents=require(_0xd58f('0x0'));var events=[_0xd58f('0x1'),'remove',_0xd58f('0x2')];function createListener(_0x37d255,_0x3977ec){return function(_0x51f4e9){_0x3977ec['emit'](_0x37d255,_0x51f4e9);};}function removeListener(_0x479e2d,_0x17cd1e){return function(){UserEvents[_0xd58f('0x3')](_0x479e2d,_0x17cd1e);};}exports[_0xd58f('0x4')]=function(_0x458d85){for(var _0x4e9af8=0x0,_0x418999=events['length'];_0x4e9af8<_0x418999;_0x4e9af8++){var _0x201842=events[_0x4e9af8];var _0x13e108=createListener(_0xd58f('0x5')+_0x201842,_0x458d85);UserEvents['on'](_0x201842,_0x13e108);}}; \ No newline at end of file +var _0x4a72=['register','user:','save','remove','update','emit','removeListener'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4a72,0xbf));var _0x24a7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4a72[_0x2641f9];return _0x585741;};'use strict';var UserEvents=require('./user.events');var events=[_0x24a7('0x0'),_0x24a7('0x1'),_0x24a7('0x2')];function createListener(_0x2640db,_0x41a9b4){return function(_0x2c91d0){_0x41a9b4[_0x24a7('0x3')](_0x2640db,_0x2c91d0);};}function removeListener(_0x5f11b9,_0xc1b08f){return function(){UserEvents[_0x24a7('0x4')](_0x5f11b9,_0xc1b08f);};}exports[_0x24a7('0x5')]=function(_0x346792){for(var _0x586557=0x0,_0x302e01=events['length'];_0x586557<_0x302e01;_0x586557++){var _0x16d080=events[_0x586557];var _0x55d1b0=createListener(_0x24a7('0x6')+_0x16d080,_0x346792);UserEvents['on'](_0x16d080,_0x55d1b0);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 39e6d4c..21972f3 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x585cdf,_0x4481a9){var _0x121702=function(_0x12e6ad){while(--_0x12e6ad){_0x585cdf['push'](_0x585cdf['shift']());}};_0x121702(++_0x4481a9);}(_0x70e0,0x17b));var _0x070e=function(_0x39ba9d,_0x491034){_0x39ba9d=_0x39ba9d-0x0;var _0x5e80ea=_0x70e0[_0x39ba9d];return _0x5e80ea;};'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(_0x469b7d,_0x4760f8){var _0xc78a4b=function(_0xd48e6c){while(--_0xd48e6c){_0x469b7d['push'](_0x469b7d['shift']());}};_0xc78a4b(++_0x4760f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index dae8149..ee1e055 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 _0x4bc2=['sequelize','exports'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x4bc2,0xe4));var _0x24bc=function(_0x385ac9,_0x504a83){_0x385ac9=_0x385ac9-0x0;var _0x24710a=_0x4bc2[_0x385ac9];return _0x24710a;};'use strict';var Sequelize=require(_0x24bc('0x0'));module[_0x24bc('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ab3=['sequelize','exports'];(function(_0xcbaaf7,_0x3924d5){var _0x3f53e9=function(_0x5ace45){while(--_0x5ace45){_0xcbaaf7['push'](_0xcbaaf7['shift']());}};_0x3f53e9(++_0x3924d5);}(_0x5ab3,0x180));var _0x35ab=function(_0x5880d2,_0x540781){_0x5880d2=_0x5880d2-0x0;var _0x53d139=_0x5ab3[_0x5880d2];return _0x53d139;};'use strict';var Sequelize=require(_0x35ab('0x0'));module[_0x35ab('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 7a20758..07b3173 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 _0xa281=['moment','bluebird','request-promise','path','exports','define','UserChatQueue','lodash','util','../../config/logger','api'];(function(_0x3afc2a,_0x55d741){var _0x23116c=function(_0x3602f1){while(--_0x3602f1){_0x3afc2a['push'](_0x3afc2a['shift']());}};_0x23116c(++_0x55d741);}(_0xa281,0xf9));var _0x1a28=function(_0x1e4954,_0x12e65f){_0x1e4954=_0x1e4954-0x0;var _0x3d2953=_0xa281[_0x1e4954];return _0x3d2953;};'use strict';var _=require(_0x1a28('0x0'));var util=require(_0x1a28('0x1'));var logger=require(_0x1a28('0x2'))(_0x1a28('0x3'));var moment=require(_0x1a28('0x4'));var BPromise=require(_0x1a28('0x5'));var rp=require(_0x1a28('0x6'));var fs=require('fs');var path=require(_0x1a28('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x1a28('0x8')]=function(_0x9979a,_0x41484e){return _0x9979a[_0x1a28('0x9')](_0x1a28('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e5f=['./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3f99e0,_0x504666){var _0x2c539c=function(_0x54d546){while(--_0x54d546){_0x3f99e0['push'](_0x3f99e0['shift']());}};_0x2c539c(++_0x504666);}(_0x9e5f,0x1ee));var _0xf9e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf9e5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf9e5('0x1'));var BPromise=require('bluebird');var rp=require(_0xf9e5('0x2'));var fs=require('fs');var path=require(_0xf9e5('0x3'));var rimraf=require(_0xf9e5('0x4'));var config=require(_0xf9e5('0x5'));var attributes=require(_0xf9e5('0x6'));module[_0xf9e5('0x7')]=function(_0x4cba11,_0x3a0110){return _0x4cba11['define'](_0xf9e5('0x8'),attributes,{'tableName':_0xf9e5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index b94aeee..bf49b92 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 _0xa836=['jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x13f5a1,_0x4b49b4){var _0x11c25b=function(_0x5d4e13){while(--_0x5d4e13){_0x13f5a1['push'](_0x13f5a1['shift']());}};_0x11c25b(++_0x4b49b4);}(_0xa836,0xdd));var _0x6a83=function(_0x46f5ac,_0x2722a4){_0x46f5ac=_0x46f5ac-0x0;var _0x5a17db=_0xa836[_0x46f5ac];return _0x5a17db;};'use strict';var _=require(_0x6a83('0x0'));var util=require(_0x6a83('0x1'));var moment=require(_0x6a83('0x2'));var BPromise=require(_0x6a83('0x3'));var rs=require(_0x6a83('0x4'));var fs=require('fs');var Redis=require(_0x6a83('0x5'));var db=require(_0x6a83('0x6'))['db'];var utils=require(_0x6a83('0x7'));var logger=require(_0x6a83('0x8'))('rpc');var config=require(_0x6a83('0x9'));var jayson=require(_0x6a83('0xa'));var client=jayson['client'][_0x6a83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5999da,_0x35472c,_0x50c231){return new BPromise(function(_0x5a62be,_0x27f6e1){return client[_0x6a83('0xc')](_0x5999da,_0x50c231)['then'](function(_0x5b0871){logger[_0x6a83('0xd')](_0x6a83('0xe'),_0x35472c,'request\x20sent');logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x35472c,_0x6a83('0xf'),JSON[_0x6a83('0x10')](_0x5b0871));if(_0x5b0871[_0x6a83('0x11')]){if(_0x5b0871[_0x6a83('0x11')]['code']===0x1f4){logger['error'](_0x6a83('0xe'),_0x35472c,_0x5b0871[_0x6a83('0x11')]['message']);return _0x27f6e1(_0x5b0871['error'][_0x6a83('0x12')]);}logger[_0x6a83('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x35472c,_0x5b0871['error'][_0x6a83('0x12')]);return _0x5a62be(_0x5b0871[_0x6a83('0x11')][_0x6a83('0x12')]);}else{logger[_0x6a83('0xd')](_0x6a83('0xe'),_0x35472c,_0x6a83('0xf'));_0x5a62be(_0x5b0871[_0x6a83('0x13')][_0x6a83('0x12')]);}})[_0x6a83('0x14')](function(_0x25142a){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x35472c,_0x25142a);_0x27f6e1(_0x25142a);});});} \ No newline at end of file +var _0xc15e=['client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x51909b,_0x1f65b2){var _0x4905eb=function(_0x37f8e4){while(--_0x37f8e4){_0x51909b['push'](_0x51909b['shift']());}};_0x4905eb(++_0x1f65b2);}(_0xc15e,0x186));var _0xec15=function(_0x40b242,_0x38d533){_0x40b242=_0x40b242-0x0;var _0x4b846b=_0xc15e[_0x40b242];return _0x4b846b;};'use strict';var _=require('lodash');var util=require(_0xec15('0x0'));var moment=require(_0xec15('0x1'));var BPromise=require(_0xec15('0x2'));var rs=require(_0xec15('0x3'));var fs=require('fs');var Redis=require(_0xec15('0x4'));var db=require(_0xec15('0x5'))['db'];var utils=require(_0xec15('0x6'));var logger=require(_0xec15('0x7'))(_0xec15('0x8'));var config=require('../../config/environment');var jayson=require(_0xec15('0x9'));var client=jayson[_0xec15('0xa')][_0xec15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x449bc2,_0x200ed7,_0x3aa0c6){return new BPromise(function(_0x10a089,_0x361c7d){return client[_0xec15('0xc')](_0x449bc2,_0x3aa0c6)[_0xec15('0xd')](function(_0x5ab588){logger['info'](_0xec15('0xe'),_0x200ed7,_0xec15('0xf'));logger[_0xec15('0x10')](_0xec15('0x11'),_0x200ed7,_0xec15('0xf'),JSON[_0xec15('0x12')](_0x5ab588));if(_0x5ab588['error']){if(_0x5ab588[_0xec15('0x13')][_0xec15('0x14')]===0x1f4){logger[_0xec15('0x13')](_0xec15('0xe'),_0x200ed7,_0x5ab588[_0xec15('0x13')]['message']);return _0x361c7d(_0x5ab588[_0xec15('0x13')]['message']);}logger['error'](_0xec15('0xe'),_0x200ed7,_0x5ab588[_0xec15('0x13')][_0xec15('0x15')]);return _0x10a089(_0x5ab588[_0xec15('0x13')][_0xec15('0x15')]);}else{logger[_0xec15('0x16')](_0xec15('0xe'),_0x200ed7,_0xec15('0xf'));_0x10a089(_0x5ab588[_0xec15('0x17')][_0xec15('0x15')]);}})[_0xec15('0x18')](function(_0x36b0a0){logger[_0xec15('0x13')](_0xec15('0xe'),_0x200ed7,_0x36b0a0);_0x361c7d(_0x36b0a0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 95de652..9916470 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5b9e58,_0x51f4e1){var _0x5f1012=function(_0x3d066a){while(--_0x3d066a){_0x5b9e58['push'](_0x5b9e58['shift']());}};_0x5f1012(++_0x51f4e1);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3e9933,_0x14b5a8){var _0x2b1365=function(_0x28fb75){while(--_0x28fb75){_0x3e9933['push'](_0x3e9933['shift']());}};_0x2b1365(++_0x14b5a8);}(_0xedd9,0xfc));var _0x9edd=function(_0x3c4cf2,_0x11a4c5){_0x3c4cf2=_0x3c4cf2-0x0;var _0x57f90d=_0xedd9[_0x3c4cf2];return _0x57f90d;};'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 diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c6db880..dae2061 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 _0xf827=['INTEGER','sequelize'];(function(_0x52df53,_0x28d727){var _0x313eab=function(_0x189a88){while(--_0x189a88){_0x52df53['push'](_0x52df53['shift']());}};_0x313eab(++_0x28d727);}(_0xf827,0x7f));var _0x7f82=function(_0x1331ba,_0x3f5772){_0x1331ba=_0x1331ba-0x0;var _0x2a2f6b=_0xf827[_0x1331ba];return _0x2a2f6b;};'use strict';var Sequelize=require(_0x7f82('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7f82('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7f82('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe053=['sequelize','INTEGER'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xe053,0xbc));var _0x3e05=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xe053[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require(_0x3e05('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3e05('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f5bf3e0..48215b9 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 _0x92da=['path','rimraf','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','moment','bluebird'];(function(_0x2a3e04,_0x1c9bc9){var _0x5d3fd2=function(_0x51de9e){while(--_0x51de9e){_0x2a3e04['push'](_0x2a3e04['shift']());}};_0x5d3fd2(++_0x1c9bc9);}(_0x92da,0x1dc));var _0xa92d=function(_0x10e6d9,_0x4c91fc){_0x10e6d9=_0x10e6d9-0x0;var _0x39171d=_0x92da[_0x10e6d9];return _0x39171d;};'use strict';var _=require(_0xa92d('0x0'));var util=require('util');var logger=require(_0xa92d('0x1'))('api');var moment=require(_0xa92d('0x2'));var BPromise=require(_0xa92d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa92d('0x4'));var rimraf=require(_0xa92d('0x5'));var config=require('../../config/environment');var attributes=require(_0xa92d('0x6'));module[_0xa92d('0x7')]=function(_0x1887a7,_0x24bc1e){return _0x1887a7['define'](_0xa92d('0x8'),attributes,{'tableName':_0xa92d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d7a=['bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','define','lodash','util','../../config/logger','moment'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x3d7a,0xc4));var _0xa3d7=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0x3d7a[_0x405385];return _0x43837b;};'use strict';var _=require(_0xa3d7('0x0'));var util=require(_0xa3d7('0x1'));var logger=require(_0xa3d7('0x2'))('api');var moment=require(_0xa3d7('0x3'));var BPromise=require(_0xa3d7('0x4'));var rp=require(_0xa3d7('0x5'));var fs=require('fs');var path=require(_0xa3d7('0x6'));var rimraf=require('rimraf');var config=require(_0xa3d7('0x7'));var attributes=require(_0xa3d7('0x8'));module['exports']=function(_0x2775a5,_0x2005e3){return _0x2775a5[_0xa3d7('0x9')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 414cbbd..2f5acea 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 _0xb0e5=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserFaxQueue,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','info','request\x20sent'];(function(_0x47aa5e,_0x5a65bc){var _0xbaa4ef=function(_0x2528d2){while(--_0x2528d2){_0x47aa5e['push'](_0x47aa5e['shift']());}};_0xbaa4ef(++_0x5a65bc);}(_0xb0e5,0x15c));var _0x5b0e=function(_0x5c027f,_0xa40135){_0x5c027f=_0x5c027f-0x0;var _0x5392f3=_0xb0e5[_0x5c027f];return _0x5392f3;};'use strict';var _=require(_0x5b0e('0x0'));var util=require(_0x5b0e('0x1'));var moment=require('moment');var BPromise=require(_0x5b0e('0x2'));var rs=require(_0x5b0e('0x3'));var fs=require('fs');var Redis=require(_0x5b0e('0x4'));var db=require(_0x5b0e('0x5'))['db'];var utils=require(_0x5b0e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5b0e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5b0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cc948,_0x162662,_0x62720d){return new BPromise(function(_0x176155,_0x4c6cc1){return client[_0x5b0e('0x9')](_0x4cc948,_0x62720d)['then'](function(_0x9e570f){logger[_0x5b0e('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x162662,_0x5b0e('0xb'));logger[_0x5b0e('0xc')](_0x5b0e('0xd'),_0x162662,'request\x20sent',JSON[_0x5b0e('0xe')](_0x9e570f));if(_0x9e570f[_0x5b0e('0xf')]){if(_0x9e570f['error'][_0x5b0e('0x10')]===0x1f4){logger[_0x5b0e('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x162662,_0x9e570f[_0x5b0e('0xf')]['message']);return _0x4c6cc1(_0x9e570f[_0x5b0e('0xf')]['message']);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x162662,_0x9e570f[_0x5b0e('0xf')][_0x5b0e('0x11')]);return _0x176155(_0x9e570f[_0x5b0e('0xf')][_0x5b0e('0x11')]);}else{logger[_0x5b0e('0xa')](_0x5b0e('0x12'),_0x162662,'request\x20sent');_0x176155(_0x9e570f['result']['message']);}})[_0x5b0e('0x13')](function(_0x141d0b){logger[_0x5b0e('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x162662,_0x141d0b);_0x4c6cc1(_0x141d0b);});});} \ No newline at end of file +var _0xd21b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x27753e,_0x5d7345){var _0x1cfc4f=function(_0x3d07f1){while(--_0x3d07f1){_0x27753e['push'](_0x27753e['shift']());}};_0x1cfc4f(++_0x5d7345);}(_0xd21b,0x135));var _0xbd21=function(_0x3aacea,_0x4dec2d){_0x3aacea=_0x3aacea-0x0;var _0xabe687=_0xd21b[_0x3aacea];return _0xabe687;};'use strict';var _=require(_0xbd21('0x0'));var util=require(_0xbd21('0x1'));var moment=require(_0xbd21('0x2'));var BPromise=require(_0xbd21('0x3'));var rs=require(_0xbd21('0x4'));var fs=require('fs');var Redis=require(_0xbd21('0x5'));var db=require(_0xbd21('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd21('0x7'))(_0xbd21('0x8'));var config=require(_0xbd21('0x9'));var jayson=require(_0xbd21('0xa'));var client=jayson[_0xbd21('0xb')][_0xbd21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ea46d,_0x1c0a0e,_0x4102bc){return new BPromise(function(_0x352b73,_0x4d0b8c){return client[_0xbd21('0xd')](_0x4ea46d,_0x4102bc)[_0xbd21('0xe')](function(_0x3a23e8){logger[_0xbd21('0xf')](_0xbd21('0x10'),_0x1c0a0e,'request\x20sent');logger[_0xbd21('0x11')](_0xbd21('0x12'),_0x1c0a0e,_0xbd21('0x13'),JSON[_0xbd21('0x14')](_0x3a23e8));if(_0x3a23e8[_0xbd21('0x15')]){if(_0x3a23e8[_0xbd21('0x15')][_0xbd21('0x16')]===0x1f4){logger[_0xbd21('0x15')](_0xbd21('0x10'),_0x1c0a0e,_0x3a23e8[_0xbd21('0x15')][_0xbd21('0x17')]);return _0x4d0b8c(_0x3a23e8[_0xbd21('0x15')]['message']);}logger[_0xbd21('0x15')](_0xbd21('0x10'),_0x1c0a0e,_0x3a23e8[_0xbd21('0x15')][_0xbd21('0x17')]);return _0x352b73(_0x3a23e8[_0xbd21('0x15')]['message']);}else{logger[_0xbd21('0xf')](_0xbd21('0x10'),_0x1c0a0e,_0xbd21('0x13'));_0x352b73(_0x3a23e8[_0xbd21('0x18')][_0xbd21('0x17')]);}})[_0xbd21('0x19')](function(_0x5752a6){logger[_0xbd21('0x15')](_0xbd21('0x10'),_0x1c0a0e,_0x5752a6);_0x4d0b8c(_0x5752a6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d49ba92..ac04ff4 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(_0x752005,_0x14dc74){var _0x40629c=function(_0x189e3d){while(--_0x189e3d){_0x752005['push'](_0x752005['shift']());}};_0x40629c(++_0x14dc74);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x59aeab,_0x2351a7){var _0x5af628=function(_0x2dd9ef){while(--_0x2dd9ef){_0x59aeab['push'](_0x59aeab['shift']());}};_0x5af628(++_0x2351a7);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d5f7412..2ad1a57 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 _0x6df5=['INTEGER','sequelize','exports'];(function(_0x1717f5,_0x17ec76){var _0x2ba043=function(_0x76acac){while(--_0x76acac){_0x1717f5['push'](_0x1717f5['shift']());}};_0x2ba043(++_0x17ec76);}(_0x6df5,0x154));var _0x56df=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x6df5[_0xf80b3];return _0x10c489;};'use strict';var Sequelize=require(_0x56df('0x0'));module[_0x56df('0x1')]={'penalty':{'type':Sequelize[_0x56df('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d84=['INTEGER','exports'];(function(_0x2574fa,_0x5adae8){var _0x35ceb7=function(_0x43c5ae){while(--_0x43c5ae){_0x2574fa['push'](_0x2574fa['shift']());}};_0x35ceb7(++_0x5adae8);}(_0x0d84,0x16b));var _0x40d8=function(_0x20f7ad,_0x33396f){_0x20f7ad=_0x20f7ad-0x0;var _0x4c9fef=_0x0d84[_0x20f7ad];return _0x4c9fef;};'use strict';var Sequelize=require('sequelize');module[_0x40d8('0x0')]={'penalty':{'type':Sequelize[_0x40d8('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index be37398..25ea9a8 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 _0xbbdc=['api','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x352be4,_0x180a93){var _0x17a2df=function(_0x3984ab){while(--_0x3984ab){_0x352be4['push'](_0x352be4['shift']());}};_0x17a2df(++_0x180a93);}(_0xbbdc,0x171));var _0xcbbd=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0xbbdc[_0x51cc1d];return _0x2eb9f2;};'use strict';var _=require(_0xcbbd('0x0'));var util=require(_0xcbbd('0x1'));var logger=require(_0xcbbd('0x2'))(_0xcbbd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbbd('0x4'));var rimraf=require(_0xcbbd('0x5'));var config=require(_0xcbbd('0x6'));var attributes=require(_0xcbbd('0x7'));module[_0xcbbd('0x8')]=function(_0x584d64,_0x40e2c8){return _0x584d64[_0xcbbd('0x9')](_0xcbbd('0xa'),attributes,{'tableName':_0xcbbd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a57=['request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0xc1a7e7,_0x4b21dd){var _0x4cf2c0=function(_0x43c844){while(--_0x43c844){_0xc1a7e7['push'](_0xc1a7e7['shift']());}};_0x4cf2c0(++_0x4b21dd);}(_0x6a57,0x103));var _0x76a5=function(_0x1843b3,_0x10995a){_0x1843b3=_0x1843b3-0x0;var _0x3c7de0=_0x6a57[_0x1843b3];return _0x3c7de0;};'use strict';var _=require(_0x76a5('0x0'));var util=require(_0x76a5('0x1'));var logger=require(_0x76a5('0x2'))(_0x76a5('0x3'));var moment=require('moment');var BPromise=require(_0x76a5('0x4'));var rp=require(_0x76a5('0x5'));var fs=require('fs');var path=require(_0x76a5('0x6'));var rimraf=require(_0x76a5('0x7'));var config=require(_0x76a5('0x8'));var attributes=require('./userMailQueue.attributes');module[_0x76a5('0x9')]=function(_0x1b6744,_0x2eade7){return _0x1b6744[_0x76a5('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','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 6bd2eca..a8dd826 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x140ade,_0x531b68){var _0x5de3e3=function(_0x390838){while(--_0x390838){_0x140ade['push'](_0x140ade['shift']());}};_0x5de3e3(++_0x531b68);}(_0xe14b,0x93));var _0xbe14=function(_0x1273bb,_0x193a23){_0x1273bb=_0x1273bb-0x0;var _0x107662=_0xe14b[_0x1273bb];return _0x107662;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ 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(_0x2daed5,_0x220392){var _0xabeea2=function(_0x18a5a9){while(--_0x18a5a9){_0x2daed5['push'](_0x2daed5['shift']());}};_0xabeea2(++_0x220392);}(_0xa41a,0x6b));var _0xaa41=function(_0x41882d,_0x27f926){_0x41882d=_0x41882d-0x0;var _0x13440f=_0xa41a[_0x41882d];return _0x13440f;};'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 ccd8fda..5ea54f3 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 _0xbcfa=['../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x40f7e1,_0x4cf5bf){var _0xd1a133=function(_0x1174c5){while(--_0x1174c5){_0x40f7e1['push'](_0x40f7e1['shift']());}};_0xd1a133(++_0x4cf5bf);}(_0xbcfa,0x170));var _0xabcf=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xbcfa[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xabcf('0x0'));var util=require(_0xabcf('0x1'));var path=require(_0xabcf('0x2'));var timeout=require(_0xabcf('0x3'));var express=require('express');var router=express[_0xabcf('0x4')]();var fs_extra=require(_0xabcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xabcf('0x6'));var config=require(_0xabcf('0x7'));var controller=require(_0xabcf('0x8'));router['post']('/',auth[_0xabcf('0x9')](),controller['sendUserNotification']);module[_0xabcf('0xa')]=router; \ No newline at end of file +var _0xb184=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','multer','util'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0xb184,0x1d2));var _0x4b18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb184[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4b18('0x0'));var util=require(_0x4b18('0x1'));var path=require(_0x4b18('0x2'));var timeout=require(_0x4b18('0x3'));var express=require(_0x4b18('0x4'));var router=express['Router']();var fs_extra=require(_0x4b18('0x5'));var auth=require(_0x4b18('0x6'));var interaction=require(_0x4b18('0x7'));var config=require(_0x4b18('0x8'));var controller=require(_0x4b18('0x9'));router[_0x4b18('0xa')]('/',auth[_0x4b18('0xb')](),controller['sendUserNotification']);module[_0x4b18('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3b1c325..bc1a716 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 _0x18fa=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x18fa,0x12c));var _0xa18f=function(_0x148d3a,_0x110475){_0x148d3a=_0x148d3a-0x0;var _0x4d96ec=_0x18fa[_0x148d3a];return _0x4d96ec;};'use strict';var Sequelize=require(_0xa18f('0x0'));module[_0xa18f('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xa18f('0x2')]},'recipientsId':{'type':Sequelize[_0xa18f('0x3')]},'recipientsDescription':{'type':Sequelize[_0xa18f('0x2')]},'beep':{'type':Sequelize[_0xa18f('0x4')]}}; \ No newline at end of file +var _0x84a7=['sequelize','TEXT','BOOLEAN'];(function(_0x1c97b5,_0x57047b){var _0x3a7bea=function(_0x212b44){while(--_0x212b44){_0x1c97b5['push'](_0x1c97b5['shift']());}};_0x3a7bea(++_0x57047b);}(_0x84a7,0x90));var _0x784a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x784a('0x0'));module['exports']={'body':{'type':Sequelize[_0x784a('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x784a('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x784a('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 7b8dc4f..583884f 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 _0xa33b=['../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','queue','replace','Queue','push','all','findOne','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa33b,0x11a));var _0xba33=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa33b[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xba33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba33('0x1'));var jsonpatch=require(_0xba33('0x2'));var rp=require(_0xba33('0x3'));var moment=require(_0xba33('0x4'));var BPromise=require(_0xba33('0x5'));var Mustache=require(_0xba33('0x6'));var util=require(_0xba33('0x7'));var path=require('path');var sox=require(_0xba33('0x8'));var csv=require(_0xba33('0x9'));var ejs=require(_0xba33('0xa'));var fs=require('fs');var fs_extra=require(_0xba33('0xb'));var _=require(_0xba33('0xc'));var squel=require(_0xba33('0xd'));var crypto=require('crypto');var jsforce=require(_0xba33('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xba33('0x9'));var querystring=require('querystring');var Papa=require(_0xba33('0xf'));var Redis=require('ioredis');var authService=require(_0xba33('0x10'));var qs=require(_0xba33('0x11'));var as=require(_0xba33('0x12'));var hardwareService=require(_0xba33('0x13'));var logger=require(_0xba33('0x14'))(_0xba33('0x15'));var utils=require(_0xba33('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xba33('0x17'));var db=require(_0xba33('0x18'))['db'];config['redis']=_['defaults'](config[_0xba33('0x19')],{'host':_0xba33('0x1a'),'port':0x18eb});var socket=require(_0xba33('0x1b'))(new Redis(config[_0xba33('0x19')]));require(_0xba33('0x1c'))[_0xba33('0x1d')](socket);function respondWithStatusCode(_0xc3d73d,_0x5228d7){_0x5228d7=_0x5228d7||0xcc;return function(_0x40386b){if(_0x40386b){return _0xc3d73d[_0xba33('0x1e')](_0x5228d7);}return _0xc3d73d['status'](_0x5228d7)[_0xba33('0x1f')]();};}function respondWithResult(_0x4427ce,_0x3aabb2){_0x3aabb2=_0x3aabb2||0xc8;return function(_0x5406fe){if(_0x5406fe){return _0x4427ce[_0xba33('0x20')](_0x3aabb2)[_0xba33('0x21')](_0x5406fe);}};}function respondWithFilteredResult(_0x59e015,_0x3d7fee){return function(_0x57c37b){if(_0x57c37b){var _0x5fdb2f=typeof _0x3d7fee[_0xba33('0x22')]===_0xba33('0x23')&&typeof _0x3d7fee['limit']===_0xba33('0x23');var _0x468bbd=_0x57c37b[_0xba33('0x24')];var _0x416d59=_0x5fdb2f?0x0:_0x3d7fee[_0xba33('0x22')];var _0x54f1c5=_0x5fdb2f?_0x57c37b[_0xba33('0x24')]:_0x3d7fee[_0xba33('0x22')]+_0x3d7fee[_0xba33('0x25')];var _0x2619db;if(_0x54f1c5>=_0x468bbd){_0x54f1c5=_0x468bbd;_0x2619db=0xc8;}else{_0x2619db=0xce;}_0x59e015[_0xba33('0x20')](_0x2619db);return _0x59e015[_0xba33('0x26')](_0xba33('0x27'),_0x416d59+'-'+_0x54f1c5+'/'+_0x468bbd)[_0xba33('0x21')](_0x57c37b);}return null;};}function patchUpdates(_0x3b04b2){return function(_0x35f8b1){try{jsonpatch[_0xba33('0x28')](_0x35f8b1,_0x3b04b2,!![]);}catch(_0x14fe2e){return BPromise[_0xba33('0x29')](_0x14fe2e);}return _0x35f8b1[_0xba33('0x2a')]();};}function saveUpdates(_0x4a3d91,_0x5a09d3){return function(_0x5a28b1){if(_0x5a28b1){return _0x5a28b1['update'](_0x4a3d91)[_0xba33('0x2b')](function(_0x127e4a){return _0x127e4a;});}return null;};}function removeEntity(_0x2c2b80,_0x1dfd87){return function(_0x3b8c78){if(_0x3b8c78){return _0x3b8c78['destroy']()[_0xba33('0x2b')](function(){_0x2c2b80['status'](0xcc)[_0xba33('0x1f')]();});}};}function handleEntityNotFound(_0xc53858,_0x26f470){return function(_0x26059f){if(!_0x26059f){_0xc53858['sendStatus'](0x194);}return _0x26059f;};}function handleError(_0x3b4d0a,_0x58dfe8){_0x58dfe8=_0x58dfe8||0x1f4;return function(_0x5be7ed){logger[_0xba33('0x2c')](_0x5be7ed['stack']);if(_0x5be7ed['name']){delete _0x5be7ed[_0xba33('0x2d')];}_0x3b4d0a[_0xba33('0x20')](_0x58dfe8)[_0xba33('0x2e')](_0x5be7ed);};}exports[_0xba33('0x2f')]=function(_0x35f48e,_0xb791c0,_0x4502ec){if(!_0x35f48e[_0xba33('0x30')][_0xba33('0x31')](_0xba33('0x32'))&&!_0x35f48e[_0xba33('0x30')][_0xba33('0x31')](_0xba33('0x33'))){throw new db[(_0xba33('0x34'))][(_0xba33('0x35'))](_0xba33('0x36'));}else{if(_0x35f48e[_0xba33('0x30')][_0xba33('0x31')](_0xba33('0x33'))&&!_0x35f48e['body'][_0xba33('0x31')](_0xba33('0x37'))){throw new db['Sequelize'][(_0xba33('0x35'))](_0xba33('0x38'));}if(!_0x35f48e[_0xba33('0x30')][_0xba33('0x31')](_0xba33('0x39'))){throw new db[(_0xba33('0x34'))]['ValidationError'](_0xba33('0x3a'));}else{try{var _0x1b9d90=JSON[_0xba33('0x3b')](_0x35f48e['body'][_0xba33('0x39')]);}catch(_0x2dd81f){logger[_0xba33('0x2c')](_0x2dd81f);throw new db[(_0xba33('0x34'))][(_0xba33('0x35'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x3966e7=['chatqueue',_0xba33('0x3c'),_0xba33('0x3d'),_0xba33('0x3e'),'smsqueue','voicequeue',_0xba33('0x3f'),_0xba33('0x40'),_0xba33('0x41')];if(_[_0xba33('0x42')](_0x1b9d90,function(_0x59d21a){return!_[_0xba33('0x43')](_0x3966e7,_0x59d21a[_0xba33('0x44')]['toLowerCase']());})){throw new db[(_0xba33('0x34'))][(_0xba33('0x35'))](_0xba33('0x45'));}}}var _0x22164b={};_0x22164b['senderName']=_0x35f48e['body'][_0xba33('0x31')]('senderName')?_0x35f48e[_0xba33('0x30')][_0xba33('0x46')]:_0x35f48e[_0xba33('0x41')][_0xba33('0x47')];_0x22164b[_0xba33('0x48')]=_[_0xba33('0x49')](_0x35f48e[_0xba33('0x30')][_0xba33('0x48')])?null:_0x35f48e[_0xba33('0x30')][_0xba33('0x48')];_0x22164b['beep']=_0x35f48e[_0xba33('0x30')][_0xba33('0x4a')]||![];_0x22164b[_0xba33('0x4b')]=_0x35f48e['user']['id'];return getContent(_0x35f48e[_0xba33('0x30')])['then'](function(_0x16b5c7){_0x22164b['body']=_0x16b5c7;return getRecipients(_0x1b9d90);})[_0xba33('0x2b')](function(_0x38cb95){_0x22164b[_0xba33('0x4c')]=_[_0xba33('0x4d')](_0x38cb95)['join'](',');return db[_0xba33('0x4e')][_0xba33('0x4f')](function(_0x133f08){return db[_0xba33('0x50')][_0xba33('0x51')](_0x22164b,{'raw':!![],'transaction':_0x133f08})[_0xba33('0x2b')](function(_0xddfa09){var _0x5685f4={'sender':_0x22164b[_0xba33('0x46')],'description':_0x22164b[_0xba33('0x48')],'content':_0x22164b[_0xba33('0x30')],'beep':_0x22164b['beep']};_0x38cb95[_0xba33('0x52')](function(_0x485320){_0x5685f4[_0xba33('0x53')]=_0x485320;socket[_0xba33('0x54')](_0xba33('0x55'),_0x5685f4);});return _0xddfa09;});});})[_0xba33('0x2b')](respondWithResult(_0xb791c0,0xc9))[_0xba33('0x56')](handleError(_0xb791c0,null));};function getContent(_0x4ce7ca){return new BPromise(function(_0x40306c,_0x4f0466){if(_0x4ce7ca[_0xba33('0x32')]){_0x40306c(_0x4ce7ca[_0xba33('0x32')]);return;}return db[_0xba33('0x57')]['findOne']({'attributes':[_0xba33('0x58')],'where':{'id':_0x4ce7ca['TemplateId']},'raw':!![]})['then'](function(_0x28c4d0){if(!_0x28c4d0)throw new db[(_0xba33('0x34'))]['ValidationError'](_0xba33('0x59'));var _0x246b0f=Mustache['render'](_0x28c4d0[_0xba33('0x58')],_0x4ce7ca[_0xba33('0x37')]);_0x40306c(_0x246b0f);})[_0xba33('0x56')](function(_0x223315){_0x4f0466(_0x223315);});});}function getRecipients(_0x21dcf1){return new BPromise(function(_0x3b787c,_0x58e171){var _0x408a7c=[];var _0x4dad15=[];_0x21dcf1['forEach'](function(_0x3f12a6){var _0x55fb42=_[_0xba33('0x5a')](_0x3f12a6['model']['toLowerCase']());if(_0x55fb42===_0xba33('0x5b')){_0x408a7c=_[_0xba33('0x5c')](_0x408a7c,_0x3f12a6[_0xba33('0x5d')]);}else{if(_['includes'](_0x55fb42,_0xba33('0x5e')))_0x55fb42=_0x55fb42[_0xba33('0x5f')](_0xba33('0x5e'),_0xba33('0x60'));_0x3f12a6['ids']['forEach'](function(_0x1b8590){_0x4dad15[_0xba33('0x61')](getAgents(_0x55fb42,_0x1b8590));});}});return BPromise[_0xba33('0x62')](_0x4dad15)[_0xba33('0x2b')](function(_0x1f7124){_0x408a7c=_[_0xba33('0x5c')](_0x408a7c,_['flatten'](_0x1f7124));_0x3b787c(_0x408a7c);})['catch'](function(_0x1794ca){_0x58e171(_0x1794ca);});});}function getAgents(_0x1add66,_0x3d1cd0){return new BPromise(function(_0xcde6f0,_0x2791ef){return db[_0x1add66][_0xba33('0x63')]({'where':{'id':_0x3d1cd0}})[_0xba33('0x2b')](function(_0x3f261f){return _0x3f261f[_0xba33('0x64')]({'attributes':['id'],'raw':!![]})[_0xba33('0x2b')](function(_0x3eac57){var _0x1b8b73=_[_0xba33('0x65')](_0x3eac57,'id');_0xcde6f0(_0x1b8b73);});})[_0xba33('0x56')](function(_0x2cedc7){_0x2791ef(_0x2cedc7);});});} \ No newline at end of file +var _0x54be=['sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','emit','catch','findOne','html','render','view','forEach','User','includes','ids','push','union','flatten','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','then','sendStatus','error','stack','name','send'];(function(_0x4aca63,_0x4f55bf){var _0x5bd612=function(_0x3d0d33){while(--_0x3d0d33){_0x4aca63['push'](_0x4aca63['shift']());}};_0x5bd612(++_0x4f55bf);}(_0x54be,0x94));var _0xe54b=function(_0x394813,_0x3fcf6b){_0x394813=_0x394813-0x0;var _0x4606bd=_0x54be[_0x394813];return _0x4606bd;};'use strict';var emlformat=require(_0xe54b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe54b('0x1'));var jsonpatch=require(_0xe54b('0x2'));var rp=require('request-promise');var moment=require(_0xe54b('0x3'));var BPromise=require(_0xe54b('0x4'));var Mustache=require(_0xe54b('0x5'));var util=require(_0xe54b('0x6'));var path=require('path');var sox=require(_0xe54b('0x7'));var csv=require('to-csv');var ejs=require(_0xe54b('0x8'));var fs=require('fs');var fs_extra=require(_0xe54b('0x9'));var _=require(_0xe54b('0xa'));var squel=require(_0xe54b('0xb'));var crypto=require(_0xe54b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe54b('0xd'));var toCsv=require(_0xe54b('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe54b('0xf'));var authService=require(_0xe54b('0x10'));var qs=require(_0xe54b('0x11'));var as=require(_0xe54b('0x12'));var hardwareService=require(_0xe54b('0x13'));var logger=require(_0xe54b('0x14'))(_0xe54b('0x15'));var utils=require(_0xe54b('0x16'));var config=require(_0xe54b('0x17'));var licenseUtil=require(_0xe54b('0x18'));var db=require(_0xe54b('0x19'))['db'];config[_0xe54b('0x1a')]=_[_0xe54b('0x1b')](config[_0xe54b('0x1a')],{'host':_0xe54b('0x1c'),'port':0x18eb});var socket=require(_0xe54b('0x1d'))(new Redis(config[_0xe54b('0x1a')]));require(_0xe54b('0x1e'))[_0xe54b('0x1f')](socket);function respondWithStatusCode(_0x45e0e8,_0x14066d){_0x14066d=_0x14066d||0xcc;return function(_0x19a570){if(_0x19a570){return _0x45e0e8['sendStatus'](_0x14066d);}return _0x45e0e8[_0xe54b('0x20')](_0x14066d)[_0xe54b('0x21')]();};}function respondWithResult(_0x5090ca,_0x4c07d1){_0x4c07d1=_0x4c07d1||0xc8;return function(_0x2c1e69){if(_0x2c1e69){return _0x5090ca[_0xe54b('0x20')](_0x4c07d1)[_0xe54b('0x22')](_0x2c1e69);}};}function respondWithFilteredResult(_0x2e2ed1,_0xaa4eef){return function(_0xa0fd83){if(_0xa0fd83){var _0x5f035f=typeof _0xaa4eef[_0xe54b('0x23')]===_0xe54b('0x24')&&typeof _0xaa4eef[_0xe54b('0x25')]===_0xe54b('0x24');var _0x5e3cc7=_0xa0fd83[_0xe54b('0x26')];var _0x328344=_0x5f035f?0x0:_0xaa4eef[_0xe54b('0x23')];var _0x58f6cc=_0x5f035f?_0xa0fd83[_0xe54b('0x26')]:_0xaa4eef[_0xe54b('0x23')]+_0xaa4eef[_0xe54b('0x25')];var _0x40842a;if(_0x58f6cc>=_0x5e3cc7){_0x58f6cc=_0x5e3cc7;_0x40842a=0xc8;}else{_0x40842a=0xce;}_0x2e2ed1['status'](_0x40842a);return _0x2e2ed1[_0xe54b('0x27')]('Content-Range',_0x328344+'-'+_0x58f6cc+'/'+_0x5e3cc7)['json'](_0xa0fd83);}return null;};}function patchUpdates(_0x1e0d0e){return function(_0x1fe77c){try{jsonpatch['apply'](_0x1fe77c,_0x1e0d0e,!![]);}catch(_0x408d39){return BPromise['reject'](_0x408d39);}return _0x1fe77c['save']();};}function saveUpdates(_0x5290af,_0x388ba9){return function(_0x2a1333){if(_0x2a1333){return _0x2a1333['update'](_0x5290af)['then'](function(_0x3375e1){return _0x3375e1;});}return null;};}function removeEntity(_0x21c360,_0x396362){return function(_0x36a884){if(_0x36a884){return _0x36a884['destroy']()[_0xe54b('0x28')](function(){_0x21c360[_0xe54b('0x20')](0xcc)[_0xe54b('0x21')]();});}};}function handleEntityNotFound(_0x2b1588,_0x372c91){return function(_0x5664c0){if(!_0x5664c0){_0x2b1588[_0xe54b('0x29')](0x194);}return _0x5664c0;};}function handleError(_0x26c38f,_0x3e6911){_0x3e6911=_0x3e6911||0x1f4;return function(_0x3003c8){logger[_0xe54b('0x2a')](_0x3003c8[_0xe54b('0x2b')]);if(_0x3003c8[_0xe54b('0x2c')]){delete _0x3003c8[_0xe54b('0x2c')];}_0x26c38f[_0xe54b('0x20')](_0x3e6911)[_0xe54b('0x2d')](_0x3003c8);};}exports[_0xe54b('0x2e')]=function(_0x4ac0d8,_0x2ca250,_0x2598b9){if(!_0x4ac0d8[_0xe54b('0x2f')][_0xe54b('0x30')](_0xe54b('0x31'))&&!_0x4ac0d8['body']['hasOwnProperty'](_0xe54b('0x32'))){throw new db[(_0xe54b('0x33'))]['ValidationError'](_0xe54b('0x34'));}else{if(_0x4ac0d8[_0xe54b('0x2f')][_0xe54b('0x30')](_0xe54b('0x32'))&&!_0x4ac0d8[_0xe54b('0x2f')][_0xe54b('0x30')]('view')){throw new db[(_0xe54b('0x33'))]['ValidationError'](_0xe54b('0x35'));}if(!_0x4ac0d8['body'][_0xe54b('0x30')](_0xe54b('0x36'))){throw new db[(_0xe54b('0x33'))][(_0xe54b('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x32b5aa=JSON[_0xe54b('0x38')](_0x4ac0d8[_0xe54b('0x2f')][_0xe54b('0x36')]);}catch(_0x660ea){logger[_0xe54b('0x2a')](_0x660ea);throw new db[(_0xe54b('0x33'))][(_0xe54b('0x37'))](_0xe54b('0x39'));}var _0x11ab42=[_0xe54b('0x3a'),_0xe54b('0x3b'),_0xe54b('0x3c'),_0xe54b('0x3d'),_0xe54b('0x3e'),_0xe54b('0x3f'),_0xe54b('0x40'),_0xe54b('0x41'),'user'];if(_[_0xe54b('0x42')](_0x32b5aa,function(_0x366bb9){return!_['includes'](_0x11ab42,_0x366bb9[_0xe54b('0x43')][_0xe54b('0x44')]());})){throw new db[(_0xe54b('0x33'))][(_0xe54b('0x37'))](_0xe54b('0x45'));}}}var _0x2f68f3={};_0x2f68f3['senderName']=_0x4ac0d8['body'][_0xe54b('0x30')](_0xe54b('0x46'))?_0x4ac0d8[_0xe54b('0x2f')][_0xe54b('0x46')]:_0x4ac0d8[_0xe54b('0x47')][_0xe54b('0x48')];_0x2f68f3[_0xe54b('0x49')]=_['isEmpty'](_0x4ac0d8['body'][_0xe54b('0x49')])?null:_0x4ac0d8[_0xe54b('0x2f')]['recipientsDescription'];_0x2f68f3[_0xe54b('0x4a')]=_0x4ac0d8['body'][_0xe54b('0x4a')]||![];_0x2f68f3['SenderId']=_0x4ac0d8['user']['id'];return getContent(_0x4ac0d8[_0xe54b('0x2f')])[_0xe54b('0x28')](function(_0x1d2232){_0x2f68f3['body']=_0x1d2232;return getRecipients(_0x32b5aa);})['then'](function(_0x2223bf){_0x2f68f3[_0xe54b('0x4b')]=_[_0xe54b('0x4c')](_0x2223bf)[_0xe54b('0x4d')](',');return db[_0xe54b('0x4e')][_0xe54b('0x4f')](function(_0x863bb5){return db[_0xe54b('0x50')][_0xe54b('0x51')](_0x2f68f3,{'raw':!![],'transaction':_0x863bb5})[_0xe54b('0x28')](function(_0x17f651){var _0x512544={'sender':_0x2f68f3['senderName'],'description':_0x2f68f3['recipientsDescription'],'content':_0x2f68f3[_0xe54b('0x2f')],'beep':_0x2f68f3[_0xe54b('0x4a')]};_0x2223bf['forEach'](function(_0x12487f){_0x512544[_0xe54b('0x52')]=_0x12487f;socket[_0xe54b('0x53')]('userNotification:send',_0x512544);});return _0x17f651;});});})[_0xe54b('0x28')](respondWithResult(_0x2ca250,0xc9))[_0xe54b('0x54')](handleError(_0x2ca250,null));};function getContent(_0x4f155b){return new BPromise(function(_0x1504dc,_0x4390e4){if(_0x4f155b[_0xe54b('0x31')]){_0x1504dc(_0x4f155b[_0xe54b('0x31')]);return;}return db['Template'][_0xe54b('0x55')]({'attributes':[_0xe54b('0x56')],'where':{'id':_0x4f155b['TemplateId']},'raw':!![]})['then'](function(_0x17c7f7){if(!_0x17c7f7)throw new db[(_0xe54b('0x33'))][(_0xe54b('0x37'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x34b40c=Mustache[_0xe54b('0x57')](_0x17c7f7[_0xe54b('0x56')],_0x4f155b[_0xe54b('0x58')]);_0x1504dc(_0x34b40c);})['catch'](function(_0x3ca77d){_0x4390e4(_0x3ca77d);});});}function getRecipients(_0x335699){return new BPromise(function(_0xb7ebc1,_0x59db4e){var _0x2598c3=[];var _0x3b0aba=[];_0x335699[_0xe54b('0x59')](function(_0x2b8b52){var _0x122ceb=_['startCase'](_0x2b8b52[_0xe54b('0x43')][_0xe54b('0x44')]());if(_0x122ceb===_0xe54b('0x5a')){_0x2598c3=_['union'](_0x2598c3,_0x2b8b52['ids']);}else{if(_[_0xe54b('0x5b')](_0x122ceb,'queue'))_0x122ceb=_0x122ceb['replace']('queue','Queue');_0x2b8b52[_0xe54b('0x5c')]['forEach'](function(_0x3b6b17){_0x3b0aba[_0xe54b('0x5d')](getAgents(_0x122ceb,_0x3b6b17));});}});return BPromise['all'](_0x3b0aba)[_0xe54b('0x28')](function(_0x856e7f){_0x2598c3=_[_0xe54b('0x5e')](_0x2598c3,_[_0xe54b('0x5f')](_0x856e7f));_0xb7ebc1(_0x2598c3);})[_0xe54b('0x54')](function(_0x1bfc28){_0x59db4e(_0x1bfc28);});});}function getAgents(_0x3d70ce,_0x4c6ed1){return new BPromise(function(_0x14c8a4,_0x1c9d1b){return db[_0x3d70ce][_0xe54b('0x55')]({'where':{'id':_0x4c6ed1}})[_0xe54b('0x28')](function(_0xf46359){return _0xf46359[_0xe54b('0x60')]({'attributes':['id'],'raw':!![]})[_0xe54b('0x28')](function(_0x4cebf8){var _0x50afd4=_['map'](_0x4cebf8,'id');_0x14c8a4(_0x50afd4);});})[_0xe54b('0x54')](function(_0x3e167d){_0x1c9d1b(_0x3e167d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index fb459e0..eb03206 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 _0x4611=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x4611,0xe7));var _0x1461=function(_0x339a66,_0x44b094){_0x339a66=_0x339a66-0x0;var _0xd2afe2=_0x4611[_0x339a66];return _0xd2afe2;};'use strict';var EventEmitter=require(_0x1461('0x0'));var UserNotification=require(_0x1461('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1461('0x2')](0x0);var events={'afterCreate':_0x1461('0x3'),'afterUpdate':_0x1461('0x4'),'afterDestroy':_0x1461('0x5')};function emitEvent(_0x17a745){return function(_0x419593,_0x3fdb02,_0xc38bcc){UserNotificationEvents['emit'](_0x17a745+':'+_0x419593['id'],_0x419593);UserNotificationEvents['emit'](_0x17a745,_0x419593);_0xc38bcc(null);};}for(var e in events){if(events[_0x1461('0x6')](e)){var event=events[e];UserNotification[_0x1461('0x7')](e,emitEvent(event));}}module[_0x1461('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xd1b5=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x73029b,_0x3df32d){var _0x4ef368=function(_0x106423){while(--_0x106423){_0x73029b['push'](_0x73029b['shift']());}};_0x4ef368(++_0x3df32d);}(_0xd1b5,0x1d1));var _0x5d1b=function(_0x2da401,_0x17e6d4){_0x2da401=_0x2da401-0x0;var _0x37127d=_0xd1b5[_0x2da401];return _0x37127d;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x5d1b('0x0'))['db'][_0x5d1b('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5d1b('0x2')](0x0);var events={'afterCreate':_0x5d1b('0x3'),'afterUpdate':_0x5d1b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x33f67d){return function(_0x7b6198,_0x5e6069,_0x412d09){UserNotificationEvents['emit'](_0x33f67d+':'+_0x7b6198['id'],_0x7b6198);UserNotificationEvents[_0x5d1b('0x5')](_0x33f67d,_0x7b6198);_0x412d09(null);};}for(var e in events){if(events[_0x5d1b('0x6')](e)){var event=events[e];UserNotification[_0x5d1b('0x7')](e,emitEvent(event));}}module[_0x5d1b('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f30eb59..f8b0df5 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 _0x44ce=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','../../config/environment','./userNotification.attributes','exports'];(function(_0x2b66ed,_0x3ece7f){var _0x860fe6=function(_0x5a2ff7){while(--_0x5a2ff7){_0x2b66ed['push'](_0x2b66ed['shift']());}};_0x860fe6(++_0x3ece7f);}(_0x44ce,0x160));var _0xe44c=function(_0x2eb38f,_0x17b21e){_0x2eb38f=_0x2eb38f-0x0;var _0x179f7e=_0x44ce[_0x2eb38f];return _0x179f7e;};'use strict';var _=require(_0xe44c('0x0'));var util=require(_0xe44c('0x1'));var logger=require('../../config/logger')(_0xe44c('0x2'));var moment=require(_0xe44c('0x3'));var BPromise=require(_0xe44c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe44c('0x5'));var attributes=require(_0xe44c('0x6'));module[_0xe44c('0x7')]=function(_0x475bb6,_0x369743){return _0x475bb6['define'](_0xe44c('0x8'),attributes,{'tableName':_0xe44c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe44c('0xa'),'collate':_0xe44c('0xb')});}; \ No newline at end of file +var _0xfc6e=['../../config/environment','./userNotification.attributes','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc6e,0x17c));var _0xefc6=function(_0x1559a0,_0x9b8fd7){_0x1559a0=_0x1559a0-0x0;var _0x37e36f=_0xfc6e[_0x1559a0];return _0x37e36f;};'use strict';var _=require(_0xefc6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xefc6('0x1'));var moment=require('moment');var BPromise=require(_0xefc6('0x2'));var rp=require(_0xefc6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefc6('0x4'));var config=require(_0xefc6('0x5'));var attributes=require(_0xefc6('0x6'));module['exports']=function(_0xa99cff,_0x3ba8fe){return _0xa99cff[_0xefc6('0x7')](_0xefc6('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xefc6('0x9'),'collate':_0xefc6('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9382fed..e4234b9 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 _0xac15=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4bbaba,_0x15097c){var _0x34ff2b=function(_0x190d49){while(--_0x190d49){_0x4bbaba['push'](_0x4bbaba['shift']());}};_0x34ff2b(++_0x15097c);}(_0xac15,0x9f));var _0x5ac1=function(_0xb6817d,_0x14eb01){_0xb6817d=_0xb6817d-0x0;var _0x481233=_0xac15[_0xb6817d];return _0x481233;};'use strict';var _=require(_0x5ac1('0x0'));var util=require(_0x5ac1('0x1'));var moment=require(_0x5ac1('0x2'));var BPromise=require(_0x5ac1('0x3'));var rs=require(_0x5ac1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ac1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ac1('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ac1('0x7'));var client=jayson[_0x5ac1('0x8')]['http']({'port':0x232a});config[_0x5ac1('0x9')]=_[_0x5ac1('0xa')](config['redis'],{'host':_0x5ac1('0xb'),'port':0x18eb});var socket=require(_0x5ac1('0xc'))(new Redis(config[_0x5ac1('0x9')]));require(_0x5ac1('0xd'))[_0x5ac1('0xe')](socket);function respondWithRpcPromise(_0x334256,_0x5e3637,_0x262687){return new BPromise(function(_0x2dcf7b,_0x2e4355){return client[_0x5ac1('0xf')](_0x334256,_0x262687)['then'](function(_0x3891c7){logger['info'](_0x5ac1('0x10'),_0x5e3637,'request\x20sent');logger['debug'](_0x5ac1('0x11'),_0x5e3637,_0x5ac1('0x12'),JSON[_0x5ac1('0x13')](_0x3891c7));if(_0x3891c7[_0x5ac1('0x14')]){if(_0x3891c7[_0x5ac1('0x14')][_0x5ac1('0x15')]===0x1f4){logger[_0x5ac1('0x14')]('UserNotification,\x20%s,\x20%s',_0x5e3637,_0x3891c7[_0x5ac1('0x14')][_0x5ac1('0x16')]);return _0x2e4355(_0x3891c7[_0x5ac1('0x14')][_0x5ac1('0x16')]);}logger[_0x5ac1('0x14')](_0x5ac1('0x10'),_0x5e3637,_0x3891c7[_0x5ac1('0x14')][_0x5ac1('0x16')]);return _0x2dcf7b(_0x3891c7['error'][_0x5ac1('0x16')]);}else{logger[_0x5ac1('0x17')](_0x5ac1('0x10'),_0x5e3637,_0x5ac1('0x12'));_0x2dcf7b(_0x3891c7[_0x5ac1('0x18')][_0x5ac1('0x16')]);}})[_0x5ac1('0x19')](function(_0x4b0b54){logger[_0x5ac1('0x14')]('UserNotification,\x20%s,\x20%s',_0x5e3637,_0x4b0b54);_0x2e4355(_0x4b0b54);});});} \ No newline at end of file +var _0x304c=['debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x454d82,_0x3794df){var _0x21fecb=function(_0x234c13){while(--_0x234c13){_0x454d82['push'](_0x454d82['shift']());}};_0x21fecb(++_0x3794df);}(_0x304c,0x1a8));var _0xc304=function(_0xd7ade2,_0x599520){_0xd7ade2=_0xd7ade2-0x0;var _0x491b3a=_0x304c[_0xd7ade2];return _0x491b3a;};'use strict';var _=require(_0xc304('0x0'));var util=require(_0xc304('0x1'));var moment=require(_0xc304('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc304('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc304('0x4'));var logger=require('../../config/logger')(_0xc304('0x5'));var config=require(_0xc304('0x6'));var jayson=require(_0xc304('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xc304('0x8')]=_[_0xc304('0x9')](config[_0xc304('0x8')],{'host':_0xc304('0xa'),'port':0x18eb});var socket=require(_0xc304('0xb'))(new Redis(config[_0xc304('0x8')]));require(_0xc304('0xc'))[_0xc304('0xd')](socket);function respondWithRpcPromise(_0x115e6d,_0x3ddd42,_0x5544a3){return new BPromise(function(_0x26df06,_0x2899e2){return client[_0xc304('0xe')](_0x115e6d,_0x5544a3)[_0xc304('0xf')](function(_0x1af8c3){logger['info'](_0xc304('0x10'),_0x3ddd42,_0xc304('0x11'));logger[_0xc304('0x12')](_0xc304('0x13'),_0x3ddd42,_0xc304('0x11'),JSON[_0xc304('0x14')](_0x1af8c3));if(_0x1af8c3['error']){if(_0x1af8c3[_0xc304('0x15')][_0xc304('0x16')]===0x1f4){logger[_0xc304('0x15')](_0xc304('0x10'),_0x3ddd42,_0x1af8c3[_0xc304('0x15')][_0xc304('0x17')]);return _0x2899e2(_0x1af8c3['error']['message']);}logger['error'](_0xc304('0x10'),_0x3ddd42,_0x1af8c3[_0xc304('0x15')][_0xc304('0x17')]);return _0x26df06(_0x1af8c3[_0xc304('0x15')][_0xc304('0x17')]);}else{logger[_0xc304('0x18')](_0xc304('0x10'),_0x3ddd42,'request\x20sent');_0x26df06(_0x1af8c3[_0xc304('0x19')][_0xc304('0x17')]);}})['catch'](function(_0x381906){logger['error']('UserNotification,\x20%s,\x20%s',_0x3ddd42,_0x381906);_0x2899e2(_0x381906);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6ce2478..8ac0fdb 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 _0xd1f6=['save','update','length','./userNotification.events'];(function(_0x4ac41e,_0x2d0837){var _0x1a0a13=function(_0x1341f4){while(--_0x1341f4){_0x4ac41e['push'](_0x4ac41e['shift']());}};_0x1a0a13(++_0x2d0837);}(_0xd1f6,0xcb));var _0x6d1f=function(_0x386508,_0x40d1fe){_0x386508=_0x386508-0x0;var _0xa9fc9=_0xd1f6[_0x386508];return _0xa9fc9;};'use strict';var UserNotificationEvents=require(_0x6d1f('0x0'));var events=[_0x6d1f('0x1'),'remove',_0x6d1f('0x2')];function createListener(_0x377007,_0x188334){return function(_0x184ea3){_0x188334['emit'](_0x377007,_0x184ea3);};}function removeListener(_0x3e6b62,_0x5c3b60){return function(){UserNotificationEvents['removeListener'](_0x3e6b62,_0x5c3b60);};}exports['register']=function(_0x3a4fc3){for(var _0x17e31f=0x0,_0x126e92=events[_0x6d1f('0x3')];_0x17e31f<_0x126e92;_0x17e31f++){var _0x578b19=events[_0x17e31f];var _0x3aa8c3=createListener('userNotification:'+_0x578b19,_0x3a4fc3);UserNotificationEvents['on'](_0x578b19,_0x3aa8c3);}}; \ No newline at end of file +var _0x72c5=['./userNotification.events','update','emit','length','userNotification:'];(function(_0x340ff8,_0x26d4f8){var _0x36bed2=function(_0x4f0287){while(--_0x4f0287){_0x340ff8['push'](_0x340ff8['shift']());}};_0x36bed2(++_0x26d4f8);}(_0x72c5,0xb4));var _0x572c=function(_0x2beeb9,_0x415c85){_0x2beeb9=_0x2beeb9-0x0;var _0x3f7f25=_0x72c5[_0x2beeb9];return _0x3f7f25;};'use strict';var UserNotificationEvents=require(_0x572c('0x0'));var events=['save','remove',_0x572c('0x1')];function createListener(_0x23f7b4,_0x51dddb){return function(_0xac068f){_0x51dddb[_0x572c('0x2')](_0x23f7b4,_0xac068f);};}function removeListener(_0x3f8aee,_0x3df2fb){return function(){UserNotificationEvents['removeListener'](_0x3f8aee,_0x3df2fb);};}exports['register']=function(_0x120389){for(var _0x1be257=0x0,_0xad8cb5=events[_0x572c('0x3')];_0x1be257<_0xad8cb5;_0x1be257++){var _0x17d126=events[_0x1be257];var _0x26df9d=createListener(_0x572c('0x4')+_0x17d126,_0x120389);UserNotificationEvents['on'](_0x17d126,_0x26df9d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 23f69a4..9023eae 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(_0x4c384b,_0x2ee262){var _0x29ee3d=function(_0xc8c652){while(--_0xc8c652){_0x4c384b['push'](_0x4c384b['shift']());}};_0x29ee3d(++_0x2ee262);}(_0x70e0,0x17b));var _0x070e=function(_0x7461d2,_0x453d5d){_0x7461d2=_0x7461d2-0x0;var _0x487889=_0x70e0[_0x7461d2];return _0x487889;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4c2a9a,_0x4ba2f2){var _0xba43e1=function(_0x486b51){while(--_0x486b51){_0x4c2a9a['push'](_0x4c2a9a['shift']());}};_0xba43e1(++_0x4ba2f2);}(_0x70e0,0x17b));var _0x070e=function(_0x45e5eb,_0x97a0e8){_0x45e5eb=_0x45e5eb-0x0;var _0x3d46b7=_0x70e0[_0x45e5eb];return _0x3d46b7;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 5e346cf..882f6be 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 _0xfd8f=['sequelize','exports'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xfd8f,0xae));var _0xffd8=function(_0x69ee2b,_0x2efd11){_0x69ee2b=_0x69ee2b-0x0;var _0x551e19=_0xfd8f[_0x69ee2b];return _0x551e19;};'use strict';var Sequelize=require(_0xffd8('0x0'));module[_0xffd8('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa01a=['exports','INTEGER','sequelize'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0xa01a,0x6e));var _0xaa01=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa01a[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0xaa01('0x0'));module[_0xaa01('0x1')]={'penalty':{'type':Sequelize[_0xaa01('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 7bb212f..93770d1 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 _0x0868=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','UserOpenchannelQueue'];(function(_0x518e15,_0x568735){var _0x3bd658=function(_0x6a579f){while(--_0x6a579f){_0x518e15['push'](_0x518e15['shift']());}};_0x3bd658(++_0x568735);}(_0x0868,0x12c));var _0x8086=function(_0x13134f,_0x2263d8){_0x13134f=_0x13134f-0x0;var _0x518d79=_0x0868[_0x13134f];return _0x518d79;};'use strict';var _=require(_0x8086('0x0'));var util=require(_0x8086('0x1'));var logger=require(_0x8086('0x2'))(_0x8086('0x3'));var moment=require(_0x8086('0x4'));var BPromise=require(_0x8086('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8086('0x6'));var rimraf=require(_0x8086('0x7'));var config=require(_0x8086('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x8086('0x9')]=function(_0xd208fe,_0x42ce0e){return _0xd208fe[_0x8086('0xa')](_0x8086('0xb'),attributes,{'tableName':_0x8086('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ef7=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x24dc98,_0x235f7f){var _0x33e6c1=function(_0x3a6e74){while(--_0x3a6e74){_0x24dc98['push'](_0x24dc98['shift']());}};_0x33e6c1(++_0x235f7f);}(_0x9ef7,0xf7));var _0x79ef=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x9ef7[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x79ef('0x0'));var util=require(_0x79ef('0x1'));var logger=require(_0x79ef('0x2'))(_0x79ef('0x3'));var moment=require(_0x79ef('0x4'));var BPromise=require(_0x79ef('0x5'));var rp=require(_0x79ef('0x6'));var fs=require('fs');var path=require(_0x79ef('0x7'));var rimraf=require(_0x79ef('0x8'));var config=require(_0x79ef('0x9'));var attributes=require(_0x79ef('0xa'));module[_0x79ef('0xb')]=function(_0x4282cb,_0x5c91c0){return _0x4282cb['define'](_0x79ef('0xc'),attributes,{'tableName':_0x79ef('0xd'),'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 5cf8b57..923649e 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 _0x29e6=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x51acf0,_0x4e17c0){var _0x249f8e=function(_0x59bf73){while(--_0x59bf73){_0x51acf0['push'](_0x51acf0['shift']());}};_0x249f8e(++_0x4e17c0);}(_0x29e6,0x1a4));var _0x629e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x29e6[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x629e('0x0'));var moment=require(_0x629e('0x1'));var BPromise=require('bluebird');var rs=require(_0x629e('0x2'));var fs=require('fs');var Redis=require(_0x629e('0x3'));var db=require(_0x629e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x629e('0x5'))(_0x629e('0x6'));var config=require(_0x629e('0x7'));var jayson=require(_0x629e('0x8'));var client=jayson[_0x629e('0x9')][_0x629e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ee277,_0x1cf285,_0x2b40c4){return new BPromise(function(_0x1a866b,_0x5c226d){return client[_0x629e('0xb')](_0x2ee277,_0x2b40c4)[_0x629e('0xc')](function(_0x5bdd36){logger[_0x629e('0xd')](_0x629e('0xe'),_0x1cf285,_0x629e('0xf'));logger[_0x629e('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1cf285,_0x629e('0xf'),JSON['stringify'](_0x5bdd36));if(_0x5bdd36[_0x629e('0x11')]){if(_0x5bdd36['error'][_0x629e('0x12')]===0x1f4){logger['error'](_0x629e('0xe'),_0x1cf285,_0x5bdd36['error'][_0x629e('0x13')]);return _0x5c226d(_0x5bdd36['error']['message']);}logger['error'](_0x629e('0xe'),_0x1cf285,_0x5bdd36[_0x629e('0x11')]['message']);return _0x1a866b(_0x5bdd36[_0x629e('0x11')][_0x629e('0x13')]);}else{logger[_0x629e('0xd')](_0x629e('0xe'),_0x1cf285,'request\x20sent');_0x1a866b(_0x5bdd36[_0x629e('0x14')][_0x629e('0x13')]);}})['catch'](function(_0x3947f2){logger[_0x629e('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1cf285,_0x3947f2);_0x5c226d(_0x3947f2);});});} \ No newline at end of file +var _0x3128=['debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3128,0xba));var _0x8312=function(_0x2d115a,_0x4b4beb){_0x2d115a=_0x2d115a-0x0;var _0x55eda0=_0x3128[_0x2d115a];return _0x55eda0;};'use strict';var _=require(_0x8312('0x0'));var util=require(_0x8312('0x1'));var moment=require(_0x8312('0x2'));var BPromise=require(_0x8312('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8312('0x4'));var db=require(_0x8312('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8312('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8312('0x7'));var client=jayson[_0x8312('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d6265,_0x4b3382,_0x1ee396){return new BPromise(function(_0x4c06e1,_0x225f17){return client[_0x8312('0x9')](_0x1d6265,_0x1ee396)[_0x8312('0xa')](function(_0xa54a6f){logger[_0x8312('0xb')](_0x8312('0xc'),_0x4b3382,_0x8312('0xd'));logger[_0x8312('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4b3382,_0x8312('0xd'),JSON[_0x8312('0xf')](_0xa54a6f));if(_0xa54a6f[_0x8312('0x10')]){if(_0xa54a6f[_0x8312('0x10')][_0x8312('0x11')]===0x1f4){logger[_0x8312('0x10')](_0x8312('0xc'),_0x4b3382,_0xa54a6f['error'][_0x8312('0x12')]);return _0x225f17(_0xa54a6f['error'][_0x8312('0x12')]);}logger['error'](_0x8312('0xc'),_0x4b3382,_0xa54a6f[_0x8312('0x10')][_0x8312('0x12')]);return _0x4c06e1(_0xa54a6f[_0x8312('0x10')][_0x8312('0x12')]);}else{logger[_0x8312('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4b3382,_0x8312('0xd'));_0x4c06e1(_0xa54a6f['result']['message']);}})[_0x8312('0x13')](function(_0x29166a){logger[_0x8312('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4b3382,_0x29166a);_0x225f17(_0x29166a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d669d63..60bc4b3 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 _0x4783=['Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','addResources','put','destroy','delete','removeSections','removeResources','exports','util','path','connect-timeout','express'];(function(_0x1b1201,_0x50f6c4){var _0x3259cf=function(_0x284f34){while(--_0x284f34){_0x1b1201['push'](_0x1b1201['shift']());}};_0x3259cf(++_0x50f6c4);}(_0x4783,0xce));var _0x3478=function(_0x267ad0,_0x3fe5fe){_0x267ad0=_0x267ad0-0x0;var _0x130d2f=_0x4783[_0x267ad0];return _0x130d2f;};'use strict';var multer=require('multer');var util=require(_0x3478('0x0'));var path=require(_0x3478('0x1'));var timeout=require(_0x3478('0x2'));var express=require(_0x3478('0x3'));var router=express[_0x3478('0x4')]();var fs_extra=require(_0x3478('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3478('0x6'));var config=require(_0x3478('0x7'));var controller=require(_0x3478('0x8'));router['get']('/',auth[_0x3478('0x9')](),controller[_0x3478('0xa')]);router[_0x3478('0xb')](_0x3478('0xc'),auth[_0x3478('0x9')](),controller['describe']);router['get'](_0x3478('0xd'),auth[_0x3478('0x9')](),controller[_0x3478('0xe')]);router[_0x3478('0xb')](_0x3478('0xf'),auth[_0x3478('0x9')](),controller[_0x3478('0x10')]);router[_0x3478('0xb')](_0x3478('0x11'),auth[_0x3478('0x9')](),controller[_0x3478('0x12')]);router['post']('/',auth[_0x3478('0x9')](),controller['create']);router[_0x3478('0x13')](_0x3478('0x14'),auth[_0x3478('0x9')](),controller[_0x3478('0x15')]);router[_0x3478('0x13')](_0x3478('0xf'),auth['isAuthenticated'](),controller[_0x3478('0x16')]);router[_0x3478('0x13')](_0x3478('0x11'),auth[_0x3478('0x9')](),controller[_0x3478('0x17')]);router[_0x3478('0x18')](_0x3478('0xd'),auth[_0x3478('0x9')](),controller['update']);router['delete']('/:id',auth[_0x3478('0x9')](),controller[_0x3478('0x19')]);router[_0x3478('0x1a')](_0x3478('0xf'),auth[_0x3478('0x9')](),controller[_0x3478('0x1b')]);router[_0x3478('0x1a')](_0x3478('0x11'),auth['isAuthenticated'](),controller[_0x3478('0x1c')]);module[_0x3478('0x1d')]=router; \ No newline at end of file +var _0xf811=['index','isAuthenticated','/:id','show','getSections','/:id/resources','getResources','post','/:id/clone','clone','/:id/sections','addSections','addResources','put','update','delete','removeSections','removeResources','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xf811,0xaf));var _0x1f81=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xf811[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x1f81('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1f81('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1f81('0x2'));var auth=require(_0x1f81('0x3'));var interaction=require(_0x1f81('0x4'));var config=require('../../config/environment');var controller=require(_0x1f81('0x5'));router[_0x1f81('0x6')]('/',auth['isAuthenticated'](),controller[_0x1f81('0x7')]);router[_0x1f81('0x6')]('/describe',auth[_0x1f81('0x8')](),controller['describe']);router['get'](_0x1f81('0x9'),auth[_0x1f81('0x8')](),controller[_0x1f81('0xa')]);router['get']('/:id/sections',auth[_0x1f81('0x8')](),controller[_0x1f81('0xb')]);router['get'](_0x1f81('0xc'),auth[_0x1f81('0x8')](),controller[_0x1f81('0xd')]);router['post']('/',auth[_0x1f81('0x8')](),controller['create']);router[_0x1f81('0xe')](_0x1f81('0xf'),auth[_0x1f81('0x8')](),controller[_0x1f81('0x10')]);router[_0x1f81('0xe')](_0x1f81('0x11'),auth[_0x1f81('0x8')](),controller[_0x1f81('0x12')]);router[_0x1f81('0xe')](_0x1f81('0xc'),auth[_0x1f81('0x8')](),controller[_0x1f81('0x13')]);router[_0x1f81('0x14')](_0x1f81('0x9'),auth[_0x1f81('0x8')](),controller[_0x1f81('0x15')]);router[_0x1f81('0x16')](_0x1f81('0x9'),auth[_0x1f81('0x8')](),controller['destroy']);router['delete'](_0x1f81('0x11'),auth[_0x1f81('0x8')](),controller[_0x1f81('0x17')]);router['delete'](_0x1f81('0xc'),auth[_0x1f81('0x8')](),controller[_0x1f81('0x18')]);module[_0x1f81('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index ef2e870..7bc5ec1 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 _0x4a37=['STRING','name','setDataValue','crudPermissions','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x97e10c,_0x40a60d){var _0x2032c6=function(_0x208696){while(--_0x208696){_0x97e10c['push'](_0x97e10c['shift']());}};_0x2032c6(++_0x40a60d);}(_0x4a37,0x154));var _0x74a3=function(_0x80b53b,_0x3d72be){_0x80b53b=_0x80b53b-0x0;var _0x24a9db=_0x4a37[_0x80b53b];return _0x24a9db;};'use strict';var Sequelize=require(_0x74a3('0x0'));module[_0x74a3('0x1')]={'name':{'type':Sequelize[_0x74a3('0x2')],'allowNull':![],'unique':_0x74a3('0x3')},'crudPermissions':{'type':Sequelize[_0x74a3('0x2')],'set':function(_0x5a09f4){this[_0x74a3('0x4')](_0x74a3('0x5'),_0x5a09f4?_0x5a09f4['join'](''):[]);},'get':function(){return this[_0x74a3('0x6')]('crudPermissions')?this[_0x74a3('0x6')]('crudPermissions')[_0x74a3('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x74a3('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x74a3('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x74a3('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x74a3('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x74a3('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x74a3('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x74a3('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf2cc=['sequelize','exports','STRING','name','setDataValue','join','crudPermissions','getDataValue','split','BOOLEAN'];(function(_0x431953,_0x22d793){var _0x4d9317=function(_0x593794){while(--_0x593794){_0x431953['push'](_0x431953['shift']());}};_0x4d9317(++_0x22d793);}(_0xf2cc,0x1cc));var _0xcf2c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xf2cc[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0xcf2c('0x0'));module[_0xcf2c('0x1')]={'name':{'type':Sequelize[_0xcf2c('0x2')],'allowNull':![],'unique':_0xcf2c('0x3')},'crudPermissions':{'type':Sequelize[_0xcf2c('0x2')],'set':function(_0xec19eb){this[_0xcf2c('0x4')]('crudPermissions',_0xec19eb?_0xec19eb[_0xcf2c('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xcf2c('0x6'))?this[_0xcf2c('0x7')](_0xcf2c('0x6'))[_0xcf2c('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcf2c('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcf2c('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcf2c('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcf2c('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcf2c('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcf2c('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcf2c('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1ce6c90..dae1491 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 _0x4017=['clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','describe','addSections','Resources','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','filter','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','UserProfile','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0x2b68fc,_0x10362e){var _0x2e3490=function(_0x13052e){while(--_0x13052e){_0x2b68fc['push'](_0x2b68fc['shift']());}};_0x2e3490(++_0x10362e);}(_0x4017,0xa0));var _0x7401=function(_0xa5a680,_0x34a410){_0xa5a680=_0xa5a680-0x0;var _0x3d3866=_0x4017[_0xa5a680];return _0x3d3866;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7401('0x0'));var zipdir=require(_0x7401('0x1'));var jsonpatch=require(_0x7401('0x2'));var rp=require(_0x7401('0x3'));var moment=require(_0x7401('0x4'));var BPromise=require(_0x7401('0x5'));var Mustache=require(_0x7401('0x6'));var util=require(_0x7401('0x7'));var path=require(_0x7401('0x8'));var sox=require(_0x7401('0x9'));var csv=require('to-csv');var ejs=require(_0x7401('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7401('0xb'));var squel=require(_0x7401('0xc'));var crypto=require('crypto');var jsforce=require(_0x7401('0xd'));var deskjs=require(_0x7401('0xe'));var toCsv=require(_0x7401('0xf'));var querystring=require(_0x7401('0x10'));var Papa=require(_0x7401('0x11'));var Redis=require(_0x7401('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7401('0x13'));var as=require(_0x7401('0x14'));var hardwareService=require(_0x7401('0x15'));var logger=require(_0x7401('0x16'))(_0x7401('0x17'));var utils=require(_0x7401('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7401('0x19'));var db=require(_0x7401('0x1a'))['db'];config[_0x7401('0x1b')]=_['defaults'](config[_0x7401('0x1b')],{'host':_0x7401('0x1c'),'port':0x18eb});var socket=require(_0x7401('0x1d'))(new Redis(config[_0x7401('0x1b')]));require(_0x7401('0x1e'))[_0x7401('0x1f')](socket);function respondWithStatusCode(_0x70476c,_0x41a5c7){_0x41a5c7=_0x41a5c7||0xcc;return function(_0x39130d){if(_0x39130d){return _0x70476c[_0x7401('0x20')](_0x41a5c7);}return _0x70476c[_0x7401('0x21')](_0x41a5c7)[_0x7401('0x22')]();};}function respondWithResult(_0x104b79,_0x3c4ffc){_0x3c4ffc=_0x3c4ffc||0xc8;return function(_0x40dde2){if(_0x40dde2){return _0x104b79[_0x7401('0x21')](_0x3c4ffc)[_0x7401('0x23')](_0x40dde2);}};}function respondWithFilteredResult(_0x47ebf0,_0x34c5d){return function(_0x443fc2){if(_0x443fc2){var _0x1b155c=typeof _0x34c5d['offset']===_0x7401('0x24')&&typeof _0x34c5d[_0x7401('0x25')]===_0x7401('0x24');var _0x47cf51=_0x443fc2['count'];var _0x31443e=_0x1b155c?0x0:_0x34c5d[_0x7401('0x26')];var _0x3c5f7d=_0x1b155c?_0x443fc2[_0x7401('0x27')]:_0x34c5d[_0x7401('0x26')]+_0x34c5d['limit'];var _0x229168;if(_0x3c5f7d>=_0x47cf51){_0x3c5f7d=_0x47cf51;_0x229168=0xc8;}else{_0x229168=0xce;}_0x47ebf0[_0x7401('0x21')](_0x229168);return _0x47ebf0[_0x7401('0x28')](_0x7401('0x29'),_0x31443e+'-'+_0x3c5f7d+'/'+_0x47cf51)[_0x7401('0x23')](_0x443fc2);}return null;};}function patchUpdates(_0xfa6d9b){return function(_0xbe16b1){try{jsonpatch[_0x7401('0x2a')](_0xbe16b1,_0xfa6d9b,!![]);}catch(_0x368814){return BPromise[_0x7401('0x2b')](_0x368814);}return _0xbe16b1[_0x7401('0x2c')]();};}function saveUpdates(_0x4de5f8,_0x5be95e){return function(_0x2eebb5){if(_0x2eebb5){return _0x2eebb5[_0x7401('0x2d')](_0x4de5f8)[_0x7401('0x2e')](function(_0x586b5d){return _0x586b5d;});}return null;};}function removeEntity(_0x25f114,_0x165541){return function(_0x3b0689){if(_0x3b0689){return _0x3b0689[_0x7401('0x2f')]()['then'](function(){_0x25f114[_0x7401('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d4795,_0xc7e47f){return function(_0x8da301){if(!_0x8da301){_0x2d4795[_0x7401('0x20')](0x194);}return _0x8da301;};}function handleError(_0x3d62d0,_0x1ab57f){_0x1ab57f=_0x1ab57f||0x1f4;return function(_0x4800df){logger['error'](_0x4800df[_0x7401('0x30')]);if(_0x4800df[_0x7401('0x31')]){delete _0x4800df[_0x7401('0x31')];}_0x3d62d0[_0x7401('0x21')](_0x1ab57f)[_0x7401('0x32')](_0x4800df);};}exports[_0x7401('0x33')]=function(_0x2e0591,_0x188c1a){var _0x311822={},_0x1ade1e={},_0x11387e={'count':0x0,'rows':[]};var _0x1b3d7d=_[_0x7401('0x34')](db[_0x7401('0x35')]['rawAttributes'],function(_0x8b4be4){return{'name':_0x8b4be4['fieldName'],'type':_0x8b4be4[_0x7401('0x36')]['key']};});_0x1ade1e[_0x7401('0x37')]=_['map'](_0x1b3d7d,_0x7401('0x31'));_0x1ade1e[_0x7401('0x38')]=_[_0x7401('0x39')](_0x2e0591[_0x7401('0x38')]);_0x1ade1e[_0x7401('0x3a')]=_[_0x7401('0x3b')](_0x1ade1e[_0x7401('0x37')],_0x1ade1e['query']);_0x311822['attributes']=_[_0x7401('0x3b')](_0x1ade1e[_0x7401('0x37')],qs[_0x7401('0x3c')](_0x2e0591[_0x7401('0x38')][_0x7401('0x3c')]));_0x311822['attributes']=_0x311822[_0x7401('0x3d')][_0x7401('0x3e')]?_0x311822[_0x7401('0x3d')]:_0x1ade1e['model'];if(!_0x2e0591[_0x7401('0x38')][_0x7401('0x3f')](_0x7401('0x40'))){_0x311822['limit']=qs[_0x7401('0x25')](_0x2e0591[_0x7401('0x38')][_0x7401('0x25')]);_0x311822[_0x7401('0x26')]=qs[_0x7401('0x26')](_0x2e0591['query']['offset']);}_0x311822[_0x7401('0x41')]=qs[_0x7401('0x42')](_0x2e0591[_0x7401('0x38')][_0x7401('0x42')]);_0x311822[_0x7401('0x43')]=qs[_0x7401('0x3a')](_[_0x7401('0x44')](_0x2e0591[_0x7401('0x38')],_0x1ade1e[_0x7401('0x3a')]),_0x1b3d7d);if(_0x2e0591[_0x7401('0x38')]['filter']){_0x311822['where']=_[_0x7401('0x45')](_0x311822['where'],{'$or':_[_0x7401('0x34')](_0x1b3d7d,function(_0x30b162){if(_0x30b162[_0x7401('0x36')]!==_0x7401('0x46')){var _0x2c6626={};_0x2c6626[_0x30b162[_0x7401('0x31')]]={'$like':'%'+_0x2e0591[_0x7401('0x38')]['filter']+'%'};return _0x2c6626;}})});}_0x311822=_[_0x7401('0x45')]({},_0x311822,_0x2e0591[_0x7401('0x47')]);var _0x4d6afe={'where':_0x311822[_0x7401('0x43')]};return db['UserProfile']['count'](_0x4d6afe)[_0x7401('0x2e')](function(_0x5ef545){_0x11387e[_0x7401('0x27')]=_0x5ef545;if(_0x2e0591[_0x7401('0x38')][_0x7401('0x48')]){_0x311822[_0x7401('0x49')]=[{'all':!![]}];}return db[_0x7401('0x35')][_0x7401('0x4a')](_0x311822);})[_0x7401('0x2e')](function(_0x43fe98){_0x11387e['rows']=_0x43fe98;return _0x11387e;})[_0x7401('0x2e')](respondWithFilteredResult(_0x188c1a,_0x311822))[_0x7401('0x4b')](handleError(_0x188c1a,null));};exports[_0x7401('0x4c')]=function(_0x27374d,_0x56163a){var _0x42b9ec={'raw':![],'where':{'id':_0x27374d[_0x7401('0x4d')]['id']}},_0x1966ba={};_0x1966ba[_0x7401('0x37')]=_[_0x7401('0x39')](db['UserProfile'][_0x7401('0x4e')]);_0x1966ba[_0x7401('0x38')]=_['keys'](_0x27374d['query']);_0x1966ba['filters']=_[_0x7401('0x3b')](_0x1966ba[_0x7401('0x37')],_0x1966ba[_0x7401('0x38')]);_0x42b9ec[_0x7401('0x3d')]=_['intersection'](_0x1966ba[_0x7401('0x37')],qs[_0x7401('0x3c')](_0x27374d[_0x7401('0x38')][_0x7401('0x3c')]));_0x42b9ec[_0x7401('0x3d')]=_0x42b9ec[_0x7401('0x3d')]['length']?_0x42b9ec[_0x7401('0x3d')]:_0x1966ba['model'];if(_0x27374d['query'][_0x7401('0x48')]){_0x42b9ec[_0x7401('0x49')]=[{'all':!![]}];}_0x42b9ec=_[_0x7401('0x45')]({},_0x42b9ec,_0x27374d['options']);return db['UserProfile'][_0x7401('0x4f')](_0x42b9ec)['then'](handleEntityNotFound(_0x56163a,null))[_0x7401('0x2e')](respondWithResult(_0x56163a,null))[_0x7401('0x4b')](handleError(_0x56163a,null));};exports['create']=function(_0x1f9498,_0xd2cd18){return db[_0x7401('0x35')][_0x7401('0x50')](_0x1f9498[_0x7401('0x51')],{})[_0x7401('0x2e')](respondWithResult(_0xd2cd18,0xc9))[_0x7401('0x4b')](handleError(_0xd2cd18,null));};exports[_0x7401('0x52')]=function(_0x2b4ee4,_0x44abd4){var _0x3bc05b={'where':{'id':_0x2b4ee4[_0x7401('0x4d')]['id']}},_0x50945b={};_0x50945b[_0x7401('0x37')]=_[_0x7401('0x39')](db['UserProfile'][_0x7401('0x4e')]);_0x3bc05b[_0x7401('0x3d')]=_['intersection'](_0x50945b[_0x7401('0x37')],qs[_0x7401('0x3c')](_0x2b4ee4[_0x7401('0x38')][_0x7401('0x3c')]));_0x3bc05b[_0x7401('0x3d')]=_0x3bc05b[_0x7401('0x3d')][_0x7401('0x3e')]?_0x3bc05b[_0x7401('0x3d')]:_0x50945b['model'];if(_0x2b4ee4[_0x7401('0x38')][_0x7401('0x48')]){_0x3bc05b[_0x7401('0x49')]=[{'all':!![]}];}_0x3bc05b=_[_0x7401('0x45')]({},_0x3bc05b,_0x2b4ee4[_0x7401('0x47')]);return db['UserProfile'][_0x7401('0x4f')](_0x3bc05b)['then'](handleEntityNotFound(_0x44abd4,null))[_0x7401('0x2e')](function(_0x51c75f){if(_0x51c75f){var _0xe4edda=_0x51c75f['get']({'plain':!![]});_0xe4edda=qs[_0x7401('0x53')](_0xe4edda,['id',_0x7401('0x54'),_0x7401('0x55'),_0x7401('0x56')]);_0x2b4ee4[_0x7401('0x51')]=_['omit'](_0x2b4ee4[_0x7401('0x51')],['id','createdAt',_0x7401('0x55')]);return db[_0x7401('0x57')][_0x7401('0x58')](function(_0x49468d){return db[_0x7401('0x35')][_0x7401('0x50')](_[_0x7401('0x45')](_0xe4edda,_0x2b4ee4[_0x7401('0x51')]),{'include':_0x2b4ee4['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x49468d})[_0x7401('0x2e')](function(_0x379a84){var _0x4eaf91=_0x379a84[_0x7401('0x59')]({'plain':!![]});return db['UserProfileSection'][_0x7401('0x4a')]({'where':{'userProfileId':_0x2b4ee4['params']['id']},'raw':!![]})[_0x7401('0x2e')](function(_0x173c84){if(_0x173c84){return BPromise[_0x7401('0x5a')](_0x173c84,function(_0x340004){return new BPromise(function(_0x10059d,_0x5b79f1){if(_0x340004[_0x7401('0x5b')]===null||_0x340004['autoAssociation']===0x1)_0x10059d(null);return db[_0x7401('0x5c')][_0x7401('0x4a')]({'where':{'sectionId':_0x340004['id']},'raw':!![]})[_0x7401('0x2e')](function(_0xa967ec){var _0x5572ab=_['map'](_0xa967ec,function(_0x138e3f){return qs['omit'](_0x138e3f,['id',_0x7401('0x54'),_0x7401('0x55'),_0x7401('0x5d')]);});_0x10059d(_0x5572ab);})[_0x7401('0x4b')](function(_0xced0fb){_0x5b79f1(_0xced0fb);});})[_0x7401('0x2e')](function(_0x2cede2){var _0x148581=qs['omit'](_0x340004,['id',_0x7401('0x54'),_0x7401('0x55')]);_0x148581[_0x7401('0x5e')]=_0x4eaf91['id'];if(_0x2cede2)_0x148581['Resources']=_0x2cede2;return _0x148581;})['then'](function(_0x5e044c){return db[_0x7401('0x5f')]['create'](_0x5e044c,{'include':[{'model':db[_0x7401('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x49468d});});})[_0x7401('0x2e')](function(){return _0x4eaf91;});}});});});}})[_0x7401('0x2e')](respondWithResult(_0x44abd4,0xc9))[_0x7401('0x4b')](handleError(_0x44abd4,null));};exports['update']=function(_0x1c9e25,_0x562724){if(_0x1c9e25[_0x7401('0x51')]['id']){delete _0x1c9e25[_0x7401('0x51')]['id'];}return db[_0x7401('0x35')][_0x7401('0x4f')]({'where':{'id':_0x1c9e25[_0x7401('0x4d')]['id']}})['then'](handleEntityNotFound(_0x562724,null))['then'](saveUpdates(_0x1c9e25[_0x7401('0x51')],null))['then'](respondWithResult(_0x562724,null))[_0x7401('0x4b')](handleError(_0x562724,null));};exports[_0x7401('0x2f')]=function(_0x2cc315,_0x2b3f2d){return db[_0x7401('0x35')][_0x7401('0x4f')]({'where':{'id':_0x2cc315[_0x7401('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2b3f2d,null))['then'](removeEntity(_0x2b3f2d,null))[_0x7401('0x4b')](handleError(_0x2b3f2d,null));};exports[_0x7401('0x60')]=function(_0x38e6a7,_0x2abf38){return db['UserProfile'][_0x7401('0x60')]()[_0x7401('0x2e')](respondWithResult(_0x2abf38,null))[_0x7401('0x4b')](handleError(_0x2abf38,null));};exports[_0x7401('0x61')]=function(_0x5b9537,_0x21d059){var _0x578098=_0x5b9537['body'];return db['UserProfile'][_0x7401('0x4f')]({'where':{'id':_0x5b9537['params']['id']}})[_0x7401('0x2e')](handleEntityNotFound(_0x21d059,null))['then'](function(_0x84dff7){if(_0x84dff7){return db['sequelize'][_0x7401('0x58')](function(_0x207821){return db[_0x7401('0x5f')][_0x7401('0x2f')]({'where':{'userProfileId':_0x5b9537[_0x7401('0x4d')]['id'],'sectionId':_[_0x7401('0x34')](_0x578098,function(_0x340dd5){return _0x340dd5['sectionId'];})},'transaction':_0x207821})[_0x7401('0x2e')](function(){var _0x537d99=_['map'](_0x578098,function(_0x229abe){_0x229abe[_0x7401('0x5e')]=_0x5b9537[_0x7401('0x4d')]['id'];return _0x229abe;});var _0x449ad5=[];return BPromise[_0x7401('0x5a')](_0x537d99,function(_0x144e29){return db[_0x7401('0x5f')][_0x7401('0x50')](_0x144e29,{'include':[{'model':db[_0x7401('0x5c')],'as':_0x7401('0x62')}],'raw':!![],'transaction':_0x207821})[_0x7401('0x2e')](function(_0x379f0a){_0x449ad5[_0x7401('0x63')](_0x379f0a[_0x7401('0x59')]({'plain':!![]}));});})['then'](function(){return _0x449ad5;});});});}})['then'](function(_0x186467){return _0x186467;})['then'](respondWithResult(_0x21d059,null))['catch'](handleError(_0x21d059,null));};exports[_0x7401('0x64')]=function(_0x137dd7,_0x48562e){var _0x8f7bb9;return db[_0x7401('0x35')][_0x7401('0x4f')]({'where':{'id':_0x137dd7['params']['id']},'attributes':['id',_0x7401('0x31')]})[_0x7401('0x2e')](handleEntityNotFound(_0x48562e,null))['then'](function(_0x5aa85c){if(_0x5aa85c){_0x8f7bb9=_0x5aa85c;return db[_0x7401('0x5f')][_0x7401('0x2f')]({'where':{'userProfileId':_0x137dd7[_0x7401('0x4d')]['id'],'sectionId':_0x137dd7[_0x7401('0x38')][_0x7401('0x65')]}});}})['then'](function(){return _0x8f7bb9;})[_0x7401('0x2e')](respondWithStatusCode(_0x48562e,null))[_0x7401('0x4b')](handleError(_0x48562e,null));};exports[_0x7401('0x66')]=function(_0x1ee8c9,_0x1d0506){var _0x3e2005=[];var _0x5ced7a=[];return db[_0x7401('0x5f')][_0x7401('0x4a')]({'where':{'userProfileId':_0x1ee8c9[_0x7401('0x4d')]['id']},'raw':!![]})[_0x7401('0x2e')](function(_0x5b28be){_0x3e2005=_['filter'](_0x5b28be,function(_0x52f447){return _0x52f447[_0x7401('0x67')]===0x1||_['includes']([0x3eb,0x709],_0x52f447[_0x7401('0x5d')]);});if(!_[_0x7401('0x68')](_0x3e2005)){return _[_0x7401('0x34')](_0x3e2005,function(_0x4c6c44){return _0x4c6c44['sectionId'];});}else{return;}})['then'](function(_0x300701){if(_0x300701)_0x5ced7a=_0x300701;if(_[_0x7401('0x69')](_0x5ced7a,0x64)){var _0x1c4ae0=_['find'](_0x3e2005,{'sectionId':0x64});return hasDefaultDashboard(_0x1c4ae0)['then'](function(_0xd17b38){return _[_0x7401('0x34')](_0x3e2005,function(_0x1ce855){if(_0x1ce855[_0x7401('0x5d')]===0x64){_0x1ce855['subsections']=_0xd17b38;}return _0x1ce855;});});}else{return;}})[_0x7401('0x2e')](function(_0x330654){if(_0x330654)_0x3e2005=_0x330654;if(_[_0x7401('0x69')](_0x5ced7a,0x3eb)){var _0x103da0=_[_0x7401('0x4f')](_0x3e2005,{'sectionId':0x3eb});return getCustomDashboards(_0x103da0)[_0x7401('0x2e')](function(_0x229030){return _[_0x7401('0x34')](_0x3e2005,function(_0x539924){if(_0x103da0[_0x7401('0x67')]){if(_0x539924[_0x7401('0x5d')]===0x3eb){_0x539924[_0x7401('0x6a')]=_0x229030;}}else{if(_0x539924[_0x7401('0x5d')]===0x64){if(!_0x539924[_0x7401('0x6a')]){_0x539924[_0x7401('0x6a')]=[];}_0x539924[_0x7401('0x6a')]=_0x539924[_0x7401('0x6a')][_0x7401('0x6b')](_0x229030);}}return _0x539924;});});}else{return;}})[_0x7401('0x2e')](function(_0x1a0287){if(_0x1a0287)_0x3e2005=_0x1a0287;if(_[_0x7401('0x69')](_0x5ced7a,0x709)){var _0x573f8f=_[_0x7401('0x4f')](_0x3e2005,{'sectionId':0x709});return getPlugins(_0x573f8f)['then'](function(_0x4c8943){if(_0x573f8f[_0x7401('0x67')]){return _[_0x7401('0x34')](_0x3e2005,function(_0x4fe0c0){if(_0x4fe0c0['sectionId']===0x709){_0x4fe0c0[_0x7401('0x6a')]=_0x4c8943;}return _0x4fe0c0;});}else{var _0x48afb6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4c8943};var _0x4c766e=_[_0x7401('0x34')](_0x3e2005);_0x4c766e['push'](_0x48afb6);return _0x4c766e;}});}else{return;}})['then'](function(_0x3f48de){if(_0x3f48de)_0x3e2005=_0x3f48de;return _[_0x7401('0x6c')](_0x3e2005,[_0x7401('0x67'),0x1]);})[_0x7401('0x2e')](respondWithResult(_0x1d0506,null))[_0x7401('0x4b')](handleError(_0x1d0506,null));};function hasDefaultDashboard(_0x5e221d){var _0x40e9ca=[0x65];return new BPromise(function(_0xb13cdf,_0x233384){try{if(_0x5e221d[_0x7401('0x5b')]){_0xb13cdf(_0x40e9ca);}else{return db[_0x7401('0x5c')][_0x7401('0x6d')]({'where':{'sectionId':_0x5e221d['id']},'raw':!![]})[_0x7401('0x2e')](function(_0x4db1d9){_0x4db1d9?_0xb13cdf(_0x40e9ca):_0xb13cdf();});}}catch(_0x5bd3e1){_0x233384(_0x5bd3e1);}});}function getCustomDashboards(_0x3a3cdf){var _0x21b348=[];return new BPromise(function(_0x2452e2,_0x4dbad5){try{if(_0x3a3cdf[_0x7401('0x5b')]){return db[_0x7401('0x6e')][_0x7401('0x4a')]({'raw':!![]})['then'](function(_0x2c746c){_0x2c746c[_0x7401('0x6f')](function(_0x1a8c5d){_0x21b348[_0x7401('0x63')](_0x1a8c5d['id']+0x1869f);});_0x2452e2(_0x21b348);});}else{return db[_0x7401('0x5c')]['findAll']({'where':{'sectionId':_0x3a3cdf['id']},'raw':!![]})[_0x7401('0x2e')](function(_0x3b644e){_0x3b644e[_0x7401('0x6f')](function(_0xd6050){_0x21b348[_0x7401('0x63')](_0xd6050[_0x7401('0x70')]+0x1869f);});_0x2452e2(_0x21b348);});}}catch(_0x2e0fef){_0x4dbad5(_0x2e0fef);}});}function getPlugins(_0x2988f3){var _0x344062=[];return new BPromise(function(_0x3e075c,_0x27932f){try{if(_0x2988f3[_0x7401('0x5b')]){return db[_0x7401('0x71')][_0x7401('0x4a')]({'raw':!![]})[_0x7401('0x2e')](function(_0x3bb379){_0x3bb379[_0x7401('0x6f')](function(_0x4886a8){_0x344062[_0x7401('0x63')](_0x4886a8['id']+0x15b38);});_0x3e075c(_0x344062);});}else{return db['UserProfileResource'][_0x7401('0x4a')]({'where':{'sectionId':_0x2988f3['id']},'raw':!![]})[_0x7401('0x2e')](function(_0x4d58e9){_0x4d58e9['forEach'](function(_0xacea39){_0x344062[_0x7401('0x63')](_0xacea39[_0x7401('0x70')]+0x15b38);});_0x3e075c(_0x344062);});}}catch(_0x5a1673){_0x27932f(_0x5a1673);}});}exports[_0x7401('0x72')]=function(_0x404653,_0x26bc40){return db['UserProfile']['find']({'where':{'id':_0x404653[_0x7401('0x4d')]['id']}})['then'](handleEntityNotFound(_0x26bc40,null))[_0x7401('0x2e')](function(_0x43fb69){if(_0x43fb69){return db[_0x7401('0x57')][_0x7401('0x58')](function(_0x59fd6d){return db[_0x7401('0x5f')][_0x7401('0x4a')]({'where':{'userProfileId':_0x404653[_0x7401('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0x7401('0x2e')](function(_0x5666f7){if(_0x5666f7){return db[_0x7401('0x5f')][_0x7401('0x2f')]({'where':{'userProfileId':_0x404653['params']['id'],'id':_[_0x7401('0x34')](_0x5666f7,function(_0x4c2090){return _0x4c2090['id'];})},'transaction':_0x59fd6d});}})[_0x7401('0x2e')](function(_0x54821f){var _0x5e9f36=_['map'](_0x404653[_0x7401('0x51')],function(_0x161b48){_0x161b48[_0x7401('0x5e')]=_0x404653['params']['id'];return _0x161b48;});return db[_0x7401('0x5f')][_0x7401('0x73')](_0x5e9f36,{'raw':!![],'transaction':_0x59fd6d});})[_0x7401('0x2e')](function(_0x5ca5d7){var _0x3af8aa=_['filter'](_['map'](_0x5ca5d7,function(_0x1d1f75){return _0x1d1f75[_0x7401('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x3af8aa){return db[_0x7401('0x5f')][_0x7401('0x4a')]({'where':{'userProfileId':_0x404653['params']['id'],'sectionId':_[_0x7401('0x34')](_0x3af8aa,function(_0x2662a3){return _0x2662a3[_0x7401('0x5d')];})},'attributes':['id',_0x7401('0x5d')],'raw':!![]})[_0x7401('0x2e')](function(_0xae12d){var _0x336ac9=_[_0x7401('0x34')](_0x404653[_0x7401('0x51')],function(_0x3967cf){_0x3967cf[_0x7401('0x5e')]=_0x404653[_0x7401('0x4d')]['id'];return _0x3967cf;});return db['UserProfileResource'][_0x7401('0x73')](_0x336ac9,{'raw':!![],'transaction':_0x59fd6d});});}})[_0x7401('0x4b')](handleError(_0x26bc40,null));});}})['then'](function(_0x5945a1){var _0x48720b=_[_0x7401('0x34')](_0x5945a1,function(_0x3b40e1){return _0x3b40e1[_0x7401('0x59')]({'plain':!![]});});})[_0x7401('0x2e')](respondWithResult(_0x26bc40,null))[_0x7401('0x4b')](handleError(_0x26bc40,null));};exports[_0x7401('0x74')]=function(_0x258f10,_0x19204b,_0x171574){return db[_0x7401('0x35')][_0x7401('0x4f')]({'where':{'id':_0x258f10[_0x7401('0x4d')]['id']}})[_0x7401('0x2e')](handleEntityNotFound(_0x19204b,null))[_0x7401('0x2e')](function(_0x50589d){if(_0x50589d){return _0x50589d['removeResources'](_0x258f10[_0x7401('0x38')][_0x7401('0x65')]);}})[_0x7401('0x2e')](respondWithStatusCode(_0x19204b,null))[_0x7401('0x4b')](handleError(_0x19204b,null));};exports['getResources']=function(_0x55da0b,_0x528523){var _0x46a90e={};if(!_0x55da0b[_0x7401('0x38')][_0x7401('0x75')])throw new Error(_0x7401('0x76'));if(!_0x55da0b['query'][_0x7401('0x3f')](_0x7401('0x40'))){_0x46a90e['limit']=qs[_0x7401('0x25')](_0x55da0b[_0x7401('0x38')]['limit']);_0x46a90e[_0x7401('0x26')]=qs['offset'](_0x55da0b[_0x7401('0x38')][_0x7401('0x26')]);}return db[_0x7401('0x35')][_0x7401('0x4f')]({'where':{'id':_0x55da0b[_0x7401('0x4d')]['id']}})[_0x7401('0x2e')](function(_0x393fa2){if(!_0x393fa2)throw new Error(_0x7401('0x77')+_0x55da0b[_0x7401('0x4d')]['id']);return db['UserProfile'][_0x7401('0x78')](_0x55da0b);})['then'](respondWithFilteredResult(_0x528523,_0x46a90e))['catch'](handleError(_0x528523,null));}; \ No newline at end of file +var _0x131d=['merge','type','VIRTUAL','includeAll','include','show','rawAttributes','options','find','catch','create','body','clone','params','get','createdAt','crudPermissions','omit','updatedAt','transaction','UserProfileSection','findAll','sectionId','userProfileId','UserProfileResource','Resources','describe','addSections','sequelize','each','push','ids','getSections','enabled','includes','isEmpty','subsections','findOne','autoAssociation','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','register','end','status','json','undefined','count','set','apply','save','then','destroy','sendStatus','error','stack','name','send','index','UserProfile','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter'];(function(_0x3a9e73,_0x567a70){var _0x5af67a=function(_0x3d793d){while(--_0x3d793d){_0x3a9e73['push'](_0x3a9e73['shift']());}};_0x5af67a(++_0x567a70);}(_0x131d,0x10a));var _0xd131=function(_0x14a770,_0x151e22){_0x14a770=_0x14a770-0x0;var _0x448cc9=_0x131d[_0x14a770];return _0x448cc9;};'use strict';var emlformat=require(_0xd131('0x0'));var rimraf=require(_0xd131('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd131('0x2'));var rp=require(_0xd131('0x3'));var moment=require(_0xd131('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd131('0x5'));var util=require(_0xd131('0x6'));var path=require('path');var sox=require(_0xd131('0x7'));var csv=require(_0xd131('0x8'));var ejs=require(_0xd131('0x9'));var fs=require('fs');var fs_extra=require(_0xd131('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd131('0xb'));var jsforce=require(_0xd131('0xc'));var deskjs=require(_0xd131('0xd'));var toCsv=require(_0xd131('0x8'));var querystring=require(_0xd131('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd131('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd131('0x10'));var hardwareService=require(_0xd131('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd131('0x12'));var licenseUtil=require(_0xd131('0x13'));var db=require(_0xd131('0x14'))['db'];config[_0xd131('0x15')]=_[_0xd131('0x16')](config[_0xd131('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd131('0x17'))[_0xd131('0x18')](socket);function respondWithStatusCode(_0x4c476a,_0x10c944){_0x10c944=_0x10c944||0xcc;return function(_0x15330f){if(_0x15330f){return _0x4c476a['sendStatus'](_0x10c944);}return _0x4c476a['status'](_0x10c944)[_0xd131('0x19')]();};}function respondWithResult(_0x404ee0,_0x125e2d){_0x125e2d=_0x125e2d||0xc8;return function(_0x5bf9b7){if(_0x5bf9b7){return _0x404ee0[_0xd131('0x1a')](_0x125e2d)[_0xd131('0x1b')](_0x5bf9b7);}};}function respondWithFilteredResult(_0x24d634,_0x886e20){return function(_0x425d4){if(_0x425d4){var _0x1897a7=typeof _0x886e20['offset']===_0xd131('0x1c')&&typeof _0x886e20['limit']===_0xd131('0x1c');var _0x6756e=_0x425d4['count'];var _0x382f43=_0x1897a7?0x0:_0x886e20['offset'];var _0x1e5eee=_0x1897a7?_0x425d4[_0xd131('0x1d')]:_0x886e20['offset']+_0x886e20['limit'];var _0x139e75;if(_0x1e5eee>=_0x6756e){_0x1e5eee=_0x6756e;_0x139e75=0xc8;}else{_0x139e75=0xce;}_0x24d634['status'](_0x139e75);return _0x24d634[_0xd131('0x1e')]('Content-Range',_0x382f43+'-'+_0x1e5eee+'/'+_0x6756e)['json'](_0x425d4);}return null;};}function patchUpdates(_0x12b425){return function(_0x2f365c){try{jsonpatch[_0xd131('0x1f')](_0x2f365c,_0x12b425,!![]);}catch(_0x24a5ed){return BPromise['reject'](_0x24a5ed);}return _0x2f365c[_0xd131('0x20')]();};}function saveUpdates(_0x3f3ffc,_0x1247c0){return function(_0x5c0e63){if(_0x5c0e63){return _0x5c0e63['update'](_0x3f3ffc)[_0xd131('0x21')](function(_0x4e0893){return _0x4e0893;});}return null;};}function removeEntity(_0x356ca0,_0x6ba760){return function(_0x175003){if(_0x175003){return _0x175003[_0xd131('0x22')]()[_0xd131('0x21')](function(){_0x356ca0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b85bb,_0x5f508c){return function(_0x4c3043){if(!_0x4c3043){_0x3b85bb[_0xd131('0x23')](0x194);}return _0x4c3043;};}function handleError(_0x4de3ff,_0x288c46){_0x288c46=_0x288c46||0x1f4;return function(_0x27612f){logger[_0xd131('0x24')](_0x27612f[_0xd131('0x25')]);if(_0x27612f['name']){delete _0x27612f[_0xd131('0x26')];}_0x4de3ff[_0xd131('0x1a')](_0x288c46)[_0xd131('0x27')](_0x27612f);};}exports[_0xd131('0x28')]=function(_0x456fe4,_0x1544f4){var _0x26243d={},_0x4eb418={},_0x33d112={'count':0x0,'rows':[]};var _0x4664df=_['map'](db[_0xd131('0x29')]['rawAttributes'],function(_0x26ec18){return{'name':_0x26ec18[_0xd131('0x2a')],'type':_0x26ec18['type'][_0xd131('0x2b')]};});_0x4eb418[_0xd131('0x2c')]=_[_0xd131('0x2d')](_0x4664df,'name');_0x4eb418[_0xd131('0x2e')]=_[_0xd131('0x2f')](_0x456fe4[_0xd131('0x2e')]);_0x4eb418[_0xd131('0x30')]=_['intersection'](_0x4eb418[_0xd131('0x2c')],_0x4eb418[_0xd131('0x2e')]);_0x26243d[_0xd131('0x31')]=_[_0xd131('0x32')](_0x4eb418[_0xd131('0x2c')],qs[_0xd131('0x33')](_0x456fe4[_0xd131('0x2e')][_0xd131('0x33')]));_0x26243d[_0xd131('0x31')]=_0x26243d[_0xd131('0x31')][_0xd131('0x34')]?_0x26243d[_0xd131('0x31')]:_0x4eb418['model'];if(!_0x456fe4[_0xd131('0x2e')][_0xd131('0x35')]('nolimit')){_0x26243d[_0xd131('0x36')]=qs['limit'](_0x456fe4[_0xd131('0x2e')][_0xd131('0x36')]);_0x26243d['offset']=qs['offset'](_0x456fe4[_0xd131('0x2e')][_0xd131('0x37')]);}_0x26243d[_0xd131('0x38')]=qs[_0xd131('0x39')](_0x456fe4['query'][_0xd131('0x39')]);_0x26243d[_0xd131('0x3a')]=qs[_0xd131('0x30')](_[_0xd131('0x3b')](_0x456fe4['query'],_0x4eb418[_0xd131('0x30')]),_0x4664df);if(_0x456fe4['query'][_0xd131('0x3c')]){_0x26243d[_0xd131('0x3a')]=_[_0xd131('0x3d')](_0x26243d[_0xd131('0x3a')],{'$or':_[_0xd131('0x2d')](_0x4664df,function(_0x438f42){if(_0x438f42[_0xd131('0x3e')]!==_0xd131('0x3f')){var _0x4d5ed8={};_0x4d5ed8[_0x438f42[_0xd131('0x26')]]={'$like':'%'+_0x456fe4[_0xd131('0x2e')][_0xd131('0x3c')]+'%'};return _0x4d5ed8;}})});}_0x26243d=_['merge']({},_0x26243d,_0x456fe4['options']);var _0x42b838={'where':_0x26243d[_0xd131('0x3a')]};return db[_0xd131('0x29')]['count'](_0x42b838)[_0xd131('0x21')](function(_0x253362){_0x33d112[_0xd131('0x1d')]=_0x253362;if(_0x456fe4[_0xd131('0x2e')][_0xd131('0x40')]){_0x26243d[_0xd131('0x41')]=[{'all':!![]}];}return db[_0xd131('0x29')]['findAll'](_0x26243d);})[_0xd131('0x21')](function(_0xa2459b){_0x33d112['rows']=_0xa2459b;return _0x33d112;})['then'](respondWithFilteredResult(_0x1544f4,_0x26243d))['catch'](handleError(_0x1544f4,null));};exports[_0xd131('0x42')]=function(_0x4ebd8c,_0x1f3881){var _0x1d6a90={'raw':![],'where':{'id':_0x4ebd8c['params']['id']}},_0x339a21={};_0x339a21['model']=_[_0xd131('0x2f')](db[_0xd131('0x29')][_0xd131('0x43')]);_0x339a21[_0xd131('0x2e')]=_['keys'](_0x4ebd8c[_0xd131('0x2e')]);_0x339a21[_0xd131('0x30')]=_[_0xd131('0x32')](_0x339a21[_0xd131('0x2c')],_0x339a21[_0xd131('0x2e')]);_0x1d6a90[_0xd131('0x31')]=_[_0xd131('0x32')](_0x339a21['model'],qs[_0xd131('0x33')](_0x4ebd8c[_0xd131('0x2e')][_0xd131('0x33')]));_0x1d6a90[_0xd131('0x31')]=_0x1d6a90[_0xd131('0x31')]['length']?_0x1d6a90[_0xd131('0x31')]:_0x339a21[_0xd131('0x2c')];if(_0x4ebd8c['query'][_0xd131('0x40')]){_0x1d6a90[_0xd131('0x41')]=[{'all':!![]}];}_0x1d6a90=_[_0xd131('0x3d')]({},_0x1d6a90,_0x4ebd8c[_0xd131('0x44')]);return db[_0xd131('0x29')][_0xd131('0x45')](_0x1d6a90)[_0xd131('0x21')](handleEntityNotFound(_0x1f3881,null))[_0xd131('0x21')](respondWithResult(_0x1f3881,null))[_0xd131('0x46')](handleError(_0x1f3881,null));};exports[_0xd131('0x47')]=function(_0x4e8a5e,_0x2f33e7){return db[_0xd131('0x29')][_0xd131('0x47')](_0x4e8a5e[_0xd131('0x48')],{})[_0xd131('0x21')](respondWithResult(_0x2f33e7,0xc9))[_0xd131('0x46')](handleError(_0x2f33e7,null));};exports[_0xd131('0x49')]=function(_0x40a88c,_0x15e31d){var _0x3c70e8={'where':{'id':_0x40a88c[_0xd131('0x4a')]['id']}},_0xc303bf={};_0xc303bf[_0xd131('0x2c')]=_['keys'](db[_0xd131('0x29')]['rawAttributes']);_0x3c70e8['attributes']=_['intersection'](_0xc303bf[_0xd131('0x2c')],qs[_0xd131('0x33')](_0x40a88c[_0xd131('0x2e')][_0xd131('0x33')]));_0x3c70e8[_0xd131('0x31')]=_0x3c70e8[_0xd131('0x31')][_0xd131('0x34')]?_0x3c70e8[_0xd131('0x31')]:_0xc303bf[_0xd131('0x2c')];if(_0x40a88c[_0xd131('0x2e')][_0xd131('0x40')]){_0x3c70e8[_0xd131('0x41')]=[{'all':!![]}];}_0x3c70e8=_[_0xd131('0x3d')]({},_0x3c70e8,_0x40a88c['options']);return db[_0xd131('0x29')][_0xd131('0x45')](_0x3c70e8)[_0xd131('0x21')](handleEntityNotFound(_0x15e31d,null))['then'](function(_0x43cdbc){if(_0x43cdbc){var _0x2aafdd=_0x43cdbc[_0xd131('0x4b')]({'plain':!![]});_0x2aafdd=qs['omit'](_0x2aafdd,['id',_0xd131('0x4c'),'updatedAt',_0xd131('0x4d')]);_0x40a88c['body']=_[_0xd131('0x4e')](_0x40a88c[_0xd131('0x48')],['id',_0xd131('0x4c'),_0xd131('0x4f')]);return db['sequelize'][_0xd131('0x50')](function(_0xeacd4){return db[_0xd131('0x29')][_0xd131('0x47')](_[_0xd131('0x3d')](_0x2aafdd,_0x40a88c[_0xd131('0x48')]),{'include':_0x40a88c[_0xd131('0x2e')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0xeacd4})[_0xd131('0x21')](function(_0x4ac64f){var _0x32a978=_0x4ac64f[_0xd131('0x4b')]({'plain':!![]});return db[_0xd131('0x51')][_0xd131('0x52')]({'where':{'userProfileId':_0x40a88c['params']['id']},'raw':!![]})['then'](function(_0xdcf1ff){if(_0xdcf1ff){return BPromise['each'](_0xdcf1ff,function(_0xb70c0c){return new BPromise(function(_0x376155,_0x5e1626){if(_0xb70c0c['autoAssociation']===null||_0xb70c0c['autoAssociation']===0x1)_0x376155(null);return db['UserProfileResource'][_0xd131('0x52')]({'where':{'sectionId':_0xb70c0c['id']},'raw':!![]})[_0xd131('0x21')](function(_0x5785f5){var _0x28c9a3=_['map'](_0x5785f5,function(_0x5deed7){return qs[_0xd131('0x4e')](_0x5deed7,['id',_0xd131('0x4c'),'updatedAt',_0xd131('0x53')]);});_0x376155(_0x28c9a3);})['catch'](function(_0x164f8d){_0x5e1626(_0x164f8d);});})[_0xd131('0x21')](function(_0x39677e){var _0x3598e1=qs[_0xd131('0x4e')](_0xb70c0c,['id','createdAt',_0xd131('0x4f')]);_0x3598e1[_0xd131('0x54')]=_0x32a978['id'];if(_0x39677e)_0x3598e1['Resources']=_0x39677e;return _0x3598e1;})['then'](function(_0x218db8){return db[_0xd131('0x51')][_0xd131('0x47')](_0x218db8,{'include':[{'model':db[_0xd131('0x55')],'as':_0xd131('0x56')}],'raw':!![],'transaction':_0xeacd4});});})[_0xd131('0x21')](function(){return _0x32a978;});}});});});}})[_0xd131('0x21')](respondWithResult(_0x15e31d,0xc9))[_0xd131('0x46')](handleError(_0x15e31d,null));};exports['update']=function(_0xea5b41,_0x699987){if(_0xea5b41[_0xd131('0x48')]['id']){delete _0xea5b41['body']['id'];}return db[_0xd131('0x29')][_0xd131('0x45')]({'where':{'id':_0xea5b41['params']['id']}})['then'](handleEntityNotFound(_0x699987,null))['then'](saveUpdates(_0xea5b41[_0xd131('0x48')],null))[_0xd131('0x21')](respondWithResult(_0x699987,null))['catch'](handleError(_0x699987,null));};exports[_0xd131('0x22')]=function(_0x346a82,_0xffb1ad){return db[_0xd131('0x29')]['find']({'where':{'id':_0x346a82[_0xd131('0x4a')]['id']}})[_0xd131('0x21')](handleEntityNotFound(_0xffb1ad,null))['then'](removeEntity(_0xffb1ad,null))['catch'](handleError(_0xffb1ad,null));};exports[_0xd131('0x57')]=function(_0x40bfa4,_0x228728){return db[_0xd131('0x29')]['describe']()[_0xd131('0x21')](respondWithResult(_0x228728,null))[_0xd131('0x46')](handleError(_0x228728,null));};exports[_0xd131('0x58')]=function(_0x9dff18,_0x207337){var _0x546922=_0x9dff18[_0xd131('0x48')];return db[_0xd131('0x29')][_0xd131('0x45')]({'where':{'id':_0x9dff18[_0xd131('0x4a')]['id']}})[_0xd131('0x21')](handleEntityNotFound(_0x207337,null))[_0xd131('0x21')](function(_0x3e7ce4){if(_0x3e7ce4){return db[_0xd131('0x59')][_0xd131('0x50')](function(_0x258975){return db[_0xd131('0x51')][_0xd131('0x22')]({'where':{'userProfileId':_0x9dff18[_0xd131('0x4a')]['id'],'sectionId':_['map'](_0x546922,function(_0x25f444){return _0x25f444[_0xd131('0x53')];})},'transaction':_0x258975})[_0xd131('0x21')](function(){var _0x3fe0ac=_['map'](_0x546922,function(_0x23e3c1){_0x23e3c1[_0xd131('0x54')]=_0x9dff18[_0xd131('0x4a')]['id'];return _0x23e3c1;});var _0x4249b3=[];return BPromise[_0xd131('0x5a')](_0x3fe0ac,function(_0x1409ad){return db[_0xd131('0x51')][_0xd131('0x47')](_0x1409ad,{'include':[{'model':db[_0xd131('0x55')],'as':_0xd131('0x56')}],'raw':!![],'transaction':_0x258975})[_0xd131('0x21')](function(_0x44ae58){_0x4249b3[_0xd131('0x5b')](_0x44ae58[_0xd131('0x4b')]({'plain':!![]}));});})['then'](function(){return _0x4249b3;});});});}})['then'](function(_0x19f944){return _0x19f944;})[_0xd131('0x21')](respondWithResult(_0x207337,null))['catch'](handleError(_0x207337,null));};exports['removeSections']=function(_0x103669,_0x38cc89){var _0x459c15;return db['UserProfile']['find']({'where':{'id':_0x103669[_0xd131('0x4a')]['id']},'attributes':['id',_0xd131('0x26')]})['then'](handleEntityNotFound(_0x38cc89,null))[_0xd131('0x21')](function(_0xb1e2b1){if(_0xb1e2b1){_0x459c15=_0xb1e2b1;return db[_0xd131('0x51')]['destroy']({'where':{'userProfileId':_0x103669[_0xd131('0x4a')]['id'],'sectionId':_0x103669[_0xd131('0x2e')][_0xd131('0x5c')]}});}})[_0xd131('0x21')](function(){return _0x459c15;})['then'](respondWithStatusCode(_0x38cc89,null))[_0xd131('0x46')](handleError(_0x38cc89,null));};exports[_0xd131('0x5d')]=function(_0x4cece3,_0x13d5a7){var _0x51ed24=[];var _0x10e88a=[];return db[_0xd131('0x51')][_0xd131('0x52')]({'where':{'userProfileId':_0x4cece3['params']['id']},'raw':!![]})['then'](function(_0x31a232){_0x51ed24=_[_0xd131('0x3c')](_0x31a232,function(_0xbec95c){return _0xbec95c[_0xd131('0x5e')]===0x1||_[_0xd131('0x5f')]([0x3eb,0x709],_0xbec95c[_0xd131('0x53')]);});if(!_[_0xd131('0x60')](_0x51ed24)){return _[_0xd131('0x2d')](_0x51ed24,function(_0x1b5c04){return _0x1b5c04[_0xd131('0x53')];});}else{return;}})[_0xd131('0x21')](function(_0x45aebe){if(_0x45aebe)_0x10e88a=_0x45aebe;if(_[_0xd131('0x5f')](_0x10e88a,0x64)){var _0x7abdb8=_['find'](_0x51ed24,{'sectionId':0x64});return hasDefaultDashboard(_0x7abdb8)[_0xd131('0x21')](function(_0x5321e4){return _[_0xd131('0x2d')](_0x51ed24,function(_0x3189a1){if(_0x3189a1['sectionId']===0x64){_0x3189a1['subsections']=_0x5321e4;}return _0x3189a1;});});}else{return;}})[_0xd131('0x21')](function(_0x45bea8){if(_0x45bea8)_0x51ed24=_0x45bea8;if(_[_0xd131('0x5f')](_0x10e88a,0x3eb)){var _0x300ae3=_[_0xd131('0x45')](_0x51ed24,{'sectionId':0x3eb});return getCustomDashboards(_0x300ae3)[_0xd131('0x21')](function(_0x5bce0f){return _[_0xd131('0x2d')](_0x51ed24,function(_0x3fe51b){if(_0x300ae3[_0xd131('0x5e')]){if(_0x3fe51b['sectionId']===0x3eb){_0x3fe51b[_0xd131('0x61')]=_0x5bce0f;}}else{if(_0x3fe51b[_0xd131('0x53')]===0x64){if(!_0x3fe51b[_0xd131('0x61')]){_0x3fe51b[_0xd131('0x61')]=[];}_0x3fe51b[_0xd131('0x61')]=_0x3fe51b[_0xd131('0x61')]['concat'](_0x5bce0f);}}return _0x3fe51b;});});}else{return;}})[_0xd131('0x21')](function(_0x59b6f2){if(_0x59b6f2)_0x51ed24=_0x59b6f2;if(_[_0xd131('0x5f')](_0x10e88a,0x709)){var _0x1aa239=_[_0xd131('0x45')](_0x51ed24,{'sectionId':0x709});return getPlugins(_0x1aa239)[_0xd131('0x21')](function(_0x4f4ce7){if(_0x1aa239['enabled']){return _[_0xd131('0x2d')](_0x51ed24,function(_0x358423){if(_0x358423['sectionId']===0x709){_0x358423[_0xd131('0x61')]=_0x4f4ce7;}return _0x358423;});}else{var _0x456471={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4f4ce7};var _0x474eb5=_[_0xd131('0x2d')](_0x51ed24);_0x474eb5[_0xd131('0x5b')](_0x456471);return _0x474eb5;}});}else{return;}})[_0xd131('0x21')](function(_0x19d9c9){if(_0x19d9c9)_0x51ed24=_0x19d9c9;return _[_0xd131('0x3c')](_0x51ed24,['enabled',0x1]);})[_0xd131('0x21')](respondWithResult(_0x13d5a7,null))['catch'](handleError(_0x13d5a7,null));};function hasDefaultDashboard(_0x41e45d){var _0x3e6729=[0x65];return new BPromise(function(_0x3327db,_0x1ac5be){try{if(_0x41e45d['autoAssociation']){_0x3327db(_0x3e6729);}else{return db['UserProfileResource'][_0xd131('0x62')]({'where':{'sectionId':_0x41e45d['id']},'raw':!![]})['then'](function(_0x4ea856){_0x4ea856?_0x3327db(_0x3e6729):_0x3327db();});}}catch(_0xe6740e){_0x1ac5be(_0xe6740e);}});}function getCustomDashboards(_0x534ed5){var _0x234eaf=[];return new BPromise(function(_0x17493d,_0x3383c6){try{if(_0x534ed5[_0xd131('0x63')]){return db['Dashboard'][_0xd131('0x52')]({'raw':!![]})[_0xd131('0x21')](function(_0x135f8f){_0x135f8f[_0xd131('0x64')](function(_0x25fa99){_0x234eaf[_0xd131('0x5b')](_0x25fa99['id']+0x1869f);});_0x17493d(_0x234eaf);});}else{return db[_0xd131('0x55')][_0xd131('0x52')]({'where':{'sectionId':_0x534ed5['id']},'raw':!![]})[_0xd131('0x21')](function(_0x539ed2){_0x539ed2[_0xd131('0x64')](function(_0x40b577){_0x234eaf[_0xd131('0x5b')](_0x40b577['resourceId']+0x1869f);});_0x17493d(_0x234eaf);});}}catch(_0x2bb465){_0x3383c6(_0x2bb465);}});}function getPlugins(_0x5e803e){var _0x165ca0=[];return new BPromise(function(_0x38f7b3,_0xad15de){try{if(_0x5e803e['autoAssociation']){return db[_0xd131('0x65')][_0xd131('0x52')]({'raw':!![]})[_0xd131('0x21')](function(_0x587826){_0x587826['forEach'](function(_0xd3f490){_0x165ca0['push'](_0xd3f490['id']+0x15b38);});_0x38f7b3(_0x165ca0);});}else{return db[_0xd131('0x55')][_0xd131('0x52')]({'where':{'sectionId':_0x5e803e['id']},'raw':!![]})['then'](function(_0xeeab03){_0xeeab03[_0xd131('0x64')](function(_0x43c2a0){_0x165ca0[_0xd131('0x5b')](_0x43c2a0[_0xd131('0x66')]+0x15b38);});_0x38f7b3(_0x165ca0);});}}catch(_0x702ab6){_0xad15de(_0x702ab6);}});}exports['addResources']=function(_0x11223a,_0x45777a){return db['UserProfile'][_0xd131('0x45')]({'where':{'id':_0x11223a[_0xd131('0x4a')]['id']}})[_0xd131('0x21')](handleEntityNotFound(_0x45777a,null))[_0xd131('0x21')](function(_0x3c63b1){if(_0x3c63b1){return db[_0xd131('0x59')]['transaction'](function(_0x501eb6){return db[_0xd131('0x51')][_0xd131('0x52')]({'where':{'userProfileId':_0x11223a[_0xd131('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xd131('0x21')](function(_0x298ce0){if(_0x298ce0){return db[_0xd131('0x51')][_0xd131('0x22')]({'where':{'userProfileId':_0x11223a[_0xd131('0x4a')]['id'],'id':_[_0xd131('0x2d')](_0x298ce0,function(_0x1f8705){return _0x1f8705['id'];})},'transaction':_0x501eb6});}})[_0xd131('0x21')](function(_0x512080){var _0x4fdfb3=_['map'](_0x11223a[_0xd131('0x48')],function(_0x2e2993){_0x2e2993[_0xd131('0x54')]=_0x11223a[_0xd131('0x4a')]['id'];return _0x2e2993;});return db[_0xd131('0x51')][_0xd131('0x67')](_0x4fdfb3,{'raw':!![],'transaction':_0x501eb6});})[_0xd131('0x21')](function(_0x23e2f3){var _0x2b9fc9=_['filter'](_[_0xd131('0x2d')](_0x23e2f3,function(_0x42235e){return _0x42235e[_0xd131('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x2b9fc9){return db[_0xd131('0x51')][_0xd131('0x52')]({'where':{'userProfileId':_0x11223a[_0xd131('0x4a')]['id'],'sectionId':_[_0xd131('0x2d')](_0x2b9fc9,function(_0xd4eb13){return _0xd4eb13[_0xd131('0x53')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xd131('0x21')](function(_0x2c055f){var _0x2a168c=_[_0xd131('0x2d')](_0x11223a[_0xd131('0x48')],function(_0x290d60){_0x290d60[_0xd131('0x54')]=_0x11223a[_0xd131('0x4a')]['id'];return _0x290d60;});return db['UserProfileResource']['bulkCreate'](_0x2a168c,{'raw':!![],'transaction':_0x501eb6});});}})[_0xd131('0x46')](handleError(_0x45777a,null));});}})[_0xd131('0x21')](function(_0x3ca2a4){var _0x5a0451=_['map'](_0x3ca2a4,function(_0x386929){return _0x386929[_0xd131('0x4b')]({'plain':!![]});});})[_0xd131('0x21')](respondWithResult(_0x45777a,null))[_0xd131('0x46')](handleError(_0x45777a,null));};exports[_0xd131('0x68')]=function(_0x5d064e,_0x2386a3,_0x3dacf5){return db['UserProfile'][_0xd131('0x45')]({'where':{'id':_0x5d064e['params']['id']}})[_0xd131('0x21')](handleEntityNotFound(_0x2386a3,null))['then'](function(_0x3bc030){if(_0x3bc030){return _0x3bc030['removeResources'](_0x5d064e[_0xd131('0x2e')][_0xd131('0x5c')]);}})[_0xd131('0x21')](respondWithStatusCode(_0x2386a3,null))[_0xd131('0x46')](handleError(_0x2386a3,null));};exports[_0xd131('0x69')]=function(_0x2e2835,_0x17ce02){var _0x52418e={};if(!_0x2e2835[_0xd131('0x2e')][_0xd131('0x6a')])throw new Error(_0xd131('0x6b'));if(!_0x2e2835[_0xd131('0x2e')][_0xd131('0x35')]('nolimit')){_0x52418e[_0xd131('0x36')]=qs[_0xd131('0x36')](_0x2e2835['query']['limit']);_0x52418e[_0xd131('0x37')]=qs['offset'](_0x2e2835[_0xd131('0x2e')][_0xd131('0x37')]);}return db['UserProfile']['find']({'where':{'id':_0x2e2835['params']['id']}})['then'](function(_0x25151f){if(!_0x25151f)throw new Error(_0xd131('0x6c')+_0x2e2835[_0xd131('0x4a')]['id']);return db['UserProfile'][_0xd131('0x69')](_0x2e2835);})[_0xd131('0x21')](respondWithFilteredResult(_0x17ce02,_0x52418e))[_0xd131('0x46')](handleError(_0x17ce02,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a327b94..4978a90 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 _0x5353=['save','update','remove','emit','hasOwnProperty','exports','events','UserProfile','setMaxListeners'];(function(_0x3836ae,_0x33dcdb){var _0x4d4a64=function(_0x58810e){while(--_0x58810e){_0x3836ae['push'](_0x3836ae['shift']());}};_0x4d4a64(++_0x33dcdb);}(_0x5353,0x12f));var _0x3535=function(_0x167b21,_0x5b817b){_0x167b21=_0x167b21-0x0;var _0x584f01=_0x5353[_0x167b21];return _0x584f01;};'use strict';var EventEmitter=require(_0x3535('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x3535('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3535('0x2')](0x0);var events={'afterCreate':_0x3535('0x3'),'afterUpdate':_0x3535('0x4'),'afterDestroy':_0x3535('0x5')};function emitEvent(_0x2b65db){return function(_0x21ad15,_0xd6adad,_0x24286e){UserProfileEvents[_0x3535('0x6')](_0x2b65db+':'+_0x21ad15['id'],_0x21ad15);UserProfileEvents['emit'](_0x2b65db,_0x21ad15);_0x24286e(null);};}for(var e in events){if(events[_0x3535('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3535('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x323f=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x28a00f,_0x103ad8){var _0x47f8c8=function(_0x2289fd){while(--_0x2289fd){_0x28a00f['push'](_0x28a00f['shift']());}};_0x47f8c8(++_0x103ad8);}(_0x323f,0x1ee));var _0xf323=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x323f[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf323('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf323('0x1')](0x0);var events={'afterCreate':_0xf323('0x2'),'afterUpdate':_0xf323('0x3'),'afterDestroy':_0xf323('0x4')};function emitEvent(_0x111042){return function(_0x2c9d35,_0xb4caa8,_0x2d4750){UserProfileEvents[_0xf323('0x5')](_0x111042+':'+_0x2c9d35['id'],_0x2c9d35);UserProfileEvents[_0xf323('0x5')](_0x111042,_0x2c9d35);_0x2d4750(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xf323('0x6')](e,emitEvent(event));}}module[_0xf323('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 45c7648..55f200f 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 _0x3e05=['union','ignore','autoAssociation','keys','filters','intersection','fields','attributes','limit','offset','order','sort','pick','merge','key','VIRTUAL','find','foreignKey','forEach','options','includeAll','include','reportType','default','reportId','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','tag','ThroughTags','color','true','chat','dataValues','sms','fax','mail','openchannel','./userProfile.attributes','squel','exports','models','filter','value','findAll','then','associatedResources','map','catch','field','model','name','resolve','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','ivrcampaigns','Campaign','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','queuecampaigns','VoiceQueues','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','all'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x3e05,0xed));var _0x53e0=function(_0x4a284d,_0x49925e){_0x4a284d=_0x4a284d-0x0;var _0x1483a0=_0x3e05[_0x4a284d];return _0x1483a0;};'use strict';var _=require('lodash');var attributes=require(_0x53e0('0x0'));var squel=require(_0x53e0('0x1'));module[_0x53e0('0x2')]=function(_0x386360){var _0x1c1a62=_0x386360[_0x53e0('0x3')];function _0xe92b77(_0xc1461e,_0x39f6c7){return new Promise(function(_0x2f363f,_0x22583a){if(!_0x39f6c7)return _0x2f363f(null);var _0x44f00e=_0x39f6c7[_0x53e0('0x4')]?{[_0x39f6c7['filter']['field']]:_0x39f6c7[_0x53e0('0x4')][_0x53e0('0x5')]}:undefined;return _0x1c1a62[_0xc1461e][_0x53e0('0x6')]({'where':_0x44f00e,'raw':!![]})[_0x53e0('0x7')](function(_0x20c7e4){_0x39f6c7[_0x53e0('0x8')]=_[_0x53e0('0x9')](_0x20c7e4,'id');_0x2f363f(_0x39f6c7);})[_0x53e0('0xa')](function(_0x134ec3){_0x22583a(_0x134ec3);});});}function _0x376d97(_0x15b993,_0x159529){return new Promise(function(_0x1487f3,_0x1da251){var _0x3dec32=_0x15b993[_0x53e0('0x4')]?{[_0x15b993[_0x53e0('0x4')][_0x53e0('0xb')]]:_0x15b993['filter'][_0x53e0('0x5')]}:undefined;return _0x1c1a62[_0x15b993[_0x53e0('0xc')]]['findAll']({'where':_0x3dec32,'raw':!![]})[_0x53e0('0x7')](function(_0x2e6474){_0x159529['associatedResources']=_['map'](_0x2e6474,function(_0x2a75ac){return _0x2a75ac[_0x53e0('0xd')];});_0x1487f3(_0x159529);})['catch'](function(_0x3391f8){_0x1da251(_0x3391f8);});});}function _0x8ac25(_0x3e5717,_0x3861cd,_0x58f8ac){if(!_0x3861cd)return Promise[_0x53e0('0xe')](null);return new Promise(function(_0x130a5f,_0x5a3b10){return _0x1c1a62['UserProfileResource'][_0x53e0('0x6')]({'where':{'sectionId':_0x3861cd['id']},'raw':!![]})['then'](function(_0x45be31){if(_0x3e5717[_0x53e0('0xb')]&&_0x3e5717[_0x53e0('0xb')]!=='id'){_0x3861cd['associatedResources']=_[_0x53e0('0x9')](_0x45be31,function(_0x10c422){return _0x10c422[_0x3e5717[_0x53e0('0xb')]];});}else{if(_0x58f8ac==='AnalyticExtractedReport'){_0x3861cd[_0x53e0('0x8')]=_[_0x53e0('0x9')](_0x45be31,function(_0x35a060){return{'id':_0x35a060[_0x53e0('0xf')],'type':_0x35a060[_0x53e0('0x10')]};});}else{_0x3861cd[_0x53e0('0x8')]=_['map'](_0x45be31,function(_0x35269c){return _0x35269c[_0x53e0('0xf')];});}}_0x130a5f(_0x3861cd);})[_0x53e0('0xa')](function(_0x5d612e){_0x5a3b10(_0x5d612e);});});}function _0x15c32f(_0x402dc0,_0x1343cf){var _0x91fadf={'parentSections':[]};switch(_0x402dc0[_0x53e0('0x11')]()){case _0x53e0('0x12'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x14');break;case _0x53e0('0x15'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x16');break;case _0x53e0('0x17'):_0x91fadf['childModel']=_0x53e0('0x18');_0x91fadf[_0x53e0('0x19')]=[{'name':_0x53e0('0x1a'),'field':_0x53e0('0xd'),'foreignKey':_0x53e0('0x1b')}];break;case _0x53e0('0x1c'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x1d');break;case _0x53e0('0x1e'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x1f');_0x91fadf[_0x53e0('0x19')]=[{'name':_0x53e0('0x20'),'field':'id','foreignKey':_0x53e0('0x21')}];break;case _0x53e0('0x22'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x23');break;case _0x53e0('0x24'):_0x91fadf['childModel']=_0x53e0('0x25');break;case _0x53e0('0x26'):_0x91fadf['childModel']='CmCustomField';break;case'chatqueues':_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x27');break;case'chatwebsites':_0x91fadf['childModel']=_0x53e0('0x28');break;case _0x53e0('0x29'):_0x91fadf['childModel']=_0x53e0('0x2a');break;case'faxaccounts':_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x2b');break;case _0x53e0('0x2c'):case _0x53e0('0x2d'):case _0x53e0('0x2e'):_0x91fadf['childModel']='VoiceExtension';break;case'contexts':_0x91fadf[_0x53e0('0x13')]='VoiceContext';break;case _0x53e0('0x2f'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x30');break;case _0x53e0('0x31'):_0x91fadf['childModel']=_0x53e0('0x32');_0x91fadf[_0x53e0('0x19')]=[{'name':_0x53e0('0x33'),'field':'name','foreignKey':_0x53e0('0x34'),'model':_0x53e0('0x35'),'filter':{'field':_0x53e0('0x36'),'value':['agent']}},{'name':_0x53e0('0x37'),'field':_0x53e0('0xd'),'foreignKey':_0x53e0('0x34'),'model':_0x53e0('0x35'),'filter':{'field':'role','value':[_0x53e0('0x38')]}},{'name':'VoiceQueues','field':_0x53e0('0xd'),'foreignKey':_0x53e0('0x39'),'model':_0x53e0('0x3a'),'filter':{'field':_0x53e0('0x10'),'value':[_0x53e0('0x3b')]}},{'name':_0x53e0('0x3c'),'field':'name','foreignKey':_0x53e0('0x39'),'model':_0x53e0('0x3a'),'filter':{'field':_0x53e0('0x10'),'value':[_0x53e0('0x3d')]}}];break;case _0x53e0('0x3e'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x3f');break;case _0x53e0('0x40'):_0x91fadf[_0x53e0('0x13')]='VoiceChanSpy';break;case'voiceprefixes':_0x91fadf[_0x53e0('0x13')]='VoicePrefix';break;case _0x53e0('0x41'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x42');break;case'mailqueues':_0x91fadf[_0x53e0('0x13')]='MailQueue';break;case _0x53e0('0x43'):_0x91fadf['childModel']=_0x53e0('0x44');break;case _0x53e0('0x45'):_0x91fadf[_0x53e0('0x13')]='MailSubstatus';break;case _0x53e0('0x46'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x47');break;case'openchannelaccounts':_0x91fadf[_0x53e0('0x13')]='OpenchannelAccount';break;case _0x53e0('0x48'):_0x91fadf['childModel']=_0x53e0('0x49');break;case _0x53e0('0x4a'):_0x91fadf[_0x53e0('0x13')]='SmsAccount';break;case _0x53e0('0x4b'):_0x91fadf['childModel']=_0x53e0('0x4c');break;case _0x53e0('0x4d'):_0x91fadf['childModel']='WhatsappAccount';break;case _0x53e0('0x4e'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x4f');break;case'voicequeues':case _0x53e0('0x50'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x3a');if(_0x1343cf){_0x91fadf[_0x53e0('0x19')]=[{'name':_0x53e0('0x51')},{'name':'QueueCampaigns'}];}break;case'users':case _0x53e0('0x52'):case _0x53e0('0x53'):_0x91fadf[_0x53e0('0x13')]='User';if(_0x1343cf){_0x91fadf[_0x53e0('0x19')]=[{'name':_0x53e0('0x54'),'filter':{'field':_0x53e0('0x36'),'value':[_0x53e0('0x55'),_0x53e0('0x56')]},'ignore':!![]},{'name':_0x53e0('0x33')},{'name':_0x53e0('0x37')}];}break;case'zendeskaccounts':_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x57');break;case _0x53e0('0x58'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x59');break;case _0x53e0('0x5a'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x5b');break;case'sugarcrmaccounts':_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x5c');break;case _0x53e0('0x5d'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x5e');break;case _0x53e0('0x5f'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x60');break;case'vtigeraccounts':_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x35');break;case _0x53e0('0x61'):_0x91fadf['childModel']=_0x53e0('0x62');break;case _0x53e0('0x63'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x64');break;case _0x53e0('0x65'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x66');break;case _0x53e0('0x67'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x68');break;case _0x53e0('0x69'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x6a');break;case _0x53e0('0x6b'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x6c');break;case'sounds':_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x6d');break;case _0x53e0('0x6e'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x6f');break;case'templates':_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x70');break;case _0x53e0('0x71'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x72');break;case _0x53e0('0x73'):_0x91fadf[_0x53e0('0x13')]='Trunk';break;case _0x53e0('0x74'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x75');break;case _0x53e0('0x76'):_0x91fadf[_0x53e0('0x13')]=_0x53e0('0x77');break;case _0x53e0('0x78'):_0x91fadf['childModel']=_0x53e0('0x79');_0x91fadf['parentSections']=[{'name':_0x53e0('0x7a'),'field':'id','foreignKey':'reportId'}];break;case _0x53e0('0x7b'):_0x91fadf['childModel']=_0x53e0('0x7c');break;}return _0x91fadf;}function _0x157ab6(_0x3d0fe4,_0x2966b6){var _0x27d6e7=_0x3d0fe4['charAt'](0x0)[_0x53e0('0x7d')]()+_0x3d0fe4[_0x53e0('0x7e')](0x1);var _0x225aa6={'type':_0x1c1a62[_0x53e0('0x7f')][_0x53e0('0x80')][_0x53e0('0x81')],'raw':!![]};return new Promise(function(_0x9ab1fe,_0x5c7dc2){var _0x338691=squel[_0x53e0('0x82')]()[_0x53e0('0xb')](_0x53e0('0x83')+_0x27d6e7+_0x53e0('0x84'),'id')[_0x53e0('0xb')](_0x53e0('0x85'))['from'](_0x53e0('0x86')+_0x3d0fe4+_0x53e0('0x87'),'ui')[_0x53e0('0x88')](_0x53e0('0x89'),_0x2966b6['id']);return _0x1c1a62['sequelize'][_0x53e0('0x8a')](_0x338691['toString'](),_0x225aa6)[_0x53e0('0x7')](function(_0xca48d8){_0x2966b6[_0x27d6e7+'OpenTabs']=_0xca48d8;_0x9ab1fe(_0xca48d8);})[_0x53e0('0xa')](function(_0xb6ca18){_0x5c7dc2(_0xb6ca18);});});}return _0x386360[_0x53e0('0x8b')](_0x53e0('0x8c'),attributes,{'tableName':_0x53e0('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x34319d){var _0x513386=require('../../components/parsers/qs');var _0x24a327={'raw':_0x34319d[_0x53e0('0x8a')][_0x53e0('0x8e')],'where':{}};var _0x3882aa={};var _0x4300a9={'count':0x0,'rows':[]};var _0xc054ba=_0x34319d[_0x53e0('0x8a')][_0x53e0('0x8f')];var _0x275d63=_0x34319d['query'][_0x53e0('0x90')]||![];var _0x571dd1=_0x15c32f(_0xc054ba,_0x275d63);if(!_0x571dd1[_0x53e0('0x13')])throw new Error(_0x53e0('0x91')+_0xc054ba+'\x27');var _0x1c6ec3=[{'name':_0xc054ba}];if(!_[_0x53e0('0x92')](_0x571dd1[_0x53e0('0x19')]))_0x1c6ec3=_0x571dd1[_0x53e0('0x19')];var _0x498ea6=[];for(var _0x33b163=0x0;_0x33b163<_0x1c6ec3[_0x53e0('0x93')];_0x33b163++){_0x498ea6[_0x53e0('0x94')](_0x1c1a62[_0x53e0('0x95')]['find']({'where':{'userProfileId':_0x34319d['params']['id'],'name':_0x1c6ec3[_0x33b163][_0x53e0('0xd')]},'raw':!![]}));}return Promise[_0x53e0('0x96')](_0x498ea6)['then'](function(_0x5a590f){var _0x5580b0=_[_0x53e0('0x4')](_0x5a590f,function(_0x5e8fca){return _0x5e8fca?_0x5e8fca:undefined;});var _0x2ed224=_[_0x53e0('0x4')](_0x1c6ec3,['ignore',!![]]);var _0x3334f3=_['isEmpty'](_0x5580b0)&&_[_0x53e0('0x92')](_0x2ed224)?null:_[_0x53e0('0x97')](_0x2ed224,_0x5580b0);if(!_0x3334f3)return null;var _0x9c29f9=[];for(var _0x11e868=0x0;_0x11e868<_0x3334f3[_0x53e0('0x93')];_0x11e868++){var _0x57d14a=_['find'](_0x1c6ec3,function(_0xf9bd63){return _0x3334f3[_0x11e868]?_0xf9bd63[_0x53e0('0xd')]===_0x3334f3[_0x11e868][_0x53e0('0xd')]:null;});if(_0x57d14a){if(_0x3334f3[_0x11e868][_0x53e0('0x98')]){_0x9c29f9[_0x53e0('0x94')](_0xe92b77(_0x571dd1[_0x53e0('0x13')],_0x3334f3[_0x11e868]));}else{if(!_0x3334f3[_0x11e868][_0x53e0('0x99')]){_0x9c29f9[_0x53e0('0x94')](_0x8ac25(_0x57d14a,_0x3334f3[_0x11e868],_0x571dd1[_0x53e0('0x13')]));}else{if(_0x57d14a[_0x53e0('0xc')]){_0x9c29f9['push'](_0x376d97(_0x57d14a,_0x3334f3[_0x11e868]));}}}}}return Promise[_0x53e0('0x96')](_0x9c29f9);})[_0x53e0('0x7')](function(_0xcc5679){var _0x3e5294=_0xcc5679;var _0x2381a=null;if(_0x3e5294){_0x2381a=_0x3e5294[_0x53e0('0x93')]===0x1?_0x3e5294[0x0]:null;}if(!_0x2381a&&!_0x3e5294)return _0x4300a9;var _0x2ab846=_0x1c1a62[_0x571dd1[_0x53e0('0x13')]]['rawAttributes'];_0x3882aa['model']=_[_0x53e0('0x9a')](_0x2ab846);_0x3882aa[_0x53e0('0x8a')]=_[_0x53e0('0x9a')](_0x34319d[_0x53e0('0x8a')]);_0x3882aa[_0x53e0('0x9b')]=_[_0x53e0('0x9c')](_0x3882aa[_0x53e0('0xc')],_0x3882aa[_0x53e0('0x8a')]);_0x24a327['attributes']=_['intersection'](_0x3882aa[_0x53e0('0xc')],_0x513386[_0x53e0('0x9d')](_0x34319d[_0x53e0('0x8a')][_0x53e0('0x9d')]));_0x24a327[_0x53e0('0x9e')]=_0x24a327['attributes'][_0x53e0('0x93')]?_0x24a327[_0x53e0('0x9e')]:_0x3882aa[_0x53e0('0xc')];if(!_0x34319d['query']['hasOwnProperty']('nolimit')){_0x24a327[_0x53e0('0x9f')]=_0x513386[_0x53e0('0x9f')](_0x34319d['query'][_0x53e0('0x9f')]);_0x24a327[_0x53e0('0xa0')]=_0x513386[_0x53e0('0xa0')](_0x34319d['query'][_0x53e0('0xa0')]);}_0x24a327[_0x53e0('0xa1')]=_0x513386[_0x53e0('0xa2')](_0x34319d[_0x53e0('0x8a')][_0x53e0('0xa2')]);_0x24a327['where']=_0x513386[_0x53e0('0x9b')](_[_0x53e0('0xa3')](_0x34319d[_0x53e0('0x8a')],_0x3882aa[_0x53e0('0x9b')]));if(_0x34319d[_0x53e0('0x8a')][_0x53e0('0x4')]){_0x24a327[_0x53e0('0x88')]=_[_0x53e0('0xa4')](_0x24a327[_0x53e0('0x88')],{'$or':_['map'](_0x2ab846,function(_0x2cf2d0){if(_0x2cf2d0[_0x53e0('0x10')][_0x53e0('0xa5')]!==_0x53e0('0xa6')){var _0x39692e={};_0x39692e[_0x2cf2d0[_0x53e0('0xb')]]={'$like':'%'+_0x34319d[_0x53e0('0x8a')][_0x53e0('0x4')]+'%'};return _0x39692e;}})});}var _0x52882d=[];var _0x5ee069=null;var _0xed0d3d={};if(_0x2381a){_0x5ee069=_[_0x53e0('0xa7')](_0x1c6ec3,[_0x53e0('0xd'),_0x2381a[_0x53e0('0xd')]]);if(_0x5ee069['field']){_0xed0d3d={};if(_0x571dd1[_0x53e0('0x13')]==='AnalyticExtractedReport'){_0xed0d3d[_0x5ee069[_0x53e0('0xa8')]]=_['map'](_0x2381a[_0x53e0('0x8')],'id');}else{_0xed0d3d[_0x5ee069[_0x53e0('0xa8')]]=_0x2381a[_0x53e0('0x8')];}_0x52882d['push'](_0xed0d3d);}else{_0x24a327['where']['id']=_0x2381a['associatedResources'];}}else{for(var _0x342ada=0x0;_0x342ada<_0x3e5294[_0x53e0('0x93')];_0x342ada++){_0x5ee069=_[_0x53e0('0xa7')](_0x1c6ec3,[_0x53e0('0xd'),_0x3e5294[_0x342ada][_0x53e0('0xd')]]);if(_0x5ee069[_0x53e0('0xb')]){_0xed0d3d={};_0xed0d3d[_0x5ee069[_0x53e0('0xa8')]]=_0x3e5294[_0x342ada]['associatedResources'];_0x52882d['push'](_0xed0d3d);}else{if(!_0x24a327['where']['id'])_0x24a327['where']['id']=[];_0x3e5294[_0x342ada][_0x53e0('0x8')][_0x53e0('0xa9')](function(_0x58f59c){_0x24a327['where']['id'][_0x53e0('0x94')](_0x58f59c);});}}}if(!_['isEmpty'](_0x52882d)){_0x24a327[_0x53e0('0x88')]=_['merge'](_0x24a327[_0x53e0('0x88')],{'$and':{'$or':_0x52882d}});}_0x24a327=_[_0x53e0('0xa4')]({},_0x24a327,_0x34319d[_0x53e0('0xaa')]);if(_0x2381a&&!_0x2381a[_0x53e0('0x99')]&&_0x571dd1[_0x53e0('0x13')]==='AnalyticExtractedReport'){if(_0x34319d[_0x53e0('0x8a')][_0x53e0('0xab')]){_0x24a327[_0x53e0('0xac')]=[{'all':!![]}];}return _0x1c1a62[_0x571dd1[_0x53e0('0x13')]][_0x53e0('0x6')](_0x24a327)[_0x53e0('0x7')](function(_0x4b011f){var _0x56f213=[];_0x4b011f[_0x53e0('0xa9')](function(_0x188767){var _0x494448;switch(_0x188767[_0x53e0('0xad')]){case _0x53e0('0xae'):_0x494448=_[_0x53e0('0xa7')](_0x2381a[_0x53e0('0x8')],function(_0x4e5cc7){return _0x4e5cc7['id']===_0x188767[_0x53e0('0xaf')]&&_0x4e5cc7[_0x53e0('0x10')]===_0x53e0('0xb0');});break;case'custom':_0x494448=_[_0x53e0('0xa7')](_0x2381a[_0x53e0('0x8')],function(_0xa32b2b){return _0xa32b2b['id']===_0x188767[_0x53e0('0xaf')]&&_0xa32b2b[_0x53e0('0x10')]===_0x53e0('0xb1');});break;}if(_0x494448)_0x56f213[_0x53e0('0x94')](_0x188767);});_0x4300a9[_0x53e0('0xb2')]=_0x56f213[_0x53e0('0x93')];_0x4300a9[_0x53e0('0xb3')]=_0x56f213;return _0x4300a9;});}else{if(!_[_0x53e0('0x92')](_0x34319d['query']['ids'])){_0x24a327['where']['id']=_0x24a327[_0x53e0('0x88')]['id']?_[_0x53e0('0x9c')](_0x24a327[_0x53e0('0x88')]['id'],_0x34319d[_0x53e0('0x8a')][_0x53e0('0xb4')]):_0x34319d[_0x53e0('0x8a')]['ids'];if(_0x34319d[_0x53e0('0x8a')][_0x53e0('0xb5')]){_0x24a327['order']=_0x34319d['query'][_0x53e0('0xb5')];}}if(_0x34319d[_0x53e0('0x8a')]['extraQueryConditions']){_0x24a327['where']=_['merge'](_0x24a327[_0x53e0('0x88')],{'$and':_0x34319d['query'][_0x53e0('0xb6')]});}return _0x1c1a62[_0x571dd1[_0x53e0('0x13')]][_0x53e0('0xb2')]({'where':_0x24a327[_0x53e0('0x88')]})['then'](function(_0x7442d2){_0x4300a9[_0x53e0('0xb2')]=_0x7442d2;if(_0x34319d['query'][_0x53e0('0xab')]){if(_0x571dd1[_0x53e0('0x13')]===_0x53e0('0x1f')){_0x24a327['include']=[{'model':_0x1c1a62[_0x53e0('0x6f')],'as':_0x53e0('0xb7'),'attributes':['id','name','color'],'required':_0x34319d[_0x53e0('0x8a')][_0x53e0('0xb8')]?!![]:![]},{'model':_0x1c1a62[_0x53e0('0x6f')],'as':_0x53e0('0xb9'),'attributes':['id','name',_0x53e0('0xba')],'through':_0x34319d[_0x53e0('0x8a')][_0x53e0('0xb8')]?{'attributes':[],'where':{'TagId':_0x34319d['query'][_0x53e0('0xb8')]||undefined}}:{},'required':_0x34319d[_0x53e0('0x8a')][_0x53e0('0xb8')]?!![]:![]}];}else{_0x24a327[_0x53e0('0xac')]=[{'all':!![]}];}}return _0x1c1a62[_0x571dd1[_0x53e0('0x13')]][_0x53e0('0x6')](_0x24a327);})[_0x53e0('0x7')](function(_0x54290a){_0x4300a9['rows']=_0x54290a;if(_0xc054ba==='Agents'&&_0x34319d[_0x53e0('0x8a')]['openTabs']===_0x53e0('0xbb')){var _0x17a3bf=[];for(var _0xb27c1b=0x0;_0xb27c1b<_0x4300a9[_0x53e0('0xb3')][_0x53e0('0x93')];_0xb27c1b++){_0x17a3bf[_0x53e0('0x94')](_0x157ab6(_0x53e0('0xbc'),_0x4300a9[_0x53e0('0xb3')][_0xb27c1b][_0x53e0('0xbd')]));_0x17a3bf[_0x53e0('0x94')](_0x157ab6(_0x53e0('0xbe'),_0x4300a9['rows'][_0xb27c1b][_0x53e0('0xbd')]));_0x17a3bf[_0x53e0('0x94')](_0x157ab6(_0x53e0('0xbf'),_0x4300a9[_0x53e0('0xb3')][_0xb27c1b]['dataValues']));_0x17a3bf[_0x53e0('0x94')](_0x157ab6(_0x53e0('0xc0'),_0x4300a9['rows'][_0xb27c1b][_0x53e0('0xbd')]));_0x17a3bf[_0x53e0('0x94')](_0x157ab6(_0x53e0('0xc1'),_0x4300a9[_0x53e0('0xb3')][_0xb27c1b][_0x53e0('0xbd')]));_0x17a3bf[_0x53e0('0x94')](_0x157ab6('whatsapp',_0x4300a9['rows'][_0xb27c1b][_0x53e0('0xbd')]));}return Promise[_0x53e0('0x96')](_0x17a3bf)[_0x53e0('0x7')](function(){return _0x4300a9;});}return _0x4300a9;});}});}}});}; \ No newline at end of file +var _0x2dcd=['Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','intervals','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','AnalyticExtractedReport','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','where','ui.UserId\x20=\x20?','toString','define','UserProfile','user_profiles','../../components/parsers/qs','raw','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','union','ignore','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','reportId','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','true','sms','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','filter','field','value','findAll','associatedResources','map','catch','model','then','name','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','Lists','ListId','lists','CmList','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','voicerecordings','Agents','membername','User','role','agent','VoiceQueues','queue','inbound','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','user'];(function(_0x12f5d8,_0x5b72a1){var _0x2955c2=function(_0x1809db){while(--_0x1809db){_0x12f5d8['push'](_0x12f5d8['shift']());}};_0x2955c2(++_0x5b72a1);}(_0x2dcd,0x1e8));var _0xd2dc=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0x2dcd[_0x172660];return _0x83204f;};'use strict';var _=require('lodash');var attributes=require(_0xd2dc('0x0'));var squel=require(_0xd2dc('0x1'));module[_0xd2dc('0x2')]=function(_0xc3f0c9){var _0x24b566=_0xc3f0c9['models'];function _0x192e2e(_0x393738,_0x5600d4){return new Promise(function(_0x4400c3,_0xe45a2c){if(!_0x5600d4)return _0x4400c3(null);var _0x456909=_0x5600d4[_0xd2dc('0x3')]?{[_0x5600d4[_0xd2dc('0x3')][_0xd2dc('0x4')]]:_0x5600d4['filter'][_0xd2dc('0x5')]}:undefined;return _0x24b566[_0x393738][_0xd2dc('0x6')]({'where':_0x456909,'raw':!![]})['then'](function(_0x4e133e){_0x5600d4[_0xd2dc('0x7')]=_[_0xd2dc('0x8')](_0x4e133e,'id');_0x4400c3(_0x5600d4);})[_0xd2dc('0x9')](function(_0x2b92d8){_0xe45a2c(_0x2b92d8);});});}function _0x18af63(_0x46e8bf,_0xfe6da3){return new Promise(function(_0x1d3007,_0x1d50a6){var _0x45dba6=_0x46e8bf[_0xd2dc('0x3')]?{[_0x46e8bf[_0xd2dc('0x3')][_0xd2dc('0x4')]]:_0x46e8bf[_0xd2dc('0x3')]['value']}:undefined;return _0x24b566[_0x46e8bf[_0xd2dc('0xa')]][_0xd2dc('0x6')]({'where':_0x45dba6,'raw':!![]})[_0xd2dc('0xb')](function(_0x537a57){_0xfe6da3[_0xd2dc('0x7')]=_[_0xd2dc('0x8')](_0x537a57,function(_0xf65db1){return _0xf65db1[_0xd2dc('0xc')];});_0x1d3007(_0xfe6da3);})[_0xd2dc('0x9')](function(_0x19ce0d){_0x1d50a6(_0x19ce0d);});});}function _0x3e8568(_0x11dd90,_0x5da844,_0xdcea37){if(!_0x5da844)return Promise['resolve'](null);return new Promise(function(_0x2eb735,_0x3e17ef){return _0x24b566[_0xd2dc('0xd')][_0xd2dc('0x6')]({'where':{'sectionId':_0x5da844['id']},'raw':!![]})[_0xd2dc('0xb')](function(_0x38fca0){if(_0x11dd90[_0xd2dc('0x4')]&&_0x11dd90['field']!=='id'){_0x5da844['associatedResources']=_[_0xd2dc('0x8')](_0x38fca0,function(_0xc56fe2){return _0xc56fe2[_0x11dd90['field']];});}else{if(_0xdcea37==='AnalyticExtractedReport'){_0x5da844['associatedResources']=_[_0xd2dc('0x8')](_0x38fca0,function(_0x38a680){return{'id':_0x38a680[_0xd2dc('0xe')],'type':_0x38a680[_0xd2dc('0xf')]};});}else{_0x5da844[_0xd2dc('0x7')]=_[_0xd2dc('0x8')](_0x38fca0,function(_0x9328cf){return _0x9328cf[_0xd2dc('0xe')];});}}_0x2eb735(_0x5da844);})[_0xd2dc('0x9')](function(_0x21f662){_0x3e17ef(_0x21f662);});});}function _0x2f9711(_0x5ab855,_0x17eb48){var _0x365519={'parentSections':[]};switch(_0x5ab855[_0xd2dc('0x10')]()){case _0xd2dc('0x11'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x13');break;case _0xd2dc('0x14'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x15');break;case _0xd2dc('0x16'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x17');_0x365519[_0xd2dc('0x18')]=[{'name':'SquareProjects','field':_0xd2dc('0xc'),'foreignKey':_0xd2dc('0x19')}];break;case _0xd2dc('0x1a'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x1b');break;case'contacts':_0x365519[_0xd2dc('0x12')]='CmContact';_0x365519[_0xd2dc('0x18')]=[{'name':_0xd2dc('0x1c'),'field':'id','foreignKey':_0xd2dc('0x1d')}];break;case _0xd2dc('0x1e'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x1f');break;case'companies':_0x365519[_0xd2dc('0x12')]='CmCompany';break;case _0xd2dc('0x20'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x21');break;case _0xd2dc('0x22'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x23');break;case _0xd2dc('0x24'):_0x365519['childModel']=_0xd2dc('0x25');break;case'faxqueues':_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x26');break;case _0xd2dc('0x27'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x28');break;case _0xd2dc('0x29'):case _0xd2dc('0x2a'):case _0xd2dc('0x2b'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x2c');break;case _0xd2dc('0x2d'):_0x365519[_0xd2dc('0x12')]='VoiceContext';break;case _0xd2dc('0x2e'):_0x365519['childModel']='VoiceMail';break;case _0xd2dc('0x2f'):_0x365519[_0xd2dc('0x12')]='VoiceRecording';_0x365519[_0xd2dc('0x18')]=[{'name':_0xd2dc('0x30'),'field':_0xd2dc('0xc'),'foreignKey':_0xd2dc('0x31'),'model':_0xd2dc('0x32'),'filter':{'field':_0xd2dc('0x33'),'value':[_0xd2dc('0x34')]}},{'name':'Telephones','field':_0xd2dc('0xc'),'foreignKey':_0xd2dc('0x31'),'model':'User','filter':{'field':_0xd2dc('0x33'),'value':['telephone']}},{'name':_0xd2dc('0x35'),'field':_0xd2dc('0xc'),'foreignKey':_0xd2dc('0x36'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xd2dc('0x37')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':_0xd2dc('0x38'),'filter':{'field':_0xd2dc('0xf'),'value':[_0xd2dc('0x39')]}}];break;case _0xd2dc('0x3a'):_0x365519['childModel']=_0xd2dc('0x3b');break;case'chanspies':_0x365519[_0xd2dc('0x12')]='VoiceChanSpy';break;case _0xd2dc('0x3c'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x3d');break;case'ivrcampaigns':_0x365519['childModel']='Campaign';break;case _0xd2dc('0x3e'):_0x365519[_0xd2dc('0x12')]='MailQueue';break;case _0xd2dc('0x3f'):_0x365519['childModel']=_0xd2dc('0x40');break;case _0xd2dc('0x41'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x42');break;case _0xd2dc('0x43'):_0x365519[_0xd2dc('0x12')]='OpenchannelQueue';break;case _0xd2dc('0x44'):_0x365519[_0xd2dc('0x12')]='OpenchannelAccount';break;case _0xd2dc('0x45'):_0x365519[_0xd2dc('0x12')]='SmsQueue';break;case _0xd2dc('0x46'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x47');break;case'whatsappqueues':_0x365519['childModel']=_0xd2dc('0x48');break;case _0xd2dc('0x49'):_0x365519[_0xd2dc('0x12')]='WhatsappAccount';break;case'teams':_0x365519[_0xd2dc('0x12')]='Team';break;case _0xd2dc('0x4a'):case _0xd2dc('0x4b'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x38');if(_0x17eb48){_0x365519[_0xd2dc('0x18')]=[{'name':'VoiceQueues'},{'name':_0xd2dc('0x4c')}];}break;case _0xd2dc('0x4d'):case _0xd2dc('0x4e'):case _0xd2dc('0x4f'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x32');if(_0x17eb48){_0x365519[_0xd2dc('0x18')]=[{'name':_0xd2dc('0x50'),'filter':{'field':_0xd2dc('0x33'),'value':['admin',_0xd2dc('0x51')]},'ignore':!![]},{'name':_0xd2dc('0x30')},{'name':_0xd2dc('0x52')}];}break;case _0xd2dc('0x53'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x54');break;case _0xd2dc('0x55'):_0x365519['childModel']=_0xd2dc('0x56');break;case _0xd2dc('0x57'):_0x365519[_0xd2dc('0x12')]='FreshdeskAccount';break;case _0xd2dc('0x58'):_0x365519['childModel']=_0xd2dc('0x59');break;case _0xd2dc('0x5a'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x5b');break;case _0xd2dc('0x5c'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x5d');break;case _0xd2dc('0x5e'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x32');break;case _0xd2dc('0x5f'):_0x365519[_0xd2dc('0x12')]='CannedAnswer';break;case _0xd2dc('0x60'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x61');break;case'customdashboards':_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x62');break;case _0xd2dc('0x63'):_0x365519[_0xd2dc('0x12')]='Interval';break;case'pauses':_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x64');break;case _0xd2dc('0x65'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x66');break;case _0xd2dc('0x67'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x68');break;case _0xd2dc('0x69'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x6a');break;case _0xd2dc('0x6b'):_0x365519['childModel']=_0xd2dc('0x6c');break;case _0xd2dc('0x6d'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x6e');break;case _0xd2dc('0x6f'):_0x365519['childModel']=_0xd2dc('0x70');break;case _0xd2dc('0x71'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x72');break;case'plugins':_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x73');break;case _0xd2dc('0x74'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x75');_0x365519[_0xd2dc('0x18')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xd2dc('0x76'):_0x365519[_0xd2dc('0x12')]=_0xd2dc('0x77');break;}return _0x365519;}function _0x532a60(_0x59066c,_0x3cb6d2){var _0x490c7d=_0x59066c[_0xd2dc('0x78')](0x0)[_0xd2dc('0x79')]()+_0x59066c['slice'](0x1);var _0x429e4d={'type':_0x24b566[_0xd2dc('0x7a')][_0xd2dc('0x7b')][_0xd2dc('0x7c')],'raw':!![]};return new Promise(function(_0x707c7,_0x4c760e){var _0x3cc273=squel[_0xd2dc('0x7d')]()[_0xd2dc('0x4')](_0xd2dc('0x7e')+_0x490c7d+'InteractionId','id')[_0xd2dc('0x4')](_0xd2dc('0x7f'))[_0xd2dc('0x80')]('user_has_'+_0x59066c+'_interactions','ui')[_0xd2dc('0x81')](_0xd2dc('0x82'),_0x3cb6d2['id']);return _0x24b566['sequelize']['query'](_0x3cc273[_0xd2dc('0x83')](),_0x429e4d)['then'](function(_0x4ac0e8){_0x3cb6d2[_0x490c7d+'OpenTabs']=_0x4ac0e8;_0x707c7(_0x4ac0e8);})[_0xd2dc('0x9')](function(_0x4a8872){_0x4c760e(_0x4a8872);});});}return _0xc3f0c9[_0xd2dc('0x84')](_0xd2dc('0x85'),attributes,{'tableName':_0xd2dc('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x352d5d){var _0x5f10fb=require(_0xd2dc('0x87'));var _0x573bb4={'raw':_0x352d5d['query'][_0xd2dc('0x88')],'where':{}};var _0x431e2c={};var _0x56875f={'count':0x0,'rows':[]};var _0x619ead=_0x352d5d['query']['section'];var _0x52dd78=_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0x8a')]||![];var _0x15be6d=_0x2f9711(_0x619ead,_0x52dd78);if(!_0x15be6d[_0xd2dc('0x12')])throw new Error(_0xd2dc('0x8b')+_0x619ead+'\x27');var _0x2fc417=[{'name':_0x619ead}];if(!_[_0xd2dc('0x8c')](_0x15be6d[_0xd2dc('0x18')]))_0x2fc417=_0x15be6d[_0xd2dc('0x18')];var _0x3f0d4c=[];for(var _0x41b305=0x0;_0x41b305<_0x2fc417[_0xd2dc('0x8d')];_0x41b305++){_0x3f0d4c[_0xd2dc('0x8e')](_0x24b566['UserProfileSection'][_0xd2dc('0x8f')]({'where':{'userProfileId':_0x352d5d[_0xd2dc('0x90')]['id'],'name':_0x2fc417[_0x41b305][_0xd2dc('0xc')]},'raw':!![]}));}return Promise[_0xd2dc('0x91')](_0x3f0d4c)[_0xd2dc('0xb')](function(_0x26648e){var _0x1859b9=_['filter'](_0x26648e,function(_0x24a381){return _0x24a381?_0x24a381:undefined;});var _0x3676c6=_[_0xd2dc('0x3')](_0x2fc417,['ignore',!![]]);var _0x4f8c50=_[_0xd2dc('0x8c')](_0x1859b9)&&_[_0xd2dc('0x8c')](_0x3676c6)?null:_[_0xd2dc('0x92')](_0x3676c6,_0x1859b9);if(!_0x4f8c50)return null;var _0x15e3cd=[];for(var _0xdbc3e4=0x0;_0xdbc3e4<_0x4f8c50[_0xd2dc('0x8d')];_0xdbc3e4++){var _0x2eb4f5=_['find'](_0x2fc417,function(_0x32de16){return _0x4f8c50[_0xdbc3e4]?_0x32de16['name']===_0x4f8c50[_0xdbc3e4][_0xd2dc('0xc')]:null;});if(_0x2eb4f5){if(_0x4f8c50[_0xdbc3e4][_0xd2dc('0x93')]){_0x15e3cd[_0xd2dc('0x8e')](_0x192e2e(_0x15be6d[_0xd2dc('0x12')],_0x4f8c50[_0xdbc3e4]));}else{if(!_0x4f8c50[_0xdbc3e4]['autoAssociation']){_0x15e3cd[_0xd2dc('0x8e')](_0x3e8568(_0x2eb4f5,_0x4f8c50[_0xdbc3e4],_0x15be6d[_0xd2dc('0x12')]));}else{if(_0x2eb4f5[_0xd2dc('0xa')]){_0x15e3cd[_0xd2dc('0x8e')](_0x18af63(_0x2eb4f5,_0x4f8c50[_0xdbc3e4]));}}}}}return Promise['all'](_0x15e3cd);})[_0xd2dc('0xb')](function(_0x871cb){var _0x2eba41=_0x871cb;var _0x4979f7=null;if(_0x2eba41){_0x4979f7=_0x2eba41[_0xd2dc('0x8d')]===0x1?_0x2eba41[0x0]:null;}if(!_0x4979f7&&!_0x2eba41)return _0x56875f;var _0x47088d=_0x24b566[_0x15be6d[_0xd2dc('0x12')]]['rawAttributes'];_0x431e2c['model']=_[_0xd2dc('0x94')](_0x47088d);_0x431e2c[_0xd2dc('0x89')]=_[_0xd2dc('0x94')](_0x352d5d[_0xd2dc('0x89')]);_0x431e2c[_0xd2dc('0x95')]=_[_0xd2dc('0x96')](_0x431e2c[_0xd2dc('0xa')],_0x431e2c[_0xd2dc('0x89')]);_0x573bb4[_0xd2dc('0x97')]=_['intersection'](_0x431e2c['model'],_0x5f10fb['fields'](_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0x98')]));_0x573bb4[_0xd2dc('0x97')]=_0x573bb4['attributes'][_0xd2dc('0x8d')]?_0x573bb4[_0xd2dc('0x97')]:_0x431e2c[_0xd2dc('0xa')];if(!_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0x99')](_0xd2dc('0x9a'))){_0x573bb4[_0xd2dc('0x9b')]=_0x5f10fb[_0xd2dc('0x9b')](_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0x9b')]);_0x573bb4[_0xd2dc('0x9c')]=_0x5f10fb[_0xd2dc('0x9c')](_0x352d5d['query'][_0xd2dc('0x9c')]);}_0x573bb4[_0xd2dc('0x9d')]=_0x5f10fb[_0xd2dc('0x9e')](_0x352d5d[_0xd2dc('0x89')]['sort']);_0x573bb4[_0xd2dc('0x81')]=_0x5f10fb[_0xd2dc('0x95')](_[_0xd2dc('0x9f')](_0x352d5d[_0xd2dc('0x89')],_0x431e2c[_0xd2dc('0x95')]));if(_0x352d5d['query'][_0xd2dc('0x3')]){_0x573bb4[_0xd2dc('0x81')]=_['merge'](_0x573bb4['where'],{'$or':_[_0xd2dc('0x8')](_0x47088d,function(_0x4bb229){if(_0x4bb229[_0xd2dc('0xf')][_0xd2dc('0xa0')]!==_0xd2dc('0xa1')){var _0x19de1b={};_0x19de1b[_0x4bb229[_0xd2dc('0x4')]]={'$like':'%'+_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0x3')]+'%'};return _0x19de1b;}})});}var _0x49ac62=[];var _0x237c34=null;var _0x43a7f0={};if(_0x4979f7){_0x237c34=_[_0xd2dc('0x8f')](_0x2fc417,[_0xd2dc('0xc'),_0x4979f7[_0xd2dc('0xc')]]);if(_0x237c34[_0xd2dc('0x4')]){_0x43a7f0={};if(_0x15be6d[_0xd2dc('0x12')]===_0xd2dc('0x75')){_0x43a7f0[_0x237c34[_0xd2dc('0xa2')]]=_[_0xd2dc('0x8')](_0x4979f7['associatedResources'],'id');}else{_0x43a7f0[_0x237c34[_0xd2dc('0xa2')]]=_0x4979f7['associatedResources'];}_0x49ac62[_0xd2dc('0x8e')](_0x43a7f0);}else{_0x573bb4[_0xd2dc('0x81')]['id']=_0x4979f7['associatedResources'];}}else{for(var _0x287e1f=0x0;_0x287e1f<_0x2eba41['length'];_0x287e1f++){_0x237c34=_[_0xd2dc('0x8f')](_0x2fc417,['name',_0x2eba41[_0x287e1f][_0xd2dc('0xc')]]);if(_0x237c34[_0xd2dc('0x4')]){_0x43a7f0={};_0x43a7f0[_0x237c34[_0xd2dc('0xa2')]]=_0x2eba41[_0x287e1f][_0xd2dc('0x7')];_0x49ac62[_0xd2dc('0x8e')](_0x43a7f0);}else{if(!_0x573bb4[_0xd2dc('0x81')]['id'])_0x573bb4[_0xd2dc('0x81')]['id']=[];_0x2eba41[_0x287e1f][_0xd2dc('0x7')][_0xd2dc('0xa3')](function(_0x21c7ac){_0x573bb4[_0xd2dc('0x81')]['id'][_0xd2dc('0x8e')](_0x21c7ac);});}}}if(!_[_0xd2dc('0x8c')](_0x49ac62)){_0x573bb4['where']=_[_0xd2dc('0xa4')](_0x573bb4['where'],{'$and':{'$or':_0x49ac62}});}_0x573bb4=_[_0xd2dc('0xa4')]({},_0x573bb4,_0x352d5d[_0xd2dc('0xa5')]);if(_0x4979f7&&!_0x4979f7['autoAssociation']&&_0x15be6d[_0xd2dc('0x12')]==='AnalyticExtractedReport'){if(_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0xa6')]){_0x573bb4[_0xd2dc('0xa7')]=[{'all':!![]}];}return _0x24b566[_0x15be6d[_0xd2dc('0x12')]][_0xd2dc('0x6')](_0x573bb4)[_0xd2dc('0xb')](function(_0x17dbc7){var _0x53245f=[];_0x17dbc7[_0xd2dc('0xa3')](function(_0x558e49){var _0x2e085e;switch(_0x558e49[_0xd2dc('0xa8')]){case _0xd2dc('0xa9'):_0x2e085e=_[_0xd2dc('0x8f')](_0x4979f7[_0xd2dc('0x7')],function(_0x336005){return _0x336005['id']===_0x558e49[_0xd2dc('0xaa')]&&_0x336005[_0xd2dc('0xf')]===_0xd2dc('0xab');});break;case _0xd2dc('0xac'):_0x2e085e=_[_0xd2dc('0x8f')](_0x4979f7[_0xd2dc('0x7')],function(_0x43d8a3){return _0x43d8a3['id']===_0x558e49[_0xd2dc('0xaa')]&&_0x43d8a3[_0xd2dc('0xf')]===_0xd2dc('0xad');});break;}if(_0x2e085e)_0x53245f[_0xd2dc('0x8e')](_0x558e49);});_0x56875f[_0xd2dc('0xae')]=_0x53245f[_0xd2dc('0x8d')];_0x56875f[_0xd2dc('0xaf')]=_0x53245f;return _0x56875f;});}else{if(!_[_0xd2dc('0x8c')](_0x352d5d['query'][_0xd2dc('0xb0')])){_0x573bb4[_0xd2dc('0x81')]['id']=_0x573bb4[_0xd2dc('0x81')]['id']?_[_0xd2dc('0x96')](_0x573bb4[_0xd2dc('0x81')]['id'],_0x352d5d[_0xd2dc('0x89')]['ids']):_0x352d5d[_0xd2dc('0x89')]['ids'];if(_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0xb1')]){_0x573bb4['order']=_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0xb1')];}}if(_0x352d5d['query'][_0xd2dc('0xb2')]){_0x573bb4[_0xd2dc('0x81')]=_[_0xd2dc('0xa4')](_0x573bb4['where'],{'$and':_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0xb2')]});}return _0x24b566[_0x15be6d[_0xd2dc('0x12')]]['count']({'where':_0x573bb4[_0xd2dc('0x81')]})[_0xd2dc('0xb')](function(_0x104039){_0x56875f[_0xd2dc('0xae')]=_0x104039;if(_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0xa6')]){if(_0x15be6d[_0xd2dc('0x12')]===_0xd2dc('0xb3')){_0x573bb4[_0xd2dc('0xa7')]=[{'model':_0x24b566[_0xd2dc('0x6a')],'as':_0xd2dc('0xb4'),'attributes':['id',_0xd2dc('0xc'),_0xd2dc('0xb5')],'required':_0x352d5d['query'][_0xd2dc('0xb6')]?!![]:![]},{'model':_0x24b566[_0xd2dc('0x6a')],'as':'ThroughTags','attributes':['id',_0xd2dc('0xc'),_0xd2dc('0xb5')],'through':_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0xb6')]?{'attributes':[],'where':{'TagId':_0x352d5d['query']['tag']||undefined}}:{},'required':_0x352d5d[_0xd2dc('0x89')][_0xd2dc('0xb6')]?!![]:![]}];}else{_0x573bb4[_0xd2dc('0xa7')]=[{'all':!![]}];}}return _0x24b566[_0x15be6d[_0xd2dc('0x12')]][_0xd2dc('0x6')](_0x573bb4);})[_0xd2dc('0xb')](function(_0x24a6b2){_0x56875f['rows']=_0x24a6b2;if(_0x619ead===_0xd2dc('0x30')&&_0x352d5d[_0xd2dc('0x89')]['openTabs']===_0xd2dc('0xb7')){var _0x3e1b93=[];for(var _0x3f9ac4=0x0;_0x3f9ac4<_0x56875f[_0xd2dc('0xaf')][_0xd2dc('0x8d')];_0x3f9ac4++){_0x3e1b93['push'](_0x532a60('chat',_0x56875f[_0xd2dc('0xaf')][_0x3f9ac4]['dataValues']));_0x3e1b93[_0xd2dc('0x8e')](_0x532a60(_0xd2dc('0xb8'),_0x56875f[_0xd2dc('0xaf')][_0x3f9ac4][_0xd2dc('0xb9')]));_0x3e1b93[_0xd2dc('0x8e')](_0x532a60(_0xd2dc('0xba'),_0x56875f[_0xd2dc('0xaf')][_0x3f9ac4][_0xd2dc('0xb9')]));_0x3e1b93[_0xd2dc('0x8e')](_0x532a60(_0xd2dc('0xbb'),_0x56875f['rows'][_0x3f9ac4][_0xd2dc('0xb9')]));_0x3e1b93[_0xd2dc('0x8e')](_0x532a60(_0xd2dc('0xbc'),_0x56875f[_0xd2dc('0xaf')][_0x3f9ac4]['dataValues']));_0x3e1b93[_0xd2dc('0x8e')](_0x532a60(_0xd2dc('0xbd'),_0x56875f[_0xd2dc('0xaf')][_0x3f9ac4]['dataValues']));}return Promise[_0xd2dc('0x91')](_0x3e1b93)[_0xd2dc('0xb')](function(){return _0x56875f;});}return _0x56875f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ac00db8..57ef290 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 _0x6eec=['./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x871a5f,_0x99bb24){var _0x62b59b=function(_0x33c254){while(--_0x33c254){_0x871a5f['push'](_0x871a5f['shift']());}};_0x62b59b(++_0x99bb24);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var moment=require(_0xc6ee('0x2'));var BPromise=require(_0xc6ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6ee('0x4'));var db=require(_0xc6ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6ee('0x6'))(_0xc6ee('0x7'));var config=require(_0xc6ee('0x8'));var jayson=require(_0xc6ee('0x9'));var client=jayson[_0xc6ee('0xa')][_0xc6ee('0xb')]({'port':0x232a});config[_0xc6ee('0xc')]=_[_0xc6ee('0xd')](config[_0xc6ee('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc6ee('0xc')]));require(_0xc6ee('0xe'))['register'](socket);function respondWithRpcPromise(_0x10a743,_0x5f57ec,_0x294274){return new BPromise(function(_0x2e999c,_0x405ce3){return client[_0xc6ee('0xf')](_0x10a743,_0x294274)['then'](function(_0x122a94){logger[_0xc6ee('0x10')](_0xc6ee('0x11'),_0x5f57ec,'request\x20sent');logger[_0xc6ee('0x12')](_0xc6ee('0x13'),_0x5f57ec,_0xc6ee('0x14'),JSON['stringify'](_0x122a94));if(_0x122a94[_0xc6ee('0x15')]){if(_0x122a94[_0xc6ee('0x15')][_0xc6ee('0x16')]===0x1f4){logger['error'](_0xc6ee('0x11'),_0x5f57ec,_0x122a94[_0xc6ee('0x15')][_0xc6ee('0x17')]);return _0x405ce3(_0x122a94['error'][_0xc6ee('0x17')]);}logger[_0xc6ee('0x15')](_0xc6ee('0x11'),_0x5f57ec,_0x122a94[_0xc6ee('0x15')][_0xc6ee('0x17')]);return _0x2e999c(_0x122a94[_0xc6ee('0x15')][_0xc6ee('0x17')]);}else{logger[_0xc6ee('0x10')](_0xc6ee('0x11'),_0x5f57ec,_0xc6ee('0x14'));_0x2e999c(_0x122a94[_0xc6ee('0x18')][_0xc6ee('0x17')]);}})[_0xc6ee('0x19')](function(_0xee8280){logger[_0xc6ee('0x15')](_0xc6ee('0x11'),_0x5f57ec,_0xee8280);_0x405ce3(_0xee8280);});});} \ No newline at end of file +var _0xf03a=['client','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xf03a,0x1a0));var _0xaf03=function(_0x4979ad,_0x36df48){_0x4979ad=_0x4979ad-0x0;var _0x3e8c8e=_0xf03a[_0x4979ad];return _0x3e8c8e;};'use strict';var _=require('lodash');var util=require(_0xaf03('0x0'));var moment=require(_0xaf03('0x1'));var BPromise=require(_0xaf03('0x2'));var rs=require(_0xaf03('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf03('0x4'))['db'];var utils=require(_0xaf03('0x5'));var logger=require('../../config/logger')(_0xaf03('0x6'));var config=require(_0xaf03('0x7'));var jayson=require(_0xaf03('0x8'));var client=jayson[_0xaf03('0x9')]['http']({'port':0x232a});config[_0xaf03('0xa')]=_['defaults'](config[_0xaf03('0xa')],{'host':_0xaf03('0xb'),'port':0x18eb});var socket=require(_0xaf03('0xc'))(new Redis(config[_0xaf03('0xa')]));require(_0xaf03('0xd'))[_0xaf03('0xe')](socket);function respondWithRpcPromise(_0x52d7fe,_0x1f3a5c,_0x12e1a1){return new BPromise(function(_0x4766d1,_0x33803e){return client[_0xaf03('0xf')](_0x52d7fe,_0x12e1a1)['then'](function(_0x1bc5a0){logger[_0xaf03('0x10')](_0xaf03('0x11'),_0x1f3a5c,_0xaf03('0x12'));logger[_0xaf03('0x13')](_0xaf03('0x14'),_0x1f3a5c,_0xaf03('0x12'),JSON['stringify'](_0x1bc5a0));if(_0x1bc5a0['error']){if(_0x1bc5a0[_0xaf03('0x15')][_0xaf03('0x16')]===0x1f4){logger[_0xaf03('0x15')]('UserProfile,\x20%s,\x20%s',_0x1f3a5c,_0x1bc5a0['error'][_0xaf03('0x17')]);return _0x33803e(_0x1bc5a0[_0xaf03('0x15')][_0xaf03('0x17')]);}logger[_0xaf03('0x15')](_0xaf03('0x11'),_0x1f3a5c,_0x1bc5a0[_0xaf03('0x15')]['message']);return _0x4766d1(_0x1bc5a0[_0xaf03('0x15')][_0xaf03('0x17')]);}else{logger[_0xaf03('0x10')](_0xaf03('0x11'),_0x1f3a5c,_0xaf03('0x12'));_0x4766d1(_0x1bc5a0[_0xaf03('0x18')]['message']);}})['catch'](function(_0x1e3508){logger[_0xaf03('0x15')](_0xaf03('0x11'),_0x1f3a5c,_0x1e3508);_0x33803e(_0x1e3508);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 4a61b62..5f149d6 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 _0x9a24=['save','register','length','userProfile:','./userProfile.events'];(function(_0x26b54a,_0x499677){var _0x63654a=function(_0x321f29){while(--_0x321f29){_0x26b54a['push'](_0x26b54a['shift']());}};_0x63654a(++_0x499677);}(_0x9a24,0x16c));var _0x49a2=function(_0x75e96b,_0x4a8152){_0x75e96b=_0x75e96b-0x0;var _0x16faa8=_0x9a24[_0x75e96b];return _0x16faa8;};'use strict';var UserProfileEvents=require(_0x49a2('0x0'));var events=[_0x49a2('0x1'),'remove','update'];function createListener(_0x34faa8,_0x3dbc63){return function(_0x3be547){_0x3dbc63['emit'](_0x34faa8,_0x3be547);};}function removeListener(_0x3961d4,_0xf02773){return function(){UserProfileEvents['removeListener'](_0x3961d4,_0xf02773);};}exports[_0x49a2('0x2')]=function(_0x39c1a6){for(var _0x3efe0a=0x0,_0x3cf1b5=events[_0x49a2('0x3')];_0x3efe0a<_0x3cf1b5;_0x3efe0a++){var _0xdb393c=events[_0x3efe0a];var _0x228584=createListener(_0x49a2('0x4')+_0xdb393c,_0x39c1a6);UserProfileEvents['on'](_0xdb393c,_0x228584);}}; \ No newline at end of file +var _0xf294=['update','emit','register','length','save'];(function(_0x1695cb,_0x4df7a8){var _0x8ebba9=function(_0x250c13){while(--_0x250c13){_0x1695cb['push'](_0x1695cb['shift']());}};_0x8ebba9(++_0x4df7a8);}(_0xf294,0x199));var _0x4f29=function(_0x3b048d,_0x450938){_0x3b048d=_0x3b048d-0x0;var _0x31b2d4=_0xf294[_0x3b048d];return _0x31b2d4;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x4f29('0x0'),'remove',_0x4f29('0x1')];function createListener(_0x4095c7,_0x44fce6){return function(_0x259c19){_0x44fce6[_0x4f29('0x2')](_0x4095c7,_0x259c19);};}function removeListener(_0x224460,_0x2ef62c){return function(){UserProfileEvents['removeListener'](_0x224460,_0x2ef62c);};}exports[_0x4f29('0x3')]=function(_0x216d7e){for(var _0x35b423=0x0,_0x57ad3d=events[_0x4f29('0x4')];_0x35b423<_0x57ad3d;_0x35b423++){var _0x5c224d=events[_0x35b423];var _0x7a120a=createListener('userProfile:'+_0x5c224d,_0x216d7e);UserProfileEvents['on'](_0x5c224d,_0x7a120a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index aedba01..3dd33cc 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 _0x4bde=['destroy','exports','multer','util','connect-timeout','fs-extra','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','update','/:id'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x4bde,0x101));var _0xe4bd=function(_0x1d8238,_0x7d9d9){_0x1d8238=_0x1d8238-0x0;var _0x322544=_0x4bde[_0x1d8238];return _0x322544;};'use strict';var multer=require(_0xe4bd('0x0'));var util=require(_0xe4bd('0x1'));var path=require('path');var timeout=require(_0xe4bd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe4bd('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe4bd('0x4'));var controller=require(_0xe4bd('0x5'));router[_0xe4bd('0x6')]('/',auth[_0xe4bd('0x7')](),controller[_0xe4bd('0x8')]);router[_0xe4bd('0x6')](_0xe4bd('0x9'),auth[_0xe4bd('0x7')](),controller[_0xe4bd('0xa')]);router[_0xe4bd('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe4bd('0x7')](),controller['create']);router['put']('/:id',auth[_0xe4bd('0x7')](),controller[_0xe4bd('0xb')]);router['delete'](_0xe4bd('0xc'),auth[_0xe4bd('0x7')](),controller[_0xe4bd('0xd')]);module[_0xe4bd('0xe')]=router; \ No newline at end of file +var _0xd24d=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x2f53e7,_0x20dbf9){var _0x531781=function(_0x4e118b){while(--_0x4e118b){_0x2f53e7['push'](_0x2f53e7['shift']());}};_0x531781(++_0x20dbf9);}(_0xd24d,0x181));var _0xdd24=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd24d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xdd24('0x0'));var util=require(_0xdd24('0x1'));var path=require('path');var timeout=require(_0xdd24('0x2'));var express=require(_0xdd24('0x3'));var router=express[_0xdd24('0x4')]();var fs_extra=require(_0xdd24('0x5'));var auth=require(_0xdd24('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdd24('0x7'));var controller=require(_0xdd24('0x8'));router['get']('/',auth[_0xdd24('0x9')](),controller['index']);router[_0xdd24('0xa')](_0xdd24('0xb'),auth[_0xdd24('0x9')](),controller[_0xdd24('0xc')]);router[_0xdd24('0xa')](_0xdd24('0xd'),auth['isAuthenticated'](),controller[_0xdd24('0xe')]);router[_0xdd24('0xf')]('/',auth[_0xdd24('0x9')](),controller[_0xdd24('0x10')]);router['put']('/:id',auth[_0xdd24('0x9')](),controller['update']);router[_0xdd24('0x11')](_0xdd24('0xd'),auth['isAuthenticated'](),controller[_0xdd24('0x12')]);module[_0xdd24('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e04fda9..e881009 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 _0x14c7=['sequelize','exports','STRING','INTEGER'];(function(_0x4c30ca,_0x1d61f4){var _0x2fa336=function(_0x1f4df9){while(--_0x1f4df9){_0x4c30ca['push'](_0x4c30ca['shift']());}};_0x2fa336(++_0x1d61f4);}(_0x14c7,0x94));var _0x714c=function(_0x56be03,_0xae36e7){_0x56be03=_0x56be03-0x0;var _0x41f6ef=_0x14c7[_0x56be03];return _0x41f6ef;};'use strict';var Sequelize=require(_0x714c('0x0'));module[_0x714c('0x1')]={'name':{'type':Sequelize[_0x714c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x714c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x714c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd206=['STRING','INTEGER','sequelize','exports'];(function(_0x5711f0,_0x699293){var _0x5ee738=function(_0x5f1c1f){while(--_0x5f1c1f){_0x5711f0['push'](_0x5711f0['shift']());}};_0x5ee738(++_0x699293);}(_0xd206,0x186));var _0x6d20=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xd206[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0x6d20('0x0'));module[_0x6d20('0x1')]={'name':{'type':Sequelize[_0x6d20('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6d20('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6d20('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 ab77df4..0931bc6 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 _0x1883=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileResource','includeAll','include','findAll','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x28eb8c,_0x983a4c){var _0x492d99=function(_0x4e1f9e){while(--_0x4e1f9e){_0x28eb8c['push'](_0x28eb8c['shift']());}};_0x492d99(++_0x983a4c);}(_0x1883,0xab));var _0x3188=function(_0x2cd68b,_0x30b9a3){_0x2cd68b=_0x2cd68b-0x0;var _0x5dbc2d=_0x1883[_0x2cd68b];return _0x5dbc2d;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['UserProfileResource'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['UserProfileResource'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));};exports[_0x3188('0x4a')]=function(_0x4f8852,_0x559264){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x559264,null))['catch'](handleError(_0x559264,null));}; \ No newline at end of file +var _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','UserProfileResource','includeAll','rows','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x457a5d,_0x496391){var _0x26aebd=function(_0x12387c){while(--_0x12387c){_0x457a5d['push'](_0x457a5d['shift']());}};_0x26aebd(++_0x496391);}(_0x90b1,0x1bb));var _0x190b=function(_0x22342c,_0x218835){_0x22342c=_0x22342c-0x0;var _0xd3b434=_0x90b1[_0x22342c];return _0xd3b434;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('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(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['UserProfileResource'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['UserProfileResource'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7be65bd..1655291 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 _0x0919=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','sectionId','lodash','util','../../config/logger'];(function(_0x20e213,_0x2fd9d0){var _0x169a3f=function(_0x1310f8){while(--_0x1310f8){_0x20e213['push'](_0x20e213['shift']());}};_0x169a3f(++_0x2fd9d0);}(_0x0919,0x152));var _0x9091=function(_0x5300b6,_0x4a5846){_0x5300b6=_0x5300b6-0x0;var _0x58980e=_0x0919[_0x5300b6];return _0x58980e;};'use strict';var _=require(_0x9091('0x0'));var util=require(_0x9091('0x1'));var logger=require(_0x9091('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9091('0x3'));var rp=require(_0x9091('0x4'));var fs=require('fs');var path=require(_0x9091('0x5'));var rimraf=require(_0x9091('0x6'));var config=require(_0x9091('0x7'));var attributes=require(_0x9091('0x8'));module[_0x9091('0x9')]=function(_0x210d3c,_0x3d7067){return _0x210d3c['define']('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x9091('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7b5=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','resourceId','sectionId'];(function(_0x1efd53,_0x34b7c9){var _0x69f643=function(_0x17f7e9){while(--_0x17f7e9){_0x1efd53['push'](_0x1efd53['shift']());}};_0x69f643(++_0x34b7c9);}(_0xa7b5,0x193));var _0x5a7b=function(_0x4f9c38,_0x52d092){_0x4f9c38=_0x4f9c38-0x0;var _0x1d6a31=_0xa7b5[_0x4f9c38];return _0x1d6a31;};'use strict';var _=require(_0x5a7b('0x0'));var util=require(_0x5a7b('0x1'));var logger=require(_0x5a7b('0x2'))(_0x5a7b('0x3'));var moment=require('moment');var BPromise=require(_0x5a7b('0x4'));var rp=require(_0x5a7b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a7b('0x6'));var config=require(_0x5a7b('0x7'));var attributes=require(_0x5a7b('0x8'));module[_0x5a7b('0x9')]=function(_0x1923c8,_0x32df53){return _0x1923c8['define']('UserProfileResource',attributes,{'tableName':_0x5a7b('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x5a7b('0xb'),_0x5a7b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d8645c0..935b0e7 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 _0x96d9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x45e709,_0x461674){var _0x3cd8e9=function(_0x50aa49){while(--_0x50aa49){_0x45e709['push'](_0x45e709['shift']());}};_0x3cd8e9(++_0x461674);}(_0x96d9,0xea));var _0x996d=function(_0x277ee2,_0x43428b){_0x277ee2=_0x277ee2-0x0;var _0xb5001c=_0x96d9[_0x277ee2];return _0xb5001c;};'use strict';var _=require(_0x996d('0x0'));var util=require(_0x996d('0x1'));var moment=require(_0x996d('0x2'));var BPromise=require(_0x996d('0x3'));var rs=require(_0x996d('0x4'));var fs=require('fs');var Redis=require(_0x996d('0x5'));var db=require(_0x996d('0x6'))['db'];var utils=require(_0x996d('0x7'));var logger=require('../../config/logger')(_0x996d('0x8'));var config=require(_0x996d('0x9'));var jayson=require(_0x996d('0xa'));var client=jayson[_0x996d('0xb')][_0x996d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x427a02,_0x327d3e,_0x4d65b5){return new BPromise(function(_0x40c142,_0x344899){return client[_0x996d('0xd')](_0x427a02,_0x4d65b5)[_0x996d('0xe')](function(_0x31694c){logger['info'](_0x996d('0xf'),_0x327d3e,_0x996d('0x10'));logger[_0x996d('0x11')](_0x996d('0x12'),_0x327d3e,'request\x20sent',JSON[_0x996d('0x13')](_0x31694c));if(_0x31694c[_0x996d('0x14')]){if(_0x31694c['error']['code']===0x1f4){logger['error'](_0x996d('0xf'),_0x327d3e,_0x31694c[_0x996d('0x14')]['message']);return _0x344899(_0x31694c[_0x996d('0x14')][_0x996d('0x15')]);}logger['error'](_0x996d('0xf'),_0x327d3e,_0x31694c[_0x996d('0x14')][_0x996d('0x15')]);return _0x40c142(_0x31694c['error'][_0x996d('0x15')]);}else{logger['info'](_0x996d('0xf'),_0x327d3e,_0x996d('0x10'));_0x40c142(_0x31694c[_0x996d('0x16')][_0x996d('0x15')]);}})[_0x996d('0x17')](function(_0x87f980){logger[_0x996d('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x327d3e,_0x87f980);_0x344899(_0x87f980);});});} \ No newline at end of file +var _0xdce7=['request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0xdce7,0x68));var _0x7dce=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xdce7[_0x2bf888];return _0x3038d6;};'use strict';var _=require(_0x7dce('0x0'));var util=require(_0x7dce('0x1'));var moment=require(_0x7dce('0x2'));var BPromise=require(_0x7dce('0x3'));var rs=require(_0x7dce('0x4'));var fs=require('fs');var Redis=require(_0x7dce('0x5'));var db=require(_0x7dce('0x6'))['db'];var utils=require(_0x7dce('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7dce('0x8'));var jayson=require(_0x7dce('0x9'));var client=jayson[_0x7dce('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f8965,_0x544332,_0x468a03){return new BPromise(function(_0x3f5712,_0x2fa2c6){return client[_0x7dce('0xb')](_0x4f8965,_0x468a03)[_0x7dce('0xc')](function(_0x3feb42){logger[_0x7dce('0xd')](_0x7dce('0xe'),_0x544332,'request\x20sent');logger[_0x7dce('0xf')](_0x7dce('0x10'),_0x544332,_0x7dce('0x11'),JSON[_0x7dce('0x12')](_0x3feb42));if(_0x3feb42[_0x7dce('0x13')]){if(_0x3feb42['error']['code']===0x1f4){logger[_0x7dce('0x13')](_0x7dce('0xe'),_0x544332,_0x3feb42[_0x7dce('0x13')][_0x7dce('0x14')]);return _0x2fa2c6(_0x3feb42[_0x7dce('0x13')]['message']);}logger[_0x7dce('0x13')](_0x7dce('0xe'),_0x544332,_0x3feb42[_0x7dce('0x13')]['message']);return _0x3f5712(_0x3feb42['error'][_0x7dce('0x14')]);}else{logger[_0x7dce('0xd')](_0x7dce('0xe'),_0x544332,_0x7dce('0x11'));_0x3f5712(_0x3feb42[_0x7dce('0x15')]['message']);}})[_0x7dce('0x16')](function(_0x552724){logger[_0x7dce('0x13')](_0x7dce('0xe'),_0x544332,_0x552724);_0x2fa2c6(_0x552724);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ccb316a..93915df 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 _0x5f0f=['/:id','show','post','create','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x5bf8e4,_0x1af25c){var _0x2b88e0=function(_0x3dad3d){while(--_0x3dad3d){_0x5bf8e4['push'](_0x5bf8e4['shift']());}};_0x2b88e0(++_0x1af25c);}(_0x5f0f,0xc3));var _0xf5f0=function(_0x14daaf,_0x150d41){_0x14daaf=_0x14daaf-0x0;var _0x51fe45=_0x5f0f[_0x14daaf];return _0x51fe45;};'use strict';var multer=require(_0xf5f0('0x0'));var util=require('util');var path=require(_0xf5f0('0x1'));var timeout=require(_0xf5f0('0x2'));var express=require(_0xf5f0('0x3'));var router=express[_0xf5f0('0x4')]();var fs_extra=require(_0xf5f0('0x5'));var auth=require(_0xf5f0('0x6'));var interaction=require(_0xf5f0('0x7'));var config=require(_0xf5f0('0x8'));var controller=require(_0xf5f0('0x9'));router['get']('/',auth[_0xf5f0('0xa')](),controller[_0xf5f0('0xb')]);router[_0xf5f0('0xc')](_0xf5f0('0xd'),auth[_0xf5f0('0xa')](),controller[_0xf5f0('0xe')]);router[_0xf5f0('0xc')](_0xf5f0('0xf'),auth['isAuthenticated'](),controller[_0xf5f0('0x10')]);router[_0xf5f0('0x11')]('/',auth['isAuthenticated'](),controller[_0xf5f0('0x12')]);router['put'](_0xf5f0('0xf'),auth[_0xf5f0('0xa')](),controller['update']);router['delete'](_0xf5f0('0xf'),auth['isAuthenticated'](),controller[_0xf5f0('0x13')]);module[_0xf5f0('0x14')]=router; \ No newline at end of file +var _0x23b0=['isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe'];(function(_0x426aab,_0xcd8e38){var _0x510f65=function(_0xf2032e){while(--_0xf2032e){_0x426aab['push'](_0x426aab['shift']());}};_0x510f65(++_0xcd8e38);}(_0x23b0,0x180));var _0x023b=function(_0x3a5c01,_0x6dbc92){_0x3a5c01=_0x3a5c01-0x0;var _0x9838d7=_0x23b0[_0x3a5c01];return _0x9838d7;};'use strict';var multer=require(_0x023b('0x0'));var util=require(_0x023b('0x1'));var path=require('path');var timeout=require(_0x023b('0x2'));var express=require('express');var router=express[_0x023b('0x3')]();var fs_extra=require(_0x023b('0x4'));var auth=require(_0x023b('0x5'));var interaction=require(_0x023b('0x6'));var config=require(_0x023b('0x7'));var controller=require(_0x023b('0x8'));router[_0x023b('0x9')]('/',auth['isAuthenticated'](),controller[_0x023b('0xa')]);router['get'](_0x023b('0xb'),auth[_0x023b('0xc')](),controller[_0x023b('0xd')]);router[_0x023b('0x9')]('/:id',auth[_0x023b('0xc')](),controller[_0x023b('0xe')]);router[_0x023b('0xf')]('/',auth['isAuthenticated'](),controller[_0x023b('0x10')]);router[_0x023b('0x11')](_0x023b('0x12'),auth['isAuthenticated'](),controller[_0x023b('0x13')]);router[_0x023b('0x14')](_0x023b('0x12'),auth[_0x023b('0xc')](),controller[_0x023b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0001516..198796f 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 _0x5ec6=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x15716a,_0x3e6958){var _0x548da0=function(_0xc42439){while(--_0xc42439){_0x15716a['push'](_0x15716a['shift']());}};_0x548da0(++_0x3e6958);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5b7c74,_0x4af5ae){_0x5b7c74=_0x5b7c74-0x0;var _0x8c1dd=_0x5ec6[_0x5b7c74];return _0x8c1dd;};'use strict';var Sequelize=require(_0x65ec('0x0'));module[_0x65ec('0x1')]={'name':{'type':Sequelize[_0x65ec('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x65ec('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x65ec('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x33751d){this['setDataValue'](_0x65ec('0x5'),_0x33751d?_0x33751d['join'](''):[]);},'get':function(){return this[_0x65ec('0x6')](_0x65ec('0x5'))?this['getDataValue'](_0x65ec('0x5'))[_0x65ec('0x7')](''):[];}}}; \ No newline at end of file +var _0xbc9d=['sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x107d38,_0x12fc9e){var _0x51397c=function(_0x29b0dc){while(--_0x29b0dc){_0x107d38['push'](_0x107d38['shift']());}};_0x51397c(++_0x12fc9e);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x4c5e48,_0xc065e){_0x4c5e48=_0x4c5e48-0x0;var _0x39e96d=_0xbc9d[_0x4c5e48];return _0x39e96d;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'name':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdbc9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2aba48){this[_0xdbc9('0x4')](_0xdbc9('0x5'),_0x2aba48?_0x2aba48[_0xdbc9('0x6')](''):[]);},'get':function(){return this[_0xdbc9('0x7')](_0xdbc9('0x5'))?this[_0xdbc9('0x7')]('crudPermissions')[_0xdbc9('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index bc08473..93a2978 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 _0x9f49=['order','sort','where','merge','VIRTUAL','filter','options','include','rows','params','fields','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x151ac6,_0x16988d){var _0x34bfd2=function(_0x55a105){while(--_0x55a105){_0x151ac6['push'](_0x151ac6['shift']());}};_0x34bfd2(++_0x16988d);}(_0x9f49,0xa6));var _0x99f4=function(_0x925867,_0x2b426d){_0x925867=_0x925867-0x0;var _0x373455=_0x9f49[_0x925867];return _0x373455;};'use strict';var emlformat=require(_0x99f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99f4('0x1'));var jsonpatch=require(_0x99f4('0x2'));var rp=require(_0x99f4('0x3'));var moment=require(_0x99f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x99f4('0x5'));var util=require(_0x99f4('0x6'));var path=require(_0x99f4('0x7'));var sox=require(_0x99f4('0x8'));var csv=require(_0x99f4('0x9'));var ejs=require(_0x99f4('0xa'));var fs=require('fs');var fs_extra=require(_0x99f4('0xb'));var _=require(_0x99f4('0xc'));var squel=require(_0x99f4('0xd'));var crypto=require(_0x99f4('0xe'));var jsforce=require(_0x99f4('0xf'));var deskjs=require(_0x99f4('0x10'));var toCsv=require(_0x99f4('0x9'));var querystring=require(_0x99f4('0x11'));var Papa=require(_0x99f4('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x99f4('0x13'));var as=require(_0x99f4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99f4('0x15'))(_0x99f4('0x16'));var utils=require('../../config/utils');var config=require(_0x99f4('0x17'));var licenseUtil=require(_0x99f4('0x18'));var db=require(_0x99f4('0x19'))['db'];function respondWithStatusCode(_0x47a9f6,_0x3f957d){_0x3f957d=_0x3f957d||0xcc;return function(_0x34d085){if(_0x34d085){return _0x47a9f6[_0x99f4('0x1a')](_0x3f957d);}return _0x47a9f6[_0x99f4('0x1b')](_0x3f957d)[_0x99f4('0x1c')]();};}function respondWithResult(_0x4d13a9,_0x78383f){_0x78383f=_0x78383f||0xc8;return function(_0x927dfd){if(_0x927dfd){return _0x4d13a9['status'](_0x78383f)[_0x99f4('0x1d')](_0x927dfd);}};}function respondWithFilteredResult(_0x413ec2,_0x3d121c){return function(_0x2c5057){if(_0x2c5057){var _0x1826e8=typeof _0x3d121c['offset']===_0x99f4('0x1e')&&typeof _0x3d121c['limit']===_0x99f4('0x1e');var _0x3104ab=_0x2c5057[_0x99f4('0x1f')];var _0x845ba1=_0x1826e8?0x0:_0x3d121c['offset'];var _0x1a0e94=_0x1826e8?_0x2c5057['count']:_0x3d121c[_0x99f4('0x20')]+_0x3d121c[_0x99f4('0x21')];var _0x2bef07;if(_0x1a0e94>=_0x3104ab){_0x1a0e94=_0x3104ab;_0x2bef07=0xc8;}else{_0x2bef07=0xce;}_0x413ec2[_0x99f4('0x1b')](_0x2bef07);return _0x413ec2[_0x99f4('0x22')](_0x99f4('0x23'),_0x845ba1+'-'+_0x1a0e94+'/'+_0x3104ab)[_0x99f4('0x1d')](_0x2c5057);}return null;};}function patchUpdates(_0x5c1149){return function(_0x5f5000){try{jsonpatch[_0x99f4('0x24')](_0x5f5000,_0x5c1149,!![]);}catch(_0x2f4ed2){return BPromise[_0x99f4('0x25')](_0x2f4ed2);}return _0x5f5000['save']();};}function saveUpdates(_0x11171d,_0x7262eb){return function(_0x272e89){if(_0x272e89){return _0x272e89[_0x99f4('0x26')](_0x11171d)[_0x99f4('0x27')](function(_0x44e26b){return _0x44e26b;});}return null;};}function removeEntity(_0x3e02d8,_0x4d435a){return function(_0x4256e3){if(_0x4256e3){return _0x4256e3[_0x99f4('0x28')]()['then'](function(){_0x3e02d8['status'](0xcc)[_0x99f4('0x1c')]();});}};}function handleEntityNotFound(_0x5e47a8,_0x4e9f98){return function(_0x3a5f03){if(!_0x3a5f03){_0x5e47a8[_0x99f4('0x1a')](0x194);}return _0x3a5f03;};}function handleError(_0x5d0d03,_0x519bd9){_0x519bd9=_0x519bd9||0x1f4;return function(_0x327cbe){logger[_0x99f4('0x29')](_0x327cbe['stack']);if(_0x327cbe[_0x99f4('0x2a')]){delete _0x327cbe[_0x99f4('0x2a')];}_0x5d0d03[_0x99f4('0x1b')](_0x519bd9)[_0x99f4('0x2b')](_0x327cbe);};}exports[_0x99f4('0x2c')]=function(_0x3532ad,_0x3a4df5){var _0x1aeda1={},_0x1beeb7={},_0x4a99ed={'count':0x0,'rows':[]};var _0x2f9302=_[_0x99f4('0x2d')](db[_0x99f4('0x2e')][_0x99f4('0x2f')],function(_0x111f00){return{'name':_0x111f00[_0x99f4('0x30')],'type':_0x111f00[_0x99f4('0x31')][_0x99f4('0x32')]};});_0x1beeb7[_0x99f4('0x33')]=_[_0x99f4('0x2d')](_0x2f9302,_0x99f4('0x2a'));_0x1beeb7[_0x99f4('0x34')]=_[_0x99f4('0x35')](_0x3532ad[_0x99f4('0x34')]);_0x1beeb7[_0x99f4('0x36')]=_[_0x99f4('0x37')](_0x1beeb7[_0x99f4('0x33')],_0x1beeb7[_0x99f4('0x34')]);_0x1aeda1[_0x99f4('0x38')]=_[_0x99f4('0x37')](_0x1beeb7['model'],qs['fields'](_0x3532ad['query']['fields']));_0x1aeda1[_0x99f4('0x38')]=_0x1aeda1[_0x99f4('0x38')][_0x99f4('0x39')]?_0x1aeda1['attributes']:_0x1beeb7[_0x99f4('0x33')];if(!_0x3532ad['query'][_0x99f4('0x3a')]('nolimit')){_0x1aeda1[_0x99f4('0x21')]=qs['limit'](_0x3532ad[_0x99f4('0x34')][_0x99f4('0x21')]);_0x1aeda1[_0x99f4('0x20')]=qs[_0x99f4('0x20')](_0x3532ad['query'][_0x99f4('0x20')]);}_0x1aeda1[_0x99f4('0x3b')]=qs['sort'](_0x3532ad[_0x99f4('0x34')][_0x99f4('0x3c')]);_0x1aeda1[_0x99f4('0x3d')]=qs[_0x99f4('0x36')](_['pick'](_0x3532ad[_0x99f4('0x34')],_0x1beeb7[_0x99f4('0x36')]),_0x2f9302);if(_0x3532ad[_0x99f4('0x34')]['filter']){_0x1aeda1['where']=_[_0x99f4('0x3e')](_0x1aeda1[_0x99f4('0x3d')],{'$or':_['map'](_0x2f9302,function(_0xe53c4d){if(_0xe53c4d[_0x99f4('0x31')]!==_0x99f4('0x3f')){var _0x9ba2b6={};_0x9ba2b6[_0xe53c4d[_0x99f4('0x2a')]]={'$like':'%'+_0x3532ad[_0x99f4('0x34')][_0x99f4('0x40')]+'%'};return _0x9ba2b6;}})});}_0x1aeda1=_[_0x99f4('0x3e')]({},_0x1aeda1,_0x3532ad[_0x99f4('0x41')]);var _0xa75fed={'where':_0x1aeda1[_0x99f4('0x3d')]};return db[_0x99f4('0x2e')][_0x99f4('0x1f')](_0xa75fed)['then'](function(_0x24d8ff){_0x4a99ed[_0x99f4('0x1f')]=_0x24d8ff;if(_0x3532ad[_0x99f4('0x34')]['includeAll']){_0x1aeda1[_0x99f4('0x42')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1aeda1);})[_0x99f4('0x27')](function(_0xb4360a){_0x4a99ed[_0x99f4('0x43')]=_0xb4360a;return _0x4a99ed;})['then'](respondWithFilteredResult(_0x3a4df5,_0x1aeda1))['catch'](handleError(_0x3a4df5,null));};exports['show']=function(_0xde3800,_0x2a587b){var _0x269372={'raw':![],'where':{'id':_0xde3800[_0x99f4('0x44')]['id']}},_0x12a4f5={};_0x12a4f5[_0x99f4('0x33')]=_[_0x99f4('0x35')](db[_0x99f4('0x2e')]['rawAttributes']);_0x12a4f5[_0x99f4('0x34')]=_[_0x99f4('0x35')](_0xde3800['query']);_0x12a4f5[_0x99f4('0x36')]=_[_0x99f4('0x37')](_0x12a4f5['model'],_0x12a4f5[_0x99f4('0x34')]);_0x269372[_0x99f4('0x38')]=_[_0x99f4('0x37')](_0x12a4f5['model'],qs[_0x99f4('0x45')](_0xde3800[_0x99f4('0x34')]['fields']));_0x269372[_0x99f4('0x38')]=_0x269372[_0x99f4('0x38')]['length']?_0x269372['attributes']:_0x12a4f5['model'];if(_0xde3800[_0x99f4('0x34')]['includeAll']){_0x269372[_0x99f4('0x42')]=[{'all':!![]}];}_0x269372=_['merge']({},_0x269372,_0xde3800[_0x99f4('0x41')]);return db[_0x99f4('0x2e')][_0x99f4('0x46')](_0x269372)[_0x99f4('0x27')](handleEntityNotFound(_0x2a587b,null))[_0x99f4('0x27')](respondWithResult(_0x2a587b,null))[_0x99f4('0x47')](handleError(_0x2a587b,null));};exports['create']=function(_0x43f4a7,_0x595c1c){return db[_0x99f4('0x2e')][_0x99f4('0x48')](_0x43f4a7['body'],{})[_0x99f4('0x27')](respondWithResult(_0x595c1c,0xc9))['catch'](handleError(_0x595c1c,null));};exports[_0x99f4('0x26')]=function(_0x1305f5,_0xcfa83f){if(_0x1305f5[_0x99f4('0x49')]['id']){delete _0x1305f5[_0x99f4('0x49')]['id'];}return db[_0x99f4('0x2e')]['find']({'where':{'id':_0x1305f5[_0x99f4('0x44')]['id']}})[_0x99f4('0x27')](handleEntityNotFound(_0xcfa83f,null))[_0x99f4('0x27')](saveUpdates(_0x1305f5[_0x99f4('0x49')],null))[_0x99f4('0x27')](respondWithResult(_0xcfa83f,null))['catch'](handleError(_0xcfa83f,null));};exports[_0x99f4('0x28')]=function(_0x1f17bb,_0x16ab1b){return db[_0x99f4('0x2e')]['find']({'where':{'id':_0x1f17bb['params']['id']}})[_0x99f4('0x27')](handleEntityNotFound(_0x16ab1b,null))[_0x99f4('0x27')](removeEntity(_0x16ab1b,null))['catch'](handleError(_0x16ab1b,null));};exports[_0x99f4('0x4a')]=function(_0x36b040,_0xd9d2bc){return db[_0x99f4('0x2e')][_0x99f4('0x4a')]()['then'](respondWithResult(_0xd9d2bc,null))['catch'](handleError(_0xd9d2bc,null));}; \ No newline at end of file +var _0xdef4=['options','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','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','status','limit','count','offset','set','json','apply','reject','save','update','then','destroy','end','sendStatus','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','nolimit','sort','pick','filter','where','merge'];(function(_0x3aa97b,_0x1db7b8){var _0x37d05e=function(_0x4f3751){while(--_0x4f3751){_0x3aa97b['push'](_0x3aa97b['shift']());}};_0x37d05e(++_0x1db7b8);}(_0xdef4,0x1cb));var _0x4def=function(_0x2de753,_0x4a544d){_0x2de753=_0x2de753-0x0;var _0x8e70a5=_0xdef4[_0x2de753];return _0x8e70a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4def('0x0'));var zipdir=require(_0x4def('0x1'));var jsonpatch=require(_0x4def('0x2'));var rp=require(_0x4def('0x3'));var moment=require(_0x4def('0x4'));var BPromise=require(_0x4def('0x5'));var Mustache=require(_0x4def('0x6'));var util=require(_0x4def('0x7'));var path=require('path');var sox=require(_0x4def('0x8'));var csv=require(_0x4def('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4def('0xa'));var _=require('lodash');var squel=require(_0x4def('0xb'));var crypto=require(_0x4def('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4def('0xd'));var toCsv=require(_0x4def('0x9'));var querystring=require(_0x4def('0xe'));var Papa=require(_0x4def('0xf'));var Redis=require(_0x4def('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4def('0x11'));var as=require(_0x4def('0x12'));var hardwareService=require(_0x4def('0x13'));var logger=require(_0x4def('0x14'))(_0x4def('0x15'));var utils=require(_0x4def('0x16'));var config=require(_0x4def('0x17'));var licenseUtil=require(_0x4def('0x18'));var db=require(_0x4def('0x19'))['db'];function respondWithStatusCode(_0x4e0603,_0x129559){_0x129559=_0x129559||0xcc;return function(_0x3abff4){if(_0x3abff4){return _0x4e0603['sendStatus'](_0x129559);}return _0x4e0603['status'](_0x129559)['end']();};}function respondWithResult(_0x51c297,_0x29cee1){_0x29cee1=_0x29cee1||0xc8;return function(_0x340c98){if(_0x340c98){return _0x51c297[_0x4def('0x1a')](_0x29cee1)['json'](_0x340c98);}};}function respondWithFilteredResult(_0x39df23,_0x163d5d){return function(_0x5a7e36){if(_0x5a7e36){var _0x2854a9=typeof _0x163d5d['offset']==='undefined'&&typeof _0x163d5d[_0x4def('0x1b')]==='undefined';var _0x26fec7=_0x5a7e36[_0x4def('0x1c')];var _0xf7ef84=_0x2854a9?0x0:_0x163d5d[_0x4def('0x1d')];var _0x53767f=_0x2854a9?_0x5a7e36[_0x4def('0x1c')]:_0x163d5d[_0x4def('0x1d')]+_0x163d5d['limit'];var _0x24063f;if(_0x53767f>=_0x26fec7){_0x53767f=_0x26fec7;_0x24063f=0xc8;}else{_0x24063f=0xce;}_0x39df23[_0x4def('0x1a')](_0x24063f);return _0x39df23[_0x4def('0x1e')]('Content-Range',_0xf7ef84+'-'+_0x53767f+'/'+_0x26fec7)[_0x4def('0x1f')](_0x5a7e36);}return null;};}function patchUpdates(_0x1d7b35){return function(_0x109e57){try{jsonpatch[_0x4def('0x20')](_0x109e57,_0x1d7b35,!![]);}catch(_0x32ee90){return BPromise[_0x4def('0x21')](_0x32ee90);}return _0x109e57[_0x4def('0x22')]();};}function saveUpdates(_0x5d632a,_0x2790f5){return function(_0x5dccc5){if(_0x5dccc5){return _0x5dccc5[_0x4def('0x23')](_0x5d632a)[_0x4def('0x24')](function(_0x28fcbb){return _0x28fcbb;});}return null;};}function removeEntity(_0x56d5f7,_0x5b612f){return function(_0x2436d9){if(_0x2436d9){return _0x2436d9[_0x4def('0x25')]()[_0x4def('0x24')](function(){_0x56d5f7['status'](0xcc)[_0x4def('0x26')]();});}};}function handleEntityNotFound(_0x2d8ebf,_0x548d9c){return function(_0x44ed1f){if(!_0x44ed1f){_0x2d8ebf[_0x4def('0x27')](0x194);}return _0x44ed1f;};}function handleError(_0xc15f26,_0x29ff5a){_0x29ff5a=_0x29ff5a||0x1f4;return function(_0x414ad9){logger['error'](_0x414ad9['stack']);if(_0x414ad9[_0x4def('0x28')]){delete _0x414ad9[_0x4def('0x28')];}_0xc15f26[_0x4def('0x1a')](_0x29ff5a)[_0x4def('0x29')](_0x414ad9);};}exports[_0x4def('0x2a')]=function(_0x40ebd1,_0x20e056){var _0x530119={},_0x3e00f9={},_0x4df660={'count':0x0,'rows':[]};var _0x2ff784=_[_0x4def('0x2b')](db['UserProfileSection'][_0x4def('0x2c')],function(_0x416c9c){return{'name':_0x416c9c[_0x4def('0x2d')],'type':_0x416c9c[_0x4def('0x2e')]['key']};});_0x3e00f9[_0x4def('0x2f')]=_['map'](_0x2ff784,_0x4def('0x28'));_0x3e00f9[_0x4def('0x30')]=_[_0x4def('0x31')](_0x40ebd1[_0x4def('0x30')]);_0x3e00f9[_0x4def('0x32')]=_[_0x4def('0x33')](_0x3e00f9[_0x4def('0x2f')],_0x3e00f9[_0x4def('0x30')]);_0x530119['attributes']=_[_0x4def('0x33')](_0x3e00f9[_0x4def('0x2f')],qs['fields'](_0x40ebd1[_0x4def('0x30')]['fields']));_0x530119[_0x4def('0x34')]=_0x530119[_0x4def('0x34')]['length']?_0x530119[_0x4def('0x34')]:_0x3e00f9[_0x4def('0x2f')];if(!_0x40ebd1['query']['hasOwnProperty'](_0x4def('0x35'))){_0x530119[_0x4def('0x1b')]=qs['limit'](_0x40ebd1[_0x4def('0x30')][_0x4def('0x1b')]);_0x530119[_0x4def('0x1d')]=qs[_0x4def('0x1d')](_0x40ebd1[_0x4def('0x30')][_0x4def('0x1d')]);}_0x530119['order']=qs[_0x4def('0x36')](_0x40ebd1[_0x4def('0x30')]['sort']);_0x530119['where']=qs[_0x4def('0x32')](_[_0x4def('0x37')](_0x40ebd1[_0x4def('0x30')],_0x3e00f9[_0x4def('0x32')]),_0x2ff784);if(_0x40ebd1['query'][_0x4def('0x38')]){_0x530119[_0x4def('0x39')]=_['merge'](_0x530119[_0x4def('0x39')],{'$or':_[_0x4def('0x2b')](_0x2ff784,function(_0x1b1b18){if(_0x1b1b18[_0x4def('0x2e')]!=='VIRTUAL'){var _0x4d4154={};_0x4d4154[_0x1b1b18[_0x4def('0x28')]]={'$like':'%'+_0x40ebd1['query'][_0x4def('0x38')]+'%'};return _0x4d4154;}})});}_0x530119=_[_0x4def('0x3a')]({},_0x530119,_0x40ebd1[_0x4def('0x3b')]);var _0x11c98a={'where':_0x530119['where']};return db[_0x4def('0x3c')][_0x4def('0x1c')](_0x11c98a)['then'](function(_0x376808){_0x4df660[_0x4def('0x1c')]=_0x376808;if(_0x40ebd1[_0x4def('0x30')][_0x4def('0x3d')]){_0x530119[_0x4def('0x3e')]=[{'all':!![]}];}return db[_0x4def('0x3c')][_0x4def('0x3f')](_0x530119);})[_0x4def('0x24')](function(_0x5c9233){_0x4df660[_0x4def('0x40')]=_0x5c9233;return _0x4df660;})[_0x4def('0x24')](respondWithFilteredResult(_0x20e056,_0x530119))[_0x4def('0x41')](handleError(_0x20e056,null));};exports[_0x4def('0x42')]=function(_0x33f21d,_0x41ec59){var _0x3c7e4f={'raw':![],'where':{'id':_0x33f21d[_0x4def('0x43')]['id']}},_0x51a79f={};_0x51a79f['model']=_[_0x4def('0x31')](db[_0x4def('0x3c')][_0x4def('0x2c')]);_0x51a79f[_0x4def('0x30')]=_[_0x4def('0x31')](_0x33f21d['query']);_0x51a79f[_0x4def('0x32')]=_['intersection'](_0x51a79f[_0x4def('0x2f')],_0x51a79f[_0x4def('0x30')]);_0x3c7e4f['attributes']=_[_0x4def('0x33')](_0x51a79f[_0x4def('0x2f')],qs[_0x4def('0x44')](_0x33f21d[_0x4def('0x30')][_0x4def('0x44')]));_0x3c7e4f[_0x4def('0x34')]=_0x3c7e4f['attributes'][_0x4def('0x45')]?_0x3c7e4f[_0x4def('0x34')]:_0x51a79f[_0x4def('0x2f')];if(_0x33f21d[_0x4def('0x30')]['includeAll']){_0x3c7e4f[_0x4def('0x3e')]=[{'all':!![]}];}_0x3c7e4f=_[_0x4def('0x3a')]({},_0x3c7e4f,_0x33f21d['options']);return db[_0x4def('0x3c')][_0x4def('0x46')](_0x3c7e4f)[_0x4def('0x24')](handleEntityNotFound(_0x41ec59,null))[_0x4def('0x24')](respondWithResult(_0x41ec59,null))['catch'](handleError(_0x41ec59,null));};exports[_0x4def('0x47')]=function(_0x237f87,_0x2f22c3){return db[_0x4def('0x3c')][_0x4def('0x47')](_0x237f87[_0x4def('0x48')],{})[_0x4def('0x24')](respondWithResult(_0x2f22c3,0xc9))[_0x4def('0x41')](handleError(_0x2f22c3,null));};exports['update']=function(_0x26c73c,_0x3f5634){if(_0x26c73c[_0x4def('0x48')]['id']){delete _0x26c73c[_0x4def('0x48')]['id'];}return db[_0x4def('0x3c')][_0x4def('0x46')]({'where':{'id':_0x26c73c[_0x4def('0x43')]['id']}})[_0x4def('0x24')](handleEntityNotFound(_0x3f5634,null))[_0x4def('0x24')](saveUpdates(_0x26c73c['body'],null))[_0x4def('0x24')](respondWithResult(_0x3f5634,null))[_0x4def('0x41')](handleError(_0x3f5634,null));};exports[_0x4def('0x25')]=function(_0x24c931,_0x39e1e5){return db[_0x4def('0x3c')][_0x4def('0x46')]({'where':{'id':_0x24c931['params']['id']}})[_0x4def('0x24')](handleEntityNotFound(_0x39e1e5,null))[_0x4def('0x24')](removeEntity(_0x39e1e5,null))[_0x4def('0x41')](handleError(_0x39e1e5,null));};exports[_0x4def('0x49')]=function(_0x52e955,_0x48cb43){return db[_0x4def('0x3c')]['describe']()[_0x4def('0x24')](respondWithResult(_0x48cb43,null))['catch'](handleError(_0x48cb43,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 19b3373..641a310 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 _0xb648=['rimraf','../../config/environment','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x542c50,_0x56473f){var _0x11384f=function(_0x403418){while(--_0x403418){_0x542c50['push'](_0x542c50['shift']());}};_0x11384f(++_0x56473f);}(_0xb648,0xfe));var _0x8b64=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0xb648[_0x2b0a86];return _0x955940;};'use strict';var _=require('lodash');var util=require(_0x8b64('0x0'));var logger=require(_0x8b64('0x1'))(_0x8b64('0x2'));var moment=require(_0x8b64('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b64('0x4'));var fs=require('fs');var path=require(_0x8b64('0x5'));var rimraf=require(_0x8b64('0x6'));var config=require(_0x8b64('0x7'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x59cb25,_0x55f229){return _0x59cb25[_0x8b64('0x8')](_0x8b64('0x9'),attributes,{'tableName':_0x8b64('0xa'),'paranoid':![],'indexes':[{'name':_0x8b64('0xb'),'fields':[_0x8b64('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d7a=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6d7a,0xd9));var _0xa6d7=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x6d7a[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xa6d7('0x0'));var util=require(_0xa6d7('0x1'));var logger=require(_0xa6d7('0x2'))(_0xa6d7('0x3'));var moment=require(_0xa6d7('0x4'));var BPromise=require('bluebird');var rp=require(_0xa6d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6d7('0x6'));var config=require(_0xa6d7('0x7'));var attributes=require(_0xa6d7('0x8'));module[_0xa6d7('0x9')]=function(_0x214625,_0x25daa2){return _0x214625[_0xa6d7('0xa')](_0xa6d7('0xb'),attributes,{'tableName':_0xa6d7('0xc'),'paranoid':![],'indexes':[{'name':_0xa6d7('0xd'),'fields':['sectionId',_0xa6d7('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 72fb3fb..cef005e 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 _0x3c21=['../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x147c96,_0x309657){var _0x4ec711=function(_0x3cf7c9){while(--_0x3cf7c9){_0x147c96['push'](_0x147c96['shift']());}};_0x4ec711(++_0x309657);}(_0x3c21,0x19e));var _0x13c2=function(_0x3b6138,_0x11c13b){_0x3b6138=_0x3b6138-0x0;var _0x1b2023=_0x3c21[_0x3b6138];return _0x1b2023;};'use strict';var _=require('lodash');var util=require(_0x13c2('0x0'));var moment=require('moment');var BPromise=require(_0x13c2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c2('0x2'));var db=require(_0x13c2('0x3'))['db'];var utils=require(_0x13c2('0x4'));var logger=require(_0x13c2('0x5'))('rpc');var config=require(_0x13c2('0x6'));var jayson=require(_0x13c2('0x7'));var client=jayson[_0x13c2('0x8')][_0x13c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc30c80,_0x8f69,_0x31a3c9){return new BPromise(function(_0x45e9b2,_0x185f44){return client[_0x13c2('0xa')](_0xc30c80,_0x31a3c9)[_0x13c2('0xb')](function(_0x4330d0){logger[_0x13c2('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x8f69,'request\x20sent');logger[_0x13c2('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x8f69,_0x13c2('0xe'),JSON['stringify'](_0x4330d0));if(_0x4330d0[_0x13c2('0xf')]){if(_0x4330d0[_0x13c2('0xf')][_0x13c2('0x10')]===0x1f4){logger[_0x13c2('0xf')](_0x13c2('0x11'),_0x8f69,_0x4330d0[_0x13c2('0xf')][_0x13c2('0x12')]);return _0x185f44(_0x4330d0[_0x13c2('0xf')][_0x13c2('0x12')]);}logger[_0x13c2('0xf')](_0x13c2('0x11'),_0x8f69,_0x4330d0['error'][_0x13c2('0x12')]);return _0x45e9b2(_0x4330d0['error'][_0x13c2('0x12')]);}else{logger[_0x13c2('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x8f69,_0x13c2('0xe'));_0x45e9b2(_0x4330d0[_0x13c2('0x13')]['message']);}})[_0x13c2('0x14')](function(_0x506737){logger[_0x13c2('0xf')](_0x13c2('0x11'),_0x8f69,_0x506737);_0x185f44(_0x506737);});});} \ No newline at end of file +var _0x956c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x397c86,_0x24edb8){var _0x5c40c5=function(_0x3c92a3){while(--_0x3c92a3){_0x397c86['push'](_0x397c86['shift']());}};_0x5c40c5(++_0x24edb8);}(_0x956c,0xe2));var _0xc956=function(_0x30b188,_0x660d3b){_0x30b188=_0x30b188-0x0;var _0x5c382b=_0x956c[_0x30b188];return _0x5c382b;};'use strict';var _=require(_0xc956('0x0'));var util=require(_0xc956('0x1'));var moment=require(_0xc956('0x2'));var BPromise=require(_0xc956('0x3'));var rs=require(_0xc956('0x4'));var fs=require('fs');var Redis=require(_0xc956('0x5'));var db=require(_0xc956('0x6'))['db'];var utils=require(_0xc956('0x7'));var logger=require(_0xc956('0x8'))('rpc');var config=require(_0xc956('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc956('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5128e9,_0x5b7cce,_0x53b61f){return new BPromise(function(_0x399c3d,_0x1ba43e){return client[_0xc956('0xb')](_0x5128e9,_0x53b61f)['then'](function(_0x18f24d){logger['info'](_0xc956('0xc'),_0x5b7cce,_0xc956('0xd'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5b7cce,_0xc956('0xd'),JSON[_0xc956('0xe')](_0x18f24d));if(_0x18f24d['error']){if(_0x18f24d[_0xc956('0xf')][_0xc956('0x10')]===0x1f4){logger['error'](_0xc956('0xc'),_0x5b7cce,_0x18f24d[_0xc956('0xf')][_0xc956('0x11')]);return _0x1ba43e(_0x18f24d['error'][_0xc956('0x11')]);}logger[_0xc956('0xf')](_0xc956('0xc'),_0x5b7cce,_0x18f24d['error'][_0xc956('0x11')]);return _0x399c3d(_0x18f24d['error'][_0xc956('0x11')]);}else{logger[_0xc956('0x12')](_0xc956('0xc'),_0x5b7cce,_0xc956('0xd'));_0x399c3d(_0x18f24d[_0xc956('0x13')][_0xc956('0x11')]);}})[_0xc956('0x14')](function(_0x271b6c){logger['error'](_0xc956('0xc'),_0x5b7cce,_0x271b6c);_0x1ba43e(_0x271b6c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a7a8152..9e0b090 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x516bdc,_0xd206c1){var _0x1badb5=function(_0xea4285){while(--_0xea4285){_0x516bdc['push'](_0x516bdc['shift']());}};_0x1badb5(++_0xd206c1);}(_0xe706,0xa3));var _0x6e70=function(_0x568427,_0x742280){_0x568427=_0x568427-0x0;var _0x3c2f86=_0xe706[_0x568427];return _0x3c2f86;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x45d809,_0x379b71){var _0x1fdd72=function(_0x57c7c5){while(--_0x57c7c5){_0x45d809['push'](_0x45d809['shift']());}};_0x1fdd72(++_0x379b71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 94e1eeb..20b3941 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 _0x3bd0=['sequelize','exports','INTEGER'];(function(_0x4594e2,_0x25da51){var _0x4be202=function(_0x2ca967){while(--_0x2ca967){_0x4594e2['push'](_0x4594e2['shift']());}};_0x4be202(++_0x25da51);}(_0x3bd0,0x93));var _0x03bd=function(_0x5448a9,_0x4764da){_0x5448a9=_0x5448a9-0x0;var _0x1924af=_0x3bd0[_0x5448a9];return _0x1924af;};'use strict';var Sequelize=require(_0x03bd('0x0'));module[_0x03bd('0x1')]={'penalty':{'type':Sequelize[_0x03bd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc684=['sequelize','INTEGER'];(function(_0x1cebed,_0x184870){var _0x181235=function(_0x5b1109){while(--_0x5b1109){_0x1cebed['push'](_0x1cebed['shift']());}};_0x181235(++_0x184870);}(_0xc684,0x106));var _0x4c68=function(_0x2477e7,_0x386f4f){_0x2477e7=_0x2477e7-0x0;var _0x4883d7=_0xc684[_0x2477e7];return _0x4883d7;};'use strict';var Sequelize=require(_0x4c68('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4c68('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 2dc6133..90cf643 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 _0xb46f=['request-promise','path','../../config/environment','exports','define','UserSmsQueue','lodash','util','api','moment','bluebird'];(function(_0x55f63a,_0x4c01c5){var _0x309b61=function(_0x5071f4){while(--_0x5071f4){_0x55f63a['push'](_0x55f63a['shift']());}};_0x309b61(++_0x4c01c5);}(_0xb46f,0xb6));var _0xfb46=function(_0x3ba40d,_0x463b68){_0x3ba40d=_0x3ba40d-0x0;var _0x190bf6=_0xb46f[_0x3ba40d];return _0x190bf6;};'use strict';var _=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var logger=require('../../config/logger')(_0xfb46('0x2'));var moment=require(_0xfb46('0x3'));var BPromise=require(_0xfb46('0x4'));var rp=require(_0xfb46('0x5'));var fs=require('fs');var path=require(_0xfb46('0x6'));var rimraf=require('rimraf');var config=require(_0xfb46('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xfb46('0x8')]=function(_0x3a5255,_0x186da6){return _0x3a5255[_0xfb46('0x9')](_0xfb46('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b0d=['define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5e4ef0,_0x25d300){var _0x1e46c8=function(_0x50d706){while(--_0x50d706){_0x5e4ef0['push'](_0x5e4ef0['shift']());}};_0x1e46c8(++_0x25d300);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x28649e,_0x36c6bf){_0x28649e=_0x28649e-0x0;var _0x321334=_0x9b0d[_0x28649e];return _0x321334;};'use strict';var _=require('lodash');var util=require(_0xd9b0('0x0'));var logger=require(_0xd9b0('0x1'))(_0xd9b0('0x2'));var moment=require(_0xd9b0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9b0('0x4'));var fs=require('fs');var path=require(_0xd9b0('0x5'));var rimraf=require(_0xd9b0('0x6'));var config=require(_0xd9b0('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xd9b0('0x8')]=function(_0x21798d,_0x41dad9){return _0x21798d[_0xd9b0('0x9')](_0xd9b0('0xa'),attributes,{'tableName':_0xd9b0('0xb'),'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 45c6578..6273a8a 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 _0x0dee=['request','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','http'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x0dee,0x14d));var _0xe0de=function(_0x539189,_0xb74691){_0x539189=_0x539189-0x0;var _0x2a838a=_0x0dee[_0x539189];return _0x2a838a;};'use strict';var _=require(_0xe0de('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe0de('0x1'));var rs=require(_0xe0de('0x2'));var fs=require('fs');var Redis=require(_0xe0de('0x3'));var db=require(_0xe0de('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe0de('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe0de('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3e6dbd,_0x4c0661,_0x1abc6b){return new BPromise(function(_0x3b7a15,_0x4ac065){return client[_0xe0de('0x7')](_0x3e6dbd,_0x1abc6b)['then'](function(_0x2a908a){logger['info'](_0xe0de('0x8'),_0x4c0661,'request\x20sent');logger[_0xe0de('0x9')](_0xe0de('0xa'),_0x4c0661,_0xe0de('0xb'),JSON[_0xe0de('0xc')](_0x2a908a));if(_0x2a908a[_0xe0de('0xd')]){if(_0x2a908a[_0xe0de('0xd')][_0xe0de('0xe')]===0x1f4){logger[_0xe0de('0xd')](_0xe0de('0x8'),_0x4c0661,_0x2a908a[_0xe0de('0xd')][_0xe0de('0xf')]);return _0x4ac065(_0x2a908a[_0xe0de('0xd')]['message']);}logger['error'](_0xe0de('0x8'),_0x4c0661,_0x2a908a['error']['message']);return _0x3b7a15(_0x2a908a[_0xe0de('0xd')][_0xe0de('0xf')]);}else{logger[_0xe0de('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x4c0661,'request\x20sent');_0x3b7a15(_0x2a908a['result'][_0xe0de('0xf')]);}})['catch'](function(_0x3d04bb){logger['error'](_0xe0de('0x8'),_0x4c0661,_0x3d04bb);_0x4ac065(_0x3d04bb);});});} \ No newline at end of file +var _0x09e0=['error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x26a680,_0x2661e0){var _0x5d6490=function(_0x20647c){while(--_0x20647c){_0x26a680['push'](_0x26a680['shift']());}};_0x5d6490(++_0x2661e0);}(_0x09e0,0x16e));var _0x009e=function(_0x158965,_0x117f97){_0x158965=_0x158965-0x0;var _0x3a3e9d=_0x09e0[_0x158965];return _0x3a3e9d;};'use strict';var _=require(_0x009e('0x0'));var util=require(_0x009e('0x1'));var moment=require(_0x009e('0x2'));var BPromise=require('bluebird');var rs=require(_0x009e('0x3'));var fs=require('fs');var Redis=require(_0x009e('0x4'));var db=require(_0x009e('0x5'))['db'];var utils=require(_0x009e('0x6'));var logger=require('../../config/logger')(_0x009e('0x7'));var config=require('../../config/environment');var jayson=require(_0x009e('0x8'));var client=jayson[_0x009e('0x9')][_0x009e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cfd10,_0x6f73fe,_0x162336){return new BPromise(function(_0x23bed0,_0x60c085){return client[_0x009e('0xb')](_0x4cfd10,_0x162336)[_0x009e('0xc')](function(_0x4dd3b9){logger[_0x009e('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x6f73fe,_0x009e('0xe'));logger[_0x009e('0xf')](_0x009e('0x10'),_0x6f73fe,_0x009e('0xe'),JSON[_0x009e('0x11')](_0x4dd3b9));if(_0x4dd3b9[_0x009e('0x12')]){if(_0x4dd3b9[_0x009e('0x12')][_0x009e('0x13')]===0x1f4){logger[_0x009e('0x12')](_0x009e('0x14'),_0x6f73fe,_0x4dd3b9['error']['message']);return _0x60c085(_0x4dd3b9['error']['message']);}logger['error'](_0x009e('0x14'),_0x6f73fe,_0x4dd3b9[_0x009e('0x12')][_0x009e('0x15')]);return _0x23bed0(_0x4dd3b9[_0x009e('0x12')][_0x009e('0x15')]);}else{logger[_0x009e('0xd')](_0x009e('0x14'),_0x6f73fe,_0x009e('0xe'));_0x23bed0(_0x4dd3b9[_0x009e('0x16')][_0x009e('0x15')]);}})[_0x009e('0x17')](function(_0x3c100c){logger[_0x009e('0x12')](_0x009e('0x14'),_0x6f73fe,_0x3c100c);_0x60c085(_0x3c100c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 752fe2a..276d2aa 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 _0x3bdd=['exports','INTEGER'];(function(_0x18019b,_0xe69829){var _0x3d0490=function(_0x3bec33){while(--_0x3bec33){_0x18019b['push'](_0x18019b['shift']());}};_0x3d0490(++_0xe69829);}(_0x3bdd,0x150));var _0xd3bd=function(_0x157c49,_0x465662){_0x157c49=_0x157c49-0x0;var _0x58cc81=_0x3bdd[_0x157c49];return _0x58cc81;};'use strict';var Sequelize=require('sequelize');module[_0xd3bd('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xd3bd('0x1')]}}; \ No newline at end of file +var _0x4e4f=['exports','sequelize'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x4e4f,0xbd));var _0xf4e4=function(_0x1153cc,_0x38ba57){_0x1153cc=_0x1153cc-0x0;var _0x373613=_0x4e4f[_0x1153cc];return _0x373613;};'use strict';var Sequelize=require(_0xf4e4('0x0'));module[_0xf4e4('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 88eb9e6..545e4cb 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(_0x11b752,_0x145001){var _0x2992d7=function(_0x42c99d){while(--_0x42c99d){_0x11b752['push'](_0x11b752['shift']());}};_0x2992d7(++_0x145001);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x27a621,_0x2fe127){var _0x1cd457=function(_0x14dfc6){while(--_0x14dfc6){_0x27a621['push'](_0x27a621['shift']());}};_0x1cd457(++_0x2fe127);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 357ef02..6b2b8df 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5ec25b,_0x1ff58e){var _0x4fe26f=function(_0x3997cf){while(--_0x3997cf){_0x5ec25b['push'](_0x5ec25b['shift']());}};_0x4fe26f(++_0x1ff58e);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x213e3a,_0x2adf8a){var _0x1f5253=function(_0x52c19f){while(--_0x52c19f){_0x213e3a['push'](_0x213e3a['shift']());}};_0x1f5253(++_0x2adf8a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0xcb91[_0xaf025d];return _0x1c77cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 425ab7c..86924c3 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 _0x38c1=['INTEGER','exports'];(function(_0x15eb7d,_0x1b1a10){var _0x459262=function(_0x2bf3cb){while(--_0x2bf3cb){_0x15eb7d['push'](_0x15eb7d['shift']());}};_0x459262(++_0x1b1a10);}(_0x38c1,0x77));var _0x138c=function(_0x21bfc8,_0x2a67d2){_0x21bfc8=_0x21bfc8-0x0;var _0x2029c0=_0x38c1[_0x21bfc8];return _0x2029c0;};'use strict';var Sequelize=require('sequelize');module[_0x138c('0x0')]={'penalty':{'type':Sequelize[_0x138c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe57c=['exports','sequelize'];(function(_0x21940d,_0x2209da){var _0x22d948=function(_0x53ee6d){while(--_0x53ee6d){_0x21940d['push'](_0x21940d['shift']());}};_0x22d948(++_0x2209da);}(_0xe57c,0xeb));var _0xce57=function(_0x2d7e49,_0xa9c5d2){_0x2d7e49=_0x2d7e49-0x0;var _0x259d84=_0xe57c[_0x2d7e49];return _0x259d84;};'use strict';var Sequelize=require(_0xce57('0x0'));module[_0xce57('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 2f90e5c..5041467 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 _0x0e75=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','request-promise'];(function(_0x470b62,_0x18977d){var _0x5e9a24=function(_0x23bc09){while(--_0x23bc09){_0x470b62['push'](_0x470b62['shift']());}};_0x5e9a24(++_0x18977d);}(_0x0e75,0x94));var _0x50e7=function(_0x2ad04c,_0x242b88){_0x2ad04c=_0x2ad04c-0x0;var _0x4164a8=_0x0e75[_0x2ad04c];return _0x4164a8;};'use strict';var _=require(_0x50e7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x50e7('0x1'));var fs=require('fs');var path=require(_0x50e7('0x2'));var rimraf=require(_0x50e7('0x3'));var config=require(_0x50e7('0x4'));var attributes=require(_0x50e7('0x5'));module[_0x50e7('0x6')]=function(_0x1f911b,_0x4625a3){return _0x1f911b[_0x50e7('0x7')](_0x50e7('0x8'),attributes,{'tableName':_0x50e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d67=['exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d67,0x85));var _0x77d6=function(_0x245fc9,_0x1d3d53){_0x245fc9=_0x245fc9-0x0;var _0x1e3bef=_0x7d67[_0x245fc9];return _0x1e3bef;};'use strict';var _=require(_0x77d6('0x0'));var util=require(_0x77d6('0x1'));var logger=require(_0x77d6('0x2'))(_0x77d6('0x3'));var moment=require(_0x77d6('0x4'));var BPromise=require(_0x77d6('0x5'));var rp=require(_0x77d6('0x6'));var fs=require('fs');var path=require(_0x77d6('0x7'));var rimraf=require(_0x77d6('0x8'));var config=require('../../config/environment');var attributes=require(_0x77d6('0x9'));module[_0x77d6('0xa')]=function(_0x3a0dfb,_0x76c340){return _0x3a0dfb[_0x77d6('0xb')](_0x77d6('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index fb3f2a6..030671a 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 _0x499e=['code','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xb697c7,_0x42d121){var _0x308f6e=function(_0xcb724f){while(--_0xcb724f){_0xb697c7['push'](_0xb697c7['shift']());}};_0x308f6e(++_0x42d121);}(_0x499e,0x1e9));var _0xe499=function(_0x4991f0,_0x5c2269){_0x4991f0=_0x4991f0-0x0;var _0x36fc25=_0x499e[_0x4991f0];return _0x36fc25;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe499('0x0'));var BPromise=require('bluebird');var rs=require(_0xe499('0x1'));var fs=require('fs');var Redis=require(_0xe499('0x2'));var db=require(_0xe499('0x3'))['db'];var utils=require(_0xe499('0x4'));var logger=require(_0xe499('0x5'))(_0xe499('0x6'));var config=require(_0xe499('0x7'));var jayson=require(_0xe499('0x8'));var client=jayson['client'][_0xe499('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10c4c0,_0x1fd207,_0x29b690){return new BPromise(function(_0x3e7080,_0x32b64d){return client[_0xe499('0xa')](_0x10c4c0,_0x29b690)[_0xe499('0xb')](function(_0x66eeb7){logger['info'](_0xe499('0xc'),_0x1fd207,_0xe499('0xd'));logger[_0xe499('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1fd207,_0xe499('0xd'),JSON[_0xe499('0xf')](_0x66eeb7));if(_0x66eeb7['error']){if(_0x66eeb7[_0xe499('0x10')][_0xe499('0x11')]===0x1f4){logger['error'](_0xe499('0xc'),_0x1fd207,_0x66eeb7['error'][_0xe499('0x12')]);return _0x32b64d(_0x66eeb7[_0xe499('0x10')][_0xe499('0x12')]);}logger[_0xe499('0x10')](_0xe499('0xc'),_0x1fd207,_0x66eeb7[_0xe499('0x10')][_0xe499('0x12')]);return _0x3e7080(_0x66eeb7['error'][_0xe499('0x12')]);}else{logger[_0xe499('0x13')](_0xe499('0xc'),_0x1fd207,_0xe499('0xd'));_0x3e7080(_0x66eeb7[_0xe499('0x14')][_0xe499('0x12')]);}})[_0xe499('0x15')](function(_0xbd80c0){logger[_0xe499('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x1fd207,_0xbd80c0);_0x32b64d(_0xbd80c0);});});} \ No newline at end of file +var _0x94c1=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x43b5c3,_0xf806f7){var _0x2827be=function(_0x2d90e3){while(--_0x2d90e3){_0x43b5c3['push'](_0x43b5c3['shift']());}};_0x2827be(++_0xf806f7);}(_0x94c1,0x18f));var _0x194c=function(_0x339f08,_0x5892dd){_0x339f08=_0x339f08-0x0;var _0x14b96d=_0x94c1[_0x339f08];return _0x14b96d;};'use strict';var _=require('lodash');var util=require(_0x194c('0x0'));var moment=require(_0x194c('0x1'));var BPromise=require(_0x194c('0x2'));var rs=require(_0x194c('0x3'));var fs=require('fs');var Redis=require(_0x194c('0x4'));var db=require(_0x194c('0x5'))['db'];var utils=require(_0x194c('0x6'));var logger=require(_0x194c('0x7'))(_0x194c('0x8'));var config=require(_0x194c('0x9'));var jayson=require(_0x194c('0xa'));var client=jayson[_0x194c('0xb')][_0x194c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x276a2b,_0x5bf144,_0x38a8ed){return new BPromise(function(_0x3b8f95,_0x54ac14){return client[_0x194c('0xd')](_0x276a2b,_0x38a8ed)[_0x194c('0xe')](function(_0x1e7090){logger[_0x194c('0xf')](_0x194c('0x10'),_0x5bf144,_0x194c('0x11'));logger[_0x194c('0x12')](_0x194c('0x13'),_0x5bf144,_0x194c('0x11'),JSON[_0x194c('0x14')](_0x1e7090));if(_0x1e7090[_0x194c('0x15')]){if(_0x1e7090[_0x194c('0x15')][_0x194c('0x16')]===0x1f4){logger[_0x194c('0x15')](_0x194c('0x10'),_0x5bf144,_0x1e7090[_0x194c('0x15')]['message']);return _0x54ac14(_0x1e7090[_0x194c('0x15')]['message']);}logger[_0x194c('0x15')](_0x194c('0x10'),_0x5bf144,_0x1e7090['error']['message']);return _0x3b8f95(_0x1e7090[_0x194c('0x15')][_0x194c('0x17')]);}else{logger[_0x194c('0xf')](_0x194c('0x10'),_0x5bf144,_0x194c('0x11'));_0x3b8f95(_0x1e7090[_0x194c('0x18')][_0x194c('0x17')]);}})[_0x194c('0x19')](function(_0x4d3aed){logger['error'](_0x194c('0x10'),_0x5bf144,_0x4d3aed);_0x54ac14(_0x4d3aed);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e13d31a..6a6e7ad 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x521a45,_0x5734bd){var _0x25dfa4=function(_0x4bc47f){while(--_0x4bc47f){_0x521a45['push'](_0x521a45['shift']());}};_0x25dfa4(++_0x5734bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x36ed80,_0x102296){var _0x418c68=function(_0x2a91fc){while(--_0x2a91fc){_0x36ed80['push'](_0x36ed80['shift']());}};_0x418c68(++_0x102296);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 3239512..198985c 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 _0x4713=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x4b0c15,_0x47e272){var _0x5a3bcf=function(_0x5cfb9f){while(--_0x5cfb9f){_0x4b0c15['push'](_0x4b0c15['shift']());}};_0x5a3bcf(++_0x47e272);}(_0x4713,0x18d));var _0x3471=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x4713[_0x350182];return _0x4a0892;};'use strict';var Sequelize=require(_0x3471('0x0'));module[_0x3471('0x1')]={'uniqueid':{'type':Sequelize[_0x3471('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3471('0x3')},'membername':{'type':Sequelize[_0x3471('0x4')],'allowNull':![],'comment':_0x3471('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3471('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x3471('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x3471('0x4')],'allowNull':![],'unique':_0x3471('0x5'),'comment':_0x3471('0x3')},'penalty':{'type':Sequelize[_0x3471('0x2')](0xb),'defaultValue':0x0,'comment':_0x3471('0x3')},'paused':{'type':Sequelize[_0x3471('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x60d4=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x5b9a93,_0x331ff7){var _0x2737eb=function(_0x7c2428){while(--_0x7c2428){_0x5b9a93['push'](_0x5b9a93['shift']());}};_0x2737eb(++_0x331ff7);}(_0x60d4,0x1ed));var _0x460d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x60d4[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x460d('0x0'));module[_0x460d('0x1')]={'uniqueid':{'type':Sequelize[_0x460d('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x460d('0x3')},'membername':{'type':Sequelize[_0x460d('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x460d('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x460d('0x5'),'comment':_0x460d('0x3')},'VoiceQueueId':{'type':Sequelize[_0x460d('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x460d('0x4')],'allowNull':![],'unique':_0x460d('0x5'),'comment':_0x460d('0x3')},'penalty':{'type':Sequelize[_0x460d('0x2')](0xb),'defaultValue':0x0,'comment':_0x460d('0x3')},'paused':{'type':Sequelize[_0x460d('0x2')](0xb),'defaultValue':0x0,'comment':_0x460d('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f90e09e..a2a1e59 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 _0x99cb=['emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners','update','remove'];(function(_0x138fa0,_0xdd4159){var _0x3f646a=function(_0x4b7a8d){while(--_0x4b7a8d){_0x138fa0['push'](_0x138fa0['shift']());}};_0x3f646a(++_0xdd4159);}(_0x99cb,0xca));var _0xb99c=function(_0x1e9dea,_0x409f32){_0x1e9dea=_0x1e9dea-0x0;var _0x10f0a4=_0x99cb[_0x1e9dea];return _0x10f0a4;};'use strict';var EventEmitter=require(_0xb99c('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xb99c('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb99c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb99c('0x3'),'afterDestroy':_0xb99c('0x4')};function emitEvent(_0x395578){return function(_0x36ba45,_0x5e7cab,_0x13ca8f){UserVoiceQueueRtEvents[_0xb99c('0x5')](_0x395578+':'+_0x36ba45['id'],_0x36ba45);UserVoiceQueueRtEvents[_0xb99c('0x5')](_0x395578,_0x36ba45);_0x13ca8f(null);};}for(var e in events){if(events[_0xb99c('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xb99c('0x7')](e,emitEvent(event));}}module[_0xb99c('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x6644=['hasOwnProperty','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x2fcbb7,_0xe05760){var _0x274bea=function(_0x4a9528){while(--_0x4a9528){_0x2fcbb7['push'](_0x2fcbb7['shift']());}};_0x274bea(++_0xe05760);}(_0x6644,0xc5));var _0x4664=function(_0x4bb16e,_0x1a31ff){_0x4bb16e=_0x4bb16e-0x0;var _0xb1c41e=_0x6644[_0x4bb16e];return _0xb1c41e;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x4664('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4664('0x1')](0x0);var events={'afterCreate':_0x4664('0x2'),'afterUpdate':_0x4664('0x3'),'afterDestroy':_0x4664('0x4')};function emitEvent(_0x21a97d){return function(_0x2b812f,_0x510485,_0x25e921){UserVoiceQueueRtEvents['emit'](_0x21a97d+':'+_0x2b812f['id'],_0x2b812f);UserVoiceQueueRtEvents[_0x4664('0x5')](_0x21a97d,_0x2b812f);_0x25e921(null);};}for(var e in events){if(events[_0x4664('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a06cb9e..26fec59 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 _0x57e3=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x57e3,0x131));var _0x357e=function(_0x202587,_0x57f0bd){_0x202587=_0x202587-0x0;var _0x11bbb9=_0x57e3[_0x202587];return _0x11bbb9;};'use strict';var _=require(_0x357e('0x0'));var util=require(_0x357e('0x1'));var logger=require(_0x357e('0x2'))(_0x357e('0x3'));var moment=require(_0x357e('0x4'));var BPromise=require(_0x357e('0x5'));var rp=require(_0x357e('0x6'));var fs=require('fs');var path=require(_0x357e('0x7'));var rimraf=require(_0x357e('0x8'));var config=require(_0x357e('0x9'));var attributes=require(_0x357e('0xa'));module[_0x357e('0xb')]=function(_0x67ba41,_0x50104a){return _0x67ba41['define'](_0x357e('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a53=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0x4a53,0x113));var _0x34a5=function(_0x53e4be,_0x1926b0){_0x53e4be=_0x53e4be-0x0;var _0x4f972c=_0x4a53[_0x53e4be];return _0x4f972c;};'use strict';var _=require(_0x34a5('0x0'));var util=require(_0x34a5('0x1'));var logger=require(_0x34a5('0x2'))('api');var moment=require(_0x34a5('0x3'));var BPromise=require(_0x34a5('0x4'));var rp=require(_0x34a5('0x5'));var fs=require('fs');var path=require(_0x34a5('0x6'));var rimraf=require('rimraf');var config=require(_0x34a5('0x7'));var attributes=require(_0x34a5('0x8'));module[_0x34a5('0x9')]=function(_0x20edaf,_0x382f6a){return _0x20edaf['define'](_0x34a5('0xa'),attributes,{'tableName':_0x34a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index a4974ce..6604fba 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 _0xb43a=['info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then'];(function(_0x117913,_0x4fd262){var _0xb8eacb=function(_0x1e8b58){while(--_0x1e8b58){_0x117913['push'](_0x117913['shift']());}};_0xb8eacb(++_0x4fd262);}(_0xb43a,0x1ce));var _0xab43=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xb43a[_0x1ebce2];return _0x4a330c;};'use strict';var _=require(_0xab43('0x0'));var util=require(_0xab43('0x1'));var moment=require(_0xab43('0x2'));var BPromise=require(_0xab43('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xab43('0x5'));var logger=require(_0xab43('0x6'))(_0xab43('0x7'));var config=require(_0xab43('0x8'));var jayson=require(_0xab43('0x9'));var client=jayson[_0xab43('0xa')][_0xab43('0xb')]({'port':0x232a});config[_0xab43('0xc')]=_[_0xab43('0xd')](config[_0xab43('0xc')],{'host':_0xab43('0xe'),'port':0x18eb});var socket=require(_0xab43('0xf'))(new Redis(config[_0xab43('0xc')]));require(_0xab43('0x10'))['register'](socket);function respondWithRpcPromise(_0x3e4747,_0x55a4f1,_0x1ea7f2){return new BPromise(function(_0x4a327d,_0x90c69e){return client[_0xab43('0x11')](_0x3e4747,_0x1ea7f2)[_0xab43('0x12')](function(_0xbdda65){logger[_0xab43('0x13')](_0xab43('0x14'),_0x55a4f1,'request\x20sent');logger[_0xab43('0x15')](_0xab43('0x16'),_0x55a4f1,'request\x20sent',JSON['stringify'](_0xbdda65));if(_0xbdda65['error']){if(_0xbdda65[_0xab43('0x17')][_0xab43('0x18')]===0x1f4){logger[_0xab43('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x55a4f1,_0xbdda65[_0xab43('0x17')][_0xab43('0x19')]);return _0x90c69e(_0xbdda65[_0xab43('0x17')][_0xab43('0x19')]);}logger[_0xab43('0x17')](_0xab43('0x14'),_0x55a4f1,_0xbdda65[_0xab43('0x17')][_0xab43('0x19')]);return _0x4a327d(_0xbdda65[_0xab43('0x17')]['message']);}else{logger['info'](_0xab43('0x14'),_0x55a4f1,_0xab43('0x1a'));_0x4a327d(_0xbdda65['result']['message']);}})[_0xab43('0x1b')](function(_0x455757){logger[_0xab43('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x55a4f1,_0x455757);_0x90c69e(_0x455757);});});}exports['GetVoiceQueueRtPauses']=function(_0x5e777e){var _0x169ce3=this;return new Promise(function(_0x5034e1,_0x14c7db){return db[_0xab43('0x1c')]['findAll']({'raw':_0x5e777e[_0xab43('0x1d')]?_0x5e777e[_0xab43('0x1d')][_0xab43('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e777e['options']?_0x5e777e[_0xab43('0x1d')][_0xab43('0x1f')]||null:null,'attributes':[[db[_0xab43('0x20')]['fn'](_0xab43('0x21'),db[_0xab43('0x20')]['fn']('IF',db[_0xab43('0x20')][_0xab43('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0xab43('0x23')]]})['then'](function(_0x3fa1cb){logger[_0xab43('0x13')](_0xab43('0x24'),_0x5e777e);logger['debug'](_0xab43('0x24'),_0x5e777e,JSON['stringify'](_0x3fa1cb));_0x5034e1(_0x3fa1cb);})[_0xab43('0x1b')](function(_0x136ac6){logger[_0xab43('0x17')](_0xab43('0x24'),_0x136ac6['message'],_0x5e777e);_0x14c7db(_0x169ce3['error'](0x1f4,_0x136ac6[_0xab43('0x19')]));});});}; \ No newline at end of file +var _0xf26d=['request\x20sent','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','debug','stringify','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x49739f,_0x2c5eef){var _0x248028=function(_0x4f9888){while(--_0x4f9888){_0x49739f['push'](_0x49739f['shift']());}};_0x248028(++_0x2c5eef);}(_0xf26d,0xbc));var _0xdf26=function(_0x5f1f55,_0x4bc97a){_0x5f1f55=_0x5f1f55-0x0;var _0x34e8a2=_0xf26d[_0x5f1f55];return _0x34e8a2;};'use strict';var _=require(_0xdf26('0x0'));var util=require('util');var moment=require(_0xdf26('0x1'));var BPromise=require(_0xdf26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf26('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf26('0x4'))(_0xdf26('0x5'));var config=require(_0xdf26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdf26('0x7')][_0xdf26('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdf26('0x9'),'port':0x18eb});var socket=require(_0xdf26('0xa'))(new Redis(config[_0xdf26('0xb')]));require('./userVoiceQueueRt.socket')[_0xdf26('0xc')](socket);function respondWithRpcPromise(_0x4caef0,_0x222b9f,_0x303fc1){return new BPromise(function(_0x3205d8,_0x537310){return client['request'](_0x4caef0,_0x303fc1)[_0xdf26('0xd')](function(_0x51c07d){logger[_0xdf26('0xe')](_0xdf26('0xf'),_0x222b9f,_0xdf26('0x10'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x222b9f,_0xdf26('0x10'),JSON['stringify'](_0x51c07d));if(_0x51c07d[_0xdf26('0x11')]){if(_0x51c07d[_0xdf26('0x11')][_0xdf26('0x12')]===0x1f4){logger[_0xdf26('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x222b9f,_0x51c07d[_0xdf26('0x11')][_0xdf26('0x13')]);return _0x537310(_0x51c07d[_0xdf26('0x11')][_0xdf26('0x13')]);}logger[_0xdf26('0x11')](_0xdf26('0xf'),_0x222b9f,_0x51c07d[_0xdf26('0x11')][_0xdf26('0x13')]);return _0x3205d8(_0x51c07d[_0xdf26('0x11')]['message']);}else{logger[_0xdf26('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x222b9f,_0xdf26('0x10'));_0x3205d8(_0x51c07d[_0xdf26('0x14')]['message']);}})[_0xdf26('0x15')](function(_0xa19399){logger[_0xdf26('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x222b9f,_0xa19399);_0x537310(_0xa19399);});});}exports['GetVoiceQueueRtPauses']=function(_0x1339d6){var _0x9e7c82=this;return new Promise(function(_0x501b3a,_0xf3cf71){return db[_0xdf26('0x16')][_0xdf26('0x17')]({'raw':_0x1339d6['options']?_0x1339d6[_0xdf26('0x18')][_0xdf26('0x19')]===undefined?!![]:![]:!![],'where':_0x1339d6[_0xdf26('0x18')]?_0x1339d6['options'][_0xdf26('0x1a')]||null:null,'attributes':[[db[_0xdf26('0x1b')]['fn'](_0xdf26('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xdf26('0x1d')))),_0xdf26('0x1e')]]})[_0xdf26('0xd')](function(_0xfa0b64){logger[_0xdf26('0xe')](_0xdf26('0x1f'),_0x1339d6);logger[_0xdf26('0x20')](_0xdf26('0x1f'),_0x1339d6,JSON[_0xdf26('0x21')](_0xfa0b64));_0x501b3a(_0xfa0b64);})[_0xdf26('0x15')](function(_0x53bce1){logger[_0xdf26('0x11')](_0xdf26('0x1f'),_0x53bce1[_0xdf26('0x13')],_0x1339d6);_0xf3cf71(_0x9e7c82[_0xdf26('0x11')](0x1f4,_0x53bce1[_0xdf26('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 878db48..1168dcd 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 _0x36bb=['remove','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x4e3f18,_0x4c23e4){var _0x56831b=function(_0x3d62c1){while(--_0x3d62c1){_0x4e3f18['push'](_0x4e3f18['shift']());}};_0x56831b(++_0x4c23e4);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0xb36b('0x0'));var events=[_0xb36b('0x1'),_0xb36b('0x2'),'update'];function createListener(_0x1d6c2e,_0xa54c6){return function(_0x9267f4){_0xa54c6[_0xb36b('0x3')](_0x1d6c2e,_0x9267f4);};}function removeListener(_0x311671,_0x3d57d7){return function(){UserVoiceQueueRtEvents[_0xb36b('0x4')](_0x311671,_0x3d57d7);};}exports[_0xb36b('0x5')]=function(_0x439ccc){for(var _0x418837=0x0,_0x181f45=events[_0xb36b('0x6')];_0x418837<_0x181f45;_0x418837++){var _0x229483=events[_0x418837];var _0x30e907=createListener(_0xb36b('0x7')+_0x229483,_0x439ccc);UserVoiceQueueRtEvents['on'](_0x229483,_0x30e907);}}; \ No newline at end of file +var _0xaf11=['update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x45adaf,_0x21c3c1){var _0x15d189=function(_0x48dc43){while(--_0x48dc43){_0x45adaf['push'](_0x45adaf['shift']());}};_0x15d189(++_0x21c3c1);}(_0xaf11,0x12f));var _0x1af1=function(_0x2b9a42,_0x1b711a){_0x2b9a42=_0x2b9a42-0x0;var _0x261fe3=_0xaf11[_0x2b9a42];return _0x261fe3;};'use strict';var UserVoiceQueueRtEvents=require(_0x1af1('0x0'));var events=[_0x1af1('0x1'),_0x1af1('0x2'),_0x1af1('0x3')];function createListener(_0x532050,_0x15fe21){return function(_0x2c89fa){_0x15fe21[_0x1af1('0x4')](_0x532050,_0x2c89fa);};}function removeListener(_0x53af48,_0xb0ace){return function(){UserVoiceQueueRtEvents[_0x1af1('0x5')](_0x53af48,_0xb0ace);};}exports[_0x1af1('0x6')]=function(_0x4d3153){for(var _0x36f1a0=0x0,_0x5dbe9d=events[_0x1af1('0x7')];_0x36f1a0<_0x5dbe9d;_0x36f1a0++){var _0x26d917=events[_0x36f1a0];var _0x48b286=createListener(_0x1af1('0x8')+_0x26d917,_0x4d3153);UserVoiceQueueRtEvents['on'](_0x26d917,_0x48b286);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 0ebbc38..f04f208 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x40d0f7,_0x1223b4){var _0x71e975=function(_0x466aa5){while(--_0x466aa5){_0x40d0f7['push'](_0x40d0f7['shift']());}};_0x71e975(++_0x1223b4);}(_0xe706,0xa3));var _0x6e70=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0xe706[_0x25c326];return _0x762452;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3567c8,_0x10f0fd){var _0x2e1f59=function(_0x5b5117){while(--_0x5b5117){_0x3567c8['push'](_0x3567c8['shift']());}};_0x2e1f59(++_0x10f0fd);}(_0xe706,0xa3));var _0x6e70=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0xe706[_0x581249];return _0x284bae;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0d37002..526408a 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 _0x36d5=['INTEGER','exports'];(function(_0x392fd7,_0x347b4d){var _0x3c168a=function(_0x8418a2){while(--_0x8418a2){_0x392fd7['push'](_0x392fd7['shift']());}};_0x3c168a(++_0x347b4d);}(_0x36d5,0x1ab));var _0x536d=function(_0x37ef22,_0x348c92){_0x37ef22=_0x37ef22-0x0;var _0x49eeb3=_0x36d5[_0x37ef22];return _0x49eeb3;};'use strict';var Sequelize=require('sequelize');module[_0x536d('0x0')]={'penalty':{'type':Sequelize[_0x536d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x54e9=['INTEGER'];(function(_0x5e6850,_0x3f0815){var _0x3fce80=function(_0x3fa240){while(--_0x3fa240){_0x5e6850['push'](_0x5e6850['shift']());}};_0x3fce80(++_0x3f0815);}(_0x54e9,0xbd));var _0x954e=function(_0x1f83b9,_0x88e2e){_0x1f83b9=_0x1f83b9-0x0;var _0x9eb0c7=_0x54e9[_0x1f83b9];return _0x9eb0c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x954e('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index aa2e0ca..458e14b 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 _0x8af2=['rimraf','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0x8af2,0x73));var _0x28af=function(_0x294e1e,_0x3ee80c){_0x294e1e=_0x294e1e-0x0;var _0x19e1f9=_0x8af2[_0x294e1e];return _0x19e1f9;};'use strict';var _=require(_0x28af('0x0'));var util=require(_0x28af('0x1'));var logger=require(_0x28af('0x2'))(_0x28af('0x3'));var moment=require(_0x28af('0x4'));var BPromise=require('bluebird');var rp=require(_0x28af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28af('0x6'));var config=require('../../config/environment');var attributes=require(_0x28af('0x7'));module[_0x28af('0x8')]=function(_0x51a9b8,_0x340014){return _0x51a9b8[_0x28af('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0x28af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bf2=['define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','../../config/environment'];(function(_0x4f8e06,_0x3226b1){var _0x327dad=function(_0x4dced3){while(--_0x4dced3){_0x4f8e06['push'](_0x4f8e06['shift']());}};_0x327dad(++_0x3226b1);}(_0x9bf2,0x79));var _0x29bf=function(_0x24f81f,_0xc83129){_0x24f81f=_0x24f81f-0x0;var _0xf8f549=_0x9bf2[_0x24f81f];return _0xf8f549;};'use strict';var _=require(_0x29bf('0x0'));var util=require(_0x29bf('0x1'));var logger=require(_0x29bf('0x2'))(_0x29bf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x29bf('0x4'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x587400,_0x2f5d36){return _0x587400[_0x29bf('0x5')]('UserWhatsappQueue',attributes,{'tableName':_0x29bf('0x6'),'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 39c3912..6ca21a9 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 _0x2404=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring'];(function(_0x295621,_0x4286b8){var _0x36d0dd=function(_0x51d57e){while(--_0x51d57e){_0x295621['push'](_0x295621['shift']());}};_0x36d0dd(++_0x4286b8);}(_0x2404,0x100));var _0x4240=function(_0x547110,_0x577188){_0x547110=_0x547110-0x0;var _0xf9c0=_0x2404[_0x547110];return _0xf9c0;};'use strict';var _=require(_0x4240('0x0'));var util=require(_0x4240('0x1'));var moment=require('moment');var BPromise=require(_0x4240('0x2'));var rs=require(_0x4240('0x3'));var fs=require('fs');var Redis=require(_0x4240('0x4'));var db=require(_0x4240('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4240('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4240('0x7'));var client=jayson[_0x4240('0x8')][_0x4240('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2df6d5,_0xd0acbd,_0x42f566){return new BPromise(function(_0x282c63,_0x33227b){return client[_0x4240('0xa')](_0x2df6d5,_0x42f566)[_0x4240('0xb')](function(_0x2fa75e){logger[_0x4240('0xc')](_0x4240('0xd'),_0xd0acbd,_0x4240('0xe'));logger['debug'](_0x4240('0xf'),_0xd0acbd,_0x4240('0xe'),JSON[_0x4240('0x10')](_0x2fa75e));if(_0x2fa75e[_0x4240('0x11')]){if(_0x2fa75e[_0x4240('0x11')]['code']===0x1f4){logger[_0x4240('0x11')](_0x4240('0xd'),_0xd0acbd,_0x2fa75e[_0x4240('0x11')][_0x4240('0x12')]);return _0x33227b(_0x2fa75e['error'][_0x4240('0x12')]);}logger[_0x4240('0x11')](_0x4240('0xd'),_0xd0acbd,_0x2fa75e[_0x4240('0x11')][_0x4240('0x12')]);return _0x282c63(_0x2fa75e['error'][_0x4240('0x12')]);}else{logger[_0x4240('0xc')](_0x4240('0xd'),_0xd0acbd,_0x4240('0xe'));_0x282c63(_0x2fa75e['result']['message']);}})[_0x4240('0x13')](function(_0x3544f1){logger['error'](_0x4240('0xd'),_0xd0acbd,_0x3544f1);_0x33227b(_0x3544f1);});});} \ No newline at end of file +var _0x68b5=['info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x68b5,0xdb));var _0x568b=function(_0x47e970,_0x36a0fa){_0x47e970=_0x47e970-0x0;var _0x44e30b=_0x68b5[_0x47e970];return _0x44e30b;};'use strict';var _=require(_0x568b('0x0'));var util=require(_0x568b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x568b('0x2'));var fs=require('fs');var Redis=require(_0x568b('0x3'));var db=require(_0x568b('0x4'))['db'];var utils=require(_0x568b('0x5'));var logger=require(_0x568b('0x6'))(_0x568b('0x7'));var config=require(_0x568b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x568b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c4f21,_0x15644b,_0x117f55){return new BPromise(function(_0x4a1984,_0x370ce1){return client[_0x568b('0xa')](_0x4c4f21,_0x117f55)[_0x568b('0xb')](function(_0xdcb18a){logger[_0x568b('0xc')](_0x568b('0xd'),_0x15644b,_0x568b('0xe'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x15644b,_0x568b('0xe'),JSON[_0x568b('0xf')](_0xdcb18a));if(_0xdcb18a['error']){if(_0xdcb18a[_0x568b('0x10')][_0x568b('0x11')]===0x1f4){logger[_0x568b('0x10')](_0x568b('0xd'),_0x15644b,_0xdcb18a[_0x568b('0x10')][_0x568b('0x12')]);return _0x370ce1(_0xdcb18a[_0x568b('0x10')][_0x568b('0x12')]);}logger['error'](_0x568b('0xd'),_0x15644b,_0xdcb18a[_0x568b('0x10')][_0x568b('0x12')]);return _0x4a1984(_0xdcb18a['error'][_0x568b('0x12')]);}else{logger[_0x568b('0xc')](_0x568b('0xd'),_0x15644b,_0x568b('0xe'));_0x4a1984(_0xdcb18a[_0x568b('0x13')][_0x568b('0x12')]);}})[_0x568b('0x14')](function(_0x4b826b){logger[_0x568b('0x10')](_0x568b('0xd'),_0x15644b,_0x4b826b);_0x370ce1(_0x4b826b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c8536bb..7d9982d 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 _0x207c=['fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','show','post','isAuthenticated','put','update','delete','util','path','connect-timeout','express','Router'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x207c,0x1e8));var _0xc207=function(_0x44c801,_0x5ad314){_0x44c801=_0x44c801-0x0;var _0x3f3468=_0x207c[_0x44c801];return _0x3f3468;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./variable.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),auth['isAuthenticated'](),controller[_0xc207('0xb')]);router[_0xc207('0xc')]('/',auth[_0xc207('0xd')](),controller['create']);router[_0xc207('0xe')](_0xc207('0xa'),auth[_0xc207('0xd')](),controller[_0xc207('0xf')]);router[_0xc207('0x10')](_0xc207('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x291c=['/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated'];(function(_0xe17162,_0x102d4e){var _0x33f8e2=function(_0x433c8a){while(--_0x433c8a){_0xe17162['push'](_0xe17162['shift']());}};_0x33f8e2(++_0x102d4e);}(_0x291c,0x137));var _0xc291=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x291c[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var path=require(_0xc291('0x2'));var timeout=require(_0xc291('0x3'));var express=require(_0xc291('0x4'));var router=express[_0xc291('0x5')]();var fs_extra=require(_0xc291('0x6'));var auth=require(_0xc291('0x7'));var interaction=require(_0xc291('0x8'));var config=require(_0xc291('0x9'));var controller=require(_0xc291('0xa'));router['get']('/',auth[_0xc291('0xb')](),controller['index']);router['get'](_0xc291('0xc'),auth[_0xc291('0xb')](),controller[_0xc291('0xd')]);router[_0xc291('0xe')]('/',auth['isAuthenticated'](),controller[_0xc291('0xf')]);router[_0xc291('0x10')](_0xc291('0xc'),auth[_0xc291('0xb')](),controller[_0xc291('0x11')]);router[_0xc291('0x12')](_0xc291('0xc'),auth[_0xc291('0xb')](),controller['destroy']);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 da3f6ac..d89e27c 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 _0xca7d=['STRING','name'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0xca7d,0x182));var _0xdca7=function(_0x8a8d0c,_0x329a5e){_0x8a8d0c=_0x8a8d0c-0x0;var _0x1355fb=_0xca7d[_0x8a8d0c];return _0x1355fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdca7('0x0')],'unique':_0xdca7('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdca7('0x0')]}}; \ No newline at end of file +var _0x2e01=['STRING','name','exports'];(function(_0x227b3e,_0x380b09){var _0x69b536=function(_0x2e1cc6){while(--_0x2e1cc6){_0x227b3e['push'](_0x227b3e['shift']());}};_0x69b536(++_0x380b09);}(_0x2e01,0x1d0));var _0x12e0=function(_0x381543,_0x18bbd0){_0x381543=_0x381543-0x0;var _0x2778a6=_0x2e01[_0x381543];return _0x2778a6;};'use strict';var Sequelize=require('sequelize');module[_0x12e0('0x0')]={'name':{'type':Sequelize[_0x12e0('0x1')],'unique':_0x12e0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x12e0('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 91a1570..16c9676 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 _0x4e31=['order','where','pick','filter','merge','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','update','then','destroy','get','sendStatus','send','map','Variable','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3c2407,_0x3c9a47){var _0x5d2eac=function(_0xb33bf8){while(--_0xb33bf8){_0x3c2407['push'](_0x3c2407['shift']());}};_0x5d2eac(++_0x3c9a47);}(_0x4e31,0x1ad));var _0x14e3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4e31[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x14e3('0x0'));var rimraf=require(_0x14e3('0x1'));var zipdir=require(_0x14e3('0x2'));var jsonpatch=require(_0x14e3('0x3'));var rp=require(_0x14e3('0x4'));var moment=require(_0x14e3('0x5'));var BPromise=require(_0x14e3('0x6'));var Mustache=require(_0x14e3('0x7'));var util=require(_0x14e3('0x8'));var path=require(_0x14e3('0x9'));var sox=require(_0x14e3('0xa'));var csv=require(_0x14e3('0xb'));var ejs=require(_0x14e3('0xc'));var fs=require('fs');var fs_extra=require(_0x14e3('0xd'));var _=require(_0x14e3('0xe'));var squel=require(_0x14e3('0xf'));var crypto=require(_0x14e3('0x10'));var jsforce=require(_0x14e3('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x14e3('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x14e3('0x12'));var authService=require(_0x14e3('0x13'));var qs=require(_0x14e3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14e3('0x15'));var logger=require(_0x14e3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x14e3('0x17'));var licenseUtil=require(_0x14e3('0x18'));var db=require(_0x14e3('0x19'))['db'];function respondWithStatusCode(_0x2725d9,_0x4e2780){_0x4e2780=_0x4e2780||0xcc;return function(_0x217def){if(_0x217def){return _0x2725d9['sendStatus'](_0x4e2780);}return _0x2725d9['status'](_0x4e2780)[_0x14e3('0x1a')]();};}function respondWithResult(_0xc5231e,_0x2611bb){_0x2611bb=_0x2611bb||0xc8;return function(_0x23da67){if(_0x23da67){return _0xc5231e['status'](_0x2611bb)[_0x14e3('0x1b')](_0x23da67);}};}function respondWithFilteredResult(_0x37fb13,_0x586f11){return function(_0x1ad3b1){if(_0x1ad3b1){var _0x3f9d4d=typeof _0x586f11[_0x14e3('0x1c')]==='undefined'&&typeof _0x586f11['limit']===_0x14e3('0x1d');var _0x34eb28=_0x1ad3b1[_0x14e3('0x1e')];var _0x42d2ee=_0x3f9d4d?0x0:_0x586f11[_0x14e3('0x1c')];var _0x530e19=_0x3f9d4d?_0x1ad3b1[_0x14e3('0x1e')]:_0x586f11[_0x14e3('0x1c')]+_0x586f11[_0x14e3('0x1f')];var _0x475434;if(_0x530e19>=_0x34eb28){_0x530e19=_0x34eb28;_0x475434=0xc8;}else{_0x475434=0xce;}_0x37fb13[_0x14e3('0x20')](_0x475434);return _0x37fb13[_0x14e3('0x21')](_0x14e3('0x22'),_0x42d2ee+'-'+_0x530e19+'/'+_0x34eb28)['json'](_0x1ad3b1);}return null;};}function patchUpdates(_0x467f5){return function(_0x46f08e){try{jsonpatch[_0x14e3('0x23')](_0x46f08e,_0x467f5,!![]);}catch(_0x26d27a){return BPromise['reject'](_0x26d27a);}return _0x46f08e['save']();};}function saveUpdates(_0x28b315,_0x3d8993){return function(_0x1ce7c6){if(_0x1ce7c6){return _0x1ce7c6[_0x14e3('0x24')](_0x28b315)[_0x14e3('0x25')](function(_0xdd9fe1){return _0xdd9fe1;});}return null;};}function removeEntity(_0x1c8e3a,_0x34f9a3){return function(_0x13cca1){if(_0x13cca1){return _0x13cca1[_0x14e3('0x26')]()[_0x14e3('0x25')](function(){var _0x1fbdee=_0x13cca1[_0x14e3('0x27')]({'plain':!![]});var _0x56ccf7='Variables';return db['UserProfileResource'][_0x14e3('0x26')]({'where':{'type':_0x56ccf7,'resourceId':_0x1fbdee['id']}})[_0x14e3('0x25')](function(){return _0x13cca1;});})[_0x14e3('0x25')](function(){_0x1c8e3a[_0x14e3('0x20')](0xcc)[_0x14e3('0x1a')]();});}};}function handleEntityNotFound(_0x34b7dc,_0x1ce11b){return function(_0x878078){if(!_0x878078){_0x34b7dc[_0x14e3('0x28')](0x194);}return _0x878078;};}function handleError(_0x35dc8b,_0x17ae77){_0x17ae77=_0x17ae77||0x1f4;return function(_0x53756b){logger['error'](_0x53756b['stack']);if(_0x53756b['name']){delete _0x53756b['name'];}_0x35dc8b[_0x14e3('0x20')](_0x17ae77)[_0x14e3('0x29')](_0x53756b);};}exports['index']=function(_0x40fe82,_0x2fcbd2){var _0x1ea9d6={},_0x5de90d={},_0x48bb78={'count':0x0,'rows':[]};var _0x2db238=_[_0x14e3('0x2a')](db[_0x14e3('0x2b')]['rawAttributes'],function(_0x1a555d){return{'name':_0x1a555d[_0x14e3('0x2c')],'type':_0x1a555d[_0x14e3('0x2d')]['key']};});_0x5de90d[_0x14e3('0x2e')]=_[_0x14e3('0x2a')](_0x2db238,_0x14e3('0x2f'));_0x5de90d[_0x14e3('0x30')]=_[_0x14e3('0x31')](_0x40fe82[_0x14e3('0x30')]);_0x5de90d[_0x14e3('0x32')]=_[_0x14e3('0x33')](_0x5de90d[_0x14e3('0x2e')],_0x5de90d[_0x14e3('0x30')]);_0x1ea9d6[_0x14e3('0x34')]=_[_0x14e3('0x33')](_0x5de90d['model'],qs['fields'](_0x40fe82['query'][_0x14e3('0x35')]));_0x1ea9d6['attributes']=_0x1ea9d6[_0x14e3('0x34')][_0x14e3('0x36')]?_0x1ea9d6[_0x14e3('0x34')]:_0x5de90d[_0x14e3('0x2e')];if(!_0x40fe82[_0x14e3('0x30')][_0x14e3('0x37')](_0x14e3('0x38'))){_0x1ea9d6[_0x14e3('0x1f')]=qs[_0x14e3('0x1f')](_0x40fe82['query'][_0x14e3('0x1f')]);_0x1ea9d6['offset']=qs['offset'](_0x40fe82[_0x14e3('0x30')][_0x14e3('0x1c')]);}_0x1ea9d6[_0x14e3('0x39')]=qs['sort'](_0x40fe82['query']['sort']);_0x1ea9d6[_0x14e3('0x3a')]=qs[_0x14e3('0x32')](_[_0x14e3('0x3b')](_0x40fe82['query'],_0x5de90d[_0x14e3('0x32')]),_0x2db238);if(_0x40fe82[_0x14e3('0x30')][_0x14e3('0x3c')]){_0x1ea9d6[_0x14e3('0x3a')]=_[_0x14e3('0x3d')](_0x1ea9d6[_0x14e3('0x3a')],{'$or':_['map'](_0x2db238,function(_0x5a2028){if(_0x5a2028[_0x14e3('0x2d')]!=='VIRTUAL'){var _0x3951c8={};_0x3951c8[_0x5a2028[_0x14e3('0x2f')]]={'$like':'%'+_0x40fe82['query'][_0x14e3('0x3c')]+'%'};return _0x3951c8;}})});}_0x1ea9d6=_['merge']({},_0x1ea9d6,_0x40fe82['options']);var _0x4a31de={'where':_0x1ea9d6[_0x14e3('0x3a')]};return db['Variable'][_0x14e3('0x1e')](_0x4a31de)[_0x14e3('0x25')](function(_0x4181d3){_0x48bb78['count']=_0x4181d3;if(_0x40fe82[_0x14e3('0x30')][_0x14e3('0x3e')]){_0x1ea9d6[_0x14e3('0x3f')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x1ea9d6);})[_0x14e3('0x25')](function(_0x40a1c1){_0x48bb78[_0x14e3('0x40')]=_0x40a1c1;return _0x48bb78;})[_0x14e3('0x25')](respondWithFilteredResult(_0x2fcbd2,_0x1ea9d6))[_0x14e3('0x41')](handleError(_0x2fcbd2,null));};exports[_0x14e3('0x42')]=function(_0x3803f3,_0x164f61){var _0x5ef418={'raw':!![],'where':{'id':_0x3803f3[_0x14e3('0x43')]['id']}},_0x325d94={};_0x325d94['model']=_[_0x14e3('0x31')](db[_0x14e3('0x2b')][_0x14e3('0x44')]);_0x325d94[_0x14e3('0x30')]=_[_0x14e3('0x31')](_0x3803f3['query']);_0x325d94[_0x14e3('0x32')]=_['intersection'](_0x325d94[_0x14e3('0x2e')],_0x325d94['query']);_0x5ef418[_0x14e3('0x34')]=_['intersection'](_0x325d94['model'],qs[_0x14e3('0x35')](_0x3803f3[_0x14e3('0x30')][_0x14e3('0x35')]));_0x5ef418['attributes']=_0x5ef418['attributes'][_0x14e3('0x36')]?_0x5ef418[_0x14e3('0x34')]:_0x325d94[_0x14e3('0x2e')];if(_0x3803f3[_0x14e3('0x30')]['includeAll']){_0x5ef418[_0x14e3('0x3f')]=[{'all':!![]}];}_0x5ef418=_['merge']({},_0x5ef418,_0x3803f3[_0x14e3('0x45')]);return db[_0x14e3('0x2b')][_0x14e3('0x46')](_0x5ef418)['then'](handleEntityNotFound(_0x164f61,null))[_0x14e3('0x25')](respondWithResult(_0x164f61,null))[_0x14e3('0x41')](handleError(_0x164f61,null));};exports[_0x14e3('0x47')]=function(_0x3671af,_0x402c0d){return db[_0x14e3('0x2b')][_0x14e3('0x47')](_0x3671af[_0x14e3('0x48')],{})[_0x14e3('0x25')](function(_0x38ad28){var _0x1a2826=_0x3671af[_0x14e3('0x49')][_0x14e3('0x27')]({'plain':!![]});if(!_0x1a2826)throw new Error(_0x14e3('0x4a'));if(_0x1a2826['role']==='user'){var _0x5e066c=_0x38ad28[_0x14e3('0x27')]({'plain':!![]});var _0x52a4bf=_0x14e3('0x4b');return db[_0x14e3('0x4c')][_0x14e3('0x46')]({'where':{'name':_0x52a4bf,'userProfileId':_0x1a2826[_0x14e3('0x4d')]},'raw':!![]})[_0x14e3('0x25')](function(_0x183f27){if(_0x183f27&&_0x183f27[_0x14e3('0x4e')]===0x0){return db[_0x14e3('0x4f')]['create']({'name':_0x5e066c[_0x14e3('0x2f')],'resourceId':_0x5e066c['id'],'type':_0x183f27[_0x14e3('0x2f')],'sectionId':_0x183f27['id']},{})['then'](function(){return _0x38ad28;});}else{return _0x38ad28;}})[_0x14e3('0x41')](function(_0x1f4b56){logger[_0x14e3('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f4b56);throw _0x1f4b56;});}return _0x38ad28;})[_0x14e3('0x25')](respondWithResult(_0x402c0d,0xc9))[_0x14e3('0x41')](handleError(_0x402c0d,null));};exports['update']=function(_0x3aead0,_0x21fd9e){if(_0x3aead0['body']['id']){delete _0x3aead0[_0x14e3('0x48')]['id'];}return db['Variable'][_0x14e3('0x46')]({'where':{'id':_0x3aead0[_0x14e3('0x43')]['id']}})[_0x14e3('0x25')](handleEntityNotFound(_0x21fd9e,null))[_0x14e3('0x25')](saveUpdates(_0x3aead0[_0x14e3('0x48')],null))[_0x14e3('0x25')](respondWithResult(_0x21fd9e,null))[_0x14e3('0x41')](handleError(_0x21fd9e,null));};exports['destroy']=function(_0x128433,_0x3446d9){return db[_0x14e3('0x2b')][_0x14e3('0x46')]({'where':{'id':_0x128433['params']['id']}})['then'](handleEntityNotFound(_0x3446d9,null))[_0x14e3('0x25')](removeEntity(_0x3446d9,null))[_0x14e3('0x41')](handleError(_0x3446d9,null));}; \ No newline at end of file +var _0xb772=['fields','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','Variable','include','rows','catch','show','params','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','offset','count','Content-Range','json','reject','save','then','destroy','Variables','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x15c851,_0x16b2d5){var _0x53fabe=function(_0xa878d0){while(--_0xa878d0){_0x15c851['push'](_0x15c851['shift']());}};_0x53fabe(++_0x16b2d5);}(_0xb772,0x18b));var _0x2b77=function(_0x21e5d8,_0x100d94){_0x21e5d8=_0x21e5d8-0x0;var _0x523ab2=_0xb772[_0x21e5d8];return _0x523ab2;};'use strict';var emlformat=require(_0x2b77('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b77('0x1'));var rp=require(_0x2b77('0x2'));var moment=require(_0x2b77('0x3'));var BPromise=require(_0x2b77('0x4'));var Mustache=require('mustache');var util=require(_0x2b77('0x5'));var path=require(_0x2b77('0x6'));var sox=require(_0x2b77('0x7'));var csv=require(_0x2b77('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b77('0x9'));var _=require(_0x2b77('0xa'));var squel=require(_0x2b77('0xb'));var crypto=require(_0x2b77('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2b77('0xd'));var toCsv=require(_0x2b77('0x8'));var querystring=require(_0x2b77('0xe'));var Papa=require('papaparse');var Redis=require(_0x2b77('0xf'));var authService=require(_0x2b77('0x10'));var qs=require(_0x2b77('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b77('0x12'))('api');var utils=require(_0x2b77('0x13'));var config=require(_0x2b77('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b77('0x15'))['db'];function respondWithStatusCode(_0x32aecd,_0x98d13e){_0x98d13e=_0x98d13e||0xcc;return function(_0x18b411){if(_0x18b411){return _0x32aecd[_0x2b77('0x16')](_0x98d13e);}return _0x32aecd[_0x2b77('0x17')](_0x98d13e)['end']();};}function respondWithResult(_0x328162,_0x254b67){_0x254b67=_0x254b67||0xc8;return function(_0x432f91){if(_0x432f91){return _0x328162[_0x2b77('0x17')](_0x254b67)['json'](_0x432f91);}};}function respondWithFilteredResult(_0x563c7e,_0x4767dc){return function(_0x35f9db){if(_0x35f9db){var _0x1f8db5=typeof _0x4767dc['offset']===_0x2b77('0x18')&&typeof _0x4767dc[_0x2b77('0x19')]==='undefined';var _0x1fbdc6=_0x35f9db['count'];var _0x4c2eeb=_0x1f8db5?0x0:_0x4767dc[_0x2b77('0x1a')];var _0x36ffac=_0x1f8db5?_0x35f9db[_0x2b77('0x1b')]:_0x4767dc[_0x2b77('0x1a')]+_0x4767dc[_0x2b77('0x19')];var _0x226155;if(_0x36ffac>=_0x1fbdc6){_0x36ffac=_0x1fbdc6;_0x226155=0xc8;}else{_0x226155=0xce;}_0x563c7e['status'](_0x226155);return _0x563c7e['set'](_0x2b77('0x1c'),_0x4c2eeb+'-'+_0x36ffac+'/'+_0x1fbdc6)[_0x2b77('0x1d')](_0x35f9db);}return null;};}function patchUpdates(_0x37c802){return function(_0x314c02){try{jsonpatch['apply'](_0x314c02,_0x37c802,!![]);}catch(_0x3df883){return BPromise[_0x2b77('0x1e')](_0x3df883);}return _0x314c02[_0x2b77('0x1f')]();};}function saveUpdates(_0x5e53ed,_0x3ca6b3){return function(_0x470058){if(_0x470058){return _0x470058['update'](_0x5e53ed)[_0x2b77('0x20')](function(_0xcc0161){return _0xcc0161;});}return null;};}function removeEntity(_0x255d0f,_0x3de6b6){return function(_0x2712ee){if(_0x2712ee){return _0x2712ee[_0x2b77('0x21')]()[_0x2b77('0x20')](function(){var _0x294809=_0x2712ee['get']({'plain':!![]});var _0x3e36ba=_0x2b77('0x22');return db[_0x2b77('0x23')][_0x2b77('0x21')]({'where':{'type':_0x3e36ba,'resourceId':_0x294809['id']}})[_0x2b77('0x20')](function(){return _0x2712ee;});})['then'](function(){_0x255d0f[_0x2b77('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x106dc6,_0x47fc41){return function(_0x57bb40){if(!_0x57bb40){_0x106dc6[_0x2b77('0x16')](0x194);}return _0x57bb40;};}function handleError(_0x4de100,_0x3f2d32){_0x3f2d32=_0x3f2d32||0x1f4;return function(_0x4a41f4){logger['error'](_0x4a41f4[_0x2b77('0x24')]);if(_0x4a41f4[_0x2b77('0x25')]){delete _0x4a41f4[_0x2b77('0x25')];}_0x4de100[_0x2b77('0x17')](_0x3f2d32)[_0x2b77('0x26')](_0x4a41f4);};}exports[_0x2b77('0x27')]=function(_0x3a6ac9,_0x1056e5){var _0x4ab909={},_0x3071a1={},_0x20f14e={'count':0x0,'rows':[]};var _0x15da00=_[_0x2b77('0x28')](db['Variable'][_0x2b77('0x29')],function(_0x27921b){return{'name':_0x27921b[_0x2b77('0x2a')],'type':_0x27921b[_0x2b77('0x2b')]['key']};});_0x3071a1[_0x2b77('0x2c')]=_['map'](_0x15da00,'name');_0x3071a1[_0x2b77('0x2d')]=_[_0x2b77('0x2e')](_0x3a6ac9[_0x2b77('0x2d')]);_0x3071a1[_0x2b77('0x2f')]=_[_0x2b77('0x30')](_0x3071a1[_0x2b77('0x2c')],_0x3071a1[_0x2b77('0x2d')]);_0x4ab909['attributes']=_[_0x2b77('0x30')](_0x3071a1[_0x2b77('0x2c')],qs[_0x2b77('0x31')](_0x3a6ac9[_0x2b77('0x2d')][_0x2b77('0x31')]));_0x4ab909['attributes']=_0x4ab909[_0x2b77('0x32')]['length']?_0x4ab909[_0x2b77('0x32')]:_0x3071a1['model'];if(!_0x3a6ac9[_0x2b77('0x2d')]['hasOwnProperty'](_0x2b77('0x33'))){_0x4ab909['limit']=qs[_0x2b77('0x19')](_0x3a6ac9[_0x2b77('0x2d')][_0x2b77('0x19')]);_0x4ab909[_0x2b77('0x1a')]=qs['offset'](_0x3a6ac9[_0x2b77('0x2d')][_0x2b77('0x1a')]);}_0x4ab909['order']=qs[_0x2b77('0x34')](_0x3a6ac9['query'][_0x2b77('0x34')]);_0x4ab909[_0x2b77('0x35')]=qs[_0x2b77('0x2f')](_['pick'](_0x3a6ac9[_0x2b77('0x2d')],_0x3071a1[_0x2b77('0x2f')]),_0x15da00);if(_0x3a6ac9[_0x2b77('0x2d')][_0x2b77('0x36')]){_0x4ab909[_0x2b77('0x35')]=_[_0x2b77('0x37')](_0x4ab909[_0x2b77('0x35')],{'$or':_[_0x2b77('0x28')](_0x15da00,function(_0x283b18){if(_0x283b18[_0x2b77('0x2b')]!==_0x2b77('0x38')){var _0x40ca57={};_0x40ca57[_0x283b18[_0x2b77('0x25')]]={'$like':'%'+_0x3a6ac9[_0x2b77('0x2d')][_0x2b77('0x36')]+'%'};return _0x40ca57;}})});}_0x4ab909=_[_0x2b77('0x37')]({},_0x4ab909,_0x3a6ac9[_0x2b77('0x39')]);var _0x582b84={'where':_0x4ab909[_0x2b77('0x35')]};return db[_0x2b77('0x3a')][_0x2b77('0x1b')](_0x582b84)[_0x2b77('0x20')](function(_0x2811e3){_0x20f14e['count']=_0x2811e3;if(_0x3a6ac9['query']['includeAll']){_0x4ab909[_0x2b77('0x3b')]=[{'all':!![]}];}return db[_0x2b77('0x3a')]['findAll'](_0x4ab909);})[_0x2b77('0x20')](function(_0x3c54f8){_0x20f14e[_0x2b77('0x3c')]=_0x3c54f8;return _0x20f14e;})[_0x2b77('0x20')](respondWithFilteredResult(_0x1056e5,_0x4ab909))[_0x2b77('0x3d')](handleError(_0x1056e5,null));};exports[_0x2b77('0x3e')]=function(_0x2c624e,_0x31fe04){var _0x3d6d3e={'raw':!![],'where':{'id':_0x2c624e[_0x2b77('0x3f')]['id']}},_0x10deca={};_0x10deca[_0x2b77('0x2c')]=_['keys'](db[_0x2b77('0x3a')][_0x2b77('0x29')]);_0x10deca['query']=_[_0x2b77('0x2e')](_0x2c624e[_0x2b77('0x2d')]);_0x10deca[_0x2b77('0x2f')]=_[_0x2b77('0x30')](_0x10deca[_0x2b77('0x2c')],_0x10deca['query']);_0x3d6d3e[_0x2b77('0x32')]=_[_0x2b77('0x30')](_0x10deca[_0x2b77('0x2c')],qs[_0x2b77('0x31')](_0x2c624e['query'][_0x2b77('0x31')]));_0x3d6d3e[_0x2b77('0x32')]=_0x3d6d3e[_0x2b77('0x32')]['length']?_0x3d6d3e[_0x2b77('0x32')]:_0x10deca[_0x2b77('0x2c')];if(_0x2c624e['query'][_0x2b77('0x40')]){_0x3d6d3e[_0x2b77('0x3b')]=[{'all':!![]}];}_0x3d6d3e=_[_0x2b77('0x37')]({},_0x3d6d3e,_0x2c624e[_0x2b77('0x39')]);return db[_0x2b77('0x3a')][_0x2b77('0x41')](_0x3d6d3e)[_0x2b77('0x20')](handleEntityNotFound(_0x31fe04,null))[_0x2b77('0x20')](respondWithResult(_0x31fe04,null))[_0x2b77('0x3d')](handleError(_0x31fe04,null));};exports[_0x2b77('0x42')]=function(_0x4eb615,_0x54d393){return db[_0x2b77('0x3a')]['create'](_0x4eb615['body'],{})[_0x2b77('0x20')](function(_0x34dcd2){var _0xde2dbb=_0x4eb615['user'][_0x2b77('0x43')]({'plain':!![]});if(!_0xde2dbb)throw new Error(_0x2b77('0x44'));if(_0xde2dbb[_0x2b77('0x45')]==='user'){var _0x395ee4=_0x34dcd2[_0x2b77('0x43')]({'plain':!![]});var _0x50263a=_0x2b77('0x22');return db['UserProfileSection'][_0x2b77('0x41')]({'where':{'name':_0x50263a,'userProfileId':_0xde2dbb[_0x2b77('0x46')]},'raw':!![]})[_0x2b77('0x20')](function(_0x24de67){if(_0x24de67&&_0x24de67['autoAssociation']===0x0){return db[_0x2b77('0x23')]['create']({'name':_0x395ee4['name'],'resourceId':_0x395ee4['id'],'type':_0x24de67[_0x2b77('0x25')],'sectionId':_0x24de67['id']},{})['then'](function(){return _0x34dcd2;});}else{return _0x34dcd2;}})[_0x2b77('0x3d')](function(_0x34c9d4){logger[_0x2b77('0x47')](_0x2b77('0x48'),_0x34c9d4);throw _0x34c9d4;});}return _0x34dcd2;})[_0x2b77('0x20')](respondWithResult(_0x54d393,0xc9))[_0x2b77('0x3d')](handleError(_0x54d393,null));};exports['update']=function(_0xccde2e,_0x7b9f40){if(_0xccde2e[_0x2b77('0x49')]['id']){delete _0xccde2e[_0x2b77('0x49')]['id'];}return db[_0x2b77('0x3a')][_0x2b77('0x41')]({'where':{'id':_0xccde2e[_0x2b77('0x3f')]['id']}})[_0x2b77('0x20')](handleEntityNotFound(_0x7b9f40,null))[_0x2b77('0x20')](saveUpdates(_0xccde2e['body'],null))[_0x2b77('0x20')](respondWithResult(_0x7b9f40,null))[_0x2b77('0x3d')](handleError(_0x7b9f40,null));};exports[_0x2b77('0x21')]=function(_0x252331,_0x45c162){return db[_0x2b77('0x3a')]['find']({'where':{'id':_0x252331['params']['id']}})['then'](handleEntityNotFound(_0x45c162,null))[_0x2b77('0x20')](removeEntity(_0x45c162,null))[_0x2b77('0x3d')](handleError(_0x45c162,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 47d9359..b434e9a 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 _0x7c2b=['./variable.attributes','exports','Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5a36ed,_0x122618){var _0x38f259=function(_0x13c434){while(--_0x13c434){_0x5a36ed['push'](_0x5a36ed['shift']());}};_0x38f259(++_0x122618);}(_0x7c2b,0xc4));var _0xb7c2=function(_0x421317,_0x31f494){_0x421317=_0x421317-0x0;var _0x13d981=_0x7c2b[_0x421317];return _0x13d981;};'use strict';var _=require(_0xb7c2('0x0'));var util=require('util');var logger=require(_0xb7c2('0x1'))(_0xb7c2('0x2'));var moment=require(_0xb7c2('0x3'));var BPromise=require(_0xb7c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7c2('0x5'));var rimraf=require(_0xb7c2('0x6'));var config=require(_0xb7c2('0x7'));var attributes=require(_0xb7c2('0x8'));module[_0xb7c2('0x9')]=function(_0x54c707,_0x16c81c){return _0x54c707['define'](_0xb7c2('0xa'),attributes,{'tableName':_0xb7c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73ae=['./variable.attributes','exports','define','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5f44c3,_0x460f76){var _0x577bf7=function(_0x370579){while(--_0x370579){_0x5f44c3['push'](_0x5f44c3['shift']());}};_0x577bf7(++_0x460f76);}(_0x73ae,0xac));var _0xe73a=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x73ae[_0x34bf97];return _0x292719;};'use strict';var _=require(_0xe73a('0x0'));var util=require('util');var logger=require(_0xe73a('0x1'))(_0xe73a('0x2'));var moment=require(_0xe73a('0x3'));var BPromise=require(_0xe73a('0x4'));var rp=require(_0xe73a('0x5'));var fs=require('fs');var path=require(_0xe73a('0x6'));var rimraf=require('rimraf');var config=require(_0xe73a('0x7'));var attributes=require(_0xe73a('0x8'));module[_0xe73a('0x9')]=function(_0x4bee6f,_0x4fe302){return _0x4bee6f[_0xe73a('0xa')]('Variable',attributes,{'tableName':_0xe73a('0xb'),'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 a7d482f..9f39652 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x55ca,0x126));var _0xa55c=function(_0x5baadf,_0x1bb942){_0x5baadf=_0x5baadf-0x0;var _0x3cd985=_0x55ca[_0x5baadf];return _0x3cd985;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _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(_0x4808d3,_0x3353c6){var _0x3057fa=function(_0x535a58){while(--_0x535a58){_0x4808d3['push'](_0x4808d3['shift']());}};_0x3057fa(++_0x3353c6);}(_0x1cb9,0x14e));var _0x91cb=function(_0x27ce59,_0x3900e4){_0x27ce59=_0x27ce59-0x0;var _0xae0d17=_0x1cb9[_0x27ce59];return _0xae0d17;};'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 45035e2..1354941 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 _0x19c5=['pull','/restart','restart','migrations','exports','express','Router','get','index','isAuthenticated','canUpdate','fetch','reset','/pull'];(function(_0x7262a6,_0x416d47){var _0xd3b6e1=function(_0x344784){while(--_0x344784){_0x7262a6['push'](_0x7262a6['shift']());}};_0xd3b6e1(++_0x416d47);}(_0x19c5,0xbb));var _0x519c=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x19c5[_0x3afe18];return _0x19ed1f;};'use strict';var express=require(_0x519c('0x0'));var router=express[_0x519c('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x519c('0x2')]('/',controller[_0x519c('0x3')]);router[_0x519c('0x2')]('/fetch',auth[_0x519c('0x4')](),auth[_0x519c('0x5')](),controller[_0x519c('0x6')]);router[_0x519c('0x2')]('/reset',auth[_0x519c('0x4')](),auth[_0x519c('0x5')](),controller[_0x519c('0x7')]);router[_0x519c('0x2')](_0x519c('0x8'),auth[_0x519c('0x4')](),auth['canUpdate'](),controller[_0x519c('0x9')]);router['get'](_0x519c('0xa'),auth['isAuthenticated'](),controller[_0x519c('0xb')]);router['get']('/migrations',controller[_0x519c('0xc')]);module[_0x519c('0xd')]=router; \ No newline at end of file +var _0x0ffd=['pull','/restart','restart','/migrations','migrations','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull'];(function(_0x5c1731,_0x45255e){var _0x3af53d=function(_0x52b5d7){while(--_0x52b5d7){_0x5c1731['push'](_0x5c1731['shift']());}};_0x3af53d(++_0x45255e);}(_0x0ffd,0x145));var _0xd0ff=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0ffd[_0x4cf98e];return _0x1623ac;};'use strict';var express=require('express');var router=express[_0xd0ff('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xd0ff('0x1'));router[_0xd0ff('0x2')]('/',controller[_0xd0ff('0x3')]);router[_0xd0ff('0x2')](_0xd0ff('0x4'),auth[_0xd0ff('0x5')](),auth[_0xd0ff('0x6')](),controller[_0xd0ff('0x7')]);router[_0xd0ff('0x2')](_0xd0ff('0x8'),auth[_0xd0ff('0x5')](),auth[_0xd0ff('0x6')](),controller[_0xd0ff('0x9')]);router[_0xd0ff('0x2')](_0xd0ff('0xa'),auth[_0xd0ff('0x5')](),auth['canUpdate'](),controller[_0xd0ff('0xb')]);router[_0xd0ff('0x2')](_0xd0ff('0xc'),auth[_0xd0ff('0x5')](),controller[_0xd0ff('0xd')]);router[_0xd0ff('0x2')](_0xd0ff('0xe'),controller[_0xd0ff('0xf')]);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 f90547f..4c11f93 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 _0x31f3=['git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','exports','latest','tags','status','json','fetch','origin','master','error'];(function(_0x21aafd,_0x1f0fa6){var _0x9f2800=function(_0xf23734){while(--_0xf23734){_0x21aafd['push'](_0x21aafd['shift']());}};_0x9f2800(++_0x1f0fa6);}(_0x31f3,0x123));var _0x331f=function(_0xb93836,_0x2e7941){_0xb93836=_0xb93836-0x0;var _0x2b3e5b=_0x31f3[_0xb93836];return _0x2b3e5b;};'use strict';var Umzug=require(_0x331f('0x0'));var path=require(_0x331f('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x331f('0x2'))(module,_0x331f('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x331f('0x4'))[_0x331f('0x5')];var db=require(_0x331f('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x331f('0x7'));var logger=require(_0x331f('0x8'))(_0x331f('0x9'));var git=require('simple-git')(config[_0x331f('0xa')]);exports[_0x331f('0xb')]=function(_0x52194f,_0x331f32){var _0x2376d5={'current':module[_0x331f('0xc')][_0x331f('0x3')],'phonebar':0x2};if(_0x52194f['query']&&_0x52194f['query'][_0x331f('0xd')]){return git['fetch']()[_0x331f('0xe')](function(_0x2ddf2d,_0x5380d0){_0x2376d5[_0x331f('0xd')]=(_0x2ddf2d?module[_0x331f('0xc')][_0x331f('0x3')]:_0x5380d0[_0x331f('0xd')])||'2.0.0';return _0x331f32[_0x331f('0xf')](0xc8)[_0x331f('0x10')](_0x2376d5);});}else{return _0x331f32[_0x331f('0xf')](0xc8)['json'](_0x2376d5);}};exports[_0x331f('0x11')]=function(_0x4fd8b6,_0x2fef2a){return git['fetch']([_0x331f('0x12'),_0x331f('0x13')],function(_0xd65825){if(_0xd65825){logger[_0x331f('0x14')](_0xd65825);return _0x2fef2a[_0x331f('0xf')](0x1f4)['json'](_0xd65825);}logger['info'](_0x331f('0x15'));return _0x2fef2a[_0x331f('0xf')](0xc8)[_0x331f('0x10')]({'output':_0x331f('0x16')});});};exports[_0x331f('0x17')]=function(_0x888ffc,_0x1d8051){return git['reset']([_0x331f('0x18'),_0x331f('0x19')],function(_0x1dee3b){if(_0x1dee3b){logger[_0x331f('0x14')](_0x1dee3b);return _0x1d8051['status'](0x1f4)['json'](_0x1dee3b);}logger[_0x331f('0x1a')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1d8051[_0x331f('0xf')](0xc8)[_0x331f('0x10')]({'output':_0x331f('0x1b')});});};exports[_0x331f('0x1c')]=function(_0x145cea,_0x28b901){exec(_0x331f('0x1d'),function(_0x1205da,_0x4f3f3c,_0x3960c8){logger['info'](_0x4f3f3c);logger[_0x331f('0x1a')](_0x3960c8);if(_0x1205da){logger[_0x331f('0x14')](_0x1205da);return _0x28b901[_0x331f('0xf')](0x1f4)[_0x331f('0x10')](_0x1205da);}return _0x28b901['status'](0xc8)[_0x331f('0x10')]({'output':_0x4f3f3c});});};exports['restart']=function(_0x27f964,_0x46801a){return pm2[_0x331f('0x1e')](_0x331f('0x1f'))[_0x331f('0x20')](function(_0x452494){logger[_0x331f('0x1a')](_0x331f('0x21'),_0x452494);return _0x46801a[_0x331f('0xf')](0xc8)[_0x331f('0x10')]({'output':_0x331f('0x22')});})[_0x331f('0x23')](function(_0xb119e1){logger[_0x331f('0x14')](_0xb119e1);return _0x46801a[_0x331f('0xf')](0x1f4)['json'](_0xb119e1);});};exports[_0x331f('0x24')]=function(_0xc1dd77,_0x20323c){var _0x52a547=fs[_0x331f('0x25')](path[_0x331f('0x26')](config[_0x331f('0xa')],_0x331f('0x27'),_0x331f('0x24')));var _0x55204a=[];for(var _0x217817=0x0;_0x217817<_0x52a547[_0x331f('0x28')];_0x217817++){var _0x45f29a=_0x52a547[_0x217817]['replace'](_0x331f('0x29'),'');if(compareVersions(module['exports']['version'],_0x45f29a)===-0x1){_0x55204a[_0x331f('0x2a')](_0x45f29a);}}if(_0x55204a[_0x331f('0x28')]){var _0x4da565=_0x55204a[_0x331f('0x2b')](compareVersions);var _0x240e8a=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x331f('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x331f('0x2d')][_0x331f('0x2e')](),db['sequelize']['constructor'],function(){throw new Error(_0x331f('0x2f'));}],'path':path['join'](config[_0x331f('0xa')],'server',_0x331f('0x24')),'pattern':/\.js$/}});_0x240e8a['up']({'migrations':_[_0x331f('0x30')](_0x4da565,function(_0x12f1b9){return _0x12f1b9+_0x331f('0x29');})})[_0x331f('0x20')](function(){return _0x20323c[_0x331f('0xf')](0xc8)[_0x331f('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x331f('0xc')][_0x331f('0x3')]+'\x20to\x20'+_[_0x331f('0x31')](_0x4da565),'migrations':_[_0x331f('0x26')](_0x4da565)});})[_0x331f('0x23')](function(_0x5dbf6a){if(_0x5dbf6a instanceof db[_0x331f('0x2d')][_0x331f('0x32')]){return _0x20323c[_0x331f('0xf')](0xc8)[_0x331f('0x10')]({'output':_0x331f('0x33')});}else{return _0x20323c[_0x331f('0xf')](0x1f4)[_0x331f('0x10')](_0x5dbf6a);}});}else{return _0x20323c['status'](0xc8)['json']({'output':_0x331f('0x33')});}}; \ No newline at end of file +var _0x7be7=['Migration','constructor','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','json','status','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_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','push','length','sort','sequelize'];(function(_0x48ec67,_0x2fdce5){var _0x5d5bc8=function(_0x5c8bba){while(--_0x5c8bba){_0x48ec67['push'](_0x48ec67['shift']());}};_0x5d5bc8(++_0x2fdce5);}(_0x7be7,0x10c));var _0x77be=function(_0x48319a,_0x488a49){_0x48319a=_0x48319a-0x0;var _0xfb1e80=_0x7be7[_0x48319a];return _0xfb1e80;};'use strict';var Umzug=require(_0x77be('0x0'));var path=require(_0x77be('0x1'));var fs=require('fs');var _=require(_0x77be('0x2'));var pkginfo=require(_0x77be('0x3'))(module,_0x77be('0x4'));var compareVersions=require(_0x77be('0x5'));var exec=require(_0x77be('0x6'))['exec'];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x77be('0x7'));var logger=require(_0x77be('0x8'))('update');var git=require(_0x77be('0x9'))(config[_0x77be('0xa')]);exports[_0x77be('0xb')]=function(_0xb661f6,_0x40b87a){var _0x35323e={'current':module[_0x77be('0xc')][_0x77be('0x4')],'phonebar':0x2};if(_0xb661f6[_0x77be('0xd')]&&_0xb661f6[_0x77be('0xd')][_0x77be('0xe')]){return git[_0x77be('0xf')]()[_0x77be('0x10')](function(_0x327364,_0x11ce43){_0x35323e['latest']=(_0x327364?module[_0x77be('0xc')][_0x77be('0x4')]:_0x11ce43['latest'])||_0x77be('0x11');return _0x40b87a['status'](0xc8)[_0x77be('0x12')](_0x35323e);});}else{return _0x40b87a[_0x77be('0x13')](0xc8)['json'](_0x35323e);}};exports['fetch']=function(_0xf959a5,_0x1954dd){return git[_0x77be('0xf')]([_0x77be('0x14'),_0x77be('0x15')],function(_0x53cd9d){if(_0x53cd9d){logger[_0x77be('0x16')](_0x53cd9d);return _0x1954dd['status'](0x1f4)[_0x77be('0x12')](_0x53cd9d);}logger[_0x77be('0x17')]('git\x20fetch');return _0x1954dd['status'](0xc8)[_0x77be('0x12')]({'output':_0x77be('0x18')});});};exports[_0x77be('0x19')]=function(_0x7d71d9,_0x1bd3be){return git[_0x77be('0x19')]([_0x77be('0x1a'),_0x77be('0x1b')],function(_0x485396){if(_0x485396){logger['error'](_0x485396);return _0x1bd3be[_0x77be('0x13')](0x1f4)[_0x77be('0x12')](_0x485396);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1bd3be[_0x77be('0x13')](0xc8)[_0x77be('0x12')]({'output':_0x77be('0x1c')});});};exports[_0x77be('0x1d')]=function(_0x1c7e90,_0x2c4c90){exec('npm\x20install\x20--production',function(_0x39e625,_0x4de2d3,_0x1f2d9d){logger[_0x77be('0x17')](_0x4de2d3);logger['info'](_0x1f2d9d);if(_0x39e625){logger[_0x77be('0x16')](_0x39e625);return _0x2c4c90[_0x77be('0x13')](0x1f4)['json'](_0x39e625);}return _0x2c4c90['status'](0xc8)[_0x77be('0x12')]({'output':_0x4de2d3});});};exports[_0x77be('0x1e')]=function(_0x44fe02,_0x35c903){return pm2[_0x77be('0x1e')](_0x77be('0x1f'))[_0x77be('0x20')](function(_0x2d71b6){logger[_0x77be('0x17')](_0x77be('0x21'),_0x2d71b6);return _0x35c903['status'](0xc8)[_0x77be('0x12')]({'output':_0x77be('0x22')});})[_0x77be('0x23')](function(_0x346fa9){logger[_0x77be('0x16')](_0x346fa9);return _0x35c903[_0x77be('0x13')](0x1f4)[_0x77be('0x12')](_0x346fa9);});};exports[_0x77be('0x24')]=function(_0x4586af,_0x51773e){var _0x15c6c2=fs[_0x77be('0x25')](path[_0x77be('0x26')](config[_0x77be('0xa')],_0x77be('0x27'),_0x77be('0x24')));var _0x1f7750=[];for(var _0x5e860b=0x0;_0x5e860b<_0x15c6c2['length'];_0x5e860b++){var _0x567369=_0x15c6c2[_0x5e860b]['replace']('.js','');if(compareVersions(module[_0x77be('0xc')][_0x77be('0x4')],_0x567369)===-0x1){_0x1f7750[_0x77be('0x28')](_0x567369);}}if(_0x1f7750[_0x77be('0x29')]){var _0x2bd510=_0x1f7750[_0x77be('0x2a')](compareVersions);var _0x5967f5=new Umzug({'storage':_0x77be('0x2b'),'storageOptions':{'model':db[_0x77be('0x2c')],'modelName':_0x77be('0x2c'),'columnName':_0x77be('0x4')},'migrations':{'params':[db[_0x77be('0x2b')]['getQueryInterface'](),db[_0x77be('0x2b')][_0x77be('0x2d')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x77be('0x26')](config[_0x77be('0xa')],_0x77be('0x27'),'migrations'),'pattern':/\.js$/}});_0x5967f5['up']({'migrations':_[_0x77be('0x2e')](_0x2bd510,function(_0x59844e){return _0x59844e+_0x77be('0x2f');})})[_0x77be('0x20')](function(){return _0x51773e[_0x77be('0x13')](0xc8)[_0x77be('0x12')]({'output':_0x77be('0x30')+module['exports'][_0x77be('0x4')]+'\x20to\x20'+_[_0x77be('0x31')](_0x2bd510),'migrations':_[_0x77be('0x26')](_0x2bd510)});})[_0x77be('0x23')](function(_0xc71a4d){if(_0xc71a4d instanceof db[_0x77be('0x2b')][_0x77be('0x32')]){return _0x51773e[_0x77be('0x13')](0xc8)['json']({'output':_0x77be('0x33')});}else{return _0x51773e[_0x77be('0x13')](0x1f4)[_0x77be('0x12')](_0xc71a4d);}});}else{return _0x51773e['status'](0xc8)[_0x77be('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1e4af5a..17fdee4 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 _0xc9c2=['/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x48d151,_0x454064){var _0x3492dd=function(_0x3c3d8b){while(--_0x3c3d8b){_0x48d151['push'](_0x48d151['shift']());}};_0x3492dd(++_0x454064);}(_0xc9c2,0x75));var _0x2c9c=function(_0x70a208,_0x5487d2){_0x70a208=_0x70a208-0x0;var _0x3a2442=_0xc9c2[_0x70a208];return _0x3a2442;};'use strict';var multer=require(_0x2c9c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2c9c('0x1'));var express=require(_0x2c9c('0x2'));var router=express[_0x2c9c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2c9c('0x4'));var interaction=require(_0x2c9c('0x5'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x2c9c('0x6')](),controller['index']);router[_0x2c9c('0x7')](_0x2c9c('0x8'),auth[_0x2c9c('0x6')](),controller['describe']);router[_0x2c9c('0x7')](_0x2c9c('0x9'),auth[_0x2c9c('0x6')](),controller[_0x2c9c('0xa')]);router[_0x2c9c('0xb')]('/',auth[_0x2c9c('0x6')](),controller[_0x2c9c('0xc')]);router[_0x2c9c('0xd')]('/:id',auth[_0x2c9c('0x6')](),controller[_0x2c9c('0xe')]);router[_0x2c9c('0xf')](_0x2c9c('0x9'),auth[_0x2c9c('0x6')](),controller[_0x2c9c('0x10')]);module[_0x2c9c('0x11')]=router; \ No newline at end of file +var _0xc360=['index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0xc360,0x1af));var _0x0c36=function(_0x58a50e,_0x12a952){_0x58a50e=_0x58a50e-0x0;var _0x3b1e57=_0xc360[_0x58a50e];return _0x3b1e57;};'use strict';var multer=require(_0x0c36('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c36('0x1'));var router=express[_0x0c36('0x2')]();var fs_extra=require(_0x0c36('0x3'));var auth=require(_0x0c36('0x4'));var interaction=require(_0x0c36('0x5'));var config=require(_0x0c36('0x6'));var controller=require(_0x0c36('0x7'));router[_0x0c36('0x8')]('/',auth[_0x0c36('0x9')](),controller[_0x0c36('0xa')]);router['get'](_0x0c36('0xb'),auth[_0x0c36('0x9')](),controller[_0x0c36('0xc')]);router[_0x0c36('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0c36('0xd')]('/',auth[_0x0c36('0x9')](),controller[_0x0c36('0xe')]);router[_0x0c36('0xf')](_0x0c36('0x10'),auth[_0x0c36('0x9')](),controller[_0x0c36('0x11')]);router[_0x0c36('0x12')](_0x0c36('0x10'),auth[_0x0c36('0x9')](),controller[_0x0c36('0x13')]);module[_0x0c36('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 5f9faa3..ebb6816 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 _0x9efc=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x4146bf,_0x25c865){var _0x5d189a=function(_0x179884){while(--_0x179884){_0x4146bf['push'](_0x4146bf['shift']());}};_0x5d189a(++_0x25c865);}(_0x9efc,0x19c));var _0xc9ef=function(_0x891c55,_0x233fe8){_0x891c55=_0x891c55-0x0;var _0x260823=_0x9efc[_0x891c55];return _0x260823;};'use strict';var Sequelize=require(_0xc9ef('0x0'));module[_0xc9ef('0x1')]={'type':{'type':Sequelize[_0xc9ef('0x2')]},'uniqueid':{'type':Sequelize[_0xc9ef('0x2')]},'calleridnum':{'type':Sequelize[_0xc9ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc9ef('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xc9ef('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xc9ef('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xc9ef('0x3')]},'holdtime':{'type':Sequelize[_0xc9ef('0x4')]},'agentcomplete':{'type':Sequelize[_0xc9ef('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc9ef('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc9ef('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc9ef('0x4')]},'agentacw':{'type':Sequelize[_0xc9ef('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc9ef('0x4')]},'reason':{'type':Sequelize[_0xc9ef('0x2')]},'lastevent':{'type':Sequelize[_0xc9ef('0x2')]},'channel':{'type':Sequelize[_0xc9ef('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc9ef('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc9ef('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc9ef('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc9ef('0x2')]},'destchannelstate':{'type':Sequelize[_0xc9ef('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc9ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc9ef('0x2')]},'destcalleridname':{'type':Sequelize[_0xc9ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc9ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc9ef('0x2')]},'destlanguage':{'type':Sequelize[_0xc9ef('0x2')]},'destaccountcode':{'type':Sequelize[_0xc9ef('0x2')]},'destcontext':{'type':Sequelize[_0xc9ef('0x2')]},'destexten':{'type':Sequelize[_0xc9ef('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc9ef('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc9ef('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc9ef('0x2')]},'transfer':{'type':Sequelize[_0xc9ef('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc9ef('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc9ef('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc9ef('0x2')]},'agententerreason':{'type':Sequelize[_0xc9ef('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf3aa=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x1ce9ea,_0x32e6f4){_0x1ce9ea=_0x1ce9ea-0x0;var _0x2a95b9=_0xf3aa[_0x1ce9ea];return _0x2a95b9;};'use strict';var Sequelize=require(_0xaf3a('0x0'));module[_0xaf3a('0x1')]={'type':{'type':Sequelize[_0xaf3a('0x2')]},'uniqueid':{'type':Sequelize[_0xaf3a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf3a('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xaf3a('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaf3a('0x3')]},'agentconnectAt':{'type':Sequelize[_0xaf3a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xaf3a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xaf3a('0x3')]},'agentdumpAt':{'type':Sequelize[_0xaf3a('0x3')]},'holdtime':{'type':Sequelize[_0xaf3a('0x4')]},'agentcomplete':{'type':Sequelize[_0xaf3a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xaf3a('0x4')]},'agentacw':{'type':Sequelize[_0xaf3a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xaf3a('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaf3a('0x2')]},'channelstate':{'type':Sequelize[_0xaf3a('0x4')]},'channelstatedesc':{'type':Sequelize[_0xaf3a('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf3a('0x2')]},'connectedlinename':{'type':Sequelize[_0xaf3a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf3a('0x2')]},'context':{'type':Sequelize[_0xaf3a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xaf3a('0x2')]},'destchannel':{'type':Sequelize[_0xaf3a('0x2')]},'destchannelstate':{'type':Sequelize[_0xaf3a('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xaf3a('0x2')]},'destcalleridname':{'type':Sequelize[_0xaf3a('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xaf3a('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xaf3a('0x2')]},'destexten':{'type':Sequelize[_0xaf3a('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xaf3a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaf3a('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xaf3a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaf3a('0x2')],'comment':_0xaf3a('0x6')},'transferexten':{'type':Sequelize[_0xaf3a('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xaf3a('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 ccae0a0..08b2584 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(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 6e2d0bf..ee3e04d 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 _0x3fc6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_agent','uniqueid','lodash','util','../../config/logger'];(function(_0x5f3f95,_0x25cc9d){var _0x2d95b8=function(_0x15d8c1){while(--_0x15d8c1){_0x5f3f95['push'](_0x5f3f95['shift']());}};_0x2d95b8(++_0x25cc9d);}(_0x3fc6,0x159));var _0x63fc=function(_0x4e2343,_0x262e16){_0x4e2343=_0x4e2343-0x0;var _0x17d2e0=_0x3fc6[_0x4e2343];return _0x17d2e0;};'use strict';var _=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var logger=require(_0x63fc('0x2'))('api');var moment=require(_0x63fc('0x3'));var BPromise=require(_0x63fc('0x4'));var rp=require(_0x63fc('0x5'));var fs=require('fs');var path=require(_0x63fc('0x6'));var rimraf=require(_0x63fc('0x7'));var config=require(_0x63fc('0x8'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0xdb65b8,_0x7d24f){return _0xdb65b8[_0x63fc('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x63fc('0xa'),'paranoid':![],'indexes':[{'fields':[_0x63fc('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x14f5=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','util','api','moment','bluebird','path','rimraf'];(function(_0x5d6fa2,_0x384022){var _0x2e5a96=function(_0x2d95c8){while(--_0x2d95c8){_0x5d6fa2['push'](_0x5d6fa2['shift']());}};_0x2e5a96(++_0x384022);}(_0x14f5,0xae));var _0x514f=function(_0x367059,_0x13299d){_0x367059=_0x367059-0x0;var _0x336f1f=_0x14f5[_0x367059];return _0x336f1f;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var logger=require('../../config/logger')(_0x514f('0x1'));var moment=require(_0x514f('0x2'));var BPromise=require(_0x514f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x514f('0x4'));var rimraf=require(_0x514f('0x5'));var config=require('../../config/environment');var attributes=require(_0x514f('0x6'));module[_0x514f('0x7')]=function(_0xc2ca56,_0x434452){return _0xc2ca56[_0x514f('0x8')](_0x514f('0x9'),attributes,{'tableName':_0x514f('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x514f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5c32684..8880a62 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 _0xf146=['stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x29fcea,_0x257199){var _0x243673=function(_0x182f2c){while(--_0x182f2c){_0x29fcea['push'](_0x29fcea['shift']());}};_0x243673(++_0x257199);}(_0xf146,0x73));var _0x6f14=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0xf146[_0x5c4e16];return _0x36044a;};'use strict';var _=require('lodash');var util=require(_0x6f14('0x0'));var moment=require(_0x6f14('0x1'));var BPromise=require(_0x6f14('0x2'));var rs=require(_0x6f14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f14('0x4'))['db'];var utils=require(_0x6f14('0x5'));var logger=require(_0x6f14('0x6'))(_0x6f14('0x7'));var config=require(_0x6f14('0x8'));var jayson=require(_0x6f14('0x9'));var client=jayson[_0x6f14('0xa')][_0x6f14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33171b,_0x5cf621,_0x5d06d0){return new BPromise(function(_0x689552,_0x202b5d){return client['request'](_0x33171b,_0x5d06d0)[_0x6f14('0xc')](function(_0x3eb06a){logger[_0x6f14('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x5cf621,'request\x20sent');logger[_0x6f14('0xe')](_0x6f14('0xf'),_0x5cf621,_0x6f14('0x10'),JSON[_0x6f14('0x11')](_0x3eb06a));if(_0x3eb06a[_0x6f14('0x12')]){if(_0x3eb06a[_0x6f14('0x12')][_0x6f14('0x13')]===0x1f4){logger[_0x6f14('0x12')](_0x6f14('0x14'),_0x5cf621,_0x3eb06a['error'][_0x6f14('0x15')]);return _0x202b5d(_0x3eb06a['error']['message']);}logger[_0x6f14('0x12')](_0x6f14('0x14'),_0x5cf621,_0x3eb06a[_0x6f14('0x12')][_0x6f14('0x15')]);return _0x689552(_0x3eb06a[_0x6f14('0x12')][_0x6f14('0x15')]);}else{logger[_0x6f14('0xd')](_0x6f14('0x14'),_0x5cf621,_0x6f14('0x10'));_0x689552(_0x3eb06a[_0x6f14('0x16')][_0x6f14('0x15')]);}})[_0x6f14('0x17')](function(_0x3d0c2a){logger['error'](_0x6f14('0x14'),_0x5cf621,_0x3d0c2a);_0x202b5d(_0x3d0c2a);});});}exports['CreateVoiceAgentReport']=function(_0x5a8c54){var _0xc5048e=this;return new Promise(function(_0x10ebcd,_0x16a1a8){return db[_0x6f14('0x18')][_0x6f14('0x19')](_0x5a8c54[_0x6f14('0x1a')],{'raw':_0x5a8c54[_0x6f14('0x1b')]?_0x5a8c54['options'][_0x6f14('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x42c96c){logger[_0x6f14('0xd')]('CreateVoiceAgentReport',_0x5a8c54);logger[_0x6f14('0xe')](_0x6f14('0x1d'),_0x5a8c54,JSON[_0x6f14('0x11')](_0x42c96c));_0x10ebcd(_0x42c96c);})[_0x6f14('0x17')](function(_0x34a5f5){logger['error'](_0x6f14('0x1d'),_0x34a5f5[_0x6f14('0x15')],_0x5a8c54);_0x16a1a8(_0xc5048e[_0x6f14('0x12')](0x1f4,_0x34a5f5[_0x6f14('0x15')]));});});};exports[_0x6f14('0x1e')]=function(_0xe344ee){var _0x56e256=this;return new Promise(function(_0x115aeb,_0x4cb01f){return db['VoiceAgentReport'][_0x6f14('0x1f')](_0xe344ee[_0x6f14('0x1a')],{'raw':_0xe344ee[_0x6f14('0x1b')]?_0xe344ee['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe344ee['options']?_0xe344ee['options'][_0x6f14('0x20')]||null:null,'attributes':_0xe344ee[_0x6f14('0x1b')]?_0xe344ee[_0x6f14('0x1b')]['attributes']||null:null,'limit':_0xe344ee[_0x6f14('0x1b')]?_0xe344ee[_0x6f14('0x1b')]['limit']||null:null})[_0x6f14('0xc')](function(_0x4e187e){logger[_0x6f14('0xd')](_0x6f14('0x1e'),_0xe344ee);logger[_0x6f14('0xe')](_0x6f14('0x1e'),_0xe344ee,JSON[_0x6f14('0x11')](_0x4e187e));_0x115aeb(_0x4e187e);})[_0x6f14('0x17')](function(_0x1c21b3){logger[_0x6f14('0x12')](_0x6f14('0x1e'),_0x1c21b3[_0x6f14('0x15')],_0xe344ee);_0x4cb01f(_0x56e256[_0x6f14('0x12')](0x1f4,_0x1c21b3['message']));});});}; \ No newline at end of file +var _0x9bee=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug','catch','UpdateVoiceAgentReport','update','where','attributes','limit','moment','bluebird'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x9bee,0x64));var _0xe9be=function(_0x1836e1,_0xd988ef){_0x1836e1=_0x1836e1-0x0;var _0x1fcbc4=_0x9bee[_0x1836e1];return _0x1fcbc4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe9be('0x0'));var BPromise=require(_0xe9be('0x1'));var rs=require(_0xe9be('0x2'));var fs=require('fs');var Redis=require(_0xe9be('0x3'));var db=require(_0xe9be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9be('0x5'))(_0xe9be('0x6'));var config=require(_0xe9be('0x7'));var jayson=require(_0xe9be('0x8'));var client=jayson[_0xe9be('0x9')][_0xe9be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15de09,_0x553b1e,_0x77d8e4){return new BPromise(function(_0x582e1a,_0x1b986e){return client['request'](_0x15de09,_0x77d8e4)[_0xe9be('0xb')](function(_0x167dc8){logger[_0xe9be('0xc')](_0xe9be('0xd'),_0x553b1e,'request\x20sent');logger['debug'](_0xe9be('0xe'),_0x553b1e,_0xe9be('0xf'),JSON[_0xe9be('0x10')](_0x167dc8));if(_0x167dc8['error']){if(_0x167dc8[_0xe9be('0x11')][_0xe9be('0x12')]===0x1f4){logger['error'](_0xe9be('0xd'),_0x553b1e,_0x167dc8[_0xe9be('0x11')][_0xe9be('0x13')]);return _0x1b986e(_0x167dc8[_0xe9be('0x11')][_0xe9be('0x13')]);}logger['error'](_0xe9be('0xd'),_0x553b1e,_0x167dc8[_0xe9be('0x11')][_0xe9be('0x13')]);return _0x582e1a(_0x167dc8[_0xe9be('0x11')][_0xe9be('0x13')]);}else{logger[_0xe9be('0xc')](_0xe9be('0xd'),_0x553b1e,_0xe9be('0xf'));_0x582e1a(_0x167dc8[_0xe9be('0x14')][_0xe9be('0x13')]);}})['catch'](function(_0x429faf){logger[_0xe9be('0x11')](_0xe9be('0xd'),_0x553b1e,_0x429faf);_0x1b986e(_0x429faf);});});}exports[_0xe9be('0x15')]=function(_0x1a7d67){var _0x1b2fe4=this;return new Promise(function(_0x2dd4a8,_0x1081b4){return db[_0xe9be('0x16')][_0xe9be('0x17')](_0x1a7d67[_0xe9be('0x18')],{'raw':_0x1a7d67[_0xe9be('0x19')]?_0x1a7d67[_0xe9be('0x19')][_0xe9be('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x37671b){logger[_0xe9be('0xc')](_0xe9be('0x15'),_0x1a7d67);logger[_0xe9be('0x1b')](_0xe9be('0x15'),_0x1a7d67,JSON[_0xe9be('0x10')](_0x37671b));_0x2dd4a8(_0x37671b);})[_0xe9be('0x1c')](function(_0x7bffe){logger[_0xe9be('0x11')](_0xe9be('0x15'),_0x7bffe['message'],_0x1a7d67);_0x1081b4(_0x1b2fe4[_0xe9be('0x11')](0x1f4,_0x7bffe['message']));});});};exports[_0xe9be('0x1d')]=function(_0x3f43cc){var _0x409229=this;return new Promise(function(_0x59e3e4,_0x25cda1){return db[_0xe9be('0x16')][_0xe9be('0x1e')](_0x3f43cc[_0xe9be('0x18')],{'raw':_0x3f43cc[_0xe9be('0x19')]?_0x3f43cc[_0xe9be('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f43cc[_0xe9be('0x19')]?_0x3f43cc[_0xe9be('0x19')][_0xe9be('0x1f')]||null:null,'attributes':_0x3f43cc[_0xe9be('0x19')]?_0x3f43cc[_0xe9be('0x19')][_0xe9be('0x20')]||null:null,'limit':_0x3f43cc[_0xe9be('0x19')]?_0x3f43cc[_0xe9be('0x19')][_0xe9be('0x21')]||null:null})[_0xe9be('0xb')](function(_0x269c2e){logger[_0xe9be('0xc')]('UpdateVoiceAgentReport',_0x3f43cc);logger[_0xe9be('0x1b')](_0xe9be('0x1d'),_0x3f43cc,JSON[_0xe9be('0x10')](_0x269c2e));_0x59e3e4(_0x269c2e);})['catch'](function(_0x28ea11){logger[_0xe9be('0x11')](_0xe9be('0x1d'),_0x28ea11['message'],_0x3f43cc);_0x25cda1(_0x409229['error'](0x1f4,_0x28ea11['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 776ee28..3dbfb1b 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 _0x7fbe=['/describe','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x54aa1c,_0x2fe1fd){var _0x3534f7=function(_0x5495ce){while(--_0x5495ce){_0x54aa1c['push'](_0x54aa1c['shift']());}};_0x3534f7(++_0x2fe1fd);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x33c562,_0x54f29c){_0x33c562=_0x33c562-0x0;var _0x4199e3=_0x7fbe[_0x33c562];return _0x4199e3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x3a87d1,_0x584e71){var _0x3aa6d8=function(_0x1e1417){while(--_0x1e1417){_0x3a87d1['push'](_0x3a87d1['shift']());}};_0x3aa6d8(++_0x584e71);}(_0x84ab,0x12f));var _0xb84a=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0x84ab[_0x10e983];return _0x324138;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index e4f9642..a42fb08 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 _0xe127=['DATE','INTEGER','exports','STRING','inbound','internal','outbound','outbound-fax','dialer','TEXT'];(function(_0x31dadb,_0xc1d00b){var _0x1ac476=function(_0x1e7aa6){while(--_0x1e7aa6){_0x31dadb['push'](_0x31dadb['shift']());}};_0x1ac476(++_0xc1d00b);}(_0xe127,0x1e2));var _0x7e12=function(_0x3329ad,_0x2d0e9d){_0x3329ad=_0x3329ad-0x0;var _0x1c71cf=_0xe127[_0x3329ad];return _0x1c71cf;};'use strict';var Sequelize=require('sequelize');module[_0x7e12('0x0')]={'uniqueid':{'type':Sequelize[_0x7e12('0x1')]},'type':{'type':Sequelize['ENUM'](_0x7e12('0x2'),_0x7e12('0x3'),_0x7e12('0x4'),'inbound-fax',_0x7e12('0x5'),_0x7e12('0x6'))},'tag':{'type':Sequelize[_0x7e12('0x1')]},'accountcode':{'type':Sequelize[_0x7e12('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x7e12('0x1')]},'callerid':{'type':Sequelize[_0x7e12('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7e12('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x7e12('0x7')]},'starttime':{'type':Sequelize[_0x7e12('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x7e12('0x8')]},'endtime':{'type':Sequelize[_0x7e12('0x8')]},'duration':{'type':Sequelize[_0x7e12('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x7e12('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7e12('0x1')]},'userfield':{'type':Sequelize[_0x7e12('0x1')]},'userDisposition':{'type':Sequelize[_0x7e12('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x7e12('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x7e12('0x1')]},'note':{'type':Sequelize[_0x7e12('0x1')]},'prefix':{'type':Sequelize[_0x7e12('0x1')]},'routeid':{'type':Sequelize[_0x7e12('0x9')]},'sipcallid':{'type':Sequelize[_0x7e12('0x1')]}}; \ No newline at end of file +var _0xf29c=['STRING','inbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x30bf81,_0x4c00c5){var _0x148a30=function(_0x320430){while(--_0x320430){_0x30bf81['push'](_0x30bf81['shift']());}};_0x148a30(++_0x4c00c5);}(_0xf29c,0xf1));var _0xcf29=function(_0xcde8ed,_0x27b300){_0xcde8ed=_0xcde8ed-0x0;var _0x3492b8=_0xf29c[_0xcde8ed];return _0x3492b8;};'use strict';var Sequelize=require(_0xcf29('0x0'));module[_0xcf29('0x1')]={'uniqueid':{'type':Sequelize[_0xcf29('0x2')]},'type':{'type':Sequelize['ENUM'](_0xcf29('0x3'),'internal','outbound',_0xcf29('0x4'),'outbound-fax',_0xcf29('0x5'))},'tag':{'type':Sequelize[_0xcf29('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xcf29('0x2')]},'destination':{'type':Sequelize[_0xcf29('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xcf29('0x2')]},'channel':{'type':Sequelize[_0xcf29('0x2')]},'destinationchannel':{'type':Sequelize[_0xcf29('0x2')]},'lastapplication':{'type':Sequelize[_0xcf29('0x2')]},'lastdata':{'type':Sequelize[_0xcf29('0x6')]},'starttime':{'type':Sequelize[_0xcf29('0x7')]},'systemanswertime':{'type':Sequelize[_0xcf29('0x7')]},'answertime':{'type':Sequelize[_0xcf29('0x7')]},'endtime':{'type':Sequelize[_0xcf29('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xcf29('0x8')]},'mohtime':{'type':Sequelize[_0xcf29('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xcf29('0x2')]},'userfield':{'type':Sequelize[_0xcf29('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xcf29('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xcf29('0x2')]},'note':{'type':Sequelize[_0xcf29('0x2')]},'prefix':{'type':Sequelize[_0xcf29('0x2')]},'routeid':{'type':Sequelize[_0xcf29('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 065b8e8..f6c6be6 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x1d6007,_0x3eb09d){_0x1d6007=_0x1d6007-0x0;var _0x5401bb=_0x2032[_0x1d6007];return _0x5401bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x4e4eea,_0x598d81){var _0xf52a6e=function(_0x1e5cc9){while(--_0x1e5cc9){_0x4e4eea['push'](_0x4e4eea['shift']());}};_0xf52a6e(++_0x598d81);}(_0x0b0e,0x187));var _0xe0b0=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x0b0e[_0x46ae5a];return _0x434986;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1e915a5..8c79856 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 _0x84fd=['exports','VoiceCallReport','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0x84fd,0xda));var _0xd84f=function(_0x1c437e,_0x3d63e2){_0x1c437e=_0x1c437e-0x0;var _0x2a22be=_0x84fd[_0x1c437e];return _0x2a22be;};'use strict';var _=require(_0xd84f('0x0'));var util=require(_0xd84f('0x1'));var logger=require(_0xd84f('0x2'))(_0xd84f('0x3'));var moment=require(_0xd84f('0x4'));var BPromise=require(_0xd84f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd84f('0x6'));var rimraf=require(_0xd84f('0x7'));var config=require(_0xd84f('0x8'));var attributes=require(_0xd84f('0x9'));module[_0xd84f('0xa')]=function(_0x58bf4e,_0x19f320){return _0x58bf4e['define'](_0xd84f('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d6b=['../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4f5318,_0x5f13a1){var _0x2f09db=function(_0x13c00d){while(--_0x13c00d){_0x4f5318['push'](_0x4f5318['shift']());}};_0x2f09db(++_0x5f13a1);}(_0x8d6b,0x124));var _0xb8d6=function(_0x2034eb,_0x395619){_0x2034eb=_0x2034eb-0x0;var _0x1a7dba=_0x8d6b[_0x2034eb];return _0x1a7dba;};'use strict';var _=require(_0xb8d6('0x0'));var util=require(_0xb8d6('0x1'));var logger=require(_0xb8d6('0x2'))(_0xb8d6('0x3'));var moment=require(_0xb8d6('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8d6('0x5'));var fs=require('fs');var path=require(_0xb8d6('0x6'));var rimraf=require(_0xb8d6('0x7'));var config=require(_0xb8d6('0x8'));var attributes=require(_0xb8d6('0x9'));module['exports']=function(_0x2a40a2,_0x1b38fa){return _0x2a40a2['define'](_0xb8d6('0xa'),attributes,{'tableName':_0xb8d6('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5795395..4bc7006 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 _0x877f=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','options','raw','where','limit','include','map','model','attributes','catch','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','util','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x877f,0x12d));var _0xf877=function(_0xb044b0,_0x39a080){_0xb044b0=_0xb044b0-0x0;var _0x1f6ec2=_0x877f[_0xb044b0];return _0x1f6ec2;};'use strict';var _=require(_0xf877('0x0'));var util=require(_0xf877('0x1'));var moment=require(_0xf877('0x2'));var BPromise=require(_0xf877('0x3'));var rs=require(_0xf877('0x4'));var fs=require('fs');var Redis=require(_0xf877('0x5'));var db=require(_0xf877('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf877('0x7'));var config=require(_0xf877('0x8'));var jayson=require(_0xf877('0x9'));var client=jayson[_0xf877('0xa')][_0xf877('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x279c97,_0x3b1bea,_0x49f8f5){return new BPromise(function(_0x4e55ef,_0x398218){return client['request'](_0x279c97,_0x49f8f5)[_0xf877('0xc')](function(_0x33de16){logger[_0xf877('0xd')](_0xf877('0xe'),_0x3b1bea,_0xf877('0xf'));logger[_0xf877('0x10')](_0xf877('0x11'),_0x3b1bea,_0xf877('0xf'),JSON[_0xf877('0x12')](_0x33de16));if(_0x33de16['error']){if(_0x33de16[_0xf877('0x13')][_0xf877('0x14')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3b1bea,_0x33de16['error'][_0xf877('0x15')]);return _0x398218(_0x33de16[_0xf877('0x13')]['message']);}logger['error'](_0xf877('0xe'),_0x3b1bea,_0x33de16[_0xf877('0x13')][_0xf877('0x15')]);return _0x4e55ef(_0x33de16[_0xf877('0x13')]['message']);}else{logger[_0xf877('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x3b1bea,'request\x20sent');_0x4e55ef(_0x33de16[_0xf877('0x16')][_0xf877('0x15')]);}})['catch'](function(_0x12b8eb){logger['error'](_0xf877('0xe'),_0x3b1bea,_0x12b8eb);_0x398218(_0x12b8eb);});});}exports[_0xf877('0x17')]=function(_0x549194){var _0x2c0264=this;return new Promise(function(_0x3db869,_0x5ee26f){return db[_0xf877('0x18')]['findAll']({'raw':_0x549194[_0xf877('0x19')]?_0x549194[_0xf877('0x19')][_0xf877('0x1a')]===undefined?!![]:![]:!![],'where':_0x549194[_0xf877('0x19')]?_0x549194[_0xf877('0x19')][_0xf877('0x1b')]||null:null,'attributes':_0x549194['options']?_0x549194[_0xf877('0x19')]['attributes']||null:null,'limit':_0x549194['options']?_0x549194[_0xf877('0x19')][_0xf877('0x1c')]||null:null,'include':_0x549194[_0xf877('0x19')]?_0x549194[_0xf877('0x19')][_0xf877('0x1d')]?_[_0xf877('0x1e')](_0x549194[_0xf877('0x19')][_0xf877('0x1d')],function(_0x498505){return{'model':db[_0x498505[_0xf877('0x1f')]],'as':_0x498505['as'],'attributes':_0x498505[_0xf877('0x20')],'include':_0x498505['include']?_[_0xf877('0x1e')](_0x498505[_0xf877('0x1d')],function(_0x52d9f5){return{'model':db[_0x52d9f5[_0xf877('0x1f')]],'as':_0x52d9f5['as'],'attributes':_0x52d9f5['attributes'],'include':_0x52d9f5[_0xf877('0x1d')]?_[_0xf877('0x1e')](_0x52d9f5['include'],function(_0x5958b2){return{'model':db[_0x5958b2[_0xf877('0x1f')]],'as':_0x5958b2['as'],'attributes':_0x5958b2['attributes']};}):[]};}):[]};}):[]:[]})[_0xf877('0xc')](function(_0x518a28){logger[_0xf877('0xd')](_0xf877('0x17'),_0x549194);logger[_0xf877('0x10')](_0xf877('0x17'),_0x549194,JSON[_0xf877('0x12')](_0x518a28));_0x3db869(_0x518a28);})[_0xf877('0x21')](function(_0x3ff387){logger[_0xf877('0x13')]('GetVoiceCallReport',_0x3ff387[_0xf877('0x15')],_0x549194);_0x5ee26f(_0x2c0264[_0xf877('0x13')](0x1f4,_0x3ff387[_0xf877('0x15')]));});});};exports[_0xf877('0x22')]=function(_0xd6972c){var _0x14f3d5=this;return new Promise(function(_0x41ee7d,_0x375e78){return db[_0xf877('0x18')]['create'](_0xd6972c['body'],{'raw':_0xd6972c[_0xf877('0x19')]?_0xd6972c['options']['raw']===undefined?!![]:![]:!![]})[_0xf877('0xc')](function(_0x2c5247){logger[_0xf877('0xd')]('CreateVoiceCallReport',_0xd6972c);logger[_0xf877('0x10')](_0xf877('0x22'),_0xd6972c,JSON[_0xf877('0x12')](_0x2c5247));_0x41ee7d(_0x2c5247);})[_0xf877('0x21')](function(_0x123813){logger[_0xf877('0x13')](_0xf877('0x22'),_0x123813['message'],_0xd6972c);_0x375e78(_0x14f3d5[_0xf877('0x13')](0x1f4,_0x123813['message']));});});};exports[_0xf877('0x23')]=function(_0xdc17bc){var _0x3d6e57=this;return new Promise(function(_0x19d4e7,_0x15e080){return db[_0xf877('0x18')][_0xf877('0x24')](_0xdc17bc[_0xf877('0x25')],{'raw':_0xdc17bc[_0xf877('0x19')]?_0xdc17bc[_0xf877('0x19')][_0xf877('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdc17bc['options']?_0xdc17bc[_0xf877('0x19')][_0xf877('0x1b')]||null:null,'attributes':_0xdc17bc[_0xf877('0x19')]?_0xdc17bc[_0xf877('0x19')][_0xf877('0x20')]||null:null,'limit':_0xdc17bc[_0xf877('0x19')]?_0xdc17bc['options'][_0xf877('0x1c')]||null:null})['then'](function(_0x1e2a62){logger[_0xf877('0xd')](_0xf877('0x23'),_0xdc17bc);logger['debug'](_0xf877('0x23'),_0xdc17bc,JSON[_0xf877('0x12')](_0x1e2a62));_0x19d4e7(_0x1e2a62);})[_0xf877('0x21')](function(_0x3b0d0c){logger['error'](_0xf877('0x23'),_0x3b0d0c[_0xf877('0x15')],_0xdc17bc);_0x15e080(_0x3d6e57['error'](0x1f4,_0x3b0d0c[_0xf877('0x15')]));});});}; \ No newline at end of file +var _0x2c36=['options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','VoiceCallReport','findAll'];(function(_0x125c6b,_0x3396bd){var _0x49b36f=function(_0x14a408){while(--_0x14a408){_0x125c6b['push'](_0x125c6b['shift']());}};_0x49b36f(++_0x3396bd);}(_0x2c36,0x177));var _0x62c3=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x2c36[_0x145b3c];return _0x1b6e36;};'use strict';var _=require(_0x62c3('0x0'));var util=require('util');var moment=require(_0x62c3('0x1'));var BPromise=require(_0x62c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62c3('0x3'));var db=require(_0x62c3('0x4'))['db'];var utils=require(_0x62c3('0x5'));var logger=require(_0x62c3('0x6'))(_0x62c3('0x7'));var config=require('../../config/environment');var jayson=require(_0x62c3('0x8'));var client=jayson[_0x62c3('0x9')][_0x62c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fc103,_0x207941,_0x678aa6){return new BPromise(function(_0x410c82,_0x1b6c83){return client[_0x62c3('0xb')](_0x3fc103,_0x678aa6)[_0x62c3('0xc')](function(_0x3bccc0){logger['info'](_0x62c3('0xd'),_0x207941,'request\x20sent');logger['debug'](_0x62c3('0xe'),_0x207941,'request\x20sent',JSON[_0x62c3('0xf')](_0x3bccc0));if(_0x3bccc0['error']){if(_0x3bccc0[_0x62c3('0x10')][_0x62c3('0x11')]===0x1f4){logger['error'](_0x62c3('0xd'),_0x207941,_0x3bccc0[_0x62c3('0x10')][_0x62c3('0x12')]);return _0x1b6c83(_0x3bccc0[_0x62c3('0x10')][_0x62c3('0x12')]);}logger[_0x62c3('0x10')](_0x62c3('0xd'),_0x207941,_0x3bccc0['error'][_0x62c3('0x12')]);return _0x410c82(_0x3bccc0[_0x62c3('0x10')][_0x62c3('0x12')]);}else{logger[_0x62c3('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x207941,_0x62c3('0x14'));_0x410c82(_0x3bccc0[_0x62c3('0x15')][_0x62c3('0x12')]);}})[_0x62c3('0x16')](function(_0x39d950){logger[_0x62c3('0x10')](_0x62c3('0xd'),_0x207941,_0x39d950);_0x1b6c83(_0x39d950);});});}exports['GetVoiceCallReport']=function(_0x17b42a){var _0x4546e8=this;return new Promise(function(_0x4c4fe4,_0x5e68bb){return db[_0x62c3('0x17')][_0x62c3('0x18')]({'raw':_0x17b42a[_0x62c3('0x19')]?_0x17b42a[_0x62c3('0x19')][_0x62c3('0x1a')]===undefined?!![]:![]:!![],'where':_0x17b42a[_0x62c3('0x19')]?_0x17b42a['options'][_0x62c3('0x1b')]||null:null,'attributes':_0x17b42a[_0x62c3('0x19')]?_0x17b42a[_0x62c3('0x19')][_0x62c3('0x1c')]||null:null,'limit':_0x17b42a[_0x62c3('0x19')]?_0x17b42a[_0x62c3('0x19')][_0x62c3('0x1d')]||null:null,'include':_0x17b42a[_0x62c3('0x19')]?_0x17b42a['options'][_0x62c3('0x1e')]?_[_0x62c3('0x1f')](_0x17b42a[_0x62c3('0x19')][_0x62c3('0x1e')],function(_0x4d753b){return{'model':db[_0x4d753b[_0x62c3('0x20')]],'as':_0x4d753b['as'],'attributes':_0x4d753b['attributes'],'include':_0x4d753b[_0x62c3('0x1e')]?_['map'](_0x4d753b[_0x62c3('0x1e')],function(_0x1fbc27){return{'model':db[_0x1fbc27[_0x62c3('0x20')]],'as':_0x1fbc27['as'],'attributes':_0x1fbc27[_0x62c3('0x1c')],'include':_0x1fbc27[_0x62c3('0x1e')]?_[_0x62c3('0x1f')](_0x1fbc27['include'],function(_0x22b6a1){return{'model':db[_0x22b6a1[_0x62c3('0x20')]],'as':_0x22b6a1['as'],'attributes':_0x22b6a1[_0x62c3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x62c3('0xc')](function(_0x31966d){logger[_0x62c3('0x13')](_0x62c3('0x21'),_0x17b42a);logger[_0x62c3('0x22')]('GetVoiceCallReport',_0x17b42a,JSON[_0x62c3('0xf')](_0x31966d));_0x4c4fe4(_0x31966d);})[_0x62c3('0x16')](function(_0x5bf0d6){logger[_0x62c3('0x10')](_0x62c3('0x21'),_0x5bf0d6[_0x62c3('0x12')],_0x17b42a);_0x5e68bb(_0x4546e8[_0x62c3('0x10')](0x1f4,_0x5bf0d6[_0x62c3('0x12')]));});});};exports[_0x62c3('0x23')]=function(_0x281c86){var _0x107b6d=this;return new Promise(function(_0x128ae3,_0x7024ce){return db[_0x62c3('0x17')][_0x62c3('0x24')](_0x281c86[_0x62c3('0x25')],{'raw':_0x281c86['options']?_0x281c86[_0x62c3('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x62c3('0xc')](function(_0x4afdca){logger[_0x62c3('0x13')]('CreateVoiceCallReport',_0x281c86);logger[_0x62c3('0x22')](_0x62c3('0x23'),_0x281c86,JSON[_0x62c3('0xf')](_0x4afdca));_0x128ae3(_0x4afdca);})[_0x62c3('0x16')](function(_0x730add){logger[_0x62c3('0x10')](_0x62c3('0x23'),_0x730add[_0x62c3('0x12')],_0x281c86);_0x7024ce(_0x107b6d['error'](0x1f4,_0x730add[_0x62c3('0x12')]));});});};exports[_0x62c3('0x26')]=function(_0x415a76){var _0x53e6b9=this;return new Promise(function(_0x36ba24,_0x27b75c){return db['VoiceCallReport'][_0x62c3('0x27')](_0x415a76[_0x62c3('0x25')],{'raw':_0x415a76[_0x62c3('0x19')]?_0x415a76[_0x62c3('0x19')][_0x62c3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x415a76[_0x62c3('0x19')]?_0x415a76[_0x62c3('0x19')][_0x62c3('0x1b')]||null:null,'attributes':_0x415a76[_0x62c3('0x19')]?_0x415a76[_0x62c3('0x19')]['attributes']||null:null,'limit':_0x415a76[_0x62c3('0x19')]?_0x415a76[_0x62c3('0x19')][_0x62c3('0x1d')]||null:null})['then'](function(_0x265e02){logger[_0x62c3('0x13')](_0x62c3('0x26'),_0x415a76);logger[_0x62c3('0x22')]('UpdateVoiceCallReport',_0x415a76,JSON['stringify'](_0x265e02));_0x36ba24(_0x265e02);})[_0x62c3('0x16')](function(_0xd2652b){logger[_0x62c3('0x10')](_0x62c3('0x26'),_0xd2652b[_0x62c3('0x12')],_0x415a76);_0x27b75c(_0x53e6b9[_0x62c3('0x10')](0x1f4,_0xd2652b[_0x62c3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c6cc83d..79aff6f 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 _0x3ffb=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ffb,0xc0));var _0xb3ff=function(_0x2e1a30,_0x23244d){_0x2e1a30=_0x2e1a30-0x0;var _0x556468=_0x3ffb[_0x2e1a30];return _0x556468;};'use strict';var multer=require('multer');var util=require(_0xb3ff('0x0'));var path=require(_0xb3ff('0x1'));var timeout=require(_0xb3ff('0x2'));var express=require(_0xb3ff('0x3'));var router=express[_0xb3ff('0x4')]();var fs_extra=require(_0xb3ff('0x5'));var auth=require(_0xb3ff('0x6'));var interaction=require(_0xb3ff('0x7'));var config=require('../../config/environment');var controller=require(_0xb3ff('0x8'));router[_0xb3ff('0x9')]('/',auth[_0xb3ff('0xa')](),controller[_0xb3ff('0xb')]);router[_0xb3ff('0x9')](_0xb3ff('0xc'),auth[_0xb3ff('0xa')](),controller[_0xb3ff('0xd')]);router[_0xb3ff('0xe')]('/',auth['isAuthenticated'](),controller[_0xb3ff('0xf')]);router['put'](_0xb3ff('0xc'),auth[_0xb3ff('0xa')](),controller[_0xb3ff('0x10')]);router[_0xb3ff('0x11')](_0xb3ff('0xc'),auth[_0xb3ff('0xa')](),controller[_0xb3ff('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4d22=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','update'];(function(_0xbc78b,_0x1fd37d){var _0x24fb2e=function(_0x52f46e){while(--_0x52f46e){_0xbc78b['push'](_0xbc78b['shift']());}};_0x24fb2e(++_0x1fd37d);}(_0x4d22,0xa2));var _0x24d2=function(_0x488784,_0x2d04cf){_0x488784=_0x488784-0x0;var _0x10d1fa=_0x4d22[_0x488784];return _0x10d1fa;};'use strict';var multer=require(_0x24d2('0x0'));var util=require(_0x24d2('0x1'));var path=require(_0x24d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x24d2('0x3'));var router=express[_0x24d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x24d2('0x5'));var interaction=require(_0x24d2('0x6'));var config=require(_0x24d2('0x7'));var controller=require(_0x24d2('0x8'));router[_0x24d2('0x9')]('/',auth[_0x24d2('0xa')](),controller[_0x24d2('0xb')]);router['get'](_0x24d2('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x24d2('0xa')](),controller['create']);router['put']('/:id',auth[_0x24d2('0xa')](),controller[_0x24d2('0xd')]);router['delete']('/:id',auth[_0x24d2('0xa')](),controller[_0x24d2('0xe')]);module[_0x24d2('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 84d97c2..97b849e 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 _0x6b27=['setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','STRING','name'];(function(_0x49dfa9,_0x536598){var _0xdd2949=function(_0x1ebcad){while(--_0x1ebcad){_0x49dfa9['push'](_0x49dfa9['shift']());}};_0xdd2949(++_0x536598);}(_0x6b27,0x1a4));var _0x76b2=function(_0x4acfb9,_0x157698){_0x4acfb9=_0x4acfb9-0x0;var _0x23554d=_0x6b27[_0x4acfb9];return _0x23554d;};'use strict';var Sequelize=require(_0x76b2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x76b2('0x1')],'unique':_0x76b2('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x192f52){this[_0x76b2('0x3')](_0x76b2('0x4'),_0x192f52?_0x192f52[_0x76b2('0x5')](''):[]);},'get':function(){return this[_0x76b2('0x6')](_0x76b2('0x4'))?this['getDataValue'](_0x76b2('0x4'))[_0x76b2('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x76b2('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x76b2('0x1')]},'description':{'type':Sequelize[_0x76b2('0x1')]}}; \ No newline at end of file +var _0x68cf=['options','split','sequelize','exports','STRING','setDataValue','join','getDataValue'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x68cf,0xaa));var _0xf68c=function(_0x128e8b,_0x5f0f53){_0x128e8b=_0x128e8b-0x0;var _0xe0f3db=_0x68cf[_0x128e8b];return _0xe0f3db;};'use strict';var Sequelize=require(_0xf68c('0x0'));module[_0xf68c('0x1')]={'name':{'type':Sequelize[_0xf68c('0x2')]},'prefix':{'type':Sequelize[_0xf68c('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x3d4ee7){this[_0xf68c('0x3')]('options',_0x3d4ee7?_0x3d4ee7[_0xf68c('0x4')](''):[]);},'get':function(){return this[_0xf68c('0x5')](_0xf68c('0x6'))?this[_0xf68c('0x5')]('options')[_0xf68c('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xf68c('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf68c('0x2')]},'description':{'type':Sequelize[_0xf68c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b666358..d12aa73 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 _0x44f8=['moment','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','update','then','get','ChanSpies','UserProfileResource','destroy','end','name','index','map','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','where','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3983ff,_0x27b229){var _0x146863=function(_0x3a9fa2){while(--_0x3a9fa2){_0x3983ff['push'](_0x3983ff['shift']());}};_0x146863(++_0x27b229);}(_0x44f8,0x1de));var _0x844f=function(_0x7c8c7d,_0x33ee0f){_0x7c8c7d=_0x7c8c7d-0x0;var _0x4773d0=_0x44f8[_0x7c8c7d];return _0x4773d0;};'use strict';var emlformat=require(_0x844f('0x0'));var rimraf=require(_0x844f('0x1'));var zipdir=require(_0x844f('0x2'));var jsonpatch=require(_0x844f('0x3'));var rp=require(_0x844f('0x4'));var moment=require(_0x844f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x844f('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x844f('0x7'));var fs=require('fs');var fs_extra=require(_0x844f('0x8'));var _=require(_0x844f('0x9'));var squel=require(_0x844f('0xa'));var crypto=require(_0x844f('0xb'));var jsforce=require(_0x844f('0xc'));var deskjs=require(_0x844f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x844f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x844f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x844f('0x10'));var config=require(_0x844f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x844f('0x12'))['db'];function respondWithStatusCode(_0x110dc2,_0x2320fc){_0x2320fc=_0x2320fc||0xcc;return function(_0x5ea542){if(_0x5ea542){return _0x110dc2['sendStatus'](_0x2320fc);}return _0x110dc2[_0x844f('0x13')](_0x2320fc)['end']();};}function respondWithResult(_0x3137c1,_0x31a0d9){_0x31a0d9=_0x31a0d9||0xc8;return function(_0x449887){if(_0x449887){return _0x3137c1[_0x844f('0x13')](_0x31a0d9)[_0x844f('0x14')](_0x449887);}};}function respondWithFilteredResult(_0x486fa0,_0x5da4ab){return function(_0x1b04a9){if(_0x1b04a9){var _0x149f21=typeof _0x5da4ab[_0x844f('0x15')]===_0x844f('0x16')&&typeof _0x5da4ab['limit']===_0x844f('0x16');var _0x547881=_0x1b04a9['count'];var _0x1f96d0=_0x149f21?0x0:_0x5da4ab[_0x844f('0x15')];var _0x5cc55c=_0x149f21?_0x1b04a9[_0x844f('0x17')]:_0x5da4ab['offset']+_0x5da4ab['limit'];var _0x31431e;if(_0x5cc55c>=_0x547881){_0x5cc55c=_0x547881;_0x31431e=0xc8;}else{_0x31431e=0xce;}_0x486fa0['status'](_0x31431e);return _0x486fa0[_0x844f('0x18')](_0x844f('0x19'),_0x1f96d0+'-'+_0x5cc55c+'/'+_0x547881)[_0x844f('0x14')](_0x1b04a9);}return null;};}function patchUpdates(_0x38e732){return function(_0x3f5060){try{jsonpatch['apply'](_0x3f5060,_0x38e732,!![]);}catch(_0x270be6){return BPromise['reject'](_0x270be6);}return _0x3f5060['save']();};}function saveUpdates(_0x3f83cd,_0x4261b6){return function(_0x1b2037){if(_0x1b2037){return _0x1b2037[_0x844f('0x1a')](_0x3f83cd)[_0x844f('0x1b')](function(_0x523f49){return _0x523f49;});}return null;};}function removeEntity(_0x189523,_0x4bd66d){return function(_0x22c055){if(_0x22c055){return _0x22c055['destroy']()[_0x844f('0x1b')](function(){var _0x19b96a=_0x22c055[_0x844f('0x1c')]({'plain':!![]});var _0x7dc0c9=_0x844f('0x1d');return db[_0x844f('0x1e')][_0x844f('0x1f')]({'where':{'type':_0x7dc0c9,'resourceId':_0x19b96a['id']}})['then'](function(){return _0x22c055;});})[_0x844f('0x1b')](function(){_0x189523[_0x844f('0x13')](0xcc)[_0x844f('0x20')]();});}};}function handleEntityNotFound(_0x1ad3da,_0x29c4c3){return function(_0x29d224){if(!_0x29d224){_0x1ad3da['sendStatus'](0x194);}return _0x29d224;};}function handleError(_0x3d8bc1,_0xa8ca5b){_0xa8ca5b=_0xa8ca5b||0x1f4;return function(_0x3f62f1){logger['error'](_0x3f62f1['stack']);if(_0x3f62f1[_0x844f('0x21')]){delete _0x3f62f1[_0x844f('0x21')];}_0x3d8bc1[_0x844f('0x13')](_0xa8ca5b)['send'](_0x3f62f1);};}exports[_0x844f('0x22')]=function(_0x55de3e,_0x2a0dc9){var _0x259d8e={},_0x516fe7={},_0x49e801={'count':0x0,'rows':[]};var _0x24319c=_[_0x844f('0x23')](db['VoiceChanSpy']['rawAttributes'],function(_0x3382d4){return{'name':_0x3382d4[_0x844f('0x24')],'type':_0x3382d4[_0x844f('0x25')]['key']};});_0x516fe7[_0x844f('0x26')]=_[_0x844f('0x23')](_0x24319c,_0x844f('0x21'));_0x516fe7[_0x844f('0x27')]=_['keys'](_0x55de3e[_0x844f('0x27')]);_0x516fe7[_0x844f('0x28')]=_[_0x844f('0x29')](_0x516fe7[_0x844f('0x26')],_0x516fe7[_0x844f('0x27')]);_0x259d8e[_0x844f('0x2a')]=_[_0x844f('0x29')](_0x516fe7[_0x844f('0x26')],qs['fields'](_0x55de3e[_0x844f('0x27')]['fields']));_0x259d8e[_0x844f('0x2a')]=_0x259d8e[_0x844f('0x2a')][_0x844f('0x2b')]?_0x259d8e[_0x844f('0x2a')]:_0x516fe7['model'];if(!_0x55de3e[_0x844f('0x27')][_0x844f('0x2c')]('nolimit')){_0x259d8e[_0x844f('0x2d')]=qs[_0x844f('0x2d')](_0x55de3e[_0x844f('0x27')][_0x844f('0x2d')]);_0x259d8e[_0x844f('0x15')]=qs[_0x844f('0x15')](_0x55de3e['query'][_0x844f('0x15')]);}_0x259d8e['order']=qs['sort'](_0x55de3e[_0x844f('0x27')]['sort']);_0x259d8e[_0x844f('0x2e')]=qs[_0x844f('0x28')](_[_0x844f('0x2f')](_0x55de3e[_0x844f('0x27')],_0x516fe7[_0x844f('0x28')]),_0x24319c);if(_0x55de3e[_0x844f('0x27')][_0x844f('0x30')]){_0x259d8e[_0x844f('0x2e')]=_[_0x844f('0x31')](_0x259d8e[_0x844f('0x2e')],{'$or':_[_0x844f('0x23')](_0x24319c,function(_0x366ebf){if(_0x366ebf[_0x844f('0x25')]!==_0x844f('0x32')){var _0x23a721={};_0x23a721[_0x366ebf['name']]={'$like':'%'+_0x55de3e['query'][_0x844f('0x30')]+'%'};return _0x23a721;}})});}_0x259d8e=_['merge']({},_0x259d8e,_0x55de3e[_0x844f('0x33')]);var _0x2ecd23={'where':_0x259d8e['where']};return db[_0x844f('0x34')]['count'](_0x2ecd23)['then'](function(_0x2b3b4d){_0x49e801['count']=_0x2b3b4d;if(_0x55de3e['query'][_0x844f('0x35')]){_0x259d8e[_0x844f('0x36')]=[{'all':!![]}];}return db[_0x844f('0x34')][_0x844f('0x37')](_0x259d8e);})['then'](function(_0x1df697){_0x49e801[_0x844f('0x38')]=_0x1df697;return _0x49e801;})[_0x844f('0x1b')](respondWithFilteredResult(_0x2a0dc9,_0x259d8e))[_0x844f('0x39')](handleError(_0x2a0dc9,null));};exports['show']=function(_0x16da77,_0x4b4da6){var _0x5848d4={'raw':![],'where':{'id':_0x16da77[_0x844f('0x3a')]['id']}},_0xd5eab8={};_0xd5eab8[_0x844f('0x26')]=_[_0x844f('0x3b')](db[_0x844f('0x34')]['rawAttributes']);_0xd5eab8[_0x844f('0x27')]=_[_0x844f('0x3b')](_0x16da77['query']);_0xd5eab8[_0x844f('0x28')]=_[_0x844f('0x29')](_0xd5eab8[_0x844f('0x26')],_0xd5eab8[_0x844f('0x27')]);_0x5848d4[_0x844f('0x2a')]=_[_0x844f('0x29')](_0xd5eab8[_0x844f('0x26')],qs[_0x844f('0x3c')](_0x16da77[_0x844f('0x27')][_0x844f('0x3c')]));_0x5848d4[_0x844f('0x2a')]=_0x5848d4['attributes'][_0x844f('0x2b')]?_0x5848d4['attributes']:_0xd5eab8[_0x844f('0x26')];if(_0x16da77[_0x844f('0x27')]['includeAll']){_0x5848d4[_0x844f('0x36')]=[{'all':!![]}];}_0x5848d4=_[_0x844f('0x31')]({},_0x5848d4,_0x16da77[_0x844f('0x33')]);return db[_0x844f('0x34')][_0x844f('0x3d')](_0x5848d4)['then'](handleEntityNotFound(_0x4b4da6,null))[_0x844f('0x1b')](respondWithResult(_0x4b4da6,null))['catch'](handleError(_0x4b4da6,null));};exports[_0x844f('0x3e')]=function(_0xa8d0cb,_0x2c28d3){return db['VoiceChanSpy'][_0x844f('0x3e')](_0xa8d0cb[_0x844f('0x3f')],{})[_0x844f('0x1b')](function(_0x511cae){var _0x17c388=_0xa8d0cb[_0x844f('0x40')][_0x844f('0x1c')]({'plain':!![]});if(!_0x17c388)throw new Error(_0x844f('0x41'));if(_0x17c388[_0x844f('0x42')]==='user'){var _0x1518d7=_0x511cae[_0x844f('0x1c')]({'plain':!![]});var _0x368372=_0x844f('0x1d');return db['UserProfileSection'][_0x844f('0x3d')]({'where':{'name':_0x368372,'userProfileId':_0x17c388[_0x844f('0x43')]},'raw':!![]})[_0x844f('0x1b')](function(_0x32f9fa){if(_0x32f9fa&&_0x32f9fa[_0x844f('0x44')]===0x0){return db[_0x844f('0x1e')]['create']({'name':_0x1518d7['name'],'resourceId':_0x1518d7['id'],'type':_0x32f9fa[_0x844f('0x21')],'sectionId':_0x32f9fa['id']},{})[_0x844f('0x1b')](function(){return _0x511cae;});}else{return _0x511cae;}})[_0x844f('0x39')](function(_0x1efc35){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1efc35);throw _0x1efc35;});}return _0x511cae;})[_0x844f('0x1b')](respondWithResult(_0x2c28d3,0xc9))['catch'](handleError(_0x2c28d3,null));};exports[_0x844f('0x1a')]=function(_0x12e37a,_0x2d3f47){if(_0x12e37a[_0x844f('0x3f')]['id']){delete _0x12e37a['body']['id'];}return db[_0x844f('0x34')][_0x844f('0x3d')]({'where':{'id':_0x12e37a['params']['id']}})['then'](handleEntityNotFound(_0x2d3f47,null))[_0x844f('0x1b')](saveUpdates(_0x12e37a[_0x844f('0x3f')],null))[_0x844f('0x1b')](respondWithResult(_0x2d3f47,null))[_0x844f('0x39')](handleError(_0x2d3f47,null));};exports[_0x844f('0x1f')]=function(_0x3fade9,_0x47ddbf){return db['VoiceChanSpy'][_0x844f('0x3d')]({'where':{'id':_0x3fade9[_0x844f('0x3a')]['id']}})[_0x844f('0x1b')](handleEntityNotFound(_0x47ddbf,null))[_0x844f('0x1b')](removeEntity(_0x47ddbf,null))[_0x844f('0x39')](handleError(_0x47ddbf,null));}; \ No newline at end of file +var _0x524a=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','ChanSpies','UserProfileResource','destroy','stack','name','index','map','VoiceChanSpy','fieldName','model','query','filters','attributes','intersection','fields','length','limit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format'];(function(_0x290612,_0x264e17){var _0x44aade=function(_0x3358d9){while(--_0x3358d9){_0x290612['push'](_0x290612['shift']());}};_0x44aade(++_0x264e17);}(_0x524a,0xf5));var _0xa524=function(_0x4f1cea,_0x217f65){_0x4f1cea=_0x4f1cea-0x0;var _0x4c18c6=_0x524a[_0x4f1cea];return _0x4c18c6;};'use strict';var emlformat=require(_0xa524('0x0'));var rimraf=require(_0xa524('0x1'));var zipdir=require(_0xa524('0x2'));var jsonpatch=require(_0xa524('0x3'));var rp=require('request-promise');var moment=require(_0xa524('0x4'));var BPromise=require(_0xa524('0x5'));var Mustache=require(_0xa524('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa524('0x7'));var csv=require(_0xa524('0x8'));var ejs=require(_0xa524('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa524('0xa'));var squel=require('squel');var crypto=require(_0xa524('0xb'));var jsforce=require(_0xa524('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa524('0x8'));var querystring=require(_0xa524('0xd'));var Papa=require(_0xa524('0xe'));var Redis=require(_0xa524('0xf'));var authService=require(_0xa524('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa524('0x11'));var hardwareService=require(_0xa524('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa524('0x13'));var config=require(_0xa524('0x14'));var licenseUtil=require(_0xa524('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55117f,_0x14a0d6){_0x14a0d6=_0x14a0d6||0xcc;return function(_0x4aa46d){if(_0x4aa46d){return _0x55117f[_0xa524('0x16')](_0x14a0d6);}return _0x55117f['status'](_0x14a0d6)[_0xa524('0x17')]();};}function respondWithResult(_0x5c7e6a,_0x75bfe8){_0x75bfe8=_0x75bfe8||0xc8;return function(_0x281137){if(_0x281137){return _0x5c7e6a['status'](_0x75bfe8)[_0xa524('0x18')](_0x281137);}};}function respondWithFilteredResult(_0x15b14c,_0xe85361){return function(_0x1de01e){if(_0x1de01e){var _0x45347f=typeof _0xe85361[_0xa524('0x19')]===_0xa524('0x1a')&&typeof _0xe85361['limit']===_0xa524('0x1a');var _0x3d8494=_0x1de01e[_0xa524('0x1b')];var _0x3d6a0d=_0x45347f?0x0:_0xe85361[_0xa524('0x19')];var _0x805b93=_0x45347f?_0x1de01e[_0xa524('0x1b')]:_0xe85361[_0xa524('0x19')]+_0xe85361['limit'];var _0x304dea;if(_0x805b93>=_0x3d8494){_0x805b93=_0x3d8494;_0x304dea=0xc8;}else{_0x304dea=0xce;}_0x15b14c[_0xa524('0x1c')](_0x304dea);return _0x15b14c[_0xa524('0x1d')](_0xa524('0x1e'),_0x3d6a0d+'-'+_0x805b93+'/'+_0x3d8494)['json'](_0x1de01e);}return null;};}function patchUpdates(_0x5510fa){return function(_0x40f4bd){try{jsonpatch[_0xa524('0x1f')](_0x40f4bd,_0x5510fa,!![]);}catch(_0x21e114){return BPromise[_0xa524('0x20')](_0x21e114);}return _0x40f4bd[_0xa524('0x21')]();};}function saveUpdates(_0x3866e2,_0x4abffe){return function(_0x262eac){if(_0x262eac){return _0x262eac[_0xa524('0x22')](_0x3866e2)[_0xa524('0x23')](function(_0x40fb4b){return _0x40fb4b;});}return null;};}function removeEntity(_0x226784,_0x45cdcc){return function(_0x26e931){if(_0x26e931){return _0x26e931['destroy']()[_0xa524('0x23')](function(){var _0x221bf=_0x26e931['get']({'plain':!![]});var _0x47efb3=_0xa524('0x24');return db[_0xa524('0x25')][_0xa524('0x26')]({'where':{'type':_0x47efb3,'resourceId':_0x221bf['id']}})[_0xa524('0x23')](function(){return _0x26e931;});})[_0xa524('0x23')](function(){_0x226784['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aeabc,_0x869b22){return function(_0x1582fa){if(!_0x1582fa){_0x1aeabc[_0xa524('0x16')](0x194);}return _0x1582fa;};}function handleError(_0x505c42,_0x1c84c6){_0x1c84c6=_0x1c84c6||0x1f4;return function(_0x32ba03){logger['error'](_0x32ba03[_0xa524('0x27')]);if(_0x32ba03[_0xa524('0x28')]){delete _0x32ba03['name'];}_0x505c42[_0xa524('0x1c')](_0x1c84c6)['send'](_0x32ba03);};}exports[_0xa524('0x29')]=function(_0x38e051,_0x45b846){var _0x238133={},_0x136e83={},_0x1c706b={'count':0x0,'rows':[]};var _0x4f6133=_[_0xa524('0x2a')](db[_0xa524('0x2b')]['rawAttributes'],function(_0x535e41){return{'name':_0x535e41[_0xa524('0x2c')],'type':_0x535e41['type']['key']};});_0x136e83[_0xa524('0x2d')]=_[_0xa524('0x2a')](_0x4f6133,_0xa524('0x28'));_0x136e83[_0xa524('0x2e')]=_['keys'](_0x38e051['query']);_0x136e83[_0xa524('0x2f')]=_['intersection'](_0x136e83['model'],_0x136e83[_0xa524('0x2e')]);_0x238133[_0xa524('0x30')]=_[_0xa524('0x31')](_0x136e83[_0xa524('0x2d')],qs[_0xa524('0x32')](_0x38e051[_0xa524('0x2e')][_0xa524('0x32')]));_0x238133[_0xa524('0x30')]=_0x238133[_0xa524('0x30')][_0xa524('0x33')]?_0x238133[_0xa524('0x30')]:_0x136e83[_0xa524('0x2d')];if(!_0x38e051['query']['hasOwnProperty']('nolimit')){_0x238133[_0xa524('0x34')]=qs[_0xa524('0x34')](_0x38e051['query'][_0xa524('0x34')]);_0x238133['offset']=qs[_0xa524('0x19')](_0x38e051[_0xa524('0x2e')]['offset']);}_0x238133[_0xa524('0x35')]=qs[_0xa524('0x36')](_0x38e051[_0xa524('0x2e')]['sort']);_0x238133[_0xa524('0x37')]=qs[_0xa524('0x2f')](_['pick'](_0x38e051[_0xa524('0x2e')],_0x136e83[_0xa524('0x2f')]),_0x4f6133);if(_0x38e051['query'][_0xa524('0x38')]){_0x238133[_0xa524('0x37')]=_['merge'](_0x238133[_0xa524('0x37')],{'$or':_[_0xa524('0x2a')](_0x4f6133,function(_0x186395){if(_0x186395[_0xa524('0x39')]!==_0xa524('0x3a')){var _0x38f87a={};_0x38f87a[_0x186395[_0xa524('0x28')]]={'$like':'%'+_0x38e051[_0xa524('0x2e')][_0xa524('0x38')]+'%'};return _0x38f87a;}})});}_0x238133=_[_0xa524('0x3b')]({},_0x238133,_0x38e051[_0xa524('0x3c')]);var _0x51cd09={'where':_0x238133[_0xa524('0x37')]};return db['VoiceChanSpy'][_0xa524('0x1b')](_0x51cd09)[_0xa524('0x23')](function(_0x35d92d){_0x1c706b[_0xa524('0x1b')]=_0x35d92d;if(_0x38e051[_0xa524('0x2e')][_0xa524('0x3d')]){_0x238133[_0xa524('0x3e')]=[{'all':!![]}];}return db[_0xa524('0x2b')][_0xa524('0x3f')](_0x238133);})[_0xa524('0x23')](function(_0x4a87d4){_0x1c706b[_0xa524('0x40')]=_0x4a87d4;return _0x1c706b;})[_0xa524('0x23')](respondWithFilteredResult(_0x45b846,_0x238133))['catch'](handleError(_0x45b846,null));};exports[_0xa524('0x41')]=function(_0x3f5564,_0x4885a4){var _0x492851={'raw':![],'where':{'id':_0x3f5564['params']['id']}},_0x4dff4b={};_0x4dff4b['model']=_[_0xa524('0x42')](db[_0xa524('0x2b')][_0xa524('0x43')]);_0x4dff4b[_0xa524('0x2e')]=_['keys'](_0x3f5564[_0xa524('0x2e')]);_0x4dff4b[_0xa524('0x2f')]=_[_0xa524('0x31')](_0x4dff4b[_0xa524('0x2d')],_0x4dff4b['query']);_0x492851[_0xa524('0x30')]=_[_0xa524('0x31')](_0x4dff4b[_0xa524('0x2d')],qs[_0xa524('0x32')](_0x3f5564[_0xa524('0x2e')]['fields']));_0x492851[_0xa524('0x30')]=_0x492851[_0xa524('0x30')][_0xa524('0x33')]?_0x492851[_0xa524('0x30')]:_0x4dff4b[_0xa524('0x2d')];if(_0x3f5564[_0xa524('0x2e')][_0xa524('0x3d')]){_0x492851[_0xa524('0x3e')]=[{'all':!![]}];}_0x492851=_[_0xa524('0x3b')]({},_0x492851,_0x3f5564['options']);return db['VoiceChanSpy'][_0xa524('0x44')](_0x492851)[_0xa524('0x23')](handleEntityNotFound(_0x4885a4,null))[_0xa524('0x23')](respondWithResult(_0x4885a4,null))[_0xa524('0x45')](handleError(_0x4885a4,null));};exports[_0xa524('0x46')]=function(_0xddc80,_0x56e570){return db[_0xa524('0x2b')][_0xa524('0x46')](_0xddc80[_0xa524('0x47')],{})[_0xa524('0x23')](function(_0x24c7ef){var _0x451bbe=_0xddc80['user'][_0xa524('0x48')]({'plain':!![]});if(!_0x451bbe)throw new Error(_0xa524('0x49'));if(_0x451bbe[_0xa524('0x4a')]===_0xa524('0x4b')){var _0x25ffbd=_0x24c7ef[_0xa524('0x48')]({'plain':!![]});var _0xef18b7=_0xa524('0x24');return db[_0xa524('0x4c')][_0xa524('0x44')]({'where':{'name':_0xef18b7,'userProfileId':_0x451bbe[_0xa524('0x4d')]},'raw':!![]})[_0xa524('0x23')](function(_0x3a374f){if(_0x3a374f&&_0x3a374f[_0xa524('0x4e')]===0x0){return db[_0xa524('0x25')]['create']({'name':_0x25ffbd[_0xa524('0x28')],'resourceId':_0x25ffbd['id'],'type':_0x3a374f[_0xa524('0x28')],'sectionId':_0x3a374f['id']},{})['then'](function(){return _0x24c7ef;});}else{return _0x24c7ef;}})['catch'](function(_0x32844c){logger[_0xa524('0x4f')](_0xa524('0x50'),_0x32844c);throw _0x32844c;});}return _0x24c7ef;})[_0xa524('0x23')](respondWithResult(_0x56e570,0xc9))[_0xa524('0x45')](handleError(_0x56e570,null));};exports[_0xa524('0x22')]=function(_0x121fc5,_0x4e3709){if(_0x121fc5[_0xa524('0x47')]['id']){delete _0x121fc5[_0xa524('0x47')]['id'];}return db[_0xa524('0x2b')][_0xa524('0x44')]({'where':{'id':_0x121fc5[_0xa524('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e3709,null))[_0xa524('0x23')](saveUpdates(_0x121fc5['body'],null))[_0xa524('0x23')](respondWithResult(_0x4e3709,null))[_0xa524('0x45')](handleError(_0x4e3709,null));};exports[_0xa524('0x26')]=function(_0x3f5694,_0x161393){return db[_0xa524('0x2b')][_0xa524('0x44')]({'where':{'id':_0x3f5694['params']['id']}})['then'](handleEntityNotFound(_0x161393,null))[_0xa524('0x23')](removeEntity(_0x161393,null))[_0xa524('0x45')](handleError(_0x161393,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index dda0e57..b41f0b1 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 _0x5288=['password','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','length','bulkCreate','destroy','lodash','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x4dd3ce,_0x4211c5){var _0x2a1aee=function(_0x2cf135){while(--_0x2cf135){_0x4dd3ce['push'](_0x4dd3ce['shift']());}};_0x2a1aee(++_0x4211c5);}(_0x5288,0x195));var _0x8528=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x5288[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x8528('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3be509,_0x3d3e2d,_0x1c0267){var _0x3574b9=0x1;var _0x4bcd0d=[];var _0x57f894={'context':_0x3d3e2d[_0x8528('0x1')]||_0x8528('0x2'),'exten':util[_0x8528('0x3')](_0x8528('0x4'),_0x3be509[_0x8528('0x5')],_0x1c0267),'type':_0x8528('0x6'),'isApp':![],'ChanSpyId':_0x3be509['id'],'UserId':_0x3d3e2d['id']};_0x4bcd0d[_0x8528('0x7')](_['merge']({'app':_0x8528('0x8'),'appdata':util[_0x8528('0x3')](_0x8528('0x9'),'chanspy'),'priority':_0x3574b9++},_0x57f894));if(_0x3be509[_0x8528('0xa')]){_0x4bcd0d['push'](_[_0x8528('0xb')]({'app':_0x8528('0xc'),'appdata':util[_0x8528('0x3')](_0x8528('0xd'),_0x3be509[_0x8528('0xe')]),'priority':_0x3574b9++},_0x57f894));}if(_0x3be509['auth']){_0x4bcd0d['push'](_[_0x8528('0xb')]({'app':'Authenticate','appdata':_0x3be509[_0x8528('0xf')],'priority':_0x3574b9++},_0x57f894));}_0x4bcd0d['push'](_[_0x8528('0xb')]({'app':_0x8528('0x10'),'appdata':util[_0x8528('0x3')](_0x8528('0x11'),_0x3d3e2d[_0x8528('0x12')],_0x3be509[_0x8528('0x13')]?_0x3be509[_0x8528('0x13')][_0x8528('0x14')](''):''),'priority':_0x3574b9++},_0x57f894));if(_0x3be509[_0x8528('0xa')]){_0x4bcd0d[_0x8528('0x7')](_['merge']({'app':'StopMixMonitor','priority':_0x3574b9++},_0x57f894));}return _0x4bcd0d;};var getChanSpyApplications=function(_0x200a3f,_0x59d3fa){var _0x15790e=[];for(var _0x95016e=0x0,_0x1d9d68=0x1;_0x95016e<_0x59d3fa['length'];_0x95016e++,_0x1d9d68=0x1){_0x15790e=_0x15790e[_0x8528('0x15')](getUserApplications(_0x200a3f,_0x59d3fa[_0x95016e],_0x59d3fa[_0x95016e][_0x8528('0x16')]));if(_0x59d3fa[_0x95016e][_0x8528('0x16')]!=_0x59d3fa[_0x95016e][_0x8528('0x12')]){_0x15790e=_0x15790e[_0x8528('0x15')](getUserApplications(_0x200a3f,_0x59d3fa[_0x95016e],_0x59d3fa[_0x95016e][_0x8528('0x12')]));}}return _0x15790e;};var getChanSpyPromise=function(_0x1b62a6,_0x476cfd){return new BPromise(function(_0x173a24,_0x4e8643){return _0x1b62a6['User']['findAll']({'attributes':['id',_0x8528('0x12'),'internal'],'where':{'role':_0x8528('0x17'),'chanspy':!![]},'raw':!![]})[_0x8528('0x18')](function(_0x2fa96c){if(_0x2fa96c){return _0x173a24(getChanSpyApplications(_0x476cfd,_0x2fa96c));}return _0x173a24([]);})[_0x8528('0x19')](function(_0x2cd41f){_0x4e8643(_0x2cd41f);});});};module[_0x8528('0x1a')]=function(_0x30a651,_0x10c312){var _0x190c1c=_0x30a651[_0x8528('0x1b')];return _0x30a651[_0x8528('0x1c')](_0x8528('0x1d'),attributes,{'tableName':_0x8528('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cb4c3,_0x2fb2df,_0xe9fa8f){return getChanSpyPromise(_0x190c1c,_0x5cb4c3)[_0x8528('0x18')](function(_0x513a7f){if(_0x513a7f&&_0x513a7f['length']){return _0x190c1c['VoiceExtension']['bulkCreate'](_0x513a7f);}})[_0x8528('0x18')](function(){_0xe9fa8f();})[_0x8528('0x19')](function(_0x1ed7ad){_0xe9fa8f(_0x1ed7ad);});},'afterUpdate':function(_0x36e38a,_0xc02e82,_0x384a6f){return _0x190c1c[_0x8528('0x1f')]['destroy']({'where':{'ChanSpyId':_0x36e38a['id']}})['then'](function(){return getChanSpyPromise(_0x190c1c,_0x36e38a);})[_0x8528('0x18')](function(_0x5369ee){if(_0x5369ee&&_0x5369ee[_0x8528('0x20')]){return _0x190c1c['VoiceExtension'][_0x8528('0x21')](_0x5369ee);}})[_0x8528('0x18')](function(){_0x384a6f();})[_0x8528('0x19')](function(_0x27c93b){_0x384a6f(_0x27c93b);});},'afterDestroy':function(_0x36d847,_0x35d9b5,_0x3f2f53){return _0x190c1c['VoiceExtension'][_0x8528('0x22')]({'where':{'ChanSpyId':_0x36d847['id']}})[_0x8528('0x18')](function(){_0x3f2f53();})[_0x8528('0x19')](function(_0x30f61c){_0x3f2f53(_0x30f61c);});}}});}; \ No newline at end of file +var _0xf34a=['format','%s%s','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','User','findAll','internal','agent','then','catch','exports','models','voice_chanspy','VoiceExtension','bulkCreate','destroy','./voiceChanSpy.attributes','from-sip'];(function(_0x4af8a5,_0x235b51){var _0x2f73a0=function(_0x62bae6){while(--_0x62bae6){_0x4af8a5['push'](_0x4af8a5['shift']());}};_0x2f73a0(++_0x235b51);}(_0xf34a,0xec));var _0xaf34=function(_0x1fbfa0,_0x3f1d51){_0x1fbfa0=_0x1fbfa0-0x0;var _0x33461a=_0xf34a[_0x1fbfa0];return _0x33461a;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xaf34('0x0'));var getUserApplications=function(_0x176d1d,_0x8cf4c5,_0x3f73a5){var _0x4bea22=0x1;var _0x7bdf7c=[];var _0x241c96={'context':_0x8cf4c5['context']||_0xaf34('0x1'),'exten':util[_0xaf34('0x2')](_0xaf34('0x3'),_0x176d1d['prefix'],_0x3f73a5),'type':_0xaf34('0x4'),'isApp':![],'ChanSpyId':_0x176d1d['id'],'UserId':_0x8cf4c5['id']};_0x7bdf7c['push'](_[_0xaf34('0x5')]({'app':_0xaf34('0x6'),'appdata':util[_0xaf34('0x2')](_0xaf34('0x7'),_0xaf34('0x8')),'priority':_0x4bea22++},_0x241c96));if(_0x176d1d[_0xaf34('0x9')]){_0x7bdf7c[_0xaf34('0xa')](_[_0xaf34('0x5')]({'app':_0xaf34('0xb'),'appdata':util[_0xaf34('0x2')](_0xaf34('0xc'),_0x176d1d['recordingFormat']),'priority':_0x4bea22++},_0x241c96));}if(_0x176d1d['auth']){_0x7bdf7c[_0xaf34('0xa')](_[_0xaf34('0x5')]({'app':_0xaf34('0xd'),'appdata':_0x176d1d[_0xaf34('0xe')],'priority':_0x4bea22++},_0x241c96));}_0x7bdf7c[_0xaf34('0xa')](_[_0xaf34('0x5')]({'app':_0xaf34('0xf'),'appdata':util['format'](_0xaf34('0x10'),_0x8cf4c5[_0xaf34('0x11')],_0x176d1d['options']?_0x176d1d[_0xaf34('0x12')]['join'](''):''),'priority':_0x4bea22++},_0x241c96));if(_0x176d1d['record']){_0x7bdf7c[_0xaf34('0xa')](_[_0xaf34('0x5')]({'app':_0xaf34('0x13'),'priority':_0x4bea22++},_0x241c96));}return _0x7bdf7c;};var getChanSpyApplications=function(_0x36cd34,_0x502256){var _0x39fdcb=[];for(var _0x22adb4=0x0,_0x3a3f39=0x1;_0x22adb4<_0x502256[_0xaf34('0x14')];_0x22adb4++,_0x3a3f39=0x1){_0x39fdcb=_0x39fdcb['concat'](getUserApplications(_0x36cd34,_0x502256[_0x22adb4],_0x502256[_0x22adb4]['internal']));if(_0x502256[_0x22adb4]['internal']!=_0x502256[_0x22adb4][_0xaf34('0x11')]){_0x39fdcb=_0x39fdcb[_0xaf34('0x15')](getUserApplications(_0x36cd34,_0x502256[_0x22adb4],_0x502256[_0x22adb4][_0xaf34('0x11')]));}}return _0x39fdcb;};var getChanSpyPromise=function(_0x2cf351,_0x296be3){return new BPromise(function(_0x36ce2b,_0x5c5ecd){return _0x2cf351[_0xaf34('0x16')][_0xaf34('0x17')]({'attributes':['id',_0xaf34('0x11'),_0xaf34('0x18')],'where':{'role':_0xaf34('0x19'),'chanspy':!![]},'raw':!![]})[_0xaf34('0x1a')](function(_0x214722){if(_0x214722){return _0x36ce2b(getChanSpyApplications(_0x296be3,_0x214722));}return _0x36ce2b([]);})[_0xaf34('0x1b')](function(_0x3a1984){_0x5c5ecd(_0x3a1984);});});};module[_0xaf34('0x1c')]=function(_0x59de7c,_0x3e374c){var _0x3628d7=_0x59de7c[_0xaf34('0x1d')];return _0x59de7c['define']('VoiceChanSpy',attributes,{'tableName':_0xaf34('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x582508,_0x52b607,_0x2afaec){return getChanSpyPromise(_0x3628d7,_0x582508)[_0xaf34('0x1a')](function(_0x22304){if(_0x22304&&_0x22304[_0xaf34('0x14')]){return _0x3628d7[_0xaf34('0x1f')][_0xaf34('0x20')](_0x22304);}})[_0xaf34('0x1a')](function(){_0x2afaec();})[_0xaf34('0x1b')](function(_0x157e5a){_0x2afaec(_0x157e5a);});},'afterUpdate':function(_0x109d34,_0xb46670,_0x3f97aa){return _0x3628d7['VoiceExtension'][_0xaf34('0x21')]({'where':{'ChanSpyId':_0x109d34['id']}})[_0xaf34('0x1a')](function(){return getChanSpyPromise(_0x3628d7,_0x109d34);})[_0xaf34('0x1a')](function(_0x421196){if(_0x421196&&_0x421196['length']){return _0x3628d7[_0xaf34('0x1f')][_0xaf34('0x20')](_0x421196);}})[_0xaf34('0x1a')](function(){_0x3f97aa();})[_0xaf34('0x1b')](function(_0x26abf2){_0x3f97aa(_0x26abf2);});},'afterDestroy':function(_0x369fd8,_0x5e814a,_0x1c76ce){return _0x3628d7[_0xaf34('0x1f')][_0xaf34('0x21')]({'where':{'ChanSpyId':_0x369fd8['id']}})['then'](function(){_0x1c76ce();})[_0xaf34('0x1b')](function(_0x1718c2){_0x1c76ce(_0x1718c2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2c612b9..399a512 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 _0xad8a=['../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xda3e2c,_0x49e060){var _0x3f7139=function(_0x5de154){while(--_0x5de154){_0xda3e2c['push'](_0xda3e2c['shift']());}};_0x3f7139(++_0x49e060);}(_0xad8a,0xb0));var _0xaad8=function(_0x571b54,_0xfd95d2){_0x571b54=_0x571b54-0x0;var _0x1718a8=_0xad8a[_0x571b54];return _0x1718a8;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var moment=require(_0xaad8('0x2'));var BPromise=require(_0xaad8('0x3'));var rs=require(_0xaad8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaad8('0x5'))['db'];var utils=require(_0xaad8('0x6'));var logger=require(_0xaad8('0x7'))('rpc');var config=require(_0xaad8('0x8'));var jayson=require(_0xaad8('0x9'));var client=jayson[_0xaad8('0xa')][_0xaad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x95aef9,_0x39c599,_0x28f3a1){return new BPromise(function(_0xf3a6c7,_0x11408a){return client[_0xaad8('0xc')](_0x95aef9,_0x28f3a1)['then'](function(_0x52477f){logger[_0xaad8('0xd')](_0xaad8('0xe'),_0x39c599,_0xaad8('0xf'));logger[_0xaad8('0x10')](_0xaad8('0x11'),_0x39c599,_0xaad8('0xf'),JSON[_0xaad8('0x12')](_0x52477f));if(_0x52477f[_0xaad8('0x13')]){if(_0x52477f[_0xaad8('0x13')]['code']===0x1f4){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0x11408a(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0xf3a6c7(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}else{logger[_0xaad8('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x39c599,_0xaad8('0xf'));_0xf3a6c7(_0x52477f[_0xaad8('0x15')]['message']);}})[_0xaad8('0x16')](function(_0x2a8e12){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x2a8e12);_0x11408a(_0x2a8e12);});});} \ No newline at end of file +var _0x765e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x765e,0x131));var _0xe765=function(_0x181ace,_0x38ee10){_0x181ace=_0x181ace-0x0;var _0x358998=_0x765e[_0x181ace];return _0x358998;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdd89e7,_0x504542,_0x35d891){return new BPromise(function(_0x28e955,_0x27b0f4){return client[_0xe765('0xe')](_0xdd89e7,_0x35d891)[_0xe765('0xf')](function(_0x41801f){logger[_0xe765('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x504542,_0xe765('0x11'));logger[_0xe765('0x12')](_0xe765('0x13'),_0x504542,'request\x20sent',JSON[_0xe765('0x14')](_0x41801f));if(_0x41801f['error']){if(_0x41801f['error']['code']===0x1f4){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x27b0f4(_0x41801f[_0xe765('0x15')]['message']);}logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x28e955(_0x41801f[_0xe765('0x15')]['message']);}else{logger['info'](_0xe765('0x16'),_0x504542,_0xe765('0x11'));_0x28e955(_0x41801f[_0xe765('0x18')]['message']);}})[_0xe765('0x19')](function(_0x36aca3){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x36aca3);_0x27b0f4(_0x36aca3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 53f78c2..ee7c5e8 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 _0xb1b6=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xb1b6,0x1e2));var _0x6b1b=function(_0x212d46,_0x145f5b){_0x212d46=_0x212d46-0x0;var _0xe8e8bf=_0xb1b6[_0x212d46];return _0xe8e8bf;};'use strict';var multer=require(_0x6b1b('0x0'));var util=require(_0x6b1b('0x1'));var path=require(_0x6b1b('0x2'));var timeout=require(_0x6b1b('0x3'));var express=require(_0x6b1b('0x4'));var router=express['Router']();var fs_extra=require(_0x6b1b('0x5'));var auth=require(_0x6b1b('0x6'));var interaction=require(_0x6b1b('0x7'));var config=require(_0x6b1b('0x8'));var controller=require('./voiceContext.controller');router[_0x6b1b('0x9')]('/',auth[_0x6b1b('0xa')](),controller['index']);router['get'](_0x6b1b('0xb'),auth[_0x6b1b('0xa')](),controller[_0x6b1b('0xc')]);router[_0x6b1b('0xd')]('/',auth[_0x6b1b('0xa')](),controller[_0x6b1b('0xe')]);router[_0x6b1b('0xf')](_0x6b1b('0xb'),auth[_0x6b1b('0xa')](),controller[_0x6b1b('0x10')]);router[_0x6b1b('0x11')](_0x6b1b('0xb'),auth[_0x6b1b('0xa')](),controller[_0x6b1b('0x12')]);module[_0x6b1b('0x13')]=router; \ No newline at end of file +var _0x1b31=['create','put','/:id','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated','show','post'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x1b31,0x1d2));var _0x11b3=function(_0x257569,_0x4b90be){_0x257569=_0x257569-0x0;var _0x4ddb91=_0x1b31[_0x257569];return _0x4ddb91;};'use strict';var multer=require(_0x11b3('0x0'));var util=require(_0x11b3('0x1'));var path=require('path');var timeout=require(_0x11b3('0x2'));var express=require('express');var router=express[_0x11b3('0x3')]();var fs_extra=require(_0x11b3('0x4'));var auth=require(_0x11b3('0x5'));var interaction=require(_0x11b3('0x6'));var config=require(_0x11b3('0x7'));var controller=require(_0x11b3('0x8'));router[_0x11b3('0x9')]('/',auth['isAuthenticated'](),controller[_0x11b3('0xa')]);router['get']('/:id',auth[_0x11b3('0xb')](),controller[_0x11b3('0xc')]);router[_0x11b3('0xd')]('/',auth[_0x11b3('0xb')](),controller[_0x11b3('0xe')]);router[_0x11b3('0xf')](_0x11b3('0x10'),auth[_0x11b3('0xb')](),controller[_0x11b3('0x11')]);router['delete'](_0x11b3('0x10'),auth[_0x11b3('0xb')](),controller[_0x11b3('0x12')]);module[_0x11b3('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index c04412d..c46a106 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 _0xc779=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4b55f3,_0x25ceb9){var _0x2b2f09=function(_0x18ee0a){while(--_0x18ee0a){_0x4b55f3['push'](_0x4b55f3['shift']());}};_0x2b2f09(++_0x25ceb9);}(_0xc779,0x138));var _0x9c77=function(_0x560bea,_0x2a1978){_0x560bea=_0x560bea-0x0;var _0x4759ee=_0xc779[_0x560bea];return _0x4759ee;};'use strict';var Sequelize=require(_0x9c77('0x0'));module[_0x9c77('0x1')]={'name':{'type':Sequelize[_0x9c77('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x9c77('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9c77('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x432f=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x2832a2,_0x1e34ea){var _0x2eb3c1=function(_0x1600fd){while(--_0x1600fd){_0x2832a2['push'](_0x2832a2['shift']());}};_0x2eb3c1(++_0x1e34ea);}(_0x432f,0x67));var _0xf432=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x432f[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require(_0xf432('0x0'));module[_0xf432('0x1')]={'name':{'type':Sequelize[_0xf432('0x2')],'unique':_0xf432('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf432('0x4')],'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 c5758f1..087ae91 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 _0x7aa2=['index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','utf8','Reload','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','then','get','Contexts','UserProfileResource','stack','name','send'];(function(_0xf8c422,_0x2586a7){var _0x274cf4=function(_0x1d304f){while(--_0x1d304f){_0xf8c422['push'](_0xf8c422['shift']());}};_0x274cf4(++_0x2586a7);}(_0x7aa2,0x1e0));var _0x27aa=function(_0x128313,_0x50691d){_0x128313=_0x128313-0x0;var _0x77a919=_0x7aa2[_0x128313];return _0x77a919;};'use strict';var emlformat=require(_0x27aa('0x0'));var rimraf=require(_0x27aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27aa('0x2'));var rp=require(_0x27aa('0x3'));var moment=require(_0x27aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x27aa('0x5'));var util=require(_0x27aa('0x6'));var path=require('path');var sox=require(_0x27aa('0x7'));var csv=require(_0x27aa('0x8'));var ejs=require(_0x27aa('0x9'));var fs=require('fs');var fs_extra=require(_0x27aa('0xa'));var _=require(_0x27aa('0xb'));var squel=require(_0x27aa('0xc'));var crypto=require(_0x27aa('0xd'));var jsforce=require(_0x27aa('0xe'));var deskjs=require(_0x27aa('0xf'));var toCsv=require(_0x27aa('0x8'));var querystring=require(_0x27aa('0x10'));var Papa=require('papaparse');var Redis=require(_0x27aa('0x11'));var authService=require(_0x27aa('0x12'));var qs=require(_0x27aa('0x13'));var as=require(_0x27aa('0x14'));var hardwareService=require(_0x27aa('0x15'));var logger=require(_0x27aa('0x16'))(_0x27aa('0x17'));var utils=require('../../config/utils');var config=require(_0x27aa('0x18'));var licenseUtil=require(_0x27aa('0x19'));var db=require(_0x27aa('0x1a'))['db'];var jayson=require(_0x27aa('0x1b'));var client=jayson[_0x27aa('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327fee,_0xba935,_0x540b97,_0x48f3e2){return new BPromise(function(_0x49dc44,_0x200283){var _0x597682=_0x48f3e2||client;return _0x597682[_0x27aa('0x1d')](_0x327fee,_0x540b97)['then'](function(_0x1c1abf){logger[_0x27aa('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xba935,_0x27aa('0x1f'));logger[_0x27aa('0x20')](_0x27aa('0x21'),_0xba935,_0x27aa('0x1f'),JSON[_0x27aa('0x22')](_0x1c1abf));if(_0x1c1abf['error']){if(_0x1c1abf[_0x27aa('0x23')][_0x27aa('0x24')]===0x1f4){logger[_0x27aa('0x23')](_0x27aa('0x25'),_0xba935,_0x1c1abf[_0x27aa('0x23')][_0x27aa('0x26')]);return _0x200283(_0x1c1abf[_0x27aa('0x23')][_0x27aa('0x26')]);}logger[_0x27aa('0x23')](_0x27aa('0x25'),_0xba935,_0x1c1abf[_0x27aa('0x23')]['message']);return _0x49dc44(_0x1c1abf[_0x27aa('0x23')]['message']);}else{logger[_0x27aa('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xba935,_0x27aa('0x1f'));_0x49dc44(_0x1c1abf[_0x27aa('0x27')]['message']);}})['catch'](function(_0x15711e){logger[_0x27aa('0x23')](_0x27aa('0x25'),_0xba935,_0x15711e);_0x200283(_0x15711e);});});}function respondWithStatusCode(_0x5583a1,_0x344f02){_0x344f02=_0x344f02||0xcc;return function(_0x5cf600){if(_0x5cf600){return _0x5583a1[_0x27aa('0x28')](_0x344f02);}return _0x5583a1[_0x27aa('0x29')](_0x344f02)[_0x27aa('0x2a')]();};}function respondWithResult(_0x290c91,_0x43bfd2){_0x43bfd2=_0x43bfd2||0xc8;return function(_0x3e9280){if(_0x3e9280){return _0x290c91[_0x27aa('0x29')](_0x43bfd2)[_0x27aa('0x2b')](_0x3e9280);}};}function respondWithFilteredResult(_0x468f3a,_0x1e30cd){return function(_0x434fb8){if(_0x434fb8){var _0x1b3ff5=typeof _0x1e30cd['offset']===_0x27aa('0x2c')&&typeof _0x1e30cd[_0x27aa('0x2d')]===_0x27aa('0x2c');var _0x1b9725=_0x434fb8[_0x27aa('0x2e')];var _0x869c10=_0x1b3ff5?0x0:_0x1e30cd[_0x27aa('0x2f')];var _0x2c0330=_0x1b3ff5?_0x434fb8['count']:_0x1e30cd[_0x27aa('0x2f')]+_0x1e30cd[_0x27aa('0x2d')];var _0x3b7ea1;if(_0x2c0330>=_0x1b9725){_0x2c0330=_0x1b9725;_0x3b7ea1=0xc8;}else{_0x3b7ea1=0xce;}_0x468f3a['status'](_0x3b7ea1);return _0x468f3a[_0x27aa('0x30')]('Content-Range',_0x869c10+'-'+_0x2c0330+'/'+_0x1b9725)['json'](_0x434fb8);}return null;};}function patchUpdates(_0x1c16d5){return function(_0xebaa1a){try{jsonpatch['apply'](_0xebaa1a,_0x1c16d5,!![]);}catch(_0x112b58){return BPromise[_0x27aa('0x31')](_0x112b58);}return _0xebaa1a[_0x27aa('0x32')]();};}function saveUpdates(_0x3b7e75,_0x202878){return function(_0x376dd8){if(_0x376dd8){return _0x376dd8[_0x27aa('0x33')](_0x3b7e75)['then'](function(_0x20759d){return _0x20759d;});}return null;};}function removeEntity(_0x401143,_0x3374a5){return function(_0x194641){if(_0x194641){return _0x194641[_0x27aa('0x34')]()[_0x27aa('0x35')](function(){var _0x1344ce=_0x194641[_0x27aa('0x36')]({'plain':!![]});var _0x3e6ede=_0x27aa('0x37');return db[_0x27aa('0x38')][_0x27aa('0x34')]({'where':{'type':_0x3e6ede,'resourceId':_0x1344ce['id']}})[_0x27aa('0x35')](function(){return _0x194641;});})[_0x27aa('0x35')](function(){_0x401143[_0x27aa('0x29')](0xcc)[_0x27aa('0x2a')]();});}};}function handleEntityNotFound(_0x42b308,_0xe7dae6){return function(_0x11c5a5){if(!_0x11c5a5){_0x42b308[_0x27aa('0x28')](0x194);}return _0x11c5a5;};}function handleError(_0x5272a1,_0x39279a){_0x39279a=_0x39279a||0x1f4;return function(_0x3865c6){logger['error'](_0x3865c6[_0x27aa('0x39')]);if(_0x3865c6['name']){delete _0x3865c6[_0x27aa('0x3a')];}_0x5272a1[_0x27aa('0x29')](_0x39279a)[_0x27aa('0x3b')](_0x3865c6);};}exports[_0x27aa('0x3c')]=function(_0x600b38,_0x4f6366){var _0x336a45={},_0x49fa6b={},_0x5374fb={'count':0x0,'rows':[]};var _0x57d4f7=_[_0x27aa('0x3d')](db[_0x27aa('0x3e')][_0x27aa('0x3f')],function(_0x11d025){return{'name':_0x11d025[_0x27aa('0x40')],'type':_0x11d025[_0x27aa('0x41')][_0x27aa('0x42')]};});_0x49fa6b[_0x27aa('0x43')]=_['map'](_0x57d4f7,'name');_0x49fa6b[_0x27aa('0x44')]=_[_0x27aa('0x45')](_0x600b38['query']);_0x49fa6b[_0x27aa('0x46')]=_[_0x27aa('0x47')](_0x49fa6b[_0x27aa('0x43')],_0x49fa6b[_0x27aa('0x44')]);_0x336a45[_0x27aa('0x48')]=_[_0x27aa('0x47')](_0x49fa6b[_0x27aa('0x43')],qs[_0x27aa('0x49')](_0x600b38[_0x27aa('0x44')][_0x27aa('0x49')]));_0x336a45['attributes']=_0x336a45[_0x27aa('0x48')][_0x27aa('0x4a')]?_0x336a45[_0x27aa('0x48')]:_0x49fa6b[_0x27aa('0x43')];if(!_0x600b38[_0x27aa('0x44')][_0x27aa('0x4b')]('nolimit')){_0x336a45[_0x27aa('0x2d')]=qs['limit'](_0x600b38[_0x27aa('0x44')]['limit']);_0x336a45[_0x27aa('0x2f')]=qs[_0x27aa('0x2f')](_0x600b38[_0x27aa('0x44')][_0x27aa('0x2f')]);}_0x336a45[_0x27aa('0x4c')]=qs['sort'](_0x600b38['query'][_0x27aa('0x4d')]);_0x336a45['where']=qs[_0x27aa('0x46')](_[_0x27aa('0x4e')](_0x600b38[_0x27aa('0x44')],_0x49fa6b[_0x27aa('0x46')]),_0x57d4f7);if(_0x600b38[_0x27aa('0x44')]['filter']){_0x336a45[_0x27aa('0x4f')]=_[_0x27aa('0x50')](_0x336a45['where'],{'$or':_[_0x27aa('0x3d')](_0x57d4f7,function(_0x506158){if(_0x506158[_0x27aa('0x41')]!==_0x27aa('0x51')){var _0x1a3384={};_0x1a3384[_0x506158[_0x27aa('0x3a')]]={'$like':'%'+_0x600b38[_0x27aa('0x44')][_0x27aa('0x52')]+'%'};return _0x1a3384;}})});}_0x336a45=_[_0x27aa('0x50')]({},_0x336a45,_0x600b38[_0x27aa('0x53')]);var _0x1e1e9d={'where':_0x336a45[_0x27aa('0x4f')]};return db['VoiceContext']['count'](_0x1e1e9d)['then'](function(_0x3234bf){_0x5374fb[_0x27aa('0x2e')]=_0x3234bf;if(_0x600b38[_0x27aa('0x44')][_0x27aa('0x54')]){_0x336a45['include']=[{'all':!![]}];}return db[_0x27aa('0x3e')][_0x27aa('0x55')](_0x336a45);})['then'](function(_0x4747bf){_0x5374fb[_0x27aa('0x56')]=_0x4747bf;return _0x5374fb;})[_0x27aa('0x35')](respondWithFilteredResult(_0x4f6366,_0x336a45))[_0x27aa('0x57')](handleError(_0x4f6366,null));};exports[_0x27aa('0x58')]=function(_0x45ef7d,_0x1064b6){var _0x103529={'raw':![],'where':{'id':_0x45ef7d[_0x27aa('0x59')]['id']}},_0x4ec609={};_0x4ec609['model']=_['keys'](db[_0x27aa('0x3e')][_0x27aa('0x3f')]);_0x4ec609[_0x27aa('0x44')]=_['keys'](_0x45ef7d[_0x27aa('0x44')]);_0x4ec609['filters']=_[_0x27aa('0x47')](_0x4ec609['model'],_0x4ec609[_0x27aa('0x44')]);_0x103529['attributes']=_['intersection'](_0x4ec609['model'],qs['fields'](_0x45ef7d['query'][_0x27aa('0x49')]));_0x103529[_0x27aa('0x48')]=_0x103529[_0x27aa('0x48')][_0x27aa('0x4a')]?_0x103529[_0x27aa('0x48')]:_0x4ec609[_0x27aa('0x43')];if(_0x45ef7d[_0x27aa('0x44')][_0x27aa('0x54')]){_0x103529[_0x27aa('0x5a')]=[{'all':!![]}];}_0x103529=_[_0x27aa('0x50')]({},_0x103529,_0x45ef7d[_0x27aa('0x53')]);return db['VoiceContext'][_0x27aa('0x5b')](_0x103529)[_0x27aa('0x35')](handleEntityNotFound(_0x1064b6,null))[_0x27aa('0x35')](respondWithResult(_0x1064b6,null))['catch'](handleError(_0x1064b6,null));};exports[_0x27aa('0x5c')]=function(_0x5efb44,_0x2841c4,_0x35d5f6){var _0x2dd61e;return db[_0x27aa('0x3e')][_0x27aa('0x5c')](_0x5efb44[_0x27aa('0x5d')],{'raw':!![]})[_0x27aa('0x35')](function(_0x30b1ac){_0x2dd61e=_0x30b1ac;return db[_0x27aa('0x3e')][_0x27aa('0x55')]({'raw':!![]});})['then'](function(_0x350015){var _0x206693=fs[_0x27aa('0x5e')](path[_0x27aa('0x5f')](config[_0x27aa('0x60')],_0x27aa('0x61')),'utf8');var _0x52dc53=ejs[_0x27aa('0x62')](_0x206693,{'contexts':_0x350015||[]});fs[_0x27aa('0x63')](_0x27aa('0x64'),_0x52dc53);})[_0x27aa('0x35')](function(){return respondWithRpcPromise('Reload',_0x27aa('0x5c'),{'module':'chan_sip.so'});})[_0x27aa('0x35')](function(){var _0x576374=_0x5efb44['user'][_0x27aa('0x36')]({'plain':!![]});if(!_0x576374)throw new Error(_0x27aa('0x65'));if(_0x576374[_0x27aa('0x66')]===_0x27aa('0x67')){var _0x378d5b=_0x2dd61e[_0x27aa('0x36')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x27aa('0x37'),'userProfileId':_0x576374[_0x27aa('0x68')]},'raw':!![]})[_0x27aa('0x35')](function(_0x2ea339){if(_0x2ea339&&_0x2ea339['autoAssociation']===0x0){return db[_0x27aa('0x38')][_0x27aa('0x5c')]({'name':_0x378d5b['name'],'resourceId':_0x378d5b['id'],'type':_0x2ea339[_0x27aa('0x3a')],'sectionId':_0x2ea339['id']},{})['then'](function(){return _0x2dd61e;});}else{return _0x2dd61e;}})['catch'](function(_0x3cd350){logger[_0x27aa('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cd350);throw _0x3cd350;});}return _0x2dd61e;})[_0x27aa('0x35')](respondWithResult(_0x2841c4,0xc9))[_0x27aa('0x57')](handleError(_0x2841c4,null));};exports[_0x27aa('0x33')]=function(_0x123753,_0x404e8e,_0x2ddaa8){var _0x461d0d;return db['VoiceContext'][_0x27aa('0x5b')]({'where':{'id':_0x123753['params']['id']}})[_0x27aa('0x35')](handleEntityNotFound(_0x404e8e,null))[_0x27aa('0x35')](saveUpdates(_0x123753[_0x27aa('0x5d')],null))['then'](function(_0x6e5875){if(_0x6e5875){_0x461d0d=_0x6e5875;return db[_0x27aa('0x3e')]['findAll']({'raw':!![]});}})['then'](function(_0x5ee999){var _0x3cafa1=fs['readFileSync'](path[_0x27aa('0x5f')](config[_0x27aa('0x60')],_0x27aa('0x61')),_0x27aa('0x69'));var _0x948cd4=ejs['render'](_0x3cafa1,{'contexts':_0x5ee999||[]});fs[_0x27aa('0x63')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x948cd4);})[_0x27aa('0x35')](function(){return respondWithRpcPromise(_0x27aa('0x6a'),_0x27aa('0x33'),{'module':_0x27aa('0x6b')});})['then'](function(){return _0x461d0d;})[_0x27aa('0x35')](respondWithResult(_0x404e8e,null))[_0x27aa('0x57')](handleError(_0x404e8e,null));};exports['destroy']=function(_0x41fc91,_0x5b36bd,_0x8bd6ac){var _0x4e1337;return db[_0x27aa('0x3e')]['find']({'where':{'id':_0x41fc91[_0x27aa('0x59')]['id']}})[_0x27aa('0x35')](handleEntityNotFound(_0x5b36bd,null))[_0x27aa('0x35')](removeEntity(_0x5b36bd,null))[_0x27aa('0x35')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x27aa('0x35')](function(_0x543b2e){var _0x7ec80d=fs[_0x27aa('0x5e')](path[_0x27aa('0x5f')](config[_0x27aa('0x60')],_0x27aa('0x61')),_0x27aa('0x69'));var _0xb71b30=ejs['render'](_0x7ec80d,{'contexts':_0x543b2e});fs[_0x27aa('0x63')](_0x27aa('0x64'),_0xb71b30);return respondWithRpcPromise(_0x27aa('0x6a'),_0x27aa('0x34'),{'module':_0x27aa('0x6b')});})[_0x27aa('0x57')](handleError(_0x5b36bd,null));}; \ No newline at end of file +var _0x2b87=['http','request','then','request\x20sent','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','destroy','Contexts','UserProfileResource','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','VoiceContext','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','writeFileSync','Reload','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','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','jayson/promise','client'];(function(_0x31ead6,_0x2b9768){var _0x18343e=function(_0x523173){while(--_0x523173){_0x31ead6['push'](_0x31ead6['shift']());}};_0x18343e(++_0x2b9768);}(_0x2b87,0x109));var _0x72b8=function(_0x3c38da,_0x321e19){_0x3c38da=_0x3c38da-0x0;var _0xc7b900=_0x2b87[_0x3c38da];return _0xc7b900;};'use strict';var emlformat=require(_0x72b8('0x0'));var rimraf=require(_0x72b8('0x1'));var zipdir=require(_0x72b8('0x2'));var jsonpatch=require(_0x72b8('0x3'));var rp=require('request-promise');var moment=require(_0x72b8('0x4'));var BPromise=require(_0x72b8('0x5'));var Mustache=require(_0x72b8('0x6'));var util=require(_0x72b8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x72b8('0x8'));var ejs=require(_0x72b8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72b8('0xa'));var squel=require(_0x72b8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x72b8('0xc'));var toCsv=require(_0x72b8('0x8'));var querystring=require(_0x72b8('0xd'));var Papa=require('papaparse');var Redis=require(_0x72b8('0xe'));var authService=require(_0x72b8('0xf'));var qs=require(_0x72b8('0x10'));var as=require(_0x72b8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72b8('0x12'))(_0x72b8('0x13'));var utils=require(_0x72b8('0x14'));var config=require(_0x72b8('0x15'));var licenseUtil=require(_0x72b8('0x16'));var db=require(_0x72b8('0x17'))['db'];var jayson=require(_0x72b8('0x18'));var client=jayson[_0x72b8('0x19')][_0x72b8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5b8794,_0x285aaf,_0x8336f7,_0x1e23ee){return new BPromise(function(_0x5af858,_0x523aba){var _0x18f5e8=_0x1e23ee||client;return _0x18f5e8[_0x72b8('0x1b')](_0x5b8794,_0x8336f7)[_0x72b8('0x1c')](function(_0x52722c){logger['info']('VoiceContext,\x20%s,\x20%s',_0x285aaf,_0x72b8('0x1d'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x285aaf,_0x72b8('0x1d'),JSON['stringify'](_0x52722c));if(_0x52722c[_0x72b8('0x1e')]){if(_0x52722c['error'][_0x72b8('0x1f')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x285aaf,_0x52722c[_0x72b8('0x1e')]['message']);return _0x523aba(_0x52722c['error']['message']);}logger[_0x72b8('0x1e')](_0x72b8('0x20'),_0x285aaf,_0x52722c[_0x72b8('0x1e')]['message']);return _0x5af858(_0x52722c[_0x72b8('0x1e')][_0x72b8('0x21')]);}else{logger['info'](_0x72b8('0x20'),_0x285aaf,'request\x20sent');_0x5af858(_0x52722c[_0x72b8('0x22')][_0x72b8('0x21')]);}})[_0x72b8('0x23')](function(_0x5d1843){logger[_0x72b8('0x1e')](_0x72b8('0x20'),_0x285aaf,_0x5d1843);_0x523aba(_0x5d1843);});});}function respondWithStatusCode(_0x47f471,_0x304092){_0x304092=_0x304092||0xcc;return function(_0x2e2d67){if(_0x2e2d67){return _0x47f471[_0x72b8('0x24')](_0x304092);}return _0x47f471[_0x72b8('0x25')](_0x304092)[_0x72b8('0x26')]();};}function respondWithResult(_0x384652,_0x4ee3bb){_0x4ee3bb=_0x4ee3bb||0xc8;return function(_0x5af8be){if(_0x5af8be){return _0x384652['status'](_0x4ee3bb)['json'](_0x5af8be);}};}function respondWithFilteredResult(_0x7a0f26,_0x118af9){return function(_0x19904e){if(_0x19904e){var _0x370d95=typeof _0x118af9[_0x72b8('0x27')]===_0x72b8('0x28')&&typeof _0x118af9['limit']===_0x72b8('0x28');var _0x181594=_0x19904e[_0x72b8('0x29')];var _0x3c5188=_0x370d95?0x0:_0x118af9[_0x72b8('0x27')];var _0x5108b9=_0x370d95?_0x19904e['count']:_0x118af9[_0x72b8('0x27')]+_0x118af9['limit'];var _0x5b2a73;if(_0x5108b9>=_0x181594){_0x5108b9=_0x181594;_0x5b2a73=0xc8;}else{_0x5b2a73=0xce;}_0x7a0f26['status'](_0x5b2a73);return _0x7a0f26['set'](_0x72b8('0x2a'),_0x3c5188+'-'+_0x5108b9+'/'+_0x181594)[_0x72b8('0x2b')](_0x19904e);}return null;};}function patchUpdates(_0x19592e){return function(_0x24c1f9){try{jsonpatch[_0x72b8('0x2c')](_0x24c1f9,_0x19592e,!![]);}catch(_0x43b04f){return BPromise[_0x72b8('0x2d')](_0x43b04f);}return _0x24c1f9['save']();};}function saveUpdates(_0x1736bd,_0x55919b){return function(_0x35e3eb){if(_0x35e3eb){return _0x35e3eb[_0x72b8('0x2e')](_0x1736bd)['then'](function(_0x4e84c4){return _0x4e84c4;});}return null;};}function removeEntity(_0x4df2bc,_0x31671f){return function(_0x402364){if(_0x402364){return _0x402364[_0x72b8('0x2f')]()['then'](function(){var _0x1d9b17=_0x402364['get']({'plain':!![]});var _0x7a59c3=_0x72b8('0x30');return db[_0x72b8('0x31')][_0x72b8('0x2f')]({'where':{'type':_0x7a59c3,'resourceId':_0x1d9b17['id']}})['then'](function(){return _0x402364;});})[_0x72b8('0x1c')](function(){_0x4df2bc[_0x72b8('0x25')](0xcc)[_0x72b8('0x26')]();});}};}function handleEntityNotFound(_0xa5b93b,_0xf258b1){return function(_0x489603){if(!_0x489603){_0xa5b93b['sendStatus'](0x194);}return _0x489603;};}function handleError(_0x37c1fe,_0x1336e9){_0x1336e9=_0x1336e9||0x1f4;return function(_0x3bae0c){logger['error'](_0x3bae0c['stack']);if(_0x3bae0c[_0x72b8('0x32')]){delete _0x3bae0c[_0x72b8('0x32')];}_0x37c1fe[_0x72b8('0x25')](_0x1336e9)[_0x72b8('0x33')](_0x3bae0c);};}exports[_0x72b8('0x34')]=function(_0x45192f,_0x352b5c){var _0xd7e9c4={},_0x2035bc={},_0x59fe5e={'count':0x0,'rows':[]};var _0x1252be=_['map'](db['VoiceContext'][_0x72b8('0x35')],function(_0x1b6e58){return{'name':_0x1b6e58['fieldName'],'type':_0x1b6e58[_0x72b8('0x36')]['key']};});_0x2035bc[_0x72b8('0x37')]=_[_0x72b8('0x38')](_0x1252be,_0x72b8('0x32'));_0x2035bc[_0x72b8('0x39')]=_[_0x72b8('0x3a')](_0x45192f['query']);_0x2035bc[_0x72b8('0x3b')]=_[_0x72b8('0x3c')](_0x2035bc[_0x72b8('0x37')],_0x2035bc[_0x72b8('0x39')]);_0xd7e9c4[_0x72b8('0x3d')]=_[_0x72b8('0x3c')](_0x2035bc[_0x72b8('0x37')],qs['fields'](_0x45192f[_0x72b8('0x39')][_0x72b8('0x3e')]));_0xd7e9c4[_0x72b8('0x3d')]=_0xd7e9c4[_0x72b8('0x3d')]['length']?_0xd7e9c4[_0x72b8('0x3d')]:_0x2035bc[_0x72b8('0x37')];if(!_0x45192f[_0x72b8('0x39')]['hasOwnProperty'](_0x72b8('0x3f'))){_0xd7e9c4[_0x72b8('0x40')]=qs[_0x72b8('0x40')](_0x45192f[_0x72b8('0x39')]['limit']);_0xd7e9c4[_0x72b8('0x27')]=qs[_0x72b8('0x27')](_0x45192f[_0x72b8('0x39')][_0x72b8('0x27')]);}_0xd7e9c4['order']=qs[_0x72b8('0x41')](_0x45192f[_0x72b8('0x39')][_0x72b8('0x41')]);_0xd7e9c4['where']=qs[_0x72b8('0x3b')](_['pick'](_0x45192f[_0x72b8('0x39')],_0x2035bc['filters']),_0x1252be);if(_0x45192f[_0x72b8('0x39')]['filter']){_0xd7e9c4[_0x72b8('0x42')]=_[_0x72b8('0x43')](_0xd7e9c4['where'],{'$or':_['map'](_0x1252be,function(_0x20a54f){if(_0x20a54f[_0x72b8('0x36')]!==_0x72b8('0x44')){var _0x4a5119={};_0x4a5119[_0x20a54f['name']]={'$like':'%'+_0x45192f['query'][_0x72b8('0x45')]+'%'};return _0x4a5119;}})});}_0xd7e9c4=_[_0x72b8('0x43')]({},_0xd7e9c4,_0x45192f[_0x72b8('0x46')]);var _0x2a1634={'where':_0xd7e9c4[_0x72b8('0x42')]};return db[_0x72b8('0x47')][_0x72b8('0x29')](_0x2a1634)[_0x72b8('0x1c')](function(_0x1c6f01){_0x59fe5e['count']=_0x1c6f01;if(_0x45192f['query'][_0x72b8('0x48')]){_0xd7e9c4[_0x72b8('0x49')]=[{'all':!![]}];}return db[_0x72b8('0x47')][_0x72b8('0x4a')](_0xd7e9c4);})[_0x72b8('0x1c')](function(_0x48f6a6){_0x59fe5e[_0x72b8('0x4b')]=_0x48f6a6;return _0x59fe5e;})['then'](respondWithFilteredResult(_0x352b5c,_0xd7e9c4))[_0x72b8('0x23')](handleError(_0x352b5c,null));};exports[_0x72b8('0x4c')]=function(_0x1df071,_0x5c238b){var _0x5b233b={'raw':![],'where':{'id':_0x1df071[_0x72b8('0x4d')]['id']}},_0x47d980={};_0x47d980[_0x72b8('0x37')]=_['keys'](db[_0x72b8('0x47')][_0x72b8('0x35')]);_0x47d980[_0x72b8('0x39')]=_['keys'](_0x1df071[_0x72b8('0x39')]);_0x47d980[_0x72b8('0x3b')]=_['intersection'](_0x47d980['model'],_0x47d980['query']);_0x5b233b[_0x72b8('0x3d')]=_[_0x72b8('0x3c')](_0x47d980['model'],qs['fields'](_0x1df071[_0x72b8('0x39')]['fields']));_0x5b233b[_0x72b8('0x3d')]=_0x5b233b[_0x72b8('0x3d')][_0x72b8('0x4e')]?_0x5b233b['attributes']:_0x47d980[_0x72b8('0x37')];if(_0x1df071[_0x72b8('0x39')][_0x72b8('0x48')]){_0x5b233b[_0x72b8('0x49')]=[{'all':!![]}];}_0x5b233b=_['merge']({},_0x5b233b,_0x1df071['options']);return db[_0x72b8('0x47')][_0x72b8('0x4f')](_0x5b233b)[_0x72b8('0x1c')](handleEntityNotFound(_0x5c238b,null))[_0x72b8('0x1c')](respondWithResult(_0x5c238b,null))[_0x72b8('0x23')](handleError(_0x5c238b,null));};exports[_0x72b8('0x50')]=function(_0x2d6fb9,_0x3698c0,_0x46e04d){var _0x271e22;return db[_0x72b8('0x47')][_0x72b8('0x50')](_0x2d6fb9[_0x72b8('0x51')],{'raw':!![]})[_0x72b8('0x1c')](function(_0x41602e){_0x271e22=_0x41602e;return db[_0x72b8('0x47')][_0x72b8('0x4a')]({'raw':!![]});})['then'](function(_0x52c645){var _0x3d36f1=fs[_0x72b8('0x52')](path[_0x72b8('0x53')](config[_0x72b8('0x54')],_0x72b8('0x55')),'utf8');var _0x55bc01=ejs[_0x72b8('0x56')](_0x3d36f1,{'contexts':_0x52c645||[]});fs['writeFileSync'](_0x72b8('0x57'),_0x55bc01);})[_0x72b8('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x72b8('0x58')});})[_0x72b8('0x1c')](function(){var _0x322f87=_0x2d6fb9[_0x72b8('0x59')][_0x72b8('0x5a')]({'plain':!![]});if(!_0x322f87)throw new Error(_0x72b8('0x5b'));if(_0x322f87[_0x72b8('0x5c')]===_0x72b8('0x59')){var _0x416657=_0x271e22['get']({'plain':!![]});return db['UserProfileSection'][_0x72b8('0x4f')]({'where':{'name':_0x72b8('0x30'),'userProfileId':_0x322f87['userProfileId']},'raw':!![]})[_0x72b8('0x1c')](function(_0x3323e0){if(_0x3323e0&&_0x3323e0['autoAssociation']===0x0){return db[_0x72b8('0x31')][_0x72b8('0x50')]({'name':_0x416657[_0x72b8('0x32')],'resourceId':_0x416657['id'],'type':_0x3323e0[_0x72b8('0x32')],'sectionId':_0x3323e0['id']},{})[_0x72b8('0x1c')](function(){return _0x271e22;});}else{return _0x271e22;}})['catch'](function(_0x38b6a8){logger[_0x72b8('0x1e')](_0x72b8('0x5d'),_0x38b6a8);throw _0x38b6a8;});}return _0x271e22;})['then'](respondWithResult(_0x3698c0,0xc9))[_0x72b8('0x23')](handleError(_0x3698c0,null));};exports[_0x72b8('0x2e')]=function(_0x31cdbd,_0x33b05f,_0x3ee618){var _0x4d8cf8;return db[_0x72b8('0x47')][_0x72b8('0x4f')]({'where':{'id':_0x31cdbd['params']['id']}})[_0x72b8('0x1c')](handleEntityNotFound(_0x33b05f,null))[_0x72b8('0x1c')](saveUpdates(_0x31cdbd['body'],null))[_0x72b8('0x1c')](function(_0x5a8c8f){if(_0x5a8c8f){_0x4d8cf8=_0x5a8c8f;return db[_0x72b8('0x47')][_0x72b8('0x4a')]({'raw':!![]});}})[_0x72b8('0x1c')](function(_0x2edd7b){var _0xb17c84=fs[_0x72b8('0x52')](path['join'](config[_0x72b8('0x54')],_0x72b8('0x55')),_0x72b8('0x5e'));var _0x2a1c03=ejs[_0x72b8('0x56')](_0xb17c84,{'contexts':_0x2edd7b||[]});fs[_0x72b8('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2a1c03);})['then'](function(){return respondWithRpcPromise(_0x72b8('0x60'),_0x72b8('0x2e'),{'module':'chan_sip.so'});})[_0x72b8('0x1c')](function(){return _0x4d8cf8;})[_0x72b8('0x1c')](respondWithResult(_0x33b05f,null))[_0x72b8('0x23')](handleError(_0x33b05f,null));};exports[_0x72b8('0x2f')]=function(_0xcbc4bf,_0x55ba5e,_0x156339){var _0xa1f788;return db['VoiceContext'][_0x72b8('0x4f')]({'where':{'id':_0xcbc4bf[_0x72b8('0x4d')]['id']}})[_0x72b8('0x1c')](handleEntityNotFound(_0x55ba5e,null))['then'](removeEntity(_0x55ba5e,null))[_0x72b8('0x1c')](function(){return db[_0x72b8('0x47')]['findAll']({'raw':!![]});})[_0x72b8('0x1c')](function(_0x462e38){var _0x12090c=fs[_0x72b8('0x52')](path['join'](config[_0x72b8('0x54')],_0x72b8('0x55')),'utf8');var _0x5cd928=ejs[_0x72b8('0x56')](_0x12090c,{'contexts':_0x462e38});fs[_0x72b8('0x5f')](_0x72b8('0x57'),_0x5cd928);return respondWithRpcPromise(_0x72b8('0x60'),_0x72b8('0x2f'),{'module':_0x72b8('0x58')});})[_0x72b8('0x23')](handleError(_0x55ba5e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5675011..501ae77 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 _0x7574=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','VoiceContext'];(function(_0x5dd06b,_0x1d95ff){var _0xca112a=function(_0x12958b){while(--_0x12958b){_0x5dd06b['push'](_0x5dd06b['shift']());}};_0xca112a(++_0x1d95ff);}(_0x7574,0x1ec));var _0x4757=function(_0x297f95,_0x4be7b2){_0x297f95=_0x297f95-0x0;var _0x2d37bc=_0x7574[_0x297f95];return _0x2d37bc;};'use strict';var _=require(_0x4757('0x0'));var util=require(_0x4757('0x1'));var logger=require(_0x4757('0x2'))(_0x4757('0x3'));var moment=require(_0x4757('0x4'));var BPromise=require(_0x4757('0x5'));var rp=require(_0x4757('0x6'));var fs=require('fs');var path=require(_0x4757('0x7'));var rimraf=require(_0x4757('0x8'));var config=require('../../config/environment');var attributes=require(_0x4757('0x9'));module['exports']=function(_0x10b400,_0x10e5b9){return _0x10b400[_0x4757('0xa')](_0x4757('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a3e=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a3e,0xd6));var _0xe0a3=function(_0x3c6965,_0x286311){_0x3c6965=_0x3c6965-0x0;var _0xe1b601=_0x0a3e[_0x3c6965];return _0xe1b601;};'use strict';var _=require(_0xe0a3('0x0'));var util=require(_0xe0a3('0x1'));var logger=require(_0xe0a3('0x2'))(_0xe0a3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe0a3('0x4'));var fs=require('fs');var path=require(_0xe0a3('0x5'));var rimraf=require(_0xe0a3('0x6'));var config=require(_0xe0a3('0x7'));var attributes=require(_0xe0a3('0x8'));module[_0xe0a3('0x9')]=function(_0x238bc4,_0x920873){return _0x238bc4[_0xe0a3('0xa')](_0xe0a3('0xb'),attributes,{'tableName':_0xe0a3('0xc'),'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 b9e4534..ee241d3 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 _0xa6ea=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','lodash','util','moment','bluebird'];(function(_0x42c4cd,_0x3c8fba){var _0x4fe7c8=function(_0x19a6fd){while(--_0x19a6fd){_0x42c4cd['push'](_0x42c4cd['shift']());}};_0x4fe7c8(++_0x3c8fba);}(_0xa6ea,0x122));var _0xaa6e=function(_0x3357ab,_0x1b9cf8){_0x3357ab=_0x3357ab-0x0;var _0x5e5a27=_0xa6ea[_0x3357ab];return _0x5e5a27;};'use strict';var _=require(_0xaa6e('0x0'));var util=require(_0xaa6e('0x1'));var moment=require(_0xaa6e('0x2'));var BPromise=require(_0xaa6e('0x3'));var rs=require(_0xaa6e('0x4'));var fs=require('fs');var Redis=require(_0xaa6e('0x5'));var db=require(_0xaa6e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa6e('0x7'))(_0xaa6e('0x8'));var config=require(_0xaa6e('0x9'));var jayson=require(_0xaa6e('0xa'));var client=jayson[_0xaa6e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x543fc1,_0x582240,_0x1e3706){return new BPromise(function(_0x22d3e4,_0x2c9dcd){return client[_0xaa6e('0xc')](_0x543fc1,_0x1e3706)[_0xaa6e('0xd')](function(_0x139806){logger['info'](_0xaa6e('0xe'),_0x582240,'request\x20sent');logger['debug'](_0xaa6e('0xf'),_0x582240,'request\x20sent',JSON['stringify'](_0x139806));if(_0x139806[_0xaa6e('0x10')]){if(_0x139806[_0xaa6e('0x10')]['code']===0x1f4){logger[_0xaa6e('0x10')]('VoiceContext,\x20%s,\x20%s',_0x582240,_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);return _0x2c9dcd(_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);}logger[_0xaa6e('0x10')](_0xaa6e('0xe'),_0x582240,_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);return _0x22d3e4(_0x139806[_0xaa6e('0x10')]['message']);}else{logger[_0xaa6e('0x12')](_0xaa6e('0xe'),_0x582240,_0xaa6e('0x13'));_0x22d3e4(_0x139806['result'][_0xaa6e('0x11')]);}})[_0xaa6e('0x14')](function(_0x475b7d){logger[_0xaa6e('0x10')]('VoiceContext,\x20%s,\x20%s',_0x582240,_0x475b7d);_0x2c9dcd(_0x475b7d);});});} \ No newline at end of file +var _0xeb43=['request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','then','info'];(function(_0x27a3cb,_0x4af597){var _0x54ff38=function(_0x3a82d2){while(--_0x3a82d2){_0x27a3cb['push'](_0x27a3cb['shift']());}};_0x54ff38(++_0x4af597);}(_0xeb43,0x149));var _0x3eb4=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0xeb43[_0x3b16e1];return _0x311d1b;};'use strict';var _=require(_0x3eb4('0x0'));var util=require(_0x3eb4('0x1'));var moment=require(_0x3eb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x3eb4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3eb4('0x4'));var logger=require(_0x3eb4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3eb4('0x6'));var client=jayson[_0x3eb4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45b9b8,_0x5d8f80,_0x14f2c3){return new BPromise(function(_0x557a28,_0x43570f){return client[_0x3eb4('0x8')](_0x45b9b8,_0x14f2c3)[_0x3eb4('0x9')](function(_0x10f337){logger[_0x3eb4('0xa')]('VoiceContext,\x20%s,\x20%s',_0x5d8f80,_0x3eb4('0xb'));logger['debug'](_0x3eb4('0xc'),_0x5d8f80,_0x3eb4('0xb'),JSON[_0x3eb4('0xd')](_0x10f337));if(_0x10f337[_0x3eb4('0xe')]){if(_0x10f337['error'][_0x3eb4('0xf')]===0x1f4){logger[_0x3eb4('0xe')](_0x3eb4('0x10'),_0x5d8f80,_0x10f337[_0x3eb4('0xe')][_0x3eb4('0x11')]);return _0x43570f(_0x10f337[_0x3eb4('0xe')]['message']);}logger[_0x3eb4('0xe')]('VoiceContext,\x20%s,\x20%s',_0x5d8f80,_0x10f337['error'][_0x3eb4('0x11')]);return _0x557a28(_0x10f337['error'][_0x3eb4('0x11')]);}else{logger[_0x3eb4('0xa')](_0x3eb4('0x10'),_0x5d8f80,_0x3eb4('0xb'));_0x557a28(_0x10f337[_0x3eb4('0x12')][_0x3eb4('0x11')]);}})[_0x3eb4('0x13')](function(_0x3fdd27){logger[_0x3eb4('0xe')](_0x3eb4('0x10'),_0x5d8f80,_0x3fdd27);_0x43570f(_0x3fdd27);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a1c5a65..51e77e4 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 _0x9ba9=['express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','util','path'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x9ba9,0xb2));var _0x99ba=function(_0x223c73,_0x5981b3){_0x223c73=_0x223c73-0x0;var _0x5bcf9c=_0x9ba9[_0x223c73];return _0x5bcf9c;};'use strict';var multer=require('multer');var util=require(_0x99ba('0x0'));var path=require(_0x99ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x99ba('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x99ba('0x3'));var interaction=require(_0x99ba('0x4'));var config=require('../../config/environment');var controller=require(_0x99ba('0x5'));router['get']('/',auth[_0x99ba('0x6')](),controller[_0x99ba('0x7')]);router[_0x99ba('0x8')](_0x99ba('0x9'),auth[_0x99ba('0x6')](),controller[_0x99ba('0xa')]);router['get'](_0x99ba('0xb'),auth[_0x99ba('0x6')](),controller[_0x99ba('0xc')]);router[_0x99ba('0xd')]('/',auth[_0x99ba('0x6')](),controller[_0x99ba('0xe')]);router[_0x99ba('0xf')](_0x99ba('0xb'),auth[_0x99ba('0x6')](),controller[_0x99ba('0x10')]);router['delete']('/:id',auth[_0x99ba('0x6')](),controller['destroy']);module[_0x99ba('0x11')]=router; \ No newline at end of file +var _0x1360=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x2ab2cc,_0xe88512){var _0x4f89f6=function(_0x3f6e6c){while(--_0x3f6e6c){_0x2ab2cc['push'](_0x2ab2cc['shift']());}};_0x4f89f6(++_0xe88512);}(_0x1360,0xd6));var _0x0136=function(_0x3b534c,_0x2c614f){_0x3b534c=_0x3b534c-0x0;var _0x449ef9=_0x1360[_0x3b534c];return _0x449ef9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0136('0x0'));var timeout=require(_0x0136('0x1'));var express=require(_0x0136('0x2'));var router=express[_0x0136('0x3')]();var fs_extra=require(_0x0136('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0136('0x5'));var config=require(_0x0136('0x6'));var controller=require(_0x0136('0x7'));router[_0x0136('0x8')]('/',auth[_0x0136('0x9')](),controller[_0x0136('0xa')]);router['get']('/describe',auth[_0x0136('0x9')](),controller[_0x0136('0xb')]);router[_0x0136('0x8')](_0x0136('0xc'),auth[_0x0136('0x9')](),controller[_0x0136('0xd')]);router[_0x0136('0xe')]('/',auth[_0x0136('0x9')](),controller[_0x0136('0xf')]);router[_0x0136('0x10')]('/:id',auth[_0x0136('0x9')](),controller[_0x0136('0x11')]);router[_0x0136('0x12')](_0x0136('0xc'),auth[_0x0136('0x9')](),controller[_0x0136('0x13')]);module[_0x0136('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 c6481b5..88db09b 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 _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x44a2fb,_0x487474){var _0x4f4dff=function(_0x59e847){while(--_0x59e847){_0x44a2fb['push'](_0x44a2fb['shift']());}};_0x4f4dff(++_0x487474);}(_0x34e8,0x12c));var _0x834e=function(_0x3aaf70,_0x46023e){_0x3aaf70=_0x3aaf70-0x0;var _0x437c40=_0x34e8[_0x3aaf70];return _0x437c40;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file +var _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0xa5f5ab,_0x251aa3){var _0xc25c1b=function(_0x10af38){while(--_0x10af38){_0xa5f5ab['push'](_0xa5f5ab['shift']());}};_0xc25c1b(++_0x251aa3);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x473399,_0x1cea7d){_0x473399=_0x473399-0x0;var _0x106022=_0x8d0e[_0x473399];return _0x106022;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 4c14171..e48d2b0 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 _0xd700=['includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x433795,_0x253d09){var _0x27661e=function(_0x1c4870){while(--_0x1c4870){_0x433795['push'](_0x433795['shift']());}};_0x27661e(++_0x253d09);}(_0xd700,0xe6));var _0x0d70=function(_0x39bf66,_0x35c96c){_0x39bf66=_0x39bf66-0x0;var _0x431030=_0xd700[_0x39bf66];return _0x431030;};'use strict';var emlformat=require(_0x0d70('0x0'));var rimraf=require(_0x0d70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d70('0x2'));var Mustache=require(_0x0d70('0x3'));var util=require(_0x0d70('0x4'));var path=require(_0x0d70('0x5'));var sox=require(_0x0d70('0x6'));var csv=require(_0x0d70('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d70('0x8'));var squel=require(_0x0d70('0x9'));var crypto=require('crypto');var jsforce=require(_0x0d70('0xa'));var deskjs=require(_0x0d70('0xb'));var toCsv=require(_0x0d70('0x7'));var querystring=require(_0x0d70('0xc'));var Papa=require(_0x0d70('0xd'));var Redis=require(_0x0d70('0xe'));var authService=require(_0x0d70('0xf'));var qs=require(_0x0d70('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d70('0x11'));var logger=require(_0x0d70('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x0d70('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d70('0x14'))['db'];function respondWithStatusCode(_0x4d7aaa,_0xf872ce){_0xf872ce=_0xf872ce||0xcc;return function(_0x47763){if(_0x47763){return _0x4d7aaa[_0x0d70('0x15')](_0xf872ce);}return _0x4d7aaa[_0x0d70('0x16')](_0xf872ce)['end']();};}function respondWithResult(_0x47a273,_0x4bd976){_0x4bd976=_0x4bd976||0xc8;return function(_0x488a52){if(_0x488a52){return _0x47a273[_0x0d70('0x16')](_0x4bd976)[_0x0d70('0x17')](_0x488a52);}};}function respondWithFilteredResult(_0x1aa77e,_0x45f241){return function(_0x38426a){if(_0x38426a){var _0x330d86=typeof _0x45f241[_0x0d70('0x18')]===_0x0d70('0x19')&&typeof _0x45f241['limit']===_0x0d70('0x19');var _0x48ae13=_0x38426a[_0x0d70('0x1a')];var _0x54286b=_0x330d86?0x0:_0x45f241[_0x0d70('0x18')];var _0x2a3169=_0x330d86?_0x38426a['count']:_0x45f241[_0x0d70('0x18')]+_0x45f241[_0x0d70('0x1b')];var _0x5186e2;if(_0x2a3169>=_0x48ae13){_0x2a3169=_0x48ae13;_0x5186e2=0xc8;}else{_0x5186e2=0xce;}_0x1aa77e[_0x0d70('0x16')](_0x5186e2);return _0x1aa77e['set']('Content-Range',_0x54286b+'-'+_0x2a3169+'/'+_0x48ae13)['json'](_0x38426a);}return null;};}function patchUpdates(_0x31c9e5){return function(_0x35e6c5){try{jsonpatch[_0x0d70('0x1c')](_0x35e6c5,_0x31c9e5,!![]);}catch(_0x4f5254){return BPromise[_0x0d70('0x1d')](_0x4f5254);}return _0x35e6c5[_0x0d70('0x1e')]();};}function saveUpdates(_0x2b9f17,_0x4a2818){return function(_0x3b3027){if(_0x3b3027){return _0x3b3027[_0x0d70('0x1f')](_0x2b9f17)[_0x0d70('0x20')](function(_0x37c1d8){return _0x37c1d8;});}return null;};}function removeEntity(_0x42e5ea,_0x4bdbcd){return function(_0x6011d7){if(_0x6011d7){return _0x6011d7[_0x0d70('0x21')]()[_0x0d70('0x20')](function(){_0x42e5ea[_0x0d70('0x16')](0xcc)[_0x0d70('0x22')]();});}};}function handleEntityNotFound(_0x50aac2,_0xcc97ce){return function(_0x158703){if(!_0x158703){_0x50aac2[_0x0d70('0x15')](0x194);}return _0x158703;};}function handleError(_0x56742b,_0x542b47){_0x542b47=_0x542b47||0x1f4;return function(_0x40482a){logger[_0x0d70('0x23')](_0x40482a[_0x0d70('0x24')]);if(_0x40482a['name']){delete _0x40482a['name'];}_0x56742b['status'](_0x542b47)[_0x0d70('0x25')](_0x40482a);};}exports[_0x0d70('0x26')]=function(_0x1848eb,_0x3d06f1){var _0x10b433={},_0x289d93={},_0x3d386f={'count':0x0,'rows':[]};var _0x80d2cd=_[_0x0d70('0x27')](db[_0x0d70('0x28')][_0x0d70('0x29')],function(_0x44bed9){return{'name':_0x44bed9[_0x0d70('0x2a')],'type':_0x44bed9[_0x0d70('0x2b')]['key']};});_0x289d93[_0x0d70('0x2c')]=_[_0x0d70('0x27')](_0x80d2cd,_0x0d70('0x2d'));_0x289d93[_0x0d70('0x2e')]=_['keys'](_0x1848eb['query']);_0x289d93[_0x0d70('0x2f')]=_['intersection'](_0x289d93[_0x0d70('0x2c')],_0x289d93[_0x0d70('0x2e')]);_0x10b433[_0x0d70('0x30')]=_[_0x0d70('0x31')](_0x289d93['model'],qs[_0x0d70('0x32')](_0x1848eb[_0x0d70('0x2e')]['fields']));_0x10b433[_0x0d70('0x30')]=_0x10b433[_0x0d70('0x30')][_0x0d70('0x33')]?_0x10b433[_0x0d70('0x30')]:_0x289d93[_0x0d70('0x2c')];if(!_0x1848eb[_0x0d70('0x2e')][_0x0d70('0x34')](_0x0d70('0x35'))){_0x10b433['limit']=qs[_0x0d70('0x1b')](_0x1848eb[_0x0d70('0x2e')]['limit']);_0x10b433['offset']=qs[_0x0d70('0x18')](_0x1848eb['query']['offset']);}_0x10b433[_0x0d70('0x36')]=qs[_0x0d70('0x37')](_0x1848eb[_0x0d70('0x2e')][_0x0d70('0x37')]);_0x10b433[_0x0d70('0x38')]=qs[_0x0d70('0x2f')](_[_0x0d70('0x39')](_0x1848eb[_0x0d70('0x2e')],_0x289d93[_0x0d70('0x2f')]),_0x80d2cd);if(_0x1848eb[_0x0d70('0x2e')][_0x0d70('0x3a')]){_0x10b433[_0x0d70('0x38')]=_[_0x0d70('0x3b')](_0x10b433['where'],{'$or':_['map'](_0x80d2cd,function(_0x421dd0){if(_0x421dd0['type']!==_0x0d70('0x3c')){var _0x287f25={};_0x287f25[_0x421dd0[_0x0d70('0x2d')]]={'$like':'%'+_0x1848eb[_0x0d70('0x2e')][_0x0d70('0x3a')]+'%'};return _0x287f25;}})});}_0x10b433=_[_0x0d70('0x3b')]({},_0x10b433,_0x1848eb[_0x0d70('0x3d')]);var _0x16dd18={'where':_0x10b433[_0x0d70('0x38')]};return db[_0x0d70('0x28')][_0x0d70('0x1a')](_0x16dd18)[_0x0d70('0x20')](function(_0x19201a){_0x3d386f['count']=_0x19201a;if(_0x1848eb['query'][_0x0d70('0x3e')]){_0x10b433[_0x0d70('0x3f')]=[{'all':!![]}];}return db[_0x0d70('0x28')][_0x0d70('0x40')](_0x10b433);})[_0x0d70('0x20')](function(_0x181aad){_0x3d386f['rows']=_0x181aad;return _0x3d386f;})[_0x0d70('0x20')](respondWithFilteredResult(_0x3d06f1,_0x10b433))[_0x0d70('0x41')](handleError(_0x3d06f1,null));};exports[_0x0d70('0x42')]=function(_0x396f55,_0x2101c9){var _0xdf9e14={'raw':!![],'where':{'id':_0x396f55[_0x0d70('0x43')]['id']}},_0x3959d4={};_0x3959d4[_0x0d70('0x2c')]=_[_0x0d70('0x44')](db[_0x0d70('0x28')][_0x0d70('0x29')]);_0x3959d4[_0x0d70('0x2e')]=_[_0x0d70('0x44')](_0x396f55[_0x0d70('0x2e')]);_0x3959d4[_0x0d70('0x2f')]=_['intersection'](_0x3959d4['model'],_0x3959d4[_0x0d70('0x2e')]);_0xdf9e14['attributes']=_[_0x0d70('0x31')](_0x3959d4[_0x0d70('0x2c')],qs[_0x0d70('0x32')](_0x396f55[_0x0d70('0x2e')][_0x0d70('0x32')]));_0xdf9e14[_0x0d70('0x30')]=_0xdf9e14[_0x0d70('0x30')][_0x0d70('0x33')]?_0xdf9e14['attributes']:_0x3959d4[_0x0d70('0x2c')];if(_0x396f55[_0x0d70('0x2e')]['includeAll']){_0xdf9e14[_0x0d70('0x3f')]=[{'all':!![]}];}_0xdf9e14=_[_0x0d70('0x3b')]({},_0xdf9e14,_0x396f55['options']);return db[_0x0d70('0x28')]['find'](_0xdf9e14)[_0x0d70('0x20')](handleEntityNotFound(_0x2101c9,null))[_0x0d70('0x20')](respondWithResult(_0x2101c9,null))[_0x0d70('0x41')](handleError(_0x2101c9,null));};exports['create']=function(_0x2a714b,_0x35c8ae){return db[_0x0d70('0x28')][_0x0d70('0x45')](_0x2a714b[_0x0d70('0x46')],{})['then'](respondWithResult(_0x35c8ae,0xc9))[_0x0d70('0x41')](handleError(_0x35c8ae,null));};exports[_0x0d70('0x1f')]=function(_0xea05a8,_0x2e8fca){if(_0xea05a8[_0x0d70('0x46')]['id']){delete _0xea05a8[_0x0d70('0x46')]['id'];}return db[_0x0d70('0x28')][_0x0d70('0x47')]({'where':{'id':_0xea05a8[_0x0d70('0x43')]['id']}})[_0x0d70('0x20')](handleEntityNotFound(_0x2e8fca,null))[_0x0d70('0x20')](saveUpdates(_0xea05a8['body'],null))[_0x0d70('0x20')](respondWithResult(_0x2e8fca,null))[_0x0d70('0x41')](handleError(_0x2e8fca,null));};exports['destroy']=function(_0x2c1a08,_0x392019){return db[_0x0d70('0x28')][_0x0d70('0x47')]({'where':{'id':_0x2c1a08[_0x0d70('0x43')]['id']}})[_0x0d70('0x20')](handleEntityNotFound(_0x392019,null))[_0x0d70('0x20')](removeEntity(_0x392019,null))['catch'](handleError(_0x392019,null));};exports[_0x0d70('0x48')]=function(_0x3e15a1,_0x203ee4){return db[_0x0d70('0x28')][_0x0d70('0x48')]()[_0x0d70('0x20')](respondWithResult(_0x203ee4,null))[_0x0d70('0x41')](handleError(_0x203ee4,null));}; \ No newline at end of file +var _0xb75b=['where','pick','filter','merge','VIRTUAL','VoiceDialReport','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort'];(function(_0x29adb7,_0x4356ec){var _0x2d676d=function(_0x20b2a8){while(--_0x20b2a8){_0x29adb7['push'](_0x29adb7['shift']());}};_0x2d676d(++_0x4356ec);}(_0xb75b,0xea));var _0xbb75=function(_0x112e8b,_0x4ad05e){_0x112e8b=_0x112e8b-0x0;var _0x5e161a=_0xb75b[_0x112e8b];return _0x5e161a;};'use strict';var emlformat=require(_0xbb75('0x0'));var rimraf=require(_0xbb75('0x1'));var zipdir=require(_0xbb75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb75('0x3'));var moment=require(_0xbb75('0x4'));var BPromise=require(_0xbb75('0x5'));var Mustache=require(_0xbb75('0x6'));var util=require(_0xbb75('0x7'));var path=require(_0xbb75('0x8'));var sox=require(_0xbb75('0x9'));var csv=require(_0xbb75('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbb75('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbb75('0xc'));var toCsv=require(_0xbb75('0xa'));var querystring=require(_0xbb75('0xd'));var Papa=require(_0xbb75('0xe'));var Redis=require(_0xbb75('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb75('0x10'));var hardwareService=require(_0xbb75('0x11'));var logger=require('../../config/logger')(_0xbb75('0x12'));var utils=require(_0xbb75('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbb75('0x14'));var db=require(_0xbb75('0x15'))['db'];function respondWithStatusCode(_0x56c50f,_0x5c381c){_0x5c381c=_0x5c381c||0xcc;return function(_0x3f9714){if(_0x3f9714){return _0x56c50f[_0xbb75('0x16')](_0x5c381c);}return _0x56c50f['status'](_0x5c381c)[_0xbb75('0x17')]();};}function respondWithResult(_0x30f7ae,_0x437123){_0x437123=_0x437123||0xc8;return function(_0x3b6201){if(_0x3b6201){return _0x30f7ae[_0xbb75('0x18')](_0x437123)[_0xbb75('0x19')](_0x3b6201);}};}function respondWithFilteredResult(_0x173a3c,_0x4336eb){return function(_0xef63fd){if(_0xef63fd){var _0x9a308f=typeof _0x4336eb[_0xbb75('0x1a')]===_0xbb75('0x1b')&&typeof _0x4336eb[_0xbb75('0x1c')]===_0xbb75('0x1b');var _0x59d803=_0xef63fd['count'];var _0x25d1cf=_0x9a308f?0x0:_0x4336eb[_0xbb75('0x1a')];var _0x50bba4=_0x9a308f?_0xef63fd[_0xbb75('0x1d')]:_0x4336eb[_0xbb75('0x1a')]+_0x4336eb[_0xbb75('0x1c')];var _0x2708d4;if(_0x50bba4>=_0x59d803){_0x50bba4=_0x59d803;_0x2708d4=0xc8;}else{_0x2708d4=0xce;}_0x173a3c['status'](_0x2708d4);return _0x173a3c[_0xbb75('0x1e')](_0xbb75('0x1f'),_0x25d1cf+'-'+_0x50bba4+'/'+_0x59d803)[_0xbb75('0x19')](_0xef63fd);}return null;};}function patchUpdates(_0x55d948){return function(_0x3ff2e8){try{jsonpatch[_0xbb75('0x20')](_0x3ff2e8,_0x55d948,!![]);}catch(_0x46e856){return BPromise['reject'](_0x46e856);}return _0x3ff2e8['save']();};}function saveUpdates(_0x401d18,_0x3bd590){return function(_0x2864b3){if(_0x2864b3){return _0x2864b3[_0xbb75('0x21')](_0x401d18)['then'](function(_0x1a636e){return _0x1a636e;});}return null;};}function removeEntity(_0x4c9529,_0xd7edf2){return function(_0x2f9fda){if(_0x2f9fda){return _0x2f9fda[_0xbb75('0x22')]()[_0xbb75('0x23')](function(){_0x4c9529['status'](0xcc)[_0xbb75('0x17')]();});}};}function handleEntityNotFound(_0x48c795,_0x3d3946){return function(_0x252926){if(!_0x252926){_0x48c795[_0xbb75('0x16')](0x194);}return _0x252926;};}function handleError(_0x219651,_0x1007e9){_0x1007e9=_0x1007e9||0x1f4;return function(_0x2142de){logger[_0xbb75('0x24')](_0x2142de['stack']);if(_0x2142de[_0xbb75('0x25')]){delete _0x2142de[_0xbb75('0x25')];}_0x219651[_0xbb75('0x18')](_0x1007e9)[_0xbb75('0x26')](_0x2142de);};}exports[_0xbb75('0x27')]=function(_0x1d98d7,_0x3b30bf){var _0x26c536={},_0x3f3b64={},_0xc495f1={'count':0x0,'rows':[]};var _0x1e2963=_[_0xbb75('0x28')](db['VoiceDialReport'][_0xbb75('0x29')],function(_0x452f3c){return{'name':_0x452f3c[_0xbb75('0x2a')],'type':_0x452f3c['type'][_0xbb75('0x2b')]};});_0x3f3b64[_0xbb75('0x2c')]=_[_0xbb75('0x28')](_0x1e2963,_0xbb75('0x25'));_0x3f3b64[_0xbb75('0x2d')]=_[_0xbb75('0x2e')](_0x1d98d7[_0xbb75('0x2d')]);_0x3f3b64[_0xbb75('0x2f')]=_[_0xbb75('0x30')](_0x3f3b64[_0xbb75('0x2c')],_0x3f3b64[_0xbb75('0x2d')]);_0x26c536['attributes']=_['intersection'](_0x3f3b64[_0xbb75('0x2c')],qs['fields'](_0x1d98d7[_0xbb75('0x2d')][_0xbb75('0x31')]));_0x26c536[_0xbb75('0x32')]=_0x26c536[_0xbb75('0x32')][_0xbb75('0x33')]?_0x26c536['attributes']:_0x3f3b64['model'];if(!_0x1d98d7[_0xbb75('0x2d')][_0xbb75('0x34')]('nolimit')){_0x26c536['limit']=qs[_0xbb75('0x1c')](_0x1d98d7[_0xbb75('0x2d')]['limit']);_0x26c536[_0xbb75('0x1a')]=qs[_0xbb75('0x1a')](_0x1d98d7[_0xbb75('0x2d')][_0xbb75('0x1a')]);}_0x26c536['order']=qs[_0xbb75('0x35')](_0x1d98d7[_0xbb75('0x2d')][_0xbb75('0x35')]);_0x26c536[_0xbb75('0x36')]=qs[_0xbb75('0x2f')](_[_0xbb75('0x37')](_0x1d98d7[_0xbb75('0x2d')],_0x3f3b64[_0xbb75('0x2f')]),_0x1e2963);if(_0x1d98d7[_0xbb75('0x2d')][_0xbb75('0x38')]){_0x26c536[_0xbb75('0x36')]=_[_0xbb75('0x39')](_0x26c536[_0xbb75('0x36')],{'$or':_['map'](_0x1e2963,function(_0x371515){if(_0x371515['type']!==_0xbb75('0x3a')){var _0x5d7dd0={};_0x5d7dd0[_0x371515[_0xbb75('0x25')]]={'$like':'%'+_0x1d98d7[_0xbb75('0x2d')][_0xbb75('0x38')]+'%'};return _0x5d7dd0;}})});}_0x26c536=_['merge']({},_0x26c536,_0x1d98d7['options']);var _0x67409d={'where':_0x26c536['where']};return db[_0xbb75('0x3b')][_0xbb75('0x1d')](_0x67409d)[_0xbb75('0x23')](function(_0x211253){_0xc495f1[_0xbb75('0x1d')]=_0x211253;if(_0x1d98d7[_0xbb75('0x2d')][_0xbb75('0x3c')]){_0x26c536['include']=[{'all':!![]}];}return db[_0xbb75('0x3b')][_0xbb75('0x3d')](_0x26c536);})[_0xbb75('0x23')](function(_0x55abdb){_0xc495f1[_0xbb75('0x3e')]=_0x55abdb;return _0xc495f1;})[_0xbb75('0x23')](respondWithFilteredResult(_0x3b30bf,_0x26c536))[_0xbb75('0x3f')](handleError(_0x3b30bf,null));};exports[_0xbb75('0x40')]=function(_0x6aca6e,_0x10f9f5){var _0x2203af={'raw':!![],'where':{'id':_0x6aca6e[_0xbb75('0x41')]['id']}},_0x1b576e={};_0x1b576e[_0xbb75('0x2c')]=_[_0xbb75('0x2e')](db[_0xbb75('0x3b')]['rawAttributes']);_0x1b576e[_0xbb75('0x2d')]=_['keys'](_0x6aca6e[_0xbb75('0x2d')]);_0x1b576e['filters']=_[_0xbb75('0x30')](_0x1b576e[_0xbb75('0x2c')],_0x1b576e['query']);_0x2203af['attributes']=_[_0xbb75('0x30')](_0x1b576e[_0xbb75('0x2c')],qs[_0xbb75('0x31')](_0x6aca6e['query'][_0xbb75('0x31')]));_0x2203af[_0xbb75('0x32')]=_0x2203af[_0xbb75('0x32')][_0xbb75('0x33')]?_0x2203af[_0xbb75('0x32')]:_0x1b576e['model'];if(_0x6aca6e[_0xbb75('0x2d')][_0xbb75('0x3c')]){_0x2203af[_0xbb75('0x42')]=[{'all':!![]}];}_0x2203af=_[_0xbb75('0x39')]({},_0x2203af,_0x6aca6e[_0xbb75('0x43')]);return db[_0xbb75('0x3b')][_0xbb75('0x44')](_0x2203af)[_0xbb75('0x23')](handleEntityNotFound(_0x10f9f5,null))['then'](respondWithResult(_0x10f9f5,null))[_0xbb75('0x3f')](handleError(_0x10f9f5,null));};exports[_0xbb75('0x45')]=function(_0x285e8a,_0x3adfc9){return db[_0xbb75('0x3b')][_0xbb75('0x45')](_0x285e8a[_0xbb75('0x46')],{})['then'](respondWithResult(_0x3adfc9,0xc9))[_0xbb75('0x3f')](handleError(_0x3adfc9,null));};exports[_0xbb75('0x21')]=function(_0x54b6e6,_0x34204d){if(_0x54b6e6[_0xbb75('0x46')]['id']){delete _0x54b6e6[_0xbb75('0x46')]['id'];}return db[_0xbb75('0x3b')]['find']({'where':{'id':_0x54b6e6[_0xbb75('0x41')]['id']}})[_0xbb75('0x23')](handleEntityNotFound(_0x34204d,null))[_0xbb75('0x23')](saveUpdates(_0x54b6e6['body'],null))[_0xbb75('0x23')](respondWithResult(_0x34204d,null))[_0xbb75('0x3f')](handleError(_0x34204d,null));};exports[_0xbb75('0x22')]=function(_0x554cc8,_0x5a0f1f){return db['VoiceDialReport']['find']({'where':{'id':_0x554cc8[_0xbb75('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a0f1f,null))[_0xbb75('0x23')](removeEntity(_0x5a0f1f,null))['catch'](handleError(_0x5a0f1f,null));};exports[_0xbb75('0x47')]=function(_0xb36e49,_0x3808a3){return db['VoiceDialReport'][_0xbb75('0x47')]()[_0xbb75('0x23')](respondWithResult(_0x3808a3,null))[_0xbb75('0x3f')](handleError(_0x3808a3,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c44cb35..554661d 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 _0x2954=['api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','util','../../config/logger'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x2954,0x1de));var _0x4295=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x2954[_0x487ab4];return _0x3bef77;};'use strict';var _=require('lodash');var util=require(_0x4295('0x0'));var logger=require(_0x4295('0x1'))(_0x4295('0x2'));var moment=require(_0x4295('0x3'));var BPromise=require(_0x4295('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4295('0x5'));var config=require(_0x4295('0x6'));var attributes=require(_0x4295('0x7'));module[_0x4295('0x8')]=function(_0x5543e4,_0x3a4390){return _0x5543e4[_0x4295('0x9')](_0x4295('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x4295('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49e5=['exports','define','VoiceDialReport','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x2d53d7,_0x2c16cb){var _0x43bde9=function(_0x2f88a1){while(--_0x2f88a1){_0x2d53d7['push'](_0x2d53d7['shift']());}};_0x43bde9(++_0x2c16cb);}(_0x49e5,0x196));var _0x549e=function(_0x34c4e9,_0x2b4d90){_0x34c4e9=_0x34c4e9-0x0;var _0x144dd4=_0x49e5[_0x34c4e9];return _0x144dd4;};'use strict';var _=require(_0x549e('0x0'));var util=require(_0x549e('0x1'));var logger=require(_0x549e('0x2'))(_0x549e('0x3'));var moment=require(_0x549e('0x4'));var BPromise=require(_0x549e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x549e('0x6'));var rimraf=require(_0x549e('0x7'));var config=require(_0x549e('0x8'));var attributes=require(_0x549e('0x9'));module[_0x549e('0xa')]=function(_0x480e2c,_0x1b110f){return _0x480e2c[_0x549e('0xb')](_0x549e('0xc'),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 3b9a2a2..16ee32e 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 _0x320f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','create','body','options','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','raw','where','attributes','limit','util','randomstring'];(function(_0xd6a568,_0x4d39e9){var _0x56e5ab=function(_0x205d9e){while(--_0x205d9e){_0xd6a568['push'](_0xd6a568['shift']());}};_0x56e5ab(++_0x4d39e9);}(_0x320f,0x115));var _0xf320=function(_0x47c516,_0x36e014){_0x47c516=_0x47c516-0x0;var _0xbc8721=_0x320f[_0x47c516];return _0xbc8721;};'use strict';var _=require('lodash');var util=require(_0xf320('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf320('0x1'));var fs=require('fs');var Redis=require(_0xf320('0x2'));var db=require(_0xf320('0x3'))['db'];var utils=require(_0xf320('0x4'));var logger=require(_0xf320('0x5'))(_0xf320('0x6'));var config=require('../../config/environment');var jayson=require(_0xf320('0x7'));var client=jayson['client'][_0xf320('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d1c0b,_0x3a98ea,_0x4f6946){return new BPromise(function(_0x24f06f,_0x39ae4b){return client[_0xf320('0x9')](_0x2d1c0b,_0x4f6946)[_0xf320('0xa')](function(_0x563343){logger[_0xf320('0xb')](_0xf320('0xc'),_0x3a98ea,_0xf320('0xd'));logger[_0xf320('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3a98ea,_0xf320('0xd'),JSON[_0xf320('0xf')](_0x563343));if(_0x563343['error']){if(_0x563343[_0xf320('0x10')]['code']===0x1f4){logger[_0xf320('0x10')](_0xf320('0xc'),_0x3a98ea,_0x563343['error'][_0xf320('0x11')]);return _0x39ae4b(_0x563343[_0xf320('0x10')]['message']);}logger[_0xf320('0x10')](_0xf320('0xc'),_0x3a98ea,_0x563343[_0xf320('0x10')][_0xf320('0x11')]);return _0x24f06f(_0x563343[_0xf320('0x10')][_0xf320('0x11')]);}else{logger[_0xf320('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x3a98ea,_0xf320('0xd'));_0x24f06f(_0x563343[_0xf320('0x12')]['message']);}})[_0xf320('0x13')](function(_0x19718d){logger[_0xf320('0x10')](_0xf320('0xc'),_0x3a98ea,_0x19718d);_0x39ae4b(_0x19718d);});});}exports['CreateVoiceDialReport']=function(_0x20b303){var _0x34ad6b=this;return new Promise(function(_0x24c9e7,_0x4a9081){return db['VoiceDialReport'][_0xf320('0x14')](_0x20b303[_0xf320('0x15')],{'raw':_0x20b303[_0xf320('0x16')]?_0x20b303[_0xf320('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xf320('0xa')](function(_0xd7adc4){logger[_0xf320('0xb')](_0xf320('0x17'),_0x20b303);logger['debug']('CreateVoiceDialReport',_0x20b303,JSON[_0xf320('0xf')](_0xd7adc4));_0x24c9e7(_0xd7adc4);})[_0xf320('0x13')](function(_0x484468){logger[_0xf320('0x10')](_0xf320('0x17'),_0x484468['message'],_0x20b303);_0x4a9081(_0x34ad6b[_0xf320('0x10')](0x1f4,_0x484468[_0xf320('0x11')]));});});};exports[_0xf320('0x18')]=function(_0x341391){var _0x32e9d8=this;return new Promise(function(_0xa47e72,_0x36c23a){return db[_0xf320('0x19')][_0xf320('0x1a')](_0x341391['body'],{'raw':_0x341391['options']?_0x341391['options'][_0xf320('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x341391['options']?_0x341391['options'][_0xf320('0x1c')]||null:null,'attributes':_0x341391['options']?_0x341391['options'][_0xf320('0x1d')]||null:null,'limit':_0x341391[_0xf320('0x16')]?_0x341391['options'][_0xf320('0x1e')]||null:null})['then'](function(_0x27bf09){logger[_0xf320('0xb')](_0xf320('0x18'),_0x341391);logger[_0xf320('0xe')](_0xf320('0x18'),_0x341391,JSON['stringify'](_0x27bf09));_0xa47e72(_0x27bf09);})['catch'](function(_0x284e28){logger[_0xf320('0x10')](_0xf320('0x18'),_0x284e28[_0xf320('0x11')],_0x341391);_0x36c23a(_0x32e9d8[_0xf320('0x10')](0x1f4,_0x284e28['message']));});});}; \ No newline at end of file +var _0xf213=['VoiceDialReport','update','body','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','CreateVoiceDialReport','create','options','raw','debug','UpdateVoiceDialReport'];(function(_0x3720d1,_0x968d8b){var _0x14a1e8=function(_0x454184){while(--_0x454184){_0x3720d1['push'](_0x3720d1['shift']());}};_0x14a1e8(++_0x968d8b);}(_0xf213,0xcc));var _0x3f21=function(_0x4434db,_0x63bdfa){_0x4434db=_0x4434db-0x0;var _0x39df64=_0xf213[_0x4434db];return _0x39df64;};'use strict';var _=require(_0x3f21('0x0'));var util=require(_0x3f21('0x1'));var moment=require('moment');var BPromise=require(_0x3f21('0x2'));var rs=require(_0x3f21('0x3'));var fs=require('fs');var Redis=require(_0x3f21('0x4'));var db=require(_0x3f21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f21('0x6'))(_0x3f21('0x7'));var config=require('../../config/environment');var jayson=require(_0x3f21('0x8'));var client=jayson['client'][_0x3f21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x323694,_0x352abe,_0x2b2ad7){return new BPromise(function(_0x24e0f4,_0x14f3d9){return client[_0x3f21('0xa')](_0x323694,_0x2b2ad7)[_0x3f21('0xb')](function(_0x40a839){logger['info'](_0x3f21('0xc'),_0x352abe,'request\x20sent');logger['debug'](_0x3f21('0xd'),_0x352abe,'request\x20sent',JSON[_0x3f21('0xe')](_0x40a839));if(_0x40a839['error']){if(_0x40a839[_0x3f21('0xf')]['code']===0x1f4){logger[_0x3f21('0xf')](_0x3f21('0xc'),_0x352abe,_0x40a839['error'][_0x3f21('0x10')]);return _0x14f3d9(_0x40a839[_0x3f21('0xf')][_0x3f21('0x10')]);}logger['error'](_0x3f21('0xc'),_0x352abe,_0x40a839[_0x3f21('0xf')][_0x3f21('0x10')]);return _0x24e0f4(_0x40a839[_0x3f21('0xf')]['message']);}else{logger[_0x3f21('0x11')](_0x3f21('0xc'),_0x352abe,_0x3f21('0x12'));_0x24e0f4(_0x40a839[_0x3f21('0x13')]['message']);}})[_0x3f21('0x14')](function(_0x547f58){logger['error'](_0x3f21('0xc'),_0x352abe,_0x547f58);_0x14f3d9(_0x547f58);});});}exports[_0x3f21('0x15')]=function(_0x5de2a8){var _0x241d48=this;return new Promise(function(_0x5e3c0c,_0x2ae0c0){return db['VoiceDialReport'][_0x3f21('0x16')](_0x5de2a8['body'],{'raw':_0x5de2a8[_0x3f21('0x17')]?_0x5de2a8[_0x3f21('0x17')][_0x3f21('0x18')]===undefined?!![]:![]:!![]})[_0x3f21('0xb')](function(_0x326f6a){logger[_0x3f21('0x11')](_0x3f21('0x15'),_0x5de2a8);logger[_0x3f21('0x19')](_0x3f21('0x15'),_0x5de2a8,JSON['stringify'](_0x326f6a));_0x5e3c0c(_0x326f6a);})[_0x3f21('0x14')](function(_0x35137e){logger[_0x3f21('0xf')](_0x3f21('0x15'),_0x35137e[_0x3f21('0x10')],_0x5de2a8);_0x2ae0c0(_0x241d48[_0x3f21('0xf')](0x1f4,_0x35137e[_0x3f21('0x10')]));});});};exports[_0x3f21('0x1a')]=function(_0xe08d3c){var _0x3e9b9c=this;return new Promise(function(_0x316439,_0x33ed3b){return db[_0x3f21('0x1b')][_0x3f21('0x1c')](_0xe08d3c[_0x3f21('0x1d')],{'raw':_0xe08d3c[_0x3f21('0x17')]?_0xe08d3c[_0x3f21('0x17')][_0x3f21('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe08d3c['options']?_0xe08d3c[_0x3f21('0x17')][_0x3f21('0x1e')]||null:null,'attributes':_0xe08d3c[_0x3f21('0x17')]?_0xe08d3c[_0x3f21('0x17')][_0x3f21('0x1f')]||null:null,'limit':_0xe08d3c[_0x3f21('0x17')]?_0xe08d3c[_0x3f21('0x17')][_0x3f21('0x20')]||null:null})['then'](function(_0x56ac1f){logger[_0x3f21('0x11')](_0x3f21('0x1a'),_0xe08d3c);logger[_0x3f21('0x19')](_0x3f21('0x1a'),_0xe08d3c,JSON['stringify'](_0x56ac1f));_0x316439(_0x56ac1f);})[_0x3f21('0x14')](function(_0x25d9fd){logger[_0x3f21('0xf')](_0x3f21('0x1a'),_0x25d9fd[_0x3f21('0x10')],_0xe08d3c);_0x33ed3b(_0x3e9b9c[_0x3f21('0xf')](0x1f4,_0x25d9fd[_0x3f21('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1115b38..11792a5 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 _0xb953=['./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','put','update','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x16e690,_0x5d4683){var _0x3beb56=function(_0x547cf5){while(--_0x547cf5){_0x16e690['push'](_0x16e690['shift']());}};_0x3beb56(++_0x5d4683);}(_0xb953,0xdc));var _0x3b95=function(_0xa4fd3f,_0x5a8318){_0xa4fd3f=_0xa4fd3f-0x0;var _0x47752d=_0xb953[_0xa4fd3f];return _0x47752d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3b95('0x0'));var express=require('express');var router=express[_0x3b95('0x1')]();var fs_extra=require(_0x3b95('0x2'));var auth=require(_0x3b95('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3b95('0x4'));var controller=require(_0x3b95('0x5'));router[_0x3b95('0x6')]('/',auth[_0x3b95('0x7')](),controller[_0x3b95('0x8')]);router['get'](_0x3b95('0x9'),auth[_0x3b95('0x7')](),controller[_0x3b95('0xa')]);router[_0x3b95('0xb')]('/',auth[_0x3b95('0x7')](),controller['create']);router['post'](_0x3b95('0xc'),auth['isAuthenticated'](),controller['addApplications']);router[_0x3b95('0xd')](_0x3b95('0x9'),auth['isAuthenticated'](),controller[_0x3b95('0xe')]);router['delete']('/:id',auth[_0x3b95('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6d2d=['./voiceExtension.controller','isAuthenticated','index','get','show','post','/:id/applications','addApplications','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c7eb0,_0x1640a4){var _0x273293=function(_0x27cc6d){while(--_0x27cc6d){_0x2c7eb0['push'](_0x2c7eb0['shift']());}};_0x273293(++_0x1640a4);}(_0x6d2d,0xf3));var _0xd6d2=function(_0x4b70d6,_0x142320){_0x4b70d6=_0x4b70d6-0x0;var _0x58a837=_0x6d2d[_0x4b70d6];return _0x58a837;};'use strict';var multer=require(_0xd6d2('0x0'));var util=require(_0xd6d2('0x1'));var path=require(_0xd6d2('0x2'));var timeout=require(_0xd6d2('0x3'));var express=require(_0xd6d2('0x4'));var router=express[_0xd6d2('0x5')]();var fs_extra=require(_0xd6d2('0x6'));var auth=require(_0xd6d2('0x7'));var interaction=require(_0xd6d2('0x8'));var config=require(_0xd6d2('0x9'));var controller=require(_0xd6d2('0xa'));router['get']('/',auth[_0xd6d2('0xb')](),controller[_0xd6d2('0xc')]);router[_0xd6d2('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd6d2('0xe')]);router[_0xd6d2('0xf')]('/',auth[_0xd6d2('0xb')](),controller['create']);router['post'](_0xd6d2('0x10'),auth['isAuthenticated'](),controller[_0xd6d2('0x11')]);router[_0xd6d2('0x12')](_0xd6d2('0x13'),auth[_0xd6d2('0xb')](),controller[_0xd6d2('0x14')]);router['delete']('/:id',auth[_0xd6d2('0xb')](),controller[_0xd6d2('0x15')]);module[_0xd6d2('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4f81761..7c2393c 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 _0xac65=['outbound','internal','outbound-fax','system','INTEGER','BOOLEAN','VIRTUAL','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x4cf97e,_0xd9a96c){var _0x46d0cc=function(_0xa4fdd9){while(--_0xa4fdd9){_0x4cf97e['push'](_0x4cf97e['shift']());}};_0x46d0cc(++_0xd9a96c);}(_0xac65,0x14c));var _0x5ac6=function(_0x498b2d,_0x14cd2f){_0x498b2d=_0x498b2d-0x0;var _0x4bee84=_0xac65[_0x498b2d];return _0x4bee84;};'use strict';var Sequelize=require('sequelize');module[_0x5ac6('0x0')]={'context':{'type':Sequelize[_0x5ac6('0x1')],'allowNull':![],'unique':_0x5ac6('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5ac6('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x5ac6('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x5ac6('0x2')},'tag':{'type':Sequelize[_0x5ac6('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5ac6('0x1')],'allowNull':![],'defaultValue':_0x5ac6('0x3')},'appdata':{'type':Sequelize[_0x5ac6('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5ac6('0x4')](_0x5ac6('0x5'),_0x5ac6('0x6'),_0x5ac6('0x7'),'inbound-fax',_0x5ac6('0x8'),_0x5ac6('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x5ac6('0x1')]},'interval':{'type':Sequelize[_0x5ac6('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x5ac6('0xa')]},'isApp':{'type':Sequelize[_0x5ac6('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x5ac6('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x5ac6('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x5ac6('0xc')],'get':function(_0xc5d9d6){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x5ac6('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xe800=['internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0xe800,0xea));var _0x0e80=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xe800[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0x0e80('0x0'));module[_0x0e80('0x1')]={'context':{'type':Sequelize[_0x0e80('0x2')],'allowNull':![],'unique':_0x0e80('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0e80('0x2')],'allowNull':![],'unique':_0x0e80('0x3')},'priority':{'type':Sequelize[_0x0e80('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0e80('0x2')],'allowNull':![],'defaultValue':_0x0e80('0x4')},'appdata':{'type':Sequelize[_0x0e80('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0e80('0x5')]('inbound','outbound',_0x0e80('0x6'),_0x0e80('0x7'),_0x0e80('0x8'),'system',_0x0e80('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0e80('0x2')]},'interval':{'type':Sequelize[_0x0e80('0x2')],'allowNull':![],'defaultValue':_0x0e80('0xa')},'IntervalId':{'type':Sequelize[_0x0e80('0xb')]},'isApp':{'type':Sequelize[_0x0e80('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0e80('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0e80('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0e80('0xb')]},'recordingFormat':{'type':Sequelize[_0x0e80('0x2')],'defaultValue':_0x0e80('0xd')},'answer':{'type':Sequelize[_0x0e80('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0e80('0xe')],'get':function(_0x3733f7){return this[_0x0e80('0xf')]('exten');}},'alias':{'type':Sequelize[_0x0e80('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0cc7d73..bb10e8d 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 _0x8bf6=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','finally','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','./voiceExtension.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','destroy','then','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','type','find','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','map','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction'];(function(_0x175bcb,_0x1f6541){var _0x35e44f=function(_0x33d71e){while(--_0x33d71e){_0x175bcb['push'](_0x175bcb['shift']());}};_0x35e44f(++_0x1f6541);}(_0x8bf6,0xba));var _0x68bf=function(_0x475dd,_0x450b68){_0x475dd=_0x475dd-0x0;var _0x4e9d32=_0x8bf6[_0x475dd];return _0x4e9d32;};'use strict';var _=require(_0x68bf('0x0'));var Redis=require(_0x68bf('0x1'));var qs=require(_0x68bf('0x2'));var logger=require('../../config/logger')(_0x68bf('0x3'));var config=require(_0x68bf('0x4'));var db=require(_0x68bf('0x5'))['db'];config[_0x68bf('0x6')]=_['defaults'](config[_0x68bf('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x68bf('0x7'))[_0x68bf('0x8')](socket);function respondWithStatusCode(_0x11d88d,_0x332620){_0x332620=_0x332620||0xcc;return function(_0x5094c7){if(_0x5094c7){return _0x11d88d[_0x68bf('0x9')](_0x332620);}return _0x11d88d[_0x68bf('0xa')](_0x332620)[_0x68bf('0xb')]();};}function respondWithResult(_0x3de651,_0x34a289){_0x34a289=_0x34a289||0xc8;return function(_0x790c3){if(_0x790c3){return _0x3de651[_0x68bf('0xa')](_0x34a289)[_0x68bf('0xc')](_0x790c3);}};}function respondWithFilteredResult(_0x2ae11f,_0x26949e){return function(_0x1c27a8){if(_0x1c27a8){var _0x42c047=typeof _0x26949e['offset']==='undefined'&&typeof _0x26949e[_0x68bf('0xd')]===_0x68bf('0xe');var _0x101e8f=_0x1c27a8['count'];var _0x4dd9f0=_0x42c047?0x0:_0x26949e[_0x68bf('0xf')];var _0x3d68f7=_0x42c047?_0x1c27a8[_0x68bf('0x10')]:_0x26949e[_0x68bf('0xf')]+_0x26949e[_0x68bf('0xd')];var _0x2afed9;if(_0x3d68f7>=_0x101e8f){_0x3d68f7=_0x101e8f;_0x2afed9=0xc8;}else{_0x2afed9=0xce;}_0x2ae11f[_0x68bf('0xa')](_0x2afed9);return _0x2ae11f['set'](_0x68bf('0x11'),_0x4dd9f0+'-'+_0x3d68f7+'/'+_0x101e8f)[_0x68bf('0xc')](_0x1c27a8);}return null;};}function removeEntity(_0x4cf392){return function(_0x1ed4fc){if(_0x1ed4fc){return _0x1ed4fc[_0x68bf('0x12')]()[_0x68bf('0x13')](function(){var _0xaad60a=_0x1ed4fc['get']({'plain':!![]});var _0xa170d0=[{'name':_0x68bf('0x14'),'value':'inbound','ignore':![]},{'name':_0x68bf('0x15'),'value':_0x68bf('0x16'),'ignore':![]},{'name':_0x68bf('0x17'),'value':_0x68bf('0x18'),'ignore':![]}];var _0x4a44db=_(_0xa170d0)[_0x68bf('0x19')](_0x68bf('0x1a'))['map']('value')[_0x68bf('0x1b')]();if(_['includes'](_0x4a44db,_0xaad60a[_0x68bf('0x1c')])){return;}var _0x1b4fa5=_[_0x68bf('0x1d')](_0xa170d0,['value',_0xaad60a['type']])[_0x68bf('0x1e')];return db[_0x68bf('0x1f')][_0x68bf('0x12')]({'where':{'type':_0x1b4fa5,'resourceId':_0xaad60a['id']}})[_0x68bf('0x13')](function(){return _0x1ed4fc;});})[_0x68bf('0x13')](function(){_0x4cf392[_0x68bf('0xa')](0xcc)[_0x68bf('0xb')]();});}};}function handleEntityNotFound(_0x2beb8a){return function(_0x173d39){if(!_0x173d39){_0x2beb8a[_0x68bf('0x9')](0x194);}return _0x173d39;};}function handleError(_0x553ae4,_0x4a101d){_0x4a101d=_0x4a101d||0x1f4;return function(_0xfb5333){logger['error'](_0xfb5333[_0x68bf('0x20')]);if(_0xfb5333[_0x68bf('0x1e')]){delete _0xfb5333['name'];}_0x553ae4[_0x68bf('0xa')](_0x4a101d)[_0x68bf('0x21')](_0xfb5333);};}exports[_0x68bf('0x22')]=function(_0xde8234,_0x12033d){var _0x1016d8={},_0x552a1a={},_0x4d594a={'count':0x0,'rows':[]};var _0x2ea774=_['map'](db[_0x68bf('0x23')][_0x68bf('0x24')],function(_0x1cf0df){return{'name':_0x1cf0df['fieldName'],'type':_0x1cf0df[_0x68bf('0x1c')]['key']};});_0x552a1a['model']=_['map'](_0x2ea774,'name');_0x552a1a['query']=_['keys'](_0xde8234[_0x68bf('0x25')]);_0x552a1a[_0x68bf('0x26')]=_['intersection'](_0x552a1a[_0x68bf('0x27')],_0x552a1a[_0x68bf('0x25')]);_0x1016d8[_0x68bf('0x28')]=_[_0x68bf('0x29')](_0x552a1a[_0x68bf('0x27')],qs[_0x68bf('0x2a')](_0xde8234['query'][_0x68bf('0x2a')]));_0x1016d8[_0x68bf('0x28')]=_0x1016d8['attributes'][_0x68bf('0x2b')]?_0x1016d8[_0x68bf('0x28')]:_0x552a1a[_0x68bf('0x27')];if(!_0xde8234['query'][_0x68bf('0x2c')](_0x68bf('0x2d'))){_0x1016d8[_0x68bf('0xd')]=qs['limit'](_0xde8234[_0x68bf('0x25')][_0x68bf('0xd')]);_0x1016d8[_0x68bf('0xf')]=qs[_0x68bf('0xf')](_0xde8234[_0x68bf('0x25')][_0x68bf('0xf')]);}_0x1016d8['order']=qs['sort'](_0xde8234['query']['sort']);_0x1016d8[_0x68bf('0x2e')]=qs[_0x68bf('0x26')](_[_0x68bf('0x2f')](_0xde8234[_0x68bf('0x25')],_0x552a1a['filters']),_0x2ea774);if(_0xde8234['query'][_0x68bf('0x19')]){_0x1016d8['where']=_['merge'](_0x1016d8[_0x68bf('0x2e')],{'$or':_[_0x68bf('0x30')](_0x2ea774,function(_0x9a9df){if(_0x9a9df['type']!==_0x68bf('0x31')){var _0x4fb197={};_0x4fb197[_0x9a9df['name']]={'$like':'%'+_0xde8234[_0x68bf('0x25')]['filter']+'%'};return _0x4fb197;}})});}_0x1016d8=_[_0x68bf('0x32')]({},_0x1016d8,_0xde8234['options']);var _0x2f3715={'where':_0x1016d8[_0x68bf('0x2e')]};return db[_0x68bf('0x23')][_0x68bf('0x10')](_0x2f3715)['then'](function(_0x31e3ed){_0x4d594a[_0x68bf('0x10')]=_0x31e3ed;if(_0xde8234[_0x68bf('0x25')]['includeAll']){_0x1016d8[_0x68bf('0x33')]=[{'all':!![]}];}return db[_0x68bf('0x23')][_0x68bf('0x34')](_0x1016d8);})['then'](function(_0x35a1b8){_0x4d594a[_0x68bf('0x35')]=_0x35a1b8;return _0x4d594a;})[_0x68bf('0x13')](respondWithFilteredResult(_0x12033d,_0x1016d8))[_0x68bf('0x36')](handleError(_0x12033d,null));};exports[_0x68bf('0x37')]=function(_0x25b914,_0x23b5df){var _0x313401={'raw':![],'where':{'id':_0x25b914[_0x68bf('0x38')]['id']}},_0x42c0c1={};_0x42c0c1[_0x68bf('0x27')]=_[_0x68bf('0x39')](db[_0x68bf('0x23')]['rawAttributes']);_0x42c0c1[_0x68bf('0x25')]=_[_0x68bf('0x39')](_0x25b914[_0x68bf('0x25')]);_0x42c0c1[_0x68bf('0x26')]=_[_0x68bf('0x29')](_0x42c0c1['model'],_0x42c0c1['query']);_0x313401[_0x68bf('0x28')]=_[_0x68bf('0x29')](_0x42c0c1['model'],qs[_0x68bf('0x2a')](_0x25b914[_0x68bf('0x25')][_0x68bf('0x2a')]));_0x313401[_0x68bf('0x28')]=_0x313401[_0x68bf('0x28')][_0x68bf('0x2b')]?_0x313401[_0x68bf('0x28')]:_0x42c0c1[_0x68bf('0x27')];if(_0x25b914[_0x68bf('0x25')][_0x68bf('0x3a')]){_0x313401['include']=[{'all':!![]}];}_0x313401=_[_0x68bf('0x32')]({},_0x313401,_0x25b914[_0x68bf('0x3b')]);return db[_0x68bf('0x23')][_0x68bf('0x1d')](_0x313401)[_0x68bf('0x13')](handleEntityNotFound(_0x23b5df,null))[_0x68bf('0x13')](respondWithResult(_0x23b5df,null))[_0x68bf('0x36')](handleError(_0x23b5df,null));};exports[_0x68bf('0x12')]=function(_0xdb5b51,_0x462e1b){return db[_0x68bf('0x23')][_0x68bf('0x1d')]({'where':{'id':_0xdb5b51[_0x68bf('0x38')]['id']}})['then'](handleEntityNotFound(_0x462e1b,null))[_0x68bf('0x13')](removeEntity(_0x462e1b,null))['catch'](handleError(_0x462e1b,null));};exports[_0x68bf('0x3c')]=function(_0x102999,_0x524d0b){if(_0x102999['body'][_0x68bf('0x1c')]==='outbound'&&!_['startsWith'](_0x102999[_0x68bf('0x3d')][_0x68bf('0x3e')],'_')){_0x102999['body'][_0x68bf('0x3e')]='_'[_0x68bf('0x3f')](_0x102999['body'][_0x68bf('0x3e')]);}return db[_0x68bf('0x23')]['create'](_0x102999[_0x68bf('0x3d')],{'raw':![]})[_0x68bf('0x13')](function(_0x54aa3d){var _0x10f486=_0x102999[_0x68bf('0x40')][_0x68bf('0x41')]({'plain':!![]});if(!_0x10f486)throw new Error(_0x68bf('0x42'));if(_0x10f486[_0x68bf('0x43')]===_0x68bf('0x40')){var _0x580067=_0x54aa3d[_0x68bf('0x41')]({'plain':!![]});var _0x50b8bd=[{'name':_0x68bf('0x14'),'value':_0x68bf('0x44')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x68bf('0x17'),'value':_0x68bf('0x18')}];var _0x3e41f0=_[_0x68bf('0x1d')](_0x50b8bd,[_0x68bf('0x1b'),_0x580067[_0x68bf('0x1c')]])[_0x68bf('0x1e')];return db[_0x68bf('0x45')][_0x68bf('0x1d')]({'where':{'name':_0x3e41f0,'userProfileId':_0x10f486[_0x68bf('0x46')]},'raw':!![]})[_0x68bf('0x13')](function(_0x48e80c){if(_0x48e80c&&_0x48e80c[_0x68bf('0x47')]===0x0){return db['UserProfileResource'][_0x68bf('0x3c')]({'name':_0x580067[_0x68bf('0x1e')],'resourceId':_0x580067['id'],'type':_0x48e80c[_0x68bf('0x1e')],'sectionId':_0x48e80c['id']},{})[_0x68bf('0x13')](function(){return _0x54aa3d;});}else{return _0x54aa3d;}})[_0x68bf('0x36')](function(_0x3e672d){logger['error'](_0x68bf('0x48'),_0x3e672d);throw _0x3e672d;});}return _0x54aa3d;})['then'](respondWithResult(_0x524d0b,0xc9))[_0x68bf('0x36')](handleError(_0x524d0b,null));};exports[_0x68bf('0x49')]=function(_0x12b1a,_0x58d0cc){if(_0x12b1a[_0x68bf('0x3d')]['id']){delete _0x12b1a[_0x68bf('0x3d')]['id'];}return db[_0x68bf('0x23')][_0x68bf('0x1d')]({'where':{'id':_0x12b1a[_0x68bf('0x38')]['id']}})[_0x68bf('0x13')](handleEntityNotFound(_0x58d0cc,null))['then'](function(_0x184f66){if(_0x184f66){return db[_0x68bf('0x23')][_0x68bf('0x49')](_['pick'](_0x12b1a['body'],['exten',_0x68bf('0x4a'),'description',_0x68bf('0x4b'),_0x68bf('0x4c'),_0x68bf('0x4d'),'alias']),{'where':{'context':_0x184f66['context'],'exten':_0x184f66[_0x68bf('0x3e')]},'individualHooks':!![]})['then'](function(_0x59658d){return _0x59658d;});}return null;})[_0x68bf('0x13')](respondWithStatusCode(_0x58d0cc,null))['catch'](handleError(_0x58d0cc,null));};exports[_0x68bf('0x4e')]=function(_0x20a4ca,_0x1a2cbe){var _0x10f21c=_0x20a4ca[_0x68bf('0x38')]['id'];var _0x41feef=_0x20a4ca['body'];var _0x5f53c0=0xc8;var _0x1b3547=null;return db[_0x68bf('0x4f')][_0x68bf('0x50')]({'isolationLevel':db[_0x68bf('0x4f')][_0x68bf('0x51')][_0x68bf('0x52')][_0x68bf('0x53')]},function(_0x226841){return db[_0x68bf('0x23')]['findOne']({'where':{'id':_0x10f21c},'transaction':_0x226841})['then'](function(_0x5a802f){if(_0x5a802f){return db['VoiceExtension'][_0x68bf('0x12')]({'where':{'VoiceExtensionId':_0x10f21c},'transaction':_0x226841})[_0x68bf('0x13')](function(){var _0x4dfbb4=_[_0x68bf('0x30')](_0x41feef,function(_0x3eb868){_0x3eb868[_0x68bf('0x54')]=_0x10f21c;_0x3eb868['isApp']=!![];return _0x3eb868;});return _0x5a802f[_0x68bf('0x55')](_0x4dfbb4);})[_0x68bf('0x13')](function(_0x2600d4){return db[_0x68bf('0x23')][_0x68bf('0x56')](_0x2600d4,{'transaction':_0x226841});});}else{_0x5f53c0=0x194;_0x1b3547=[];}});})[_0x68bf('0x13')](function(){if(_0x5f53c0!==0x194){return db[_0x68bf('0x23')][_0x68bf('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x10f21c},'order':'cast(priority\x20as\x20unsigned)'})[_0x68bf('0x13')](function(_0x53df26){_0x1b3547=_0x53df26;});}})[_0x68bf('0x36')](function(_0x5f4eb9){_0x5f53c0=0x1f4;logger['error'](_0x5f4eb9[_0x68bf('0x20')]);if(_0x5f4eb9['name']){delete _0x5f4eb9['name'];}_0x1b3547=_0x5f4eb9;})[_0x68bf('0x58')](function(){if(_0x1b3547===null){_0x1a2cbe[_0x68bf('0x9')](_0x5f53c0);}else{if(_0x5f53c0===0x1f4){_0x1a2cbe[_0x68bf('0xa')](_0x5f53c0)['send'](_0x1b3547);}else{_0x1a2cbe[_0x68bf('0xa')](_0x5f53c0)[_0x68bf('0xc')](_0x1b3547);}}});}; \ No newline at end of file +var _0x5b5f=['fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','includeAll','findAll','rows','catch','rawAttributes','keys','options','params','create','outbound','startsWith','exten','body','concat','user','role','inbound','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','mandatoryDisposition','alias','addApplications','transaction','Transaction','ISOLATION_LEVELS','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','sendStatus','status','json','offset','undefined','count','set','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','internal','filter','value','includes','type','find','name','UserProfileResource','then','end','error','stack','send','VoiceExtension','fieldName','model','map','query','filters','attributes','intersection'];(function(_0x43df8b,_0x163b58){var _0x3268fd=function(_0x190e88){while(--_0x190e88){_0x43df8b['push'](_0x43df8b['shift']());}};_0x3268fd(++_0x163b58);}(_0x5b5f,0x1e0));var _0xf5b5=function(_0x30e977,_0x5edc12){_0x30e977=_0x30e977-0x0;var _0x536cb5=_0x5b5f[_0x30e977];return _0x536cb5;};'use strict';var _=require(_0xf5b5('0x0'));var Redis=require('ioredis');var qs=require(_0xf5b5('0x1'));var logger=require('../../config/logger')(_0xf5b5('0x2'));var config=require(_0xf5b5('0x3'));var db=require(_0xf5b5('0x4'))['db'];config[_0xf5b5('0x5')]=_[_0xf5b5('0x6')](config[_0xf5b5('0x5')],{'host':_0xf5b5('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5b5('0x5')]));require(_0xf5b5('0x8'))['register'](socket);function respondWithStatusCode(_0x169d43,_0x104428){_0x104428=_0x104428||0xcc;return function(_0x1d487e){if(_0x1d487e){return _0x169d43[_0xf5b5('0x9')](_0x104428);}return _0x169d43[_0xf5b5('0xa')](_0x104428)['end']();};}function respondWithResult(_0x51af88,_0x9e63cb){_0x9e63cb=_0x9e63cb||0xc8;return function(_0x279c2b){if(_0x279c2b){return _0x51af88[_0xf5b5('0xa')](_0x9e63cb)[_0xf5b5('0xb')](_0x279c2b);}};}function respondWithFilteredResult(_0x53085c,_0x6d4873){return function(_0x208876){if(_0x208876){var _0x2a290a=typeof _0x6d4873[_0xf5b5('0xc')]===_0xf5b5('0xd')&&typeof _0x6d4873['limit']==='undefined';var _0x4baef7=_0x208876[_0xf5b5('0xe')];var _0x13cc9d=_0x2a290a?0x0:_0x6d4873[_0xf5b5('0xc')];var _0x4fbb23=_0x2a290a?_0x208876[_0xf5b5('0xe')]:_0x6d4873[_0xf5b5('0xc')]+_0x6d4873['limit'];var _0x2ec527;if(_0x4fbb23>=_0x4baef7){_0x4fbb23=_0x4baef7;_0x2ec527=0xc8;}else{_0x2ec527=0xce;}_0x53085c[_0xf5b5('0xa')](_0x2ec527);return _0x53085c[_0xf5b5('0xf')](_0xf5b5('0x10'),_0x13cc9d+'-'+_0x4fbb23+'/'+_0x4baef7)[_0xf5b5('0xb')](_0x208876);}return null;};}function removeEntity(_0x1a31a4){return function(_0x361832){if(_0x361832){return _0x361832[_0xf5b5('0x11')]()['then'](function(){var _0x16033c=_0x361832[_0xf5b5('0x12')]({'plain':!![]});var _0x3f5b5f=[{'name':_0xf5b5('0x13'),'value':'inbound','ignore':![]},{'name':_0xf5b5('0x14'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0xf5b5('0x15'),'ignore':![]}];var _0x1ae5f0=_(_0x3f5b5f)[_0xf5b5('0x16')]('ignore')['map'](_0xf5b5('0x17'))[_0xf5b5('0x17')]();if(_[_0xf5b5('0x18')](_0x1ae5f0,_0x16033c[_0xf5b5('0x19')])){return;}var _0x35fd86=_[_0xf5b5('0x1a')](_0x3f5b5f,['value',_0x16033c[_0xf5b5('0x19')]])[_0xf5b5('0x1b')];return db[_0xf5b5('0x1c')][_0xf5b5('0x11')]({'where':{'type':_0x35fd86,'resourceId':_0x16033c['id']}})[_0xf5b5('0x1d')](function(){return _0x361832;});})[_0xf5b5('0x1d')](function(){_0x1a31a4['status'](0xcc)[_0xf5b5('0x1e')]();});}};}function handleEntityNotFound(_0x291555){return function(_0xd689ec){if(!_0xd689ec){_0x291555[_0xf5b5('0x9')](0x194);}return _0xd689ec;};}function handleError(_0x121dca,_0x55024e){_0x55024e=_0x55024e||0x1f4;return function(_0x1bed07){logger[_0xf5b5('0x1f')](_0x1bed07[_0xf5b5('0x20')]);if(_0x1bed07[_0xf5b5('0x1b')]){delete _0x1bed07[_0xf5b5('0x1b')];}_0x121dca[_0xf5b5('0xa')](_0x55024e)[_0xf5b5('0x21')](_0x1bed07);};}exports['index']=function(_0x1babe8,_0x8694ae){var _0x2198d1={},_0x5cf250={},_0x57a3db={'count':0x0,'rows':[]};var _0x38c7d4=_['map'](db[_0xf5b5('0x22')]['rawAttributes'],function(_0x418c0f){return{'name':_0x418c0f[_0xf5b5('0x23')],'type':_0x418c0f['type']['key']};});_0x5cf250[_0xf5b5('0x24')]=_[_0xf5b5('0x25')](_0x38c7d4,_0xf5b5('0x1b'));_0x5cf250[_0xf5b5('0x26')]=_['keys'](_0x1babe8[_0xf5b5('0x26')]);_0x5cf250[_0xf5b5('0x27')]=_['intersection'](_0x5cf250[_0xf5b5('0x24')],_0x5cf250[_0xf5b5('0x26')]);_0x2198d1[_0xf5b5('0x28')]=_[_0xf5b5('0x29')](_0x5cf250[_0xf5b5('0x24')],qs[_0xf5b5('0x2a')](_0x1babe8[_0xf5b5('0x26')][_0xf5b5('0x2a')]));_0x2198d1['attributes']=_0x2198d1[_0xf5b5('0x28')][_0xf5b5('0x2b')]?_0x2198d1[_0xf5b5('0x28')]:_0x5cf250['model'];if(!_0x1babe8[_0xf5b5('0x26')][_0xf5b5('0x2c')](_0xf5b5('0x2d'))){_0x2198d1['limit']=qs[_0xf5b5('0x2e')](_0x1babe8['query']['limit']);_0x2198d1[_0xf5b5('0xc')]=qs[_0xf5b5('0xc')](_0x1babe8[_0xf5b5('0x26')][_0xf5b5('0xc')]);}_0x2198d1['order']=qs[_0xf5b5('0x2f')](_0x1babe8[_0xf5b5('0x26')][_0xf5b5('0x2f')]);_0x2198d1[_0xf5b5('0x30')]=qs[_0xf5b5('0x27')](_['pick'](_0x1babe8[_0xf5b5('0x26')],_0x5cf250[_0xf5b5('0x27')]),_0x38c7d4);if(_0x1babe8[_0xf5b5('0x26')]['filter']){_0x2198d1[_0xf5b5('0x30')]=_[_0xf5b5('0x31')](_0x2198d1[_0xf5b5('0x30')],{'$or':_[_0xf5b5('0x25')](_0x38c7d4,function(_0xf87173){if(_0xf87173['type']!=='VIRTUAL'){var _0xc8ab56={};_0xc8ab56[_0xf87173[_0xf5b5('0x1b')]]={'$like':'%'+_0x1babe8[_0xf5b5('0x26')]['filter']+'%'};return _0xc8ab56;}})});}_0x2198d1=_[_0xf5b5('0x31')]({},_0x2198d1,_0x1babe8['options']);var _0x5d88f={'where':_0x2198d1[_0xf5b5('0x30')]};return db[_0xf5b5('0x22')][_0xf5b5('0xe')](_0x5d88f)['then'](function(_0xa4e17f){_0x57a3db['count']=_0xa4e17f;if(_0x1babe8['query'][_0xf5b5('0x32')]){_0x2198d1['include']=[{'all':!![]}];}return db[_0xf5b5('0x22')][_0xf5b5('0x33')](_0x2198d1);})[_0xf5b5('0x1d')](function(_0x3eb218){_0x57a3db[_0xf5b5('0x34')]=_0x3eb218;return _0x57a3db;})['then'](respondWithFilteredResult(_0x8694ae,_0x2198d1))[_0xf5b5('0x35')](handleError(_0x8694ae,null));};exports['show']=function(_0x1ec626,_0x1ecc50){var _0x2a4caf={'raw':![],'where':{'id':_0x1ec626['params']['id']}},_0x597e47={};_0x597e47['model']=_['keys'](db[_0xf5b5('0x22')][_0xf5b5('0x36')]);_0x597e47[_0xf5b5('0x26')]=_[_0xf5b5('0x37')](_0x1ec626[_0xf5b5('0x26')]);_0x597e47[_0xf5b5('0x27')]=_['intersection'](_0x597e47[_0xf5b5('0x24')],_0x597e47[_0xf5b5('0x26')]);_0x2a4caf[_0xf5b5('0x28')]=_[_0xf5b5('0x29')](_0x597e47['model'],qs[_0xf5b5('0x2a')](_0x1ec626[_0xf5b5('0x26')][_0xf5b5('0x2a')]));_0x2a4caf['attributes']=_0x2a4caf[_0xf5b5('0x28')][_0xf5b5('0x2b')]?_0x2a4caf[_0xf5b5('0x28')]:_0x597e47['model'];if(_0x1ec626[_0xf5b5('0x26')][_0xf5b5('0x32')]){_0x2a4caf['include']=[{'all':!![]}];}_0x2a4caf=_[_0xf5b5('0x31')]({},_0x2a4caf,_0x1ec626[_0xf5b5('0x38')]);return db[_0xf5b5('0x22')][_0xf5b5('0x1a')](_0x2a4caf)[_0xf5b5('0x1d')](handleEntityNotFound(_0x1ecc50,null))[_0xf5b5('0x1d')](respondWithResult(_0x1ecc50,null))['catch'](handleError(_0x1ecc50,null));};exports[_0xf5b5('0x11')]=function(_0x381c2a,_0x2e8f55){return db[_0xf5b5('0x22')]['find']({'where':{'id':_0x381c2a[_0xf5b5('0x39')]['id']}})[_0xf5b5('0x1d')](handleEntityNotFound(_0x2e8f55,null))[_0xf5b5('0x1d')](removeEntity(_0x2e8f55,null))[_0xf5b5('0x35')](handleError(_0x2e8f55,null));};exports[_0xf5b5('0x3a')]=function(_0x3cdcaf,_0x13d02a){if(_0x3cdcaf['body'][_0xf5b5('0x19')]===_0xf5b5('0x3b')&&!_[_0xf5b5('0x3c')](_0x3cdcaf['body'][_0xf5b5('0x3d')],'_')){_0x3cdcaf[_0xf5b5('0x3e')][_0xf5b5('0x3d')]='_'[_0xf5b5('0x3f')](_0x3cdcaf['body'][_0xf5b5('0x3d')]);}return db[_0xf5b5('0x22')][_0xf5b5('0x3a')](_0x3cdcaf['body'],{'raw':![]})['then'](function(_0x117fd0){var _0x562258=_0x3cdcaf[_0xf5b5('0x40')][_0xf5b5('0x12')]({'plain':!![]});if(!_0x562258)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x562258[_0xf5b5('0x41')]===_0xf5b5('0x40')){var _0x359464=_0x117fd0[_0xf5b5('0x12')]({'plain':!![]});var _0x33f816=[{'name':_0xf5b5('0x13'),'value':_0xf5b5('0x42')},{'name':_0xf5b5('0x14'),'value':_0xf5b5('0x3b')},{'name':_0xf5b5('0x43'),'value':_0xf5b5('0x15')}];var _0x528651=_[_0xf5b5('0x1a')](_0x33f816,[_0xf5b5('0x17'),_0x359464[_0xf5b5('0x19')]])['name'];return db[_0xf5b5('0x44')][_0xf5b5('0x1a')]({'where':{'name':_0x528651,'userProfileId':_0x562258[_0xf5b5('0x45')]},'raw':!![]})[_0xf5b5('0x1d')](function(_0x25f4bd){if(_0x25f4bd&&_0x25f4bd[_0xf5b5('0x46')]===0x0){return db['UserProfileResource']['create']({'name':_0x359464[_0xf5b5('0x1b')],'resourceId':_0x359464['id'],'type':_0x25f4bd['name'],'sectionId':_0x25f4bd['id']},{})[_0xf5b5('0x1d')](function(){return _0x117fd0;});}else{return _0x117fd0;}})['catch'](function(_0x55b10d){logger['error'](_0xf5b5('0x47'),_0x55b10d);throw _0x55b10d;});}return _0x117fd0;})[_0xf5b5('0x1d')](respondWithResult(_0x13d02a,0xc9))['catch'](handleError(_0x13d02a,null));};exports['update']=function(_0x29143e,_0x7bd5d6){if(_0x29143e[_0xf5b5('0x3e')]['id']){delete _0x29143e['body']['id'];}return db[_0xf5b5('0x22')]['find']({'where':{'id':_0x29143e[_0xf5b5('0x39')]['id']}})['then'](handleEntityNotFound(_0x7bd5d6,null))[_0xf5b5('0x1d')](function(_0xe8067f){if(_0xe8067f){return db[_0xf5b5('0x22')][_0xf5b5('0x48')](_['pick'](_0x29143e[_0xf5b5('0x3e')],['exten',_0xf5b5('0x49'),'description',_0xf5b5('0x4a'),'cutdigits',_0xf5b5('0x4b'),_0xf5b5('0x4c')]),{'where':{'context':_0xe8067f[_0xf5b5('0x49')],'exten':_0xe8067f[_0xf5b5('0x3d')]},'individualHooks':!![]})[_0xf5b5('0x1d')](function(_0x182db1){return _0x182db1;});}return null;})['then'](respondWithStatusCode(_0x7bd5d6,null))[_0xf5b5('0x35')](handleError(_0x7bd5d6,null));};exports[_0xf5b5('0x4d')]=function(_0x5da795,_0x4eb2a4){var _0x280304=_0x5da795['params']['id'];var _0x16c871=_0x5da795['body'];var _0x36a996=0xc8;var _0x3bb898=null;return db['sequelize'][_0xf5b5('0x4e')]({'isolationLevel':db['sequelize'][_0xf5b5('0x4f')][_0xf5b5('0x50')]['READ_COMMITTED']},function(_0x4befb5){return db[_0xf5b5('0x22')]['findOne']({'where':{'id':_0x280304},'transaction':_0x4befb5})[_0xf5b5('0x1d')](function(_0x53e45f){if(_0x53e45f){return db[_0xf5b5('0x22')][_0xf5b5('0x11')]({'where':{'VoiceExtensionId':_0x280304},'transaction':_0x4befb5})[_0xf5b5('0x1d')](function(){var _0x1bff5b=_[_0xf5b5('0x25')](_0x16c871,function(_0x3e6dd6){_0x3e6dd6[_0xf5b5('0x51')]=_0x280304;_0x3e6dd6[_0xf5b5('0x52')]=!![];return _0x3e6dd6;});return _0x53e45f['createRouting'](_0x1bff5b);})[_0xf5b5('0x1d')](function(_0x21b23a){return db[_0xf5b5('0x22')][_0xf5b5('0x53')](_0x21b23a,{'transaction':_0x4befb5});});}else{_0x36a996=0x194;_0x3bb898=[];}});})[_0xf5b5('0x1d')](function(){if(_0x36a996!==0x194){return db[_0xf5b5('0x22')][_0xf5b5('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x280304},'order':_0xf5b5('0x55')})[_0xf5b5('0x1d')](function(_0x5cd008){_0x3bb898=_0x5cd008;});}})[_0xf5b5('0x35')](function(_0x242d9f){_0x36a996=0x1f4;logger[_0xf5b5('0x1f')](_0x242d9f[_0xf5b5('0x20')]);if(_0x242d9f['name']){delete _0x242d9f['name'];}_0x3bb898=_0x242d9f;})[_0xf5b5('0x56')](function(){if(_0x3bb898===null){_0x4eb2a4[_0xf5b5('0x9')](_0x36a996);}else{if(_0x36a996===0x1f4){_0x4eb2a4['status'](_0x36a996)[_0xf5b5('0x21')](_0x3bb898);}else{_0x4eb2a4[_0xf5b5('0xa')](_0x36a996)[_0xf5b5('0xb')](_0x3bb898);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ba13ccd..5fedb6d 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 _0xe35a=['update','remove','emit','hasOwnProperty','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x326d35,_0x4f65b3){var _0xd3f8f3=function(_0x1fbbaf){while(--_0x1fbbaf){_0x326d35['push'](_0x326d35['shift']());}};_0xd3f8f3(++_0x4f65b3);}(_0xe35a,0x1bc));var _0xae35=function(_0x116e6f,_0x3c33cb){_0x116e6f=_0x116e6f-0x0;var _0x2ed403=_0xe35a[_0x116e6f];return _0x2ed403;};'use strict';var EventEmitter=require(_0xae35('0x0'));var VoiceExtension=require(_0xae35('0x1'))['db'][_0xae35('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xae35('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xae35('0x4'),'afterDestroy':_0xae35('0x5')};function emitEvent(_0x51ab47){return function(_0x525e23,_0x15bd37,_0x2f384e){VoiceExtensionEvents[_0xae35('0x6')](_0x51ab47+':'+_0x525e23['id'],_0x525e23);VoiceExtensionEvents['emit'](_0x51ab47,_0x525e23);_0x2f384e(null);};}for(var e in events){if(events[_0xae35('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x0515=['setMaxListeners','update','emit','hasOwnProperty','exports','events','VoiceExtension'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x0515,0x140));var _0x5051=function(_0x3167b1,_0x5ad266){_0x3167b1=_0x3167b1-0x0;var _0x362152=_0x0515[_0x3167b1];return _0x362152;};'use strict';var EventEmitter=require(_0x5051('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x5051('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5051('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5051('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4c7ec2){return function(_0x12c551,_0x4ac6b2,_0x4d424e){VoiceExtensionEvents['emit'](_0x4c7ec2+':'+_0x12c551['id'],_0x12c551);VoiceExtensionEvents[_0x5051('0x4')](_0x4c7ec2,_0x12c551);_0x4d424e(null);};}for(var e in events){if(events[_0x5051('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x5051('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 15c1419..d5cba3a 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 _0xd1e4=['interval','IntervalId','*,*,*,*','intervals','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','voice_extensions','then','concat','Hangup','lodash','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','options','url','length','param','phone','split','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll'];(function(_0x2b60ec,_0x3414f6){var _0x1e181b=function(_0xd64f80){while(--_0xd64f80){_0x2b60ec['push'](_0x2b60ec['shift']());}};_0x1e181b(++_0x3414f6);}(_0xd1e4,0xc5));var _0x4d1e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd1e4[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x4d1e('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x4d1e('0x1')]=function(_0x1dcc3d){var _0x7b312=_0x1dcc3d[_0x4d1e('0x2')];function _0x5040ff(_0x5a6acc){var _0x288112=0x2;var _0x288cae=[{'type':_0x5a6acc['type'],'app':_0x4d1e('0x3'),'appdata':_0x4d1e('0x4')+_0x5a6acc[_0x4d1e('0x5')],'context':_0x5a6acc[_0x4d1e('0x6')],'exten':_0x5a6acc[_0x4d1e('0x7')],'priority':_0x288112++,'VoiceExtensionId':_0x5a6acc['id']},{'type':_0x5a6acc[_0x4d1e('0x5')],'app':_0x5a6acc[_0x4d1e('0x8')]?_0x4d1e('0x3'):_0x4d1e('0x9'),'appdata':_0x5a6acc['alias']?_0x4d1e('0xa')+_0x5a6acc['alias']:'No\x20alias\x20set','context':_0x5a6acc[_0x4d1e('0x6')],'exten':_0x5a6acc[_0x4d1e('0x7')],'priority':_0x288112++,'VoiceExtensionId':_0x5a6acc['id']}];if(_0x5a6acc[_0x4d1e('0x5')]===_0x4d1e('0xb')){_0x288cae[_0x4d1e('0xc')]({'type':_0x4d1e('0xb'),'app':_0x4d1e('0x3'),'appdata':'CDR(routeid)='+_0x5a6acc['id'],'context':_0x5a6acc['context'],'exten':_0x5a6acc[_0x4d1e('0x7')],'priority':_0x288112++,'VoiceExtensionId':_0x5a6acc['id']});}_0x288cae['push']({'type':_0x5a6acc['type'],'app':_0x4d1e('0x3'),'appdata':_0x4d1e('0xd'),'context':_0x5a6acc[_0x4d1e('0x6')],'exten':_0x5a6acc['exten'],'priority':_0x288112++,'VoiceExtensionId':_0x5a6acc['id']},{'type':_0x5a6acc[_0x4d1e('0x5')],'app':'Set','appdata':_0x4d1e('0xe'),'context':_0x5a6acc[_0x4d1e('0x6')],'exten':_0x5a6acc[_0x4d1e('0x7')],'priority':_0x288112++,'VoiceExtensionId':_0x5a6acc['id']},{'type':_0x5a6acc[_0x4d1e('0x5')],'app':_0x4d1e('0x3'),'appdata':_0x4d1e('0xf'),'context':_0x5a6acc[_0x4d1e('0x6')],'exten':_0x5a6acc['exten'],'priority':_0x288112++,'VoiceExtensionId':_0x5a6acc['id']});return _0x288cae;}function _0x39e450(_0x58cd28){var _0x401623=0x2;var _0x5e54aa=[{'type':_0x4d1e('0x10'),'app':_0x4d1e('0x3'),'appdata':'CDR(type)=outbound','context':_0x58cd28['context'],'exten':_0x58cd28[_0x4d1e('0x7')],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':_0x4d1e('0x10'),'app':_0x58cd28[_0x4d1e('0x8')]?_0x4d1e('0x3'):_0x4d1e('0x9'),'appdata':_0x58cd28[_0x4d1e('0x8')]?'CDR(routeAlias)='+_0x58cd28[_0x4d1e('0x8')]:_0x4d1e('0x11'),'context':_0x58cd28['context'],'exten':_0x58cd28['exten'],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':_0x4d1e('0x10'),'app':_0x4d1e('0x3'),'appdata':_0x4d1e('0x12')+(_0x58cd28[_0x4d1e('0x13')]?_0x4d1e('0x14')+_0x58cd28['cutdigits']+'}':_0x4d1e('0x15')),'context':_0x58cd28[_0x4d1e('0x6')],'exten':_0x58cd28[_0x4d1e('0x7')],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':_0x4d1e('0x10'),'app':_0x4d1e('0x3'),'appdata':_0x4d1e('0x16')+_0x58cd28['id'],'context':_0x58cd28[_0x4d1e('0x6')],'exten':_0x58cd28['exten'],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':_0x4d1e('0x10'),'app':_0x4d1e('0x17'),'appdata':_0x4d1e('0x18')+(_0x401623+0x2)+_0x4d1e('0x19')+(_0x401623+0x1)+')','context':_0x58cd28[_0x4d1e('0x6')],'exten':_0x58cd28[_0x4d1e('0x7')],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':_0x4d1e('0x10'),'app':_0x4d1e('0x3'),'appdata':_0x58cd28['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x58cd28[_0x4d1e('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x58cd28['context'],'exten':_0x58cd28['exten'],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':'outbound','app':_0x4d1e('0x3'),'appdata':_0x4d1e('0xd'),'context':_0x58cd28[_0x4d1e('0x6')],'exten':_0x58cd28[_0x4d1e('0x7')],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':_0x4d1e('0x10'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x58cd28[_0x4d1e('0x6')],'exten':_0x58cd28['exten'],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':_0x4d1e('0x10'),'app':_0x4d1e('0x3'),'appdata':_0x4d1e('0xf'),'context':_0x58cd28[_0x4d1e('0x6')],'exten':_0x58cd28['exten'],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':_0x4d1e('0x10'),'app':'Set','appdata':_0x4d1e('0x1a')+_0x58cd28['id'],'context':_0x58cd28['context'],'exten':_0x58cd28['exten'],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']}];if(_0x58cd28[_0x4d1e('0x1b')]('recordingFormat')&&_0x58cd28[_0x4d1e('0x1c')]!=='none'){_0x5e54aa[_0x4d1e('0xc')]({'type':'outbound','app':_0x4d1e('0x3'),'appdata':_0x4d1e('0x1d'),'context':_0x58cd28[_0x4d1e('0x6')],'exten':_0x58cd28[_0x4d1e('0x7')],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']},{'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x58cd28[_0x4d1e('0x1c')]||_0x4d1e('0x1e'),'context':_0x58cd28[_0x4d1e('0x6')],'exten':_0x58cd28[_0x4d1e('0x7')],'priority':_0x401623++,'VoiceExtensionId':_0x58cd28['id']});}return _0x5e54aa;}function _0x460a26(_0x476daf,_0x271ec9){var _0x284ebb=[{'name':_0x4d1e('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x4d1e('0x20'),'param':0x2},{'name':_0x4d1e('0x21'),'param':0x3}];var _0x148a23={};var _0x257a03=_0x271ec9['split'](',');var _0x2be700=[];for(var _0x3fd35b=0x0;_0x3fd35b<_0x284ebb[_0x4d1e('0x22')];_0x3fd35b++){switch(_0x284ebb[_0x3fd35b]['name']){case _0x4d1e('0x1f'):_0x148a23[_0x4d1e('0x1f')]=_0x257a03[_0x284ebb[_0x3fd35b][_0x4d1e('0x23')]]['split']('/')[0x1];_0x148a23[_0x4d1e('0x24')]=_0x257a03[_0x284ebb[_0x3fd35b][_0x4d1e('0x23')]][_0x4d1e('0x25')]('/')[0x2];_0x148a23[_0x4d1e('0x26')]=_0x148a23['phone']?_0x148a23[_0x4d1e('0x24')]['split']('$')[0x0]:undefined;_0x148a23[_0x4d1e('0x24')]=_0x476daf[_0x4d1e('0x13')]?(_0x148a23[_0x4d1e('0x26')]||'')+'${EXTEN:'+_0x476daf[_0x4d1e('0x13')]+'}':(_0x148a23[_0x4d1e('0x26')]||'')+_0x4d1e('0x15');_0x2be700[_0x284ebb[_0x3fd35b][_0x4d1e('0x23')]]=[_0x4d1e('0x27'),_0x148a23[_0x4d1e('0x1f')],_0x148a23[_0x4d1e('0x24')]][_0x4d1e('0x28')]('/');break;case _0x4d1e('0x20'):_0x148a23['options']=_0x257a03[_0x284ebb[_0x3fd35b][_0x4d1e('0x23')]];if(_0x476daf['recordingFormat']!=='none'){if(_0x148a23[_0x4d1e('0x20')]['indexOf'](_0x4d1e('0x29'))<0x0){_0x148a23[_0x4d1e('0x20')]+=_0x4d1e('0x29');}}else{_0x148a23[_0x4d1e('0x20')]=_0x148a23[_0x4d1e('0x20')][_0x4d1e('0x2a')](_0x4d1e('0x29'),'');}_0x2be700[_0x284ebb[_0x3fd35b]['param']]=_0x148a23[_0x4d1e('0x20')];break;default:_0x2be700[_0x284ebb[_0x3fd35b][_0x4d1e('0x23')]]=_0x257a03[_0x284ebb[_0x3fd35b][_0x4d1e('0x23')]];}}return _0x2be700[_0x4d1e('0x28')](',');}function _0x39a130(_0x3dcd53,_0x20f520,_0x1842e6){return new Promise(function(_0x1db33f,_0x51145d){var _0x4dcaad=[];if(_[_0x4d1e('0x2b')](_0x20f520))return _0x1db33f(_0x4dcaad);_0x7b312[_0x4d1e('0x2c')][_0x4d1e('0x2d')]({'attributes':['id',_0x4d1e('0x2e'),_0x4d1e('0x2f')],'raw':!![]})['then'](function(_0x146697){for(var _0x3eecbe=0x0,_0x422bc2=0x0;_0x3eecbe<_0x20f520[_0x4d1e('0x22')];_0x3eecbe++,_0x422bc2=0x0){var _0x30de70=_0x20f520[_0x3eecbe];var _0x5b29ba=[];var _0x3b826b=[];delete _0x30de70['id'];if(_0x30de70[_0x4d1e('0x2e')]!==_0x4d1e('0x30')){_0x30de70[_0x4d1e('0x31')]=[_0x30de70[_0x4d1e('0x2e')]];}else{_0x30de70[_0x4d1e('0x31')]=_0x30de70[_0x4d1e('0x2f')]?_['map'](_['filter'](_0x146697,{'IntervalId':_0x30de70[_0x4d1e('0x2f')]}),'interval'):[];}_0x30de70[_0x4d1e('0x6')]=_0x3dcd53['context'];_0x30de70[_0x4d1e('0x7')]=_0x3dcd53[_0x4d1e('0x7')];if(_0x30de70[_0x4d1e('0x5')])_0x30de70['type']=_0x30de70[_0x4d1e('0x5')]['toLowerCase']();if(_0x3dcd53[_0x4d1e('0x5')]===_0x4d1e('0x10')){if(_0x30de70[_0x4d1e('0x1b')](_0x4d1e('0x32'))&&_0x30de70[_0x4d1e('0x32')]&&_0x30de70[_0x4d1e('0x32')]!=='--'){_0x5b29ba['push']({'type':_0x30de70[_0x4d1e('0x5')][_0x4d1e('0x33')](),'app':_0x4d1e('0x3'),'appdata':_0x4d1e('0x34')+_0x30de70[_0x4d1e('0x32')],'context':_0x3dcd53[_0x4d1e('0x6')],'exten':_0x3dcd53[_0x4d1e('0x7')],'priority':_0x30de70[_0x4d1e('0x31')][_0x4d1e('0x22')]+_0x1842e6+_0x422bc2++,'VoiceExtensionId':_0x3dcd53['id']});}_0x5b29ba[_0x4d1e('0xc')]({'type':_0x30de70[_0x4d1e('0x5')][_0x4d1e('0x33')](),'app':_0x4d1e('0x17'),'appdata':_0x4d1e('0x35')+(_0x30de70[_0x4d1e('0x36')]?_0x4d1e('0x37')+_0x30de70[_0x4d1e('0x36')]+')':_0x4d1e('0x38')),'context':_0x3dcd53[_0x4d1e('0x6')],'exten':_0x3dcd53[_0x4d1e('0x7')],'priority':_0x30de70[_0x4d1e('0x31')][_0x4d1e('0x22')]+_0x1842e6+_0x422bc2++,'VoiceExtensionId':_0x3dcd53['id']});}else{if(_0x30de70[_0x4d1e('0x1b')](_0x4d1e('0x39'))){if([_0x4d1e('0x3a'),_0x4d1e('0x3b')][_0x4d1e('0x3c')](_0x30de70[_0x4d1e('0x3d')][_0x4d1e('0x33')]())&&_0x30de70[_0x4d1e('0x3e')]!==_0x4d1e('0x3f')){if(_0x30de70['answer']){_0x5b29ba['push']({'type':_0x30de70[_0x4d1e('0x5')][_0x4d1e('0x33')](),'app':_0x4d1e('0x17'),'appdata':_0x4d1e('0x40'),'context':_0x3dcd53[_0x4d1e('0x6')],'exten':_0x3dcd53['exten'],'priority':_0x30de70['intervals']['length']+_0x1842e6+_0x422bc2++,'VoiceExtensionId':_0x3dcd53['id']});_0x5b29ba['push']({'type':_0x30de70['type'][_0x4d1e('0x33')](),'app':'Set','appdata':_0x4d1e('0x41'),'context':_0x3dcd53[_0x4d1e('0x6')],'exten':_0x3dcd53['exten'],'priority':_0x30de70[_0x4d1e('0x31')][_0x4d1e('0x22')]+_0x1842e6+_0x422bc2++,'VoiceExtensionId':_0x3dcd53['id']});}else{_0x5b29ba['push']({'type':_0x30de70[_0x4d1e('0x5')]['toLowerCase'](),'app':_0x4d1e('0x17'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3dcd53[_0x4d1e('0x6')],'exten':_0x3dcd53[_0x4d1e('0x7')],'priority':_0x30de70[_0x4d1e('0x31')][_0x4d1e('0x22')]+_0x1842e6+_0x422bc2++,'VoiceExtensionId':_0x3dcd53['id']});_0x5b29ba['push']({'type':_0x30de70[_0x4d1e('0x5')][_0x4d1e('0x33')](),'app':_0x4d1e('0x3'),'appdata':_0x4d1e('0x42'),'context':_0x3dcd53[_0x4d1e('0x6')],'exten':_0x3dcd53[_0x4d1e('0x7')],'priority':_0x30de70[_0x4d1e('0x31')]['length']+_0x1842e6+_0x422bc2++,'VoiceExtensionId':_0x3dcd53['id']});}}}}for(var _0x1dc6f9=0x0;_0x1dc6f9<_0x30de70[_0x4d1e('0x31')][_0x4d1e('0x22')];_0x1dc6f9++){var _0x2c80a7=_0x1842e6+_0x30de70[_0x4d1e('0x31')][_0x4d1e('0x22')];var _0xb3718c=_0x1dc6f9===_0x30de70[_0x4d1e('0x31')][_0x4d1e('0x22')]-0x1?_0x1842e6+_0x5b29ba['length']+_0x3b826b['length']+0x2:_0x1842e6+_0x1dc6f9+0x1;_0x5b29ba[_0x4d1e('0x43')](_0x1dc6f9,0x0,{'type':_0x3dcd53['type'],'app':'GotoIfTime','appdata':_0x30de70[_0x4d1e('0x31')][_0x1dc6f9]+'?'+_0x3dcd53[_0x4d1e('0x6')]+',${EXTEN},'+_0x2c80a7+':'+_0x3dcd53[_0x4d1e('0x6')]+_0x4d1e('0x44')+_0xb3718c,'exten':_0x3dcd53['exten'],'context':_0x3dcd53[_0x4d1e('0x6')],'priority':_0x1842e6+_0x1dc6f9,'VoiceExtensionId':_0x3dcd53['id']});}if(_0x30de70[_0x4d1e('0x3e')]==='outboundDial'){_0x30de70[_0x4d1e('0x45')]=_0x460a26(_0x3dcd53,_0x30de70[_0x4d1e('0x45')]);}if(_0x30de70[_0x4d1e('0x3e')]===_0x4d1e('0x46')){_0x5b29ba[_0x4d1e('0xc')]({'type':_0x30de70['type'][_0x4d1e('0x33')](),'app':'Set','appdata':_0x4d1e('0x47'),'context':_0x3dcd53[_0x4d1e('0x6')],'exten':_0x3dcd53[_0x4d1e('0x7')],'priority':_0x30de70[_0x4d1e('0x31')][_0x4d1e('0x22')]+_0x1842e6+_0x422bc2++,'VoiceExtensionId':_0x3dcd53['id']});}_0x30de70[_0x4d1e('0x48')]=_0x5b29ba['length']?_[_0x4d1e('0x49')](_0x5b29ba)[_0x4d1e('0x48')]+0x1:_0x1842e6;_0x4dcaad=_['concat'](_0x4dcaad,_0x5b29ba,[_0x30de70],_0x3b826b);_0x1842e6=_['last'](_0x4dcaad)[_0x4d1e('0x48')]+0x1;}return _0x1db33f(_0x4dcaad);})[_0x4d1e('0x4a')](function(_0x1ffd05){_0x51145d(_0x1ffd05);});});}return _0x1dcc3d[_0x4d1e('0x4b')](_0x4d1e('0x4c'),attributes,{'tableName':_0x4d1e('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xb69d2a){var _0x5a3d4f=this['get']({'plain':!![]});var _0x4220f2=_0x5a3d4f['type']===_0x4d1e('0x10')?_0x39e450(_0x5a3d4f):_0x5040ff(_0x5a3d4f);return _0x39a130(_0x5a3d4f,_0xb69d2a,_['last'](_0x4220f2)[_0x4d1e('0x48')]+0x1)[_0x4d1e('0x4e')](function(_0x1f47e2){var _0x363640=_[_0x4d1e('0x4f')](_0x4220f2,_0x1f47e2);_0x363640[_0x4d1e('0xc')]({'type':_0x5a3d4f[_0x4d1e('0x5')],'app':_0x4d1e('0x50'),'exten':_0x5a3d4f[_0x4d1e('0x7')],'context':_0x5a3d4f['context'],'priority':_[_0x4d1e('0x49')](_0x363640)['priority']+0x1,'VoiceExtensionId':_0x5a3d4f['id']});return _0x363640;});}}});}; \ No newline at end of file +var _0x6b94=['${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','interval','IntervalId','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','voice_extensions','get','then','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','split','length','name','trunk','phone','param','prefix'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x6b94,0x78));var _0x46b9=function(_0x50eeb3,_0x7cf09e){_0x50eeb3=_0x50eeb3-0x0;var _0x2a801b=_0x6b94[_0x50eeb3];return _0x2a801b;};'use strict';var _=require(_0x46b9('0x0'));var attributes=require(_0x46b9('0x1'));module['exports']=function(_0x4c8768){var _0x1e0df3=_0x4c8768[_0x46b9('0x2')];function _0x5c2d05(_0x2e0e09){var _0x45a4e2=0x2;var _0x578de2=[{'type':_0x2e0e09[_0x46b9('0x3')],'app':_0x46b9('0x4'),'appdata':_0x46b9('0x5')+_0x2e0e09[_0x46b9('0x3')],'context':_0x2e0e09[_0x46b9('0x6')],'exten':_0x2e0e09[_0x46b9('0x7')],'priority':_0x45a4e2++,'VoiceExtensionId':_0x2e0e09['id']},{'type':_0x2e0e09[_0x46b9('0x3')],'app':_0x2e0e09[_0x46b9('0x8')]?_0x46b9('0x4'):_0x46b9('0x9'),'appdata':_0x2e0e09[_0x46b9('0x8')]?_0x46b9('0xa')+_0x2e0e09['alias']:_0x46b9('0xb'),'context':_0x2e0e09[_0x46b9('0x6')],'exten':_0x2e0e09[_0x46b9('0x7')],'priority':_0x45a4e2++,'VoiceExtensionId':_0x2e0e09['id']}];if(_0x2e0e09[_0x46b9('0x3')]===_0x46b9('0xc')){_0x578de2['push']({'type':_0x46b9('0xc'),'app':'Set','appdata':_0x46b9('0xd')+_0x2e0e09['id'],'context':_0x2e0e09[_0x46b9('0x6')],'exten':_0x2e0e09['exten'],'priority':_0x45a4e2++,'VoiceExtensionId':_0x2e0e09['id']});}_0x578de2[_0x46b9('0xe')]({'type':_0x2e0e09[_0x46b9('0x3')],'app':_0x46b9('0x4'),'appdata':_0x46b9('0xf'),'context':_0x2e0e09[_0x46b9('0x6')],'exten':_0x2e0e09[_0x46b9('0x7')],'priority':_0x45a4e2++,'VoiceExtensionId':_0x2e0e09['id']},{'type':_0x2e0e09[_0x46b9('0x3')],'app':_0x46b9('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2e0e09[_0x46b9('0x6')],'exten':_0x2e0e09[_0x46b9('0x7')],'priority':_0x45a4e2++,'VoiceExtensionId':_0x2e0e09['id']},{'type':_0x2e0e09['type'],'app':_0x46b9('0x4'),'appdata':_0x46b9('0x10'),'context':_0x2e0e09[_0x46b9('0x6')],'exten':_0x2e0e09['exten'],'priority':_0x45a4e2++,'VoiceExtensionId':_0x2e0e09['id']});return _0x578de2;}function _0x5ce0f8(_0x299142){var _0x5f3904=0x2;var _0x111d32=[{'type':'outbound','app':'Set','appdata':_0x46b9('0x11'),'context':_0x299142['context'],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':_0x46b9('0x12'),'app':_0x299142[_0x46b9('0x8')]?_0x46b9('0x4'):'NoOp','appdata':_0x299142[_0x46b9('0x8')]?'CDR(routeAlias)='+_0x299142[_0x46b9('0x8')]:_0x46b9('0xb'),'context':_0x299142[_0x46b9('0x6')],'exten':_0x299142['exten'],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':_0x46b9('0x12'),'app':'Set','appdata':_0x46b9('0x13')+(_0x299142['cutdigits']?_0x46b9('0x14')+_0x299142[_0x46b9('0x15')]+'}':'${EXTEN}'),'context':_0x299142[_0x46b9('0x6')],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':_0x46b9('0x12'),'app':_0x46b9('0x4'),'appdata':_0x46b9('0xd')+_0x299142['id'],'context':_0x299142['context'],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':_0x46b9('0x12'),'app':_0x46b9('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5f3904+0x2)+_0x46b9('0x17')+(_0x5f3904+0x1)+')','context':_0x299142['context'],'exten':_0x299142['exten'],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':'outbound','app':'Set','appdata':_0x299142[_0x46b9('0x15')]?_0x46b9('0x18')+_0x299142[_0x46b9('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x299142[_0x46b9('0x6')],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':_0x46b9('0x12'),'app':_0x46b9('0x4'),'appdata':_0x46b9('0xf'),'context':_0x299142[_0x46b9('0x6')],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':'outbound','app':_0x46b9('0x4'),'appdata':_0x46b9('0x19'),'context':_0x299142[_0x46b9('0x6')],'exten':_0x299142['exten'],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':_0x46b9('0x12'),'app':'Set','appdata':_0x46b9('0x10'),'context':_0x299142[_0x46b9('0x6')],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':_0x46b9('0x12'),'app':_0x46b9('0x4'),'appdata':_0x46b9('0x1a')+_0x299142['id'],'context':_0x299142[_0x46b9('0x6')],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']}];if(_0x299142['hasOwnProperty'](_0x46b9('0x1b'))&&_0x299142['recordingFormat']!==_0x46b9('0x1c')){_0x111d32[_0x46b9('0xe')]({'type':'outbound','app':_0x46b9('0x4'),'appdata':_0x46b9('0x1d'),'context':_0x299142['context'],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']},{'type':_0x46b9('0x12'),'app':'Set','appdata':_0x46b9('0x1e')+_0x299142[_0x46b9('0x1b')]||_0x46b9('0x1f'),'context':_0x299142[_0x46b9('0x6')],'exten':_0x299142[_0x46b9('0x7')],'priority':_0x5f3904++,'VoiceExtensionId':_0x299142['id']});}return _0x111d32;}function _0x256db3(_0x584e5f,_0xc4ebf7){var _0x54d718=[{'name':'trunk','param':0x0},{'name':_0x46b9('0x20'),'param':0x1},{'name':_0x46b9('0x21'),'param':0x2},{'name':_0x46b9('0x22'),'param':0x3}];var _0x4c3188={};var _0x2a14d0=_0xc4ebf7[_0x46b9('0x23')](',');var _0x449269=[];for(var _0xfb8faa=0x0;_0xfb8faa<_0x54d718[_0x46b9('0x24')];_0xfb8faa++){switch(_0x54d718[_0xfb8faa][_0x46b9('0x25')]){case _0x46b9('0x26'):_0x4c3188['trunk']=_0x2a14d0[_0x54d718[_0xfb8faa]['param']]['split']('/')[0x1];_0x4c3188[_0x46b9('0x27')]=_0x2a14d0[_0x54d718[_0xfb8faa][_0x46b9('0x28')]][_0x46b9('0x23')]('/')[0x2];_0x4c3188[_0x46b9('0x29')]=_0x4c3188[_0x46b9('0x27')]?_0x4c3188['phone'][_0x46b9('0x23')]('$')[0x0]:undefined;_0x4c3188[_0x46b9('0x27')]=_0x584e5f[_0x46b9('0x15')]?(_0x4c3188[_0x46b9('0x29')]||'')+_0x46b9('0x14')+_0x584e5f[_0x46b9('0x15')]+'}':(_0x4c3188[_0x46b9('0x29')]||'')+_0x46b9('0x2a');_0x449269[_0x54d718[_0xfb8faa][_0x46b9('0x28')]]=[_0x46b9('0x2b'),_0x4c3188[_0x46b9('0x26')],_0x4c3188[_0x46b9('0x27')]][_0x46b9('0x2c')]('/');break;case'options':_0x4c3188[_0x46b9('0x21')]=_0x2a14d0[_0x54d718[_0xfb8faa]['param']];if(_0x584e5f[_0x46b9('0x1b')]!=='none'){if(_0x4c3188[_0x46b9('0x21')][_0x46b9('0x2d')](_0x46b9('0x2e'))<0x0){_0x4c3188['options']+=_0x46b9('0x2e');}}else{_0x4c3188[_0x46b9('0x21')]=_0x4c3188['options']['replace'](_0x46b9('0x2e'),'');}_0x449269[_0x54d718[_0xfb8faa][_0x46b9('0x28')]]=_0x4c3188[_0x46b9('0x21')];break;default:_0x449269[_0x54d718[_0xfb8faa][_0x46b9('0x28')]]=_0x2a14d0[_0x54d718[_0xfb8faa][_0x46b9('0x28')]];}}return _0x449269[_0x46b9('0x2c')](',');}function _0x32bd39(_0x2cf58f,_0x55d4a8,_0x85072f){return new Promise(function(_0x2a6233,_0x5dd3bc){var _0x41e682=[];if(_[_0x46b9('0x2f')](_0x55d4a8))return _0x2a6233(_0x41e682);_0x1e0df3[_0x46b9('0x30')]['findAll']({'attributes':['id',_0x46b9('0x31'),_0x46b9('0x32')],'raw':!![]})['then'](function(_0x45e67d){for(var _0x3df43f=0x0,_0x87fe99=0x0;_0x3df43f<_0x55d4a8['length'];_0x3df43f++,_0x87fe99=0x0){var _0x1aea79=_0x55d4a8[_0x3df43f];var _0x637ddc=[];var _0x1853e1=[];delete _0x1aea79['id'];if(_0x1aea79[_0x46b9('0x31')]!=='*,*,*,*'){_0x1aea79[_0x46b9('0x33')]=[_0x1aea79[_0x46b9('0x31')]];}else{_0x1aea79[_0x46b9('0x33')]=_0x1aea79['IntervalId']?_[_0x46b9('0x34')](_[_0x46b9('0x35')](_0x45e67d,{'IntervalId':_0x1aea79[_0x46b9('0x32')]}),'interval'):[];}_0x1aea79[_0x46b9('0x6')]=_0x2cf58f['context'];_0x1aea79[_0x46b9('0x7')]=_0x2cf58f['exten'];if(_0x1aea79['type'])_0x1aea79[_0x46b9('0x3')]=_0x1aea79[_0x46b9('0x3')][_0x46b9('0x36')]();if(_0x2cf58f['type']===_0x46b9('0x12')){if(_0x1aea79[_0x46b9('0x37')](_0x46b9('0x38'))&&_0x1aea79[_0x46b9('0x38')]&&_0x1aea79['tag']!=='--'){_0x637ddc[_0x46b9('0xe')]({'type':_0x1aea79[_0x46b9('0x3')]['toLowerCase'](),'app':_0x46b9('0x4'),'appdata':_0x46b9('0x39')+_0x1aea79[_0x46b9('0x38')],'context':_0x2cf58f[_0x46b9('0x6')],'exten':_0x2cf58f['exten'],'priority':_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')]+_0x85072f+_0x87fe99++,'VoiceExtensionId':_0x2cf58f['id']});}_0x637ddc[_0x46b9('0xe')]({'type':_0x1aea79[_0x46b9('0x3')]['toLowerCase'](),'app':_0x46b9('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1aea79['callerID']?'Set(CALLERID(all)='+_0x1aea79['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x2cf58f['context'],'exten':_0x2cf58f['exten'],'priority':_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')]+_0x85072f+_0x87fe99++,'VoiceExtensionId':_0x2cf58f['id']});}else{if(_0x1aea79[_0x46b9('0x37')](_0x46b9('0x3a'))){if([_0x46b9('0x3b'),_0x46b9('0x3c')]['includes'](_0x1aea79[_0x46b9('0x3d')][_0x46b9('0x36')]())&&_0x1aea79[_0x46b9('0x3e')]!==_0x46b9('0x3f')){if(_0x1aea79[_0x46b9('0x3a')]){_0x637ddc[_0x46b9('0xe')]({'type':_0x1aea79[_0x46b9('0x3')][_0x46b9('0x36')](),'app':_0x46b9('0x16'),'appdata':_0x46b9('0x40'),'context':_0x2cf58f[_0x46b9('0x6')],'exten':_0x2cf58f[_0x46b9('0x7')],'priority':_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')]+_0x85072f+_0x87fe99++,'VoiceExtensionId':_0x2cf58f['id']});_0x637ddc['push']({'type':_0x1aea79[_0x46b9('0x3')]['toLowerCase'](),'app':_0x46b9('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2cf58f[_0x46b9('0x6')],'exten':_0x2cf58f['exten'],'priority':_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')]+_0x85072f+_0x87fe99++,'VoiceExtensionId':_0x2cf58f['id']});}else{_0x637ddc[_0x46b9('0xe')]({'type':_0x1aea79['type'][_0x46b9('0x36')](),'app':_0x46b9('0x16'),'appdata':_0x46b9('0x41'),'context':_0x2cf58f['context'],'exten':_0x2cf58f['exten'],'priority':_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')]+_0x85072f+_0x87fe99++,'VoiceExtensionId':_0x2cf58f['id']});_0x637ddc['push']({'type':_0x1aea79[_0x46b9('0x3')][_0x46b9('0x36')](),'app':_0x46b9('0x4'),'appdata':_0x46b9('0x42'),'context':_0x2cf58f[_0x46b9('0x6')],'exten':_0x2cf58f[_0x46b9('0x7')],'priority':_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')]+_0x85072f+_0x87fe99++,'VoiceExtensionId':_0x2cf58f['id']});}}}}for(var _0x336942=0x0;_0x336942<_0x1aea79['intervals'][_0x46b9('0x24')];_0x336942++){var _0x436a99=_0x85072f+_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')];var _0x12867a=_0x336942===_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')]-0x1?_0x85072f+_0x637ddc['length']+_0x1853e1[_0x46b9('0x24')]+0x2:_0x85072f+_0x336942+0x1;_0x637ddc[_0x46b9('0x43')](_0x336942,0x0,{'type':_0x2cf58f['type'],'app':_0x46b9('0x44'),'appdata':_0x1aea79[_0x46b9('0x33')][_0x336942]+'?'+_0x2cf58f['context']+',${EXTEN},'+_0x436a99+':'+_0x2cf58f['context']+_0x46b9('0x45')+_0x12867a,'exten':_0x2cf58f['exten'],'context':_0x2cf58f[_0x46b9('0x6')],'priority':_0x85072f+_0x336942,'VoiceExtensionId':_0x2cf58f['id']});}if(_0x1aea79[_0x46b9('0x3e')]===_0x46b9('0x46')){_0x1aea79[_0x46b9('0x47')]=_0x256db3(_0x2cf58f,_0x1aea79[_0x46b9('0x47')]);}if(_0x1aea79['appType']==='agi'){_0x637ddc[_0x46b9('0xe')]({'type':_0x1aea79[_0x46b9('0x3')][_0x46b9('0x36')](),'app':_0x46b9('0x4'),'appdata':_0x46b9('0x48'),'context':_0x2cf58f[_0x46b9('0x6')],'exten':_0x2cf58f['exten'],'priority':_0x1aea79[_0x46b9('0x33')][_0x46b9('0x24')]+_0x85072f+_0x87fe99++,'VoiceExtensionId':_0x2cf58f['id']});}_0x1aea79[_0x46b9('0x49')]=_0x637ddc[_0x46b9('0x24')]?_['last'](_0x637ddc)['priority']+0x1:_0x85072f;_0x41e682=_[_0x46b9('0x4a')](_0x41e682,_0x637ddc,[_0x1aea79],_0x1853e1);_0x85072f=_[_0x46b9('0x4b')](_0x41e682)[_0x46b9('0x49')]+0x1;}return _0x2a6233(_0x41e682);})[_0x46b9('0x4c')](function(_0x5923ba){_0x5dd3bc(_0x5923ba);});});}return _0x4c8768[_0x46b9('0x4d')]('VoiceExtension',attributes,{'tableName':_0x46b9('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x22d181){var _0x5aa80d=this[_0x46b9('0x4f')]({'plain':!![]});var _0x1a8120=_0x5aa80d[_0x46b9('0x3')]===_0x46b9('0x12')?_0x5ce0f8(_0x5aa80d):_0x5c2d05(_0x5aa80d);return _0x32bd39(_0x5aa80d,_0x22d181,_['last'](_0x1a8120)[_0x46b9('0x49')]+0x1)[_0x46b9('0x50')](function(_0x505630){var _0x13437d=_[_0x46b9('0x4a')](_0x1a8120,_0x505630);_0x13437d[_0x46b9('0xe')]({'type':_0x5aa80d[_0x46b9('0x3')],'app':'Hangup','exten':_0x5aa80d[_0x46b9('0x7')],'context':_0x5aa80d[_0x46b9('0x6')],'priority':_[_0x46b9('0x4b')](_0x13437d)[_0x46b9('0x49')]+0x1,'VoiceExtensionId':_0x5aa80d['id']});return _0x13437d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8fa5361..d44945d 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 _0x0d4d=['request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceExtension','findAll','raw','options','attributes','limit','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0d4d,0x132));var _0xd0d4=function(_0xbecff3,_0x3fc6ee){_0xbecff3=_0xbecff3-0x0;var _0xdd318d=_0x0d4d[_0xbecff3];return _0xdd318d;};'use strict';var _=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var moment=require(_0xd0d4('0x2'));var BPromise=require(_0xd0d4('0x3'));var rs=require(_0xd0d4('0x4'));var fs=require('fs');var Redis=require(_0xd0d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0d4('0x6'));var logger=require('../../config/logger')(_0xd0d4('0x7'));var config=require(_0xd0d4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd0d4('0x9')][_0xd0d4('0xa')]({'port':0x232a});config[_0xd0d4('0xb')]=_['defaults'](config[_0xd0d4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0d4('0xc'))(new Redis(config['redis']));require(_0xd0d4('0xd'))[_0xd0d4('0xe')](socket);function respondWithRpcPromise(_0xdfcbed,_0x5bdeab,_0x1ed4da){return new BPromise(function(_0x2014b6,_0x2a9607){return client[_0xd0d4('0xf')](_0xdfcbed,_0x1ed4da)[_0xd0d4('0x10')](function(_0xbf4c47){logger['info'](_0xd0d4('0x11'),_0x5bdeab,_0xd0d4('0x12'));logger[_0xd0d4('0x13')](_0xd0d4('0x14'),_0x5bdeab,_0xd0d4('0x12'),JSON[_0xd0d4('0x15')](_0xbf4c47));if(_0xbf4c47['error']){if(_0xbf4c47[_0xd0d4('0x16')][_0xd0d4('0x17')]===0x1f4){logger[_0xd0d4('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x5bdeab,_0xbf4c47['error'][_0xd0d4('0x18')]);return _0x2a9607(_0xbf4c47[_0xd0d4('0x16')]['message']);}logger[_0xd0d4('0x16')](_0xd0d4('0x11'),_0x5bdeab,_0xbf4c47['error']['message']);return _0x2014b6(_0xbf4c47[_0xd0d4('0x16')][_0xd0d4('0x18')]);}else{logger[_0xd0d4('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x5bdeab,'request\x20sent');_0x2014b6(_0xbf4c47['result'][_0xd0d4('0x18')]);}})[_0xd0d4('0x1a')](function(_0x1e8409){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5bdeab,_0x1e8409);_0x2a9607(_0x1e8409);});});}exports[_0xd0d4('0x1b')]=function(_0x4b3b77){var _0x2e6bbf=this;return new Promise(function(_0x272580,_0x1dcc1b){return db['VoiceExtension'][_0xd0d4('0x1c')]({'raw':_0x4b3b77['options']?_0x4b3b77['options'][_0xd0d4('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b3b77[_0xd0d4('0x1e')]?_0x4b3b77['options']['where']||null:null,'attributes':_0x4b3b77[_0xd0d4('0x1e')]?_0x4b3b77[_0xd0d4('0x1e')][_0xd0d4('0x1f')]||null:null,'limit':_0x4b3b77[_0xd0d4('0x1e')]?_0x4b3b77[_0xd0d4('0x1e')][_0xd0d4('0x20')]||null:null,'include':_0x4b3b77['options']?_0x4b3b77[_0xd0d4('0x1e')]['include']?_[_0xd0d4('0x21')](_0x4b3b77[_0xd0d4('0x1e')][_0xd0d4('0x22')],function(_0x5380c3){return{'model':db[_0x5380c3['model']],'as':_0x5380c3['as'],'attributes':_0x5380c3[_0xd0d4('0x1f')],'include':_0x5380c3['include']?_['map'](_0x5380c3[_0xd0d4('0x22')],function(_0x29948c){return{'model':db[_0x29948c[_0xd0d4('0x23')]],'as':_0x29948c['as'],'attributes':_0x29948c[_0xd0d4('0x1f')],'include':_0x29948c['include']?_[_0xd0d4('0x21')](_0x29948c[_0xd0d4('0x22')],function(_0x45acf8){return{'model':db[_0x45acf8[_0xd0d4('0x23')]],'as':_0x45acf8['as'],'attributes':_0x45acf8[_0xd0d4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd0d4('0x10')](function(_0x1b07e8){logger[_0xd0d4('0x19')](_0xd0d4('0x1b'),_0x4b3b77);logger['debug'](_0xd0d4('0x1b'),_0x4b3b77,JSON[_0xd0d4('0x15')](_0x1b07e8));_0x272580(_0x1b07e8);})[_0xd0d4('0x1a')](function(_0x18096a){logger[_0xd0d4('0x16')](_0xd0d4('0x1b'),_0x18096a['message'],_0x4b3b77);_0x1dcc1b(_0x2e6bbf['error'](0x1f4,_0x18096a[_0xd0d4('0x18')]));});});}; \ No newline at end of file +var _0xeecc=['attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where'];(function(_0x249f28,_0x1edf11){var _0x1b2dd6=function(_0x190389){while(--_0x190389){_0x249f28['push'](_0x249f28['shift']());}};_0x1b2dd6(++_0x1edf11);}(_0xeecc,0x12d));var _0xceec=function(_0x1aa86e,_0x1014e3){_0x1aa86e=_0x1aa86e-0x0;var _0x53c9a0=_0xeecc[_0x1aa86e];return _0x53c9a0;};'use strict';var _=require(_0xceec('0x0'));var util=require(_0xceec('0x1'));var moment=require(_0xceec('0x2'));var BPromise=require(_0xceec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xceec('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xceec('0x5'));var config=require(_0xceec('0x6'));var jayson=require(_0xceec('0x7'));var client=jayson[_0xceec('0x8')]['http']({'port':0x232a});config[_0xceec('0x9')]=_['defaults'](config[_0xceec('0x9')],{'host':_0xceec('0xa'),'port':0x18eb});var socket=require(_0xceec('0xb'))(new Redis(config[_0xceec('0x9')]));require(_0xceec('0xc'))[_0xceec('0xd')](socket);function respondWithRpcPromise(_0x23229d,_0x58f64e,_0x12b37d){return new BPromise(function(_0x11f15f,_0x257259){return client[_0xceec('0xe')](_0x23229d,_0x12b37d)[_0xceec('0xf')](function(_0x503795){logger[_0xceec('0x10')](_0xceec('0x11'),_0x58f64e,_0xceec('0x12'));logger[_0xceec('0x13')](_0xceec('0x14'),_0x58f64e,'request\x20sent',JSON[_0xceec('0x15')](_0x503795));if(_0x503795['error']){if(_0x503795[_0xceec('0x16')][_0xceec('0x17')]===0x1f4){logger[_0xceec('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x58f64e,_0x503795['error'][_0xceec('0x18')]);return _0x257259(_0x503795['error'][_0xceec('0x18')]);}logger[_0xceec('0x16')](_0xceec('0x11'),_0x58f64e,_0x503795[_0xceec('0x16')][_0xceec('0x18')]);return _0x11f15f(_0x503795[_0xceec('0x16')][_0xceec('0x18')]);}else{logger[_0xceec('0x10')](_0xceec('0x11'),_0x58f64e,_0xceec('0x12'));_0x11f15f(_0x503795[_0xceec('0x19')]['message']);}})[_0xceec('0x1a')](function(_0x1c0cfc){logger[_0xceec('0x16')](_0xceec('0x11'),_0x58f64e,_0x1c0cfc);_0x257259(_0x1c0cfc);});});}exports[_0xceec('0x1b')]=function(_0x32ac95){var _0x230c88=this;return new Promise(function(_0x422e25,_0x32778b){return db[_0xceec('0x1c')]['findAll']({'raw':_0x32ac95[_0xceec('0x1d')]?_0x32ac95['options'][_0xceec('0x1e')]===undefined?!![]:![]:!![],'where':_0x32ac95[_0xceec('0x1d')]?_0x32ac95['options'][_0xceec('0x1f')]||null:null,'attributes':_0x32ac95['options']?_0x32ac95[_0xceec('0x1d')][_0xceec('0x20')]||null:null,'limit':_0x32ac95[_0xceec('0x1d')]?_0x32ac95[_0xceec('0x1d')][_0xceec('0x21')]||null:null,'include':_0x32ac95[_0xceec('0x1d')]?_0x32ac95[_0xceec('0x1d')]['include']?_[_0xceec('0x22')](_0x32ac95['options'][_0xceec('0x23')],function(_0x1ee42d){return{'model':db[_0x1ee42d[_0xceec('0x24')]],'as':_0x1ee42d['as'],'attributes':_0x1ee42d[_0xceec('0x20')],'include':_0x1ee42d[_0xceec('0x23')]?_[_0xceec('0x22')](_0x1ee42d['include'],function(_0x2cebb0){return{'model':db[_0x2cebb0['model']],'as':_0x2cebb0['as'],'attributes':_0x2cebb0[_0xceec('0x20')],'include':_0x2cebb0[_0xceec('0x23')]?_[_0xceec('0x22')](_0x2cebb0[_0xceec('0x23')],function(_0xde9e91){return{'model':db[_0xde9e91[_0xceec('0x24')]],'as':_0xde9e91['as'],'attributes':_0xde9e91[_0xceec('0x20')]};}):[]};}):[]};}):[]:[]})[_0xceec('0xf')](function(_0x475910){logger['info'](_0xceec('0x1b'),_0x32ac95);logger[_0xceec('0x13')](_0xceec('0x1b'),_0x32ac95,JSON[_0xceec('0x15')](_0x475910));_0x422e25(_0x475910);})[_0xceec('0x1a')](function(_0x39cf05){logger[_0xceec('0x16')](_0xceec('0x1b'),_0x39cf05['message'],_0x32ac95);_0x32778b(_0x230c88[_0xceec('0x16')](0x1f4,_0x39cf05[_0xceec('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 15456ae..fec5ba3 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x5c2d58,_0x11a42f){var _0x86762a=function(_0x175406){while(--_0x175406){_0x5c2d58['push'](_0x5c2d58['shift']());}};_0x86762a(++_0x11a42f);}(_0x4975,0x86));var _0x5497=function(_0x30b025,_0x19217){_0x30b025=_0x30b025-0x0;var _0x48ae21=_0x4975[_0x30b025];return _0x48ae21;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x2eb860,_0x224816){var _0x181bcf=function(_0x5e829b){while(--_0x5e829b){_0x2eb860['push'](_0x2eb860['shift']());}};_0x181bcf(++_0x224816);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x5fc3[_0x3725ee];return _0x399c71;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 6408b00..60ed921 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 _0xafb9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','getMessages','post','create','update','delete','/:id','destroy','exports','multer'];(function(_0x26166f,_0x4ffe7d){var _0x4f0376=function(_0x8b211){while(--_0x8b211){_0x26166f['push'](_0x26166f['shift']());}};_0x4f0376(++_0x4ffe7d);}(_0xafb9,0x68));var _0x9afb=function(_0x4a3879,_0xf0a572){_0x4a3879=_0x4a3879-0x0;var _0x6813dd=_0xafb9[_0x4a3879];return _0x6813dd;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var fs_extra=require(_0x9afb('0x6'));var auth=require(_0x9afb('0x7'));var interaction=require(_0x9afb('0x8'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x9afb('0x9')]('/',auth['isAuthenticated'](),controller[_0x9afb('0xa')]);router['get']('/:id',auth[_0x9afb('0xb')](),controller[_0x9afb('0xc')]);router[_0x9afb('0x9')]('/:id/messages',auth[_0x9afb('0xb')](),controller[_0x9afb('0xd')]);router[_0x9afb('0xe')]('/',auth[_0x9afb('0xb')](),controller[_0x9afb('0xf')]);router['put']('/:id',auth[_0x9afb('0xb')](),controller[_0x9afb('0x10')]);router[_0x9afb('0x11')](_0x9afb('0x12'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x13')]);module[_0x9afb('0x14')]=router; \ No newline at end of file +var _0x7ee1=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','create','/:id','update','delete','exports','multer','express','Router'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x7ee1,0x8d));var _0x17ee=function(_0x312c72,_0x2b2ee6){_0x312c72=_0x312c72-0x0;var _0x51403a=_0x7ee1[_0x312c72];return _0x51403a;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/:id',auth[_0x17ee('0x9')](),controller['show']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x17ee('0xb')]);router['put'](_0x17ee('0xc'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xd')]);router[_0x17ee('0xe')]('/:id',auth[_0x17ee('0x9')](),controller['destroy']);module[_0x17ee('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 11aba28..617158c 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 _0xd3a4=['TINYINT(4)','INTEGER','fullname','\x20-\x20','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3a4,0xb0));var _0x4d3a=function(_0x4cfce3,_0x5cfba0){_0x4cfce3=_0x4cfce3-0x0;var _0xd71772=_0xd3a4[_0x4cfce3];return _0xd71772;};'use strict';var Sequelize=require('sequelize');module[_0x4d3a('0x0')]={'customer_id':{'type':Sequelize[_0x4d3a('0x1')]},'context':{'type':Sequelize[_0x4d3a('0x1')],'defaultValue':_0x4d3a('0x2'),'unique':_0x4d3a('0x3')},'mailbox':{'type':Sequelize[_0x4d3a('0x1')],'defaultValue':'','allowNull':![],'unique':_0x4d3a('0x3')},'password':{'type':Sequelize[_0x4d3a('0x1')]},'fullname':{'type':Sequelize[_0x4d3a('0x1')]},'email':{'type':Sequelize[_0x4d3a('0x1')],'validate':{'isEmail':!![]},'set':function(_0x241306){this[_0x4d3a('0x4')](_0x4d3a('0x5'),typeof _0x241306===_0x4d3a('0x6')&&_0x241306[_0x4d3a('0x7')]()?_0x241306[_0x4d3a('0x7')]():null);}},'pager':{'type':Sequelize[_0x4d3a('0x1')]},'tz':{'type':Sequelize[_0x4d3a('0x1')],'defaultValue':_0x4d3a('0x8')},'attach':{'type':Sequelize[_0x4d3a('0x9')](_0x4d3a('0xa'),'no'),'defaultValue':_0x4d3a('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4d3a('0x9')](_0x4d3a('0xa'),'no'),'defaultValue':_0x4d3a('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4d3a('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x4d3a('0x9')](_0x4d3a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x4d3a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4d3a('0x9')](_0x4d3a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4d3a('0x9')](_0x4d3a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4d3a('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4d3a('0x9')](_0x4d3a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4d3a('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4d3a('0x9')](_0x4d3a('0xa'),'no'),'defaultValue':_0x4d3a('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x4d3a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4d3a('0x9')](_0x4d3a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x4d3a('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x4d3a('0x1')]},'emailbody':{'type':Sequelize[_0x4d3a('0x1')]},'maxsecs':{'type':Sequelize[_0x4d3a('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x4d3a('0xd'))+_0x4d3a('0xe')+this[_0x4d3a('0xf')](_0x4d3a('0x10'));}}}; \ No newline at end of file +var _0x09b4=['yes','TINYINT(4)','TIMESTAMP','INTEGER','fullname','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM'];(function(_0x5079f0,_0x2e0ae4){var _0x182bce=function(_0xa6f581){while(--_0xa6f581){_0x5079f0['push'](_0x5079f0['shift']());}};_0x182bce(++_0x2e0ae4);}(_0x09b4,0x16f));var _0x409b=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x09b4[_0x4a3898];return _0x25ceb0;};'use strict';var Sequelize=require(_0x409b('0x0'));module[_0x409b('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x409b('0x2')],'defaultValue':_0x409b('0x3'),'unique':_0x409b('0x4')},'mailbox':{'type':Sequelize[_0x409b('0x2')],'defaultValue':'','allowNull':![],'unique':_0x409b('0x4')},'password':{'type':Sequelize[_0x409b('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x409b('0x2')],'validate':{'isEmail':!![]},'set':function(_0xcf246){this[_0x409b('0x5')](_0x409b('0x6'),typeof _0xcf246===_0x409b('0x7')&&_0xcf246[_0x409b('0x8')]()?_0xcf246['trim']():null);}},'pager':{'type':Sequelize[_0x409b('0x2')]},'tz':{'type':Sequelize[_0x409b('0x2')],'defaultValue':_0x409b('0x9')},'attach':{'type':Sequelize[_0x409b('0xa')]('yes','no'),'defaultValue':_0x409b('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x409b('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x409b('0x2')]},'callback':{'type':Sequelize[_0x409b('0x2')]},'review':{'type':Sequelize[_0x409b('0xa')](_0x409b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x409b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x409b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x409b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x409b('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x409b('0xa')](_0x409b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x409b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x409b('0xa')](_0x409b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x409b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x409b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x409b('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x409b('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x409b('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x409b('0xf'))+'\x20-\x20'+this[_0x409b('0x10')](_0x409b('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e89a621..61682f2 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 _0xcf66=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','VoiceMail','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0xcf66,0x71));var _0x6cf6=function(_0x2b8410,_0x257ebc){_0x2b8410=_0x2b8410-0x0;var _0x3dbbe2=_0xcf66[_0x2b8410];return _0x3dbbe2;};'use strict';var emlformat=require(_0x6cf6('0x0'));var rimraf=require(_0x6cf6('0x1'));var zipdir=require(_0x6cf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cf6('0x5'));var path=require(_0x6cf6('0x6'));var sox=require('sox');var csv=require(_0x6cf6('0x7'));var ejs=require(_0x6cf6('0x8'));var fs=require('fs');var fs_extra=require(_0x6cf6('0x9'));var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x7'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdfea,_0x13b1ad){_0x13b1ad=_0x13b1ad||0xcc;return function(_0x372d12){if(_0x372d12){return _0x3fdfea[_0x6cf6('0x14')](_0x13b1ad);}return _0x3fdfea[_0x6cf6('0x15')](_0x13b1ad)[_0x6cf6('0x16')]();};}function respondWithResult(_0x57909f,_0x32fe64){_0x32fe64=_0x32fe64||0xc8;return function(_0x494ece){if(_0x494ece){return _0x57909f[_0x6cf6('0x15')](_0x32fe64)[_0x6cf6('0x17')](_0x494ece);}};}function respondWithFilteredResult(_0x4b073f,_0x40e413){return function(_0x1b40f8){if(_0x1b40f8){var _0x2d23ab=typeof _0x40e413[_0x6cf6('0x18')]===_0x6cf6('0x19')&&typeof _0x40e413[_0x6cf6('0x1a')]===_0x6cf6('0x19');var _0x39ec25=_0x1b40f8[_0x6cf6('0x1b')];var _0x2ca2b1=_0x2d23ab?0x0:_0x40e413['offset'];var _0x11d994=_0x2d23ab?_0x1b40f8[_0x6cf6('0x1b')]:_0x40e413[_0x6cf6('0x18')]+_0x40e413['limit'];var _0x18abd9;if(_0x11d994>=_0x39ec25){_0x11d994=_0x39ec25;_0x18abd9=0xc8;}else{_0x18abd9=0xce;}_0x4b073f[_0x6cf6('0x15')](_0x18abd9);return _0x4b073f[_0x6cf6('0x1c')](_0x6cf6('0x1d'),_0x2ca2b1+'-'+_0x11d994+'/'+_0x39ec25)[_0x6cf6('0x17')](_0x1b40f8);}return null;};}function patchUpdates(_0x21e903){return function(_0x123993){try{jsonpatch['apply'](_0x123993,_0x21e903,!![]);}catch(_0x19f2cd){return BPromise[_0x6cf6('0x1e')](_0x19f2cd);}return _0x123993[_0x6cf6('0x1f')]();};}function saveUpdates(_0x380a40,_0x5cba3a){return function(_0x470ea4){if(_0x470ea4){return _0x470ea4[_0x6cf6('0x20')](_0x380a40)[_0x6cf6('0x21')](function(_0x5b2767){return _0x5b2767;});}return null;};}function removeEntity(_0x5b30e0,_0x276225){return function(_0x59f838){if(_0x59f838){return _0x59f838[_0x6cf6('0x22')]()[_0x6cf6('0x21')](function(){var _0x14ae3e=_0x59f838[_0x6cf6('0x23')]({'plain':!![]});var _0x3f9871=_0x6cf6('0x24');return db[_0x6cf6('0x25')]['destroy']({'where':{'type':_0x3f9871,'resourceId':_0x14ae3e['id']}})[_0x6cf6('0x21')](function(){return _0x59f838;});})[_0x6cf6('0x21')](function(){_0x5b30e0[_0x6cf6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf4eec5,_0x2e56ca){return function(_0x2224db){if(!_0x2224db){_0xf4eec5[_0x6cf6('0x14')](0x194);}return _0x2224db;};}function handleError(_0x5c9236,_0x584594){_0x584594=_0x584594||0x1f4;return function(_0x2afe84){logger[_0x6cf6('0x26')](_0x2afe84[_0x6cf6('0x27')]);if(_0x2afe84[_0x6cf6('0x28')]){delete _0x2afe84['name'];}_0x5c9236[_0x6cf6('0x15')](_0x584594)['send'](_0x2afe84);};}exports['index']=function(_0x519a70,_0x10bde5){var _0x65433={},_0x33d308={},_0x42f488={'count':0x0,'rows':[]};var _0x11c848=_['map'](db[_0x6cf6('0x29')][_0x6cf6('0x2a')],function(_0x356340){return{'name':_0x356340['fieldName'],'type':_0x356340[_0x6cf6('0x2b')][_0x6cf6('0x2c')]};});_0x33d308[_0x6cf6('0x2d')]=_[_0x6cf6('0x2e')](_0x11c848,_0x6cf6('0x28'));_0x33d308[_0x6cf6('0x2f')]=_[_0x6cf6('0x30')](_0x519a70[_0x6cf6('0x2f')]);_0x33d308[_0x6cf6('0x31')]=_[_0x6cf6('0x32')](_0x33d308[_0x6cf6('0x2d')],_0x33d308[_0x6cf6('0x2f')]);_0x65433[_0x6cf6('0x33')]=_[_0x6cf6('0x32')](_0x33d308[_0x6cf6('0x2d')],qs[_0x6cf6('0x34')](_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x34')]));_0x65433['attributes']=_0x65433[_0x6cf6('0x33')][_0x6cf6('0x35')]?_0x65433[_0x6cf6('0x33')]:_0x33d308[_0x6cf6('0x2d')];if(!_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x36')](_0x6cf6('0x37'))){_0x65433[_0x6cf6('0x1a')]=qs[_0x6cf6('0x1a')](_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x1a')]);_0x65433['offset']=qs[_0x6cf6('0x18')](_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x18')]);}_0x65433[_0x6cf6('0x38')]=qs[_0x6cf6('0x39')](_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x39')]);_0x65433[_0x6cf6('0x3a')]=qs[_0x6cf6('0x31')](_['pick'](_0x519a70[_0x6cf6('0x2f')],_0x33d308[_0x6cf6('0x31')]),_0x11c848);if(_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x3b')]){_0x65433[_0x6cf6('0x3a')]=_[_0x6cf6('0x3c')](_0x65433[_0x6cf6('0x3a')],{'$or':_[_0x6cf6('0x2e')](_0x11c848,function(_0x3a7c3b){if(_0x3a7c3b['type']!==_0x6cf6('0x3d')){var _0x5a9727={};_0x5a9727[_0x3a7c3b[_0x6cf6('0x28')]]={'$like':'%'+_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x3b')]+'%'};return _0x5a9727;}})});}_0x65433=_[_0x6cf6('0x3c')]({},_0x65433,_0x519a70[_0x6cf6('0x3e')]);var _0x29541e={'where':_0x65433[_0x6cf6('0x3a')]};return db[_0x6cf6('0x29')]['count'](_0x29541e)[_0x6cf6('0x21')](function(_0x335dce){_0x42f488['count']=_0x335dce;if(_0x519a70[_0x6cf6('0x2f')][_0x6cf6('0x3f')]){_0x65433[_0x6cf6('0x40')]=[{'all':!![]}];}return db['VoiceMail'][_0x6cf6('0x41')](_0x65433);})[_0x6cf6('0x21')](function(_0x51d915){_0x42f488[_0x6cf6('0x42')]=_0x51d915;return _0x42f488;})[_0x6cf6('0x21')](respondWithFilteredResult(_0x10bde5,_0x65433))[_0x6cf6('0x43')](handleError(_0x10bde5,null));};exports[_0x6cf6('0x44')]=function(_0x41195e,_0x20dacd){var _0xbcb6a7={'raw':!![],'where':{'id':_0x41195e[_0x6cf6('0x45')]['id']}},_0x5a2ef8={};_0x5a2ef8['model']=_[_0x6cf6('0x30')](db[_0x6cf6('0x29')]['rawAttributes']);_0x5a2ef8[_0x6cf6('0x2f')]=_[_0x6cf6('0x30')](_0x41195e[_0x6cf6('0x2f')]);_0x5a2ef8[_0x6cf6('0x31')]=_[_0x6cf6('0x32')](_0x5a2ef8['model'],_0x5a2ef8[_0x6cf6('0x2f')]);_0xbcb6a7[_0x6cf6('0x33')]=_[_0x6cf6('0x32')](_0x5a2ef8['model'],qs[_0x6cf6('0x34')](_0x41195e[_0x6cf6('0x2f')][_0x6cf6('0x34')]));_0xbcb6a7['attributes']=_0xbcb6a7[_0x6cf6('0x33')]['length']?_0xbcb6a7['attributes']:_0x5a2ef8[_0x6cf6('0x2d')];if(_0x41195e[_0x6cf6('0x2f')][_0x6cf6('0x3f')]){_0xbcb6a7[_0x6cf6('0x40')]=[{'all':!![]}];}_0xbcb6a7=_[_0x6cf6('0x3c')]({},_0xbcb6a7,_0x41195e[_0x6cf6('0x3e')]);return db[_0x6cf6('0x29')][_0x6cf6('0x46')](_0xbcb6a7)[_0x6cf6('0x21')](handleEntityNotFound(_0x20dacd,null))[_0x6cf6('0x21')](respondWithResult(_0x20dacd,null))[_0x6cf6('0x43')](handleError(_0x20dacd,null));};exports[_0x6cf6('0x47')]=function(_0x3786d1,_0x4c8ada){return db[_0x6cf6('0x29')][_0x6cf6('0x47')](_0x3786d1['body'],{})['then'](function(_0x10047a){var _0x17dd6e=_0x3786d1[_0x6cf6('0x48')][_0x6cf6('0x23')]({'plain':!![]});if(!_0x17dd6e)throw new Error(_0x6cf6('0x49'));if(_0x17dd6e[_0x6cf6('0x4a')]==='user'){var _0x115b9b=_0x10047a[_0x6cf6('0x23')]({'plain':!![]});var _0x2503dc='Voicemails';return db['UserProfileSection'][_0x6cf6('0x46')]({'where':{'name':_0x2503dc,'userProfileId':_0x17dd6e[_0x6cf6('0x4b')]},'raw':!![]})[_0x6cf6('0x21')](function(_0x255e88){if(_0x255e88&&_0x255e88[_0x6cf6('0x4c')]===0x0){return db[_0x6cf6('0x25')][_0x6cf6('0x47')]({'name':_0x115b9b[_0x6cf6('0x28')],'resourceId':_0x115b9b['id'],'type':_0x255e88[_0x6cf6('0x28')],'sectionId':_0x255e88['id']},{})[_0x6cf6('0x21')](function(){return _0x10047a;});}else{return _0x10047a;}})['catch'](function(_0x217072){logger[_0x6cf6('0x26')](_0x6cf6('0x4d'),_0x217072);throw _0x217072;});}return _0x10047a;})[_0x6cf6('0x21')](respondWithResult(_0x4c8ada,0xc9))[_0x6cf6('0x43')](handleError(_0x4c8ada,null));};exports[_0x6cf6('0x20')]=function(_0x2e1ee7,_0xce361){if(_0x2e1ee7[_0x6cf6('0x4e')]['id']){delete _0x2e1ee7[_0x6cf6('0x4e')]['id'];}return db[_0x6cf6('0x29')]['find']({'where':{'id':_0x2e1ee7[_0x6cf6('0x45')]['id']}})['then'](handleEntityNotFound(_0xce361,null))[_0x6cf6('0x21')](saveUpdates(_0x2e1ee7[_0x6cf6('0x4e')],null))['then'](respondWithResult(_0xce361,null))[_0x6cf6('0x43')](handleError(_0xce361,null));};exports[_0x6cf6('0x22')]=function(_0x4699d5,_0x1bdbc1){return db[_0x6cf6('0x29')][_0x6cf6('0x46')]({'where':{'id':_0x4699d5['params']['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x1bdbc1,null))[_0x6cf6('0x21')](removeEntity(_0x1bdbc1,null))[_0x6cf6('0x43')](handleError(_0x1bdbc1,null));};exports['getMessages']=function(_0x4f1de3,_0x2c8736,_0x140ed2){return db['VoiceMail'][_0x6cf6('0x4f')]({'where':{'id':_0x4f1de3[_0x6cf6('0x45')]['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x2c8736,null))[_0x6cf6('0x21')](function(_0x2e460a){var _0x58ec7e;var _0x3e7e5b={},_0x40b31f={};_0x40b31f['model']=_['keys'](db[_0x6cf6('0x50')][_0x6cf6('0x2a')]);_0x40b31f[_0x6cf6('0x2f')]=_[_0x6cf6('0x30')](_0x4f1de3[_0x6cf6('0x2f')]);_0x40b31f['filters']=_['intersection'](_0x40b31f[_0x6cf6('0x2d')],_0x40b31f[_0x6cf6('0x2f')]);_0x3e7e5b[_0x6cf6('0x33')]=_[_0x6cf6('0x32')](_0x40b31f[_0x6cf6('0x2d')],qs['fields'](_0x4f1de3['query']['fields']));_0x3e7e5b[_0x6cf6('0x33')]=_0x3e7e5b[_0x6cf6('0x33')][_0x6cf6('0x35')]?_0x3e7e5b[_0x6cf6('0x33')]:_0x40b31f['model'];if(!_0x4f1de3[_0x6cf6('0x2f')]['hasOwnProperty'](_0x6cf6('0x37'))){_0x3e7e5b['limit']=qs[_0x6cf6('0x1a')](_0x4f1de3[_0x6cf6('0x2f')][_0x6cf6('0x1a')]);_0x3e7e5b[_0x6cf6('0x18')]=qs[_0x6cf6('0x18')](_0x4f1de3['query'][_0x6cf6('0x18')]);}_0x3e7e5b['order']=qs[_0x6cf6('0x39')](_0x4f1de3['query'][_0x6cf6('0x39')]);_0x3e7e5b['where']=qs[_0x6cf6('0x31')](_[_0x6cf6('0x51')](_0x4f1de3['query'],_0x40b31f[_0x6cf6('0x31')]));if(_0x4f1de3[_0x6cf6('0x2f')][_0x6cf6('0x3b')]){_0x3e7e5b[_0x6cf6('0x3a')]=_[_0x6cf6('0x3c')](_0x3e7e5b[_0x6cf6('0x3a')],{'$or':_[_0x6cf6('0x2e')](_0x3e7e5b['attributes'],function(_0x4ff62b){var _0x2df3ea={};_0x2df3ea[_0x4ff62b]={'$like':'%'+_0x4f1de3[_0x6cf6('0x2f')]['filter']+'%'};return _0x2df3ea;})});}_0x3e7e5b[_0x6cf6('0x3a')]=_['merge'](_0x3e7e5b['where'],{'mailboxuser':_0x2e460a[_0x6cf6('0x52')]});_0x3e7e5b=_['merge']({},_0x3e7e5b,_0x4f1de3['options']);return db[_0x6cf6('0x50')][_0x6cf6('0x53')](_0x3e7e5b)[_0x6cf6('0x21')](respondWithFilteredResult(_0x2c8736,_0x3e7e5b));})['catch'](handleError(_0x2c8736,null));}; \ No newline at end of file +var _0x6f7a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Voicemails','destroy','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll'];(function(_0x2cf5e3,_0x4fbd1f){var _0x5a7f32=function(_0x199c05){while(--_0x199c05){_0x2cf5e3['push'](_0x2cf5e3['shift']());}};_0x5a7f32(++_0x4fbd1f);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x4c95b5,_0x20bcb1){_0x4c95b5=_0x4c95b5-0x0;var _0x525d58=_0x6f7a[_0x4c95b5];return _0x525d58;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['VoiceMail'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['VoiceMail'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['VoiceMail'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));};exports[_0xa6f7('0x51')]=function(_0x139192,_0x4496f1,_0x5908e3){return db['VoiceMail'][_0xa6f7('0x52')]({'where':{'id':_0x139192[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4496f1,null))[_0xa6f7('0x25')](function(_0x301327){var _0x269249;var _0x1fcb72={},_0x5efd49={};_0x5efd49[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db[_0xa6f7('0x53')][_0xa6f7('0x2d')]);_0x5efd49[_0xa6f7('0x32')]=_[_0xa6f7('0x47')](_0x139192[_0xa6f7('0x32')]);_0x5efd49[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x5efd49[_0xa6f7('0x30')],_0x5efd49[_0xa6f7('0x32')]);_0x1fcb72['attributes']=_[_0xa6f7('0x33')](_0x5efd49['model'],qs[_0xa6f7('0x35')](_0x139192['query'][_0xa6f7('0x35')]));_0x1fcb72[_0xa6f7('0x34')]=_0x1fcb72['attributes'][_0xa6f7('0x36')]?_0x1fcb72[_0xa6f7('0x34')]:_0x5efd49[_0xa6f7('0x30')];if(!_0x139192['query'][_0xa6f7('0x37')]('nolimit')){_0x1fcb72[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x139192['query'][_0xa6f7('0x1d')]);_0x1fcb72['offset']=qs[_0xa6f7('0x1e')](_0x139192['query'][_0xa6f7('0x1e')]);}_0x1fcb72[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x139192[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x1fcb72[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x139192[_0xa6f7('0x32')],_0x5efd49[_0xa6f7('0x3b')]));if(_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'$or':_[_0xa6f7('0x31')](_0x1fcb72[_0xa6f7('0x34')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]+'%'};return _0x3a464e;})});}_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'mailboxuser':_0x301327[_0xa6f7('0x54')]});_0x1fcb72=_['merge']({},_0x1fcb72,_0x139192[_0xa6f7('0x40')]);return db[_0xa6f7('0x53')][_0xa6f7('0x55')](_0x1fcb72)[_0xa6f7('0x25')](respondWithFilteredResult(_0x4496f1,_0x1fcb72));})[_0xa6f7('0x45')](handleError(_0x4496f1,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 590d08c..49185b5 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 _0x1101=['mailbox','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x3e5745,_0x3e253b){var _0xd89f3a=function(_0x1be253){while(--_0x1be253){_0x3e5745['push'](_0x3e5745['shift']());}};_0xd89f3a(++_0x3e253b);}(_0x1101,0xa6));var _0x1110=function(_0xb8d02e,_0x1a97de){_0xb8d02e=_0xb8d02e-0x0;var _0x553a5d=_0x1101[_0xb8d02e];return _0x553a5d;};'use strict';var _=require(_0x1110('0x0'));var util=require(_0x1110('0x1'));var logger=require(_0x1110('0x2'))(_0x1110('0x3'));var moment=require(_0x1110('0x4'));var BPromise=require('bluebird');var rp=require(_0x1110('0x5'));var fs=require('fs');var path=require(_0x1110('0x6'));var rimraf=require(_0x1110('0x7'));var config=require(_0x1110('0x8'));var attributes=require('./voiceMail.attributes');module[_0x1110('0x9')]=function(_0x14ad82,_0x55fa2b){return _0x14ad82[_0x1110('0xa')](_0x1110('0xb'),attributes,{'tableName':_0x1110('0xc'),'paranoid':![],'indexes':[{'name':_0x1110('0xd'),'fields':[_0x1110('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe86b=['context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe86b,0x1c3));var _0xbe86=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe86b[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xbe86('0x0'));var util=require(_0xbe86('0x1'));var logger=require(_0xbe86('0x2'))(_0xbe86('0x3'));var moment=require(_0xbe86('0x4'));var BPromise=require(_0xbe86('0x5'));var rp=require(_0xbe86('0x6'));var fs=require('fs');var path=require(_0xbe86('0x7'));var rimraf=require(_0xbe86('0x8'));var config=require(_0xbe86('0x9'));var attributes=require(_0xbe86('0xa'));module[_0xbe86('0xb')]=function(_0x5b3750,_0x32feaf){return _0x5b3750[_0xbe86('0xc')](_0xbe86('0xd'),attributes,{'tableName':_0xbe86('0xe'),'paranoid':![],'indexes':[{'name':_0xbe86('0xf'),'fields':[_0xbe86('0x10'),_0xbe86('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 7fe00b8..7866bba 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 _0x68b3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis'];(function(_0x44b203,_0x2ebdad){var _0x16fb4f=function(_0x54d7e5){while(--_0x54d7e5){_0x44b203['push'](_0x44b203['shift']());}};_0x16fb4f(++_0x2ebdad);}(_0x68b3,0x6f));var _0x368b=function(_0x1ac8b8,_0x3e39d8){_0x1ac8b8=_0x1ac8b8-0x0;var _0x2159e0=_0x68b3[_0x1ac8b8];return _0x2159e0;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require('moment');var BPromise=require(_0x368b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x368b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x368b('0x4'));var logger=require(_0x368b('0x5'))(_0x368b('0x6'));var config=require(_0x368b('0x7'));var jayson=require(_0x368b('0x8'));var client=jayson[_0x368b('0x9')][_0x368b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45b190,_0x1e844a,_0x40aa91){return new BPromise(function(_0x26878f,_0x28b753){return client[_0x368b('0xb')](_0x45b190,_0x40aa91)[_0x368b('0xc')](function(_0x521b9c){logger['info'](_0x368b('0xd'),_0x1e844a,_0x368b('0xe'));logger['debug'](_0x368b('0xf'),_0x1e844a,_0x368b('0xe'),JSON[_0x368b('0x10')](_0x521b9c));if(_0x521b9c[_0x368b('0x11')]){if(_0x521b9c[_0x368b('0x11')][_0x368b('0x12')]===0x1f4){logger[_0x368b('0x11')](_0x368b('0xd'),_0x1e844a,_0x521b9c[_0x368b('0x11')][_0x368b('0x13')]);return _0x28b753(_0x521b9c[_0x368b('0x11')][_0x368b('0x13')]);}logger[_0x368b('0x11')](_0x368b('0xd'),_0x1e844a,_0x521b9c[_0x368b('0x11')][_0x368b('0x13')]);return _0x26878f(_0x521b9c[_0x368b('0x11')][_0x368b('0x13')]);}else{logger[_0x368b('0x14')]('VoiceMail,\x20%s,\x20%s',_0x1e844a,_0x368b('0xe'));_0x26878f(_0x521b9c[_0x368b('0x15')][_0x368b('0x13')]);}})[_0x368b('0x16')](function(_0x436ffe){logger[_0x368b('0x11')](_0x368b('0xd'),_0x1e844a,_0x436ffe);_0x28b753(_0x436ffe);});});} \ No newline at end of file +var _0x778b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util'];(function(_0x2e3a01,_0x2c2a2a){var _0x1115a9=function(_0x4f01f3){while(--_0x4f01f3){_0x2e3a01['push'](_0x2e3a01['shift']());}};_0x1115a9(++_0x2c2a2a);}(_0x778b,0x91));var _0xb778=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x778b[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xb778('0x0'));var util=require(_0xb778('0x1'));var moment=require(_0xb778('0x2'));var BPromise=require(_0xb778('0x3'));var rs=require(_0xb778('0x4'));var fs=require('fs');var Redis=require(_0xb778('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb778('0x6'));var logger=require(_0xb778('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb778('0x8'));var client=jayson[_0xb778('0x9')][_0xb778('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ec562,_0x234318,_0x5f5c71){return new BPromise(function(_0x5d4255,_0x1737fb){return client['request'](_0x4ec562,_0x5f5c71)[_0xb778('0xb')](function(_0x4ae591){logger[_0xb778('0xc')](_0xb778('0xd'),_0x234318,_0xb778('0xe'));logger[_0xb778('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x234318,_0xb778('0xe'),JSON[_0xb778('0x10')](_0x4ae591));if(_0x4ae591['error']){if(_0x4ae591[_0xb778('0x11')][_0xb778('0x12')]===0x1f4){logger[_0xb778('0x11')](_0xb778('0xd'),_0x234318,_0x4ae591['error'][_0xb778('0x13')]);return _0x1737fb(_0x4ae591[_0xb778('0x11')][_0xb778('0x13')]);}logger[_0xb778('0x11')](_0xb778('0xd'),_0x234318,_0x4ae591['error'][_0xb778('0x13')]);return _0x5d4255(_0x4ae591['error'][_0xb778('0x13')]);}else{logger['info'](_0xb778('0xd'),_0x234318,_0xb778('0xe'));_0x5d4255(_0x4ae591[_0xb778('0x14')][_0xb778('0x13')]);}})['catch'](function(_0x530ad7){logger['error'](_0xb778('0xd'),_0x234318,_0x530ad7);_0x1737fb(_0x530ad7);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index acbfdee..7696c04 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 _0x693e=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','/:id/download','isAuthenticated','download'];(function(_0x4927eb,_0x4ef04d){var _0xd860ba=function(_0x14734d){while(--_0x14734d){_0x4927eb['push'](_0x4927eb['shift']());}};_0xd860ba(++_0x4ef04d);}(_0x693e,0x1d1));var _0xe693=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x693e[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xe693('0x0'));var util=require(_0xe693('0x1'));var path=require(_0xe693('0x2'));var timeout=require(_0xe693('0x3'));var express=require(_0xe693('0x4'));var router=express['Router']();var fs_extra=require(_0xe693('0x5'));var auth=require(_0xe693('0x6'));var interaction=require(_0xe693('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xe693('0x8')]('/',auth['isAuthenticated'](),controller[_0xe693('0x9')]);router[_0xe693('0x8')](_0xe693('0xa'),auth['isAuthenticated'](),controller[_0xe693('0xb')]);router[_0xe693('0x8')](_0xe693('0xc'),auth[_0xe693('0xd')](),controller[_0xe693('0xe')]);router[_0xe693('0xf')]('/',auth[_0xe693('0xd')](),controller[_0xe693('0x10')]);router['put'](_0xe693('0xa'),auth['isAuthenticated'](),controller[_0xe693('0x11')]);router[_0xe693('0x12')](_0xe693('0xa'),auth[_0xe693('0xd')](),controller[_0xe693('0x13')]);module['exports']=router; \ No newline at end of file +var _0xff79=['/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x20913a,_0x43e4f1){var _0x179f06=function(_0x107e3f){while(--_0x107e3f){_0x20913a['push'](_0x20913a['shift']());}};_0x179f06(++_0x43e4f1);}(_0xff79,0x143));var _0x9ff7=function(_0x5c2a33,_0x355731){_0x5c2a33=_0x5c2a33-0x0;var _0x4ebd63=_0xff79[_0x5c2a33];return _0x4ebd63;};'use strict';var multer=require(_0x9ff7('0x0'));var util=require(_0x9ff7('0x1'));var path=require(_0x9ff7('0x2'));var timeout=require(_0x9ff7('0x3'));var express=require(_0x9ff7('0x4'));var router=express[_0x9ff7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9ff7('0x6'));var interaction=require(_0x9ff7('0x7'));var config=require(_0x9ff7('0x8'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x9ff7('0x9')](),controller[_0x9ff7('0xa')]);router[_0x9ff7('0xb')](_0x9ff7('0xc'),auth[_0x9ff7('0x9')](),controller['show']);router[_0x9ff7('0xb')](_0x9ff7('0xd'),auth[_0x9ff7('0x9')](),controller[_0x9ff7('0xe')]);router[_0x9ff7('0xf')]('/',auth[_0x9ff7('0x9')](),controller[_0x9ff7('0x10')]);router[_0x9ff7('0x11')](_0x9ff7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9ff7('0x12')](_0x9ff7('0xc'),auth[_0x9ff7('0x9')](),controller[_0x9ff7('0x13')]);module[_0x9ff7('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3139cdd..071105d 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 _0x0b00=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports'];(function(_0x4dbe77,_0x44ac82){var _0x143766=function(_0x1dbf33){while(--_0x1dbf33){_0x4dbe77['push'](_0x4dbe77['shift']());}};_0x143766(++_0x44ac82);}(_0x0b00,0x134));var _0x00b0=function(_0x277946,_0x317258){_0x277946=_0x277946-0x0;var _0x54c026=_0x0b00[_0x277946];return _0x54c026;};'use strict';var Sequelize=require(_0x00b0('0x0'));module[_0x00b0('0x1')]={'name':{'type':Sequelize[_0x00b0('0x2')],'get':function(_0x3c1798){return this[_0x00b0('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x00b0('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x00b0('0x6')](_0x00b0('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x00b0('0x5')],'defaultValue':''},'stamp':{'type':_0x00b0('0x8'),'defaultValue':Sequelize[_0x00b0('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xe6c8=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6c8,0x1ea));var _0x8e6c=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe6c8[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8e6c('0x0')],'get':function(_0x5c6931){return this[_0x8e6c('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x8e6c('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x8e6c('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8e6c('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8e6c('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8e6c('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8e6c('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x8e6c('0x4')](_0x8e6c('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8e6c('0x3')],'defaultValue':''},'stamp':{'type':_0x8e6c('0x6'),'defaultValue':Sequelize[_0x8e6c('0x7')](_0x8e6c('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 0f163c4..243871f 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 _0xdd23=['save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','type','differenceBy','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','create','body','find','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x28bb12,_0x35fe9a){var _0x26d1ae=function(_0x2ae352){while(--_0x2ae352){_0x28bb12['push'](_0x28bb12['shift']());}};_0x26d1ae(++_0x35fe9a);}(_0xdd23,0xdc));var _0x3dd2=function(_0x388266,_0x4520b2){_0x388266=_0x388266-0x0;var _0x58c7e5=_0xdd23[_0x388266];return _0x58c7e5;};'use strict';var emlformat=require(_0x3dd2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dd2('0x1'));var jsonpatch=require(_0x3dd2('0x2'));var rp=require('request-promise');var moment=require(_0x3dd2('0x3'));var BPromise=require(_0x3dd2('0x4'));var Mustache=require(_0x3dd2('0x5'));var util=require(_0x3dd2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3dd2('0x7'));var ejs=require(_0x3dd2('0x8'));var fs=require('fs');var fs_extra=require(_0x3dd2('0x9'));var _=require(_0x3dd2('0xa'));var squel=require(_0x3dd2('0xb'));var crypto=require(_0x3dd2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3dd2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3dd2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3dd2('0xf'));var qs=require(_0x3dd2('0x10'));var as=require(_0x3dd2('0x11'));var hardwareService=require(_0x3dd2('0x12'));var logger=require(_0x3dd2('0x13'))(_0x3dd2('0x14'));var utils=require(_0x3dd2('0x15'));var config=require(_0x3dd2('0x16'));var licenseUtil=require(_0x3dd2('0x17'));var db=require(_0x3dd2('0x18'))['db'];function respondWithStatusCode(_0x44e5eb,_0x21ba9c){_0x21ba9c=_0x21ba9c||0xcc;return function(_0x5cad27){if(_0x5cad27){return _0x44e5eb[_0x3dd2('0x19')](_0x21ba9c);}return _0x44e5eb[_0x3dd2('0x1a')](_0x21ba9c)[_0x3dd2('0x1b')]();};}function respondWithResult(_0x2a3015,_0x46a7c5){_0x46a7c5=_0x46a7c5||0xc8;return function(_0x12acd0){if(_0x12acd0){return _0x2a3015[_0x3dd2('0x1a')](_0x46a7c5)[_0x3dd2('0x1c')](_0x12acd0);}};}function respondWithFilteredResult(_0x3c04ef,_0x2cb696){return function(_0x5e1a5e){if(_0x5e1a5e){var _0x285a7=typeof _0x2cb696[_0x3dd2('0x1d')]===_0x3dd2('0x1e')&&typeof _0x2cb696[_0x3dd2('0x1f')]==='undefined';var _0x2cf41f=_0x5e1a5e['count'];var _0x2042c4=_0x285a7?0x0:_0x2cb696['offset'];var _0x30a4b4=_0x285a7?_0x5e1a5e[_0x3dd2('0x20')]:_0x2cb696[_0x3dd2('0x1d')]+_0x2cb696['limit'];var _0x46102;if(_0x30a4b4>=_0x2cf41f){_0x30a4b4=_0x2cf41f;_0x46102=0xc8;}else{_0x46102=0xce;}_0x3c04ef[_0x3dd2('0x1a')](_0x46102);return _0x3c04ef['set'](_0x3dd2('0x21'),_0x2042c4+'-'+_0x30a4b4+'/'+_0x2cf41f)['json'](_0x5e1a5e);}return null;};}function patchUpdates(_0x253b18){return function(_0x424c71){try{jsonpatch[_0x3dd2('0x22')](_0x424c71,_0x253b18,!![]);}catch(_0x401cb7){return BPromise['reject'](_0x401cb7);}return _0x424c71[_0x3dd2('0x23')]();};}function saveUpdates(_0x1b5af4,_0x30f19b){return function(_0x468c94){if(_0x468c94){return _0x468c94[_0x3dd2('0x24')](_0x1b5af4)[_0x3dd2('0x25')](function(_0x56ba8c){return _0x56ba8c;});}return null;};}function removeEntity(_0x1e32fc,_0x249abf){return function(_0x5cd58f){if(_0x5cd58f){return _0x5cd58f[_0x3dd2('0x26')]()[_0x3dd2('0x25')](function(){_0x1e32fc['status'](0xcc)[_0x3dd2('0x1b')]();});}};}function handleEntityNotFound(_0x1a6226,_0x22c695){return function(_0xa37f68){if(!_0xa37f68){_0x1a6226[_0x3dd2('0x19')](0x194);}return _0xa37f68;};}function handleError(_0x3eaf26,_0x14a5e2){_0x14a5e2=_0x14a5e2||0x1f4;return function(_0x1092aa){logger[_0x3dd2('0x27')](_0x1092aa[_0x3dd2('0x28')]);if(_0x1092aa[_0x3dd2('0x29')]){delete _0x1092aa[_0x3dd2('0x29')];}_0x3eaf26[_0x3dd2('0x1a')](_0x14a5e2)[_0x3dd2('0x2a')](_0x1092aa);};}exports[_0x3dd2('0x2b')]=function(_0x4f1f7d,_0x2a7d96){var _0x1092e3={},_0xeb8c9f={},_0x41a843={'count':0x0,'rows':[]};var _0x4ab5c5=_[_0x3dd2('0x2c')](db[_0x3dd2('0x2d')]['rawAttributes'],function(_0x2a8297){return{'name':_0x2a8297['fieldName'],'type':_0x2a8297[_0x3dd2('0x2e')]['key']};});_0xeb8c9f['model']=_[_0x3dd2('0x2f')](_['map'](_0x4ab5c5,_0x3dd2('0x29')),[_0x3dd2('0x29')]);_0xeb8c9f[_0x3dd2('0x30')]=_[_0x3dd2('0x31')](_0x4f1f7d[_0x3dd2('0x30')]);_0xeb8c9f['filters']=_[_0x3dd2('0x32')](_0xeb8c9f[_0x3dd2('0x33')],_0xeb8c9f['query']);_0x1092e3[_0x3dd2('0x34')]=_[_0x3dd2('0x32')](_0xeb8c9f[_0x3dd2('0x33')],qs[_0x3dd2('0x35')](_0x4f1f7d[_0x3dd2('0x30')]['fields']));_0x1092e3[_0x3dd2('0x34')]=_0x1092e3[_0x3dd2('0x34')]['length']?_0x1092e3['attributes']:_0xeb8c9f['model'];if(!_0x4f1f7d[_0x3dd2('0x30')][_0x3dd2('0x36')](_0x3dd2('0x37'))){_0x1092e3[_0x3dd2('0x1f')]=qs[_0x3dd2('0x1f')](_0x4f1f7d[_0x3dd2('0x30')]['limit']);_0x1092e3['offset']=qs[_0x3dd2('0x1d')](_0x4f1f7d['query'][_0x3dd2('0x1d')]);}_0x1092e3[_0x3dd2('0x38')]=qs[_0x3dd2('0x39')](_0x4f1f7d[_0x3dd2('0x30')][_0x3dd2('0x39')]);_0x1092e3['where']=qs[_0x3dd2('0x3a')](_['pick'](_0x4f1f7d['query'],_0xeb8c9f[_0x3dd2('0x3a')]),_0x4ab5c5);if(_0x4f1f7d[_0x3dd2('0x30')][_0x3dd2('0x3b')]){_0x1092e3[_0x3dd2('0x3c')]=_[_0x3dd2('0x3d')](_0x1092e3[_0x3dd2('0x3c')],{'$or':_[_0x3dd2('0x2c')](_0x4ab5c5,function(_0x9f6dce){if(_0x9f6dce[_0x3dd2('0x2e')]!=='VIRTUAL'){var _0xd52329={};_0xd52329[_0x9f6dce[_0x3dd2('0x29')]]={'$like':'%'+_0x4f1f7d[_0x3dd2('0x30')]['filter']+'%'};return _0xd52329;}})});}_0x1092e3=_[_0x3dd2('0x3d')]({},_0x1092e3,_0x4f1f7d['options']);var _0x5f453b={'where':_0x1092e3[_0x3dd2('0x3c')]};return db[_0x3dd2('0x2d')][_0x3dd2('0x20')](_0x5f453b)[_0x3dd2('0x25')](function(_0x5c1bed){_0x41a843['count']=_0x5c1bed;if(_0x4f1f7d['query'][_0x3dd2('0x3e')]){_0x1092e3[_0x3dd2('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x3dd2('0x40')](_0x1092e3);})[_0x3dd2('0x25')](function(_0x451afe){_0x41a843[_0x3dd2('0x41')]=_0x451afe;return _0x41a843;})[_0x3dd2('0x25')](respondWithFilteredResult(_0x2a7d96,_0x1092e3))[_0x3dd2('0x42')](handleError(_0x2a7d96,null));};exports[_0x3dd2('0x43')]=function(_0x408516,_0x35802c){var _0x1855d6={'raw':!![],'where':{'id':_0x408516[_0x3dd2('0x44')]['id']}},_0x36941b={};_0x36941b[_0x3dd2('0x33')]=_['keys'](db[_0x3dd2('0x2d')][_0x3dd2('0x45')]);_0x36941b[_0x3dd2('0x30')]=_[_0x3dd2('0x31')](_0x408516[_0x3dd2('0x30')]);_0x36941b[_0x3dd2('0x3a')]=_[_0x3dd2('0x32')](_0x36941b[_0x3dd2('0x33')],_0x36941b['query']);_0x1855d6[_0x3dd2('0x34')]=_[_0x3dd2('0x32')](_0x36941b[_0x3dd2('0x33')],qs[_0x3dd2('0x35')](_0x408516['query'][_0x3dd2('0x35')]));_0x1855d6[_0x3dd2('0x34')]=_0x1855d6[_0x3dd2('0x34')][_0x3dd2('0x46')]?_0x1855d6[_0x3dd2('0x34')]:_0x36941b['model'];if(_0x408516[_0x3dd2('0x30')][_0x3dd2('0x3e')]){_0x1855d6[_0x3dd2('0x3f')]=[{'all':!![]}];}_0x1855d6=_['merge']({},_0x1855d6,_0x408516[_0x3dd2('0x47')]);return db[_0x3dd2('0x2d')]['find'](_0x1855d6)[_0x3dd2('0x25')](handleEntityNotFound(_0x35802c,null))[_0x3dd2('0x25')](respondWithResult(_0x35802c,null))[_0x3dd2('0x42')](handleError(_0x35802c,null));};exports[_0x3dd2('0x48')]=function(_0x4db90e,_0x27f2c9){return db['VoiceMailMessage']['create'](_0x4db90e['body'],{})['then'](respondWithResult(_0x27f2c9,0xc9))[_0x3dd2('0x42')](handleError(_0x27f2c9,null));};exports['update']=function(_0x1a7a6f,_0x39a038){if(_0x1a7a6f[_0x3dd2('0x49')]['id']){delete _0x1a7a6f[_0x3dd2('0x49')]['id'];}return db[_0x3dd2('0x2d')][_0x3dd2('0x4a')]({'where':{'id':_0x1a7a6f[_0x3dd2('0x44')]['id']}})['then'](handleEntityNotFound(_0x39a038,null))['then'](saveUpdates(_0x1a7a6f[_0x3dd2('0x49')],null))[_0x3dd2('0x25')](respondWithResult(_0x39a038,null))[_0x3dd2('0x42')](handleError(_0x39a038,null));};exports['destroy']=function(_0x13385f,_0xcd32ed){return db[_0x3dd2('0x2d')][_0x3dd2('0x4a')]({'where':{'id':_0x13385f['params']['id']}})['then'](handleEntityNotFound(_0xcd32ed,null))[_0x3dd2('0x25')](removeEntity(_0xcd32ed,null))[_0x3dd2('0x42')](handleError(_0xcd32ed,null));};exports[_0x3dd2('0x4b')]=function(_0x37547b,_0x49f66c,_0x21e585){return db['VoiceMailMessage'][_0x3dd2('0x4a')]({'where':{'id':_0x37547b[_0x3dd2('0x44')]['id']},'attributes':['id',_0x3dd2('0x4c'),'msg_id']})[_0x3dd2('0x25')](handleEntityNotFound(_0x49f66c,null))[_0x3dd2('0x25')](function(_0x52bfdf){if(_0x52bfdf){if(!_0x52bfdf[_0x3dd2('0x4c')]){throw new db['Sequelize'][(_0x3dd2('0x4d'))](_0x3dd2('0x4e'));}var _0x1fb51d={'Content-Type':_0x3dd2('0x4f'),'Content-Disposition':'attachment'};if(_0x52bfdf[_0x3dd2('0x50')]){_0x1fb51d[_0x3dd2('0x51')]=_0x3dd2('0x52')+_0x52bfdf['msg_id']+_0x3dd2('0x53');}_0x49f66c[_0x3dd2('0x54')](_0x1fb51d);return _0x49f66c[_0x3dd2('0x2a')](new Buffer(_0x52bfdf[_0x3dd2('0x4c')]));}})[_0x3dd2('0x42')](handleError(_0x49f66c,null));}; \ No newline at end of file +var _0xedf2=['find','create','body','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','save','update','then','destroy','stack','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','include','findAll','rows','catch','params','includeAll','options'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0xedf2,0x10d));var _0x2edf=function(_0x55bfce,_0x2578d4){_0x55bfce=_0x55bfce-0x0;var _0x4b15ea=_0xedf2[_0x55bfce];return _0x4b15ea;};'use strict';var emlformat=require(_0x2edf('0x0'));var rimraf=require(_0x2edf('0x1'));var zipdir=require(_0x2edf('0x2'));var jsonpatch=require(_0x2edf('0x3'));var rp=require(_0x2edf('0x4'));var moment=require(_0x2edf('0x5'));var BPromise=require(_0x2edf('0x6'));var Mustache=require(_0x2edf('0x7'));var util=require(_0x2edf('0x8'));var path=require(_0x2edf('0x9'));var sox=require(_0x2edf('0xa'));var csv=require(_0x2edf('0xb'));var ejs=require(_0x2edf('0xc'));var fs=require('fs');var fs_extra=require(_0x2edf('0xd'));var _=require('lodash');var squel=require(_0x2edf('0xe'));var crypto=require('crypto');var jsforce=require(_0x2edf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2edf('0xb'));var querystring=require('querystring');var Papa=require(_0x2edf('0x10'));var Redis=require(_0x2edf('0x11'));var authService=require(_0x2edf('0x12'));var qs=require(_0x2edf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2edf('0x14'));var logger=require(_0x2edf('0x15'))(_0x2edf('0x16'));var utils=require(_0x2edf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2edf('0x18'));var db=require(_0x2edf('0x19'))['db'];function respondWithStatusCode(_0x58b1d4,_0x2d7789){_0x2d7789=_0x2d7789||0xcc;return function(_0x20b671){if(_0x20b671){return _0x58b1d4[_0x2edf('0x1a')](_0x2d7789);}return _0x58b1d4[_0x2edf('0x1b')](_0x2d7789)[_0x2edf('0x1c')]();};}function respondWithResult(_0x3534cc,_0xec05ef){_0xec05ef=_0xec05ef||0xc8;return function(_0xd60f38){if(_0xd60f38){return _0x3534cc[_0x2edf('0x1b')](_0xec05ef)['json'](_0xd60f38);}};}function respondWithFilteredResult(_0x49c582,_0x49b25d){return function(_0x46e548){if(_0x46e548){var _0x10e8bc=typeof _0x49b25d['offset']===_0x2edf('0x1d')&&typeof _0x49b25d[_0x2edf('0x1e')]===_0x2edf('0x1d');var _0x142944=_0x46e548[_0x2edf('0x1f')];var _0x16a015=_0x10e8bc?0x0:_0x49b25d[_0x2edf('0x20')];var _0x178ad9=_0x10e8bc?_0x46e548[_0x2edf('0x1f')]:_0x49b25d[_0x2edf('0x20')]+_0x49b25d[_0x2edf('0x1e')];var _0x2434f8;if(_0x178ad9>=_0x142944){_0x178ad9=_0x142944;_0x2434f8=0xc8;}else{_0x2434f8=0xce;}_0x49c582[_0x2edf('0x1b')](_0x2434f8);return _0x49c582['set'](_0x2edf('0x21'),_0x16a015+'-'+_0x178ad9+'/'+_0x142944)[_0x2edf('0x22')](_0x46e548);}return null;};}function patchUpdates(_0x186252){return function(_0x350e73){try{jsonpatch['apply'](_0x350e73,_0x186252,!![]);}catch(_0x2819a1){return BPromise['reject'](_0x2819a1);}return _0x350e73[_0x2edf('0x23')]();};}function saveUpdates(_0x5a540d,_0x3aa141){return function(_0x216481){if(_0x216481){return _0x216481[_0x2edf('0x24')](_0x5a540d)[_0x2edf('0x25')](function(_0x4d73aa){return _0x4d73aa;});}return null;};}function removeEntity(_0x1a95e2,_0x4dbafd){return function(_0x1e37ed){if(_0x1e37ed){return _0x1e37ed[_0x2edf('0x26')]()[_0x2edf('0x25')](function(){_0x1a95e2[_0x2edf('0x1b')](0xcc)[_0x2edf('0x1c')]();});}};}function handleEntityNotFound(_0xe693db,_0x42dcdb){return function(_0x266888){if(!_0x266888){_0xe693db[_0x2edf('0x1a')](0x194);}return _0x266888;};}function handleError(_0x2f1532,_0x16524){_0x16524=_0x16524||0x1f4;return function(_0x512558){logger['error'](_0x512558[_0x2edf('0x27')]);if(_0x512558[_0x2edf('0x28')]){delete _0x512558['name'];}_0x2f1532[_0x2edf('0x1b')](_0x16524)[_0x2edf('0x29')](_0x512558);};}exports[_0x2edf('0x2a')]=function(_0x1cb383,_0x4e1173){var _0x5b5206={},_0x585f28={},_0x5f1ae3={'count':0x0,'rows':[]};var _0x153508=_[_0x2edf('0x2b')](db[_0x2edf('0x2c')][_0x2edf('0x2d')],function(_0x43e026){return{'name':_0x43e026['fieldName'],'type':_0x43e026[_0x2edf('0x2e')][_0x2edf('0x2f')]};});_0x585f28[_0x2edf('0x30')]=_[_0x2edf('0x31')](_[_0x2edf('0x2b')](_0x153508,'name'),[_0x2edf('0x28')]);_0x585f28[_0x2edf('0x32')]=_[_0x2edf('0x33')](_0x1cb383['query']);_0x585f28['filters']=_[_0x2edf('0x34')](_0x585f28[_0x2edf('0x30')],_0x585f28[_0x2edf('0x32')]);_0x5b5206[_0x2edf('0x35')]=_['intersection'](_0x585f28[_0x2edf('0x30')],qs[_0x2edf('0x36')](_0x1cb383['query'][_0x2edf('0x36')]));_0x5b5206[_0x2edf('0x35')]=_0x5b5206[_0x2edf('0x35')][_0x2edf('0x37')]?_0x5b5206[_0x2edf('0x35')]:_0x585f28[_0x2edf('0x30')];if(!_0x1cb383[_0x2edf('0x32')][_0x2edf('0x38')](_0x2edf('0x39'))){_0x5b5206[_0x2edf('0x1e')]=qs[_0x2edf('0x1e')](_0x1cb383[_0x2edf('0x32')][_0x2edf('0x1e')]);_0x5b5206['offset']=qs[_0x2edf('0x20')](_0x1cb383[_0x2edf('0x32')]['offset']);}_0x5b5206[_0x2edf('0x3a')]=qs[_0x2edf('0x3b')](_0x1cb383[_0x2edf('0x32')][_0x2edf('0x3b')]);_0x5b5206[_0x2edf('0x3c')]=qs[_0x2edf('0x3d')](_['pick'](_0x1cb383[_0x2edf('0x32')],_0x585f28[_0x2edf('0x3d')]),_0x153508);if(_0x1cb383[_0x2edf('0x32')][_0x2edf('0x3e')]){_0x5b5206['where']=_[_0x2edf('0x3f')](_0x5b5206['where'],{'$or':_['map'](_0x153508,function(_0x1104ff){if(_0x1104ff['type']!=='VIRTUAL'){var _0x332482={};_0x332482[_0x1104ff[_0x2edf('0x28')]]={'$like':'%'+_0x1cb383[_0x2edf('0x32')][_0x2edf('0x3e')]+'%'};return _0x332482;}})});}_0x5b5206=_[_0x2edf('0x3f')]({},_0x5b5206,_0x1cb383['options']);var _0x26bf00={'where':_0x5b5206['where']};return db[_0x2edf('0x2c')][_0x2edf('0x1f')](_0x26bf00)[_0x2edf('0x25')](function(_0x1e7271){_0x5f1ae3['count']=_0x1e7271;if(_0x1cb383[_0x2edf('0x32')]['includeAll']){_0x5b5206[_0x2edf('0x40')]=[{'all':!![]}];}return db[_0x2edf('0x2c')][_0x2edf('0x41')](_0x5b5206);})['then'](function(_0x54150b){_0x5f1ae3[_0x2edf('0x42')]=_0x54150b;return _0x5f1ae3;})['then'](respondWithFilteredResult(_0x4e1173,_0x5b5206))[_0x2edf('0x43')](handleError(_0x4e1173,null));};exports['show']=function(_0x8b5589,_0x512723){var _0x5984aa={'raw':!![],'where':{'id':_0x8b5589[_0x2edf('0x44')]['id']}},_0x544054={};_0x544054[_0x2edf('0x30')]=_[_0x2edf('0x33')](db[_0x2edf('0x2c')][_0x2edf('0x2d')]);_0x544054[_0x2edf('0x32')]=_[_0x2edf('0x33')](_0x8b5589[_0x2edf('0x32')]);_0x544054[_0x2edf('0x3d')]=_[_0x2edf('0x34')](_0x544054[_0x2edf('0x30')],_0x544054['query']);_0x5984aa[_0x2edf('0x35')]=_[_0x2edf('0x34')](_0x544054[_0x2edf('0x30')],qs['fields'](_0x8b5589[_0x2edf('0x32')][_0x2edf('0x36')]));_0x5984aa[_0x2edf('0x35')]=_0x5984aa[_0x2edf('0x35')][_0x2edf('0x37')]?_0x5984aa['attributes']:_0x544054[_0x2edf('0x30')];if(_0x8b5589[_0x2edf('0x32')][_0x2edf('0x45')]){_0x5984aa[_0x2edf('0x40')]=[{'all':!![]}];}_0x5984aa=_['merge']({},_0x5984aa,_0x8b5589[_0x2edf('0x46')]);return db['VoiceMailMessage'][_0x2edf('0x47')](_0x5984aa)[_0x2edf('0x25')](handleEntityNotFound(_0x512723,null))[_0x2edf('0x25')](respondWithResult(_0x512723,null))[_0x2edf('0x43')](handleError(_0x512723,null));};exports[_0x2edf('0x48')]=function(_0x195315,_0x2dbf41){return db[_0x2edf('0x2c')][_0x2edf('0x48')](_0x195315[_0x2edf('0x49')],{})[_0x2edf('0x25')](respondWithResult(_0x2dbf41,0xc9))[_0x2edf('0x43')](handleError(_0x2dbf41,null));};exports[_0x2edf('0x24')]=function(_0x110f13,_0x5a81ab){if(_0x110f13[_0x2edf('0x49')]['id']){delete _0x110f13[_0x2edf('0x49')]['id'];}return db[_0x2edf('0x2c')]['find']({'where':{'id':_0x110f13['params']['id']}})['then'](handleEntityNotFound(_0x5a81ab,null))['then'](saveUpdates(_0x110f13['body'],null))[_0x2edf('0x25')](respondWithResult(_0x5a81ab,null))[_0x2edf('0x43')](handleError(_0x5a81ab,null));};exports[_0x2edf('0x26')]=function(_0x3ce646,_0x1877bf){return db['VoiceMailMessage'][_0x2edf('0x47')]({'where':{'id':_0x3ce646['params']['id']}})['then'](handleEntityNotFound(_0x1877bf,null))[_0x2edf('0x25')](removeEntity(_0x1877bf,null))['catch'](handleError(_0x1877bf,null));};exports[_0x2edf('0x4a')]=function(_0x395df1,_0x460e8c,_0x3ed026){return db[_0x2edf('0x2c')][_0x2edf('0x47')]({'where':{'id':_0x395df1[_0x2edf('0x44')]['id']},'attributes':['id','recording','msg_id']})['then'](handleEntityNotFound(_0x460e8c,null))[_0x2edf('0x25')](function(_0x17f72f){if(_0x17f72f){if(!_0x17f72f[_0x2edf('0x4b')]){throw new db[(_0x2edf('0x4c'))]['ValidationError'](_0x2edf('0x4d'));}var _0x494d1d={'Content-Type':_0x2edf('0x4e'),'Content-Disposition':_0x2edf('0x4f')};if(_0x17f72f[_0x2edf('0x50')]){_0x494d1d[_0x2edf('0x51')]=_0x2edf('0x52')+_0x17f72f[_0x2edf('0x50')]+_0x2edf('0x53');}_0x460e8c[_0x2edf('0x54')](_0x494d1d);return _0x460e8c[_0x2edf('0x29')](new Buffer(_0x17f72f[_0x2edf('0x4b')]));}})[_0x2edf('0x43')](handleError(_0x460e8c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 9d3dfc6..1149b84 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 _0x9551=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x4e9d7e,_0x3ee91d){var _0x56d7a5=function(_0x8c3157){while(--_0x8c3157){_0x4e9d7e['push'](_0x4e9d7e['shift']());}};_0x56d7a5(++_0x3ee91d);}(_0x9551,0x1db));var _0x1955=function(_0x209f9c,_0x4ea385){_0x209f9c=_0x209f9c-0x0;var _0x13c1ef=_0x9551[_0x209f9c];return _0x13c1ef;};'use strict';var _=require(_0x1955('0x0'));var util=require(_0x1955('0x1'));var logger=require(_0x1955('0x2'))(_0x1955('0x3'));var moment=require(_0x1955('0x4'));var BPromise=require(_0x1955('0x5'));var rp=require(_0x1955('0x6'));var fs=require('fs');var path=require(_0x1955('0x7'));var rimraf=require(_0x1955('0x8'));var config=require(_0x1955('0x9'));var attributes=require('./voiceMailMessage.attributes');module[_0x1955('0xa')]=function(_0x6c59de,_0x42d584){return _0x6c59de[_0x1955('0xb')](_0x1955('0xc'),attributes,{'tableName':_0x1955('0xd'),'paranoid':![],'indexes':[{'name':_0x1955('0xe'),'fields':[_0x1955('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5c11=['request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','util','../../config/logger','api','moment','bluebird'];(function(_0x5ba87c,_0x3cce02){var _0x1ddb7e=function(_0x3e196c){while(--_0x3e196c){_0x5ba87c['push'](_0x5ba87c['shift']());}};_0x1ddb7e(++_0x3cce02);}(_0x5c11,0xb1));var _0x15c1=function(_0x8036e9,_0xb2a199){_0x8036e9=_0x8036e9-0x0;var _0x34a8eb=_0x5c11[_0x8036e9];return _0x34a8eb;};'use strict';var _=require('lodash');var util=require(_0x15c1('0x0'));var logger=require(_0x15c1('0x1'))(_0x15c1('0x2'));var moment=require(_0x15c1('0x3'));var BPromise=require(_0x15c1('0x4'));var rp=require(_0x15c1('0x5'));var fs=require('fs');var path=require(_0x15c1('0x6'));var rimraf=require(_0x15c1('0x7'));var config=require('../../config/environment');var attributes=require(_0x15c1('0x8'));module[_0x15c1('0x9')]=function(_0xa98fdb,_0x356e58){return _0xa98fdb[_0x15c1('0xa')](_0x15c1('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x15c1('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f7bb40c..9b23adf 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 _0xea05=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xea05,0x102));var _0x5ea0=function(_0x3afd71,_0x25ab3f){_0x3afd71=_0x3afd71-0x0;var _0x2624b5=_0xea05[_0x3afd71];return _0x2624b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ea0('0x0'));var BPromise=require(_0x5ea0('0x1'));var rs=require(_0x5ea0('0x2'));var fs=require('fs');var Redis=require(_0x5ea0('0x3'));var db=require(_0x5ea0('0x4'))['db'];var utils=require(_0x5ea0('0x5'));var logger=require(_0x5ea0('0x6'))(_0x5ea0('0x7'));var config=require(_0x5ea0('0x8'));var jayson=require(_0x5ea0('0x9'));var client=jayson['client'][_0x5ea0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c081a,_0xd88347,_0x2cd47d){return new BPromise(function(_0x4b97f7,_0x1cee6e){return client[_0x5ea0('0xb')](_0x3c081a,_0x2cd47d)[_0x5ea0('0xc')](function(_0x4474f7){logger[_0x5ea0('0xd')](_0x5ea0('0xe'),_0xd88347,_0x5ea0('0xf'));logger['debug'](_0x5ea0('0x10'),_0xd88347,_0x5ea0('0xf'),JSON[_0x5ea0('0x11')](_0x4474f7));if(_0x4474f7['error']){if(_0x4474f7['error']['code']===0x1f4){logger[_0x5ea0('0x12')](_0x5ea0('0xe'),_0xd88347,_0x4474f7[_0x5ea0('0x12')][_0x5ea0('0x13')]);return _0x1cee6e(_0x4474f7[_0x5ea0('0x12')][_0x5ea0('0x13')]);}logger[_0x5ea0('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0xd88347,_0x4474f7[_0x5ea0('0x12')]['message']);return _0x4b97f7(_0x4474f7[_0x5ea0('0x12')][_0x5ea0('0x13')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0xd88347,_0x5ea0('0xf'));_0x4b97f7(_0x4474f7[_0x5ea0('0x14')]['message']);}})[_0x5ea0('0x15')](function(_0x154931){logger[_0x5ea0('0x12')](_0x5ea0('0xe'),_0xd88347,_0x154931);_0x1cee6e(_0x154931);});});} \ No newline at end of file +var _0xbc71=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0xbc71,0x1bc));var _0x1bc7=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xbc71[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x1bc7('0x0'));var util=require(_0x1bc7('0x1'));var moment=require(_0x1bc7('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bc7('0x3'));var fs=require('fs');var Redis=require(_0x1bc7('0x4'));var db=require(_0x1bc7('0x5'))['db'];var utils=require(_0x1bc7('0x6'));var logger=require(_0x1bc7('0x7'))('rpc');var config=require(_0x1bc7('0x8'));var jayson=require(_0x1bc7('0x9'));var client=jayson[_0x1bc7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f34cc,_0x17eb8f,_0x3532ef){return new BPromise(function(_0x5c0303,_0x6974c8){return client['request'](_0x4f34cc,_0x3532ef)[_0x1bc7('0xb')](function(_0x134afb){logger[_0x1bc7('0xc')](_0x1bc7('0xd'),_0x17eb8f,_0x1bc7('0xe'));logger['debug'](_0x1bc7('0xf'),_0x17eb8f,_0x1bc7('0xe'),JSON['stringify'](_0x134afb));if(_0x134afb[_0x1bc7('0x10')]){if(_0x134afb['error'][_0x1bc7('0x11')]===0x1f4){logger['error'](_0x1bc7('0xd'),_0x17eb8f,_0x134afb['error'][_0x1bc7('0x12')]);return _0x6974c8(_0x134afb['error']['message']);}logger[_0x1bc7('0x10')](_0x1bc7('0xd'),_0x17eb8f,_0x134afb['error']['message']);return _0x5c0303(_0x134afb['error'][_0x1bc7('0x12')]);}else{logger[_0x1bc7('0xc')](_0x1bc7('0xd'),_0x17eb8f,_0x1bc7('0xe'));_0x5c0303(_0x134afb[_0x1bc7('0x13')][_0x1bc7('0x12')]);}})[_0x1bc7('0x14')](function(_0x396e27){logger[_0x1bc7('0x10')](_0x1bc7('0xd'),_0x17eb8f,_0x396e27);_0x6974c8(_0x396e27);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 975dba3..912a090 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 _0x966c=['create','addSound','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','/:id/sounds','getSounds','post'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x966c,0x1d1));var _0xc966=function(_0x3261de,_0x3cc819){_0x3261de=_0x3261de-0x0;var _0x3d9872=_0x966c[_0x3261de];return _0x3d9872;};'use strict';var multer=require(_0xc966('0x0'));var util=require(_0xc966('0x1'));var path=require(_0xc966('0x2'));var timeout=require(_0xc966('0x3'));var express=require(_0xc966('0x4'));var router=express[_0xc966('0x5')]();var fs_extra=require(_0xc966('0x6'));var auth=require(_0xc966('0x7'));var interaction=require(_0xc966('0x8'));var config=require(_0xc966('0x9'));var controller=require(_0xc966('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xc966('0xb')]);router[_0xc966('0xc')](_0xc966('0xd'),auth[_0xc966('0xe')](),controller['show']);router[_0xc966('0xc')](_0xc966('0xf'),auth[_0xc966('0xe')](),controller[_0xc966('0x10')]);router[_0xc966('0x11')]('/',auth[_0xc966('0xe')](),controller[_0xc966('0x12')]);router[_0xc966('0x11')](_0xc966('0xf'),auth[_0xc966('0xe')](),controller[_0xc966('0x13')]);router['put'](_0xc966('0xd'),auth['isAuthenticated'](),controller[_0xc966('0x14')]);router[_0xc966('0x15')](_0xc966('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc966('0x15')]('/:id/sounds/:id2',auth[_0xc966('0xe')](),controller['removeSound']);module[_0xc966('0x16')]=router; \ No newline at end of file +var _0x36b6=['get','index','/:id','isAuthenticated','show','/:id/sounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x14afab,_0x1bd101){var _0x31ba9f=function(_0x2f7ee6){while(--_0x2f7ee6){_0x14afab['push'](_0x14afab['shift']());}};_0x31ba9f(++_0x1bd101);}(_0x36b6,0x159));var _0x636b=function(_0xff2639,_0x2fa99c){_0xff2639=_0xff2639-0x0;var _0x54334c=_0x36b6[_0xff2639];return _0x54334c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x636b('0x0'));var router=express[_0x636b('0x1')]();var fs_extra=require(_0x636b('0x2'));var auth=require(_0x636b('0x3'));var interaction=require(_0x636b('0x4'));var config=require(_0x636b('0x5'));var controller=require(_0x636b('0x6'));router[_0x636b('0x7')]('/',auth['isAuthenticated'](),controller[_0x636b('0x8')]);router[_0x636b('0x7')](_0x636b('0x9'),auth[_0x636b('0xa')](),controller[_0x636b('0xb')]);router[_0x636b('0x7')](_0x636b('0xc'),auth[_0x636b('0xa')](),controller['getSounds']);router[_0x636b('0xd')]('/',auth['isAuthenticated'](),controller[_0x636b('0xe')]);router[_0x636b('0xd')](_0x636b('0xc'),auth[_0x636b('0xa')](),controller[_0x636b('0xf')]);router[_0x636b('0x10')]('/:id',auth[_0x636b('0xa')](),controller['update']);router[_0x636b('0x11')](_0x636b('0x9'),auth[_0x636b('0xa')](),controller[_0x636b('0x12')]);router['delete'](_0x636b('0x13'),auth[_0x636b('0xa')](),controller[_0x636b('0x14')]);module[_0x636b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5197e80..0ee7af2 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 _0x54e5=['ENUM','custom','mp3nb','quietmp3nb','mp3','files','BOOLEAN','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54e5,0x1d3));var _0x554e=function(_0x101d5b,_0x40cfd){_0x101d5b=_0x101d5b-0x0;var _0x382a50=_0x54e5[_0x101d5b];return _0x382a50;};'use strict';var Sequelize=require('sequelize');module[_0x554e('0x0')]={'name':{'type':Sequelize[_0x554e('0x1')],'allowNull':![],'unique':_0x554e('0x2')},'mode':{'type':Sequelize[_0x554e('0x3')](_0x554e('0x4'),'files',_0x554e('0x5'),_0x554e('0x6'),'quietmp3',_0x554e('0x7')),'allowNull':!![],'defaultValue':_0x554e('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x554e('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x554e('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x554e('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x554e('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x554e('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd560=['files','STRING','alpha','BOOLEAN','sequelize','exports','custom'];(function(_0x1ae673,_0x568d61){var _0x433cc6=function(_0x12f18f){while(--_0x12f18f){_0x1ae673['push'](_0x1ae673['shift']());}};_0x433cc6(++_0x568d61);}(_0xd560,0xba));var _0x0d56=function(_0x3c0c62,_0x57ba75){_0x3c0c62=_0x3c0c62-0x0;var _0x298b1f=_0xd560[_0x3c0c62];return _0x298b1f;};'use strict';var Sequelize=require(_0x0d56('0x0'));module[_0x0d56('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x0d56('0x2'),_0x0d56('0x3'),'mp3nb','quietmp3nb','quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x0d56('0x3')},'directory':{'type':Sequelize[_0x0d56('0x4')],'allowNull':!![]},'application':{'type':Sequelize[_0x0d56('0x4')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x0d56('0x4')],'allowNull':!![],'defaultValue':_0x0d56('0x5')},'format':{'type':Sequelize[_0x0d56('0x4')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x0d56('0x6')],'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 33bc938..3cb57c0 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 _0xfca7=['message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','ValidationError','removeSound','findOne','id2','getSounds','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','sequelize','transaction','mode','join','root','server/files/moh','create','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','Sequelize'];(function(_0x581e7d,_0x125495){var _0x58d2b1=function(_0xe544e3){while(--_0xe544e3){_0x581e7d['push'](_0x581e7d['shift']());}};_0x58d2b1(++_0x125495);}(_0xfca7,0x1c3));var _0x7fca=function(_0x41e45d,_0x1ee3b0){_0x41e45d=_0x41e45d-0x0;var _0x4d3aac=_0xfca7[_0x41e45d];return _0x4d3aac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fca('0x0'));var zipdir=require(_0x7fca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7fca('0x2'));var BPromise=require(_0x7fca('0x3'));var Mustache=require(_0x7fca('0x4'));var util=require(_0x7fca('0x5'));var path=require('path');var sox=require(_0x7fca('0x6'));var csv=require(_0x7fca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fca('0x8'));var _=require(_0x7fca('0x9'));var squel=require('squel');var crypto=require(_0x7fca('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7fca('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7fca('0xc'));var Redis=require(_0x7fca('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7fca('0xe'));var as=require(_0x7fca('0xf'));var hardwareService=require(_0x7fca('0x10'));var logger=require(_0x7fca('0x11'))('api');var utils=require(_0x7fca('0x12'));var config=require(_0x7fca('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x570818,_0x4016b6){_0x4016b6=_0x4016b6||0xcc;return function(_0x5791db){if(_0x5791db){return _0x570818[_0x7fca('0x14')](_0x4016b6);}return _0x570818[_0x7fca('0x15')](_0x4016b6)[_0x7fca('0x16')]();};}function respondWithResult(_0xdc0b8b,_0x55927b){_0x55927b=_0x55927b||0xc8;return function(_0x5d5361){if(_0x5d5361){return _0xdc0b8b[_0x7fca('0x15')](_0x55927b)[_0x7fca('0x17')](_0x5d5361);}};}function respondWithFilteredResult(_0x3f318e,_0x448cda){return function(_0x22c5e5){if(_0x22c5e5){var _0x4d468d=typeof _0x448cda[_0x7fca('0x18')]==='undefined'&&typeof _0x448cda[_0x7fca('0x19')]===_0x7fca('0x1a');var _0x5c616c=_0x22c5e5['count'];var _0x23f527=_0x4d468d?0x0:_0x448cda[_0x7fca('0x18')];var _0x5e4e4b=_0x4d468d?_0x22c5e5[_0x7fca('0x1b')]:_0x448cda[_0x7fca('0x18')]+_0x448cda[_0x7fca('0x19')];var _0x3a0734;if(_0x5e4e4b>=_0x5c616c){_0x5e4e4b=_0x5c616c;_0x3a0734=0xc8;}else{_0x3a0734=0xce;}_0x3f318e[_0x7fca('0x15')](_0x3a0734);return _0x3f318e[_0x7fca('0x1c')](_0x7fca('0x1d'),_0x23f527+'-'+_0x5e4e4b+'/'+_0x5c616c)[_0x7fca('0x17')](_0x22c5e5);}return null;};}function patchUpdates(_0x1de355){return function(_0x1829a0){try{jsonpatch[_0x7fca('0x1e')](_0x1829a0,_0x1de355,!![]);}catch(_0xf91803){return BPromise[_0x7fca('0x1f')](_0xf91803);}return _0x1829a0[_0x7fca('0x20')]();};}function saveUpdates(_0x4f3231,_0x18d58c){return function(_0x109e6c){if(_0x109e6c){return _0x109e6c[_0x7fca('0x21')](_0x4f3231)[_0x7fca('0x22')](function(_0x10d334){return _0x10d334;});}return null;};}function removeEntity(_0x5f3b2c,_0xb64b56){return function(_0x711cf4){if(_0x711cf4){return _0x711cf4[_0x7fca('0x23')]()[_0x7fca('0x22')](function(){var _0x1c3c24=_0x711cf4['get']({'plain':!![]});var _0x4addc5=_0x7fca('0x24');return db[_0x7fca('0x25')][_0x7fca('0x23')]({'where':{'type':_0x4addc5,'resourceId':_0x1c3c24['id']}})[_0x7fca('0x22')](function(){return _0x711cf4;});})['then'](function(){_0x5f3b2c[_0x7fca('0x15')](0xcc)[_0x7fca('0x16')]();});}};}function handleEntityNotFound(_0x3d5c6c,_0x48d090){return function(_0x4e2c64){if(!_0x4e2c64){_0x3d5c6c[_0x7fca('0x14')](0x194);}return _0x4e2c64;};}function handleError(_0x34563d,_0x5e5e03){_0x5e5e03=_0x5e5e03||0x1f4;return function(_0x2ebce2){logger[_0x7fca('0x26')](_0x2ebce2[_0x7fca('0x27')]);if(_0x2ebce2[_0x7fca('0x28')]){delete _0x2ebce2['name'];}_0x34563d['status'](_0x5e5e03)['send'](_0x2ebce2);};}exports[_0x7fca('0x29')]=function(_0x2d0503,_0x45f458){var _0x3fe356={},_0x302023={},_0x4485d9={'count':0x0,'rows':[]};var _0x2cb021=_[_0x7fca('0x2a')](db[_0x7fca('0x2b')][_0x7fca('0x2c')],function(_0x22195e){return{'name':_0x22195e['fieldName'],'type':_0x22195e[_0x7fca('0x2d')][_0x7fca('0x2e')]};});_0x302023['model']=_[_0x7fca('0x2a')](_0x2cb021,_0x7fca('0x28'));_0x302023[_0x7fca('0x2f')]=_[_0x7fca('0x30')](_0x2d0503[_0x7fca('0x2f')]);_0x302023['filters']=_[_0x7fca('0x31')](_0x302023['model'],_0x302023['query']);_0x3fe356[_0x7fca('0x32')]=_[_0x7fca('0x31')](_0x302023[_0x7fca('0x33')],qs[_0x7fca('0x34')](_0x2d0503[_0x7fca('0x2f')][_0x7fca('0x34')]));_0x3fe356['attributes']=_0x3fe356[_0x7fca('0x32')][_0x7fca('0x35')]?_0x3fe356['attributes']:_0x302023[_0x7fca('0x33')];if(!_0x2d0503[_0x7fca('0x2f')][_0x7fca('0x36')](_0x7fca('0x37'))){_0x3fe356[_0x7fca('0x19')]=qs['limit'](_0x2d0503[_0x7fca('0x2f')]['limit']);_0x3fe356['offset']=qs['offset'](_0x2d0503['query'][_0x7fca('0x18')]);}_0x3fe356[_0x7fca('0x38')]=qs[_0x7fca('0x39')](_0x2d0503[_0x7fca('0x2f')][_0x7fca('0x39')]);delete _0x2d0503[_0x7fca('0x2f')][_0x7fca('0x39')];_0x3fe356[_0x7fca('0x3a')]=qs[_0x7fca('0x3b')](_[_0x7fca('0x3c')](_0x2d0503[_0x7fca('0x2f')],_0x302023['filters']),_0x2cb021);if(_0x2d0503[_0x7fca('0x2f')][_0x7fca('0x3d')]){_0x3fe356[_0x7fca('0x3a')]=_[_0x7fca('0x3e')](_0x3fe356[_0x7fca('0x3a')],{'$or':_[_0x7fca('0x2a')](_0x2cb021,function(_0xa3c4b){if(_0xa3c4b['type']!==_0x7fca('0x3f')){var _0x463ca0={};_0x463ca0[_0xa3c4b[_0x7fca('0x28')]]={'$like':'%'+_0x2d0503[_0x7fca('0x2f')]['filter']+'%'};return _0x463ca0;}})});}_0x3fe356=_['merge']({},_0x3fe356,_0x2d0503[_0x7fca('0x40')]);var _0x3c52fe={'where':_0x3fe356[_0x7fca('0x3a')]};return db[_0x7fca('0x2b')][_0x7fca('0x1b')](_0x3c52fe)[_0x7fca('0x22')](function(_0x2354a6){_0x4485d9[_0x7fca('0x1b')]=_0x2354a6;if(_0x2d0503[_0x7fca('0x2f')][_0x7fca('0x41')]){_0x3fe356[_0x7fca('0x42')]=[{'all':!![]}];}return db[_0x7fca('0x2b')]['findAll'](_0x3fe356);})['then'](function(_0x44de09){_0x4485d9[_0x7fca('0x43')]=_0x44de09;return _0x4485d9;})[_0x7fca('0x22')](respondWithFilteredResult(_0x45f458,_0x3fe356))[_0x7fca('0x44')](handleError(_0x45f458,null));};exports[_0x7fca('0x45')]=function(_0x1c3868,_0x9d6297){var _0x202c01={'raw':![],'where':{'id':_0x1c3868[_0x7fca('0x46')]['id']}},_0x480845={};_0x480845[_0x7fca('0x33')]=_[_0x7fca('0x30')](db[_0x7fca('0x2b')][_0x7fca('0x2c')]);_0x480845[_0x7fca('0x2f')]=_[_0x7fca('0x30')](_0x1c3868['query']);_0x480845[_0x7fca('0x3b')]=_[_0x7fca('0x31')](_0x480845[_0x7fca('0x33')],_0x480845[_0x7fca('0x2f')]);_0x202c01[_0x7fca('0x32')]=_[_0x7fca('0x31')](_0x480845[_0x7fca('0x33')],qs['fields'](_0x1c3868[_0x7fca('0x2f')][_0x7fca('0x34')]));_0x202c01[_0x7fca('0x32')]=_0x202c01[_0x7fca('0x32')][_0x7fca('0x35')]?_0x202c01['attributes']:_0x480845['model'];if(_0x1c3868[_0x7fca('0x2f')]['includeAll']){_0x202c01['include']=[{'all':!![]}];}_0x202c01=_[_0x7fca('0x3e')]({},_0x202c01,_0x1c3868[_0x7fca('0x40')]);return db[_0x7fca('0x2b')][_0x7fca('0x47')](_0x202c01)[_0x7fca('0x22')](handleEntityNotFound(_0x9d6297,null))['then'](respondWithResult(_0x9d6297,null))['catch'](handleError(_0x9d6297,null));};exports[_0x7fca('0x21')]=function(_0x3eab76,_0x2d7418){if(_0x3eab76[_0x7fca('0x48')]['id']){delete _0x3eab76[_0x7fca('0x48')]['id'];}return db[_0x7fca('0x2b')][_0x7fca('0x47')]({'where':{'id':_0x3eab76[_0x7fca('0x46')]['id']}})[_0x7fca('0x22')](handleEntityNotFound(_0x2d7418,null))[_0x7fca('0x22')](saveUpdates(_0x3eab76['body'],null))[_0x7fca('0x22')](respondWithResult(_0x2d7418,null))[_0x7fca('0x44')](handleError(_0x2d7418,null));};exports['create']=function(_0x3599b0,_0x29d7dc,_0x18e3ba){return db[_0x7fca('0x49')][_0x7fca('0x4a')](function(_0xe0844d){if(_0x3599b0[_0x7fca('0x48')][_0x7fca('0x4b')]==='files'){_0x3599b0['body']['directory']=path[_0x7fca('0x4c')](config[_0x7fca('0x4d')],_0x7fca('0x4e'),_0x3599b0[_0x7fca('0x48')][_0x7fca('0x28')]);}return db['VoiceMusicOnHold'][_0x7fca('0x4f')](_0x3599b0[_0x7fca('0x48')],{'transaction':_0xe0844d})[_0x7fca('0x22')](function(_0x241da7){if(_0x3599b0[_0x7fca('0x48')][_0x7fca('0x4b')]==='files'){fs[_0x7fca('0x50')](_0x241da7[_0x7fca('0x51')],parseInt(_0x7fca('0x52'),0x8));}var _0x50d6d5=_0x3599b0[_0x7fca('0x53')][_0x7fca('0x54')]({'plain':!![]});if(!_0x50d6d5)throw new Error(_0x7fca('0x55'));if(_0x50d6d5[_0x7fca('0x56')]===_0x7fca('0x53')){var _0x52b255=_0x241da7[_0x7fca('0x54')]({'plain':!![]});return db[_0x7fca('0x57')][_0x7fca('0x47')]({'where':{'name':_0x7fca('0x24'),'userProfileId':_0x50d6d5['userProfileId']},'raw':!![]})[_0x7fca('0x22')](function(_0x2f6a17){if(_0x2f6a17&&_0x2f6a17[_0x7fca('0x58')]===0x0){return db[_0x7fca('0x25')][_0x7fca('0x4f')]({'name':_0x52b255[_0x7fca('0x28')],'resourceId':_0x52b255['id'],'type':_0x2f6a17[_0x7fca('0x28')],'sectionId':_0x2f6a17['id']},{})['then'](function(){return _0x241da7;});}else{return _0x241da7;}})[_0x7fca('0x44')](function(_0x3310d8){logger[_0x7fca('0x26')](_0x7fca('0x59'),_0x3310d8);});}return _0x241da7;});})[_0x7fca('0x22')](respondWithResult(_0x29d7dc,0xc9))[_0x7fca('0x44')](handleError(_0x29d7dc,null));};exports[_0x7fca('0x23')]=function(_0x4fb1c6,_0x40d36e,_0x571922){var _0x38f11b;return db[_0x7fca('0x2b')][_0x7fca('0x47')]({'where':{'id':_0x4fb1c6['params']['id']}})['then'](function(_0x52be56){if(_0x52be56){return db[_0x7fca('0x49')][_0x7fca('0x4a')](function(_0x41d29b){return _0x52be56['destroy']({'transaction':_0x41d29b,'raw':!![]})[_0x7fca('0x22')](function(_0x166b21){if(_0x166b21[_0x7fca('0x51')]){fs['readdirSync'](_0x166b21['directory'])[_0x7fca('0x5a')](function(_0x23405f){fs[_0x7fca('0x5b')](path[_0x7fca('0x4c')](_0x166b21[_0x7fca('0x51')],_0x23405f));});fs[_0x7fca('0x5c')](_0x166b21[_0x7fca('0x51')]);}return _0x166b21;});})[_0x7fca('0x44')](function(_0x157ed4){throw new db[(_0x7fca('0x5d'))]['ValidationError'](_0x157ed4[_0x7fca('0x5e')]);});}})[_0x7fca('0x22')](handleEntityNotFound(_0x40d36e,null))[_0x7fca('0x22')](removeEntity(_0x40d36e,null))['catch'](handleError(_0x40d36e,null));};exports[_0x7fca('0x5f')]=function(_0x1fbb43,_0x5d09cf,_0x3d7118){return db[_0x7fca('0x49')]['transaction'](function(_0x270d3e){var _0x40cf7e;return db[_0x7fca('0x2b')][_0x7fca('0x47')]({'where':{'id':_0x1fbb43['params']['id']}})[_0x7fca('0x22')](function(_0x1ddaf6){if(_0x1ddaf6){_0x40cf7e=_0x1ddaf6;return _0x1ddaf6['addSound'](_0x1fbb43[_0x7fca('0x48')]['id'],{'transaction':_0x270d3e});}})[_0x7fca('0x22')](function(_0x268626){if(_0x268626){return db[_0x7fca('0x60')]['findOne']({'where':{'id':_0x1fbb43[_0x7fca('0x48')]['id']},'attributes':['id','name',_0x7fca('0x61'),_0x7fca('0x62'),_0x7fca('0x63')],'raw':!![]});}})['then'](function(_0x1e28c4){if(_0x1e28c4){var _0x1df91c=path[_0x7fca('0x4c')](config[_0x7fca('0x4d')],_0x7fca('0x64'),util[_0x7fca('0x65')](_0x7fca('0x66'),path[_0x7fca('0x67')](_0x1e28c4[_0x7fca('0x61')],path['extname'](_0x1e28c4[_0x7fca('0x61')])),_0x1e28c4[_0x7fca('0x62')]));var _0x5acf23=path[_0x7fca('0x4c')](config[_0x7fca('0x4d')],'server/files/moh',_0x40cf7e['name'],util['format'](_0x7fca('0x66'),_0x1e28c4[_0x7fca('0x28')],_0x1e28c4[_0x7fca('0x62')]));fs['symlinkSync'](_0x1df91c,_0x5acf23);return _0x1e28c4;}})[_0x7fca('0x44')](function(_0x14c0db){throw new db[(_0x7fca('0x5d'))][(_0x7fca('0x68'))](_0x14c0db['message']);});})[_0x7fca('0x22')](handleEntityNotFound(_0x5d09cf,null))[_0x7fca('0x22')](respondWithResult(_0x5d09cf,0xc9))['catch'](handleError(_0x5d09cf,null));};exports[_0x7fca('0x69')]=function(_0x6163f,_0x2fb5f4,_0x122b60){return db[_0x7fca('0x49')][_0x7fca('0x4a')](function(_0xaddb72){var _0x30ebb5;return db['VoiceMusicOnHold'][_0x7fca('0x6a')]({'where':{'id':_0x6163f['params']['id']}})[_0x7fca('0x22')](handleEntityNotFound(_0x2fb5f4,null))['then'](function(_0x4474f1){if(_0x4474f1){_0x30ebb5=_0x4474f1;return _0x4474f1[_0x7fca('0x69')](_0x6163f[_0x7fca('0x46')][_0x7fca('0x6b')]);}})['then'](function(_0x1ebfee){if(_0x1ebfee){return db[_0x7fca('0x60')][_0x7fca('0x6a')]({'where':{'id':_0x6163f[_0x7fca('0x46')]['id2']},'attributes':['id',_0x7fca('0x28'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0x7fca('0x22')](function(_0x3a8a9f){if(_0x3a8a9f){fs[_0x7fca('0x5b')](path[_0x7fca('0x4c')](_0x30ebb5[_0x7fca('0x51')],util['format']('%s.%s',_0x3a8a9f[_0x7fca('0x28')],_0x3a8a9f['converted_format'])));return _0x3a8a9f;}})['catch'](function(_0x27f5c8){throw new db[(_0x7fca('0x5d'))][(_0x7fca('0x68'))](_0x27f5c8['message']);});})['then'](handleEntityNotFound(_0x2fb5f4,null))[_0x7fca('0x22')](respondWithStatusCode(_0x2fb5f4,0xcc))[_0x7fca('0x44')](handleError(_0x2fb5f4,null));};exports[_0x7fca('0x6c')]=function(_0x47a0a9,_0x4824dc,_0x881aa6){var _0x383e7a={};var _0x319943={};var _0x41267f;var _0x4b76fc;return db[_0x7fca('0x2b')][_0x7fca('0x6a')]({'where':{'id':_0x47a0a9[_0x7fca('0x46')]['id']}})[_0x7fca('0x22')](handleEntityNotFound(_0x4824dc,null))['then'](function(_0x12c915){if(_0x12c915){_0x41267f=_0x12c915;_0x319943[_0x7fca('0x33')]=_[_0x7fca('0x30')](db[_0x7fca('0x60')][_0x7fca('0x2c')]);_0x319943['query']=_[_0x7fca('0x30')](_0x47a0a9['query']);_0x319943[_0x7fca('0x3b')]=_[_0x7fca('0x31')](_0x319943['model'],_0x319943[_0x7fca('0x2f')]);_0x383e7a[_0x7fca('0x32')]=_[_0x7fca('0x31')](_0x319943['model'],qs[_0x7fca('0x34')](_0x47a0a9[_0x7fca('0x2f')]['fields']));_0x383e7a[_0x7fca('0x32')]=_0x383e7a[_0x7fca('0x32')][_0x7fca('0x35')]?_0x383e7a[_0x7fca('0x32')]:_0x319943[_0x7fca('0x33')];_0x383e7a[_0x7fca('0x38')]=qs[_0x7fca('0x39')](_0x47a0a9[_0x7fca('0x2f')]['sort']);_0x383e7a['where']=qs[_0x7fca('0x3b')](_[_0x7fca('0x3c')](_0x47a0a9['query'],_0x319943[_0x7fca('0x3b')]));if(_0x47a0a9[_0x7fca('0x2f')][_0x7fca('0x3d')]){_0x383e7a['where']=_[_0x7fca('0x3e')](_0x383e7a[_0x7fca('0x3a')],{'$or':_[_0x7fca('0x2a')](_0x383e7a['attributes'],function(_0x40813b){var _0x53bc4b={};_0x53bc4b[_0x40813b]={'$like':'%'+_0x47a0a9[_0x7fca('0x2f')][_0x7fca('0x3d')]+'%'};return _0x53bc4b;})});}_0x383e7a=_[_0x7fca('0x3e')]({},_0x383e7a,_0x47a0a9[_0x7fca('0x40')]);return _0x41267f['getSounds'](_0x383e7a);}})[_0x7fca('0x22')](function(_0x312c70){if(_0x312c70){_0x4b76fc=_0x312c70[_0x7fca('0x35')];if(!_0x47a0a9[_0x7fca('0x2f')][_0x7fca('0x36')]('nolimit')){_0x383e7a['limit']=qs[_0x7fca('0x19')](_0x47a0a9['query'][_0x7fca('0x19')]);_0x383e7a[_0x7fca('0x18')]=qs[_0x7fca('0x18')](_0x47a0a9[_0x7fca('0x2f')]['offset']);}return _0x41267f['getSounds'](_0x383e7a);}})[_0x7fca('0x22')](function(_0x55abc6){if(_0x55abc6){return _0x55abc6?{'count':_0x4b76fc,'rows':_0x55abc6}:null;}})['then'](respondWithResult(_0x4824dc,null))['catch'](handleError(_0x4824dc,null));}; \ No newline at end of file +var _0x6dab=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','VoiceMusicOnHold','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','extname','symlinkSync','removeSound','id2','Sequelize','message','getSounds','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x6dab,0xc7));var _0xb6da=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x6dab[_0xd9c529];return _0x146760;};'use strict';var emlformat=require(_0xb6da('0x0'));var rimraf=require(_0xb6da('0x1'));var zipdir=require(_0xb6da('0x2'));var jsonpatch=require(_0xb6da('0x3'));var rp=require('request-promise');var moment=require(_0xb6da('0x4'));var BPromise=require(_0xb6da('0x5'));var Mustache=require(_0xb6da('0x6'));var util=require(_0xb6da('0x7'));var path=require(_0xb6da('0x8'));var sox=require(_0xb6da('0x9'));var csv=require(_0xb6da('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6da('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb6da('0xc'));var deskjs=require(_0xb6da('0xd'));var toCsv=require(_0xb6da('0xa'));var querystring=require('querystring');var Papa=require(_0xb6da('0xe'));var Redis=require(_0xb6da('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb6da('0x10'));var hardwareService=require(_0xb6da('0x11'));var logger=require(_0xb6da('0x12'))(_0xb6da('0x13'));var utils=require('../../config/utils');var config=require(_0xb6da('0x14'));var licenseUtil=require(_0xb6da('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9e6248,_0x4c3d83){_0x4c3d83=_0x4c3d83||0xcc;return function(_0x55a8e0){if(_0x55a8e0){return _0x9e6248[_0xb6da('0x16')](_0x4c3d83);}return _0x9e6248[_0xb6da('0x17')](_0x4c3d83)[_0xb6da('0x18')]();};}function respondWithResult(_0x254060,_0x281f9c){_0x281f9c=_0x281f9c||0xc8;return function(_0xd620e6){if(_0xd620e6){return _0x254060['status'](_0x281f9c)[_0xb6da('0x19')](_0xd620e6);}};}function respondWithFilteredResult(_0x4f30d2,_0x15286d){return function(_0x2add22){if(_0x2add22){var _0x120e70=typeof _0x15286d[_0xb6da('0x1a')]===_0xb6da('0x1b')&&typeof _0x15286d[_0xb6da('0x1c')]==='undefined';var _0x5243b2=_0x2add22[_0xb6da('0x1d')];var _0x4488de=_0x120e70?0x0:_0x15286d['offset'];var _0x520a08=_0x120e70?_0x2add22[_0xb6da('0x1d')]:_0x15286d[_0xb6da('0x1a')]+_0x15286d['limit'];var _0x24221c;if(_0x520a08>=_0x5243b2){_0x520a08=_0x5243b2;_0x24221c=0xc8;}else{_0x24221c=0xce;}_0x4f30d2[_0xb6da('0x17')](_0x24221c);return _0x4f30d2[_0xb6da('0x1e')](_0xb6da('0x1f'),_0x4488de+'-'+_0x520a08+'/'+_0x5243b2)[_0xb6da('0x19')](_0x2add22);}return null;};}function patchUpdates(_0x415518){return function(_0x87ffbb){try{jsonpatch[_0xb6da('0x20')](_0x87ffbb,_0x415518,!![]);}catch(_0xfcdb61){return BPromise[_0xb6da('0x21')](_0xfcdb61);}return _0x87ffbb[_0xb6da('0x22')]();};}function saveUpdates(_0x283133,_0x1eab7f){return function(_0x2f1515){if(_0x2f1515){return _0x2f1515[_0xb6da('0x23')](_0x283133)[_0xb6da('0x24')](function(_0x482f55){return _0x482f55;});}return null;};}function removeEntity(_0x63ff2d,_0x21fc10){return function(_0xea389c){if(_0xea389c){return _0xea389c[_0xb6da('0x25')]()[_0xb6da('0x24')](function(){var _0x3a11c9=_0xea389c[_0xb6da('0x26')]({'plain':!![]});var _0x37d656=_0xb6da('0x27');return db[_0xb6da('0x28')]['destroy']({'where':{'type':_0x37d656,'resourceId':_0x3a11c9['id']}})['then'](function(){return _0xea389c;});})[_0xb6da('0x24')](function(){_0x63ff2d[_0xb6da('0x17')](0xcc)[_0xb6da('0x18')]();});}};}function handleEntityNotFound(_0x2c3dfd,_0x51f464){return function(_0x111940){if(!_0x111940){_0x2c3dfd['sendStatus'](0x194);}return _0x111940;};}function handleError(_0x12f8f5,_0x4aed5c){_0x4aed5c=_0x4aed5c||0x1f4;return function(_0x1676be){logger[_0xb6da('0x29')](_0x1676be[_0xb6da('0x2a')]);if(_0x1676be['name']){delete _0x1676be[_0xb6da('0x2b')];}_0x12f8f5[_0xb6da('0x17')](_0x4aed5c)[_0xb6da('0x2c')](_0x1676be);};}exports['index']=function(_0x466731,_0x524364){var _0x4f1fdb={},_0x2b558f={},_0x218781={'count':0x0,'rows':[]};var _0x5d04cd=_['map'](db[_0xb6da('0x2d')][_0xb6da('0x2e')],function(_0x1f4a5b){return{'name':_0x1f4a5b['fieldName'],'type':_0x1f4a5b[_0xb6da('0x2f')][_0xb6da('0x30')]};});_0x2b558f[_0xb6da('0x31')]=_[_0xb6da('0x32')](_0x5d04cd,'name');_0x2b558f[_0xb6da('0x33')]=_[_0xb6da('0x34')](_0x466731[_0xb6da('0x33')]);_0x2b558f['filters']=_[_0xb6da('0x35')](_0x2b558f[_0xb6da('0x31')],_0x2b558f['query']);_0x4f1fdb[_0xb6da('0x36')]=_[_0xb6da('0x35')](_0x2b558f['model'],qs['fields'](_0x466731[_0xb6da('0x33')][_0xb6da('0x37')]));_0x4f1fdb[_0xb6da('0x36')]=_0x4f1fdb[_0xb6da('0x36')][_0xb6da('0x38')]?_0x4f1fdb[_0xb6da('0x36')]:_0x2b558f[_0xb6da('0x31')];if(!_0x466731[_0xb6da('0x33')]['hasOwnProperty']('nolimit')){_0x4f1fdb[_0xb6da('0x1c')]=qs[_0xb6da('0x1c')](_0x466731[_0xb6da('0x33')][_0xb6da('0x1c')]);_0x4f1fdb['offset']=qs[_0xb6da('0x1a')](_0x466731[_0xb6da('0x33')][_0xb6da('0x1a')]);}_0x4f1fdb[_0xb6da('0x39')]=qs[_0xb6da('0x3a')](_0x466731['query'][_0xb6da('0x3a')]);delete _0x466731[_0xb6da('0x33')][_0xb6da('0x3a')];_0x4f1fdb[_0xb6da('0x3b')]=qs['filters'](_[_0xb6da('0x3c')](_0x466731['query'],_0x2b558f[_0xb6da('0x3d')]),_0x5d04cd);if(_0x466731[_0xb6da('0x33')][_0xb6da('0x3e')]){_0x4f1fdb[_0xb6da('0x3b')]=_[_0xb6da('0x3f')](_0x4f1fdb[_0xb6da('0x3b')],{'$or':_[_0xb6da('0x32')](_0x5d04cd,function(_0x4d2deb){if(_0x4d2deb[_0xb6da('0x2f')]!=='VIRTUAL'){var _0x1a7630={};_0x1a7630[_0x4d2deb[_0xb6da('0x2b')]]={'$like':'%'+_0x466731[_0xb6da('0x33')]['filter']+'%'};return _0x1a7630;}})});}_0x4f1fdb=_['merge']({},_0x4f1fdb,_0x466731['options']);var _0x2bac98={'where':_0x4f1fdb[_0xb6da('0x3b')]};return db[_0xb6da('0x2d')][_0xb6da('0x1d')](_0x2bac98)[_0xb6da('0x24')](function(_0x2123b5){_0x218781['count']=_0x2123b5;if(_0x466731['query'][_0xb6da('0x40')]){_0x4f1fdb[_0xb6da('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xb6da('0x42')](_0x4f1fdb);})[_0xb6da('0x24')](function(_0x542223){_0x218781[_0xb6da('0x43')]=_0x542223;return _0x218781;})[_0xb6da('0x24')](respondWithFilteredResult(_0x524364,_0x4f1fdb))[_0xb6da('0x44')](handleError(_0x524364,null));};exports[_0xb6da('0x45')]=function(_0x1b0c6d,_0x524007){var _0x4e3abf={'raw':![],'where':{'id':_0x1b0c6d[_0xb6da('0x46')]['id']}},_0x1b7fea={};_0x1b7fea['model']=_['keys'](db[_0xb6da('0x2d')][_0xb6da('0x2e')]);_0x1b7fea[_0xb6da('0x33')]=_['keys'](_0x1b0c6d[_0xb6da('0x33')]);_0x1b7fea[_0xb6da('0x3d')]=_[_0xb6da('0x35')](_0x1b7fea[_0xb6da('0x31')],_0x1b7fea[_0xb6da('0x33')]);_0x4e3abf[_0xb6da('0x36')]=_[_0xb6da('0x35')](_0x1b7fea[_0xb6da('0x31')],qs[_0xb6da('0x37')](_0x1b0c6d[_0xb6da('0x33')][_0xb6da('0x37')]));_0x4e3abf['attributes']=_0x4e3abf['attributes'][_0xb6da('0x38')]?_0x4e3abf[_0xb6da('0x36')]:_0x1b7fea[_0xb6da('0x31')];if(_0x1b0c6d[_0xb6da('0x33')]['includeAll']){_0x4e3abf['include']=[{'all':!![]}];}_0x4e3abf=_[_0xb6da('0x3f')]({},_0x4e3abf,_0x1b0c6d[_0xb6da('0x47')]);return db[_0xb6da('0x2d')][_0xb6da('0x48')](_0x4e3abf)[_0xb6da('0x24')](handleEntityNotFound(_0x524007,null))[_0xb6da('0x24')](respondWithResult(_0x524007,null))[_0xb6da('0x44')](handleError(_0x524007,null));};exports[_0xb6da('0x23')]=function(_0x43e8c6,_0x268e0a){if(_0x43e8c6[_0xb6da('0x49')]['id']){delete _0x43e8c6[_0xb6da('0x49')]['id'];}return db[_0xb6da('0x2d')][_0xb6da('0x48')]({'where':{'id':_0x43e8c6['params']['id']}})['then'](handleEntityNotFound(_0x268e0a,null))['then'](saveUpdates(_0x43e8c6[_0xb6da('0x49')],null))[_0xb6da('0x24')](respondWithResult(_0x268e0a,null))[_0xb6da('0x44')](handleError(_0x268e0a,null));};exports[_0xb6da('0x4a')]=function(_0x569e8d,_0x5e979f,_0x3db3c0){return db[_0xb6da('0x4b')][_0xb6da('0x4c')](function(_0x108494){if(_0x569e8d[_0xb6da('0x49')]['mode']===_0xb6da('0x4d')){_0x569e8d[_0xb6da('0x49')][_0xb6da('0x4e')]=path[_0xb6da('0x4f')](config[_0xb6da('0x50')],_0xb6da('0x51'),_0x569e8d['body'][_0xb6da('0x2b')]);}return db[_0xb6da('0x2d')][_0xb6da('0x4a')](_0x569e8d[_0xb6da('0x49')],{'transaction':_0x108494})[_0xb6da('0x24')](function(_0x246c43){if(_0x569e8d[_0xb6da('0x49')][_0xb6da('0x52')]===_0xb6da('0x4d')){fs['mkdirSync'](_0x246c43[_0xb6da('0x4e')],parseInt(_0xb6da('0x53'),0x8));}var _0x4d5fbf=_0x569e8d[_0xb6da('0x54')][_0xb6da('0x26')]({'plain':!![]});if(!_0x4d5fbf)throw new Error(_0xb6da('0x55'));if(_0x4d5fbf[_0xb6da('0x56')]==='user'){var _0x4204ed=_0x246c43[_0xb6da('0x26')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x4d5fbf[_0xb6da('0x57')]},'raw':!![]})['then'](function(_0x84d069){if(_0x84d069&&_0x84d069[_0xb6da('0x58')]===0x0){return db[_0xb6da('0x28')]['create']({'name':_0x4204ed[_0xb6da('0x2b')],'resourceId':_0x4204ed['id'],'type':_0x84d069[_0xb6da('0x2b')],'sectionId':_0x84d069['id']},{})[_0xb6da('0x24')](function(){return _0x246c43;});}else{return _0x246c43;}})[_0xb6da('0x44')](function(_0x2f9647){logger['error'](_0xb6da('0x59'),_0x2f9647);});}return _0x246c43;});})[_0xb6da('0x24')](respondWithResult(_0x5e979f,0xc9))[_0xb6da('0x44')](handleError(_0x5e979f,null));};exports[_0xb6da('0x25')]=function(_0x43d97e,_0x2cd31a,_0xc33a1){var _0x3af55f;return db[_0xb6da('0x2d')][_0xb6da('0x48')]({'where':{'id':_0x43d97e[_0xb6da('0x46')]['id']}})[_0xb6da('0x24')](function(_0x4ef430){if(_0x4ef430){return db[_0xb6da('0x4b')][_0xb6da('0x4c')](function(_0x1c45e2){return _0x4ef430[_0xb6da('0x25')]({'transaction':_0x1c45e2,'raw':!![]})[_0xb6da('0x24')](function(_0x2606e1){if(_0x2606e1[_0xb6da('0x4e')]){fs['readdirSync'](_0x2606e1[_0xb6da('0x4e')])[_0xb6da('0x5a')](function(_0x2ca635){fs[_0xb6da('0x5b')](path['join'](_0x2606e1['directory'],_0x2ca635));});fs[_0xb6da('0x5c')](_0x2606e1[_0xb6da('0x4e')]);}return _0x2606e1;});})[_0xb6da('0x44')](function(_0x256f26){throw new db['Sequelize'][(_0xb6da('0x5d'))](_0x256f26['message']);});}})[_0xb6da('0x24')](handleEntityNotFound(_0x2cd31a,null))[_0xb6da('0x24')](removeEntity(_0x2cd31a,null))[_0xb6da('0x44')](handleError(_0x2cd31a,null));};exports['addSound']=function(_0x25eb1d,_0x49687d,_0x3c4076){return db[_0xb6da('0x4b')]['transaction'](function(_0x196253){var _0xb04820;return db['VoiceMusicOnHold'][_0xb6da('0x48')]({'where':{'id':_0x25eb1d[_0xb6da('0x46')]['id']}})[_0xb6da('0x24')](function(_0x542dcb){if(_0x542dcb){_0xb04820=_0x542dcb;return _0x542dcb[_0xb6da('0x5e')](_0x25eb1d[_0xb6da('0x49')]['id'],{'transaction':_0x196253});}})[_0xb6da('0x24')](function(_0x1d445d){if(_0x1d445d){return db[_0xb6da('0x5f')][_0xb6da('0x60')]({'where':{'id':_0x25eb1d[_0xb6da('0x49')]['id']},'attributes':['id','name',_0xb6da('0x61'),_0xb6da('0x62'),_0xb6da('0x63')],'raw':!![]});}})['then'](function(_0xf403ca){if(_0xf403ca){var _0x5afcb8=path[_0xb6da('0x4f')](config[_0xb6da('0x50')],'server/files/sounds/converted',util[_0xb6da('0x64')](_0xb6da('0x65'),path['basename'](_0xf403ca['save_name'],path[_0xb6da('0x66')](_0xf403ca[_0xb6da('0x61')])),_0xf403ca['converted_format']));var _0x4aac9b=path[_0xb6da('0x4f')](config['root'],_0xb6da('0x51'),_0xb04820[_0xb6da('0x2b')],util[_0xb6da('0x64')](_0xb6da('0x65'),_0xf403ca[_0xb6da('0x2b')],_0xf403ca['converted_format']));fs[_0xb6da('0x67')](_0x5afcb8,_0x4aac9b);return _0xf403ca;}})[_0xb6da('0x44')](function(_0x1cdb8a){throw new db['Sequelize'][(_0xb6da('0x5d'))](_0x1cdb8a['message']);});})[_0xb6da('0x24')](handleEntityNotFound(_0x49687d,null))[_0xb6da('0x24')](respondWithResult(_0x49687d,0xc9))['catch'](handleError(_0x49687d,null));};exports['removeSound']=function(_0x3d69aa,_0x5afac8,_0x293af3){return db[_0xb6da('0x4b')]['transaction'](function(_0x1d9539){var _0x361372;return db['VoiceMusicOnHold'][_0xb6da('0x60')]({'where':{'id':_0x3d69aa['params']['id']}})[_0xb6da('0x24')](handleEntityNotFound(_0x5afac8,null))[_0xb6da('0x24')](function(_0x58f4ee){if(_0x58f4ee){_0x361372=_0x58f4ee;return _0x58f4ee[_0xb6da('0x68')](_0x3d69aa['params'][_0xb6da('0x69')]);}})[_0xb6da('0x24')](function(_0x349f0b){if(_0x349f0b){return db[_0xb6da('0x5f')][_0xb6da('0x60')]({'where':{'id':_0x3d69aa['params']['id2']},'attributes':['id',_0xb6da('0x2b'),_0xb6da('0x61'),_0xb6da('0x62'),_0xb6da('0x63')],'raw':!![]});}})[_0xb6da('0x24')](function(_0x1359d4){if(_0x1359d4){fs[_0xb6da('0x5b')](path[_0xb6da('0x4f')](_0x361372[_0xb6da('0x4e')],util[_0xb6da('0x64')](_0xb6da('0x65'),_0x1359d4[_0xb6da('0x2b')],_0x1359d4[_0xb6da('0x62')])));return _0x1359d4;}})[_0xb6da('0x44')](function(_0x3f53bf){throw new db[(_0xb6da('0x6a'))]['ValidationError'](_0x3f53bf[_0xb6da('0x6b')]);});})[_0xb6da('0x24')](handleEntityNotFound(_0x5afac8,null))[_0xb6da('0x24')](respondWithStatusCode(_0x5afac8,0xcc))[_0xb6da('0x44')](handleError(_0x5afac8,null));};exports[_0xb6da('0x6c')]=function(_0x57b7d6,_0x25d134,_0x1f0738){var _0x1bcb2e={};var _0x39417b={};var _0x598f13;var _0x3b6b36;return db[_0xb6da('0x2d')][_0xb6da('0x60')]({'where':{'id':_0x57b7d6[_0xb6da('0x46')]['id']}})[_0xb6da('0x24')](handleEntityNotFound(_0x25d134,null))[_0xb6da('0x24')](function(_0x1953b8){if(_0x1953b8){_0x598f13=_0x1953b8;_0x39417b['model']=_[_0xb6da('0x34')](db['Sound'][_0xb6da('0x2e')]);_0x39417b[_0xb6da('0x33')]=_[_0xb6da('0x34')](_0x57b7d6[_0xb6da('0x33')]);_0x39417b[_0xb6da('0x3d')]=_[_0xb6da('0x35')](_0x39417b['model'],_0x39417b[_0xb6da('0x33')]);_0x1bcb2e[_0xb6da('0x36')]=_[_0xb6da('0x35')](_0x39417b[_0xb6da('0x31')],qs[_0xb6da('0x37')](_0x57b7d6[_0xb6da('0x33')][_0xb6da('0x37')]));_0x1bcb2e[_0xb6da('0x36')]=_0x1bcb2e[_0xb6da('0x36')][_0xb6da('0x38')]?_0x1bcb2e['attributes']:_0x39417b['model'];_0x1bcb2e[_0xb6da('0x39')]=qs['sort'](_0x57b7d6[_0xb6da('0x33')][_0xb6da('0x3a')]);_0x1bcb2e[_0xb6da('0x3b')]=qs[_0xb6da('0x3d')](_[_0xb6da('0x3c')](_0x57b7d6[_0xb6da('0x33')],_0x39417b[_0xb6da('0x3d')]));if(_0x57b7d6[_0xb6da('0x33')][_0xb6da('0x3e')]){_0x1bcb2e[_0xb6da('0x3b')]=_[_0xb6da('0x3f')](_0x1bcb2e['where'],{'$or':_[_0xb6da('0x32')](_0x1bcb2e[_0xb6da('0x36')],function(_0x4bd323){var _0x1b5491={};_0x1b5491[_0x4bd323]={'$like':'%'+_0x57b7d6[_0xb6da('0x33')][_0xb6da('0x3e')]+'%'};return _0x1b5491;})});}_0x1bcb2e=_[_0xb6da('0x3f')]({},_0x1bcb2e,_0x57b7d6['options']);return _0x598f13['getSounds'](_0x1bcb2e);}})[_0xb6da('0x24')](function(_0x29ed41){if(_0x29ed41){_0x3b6b36=_0x29ed41[_0xb6da('0x38')];if(!_0x57b7d6[_0xb6da('0x33')][_0xb6da('0x6d')](_0xb6da('0x6e'))){_0x1bcb2e['limit']=qs[_0xb6da('0x1c')](_0x57b7d6[_0xb6da('0x33')]['limit']);_0x1bcb2e[_0xb6da('0x1a')]=qs[_0xb6da('0x1a')](_0x57b7d6[_0xb6da('0x33')][_0xb6da('0x1a')]);}return _0x598f13['getSounds'](_0x1bcb2e);}})[_0xb6da('0x24')](function(_0xdab0d3){if(_0xdab0d3){return _0xdab0d3?{'count':_0x3b6b36,'rows':_0xdab0d3}:null;}})['then'](respondWithResult(_0x25d134,null))[_0xb6da('0x44')](handleError(_0x25d134,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0a2726b..26b21f9 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 _0x6f23=['../../config/logger','bluebird','path','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold'];(function(_0x2ddaa0,_0x5a0a7e){var _0x4e5548=function(_0x5141e9){while(--_0x5141e9){_0x2ddaa0['push'](_0x2ddaa0['shift']());}};_0x4e5548(++_0x5a0a7e);}(_0x6f23,0x7e));var _0x36f2=function(_0x57de4d,_0x4943d9){_0x57de4d=_0x57de4d-0x0;var _0x57607f=_0x6f23[_0x57de4d];return _0x57607f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x36f2('0x0'))('api');var moment=require('moment');var BPromise=require(_0x36f2('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36f2('0x2'));var rimraf=require('rimraf');var config=require(_0x36f2('0x3'));var attributes=require(_0x36f2('0x4'));module[_0x36f2('0x5')]=function(_0x3b97fe,_0x5d3220){return _0x3b97fe['define'](_0x36f2('0x6'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0cf=['./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x278787,_0x50e874){var _0x3430ab=function(_0x575ddb){while(--_0x575ddb){_0x278787['push'](_0x278787['shift']());}};_0x3430ab(++_0x50e874);}(_0xa0cf,0x164));var _0xfa0c=function(_0xdee7ec,_0x29d552){_0xdee7ec=_0xdee7ec-0x0;var _0x1879b6=_0xa0cf[_0xdee7ec];return _0x1879b6;};'use strict';var _=require(_0xfa0c('0x0'));var util=require(_0xfa0c('0x1'));var logger=require(_0xfa0c('0x2'))(_0xfa0c('0x3'));var moment=require(_0xfa0c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa0c('0x5'));var rimraf=require('rimraf');var config=require(_0xfa0c('0x6'));var attributes=require(_0xfa0c('0x7'));module[_0xfa0c('0x8')]=function(_0x59a554,_0x27d9f7){return _0x59a554[_0xfa0c('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0xfa0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 133e8ac..283083e 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x52bb69,_0xa562e8){var _0x410e56=function(_0x249928){while(--_0x249928){_0x52bb69['push'](_0x52bb69['shift']());}};_0x410e56(++_0xa562e8);}(_0xedd9,0xfc));var _0x9edd=function(_0x11ca5c,_0x270dd6){_0x11ca5c=_0x11ca5c-0x0;var _0x196716=_0xedd9[_0x11ca5c];return _0x196716;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +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(_0x5726aa,_0x551bec){var _0xd967ab=function(_0x3ca624){while(--_0x3ca624){_0x5726aa['push'](_0x5726aa['shift']());}};_0xd967ab(++_0x551bec);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xcb91[_0x35f7f5];return _0x5567a4;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index bc8f419..c2b3ec3 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 _0x8456=['getTeams','post','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/users','/:id/teams'];(function(_0xe85c5,_0x5468bf){var _0x3ad2a1=function(_0x308da5){while(--_0x308da5){_0xe85c5['push'](_0xe85c5['shift']());}};_0x3ad2a1(++_0x5468bf);}(_0x8456,0xfd));var _0x6845=function(_0xb663bd,_0xc0326f){_0xb663bd=_0xb663bd-0x0;var _0x1ab567=_0x8456[_0xb663bd];return _0x1ab567;};'use strict';var multer=require(_0x6845('0x0'));var util=require(_0x6845('0x1'));var path=require(_0x6845('0x2'));var timeout=require('connect-timeout');var express=require(_0x6845('0x3'));var router=express['Router']();var fs_extra=require(_0x6845('0x4'));var auth=require(_0x6845('0x5'));var interaction=require(_0x6845('0x6'));var config=require(_0x6845('0x7'));var controller=require(_0x6845('0x8'));router[_0x6845('0x9')]('/',auth[_0x6845('0xa')](),controller[_0x6845('0xb')]);router[_0x6845('0x9')](_0x6845('0xc'),auth['isAuthenticated'](),controller[_0x6845('0xd')]);router['get'](_0x6845('0xe'),auth[_0x6845('0xa')](),controller['show']);router[_0x6845('0x9')](_0x6845('0xf'),auth[_0x6845('0xa')](),controller['getAgents']);router[_0x6845('0x9')](_0x6845('0x10'),auth[_0x6845('0xa')](),controller[_0x6845('0x11')]);router[_0x6845('0x12')]('/',auth[_0x6845('0xa')](),controller['create']);router[_0x6845('0x12')](_0x6845('0xf'),auth[_0x6845('0xa')](),controller[_0x6845('0x13')]);router[_0x6845('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6845('0x14')]);router[_0x6845('0x15')](_0x6845('0xe'),auth['isAuthenticated'](),controller[_0x6845('0x16')]);router[_0x6845('0x17')](_0x6845('0xe'),auth[_0x6845('0xa')](),controller[_0x6845('0x18')]);router[_0x6845('0x17')](_0x6845('0xf'),auth['isAuthenticated'](),controller[_0x6845('0x19')]);router['delete']('/:id/teams',auth[_0x6845('0xa')](),controller[_0x6845('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xd694=['removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete'];(function(_0x49465c,_0x27f01b){var _0x22469f=function(_0x27cfd2){while(--_0x27cfd2){_0x49465c['push'](_0x49465c['shift']());}};_0x22469f(++_0x27f01b);}(_0xd694,0x11b));var _0x4d69=function(_0x1c28d2,_0x1e77f7){_0x1c28d2=_0x1c28d2-0x0;var _0x5aa5b3=_0xd694[_0x1c28d2];return _0x5aa5b3;};'use strict';var multer=require(_0x4d69('0x0'));var util=require('util');var path=require(_0x4d69('0x1'));var timeout=require(_0x4d69('0x2'));var express=require(_0x4d69('0x3'));var router=express[_0x4d69('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4d69('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d69('0x6'));var controller=require(_0x4d69('0x7'));router['get']('/',auth[_0x4d69('0x8')](),controller[_0x4d69('0x9')]);router[_0x4d69('0xa')](_0x4d69('0xb'),auth['isAuthenticated'](),controller[_0x4d69('0xc')]);router['get'](_0x4d69('0xd'),auth[_0x4d69('0x8')](),controller[_0x4d69('0xe')]);router['get']('/:id/users',auth[_0x4d69('0x8')](),controller[_0x4d69('0xf')]);router[_0x4d69('0xa')](_0x4d69('0x10'),auth[_0x4d69('0x8')](),controller[_0x4d69('0x11')]);router[_0x4d69('0x12')]('/',auth[_0x4d69('0x8')](),controller[_0x4d69('0x13')]);router['post'](_0x4d69('0x14'),auth[_0x4d69('0x8')](),controller[_0x4d69('0x15')]);router[_0x4d69('0x12')](_0x4d69('0x10'),auth[_0x4d69('0x8')](),controller['addTeams']);router[_0x4d69('0x16')]('/:id',auth[_0x4d69('0x8')](),controller[_0x4d69('0x17')]);router[_0x4d69('0x18')](_0x4d69('0xd'),auth[_0x4d69('0x8')](),controller['destroy']);router[_0x4d69('0x18')](_0x4d69('0x14'),auth[_0x4d69('0x8')](),controller[_0x4d69('0x19')]);router[_0x4d69('0x18')](_0x4d69('0x10'),auth[_0x4d69('0x8')](),controller[_0x4d69('0x1a')]);module[_0x4d69('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f8d5234..7229534 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 _0x6551=['exports','name','VIRTUAL','getDataValue','STRING','INTEGER','sequelize'];(function(_0x24e0a8,_0x49d031){var _0x1051f5=function(_0x45f365){while(--_0x45f365){_0x24e0a8['push'](_0x24e0a8['shift']());}};_0x1051f5(++_0x49d031);}(_0x6551,0xbc));var _0x1655=function(_0x15a7b1,_0x1ffc78){_0x15a7b1=_0x15a7b1-0x0;var _0x5383fa=_0x6551[_0x15a7b1];return _0x5383fa;};'use strict';var Sequelize=require(_0x1655('0x0'));module[_0x1655('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1655('0x2')},'prefix':{'type':Sequelize[_0x1655('0x3')],'get':function(_0x28d05b){return'system-'+this[_0x1655('0x4')](_0x1655('0x2'))+'-';}},'description':{'type':Sequelize[_0x1655('0x5')]},'callerIdAll':{'type':Sequelize[_0x1655('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x1655('0x6')]}}; \ No newline at end of file +var _0x9c29=['system-','getDataValue','name','INTEGER','sequelize','STRING'];(function(_0x521599,_0x12ebc1){var _0x47e8e8=function(_0x28ade9){while(--_0x28ade9){_0x521599['push'](_0x521599['shift']());}};_0x47e8e8(++_0x12ebc1);}(_0x9c29,0xee));var _0x99c2=function(_0x52f652,_0x71f6c7){_0x52f652=_0x52f652-0x0;var _0x176100=_0x9c29[_0x52f652];return _0x176100;};'use strict';var Sequelize=require(_0x99c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x99c2('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1db4b3){return _0x99c2('0x2')+this[_0x99c2('0x3')](_0x99c2('0x4'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x99c2('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x99c2('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 274c1f8..e1de67c 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 _0x34b7=['fieldName','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','catch','fields','includeAll','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','order','getTeams','Team','addTeams','findAll','Agents','online','voicePause','interface','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','TeamId','all','compact','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','index','map','VoicePrefix','rawAttributes'];(function(_0x56b733,_0x461486){var _0x22bf1d=function(_0x506795){while(--_0x506795){_0x56b733['push'](_0x56b733['shift']());}};_0x22bf1d(++_0x461486);}(_0x34b7,0x196));var _0x734b=function(_0x4b095c,_0x266c55){_0x4b095c=_0x4b095c-0x0;var _0x4495e2=_0x34b7[_0x4b095c];return _0x4495e2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];config[_0x734b('0x18')]=_[_0x734b('0x19')](config[_0x734b('0x18')],{'host':_0x734b('0x1a'),'port':0x18eb});var socket=require(_0x734b('0x1b'))(new Redis(config['redis']));require(_0x734b('0x1c'))[_0x734b('0x1d')](socket);function respondWithStatusCode(_0x47791c,_0xd1ab2a){_0xd1ab2a=_0xd1ab2a||0xcc;return function(_0x19f427){if(_0x19f427){return _0x47791c[_0x734b('0x1e')](_0xd1ab2a);}return _0x47791c[_0x734b('0x1f')](_0xd1ab2a)[_0x734b('0x20')]();};}function respondWithResult(_0xa6d111,_0x4b8c63){_0x4b8c63=_0x4b8c63||0xc8;return function(_0x42407a){if(_0x42407a){return _0xa6d111['status'](_0x4b8c63)[_0x734b('0x21')](_0x42407a);}};}function respondWithFilteredResult(_0x2ee290,_0xfb661a){return function(_0x5edbe9){if(_0x5edbe9){var _0x4d3b9c=typeof _0xfb661a['offset']===_0x734b('0x22')&&typeof _0xfb661a[_0x734b('0x23')]===_0x734b('0x22');var _0x41ba87=_0x5edbe9[_0x734b('0x24')];var _0xfe567d=_0x4d3b9c?0x0:_0xfb661a[_0x734b('0x25')];var _0x6572ee=_0x4d3b9c?_0x5edbe9[_0x734b('0x24')]:_0xfb661a[_0x734b('0x25')]+_0xfb661a[_0x734b('0x23')];var _0x3d0ffd;if(_0x6572ee>=_0x41ba87){_0x6572ee=_0x41ba87;_0x3d0ffd=0xc8;}else{_0x3d0ffd=0xce;}_0x2ee290[_0x734b('0x1f')](_0x3d0ffd);return _0x2ee290[_0x734b('0x26')]('Content-Range',_0xfe567d+'-'+_0x6572ee+'/'+_0x41ba87)[_0x734b('0x21')](_0x5edbe9);}return null;};}function patchUpdates(_0x7856d7){return function(_0x4f98a7){try{jsonpatch[_0x734b('0x27')](_0x4f98a7,_0x7856d7,!![]);}catch(_0x1f81de){return BPromise[_0x734b('0x28')](_0x1f81de);}return _0x4f98a7[_0x734b('0x29')]();};}function saveUpdates(_0x46d432,_0x26d118){return function(_0x26eccf){if(_0x26eccf){return _0x26eccf[_0x734b('0x2a')](_0x46d432)[_0x734b('0x2b')](function(_0x3abbe6){return _0x3abbe6;});}return null;};}function removeEntity(_0x44ffa9,_0x148abe){return function(_0x3bb651){if(_0x3bb651){return _0x3bb651['destroy']()['then'](function(){var _0x13cc5a=_0x3bb651[_0x734b('0x2c')]({'plain':!![]});var _0x47a0a9=_0x734b('0x2d');return db[_0x734b('0x2e')][_0x734b('0x2f')]({'where':{'type':_0x47a0a9,'resourceId':_0x13cc5a['id']}})[_0x734b('0x2b')](function(){return _0x3bb651;});})[_0x734b('0x2b')](function(){_0x44ffa9[_0x734b('0x1f')](0xcc)[_0x734b('0x20')]();});}};}function handleEntityNotFound(_0x5c6c5d,_0x1f3652){return function(_0x436efe){if(!_0x436efe){_0x5c6c5d[_0x734b('0x1e')](0x194);}return _0x436efe;};}function handleError(_0x241c89,_0x729431){_0x729431=_0x729431||0x1f4;return function(_0x427c36){logger[_0x734b('0x30')](_0x427c36[_0x734b('0x31')]);if(_0x427c36[_0x734b('0x32')]){delete _0x427c36[_0x734b('0x32')];}_0x241c89['status'](_0x729431)[_0x734b('0x33')](_0x427c36);};}exports[_0x734b('0x34')]=function(_0x57f792,_0xbbe037){var _0x3cfce2={},_0xf4ef21={},_0x2fe7d5={'count':0x0,'rows':[]};var _0x21cb04=_[_0x734b('0x35')](db[_0x734b('0x36')][_0x734b('0x37')],function(_0x1e53fb){return{'name':_0x1e53fb[_0x734b('0x38')],'type':_0x1e53fb[_0x734b('0x39')][_0x734b('0x3a')]};});_0xf4ef21[_0x734b('0x3b')]=_[_0x734b('0x35')](_0x21cb04,_0x734b('0x32'));_0xf4ef21['query']=_[_0x734b('0x3c')](_0x57f792['query']);_0xf4ef21[_0x734b('0x3d')]=_[_0x734b('0x3e')](_0xf4ef21[_0x734b('0x3b')],_0xf4ef21[_0x734b('0x3f')]);_0x3cfce2[_0x734b('0x40')]=_[_0x734b('0x3e')](_0xf4ef21['model'],qs['fields'](_0x57f792[_0x734b('0x3f')]['fields']));_0x3cfce2[_0x734b('0x40')]=_0x3cfce2['attributes'][_0x734b('0x41')]?_0x3cfce2['attributes']:_0xf4ef21[_0x734b('0x3b')];if(!_0x57f792['query'][_0x734b('0x42')](_0x734b('0x43'))){_0x3cfce2[_0x734b('0x23')]=qs[_0x734b('0x23')](_0x57f792[_0x734b('0x3f')][_0x734b('0x23')]);_0x3cfce2[_0x734b('0x25')]=qs['offset'](_0x57f792[_0x734b('0x3f')][_0x734b('0x25')]);}_0x3cfce2['order']=qs[_0x734b('0x44')](_0x57f792[_0x734b('0x3f')][_0x734b('0x44')]);_0x3cfce2[_0x734b('0x45')]=qs['filters'](_[_0x734b('0x46')](_0x57f792[_0x734b('0x3f')],_0xf4ef21['filters']),_0x21cb04);if(_0x57f792[_0x734b('0x3f')][_0x734b('0x47')]){_0x3cfce2['where']=_[_0x734b('0x48')](_0x3cfce2[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x21cb04,function(_0x300aaa){if(_0x300aaa['type']!=='VIRTUAL'){var _0x2f6cee={};_0x2f6cee[_0x300aaa['name']]={'$like':'%'+_0x57f792['query'][_0x734b('0x47')]+'%'};return _0x2f6cee;}})});}_0x3cfce2=_['merge']({},_0x3cfce2,_0x57f792[_0x734b('0x49')]);var _0x4d77f0={'where':_0x3cfce2[_0x734b('0x45')]};return db[_0x734b('0x36')][_0x734b('0x24')](_0x4d77f0)['then'](function(_0x5cf3a0){_0x2fe7d5[_0x734b('0x24')]=_0x5cf3a0;if(_0x57f792['query']['includeAll']){_0x3cfce2[_0x734b('0x4a')]=[{'all':!![]}];}return db[_0x734b('0x36')]['findAll'](_0x3cfce2);})[_0x734b('0x2b')](function(_0x513f07){_0x2fe7d5[_0x734b('0x4b')]=_0x513f07;return _0x2fe7d5;})[_0x734b('0x2b')](respondWithFilteredResult(_0xbbe037,_0x3cfce2))[_0x734b('0x4c')](handleError(_0xbbe037,null));};exports['show']=function(_0xe8b116,_0x2455b9){var _0x3bca7e={'raw':![],'where':{'id':_0xe8b116['params']['id']}},_0x439139={};_0x439139['model']=_['keys'](db[_0x734b('0x36')]['rawAttributes']);_0x439139['query']=_[_0x734b('0x3c')](_0xe8b116['query']);_0x439139[_0x734b('0x3d')]=_[_0x734b('0x3e')](_0x439139[_0x734b('0x3b')],_0x439139[_0x734b('0x3f')]);_0x3bca7e['attributes']=_[_0x734b('0x3e')](_0x439139['model'],qs[_0x734b('0x4d')](_0xe8b116[_0x734b('0x3f')][_0x734b('0x4d')]));_0x3bca7e['attributes']=_0x3bca7e[_0x734b('0x40')]['length']?_0x3bca7e[_0x734b('0x40')]:_0x439139[_0x734b('0x3b')];if(_0xe8b116['query'][_0x734b('0x4e')]){_0x3bca7e[_0x734b('0x4a')]=[{'all':!![]}];}_0x3bca7e=_[_0x734b('0x48')]({},_0x3bca7e,_0xe8b116[_0x734b('0x49')]);return db[_0x734b('0x36')]['find'](_0x3bca7e)[_0x734b('0x2b')](handleEntityNotFound(_0x2455b9,null))['then'](respondWithResult(_0x2455b9,null))[_0x734b('0x4c')](handleError(_0x2455b9,null));};exports['destroy']=function(_0xd3c688,_0xa2fd9d){return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0xd3c688[_0x734b('0x50')]['id']}})['then'](handleEntityNotFound(_0xa2fd9d,null))['then'](removeEntity(_0xa2fd9d,null))['catch'](handleError(_0xa2fd9d,null));};exports[_0x734b('0x51')]=function(_0x1901a8,_0x541991){return db[_0x734b('0x36')][_0x734b('0x51')]()['then'](respondWithResult(_0x541991,null))[_0x734b('0x4c')](handleError(_0x541991,null));};exports[_0x734b('0x52')]=function(_0x44e6d2,_0x4d6501){var _0x2e95aa;return db[_0x734b('0x53')][_0x734b('0x54')](function(_0xe605be){return db['VoicePrefix'][_0x734b('0x52')](_0x44e6d2[_0x734b('0x55')],{'transaction':_0xe605be})[_0x734b('0x2b')](function(_0x432a96){_0x2e95aa=_0x432a96['get']({'plain':!![]});return db[_0x734b('0x56')]['find']({'where':{'id':_0x2e95aa[_0x734b('0x57')]},'raw':!![]})[_0x734b('0x2b')](function(_0x1f3594){return createVoicePrefixExtensions(_0x2e95aa,_0x1f3594,_0xe605be);});});})[_0x734b('0x2b')](function(){var _0x58d665=_0x44e6d2[_0x734b('0x58')][_0x734b('0x2c')]({'plain':!![]});if(!_0x58d665)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58d665['role']===_0x734b('0x58')){var _0x577735=_0x2e95aa;return db[_0x734b('0x59')][_0x734b('0x4f')]({'where':{'name':_0x734b('0x2d'),'userProfileId':_0x58d665['userProfileId']},'raw':!![]})[_0x734b('0x2b')](function(_0x588cd8){if(_0x588cd8&&_0x588cd8[_0x734b('0x5a')]===0x0){return db[_0x734b('0x2e')][_0x734b('0x52')]({'name':_0x577735[_0x734b('0x32')],'resourceId':_0x577735['id'],'type':_0x588cd8['name'],'sectionId':_0x588cd8['id']},{})[_0x734b('0x2b')](function(){return _0x2e95aa;});}else{return _0x2e95aa;}})['catch'](function(_0x6b198c){logger[_0x734b('0x30')](_0x734b('0x5b'),_0x6b198c);throw _0x6b198c;});}return _0x2e95aa;})['then'](respondWithResult(_0x4d6501,null))[_0x734b('0x4c')](handleError(_0x4d6501,null));};function Extension(_0x55c699,_0x2c81a1,_0x17a217,_0x3ec705){this[_0x734b('0x5c')]='from-sip';this[_0x734b('0x5d')]=_0x55c699;this['app']=_0x17a217;this[_0x734b('0x39')]=_0x734b('0x5e');this[_0x734b('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x734b('0x60')]=_0x2c81a1;this[_0x734b('0x61')]=_0x3ec705;}function createVoicePrefixExtensions(_0x366379,_0x3b16bb,_0x228f85){return new BPromise(function(_0x262244,_0x164c81){var _0x506407=new Extension(formatPrefixName(_0x366379[_0x734b('0x62')]),0x1,_0x734b('0x63'),_0x734b('0x64'));_0x506407['VoicePrefixId']=_0x366379['id'];return db['VoiceExtension'][_0x734b('0x52')](_0x506407,{'transaction':_0x228f85})[_0x734b('0x2b')](function(_0x391c04){var _0x1eec8e=_0x391c04['get']({'plain':!![]});var _0x565a2e=_['map'](addVoicePrefixExtensions(_0x366379,_0x3b16bb),function(_0x1bd023){_0x1bd023[_0x734b('0x57')]=_0x1eec8e['id'];_0x1bd023[_0x734b('0x65')]=_0x366379['id'];return _0x1bd023;});return db[_0x734b('0x56')][_0x734b('0x66')](_0x565a2e,{'transaction':_0x228f85})[_0x734b('0x2b')](function(_0x113931){if(!_0x113931){return _0x164c81(_0x734b('0x67'));}else{return _0x262244(_0x113931);}})[_0x734b('0x4c')](function(_0x459788){return _0x164c81(_0x459788);});});;});};function addVoicePrefixExtensions(_0xc5a114,_0x69b605){var _0x43951a=[];var _0x467b1=formatPrefixName(_0xc5a114[_0x734b('0x62')]);_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x2,_0x734b('0x69'),_0x734b('0x6a')+_0xc5a114[_0x734b('0x32')]));if(_0xc5a114[_0x734b('0x6b')]){_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x3,'Set',_0x734b('0x6c')+_0xc5a114[_0x734b('0x6b')]));}else{_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x3,_0x734b('0x63'),_0x734b('0x6d')));}_0x43951a['push'](new Extension(_0x467b1,0x4,_0x734b('0x6e'),_0x69b605[_0x734b('0x5c')]+','+_0x734b('0x6f')+(0x8+_0xc5a114[_0x734b('0x32')][_0x734b('0x41')])+'}'+','+0x1));return _0x43951a;}function formatPrefixName(_0x5d785d){var _0x594df0='_';for(var _0x479ee2=0x0;_0x479ee2<_0x5d785d['length'];_0x479ee2++){if(_0x5d785d['charAt'](_0x479ee2)=='-'){_0x594df0+=_0x5d785d['charAt'](_0x479ee2);}else{_0x594df0+='['+_0x5d785d[_0x734b('0x70')](_0x479ee2)+']';}}_0x594df0+='.';return _0x594df0;}exports[_0x734b('0x2a')]=function(_0x16c9d2,_0xb23b61,_0x496070){var _0x4f79a9=_0x16c9d2[_0x734b('0x55')];_0x4f79a9[_0x734b('0x62')]=_0x734b('0x71')+_0x4f79a9[_0x734b('0x32')]+'-';return db['sequelize'][_0x734b('0x54')](function(_0x24ab5c){return db[_0x734b('0x36')][_0x734b('0x2a')](_0x4f79a9,{'where':{'id':_0x4f79a9['id']},'transaction':_0x24ab5c})['then'](function(){return db[_0x734b('0x56')]['destroy']({'where':{'VoicePrefixId':_0x4f79a9['id']},'transaction':_0x24ab5c})[_0x734b('0x2b')](function(){return db[_0x734b('0x56')][_0x734b('0x4f')]({'where':{'id':_0x4f79a9[_0x734b('0x57')]},'raw':!![]})[_0x734b('0x2b')](function(_0x4e43c3){return createVoicePrefixExtensions(_0x4f79a9,_0x4e43c3,_0x24ab5c);});});});})[_0x734b('0x2b')](function(){return db[_0x734b('0x36')][_0x734b('0x72')](_0x4f79a9['id']);})[_0x734b('0x2b')](respondWithResult(_0xb23b61,null))[_0x734b('0x4c')](handleError(_0xb23b61,null));};exports['addAgents']=function(_0x475ecd,_0x2dcb30,_0x1316ae){return db[_0x734b('0x36')]['find']({'where':{'id':_0x475ecd[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x2dcb30,null))[_0x734b('0x2b')](function(_0x407006){if(_0x407006){return _0x407006[_0x734b('0x73')](_0x475ecd['body'][_0x734b('0x74')],_['omit'](_0x475ecd[_0x734b('0x55')],[_0x734b('0x74'),'id'])||{})[_0x734b('0x75')](function(_0x27fd22){for(var _0x4624c7=0x0;_0x4624c7<_0x475ecd[_0x734b('0x55')]['ids']['length'];_0x4624c7+=0x1){socket['emit'](_0x734b('0x76'),{'UserId':Number(_0x475ecd['body'][_0x734b('0x74')][_0x4624c7]),'VoicePrefixId':Number(_0x475ecd[_0x734b('0x50')]['id'])});}return _0x27fd22;});}})['then'](respondWithResult(_0x2dcb30,null))[_0x734b('0x4c')](handleError(_0x2dcb30,null));};exports[_0x734b('0x77')]=function(_0x17749f,_0x2a3c8d,_0x1d0bfb){return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0x17749f[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x2a3c8d,null))[_0x734b('0x2b')](function(_0x5de89a){if(_0x5de89a){return _0x5de89a[_0x734b('0x77')](_0x17749f[_0x734b('0x3f')][_0x734b('0x74')])['then'](function(){if(_[_0x734b('0x78')](_0x17749f[_0x734b('0x3f')][_0x734b('0x74')])){for(var _0x13f1fd=0x0;_0x13f1fd<_0x17749f[_0x734b('0x3f')][_0x734b('0x74')][_0x734b('0x41')];_0x13f1fd+=0x1){socket[_0x734b('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x17749f[_0x734b('0x3f')][_0x734b('0x74')][_0x13f1fd]),'VoicePrefixId':Number(_0x17749f[_0x734b('0x50')]['id'])});}}else{socket[_0x734b('0x79')](_0x734b('0x7a'),{'UserId':Number(_0x17749f[_0x734b('0x3f')][_0x734b('0x74')]),'VoicePrefixId':Number(_0x17749f[_0x734b('0x50')]['id'])});}});}})[_0x734b('0x2b')](respondWithStatusCode(_0x2a3c8d,null))['catch'](handleError(_0x2a3c8d,null));};exports[_0x734b('0x7b')]=function(_0x13f4e8,_0x41eca7,_0x500ebf){var _0x31e1ec={};var _0x2fde66={};var _0x24fb9d;var _0x3f3511;return db[_0x734b('0x36')][_0x734b('0x7c')]({'where':{'id':_0x13f4e8['params']['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x41eca7,null))['then'](function(_0x504a7f){if(_0x504a7f){_0x24fb9d=_0x504a7f;_0x2fde66['model']=_['keys'](db[_0x734b('0x7d')][_0x734b('0x37')]);_0x2fde66[_0x734b('0x3f')]=_[_0x734b('0x3c')](_0x13f4e8['query']);_0x2fde66['filters']=_[_0x734b('0x3e')](_0x2fde66['model'],_0x2fde66[_0x734b('0x3f')]);_0x31e1ec[_0x734b('0x40')]=_['intersection'](_0x2fde66[_0x734b('0x3b')],qs['fields'](_0x13f4e8['query']['fields']));_0x31e1ec[_0x734b('0x40')]=_0x31e1ec[_0x734b('0x40')][_0x734b('0x41')]?_0x31e1ec[_0x734b('0x40')]:_0x2fde66['model'];_0x31e1ec[_0x734b('0x7e')]=qs[_0x734b('0x44')](_0x13f4e8['query'][_0x734b('0x44')]);_0x31e1ec[_0x734b('0x45')]=qs['filters'](_[_0x734b('0x46')](_0x13f4e8['query'],_0x2fde66[_0x734b('0x3d')]));if(_0x13f4e8[_0x734b('0x3f')][_0x734b('0x47')]){_0x31e1ec[_0x734b('0x45')]=_[_0x734b('0x48')](_0x31e1ec[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x31e1ec['attributes'],function(_0x5be5f2){var _0x57f20a={};_0x57f20a[_0x5be5f2]={'$like':'%'+_0x13f4e8[_0x734b('0x3f')][_0x734b('0x47')]+'%'};return _0x57f20a;})});}_0x31e1ec=_['merge']({},_0x31e1ec,_0x13f4e8[_0x734b('0x49')]);return _0x24fb9d[_0x734b('0x7b')](_0x31e1ec);}})[_0x734b('0x2b')](function(_0x48b0e1){if(_0x48b0e1){_0x3f3511=_0x48b0e1[_0x734b('0x41')];if(!_0x13f4e8[_0x734b('0x3f')][_0x734b('0x42')]('nolimit')){_0x31e1ec[_0x734b('0x23')]=qs[_0x734b('0x23')](_0x13f4e8[_0x734b('0x3f')]['limit']);_0x31e1ec['offset']=qs['offset'](_0x13f4e8[_0x734b('0x3f')]['offset']);}return _0x24fb9d[_0x734b('0x7b')](_0x31e1ec);}})[_0x734b('0x2b')](function(_0x2a5aa9){if(_0x2a5aa9){return _0x2a5aa9?{'count':_0x3f3511,'rows':_0x2a5aa9}:null;}})['then'](respondWithResult(_0x41eca7,null))['catch'](handleError(_0x41eca7,null));};exports[_0x734b('0x7f')]=function(_0xa9bb2a,_0x4f3a90,_0x72d3ad){var _0x548206={};var _0x4a809a={};var _0x52890d;var _0xbb8121;return db[_0x734b('0x36')][_0x734b('0x7c')]({'where':{'id':_0xa9bb2a[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x4f3a90,null))[_0x734b('0x2b')](function(_0x18cb9){if(_0x18cb9){_0x52890d=_0x18cb9;_0x4a809a['model']=_[_0x734b('0x3c')](db[_0x734b('0x80')][_0x734b('0x37')]);_0x4a809a[_0x734b('0x3f')]=_['keys'](_0xa9bb2a['query']);_0x4a809a['filters']=_[_0x734b('0x3e')](_0x4a809a[_0x734b('0x3b')],_0x4a809a[_0x734b('0x3f')]);_0x548206[_0x734b('0x40')]=_[_0x734b('0x3e')](_0x4a809a[_0x734b('0x3b')],qs[_0x734b('0x4d')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x4d')]));_0x548206[_0x734b('0x40')]=_0x548206[_0x734b('0x40')][_0x734b('0x41')]?_0x548206[_0x734b('0x40')]:_0x4a809a['model'];_0x548206['order']=qs[_0x734b('0x44')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x44')]);_0x548206['where']=qs[_0x734b('0x3d')](_[_0x734b('0x46')](_0xa9bb2a[_0x734b('0x3f')],_0x4a809a[_0x734b('0x3d')]));if(_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x47')]){_0x548206[_0x734b('0x45')]=_[_0x734b('0x48')](_0x548206[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x548206[_0x734b('0x40')],function(_0x30dff6){var _0x5ac65f={};_0x5ac65f[_0x30dff6]={'$like':'%'+_0xa9bb2a[_0x734b('0x3f')]['filter']+'%'};return _0x5ac65f;})});}_0x548206=_[_0x734b('0x48')]({},_0x548206,_0xa9bb2a[_0x734b('0x49')]);return _0x52890d[_0x734b('0x7f')](_0x548206);}})[_0x734b('0x2b')](function(_0x1bedc4){if(_0x1bedc4){_0xbb8121=_0x1bedc4['length'];if(!_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x42')]('nolimit')){_0x548206[_0x734b('0x23')]=qs[_0x734b('0x23')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x23')]);_0x548206['offset']=qs['offset'](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x25')]);}return _0x52890d['getTeams'](_0x548206);}})[_0x734b('0x2b')](function(_0x19a54a){if(_0x19a54a){return _0x19a54a?{'count':_0xbb8121,'rows':_0x19a54a}:null;}})[_0x734b('0x2b')](respondWithResult(_0x4f3a90,null))[_0x734b('0x4c')](handleError(_0x4f3a90,null));};exports[_0x734b('0x81')]=function(_0x4e46a2,_0x5d0a69,_0x303257){var _0x1bac04=_0x4e46a2[_0x734b('0x55')]['ids'];var _0x200182;return db[_0x734b('0x80')][_0x734b('0x82')]({'where':{'id':_0x1bac04},'attributes':['id'],'include':[{'model':db[_0x734b('0x7d')],'as':_0x734b('0x83'),'attributes':['id',_0x734b('0x32'),_0x734b('0x84'),_0x734b('0x85'),_0x734b('0x86')],'raw':!![]}]})[_0x734b('0x2b')](function(_0x48fbb3){if(_0x48fbb3){_0x200182=_0x48fbb3;var _0x564dda=_[_0x734b('0x87')](_0x48fbb3,function(_0x26af1f){var _0x1ba633=_0x26af1f[_0x734b('0x2c')]({'plain':!![]});return _0x1ba633[_0x734b('0x83')];});return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0x4e46a2[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](function(_0xc74aeb){return db[_0x734b('0x53')]['transaction'](function(_0x288109){return _0xc74aeb[_0x734b('0x81')](_0x1bac04,{'transaction':_0x288109})['then'](function(){return BPromise['each'](_0x200182,function(_0x255fca){return db[_0x734b('0x88')][_0x734b('0x89')]({'TeamId':_0x255fca['id'],'VoicePrefixId':_0x4e46a2[_0x734b('0x50')]['id']},{'transaction':_0x288109});});})['then'](function(){return BPromise[_0x734b('0x8a')](_0x564dda,function(_0x1c9a1e){return db['UserVoicePrefix'][_0x734b('0x8b')]({'where':{'UserId':_0x1c9a1e['id'],'VoicePrefixId':_0x4e46a2[_0x734b('0x50')]['id']},'transaction':_0x288109});});})[_0x734b('0x2b')](function(){_0x564dda[_0x734b('0x8c')](function(_0x189e6d){socket[_0x734b('0x79')](_0x734b('0x76'),{'UserId':_0x189e6d['id'],'VoicePrefixId':_0xc74aeb['id']});});});});});}})[_0x734b('0x2b')](respondWithStatusCode(_0x5d0a69,null))['catch'](handleError(_0x5d0a69,null));};exports[_0x734b('0x8d')]=function(_0x31468d,_0x45a160,_0x16451a){return db[_0x734b('0x80')]['findAll']({'where':{'id':_0x31468d['query'][_0x734b('0x74')]},'attributes':['id'],'include':[{'model':db[_0x734b('0x7d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x734b('0x2b')](handleEntityNotFound(_0x45a160,null))['then'](function(_0x19cf27){var _0x1237cf=_[_0x734b('0x35')](_0x19cf27,'id');var _0x42038a=[];var _0x3e61f1=[];var _0x22e919=squel[_0x734b('0x8e')]();_0x22e919['field']('tq.TeamId')[_0x734b('0x8f')](_0x734b('0x90'),'tq')[_0x734b('0x91')]('user_has_teams','ut',_0x734b('0x92'))[_0x734b('0x45')](_0x734b('0x93'),_0x31468d['params']['id']);for(var _0x1fcc17=0x0;_0x1fcc17<_0x19cf27[_0x734b('0x41')];_0x1fcc17+=0x1){let _0x39a46e=_0x19cf27[_0x1fcc17];for(var _0x2a8f17=0x0;_0x2a8f17<_0x39a46e['Agents']['length'];_0x2a8f17+=0x1){let _0x9cfb2f=_0x39a46e[_0x734b('0x83')][_0x2a8f17];var _0x326783=_0x22e919['clone']();_0x326783[_0x734b('0x45')]('ut.UserId\x20=\x20?',_0x9cfb2f['id']);_0x3e61f1[_0x734b('0x68')](db[_0x734b('0x53')][_0x734b('0x3f')](_0x326783[_0x734b('0x94')](),{'type':db[_0x734b('0x53')]['QueryTypes'][_0x734b('0x95')]})[_0x734b('0x2b')](function(_0x5ddf23){if(_0x5ddf23['length']===0x1){return _0x9cfb2f['id'];}else{var _0x967ccc=_[_0x734b('0x96')](_['map'](_0x5ddf23,_0x734b('0x97')),function(_0x23be49){return _['includes'](_0x1237cf,_0x23be49);});if(_0x967ccc){return _0x9cfb2f['id'];}}}));}}return BPromise[_0x734b('0x98')](_0x3e61f1)['then'](function(_0x4d75bc){_0x42038a=_(_0x42038a)['union'](_0x4d75bc)[_0x734b('0x99')]()['value']();return db[_0x734b('0x36')]['find']({'where':{'id':_0x31468d[_0x734b('0x50')]['id']}})['then'](function(_0xf43253){return db[_0x734b('0x53')][_0x734b('0x54')](function(_0x483d0a){return _0xf43253[_0x734b('0x8d')](_0x31468d[_0x734b('0x3f')]['ids'],{'transaction':_0x483d0a})[_0x734b('0x2b')](function(){if(!_['isEmpty'](_0x42038a)){return _0xf43253[_0x734b('0x77')](_0x42038a,{'transaction':_0x483d0a});}})[_0x734b('0x2b')](function(){_0x42038a['forEach'](function(_0x1f00b3){socket[_0x734b('0x79')](_0x734b('0x7a'),{'UserId':_0x1f00b3,'VoicePrefixId':_0xf43253['id']});});});});});});})[_0x734b('0x2b')](respondWithStatusCode(_0x45a160,null))['catch'](handleError(_0x45a160,null));}; \ No newline at end of file +var _0x4fc2=['set','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoicePrefix','include','findAll','rows','catch','show','params','length','find','describe','sequelize','transaction','create','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','context','charAt','body','findById','addAgents','omit','spread','ids','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','findOrCreate','forEach','removeTeams','User','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status','json','offset','undefined','count'];(function(_0x154a93,_0xf11b03){var _0x330c47=function(_0x4c01a6){while(--_0x4c01a6){_0x154a93['push'](_0x154a93['shift']());}};_0x330c47(++_0xf11b03);}(_0x4fc2,0x111));var _0x24fc=function(_0x1a79c6,_0x5bad0b){_0x1a79c6=_0x1a79c6-0x0;var _0x301647=_0x4fc2[_0x1a79c6];return _0x301647;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];config['redis']=_[_0x24fc('0x1b')](config[_0x24fc('0x1c')],{'host':_0x24fc('0x1d'),'port':0x18eb});var socket=require(_0x24fc('0x1e'))(new Redis(config[_0x24fc('0x1c')]));require(_0x24fc('0x1f'))['register'](socket);function respondWithStatusCode(_0x2a0971,_0x18c0a7){_0x18c0a7=_0x18c0a7||0xcc;return function(_0x2ffed3){if(_0x2ffed3){return _0x2a0971[_0x24fc('0x20')](_0x18c0a7);}return _0x2a0971['status'](_0x18c0a7)[_0x24fc('0x21')]();};}function respondWithResult(_0x588543,_0x4af098){_0x4af098=_0x4af098||0xc8;return function(_0x3385c7){if(_0x3385c7){return _0x588543[_0x24fc('0x22')](_0x4af098)[_0x24fc('0x23')](_0x3385c7);}};}function respondWithFilteredResult(_0x25cb40,_0x52a884){return function(_0x23873c){if(_0x23873c){var _0x1cb3d0=typeof _0x52a884[_0x24fc('0x24')]===_0x24fc('0x25')&&typeof _0x52a884['limit']===_0x24fc('0x25');var _0x4073e0=_0x23873c[_0x24fc('0x26')];var _0x5b0516=_0x1cb3d0?0x0:_0x52a884[_0x24fc('0x24')];var _0x36a771=_0x1cb3d0?_0x23873c[_0x24fc('0x26')]:_0x52a884[_0x24fc('0x24')]+_0x52a884['limit'];var _0x323beb;if(_0x36a771>=_0x4073e0){_0x36a771=_0x4073e0;_0x323beb=0xc8;}else{_0x323beb=0xce;}_0x25cb40['status'](_0x323beb);return _0x25cb40[_0x24fc('0x27')]('Content-Range',_0x5b0516+'-'+_0x36a771+'/'+_0x4073e0)[_0x24fc('0x23')](_0x23873c);}return null;};}function patchUpdates(_0x44c121){return function(_0x2ffade){try{jsonpatch['apply'](_0x2ffade,_0x44c121,!![]);}catch(_0x313a25){return BPromise['reject'](_0x313a25);}return _0x2ffade[_0x24fc('0x28')]();};}function saveUpdates(_0x2bb93a,_0x36a9b4){return function(_0x34b5b2){if(_0x34b5b2){return _0x34b5b2[_0x24fc('0x29')](_0x2bb93a)[_0x24fc('0x2a')](function(_0x3f0875){return _0x3f0875;});}return null;};}function removeEntity(_0x20192b,_0x168d98){return function(_0x2a5c4b){if(_0x2a5c4b){return _0x2a5c4b['destroy']()[_0x24fc('0x2a')](function(){var _0x16f27f=_0x2a5c4b[_0x24fc('0x2b')]({'plain':!![]});var _0x5bb4c8=_0x24fc('0x2c');return db[_0x24fc('0x2d')][_0x24fc('0x2e')]({'where':{'type':_0x5bb4c8,'resourceId':_0x16f27f['id']}})[_0x24fc('0x2a')](function(){return _0x2a5c4b;});})[_0x24fc('0x2a')](function(){_0x20192b[_0x24fc('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240ae7,_0x29a461){return function(_0x3c99ed){if(!_0x3c99ed){_0x240ae7[_0x24fc('0x20')](0x194);}return _0x3c99ed;};}function handleError(_0x9f7bbc,_0x490aa5){_0x490aa5=_0x490aa5||0x1f4;return function(_0x55c27f){logger['error'](_0x55c27f[_0x24fc('0x2f')]);if(_0x55c27f['name']){delete _0x55c27f[_0x24fc('0x30')];}_0x9f7bbc[_0x24fc('0x22')](_0x490aa5)[_0x24fc('0x31')](_0x55c27f);};}exports[_0x24fc('0x32')]=function(_0x4dbd52,_0x66eec0){var _0x33f368={},_0x523c1f={},_0xf46cd5={'count':0x0,'rows':[]};var _0x1b174d=_['map'](db['VoicePrefix'][_0x24fc('0x33')],function(_0x56eae7){return{'name':_0x56eae7[_0x24fc('0x34')],'type':_0x56eae7[_0x24fc('0x35')]['key']};});_0x523c1f[_0x24fc('0x36')]=_[_0x24fc('0x37')](_0x1b174d,_0x24fc('0x30'));_0x523c1f[_0x24fc('0x38')]=_[_0x24fc('0x39')](_0x4dbd52[_0x24fc('0x38')]);_0x523c1f[_0x24fc('0x3a')]=_[_0x24fc('0x3b')](_0x523c1f[_0x24fc('0x36')],_0x523c1f['query']);_0x33f368[_0x24fc('0x3c')]=_[_0x24fc('0x3b')](_0x523c1f[_0x24fc('0x36')],qs[_0x24fc('0x3d')](_0x4dbd52[_0x24fc('0x38')]['fields']));_0x33f368['attributes']=_0x33f368[_0x24fc('0x3c')]['length']?_0x33f368[_0x24fc('0x3c')]:_0x523c1f[_0x24fc('0x36')];if(!_0x4dbd52[_0x24fc('0x38')][_0x24fc('0x3e')]('nolimit')){_0x33f368[_0x24fc('0x3f')]=qs['limit'](_0x4dbd52[_0x24fc('0x38')][_0x24fc('0x3f')]);_0x33f368[_0x24fc('0x24')]=qs[_0x24fc('0x24')](_0x4dbd52[_0x24fc('0x38')]['offset']);}_0x33f368[_0x24fc('0x40')]=qs[_0x24fc('0x41')](_0x4dbd52[_0x24fc('0x38')][_0x24fc('0x41')]);_0x33f368['where']=qs[_0x24fc('0x3a')](_[_0x24fc('0x42')](_0x4dbd52['query'],_0x523c1f[_0x24fc('0x3a')]),_0x1b174d);if(_0x4dbd52['query'][_0x24fc('0x43')]){_0x33f368[_0x24fc('0x44')]=_[_0x24fc('0x45')](_0x33f368[_0x24fc('0x44')],{'$or':_[_0x24fc('0x37')](_0x1b174d,function(_0x278b18){if(_0x278b18[_0x24fc('0x35')]!==_0x24fc('0x46')){var _0x4a18bb={};_0x4a18bb[_0x278b18[_0x24fc('0x30')]]={'$like':'%'+_0x4dbd52[_0x24fc('0x38')][_0x24fc('0x43')]+'%'};return _0x4a18bb;}})});}_0x33f368=_['merge']({},_0x33f368,_0x4dbd52[_0x24fc('0x47')]);var _0x1e3b52={'where':_0x33f368['where']};return db[_0x24fc('0x48')][_0x24fc('0x26')](_0x1e3b52)[_0x24fc('0x2a')](function(_0x5e4e9b){_0xf46cd5[_0x24fc('0x26')]=_0x5e4e9b;if(_0x4dbd52[_0x24fc('0x38')]['includeAll']){_0x33f368[_0x24fc('0x49')]=[{'all':!![]}];}return db[_0x24fc('0x48')][_0x24fc('0x4a')](_0x33f368);})[_0x24fc('0x2a')](function(_0x4c8dad){_0xf46cd5[_0x24fc('0x4b')]=_0x4c8dad;return _0xf46cd5;})[_0x24fc('0x2a')](respondWithFilteredResult(_0x66eec0,_0x33f368))[_0x24fc('0x4c')](handleError(_0x66eec0,null));};exports[_0x24fc('0x4d')]=function(_0xbcbcfa,_0x58a950){var _0x2a27e6={'raw':![],'where':{'id':_0xbcbcfa[_0x24fc('0x4e')]['id']}},_0x1b9c90={};_0x1b9c90[_0x24fc('0x36')]=_['keys'](db[_0x24fc('0x48')][_0x24fc('0x33')]);_0x1b9c90['query']=_['keys'](_0xbcbcfa[_0x24fc('0x38')]);_0x1b9c90['filters']=_['intersection'](_0x1b9c90[_0x24fc('0x36')],_0x1b9c90['query']);_0x2a27e6[_0x24fc('0x3c')]=_[_0x24fc('0x3b')](_0x1b9c90[_0x24fc('0x36')],qs['fields'](_0xbcbcfa[_0x24fc('0x38')][_0x24fc('0x3d')]));_0x2a27e6[_0x24fc('0x3c')]=_0x2a27e6[_0x24fc('0x3c')][_0x24fc('0x4f')]?_0x2a27e6[_0x24fc('0x3c')]:_0x1b9c90[_0x24fc('0x36')];if(_0xbcbcfa[_0x24fc('0x38')]['includeAll']){_0x2a27e6['include']=[{'all':!![]}];}_0x2a27e6=_[_0x24fc('0x45')]({},_0x2a27e6,_0xbcbcfa[_0x24fc('0x47')]);return db[_0x24fc('0x48')]['find'](_0x2a27e6)['then'](handleEntityNotFound(_0x58a950,null))[_0x24fc('0x2a')](respondWithResult(_0x58a950,null))[_0x24fc('0x4c')](handleError(_0x58a950,null));};exports[_0x24fc('0x2e')]=function(_0x134f64,_0x21f8b8){return db[_0x24fc('0x48')][_0x24fc('0x50')]({'where':{'id':_0x134f64[_0x24fc('0x4e')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x21f8b8,null))[_0x24fc('0x2a')](removeEntity(_0x21f8b8,null))[_0x24fc('0x4c')](handleError(_0x21f8b8,null));};exports[_0x24fc('0x51')]=function(_0x5ec1c0,_0x1c9a28){return db[_0x24fc('0x48')][_0x24fc('0x51')]()[_0x24fc('0x2a')](respondWithResult(_0x1c9a28,null))[_0x24fc('0x4c')](handleError(_0x1c9a28,null));};exports['create']=function(_0x428012,_0x4bf3a8){var _0x2c8f74;return db[_0x24fc('0x52')][_0x24fc('0x53')](function(_0x41ddfb){return db[_0x24fc('0x48')][_0x24fc('0x54')](_0x428012['body'],{'transaction':_0x41ddfb})[_0x24fc('0x2a')](function(_0xc2ba88){_0x2c8f74=_0xc2ba88[_0x24fc('0x2b')]({'plain':!![]});return db[_0x24fc('0x55')][_0x24fc('0x50')]({'where':{'id':_0x2c8f74[_0x24fc('0x56')]},'raw':!![]})['then'](function(_0x36d500){return createVoicePrefixExtensions(_0x2c8f74,_0x36d500,_0x41ddfb);});});})[_0x24fc('0x2a')](function(){var _0x1628b4=_0x428012[_0x24fc('0x57')][_0x24fc('0x2b')]({'plain':!![]});if(!_0x1628b4)throw new Error(_0x24fc('0x58'));if(_0x1628b4[_0x24fc('0x59')]==='user'){var _0xd673f8=_0x2c8f74;return db[_0x24fc('0x5a')]['find']({'where':{'name':_0x24fc('0x2c'),'userProfileId':_0x1628b4[_0x24fc('0x5b')]},'raw':!![]})[_0x24fc('0x2a')](function(_0x2ba959){if(_0x2ba959&&_0x2ba959[_0x24fc('0x5c')]===0x0){return db[_0x24fc('0x2d')]['create']({'name':_0xd673f8[_0x24fc('0x30')],'resourceId':_0xd673f8['id'],'type':_0x2ba959['name'],'sectionId':_0x2ba959['id']},{})[_0x24fc('0x2a')](function(){return _0x2c8f74;});}else{return _0x2c8f74;}})[_0x24fc('0x4c')](function(_0x50e5b0){logger[_0x24fc('0x5d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50e5b0);throw _0x50e5b0;});}return _0x2c8f74;})[_0x24fc('0x2a')](respondWithResult(_0x4bf3a8,null))['catch'](handleError(_0x4bf3a8,null));};function Extension(_0xdff811,_0x27b612,_0x57daaf,_0x2edef7){this['context']=_0x24fc('0x5e');this[_0x24fc('0x5f')]=_0xdff811;this['app']=_0x57daaf;this[_0x24fc('0x35')]=_0x24fc('0x60');this[_0x24fc('0x61')]=_0x24fc('0x62');this[_0x24fc('0x63')]=_0x27b612;this['appdata']=_0x2edef7;}function createVoicePrefixExtensions(_0x39da59,_0x2f62b0,_0x2d657a){return new BPromise(function(_0x2b5dca,_0x11d0e0){var _0x5e9c03=new Extension(formatPrefixName(_0x39da59['prefix']),0x1,_0x24fc('0x64'),_0x24fc('0x65'));_0x5e9c03['VoicePrefixId']=_0x39da59['id'];return db['VoiceExtension'][_0x24fc('0x54')](_0x5e9c03,{'transaction':_0x2d657a})[_0x24fc('0x2a')](function(_0x28ef6a){var _0x1c47cd=_0x28ef6a['get']({'plain':!![]});var _0x20973d=_[_0x24fc('0x37')](addVoicePrefixExtensions(_0x39da59,_0x2f62b0),function(_0x14427b){_0x14427b[_0x24fc('0x56')]=_0x1c47cd['id'];_0x14427b[_0x24fc('0x66')]=_0x39da59['id'];return _0x14427b;});return db[_0x24fc('0x55')][_0x24fc('0x67')](_0x20973d,{'transaction':_0x2d657a})[_0x24fc('0x2a')](function(_0xbe136e){if(!_0xbe136e){return _0x11d0e0(_0x24fc('0x68'));}else{return _0x2b5dca(_0xbe136e);}})[_0x24fc('0x4c')](function(_0x456690){return _0x11d0e0(_0x456690);});});;});};function addVoicePrefixExtensions(_0x8dbb4a,_0x24ca4b){var _0x354fc6=[];var _0x54ead5=formatPrefixName(_0x8dbb4a[_0x24fc('0x69')]);_0x354fc6[_0x24fc('0x6a')](new Extension(_0x54ead5,0x2,_0x24fc('0x6b'),_0x24fc('0x6c')+_0x8dbb4a[_0x24fc('0x30')]));if(_0x8dbb4a[_0x24fc('0x6d')]){_0x354fc6[_0x24fc('0x6a')](new Extension(_0x54ead5,0x3,_0x24fc('0x6b'),'PREFIX-CALLERIDALL='+_0x8dbb4a[_0x24fc('0x6d')]));}else{_0x354fc6[_0x24fc('0x6a')](new Extension(_0x54ead5,0x3,_0x24fc('0x64'),_0x24fc('0x6e')));}_0x354fc6['push'](new Extension(_0x54ead5,0x4,_0x24fc('0x6f'),_0x24ca4b[_0x24fc('0x70')]+','+'${EXTEN:'+(0x8+_0x8dbb4a['name']['length'])+'}'+','+0x1));return _0x354fc6;}function formatPrefixName(_0x2ae2ac){var _0x698283='_';for(var _0x246ef1=0x0;_0x246ef1<_0x2ae2ac[_0x24fc('0x4f')];_0x246ef1++){if(_0x2ae2ac[_0x24fc('0x71')](_0x246ef1)=='-'){_0x698283+=_0x2ae2ac[_0x24fc('0x71')](_0x246ef1);}else{_0x698283+='['+_0x2ae2ac['charAt'](_0x246ef1)+']';}}_0x698283+='.';return _0x698283;}exports[_0x24fc('0x29')]=function(_0x15e8a3,_0x5a2c09,_0x51b1c0){var _0xfc6b7f=_0x15e8a3[_0x24fc('0x72')];_0xfc6b7f[_0x24fc('0x69')]='system-'+_0xfc6b7f[_0x24fc('0x30')]+'-';return db[_0x24fc('0x52')][_0x24fc('0x53')](function(_0x4f5547){return db['VoicePrefix']['update'](_0xfc6b7f,{'where':{'id':_0xfc6b7f['id']},'transaction':_0x4f5547})['then'](function(){return db['VoiceExtension'][_0x24fc('0x2e')]({'where':{'VoicePrefixId':_0xfc6b7f['id']},'transaction':_0x4f5547})[_0x24fc('0x2a')](function(){return db[_0x24fc('0x55')][_0x24fc('0x50')]({'where':{'id':_0xfc6b7f['VoiceExtensionId']},'raw':!![]})[_0x24fc('0x2a')](function(_0x56dd0b){return createVoicePrefixExtensions(_0xfc6b7f,_0x56dd0b,_0x4f5547);});});});})[_0x24fc('0x2a')](function(){return db['VoicePrefix'][_0x24fc('0x73')](_0xfc6b7f['id']);})[_0x24fc('0x2a')](respondWithResult(_0x5a2c09,null))[_0x24fc('0x4c')](handleError(_0x5a2c09,null));};exports[_0x24fc('0x74')]=function(_0x3c4e2c,_0x291d60,_0x35c5f7){return db['VoicePrefix'][_0x24fc('0x50')]({'where':{'id':_0x3c4e2c[_0x24fc('0x4e')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x291d60,null))['then'](function(_0x5201e7){if(_0x5201e7){return _0x5201e7[_0x24fc('0x74')](_0x3c4e2c[_0x24fc('0x72')]['ids'],_[_0x24fc('0x75')](_0x3c4e2c[_0x24fc('0x72')],['ids','id'])||{})[_0x24fc('0x76')](function(_0x383503){for(var _0x5249ea=0x0;_0x5249ea<_0x3c4e2c[_0x24fc('0x72')][_0x24fc('0x77')][_0x24fc('0x4f')];_0x5249ea+=0x1){socket[_0x24fc('0x78')](_0x24fc('0x79'),{'UserId':Number(_0x3c4e2c[_0x24fc('0x72')]['ids'][_0x5249ea]),'VoicePrefixId':Number(_0x3c4e2c['params']['id'])});}return _0x383503;});}})[_0x24fc('0x2a')](respondWithResult(_0x291d60,null))['catch'](handleError(_0x291d60,null));};exports[_0x24fc('0x7a')]=function(_0x52d54e,_0x5233c5,_0x436652){return db[_0x24fc('0x48')][_0x24fc('0x50')]({'where':{'id':_0x52d54e[_0x24fc('0x4e')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0x5233c5,null))[_0x24fc('0x2a')](function(_0x44eb26){if(_0x44eb26){return _0x44eb26[_0x24fc('0x7a')](_0x52d54e['query'][_0x24fc('0x77')])[_0x24fc('0x2a')](function(){if(_['isArray'](_0x52d54e['query'][_0x24fc('0x77')])){for(var _0x3cb0b5=0x0;_0x3cb0b5<_0x52d54e[_0x24fc('0x38')][_0x24fc('0x77')][_0x24fc('0x4f')];_0x3cb0b5+=0x1){socket['emit'](_0x24fc('0x7b'),{'UserId':Number(_0x52d54e[_0x24fc('0x38')]['ids'][_0x3cb0b5]),'VoicePrefixId':Number(_0x52d54e[_0x24fc('0x4e')]['id'])});}}else{socket[_0x24fc('0x78')](_0x24fc('0x7b'),{'UserId':Number(_0x52d54e['query'][_0x24fc('0x77')]),'VoicePrefixId':Number(_0x52d54e[_0x24fc('0x4e')]['id'])});}});}})[_0x24fc('0x2a')](respondWithStatusCode(_0x5233c5,null))[_0x24fc('0x4c')](handleError(_0x5233c5,null));};exports[_0x24fc('0x7c')]=function(_0x1ce8cb,_0x17f88a,_0x46b320){var _0x188edb={};var _0x54f379={};var _0x7f4f80;var _0x2921a7;return db[_0x24fc('0x48')]['findOne']({'where':{'id':_0x1ce8cb['params']['id']}})['then'](handleEntityNotFound(_0x17f88a,null))[_0x24fc('0x2a')](function(_0x560c80){if(_0x560c80){_0x7f4f80=_0x560c80;_0x54f379[_0x24fc('0x36')]=_[_0x24fc('0x39')](db['User'][_0x24fc('0x33')]);_0x54f379['query']=_[_0x24fc('0x39')](_0x1ce8cb['query']);_0x54f379[_0x24fc('0x3a')]=_[_0x24fc('0x3b')](_0x54f379[_0x24fc('0x36')],_0x54f379[_0x24fc('0x38')]);_0x188edb[_0x24fc('0x3c')]=_[_0x24fc('0x3b')](_0x54f379['model'],qs[_0x24fc('0x3d')](_0x1ce8cb[_0x24fc('0x38')][_0x24fc('0x3d')]));_0x188edb[_0x24fc('0x3c')]=_0x188edb[_0x24fc('0x3c')][_0x24fc('0x4f')]?_0x188edb[_0x24fc('0x3c')]:_0x54f379[_0x24fc('0x36')];_0x188edb[_0x24fc('0x40')]=qs['sort'](_0x1ce8cb[_0x24fc('0x38')][_0x24fc('0x41')]);_0x188edb[_0x24fc('0x44')]=qs[_0x24fc('0x3a')](_['pick'](_0x1ce8cb[_0x24fc('0x38')],_0x54f379[_0x24fc('0x3a')]));if(_0x1ce8cb[_0x24fc('0x38')]['filter']){_0x188edb[_0x24fc('0x44')]=_['merge'](_0x188edb['where'],{'$or':_['map'](_0x188edb[_0x24fc('0x3c')],function(_0x49c35c){var _0x29f1c1={};_0x29f1c1[_0x49c35c]={'$like':'%'+_0x1ce8cb[_0x24fc('0x38')][_0x24fc('0x43')]+'%'};return _0x29f1c1;})});}_0x188edb=_[_0x24fc('0x45')]({},_0x188edb,_0x1ce8cb['options']);return _0x7f4f80[_0x24fc('0x7c')](_0x188edb);}})[_0x24fc('0x2a')](function(_0x3d8394){if(_0x3d8394){_0x2921a7=_0x3d8394[_0x24fc('0x4f')];if(!_0x1ce8cb[_0x24fc('0x38')]['hasOwnProperty'](_0x24fc('0x7d'))){_0x188edb[_0x24fc('0x3f')]=qs[_0x24fc('0x3f')](_0x1ce8cb[_0x24fc('0x38')]['limit']);_0x188edb['offset']=qs[_0x24fc('0x24')](_0x1ce8cb[_0x24fc('0x38')][_0x24fc('0x24')]);}return _0x7f4f80[_0x24fc('0x7c')](_0x188edb);}})[_0x24fc('0x2a')](function(_0x49e6f2){if(_0x49e6f2){return _0x49e6f2?{'count':_0x2921a7,'rows':_0x49e6f2}:null;}})[_0x24fc('0x2a')](respondWithResult(_0x17f88a,null))[_0x24fc('0x4c')](handleError(_0x17f88a,null));};exports[_0x24fc('0x7e')]=function(_0x5d5a59,_0xa8881f,_0x69a2cd){var _0x437233={};var _0x1e1474={};var _0xc52004;var _0x4c10d9;return db['VoicePrefix']['findOne']({'where':{'id':_0x5d5a59[_0x24fc('0x4e')]['id']}})[_0x24fc('0x2a')](handleEntityNotFound(_0xa8881f,null))[_0x24fc('0x2a')](function(_0x23a033){if(_0x23a033){_0xc52004=_0x23a033;_0x1e1474[_0x24fc('0x36')]=_[_0x24fc('0x39')](db[_0x24fc('0x7f')][_0x24fc('0x33')]);_0x1e1474[_0x24fc('0x38')]=_[_0x24fc('0x39')](_0x5d5a59[_0x24fc('0x38')]);_0x1e1474[_0x24fc('0x3a')]=_['intersection'](_0x1e1474['model'],_0x1e1474[_0x24fc('0x38')]);_0x437233['attributes']=_[_0x24fc('0x3b')](_0x1e1474[_0x24fc('0x36')],qs[_0x24fc('0x3d')](_0x5d5a59[_0x24fc('0x38')][_0x24fc('0x3d')]));_0x437233[_0x24fc('0x3c')]=_0x437233[_0x24fc('0x3c')][_0x24fc('0x4f')]?_0x437233[_0x24fc('0x3c')]:_0x1e1474['model'];_0x437233[_0x24fc('0x40')]=qs[_0x24fc('0x41')](_0x5d5a59['query']['sort']);_0x437233[_0x24fc('0x44')]=qs[_0x24fc('0x3a')](_[_0x24fc('0x42')](_0x5d5a59[_0x24fc('0x38')],_0x1e1474[_0x24fc('0x3a')]));if(_0x5d5a59[_0x24fc('0x38')]['filter']){_0x437233[_0x24fc('0x44')]=_[_0x24fc('0x45')](_0x437233[_0x24fc('0x44')],{'$or':_[_0x24fc('0x37')](_0x437233['attributes'],function(_0x2fb68a){var _0x10519f={};_0x10519f[_0x2fb68a]={'$like':'%'+_0x5d5a59[_0x24fc('0x38')]['filter']+'%'};return _0x10519f;})});}_0x437233=_[_0x24fc('0x45')]({},_0x437233,_0x5d5a59[_0x24fc('0x47')]);return _0xc52004[_0x24fc('0x7e')](_0x437233);}})['then'](function(_0x163a99){if(_0x163a99){_0x4c10d9=_0x163a99[_0x24fc('0x4f')];if(!_0x5d5a59['query']['hasOwnProperty'](_0x24fc('0x7d'))){_0x437233[_0x24fc('0x3f')]=qs[_0x24fc('0x3f')](_0x5d5a59[_0x24fc('0x38')][_0x24fc('0x3f')]);_0x437233[_0x24fc('0x24')]=qs['offset'](_0x5d5a59[_0x24fc('0x38')][_0x24fc('0x24')]);}return _0xc52004[_0x24fc('0x7e')](_0x437233);}})[_0x24fc('0x2a')](function(_0x6f8974){if(_0x6f8974){return _0x6f8974?{'count':_0x4c10d9,'rows':_0x6f8974}:null;}})[_0x24fc('0x2a')](respondWithResult(_0xa8881f,null))['catch'](handleError(_0xa8881f,null));};exports[_0x24fc('0x80')]=function(_0x4a2522,_0x5226aa,_0x260a62){var _0x19b426=_0x4a2522['body'][_0x24fc('0x77')];var _0x45e8da;return db[_0x24fc('0x7f')][_0x24fc('0x4a')]({'where':{'id':_0x19b426},'attributes':['id'],'include':[{'model':db['User'],'as':_0x24fc('0x81'),'attributes':['id',_0x24fc('0x30'),_0x24fc('0x82'),_0x24fc('0x83'),_0x24fc('0x84')],'raw':!![]}]})[_0x24fc('0x2a')](function(_0x4e31bd){if(_0x4e31bd){_0x45e8da=_0x4e31bd;var _0x492328=_['flatMap'](_0x4e31bd,function(_0xc4f001){var _0x3fb8fc=_0xc4f001['get']({'plain':!![]});return _0x3fb8fc[_0x24fc('0x81')];});return db[_0x24fc('0x48')][_0x24fc('0x50')]({'where':{'id':_0x4a2522['params']['id']}})[_0x24fc('0x2a')](function(_0x15dbba){return db['sequelize']['transaction'](function(_0x33c581){return _0x15dbba[_0x24fc('0x80')](_0x19b426,{'transaction':_0x33c581})[_0x24fc('0x2a')](function(){return BPromise['each'](_0x45e8da,function(_0x2e4e38){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x2e4e38['id'],'VoicePrefixId':_0x4a2522[_0x24fc('0x4e')]['id']},{'transaction':_0x33c581});});})['then'](function(){return BPromise['each'](_0x492328,function(_0x6dee4c){return db['UserVoicePrefix'][_0x24fc('0x85')]({'where':{'UserId':_0x6dee4c['id'],'VoicePrefixId':_0x4a2522[_0x24fc('0x4e')]['id']},'transaction':_0x33c581});});})[_0x24fc('0x2a')](function(){_0x492328[_0x24fc('0x86')](function(_0x4ae346){socket[_0x24fc('0x78')](_0x24fc('0x79'),{'UserId':_0x4ae346['id'],'VoicePrefixId':_0x15dbba['id']});});});});});}})['then'](respondWithStatusCode(_0x5226aa,null))[_0x24fc('0x4c')](handleError(_0x5226aa,null));};exports[_0x24fc('0x87')]=function(_0x30d523,_0x8b1efd,_0x2a19f9){return db['Team'][_0x24fc('0x4a')]({'where':{'id':_0x30d523[_0x24fc('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x24fc('0x88')],'as':_0x24fc('0x81'),'attributes':['id'],'raw':!![]}]})[_0x24fc('0x2a')](handleEntityNotFound(_0x8b1efd,null))[_0x24fc('0x2a')](function(_0x18197a){var _0x5aaa55=_[_0x24fc('0x37')](_0x18197a,'id');var _0x5d6e00=[];var _0x5c8969=[];var _0x42c158=squel[_0x24fc('0x89')]();_0x42c158[_0x24fc('0x8a')]('tq.TeamId')['from'](_0x24fc('0x8b'),'tq')[_0x24fc('0x8c')](_0x24fc('0x8d'),'ut',_0x24fc('0x8e'))[_0x24fc('0x44')](_0x24fc('0x8f'),_0x30d523[_0x24fc('0x4e')]['id']);for(var _0x1efb25=0x0;_0x1efb25<_0x18197a['length'];_0x1efb25+=0x1){let _0x5bbe2c=_0x18197a[_0x1efb25];for(var _0x316b8f=0x0;_0x316b8f<_0x5bbe2c['Agents']['length'];_0x316b8f+=0x1){let _0x1bf646=_0x5bbe2c[_0x24fc('0x81')][_0x316b8f];var _0x31c499=_0x42c158[_0x24fc('0x90')]();_0x31c499[_0x24fc('0x44')](_0x24fc('0x91'),_0x1bf646['id']);_0x5c8969[_0x24fc('0x6a')](db['sequelize'][_0x24fc('0x38')](_0x31c499[_0x24fc('0x92')](),{'type':db[_0x24fc('0x52')][_0x24fc('0x93')][_0x24fc('0x94')]})[_0x24fc('0x2a')](function(_0x3be176){if(_0x3be176[_0x24fc('0x4f')]===0x1){return _0x1bf646['id'];}else{var _0x9fd1b5=_[_0x24fc('0x95')](_[_0x24fc('0x37')](_0x3be176,_0x24fc('0x96')),function(_0x11ed4f){return _[_0x24fc('0x97')](_0x5aaa55,_0x11ed4f);});if(_0x9fd1b5){return _0x1bf646['id'];}}}));}}return BPromise[_0x24fc('0x98')](_0x5c8969)[_0x24fc('0x2a')](function(_0x29af09){_0x5d6e00=_(_0x5d6e00)[_0x24fc('0x99')](_0x29af09)[_0x24fc('0x9a')]()[_0x24fc('0x9b')]();return db[_0x24fc('0x48')][_0x24fc('0x50')]({'where':{'id':_0x30d523[_0x24fc('0x4e')]['id']}})[_0x24fc('0x2a')](function(_0x219be8){return db['sequelize'][_0x24fc('0x53')](function(_0x4217f0){return _0x219be8[_0x24fc('0x87')](_0x30d523[_0x24fc('0x38')]['ids'],{'transaction':_0x4217f0})['then'](function(){if(!_['isEmpty'](_0x5d6e00)){return _0x219be8[_0x24fc('0x7a')](_0x5d6e00,{'transaction':_0x4217f0});}})['then'](function(){_0x5d6e00[_0x24fc('0x86')](function(_0x49e026){socket[_0x24fc('0x78')](_0x24fc('0x7b'),{'UserId':_0x49e026,'VoicePrefixId':_0x219be8['id']});});});});});});})[_0x24fc('0x2a')](respondWithStatusCode(_0x8b1efd,null))[_0x24fc('0x4c')](handleError(_0x8b1efd,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 2db989f..04c4e00 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 _0x9a42=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x391fc7,_0x1e2b2c){var _0x4d2630=function(_0x23feef){while(--_0x23feef){_0x391fc7['push'](_0x391fc7['shift']());}};_0x4d2630(++_0x1e2b2c);}(_0x9a42,0x18b));var _0x29a4=function(_0x1f0e84,_0x49cdf2){_0x1f0e84=_0x1f0e84-0x0;var _0x1341e0=_0x9a42[_0x1f0e84];return _0x1341e0;};'use strict';var EventEmitter=require(_0x29a4('0x0'));var VoicePrefix=require(_0x29a4('0x1'))['db'][_0x29a4('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x29a4('0x3')](0x0);var events={'afterCreate':_0x29a4('0x4'),'afterUpdate':_0x29a4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x460efa){return function(_0x583fb9,_0x317a04,_0x3c2b2c){VoicePrefixEvents[_0x29a4('0x6')](_0x460efa+':'+_0x583fb9['id'],_0x583fb9);VoicePrefixEvents['emit'](_0x460efa,_0x583fb9);_0x3c2b2c(null);};}for(var e in events){if(events[_0x29a4('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x29a4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x4a77=['setMaxListeners','remove','emit','hasOwnProperty','../../mysqldb','VoicePrefix'];(function(_0x394514,_0x291743){var _0x4e3ed1=function(_0x4b3832){while(--_0x4b3832){_0x394514['push'](_0x394514['shift']());}};_0x4e3ed1(++_0x291743);}(_0x4a77,0x1ba));var _0x74a7=function(_0x318b2e,_0x41e795){_0x318b2e=_0x318b2e-0x0;var _0x3609bd=_0x4a77[_0x318b2e];return _0x3609bd;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x74a7('0x0'))['db'][_0x74a7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x74a7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x74a7('0x3')};function emitEvent(_0x537dc1){return function(_0x5f59ad,_0x5cf832,_0x30d8e1){VoicePrefixEvents[_0x74a7('0x4')](_0x537dc1+':'+_0x5f59ad['id'],_0x5f59ad);VoicePrefixEvents['emit'](_0x537dc1,_0x5f59ad);_0x30d8e1(null);};}for(var e in events){if(events[_0x74a7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index eab6bc6..d87565a 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 _0x3fbc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','lodash','util','../../config/logger','api'];(function(_0x2d4d68,_0x587132){var _0x887f0d=function(_0x202226){while(--_0x202226){_0x2d4d68['push'](_0x2d4d68['shift']());}};_0x887f0d(++_0x587132);}(_0x3fbc,0xb2));var _0xc3fb=function(_0x3f6b03,_0x92ad6e){_0x3f6b03=_0x3f6b03-0x0;var _0x2e9ad7=_0x3fbc[_0x3f6b03];return _0x2e9ad7;};'use strict';var _=require(_0xc3fb('0x0'));var util=require(_0xc3fb('0x1'));var logger=require(_0xc3fb('0x2'))(_0xc3fb('0x3'));var moment=require(_0xc3fb('0x4'));var BPromise=require(_0xc3fb('0x5'));var rp=require(_0xc3fb('0x6'));var fs=require('fs');var path=require(_0xc3fb('0x7'));var rimraf=require(_0xc3fb('0x8'));var config=require(_0xc3fb('0x9'));var attributes=require(_0xc3fb('0xa'));module[_0xc3fb('0xb')]=function(_0x43d604,_0x506905){return _0x43d604['define'](_0xc3fb('0xc'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fa8=['request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0fa8,0x6f));var _0x80fa=function(_0x187499,_0x5e416a){_0x187499=_0x187499-0x0;var _0x2965fe=_0x0fa8[_0x187499];return _0x2965fe;};'use strict';var _=require(_0x80fa('0x0'));var util=require(_0x80fa('0x1'));var logger=require(_0x80fa('0x2'))(_0x80fa('0x3'));var moment=require(_0x80fa('0x4'));var BPromise=require(_0x80fa('0x5'));var rp=require(_0x80fa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80fa('0x7'));var config=require(_0x80fa('0x8'));var attributes=require(_0x80fa('0x9'));module[_0x80fa('0xa')]=function(_0xa2e2b,_0x3fd1f2){return _0xa2e2b[_0x80fa('0xb')](_0x80fa('0xc'),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 14cdb44..cf7b5c2 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 _0xe9ef=['http','redis','socket.io-emitter','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x2a0898,_0xa101ce){var _0x2ee6e9=function(_0x109070){while(--_0x109070){_0x2a0898['push'](_0x2a0898['shift']());}};_0x2ee6e9(++_0xa101ce);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0xe9ef[_0x36b400];return _0x4d47bf;};'use strict';var _=require(_0xfe9e('0x0'));var util=require('util');var moment=require(_0xfe9e('0x1'));var BPromise=require(_0xfe9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe9e('0x4'));var logger=require(_0xfe9e('0x5'))(_0xfe9e('0x6'));var config=require(_0xfe9e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe9e('0x8')][_0xfe9e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfe9e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe9e('0xb'))(new Redis(config[_0xfe9e('0xa')]));require(_0xfe9e('0xc'))['register'](socket);function respondWithRpcPromise(_0x165c47,_0x210da6,_0xba1c64){return new BPromise(function(_0x5ab3bd,_0x1cc515){return client['request'](_0x165c47,_0xba1c64)[_0xfe9e('0xd')](function(_0x318158){logger[_0xfe9e('0xe')](_0xfe9e('0xf'),_0x210da6,_0xfe9e('0x10'));logger[_0xfe9e('0x11')](_0xfe9e('0x12'),_0x210da6,_0xfe9e('0x10'),JSON[_0xfe9e('0x13')](_0x318158));if(_0x318158['error']){if(_0x318158[_0xfe9e('0x14')][_0xfe9e('0x15')]===0x1f4){logger['error'](_0xfe9e('0xf'),_0x210da6,_0x318158[_0xfe9e('0x14')][_0xfe9e('0x16')]);return _0x1cc515(_0x318158[_0xfe9e('0x14')]['message']);}logger['error'](_0xfe9e('0xf'),_0x210da6,_0x318158[_0xfe9e('0x14')][_0xfe9e('0x16')]);return _0x5ab3bd(_0x318158[_0xfe9e('0x14')]['message']);}else{logger[_0xfe9e('0xe')](_0xfe9e('0xf'),_0x210da6,_0xfe9e('0x10'));_0x5ab3bd(_0x318158[_0xfe9e('0x17')]['message']);}})[_0xfe9e('0x18')](function(_0x114434){logger[_0xfe9e('0x14')](_0xfe9e('0xf'),_0x210da6,_0x114434);_0x1cc515(_0x114434);});});} \ No newline at end of file +var _0x1a85=['catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x262798,_0x16c1f4){var _0x313b56=function(_0x3b4517){while(--_0x3b4517){_0x262798['push'](_0x262798['shift']());}};_0x313b56(++_0x16c1f4);}(_0x1a85,0x178));var _0x51a8=function(_0x34404c,_0x49b8d1){_0x34404c=_0x34404c-0x0;var _0x46d1f2=_0x1a85[_0x34404c];return _0x46d1f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7af07a8..a5b66e5 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 _0x4876=['length','voicePrefix:','remove','emit','removeListener'];(function(_0x1c359c,_0x58f04f){var _0x15afa9=function(_0x21b63d){while(--_0x21b63d){_0x1c359c['push'](_0x1c359c['shift']());}};_0x15afa9(++_0x58f04f);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x6487('0x0'),'update'];function createListener(_0x502614,_0x236189){return function(_0x498e31){_0x236189[_0x6487('0x1')](_0x502614,_0x498e31);};}function removeListener(_0x2bace9,_0x192d3c){return function(){VoicePrefixEvents[_0x6487('0x2')](_0x2bace9,_0x192d3c);};}exports['register']=function(_0x23e50b){for(var _0x856b1c=0x0,_0x52177e=events[_0x6487('0x3')];_0x856b1c<_0x52177e;_0x856b1c++){var _0x14d6d8=events[_0x856b1c];var _0x2df3c1=createListener(_0x6487('0x4')+_0x14d6d8,_0x23e50b);VoicePrefixEvents['on'](_0x14d6d8,_0x2df3c1);}}; \ No newline at end of file +var _0x68fc=['emit','removeListener','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x68fc,0xa5));var _0xc68f=function(_0x5122be,_0x593c17){_0x5122be=_0x5122be-0x0;var _0x261b62=_0x68fc[_0x5122be];return _0x261b62;};'use strict';var VoicePrefixEvents=require(_0xc68f('0x0'));var events=[_0xc68f('0x1'),_0xc68f('0x2'),'update'];function createListener(_0x49aa95,_0x26513f){return function(_0x506fb5){_0x26513f[_0xc68f('0x3')](_0x49aa95,_0x506fb5);};}function removeListener(_0x593648,_0x5899ea){return function(){VoicePrefixEvents[_0xc68f('0x4')](_0x593648,_0x5899ea);};}exports[_0xc68f('0x5')]=function(_0x1c6df9){for(var _0x363cdf=0x0,_0x4fcce4=events['length'];_0x363cdf<_0x4fcce4;_0x363cdf++){var _0x9f2705=events[_0x363cdf];var _0x2bf3fd=createListener(_0xc68f('0x6')+_0x9f2705,_0x1c6df9);VoicePrefixEvents['on'](_0x9f2705,_0x2bf3fd);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b5d66c0..0cef068 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x534005,_0x62e0a2){var _0x568737=function(_0x532155){while(--_0x532155){_0x534005['push'](_0x534005['shift']());}};_0x568737(++_0x62e0a2);}(_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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0xb10b,0x12a));var _0xbb10=function(_0x35ec01,_0x5c44ac){_0x35ec01=_0x35ec01-0x0;var _0x4f75d5=_0xb10b[_0x35ec01];return _0x4f75d5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index bb2e7ef..cfe1274 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 _0xa971=['ENUM','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','dialMethod','preview','booked','INTEGER','yes','all','once','setDataValue','periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','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)','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)','#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\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#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','STRING','name','inbound','outbound','default'];(function(_0x42bf11,_0x117f15){var _0x3510aa=function(_0x3967d9){while(--_0x3967d9){_0x42bf11['push'](_0x42bf11['shift']());}};_0x3510aa(++_0x117f15);}(_0xa971,0xed));var _0x1a97=function(_0x33e07b,_0x2ff14c){_0x33e07b=_0x33e07b-0x0;var _0x2a5ea0=_0xa971[_0x33e07b];return _0x2a5ea0;};'use strict';var Sequelize=require(_0x1a97('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a97('0x1')],'allowNull':![],'unique':_0x1a97('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1a97('0x3'),_0x1a97('0x4')),'allowNull':![],'defaultValue':_0x1a97('0x3')},'musiconhold':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':_0x1a97('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x1a97('0x6')]('rr',_0x1a97('0x7'),'leastrecent',_0x1a97('0x8'),_0x1a97('0x9'),_0x1a97('0xa'),_0x1a97('0xb'),_0x1a97('0xc'),_0x1a97('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x5d46b7){this['setDataValue'](_0x1a97('0xe'),_0x5d46b7?_0x5d46b7:_0x1a97('0xa'));},'get':function(){var _0x4a0fc9=this[_0x1a97('0xf')]('type');var _0x550408=this['getDataValue'](_0x1a97('0x10'));var _0xdb26df=this[_0x1a97('0xf')](_0x1a97('0xe'));if(_0x4a0fc9===_0x1a97('0x4')){if(_0x550408===_0x1a97('0x11')){return null;}if(_0x550408===_0x1a97('0x12')&&!['rrmemory','roundrobin']['includes'](_0xdb26df)){this['setDataValue'](_0x1a97('0xe'),_0x1a97('0xa'));}}return _0xdb26df;}},'servicelevel':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1a97('0x13')](0xb)},'timeout':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1a97('0x1')]},'weight':{'type':Sequelize[_0x1a97('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1a97('0x6')]('yes','no'),'defaultValue':_0x1a97('0x14')},'autopause':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x14'),'no',_0x1a97('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x1a97('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1a97('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1a97('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x1a97('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1a97('0x6')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x14'),'no',_0x1a97('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1a97('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1a97('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x1a97('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x1a97('0x1')]},'queue_less_than':{'type':Sequelize[_0x1a97('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4e3ad1){this[_0x1a97('0x17')](_0x1a97('0x18'),_0x4e3ad1?_0x4e3ad1[_0x1a97('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0x1a97('0x18'))?this[_0x1a97('0xf')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':'yes','set':function(_0x447c52){this[_0x1a97('0x17')](_0x1a97('0x1a'),_0x447c52?_0x447c52['join'](','):undefined);},'get':function(){return this[_0x1a97('0xf')]('joinempty')?this[_0x1a97('0xf')](_0x1a97('0x1a'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xe3b5c1){this[_0x1a97('0x17')](_0x1a97('0x1b'),_0xe3b5c1?_0xe3b5c1[_0x1a97('0x19')](','):undefined);},'get':function(){return this[_0x1a97('0xf')](_0x1a97('0x1b'))?this[_0x1a97('0xf')](_0x1a97('0x1b'))[_0x1a97('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x1a97('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a97('0x1')]},'acw':{'type':Sequelize[_0x1a97('0x1d')],'defaultValue':0x0,'set':function(_0x24b483){this['setDataValue'](_0x1a97('0x1e'),_0x24b483);if(_0x24b483){if(this[_0x1a97('0xf')](_0x1a97('0x1f'))<0x2){this[_0x1a97('0x17')](_0x1a97('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1a97('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1a97('0x1d')],'defaultValue':0x0,'comment':_0x1a97('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0x1a97('0x11'),_0x1a97('0x21'),_0x1a97('0x22'),_0x1a97('0x23'),_0x1a97('0x12')),'defaultValue':'progressive','comment':_0x1a97('0x24')},'dialLimitChannel':{'type':Sequelize[_0x1a97('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x1a97('0x13')](0x4)[_0x1a97('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1a97('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x1a97('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1a97('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x1a97('0x6')](_0x1a97('0x28'),_0x1a97('0x29')),'defaultValue':_0x1a97('0x29'),'comment':_0x1a97('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x1a97('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1a97('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x1a97('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1a97('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1a97('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1a97('0x13')](0x3)[_0x1a97('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a97('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':'tTxX','comment':_0x1a97('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1a97('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a97('0x2f')},'dialQueueProject':{'type':Sequelize[_0x1a97('0x1')],'comment':_0x1a97('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1a97('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a97('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[_0x1a97('0x13')](0x3)[_0x1a97('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a97('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1a97('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1a97('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1a97('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a97('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1a97('0x35')},'dialTimezone':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':_0x1a97('0x36')},'dialPrefix':{'type':Sequelize[_0x1a97('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1a97('0x6')]('always',_0x1a97('0x37'),_0x1a97('0x38')),'defaultValue':_0x1a97('0x39')},'dialAMDActive':{'type':Sequelize[_0x1a97('0x1d')],'defaultValue':0x0,'comment':_0x1a97('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x1a97('0x13')](0x9)[_0x1a97('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1a97('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1a97('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1a97('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1a97('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1a97('0x13')](0x9)[_0x1a97('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1a97('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1a97('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1a97('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1a97('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1a97('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1a97('0x13')](0x9)[_0x1a97('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1a97('0x3f')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1a97('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x1a97('0x1d')],'defaultValue':0x0,'comment':_0x1a97('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1a97('0x6')]('DESC',_0x1a97('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x1a97('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1a97('0x13')](0x3)[_0x1a97('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a97('0x43')},'dialCutDigit':{'type':Sequelize[_0x1a97('0x13')](0x3)[_0x1a97('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a97('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1a97('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a97('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1a97('0x13')](0x3)[_0x1a97('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a97('0x45')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a97('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1a97('0x13')](0x3)[_0x1a97('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a97('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1a97('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a97('0x48')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1a97('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a97('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1a97('0x13')](0x5)[_0x1a97('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a97('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1a97('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a97('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1a97('0x13')](0x5)[_0x1a97('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a97('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a97('0x13')],'allowNull':!![],'comment':_0x1a97('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x1a97('0x1d')],'defaultValue':![],'comment':_0x1a97('0x4e'),'set':function(_0x5d9873){if(!_0x5d9873)this[_0x1a97('0x17')](_0x1a97('0x4f'),null);this[_0x1a97('0x17')](_0x1a97('0x50'),_0x5d9873);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1a97('0x13')](0x3)[_0x1a97('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1a97('0x13')](0x3)[_0x1a97('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1a97('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1a97('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1a97('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xbecd=['ringall','fewestcalls','random','rrmemory','linear','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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)','mandatoryDispositionPauseId','STRING','name','inbound','outbound','ENUM'];(function(_0x11b19f,_0x4cb2bf){var _0xc53c9d=function(_0x2bc447){while(--_0x2bc447){_0x11b19f['push'](_0x11b19f['shift']());}};_0xc53c9d(++_0x4cb2bf);}(_0xbecd,0x181));var _0xdbec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbecd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdbec('0x0')],'allowNull':![],'unique':_0xdbec('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xdbec('0x2'),_0xdbec('0x3')),'allowNull':![],'defaultValue':_0xdbec('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0xdbec('0x4')]('rr',_0xdbec('0x5'),'leastrecent',_0xdbec('0x6'),_0xdbec('0x7'),_0xdbec('0x8'),_0xdbec('0x9'),'wrandom',_0xdbec('0xa')),'allowNull':![],'defaultValue':_0xdbec('0x5'),'set':function(_0x32af41){this['setDataValue'](_0xdbec('0xb'),_0x32af41?_0x32af41:_0xdbec('0x8'));},'get':function(){var _0x375d97=this[_0xdbec('0xc')](_0xdbec('0xd'));var _0x3d70a7=this[_0xdbec('0xc')](_0xdbec('0xe'));var _0x354df9=this[_0xdbec('0xc')](_0xdbec('0xb'));if(_0x375d97===_0xdbec('0x3')){if(_0x3d70a7===_0xdbec('0xf')){return null;}if(_0x3d70a7===_0xdbec('0x10')&&![_0xdbec('0x8'),_0xdbec('0x11')][_0xdbec('0x12')](_0x354df9)){this[_0xdbec('0x13')](_0xdbec('0xb'),_0xdbec('0x8'));}}return _0x354df9;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xdbec('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xdbec('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xdbec('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xdbec('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xdbec('0x15'),'no'),'defaultValue':_0xdbec('0x15')},'autopause':{'type':Sequelize['ENUM'](_0xdbec('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xdbec('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xdbec('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xdbec('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xdbec('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xdbec('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdbec('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdbec('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xdbec('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xdbec('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xdbec('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0x15'),'no'),'defaultValue':_0xdbec('0x15')},'announce_holdtime':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0x15'),'no',_0xdbec('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xdbec('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdbec('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xdbec('0x0')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xdbec('0x0')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xdbec('0x17')],'set':function(_0x59e325){this[_0xdbec('0x13')](_0xdbec('0x18'),_0x59e325?_0x59e325[_0xdbec('0x19')](','):[]);},'get':function(){return this[_0xdbec('0xc')]('periodic_announce')?this[_0xdbec('0xc')](_0xdbec('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xdbec('0x15'),'set':function(_0x1ff329){this[_0xdbec('0x13')](_0xdbec('0x1a'),_0x1ff329?_0x1ff329['join'](','):undefined);},'get':function(){return this['getDataValue'](_0xdbec('0x1a'))?this[_0xdbec('0xc')](_0xdbec('0x1a'))[_0xdbec('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':'no','set':function(_0x194a14){this[_0xdbec('0x13')]('leavewhenempty',_0x194a14?_0x194a14[_0xdbec('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0xdbec('0x1c'))?this['getDataValue'](_0xdbec('0x1c'))[_0xdbec('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xdbec('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xdbec('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xdbec('0x0')]},'description':{'type':Sequelize[_0xdbec('0x0')]},'acw':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':0x0,'set':function(_0x3c4e4f){this['setDataValue'](_0xdbec('0x1e'),_0x3c4e4f);if(_0x3c4e4f){if(this['getDataValue'](_0xdbec('0x1f'))<0x2){this[_0xdbec('0x13')](_0xdbec('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xdbec('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0xf'),_0xdbec('0x20'),_0xdbec('0x21'),_0xdbec('0x22'),_0xdbec('0x10')),'defaultValue':'progressive','comment':_0xdbec('0x23')},'dialLimitChannel':{'type':Sequelize[_0xdbec('0x14')](0x4)[_0xdbec('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdbec('0x25')},'dialLimitQueue':{'type':Sequelize[_0xdbec('0x14')](0x4)[_0xdbec('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdbec('0x26')},'dialPowerLevel':{'type':Sequelize[_0xdbec('0x27')](0x2)[_0xdbec('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xdbec('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xdbec('0x29'),_0xdbec('0x2a')),'defaultValue':_0xdbec('0x2a'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xdbec('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xdbec('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdbec('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdbec('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbec('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':_0xdbec('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbec('0x2f')},'dialQueueProject':{'type':Sequelize[_0xdbec('0x0')],'comment':_0xdbec('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xdbec('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdbec('0x14')](0x5)[_0xdbec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbec('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbec('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdbec('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbec('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'defaultValue':0x3,'comment':_0xdbec('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdbec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdbec('0x35')},'dialTimezone':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xdbec('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xdbec('0x4')](_0xdbec('0x36'),_0xdbec('0x37'),_0xdbec('0x38')),'defaultValue':_0xdbec('0x36')},'dialAMDActive':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':0x0,'comment':_0xdbec('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xdbec('0x14')](0x9)[_0xdbec('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdbec('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xdbec('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdbec('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdbec('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdbec('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xdbec('0x14')](0x9)[_0xdbec('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdbec('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdbec('0x14')](0x9)[_0xdbec('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdbec('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdbec('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdbec('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xdbec('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdbec('0x14')](0x9)[_0xdbec('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xdbec('0x14')](0x5)[_0xdbec('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':0x0,'comment':_0xdbec('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdbec('0x4')]('DESC','ASC'),'defaultValue':_0xdbec('0x41')},'dialQueueProject2':{'type':Sequelize[_0xdbec('0x0')],'comment':_0xdbec('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdbec('0x42')},'dialCutDigit':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdbec('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbec('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdbec('0x14')](0x5)[_0xdbec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbec('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbec('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xdbec('0x14')](0x5)[_0xdbec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdbec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbec('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdbec('0x14')](0x5)[_0xdbec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbec('0x48')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbec('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdbec('0x14')](0x5)[_0xdbec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbec('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdbec('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdbec('0x14')](0x5)[_0xdbec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdbec('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1bce3f){if(!_0x1bce3f)this[_0xdbec('0x13')](_0xdbec('0x4d'),null);this[_0xdbec('0x13')]('mandatoryDisposition',_0x1bce3f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xdbec('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xdbec('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xdbec('0x14')](0x3)[_0xdbec('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xdbec('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 288f039..94618b7 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 _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x5c2511,_0x38f5fd){var _0x480bab=function(_0x4749e8){while(--_0x4749e8){_0x5c2511['push'](_0x5c2511['shift']());}};_0x480bab(++_0x38f5fd);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5a8087,_0x199c47){_0x5a8087=_0x5a8087-0x0;var _0x11e86e=_0x8ef6[_0x5a8087];return _0x11e86e;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file +var _0x7fbe=['send','VoiceQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','inbound','outbound','update','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','CmHopperHistory','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','emit','online','isNil','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','VoiceQueues','QueueCampaigns','filter','map','value','type','name','sendStatus','error'];(function(_0x2e49cc,_0x1f72a7){var _0xa0c6c1=function(_0x38b018){while(--_0x38b018){_0x2e49cc['push'](_0x2e49cc['shift']());}};_0xa0c6c1(++_0x1f72a7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x54d2bd,_0x57c539){_0x54d2bd=_0x54d2bd-0x0;var _0x34f0d4=_0x7fbe[_0x54d2bd];return _0x34f0d4;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe7fb('0x0'));var _=require(_0xe7fb('0x1'));var squel=require(_0xe7fb('0x2'));var Redis=require(_0xe7fb('0x3'));var qs=require(_0xe7fb('0x4'));var logger=require(_0xe7fb('0x5'))(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var db=require(_0xe7fb('0x8'))['db'];config[_0xe7fb('0x9')]=_[_0xe7fb('0xa')](config[_0xe7fb('0x9')],{'host':_0xe7fb('0xb'),'port':0x18eb});var socket=require(_0xe7fb('0xc'))(new Redis(config['redis']));require(_0xe7fb('0xd'))[_0xe7fb('0xe')](socket);function respondWithStatusCode(_0x1d0741,_0x190a7a){_0x190a7a=_0x190a7a||0xcc;return function(_0x4ba197){if(_0x4ba197){return _0x1d0741['sendStatus'](_0x190a7a);}return _0x1d0741[_0xe7fb('0xf')](_0x190a7a)[_0xe7fb('0x10')]();};}function respondWithResult(_0x41a514,_0x348a73){_0x348a73=_0x348a73||0xc8;return function(_0x2a2223){if(_0x2a2223){return _0x41a514[_0xe7fb('0xf')](_0x348a73)[_0xe7fb('0x11')](_0x2a2223);}};}function respondWithFilteredResult(_0x3c07f3,_0x325035){return function(_0x2fe8ab){if(_0x2fe8ab){var _0x2437d4=typeof _0x325035[_0xe7fb('0x12')]===_0xe7fb('0x13')&&typeof _0x325035[_0xe7fb('0x14')]===_0xe7fb('0x13');var _0x598729=_0x2fe8ab[_0xe7fb('0x15')];var _0x2225e5=_0x2437d4?0x0:_0x325035['offset'];var _0x30015a=_0x2437d4?_0x2fe8ab[_0xe7fb('0x15')]:_0x325035['offset']+_0x325035[_0xe7fb('0x14')];var _0x559129;if(_0x30015a>=_0x598729){_0x30015a=_0x598729;_0x559129=0xc8;}else{_0x559129=0xce;}_0x3c07f3[_0xe7fb('0xf')](_0x559129);return _0x3c07f3[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x2225e5+'-'+_0x30015a+'/'+_0x598729)[_0xe7fb('0x11')](_0x2fe8ab);}return null;};}function saveUpdates(_0x562262){return function(_0x892b0f){if(_0x892b0f){return _0x892b0f['update'](_0x562262)[_0xe7fb('0x18')](function(_0x546463){return _0x546463;});}return null;};}function removeEntity(_0x1e77fd){return function(_0x4708f7){if(_0x4708f7){return _0x4708f7[_0xe7fb('0x19')]()[_0xe7fb('0x18')](function(){var _0x5df1a1=_0x4708f7[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d1c87=[{'name':_0xe7fb('0x1b'),'value':'inbound','ignore':![]},{'name':_0xe7fb('0x1c'),'value':'outbound','ignore':![]}];var _0xa5af01=_(_0x5d1c87)[_0xe7fb('0x1d')]('ignore')[_0xe7fb('0x1e')](_0xe7fb('0x1f'))[_0xe7fb('0x1f')]();if(_['includes'](_0xa5af01,_0x5df1a1[_0xe7fb('0x20')])){return;}var _0x469ead=_['find'](_0x5d1c87,['value',_0x5df1a1['type']])[_0xe7fb('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x469ead,'resourceId':_0x5df1a1['id']}})[_0xe7fb('0x18')](function(){return _0x4708f7;});})[_0xe7fb('0x18')](function(){_0x1e77fd[_0xe7fb('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c930){return function(_0x2b69c4){if(!_0x2b69c4){_0x6c930[_0xe7fb('0x22')](0x194);}return _0x2b69c4;};}function handleError(_0x1ceed8,_0x392d75){_0x392d75=_0x392d75||0x1f4;return function(_0x16237a){logger[_0xe7fb('0x23')](_0x16237a['stack']);if(_0x16237a['name']){delete _0x16237a[_0xe7fb('0x21')];}_0x1ceed8[_0xe7fb('0xf')](_0x392d75)[_0xe7fb('0x24')](_0x16237a);};}exports['index']=function(_0xb1f2f4,_0x251807){var _0xd3fffe={};var _0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x1e')](db[_0xe7fb('0x25')][_0xe7fb('0x26')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x27')],'type':_0x4ce993[_0xe7fb('0x20')][_0xe7fb('0x28')]};});_0xd3fffe=qs['getOptions'](_0x219554,_0xb1f2f4);var _0x517d70={'where':_0xd3fffe[_0xe7fb('0x29')]};return db['VoiceQueue'][_0xe7fb('0x15')](_0x517d70)[_0xe7fb('0x18')](function(_0xe49053){_0x5f265f[_0xe7fb('0x15')]=_0xe49053;_0xd3fffe['include']=qs[_0xe7fb('0x2a')](_0xb1f2f4[_0xe7fb('0x2b')]);return db[_0xe7fb('0x25')][_0xe7fb('0x2c')](_0xd3fffe);})[_0xe7fb('0x18')](function(_0x480819){_0x5f265f[_0xe7fb('0x2d')]=_0x480819;return _0x5f265f;})[_0xe7fb('0x18')](respondWithFilteredResult(_0x251807,_0xd3fffe))[_0xe7fb('0x2e')](handleError(_0x251807,null));};exports[_0xe7fb('0x2f')]=function(_0x46f430,_0x25e925){var _0x1bc72d={'raw':![],'where':{'id':_0x46f430[_0xe7fb('0x30')]['id']}},_0x147eb1={};_0x147eb1['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')][_0xe7fb('0x26')]);_0x147eb1['query']=_[_0xe7fb('0x31')](_0x46f430[_0xe7fb('0x2b')]);_0x147eb1[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],_0x147eb1[_0xe7fb('0x2b')]);_0x1bc72d[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x147eb1[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x1bc72d[_0xe7fb('0x35')]=_0x1bc72d[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x1bc72d[_0xe7fb('0x35')]:_0x147eb1[_0xe7fb('0x34')];if(_0x46f430[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x1bc72d['include']=[{'all':!![]}];}_0x1bc72d=_[_0xe7fb('0x39')]({},_0x1bc72d,_0x46f430[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x1bc72d)['then'](handleEntityNotFound(_0x25e925,null))[_0xe7fb('0x18')](respondWithResult(_0x25e925,null))[_0xe7fb('0x2e')](handleError(_0x25e925,null));};exports[_0xe7fb('0x3c')]=function(_0x413a13,_0x49fe9d){return db[_0xe7fb('0x25')][_0xe7fb('0x3c')](_0x413a13[_0xe7fb('0x3d')],{})[_0xe7fb('0x18')](function(_0x468d16){var _0xb729fc=_0x413a13['user'][_0xe7fb('0x1a')]({'plain':!![]});if(!_0xb729fc)throw new Error(_0xe7fb('0x3e'));if(_0xb729fc[_0xe7fb('0x3f')]==='user'){var _0x36a341=_0x468d16[_0xe7fb('0x1a')]({'plain':!![]});var _0x5d42ac=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x900d67=_[_0xe7fb('0x3b')](_0x5d42ac,[_0xe7fb('0x1f'),_0x36a341['type']])[_0xe7fb('0x21')];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x900d67,'userProfileId':_0xb729fc[_0xe7fb('0x40')]},'raw':!![]})['then'](function(_0x108a16){if(_0x108a16&&_0x108a16[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x36a341['name'],'resourceId':_0x36a341['id'],'type':_0x108a16[_0xe7fb('0x21')],'sectionId':_0x108a16['id']},{})[_0xe7fb('0x18')](function(){return _0x468d16;});}else{return _0x468d16;}})[_0xe7fb('0x2e')](function(_0x56a84f){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x56a84f);throw _0x56a84f;});}return _0x468d16;})[_0xe7fb('0x18')](respondWithResult(_0x49fe9d,0xc9))[_0xe7fb('0x2e')](handleError(_0x49fe9d,null));};exports[_0xe7fb('0x44')]=function(_0x5a1ce1,_0x2eb999){var _0x4df4aa={'where':{'id':_0x5a1ce1[_0xe7fb('0x30')]['id']}},_0x2c72dd={};_0x2c72dd[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x25')]['rawAttributes']);_0x4df4aa[_0xe7fb('0x35')]=_['intersection'](_0x2c72dd['model'],qs[_0xe7fb('0x36')](_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4df4aa['attributes']=_0x4df4aa[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x4df4aa['attributes']:_0x2c72dd['model'];if(_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4df4aa[_0xe7fb('0x2a')]=[{'all':!![]}];}_0x4df4aa=_[_0xe7fb('0x39')]({},_0x4df4aa,_0x5a1ce1[_0xe7fb('0x3a')]);return db[_0xe7fb('0x25')][_0xe7fb('0x3b')](_0x4df4aa)[_0xe7fb('0x18')](handleEntityNotFound(_0x2eb999,null))['then'](function(_0x925a5e){if(_0x925a5e){var _0x5cc28f=_0x925a5e[_0xe7fb('0x1a')]({'plain':!![]});_0x5cc28f=qs[_0xe7fb('0x45')](_0x5cc28f,['id','createdAt',_0xe7fb('0x46')]);_0x5a1ce1['body']=_[_0xe7fb('0x45')](_0x5a1ce1['body'],['id',_0xe7fb('0x47'),'updatedAt']);return db[_0xe7fb('0x25')]['create'](_[_0xe7fb('0x39')](_0x5cc28f,_0x5a1ce1[_0xe7fb('0x3d')]),{'include':_0x5a1ce1[_0xe7fb('0x2b')][_0xe7fb('0x38')]?[{'all':!![]}]:undefined})[_0xe7fb('0x18')](function(_0x2f959d){var _0x2f4760=_0x5a1ce1['user']['get']({'plain':!![]});if(!_0x2f4760)throw new Error(_0xe7fb('0x3e'));if(_0x2f4760['role']==='user'){var _0x4c3eb7=_0x2f959d['get']({'plain':!![]});var _0x539252=[{'name':_0xe7fb('0x1b'),'value':_0xe7fb('0x48')},{'name':_0xe7fb('0x1c'),'value':_0xe7fb('0x49')}];var _0x59c92d=_[_0xe7fb('0x3b')](_0x539252,[_0xe7fb('0x1f'),_0x4c3eb7[_0xe7fb('0x20')]])['name'];return db['UserProfileSection'][_0xe7fb('0x3b')]({'where':{'name':_0x59c92d,'userProfileId':_0x2f4760[_0xe7fb('0x40')]},'raw':!![]})[_0xe7fb('0x18')](function(_0x4f4ba3){if(_0x4f4ba3&&_0x4f4ba3[_0xe7fb('0x41')]===0x0){return db[_0xe7fb('0x42')][_0xe7fb('0x3c')]({'name':_0x4c3eb7[_0xe7fb('0x21')],'resourceId':_0x4c3eb7['id'],'type':_0x4f4ba3['name'],'sectionId':_0x4f4ba3['id']},{})['then'](function(){return _0x2f959d;});}else{return _0x2f959d;}})[_0xe7fb('0x2e')](function(_0x3104c2){logger[_0xe7fb('0x23')](_0xe7fb('0x43'),_0x3104c2);throw _0x3104c2;});}return _0x2f959d;});}})[_0xe7fb('0x18')](respondWithResult(_0x2eb999,0xc9))['catch'](handleError(_0x2eb999,null));};exports[_0xe7fb('0x4a')]=function(_0x349a2a,_0x23755b){if(_0x349a2a['body']['id']){delete _0x349a2a['body']['id'];}return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x349a2a[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23755b,null))[_0xe7fb('0x18')](saveUpdates(_0x349a2a[_0xe7fb('0x3d')],null))['then'](respondWithResult(_0x23755b,null))[_0xe7fb('0x2e')](handleError(_0x23755b,null));};exports[_0xe7fb('0x19')]=function(_0x2cd4e5,_0x1aef59){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x2cd4e5['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1aef59,null))['then'](removeEntity(_0x1aef59,null))[_0xe7fb('0x2e')](handleError(_0x1aef59,null));};exports[_0xe7fb('0x4b')]=function(_0x116c7e,_0x1b24fd){var _0x5925e6={'raw':![],'where':{}};var _0x47ac92={};var _0x2789a4={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x116c7e[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x1b24fd,null))['then'](function(_0x4096d4){if(_0x4096d4){_0x47ac92['model']=_[_0xe7fb('0x31')](db['CmHopper']['rawAttributes']);_0x47ac92[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x116c7e[_0xe7fb('0x2b')]);_0x47ac92['filters']=_[_0xe7fb('0x33')](_0x47ac92[_0xe7fb('0x34')],_0x47ac92[_0xe7fb('0x2b')]);_0x5925e6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x47ac92['model'],qs[_0xe7fb('0x36')](_0x116c7e[_0xe7fb('0x2b')]['fields']));_0x5925e6[_0xe7fb('0x35')]=_0x5925e6[_0xe7fb('0x35')]['length']?_0x5925e6[_0xe7fb('0x35')]:_0x47ac92['model'];if(!_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x5925e6['limit']=qs[_0xe7fb('0x14')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x5925e6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0x5925e6[_0xe7fb('0x4f')]=qs['sort'](_0x116c7e['query'][_0xe7fb('0x50')]);_0x5925e6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x116c7e['query'],_0x47ac92[_0xe7fb('0x32')]));_0x5925e6[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4096d4['id'];if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x5925e6[_0xe7fb('0x29')]=_[_0xe7fb('0x39')](_0x5925e6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x5925e6[_0xe7fb('0x35')],function(_0x1ff5e7){var _0xf423ab={};_0xf423ab[_0x1ff5e7]={'$like':'%'+_0x116c7e[_0xe7fb('0x2b')]['filter']+'%'};return _0xf423ab;})});}_0x5925e6=_['merge']({},_0x5925e6,_0x116c7e[_0xe7fb('0x3a')]);return db[_0xe7fb('0x52')][_0xe7fb('0x15')]({'where':_0x5925e6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x562493){_0x2789a4[_0xe7fb('0x15')]=_0x562493;if(_0x116c7e[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x5925e6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x52')][_0xe7fb('0x2c')](_0x5925e6);})[_0xe7fb('0x18')](function(_0x1e6256){_0x2789a4[_0xe7fb('0x2d')]=_0x1e6256;return _0x2789a4;});}})['then'](respondWithFilteredResult(_0x1b24fd,_0x5925e6))[_0xe7fb('0x2e')](handleError(_0x1b24fd,null));};exports['getHopperHistories']=function(_0x279663,_0x2f13f2){var _0x2a2079={'raw':!![],'where':{}};var _0x31c159={};var _0x318d06={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x279663[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x2f13f2,null))[_0xe7fb('0x18')](function(_0x15d881){if(_0x15d881){_0x31c159[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x53')][_0xe7fb('0x26')]);_0x31c159[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x279663[_0xe7fb('0x2b')]);_0x31c159[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x31c159['model'],_0x31c159['query']);_0x2a2079['attributes']=_[_0xe7fb('0x33')](_0x31c159[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x279663[_0xe7fb('0x2b')]['fields']));_0x2a2079[_0xe7fb('0x35')]=_0x2a2079[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2a2079[_0xe7fb('0x35')]:_0x31c159['model'];if(!_0x279663[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2a2079[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2a2079['offset']=qs[_0xe7fb('0x12')](_0x279663['query'][_0xe7fb('0x12')]);}_0x2a2079['order']=qs[_0xe7fb('0x50')](_0x279663[_0xe7fb('0x2b')]['sort']);_0x2a2079[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x279663[_0xe7fb('0x2b')],_0x31c159['filters']));_0x2a2079[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x15d881['id'];if(_0x279663[_0xe7fb('0x2b')]['filter']){_0x2a2079[_0xe7fb('0x29')]=_['merge'](_0x2a2079['where'],{'$or':_['map'](_0x2a2079[_0xe7fb('0x35')],function(_0x27019a){var _0x4a8a65={};_0x4a8a65[_0x27019a]={'$like':'%'+_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4a8a65;})});}_0x2a2079=_[_0xe7fb('0x39')]({},_0x2a2079,_0x279663[_0xe7fb('0x3a')]);return db[_0xe7fb('0x53')][_0xe7fb('0x15')]({'where':_0x2a2079[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x42190e){_0x318d06[_0xe7fb('0x15')]=_0x42190e;if(_0x279663[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x2a2079[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x53')][_0xe7fb('0x2c')](_0x2a2079);})[_0xe7fb('0x18')](function(_0x3c5bd9){_0x318d06[_0xe7fb('0x2d')]=_0x3c5bd9;return _0x318d06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x2f13f2,_0x2a2079))[_0xe7fb('0x2e')](handleError(_0x2f13f2,null));};exports['getHopperFinals']=function(_0x47568c,_0x185ac0){var _0xc3958f={'raw':!![],'where':{}};var _0x1b8fdb={};var _0x19fe06={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x47568c['params']['id']}})['then'](handleEntityNotFound(_0x185ac0,null))[_0xe7fb('0x18')](function(_0x4e1865){if(_0x4e1865){_0x1b8fdb[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['CmHopperFinal'][_0xe7fb('0x26')]);_0x1b8fdb[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x47568c[_0xe7fb('0x2b')]);_0x1b8fdb[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x1b8fdb['model'],_0x1b8fdb[_0xe7fb('0x2b')]);_0xc3958f[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x1b8fdb[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x47568c[_0xe7fb('0x2b')]['fields']));_0xc3958f['attributes']=_0xc3958f['attributes'][_0xe7fb('0x37')]?_0xc3958f[_0xe7fb('0x35')]:_0x1b8fdb[_0xe7fb('0x34')];if(!_0x47568c['query'][_0xe7fb('0x4d')]('nolimit')){_0xc3958f[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0xc3958f['offset']=qs[_0xe7fb('0x12')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}_0xc3958f[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0xc3958f[_0xe7fb('0x29')]=qs['filters'](_['pick'](_0x47568c[_0xe7fb('0x2b')],_0x1b8fdb['filters']));_0xc3958f[_0xe7fb('0x29')][_0xe7fb('0x51')]=_0x4e1865['id'];if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0xc3958f['where']=_['merge'](_0xc3958f[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0xc3958f['attributes'],function(_0x21cb12){var _0x431d21={};_0x431d21[_0x21cb12]={'$like':'%'+_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x431d21;})});}_0xc3958f=_[_0xe7fb('0x39')]({},_0xc3958f,_0x47568c[_0xe7fb('0x3a')]);return db['CmHopperFinal'][_0xe7fb('0x15')]({'where':_0xc3958f[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x2607b9){_0x19fe06[_0xe7fb('0x15')]=_0x2607b9;if(_0x47568c[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0xc3958f[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x55')][_0xe7fb('0x2c')](_0xc3958f);})[_0xe7fb('0x18')](function(_0x3b1a90){_0x19fe06[_0xe7fb('0x2d')]=_0x3b1a90;return _0x19fe06;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x185ac0,_0xc3958f))[_0xe7fb('0x2e')](handleError(_0x185ac0,null));};exports[_0xe7fb('0x56')]=function(_0x27c100,_0x19e86f){var _0x4b4cf6={'raw':!![],'where':{}};var _0x173d85={};var _0xa1368a={'count':0x0,'rows':[]};return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x27c100['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x19e86f,null))[_0xe7fb('0x18')](function(_0x4ca09c){if(_0x4ca09c){_0x173d85[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x57')]['rawAttributes']);_0x173d85[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x27c100['query']);_0x173d85['filters']=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],_0x173d85[_0xe7fb('0x2b')]);_0x4b4cf6[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x173d85[_0xe7fb('0x34')],qs['fields'](_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x4b4cf6[_0xe7fb('0x35')]=_0x4b4cf6['attributes'][_0xe7fb('0x37')]?_0x4b4cf6[_0xe7fb('0x35')]:_0x173d85[_0xe7fb('0x34')];if(!_0x27c100[_0xe7fb('0x2b')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x4b4cf6[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x27c100['query'][_0xe7fb('0x14')]);_0x4b4cf6[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x27c100[_0xe7fb('0x2b')]['offset']);}_0x4b4cf6[_0xe7fb('0x4f')]=qs['sort'](_0x27c100[_0xe7fb('0x2b')]['sort']);_0x4b4cf6[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_['pick'](_0x27c100['query'],_0x173d85[_0xe7fb('0x32')]));_0x4b4cf6['where'][_0xe7fb('0x51')]=_0x4ca09c['id'];if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x4b4cf6[_0xe7fb('0x29')]=_['merge'](_0x4b4cf6[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x4b4cf6[_0xe7fb('0x35')],function(_0x27a822){var _0x5505e5={};_0x5505e5[_0x27a822]={'$like':'%'+_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x5505e5;})});}_0x4b4cf6=_[_0xe7fb('0x39')]({},_0x4b4cf6,_0x27c100[_0xe7fb('0x3a')]);return db[_0xe7fb('0x57')]['count']({'where':_0x4b4cf6[_0xe7fb('0x29')]})[_0xe7fb('0x18')](function(_0x54233){_0xa1368a[_0xe7fb('0x15')]=_0x54233;if(_0x27c100[_0xe7fb('0x2b')][_0xe7fb('0x38')]){_0x4b4cf6[_0xe7fb('0x2a')]=[{'all':!![]}];}return db[_0xe7fb('0x57')][_0xe7fb('0x2c')](_0x4b4cf6);})['then'](function(_0x795e32){_0xa1368a[_0xe7fb('0x2d')]=_0x795e32;return _0xa1368a;});}})[_0xe7fb('0x18')](respondWithFilteredResult(_0x19e86f,_0x4b4cf6))[_0xe7fb('0x2e')](handleError(_0x19e86f,null));};exports[_0xe7fb('0x58')]=function(_0x16f2b1,_0x3a8154){var _0x51335c={};var _0x4f4772={};var _0x4ef7b4;var _0x1bcee7;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x16f2b1['params']['id']}})['then'](handleEntityNotFound(_0x3a8154,null))[_0xe7fb('0x18')](function(_0x5bd869){if(_0x5bd869){_0x4ef7b4=_0x5bd869;_0x4f4772[_0xe7fb('0x34')]=_['keys'](db[_0xe7fb('0x59')][_0xe7fb('0x26')]);_0x4f4772[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x16f2b1[_0xe7fb('0x2b')]);_0x4f4772[_0xe7fb('0x32')]=_['intersection'](_0x4f4772[_0xe7fb('0x34')],_0x4f4772[_0xe7fb('0x2b')]);_0x51335c[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x4f4772[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x16f2b1[_0xe7fb('0x2b')]['fields']));_0x51335c[_0xe7fb('0x35')]=_0x51335c[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x51335c[_0xe7fb('0x35')]:_0x4f4772['model'];_0x51335c[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x51335c[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x16f2b1['query'],_0x4f4772['filters']));if(_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x51335c['where']=_[_0xe7fb('0x39')](_0x51335c['where'],{'$or':_[_0xe7fb('0x1e')](_0x51335c[_0xe7fb('0x35')],function(_0x220d72){var _0x5ea91d={};_0x5ea91d[_0x220d72]={'$like':'%'+_0x16f2b1['query'][_0xe7fb('0x1d')]+'%'};return _0x5ea91d;})});}_0x51335c=_['merge']({},_0x51335c,_0x16f2b1['options']);return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x3b073e){if(_0x3b073e){_0x1bcee7=_0x3b073e[_0xe7fb('0x37')];if(!_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x51335c[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x51335c[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x16f2b1[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x4ef7b4[_0xe7fb('0x58')](_0x51335c);}})[_0xe7fb('0x18')](function(_0x249d6f){if(_0x249d6f){return _0x249d6f?{'count':_0x1bcee7,'rows':_0x249d6f}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x3a8154,null))['catch'](handleError(_0x3a8154,null));};exports[_0xe7fb('0x5a')]=function(_0x19ebe2,_0x3406ed){var _0x1631cc=_0x19ebe2['body'][_0xe7fb('0x5b')];var _0x21ee89=_[_0xe7fb('0x1e')](_0x1631cc,'id');return db[_0xe7fb('0x59')][_0xe7fb('0x2c')]({'where':{'id':_0x21ee89},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe7fb('0x21'),'online','voicePause','interface'],'raw':!![]}]})[_0xe7fb('0x18')](function(_0x5a97c8){if(_0x5a97c8){var _0x503ae2=_['flatMap'](_0x5a97c8,function(_0x2ccf71){var _0x35be16=_0x2ccf71[_0xe7fb('0x1a')]({'plain':!![]});_0x35be16[_0xe7fb('0x5c')][_0xe7fb('0x5d')](function(_0x1db971){_0x1db971['penalty']=_['find'](_0x1631cc,{'id':_0x35be16['id']})[_0xe7fb('0x5e')];});return _0x35be16['Agents'];});return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x19ebe2[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x3891ed){return db[_0xe7fb('0x5f')]['transaction'](function(_0x4aa499){return _0x3891ed[_0xe7fb('0x5a')](_0x21ee89,{'transaction':_0x4aa499})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x1631cc,function(_0x7a7a6b){return db[_0xe7fb('0x61')][_0xe7fb('0x62')]({'TeamId':_0x7a7a6b['id'],'VoiceQueueId':_0x19ebe2['params']['id'],'penalty':_0x7a7a6b[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise[_0xe7fb('0x60')](_0x503ae2,function(_0x33d638){return db[_0xe7fb('0x63')]['findOrCreate']({'where':{'UserId':_0x33d638['id'],'VoiceQueueId':_0x19ebe2[_0xe7fb('0x30')]['id']},'defaults':{'penalty':_0x33d638[_0xe7fb('0x5e')]},'transaction':_0x4aa499});});})[_0xe7fb('0x18')](function(){return BPromise['each'](_['filter'](_0x503ae2,{'online':!![]}),function(_0x5d30ef){return db[_0xe7fb('0x64')]['upsert']({'membername':_0x5d30ef['name'],'UserId':_0x5d30ef['id'],'queue_name':_0x3891ed[_0xe7fb('0x21')],'VoiceQueueId':_0x3891ed['id'],'interface':_['isNil'](_0x5d30ef[_0xe7fb('0x65')])?util[_0xe7fb('0x66')](_0xe7fb('0x67'),_0x5d30ef[_0xe7fb('0x21')]):_0x5d30ef[_0xe7fb('0x65')],'paused':_0x5d30ef[_0xe7fb('0x68')]||![],'penalty':_0x5d30ef[_0xe7fb('0x5e')]},{'transaction':_0x4aa499});});})['then'](function(){_0x503ae2[_0xe7fb('0x5d')](function(_0x16e9d4){socket['emit'](_0xe7fb('0x69'),{'UserId':_0x16e9d4['id'],'VoiceQueueId':_0x3891ed['id']});});});});});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x3406ed,null))[_0xe7fb('0x2e')](handleError(_0x3406ed,null));};exports[_0xe7fb('0x6a')]=function(_0x366acb,_0x4d2c92){return db['Team'][_0xe7fb('0x2c')]({'where':{'id':_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xe7fb('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe7fb('0x18')](handleEntityNotFound(_0x4d2c92,null))[_0xe7fb('0x18')](function(_0x2e276c){var _0x4efcdc=_[_0xe7fb('0x1e')](_0x2e276c,'id');var _0x146fc9=[];var _0x470718=[];var _0x55048c=squel[_0xe7fb('0x6d')]();_0x55048c[_0xe7fb('0x6e')]('tq.TeamId')[_0xe7fb('0x6f')](_0xe7fb('0x70'),'tq')['join'](_0xe7fb('0x71'),'ut',_0xe7fb('0x72'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x366acb[_0xe7fb('0x30')]['id']);for(var _0x5d9b58=0x0;_0x5d9b58<_0x2e276c['length'];_0x5d9b58+=0x1){let _0x5986f1=_0x2e276c[_0x5d9b58];for(var _0x23ec12=0x0;_0x23ec12<_0x5986f1[_0xe7fb('0x5c')][_0xe7fb('0x37')];_0x23ec12+=0x1){let _0x36be03=_0x5986f1['Agents'][_0x23ec12];var _0x29de1e=_0x55048c[_0xe7fb('0x44')]();_0x29de1e['where']('ut.UserId\x20=\x20?',_0x36be03['id']);_0x470718[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x29de1e[_0xe7fb('0x75')](),{'type':db[_0xe7fb('0x5f')]['QueryTypes'][_0xe7fb('0x76')]})[_0xe7fb('0x18')](function(_0xe52155){if(_0xe52155['length']===0x1){return _0x36be03['id'];}else{var _0x20b1fc=_[_0xe7fb('0x77')](_['map'](_0xe52155,_0xe7fb('0x78')),function(_0x6ec6b6){return _[_0xe7fb('0x79')](_0x4efcdc,_0x6ec6b6);});if(_0x20b1fc){return _0x36be03['id'];}}}));}}return BPromise[_0xe7fb('0x7a')](_0x470718)['then'](function(_0x4ed327){_0x146fc9=_(_0x146fc9)[_0xe7fb('0x7b')](_0x4ed327)[_0xe7fb('0x7c')]()[_0xe7fb('0x1f')]();return db['VoiceQueue'][_0xe7fb('0x3b')]({'where':{'id':_0x366acb[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(_0x49fb4b){return db[_0xe7fb('0x5f')][_0xe7fb('0x7d')](function(_0x362fe1){return _0x49fb4b['removeTeams'](_0x366acb[_0xe7fb('0x2b')][_0xe7fb('0x6b')],{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){if(!_[_0xe7fb('0x7e')](_0x146fc9)){return _0x49fb4b[_0xe7fb('0x7f')](_0x146fc9,{'transaction':_0x362fe1})[_0xe7fb('0x18')](function(){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x366acb['params']['id'],'UserId':_0x146fc9},'transaction':_0x362fe1});});}})[_0xe7fb('0x18')](function(){_0x146fc9[_0xe7fb('0x5d')](function(_0x5dadac){socket['emit'](_0xe7fb('0x80'),{'UserId':_0x5dadac,'VoiceQueueId':_0x49fb4b['id']});});});});});});})[_0xe7fb('0x18')](respondWithStatusCode(_0x4d2c92,null))[_0xe7fb('0x2e')](handleError(_0x4d2c92,null));};exports[_0xe7fb('0x81')]=function(_0x4b58de,_0x4386ea){var _0x41c771,_0x489c9d;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4b58de[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x4386ea,null))[_0xe7fb('0x18')](function(_0x39fef6){if(_0x39fef6){_0x489c9d=_0x39fef6;return _0x39fef6[_0xe7fb('0x81')](_0x4b58de['body'][_0xe7fb('0x6b')],_['omit'](_0x4b58de[_0xe7fb('0x3d')],['ids','id'])||{})['spread'](function(_0x260067){for(var _0xed4af4=0x0;_0xed4af4<_0x4b58de[_0xe7fb('0x3d')][_0xe7fb('0x6b')][_0xe7fb('0x37')];_0xed4af4+=0x1){socket[_0xe7fb('0x82')](_0xe7fb('0x69'),{'UserId':Number(_0x4b58de['body'][_0xe7fb('0x6b')][_0xed4af4]),'VoiceQueueId':Number(_0x4b58de[_0xe7fb('0x30')]['id'])});}return _0x260067;});}})[_0xe7fb('0x18')](function(_0x19a7ec){_0x41c771=_0x19a7ec||[];if(_0x489c9d){return db[_0xe7fb('0x6c')][_0xe7fb('0x2c')]({'where':{'id':_0x4b58de[_0xe7fb('0x3d')]['ids']},'attributes':['id',_0xe7fb('0x21'),_0xe7fb('0x83'),_0xe7fb('0x68'),'interface'],'raw':!![]});}})[_0xe7fb('0x18')](function(_0x52c758){if(!_['isEmpty'](_0x52c758)){var _0x4930c6=[];for(var _0x1a3d44=0x0;_0x1a3d44<_0x52c758[_0xe7fb('0x37')];_0x1a3d44++){if(_0x52c758[_0x1a3d44]['online']){_0x4930c6[_0xe7fb('0x74')](db[_0xe7fb('0x64')]['upsert']({'membername':_0x52c758[_0x1a3d44]['name'],'UserId':_0x52c758[_0x1a3d44]['id'],'queue_name':_0x489c9d[_0xe7fb('0x21')],'VoiceQueueId':_0x489c9d['id'],'interface':_[_0xe7fb('0x84')](_0x52c758[_0x1a3d44][_0xe7fb('0x65')])?util['format'](_0xe7fb('0x67'),_0x52c758[_0x1a3d44][_0xe7fb('0x21')]):_0x52c758[_0x1a3d44]['interface'],'paused':_0x52c758[_0x1a3d44]['voicePause']||![],'penalty':_0x4b58de[_0xe7fb('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4930c6);}})['then'](function(){return _0x41c771;})[_0xe7fb('0x18')](respondWithResult(_0x4386ea,null))[_0xe7fb('0x2e')](handleError(_0x4386ea,null));};exports['removeAgents']=function(_0x35b5ad,_0x55c935){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x35b5ad[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x55c935,null))[_0xe7fb('0x18')](function(_0x4736bf){if(_0x4736bf){return _0x4736bf[_0xe7fb('0x7f')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])[_0xe7fb('0x18')](function(){if(_[_0xe7fb('0x85')](_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')])){for(var _0x5744a8=0x0;_0x5744a8<_0x35b5ad[_0xe7fb('0x2b')][_0xe7fb('0x6b')]['length'];_0x5744a8+=0x1){socket['emit'](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad['query'][_0xe7fb('0x6b')][_0x5744a8]),'VoiceQueueId':Number(_0x35b5ad[_0xe7fb('0x30')]['id'])});}}else{socket[_0xe7fb('0x82')](_0xe7fb('0x80'),{'UserId':Number(_0x35b5ad[_0xe7fb('0x2b')]['ids']),'VoiceQueueId':Number(_0x35b5ad['params']['id'])});}});}})[_0xe7fb('0x18')](function(_0x27b153){return db[_0xe7fb('0x64')][_0xe7fb('0x19')]({'where':{'VoiceQueueId':_0x35b5ad[_0xe7fb('0x30')]['id'],'UserId':_0x35b5ad['query'][_0xe7fb('0x6b')]}})['then'](function(){return _0x27b153;});})[_0xe7fb('0x18')](respondWithStatusCode(_0x55c935,null))[_0xe7fb('0x2e')](handleError(_0x55c935,null));};exports['getAgents']=function(_0x5d0f05,_0x519e35){var _0x16ae95={};var _0xb1a3fa={};var _0x59e676;var _0x577895;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x5d0f05['params']['id']}})['then'](handleEntityNotFound(_0x519e35,null))[_0xe7fb('0x18')](function(_0xe1613c){if(_0xe1613c){_0x59e676=_0xe1613c;_0xb1a3fa[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db['User'][_0xe7fb('0x26')]);_0xb1a3fa[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x5d0f05[_0xe7fb('0x2b')]);_0xb1a3fa[_0xe7fb('0x32')]=_['intersection'](_0xb1a3fa['model'],_0xb1a3fa[_0xe7fb('0x2b')]);_0x16ae95[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0xb1a3fa[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x5d0f05['query'][_0xe7fb('0x36')]));_0x16ae95['attributes']=_0x16ae95['attributes'][_0xe7fb('0x37')]?_0x16ae95[_0xe7fb('0x35')]:_0xb1a3fa[_0xe7fb('0x34')];_0x16ae95[_0xe7fb('0x4f')]=qs['sort'](_0x5d0f05[_0xe7fb('0x2b')]['sort']);_0x16ae95['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x5d0f05[_0xe7fb('0x2b')],_0xb1a3fa[_0xe7fb('0x32')]));if(_0x5d0f05[_0xe7fb('0x2b')]['filter']){_0x16ae95['where']=_[_0xe7fb('0x39')](_0x16ae95['where'],{'$or':_['map'](_0x16ae95[_0xe7fb('0x35')],function(_0x5763dd){var _0x4cab2f={};_0x4cab2f[_0x5763dd]={'$like':'%'+_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x4cab2f;})});}_0x16ae95=_[_0xe7fb('0x39')]({},_0x16ae95,_0x5d0f05[_0xe7fb('0x3a')]);return _0x59e676[_0xe7fb('0x86')](_0x16ae95);}})['then'](function(_0xcf6d2){if(_0xcf6d2){_0x577895=_0xcf6d2['length'];if(!_0x5d0f05['query'][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x16ae95[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x5d0f05[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x16ae95[_0xe7fb('0x12')]=qs['offset'](_0x5d0f05['query'][_0xe7fb('0x12')]);}return _0x59e676['getAgents'](_0x16ae95);}})[_0xe7fb('0x18')](function(_0x51ff1e){if(_0x51ff1e){return _0x51ff1e?{'count':_0x577895,'rows':_0x51ff1e}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x519e35,null))['catch'](handleError(_0x519e35,null));};exports[_0xe7fb('0x87')]=function(_0x4407ee,_0x56869b){var _0x2139e3={};var _0x2e0e13={};var _0x23e1db;var _0x2a2fa6;return db['VoiceQueue'][_0xe7fb('0x4c')]({'where':{'id':_0x4407ee[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x56869b,null))[_0xe7fb('0x18')](function(_0x454ef0){if(_0x454ef0){_0x23e1db=_0x454ef0;_0x2e0e13['model']=_[_0xe7fb('0x31')](db[_0xe7fb('0x64')][_0xe7fb('0x26')]);_0x2e0e13[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4407ee[_0xe7fb('0x2b')]);_0x2e0e13[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],_0x2e0e13[_0xe7fb('0x2b')]);_0x2139e3[_0xe7fb('0x35')]=_[_0xe7fb('0x33')](_0x2e0e13[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0x4407ee[_0xe7fb('0x2b')]['fields']));_0x2139e3['attributes']=_0x2139e3[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x2139e3[_0xe7fb('0x35')]:_0x2e0e13[_0xe7fb('0x34')];_0x2139e3[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x2139e3['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4407ee[_0xe7fb('0x2b')],_0x2e0e13[_0xe7fb('0x32')]));if(_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x2139e3['where']=_[_0xe7fb('0x39')](_0x2139e3[_0xe7fb('0x29')],{'$or':_['map'](_0x2139e3[_0xe7fb('0x35')],function(_0x5dde83){var _0x21d86e={};_0x21d86e[_0x5dde83]={'$like':'%'+_0x4407ee['query'][_0xe7fb('0x1d')]+'%'};return _0x21d86e;})});}_0x2139e3=_[_0xe7fb('0x39')]({},_0x2139e3,_0x4407ee['options']);return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})[_0xe7fb('0x18')](function(_0x5892cd){if(_0x5892cd){_0x2a2fa6=_0x5892cd['length'];if(!_0x4407ee['query']['hasOwnProperty'](_0xe7fb('0x4e'))){_0x2139e3[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x2139e3[_0xe7fb('0x12')]=qs['offset'](_0x4407ee[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x23e1db[_0xe7fb('0x87')](_0x2139e3);}})['then'](function(_0x3c56ad){return _0x3c56ad?{'count':_0x2a2fa6,'rows':_0x3c56ad}:null;})['then'](respondWithResult(_0x56869b,null))[_0xe7fb('0x2e')](handleError(_0x56869b,null));};exports['getLists']=function(_0x4880a7,_0x27669f){var _0x3d8b9a={};var _0x3503ac={};var _0x413843;var _0x55ce0f;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0x4880a7[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x27669f,null))[_0xe7fb('0x18')](function(_0x21d9b0){if(_0x21d9b0){_0x413843=_0x21d9b0;_0x3503ac[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x3503ac[_0xe7fb('0x2b')]=_[_0xe7fb('0x31')](_0x4880a7[_0xe7fb('0x2b')]);_0x3503ac[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],_0x3503ac[_0xe7fb('0x2b')]);_0x3d8b9a['attributes']=_[_0xe7fb('0x33')](_0x3503ac[_0xe7fb('0x34')],qs['fields'](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x36')]));_0x3d8b9a[_0xe7fb('0x35')]=_0x3d8b9a['attributes'][_0xe7fb('0x37')]?_0x3d8b9a[_0xe7fb('0x35')]:_0x3503ac[_0xe7fb('0x34')];_0x3d8b9a[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x4880a7[_0xe7fb('0x2b')]['sort']);_0x3d8b9a[_0xe7fb('0x29')]=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0x4880a7['query'],_0x3503ac[_0xe7fb('0x32')]));if(_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x1d')]){_0x3d8b9a[_0xe7fb('0x29')]=_['merge'](_0x3d8b9a[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x3d8b9a[_0xe7fb('0x35')],function(_0x39ffed){var _0x47e833={};_0x47e833[_0x39ffed]={'$like':'%'+_0x4880a7['query'][_0xe7fb('0x1d')]+'%'};return _0x47e833;})});}_0x3d8b9a=_[_0xe7fb('0x39')]({},_0x3d8b9a,_0x4880a7[_0xe7fb('0x3a')]);return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})['then'](function(_0x57750a){if(_0x57750a){_0x55ce0f=_0x57750a[_0xe7fb('0x37')];if(!_0x4880a7['query'][_0xe7fb('0x4d')]('nolimit')){_0x3d8b9a[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x3d8b9a[_0xe7fb('0x12')]=qs[_0xe7fb('0x12')](_0x4880a7[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x413843[_0xe7fb('0x89')](_0x3d8b9a);}})[_0xe7fb('0x18')](function(_0x14014d){if(_0x14014d){return _0x14014d?{'count':_0x55ce0f,'rows':_0x14014d}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x27669f,null))[_0xe7fb('0x2e')](handleError(_0x27669f,null));};exports[_0xe7fb('0x8a')]=function(_0x4d9a76,_0x23a49e){var _0x30651f=moment()[_0xe7fb('0x66')](_0xe7fb('0x8b'));var _0x582862,_0x5b6da5;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x4d9a76[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x23a49e,null))['then'](function(_0x4e09d8){if(_0x4e09d8){_0x5b6da5=_0x4e09d8;return _0x4e09d8[_0xe7fb('0x8a')](_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x6b')],_[_0xe7fb('0x45')](_0x4d9a76[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x2e2167){var _0xd7f440;_0x582862=_0x2e2167||[];var _0xc8055f=[];if(_0x2e2167){for(var _0x45b449=0x0;_0x45b449<_0x2e2167['length'];_0x45b449+=0x1){var _0x366c06=_0x2e2167[_0x45b449][_0xe7fb('0x1a')]({'plain':!![]});_0x5b6da5[_0xe7fb('0x8d')]=_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]?_0x4d9a76[_0xe7fb('0x3d')][_0xe7fb('0x8d')]:_0x5b6da5[_0xe7fb('0x8d')];switch(_0x5b6da5['dialCheckDuplicateType']){case _0xe7fb('0x8e'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))['fromQuery']([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()['field'](_0xe7fb('0x92'),_0xe7fb('0x92'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))['field']('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x4d9a76[_0xe7fb('0x30')]['id']['toString'](),'VoiceQueueId')[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27','createdAt')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')]('cm_contacts')[_0xe7fb('0x29')](_0xe7fb('0x97'))['where'](_0xe7fb('0x98'),_0x366c06['CmListId'][_0xe7fb('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7fb('0x29')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe7fb('0x6e')](_0xe7fb('0x99'))['from'](_0xe7fb('0x9a'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')]()))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel['select']()['field'](_0xe7fb('0x9c'))['from']('cm_hopper')[_0xe7fb('0x29')]('VoiceQueueId\x20=\x20?',_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;case _0xe7fb('0x9d'):_0xd7f440=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),'scheduledAt',_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x92'),_0xe7fb('0x92'))['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))['field'](_0x4d9a76['params']['id']['toString'](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06['CmListId']['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0'))[_0xe7fb('0x29')](_0xe7fb('0x9b'),squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0x9c'))['from'](_0xe7fb('0x91'))[_0xe7fb('0x29')](_0xe7fb('0x73'),_0x4d9a76['params']['id'][_0xe7fb('0x75')]())))['toString']();break;default:_0xd7f440=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0x91'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x93'),_0xe7fb('0x94'),'ListId',_0xe7fb('0x51'),'createdAt','updatedAt'],squel['select']()[_0xe7fb('0x6e')]('phone','phone')['field']('\x27'+_0x30651f+'\x27',_0xe7fb('0x93'))[_0xe7fb('0x6e')]('id','ContactId')[_0xe7fb('0x6e')](_0x366c06[_0xe7fb('0x96')]['toString'](),_0xe7fb('0x95'))['field'](_0x4d9a76[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),_0xe7fb('0x51'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))['where'](_0xe7fb('0x97'))[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x366c06[_0xe7fb('0x96')]['toString']())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();}_0xc8055f['push'](db[_0xe7fb('0x5f')]['query'](_0xd7f440));}return BPromise[_0xe7fb('0x7a')](_0xc8055f);}})[_0xe7fb('0x18')](function(){var _0x20b22f=[];var _0x2e22c1=squel[_0xe7fb('0x8f')]()['into'](_0xe7fb('0xa1'))['fromQuery']([_0xe7fb('0xa2'),_0xe7fb('0x92'),_0xe7fb('0xa3'),'createdAt',_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')](_0xe7fb('0xa4'))[_0xe7fb('0x6e')]('ci.item')[_0xe7fb('0x6e')](_0xe7fb('0xa5'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x47'))[_0xe7fb('0x6e')]('\x27'+_0x30651f+'\x27',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0xa6'),'ci')[_0xe7fb('0xa7')]('cm_hopper','h',_0xe7fb('0xa8'))[_0xe7fb('0x29')]('h.scheduledat=?',_0x30651f)[_0xe7fb('0x29')]('ci.ItemClass=?',_0xe7fb('0xa9')))[_0xe7fb('0x75')]();_0x20b22f[_0xe7fb('0x74')](db[_0xe7fb('0x5f')][_0xe7fb('0x2b')](_0x2e22c1));return BPromise[_0xe7fb('0x7a')](_0x20b22f);})[_0xe7fb('0x18')](function(){return _0x582862;})['then'](respondWithResult(_0x23a49e,null))[_0xe7fb('0x2e')](handleError(_0x23a49e,null));};exports[_0xe7fb('0xaa')]=function(_0x3c04f4,_0x290cc3){return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x3c04f4['params']['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x290cc3,null))[_0xe7fb('0x18')](function(_0x3ed48f){if(_0x3ed48f){return _0x3ed48f['removeLists'](_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')]);}})[_0xe7fb('0x18')](function(_0x2eeff4){if(_0x2eeff4){return db[_0xe7fb('0x52')]['destroy']({'where':{'ListId':_0x3c04f4[_0xe7fb('0x2b')][_0xe7fb('0x6b')],'VoiceQueueId':_0x3c04f4[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x2eeff4;});}})[_0xe7fb('0x18')](respondWithStatusCode(_0x290cc3,null))[_0xe7fb('0x2e')](handleError(_0x290cc3,null));};exports[_0xe7fb('0xab')]=function(_0xcaad94,_0x5b88bd){var _0x143dbb={};var _0x715444={};var _0x92a316;var _0x30a834;return db[_0xe7fb('0x25')][_0xe7fb('0x4c')]({'where':{'id':_0xcaad94[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](handleEntityNotFound(_0x5b88bd,null))[_0xe7fb('0x18')](function(_0x1b1818){if(_0x1b1818){_0x92a316=_0x1b1818;_0x715444[_0xe7fb('0x34')]=_[_0xe7fb('0x31')](db[_0xe7fb('0x88')][_0xe7fb('0x26')]);_0x715444[_0xe7fb('0x2b')]=_['keys'](_0xcaad94[_0xe7fb('0x2b')]);_0x715444[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],_0x715444[_0xe7fb('0x2b')]);_0x143dbb['attributes']=_[_0xe7fb('0x33')](_0x715444[_0xe7fb('0x34')],qs[_0xe7fb('0x36')](_0xcaad94['query']['fields']));_0x143dbb[_0xe7fb('0x35')]=_0x143dbb[_0xe7fb('0x35')][_0xe7fb('0x37')]?_0x143dbb[_0xe7fb('0x35')]:_0x715444['model'];_0x143dbb[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x50')]);_0x143dbb['where']=qs[_0xe7fb('0x32')](_[_0xe7fb('0x54')](_0xcaad94['query'],_0x715444[_0xe7fb('0x32')]));if(_0xcaad94[_0xe7fb('0x2b')]['filter']){_0x143dbb['where']=_[_0xe7fb('0x39')](_0x143dbb[_0xe7fb('0x29')],{'$or':_[_0xe7fb('0x1e')](_0x143dbb['attributes'],function(_0x3b2375){var _0x170347={};_0x170347[_0x3b2375]={'$like':'%'+_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x1d')]+'%'};return _0x170347;})});}_0x143dbb=_['merge']({},_0x143dbb,_0xcaad94[_0xe7fb('0x3a')]);return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x2a984e){if(_0x2a984e){_0x30a834=_0x2a984e[_0xe7fb('0x37')];if(!_0xcaad94[_0xe7fb('0x2b')]['hasOwnProperty']('nolimit')){_0x143dbb[_0xe7fb('0x14')]=qs[_0xe7fb('0x14')](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x14')]);_0x143dbb[_0xe7fb('0x12')]=qs['offset'](_0xcaad94[_0xe7fb('0x2b')][_0xe7fb('0x12')]);}return _0x92a316[_0xe7fb('0xab')](_0x143dbb);}})[_0xe7fb('0x18')](function(_0x286382){if(_0x286382){return _0x286382?{'count':_0x30a834,'rows':_0x286382}:null;}})[_0xe7fb('0x18')](respondWithResult(_0x5b88bd,null))[_0xe7fb('0x2e')](handleError(_0x5b88bd,null));};exports[_0xe7fb('0xac')]=function(_0x325c7b,_0x38472b){var _0x1a33f8;return db[_0xe7fb('0x25')][_0xe7fb('0x3b')]({'where':{'id':_0x325c7b[_0xe7fb('0x30')]['id']}})['then'](handleEntityNotFound(_0x38472b,null))[_0xe7fb('0x18')](function(_0x291a8d){if(_0x291a8d){return _0x291a8d['addBlackLists'](_0x325c7b[_0xe7fb('0x3d')]['ids'],_[_0xe7fb('0x45')](_0x325c7b[_0xe7fb('0x3d')],[_0xe7fb('0x6b'),'id'])||{});}return null;})[_0xe7fb('0x8c')](function(_0x3ade81){var _0x1b9ea2;_0x1a33f8=_0x3ade81||[];var _0x418561=[];if(_0x3ade81){for(var _0x3ec66a=0x0;_0x3ec66a<_0x3ade81[_0xe7fb('0x37')];_0x3ec66a+=0x1){var _0x1c76a1=_0x3ade81[_0x3ec66a][_0xe7fb('0x1a')]({'plain':!![]});_0x1b9ea2=squel[_0xe7fb('0x8f')]()[_0xe7fb('0x90')](_0xe7fb('0xad'))[_0xe7fb('0x9e')]([_0xe7fb('0x92'),_0xe7fb('0x94'),_0xe7fb('0x95'),_0xe7fb('0x51'),_0xe7fb('0x47'),_0xe7fb('0x46')],squel[_0xe7fb('0x6d')]()[_0xe7fb('0x6e')]('phone',_0xe7fb('0x92'))[_0xe7fb('0x6e')]('id',_0xe7fb('0x94'))['field'](_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')](),_0xe7fb('0x95'))[_0xe7fb('0x6e')](_0x325c7b[_0xe7fb('0x30')]['id'][_0xe7fb('0x75')](),'VoiceQueueId')[_0xe7fb('0x6e')](_0xe7fb('0xae'),_0xe7fb('0x47'))[_0xe7fb('0x6e')]('NOW()',_0xe7fb('0x46'))[_0xe7fb('0x6f')](_0xe7fb('0x9f'))[_0xe7fb('0x29')]('deletedAt\x20IS\x20NULL')[_0xe7fb('0x29')](_0xe7fb('0x98'),_0x1c76a1[_0xe7fb('0x96')][_0xe7fb('0x75')]())[_0xe7fb('0x29')](_0xe7fb('0xa0')))['toString']();_0x418561[_0xe7fb('0x74')](db[_0xe7fb('0x5f')]['query'](_0x1b9ea2));}return BPromise[_0xe7fb('0x7a')](_0x418561);}})[_0xe7fb('0x18')](function(){return _0x1a33f8;})['then'](respondWithResult(_0x38472b,null))[_0xe7fb('0x2e')](handleError(_0x38472b,null));};exports['removeBlackLists']=function(_0x127051,_0x4d9376){return db[_0xe7fb('0x25')]['find']({'where':{'id':_0x127051['params']['id']}})['then'](handleEntityNotFound(_0x4d9376,null))['then'](function(_0x547d29){if(_0x547d29){return _0x547d29[_0xe7fb('0xaf')](_0x127051[_0xe7fb('0x2b')]['ids']);}})[_0xe7fb('0x18')](function(_0x5c0baf){if(_0x5c0baf){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x127051['query'][_0xe7fb('0x6b')],'VoiceQueueId':_0x127051[_0xe7fb('0x30')]['id']}})[_0xe7fb('0x18')](function(){return _0x5c0baf;});}})['then'](respondWithStatusCode(_0x4d9376,null))[_0xe7fb('0x2e')](handleError(_0x4d9376,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1c744ce..01207c8 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 _0x24ca=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x183f6f,_0x53195a){var _0x1637ef=function(_0x1b228e){while(--_0x1b228e){_0x183f6f['push'](_0x183f6f['shift']());}};_0x1637ef(++_0x53195a);}(_0x24ca,0x161));var _0xa24c=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x24ca[_0x450689];return _0x46ffb0;};'use strict';var EventEmitter=require(_0xa24c('0x0'));var VoiceQueue=require(_0xa24c('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa24c('0x2')](0x0);var events={'afterCreate':_0xa24c('0x3'),'afterUpdate':_0xa24c('0x4'),'afterDestroy':_0xa24c('0x5')};function emitEvent(_0x412c4b){return function(_0x117f64,_0x3ad9f4,_0xb40f2c){VoiceQueueEvents[_0xa24c('0x6')](_0x412c4b+':'+_0x117f64['id'],_0x117f64);VoiceQueueEvents['emit'](_0x412c4b,_0x117f64);_0xb40f2c(null);};}for(var e in events){if(events[_0xa24c('0x7')](e)){var event=events[e];VoiceQueue[_0xa24c('0x8')](e,emitEvent(event));}}module[_0xa24c('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x6b77=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x6b77,0x145));var _0x76b7=function(_0x5944af,_0x31cbab){_0x5944af=_0x5944af-0x0;var _0x9d3940=_0x6b77[_0x5944af];return _0x9d3940;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x76b7('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x76b7('0x1')](0x0);var events={'afterCreate':_0x76b7('0x2'),'afterUpdate':_0x76b7('0x3'),'afterDestroy':_0x76b7('0x4')};function emitEvent(_0x21d68a){return function(_0x3c941b,_0x171562,_0x12e460){VoiceQueueEvents['emit'](_0x21d68a+':'+_0x3c941b['id'],_0x3c941b);VoiceQueueEvents[_0x76b7('0x5')](_0x21d68a,_0x3c941b);_0x12e460(null);};}for(var e in events){if(events[_0x76b7('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x76b7('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2a0f0e5..2c9e742 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(_0x170d59,_0xd5808c){var _0x2886c8=function(_0x2ebd74){while(--_0x2ebd74){_0x170d59['push'](_0x170d59['shift']());}};_0x2886c8(++_0xd5808c);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a908d,_0x56bc38){_0x3a908d=_0x3a908d-0x0;var _0xd0abde=_0xedd9[_0x3a908d];return _0xd0abde;};'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(_0x3f99a4,_0x49a964){var _0x4ea168=function(_0x36b575){while(--_0x36b575){_0x3f99a4['push'](_0x3f99a4['shift']());}};_0x4ea168(++_0x49a964);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ba2bb,_0x26a0ef){_0x4ba2bb=_0x4ba2bb-0x0;var _0x4c93cc=_0xedd9[_0x4ba2bb];return _0x4c93cc;};'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 6ae5941..37591aa 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 _0xfcef=['attributes','include','map','model','then','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xfcef,0x7f));var _0xffce=function(_0x334dd6,_0x2025e8){_0x334dd6=_0x334dd6-0x0;var _0x3576c4=_0xfcef[_0x334dd6];return _0x3576c4;};'use strict';var _=require(_0xffce('0x0'));var util=require(_0xffce('0x1'));var moment=require(_0xffce('0x2'));var BPromise=require(_0xffce('0x3'));var rs=require(_0xffce('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xffce('0x6'))(_0xffce('0x7'));var config=require(_0xffce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xffce('0x9')][_0xffce('0xa')]({'port':0x232a});config['redis']=_[_0xffce('0xb')](config[_0xffce('0xc')],{'host':_0xffce('0xd'),'port':0x18eb});var socket=require(_0xffce('0xe'))(new Redis(config[_0xffce('0xc')]));require(_0xffce('0xf'))[_0xffce('0x10')](socket);function respondWithRpcPromise(_0x464c97,_0x41c983,_0x25393d){return new BPromise(function(_0x4f6619,_0x2b4aaa){return client['request'](_0x464c97,_0x25393d)['then'](function(_0x5cec09){logger[_0xffce('0x11')](_0xffce('0x12'),_0x41c983,_0xffce('0x13'));logger[_0xffce('0x14')](_0xffce('0x15'),_0x41c983,_0xffce('0x13'),JSON[_0xffce('0x16')](_0x5cec09));if(_0x5cec09['error']){if(_0x5cec09['error']['code']===0x1f4){logger[_0xffce('0x17')](_0xffce('0x12'),_0x41c983,_0x5cec09[_0xffce('0x17')][_0xffce('0x18')]);return _0x2b4aaa(_0x5cec09[_0xffce('0x17')][_0xffce('0x18')]);}logger[_0xffce('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x41c983,_0x5cec09[_0xffce('0x17')][_0xffce('0x18')]);return _0x4f6619(_0x5cec09[_0xffce('0x17')]['message']);}else{logger[_0xffce('0x11')](_0xffce('0x12'),_0x41c983,_0xffce('0x13'));_0x4f6619(_0x5cec09[_0xffce('0x19')][_0xffce('0x18')]);}})[_0xffce('0x1a')](function(_0x53fbbf){logger[_0xffce('0x17')](_0xffce('0x12'),_0x41c983,_0x53fbbf);_0x2b4aaa(_0x53fbbf);});});}exports[_0xffce('0x1b')]=function(_0x164e9a){var _0x181ed9=this;return new Promise(function(_0x4abbc9,_0xef969){return db[_0xffce('0x1c')][_0xffce('0x1d')]({'raw':_0x164e9a[_0xffce('0x1e')]?_0x164e9a[_0xffce('0x1e')][_0xffce('0x1f')]===undefined?!![]:![]:!![],'where':_0x164e9a[_0xffce('0x1e')]?_0x164e9a[_0xffce('0x1e')][_0xffce('0x20')]||null:null,'attributes':_0x164e9a[_0xffce('0x1e')]?_0x164e9a['options'][_0xffce('0x21')]||null:null,'limit':_0x164e9a[_0xffce('0x1e')]?_0x164e9a[_0xffce('0x1e')]['limit']||null:null,'include':_0x164e9a[_0xffce('0x1e')]?_0x164e9a[_0xffce('0x1e')][_0xffce('0x22')]?_[_0xffce('0x23')](_0x164e9a[_0xffce('0x1e')]['include'],function(_0x2ac721){return{'model':db[_0x2ac721[_0xffce('0x24')]],'as':_0x2ac721['as'],'attributes':_0x2ac721['attributes'],'include':_0x2ac721[_0xffce('0x22')]?_[_0xffce('0x23')](_0x2ac721['include'],function(_0x12051f){return{'model':db[_0x12051f[_0xffce('0x24')]],'as':_0x12051f['as'],'attributes':_0x12051f['attributes'],'include':_0x12051f[_0xffce('0x22')]?_[_0xffce('0x23')](_0x12051f[_0xffce('0x22')],function(_0x13319a){return{'model':db[_0x13319a['model']],'as':_0x13319a['as'],'attributes':_0x13319a['attributes']};}):[]};}):[]};}):[]:[]})[_0xffce('0x25')](function(_0x150892){logger[_0xffce('0x11')]('GetVoiceQueue',_0x164e9a);logger[_0xffce('0x14')]('GetVoiceQueue',_0x164e9a,JSON['stringify'](_0x150892));_0x4abbc9(_0x150892);})[_0xffce('0x1a')](function(_0x1e6248){logger['error'](_0xffce('0x1b'),_0x1e6248[_0xffce('0x18')],_0x164e9a);_0xef969(_0x181ed9[_0xffce('0x17')](0x1f4,_0x1e6248[_0xffce('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x12134){var _0x2d1315=this;return new Promise(function(_0x5bfe3f,_0x57f811){return db[_0xffce('0x1c')][_0xffce('0x26')]({'raw':_0x12134[_0xffce('0x1e')]?_0x12134[_0xffce('0x1e')][_0xffce('0x1f')]===undefined?!![]:![]:!![],'where':_0x12134['options']?_0x12134[_0xffce('0x1e')]['where']||null:null,'attributes':_0x12134[_0xffce('0x1e')]?_0x12134['options'][_0xffce('0x21')]||null:null,'include':_0x12134[_0xffce('0x1e')]?_0x12134[_0xffce('0x1e')][_0xffce('0x22')]?_['map'](_0x12134[_0xffce('0x1e')][_0xffce('0x22')],function(_0x10ad08){return{'model':db[_0x10ad08['model']],'as':_0x10ad08['as'],'attributes':_0x10ad08['attributes'],'include':_0x10ad08[_0xffce('0x22')]?_['map'](_0x10ad08[_0xffce('0x22')],function(_0x1edcff){return{'model':db[_0x1edcff[_0xffce('0x24')]],'as':_0x1edcff['as'],'attributes':_0x1edcff[_0xffce('0x21')],'include':_0x1edcff[_0xffce('0x22')]?_[_0xffce('0x23')](_0x1edcff['include'],function(_0x3fef09){return{'model':db[_0x3fef09[_0xffce('0x24')]],'as':_0x3fef09['as'],'attributes':_0x3fef09[_0xffce('0x21')]};}):[]};}):[]};}):[]:[]})[_0xffce('0x25')](function(_0x462a81){logger[_0xffce('0x11')](_0xffce('0x27'),_0x12134);logger[_0xffce('0x14')](_0xffce('0x27'),_0x12134,JSON['stringify'](_0x462a81));_0x5bfe3f(_0x462a81);})[_0xffce('0x1a')](function(_0xccb87f){logger[_0xffce('0x17')]('ShowVoiceQueue',_0xccb87f['message'],_0x12134);_0x57f811(_0x2d1315[_0xffce('0x17')](0x1f4,_0xccb87f['message']));});});}; \ No newline at end of file +var _0x5331=['stringify','error','message','request\x20sent','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','include','map','model','attributes','debug','find','raw','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x46652d,_0x37f677){var _0x175796=function(_0x5b5673){while(--_0x5b5673){_0x46652d['push'](_0x46652d['shift']());}};_0x175796(++_0x37f677);}(_0x5331,0x1c1));var _0x1533=function(_0xd4b628,_0x1d653f){_0xd4b628=_0xd4b628-0x0;var _0x41b47f=_0x5331[_0xd4b628];return _0x41b47f;};'use strict';var _=require(_0x1533('0x0'));var util=require(_0x1533('0x1'));var moment=require(_0x1533('0x2'));var BPromise=require(_0x1533('0x3'));var rs=require(_0x1533('0x4'));var fs=require('fs');var Redis=require(_0x1533('0x5'));var db=require(_0x1533('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1533('0x7'))(_0x1533('0x8'));var config=require(_0x1533('0x9'));var jayson=require(_0x1533('0xa'));var client=jayson[_0x1533('0xb')][_0x1533('0xc')]({'port':0x232a});config['redis']=_[_0x1533('0xd')](config[_0x1533('0xe')],{'host':_0x1533('0xf'),'port':0x18eb});var socket=require(_0x1533('0x10'))(new Redis(config['redis']));require(_0x1533('0x11'))[_0x1533('0x12')](socket);function respondWithRpcPromise(_0x51931f,_0x101434,_0x44294e){return new BPromise(function(_0x3fb505,_0x13a682){return client[_0x1533('0x13')](_0x51931f,_0x44294e)[_0x1533('0x14')](function(_0x2620b3){logger[_0x1533('0x15')](_0x1533('0x16'),_0x101434,'request\x20sent');logger['debug'](_0x1533('0x17'),_0x101434,'request\x20sent',JSON[_0x1533('0x18')](_0x2620b3));if(_0x2620b3[_0x1533('0x19')]){if(_0x2620b3[_0x1533('0x19')]['code']===0x1f4){logger[_0x1533('0x19')](_0x1533('0x16'),_0x101434,_0x2620b3[_0x1533('0x19')][_0x1533('0x1a')]);return _0x13a682(_0x2620b3[_0x1533('0x19')][_0x1533('0x1a')]);}logger[_0x1533('0x19')](_0x1533('0x16'),_0x101434,_0x2620b3[_0x1533('0x19')][_0x1533('0x1a')]);return _0x3fb505(_0x2620b3[_0x1533('0x19')][_0x1533('0x1a')]);}else{logger[_0x1533('0x15')](_0x1533('0x16'),_0x101434,_0x1533('0x1b'));_0x3fb505(_0x2620b3[_0x1533('0x1c')]['message']);}})[_0x1533('0x1d')](function(_0x1a91bd){logger[_0x1533('0x19')](_0x1533('0x16'),_0x101434,_0x1a91bd);_0x13a682(_0x1a91bd);});});}exports[_0x1533('0x1e')]=function(_0x4af250){var _0x4eadd1=this;return new Promise(function(_0x5ed90c,_0xc17096){return db[_0x1533('0x1f')][_0x1533('0x20')]({'raw':_0x4af250['options']?_0x4af250[_0x1533('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x4af250[_0x1533('0x21')]?_0x4af250[_0x1533('0x21')][_0x1533('0x22')]||null:null,'attributes':_0x4af250['options']?_0x4af250[_0x1533('0x21')]['attributes']||null:null,'limit':_0x4af250[_0x1533('0x21')]?_0x4af250['options']['limit']||null:null,'include':_0x4af250[_0x1533('0x21')]?_0x4af250[_0x1533('0x21')][_0x1533('0x23')]?_[_0x1533('0x24')](_0x4af250[_0x1533('0x21')][_0x1533('0x23')],function(_0x380e8d){return{'model':db[_0x380e8d[_0x1533('0x25')]],'as':_0x380e8d['as'],'attributes':_0x380e8d['attributes'],'include':_0x380e8d[_0x1533('0x23')]?_['map'](_0x380e8d[_0x1533('0x23')],function(_0x32d57f){return{'model':db[_0x32d57f['model']],'as':_0x32d57f['as'],'attributes':_0x32d57f[_0x1533('0x26')],'include':_0x32d57f['include']?_[_0x1533('0x24')](_0x32d57f['include'],function(_0x5147c8){return{'model':db[_0x5147c8['model']],'as':_0x5147c8['as'],'attributes':_0x5147c8[_0x1533('0x26')]};}):[]};}):[]};}):[]:[]})[_0x1533('0x14')](function(_0x5d08af){logger[_0x1533('0x15')]('GetVoiceQueue',_0x4af250);logger[_0x1533('0x27')]('GetVoiceQueue',_0x4af250,JSON[_0x1533('0x18')](_0x5d08af));_0x5ed90c(_0x5d08af);})[_0x1533('0x1d')](function(_0x6cabc0){logger['error'](_0x1533('0x1e'),_0x6cabc0[_0x1533('0x1a')],_0x4af250);_0xc17096(_0x4eadd1['error'](0x1f4,_0x6cabc0[_0x1533('0x1a')]));});});};exports['ShowVoiceQueue']=function(_0x219dcc){var _0x8f0112=this;return new Promise(function(_0x46bdf2,_0x2e6d99){return db[_0x1533('0x1f')][_0x1533('0x28')]({'raw':_0x219dcc[_0x1533('0x21')]?_0x219dcc[_0x1533('0x21')][_0x1533('0x29')]===undefined?!![]:![]:!![],'where':_0x219dcc[_0x1533('0x21')]?_0x219dcc[_0x1533('0x21')][_0x1533('0x22')]||null:null,'attributes':_0x219dcc[_0x1533('0x21')]?_0x219dcc['options']['attributes']||null:null,'include':_0x219dcc[_0x1533('0x21')]?_0x219dcc[_0x1533('0x21')][_0x1533('0x23')]?_[_0x1533('0x24')](_0x219dcc[_0x1533('0x21')]['include'],function(_0x570d1e){return{'model':db[_0x570d1e[_0x1533('0x25')]],'as':_0x570d1e['as'],'attributes':_0x570d1e[_0x1533('0x26')],'include':_0x570d1e['include']?_[_0x1533('0x24')](_0x570d1e[_0x1533('0x23')],function(_0x56630a){return{'model':db[_0x56630a['model']],'as':_0x56630a['as'],'attributes':_0x56630a[_0x1533('0x26')],'include':_0x56630a[_0x1533('0x23')]?_['map'](_0x56630a[_0x1533('0x23')],function(_0x2226a4){return{'model':db[_0x2226a4[_0x1533('0x25')]],'as':_0x2226a4['as'],'attributes':_0x2226a4[_0x1533('0x26')]};}):[]};}):[]};}):[]:[]})[_0x1533('0x14')](function(_0x2ee1b0){logger[_0x1533('0x15')](_0x1533('0x2a'),_0x219dcc);logger[_0x1533('0x27')]('ShowVoiceQueue',_0x219dcc,JSON['stringify'](_0x2ee1b0));_0x46bdf2(_0x2ee1b0);})[_0x1533('0x1d')](function(_0x15dfb8){logger['error'](_0x1533('0x2a'),_0x15dfb8[_0x1533('0x1a')],_0x219dcc);_0x2e6d99(_0x8f0112['error'](0x1f4,_0x15dfb8[_0x1533('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 40fe28b..3f6ab2b 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 _0x0940=['update','emit','removeListener','register','length','./voiceQueue.events','save'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x0940,0x1ef));var _0x0094=function(_0x3f70c9,_0x4c3ff3){_0x3f70c9=_0x3f70c9-0x0;var _0x222889=_0x0940[_0x3f70c9];return _0x222889;};'use strict';var VoiceQueueEvents=require(_0x0094('0x0'));var events=[_0x0094('0x1'),'remove',_0x0094('0x2')];function createListener(_0x10085d,_0x5e65d5){return function(_0x5ca2e9){_0x5e65d5[_0x0094('0x3')](_0x10085d,_0x5ca2e9);};}function removeListener(_0x2a3626,_0x4452c1){return function(){VoiceQueueEvents[_0x0094('0x4')](_0x2a3626,_0x4452c1);};}exports[_0x0094('0x5')]=function(_0x37a4de){for(var _0x59968a=0x0,_0x42c7b0=events[_0x0094('0x6')];_0x59968a<_0x42c7b0;_0x59968a++){var _0x2ac1f8=events[_0x59968a];var _0x17b1b7=createListener('voiceQueue:'+_0x2ac1f8,_0x37a4de);VoiceQueueEvents['on'](_0x2ac1f8,_0x17b1b7);}}; \ No newline at end of file +var _0x8ebe=['save','remove','emit','removeListener','register','voiceQueue:','./voiceQueue.events'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x8ebe,0x8b));var _0xe8eb=function(_0x2ae22a,_0x4fe753){_0x2ae22a=_0x2ae22a-0x0;var _0x286a82=_0x8ebe[_0x2ae22a];return _0x286a82;};'use strict';var VoiceQueueEvents=require(_0xe8eb('0x0'));var events=[_0xe8eb('0x1'),_0xe8eb('0x2'),'update'];function createListener(_0x4c8b34,_0x33fa5a){return function(_0x49e043){_0x33fa5a[_0xe8eb('0x3')](_0x4c8b34,_0x49e043);};}function removeListener(_0x9a4ea1,_0x3faa30){return function(){VoiceQueueEvents[_0xe8eb('0x4')](_0x9a4ea1,_0x3faa30);};}exports[_0xe8eb('0x5')]=function(_0x18884f){for(var _0x435e0e=0x0,_0x294c52=events['length'];_0x435e0e<_0x294c52;_0x435e0e++){var _0x2b069e=events[_0x435e0e];var _0x54c598=createListener(_0xe8eb('0x6')+_0x2b069e,_0x18884f);VoiceQueueEvents['on'](_0x2b069e,_0x54c598);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c72945a..6be421c 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 _0x7c51=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x482d06,_0x1c7c4a){var _0x3bdd88=function(_0x476f12){while(--_0x476f12){_0x482d06['push'](_0x482d06['shift']());}};_0x3bdd88(++_0x1c7c4a);}(_0x7c51,0xcf));var _0x17c5=function(_0x13ac60,_0x5ca661){_0x13ac60=_0x13ac60-0x0;var _0x2d55fe=_0x7c51[_0x13ac60];return _0x2d55fe;};'use strict';var multer=require(_0x17c5('0x0'));var util=require(_0x17c5('0x1'));var path=require('path');var timeout=require(_0x17c5('0x2'));var express=require(_0x17c5('0x3'));var router=express[_0x17c5('0x4')]();var fs_extra=require(_0x17c5('0x5'));var auth=require(_0x17c5('0x6'));var interaction=require(_0x17c5('0x7'));var config=require('../../config/environment');var controller=require(_0x17c5('0x8'));router[_0x17c5('0x9')]('/',auth[_0x17c5('0xa')](),controller['index']);router[_0x17c5('0x9')](_0x17c5('0xb'),auth['isAuthenticated'](),controller[_0x17c5('0xc')]);router[_0x17c5('0x9')](_0x17c5('0xd'),auth[_0x17c5('0xa')](),controller[_0x17c5('0xe')]);router[_0x17c5('0x9')](_0x17c5('0xf'),auth[_0x17c5('0xa')](),controller[_0x17c5('0x10')]);router[_0x17c5('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x17c5('0x12')](_0x17c5('0xf'),auth['isAuthenticated'](),controller[_0x17c5('0x13')]);router[_0x17c5('0x14')](_0x17c5('0xf'),auth[_0x17c5('0xa')](),controller[_0x17c5('0x15')]);module[_0x17c5('0x16')]=router; \ No newline at end of file +var _0x0546=['get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x31bca3,_0x209a1e){var _0x2f10ea=function(_0x248a36){while(--_0x248a36){_0x31bca3['push'](_0x31bca3['shift']());}};_0x2f10ea(++_0x209a1e);}(_0x0546,0xb8));var _0x6054=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x0546[_0x507403];return _0x1327c;};'use strict';var multer=require(_0x6054('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6054('0x1'));var express=require(_0x6054('0x2'));var router=express['Router']();var fs_extra=require(_0x6054('0x3'));var auth=require(_0x6054('0x4'));var interaction=require(_0x6054('0x5'));var config=require(_0x6054('0x6'));var controller=require(_0x6054('0x7'));router[_0x6054('0x8')]('/',auth[_0x6054('0x9')](),controller[_0x6054('0xa')]);router[_0x6054('0x8')](_0x6054('0xb'),auth[_0x6054('0x9')](),controller[_0x6054('0xc')]);router[_0x6054('0x8')](_0x6054('0xd'),auth[_0x6054('0x9')](),controller[_0x6054('0xe')]);router[_0x6054('0x8')](_0x6054('0xf'),auth[_0x6054('0x9')](),controller[_0x6054('0x10')]);router[_0x6054('0x11')]('/',auth[_0x6054('0x9')](),controller[_0x6054('0x12')]);router[_0x6054('0x13')](_0x6054('0xf'),auth[_0x6054('0x9')](),controller[_0x6054('0x14')]);router[_0x6054('0x15')](_0x6054('0xf'),auth[_0x6054('0x9')](),controller[_0x6054('0x16')]);module[_0x6054('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d21528f..14c1710 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 _0x5e64=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x5ece50,_0x2b7411){var _0xa73f6a=function(_0x4ab5c5){while(--_0x4ab5c5){_0x5ece50['push'](_0x5ece50['shift']());}};_0xa73f6a(++_0x2b7411);}(_0x5e64,0x18b));var _0x45e6=function(_0x278748,_0xbb025f){_0x278748=_0x278748-0x0;var _0x28d33c=_0x5e64[_0x278748];return _0x28d33c;};'use strict';var Sequelize=require(_0x45e6('0x0'));var moment=require(_0x45e6('0x1'));module['exports']={'type':{'type':Sequelize[_0x45e6('0x2')]},'uniqueid':{'type':Sequelize[_0x45e6('0x2')]},'calleridnum':{'type':Sequelize[_0x45e6('0x2')]},'calleridname':{'type':Sequelize[_0x45e6('0x2')]},'queue':{'type':Sequelize[_0x45e6('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x45e6('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x36006b){var _0x2364ff=moment(_0x36006b);var _0x1daef8=moment(this[_0x45e6('0x4')](_0x45e6('0x5')))[_0x45e6('0x6')](_0x45e6('0x7'));var _0x40b72a=_0x2364ff[_0x45e6('0x8')](_0x1daef8,_0x45e6('0x9'));this[_0x45e6('0xa')](_0x45e6('0xb'),_0x36006b);this['setDataValue'](_0x45e6('0xc'),_0x40b72a||null);}},'position':{'type':Sequelize[_0x45e6('0xd')]},'count':{'type':Sequelize[_0x45e6('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x45e6('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x45e6('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x45e6('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x45e6('0xf')},'originalposition':{'type':Sequelize[_0x45e6('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x45e6('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x45e6('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x45e6('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x45e6('0xd')]},'mohtime':{'type':Sequelize[_0x45e6('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x45e6('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x45e6('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x45e6('0x2')],'comment':_0x45e6('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x45e6('0x2')]},'disposition':{'type':Sequelize[_0x45e6('0x2')]},'secondDisposition':{'type':Sequelize[_0x45e6('0x2')]},'thirdDisposition':{'type':Sequelize[_0x45e6('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1223=['moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','sequelize'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x1223,0x158));var _0x3122=function(_0x546f7d,_0x19d51d){_0x546f7d=_0x546f7d-0x0;var _0x22b4b5=_0x1223[_0x546f7d];return _0x22b4b5;};'use strict';var Sequelize=require(_0x3122('0x0'));var moment=require(_0x3122('0x1'));module[_0x3122('0x2')]={'type':{'type':Sequelize[_0x3122('0x3')]},'uniqueid':{'type':Sequelize[_0x3122('0x3')]},'calleridnum':{'type':Sequelize[_0x3122('0x3')]},'calleridname':{'type':Sequelize[_0x3122('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3122('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x3122('0x4')],'set':function(_0x392f24){var _0x5979ec=moment(_0x392f24);var _0x520070=moment(this[_0x3122('0x5')]('queuecallerjoinAt'))[_0x3122('0x6')](_0x3122('0x7'));var _0x2b4750=_0x5979ec[_0x3122('0x8')](_0x520070,_0x3122('0x9'));this[_0x3122('0xa')](_0x3122('0xb'),_0x392f24);this['setDataValue'](_0x3122('0xc'),_0x2b4750||null);}},'position':{'type':Sequelize[_0x3122('0xd')]},'count':{'type':Sequelize[_0x3122('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x3122('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3122('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x3122('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3122('0x4')]},'queuecallerexit':{'type':Sequelize[_0x3122('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3122('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x3122('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x3122('0xd')]},'channel':{'type':Sequelize[_0x3122('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3122('0x3')]},'accountcode':{'type':Sequelize[_0x3122('0x3')]},'context':{'type':Sequelize[_0x3122('0x3')]},'exten':{'type':Sequelize[_0x3122('0x3')]},'priority':{'type':Sequelize[_0x3122('0x3')]},'holdtime':{'type':Sequelize[_0x3122('0xd')]},'mohtime':{'type':Sequelize[_0x3122('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3122('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x3122('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x3122('0x3')]},'disposition':{'type':Sequelize[_0x3122('0x3')]},'secondDisposition':{'type':Sequelize[_0x3122('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3122('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x3122('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index cccf0ec..b33cc13 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 _0xc149=['end','limit','undefined','offset','count','set','json','reject','save','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','destroy','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./voiceQueueReport.socket','register','sendStatus','status'];(function(_0x448970,_0x44b9b4){var _0x2fa420=function(_0x10a754){while(--_0x10a754){_0x448970['push'](_0x448970['shift']());}};_0x2fa420(++_0x44b9b4);}(_0xc149,0x125));var _0x9c14=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc149[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x9c14('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c14('0x1'));var jsonpatch=require(_0x9c14('0x2'));var rp=require(_0x9c14('0x3'));var moment=require(_0x9c14('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c14('0x5'));var util=require(_0x9c14('0x6'));var path=require(_0x9c14('0x7'));var sox=require(_0x9c14('0x8'));var csv=require(_0x9c14('0x9'));var ejs=require(_0x9c14('0xa'));var fs=require('fs');var fs_extra=require(_0x9c14('0xb'));var _=require(_0x9c14('0xc'));var squel=require(_0x9c14('0xd'));var crypto=require(_0x9c14('0xe'));var jsforce=require(_0x9c14('0xf'));var deskjs=require(_0x9c14('0x10'));var toCsv=require(_0x9c14('0x9'));var querystring=require(_0x9c14('0x11'));var Papa=require(_0x9c14('0x12'));var Redis=require(_0x9c14('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c14('0x14'));var logger=require(_0x9c14('0x15'))('api');var utils=require(_0x9c14('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9c14('0x17'));var db=require(_0x9c14('0x18'))['db'];config[_0x9c14('0x19')]=_[_0x9c14('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c14('0x19')]));require(_0x9c14('0x1b'))[_0x9c14('0x1c')](socket);function respondWithStatusCode(_0x1b48f5,_0x470bf2){_0x470bf2=_0x470bf2||0xcc;return function(_0x4252bd){if(_0x4252bd){return _0x1b48f5[_0x9c14('0x1d')](_0x470bf2);}return _0x1b48f5[_0x9c14('0x1e')](_0x470bf2)[_0x9c14('0x1f')]();};}function respondWithResult(_0x5ba87b,_0x3dae4f){_0x3dae4f=_0x3dae4f||0xc8;return function(_0x439a26){if(_0x439a26){return _0x5ba87b['status'](_0x3dae4f)['json'](_0x439a26);}};}function respondWithFilteredResult(_0x31c62b,_0x26165b){return function(_0xcbae5){if(_0xcbae5){var _0x2b6140=typeof _0x26165b['offset']==='undefined'&&typeof _0x26165b[_0x9c14('0x20')]===_0x9c14('0x21');var _0x16bb60=_0xcbae5['count'];var _0x21cbe0=_0x2b6140?0x0:_0x26165b[_0x9c14('0x22')];var _0x393ba8=_0x2b6140?_0xcbae5[_0x9c14('0x23')]:_0x26165b['offset']+_0x26165b[_0x9c14('0x20')];var _0x48e3af;if(_0x393ba8>=_0x16bb60){_0x393ba8=_0x16bb60;_0x48e3af=0xc8;}else{_0x48e3af=0xce;}_0x31c62b[_0x9c14('0x1e')](_0x48e3af);return _0x31c62b[_0x9c14('0x24')]('Content-Range',_0x21cbe0+'-'+_0x393ba8+'/'+_0x16bb60)[_0x9c14('0x25')](_0xcbae5);}return null;};}function patchUpdates(_0x223c06){return function(_0x57f1e0){try{jsonpatch['apply'](_0x57f1e0,_0x223c06,!![]);}catch(_0x50eac0){return BPromise[_0x9c14('0x26')](_0x50eac0);}return _0x57f1e0[_0x9c14('0x27')]();};}function saveUpdates(_0x5c4843,_0x431b80){return function(_0x2b909a){if(_0x2b909a){return _0x2b909a['update'](_0x5c4843)['then'](function(_0x54e255){return _0x54e255;});}return null;};}function removeEntity(_0x40e1b2,_0x11abbd){return function(_0x1d57c8){if(_0x1d57c8){return _0x1d57c8['destroy']()[_0x9c14('0x28')](function(){_0x40e1b2[_0x9c14('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e68d,_0x1052d2){return function(_0x4d4d79){if(!_0x4d4d79){_0x34e68d[_0x9c14('0x1d')](0x194);}return _0x4d4d79;};}function handleError(_0x54cc70,_0x2d800a){_0x2d800a=_0x2d800a||0x1f4;return function(_0x1a7c6f){logger[_0x9c14('0x29')](_0x1a7c6f[_0x9c14('0x2a')]);if(_0x1a7c6f[_0x9c14('0x2b')]){delete _0x1a7c6f[_0x9c14('0x2b')];}_0x54cc70['status'](_0x2d800a)[_0x9c14('0x2c')](_0x1a7c6f);};}exports[_0x9c14('0x2d')]=function(_0x5d0fd7,_0x22a737){var _0x48c64b={},_0x441d0a={},_0x3029a7={'count':0x0,'rows':[]};var _0x1bf4a7=_[_0x9c14('0x2e')](db[_0x9c14('0x2f')][_0x9c14('0x30')],function(_0x5cd0c6){return{'name':_0x5cd0c6[_0x9c14('0x31')],'type':_0x5cd0c6[_0x9c14('0x32')][_0x9c14('0x33')]};});_0x441d0a[_0x9c14('0x34')]=_['map'](_0x1bf4a7,'name');_0x441d0a[_0x9c14('0x35')]=_['keys'](_0x5d0fd7['query']);_0x441d0a['filters']=_[_0x9c14('0x36')](_0x441d0a[_0x9c14('0x34')],_0x441d0a['query']);_0x48c64b[_0x9c14('0x37')]=_[_0x9c14('0x36')](_0x441d0a['model'],qs['fields'](_0x5d0fd7[_0x9c14('0x35')][_0x9c14('0x38')]));_0x48c64b[_0x9c14('0x37')]=_0x48c64b[_0x9c14('0x37')][_0x9c14('0x39')]?_0x48c64b[_0x9c14('0x37')]:_0x441d0a['model'];if(!_0x5d0fd7[_0x9c14('0x35')]['hasOwnProperty'](_0x9c14('0x3a'))){_0x48c64b['limit']=qs[_0x9c14('0x20')](_0x5d0fd7['query'][_0x9c14('0x20')]);_0x48c64b[_0x9c14('0x22')]=qs[_0x9c14('0x22')](_0x5d0fd7['query'][_0x9c14('0x22')]);}_0x48c64b[_0x9c14('0x3b')]=qs[_0x9c14('0x3c')](_0x5d0fd7[_0x9c14('0x35')]['sort']);_0x48c64b[_0x9c14('0x3d')]=qs[_0x9c14('0x3e')](_[_0x9c14('0x3f')](_0x5d0fd7['query'],_0x441d0a[_0x9c14('0x3e')]),_0x1bf4a7);if(_0x5d0fd7[_0x9c14('0x35')][_0x9c14('0x40')]){_0x48c64b[_0x9c14('0x3d')]=_[_0x9c14('0x41')](_0x48c64b[_0x9c14('0x3d')],{'$or':_[_0x9c14('0x2e')](_0x1bf4a7,function(_0x238c78){if(_0x238c78[_0x9c14('0x32')]!=='VIRTUAL'){var _0x934428={};_0x934428[_0x238c78['name']]={'$like':'%'+_0x5d0fd7[_0x9c14('0x35')][_0x9c14('0x40')]+'%'};return _0x934428;}})});}_0x48c64b=_[_0x9c14('0x41')]({},_0x48c64b,_0x5d0fd7[_0x9c14('0x42')]);var _0x1e9353={'where':_0x48c64b[_0x9c14('0x3d')]};return db['VoiceQueueReport'][_0x9c14('0x23')](_0x1e9353)[_0x9c14('0x28')](function(_0x2e29ea){_0x3029a7[_0x9c14('0x23')]=_0x2e29ea;if(_0x5d0fd7[_0x9c14('0x35')][_0x9c14('0x43')]){_0x48c64b[_0x9c14('0x44')]=[{'all':!![]}];}return db[_0x9c14('0x2f')][_0x9c14('0x45')](_0x48c64b);})[_0x9c14('0x28')](function(_0x41d5fc){_0x3029a7[_0x9c14('0x46')]=_0x41d5fc;return _0x3029a7;})['then'](respondWithFilteredResult(_0x22a737,_0x48c64b))[_0x9c14('0x47')](handleError(_0x22a737,null));};exports[_0x9c14('0x48')]=function(_0xfb1f14,_0x4b370a){var _0x4881ba={'raw':![],'where':{'id':_0xfb1f14[_0x9c14('0x49')]['id']}},_0x439d00={};_0x439d00[_0x9c14('0x34')]=_[_0x9c14('0x4a')](db['VoiceQueueReport'][_0x9c14('0x30')]);_0x439d00[_0x9c14('0x35')]=_['keys'](_0xfb1f14[_0x9c14('0x35')]);_0x439d00[_0x9c14('0x3e')]=_['intersection'](_0x439d00[_0x9c14('0x34')],_0x439d00[_0x9c14('0x35')]);_0x4881ba['attributes']=_[_0x9c14('0x36')](_0x439d00[_0x9c14('0x34')],qs[_0x9c14('0x38')](_0xfb1f14[_0x9c14('0x35')]['fields']));_0x4881ba[_0x9c14('0x37')]=_0x4881ba[_0x9c14('0x37')][_0x9c14('0x39')]?_0x4881ba[_0x9c14('0x37')]:_0x439d00[_0x9c14('0x34')];if(_0xfb1f14[_0x9c14('0x35')][_0x9c14('0x43')]){_0x4881ba['include']=[{'all':!![]}];}_0x4881ba=_['merge']({},_0x4881ba,_0xfb1f14[_0x9c14('0x42')]);return db[_0x9c14('0x2f')][_0x9c14('0x4b')](_0x4881ba)[_0x9c14('0x28')](handleEntityNotFound(_0x4b370a,null))['then'](respondWithResult(_0x4b370a,null))[_0x9c14('0x47')](handleError(_0x4b370a,null));};exports['create']=function(_0x1ea1be,_0x4967c8){return db['VoiceQueueReport'][_0x9c14('0x4c')](_0x1ea1be[_0x9c14('0x4d')],{})[_0x9c14('0x28')](respondWithResult(_0x4967c8,0xc9))[_0x9c14('0x47')](handleError(_0x4967c8,null));};exports[_0x9c14('0x4e')]=function(_0x188dc1,_0x511d81){if(_0x188dc1[_0x9c14('0x4d')]['id']){delete _0x188dc1[_0x9c14('0x4d')]['id'];}return db[_0x9c14('0x2f')][_0x9c14('0x4b')]({'where':{'id':_0x188dc1[_0x9c14('0x49')]['id']}})['then'](handleEntityNotFound(_0x511d81,null))[_0x9c14('0x28')](saveUpdates(_0x188dc1[_0x9c14('0x4d')],null))[_0x9c14('0x28')](respondWithResult(_0x511d81,null))[_0x9c14('0x47')](handleError(_0x511d81,null));};exports[_0x9c14('0x4f')]=function(_0x5abdf2,_0x237167){return db[_0x9c14('0x2f')][_0x9c14('0x4b')]({'where':{'id':_0x5abdf2[_0x9c14('0x49')]['id']}})[_0x9c14('0x28')](handleEntityNotFound(_0x237167,null))[_0x9c14('0x28')](removeEntity(_0x237167,null))[_0x9c14('0x47')](handleError(_0x237167,null));};exports['describe']=function(_0x3e072c,_0x56ec9c){return db['VoiceQueueReport']['describe']()[_0x9c14('0x28')](respondWithResult(_0x56ec9c,null))['catch'](handleError(_0x56ec9c,null));};exports[_0x9c14('0x50')]=function(_0x3db443,_0x452d75){var _0x16dec9={},_0x32fae3={},_0x30f13f={'count':0x0,'rows':[]};_0x32fae3['model']=_[_0x9c14('0x4a')](db['VoiceQueueReport'][_0x9c14('0x30')]);_0x32fae3[_0x9c14('0x35')]=_[_0x9c14('0x4a')](_0x3db443[_0x9c14('0x35')]);_0x32fae3[_0x9c14('0x3e')]=_[_0x9c14('0x36')](_0x32fae3['model'],_0x32fae3['query']);_0x16dec9['attributes']=_[_0x9c14('0x36')](_0x32fae3[_0x9c14('0x34')],qs[_0x9c14('0x38')](_0x3db443[_0x9c14('0x35')][_0x9c14('0x38')]));_0x16dec9[_0x9c14('0x37')]=_0x16dec9[_0x9c14('0x37')][_0x9c14('0x39')]?_0x16dec9[_0x9c14('0x37')]:_0x32fae3['model'];if(!_0x3db443[_0x9c14('0x35')]['hasOwnProperty']('nolimit')){_0x16dec9[_0x9c14('0x20')]=qs[_0x9c14('0x20')](_0x3db443['query'][_0x9c14('0x20')]);_0x16dec9[_0x9c14('0x22')]=qs[_0x9c14('0x22')](_0x3db443[_0x9c14('0x35')]['offset']);}_0x16dec9[_0x9c14('0x3b')]=qs[_0x9c14('0x3c')](_0x3db443[_0x9c14('0x35')]['sort']);_0x16dec9[_0x9c14('0x3d')]=qs[_0x9c14('0x3e')](_[_0x9c14('0x3f')](_0x3db443[_0x9c14('0x35')],_0x32fae3['filters']));if(_0x3db443[_0x9c14('0x35')]['filter']){_0x16dec9[_0x9c14('0x3d')]=_[_0x9c14('0x41')](_0x16dec9[_0x9c14('0x3d')],{'$or':_[_0x9c14('0x2e')](_0x16dec9[_0x9c14('0x37')],function(_0x3aadb3){var _0x390d8b={};_0x390d8b[_0x3aadb3]={'$like':'%'+_0x3db443[_0x9c14('0x35')][_0x9c14('0x40')]+'%'};return _0x390d8b;})});}_0x16dec9=_[_0x9c14('0x41')]({},_0x16dec9,_0x3db443[_0x9c14('0x42')]);var _0x22a904={'where':_0x16dec9['where']};return db['VoiceQueueReport']['count'](_0x22a904)[_0x9c14('0x28')](function(_0x2329ec){_0x30f13f['count']=_0x2329ec;if(_0x3db443[_0x9c14('0x35')][_0x9c14('0x43')]){_0x16dec9[_0x9c14('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x16dec9);})[_0x9c14('0x28')](function(_0x203e2c){_0x30f13f[_0x9c14('0x46')]=_0x203e2c;return _0x30f13f;})[_0x9c14('0x28')](respondWithFilteredResult(_0x452d75,_0x16dec9,_0x9c14('0x50')))[_0x9c14('0x47')](handleError(_0x452d75,null,_0x9c14('0x50')));}; \ No newline at end of file +var _0x4e4f=['includeAll','include','findAll','rows','params','find','create','body','catch','describe','nolimit','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0xe0b8a0,_0xdf3087){var _0xd2cd16=function(_0x391bcb){while(--_0x391bcb){_0xe0b8a0['push'](_0xe0b8a0['shift']());}};_0xd2cd16(++_0xdf3087);}(_0x4e4f,0x1b5));var _0xf4e4=function(_0x3ab214,_0x3134f5){_0x3ab214=_0x3ab214-0x0;var _0x297528=_0x4e4f[_0x3ab214];return _0x297528;};'use strict';var emlformat=require(_0xf4e4('0x0'));var rimraf=require(_0xf4e4('0x1'));var zipdir=require(_0xf4e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4e4('0x3'));var moment=require(_0xf4e4('0x4'));var BPromise=require(_0xf4e4('0x5'));var Mustache=require(_0xf4e4('0x6'));var util=require(_0xf4e4('0x7'));var path=require(_0xf4e4('0x8'));var sox=require(_0xf4e4('0x9'));var csv=require(_0xf4e4('0xa'));var ejs=require(_0xf4e4('0xb'));var fs=require('fs');var fs_extra=require(_0xf4e4('0xc'));var _=require(_0xf4e4('0xd'));var squel=require(_0xf4e4('0xe'));var crypto=require(_0xf4e4('0xf'));var jsforce=require(_0xf4e4('0x10'));var deskjs=require(_0xf4e4('0x11'));var toCsv=require('to-csv');var querystring=require(_0xf4e4('0x12'));var Papa=require('papaparse');var Redis=require(_0xf4e4('0x13'));var authService=require(_0xf4e4('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4e4('0x15'))(_0xf4e4('0x16'));var utils=require('../../config/utils');var config=require(_0xf4e4('0x17'));var licenseUtil=require(_0xf4e4('0x18'));var db=require(_0xf4e4('0x19'))['db'];config[_0xf4e4('0x1a')]=_['defaults'](config[_0xf4e4('0x1a')],{'host':_0xf4e4('0x1b'),'port':0x18eb});var socket=require(_0xf4e4('0x1c'))(new Redis(config[_0xf4e4('0x1a')]));require(_0xf4e4('0x1d'))[_0xf4e4('0x1e')](socket);function respondWithStatusCode(_0x5165fc,_0x2c5b94){_0x2c5b94=_0x2c5b94||0xcc;return function(_0xb689bf){if(_0xb689bf){return _0x5165fc[_0xf4e4('0x1f')](_0x2c5b94);}return _0x5165fc[_0xf4e4('0x20')](_0x2c5b94)[_0xf4e4('0x21')]();};}function respondWithResult(_0x31e36e,_0x4353c9){_0x4353c9=_0x4353c9||0xc8;return function(_0xc39f31){if(_0xc39f31){return _0x31e36e[_0xf4e4('0x20')](_0x4353c9)[_0xf4e4('0x22')](_0xc39f31);}};}function respondWithFilteredResult(_0x449c87,_0x16536e){return function(_0x1d7457){if(_0x1d7457){var _0x49b67b=typeof _0x16536e[_0xf4e4('0x23')]===_0xf4e4('0x24')&&typeof _0x16536e[_0xf4e4('0x25')]===_0xf4e4('0x24');var _0x4b2750=_0x1d7457[_0xf4e4('0x26')];var _0x2cc5de=_0x49b67b?0x0:_0x16536e[_0xf4e4('0x23')];var _0x558898=_0x49b67b?_0x1d7457[_0xf4e4('0x26')]:_0x16536e[_0xf4e4('0x23')]+_0x16536e[_0xf4e4('0x25')];var _0x319357;if(_0x558898>=_0x4b2750){_0x558898=_0x4b2750;_0x319357=0xc8;}else{_0x319357=0xce;}_0x449c87[_0xf4e4('0x20')](_0x319357);return _0x449c87[_0xf4e4('0x27')](_0xf4e4('0x28'),_0x2cc5de+'-'+_0x558898+'/'+_0x4b2750)[_0xf4e4('0x22')](_0x1d7457);}return null;};}function patchUpdates(_0x210a5e){return function(_0xcb9ac7){try{jsonpatch[_0xf4e4('0x29')](_0xcb9ac7,_0x210a5e,!![]);}catch(_0x38ae65){return BPromise[_0xf4e4('0x2a')](_0x38ae65);}return _0xcb9ac7[_0xf4e4('0x2b')]();};}function saveUpdates(_0x13e318,_0x3fb94b){return function(_0x670ced){if(_0x670ced){return _0x670ced[_0xf4e4('0x2c')](_0x13e318)[_0xf4e4('0x2d')](function(_0x24be52){return _0x24be52;});}return null;};}function removeEntity(_0x3b504e,_0x1ac115){return function(_0x412963){if(_0x412963){return _0x412963['destroy']()['then'](function(){_0x3b504e[_0xf4e4('0x20')](0xcc)[_0xf4e4('0x21')]();});}};}function handleEntityNotFound(_0x79ff22,_0xfbe929){return function(_0x51e5d7){if(!_0x51e5d7){_0x79ff22[_0xf4e4('0x1f')](0x194);}return _0x51e5d7;};}function handleError(_0x394c80,_0x457626){_0x457626=_0x457626||0x1f4;return function(_0x2a11ce){logger[_0xf4e4('0x2e')](_0x2a11ce[_0xf4e4('0x2f')]);if(_0x2a11ce[_0xf4e4('0x30')]){delete _0x2a11ce[_0xf4e4('0x30')];}_0x394c80['status'](_0x457626)[_0xf4e4('0x31')](_0x2a11ce);};}exports[_0xf4e4('0x32')]=function(_0x1d296d,_0x4dfb0f){var _0xf23ec8={},_0x4aa244={},_0x2a3bf6={'count':0x0,'rows':[]};var _0x5dd837=_[_0xf4e4('0x33')](db[_0xf4e4('0x34')][_0xf4e4('0x35')],function(_0x4928e4){return{'name':_0x4928e4[_0xf4e4('0x36')],'type':_0x4928e4[_0xf4e4('0x37')][_0xf4e4('0x38')]};});_0x4aa244[_0xf4e4('0x39')]=_[_0xf4e4('0x33')](_0x5dd837,'name');_0x4aa244['query']=_[_0xf4e4('0x3a')](_0x1d296d['query']);_0x4aa244[_0xf4e4('0x3b')]=_[_0xf4e4('0x3c')](_0x4aa244['model'],_0x4aa244[_0xf4e4('0x3d')]);_0xf23ec8['attributes']=_[_0xf4e4('0x3c')](_0x4aa244['model'],qs[_0xf4e4('0x3e')](_0x1d296d[_0xf4e4('0x3d')][_0xf4e4('0x3e')]));_0xf23ec8[_0xf4e4('0x3f')]=_0xf23ec8[_0xf4e4('0x3f')][_0xf4e4('0x40')]?_0xf23ec8['attributes']:_0x4aa244[_0xf4e4('0x39')];if(!_0x1d296d[_0xf4e4('0x3d')][_0xf4e4('0x41')]('nolimit')){_0xf23ec8[_0xf4e4('0x25')]=qs[_0xf4e4('0x25')](_0x1d296d[_0xf4e4('0x3d')][_0xf4e4('0x25')]);_0xf23ec8[_0xf4e4('0x23')]=qs['offset'](_0x1d296d[_0xf4e4('0x3d')][_0xf4e4('0x23')]);}_0xf23ec8[_0xf4e4('0x42')]=qs[_0xf4e4('0x43')](_0x1d296d[_0xf4e4('0x3d')][_0xf4e4('0x43')]);_0xf23ec8[_0xf4e4('0x44')]=qs[_0xf4e4('0x3b')](_[_0xf4e4('0x45')](_0x1d296d[_0xf4e4('0x3d')],_0x4aa244[_0xf4e4('0x3b')]),_0x5dd837);if(_0x1d296d['query'][_0xf4e4('0x46')]){_0xf23ec8['where']=_['merge'](_0xf23ec8[_0xf4e4('0x44')],{'$or':_[_0xf4e4('0x33')](_0x5dd837,function(_0x12a596){if(_0x12a596[_0xf4e4('0x37')]!==_0xf4e4('0x47')){var _0x17095d={};_0x17095d[_0x12a596[_0xf4e4('0x30')]]={'$like':'%'+_0x1d296d[_0xf4e4('0x3d')][_0xf4e4('0x46')]+'%'};return _0x17095d;}})});}_0xf23ec8=_[_0xf4e4('0x48')]({},_0xf23ec8,_0x1d296d['options']);var _0x48aaf5={'where':_0xf23ec8[_0xf4e4('0x44')]};return db[_0xf4e4('0x34')]['count'](_0x48aaf5)[_0xf4e4('0x2d')](function(_0x287fe7){_0x2a3bf6[_0xf4e4('0x26')]=_0x287fe7;if(_0x1d296d['query'][_0xf4e4('0x49')]){_0xf23ec8[_0xf4e4('0x4a')]=[{'all':!![]}];}return db[_0xf4e4('0x34')][_0xf4e4('0x4b')](_0xf23ec8);})[_0xf4e4('0x2d')](function(_0x552868){_0x2a3bf6[_0xf4e4('0x4c')]=_0x552868;return _0x2a3bf6;})['then'](respondWithFilteredResult(_0x4dfb0f,_0xf23ec8))['catch'](handleError(_0x4dfb0f,null));};exports['show']=function(_0x1763ee,_0x169e92){var _0x31ccba={'raw':![],'where':{'id':_0x1763ee[_0xf4e4('0x4d')]['id']}},_0x181933={};_0x181933['model']=_[_0xf4e4('0x3a')](db[_0xf4e4('0x34')][_0xf4e4('0x35')]);_0x181933['query']=_[_0xf4e4('0x3a')](_0x1763ee[_0xf4e4('0x3d')]);_0x181933[_0xf4e4('0x3b')]=_[_0xf4e4('0x3c')](_0x181933[_0xf4e4('0x39')],_0x181933['query']);_0x31ccba[_0xf4e4('0x3f')]=_[_0xf4e4('0x3c')](_0x181933[_0xf4e4('0x39')],qs[_0xf4e4('0x3e')](_0x1763ee[_0xf4e4('0x3d')][_0xf4e4('0x3e')]));_0x31ccba[_0xf4e4('0x3f')]=_0x31ccba[_0xf4e4('0x3f')][_0xf4e4('0x40')]?_0x31ccba[_0xf4e4('0x3f')]:_0x181933[_0xf4e4('0x39')];if(_0x1763ee[_0xf4e4('0x3d')][_0xf4e4('0x49')]){_0x31ccba[_0xf4e4('0x4a')]=[{'all':!![]}];}_0x31ccba=_['merge']({},_0x31ccba,_0x1763ee['options']);return db[_0xf4e4('0x34')][_0xf4e4('0x4e')](_0x31ccba)[_0xf4e4('0x2d')](handleEntityNotFound(_0x169e92,null))[_0xf4e4('0x2d')](respondWithResult(_0x169e92,null))['catch'](handleError(_0x169e92,null));};exports['create']=function(_0x37ce4d,_0x457cb7){return db[_0xf4e4('0x34')][_0xf4e4('0x4f')](_0x37ce4d[_0xf4e4('0x50')],{})[_0xf4e4('0x2d')](respondWithResult(_0x457cb7,0xc9))[_0xf4e4('0x51')](handleError(_0x457cb7,null));};exports[_0xf4e4('0x2c')]=function(_0x182c45,_0x5ca653){if(_0x182c45['body']['id']){delete _0x182c45['body']['id'];}return db[_0xf4e4('0x34')][_0xf4e4('0x4e')]({'where':{'id':_0x182c45[_0xf4e4('0x4d')]['id']}})[_0xf4e4('0x2d')](handleEntityNotFound(_0x5ca653,null))[_0xf4e4('0x2d')](saveUpdates(_0x182c45[_0xf4e4('0x50')],null))[_0xf4e4('0x2d')](respondWithResult(_0x5ca653,null))[_0xf4e4('0x51')](handleError(_0x5ca653,null));};exports['destroy']=function(_0x311e5d,_0x1922cc){return db[_0xf4e4('0x34')]['find']({'where':{'id':_0x311e5d[_0xf4e4('0x4d')]['id']}})[_0xf4e4('0x2d')](handleEntityNotFound(_0x1922cc,null))['then'](removeEntity(_0x1922cc,null))['catch'](handleError(_0x1922cc,null));};exports[_0xf4e4('0x52')]=function(_0x517870,_0x3d2607){return db['VoiceQueueReport'][_0xf4e4('0x52')]()[_0xf4e4('0x2d')](respondWithResult(_0x3d2607,null))[_0xf4e4('0x51')](handleError(_0x3d2607,null));};exports['getVoiceQueuesReport']=function(_0x251bef,_0x24d82b){var _0x1b3376={},_0x5f1db8={},_0xbb9fd3={'count':0x0,'rows':[]};_0x5f1db8[_0xf4e4('0x39')]=_[_0xf4e4('0x3a')](db['VoiceQueueReport'][_0xf4e4('0x35')]);_0x5f1db8[_0xf4e4('0x3d')]=_['keys'](_0x251bef['query']);_0x5f1db8[_0xf4e4('0x3b')]=_[_0xf4e4('0x3c')](_0x5f1db8[_0xf4e4('0x39')],_0x5f1db8[_0xf4e4('0x3d')]);_0x1b3376['attributes']=_['intersection'](_0x5f1db8[_0xf4e4('0x39')],qs[_0xf4e4('0x3e')](_0x251bef['query'][_0xf4e4('0x3e')]));_0x1b3376[_0xf4e4('0x3f')]=_0x1b3376[_0xf4e4('0x3f')][_0xf4e4('0x40')]?_0x1b3376['attributes']:_0x5f1db8['model'];if(!_0x251bef['query']['hasOwnProperty'](_0xf4e4('0x53'))){_0x1b3376[_0xf4e4('0x25')]=qs[_0xf4e4('0x25')](_0x251bef['query'][_0xf4e4('0x25')]);_0x1b3376[_0xf4e4('0x23')]=qs[_0xf4e4('0x23')](_0x251bef['query'][_0xf4e4('0x23')]);}_0x1b3376[_0xf4e4('0x42')]=qs[_0xf4e4('0x43')](_0x251bef[_0xf4e4('0x3d')][_0xf4e4('0x43')]);_0x1b3376[_0xf4e4('0x44')]=qs[_0xf4e4('0x3b')](_['pick'](_0x251bef[_0xf4e4('0x3d')],_0x5f1db8['filters']));if(_0x251bef[_0xf4e4('0x3d')][_0xf4e4('0x46')]){_0x1b3376[_0xf4e4('0x44')]=_['merge'](_0x1b3376[_0xf4e4('0x44')],{'$or':_[_0xf4e4('0x33')](_0x1b3376[_0xf4e4('0x3f')],function(_0xd2b512){var _0x110fc2={};_0x110fc2[_0xd2b512]={'$like':'%'+_0x251bef[_0xf4e4('0x3d')]['filter']+'%'};return _0x110fc2;})});}_0x1b3376=_[_0xf4e4('0x48')]({},_0x1b3376,_0x251bef['options']);var _0x2d502b={'where':_0x1b3376[_0xf4e4('0x44')]};return db[_0xf4e4('0x34')]['count'](_0x2d502b)[_0xf4e4('0x2d')](function(_0x47257f){_0xbb9fd3['count']=_0x47257f;if(_0x251bef[_0xf4e4('0x3d')][_0xf4e4('0x49')]){_0x1b3376[_0xf4e4('0x4a')]=[{'all':!![]}];}return db[_0xf4e4('0x34')][_0xf4e4('0x4b')](_0x1b3376);})['then'](function(_0x47259b){_0xbb9fd3[_0xf4e4('0x4c')]=_0x47259b;return _0xbb9fd3;})[_0xf4e4('0x2d')](respondWithFilteredResult(_0x24d82b,_0x1b3376,_0xf4e4('0x54')))[_0xf4e4('0x51')](handleError(_0x24d82b,null,_0xf4e4('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b4a506c..0612f09 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 _0x47ad=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x5760b8,_0x5f127b){var _0x1c85dd=function(_0x5de48a){while(--_0x5de48a){_0x5760b8['push'](_0x5760b8['shift']());}};_0x1c85dd(++_0x5f127b);}(_0x47ad,0xa4));var _0xd47a=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x47ad[_0x476c7];return _0x47ae56;};'use strict';var EventEmitter=require(_0xd47a('0x0'));var VoiceQueueReport=require(_0xd47a('0x1'))['db'][_0xd47a('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd47a('0x3')](0x0);var events={'afterCreate':_0xd47a('0x4'),'afterUpdate':_0xd47a('0x5'),'afterDestroy':_0xd47a('0x6')};function emitEvent(_0x4a41b1){return function(_0x15bd38,_0x5e842b,_0xf30198){VoiceQueueReportEvents[_0xd47a('0x7')](_0x4a41b1+':'+_0x15bd38['id'],_0x15bd38);VoiceQueueReportEvents['emit'](_0x4a41b1,_0x15bd38);_0xf30198(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xd47a('0x8')](e,emitEvent(event));}}module[_0xd47a('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x847d=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','update','remove','emit'];(function(_0x3aaef5,_0x16cdc8){var _0x4c0ed5=function(_0x4f7046){while(--_0x4f7046){_0x3aaef5['push'](_0x3aaef5['shift']());}};_0x4c0ed5(++_0x16cdc8);}(_0x847d,0x93));var _0xd847=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x847d[_0x16771d];return _0x386f11;};'use strict';var EventEmitter=require(_0xd847('0x0'));var VoiceQueueReport=require(_0xd847('0x1'))['db'][_0xd847('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd847('0x3'),'afterDestroy':_0xd847('0x4')};function emitEvent(_0x443f86){return function(_0x3f2f1b,_0x120f01,_0x596ccd){VoiceQueueReportEvents[_0xd847('0x5')](_0x443f86+':'+_0x3f2f1b['id'],_0x3f2f1b);VoiceQueueReportEvents[_0xd847('0x5')](_0x443f86,_0x3f2f1b);_0x596ccd(null);};}for(var e in events){if(events[_0xd847('0x6')](e)){var event=events[e];VoiceQueueReport[_0xd847('0x7')](e,emitEvent(event));}}module[_0xd847('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 36b94bd..faf238d 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 _0x007b=['path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x007b,0x164));var _0xb007=function(_0x58e972,_0x2667fc){_0x58e972=_0x58e972-0x0;var _0x260176=_0x007b[_0x58e972];return _0x260176;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb007('0x0'))(_0xb007('0x1'));var moment=require(_0xb007('0x2'));var BPromise=require(_0xb007('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb007('0x4'));var rimraf=require('rimraf');var config=require(_0xb007('0x5'));var attributes=require(_0xb007('0x6'));module[_0xb007('0x7')]=function(_0x5b3a87,_0x48f5ad){return _0x5b3a87[_0xb007('0x8')](_0xb007('0x9'),attributes,{'tableName':_0xb007('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb007('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x95eb=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x4c9191,_0xe10c76){var _0x593642=function(_0x11e43b){while(--_0x11e43b){_0x4c9191['push'](_0x4c9191['shift']());}};_0x593642(++_0xe10c76);}(_0x95eb,0x7c));var _0xb95e=function(_0x914fd8,_0x202308){_0x914fd8=_0x914fd8-0x0;var _0x4aa239=_0x95eb[_0x914fd8];return _0x4aa239;};'use strict';var _=require(_0xb95e('0x0'));var util=require(_0xb95e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb95e('0x2'));var BPromise=require(_0xb95e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb95e('0x4'));var rimraf=require('rimraf');var config=require(_0xb95e('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0xb95e('0x6')]=function(_0x199060,_0x475608){return _0x199060[_0xb95e('0x7')](_0xb95e('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xb95e('0x9')]},{'fields':[_0xb95e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a6d2efd..25bb6a1 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 _0x577f=['options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceQueueReport','findAll'];(function(_0x8c0dda,_0x2d3a2b){var _0x5f5106=function(_0x38aa12){while(--_0x38aa12){_0x8c0dda['push'](_0x8c0dda['shift']());}};_0x5f5106(++_0x2d3a2b);}(_0x577f,0x1b3));var _0xf577=function(_0x1b0d41,_0x128699){_0x1b0d41=_0x1b0d41-0x0;var _0x2568b4=_0x577f[_0x1b0d41];return _0x2568b4;};'use strict';var _=require(_0xf577('0x0'));var util=require(_0xf577('0x1'));var moment=require(_0xf577('0x2'));var BPromise=require('bluebird');var rs=require(_0xf577('0x3'));var fs=require('fs');var Redis=require(_0xf577('0x4'));var db=require(_0xf577('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf577('0x6'))('rpc');var config=require(_0xf577('0x7'));var jayson=require(_0xf577('0x8'));var client=jayson[_0xf577('0x9')][_0xf577('0xa')]({'port':0x232a});config[_0xf577('0xb')]=_['defaults'](config[_0xf577('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf577('0xc'))(new Redis(config[_0xf577('0xb')]));require(_0xf577('0xd'))['register'](socket);function respondWithRpcPromise(_0x41efe9,_0x546b0c,_0xf3c871){return new BPromise(function(_0x58e612,_0x7eccee){return client[_0xf577('0xe')](_0x41efe9,_0xf3c871)[_0xf577('0xf')](function(_0xf79253){logger[_0xf577('0x10')](_0xf577('0x11'),_0x546b0c,_0xf577('0x12'));logger[_0xf577('0x13')](_0xf577('0x14'),_0x546b0c,'request\x20sent',JSON['stringify'](_0xf79253));if(_0xf79253[_0xf577('0x15')]){if(_0xf79253[_0xf577('0x15')]['code']===0x1f4){logger[_0xf577('0x15')](_0xf577('0x11'),_0x546b0c,_0xf79253[_0xf577('0x15')][_0xf577('0x16')]);return _0x7eccee(_0xf79253[_0xf577('0x15')][_0xf577('0x16')]);}logger['error'](_0xf577('0x11'),_0x546b0c,_0xf79253['error'][_0xf577('0x16')]);return _0x58e612(_0xf79253[_0xf577('0x15')][_0xf577('0x16')]);}else{logger['info'](_0xf577('0x11'),_0x546b0c,_0xf577('0x12'));_0x58e612(_0xf79253[_0xf577('0x17')][_0xf577('0x16')]);}})[_0xf577('0x18')](function(_0x52d716){logger[_0xf577('0x15')](_0xf577('0x11'),_0x546b0c,_0x52d716);_0x7eccee(_0x52d716);});});}exports['GetVoiceQueueReport']=function(_0x41226a){var _0x335946=this;return new Promise(function(_0x2b02b1,_0x73d221){return db[_0xf577('0x19')][_0xf577('0x1a')]({'raw':_0x41226a[_0xf577('0x1b')]?_0x41226a[_0xf577('0x1b')][_0xf577('0x1c')]===undefined?!![]:![]:!![],'where':_0x41226a[_0xf577('0x1b')]?_0x41226a[_0xf577('0x1b')][_0xf577('0x1d')]||null:null,'attributes':_0x41226a['options']?_0x41226a['options'][_0xf577('0x1e')]||null:null,'limit':_0x41226a[_0xf577('0x1b')]?_0x41226a[_0xf577('0x1b')][_0xf577('0x1f')]||null:null,'include':_0x41226a[_0xf577('0x1b')]?_0x41226a[_0xf577('0x1b')][_0xf577('0x20')]?_[_0xf577('0x21')](_0x41226a[_0xf577('0x1b')][_0xf577('0x20')],function(_0x49e548){return{'model':db[_0x49e548[_0xf577('0x22')]],'as':_0x49e548['as'],'attributes':_0x49e548[_0xf577('0x1e')],'include':_0x49e548[_0xf577('0x20')]?_[_0xf577('0x21')](_0x49e548[_0xf577('0x20')],function(_0x9a33f1){return{'model':db[_0x9a33f1[_0xf577('0x22')]],'as':_0x9a33f1['as'],'attributes':_0x9a33f1[_0xf577('0x1e')],'include':_0x9a33f1[_0xf577('0x20')]?_[_0xf577('0x21')](_0x9a33f1[_0xf577('0x20')],function(_0x578945){return{'model':db[_0x578945['model']],'as':_0x578945['as'],'attributes':_0x578945[_0xf577('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf577('0xf')](function(_0x5a9739){logger[_0xf577('0x10')](_0xf577('0x23'),_0x41226a);logger[_0xf577('0x13')](_0xf577('0x23'),_0x41226a,JSON[_0xf577('0x24')](_0x5a9739));_0x2b02b1(_0x5a9739);})[_0xf577('0x18')](function(_0x25e33e){logger[_0xf577('0x15')](_0xf577('0x23'),_0x25e33e['message'],_0x41226a);_0x73d221(_0x335946[_0xf577('0x15')](0x1f4,_0x25e33e['message']));});});};exports[_0xf577('0x25')]=function(_0x10ed9e){var _0x355c02=this;return new Promise(function(_0x33a741,_0x2aba0b){return db[_0xf577('0x19')][_0xf577('0x26')](_0x10ed9e['body'],{'raw':_0x10ed9e['options']?_0x10ed9e[_0xf577('0x1b')][_0xf577('0x1c')]===undefined?!![]:![]:!![]})[_0xf577('0xf')](function(_0x10075f){logger['info'](_0xf577('0x25'),_0x10ed9e);logger[_0xf577('0x13')]('CreateVoiceQueueReport',_0x10ed9e,JSON[_0xf577('0x24')](_0x10075f));_0x33a741(_0x10075f);})[_0xf577('0x18')](function(_0x4cf9ef){logger[_0xf577('0x15')](_0xf577('0x25'),_0x4cf9ef[_0xf577('0x16')],_0x10ed9e);_0x2aba0b(_0x355c02[_0xf577('0x15')](0x1f4,_0x4cf9ef['message']));});});};exports[_0xf577('0x27')]=function(_0x4141df){var _0x438e33=this;return new Promise(function(_0x2d6980,_0x43ea33){return db[_0xf577('0x19')][_0xf577('0x28')](_0x4141df[_0xf577('0x29')],{'raw':_0x4141df[_0xf577('0x1b')]?_0x4141df['options'][_0xf577('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4141df['options']?_0x4141df[_0xf577('0x1b')][_0xf577('0x1d')]||null:null,'attributes':_0x4141df[_0xf577('0x1b')]?_0x4141df[_0xf577('0x1b')][_0xf577('0x1e')]||null:null,'limit':_0x4141df[_0xf577('0x1b')]?_0x4141df[_0xf577('0x1b')]['limit']||null:null})[_0xf577('0xf')](function(_0x58a02b){logger[_0xf577('0x10')](_0xf577('0x27'),_0x4141df);logger[_0xf577('0x13')](_0xf577('0x27'),_0x4141df,JSON['stringify'](_0x58a02b));_0x2d6980(_0x58a02b);})['catch'](function(_0x4cba5c){logger[_0xf577('0x15')](_0xf577('0x27'),_0x4cba5c['message'],_0x4141df);_0x43ea33(_0x438e33[_0xf577('0x15')](0x1f4,_0x4cba5c['message']));});});}; \ No newline at end of file +var _0x9c13=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','body','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9c13,0x10f));var _0x39c1=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9c13[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x39c1('0x0'));var util=require(_0x39c1('0x1'));var moment=require(_0x39c1('0x2'));var BPromise=require(_0x39c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x39c1('0x5'));var logger=require(_0x39c1('0x6'))(_0x39c1('0x7'));var config=require(_0x39c1('0x8'));var jayson=require(_0x39c1('0x9'));var client=jayson[_0x39c1('0xa')][_0x39c1('0xb')]({'port':0x232a});config[_0x39c1('0xc')]=_[_0x39c1('0xd')](config[_0x39c1('0xc')],{'host':_0x39c1('0xe'),'port':0x18eb});var socket=require(_0x39c1('0xf'))(new Redis(config[_0x39c1('0xc')]));require(_0x39c1('0x10'))[_0x39c1('0x11')](socket);function respondWithRpcPromise(_0x202236,_0xf3f628,_0x559c06){return new BPromise(function(_0x52651d,_0x575e6e){return client[_0x39c1('0x12')](_0x202236,_0x559c06)[_0x39c1('0x13')](function(_0x1372d1){logger[_0x39c1('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0xf3f628,_0x39c1('0x15'));logger[_0x39c1('0x16')](_0x39c1('0x17'),_0xf3f628,_0x39c1('0x15'),JSON[_0x39c1('0x18')](_0x1372d1));if(_0x1372d1[_0x39c1('0x19')]){if(_0x1372d1[_0x39c1('0x19')][_0x39c1('0x1a')]===0x1f4){logger[_0x39c1('0x19')](_0x39c1('0x1b'),_0xf3f628,_0x1372d1[_0x39c1('0x19')]['message']);return _0x575e6e(_0x1372d1[_0x39c1('0x19')][_0x39c1('0x1c')]);}logger[_0x39c1('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0xf3f628,_0x1372d1[_0x39c1('0x19')][_0x39c1('0x1c')]);return _0x52651d(_0x1372d1[_0x39c1('0x19')]['message']);}else{logger['info'](_0x39c1('0x1b'),_0xf3f628,_0x39c1('0x15'));_0x52651d(_0x1372d1[_0x39c1('0x1d')][_0x39c1('0x1c')]);}})[_0x39c1('0x1e')](function(_0x54c740){logger[_0x39c1('0x19')](_0x39c1('0x1b'),_0xf3f628,_0x54c740);_0x575e6e(_0x54c740);});});}exports[_0x39c1('0x1f')]=function(_0x527612){var _0x4ea4bc=this;return new Promise(function(_0xbb20ed,_0x5c60ba){return db[_0x39c1('0x20')][_0x39c1('0x21')]({'raw':_0x527612[_0x39c1('0x22')]?_0x527612['options'][_0x39c1('0x23')]===undefined?!![]:![]:!![],'where':_0x527612['options']?_0x527612[_0x39c1('0x22')][_0x39c1('0x24')]||null:null,'attributes':_0x527612[_0x39c1('0x22')]?_0x527612[_0x39c1('0x22')][_0x39c1('0x25')]||null:null,'limit':_0x527612[_0x39c1('0x22')]?_0x527612[_0x39c1('0x22')][_0x39c1('0x26')]||null:null,'include':_0x527612[_0x39c1('0x22')]?_0x527612[_0x39c1('0x22')][_0x39c1('0x27')]?_[_0x39c1('0x28')](_0x527612[_0x39c1('0x22')][_0x39c1('0x27')],function(_0x45a22b){return{'model':db[_0x45a22b['model']],'as':_0x45a22b['as'],'attributes':_0x45a22b['attributes'],'include':_0x45a22b['include']?_[_0x39c1('0x28')](_0x45a22b[_0x39c1('0x27')],function(_0x3c6100){return{'model':db[_0x3c6100['model']],'as':_0x3c6100['as'],'attributes':_0x3c6100[_0x39c1('0x25')],'include':_0x3c6100[_0x39c1('0x27')]?_[_0x39c1('0x28')](_0x3c6100[_0x39c1('0x27')],function(_0x1b65f){return{'model':db[_0x1b65f[_0x39c1('0x29')]],'as':_0x1b65f['as'],'attributes':_0x1b65f['attributes']};}):[]};}):[]};}):[]:[]})[_0x39c1('0x13')](function(_0x505e79){logger[_0x39c1('0x14')](_0x39c1('0x1f'),_0x527612);logger[_0x39c1('0x16')]('GetVoiceQueueReport',_0x527612,JSON[_0x39c1('0x18')](_0x505e79));_0xbb20ed(_0x505e79);})[_0x39c1('0x1e')](function(_0x27de2e){logger[_0x39c1('0x19')](_0x39c1('0x1f'),_0x27de2e[_0x39c1('0x1c')],_0x527612);_0x5c60ba(_0x4ea4bc[_0x39c1('0x19')](0x1f4,_0x27de2e[_0x39c1('0x1c')]));});});};exports[_0x39c1('0x2a')]=function(_0x1bf28){var _0x334b3e=this;return new Promise(function(_0x1737e0,_0x211ddd){return db[_0x39c1('0x20')]['create'](_0x1bf28[_0x39c1('0x2b')],{'raw':_0x1bf28[_0x39c1('0x22')]?_0x1bf28[_0x39c1('0x22')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x18a3e2){logger['info'](_0x39c1('0x2a'),_0x1bf28);logger['debug'](_0x39c1('0x2a'),_0x1bf28,JSON[_0x39c1('0x18')](_0x18a3e2));_0x1737e0(_0x18a3e2);})[_0x39c1('0x1e')](function(_0x1794a4){logger['error'](_0x39c1('0x2a'),_0x1794a4[_0x39c1('0x1c')],_0x1bf28);_0x211ddd(_0x334b3e['error'](0x1f4,_0x1794a4[_0x39c1('0x1c')]));});});};exports['UpdateVoiceQueueReport']=function(_0x5542ae){var _0x45f0f7=this;return new Promise(function(_0x4d3908,_0x10c723){return db[_0x39c1('0x20')][_0x39c1('0x2c')](_0x5542ae[_0x39c1('0x2b')],{'raw':_0x5542ae['options']?_0x5542ae['options'][_0x39c1('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5542ae['options']?_0x5542ae[_0x39c1('0x22')][_0x39c1('0x24')]||null:null,'attributes':_0x5542ae[_0x39c1('0x22')]?_0x5542ae[_0x39c1('0x22')][_0x39c1('0x25')]||null:null,'limit':_0x5542ae[_0x39c1('0x22')]?_0x5542ae[_0x39c1('0x22')]['limit']||null:null})[_0x39c1('0x13')](function(_0x31de3e){logger['info']('UpdateVoiceQueueReport',_0x5542ae);logger[_0x39c1('0x16')](_0x39c1('0x2d'),_0x5542ae,JSON[_0x39c1('0x18')](_0x31de3e));_0x4d3908(_0x31de3e);})[_0x39c1('0x1e')](function(_0x2f8526){logger[_0x39c1('0x19')](_0x39c1('0x2d'),_0x2f8526['message'],_0x5542ae);_0x10c723(_0x45f0f7[_0x39c1('0x19')](0x1f4,_0x2f8526[_0x39c1('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b603178..0d5a909 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 _0xeb5d=['register','length','voiceQueueReport:','save','remove','update','emit','removeListener'];(function(_0x3c4140,_0x37e846){var _0x31764b=function(_0x5e5ecd){while(--_0x5e5ecd){_0x3c4140['push'](_0x3c4140['shift']());}};_0x31764b(++_0x37e846);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xeb5d[_0x2c91e9];return _0x13f0ff;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xdeb5('0x0'),_0xdeb5('0x1'),_0xdeb5('0x2')];function createListener(_0x2b0a09,_0x55bbde){return function(_0x5acd11){_0x55bbde[_0xdeb5('0x3')](_0x2b0a09,_0x5acd11);};}function removeListener(_0x16c31b,_0x546313){return function(){VoiceQueueReportEvents[_0xdeb5('0x4')](_0x16c31b,_0x546313);};}exports[_0xdeb5('0x5')]=function(_0x164ecb){for(var _0x33af72=0x0,_0x120329=events[_0xdeb5('0x6')];_0x33af72<_0x120329;_0x33af72++){var _0x328d6b=events[_0x33af72];var _0x35c086=createListener(_0xdeb5('0x7')+_0x328d6b,_0x164ecb);VoiceQueueReportEvents['on'](_0x328d6b,_0x35c086);}}; \ No newline at end of file +var _0x5a52=['voiceQueueReport:','./voiceQueueReport.events','emit','removeListener','register','length'];(function(_0x572637,_0x216d95){var _0xb6748=function(_0x3eeb8c){while(--_0x3eeb8c){_0x572637['push'](_0x572637['shift']());}};_0xb6748(++_0x216d95);}(_0x5a52,0x18d));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueReportEvents=require(_0x25a5('0x0'));var events=['save','remove','update'];function createListener(_0x4427a1,_0x3d1573){return function(_0x2553ad){_0x3d1573[_0x25a5('0x1')](_0x4427a1,_0x2553ad);};}function removeListener(_0x2fc1db,_0x407636){return function(){VoiceQueueReportEvents[_0x25a5('0x2')](_0x2fc1db,_0x407636);};}exports[_0x25a5('0x3')]=function(_0x5db751){for(var _0x2c210a=0x0,_0x4d0639=events[_0x25a5('0x4')];_0x2c210a<_0x4d0639;_0x2c210a++){var _0x2d8920=events[_0x2c210a];var _0x31a0a=createListener(_0x25a5('0x5')+_0x2d8920,_0x5db751);VoiceQueueReportEvents['on'](_0x2d8920,_0x31a0a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 727997e..83f3e75 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 _0xc698=['show','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./voiceQueuesLog.controller','get','/:id','isAuthenticated'];(function(_0x42e034,_0x5ecdef){var _0x1d3d70=function(_0x800c3c){while(--_0x800c3c){_0x42e034['push'](_0x42e034['shift']());}};_0x1d3d70(++_0x5ecdef);}(_0xc698,0x116));var _0x8c69=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0xc698[_0x1460f6];return _0x46ce94;};'use strict';var multer=require(_0x8c69('0x0'));var util=require(_0x8c69('0x1'));var path=require(_0x8c69('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c69('0x3'));var router=express[_0x8c69('0x4')]();var fs_extra=require(_0x8c69('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8c69('0x6'));var config=require('../../config/environment');var controller=require(_0x8c69('0x7'));router[_0x8c69('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8c69('0x8')](_0x8c69('0x9'),auth[_0x8c69('0xa')](),controller[_0x8c69('0xb')]);router[_0x8c69('0xc')]('/',auth[_0x8c69('0xa')](),controller[_0x8c69('0xd')]);router[_0x8c69('0xe')](_0x8c69('0x9'),auth[_0x8c69('0xa')](),controller[_0x8c69('0xf')]);router[_0x8c69('0x10')]('/:id',auth[_0x8c69('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa67b=['util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x266105,_0x196dce){var _0x5ec0d5=function(_0x2e4481){while(--_0x2e4481){_0x266105['push'](_0x266105['shift']());}};_0x5ec0d5(++_0x196dce);}(_0xa67b,0xc5));var _0xba67=function(_0x7b9a37,_0x21163){_0x7b9a37=_0x7b9a37-0x0;var _0x262da0=_0xa67b[_0x7b9a37];return _0x262da0;};'use strict';var multer=require(_0xba67('0x0'));var util=require(_0xba67('0x1'));var path=require(_0xba67('0x2'));var timeout=require('connect-timeout');var express=require(_0xba67('0x3'));var router=express['Router']();var fs_extra=require(_0xba67('0x4'));var auth=require(_0xba67('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba67('0x6'));var controller=require(_0xba67('0x7'));router['get']('/',auth[_0xba67('0x8')](),controller[_0xba67('0x9')]);router[_0xba67('0xa')](_0xba67('0xb'),auth[_0xba67('0x8')](),controller[_0xba67('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xba67('0xd')]);router[_0xba67('0xe')](_0xba67('0xb'),auth['isAuthenticated'](),controller[_0xba67('0xf')]);router[_0xba67('0x10')](_0xba67('0xb'),auth[_0xba67('0x8')](),controller[_0xba67('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index bd813e2..4218381 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 _0xe232=['moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe232,0x1f0));var _0x2e23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe232[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2e23('0x0'));var moment=require(_0x2e23('0x1'));module[_0x2e23('0x2')]={'time':{'type':Sequelize[_0x2e23('0x3')]},'callid':{'type':Sequelize[_0x2e23('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2e23('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2e23('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2e23('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2e23('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2e23('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2e23('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2e23('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x2e23('0x5')](_0x2e23('0x6'))}}; \ No newline at end of file +var _0xab9b=['moment','exports','STRING','DATE','literal'];(function(_0x4883cb,_0x3df63c){var _0x33aad7=function(_0x2e901e){while(--_0x2e901e){_0x4883cb['push'](_0x4883cb['shift']());}};_0x33aad7(++_0x3df63c);}(_0xab9b,0x1b3));var _0xbab9=function(_0x3e8f4d,_0x2973ed){_0x3e8f4d=_0x3e8f4d-0x0;var _0x590a2e=_0xab9b[_0x3e8f4d];return _0x590a2e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbab9('0x0'));module[_0xbab9('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xbab9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xbab9('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbab9('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c0126a4..2be9bbe 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 _0x0970=['pick','filter','merge','options','includeAll','findAll','rows','show','params','length','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0x0970,0x185));var _0x0097=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0970[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0097('0x1'));var rp=require(_0x0097('0x2'));var moment=require(_0x0097('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0097('0x4'));var util=require(_0x0097('0x5'));var path=require(_0x0097('0x6'));var sox=require(_0x0097('0x7'));var csv=require(_0x0097('0x8'));var ejs=require(_0x0097('0x9'));var fs=require('fs');var fs_extra=require(_0x0097('0xa'));var _=require(_0x0097('0xb'));var squel=require(_0x0097('0xc'));var crypto=require(_0x0097('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0097('0x8'));var querystring=require(_0x0097('0xe'));var Papa=require(_0x0097('0xf'));var Redis=require('ioredis');var authService=require(_0x0097('0x10'));var qs=require(_0x0097('0x11'));var as=require(_0x0097('0x12'));var hardwareService=require(_0x0097('0x13'));var logger=require(_0x0097('0x14'))(_0x0097('0x15'));var utils=require(_0x0097('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0097('0x17'));var db=require(_0x0097('0x18'))['db'];function respondWithStatusCode(_0x16a1ce,_0x52a2d2){_0x52a2d2=_0x52a2d2||0xcc;return function(_0x166253){if(_0x166253){return _0x16a1ce[_0x0097('0x19')](_0x52a2d2);}return _0x16a1ce[_0x0097('0x1a')](_0x52a2d2)[_0x0097('0x1b')]();};}function respondWithResult(_0x238713,_0x330aaa){_0x330aaa=_0x330aaa||0xc8;return function(_0x5ecc63){if(_0x5ecc63){return _0x238713[_0x0097('0x1a')](_0x330aaa)[_0x0097('0x1c')](_0x5ecc63);}};}function respondWithFilteredResult(_0x352be0,_0x2a7db6){return function(_0xb2250a){if(_0xb2250a){var _0x459a68=typeof _0x2a7db6['offset']===_0x0097('0x1d')&&typeof _0x2a7db6[_0x0097('0x1e')]===_0x0097('0x1d');var _0x4bb0d7=_0xb2250a['count'];var _0x24ac87=_0x459a68?0x0:_0x2a7db6[_0x0097('0x1f')];var _0x634743=_0x459a68?_0xb2250a[_0x0097('0x20')]:_0x2a7db6[_0x0097('0x1f')]+_0x2a7db6[_0x0097('0x1e')];var _0x17a018;if(_0x634743>=_0x4bb0d7){_0x634743=_0x4bb0d7;_0x17a018=0xc8;}else{_0x17a018=0xce;}_0x352be0[_0x0097('0x1a')](_0x17a018);return _0x352be0[_0x0097('0x21')](_0x0097('0x22'),_0x24ac87+'-'+_0x634743+'/'+_0x4bb0d7)['json'](_0xb2250a);}return null;};}function patchUpdates(_0x3496b9){return function(_0x7e82bf){try{jsonpatch[_0x0097('0x23')](_0x7e82bf,_0x3496b9,!![]);}catch(_0x3d655e){return BPromise[_0x0097('0x24')](_0x3d655e);}return _0x7e82bf[_0x0097('0x25')]();};}function saveUpdates(_0x421f43,_0x5ba452){return function(_0x5f066e){if(_0x5f066e){return _0x5f066e[_0x0097('0x26')](_0x421f43)['then'](function(_0x4a2c14){return _0x4a2c14;});}return null;};}function removeEntity(_0x51565a,_0x5484b3){return function(_0x575950){if(_0x575950){return _0x575950[_0x0097('0x27')]()[_0x0097('0x28')](function(){_0x51565a[_0x0097('0x1a')](0xcc)[_0x0097('0x1b')]();});}};}function handleEntityNotFound(_0x3a43b6,_0x34b363){return function(_0x137e91){if(!_0x137e91){_0x3a43b6[_0x0097('0x19')](0x194);}return _0x137e91;};}function handleError(_0x4f79df,_0x692619){_0x692619=_0x692619||0x1f4;return function(_0x280a3d){logger['error'](_0x280a3d['stack']);if(_0x280a3d[_0x0097('0x29')]){delete _0x280a3d[_0x0097('0x29')];}_0x4f79df['status'](_0x692619)[_0x0097('0x2a')](_0x280a3d);};}exports[_0x0097('0x2b')]=function(_0x1ec8f0,_0x57bc25){var _0x276816={},_0x824047={},_0x6581ec={'count':0x0,'rows':[]};var _0x782e79=_[_0x0097('0x2c')](db[_0x0097('0x2d')][_0x0097('0x2e')],function(_0x51b1bf){return{'name':_0x51b1bf['fieldName'],'type':_0x51b1bf[_0x0097('0x2f')][_0x0097('0x30')]};});_0x824047[_0x0097('0x31')]=_[_0x0097('0x2c')](_0x782e79,'name');_0x824047[_0x0097('0x32')]=_[_0x0097('0x33')](_0x1ec8f0['query']);_0x824047[_0x0097('0x34')]=_[_0x0097('0x35')](_0x824047[_0x0097('0x31')],_0x824047[_0x0097('0x32')]);_0x276816[_0x0097('0x36')]=_['intersection'](_0x824047[_0x0097('0x31')],qs['fields'](_0x1ec8f0['query'][_0x0097('0x37')]));_0x276816['attributes']=_0x276816[_0x0097('0x36')]['length']?_0x276816[_0x0097('0x36')]:_0x824047[_0x0097('0x31')];if(!_0x1ec8f0[_0x0097('0x32')][_0x0097('0x38')](_0x0097('0x39'))){_0x276816[_0x0097('0x1e')]=qs[_0x0097('0x1e')](_0x1ec8f0[_0x0097('0x32')][_0x0097('0x1e')]);_0x276816[_0x0097('0x1f')]=qs[_0x0097('0x1f')](_0x1ec8f0[_0x0097('0x32')]['offset']);}_0x276816[_0x0097('0x3a')]=qs[_0x0097('0x3b')](_0x1ec8f0[_0x0097('0x32')][_0x0097('0x3b')]);_0x276816[_0x0097('0x3c')]=qs[_0x0097('0x34')](_[_0x0097('0x3d')](_0x1ec8f0['query'],_0x824047[_0x0097('0x34')]),_0x782e79);if(_0x1ec8f0[_0x0097('0x32')][_0x0097('0x3e')]){_0x276816['where']=_[_0x0097('0x3f')](_0x276816[_0x0097('0x3c')],{'$or':_[_0x0097('0x2c')](_0x782e79,function(_0x58427d){if(_0x58427d[_0x0097('0x2f')]!=='VIRTUAL'){var _0x271f75={};_0x271f75[_0x58427d['name']]={'$like':'%'+_0x1ec8f0[_0x0097('0x32')][_0x0097('0x3e')]+'%'};return _0x271f75;}})});}_0x276816=_[_0x0097('0x3f')]({},_0x276816,_0x1ec8f0[_0x0097('0x40')]);var _0x41c38d={'where':_0x276816[_0x0097('0x3c')]};return db['VoiceQueuesLog'][_0x0097('0x20')](_0x41c38d)['then'](function(_0x10e115){_0x6581ec[_0x0097('0x20')]=_0x10e115;if(_0x1ec8f0[_0x0097('0x32')][_0x0097('0x41')]){_0x276816['include']=[{'all':!![]}];}return db[_0x0097('0x2d')][_0x0097('0x42')](_0x276816);})[_0x0097('0x28')](function(_0x3c316e){_0x6581ec[_0x0097('0x43')]=_0x3c316e;return _0x6581ec;})[_0x0097('0x28')](respondWithFilteredResult(_0x57bc25,_0x276816))['catch'](handleError(_0x57bc25,null));};exports[_0x0097('0x44')]=function(_0x6b3270,_0x3be84e){var _0x1567dc={'raw':!![],'where':{'id':_0x6b3270[_0x0097('0x45')]['id']}},_0x483ac5={};_0x483ac5[_0x0097('0x31')]=_[_0x0097('0x33')](db[_0x0097('0x2d')]['rawAttributes']);_0x483ac5[_0x0097('0x32')]=_[_0x0097('0x33')](_0x6b3270[_0x0097('0x32')]);_0x483ac5[_0x0097('0x34')]=_[_0x0097('0x35')](_0x483ac5[_0x0097('0x31')],_0x483ac5['query']);_0x1567dc[_0x0097('0x36')]=_[_0x0097('0x35')](_0x483ac5[_0x0097('0x31')],qs[_0x0097('0x37')](_0x6b3270['query']['fields']));_0x1567dc[_0x0097('0x36')]=_0x1567dc[_0x0097('0x36')][_0x0097('0x46')]?_0x1567dc[_0x0097('0x36')]:_0x483ac5[_0x0097('0x31')];if(_0x6b3270[_0x0097('0x32')]['includeAll']){_0x1567dc['include']=[{'all':!![]}];}_0x1567dc=_[_0x0097('0x3f')]({},_0x1567dc,_0x6b3270[_0x0097('0x40')]);return db[_0x0097('0x2d')][_0x0097('0x47')](_0x1567dc)[_0x0097('0x28')](handleEntityNotFound(_0x3be84e,null))['then'](respondWithResult(_0x3be84e,null))[_0x0097('0x48')](handleError(_0x3be84e,null));};exports[_0x0097('0x49')]=function(_0x3abd84,_0x3efbb8){return db[_0x0097('0x2d')][_0x0097('0x49')](_0x3abd84[_0x0097('0x4a')],{})[_0x0097('0x28')](respondWithResult(_0x3efbb8,0xc9))[_0x0097('0x48')](handleError(_0x3efbb8,null));};exports[_0x0097('0x26')]=function(_0x2cf064,_0x30cb65){if(_0x2cf064[_0x0097('0x4a')]['id']){delete _0x2cf064[_0x0097('0x4a')]['id'];}return db[_0x0097('0x2d')][_0x0097('0x47')]({'where':{'id':_0x2cf064[_0x0097('0x45')]['id']}})[_0x0097('0x28')](handleEntityNotFound(_0x30cb65,null))[_0x0097('0x28')](saveUpdates(_0x2cf064['body'],null))['then'](respondWithResult(_0x30cb65,null))[_0x0097('0x48')](handleError(_0x30cb65,null));};exports[_0x0097('0x27')]=function(_0x352903,_0x141fee){return db[_0x0097('0x2d')][_0x0097('0x47')]({'where':{'id':_0x352903[_0x0097('0x45')]['id']}})[_0x0097('0x28')](handleEntityNotFound(_0x141fee,null))[_0x0097('0x28')](removeEntity(_0x141fee,null))[_0x0097('0x48')](handleError(_0x141fee,null));}; \ No newline at end of file +var _0x9e17=['status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0x9e17,0x7b));var _0x79e1=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x9e17[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x79e1('0x0'));var rimraf=require(_0x79e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79e1('0x2'));var rp=require(_0x79e1('0x3'));var moment=require(_0x79e1('0x4'));var BPromise=require(_0x79e1('0x5'));var Mustache=require(_0x79e1('0x6'));var util=require('util');var path=require(_0x79e1('0x7'));var sox=require(_0x79e1('0x8'));var csv=require('to-csv');var ejs=require(_0x79e1('0x9'));var fs=require('fs');var fs_extra=require(_0x79e1('0xa'));var _=require(_0x79e1('0xb'));var squel=require(_0x79e1('0xc'));var crypto=require(_0x79e1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x79e1('0xf'));var Papa=require(_0x79e1('0x10'));var Redis=require(_0x79e1('0x11'));var authService=require(_0x79e1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x79e1('0x13'));var hardwareService=require(_0x79e1('0x14'));var logger=require(_0x79e1('0x15'))(_0x79e1('0x16'));var utils=require(_0x79e1('0x17'));var config=require(_0x79e1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x79e1('0x19'))['db'];function respondWithStatusCode(_0x109928,_0x20b01f){_0x20b01f=_0x20b01f||0xcc;return function(_0x54a4bb){if(_0x54a4bb){return _0x109928[_0x79e1('0x1a')](_0x20b01f);}return _0x109928[_0x79e1('0x1b')](_0x20b01f)['end']();};}function respondWithResult(_0x174ba2,_0x5e501){_0x5e501=_0x5e501||0xc8;return function(_0x38c99d){if(_0x38c99d){return _0x174ba2['status'](_0x5e501)[_0x79e1('0x1c')](_0x38c99d);}};}function respondWithFilteredResult(_0x2610f2,_0x19165d){return function(_0x228199){if(_0x228199){var _0x1a928d=typeof _0x19165d[_0x79e1('0x1d')]===_0x79e1('0x1e')&&typeof _0x19165d['limit']===_0x79e1('0x1e');var _0x3912a6=_0x228199[_0x79e1('0x1f')];var _0x25dc4a=_0x1a928d?0x0:_0x19165d[_0x79e1('0x1d')];var _0x605195=_0x1a928d?_0x228199[_0x79e1('0x1f')]:_0x19165d[_0x79e1('0x1d')]+_0x19165d[_0x79e1('0x20')];var _0x4d7262;if(_0x605195>=_0x3912a6){_0x605195=_0x3912a6;_0x4d7262=0xc8;}else{_0x4d7262=0xce;}_0x2610f2[_0x79e1('0x1b')](_0x4d7262);return _0x2610f2[_0x79e1('0x21')](_0x79e1('0x22'),_0x25dc4a+'-'+_0x605195+'/'+_0x3912a6)[_0x79e1('0x1c')](_0x228199);}return null;};}function patchUpdates(_0x29ce1d){return function(_0x4647a0){try{jsonpatch['apply'](_0x4647a0,_0x29ce1d,!![]);}catch(_0x2c17cb){return BPromise[_0x79e1('0x23')](_0x2c17cb);}return _0x4647a0['save']();};}function saveUpdates(_0x429dc3,_0x1341fb){return function(_0x1ae7e2){if(_0x1ae7e2){return _0x1ae7e2[_0x79e1('0x24')](_0x429dc3)[_0x79e1('0x25')](function(_0x381a77){return _0x381a77;});}return null;};}function removeEntity(_0x4a4d27,_0x542c9b){return function(_0x4cea07){if(_0x4cea07){return _0x4cea07[_0x79e1('0x26')]()[_0x79e1('0x25')](function(){_0x4a4d27[_0x79e1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e9bf,_0x16cf54){return function(_0x5dea7d){if(!_0x5dea7d){_0x48e9bf[_0x79e1('0x1a')](0x194);}return _0x5dea7d;};}function handleError(_0x550192,_0x5383b5){_0x5383b5=_0x5383b5||0x1f4;return function(_0x5f196c){logger['error'](_0x5f196c[_0x79e1('0x27')]);if(_0x5f196c[_0x79e1('0x28')]){delete _0x5f196c[_0x79e1('0x28')];}_0x550192['status'](_0x5383b5)[_0x79e1('0x29')](_0x5f196c);};}exports['index']=function(_0x4f6e62,_0x2d3be2){var _0x1b416e={},_0x404648={},_0xba1a0e={'count':0x0,'rows':[]};var _0x5550ef=_[_0x79e1('0x2a')](db[_0x79e1('0x2b')][_0x79e1('0x2c')],function(_0x207dd7){return{'name':_0x207dd7[_0x79e1('0x2d')],'type':_0x207dd7[_0x79e1('0x2e')][_0x79e1('0x2f')]};});_0x404648['model']=_[_0x79e1('0x2a')](_0x5550ef,_0x79e1('0x28'));_0x404648[_0x79e1('0x30')]=_[_0x79e1('0x31')](_0x4f6e62['query']);_0x404648[_0x79e1('0x32')]=_['intersection'](_0x404648[_0x79e1('0x33')],_0x404648[_0x79e1('0x30')]);_0x1b416e[_0x79e1('0x34')]=_[_0x79e1('0x35')](_0x404648[_0x79e1('0x33')],qs[_0x79e1('0x36')](_0x4f6e62[_0x79e1('0x30')][_0x79e1('0x36')]));_0x1b416e['attributes']=_0x1b416e[_0x79e1('0x34')][_0x79e1('0x37')]?_0x1b416e[_0x79e1('0x34')]:_0x404648[_0x79e1('0x33')];if(!_0x4f6e62[_0x79e1('0x30')][_0x79e1('0x38')](_0x79e1('0x39'))){_0x1b416e[_0x79e1('0x20')]=qs['limit'](_0x4f6e62[_0x79e1('0x30')][_0x79e1('0x20')]);_0x1b416e[_0x79e1('0x1d')]=qs[_0x79e1('0x1d')](_0x4f6e62[_0x79e1('0x30')][_0x79e1('0x1d')]);}_0x1b416e[_0x79e1('0x3a')]=qs['sort'](_0x4f6e62['query'][_0x79e1('0x3b')]);_0x1b416e[_0x79e1('0x3c')]=qs[_0x79e1('0x32')](_[_0x79e1('0x3d')](_0x4f6e62['query'],_0x404648[_0x79e1('0x32')]),_0x5550ef);if(_0x4f6e62[_0x79e1('0x30')]['filter']){_0x1b416e[_0x79e1('0x3c')]=_['merge'](_0x1b416e[_0x79e1('0x3c')],{'$or':_[_0x79e1('0x2a')](_0x5550ef,function(_0x715139){if(_0x715139[_0x79e1('0x2e')]!==_0x79e1('0x3e')){var _0x4dea25={};_0x4dea25[_0x715139[_0x79e1('0x28')]]={'$like':'%'+_0x4f6e62[_0x79e1('0x30')]['filter']+'%'};return _0x4dea25;}})});}_0x1b416e=_['merge']({},_0x1b416e,_0x4f6e62[_0x79e1('0x3f')]);var _0x16d451={'where':_0x1b416e[_0x79e1('0x3c')]};return db['VoiceQueuesLog']['count'](_0x16d451)[_0x79e1('0x25')](function(_0x4aad4e){_0xba1a0e['count']=_0x4aad4e;if(_0x4f6e62[_0x79e1('0x30')][_0x79e1('0x40')]){_0x1b416e[_0x79e1('0x41')]=[{'all':!![]}];}return db[_0x79e1('0x2b')][_0x79e1('0x42')](_0x1b416e);})[_0x79e1('0x25')](function(_0x5c317e){_0xba1a0e[_0x79e1('0x43')]=_0x5c317e;return _0xba1a0e;})[_0x79e1('0x25')](respondWithFilteredResult(_0x2d3be2,_0x1b416e))[_0x79e1('0x44')](handleError(_0x2d3be2,null));};exports[_0x79e1('0x45')]=function(_0x4d5534,_0x1bf710){var _0x1326ee={'raw':!![],'where':{'id':_0x4d5534[_0x79e1('0x46')]['id']}},_0x50f9c7={};_0x50f9c7[_0x79e1('0x33')]=_['keys'](db[_0x79e1('0x2b')][_0x79e1('0x2c')]);_0x50f9c7[_0x79e1('0x30')]=_[_0x79e1('0x31')](_0x4d5534[_0x79e1('0x30')]);_0x50f9c7['filters']=_['intersection'](_0x50f9c7[_0x79e1('0x33')],_0x50f9c7[_0x79e1('0x30')]);_0x1326ee[_0x79e1('0x34')]=_[_0x79e1('0x35')](_0x50f9c7[_0x79e1('0x33')],qs['fields'](_0x4d5534['query'][_0x79e1('0x36')]));_0x1326ee['attributes']=_0x1326ee[_0x79e1('0x34')][_0x79e1('0x37')]?_0x1326ee['attributes']:_0x50f9c7['model'];if(_0x4d5534[_0x79e1('0x30')][_0x79e1('0x40')]){_0x1326ee[_0x79e1('0x41')]=[{'all':!![]}];}_0x1326ee=_[_0x79e1('0x47')]({},_0x1326ee,_0x4d5534['options']);return db[_0x79e1('0x2b')][_0x79e1('0x48')](_0x1326ee)['then'](handleEntityNotFound(_0x1bf710,null))[_0x79e1('0x25')](respondWithResult(_0x1bf710,null))['catch'](handleError(_0x1bf710,null));};exports[_0x79e1('0x49')]=function(_0x22c6fa,_0x1ca997){return db[_0x79e1('0x2b')][_0x79e1('0x49')](_0x22c6fa[_0x79e1('0x4a')],{})[_0x79e1('0x25')](respondWithResult(_0x1ca997,0xc9))[_0x79e1('0x44')](handleError(_0x1ca997,null));};exports[_0x79e1('0x24')]=function(_0x14c069,_0x1825fe){if(_0x14c069[_0x79e1('0x4a')]['id']){delete _0x14c069['body']['id'];}return db['VoiceQueuesLog'][_0x79e1('0x48')]({'where':{'id':_0x14c069[_0x79e1('0x46')]['id']}})[_0x79e1('0x25')](handleEntityNotFound(_0x1825fe,null))[_0x79e1('0x25')](saveUpdates(_0x14c069['body'],null))[_0x79e1('0x25')](respondWithResult(_0x1825fe,null))[_0x79e1('0x44')](handleError(_0x1825fe,null));};exports['destroy']=function(_0x203b0b,_0xbd7e0e){return db[_0x79e1('0x2b')][_0x79e1('0x48')]({'where':{'id':_0x203b0b['params']['id']}})[_0x79e1('0x25')](handleEntityNotFound(_0xbd7e0e,null))[_0x79e1('0x25')](removeEntity(_0xbd7e0e,null))['catch'](handleError(_0xbd7e0e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ebfaa7c..7004b23 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 _0xdab3=['request-promise','rimraf','exports','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','api'];(function(_0x3e29e5,_0x1cd087){var _0x37f88a=function(_0x2c6621){while(--_0x2c6621){_0x3e29e5['push'](_0x3e29e5['shift']());}};_0x37f88a(++_0x1cd087);}(_0xdab3,0x97));var _0x3dab=function(_0x386006,_0x569458){_0x386006=_0x386006-0x0;var _0x1161e3=_0xdab3[_0x386006];return _0x1161e3;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var logger=require('../../config/logger')(_0x3dab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3dab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dab('0x4'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x3dab('0x5')]=function(_0x1ab4b1,_0x1c00a4){return _0x1ab4b1[_0x3dab('0x6')](_0x3dab('0x7'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x3dab('0x8'),'fields':[_0x3dab('0x9'),_0x3dab('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x92e8=['rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event','dtm','lodash','api','bluebird','request-promise','path'];(function(_0xba2543,_0x43bbdc){var _0x33a874=function(_0x1d85b6){while(--_0x1d85b6){_0xba2543['push'](_0xba2543['shift']());}};_0x33a874(++_0x43bbdc);}(_0x92e8,0x7f));var _0x892e=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x92e8[_0x559a80];return _0x42f555;};'use strict';var _=require(_0x892e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x892e('0x1'));var moment=require('moment');var BPromise=require(_0x892e('0x2'));var rp=require(_0x892e('0x3'));var fs=require('fs');var path=require(_0x892e('0x4'));var rimraf=require(_0x892e('0x5'));var config=require(_0x892e('0x6'));var attributes=require(_0x892e('0x7'));module['exports']=function(_0x3b557d,_0x47adfa){return _0x3b557d[_0x892e('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x892e('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x892e('0xa'),_0x892e('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index af02dce..c4dfc86 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 _0x4787=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent'];(function(_0x1294d2,_0x3abe70){var _0x2fd128=function(_0x1fee69){while(--_0x1fee69){_0x1294d2['push'](_0x1294d2['shift']());}};_0x2fd128(++_0x3abe70);}(_0x4787,0x148));var _0x7478=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x4787[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require('lodash');var util=require(_0x7478('0x0'));var moment=require(_0x7478('0x1'));var BPromise=require(_0x7478('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7478('0x3'));var db=require(_0x7478('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7478('0x5'))(_0x7478('0x6'));var config=require(_0x7478('0x7'));var jayson=require(_0x7478('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4042a3,_0x5df7ad,_0xc88906){return new BPromise(function(_0xd7efb1,_0x135ae9){return client[_0x7478('0x9')](_0x4042a3,_0xc88906)[_0x7478('0xa')](function(_0x3a5afd){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5df7ad,_0x7478('0xb'));logger['debug'](_0x7478('0xc'),_0x5df7ad,'request\x20sent',JSON[_0x7478('0xd')](_0x3a5afd));if(_0x3a5afd['error']){if(_0x3a5afd[_0x7478('0xe')]['code']===0x1f4){logger[_0x7478('0xe')](_0x7478('0xf'),_0x5df7ad,_0x3a5afd['error']['message']);return _0x135ae9(_0x3a5afd['error']['message']);}logger[_0x7478('0xe')](_0x7478('0xf'),_0x5df7ad,_0x3a5afd[_0x7478('0xe')][_0x7478('0x10')]);return _0xd7efb1(_0x3a5afd['error']['message']);}else{logger[_0x7478('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5df7ad,_0x7478('0xb'));_0xd7efb1(_0x3a5afd[_0x7478('0x12')]['message']);}})[_0x7478('0x13')](function(_0x3ee0fb){logger[_0x7478('0xe')](_0x7478('0xf'),_0x5df7ad,_0x3ee0fb);_0x135ae9(_0x3ee0fb);});});} \ No newline at end of file +var _0x5044=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x1844a5,_0x57212e){var _0x59621e=function(_0x51f95f){while(--_0x51f95f){_0x1844a5['push'](_0x1844a5['shift']());}};_0x59621e(++_0x57212e);}(_0x5044,0xc8));var _0x4504=function(_0xf40a8a,_0x4474b2){_0xf40a8a=_0xf40a8a-0x0;var _0x13f1c4=_0x5044[_0xf40a8a];return _0x13f1c4;};'use strict';var _=require('lodash');var util=require(_0x4504('0x0'));var moment=require('moment');var BPromise=require(_0x4504('0x1'));var rs=require(_0x4504('0x2'));var fs=require('fs');var Redis=require(_0x4504('0x3'));var db=require(_0x4504('0x4'))['db'];var utils=require(_0x4504('0x5'));var logger=require(_0x4504('0x6'))(_0x4504('0x7'));var config=require(_0x4504('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4504('0x9')][_0x4504('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x282816,_0x6e2dbb,_0x3df37b){return new BPromise(function(_0xbce7c4,_0x2cd45a){return client[_0x4504('0xb')](_0x282816,_0x3df37b)[_0x4504('0xc')](function(_0x56961c){logger[_0x4504('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x6e2dbb,_0x4504('0xe'));logger[_0x4504('0xf')](_0x4504('0x10'),_0x6e2dbb,_0x4504('0xe'),JSON[_0x4504('0x11')](_0x56961c));if(_0x56961c[_0x4504('0x12')]){if(_0x56961c[_0x4504('0x12')][_0x4504('0x13')]===0x1f4){logger[_0x4504('0x12')](_0x4504('0x14'),_0x6e2dbb,_0x56961c[_0x4504('0x12')][_0x4504('0x15')]);return _0x2cd45a(_0x56961c[_0x4504('0x12')]['message']);}logger[_0x4504('0x12')](_0x4504('0x14'),_0x6e2dbb,_0x56961c['error'][_0x4504('0x15')]);return _0xbce7c4(_0x56961c[_0x4504('0x12')][_0x4504('0x15')]);}else{logger[_0x4504('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x6e2dbb,'request\x20sent');_0xbce7c4(_0x56961c[_0x4504('0x16')]['message']);}})[_0x4504('0x17')](function(_0x5ede87){logger[_0x4504('0x12')](_0x4504('0x14'),_0x6e2dbb,_0x5ede87);_0x2cd45a(_0x5ede87);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 1f3c06c..782a4bf 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 _0xbfa2=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','isAuthenticated','describe','/:id','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1cd4e7,_0x5f17dd){var _0x5243eb=function(_0x827ee4){while(--_0x827ee4){_0x1cd4e7['push'](_0x1cd4e7['shift']());}};_0x5243eb(++_0x5f17dd);}(_0xbfa2,0xa4));var _0x2bfa=function(_0x2bc909,_0xaec652){_0x2bc909=_0x2bc909-0x0;var _0x54b918=_0xbfa2[_0x2bc909];return _0x54b918;};'use strict';var multer=require(_0x2bfa('0x0'));var util=require(_0x2bfa('0x1'));var path=require(_0x2bfa('0x2'));var timeout=require(_0x2bfa('0x3'));var express=require(_0x2bfa('0x4'));var router=express[_0x2bfa('0x5')]();var fs_extra=require(_0x2bfa('0x6'));var auth=require(_0x2bfa('0x7'));var interaction=require(_0x2bfa('0x8'));var config=require(_0x2bfa('0x9'));var controller=require(_0x2bfa('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x2bfa('0xb')]);router[_0x2bfa('0xc')]('/describe',auth[_0x2bfa('0xd')](),controller[_0x2bfa('0xe')]);router[_0x2bfa('0xc')](_0x2bfa('0xf'),auth[_0x2bfa('0xd')](),controller['show']);router[_0x2bfa('0xc')](_0x2bfa('0x10'),auth[_0x2bfa('0xd')](),controller[_0x2bfa('0x11')]);router[_0x2bfa('0xc')]('/:id/downloads',controller[_0x2bfa('0x12')]);router[_0x2bfa('0xc')](_0x2bfa('0x13'),auth[_0x2bfa('0xd')](),controller[_0x2bfa('0x14')]);router['post']('/',auth[_0x2bfa('0xd')](),controller['create']);router[_0x2bfa('0x15')]('/:id/transcribe',auth[_0x2bfa('0xd')](),controller[_0x2bfa('0x16')]);router[_0x2bfa('0x17')](_0x2bfa('0xf'),auth['isAuthenticated'](),controller[_0x2bfa('0x18')]);router[_0x2bfa('0x19')](_0x2bfa('0xf'),auth[_0x2bfa('0xd')](),controller[_0x2bfa('0x1a')]);module[_0x2bfa('0x1b')]=router; \ No newline at end of file +var _0x3df8=['fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x34d8b4,_0x33e64f){var _0x23a022=function(_0xd3d2e4){while(--_0xd3d2e4){_0x34d8b4['push'](_0x34d8b4['shift']());}};_0x23a022(++_0x33e64f);}(_0x3df8,0x113));var _0x83df=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x3df8[_0x57a50d];return _0x1b25b3;};'use strict';var multer=require('multer');var util=require(_0x83df('0x0'));var path=require(_0x83df('0x1'));var timeout=require(_0x83df('0x2'));var express=require(_0x83df('0x3'));var router=express[_0x83df('0x4')]();var fs_extra=require(_0x83df('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x83df('0x6'));var config=require(_0x83df('0x7'));var controller=require(_0x83df('0x8'));router[_0x83df('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x83df('0x9')](_0x83df('0xa'),auth[_0x83df('0xb')](),controller[_0x83df('0xc')]);router[_0x83df('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x83df('0xd')]);router[_0x83df('0x9')](_0x83df('0xe'),auth['isAuthenticated'](),controller[_0x83df('0xf')]);router[_0x83df('0x9')](_0x83df('0x10'),controller[_0x83df('0x11')]);router[_0x83df('0x9')](_0x83df('0x12'),auth[_0x83df('0xb')](),controller[_0x83df('0x13')]);router[_0x83df('0x14')]('/',auth[_0x83df('0xb')](),controller[_0x83df('0x15')]);router[_0x83df('0x14')](_0x83df('0x12'),auth[_0x83df('0xb')](),controller['runTranscribe']);router[_0x83df('0x16')](_0x83df('0x17'),auth[_0x83df('0xb')](),controller[_0x83df('0x18')]);router[_0x83df('0x19')](_0x83df('0x17'),auth[_0x83df('0xb')](),controller[_0x83df('0x1a')]);module[_0x83df('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b5f2381..29e667e 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(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 6314291..e536279 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 _0x6ec6=['jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','options','where','includeAll','findAll','rows','show','params','find','catch','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x528c2d,_0x14c00e){var _0x1d6563=function(_0x33e803){while(--_0x33e803){_0x528c2d['push'](_0x528c2d['shift']());}};_0x1d6563(++_0x14c00e);}(_0x6ec6,0x1ba));var _0x66ec=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x6ec6[_0x217c2e];return _0x22b7d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66ec('0x0'));var zipdir=require(_0x66ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x66ec('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66ec('0x3'));var path=require(_0x66ec('0x4'));var sox=require(_0x66ec('0x5'));var csv=require(_0x66ec('0x6'));var ejs=require(_0x66ec('0x7'));var fs=require('fs');var fs_extra=require(_0x66ec('0x8'));var _=require(_0x66ec('0x9'));var squel=require(_0x66ec('0xa'));var crypto=require('crypto');var jsforce=require(_0x66ec('0xb'));var deskjs=require(_0x66ec('0xc'));var toCsv=require(_0x66ec('0x6'));var querystring=require(_0x66ec('0xd'));var Papa=require('papaparse');var AWS=require(_0x66ec('0xe'));var uuidv4=require(_0x66ec('0xf'));var Redis=require(_0x66ec('0x10'));var authService=require(_0x66ec('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66ec('0x12'));var logger=require(_0x66ec('0x13'))(_0x66ec('0x14'));var utils=require(_0x66ec('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x66ec('0x16'));var db=require(_0x66ec('0x17'))['db'];function respondWithStatusCode(_0x218667,_0x5048a7){_0x5048a7=_0x5048a7||0xcc;return function(_0x5b6cfb){if(_0x5b6cfb){return _0x218667[_0x66ec('0x18')](_0x5048a7);}return _0x218667['status'](_0x5048a7)[_0x66ec('0x19')]();};}function respondWithResult(_0x4abf50,_0x2130ba){_0x2130ba=_0x2130ba||0xc8;return function(_0x199612){if(_0x199612){return _0x4abf50[_0x66ec('0x1a')](_0x2130ba)['json'](_0x199612);}};}function respondWithFilteredResult(_0x530465,_0x5f3d01){return function(_0x29f487){if(_0x29f487){var _0x46054f=typeof _0x5f3d01[_0x66ec('0x1b')]===_0x66ec('0x1c')&&typeof _0x5f3d01[_0x66ec('0x1d')]===_0x66ec('0x1c');var _0x113e30=_0x29f487[_0x66ec('0x1e')];var _0x3a1819=_0x46054f?0x0:_0x5f3d01['offset'];var _0x2924ee=_0x46054f?_0x29f487[_0x66ec('0x1e')]:_0x5f3d01['offset']+_0x5f3d01['limit'];var _0x2713e3;if(_0x2924ee>=_0x113e30){_0x2924ee=_0x113e30;_0x2713e3=0xc8;}else{_0x2713e3=0xce;}_0x530465[_0x66ec('0x1a')](_0x2713e3);return _0x530465[_0x66ec('0x1f')]('Content-Range',_0x3a1819+'-'+_0x2924ee+'/'+_0x113e30)[_0x66ec('0x20')](_0x29f487);}return null;};}function patchUpdates(_0x274a72){return function(_0x17c446){try{jsonpatch[_0x66ec('0x21')](_0x17c446,_0x274a72,!![]);}catch(_0x53367b){return BPromise[_0x66ec('0x22')](_0x53367b);}return _0x17c446[_0x66ec('0x23')]();};}function saveUpdates(_0x47a0f2,_0x1279e4){return function(_0x5705bd){if(_0x5705bd){return _0x5705bd['update'](_0x47a0f2)[_0x66ec('0x24')](function(_0x5820fe){return _0x5820fe;});}return null;};}function removeEntity(_0x4914d4,_0x2b9c28){return function(_0x51b792){if(_0x51b792){return _0x51b792[_0x66ec('0x25')]()[_0x66ec('0x24')](function(){_0x4914d4[_0x66ec('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29e54c,_0x30f637){return function(_0x2da5b6){if(!_0x2da5b6){_0x29e54c[_0x66ec('0x18')](0x194);}return _0x2da5b6;};}function handleError(_0x2875c7,_0x2c2022){_0x2c2022=_0x2c2022||0x1f4;return function(_0x14a28f){logger[_0x66ec('0x26')](_0x14a28f[_0x66ec('0x27')]);if(_0x14a28f[_0x66ec('0x28')]){delete _0x14a28f[_0x66ec('0x28')];}_0x2875c7['status'](_0x2c2022)[_0x66ec('0x29')](_0x14a28f);};}exports[_0x66ec('0x2a')]=function(_0x588a1f,_0x18af26){var _0xf9e8da={},_0x1d16e3={},_0x3eb64a={'count':0x0,'rows':[]};var _0x480fea=_['map'](db[_0x66ec('0x2b')][_0x66ec('0x2c')],function(_0x202439){return{'name':_0x202439['fieldName'],'type':_0x202439[_0x66ec('0x2d')][_0x66ec('0x2e')]};});_0x1d16e3[_0x66ec('0x2f')]=_['differenceBy'](_['map'](_0x480fea,_0x66ec('0x28')),[_0x66ec('0x30')]);_0x1d16e3['query']=_[_0x66ec('0x31')](_0x588a1f[_0x66ec('0x32')]);_0x1d16e3[_0x66ec('0x33')]=_[_0x66ec('0x34')](_0x1d16e3[_0x66ec('0x2f')],_0x1d16e3[_0x66ec('0x32')]);_0xf9e8da[_0x66ec('0x35')]=_['intersection'](_0x1d16e3[_0x66ec('0x2f')],qs[_0x66ec('0x36')](_0x588a1f[_0x66ec('0x32')]['fields']));_0xf9e8da[_0x66ec('0x35')]=_0xf9e8da[_0x66ec('0x35')][_0x66ec('0x37')]?_0xf9e8da[_0x66ec('0x35')]:_0x1d16e3[_0x66ec('0x2f')];if(!_0x588a1f[_0x66ec('0x32')][_0x66ec('0x38')](_0x66ec('0x39'))){_0xf9e8da[_0x66ec('0x1d')]=qs['limit'](_0x588a1f['query'][_0x66ec('0x1d')]);_0xf9e8da[_0x66ec('0x1b')]=qs[_0x66ec('0x1b')](_0x588a1f[_0x66ec('0x32')]['offset']);}_0xf9e8da[_0x66ec('0x3a')]=qs['sort'](_0x588a1f['query']['sort']);_0xf9e8da['where']=qs['filters'](_[_0x66ec('0x3b')](_0x588a1f['query'],_0x1d16e3['filters']),_0x480fea);if(_0x588a1f[_0x66ec('0x32')][_0x66ec('0x3c')]){_0xf9e8da['where']=_[_0x66ec('0x3d')](_0xf9e8da['where'],{'$or':_['map'](_0x480fea,function(_0x22b568){if(_0x22b568[_0x66ec('0x2d')]!=='VIRTUAL'){var _0x41ea15={};_0x41ea15[_0x22b568[_0x66ec('0x28')]]={'$like':'%'+_0x588a1f[_0x66ec('0x32')][_0x66ec('0x3c')]+'%'};return _0x41ea15;}})});}_0xf9e8da=_[_0x66ec('0x3d')]({},_0xf9e8da,_0x588a1f[_0x66ec('0x3e')]);var _0x4a6e2b={'where':_0xf9e8da[_0x66ec('0x3f')]};return db[_0x66ec('0x2b')]['count'](_0x4a6e2b)[_0x66ec('0x24')](function(_0x3540fc){_0x3eb64a[_0x66ec('0x1e')]=_0x3540fc;if(_0x588a1f[_0x66ec('0x32')][_0x66ec('0x40')]){_0xf9e8da['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x66ec('0x41')](_0xf9e8da);})[_0x66ec('0x24')](function(_0xe3e6b5){_0x3eb64a[_0x66ec('0x42')]=_0xe3e6b5;return _0x3eb64a;})[_0x66ec('0x24')](respondWithFilteredResult(_0x18af26,_0xf9e8da))['catch'](handleError(_0x18af26,null));};exports[_0x66ec('0x43')]=function(_0x3ea0bf,_0x3bc117){var _0x17aec9={'raw':![],'where':{'id':_0x3ea0bf[_0x66ec('0x44')]['id']}},_0xd0bf67={};_0xd0bf67[_0x66ec('0x2f')]=_[_0x66ec('0x31')](db[_0x66ec('0x2b')][_0x66ec('0x2c')]);_0xd0bf67['query']=_[_0x66ec('0x31')](_0x3ea0bf['query']);_0xd0bf67[_0x66ec('0x33')]=_['intersection'](_0xd0bf67['model'],_0xd0bf67[_0x66ec('0x32')]);_0x17aec9[_0x66ec('0x35')]=_[_0x66ec('0x34')](_0xd0bf67[_0x66ec('0x2f')],qs['fields'](_0x3ea0bf[_0x66ec('0x32')][_0x66ec('0x36')]));_0x17aec9['attributes']=_0x17aec9[_0x66ec('0x35')][_0x66ec('0x37')]?_0x17aec9['attributes']:_0xd0bf67[_0x66ec('0x2f')];if(_0x3ea0bf[_0x66ec('0x32')]['includeAll']){_0x17aec9['include']=[{'all':!![]}];}_0x17aec9=_[_0x66ec('0x3d')]({},_0x17aec9,_0x3ea0bf[_0x66ec('0x3e')]);return db[_0x66ec('0x2b')][_0x66ec('0x45')](_0x17aec9)[_0x66ec('0x24')](handleEntityNotFound(_0x3bc117,null))[_0x66ec('0x24')](respondWithResult(_0x3bc117,null))[_0x66ec('0x46')](handleError(_0x3bc117,null));};exports[_0x66ec('0x47')]=function(_0x4e792b,_0x4b2f90){return db[_0x66ec('0x2b')][_0x66ec('0x47')](_0x4e792b[_0x66ec('0x48')],{})[_0x66ec('0x24')](respondWithResult(_0x4b2f90,0xc9))[_0x66ec('0x46')](handleError(_0x4b2f90,null));};exports[_0x66ec('0x49')]=function(_0x5c3423,_0x41a2cf){if(_0x5c3423[_0x66ec('0x48')]['id']){delete _0x5c3423[_0x66ec('0x48')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x5c3423['params']['id']}})[_0x66ec('0x24')](handleEntityNotFound(_0x41a2cf,null))['then'](saveUpdates(_0x5c3423['body'],null))[_0x66ec('0x24')](respondWithResult(_0x41a2cf,null))[_0x66ec('0x46')](handleError(_0x41a2cf,null));};exports['describe']=function(_0x39575b,_0x3091e7){return db[_0x66ec('0x2b')][_0x66ec('0x4a')]()[_0x66ec('0x24')](respondWithResult(_0x3091e7,null))[_0x66ec('0x46')](handleError(_0x3091e7,null));};exports[_0x66ec('0x4b')]=function(_0xaa3c29,_0x401d74,_0x582757){var _0x38f684=require(_0x66ec('0x4c'));var _0x3cac00=![];var _0x39c8b3={};if(_0xaa3c29[_0x66ec('0x32')]['type']&&_0xaa3c29[_0x66ec('0x32')][_0x66ec('0x2d')]===_0x66ec('0x4d')){_0x39c8b3[_0x66ec('0x4d')]=_0xaa3c29[_0x66ec('0x44')]['id'];}else{_0x39c8b3['id']=_0xaa3c29[_0x66ec('0x44')]['id'];}return db[_0x66ec('0x2b')][_0x66ec('0x45')]({'where':_0x39c8b3,'attributes':['id',_0x66ec('0x4e')],'raw':!![]})[_0x66ec('0x24')](handleEntityNotFound(_0x401d74,null))[_0x66ec('0x24')](function(_0x598db5){if(_0x598db5){var _0x2ef6d6=_0x598db5['value'];var _0x1f0677=util[_0x66ec('0x30')](_0x66ec('0x4f'),_0x2ef6d6);if(fs['existsSync'](_0x1f0677)){_0x3cac00=!![];return _0x38f684[_0x66ec('0x50')](_0x1f0677,_0x2ef6d6,config[_0x66ec('0x51')][_0x66ec('0x52')])[_0x66ec('0x24')](function(){return _0x598db5;});}return _0x598db5;}})[_0x66ec('0x24')](function(_0x110738){if(_0x110738){var _0x10ea5e=_0x110738[_0x66ec('0x4e')];if(!fs[_0x66ec('0x53')](_0x10ea5e)){throw new db[(_0x66ec('0x54'))][(_0x66ec('0x55'))](_0x66ec('0x56'));}if(_0x110738[_0x66ec('0x57')]){return _0x401d74[_0x66ec('0x4b')](_0x10ea5e,_0x110738[_0x66ec('0x57')]+path[_0x66ec('0x58')](_0x10ea5e),function(){if(_0x3cac00){fs[_0x66ec('0x59')](_0x10ea5e);}});}else{return _0x401d74[_0x66ec('0x4b')](_0x10ea5e,function(_0x1a02c6){if(_0x3cac00){fs[_0x66ec('0x59')](_0x10ea5e);}});}}})[_0x66ec('0x46')](function(_0x18afd3){if(_0x18afd3[_0x66ec('0x5a')]==='VoiceRecording\x20not\x20found'){_0x401d74[_0x66ec('0x1a')](0x194)[_0x66ec('0x29')](_0x66ec('0x5b'));}else{return handleError(_0x401d74,null);}});};exports[_0x66ec('0x5c')]=function(_0x26c15b,_0xd4b0b4,_0x38292e){var _0x17c573=require(_0x66ec('0x4c'));var _0x514a7e=![];var _0x1f44bc={'$and':[db[_0x66ec('0x5d')][_0x66ec('0x3f')](db[_0x66ec('0x5d')]['fn'](_0x66ec('0x5e'),db['sequelize'][_0x66ec('0x5f')](_0x66ec('0x4d'))),_0x26c15b[_0x66ec('0x32')][_0x66ec('0x60')])]};if(_0x26c15b[_0x66ec('0x32')]['type']&&_0x26c15b['query']['type']===_0x66ec('0x4d')){_0x1f44bc['$and'][_0x66ec('0x61')]({'uniqueid':_0x26c15b[_0x66ec('0x44')]['id']});}else{_0x1f44bc[_0x66ec('0x62')][_0x66ec('0x61')]({'id':_0x26c15b[_0x66ec('0x44')]['id']});}return db['VoiceRecording'][_0x66ec('0x45')]({'where':_0x1f44bc,'attributes':['id',_0x66ec('0x4e')],'raw':!![]})[_0x66ec('0x24')](handleEntityNotFound(_0xd4b0b4,null))['then'](function(_0x51f343){if(_0x51f343){var _0x4e8592=util[_0x66ec('0x30')]('%s.cypher',_0x51f343[_0x66ec('0x4e')]);if(fs[_0x66ec('0x53')](_0x4e8592)){_0x514a7e=!![];return _0x17c573[_0x66ec('0x50')](_0x4e8592,_0x51f343[_0x66ec('0x4e')],config[_0x66ec('0x51')][_0x66ec('0x52')])['then'](function(){return _0x51f343;});}return _0x51f343;}})[_0x66ec('0x24')](function(_0x59e4f5){if(_0x59e4f5){if(!fs['existsSync'](_0x59e4f5[_0x66ec('0x4e')])){throw new db['Sequelize']['ValidationError'](_0x66ec('0x56'));}if(_0x59e4f5[_0x66ec('0x57')]){return _0xd4b0b4[_0x66ec('0x4b')](_0x59e4f5[_0x66ec('0x4e')],_0x59e4f5[_0x66ec('0x57')]+path[_0x66ec('0x58')](_0x59e4f5[_0x66ec('0x4e')]),function(){if(_0x514a7e){fs[_0x66ec('0x59')](_0x59e4f5[_0x66ec('0x4e')]);}});}else{return _0xd4b0b4['download'](_0x59e4f5[_0x66ec('0x4e')],function(_0x213fa8){if(_0x514a7e){fs[_0x66ec('0x59')](_0x59e4f5[_0x66ec('0x4e')]);}});}}})[_0x66ec('0x46')](handleError(_0xd4b0b4,null));};exports['destroy']=function(_0x5f33b7,_0x332ff4){return db[_0x66ec('0x2b')][_0x66ec('0x45')]({'where':{'id':_0x5f33b7[_0x66ec('0x44')]['id']}})['then'](function(_0x19fec3){if(_[_0x66ec('0x63')](_0x19fec3)){throw new ReferenceError(_0x66ec('0x64'));}return _0x19fec3;})[_0x66ec('0x24')](function(_0x51119f){var _0xb63c19=_0x51119f[_0x66ec('0x4e')];logger[_0x66ec('0x65')](_0x66ec('0x66'),_0xb63c19);if(!_['isNil'](_0x51119f[_0x66ec('0x4e')])&&fs['existsSync'](_0xb63c19)){logger[_0x66ec('0x65')](_0x66ec('0x67')+_0xb63c19+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x66ec('0x68')](_0xb63c19);}_0xb63c19=_0xb63c19+_0x66ec('0x69');if(!_[_0x66ec('0x63')](_0x51119f['value'])&&fs[_0x66ec('0x53')](_0xb63c19)){logger[_0x66ec('0x65')]('File:\x20\x22'+_0xb63c19+_0x66ec('0x6a'));fs['unlinkSync'](_0xb63c19);}return _0x51119f;})[_0x66ec('0x24')](function(_0x451fd1){if(!_0x451fd1)throw new InternalError();return _0x451fd1[_0x66ec('0x25')]();})[_0x66ec('0x24')](function(){_0x332ff4['status'](0xcc)[_0x66ec('0x19')]();})[_0x66ec('0x46')](handleError(_0x332ff4,null));};function getBucketslist(_0x310866,_0x4a6faa,_0x1f3128){return new Promise(function(_0x1c95b6,_0x4f14f2){var _0x3ee9d5=new AWS['S3']({'accessKeyId':_0x4a6faa,'secretAccessKey':_0x310866,'region':_0x1f3128});_0x3ee9d5[_0x66ec('0x6b')]({},function(_0x3d4085,_0x5c0691){if(_0x3d4085){return _0x4f14f2(_0x3d4085);}else{return _0x1c95b6(_0x5c0691);}});});}function createBucket(_0x5798e1,_0x45028e,_0x5f2020,_0x3bdd33){return new Promise(function(_0x185a72,_0x5e70e1){var _0x1a4865=new AWS['S3']({'accessKeyId':_0x45028e,'secretAccessKey':_0x5798e1,'region':_0x5f2020});_0x1a4865['createBucket']({'Bucket':_0x3bdd33},function(_0x55ecd1,_0x12cf17){if(_0x55ecd1){return _0x5e70e1(_0x55ecd1);}else{return _0x185a72(_0x12cf17);}});});}function uploadFile(_0x2d0263,_0x4e7cf4,_0xb505a2,_0x5c8ae9,_0x201075,_0x528954){return new Promise(function(_0x25268a,_0x4f6dd7){var _0x595e65=new AWS['S3']({'accessKeyId':_0x4e7cf4,'secretAccessKey':_0x2d0263,'region':_0xb505a2});_0x595e65[_0x66ec('0x6c')]({'Bucket':_0x5c8ae9,'Key':_0x201075,'Body':_0x528954},function(_0xa68d78,_0x3175d2){if(_0xa68d78){return _0x4f6dd7(_0xa68d78);}else{return _0x25268a(_0x3175d2);}});});}function startTranscribe(_0x2e451e,_0x32ef55,_0x317888,_0x99f9da,_0x2cfd58,_0x5903b5){return new Promise(function(_0x47be3c,_0x4cb617){var _0x2db340=new AWS[(_0x66ec('0x6d'))]({'accessKeyId':_0x32ef55,'secretAccessKey':_0x2e451e,'region':_0x317888});_0x2db340[_0x66ec('0x6e')]({'TranscriptionJobName':_0x99f9da,'LanguageCode':_0x2cfd58,'Media':{'MediaFileUri':_0x5903b5}},function(_0x271319,_0x5a84a7){if(_0x271319){return _0x4cb617(_0x271319);}else{return _0x47be3c(_0x5a84a7);}});});}function transcribe(_0x46e3ca,_0x2d47f7,_0x5d5825,_0x4e5cd8,_0x50501b,_0x5f01f3,_0x49dc4f){return new Promise(function(_0x292c44,_0x58ec02){var _0x475a2e={};logger[_0x66ec('0x65')](util['format'](_0x66ec('0x6f'),_0x46e3ca,_0x50501b));return uploadFile(_0x2d47f7,_0x5d5825,_0x4e5cd8,_0x50501b,path[_0x66ec('0x70')](_0x5f01f3),fs[_0x66ec('0x71')](_0x5f01f3))[_0x66ec('0x24')](function(_0x2c5124){logger['info'](util[_0x66ec('0x30')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x46e3ca,_0x50501b,_0x2c5124[_0x66ec('0x72')]));_0x475a2e[_0x66ec('0x73')]=_0x2c5124['Bucket'];_0x475a2e['location']=_0x2c5124[_0x66ec('0x72')];logger['info'](util['format'](_0x66ec('0x74'),_0x46e3ca));return startTranscribe(_0x2d47f7,_0x5d5825,_0x4e5cd8,uuidv4(),_0x49dc4f,_0x2c5124[_0x66ec('0x72')]);})[_0x66ec('0x24')](function(_0x215d30){logger[_0x66ec('0x65')](util[_0x66ec('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x46e3ca,_0x215d30[_0x66ec('0x75')][_0x66ec('0x76')]));_0x475a2e[_0x66ec('0x77')]=_0x215d30[_0x66ec('0x75')]['TranscriptionJobName'];_0x475a2e[_0x66ec('0x78')]=_0x215d30['TranscriptionJob'][_0x66ec('0x79')];return _0x292c44(_0x475a2e);})[_0x66ec('0x46')](function(_0x4ca84d){return _0x58ec02(_0x4ca84d);});});}exports[_0x66ec('0x7a')]=function(_0x2a25ad,_0x326428,_0x154593){var _0x48abe9;var _0x525bdf;var _0x5c4210;var _0x809407=require(_0x66ec('0x4c'));return db[_0x66ec('0x2b')][_0x66ec('0x7b')]({'where':{'id':_0x2a25ad[_0x66ec('0x44')]['id']}})[_0x66ec('0x24')](function(_0x4dd8a6){if(_0x4dd8a6){var _0x1caa44=util[_0x66ec('0x30')](_0x66ec('0x4f'),_0x4dd8a6[_0x66ec('0x4e')]);if(fs[_0x66ec('0x53')](_0x1caa44)){cypher=!![];return _0x809407[_0x66ec('0x50')](_0x1caa44,_0x4dd8a6[_0x66ec('0x4e')],config[_0x66ec('0x51')]['recording'])[_0x66ec('0x24')](function(){return _0x4dd8a6;});}return _0x4dd8a6;}})[_0x66ec('0x24')](function(_0x3e8624){if(!_0x3e8624){throw new db['Sequelize'][(_0x66ec('0x55'))](_0x66ec('0x7c'));}_0x525bdf=_0x3e8624;return db[_0x66ec('0x7d')][_0x66ec('0x7b')]({'where':{'id':0x1}});})[_0x66ec('0x24')](handleEntityNotFound(_0x326428,null))[_0x66ec('0x24')](function(_0x35372b){if(_0x35372b){_0x48abe9=_0x35372b;if(!_0x48abe9['transcribe']||!_0x48abe9[_0x66ec('0x7e')]||!_0x48abe9[_0x66ec('0x7f')]||!_0x48abe9[_0x66ec('0x80')]||!_0x48abe9[_0x66ec('0x73')]){throw new db[(_0x66ec('0x54'))]['ValidationError'](_0x66ec('0x81'));}if(_0x2a25ad[_0x66ec('0x48')][_0x66ec('0x82')]&&(!_0x48abe9[_0x66ec('0x83')]||!_0x48abe9[_0x66ec('0x84')]||!_0x48abe9[_0x66ec('0x85')]||!_0x48abe9[_0x66ec('0x80')]||!_0x48abe9['bucket'])){throw new db[(_0x66ec('0x54'))][(_0x66ec('0x55'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x66ec('0x7b')]({'where':{'id':_0x48abe9['transcribeAccountId']}});}})[_0x66ec('0x24')](function(_0x218866){if(!_0x218866){throw new db[(_0x66ec('0x54'))]['ValidationError'](_0x66ec('0x86'));}if(!_0x218866['data1']||!_0x218866[_0x66ec('0x87')]){throw new db[(_0x66ec('0x54'))][(_0x66ec('0x55'))](_0x66ec('0x88'));}_0x5c4210=_0x218866;return getBucketslist(_0x5c4210[_0x66ec('0x89')],_0x5c4210[_0x66ec('0x87')],_0x48abe9['transcribeRegion']);})['then'](function(_0x4ad114){if(_0x4ad114&&_0x4ad114['Buckets']){var _0x265f5e=_['find'](_0x4ad114[_0x66ec('0x8a')],function(_0x3f85f3){return _0x3f85f3['Name']===_0x48abe9[_0x66ec('0x73')];});if(!_0x265f5e){logger[_0x66ec('0x65')](util[_0x66ec('0x30')](_0x66ec('0x8b'),_0x2a25ad[_0x66ec('0x44')]['id'],_0x48abe9[_0x66ec('0x73')]));return createBucket(_0x5c4210[_0x66ec('0x89')],_0x5c4210[_0x66ec('0x87')],_0x48abe9[_0x66ec('0x7f')],_0x48abe9[_0x66ec('0x73')]);}logger[_0x66ec('0x65')](util[_0x66ec('0x30')](_0x66ec('0x8c'),_0x2a25ad['params']['id'],_0x48abe9[_0x66ec('0x73')]));return;}})['then'](function(_0x3373e0){if(_0x525bdf[_0x66ec('0x78')]===_0x66ec('0x8d')){return transcribe(_0x2a25ad[_0x66ec('0x44')]['id'],_0x5c4210[_0x66ec('0x89')],_0x5c4210['data2'],_0x48abe9['transcribeRegion'],_0x48abe9[_0x66ec('0x73')],_0x525bdf[_0x66ec('0x4e')],_0x48abe9[_0x66ec('0x80')]);}else{logger[_0x66ec('0x65')](util[_0x66ec('0x30')](_0x66ec('0x8e'),_0x2a25ad[_0x66ec('0x44')]['id']));return{'transcribeStatus':_0x66ec('0x8f')};}})[_0x66ec('0x24')](function(_0xd9a00f){if(_0xd9a00f){_0xd9a00f['tempSentiment']=_0x2a25ad['body'][_0x66ec('0x82')];return _0x525bdf[_0x66ec('0x90')](_0xd9a00f);}})[_0x66ec('0x24')](respondWithResult(_0x326428,null))[_0x66ec('0x46')](handleError(_0x326428,null));};function writeFile(_0xe8c189,_0x48f445){return new Promise(function(_0x6c10e0,_0x19d63b){fs['writeFile'](_0x48f445,_0xe8c189,function(_0x5527c9,_0x2a6ec2){if(_0x5527c9){return _0x19d63b(_0x5527c9);}else{return _0x6c10e0(_0x2a6ec2);}});});}exports[_0x66ec('0x91')]=function(_0x3591a4,_0x4905e1,_0xb3a109){return db[_0x66ec('0x2b')][_0x66ec('0x7b')]({'where':{'id':_0x3591a4[_0x66ec('0x44')]['id']}})[_0x66ec('0x24')](handleEntityNotFound(_0x4905e1))['then'](function(_0x468645){if(_0x468645&&_0x468645[_0x66ec('0x92')]){var _0x1b74e9=_0x468645['fileText'];var _0x51154b=config[_0x66ec('0x93')]+_0x66ec('0x94')+_0x468645['id']+_0x66ec('0x95');if(fs[_0x66ec('0x53')](_0x51154b)){return _0x51154b;}return writeFile(_0x1b74e9,_0x51154b)[_0x66ec('0x24')](function(){return _0x51154b;});}else{throw new db[(_0x66ec('0x54'))][(_0x66ec('0x55'))](_0x66ec('0x96'));}})[_0x66ec('0x24')](function(_0x301828){return _0x4905e1[_0x66ec('0x4b')](_0x301828);})[_0x66ec('0x46')](handleError(_0x4905e1));}; \ No newline at end of file +var _0xeb1d=['$and','push','decryptFile','secrets','isNil','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','find','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','findAll','show','params','length','includeAll','include','options','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','token'];(function(_0x25a664,_0x75b781){var _0x12877e=function(_0x2507a9){while(--_0x2507a9){_0x25a664['push'](_0x25a664['shift']());}};_0x12877e(++_0x75b781);}(_0xeb1d,0x173));var _0xdeb1=function(_0x2b17df,_0x32494c){_0x2b17df=_0x2b17df-0x0;var _0x4ca24a=_0xeb1d[_0x2b17df];return _0x4ca24a;};'use strict';var emlformat=require(_0xdeb1('0x0'));var rimraf=require(_0xdeb1('0x1'));var zipdir=require(_0xdeb1('0x2'));var jsonpatch=require(_0xdeb1('0x3'));var rp=require(_0xdeb1('0x4'));var moment=require(_0xdeb1('0x5'));var BPromise=require(_0xdeb1('0x6'));var Mustache=require('mustache');var util=require(_0xdeb1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdeb1('0x8'));var fs=require('fs');var fs_extra=require(_0xdeb1('0x9'));var _=require(_0xdeb1('0xa'));var squel=require(_0xdeb1('0xb'));var crypto=require('crypto');var jsforce=require(_0xdeb1('0xc'));var deskjs=require(_0xdeb1('0xd'));var toCsv=require(_0xdeb1('0xe'));var querystring=require('querystring');var Papa=require(_0xdeb1('0xf'));var AWS=require(_0xdeb1('0x10'));var uuidv4=require(_0xdeb1('0x11'));var Redis=require(_0xdeb1('0x12'));var authService=require(_0xdeb1('0x13'));var qs=require(_0xdeb1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdeb1('0x15'));var logger=require(_0xdeb1('0x16'))(_0xdeb1('0x17'));var utils=require(_0xdeb1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdeb1('0x19'));var db=require(_0xdeb1('0x1a'))['db'];function respondWithStatusCode(_0x24ceac,_0xdd0d5b){_0xdd0d5b=_0xdd0d5b||0xcc;return function(_0x1f20b9){if(_0x1f20b9){return _0x24ceac['sendStatus'](_0xdd0d5b);}return _0x24ceac[_0xdeb1('0x1b')](_0xdd0d5b)['end']();};}function respondWithResult(_0x1a59e0,_0x19ae44){_0x19ae44=_0x19ae44||0xc8;return function(_0x398ea0){if(_0x398ea0){return _0x1a59e0[_0xdeb1('0x1b')](_0x19ae44)[_0xdeb1('0x1c')](_0x398ea0);}};}function respondWithFilteredResult(_0x5563d7,_0x561289){return function(_0x578a7a){if(_0x578a7a){var _0xff8924=typeof _0x561289[_0xdeb1('0x1d')]===_0xdeb1('0x1e')&&typeof _0x561289['limit']===_0xdeb1('0x1e');var _0x417ce3=_0x578a7a[_0xdeb1('0x1f')];var _0x863904=_0xff8924?0x0:_0x561289[_0xdeb1('0x1d')];var _0x2c3213=_0xff8924?_0x578a7a[_0xdeb1('0x1f')]:_0x561289[_0xdeb1('0x1d')]+_0x561289[_0xdeb1('0x20')];var _0x1716eb;if(_0x2c3213>=_0x417ce3){_0x2c3213=_0x417ce3;_0x1716eb=0xc8;}else{_0x1716eb=0xce;}_0x5563d7[_0xdeb1('0x1b')](_0x1716eb);return _0x5563d7[_0xdeb1('0x21')](_0xdeb1('0x22'),_0x863904+'-'+_0x2c3213+'/'+_0x417ce3)[_0xdeb1('0x1c')](_0x578a7a);}return null;};}function patchUpdates(_0x2f9f65){return function(_0x4ef35b){try{jsonpatch[_0xdeb1('0x23')](_0x4ef35b,_0x2f9f65,!![]);}catch(_0x108b2d){return BPromise[_0xdeb1('0x24')](_0x108b2d);}return _0x4ef35b['save']();};}function saveUpdates(_0x553740,_0x22ce14){return function(_0x1ebddf){if(_0x1ebddf){return _0x1ebddf[_0xdeb1('0x25')](_0x553740)[_0xdeb1('0x26')](function(_0x126a2e){return _0x126a2e;});}return null;};}function removeEntity(_0x4ff008,_0x342917){return function(_0x249d9e){if(_0x249d9e){return _0x249d9e[_0xdeb1('0x27')]()[_0xdeb1('0x26')](function(){_0x4ff008[_0xdeb1('0x1b')](0xcc)[_0xdeb1('0x28')]();});}};}function handleEntityNotFound(_0x16085e,_0x1f163e){return function(_0x63302c){if(!_0x63302c){_0x16085e[_0xdeb1('0x29')](0x194);}return _0x63302c;};}function handleError(_0x433790,_0x21ff3c){_0x21ff3c=_0x21ff3c||0x1f4;return function(_0x2a26ac){logger[_0xdeb1('0x2a')](_0x2a26ac[_0xdeb1('0x2b')]);if(_0x2a26ac[_0xdeb1('0x2c')]){delete _0x2a26ac[_0xdeb1('0x2c')];}_0x433790['status'](_0x21ff3c)[_0xdeb1('0x2d')](_0x2a26ac);};}exports[_0xdeb1('0x2e')]=function(_0x3aee4f,_0x37bee2){var _0x11ae35={},_0x4f99d5={},_0x50055e={'count':0x0,'rows':[]};var _0x56cbe1=_[_0xdeb1('0x2f')](db[_0xdeb1('0x30')][_0xdeb1('0x31')],function(_0x33c2e4){return{'name':_0x33c2e4['fieldName'],'type':_0x33c2e4[_0xdeb1('0x32')][_0xdeb1('0x33')]};});_0x4f99d5['model']=_[_0xdeb1('0x34')](_[_0xdeb1('0x2f')](_0x56cbe1,_0xdeb1('0x2c')),['format']);_0x4f99d5[_0xdeb1('0x35')]=_[_0xdeb1('0x36')](_0x3aee4f['query']);_0x4f99d5[_0xdeb1('0x37')]=_[_0xdeb1('0x38')](_0x4f99d5[_0xdeb1('0x39')],_0x4f99d5[_0xdeb1('0x35')]);_0x11ae35[_0xdeb1('0x3a')]=_[_0xdeb1('0x38')](_0x4f99d5[_0xdeb1('0x39')],qs[_0xdeb1('0x3b')](_0x3aee4f[_0xdeb1('0x35')][_0xdeb1('0x3b')]));_0x11ae35[_0xdeb1('0x3a')]=_0x11ae35[_0xdeb1('0x3a')]['length']?_0x11ae35[_0xdeb1('0x3a')]:_0x4f99d5[_0xdeb1('0x39')];if(!_0x3aee4f[_0xdeb1('0x35')]['hasOwnProperty'](_0xdeb1('0x3c'))){_0x11ae35[_0xdeb1('0x20')]=qs[_0xdeb1('0x20')](_0x3aee4f[_0xdeb1('0x35')][_0xdeb1('0x20')]);_0x11ae35['offset']=qs[_0xdeb1('0x1d')](_0x3aee4f[_0xdeb1('0x35')]['offset']);}_0x11ae35[_0xdeb1('0x3d')]=qs[_0xdeb1('0x3e')](_0x3aee4f['query'][_0xdeb1('0x3e')]);_0x11ae35[_0xdeb1('0x3f')]=qs[_0xdeb1('0x37')](_[_0xdeb1('0x40')](_0x3aee4f[_0xdeb1('0x35')],_0x4f99d5['filters']),_0x56cbe1);if(_0x3aee4f[_0xdeb1('0x35')][_0xdeb1('0x41')]){_0x11ae35[_0xdeb1('0x3f')]=_['merge'](_0x11ae35[_0xdeb1('0x3f')],{'$or':_[_0xdeb1('0x2f')](_0x56cbe1,function(_0x24b149){if(_0x24b149[_0xdeb1('0x32')]!=='VIRTUAL'){var _0x173d99={};_0x173d99[_0x24b149[_0xdeb1('0x2c')]]={'$like':'%'+_0x3aee4f[_0xdeb1('0x35')][_0xdeb1('0x41')]+'%'};return _0x173d99;}})});}_0x11ae35=_[_0xdeb1('0x42')]({},_0x11ae35,_0x3aee4f['options']);var _0x1c9089={'where':_0x11ae35[_0xdeb1('0x3f')]};return db[_0xdeb1('0x30')]['count'](_0x1c9089)[_0xdeb1('0x26')](function(_0x39b0a5){_0x50055e[_0xdeb1('0x1f')]=_0x39b0a5;if(_0x3aee4f[_0xdeb1('0x35')]['includeAll']){_0x11ae35['include']=[{'all':!![]}];}return db[_0xdeb1('0x30')][_0xdeb1('0x43')](_0x11ae35);})[_0xdeb1('0x26')](function(_0x149717){_0x50055e['rows']=_0x149717;return _0x50055e;})[_0xdeb1('0x26')](respondWithFilteredResult(_0x37bee2,_0x11ae35))['catch'](handleError(_0x37bee2,null));};exports[_0xdeb1('0x44')]=function(_0x8c7ef1,_0x340212){var _0x5bac6a={'raw':![],'where':{'id':_0x8c7ef1[_0xdeb1('0x45')]['id']}},_0x57a8f7={};_0x57a8f7[_0xdeb1('0x39')]=_[_0xdeb1('0x36')](db['VoiceRecording'][_0xdeb1('0x31')]);_0x57a8f7[_0xdeb1('0x35')]=_[_0xdeb1('0x36')](_0x8c7ef1[_0xdeb1('0x35')]);_0x57a8f7[_0xdeb1('0x37')]=_[_0xdeb1('0x38')](_0x57a8f7[_0xdeb1('0x39')],_0x57a8f7[_0xdeb1('0x35')]);_0x5bac6a['attributes']=_[_0xdeb1('0x38')](_0x57a8f7[_0xdeb1('0x39')],qs[_0xdeb1('0x3b')](_0x8c7ef1[_0xdeb1('0x35')]['fields']));_0x5bac6a['attributes']=_0x5bac6a[_0xdeb1('0x3a')][_0xdeb1('0x46')]?_0x5bac6a['attributes']:_0x57a8f7[_0xdeb1('0x39')];if(_0x8c7ef1[_0xdeb1('0x35')][_0xdeb1('0x47')]){_0x5bac6a[_0xdeb1('0x48')]=[{'all':!![]}];}_0x5bac6a=_['merge']({},_0x5bac6a,_0x8c7ef1[_0xdeb1('0x49')]);return db[_0xdeb1('0x30')]['find'](_0x5bac6a)[_0xdeb1('0x26')](handleEntityNotFound(_0x340212,null))[_0xdeb1('0x26')](respondWithResult(_0x340212,null))[_0xdeb1('0x4a')](handleError(_0x340212,null));};exports[_0xdeb1('0x4b')]=function(_0x10249d,_0x127cc1){return db[_0xdeb1('0x30')][_0xdeb1('0x4b')](_0x10249d['body'],{})[_0xdeb1('0x26')](respondWithResult(_0x127cc1,0xc9))[_0xdeb1('0x4a')](handleError(_0x127cc1,null));};exports['update']=function(_0x1045a8,_0x5f42b1){if(_0x1045a8['body']['id']){delete _0x1045a8[_0xdeb1('0x4c')]['id'];}return db[_0xdeb1('0x30')]['find']({'where':{'id':_0x1045a8[_0xdeb1('0x45')]['id']}})[_0xdeb1('0x26')](handleEntityNotFound(_0x5f42b1,null))['then'](saveUpdates(_0x1045a8[_0xdeb1('0x4c')],null))['then'](respondWithResult(_0x5f42b1,null))['catch'](handleError(_0x5f42b1,null));};exports['describe']=function(_0x45d085,_0x3f9bd3){return db[_0xdeb1('0x30')][_0xdeb1('0x4d')]()[_0xdeb1('0x26')](respondWithResult(_0x3f9bd3,null))[_0xdeb1('0x4a')](handleError(_0x3f9bd3,null));};exports[_0xdeb1('0x4e')]=function(_0x4d4d0c,_0x446e9e,_0x30502a){var _0x18c799=require(_0xdeb1('0x4f'));var _0x24697c=![];var _0x1f7bbd={};if(_0x4d4d0c[_0xdeb1('0x35')]['type']&&_0x4d4d0c['query']['type']==='uniqueid'){_0x1f7bbd[_0xdeb1('0x50')]=_0x4d4d0c[_0xdeb1('0x45')]['id'];}else{_0x1f7bbd['id']=_0x4d4d0c[_0xdeb1('0x45')]['id'];}return db['VoiceRecording']['find']({'where':_0x1f7bbd,'attributes':['id',_0xdeb1('0x51')],'raw':!![]})[_0xdeb1('0x26')](handleEntityNotFound(_0x446e9e,null))[_0xdeb1('0x26')](function(_0x5000b1){if(_0x5000b1){var _0x31fee9=_0x5000b1[_0xdeb1('0x51')];var _0x1f64ba=util[_0xdeb1('0x52')](_0xdeb1('0x53'),_0x31fee9);if(fs['existsSync'](_0x1f64ba)){_0x24697c=!![];return _0x18c799['decryptFile'](_0x1f64ba,_0x31fee9,config['secrets'][_0xdeb1('0x54')])[_0xdeb1('0x26')](function(){return _0x5000b1;});}return _0x5000b1;}})[_0xdeb1('0x26')](function(_0x3081d3){if(_0x3081d3){var _0x138317=_0x3081d3['value'];if(!fs[_0xdeb1('0x55')](_0x138317)){throw new db[(_0xdeb1('0x56'))][(_0xdeb1('0x57'))](_0xdeb1('0x58'));}if(_0x3081d3[_0xdeb1('0x59')]){return _0x446e9e['download'](_0x138317,_0x3081d3[_0xdeb1('0x59')]+path[_0xdeb1('0x5a')](_0x138317),function(){if(_0x24697c){fs[_0xdeb1('0x5b')](_0x138317);}});}else{return _0x446e9e[_0xdeb1('0x4e')](_0x138317,function(_0x9923ab){if(_0x24697c){fs[_0xdeb1('0x5b')](_0x138317);}});}}})['catch'](function(_0x2c8a55){if(_0x2c8a55[_0xdeb1('0x5c')]===_0xdeb1('0x58')){_0x446e9e[_0xdeb1('0x1b')](0x194)['send'](_0xdeb1('0x5d'));}else{return handleError(_0x446e9e,null);}});};exports[_0xdeb1('0x5e')]=function(_0x3dc6b9,_0x11c946,_0x1ee7fc){var _0x41116c=require(_0xdeb1('0x4f'));var _0x5cb567=![];var _0x1caed6={'$and':[db['sequelize'][_0xdeb1('0x3f')](db[_0xdeb1('0x5f')]['fn']('MD5',db[_0xdeb1('0x5f')]['col']('uniqueid')),_0x3dc6b9[_0xdeb1('0x35')][_0xdeb1('0x60')])]};if(_0x3dc6b9[_0xdeb1('0x35')][_0xdeb1('0x32')]&&_0x3dc6b9[_0xdeb1('0x35')][_0xdeb1('0x32')]==='uniqueid'){_0x1caed6[_0xdeb1('0x61')][_0xdeb1('0x62')]({'uniqueid':_0x3dc6b9[_0xdeb1('0x45')]['id']});}else{_0x1caed6['$and'][_0xdeb1('0x62')]({'id':_0x3dc6b9[_0xdeb1('0x45')]['id']});}return db[_0xdeb1('0x30')]['find']({'where':_0x1caed6,'attributes':['id','value'],'raw':!![]})[_0xdeb1('0x26')](handleEntityNotFound(_0x11c946,null))[_0xdeb1('0x26')](function(_0x2468d1){if(_0x2468d1){var _0x15f4d6=util[_0xdeb1('0x52')](_0xdeb1('0x53'),_0x2468d1[_0xdeb1('0x51')]);if(fs[_0xdeb1('0x55')](_0x15f4d6)){_0x5cb567=!![];return _0x41116c[_0xdeb1('0x63')](_0x15f4d6,_0x2468d1['value'],config[_0xdeb1('0x64')][_0xdeb1('0x54')])[_0xdeb1('0x26')](function(){return _0x2468d1;});}return _0x2468d1;}})[_0xdeb1('0x26')](function(_0x1a609c){if(_0x1a609c){if(!fs[_0xdeb1('0x55')](_0x1a609c[_0xdeb1('0x51')])){throw new db[(_0xdeb1('0x56'))][(_0xdeb1('0x57'))](_0xdeb1('0x58'));}if(_0x1a609c[_0xdeb1('0x59')]){return _0x11c946[_0xdeb1('0x4e')](_0x1a609c[_0xdeb1('0x51')],_0x1a609c[_0xdeb1('0x59')]+path['extname'](_0x1a609c['value']),function(){if(_0x5cb567){fs[_0xdeb1('0x5b')](_0x1a609c[_0xdeb1('0x51')]);}});}else{return _0x11c946['download'](_0x1a609c[_0xdeb1('0x51')],function(_0x1144ed){if(_0x5cb567){fs[_0xdeb1('0x5b')](_0x1a609c['value']);}});}}})[_0xdeb1('0x4a')](handleError(_0x11c946,null));};exports[_0xdeb1('0x27')]=function(_0x2b3ae8,_0x405b38){return db[_0xdeb1('0x30')]['find']({'where':{'id':_0x2b3ae8[_0xdeb1('0x45')]['id']}})['then'](function(_0x217af2){if(_[_0xdeb1('0x65')](_0x217af2)){throw new ReferenceError('Entity\x20not\x20found');}return _0x217af2;})[_0xdeb1('0x26')](function(_0x25a621){var _0x51d5cb=_0x25a621[_0xdeb1('0x51')];logger[_0xdeb1('0x66')](_0xdeb1('0x67'),_0x51d5cb);if(!_[_0xdeb1('0x65')](_0x25a621[_0xdeb1('0x51')])&&fs[_0xdeb1('0x55')](_0x51d5cb)){logger[_0xdeb1('0x66')]('File:\x20\x22'+_0x51d5cb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdeb1('0x68')](_0x51d5cb);}_0x51d5cb=_0x51d5cb+_0xdeb1('0x69');if(!_[_0xdeb1('0x65')](_0x25a621[_0xdeb1('0x51')])&&fs[_0xdeb1('0x55')](_0x51d5cb)){logger['info'](_0xdeb1('0x6a')+_0x51d5cb+_0xdeb1('0x6b'));fs['unlinkSync'](_0x51d5cb);}return _0x25a621;})['then'](function(_0x428d58){if(!_0x428d58)throw new InternalError();return _0x428d58['destroy']();})[_0xdeb1('0x26')](function(){_0x405b38[_0xdeb1('0x1b')](0xcc)[_0xdeb1('0x28')]();})[_0xdeb1('0x4a')](handleError(_0x405b38,null));};function getBucketslist(_0x11782d,_0x1d3940,_0x39b7cc){return new Promise(function(_0x4ef28f,_0x50af23){var _0x4a378e=new AWS['S3']({'accessKeyId':_0x1d3940,'secretAccessKey':_0x11782d,'region':_0x39b7cc});_0x4a378e['listBuckets']({},function(_0x3b8e50,_0x2f53f8){if(_0x3b8e50){return _0x50af23(_0x3b8e50);}else{return _0x4ef28f(_0x2f53f8);}});});}function createBucket(_0x221ec7,_0x5231ac,_0x52e504,_0x33505d){return new Promise(function(_0x2db0dc,_0x2cac99){var _0x52b170=new AWS['S3']({'accessKeyId':_0x5231ac,'secretAccessKey':_0x221ec7,'region':_0x52e504});_0x52b170['createBucket']({'Bucket':_0x33505d},function(_0x39c704,_0xabd37a){if(_0x39c704){return _0x2cac99(_0x39c704);}else{return _0x2db0dc(_0xabd37a);}});});}function uploadFile(_0x28d934,_0x30066c,_0x3640cf,_0xb183f5,_0x4f4628,_0x4f7f7c){return new Promise(function(_0x4f6eb0,_0x54b64c){var _0x18ebad=new AWS['S3']({'accessKeyId':_0x30066c,'secretAccessKey':_0x28d934,'region':_0x3640cf});_0x18ebad[_0xdeb1('0x6c')]({'Bucket':_0xb183f5,'Key':_0x4f4628,'Body':_0x4f7f7c},function(_0x1a1d84,_0x39b1aa){if(_0x1a1d84){return _0x54b64c(_0x1a1d84);}else{return _0x4f6eb0(_0x39b1aa);}});});}function startTranscribe(_0x4d9ae7,_0x3f97ca,_0x24de91,_0x56b7be,_0x1cf803,_0x4c8205){return new Promise(function(_0x131a4d,_0x49713d){var _0x4de3f4=new AWS[(_0xdeb1('0x6d'))]({'accessKeyId':_0x3f97ca,'secretAccessKey':_0x4d9ae7,'region':_0x24de91});_0x4de3f4[_0xdeb1('0x6e')]({'TranscriptionJobName':_0x56b7be,'LanguageCode':_0x1cf803,'Media':{'MediaFileUri':_0x4c8205}},function(_0x2d2ed6,_0x978a42){if(_0x2d2ed6){return _0x49713d(_0x2d2ed6);}else{return _0x131a4d(_0x978a42);}});});}function transcribe(_0x10edb7,_0x1b20ee,_0x4b6473,_0x43dab6,_0x1b86aa,_0x183458,_0x2beffe){return new Promise(function(_0x51b62e,_0x119ccb){var _0x531bb5={};logger[_0xdeb1('0x66')](util[_0xdeb1('0x52')](_0xdeb1('0x6f'),_0x10edb7,_0x1b86aa));return uploadFile(_0x1b20ee,_0x4b6473,_0x43dab6,_0x1b86aa,path[_0xdeb1('0x70')](_0x183458),fs[_0xdeb1('0x71')](_0x183458))[_0xdeb1('0x26')](function(_0x2fd21a){logger[_0xdeb1('0x66')](util[_0xdeb1('0x52')](_0xdeb1('0x72'),_0x10edb7,_0x1b86aa,_0x2fd21a[_0xdeb1('0x73')]));_0x531bb5['bucket']=_0x2fd21a[_0xdeb1('0x74')];_0x531bb5['location']=_0x2fd21a['Location'];logger[_0xdeb1('0x66')](util[_0xdeb1('0x52')](_0xdeb1('0x75'),_0x10edb7));return startTranscribe(_0x1b20ee,_0x4b6473,_0x43dab6,uuidv4(),_0x2beffe,_0x2fd21a[_0xdeb1('0x73')]);})['then'](function(_0x4117ec){logger['info'](util[_0xdeb1('0x52')](_0xdeb1('0x76'),_0x10edb7,_0x4117ec[_0xdeb1('0x77')]['TranscriptionJobName']));_0x531bb5[_0xdeb1('0x78')]=_0x4117ec[_0xdeb1('0x77')][_0xdeb1('0x79')];_0x531bb5[_0xdeb1('0x7a')]=_0x4117ec[_0xdeb1('0x77')]['TranscriptionJobStatus'];return _0x51b62e(_0x531bb5);})[_0xdeb1('0x4a')](function(_0x150895){return _0x119ccb(_0x150895);});});}exports[_0xdeb1('0x7b')]=function(_0x30ec96,_0x348db0,_0xd0ea96){var _0x53d5af;var _0x238bcc;var _0x493759;var _0x20e7c6=require(_0xdeb1('0x4f'));return db['VoiceRecording']['findOne']({'where':{'id':_0x30ec96[_0xdeb1('0x45')]['id']}})['then'](function(_0x573153){if(_0x573153){var _0x53c26d=util[_0xdeb1('0x52')](_0xdeb1('0x53'),_0x573153[_0xdeb1('0x51')]);if(fs[_0xdeb1('0x55')](_0x53c26d)){cypher=!![];return _0x20e7c6['decryptFile'](_0x53c26d,_0x573153[_0xdeb1('0x51')],config['secrets'][_0xdeb1('0x54')])['then'](function(){return _0x573153;});}return _0x573153;}})[_0xdeb1('0x26')](function(_0x223f17){if(!_0x223f17){throw new db[(_0xdeb1('0x56'))][(_0xdeb1('0x57'))](_0xdeb1('0x7c'));}_0x238bcc=_0x223f17;return db[_0xdeb1('0x7d')][_0xdeb1('0x7e')]({'where':{'id':0x1}});})[_0xdeb1('0x26')](handleEntityNotFound(_0x348db0,null))[_0xdeb1('0x26')](function(_0x167254){if(_0x167254){_0x53d5af=_0x167254;if(!_0x53d5af[_0xdeb1('0x7f')]||!_0x53d5af[_0xdeb1('0x80')]||!_0x53d5af[_0xdeb1('0x81')]||!_0x53d5af[_0xdeb1('0x82')]||!_0x53d5af[_0xdeb1('0x83')]){throw new db[(_0xdeb1('0x56'))][(_0xdeb1('0x57'))](_0xdeb1('0x84'));}if(_0x30ec96[_0xdeb1('0x4c')][_0xdeb1('0x85')]&&(!_0x53d5af['sentiment']||!_0x53d5af[_0xdeb1('0x86')]||!_0x53d5af[_0xdeb1('0x87')]||!_0x53d5af[_0xdeb1('0x82')]||!_0x53d5af[_0xdeb1('0x83')])){throw new db[(_0xdeb1('0x56'))][(_0xdeb1('0x57'))](_0xdeb1('0x88'));}return db[_0xdeb1('0x89')]['findOne']({'where':{'id':_0x53d5af[_0xdeb1('0x80')]}});}})['then'](function(_0x2999cb){if(!_0x2999cb){throw new db['Sequelize'][(_0xdeb1('0x57'))](_0xdeb1('0x8a'));}if(!_0x2999cb[_0xdeb1('0x8b')]||!_0x2999cb[_0xdeb1('0x8c')]){throw new db[(_0xdeb1('0x56'))][(_0xdeb1('0x57'))](_0xdeb1('0x8d'));}_0x493759=_0x2999cb;return getBucketslist(_0x493759['data1'],_0x493759[_0xdeb1('0x8c')],_0x53d5af[_0xdeb1('0x81')]);})[_0xdeb1('0x26')](function(_0x1ce177){if(_0x1ce177&&_0x1ce177[_0xdeb1('0x8e')]){var _0x535ee9=_[_0xdeb1('0x8f')](_0x1ce177[_0xdeb1('0x8e')],function(_0xfda0e0){return _0xfda0e0[_0xdeb1('0x90')]===_0x53d5af['bucket'];});if(!_0x535ee9){logger[_0xdeb1('0x66')](util[_0xdeb1('0x52')](_0xdeb1('0x91'),_0x30ec96[_0xdeb1('0x45')]['id'],_0x53d5af[_0xdeb1('0x83')]));return createBucket(_0x493759[_0xdeb1('0x8b')],_0x493759[_0xdeb1('0x8c')],_0x53d5af['transcribeRegion'],_0x53d5af[_0xdeb1('0x83')]);}logger[_0xdeb1('0x66')](util[_0xdeb1('0x52')](_0xdeb1('0x92'),_0x30ec96['params']['id'],_0x53d5af[_0xdeb1('0x83')]));return;}})['then'](function(_0x19104e){if(_0x238bcc[_0xdeb1('0x7a')]==='NEW'){return transcribe(_0x30ec96[_0xdeb1('0x45')]['id'],_0x493759['data1'],_0x493759['data2'],_0x53d5af[_0xdeb1('0x81')],_0x53d5af[_0xdeb1('0x83')],_0x238bcc[_0xdeb1('0x51')],_0x53d5af['language']);}else{logger['info'](util['format'](_0xdeb1('0x93'),_0x30ec96['params']['id']));return{'transcribeStatus':_0xdeb1('0x94')};}})[_0xdeb1('0x26')](function(_0x439d13){if(_0x439d13){_0x439d13[_0xdeb1('0x95')]=_0x30ec96['body']['runSentiment'];return _0x238bcc[_0xdeb1('0x96')](_0x439d13);}})[_0xdeb1('0x26')](respondWithResult(_0x348db0,null))[_0xdeb1('0x4a')](handleError(_0x348db0,null));};function writeFile(_0x16b317,_0x478f0f){return new Promise(function(_0x1fa1e0,_0x3e667f){fs['writeFile'](_0x478f0f,_0x16b317,function(_0x36c836,_0xc1872){if(_0x36c836){return _0x3e667f(_0x36c836);}else{return _0x1fa1e0(_0xc1872);}});});}exports[_0xdeb1('0x97')]=function(_0x276813,_0x107df8,_0x513153){return db['VoiceRecording']['findOne']({'where':{'id':_0x276813[_0xdeb1('0x45')]['id']}})[_0xdeb1('0x26')](handleEntityNotFound(_0x107df8))[_0xdeb1('0x26')](function(_0x2e1a5c){if(_0x2e1a5c&&_0x2e1a5c['fileText']){var _0x176309=_0x2e1a5c[_0xdeb1('0x98')];var _0x578989=config['root']+_0xdeb1('0x99')+_0x2e1a5c['id']+_0xdeb1('0x9a');if(fs[_0xdeb1('0x55')](_0x578989)){return _0x578989;}return writeFile(_0x176309,_0x578989)[_0xdeb1('0x26')](function(){return _0x578989;});}else{throw new db[(_0xdeb1('0x56'))]['ValidationError'](_0xdeb1('0x9b'));}})[_0xdeb1('0x26')](function(_0x42fb78){return _0x107df8[_0xdeb1('0x4e')](_0x42fb78);})[_0xdeb1('0x4a')](handleError(_0x107df8));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f13d1c3..a5c89d5 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 _0x5712=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x2331ef,_0x141f5c){var _0x76f8bc=function(_0xbf7846){while(--_0xbf7846){_0x2331ef['push'](_0x2331ef['shift']());}};_0x76f8bc(++_0x141f5c);}(_0x5712,0x140));var _0x2571=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5712[_0x501510];return _0x1e6ee5;};'use strict';var attributes=require(_0x2571('0x0'));module[_0x2571('0x1')]=function(_0x247ab0,_0x2e56c3){return _0x247ab0[_0x2571('0x2')](_0x2571('0x3'),attributes,{'tableName':_0x2571('0x4'),'paranoid':![],'indexes':[{'name':_0x2571('0x5'),'fields':[_0x2571('0x5')]},{'name':_0x2571('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x949d=['exports','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x3e2933,_0x482bb7){var _0x4ff9cf=function(_0x1021cd){while(--_0x1021cd){_0x3e2933['push'](_0x3e2933['shift']());}};_0x4ff9cf(++_0x482bb7);}(_0x949d,0x162));var _0xd949=function(_0x4a3573,_0x38b682){_0x4a3573=_0x4a3573-0x0;var _0x1a03cf=_0x949d[_0x4a3573];return _0x1a03cf;};'use strict';var attributes=require(_0xd949('0x0'));module[_0xd949('0x1')]=function(_0x1cdfa8,_0x45e6f8){return _0x1cdfa8['define']('VoiceRecording',attributes,{'tableName':_0xd949('0x2'),'paranoid':![],'indexes':[{'name':_0xd949('0x3'),'fields':['uniqueid']},{'name':_0xd949('0x4'),'fields':[_0xd949('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e7e1e3e..6b0aca7 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 _0xd824=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','then','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x182373,_0xe48703){var _0x4e60d3=function(_0x255265){while(--_0x255265){_0x182373['push'](_0x182373['shift']());}};_0x4e60d3(++_0xe48703);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x18')]||null:null,'attributes':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['limit']||null:null})[_0x4d82('0x19')](function(_0x41f194){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1a')](_0x4d82('0x12'),_0x258c59,JSON[_0x4d82('0xe')](_0x41f194));_0x2f2127(_0x41f194);})[_0x4d82('0x11')](function(_0x12feab){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x12feab[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x12feab[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1b')]=function(_0x4af6da){var _0x5e0b03=this;return new Promise(function(_0x3dcb0f,_0x2548de){var _0x2a0572=require(_0x4d82('0x1c'));var _0x5cbd7e;return db[_0x4d82('0x1d')][_0x4d82('0x1e')]({'attributes':['id',_0x4d82('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x4d82('0x19')](function(_0x5ce98b){_0x5cbd7e=_0x5ce98b;return db[_0x4d82('0x13')]['create'](_0x4af6da['body']);})['then'](function(_0x52533b){if(_0x5cbd7e[_0x4d82('0x1f')]&&fs[_0x4d82('0x20')](_0x52533b[_0x4d82('0x21')])){var _0x52e320=util[_0x4d82('0x22')](_0x4d82('0x23'),_0x52533b['value']);return _0x2a0572['encryptFile'](_0x52533b[_0x4d82('0x21')],_0x52e320,config[_0x4d82('0x24')][_0x4d82('0x25')])[_0x4d82('0x19')](function(){fs['unlink'](_0x52533b[_0x4d82('0x21')]);logger['info'](_0x4d82('0x26'));return _0x52533b;});}return _0x52533b;})[_0x4d82('0x19')](function(_0x4a2a45){logger['info'](_0x4d82('0x1b'),_0x4af6da);logger[_0x4d82('0x1a')](_0x4d82('0x1b'),_0x4af6da,JSON[_0x4d82('0xe')](_0x4a2a45));_0x3dcb0f(_0x4a2a45);})[_0x4d82('0x11')](function(_0x420b28){logger[_0x4d82('0xf')](_0x4d82('0x1b'),_0x420b28[_0x4d82('0x10')],_0x4af6da);_0x2548de(_0x5e0b03[_0x4d82('0xf')](0x1f4,_0x420b28['message']));});});}; \ No newline at end of file +var _0x8f4c=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x418a44,_0x472586){var _0x478825=function(_0x53a568){while(--_0x53a568){_0x418a44['push'](_0x418a44['shift']());}};_0x478825(++_0x472586);}(_0x8f4c,0x113));var _0xc8f4=function(_0x4581cb,_0x166469){_0x4581cb=_0x4581cb-0x0;var _0x11593f=_0x8f4c[_0x4581cb];return _0x11593f;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108076[_0xc8f4('0x1b')]?_0x108076['options'][_0xc8f4('0x1d')]||null:null,'attributes':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1e')]||null:null,'limit':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x5e62aa){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON['stringify'](_0x5e62aa));_0x4763c1(_0x5e62aa);})[_0xc8f4('0x16')](function(_0x4a44e0){logger[_0xc8f4('0x11')]('UpdateVoiceRecording',_0x4a44e0[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0x4a44e0['message']));});});};exports[_0xc8f4('0x20')]=function(_0x21062f){var _0x11f766=this;return new Promise(function(_0x2fa052,_0x4ce586){var _0x3db490=require(_0xc8f4('0x21'));var _0x5db666;return db[_0xc8f4('0x22')][_0xc8f4('0x23')]({'attributes':['id',_0xc8f4('0x24')],'where':{'id':0x1},'raw':!![]})[_0xc8f4('0xb')](function(_0x24bef0){_0x5db666=_0x24bef0;return db[_0xc8f4('0x18')]['create'](_0x21062f[_0xc8f4('0x1a')]);})[_0xc8f4('0xb')](function(_0x1ea3d9){if(_0x5db666['callRecordingEncryption']&&fs[_0xc8f4('0x25')](_0x1ea3d9[_0xc8f4('0x26')])){var _0x5ab6cb=util['format']('%s.cypher',_0x1ea3d9[_0xc8f4('0x26')]);return _0x3db490[_0xc8f4('0x27')](_0x1ea3d9[_0xc8f4('0x26')],_0x5ab6cb,config[_0xc8f4('0x28')][_0xc8f4('0x29')])[_0xc8f4('0xb')](function(){fs[_0xc8f4('0x2a')](_0x1ea3d9[_0xc8f4('0x26')]);logger['info'](_0xc8f4('0x2b'));return _0x1ea3d9;});}return _0x1ea3d9;})[_0xc8f4('0xb')](function(_0x3910f3){logger['info'](_0xc8f4('0x20'),_0x21062f);logger[_0xc8f4('0xe')]('CreateVoiceRecording',_0x21062f,JSON[_0xc8f4('0x10')](_0x3910f3));_0x2fa052(_0x3910f3);})[_0xc8f4('0x16')](function(_0x36f24f){logger['error'](_0xc8f4('0x20'),_0x36f24f[_0xc8f4('0x13')],_0x21062f);_0x4ce586(_0x11f766[_0xc8f4('0x11')](0x1f4,_0x36f24f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index fd8c624..ba8304f 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 _0x963a=['fs-extra','./voiceTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x4f5ab8,_0x5822b4){var _0x35f8e1=function(_0x4c4422){while(--_0x4c4422){_0x4f5ab8['push'](_0x4f5ab8['shift']());}};_0x35f8e1(++_0x5822b4);}(_0x963a,0x11e));var _0xa963=function(_0x9c58a1,_0x4dd391){_0x9c58a1=_0x9c58a1-0x0;var _0x1d81a4=_0x963a[_0x9c58a1];return _0x1d81a4;};'use strict';var multer=require('multer');var util=require(_0xa963('0x0'));var path=require(_0xa963('0x1'));var timeout=require(_0xa963('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa963('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa963('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xa963('0x5')]);router[_0xa963('0x6')](_0xa963('0x7'),auth[_0xa963('0x8')](),controller[_0xa963('0x9')]);router[_0xa963('0x6')](_0xa963('0xa'),auth[_0xa963('0x8')](),controller[_0xa963('0xb')]);router[_0xa963('0xc')]('/',auth[_0xa963('0x8')](),controller['create']);router[_0xa963('0xd')](_0xa963('0xa'),auth[_0xa963('0x8')](),controller[_0xa963('0xe')]);router['delete'](_0xa963('0xa'),auth[_0xa963('0x8')](),controller[_0xa963('0xf')]);module[_0xa963('0x10')]=router; \ No newline at end of file +var _0x33b6=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x3f7e2c,_0x432ab1){var _0x5b2fc6=function(_0x1d95e7){while(--_0x1d95e7){_0x3f7e2c['push'](_0x3f7e2c['shift']());}};_0x5b2fc6(++_0x432ab1);}(_0x33b6,0x155));var _0x633b=function(_0x32ed89,_0x11d953){_0x32ed89=_0x32ed89-0x0;var _0x262961=_0x33b6[_0x32ed89];return _0x262961;};'use strict';var multer=require(_0x633b('0x0'));var util=require(_0x633b('0x1'));var path=require('path');var timeout=require(_0x633b('0x2'));var express=require(_0x633b('0x3'));var router=express[_0x633b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x633b('0x5'));var interaction=require(_0x633b('0x6'));var config=require(_0x633b('0x7'));var controller=require(_0x633b('0x8'));router['get']('/',auth[_0x633b('0x9')](),controller[_0x633b('0xa')]);router[_0x633b('0xb')](_0x633b('0xc'),auth['isAuthenticated'](),controller[_0x633b('0xd')]);router[_0x633b('0xb')](_0x633b('0xe'),auth[_0x633b('0x9')](),controller[_0x633b('0xf')]);router[_0x633b('0x10')]('/',auth[_0x633b('0x9')](),controller[_0x633b('0x11')]);router['put'](_0x633b('0xe'),auth[_0x633b('0x9')](),controller['update']);router[_0x633b('0x12')]('/:id',auth[_0x633b('0x9')](),controller[_0x633b('0x13')]);module[_0x633b('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 62ca105..e07f65c 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 _0x5162=['attended','STRING','ENUM','Yes','sequelize','exports','blind'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x5162,0x90));var _0x2516=function(_0xd948e7,_0x2f9dd1){_0xd948e7=_0xd948e7-0x0;var _0x323d00=_0x5162[_0xd948e7];return _0x323d00;};'use strict';var Sequelize=require(_0x2516('0x0'));var moment=require('moment');module[_0x2516('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2516('0x2'),_0x2516('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x2516('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x2516('0x4')]},'transferercalleridname':{'type':Sequelize[_0x2516('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x2516('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x2516('0x4')]},'transferercontext':{'type':Sequelize[_0x2516('0x4')]},'transfererexten':{'type':Sequelize[_0x2516('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x2516('0x4')]},'transfereechannel':{'type':Sequelize[_0x2516('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x2516('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x2516('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2516('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2516('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x2516('0x4')]},'transfereecontext':{'type':Sequelize[_0x2516('0x4')]},'transfereeexten':{'type':Sequelize[_0x2516('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x2516('0x4')]},'isexternal':{'type':Sequelize[_0x2516('0x5')](_0x2516('0x6'),'No')},'context':{'type':Sequelize[_0x2516('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x00b9=['attended','STRING','Yes','sequelize','exports','ENUM','blind'];(function(_0x3eb1c1,_0x1bb418){var _0x53645a=function(_0x5824b8){while(--_0x5824b8){_0x3eb1c1['push'](_0x3eb1c1['shift']());}};_0x53645a(++_0x1bb418);}(_0x00b9,0x1ca));var _0x900b=function(_0x102fdd,_0x1c412){_0x102fdd=_0x102fdd-0x0;var _0x309f0c=_0x00b9[_0x102fdd];return _0x309f0c;};'use strict';var Sequelize=require(_0x900b('0x0'));var moment=require('moment');module[_0x900b('0x1')]={'type':{'type':Sequelize[_0x900b('0x2')](_0x900b('0x3'),_0x900b('0x4'))},'result':{'type':Sequelize[_0x900b('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x900b('0x5')]},'transferercalleridname':{'type':Sequelize[_0x900b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x900b('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x900b('0x5')]},'transferercontext':{'type':Sequelize[_0x900b('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x900b('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x900b('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x900b('0x5')]},'transfereeexten':{'type':Sequelize[_0x900b('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x900b('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9ef6ffb..b60245d 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 _0xa880=['fields','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes'];(function(_0x34e602,_0x6f5cb){var _0x3c5eae=function(_0x1f43a7){while(--_0x1f43a7){_0x34e602['push'](_0x34e602['shift']());}};_0x3c5eae(++_0x6f5cb);}(_0xa880,0xb4));var _0x0a88=function(_0x50f9ab,_0x5009b4){_0x50f9ab=_0x50f9ab-0x0;var _0x58dda4=_0xa880[_0x50f9ab];return _0x58dda4;};'use strict';var emlformat=require(_0x0a88('0x0'));var rimraf=require(_0x0a88('0x1'));var zipdir=require(_0x0a88('0x2'));var jsonpatch=require(_0x0a88('0x3'));var rp=require('request-promise');var moment=require(_0x0a88('0x4'));var BPromise=require(_0x0a88('0x5'));var Mustache=require(_0x0a88('0x6'));var util=require(_0x0a88('0x7'));var path=require(_0x0a88('0x8'));var sox=require(_0x0a88('0x9'));var csv=require(_0x0a88('0xa'));var ejs=require(_0x0a88('0xb'));var fs=require('fs');var fs_extra=require(_0x0a88('0xc'));var _=require(_0x0a88('0xd'));var squel=require(_0x0a88('0xe'));var crypto=require('crypto');var jsforce=require(_0x0a88('0xf'));var deskjs=require(_0x0a88('0x10'));var toCsv=require(_0x0a88('0xa'));var querystring=require(_0x0a88('0x11'));var Papa=require(_0x0a88('0x12'));var Redis=require(_0x0a88('0x13'));var authService=require(_0x0a88('0x14'));var qs=require(_0x0a88('0x15'));var as=require(_0x0a88('0x16'));var hardwareService=require(_0x0a88('0x17'));var logger=require(_0x0a88('0x18'))(_0x0a88('0x19'));var utils=require(_0x0a88('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x0a88('0x1b'));var db=require(_0x0a88('0x1c'))['db'];function respondWithStatusCode(_0x59c0be,_0x268106){_0x268106=_0x268106||0xcc;return function(_0x139213){if(_0x139213){return _0x59c0be[_0x0a88('0x1d')](_0x268106);}return _0x59c0be[_0x0a88('0x1e')](_0x268106)[_0x0a88('0x1f')]();};}function respondWithResult(_0x51ccd3,_0x2d67d3){_0x2d67d3=_0x2d67d3||0xc8;return function(_0x30a193){if(_0x30a193){return _0x51ccd3[_0x0a88('0x1e')](_0x2d67d3)[_0x0a88('0x20')](_0x30a193);}};}function respondWithFilteredResult(_0x2e3781,_0x1cf3b1){return function(_0x35106c){if(_0x35106c){var _0xf8ea1a=typeof _0x1cf3b1[_0x0a88('0x21')]===_0x0a88('0x22')&&typeof _0x1cf3b1['limit']==='undefined';var _0x21fab7=_0x35106c[_0x0a88('0x23')];var _0x168cb2=_0xf8ea1a?0x0:_0x1cf3b1[_0x0a88('0x21')];var _0x22da6f=_0xf8ea1a?_0x35106c[_0x0a88('0x23')]:_0x1cf3b1[_0x0a88('0x21')]+_0x1cf3b1['limit'];var _0x3f112c;if(_0x22da6f>=_0x21fab7){_0x22da6f=_0x21fab7;_0x3f112c=0xc8;}else{_0x3f112c=0xce;}_0x2e3781['status'](_0x3f112c);return _0x2e3781[_0x0a88('0x24')]('Content-Range',_0x168cb2+'-'+_0x22da6f+'/'+_0x21fab7)[_0x0a88('0x20')](_0x35106c);}return null;};}function patchUpdates(_0x24e759){return function(_0x4f66f4){try{jsonpatch[_0x0a88('0x25')](_0x4f66f4,_0x24e759,!![]);}catch(_0x5f46dc){return BPromise[_0x0a88('0x26')](_0x5f46dc);}return _0x4f66f4[_0x0a88('0x27')]();};}function saveUpdates(_0x527e13,_0x570129){return function(_0x5badc5){if(_0x5badc5){return _0x5badc5[_0x0a88('0x28')](_0x527e13)['then'](function(_0x225c62){return _0x225c62;});}return null;};}function removeEntity(_0x3d5cf6,_0x40de16){return function(_0x4c4ba6){if(_0x4c4ba6){return _0x4c4ba6[_0x0a88('0x29')]()[_0x0a88('0x2a')](function(){_0x3d5cf6[_0x0a88('0x1e')](0xcc)[_0x0a88('0x1f')]();});}};}function handleEntityNotFound(_0x383e28,_0x3f1fc1){return function(_0x3dd56e){if(!_0x3dd56e){_0x383e28[_0x0a88('0x1d')](0x194);}return _0x3dd56e;};}function handleError(_0x382203,_0x39051a){_0x39051a=_0x39051a||0x1f4;return function(_0x2cb029){logger[_0x0a88('0x2b')](_0x2cb029[_0x0a88('0x2c')]);if(_0x2cb029[_0x0a88('0x2d')]){delete _0x2cb029[_0x0a88('0x2d')];}_0x382203[_0x0a88('0x1e')](_0x39051a)['send'](_0x2cb029);};}exports[_0x0a88('0x2e')]=function(_0x157f99,_0x2a34dd){var _0x146f62={},_0x1eff6f={},_0x45044a={'count':0x0,'rows':[]};var _0x352628=_[_0x0a88('0x2f')](db[_0x0a88('0x30')][_0x0a88('0x31')],function(_0x37a510){return{'name':_0x37a510[_0x0a88('0x32')],'type':_0x37a510[_0x0a88('0x33')]['key']};});_0x1eff6f[_0x0a88('0x34')]=_[_0x0a88('0x2f')](_0x352628,'name');_0x1eff6f[_0x0a88('0x35')]=_[_0x0a88('0x36')](_0x157f99['query']);_0x1eff6f['filters']=_[_0x0a88('0x37')](_0x1eff6f['model'],_0x1eff6f['query']);_0x146f62[_0x0a88('0x38')]=_[_0x0a88('0x37')](_0x1eff6f[_0x0a88('0x34')],qs[_0x0a88('0x39')](_0x157f99['query']['fields']));_0x146f62[_0x0a88('0x38')]=_0x146f62[_0x0a88('0x38')]['length']?_0x146f62[_0x0a88('0x38')]:_0x1eff6f['model'];if(!_0x157f99[_0x0a88('0x35')]['hasOwnProperty'](_0x0a88('0x3a'))){_0x146f62['limit']=qs[_0x0a88('0x3b')](_0x157f99[_0x0a88('0x35')][_0x0a88('0x3b')]);_0x146f62[_0x0a88('0x21')]=qs[_0x0a88('0x21')](_0x157f99[_0x0a88('0x35')]['offset']);}_0x146f62[_0x0a88('0x3c')]=qs[_0x0a88('0x3d')](_0x157f99[_0x0a88('0x35')][_0x0a88('0x3d')]);_0x146f62[_0x0a88('0x3e')]=qs[_0x0a88('0x3f')](_[_0x0a88('0x40')](_0x157f99[_0x0a88('0x35')],_0x1eff6f['filters']),_0x352628);if(_0x157f99[_0x0a88('0x35')][_0x0a88('0x41')]){_0x146f62[_0x0a88('0x3e')]=_['merge'](_0x146f62[_0x0a88('0x3e')],{'$or':_[_0x0a88('0x2f')](_0x352628,function(_0x5c433d){if(_0x5c433d['type']!==_0x0a88('0x42')){var _0x54b963={};_0x54b963[_0x5c433d['name']]={'$like':'%'+_0x157f99['query'][_0x0a88('0x41')]+'%'};return _0x54b963;}})});}_0x146f62=_[_0x0a88('0x43')]({},_0x146f62,_0x157f99[_0x0a88('0x44')]);var _0x569152={'where':_0x146f62[_0x0a88('0x3e')]};return db[_0x0a88('0x30')][_0x0a88('0x23')](_0x569152)[_0x0a88('0x2a')](function(_0x31e472){_0x45044a[_0x0a88('0x23')]=_0x31e472;if(_0x157f99[_0x0a88('0x35')][_0x0a88('0x45')]){_0x146f62[_0x0a88('0x46')]=[{'all':!![]}];}return db[_0x0a88('0x30')]['findAll'](_0x146f62);})[_0x0a88('0x2a')](function(_0x2f2b22){_0x45044a['rows']=_0x2f2b22;return _0x45044a;})[_0x0a88('0x2a')](respondWithFilteredResult(_0x2a34dd,_0x146f62))[_0x0a88('0x47')](handleError(_0x2a34dd,null));};exports[_0x0a88('0x48')]=function(_0x9f7f6,_0x23e64a){var _0x3e51be={'raw':!![],'where':{'id':_0x9f7f6[_0x0a88('0x49')]['id']}},_0x48b3d3={};_0x48b3d3[_0x0a88('0x34')]=_[_0x0a88('0x36')](db['VoiceTransferReport'][_0x0a88('0x31')]);_0x48b3d3[_0x0a88('0x35')]=_[_0x0a88('0x36')](_0x9f7f6['query']);_0x48b3d3['filters']=_[_0x0a88('0x37')](_0x48b3d3[_0x0a88('0x34')],_0x48b3d3['query']);_0x3e51be[_0x0a88('0x38')]=_['intersection'](_0x48b3d3['model'],qs['fields'](_0x9f7f6[_0x0a88('0x35')][_0x0a88('0x39')]));_0x3e51be[_0x0a88('0x38')]=_0x3e51be[_0x0a88('0x38')][_0x0a88('0x4a')]?_0x3e51be['attributes']:_0x48b3d3[_0x0a88('0x34')];if(_0x9f7f6[_0x0a88('0x35')][_0x0a88('0x45')]){_0x3e51be['include']=[{'all':!![]}];}_0x3e51be=_['merge']({},_0x3e51be,_0x9f7f6[_0x0a88('0x44')]);return db[_0x0a88('0x30')][_0x0a88('0x4b')](_0x3e51be)[_0x0a88('0x2a')](handleEntityNotFound(_0x23e64a,null))['then'](respondWithResult(_0x23e64a,null))[_0x0a88('0x47')](handleError(_0x23e64a,null));};exports[_0x0a88('0x4c')]=function(_0x4db128,_0x3328d6){return db[_0x0a88('0x30')][_0x0a88('0x4c')](_0x4db128[_0x0a88('0x4d')],{})[_0x0a88('0x2a')](respondWithResult(_0x3328d6,0xc9))[_0x0a88('0x47')](handleError(_0x3328d6,null));};exports[_0x0a88('0x28')]=function(_0xb6cb96,_0x5f36e1){if(_0xb6cb96['body']['id']){delete _0xb6cb96[_0x0a88('0x4d')]['id'];}return db[_0x0a88('0x30')][_0x0a88('0x4b')]({'where':{'id':_0xb6cb96[_0x0a88('0x49')]['id']}})[_0x0a88('0x2a')](handleEntityNotFound(_0x5f36e1,null))['then'](saveUpdates(_0xb6cb96[_0x0a88('0x4d')],null))[_0x0a88('0x2a')](respondWithResult(_0x5f36e1,null))['catch'](handleError(_0x5f36e1,null));};exports[_0x0a88('0x29')]=function(_0x4c662f,_0xfe2d5c){return db['VoiceTransferReport'][_0x0a88('0x4b')]({'where':{'id':_0x4c662f[_0x0a88('0x49')]['id']}})[_0x0a88('0x2a')](handleEntityNotFound(_0xfe2d5c,null))[_0x0a88('0x2a')](removeEntity(_0xfe2d5c,null))['catch'](handleError(_0xfe2d5c,null));};exports[_0x0a88('0x4e')]=function(_0x15dd35,_0x508da8){return db['VoiceTransferReport'][_0x0a88('0x4e')]()[_0x0a88('0x2a')](respondWithResult(_0x508da8,null))['catch'](handleError(_0x508da8,null));}; \ No newline at end of file +var _0x647f=['reject','save','update','destroy','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply'];(function(_0x4a8c1d,_0x4c717a){var _0x95d97d=function(_0x39f596){while(--_0x39f596){_0x4a8c1d['push'](_0x4a8c1d['shift']());}};_0x95d97d(++_0x4c717a);}(_0x647f,0xbf));var _0xf647=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x647f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf647('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf647('0x1'));var rp=require(_0xf647('0x2'));var moment=require(_0xf647('0x3'));var BPromise=require(_0xf647('0x4'));var Mustache=require('mustache');var util=require(_0xf647('0x5'));var path=require(_0xf647('0x6'));var sox=require(_0xf647('0x7'));var csv=require(_0xf647('0x8'));var ejs=require(_0xf647('0x9'));var fs=require('fs');var fs_extra=require(_0xf647('0xa'));var _=require(_0xf647('0xb'));var squel=require(_0xf647('0xc'));var crypto=require(_0xf647('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf647('0xe'));var toCsv=require(_0xf647('0x8'));var querystring=require('querystring');var Papa=require(_0xf647('0xf'));var Redis=require(_0xf647('0x10'));var authService=require(_0xf647('0x11'));var qs=require(_0xf647('0x12'));var as=require(_0xf647('0x13'));var hardwareService=require(_0xf647('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf647('0x15'));var config=require(_0xf647('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf647('0x17'))['db'];function respondWithStatusCode(_0x684d06,_0xb8f11c){_0xb8f11c=_0xb8f11c||0xcc;return function(_0x3b2e0e){if(_0x3b2e0e){return _0x684d06[_0xf647('0x18')](_0xb8f11c);}return _0x684d06[_0xf647('0x19')](_0xb8f11c)['end']();};}function respondWithResult(_0x3e7532,_0x36a4a3){_0x36a4a3=_0x36a4a3||0xc8;return function(_0x4a513c){if(_0x4a513c){return _0x3e7532[_0xf647('0x19')](_0x36a4a3)['json'](_0x4a513c);}};}function respondWithFilteredResult(_0x250829,_0x59fa7d){return function(_0x43973f){if(_0x43973f){var _0x285627=typeof _0x59fa7d['offset']===_0xf647('0x1a')&&typeof _0x59fa7d[_0xf647('0x1b')]===_0xf647('0x1a');var _0x1c4a89=_0x43973f[_0xf647('0x1c')];var _0x2ea07f=_0x285627?0x0:_0x59fa7d[_0xf647('0x1d')];var _0x194b4a=_0x285627?_0x43973f[_0xf647('0x1c')]:_0x59fa7d[_0xf647('0x1d')]+_0x59fa7d['limit'];var _0x8e5ed3;if(_0x194b4a>=_0x1c4a89){_0x194b4a=_0x1c4a89;_0x8e5ed3=0xc8;}else{_0x8e5ed3=0xce;}_0x250829['status'](_0x8e5ed3);return _0x250829[_0xf647('0x1e')](_0xf647('0x1f'),_0x2ea07f+'-'+_0x194b4a+'/'+_0x1c4a89)[_0xf647('0x20')](_0x43973f);}return null;};}function patchUpdates(_0x1ee344){return function(_0x1f1fa0){try{jsonpatch[_0xf647('0x21')](_0x1f1fa0,_0x1ee344,!![]);}catch(_0x4f7d18){return BPromise[_0xf647('0x22')](_0x4f7d18);}return _0x1f1fa0[_0xf647('0x23')]();};}function saveUpdates(_0x2c1777,_0x59fa46){return function(_0x624f77){if(_0x624f77){return _0x624f77[_0xf647('0x24')](_0x2c1777)['then'](function(_0x1fd7dc){return _0x1fd7dc;});}return null;};}function removeEntity(_0x13fb7f,_0x32fed1){return function(_0x55cbda){if(_0x55cbda){return _0x55cbda[_0xf647('0x25')]()[_0xf647('0x26')](function(){_0x13fb7f[_0xf647('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa04f71,_0x197123){return function(_0x47e450){if(!_0x47e450){_0xa04f71[_0xf647('0x18')](0x194);}return _0x47e450;};}function handleError(_0xdf7168,_0xb34871){_0xb34871=_0xb34871||0x1f4;return function(_0x190056){logger[_0xf647('0x27')](_0x190056[_0xf647('0x28')]);if(_0x190056[_0xf647('0x29')]){delete _0x190056['name'];}_0xdf7168[_0xf647('0x19')](_0xb34871)['send'](_0x190056);};}exports[_0xf647('0x2a')]=function(_0x467173,_0xa21983){var _0x18f761={},_0x4b08cd={},_0x32e283={'count':0x0,'rows':[]};var _0x4c156e=_[_0xf647('0x2b')](db[_0xf647('0x2c')][_0xf647('0x2d')],function(_0x429b60){return{'name':_0x429b60[_0xf647('0x2e')],'type':_0x429b60[_0xf647('0x2f')][_0xf647('0x30')]};});_0x4b08cd['model']=_[_0xf647('0x2b')](_0x4c156e,'name');_0x4b08cd[_0xf647('0x31')]=_[_0xf647('0x32')](_0x467173[_0xf647('0x31')]);_0x4b08cd[_0xf647('0x33')]=_[_0xf647('0x34')](_0x4b08cd[_0xf647('0x35')],_0x4b08cd[_0xf647('0x31')]);_0x18f761[_0xf647('0x36')]=_[_0xf647('0x34')](_0x4b08cd[_0xf647('0x35')],qs[_0xf647('0x37')](_0x467173['query']['fields']));_0x18f761[_0xf647('0x36')]=_0x18f761[_0xf647('0x36')][_0xf647('0x38')]?_0x18f761[_0xf647('0x36')]:_0x4b08cd[_0xf647('0x35')];if(!_0x467173[_0xf647('0x31')]['hasOwnProperty'](_0xf647('0x39'))){_0x18f761[_0xf647('0x1b')]=qs[_0xf647('0x1b')](_0x467173['query']['limit']);_0x18f761[_0xf647('0x1d')]=qs[_0xf647('0x1d')](_0x467173['query'][_0xf647('0x1d')]);}_0x18f761[_0xf647('0x3a')]=qs[_0xf647('0x3b')](_0x467173[_0xf647('0x31')][_0xf647('0x3b')]);_0x18f761[_0xf647('0x3c')]=qs[_0xf647('0x33')](_[_0xf647('0x3d')](_0x467173[_0xf647('0x31')],_0x4b08cd[_0xf647('0x33')]),_0x4c156e);if(_0x467173[_0xf647('0x31')][_0xf647('0x3e')]){_0x18f761[_0xf647('0x3c')]=_[_0xf647('0x3f')](_0x18f761['where'],{'$or':_[_0xf647('0x2b')](_0x4c156e,function(_0x219b07){if(_0x219b07[_0xf647('0x2f')]!==_0xf647('0x40')){var _0x3cb238={};_0x3cb238[_0x219b07[_0xf647('0x29')]]={'$like':'%'+_0x467173[_0xf647('0x31')]['filter']+'%'};return _0x3cb238;}})});}_0x18f761=_[_0xf647('0x3f')]({},_0x18f761,_0x467173[_0xf647('0x41')]);var _0x3dd640={'where':_0x18f761['where']};return db[_0xf647('0x2c')]['count'](_0x3dd640)[_0xf647('0x26')](function(_0xfabce8){_0x32e283['count']=_0xfabce8;if(_0x467173[_0xf647('0x31')][_0xf647('0x42')]){_0x18f761[_0xf647('0x43')]=[{'all':!![]}];}return db[_0xf647('0x2c')][_0xf647('0x44')](_0x18f761);})[_0xf647('0x26')](function(_0x381eb5){_0x32e283[_0xf647('0x45')]=_0x381eb5;return _0x32e283;})['then'](respondWithFilteredResult(_0xa21983,_0x18f761))[_0xf647('0x46')](handleError(_0xa21983,null));};exports['show']=function(_0x1f935b,_0x52f562){var _0x1159b7={'raw':!![],'where':{'id':_0x1f935b[_0xf647('0x47')]['id']}},_0x4f28f5={};_0x4f28f5['model']=_[_0xf647('0x32')](db[_0xf647('0x2c')][_0xf647('0x2d')]);_0x4f28f5[_0xf647('0x31')]=_[_0xf647('0x32')](_0x1f935b[_0xf647('0x31')]);_0x4f28f5['filters']=_[_0xf647('0x34')](_0x4f28f5[_0xf647('0x35')],_0x4f28f5[_0xf647('0x31')]);_0x1159b7[_0xf647('0x36')]=_['intersection'](_0x4f28f5[_0xf647('0x35')],qs[_0xf647('0x37')](_0x1f935b[_0xf647('0x31')][_0xf647('0x37')]));_0x1159b7[_0xf647('0x36')]=_0x1159b7[_0xf647('0x36')][_0xf647('0x38')]?_0x1159b7[_0xf647('0x36')]:_0x4f28f5['model'];if(_0x1f935b[_0xf647('0x31')][_0xf647('0x42')]){_0x1159b7[_0xf647('0x43')]=[{'all':!![]}];}_0x1159b7=_[_0xf647('0x3f')]({},_0x1159b7,_0x1f935b[_0xf647('0x41')]);return db[_0xf647('0x2c')][_0xf647('0x48')](_0x1159b7)['then'](handleEntityNotFound(_0x52f562,null))['then'](respondWithResult(_0x52f562,null))[_0xf647('0x46')](handleError(_0x52f562,null));};exports[_0xf647('0x49')]=function(_0x3cf8c5,_0xee65f5){return db['VoiceTransferReport'][_0xf647('0x49')](_0x3cf8c5['body'],{})[_0xf647('0x26')](respondWithResult(_0xee65f5,0xc9))[_0xf647('0x46')](handleError(_0xee65f5,null));};exports['update']=function(_0x521601,_0x4de279){if(_0x521601[_0xf647('0x4a')]['id']){delete _0x521601[_0xf647('0x4a')]['id'];}return db[_0xf647('0x2c')][_0xf647('0x48')]({'where':{'id':_0x521601['params']['id']}})[_0xf647('0x26')](handleEntityNotFound(_0x4de279,null))[_0xf647('0x26')](saveUpdates(_0x521601[_0xf647('0x4a')],null))[_0xf647('0x26')](respondWithResult(_0x4de279,null))[_0xf647('0x46')](handleError(_0x4de279,null));};exports['destroy']=function(_0x47e7d3,_0x39d066){return db[_0xf647('0x2c')][_0xf647('0x48')]({'where':{'id':_0x47e7d3[_0xf647('0x47')]['id']}})[_0xf647('0x26')](handleEntityNotFound(_0x39d066,null))[_0xf647('0x26')](removeEntity(_0x39d066,null))[_0xf647('0x46')](handleError(_0x39d066,null));};exports['describe']=function(_0x386c12,_0x1466b1){return db['VoiceTransferReport']['describe']()[_0xf647('0x26')](respondWithResult(_0x1466b1,null))['catch'](handleError(_0x1466b1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6e7bd05..c2dc92a 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 _0xf4f7=['report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x543ef3,_0x585b8a){var _0x5a1289=function(_0x3ba347){while(--_0x3ba347){_0x543ef3['push'](_0x543ef3['shift']());}};_0x5a1289(++_0x585b8a);}(_0xf4f7,0x194));var _0x7f4f=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0xf4f7[_0x430f44];return _0x1f6b0f;};'use strict';var _=require(_0x7f4f('0x0'));var util=require('util');var logger=require(_0x7f4f('0x1'))(_0x7f4f('0x2'));var moment=require(_0x7f4f('0x3'));var BPromise=require(_0x7f4f('0x4'));var rp=require(_0x7f4f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f4f('0x6'));var config=require(_0x7f4f('0x7'));var attributes=require(_0x7f4f('0x8'));module[_0x7f4f('0x9')]=function(_0x25ef34,_0x5da557){return _0x25ef34[_0x7f4f('0xa')](_0x7f4f('0xb'),attributes,{'tableName':_0x7f4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1385=['request-promise','path','rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5a6f32,_0x58b204){var _0x18c961=function(_0x2b7dc2){while(--_0x2b7dc2){_0x5a6f32['push'](_0x5a6f32['shift']());}};_0x18c961(++_0x58b204);}(_0x1385,0x174));var _0x5138=function(_0x1ea773,_0x133cc8){_0x1ea773=_0x1ea773-0x0;var _0x5b9e2f=_0x1385[_0x1ea773];return _0x5b9e2f;};'use strict';var _=require(_0x5138('0x0'));var util=require(_0x5138('0x1'));var logger=require(_0x5138('0x2'))(_0x5138('0x3'));var moment=require(_0x5138('0x4'));var BPromise=require(_0x5138('0x5'));var rp=require(_0x5138('0x6'));var fs=require('fs');var path=require(_0x5138('0x7'));var rimraf=require(_0x5138('0x8'));var config=require(_0x5138('0x9'));var attributes=require('./voiceTransferReport.attributes');module[_0x5138('0xa')]=function(_0x50c22d,_0x2a707c){return _0x50c22d[_0x5138('0xb')](_0x5138('0xc'),attributes,{'tableName':_0x5138('0xd'),'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 1b30d63..3758fe6 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 _0x042a=['../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x042a,0xa8));var _0xa042=function(_0x1faa4d,_0x8898f8){_0x1faa4d=_0x1faa4d-0x0;var _0x3f8880=_0x042a[_0x1faa4d];return _0x3f8880;};'use strict';var _=require(_0xa042('0x0'));var util=require(_0xa042('0x1'));var moment=require(_0xa042('0x2'));var BPromise=require(_0xa042('0x3'));var rs=require(_0xa042('0x4'));var fs=require('fs');var Redis=require(_0xa042('0x5'));var db=require(_0xa042('0x6'))['db'];var utils=require(_0xa042('0x7'));var logger=require('../../config/logger')(_0xa042('0x8'));var config=require('../../config/environment');var jayson=require(_0xa042('0x9'));var client=jayson['client'][_0xa042('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f4107,_0x3fdf93,_0x2da2af){return new BPromise(function(_0x560435,_0xe3a40d){return client[_0xa042('0xb')](_0x2f4107,_0x2da2af)['then'](function(_0xf98065){logger[_0xa042('0xc')](_0xa042('0xd'),_0x3fdf93,_0xa042('0xe'));logger[_0xa042('0xf')](_0xa042('0x10'),_0x3fdf93,'request\x20sent',JSON[_0xa042('0x11')](_0xf98065));if(_0xf98065[_0xa042('0x12')]){if(_0xf98065[_0xa042('0x12')][_0xa042('0x13')]===0x1f4){logger['error'](_0xa042('0xd'),_0x3fdf93,_0xf98065[_0xa042('0x12')][_0xa042('0x14')]);return _0xe3a40d(_0xf98065[_0xa042('0x12')][_0xa042('0x14')]);}logger[_0xa042('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x3fdf93,_0xf98065[_0xa042('0x12')][_0xa042('0x14')]);return _0x560435(_0xf98065[_0xa042('0x12')][_0xa042('0x14')]);}else{logger[_0xa042('0xc')](_0xa042('0xd'),_0x3fdf93,'request\x20sent');_0x560435(_0xf98065['result']['message']);}})[_0xa042('0x15')](function(_0x2dc4f2){logger['error'](_0xa042('0xd'),_0x3fdf93,_0x2dc4f2);_0xe3a40d(_0x2dc4f2);});});}exports[_0xa042('0x16')]=function(_0x241636){var _0xa9dfd=this;return new Promise(function(_0x44126e,_0x4324ab){return db[_0xa042('0x17')][_0xa042('0x18')](_0x241636[_0xa042('0x19')],{'raw':_0x241636['options']?_0x241636[_0xa042('0x1a')][_0xa042('0x1b')]===undefined?!![]:![]:!![]})[_0xa042('0x1c')](function(_0x22d36f){logger['info']('CreateVoiceTransferReport',_0x241636);logger['debug'](_0xa042('0x16'),_0x241636,JSON[_0xa042('0x11')](_0x22d36f));_0x44126e(_0x22d36f);})['catch'](function(_0x13885b){logger[_0xa042('0x12')](_0xa042('0x16'),_0x13885b[_0xa042('0x14')],_0x241636);_0x4324ab(_0xa9dfd[_0xa042('0x12')](0x1f4,_0x13885b['message']));});});}; \ No newline at end of file +var _0xc48f=['catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x48a928,_0x430727){var _0x11c1e9=function(_0x338805){while(--_0x338805){_0x48a928['push'](_0x48a928['shift']());}};_0x11c1e9(++_0x430727);}(_0xc48f,0x19e));var _0xfc48=function(_0x12dafa,_0x51ce5){_0x12dafa=_0x12dafa-0x0;var _0x1f3784=_0xc48f[_0x12dafa];return _0x1f3784;};'use strict';var _=require(_0xfc48('0x0'));var util=require(_0xfc48('0x1'));var moment=require(_0xfc48('0x2'));var BPromise=require(_0xfc48('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc48('0x4'));var db=require(_0xfc48('0x5'))['db'];var utils=require(_0xfc48('0x6'));var logger=require(_0xfc48('0x7'))(_0xfc48('0x8'));var config=require(_0xfc48('0x9'));var jayson=require(_0xfc48('0xa'));var client=jayson[_0xfc48('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35849b,_0x1e10a9,_0x3deacc){return new BPromise(function(_0x1a968e,_0x3bc446){return client[_0xfc48('0xc')](_0x35849b,_0x3deacc)[_0xfc48('0xd')](function(_0xd7bbe0){logger['info'](_0xfc48('0xe'),_0x1e10a9,_0xfc48('0xf'));logger[_0xfc48('0x10')](_0xfc48('0x11'),_0x1e10a9,_0xfc48('0xf'),JSON['stringify'](_0xd7bbe0));if(_0xd7bbe0[_0xfc48('0x12')]){if(_0xd7bbe0['error']['code']===0x1f4){logger[_0xfc48('0x12')](_0xfc48('0xe'),_0x1e10a9,_0xd7bbe0[_0xfc48('0x12')][_0xfc48('0x13')]);return _0x3bc446(_0xd7bbe0[_0xfc48('0x12')][_0xfc48('0x13')]);}logger[_0xfc48('0x12')](_0xfc48('0xe'),_0x1e10a9,_0xd7bbe0[_0xfc48('0x12')][_0xfc48('0x13')]);return _0x1a968e(_0xd7bbe0[_0xfc48('0x12')][_0xfc48('0x13')]);}else{logger[_0xfc48('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e10a9,_0xfc48('0xf'));_0x1a968e(_0xd7bbe0['result'][_0xfc48('0x13')]);}})[_0xfc48('0x15')](function(_0x4f5e30){logger[_0xfc48('0x12')](_0xfc48('0xe'),_0x1e10a9,_0x4f5e30);_0x3bc446(_0x4f5e30);});});}exports[_0xfc48('0x16')]=function(_0x478bd2){var _0x251b3c=this;return new Promise(function(_0x1fe606,_0x168882){return db[_0xfc48('0x17')][_0xfc48('0x18')](_0x478bd2[_0xfc48('0x19')],{'raw':_0x478bd2['options']?_0x478bd2[_0xfc48('0x1a')][_0xfc48('0x1b')]===undefined?!![]:![]:!![]})[_0xfc48('0xd')](function(_0x340134){logger[_0xfc48('0x14')](_0xfc48('0x16'),_0x478bd2);logger[_0xfc48('0x10')]('CreateVoiceTransferReport',_0x478bd2,JSON[_0xfc48('0x1c')](_0x340134));_0x1fe606(_0x340134);})[_0xfc48('0x15')](function(_0x3cd57f){logger[_0xfc48('0x12')]('CreateVoiceTransferReport',_0x3cd57f[_0xfc48('0x13')],_0x478bd2);_0x168882(_0x251b3c[_0xfc48('0x12')](0x1f4,_0x3cd57f[_0xfc48('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9302971..3aa16b9 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 _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x70f8c2,_0x3b36e5){var _0x2850b3=function(_0x546e86){while(--_0x546e86){_0x70f8c2['push'](_0x70f8c2['shift']());}};_0x2850b3(++_0x3b36e5);}(_0xbec5,0xe5));var _0x5bec=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xbec5[_0x46698a];return _0x356db0;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file +var _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x208683,_0x26bbfa){var _0x21bc96=function(_0x5487a7){while(--_0x5487a7){_0x208683['push'](_0x208683['shift']());}};_0x21bc96(++_0x26bbfa);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3e2d0d,_0x129175){_0x3e2d0d=_0x3e2d0d-0x0;var _0x122897=_0xf4eb[_0x3e2d0d];return _0x122897;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c082a94..b99f25c 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 _0xb43b=['localhost','socket.io-emitter','redis','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','emit','handleError:','stack','name','send','status','request','error','code','result','catch','User','findOne','agent','VoiceChannels','all','then','filter','rows','sessionId','originate','info','originate\x20fired:','body','length','json','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','UserId','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','defaults'];(function(_0x503f89,_0x3b726e){var _0x44fb74=function(_0x4623b7){while(--_0x4623b7){_0x503f89['push'](_0x503f89['shift']());}};_0x44fb74(++_0x3b726e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x651c5a,_0x1bce12){_0x651c5a=_0x651c5a-0x0;var _0x510c91=_0xb43b[_0x651c5a];return _0x510c91;};'use strict';var path=require(_0xbb43('0x0'));var fs=require('fs');var _=require(_0xbb43('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xbb43('0x2'));var util=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xbb43('0x5')][_0xbb43('0x6')]({'port':0x232a});var logger=require(_0xbb43('0x7'))(_0xbb43('0x8'));var Redis=require('ioredis');config['redis']=_[_0xbb43('0x9')](config['redis'],{'host':_0xbb43('0xa'),'port':0x18eb});var io=require(_0xbb43('0xb'))(new Redis(config[_0xbb43('0xc')]));var Schema=require(_0xbb43('0xd'));var originateValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xbb43('0xf'),'required':[!![],_0xbb43('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xbb43('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':_0xbb43('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xbb43('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]}});function emit(_0x57bd1d,_0x526330,_0x202980){logger['info'](_0x57bd1d,_0x526330,JSON['stringify'](_0x202980));io['to'](_0x57bd1d)[_0xbb43('0x12')](_0x526330,_0x202980);}function handleError(_0x8242ab){return function(_0x2e3b43){console['log'](_0xbb43('0x13'),_0x2e3b43,_0x2e3b43 instanceof RangeError);logger['error'](_0x2e3b43[_0xbb43('0x14')]);if(_0x2e3b43 instanceof RangeError){if(_0x2e3b43[_0xbb43('0x15')]){delete _0x2e3b43['name'];}_0x8242ab['status'](0x194)[_0xbb43('0x16')](_0x2e3b43);}else{if(_0x2e3b43[_0xbb43('0x15')]){delete _0x2e3b43[_0xbb43('0x15')];}_0x8242ab[_0xbb43('0x17')](0x1f4)['send'](_0x2e3b43);}};}function checkError(){return function(_0x40a650){if(!_0x40a650){throw new RangeError('NotFound');}return _0x40a650;};}function respondWithRpcPromise(_0x3a257d,_0x4bfaca){return new BPromise(function(_0x2f5e31,_0x565256){var _0x3f323e=amiClient;return _0x3f323e[_0xbb43('0x18')](_0x3a257d,_0x4bfaca)['then'](function(_0x1d0768){if(_0x1d0768['error']){if(_0x1d0768[_0xbb43('0x19')][_0xbb43('0x1a')]===0x1f4){return _0x565256(_0x1d0768[_0xbb43('0x19')]['message']);}return _0x2f5e31(_0x1d0768['error']['message']);}else{_0x2f5e31(_0x1d0768[_0xbb43('0x1b')]);}})[_0xbb43('0x1c')](function(_0x5d8310){_0x565256(_0x5d8310);});});}function getAgent(_0x3b3083){return db[_0xbb43('0x1d')][_0xbb43('0x1e')]({'where':{'id':_0x3b3083,'role':_0xbb43('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x4b5342,_0x27fd7a){return new BPromise(function(_0x42800f,_0xa88db0){var _0x8b3205=respondWithRpcPromise(_0xbb43('0x20'));var _0x40b04b=getAgent(_0x4b5342);Promise[_0xbb43('0x21')]([_0x8b3205,_0x40b04b])[_0xbb43('0x22')](function(_0x539730){var _0x2ad6da=_0x539730[0x0];var _0x56fe33=_0x539730[0x1];var _0x31fbc8=_[_0xbb43('0x23')](_0x2ad6da[_0xbb43('0x24')],function(_0x1880cd){return _0x1880cd['UserId']==_0x56fe33['id']&&_0x1880cd[_0xbb43('0x25')]==_0x27fd7a;});if(_0x31fbc8['length']==0x1){_0x42800f(_0x56fe33);}else{_0xa88db0(new RangeError('sessionId\x20'+_0x27fd7a+'\x20not\x20found!'));}});});}exports[_0xbb43('0x26')]=function(_0x573a05,_0xa7e144){logger[_0xbb43('0x27')](_0xbb43('0x28'),_0x573a05['body']);var _0x205011=originateValidation[_0xbb43('0xd')](_0x573a05[_0xbb43('0x29')]);if(_0x205011[_0xbb43('0x2a')]>0x0){return _0xa7e144[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x205011);}var _0x3de482=_0x573a05[_0xbb43('0x29')]['userId'];var _0x2109aa=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2c')];var _0x244d66=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2d')];var _0x1eae09=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2e')];return getAgent(_0x3de482)[_0xbb43('0x22')](function(_0x21346a){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x21346a[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x21346a['name']),_0xbb43('0x32'),{'callNumber':_0x2109aa,'callerId':_0x244d66,'callbackUrl':_0x1eae09});return _0xa7e144[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x33')});})[_0xbb43('0x1c')](handleError(_0xa7e144));};exports[_0xbb43('0x34')]=function(_0x5374a2,_0x5f4601){logger['info'](_0xbb43('0x35'),_0x5374a2[_0xbb43('0x29')]);var _0x4a95c3=hangupValidation['validate'](_0x5374a2[_0xbb43('0x29')]);if(_0x4a95c3[_0xbb43('0x2a')]>0x0){return _0x5f4601[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x4a95c3);}var _0x3f9e7f=_0x5374a2['body'][_0xbb43('0x36')];var _0x526cb8=_0x5374a2[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x3f9e7f)[_0xbb43('0x22')](function(_0x531d96){logger[_0xbb43('0x27')]('entityFound:',_0x531d96[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x531d96[_0xbb43('0x15')]),'webbar:hangup',{'sessionId':_0x526cb8});return _0x5f4601[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x37')});})[_0xbb43('0x1c')](handleError(_0x5f4601));};exports['answer']=function(_0x3e0871,_0x136bd4){logger['info'](_0xbb43('0x38'),_0x3e0871['body']);var _0x42b965=answerValidation[_0xbb43('0xd')](_0x3e0871[_0xbb43('0x29')]);if(_0x42b965[_0xbb43('0x2a')]>0x0){return _0x136bd4[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x42b965);}var _0x4bf8ed=_0x3e0871[_0xbb43('0x29')]['userId'];var _0x307f1e=_0x3e0871[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x4bf8ed)[_0xbb43('0x22')](function(_0x4970fb){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x4970fb[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x4970fb[_0xbb43('0x15')]),_0xbb43('0x39'),{'sessionId':_0x307f1e});return _0x136bd4[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x3a')});})[_0xbb43('0x1c')](handleError(_0x136bd4));};exports['hold']=function(_0x1a66f0,_0x5d4c19){logger['info']('hold\x20fired:',_0x1a66f0['body']);var _0x1c3482=holdValidation['validate'](_0x1a66f0[_0xbb43('0x29')]);if(_0x1c3482['length']>0x0){return _0x5d4c19[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x1c3482);}var _0x1f3fb4=_0x1a66f0['body'][_0xbb43('0x36')];var _0x4d9f18=_0x1a66f0[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x1f3fb4)[_0xbb43('0x22')](function(_0x29840e){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x29840e[_0xbb43('0x15')]);emit(util['format'](_0xbb43('0x31'),_0x29840e[_0xbb43('0x15')]),_0xbb43('0x3b'),{'sessionId':_0x4d9f18});return _0x5d4c19[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x3c')});})[_0xbb43('0x1c')](handleError(_0x5d4c19));};exports[_0xbb43('0x3d')]=function(_0xb1883e,_0x4b7712){logger[_0xbb43('0x27')](_0xbb43('0x3e'),_0xb1883e[_0xbb43('0x29')]);var _0x4e1959=unholdValidation[_0xbb43('0xd')](_0xb1883e[_0xbb43('0x29')]);if(_0x4e1959[_0xbb43('0x2a')]>0x0){return _0x4b7712[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x4e1959);}var _0x59c805=_0xb1883e['body'][_0xbb43('0x36')];var _0x5c75ba=_0xb1883e[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x59c805)['then'](function(_0x29aea0){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x29aea0[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x29aea0[_0xbb43('0x15')]),'webbar:unhold',{'sessionId':_0x5c75ba});return _0x4b7712['status'](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x3f')});})[_0xbb43('0x1c')](handleError(_0x4b7712));};exports[_0xbb43('0x40')]=function(_0x129ee6,_0x5db053){logger['info'](_0xbb43('0x41'),_0x5db053[_0xbb43('0x29')]);var _0x3a84ad=callsValidation[_0xbb43('0xd')](_0x129ee6[_0xbb43('0x29')]);if(_0x3a84ad[_0xbb43('0x2a')]>0x0){return _0x5db053[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x3a84ad);}var _0x1a3f98=_0x129ee6['body'][_0xbb43('0x36')];var _0xb996d7=respondWithRpcPromise(_0xbb43('0x20'));var _0x3675d9=getAgent(_0x1a3f98);return Promise[_0xbb43('0x21')]([_0xb996d7,_0x3675d9])[_0xbb43('0x22')](function(_0x3f7262){var _0x3589fd=_0x3f7262[0x0];var _0x3e01e4=_0x3f7262[0x1];var _0x49a54e=_['filter'](_0x3589fd[_0xbb43('0x24')],function(_0x2b72ae){return _0x2b72ae[_0xbb43('0x42')]==_0x3e01e4['id'];});return _0x5db053[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'count':_0x49a54e[_0xbb43('0x2a')],'rows':_0x49a54e});})[_0xbb43('0x1c')](handleError(_0x5db053));};exports['conference']=function(_0x3bda63,_0x599eec){logger['info'](_0xbb43('0x43'),_0x3bda63[_0xbb43('0x29')]);var _0x3cccea=conferenceValidation[_0xbb43('0xd')](_0x3bda63[_0xbb43('0x29')]);if(_0x3cccea[_0xbb43('0x2a')]>0x0){return _0x599eec[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x3cccea);}var _0x51b076=_0x3bda63['body'][_0xbb43('0x36')];return getAgent(_0x51b076)[_0xbb43('0x22')](function(_0x137e75){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x137e75[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x137e75[_0xbb43('0x15')]),'webbar:conference');return _0x599eec[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x44')});})[_0xbb43('0x1c')](handleError(_0x599eec));};exports[_0xbb43('0x45')]=function(_0x33a4db,_0x5745eb){logger[_0xbb43('0x27')](_0xbb43('0x46'),_0x33a4db[_0xbb43('0x29')]);var _0x6d3bb1=transferValidation[_0xbb43('0xd')](_0x33a4db['body']);if(_0x6d3bb1[_0xbb43('0x2a')]>0x0){return _0x5745eb[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x6d3bb1);}var _0x231b11=_0x33a4db[_0xbb43('0x29')][_0xbb43('0x36')];var _0x2bd30e=_0x33a4db[_0xbb43('0x29')][_0xbb43('0x25')];var _0x3ab906=_0x33a4db['body'][_0xbb43('0x47')];return getAgent(_0x231b11)['then'](function(_0x2b9e5d){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x2b9e5d[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x2b9e5d['name']),_0xbb43('0x48'),{'sessionId':_0x2bd30e,'transferNumber':_0x3ab906});return _0x5745eb[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x49')});})[_0xbb43('0x1c')](handleError(_0x5745eb));}; \ No newline at end of file +var _0xadb8=['originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','length','webbar:hangup','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','callNumber\x20is\x20required','userId\x20is\x20required','string','number','sessionId\x20is\x20required','info','emit','handleError:','error','stack','name','status','send','request','then','message','result','catch','User','findOne','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','originate'];(function(_0x316cb9,_0xae8733){var _0x496599=function(_0x37f3bf){while(--_0x37f3bf){_0x316cb9['push'](_0x316cb9['shift']());}};_0x496599(++_0xae8733);}(_0xadb8,0x1d0));var _0x8adb=function(_0x1bf8f5,_0x28f62c){_0x1bf8f5=_0x1bf8f5-0x0;var _0x36a54e=_0xadb8[_0x1bf8f5];return _0x36a54e;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x8adb('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var jayson=require(_0x8adb('0x3'));var amiClient=jayson[_0x8adb('0x4')][_0x8adb('0x5')]({'port':0x232a});var logger=require(_0x8adb('0x6'))(_0x8adb('0x7'));var Redis=require('ioredis');config[_0x8adb('0x8')]=_[_0x8adb('0x9')](config[_0x8adb('0x8')],{'host':_0x8adb('0xa'),'port':0x18eb});var io=require(_0x8adb('0xb'))(new Redis(config[_0x8adb('0x8')]));var Schema=require(_0x8adb('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x8adb('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8adb('0xe')]},'sessionId':{'type':_0x8adb('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8adb('0x10'),'required':[!![],_0x8adb('0xe')]},'sessionId':{'type':_0x8adb('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8adb('0x10'),'required':[!![],_0x8adb('0xe')]},'sessionId':{'type':_0x8adb('0xf'),'required':[!![],_0x8adb('0x11')]},'transferNumber':{'type':_0x8adb('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8adb('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8adb('0xe')]},'sessionId':{'type':_0x8adb('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8adb('0x10'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x8adb('0x10'),'required':[!![],_0x8adb('0xe')]}});function emit(_0x1096fb,_0x3f1ca7,_0x224e6c){logger[_0x8adb('0x12')](_0x1096fb,_0x3f1ca7,JSON['stringify'](_0x224e6c));io['to'](_0x1096fb)[_0x8adb('0x13')](_0x3f1ca7,_0x224e6c);}function handleError(_0xe8cfa5){return function(_0x4ba298){console['log'](_0x8adb('0x14'),_0x4ba298,_0x4ba298 instanceof RangeError);logger[_0x8adb('0x15')](_0x4ba298[_0x8adb('0x16')]);if(_0x4ba298 instanceof RangeError){if(_0x4ba298[_0x8adb('0x17')]){delete _0x4ba298[_0x8adb('0x17')];}_0xe8cfa5[_0x8adb('0x18')](0x194)[_0x8adb('0x19')](_0x4ba298);}else{if(_0x4ba298[_0x8adb('0x17')]){delete _0x4ba298[_0x8adb('0x17')];}_0xe8cfa5[_0x8adb('0x18')](0x1f4)[_0x8adb('0x19')](_0x4ba298);}};}function checkError(){return function(_0x190171){if(!_0x190171){throw new RangeError('NotFound');}return _0x190171;};}function respondWithRpcPromise(_0x548317,_0x24b31d){return new BPromise(function(_0x3d37db,_0x4f33e7){var _0x37b0a4=amiClient;return _0x37b0a4[_0x8adb('0x1a')](_0x548317,_0x24b31d)[_0x8adb('0x1b')](function(_0x184c2a){if(_0x184c2a[_0x8adb('0x15')]){if(_0x184c2a[_0x8adb('0x15')]['code']===0x1f4){return _0x4f33e7(_0x184c2a[_0x8adb('0x15')][_0x8adb('0x1c')]);}return _0x3d37db(_0x184c2a[_0x8adb('0x15')]['message']);}else{_0x3d37db(_0x184c2a[_0x8adb('0x1d')]);}})[_0x8adb('0x1e')](function(_0x2892bb){_0x4f33e7(_0x2892bb);});});}function getAgent(_0xd49f8f){return db[_0x8adb('0x1f')][_0x8adb('0x20')]({'where':{'id':_0xd49f8f,'role':'agent'}})[_0x8adb('0x1b')](checkError());}function getAgentCheckSession(_0x16f724,_0x18f94e){return new BPromise(function(_0x44f242,_0x42c6cc){var _0x4aca77=respondWithRpcPromise(_0x8adb('0x21'));var _0x5c5a7b=getAgent(_0x16f724);Promise[_0x8adb('0x22')]([_0x4aca77,_0x5c5a7b])[_0x8adb('0x1b')](function(_0x3e0ccf){var _0x824eda=_0x3e0ccf[0x0];var _0x48fd77=_0x3e0ccf[0x1];var _0x3ed9e9=_['filter'](_0x824eda[_0x8adb('0x23')],function(_0x1ac23e){return _0x1ac23e[_0x8adb('0x24')]==_0x48fd77['id']&&_0x1ac23e[_0x8adb('0x25')]==_0x18f94e;});if(_0x3ed9e9['length']==0x1){_0x44f242(_0x48fd77);}else{_0x42c6cc(new RangeError(_0x8adb('0x26')+_0x18f94e+'\x20not\x20found!'));}});});}exports[_0x8adb('0x27')]=function(_0x5ac5d5,_0x1d4962){logger[_0x8adb('0x12')](_0x8adb('0x28'),_0x5ac5d5[_0x8adb('0x29')]);var _0x309236=originateValidation[_0x8adb('0xc')](_0x5ac5d5['body']);if(_0x309236['length']>0x0){return _0x1d4962[_0x8adb('0x18')](0x190)[_0x8adb('0x2a')](_0x309236);}var _0x429d5a=_0x5ac5d5[_0x8adb('0x29')][_0x8adb('0x2b')];var _0x259137=_0x5ac5d5[_0x8adb('0x29')][_0x8adb('0x2c')];var _0x20a7d6=_0x5ac5d5[_0x8adb('0x29')][_0x8adb('0x2d')];var _0x3c4f7c=_0x5ac5d5[_0x8adb('0x29')]['callbackUrl'];return getAgent(_0x429d5a)[_0x8adb('0x1b')](function(_0x420ae0){logger['info'](_0x8adb('0x2e'),_0x420ae0['name']);emit(util[_0x8adb('0x2f')](_0x8adb('0x30'),_0x420ae0[_0x8adb('0x17')]),_0x8adb('0x31'),{'callNumber':_0x259137,'callerId':_0x20a7d6,'callbackUrl':_0x3c4f7c});return _0x1d4962[_0x8adb('0x18')](0xc8)['json']({'error':![],'message':_0x8adb('0x32')});})['catch'](handleError(_0x1d4962));};exports[_0x8adb('0x33')]=function(_0x374ef3,_0x4a1693){logger[_0x8adb('0x12')]('hangup\x20fired:',_0x374ef3[_0x8adb('0x29')]);var _0x494afd=hangupValidation[_0x8adb('0xc')](_0x374ef3[_0x8adb('0x29')]);if(_0x494afd[_0x8adb('0x34')]>0x0){return _0x4a1693['status'](0x190)['json'](_0x494afd);}var _0x182c4b=_0x374ef3[_0x8adb('0x29')]['userId'];var _0x1f6481=_0x374ef3[_0x8adb('0x29')][_0x8adb('0x25')];return getAgent(_0x182c4b)[_0x8adb('0x1b')](function(_0x922b58){logger[_0x8adb('0x12')](_0x8adb('0x2e'),_0x922b58[_0x8adb('0x17')]);emit(util['format']('user:%s',_0x922b58[_0x8adb('0x17')]),_0x8adb('0x35'),{'sessionId':_0x1f6481});return _0x4a1693[_0x8adb('0x18')](0xc8)[_0x8adb('0x2a')]({'error':![],'message':'hangup\x20executed!'});})[_0x8adb('0x1e')](handleError(_0x4a1693));};exports['answer']=function(_0x26abec,_0x32b764){logger[_0x8adb('0x12')](_0x8adb('0x36'),_0x26abec['body']);var _0x4ef5a3=answerValidation[_0x8adb('0xc')](_0x26abec['body']);if(_0x4ef5a3[_0x8adb('0x34')]>0x0){return _0x32b764['status'](0x190)['json'](_0x4ef5a3);}var _0x18984a=_0x26abec[_0x8adb('0x29')]['userId'];var _0x3fb9e0=_0x26abec[_0x8adb('0x29')][_0x8adb('0x25')];return getAgent(_0x18984a)[_0x8adb('0x1b')](function(_0x1f3934){logger['info'](_0x8adb('0x2e'),_0x1f3934['name']);emit(util[_0x8adb('0x2f')](_0x8adb('0x30'),_0x1f3934['name']),'webbar:answer',{'sessionId':_0x3fb9e0});return _0x32b764[_0x8adb('0x18')](0xc8)['json']({'error':![],'message':_0x8adb('0x37')});})[_0x8adb('0x1e')](handleError(_0x32b764));};exports[_0x8adb('0x38')]=function(_0x222f06,_0x5181ed){logger[_0x8adb('0x12')](_0x8adb('0x39'),_0x222f06['body']);var _0x5ba7a5=holdValidation[_0x8adb('0xc')](_0x222f06[_0x8adb('0x29')]);if(_0x5ba7a5[_0x8adb('0x34')]>0x0){return _0x5181ed['status'](0x190)[_0x8adb('0x2a')](_0x5ba7a5);}var _0x18c04f=_0x222f06[_0x8adb('0x29')][_0x8adb('0x2b')];var _0x2f6031=_0x222f06[_0x8adb('0x29')][_0x8adb('0x25')];return getAgent(_0x18c04f)[_0x8adb('0x1b')](function(_0xc2861b){logger[_0x8adb('0x12')](_0x8adb('0x2e'),_0xc2861b[_0x8adb('0x17')]);emit(util['format'](_0x8adb('0x30'),_0xc2861b[_0x8adb('0x17')]),_0x8adb('0x3a'),{'sessionId':_0x2f6031});return _0x5181ed[_0x8adb('0x18')](0xc8)[_0x8adb('0x2a')]({'error':![],'message':_0x8adb('0x3b')});})[_0x8adb('0x1e')](handleError(_0x5181ed));};exports[_0x8adb('0x3c')]=function(_0x276af8,_0x2033aa){logger['info'](_0x8adb('0x3d'),_0x276af8[_0x8adb('0x29')]);var _0x42d299=unholdValidation[_0x8adb('0xc')](_0x276af8[_0x8adb('0x29')]);if(_0x42d299[_0x8adb('0x34')]>0x0){return _0x2033aa[_0x8adb('0x18')](0x190)[_0x8adb('0x2a')](_0x42d299);}var _0x59aeb2=_0x276af8[_0x8adb('0x29')][_0x8adb('0x2b')];var _0x33f519=_0x276af8[_0x8adb('0x29')]['sessionId'];return getAgent(_0x59aeb2)[_0x8adb('0x1b')](function(_0x2c4e7e){logger[_0x8adb('0x12')](_0x8adb('0x2e'),_0x2c4e7e['name']);emit(util[_0x8adb('0x2f')](_0x8adb('0x30'),_0x2c4e7e[_0x8adb('0x17')]),_0x8adb('0x3e'),{'sessionId':_0x33f519});return _0x2033aa[_0x8adb('0x18')](0xc8)[_0x8adb('0x2a')]({'error':![],'message':_0x8adb('0x3f')});})[_0x8adb('0x1e')](handleError(_0x2033aa));};exports[_0x8adb('0x40')]=function(_0x253758,_0x404ba5){logger[_0x8adb('0x12')]('calls\x20fired:',_0x404ba5[_0x8adb('0x29')]);var _0x492a60=callsValidation['validate'](_0x253758[_0x8adb('0x29')]);if(_0x492a60[_0x8adb('0x34')]>0x0){return _0x404ba5['status'](0x190)[_0x8adb('0x2a')](_0x492a60);}var _0x37bdb4=_0x253758[_0x8adb('0x29')][_0x8adb('0x2b')];var _0x545a47=respondWithRpcPromise(_0x8adb('0x21'));var _0x509eec=getAgent(_0x37bdb4);return Promise[_0x8adb('0x22')]([_0x545a47,_0x509eec])[_0x8adb('0x1b')](function(_0x13bc21){var _0x47a2a4=_0x13bc21[0x0];var _0x3142c3=_0x13bc21[0x1];var _0x50dc53=_[_0x8adb('0x41')](_0x47a2a4[_0x8adb('0x23')],function(_0x43271b){return _0x43271b['UserId']==_0x3142c3['id'];});return _0x404ba5[_0x8adb('0x18')](0xc8)[_0x8adb('0x2a')]({'count':_0x50dc53[_0x8adb('0x34')],'rows':_0x50dc53});})[_0x8adb('0x1e')](handleError(_0x404ba5));};exports['conference']=function(_0x1a001e,_0x2bf6c8){logger['info'](_0x8adb('0x42'),_0x1a001e[_0x8adb('0x29')]);var _0x43730e=conferenceValidation['validate'](_0x1a001e[_0x8adb('0x29')]);if(_0x43730e[_0x8adb('0x34')]>0x0){return _0x2bf6c8[_0x8adb('0x18')](0x190)[_0x8adb('0x2a')](_0x43730e);}var _0x4d46b6=_0x1a001e[_0x8adb('0x29')]['userId'];return getAgent(_0x4d46b6)['then'](function(_0x4b658e){logger[_0x8adb('0x12')](_0x8adb('0x2e'),_0x4b658e[_0x8adb('0x17')]);emit(util['format'](_0x8adb('0x30'),_0x4b658e['name']),_0x8adb('0x43'));return _0x2bf6c8[_0x8adb('0x18')](0xc8)[_0x8adb('0x2a')]({'error':![],'message':_0x8adb('0x44')});})[_0x8adb('0x1e')](handleError(_0x2bf6c8));};exports[_0x8adb('0x45')]=function(_0x414448,_0xa04f70){logger[_0x8adb('0x12')]('transfer\x20fired:',_0x414448[_0x8adb('0x29')]);var _0x85f9ae=transferValidation[_0x8adb('0xc')](_0x414448[_0x8adb('0x29')]);if(_0x85f9ae['length']>0x0){return _0xa04f70[_0x8adb('0x18')](0x190)['json'](_0x85f9ae);}var _0x247d1e=_0x414448[_0x8adb('0x29')][_0x8adb('0x2b')];var _0x4121b8=_0x414448['body'][_0x8adb('0x25')];var _0x14c13b=_0x414448['body']['transferNumber'];return getAgent(_0x247d1e)['then'](function(_0x366b92){logger[_0x8adb('0x12')](_0x8adb('0x2e'),_0x366b92['name']);emit(util['format'](_0x8adb('0x30'),_0x366b92[_0x8adb('0x17')]),_0x8adb('0x46'),{'sessionId':_0x4121b8,'transferNumber':_0x14c13b});return _0xa04f70['status'](0xc8)[_0x8adb('0x2a')]({'error':![],'message':_0x8adb('0x47')});})[_0x8adb('0x1e')](handleError(_0xa04f70));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b24640b..9f54b25 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 _0x7af6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','notify','/:id/send','put','update','destroy','delete','removeAgents','exports','multer','util','connect-timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7af6,0xcf));var _0x67af=function(_0x39a3f4,_0x111c40){_0x39a3f4=_0x39a3f4-0x0;var _0x345121=_0x7af6[_0x39a3f4];return _0x345121;};'use strict';var multer=require(_0x67af('0x0'));var util=require(_0x67af('0x1'));var path=require('path');var timeout=require(_0x67af('0x2'));var express=require(_0x67af('0x3'));var router=express[_0x67af('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x67af('0x5'));var interaction=require(_0x67af('0x6'));var config=require(_0x67af('0x7'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x67af('0x8')](),controller[_0x67af('0x9')]);router[_0x67af('0xa')](_0x67af('0xb'),auth[_0x67af('0x8')](),controller[_0x67af('0xc')]);router[_0x67af('0xa')](_0x67af('0xd'),auth[_0x67af('0x8')](),controller[_0x67af('0xe')]);router['get'](_0x67af('0xf'),auth[_0x67af('0x8')](),controller[_0x67af('0x10')]);router[_0x67af('0xa')]('/:id/canned_answers',auth[_0x67af('0x8')](),controller[_0x67af('0x11')]);router[_0x67af('0xa')](_0x67af('0x12'),auth[_0x67af('0x8')](),controller[_0x67af('0x13')]);router[_0x67af('0xa')](_0x67af('0x14'),auth[_0x67af('0x8')](),controller[_0x67af('0x15')]);router[_0x67af('0x16')]('/',auth['isAuthenticated'](),controller[_0x67af('0x17')]);router[_0x67af('0x16')]('/:id/dispositions',auth[_0x67af('0x8')](),controller[_0x67af('0x18')]);router[_0x67af('0x16')]('/:id/canned_answers',auth[_0x67af('0x8')](),controller[_0x67af('0x19')]);router['post'](_0x67af('0x12'),auth[_0x67af('0x8')](),controller['addAgents']);router[_0x67af('0x16')](_0x67af('0x14'),auth['isAuthenticated'](),controller[_0x67af('0x1a')]);router[_0x67af('0x16')]('/:id/notify',controller[_0x67af('0x1b')]);router['post'](_0x67af('0x1c'),auth[_0x67af('0x8')](),controller['send']);router[_0x67af('0x1d')](_0x67af('0xd'),auth[_0x67af('0x8')](),controller[_0x67af('0x1e')]);router['delete'](_0x67af('0xd'),auth[_0x67af('0x8')](),controller[_0x67af('0x1f')]);router[_0x67af('0x20')](_0x67af('0xf'),auth[_0x67af('0x8')](),controller['removeDispositions']);router[_0x67af('0x20')]('/:id/canned_answers',auth[_0x67af('0x8')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x67af('0x8')](),controller[_0x67af('0x21')]);module[_0x67af('0x22')]=router; \ No newline at end of file +var _0x6aaa=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','send','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x42f1e7,_0x3a1279){var _0x460d91=function(_0x3e9820){while(--_0x3e9820){_0x42f1e7['push'](_0x42f1e7['shift']());}};_0x460d91(++_0x3a1279);}(_0x6aaa,0x163));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa6aa('0x0'));var util=require(_0xa6aa('0x1'));var path=require(_0xa6aa('0x2'));var timeout=require(_0xa6aa('0x3'));var express=require(_0xa6aa('0x4'));var router=express[_0xa6aa('0x5')]();var fs_extra=require(_0xa6aa('0x6'));var auth=require(_0xa6aa('0x7'));var interaction=require(_0xa6aa('0x8'));var config=require(_0xa6aa('0x9'));var controller=require('./whatsappAccount.controller');router[_0xa6aa('0xa')]('/',auth[_0xa6aa('0xb')](),controller[_0xa6aa('0xc')]);router['get'](_0xa6aa('0xd'),auth[_0xa6aa('0xb')](),controller['describe']);router['get'](_0xa6aa('0xe'),auth[_0xa6aa('0xb')](),controller[_0xa6aa('0xf')]);router['get'](_0xa6aa('0x10'),auth[_0xa6aa('0xb')](),controller['getDispositions']);router[_0xa6aa('0xa')](_0xa6aa('0x11'),auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x12')]);router[_0xa6aa('0xa')](_0xa6aa('0x13'),auth[_0xa6aa('0xb')](),controller['getAgents']);router[_0xa6aa('0xa')]('/:id/applications',auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x14')]);router[_0xa6aa('0x15')]('/',auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x16')]);router['post'](_0xa6aa('0x10'),auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x17')]);router[_0xa6aa('0x15')](_0xa6aa('0x11'),auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x18')]);router[_0xa6aa('0x15')](_0xa6aa('0x13'),auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x19')]);router[_0xa6aa('0x15')](_0xa6aa('0x1a'),auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x1b')]);router[_0xa6aa('0x15')]('/:id/notify',controller[_0xa6aa('0x1c')]);router[_0xa6aa('0x15')](_0xa6aa('0x1d'),auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x1e')]);router['put'](_0xa6aa('0xe'),auth[_0xa6aa('0xb')](),controller[_0xa6aa('0x1f')]);router[_0xa6aa('0x20')](_0xa6aa('0xe'),auth['isAuthenticated'](),controller[_0xa6aa('0x21')]);router[_0xa6aa('0x20')](_0xa6aa('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xa6aa('0x20')](_0xa6aa('0x11'),auth[_0xa6aa('0xb')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xa6aa('0x22')]);module[_0xa6aa('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 300582f..b5d8877 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 _0x65a3=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x13042f,_0x2022c4){var _0x5de5a0=function(_0x565cf1){while(--_0x565cf1){_0x13042f['push'](_0x13042f['shift']());}};_0x5de5a0(++_0x2022c4);}(_0x65a3,0x8c));var _0x365a=function(_0x38270c,_0x557fe0){_0x38270c=_0x38270c-0x0;var _0x19ad30=_0x65a3[_0x38270c];return _0x19ad30;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x365a('0x0'));module[_0x365a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x365a('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x365a('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x365a('0x3')],'defaultValue':function(){return rs[_0x365a('0x4')]();}},'phone':{'type':Sequelize[_0x365a('0x3')]},'type':{'type':Sequelize['ENUM'](_0x365a('0x5'),_0x365a('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x365a('0x3')]},'authToken':{'type':Sequelize[_0x365a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x365a('0x7')],'defaultValue':function(){return _0x365a('0x8');}},'notificationSound':{'type':Sequelize[_0x365a('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x365a('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x365a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x365a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x365a('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x365a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x365a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x365a('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x365a('0x9')],'defaultValue':![],'comment':_0x365a('0xb'),'set':function(_0x4694cd){if(!_0x4694cd){this['setDataValue'](_0x365a('0xc'),null);}this[_0x365a('0xd')](_0x365a('0xe'),_0x4694cd);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd536=['generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd536,0x1ed));var _0x6d53=function(_0x3a8d99,_0x2e16a0){_0x3a8d99=_0x3a8d99-0x0;var _0x5aa05f=_0xd536[_0x3a8d99];return _0x5aa05f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6d53('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d53('0x1')],'unique':_0x6d53('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6d53('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x6d53('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x6d53('0x1')],'defaultValue':function(){return rs[_0x6d53('0x3')]();}},'phone':{'type':Sequelize[_0x6d53('0x1')]},'type':{'type':Sequelize[_0x6d53('0x4')](_0x6d53('0x5'),_0x6d53('0x6'))},'accountSid':{'type':Sequelize[_0x6d53('0x1')]},'baseUrl':{'type':Sequelize[_0x6d53('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6d53('0x7')],'defaultValue':function(){return _0x6d53('0x8');}},'notificationSound':{'type':Sequelize[_0x6d53('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6d53('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6d53('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6d53('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6d53('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6d53('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6d53('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d53('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6d53('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x6d53('0x9')],'defaultValue':![],'comment':_0x6d53('0xc'),'set':function(_0x4467ee){if(!_0x4467ee){this[_0x6d53('0xd')](_0x6d53('0xe'),null);}this[_0x6d53('0xd')](_0x6d53('0xf'),_0x4467ee);}},'description':{'type':Sequelize[_0x6d53('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 21ccd73..ee5050e 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 _0xbecf=['redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','status','end','json','offset','undefined','limit','count','apply','save','then','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','WhatsappAccount','includeAll','include','findAll','rows','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','WhatsappAccountId','Disposition','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','pick','removeAnswers','ids','addAgents','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','priority','stack','getApplications','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','messageId','notifications','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','UserId','unshift','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','entity\x20found','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','spread','Messages','dataValues','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0xbecf,0x15c));var _0xfbec=function(_0x434400,_0x16e10e){_0x434400=_0x434400-0x0;var _0x27dd55=_0xbecf[_0x434400];return _0x27dd55;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfbec('0x0'));var jsonpatch=require(_0xfbec('0x1'));var rp=require(_0xfbec('0x2'));var moment=require(_0xfbec('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfbec('0x4'));var util=require(_0xfbec('0x5'));var path=require(_0xfbec('0x6'));var sox=require(_0xfbec('0x7'));var csv=require(_0xfbec('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbec('0x9'));var _=require(_0xfbec('0xa'));var squel=require(_0xfbec('0xb'));var crypto=require(_0xfbec('0xc'));var jsforce=require(_0xfbec('0xd'));var deskjs=require(_0xfbec('0xe'));var toCsv=require(_0xfbec('0x8'));var querystring=require(_0xfbec('0xf'));var Papa=require(_0xfbec('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfbec('0x11'));var hardwareService=require(_0xfbec('0x12'));var logger=require(_0xfbec('0x13'))(_0xfbec('0x14'));var utils=require(_0xfbec('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfbec('0x16'));var db=require(_0xfbec('0x17'))['db'];config[_0xfbec('0x18')]=_[_0xfbec('0x19')](config['redis'],{'host':_0xfbec('0x1a'),'port':0x18eb});var socket=require(_0xfbec('0x1b'))(new Redis(config[_0xfbec('0x18')]));require(_0xfbec('0x1c'))['register'](socket);var jayson=require(_0xfbec('0x1d'));var client=jayson['client'][_0xfbec('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x536508,_0x2edf2c,_0x923681,_0x171721){return new BPromise(function(_0x4aa49e,_0xe91fb8){var _0x2a3329=_0x171721||client;return _0x2a3329[_0xfbec('0x1f')](_0x536508,_0x923681)['then'](function(_0x148453){logger[_0xfbec('0x20')](_0xfbec('0x21'),_0x2edf2c,_0xfbec('0x22'));logger[_0xfbec('0x23')](_0xfbec('0x24'),_0x2edf2c,_0xfbec('0x22'),JSON['stringify'](_0x148453));if(_0x148453['error']){if(_0x148453['error'][_0xfbec('0x25')]===0x1f4){logger[_0xfbec('0x26')](_0xfbec('0x21'),_0x2edf2c,_0x148453['error'][_0xfbec('0x27')]);return _0xe91fb8(_0x148453[_0xfbec('0x26')]['message']);}logger[_0xfbec('0x26')](_0xfbec('0x21'),_0x2edf2c,_0x148453['error'][_0xfbec('0x27')]);return _0x4aa49e(_0x148453[_0xfbec('0x26')][_0xfbec('0x27')]);}else{logger[_0xfbec('0x20')](_0xfbec('0x21'),_0x2edf2c,'request\x20sent');_0x4aa49e(_0x148453[_0xfbec('0x28')]['message']);}})[_0xfbec('0x29')](function(_0x1c9a07){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2edf2c,_0x1c9a07);_0xe91fb8(_0x1c9a07);});});}function respondWithStatusCode(_0x4d8a3f,_0x10f5d3){_0x10f5d3=_0x10f5d3||0xcc;return function(_0x421535){if(_0x421535){return _0x4d8a3f['sendStatus'](_0x10f5d3);}return _0x4d8a3f[_0xfbec('0x2a')](_0x10f5d3)[_0xfbec('0x2b')]();};}function respondWithResult(_0x1613de,_0x4ac842){_0x4ac842=_0x4ac842||0xc8;return function(_0x29126f){if(_0x29126f){return _0x1613de[_0xfbec('0x2a')](_0x4ac842)[_0xfbec('0x2c')](_0x29126f);}};}function respondWithFilteredResult(_0x14aa8a,_0xe7036f){return function(_0x5b359b){if(_0x5b359b){var _0x4aff99=typeof _0xe7036f[_0xfbec('0x2d')]===_0xfbec('0x2e')&&typeof _0xe7036f[_0xfbec('0x2f')]===_0xfbec('0x2e');var _0x202e3b=_0x5b359b[_0xfbec('0x30')];var _0x41b4cf=_0x4aff99?0x0:_0xe7036f['offset'];var _0xa0084a=_0x4aff99?_0x5b359b['count']:_0xe7036f['offset']+_0xe7036f['limit'];var _0x22a487;if(_0xa0084a>=_0x202e3b){_0xa0084a=_0x202e3b;_0x22a487=0xc8;}else{_0x22a487=0xce;}_0x14aa8a[_0xfbec('0x2a')](_0x22a487);return _0x14aa8a['set']('Content-Range',_0x41b4cf+'-'+_0xa0084a+'/'+_0x202e3b)[_0xfbec('0x2c')](_0x5b359b);}return null;};}function patchUpdates(_0xab9f46){return function(_0x242a4b){try{jsonpatch[_0xfbec('0x31')](_0x242a4b,_0xab9f46,!![]);}catch(_0x140569){return BPromise['reject'](_0x140569);}return _0x242a4b[_0xfbec('0x32')]();};}function saveUpdates(_0x2376ce,_0x5e8e01){return function(_0x2c1cbf){if(_0x2c1cbf){return _0x2c1cbf['update'](_0x2376ce)['then'](function(_0x301c3b){return _0x301c3b;});}return null;};}function removeEntity(_0x390494,_0x376f1b){return function(_0x143463){if(_0x143463){return _0x143463['destroy']()[_0xfbec('0x33')](function(){var _0x702f4a=_0x143463[_0xfbec('0x34')]({'plain':!![]});var _0x4996fb='WhatsappAccounts';return db[_0xfbec('0x35')]['destroy']({'where':{'type':_0x4996fb,'resourceId':_0x702f4a['id']}})[_0xfbec('0x33')](function(){return _0x143463;});})[_0xfbec('0x33')](function(){_0x390494[_0xfbec('0x2a')](0xcc)[_0xfbec('0x2b')]();});}};}function handleEntityNotFound(_0x68de54,_0x286a07){return function(_0x5c58fd){if(!_0x5c58fd){_0x68de54['sendStatus'](0x194);}return _0x5c58fd;};}function handleError(_0x387e55,_0x39e8ab){_0x39e8ab=_0x39e8ab||0x1f4;return function(_0x173064){logger[_0xfbec('0x26')](_0x173064['stack']);if(_0x173064[_0xfbec('0x36')]){delete _0x173064['name'];}_0x387e55['status'](_0x39e8ab)[_0xfbec('0x37')](_0x173064);};}exports[_0xfbec('0x38')]=function(_0x315722,_0x2b30e7){var _0x2c6182={'include':[{'model':db[_0xfbec('0x39')],'as':_0xfbec('0x3a')}]},_0x26b6d3={},_0x2eb1e1={'count':0x0,'rows':[]};var _0x40f769=_['map'](db['WhatsappAccount'][_0xfbec('0x3b')],function(_0x2d6d9c){return{'name':_0x2d6d9c[_0xfbec('0x3c')],'type':_0x2d6d9c[_0xfbec('0x3d')]['key']};});_0x26b6d3[_0xfbec('0x3e')]=_[_0xfbec('0x3f')](_0x40f769,_0xfbec('0x36'));_0x26b6d3[_0xfbec('0x40')]=_[_0xfbec('0x41')](_0x315722[_0xfbec('0x40')]);_0x26b6d3[_0xfbec('0x42')]=_['intersection'](_0x26b6d3[_0xfbec('0x3e')],_0x26b6d3[_0xfbec('0x40')]);_0x2c6182['attributes']=_[_0xfbec('0x43')](_0x26b6d3[_0xfbec('0x3e')],qs[_0xfbec('0x44')](_0x315722[_0xfbec('0x40')][_0xfbec('0x44')]));_0x2c6182[_0xfbec('0x45')]=_0x2c6182[_0xfbec('0x45')]['length']?_0x2c6182[_0xfbec('0x45')]:_0x26b6d3[_0xfbec('0x3e')];if(!_0x315722['query'][_0xfbec('0x46')]('nolimit')){_0x2c6182[_0xfbec('0x2f')]=qs['limit'](_0x315722[_0xfbec('0x40')][_0xfbec('0x2f')]);_0x2c6182[_0xfbec('0x2d')]=qs[_0xfbec('0x2d')](_0x315722[_0xfbec('0x40')][_0xfbec('0x2d')]);}_0x2c6182[_0xfbec('0x47')]=qs['sort'](_0x315722[_0xfbec('0x40')][_0xfbec('0x48')]);_0x2c6182[_0xfbec('0x49')]=qs[_0xfbec('0x42')](_['pick'](_0x315722[_0xfbec('0x40')],_0x26b6d3[_0xfbec('0x42')]),_0x40f769);if(_0x315722[_0xfbec('0x40')][_0xfbec('0x4a')]){_0x2c6182[_0xfbec('0x49')]=_[_0xfbec('0x4b')](_0x2c6182[_0xfbec('0x49')],{'$or':_['map'](_0x40f769,function(_0x12b1aa){if(_0x12b1aa[_0xfbec('0x3d')]!=='VIRTUAL'){var _0x17dffe={};_0x17dffe[_0x12b1aa[_0xfbec('0x36')]]={'$like':'%'+_0x315722[_0xfbec('0x40')][_0xfbec('0x4a')]+'%'};return _0x17dffe;}})});}_0x2c6182=_[_0xfbec('0x4b')]({},_0x2c6182,_0x315722['options']);var _0x227411={'where':_0x2c6182[_0xfbec('0x49')]};return db[_0xfbec('0x4c')][_0xfbec('0x30')](_0x227411)[_0xfbec('0x33')](function(_0x5c05a3){_0x2eb1e1[_0xfbec('0x30')]=_0x5c05a3;if(_0x315722[_0xfbec('0x40')][_0xfbec('0x4d')]){_0x2c6182[_0xfbec('0x4e')]=[{'all':!![]}];}return db[_0xfbec('0x4c')][_0xfbec('0x4f')](_0x2c6182);})[_0xfbec('0x33')](function(_0x2cc356){_0x2eb1e1[_0xfbec('0x50')]=_0x2cc356;return _0x2eb1e1;})[_0xfbec('0x33')](respondWithFilteredResult(_0x2b30e7,_0x2c6182))[_0xfbec('0x29')](handleError(_0x2b30e7,null));};exports['show']=function(_0x86c364,_0x30fe9b){var _0x264057={'raw':![],'where':{'id':_0x86c364[_0xfbec('0x51')]['id']},'include':[{'model':db[_0xfbec('0x39')],'as':_0xfbec('0x3a')}]},_0x2c5a9a={};_0x2c5a9a[_0xfbec('0x3e')]=_[_0xfbec('0x41')](db[_0xfbec('0x4c')][_0xfbec('0x3b')]);_0x2c5a9a[_0xfbec('0x40')]=_[_0xfbec('0x41')](_0x86c364['query']);_0x2c5a9a[_0xfbec('0x42')]=_[_0xfbec('0x43')](_0x2c5a9a[_0xfbec('0x3e')],_0x2c5a9a[_0xfbec('0x40')]);_0x264057[_0xfbec('0x45')]=_[_0xfbec('0x43')](_0x2c5a9a[_0xfbec('0x3e')],qs['fields'](_0x86c364['query'][_0xfbec('0x44')]));_0x264057[_0xfbec('0x45')]=_0x264057[_0xfbec('0x45')][_0xfbec('0x52')]?_0x264057[_0xfbec('0x45')]:_0x2c5a9a[_0xfbec('0x3e')];if(_0x86c364['query'][_0xfbec('0x4d')]){_0x264057[_0xfbec('0x4e')]=[{'all':!![]}];}_0x264057=_[_0xfbec('0x4b')]({},_0x264057,_0x86c364[_0xfbec('0x53')]);return db[_0xfbec('0x4c')][_0xfbec('0x54')](_0x264057)[_0xfbec('0x33')](handleEntityNotFound(_0x30fe9b,null))['then'](respondWithResult(_0x30fe9b,null))[_0xfbec('0x29')](handleError(_0x30fe9b,null));};exports[_0xfbec('0x55')]=function(_0x5c6f1d,_0x1f233b){return db[_0xfbec('0x4c')][_0xfbec('0x55')](_0x5c6f1d[_0xfbec('0x56')],{})[_0xfbec('0x33')](function(_0x4fbf88){var _0x2b8d99=_0x5c6f1d[_0xfbec('0x57')][_0xfbec('0x34')]({'plain':!![]});if(!_0x2b8d99)throw new Error(_0xfbec('0x58'));if(_0x2b8d99[_0xfbec('0x59')]===_0xfbec('0x57')){var _0x4d7345=_0x4fbf88['get']({'plain':!![]});var _0xa9a2bc=_0xfbec('0x5a');return db[_0xfbec('0x5b')][_0xfbec('0x54')]({'where':{'name':_0xa9a2bc,'userProfileId':_0x2b8d99[_0xfbec('0x5c')]},'raw':!![]})[_0xfbec('0x33')](function(_0x3c2b99){if(_0x3c2b99&&_0x3c2b99[_0xfbec('0x5d')]===0x0){return db['UserProfileResource'][_0xfbec('0x55')]({'name':_0x4d7345[_0xfbec('0x36')],'resourceId':_0x4d7345['id'],'type':_0x3c2b99[_0xfbec('0x36')],'sectionId':_0x3c2b99['id']},{})[_0xfbec('0x33')](function(){return _0x4fbf88;});}else{return _0x4fbf88;}})[_0xfbec('0x29')](function(_0x3d3fc1){logger['error'](_0xfbec('0x5e'),_0x3d3fc1);throw _0x3d3fc1;});}return _0x4fbf88;})['then'](respondWithResult(_0x1f233b,0xc9))[_0xfbec('0x29')](handleError(_0x1f233b,null));};exports['update']=function(_0x139660,_0x4f9f11){if(_0x139660['body']['id']){delete _0x139660[_0xfbec('0x56')]['id'];}return db[_0xfbec('0x4c')]['find']({'where':{'id':_0x139660[_0xfbec('0x51')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xfbec('0x33')](handleEntityNotFound(_0x4f9f11,null))[_0xfbec('0x33')](saveUpdates(_0x139660[_0xfbec('0x56')],null))['then'](respondWithResult(_0x4f9f11,null))[_0xfbec('0x29')](handleError(_0x4f9f11,null));};exports[_0xfbec('0x5f')]=function(_0x5fe3ba,_0x45d6c2){return db[_0xfbec('0x4c')][_0xfbec('0x54')]({'where':{'id':_0x5fe3ba['params']['id']}})[_0xfbec('0x33')](handleEntityNotFound(_0x45d6c2,null))[_0xfbec('0x33')](removeEntity(_0x45d6c2,null))[_0xfbec('0x29')](handleError(_0x45d6c2,null));};exports[_0xfbec('0x60')]=function(_0x576fc6,_0x53ca19){return db[_0xfbec('0x4c')][_0xfbec('0x60')]()[_0xfbec('0x33')](respondWithResult(_0x53ca19,null))[_0xfbec('0x29')](handleError(_0x53ca19,null));};exports[_0xfbec('0x61')]=function(_0x555120,_0x2654e1,_0x5cf775){if(_0x555120[_0xfbec('0x56')]['id']){delete _0x555120[_0xfbec('0x56')]['id'];}return db[_0xfbec('0x4c')]['find']({'where':{'id':_0x555120['params']['id']}})[_0xfbec('0x33')](handleEntityNotFound(_0x2654e1,null))['then'](function(_0x37bd34){if(_0x37bd34){_0x555120[_0xfbec('0x56')][_0xfbec('0x62')]=_0x37bd34['id'];return db[_0xfbec('0x63')]['create'](_0x555120[_0xfbec('0x56')]);}})[_0xfbec('0x33')](respondWithResult(_0x2654e1,null))[_0xfbec('0x29')](handleError(_0x2654e1,null));};exports['getDispositions']=function(_0x5dcd8a,_0x5e0c94,_0x2e3295){var _0x3df279={'raw':![],'where':{}};var _0x561b90={};var _0x3c925d={'count':0x0,'rows':[]};return db[_0xfbec('0x4c')]['findOne']({'where':{'id':_0x5dcd8a[_0xfbec('0x51')]['id']}})['then'](handleEntityNotFound(_0x5e0c94,null))[_0xfbec('0x33')](function(_0x3493af){if(_0x3493af){_0x561b90['model']=_[_0xfbec('0x41')](db[_0xfbec('0x63')]['rawAttributes']);_0x561b90['query']=_[_0xfbec('0x41')](_0x5dcd8a[_0xfbec('0x40')]);_0x561b90[_0xfbec('0x42')]=_[_0xfbec('0x43')](_0x561b90[_0xfbec('0x3e')],_0x561b90[_0xfbec('0x40')]);_0x3df279[_0xfbec('0x45')]=_['intersection'](_0x561b90[_0xfbec('0x3e')],qs[_0xfbec('0x44')](_0x5dcd8a[_0xfbec('0x40')][_0xfbec('0x44')]));_0x3df279['attributes']=_0x3df279[_0xfbec('0x45')][_0xfbec('0x52')]?_0x3df279[_0xfbec('0x45')]:_0x561b90[_0xfbec('0x3e')];if(!_0x5dcd8a[_0xfbec('0x40')][_0xfbec('0x46')](_0xfbec('0x64'))){_0x3df279[_0xfbec('0x2f')]=qs['limit'](_0x5dcd8a[_0xfbec('0x40')][_0xfbec('0x2f')]);_0x3df279['offset']=qs[_0xfbec('0x2d')](_0x5dcd8a[_0xfbec('0x40')][_0xfbec('0x2d')]);}_0x3df279[_0xfbec('0x47')]=qs[_0xfbec('0x48')](_0x5dcd8a[_0xfbec('0x40')]['sort']);_0x3df279['where']=qs[_0xfbec('0x42')](_['pick'](_0x5dcd8a['query'],_0x561b90['filters']));_0x3df279[_0xfbec('0x49')]['WhatsappAccountId']=_0x3493af['id'];if(_0x5dcd8a[_0xfbec('0x40')]['filter']){_0x3df279[_0xfbec('0x49')]=_['merge'](_0x3df279[_0xfbec('0x49')],{'$or':_[_0xfbec('0x3f')](_0x3df279[_0xfbec('0x45')],function(_0x24c1dd){var _0x344fed={};_0x344fed[_0x24c1dd]={'$like':'%'+_0x5dcd8a[_0xfbec('0x40')][_0xfbec('0x4a')]+'%'};return _0x344fed;})});}_0x3df279=_['merge']({},_0x3df279,_0x5dcd8a[_0xfbec('0x53')]);return db[_0xfbec('0x63')][_0xfbec('0x30')]({'where':_0x3df279['where']})[_0xfbec('0x33')](function(_0x4bc655){_0x3c925d[_0xfbec('0x30')]=_0x4bc655;if(_0x5dcd8a[_0xfbec('0x40')]['includeAll']){_0x3df279['include']=[{'all':!![]}];}return db[_0xfbec('0x63')][_0xfbec('0x4f')](_0x3df279);})[_0xfbec('0x33')](function(_0x2fb4a6){_0x3c925d['rows']=_0x2fb4a6;return _0x3c925d;});}})[_0xfbec('0x33')](respondWithFilteredResult(_0x5e0c94,_0x3df279))[_0xfbec('0x29')](handleError(_0x5e0c94,null));};exports[_0xfbec('0x65')]=function(_0x2b77a4,_0x272196,_0x553a93){return db[_0xfbec('0x4c')][_0xfbec('0x54')]({'where':{'id':_0x2b77a4[_0xfbec('0x51')]['id']}})[_0xfbec('0x33')](handleEntityNotFound(_0x272196,null))['then'](function(_0x4fa1e9){if(_0x4fa1e9){return _0x4fa1e9[_0xfbec('0x65')](_0x2b77a4[_0xfbec('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x272196,null))[_0xfbec('0x29')](handleError(_0x272196,null));};exports[_0xfbec('0x66')]=function(_0x598ab9,_0xfd4fdf,_0x35d032){if(_0x598ab9['body']['id']){delete _0x598ab9['body']['id'];}return db[_0xfbec('0x4c')]['find']({'where':{'id':_0x598ab9['params']['id']}})['then'](handleEntityNotFound(_0xfd4fdf,null))[_0xfbec('0x33')](function(_0x224751){if(_0x224751){_0x598ab9[_0xfbec('0x56')][_0xfbec('0x62')]=_0x224751['id'];return db[_0xfbec('0x67')][_0xfbec('0x55')](_0x598ab9['body']);}})[_0xfbec('0x33')](respondWithResult(_0xfd4fdf,null))[_0xfbec('0x29')](handleError(_0xfd4fdf,null));};exports[_0xfbec('0x68')]=function(_0x6acfb7,_0x56f05,_0x57424d){var _0x26da23={'raw':![],'where':{}};var _0x577d48={};var _0x2d00b8={'count':0x0,'rows':[]};return db[_0xfbec('0x4c')][_0xfbec('0x69')]({'where':{'id':_0x6acfb7[_0xfbec('0x51')]['id']}})[_0xfbec('0x33')](handleEntityNotFound(_0x56f05,null))['then'](function(_0x4bf568){if(_0x4bf568){_0x577d48[_0xfbec('0x3e')]=_[_0xfbec('0x41')](db[_0xfbec('0x67')][_0xfbec('0x3b')]);_0x577d48[_0xfbec('0x40')]=_[_0xfbec('0x41')](_0x6acfb7[_0xfbec('0x40')]);_0x577d48['filters']=_['intersection'](_0x577d48[_0xfbec('0x3e')],_0x577d48[_0xfbec('0x40')]);_0x26da23[_0xfbec('0x45')]=_['intersection'](_0x577d48[_0xfbec('0x3e')],qs[_0xfbec('0x44')](_0x6acfb7[_0xfbec('0x40')][_0xfbec('0x44')]));_0x26da23[_0xfbec('0x45')]=_0x26da23[_0xfbec('0x45')][_0xfbec('0x52')]?_0x26da23[_0xfbec('0x45')]:_0x577d48[_0xfbec('0x3e')];if(!_0x6acfb7[_0xfbec('0x40')]['hasOwnProperty']('nolimit')){_0x26da23['limit']=qs[_0xfbec('0x2f')](_0x6acfb7['query'][_0xfbec('0x2f')]);_0x26da23[_0xfbec('0x2d')]=qs['offset'](_0x6acfb7[_0xfbec('0x40')]['offset']);}_0x26da23['order']=qs[_0xfbec('0x48')](_0x6acfb7[_0xfbec('0x40')][_0xfbec('0x48')]);_0x26da23['where']=qs[_0xfbec('0x42')](_[_0xfbec('0x6a')](_0x6acfb7[_0xfbec('0x40')],_0x577d48[_0xfbec('0x42')]));_0x26da23['where'][_0xfbec('0x62')]=_0x4bf568['id'];if(_0x6acfb7['query'][_0xfbec('0x4a')]){_0x26da23['where']=_[_0xfbec('0x4b')](_0x26da23[_0xfbec('0x49')],{'$or':_[_0xfbec('0x3f')](_0x26da23['attributes'],function(_0x3495bd){var _0x32beda={};_0x32beda[_0x3495bd]={'$like':'%'+_0x6acfb7[_0xfbec('0x40')][_0xfbec('0x4a')]+'%'};return _0x32beda;})});}_0x26da23=_['merge']({},_0x26da23,_0x6acfb7[_0xfbec('0x53')]);return db[_0xfbec('0x67')]['count']({'where':_0x26da23[_0xfbec('0x49')]})[_0xfbec('0x33')](function(_0xaab033){_0x2d00b8[_0xfbec('0x30')]=_0xaab033;if(_0x6acfb7[_0xfbec('0x40')][_0xfbec('0x4d')]){_0x26da23['include']=[{'all':!![]}];}return db[_0xfbec('0x67')]['findAll'](_0x26da23);})[_0xfbec('0x33')](function(_0x4009e2){_0x2d00b8[_0xfbec('0x50')]=_0x4009e2;return _0x2d00b8;});}})['then'](respondWithFilteredResult(_0x56f05,_0x26da23))[_0xfbec('0x29')](handleError(_0x56f05,null));};exports[_0xfbec('0x6b')]=function(_0x3adb0e,_0x440995,_0xe5efdc){return db[_0xfbec('0x4c')]['find']({'where':{'id':_0x3adb0e['params']['id']}})[_0xfbec('0x33')](handleEntityNotFound(_0x440995,null))['then'](function(_0x3a355d){if(_0x3a355d){return _0x3a355d['removeAnswers'](_0x3adb0e['query'][_0xfbec('0x6c')]);}})[_0xfbec('0x33')](respondWithStatusCode(_0x440995,null))[_0xfbec('0x29')](handleError(_0x440995,null));};exports[_0xfbec('0x6d')]=function(_0x3f0cc7,_0x1016ed,_0x505edf){return db[_0xfbec('0x4c')][_0xfbec('0x54')]({'where':{'id':_0x3f0cc7['params']['id']}})['then'](handleEntityNotFound(_0x1016ed,null))['then'](function(_0x3a1179){if(_0x3a1179){return _0x3a1179[_0xfbec('0x6d')](_0x3f0cc7[_0xfbec('0x56')][_0xfbec('0x6c')],_['omit'](_0x3f0cc7['body'],['ids','id'])||{})['spread'](function(_0x34f5ab){for(var _0x53a885=0x0;_0x53a885<_0x3f0cc7[_0xfbec('0x56')][_0xfbec('0x6c')]['length'];_0x53a885+=0x1){socket[_0xfbec('0x6e')](_0xfbec('0x6f'),{'UserId':Number(_0x3f0cc7[_0xfbec('0x56')]['ids'][_0x53a885]),'WhatsappAccountId':Number(_0x3f0cc7[_0xfbec('0x51')]['id'])});}return _0x34f5ab;});}})[_0xfbec('0x33')](respondWithResult(_0x1016ed,null))[_0xfbec('0x29')](handleError(_0x1016ed,null));};exports[_0xfbec('0x70')]=function(_0xf45f62,_0x1e004a,_0x5f1c19){return db[_0xfbec('0x4c')][_0xfbec('0x54')]({'where':{'id':_0xf45f62['params']['id']}})[_0xfbec('0x33')](handleEntityNotFound(_0x1e004a,null))[_0xfbec('0x33')](function(_0x4664e7){if(_0x4664e7){return _0x4664e7['removeAgents'](_0xf45f62[_0xfbec('0x40')][_0xfbec('0x6c')])[_0xfbec('0x33')](function(){if(_['isArray'](_0xf45f62[_0xfbec('0x40')][_0xfbec('0x6c')])){for(var _0x4e5933=0x0;_0x4e5933<_0xf45f62[_0xfbec('0x40')][_0xfbec('0x6c')][_0xfbec('0x52')];_0x4e5933+=0x1){socket[_0xfbec('0x6e')](_0xfbec('0x71'),{'UserId':Number(_0xf45f62[_0xfbec('0x40')]['ids'][_0x4e5933]),'WhatsappAccountId':Number(_0xf45f62[_0xfbec('0x51')]['id'])});}}else{socket[_0xfbec('0x6e')](_0xfbec('0x71'),{'UserId':Number(_0xf45f62[_0xfbec('0x40')][_0xfbec('0x6c')]),'WhatsappAccountId':Number(_0xf45f62[_0xfbec('0x51')]['id'])});}});}})[_0xfbec('0x33')](respondWithStatusCode(_0x1e004a,null))[_0xfbec('0x29')](handleError(_0x1e004a,null));};exports['getAgents']=function(_0x493335,_0x311d71,_0x3e2788){var _0x46b2e6={};var _0x22280c={};var _0x3c3d4c;var _0xf75ced;return db[_0xfbec('0x4c')][_0xfbec('0x69')]({'where':{'id':_0x493335[_0xfbec('0x51')]['id']}})[_0xfbec('0x33')](handleEntityNotFound(_0x311d71,null))[_0xfbec('0x33')](function(_0x8de759){if(_0x8de759){_0x3c3d4c=_0x8de759;_0x22280c[_0xfbec('0x3e')]=_[_0xfbec('0x41')](db['User'][_0xfbec('0x3b')]);_0x22280c['query']=_['keys'](_0x493335[_0xfbec('0x40')]);_0x22280c[_0xfbec('0x42')]=_['intersection'](_0x22280c[_0xfbec('0x3e')],_0x22280c[_0xfbec('0x40')]);_0x46b2e6[_0xfbec('0x45')]=_[_0xfbec('0x43')](_0x22280c[_0xfbec('0x3e')],qs['fields'](_0x493335[_0xfbec('0x40')][_0xfbec('0x44')]));_0x46b2e6[_0xfbec('0x45')]=_0x46b2e6[_0xfbec('0x45')][_0xfbec('0x52')]?_0x46b2e6[_0xfbec('0x45')]:_0x22280c[_0xfbec('0x3e')];_0x46b2e6[_0xfbec('0x47')]=qs[_0xfbec('0x48')](_0x493335['query'][_0xfbec('0x48')]);_0x46b2e6[_0xfbec('0x49')]=qs[_0xfbec('0x42')](_['pick'](_0x493335[_0xfbec('0x40')],_0x22280c[_0xfbec('0x42')]));if(_0x493335['query'][_0xfbec('0x4a')]){_0x46b2e6[_0xfbec('0x49')]=_[_0xfbec('0x4b')](_0x46b2e6['where'],{'$or':_[_0xfbec('0x3f')](_0x46b2e6[_0xfbec('0x45')],function(_0x2d533f){var _0x49b2a2={};_0x49b2a2[_0x2d533f]={'$like':'%'+_0x493335[_0xfbec('0x40')]['filter']+'%'};return _0x49b2a2;})});}_0x46b2e6=_[_0xfbec('0x4b')]({},_0x46b2e6,_0x493335['options']);return _0x3c3d4c[_0xfbec('0x72')](_0x46b2e6);}})['then'](function(_0x4ffbc0){if(_0x4ffbc0){_0xf75ced=_0x4ffbc0['length'];if(!_0x493335['query'][_0xfbec('0x46')](_0xfbec('0x64'))){_0x46b2e6[_0xfbec('0x2f')]=qs[_0xfbec('0x2f')](_0x493335[_0xfbec('0x40')][_0xfbec('0x2f')]);_0x46b2e6[_0xfbec('0x2d')]=qs[_0xfbec('0x2d')](_0x493335[_0xfbec('0x40')][_0xfbec('0x2d')]);}return _0x3c3d4c[_0xfbec('0x72')](_0x46b2e6);}})[_0xfbec('0x33')](function(_0x31ef74){if(_0x31ef74){return _0x31ef74?{'count':_0xf75ced,'rows':_0x31ef74}:null;}})[_0xfbec('0x33')](respondWithResult(_0x311d71,null))['catch'](handleError(_0x311d71,null));};exports['addApplications']=function(_0x2b79db,_0x131a4e){var _0x4dc50a=_0x2b79db[_0xfbec('0x51')]['id'];var _0x37e273=_0x2b79db[_0xfbec('0x56')];var _0xb26ade=0xc8;var _0x126df9=null;return db[_0xfbec('0x73')]['transaction']({'isolationLevel':db[_0xfbec('0x73')][_0xfbec('0x74')][_0xfbec('0x75')]['READ_COMMITTED']},function(_0x52941f){return db[_0xfbec('0x4c')][_0xfbec('0x69')]({'where':{'id':_0x4dc50a},'transaction':_0x52941f})['then'](function(_0x145086){if(_0x145086){return db[_0xfbec('0x76')][_0xfbec('0x5f')]({'where':{'WhatsappAccountId':_0x4dc50a},'transaction':_0x52941f})[_0xfbec('0x33')](function(){var _0x52445c=_[_0xfbec('0x3f')](_0x37e273,function(_0x1ff9ec){_0x1ff9ec['WhatsappAccountId']=_0x4dc50a;return _0x1ff9ec;});return db['WhatsappApplication']['bulkCreate'](_0x52445c,{'transaction':_0x52941f});});}else{_0xb26ade=0x194;_0x126df9=[];}});})[_0xfbec('0x33')](function(){if(_0xb26ade!==0x194){return db[_0xfbec('0x76')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x4dc50a},'order':_0xfbec('0x77')})[_0xfbec('0x33')](function(_0x4f077c){_0x126df9=_0x4f077c;});}})[_0xfbec('0x29')](function(_0x37a870){_0xb26ade=0x1f4;logger[_0xfbec('0x26')](_0x37a870[_0xfbec('0x78')]);if(_0x37a870[_0xfbec('0x36')]){delete _0x37a870[_0xfbec('0x36')];}_0x126df9=_0x37a870;})['finally'](function(){if(_0x126df9===null){_0x131a4e['sendStatus'](_0xb26ade);}else{if(_0xb26ade===0x1f4){_0x131a4e[_0xfbec('0x2a')](_0xb26ade)[_0xfbec('0x37')](_0x126df9);}else{_0x131a4e[_0xfbec('0x2a')](_0xb26ade)[_0xfbec('0x2c')](_0x126df9);}}});};exports[_0xfbec('0x79')]=function(_0x43d0b1,_0x4b8fbf,_0x6d5935){var _0xa83034={};var _0x5ee401={};var _0x5ae370;var _0x2760dd;return db[_0xfbec('0x4c')][_0xfbec('0x69')]({'where':{'id':_0x43d0b1['params']['id']}})[_0xfbec('0x33')](handleEntityNotFound(_0x4b8fbf,null))[_0xfbec('0x33')](function(_0x11d7de){if(_0x11d7de){_0x5ae370=_0x11d7de;_0x5ee401[_0xfbec('0x3e')]=_[_0xfbec('0x41')](db['WhatsappApplication'][_0xfbec('0x3b')]);_0x5ee401['query']=_[_0xfbec('0x41')](_0x43d0b1[_0xfbec('0x40')]);_0x5ee401[_0xfbec('0x42')]=_[_0xfbec('0x43')](_0x5ee401[_0xfbec('0x3e')],_0x5ee401[_0xfbec('0x40')]);_0xa83034['attributes']=_[_0xfbec('0x43')](_0x5ee401[_0xfbec('0x3e')],qs['fields'](_0x43d0b1[_0xfbec('0x40')][_0xfbec('0x44')]));_0xa83034[_0xfbec('0x45')]=_0xa83034[_0xfbec('0x45')][_0xfbec('0x52')]?_0xa83034['attributes']:_0x5ee401[_0xfbec('0x3e')];_0xa83034[_0xfbec('0x47')]=qs[_0xfbec('0x48')](_0x43d0b1[_0xfbec('0x40')][_0xfbec('0x48')]);_0xa83034[_0xfbec('0x49')]=qs['filters'](_['pick'](_0x43d0b1['query'],_0x5ee401[_0xfbec('0x42')]));if(_0x43d0b1[_0xfbec('0x40')][_0xfbec('0x4a')]){_0xa83034[_0xfbec('0x49')]=_[_0xfbec('0x4b')](_0xa83034[_0xfbec('0x49')],{'$or':_[_0xfbec('0x3f')](_0xa83034[_0xfbec('0x45')],function(_0x4c80c6){var _0x2f9a8b={};_0x2f9a8b[_0x4c80c6]={'$like':'%'+_0x43d0b1[_0xfbec('0x40')][_0xfbec('0x4a')]+'%'};return _0x2f9a8b;})});}_0xa83034=_[_0xfbec('0x4b')]({},_0xa83034,_0x43d0b1[_0xfbec('0x53')]);return _0x5ae370['getApplications'](_0xa83034);}})[_0xfbec('0x33')](function(_0x316bea){if(_0x316bea){_0x2760dd=_0x316bea[_0xfbec('0x52')];if(!_0x43d0b1[_0xfbec('0x40')][_0xfbec('0x46')](_0xfbec('0x64'))){_0xa83034[_0xfbec('0x2f')]=qs['limit'](_0x43d0b1['query'][_0xfbec('0x2f')]);_0xa83034[_0xfbec('0x2d')]=qs['offset'](_0x43d0b1['query'][_0xfbec('0x2d')]);}return _0x5ae370[_0xfbec('0x79')](_0xa83034);}})[_0xfbec('0x33')](function(_0x394dab){if(_0x394dab){return _0x394dab?{'count':_0x2760dd,'rows':_0x394dab}:null;}})[_0xfbec('0x33')](respondWithResult(_0x4b8fbf,null))['catch'](handleError(_0x4b8fbf,null));};exports['notify']=function(_0x11defa,_0x54b486,_0x38bb9d){var _0x19f5a6={'channel':'whatsapp'};var _0x180c39=[];var _0x2030f8=[];var _0x2931fc={};return db[_0xfbec('0x4c')][_0xfbec('0x54')]({'where':{'id':_0x11defa[_0xfbec('0x51')]['id']},'include':[{'model':db[_0xfbec('0x76')],'as':_0xfbec('0x7a')}]})[_0xfbec('0x33')](handleEntityNotFound(_0x54b486,null))[_0xfbec('0x33')](function(_0x202507){_0x19f5a6[_0xfbec('0x7b')]=_0x202507;if(_0x19f5a6[_0xfbec('0x7b')]&&_0x19f5a6[_0xfbec('0x7b')]['type']===_0xfbec('0x7c')&&_0x11defa[_0xfbec('0x56')][_0xfbec('0x7d')]){if(_0x11defa[_0xfbec('0x56')][_0xfbec('0x7d')]['length']===0x0)return;if(_0x11defa[_0xfbec('0x56')][_0xfbec('0x7d')][0x0][_0xfbec('0x7e')]!=='read')return;return db[_0xfbec('0x7f')]['update']({'read':!![],'readAt':_0x11defa[_0xfbec('0x56')]['statuses'][0x0][_0xfbec('0x80')]},{'where':{'messageId':_0x11defa[_0xfbec('0x56')][_0xfbec('0x7d')][0x0][_0xfbec('0x81')]},'individualHooks':!![]})[_0xfbec('0x33')](function(_0x241147){return _0x54b486[_0xfbec('0x2a')](0xc8)['json'](_0x241147);});}_0x19f5a6[_0xfbec('0x82')]=_[_0xfbec('0x83')](_0x202507[_0xfbec('0x7a')],['priority'],[_0xfbec('0x84')]);if(_0x19f5a6['account'][_0xfbec('0x7a')]){delete _0x19f5a6[_0xfbec('0x7b')][_0xfbec('0x7a')];}return db[_0xfbec('0x85')]['describe']()[_0xfbec('0x33')](function(_0x3e8280){if(!_0x3e8280){throw new db[(_0xfbec('0x86'))]['ValidationError']('no\x20available\x20attributes');}_0x180c39=_[_0xfbec('0x87')](_[_0xfbec('0x41')](_0x3e8280),['createdAt','updatedAt']);_0x2030f8=_[_0xfbec('0x87')](_['keys'](_0x3e8280),['createdAt',_0xfbec('0x88'),_0xfbec('0x89'),_0xfbec('0x8a')]);_0x19f5a6[_0xfbec('0x56')]={'mapKey':_0xfbec('0x8b')};if(_0x19f5a6[_0xfbec('0x7b')]&&_0x19f5a6[_0xfbec('0x7b')][_0xfbec('0x3d')]===_0xfbec('0x8c')){_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x8d')]=_0x11defa[_0xfbec('0x56')][_0xfbec('0x8e')]['replace'](_0xfbec('0x8f'),'');_0x19f5a6[_0xfbec('0x56')]['body']=_0x11defa[_0xfbec('0x56')]['Body'];_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x90')]=_0x11defa[_0xfbec('0x56')]['MessageSid'];}if(_0x19f5a6[_0xfbec('0x7b')]&&_0x19f5a6[_0xfbec('0x7b')][_0xfbec('0x3d')]===_0xfbec('0x7c')){_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x8d')]=_0x11defa[_0xfbec('0x56')][_0xfbec('0x91')][0x0][_0xfbec('0x8d')];_0x19f5a6['body'][_0xfbec('0x56')]=_0x11defa[_0xfbec('0x56')]['notifications'][0x0][_0xfbec('0x27')]['body'];_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x90')]=_0x11defa['body'][_0xfbec('0x91')][0x0][_0xfbec('0x81')];}if(_0x19f5a6['body']['id']){delete _0x19f5a6[_0xfbec('0x56')]['id'];}if(_[_0xfbec('0x92')](_0x19f5a6['body'][_0xfbec('0x8d')])){throw new db['Sequelize'][(_0xfbec('0x93'))]('from\x20is\x20mandatory');}if(_[_0xfbec('0x92')](_0x19f5a6['body'][_0xfbec('0x56')])||_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x56')]===''){throw new db[(_0xfbec('0x86'))][(_0xfbec('0x93'))](_0xfbec('0x94'));}if(_[_0xfbec('0x92')](_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x95')])){throw new db[(_0xfbec('0x86'))][(_0xfbec('0x93'))](_0xfbec('0x96')+_0x2030f8);}if(!_[_0xfbec('0x97')](_0x2030f8,_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x95')])){throw new db[(_0xfbec('0x86'))][(_0xfbec('0x93'))](_0xfbec('0x98')+_0x2030f8);}_0x2931fc[_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x95')]]=_0x19f5a6['body']['from'];return db[_0xfbec('0x99')][_0xfbec('0x54')]({'where':{'id':_0x19f5a6[_0xfbec('0x7b')][_0xfbec('0x8a')]},'include':[{'model':db[_0xfbec('0x85')],'as':_0xfbec('0x9a'),'where':_0x2931fc,'limit':0x1,'order':[[_0xfbec('0x88'),_0xfbec('0x9b')]]}]});})[_0xfbec('0x33')](handleEntityNotFound(_0x54b486,null))['then'](function(_0x8c0eb7){if(_0x8c0eb7){_0x19f5a6[_0xfbec('0x9c')]=_['omit'](_0x8c0eb7,[_0xfbec('0x9a')]);if(_0x8c0eb7[_0xfbec('0x9a')][_0xfbec('0x52')]){return _0x8c0eb7['Contacts'][0x0];}var _0xae2774=_[_0xfbec('0x19')](_0x19f5a6[_0xfbec('0x56')],{'firstName':_0x19f5a6['body']['from'],'ListId':_0x8c0eb7['id']});_0xae2774[_0x19f5a6[_0xfbec('0x56')]['mapKey']]=_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x8d')];return db[_0xfbec('0x85')][_0xfbec('0x55')](_0xae2774,{'fields':_0x180c39,'raw':!![]});}})['then'](handleEntityNotFound(_0x54b486,null))[_0xfbec('0x33')](function(_0x4e7e6e){if(_0x4e7e6e){_0x19f5a6[_0xfbec('0x9d')]=_0x4e7e6e;var _0x39931d={'ContactId':_0x4e7e6e['id'],'phone':_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x8d')],'WhatsappAccountId':_0x11defa[_0xfbec('0x51')]['id']};var _0xb4a96b={'ContactId':_0x4e7e6e['id'],'WhatsappAccountId':_0x11defa['params']['id'],'closed':![]};return db[_0xfbec('0x9e')]['find']({'where':_0xb4a96b})[_0xfbec('0x33')](function(_0x417114){if(_0x417114){return[_0x417114,![]];}return db[_0xfbec('0x9e')][_0xfbec('0x55')](_0x39931d)[_0xfbec('0x33')](function(_0x3a8309){return[_0x3a8309,!![]];});});}})['spread'](function(_0x7043c0,_0xb090ed){_0x19f5a6[_0xfbec('0x9f')]=_0x7043c0[_0xfbec('0x34')]({'plain':!![]});_0x19f5a6[_0xfbec('0x9f')][_0xfbec('0xa0')]=![];if(_0xb090ed){if(_0x19f5a6[_0xfbec('0x7b')][_0xfbec('0xa1')]){_0x19f5a6[_0xfbec('0x82')][_0xfbec('0xa2')]({'id':0x0,'priority':_0x19f5a6[_0xfbec('0x82')][_0xfbec('0x52')]+0x1,'app':_0xfbec('0xa3'),'appdata':_0xfbec('0xa4'),'interval':'*,*,*,*'});}_0x19f5a6['interaction'][_0xfbec('0xa0')]=!![];}return db[_0xfbec('0x7f')][_0xfbec('0x55')]({'phone':_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x8d')],'messageId':_0x19f5a6[_0xfbec('0x56')][_0xfbec('0x90')],'body':_0x19f5a6['body'][_0xfbec('0x56')],'WhatsappAccountId':_0x11defa[_0xfbec('0x51')]['id'],'WhatsappInteractionId':_0x7043c0['id'],'direction':'in','ContactId':_0x7043c0[_0xfbec('0xa5')],'AttachmentId':_0x19f5a6[_0xfbec('0x56')]['AttachmentId']});})[_0xfbec('0x33')](function(_0x57b0c9){_0x19f5a6[_0xfbec('0x27')]=_0x57b0c9;if(!_0x19f5a6[_0xfbec('0x9f')][_0xfbec('0xa6')])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x19f5a6[_0xfbec('0x9f')][_0xfbec('0xa6')]}});})[_0xfbec('0x33')](function(_0x4c4334){if(_0x4c4334){_0x19f5a6['applications'][_0xfbec('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c4334[_0xfbec('0x36')]+','+(_0x19f5a6[_0xfbec('0x7b')][_0xfbec('0xa8')]||0xa),'interval':'*,*,*,*'});}if(!_0x19f5a6[_0xfbec('0x9f')][_0xfbec('0xa9')])return;return db[_0xfbec('0xaa')][_0xfbec('0x54')]({'attributes':['id',_0xfbec('0x36')],'where':{'id':_0x19f5a6[_0xfbec('0x9f')][_0xfbec('0xa9')]}});})[_0xfbec('0x33')](function(_0x267296){if(_0x267296){_0x19f5a6[_0xfbec('0x82')][_0xfbec('0xa7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x267296[_0xfbec('0x36')]+','+(_0x19f5a6[_0xfbec('0x7b')][_0xfbec('0xab')]||0x12c),'interval':_0xfbec('0xac')});}return respondWithRpcPromise(_0xfbec('0xad'),_0xfbec('0xae'),_0x19f5a6);})[_0xfbec('0x33')](function(_0xaa6a20){if(_0xaa6a20){var _0x22ddef=0xc8;var _0x1d42d8='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1d42d8,_0x22ddef,_0xfbec('0xaf'));logger[_0xfbec('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1d42d8,_0x22ddef,_0xfbec('0xaf'),JSON[_0xfbec('0xb0')](_0xaa6a20));if(_0x19f5a6['account'][_0xfbec('0x3d')]===_0xfbec('0x8c')){return _0x54b486[_0xfbec('0x2a')](_0x22ddef)['set'](_0xfbec('0xb1'),_0xfbec('0xb2'))['send'](_0xfbec('0xb3'));}else{return _0x54b486[_0xfbec('0x2a')](_0x22ddef)[_0xfbec('0x2c')](_0xaa6a20);}}});})[_0xfbec('0x29')](handleError(_0x54b486,null));};exports[_0xfbec('0x37')]=function(_0x834c77,_0x22711,_0x5e0c0f){var _0x12c142,_0xc86f57,_0x1deb4f;if(_[_0xfbec('0x92')](_0x834c77[_0xfbec('0x56')][_0xfbec('0x56')])||_0x834c77[_0xfbec('0x56')]['body']===''){throw new db[(_0xfbec('0x86'))][(_0xfbec('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x834c77['body']['to'])){throw new db[(_0xfbec('0x86'))][(_0xfbec('0x93'))](_0xfbec('0xb4'));}_0x12c142=_0x834c77[_0xfbec('0x56')]['to'];return db['WhatsappAccount'][_0xfbec('0x54')]({'where':{'id':_0x834c77[_0xfbec('0x51')]['id']},'include':[{'model':db[_0xfbec('0x99')],'as':_0xfbec('0xb5'),'include':[{'model':db[_0xfbec('0x85')],'as':_0xfbec('0x9a'),'where':{'mobile':_0x12c142},'limit':0x1,'order':[[_0xfbec('0x88'),_0xfbec('0x9b')]]}]}]})[_0xfbec('0x33')](handleEntityNotFound(_0x22711,null))[_0xfbec('0x33')](function(_0x1d38a8){if(_0x1d38a8&&_0x1d38a8[_0xfbec('0xb5')]){_0xc86f57=_0x1d38a8[_0xfbec('0x34')]({'plain':!![]});if(_0xc86f57[_0xfbec('0xb5')]&&_0xc86f57[_0xfbec('0xb5')][_0xfbec('0x9a')][_0xfbec('0x52')]){return _0xc86f57[_0xfbec('0xb5')][_0xfbec('0x9a')][0x0];}return db[_0xfbec('0x85')][_0xfbec('0x55')](_['defaults'](_0x834c77['body'],{'firstName':_0x12c142,'mobile':_0x12c142,'phone':_0x12c142,'ListId':_0xc86f57[_0xfbec('0x8a')]}));}})[_0xfbec('0x33')](handleEntityNotFound(_0x22711,null))[_0xfbec('0x33')](function(_0x3cd9a2){if(_0x3cd9a2){_0x1deb4f=_0x3cd9a2;return db[_0xfbec('0x9e')][_0xfbec('0x54')]({'where':{'ContactId':_0x1deb4f['id'],'closed':![],'WhatsappAccountId':_0xc86f57['id']}})[_0xfbec('0x33')](function(_0x4208bd){if(_0x4208bd){return[_0x4208bd,![]];}return db[_0xfbec('0x9e')]['create']({'UserId':_0x834c77['user']['id'],'ContactId':_0x1deb4f['id'],'WhatsappAccountId':_0xc86f57['id'],'phone':_0x12c142,'firstMsgDirection':_0xfbec('0xb6'),'Messages':[_[_0xfbec('0x4b')](_0x834c77[_0xfbec('0x56')],{'read':![],'body':_0x834c77['body']['body'],'phone':_0x12c142,'WhatsappAccountId':_0xc86f57['id'],'UserId':_0x834c77[_0xfbec('0x57')]['id'],'ContactId':_0x1deb4f['id']})]},{'include':[{'model':db[_0xfbec('0x7f')],'as':'Messages'}]})['then'](function(_0x271bfc){return[_0x271bfc,!![]];});});}})[_0xfbec('0xb7')](function(_0x9efdb4,_0x10fc33){if(_0x10fc33){return _0x9efdb4;}return db[_0xfbec('0x7f')][_0xfbec('0x55')](_[_0xfbec('0x4b')](_0x834c77[_0xfbec('0x56')],{'read':![],'body':_0x834c77[_0xfbec('0x56')]['body'],'phone':_0x12c142,'WhatsappAccountId':_0xc86f57['id'],'WhatsappInteractionId':_0x9efdb4['id'],'UserId':_0x834c77[_0xfbec('0x57')]['id'],'ContactId':_0x1deb4f['id']}))['then'](function(_0x1c5acc){_0x9efdb4['dataValues'][_0xfbec('0xb8')]=[];_0x9efdb4[_0xfbec('0xb9')][_0xfbec('0xb8')]['push'](_0x1c5acc[_0xfbec('0xb9')]);return _0x9efdb4;});})[_0xfbec('0x33')](respondWithResult(_0x22711,null))['catch'](handleError(_0x22711,null));}; \ No newline at end of file +var _0x9490=['update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','WhatsappAccount','findAll','rows','catch','show','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','length','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','whatsapp:','messageId','notifications','message_id','Sequelize','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','WhatsappInteraction','interaction','applications','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','to\x20is\x20mandatory','List','DESC','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','./whatsappAccount.socket','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x9490,0x148));var _0x0949=function(_0x593491,_0x43f424){_0x593491=_0x593491-0x0;var _0x46165c=_0x9490[_0x593491];return _0x46165c;};'use strict';var emlformat=require(_0x0949('0x0'));var rimraf=require(_0x0949('0x1'));var zipdir=require(_0x0949('0x2'));var jsonpatch=require(_0x0949('0x3'));var rp=require('request-promise');var moment=require(_0x0949('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0949('0x5'));var util=require(_0x0949('0x6'));var path=require(_0x0949('0x7'));var sox=require(_0x0949('0x8'));var csv=require(_0x0949('0x9'));var ejs=require(_0x0949('0xa'));var fs=require('fs');var fs_extra=require(_0x0949('0xb'));var _=require(_0x0949('0xc'));var squel=require(_0x0949('0xd'));var crypto=require('crypto');var jsforce=require(_0x0949('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0949('0x9'));var querystring=require('querystring');var Papa=require(_0x0949('0xf'));var Redis=require(_0x0949('0x10'));var authService=require(_0x0949('0x11'));var qs=require(_0x0949('0x12'));var as=require(_0x0949('0x13'));var hardwareService=require(_0x0949('0x14'));var logger=require(_0x0949('0x15'))(_0x0949('0x16'));var utils=require(_0x0949('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0949('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0949('0x19')](config[_0x0949('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0949('0x1a')]));require(_0x0949('0x1b'))['register'](socket);var jayson=require(_0x0949('0x1c'));var client=jayson[_0x0949('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4b2787,_0x41d083,_0xe1a553,_0x541732){return new BPromise(function(_0x2c3cf3,_0xbf5cb3){var _0x4d1624=_0x541732||client;return _0x4d1624['request'](_0x4b2787,_0xe1a553)[_0x0949('0x1e')](function(_0x185cee){logger[_0x0949('0x1f')](_0x0949('0x20'),_0x41d083,_0x0949('0x21'));logger[_0x0949('0x22')](_0x0949('0x23'),_0x41d083,_0x0949('0x21'),JSON[_0x0949('0x24')](_0x185cee));if(_0x185cee[_0x0949('0x25')]){if(_0x185cee[_0x0949('0x25')][_0x0949('0x26')]===0x1f4){logger[_0x0949('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x41d083,_0x185cee[_0x0949('0x25')]['message']);return _0xbf5cb3(_0x185cee['error']['message']);}logger['error'](_0x0949('0x20'),_0x41d083,_0x185cee[_0x0949('0x25')][_0x0949('0x27')]);return _0x2c3cf3(_0x185cee[_0x0949('0x25')][_0x0949('0x27')]);}else{logger[_0x0949('0x1f')](_0x0949('0x20'),_0x41d083,_0x0949('0x21'));_0x2c3cf3(_0x185cee[_0x0949('0x28')][_0x0949('0x27')]);}})['catch'](function(_0x13df8d){logger['error'](_0x0949('0x20'),_0x41d083,_0x13df8d);_0xbf5cb3(_0x13df8d);});});}function respondWithStatusCode(_0x57fae9,_0xa78047){_0xa78047=_0xa78047||0xcc;return function(_0x1c6421){if(_0x1c6421){return _0x57fae9[_0x0949('0x29')](_0xa78047);}return _0x57fae9[_0x0949('0x2a')](_0xa78047)[_0x0949('0x2b')]();};}function respondWithResult(_0x5534db,_0x58defa){_0x58defa=_0x58defa||0xc8;return function(_0x80dc23){if(_0x80dc23){return _0x5534db['status'](_0x58defa)[_0x0949('0x2c')](_0x80dc23);}};}function respondWithFilteredResult(_0x4bf602,_0x308c92){return function(_0x567ef0){if(_0x567ef0){var _0x406d55=typeof _0x308c92['offset']===_0x0949('0x2d')&&typeof _0x308c92['limit']==='undefined';var _0x209d02=_0x567ef0[_0x0949('0x2e')];var _0x2aaaba=_0x406d55?0x0:_0x308c92[_0x0949('0x2f')];var _0x1b1e9e=_0x406d55?_0x567ef0['count']:_0x308c92[_0x0949('0x2f')]+_0x308c92[_0x0949('0x30')];var _0x2e168a;if(_0x1b1e9e>=_0x209d02){_0x1b1e9e=_0x209d02;_0x2e168a=0xc8;}else{_0x2e168a=0xce;}_0x4bf602[_0x0949('0x2a')](_0x2e168a);return _0x4bf602[_0x0949('0x31')](_0x0949('0x32'),_0x2aaaba+'-'+_0x1b1e9e+'/'+_0x209d02)[_0x0949('0x2c')](_0x567ef0);}return null;};}function patchUpdates(_0x147164){return function(_0x290f29){try{jsonpatch[_0x0949('0x33')](_0x290f29,_0x147164,!![]);}catch(_0x291727){return BPromise[_0x0949('0x34')](_0x291727);}return _0x290f29[_0x0949('0x35')]();};}function saveUpdates(_0x3ae278,_0x40e522){return function(_0x2578c4){if(_0x2578c4){return _0x2578c4[_0x0949('0x36')](_0x3ae278)[_0x0949('0x1e')](function(_0x1208d9){return _0x1208d9;});}return null;};}function removeEntity(_0x624b88,_0x3ece2b){return function(_0x4d1ed7){if(_0x4d1ed7){return _0x4d1ed7[_0x0949('0x37')]()[_0x0949('0x1e')](function(){var _0x1460aa=_0x4d1ed7[_0x0949('0x38')]({'plain':!![]});var _0x3191ad=_0x0949('0x39');return db[_0x0949('0x3a')][_0x0949('0x37')]({'where':{'type':_0x3191ad,'resourceId':_0x1460aa['id']}})[_0x0949('0x1e')](function(){return _0x4d1ed7;});})[_0x0949('0x1e')](function(){_0x624b88[_0x0949('0x2a')](0xcc)[_0x0949('0x2b')]();});}};}function handleEntityNotFound(_0x2da271,_0x1c5e4c){return function(_0x51305b){if(!_0x51305b){_0x2da271[_0x0949('0x29')](0x194);}return _0x51305b;};}function handleError(_0x7b9cd0,_0x50509e){_0x50509e=_0x50509e||0x1f4;return function(_0x4f1f2f){logger[_0x0949('0x25')](_0x4f1f2f['stack']);if(_0x4f1f2f[_0x0949('0x3b')]){delete _0x4f1f2f['name'];}_0x7b9cd0[_0x0949('0x2a')](_0x50509e)[_0x0949('0x3c')](_0x4f1f2f);};}exports['index']=function(_0x9d6dc2,_0x502c7b){var _0x160815={'include':[{'model':db[_0x0949('0x3d')],'as':_0x0949('0x3e')}]},_0x5424fc={},_0x44d5c7={'count':0x0,'rows':[]};var _0x42013d=_[_0x0949('0x3f')](db['WhatsappAccount'][_0x0949('0x40')],function(_0x126243){return{'name':_0x126243[_0x0949('0x41')],'type':_0x126243[_0x0949('0x42')]['key']};});_0x5424fc[_0x0949('0x43')]=_[_0x0949('0x3f')](_0x42013d,_0x0949('0x3b'));_0x5424fc[_0x0949('0x44')]=_[_0x0949('0x45')](_0x9d6dc2[_0x0949('0x44')]);_0x5424fc[_0x0949('0x46')]=_[_0x0949('0x47')](_0x5424fc[_0x0949('0x43')],_0x5424fc['query']);_0x160815[_0x0949('0x48')]=_['intersection'](_0x5424fc[_0x0949('0x43')],qs['fields'](_0x9d6dc2[_0x0949('0x44')][_0x0949('0x49')]));_0x160815[_0x0949('0x48')]=_0x160815[_0x0949('0x48')]['length']?_0x160815[_0x0949('0x48')]:_0x5424fc['model'];if(!_0x9d6dc2[_0x0949('0x44')][_0x0949('0x4a')](_0x0949('0x4b'))){_0x160815['limit']=qs[_0x0949('0x30')](_0x9d6dc2[_0x0949('0x44')][_0x0949('0x30')]);_0x160815[_0x0949('0x2f')]=qs[_0x0949('0x2f')](_0x9d6dc2[_0x0949('0x44')][_0x0949('0x2f')]);}_0x160815[_0x0949('0x4c')]=qs[_0x0949('0x4d')](_0x9d6dc2[_0x0949('0x44')]['sort']);_0x160815['where']=qs['filters'](_['pick'](_0x9d6dc2[_0x0949('0x44')],_0x5424fc['filters']),_0x42013d);if(_0x9d6dc2[_0x0949('0x44')][_0x0949('0x4e')]){_0x160815[_0x0949('0x4f')]=_['merge'](_0x160815[_0x0949('0x4f')],{'$or':_[_0x0949('0x3f')](_0x42013d,function(_0x4a8d14){if(_0x4a8d14[_0x0949('0x42')]!==_0x0949('0x50')){var _0x4fb4d5={};_0x4fb4d5[_0x4a8d14['name']]={'$like':'%'+_0x9d6dc2['query']['filter']+'%'};return _0x4fb4d5;}})});}_0x160815=_['merge']({},_0x160815,_0x9d6dc2[_0x0949('0x51')]);var _0x4e9370={'where':_0x160815[_0x0949('0x4f')]};return db['WhatsappAccount'][_0x0949('0x2e')](_0x4e9370)[_0x0949('0x1e')](function(_0x43cb91){_0x44d5c7[_0x0949('0x2e')]=_0x43cb91;if(_0x9d6dc2[_0x0949('0x44')][_0x0949('0x52')]){_0x160815[_0x0949('0x53')]=[{'all':!![]}];}return db[_0x0949('0x54')][_0x0949('0x55')](_0x160815);})[_0x0949('0x1e')](function(_0x364729){_0x44d5c7[_0x0949('0x56')]=_0x364729;return _0x44d5c7;})['then'](respondWithFilteredResult(_0x502c7b,_0x160815))[_0x0949('0x57')](handleError(_0x502c7b,null));};exports[_0x0949('0x58')]=function(_0x28cd52,_0x175afe){var _0x4ee5d7={'raw':![],'where':{'id':_0x28cd52['params']['id']},'include':[{'model':db[_0x0949('0x3d')],'as':_0x0949('0x3e')}]},_0x187351={};_0x187351['model']=_[_0x0949('0x45')](db[_0x0949('0x54')][_0x0949('0x40')]);_0x187351[_0x0949('0x44')]=_[_0x0949('0x45')](_0x28cd52[_0x0949('0x44')]);_0x187351['filters']=_[_0x0949('0x47')](_0x187351[_0x0949('0x43')],_0x187351[_0x0949('0x44')]);_0x4ee5d7[_0x0949('0x48')]=_[_0x0949('0x47')](_0x187351[_0x0949('0x43')],qs[_0x0949('0x49')](_0x28cd52[_0x0949('0x44')][_0x0949('0x49')]));_0x4ee5d7[_0x0949('0x48')]=_0x4ee5d7['attributes']['length']?_0x4ee5d7[_0x0949('0x48')]:_0x187351[_0x0949('0x43')];if(_0x28cd52['query'][_0x0949('0x52')]){_0x4ee5d7['include']=[{'all':!![]}];}_0x4ee5d7=_[_0x0949('0x59')]({},_0x4ee5d7,_0x28cd52[_0x0949('0x51')]);return db[_0x0949('0x54')][_0x0949('0x5a')](_0x4ee5d7)['then'](handleEntityNotFound(_0x175afe,null))[_0x0949('0x1e')](respondWithResult(_0x175afe,null))[_0x0949('0x57')](handleError(_0x175afe,null));};exports[_0x0949('0x5b')]=function(_0x156442,_0x3e965f){return db[_0x0949('0x54')][_0x0949('0x5b')](_0x156442[_0x0949('0x5c')],{})[_0x0949('0x1e')](function(_0x38597b){var _0x144803=_0x156442[_0x0949('0x5d')][_0x0949('0x38')]({'plain':!![]});if(!_0x144803)throw new Error(_0x0949('0x5e'));if(_0x144803[_0x0949('0x5f')]===_0x0949('0x5d')){var _0xd0b0d1=_0x38597b[_0x0949('0x38')]({'plain':!![]});var _0x3bd1d9=_0x0949('0x39');return db[_0x0949('0x60')][_0x0949('0x5a')]({'where':{'name':_0x3bd1d9,'userProfileId':_0x144803['userProfileId']},'raw':!![]})[_0x0949('0x1e')](function(_0x2551aa){if(_0x2551aa&&_0x2551aa[_0x0949('0x61')]===0x0){return db[_0x0949('0x3a')][_0x0949('0x5b')]({'name':_0xd0b0d1[_0x0949('0x3b')],'resourceId':_0xd0b0d1['id'],'type':_0x2551aa[_0x0949('0x3b')],'sectionId':_0x2551aa['id']},{})[_0x0949('0x1e')](function(){return _0x38597b;});}else{return _0x38597b;}})[_0x0949('0x57')](function(_0x1eae68){logger[_0x0949('0x25')](_0x0949('0x62'),_0x1eae68);throw _0x1eae68;});}return _0x38597b;})[_0x0949('0x1e')](respondWithResult(_0x3e965f,0xc9))[_0x0949('0x57')](handleError(_0x3e965f,null));};exports[_0x0949('0x36')]=function(_0x1aa196,_0x62bb43){if(_0x1aa196['body']['id']){delete _0x1aa196[_0x0949('0x5c')]['id'];}return db[_0x0949('0x54')][_0x0949('0x5a')]({'where':{'id':_0x1aa196[_0x0949('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0x0949('0x3e')}]})[_0x0949('0x1e')](handleEntityNotFound(_0x62bb43,null))[_0x0949('0x1e')](saveUpdates(_0x1aa196[_0x0949('0x5c')],null))[_0x0949('0x1e')](respondWithResult(_0x62bb43,null))[_0x0949('0x57')](handleError(_0x62bb43,null));};exports[_0x0949('0x37')]=function(_0x5ac678,_0x26f586){return db[_0x0949('0x54')][_0x0949('0x5a')]({'where':{'id':_0x5ac678[_0x0949('0x63')]['id']}})[_0x0949('0x1e')](handleEntityNotFound(_0x26f586,null))['then'](removeEntity(_0x26f586,null))['catch'](handleError(_0x26f586,null));};exports[_0x0949('0x64')]=function(_0x2302fd,_0x3b8f21){return db[_0x0949('0x54')][_0x0949('0x64')]()[_0x0949('0x1e')](respondWithResult(_0x3b8f21,null))['catch'](handleError(_0x3b8f21,null));};exports['addDisposition']=function(_0x42ce72,_0x3098db,_0x1ea763){if(_0x42ce72[_0x0949('0x5c')]['id']){delete _0x42ce72['body']['id'];}return db['WhatsappAccount'][_0x0949('0x5a')]({'where':{'id':_0x42ce72['params']['id']}})['then'](handleEntityNotFound(_0x3098db,null))[_0x0949('0x1e')](function(_0x1952f2){if(_0x1952f2){_0x42ce72['body'][_0x0949('0x65')]=_0x1952f2['id'];return db[_0x0949('0x66')][_0x0949('0x5b')](_0x42ce72[_0x0949('0x5c')]);}})[_0x0949('0x1e')](respondWithResult(_0x3098db,null))[_0x0949('0x57')](handleError(_0x3098db,null));};exports[_0x0949('0x67')]=function(_0x390cb1,_0x527d67,_0x2e598b){var _0x4d3773={'raw':![],'where':{}};var _0x543f81={};var _0x1161c7={'count':0x0,'rows':[]};return db[_0x0949('0x54')][_0x0949('0x68')]({'where':{'id':_0x390cb1[_0x0949('0x63')]['id']}})['then'](handleEntityNotFound(_0x527d67,null))['then'](function(_0x846356){if(_0x846356){_0x543f81[_0x0949('0x43')]=_[_0x0949('0x45')](db[_0x0949('0x66')][_0x0949('0x40')]);_0x543f81[_0x0949('0x44')]=_['keys'](_0x390cb1[_0x0949('0x44')]);_0x543f81['filters']=_[_0x0949('0x47')](_0x543f81[_0x0949('0x43')],_0x543f81[_0x0949('0x44')]);_0x4d3773[_0x0949('0x48')]=_[_0x0949('0x47')](_0x543f81[_0x0949('0x43')],qs['fields'](_0x390cb1[_0x0949('0x44')][_0x0949('0x49')]));_0x4d3773['attributes']=_0x4d3773[_0x0949('0x48')][_0x0949('0x69')]?_0x4d3773[_0x0949('0x48')]:_0x543f81[_0x0949('0x43')];if(!_0x390cb1[_0x0949('0x44')]['hasOwnProperty']('nolimit')){_0x4d3773['limit']=qs['limit'](_0x390cb1[_0x0949('0x44')][_0x0949('0x30')]);_0x4d3773[_0x0949('0x2f')]=qs['offset'](_0x390cb1[_0x0949('0x44')]['offset']);}_0x4d3773[_0x0949('0x4c')]=qs['sort'](_0x390cb1[_0x0949('0x44')]['sort']);_0x4d3773['where']=qs[_0x0949('0x46')](_[_0x0949('0x6a')](_0x390cb1[_0x0949('0x44')],_0x543f81[_0x0949('0x46')]));_0x4d3773[_0x0949('0x4f')][_0x0949('0x65')]=_0x846356['id'];if(_0x390cb1[_0x0949('0x44')]['filter']){_0x4d3773[_0x0949('0x4f')]=_[_0x0949('0x59')](_0x4d3773[_0x0949('0x4f')],{'$or':_[_0x0949('0x3f')](_0x4d3773[_0x0949('0x48')],function(_0x14bc18){var _0x302974={};_0x302974[_0x14bc18]={'$like':'%'+_0x390cb1[_0x0949('0x44')][_0x0949('0x4e')]+'%'};return _0x302974;})});}_0x4d3773=_[_0x0949('0x59')]({},_0x4d3773,_0x390cb1['options']);return db[_0x0949('0x66')][_0x0949('0x2e')]({'where':_0x4d3773[_0x0949('0x4f')]})[_0x0949('0x1e')](function(_0x593b74){_0x1161c7['count']=_0x593b74;if(_0x390cb1[_0x0949('0x44')][_0x0949('0x52')]){_0x4d3773[_0x0949('0x53')]=[{'all':!![]}];}return db[_0x0949('0x66')][_0x0949('0x55')](_0x4d3773);})[_0x0949('0x1e')](function(_0x19beec){_0x1161c7[_0x0949('0x56')]=_0x19beec;return _0x1161c7;});}})[_0x0949('0x1e')](respondWithFilteredResult(_0x527d67,_0x4d3773))[_0x0949('0x57')](handleError(_0x527d67,null));};exports[_0x0949('0x6b')]=function(_0x2f9c1f,_0x1497f6,_0x27cb2e){return db['WhatsappAccount'][_0x0949('0x5a')]({'where':{'id':_0x2f9c1f[_0x0949('0x63')]['id']}})[_0x0949('0x1e')](handleEntityNotFound(_0x1497f6,null))['then'](function(_0x13cfc3){if(_0x13cfc3){return _0x13cfc3['removeDispositions'](_0x2f9c1f['query'][_0x0949('0x6c')]);}})[_0x0949('0x1e')](respondWithStatusCode(_0x1497f6,null))['catch'](handleError(_0x1497f6,null));};exports[_0x0949('0x6d')]=function(_0x1a7b7a,_0xaebe16,_0x5d1443){if(_0x1a7b7a[_0x0949('0x5c')]['id']){delete _0x1a7b7a[_0x0949('0x5c')]['id'];}return db[_0x0949('0x54')][_0x0949('0x5a')]({'where':{'id':_0x1a7b7a['params']['id']}})[_0x0949('0x1e')](handleEntityNotFound(_0xaebe16,null))[_0x0949('0x1e')](function(_0x1bba30){if(_0x1bba30){_0x1a7b7a[_0x0949('0x5c')][_0x0949('0x65')]=_0x1bba30['id'];return db[_0x0949('0x6e')]['create'](_0x1a7b7a[_0x0949('0x5c')]);}})['then'](respondWithResult(_0xaebe16,null))[_0x0949('0x57')](handleError(_0xaebe16,null));};exports[_0x0949('0x6f')]=function(_0x1e2a6f,_0x1809fa,_0x29be10){var _0xa5d7fa={'raw':![],'where':{}};var _0x25bb73={};var _0x134e9c={'count':0x0,'rows':[]};return db[_0x0949('0x54')][_0x0949('0x68')]({'where':{'id':_0x1e2a6f[_0x0949('0x63')]['id']}})[_0x0949('0x1e')](handleEntityNotFound(_0x1809fa,null))[_0x0949('0x1e')](function(_0x2854ef){if(_0x2854ef){_0x25bb73['model']=_[_0x0949('0x45')](db[_0x0949('0x6e')][_0x0949('0x40')]);_0x25bb73['query']=_[_0x0949('0x45')](_0x1e2a6f[_0x0949('0x44')]);_0x25bb73['filters']=_[_0x0949('0x47')](_0x25bb73['model'],_0x25bb73[_0x0949('0x44')]);_0xa5d7fa[_0x0949('0x48')]=_['intersection'](_0x25bb73[_0x0949('0x43')],qs['fields'](_0x1e2a6f['query'][_0x0949('0x49')]));_0xa5d7fa[_0x0949('0x48')]=_0xa5d7fa[_0x0949('0x48')][_0x0949('0x69')]?_0xa5d7fa[_0x0949('0x48')]:_0x25bb73[_0x0949('0x43')];if(!_0x1e2a6f[_0x0949('0x44')][_0x0949('0x4a')]('nolimit')){_0xa5d7fa[_0x0949('0x30')]=qs[_0x0949('0x30')](_0x1e2a6f['query'][_0x0949('0x30')]);_0xa5d7fa[_0x0949('0x2f')]=qs['offset'](_0x1e2a6f[_0x0949('0x44')][_0x0949('0x2f')]);}_0xa5d7fa['order']=qs['sort'](_0x1e2a6f[_0x0949('0x44')][_0x0949('0x4d')]);_0xa5d7fa[_0x0949('0x4f')]=qs[_0x0949('0x46')](_[_0x0949('0x6a')](_0x1e2a6f['query'],_0x25bb73[_0x0949('0x46')]));_0xa5d7fa[_0x0949('0x4f')]['WhatsappAccountId']=_0x2854ef['id'];if(_0x1e2a6f[_0x0949('0x44')][_0x0949('0x4e')]){_0xa5d7fa[_0x0949('0x4f')]=_['merge'](_0xa5d7fa[_0x0949('0x4f')],{'$or':_[_0x0949('0x3f')](_0xa5d7fa[_0x0949('0x48')],function(_0x633b72){var _0x232627={};_0x232627[_0x633b72]={'$like':'%'+_0x1e2a6f['query'][_0x0949('0x4e')]+'%'};return _0x232627;})});}_0xa5d7fa=_[_0x0949('0x59')]({},_0xa5d7fa,_0x1e2a6f['options']);return db[_0x0949('0x6e')][_0x0949('0x2e')]({'where':_0xa5d7fa[_0x0949('0x4f')]})[_0x0949('0x1e')](function(_0x50ddf1){_0x134e9c[_0x0949('0x2e')]=_0x50ddf1;if(_0x1e2a6f[_0x0949('0x44')][_0x0949('0x52')]){_0xa5d7fa[_0x0949('0x53')]=[{'all':!![]}];}return db[_0x0949('0x6e')][_0x0949('0x55')](_0xa5d7fa);})[_0x0949('0x1e')](function(_0x2c927c){_0x134e9c['rows']=_0x2c927c;return _0x134e9c;});}})[_0x0949('0x1e')](respondWithFilteredResult(_0x1809fa,_0xa5d7fa))[_0x0949('0x57')](handleError(_0x1809fa,null));};exports['removeAnswers']=function(_0x1e9293,_0x24bc88,_0x5cf173){return db['WhatsappAccount'][_0x0949('0x5a')]({'where':{'id':_0x1e9293['params']['id']}})[_0x0949('0x1e')](handleEntityNotFound(_0x24bc88,null))[_0x0949('0x1e')](function(_0x51016b){if(_0x51016b){return _0x51016b[_0x0949('0x70')](_0x1e9293[_0x0949('0x44')][_0x0949('0x6c')]);}})[_0x0949('0x1e')](respondWithStatusCode(_0x24bc88,null))['catch'](handleError(_0x24bc88,null));};exports['addAgents']=function(_0x3ed849,_0x175a46,_0x11aadf){return db['WhatsappAccount'][_0x0949('0x5a')]({'where':{'id':_0x3ed849[_0x0949('0x63')]['id']}})['then'](handleEntityNotFound(_0x175a46,null))[_0x0949('0x1e')](function(_0x552399){if(_0x552399){return _0x552399[_0x0949('0x71')](_0x3ed849[_0x0949('0x5c')][_0x0949('0x6c')],_[_0x0949('0x72')](_0x3ed849[_0x0949('0x5c')],[_0x0949('0x6c'),'id'])||{})[_0x0949('0x73')](function(_0x288c1a){for(var _0x39e490=0x0;_0x39e490<_0x3ed849[_0x0949('0x5c')][_0x0949('0x6c')][_0x0949('0x69')];_0x39e490+=0x1){socket[_0x0949('0x74')](_0x0949('0x75'),{'UserId':Number(_0x3ed849['body'][_0x0949('0x6c')][_0x39e490]),'WhatsappAccountId':Number(_0x3ed849['params']['id'])});}return _0x288c1a;});}})[_0x0949('0x1e')](respondWithResult(_0x175a46,null))[_0x0949('0x57')](handleError(_0x175a46,null));};exports[_0x0949('0x76')]=function(_0x488cdf,_0x38142f,_0x4bee19){return db[_0x0949('0x54')][_0x0949('0x5a')]({'where':{'id':_0x488cdf[_0x0949('0x63')]['id']}})[_0x0949('0x1e')](handleEntityNotFound(_0x38142f,null))[_0x0949('0x1e')](function(_0x3a142b){if(_0x3a142b){return _0x3a142b[_0x0949('0x76')](_0x488cdf[_0x0949('0x44')]['ids'])[_0x0949('0x1e')](function(){if(_['isArray'](_0x488cdf['query'][_0x0949('0x6c')])){for(var _0x405b05=0x0;_0x405b05<_0x488cdf[_0x0949('0x44')][_0x0949('0x6c')][_0x0949('0x69')];_0x405b05+=0x1){socket[_0x0949('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x488cdf[_0x0949('0x44')][_0x0949('0x6c')][_0x405b05]),'WhatsappAccountId':Number(_0x488cdf[_0x0949('0x63')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x488cdf['query'][_0x0949('0x6c')]),'WhatsappAccountId':Number(_0x488cdf[_0x0949('0x63')]['id'])});}});}})[_0x0949('0x1e')](respondWithStatusCode(_0x38142f,null))[_0x0949('0x57')](handleError(_0x38142f,null));};exports['getAgents']=function(_0x207b8f,_0x3c3ce3,_0x47ddb9){var _0x5de502={};var _0x5f0ad1={};var _0x2012f9;var _0x3700d7;return db['WhatsappAccount'][_0x0949('0x68')]({'where':{'id':_0x207b8f[_0x0949('0x63')]['id']}})[_0x0949('0x1e')](handleEntityNotFound(_0x3c3ce3,null))[_0x0949('0x1e')](function(_0x4a211c){if(_0x4a211c){_0x2012f9=_0x4a211c;_0x5f0ad1[_0x0949('0x43')]=_[_0x0949('0x45')](db['User']['rawAttributes']);_0x5f0ad1[_0x0949('0x44')]=_[_0x0949('0x45')](_0x207b8f[_0x0949('0x44')]);_0x5f0ad1['filters']=_[_0x0949('0x47')](_0x5f0ad1[_0x0949('0x43')],_0x5f0ad1[_0x0949('0x44')]);_0x5de502['attributes']=_[_0x0949('0x47')](_0x5f0ad1[_0x0949('0x43')],qs[_0x0949('0x49')](_0x207b8f[_0x0949('0x44')][_0x0949('0x49')]));_0x5de502['attributes']=_0x5de502[_0x0949('0x48')]['length']?_0x5de502['attributes']:_0x5f0ad1[_0x0949('0x43')];_0x5de502['order']=qs['sort'](_0x207b8f[_0x0949('0x44')]['sort']);_0x5de502[_0x0949('0x4f')]=qs[_0x0949('0x46')](_['pick'](_0x207b8f[_0x0949('0x44')],_0x5f0ad1[_0x0949('0x46')]));if(_0x207b8f[_0x0949('0x44')]['filter']){_0x5de502['where']=_['merge'](_0x5de502[_0x0949('0x4f')],{'$or':_[_0x0949('0x3f')](_0x5de502[_0x0949('0x48')],function(_0x116467){var _0x40cb0e={};_0x40cb0e[_0x116467]={'$like':'%'+_0x207b8f[_0x0949('0x44')][_0x0949('0x4e')]+'%'};return _0x40cb0e;})});}_0x5de502=_[_0x0949('0x59')]({},_0x5de502,_0x207b8f[_0x0949('0x51')]);return _0x2012f9[_0x0949('0x77')](_0x5de502);}})['then'](function(_0x37f213){if(_0x37f213){_0x3700d7=_0x37f213['length'];if(!_0x207b8f[_0x0949('0x44')][_0x0949('0x4a')]('nolimit')){_0x5de502[_0x0949('0x30')]=qs[_0x0949('0x30')](_0x207b8f[_0x0949('0x44')][_0x0949('0x30')]);_0x5de502[_0x0949('0x2f')]=qs[_0x0949('0x2f')](_0x207b8f[_0x0949('0x44')]['offset']);}return _0x2012f9[_0x0949('0x77')](_0x5de502);}})[_0x0949('0x1e')](function(_0x4eab51){if(_0x4eab51){return _0x4eab51?{'count':_0x3700d7,'rows':_0x4eab51}:null;}})[_0x0949('0x1e')](respondWithResult(_0x3c3ce3,null))['catch'](handleError(_0x3c3ce3,null));};exports[_0x0949('0x78')]=function(_0x39847b,_0x12608f){var _0x2be35a=_0x39847b[_0x0949('0x63')]['id'];var _0x260bea=_0x39847b[_0x0949('0x5c')];var _0x2e7697=0xc8;var _0x5987ce=null;return db[_0x0949('0x79')][_0x0949('0x7a')]({'isolationLevel':db[_0x0949('0x79')][_0x0949('0x7b')][_0x0949('0x7c')]['READ_COMMITTED']},function(_0x18a880){return db['WhatsappAccount'][_0x0949('0x68')]({'where':{'id':_0x2be35a},'transaction':_0x18a880})['then'](function(_0x3e362b){if(_0x3e362b){return db[_0x0949('0x7d')]['destroy']({'where':{'WhatsappAccountId':_0x2be35a},'transaction':_0x18a880})[_0x0949('0x1e')](function(){var _0x1c50ba=_[_0x0949('0x3f')](_0x260bea,function(_0xdd8aa3){_0xdd8aa3[_0x0949('0x65')]=_0x2be35a;return _0xdd8aa3;});return db['WhatsappApplication'][_0x0949('0x7e')](_0x1c50ba,{'transaction':_0x18a880});});}else{_0x2e7697=0x194;_0x5987ce=[];}});})[_0x0949('0x1e')](function(){if(_0x2e7697!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x2be35a},'order':_0x0949('0x7f')})[_0x0949('0x1e')](function(_0x578226){_0x5987ce=_0x578226;});}})['catch'](function(_0x15179a){_0x2e7697=0x1f4;logger[_0x0949('0x25')](_0x15179a['stack']);if(_0x15179a[_0x0949('0x3b')]){delete _0x15179a[_0x0949('0x3b')];}_0x5987ce=_0x15179a;})[_0x0949('0x80')](function(){if(_0x5987ce===null){_0x12608f[_0x0949('0x29')](_0x2e7697);}else{if(_0x2e7697===0x1f4){_0x12608f[_0x0949('0x2a')](_0x2e7697)[_0x0949('0x3c')](_0x5987ce);}else{_0x12608f[_0x0949('0x2a')](_0x2e7697)[_0x0949('0x2c')](_0x5987ce);}}});};exports[_0x0949('0x81')]=function(_0x167ca8,_0x52eb96,_0x1a0982){var _0x2ce15b={};var _0x15d635={};var _0xfd2e11;var _0x8c861e;return db[_0x0949('0x54')][_0x0949('0x68')]({'where':{'id':_0x167ca8['params']['id']}})[_0x0949('0x1e')](handleEntityNotFound(_0x52eb96,null))['then'](function(_0x1bf998){if(_0x1bf998){_0xfd2e11=_0x1bf998;_0x15d635[_0x0949('0x43')]=_[_0x0949('0x45')](db[_0x0949('0x7d')][_0x0949('0x40')]);_0x15d635[_0x0949('0x44')]=_[_0x0949('0x45')](_0x167ca8[_0x0949('0x44')]);_0x15d635[_0x0949('0x46')]=_[_0x0949('0x47')](_0x15d635[_0x0949('0x43')],_0x15d635[_0x0949('0x44')]);_0x2ce15b[_0x0949('0x48')]=_['intersection'](_0x15d635[_0x0949('0x43')],qs[_0x0949('0x49')](_0x167ca8[_0x0949('0x44')][_0x0949('0x49')]));_0x2ce15b[_0x0949('0x48')]=_0x2ce15b[_0x0949('0x48')][_0x0949('0x69')]?_0x2ce15b[_0x0949('0x48')]:_0x15d635['model'];_0x2ce15b[_0x0949('0x4c')]=qs[_0x0949('0x4d')](_0x167ca8['query'][_0x0949('0x4d')]);_0x2ce15b[_0x0949('0x4f')]=qs[_0x0949('0x46')](_[_0x0949('0x6a')](_0x167ca8[_0x0949('0x44')],_0x15d635[_0x0949('0x46')]));if(_0x167ca8[_0x0949('0x44')][_0x0949('0x4e')]){_0x2ce15b[_0x0949('0x4f')]=_[_0x0949('0x59')](_0x2ce15b[_0x0949('0x4f')],{'$or':_[_0x0949('0x3f')](_0x2ce15b[_0x0949('0x48')],function(_0x5d48bd){var _0x21ea16={};_0x21ea16[_0x5d48bd]={'$like':'%'+_0x167ca8[_0x0949('0x44')][_0x0949('0x4e')]+'%'};return _0x21ea16;})});}_0x2ce15b=_['merge']({},_0x2ce15b,_0x167ca8[_0x0949('0x51')]);return _0xfd2e11[_0x0949('0x81')](_0x2ce15b);}})['then'](function(_0x59120a){if(_0x59120a){_0x8c861e=_0x59120a[_0x0949('0x69')];if(!_0x167ca8['query'][_0x0949('0x4a')](_0x0949('0x4b'))){_0x2ce15b[_0x0949('0x30')]=qs[_0x0949('0x30')](_0x167ca8[_0x0949('0x44')][_0x0949('0x30')]);_0x2ce15b['offset']=qs[_0x0949('0x2f')](_0x167ca8['query'][_0x0949('0x2f')]);}return _0xfd2e11[_0x0949('0x81')](_0x2ce15b);}})[_0x0949('0x1e')](function(_0x31adbc){if(_0x31adbc){return _0x31adbc?{'count':_0x8c861e,'rows':_0x31adbc}:null;}})['then'](respondWithResult(_0x52eb96,null))[_0x0949('0x57')](handleError(_0x52eb96,null));};exports[_0x0949('0x82')]=function(_0x4f9205,_0x4532e3,_0x327eaa){var _0x20bff4={'channel':_0x0949('0x83')};var _0x3c49f3=[];var _0x4e9426=[];var _0x9a0a7b={};return db[_0x0949('0x54')][_0x0949('0x5a')]({'where':{'id':_0x4f9205['params']['id']},'include':[{'model':db[_0x0949('0x7d')],'as':_0x0949('0x84')}]})[_0x0949('0x1e')](handleEntityNotFound(_0x4532e3,null))['then'](function(_0x2a9232){_0x20bff4[_0x0949('0x85')]=_0x2a9232;if(_0x20bff4[_0x0949('0x85')]&&_0x20bff4[_0x0949('0x85')][_0x0949('0x42')]===_0x0949('0x86')&&_0x4f9205[_0x0949('0x5c')][_0x0949('0x87')]){if(_0x4f9205[_0x0949('0x5c')]['statuses'][_0x0949('0x69')]===0x0)return;if(_0x4f9205[_0x0949('0x5c')][_0x0949('0x87')][0x0][_0x0949('0x88')]!=='read')return;return db[_0x0949('0x89')]['update']({'read':!![],'readAt':_0x4f9205[_0x0949('0x5c')][_0x0949('0x87')][0x0]['timestamp']},{'where':{'messageId':_0x4f9205['body'][_0x0949('0x87')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x5078ec){return _0x4532e3['status'](0xc8)[_0x0949('0x2c')](_0x5078ec);});}_0x20bff4['applications']=_[_0x0949('0x8a')](_0x2a9232[_0x0949('0x84')],[_0x0949('0x7f')],[_0x0949('0x8b')]);if(_0x20bff4['account'][_0x0949('0x84')]){delete _0x20bff4[_0x0949('0x85')][_0x0949('0x84')];}return db[_0x0949('0x8c')]['describe']()[_0x0949('0x1e')](function(_0x4a8cef){if(!_0x4a8cef){throw new db['Sequelize'][(_0x0949('0x8d'))](_0x0949('0x8e'));}_0x3c49f3=_[_0x0949('0x8f')](_['keys'](_0x4a8cef),[_0x0949('0x90'),_0x0949('0x91')]);_0x4e9426=_[_0x0949('0x8f')](_[_0x0949('0x45')](_0x4a8cef),[_0x0949('0x90'),'updatedAt',_0x0949('0x92'),_0x0949('0x93')]);_0x20bff4[_0x0949('0x5c')]={'mapKey':_0x0949('0x94')};if(_0x20bff4[_0x0949('0x85')]&&_0x20bff4[_0x0949('0x85')][_0x0949('0x42')]==='twilio'){_0x20bff4[_0x0949('0x5c')][_0x0949('0x95')]=_0x4f9205[_0x0949('0x5c')]['From']['replace'](_0x0949('0x96'),'');_0x20bff4[_0x0949('0x5c')]['body']=_0x4f9205[_0x0949('0x5c')]['Body'];_0x20bff4[_0x0949('0x5c')][_0x0949('0x97')]=_0x4f9205[_0x0949('0x5c')]['MessageSid'];}if(_0x20bff4['account']&&_0x20bff4[_0x0949('0x85')][_0x0949('0x42')]===_0x0949('0x86')){_0x20bff4['body'][_0x0949('0x95')]=_0x4f9205[_0x0949('0x5c')][_0x0949('0x98')][0x0][_0x0949('0x95')];_0x20bff4[_0x0949('0x5c')][_0x0949('0x5c')]=_0x4f9205[_0x0949('0x5c')]['notifications'][0x0][_0x0949('0x27')]['body'];_0x20bff4[_0x0949('0x5c')][_0x0949('0x97')]=_0x4f9205['body'][_0x0949('0x98')][0x0][_0x0949('0x99')];}if(_0x20bff4['body']['id']){delete _0x20bff4[_0x0949('0x5c')]['id'];}if(_['isNil'](_0x20bff4[_0x0949('0x5c')][_0x0949('0x95')])){throw new db[(_0x0949('0x9a'))][(_0x0949('0x8d'))]('from\x20is\x20mandatory');}if(_[_0x0949('0x9b')](_0x20bff4[_0x0949('0x5c')][_0x0949('0x5c')])||_0x20bff4[_0x0949('0x5c')][_0x0949('0x5c')]===''){throw new db[(_0x0949('0x9a'))]['ValidationError'](_0x0949('0x9c'));}if(_[_0x0949('0x9b')](_0x20bff4[_0x0949('0x5c')][_0x0949('0x9d')])){throw new db['Sequelize'][(_0x0949('0x8d'))](_0x0949('0x9e')+_0x4e9426);}if(!_[_0x0949('0x9f')](_0x4e9426,_0x20bff4['body'][_0x0949('0x9d')])){throw new db[(_0x0949('0x9a'))]['ValidationError'](_0x0949('0xa0')+_0x4e9426);}_0x9a0a7b[_0x20bff4['body'][_0x0949('0x9d')]]=_0x20bff4[_0x0949('0x5c')][_0x0949('0x95')];return db[_0x0949('0xa1')]['find']({'where':{'id':_0x20bff4['account'][_0x0949('0x93')]},'include':[{'model':db[_0x0949('0x8c')],'as':_0x0949('0xa2'),'where':_0x9a0a7b,'limit':0x1,'order':[[_0x0949('0x91'),'DESC']]}]});})[_0x0949('0x1e')](handleEntityNotFound(_0x4532e3,null))[_0x0949('0x1e')](function(_0x3ba391){if(_0x3ba391){_0x20bff4['list']=_[_0x0949('0x72')](_0x3ba391,[_0x0949('0xa2')]);if(_0x3ba391['Contacts']['length']){return _0x3ba391[_0x0949('0xa2')][0x0];}var _0x288b74=_[_0x0949('0x19')](_0x20bff4['body'],{'firstName':_0x20bff4[_0x0949('0x5c')][_0x0949('0x95')],'ListId':_0x3ba391['id']});_0x288b74[_0x20bff4[_0x0949('0x5c')][_0x0949('0x9d')]]=_0x20bff4[_0x0949('0x5c')][_0x0949('0x95')];return db[_0x0949('0x8c')]['create'](_0x288b74,{'fields':_0x3c49f3,'raw':!![]});}})[_0x0949('0x1e')](handleEntityNotFound(_0x4532e3,null))['then'](function(_0x4170c3){if(_0x4170c3){_0x20bff4[_0x0949('0xa3')]=_0x4170c3;var _0x30b0d1={'ContactId':_0x4170c3['id'],'phone':_0x20bff4[_0x0949('0x5c')]['from'],'WhatsappAccountId':_0x4f9205[_0x0949('0x63')]['id']};var _0x103dd8={'ContactId':_0x4170c3['id'],'WhatsappAccountId':_0x4f9205[_0x0949('0x63')]['id'],'closed':![]};return db[_0x0949('0xa4')]['find']({'where':_0x103dd8})[_0x0949('0x1e')](function(_0x538113){if(_0x538113){return[_0x538113,![]];}return db['WhatsappInteraction'][_0x0949('0x5b')](_0x30b0d1)[_0x0949('0x1e')](function(_0x309eb8){return[_0x309eb8,!![]];});});}})[_0x0949('0x73')](function(_0x2b6d7d,_0x335f5d){_0x20bff4[_0x0949('0xa5')]=_0x2b6d7d[_0x0949('0x38')]({'plain':!![]});_0x20bff4['interaction']['created']=![];if(_0x335f5d){if(_0x20bff4[_0x0949('0x85')]['autoclose']){_0x20bff4[_0x0949('0xa6')]['push']({'id':0x0,'priority':_0x20bff4['applications'][_0x0949('0x69')]+0x1,'app':_0x0949('0xa7'),'appdata':_0x0949('0xa8'),'interval':_0x0949('0xa9')});}_0x20bff4[_0x0949('0xa5')]['created']=!![];}return db[_0x0949('0x89')][_0x0949('0x5b')]({'phone':_0x20bff4['body']['from'],'messageId':_0x20bff4['body']['messageId'],'body':_0x20bff4[_0x0949('0x5c')]['body'],'WhatsappAccountId':_0x4f9205[_0x0949('0x63')]['id'],'WhatsappInteractionId':_0x2b6d7d['id'],'direction':'in','ContactId':_0x2b6d7d[_0x0949('0xaa')],'AttachmentId':_0x20bff4['body'][_0x0949('0xab')]});})[_0x0949('0x1e')](function(_0x54c1ff){_0x20bff4[_0x0949('0x27')]=_0x54c1ff;if(!_0x20bff4[_0x0949('0xa5')][_0x0949('0xac')])return;return db[_0x0949('0xad')][_0x0949('0x5a')]({'attributes':['id',_0x0949('0x3b')],'where':{'id':_0x20bff4[_0x0949('0xa5')][_0x0949('0xac')]}});})[_0x0949('0x1e')](function(_0x10bac5){if(_0x10bac5){_0x20bff4['applications'][_0x0949('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10bac5[_0x0949('0x3b')]+','+(_0x20bff4[_0x0949('0x85')][_0x0949('0xaf')]||0xa),'interval':_0x0949('0xa9')});}if(!_0x20bff4['interaction'][_0x0949('0xb0')])return;return db[_0x0949('0xb1')][_0x0949('0x5a')]({'attributes':['id',_0x0949('0x3b')],'where':{'id':_0x20bff4['interaction'][_0x0949('0xb0')]}});})['then'](function(_0x5e30d9){if(_0x5e30d9){_0x20bff4[_0x0949('0xa6')][_0x0949('0xae')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5e30d9[_0x0949('0x3b')]+','+(_0x20bff4['account'][_0x0949('0xb2')]||0x12c),'interval':_0x0949('0xa9')});}return respondWithRpcPromise(_0x0949('0xb3'),'startRouting',_0x20bff4);})[_0x0949('0x1e')](function(_0x190b5c){if(_0x190b5c){var _0xbc1612=0xc8;var _0x49453d=_0x0949('0xb4');logger['info'](_0x0949('0x23'),_0x49453d,_0xbc1612,_0x0949('0xb5'));logger[_0x0949('0x22')](_0x0949('0xb6'),_0x49453d,_0xbc1612,_0x0949('0xb5'),JSON[_0x0949('0x24')](_0x190b5c));if(_0x20bff4['account'][_0x0949('0x42')]===_0x0949('0xb7')){return _0x4532e3[_0x0949('0x2a')](_0xbc1612)[_0x0949('0x31')](_0x0949('0xb8'),'text/xml')['send']('\x0a');}else{return _0x4532e3[_0x0949('0x2a')](_0xbc1612)[_0x0949('0x2c')](_0x190b5c);}}});})['catch'](handleError(_0x4532e3,null));};exports['send']=function(_0x103cb1,_0x242829,_0x49705c){var _0x5d3f75,_0x26fcab,_0x133340;if(_[_0x0949('0x9b')](_0x103cb1[_0x0949('0x5c')]['body'])||_0x103cb1['body']['body']===''){throw new db[(_0x0949('0x9a'))][(_0x0949('0x8d'))](_0x0949('0x9c'));}if(_[_0x0949('0x9b')](_0x103cb1[_0x0949('0x5c')]['to'])){throw new db['Sequelize'][(_0x0949('0x8d'))](_0x0949('0xb9'));}_0x5d3f75=_0x103cb1[_0x0949('0x5c')]['to'];return db[_0x0949('0x54')]['find']({'where':{'id':_0x103cb1[_0x0949('0x63')]['id']},'include':[{'model':db[_0x0949('0xa1')],'as':_0x0949('0xba'),'include':[{'model':db[_0x0949('0x8c')],'as':_0x0949('0xa2'),'where':{'mobile':_0x5d3f75},'limit':0x1,'order':[[_0x0949('0x91'),_0x0949('0xbb')]]}]}]})[_0x0949('0x1e')](handleEntityNotFound(_0x242829,null))[_0x0949('0x1e')](function(_0x541122){if(_0x541122&&_0x541122[_0x0949('0xba')]){_0x26fcab=_0x541122['get']({'plain':!![]});if(_0x26fcab[_0x0949('0xba')]&&_0x26fcab['List']['Contacts'][_0x0949('0x69')]){return _0x26fcab[_0x0949('0xba')]['Contacts'][0x0];}return db[_0x0949('0x8c')]['create'](_['defaults'](_0x103cb1[_0x0949('0x5c')],{'firstName':_0x5d3f75,'mobile':_0x5d3f75,'phone':_0x5d3f75,'ListId':_0x26fcab['ListId']}));}})['then'](handleEntityNotFound(_0x242829,null))[_0x0949('0x1e')](function(_0x27cb9c){if(_0x27cb9c){_0x133340=_0x27cb9c;return db[_0x0949('0xa4')]['find']({'where':{'ContactId':_0x133340['id'],'closed':![],'WhatsappAccountId':_0x26fcab['id']}})[_0x0949('0x1e')](function(_0x411363){if(_0x411363){return[_0x411363,![]];}return db[_0x0949('0xa4')][_0x0949('0x5b')]({'UserId':_0x103cb1['user']['id'],'ContactId':_0x133340['id'],'WhatsappAccountId':_0x26fcab['id'],'phone':_0x5d3f75,'firstMsgDirection':'out','Messages':[_['merge'](_0x103cb1[_0x0949('0x5c')],{'read':![],'body':_0x103cb1[_0x0949('0x5c')][_0x0949('0x5c')],'phone':_0x5d3f75,'WhatsappAccountId':_0x26fcab['id'],'UserId':_0x103cb1[_0x0949('0x5d')]['id'],'ContactId':_0x133340['id']})]},{'include':[{'model':db[_0x0949('0x89')],'as':'Messages'}]})[_0x0949('0x1e')](function(_0x5c4607){return[_0x5c4607,!![]];});});}})[_0x0949('0x73')](function(_0x170ad4,_0xb4eed2){if(_0xb4eed2){return _0x170ad4;}return db[_0x0949('0x89')][_0x0949('0x5b')](_['merge'](_0x103cb1[_0x0949('0x5c')],{'read':![],'body':_0x103cb1[_0x0949('0x5c')][_0x0949('0x5c')],'phone':_0x5d3f75,'WhatsappAccountId':_0x26fcab['id'],'WhatsappInteractionId':_0x170ad4['id'],'UserId':_0x103cb1['user']['id'],'ContactId':_0x133340['id']}))[_0x0949('0x1e')](function(_0x5aad89){_0x170ad4[_0x0949('0xbc')][_0x0949('0xbd')]=[];_0x170ad4['dataValues'][_0x0949('0xbd')][_0x0949('0xbe')](_0x5aad89['dataValues']);return _0x170ad4;});})[_0x0949('0x1e')](respondWithResult(_0x242829,null))['catch'](handleError(_0x242829,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index cc7d01d..2475109 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 _0x0882=['emit','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x3f4bc1,_0x15ace5){var _0x46fcf6=function(_0x3a19c1){while(--_0x3a19c1){_0x3f4bc1['push'](_0x3f4bc1['shift']());}};_0x46fcf6(++_0x15ace5);}(_0x0882,0x1ad));var _0x2088=function(_0x45afc1,_0x52a029){_0x45afc1=_0x45afc1-0x0;var _0x182539=_0x0882[_0x45afc1];return _0x182539;};'use strict';var EventEmitter=require(_0x2088('0x0'));var WhatsappAccount=require(_0x2088('0x1'))['db'][_0x2088('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2088('0x3')](0x0);var events={'afterCreate':_0x2088('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d7bf8){return function(_0x7543a7,_0xdd12dc,_0x842cf0){WhatsappAccountEvents[_0x2088('0x5')](_0x1d7bf8+':'+_0x7543a7['id'],_0x7543a7);WhatsappAccountEvents[_0x2088('0x5')](_0x1d7bf8,_0x7543a7);_0x842cf0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x2088('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x8129=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x4c8232,_0x4e0dea){var _0x3cc8e5=function(_0x248561){while(--_0x248561){_0x4c8232['push'](_0x4c8232['shift']());}};_0x3cc8e5(++_0x4e0dea);}(_0x8129,0x13f));var _0x9812=function(_0x2a2890,_0x22b0fc){_0x2a2890=_0x2a2890-0x0;var _0x53d497=_0x8129[_0x2a2890];return _0x53d497;};'use strict';var EventEmitter=require(_0x9812('0x0'));var WhatsappAccount=require(_0x9812('0x1'))['db'][_0x9812('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9812('0x3')](0x0);var events={'afterCreate':_0x9812('0x4'),'afterUpdate':'update','afterDestroy':_0x9812('0x5')};function emitEvent(_0x457200){return function(_0x1b8bde,_0x2ab782,_0x2cd29f){WhatsappAccountEvents[_0x9812('0x6')](_0x457200+':'+_0x1b8bde['id'],_0x1b8bde);WhatsappAccountEvents[_0x9812('0x6')](_0x457200,_0x1b8bde);_0x2cd29f(null);};}for(var e in events){if(events[_0x9812('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x9812('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e35d2f7..f8eb533 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 _0x61b7=['moment','bluebird','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger'];(function(_0x2a4e87,_0x132598){var _0x20acdc=function(_0x1e8132){while(--_0x1e8132){_0x2a4e87['push'](_0x2a4e87['shift']());}};_0x20acdc(++_0x132598);}(_0x61b7,0x166));var _0x761b=function(_0x1fd100,_0x5afdff){_0x1fd100=_0x1fd100-0x0;var _0x37b232=_0x61b7[_0x1fd100];return _0x37b232;};'use strict';var _=require(_0x761b('0x0'));var util=require('util');var logger=require(_0x761b('0x1'))('api');var moment=require(_0x761b('0x2'));var BPromise=require(_0x761b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x761b('0x4'));var config=require(_0x761b('0x5'));var attributes=require(_0x761b('0x6'));module['exports']=function(_0x26b809,_0x9f0ae6){return _0x26b809[_0x761b('0x7')](_0x761b('0x8'),attributes,{'tableName':_0x761b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe84a=['rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x29615d,_0x352029){var _0x53336c=function(_0x2cd2d5){while(--_0x2cd2d5){_0x29615d['push'](_0x29615d['shift']());}};_0x53336c(++_0x352029);}(_0xe84a,0x1d4));var _0xae84=function(_0x323116,_0x5ced14){_0x323116=_0x323116-0x0;var _0x14b3ea=_0xe84a[_0x323116];return _0x14b3ea;};'use strict';var _=require(_0xae84('0x0'));var util=require(_0xae84('0x1'));var logger=require(_0xae84('0x2'))(_0xae84('0x3'));var moment=require(_0xae84('0x4'));var BPromise=require(_0xae84('0x5'));var rp=require(_0xae84('0x6'));var fs=require('fs');var path=require(_0xae84('0x7'));var rimraf=require(_0xae84('0x8'));var config=require('../../config/environment');var attributes=require(_0xae84('0x9'));module[_0xae84('0xa')]=function(_0x24f650,_0x4f1bf4){return _0x24f650[_0xae84('0xb')](_0xae84('0xc'),attributes,{'tableName':_0xae84('0xd'),'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 3f5b2be..f5134b0 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 _0x2eb0=['attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x2eb0,0x155));var _0x02eb=function(_0x5c5f14,_0x1c7f28){_0x5c5f14=_0x5c5f14-0x0;var _0x5e7378=_0x2eb0[_0x5c5f14];return _0x5e7378;};'use strict';var _=require(_0x02eb('0x0'));var util=require(_0x02eb('0x1'));var moment=require(_0x02eb('0x2'));var BPromise=require(_0x02eb('0x3'));var rs=require(_0x02eb('0x4'));var fs=require('fs');var Redis=require(_0x02eb('0x5'));var db=require(_0x02eb('0x6'))['db'];var utils=require(_0x02eb('0x7'));var logger=require(_0x02eb('0x8'))('rpc');var config=require(_0x02eb('0x9'));var jayson=require(_0x02eb('0xa'));var client=jayson[_0x02eb('0xb')][_0x02eb('0xc')]({'port':0x232a});config['redis']=_[_0x02eb('0xd')](config[_0x02eb('0xe')],{'host':_0x02eb('0xf'),'port':0x18eb});var socket=require(_0x02eb('0x10'))(new Redis(config[_0x02eb('0xe')]));require(_0x02eb('0x11'))[_0x02eb('0x12')](socket);function respondWithRpcPromise(_0x164568,_0x12e2ff,_0x2f6c31){return new BPromise(function(_0xc91846,_0x4e8fbe){return client[_0x02eb('0x13')](_0x164568,_0x2f6c31)[_0x02eb('0x14')](function(_0x594cdb){logger[_0x02eb('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x12e2ff,_0x02eb('0x16'));logger[_0x02eb('0x17')](_0x02eb('0x18'),_0x12e2ff,'request\x20sent',JSON[_0x02eb('0x19')](_0x594cdb));if(_0x594cdb['error']){if(_0x594cdb[_0x02eb('0x1a')][_0x02eb('0x1b')]===0x1f4){logger[_0x02eb('0x1a')](_0x02eb('0x1c'),_0x12e2ff,_0x594cdb[_0x02eb('0x1a')][_0x02eb('0x1d')]);return _0x4e8fbe(_0x594cdb[_0x02eb('0x1a')][_0x02eb('0x1d')]);}logger[_0x02eb('0x1a')](_0x02eb('0x1c'),_0x12e2ff,_0x594cdb[_0x02eb('0x1a')][_0x02eb('0x1d')]);return _0xc91846(_0x594cdb[_0x02eb('0x1a')]['message']);}else{logger[_0x02eb('0x15')](_0x02eb('0x1c'),_0x12e2ff,_0x02eb('0x16'));_0xc91846(_0x594cdb[_0x02eb('0x1e')][_0x02eb('0x1d')]);}})['catch'](function(_0x3ab2c9){logger[_0x02eb('0x1a')]('WhatsappAccount,\x20%s,\x20%s',_0x12e2ff,_0x3ab2c9);_0x4e8fbe(_0x3ab2c9);});});}exports[_0x02eb('0x1f')]=function(_0x5d40b5){var _0x484816=this;return new Promise(function(_0x2527ad,_0x537c84){return db[_0x02eb('0x20')][_0x02eb('0x21')]({'raw':_0x5d40b5[_0x02eb('0x22')]?_0x5d40b5[_0x02eb('0x22')][_0x02eb('0x23')]===undefined?!![]:![]:!![],'where':_0x5d40b5[_0x02eb('0x22')]?_0x5d40b5[_0x02eb('0x22')][_0x02eb('0x24')]||null:null,'attributes':_0x5d40b5[_0x02eb('0x22')]?_0x5d40b5[_0x02eb('0x22')][_0x02eb('0x25')]||null:null,'include':_0x5d40b5[_0x02eb('0x22')]?_0x5d40b5[_0x02eb('0x22')][_0x02eb('0x26')]?_[_0x02eb('0x27')](_0x5d40b5[_0x02eb('0x22')]['include'],function(_0x2c3bfb){return{'model':db[_0x2c3bfb[_0x02eb('0x28')]],'as':_0x2c3bfb['as'],'attributes':_0x2c3bfb[_0x02eb('0x25')],'include':_0x2c3bfb[_0x02eb('0x26')]?_['map'](_0x2c3bfb[_0x02eb('0x26')],function(_0x2a8ed1){return{'model':db[_0x2a8ed1['model']],'as':_0x2a8ed1['as'],'attributes':_0x2a8ed1['attributes'],'include':_0x2a8ed1['include']?_[_0x02eb('0x27')](_0x2a8ed1[_0x02eb('0x26')],function(_0x1a6ec0){return{'model':db[_0x1a6ec0['model']],'as':_0x1a6ec0['as'],'attributes':_0x1a6ec0[_0x02eb('0x25')]};}):[]};}):[]};}):[]:[]})[_0x02eb('0x14')](function(_0x5a24a9){logger[_0x02eb('0x15')](_0x02eb('0x1f'),_0x5d40b5);logger['debug'](_0x02eb('0x1f'),_0x5d40b5,JSON[_0x02eb('0x19')](_0x5a24a9));_0x2527ad(_0x5a24a9);})[_0x02eb('0x29')](function(_0x556c89){logger[_0x02eb('0x1a')](_0x02eb('0x1f'),_0x556c89['message'],_0x5d40b5);_0x537c84(_0x484816[_0x02eb('0x1a')](0x1f4,_0x556c89[_0x02eb('0x1d')]));});});}; \ No newline at end of file +var _0x467e=['jayson/promise','redis','defaults','socket.io-emitter','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x282d28,_0x39bdc4){var _0x5e7073=function(_0xcb228f){while(--_0xcb228f){_0x282d28['push'](_0x282d28['shift']());}};_0x5e7073(++_0x39bdc4);}(_0x467e,0x121));var _0xe467=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x467e[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0xe467('0x0'));var util=require(_0xe467('0x1'));var moment=require(_0xe467('0x2'));var BPromise=require('bluebird');var rs=require(_0xe467('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe467('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe467('0x5'))(_0xe467('0x6'));var config=require(_0xe467('0x7'));var jayson=require(_0xe467('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xe467('0x9')]=_[_0xe467('0xa')](config[_0xe467('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe467('0xb'))(new Redis(config[_0xe467('0x9')]));require('./whatsappAccount.socket')[_0xe467('0xc')](socket);function respondWithRpcPromise(_0x3fb58d,_0xa3b91a,_0x17640f){return new BPromise(function(_0x3f1ee4,_0x59caca){return client[_0xe467('0xd')](_0x3fb58d,_0x17640f)[_0xe467('0xe')](function(_0x45be0d){logger['info'](_0xe467('0xf'),_0xa3b91a,_0xe467('0x10'));logger[_0xe467('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa3b91a,_0xe467('0x10'),JSON[_0xe467('0x12')](_0x45be0d));if(_0x45be0d[_0xe467('0x13')]){if(_0x45be0d[_0xe467('0x13')]['code']===0x1f4){logger[_0xe467('0x13')](_0xe467('0xf'),_0xa3b91a,_0x45be0d[_0xe467('0x13')][_0xe467('0x14')]);return _0x59caca(_0x45be0d['error'][_0xe467('0x14')]);}logger['error'](_0xe467('0xf'),_0xa3b91a,_0x45be0d[_0xe467('0x13')][_0xe467('0x14')]);return _0x3f1ee4(_0x45be0d[_0xe467('0x13')][_0xe467('0x14')]);}else{logger[_0xe467('0x15')](_0xe467('0xf'),_0xa3b91a,'request\x20sent');_0x3f1ee4(_0x45be0d['result'][_0xe467('0x14')]);}})[_0xe467('0x16')](function(_0x5eefe0){logger[_0xe467('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xa3b91a,_0x5eefe0);_0x59caca(_0x5eefe0);});});}exports[_0xe467('0x17')]=function(_0xf288f2){var _0x3da597=this;return new Promise(function(_0x133f94,_0x45fa44){return db[_0xe467('0x18')][_0xe467('0x19')]({'raw':_0xf288f2['options']?_0xf288f2[_0xe467('0x1a')][_0xe467('0x1b')]===undefined?!![]:![]:!![],'where':_0xf288f2[_0xe467('0x1a')]?_0xf288f2['options'][_0xe467('0x1c')]||null:null,'attributes':_0xf288f2['options']?_0xf288f2[_0xe467('0x1a')][_0xe467('0x1d')]||null:null,'include':_0xf288f2[_0xe467('0x1a')]?_0xf288f2[_0xe467('0x1a')][_0xe467('0x1e')]?_[_0xe467('0x1f')](_0xf288f2[_0xe467('0x1a')][_0xe467('0x1e')],function(_0x4ae01b){return{'model':db[_0x4ae01b[_0xe467('0x20')]],'as':_0x4ae01b['as'],'attributes':_0x4ae01b[_0xe467('0x1d')],'include':_0x4ae01b[_0xe467('0x1e')]?_[_0xe467('0x1f')](_0x4ae01b['include'],function(_0x2694c8){return{'model':db[_0x2694c8[_0xe467('0x20')]],'as':_0x2694c8['as'],'attributes':_0x2694c8[_0xe467('0x1d')],'include':_0x2694c8[_0xe467('0x1e')]?_[_0xe467('0x1f')](_0x2694c8[_0xe467('0x1e')],function(_0x699bee){return{'model':db[_0x699bee[_0xe467('0x20')]],'as':_0x699bee['as'],'attributes':_0x699bee['attributes']};}):[]};}):[]};}):[]:[]})[_0xe467('0xe')](function(_0x61b1e0){logger['info'](_0xe467('0x17'),_0xf288f2);logger[_0xe467('0x11')](_0xe467('0x17'),_0xf288f2,JSON[_0xe467('0x12')](_0x61b1e0));_0x133f94(_0x61b1e0);})['catch'](function(_0x67ef1d){logger[_0xe467('0x13')](_0xe467('0x17'),_0x67ef1d[_0xe467('0x14')],_0xf288f2);_0x45fa44(_0x3da597[_0xe467('0x13')](0x1f4,_0x67ef1d[_0xe467('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 634f25a..5b6e4ca 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 _0x1fb6=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x1fb6,0x9e));var _0x61fb=function(_0x5d75c2,_0xb96912){_0x5d75c2=_0x5d75c2-0x0;var _0x43f973=_0x1fb6[_0x5d75c2];return _0x43f973;};'use strict';var WhatsappAccountEvents=require(_0x61fb('0x0'));var events=[_0x61fb('0x1'),'remove',_0x61fb('0x2')];function createListener(_0xecc447,_0x15d0ec){return function(_0x182728){_0x15d0ec[_0x61fb('0x3')](_0xecc447,_0x182728);};}function removeListener(_0x30c1e0,_0x13a12b){return function(){WhatsappAccountEvents[_0x61fb('0x4')](_0x30c1e0,_0x13a12b);};}exports[_0x61fb('0x5')]=function(_0x4300e3){for(var _0x490532=0x0,_0xf75b81=events[_0x61fb('0x6')];_0x490532<_0xf75b81;_0x490532++){var _0x194bed=events[_0x490532];var _0x326a2a=createListener(_0x61fb('0x7')+_0x194bed,_0x4300e3);WhatsappAccountEvents['on'](_0x194bed,_0x326a2a);}}; \ No newline at end of file +var _0x6ec2=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0x6ec2,0xb4));var _0x26ec=function(_0x433766,_0x49e912){_0x433766=_0x433766-0x0;var _0x48dba8=_0x6ec2[_0x433766];return _0x48dba8;};'use strict';var WhatsappAccountEvents=require(_0x26ec('0x0'));var events=[_0x26ec('0x1'),_0x26ec('0x2'),_0x26ec('0x3')];function createListener(_0x5e7e23,_0x145aa7){return function(_0x42c613){_0x145aa7['emit'](_0x5e7e23,_0x42c613);};}function removeListener(_0x56662d,_0x14584c){return function(){WhatsappAccountEvents[_0x26ec('0x4')](_0x56662d,_0x14584c);};}exports[_0x26ec('0x5')]=function(_0x14be40){for(var _0x17bebd=0x0,_0x16955e=events[_0x26ec('0x6')];_0x17bebd<_0x16955e;_0x17bebd++){var _0x11d8d6=events[_0x17bebd];var _0x53deee=createListener(_0x26ec('0x7')+_0x11d8d6,_0x14be40);WhatsappAccountEvents['on'](_0x11d8d6,_0x53deee);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index df20b79..a3bae7c 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 _0x29de=['index','show','post','create','put','/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x2641a5,_0x43b2a3){var _0x3d2409=function(_0x6ff937){while(--_0x6ff937){_0x2641a5['push'](_0x2641a5['shift']());}};_0x3d2409(++_0x43b2a3);}(_0x29de,0x1be));var _0xe29d=function(_0x263cbc,_0x77e13a){_0x263cbc=_0x263cbc-0x0;var _0x52da29=_0x29de[_0x263cbc];return _0x52da29;};'use strict';var multer=require(_0xe29d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe29d('0x1'));var express=require(_0xe29d('0x2'));var router=express[_0xe29d('0x3')]();var fs_extra=require(_0xe29d('0x4'));var auth=require(_0xe29d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe29d('0x6'));var controller=require(_0xe29d('0x7'));router[_0xe29d('0x8')]('/',auth[_0xe29d('0x9')](),controller[_0xe29d('0xa')]);router[_0xe29d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe29d('0xb')]);router[_0xe29d('0xc')]('/',auth[_0xe29d('0x9')](),controller[_0xe29d('0xd')]);router[_0xe29d('0xe')](_0xe29d('0xf'),auth['isAuthenticated'](),controller[_0xe29d('0x10')]);router[_0xe29d('0x11')](_0xe29d('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xe29d('0x12')]=router; \ No newline at end of file +var _0x6a3f=['multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','post','isAuthenticated','create','put','update','delete','exports'];(function(_0x1331a4,_0x1aba4c){var _0x46d5a7=function(_0x354f1a){while(--_0x354f1a){_0x1331a4['push'](_0x1331a4['shift']());}};_0x46d5a7(++_0x1aba4c);}(_0x6a3f,0xaa));var _0xf6a3=function(_0x318e2a,_0x50e65d){_0x318e2a=_0x318e2a-0x0;var _0x111736=_0x6a3f[_0x318e2a];return _0x111736;};'use strict';var multer=require(_0xf6a3('0x0'));var util=require(_0xf6a3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf6a3('0x2'));var router=express[_0xf6a3('0x3')]();var fs_extra=require(_0xf6a3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf6a3('0x5'));var config=require(_0xf6a3('0x6'));var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf6a3('0x7')](_0xf6a3('0x8'),auth['isAuthenticated'](),controller[_0xf6a3('0x9')]);router[_0xf6a3('0xa')]('/',auth[_0xf6a3('0xb')](),controller[_0xf6a3('0xc')]);router[_0xf6a3('0xd')](_0xf6a3('0x8'),auth['isAuthenticated'](),controller[_0xf6a3('0xe')]);router[_0xf6a3('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf6a3('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 0ca7064..a069959 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 _0x793f=['INTEGER','noop','STRING','*,*,*,*'];(function(_0x289fa0,_0x300ad1){var _0x53c48c=function(_0x11513c){while(--_0x11513c){_0x289fa0['push'](_0x289fa0['shift']());}};_0x53c48c(++_0x300ad1);}(_0x793f,0x1c4));var _0xf793=function(_0xcf7425,_0x2ec7b4){_0xcf7425=_0xcf7425-0x0;var _0xd76b28=_0x793f[_0xcf7425];return _0xd76b28;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xf793('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf793('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf793('0x2')],'defaultValue':_0xf793('0x3')}}; \ No newline at end of file +var _0xce39=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x50d760,_0x586779){var _0x24aa96=function(_0x26dff4){while(--_0x26dff4){_0x50d760['push'](_0x50d760['shift']());}};_0x24aa96(++_0x586779);}(_0xce39,0x11e));var _0x9ce3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xce39[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x9ce3('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9ce3('0x1')],'allowNull':![],'defaultValue':_0x9ce3('0x2')},'appdata':{'type':Sequelize[_0x9ce3('0x3')]()},'description':{'type':Sequelize[_0x9ce3('0x1')]},'interval':{'type':Sequelize[_0x9ce3('0x1')],'defaultValue':_0x9ce3('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index d814e5e..4ac9ade 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 _0xbb8d=['then','destroy','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','update','body','params','find','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','apply','reject','save'];(function(_0x5725dd,_0x3b17c5){var _0xf46aad=function(_0x12d82e){while(--_0x12d82e){_0x5725dd['push'](_0x5725dd['shift']());}};_0xf46aad(++_0x3b17c5);}(_0xbb8d,0x146));var _0xdbb8=function(_0x50b5e9,_0x15da7a){_0x50b5e9=_0x50b5e9-0x0;var _0x3edd59=_0xbb8d[_0x50b5e9];return _0x3edd59;};'use strict';var emlformat=require(_0xdbb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbb8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdbb8('0x2'));var Mustache=require(_0xdbb8('0x3'));var util=require(_0xdbb8('0x4'));var path=require(_0xdbb8('0x5'));var sox=require(_0xdbb8('0x6'));var csv=require('to-csv');var ejs=require(_0xdbb8('0x7'));var fs=require('fs');var fs_extra=require(_0xdbb8('0x8'));var _=require(_0xdbb8('0x9'));var squel=require(_0xdbb8('0xa'));var crypto=require('crypto');var jsforce=require(_0xdbb8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdbb8('0xc'));var querystring=require(_0xdbb8('0xd'));var Papa=require('papaparse');var Redis=require(_0xdbb8('0xe'));var authService=require(_0xdbb8('0xf'));var qs=require(_0xdbb8('0x10'));var as=require(_0xdbb8('0x11'));var hardwareService=require(_0xdbb8('0x12'));var logger=require(_0xdbb8('0x13'))(_0xdbb8('0x14'));var utils=require(_0xdbb8('0x15'));var config=require(_0xdbb8('0x16'));var licenseUtil=require(_0xdbb8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a7002,_0x309fa3){_0x309fa3=_0x309fa3||0xcc;return function(_0x22596c){if(_0x22596c){return _0x2a7002[_0xdbb8('0x18')](_0x309fa3);}return _0x2a7002[_0xdbb8('0x19')](_0x309fa3)[_0xdbb8('0x1a')]();};}function respondWithResult(_0x28ee7f,_0x242952){_0x242952=_0x242952||0xc8;return function(_0x519b79){if(_0x519b79){return _0x28ee7f[_0xdbb8('0x19')](_0x242952)['json'](_0x519b79);}};}function respondWithFilteredResult(_0x2c6ac,_0x2723c7){return function(_0x2f3b5f){if(_0x2f3b5f){var _0x3180a7=typeof _0x2723c7[_0xdbb8('0x1b')]==='undefined'&&typeof _0x2723c7[_0xdbb8('0x1c')]==='undefined';var _0x56532a=_0x2f3b5f[_0xdbb8('0x1d')];var _0x51ed87=_0x3180a7?0x0:_0x2723c7[_0xdbb8('0x1b')];var _0x1e6803=_0x3180a7?_0x2f3b5f[_0xdbb8('0x1d')]:_0x2723c7[_0xdbb8('0x1b')]+_0x2723c7[_0xdbb8('0x1c')];var _0x229277;if(_0x1e6803>=_0x56532a){_0x1e6803=_0x56532a;_0x229277=0xc8;}else{_0x229277=0xce;}_0x2c6ac[_0xdbb8('0x19')](_0x229277);return _0x2c6ac[_0xdbb8('0x1e')]('Content-Range',_0x51ed87+'-'+_0x1e6803+'/'+_0x56532a)['json'](_0x2f3b5f);}return null;};}function patchUpdates(_0x4b5a99){return function(_0x11be8c){try{jsonpatch[_0xdbb8('0x1f')](_0x11be8c,_0x4b5a99,!![]);}catch(_0x1634b5){return BPromise[_0xdbb8('0x20')](_0x1634b5);}return _0x11be8c[_0xdbb8('0x21')]();};}function saveUpdates(_0x42dcf4,_0x423ffb){return function(_0xe26dfa){if(_0xe26dfa){return _0xe26dfa['update'](_0x42dcf4)[_0xdbb8('0x22')](function(_0x4090e7){return _0x4090e7;});}return null;};}function removeEntity(_0x3ea771,_0x5e58df){return function(_0xa2a177){if(_0xa2a177){return _0xa2a177[_0xdbb8('0x23')]()['then'](function(){_0x3ea771[_0xdbb8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x447af4,_0x21ef2c){return function(_0x1e4bfc){if(!_0x1e4bfc){_0x447af4[_0xdbb8('0x18')](0x194);}return _0x1e4bfc;};}function handleError(_0x582916,_0x581ee5){_0x581ee5=_0x581ee5||0x1f4;return function(_0x2db294){logger['error'](_0x2db294['stack']);if(_0x2db294[_0xdbb8('0x24')]){delete _0x2db294[_0xdbb8('0x24')];}_0x582916['status'](_0x581ee5)['send'](_0x2db294);};}exports[_0xdbb8('0x25')]=function(_0x2e907b,_0x4f2276){var _0x2331e2={},_0xf7e4ee={},_0x43064d={'count':0x0,'rows':[]};var _0x2b4506=_[_0xdbb8('0x26')](db[_0xdbb8('0x27')][_0xdbb8('0x28')],function(_0x379307){return{'name':_0x379307[_0xdbb8('0x29')],'type':_0x379307[_0xdbb8('0x2a')][_0xdbb8('0x2b')]};});_0xf7e4ee[_0xdbb8('0x2c')]=_[_0xdbb8('0x26')](_0x2b4506,_0xdbb8('0x24'));_0xf7e4ee['query']=_[_0xdbb8('0x2d')](_0x2e907b[_0xdbb8('0x2e')]);_0xf7e4ee[_0xdbb8('0x2f')]=_[_0xdbb8('0x30')](_0xf7e4ee['model'],_0xf7e4ee[_0xdbb8('0x2e')]);_0x2331e2[_0xdbb8('0x31')]=_[_0xdbb8('0x30')](_0xf7e4ee[_0xdbb8('0x2c')],qs[_0xdbb8('0x32')](_0x2e907b[_0xdbb8('0x2e')][_0xdbb8('0x32')]));_0x2331e2[_0xdbb8('0x31')]=_0x2331e2[_0xdbb8('0x31')]['length']?_0x2331e2['attributes']:_0xf7e4ee['model'];if(!_0x2e907b[_0xdbb8('0x2e')][_0xdbb8('0x33')](_0xdbb8('0x34'))){_0x2331e2['limit']=qs[_0xdbb8('0x1c')](_0x2e907b[_0xdbb8('0x2e')][_0xdbb8('0x1c')]);_0x2331e2['offset']=qs[_0xdbb8('0x1b')](_0x2e907b[_0xdbb8('0x2e')][_0xdbb8('0x1b')]);}_0x2331e2[_0xdbb8('0x35')]=qs['sort'](_0x2e907b[_0xdbb8('0x2e')][_0xdbb8('0x36')]);_0x2331e2[_0xdbb8('0x37')]=qs[_0xdbb8('0x2f')](_[_0xdbb8('0x38')](_0x2e907b[_0xdbb8('0x2e')],_0xf7e4ee['filters']),_0x2b4506);if(_0x2e907b[_0xdbb8('0x2e')][_0xdbb8('0x39')]){_0x2331e2[_0xdbb8('0x37')]=_[_0xdbb8('0x3a')](_0x2331e2[_0xdbb8('0x37')],{'$or':_[_0xdbb8('0x26')](_0x2b4506,function(_0x5ba008){if(_0x5ba008['type']!==_0xdbb8('0x3b')){var _0x418909={};_0x418909[_0x5ba008['name']]={'$like':'%'+_0x2e907b[_0xdbb8('0x2e')][_0xdbb8('0x39')]+'%'};return _0x418909;}})});}_0x2331e2=_['merge']({},_0x2331e2,_0x2e907b[_0xdbb8('0x3c')]);var _0x20d400={'where':_0x2331e2[_0xdbb8('0x37')]};return db['WhatsappApplication'][_0xdbb8('0x1d')](_0x20d400)[_0xdbb8('0x22')](function(_0x411365){_0x43064d['count']=_0x411365;if(_0x2e907b[_0xdbb8('0x2e')][_0xdbb8('0x3d')]){_0x2331e2[_0xdbb8('0x3e')]=[{'all':!![]}];}return db[_0xdbb8('0x27')][_0xdbb8('0x3f')](_0x2331e2);})[_0xdbb8('0x22')](function(_0xb615ca){_0x43064d[_0xdbb8('0x40')]=_0xb615ca;return _0x43064d;})[_0xdbb8('0x22')](respondWithFilteredResult(_0x4f2276,_0x2331e2))[_0xdbb8('0x41')](handleError(_0x4f2276,null));};exports[_0xdbb8('0x42')]=function(_0x220825,_0x5995ca){var _0x432415={'raw':!![],'where':{'id':_0x220825['params']['id']}},_0x263179={};_0x263179[_0xdbb8('0x2c')]=_[_0xdbb8('0x2d')](db['WhatsappApplication'][_0xdbb8('0x28')]);_0x263179[_0xdbb8('0x2e')]=_[_0xdbb8('0x2d')](_0x220825[_0xdbb8('0x2e')]);_0x263179[_0xdbb8('0x2f')]=_[_0xdbb8('0x30')](_0x263179['model'],_0x263179[_0xdbb8('0x2e')]);_0x432415[_0xdbb8('0x31')]=_[_0xdbb8('0x30')](_0x263179[_0xdbb8('0x2c')],qs['fields'](_0x220825[_0xdbb8('0x2e')][_0xdbb8('0x32')]));_0x432415[_0xdbb8('0x31')]=_0x432415['attributes']['length']?_0x432415[_0xdbb8('0x31')]:_0x263179[_0xdbb8('0x2c')];if(_0x220825[_0xdbb8('0x2e')][_0xdbb8('0x3d')]){_0x432415[_0xdbb8('0x3e')]=[{'all':!![]}];}_0x432415=_['merge']({},_0x432415,_0x220825[_0xdbb8('0x3c')]);return db[_0xdbb8('0x27')]['find'](_0x432415)[_0xdbb8('0x22')](handleEntityNotFound(_0x5995ca,null))[_0xdbb8('0x22')](respondWithResult(_0x5995ca,null))['catch'](handleError(_0x5995ca,null));};exports[_0xdbb8('0x43')]=function(_0x425ba1,_0x4542b1){return db[_0xdbb8('0x27')]['create'](_0x425ba1['body'],{})[_0xdbb8('0x22')](respondWithResult(_0x4542b1,0xc9))['catch'](handleError(_0x4542b1,null));};exports[_0xdbb8('0x44')]=function(_0x5ec10f,_0x5b6aad){if(_0x5ec10f[_0xdbb8('0x45')]['id']){delete _0x5ec10f[_0xdbb8('0x45')]['id'];}return db[_0xdbb8('0x27')]['find']({'where':{'id':_0x5ec10f[_0xdbb8('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b6aad,null))[_0xdbb8('0x22')](saveUpdates(_0x5ec10f[_0xdbb8('0x45')],null))[_0xdbb8('0x22')](respondWithResult(_0x5b6aad,null))[_0xdbb8('0x41')](handleError(_0x5b6aad,null));};exports['destroy']=function(_0xb7a59a,_0x382664){return db[_0xdbb8('0x27')][_0xdbb8('0x47')]({'where':{'id':_0xb7a59a[_0xdbb8('0x46')]['id']}})[_0xdbb8('0x22')](handleEntityNotFound(_0x382664,null))[_0xdbb8('0x22')](removeEntity(_0x382664,null))[_0xdbb8('0x41')](handleError(_0x382664,null));}; \ No newline at end of file +var _0xf954=['count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','WhatsappApplication','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x3ac69a,_0x3263ad){var _0x2f403b=function(_0x1cd460){while(--_0x1cd460){_0x3ac69a['push'](_0x3ac69a['shift']());}};_0x2f403b(++_0x3263ad);}(_0xf954,0x10e));var _0x4f95=function(_0x3b58c9,_0x1f46c3){_0x3b58c9=_0x3b58c9-0x0;var _0x5b653a=_0xf954[_0x3b58c9];return _0x5b653a;};'use strict';var emlformat=require(_0x4f95('0x0'));var rimraf=require(_0x4f95('0x1'));var zipdir=require(_0x4f95('0x2'));var jsonpatch=require(_0x4f95('0x3'));var rp=require(_0x4f95('0x4'));var moment=require(_0x4f95('0x5'));var BPromise=require(_0x4f95('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4f95('0x7'));var sox=require(_0x4f95('0x8'));var csv=require(_0x4f95('0x9'));var ejs=require(_0x4f95('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f95('0xb'));var squel=require(_0x4f95('0xc'));var crypto=require(_0x4f95('0xd'));var jsforce=require(_0x4f95('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4f95('0xf'));var Papa=require(_0x4f95('0x10'));var Redis=require(_0x4f95('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f95('0x12'));var logger=require(_0x4f95('0x13'))(_0x4f95('0x14'));var utils=require(_0x4f95('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4f95('0x16'));var db=require(_0x4f95('0x17'))['db'];function respondWithStatusCode(_0x424457,_0x4629d9){_0x4629d9=_0x4629d9||0xcc;return function(_0xefe2a2){if(_0xefe2a2){return _0x424457['sendStatus'](_0x4629d9);}return _0x424457[_0x4f95('0x18')](_0x4629d9)[_0x4f95('0x19')]();};}function respondWithResult(_0x39a456,_0x125249){_0x125249=_0x125249||0xc8;return function(_0x56d995){if(_0x56d995){return _0x39a456[_0x4f95('0x18')](_0x125249)[_0x4f95('0x1a')](_0x56d995);}};}function respondWithFilteredResult(_0x234adf,_0x57bbcd){return function(_0xfd3673){if(_0xfd3673){var _0x451dc2=typeof _0x57bbcd[_0x4f95('0x1b')]===_0x4f95('0x1c')&&typeof _0x57bbcd[_0x4f95('0x1d')]===_0x4f95('0x1c');var _0x2aa444=_0xfd3673[_0x4f95('0x1e')];var _0x235c03=_0x451dc2?0x0:_0x57bbcd[_0x4f95('0x1b')];var _0x5918ad=_0x451dc2?_0xfd3673[_0x4f95('0x1e')]:_0x57bbcd[_0x4f95('0x1b')]+_0x57bbcd[_0x4f95('0x1d')];var _0x2d2595;if(_0x5918ad>=_0x2aa444){_0x5918ad=_0x2aa444;_0x2d2595=0xc8;}else{_0x2d2595=0xce;}_0x234adf[_0x4f95('0x18')](_0x2d2595);return _0x234adf[_0x4f95('0x1f')](_0x4f95('0x20'),_0x235c03+'-'+_0x5918ad+'/'+_0x2aa444)[_0x4f95('0x1a')](_0xfd3673);}return null;};}function patchUpdates(_0xc449b4){return function(_0x50d3b0){try{jsonpatch[_0x4f95('0x21')](_0x50d3b0,_0xc449b4,!![]);}catch(_0xf70461){return BPromise[_0x4f95('0x22')](_0xf70461);}return _0x50d3b0[_0x4f95('0x23')]();};}function saveUpdates(_0x131436,_0xe47cd7){return function(_0xe49db2){if(_0xe49db2){return _0xe49db2[_0x4f95('0x24')](_0x131436)[_0x4f95('0x25')](function(_0x10cab5){return _0x10cab5;});}return null;};}function removeEntity(_0x21e3eb,_0x27a229){return function(_0x1e675c){if(_0x1e675c){return _0x1e675c['destroy']()[_0x4f95('0x25')](function(){_0x21e3eb[_0x4f95('0x18')](0xcc)[_0x4f95('0x19')]();});}};}function handleEntityNotFound(_0x34a4de,_0x3875fe){return function(_0x14ba9f){if(!_0x14ba9f){_0x34a4de[_0x4f95('0x26')](0x194);}return _0x14ba9f;};}function handleError(_0x49677d,_0x2154c4){_0x2154c4=_0x2154c4||0x1f4;return function(_0x50996d){logger[_0x4f95('0x27')](_0x50996d[_0x4f95('0x28')]);if(_0x50996d[_0x4f95('0x29')]){delete _0x50996d[_0x4f95('0x29')];}_0x49677d[_0x4f95('0x18')](_0x2154c4)['send'](_0x50996d);};}exports[_0x4f95('0x2a')]=function(_0x2dc278,_0x1cdd1b){var _0x6ff6c4={},_0x1ae268={},_0x73783a={'count':0x0,'rows':[]};var _0x2e33dc=_[_0x4f95('0x2b')](db['WhatsappApplication']['rawAttributes'],function(_0x5ea525){return{'name':_0x5ea525[_0x4f95('0x2c')],'type':_0x5ea525['type'][_0x4f95('0x2d')]};});_0x1ae268[_0x4f95('0x2e')]=_[_0x4f95('0x2b')](_0x2e33dc,_0x4f95('0x29'));_0x1ae268[_0x4f95('0x2f')]=_[_0x4f95('0x30')](_0x2dc278[_0x4f95('0x2f')]);_0x1ae268[_0x4f95('0x31')]=_['intersection'](_0x1ae268[_0x4f95('0x2e')],_0x1ae268[_0x4f95('0x2f')]);_0x6ff6c4[_0x4f95('0x32')]=_[_0x4f95('0x33')](_0x1ae268[_0x4f95('0x2e')],qs[_0x4f95('0x34')](_0x2dc278[_0x4f95('0x2f')][_0x4f95('0x34')]));_0x6ff6c4['attributes']=_0x6ff6c4[_0x4f95('0x32')][_0x4f95('0x35')]?_0x6ff6c4[_0x4f95('0x32')]:_0x1ae268[_0x4f95('0x2e')];if(!_0x2dc278[_0x4f95('0x2f')][_0x4f95('0x36')](_0x4f95('0x37'))){_0x6ff6c4[_0x4f95('0x1d')]=qs[_0x4f95('0x1d')](_0x2dc278[_0x4f95('0x2f')][_0x4f95('0x1d')]);_0x6ff6c4[_0x4f95('0x1b')]=qs[_0x4f95('0x1b')](_0x2dc278['query']['offset']);}_0x6ff6c4[_0x4f95('0x38')]=qs[_0x4f95('0x39')](_0x2dc278[_0x4f95('0x2f')][_0x4f95('0x39')]);_0x6ff6c4[_0x4f95('0x3a')]=qs['filters'](_['pick'](_0x2dc278[_0x4f95('0x2f')],_0x1ae268[_0x4f95('0x31')]),_0x2e33dc);if(_0x2dc278[_0x4f95('0x2f')][_0x4f95('0x3b')]){_0x6ff6c4[_0x4f95('0x3a')]=_[_0x4f95('0x3c')](_0x6ff6c4['where'],{'$or':_[_0x4f95('0x2b')](_0x2e33dc,function(_0x110470){if(_0x110470[_0x4f95('0x3d')]!==_0x4f95('0x3e')){var _0x203b19={};_0x203b19[_0x110470[_0x4f95('0x29')]]={'$like':'%'+_0x2dc278[_0x4f95('0x2f')]['filter']+'%'};return _0x203b19;}})});}_0x6ff6c4=_['merge']({},_0x6ff6c4,_0x2dc278['options']);var _0x5322db={'where':_0x6ff6c4[_0x4f95('0x3a')]};return db[_0x4f95('0x3f')]['count'](_0x5322db)['then'](function(_0x4b6009){_0x73783a[_0x4f95('0x1e')]=_0x4b6009;if(_0x2dc278[_0x4f95('0x2f')][_0x4f95('0x40')]){_0x6ff6c4[_0x4f95('0x41')]=[{'all':!![]}];}return db[_0x4f95('0x3f')]['findAll'](_0x6ff6c4);})[_0x4f95('0x25')](function(_0x2af149){_0x73783a[_0x4f95('0x42')]=_0x2af149;return _0x73783a;})[_0x4f95('0x25')](respondWithFilteredResult(_0x1cdd1b,_0x6ff6c4))[_0x4f95('0x43')](handleError(_0x1cdd1b,null));};exports[_0x4f95('0x44')]=function(_0x338d48,_0x10e8bf){var _0x2e133d={'raw':!![],'where':{'id':_0x338d48[_0x4f95('0x45')]['id']}},_0x572606={};_0x572606[_0x4f95('0x2e')]=_[_0x4f95('0x30')](db[_0x4f95('0x3f')][_0x4f95('0x46')]);_0x572606['query']=_['keys'](_0x338d48['query']);_0x572606[_0x4f95('0x31')]=_[_0x4f95('0x33')](_0x572606[_0x4f95('0x2e')],_0x572606['query']);_0x2e133d['attributes']=_[_0x4f95('0x33')](_0x572606[_0x4f95('0x2e')],qs[_0x4f95('0x34')](_0x338d48['query'][_0x4f95('0x34')]));_0x2e133d[_0x4f95('0x32')]=_0x2e133d['attributes']['length']?_0x2e133d[_0x4f95('0x32')]:_0x572606[_0x4f95('0x2e')];if(_0x338d48[_0x4f95('0x2f')][_0x4f95('0x40')]){_0x2e133d[_0x4f95('0x41')]=[{'all':!![]}];}_0x2e133d=_[_0x4f95('0x3c')]({},_0x2e133d,_0x338d48[_0x4f95('0x47')]);return db[_0x4f95('0x3f')][_0x4f95('0x48')](_0x2e133d)[_0x4f95('0x25')](handleEntityNotFound(_0x10e8bf,null))[_0x4f95('0x25')](respondWithResult(_0x10e8bf,null))['catch'](handleError(_0x10e8bf,null));};exports[_0x4f95('0x49')]=function(_0x23b029,_0x372e1b){return db[_0x4f95('0x3f')]['create'](_0x23b029[_0x4f95('0x4a')],{})[_0x4f95('0x25')](respondWithResult(_0x372e1b,0xc9))[_0x4f95('0x43')](handleError(_0x372e1b,null));};exports[_0x4f95('0x24')]=function(_0x3b66b8,_0x43c97b){if(_0x3b66b8['body']['id']){delete _0x3b66b8[_0x4f95('0x4a')]['id'];}return db[_0x4f95('0x3f')][_0x4f95('0x48')]({'where':{'id':_0x3b66b8[_0x4f95('0x45')]['id']}})[_0x4f95('0x25')](handleEntityNotFound(_0x43c97b,null))[_0x4f95('0x25')](saveUpdates(_0x3b66b8[_0x4f95('0x4a')],null))['then'](respondWithResult(_0x43c97b,null))[_0x4f95('0x43')](handleError(_0x43c97b,null));};exports['destroy']=function(_0x4646ca,_0x2d91bc){return db[_0x4f95('0x3f')]['find']({'where':{'id':_0x4646ca['params']['id']}})[_0x4f95('0x25')](handleEntityNotFound(_0x2d91bc,null))['then'](removeEntity(_0x2d91bc,null))[_0x4f95('0x43')](handleError(_0x2d91bc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 6ad02f6..a9e28ff 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 _0x61a5=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x419ffd,_0x10bdfe){var _0xb0b19d=function(_0x335815){while(--_0x335815){_0x419ffd['push'](_0x419ffd['shift']());}};_0xb0b19d(++_0x10bdfe);}(_0x61a5,0xf0));var _0x561a=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x61a5[_0x4d35f3];return _0x382fea;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var moment=require(_0x561a('0x3'));var BPromise=require(_0x561a('0x4'));var rp=require(_0x561a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x561a('0x8')]=function(_0x31f762,_0x24c89a){return _0x31f762[_0x561a('0x9')](_0x561a('0xa'),attributes,{'tableName':_0x561a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x561a('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc997=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x496729,_0x4e331f){var _0x100ad4=function(_0x4a6303){while(--_0x4a6303){_0x496729['push'](_0x496729['shift']());}};_0x100ad4(++_0x4e331f);}(_0xc997,0x1ac));var _0x7c99=function(_0x33d022,_0x555dee){_0x33d022=_0x33d022-0x0;var _0x3760e5=_0xc997[_0x33d022];return _0x3760e5;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('WhatsappApplication',attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c99('0xc'),'collate':_0x7c99('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 417f385..f603288 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x5d7a3d,_0x1ce20b){var _0x48afcb=function(_0x2a361f){while(--_0x2a361f){_0x5d7a3d['push'](_0x5d7a3d['shift']());}};_0x48afcb(++_0x1ce20b);}(_0xb821,0xa7));var _0x1b82=function(_0x3d0d3c,_0x8f0127){_0x3d0d3c=_0x3d0d3c-0x0;var _0x567568=_0xb821[_0x3d0d3c];return _0x567568;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0x7bae=['rpc','../../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','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7bae,0x13b));var _0xe7ba=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7bae[_0x397cfb];return _0x15fed9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1660d4a..ca1b1f4 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x277c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','whatsapp','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x277c,0x153));var _0xc277=function(_0x3b609e,_0x3c21d0){_0x3b609e=_0x3b609e-0x0;var _0x3b42e2=_0x277c[_0x3b609e];return _0x3b42e2;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/describe',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['get'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0xd')]);router[_0xc277('0xa')](_0xc277('0xe'),auth[_0xc277('0x9')](),controller['getMessages']);router['get'](_0xc277('0xf'),auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')]('/',auth['isAuthenticated'](),controller[_0xc277('0x12')]);router['post'](_0xc277('0xe'),auth[_0xc277('0x9')](),controller[_0xc277('0x13')]);router[_0xc277('0x11')]('/:id/tags',auth[_0xc277('0x9')](),interaction[_0xc277('0x14')](_0xc277('0x15'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xc277('0x16')]('/:id',auth[_0xc277('0x9')](),interaction['tracked'](_0xc277('0x15'),_0xc277('0x17')),controller[_0xc277('0x18')]);router['delete']('/:id',auth[_0xc277('0x9')](),interaction['tracked']('whatsapp',_0xc277('0x19')),controller[_0xc277('0x1a')]);router[_0xc277('0x1b')](_0xc277('0x1c'),auth[_0xc277('0x9')](),controller[_0xc277('0x1d')]);module[_0xc277('0x1e')]=router; \ No newline at end of file +var _0x56a4=['create','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsapp','whatsappinteraction:destroy','removeTags','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x56a4,0x11b));var _0x456a=function(_0x45050c,_0x2c514e){_0x45050c=_0x45050c-0x0;var _0x43be36=_0x56a4[_0x45050c];return _0x43be36;};'use strict';var multer=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var path=require('path');var timeout=require(_0x456a('0x2'));var express=require(_0x456a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x456a('0x4'));var interaction=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var controller=require(_0x456a('0x7'));router[_0x456a('0x8')]('/',auth['isAuthenticated'](),controller[_0x456a('0x9')]);router['get']('/describe',auth[_0x456a('0xa')](),controller[_0x456a('0xb')]);router[_0x456a('0x8')]('/:id',auth[_0x456a('0xa')](),controller['show']);router[_0x456a('0x8')](_0x456a('0xc'),auth[_0x456a('0xa')](),controller[_0x456a('0xd')]);router[_0x456a('0x8')](_0x456a('0xe'),auth[_0x456a('0xa')](),controller[_0x456a('0xf')]);router[_0x456a('0x10')]('/',auth[_0x456a('0xa')](),controller[_0x456a('0x11')]);router['post'](_0x456a('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0x456a('0x10')](_0x456a('0x12'),auth[_0x456a('0xa')](),interaction[_0x456a('0x13')]('whatsapp',_0x456a('0x14')),controller[_0x456a('0x15')]);router[_0x456a('0x16')](_0x456a('0x17'),auth[_0x456a('0xa')](),interaction[_0x456a('0x13')]('whatsapp',_0x456a('0x18')),controller[_0x456a('0x19')]);router[_0x456a('0x1a')](_0x456a('0x17'),auth['isAuthenticated'](),interaction[_0x456a('0x13')](_0x456a('0x1b'),_0x456a('0x1c')),controller['destroy']);router[_0x456a('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x456a('0x1d')]);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 c5a1302..5dbb8a8 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 _0x1e24=['DATE','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x376ddb,_0x5c43ca){var _0x4ba9fa=function(_0x3abb4c){while(--_0x3abb4c){_0x376ddb['push'](_0x376ddb['shift']());}};_0x4ba9fa(++_0x5c43ca);}(_0x1e24,0x82));var _0x41e2=function(_0x363dee,_0x4d1a44){_0x363dee=_0x363dee-0x0;var _0x31ae44=_0x1e24[_0x363dee];return _0x31ae44;};'use strict';var Sequelize=require(_0x41e2('0x0'));var moment=require(_0x41e2('0x1'));module[_0x41e2('0x2')]={'closed':{'type':Sequelize[_0x41e2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x41e2('0x4')]},'secondDisposition':{'type':Sequelize[_0x41e2('0x4')]},'thirdDisposition':{'type':Sequelize[_0x41e2('0x4')]},'note':{'type':Sequelize[_0x41e2('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x41e2('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x41e2('0x6')]('in',_0x41e2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x41e2('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x41e2('0x6')]('in',_0x41e2('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x41e2('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x41e2('0x8')]}}; \ No newline at end of file +var _0x8603=['ENUM','moment','exports','BOOLEAN','STRING','DATE','out'];(function(_0x394ff3,_0xa9d9a0){var _0x577f61=function(_0x3b145b){while(--_0x3b145b){_0x394ff3['push'](_0x394ff3['shift']());}};_0x577f61(++_0xa9d9a0);}(_0x8603,0x190));var _0x3860=function(_0xf5a51e,_0x14a189){_0xf5a51e=_0xf5a51e-0x0;var _0x5035da=_0x8603[_0xf5a51e];return _0x5035da;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3860('0x0'));module[_0x3860('0x1')]={'closed':{'type':Sequelize[_0x3860('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3860('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3860('0x3')]},'note':{'type':Sequelize[_0x3860('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3860('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x3860('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3860('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3860('0x6')]('in',_0x3860('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3860('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index e0d7f1e..851e838 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 _0xc177=['omit','spread','Tag','color','emit','removeTags','download','toString','join','root','tmp','server','files','attachments','format','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','pipe','createWriteStream','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','then','sendStatus','error','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','destroy','WhatsappMessage','addMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags'];(function(_0x3db7f5,_0x5ac8b2){var _0x47d743=function(_0x68c0b9){while(--_0x68c0b9){_0x3db7f5['push'](_0x3db7f5['shift']());}};_0x47d743(++_0x5ac8b2);}(_0xc177,0x1b2));var _0x7c17=function(_0x4fbc69,_0x27a9e6){_0x4fbc69=_0x4fbc69-0x0;var _0x4fd5ae=_0xc177[_0x4fbc69];return _0x4fd5ae;};'use strict';var rimraf=require(_0x7c17('0x0'));var zipdir=require(_0x7c17('0x1'));var moment=require(_0x7c17('0x2'));var BPromise=require(_0x7c17('0x3'));var util=require(_0x7c17('0x4'));var path=require('path');var ejs=require(_0x7c17('0x5'));var fs=require('fs');var _=require(_0x7c17('0x6'));var Redis=require(_0x7c17('0x7'));var interaction=require(_0x7c17('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7c17('0x9'));var logger=require(_0x7c17('0xa'))(_0x7c17('0xb'));var config=require('../../config/environment');var db=require(_0x7c17('0xc'))['db'];config[_0x7c17('0xd')]=_[_0x7c17('0xe')](config[_0x7c17('0xd')],{'host':_0x7c17('0xf'),'port':0x18eb});var socket=require(_0x7c17('0x10'))(new Redis(config[_0x7c17('0xd')]));require(_0x7c17('0x11'))[_0x7c17('0x12')](socket);function respondWithStatusCode(_0x39e320,_0x502793){_0x502793=_0x502793||0xcc;return function(_0x5ec150){if(_0x5ec150){return _0x39e320['sendStatus'](_0x502793);}return _0x39e320[_0x7c17('0x13')](_0x502793)[_0x7c17('0x14')]();};}function respondWithResult(_0x40cc08,_0x57a04c){_0x57a04c=_0x57a04c||0xc8;return function(_0xfcc2eb){if(_0xfcc2eb){return _0x40cc08[_0x7c17('0x13')](_0x57a04c)[_0x7c17('0x15')](_0xfcc2eb);}};}function respondWithFilteredResult(_0x5c7a1a,_0x57ae6e){return function(_0xf2412e){if(_0xf2412e){var _0x1220a8=typeof _0x57ae6e['offset']===_0x7c17('0x16')&&typeof _0x57ae6e['limit']===_0x7c17('0x16');var _0x5714b6=_0xf2412e[_0x7c17('0x17')];var _0x1e5997=_0x1220a8?0x0:_0x57ae6e[_0x7c17('0x18')];var _0x33f9cc=_0x1220a8?_0xf2412e[_0x7c17('0x17')]:_0x57ae6e[_0x7c17('0x18')]+_0x57ae6e[_0x7c17('0x19')];var _0x186812;if(_0x33f9cc>=_0x5714b6){_0x33f9cc=_0x5714b6;_0x186812=0xc8;}else{_0x186812=0xce;}_0x5c7a1a[_0x7c17('0x13')](_0x186812);return _0x5c7a1a[_0x7c17('0x1a')](_0x7c17('0x1b'),_0x1e5997+'-'+_0x33f9cc+'/'+_0x5714b6)[_0x7c17('0x15')](_0xf2412e);}return null;};}function saveUpdates(_0x2092b8){return function(_0x41440d){if(_0x41440d){return _0x41440d['update'](_0x2092b8)[_0x7c17('0x1c')](function(_0x302e4c){return _0x302e4c;});}return null;};}function removeEntity(_0x5df60d){return function(_0x291c5e){if(_0x291c5e){return _0x291c5e['destroy']()['then'](function(){_0x5df60d[_0x7c17('0x13')](0xcc)[_0x7c17('0x14')]();});}};}function handleEntityNotFound(_0x427e3a){return function(_0x5d5b75){if(!_0x5d5b75){_0x427e3a[_0x7c17('0x1d')](0x194);}return _0x5d5b75;};}function handleError(_0x26a134,_0x59c085){_0x59c085=_0x59c085||0x1f4;return function(_0x3ad6b9){logger[_0x7c17('0x1e')](_0x3ad6b9[_0x7c17('0x1f')]);if(_0x3ad6b9['name']){delete _0x3ad6b9[_0x7c17('0x20')];}_0x26a134[_0x7c17('0x13')](_0x59c085)[_0x7c17('0x21')](_0x3ad6b9);};}exports['index']=function(_0xa4f95e,_0x270130){var _0x50b041={};var _0x565e05=_[_0x7c17('0x22')](db[_0x7c17('0x23')][_0x7c17('0x24')],function(_0x36b5ed){return{'name':_0x36b5ed[_0x7c17('0x25')],'type':_0x36b5ed[_0x7c17('0x26')]['key']};});_0x50b041=qs[_0x7c17('0x27')](_0x565e05,_0xa4f95e);return interaction[_0x7c17('0x28')](_0x7c17('0x29'),_0xa4f95e[_0x7c17('0x2a')],_0xa4f95e[_0x7c17('0x2b')],_0x50b041,_0x565e05)[_0x7c17('0x1c')](respondWithFilteredResult(_0x270130,_0x50b041))[_0x7c17('0x2c')](handleError(_0x270130,null));};exports[_0x7c17('0x2d')]=function(_0x3a4a58,_0x3a2e61){var _0x4776cc={'raw':![],'where':{'id':_0x3a4a58[_0x7c17('0x2e')]['id']}},_0x4f40fb={};_0x4f40fb[_0x7c17('0x2f')]=_[_0x7c17('0x30')](db[_0x7c17('0x23')]['rawAttributes']);_0x4f40fb[_0x7c17('0x2a')]=_[_0x7c17('0x30')](_0x3a4a58['query']);_0x4f40fb[_0x7c17('0x31')]=_[_0x7c17('0x32')](_0x4f40fb[_0x7c17('0x2f')],_0x4f40fb['query']);_0x4776cc[_0x7c17('0x33')]=_['intersection'](_0x4f40fb[_0x7c17('0x2f')],qs[_0x7c17('0x34')](_0x3a4a58[_0x7c17('0x2a')][_0x7c17('0x34')]));_0x4776cc['attributes']=_0x4776cc[_0x7c17('0x33')][_0x7c17('0x35')]?_0x4776cc[_0x7c17('0x33')]:_0x4f40fb[_0x7c17('0x2f')];if(_0x3a4a58[_0x7c17('0x2a')][_0x7c17('0x36')]){_0x4776cc['include']=[{'all':!![]}];}_0x4776cc=_[_0x7c17('0x37')]({},_0x4776cc,_0x3a4a58[_0x7c17('0x38')]);return db['WhatsappInteraction'][_0x7c17('0x39')](_0x4776cc)[_0x7c17('0x1c')](handleEntityNotFound(_0x3a2e61,null))['then'](respondWithResult(_0x3a2e61,null))[_0x7c17('0x2c')](handleError(_0x3a2e61,null));};exports['create']=function(_0x423661,_0x35d249){return db[_0x7c17('0x23')]['create'](_0x423661[_0x7c17('0x3a')],{})[_0x7c17('0x1c')](respondWithResult(_0x35d249,0xc9))[_0x7c17('0x2c')](handleError(_0x35d249,null));};exports['update']=function(_0x502e36,_0x2f0afb){if(_0x502e36['body']['id']){delete _0x502e36[_0x7c17('0x3a')]['id'];}return db[_0x7c17('0x23')][_0x7c17('0x39')]({'where':{'id':_0x502e36['params']['id']}})[_0x7c17('0x1c')](handleEntityNotFound(_0x2f0afb,null))[_0x7c17('0x1c')](saveUpdates(_0x502e36[_0x7c17('0x3a')],null))[_0x7c17('0x1c')](respondWithResult(_0x2f0afb,null))[_0x7c17('0x2c')](handleError(_0x2f0afb,null));};exports[_0x7c17('0x3b')]=function(_0x47de27,_0x3fdda7){return db[_0x7c17('0x23')][_0x7c17('0x39')]({'where':{'id':_0x47de27[_0x7c17('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3fdda7,null))[_0x7c17('0x1c')](removeEntity(_0x3fdda7,null))[_0x7c17('0x2c')](handleError(_0x3fdda7,null));};exports['describe']=function(_0xf1a401,_0x563f2e){return db['WhatsappInteraction']['describe']()[_0x7c17('0x1c')](respondWithResult(_0x563f2e,null))[_0x7c17('0x2c')](handleError(_0x563f2e,null));};exports['addMessage']=function(_0x3fa415,_0x240bb7){return db[_0x7c17('0x3c')][_0x7c17('0x39')]({'where':{'id':_0x3fa415[_0x7c17('0x2e')]['id']}})[_0x7c17('0x1c')](handleEntityNotFound(_0x240bb7,null))[_0x7c17('0x1c')](function(_0x555237){if(_0x555237){return _0x555237[_0x7c17('0x3d')](_0x3fa415['body'][_0x7c17('0x3e')],_['omit'](_0x3fa415['body'],[_0x7c17('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x240bb7,null))[_0x7c17('0x2c')](handleError(_0x240bb7,null));};exports[_0x7c17('0x3f')]=function(_0x185281,_0x218529){var _0x452f49={'raw':![],'where':{}};var _0x1d525a={};var _0x115c7c={'count':0x0,'rows':[]};return db[_0x7c17('0x23')][_0x7c17('0x40')]({'where':{'id':_0x185281[_0x7c17('0x2e')]['id']}})[_0x7c17('0x1c')](handleEntityNotFound(_0x218529,null))[_0x7c17('0x1c')](function(_0x45c5d9){if(_0x45c5d9){_0x1d525a[_0x7c17('0x2f')]=_[_0x7c17('0x30')](db['WhatsappMessage'][_0x7c17('0x24')]);_0x1d525a['query']=_[_0x7c17('0x30')](_0x185281[_0x7c17('0x2a')]);_0x1d525a['filters']=_['intersection'](_0x1d525a['model'],_0x1d525a[_0x7c17('0x2a')]);_0x452f49['attributes']=_['intersection'](_0x1d525a[_0x7c17('0x2f')],qs[_0x7c17('0x34')](_0x185281['query']['fields']));_0x452f49[_0x7c17('0x33')]=_0x452f49['attributes'][_0x7c17('0x35')]?_0x452f49[_0x7c17('0x33')]:_0x1d525a[_0x7c17('0x2f')];if(!_0x185281['query'][_0x7c17('0x41')](_0x7c17('0x42'))){_0x452f49[_0x7c17('0x19')]=qs['limit'](_0x185281[_0x7c17('0x2a')][_0x7c17('0x19')]);_0x452f49[_0x7c17('0x18')]=qs[_0x7c17('0x18')](_0x185281[_0x7c17('0x2a')]['offset']);}_0x452f49[_0x7c17('0x43')]=qs[_0x7c17('0x44')](_0x185281[_0x7c17('0x2a')][_0x7c17('0x44')]);_0x452f49[_0x7c17('0x45')]=qs[_0x7c17('0x31')](_[_0x7c17('0x46')](_0x185281[_0x7c17('0x2a')],_0x1d525a[_0x7c17('0x31')]));_0x452f49['where']['WhatsappInteractionId']=_0x45c5d9['id'];if(_0x185281[_0x7c17('0x2a')]['filter']){_0x452f49[_0x7c17('0x45')]=_['merge'](_0x452f49[_0x7c17('0x45')],{'$or':_[_0x7c17('0x22')](_0x452f49['attributes'],function(_0x53234f){var _0x18cab8={};_0x18cab8[_0x53234f]={'$like':'%'+_0x185281[_0x7c17('0x2a')][_0x7c17('0x47')]+'%'};return _0x18cab8;})});}if(_0x185281['query'][_0x7c17('0x48')]){var _0xcdb9de=_0x185281[_0x7c17('0x2a')][_0x7c17('0x48')][_0x7c17('0x49')](',');var _0x160d64={};_0x160d64[_0xcdb9de[0x0]]={'$gte':moment(_0xcdb9de[0x1])['format'](_0x7c17('0x4a'))};_0x452f49[_0x7c17('0x45')]=_[_0x7c17('0x37')](_0x452f49[_0x7c17('0x45')],_0x160d64);}_0x452f49=_[_0x7c17('0x37')]({},_0x452f49,_0x185281[_0x7c17('0x38')]);return db[_0x7c17('0x3c')]['count']({'where':_0x452f49[_0x7c17('0x45')]})['then'](function(_0x5d8970){_0x115c7c[_0x7c17('0x17')]=_0x5d8970;if(_0x185281[_0x7c17('0x2a')][_0x7c17('0x36')]){_0x452f49[_0x7c17('0x4b')]=[{'all':!![]}];}return db[_0x7c17('0x3c')][_0x7c17('0x28')](_0x452f49);})[_0x7c17('0x1c')](function(_0x32d3f2){_0x115c7c['rows']=_0x32d3f2;return _0x115c7c;});}})[_0x7c17('0x1c')](respondWithFilteredResult(_0x218529,_0x452f49))[_0x7c17('0x2c')](handleError(_0x218529,null));};exports[_0x7c17('0x4c')]=function(_0x495169,_0x3a8622){return db[_0x7c17('0x23')]['find']({'where':{'id':_0x495169[_0x7c17('0x2e')]['id']}})[_0x7c17('0x1c')](handleEntityNotFound(_0x3a8622,null))[_0x7c17('0x1c')](function(_0x517048){if(_0x517048){return _0x517048[_0x7c17('0x4d')](_0x495169[_0x7c17('0x3a')][_0x7c17('0x3e')],_[_0x7c17('0x4e')](_0x495169['body'],[_0x7c17('0x3e'),'id'])||{})[_0x7c17('0x4f')](function(){return db[_0x7c17('0x50')][_0x7c17('0x28')]({'attributes':['id',_0x7c17('0x20'),_0x7c17('0x51')],'where':{'id':_0x495169[_0x7c17('0x3a')][_0x7c17('0x3e')]}});})[_0x7c17('0x1c')](function(_0x322dc9){socket[_0x7c17('0x52')]('whatsappInteractionTags:save',{'id':Number(_0x495169['params']['id']),'tags':_0x322dc9||[]});return{'id':Number(_0x495169[_0x7c17('0x2e')]['id']),'tags':_0x322dc9||[]};});}})[_0x7c17('0x1c')](respondWithResult(_0x3a8622,null))['catch'](handleError(_0x3a8622,null));};exports[_0x7c17('0x53')]=function(_0x26a6d9,_0x39bfeb){return db[_0x7c17('0x23')]['find']({'where':{'id':_0x26a6d9[_0x7c17('0x2e')]['id']}})[_0x7c17('0x1c')](handleEntityNotFound(_0x39bfeb,null))[_0x7c17('0x1c')](function(_0x3b7cc6){if(_0x3b7cc6){return _0x3b7cc6['removeTags'](_0x26a6d9['query']['ids']);}})['then'](respondWithStatusCode(_0x39bfeb,null))[_0x7c17('0x2c')](handleError(_0x39bfeb,null));};exports[_0x7c17('0x54')]=function(_0x5dd1e3,_0x359028){var _0xd582d3=moment()['unix']()[_0x7c17('0x55')]();var _0x4daff5=path[_0x7c17('0x56')](config[_0x7c17('0x57')],'server','files',_0x7c17('0x58'));var _0x9d66f=path[_0x7c17('0x56')](config[_0x7c17('0x57')],_0x7c17('0x59'),_0x7c17('0x5a'),_0x7c17('0x5b'));var _0x7aec57=path[_0x7c17('0x56')](_0x4daff5,_0xd582d3);var _0x2192a6=util[_0x7c17('0x5c')](_0x7c17('0x5d'),_0x5dd1e3[_0x7c17('0x2e')]['id'],_0xd582d3);var _0x7b3bc0=path['join'](_0x4daff5,_0x2192a6);var _0x4c81f8=[];_0x4c81f8['push']({'model':db[_0x7c17('0x5e')],'as':_0x7c17('0x5e'),'attributes':['id',_0x7c17('0x5f')],'raw':!![]});_0x4c81f8['push']({'model':db['CmContact'],'as':_0x7c17('0x60'),'attributes':['id',_0x7c17('0x61'),_0x7c17('0x62')],'raw':!![]});if(_0x5dd1e3[_0x7c17('0x2a')]['attachments']){_0x4c81f8['push']({'model':db[_0x7c17('0x63')],'as':'Attachment','raw':!![]});}var _0x759546=[{'model':db[_0x7c17('0x3c')],'as':'Messages','attributes':['id',_0x7c17('0x3a'),_0x7c17('0x64'),_0x7c17('0x65'),_0x7c17('0x66'),_0x7c17('0x67')],'include':_0x4c81f8}];_0x759546['push']({'model':db[_0x7c17('0x68')],'as':_0x7c17('0x69'),'attributes':['id',_0x7c17('0x20')]});_0x759546['push']({'model':db[_0x7c17('0x5e')],'as':_0x7c17('0x6a'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0x7c17('0x39')]({'where':{'id':_0x5dd1e3['params']['id']},'include':_0x759546})[_0x7c17('0x1c')](handleEntityNotFound(_0x359028,null))[_0x7c17('0x1c')](function(_0x520086){if(_0x520086){var _0x1fb144=_0x520086[_0x7c17('0x6b')]({'plain':!![]});fs['mkdirSync'](_0x7aec57);var _0x241371={'channel':_0x7c17('0x6c'),'account':_0x1fb144[_0x7c17('0x69')]['name'],'agent':_0x1fb144[_0x7c17('0x6a')]?_0x1fb144[_0x7c17('0x6a')][_0x7c17('0x5f')]:_0x7c17('0x6d'),'createdAt':moment(_0x1fb144[_0x7c17('0x64')])['format'](_0x7c17('0x4a'))[_0x7c17('0x55')](),'closedAt':_0x1fb144[_0x7c17('0x6e')]?moment(_0x1fb144[_0x7c17('0x6f')])[_0x7c17('0x5c')](_0x7c17('0x4a'))[_0x7c17('0x55')]():'','disposition':_0x1fb144[_0x7c17('0x70')],'messages':_(_0x1fb144[_0x7c17('0x71')])[_0x7c17('0x47')]({'secret':![]})[_0x7c17('0x22')](function(_0x57312d){if(_0x57312d[_0x7c17('0x63')]){var _0x384e0f=path[_0x7c17('0x56')](_0x9d66f,_0x57312d['Attachment'][_0x7c17('0x72')]);if(fs[_0x7c17('0x73')](_0x384e0f)){fs['createReadStream'](_0x384e0f)[_0x7c17('0x74')](fs[_0x7c17('0x75')](path['join'](_0x7aec57,_0x57312d['Attachment'][_0x7c17('0x72')])));}}return{'date':moment(_0x57312d[_0x7c17('0x64')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7c17('0x55')](),'sender':_0x57312d['direction']===_0x7c17('0x76')?_0x57312d[_0x7c17('0x5e')]?_0x57312d['User'][_0x7c17('0x5f')]:_0x7c17('0x77'):_0x57312d[_0x7c17('0x60')][_0x7c17('0x61')]+(_0x57312d[_0x7c17('0x60')][_0x7c17('0x62')]?'\x20'+_0x57312d[_0x7c17('0x60')][_0x7c17('0x62')]:''),'body':_0x57312d[_0x7c17('0x63')]?_0x57312d['Attachment'][_0x7c17('0x72')]:_0x57312d['body'],'direction':_0x57312d[_0x7c17('0x65')]==='out'?'A':'C','secret':_0x57312d[_0x7c17('0x66')],'read':_0x57312d[_0x7c17('0x67')],'attachment':_0x57312d[_0x7c17('0x63')]};})['value']()};return ejs[_0x7c17('0x78')](path[_0x7c17('0x56')](config[_0x7c17('0x57')],_0x7c17('0x59'),_0x7c17('0x79'),'downloadInteraction.ejs'),{'interaction':_0x241371})['then'](function(_0x1e32b7){var _0x1177df=path[_0x7c17('0x56')](_0x7aec57,_0x7c17('0x7a')+_0x1fb144['id']+'-'+_0xd582d3+_0x7c17('0x7b'));var _0x315000={'path':_0x1177df,'channel':_0x7c17('0x6c'),'interactionId':_0x1fb144['id']};return pdf[_0x7c17('0x7c')](_0x1e32b7,_0x315000);})[_0x7c17('0x1c')](function(){return new BPromise(function(_0x25e76b,_0x10bae9){zipdir(_0x7aec57,{'saveTo':_0x7b3bc0},function(_0x13b7d4,_0x3d6a92){if(_0x13b7d4)return _0x10bae9(_0x13b7d4);return _0x25e76b(_0x3d6a92);});})[_0x7c17('0x1c')](function(){return new BPromise(function(_0x267c33,_0x25b690){rimraf(_0x7aec57,function(_0x1d6617){if(_0x1d6617)_0x25b690(_0x1d6617);return _0x267c33();});});})[_0x7c17('0x1c')](function(){return _0x359028['download'](_0x7b3bc0,_0x2192a6,function(_0x2411b1){if(_0x2411b1){console[_0x7c17('0x7d')](_0x7c17('0x7e'),_0x2411b1);}else{fs[_0x7c17('0x7f')](_0x7b3bc0);}});});});}else{return _0x359028[_0x7c17('0x1d')](0xc8);}})[_0x7c17('0x2c')](handleError(_0x359028,null));}; \ No newline at end of file +var _0xaada=['../../components/export/pdf','../../config/logger','../../config/environment','redis','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','show','model','filters','intersection','fields','attributes','length','includeAll','merge','find','create','body','params','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','keys','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','format','options','include','rows','spread','emit','whatsappInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','createdAt','closed','YYYY-MM-DD\x20HH:mm:ss','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','createPdfFromHTML','download','log','unlinkSync','rimraf','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service'];(function(_0x54b71a,_0x111d53){var _0x2370ff=function(_0xa28fea){while(--_0xa28fea){_0x54b71a['push'](_0x54b71a['shift']());}};_0x2370ff(++_0x111d53);}(_0xaada,0x1d7));var _0xaaad=function(_0x4e8f13,_0x4bc0a9){_0x4e8f13=_0x4e8f13-0x0;var _0x57f410=_0xaada[_0x4e8f13];return _0x57f410;};'use strict';var rimraf=require(_0xaaad('0x0'));var zipdir=require('zip-dir');var moment=require(_0xaaad('0x1'));var BPromise=require(_0xaaad('0x2'));var util=require(_0xaaad('0x3'));var path=require(_0xaaad('0x4'));var ejs=require(_0xaaad('0x5'));var fs=require('fs');var _=require(_0xaaad('0x6'));var Redis=require(_0xaaad('0x7'));var interaction=require(_0xaaad('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0xaaad('0x9'));var logger=require(_0xaaad('0xa'))('api');var config=require(_0xaaad('0xb'));var db=require('../../mysqldb')['db'];config[_0xaaad('0xc')]=_['defaults'](config[_0xaaad('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaaad('0xc')]));require(_0xaaad('0xd'))['register'](socket);function respondWithStatusCode(_0x40eea8,_0x5227b6){_0x5227b6=_0x5227b6||0xcc;return function(_0x2f0afc){if(_0x2f0afc){return _0x40eea8[_0xaaad('0xe')](_0x5227b6);}return _0x40eea8[_0xaaad('0xf')](_0x5227b6)[_0xaaad('0x10')]();};}function respondWithResult(_0x12bbe8,_0x25e310){_0x25e310=_0x25e310||0xc8;return function(_0x484657){if(_0x484657){return _0x12bbe8[_0xaaad('0xf')](_0x25e310)[_0xaaad('0x11')](_0x484657);}};}function respondWithFilteredResult(_0x21e45d,_0xd5dbb9){return function(_0x2604eb){if(_0x2604eb){var _0x23c78b=typeof _0xd5dbb9[_0xaaad('0x12')]===_0xaaad('0x13')&&typeof _0xd5dbb9['limit']==='undefined';var _0x1c44ec=_0x2604eb[_0xaaad('0x14')];var _0x9e6656=_0x23c78b?0x0:_0xd5dbb9[_0xaaad('0x12')];var _0x53e7d0=_0x23c78b?_0x2604eb[_0xaaad('0x14')]:_0xd5dbb9[_0xaaad('0x12')]+_0xd5dbb9[_0xaaad('0x15')];var _0x4d4092;if(_0x53e7d0>=_0x1c44ec){_0x53e7d0=_0x1c44ec;_0x4d4092=0xc8;}else{_0x4d4092=0xce;}_0x21e45d['status'](_0x4d4092);return _0x21e45d['set'](_0xaaad('0x16'),_0x9e6656+'-'+_0x53e7d0+'/'+_0x1c44ec)[_0xaaad('0x11')](_0x2604eb);}return null;};}function saveUpdates(_0x4e437e){return function(_0x5b39de){if(_0x5b39de){return _0x5b39de[_0xaaad('0x17')](_0x4e437e)[_0xaaad('0x18')](function(_0x98ad05){return _0x98ad05;});}return null;};}function removeEntity(_0x5bf940){return function(_0x523d85){if(_0x523d85){return _0x523d85[_0xaaad('0x19')]()[_0xaaad('0x18')](function(){_0x5bf940[_0xaaad('0xf')](0xcc)[_0xaaad('0x10')]();});}};}function handleEntityNotFound(_0x2d838e){return function(_0x4c50dd){if(!_0x4c50dd){_0x2d838e['sendStatus'](0x194);}return _0x4c50dd;};}function handleError(_0x1ac807,_0x29a42e){_0x29a42e=_0x29a42e||0x1f4;return function(_0x29a286){logger['error'](_0x29a286[_0xaaad('0x1a')]);if(_0x29a286[_0xaaad('0x1b')]){delete _0x29a286[_0xaaad('0x1b')];}_0x1ac807['status'](_0x29a42e)[_0xaaad('0x1c')](_0x29a286);};}exports[_0xaaad('0x1d')]=function(_0x2043f9,_0x36280c){var _0x449d34={};var _0x1521da=_['map'](db[_0xaaad('0x1e')][_0xaaad('0x1f')],function(_0x24541b){return{'name':_0x24541b[_0xaaad('0x20')],'type':_0x24541b[_0xaaad('0x21')][_0xaaad('0x22')]};});_0x449d34=qs[_0xaaad('0x23')](_0x1521da,_0x2043f9);return interaction[_0xaaad('0x24')]('whatsapp',_0x2043f9[_0xaaad('0x25')],_0x2043f9['user'],_0x449d34,_0x1521da)[_0xaaad('0x18')](respondWithFilteredResult(_0x36280c,_0x449d34))[_0xaaad('0x26')](handleError(_0x36280c,null));};exports[_0xaaad('0x27')]=function(_0x196c97,_0x2f8a68){var _0x472de9={'raw':![],'where':{'id':_0x196c97['params']['id']}},_0x37aca0={};_0x37aca0[_0xaaad('0x28')]=_['keys'](db[_0xaaad('0x1e')][_0xaaad('0x1f')]);_0x37aca0[_0xaaad('0x25')]=_['keys'](_0x196c97[_0xaaad('0x25')]);_0x37aca0[_0xaaad('0x29')]=_[_0xaaad('0x2a')](_0x37aca0[_0xaaad('0x28')],_0x37aca0[_0xaaad('0x25')]);_0x472de9['attributes']=_[_0xaaad('0x2a')](_0x37aca0[_0xaaad('0x28')],qs[_0xaaad('0x2b')](_0x196c97[_0xaaad('0x25')][_0xaaad('0x2b')]));_0x472de9['attributes']=_0x472de9[_0xaaad('0x2c')][_0xaaad('0x2d')]?_0x472de9['attributes']:_0x37aca0[_0xaaad('0x28')];if(_0x196c97[_0xaaad('0x25')][_0xaaad('0x2e')]){_0x472de9['include']=[{'all':!![]}];}_0x472de9=_[_0xaaad('0x2f')]({},_0x472de9,_0x196c97['options']);return db[_0xaaad('0x1e')][_0xaaad('0x30')](_0x472de9)[_0xaaad('0x18')](handleEntityNotFound(_0x2f8a68,null))[_0xaaad('0x18')](respondWithResult(_0x2f8a68,null))[_0xaaad('0x26')](handleError(_0x2f8a68,null));};exports[_0xaaad('0x31')]=function(_0x28d19c,_0x232fa2){return db[_0xaaad('0x1e')][_0xaaad('0x31')](_0x28d19c[_0xaaad('0x32')],{})[_0xaaad('0x18')](respondWithResult(_0x232fa2,0xc9))[_0xaaad('0x26')](handleError(_0x232fa2,null));};exports[_0xaaad('0x17')]=function(_0x1cc96e,_0x357087){if(_0x1cc96e[_0xaaad('0x32')]['id']){delete _0x1cc96e[_0xaaad('0x32')]['id'];}return db[_0xaaad('0x1e')][_0xaaad('0x30')]({'where':{'id':_0x1cc96e[_0xaaad('0x33')]['id']}})[_0xaaad('0x18')](handleEntityNotFound(_0x357087,null))[_0xaaad('0x18')](saveUpdates(_0x1cc96e[_0xaaad('0x32')],null))[_0xaaad('0x18')](respondWithResult(_0x357087,null))[_0xaaad('0x26')](handleError(_0x357087,null));};exports['destroy']=function(_0x49e94c,_0xf70cb5){return db[_0xaaad('0x1e')][_0xaaad('0x30')]({'where':{'id':_0x49e94c[_0xaaad('0x33')]['id']}})[_0xaaad('0x18')](handleEntityNotFound(_0xf70cb5,null))[_0xaaad('0x18')](removeEntity(_0xf70cb5,null))[_0xaaad('0x26')](handleError(_0xf70cb5,null));};exports['describe']=function(_0x3378f6,_0x1f43c8){return db['WhatsappInteraction']['describe']()[_0xaaad('0x18')](respondWithResult(_0x1f43c8,null))[_0xaaad('0x26')](handleError(_0x1f43c8,null));};exports[_0xaaad('0x34')]=function(_0x801e7d,_0x4c5106){return db[_0xaaad('0x35')]['find']({'where':{'id':_0x801e7d[_0xaaad('0x33')]['id']}})[_0xaaad('0x18')](handleEntityNotFound(_0x4c5106,null))[_0xaaad('0x18')](function(_0xd2f8c0){if(_0xd2f8c0){return _0xd2f8c0[_0xaaad('0x34')](_0x801e7d[_0xaaad('0x32')]['ids'],_[_0xaaad('0x36')](_0x801e7d[_0xaaad('0x32')],[_0xaaad('0x37'),'id'])||{});}})['then'](respondWithResult(_0x4c5106,null))[_0xaaad('0x26')](handleError(_0x4c5106,null));};exports[_0xaaad('0x38')]=function(_0xabe26c,_0x3a3f95){var _0x2e8950={'raw':![],'where':{}};var _0x2e33fb={};var _0x262d0c={'count':0x0,'rows':[]};return db[_0xaaad('0x1e')][_0xaaad('0x39')]({'where':{'id':_0xabe26c[_0xaaad('0x33')]['id']}})['then'](handleEntityNotFound(_0x3a3f95,null))[_0xaaad('0x18')](function(_0x4bf9f2){if(_0x4bf9f2){_0x2e33fb[_0xaaad('0x28')]=_[_0xaaad('0x3a')](db['WhatsappMessage']['rawAttributes']);_0x2e33fb['query']=_[_0xaaad('0x3a')](_0xabe26c[_0xaaad('0x25')]);_0x2e33fb[_0xaaad('0x29')]=_[_0xaaad('0x2a')](_0x2e33fb['model'],_0x2e33fb[_0xaaad('0x25')]);_0x2e8950[_0xaaad('0x2c')]=_[_0xaaad('0x2a')](_0x2e33fb[_0xaaad('0x28')],qs[_0xaaad('0x2b')](_0xabe26c[_0xaaad('0x25')][_0xaaad('0x2b')]));_0x2e8950['attributes']=_0x2e8950[_0xaaad('0x2c')][_0xaaad('0x2d')]?_0x2e8950['attributes']:_0x2e33fb[_0xaaad('0x28')];if(!_0xabe26c[_0xaaad('0x25')][_0xaaad('0x3b')](_0xaaad('0x3c'))){_0x2e8950[_0xaaad('0x15')]=qs[_0xaaad('0x15')](_0xabe26c['query'][_0xaaad('0x15')]);_0x2e8950[_0xaaad('0x12')]=qs[_0xaaad('0x12')](_0xabe26c[_0xaaad('0x25')][_0xaaad('0x12')]);}_0x2e8950['order']=qs[_0xaaad('0x3d')](_0xabe26c[_0xaaad('0x25')][_0xaaad('0x3d')]);_0x2e8950[_0xaaad('0x3e')]=qs[_0xaaad('0x29')](_[_0xaaad('0x3f')](_0xabe26c[_0xaaad('0x25')],_0x2e33fb[_0xaaad('0x29')]));_0x2e8950['where'][_0xaaad('0x40')]=_0x4bf9f2['id'];if(_0xabe26c[_0xaaad('0x25')][_0xaaad('0x41')]){_0x2e8950[_0xaaad('0x3e')]=_[_0xaaad('0x2f')](_0x2e8950[_0xaaad('0x3e')],{'$or':_[_0xaaad('0x42')](_0x2e8950[_0xaaad('0x2c')],function(_0x5e4585){var _0x59089d={};_0x59089d[_0x5e4585]={'$like':'%'+_0xabe26c[_0xaaad('0x25')]['filter']+'%'};return _0x59089d;})});}if(_0xabe26c['query'][_0xaaad('0x43')]){var _0x3681e8=_0xabe26c[_0xaaad('0x25')][_0xaaad('0x43')][_0xaaad('0x44')](',');var _0x148aad={};_0x148aad[_0x3681e8[0x0]]={'$gte':moment(_0x3681e8[0x1])[_0xaaad('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2e8950[_0xaaad('0x3e')]=_[_0xaaad('0x2f')](_0x2e8950[_0xaaad('0x3e')],_0x148aad);}_0x2e8950=_['merge']({},_0x2e8950,_0xabe26c[_0xaaad('0x46')]);return db[_0xaaad('0x35')][_0xaaad('0x14')]({'where':_0x2e8950[_0xaaad('0x3e')]})['then'](function(_0x1560ef){_0x262d0c[_0xaaad('0x14')]=_0x1560ef;if(_0xabe26c[_0xaaad('0x25')][_0xaaad('0x2e')]){_0x2e8950[_0xaaad('0x47')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xaaad('0x24')](_0x2e8950);})[_0xaaad('0x18')](function(_0x5dbd4f){_0x262d0c[_0xaaad('0x48')]=_0x5dbd4f;return _0x262d0c;});}})[_0xaaad('0x18')](respondWithFilteredResult(_0x3a3f95,_0x2e8950))[_0xaaad('0x26')](handleError(_0x3a3f95,null));};exports['addTags']=function(_0x5b9f25,_0x499889){return db[_0xaaad('0x1e')][_0xaaad('0x30')]({'where':{'id':_0x5b9f25[_0xaaad('0x33')]['id']}})[_0xaaad('0x18')](handleEntityNotFound(_0x499889,null))[_0xaaad('0x18')](function(_0x4b190f){if(_0x4b190f){return _0x4b190f['setTags'](_0x5b9f25[_0xaaad('0x32')]['ids'],_[_0xaaad('0x36')](_0x5b9f25['body'],[_0xaaad('0x37'),'id'])||{})[_0xaaad('0x49')](function(){return db['Tag'][_0xaaad('0x24')]({'attributes':['id','name','color'],'where':{'id':_0x5b9f25[_0xaaad('0x32')]['ids']}});})[_0xaaad('0x18')](function(_0xd0bbd1){socket[_0xaaad('0x4a')](_0xaaad('0x4b'),{'id':Number(_0x5b9f25[_0xaaad('0x33')]['id']),'tags':_0xd0bbd1||[]});return{'id':Number(_0x5b9f25[_0xaaad('0x33')]['id']),'tags':_0xd0bbd1||[]};});}})[_0xaaad('0x18')](respondWithResult(_0x499889,null))[_0xaaad('0x26')](handleError(_0x499889,null));};exports[_0xaaad('0x4c')]=function(_0x3c0fd4,_0x5d6a04){return db[_0xaaad('0x1e')][_0xaaad('0x30')]({'where':{'id':_0x3c0fd4[_0xaaad('0x33')]['id']}})['then'](handleEntityNotFound(_0x5d6a04,null))['then'](function(_0x2b1bae){if(_0x2b1bae){return _0x2b1bae[_0xaaad('0x4c')](_0x3c0fd4[_0xaaad('0x25')][_0xaaad('0x37')]);}})[_0xaaad('0x18')](respondWithStatusCode(_0x5d6a04,null))['catch'](handleError(_0x5d6a04,null));};exports['download']=function(_0x2fc07f,_0x152969){var _0x2a3965=moment()[_0xaaad('0x4d')]()[_0xaaad('0x4e')]();var _0x8703a0=path['join'](config[_0xaaad('0x4f')],_0xaaad('0x50'),_0xaaad('0x51'),_0xaaad('0x52'));var _0x5c4dfe=path[_0xaaad('0x53')](config['root'],_0xaaad('0x50'),_0xaaad('0x51'),_0xaaad('0x54'));var _0x4c71ae=path['join'](_0x8703a0,_0x2a3965);var _0x430229=util['format'](_0xaaad('0x55'),_0x2fc07f[_0xaaad('0x33')]['id'],_0x2a3965);var _0x54cde8=path[_0xaaad('0x53')](_0x8703a0,_0x430229);var _0x3c101d=[];_0x3c101d[_0xaaad('0x56')]({'model':db[_0xaaad('0x57')],'as':_0xaaad('0x57'),'attributes':['id',_0xaaad('0x58')],'raw':!![]});_0x3c101d[_0xaaad('0x56')]({'model':db['CmContact'],'as':_0xaaad('0x59'),'attributes':['id',_0xaaad('0x5a'),_0xaaad('0x5b')],'raw':!![]});if(_0x2fc07f[_0xaaad('0x25')][_0xaaad('0x54')]){_0x3c101d[_0xaaad('0x56')]({'model':db[_0xaaad('0x5c')],'as':_0xaaad('0x5c'),'raw':!![]});}var _0x47d4d7=[{'model':db['WhatsappMessage'],'as':_0xaaad('0x5d'),'attributes':['id','body','createdAt',_0xaaad('0x5e'),_0xaaad('0x5f'),_0xaaad('0x60')],'include':_0x3c101d}];_0x47d4d7[_0xaaad('0x56')]({'model':db[_0xaaad('0x61')],'as':_0xaaad('0x62'),'attributes':['id',_0xaaad('0x1b')]});_0x47d4d7[_0xaaad('0x56')]({'model':db[_0xaaad('0x57')],'as':_0xaaad('0x63'),'attributes':['id',_0xaaad('0x58')]});return db[_0xaaad('0x1e')]['find']({'where':{'id':_0x2fc07f[_0xaaad('0x33')]['id']},'include':_0x47d4d7})[_0xaaad('0x18')](handleEntityNotFound(_0x152969,null))[_0xaaad('0x18')](function(_0x112fce){if(_0x112fce){var _0x21ae96=_0x112fce[_0xaaad('0x64')]({'plain':!![]});fs[_0xaaad('0x65')](_0x4c71ae);var _0x1e08e2={'channel':_0xaaad('0x66'),'account':_0x21ae96[_0xaaad('0x62')][_0xaaad('0x1b')],'agent':_0x21ae96[_0xaaad('0x63')]?_0x21ae96[_0xaaad('0x63')][_0xaaad('0x58')]:_0xaaad('0x67'),'createdAt':moment(_0x21ae96[_0xaaad('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xaaad('0x4e')](),'closedAt':_0x21ae96[_0xaaad('0x69')]?moment(_0x21ae96['closedAt'])[_0xaaad('0x45')](_0xaaad('0x6a'))[_0xaaad('0x4e')]():'','disposition':_0x21ae96['disposition'],'messages':_(_0x21ae96['Messages'])[_0xaaad('0x41')]({'secret':![]})[_0xaaad('0x42')](function(_0x194fa8){if(_0x194fa8[_0xaaad('0x5c')]){var _0x3f918d=path[_0xaaad('0x53')](_0x5c4dfe,_0x194fa8[_0xaaad('0x5c')][_0xaaad('0x6b')]);if(fs[_0xaaad('0x6c')](_0x3f918d)){fs[_0xaaad('0x6d')](_0x3f918d)[_0xaaad('0x6e')](fs[_0xaaad('0x6f')](path[_0xaaad('0x53')](_0x4c71ae,_0x194fa8['Attachment'][_0xaaad('0x6b')])));}}return{'date':moment(_0x194fa8['createdAt'])[_0xaaad('0x45')](_0xaaad('0x6a'))[_0xaaad('0x4e')](),'sender':_0x194fa8[_0xaaad('0x5e')]===_0xaaad('0x70')?_0x194fa8['User']?_0x194fa8[_0xaaad('0x57')][_0xaaad('0x58')]:_0xaaad('0x71'):_0x194fa8[_0xaaad('0x59')][_0xaaad('0x5a')]+(_0x194fa8[_0xaaad('0x59')]['lastName']?'\x20'+_0x194fa8[_0xaaad('0x59')][_0xaaad('0x5b')]:''),'body':_0x194fa8[_0xaaad('0x5c')]?_0x194fa8[_0xaaad('0x5c')]['basename']:_0x194fa8['body'],'direction':_0x194fa8['direction']===_0xaaad('0x70')?'A':'C','secret':_0x194fa8[_0xaaad('0x5f')],'read':_0x194fa8['read'],'attachment':_0x194fa8[_0xaaad('0x5c')]};})[_0xaaad('0x72')]()};return ejs[_0xaaad('0x73')](path[_0xaaad('0x53')](config[_0xaaad('0x4f')],'server','views','downloadInteraction.ejs'),{'interaction':_0x1e08e2})[_0xaaad('0x18')](function(_0x47efc5){var _0x52ee26=path[_0xaaad('0x53')](_0x4c71ae,'transcript-'+_0x21ae96['id']+'-'+_0x2a3965+'.pdf');var _0x405b4b={'path':_0x52ee26,'channel':_0xaaad('0x66'),'interactionId':_0x21ae96['id']};return pdf[_0xaaad('0x74')](_0x47efc5,_0x405b4b);})['then'](function(){return new BPromise(function(_0x2a80d1,_0x3a0f81){zipdir(_0x4c71ae,{'saveTo':_0x54cde8},function(_0x406a98,_0x28b271){if(_0x406a98)return _0x3a0f81(_0x406a98);return _0x2a80d1(_0x28b271);});})[_0xaaad('0x18')](function(){return new BPromise(function(_0x3d4145,_0x1c1218){rimraf(_0x4c71ae,function(_0x27ef6e){if(_0x27ef6e)_0x1c1218(_0x27ef6e);return _0x3d4145();});});})['then'](function(){return _0x152969[_0xaaad('0x75')](_0x54cde8,_0x430229,function(_0x2dc8cd){if(_0x2dc8cd){console[_0xaaad('0x76')]('err',_0x2dc8cd);}else{fs[_0xaaad('0x77')](_0x54cde8);}});});});}else{return _0x152969['sendStatus'](0xc8);}})[_0xaaad('0x26')](handleError(_0x152969,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index eeaffd4..867d2e9 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 _0x4ffe=['hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','Users','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x422a2d,_0x39a07c){var _0x3bda42=function(_0x5ad425){while(--_0x5ad425){_0x422a2d['push'](_0x422a2d['shift']());}};_0x3bda42(++_0x39a07c);}(_0x4ffe,0x172));var _0xe4ff=function(_0x26f866,_0x1900bc){_0x26f866=_0x26f866-0x0;var _0x1abef3=_0x4ffe[_0x26f866];return _0x1abef3;};'use strict';var EventEmitter=require(_0xe4ff('0x0'));var WhatsappInteraction=require(_0xe4ff('0x1'))['db'][_0xe4ff('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xe4ff('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe4ff('0x4')](0x0);var events={'afterCreate':_0xe4ff('0x5'),'afterUpdate':'update','afterDestroy':_0xe4ff('0x6')};function emitEvent(_0x2621fc){return function(_0x1397e1,_0x33a19a,_0x68c0c7){_0x1397e1['getUsers']({'attributes':['id'],'raw':!![]})[_0xe4ff('0x7')](function(_0x455874){_0x1397e1[_0xe4ff('0x8')](_0xe4ff('0x9'),_0x455874['map'](function(_0x4718d9){return{'id':_0x4718d9['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1397e1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe4ff('0x7')](function(_0x188173){_0x1397e1[_0xe4ff('0x8')](_0xe4ff('0xa'),_0x188173['length']);WhatsappInteractionEvents['emit'](_0x2621fc+':'+_0x1397e1['id'],_0x1397e1);WhatsappInteractionEvents[_0xe4ff('0xb')](_0x2621fc,_0x1397e1);_0x68c0c7(null);})[_0xe4ff('0xc')](_0x68c0c7(null));};}for(var e in events){if(events[_0xe4ff('0xd')](e)){var event=events[e];WhatsappInteraction[_0xe4ff('0xe')](e,emitEvent(event));}}module[_0xe4ff('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x7834=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','setMaxListeners','save'];(function(_0x404b5a,_0x255e99){var _0x33bd94=function(_0x5517bb){while(--_0x5517bb){_0x404b5a['push'](_0x404b5a['shift']());}};_0x33bd94(++_0x255e99);}(_0x7834,0x13f));var _0x4783=function(_0xccd4d3,_0xec2028){_0xccd4d3=_0xccd4d3-0x0;var _0xca752=_0x7834[_0xccd4d3];return _0xca752;};'use strict';var EventEmitter=require(_0x4783('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4783('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4783('0x2')](0x0);var events={'afterCreate':_0x4783('0x3'),'afterUpdate':_0x4783('0x4'),'afterDestroy':_0x4783('0x5')};function emitEvent(_0x29566c){return function(_0x3ebf06,_0x4150f2,_0x49114c){_0x3ebf06[_0x4783('0x6')]({'attributes':['id'],'raw':!![]})[_0x4783('0x7')](function(_0x518da8){_0x3ebf06[_0x4783('0x8')](_0x4783('0x9'),_0x518da8[_0x4783('0xa')](function(_0x112a19){return{'id':_0x112a19['id']};}));return WhatsappMessage[_0x4783('0xb')]({'where':{'WhatsappInteractionId':_0x3ebf06['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4783('0x7')](function(_0x5caa81){_0x3ebf06[_0x4783('0x8')](_0x4783('0xc'),_0x5caa81[_0x4783('0xd')]);WhatsappInteractionEvents[_0x4783('0xe')](_0x29566c+':'+_0x3ebf06['id'],_0x3ebf06);WhatsappInteractionEvents[_0x4783('0xe')](_0x29566c,_0x3ebf06);_0x49114c(null);})[_0x4783('0xf')](_0x49114c(null));};}for(var e in events){if(events[_0x4783('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](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 f286234..8b9fa9f 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 _0xc487=['whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction'];(function(_0xc905bf,_0x3fb45d){var _0x3ffd14=function(_0x3d3d02){while(--_0x3d3d02){_0xc905bf['push'](_0xc905bf['shift']());}};_0x3ffd14(++_0x3fb45d);}(_0xc487,0x6b));var _0x7c48=function(_0x502256,_0x19a90){_0x502256=_0x502256-0x0;var _0x2dfb66=_0xc487[_0x502256];return _0x2dfb66;};'use strict';var _=require('lodash');var util=require(_0x7c48('0x0'));var logger=require(_0x7c48('0x1'))(_0x7c48('0x2'));var moment=require(_0x7c48('0x3'));var BPromise=require(_0x7c48('0x4'));var rp=require(_0x7c48('0x5'));var fs=require('fs');var path=require(_0x7c48('0x6'));var rimraf=require(_0x7c48('0x7'));var config=require(_0x7c48('0x8'));var attributes=require(_0x7c48('0x9'));module[_0x7c48('0xa')]=function(_0x42eb60,_0x76162){return _0x42eb60['define'](_0x7c48('0xb'),attributes,{'tableName':_0x7c48('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x205cd2,_0x553e9e,_0x3ce554){if(_0x205cd2[_0x7c48('0xd')]('closed')){_0x205cd2[_0x7c48('0xe')]=moment()[_0x7c48('0xf')](_0x7c48('0x10'));}_0x3ce554(null,_0x205cd2);}}});}; \ No newline at end of file +var _0x0e5c=['moment','bluebird','request-promise','path','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x288937,_0xb6129){var _0xf1e7fb=function(_0x5d914c){while(--_0x5d914c){_0x288937['push'](_0x288937['shift']());}};_0xf1e7fb(++_0xb6129);}(_0x0e5c,0x1cd));var _0xc0e5=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x0e5c[_0x576e2b];return _0x46461a;};'use strict';var _=require(_0xc0e5('0x0'));var util=require(_0xc0e5('0x1'));var logger=require(_0xc0e5('0x2'))(_0xc0e5('0x3'));var moment=require(_0xc0e5('0x4'));var BPromise=require(_0xc0e5('0x5'));var rp=require(_0xc0e5('0x6'));var fs=require('fs');var path=require(_0xc0e5('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x9e56c4,_0x23939a){return _0x9e56c4[_0xc0e5('0x8')](_0xc0e5('0x9'),attributes,{'tableName':_0xc0e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x582218,_0x2081a2,_0x1e089a){if(_0x582218[_0xc0e5('0xb')](_0xc0e5('0xc'))){_0x582218['closedAt']=moment()[_0xc0e5('0xd')](_0xc0e5('0xe'));}_0x1e089a(null,_0x582218);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6ca248f..aedffdf 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 _0xc97f=['find','body','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','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','update','options','raw','where','attributes','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x2b5c18,_0x21c121){var _0x4e546b=function(_0x53d593){while(--_0x53d593){_0x2b5c18['push'](_0x2b5c18['shift']());}};_0x4e546b(++_0x21c121);}(_0xc97f,0x107));var _0xfc97=function(_0x1d3e26,_0x468839){_0x1d3e26=_0x1d3e26-0x0;var _0x26f484=_0xc97f[_0x1d3e26];return _0x26f484;};'use strict';var _=require(_0xfc97('0x0'));var util=require(_0xfc97('0x1'));var moment=require(_0xfc97('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc97('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc97('0x4'))['db'];var utils=require(_0xfc97('0x5'));var logger=require(_0xfc97('0x6'))(_0xfc97('0x7'));var config=require(_0xfc97('0x8'));var jayson=require(_0xfc97('0x9'));var client=jayson[_0xfc97('0xa')]['http']({'port':0x232a});config['redis']=_[_0xfc97('0xb')](config['redis'],{'host':_0xfc97('0xc'),'port':0x18eb});var socket=require(_0xfc97('0xd'))(new Redis(config[_0xfc97('0xe')]));require(_0xfc97('0xf'))[_0xfc97('0x10')](socket);function respondWithRpcPromise(_0x4642db,_0x3f5006,_0x5699ba){return new BPromise(function(_0x2136e3,_0x242ccd){return client[_0xfc97('0x11')](_0x4642db,_0x5699ba)[_0xfc97('0x12')](function(_0x255ede){logger[_0xfc97('0x13')](_0xfc97('0x14'),_0x3f5006,_0xfc97('0x15'));logger[_0xfc97('0x16')](_0xfc97('0x17'),_0x3f5006,'request\x20sent',JSON[_0xfc97('0x18')](_0x255ede));if(_0x255ede[_0xfc97('0x19')]){if(_0x255ede['error'][_0xfc97('0x1a')]===0x1f4){logger[_0xfc97('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x3f5006,_0x255ede['error'][_0xfc97('0x1b')]);return _0x242ccd(_0x255ede['error'][_0xfc97('0x1b')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x3f5006,_0x255ede[_0xfc97('0x19')]['message']);return _0x2136e3(_0x255ede[_0xfc97('0x19')][_0xfc97('0x1b')]);}else{logger['info'](_0xfc97('0x14'),_0x3f5006,_0xfc97('0x15'));_0x2136e3(_0x255ede[_0xfc97('0x1c')]['message']);}})[_0xfc97('0x1d')](function(_0x3c2239){logger[_0xfc97('0x19')](_0xfc97('0x14'),_0x3f5006,_0x3c2239);_0x242ccd(_0x3c2239);});});}exports['UpdateWhatsappInteraction']=function(_0x5291ef){var _0x5f21cc=this;return new Promise(function(_0x5c32cf,_0x431016){return db[_0xfc97('0x1e')][_0xfc97('0x1f')](_0x5291ef['body'],{'raw':_0x5291ef[_0xfc97('0x20')]?_0x5291ef[_0xfc97('0x20')][_0xfc97('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5291ef[_0xfc97('0x20')]?_0x5291ef[_0xfc97('0x20')][_0xfc97('0x22')]||null:null,'attributes':_0x5291ef[_0xfc97('0x20')]?_0x5291ef[_0xfc97('0x20')][_0xfc97('0x23')]||null:null,'limit':_0x5291ef[_0xfc97('0x20')]?_0x5291ef['options']['limit']||null:null})[_0xfc97('0x12')](function(_0xce1e94){logger[_0xfc97('0x13')](_0xfc97('0x24'),_0x5291ef);logger['debug']('UpdateWhatsappInteraction',_0x5291ef,JSON['stringify'](_0xce1e94));_0x5c32cf(_0xce1e94);})[_0xfc97('0x1d')](function(_0x59c62e){logger[_0xfc97('0x19')](_0xfc97('0x24'),_0x59c62e['message'],_0x5291ef);_0x431016(_0x5f21cc[_0xfc97('0x19')](0x1f4,_0x59c62e['message']));});});};exports[_0xfc97('0x25')]=function(_0x5aec19){return new Promise(function(_0x1649ab,_0x4c8c21){return db[_0xfc97('0x1e')][_0xfc97('0x26')]({'where':_0x5aec19[_0xfc97('0x20')]?_0x5aec19[_0xfc97('0x20')][_0xfc97('0x22')]||null:null})[_0xfc97('0x12')](function(_0x19a732){if(_0x19a732){return _0x19a732['addTags'](_0x5aec19[_0xfc97('0x27')]['ids'],_[_0xfc97('0x28')](_0x5aec19['body'],['ids','id'])||{});}})[_0xfc97('0x29')](function(_0x220409){logger[_0xfc97('0x13')](_0xfc97('0x2a'),_0x5aec19);logger['debug'](_0xfc97('0x2a'),_0x5aec19,JSON[_0xfc97('0x18')](_0x220409));_0x1649ab(_0x220409);})[_0xfc97('0x1d')](function(_0x3346c5){logger['error'](_0xfc97('0x2a'),_0x3346c5[_0xfc97('0x1b')],_0x5aec19);_0x4c8c21(_this[_0xfc97('0x19')](0x1f4,_0x3346c5[_0xfc97('0x1b')]));});});}; \ No newline at end of file +var _0xbc22=['client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','where','attributes','limit','then','debug','catch','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2cccd3,_0x45547d){var _0x481e99=function(_0x552b14){while(--_0x552b14){_0x2cccd3['push'](_0x2cccd3['shift']());}};_0x481e99(++_0x45547d);}(_0xbc22,0xc1));var _0x2bc2=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xbc22[_0x1c06f4];return _0x1a727e;};'use strict';var _=require(_0x2bc2('0x0'));var util=require(_0x2bc2('0x1'));var moment=require(_0x2bc2('0x2'));var BPromise=require(_0x2bc2('0x3'));var rs=require(_0x2bc2('0x4'));var fs=require('fs');var Redis=require(_0x2bc2('0x5'));var db=require(_0x2bc2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2bc2('0x7')][_0x2bc2('0x8')]({'port':0x232a});config[_0x2bc2('0x9')]=_[_0x2bc2('0xa')](config[_0x2bc2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bc2('0xb'))(new Redis(config[_0x2bc2('0x9')]));require(_0x2bc2('0xc'))['register'](socket);function respondWithRpcPromise(_0x5e96d2,_0x5e2146,_0x56a277){return new BPromise(function(_0x166ca1,_0x1f51f8){return client[_0x2bc2('0xd')](_0x5e96d2,_0x56a277)['then'](function(_0x4ad98a){logger[_0x2bc2('0xe')](_0x2bc2('0xf'),_0x5e2146,_0x2bc2('0x10'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5e2146,'request\x20sent',JSON[_0x2bc2('0x11')](_0x4ad98a));if(_0x4ad98a['error']){if(_0x4ad98a[_0x2bc2('0x12')][_0x2bc2('0x13')]===0x1f4){logger[_0x2bc2('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5e2146,_0x4ad98a[_0x2bc2('0x12')][_0x2bc2('0x14')]);return _0x1f51f8(_0x4ad98a[_0x2bc2('0x12')][_0x2bc2('0x14')]);}logger[_0x2bc2('0x12')](_0x2bc2('0xf'),_0x5e2146,_0x4ad98a[_0x2bc2('0x12')][_0x2bc2('0x14')]);return _0x166ca1(_0x4ad98a[_0x2bc2('0x12')][_0x2bc2('0x14')]);}else{logger[_0x2bc2('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x5e2146,'request\x20sent');_0x166ca1(_0x4ad98a[_0x2bc2('0x15')]['message']);}})['catch'](function(_0x5e72ef){logger[_0x2bc2('0x12')](_0x2bc2('0xf'),_0x5e2146,_0x5e72ef);_0x1f51f8(_0x5e72ef);});});}exports[_0x2bc2('0x16')]=function(_0x2d28d1){var _0x324b13=this;return new Promise(function(_0x41848f,_0x450b4b){return db[_0x2bc2('0x17')][_0x2bc2('0x18')](_0x2d28d1[_0x2bc2('0x19')],{'raw':_0x2d28d1['options']?_0x2d28d1['options'][_0x2bc2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d28d1[_0x2bc2('0x1b')]?_0x2d28d1[_0x2bc2('0x1b')][_0x2bc2('0x1c')]||null:null,'attributes':_0x2d28d1['options']?_0x2d28d1[_0x2bc2('0x1b')][_0x2bc2('0x1d')]||null:null,'limit':_0x2d28d1[_0x2bc2('0x1b')]?_0x2d28d1[_0x2bc2('0x1b')][_0x2bc2('0x1e')]||null:null})[_0x2bc2('0x1f')](function(_0x189eb3){logger[_0x2bc2('0xe')]('UpdateWhatsappInteraction',_0x2d28d1);logger[_0x2bc2('0x20')](_0x2bc2('0x16'),_0x2d28d1,JSON[_0x2bc2('0x11')](_0x189eb3));_0x41848f(_0x189eb3);})[_0x2bc2('0x21')](function(_0x3d6677){logger[_0x2bc2('0x12')](_0x2bc2('0x16'),_0x3d6677[_0x2bc2('0x14')],_0x2d28d1);_0x450b4b(_0x324b13[_0x2bc2('0x12')](0x1f4,_0x3d6677['message']));});});};exports[_0x2bc2('0x22')]=function(_0x284e84){return new Promise(function(_0x5079e5,_0x174de5){return db[_0x2bc2('0x17')][_0x2bc2('0x23')]({'where':_0x284e84['options']?_0x284e84[_0x2bc2('0x1b')]['where']||null:null})[_0x2bc2('0x1f')](function(_0x510d3a){if(_0x510d3a){return _0x510d3a['addTags'](_0x284e84['body'][_0x2bc2('0x24')],_[_0x2bc2('0x25')](_0x284e84[_0x2bc2('0x19')],[_0x2bc2('0x24'),'id'])||{});}})[_0x2bc2('0x26')](function(_0x50efb9){logger[_0x2bc2('0xe')]('AddTags',_0x284e84);logger['debug'](_0x2bc2('0x27'),_0x284e84,JSON['stringify'](_0x50efb9));_0x5079e5(_0x50efb9);})['catch'](function(_0x3e751a){logger[_0x2bc2('0x12')](_0x2bc2('0x27'),_0x3e751a['message'],_0x284e84);_0x174de5(_this[_0x2bc2('0x12')](0x1f4,_0x3e751a[_0x2bc2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4fb4b3d..983153b 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 _0x02da=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x3b4f00,_0x410318){var _0x1aa7cc=function(_0x8e60a2){while(--_0x8e60a2){_0x3b4f00['push'](_0x3b4f00['shift']());}};_0x1aa7cc(++_0x410318);}(_0x02da,0x179));var _0xa02d=function(_0x42c5db,_0x52b16a){_0x42c5db=_0x42c5db-0x0;var _0x488617=_0x02da[_0x42c5db];return _0x488617;};'use strict';var WhatsappInteractionEvents=require(_0xa02d('0x0'));var events=[_0xa02d('0x1'),_0xa02d('0x2'),_0xa02d('0x3')];function createListener(_0x963322,_0x2d6b20){return function(_0x1dee27){_0x2d6b20[_0xa02d('0x4')](_0x963322,_0x1dee27);};}function removeListener(_0x1a3211,_0x281b23){return function(){WhatsappInteractionEvents[_0xa02d('0x5')](_0x1a3211,_0x281b23);};}exports[_0xa02d('0x6')]=function(_0x5ef3c3){for(var _0x3df04a=0x0,_0x38b885=events['length'];_0x3df04a<_0x38b885;_0x3df04a++){var _0x26b34e=events[_0x3df04a];var _0x3de2d7=createListener(_0xa02d('0x7')+_0x26b34e,_0x5ef3c3);WhatsappInteractionEvents['on'](_0x26b34e,_0x3de2d7);}}; \ No newline at end of file +var _0xa8ef=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8ef,0xac));var _0xfa8e=function(_0x1568c5,_0x298d64){_0x1568c5=_0x1568c5-0x0;var _0x145229=_0xa8ef[_0x1568c5];return _0x145229;};'use strict';var WhatsappInteractionEvents=require(_0xfa8e('0x0'));var events=[_0xfa8e('0x1'),_0xfa8e('0x2'),_0xfa8e('0x3')];function createListener(_0x4f3c7e,_0x7c18d6){return function(_0x1a8e34){_0x7c18d6[_0xfa8e('0x4')](_0x4f3c7e,_0x1a8e34);};}function removeListener(_0x179a5f,_0x381cee){return function(){WhatsappInteractionEvents[_0xfa8e('0x5')](_0x179a5f,_0x381cee);};}exports[_0xfa8e('0x6')]=function(_0x38857e){for(var _0x3182a7=0x0,_0x29e044=events[_0xfa8e('0x7')];_0x3182a7<_0x29e044;_0x3182a7++){var _0x18df76=events[_0x3182a7];var _0x182769=createListener(_0xfa8e('0x8')+_0x18df76,_0x38857e);WhatsappInteractionEvents['on'](_0x18df76,_0x182769);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4341c75..faffb5e 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 _0x3055=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path'];(function(_0x35137d,_0x23348e){var _0x3dcdab=function(_0x18a124){while(--_0x18a124){_0x35137d['push'](_0x35137d['shift']());}};_0x3dcdab(++_0x23348e);}(_0x3055,0x171));var _0x5305=function(_0x57c666,_0xbde7c8){_0x57c666=_0x57c666-0x0;var _0x10ee1c=_0x3055[_0x57c666];return _0x10ee1c;};'use strict';var multer=require(_0x5305('0x0'));var util=require(_0x5305('0x1'));var path=require(_0x5305('0x2'));var timeout=require(_0x5305('0x3'));var express=require('express');var router=express[_0x5305('0x4')]();var fs_extra=require(_0x5305('0x5'));var auth=require(_0x5305('0x6'));var interaction=require(_0x5305('0x7'));var config=require(_0x5305('0x8'));var controller=require(_0x5305('0x9'));router[_0x5305('0xa')]('/',auth[_0x5305('0xb')](),controller[_0x5305('0xc')]);router[_0x5305('0xa')](_0x5305('0xd'),auth[_0x5305('0xb')](),controller[_0x5305('0xe')]);router['get'](_0x5305('0xf'),auth[_0x5305('0xb')](),controller[_0x5305('0x10')]);router[_0x5305('0x11')]('/',auth[_0x5305('0xb')](),interaction[_0x5305('0x12')]('whatsapp',_0x5305('0x13')),controller[_0x5305('0x14')]);router[_0x5305('0x11')](_0x5305('0x15'),controller[_0x5305('0x16')]);router[_0x5305('0x17')](_0x5305('0xf'),auth[_0x5305('0xb')](),controller[_0x5305('0x18')]);router[_0x5305('0x17')](_0x5305('0x19'),auth[_0x5305('0xb')](),controller[_0x5305('0x1a')]);router[_0x5305('0x17')](_0x5305('0x1b'),auth[_0x5305('0xb')](),controller[_0x5305('0x1c')]);router[_0x5305('0x1d')](_0x5305('0xf'),auth['isAuthenticated'](),controller[_0x5305('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x2a70=['/:id','show','post','whatsapp','whatsappmessage:create','create','put','accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated'];(function(_0x16be8b,_0x4d4b42){var _0x4e1ab6=function(_0x45f886){while(--_0x45f886){_0x16be8b['push'](_0x16be8b['shift']());}};_0x4e1ab6(++_0x4d4b42);}(_0x2a70,0x88));var _0x02a7=function(_0x65fcb4,_0x4ef502){_0x65fcb4=_0x65fcb4-0x0;var _0x4353be=_0x2a70[_0x65fcb4];return _0x4353be;};'use strict';var multer=require(_0x02a7('0x0'));var util=require(_0x02a7('0x1'));var path=require(_0x02a7('0x2'));var timeout=require(_0x02a7('0x3'));var express=require(_0x02a7('0x4'));var router=express[_0x02a7('0x5')]();var fs_extra=require(_0x02a7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x02a7('0x7'));var config=require(_0x02a7('0x8'));var controller=require(_0x02a7('0x9'));router[_0x02a7('0xa')]('/',auth['isAuthenticated'](),controller[_0x02a7('0xb')]);router[_0x02a7('0xa')](_0x02a7('0xc'),auth[_0x02a7('0xd')](),controller['describe']);router[_0x02a7('0xa')](_0x02a7('0xe'),auth[_0x02a7('0xd')](),controller[_0x02a7('0xf')]);router[_0x02a7('0x10')]('/',auth[_0x02a7('0xd')](),interaction['tracked'](_0x02a7('0x11'),_0x02a7('0x12')),controller[_0x02a7('0x13')]);router[_0x02a7('0x10')]('/:id/status',controller['status']);router[_0x02a7('0x14')](_0x02a7('0xe'),auth[_0x02a7('0xd')](),controller['update']);router[_0x02a7('0x14')]('/:id/accept',auth[_0x02a7('0xd')](),controller[_0x02a7('0x15')]);router[_0x02a7('0x14')](_0x02a7('0x16'),auth[_0x02a7('0xd')](),controller['reject']);router['delete'](_0x02a7('0xe'),auth[_0x02a7('0xd')](),controller[_0x02a7('0x17')]);module[_0x02a7('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 e6e103d..2cdf412 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 _0x30ea=['medium','ENUM','out','STRING','DATE','BOOLEAN','TEXT'];(function(_0x8eb552,_0x4b95b3){var _0x52597a=function(_0x42a963){while(--_0x42a963){_0x8eb552['push'](_0x8eb552['shift']());}};_0x52597a(++_0x4b95b3);}(_0x30ea,0x13a));var _0xa30e=function(_0x486100,_0x2dbdef){_0x486100=_0x486100-0x0;var _0x5eb54=_0x30ea[_0x486100];return _0x5eb54;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xa30e('0x0')](_0xa30e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa30e('0x2')]('in',_0xa30e('0x3')),'defaultValue':_0xa30e('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa30e('0x4')]},'readAt':{'type':Sequelize[_0xa30e('0x5')]},'secret':{'type':Sequelize[_0xa30e('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa30e('0x4')]},'providerResponse':{'type':Sequelize[_0xa30e('0x0')]}}; \ No newline at end of file +var _0x1cb9=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x5e6bb2,_0x5478c6){var _0x43721e=function(_0x280fd3){while(--_0x280fd3){_0x5e6bb2['push'](_0x5e6bb2['shift']());}};_0x43721e(++_0x5478c6);}(_0x1cb9,0x14e));var _0x91cb=function(_0x355d9c,_0x540750){_0x355d9c=_0x355d9c-0x0;var _0x51de8a=_0x1cb9[_0x355d9c];return _0x51de8a;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'body':{'type':Sequelize[_0x91cb('0x1')](_0x91cb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x91cb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x91cb('0x4')]('in','out'),'defaultValue':_0x91cb('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x91cb('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x91cb('0x7')]},'secret':{'type':Sequelize[_0x91cb('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x91cb('0x6')]},'providerResponse':{'type':Sequelize[_0x91cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 703a7fe..57829bf 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 _0xfa78=['send','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','UserId','user','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE: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','QueryTypes','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','SELECT','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','mustache','path','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./whatsappMessage.socket','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name'];(function(_0x43907c,_0x4ab831){var _0x42b194=function(_0x3e6552){while(--_0x3e6552){_0x43907c['push'](_0x43907c['shift']());}};_0x42b194(++_0x4ab831);}(_0xfa78,0x163));var _0x8fa7=function(_0x152a62,_0x1359e7){_0x152a62=_0x152a62-0x0;var _0x736321=_0xfa78[_0x152a62];return _0x736321;};'use strict';var emlformat=require(_0x8fa7('0x0'));var rimraf=require(_0x8fa7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fa7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8fa7('0x3'));var util=require('util');var path=require(_0x8fa7('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fa7('0x5'));var _=require('lodash');var squel=require(_0x8fa7('0x6'));var crypto=require(_0x8fa7('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x8fa7('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8fa7('0x9'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8fa7('0xa'));var hardwareService=require(_0x8fa7('0xb'));var logger=require(_0x8fa7('0xc'))(_0x8fa7('0xd'));var utils=require(_0x8fa7('0xe'));var config=require(_0x8fa7('0xf'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8fa7('0x10')]=_[_0x8fa7('0x11')](config[_0x8fa7('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0x8fa7('0x12'))(new Redis(config[_0x8fa7('0x10')]));require(_0x8fa7('0x13'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8fa7('0x14')][_0x8fa7('0x15')]({'port':0x232c});var client9002=jayson[_0x8fa7('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdd4238,_0x171874,_0x6d9374,_0x15c443){return new BPromise(function(_0x5ea6d7,_0x2de456){var _0x22ee57=_0x15c443||client;return _0x22ee57[_0x8fa7('0x16')](_0xdd4238,_0x6d9374)[_0x8fa7('0x17')](function(_0x2ea693){logger[_0x8fa7('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x171874,_0x8fa7('0x19'));logger[_0x8fa7('0x1a')](_0x8fa7('0x1b'),_0x171874,_0x8fa7('0x19'),JSON[_0x8fa7('0x1c')](_0x2ea693));if(_0x2ea693[_0x8fa7('0x1d')]){if(_0x2ea693[_0x8fa7('0x1d')][_0x8fa7('0x1e')]===0x1f4){logger[_0x8fa7('0x1d')](_0x8fa7('0x1f'),_0x171874,_0x2ea693[_0x8fa7('0x1d')][_0x8fa7('0x20')]);return _0x2de456(_0x2ea693['error'][_0x8fa7('0x20')]);}logger['error'](_0x8fa7('0x1f'),_0x171874,_0x2ea693['error'][_0x8fa7('0x20')]);return _0x5ea6d7(_0x2ea693['error']['message']);}else{logger[_0x8fa7('0x18')](_0x8fa7('0x1f'),_0x171874,_0x8fa7('0x19'));_0x5ea6d7(_0x2ea693['result']['message']);}})['catch'](function(_0x2cb82e){logger[_0x8fa7('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x171874,_0x2cb82e);_0x2de456(_0x2cb82e);});});}function respondWithStatusCode(_0x3e6c6b,_0x157bde){_0x157bde=_0x157bde||0xcc;return function(_0x323784){if(_0x323784){return _0x3e6c6b[_0x8fa7('0x21')](_0x157bde);}return _0x3e6c6b[_0x8fa7('0x22')](_0x157bde)[_0x8fa7('0x23')]();};}function respondWithResult(_0x33834a,_0x20cd9e){_0x20cd9e=_0x20cd9e||0xc8;return function(_0x133aff){if(_0x133aff){return _0x33834a['status'](_0x20cd9e)[_0x8fa7('0x24')](_0x133aff);}};}function respondWithFilteredResult(_0x51e691,_0x51bee6){return function(_0x3d25e2){if(_0x3d25e2){var _0x2c3e96=typeof _0x51bee6[_0x8fa7('0x25')]==='undefined'&&typeof _0x51bee6['limit']===_0x8fa7('0x26');var _0x4dfae3=_0x3d25e2[_0x8fa7('0x27')];var _0x1ed1c6=_0x2c3e96?0x0:_0x51bee6['offset'];var _0x5f2435=_0x2c3e96?_0x3d25e2[_0x8fa7('0x27')]:_0x51bee6[_0x8fa7('0x25')]+_0x51bee6[_0x8fa7('0x28')];var _0x34aad0;if(_0x5f2435>=_0x4dfae3){_0x5f2435=_0x4dfae3;_0x34aad0=0xc8;}else{_0x34aad0=0xce;}_0x51e691['status'](_0x34aad0);return _0x51e691[_0x8fa7('0x29')](_0x8fa7('0x2a'),_0x1ed1c6+'-'+_0x5f2435+'/'+_0x4dfae3)[_0x8fa7('0x24')](_0x3d25e2);}return null;};}function patchUpdates(_0x324e67){return function(_0x59dd98){try{jsonpatch[_0x8fa7('0x2b')](_0x59dd98,_0x324e67,!![]);}catch(_0x10b0d5){return BPromise[_0x8fa7('0x2c')](_0x10b0d5);}return _0x59dd98[_0x8fa7('0x2d')]();};}function saveUpdates(_0x159981,_0x2ffeb4){return function(_0x1b6cd5){if(_0x1b6cd5){return _0x1b6cd5[_0x8fa7('0x2e')](_0x159981)['then'](function(_0x6245bb){return _0x6245bb;});}return null;};}function removeEntity(_0xf331ff,_0x4f27ca){return function(_0x17ef4a){if(_0x17ef4a){return _0x17ef4a[_0x8fa7('0x2f')]()[_0x8fa7('0x17')](function(){_0xf331ff[_0x8fa7('0x22')](0xcc)[_0x8fa7('0x23')]();});}};}function handleEntityNotFound(_0x22c911,_0x245e17){return function(_0x46f233){if(!_0x46f233){_0x22c911[_0x8fa7('0x21')](0x194);}return _0x46f233;};}function handleError(_0x4e7e4b,_0x282640){_0x282640=_0x282640||0x1f4;return function(_0x324bb9){logger['error'](_0x324bb9[_0x8fa7('0x30')]);if(_0x324bb9[_0x8fa7('0x31')]){delete _0x324bb9['name'];}_0x4e7e4b['status'](_0x282640)[_0x8fa7('0x32')](_0x324bb9);};}exports[_0x8fa7('0x33')]=function(_0x1d21ba,_0x122fcb){var _0x20e53e={},_0x91c948={},_0x32c1ca={'count':0x0,'rows':[]};var _0x3cee4b=_['map'](db[_0x8fa7('0x34')][_0x8fa7('0x35')],function(_0x149cd9){return{'name':_0x149cd9[_0x8fa7('0x36')],'type':_0x149cd9[_0x8fa7('0x37')][_0x8fa7('0x38')]};});_0x91c948[_0x8fa7('0x39')]=_['map'](_0x3cee4b,_0x8fa7('0x31'));_0x91c948[_0x8fa7('0x3a')]=_[_0x8fa7('0x3b')](_0x1d21ba[_0x8fa7('0x3a')]);_0x91c948[_0x8fa7('0x3c')]=_[_0x8fa7('0x3d')](_0x91c948[_0x8fa7('0x39')],_0x91c948['query']);_0x20e53e[_0x8fa7('0x3e')]=_[_0x8fa7('0x3d')](_0x91c948[_0x8fa7('0x39')],qs['fields'](_0x1d21ba[_0x8fa7('0x3a')][_0x8fa7('0x3f')]));_0x20e53e[_0x8fa7('0x3e')]=_0x20e53e[_0x8fa7('0x3e')]['length']?_0x20e53e['attributes']:_0x91c948['model'];if(!_0x1d21ba[_0x8fa7('0x3a')][_0x8fa7('0x40')]('nolimit')){_0x20e53e['limit']=qs[_0x8fa7('0x28')](_0x1d21ba[_0x8fa7('0x3a')][_0x8fa7('0x28')]);_0x20e53e[_0x8fa7('0x25')]=qs['offset'](_0x1d21ba['query'][_0x8fa7('0x25')]);}_0x20e53e[_0x8fa7('0x41')]=qs[_0x8fa7('0x42')](_0x1d21ba[_0x8fa7('0x3a')][_0x8fa7('0x42')]);_0x20e53e[_0x8fa7('0x43')]=qs[_0x8fa7('0x3c')](_[_0x8fa7('0x44')](_0x1d21ba[_0x8fa7('0x3a')],_0x91c948[_0x8fa7('0x3c')]),_0x3cee4b);if(_0x1d21ba['query'][_0x8fa7('0x45')]){_0x20e53e['where']=_[_0x8fa7('0x46')](_0x20e53e['where'],{'$or':_[_0x8fa7('0x47')](_0x3cee4b,function(_0x2fe905){if(_0x2fe905[_0x8fa7('0x37')]!==_0x8fa7('0x48')){var _0x1d31d3={};_0x1d31d3[_0x2fe905['name']]={'$like':'%'+_0x1d21ba[_0x8fa7('0x3a')][_0x8fa7('0x45')]+'%'};return _0x1d31d3;}})});}_0x20e53e=_['merge']({},_0x20e53e,_0x1d21ba[_0x8fa7('0x49')]);var _0x21ca39={'where':_0x20e53e[_0x8fa7('0x43')]};return db[_0x8fa7('0x34')][_0x8fa7('0x27')](_0x21ca39)['then'](function(_0x29e36e){_0x32c1ca[_0x8fa7('0x27')]=_0x29e36e;if(_0x1d21ba[_0x8fa7('0x3a')][_0x8fa7('0x4a')]){_0x20e53e['include']=[{'all':!![]}];}return db[_0x8fa7('0x34')][_0x8fa7('0x4b')](_0x20e53e);})[_0x8fa7('0x17')](function(_0xd42f6f){_0x32c1ca[_0x8fa7('0x4c')]=_0xd42f6f;return _0x32c1ca;})[_0x8fa7('0x17')](respondWithFilteredResult(_0x122fcb,_0x20e53e))[_0x8fa7('0x4d')](handleError(_0x122fcb,null));};exports[_0x8fa7('0x4e')]=function(_0x1d5188,_0x31e723){var _0x3abe09={'raw':!![],'where':{'id':_0x1d5188[_0x8fa7('0x4f')]['id']}},_0x27cfbf={};_0x27cfbf[_0x8fa7('0x39')]=_[_0x8fa7('0x3b')](db['WhatsappMessage'][_0x8fa7('0x35')]);_0x27cfbf['query']=_[_0x8fa7('0x3b')](_0x1d5188[_0x8fa7('0x3a')]);_0x27cfbf[_0x8fa7('0x3c')]=_['intersection'](_0x27cfbf[_0x8fa7('0x39')],_0x27cfbf[_0x8fa7('0x3a')]);_0x3abe09[_0x8fa7('0x3e')]=_['intersection'](_0x27cfbf['model'],qs[_0x8fa7('0x3f')](_0x1d5188['query'][_0x8fa7('0x3f')]));_0x3abe09[_0x8fa7('0x3e')]=_0x3abe09['attributes'][_0x8fa7('0x50')]?_0x3abe09['attributes']:_0x27cfbf[_0x8fa7('0x39')];if(_0x1d5188['query'][_0x8fa7('0x4a')]){_0x3abe09[_0x8fa7('0x51')]=[{'all':!![]}];}_0x3abe09=_[_0x8fa7('0x46')]({},_0x3abe09,_0x1d5188[_0x8fa7('0x49')]);return db[_0x8fa7('0x34')][_0x8fa7('0x52')](_0x3abe09)[_0x8fa7('0x17')](handleEntityNotFound(_0x31e723,null))['then'](respondWithResult(_0x31e723,null))[_0x8fa7('0x4d')](handleError(_0x31e723,null));};exports[_0x8fa7('0x53')]=function(_0x190b39,_0x4ecdb1){return db[_0x8fa7('0x34')]['create'](_0x190b39['body'],{})['then'](respondWithResult(_0x4ecdb1,0xc9))[_0x8fa7('0x4d')](handleError(_0x4ecdb1,null));};exports['update']=function(_0x5c22f6,_0x46e4de){if(_0x5c22f6[_0x8fa7('0x54')]['id']){delete _0x5c22f6[_0x8fa7('0x54')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x5c22f6[_0x8fa7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46e4de,null))['then'](saveUpdates(_0x5c22f6[_0x8fa7('0x54')],null))[_0x8fa7('0x17')](respondWithResult(_0x46e4de,null))[_0x8fa7('0x4d')](handleError(_0x46e4de,null));};exports[_0x8fa7('0x2f')]=function(_0x2e10eb,_0x518561){return db[_0x8fa7('0x34')][_0x8fa7('0x52')]({'where':{'id':_0x2e10eb[_0x8fa7('0x4f')]['id']}})[_0x8fa7('0x17')](handleEntityNotFound(_0x518561,null))['then'](removeEntity(_0x518561,null))['catch'](handleError(_0x518561,null));};exports[_0x8fa7('0x55')]=function(_0x4255e9,_0x479bcb){return db[_0x8fa7('0x34')][_0x8fa7('0x55')]()['then'](respondWithResult(_0x479bcb,null))[_0x8fa7('0x4d')](handleError(_0x479bcb,null));};var interaction_log=require(_0x8fa7('0xc'))(_0x8fa7('0x56'));exports['accept']=function(_0x5e5848,_0x363f67,_0xe95d2a){var _0x30b8eb={'agent':{},'channel':_0x8fa7('0x57')};if(_0x5e5848[_0x8fa7('0x54')]['id']){delete _0x5e5848['body']['id'];}_0x5e5848[_0x8fa7('0x54')][_0x8fa7('0x58')]=!![];_0x5e5848[_0x8fa7('0x54')][_0x8fa7('0x59')]=moment()[_0x8fa7('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e5848[_0x8fa7('0x54')][_0x8fa7('0x5b')]=_0x5e5848[_0x8fa7('0x54')]['UserId']||_0x5e5848[_0x8fa7('0x5c')]['id'];_0x30b8eb['agent']['id']=_0x5e5848['body'][_0x8fa7('0x5b')];return db[_0x8fa7('0x34')]['find']({'where':{'id':_0x5e5848[_0x8fa7('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x363f67,null))[_0x8fa7('0x17')](saveUpdates(_0x5e5848[_0x8fa7('0x54')],null))[_0x8fa7('0x17')](function(_0x24acaa){if(_0x24acaa){_0x30b8eb[_0x8fa7('0x20')]=_0x24acaa[_0x8fa7('0x5d')]({'plain':!![]});return db[_0x8fa7('0x5e')][_0x8fa7('0x52')]({'where':{'id':_0x24acaa['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x363f67,null))[_0x8fa7('0x17')](function(_0x2800d7){if(_0x2800d7){return _0x2800d7[_0x8fa7('0x2e')]({'UserId':_0x5e5848[_0x8fa7('0x54')][_0x8fa7('0x5b')],'read1stAt':_[_0x8fa7('0x5f')](_0x2800d7[_0x8fa7('0x60')])?moment()[_0x8fa7('0x5a')](_0x8fa7('0x61')):undefined});}return null;})[_0x8fa7('0x17')](function(_0x6c2dc5){if(_0x6c2dc5){_0x30b8eb['interaction']=_0x6c2dc5['get']({'plain':!![]});interaction_log['info'](_0x8fa7('0x62'),_0x5e5848[_0x8fa7('0x5c')]['id'],_0x5e5848[_0x8fa7('0x5c')][_0x8fa7('0x31')],_0x5e5848[_0x8fa7('0x5c')][_0x8fa7('0x63')],_0x30b8eb[_0x8fa7('0x64')]['id'],_0x5e5848[_0x8fa7('0x54')]?JSON[_0x8fa7('0x1c')](_0x5e5848[_0x8fa7('0x54')]):_0x8fa7('0x65'));return respondWithRpcPromise(_0x8fa7('0x66'),'acceptMessage',_0x30b8eb);}return null;})[_0x8fa7('0x17')](function(_0x3c017a){var _0x41e7e7=_0x8fa7('0x67')+_0x3c017a[_0x8fa7('0x20')]['ContactId'];return db[_0x8fa7('0x68')][_0x8fa7('0x3a')](_0x41e7e7,{'type':db[_0x8fa7('0x69')][_0x8fa7('0x6a')]['SELECT'],'raw':!![]})[_0x8fa7('0x17')](function(_0x16ff03){return _0x16ff03;});})[_0x8fa7('0x17')](function(_0x248654){if(_0x248654){_0x30b8eb[_0x8fa7('0x20')][_0x8fa7('0x6b')]=_0x248654[0x0];if(!_0x5e5848[_0x8fa7('0x54')][_0x8fa7('0x5b')])return;return db[_0x8fa7('0x6c')]['find']({'where':{'id':_0x5e5848[_0x8fa7('0x54')][_0x8fa7('0x5b')],'role':'agent'},'attributes':['id',_0x8fa7('0x31'),'fullname',_0x8fa7('0x6d'),_0x8fa7('0x6e')],'raw':!![]});}return null;})[_0x8fa7('0x17')](function(_0x4a3e5b){if(!_0x4a3e5b)return null;_0x30b8eb['message']['agent']=_0x4a3e5b;return _0x30b8eb;})[_0x8fa7('0x17')](function(_0x50c8d6){if(_0x50c8d6){if(_0x5e5848['body'][_0x8fa7('0x6f')]){_0x30b8eb[_0x8fa7('0x20')][_0x8fa7('0x70')]=util[_0x8fa7('0x5a')](_0x8fa7('0x71'),_0x5e5848[_0x8fa7('0x5c')][_0x8fa7('0x31')]);_0x30b8eb[_0x8fa7('0x20')]['channel']=_0x30b8eb[_0x8fa7('0x72')];_0x30b8eb[_0x8fa7('0x20')][_0x8fa7('0x73')]=_0x30b8eb['channel'];_0x30b8eb[_0x8fa7('0x20')][_0x8fa7('0x74')]='accept';return respondWithRpcPromise(_0x8fa7('0x75'),_0x8fa7('0x75'),{'event':_0x8fa7('0x76'),'message':_0x30b8eb['message']},client9002)[_0x8fa7('0x17')](function(){return _0x30b8eb;});}return _0x30b8eb;}return null;})['then'](respondWithResult(_0x363f67,null))['catch'](handleError(_0x363f67,null));};var interaction_log=require(_0x8fa7('0xc'))('whatsapp-interactions');exports[_0x8fa7('0x2c')]=function(_0x17ceb4,_0x2f1dd7,_0x13855d){var _0x71ddfb={'agent':{},'channel':_0x8fa7('0x57')};if(_0x17ceb4[_0x8fa7('0x54')]['id']){delete _0x17ceb4[_0x8fa7('0x54')]['id'];}_0x17ceb4[_0x8fa7('0x54')][_0x8fa7('0x5b')]=_0x17ceb4[_0x8fa7('0x54')][_0x8fa7('0x5b')]||_0x17ceb4['user']['id'];_0x71ddfb[_0x8fa7('0x77')]['id']=_0x17ceb4[_0x8fa7('0x54')]['UserId'];return db[_0x8fa7('0x34')][_0x8fa7('0x52')]({'where':{'id':_0x17ceb4['params']['id'],'UserId':null}})[_0x8fa7('0x17')](handleEntityNotFound(_0x2f1dd7,null))[_0x8fa7('0x17')](function(_0x39cc98){if(_0x39cc98){_0x71ddfb['message']=_0x39cc98[_0x8fa7('0x5d')]({'plain':!![]});return db[_0x8fa7('0x5e')][_0x8fa7('0x52')]({'where':{'id':_0x39cc98['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2f1dd7,null))[_0x8fa7('0x17')](function(_0x25fc39){if(_0x25fc39){_0x71ddfb[_0x8fa7('0x64')]=_0x25fc39['get']({'plain':!![]});interaction_log[_0x8fa7('0x18')](_0x8fa7('0x78'),_0x17ceb4[_0x8fa7('0x5c')]['id'],_0x17ceb4[_0x8fa7('0x5c')][_0x8fa7('0x31')],_0x17ceb4[_0x8fa7('0x5c')][_0x8fa7('0x63')],_0x71ddfb[_0x8fa7('0x64')]['id'],_0x17ceb4[_0x8fa7('0x54')]?JSON[_0x8fa7('0x1c')](_0x17ceb4[_0x8fa7('0x54')]):_0x8fa7('0x65'));return respondWithRpcPromise(_0x8fa7('0x79'),'rejectMessage',_0x71ddfb);}return null;})['then'](function(_0x1a2f68){var _0x2e7335=_0x8fa7('0x67')+_0x1a2f68[_0x8fa7('0x20')][_0x8fa7('0x7a')];return db['sequelize'][_0x8fa7('0x3a')](_0x2e7335,{'type':db[_0x8fa7('0x69')]['QueryTypes'][_0x8fa7('0x7b')],'raw':!![]})['then'](function(_0x29ca4e){return _0x29ca4e;});})[_0x8fa7('0x17')](function(_0x42bb04){if(_0x42bb04){_0x71ddfb['message'][_0x8fa7('0x6b')]=_0x42bb04[0x0];if(!_0x17ceb4['body'][_0x8fa7('0x5b')])return;return db['User'][_0x8fa7('0x52')]({'where':{'id':_0x17ceb4[_0x8fa7('0x54')][_0x8fa7('0x5b')],'role':_0x8fa7('0x77')},'attributes':['id',_0x8fa7('0x31'),'fullname','email',_0x8fa7('0x6e')],'raw':!![]});}return null;})['then'](function(_0x53a8bf){if(!_0x53a8bf)return null;_0x71ddfb[_0x8fa7('0x20')][_0x8fa7('0x77')]=_0x53a8bf;return _0x71ddfb;})[_0x8fa7('0x17')](function(_0x5648dd){if(_0x5648dd){_0x5648dd[_0x8fa7('0x20')][_0x8fa7('0x70')]=util[_0x8fa7('0x5a')](_0x8fa7('0x71'),_0x17ceb4[_0x8fa7('0x5c')]['name']);_0x5648dd['message'][_0x8fa7('0x72')]=_0x71ddfb['channel'];_0x5648dd[_0x8fa7('0x20')][_0x8fa7('0x73')]=_0x71ddfb[_0x8fa7('0x72')];_0x5648dd[_0x8fa7('0x20')]['event']=_0x8fa7('0x2c');respondWithRpcPromise('EventManager',_0x8fa7('0x75'),{'event':_0x8fa7('0x7c'),'message':_0x5648dd[_0x8fa7('0x20')]},client9002);return _0x71ddfb;}return null;})[_0x8fa7('0x17')](respondWithResult(_0x2f1dd7,null))[_0x8fa7('0x4d')](handleError(_0x2f1dd7,null));};exports[_0x8fa7('0x22')]=function(_0x3d10cc,_0x369580,_0x1be66b){if(_0x3d10cc[_0x8fa7('0x54')]['id']){delete _0x3d10cc['body']['id'];}var _0x306e45;return db[_0x8fa7('0x34')]['find']({'where':{'id':_0x3d10cc[_0x8fa7('0x4f')]['id']}})[_0x8fa7('0x17')](handleEntityNotFound(_0x369580,null))[_0x8fa7('0x17')](function(_0x47da23){if(_0x47da23){_0x306e45=_0x47da23;return db[_0x8fa7('0x7d')]['find']({'where':{'id':_0x47da23[_0x8fa7('0x7e')]}});}})[_0x8fa7('0x17')](handleEntityNotFound(_0x369580,null))[_0x8fa7('0x17')](function(_0x2ec2c5){if(_0x2ec2c5){logger[_0x8fa7('0x1a')](_0x8fa7('0x7f'),'status',_0x8fa7('0x80'),_0x2ec2c5[_0x8fa7('0x37')],util[_0x8fa7('0x81')](_0x3d10cc['body'],{'showHidden':![],'depth':null}));switch(_0x2ec2c5[_0x8fa7('0x37')]){case _0x8fa7('0x82'):if(_0x3d10cc[_0x8fa7('0x54')][_0x8fa7('0x83')]&&_0x3d10cc['body'][_0x8fa7('0x83')]===_0x306e45[_0x8fa7('0x84')]&&_0x3d10cc[_0x8fa7('0x54')][_0x8fa7('0x85')]&&_0x3d10cc[_0x8fa7('0x54')][_0x8fa7('0x85')]==='read'){return _0x306e45[_0x8fa7('0x2e')]({'read':!![]});}else{logger['error'](_0x8fa7('0x86'),_0x8fa7('0x22'),_0x8fa7('0x82'),util[_0x8fa7('0x81')](_0x3d10cc[_0x8fa7('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x306e45;}})[_0x8fa7('0x17')](respondWithResult(_0x369580,null))[_0x8fa7('0x4d')](handleError(_0x369580,null));}; \ No newline at end of file +var _0x1d7e=['jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','length','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','contact','User','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x1d7e,0x71));var _0xe1d7=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x1d7e[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0xe1d7('0x0'));var rimraf=require(_0xe1d7('0x1'));var zipdir=require(_0xe1d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1d7('0x3'));var moment=require(_0xe1d7('0x4'));var BPromise=require(_0xe1d7('0x5'));var Mustache=require(_0xe1d7('0x6'));var util=require(_0xe1d7('0x7'));var path=require(_0xe1d7('0x8'));var sox=require('sox');var csv=require(_0xe1d7('0x9'));var ejs=require(_0xe1d7('0xa'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xb'));var _=require(_0xe1d7('0xc'));var squel=require(_0xe1d7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x9'));var querystring=require(_0xe1d7('0xe'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0xf'));var authService=require(_0xe1d7('0x10'));var qs=require(_0xe1d7('0x11'));var as=require(_0xe1d7('0x12'));var hardwareService=require(_0xe1d7('0x13'));var logger=require(_0xe1d7('0x14'))(_0xe1d7('0x15'));var utils=require(_0xe1d7('0x16'));var config=require(_0xe1d7('0x17'));var licenseUtil=require(_0xe1d7('0x18'));var db=require(_0xe1d7('0x19'))['db'];config[_0xe1d7('0x1a')]=_[_0xe1d7('0x1b')](config[_0xe1d7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe1d7('0x1c'))(new Redis(config[_0xe1d7('0x1a')]));require(_0xe1d7('0x1d'))['register'](socket);var jayson=require(_0xe1d7('0x1e'));var client=jayson[_0xe1d7('0x1f')][_0xe1d7('0x20')]({'port':0x232c});var client9002=jayson[_0xe1d7('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x449049,_0x3c7e6b,_0x406101,_0x52de99){return new BPromise(function(_0x5aaa82,_0xa7bf89){var _0x5a275d=_0x52de99||client;return _0x5a275d[_0xe1d7('0x21')](_0x449049,_0x406101)[_0xe1d7('0x22')](function(_0x3fd069){logger['info'](_0xe1d7('0x23'),_0x3c7e6b,_0xe1d7('0x24'));logger[_0xe1d7('0x25')](_0xe1d7('0x26'),_0x3c7e6b,'request\x20sent',JSON[_0xe1d7('0x27')](_0x3fd069));if(_0x3fd069[_0xe1d7('0x28')]){if(_0x3fd069['error'][_0xe1d7('0x29')]===0x1f4){logger[_0xe1d7('0x28')](_0xe1d7('0x23'),_0x3c7e6b,_0x3fd069[_0xe1d7('0x28')]['message']);return _0xa7bf89(_0x3fd069[_0xe1d7('0x28')][_0xe1d7('0x2a')]);}logger[_0xe1d7('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x3c7e6b,_0x3fd069[_0xe1d7('0x28')][_0xe1d7('0x2a')]);return _0x5aaa82(_0x3fd069['error'][_0xe1d7('0x2a')]);}else{logger['info'](_0xe1d7('0x23'),_0x3c7e6b,_0xe1d7('0x24'));_0x5aaa82(_0x3fd069['result']['message']);}})[_0xe1d7('0x2b')](function(_0x4341b6){logger[_0xe1d7('0x28')](_0xe1d7('0x23'),_0x3c7e6b,_0x4341b6);_0xa7bf89(_0x4341b6);});});}function respondWithStatusCode(_0x31b9a1,_0x152062){_0x152062=_0x152062||0xcc;return function(_0x16be88){if(_0x16be88){return _0x31b9a1['sendStatus'](_0x152062);}return _0x31b9a1[_0xe1d7('0x2c')](_0x152062)[_0xe1d7('0x2d')]();};}function respondWithResult(_0x49f862,_0x87d6c7){_0x87d6c7=_0x87d6c7||0xc8;return function(_0x4ed7ba){if(_0x4ed7ba){return _0x49f862[_0xe1d7('0x2c')](_0x87d6c7)[_0xe1d7('0x2e')](_0x4ed7ba);}};}function respondWithFilteredResult(_0x3726d3,_0x1eb749){return function(_0x4ecbd3){if(_0x4ecbd3){var _0x1a0924=typeof _0x1eb749[_0xe1d7('0x2f')]===_0xe1d7('0x30')&&typeof _0x1eb749[_0xe1d7('0x31')]===_0xe1d7('0x30');var _0x3963e5=_0x4ecbd3[_0xe1d7('0x32')];var _0x3cbcd7=_0x1a0924?0x0:_0x1eb749[_0xe1d7('0x2f')];var _0x23995e=_0x1a0924?_0x4ecbd3[_0xe1d7('0x32')]:_0x1eb749[_0xe1d7('0x2f')]+_0x1eb749['limit'];var _0xf7adb4;if(_0x23995e>=_0x3963e5){_0x23995e=_0x3963e5;_0xf7adb4=0xc8;}else{_0xf7adb4=0xce;}_0x3726d3['status'](_0xf7adb4);return _0x3726d3[_0xe1d7('0x33')](_0xe1d7('0x34'),_0x3cbcd7+'-'+_0x23995e+'/'+_0x3963e5)[_0xe1d7('0x2e')](_0x4ecbd3);}return null;};}function patchUpdates(_0x480f13){return function(_0x278cac){try{jsonpatch[_0xe1d7('0x35')](_0x278cac,_0x480f13,!![]);}catch(_0x28e0f7){return BPromise[_0xe1d7('0x36')](_0x28e0f7);}return _0x278cac[_0xe1d7('0x37')]();};}function saveUpdates(_0x136e41,_0x5cbf96){return function(_0x9e9ee0){if(_0x9e9ee0){return _0x9e9ee0[_0xe1d7('0x38')](_0x136e41)['then'](function(_0x1b0db5){return _0x1b0db5;});}return null;};}function removeEntity(_0x2059d0,_0x4ea709){return function(_0x2ae4b3){if(_0x2ae4b3){return _0x2ae4b3[_0xe1d7('0x39')]()[_0xe1d7('0x22')](function(){_0x2059d0[_0xe1d7('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2977c,_0x3e6e7b){return function(_0x218ad5){if(!_0x218ad5){_0xd2977c['sendStatus'](0x194);}return _0x218ad5;};}function handleError(_0x4321c9,_0x4b68c2){_0x4b68c2=_0x4b68c2||0x1f4;return function(_0x16eb02){logger[_0xe1d7('0x28')](_0x16eb02[_0xe1d7('0x3a')]);if(_0x16eb02[_0xe1d7('0x3b')]){delete _0x16eb02[_0xe1d7('0x3b')];}_0x4321c9[_0xe1d7('0x2c')](_0x4b68c2)[_0xe1d7('0x3c')](_0x16eb02);};}exports[_0xe1d7('0x3d')]=function(_0x3613e1,_0x5483a9){var _0x1f1fc0={},_0x5a165c={},_0xe85643={'count':0x0,'rows':[]};var _0x3343c0=_[_0xe1d7('0x3e')](db[_0xe1d7('0x3f')][_0xe1d7('0x40')],function(_0x549482){return{'name':_0x549482[_0xe1d7('0x41')],'type':_0x549482['type'][_0xe1d7('0x42')]};});_0x5a165c['model']=_[_0xe1d7('0x3e')](_0x3343c0,_0xe1d7('0x3b'));_0x5a165c[_0xe1d7('0x43')]=_[_0xe1d7('0x44')](_0x3613e1['query']);_0x5a165c[_0xe1d7('0x45')]=_[_0xe1d7('0x46')](_0x5a165c[_0xe1d7('0x47')],_0x5a165c[_0xe1d7('0x43')]);_0x1f1fc0[_0xe1d7('0x48')]=_[_0xe1d7('0x46')](_0x5a165c[_0xe1d7('0x47')],qs[_0xe1d7('0x49')](_0x3613e1[_0xe1d7('0x43')][_0xe1d7('0x49')]));_0x1f1fc0[_0xe1d7('0x48')]=_0x1f1fc0[_0xe1d7('0x48')]['length']?_0x1f1fc0[_0xe1d7('0x48')]:_0x5a165c[_0xe1d7('0x47')];if(!_0x3613e1[_0xe1d7('0x43')][_0xe1d7('0x4a')]('nolimit')){_0x1f1fc0[_0xe1d7('0x31')]=qs[_0xe1d7('0x31')](_0x3613e1[_0xe1d7('0x43')][_0xe1d7('0x31')]);_0x1f1fc0[_0xe1d7('0x2f')]=qs[_0xe1d7('0x2f')](_0x3613e1['query']['offset']);}_0x1f1fc0['order']=qs[_0xe1d7('0x4b')](_0x3613e1['query']['sort']);_0x1f1fc0[_0xe1d7('0x4c')]=qs['filters'](_[_0xe1d7('0x4d')](_0x3613e1['query'],_0x5a165c[_0xe1d7('0x45')]),_0x3343c0);if(_0x3613e1['query'][_0xe1d7('0x4e')]){_0x1f1fc0['where']=_[_0xe1d7('0x4f')](_0x1f1fc0[_0xe1d7('0x4c')],{'$or':_[_0xe1d7('0x3e')](_0x3343c0,function(_0x553d5e){if(_0x553d5e[_0xe1d7('0x50')]!==_0xe1d7('0x51')){var _0x503192={};_0x503192[_0x553d5e[_0xe1d7('0x3b')]]={'$like':'%'+_0x3613e1[_0xe1d7('0x43')][_0xe1d7('0x4e')]+'%'};return _0x503192;}})});}_0x1f1fc0=_[_0xe1d7('0x4f')]({},_0x1f1fc0,_0x3613e1[_0xe1d7('0x52')]);var _0x3765ab={'where':_0x1f1fc0['where']};return db[_0xe1d7('0x3f')][_0xe1d7('0x32')](_0x3765ab)[_0xe1d7('0x22')](function(_0x2fc2ac){_0xe85643[_0xe1d7('0x32')]=_0x2fc2ac;if(_0x3613e1[_0xe1d7('0x43')][_0xe1d7('0x53')]){_0x1f1fc0[_0xe1d7('0x54')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xe1d7('0x55')](_0x1f1fc0);})['then'](function(_0x1bd389){_0xe85643[_0xe1d7('0x56')]=_0x1bd389;return _0xe85643;})[_0xe1d7('0x22')](respondWithFilteredResult(_0x5483a9,_0x1f1fc0))['catch'](handleError(_0x5483a9,null));};exports['show']=function(_0xcdb433,_0x1b0cee){var _0x2aef9f={'raw':!![],'where':{'id':_0xcdb433['params']['id']}},_0x3c91b6={};_0x3c91b6[_0xe1d7('0x47')]=_['keys'](db[_0xe1d7('0x3f')][_0xe1d7('0x40')]);_0x3c91b6[_0xe1d7('0x43')]=_[_0xe1d7('0x44')](_0xcdb433[_0xe1d7('0x43')]);_0x3c91b6['filters']=_[_0xe1d7('0x46')](_0x3c91b6[_0xe1d7('0x47')],_0x3c91b6[_0xe1d7('0x43')]);_0x2aef9f[_0xe1d7('0x48')]=_['intersection'](_0x3c91b6[_0xe1d7('0x47')],qs['fields'](_0xcdb433[_0xe1d7('0x43')][_0xe1d7('0x49')]));_0x2aef9f[_0xe1d7('0x48')]=_0x2aef9f['attributes'][_0xe1d7('0x57')]?_0x2aef9f[_0xe1d7('0x48')]:_0x3c91b6[_0xe1d7('0x47')];if(_0xcdb433[_0xe1d7('0x43')][_0xe1d7('0x53')]){_0x2aef9f[_0xe1d7('0x54')]=[{'all':!![]}];}_0x2aef9f=_[_0xe1d7('0x4f')]({},_0x2aef9f,_0xcdb433[_0xe1d7('0x52')]);return db[_0xe1d7('0x3f')][_0xe1d7('0x58')](_0x2aef9f)[_0xe1d7('0x22')](handleEntityNotFound(_0x1b0cee,null))[_0xe1d7('0x22')](respondWithResult(_0x1b0cee,null))[_0xe1d7('0x2b')](handleError(_0x1b0cee,null));};exports[_0xe1d7('0x59')]=function(_0x508806,_0x21ed30){return db['WhatsappMessage'][_0xe1d7('0x59')](_0x508806[_0xe1d7('0x5a')],{})['then'](respondWithResult(_0x21ed30,0xc9))[_0xe1d7('0x2b')](handleError(_0x21ed30,null));};exports[_0xe1d7('0x38')]=function(_0x4b2107,_0x4f93a7){if(_0x4b2107[_0xe1d7('0x5a')]['id']){delete _0x4b2107[_0xe1d7('0x5a')]['id'];}return db['WhatsappMessage'][_0xe1d7('0x58')]({'where':{'id':_0x4b2107['params']['id']}})[_0xe1d7('0x22')](handleEntityNotFound(_0x4f93a7,null))[_0xe1d7('0x22')](saveUpdates(_0x4b2107[_0xe1d7('0x5a')],null))['then'](respondWithResult(_0x4f93a7,null))[_0xe1d7('0x2b')](handleError(_0x4f93a7,null));};exports[_0xe1d7('0x39')]=function(_0x5f166a,_0x460713){return db['WhatsappMessage'][_0xe1d7('0x58')]({'where':{'id':_0x5f166a[_0xe1d7('0x5b')]['id']}})[_0xe1d7('0x22')](handleEntityNotFound(_0x460713,null))[_0xe1d7('0x22')](removeEntity(_0x460713,null))['catch'](handleError(_0x460713,null));};exports[_0xe1d7('0x5c')]=function(_0x439105,_0x47ad27){return db[_0xe1d7('0x3f')]['describe']()['then'](respondWithResult(_0x47ad27,null))['catch'](handleError(_0x47ad27,null));};var interaction_log=require(_0xe1d7('0x14'))(_0xe1d7('0x5d'));exports[_0xe1d7('0x5e')]=function(_0x4becb2,_0x44d634,_0x438832){var _0x4e39c5={'agent':{},'channel':_0xe1d7('0x5f')};if(_0x4becb2[_0xe1d7('0x5a')]['id']){delete _0x4becb2[_0xe1d7('0x5a')]['id'];}_0x4becb2['body'][_0xe1d7('0x60')]=!![];_0x4becb2[_0xe1d7('0x5a')][_0xe1d7('0x61')]=moment()[_0xe1d7('0x62')](_0xe1d7('0x63'));_0x4becb2[_0xe1d7('0x5a')][_0xe1d7('0x64')]=_0x4becb2[_0xe1d7('0x5a')][_0xe1d7('0x64')]||_0x4becb2[_0xe1d7('0x65')]['id'];_0x4e39c5[_0xe1d7('0x66')]['id']=_0x4becb2[_0xe1d7('0x5a')][_0xe1d7('0x64')];return db[_0xe1d7('0x3f')][_0xe1d7('0x58')]({'where':{'id':_0x4becb2[_0xe1d7('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44d634,null))[_0xe1d7('0x22')](saveUpdates(_0x4becb2[_0xe1d7('0x5a')],null))[_0xe1d7('0x22')](function(_0x17c3c0){if(_0x17c3c0){_0x4e39c5[_0xe1d7('0x2a')]=_0x17c3c0[_0xe1d7('0x67')]({'plain':!![]});return db[_0xe1d7('0x68')][_0xe1d7('0x58')]({'where':{'id':_0x17c3c0[_0xe1d7('0x69')]}});}return null;})[_0xe1d7('0x22')](handleEntityNotFound(_0x44d634,null))['then'](function(_0x28b372){if(_0x28b372){return _0x28b372[_0xe1d7('0x38')]({'UserId':_0x4becb2['body']['UserId'],'read1stAt':_[_0xe1d7('0x6a')](_0x28b372[_0xe1d7('0x6b')])?moment()['format'](_0xe1d7('0x63')):undefined});}return null;})['then'](function(_0x2a3050){if(_0x2a3050){_0x4e39c5[_0xe1d7('0x6c')]=_0x2a3050['get']({'plain':!![]});interaction_log[_0xe1d7('0x6d')](_0xe1d7('0x6e'),_0x4becb2['user']['id'],_0x4becb2[_0xe1d7('0x65')][_0xe1d7('0x3b')],_0x4becb2[_0xe1d7('0x65')][_0xe1d7('0x6f')],_0x4e39c5[_0xe1d7('0x6c')]['id'],_0x4becb2[_0xe1d7('0x5a')]?JSON[_0xe1d7('0x27')](_0x4becb2['body']):_0xe1d7('0x70'));return respondWithRpcPromise('AcceptMessage',_0xe1d7('0x71'),_0x4e39c5);}return null;})[_0xe1d7('0x22')](function(_0x1836d2){var _0xe356a5=_0xe1d7('0x72')+_0x1836d2['message'][_0xe1d7('0x73')];return db[_0xe1d7('0x74')]['query'](_0xe356a5,{'type':db[_0xe1d7('0x75')][_0xe1d7('0x76')]['SELECT'],'raw':!![]})[_0xe1d7('0x22')](function(_0x3b7753){return _0x3b7753;});})['then'](function(_0x1963e4){if(_0x1963e4){_0x4e39c5[_0xe1d7('0x2a')]['contact']=_0x1963e4[0x0];if(!_0x4becb2['body']['UserId'])return;return db['User'][_0xe1d7('0x58')]({'where':{'id':_0x4becb2[_0xe1d7('0x5a')][_0xe1d7('0x64')],'role':_0xe1d7('0x66')},'attributes':['id','name',_0xe1d7('0x77'),_0xe1d7('0x78'),'internal'],'raw':!![]});}return null;})['then'](function(_0x233863){if(!_0x233863)return null;_0x4e39c5[_0xe1d7('0x2a')][_0xe1d7('0x66')]=_0x233863;return _0x4e39c5;})['then'](function(_0x41ce12){if(_0x41ce12){if(_0x4becb2['body'][_0xe1d7('0x79')]){_0x4e39c5[_0xe1d7('0x2a')][_0xe1d7('0x7a')]=util[_0xe1d7('0x62')](_0xe1d7('0x7b'),_0x4becb2[_0xe1d7('0x65')][_0xe1d7('0x3b')]);_0x4e39c5[_0xe1d7('0x2a')][_0xe1d7('0x7c')]=_0x4e39c5[_0xe1d7('0x7c')];_0x4e39c5[_0xe1d7('0x2a')]['motionChannel']=_0x4e39c5['channel'];_0x4e39c5['message'][_0xe1d7('0x7d')]=_0xe1d7('0x5e');return respondWithRpcPromise(_0xe1d7('0x7e'),_0xe1d7('0x7e'),{'event':_0xe1d7('0x7f'),'message':_0x4e39c5[_0xe1d7('0x2a')]},client9002)[_0xe1d7('0x22')](function(){return _0x4e39c5;});}return _0x4e39c5;}return null;})[_0xe1d7('0x22')](respondWithResult(_0x44d634,null))[_0xe1d7('0x2b')](handleError(_0x44d634,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xe1d7('0x36')]=function(_0xcc2e08,_0x2aa9e7,_0x44dbce){var _0x2b9726={'agent':{},'channel':_0xe1d7('0x5f')};if(_0xcc2e08[_0xe1d7('0x5a')]['id']){delete _0xcc2e08['body']['id'];}_0xcc2e08[_0xe1d7('0x5a')][_0xe1d7('0x64')]=_0xcc2e08[_0xe1d7('0x5a')][_0xe1d7('0x64')]||_0xcc2e08[_0xe1d7('0x65')]['id'];_0x2b9726[_0xe1d7('0x66')]['id']=_0xcc2e08[_0xe1d7('0x5a')][_0xe1d7('0x64')];return db[_0xe1d7('0x3f')][_0xe1d7('0x58')]({'where':{'id':_0xcc2e08[_0xe1d7('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2aa9e7,null))['then'](function(_0x372cc6){if(_0x372cc6){_0x2b9726[_0xe1d7('0x2a')]=_0x372cc6[_0xe1d7('0x67')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x372cc6[_0xe1d7('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x2aa9e7,null))[_0xe1d7('0x22')](function(_0x373e75){if(_0x373e75){_0x2b9726['interaction']=_0x373e75[_0xe1d7('0x67')]({'plain':!![]});interaction_log[_0xe1d7('0x6d')](_0xe1d7('0x80'),_0xcc2e08[_0xe1d7('0x65')]['id'],_0xcc2e08[_0xe1d7('0x65')]['name'],_0xcc2e08['user']['role'],_0x2b9726[_0xe1d7('0x6c')]['id'],_0xcc2e08['body']?JSON[_0xe1d7('0x27')](_0xcc2e08['body']):'null');return respondWithRpcPromise(_0xe1d7('0x81'),_0xe1d7('0x82'),_0x2b9726);}return null;})[_0xe1d7('0x22')](function(_0x5f2011){var _0x59682d=_0xe1d7('0x72')+_0x5f2011[_0xe1d7('0x2a')][_0xe1d7('0x73')];return db[_0xe1d7('0x74')][_0xe1d7('0x43')](_0x59682d,{'type':db[_0xe1d7('0x75')][_0xe1d7('0x76')][_0xe1d7('0x83')],'raw':!![]})['then'](function(_0x21d4fd){return _0x21d4fd;});})['then'](function(_0x4c1ea8){if(_0x4c1ea8){_0x2b9726[_0xe1d7('0x2a')][_0xe1d7('0x84')]=_0x4c1ea8[0x0];if(!_0xcc2e08['body'][_0xe1d7('0x64')])return;return db[_0xe1d7('0x85')]['find']({'where':{'id':_0xcc2e08[_0xe1d7('0x5a')]['UserId'],'role':_0xe1d7('0x66')},'attributes':['id',_0xe1d7('0x3b'),_0xe1d7('0x77'),_0xe1d7('0x78'),'internal'],'raw':!![]});}return null;})[_0xe1d7('0x22')](function(_0x3e4b30){if(!_0x3e4b30)return null;_0x2b9726['message'][_0xe1d7('0x66')]=_0x3e4b30;return _0x2b9726;})[_0xe1d7('0x22')](function(_0xa7a28c){if(_0xa7a28c){_0xa7a28c[_0xe1d7('0x2a')][_0xe1d7('0x7a')]=util[_0xe1d7('0x62')](_0xe1d7('0x7b'),_0xcc2e08[_0xe1d7('0x65')][_0xe1d7('0x3b')]);_0xa7a28c[_0xe1d7('0x2a')]['channel']=_0x2b9726[_0xe1d7('0x7c')];_0xa7a28c['message']['motionChannel']=_0x2b9726[_0xe1d7('0x7c')];_0xa7a28c['message'][_0xe1d7('0x7d')]=_0xe1d7('0x36');respondWithRpcPromise(_0xe1d7('0x7e'),_0xe1d7('0x7e'),{'event':_0xe1d7('0x86'),'message':_0xa7a28c[_0xe1d7('0x2a')]},client9002);return _0x2b9726;}return null;})[_0xe1d7('0x22')](respondWithResult(_0x2aa9e7,null))[_0xe1d7('0x2b')](handleError(_0x2aa9e7,null));};exports[_0xe1d7('0x2c')]=function(_0x399c4b,_0x44fe2f,_0x48f93c){if(_0x399c4b[_0xe1d7('0x5a')]['id']){delete _0x399c4b[_0xe1d7('0x5a')]['id'];}var _0x5e14a6;return db[_0xe1d7('0x3f')]['find']({'where':{'id':_0x399c4b[_0xe1d7('0x5b')]['id']}})[_0xe1d7('0x22')](handleEntityNotFound(_0x44fe2f,null))['then'](function(_0x502682){if(_0x502682){_0x5e14a6=_0x502682;return db[_0xe1d7('0x87')][_0xe1d7('0x58')]({'where':{'id':_0x502682['WhatsappAccountId']}});}})[_0xe1d7('0x22')](handleEntityNotFound(_0x44fe2f,null))['then'](function(_0x15e1f9){if(_0x15e1f9){logger[_0xe1d7('0x25')](_0xe1d7('0x88'),_0xe1d7('0x2c'),'received\x20delivery\x20report\x20from',_0x15e1f9['type'],util[_0xe1d7('0x89')](_0x399c4b[_0xe1d7('0x5a')],{'showHidden':![],'depth':null}));switch(_0x15e1f9[_0xe1d7('0x50')]){case _0xe1d7('0x8a'):if(_0x399c4b[_0xe1d7('0x5a')][_0xe1d7('0x8b')]&&_0x399c4b[_0xe1d7('0x5a')][_0xe1d7('0x8b')]===_0x5e14a6[_0xe1d7('0x8c')]&&_0x399c4b[_0xe1d7('0x5a')][_0xe1d7('0x8d')]&&_0x399c4b[_0xe1d7('0x5a')][_0xe1d7('0x8d')]===_0xe1d7('0x60')){return _0x5e14a6['update']({'read':!![]});}else{logger[_0xe1d7('0x28')](_0xe1d7('0x8e'),_0xe1d7('0x2c'),_0xe1d7('0x8a'),util[_0xe1d7('0x89')](_0x399c4b[_0xe1d7('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x5e14a6;}})[_0xe1d7('0x22')](respondWithResult(_0x44fe2f,null))[_0xe1d7('0x2b')](handleError(_0x44fe2f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b7d663c..d9b7a53 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 _0x9c00=['emit','hook','exports','events','../../mysqldb','save','update'];(function(_0x1deafc,_0x202527){var _0xb2482e=function(_0x59644f){while(--_0x59644f){_0x1deafc['push'](_0x1deafc['shift']());}};_0xb2482e(++_0x202527);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2ce4bb,_0x4bc632){_0x2ce4bb=_0x2ce4bb-0x0;var _0x19356b=_0x9c00[_0x2ce4bb];return _0x19356b;};'use strict';var EventEmitter=require(_0x09c0('0x0'));var WhatsappMessage=require(_0x09c0('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x09c0('0x2'),'afterUpdate':_0x09c0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x220c0c){return function(_0x2c702c,_0x2ed715,_0x2fd03e){WhatsappMessageEvents[_0x09c0('0x4')](_0x220c0c+':'+_0x2c702c['id'],_0x2c702c);WhatsappMessageEvents['emit'](_0x220c0c,_0x2c702c);_0x2fd03e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x09c0('0x5')](e,emitEvent(event));}}module[_0x09c0('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0db9=['hook','exports','events','save','update','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0db9,0xa3));var _0x90db=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0x0db9[_0x4bfcbe];return _0x5b65e6;};'use strict';var EventEmitter=require(_0x90db('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90db('0x1'),'afterUpdate':_0x90db('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2da262){return function(_0x500dcf,_0x1e0f41,_0x29b59f){WhatsappMessageEvents['emit'](_0x2da262+':'+_0x500dcf['id'],_0x500dcf);WhatsappMessageEvents[_0x90db('0x3')](_0x2da262,_0x500dcf);_0x29b59f(null);};}for(var e in events){if(events[_0x90db('0x4')](e)){var event=events[e];WhatsappMessage[_0x90db('0x5')](e,emitEvent(event));}}module[_0x90db('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 88f355f..984a846 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 _0x990b=['../../config/logger','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','catch','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x990b,0x1df));var _0xb990=function(_0x1bb471,_0x50059d){_0x1bb471=_0x1bb471-0x0;var _0x50684f=_0x990b[_0x1bb471];return _0x50684f;};'use strict';var _=require('lodash');var util=require(_0xb990('0x0'));var logger=require(_0xb990('0x1'))('api');var moment=require(_0xb990('0x2'));var BPromise=require(_0xb990('0x3'));var rp=require(_0xb990('0x4'));var fetch=require(_0xb990('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb990('0x6'));var config=require(_0xb990('0x7'));var attributes=require(_0xb990('0x8'));module[_0xb990('0x9')]=function(_0x4d35b5,_0x2979c2){return _0x4d35b5[_0xb990('0xa')]('WhatsappMessage',attributes,{'tableName':_0xb990('0xb'),'paranoid':![],'indexes':[{'name':_0xb990('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xb990('0xd')],'type':_0xb990('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fbb2b,_0x3f58f6,_0x594358){var _0x2e5ba5=_0x4d35b5[_0xb990('0xf')];var _0x212e63=_0x1fbb2b[_0xb990('0x10')]({'plain':!![]});if(_0x212e63['direction'][_0xb990('0x11')]()==='in'||_0x212e63[_0xb990('0x12')][_0xb990('0x11')]()===_0xb990('0x13')&&!_0x212e63[_0xb990('0x14')]&&!_[_0xb990('0x15')](_0x212e63[_0xb990('0x16')])){_0x2e5ba5[_0xb990('0x17')][_0xb990('0x18')]({'where':{'id':_0x212e63['WhatsappInteractionId']}})['then'](function(_0x6eee58){if(_0x6eee58){_0x6eee58[_0xb990('0x19')]({'lastMsgAt':_0x212e63[_0xb990('0x1a')],'lastMsgDirection':_0x212e63[_0xb990('0x12')]['toLowerCase']()});}})[_0xb990('0x1b')](function(_0x3a651a){console['error'](_0x3a651a);});}if(_0x212e63[_0xb990('0x12')]===_0xb990('0x13')&&!_0x212e63[_0xb990('0x14')]){var _0x200e0f;_0x2e5ba5[_0xb990('0x1c')]['find']({'where':{'id':_0x212e63[_0xb990('0x1d')]},'raw':!![]})[_0xb990('0x1e')](function(_0x17b644){_0x200e0f=_0x17b644;if(_0x200e0f&&_0x200e0f[_0xb990('0x1f')]){switch(_0x200e0f[_0xb990('0x1f')]){case _0xb990('0x20'):var _0x59da85=require(_0xb990('0x20'));if(_0x200e0f[_0xb990('0x21')]&&_0x200e0f[_0xb990('0x22')]&&_0x200e0f['phone']){var _0x4b32b2=new _0x59da85(_0x200e0f['accountSid'],_0x200e0f[_0xb990('0x22')]);_0x4b32b2[_0xb990('0x23')][_0xb990('0x24')]({'body':_0x212e63['body'],'to':_0xb990('0x25')+_0x212e63[_0xb990('0x26')],'from':_0xb990('0x25')+_0x200e0f[_0xb990('0x26')],'statusCallback':_0x200e0f[_0xb990('0x27')]+_0xb990('0x28')+_0x212e63['id']+_0xb990('0x29')+_0x200e0f[_0xb990('0x2a')]})[_0xb990('0x1e')](function(_0x484cb4){if(_0x484cb4['sid']){return _0x1fbb2b[_0xb990('0x19')]({'messageId':_0x484cb4[_0xb990('0x2b')]});}})['catch'](function(_0x262f38){logger[_0xb990('0x2c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb990('0x2d'),'twilio',util[_0xb990('0x2e')](_0x262f38,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb990('0x2f'),_0xb990('0x2d'),_0xb990('0x20'),_0xb990('0x30'));}break;case _0xb990('0x31'):var _0x5e470c=_0x200e0f[_0xb990('0x21')];var _0x542d6b=_0x200e0f['authToken'];var _0x768ce9=_0x200e0f[_0xb990('0x32')]+_0xb990('0x33')+_0x5e470c+_0xb990('0x34');var _0x8d33aa={'to':[_0x212e63[_0xb990('0x26')]],'message':{'type':'text','text':_0x212e63[_0xb990('0xd')]}};var _0x316518={'method':_0xb990('0x35'),'uri':_0x768ce9,'headers':{'Authorization':'Bearer\x20'+_0x542d6b,'Content-Type':'application/json'},'body':_0x8d33aa,'json':!![]};rp(_0x316518)[_0xb990('0x1e')](function(_0x56eb7a){if(_0x56eb7a[_0xb990('0x36')][0x0]['message_id']){return _0x1fbb2b[_0xb990('0x19')]({'messageId':_0x56eb7a[_0xb990('0x36')][0x0][_0xb990('0x37')]});}})[_0xb990('0x1b')](function(_0x11087f){logger[_0xb990('0x38')]('WhatsappMessage,\x20%s',_0x11087f);});break;}}})[_0xb990('0x39')](function(){_0x594358();});}else{_0x594358();}}},'charset':_0xb990('0x3a'),'collate':_0xb990('0x3b')});}; \ No newline at end of file +var _0x851e=['catch','error','find','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','WhatsappInteraction','findOne','then','update'];(function(_0x21f86d,_0x5df318){var _0x1c8bf7=function(_0x1b87a2){while(--_0x1b87a2){_0x21f86d['push'](_0x21f86d['shift']());}};_0x1c8bf7(++_0x5df318);}(_0x851e,0x1e8));var _0xe851=function(_0x508167,_0x2a24ec){_0x508167=_0x508167-0x0;var _0x5e7a78=_0x851e[_0x508167];return _0x5e7a78;};'use strict';var _=require(_0xe851('0x0'));var util=require(_0xe851('0x1'));var logger=require(_0xe851('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe851('0x3'));var rp=require(_0xe851('0x4'));var fetch=require(_0xe851('0x5'));var fs=require('fs');var path=require(_0xe851('0x6'));var rimraf=require(_0xe851('0x7'));var config=require('../../config/environment');var attributes=require(_0xe851('0x8'));module[_0xe851('0x9')]=function(_0xba0648,_0x37ac0b){return _0xba0648[_0xe851('0xa')]('WhatsappMessage',attributes,{'tableName':_0xe851('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xe851('0xc'),'fields':[_0xe851('0xd')],'type':_0xe851('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe0cb8d,_0x4e5eca,_0x3325f5){var _0xd5d71c=_0xba0648[_0xe851('0xf')];var _0x4e360f=_0xe0cb8d[_0xe851('0x10')]({'plain':!![]});if(_0x4e360f['direction'][_0xe851('0x11')]()==='in'||_0x4e360f[_0xe851('0x12')]['toLowerCase']()===_0xe851('0x13')&&!_0x4e360f['secret']&&!_[_0xe851('0x14')](_0x4e360f['UserId'])){_0xd5d71c[_0xe851('0x15')][_0xe851('0x16')]({'where':{'id':_0x4e360f['WhatsappInteractionId']}})[_0xe851('0x17')](function(_0x3ba4cb){if(_0x3ba4cb){_0x3ba4cb[_0xe851('0x18')]({'lastMsgAt':_0x4e360f['createdAt'],'lastMsgDirection':_0x4e360f['direction'][_0xe851('0x11')]()});}})[_0xe851('0x19')](function(_0x1c7181){console[_0xe851('0x1a')](_0x1c7181);});}if(_0x4e360f[_0xe851('0x12')]===_0xe851('0x13')&&!_0x4e360f['secret']){var _0xa8a883;_0xd5d71c['WhatsappAccount'][_0xe851('0x1b')]({'where':{'id':_0x4e360f['WhatsappAccountId']},'raw':!![]})[_0xe851('0x17')](function(_0x51d5ba){_0xa8a883=_0x51d5ba;if(_0xa8a883&&_0xa8a883[_0xe851('0x1c')]){switch(_0xa8a883[_0xe851('0x1c')]){case _0xe851('0x1d'):var _0x1adceb=require(_0xe851('0x1d'));if(_0xa8a883[_0xe851('0x1e')]&&_0xa8a883[_0xe851('0x1f')]&&_0xa8a883[_0xe851('0x20')]){var _0x4d1c54=new _0x1adceb(_0xa8a883[_0xe851('0x1e')],_0xa8a883['authToken']);_0x4d1c54[_0xe851('0x21')]['create']({'body':_0x4e360f[_0xe851('0xd')],'to':_0xe851('0x22')+_0x4e360f['phone'],'from':'whatsapp:'+_0xa8a883[_0xe851('0x20')],'statusCallback':_0xa8a883[_0xe851('0x23')]+_0xe851('0x24')+_0x4e360f['id']+_0xe851('0x25')+_0xa8a883[_0xe851('0x26')]})[_0xe851('0x17')](function(_0x4ce93a){if(_0x4ce93a[_0xe851('0x27')]){return _0xe0cb8d[_0xe851('0x18')]({'messageId':_0x4ce93a['sid']});}})['catch'](function(_0x40af50){logger['error'](_0xe851('0x28'),_0xe851('0x29'),_0xe851('0x1d'),util[_0xe851('0x2a')](_0x40af50,{'showHidden':![],'depth':null}));});}else{logger[_0xe851('0x1a')](_0xe851('0x28'),_0xe851('0x29'),_0xe851('0x1d'),_0xe851('0x2b'));}break;case _0xe851('0x2c'):var _0x595de7=_0xa8a883['accountSid'];var _0x5d2a79=_0xa8a883[_0xe851('0x1f')];var _0x3a8631=_0xa8a883[_0xe851('0x2d')]+_0xe851('0x2e')+_0x595de7+'/messages/';var _0x4d9d17={'to':[_0x4e360f[_0xe851('0x20')]],'message':{'type':_0xe851('0x2f'),'text':_0x4e360f[_0xe851('0xd')]}};var _0x7d1569={'method':_0xe851('0x30'),'uri':_0x3a8631,'headers':{'Authorization':_0xe851('0x31')+_0x5d2a79,'Content-Type':_0xe851('0x32')},'body':_0x4d9d17,'json':!![]};rp(_0x7d1569)['then'](function(_0x5e6840){if(_0x5e6840[_0xe851('0x33')][0x0][_0xe851('0x34')]){return _0xe0cb8d[_0xe851('0x18')]({'messageId':_0x5e6840[_0xe851('0x33')][0x0][_0xe851('0x34')]});}})[_0xe851('0x19')](function(_0x31a9bd){logger[_0xe851('0x35')](_0xe851('0x36'),_0x31a9bd);});break;}}})[_0xe851('0x37')](function(){_0x3325f5();});}else{_0x3325f5();}}},'charset':'utf8mb4','collate':_0xe851('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 2dec958..db3563e 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 _0x2f88=['create','body','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x2d1512,_0x293ac6){var _0x2fe59e=function(_0x433af8){while(--_0x433af8){_0x2d1512['push'](_0x2d1512['shift']());}};_0x2fe59e(++_0x293ac6);}(_0x2f88,0x85));var _0x82f8=function(_0x3345fe,_0x2c4041){_0x3345fe=_0x3345fe-0x0;var _0x9866b5=_0x2f88[_0x3345fe];return _0x9866b5;};'use strict';var _=require(_0x82f8('0x0'));var util=require(_0x82f8('0x1'));var moment=require(_0x82f8('0x2'));var BPromise=require(_0x82f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82f8('0x4'));var db=require(_0x82f8('0x5'))['db'];var utils=require(_0x82f8('0x6'));var logger=require(_0x82f8('0x7'))('rpc');var config=require(_0x82f8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x82f8('0x9')][_0x82f8('0xa')]({'port':0x232a});config[_0x82f8('0xb')]=_[_0x82f8('0xc')](config[_0x82f8('0xb')],{'host':_0x82f8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82f8('0xb')]));require(_0x82f8('0xe'))[_0x82f8('0xf')](socket);function respondWithRpcPromise(_0x3c7f96,_0x57484f,_0x59977c){return new BPromise(function(_0x642cb0,_0xcac42e){return client['request'](_0x3c7f96,_0x59977c)[_0x82f8('0x10')](function(_0x53e216){logger[_0x82f8('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x57484f,_0x82f8('0x12'));logger['debug'](_0x82f8('0x13'),_0x57484f,_0x82f8('0x12'),JSON[_0x82f8('0x14')](_0x53e216));if(_0x53e216['error']){if(_0x53e216[_0x82f8('0x15')][_0x82f8('0x16')]===0x1f4){logger[_0x82f8('0x15')](_0x82f8('0x17'),_0x57484f,_0x53e216[_0x82f8('0x15')][_0x82f8('0x18')]);return _0xcac42e(_0x53e216['error'][_0x82f8('0x18')]);}logger[_0x82f8('0x15')](_0x82f8('0x17'),_0x57484f,_0x53e216[_0x82f8('0x15')]['message']);return _0x642cb0(_0x53e216['error'][_0x82f8('0x18')]);}else{logger[_0x82f8('0x11')](_0x82f8('0x17'),_0x57484f,_0x82f8('0x12'));_0x642cb0(_0x53e216[_0x82f8('0x19')][_0x82f8('0x18')]);}})[_0x82f8('0x1a')](function(_0x4df5aa){logger[_0x82f8('0x15')](_0x82f8('0x17'),_0x57484f,_0x4df5aa);_0xcac42e(_0x4df5aa);});});}exports['CreateWhatsappMessage']=function(_0x147267){var _0x2abb8b=this;return new Promise(function(_0x467362,_0x3f385e){return db['WhatsappMessage'][_0x82f8('0x1b')](_0x147267[_0x82f8('0x1c')],{'raw':_0x147267['options']?_0x147267[_0x82f8('0x1d')][_0x82f8('0x1e')]===undefined?!![]:![]:!![]})[_0x82f8('0x10')](function(_0x226fae){logger[_0x82f8('0x11')](_0x82f8('0x1f'),_0x147267);logger['debug'](_0x82f8('0x1f'),_0x147267,JSON[_0x82f8('0x14')](_0x226fae));_0x467362(_0x226fae);})[_0x82f8('0x1a')](function(_0x2b36c9){logger[_0x82f8('0x15')](_0x82f8('0x1f'),_0x2b36c9[_0x82f8('0x18')],_0x147267);_0x3f385e(_0x2abb8b[_0x82f8('0x15')](0x1f4,_0x2b36c9['message']));});});}; \ No newline at end of file +var _0x9b3c=['CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x455989,_0x4804c8){var _0x7479a4=function(_0x4bbfe2){while(--_0x4bbfe2){_0x455989['push'](_0x455989['shift']());}};_0x7479a4(++_0x4804c8);}(_0x9b3c,0x6b));var _0xc9b3=function(_0x41c0db,_0x53385e){_0x41c0db=_0x41c0db-0x0;var _0x2d71d1=_0x9b3c[_0x41c0db];return _0x2d71d1;};'use strict';var _=require(_0xc9b3('0x0'));var util=require(_0xc9b3('0x1'));var moment=require(_0xc9b3('0x2'));var BPromise=require(_0xc9b3('0x3'));var rs=require(_0xc9b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9b3('0x5'))['db'];var utils=require(_0xc9b3('0x6'));var logger=require('../../config/logger')(_0xc9b3('0x7'));var config=require(_0xc9b3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc9b3('0x9')][_0xc9b3('0xa')]({'port':0x232a});config['redis']=_[_0xc9b3('0xb')](config[_0xc9b3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc9b3('0xd'))[_0xc9b3('0xe')](socket);function respondWithRpcPromise(_0x5838e7,_0x4d44ad,_0x13ebc1){return new BPromise(function(_0x100894,_0x42b24b){return client[_0xc9b3('0xf')](_0x5838e7,_0x13ebc1)[_0xc9b3('0x10')](function(_0x3d745e){logger[_0xc9b3('0x11')](_0xc9b3('0x12'),_0x4d44ad,_0xc9b3('0x13'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4d44ad,_0xc9b3('0x13'),JSON[_0xc9b3('0x14')](_0x3d745e));if(_0x3d745e[_0xc9b3('0x15')]){if(_0x3d745e[_0xc9b3('0x15')][_0xc9b3('0x16')]===0x1f4){logger[_0xc9b3('0x15')](_0xc9b3('0x12'),_0x4d44ad,_0x3d745e['error'][_0xc9b3('0x17')]);return _0x42b24b(_0x3d745e['error']['message']);}logger[_0xc9b3('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x4d44ad,_0x3d745e['error']['message']);return _0x100894(_0x3d745e[_0xc9b3('0x15')][_0xc9b3('0x17')]);}else{logger[_0xc9b3('0x11')](_0xc9b3('0x12'),_0x4d44ad,_0xc9b3('0x13'));_0x100894(_0x3d745e[_0xc9b3('0x18')][_0xc9b3('0x17')]);}})['catch'](function(_0x36b4d0){logger[_0xc9b3('0x15')](_0xc9b3('0x12'),_0x4d44ad,_0x36b4d0);_0x42b24b(_0x36b4d0);});});}exports[_0xc9b3('0x19')]=function(_0x4f6f81){var _0x227137=this;return new Promise(function(_0x1da6b5,_0x30417f){return db[_0xc9b3('0x1a')][_0xc9b3('0x1b')](_0x4f6f81[_0xc9b3('0x1c')],{'raw':_0x4f6f81[_0xc9b3('0x1d')]?_0x4f6f81[_0xc9b3('0x1d')][_0xc9b3('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5a8a86){logger[_0xc9b3('0x11')](_0xc9b3('0x19'),_0x4f6f81);logger[_0xc9b3('0x1f')](_0xc9b3('0x19'),_0x4f6f81,JSON['stringify'](_0x5a8a86));_0x1da6b5(_0x5a8a86);})[_0xc9b3('0x20')](function(_0x402268){logger[_0xc9b3('0x15')](_0xc9b3('0x19'),_0x402268[_0xc9b3('0x17')],_0x4f6f81);_0x30417f(_0x227137[_0xc9b3('0x15')](0x1f4,_0x402268[_0xc9b3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3c8a404..35377dd 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 _0xa84f=['emit','register','length','./whatsappMessage.events','save','remove','update'];(function(_0x1075eb,_0x2a2d9c){var _0x200346=function(_0x17ad1b){while(--_0x17ad1b){_0x1075eb['push'](_0x1075eb['shift']());}};_0x200346(++_0x2a2d9c);}(_0xa84f,0x88));var _0xfa84=function(_0x3441e9,_0x269c8a){_0x3441e9=_0x3441e9-0x0;var _0x7f9ada=_0xa84f[_0x3441e9];return _0x7f9ada;};'use strict';var WhatsappMessageEvents=require(_0xfa84('0x0'));var events=[_0xfa84('0x1'),_0xfa84('0x2'),_0xfa84('0x3')];function createListener(_0x32ebc5,_0x3d6a50){return function(_0x58c5fd){_0x3d6a50[_0xfa84('0x4')](_0x32ebc5,_0x58c5fd);};}function removeListener(_0x58ff47,_0x18a42c){return function(){WhatsappMessageEvents['removeListener'](_0x58ff47,_0x18a42c);};}exports[_0xfa84('0x5')]=function(_0x491f0a){for(var _0x1d2828=0x0,_0x2ce315=events[_0xfa84('0x6')];_0x1d2828<_0x2ce315;_0x1d2828++){var _0x2bf04c=events[_0x1d2828];var _0x36a7dc=createListener('whatsappMessage:'+_0x2bf04c,_0x491f0a);WhatsappMessageEvents['on'](_0x2bf04c,_0x36a7dc);}}; \ No newline at end of file +var _0xd9a8=['length','./whatsappMessage.events','save','update','register'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xd9a8,0x1a0));var _0x8d9a=function(_0xe8f3bc,_0x12985f){_0xe8f3bc=_0xe8f3bc-0x0;var _0x4d1fe2=_0xd9a8[_0xe8f3bc];return _0x4d1fe2;};'use strict';var WhatsappMessageEvents=require(_0x8d9a('0x0'));var events=[_0x8d9a('0x1'),'remove',_0x8d9a('0x2')];function createListener(_0x30087c,_0x1a2635){return function(_0x4327f1){_0x1a2635['emit'](_0x30087c,_0x4327f1);};}function removeListener(_0x273eba,_0xccce59){return function(){WhatsappMessageEvents['removeListener'](_0x273eba,_0xccce59);};}exports[_0x8d9a('0x3')]=function(_0x58c0cf){for(var _0x1164ef=0x0,_0x262f75=events[_0x8d9a('0x4')];_0x1164ef<_0x262f75;_0x1164ef++){var _0x550690=events[_0x1164ef];var _0x15d2ff=createListener('whatsappMessage:'+_0x550690,_0x58c0cf);WhatsappMessageEvents['on'](_0x550690,_0x15d2ff);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 56cddbb..fa758dc 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 _0xf65d=['./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','/:id/teams','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x39cc4c,_0x3349a8){var _0x22ac0a=function(_0x3698eb){while(--_0x3698eb){_0x39cc4c['push'](_0x39cc4c['shift']());}};_0x22ac0a(++_0x3349a8);}(_0xf65d,0x13a));var _0xdf65=function(_0xd467d7,_0x2f13cd){_0xd467d7=_0xd467d7-0x0;var _0x23b23d=_0xf65d[_0xd467d7];return _0x23b23d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdf65('0x0'));var express=require(_0xdf65('0x1'));var router=express[_0xdf65('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdf65('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdf65('0x4'));var controller=require(_0xdf65('0x5'));router[_0xdf65('0x6')]('/',auth[_0xdf65('0x7')](),controller[_0xdf65('0x8')]);router[_0xdf65('0x6')](_0xdf65('0x9'),auth[_0xdf65('0x7')](),controller[_0xdf65('0xa')]);router['get']('/:id',auth[_0xdf65('0x7')](),controller[_0xdf65('0xb')]);router[_0xdf65('0x6')](_0xdf65('0xc'),auth[_0xdf65('0x7')](),controller[_0xdf65('0xd')]);router[_0xdf65('0x6')]('/:id/teams',auth[_0xdf65('0x7')](),controller[_0xdf65('0xe')]);router[_0xdf65('0x6')]('/:id/users',auth[_0xdf65('0x7')](),controller[_0xdf65('0xf')]);router[_0xdf65('0x10')]('/',auth['isAuthenticated'](),controller[_0xdf65('0x11')]);router[_0xdf65('0x10')]('/:id/teams',auth[_0xdf65('0x7')](),controller[_0xdf65('0x12')]);router[_0xdf65('0x10')](_0xdf65('0x13'),auth['isAuthenticated'](),controller[_0xdf65('0x14')]);router[_0xdf65('0x15')](_0xdf65('0x16'),auth[_0xdf65('0x7')](),controller[_0xdf65('0x17')]);router[_0xdf65('0x18')](_0xdf65('0x16'),auth[_0xdf65('0x7')](),controller[_0xdf65('0x19')]);router[_0xdf65('0x18')](_0xdf65('0x1a'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xdf65('0x18')](_0xdf65('0x13'),auth['isAuthenticated'](),controller[_0xdf65('0x1b')]);module[_0xdf65('0x1c')]=router; \ No newline at end of file +var _0x4425=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x512d18,_0x5a874f){var _0x3be5af=function(_0x200a4e){while(--_0x200a4e){_0x512d18['push'](_0x512d18['shift']());}};_0x3be5af(++_0x5a874f);}(_0x4425,0x19a));var _0x5442=function(_0x24b82c,_0x45767d){_0x24b82c=_0x24b82c-0x0;var _0x349d5d=_0x4425[_0x24b82c];return _0x349d5d;};'use strict';var multer=require(_0x5442('0x0'));var util=require(_0x5442('0x1'));var path=require(_0x5442('0x2'));var timeout=require(_0x5442('0x3'));var express=require(_0x5442('0x4'));var router=express[_0x5442('0x5')]();var fs_extra=require(_0x5442('0x6'));var auth=require(_0x5442('0x7'));var interaction=require(_0x5442('0x8'));var config=require(_0x5442('0x9'));var controller=require('./whatsappQueue.controller');router[_0x5442('0xa')]('/',auth[_0x5442('0xb')](),controller[_0x5442('0xc')]);router['get'](_0x5442('0xd'),auth[_0x5442('0xb')](),controller[_0x5442('0xe')]);router[_0x5442('0xa')](_0x5442('0xf'),auth[_0x5442('0xb')](),controller[_0x5442('0x10')]);router[_0x5442('0xa')](_0x5442('0x11'),auth['isAuthenticated'](),controller[_0x5442('0x12')]);router[_0x5442('0xa')](_0x5442('0x13'),auth[_0x5442('0xb')](),controller[_0x5442('0x14')]);router[_0x5442('0xa')](_0x5442('0x15'),auth[_0x5442('0xb')](),controller[_0x5442('0x16')]);router[_0x5442('0x17')]('/',auth[_0x5442('0xb')](),controller[_0x5442('0x18')]);router[_0x5442('0x17')](_0x5442('0x13'),auth[_0x5442('0xb')](),controller[_0x5442('0x19')]);router[_0x5442('0x17')](_0x5442('0x15'),auth[_0x5442('0xb')](),controller[_0x5442('0x1a')]);router[_0x5442('0x1b')]('/:id',auth[_0x5442('0xb')](),controller['update']);router['delete']('/:id',auth[_0x5442('0xb')](),controller[_0x5442('0x1c')]);router['delete'](_0x5442('0x13'),auth[_0x5442('0xb')](),controller[_0x5442('0x1d')]);router[_0x5442('0x1e')](_0x5442('0x15'),auth[_0x5442('0xb')](),controller[_0x5442('0x1f')]);module[_0x5442('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f2077a3..6b13bcb 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 _0xfaa4=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x48321f,_0x153ba3){var _0x1b7637=function(_0x9b8281){while(--_0x9b8281){_0x48321f['push'](_0x48321f['shift']());}};_0x1b7637(++_0x153ba3);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x214a01,_0x3da79f){_0x214a01=_0x214a01-0x0;var _0x51771c=_0xfaa4[_0x214a01];return _0x51771c;};'use strict';var Sequelize=require(_0x4faa('0x0'));module[_0x4faa('0x1')]={'name':{'type':Sequelize[_0x4faa('0x2')],'unique':_0x4faa('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4faa('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4faa('0x5')]('rrmemory',_0x4faa('0x6'),_0x4faa('0x7'))},'description':{'type':Sequelize[_0x4faa('0x2')]}}; \ No newline at end of file +var _0xcd31=['STRING','name','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x4e3fb9,_0x3046cc){var _0x525d75=function(_0xd5dbee){while(--_0xd5dbee){_0x4e3fb9['push'](_0x4e3fb9['shift']());}};_0x525d75(++_0x3046cc);}(_0xcd31,0x15d));var _0x1cd3=function(_0x4fecb6,_0x7def4e){_0x4fecb6=_0x4fecb6-0x0;var _0x47036a=_0xcd31[_0x4fecb6];return _0x47036a;};'use strict';var Sequelize=require('sequelize');module[_0x1cd3('0x0')]={'name':{'type':Sequelize[_0x1cd3('0x1')],'unique':_0x1cd3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1cd3('0x3')](_0x1cd3('0x4'),_0x1cd3('0x5'),_0x1cd3('0x6'))},'description':{'type':Sequelize[_0x1cd3('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8490830..5fb0385 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 _0xfad0=['map','filter','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','pick','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','removeTeams','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','hasOwnProperty','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','end','status','json','limit','undefined','offset','count','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','WhatsappQueue','rawAttributes','getOptions','where','include','findAll','rows','catch','show','model','keys','query','filters','intersection','fields','attributes','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','find','describe','getMembers','findOne','UserWhatsappQueue','length','nolimit','sort','WhatsappQueueId','merge'];(function(_0x7ca506,_0x1e22f8){var _0x24f0e1=function(_0x140c99){while(--_0x140c99){_0x7ca506['push'](_0x7ca506['shift']());}};_0x24f0e1(++_0x1e22f8);}(_0xfad0,0x1a1));var _0x0fad=function(_0x5219e4,_0x4bb57b){_0x5219e4=_0x5219e4-0x0;var _0x31a319=_0xfad0[_0x5219e4];return _0x31a319;};'use strict';var BPromise=require(_0x0fad('0x0'));var util=require('util');var _=require(_0x0fad('0x1'));var squel=require(_0x0fad('0x2'));var Redis=require(_0x0fad('0x3'));var qs=require(_0x0fad('0x4'));var logger=require('../../config/logger')(_0x0fad('0x5'));var config=require(_0x0fad('0x6'));var db=require(_0x0fad('0x7'))['db'];config['redis']=_[_0x0fad('0x8')](config['redis'],{'host':_0x0fad('0x9'),'port':0x18eb});var socket=require(_0x0fad('0xa'))(new Redis(config[_0x0fad('0xb')]));require(_0x0fad('0xc'))['register'](socket);function respondWithStatusCode(_0x4d0f81,_0x518b7e){_0x518b7e=_0x518b7e||0xcc;return function(_0x1b03ce){if(_0x1b03ce){return _0x4d0f81['sendStatus'](_0x518b7e);}return _0x4d0f81['status'](_0x518b7e)[_0x0fad('0xd')]();};}function respondWithResult(_0x250b4a,_0x1e6938){_0x1e6938=_0x1e6938||0xc8;return function(_0x360564){if(_0x360564){return _0x250b4a[_0x0fad('0xe')](_0x1e6938)[_0x0fad('0xf')](_0x360564);}};}function respondWithFilteredResult(_0x17bdf2,_0x1c5b53){return function(_0x5272bb){if(_0x5272bb){var _0x57e0d5=typeof _0x1c5b53['offset']==='undefined'&&typeof _0x1c5b53[_0x0fad('0x10')]===_0x0fad('0x11');var _0x23ec1e=_0x5272bb['count'];var _0x1443c3=_0x57e0d5?0x0:_0x1c5b53[_0x0fad('0x12')];var _0x40fd95=_0x57e0d5?_0x5272bb[_0x0fad('0x13')]:_0x1c5b53[_0x0fad('0x12')]+_0x1c5b53[_0x0fad('0x10')];var _0x4ef336;if(_0x40fd95>=_0x23ec1e){_0x40fd95=_0x23ec1e;_0x4ef336=0xc8;}else{_0x4ef336=0xce;}_0x17bdf2[_0x0fad('0xe')](_0x4ef336);return _0x17bdf2[_0x0fad('0x14')](_0x0fad('0x15'),_0x1443c3+'-'+_0x40fd95+'/'+_0x23ec1e)[_0x0fad('0xf')](_0x5272bb);}return null;};}function saveUpdates(_0x3bf174){return function(_0x276e7b){if(_0x276e7b){return _0x276e7b[_0x0fad('0x16')](_0x3bf174)[_0x0fad('0x17')](function(_0x59e9ba){return _0x59e9ba;});}return null;};}function removeEntity(_0x19fc5b){return function(_0xb64277){if(_0xb64277){return _0xb64277[_0x0fad('0x18')]()[_0x0fad('0x17')](function(){var _0x4c0e3a=_0xb64277[_0x0fad('0x19')]({'plain':!![]});var _0x5c2048=_0x0fad('0x1a');return db[_0x0fad('0x1b')][_0x0fad('0x18')]({'where':{'type':_0x5c2048,'resourceId':_0x4c0e3a['id']}})['then'](function(){return _0xb64277;});})[_0x0fad('0x17')](function(){_0x19fc5b[_0x0fad('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x878d3b){return function(_0x20b2a9){if(!_0x20b2a9){_0x878d3b[_0x0fad('0x1c')](0x194);}return _0x20b2a9;};}function handleError(_0x518855,_0x2bce00){_0x2bce00=_0x2bce00||0x1f4;return function(_0x36e92a){logger[_0x0fad('0x1d')](_0x36e92a[_0x0fad('0x1e')]);if(_0x36e92a['name']){delete _0x36e92a[_0x0fad('0x1f')];}_0x518855[_0x0fad('0xe')](_0x2bce00)[_0x0fad('0x20')](_0x36e92a);};}exports[_0x0fad('0x21')]=function(_0x56bcc1,_0x3ac419){var _0xb8b05={};var _0x37b0f7={'count':0x0,'rows':[]};var _0xdd09da=_['map'](db[_0x0fad('0x22')][_0x0fad('0x23')],function(_0x4b5909){return{'name':_0x4b5909['fieldName'],'type':_0x4b5909['type']['key']};});_0xb8b05=qs[_0x0fad('0x24')](_0xdd09da,_0x56bcc1);var _0x3380b0={'where':_0xb8b05[_0x0fad('0x25')]};return db[_0x0fad('0x22')][_0x0fad('0x13')](_0x3380b0)[_0x0fad('0x17')](function(_0x125692){_0x37b0f7[_0x0fad('0x13')]=_0x125692;_0xb8b05['include']=qs[_0x0fad('0x26')](_0x56bcc1['query']);return db[_0x0fad('0x22')][_0x0fad('0x27')](_0xb8b05);})[_0x0fad('0x17')](function(_0x5056c1){_0x37b0f7[_0x0fad('0x28')]=_0x5056c1;return _0x37b0f7;})[_0x0fad('0x17')](respondWithFilteredResult(_0x3ac419,_0xb8b05))[_0x0fad('0x29')](handleError(_0x3ac419,null));};exports[_0x0fad('0x2a')]=function(_0xdb5322,_0x3124e){var _0x5bb57b={'raw':!![],'where':{'id':_0xdb5322['params']['id']}},_0x18fead={};_0x18fead[_0x0fad('0x2b')]=_[_0x0fad('0x2c')](db[_0x0fad('0x22')][_0x0fad('0x23')]);_0x18fead['query']=_[_0x0fad('0x2c')](_0xdb5322[_0x0fad('0x2d')]);_0x18fead[_0x0fad('0x2e')]=_['intersection'](_0x18fead['model'],_0x18fead[_0x0fad('0x2d')]);_0x5bb57b['attributes']=_[_0x0fad('0x2f')](_0x18fead[_0x0fad('0x2b')],qs[_0x0fad('0x30')](_0xdb5322[_0x0fad('0x2d')][_0x0fad('0x30')]));_0x5bb57b[_0x0fad('0x31')]=_0x5bb57b[_0x0fad('0x31')]['length']?_0x5bb57b[_0x0fad('0x31')]:_0x18fead['model'];if(_0xdb5322[_0x0fad('0x2d')][_0x0fad('0x32')]){_0x5bb57b[_0x0fad('0x26')]=[{'all':!![]}];}_0x5bb57b=_['merge']({},_0x5bb57b,_0xdb5322[_0x0fad('0x33')]);return db['WhatsappQueue']['find'](_0x5bb57b)['then'](handleEntityNotFound(_0x3124e,null))['then'](respondWithResult(_0x3124e,null))['catch'](handleError(_0x3124e,null));};exports[_0x0fad('0x34')]=function(_0x3af486,_0x31eac1){return db['WhatsappQueue'][_0x0fad('0x34')](_0x3af486['body'],{})[_0x0fad('0x17')](function(_0x2507ad){var _0x26cff1=_0x3af486[_0x0fad('0x35')][_0x0fad('0x19')]({'plain':!![]});if(!_0x26cff1)throw new Error(_0x0fad('0x36'));if(_0x26cff1[_0x0fad('0x37')]==='user'){var _0x251c32=_0x2507ad[_0x0fad('0x19')]({'plain':!![]});var _0x29d017=_0x0fad('0x1a');return db[_0x0fad('0x38')]['find']({'where':{'name':_0x29d017,'userProfileId':_0x26cff1[_0x0fad('0x39')]},'raw':!![]})['then'](function(_0x519d79){if(_0x519d79&&_0x519d79[_0x0fad('0x3a')]===0x0){return db[_0x0fad('0x1b')][_0x0fad('0x34')]({'name':_0x251c32[_0x0fad('0x1f')],'resourceId':_0x251c32['id'],'type':_0x519d79[_0x0fad('0x1f')],'sectionId':_0x519d79['id']},{})['then'](function(){return _0x2507ad;});}else{return _0x2507ad;}})['catch'](function(_0x3227b1){logger[_0x0fad('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3227b1);throw _0x3227b1;});}return _0x2507ad;})['then'](respondWithResult(_0x31eac1,0xc9))[_0x0fad('0x29')](handleError(_0x31eac1,null));};exports['update']=function(_0x5ba63c,_0x7b1eb0){if(_0x5ba63c[_0x0fad('0x3b')]['id']){delete _0x5ba63c[_0x0fad('0x3b')]['id'];}return db[_0x0fad('0x22')]['find']({'where':{'id':_0x5ba63c[_0x0fad('0x3c')]['id']}})[_0x0fad('0x17')](handleEntityNotFound(_0x7b1eb0,null))['then'](saveUpdates(_0x5ba63c[_0x0fad('0x3b')],null))[_0x0fad('0x17')](respondWithResult(_0x7b1eb0,null))[_0x0fad('0x29')](handleError(_0x7b1eb0,null));};exports[_0x0fad('0x18')]=function(_0x30b566,_0x370b2e){return db[_0x0fad('0x22')][_0x0fad('0x3d')]({'where':{'id':_0x30b566[_0x0fad('0x3c')]['id']}})['then'](handleEntityNotFound(_0x370b2e,null))[_0x0fad('0x17')](removeEntity(_0x370b2e,null))['catch'](handleError(_0x370b2e,null));};exports[_0x0fad('0x3e')]=function(_0x1c1ea1,_0x192582){return db['WhatsappQueue'][_0x0fad('0x3e')]()[_0x0fad('0x17')](respondWithResult(_0x192582,null))[_0x0fad('0x29')](handleError(_0x192582,null));};exports[_0x0fad('0x3f')]=function(_0x52cbb9,_0xc8ac5){var _0x14bb0c={'raw':!![],'where':{}},_0x403e37={},_0x2b046c;return db[_0x0fad('0x22')][_0x0fad('0x40')]({'where':{'id':_0x52cbb9[_0x0fad('0x3c')]['id']}})[_0x0fad('0x17')](handleEntityNotFound(_0xc8ac5,null))[_0x0fad('0x17')](function(_0x46aab1){if(_0x46aab1){_0x2b046c=_0x46aab1[_0x0fad('0x19')]({'plain':!![]});_0x403e37[_0x0fad('0x2b')]=_[_0x0fad('0x2c')](db[_0x0fad('0x41')][_0x0fad('0x23')]);_0x403e37[_0x0fad('0x2d')]=_[_0x0fad('0x2c')](_0x52cbb9[_0x0fad('0x2d')]);_0x403e37[_0x0fad('0x2e')]=_[_0x0fad('0x2f')](_0x403e37[_0x0fad('0x2b')],_0x403e37['query']);_0x14bb0c[_0x0fad('0x31')]=_['intersection'](_0x403e37[_0x0fad('0x2b')],qs[_0x0fad('0x30')](_0x52cbb9[_0x0fad('0x2d')][_0x0fad('0x30')]));_0x14bb0c[_0x0fad('0x31')]=_0x14bb0c['attributes'][_0x0fad('0x42')]?_0x14bb0c['attributes']:_0x403e37[_0x0fad('0x2b')];if(!_0x52cbb9[_0x0fad('0x2d')]['hasOwnProperty'](_0x0fad('0x43'))){_0x14bb0c[_0x0fad('0x10')]=qs[_0x0fad('0x10')](_0x52cbb9[_0x0fad('0x2d')][_0x0fad('0x10')]);_0x14bb0c['offset']=qs['offset'](_0x52cbb9[_0x0fad('0x2d')][_0x0fad('0x12')]);}_0x14bb0c['order']=qs[_0x0fad('0x44')](_0x52cbb9[_0x0fad('0x2d')]['sort']);_0x14bb0c[_0x0fad('0x25')]=qs[_0x0fad('0x2e')](_['pick'](_0x52cbb9[_0x0fad('0x2d')],_0x403e37[_0x0fad('0x2e')]));_0x14bb0c[_0x0fad('0x25')][_0x0fad('0x45')]=_0x46aab1['id'];if(_0x52cbb9[_0x0fad('0x2d')]['filter']){_0x14bb0c['where']=_[_0x0fad('0x46')](_0x14bb0c[_0x0fad('0x25')],{'$or':_[_0x0fad('0x47')](_0x14bb0c[_0x0fad('0x31')],function(_0x1c6a47){var _0x3fb514={};_0x3fb514[_0x1c6a47]={'$like':'%'+_0x52cbb9[_0x0fad('0x2d')][_0x0fad('0x48')]+'%'};return _0x3fb514;})});}_0x14bb0c=_[_0x0fad('0x46')]({},_0x14bb0c,_0x52cbb9[_0x0fad('0x33')]);return db['UserWhatsappQueue'][_0x0fad('0x27')](_0x14bb0c);}})[_0x0fad('0x17')](function(_0x2810a8){if(_0x2810a8){return db['User']['findAndCountAll']({'where':{'id':_[_0x0fad('0x47')](_0x2810a8,_0x0fad('0x49')),'role':_0x0fad('0x4a')},'attributes':['id',_0x0fad('0x1f'),_0x0fad('0x4b'),_0x0fad('0x4c'),_0x0fad('0x4d')]});}})[_0x0fad('0x17')](function(_0x1af9a5){if(_0x1af9a5){return{'count':_0x1af9a5[_0x0fad('0x13')],'rows':_['map'](_0x1af9a5[_0x0fad('0x28')],function(_0x5828d5){return{'membername':_0x5828d5[_0x0fad('0x1f')],'UserId':_0x5828d5['id'],'queue_name':_0x2b046c[_0x0fad('0x1f')],'WhatsappQueueId':_0x2b046c['id'],'interface':util[_0x0fad('0x4e')](_0x0fad('0x4f'),_0x0fad('0x50'),_0x5828d5[_0x0fad('0x1f')]),'penalty':0x0,'paused':_0x5828d5['whatsappPause'],'createdAt':_0x5828d5['createdAt'],'updatedAt':_0x5828d5[_0x0fad('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0fad('0x17')](respondWithFilteredResult(_0xc8ac5,_0x14bb0c))['catch'](handleError(_0xc8ac5,null));};exports[_0x0fad('0x51')]=function(_0x2b5bbf,_0x4b6b9d){var _0x7019bd={};var _0x5adbdc={};var _0x24480d;var _0x45385b;return db[_0x0fad('0x22')][_0x0fad('0x40')]({'where':{'id':_0x2b5bbf[_0x0fad('0x3c')]['id']}})[_0x0fad('0x17')](handleEntityNotFound(_0x4b6b9d,null))[_0x0fad('0x17')](function(_0x4a1c12){if(_0x4a1c12){_0x24480d=_0x4a1c12;_0x5adbdc['model']=_[_0x0fad('0x2c')](db[_0x0fad('0x52')][_0x0fad('0x23')]);_0x5adbdc[_0x0fad('0x2d')]=_[_0x0fad('0x2c')](_0x2b5bbf[_0x0fad('0x2d')]);_0x5adbdc[_0x0fad('0x2e')]=_['intersection'](_0x5adbdc[_0x0fad('0x2b')],_0x5adbdc[_0x0fad('0x2d')]);_0x7019bd['attributes']=_[_0x0fad('0x2f')](_0x5adbdc[_0x0fad('0x2b')],qs[_0x0fad('0x30')](_0x2b5bbf[_0x0fad('0x2d')]['fields']));_0x7019bd[_0x0fad('0x31')]=_0x7019bd[_0x0fad('0x31')]['length']?_0x7019bd[_0x0fad('0x31')]:_0x5adbdc[_0x0fad('0x2b')];_0x7019bd[_0x0fad('0x53')]=qs['sort'](_0x2b5bbf[_0x0fad('0x2d')][_0x0fad('0x44')]);_0x7019bd[_0x0fad('0x25')]=qs[_0x0fad('0x2e')](_[_0x0fad('0x54')](_0x2b5bbf[_0x0fad('0x2d')],_0x5adbdc[_0x0fad('0x2e')]));if(_0x2b5bbf['query']['filter']){_0x7019bd[_0x0fad('0x25')]=_[_0x0fad('0x46')](_0x7019bd[_0x0fad('0x25')],{'$or':_['map'](_0x7019bd[_0x0fad('0x31')],function(_0x2c1a89){var _0x1635f2={};_0x1635f2[_0x2c1a89]={'$like':'%'+_0x2b5bbf[_0x0fad('0x2d')][_0x0fad('0x48')]+'%'};return _0x1635f2;})});}_0x7019bd=_[_0x0fad('0x46')]({},_0x7019bd,_0x2b5bbf[_0x0fad('0x33')]);return _0x24480d[_0x0fad('0x51')](_0x7019bd);}})[_0x0fad('0x17')](function(_0xb26c6f){if(_0xb26c6f){_0x45385b=_0xb26c6f['length'];if(!_0x2b5bbf[_0x0fad('0x2d')]['hasOwnProperty'](_0x0fad('0x43'))){_0x7019bd[_0x0fad('0x10')]=qs[_0x0fad('0x10')](_0x2b5bbf[_0x0fad('0x2d')][_0x0fad('0x10')]);_0x7019bd[_0x0fad('0x12')]=qs[_0x0fad('0x12')](_0x2b5bbf['query'][_0x0fad('0x12')]);}return _0x24480d[_0x0fad('0x51')](_0x7019bd);}})[_0x0fad('0x17')](function(_0x418719){if(_0x418719){return _0x418719?{'count':_0x45385b,'rows':_0x418719}:null;}})[_0x0fad('0x17')](respondWithResult(_0x4b6b9d,null))[_0x0fad('0x29')](handleError(_0x4b6b9d,null));};exports['addTeams']=function(_0x2a0264,_0x58372){var _0xdf1b40=_0x2a0264[_0x0fad('0x3b')][_0x0fad('0x55')];return db['Team'][_0x0fad('0x27')]({'where':{'id':_0xdf1b40},'attributes':['id'],'include':[{'model':db[_0x0fad('0x56')],'as':_0x0fad('0x57'),'attributes':['id',_0x0fad('0x1f'),_0x0fad('0x58'),_0x0fad('0x59'),_0x0fad('0x5a')],'raw':!![]}]})[_0x0fad('0x17')](function(_0x262a3){if(_0x262a3){var _0x404a47=_[_0x0fad('0x5b')](_0x262a3,function(_0x4163a0){var _0x43f168=_0x4163a0[_0x0fad('0x19')]({'plain':!![]});return _0x43f168[_0x0fad('0x57')];});return db[_0x0fad('0x22')]['find']({'where':{'id':_0x2a0264[_0x0fad('0x3c')]['id']}})['then'](function(_0x330769){return db[_0x0fad('0x5c')][_0x0fad('0x5d')](function(_0x5dae9f){return _0x330769[_0x0fad('0x5e')](_0xdf1b40,{'transaction':_0x5dae9f})['then'](function(){return BPromise['each'](_0x404a47,function(_0x3d06bf){return db[_0x0fad('0x41')][_0x0fad('0x5f')]({'where':{'UserId':_0x3d06bf['id'],'WhatsappQueueId':_0x2a0264[_0x0fad('0x3c')]['id']},'transaction':_0x5dae9f});});})[_0x0fad('0x17')](function(){_0x404a47[_0x0fad('0x60')](function(_0x2f04ae){socket[_0x0fad('0x61')]('userWhatsappQueue:save',{'UserId':_0x2f04ae['id'],'WhatsappQueueId':_0x330769['id']});});});});});}})[_0x0fad('0x17')](respondWithStatusCode(_0x58372,null))[_0x0fad('0x29')](handleError(_0x58372,null));};exports[_0x0fad('0x62')]=function(_0x36927c,_0xb166ac){return db[_0x0fad('0x52')][_0x0fad('0x27')]({'where':{'id':_0x36927c[_0x0fad('0x2d')][_0x0fad('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0fad('0x57'),'attributes':['id'],'raw':!![]}]})[_0x0fad('0x17')](handleEntityNotFound(_0xb166ac,null))[_0x0fad('0x17')](function(_0x1f1021){var _0x2a3979=_[_0x0fad('0x47')](_0x1f1021,'id');var _0x1dba5a=[];var _0x308cbd=[];var _0x303278=squel['select']();_0x303278['field']('tq.TeamId')['from']('team_has_whatsapp_queues','tq')[_0x0fad('0x63')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0fad('0x25')](_0x0fad('0x64'),_0x36927c[_0x0fad('0x3c')]['id']);for(var _0x26defb=0x0;_0x26defb<_0x1f1021[_0x0fad('0x42')];_0x26defb+=0x1){let _0x2031b3=_0x1f1021[_0x26defb];for(var _0x2e2f47=0x0;_0x2e2f47<_0x2031b3[_0x0fad('0x57')][_0x0fad('0x42')];_0x2e2f47+=0x1){let _0x21d2ed=_0x2031b3[_0x0fad('0x57')][_0x2e2f47];var _0x127618=_0x303278[_0x0fad('0x65')]();_0x127618[_0x0fad('0x25')](_0x0fad('0x66'),_0x21d2ed['id']);_0x308cbd[_0x0fad('0x67')](db[_0x0fad('0x5c')][_0x0fad('0x2d')](_0x127618[_0x0fad('0x68')](),{'type':db['sequelize'][_0x0fad('0x69')]['SELECT']})[_0x0fad('0x17')](function(_0x19829f){if(_0x19829f['length']===0x1){return _0x21d2ed['id'];}else{var _0x9ba911=_[_0x0fad('0x6a')](_['map'](_0x19829f,_0x0fad('0x6b')),function(_0x1433a8){return _[_0x0fad('0x6c')](_0x2a3979,_0x1433a8);});if(_0x9ba911){return _0x21d2ed['id'];}}}));}}return BPromise[_0x0fad('0x6d')](_0x308cbd)['then'](function(_0x43d808){_0x1dba5a=_(_0x1dba5a)[_0x0fad('0x6e')](_0x43d808)[_0x0fad('0x6f')]()[_0x0fad('0x70')]();return db[_0x0fad('0x22')][_0x0fad('0x3d')]({'where':{'id':_0x36927c['params']['id']}})[_0x0fad('0x17')](function(_0x1d45a5){return db[_0x0fad('0x5c')][_0x0fad('0x5d')](function(_0x4e9a61){return _0x1d45a5['removeTeams'](_0x36927c[_0x0fad('0x2d')][_0x0fad('0x55')],{'transaction':_0x4e9a61})[_0x0fad('0x17')](function(){if(!_['isEmpty'](_0x1dba5a)){return _0x1d45a5['removeAgents'](_0x1dba5a,{'transaction':_0x4e9a61});}})[_0x0fad('0x17')](function(){_0x1dba5a[_0x0fad('0x60')](function(_0xe98388){socket[_0x0fad('0x61')](_0x0fad('0x71'),{'UserId':_0xe98388,'WhatsappQueueId':_0x1d45a5['id']});});});});});});})[_0x0fad('0x17')](respondWithStatusCode(_0xb166ac,null))[_0x0fad('0x29')](handleError(_0xb166ac,null));};exports[_0x0fad('0x72')]=function(_0x294936,_0x5a4b35){return db[_0x0fad('0x22')][_0x0fad('0x3d')]({'where':{'id':_0x294936['params']['id']}})['then'](handleEntityNotFound(_0x5a4b35,null))[_0x0fad('0x17')](function(_0x61550d){if(_0x61550d){return _0x61550d[_0x0fad('0x72')](_0x294936[_0x0fad('0x3b')][_0x0fad('0x55')],_[_0x0fad('0x73')](_0x294936[_0x0fad('0x3b')],[_0x0fad('0x55'),'id'])||{})[_0x0fad('0x74')](function(_0x1353dd){for(var _0x9d9e1=0x0;_0x9d9e1<_0x294936['body'][_0x0fad('0x55')]['length'];_0x9d9e1+=0x1){socket[_0x0fad('0x61')](_0x0fad('0x75'),{'UserId':Number(_0x294936['body'][_0x0fad('0x55')][_0x9d9e1]),'WhatsappQueueId':Number(_0x294936[_0x0fad('0x3c')]['id'])});}return _0x1353dd;});}})[_0x0fad('0x17')](respondWithResult(_0x5a4b35,null))[_0x0fad('0x29')](handleError(_0x5a4b35,null));};exports[_0x0fad('0x76')]=function(_0x22a547,_0x10be29){return db['WhatsappQueue'][_0x0fad('0x3d')]({'where':{'id':_0x22a547[_0x0fad('0x3c')]['id']}})[_0x0fad('0x17')](handleEntityNotFound(_0x10be29,null))['then'](function(_0x40de03){if(_0x40de03){return _0x40de03[_0x0fad('0x76')](_0x22a547[_0x0fad('0x2d')][_0x0fad('0x55')])['then'](function(){if(_[_0x0fad('0x77')](_0x22a547['query']['ids'])){for(var _0x3b528c=0x0;_0x3b528c<_0x22a547[_0x0fad('0x2d')][_0x0fad('0x55')][_0x0fad('0x42')];_0x3b528c+=0x1){socket['emit'](_0x0fad('0x71'),{'UserId':Number(_0x22a547[_0x0fad('0x2d')]['ids'][_0x3b528c]),'WhatsappQueueId':Number(_0x22a547['params']['id'])});}}else{socket[_0x0fad('0x61')](_0x0fad('0x71'),{'UserId':Number(_0x22a547[_0x0fad('0x2d')][_0x0fad('0x55')]),'WhatsappQueueId':Number(_0x22a547['params']['id'])});}});}})[_0x0fad('0x17')](respondWithStatusCode(_0x10be29,null))['catch'](handleError(_0x10be29,null));};exports[_0x0fad('0x78')]=function(_0x40c415,_0x1ec6a5){var _0x3fb67e={};var _0x1992a8={};var _0x5e8e43;var _0x52ee35;return db[_0x0fad('0x22')][_0x0fad('0x40')]({'where':{'id':_0x40c415[_0x0fad('0x3c')]['id']}})[_0x0fad('0x17')](handleEntityNotFound(_0x1ec6a5,null))[_0x0fad('0x17')](function(_0x1aa7c6){if(_0x1aa7c6){_0x5e8e43=_0x1aa7c6;_0x1992a8[_0x0fad('0x2b')]=_[_0x0fad('0x2c')](db['User']['rawAttributes']);_0x1992a8[_0x0fad('0x2d')]=_[_0x0fad('0x2c')](_0x40c415[_0x0fad('0x2d')]);_0x1992a8['filters']=_['intersection'](_0x1992a8['model'],_0x1992a8[_0x0fad('0x2d')]);_0x3fb67e[_0x0fad('0x31')]=_[_0x0fad('0x2f')](_0x1992a8[_0x0fad('0x2b')],qs[_0x0fad('0x30')](_0x40c415[_0x0fad('0x2d')][_0x0fad('0x30')]));_0x3fb67e[_0x0fad('0x31')]=_0x3fb67e[_0x0fad('0x31')][_0x0fad('0x42')]?_0x3fb67e[_0x0fad('0x31')]:_0x1992a8[_0x0fad('0x2b')];_0x3fb67e[_0x0fad('0x53')]=qs['sort'](_0x40c415[_0x0fad('0x2d')][_0x0fad('0x44')]);_0x3fb67e[_0x0fad('0x25')]=qs['filters'](_['pick'](_0x40c415[_0x0fad('0x2d')],_0x1992a8[_0x0fad('0x2e')]));if(_0x40c415['query']['filter']){_0x3fb67e[_0x0fad('0x25')]=_[_0x0fad('0x46')](_0x3fb67e[_0x0fad('0x25')],{'$or':_['map'](_0x3fb67e[_0x0fad('0x31')],function(_0x2396cd){var _0x28ba07={};_0x28ba07[_0x2396cd]={'$like':'%'+_0x40c415[_0x0fad('0x2d')]['filter']+'%'};return _0x28ba07;})});}_0x3fb67e=_[_0x0fad('0x46')]({},_0x3fb67e,_0x40c415[_0x0fad('0x33')]);return _0x5e8e43[_0x0fad('0x78')](_0x3fb67e);}})[_0x0fad('0x17')](function(_0xa25a3d){if(_0xa25a3d){_0x52ee35=_0xa25a3d['length'];if(!_0x40c415['query'][_0x0fad('0x79')](_0x0fad('0x43'))){_0x3fb67e[_0x0fad('0x10')]=qs[_0x0fad('0x10')](_0x40c415[_0x0fad('0x2d')][_0x0fad('0x10')]);_0x3fb67e[_0x0fad('0x12')]=qs['offset'](_0x40c415[_0x0fad('0x2d')][_0x0fad('0x12')]);}return _0x5e8e43['getAgents'](_0x3fb67e);}})[_0x0fad('0x17')](function(_0x2fc208){if(_0x2fc208){return _0x2fc208?{'count':_0x52ee35,'rows':_0x2fc208}:null;}})['then'](respondWithResult(_0x1ec6a5,null))[_0x0fad('0x29')](handleError(_0x1ec6a5,null));}; \ No newline at end of file +var _0x77f9=['Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','update','then','destroy','get','WhatsappQueues','error','name','index','map','WhatsappQueue','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','rawAttributes','keys','filters','intersection','model','attributes','fields','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','length','nolimit','order','sort','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','%s/%s','getTeams','Team','pick','hasOwnProperty','addTeams','ids'];(function(_0x509e54,_0x1c358c){var _0x4a2400=function(_0x47ede1){while(--_0x47ede1){_0x509e54['push'](_0x509e54['shift']());}};_0x4a2400(++_0x1c358c);}(_0x77f9,0x9c));var _0x977f=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x77f9[_0xa9a245];return _0x2d0eaa;};'use strict';var BPromise=require('bluebird');var util=require(_0x977f('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x977f('0x1'));var qs=require(_0x977f('0x2'));var logger=require('../../config/logger')(_0x977f('0x3'));var config=require('../../config/environment');var db=require(_0x977f('0x4'))['db'];config[_0x977f('0x5')]=_[_0x977f('0x6')](config['redis'],{'host':_0x977f('0x7'),'port':0x18eb});var socket=require(_0x977f('0x8'))(new Redis(config[_0x977f('0x5')]));require(_0x977f('0x9'))[_0x977f('0xa')](socket);function respondWithStatusCode(_0x5c308a,_0x570f36){_0x570f36=_0x570f36||0xcc;return function(_0x4947a2){if(_0x4947a2){return _0x5c308a[_0x977f('0xb')](_0x570f36);}return _0x5c308a[_0x977f('0xc')](_0x570f36)[_0x977f('0xd')]();};}function respondWithResult(_0x450257,_0x494942){_0x494942=_0x494942||0xc8;return function(_0x2519fd){if(_0x2519fd){return _0x450257[_0x977f('0xc')](_0x494942)['json'](_0x2519fd);}};}function respondWithFilteredResult(_0x4fe658,_0x144a15){return function(_0x108832){if(_0x108832){var _0x1a99c0=typeof _0x144a15[_0x977f('0xe')]===_0x977f('0xf')&&typeof _0x144a15[_0x977f('0x10')]==='undefined';var _0x4c981c=_0x108832[_0x977f('0x11')];var _0x3026bf=_0x1a99c0?0x0:_0x144a15[_0x977f('0xe')];var _0x17ea8a=_0x1a99c0?_0x108832[_0x977f('0x11')]:_0x144a15[_0x977f('0xe')]+_0x144a15[_0x977f('0x10')];var _0x1b7c7f;if(_0x17ea8a>=_0x4c981c){_0x17ea8a=_0x4c981c;_0x1b7c7f=0xc8;}else{_0x1b7c7f=0xce;}_0x4fe658[_0x977f('0xc')](_0x1b7c7f);return _0x4fe658['set']('Content-Range',_0x3026bf+'-'+_0x17ea8a+'/'+_0x4c981c)[_0x977f('0x12')](_0x108832);}return null;};}function saveUpdates(_0x16fff6){return function(_0x4669ae){if(_0x4669ae){return _0x4669ae[_0x977f('0x13')](_0x16fff6)[_0x977f('0x14')](function(_0x40b870){return _0x40b870;});}return null;};}function removeEntity(_0x30c633){return function(_0x4b7e1e){if(_0x4b7e1e){return _0x4b7e1e[_0x977f('0x15')]()[_0x977f('0x14')](function(){var _0x280208=_0x4b7e1e[_0x977f('0x16')]({'plain':!![]});var _0x2b0b54=_0x977f('0x17');return db['UserProfileResource'][_0x977f('0x15')]({'where':{'type':_0x2b0b54,'resourceId':_0x280208['id']}})[_0x977f('0x14')](function(){return _0x4b7e1e;});})[_0x977f('0x14')](function(){_0x30c633['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6a02){return function(_0x3599a7){if(!_0x3599a7){_0x1e6a02[_0x977f('0xb')](0x194);}return _0x3599a7;};}function handleError(_0x546371,_0x1b7468){_0x1b7468=_0x1b7468||0x1f4;return function(_0x162b6b){logger[_0x977f('0x18')](_0x162b6b['stack']);if(_0x162b6b[_0x977f('0x19')]){delete _0x162b6b['name'];}_0x546371['status'](_0x1b7468)['send'](_0x162b6b);};}exports[_0x977f('0x1a')]=function(_0x1b5b36,_0x49f95d){var _0x23f4f5={};var _0x469559={'count':0x0,'rows':[]};var _0x5a78d5=_[_0x977f('0x1b')](db[_0x977f('0x1c')]['rawAttributes'],function(_0x2a149b){return{'name':_0x2a149b[_0x977f('0x1d')],'type':_0x2a149b[_0x977f('0x1e')][_0x977f('0x1f')]};});_0x23f4f5=qs[_0x977f('0x20')](_0x5a78d5,_0x1b5b36);var _0x427393={'where':_0x23f4f5[_0x977f('0x21')]};return db[_0x977f('0x1c')][_0x977f('0x11')](_0x427393)[_0x977f('0x14')](function(_0xaf5a09){_0x469559[_0x977f('0x11')]=_0xaf5a09;_0x23f4f5[_0x977f('0x22')]=qs['include'](_0x1b5b36[_0x977f('0x23')]);return db[_0x977f('0x1c')][_0x977f('0x24')](_0x23f4f5);})['then'](function(_0x3c1075){_0x469559['rows']=_0x3c1075;return _0x469559;})[_0x977f('0x14')](respondWithFilteredResult(_0x49f95d,_0x23f4f5))[_0x977f('0x25')](handleError(_0x49f95d,null));};exports[_0x977f('0x26')]=function(_0x1b9f6a,_0x1a887b){var _0x521f5c={'raw':!![],'where':{'id':_0x1b9f6a[_0x977f('0x27')]['id']}},_0x380a5b={};_0x380a5b['model']=_['keys'](db['WhatsappQueue'][_0x977f('0x28')]);_0x380a5b[_0x977f('0x23')]=_[_0x977f('0x29')](_0x1b9f6a[_0x977f('0x23')]);_0x380a5b[_0x977f('0x2a')]=_[_0x977f('0x2b')](_0x380a5b[_0x977f('0x2c')],_0x380a5b[_0x977f('0x23')]);_0x521f5c[_0x977f('0x2d')]=_[_0x977f('0x2b')](_0x380a5b[_0x977f('0x2c')],qs[_0x977f('0x2e')](_0x1b9f6a[_0x977f('0x23')][_0x977f('0x2e')]));_0x521f5c['attributes']=_0x521f5c['attributes']['length']?_0x521f5c['attributes']:_0x380a5b[_0x977f('0x2c')];if(_0x1b9f6a[_0x977f('0x23')]['includeAll']){_0x521f5c[_0x977f('0x22')]=[{'all':!![]}];}_0x521f5c=_[_0x977f('0x2f')]({},_0x521f5c,_0x1b9f6a[_0x977f('0x30')]);return db[_0x977f('0x1c')][_0x977f('0x31')](_0x521f5c)[_0x977f('0x14')](handleEntityNotFound(_0x1a887b,null))['then'](respondWithResult(_0x1a887b,null))[_0x977f('0x25')](handleError(_0x1a887b,null));};exports[_0x977f('0x32')]=function(_0x36f45c,_0x8cc376){return db[_0x977f('0x1c')]['create'](_0x36f45c[_0x977f('0x33')],{})[_0x977f('0x14')](function(_0x413113){var _0x274f29=_0x36f45c[_0x977f('0x34')][_0x977f('0x16')]({'plain':!![]});if(!_0x274f29)throw new Error(_0x977f('0x35'));if(_0x274f29[_0x977f('0x36')]==='user'){var _0x33b1ce=_0x413113[_0x977f('0x16')]({'plain':!![]});var _0x2226cd=_0x977f('0x17');return db[_0x977f('0x37')][_0x977f('0x31')]({'where':{'name':_0x2226cd,'userProfileId':_0x274f29[_0x977f('0x38')]},'raw':!![]})[_0x977f('0x14')](function(_0x245ab7){if(_0x245ab7&&_0x245ab7['autoAssociation']===0x0){return db['UserProfileResource'][_0x977f('0x32')]({'name':_0x33b1ce['name'],'resourceId':_0x33b1ce['id'],'type':_0x245ab7[_0x977f('0x19')],'sectionId':_0x245ab7['id']},{})['then'](function(){return _0x413113;});}else{return _0x413113;}})[_0x977f('0x25')](function(_0x57372f){logger['error'](_0x977f('0x39'),_0x57372f);throw _0x57372f;});}return _0x413113;})[_0x977f('0x14')](respondWithResult(_0x8cc376,0xc9))[_0x977f('0x25')](handleError(_0x8cc376,null));};exports['update']=function(_0x759a82,_0x33d9c0){if(_0x759a82[_0x977f('0x33')]['id']){delete _0x759a82[_0x977f('0x33')]['id'];}return db[_0x977f('0x1c')][_0x977f('0x31')]({'where':{'id':_0x759a82['params']['id']}})[_0x977f('0x14')](handleEntityNotFound(_0x33d9c0,null))['then'](saveUpdates(_0x759a82['body'],null))['then'](respondWithResult(_0x33d9c0,null))['catch'](handleError(_0x33d9c0,null));};exports[_0x977f('0x15')]=function(_0x31ff4c,_0x3d3363){return db['WhatsappQueue'][_0x977f('0x31')]({'where':{'id':_0x31ff4c['params']['id']}})[_0x977f('0x14')](handleEntityNotFound(_0x3d3363,null))[_0x977f('0x14')](removeEntity(_0x3d3363,null))[_0x977f('0x25')](handleError(_0x3d3363,null));};exports[_0x977f('0x3a')]=function(_0x1fec7f,_0x5ac9a3){return db[_0x977f('0x1c')][_0x977f('0x3a')]()[_0x977f('0x14')](respondWithResult(_0x5ac9a3,null))['catch'](handleError(_0x5ac9a3,null));};exports[_0x977f('0x3b')]=function(_0x2feeee,_0x45702e){var _0x3dd369={'raw':!![],'where':{}},_0x9d7ed3={},_0x2ef3a0;return db['WhatsappQueue'][_0x977f('0x3c')]({'where':{'id':_0x2feeee[_0x977f('0x27')]['id']}})[_0x977f('0x14')](handleEntityNotFound(_0x45702e,null))[_0x977f('0x14')](function(_0x58cd17){if(_0x58cd17){_0x2ef3a0=_0x58cd17[_0x977f('0x16')]({'plain':!![]});_0x9d7ed3['model']=_[_0x977f('0x29')](db[_0x977f('0x3d')]['rawAttributes']);_0x9d7ed3[_0x977f('0x23')]=_[_0x977f('0x29')](_0x2feeee['query']);_0x9d7ed3[_0x977f('0x2a')]=_[_0x977f('0x2b')](_0x9d7ed3[_0x977f('0x2c')],_0x9d7ed3['query']);_0x3dd369[_0x977f('0x2d')]=_['intersection'](_0x9d7ed3[_0x977f('0x2c')],qs[_0x977f('0x2e')](_0x2feeee[_0x977f('0x23')][_0x977f('0x2e')]));_0x3dd369[_0x977f('0x2d')]=_0x3dd369[_0x977f('0x2d')][_0x977f('0x3e')]?_0x3dd369[_0x977f('0x2d')]:_0x9d7ed3[_0x977f('0x2c')];if(!_0x2feeee[_0x977f('0x23')]['hasOwnProperty'](_0x977f('0x3f'))){_0x3dd369[_0x977f('0x10')]=qs['limit'](_0x2feeee[_0x977f('0x23')][_0x977f('0x10')]);_0x3dd369['offset']=qs[_0x977f('0xe')](_0x2feeee['query'][_0x977f('0xe')]);}_0x3dd369[_0x977f('0x40')]=qs[_0x977f('0x41')](_0x2feeee[_0x977f('0x23')]['sort']);_0x3dd369['where']=qs[_0x977f('0x2a')](_['pick'](_0x2feeee['query'],_0x9d7ed3['filters']));_0x3dd369['where']['WhatsappQueueId']=_0x58cd17['id'];if(_0x2feeee[_0x977f('0x23')]['filter']){_0x3dd369[_0x977f('0x21')]=_[_0x977f('0x2f')](_0x3dd369[_0x977f('0x21')],{'$or':_[_0x977f('0x1b')](_0x3dd369['attributes'],function(_0x1653ce){var _0x4026fe={};_0x4026fe[_0x1653ce]={'$like':'%'+_0x2feeee[_0x977f('0x23')][_0x977f('0x42')]+'%'};return _0x4026fe;})});}_0x3dd369=_[_0x977f('0x2f')]({},_0x3dd369,_0x2feeee[_0x977f('0x30')]);return db['UserWhatsappQueue'][_0x977f('0x24')](_0x3dd369);}})['then'](function(_0x5c4aee){if(_0x5c4aee){return db[_0x977f('0x43')][_0x977f('0x44')]({'where':{'id':_[_0x977f('0x1b')](_0x5c4aee,_0x977f('0x45')),'role':_0x977f('0x46')},'attributes':['id',_0x977f('0x19'),_0x977f('0x47'),_0x977f('0x48'),'createdAt']});}})[_0x977f('0x14')](function(_0x30466a){if(_0x30466a){return{'count':_0x30466a[_0x977f('0x11')],'rows':_[_0x977f('0x1b')](_0x30466a[_0x977f('0x49')],function(_0x8cdb83){return{'membername':_0x8cdb83[_0x977f('0x19')],'UserId':_0x8cdb83['id'],'queue_name':_0x2ef3a0[_0x977f('0x19')],'WhatsappQueueId':_0x2ef3a0['id'],'interface':util[_0x977f('0x4a')](_0x977f('0x4b'),'SIP',_0x8cdb83[_0x977f('0x19')]),'penalty':0x0,'paused':_0x8cdb83['whatsappPause'],'createdAt':_0x8cdb83['createdAt'],'updatedAt':_0x8cdb83[_0x977f('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x45702e,_0x3dd369))['catch'](handleError(_0x45702e,null));};exports[_0x977f('0x4c')]=function(_0xfb8860,_0x4edb38){var _0x44b1e2={};var _0x4374c1={};var _0x457175;var _0x52cf2f;return db[_0x977f('0x1c')][_0x977f('0x3c')]({'where':{'id':_0xfb8860[_0x977f('0x27')]['id']}})[_0x977f('0x14')](handleEntityNotFound(_0x4edb38,null))['then'](function(_0x104936){if(_0x104936){_0x457175=_0x104936;_0x4374c1['model']=_['keys'](db[_0x977f('0x4d')][_0x977f('0x28')]);_0x4374c1['query']=_[_0x977f('0x29')](_0xfb8860[_0x977f('0x23')]);_0x4374c1['filters']=_[_0x977f('0x2b')](_0x4374c1['model'],_0x4374c1[_0x977f('0x23')]);_0x44b1e2[_0x977f('0x2d')]=_['intersection'](_0x4374c1['model'],qs['fields'](_0xfb8860[_0x977f('0x23')][_0x977f('0x2e')]));_0x44b1e2[_0x977f('0x2d')]=_0x44b1e2[_0x977f('0x2d')][_0x977f('0x3e')]?_0x44b1e2[_0x977f('0x2d')]:_0x4374c1['model'];_0x44b1e2[_0x977f('0x40')]=qs[_0x977f('0x41')](_0xfb8860[_0x977f('0x23')]['sort']);_0x44b1e2[_0x977f('0x21')]=qs[_0x977f('0x2a')](_[_0x977f('0x4e')](_0xfb8860['query'],_0x4374c1[_0x977f('0x2a')]));if(_0xfb8860['query']['filter']){_0x44b1e2['where']=_[_0x977f('0x2f')](_0x44b1e2[_0x977f('0x21')],{'$or':_[_0x977f('0x1b')](_0x44b1e2[_0x977f('0x2d')],function(_0x259543){var _0x2903db={};_0x2903db[_0x259543]={'$like':'%'+_0xfb8860[_0x977f('0x23')]['filter']+'%'};return _0x2903db;})});}_0x44b1e2=_[_0x977f('0x2f')]({},_0x44b1e2,_0xfb8860[_0x977f('0x30')]);return _0x457175['getTeams'](_0x44b1e2);}})[_0x977f('0x14')](function(_0x54c76e){if(_0x54c76e){_0x52cf2f=_0x54c76e[_0x977f('0x3e')];if(!_0xfb8860[_0x977f('0x23')][_0x977f('0x4f')](_0x977f('0x3f'))){_0x44b1e2[_0x977f('0x10')]=qs[_0x977f('0x10')](_0xfb8860[_0x977f('0x23')][_0x977f('0x10')]);_0x44b1e2[_0x977f('0xe')]=qs['offset'](_0xfb8860['query'][_0x977f('0xe')]);}return _0x457175[_0x977f('0x4c')](_0x44b1e2);}})[_0x977f('0x14')](function(_0x44771d){if(_0x44771d){return _0x44771d?{'count':_0x52cf2f,'rows':_0x44771d}:null;}})[_0x977f('0x14')](respondWithResult(_0x4edb38,null))[_0x977f('0x25')](handleError(_0x4edb38,null));};exports[_0x977f('0x50')]=function(_0x5528cc,_0x4fc71f){var _0x20abb5=_0x5528cc['body'][_0x977f('0x51')];return db[_0x977f('0x4d')][_0x977f('0x24')]({'where':{'id':_0x20abb5},'attributes':['id'],'include':[{'model':db[_0x977f('0x43')],'as':_0x977f('0x52'),'attributes':['id',_0x977f('0x19'),_0x977f('0x53'),'voicePause',_0x977f('0x54')],'raw':!![]}]})[_0x977f('0x14')](function(_0x4c03cd){if(_0x4c03cd){var _0x25a7b8=_[_0x977f('0x55')](_0x4c03cd,function(_0x382db1){var _0xe0f675=_0x382db1[_0x977f('0x16')]({'plain':!![]});return _0xe0f675[_0x977f('0x52')];});return db[_0x977f('0x1c')][_0x977f('0x31')]({'where':{'id':_0x5528cc[_0x977f('0x27')]['id']}})[_0x977f('0x14')](function(_0x5ee317){return db[_0x977f('0x56')][_0x977f('0x57')](function(_0x2724d6){return _0x5ee317[_0x977f('0x50')](_0x20abb5,{'transaction':_0x2724d6})[_0x977f('0x14')](function(){return BPromise[_0x977f('0x58')](_0x25a7b8,function(_0x386a0e){return db[_0x977f('0x3d')][_0x977f('0x59')]({'where':{'UserId':_0x386a0e['id'],'WhatsappQueueId':_0x5528cc['params']['id']},'transaction':_0x2724d6});});})[_0x977f('0x14')](function(){_0x25a7b8[_0x977f('0x5a')](function(_0xeea7f5){socket[_0x977f('0x5b')](_0x977f('0x5c'),{'UserId':_0xeea7f5['id'],'WhatsappQueueId':_0x5ee317['id']});});});});});}})[_0x977f('0x14')](respondWithStatusCode(_0x4fc71f,null))[_0x977f('0x25')](handleError(_0x4fc71f,null));};exports[_0x977f('0x5d')]=function(_0x2bf8c,_0x17d33d){return db[_0x977f('0x4d')][_0x977f('0x24')]({'where':{'id':_0x2bf8c[_0x977f('0x23')][_0x977f('0x51')]},'attributes':['id'],'include':[{'model':db[_0x977f('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x977f('0x14')](handleEntityNotFound(_0x17d33d,null))['then'](function(_0x405b27){var _0x3f0388=_[_0x977f('0x1b')](_0x405b27,'id');var _0x32d315=[];var _0x2700e0=[];var _0x11c864=squel['select']();_0x11c864[_0x977f('0x5e')](_0x977f('0x5f'))[_0x977f('0x60')](_0x977f('0x61'),'tq')[_0x977f('0x62')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x977f('0x21')](_0x977f('0x63'),_0x2bf8c[_0x977f('0x27')]['id']);for(var _0x15a2d5=0x0;_0x15a2d5<_0x405b27[_0x977f('0x3e')];_0x15a2d5+=0x1){let _0x54ca72=_0x405b27[_0x15a2d5];for(var _0x13d09e=0x0;_0x13d09e<_0x54ca72['Agents'][_0x977f('0x3e')];_0x13d09e+=0x1){let _0x4167d4=_0x54ca72[_0x977f('0x52')][_0x13d09e];var _0x33073b=_0x11c864[_0x977f('0x64')]();_0x33073b[_0x977f('0x21')](_0x977f('0x65'),_0x4167d4['id']);_0x2700e0[_0x977f('0x66')](db[_0x977f('0x56')][_0x977f('0x23')](_0x33073b[_0x977f('0x67')](),{'type':db[_0x977f('0x56')]['QueryTypes'][_0x977f('0x68')]})[_0x977f('0x14')](function(_0x5d2dcd){if(_0x5d2dcd[_0x977f('0x3e')]===0x1){return _0x4167d4['id'];}else{var _0x4f4ce0=_[_0x977f('0x69')](_['map'](_0x5d2dcd,_0x977f('0x6a')),function(_0x7291a8){return _[_0x977f('0x6b')](_0x3f0388,_0x7291a8);});if(_0x4f4ce0){return _0x4167d4['id'];}}}));}}return BPromise[_0x977f('0x6c')](_0x2700e0)[_0x977f('0x14')](function(_0x56db90){_0x32d315=_(_0x32d315)[_0x977f('0x6d')](_0x56db90)[_0x977f('0x6e')]()['value']();return db[_0x977f('0x1c')][_0x977f('0x31')]({'where':{'id':_0x2bf8c['params']['id']}})[_0x977f('0x14')](function(_0x1c6ac7){return db['sequelize'][_0x977f('0x57')](function(_0x4dfe00){return _0x1c6ac7[_0x977f('0x5d')](_0x2bf8c[_0x977f('0x23')][_0x977f('0x51')],{'transaction':_0x4dfe00})[_0x977f('0x14')](function(){if(!_[_0x977f('0x6f')](_0x32d315)){return _0x1c6ac7['removeAgents'](_0x32d315,{'transaction':_0x4dfe00});}})[_0x977f('0x14')](function(){_0x32d315[_0x977f('0x5a')](function(_0x5440b5){socket[_0x977f('0x5b')](_0x977f('0x70'),{'UserId':_0x5440b5,'WhatsappQueueId':_0x1c6ac7['id']});});});});});});})[_0x977f('0x14')](respondWithStatusCode(_0x17d33d,null))['catch'](handleError(_0x17d33d,null));};exports[_0x977f('0x71')]=function(_0x5c7715,_0x57eca5){return db['WhatsappQueue'][_0x977f('0x31')]({'where':{'id':_0x5c7715[_0x977f('0x27')]['id']}})[_0x977f('0x14')](handleEntityNotFound(_0x57eca5,null))[_0x977f('0x14')](function(_0x1f98a5){if(_0x1f98a5){return _0x1f98a5[_0x977f('0x71')](_0x5c7715[_0x977f('0x33')][_0x977f('0x51')],_[_0x977f('0x72')](_0x5c7715['body'],[_0x977f('0x51'),'id'])||{})[_0x977f('0x73')](function(_0x264c8f){for(var _0x3cd55a=0x0;_0x3cd55a<_0x5c7715[_0x977f('0x33')]['ids'][_0x977f('0x3e')];_0x3cd55a+=0x1){socket[_0x977f('0x5b')](_0x977f('0x5c'),{'UserId':Number(_0x5c7715['body']['ids'][_0x3cd55a]),'WhatsappQueueId':Number(_0x5c7715['params']['id'])});}return _0x264c8f;});}})['then'](respondWithResult(_0x57eca5,null))[_0x977f('0x25')](handleError(_0x57eca5,null));};exports[_0x977f('0x74')]=function(_0x3f7f97,_0x3446bd){return db[_0x977f('0x1c')][_0x977f('0x31')]({'where':{'id':_0x3f7f97['params']['id']}})['then'](handleEntityNotFound(_0x3446bd,null))[_0x977f('0x14')](function(_0x2175e8){if(_0x2175e8){return _0x2175e8[_0x977f('0x74')](_0x3f7f97[_0x977f('0x23')][_0x977f('0x51')])[_0x977f('0x14')](function(){if(_[_0x977f('0x75')](_0x3f7f97['query'][_0x977f('0x51')])){for(var _0x209ccd=0x0;_0x209ccd<_0x3f7f97[_0x977f('0x23')]['ids'][_0x977f('0x3e')];_0x209ccd+=0x1){socket[_0x977f('0x5b')](_0x977f('0x70'),{'UserId':Number(_0x3f7f97[_0x977f('0x23')][_0x977f('0x51')][_0x209ccd]),'WhatsappQueueId':Number(_0x3f7f97[_0x977f('0x27')]['id'])});}}else{socket[_0x977f('0x5b')](_0x977f('0x70'),{'UserId':Number(_0x3f7f97[_0x977f('0x23')][_0x977f('0x51')]),'WhatsappQueueId':Number(_0x3f7f97['params']['id'])});}});}})[_0x977f('0x14')](respondWithStatusCode(_0x3446bd,null))[_0x977f('0x25')](handleError(_0x3446bd,null));};exports[_0x977f('0x76')]=function(_0x8dc24a,_0x440189){var _0x4368f4={};var _0x1aed58={};var _0x3e74c1;var _0x992122;return db[_0x977f('0x1c')][_0x977f('0x3c')]({'where':{'id':_0x8dc24a[_0x977f('0x27')]['id']}})[_0x977f('0x14')](handleEntityNotFound(_0x440189,null))[_0x977f('0x14')](function(_0x4cf9ec){if(_0x4cf9ec){_0x3e74c1=_0x4cf9ec;_0x1aed58[_0x977f('0x2c')]=_[_0x977f('0x29')](db[_0x977f('0x43')][_0x977f('0x28')]);_0x1aed58[_0x977f('0x23')]=_[_0x977f('0x29')](_0x8dc24a[_0x977f('0x23')]);_0x1aed58[_0x977f('0x2a')]=_[_0x977f('0x2b')](_0x1aed58['model'],_0x1aed58[_0x977f('0x23')]);_0x4368f4[_0x977f('0x2d')]=_['intersection'](_0x1aed58[_0x977f('0x2c')],qs[_0x977f('0x2e')](_0x8dc24a[_0x977f('0x23')]['fields']));_0x4368f4[_0x977f('0x2d')]=_0x4368f4[_0x977f('0x2d')]['length']?_0x4368f4[_0x977f('0x2d')]:_0x1aed58[_0x977f('0x2c')];_0x4368f4[_0x977f('0x40')]=qs[_0x977f('0x41')](_0x8dc24a[_0x977f('0x23')][_0x977f('0x41')]);_0x4368f4[_0x977f('0x21')]=qs[_0x977f('0x2a')](_[_0x977f('0x4e')](_0x8dc24a['query'],_0x1aed58[_0x977f('0x2a')]));if(_0x8dc24a['query'][_0x977f('0x42')]){_0x4368f4['where']=_[_0x977f('0x2f')](_0x4368f4[_0x977f('0x21')],{'$or':_[_0x977f('0x1b')](_0x4368f4['attributes'],function(_0x2bbea3){var _0x2f6a83={};_0x2f6a83[_0x2bbea3]={'$like':'%'+_0x8dc24a['query'][_0x977f('0x42')]+'%'};return _0x2f6a83;})});}_0x4368f4=_['merge']({},_0x4368f4,_0x8dc24a[_0x977f('0x30')]);return _0x3e74c1['getAgents'](_0x4368f4);}})['then'](function(_0x2e4153){if(_0x2e4153){_0x992122=_0x2e4153[_0x977f('0x3e')];if(!_0x8dc24a[_0x977f('0x23')][_0x977f('0x4f')]('nolimit')){_0x4368f4['limit']=qs[_0x977f('0x10')](_0x8dc24a[_0x977f('0x23')][_0x977f('0x10')]);_0x4368f4[_0x977f('0xe')]=qs[_0x977f('0xe')](_0x8dc24a[_0x977f('0x23')][_0x977f('0xe')]);}return _0x3e74c1['getAgents'](_0x4368f4);}})['then'](function(_0x23c358){if(_0x23c358){return _0x23c358?{'count':_0x992122,'rows':_0x23c358}:null;}})['then'](respondWithResult(_0x440189,null))[_0x977f('0x25')](handleError(_0x440189,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 1642fce..fe43f9c 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 _0xe887=['WhatsappQueue','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe887,0x8e));var _0x7e88=function(_0x34c825,_0x44cad4){_0x34c825=_0x34c825-0x0;var _0x2fde13=_0xe887[_0x34c825];return _0x2fde13;};'use strict';var EventEmitter=require(_0x7e88('0x0'));var WhatsappQueue=require(_0x7e88('0x1'))['db'][_0x7e88('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7e88('0x3'),'afterUpdate':_0x7e88('0x4'),'afterDestroy':_0x7e88('0x5')};function emitEvent(_0x58ef39){return function(_0x478ab7,_0x2b8007,_0x66f2b8){WhatsappQueueEvents[_0x7e88('0x6')](_0x58ef39+':'+_0x478ab7['id'],_0x478ab7);WhatsappQueueEvents[_0x7e88('0x6')](_0x58ef39,_0x478ab7);_0x66f2b8(null);};}for(var e in events){if(events[_0x7e88('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7e88('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2c87=['emit','hasOwnProperty','../../mysqldb','WhatsappQueue','save','remove'];(function(_0x1d94d1,_0x347bb8){var _0x23c397=function(_0x489441){while(--_0x489441){_0x1d94d1['push'](_0x1d94d1['shift']());}};_0x23c397(++_0x347bb8);}(_0x2c87,0x86));var _0x72c8=function(_0xd35ba6,_0xb9cf44){_0xd35ba6=_0xd35ba6-0x0;var _0x503dd6=_0x2c87[_0xd35ba6];return _0x503dd6;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x72c8('0x0'))['db'][_0x72c8('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x72c8('0x2'),'afterUpdate':'update','afterDestroy':_0x72c8('0x3')};function emitEvent(_0x2cbcab){return function(_0x267d28,_0x1b4d13,_0x597cb7){WhatsappQueueEvents[_0x72c8('0x4')](_0x2cbcab+':'+_0x267d28['id'],_0x267d28);WhatsappQueueEvents[_0x72c8('0x4')](_0x2cbcab,_0x267d28);_0x597cb7(null);};}for(var e in events){if(events[_0x72c8('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ac6f2c9..cb1dc18 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 _0xa375=['whatsapp_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','WhatsappQueue'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa375,0x14b));var _0x5a37=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0xa375[_0x102977];return _0x15c466;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a37('0x0'))(_0x5a37('0x1'));var moment=require(_0x5a37('0x2'));var BPromise=require(_0x5a37('0x3'));var rp=require(_0x5a37('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a37('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x5a37('0x6')]=function(_0x19a10e,_0x44dcb6){return _0x19a10e[_0x5a37('0x7')](_0x5a37('0x8'),attributes,{'tableName':_0x5a37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11a1=['./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x18dc00,_0x133afb){var _0x2366e9=function(_0x40e430){while(--_0x40e430){_0x18dc00['push'](_0x18dc00['shift']());}};_0x2366e9(++_0x133afb);}(_0x11a1,0xef));var _0x111a=function(_0xc50180,_0x29c6db){_0xc50180=_0xc50180-0x0;var _0x45d326=_0x11a1[_0xc50180];return _0x45d326;};'use strict';var _=require(_0x111a('0x0'));var util=require(_0x111a('0x1'));var logger=require('../../config/logger')(_0x111a('0x2'));var moment=require(_0x111a('0x3'));var BPromise=require(_0x111a('0x4'));var rp=require(_0x111a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x111a('0x6'));var config=require(_0x111a('0x7'));var attributes=require(_0x111a('0x8'));module[_0x111a('0x9')]=function(_0x406ee7,_0x432dec){return _0x406ee7[_0x111a('0xa')](_0x111a('0xb'),attributes,{'tableName':_0x111a('0xc'),'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 cccd29b..1c39d58 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 _0xc531=['then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','raw','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0xc531,0x6b));var _0x1c53=function(_0x31c98c,_0x4d0933){_0x31c98c=_0x31c98c-0x0;var _0x1915bb=_0xc531[_0x31c98c];return _0x1915bb;};'use strict';var _=require(_0x1c53('0x0'));var util=require(_0x1c53('0x1'));var moment=require(_0x1c53('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c53('0x3'));var db=require(_0x1c53('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1c53('0x5'));var config=require(_0x1c53('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1c53('0x7')][_0x1c53('0x8')]({'port':0x232a});config['redis']=_[_0x1c53('0x9')](config['redis'],{'host':_0x1c53('0xa'),'port':0x18eb});var socket=require(_0x1c53('0xb'))(new Redis(config[_0x1c53('0xc')]));require(_0x1c53('0xd'))[_0x1c53('0xe')](socket);function respondWithRpcPromise(_0x269ed5,_0x5722bb,_0x47013c){return new BPromise(function(_0x261afa,_0x4e411a){return client[_0x1c53('0xf')](_0x269ed5,_0x47013c)[_0x1c53('0x10')](function(_0x47d559){logger['info'](_0x1c53('0x11'),_0x5722bb,'request\x20sent');logger[_0x1c53('0x12')](_0x1c53('0x13'),_0x5722bb,_0x1c53('0x14'),JSON[_0x1c53('0x15')](_0x47d559));if(_0x47d559[_0x1c53('0x16')]){if(_0x47d559[_0x1c53('0x16')][_0x1c53('0x17')]===0x1f4){logger[_0x1c53('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x5722bb,_0x47d559[_0x1c53('0x16')]['message']);return _0x4e411a(_0x47d559[_0x1c53('0x16')][_0x1c53('0x18')]);}logger[_0x1c53('0x16')](_0x1c53('0x11'),_0x5722bb,_0x47d559[_0x1c53('0x16')][_0x1c53('0x18')]);return _0x261afa(_0x47d559[_0x1c53('0x16')]['message']);}else{logger[_0x1c53('0x19')](_0x1c53('0x11'),_0x5722bb,_0x1c53('0x14'));_0x261afa(_0x47d559[_0x1c53('0x1a')][_0x1c53('0x18')]);}})[_0x1c53('0x1b')](function(_0x3274b8){logger[_0x1c53('0x16')](_0x1c53('0x11'),_0x5722bb,_0x3274b8);_0x4e411a(_0x3274b8);});});}exports[_0x1c53('0x1c')]=function(_0x192e4a){var _0x23fb3d=this;return new Promise(function(_0x2646f6,_0x10c095){return db[_0x1c53('0x1d')][_0x1c53('0x1e')]({'raw':_0x192e4a[_0x1c53('0x1f')]?_0x192e4a[_0x1c53('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x192e4a[_0x1c53('0x1f')]?_0x192e4a[_0x1c53('0x1f')][_0x1c53('0x20')]||null:null,'attributes':_0x192e4a[_0x1c53('0x1f')]?_0x192e4a[_0x1c53('0x1f')][_0x1c53('0x21')]||null:null,'limit':_0x192e4a[_0x1c53('0x1f')]?_0x192e4a[_0x1c53('0x1f')][_0x1c53('0x22')]||null:null,'include':_0x192e4a[_0x1c53('0x1f')]?_0x192e4a[_0x1c53('0x1f')][_0x1c53('0x23')]?_[_0x1c53('0x24')](_0x192e4a[_0x1c53('0x1f')][_0x1c53('0x23')],function(_0x3a4782){return{'model':db[_0x3a4782[_0x1c53('0x25')]],'as':_0x3a4782['as'],'attributes':_0x3a4782[_0x1c53('0x21')],'include':_0x3a4782[_0x1c53('0x23')]?_[_0x1c53('0x24')](_0x3a4782[_0x1c53('0x23')],function(_0x4953e3){return{'model':db[_0x4953e3[_0x1c53('0x25')]],'as':_0x4953e3['as'],'attributes':_0x4953e3[_0x1c53('0x21')],'include':_0x4953e3[_0x1c53('0x23')]?_[_0x1c53('0x24')](_0x4953e3[_0x1c53('0x23')],function(_0xea1df3){return{'model':db[_0xea1df3[_0x1c53('0x25')]],'as':_0xea1df3['as'],'attributes':_0xea1df3[_0x1c53('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1c53('0x10')](function(_0x3c495f){logger['info'](_0x1c53('0x1c'),_0x192e4a);logger['debug'](_0x1c53('0x1c'),_0x192e4a,JSON[_0x1c53('0x15')](_0x3c495f));_0x2646f6(_0x3c495f);})['catch'](function(_0x21d78e){logger[_0x1c53('0x16')]('GetWhatsappQueue',_0x21d78e[_0x1c53('0x18')],_0x192e4a);_0x10c095(_0x23fb3d[_0x1c53('0x16')](0x1f4,_0x21d78e[_0x1c53('0x18')]));});});};exports[_0x1c53('0x26')]=function(_0x3e19a8){var _0x2f54eb=this;return new Promise(function(_0x5e1dc8,_0x233f43){return db[_0x1c53('0x1d')][_0x1c53('0x27')]({'raw':_0x3e19a8[_0x1c53('0x1f')]?_0x3e19a8[_0x1c53('0x1f')][_0x1c53('0x28')]===undefined?!![]:![]:!![],'where':_0x3e19a8[_0x1c53('0x1f')]?_0x3e19a8[_0x1c53('0x1f')][_0x1c53('0x20')]||null:null,'attributes':_0x3e19a8[_0x1c53('0x1f')]?_0x3e19a8['options'][_0x1c53('0x21')]||null:null,'include':_0x3e19a8['options']?_0x3e19a8[_0x1c53('0x1f')][_0x1c53('0x23')]?_['map'](_0x3e19a8[_0x1c53('0x1f')][_0x1c53('0x23')],function(_0x2cb1a0){return{'model':db[_0x2cb1a0['model']],'as':_0x2cb1a0['as'],'attributes':_0x2cb1a0[_0x1c53('0x21')],'include':_0x2cb1a0[_0x1c53('0x23')]?_[_0x1c53('0x24')](_0x2cb1a0['include'],function(_0x3a5cc2){return{'model':db[_0x3a5cc2[_0x1c53('0x25')]],'as':_0x3a5cc2['as'],'attributes':_0x3a5cc2['attributes'],'include':_0x3a5cc2[_0x1c53('0x23')]?_[_0x1c53('0x24')](_0x3a5cc2[_0x1c53('0x23')],function(_0x113386){return{'model':db[_0x113386[_0x1c53('0x25')]],'as':_0x113386['as'],'attributes':_0x113386['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c53('0x10')](function(_0x25f06){logger[_0x1c53('0x19')](_0x1c53('0x26'),_0x3e19a8);logger[_0x1c53('0x12')]('ShowWhatsappQueue',_0x3e19a8,JSON[_0x1c53('0x15')](_0x25f06));_0x5e1dc8(_0x25f06);})[_0x1c53('0x1b')](function(_0x43c21d){logger['error']('ShowWhatsappQueue',_0x43c21d[_0x1c53('0x18')],_0x3e19a8);_0x233f43(_0x2f54eb[_0x1c53('0x16')](0x1f4,_0x43c21d['message']));});});}; \ No newline at end of file +var _0x65c9=['error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','map','include','model','catch','find','raw','where','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x65c9,0x96));var _0x965c=function(_0x1820f3,_0x5da090){_0x1820f3=_0x1820f3-0x0;var _0x78857a=_0x65c9[_0x1820f3];return _0x78857a;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var moment=require(_0x965c('0x2'));var BPromise=require(_0x965c('0x3'));var rs=require(_0x965c('0x4'));var fs=require('fs');var Redis=require(_0x965c('0x5'));var db=require(_0x965c('0x6'))['db'];var utils=require(_0x965c('0x7'));var logger=require(_0x965c('0x8'))('rpc');var config=require(_0x965c('0x9'));var jayson=require(_0x965c('0xa'));var client=jayson[_0x965c('0xb')][_0x965c('0xc')]({'port':0x232a});config[_0x965c('0xd')]=_[_0x965c('0xe')](config['redis'],{'host':_0x965c('0xf'),'port':0x18eb});var socket=require(_0x965c('0x10'))(new Redis(config[_0x965c('0xd')]));require('./whatsappQueue.socket')[_0x965c('0x11')](socket);function respondWithRpcPromise(_0x376cee,_0x546bb8,_0x2efd31){return new BPromise(function(_0x150a9a,_0x51d1ca){return client[_0x965c('0x12')](_0x376cee,_0x2efd31)[_0x965c('0x13')](function(_0xae6ab6){logger[_0x965c('0x14')](_0x965c('0x15'),_0x546bb8,'request\x20sent');logger[_0x965c('0x16')](_0x965c('0x17'),_0x546bb8,_0x965c('0x18'),JSON[_0x965c('0x19')](_0xae6ab6));if(_0xae6ab6[_0x965c('0x1a')]){if(_0xae6ab6[_0x965c('0x1a')][_0x965c('0x1b')]===0x1f4){logger[_0x965c('0x1a')](_0x965c('0x15'),_0x546bb8,_0xae6ab6[_0x965c('0x1a')]['message']);return _0x51d1ca(_0xae6ab6[_0x965c('0x1a')][_0x965c('0x1c')]);}logger[_0x965c('0x1a')](_0x965c('0x15'),_0x546bb8,_0xae6ab6[_0x965c('0x1a')][_0x965c('0x1c')]);return _0x150a9a(_0xae6ab6[_0x965c('0x1a')][_0x965c('0x1c')]);}else{logger[_0x965c('0x14')](_0x965c('0x15'),_0x546bb8,_0x965c('0x18'));_0x150a9a(_0xae6ab6[_0x965c('0x1d')][_0x965c('0x1c')]);}})['catch'](function(_0x20dc0f){logger[_0x965c('0x1a')](_0x965c('0x15'),_0x546bb8,_0x20dc0f);_0x51d1ca(_0x20dc0f);});});}exports[_0x965c('0x1e')]=function(_0x26355f){var _0x2559a5=this;return new Promise(function(_0x5f2ffd,_0x727601){return db[_0x965c('0x1f')][_0x965c('0x20')]({'raw':_0x26355f[_0x965c('0x21')]?_0x26355f[_0x965c('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x26355f[_0x965c('0x21')]?_0x26355f[_0x965c('0x21')]['where']||null:null,'attributes':_0x26355f[_0x965c('0x21')]?_0x26355f[_0x965c('0x21')][_0x965c('0x22')]||null:null,'limit':_0x26355f[_0x965c('0x21')]?_0x26355f[_0x965c('0x21')][_0x965c('0x23')]||null:null,'include':_0x26355f[_0x965c('0x21')]?_0x26355f['options']['include']?_[_0x965c('0x24')](_0x26355f['options'][_0x965c('0x25')],function(_0x3e1840){return{'model':db[_0x3e1840[_0x965c('0x26')]],'as':_0x3e1840['as'],'attributes':_0x3e1840[_0x965c('0x22')],'include':_0x3e1840[_0x965c('0x25')]?_[_0x965c('0x24')](_0x3e1840[_0x965c('0x25')],function(_0x2ef149){return{'model':db[_0x2ef149[_0x965c('0x26')]],'as':_0x2ef149['as'],'attributes':_0x2ef149[_0x965c('0x22')],'include':_0x2ef149['include']?_[_0x965c('0x24')](_0x2ef149[_0x965c('0x25')],function(_0x2b568d){return{'model':db[_0x2b568d[_0x965c('0x26')]],'as':_0x2b568d['as'],'attributes':_0x2b568d['attributes']};}):[]};}):[]};}):[]:[]})[_0x965c('0x13')](function(_0x44d080){logger['info']('GetWhatsappQueue',_0x26355f);logger[_0x965c('0x16')](_0x965c('0x1e'),_0x26355f,JSON[_0x965c('0x19')](_0x44d080));_0x5f2ffd(_0x44d080);})[_0x965c('0x27')](function(_0x232aa2){logger[_0x965c('0x1a')](_0x965c('0x1e'),_0x232aa2[_0x965c('0x1c')],_0x26355f);_0x727601(_0x2559a5['error'](0x1f4,_0x232aa2[_0x965c('0x1c')]));});});};exports['ShowWhatsappQueue']=function(_0x82c2cb){var _0x46ee9c=this;return new Promise(function(_0xd4038b,_0x3b52f9){return db['WhatsappQueue'][_0x965c('0x28')]({'raw':_0x82c2cb[_0x965c('0x21')]?_0x82c2cb['options'][_0x965c('0x29')]===undefined?!![]:![]:!![],'where':_0x82c2cb[_0x965c('0x21')]?_0x82c2cb[_0x965c('0x21')][_0x965c('0x2a')]||null:null,'attributes':_0x82c2cb[_0x965c('0x21')]?_0x82c2cb['options'][_0x965c('0x22')]||null:null,'include':_0x82c2cb[_0x965c('0x21')]?_0x82c2cb['options'][_0x965c('0x25')]?_[_0x965c('0x24')](_0x82c2cb[_0x965c('0x21')]['include'],function(_0x5cb3b8){return{'model':db[_0x5cb3b8[_0x965c('0x26')]],'as':_0x5cb3b8['as'],'attributes':_0x5cb3b8['attributes'],'include':_0x5cb3b8[_0x965c('0x25')]?_[_0x965c('0x24')](_0x5cb3b8[_0x965c('0x25')],function(_0x29c07b){return{'model':db[_0x29c07b[_0x965c('0x26')]],'as':_0x29c07b['as'],'attributes':_0x29c07b[_0x965c('0x22')],'include':_0x29c07b['include']?_['map'](_0x29c07b[_0x965c('0x25')],function(_0x4ed78e){return{'model':db[_0x4ed78e[_0x965c('0x26')]],'as':_0x4ed78e['as'],'attributes':_0x4ed78e[_0x965c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x965c('0x13')](function(_0x3afcfa){logger[_0x965c('0x14')]('ShowWhatsappQueue',_0x82c2cb);logger[_0x965c('0x16')](_0x965c('0x2b'),_0x82c2cb,JSON[_0x965c('0x19')](_0x3afcfa));_0xd4038b(_0x3afcfa);})[_0x965c('0x27')](function(_0x4d941e){logger[_0x965c('0x1a')](_0x965c('0x2b'),_0x4d941e[_0x965c('0x1c')],_0x82c2cb);_0x3b52f9(_0x46ee9c[_0x965c('0x1a')](0x1f4,_0x4d941e[_0x965c('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 35f0acb..0676e7f 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 _0xba44=['register','length','whatsappQueue:','remove','update','emit','removeListener'];(function(_0x5139ec,_0x1c2e54){var _0x852db8=function(_0x20ebb7){while(--_0x20ebb7){_0x5139ec['push'](_0x5139ec['shift']());}};_0x852db8(++_0x1c2e54);}(_0xba44,0x199));var _0x4ba4=function(_0x38106a,_0x5f21db){_0x38106a=_0x38106a-0x0;var _0x365bc7=_0xba44[_0x38106a];return _0x365bc7;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x4ba4('0x0'),_0x4ba4('0x1')];function createListener(_0x2d5b99,_0x161c1b){return function(_0x24cd9c){_0x161c1b[_0x4ba4('0x2')](_0x2d5b99,_0x24cd9c);};}function removeListener(_0x39e65c,_0x5d9962){return function(){WhatsappQueueEvents[_0x4ba4('0x3')](_0x39e65c,_0x5d9962);};}exports[_0x4ba4('0x4')]=function(_0xf12a93){for(var _0x1e9ae4=0x0,_0x26c06e=events[_0x4ba4('0x5')];_0x1e9ae4<_0x26c06e;_0x1e9ae4++){var _0x5e8e1d=events[_0x1e9ae4];var _0xfae122=createListener(_0x4ba4('0x6')+_0x5e8e1d,_0xf12a93);WhatsappQueueEvents['on'](_0x5e8e1d,_0xfae122);}}; \ No newline at end of file +var _0xaaa6=['emit','removeListener','register','whatsappQueue:','save','remove','update'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xaaa6,0x107));var _0x6aaa=function(_0xee329e,_0x59fa63){_0xee329e=_0xee329e-0x0;var _0x406723=_0xaaa6[_0xee329e];return _0x406723;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6aaa('0x0'),_0x6aaa('0x1'),_0x6aaa('0x2')];function createListener(_0x4d3550,_0x561ad1){return function(_0x1ab7b6){_0x561ad1[_0x6aaa('0x3')](_0x4d3550,_0x1ab7b6);};}function removeListener(_0x5acdf6,_0x2a22dd){return function(){WhatsappQueueEvents[_0x6aaa('0x4')](_0x5acdf6,_0x2a22dd);};}exports[_0x6aaa('0x5')]=function(_0x154104){for(var _0x4e1778=0x0,_0x1977bf=events['length'];_0x4e1778<_0x1977bf;_0x4e1778++){var _0x34654a=events[_0x4e1778];var _0x4e0a5a=createListener(_0x6aaa('0x6')+_0x34654a,_0x154104);WhatsappQueueEvents['on'](_0x34654a,_0x4e0a5a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c3e62b7..44161fc 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 _0x1924=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy'];(function(_0x35140a,_0x6e06f){var _0x1c0051=function(_0xa89f7f){while(--_0xa89f7f){_0x35140a['push'](_0x35140a['shift']());}};_0x1c0051(++_0x6e06f);}(_0x1924,0x91));var _0x4192=function(_0x334dc2,_0x44f024){_0x334dc2=_0x334dc2-0x0;var _0x487011=_0x1924[_0x334dc2];return _0x487011;};'use strict';var multer=require('multer');var util=require(_0x4192('0x0'));var path=require('path');var timeout=require(_0x4192('0x1'));var express=require(_0x4192('0x2'));var router=express[_0x4192('0x3')]();var fs_extra=require(_0x4192('0x4'));var auth=require(_0x4192('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4192('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4192('0x7')](_0x4192('0x8'),auth[_0x4192('0x9')](),controller[_0x4192('0xa')]);router[_0x4192('0x7')](_0x4192('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4192('0xc')]('/',auth[_0x4192('0x9')](),controller[_0x4192('0xd')]);router[_0x4192('0xe')](_0x4192('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4192('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x4192('0x10')]);module[_0x4192('0x11')]=router; \ No newline at end of file +var _0x7aa5=['post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7aa5,0x15c));var _0x57aa=function(_0x5a2b40,_0x315ead){_0x5a2b40=_0x5a2b40-0x0;var _0x32ae67=_0x7aa5[_0x5a2b40];return _0x32ae67;};'use strict';var multer=require('multer');var util=require(_0x57aa('0x0'));var path=require('path');var timeout=require(_0x57aa('0x1'));var express=require('express');var router=express[_0x57aa('0x2')]();var fs_extra=require(_0x57aa('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57aa('0x4'));var controller=require(_0x57aa('0x5'));router[_0x57aa('0x6')]('/',auth['isAuthenticated'](),controller[_0x57aa('0x7')]);router[_0x57aa('0x6')](_0x57aa('0x8'),auth[_0x57aa('0x9')](),controller[_0x57aa('0xa')]);router['get']('/:id',auth[_0x57aa('0x9')](),controller[_0x57aa('0xb')]);router[_0x57aa('0xc')]('/',auth[_0x57aa('0x9')](),controller[_0x57aa('0xd')]);router[_0x57aa('0xe')](_0x57aa('0xf'),auth[_0x57aa('0x9')](),controller[_0x57aa('0x10')]);router[_0x57aa('0x11')](_0x57aa('0xf'),auth['isAuthenticated'](),controller[_0x57aa('0x12')]);module[_0x57aa('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index db6619b..5668478 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(_0x404d64,_0x478980){var _0x36b9c9=function(_0x5ad582){while(--_0x5ad582){_0x404d64['push'](_0x404d64['shift']());}};_0x36b9c9(++_0x478980);}(_0x7a54,0x106));var _0x47a5=function(_0x578652,_0x42dcaf){_0x578652=_0x578652-0x0;var _0x31de4a=_0x7a54[_0x578652];return _0x31de4a;};'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(_0x4cd43a,_0x49740d){var _0x59dd22=function(_0x594f1a){while(--_0x594f1a){_0x4cd43a['push'](_0x4cd43a['shift']());}};_0x59dd22(++_0x49740d);}(_0x7a54,0x106));var _0x47a5=function(_0x2c38b0,_0x1c5ea6){_0x2c38b0=_0x2c38b0-0x0;var _0x1787c3=_0x7a54[_0x2c38b0];return _0x1787c3;};'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 8685431..0d36cec 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 _0x0102=['filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','then','findAll','rows','catch','params','rawAttributes','intersection','include','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','key','model','query','keys'];(function(_0x11cc4d,_0x535ad8){var _0x9b5720=function(_0x37f3e4){while(--_0x37f3e4){_0x11cc4d['push'](_0x11cc4d['shift']());}};_0x9b5720(++_0x535ad8);}(_0x0102,0x186));var _0x2010=function(_0x2b393f,_0x233dbc){_0x2b393f=_0x2b393f-0x0;var _0xa9d814=_0x0102[_0x2b393f];return _0xa9d814;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];function respondWithStatusCode(_0x3f307c,_0x3e8624){_0x3e8624=_0x3e8624||0xcc;return function(_0x388991){if(_0x388991){return _0x3f307c['sendStatus'](_0x3e8624);}return _0x3f307c['status'](_0x3e8624)[_0x2010('0x18')]();};}function respondWithResult(_0x385720,_0x2e8ec2){_0x2e8ec2=_0x2e8ec2||0xc8;return function(_0x10b587){if(_0x10b587){return _0x385720[_0x2010('0x19')](_0x2e8ec2)[_0x2010('0x1a')](_0x10b587);}};}function respondWithFilteredResult(_0x517ff4,_0x3195fa){return function(_0x136418){if(_0x136418){var _0x5ad412=typeof _0x3195fa[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x3195fa[_0x2010('0x1d')]===_0x2010('0x1c');var _0x2d0bf2=_0x136418[_0x2010('0x1e')];var _0x83cd35=_0x5ad412?0x0:_0x3195fa[_0x2010('0x1b')];var _0x309477=_0x5ad412?_0x136418['count']:_0x3195fa['offset']+_0x3195fa[_0x2010('0x1d')];var _0x38a15a;if(_0x309477>=_0x2d0bf2){_0x309477=_0x2d0bf2;_0x38a15a=0xc8;}else{_0x38a15a=0xce;}_0x517ff4[_0x2010('0x19')](_0x38a15a);return _0x517ff4[_0x2010('0x1f')]('Content-Range',_0x83cd35+'-'+_0x309477+'/'+_0x2d0bf2)['json'](_0x136418);}return null;};}function patchUpdates(_0x22c252){return function(_0x171e45){try{jsonpatch[_0x2010('0x20')](_0x171e45,_0x22c252,!![]);}catch(_0x26facc){return BPromise[_0x2010('0x21')](_0x26facc);}return _0x171e45[_0x2010('0x22')]();};}function saveUpdates(_0x4f621c,_0x3db13d){return function(_0x1cfa57){if(_0x1cfa57){return _0x1cfa57['update'](_0x4f621c)['then'](function(_0x50aecc){return _0x50aecc;});}return null;};}function removeEntity(_0x424453,_0x574719){return function(_0x277dcc){if(_0x277dcc){return _0x277dcc['destroy']()['then'](function(){_0x424453[_0x2010('0x19')](0xcc)[_0x2010('0x18')]();});}};}function handleEntityNotFound(_0x52b4fe,_0x99ebe0){return function(_0x4cff59){if(!_0x4cff59){_0x52b4fe[_0x2010('0x23')](0x194);}return _0x4cff59;};}function handleError(_0x27b425,_0x3929d9){_0x3929d9=_0x3929d9||0x1f4;return function(_0x3dcea4){logger[_0x2010('0x24')](_0x3dcea4[_0x2010('0x25')]);if(_0x3dcea4[_0x2010('0x26')]){delete _0x3dcea4[_0x2010('0x26')];}_0x27b425[_0x2010('0x19')](_0x3929d9)[_0x2010('0x27')](_0x3dcea4);};}exports[_0x2010('0x28')]=function(_0x2ebdbb,_0x499cbe){var _0x2a4691={},_0x52fe5e={},_0x5b52fb={'count':0x0,'rows':[]};var _0x147a5a=_[_0x2010('0x29')](db[_0x2010('0x2a')]['rawAttributes'],function(_0x554f66){return{'name':_0x554f66[_0x2010('0x2b')],'type':_0x554f66['type'][_0x2010('0x2c')]};});_0x52fe5e[_0x2010('0x2d')]=_['map'](_0x147a5a,_0x2010('0x26'));_0x52fe5e[_0x2010('0x2e')]=_[_0x2010('0x2f')](_0x2ebdbb[_0x2010('0x2e')]);_0x52fe5e[_0x2010('0x30')]=_['intersection'](_0x52fe5e[_0x2010('0x2d')],_0x52fe5e[_0x2010('0x2e')]);_0x2a4691[_0x2010('0x31')]=_['intersection'](_0x52fe5e['model'],qs[_0x2010('0x32')](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x32')]));_0x2a4691['attributes']=_0x2a4691['attributes'][_0x2010('0x33')]?_0x2a4691[_0x2010('0x31')]:_0x52fe5e[_0x2010('0x2d')];if(!_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x34')]('nolimit')){_0x2a4691['limit']=qs['limit'](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x1d')]);_0x2a4691[_0x2010('0x1b')]=qs['offset'](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x1b')]);}_0x2a4691[_0x2010('0x35')]=qs[_0x2010('0x36')](_0x2ebdbb['query'][_0x2010('0x36')]);_0x2a4691[_0x2010('0x37')]=qs[_0x2010('0x30')](_['pick'](_0x2ebdbb[_0x2010('0x2e')],_0x52fe5e['filters']),_0x147a5a);if(_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x38')]){_0x2a4691[_0x2010('0x37')]=_[_0x2010('0x39')](_0x2a4691[_0x2010('0x37')],{'$or':_[_0x2010('0x29')](_0x147a5a,function(_0x53c09e){if(_0x53c09e[_0x2010('0x3a')]!=='VIRTUAL'){var _0x3e5422={};_0x3e5422[_0x53c09e[_0x2010('0x26')]]={'$like':'%'+_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x38')]+'%'};return _0x3e5422;}})});}_0x2a4691=_[_0x2010('0x39')]({},_0x2a4691,_0x2ebdbb[_0x2010('0x3b')]);var _0x398f10={'where':_0x2a4691[_0x2010('0x37')]};return db[_0x2010('0x2a')][_0x2010('0x1e')](_0x398f10)[_0x2010('0x3c')](function(_0x2f37ca){_0x5b52fb[_0x2010('0x1e')]=_0x2f37ca;if(_0x2ebdbb[_0x2010('0x2e')]['includeAll']){_0x2a4691['include']=[{'all':!![]}];}return db[_0x2010('0x2a')][_0x2010('0x3d')](_0x2a4691);})[_0x2010('0x3c')](function(_0x35d631){_0x5b52fb[_0x2010('0x3e')]=_0x35d631;return _0x5b52fb;})[_0x2010('0x3c')](respondWithFilteredResult(_0x499cbe,_0x2a4691))[_0x2010('0x3f')](handleError(_0x499cbe,null));};exports['show']=function(_0x392576,_0x578645){var _0x27fd64={'raw':!![],'where':{'id':_0x392576[_0x2010('0x40')]['id']}},_0x3ff496={};_0x3ff496[_0x2010('0x2d')]=_[_0x2010('0x2f')](db['WhatsappQueueReport'][_0x2010('0x41')]);_0x3ff496[_0x2010('0x2e')]=_[_0x2010('0x2f')](_0x392576[_0x2010('0x2e')]);_0x3ff496['filters']=_[_0x2010('0x42')](_0x3ff496['model'],_0x3ff496['query']);_0x27fd64['attributes']=_[_0x2010('0x42')](_0x3ff496[_0x2010('0x2d')],qs[_0x2010('0x32')](_0x392576[_0x2010('0x2e')][_0x2010('0x32')]));_0x27fd64[_0x2010('0x31')]=_0x27fd64['attributes'][_0x2010('0x33')]?_0x27fd64[_0x2010('0x31')]:_0x3ff496[_0x2010('0x2d')];if(_0x392576['query']['includeAll']){_0x27fd64[_0x2010('0x43')]=[{'all':!![]}];}_0x27fd64=_['merge']({},_0x27fd64,_0x392576[_0x2010('0x3b')]);return db[_0x2010('0x2a')][_0x2010('0x44')](_0x27fd64)[_0x2010('0x3c')](handleEntityNotFound(_0x578645,null))['then'](respondWithResult(_0x578645,null))[_0x2010('0x3f')](handleError(_0x578645,null));};exports[_0x2010('0x45')]=function(_0x2e2703,_0x231db7){return db[_0x2010('0x2a')][_0x2010('0x45')](_0x2e2703['body'],{})[_0x2010('0x3c')](respondWithResult(_0x231db7,0xc9))[_0x2010('0x3f')](handleError(_0x231db7,null));};exports[_0x2010('0x46')]=function(_0x4dc0cf,_0x30e5d0){if(_0x4dc0cf[_0x2010('0x47')]['id']){delete _0x4dc0cf['body']['id'];}return db[_0x2010('0x2a')][_0x2010('0x44')]({'where':{'id':_0x4dc0cf[_0x2010('0x40')]['id']}})[_0x2010('0x3c')](handleEntityNotFound(_0x30e5d0,null))[_0x2010('0x3c')](saveUpdates(_0x4dc0cf[_0x2010('0x47')],null))[_0x2010('0x3c')](respondWithResult(_0x30e5d0,null))[_0x2010('0x3f')](handleError(_0x30e5d0,null));};exports['destroy']=function(_0x5258b9,_0xc9f070){return db[_0x2010('0x2a')]['find']({'where':{'id':_0x5258b9[_0x2010('0x40')]['id']}})[_0x2010('0x3c')](handleEntityNotFound(_0xc9f070,null))[_0x2010('0x3c')](removeEntity(_0xc9f070,null))[_0x2010('0x3f')](handleError(_0xc9f070,null));};exports[_0x2010('0x48')]=function(_0x506943,_0x5f4e98){return db[_0x2010('0x2a')][_0x2010('0x48')]()[_0x2010('0x3c')](respondWithResult(_0x5f4e98,null))[_0x2010('0x3f')](handleError(_0x5f4e98,null));}; \ No newline at end of file +var _0x63a5=['filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','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','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1e4d3f,_0x5bd6dc){var _0x2765b7=function(_0x7410d4){while(--_0x7410d4){_0x1e4d3f['push'](_0x1e4d3f['shift']());}};_0x2765b7(++_0x5bd6dc);}(_0x63a5,0x18e));var _0x563a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x63a5[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0x1682ee,_0x3642b3){return function(_0x173990){if(!_0x173990){_0x1682ee['sendStatus'](0x194);}return _0x173990;};}function handleError(_0x146ea0,_0x2b688e){_0x2b688e=_0x2b688e||0x1f4;return function(_0x2311f2){logger[_0x563a('0x28')](_0x2311f2[_0x563a('0x29')]);if(_0x2311f2[_0x563a('0x2a')]){delete _0x2311f2[_0x563a('0x2a')];}_0x146ea0[_0x563a('0x1a')](_0x2b688e)[_0x563a('0x2b')](_0x2311f2);};}exports[_0x563a('0x2c')]=function(_0x1a69d5,_0x24d1a8){var _0x1bdfb0={},_0x7696c2={},_0x579cb5={'count':0x0,'rows':[]};var _0x43379c=_[_0x563a('0x2d')](db[_0x563a('0x2e')]['rawAttributes'],function(_0x1e8d43){return{'name':_0x1e8d43[_0x563a('0x2f')],'type':_0x1e8d43[_0x563a('0x30')][_0x563a('0x31')]};});_0x7696c2[_0x563a('0x32')]=_[_0x563a('0x2d')](_0x43379c,_0x563a('0x2a'));_0x7696c2['query']=_[_0x563a('0x33')](_0x1a69d5[_0x563a('0x34')]);_0x7696c2[_0x563a('0x35')]=_[_0x563a('0x36')](_0x7696c2[_0x563a('0x32')],_0x7696c2['query']);_0x1bdfb0['attributes']=_['intersection'](_0x7696c2['model'],qs[_0x563a('0x37')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x37')]));_0x1bdfb0[_0x563a('0x38')]=_0x1bdfb0[_0x563a('0x38')][_0x563a('0x39')]?_0x1bdfb0['attributes']:_0x7696c2['model'];if(!_0x1a69d5[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1bdfb0[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x1e')]);_0x1bdfb0[_0x563a('0x1f')]=qs[_0x563a('0x1f')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x1f')]);}_0x1bdfb0[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x3d')]);_0x1bdfb0[_0x563a('0x3e')]=qs['filters'](_[_0x563a('0x3f')](_0x1a69d5[_0x563a('0x34')],_0x7696c2[_0x563a('0x35')]),_0x43379c);if(_0x1a69d5['query'][_0x563a('0x40')]){_0x1bdfb0['where']=_[_0x563a('0x41')](_0x1bdfb0[_0x563a('0x3e')],{'$or':_['map'](_0x43379c,function(_0x52e4a2){if(_0x52e4a2[_0x563a('0x30')]!=='VIRTUAL'){var _0x13b795={};_0x13b795[_0x52e4a2[_0x563a('0x2a')]]={'$like':'%'+_0x1a69d5[_0x563a('0x34')][_0x563a('0x40')]+'%'};return _0x13b795;}})});}_0x1bdfb0=_['merge']({},_0x1bdfb0,_0x1a69d5['options']);var _0x615d2e={'where':_0x1bdfb0['where']};return db[_0x563a('0x2e')][_0x563a('0x20')](_0x615d2e)[_0x563a('0x26')](function(_0x9c392c){_0x579cb5[_0x563a('0x20')]=_0x9c392c;if(_0x1a69d5[_0x563a('0x34')][_0x563a('0x42')]){_0x1bdfb0[_0x563a('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x563a('0x44')](_0x1bdfb0);})['then'](function(_0x20c142){_0x579cb5[_0x563a('0x45')]=_0x20c142;return _0x579cb5;})[_0x563a('0x26')](respondWithFilteredResult(_0x24d1a8,_0x1bdfb0))[_0x563a('0x46')](handleError(_0x24d1a8,null));};exports['show']=function(_0x4b3d38,_0x54ac1e){var _0x2221d4={'raw':!![],'where':{'id':_0x4b3d38[_0x563a('0x47')]['id']}},_0x1255da={};_0x1255da[_0x563a('0x32')]=_[_0x563a('0x33')](db[_0x563a('0x2e')][_0x563a('0x48')]);_0x1255da[_0x563a('0x34')]=_[_0x563a('0x33')](_0x4b3d38[_0x563a('0x34')]);_0x1255da[_0x563a('0x35')]=_[_0x563a('0x36')](_0x1255da[_0x563a('0x32')],_0x1255da[_0x563a('0x34')]);_0x2221d4[_0x563a('0x38')]=_[_0x563a('0x36')](_0x1255da[_0x563a('0x32')],qs[_0x563a('0x37')](_0x4b3d38[_0x563a('0x34')]['fields']));_0x2221d4['attributes']=_0x2221d4[_0x563a('0x38')][_0x563a('0x39')]?_0x2221d4[_0x563a('0x38')]:_0x1255da[_0x563a('0x32')];if(_0x4b3d38[_0x563a('0x34')][_0x563a('0x42')]){_0x2221d4[_0x563a('0x43')]=[{'all':!![]}];}_0x2221d4=_[_0x563a('0x41')]({},_0x2221d4,_0x4b3d38['options']);return db['WhatsappQueueReport'][_0x563a('0x49')](_0x2221d4)[_0x563a('0x26')](handleEntityNotFound(_0x54ac1e,null))[_0x563a('0x26')](respondWithResult(_0x54ac1e,null))[_0x563a('0x46')](handleError(_0x54ac1e,null));};exports[_0x563a('0x4a')]=function(_0x3f2c5d,_0x2689b5){return db[_0x563a('0x2e')]['create'](_0x3f2c5d[_0x563a('0x4b')],{})[_0x563a('0x26')](respondWithResult(_0x2689b5,0xc9))['catch'](handleError(_0x2689b5,null));};exports[_0x563a('0x25')]=function(_0x5a063a,_0x3ea787){if(_0x5a063a[_0x563a('0x4b')]['id']){delete _0x5a063a[_0x563a('0x4b')]['id'];}return db['WhatsappQueueReport'][_0x563a('0x49')]({'where':{'id':_0x5a063a[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3ea787,null))[_0x563a('0x26')](saveUpdates(_0x5a063a[_0x563a('0x4b')],null))[_0x563a('0x26')](respondWithResult(_0x3ea787,null))[_0x563a('0x46')](handleError(_0x3ea787,null));};exports[_0x563a('0x27')]=function(_0x277d54,_0x2008d4){return db[_0x563a('0x2e')][_0x563a('0x49')]({'where':{'id':_0x277d54[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2008d4,null))['then'](removeEntity(_0x2008d4,null))[_0x563a('0x46')](handleError(_0x2008d4,null));};exports[_0x563a('0x4c')]=function(_0x143daa,_0x4a807f){return db['WhatsappQueueReport'][_0x563a('0x4c')]()[_0x563a('0x26')](respondWithResult(_0x4a807f,null))['catch'](handleError(_0x4a807f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 43b5179..d035038 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 _0x0096=['request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x9de574,_0x4ae3d7){var _0x1d3771=function(_0x129659){while(--_0x129659){_0x9de574['push'](_0x9de574['shift']());}};_0x1d3771(++_0x4ae3d7);}(_0x0096,0x79));var _0x6009=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0096[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x6009('0x0'));var util=require(_0x6009('0x1'));var logger=require(_0x6009('0x2'))('api');var moment=require(_0x6009('0x3'));var BPromise=require(_0x6009('0x4'));var rp=require(_0x6009('0x5'));var fs=require('fs');var path=require(_0x6009('0x6'));var rimraf=require('rimraf');var config=require(_0x6009('0x7'));var attributes=require(_0x6009('0x8'));module[_0x6009('0x9')]=function(_0x215e90,_0x4d1eb5){return _0x215e90[_0x6009('0xa')](_0x6009('0xb'),attributes,{'tableName':_0x6009('0xc'),'paranoid':![],'indexes':[{'name':_0x6009('0xd'),'fields':[_0x6009('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66b9=['bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api'];(function(_0x567247,_0x40a9cb){var _0x23fcfd=function(_0x55eed9){while(--_0x55eed9){_0x567247['push'](_0x567247['shift']());}};_0x23fcfd(++_0x40a9cb);}(_0x66b9,0xbd));var _0x966b=function(_0x2a4bbb,_0x54c1aa){_0x2a4bbb=_0x2a4bbb-0x0;var _0x2b853e=_0x66b9[_0x2a4bbb];return _0x2b853e;};'use strict';var _=require('lodash');var util=require(_0x966b('0x0'));var logger=require(_0x966b('0x1'))(_0x966b('0x2'));var moment=require('moment');var BPromise=require(_0x966b('0x3'));var rp=require(_0x966b('0x4'));var fs=require('fs');var path=require(_0x966b('0x5'));var rimraf=require('rimraf');var config=require(_0x966b('0x6'));var attributes=require(_0x966b('0x7'));module[_0x966b('0x8')]=function(_0xaae495,_0x47c3db){return _0xaae495['define'](_0x966b('0x9'),attributes,{'tableName':_0x966b('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x966b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 96cf59a..fe905d7 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 _0x013f=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x37c219,_0x16d29c){var _0x52b594=function(_0x5d64eb){while(--_0x5d64eb){_0x37c219['push'](_0x37c219['shift']());}};_0x52b594(++_0x16d29c);}(_0x013f,0x1a0));var _0xf013=function(_0x3cd215,_0x322fe8){_0x3cd215=_0x3cd215-0x0;var _0x43452d=_0x013f[_0x3cd215];return _0x43452d;};'use strict';var _=require('lodash');var util=require(_0xf013('0x0'));var moment=require(_0xf013('0x1'));var BPromise=require(_0xf013('0x2'));var rs=require(_0xf013('0x3'));var fs=require('fs');var Redis=require(_0xf013('0x4'));var db=require(_0xf013('0x5'))['db'];var utils=require(_0xf013('0x6'));var logger=require('../../config/logger')(_0xf013('0x7'));var config=require(_0xf013('0x8'));var jayson=require(_0xf013('0x9'));var client=jayson[_0xf013('0xa')][_0xf013('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22b414,_0x2aa029,_0x1c5217){return new BPromise(function(_0x17a4e9,_0x5ca027){return client[_0xf013('0xc')](_0x22b414,_0x1c5217)[_0xf013('0xd')](function(_0x52ed10){logger['info'](_0xf013('0xe'),_0x2aa029,_0xf013('0xf'));logger[_0xf013('0x10')](_0xf013('0x11'),_0x2aa029,_0xf013('0xf'),JSON[_0xf013('0x12')](_0x52ed10));if(_0x52ed10[_0xf013('0x13')]){if(_0x52ed10[_0xf013('0x13')][_0xf013('0x14')]===0x1f4){logger[_0xf013('0x13')](_0xf013('0xe'),_0x2aa029,_0x52ed10['error'][_0xf013('0x15')]);return _0x5ca027(_0x52ed10[_0xf013('0x13')]['message']);}logger[_0xf013('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2aa029,_0x52ed10[_0xf013('0x13')][_0xf013('0x15')]);return _0x17a4e9(_0x52ed10[_0xf013('0x13')]['message']);}else{logger[_0xf013('0x16')](_0xf013('0xe'),_0x2aa029,'request\x20sent');_0x17a4e9(_0x52ed10[_0xf013('0x17')][_0xf013('0x15')]);}})['catch'](function(_0x1fa8d7){logger[_0xf013('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2aa029,_0x1fa8d7);_0x5ca027(_0x1fa8d7);});});}exports[_0xf013('0x18')]=function(_0xbe5432){var _0x5b8199=this;return new Promise(function(_0x2ffd5a,_0x31ee1f){return db[_0xf013('0x19')][_0xf013('0x1a')](_0xbe5432[_0xf013('0x1b')],{'raw':_0xbe5432[_0xf013('0x1c')]?_0xbe5432['options'][_0xf013('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x15ef7c){logger[_0xf013('0x16')](_0xf013('0x18'),_0xbe5432);logger['debug'](_0xf013('0x18'),_0xbe5432,JSON[_0xf013('0x12')](_0x15ef7c));_0x2ffd5a(_0x15ef7c);})['catch'](function(_0x3e5ea9){logger[_0xf013('0x13')]('CreateWhatsappQueueReport',_0x3e5ea9[_0xf013('0x15')],_0xbe5432);_0x31ee1f(_0x5b8199[_0xf013('0x13')](0x1f4,_0x3e5ea9[_0xf013('0x15')]));});});};exports[_0xf013('0x1e')]=function(_0x37ad38){var _0x1e3203=this;return new Promise(function(_0x5dc7cf,_0x24db20){return db[_0xf013('0x19')][_0xf013('0x1f')](_0x37ad38[_0xf013('0x1b')],{'raw':_0x37ad38[_0xf013('0x1c')]?_0x37ad38['options'][_0xf013('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37ad38['options']?_0x37ad38[_0xf013('0x1c')][_0xf013('0x20')]||null:null,'attributes':_0x37ad38[_0xf013('0x1c')]?_0x37ad38[_0xf013('0x1c')][_0xf013('0x21')]||null:null,'limit':_0x37ad38['options']?_0x37ad38[_0xf013('0x1c')][_0xf013('0x22')]||null:null})[_0xf013('0xd')](function(_0xcaa234){logger['info'](_0xf013('0x1e'),_0x37ad38);logger[_0xf013('0x10')]('UpdateWhatsappQueueReport',_0x37ad38,JSON[_0xf013('0x12')](_0xcaa234));_0x5dc7cf(_0xcaa234);})[_0xf013('0x23')](function(_0xabd253){logger[_0xf013('0x13')](_0xf013('0x1e'),_0xabd253[_0xf013('0x15')],_0x37ad38);_0x24db20(_0x1e3203['error'](0x1f4,_0xabd253['message']));});});}; \ No newline at end of file +var _0xc7c7=['request','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','then','stringify','update','attributes','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x4a87a5,_0x17f014){var _0x50ad0f=function(_0x346843){while(--_0x346843){_0x4a87a5['push'](_0x4a87a5['shift']());}};_0x50ad0f(++_0x17f014);}(_0xc7c7,0xe6));var _0x7c7c=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc7c7[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x7c7c('0x0'));var util=require(_0x7c7c('0x1'));var moment=require('moment');var BPromise=require(_0x7c7c('0x2'));var rs=require(_0x7c7c('0x3'));var fs=require('fs');var Redis=require(_0x7c7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c7c('0x5'));var logger=require(_0x7c7c('0x6'))('rpc');var config=require(_0x7c7c('0x7'));var jayson=require(_0x7c7c('0x8'));var client=jayson['client'][_0x7c7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3af9e9,_0x4af037,_0x5706de){return new BPromise(function(_0x1dd348,_0x2913b1){return client[_0x7c7c('0xa')](_0x3af9e9,_0x5706de)['then'](function(_0xa2f806){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4af037,'request\x20sent');logger['debug'](_0x7c7c('0xb'),_0x4af037,_0x7c7c('0xc'),JSON['stringify'](_0xa2f806));if(_0xa2f806[_0x7c7c('0xd')]){if(_0xa2f806['error'][_0x7c7c('0xe')]===0x1f4){logger[_0x7c7c('0xd')](_0x7c7c('0xf'),_0x4af037,_0xa2f806[_0x7c7c('0xd')][_0x7c7c('0x10')]);return _0x2913b1(_0xa2f806['error'][_0x7c7c('0x10')]);}logger[_0x7c7c('0xd')](_0x7c7c('0xf'),_0x4af037,_0xa2f806[_0x7c7c('0xd')]['message']);return _0x1dd348(_0xa2f806[_0x7c7c('0xd')]['message']);}else{logger[_0x7c7c('0x11')](_0x7c7c('0xf'),_0x4af037,'request\x20sent');_0x1dd348(_0xa2f806[_0x7c7c('0x12')][_0x7c7c('0x10')]);}})[_0x7c7c('0x13')](function(_0x7b163f){logger[_0x7c7c('0xd')](_0x7c7c('0xf'),_0x4af037,_0x7b163f);_0x2913b1(_0x7b163f);});});}exports[_0x7c7c('0x14')]=function(_0x24ad5b){var _0x2f918d=this;return new Promise(function(_0x17a1cf,_0x3f3243){return db[_0x7c7c('0x15')]['create'](_0x24ad5b[_0x7c7c('0x16')],{'raw':_0x24ad5b[_0x7c7c('0x17')]?_0x24ad5b[_0x7c7c('0x17')][_0x7c7c('0x18')]===undefined?!![]:![]:!![]})[_0x7c7c('0x19')](function(_0x31b387){logger[_0x7c7c('0x11')]('CreateWhatsappQueueReport',_0x24ad5b);logger['debug']('CreateWhatsappQueueReport',_0x24ad5b,JSON[_0x7c7c('0x1a')](_0x31b387));_0x17a1cf(_0x31b387);})[_0x7c7c('0x13')](function(_0x22cee9){logger[_0x7c7c('0xd')](_0x7c7c('0x14'),_0x22cee9[_0x7c7c('0x10')],_0x24ad5b);_0x3f3243(_0x2f918d['error'](0x1f4,_0x22cee9[_0x7c7c('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1d1fcd){var _0x17abad=this;return new Promise(function(_0x2edb1f,_0x3739bb){return db[_0x7c7c('0x15')][_0x7c7c('0x1b')](_0x1d1fcd[_0x7c7c('0x16')],{'raw':_0x1d1fcd[_0x7c7c('0x17')]?_0x1d1fcd[_0x7c7c('0x17')][_0x7c7c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d1fcd[_0x7c7c('0x17')]?_0x1d1fcd[_0x7c7c('0x17')]['where']||null:null,'attributes':_0x1d1fcd[_0x7c7c('0x17')]?_0x1d1fcd[_0x7c7c('0x17')][_0x7c7c('0x1c')]||null:null,'limit':_0x1d1fcd[_0x7c7c('0x17')]?_0x1d1fcd[_0x7c7c('0x17')]['limit']||null:null})[_0x7c7c('0x19')](function(_0x1b9c38){logger['info'](_0x7c7c('0x1d'),_0x1d1fcd);logger['debug']('UpdateWhatsappQueueReport',_0x1d1fcd,JSON[_0x7c7c('0x1a')](_0x1b9c38));_0x2edb1f(_0x1b9c38);})['catch'](function(_0xa352be){logger[_0x7c7c('0xd')](_0x7c7c('0x1d'),_0xa352be[_0x7c7c('0x10')],_0x1d1fcd);_0x3739bb(_0x17abad[_0x7c7c('0xd')](0x1f4,_0xa352be['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index fe50e5a..55176cd 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 _0x8efd=['update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put'];(function(_0x32b1b4,_0x11a258){var _0x768d0d=function(_0x474d36){while(--_0x474d36){_0x32b1b4['push'](_0x32b1b4['shift']());}};_0x768d0d(++_0x11a258);}(_0x8efd,0x1bb));var _0xd8ef=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8efd[_0x46698a];return _0x356db0;};'use strict';var multer=require('multer');var util=require(_0xd8ef('0x0'));var path=require(_0xd8ef('0x1'));var timeout=require(_0xd8ef('0x2'));var express=require(_0xd8ef('0x3'));var router=express[_0xd8ef('0x4')]();var fs_extra=require(_0xd8ef('0x5'));var auth=require(_0xd8ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd8ef('0x7'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xd8ef('0x8')](),controller[_0xd8ef('0x9')]);router[_0xd8ef('0xa')](_0xd8ef('0xb'),auth[_0xd8ef('0x8')](),controller[_0xd8ef('0xc')]);router['get'](_0xd8ef('0xd'),auth[_0xd8ef('0x8')](),controller['show']);router[_0xd8ef('0xe')]('/',auth['isAuthenticated'](),controller[_0xd8ef('0xf')]);router[_0xd8ef('0x10')](_0xd8ef('0xd'),auth[_0xd8ef('0x8')](),controller[_0xd8ef('0x11')]);router['delete']('/:id',auth[_0xd8ef('0x8')](),controller[_0xd8ef('0x12')]);module[_0xd8ef('0x13')]=router; \ No newline at end of file +var _0x25e2=['exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x344110,_0x373ee3){var _0x14a81e=function(_0xe81ec0){while(--_0xe81ec0){_0x344110['push'](_0x344110['shift']());}};_0x14a81e(++_0x373ee3);}(_0x25e2,0xf1));var _0x225e=function(_0x8f3687,_0x28e318){_0x8f3687=_0x8f3687-0x0;var _0x161847=_0x25e2[_0x8f3687];return _0x161847;};'use strict';var multer=require('multer');var util=require(_0x225e('0x0'));var path=require('path');var timeout=require(_0x225e('0x1'));var express=require(_0x225e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x225e('0x3'));var config=require(_0x225e('0x4'));var controller=require(_0x225e('0x5'));router[_0x225e('0x6')]('/',auth[_0x225e('0x7')](),controller[_0x225e('0x8')]);router[_0x225e('0x6')](_0x225e('0x9'),auth[_0x225e('0x7')](),controller['describe']);router[_0x225e('0x6')](_0x225e('0xa'),auth[_0x225e('0x7')](),controller[_0x225e('0xb')]);router[_0x225e('0xc')]('/',auth[_0x225e('0x7')](),controller[_0x225e('0xd')]);router[_0x225e('0xe')](_0x225e('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x225e('0xa'),auth[_0x225e('0x7')](),controller['destroy']);module[_0x225e('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index ed382a3..1220335 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 _0xbd9f=['agent','DATE','ENUM'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbd9f,0x98));var _0xfbd9=function(_0x3781b0,_0x24928b){_0x3781b0=_0x3781b0-0x0;var _0x4113c9=_0xbd9f[_0x3781b0];return _0x4113c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfbd9('0x0')]('account',_0xfbd9('0x1'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfbd9('0x2')]}}; \ No newline at end of file +var _0x505d=['agent','queue','STRING','ENUM','account'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x505d,0x93));var _0xd505=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x505d[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd505('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xd505('0x1')](_0xd505('0x2'),_0xd505('0x3'),_0xd505('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5401e78..b361c9b 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 _0xe451=['catch','show','params','includeAll','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows'];(function(_0x3fb58d,_0x3d4355){var _0x171fcb=function(_0x4d7704){while(--_0x4d7704){_0x3fb58d['push'](_0x3fb58d['shift']());}};_0x171fcb(++_0x3d4355);}(_0xe451,0x12c));var _0x1e45=function(_0x1541a3,_0xec95b6){_0x1541a3=_0x1541a3-0x0;var _0x5be16c=_0xe451[_0x1541a3];return _0x5be16c;};'use strict';var emlformat=require(_0x1e45('0x0'));var rimraf=require(_0x1e45('0x1'));var zipdir=require(_0x1e45('0x2'));var jsonpatch=require(_0x1e45('0x3'));var rp=require(_0x1e45('0x4'));var moment=require(_0x1e45('0x5'));var BPromise=require(_0x1e45('0x6'));var Mustache=require(_0x1e45('0x7'));var util=require('util');var path=require(_0x1e45('0x8'));var sox=require(_0x1e45('0x9'));var csv=require(_0x1e45('0xa'));var ejs=require(_0x1e45('0xb'));var fs=require('fs');var fs_extra=require(_0x1e45('0xc'));var _=require('lodash');var squel=require(_0x1e45('0xd'));var crypto=require(_0x1e45('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1e45('0xf'));var toCsv=require(_0x1e45('0xa'));var querystring=require('querystring');var Papa=require(_0x1e45('0x10'));var Redis=require(_0x1e45('0x11'));var authService=require(_0x1e45('0x12'));var qs=require(_0x1e45('0x13'));var as=require(_0x1e45('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e45('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1e45('0x16'));var licenseUtil=require(_0x1e45('0x17'));var db=require(_0x1e45('0x18'))['db'];function respondWithStatusCode(_0x56d814,_0x169127){_0x169127=_0x169127||0xcc;return function(_0xa4388e){if(_0xa4388e){return _0x56d814[_0x1e45('0x19')](_0x169127);}return _0x56d814[_0x1e45('0x1a')](_0x169127)[_0x1e45('0x1b')]();};}function respondWithResult(_0x320edb,_0x4a155c){_0x4a155c=_0x4a155c||0xc8;return function(_0xfb0d8c){if(_0xfb0d8c){return _0x320edb['status'](_0x4a155c)[_0x1e45('0x1c')](_0xfb0d8c);}};}function respondWithFilteredResult(_0x5e994a,_0x25650e){return function(_0x5340f4){if(_0x5340f4){var _0x1793f0=typeof _0x25650e[_0x1e45('0x1d')]==='undefined'&&typeof _0x25650e[_0x1e45('0x1e')]==='undefined';var _0x3fb4ed=_0x5340f4[_0x1e45('0x1f')];var _0x51b079=_0x1793f0?0x0:_0x25650e['offset'];var _0x1f9734=_0x1793f0?_0x5340f4[_0x1e45('0x1f')]:_0x25650e['offset']+_0x25650e['limit'];var _0x4cf258;if(_0x1f9734>=_0x3fb4ed){_0x1f9734=_0x3fb4ed;_0x4cf258=0xc8;}else{_0x4cf258=0xce;}_0x5e994a[_0x1e45('0x1a')](_0x4cf258);return _0x5e994a[_0x1e45('0x20')](_0x1e45('0x21'),_0x51b079+'-'+_0x1f9734+'/'+_0x3fb4ed)['json'](_0x5340f4);}return null;};}function patchUpdates(_0x5da6b6){return function(_0x4a14f9){try{jsonpatch[_0x1e45('0x22')](_0x4a14f9,_0x5da6b6,!![]);}catch(_0x115f51){return BPromise['reject'](_0x115f51);}return _0x4a14f9[_0x1e45('0x23')]();};}function saveUpdates(_0x2962cc,_0x351cd9){return function(_0x3bd33a){if(_0x3bd33a){return _0x3bd33a['update'](_0x2962cc)[_0x1e45('0x24')](function(_0x238b81){return _0x238b81;});}return null;};}function removeEntity(_0x32dcb5,_0x4f4d4c){return function(_0x2896e4){if(_0x2896e4){return _0x2896e4['destroy']()[_0x1e45('0x24')](function(){_0x32dcb5[_0x1e45('0x1a')](0xcc)[_0x1e45('0x1b')]();});}};}function handleEntityNotFound(_0xac963,_0x100559){return function(_0x22809c){if(!_0x22809c){_0xac963[_0x1e45('0x19')](0x194);}return _0x22809c;};}function handleError(_0x2b77e9,_0x26989f){_0x26989f=_0x26989f||0x1f4;return function(_0x131d77){logger[_0x1e45('0x25')](_0x131d77[_0x1e45('0x26')]);if(_0x131d77['name']){delete _0x131d77[_0x1e45('0x27')];}_0x2b77e9['status'](_0x26989f)[_0x1e45('0x28')](_0x131d77);};}exports[_0x1e45('0x29')]=function(_0x2c64c4,_0x3cab59){var _0x4b3c37={},_0x5d6459={},_0x2f48e6={'count':0x0,'rows':[]};var _0x3ede5b=_[_0x1e45('0x2a')](db[_0x1e45('0x2b')][_0x1e45('0x2c')],function(_0x47f705){return{'name':_0x47f705[_0x1e45('0x2d')],'type':_0x47f705['type'][_0x1e45('0x2e')]};});_0x5d6459[_0x1e45('0x2f')]=_['map'](_0x3ede5b,_0x1e45('0x27'));_0x5d6459['query']=_[_0x1e45('0x30')](_0x2c64c4[_0x1e45('0x31')]);_0x5d6459[_0x1e45('0x32')]=_[_0x1e45('0x33')](_0x5d6459[_0x1e45('0x2f')],_0x5d6459['query']);_0x4b3c37[_0x1e45('0x34')]=_[_0x1e45('0x33')](_0x5d6459['model'],qs[_0x1e45('0x35')](_0x2c64c4[_0x1e45('0x31')][_0x1e45('0x35')]));_0x4b3c37['attributes']=_0x4b3c37[_0x1e45('0x34')]['length']?_0x4b3c37[_0x1e45('0x34')]:_0x5d6459[_0x1e45('0x2f')];if(!_0x2c64c4['query']['hasOwnProperty']('nolimit')){_0x4b3c37[_0x1e45('0x1e')]=qs[_0x1e45('0x1e')](_0x2c64c4[_0x1e45('0x31')]['limit']);_0x4b3c37[_0x1e45('0x1d')]=qs[_0x1e45('0x1d')](_0x2c64c4[_0x1e45('0x31')]['offset']);}_0x4b3c37['order']=qs[_0x1e45('0x36')](_0x2c64c4[_0x1e45('0x31')][_0x1e45('0x36')]);_0x4b3c37[_0x1e45('0x37')]=qs['filters'](_[_0x1e45('0x38')](_0x2c64c4[_0x1e45('0x31')],_0x5d6459[_0x1e45('0x32')]),_0x3ede5b);if(_0x2c64c4[_0x1e45('0x31')][_0x1e45('0x39')]){_0x4b3c37[_0x1e45('0x37')]=_[_0x1e45('0x3a')](_0x4b3c37[_0x1e45('0x37')],{'$or':_['map'](_0x3ede5b,function(_0x4bbf4f){if(_0x4bbf4f[_0x1e45('0x3b')]!==_0x1e45('0x3c')){var _0x291612={};_0x291612[_0x4bbf4f[_0x1e45('0x27')]]={'$like':'%'+_0x2c64c4[_0x1e45('0x31')][_0x1e45('0x39')]+'%'};return _0x291612;}})});}_0x4b3c37=_[_0x1e45('0x3a')]({},_0x4b3c37,_0x2c64c4[_0x1e45('0x3d')]);var _0x3d7381={'where':_0x4b3c37[_0x1e45('0x37')]};return db[_0x1e45('0x2b')][_0x1e45('0x1f')](_0x3d7381)['then'](function(_0x71ecb1){_0x2f48e6[_0x1e45('0x1f')]=_0x71ecb1;if(_0x2c64c4[_0x1e45('0x31')]['includeAll']){_0x4b3c37[_0x1e45('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x1e45('0x3f')](_0x4b3c37);})[_0x1e45('0x24')](function(_0x313083){_0x2f48e6[_0x1e45('0x40')]=_0x313083;return _0x2f48e6;})[_0x1e45('0x24')](respondWithFilteredResult(_0x3cab59,_0x4b3c37))[_0x1e45('0x41')](handleError(_0x3cab59,null));};exports[_0x1e45('0x42')]=function(_0x2f2038,_0xe43e7){var _0x38c6b5={'raw':!![],'where':{'id':_0x2f2038[_0x1e45('0x43')]['id']}},_0x462123={};_0x462123[_0x1e45('0x2f')]=_[_0x1e45('0x30')](db[_0x1e45('0x2b')]['rawAttributes']);_0x462123[_0x1e45('0x31')]=_[_0x1e45('0x30')](_0x2f2038['query']);_0x462123['filters']=_[_0x1e45('0x33')](_0x462123['model'],_0x462123['query']);_0x38c6b5[_0x1e45('0x34')]=_[_0x1e45('0x33')](_0x462123[_0x1e45('0x2f')],qs[_0x1e45('0x35')](_0x2f2038[_0x1e45('0x31')]['fields']));_0x38c6b5[_0x1e45('0x34')]=_0x38c6b5['attributes']['length']?_0x38c6b5[_0x1e45('0x34')]:_0x462123['model'];if(_0x2f2038[_0x1e45('0x31')][_0x1e45('0x44')]){_0x38c6b5[_0x1e45('0x3e')]=[{'all':!![]}];}_0x38c6b5=_['merge']({},_0x38c6b5,_0x2f2038[_0x1e45('0x3d')]);return db[_0x1e45('0x2b')][_0x1e45('0x45')](_0x38c6b5)[_0x1e45('0x24')](handleEntityNotFound(_0xe43e7,null))['then'](respondWithResult(_0xe43e7,null))[_0x1e45('0x41')](handleError(_0xe43e7,null));};exports['create']=function(_0x2dc2cb,_0x14661c){return db[_0x1e45('0x2b')]['create'](_0x2dc2cb[_0x1e45('0x46')],{})['then'](respondWithResult(_0x14661c,0xc9))['catch'](handleError(_0x14661c,null));};exports['update']=function(_0x461e5d,_0x5d2af0){if(_0x461e5d[_0x1e45('0x46')]['id']){delete _0x461e5d[_0x1e45('0x46')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x461e5d[_0x1e45('0x43')]['id']}})[_0x1e45('0x24')](handleEntityNotFound(_0x5d2af0,null))['then'](saveUpdates(_0x461e5d['body'],null))['then'](respondWithResult(_0x5d2af0,null))[_0x1e45('0x41')](handleError(_0x5d2af0,null));};exports[_0x1e45('0x47')]=function(_0x5de540,_0x32feae){return db[_0x1e45('0x2b')][_0x1e45('0x45')]({'where':{'id':_0x5de540['params']['id']}})[_0x1e45('0x24')](handleEntityNotFound(_0x32feae,null))[_0x1e45('0x24')](removeEntity(_0x32feae,null))['catch'](handleError(_0x32feae,null));};exports[_0x1e45('0x48')]=function(_0x3e8df9,_0x5b9cbd){return db[_0x1e45('0x2b')]['describe']()[_0x1e45('0x24')](respondWithResult(_0x5b9cbd,null))['catch'](handleError(_0x5b9cbd,null));}; \ No newline at end of file +var _0x43c2=['type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','send','WhatsappTransferReport','fieldName'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x43c2,0xbc));var _0x243c=function(_0x5268d2,_0xe7529e){_0x5268d2=_0x5268d2-0x0;var _0x30b2b1=_0x43c2[_0x5268d2];return _0x30b2b1;};'use strict';var emlformat=require(_0x243c('0x0'));var rimraf=require(_0x243c('0x1'));var zipdir=require(_0x243c('0x2'));var jsonpatch=require(_0x243c('0x3'));var rp=require(_0x243c('0x4'));var moment=require(_0x243c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x243c('0x6'));var util=require(_0x243c('0x7'));var path=require(_0x243c('0x8'));var sox=require(_0x243c('0x9'));var csv=require(_0x243c('0xa'));var ejs=require(_0x243c('0xb'));var fs=require('fs');var fs_extra=require(_0x243c('0xc'));var _=require(_0x243c('0xd'));var squel=require(_0x243c('0xe'));var crypto=require(_0x243c('0xf'));var jsforce=require(_0x243c('0x10'));var deskjs=require(_0x243c('0x11'));var toCsv=require(_0x243c('0xa'));var querystring=require(_0x243c('0x12'));var Papa=require(_0x243c('0x13'));var Redis=require(_0x243c('0x14'));var authService=require(_0x243c('0x15'));var qs=require(_0x243c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x243c('0x17'));var logger=require(_0x243c('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x243c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x243c('0x1a'))['db'];function respondWithStatusCode(_0xee82ee,_0x251ce4){_0x251ce4=_0x251ce4||0xcc;return function(_0x20b931){if(_0x20b931){return _0xee82ee[_0x243c('0x1b')](_0x251ce4);}return _0xee82ee[_0x243c('0x1c')](_0x251ce4)[_0x243c('0x1d')]();};}function respondWithResult(_0x1a99b6,_0x328905){_0x328905=_0x328905||0xc8;return function(_0x2f41fa){if(_0x2f41fa){return _0x1a99b6[_0x243c('0x1c')](_0x328905)[_0x243c('0x1e')](_0x2f41fa);}};}function respondWithFilteredResult(_0x1094a3,_0x12650b){return function(_0xfac414){if(_0xfac414){var _0x1315f2=typeof _0x12650b[_0x243c('0x1f')]===_0x243c('0x20')&&typeof _0x12650b[_0x243c('0x21')]===_0x243c('0x20');var _0x409e70=_0xfac414[_0x243c('0x22')];var _0xf54693=_0x1315f2?0x0:_0x12650b[_0x243c('0x1f')];var _0x4d580a=_0x1315f2?_0xfac414[_0x243c('0x22')]:_0x12650b[_0x243c('0x1f')]+_0x12650b[_0x243c('0x21')];var _0x76db8a;if(_0x4d580a>=_0x409e70){_0x4d580a=_0x409e70;_0x76db8a=0xc8;}else{_0x76db8a=0xce;}_0x1094a3[_0x243c('0x1c')](_0x76db8a);return _0x1094a3['set'](_0x243c('0x23'),_0xf54693+'-'+_0x4d580a+'/'+_0x409e70)[_0x243c('0x1e')](_0xfac414);}return null;};}function patchUpdates(_0xbf32b9){return function(_0x168a2c){try{jsonpatch[_0x243c('0x24')](_0x168a2c,_0xbf32b9,!![]);}catch(_0x432cc9){return BPromise['reject'](_0x432cc9);}return _0x168a2c[_0x243c('0x25')]();};}function saveUpdates(_0xa624ae,_0x542c5c){return function(_0xfbc73e){if(_0xfbc73e){return _0xfbc73e[_0x243c('0x26')](_0xa624ae)[_0x243c('0x27')](function(_0x5701ae){return _0x5701ae;});}return null;};}function removeEntity(_0x10139e,_0x5a56e3){return function(_0xb1ad40){if(_0xb1ad40){return _0xb1ad40[_0x243c('0x28')]()[_0x243c('0x27')](function(){_0x10139e['status'](0xcc)[_0x243c('0x1d')]();});}};}function handleEntityNotFound(_0x3fd89a,_0x16aedd){return function(_0x433c3d){if(!_0x433c3d){_0x3fd89a[_0x243c('0x1b')](0x194);}return _0x433c3d;};}function handleError(_0x46fad3,_0x3276e9){_0x3276e9=_0x3276e9||0x1f4;return function(_0x56193e){logger[_0x243c('0x29')](_0x56193e[_0x243c('0x2a')]);if(_0x56193e['name']){delete _0x56193e['name'];}_0x46fad3[_0x243c('0x1c')](_0x3276e9)[_0x243c('0x2b')](_0x56193e);};}exports['index']=function(_0x3b777f,_0xf8bf72){var _0x35ccbd={},_0x38ecf5={},_0x2d1c29={'count':0x0,'rows':[]};var _0x172bfc=_['map'](db[_0x243c('0x2c')]['rawAttributes'],function(_0x42ff11){return{'name':_0x42ff11[_0x243c('0x2d')],'type':_0x42ff11[_0x243c('0x2e')][_0x243c('0x2f')]};});_0x38ecf5[_0x243c('0x30')]=_[_0x243c('0x31')](_0x172bfc,_0x243c('0x32'));_0x38ecf5[_0x243c('0x33')]=_['keys'](_0x3b777f[_0x243c('0x33')]);_0x38ecf5[_0x243c('0x34')]=_['intersection'](_0x38ecf5[_0x243c('0x30')],_0x38ecf5[_0x243c('0x33')]);_0x35ccbd[_0x243c('0x35')]=_[_0x243c('0x36')](_0x38ecf5[_0x243c('0x30')],qs['fields'](_0x3b777f[_0x243c('0x33')][_0x243c('0x37')]));_0x35ccbd['attributes']=_0x35ccbd['attributes'][_0x243c('0x38')]?_0x35ccbd[_0x243c('0x35')]:_0x38ecf5[_0x243c('0x30')];if(!_0x3b777f[_0x243c('0x33')][_0x243c('0x39')]('nolimit')){_0x35ccbd[_0x243c('0x21')]=qs['limit'](_0x3b777f[_0x243c('0x33')][_0x243c('0x21')]);_0x35ccbd[_0x243c('0x1f')]=qs[_0x243c('0x1f')](_0x3b777f[_0x243c('0x33')][_0x243c('0x1f')]);}_0x35ccbd[_0x243c('0x3a')]=qs['sort'](_0x3b777f[_0x243c('0x33')][_0x243c('0x3b')]);_0x35ccbd['where']=qs[_0x243c('0x34')](_[_0x243c('0x3c')](_0x3b777f[_0x243c('0x33')],_0x38ecf5[_0x243c('0x34')]),_0x172bfc);if(_0x3b777f['query'][_0x243c('0x3d')]){_0x35ccbd[_0x243c('0x3e')]=_['merge'](_0x35ccbd[_0x243c('0x3e')],{'$or':_[_0x243c('0x31')](_0x172bfc,function(_0x347c62){if(_0x347c62[_0x243c('0x2e')]!==_0x243c('0x3f')){var _0x3c59c5={};_0x3c59c5[_0x347c62[_0x243c('0x32')]]={'$like':'%'+_0x3b777f[_0x243c('0x33')][_0x243c('0x3d')]+'%'};return _0x3c59c5;}})});}_0x35ccbd=_[_0x243c('0x40')]({},_0x35ccbd,_0x3b777f[_0x243c('0x41')]);var _0x22395a={'where':_0x35ccbd['where']};return db[_0x243c('0x2c')][_0x243c('0x22')](_0x22395a)[_0x243c('0x27')](function(_0x25deb0){_0x2d1c29[_0x243c('0x22')]=_0x25deb0;if(_0x3b777f[_0x243c('0x33')][_0x243c('0x42')]){_0x35ccbd[_0x243c('0x43')]=[{'all':!![]}];}return db[_0x243c('0x2c')][_0x243c('0x44')](_0x35ccbd);})[_0x243c('0x27')](function(_0x344cbe){_0x2d1c29[_0x243c('0x45')]=_0x344cbe;return _0x2d1c29;})[_0x243c('0x27')](respondWithFilteredResult(_0xf8bf72,_0x35ccbd))[_0x243c('0x46')](handleError(_0xf8bf72,null));};exports['show']=function(_0x49d50a,_0x4c2383){var _0x2f7fc0={'raw':!![],'where':{'id':_0x49d50a[_0x243c('0x47')]['id']}},_0x53ecd3={};_0x53ecd3['model']=_[_0x243c('0x48')](db['WhatsappTransferReport'][_0x243c('0x49')]);_0x53ecd3[_0x243c('0x33')]=_[_0x243c('0x48')](_0x49d50a[_0x243c('0x33')]);_0x53ecd3[_0x243c('0x34')]=_[_0x243c('0x36')](_0x53ecd3['model'],_0x53ecd3['query']);_0x2f7fc0[_0x243c('0x35')]=_[_0x243c('0x36')](_0x53ecd3['model'],qs[_0x243c('0x37')](_0x49d50a[_0x243c('0x33')][_0x243c('0x37')]));_0x2f7fc0[_0x243c('0x35')]=_0x2f7fc0[_0x243c('0x35')][_0x243c('0x38')]?_0x2f7fc0[_0x243c('0x35')]:_0x53ecd3[_0x243c('0x30')];if(_0x49d50a['query']['includeAll']){_0x2f7fc0['include']=[{'all':!![]}];}_0x2f7fc0=_[_0x243c('0x40')]({},_0x2f7fc0,_0x49d50a[_0x243c('0x41')]);return db[_0x243c('0x2c')][_0x243c('0x4a')](_0x2f7fc0)[_0x243c('0x27')](handleEntityNotFound(_0x4c2383,null))[_0x243c('0x27')](respondWithResult(_0x4c2383,null))[_0x243c('0x46')](handleError(_0x4c2383,null));};exports[_0x243c('0x4b')]=function(_0x5e0704,_0x4eab12){return db[_0x243c('0x2c')]['create'](_0x5e0704['body'],{})[_0x243c('0x27')](respondWithResult(_0x4eab12,0xc9))[_0x243c('0x46')](handleError(_0x4eab12,null));};exports['update']=function(_0x3db40f,_0xe8a1f5){if(_0x3db40f[_0x243c('0x4c')]['id']){delete _0x3db40f[_0x243c('0x4c')]['id'];}return db['WhatsappTransferReport'][_0x243c('0x4a')]({'where':{'id':_0x3db40f[_0x243c('0x47')]['id']}})['then'](handleEntityNotFound(_0xe8a1f5,null))[_0x243c('0x27')](saveUpdates(_0x3db40f[_0x243c('0x4c')],null))[_0x243c('0x27')](respondWithResult(_0xe8a1f5,null))[_0x243c('0x46')](handleError(_0xe8a1f5,null));};exports[_0x243c('0x28')]=function(_0x3ad501,_0x1c6b8c){return db[_0x243c('0x2c')]['find']({'where':{'id':_0x3ad501[_0x243c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c6b8c,null))[_0x243c('0x27')](removeEntity(_0x1c6b8c,null))[_0x243c('0x46')](handleError(_0x1c6b8c,null));};exports[_0x243c('0x4d')]=function(_0x1be7a6,_0x303b44){return db['WhatsappTransferReport'][_0x243c('0x4d')]()[_0x243c('0x27')](respondWithResult(_0x303b44,null))[_0x243c('0x46')](handleError(_0x303b44,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 7a0a5ea..c7a3e2b 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 _0x6aaa=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x6aaa,0x1b4));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6aa('0x0'));var util=require(_0xa6aa('0x1'));var logger=require(_0xa6aa('0x2'))(_0xa6aa('0x3'));var moment=require(_0xa6aa('0x4'));var BPromise=require(_0xa6aa('0x5'));var rp=require(_0xa6aa('0x6'));var fs=require('fs');var path=require(_0xa6aa('0x7'));var rimraf=require(_0xa6aa('0x8'));var config=require(_0xa6aa('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0xa6aa('0xa')]=function(_0x571f24,_0x476764){return _0x571f24[_0xa6aa('0xb')](_0xa6aa('0xc'),attributes,{'tableName':_0xa6aa('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa6aa('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb6=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xdfb6,0x1cc));var _0x6dfb=function(_0x4fb0d9,_0x10767b){_0x4fb0d9=_0x4fb0d9-0x0;var _0x4e4fa0=_0xdfb6[_0x4fb0d9];return _0x4e4fa0;};'use strict';var _=require(_0x6dfb('0x0'));var util=require(_0x6dfb('0x1'));var logger=require(_0x6dfb('0x2'))(_0x6dfb('0x3'));var moment=require('moment');var BPromise=require(_0x6dfb('0x4'));var rp=require(_0x6dfb('0x5'));var fs=require('fs');var path=require(_0x6dfb('0x6'));var rimraf=require(_0x6dfb('0x7'));var config=require(_0x6dfb('0x8'));var attributes=require(_0x6dfb('0x9'));module[_0x6dfb('0xa')]=function(_0x7e3994,_0x490615){return _0x7e3994[_0x6dfb('0xb')](_0x6dfb('0xc'),attributes,{'tableName':_0x6dfb('0xd'),'paranoid':![],'indexes':[{'name':_0x6dfb('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 34d7405..6847b72 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 _0x125f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','moment','randomstring'];(function(_0x1b1fd9,_0x5dcf2b){var _0x1fb351=function(_0x556e9f){while(--_0x556e9f){_0x1b1fd9['push'](_0x1b1fd9['shift']());}};_0x1fb351(++_0x5dcf2b);}(_0x125f,0x12a));var _0xf125=function(_0xff319d,_0x1dfdc0){_0xff319d=_0xff319d-0x0;var _0x4839c7=_0x125f[_0xff319d];return _0x4839c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf125('0x0'));var BPromise=require('bluebird');var rs=require(_0xf125('0x1'));var fs=require('fs');var Redis=require(_0xf125('0x2'));var db=require(_0xf125('0x3'))['db'];var utils=require(_0xf125('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf125('0x5'));var jayson=require(_0xf125('0x6'));var client=jayson[_0xf125('0x7')][_0xf125('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24e15f,_0x2ea69e,_0x14bade){return new BPromise(function(_0x1d9aa7,_0x453aca){return client[_0xf125('0x9')](_0x24e15f,_0x14bade)[_0xf125('0xa')](function(_0x74d72f){logger[_0xf125('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2ea69e,_0xf125('0xc'));logger[_0xf125('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x2ea69e,_0xf125('0xc'),JSON[_0xf125('0xe')](_0x74d72f));if(_0x74d72f[_0xf125('0xf')]){if(_0x74d72f[_0xf125('0xf')]['code']===0x1f4){logger['error'](_0xf125('0x10'),_0x2ea69e,_0x74d72f['error'][_0xf125('0x11')]);return _0x453aca(_0x74d72f['error'][_0xf125('0x11')]);}logger[_0xf125('0xf')](_0xf125('0x10'),_0x2ea69e,_0x74d72f[_0xf125('0xf')][_0xf125('0x11')]);return _0x1d9aa7(_0x74d72f['error'][_0xf125('0x11')]);}else{logger['info'](_0xf125('0x10'),_0x2ea69e,'request\x20sent');_0x1d9aa7(_0x74d72f[_0xf125('0x12')]['message']);}})[_0xf125('0x13')](function(_0x5351df){logger[_0xf125('0xf')](_0xf125('0x10'),_0x2ea69e,_0x5351df);_0x453aca(_0x5351df);});});} \ No newline at end of file +var _0xf4a5=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xf4a5,0x1d1));var _0x5f4a=function(_0x6d0143,_0x3d7c30){_0x6d0143=_0x6d0143-0x0;var _0x29cb75=_0xf4a5[_0x6d0143];return _0x29cb75;};'use strict';var _=require(_0x5f4a('0x0'));var util=require('util');var moment=require(_0x5f4a('0x1'));var BPromise=require(_0x5f4a('0x2'));var rs=require(_0x5f4a('0x3'));var fs=require('fs');var Redis=require(_0x5f4a('0x4'));var db=require(_0x5f4a('0x5'))['db'];var utils=require(_0x5f4a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5f4a('0x7'));var jayson=require(_0x5f4a('0x8'));var client=jayson[_0x5f4a('0x9')][_0x5f4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5144da,_0x2c5d23,_0x1bc91d){return new BPromise(function(_0x43b59d,_0x230cb8){return client[_0x5f4a('0xb')](_0x5144da,_0x1bc91d)['then'](function(_0x21dc44){logger['info'](_0x5f4a('0xc'),_0x2c5d23,'request\x20sent');logger['debug'](_0x5f4a('0xd'),_0x2c5d23,_0x5f4a('0xe'),JSON[_0x5f4a('0xf')](_0x21dc44));if(_0x21dc44[_0x5f4a('0x10')]){if(_0x21dc44[_0x5f4a('0x10')][_0x5f4a('0x11')]===0x1f4){logger[_0x5f4a('0x10')](_0x5f4a('0xc'),_0x2c5d23,_0x21dc44[_0x5f4a('0x10')][_0x5f4a('0x12')]);return _0x230cb8(_0x21dc44[_0x5f4a('0x10')]['message']);}logger['error'](_0x5f4a('0xc'),_0x2c5d23,_0x21dc44[_0x5f4a('0x10')][_0x5f4a('0x12')]);return _0x43b59d(_0x21dc44[_0x5f4a('0x10')][_0x5f4a('0x12')]);}else{logger['info'](_0x5f4a('0xc'),_0x2c5d23,_0x5f4a('0xe'));_0x43b59d(_0x21dc44[_0x5f4a('0x13')][_0x5f4a('0x12')]);}})[_0x5f4a('0x14')](function(_0x82420){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x2c5d23,_0x82420);_0x230cb8(_0x82420);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 699ae80..300b642 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7266=['\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length'];(function(_0x2b44f6,_0x4264e4){var _0x24a7b1=function(_0x216e9f){while(--_0x216e9f){_0x2b44f6['push'](_0x2b44f6['shift']());}};_0x24a7b1(++_0x4264e4);}(_0x7266,0xec));var _0x6726=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x7266[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x6726('0x0'));var db=require(_0x6726('0x1'))['db'];var seedDb=require(_0x6726('0x2'));var checkLicense=require(_0x6726('0x3'));var rpc=require(_0x6726('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x6726('0x5'));var pm2=require(_0x6726('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x6726('0x7'));var whatsapp=require(_0x6726('0x8'));var transcribe=require(_0x6726('0x9'));var provider=require(_0x6726('0xa'));function main(){return db[_0x6726('0xb')][_0x6726('0xc')]()[_0x6726('0xd')](function(){if(config[_0x6726('0xe')]){return seedDb[_0x6726('0xf')]();}})[_0x6726('0xd')](function(){return checkLicense[_0x6726('0xf')]();})[_0x6726('0xd')](function(){return rpc[_0x6726('0x10')]();})['then'](function(_0x44ff0c){logger[_0x6726('0x11')](_0x44ff0c);return chat[_0x6726('0x12')]();})[_0x6726('0xd')](function(){return whatsapp['start']();})[_0x6726('0xd')](function(){return schedule['start']();})[_0x6726('0xd')](function(){return transcribe[_0x6726('0x12')]();})['then'](function(){return provider[_0x6726('0x12')]();})[_0x6726('0xd')](function(_0x1182b2){logger[_0x6726('0x11')](_0x1182b2);return pm2['start'](pm2Config);})[_0x6726('0xd')](function(_0x2eb2bc){var _0x4dc47d=_0x2eb2bc[_0x6726('0x13')](function(_0x5d3458){return typeof _0x5d3458[_0x6726('0x14')]===_0x6726('0x15')&&_0x5d3458[_0x6726('0x14')]>=0x0;});if(_0x4dc47d[_0x6726('0x16')]>0x0){throw new Error(_0x4dc47d['length']+_0x6726('0x17')+_[_0x6726('0x18')](_0x4dc47d,function(_0x4adb51){return'\x22'+_0x4adb51[_0x6726('0x19')]['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x6726('0x18')](_[_0x6726('0x13')](_0x2eb2bc,{'status':'online'}),_0x6726('0x1a'))[_0x6726('0x1b')]());logger[_0x6726('0x11')](_0x6726('0x1c'),_[_0x6726('0x18')](_[_0x6726('0x13')](_0x2eb2bc,function(_0x4af165){return _0x4af165[_0x6726('0x1d')]!=='online';}),_0x6726('0x1a'))[_0x6726('0x1b')]()||_0x6726('0x1e'));console[_0x6726('0x1f')](_0x6726('0x20'));})[_0x6726('0x21')](function(_0x562058){console[_0x6726('0x1f')](_0x6726('0x22'),_0x562058);logger[_0x6726('0x23')](_0x6726('0x24'),_0x562058);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x4813=['listen','info','start','filter','number','exitCode','name','online','Offline\x20apps:','map','status','join','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','then','seedDB','default'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4813,0x14e));var _0x3481=function(_0x1965d6,_0x1e8d86){_0x1965d6=_0x1965d6-0x0;var _0x3d0399=_0x4813[_0x1965d6];return _0x3d0399;};'use strict';var _=require(_0x3481('0x0'));var db=require(_0x3481('0x1'))['db'];var seedDb=require(_0x3481('0x2'));var checkLicense=require(_0x3481('0x3'));var rpc=require(_0x3481('0x4'));var config=require(_0x3481('0x5'));var logger=require(_0x3481('0x6'))('app');var pm2=require(_0x3481('0x7'));var pm2Config=require(_0x3481('0x8'));var schedule=require(_0x3481('0x9'));var chat=require(_0x3481('0xa'));var whatsapp=require(_0x3481('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x3481('0xc')]['sync']()[_0x3481('0xd')](function(){if(config[_0x3481('0xe')]){return seedDb[_0x3481('0xf')]();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x3481('0x10')]();})['then'](function(_0x4da46b){logger[_0x3481('0x11')](_0x4da46b);return chat[_0x3481('0x12')]();})[_0x3481('0xd')](function(){return whatsapp[_0x3481('0x12')]();})[_0x3481('0xd')](function(){return schedule[_0x3481('0x12')]();})[_0x3481('0xd')](function(){return transcribe[_0x3481('0x12')]();})[_0x3481('0xd')](function(){return provider[_0x3481('0x12')]();})[_0x3481('0xd')](function(_0x18c6df){logger['info'](_0x18c6df);return pm2[_0x3481('0x12')](pm2Config);})[_0x3481('0xd')](function(_0x1bcfad){var _0x3f5ef5=_0x1bcfad[_0x3481('0x13')](function(_0x39e581){return typeof _0x39e581['exitCode']===_0x3481('0x14')&&_0x39e581[_0x3481('0x15')]>=0x0;});if(_0x3f5ef5['length']>0x0){throw new Error(_0x3f5ef5['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x3f5ef5,function(_0x4f5d1b){return'\x22'+_0x4f5d1b['pm2_env'][_0x3481('0x16')]+'\x22';}));}logger[_0x3481('0x11')]('Online\x20apps:',_['map'](_[_0x3481('0x13')](_0x1bcfad,{'status':_0x3481('0x17')}),_0x3481('0x16'))['join']());logger['info'](_0x3481('0x18'),_[_0x3481('0x19')](_[_0x3481('0x13')](_0x1bcfad,function(_0x1ba743){return _0x1ba743[_0x3481('0x1a')]!==_0x3481('0x17');}),'name')[_0x3481('0x1b')]()||_0x3481('0x1c'));console[_0x3481('0x1d')](_0x3481('0x1e'));})['catch'](function(_0x2ecb2d){console['log'](_0x3481('0x1f'),_0x2ecb2d);logger[_0x3481('0x20')](_0x3481('0x21'),_0x2ecb2d);process[_0x3481('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 89dda5d..374e5c0 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 _0x14a0=['now','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','crypto','bluebird','util','session','role','fullname','email','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','Unmanaged.','Forbidden.','isAuthenticated','headers','authorization','startsWith','Basic','User','find','name','authenticate','pass','status','Wrong\x20credentials.','catch','json','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','Unknown\x20authorization\x20format','canUpdate','getLicense','update','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','encryptString','join','promisify','sign','secret','secrets','options','verify','randomBytes','toString','hex','floor'];(function(_0x28d297,_0x40d76f){var _0x172427=function(_0x585dfb){while(--_0x585dfb){_0x28d297['push'](_0x28d297['shift']());}};_0x172427(++_0x40d76f);}(_0x14a0,0x8e));var _0x014a=function(_0x2f1e7e,_0x45b3cc){_0x2f1e7e=_0x2f1e7e-0x0;var _0x41acf8=_0x14a0[_0x2f1e7e];return _0x41acf8;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x014a('0x0'));var hardwareConf=require(_0x014a('0x1'));var licenseUtil=require(_0x014a('0x2'));var encryptor=require(_0x014a('0x3'));var _=require(_0x014a('0x4'));var jwt=require(_0x014a('0x5'));var expressJwt=require(_0x014a('0x6'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x014a('0x7'));var BPromise=require(_0x014a('0x8'));var util=require(_0x014a('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0x014a('0xa')]});var userAttributes=['id',_0x014a('0xb'),_0x014a('0xc'),'name','internal',_0x014a('0xd'),'userpic','permissions','md5secret','voicePause',_0x014a('0xe'),'mailPause',_0x014a('0xf'),_0x014a('0x10'),'openchannelPause',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'phoneBarEnableDtmfTone',_0x014a('0x1d'),_0x014a('0x1e'),'phoneBarPrefixRequired',_0x014a('0x1f'),_0x014a('0x20'),'hotdesk',_0x014a('0x21'),_0x014a('0x22'),_0x014a('0x23'),_0x014a('0x24'),_0x014a('0x25'),_0x014a('0x26'),_0x014a('0x27'),_0x014a('0x28'),_0x014a('0x29'),_0x014a('0x2a'),_0x014a('0x2b'),_0x014a('0x2c'),_0x014a('0x2d'),_0x014a('0x2e'),'smsAutoanswer',_0x014a('0x2f'),_0x014a('0x30'),_0x014a('0x31'),_0x014a('0x32'),_0x014a('0x33'),_0x014a('0x34'),_0x014a('0x35'),_0x014a('0x36')];exports[_0x014a('0x37')]=function(){return this['isAuthenticated'](!![])[_0x014a('0x38')](function(_0x5f556e,_0x1a1318,_0x26718b){if(_0x5f556e[_0x014a('0x39')]){_0x26718b();}else{return db[_0x014a('0x3a')][_0x014a('0x3b')]({'where':{'id':_0x5f556e[_0x014a('0x3c')]['id']},'attributes':['id',_0x014a('0x3d'),_0x014a('0x3e')],'raw':!![]})[_0x014a('0x3f')](function(_0x4c2627){if(_0x4c2627&&_0x4c2627[_0x014a('0x3d')]){return _0x1a1318['status'](_0x4c2627[_0x014a('0x3e')]===_0x014a('0x40')?0x195:0x193)['json']({'message':_0x4c2627['disposition']===_0x014a('0x40')?_0x014a('0x41'):_0x014a('0x42')});}else{_0x26718b();}})['catch'](function(_0x183f19){_0x26718b(_0x183f19);});}});};exports[_0x014a('0x43')]=function isAuthenticated(_0x598179){return compose()[_0x014a('0x38')](function(_0x2560a6,_0x496040,_0x4f9c1c){var _0x397850;if(_0x2560a6[_0x014a('0x44')][_0x014a('0x45')]){if(_[_0x014a('0x46')](_0x2560a6['headers'][_0x014a('0x45')],_0x014a('0x47'))){var _0x15af07=basicAuth(_0x2560a6);db[_0x014a('0x48')][_0x014a('0x49')]({'where':{'name':_0x15af07[_0x014a('0x4a')]}})[_0x014a('0x3f')](function(_0x1dae8e){if(!_0x1dae8e||!_0x1dae8e[_0x014a('0x4b')](_0x15af07[_0x014a('0x4c')])){return _0x496040[_0x014a('0x4d')](0x191)['json']({'message':_0x014a('0x4e')});}_0x2560a6[_0x014a('0x39')]={'id':_0x1dae8e['id']};_0x4f9c1c();})[_0x014a('0x4f')](function(_0x457883){_0x4f9c1c(_0x457883);});}else if(_[_0x014a('0x46')](_0x2560a6[_0x014a('0x44')][_0x014a('0x45')],'Bearer')){validateJwt(_0x2560a6,_0x496040,_0x4f9c1c);}else{if(_0x598179){_0x4f9c1c();}else{return _0x496040[_0x014a('0x4d')](0x193)[_0x014a('0x50')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2560a6[_0x014a('0x51')][_0x014a('0x52')]){try{var _0x40738f={'audience':hardwareConf[_0x014a('0x53')](),'issuer':hardwareConf[_0x014a('0x53')]()};verifyJwt(_0x2560a6[_0x014a('0x51')][_0x014a('0x52')],_0x40738f)[_0x014a('0x3f')](function(_0x5e37e4){return db[_0x014a('0x48')][_0x014a('0x49')]({'where':{'id':_0x5e37e4[_0x014a('0x54')]}})[_0x014a('0x3f')](function(_0x5127f3){_0x397850=_0x5127f3;return db[_0x014a('0x55')][_0x014a('0x3b')]({'where':{'id':0x1},'attributes':[_0x014a('0x56'),_0x014a('0x57')],'raw':!![]});})[_0x014a('0x3f')](function(_0x309925){if(!_0x397850||!_[_0x014a('0x58')](_0x397850[_0x014a('0x59')],_0x5e37e4[_0x014a('0x5a')])){return _0x496040['status'](0x191)[_0x014a('0x50')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x397850[_0x014a('0x5b')]){return _0x496040[_0x014a('0x4d')](0x191)[_0x014a('0x50')]({'message':_0x014a('0x5c')});}if(_0x397850[_0x014a('0x5d')]){if(_0x309925['blockDuration']>0x0){if(moment(_0x397850[_0x014a('0x5e')])[_0x014a('0x5f')](_0x309925['blockDuration'],_0x014a('0x60'))>moment()){return _0x496040[_0x014a('0x4d')](0x191)[_0x014a('0x50')]({'message':_0x014a('0x5c')});}}else{return _0x496040[_0x014a('0x4d')](0x191)[_0x014a('0x50')]({'message':_0x014a('0x5c')});}}_0x2560a6[_0x014a('0x39')]={'id':_0x397850['id']};_0x4f9c1c();});})[_0x014a('0x4f')](function(){return _0x496040['status'](0x191)[_0x014a('0x50')]({'message':_0x014a('0x5c')});});}catch(_0x440d82){_0x4f9c1c(_0x440d82);}}else if(_0x598179){_0x4f9c1c();}else{return _0x496040[_0x014a('0x4d')](0x193)['json']({'message':_0x014a('0x61')});}})[_0x014a('0x38')](function(_0x4cd132,_0x1355dd,_0x1dc647){if(_0x4cd132[_0x014a('0x39')]){db['User'][_0x014a('0x49')]({'where':{'id':_0x4cd132[_0x014a('0x39')]['id']},'attributes':userAttributes})['then'](function(_0xc086b3){if(!_0xc086b3){return _0x1355dd[_0x014a('0x4d')](0x194)[_0x014a('0x50')]({'message':'User\x20not\x20found.'});}_0x4cd132[_0x014a('0x39')]=_0xc086b3;_0x1dc647();})['catch'](function(_0x5ab5e8){_0x1dc647(_0x5ab5e8);});}else if(_0x598179){_0x1dc647();}else{return _0x1355dd[_0x014a('0x4d')](0x194)[_0x014a('0x50')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x014a('0x62')]=function canUpdate(){return compose()[_0x014a('0x38')](function(_0xa4b68e,_0x15c5dc,_0x382a5f){return licenseUtil[_0x014a('0x63')]()['then'](function(_0x3a6b4f){if(_0x3a6b4f[_0x014a('0x64')]){_0x382a5f();}else{return _0x15c5dc[_0x014a('0x4d')](0x193)['json']({'message':'Forbidden'});}})[_0x014a('0x4f')](function(_0x57f5f4){_0x382a5f(_0x57f5f4);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x014a('0x38')](function(_0x47aaac,_0x2a4679,_0x45caee){return licenseUtil[_0x014a('0x63')]()['then'](function(_0x395e5e){if(_0x395e5e[_0x014a('0x65')]){_0x45caee();}else{return _0x2a4679[_0x014a('0x4d')](0x193)[_0x014a('0x50')]({'message':_0x014a('0x66')});}})[_0x014a('0x4f')](function(_0x559954){_0x45caee(_0x559954);});});};exports[_0x014a('0x67')]=function(_0x1f7f40,_0x5a861c,_0x1a4df9){_0x1f7f40[_0x014a('0x67')]=!![];return _0x1a4df9();};exports[_0x014a('0x68')]=function signToken(_0x324df7){return signJwt(_0x324df7);};exports[_0x014a('0x69')]=function(_0x357ca1,_0x437f23){if(!_0x357ca1[_0x014a('0x39')]){return _0x437f23['status'](0x194)[_0x014a('0x50')]({'message':_0x014a('0x6a')});}var _0x3f286d={'payload':{'id':_0x357ca1[_0x014a('0x39')]['id'],'role':_0x357ca1[_0x014a('0x39')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3f286d)[_0x014a('0x3f')](function(_0x5bee56){_0x437f23[_0x014a('0x6b')](_0x014a('0x6c'),_0x5bee56);_0x437f23[_0x014a('0x6d')](_0x014a('0x6e'));})[_0x014a('0x4f')](function(_0x4f8547){return _0x437f23['status'](0x1f4)['send'](_0x4f8547);});};exports['retrieveApiKey']=function(_0x1c11d0){if(_['isNil'](_0x1c11d0[_0x014a('0x59')])||_['isNil'](_0x1c11d0['apiKeyIat'])){return null;}else{return createJwt(_0x1c11d0);}};exports[_0x014a('0x6f')]=function(_0x55ca2f){_0x55ca2f[_0x014a('0x59')]=generateNonce();_0x55ca2f[_0x014a('0x70')]=generateIssuedAt();return createJwt(_0x55ca2f);};exports[_0x014a('0x71')]=function(_0x3c7e06,_0x21b16c){var _0x46dde4=_0x3c7e06[_0x014a('0x51')][_0x014a('0x52')];if(_0x46dde4){var _0x133fcd={'nonce':_0x21b16c[_0x014a('0x59')],'iat':_0x21b16c['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x014a('0x53')]()};return verifyJwt(_0x46dde4,_0x133fcd)[_0x014a('0x3f')](function(){return generateApiKey(_0x21b16c);});}else{throw{'message':_0x014a('0x72')};}};exports['validatePasswordPattern']=function(_0x58aa79){var _0x4591ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4591ad['test'](_0x58aa79))throw new db[(_0x014a('0x73'))][(_0x014a('0x74'))](_0x014a('0x75'));return;};exports[_0x014a('0x76')]=function(_0x53e631,_0x861fb5,_0x2ccc2f){var _0x3d1c9d=encryptor['decryptString'](_0x861fb5)[_0x014a('0x77')](',');for(var _0x57e179=0x0;_0x57e179<_0x2ccc2f;_0x57e179++){if(!_0x3d1c9d[_0x57e179])break;if(_0x53e631[_0x014a('0x78')]()===_0x3d1c9d[_0x57e179][_0x014a('0x78')]()){var _0x34736b=util[_0x014a('0x79')](_0x014a('0x7a'),_0x2ccc2f);if(_0x2ccc2f===0x1){_0x34736b=_0x014a('0x7b');}throw new db['Sequelize'][(_0x014a('0x74'))](_0x34736b);}}return;};exports[_0x014a('0x7c')]=function(_0x29da9b,_0x52b123){var _0x1761c9=_0x52b123?encryptor[_0x014a('0x7d')](_0x52b123)[_0x014a('0x77')](','):[];if(_0x1761c9[_0x014a('0x7e')]===0x5){_0x1761c9[_0x014a('0x7f')](-0x1,0x1);}_0x1761c9['unshift'](_0x29da9b);return encryptor[_0x014a('0x80')](_0x1761c9[_0x014a('0x81')](','));};function signJwt(_0x63c341){var _0x37a7b8=BPromise[_0x014a('0x82')](jwt[_0x014a('0x83')],{'context':jwt});var _0x477946=_0x63c341[_0x014a('0x84')]||config[_0x014a('0x85')][_0x014a('0xa')];return new BPromise(function(_0x3aa8c4,_0x2d3efb){_0x37a7b8(_0x63c341['payload'],_0x477946,_0x63c341[_0x014a('0x86')])['then'](function(_0x4f6cd9){_0x3aa8c4(_0x4f6cd9);})['catch'](function(_0x4a38e0){_0x2d3efb(_0x4a38e0);});});}function verifyJwt(_0x5a38b4,_0x1716d3,_0x19be40){var _0x2613ff=BPromise['promisify'](jwt[_0x014a('0x87')],{'context':jwt});var _0x2a5007=_0x19be40||config[_0x014a('0x85')][_0x014a('0xa')];return new BPromise(function(_0x4dd210,_0x5edf80){_0x2613ff(_0x5a38b4,_0x2a5007,_0x1716d3)[_0x014a('0x3f')](function(_0x39154c){_0x4dd210(_0x39154c);})[_0x014a('0x4f')](function(_0x36807a){_0x5edf80(_0x36807a);});});}function generateNonce(){return crypto[_0x014a('0x88')](0x10)[_0x014a('0x89')](_0x014a('0x8a'));}function generateIssuedAt(){return Math[_0x014a('0x8b')](Date[_0x014a('0x8c')]()/0x3e8)[_0x014a('0x89')]();}function createJwt(_0x3126f){var _0x4b1fbf={'payload':{'iat':_0x3126f[_0x014a('0x70')],'nonce':_0x3126f[_0x014a('0x59')]},'options':{'algorithm':'HS512','subject':_0x3126f['id'][_0x014a('0x89')](),'issuer':hardwareConf[_0x014a('0x53')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x4b1fbf)[_0x014a('0x3f')](function(_0x51ddea){return{'iat':_0x3126f[_0x014a('0x70')],'nonce':_0x3126f[_0x014a('0x59')],'token':_0x51ddea};});} \ No newline at end of file +var _0x4cf8=['Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','options','promisify','verify','randomBytes','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','role','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','authenticate','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0x4cf8[_0x1a7e4b];return _0x37a8fd;};'use strict';var db=require(_0x84cf('0x0'))['db'];var config=require(_0x84cf('0x1'));var hardwareConf=require(_0x84cf('0x2'));var licenseUtil=require(_0x84cf('0x3'));var encryptor=require(_0x84cf('0x4'));var _=require(_0x84cf('0x5'));var jwt=require(_0x84cf('0x6'));var expressJwt=require(_0x84cf('0x7'));var compose=require(_0x84cf('0x8'));var basicAuth=require(_0x84cf('0x9'));var crypto=require(_0x84cf('0xa'));var BPromise=require(_0x84cf('0xb'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x84cf('0xc')]['session']});var userAttributes=['id',_0x84cf('0xd'),_0x84cf('0xe'),'name',_0x84cf('0xf'),_0x84cf('0x10'),'userpic',_0x84cf('0x11'),_0x84cf('0x12'),_0x84cf('0x13'),_0x84cf('0x14'),'mailPause',_0x84cf('0x15'),_0x84cf('0x16'),'openchannelPause','pauseType',_0x84cf('0x17'),_0x84cf('0x18'),_0x84cf('0x19'),_0x84cf('0x1a'),_0x84cf('0x1b'),_0x84cf('0x1c'),_0x84cf('0x1d'),_0x84cf('0x1e'),_0x84cf('0x1f'),_0x84cf('0x20'),_0x84cf('0x21'),_0x84cf('0x22'),_0x84cf('0x23'),_0x84cf('0x24'),_0x84cf('0x25'),_0x84cf('0x26'),_0x84cf('0x27'),_0x84cf('0x28'),_0x84cf('0x29'),'userProfileId',_0x84cf('0x2a'),_0x84cf('0x2b'),_0x84cf('0x2c'),_0x84cf('0x2d'),_0x84cf('0x2e'),_0x84cf('0x2f'),_0x84cf('0x30'),'selectRecallMeCampaign','chatAutoanswer',_0x84cf('0x31'),_0x84cf('0x32'),_0x84cf('0x33'),_0x84cf('0x34'),_0x84cf('0x35'),'openchannelAutoanswer',_0x84cf('0x36'),_0x84cf('0x37'),_0x84cf('0x38'),_0x84cf('0x39'),_0x84cf('0x3a'),'messengerSoundNotification'];exports[_0x84cf('0x3b')]=function(){return this[_0x84cf('0x3c')](!![])[_0x84cf('0x3d')](function(_0x23e1e7,_0x3e5e94,_0x29e9e1){if(_0x23e1e7[_0x84cf('0x3e')]){_0x29e9e1();}else{return db['ChatInteraction'][_0x84cf('0x3f')]({'where':{'id':_0x23e1e7[_0x84cf('0x40')]['id']},'attributes':['id',_0x84cf('0x41'),_0x84cf('0x42')],'raw':!![]})[_0x84cf('0x43')](function(_0x44d4bf){if(_0x44d4bf&&_0x44d4bf[_0x84cf('0x41')]){return _0x3e5e94[_0x84cf('0x44')](_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?0x195:0x193)['json']({'message':_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?_0x84cf('0x46'):_0x84cf('0x47')});}else{_0x29e9e1();}})['catch'](function(_0x1595dd){_0x29e9e1(_0x1595dd);});}});};exports['isAuthenticated']=function isAuthenticated(_0x29455e){return compose()[_0x84cf('0x3d')](function(_0x43b41b,_0xc15298,_0x51adcf){var _0x20de4b;if(_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')]){if(_[_0x84cf('0x4a')](_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')],_0x84cf('0x4b'))){var _0x18243d=basicAuth(_0x43b41b);db[_0x84cf('0x4c')]['find']({'where':{'name':_0x18243d['name']}})[_0x84cf('0x43')](function(_0x25de3a){if(!_0x25de3a||!_0x25de3a[_0x84cf('0x4d')](_0x18243d[_0x84cf('0x4e')])){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x50')});}_0x43b41b[_0x84cf('0x3e')]={'id':_0x25de3a['id']};_0x51adcf();})['catch'](function(_0x113b3e){_0x51adcf(_0x113b3e);});}else if(_[_0x84cf('0x4a')](_0x43b41b['headers'][_0x84cf('0x49')],'Bearer')){validateJwt(_0x43b41b,_0xc15298,_0x51adcf);}else{if(_0x29455e){_0x51adcf();}else{return _0xc15298[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}}}else if(_0x43b41b[_0x84cf('0x52')][_0x84cf('0x53')]){try{var _0x49d415={'audience':hardwareConf[_0x84cf('0x54')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x43b41b['query'][_0x84cf('0x53')],_0x49d415)[_0x84cf('0x43')](function(_0x4c4676){return db[_0x84cf('0x4c')][_0x84cf('0x55')]({'where':{'id':_0x4c4676[_0x84cf('0x56')]}})[_0x84cf('0x43')](function(_0xd13908){_0x20de4b=_0xd13908;return db[_0x84cf('0x57')]['findOne']({'where':{'id':0x1},'attributes':[_0x84cf('0x58'),_0x84cf('0x59')],'raw':!![]});})[_0x84cf('0x43')](function(_0x32cff6){if(!_0x20de4b||!_[_0x84cf('0x5a')](_0x20de4b[_0x84cf('0x5b')],_0x4c4676['nonce'])){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5c')});}if(_0x20de4b[_0x84cf('0x5d')]){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}if(_0x20de4b[_0x84cf('0x5f')]){if(_0x32cff6[_0x84cf('0x59')]>0x0){if(moment(_0x20de4b[_0x84cf('0x60')])[_0x84cf('0x61')](_0x32cff6['blockDuration'],_0x84cf('0x62'))>moment()){return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}}else{return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x43b41b[_0x84cf('0x3e')]={'id':_0x20de4b['id']};_0x51adcf();});})['catch'](function(){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5e')});});}catch(_0x40ae50){_0x51adcf(_0x40ae50);}}else if(_0x29455e){_0x51adcf();}else{return _0xc15298['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}})[_0x84cf('0x3d')](function(_0x5ef5fb,_0x3c1314,_0x5f1b8e){if(_0x5ef5fb[_0x84cf('0x3e')]){db['User']['find']({'where':{'id':_0x5ef5fb['user']['id']},'attributes':userAttributes})[_0x84cf('0x43')](function(_0xcf14ba){if(!_0xcf14ba){return _0x3c1314['status'](0x194)[_0x84cf('0x4f')]({'message':'User\x20not\x20found.'});}_0x5ef5fb[_0x84cf('0x3e')]=_0xcf14ba;_0x5f1b8e();})[_0x84cf('0x63')](function(_0x5ce309){_0x5f1b8e(_0x5ce309);});}else if(_0x29455e){_0x5f1b8e();}else{return _0x3c1314[_0x84cf('0x44')](0x194)['json']({'message':_0x84cf('0x64')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5d8b69,_0x5498ec,_0x585644){return licenseUtil['getLicense']()['then'](function(_0x210d9b){if(_0x210d9b[_0x84cf('0x65')]){_0x585644();}else{return _0x5498ec[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':'Forbidden'});}})[_0x84cf('0x63')](function(_0x4af229){_0x585644(_0x4af229);});});};exports[_0x84cf('0x66')]=function isWebrtcLicence(){return compose()[_0x84cf('0x3d')](function(_0x1533a7,_0x253464,_0x121bb9){return licenseUtil[_0x84cf('0x67')]()['then'](function(_0x2f7da6){if(_0x2f7da6[_0x84cf('0x68')]){_0x121bb9();}else{return _0x253464['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x69')});}})[_0x84cf('0x63')](function(_0x5212ec){_0x121bb9(_0x5212ec);});});};exports['isMiddleware']=function(_0x5499f9,_0x1cf3f6,_0x104421){_0x5499f9[_0x84cf('0x6a')]=!![];return _0x104421();};exports[_0x84cf('0x6b')]=function signToken(_0x271cc3){return signJwt(_0x271cc3);};exports[_0x84cf('0x6c')]=function(_0x51d725,_0x350985){if(!_0x51d725['user']){return _0x350985[_0x84cf('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x46c595={'payload':{'id':_0x51d725[_0x84cf('0x3e')]['id'],'role':_0x51d725[_0x84cf('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x46c595)['then'](function(_0x290a4d){_0x350985[_0x84cf('0x6d')](_0x84cf('0x6e'),_0x290a4d);_0x350985[_0x84cf('0x6f')](_0x84cf('0x70'));})['catch'](function(_0xcfe28f){return _0x350985[_0x84cf('0x44')](0x1f4)['send'](_0xcfe28f);});};exports[_0x84cf('0x71')]=function(_0x5baea8){if(_['isNil'](_0x5baea8[_0x84cf('0x5b')])||_[_0x84cf('0x72')](_0x5baea8['apiKeyIat'])){return null;}else{return createJwt(_0x5baea8);}};exports['generateApiKey']=function(_0x31176c){_0x31176c[_0x84cf('0x5b')]=generateNonce();_0x31176c[_0x84cf('0x73')]=generateIssuedAt();return createJwt(_0x31176c);};exports[_0x84cf('0x74')]=function(_0x406c33,_0x3edaec){var _0x3a0eb4=_0x406c33[_0x84cf('0x52')]['apikey'];if(_0x3a0eb4){var _0x1bc15c={'nonce':_0x3edaec[_0x84cf('0x5b')],'iat':_0x3edaec['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x84cf('0x54')]()};return verifyJwt(_0x3a0eb4,_0x1bc15c)[_0x84cf('0x43')](function(){return generateApiKey(_0x3edaec);});}else{throw{'message':_0x84cf('0x75')};}};exports[_0x84cf('0x76')]=function(_0x340915){var _0xfec87d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xfec87d[_0x84cf('0x77')](_0x340915))throw new db['Sequelize'][(_0x84cf('0x78'))]('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[_0x84cf('0x79')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){var _0x55d8c4=encryptor[_0x84cf('0x7a')](_0x2a60bc)[_0x84cf('0x7b')](',');for(var _0x52a3f1=0x0;_0x52a3f1<_0x1c2f1b;_0x52a3f1++){if(!_0x55d8c4[_0x52a3f1])break;if(_0x5c0122[_0x84cf('0x7c')]()===_0x55d8c4[_0x52a3f1]['toLowerCase']()){var _0x577d55=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1c2f1b);if(_0x1c2f1b===0x1){_0x577d55=_0x84cf('0x7d');}throw new db[(_0x84cf('0x7e'))][(_0x84cf('0x78'))](_0x577d55);}}return;};exports[_0x84cf('0x7f')]=function(_0x480c3e,_0x32aa8b){var _0x3c1c55=_0x32aa8b?encryptor['decryptString'](_0x32aa8b)[_0x84cf('0x7b')](','):[];if(_0x3c1c55[_0x84cf('0x80')]===0x5){_0x3c1c55[_0x84cf('0x81')](-0x1,0x1);}_0x3c1c55[_0x84cf('0x82')](_0x480c3e);return encryptor[_0x84cf('0x83')](_0x3c1c55[_0x84cf('0x84')](','));};function signJwt(_0x1f1f76){var _0x39a336=BPromise['promisify'](jwt[_0x84cf('0x85')],{'context':jwt});var _0x58a96a=_0x1f1f76[_0x84cf('0x86')]||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x276ab1,_0x2602b7){_0x39a336(_0x1f1f76['payload'],_0x58a96a,_0x1f1f76[_0x84cf('0x88')])[_0x84cf('0x43')](function(_0xe1a1d9){_0x276ab1(_0xe1a1d9);})['catch'](function(_0xdb9b0c){_0x2602b7(_0xdb9b0c);});});}function verifyJwt(_0x240cca,_0x4e6077,_0x84d9cb){var _0x482958=BPromise[_0x84cf('0x89')](jwt[_0x84cf('0x8a')],{'context':jwt});var _0x57f1f2=_0x84d9cb||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x4a7905,_0x40b33e){_0x482958(_0x240cca,_0x57f1f2,_0x4e6077)[_0x84cf('0x43')](function(_0x262ae1){_0x4a7905(_0x262ae1);})[_0x84cf('0x63')](function(_0x577ade){_0x40b33e(_0x577ade);});});}function generateNonce(){return crypto[_0x84cf('0x8b')](0x10)[_0x84cf('0x8c')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x84cf('0x8c')]();}function createJwt(_0x8399f4){var _0xfcd0d={'payload':{'iat':_0x8399f4['apiKeyIat'],'nonce':_0x8399f4['apiKeyNonce']},'options':{'algorithm':_0x84cf('0x8d'),'subject':_0x8399f4['id'][_0x84cf('0x8c')](),'issuer':hardwareConf[_0x84cf('0x54')](),'audience':hardwareConf[_0x84cf('0x54')]()}};return signJwt(_0xfcd0d)[_0x84cf('0x43')](function(_0x39bd44){return{'iat':_0x8399f4[_0x84cf('0x73')],'nonce':_0x8399f4[_0x84cf('0x5b')],'token':_0x39bd44};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index bbf0bdb..b7dccfe 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14e4=['checkListsRestrictions','tag','countFilteredContacts','count','User','getFilteredContacts','catch','CmContact','describe','keys','startsWith','cf_','map','CmCustomField','findOne','all','length','fieldType','type','lodash','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','fields','filter','user','clause','tags','skip'];(function(_0x2fb207,_0x4d0d92){var _0x3dd6be=function(_0x1b4846){while(--_0x1b4846){_0x2fb207['push'](_0x2fb207['shift']());}};_0x3dd6be(++_0x4d0d92);}(_0x14e4,0x9f));var _0x414e=function(_0x5ce1d4,_0x38c804){_0x5ce1d4=_0x5ce1d4-0x0;var _0x4a8791=_0x14e4[_0x5ce1d4];return _0x4a8791;};'use strict';var _=require(_0x414e('0x0'));var sqlUtils=require(_0x414e('0x1'));var db=require('../../mysqldb')['db'];exports[_0x414e('0x2')]=function(_0x2f39a6,_0x1534c0,_0x1d51df,_0x5c8ac1){var _0x52f041={'count':0x0,'rows':[]};var _0x21be9f=sqlUtils[_0x414e('0x3')](_0x1534c0,_0x2f39a6);if(_0x21be9f){return Promise[_0x414e('0x4')](_0x52f041);}var _0x314073=sqlUtils[_0x414e('0x5')]();var _0x241843={};var _0x1aba11=![];var _0x4effa6=![];return Promise['resolve']()[_0x414e('0x6')](function(){if(_0x2f39a6[_0x414e('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0x2f39a6[_0x414e('0x7')],_0x5c8ac1);}else{return sqlUtils[_0x414e('0x8')](_0x2f39a6,_0x5c8ac1);}})['then'](function(_0x5b20d0){_0x314073[_0x414e('0x9')](_0x5b20d0['default']);_0x314073[_0x414e('0x9')](_0x5b20d0[_0x414e('0xa')]);_0x314073['where'](_0x5b20d0[_0x414e('0xb')]);_0x314073[_0x414e('0x9')](_0x5b20d0[_0x414e('0xc')][_0x414e('0xd')]);_0x241843=_0x5b20d0[_0x414e('0xe')];_0x4effa6=_0x5b20d0['user'][_0x414e('0xf')];return sqlUtils[_0x414e('0x10')](_0x1534c0,_0x2f39a6,_0x4effa6);})['then'](function(_0x5877c0){_0x314073['where'](_0x5877c0);var _0x4a6385=_0x2f39a6[_0x414e('0x7')]?_0x241843['ids']:_0x2f39a6[_0x414e('0x11')];_0x1aba11=_0x4a6385?!![]:![];return sqlUtils[_0x414e('0x12')](_0x314073,_0x4a6385);})['then'](function(_0x3ed431){_0x52f041[_0x414e('0x13')]=_0x3ed431;if(_0x52f041[_0x414e('0x13')]===0x0){return;}if(_0x2f39a6[_0x414e('0x14')]){_0x4effa6=!![];}return sqlUtils['buildContactsQuery'](_0x314073,_0x2f39a6['fields'],_0x1d51df,_0x1aba11,_0x241843[_0x414e('0xd')],_0x4effa6);})[_0x414e('0x6')](function(_0xa737a0){if(!_0xa737a0){return[];}return sqlUtils[_0x414e('0x15')](_0xa737a0,_0x2f39a6,_0x1d51df);})[_0x414e('0x6')](function(_0x5c8014){_0x52f041['rows']=_0x5c8014;return _0x52f041;})[_0x414e('0x16')](function(_0x265593){throw _0x265593;});};exports['describe']=function(){var _0x4261fa={};var _0x13dbf6=[];return db[_0x414e('0x17')][_0x414e('0x18')]()[_0x414e('0x6')](function(_0x4e54c0){_0x4261fa=_0x4e54c0;var _0xf2565d=Object[_0x414e('0x19')](_0x4261fa)['filter'](function(_0x3497d0){return _[_0x414e('0x1a')](_0x3497d0,_0x414e('0x1b'))?_0x3497d0:undefined;});var _0x512875=_0xf2565d[_0x414e('0x1c')](function(_0x273b1b){return db[_0x414e('0x1d')][_0x414e('0x1e')]({'where':{'id':_0x273b1b['slice'](0x3)},'raw':!![]});});return Promise[_0x414e('0x1f')](_0x512875);})['then'](function(_0x7bffb7){for(var _0x2d21c3=0x0;_0x2d21c3<_0x7bffb7[_0x414e('0x20')];_0x2d21c3++){if(_0x7bffb7[_0x2d21c3]){var _0x10dcca='cf_'+_0x7bffb7[_0x2d21c3]['id'];_0x4261fa[_0x10dcca][_0x414e('0x21')]=_0x7bffb7[_0x2d21c3][_0x414e('0x22')];}}_0x13dbf6=_[_0x414e('0x1c')](Object[_0x414e('0x19')](_0x4261fa),function(_0x524735){return{'name':_0x524735,'type':_0x4261fa[_0x524735][_0x414e('0x22')]};});return _0x13dbf6;})[_0x414e('0x16')](function(_0x3bf363){throw _0x3bf363;});}; \ No newline at end of file +var _0x7b17=['skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','fields','clause','getFilteredContacts','rows','describe','CmContact','keys','filter','map','CmCustomField','slice','all','cf_','fieldType','type','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','default','where','tags','user'];(function(_0x2da127,_0x1344e1){var _0x4dc47b=function(_0x7e9a3b){while(--_0x7e9a3b){_0x2da127['push'](_0x2da127['shift']());}};_0x4dc47b(++_0x1344e1);}(_0x7b17,0x17f));var _0x77b1=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x7b17[_0x2ac5f8];return _0x3b8229;};'use strict';var _=require('lodash');var sqlUtils=require(_0x77b1('0x0'));var db=require('../../mysqldb')['db'];exports[_0x77b1('0x1')]=function(_0x8b2a24,_0x12f5f4,_0x1f09d0,_0x2d5b79){var _0x688a55={'count':0x0,'rows':[]};var _0x5ef1d=sqlUtils[_0x77b1('0x2')](_0x12f5f4,_0x8b2a24);if(_0x5ef1d){return Promise[_0x77b1('0x3')](_0x688a55);}var _0x26d71a=sqlUtils[_0x77b1('0x4')]();var _0xd6b0a2={};var _0x3e7f57=![];var _0x197e6f=![];return Promise[_0x77b1('0x3')]()[_0x77b1('0x5')](function(){if(_0x8b2a24['search']){return sqlUtils[_0x77b1('0x6')](_0x8b2a24[_0x77b1('0x7')],_0x2d5b79);}else{return sqlUtils[_0x77b1('0x8')](_0x8b2a24,_0x2d5b79);}})[_0x77b1('0x5')](function(_0x1890fe){_0x26d71a['where'](_0x1890fe[_0x77b1('0x9')]);_0x26d71a['where'](_0x1890fe['fields']);_0x26d71a['where'](_0x1890fe['filter']);_0x26d71a[_0x77b1('0xa')](_0x1890fe['user']['clause']);_0xd6b0a2=_0x1890fe[_0x77b1('0xb')];_0x197e6f=_0x1890fe[_0x77b1('0xc')][_0x77b1('0xd')];return sqlUtils[_0x77b1('0xe')](_0x12f5f4,_0x8b2a24,_0x197e6f);})[_0x77b1('0x5')](function(_0x4baa95){_0x26d71a['where'](_0x4baa95);var _0x1625d6=_0x8b2a24['search']?_0xd6b0a2[_0x77b1('0xf')]:_0x8b2a24[_0x77b1('0x10')];_0x3e7f57=_0x1625d6?!![]:![];return sqlUtils[_0x77b1('0x11')](_0x26d71a,_0x1625d6);})[_0x77b1('0x5')](function(_0x384b81){_0x688a55[_0x77b1('0x12')]=_0x384b81;if(_0x688a55[_0x77b1('0x12')]===0x0){return;}if(_0x8b2a24[_0x77b1('0x13')]){_0x197e6f=!![];}return sqlUtils[_0x77b1('0x14')](_0x26d71a,_0x8b2a24[_0x77b1('0x15')],_0x1f09d0,_0x3e7f57,_0xd6b0a2[_0x77b1('0x16')],_0x197e6f);})['then'](function(_0x2826d2){if(!_0x2826d2){return[];}return sqlUtils[_0x77b1('0x17')](_0x2826d2,_0x8b2a24,_0x1f09d0);})[_0x77b1('0x5')](function(_0x2f582c){_0x688a55[_0x77b1('0x18')]=_0x2f582c;return _0x688a55;})['catch'](function(_0x54b37c){throw _0x54b37c;});};exports[_0x77b1('0x19')]=function(){var _0x46243c={};var _0x5deff7=[];return db[_0x77b1('0x1a')][_0x77b1('0x19')]()['then'](function(_0x2e2715){_0x46243c=_0x2e2715;var _0x9bc355=Object[_0x77b1('0x1b')](_0x46243c)[_0x77b1('0x1c')](function(_0x57d6b8){return _['startsWith'](_0x57d6b8,'cf_')?_0x57d6b8:undefined;});var _0x199243=_0x9bc355[_0x77b1('0x1d')](function(_0x38c9fd){return db[_0x77b1('0x1e')]['findOne']({'where':{'id':_0x38c9fd[_0x77b1('0x1f')](0x3)},'raw':!![]});});return Promise[_0x77b1('0x20')](_0x199243);})[_0x77b1('0x5')](function(_0x2471e8){for(var _0x272fd6=0x0;_0x272fd6<_0x2471e8['length'];_0x272fd6++){if(_0x2471e8[_0x272fd6]){var _0x402494=_0x77b1('0x21')+_0x2471e8[_0x272fd6]['id'];_0x46243c[_0x402494][_0x77b1('0x22')]=_0x2471e8[_0x272fd6][_0x77b1('0x23')];}}_0x5deff7=_[_0x77b1('0x1d')](Object[_0x77b1('0x1b')](_0x46243c),function(_0x2629f7){return{'name':_0x2629f7,'type':_0x46243c[_0x2629f7]['type']};});return _0x5deff7;})['catch'](function(_0x52277e){throw _0x52277e;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 9e94955..5179437 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5787=['DESC','subqry.','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','c.id','isEmpty','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','mobile','fax','email','CompanyId','createdAt','updatedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','and','tags','ids','User','uc.UserId\x20=\x20?','user','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','fields','tag','clause','filter','getLists','c.ListId\x20IS\x20NULL','map','attributes','group','limit','offset','subqry.id','order'];(function(_0x5f5ac5,_0x526505){var _0x3697f2=function(_0x49cec5){while(--_0x49cec5){_0x5f5ac5['push'](_0x5f5ac5['shift']());}};_0x3697f2(++_0x526505);}(_0x5787,0x156));var _0x7578=function(_0x9774a3,_0x21c418){_0x9774a3=_0x9774a3-0x0;var _0x1e53fd=_0x5787[_0x9774a3];return _0x1e53fd;};'use strict';var _=require('lodash');var squel=require(_0x7578('0x0'));var as=require(_0x7578('0x1'));var qs=require(_0x7578('0x2'));var utils=require(_0x7578('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x1c741d,_0x11f91f){var _0x567d35=![];if(_0x1c741d[_0x7578('0x4')]===_0x7578('0x5')&&!_0x11f91f[_0x7578('0x6')]&&!_0x11f91f[_0x7578('0x7')]&&_0x11f91f[_0x7578('0x8')]!==_0x7578('0x9')){_0x567d35=!![];}return _0x567d35;}function getContactsSubquery(){return squel[_0x7578('0xa')]()[_0x7578('0xb')]('cm_contacts','c')[_0x7578('0xc')](_0x7578('0xd'));}function applyJoinClauses(_0x18f971,_0x50594a){var _0xc42dd0=_0x50594a?'c':'subqry';_0x18f971[_0x7578('0xe')]('cm_user_has_contacts','uc',_0x7578('0xf')+_0xc42dd0+_0x7578('0x10'))[_0x7578('0xe')](_0x7578('0x11'),'ct',_0x7578('0x12')+_0xc42dd0+'.id')[_0x7578('0xe')](_0x7578('0x13'),'t',_0x7578('0x14'));return _0x18f971;}function addFieldsToQuery(_0x38fc64,_0x17066a,_0x1ec692,_0x419d6f,_0x5a7c2b){var _0x555771=_0x5a7c2b?'c':_0x7578('0x15');if(!_0x17066a){_0x17066a=['id',_0x7578('0x16'),_0x7578('0x17'),'phone',_0x7578('0x18'),_0x7578('0x19'),_0x7578('0x1a'),'ListId',_0x7578('0x1b'),_0x7578('0x1c'),_0x7578('0x1d'),'deletedAt',_0x7578('0x1e')];}else if(!_0x17066a[_0x7578('0x1f')]('id')){_0x17066a[_0x7578('0x20')]('id');}var _0x118cf8=_0x1ec692&&_0x5a7c2b||!_0x1ec692&&!_0x5a7c2b;if(_0x419d6f){_0x118cf8=_0x419d6f&&_0x5a7c2b||!_0x419d6f&&!_0x5a7c2b;}_0x17066a[_0x7578('0x21')](function(_0x2ff89f){if(_0x2ff89f===_0x7578('0x1e')){if(_0x118cf8){_0x38fc64['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2ff89f);}else if(_0x1ec692||_0x419d6f){_0x38fc64[_0x7578('0x22')](_0x555771+'.'+_0x2ff89f);}}else{_0x38fc64[_0x7578('0x22')](_0x555771+'.'+_0x2ff89f);}});return _0x38fc64;}function getSqlClauses(){var _0x76b392={'default':squel['expr'](),'fields':squel[_0x7578('0x23')](),'filter':squel[_0x7578('0x23')](),'tags':{'clause':squel[_0x7578('0x23')](),'ids':null},'user':{'clause':squel[_0x7578('0x23')](),'skip':![]}};return _0x76b392;}function parseTagParameter(_0x4f5340){var _0x15be2f=squel[_0x7578('0x23')]();if(_0x4f5340){var _0x587310=utils[_0x7578('0x24')](_0x4f5340);_0x587310[_0x7578('0x21')](function(_0x447b6f){_0x15be2f['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x447b6f+',%');});}return _0x15be2f;}function parseSearchFilter(_0x38d2b3){var _0x1ec40a=squel['expr']();if(_0x38d2b3){var _0x17b661=_0x38d2b3[_0x7578('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x17b661[_0x7578('0x26')]('\x20')[_0x7578('0x27')]>0x1){_0x1ec40a['or'](_0x7578('0x28'),qs[_0x7578('0x29')](_0x17b661,!![]),null);}else{if(qs['isNumeric'](_0x17b661)){_0x1ec40a['or'](_0x7578('0x2a'),_0x17b661+'%');_0x1ec40a['or'](_0x7578('0x2b'),_0x17b661+'%');_0x1ec40a['or']('c.mobile\x20LIKE\x20?',_0x17b661+'%');_0x1ec40a['or'](_0x7578('0x2c'),_0x17b661+'%');}else if(qs[_0x7578('0x2d')](_0x17b661)){_0x1ec40a['or']('c.email\x20LIKE\x20?',_0x17b661+'%');}else{_0x1ec40a['or'](_0x7578('0x2e'),'%'+_0x17b661+'%');_0x1ec40a['or'](_0x7578('0x2f'),'%'+_0x17b661+'%');_0x1ec40a['or']('c.email\x20LIKE\x20?','%'+_0x17b661+'%');}}}return _0x1ec40a;}function parseAdvancedSearchFilter(_0x513bdc,_0x4c27f3){var _0x152fee=getSqlClauses();var _0x3eef43=as[_0x7578('0x30')](_0x513bdc);var _0x5b1877=_0x3eef43[_0x7578('0x31')];for(var _0x417994=0x0;_0x417994<_0x3eef43[_0x7578('0x32')][_0x7578('0x27')];_0x417994++){var _0x34d19c=_0x3eef43[_0x7578('0x32')][_0x417994];var _0x2e704c='c';var _0x4fc1d6=_['find'](_0x4c27f3,[_0x7578('0x33'),_0x34d19c[_0x7578('0x22')]]);if(_0x4fc1d6){if(_0x34d19c['field']===_0x7578('0x34')||_0x4fc1d6[_0x7578('0x35')]===_0x7578('0x36')){_0x34d19c[_0x7578('0x37')]=_0x7578('0x38');}var _0x683ef8=as[_0x7578('0x39')](_0x2e704c,_0x4fc1d6[_0x7578('0x3a')],_0x34d19c);_0x152fee[_0x7578('0x3b')][_0x5b1877](_0x683ef8[_0x7578('0x3c')],_0x683ef8[_0x7578('0x3d')][_0x7578('0x3e')],_0x683ef8[_0x7578('0x3d')][_0x7578('0x3f')]);}else{if(_0x34d19c[_0x7578('0x22')]===_0x7578('0x40')){var _0x19a9aa=_0x34d19c[_0x7578('0x3d')]['split'](',')['map'](function(_0x37fb7b){return Number(_0x37fb7b);});var _0xc397fe=parseTagParameter(_0x19a9aa);_0x152fee['tags']['clause'][_0x7578('0x41')](_0xc397fe);_0x152fee[_0x7578('0x42')][_0x7578('0x43')]=_0x19a9aa;}else if(_0x34d19c[_0x7578('0x22')]===_0x7578('0x44')){_0x152fee['user']['clause']['and'](_0x7578('0x45'),_0x34d19c[_0x7578('0x3d')]);_0x152fee[_0x7578('0x46')][_0x7578('0x47')]=!![];}}}return _0x152fee;}function parseModelFields(_0x9cd9cf,_0x593722){var _0x566534=squel[_0x7578('0x23')]();var _0xc06280=_(_0x9cd9cf)[_0x7578('0x48')]()['map'](function(_0x1d5aec){return _[_0x7578('0x49')](_0x593722,[_0x7578('0x33'),_0x1d5aec])?_0x1d5aec:undefined;})[_0x7578('0x4a')]()[_0x7578('0x3d')]();if(_0x9cd9cf['Contact']){_0xc06280['push'](_0x7578('0x4b'));}if(_0x9cd9cf['User']){_0xc06280[_0x7578('0x20')](_0x7578('0x44'));}if(_0xc06280[_0x7578('0x27')]>0x0){_0xc06280[_0x7578('0x21')](function(_0x7f7387){if(_0x7f7387===_0x7578('0x7')){_0x566534[_0x7578('0x41')](_0x7578('0x4c'),[][_0x7578('0x4d')](_0x9cd9cf[_0x7f7387]));}else if(_0x7f7387===_0x7578('0x4b')){var _0x57fcdb='%'+_0x9cd9cf[_0x7f7387]+'%';_0x566534[_0x7578('0x41')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x57fcdb);}else if(_0x7f7387==='User'){_0x566534[_0x7578('0x41')](_0x7578('0x45'),_0x9cd9cf[_0x7f7387]);}else{_0x566534[_0x7578('0x41')]('c.'+_0x7f7387+_0x7578('0x4e'),_0x9cd9cf[_0x7f7387]);}});}return _0x566534;}function parseQueryParameters(_0x578e18,_0x1b6c50){var _0x1cbf9c=getSqlClauses();return Promise[_0x7578('0x4f')]()[_0x7578('0x50')](function(){return parseModelFields(_0x578e18,_0x1b6c50);})['then'](function(_0x33a36c){_0x1cbf9c[_0x7578('0x51')][_0x7578('0x41')](_0x33a36c);return parseTagParameter(_0x578e18[_0x7578('0x52')]);})[_0x7578('0x50')](function(_0x4ea323){_0x1cbf9c[_0x7578('0x42')][_0x7578('0x53')][_0x7578('0x41')](_0x4ea323);return parseSearchFilter(_0x578e18[_0x7578('0x54')]);})[_0x7578('0x50')](function(_0x1cfd10){_0x1cbf9c[_0x7578('0x54')]=_0x1cfd10;return _0x1cbf9c;});}function checkListsRestrictions(_0x401c76,_0xe74943,_0x440307){var _0x4d16dc=squel[_0x7578('0x23')]();return Promise[_0x7578('0x4f')]()[_0x7578('0x50')](function(){if(_0xe74943['search']&&_0x401c76['role']===_0x7578('0x5')&&!_0x440307){return _0x401c76[_0x7578('0x55')]({'attributes':['id'],'raw':!![]});}})[_0x7578('0x50')](function(_0x3d931d){if(_0x3d931d){if(_0x3d931d[_0x7578('0x27')]===0x0){_0x4d16dc[_0x7578('0x41')](_0x7578('0x56'));}else{_0x4d16dc[_0x7578('0x41')](_0x7578('0x4c'),_[_0x7578('0x57')](_0x3d931d,'id'));}}})[_0x7578('0x50')](function(){return _0x4d16dc;});}function buildContactsQuery(_0x52277d,_0x397015,_0x15b16d,_0x2e9ebb,_0x7b7ce8,_0x2b681f){if(_0x397015){_0x397015=_0x15b16d[_0x7578('0x58')];}_0x52277d=addFieldsToQuery(_0x52277d,_0x397015,_0x2e9ebb,_0x2b681f,!![]);var _0x49730f=squel[_0x7578('0xa')]();_0x49730f=addFieldsToQuery(_0x49730f,_0x397015,_0x2e9ebb,_0x2b681f,![]);if(_0x2e9ebb||_0x2b681f){_0x52277d=applyJoinClauses(_0x52277d,!![]);_0x52277d[_0x7578('0x59')]('c.id');if(_0x15b16d[_0x7578('0x5a')]){_0x49730f[_0x7578('0x5a')](_0x15b16d[_0x7578('0x5a')]);}if(_0x15b16d['offset']){_0x49730f[_0x7578('0x5b')](_0x15b16d['offset']);}}else{_0x49730f=applyJoinClauses(_0x49730f,![]);_0x49730f[_0x7578('0x59')](_0x7578('0x5c'));if(_0x15b16d[_0x7578('0x5a')]){_0x52277d['limit'](_0x15b16d['limit']);}if(_0x15b16d[_0x7578('0x5b')]){_0x52277d['offset'](_0x15b16d[_0x7578('0x5b')]);}}_0x49730f['having'](_0x7b7ce8);if(_0x15b16d[_0x7578('0x5d')]){_0x15b16d['order'][_0x7578('0x21')](function(_0x49f126){_0x52277d['order']('c.'+_0x49f126[0x0],_0x49f126[0x1]===_0x7578('0x5e')?![]:!![]);_0x49730f['order'](_0x7578('0x5f')+_0x49f126[0x0],_0x49f126[0x1]===_0x7578('0x5e')?![]:!![]);});}_0x49730f[_0x7578('0xb')](_0x52277d,_0x7578('0x15'));return _0x49730f;}function getFilteredContacts(_0x4b3fe4){var _0x5a8092=[];return db[_0x7578('0x40')][_0x7578('0x60')]({'attributes':['id','name','color'],'raw':!![]})[_0x7578('0x50')](function(_0x458fb6){_0x5a8092=_[_0x7578('0x61')](_0x458fb6,'id');var _0x4fe30e={'type':db[_0x7578('0x62')][_0x7578('0x63')][_0x7578('0x64')],'model':db[_0x7578('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7578('0x66')][_0x7578('0x67')](_0x4b3fe4['toString'](),_0x4fe30e);})[_0x7578('0x50')](function(_0x57a0b2){_0x57a0b2[_0x7578('0x21')](function(_0x39c116){if(_0x39c116[_0x7578('0x1e')]){_0x39c116['Tags']=[];_0x39c116['TagIds'][_0x7578('0x26')](',')['forEach'](function(_0x210698){_0x39c116[_0x7578('0x68')][_0x7578('0x20')](_0x5a8092[_0x210698]);});}delete _0x39c116[_0x7578('0x1e')];});return _0x57a0b2;});}function countFilteredContacts(_0x341a7f,_0x142b3d){var _0x537e56=_0x341a7f[_0x7578('0x69')]();_0x537e56[_0x7578('0x22')]('COUNT(*)');_0x537e56=applyJoinClauses(_0x537e56,!![]);_0x341a7f[_0x7578('0x59')](_0x7578('0x6a'));var _0x1b1b1d=utils[_0x7578('0x24')](_0x142b3d);if(!_[_0x7578('0x6b')](_0x1b1b1d)){_0x537e56[_0x7578('0xc')]('t.id\x20IN\x20?',_0x1b1b1d);}var _0x2c08f1={'type':db[_0x7578('0x62')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0x7578('0x67')](_0x537e56['toString'](),_0x2c08f1)['then'](function(_0x47f269){return _0x47f269[0x0]['COUNT(*)'];});}module[_0x7578('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x7318=['buildExpression','type','default','value','end','Tag','map','tags','clause','ids','User','user','and','uc.UserId\x20=\x20?','skip','some','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','search','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','order','subqry.','DESC','from','name','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','ListId','autocomplete','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','.id','left_join','tools_tags','t.id\x20=\x20ct.TagId','firstName','mobile','fax','CompanyId','createdAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','dateOfBirth','datetime','castTo'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x7318,0xa4));var _0x8731=function(_0x59f49b,_0x2c24b5){_0x59f49b=_0x59f49b-0x0;var _0x313bfb=_0x7318[_0x59f49b];return _0x313bfb;};'use strict';var _=require(_0x8731('0x0'));var squel=require(_0x8731('0x1'));var as=require(_0x8731('0x2'));var qs=require(_0x8731('0x3'));var utils=require(_0x8731('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x1bd22f,_0x34c588){var _0x4b2f18=![];if(_0x1bd22f[_0x8731('0x5')]==='agent'&&!_0x34c588['search']&&!_0x34c588[_0x8731('0x6')]&&_0x34c588[_0x8731('0x7')]!=='true'){_0x4b2f18=!![];}return _0x4b2f18;}function getContactsSubquery(){return squel[_0x8731('0x8')]()['from'](_0x8731('0x9'),'c')[_0x8731('0xa')](_0x8731('0xb'));}function applyJoinClauses(_0xd40941,_0x23a6fc){var _0x5c7721=_0x23a6fc?'c':_0x8731('0xc');_0xd40941['left_join'](_0x8731('0xd'),'uc',_0x8731('0xe')+_0x5c7721+'.id')['left_join'](_0x8731('0xf'),'ct','ct.CmContactId\x20=\x20'+_0x5c7721+_0x8731('0x10'))[_0x8731('0x11')](_0x8731('0x12'),'t',_0x8731('0x13'));return _0xd40941;}function addFieldsToQuery(_0x2274ef,_0x4703c3,_0x3613df,_0x364714,_0x2fa594){var _0x14e739=_0x2fa594?'c':'subqry';if(!_0x4703c3){_0x4703c3=['id',_0x8731('0x14'),'lastName','phone',_0x8731('0x15'),_0x8731('0x16'),'email',_0x8731('0x6'),_0x8731('0x17'),_0x8731('0x18'),'updatedAt','deletedAt',_0x8731('0x19')];}else if(!_0x4703c3[_0x8731('0x1a')]('id')){_0x4703c3[_0x8731('0x1b')]('id');}var _0x320cf0=_0x3613df&&_0x2fa594||!_0x3613df&&!_0x2fa594;if(_0x364714){_0x320cf0=_0x364714&&_0x2fa594||!_0x364714&&!_0x2fa594;}_0x4703c3[_0x8731('0x1c')](function(_0x20986d){if(_0x20986d==='TagIds'){if(_0x320cf0){_0x2274ef[_0x8731('0x1d')](_0x8731('0x1e'),_0x20986d);}else if(_0x3613df||_0x364714){_0x2274ef['field'](_0x14e739+'.'+_0x20986d);}}else{_0x2274ef[_0x8731('0x1d')](_0x14e739+'.'+_0x20986d);}});return _0x2274ef;}function getSqlClauses(){var _0x19da5d={'default':squel[_0x8731('0x1f')](),'fields':squel[_0x8731('0x1f')](),'filter':squel[_0x8731('0x1f')](),'tags':{'clause':squel[_0x8731('0x1f')](),'ids':null},'user':{'clause':squel[_0x8731('0x1f')](),'skip':![]}};return _0x19da5d;}function parseTagParameter(_0x543c3a){var _0x3088cc=squel[_0x8731('0x1f')]();if(_0x543c3a){var _0x14ca36=utils[_0x8731('0x20')](_0x543c3a);_0x14ca36['forEach'](function(_0x3cb6c0){_0x3088cc['or'](_0x8731('0x21'),'%,'+_0x3cb6c0+',%');});}return _0x3088cc;}function parseSearchFilter(_0x221cf2){var _0xa59723=squel[_0x8731('0x1f')]();if(_0x221cf2){var _0x47efda=_0x221cf2[_0x8731('0x22')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x47efda[_0x8731('0x23')]('\x20')[_0x8731('0x24')]>0x1){_0xa59723['or'](_0x8731('0x25'),qs[_0x8731('0x26')](_0x47efda,!![]),null);}else{if(qs[_0x8731('0x27')](_0x47efda)){_0xa59723['or'](_0x8731('0x28'),_0x47efda+'%');_0xa59723['or'](_0x8731('0x29'),_0x47efda+'%');_0xa59723['or'](_0x8731('0x2a'),_0x47efda+'%');_0xa59723['or'](_0x8731('0x2b'),_0x47efda+'%');}else if(qs[_0x8731('0x2c')](_0x47efda)){_0xa59723['or'](_0x8731('0x2d'),_0x47efda+'%');}else{_0xa59723['or'](_0x8731('0x2e'),'%'+_0x47efda+'%');_0xa59723['or'](_0x8731('0x2f'),'%'+_0x47efda+'%');_0xa59723['or'](_0x8731('0x2d'),'%'+_0x47efda+'%');}}}return _0xa59723;}function parseAdvancedSearchFilter(_0x5f49d3,_0x30e258){var _0x261ec3=getSqlClauses();var _0x1e0a89=as[_0x8731('0x30')](_0x5f49d3);var _0x23f130=_0x1e0a89['sqlOperator'];for(var _0x421a9e=0x0;_0x421a9e<_0x1e0a89[_0x8731('0x31')][_0x8731('0x24')];_0x421a9e++){var _0x5d73b6=_0x1e0a89[_0x8731('0x31')][_0x421a9e];var _0x4dc0e5='c';var _0x3ba63e=_[_0x8731('0x32')](_0x30e258,['name',_0x5d73b6[_0x8731('0x1d')]]);if(_0x3ba63e){if(_0x5d73b6[_0x8731('0x1d')]===_0x8731('0x33')||_0x3ba63e['fieldType']===_0x8731('0x34')){_0x5d73b6[_0x8731('0x35')]='DATE';}var _0x2a4505=as[_0x8731('0x36')](_0x4dc0e5,_0x3ba63e[_0x8731('0x37')],_0x5d73b6);_0x261ec3[_0x8731('0x38')][_0x23f130](_0x2a4505['text'],_0x2a4505[_0x8731('0x39')]['start'],_0x2a4505['value'][_0x8731('0x3a')]);}else{if(_0x5d73b6['field']===_0x8731('0x3b')){var _0x5aeb8b=_0x5d73b6[_0x8731('0x39')][_0x8731('0x23')](',')[_0x8731('0x3c')](function(_0x4ff41b){return Number(_0x4ff41b);});var _0x248a00=parseTagParameter(_0x5aeb8b);_0x261ec3[_0x8731('0x3d')][_0x8731('0x3e')]['and'](_0x248a00);_0x261ec3[_0x8731('0x3d')][_0x8731('0x3f')]=_0x5aeb8b;}else if(_0x5d73b6['field']===_0x8731('0x40')){_0x261ec3[_0x8731('0x41')][_0x8731('0x3e')][_0x8731('0x42')](_0x8731('0x43'),_0x5d73b6['value']);_0x261ec3[_0x8731('0x41')][_0x8731('0x44')]=!![];}}}return _0x261ec3;}function parseModelFields(_0x1f6313,_0x55e3af){var _0x5e94cb=squel[_0x8731('0x1f')]();var _0x27f60f=_(_0x1f6313)['keys']()[_0x8731('0x3c')](function(_0x493e0c){return _[_0x8731('0x45')](_0x55e3af,['name',_0x493e0c])?_0x493e0c:undefined;})['compact']()[_0x8731('0x39')]();if(_0x1f6313[_0x8731('0x46')]){_0x27f60f[_0x8731('0x1b')](_0x8731('0x46'));}if(_0x1f6313[_0x8731('0x40')]){_0x27f60f[_0x8731('0x1b')](_0x8731('0x40'));}if(_0x27f60f[_0x8731('0x24')]>0x0){_0x27f60f[_0x8731('0x1c')](function(_0x14e27d){if(_0x14e27d==='ListId'){_0x5e94cb[_0x8731('0x42')](_0x8731('0x47'),[][_0x8731('0x48')](_0x1f6313[_0x14e27d]));}else if(_0x14e27d==='Contact'){var _0x38a6c5='%'+_0x1f6313[_0x14e27d]+'%';_0x5e94cb[_0x8731('0x42')](_0x8731('0x49'),_0x38a6c5);}else if(_0x14e27d===_0x8731('0x40')){_0x5e94cb[_0x8731('0x42')](_0x8731('0x43'),_0x1f6313[_0x14e27d]);}else{_0x5e94cb[_0x8731('0x42')]('c.'+_0x14e27d+_0x8731('0x4a'),_0x1f6313[_0x14e27d]);}});}return _0x5e94cb;}function parseQueryParameters(_0x2cabe2,_0x683a33){var _0x753037=getSqlClauses();return Promise[_0x8731('0x4b')]()[_0x8731('0x4c')](function(){return parseModelFields(_0x2cabe2,_0x683a33);})[_0x8731('0x4c')](function(_0x5cc4cb){_0x753037[_0x8731('0x4d')]['and'](_0x5cc4cb);return parseTagParameter(_0x2cabe2[_0x8731('0x4e')]);})[_0x8731('0x4c')](function(_0x13fd12){_0x753037[_0x8731('0x3d')][_0x8731('0x3e')]['and'](_0x13fd12);return parseSearchFilter(_0x2cabe2[_0x8731('0x4f')]);})[_0x8731('0x4c')](function(_0x144ee0){_0x753037['filter']=_0x144ee0;return _0x753037;});}function checkListsRestrictions(_0x4e5841,_0x441d60,_0x118afc){var _0x3f3801=squel[_0x8731('0x1f')]();return Promise['resolve']()[_0x8731('0x4c')](function(){if(_0x441d60[_0x8731('0x50')]&&_0x4e5841[_0x8731('0x5')]===_0x8731('0x51')&&!_0x118afc){return _0x4e5841[_0x8731('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x8731('0x4c')](function(_0x17188c){if(_0x17188c){if(_0x17188c[_0x8731('0x24')]===0x0){_0x3f3801['and'](_0x8731('0x53'));}else{_0x3f3801['and'](_0x8731('0x47'),_[_0x8731('0x3c')](_0x17188c,'id'));}}})[_0x8731('0x4c')](function(){return _0x3f3801;});}function buildContactsQuery(_0x14dfc1,_0x5e3e43,_0x291015,_0x2c7ec5,_0x1f9c56,_0x2a9cbc){if(_0x5e3e43){_0x5e3e43=_0x291015[_0x8731('0x54')];}_0x14dfc1=addFieldsToQuery(_0x14dfc1,_0x5e3e43,_0x2c7ec5,_0x2a9cbc,!![]);var _0x44f149=squel[_0x8731('0x8')]();_0x44f149=addFieldsToQuery(_0x44f149,_0x5e3e43,_0x2c7ec5,_0x2a9cbc,![]);if(_0x2c7ec5||_0x2a9cbc){_0x14dfc1=applyJoinClauses(_0x14dfc1,!![]);_0x14dfc1[_0x8731('0x55')](_0x8731('0x56'));if(_0x291015['limit']){_0x44f149[_0x8731('0x57')](_0x291015[_0x8731('0x57')]);}if(_0x291015[_0x8731('0x58')]){_0x44f149[_0x8731('0x58')](_0x291015[_0x8731('0x58')]);}}else{_0x44f149=applyJoinClauses(_0x44f149,![]);_0x44f149[_0x8731('0x55')](_0x8731('0x59'));if(_0x291015['limit']){_0x14dfc1[_0x8731('0x57')](_0x291015[_0x8731('0x57')]);}if(_0x291015[_0x8731('0x58')]){_0x14dfc1[_0x8731('0x58')](_0x291015['offset']);}}_0x44f149['having'](_0x1f9c56);if(_0x291015[_0x8731('0x5a')]){_0x291015[_0x8731('0x5a')]['forEach'](function(_0x50d7c8){_0x14dfc1[_0x8731('0x5a')]('c.'+_0x50d7c8[0x0],_0x50d7c8[0x1]==='DESC'?![]:!![]);_0x44f149[_0x8731('0x5a')](_0x8731('0x5b')+_0x50d7c8[0x0],_0x50d7c8[0x1]===_0x8731('0x5c')?![]:!![]);});}_0x44f149[_0x8731('0x5d')](_0x14dfc1,_0x8731('0xc'));return _0x44f149;}function getFilteredContacts(_0x5171c2){var _0x437f8f=[];return db['Tag']['findAll']({'attributes':['id',_0x8731('0x5e'),_0x8731('0x5f')],'raw':!![]})[_0x8731('0x4c')](function(_0x7f8f38){_0x437f8f=_[_0x8731('0x60')](_0x7f8f38,'id');var _0x303b7b={'type':db[_0x8731('0x61')][_0x8731('0x62')]['SELECT'],'model':db[_0x8731('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x8731('0x64')][_0x8731('0x65')](_0x5171c2[_0x8731('0x66')](),_0x303b7b);})[_0x8731('0x4c')](function(_0x2c61ed){_0x2c61ed[_0x8731('0x1c')](function(_0x2952d8){if(_0x2952d8[_0x8731('0x19')]){_0x2952d8[_0x8731('0x67')]=[];_0x2952d8[_0x8731('0x19')][_0x8731('0x23')](',')[_0x8731('0x1c')](function(_0xd28c07){_0x2952d8['Tags']['push'](_0x437f8f[_0xd28c07]);});}delete _0x2952d8[_0x8731('0x19')];});return _0x2c61ed;});}function countFilteredContacts(_0x4e92ef,_0x15f53c){var _0x5b390b=_0x4e92ef['clone']();_0x5b390b[_0x8731('0x1d')](_0x8731('0x68'));_0x5b390b=applyJoinClauses(_0x5b390b,!![]);_0x4e92ef[_0x8731('0x55')](_0x8731('0x56'));var _0x193ff3=utils[_0x8731('0x20')](_0x15f53c);if(!_[_0x8731('0x69')](_0x193ff3)){_0x5b390b['where'](_0x8731('0x6a'),_0x193ff3);}var _0x2ab07e={'type':db[_0x8731('0x61')]['QueryTypes'][_0x8731('0x6b')],'raw':!![]};return db['sequelize'][_0x8731('0x65')](_0x5b390b[_0x8731('0x66')](),_0x2ab07e)[_0x8731('0x4c')](function(_0x12759b){return _0x12759b[0x0][_0x8731('0x68')];});}module[_0x8731('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 454d54d..26aac75 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 _0xb434=['error','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','end','close','unlink','createDecipher','final','write','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb434,0x1f3));var _0x4b43=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0xb434[_0x257841];return _0x1b87ed;};'use strict';var crypto=require(_0x4b43('0x0'));var fs=require('fs');var BPromise=require(_0x4b43('0x1'));var _=require(_0x4b43('0x2'));var config=require(_0x4b43('0x3'));var logger=require('../../config/logger')(_0x4b43('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4b43('0x5')]['session'],'algorithm':_0x4b43('0x6')};const fileOptions={'algorithm':_0x4b43('0x7')};if(config[_0x4b43('0x8')]&&config[_0x4b43('0x8')][_0x4b43('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x4b43('0x9')]);if(isSupported){fileOptions[_0x4b43('0x9')]=config[_0x4b43('0x8')][_0x4b43('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4b43('0xa')](',\x20');logger[_0x4b43('0xb')](config['encrypt'][_0x4b43('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x37e80a){return AES_SUPPORTED_RX['test'](_0x37e80a);}function getSupportedCiphers(){return crypto[_0x4b43('0xc')]()[_0x4b43('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x452ad8){return getSupportedCiphers()[_0x4b43('0xe')](_0x452ad8)>-0x1;}function combineOptions(_0x35ece4){var _0x3aec2={};for(var _0x49fe49 in fileOptions){if(fileOptions[_0x4b43('0xf')](_0x49fe49)){_0x3aec2[_0x49fe49]=fileOptions[_0x49fe49];}}if(_0x35ece4){for(var _0x1bb01a in _0x35ece4){if(_0x35ece4['hasOwnProperty'](_0x1bb01a)){_0x3aec2[_0x1bb01a]=_0x35ece4[_0x1bb01a];}}}return _0x3aec2;}exports[_0x4b43('0x10')]=function(_0x4c38f8,_0x3cc9ca,_0x2c882d,_0x58be29){return new BPromise(function(_0x3393c5,_0x5b8473){_0x58be29=combineOptions(_0x58be29);var _0xc4a4c1=new Buffer(_0x2c882d);var _0x2ac9d9=fs[_0x4b43('0x11')](_0x4c38f8);var _0x4bbdd1=fs[_0x4b43('0x12')](_0x3cc9ca);var _0x396bb4=crypto[_0x4b43('0x13')](_0x58be29[_0x4b43('0x9')],_0xc4a4c1);_0x2ac9d9['on'](_0x4b43('0x14'),function(_0x2bf580){var _0x25edb1=new Buffer(_0x396bb4[_0x4b43('0x15')](_0x2bf580),_0x4b43('0x16'));_0x4bbdd1['write'](_0x25edb1);});_0x2ac9d9['on']('end',function(){try{var _0x355643=new Buffer(_0x396bb4['final']('binary'),_0x4b43('0x16'));_0x4bbdd1['write'](_0x355643);_0x4bbdd1[_0x4b43('0x17')]();_0x4bbdd1['on'](_0x4b43('0x18'),function(){return _0x3393c5(_0x3cc9ca);});}catch(_0x32d8d5){fs[_0x4b43('0x19')](_0x3cc9ca);return _0x5b8473(_0x32d8d5);}});});};exports['decryptFile']=function(_0x486cdd,_0x7a481e,_0x3dbcc6,_0x1912e8){return new BPromise(function(_0x1ad3d0,_0x419874){_0x1912e8=combineOptions(_0x1912e8);var _0x185e6=new Buffer(_0x3dbcc6);var _0x460724=fs[_0x4b43('0x11')](_0x486cdd);var _0x3d950e=fs[_0x4b43('0x12')](_0x7a481e);var _0x1ffd5e=crypto[_0x4b43('0x1a')](_0x1912e8[_0x4b43('0x9')],_0x185e6);_0x460724['on'](_0x4b43('0x14'),function(_0x3f3704){var _0x5a64b4=new Buffer(_0x1ffd5e[_0x4b43('0x15')](_0x3f3704),_0x4b43('0x16'));_0x3d950e['write'](_0x5a64b4);});_0x460724['on']('end',function(){try{var _0x1d8f22=new Buffer(_0x1ffd5e[_0x4b43('0x1b')](_0x4b43('0x16')),_0x4b43('0x16'));_0x3d950e[_0x4b43('0x1c')](_0x1d8f22);_0x3d950e[_0x4b43('0x17')]();_0x3d950e['on'](_0x4b43('0x18'),function(){return _0x1ad3d0(_0x7a481e);});}catch(_0x2c4a3c){fs[_0x4b43('0x19')](_0x7a481e);return _0x419874(_0x2c4a3c);}});});};exports[_0x4b43('0x1d')]=function(_0x3fc169,_0x529151,_0x5b1908){var _0x41a5db=_0x5b1908||stringOptions['algorithm'];var _0x183468=_0x529151||stringOptions[_0x4b43('0x1e')];var _0x25aea2=crypto[_0x4b43('0x13')](_0x41a5db,_0x183468);var _0x48b7d6=_0x25aea2[_0x4b43('0x15')](_0x3fc169,_0x4b43('0x1f'),_0x4b43('0x20'));_0x48b7d6+=_0x25aea2[_0x4b43('0x1b')](_0x4b43('0x20'));return _0x48b7d6;};exports[_0x4b43('0x21')]=function(_0x2ed2ac,_0x53a6c7,_0x334ff4){var _0x4b8961=_0x334ff4||stringOptions[_0x4b43('0x9')];var _0x4b9410=_0x53a6c7||stringOptions[_0x4b43('0x1e')];var _0x26f9e9=crypto['createDecipher'](_0x4b8961,_0x4b9410);var _0x588a6f=_0x26f9e9[_0x4b43('0x15')](_0x2ed2ac,_0x4b43('0x20'),_0x4b43('0x1f'));_0x588a6f+=_0x26f9e9[_0x4b43('0x1b')]('utf8');return _0x588a6f;}; \ No newline at end of file +var _0x5c43=['final','write','end','close','unlink','decryptFile','createDecipher','encryptString','secret','createCipher','utf8','base64','crypto','bluebird','../../config/environment','app','secrets','aes192','encrypt','algorithm','join','error','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary'];(function(_0x9f384d,_0x5d8032){var _0x3b64ec=function(_0x52b37a){while(--_0x52b37a){_0x9f384d['push'](_0x9f384d['shift']());}};_0x3b64ec(++_0x5d8032);}(_0x5c43,0x123));var _0x35c4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5c43[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require(_0x35c4('0x0'));var fs=require('fs');var BPromise=require(_0x35c4('0x1'));var _=require('lodash');var config=require(_0x35c4('0x2'));var logger=require('../../config/logger')(_0x35c4('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x35c4('0x4')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x35c4('0x5')};if(config[_0x35c4('0x6')]&&config['encrypt'][_0x35c4('0x7')]){var isSupported=isAlgorithmSupported(config[_0x35c4('0x6')][_0x35c4('0x7')]);if(isSupported){fileOptions[_0x35c4('0x7')]=config[_0x35c4('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x35c4('0x8')](',\x20');logger[_0x35c4('0x9')](config[_0x35c4('0x6')][_0x35c4('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2f9c1d){return AES_SUPPORTED_RX['test'](_0x2f9c1d);}function getSupportedCiphers(){return crypto[_0x35c4('0xa')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xddf14){return getSupportedCiphers()[_0x35c4('0xb')](_0xddf14)>-0x1;}function combineOptions(_0x13cb08){var _0x26f6b2={};for(var _0x58b1ee in fileOptions){if(fileOptions[_0x35c4('0xc')](_0x58b1ee)){_0x26f6b2[_0x58b1ee]=fileOptions[_0x58b1ee];}}if(_0x13cb08){for(var _0x30440b in _0x13cb08){if(_0x13cb08['hasOwnProperty'](_0x30440b)){_0x26f6b2[_0x30440b]=_0x13cb08[_0x30440b];}}}return _0x26f6b2;}exports[_0x35c4('0xd')]=function(_0x33241d,_0x420330,_0x2afd1f,_0x41b506){return new BPromise(function(_0x4e42ca,_0x248cea){_0x41b506=combineOptions(_0x41b506);var _0x26de8d=new Buffer(_0x2afd1f);var _0x3a1071=fs[_0x35c4('0xe')](_0x33241d);var _0x94ad85=fs[_0x35c4('0xf')](_0x420330);var _0x3feaca=crypto['createCipher'](_0x41b506[_0x35c4('0x7')],_0x26de8d);_0x3a1071['on'](_0x35c4('0x10'),function(_0x3b095e){var _0x1680b6=new Buffer(_0x3feaca[_0x35c4('0x11')](_0x3b095e),_0x35c4('0x12'));_0x94ad85['write'](_0x1680b6);});_0x3a1071['on']('end',function(){try{var _0x156608=new Buffer(_0x3feaca[_0x35c4('0x13')](_0x35c4('0x12')),_0x35c4('0x12'));_0x94ad85[_0x35c4('0x14')](_0x156608);_0x94ad85[_0x35c4('0x15')]();_0x94ad85['on'](_0x35c4('0x16'),function(){return _0x4e42ca(_0x420330);});}catch(_0x17953c){fs[_0x35c4('0x17')](_0x420330);return _0x248cea(_0x17953c);}});});};exports[_0x35c4('0x18')]=function(_0x39dbf8,_0x51a30a,_0x13e4d4,_0x2a617b){return new BPromise(function(_0x3328d0,_0x458188){_0x2a617b=combineOptions(_0x2a617b);var _0x1b7c78=new Buffer(_0x13e4d4);var _0x17cd7a=fs[_0x35c4('0xe')](_0x39dbf8);var _0x905829=fs['createWriteStream'](_0x51a30a);var _0x245870=crypto[_0x35c4('0x19')](_0x2a617b['algorithm'],_0x1b7c78);_0x17cd7a['on']('data',function(_0x133faa){var _0x43bee5=new Buffer(_0x245870['update'](_0x133faa),'binary');_0x905829[_0x35c4('0x14')](_0x43bee5);});_0x17cd7a['on'](_0x35c4('0x15'),function(){try{var _0x4e6baa=new Buffer(_0x245870[_0x35c4('0x13')](_0x35c4('0x12')),_0x35c4('0x12'));_0x905829[_0x35c4('0x14')](_0x4e6baa);_0x905829[_0x35c4('0x15')]();_0x905829['on'](_0x35c4('0x16'),function(){return _0x3328d0(_0x51a30a);});}catch(_0x573264){fs[_0x35c4('0x17')](_0x51a30a);return _0x458188(_0x573264);}});});};exports[_0x35c4('0x1a')]=function(_0x2c5a1a,_0x54d78c,_0x59b711){var _0x56ca90=_0x59b711||stringOptions[_0x35c4('0x7')];var _0x124ab4=_0x54d78c||stringOptions[_0x35c4('0x1b')];var _0x250ad3=crypto[_0x35c4('0x1c')](_0x56ca90,_0x124ab4);var _0x3600b8=_0x250ad3[_0x35c4('0x11')](_0x2c5a1a,_0x35c4('0x1d'),'base64');_0x3600b8+=_0x250ad3[_0x35c4('0x13')](_0x35c4('0x1e'));return _0x3600b8;};exports['decryptString']=function(_0x21d34d,_0x339271,_0x170ac6){var _0x5ba4a0=_0x170ac6||stringOptions[_0x35c4('0x7')];var _0x1fe978=_0x339271||stringOptions['secret'];var _0x59a00f=crypto[_0x35c4('0x19')](_0x5ba4a0,_0x1fe978);var _0x19fd83=_0x59a00f['update'](_0x21d34d,_0x35c4('0x1e'),_0x35c4('0x1d'));_0x19fd83+=_0x59a00f[_0x35c4('0x13')](_0x35c4('0x1d'));return _0x19fd83;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 724ac6a..3860fb8 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 _0x933a=['each','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','dbH','../../config/logger','argv','savename','update','info','format','Setting','find','split','splitSizeCsv','then','query','sequelize','QueryTypes','SELECT','Empty','length','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','.csv','existsSync','join','mkdirSync'];(function(_0x2f646a,_0x3f5ca7){var _0x1ca740=function(_0x1e2bdc){while(--_0x1e2bdc){_0x2f646a['push'](_0x2f646a['shift']());}};_0x1ca740(++_0x3f5ca7);}(_0x933a,0x1ef));var _0xa933=function(_0x21aa2a,_0x398c4a){_0x21aa2a=_0x21aa2a-0x0;var _0x229988=_0x933a[_0x21aa2a];return _0x229988;};'use strict';var util=require(_0xa933('0x0'));var path=require('path');var _=require(_0xa933('0x1'));var csv=require(_0xa933('0x2'));var fs=require('fs');var BPromise=require(_0xa933('0x3'));var zipdir=require(_0xa933('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xa933('0x5')];var logger=require(_0xa933('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa933('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x25af0a,_0x2c69cc){var _0x1741f0={'status':_0x25af0a};var _0x31b8e9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c69cc){_0x1741f0[_0xa933('0x8')]=_0x2c69cc;}return db['AnalyticExtractedReport'][_0xa933('0x9')](_0x1741f0,_0x31b8e9);}function main(){var _0x3de5dd=0x1388;var _0x4fdcd8;logger[_0xa933('0xa')](util[_0xa933('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xa933('0xc')][_0xa933('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa933('0xe'),_0xa933('0xf')]})[_0xa933('0x10')](function(_0x1174ca){if(_0x1174ca){_0x4fdcd8=_0x1174ca;_0x3de5dd=_0x4fdcd8['splitSizeCsv']||0x1388;}})[_0xa933('0x10')](function(){return dbH['sequelize'][_0xa933('0x11')](util[_0xa933('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa933('0x12')][_0xa933('0x13')][_0xa933('0x14')]});})[_0xa933('0x10')](function(_0x3a0265){if(!_0x3a0265[0x0]['num']){return analyticExtractedReport(_0xa933('0x15'));}var _0x5597f6=[];var _0x13bc69=0x0;if(_0x4fdcd8['split']){if(_0x3a0265&&_0x3a0265[_0xa933('0x16')]){var _0x14ea91=_['range'](_0x3a0265[0x0][_0xa933('0x17')]/_0x3de5dd);var _0xb6e4cd=Number[_0xa933('0x18')](_0x3a0265[0x0]['num']/_0x3de5dd)?_0x3a0265[0x0]['num']%_0x3de5dd:0x0;_0x14ea91[_0xa933('0x19')](function(_0x491dbe){if(_0x491dbe>0x0){_0x13bc69+=_0x3de5dd;}_0x5597f6['push'](dbH[_0xa933('0x12')][_0xa933('0x11')](util[_0xa933('0xb')](_0xa933('0x1a'),QUERY,_0x3de5dd,_0x13bc69),{'type':dbH[_0xa933('0x12')][_0xa933('0x13')]['SELECT']}));});if(_0xb6e4cd>0x0){_0x13bc69+=_0x3de5dd;_0x5597f6[_0xa933('0x1b')](dbH[_0xa933('0x12')][_0xa933('0x11')](util['format'](_0xa933('0x1a'),QUERY,_0xb6e4cd,_0x13bc69),{'type':dbH[_0xa933('0x12')]['QueryTypes'][_0xa933('0x14')]}));}}}else{_0x5597f6[_0xa933('0x1b')](dbH[_0xa933('0x12')][_0xa933('0x11')](QUERY,{'type':dbH['sequelize'][_0xa933('0x13')][_0xa933('0x14')]}));}var _0x71fc6e=path['dirname'](PATH);var _0x19c8cf=path[_0xa933('0x1c')](PATH,_0xa933('0x1d'));var _0x38ac57=_0x4fdcd8['split']&&_0x5597f6[_0xa933('0x16')]>0x1;var _0x3bfa6d=[];if(!fs[_0xa933('0x1e')](path[_0xa933('0x1f')](_0x71fc6e,_0x19c8cf))&&_0x38ac57){fs[_0xa933('0x20')](path[_0xa933('0x1f')](_0x71fc6e,_0x19c8cf));}return BPromise[_0xa933('0x21')](_0x5597f6,function(_0x59e055){_0x3bfa6d['push'](_0x59e055);})['then'](function(){for(var _0x300769=0x0;_0x300769<_0x3bfa6d[_0xa933('0x16')];_0x300769+=0x1){var _0x1fe411;var _0x402cc3=_0x3bfa6d[_0x300769];if(_0x38ac57){_0x1fe411=path[_0xa933('0x1f')](_0x71fc6e,_0x19c8cf,util['format'](_0xa933('0x22'),_0x19c8cf,_0x300769,'csv'));}else{_0x1fe411=path[_0xa933('0x1f')](_0x71fc6e,util['format'](_0xa933('0x23'),_0x19c8cf,_0xa933('0x24')));}fs[_0xa933('0x25')](_0x1fe411,csv(_0x402cc3));}})['then'](function(){if(_0x38ac57){return new Promise(function(_0x11ca3f){zipdir(path[_0xa933('0x1f')](_0x71fc6e,_0x19c8cf),{'saveTo':path[_0xa933('0x1f')](_0x71fc6e,util[_0xa933('0xb')](_0xa933('0x23'),_0x19c8cf,_0xa933('0x26')))},function(_0x3e6259,_0x393cfd){rimraf(path[_0xa933('0x1f')](_0x71fc6e,_0x19c8cf),function(){});_0x11ca3f('zip\x20finished');});});}})[_0xa933('0x10')](function(){logger['info'](util['format'](_0xa933('0x27'),EXTRACTED_REPORT_ID,_0xa933('0x28')));return analyticExtractedReport(_0xa933('0x29'),_0x38ac57?util[_0xa933('0xb')]('%s.%s',_0x19c8cf,_0x38ac57?'zip':'csv'):null);});})[_0xa933('0x2a')](function(_0x4cb114){logger[_0xa933('0xa')](util[_0xa933('0xb')](_0xa933('0x2b'),EXTRACTED_REPORT_ID,_0xa933('0x28')),util[_0xa933('0x2c')](_0x4cb114,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa933('0x2d'));})[_0xa933('0x2e')](function(){process[_0xa933('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xad6d=['csv','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','path','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','mkdirSync','each'];(function(_0x56c56d,_0x431b80){var _0x1cabc3=function(_0x218d9c){while(--_0x218d9c){_0x56c56d['push'](_0x56c56d['shift']());}};_0x1cabc3(++_0x431b80);}(_0xad6d,0x143));var _0xdad6=function(_0x5f3f64,_0x1e8de8){_0x5f3f64=_0x5f3f64-0x0;var _0x18f660=_0xad6d[_0x5f3f64];return _0x18f660;};'use strict';var util=require('util');var path=require(_0xdad6('0x0'));var _=require('lodash');var csv=require(_0xdad6('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xdad6('0x2'));var rimraf=require(_0xdad6('0x3'));var db=require(_0xdad6('0x4'))['db'];var dbH=require(_0xdad6('0x4'))[_0xdad6('0x5')];var logger=require(_0xdad6('0x6'))(_0xdad6('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdad6('0x8')][0x3];var PATH=process[_0xdad6('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x33238a,_0x1b8881){var _0x16f34a={'status':_0x33238a};var _0x18d1f5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b8881){_0x16f34a[_0xdad6('0x9')]=_0x1b8881;}return db[_0xdad6('0xa')][_0xdad6('0xb')](_0x16f34a,_0x18d1f5);}function main(){var _0x5255ab=0x1388;var _0x27cc83;logger[_0xdad6('0xc')](util[_0xdad6('0xd')](_0xdad6('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xdad6('0xf')][_0xdad6('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdad6('0x11'),_0xdad6('0x12')]})[_0xdad6('0x13')](function(_0x5090db){if(_0x5090db){_0x27cc83=_0x5090db;_0x5255ab=_0x27cc83[_0xdad6('0x12')]||0x1388;}})[_0xdad6('0x13')](function(){return dbH[_0xdad6('0x14')][_0xdad6('0x15')](util['format'](_0xdad6('0x16'),QUERY),{'type':dbH[_0xdad6('0x14')][_0xdad6('0x17')][_0xdad6('0x18')]});})['then'](function(_0x3698f8){if(!_0x3698f8[0x0][_0xdad6('0x19')]){return analyticExtractedReport(_0xdad6('0x1a'));}var _0x2ea6ea=[];var _0x195a81=0x0;if(_0x27cc83[_0xdad6('0x11')]){if(_0x3698f8&&_0x3698f8[_0xdad6('0x1b')]){var _0x1f90c1=_[_0xdad6('0x1c')](_0x3698f8[0x0][_0xdad6('0x19')]/_0x5255ab);var _0x1f3837=Number['isInteger'](_0x3698f8[0x0][_0xdad6('0x19')]/_0x5255ab)?_0x3698f8[0x0]['num']%_0x5255ab:0x0;_0x1f90c1[_0xdad6('0x1d')](function(_0x185c1a){if(_0x185c1a>0x0){_0x195a81+=_0x5255ab;}_0x2ea6ea[_0xdad6('0x1e')](dbH[_0xdad6('0x14')][_0xdad6('0x15')](util[_0xdad6('0xd')](_0xdad6('0x1f'),QUERY,_0x5255ab,_0x195a81),{'type':dbH[_0xdad6('0x14')][_0xdad6('0x17')]['SELECT']}));});if(_0x1f3837>0x0){_0x195a81+=_0x5255ab;_0x2ea6ea[_0xdad6('0x1e')](dbH[_0xdad6('0x14')][_0xdad6('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1f3837,_0x195a81),{'type':dbH[_0xdad6('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x2ea6ea[_0xdad6('0x1e')](dbH[_0xdad6('0x14')]['query'](QUERY,{'type':dbH[_0xdad6('0x14')][_0xdad6('0x17')]['SELECT']}));}var _0x201e16=path['dirname'](PATH);var _0x48fd61=path[_0xdad6('0x20')](PATH,_0xdad6('0x21'));var _0x3b8bb1=_0x27cc83[_0xdad6('0x11')]&&_0x2ea6ea['length']>0x1;var _0x1141b3=[];if(!fs['existsSync'](path[_0xdad6('0x22')](_0x201e16,_0x48fd61))&&_0x3b8bb1){fs[_0xdad6('0x23')](path['join'](_0x201e16,_0x48fd61));}return BPromise[_0xdad6('0x24')](_0x2ea6ea,function(_0x51d8c1){_0x1141b3[_0xdad6('0x1e')](_0x51d8c1);})['then'](function(){for(var _0x3a46d9=0x0;_0x3a46d9<_0x1141b3['length'];_0x3a46d9+=0x1){var _0x3f65ec;var _0x3daecd=_0x1141b3[_0x3a46d9];if(_0x3b8bb1){_0x3f65ec=path[_0xdad6('0x22')](_0x201e16,_0x48fd61,util[_0xdad6('0xd')]('%s%d.%s',_0x48fd61,_0x3a46d9,_0xdad6('0x25')));}else{_0x3f65ec=path[_0xdad6('0x22')](_0x201e16,util[_0xdad6('0xd')](_0xdad6('0x26'),_0x48fd61,_0xdad6('0x25')));}fs['writeFileSync'](_0x3f65ec,csv(_0x3daecd));}})[_0xdad6('0x13')](function(){if(_0x3b8bb1){return new Promise(function(_0x3d02c7){zipdir(path[_0xdad6('0x22')](_0x201e16,_0x48fd61),{'saveTo':path[_0xdad6('0x22')](_0x201e16,util[_0xdad6('0xd')](_0xdad6('0x26'),_0x48fd61,'zip'))},function(_0x1f9e90,_0x1403c4){rimraf(path[_0xdad6('0x22')](_0x201e16,_0x48fd61),function(){});_0x3d02c7('zip\x20finished');});});}})[_0xdad6('0x13')](function(){logger[_0xdad6('0xc')](util['format'](_0xdad6('0x27'),EXTRACTED_REPORT_ID,_0xdad6('0x28')));return analyticExtractedReport('Completed',_0x3b8bb1?util[_0xdad6('0xd')](_0xdad6('0x26'),_0x48fd61,_0x3b8bb1?_0xdad6('0x29'):_0xdad6('0x25')):null);});})['catch'](function(_0x368614){logger[_0xdad6('0xc')](util[_0xdad6('0xd')](_0xdad6('0x2a'),EXTRACTED_REPORT_ID,_0xdad6('0x28')),util[_0xdad6('0x2b')](_0x368614,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xdad6('0x2c')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 17ec17c..046d673 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 _0x745a=['zip','zip\x20finished','info','Completed','%s.%s','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','tableHeader','toString','value','fill','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','find','split','splitSizePdf','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','basename','.pdf','existsSync','join','each','then','flatten','%s%d.%s','pdf'];(function(_0x23d6e7,_0x24a914){var _0x139d82=function(_0x15b0ca){while(--_0x15b0ca){_0x23d6e7['push'](_0x23d6e7['shift']());}};_0x139d82(++_0x24a914);}(_0x745a,0x1ed));var _0xa745=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x745a[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xa745('0x0'));var fs=require('fs');var util=require(_0xa745('0x1'));var path=require(_0xa745('0x2'));var moment=require(_0xa745('0x3'));var htmlToPdfmake=require(_0xa745('0x4'));var PdfPrinter=require(_0xa745('0x5'));var zipdir=require(_0xa745('0x6'));var rimraf=require(_0xa745('0x7'));var JSDOM=require(_0xa745('0x8'))[_0xa745('0x9')];var window=new JSDOM('')[_0xa745('0xa')];var BPromise=require(_0xa745('0xb'));var db=require(_0xa745('0xc'))['db'];var dbH=require(_0xa745('0xc'))[_0xa745('0xd')];var logger=require(_0xa745('0xe'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa745('0xf')][0x3];var PATH=process[_0xa745('0xf')][0x4];var NAME=process[_0xa745('0xf')][0x5];var FORMAT=_0xa745('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5e6b07,_0x43d475){var _0xa20a49={'status':_0x5e6b07};var _0x22fa5c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43d475){_0xa20a49['savename']=_0x43d475;}return db['AnalyticExtractedReport'][_0xa745('0x11')](_0xa20a49,_0x22fa5c);}function getHeaders(_0x4cc11b){return _[_0xa745('0x12')](_0x4cc11b,function(_0x5e0736){return{'text':_0x5e0736,'style':_0xa745('0x13')};});}function getRows(_0x583434,_0xdb7acd){return _[_0xa745('0x12')](_0xdb7acd,function(_0x327078){return _(_0x327078)['pick'](_0x583434)[_0xa745('0x12')](function(_0x274b54){return _0x274b54?_[_0xa745('0x14')](_0x274b54):'';})[_0xa745('0x15')]();});}function createTable(_0x13d3de,_0x34315d){var _0x42669f={'widths':_[_0xa745('0x16')](Array(_0x13d3de['length']),0x91),'heights':function(_0x1f50ae){return _0x1f50ae===0x0?_0xa745('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4cc7af=getHeaders(_0x13d3de);_0x42669f[_0xa745('0x18')][_0xa745('0x19')](_0x4cc7af);var _0x27661f=getRows(_0x13d3de,_0x34315d);_0x42669f[_0xa745('0x18')]=_0x42669f[_0xa745('0x18')][_0xa745('0x1a')](_0x27661f);return _0x42669f;}function createTables(_0x5b6786){var _0x19d028=[];var _0x2d3396=_[_0xa745('0x1b')](Object[_0xa745('0x1c')](_0x5b6786[0x0]),0x5);_0x2d3396[_0xa745('0x1d')](function(_0x27a32e){_0x19d028[_0xa745('0x19')](createTable(_0x27a32e,_0x5b6786));});return _0x19d028;}function getPDFDocDefinition(_0x39f2ee){var _0x3748bc=util[_0xa745('0x1e')](_0xa745('0x1f'),NAME,EXTRACTED_REPORT[_0xa745('0x20')],moment(EXTRACTED_REPORT[_0xa745('0x21')])[_0xa745('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xa745('0x22')])[_0xa745('0x1e')](FORMAT));var _0x5e17af=[];for(var _0x441d84=0x0;_0x441d84<_0x39f2ee[_0xa745('0x23')];_0x441d84++){var _0x1a15eb=[];if(_0x441d84===0x0){_0x1a15eb['push']({'text':_0x3748bc,'style':_0xa745('0x24')});}var _0x204b93={'table':_0x39f2ee[_0x441d84]};if(_0x441d84>0x0){_0x204b93['pageBreak']='before';_0x204b93[_0xa745('0x25')]=[0x0,0x46,0x0,0x0];}_0x1a15eb[_0xa745('0x19')](_0x204b93);_0x5e17af[_0xa745('0x19')](_0x1a15eb);}return{'pageSize':'A4','pageOrientation':_0xa745('0x26'),'content':_0x5e17af,'footer':function(_0x12ef77,_0x2258ba){return{'text':_0x12ef77[_0xa745('0x14')]()+_0xa745('0x27')+_0x2258ba,'style':_0xa745('0x28')};},'defaultStyle':{'font':_0xa745('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa745('0x2a')},'footer':{'alignment':_0xa745('0x2b'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x449706){var _0x3c580a=0x1388;var _0xdbeb4f;if(!_0x449706[0x0][_0xa745('0x2c')]){return analyticExtractedReport(_0xa745('0x2d'));}return db['Setting'][_0xa745('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa745('0x2f'),_0xa745('0x30')]})['then'](function(_0x1d54ec){if(_0x1d54ec){_0xdbeb4f=_0x1d54ec;_0x3c580a=_0xdbeb4f[_0xa745('0x30')]||0x3e8;}})['then'](function(){var _0xcb3012=[];var _0x8203cc=0x0;if(_0xdbeb4f[_0xa745('0x2f')]){if(_0x449706&&_0x449706['length']){var _0x415229=_[_0xa745('0x31')](_0x449706[0x0][_0xa745('0x2c')]/_0x3c580a);var _0x432bce=Number[_0xa745('0x32')](_0x449706[0x0][_0xa745('0x2c')]/_0x3c580a)?_0x449706[0x0][_0xa745('0x2c')]%_0x3c580a:0x0;_0x415229['forEach'](function(_0x1ddadf){if(_0x1ddadf>0x0){_0x8203cc+=_0x3c580a;}_0xcb3012[_0xa745('0x19')](dbH['sequelize']['query'](util[_0xa745('0x1e')](_0xa745('0x33'),QUERY,_0x3c580a,_0x8203cc),{'type':dbH[_0xa745('0x34')][_0xa745('0x35')][_0xa745('0x36')]}));});if(_0x432bce>0x0){_0x8203cc+=_0x3c580a;_0xcb3012[_0xa745('0x19')](dbH[_0xa745('0x34')]['query'](util[_0xa745('0x1e')](_0xa745('0x33'),QUERY,_0x432bce,_0x8203cc),{'type':dbH[_0xa745('0x34')][_0xa745('0x35')]['SELECT']}));}}}else{_0xcb3012[_0xa745('0x19')](dbH[_0xa745('0x34')][_0xa745('0x37')](QUERY,{'type':dbH['sequelize'][_0xa745('0x35')]['SELECT']}));}var _0x4ca282=path['dirname'](PATH);var _0x367bbf=path[_0xa745('0x38')](PATH,_0xa745('0x39'));var _0x21b8b1=_0xdbeb4f[_0xa745('0x2f')]&&_0xcb3012[_0xa745('0x23')]>0x1;var _0x38ce72=[];if(!fs[_0xa745('0x3a')](path['join'](_0x4ca282,_0x367bbf))&&_0x21b8b1){fs['mkdirSync'](path[_0xa745('0x3b')](_0x4ca282,_0x367bbf));}return BPromise[_0xa745('0x3c')](_0xcb3012,function(_0x18c5fd){_0x38ce72[_0xa745('0x19')](_0x18c5fd);})[_0xa745('0x3d')](function(){var _0x3e6f37=[];for(var _0x53a8de=0x0;_0x53a8de<_0x38ce72['length'];_0x53a8de+=0x1){var _0x4d2e13=_0x38ce72[_0x53a8de];var _0x40e025=createTables(_[_0xa745('0x3e')](_0x4d2e13));var _0x29f6f3;var _0x4c381a=getPDFDocDefinition(_0x40e025);var _0x460504=getPDFPrinter();var _0x44dd3f=_0x460504['createPdfKitDocument'](_0x4c381a);if(_0x21b8b1){_0x29f6f3=path[_0xa745('0x3b')](_0x4ca282,_0x367bbf,util[_0xa745('0x1e')](_0xa745('0x3f'),_0x367bbf,_0x53a8de,_0xa745('0x40')));}else{_0x29f6f3=path[_0xa745('0x3b')](_0x4ca282,util[_0xa745('0x1e')]('%s.%s',_0x367bbf,_0xa745('0x40')));}_0x3e6f37[_0xa745('0x19')](writePDFDocument(_0x44dd3f,_0x29f6f3));}return Promise['all'](_0x3e6f37);})[_0xa745('0x3d')](function(){if(_0x21b8b1){return new Promise(function(_0x16370a){zipdir(path[_0xa745('0x3b')](_0x4ca282,_0x367bbf),{'saveTo':path[_0xa745('0x3b')](_0x4ca282,util[_0xa745('0x1e')]('%s.%s',_0x367bbf,_0xa745('0x41')))},function(){rimraf(path[_0xa745('0x3b')](_0x4ca282,_0x367bbf),function(){});_0x16370a(_0xa745('0x42'));});});}})[_0xa745('0x3d')](function(){if(!_0x21b8b1)return;rimraf(path[_0xa745('0x3b')](_0x4ca282,_0x367bbf),function(){});})[_0xa745('0x3d')](function(){logger[_0xa745('0x43')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xa745('0x44'),_0x21b8b1?util[_0xa745('0x1e')](_0xa745('0x45'),_0x367bbf,_0x21b8b1?'zip':_0xa745('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xa745('0x1e')](_0xa745('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xa745('0x47')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa745('0x3d')](function(_0x1e6d17){EXTRACTED_REPORT=_0x1e6d17;return dbH[_0xa745('0x34')][_0xa745('0x37')](util[_0xa745('0x1e')](_0xa745('0x48'),QUERY),{'type':dbH[_0xa745('0x34')]['QueryTypes'][_0xa745('0x36')]});})['then'](extractReport)[_0xa745('0x49')](function(_0x3ad2df){logger['info'](util[_0xa745('0x1e')](_0xa745('0x4a'),EXTRACTED_REPORT_ID,_0xa745('0x4b')),util[_0xa745('0x4c')](_0x3ad2df,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa745('0x4d')](function(){process[_0xa745('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x32e50d=new PdfPrinter({'Arial':{'normal':__dirname+_0xa745('0x4f'),'bold':__dirname+_0xa745('0x50'),'italics':__dirname+_0xa745('0x51'),'bolditalics':__dirname+_0xa745('0x52')}});return _0x32e50d;}function getPDFDocDefinitionFromHTML(_0x13582b,_0x28089d){var _0x229c2e=util[_0xa745('0x1e')]('%s\x20#%d',_0x28089d['channel'],_0x28089d['interactionId']);var _0x2eaa2c=moment()[_0xa745('0x1e')](_0xa745('0x53'))['toString']();var _0x4ea895=htmlToPdfmake(_0x13582b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4ea895],'defaultStyle':{'font':_0xa745('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa745('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xa745('0x55'),'style':_0xa745('0x24')}];},'footer':function(_0x4fe610,_0x572223){return[{'text':util[_0xa745('0x1e')](_0xa745('0x56'),_0x229c2e,_0x4fe610,_0x572223,_0x2eaa2c),'style':_0xa745('0x28')}];}};}function writePDFDocument(_0x367404,_0x565b31){return new Promise(function(_0x59dc2f,_0x4f375a){var _0x295f3a=_0x367404[_0xa745('0x57')](fs['createWriteStream'](_0x565b31));_0x295f3a['on'](_0xa745('0x58'),function(){_0x59dc2f('finish');});_0x295f3a['on'](_0xa745('0x59'),function(_0x3a341f){_0x4f375a(_0x3a341f);});_0x367404[_0xa745('0x5a')]();});}exports[_0xa745('0x5b')]=function(_0x1c7a95,_0x5c6e8b){var _0xe59907=getPDFPrinter();var _0x24b75d=getPDFDocDefinitionFromHTML(_0x1c7a95,_0x5c6e8b);var _0xdbcd4f=_0xe59907[_0xa745('0x5c')](_0x24b75d);return writePDFDocument(_0xdbcd4f,_0x5c6e8b[_0xa745('0x2')])[_0xa745('0x49')](function(_0x2e0eb1){throw _0x2e0eb1;});}; \ No newline at end of file +var _0xde36=['findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','PDF','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','util','path','moment','pdfmake/src/printer','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','push','header','pageBreak','before','margin','Arial','black','right','Empty','Setting','split','then','splitSizePdf','num','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','info','AnalyticExtractedReport'];(function(_0xbe8733,_0x5360f3){var _0x1d5823=function(_0x8c2d85){while(--_0x8c2d85){_0xbe8733['push'](_0xbe8733['shift']());}};_0x1d5823(++_0x5360f3);}(_0xde36,0x71));var _0x6de3=function(_0x4330e5,_0x141433){_0x4330e5=_0x4330e5-0x0;var _0x1363ff=_0xde36[_0x4330e5];return _0x1363ff;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x6de3('0x0'));var path=require(_0x6de3('0x1'));var moment=require(_0x6de3('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x6de3('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x6de3('0x4'))[_0x6de3('0x5')];var window=new JSDOM('')[_0x6de3('0x6')];var BPromise=require(_0x6de3('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6de3('0x8'))['dbH'];var logger=require(_0x6de3('0x9'))(_0x6de3('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x6de3('0xb')][0x2]);var QUERY=process[_0x6de3('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x6de3('0xb')][0x5];var FORMAT=_0x6de3('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cf891,_0x39b172){var _0x3065ad={'status':_0x5cf891};var _0x3cb069={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x39b172){_0x3065ad[_0x6de3('0xd')]=_0x39b172;}return db['AnalyticExtractedReport'][_0x6de3('0xe')](_0x3065ad,_0x3cb069);}function getHeaders(_0xf8eb85){return _[_0x6de3('0xf')](_0xf8eb85,function(_0xdd4c13){return{'text':_0xdd4c13,'style':_0x6de3('0x10')};});}function getRows(_0x5aad99,_0x5d7da6){return _[_0x6de3('0xf')](_0x5d7da6,function(_0x1cc596){return _(_0x1cc596)[_0x6de3('0x11')](_0x5aad99)[_0x6de3('0xf')](function(_0x665dc7){return _0x665dc7?_[_0x6de3('0x12')](_0x665dc7):'';})[_0x6de3('0x13')]();});}function createTable(_0x3e397d,_0x139c1b){var _0x17c708={'widths':_[_0x6de3('0x14')](Array(_0x3e397d[_0x6de3('0x15')]),0x91),'heights':function(_0x4d494c){return _0x4d494c===0x0?_0x6de3('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x488148=getHeaders(_0x3e397d);_0x17c708[_0x6de3('0x17')]['push'](_0x488148);var _0x2af54d=getRows(_0x3e397d,_0x139c1b);_0x17c708[_0x6de3('0x17')]=_0x17c708['body'][_0x6de3('0x18')](_0x2af54d);return _0x17c708;}function createTables(_0x1e34e2){var _0x1996b8=[];var _0x14e174=_[_0x6de3('0x19')](Object[_0x6de3('0x1a')](_0x1e34e2[0x0]),0x5);_0x14e174[_0x6de3('0x1b')](function(_0x3c3145){_0x1996b8['push'](createTable(_0x3c3145,_0x1e34e2));});return _0x1996b8;}function getPDFDocDefinition(_0xd42f9a){var _0x3a865e=util[_0x6de3('0x1c')](_0x6de3('0x1d'),NAME,EXTRACTED_REPORT[_0x6de3('0x1e')],moment(EXTRACTED_REPORT[_0x6de3('0x1f')])[_0x6de3('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x6de3('0x20')])[_0x6de3('0x1c')](FORMAT));var _0x38ec66=[];for(var _0x199b86=0x0;_0x199b86<_0xd42f9a[_0x6de3('0x15')];_0x199b86++){var _0x1e2cce=[];if(_0x199b86===0x0){_0x1e2cce[_0x6de3('0x21')]({'text':_0x3a865e,'style':_0x6de3('0x22')});}var _0x5100b9={'table':_0xd42f9a[_0x199b86]};if(_0x199b86>0x0){_0x5100b9[_0x6de3('0x23')]=_0x6de3('0x24');_0x5100b9[_0x6de3('0x25')]=[0x0,0x46,0x0,0x0];}_0x1e2cce[_0x6de3('0x21')](_0x5100b9);_0x38ec66[_0x6de3('0x21')](_0x1e2cce);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x38ec66,'footer':function(_0x2c486d,_0x3aa173){return{'text':_0x2c486d[_0x6de3('0x12')]()+'\x20/\x20'+_0x3aa173,'style':'footer'};},'defaultStyle':{'font':_0x6de3('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x6de3('0x27')},'footer':{'alignment':_0x6de3('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xb73fcd){var _0x5a37d4=0x1388;var _0x350b84;if(!_0xb73fcd[0x0]['num']){return analyticExtractedReport(_0x6de3('0x29'));}return db[_0x6de3('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6de3('0x2b'),'splitSizePdf']})[_0x6de3('0x2c')](function(_0x3c5988){if(_0x3c5988){_0x350b84=_0x3c5988;_0x5a37d4=_0x350b84[_0x6de3('0x2d')]||0x3e8;}})[_0x6de3('0x2c')](function(){var _0x2a24da=[];var _0x4af169=0x0;if(_0x350b84[_0x6de3('0x2b')]){if(_0xb73fcd&&_0xb73fcd[_0x6de3('0x15')]){var _0x537e7e=_['range'](_0xb73fcd[0x0]['num']/_0x5a37d4);var _0x446d43=Number['isInteger'](_0xb73fcd[0x0]['num']/_0x5a37d4)?_0xb73fcd[0x0][_0x6de3('0x2e')]%_0x5a37d4:0x0;_0x537e7e['forEach'](function(_0x4bad34){if(_0x4bad34>0x0){_0x4af169+=_0x5a37d4;}_0x2a24da[_0x6de3('0x21')](dbH[_0x6de3('0x2f')][_0x6de3('0x30')](util[_0x6de3('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a37d4,_0x4af169),{'type':dbH[_0x6de3('0x2f')][_0x6de3('0x31')][_0x6de3('0x32')]}));});if(_0x446d43>0x0){_0x4af169+=_0x5a37d4;_0x2a24da[_0x6de3('0x21')](dbH[_0x6de3('0x2f')][_0x6de3('0x30')](util[_0x6de3('0x1c')](_0x6de3('0x33'),QUERY,_0x446d43,_0x4af169),{'type':dbH['sequelize']['QueryTypes'][_0x6de3('0x32')]}));}}}else{_0x2a24da[_0x6de3('0x21')](dbH[_0x6de3('0x2f')][_0x6de3('0x30')](QUERY,{'type':dbH[_0x6de3('0x2f')][_0x6de3('0x31')]['SELECT']}));}var _0x2da015=path['dirname'](PATH);var _0x3f08fd=path[_0x6de3('0x34')](PATH,_0x6de3('0x35'));var _0x32ff4d=_0x350b84[_0x6de3('0x2b')]&&_0x2a24da[_0x6de3('0x15')]>0x1;var _0xe80c0d=[];if(!fs[_0x6de3('0x36')](path[_0x6de3('0x37')](_0x2da015,_0x3f08fd))&&_0x32ff4d){fs[_0x6de3('0x38')](path[_0x6de3('0x37')](_0x2da015,_0x3f08fd));}return BPromise[_0x6de3('0x39')](_0x2a24da,function(_0x40f987){_0xe80c0d[_0x6de3('0x21')](_0x40f987);})[_0x6de3('0x2c')](function(){var _0x583033=[];for(var _0x5a0372=0x0;_0x5a0372<_0xe80c0d[_0x6de3('0x15')];_0x5a0372+=0x1){var _0x427ba0=_0xe80c0d[_0x5a0372];var _0x3d3785=createTables(_['flatten'](_0x427ba0));var _0x4ff350;var _0x269264=getPDFDocDefinition(_0x3d3785);var _0x28de2e=getPDFPrinter();var _0x2e6f81=_0x28de2e[_0x6de3('0x3a')](_0x269264);if(_0x32ff4d){_0x4ff350=path[_0x6de3('0x37')](_0x2da015,_0x3f08fd,util[_0x6de3('0x1c')](_0x6de3('0x3b'),_0x3f08fd,_0x5a0372,_0x6de3('0x3c')));}else{_0x4ff350=path[_0x6de3('0x37')](_0x2da015,util[_0x6de3('0x1c')](_0x6de3('0x3d'),_0x3f08fd,_0x6de3('0x3c')));}_0x583033[_0x6de3('0x21')](writePDFDocument(_0x2e6f81,_0x4ff350));}return Promise[_0x6de3('0x3e')](_0x583033);})['then'](function(){if(_0x32ff4d){return new Promise(function(_0x2aa714){zipdir(path[_0x6de3('0x37')](_0x2da015,_0x3f08fd),{'saveTo':path[_0x6de3('0x37')](_0x2da015,util[_0x6de3('0x1c')](_0x6de3('0x3d'),_0x3f08fd,'zip'))},function(){rimraf(path[_0x6de3('0x37')](_0x2da015,_0x3f08fd),function(){});_0x2aa714(_0x6de3('0x3f'));});});}})[_0x6de3('0x2c')](function(){if(!_0x32ff4d)return;rimraf(path['join'](_0x2da015,_0x3f08fd),function(){});})[_0x6de3('0x2c')](function(){logger['info'](util[_0x6de3('0x1c')](_0x6de3('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x6de3('0x41'),_0x32ff4d?util[_0x6de3('0x1c')](_0x6de3('0x3d'),_0x3f08fd,_0x32ff4d?_0x6de3('0x42'):_0x6de3('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x6de3('0x43')](util[_0x6de3('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x6de3('0x44')][_0x6de3('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x31965f){EXTRACTED_REPORT=_0x31965f;return dbH[_0x6de3('0x2f')]['query'](util[_0x6de3('0x1c')](_0x6de3('0x46'),QUERY),{'type':dbH[_0x6de3('0x2f')]['QueryTypes'][_0x6de3('0x32')]});})[_0x6de3('0x2c')](extractReport)[_0x6de3('0x47')](function(_0x23e531){logger[_0x6de3('0x43')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6de3('0x48')),util[_0x6de3('0x49')](_0x23e531,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6de3('0x4a'));})['finally'](function(){process[_0x6de3('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9befca=new PdfPrinter({'Arial':{'normal':__dirname+_0x6de3('0x4c'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x6de3('0x4d'),'bolditalics':__dirname+_0x6de3('0x4e')}});return _0x9befca;}function getPDFDocDefinitionFromHTML(_0x59cdbe,_0x5d0ef0){var _0x28bb5b=util[_0x6de3('0x1c')](_0x6de3('0x4f'),_0x5d0ef0[_0x6de3('0x50')],_0x5d0ef0['interactionId']);var _0x4cf681=moment()[_0x6de3('0x1c')](_0x6de3('0x51'))[_0x6de3('0x12')]();var _0xc6c9b=htmlToPdfmake(_0x59cdbe,{'window':window,'tableAutoSize':!![]});return{'content':[_0xc6c9b],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6de3('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x6de3('0x53'),'style':'header'}];},'footer':function(_0x5b85cd,_0x12b520){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x28bb5b,_0x5b85cd,_0x12b520,_0x4cf681),'style':_0x6de3('0x54')}];}};}function writePDFDocument(_0x251077,_0x2ccf4a){return new Promise(function(_0x3985ad,_0x4513ea){var _0x1f903e=_0x251077[_0x6de3('0x55')](fs[_0x6de3('0x56')](_0x2ccf4a));_0x1f903e['on']('finish',function(){_0x3985ad(_0x6de3('0x57'));});_0x1f903e['on'](_0x6de3('0x58'),function(_0x31c95a){_0x4513ea(_0x31c95a);});_0x251077[_0x6de3('0x59')]();});}exports[_0x6de3('0x5a')]=function(_0x33b962,_0xeccd3c){var _0x4bc806=getPDFPrinter();var _0x14055c=getPDFDocDefinitionFromHTML(_0x33b962,_0xeccd3c);var _0x45625f=_0x4bc806[_0x6de3('0x3a')](_0x14055c);return writePDFDocument(_0x45625f,_0xeccd3c[_0x6de3('0x1')])['catch'](function(_0x1fe837){throw _0x1fe837;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3b26ef5..dea6c9f 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 _0xfd11=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xfd11,0xf5));var _0x1fd1=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xfd11[_0x11a55c];return _0x26c390;};'use strict';var util=require('util');var path=require(_0x1fd1('0x0'));var _=require(_0x1fd1('0x1'));var fs=require('fs');var json2xls=require(_0x1fd1('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x1fd1('0x3'));var rimraf=require(_0x1fd1('0x4'));var db=require(_0x1fd1('0x5'))['db'];var dbH=require(_0x1fd1('0x5'))[_0x1fd1('0x6')];var logger=require(_0x1fd1('0x7'))(_0x1fd1('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1fd1('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x53997a,_0x3dad0e){var _0xd6930d={'status':_0x53997a};var _0x3c2546={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3dad0e){_0xd6930d['savename']=_0x3dad0e;}return db[_0x1fd1('0xa')][_0x1fd1('0xb')](_0xd6930d,_0x3c2546);}function main(){var _0x52574b=0x1388;var _0x204abc;logger[_0x1fd1('0xc')](util[_0x1fd1('0xd')](_0x1fd1('0xe'),EXTRACTED_REPORT_ID,_0x1fd1('0xf')));return db['Setting'][_0x1fd1('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1fd1('0x11')]})[_0x1fd1('0x12')](function(_0x900186){if(_0x900186){_0x204abc=_0x900186;_0x52574b=_0x204abc['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x1fd1('0x13')][_0x1fd1('0x14')](util[_0x1fd1('0xd')](_0x1fd1('0x15'),QUERY),{'type':dbH[_0x1fd1('0x13')][_0x1fd1('0x16')][_0x1fd1('0x17')]});})[_0x1fd1('0x12')](function(_0x40c5c7){if(!_0x40c5c7[0x0][_0x1fd1('0x18')]){return analyticExtractedReport(_0x1fd1('0x19'));}var _0x3e65ea=[];var _0x5dd06d=0x0;if(_0x204abc['split']){if(_0x40c5c7&&_0x40c5c7[_0x1fd1('0x1a')]){var _0x291949=_[_0x1fd1('0x1b')](_0x40c5c7[0x0][_0x1fd1('0x18')]/_0x52574b);var _0x1af55b=Number['isInteger'](_0x40c5c7[0x0][_0x1fd1('0x18')]/_0x52574b)?_0x40c5c7[0x0][_0x1fd1('0x18')]%_0x52574b:0x0;_0x291949[_0x1fd1('0x1c')](function(_0x5e8136){if(_0x5e8136>0x0){_0x5dd06d+=_0x52574b;}_0x3e65ea['push'](dbH[_0x1fd1('0x13')][_0x1fd1('0x14')](util[_0x1fd1('0xd')](_0x1fd1('0x1d'),QUERY,_0x52574b,_0x5dd06d),{'type':dbH[_0x1fd1('0x13')][_0x1fd1('0x16')][_0x1fd1('0x17')]}));});if(_0x1af55b>0x0){_0x5dd06d+=_0x52574b;_0x3e65ea[_0x1fd1('0x1e')](dbH[_0x1fd1('0x13')]['query'](util[_0x1fd1('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1af55b,_0x5dd06d),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x3e65ea[_0x1fd1('0x1e')](dbH[_0x1fd1('0x13')][_0x1fd1('0x14')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x60e918=path[_0x1fd1('0x1f')](PATH);var _0x2343f0=path['basename'](PATH,'.xlsx');var _0x37b769=_0x204abc['split']&&_0x3e65ea[_0x1fd1('0x1a')]>0x1;var _0x328306=[];if(!fs[_0x1fd1('0x20')](path[_0x1fd1('0x21')](_0x60e918,_0x2343f0))&&_0x37b769){fs[_0x1fd1('0x22')](path[_0x1fd1('0x21')](_0x60e918,_0x2343f0));}return BPromise[_0x1fd1('0x23')](_0x3e65ea,function(_0x44a7f3){_0x328306['push'](_0x44a7f3);})[_0x1fd1('0x12')](function(){for(var _0x54618e=0x0;_0x54618e<_0x328306[_0x1fd1('0x1a')];_0x54618e+=0x1){var _0x3690c0;var _0x21e395=_0x328306[_0x54618e];if(_0x37b769){_0x3690c0=path[_0x1fd1('0x21')](_0x60e918,_0x2343f0,util['format'](_0x1fd1('0x24'),_0x2343f0,_0x54618e,_0x1fd1('0x25')));}else{_0x3690c0=path[_0x1fd1('0x21')](_0x60e918,util[_0x1fd1('0xd')]('%s.%s',_0x2343f0,_0x1fd1('0x25')));}fs[_0x1fd1('0x26')](_0x3690c0,json2xls(_0x21e395),'binary');}})[_0x1fd1('0x12')](function(){if(_0x37b769){return new Promise(function(_0x34d674){zipdir(path[_0x1fd1('0x21')](_0x60e918,_0x2343f0),{'saveTo':path[_0x1fd1('0x21')](_0x60e918,util[_0x1fd1('0xd')]('%s.%s',_0x2343f0,_0x1fd1('0x27')))},function(_0x3952a5,_0x2a2eba){rimraf(path[_0x1fd1('0x21')](_0x60e918,_0x2343f0),function(){});_0x34d674(_0x1fd1('0x28'));});});}})[_0x1fd1('0x12')](function(){logger[_0x1fd1('0xc')](util['format'](_0x1fd1('0x29'),EXTRACTED_REPORT_ID,_0x1fd1('0xf')));return analyticExtractedReport(_0x1fd1('0x2a'),_0x37b769?util[_0x1fd1('0xd')]('%s.%s',_0x2343f0,_0x37b769?'zip':'xlsx'):null);});})[_0x1fd1('0x2b')](function(_0x19bc44){logger[_0x1fd1('0xc')](util['format'](_0x1fd1('0x2c'),EXTRACTED_REPORT_ID,_0x1fd1('0xf')),util[_0x1fd1('0x2d')](_0x19bc44,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1fd1('0x2e'));})[_0x1fd1('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6c9c=['split','length','range','num','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','Completed','catch','inspect','Failed','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty'];(function(_0x5ab5d9,_0x38a056){var _0x106fb8=function(_0x135e83){while(--_0x135e83){_0x5ab5d9['push'](_0x5ab5d9['shift']());}};_0x106fb8(++_0x38a056);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x217c42,_0xa0e462){_0x217c42=_0x217c42-0x0;var _0x4ddb57=_0x6c9c[_0x217c42];return _0x4ddb57;};'use strict';var util=require(_0xc6c9('0x0'));var path=require(_0xc6c9('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xc6c9('0x2'));var BPromise=require(_0xc6c9('0x3'));var zipdir=require(_0xc6c9('0x4'));var rimraf=require(_0xc6c9('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc6c9('0x6'))[_0xc6c9('0x7')];var logger=require(_0xc6c9('0x8'))(_0xc6c9('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc6c9('0xa')][0x2]);var QUERY=process[_0xc6c9('0xa')][0x3];var PATH=process[_0xc6c9('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd310e9,_0x30db53){var _0x15cf6e={'status':_0xd310e9};var _0xb11c68={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x30db53){_0x15cf6e[_0xc6c9('0xb')]=_0x30db53;}return db[_0xc6c9('0xc')][_0xc6c9('0xd')](_0x15cf6e,_0xb11c68);}function main(){var _0x2fb627=0x1388;var _0x10a3d4;logger[_0xc6c9('0xe')](util[_0xc6c9('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc6c9('0x10')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc6c9('0x11')]})[_0xc6c9('0x12')](function(_0x2d35c9){if(_0x2d35c9){_0x10a3d4=_0x2d35c9;_0x2fb627=_0x10a3d4[_0xc6c9('0x11')]||0x1388;}})[_0xc6c9('0x12')](function(){return dbH[_0xc6c9('0x13')]['query'](util['format'](_0xc6c9('0x14'),QUERY),{'type':dbH[_0xc6c9('0x13')][_0xc6c9('0x15')][_0xc6c9('0x16')]});})[_0xc6c9('0x12')](function(_0x12d501){if(!_0x12d501[0x0]['num']){return analyticExtractedReport(_0xc6c9('0x17'));}var _0x242d20=[];var _0x406add=0x0;if(_0x10a3d4[_0xc6c9('0x18')]){if(_0x12d501&&_0x12d501[_0xc6c9('0x19')]){var _0x35c82c=_[_0xc6c9('0x1a')](_0x12d501[0x0][_0xc6c9('0x1b')]/_0x2fb627);var _0x40d245=Number[_0xc6c9('0x1c')](_0x12d501[0x0][_0xc6c9('0x1b')]/_0x2fb627)?_0x12d501[0x0]['num']%_0x2fb627:0x0;_0x35c82c['forEach'](function(_0x3b46af){if(_0x3b46af>0x0){_0x406add+=_0x2fb627;}_0x242d20[_0xc6c9('0x1d')](dbH[_0xc6c9('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2fb627,_0x406add),{'type':dbH['sequelize'][_0xc6c9('0x15')][_0xc6c9('0x16')]}));});if(_0x40d245>0x0){_0x406add+=_0x2fb627;_0x242d20[_0xc6c9('0x1d')](dbH[_0xc6c9('0x13')][_0xc6c9('0x1e')](util['format'](_0xc6c9('0x1f'),QUERY,_0x40d245,_0x406add),{'type':dbH[_0xc6c9('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x242d20['push'](dbH[_0xc6c9('0x13')][_0xc6c9('0x1e')](QUERY,{'type':dbH[_0xc6c9('0x13')][_0xc6c9('0x15')][_0xc6c9('0x16')]}));}var _0x589dbf=path['dirname'](PATH);var _0xb432ec=path[_0xc6c9('0x20')](PATH,_0xc6c9('0x21'));var _0x5e1817=_0x10a3d4[_0xc6c9('0x18')]&&_0x242d20[_0xc6c9('0x19')]>0x1;var _0x1fe406=[];if(!fs['existsSync'](path['join'](_0x589dbf,_0xb432ec))&&_0x5e1817){fs['mkdirSync'](path[_0xc6c9('0x22')](_0x589dbf,_0xb432ec));}return BPromise[_0xc6c9('0x23')](_0x242d20,function(_0x9ffcb5){_0x1fe406[_0xc6c9('0x1d')](_0x9ffcb5);})[_0xc6c9('0x12')](function(){for(var _0x47fe8e=0x0;_0x47fe8e<_0x1fe406[_0xc6c9('0x19')];_0x47fe8e+=0x1){var _0x167173;var _0x5a6848=_0x1fe406[_0x47fe8e];if(_0x5e1817){_0x167173=path[_0xc6c9('0x22')](_0x589dbf,_0xb432ec,util[_0xc6c9('0xf')](_0xc6c9('0x24'),_0xb432ec,_0x47fe8e,_0xc6c9('0x25')));}else{_0x167173=path[_0xc6c9('0x22')](_0x589dbf,util['format'](_0xc6c9('0x26'),_0xb432ec,_0xc6c9('0x25')));}fs[_0xc6c9('0x27')](_0x167173,json2xls(_0x5a6848),'binary');}})[_0xc6c9('0x12')](function(){if(_0x5e1817){return new Promise(function(_0x1493ca){zipdir(path[_0xc6c9('0x22')](_0x589dbf,_0xb432ec),{'saveTo':path[_0xc6c9('0x22')](_0x589dbf,util[_0xc6c9('0xf')](_0xc6c9('0x26'),_0xb432ec,_0xc6c9('0x28')))},function(_0x156968,_0xa36594){rimraf(path[_0xc6c9('0x22')](_0x589dbf,_0xb432ec),function(){});_0x1493ca('zip\x20finished');});});}})[_0xc6c9('0x12')](function(){logger['info'](util[_0xc6c9('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xc6c9('0x29'),_0x5e1817?util[_0xc6c9('0xf')](_0xc6c9('0x26'),_0xb432ec,_0x5e1817?'zip':_0xc6c9('0x25')):null);});})[_0xc6c9('0x2a')](function(_0x859dd8){logger[_0xc6c9('0xe')](util[_0xc6c9('0xf')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc6c9('0x10')),util[_0xc6c9('0x2b')](_0x859dd8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc6c9('0x2c'));})['finally'](function(){process[_0xc6c9('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index dfa675a..21d5783 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 _0x59ce=['CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','IntervalId','interval','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59ce,0x15f));var _0xe59c=function(_0x15200b,_0x3bd575){_0x15200b=_0x15200b-0x0;var _0x110a89=_0x59ce[_0x15200b];return _0x110a89;};'use strict';var _=require(_0xe59c('0x0'));var util=require(_0xe59c('0x1'));function rewrite(_0x536565,_0x1b19ec){var _0x4dd76a=this;return _0x536565[_0xe59c('0x2')][_0xe59c('0x3')][_0xe59c('0x4')]({'raw':!![]})[_0xe59c('0x5')](function(_0x16e1d2){_0x4dd76a[_0xe59c('0x6')]=_0x16e1d2;return _0x536565[_0xe59c('0x2')][_0xe59c('0x7')][_0xe59c('0x4')]({'where':{'IntervalId':_0x1b19ec['IntervalId']},'raw':!![]});})[_0xe59c('0x5')](function(_0x387472){return _0x536565[_0xe59c('0x2')][_0xe59c('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xe59c('0x8')](_['map'](_0x387472,_0xe59c('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xe59c('0x5')](function(_0x16727a){var _0x2594fe=_[_0xe59c('0xa')](_0x16727a,{'priority':'1'});var _0xc7bc79=_[_0xe59c('0xa')](_0x16727a,{'isApp':0x1});var _0x1735ee=_[_0xe59c('0xb')](_0xc7bc79,_0xe59c('0x9'));var _0x2c0015=[_0xe59c('0xc'),_0xe59c('0xd')];var _0x1d854b=[];var _0x3dd4a3=[];for(var _0x42372a in _0x1735ee){if(_0x1735ee[_0xe59c('0xe')](_0x42372a)){_0x4dd76a[_0xe59c('0xf')]=0x2;_0x4dd76a[_0xe59c('0x10')]=[];_0x4dd76a[_0xe59c('0x11')]=_[_0xe59c('0x12')](_0x2594fe,{'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')]});_0x4dd76a[_0xe59c('0x10')]['push']({'type':_0x1735ee[_0x42372a][0x0]['type'],'app':_0xe59c('0x13'),'appdata':util[_0xe59c('0x14')](_0xe59c('0x15'),_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')]),'context':_0x1735ee[_0x42372a][0x0][_0xe59c('0x17')],'exten':_0x1735ee[_0x42372a][0x0]['exten'],'priority':_0x4dd76a[_0xe59c('0xf')]++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});if(_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')]===_0xe59c('0x19')){_0x4dd76a['extensions'][_0xe59c('0x1a')]({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':_0xe59c('0x1b')+_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')],'context':_0x1735ee[_0x42372a][0x0]['context'],'exten':_0x1735ee[_0x42372a][0x0]['exten'],'priority':_0x4dd76a['priority']++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});}else if(_0x1735ee[_0x42372a][0x0]['type']===_0xe59c('0x1c')){if(_0x4dd76a[_0xe59c('0x11')]){_0x4dd76a[_0xe59c('0x10')][_0xe59c('0x1a')]({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':_0xe59c('0x1d')+(_0x4dd76a[_0xe59c('0x11')][_0xe59c('0x1e')]?_0xe59c('0x1f')+_0x4dd76a[_0xe59c('0x11')][_0xe59c('0x1e')]+'}':_0xe59c('0x20')),'context':_0x1735ee[_0x42372a][0x0]['context'],'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'priority':_0x4dd76a[_0xe59c('0xf')]++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});}_0x4dd76a[_0xe59c('0x10')][_0xe59c('0x1a')]({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':'CDR(routeid)='+_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')],'context':_0x1735ee[_0x42372a][0x0][_0xe59c('0x17')],'exten':_0x1735ee[_0x42372a][0x0]['exten'],'priority':_0x4dd76a[_0xe59c('0xf')]++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});var _0x147150=_0x4dd76a['priority']++;_0x4dd76a['extensions']['push']({'type':_0x1735ee[_0x42372a][0x0]['type'],'app':'ExecIf','appdata':_0xe59c('0x21')+(_0x147150+0x2)+_0xe59c('0x22')+(_0x147150+0x1)+')','context':_0x1735ee[_0x42372a][0x0]['context'],'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'priority':_0x147150,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});if(_0x4dd76a[_0xe59c('0x11')]){_0x4dd76a['extensions'][_0xe59c('0x1a')]({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':'Set','appdata':_0x4dd76a[_0xe59c('0x11')][_0xe59c('0x1e')]?_0xe59c('0x23')+_0x4dd76a[_0xe59c('0x11')][_0xe59c('0x1e')]+'}':_0xe59c('0x24'),'context':_0x1735ee[_0x42372a][0x0][_0xe59c('0x17')],'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'priority':_0x4dd76a[_0xe59c('0xf')]++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});}_0x4dd76a['extensions']['push']({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':'outboundrouteid='+_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')],'context':_0x1735ee[_0x42372a][0x0][_0xe59c('0x17')],'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'priority':_0x4dd76a[_0xe59c('0xf')]++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});if(_0x4dd76a[_0xe59c('0x11')]&&_0x4dd76a[_0xe59c('0x11')][_0xe59c('0xe')](_0xe59c('0x25'))&&_0x4dd76a[_0xe59c('0x11')][_0xe59c('0x25')]!==_0xe59c('0x26')){_0x4dd76a[_0xe59c('0x10')]['push']({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':_0xe59c('0x27'),'context':_0x1735ee[_0x42372a][0x0][_0xe59c('0x17')],'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'priority':_0x4dd76a[_0xe59c('0xf')]++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0]['VoiceExtensionId']});_0x4dd76a[_0xe59c('0x10')]['push']({'type':_0x1735ee[_0x42372a][0x0]['type'],'app':_0xe59c('0x13'),'appdata':_0xe59c('0x28')+_0x4dd76a['extension'][_0xe59c('0x25')]||_0xe59c('0x29'),'context':_0x1735ee[_0x42372a][0x0][_0xe59c('0x17')],'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'priority':_0x4dd76a[_0xe59c('0xf')]++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});}}_0x4dd76a[_0xe59c('0x10')]['push']({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':_0xe59c('0x2a'),'context':_0x1735ee[_0x42372a][0x0]['context'],'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'priority':_0x4dd76a['priority']++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0]['VoiceExtensionId']});_0x4dd76a[_0xe59c('0x10')][_0xe59c('0x1a')]({'type':_0x1735ee[_0x42372a][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1735ee[_0x42372a][0x0]['context'],'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'priority':_0x4dd76a[_0xe59c('0xf')]++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});_0x4dd76a['extensions'][_0xe59c('0x1a')]({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':_0xe59c('0x2b'),'context':_0x1735ee[_0x42372a][0x0]['context'],'exten':_0x1735ee[_0x42372a][0x0]['exten'],'priority':_0x4dd76a['priority']++,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});for(var _0x5e8683=0x0,_0x3fd998=0x0;_0x5e8683<_0x1735ee[_0x42372a][_0xe59c('0x2c')];_0x5e8683+=0x1,_0x3fd998=0x0){var _0x5e8fc6=_0x1735ee[_0x42372a][_0x5e8683];if(_0x5e8fc6[_0xe59c('0x16')]){_0x5e8fc6[_0xe59c('0x16')]=_0x5e8fc6[_0xe59c('0x16')]['toLowerCase']();}var _0x28be60=[];var _0x3fa8f0=[];delete _0x5e8fc6['id'];delete _0x5e8fc6[_0xe59c('0x2d')];delete _0x5e8fc6[_0xe59c('0x2e')];var _0xa8e281=_0x5e8fc6['interval']!=='*,*,*,*'?[_0x5e8fc6['interval']]:_0x5e8fc6['IntervalId']?_['map'](_[_0xe59c('0xa')](_0x4dd76a['intervals'],{'IntervalId':_0x5e8fc6[_0xe59c('0x2f')]}),_0xe59c('0x30')):[];if(_0x5e8fc6[_0xe59c('0xe')](_0xe59c('0x31'))){if(_0x5e8fc6[_0xe59c('0x31')]&&_0x5e8fc6['tag']!=='--'){_0x28be60[_0xe59c('0x1a')]({'type':_0x5e8fc6[_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':_0xe59c('0x32')+_0x5e8fc6[_0xe59c('0x31')],'context':_0x5e8fc6[_0xe59c('0x17')],'exten':_0x5e8fc6[_0xe59c('0x9')],'priority':_0xa8e281['length']+_0x4dd76a[_0xe59c('0xf')]+_0x3fd998++,'VoiceExtensionId':_0x5e8fc6[_0xe59c('0x18')]});}}if(_0x5e8fc6['type']===_0xe59c('0x1c')&&_0x5e8fc6[_0xe59c('0xe')]('callerID')){if(_0x5e8fc6['callerID']){_0x28be60[_0xe59c('0x1a')]({'type':_0x5e8fc6[_0xe59c('0x16')],'app':_0xe59c('0x33'),'appdata':_0xe59c('0x34')+_0x5e8fc6[_0xe59c('0x35')]+')','context':_0x5e8fc6['context'],'exten':_0x5e8fc6[_0xe59c('0x9')],'priority':_0xa8e281[_0xe59c('0x2c')]+_0x4dd76a['priority']+_0x3fd998++,'VoiceExtensionId':_0x5e8fc6[_0xe59c('0x18')]});}else{_0x28be60[_0xe59c('0x1a')]({'type':_0x5e8fc6[_0xe59c('0x16')],'app':_0xe59c('0x33'),'appdata':_0xe59c('0x36'),'context':_0x5e8fc6['context'],'exten':_0x5e8fc6[_0xe59c('0x9')],'priority':_0xa8e281[_0xe59c('0x2c')]+_0x4dd76a[_0xe59c('0xf')]+_0x3fd998++,'VoiceExtensionId':_0x5e8fc6[_0xe59c('0x18')]});}}if(_0x5e8fc6['hasOwnProperty'](_0xe59c('0x37'))){if(_0x2c0015[_0xe59c('0x38')](_0x5e8fc6[_0xe59c('0x39')][_0xe59c('0x3a')]())>=0x0&&_0x5e8fc6[_0xe59c('0x3b')]!==_0xe59c('0x3c')){if(_0x5e8fc6['answer']){_0x28be60[_0xe59c('0x1a')]({'type':_0x5e8fc6[_0xe59c('0x16')],'app':_0xe59c('0x33'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5e8fc6['context'],'exten':_0x5e8fc6[_0xe59c('0x9')],'priority':_0xa8e281['length']+_0x4dd76a['priority']+_0x3fd998++,'VoiceExtensionId':_0x5e8fc6['VoiceExtensionId']});_0x28be60[_0xe59c('0x1a')]({'type':_0x5e8fc6[_0xe59c('0x16')],'app':'Set','appdata':_0xe59c('0x3d'),'context':_0x5e8fc6[_0xe59c('0x17')],'exten':_0x5e8fc6[_0xe59c('0x9')],'priority':_0xa8e281[_0xe59c('0x2c')]+_0x4dd76a[_0xe59c('0xf')]+_0x3fd998++,'VoiceExtensionId':_0x5e8fc6[_0xe59c('0x18')]});}else{_0x28be60[_0xe59c('0x1a')]({'type':_0x5e8fc6[_0xe59c('0x16')],'app':_0xe59c('0x33'),'appdata':_0xe59c('0x3e'),'context':_0x5e8fc6[_0xe59c('0x17')],'exten':_0x5e8fc6[_0xe59c('0x9')],'priority':_0xa8e281[_0xe59c('0x2c')]+_0x4dd76a[_0xe59c('0xf')]+_0x3fd998++,'VoiceExtensionId':_0x5e8fc6['VoiceExtensionId']});_0x28be60[_0xe59c('0x1a')]({'type':_0x5e8fc6[_0xe59c('0x16')],'app':_0xe59c('0x13'),'appdata':_0xe59c('0x3f'),'context':_0x5e8fc6[_0xe59c('0x17')],'exten':_0x5e8fc6[_0xe59c('0x9')],'priority':_0xa8e281[_0xe59c('0x2c')]+_0x4dd76a[_0xe59c('0xf')]+_0x3fd998++,'VoiceExtensionId':_0x5e8fc6[_0xe59c('0x18')]});}}}for(var _0x567404=0x0;_0x567404<_0xa8e281[_0xe59c('0x2c')];_0x567404+=0x1){var _0x5b6de0=_0x4dd76a['priority']+_0xa8e281[_0xe59c('0x2c')];var _0x472feb=_0x567404===_0xa8e281[_0xe59c('0x2c')]-0x1?_0x4dd76a['priority']+_0x28be60['length']+_0x3fa8f0[_0xe59c('0x2c')]+0x2:_0x4dd76a[_0xe59c('0xf')]+_0x567404+0x1;_0x28be60[_0xe59c('0x40')](_0x567404,0x0,{'type':_0x5e8fc6[_0xe59c('0x16')],'app':_0xe59c('0x41'),'appdata':_0xa8e281[_0x567404]+'?'+_0x5e8fc6[_0xe59c('0x17')]+_0xe59c('0x42')+_0x5b6de0+':'+_0x5e8fc6[_0xe59c('0x17')]+_0xe59c('0x42')+_0x472feb,'exten':_0x5e8fc6[_0xe59c('0x9')],'context':_0x5e8fc6[_0xe59c('0x17')],'priority':_0x4dd76a['priority']+_0x567404,'VoiceExtensionId':_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]});}_0x5e8fc6['priority']=_0x28be60[_0xe59c('0x2c')]?_['last'](_0x28be60)[_0xe59c('0xf')]+0x1:_0x4dd76a[_0xe59c('0xf')];_0x4dd76a[_0xe59c('0xf')]=(_0x3fa8f0['length']?_[_0xe59c('0x43')](_0x3fa8f0)[_0xe59c('0xf')]:_0x5e8fc6[_0xe59c('0xf')])+0x1;_0x4dd76a[_0xe59c('0x10')]=_[_0xe59c('0x44')](_0x4dd76a[_0xe59c('0x10')],_0x28be60,[_0x5e8fc6],_0x3fa8f0);}_0x4dd76a[_0xe59c('0x10')]['push']({'type':_0x1735ee[_0x42372a][0x0][_0xe59c('0x16')],'app':_0xe59c('0x45'),'exten':_0x1735ee[_0x42372a][0x0][_0xe59c('0x9')],'context':_0x1735ee[_0x42372a][0x0][_0xe59c('0x17')],'priority':_0x4dd76a[_0xe59c('0xf')],'VoiceExtensionId':_0x1735ee[_0x42372a][0x0]['VoiceExtensionId']});_0x1d854b['push'](_0x1735ee[_0x42372a][0x0][_0xe59c('0x18')]);_0x3dd4a3=_[_0xe59c('0x44')](_0x3dd4a3,_0x4dd76a['extensions']);}}return _0x536565[_0xe59c('0x46')](function(_0x33601f){return _0x536565[_0xe59c('0x2')]['VoiceExtension'][_0xe59c('0x47')]({'where':{'VoiceExtensionId':{'$in':_0x1d854b}},'transaction':_0x33601f})[_0xe59c('0x5')](function(_0x3c9dc8){return _0x536565['models'][_0xe59c('0x7')][_0xe59c('0x48')](_[_0xe59c('0x49')](_0x3dd4a3,'priority'),{'transaction':_0x33601f});});});})['catch'](function(_0x4ffe91){console[_0xe59c('0x4a')](_0x4ffe91);});}exports[_0xe59c('0x4b')]=rewrite; \ No newline at end of file +var _0xf557=['wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','map','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','extensions','VoiceExtensionId','type','push','Set','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x549739,_0x7d6313){var _0x675472=function(_0x447757){while(--_0x447757){_0x549739['push'](_0x549739['shift']());}};_0x675472(++_0x7d6313);}(_0xf557,0x1bd));var _0x7f55=function(_0x8f1b0,_0x7bd5db){_0x8f1b0=_0x8f1b0-0x0;var _0x2a8db8=_0xf557[_0x8f1b0];return _0x2a8db8;};'use strict';var _=require(_0x7f55('0x0'));var util=require(_0x7f55('0x1'));function rewrite(_0xf3e724,_0x1514f8){var _0x46de52=this;return _0xf3e724[_0x7f55('0x2')][_0x7f55('0x3')]['findAll']({'raw':!![]})[_0x7f55('0x4')](function(_0x3941ab){_0x46de52[_0x7f55('0x5')]=_0x3941ab;return _0xf3e724[_0x7f55('0x2')][_0x7f55('0x6')][_0x7f55('0x7')]({'where':{'IntervalId':_0x1514f8[_0x7f55('0x8')]},'raw':!![]});})[_0x7f55('0x4')](function(_0x38b032){return _0xf3e724[_0x7f55('0x2')][_0x7f55('0x6')][_0x7f55('0x7')]({'where':{'exten':{'$in':_['uniq'](_[_0x7f55('0x9')](_0x38b032,_0x7f55('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x7f55('0x4')](function(_0x2b1235){var _0x391df7=_['filter'](_0x2b1235,{'priority':'1'});var _0x34d480=_[_0x7f55('0xb')](_0x2b1235,{'isApp':0x1});var _0x6030c4=_[_0x7f55('0xc')](_0x34d480,_0x7f55('0xa'));var _0x50f5ea=[_0x7f55('0xd'),_0x7f55('0xe')];var _0x1c0eb0=[];var _0x26f29c=[];for(var _0x28f7b9 in _0x6030c4){if(_0x6030c4[_0x7f55('0xf')](_0x28f7b9)){_0x46de52[_0x7f55('0x10')]=0x2;_0x46de52['extensions']=[];_0x46de52[_0x7f55('0x11')]=_['find'](_0x391df7,{'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')]});_0x46de52[_0x7f55('0x12')]['push']({'type':_0x6030c4[_0x28f7b9][0x0]['type'],'app':'Set','appdata':util['format']('CDR(type)=%s',_0x6030c4[_0x28f7b9][0x0]['type']),'context':_0x6030c4[_0x28f7b9][0x0]['context'],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52['priority']++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});if(_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')]==='inbound'){_0x46de52[_0x7f55('0x12')][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x7f55('0x17')+_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')],'context':_0x6030c4[_0x28f7b9][0x0]['context'],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52['priority']++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0]['VoiceExtensionId']});}else if(_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')]===_0x7f55('0x18')){if(_0x46de52[_0x7f55('0x11')]){_0x46de52[_0x7f55('0x12')][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x7f55('0x19')+(_0x46de52[_0x7f55('0x11')][_0x7f55('0x1a')]?_0x7f55('0x1b')+_0x46de52[_0x7f55('0x11')][_0x7f55('0x1a')]+'}':_0x7f55('0x1c')),'context':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x1d')],'exten':_0x6030c4[_0x28f7b9][0x0]['exten'],'priority':_0x46de52['priority']++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0]['VoiceExtensionId']});}_0x46de52[_0x7f55('0x12')][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x7f55('0x17')+_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')],'context':_0x6030c4[_0x28f7b9][0x0]['context'],'exten':_0x6030c4[_0x28f7b9][0x0]['exten'],'priority':_0x46de52['priority']++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});var _0x3acb12=_0x46de52[_0x7f55('0x10')]++;_0x46de52[_0x7f55('0x12')][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0]['type'],'app':'ExecIf','appdata':_0x7f55('0x1e')+(_0x3acb12+0x2)+_0x7f55('0x1f')+(_0x3acb12+0x1)+')','context':_0x6030c4[_0x28f7b9][0x0]['context'],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x3acb12,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});if(_0x46de52[_0x7f55('0x11')]){_0x46de52[_0x7f55('0x12')]['push']({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x46de52['extension'][_0x7f55('0x1a')]?_0x7f55('0x20')+_0x46de52[_0x7f55('0x11')][_0x7f55('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x6030c4[_0x28f7b9][0x0]['context'],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52['priority']++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});}_0x46de52[_0x7f55('0x12')]['push']({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x7f55('0x21')+_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')],'context':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x1d')],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52['priority']++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});if(_0x46de52['extension']&&_0x46de52[_0x7f55('0x11')]['hasOwnProperty']('recordingFormat')&&_0x46de52[_0x7f55('0x11')][_0x7f55('0x22')]!==_0x7f55('0x23')){_0x46de52[_0x7f55('0x12')][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x7f55('0x24'),'context':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x1d')],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52[_0x7f55('0x10')]++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});_0x46de52['extensions'][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':'Set','appdata':_0x7f55('0x25')+_0x46de52[_0x7f55('0x11')][_0x7f55('0x22')]||_0x7f55('0x26'),'context':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x1d')],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52['priority']++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});}}_0x46de52[_0x7f55('0x12')][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':'Set','appdata':_0x7f55('0x27'),'context':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x1d')],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52[_0x7f55('0x10')]++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0]['VoiceExtensionId']});_0x46de52[_0x7f55('0x12')][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x7f55('0x28'),'context':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x1d')],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52[_0x7f55('0x10')]++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0]['VoiceExtensionId']});_0x46de52[_0x7f55('0x12')][_0x7f55('0x15')]({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x7f55('0x29'),'context':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x1d')],'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'priority':_0x46de52['priority']++,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0]['VoiceExtensionId']});for(var _0xee8a5a=0x0,_0x34c3dc=0x0;_0xee8a5a<_0x6030c4[_0x28f7b9]['length'];_0xee8a5a+=0x1,_0x34c3dc=0x0){var _0x20649a=_0x6030c4[_0x28f7b9][_0xee8a5a];if(_0x20649a['type']){_0x20649a[_0x7f55('0x14')]=_0x20649a[_0x7f55('0x14')][_0x7f55('0x2a')]();}var _0x5c5309=[];var _0x6d1164=[];delete _0x20649a['id'];delete _0x20649a[_0x7f55('0x2b')];delete _0x20649a['updatedAt'];var _0x3f21a3=_0x20649a[_0x7f55('0x2c')]!==_0x7f55('0x2d')?[_0x20649a[_0x7f55('0x2c')]]:_0x20649a[_0x7f55('0x8')]?_[_0x7f55('0x9')](_[_0x7f55('0xb')](_0x46de52[_0x7f55('0x5')],{'IntervalId':_0x20649a[_0x7f55('0x8')]}),_0x7f55('0x2c')):[];if(_0x20649a['hasOwnProperty']('tag')){if(_0x20649a[_0x7f55('0x2e')]&&_0x20649a[_0x7f55('0x2e')]!=='--'){_0x5c5309[_0x7f55('0x15')]({'type':_0x20649a[_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':_0x7f55('0x2f')+_0x20649a[_0x7f55('0x2e')],'context':_0x20649a['context'],'exten':_0x20649a['exten'],'priority':_0x3f21a3[_0x7f55('0x30')]+_0x46de52['priority']+_0x34c3dc++,'VoiceExtensionId':_0x20649a[_0x7f55('0x13')]});}}if(_0x20649a[_0x7f55('0x14')]===_0x7f55('0x18')&&_0x20649a[_0x7f55('0xf')](_0x7f55('0x31'))){if(_0x20649a['callerID']){_0x5c5309[_0x7f55('0x15')]({'type':_0x20649a[_0x7f55('0x14')],'app':_0x7f55('0x32'),'appdata':_0x7f55('0x33')+_0x20649a[_0x7f55('0x31')]+')','context':_0x20649a['context'],'exten':_0x20649a[_0x7f55('0xa')],'priority':_0x3f21a3['length']+_0x46de52[_0x7f55('0x10')]+_0x34c3dc++,'VoiceExtensionId':_0x20649a[_0x7f55('0x13')]});}else{_0x5c5309[_0x7f55('0x15')]({'type':_0x20649a[_0x7f55('0x14')],'app':_0x7f55('0x32'),'appdata':_0x7f55('0x34'),'context':_0x20649a[_0x7f55('0x1d')],'exten':_0x20649a[_0x7f55('0xa')],'priority':_0x3f21a3['length']+_0x46de52[_0x7f55('0x10')]+_0x34c3dc++,'VoiceExtensionId':_0x20649a[_0x7f55('0x13')]});}}if(_0x20649a[_0x7f55('0xf')](_0x7f55('0x35'))){if(_0x50f5ea[_0x7f55('0x36')](_0x20649a['app'][_0x7f55('0x2a')]())>=0x0&&_0x20649a['appType']!==_0x7f55('0x37')){if(_0x20649a[_0x7f55('0x35')]){_0x5c5309[_0x7f55('0x15')]({'type':_0x20649a['type'],'app':_0x7f55('0x32'),'appdata':_0x7f55('0x38'),'context':_0x20649a['context'],'exten':_0x20649a[_0x7f55('0xa')],'priority':_0x3f21a3[_0x7f55('0x30')]+_0x46de52[_0x7f55('0x10')]+_0x34c3dc++,'VoiceExtensionId':_0x20649a[_0x7f55('0x13')]});_0x5c5309['push']({'type':_0x20649a['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x20649a['context'],'exten':_0x20649a[_0x7f55('0xa')],'priority':_0x3f21a3[_0x7f55('0x30')]+_0x46de52[_0x7f55('0x10')]+_0x34c3dc++,'VoiceExtensionId':_0x20649a['VoiceExtensionId']});}else{_0x5c5309[_0x7f55('0x15')]({'type':_0x20649a['type'],'app':_0x7f55('0x32'),'appdata':_0x7f55('0x39'),'context':_0x20649a['context'],'exten':_0x20649a[_0x7f55('0xa')],'priority':_0x3f21a3[_0x7f55('0x30')]+_0x46de52[_0x7f55('0x10')]+_0x34c3dc++,'VoiceExtensionId':_0x20649a['VoiceExtensionId']});_0x5c5309['push']({'type':_0x20649a[_0x7f55('0x14')],'app':_0x7f55('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x20649a[_0x7f55('0x1d')],'exten':_0x20649a[_0x7f55('0xa')],'priority':_0x3f21a3[_0x7f55('0x30')]+_0x46de52[_0x7f55('0x10')]+_0x34c3dc++,'VoiceExtensionId':_0x20649a['VoiceExtensionId']});}}}for(var _0x467012=0x0;_0x467012<_0x3f21a3[_0x7f55('0x30')];_0x467012+=0x1){var _0x59dc7f=_0x46de52[_0x7f55('0x10')]+_0x3f21a3[_0x7f55('0x30')];var _0xb4a2dc=_0x467012===_0x3f21a3[_0x7f55('0x30')]-0x1?_0x46de52[_0x7f55('0x10')]+_0x5c5309[_0x7f55('0x30')]+_0x6d1164['length']+0x2:_0x46de52[_0x7f55('0x10')]+_0x467012+0x1;_0x5c5309['splice'](_0x467012,0x0,{'type':_0x20649a['type'],'app':'GotoIfTime','appdata':_0x3f21a3[_0x467012]+'?'+_0x20649a[_0x7f55('0x1d')]+_0x7f55('0x3a')+_0x59dc7f+':'+_0x20649a[_0x7f55('0x1d')]+_0x7f55('0x3a')+_0xb4a2dc,'exten':_0x20649a['exten'],'context':_0x20649a[_0x7f55('0x1d')],'priority':_0x46de52[_0x7f55('0x10')]+_0x467012,'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});}_0x20649a[_0x7f55('0x10')]=_0x5c5309['length']?_[_0x7f55('0x3b')](_0x5c5309)[_0x7f55('0x10')]+0x1:_0x46de52[_0x7f55('0x10')];_0x46de52[_0x7f55('0x10')]=(_0x6d1164[_0x7f55('0x30')]?_[_0x7f55('0x3b')](_0x6d1164)[_0x7f55('0x10')]:_0x20649a[_0x7f55('0x10')])+0x1;_0x46de52['extensions']=_['concat'](_0x46de52[_0x7f55('0x12')],_0x5c5309,[_0x20649a],_0x6d1164);}_0x46de52[_0x7f55('0x12')]['push']({'type':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x14')],'app':_0x7f55('0x3c'),'exten':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0xa')],'context':_0x6030c4[_0x28f7b9][0x0]['context'],'priority':_0x46de52[_0x7f55('0x10')],'VoiceExtensionId':_0x6030c4[_0x28f7b9][0x0][_0x7f55('0x13')]});_0x1c0eb0['push'](_0x6030c4[_0x28f7b9][0x0]['VoiceExtensionId']);_0x26f29c=_[_0x7f55('0x3d')](_0x26f29c,_0x46de52[_0x7f55('0x12')]);}}return _0xf3e724[_0x7f55('0x3e')](function(_0x578c74){return _0xf3e724[_0x7f55('0x2')][_0x7f55('0x6')][_0x7f55('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x1c0eb0}},'transaction':_0x578c74})['then'](function(_0x1756a1){return _0xf3e724[_0x7f55('0x2')]['VoiceExtension'][_0x7f55('0x40')](_[_0x7f55('0x41')](_0x26f29c,'priority'),{'transaction':_0x578c74});});});})[_0x7f55('0x42')](function(_0x46e702){console[_0x7f55('0x43')](_0x46e702);});}exports[_0x7f55('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ed500d3..4d864e9 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 _0x31b6=['squel','papaparse','../../../mysqldb','../../../config/logger','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','find','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','ContactId','ListId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','scheduledAt','ListId\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','str','VoiceQueue','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x31b6,0xdf));var _0x631b=function(_0x14cc78,_0x1d6d29){_0x14cc78=_0x14cc78-0x0;var _0x4e5112=_0x31b6[_0x14cc78];return _0x4e5112;};'use strict';var BPromise=require(_0x631b('0x0'));var util=require(_0x631b('0x1'));var _=require(_0x631b('0x2'));var fs=require('fs');var squel=require(_0x631b('0x3'));var Papa=require(_0x631b('0x4'));var Redis=require('ioredis');var db=require(_0x631b('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x631b('0x6'))('api');config['redis']=_[_0x631b('0x7')](config[_0x631b('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x631b('0x9'))(new Redis(config[_0x631b('0x8')]));require(_0x631b('0xa'))[_0x631b('0xb')](socket);try{if(!process[_0x631b('0xc')][0x2]||process['argv'][0x2]===_0x631b('0xd')||process[_0x631b('0xc')][0x2]===_0x631b('0xe')){throw new Error(_0x631b('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0x631b('0xc')][0x3]||process[_0x631b('0xc')][0x3]===_0x631b('0xd')||process['argv'][0x3]===_0x631b('0xe')||!process[_0x631b('0xc')][0x4]||process[_0x631b('0xc')][0x4]==='undefined'||process[_0x631b('0xc')][0x4]===_0x631b('0xe')){throw new Error(_0x631b('0x10'));}var FIELDS=_[_0x631b('0x11')](process[_0x631b('0xc')][0x3][_0x631b('0x12')](','),process[_0x631b('0xc')][0x4][_0x631b('0x12')](','));if(!process['argv'][0x5]||process[_0x631b('0xc')][0x5]===_0x631b('0xd')||process[_0x631b('0xc')][0x5]===_0x631b('0xe')){throw new Error(_0x631b('0x13'));}var LISTID=process[_0x631b('0xc')][0x5];var COMPANYID=process[_0x631b('0xc')][0x6]&&process[_0x631b('0xc')][0x6]!==_0x631b('0xd')&&process[_0x631b('0xc')][0x6]!==_0x631b('0xe')?process[_0x631b('0xc')][0x6]:null;var DUPLICATES=process[_0x631b('0xc')][0x7]&&process[_0x631b('0xc')][0x7]!=='undefined'&&process[_0x631b('0xc')][0x7]!==_0x631b('0xe')?process[_0x631b('0xc')][0x7]:null;if(!process[_0x631b('0xc')][0x8]||process[_0x631b('0xc')][0x8]==='undefined'||process[_0x631b('0xc')][0x8]===_0x631b('0xe')){throw new Error(_0x631b('0x14'));}var SOCKET_TIMESTAMP=process[_0x631b('0xc')][0x8];}catch(_0x3400ec){logger['error'](_0x3400ec);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(_0x1980c5,_0x4cdc67,_0x460281,_0x5bd466){var _0x28289f={'message':_0x4cdc67};_0x28289f[_0x1980c5]=!![];if(_0x460281){_0x28289f[_0x631b('0x15')]=_0x460281;}if(_0x5bd466){_0x28289f[_0x631b('0x16')]=_0x5bd466;}return _0x28289f;}function isEmail(_0x185d74){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))*$/[_0x631b('0x17')](_0x185d74);}function checkRow(_0xef6fb7,_0x158e4d,_0x3e0988){return new BPromise(function(_0x4954be,_0x1ef98e){if(_[_0x631b('0x18')](_0xef6fb7)){return _0x1ef98e(handleCheckRowError(_0x631b('0x19'),_0x631b('0x1a'),null,_0x3e0988));}if(_0xef6fb7[_0x631b('0x1b')]&&_0xef6fb7['errors'][_0x631b('0x1c')]){var _0x15419c=_[_0x631b('0x1d')](_0xef6fb7[_0x631b('0x1b')],_0x631b('0x1e'))[_0x631b('0x1f')](';');return _0x1ef98e(handleCheckRowError('error',_0x15419c,null,_0x3e0988));}var _0x4d3516={};for(var _0x564723 in FIELDS){if(FIELDS['hasOwnProperty'](_0x564723)&&FIELDS[_0x564723]){_0x4d3516[_0x564723]=_0xef6fb7[_0x631b('0x20')][0x0][FIELDS[_0x564723]]||_0xef6fb7['data'][0x0]['\ufeff'+FIELDS[_0x564723]];}}if(!_0x4d3516[_0x631b('0x21')]){return _0x1ef98e(handleCheckRowError(_0x631b('0x19'),_0x631b('0x22'),null,_0x3e0988));}if(!_0x4d3516[_0x631b('0x23')]){return _0x1ef98e(handleCheckRowError(_0x631b('0x19'),_0x631b('0x24'),null,_0x3e0988));}if(_0x4d3516[_0x631b('0x25')]){var _0x2cdc6e=moment(_0x4d3516['birthDate'],_0x631b('0x26'));if(!_0x2cdc6e[_0x631b('0x27')]()){return _0x1ef98e(handleCheckRowError(_0x631b('0x19'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3e0988));}}if(_0x4d3516[_0x631b('0x28')]){if(!isEmail(_0x4d3516[_0x631b('0x28')])){return _0x1ef98e(handleCheckRowError(_0x631b('0x19'),_0x631b('0x29'),null,_0x3e0988));}}_0x4d3516['ListId']=LISTID;_0x4d3516['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x631b('0x1c')]&&_0x158e4d){var _0xc45e15={};for(var _0x236c63=0x0,_0x38d702=DUPLICATES[_0x631b('0x1c')];_0x236c63<_0x38d702;_0x236c63+=0x1){_0xc45e15[DUPLICATES[_0x236c63]]=_0x4d3516[DUPLICATES[_0x236c63]];}var _0x21cfd2=_[_0x631b('0x2a')](_0x158e4d,_0xc45e15);if(_0x21cfd2){return _0x1ef98e(handleCheckRowError('duplicate',_0x631b('0x2b'),_0x21cfd2,_0x3e0988));}}return db[_0x631b('0x2c')][_0x631b('0x2d')](_0x4d3516,{'raw':!![],'hooks':![],'fields':_[_0x631b('0x2e')](_0x4d3516)})[_0x631b('0x2f')](function(_0x4e0f14){if(DUPLICATES&&DUPLICATES[_0x631b('0x1c')]&&_0x158e4d){_0x158e4d['push'](_[_0x631b('0x30')](_0x4d3516,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4e0f14['id'];return _0x4954be();})[_0x631b('0x31')](function(_0x2ca1b6){return _0x1ef98e(handleCheckRowError(_0x631b('0x19'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2ca1b6[_0x631b('0x1e')]||JSON[_0x631b('0x32')](_0x2ca1b6)),null,_0x3e0988));});});}function checkHopper(){function _0x112f66(){return function(_0x20525e){logger[_0x631b('0x19')](_0x631b('0x33'),_0x631b('0x34'),util[_0x631b('0x35')](_0x20525e,{'showHidden':![],'depth':null}));};}var _0x1a9c8a=function(_0x417737,_0x46e51c){var _0xfec572=squel[_0x631b('0x36')]()[_0x631b('0x37')]('cm_hopper')[_0x631b('0x38')]([_0x631b('0x23'),'scheduledAt',_0x631b('0x39'),_0x631b('0x3a'),_0x46e51c,'createdAt',_0x631b('0x3b')],squel[_0x631b('0x3c')]()[_0x631b('0x3d')](_0x631b('0x23'),_0x631b('0x23'))[_0x631b('0x3d')](_0x631b('0x3e'),'scheduledAt')[_0x631b('0x3d')]('id','ContactId')['field'](LISTID[_0x631b('0x3f')](),'ListId')['field'](_0x417737['id'][_0x631b('0x3f')](),_0x46e51c)[_0x631b('0x3d')](_0x631b('0x3e'),_0x631b('0x40'))[_0x631b('0x3d')](_0x631b('0x3e'),_0x631b('0x3b'))[_0x631b('0x41')](_0x631b('0x42'))[_0x631b('0x43')](_0x631b('0x44'))[_0x631b('0x43')]('ListId\x20=\x20?',LISTID[_0x631b('0x3f')]())[_0x631b('0x43')](_0x631b('0x45'))['where'](_0x631b('0x46'),squel[_0x631b('0x3c')]()['field'](_0x631b('0x23'))[_0x631b('0x41')]('cm_hopper')[_0x631b('0x43')](_0x46e51c+_0x631b('0x47'),_0x417737['id'][_0x631b('0x3f')]())))['toString']();return _0xfec572;};var _0x4e768b=function(_0x5fc327,_0xd1f947){var _0x10b92c=squel[_0x631b('0x36')]()[_0x631b('0x37')]('cm_hopper')[_0x631b('0x38')]([_0x631b('0x23'),'scheduledAt',_0x631b('0x39'),_0x631b('0x3a'),_0xd1f947,'createdAt',_0x631b('0x3b')],squel[_0x631b('0x3c')]()[_0x631b('0x3d')](_0x631b('0x23'),_0x631b('0x23'))[_0x631b('0x3d')]('NOW()',_0x631b('0x48'))['field']('id',_0x631b('0x39'))['field'](LISTID[_0x631b('0x3f')](),_0x631b('0x3a'))[_0x631b('0x3d')](_0x5fc327['id'][_0x631b('0x3f')](),_0xd1f947)[_0x631b('0x3d')](_0x631b('0x3e'),_0x631b('0x40'))[_0x631b('0x3d')](_0x631b('0x3e'),_0x631b('0x3b'))[_0x631b('0x41')]('cm_contacts')[_0x631b('0x43')](_0x631b('0x44'))[_0x631b('0x43')](_0x631b('0x49'),LISTID['toString']())[_0x631b('0x43')](_0x631b('0x4a'),squel['str'](hopperContacts))[_0x631b('0x43')](_0x631b('0x45'))[_0x631b('0x43')](_0x631b('0x46'),squel[_0x631b('0x3c')]()['field'](_0x631b('0x4b'))['from'](_0x631b('0x4c'))['where'](_0xd1f947+_0x631b('0x47'),_0x5fc327['id']['toString']()))[_0x631b('0x43')](_0x631b('0x46'),squel[_0x631b('0x3c')]()[_0x631b('0x3d')](_0x631b('0x23'))[_0x631b('0x41')]('cm_hopper')[_0x631b('0x43')](_0xd1f947+_0x631b('0x47'),_0x5fc327['id'][_0x631b('0x3f')]())))[_0x631b('0x3f')]();return _0x10b92c;};function _0x57eea9(_0x1954ea,_0x5e5b53){var _0x437a56=squel[_0x631b('0x36')]()[_0x631b('0x37')]('cm_hopper')[_0x631b('0x38')]([_0x631b('0x23'),_0x631b('0x48'),_0x631b('0x39'),_0x631b('0x3a'),_0x5e5b53,_0x631b('0x40'),'updatedAt'],squel['select']()[_0x631b('0x3d')]('phone',_0x631b('0x23'))[_0x631b('0x3d')](_0x631b('0x3e'),_0x631b('0x48'))['field']('id',_0x631b('0x39'))['field'](LISTID[_0x631b('0x3f')](),_0x631b('0x3a'))[_0x631b('0x3d')](_0x1954ea['id'][_0x631b('0x3f')](),_0x5e5b53)[_0x631b('0x3d')](_0x631b('0x3e'),_0x631b('0x40'))[_0x631b('0x3d')]('NOW()','updatedAt')['from'](_0x631b('0x42'))[_0x631b('0x43')](_0x631b('0x44'))[_0x631b('0x43')](_0x631b('0x49'),LISTID[_0x631b('0x3f')]())['where'](_0x631b('0x4a'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x437a56;}function _0x7b6595(_0x243173,_0x4456ed){var _0x5e3ad7=squel[_0x631b('0x36')]()[_0x631b('0x37')]('cm_hopper_black')[_0x631b('0x38')]([_0x631b('0x23'),_0x631b('0x39'),_0x631b('0x3a'),_0x4456ed,_0x631b('0x40'),_0x631b('0x3b')],squel[_0x631b('0x3c')]()[_0x631b('0x3d')](_0x631b('0x23'),_0x631b('0x23'))[_0x631b('0x3d')]('id','ContactId')[_0x631b('0x3d')](LISTID[_0x631b('0x3f')](),'ListId')[_0x631b('0x3d')](_0x243173['id'][_0x631b('0x3f')](),_0x4456ed)[_0x631b('0x3d')](_0x631b('0x3e'),_0x631b('0x40'))['field'](_0x631b('0x3e'),'updatedAt')[_0x631b('0x41')](_0x631b('0x42'))[_0x631b('0x43')](_0x631b('0x44'))[_0x631b('0x43')](_0x631b('0x49'),LISTID[_0x631b('0x3f')]())[_0x631b('0x43')](_0x631b('0x4a'),squel[_0x631b('0x4d')](hopperContacts))[_0x631b('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x631b('0x3f')]();return _0x5e3ad7;}return db[_0x631b('0x4e')]['findAll']({'where':{'type':_0x631b('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x631b('0x50')],'as':_0x631b('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x5d89df){var _0x1183a2=[];if(_0x5d89df){var _0x5a2f71;for(var _0x20aebd=0x0,_0x568605;_0x20aebd<_0x5d89df[_0x631b('0x1c')];_0x20aebd+=0x1){_0x568605=_0x5d89df[_0x20aebd][_0x631b('0x52')]({'plain':!![]});switch(_0x568605[_0x631b('0x53')]){case _0x631b('0x54'):_0x1183a2[_0x631b('0x55')](db[_0x631b('0x56')][_0x631b('0x57')](_0x4e768b(_0x568605,_0x631b('0x58')))['then'](function(){})[_0x631b('0x31')](_0x112f66()));break;case _0x631b('0x59'):_0x1183a2[_0x631b('0x55')](db[_0x631b('0x56')]['query'](_0x1a9c8a(_0x568605,_0x631b('0x58')))[_0x631b('0x2f')](function(){})['catch'](_0x112f66()));break;default:_0x1183a2[_0x631b('0x55')](db[_0x631b('0x56')][_0x631b('0x57')](_0x57eea9(_0x568605,_0x631b('0x58')))[_0x631b('0x2f')](function(){})[_0x631b('0x31')](_0x112f66()));}}}return _0x1183a2;})[_0x631b('0x5a')]()[_0x631b('0x2f')](function(){return db[_0x631b('0x4e')][_0x631b('0x5b')]({'where':{'type':_0x631b('0x4f')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x631b('0x5c'),'where':{'id':LISTID}}]})[_0x631b('0x2f')](function(_0x1b2a59){var _0x4dc8ac=[];if(_0x1b2a59){var _0xf74095;for(var _0x42a74e=0x0,_0x45bfa1;_0x42a74e<_0x1b2a59['length'];_0x42a74e+=0x1){_0x45bfa1=_0x1b2a59[_0x42a74e][_0x631b('0x52')]({'plain':!![]});_0x4dc8ac[_0x631b('0x55')](db['sequelize'][_0x631b('0x57')](_0x7b6595(_0x45bfa1,_0x631b('0x58')))[_0x631b('0x2f')](function(){})['catch'](_0x112f66()));}}return _0x4dc8ac;})[_0x631b('0x5a')]();})['then'](function(){return db[_0x631b('0x5d')][_0x631b('0x5b')]({'attributes':['id',_0x631b('0x53')],'include':[{'model':db[_0x631b('0x50')],'as':_0x631b('0x51'),'where':{'id':LISTID}}]})[_0x631b('0x2f')](function(_0x303673){var _0x21c2cf=[];if(_0x303673){for(var _0x125a66=0x0,_0x5a6229;_0x125a66<_0x303673['length'];_0x125a66+=0x1){_0x5a6229=_0x303673[_0x125a66]['get']({'plain':!![]});switch(_0x5a6229[_0x631b('0x53')]){case _0x631b('0x54'):_0x21c2cf[_0x631b('0x55')](db[_0x631b('0x56')][_0x631b('0x57')](_0x4e768b(_0x5a6229,'CampaignId'))[_0x631b('0x2f')](function(){})[_0x631b('0x31')](_0x112f66()));break;case _0x631b('0x59'):_0x21c2cf[_0x631b('0x55')](db[_0x631b('0x56')][_0x631b('0x57')](_0x1a9c8a(_0x5a6229,_0x631b('0x5e')))[_0x631b('0x2f')](function(){})[_0x631b('0x31')](_0x112f66()));break;default:_0x21c2cf[_0x631b('0x55')](db['sequelize'][_0x631b('0x57')](_0x57eea9(_0x5a6229,_0x631b('0x5e')))[_0x631b('0x2f')](function(){})[_0x631b('0x31')](_0x112f66()));}}}return _0x21c2cf;})[_0x631b('0x5a')]();})['then'](function(){return db[_0x631b('0x5d')][_0x631b('0x5b')]({'attributes':['id'],'include':[{'model':db[_0x631b('0x50')],'as':_0x631b('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x41ad3c){var _0x17a3ff=[];if(_0x41ad3c){for(var _0x232389=0x0,_0x5ea452;_0x232389<_0x41ad3c[_0x631b('0x1c')];_0x232389+=0x1){_0x5ea452=_0x41ad3c[_0x232389][_0x631b('0x52')]({'plain':!![]});_0x17a3ff[_0x631b('0x55')](db['sequelize'][_0x631b('0x57')](_0x7b6595(_0x5ea452,'CampaignId'))[_0x631b('0x2f')](function(){})[_0x631b('0x31')](_0x112f66()));}}return _0x17a3ff;})[_0x631b('0x5a')]();})[_0x631b('0x31')](function(_0x97302c){logger['error'](_0x631b('0x5f'),_0x631b('0x60'),_0x97302c[_0x631b('0x1e')]);});}var processPromises=function(_0x361a4c){return BPromise[_0x631b('0x5a')](promises)[_0x631b('0x2f')](function(_0x2cb994){})[_0x631b('0x31')](function(_0x2133c2){logger[_0x631b('0x19')]('Error\x20processing\x20rows\x20block:',JSON[_0x631b('0x32')](_0x2133c2));})[_0x631b('0x61')](function(){socket[_0x631b('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x361a4c){return _0x361a4c[_0x631b('0x63')]();}});};var endCsv=function(){return BPromise[_0x631b('0x64')]()[_0x631b('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x631b('0x62')](_0x631b('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x631b('0x66')](FILEPATH);}catch(_0x3eab09){logger[_0x631b('0x19')](_0x631b('0x67'),JSON['stringify'](_0x3eab09));}finally{process[_0x631b('0x68')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x631b('0x69'));endCsv();});function main(){return BPromise[_0x631b('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x631b('0x2c')][_0x631b('0x5b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x631b('0x2f')](function(_0x430a04){var _0x165830=fs[_0x631b('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x631b('0x6b')](_0x165830,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2cd327,_0x344dde){total+=0x1;var _0x147826=total;promises[_0x631b('0x55')](checkRow(_0x2cd327,_0x430a04,_0x147826)['then'](function(){success+=0x1;})[_0x631b('0x31')](function(_0x2f2551){if(_0x2f2551[_0x631b('0x19')]){errors+=0x1;delete _0x2f2551[_0x631b('0x19')];}else if(_0x2f2551[_0x631b('0x6c')]){duplicates+=0x1;delete _0x2f2551[_0x631b('0x6c')];}rows['push'](_0x2f2551);}));if(total%0xc8===0x0){_0x344dde[_0x631b('0x6d')]();return processPromises(_0x344dde);}},'complete':function(){return processPromises()['then'](function(){logger[_0x631b('0x6e')](_0x631b('0x6f'));endCsv();});},'error':function(_0x4909a8,_0x3d0836){logger[_0x631b('0x6e')]('CSV\x20parse\x20error',JSON['stringify'](_0x4909a8));endCsv();}});})[_0x631b('0x31')](function(_0x39f64b){logger[_0x631b('0x19')](_0x631b('0x70'),JSON[_0x631b('0x32')](_0x39f64b));});}main(); \ No newline at end of file +var _0x7ab7=['cm_hopper_black','VoiceQueue','findAll','outbound','Lists','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','CmList','BlackLists','get','Campaign','dialCheckDuplicateType','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','insert','scheduledAt','ContactId','updatedAt','select','field','phone','NOW()','toString','createdAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','cm_hopper','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','cm_hopper_final','phone\x20NOT\x20IN\x20(?)'];(function(_0x158b1c,_0x39aa8a){var _0x126827=function(_0x4eb84a){while(--_0x4eb84a){_0x158b1c['push'](_0x158b1c['shift']());}};_0x126827(++_0x39aa8a);}(_0x7ab7,0x91));var _0x77ab=function(_0xa434e5,_0x390c6b){_0xa434e5=_0xa434e5-0x0;var _0x21704d=_0x7ab7[_0xa434e5];return _0x21704d;};'use strict';var BPromise=require(_0x77ab('0x0'));var util=require(_0x77ab('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x77ab('0x2'));var Papa=require('papaparse');var Redis=require(_0x77ab('0x3'));var db=require(_0x77ab('0x4'))['db'];var config=require(_0x77ab('0x5'));var logger=require(_0x77ab('0x6'))(_0x77ab('0x7'));config['redis']=_[_0x77ab('0x8')](config[_0x77ab('0x9')],{'host':_0x77ab('0xa'),'port':0x18eb});var socket=require(_0x77ab('0xb'))(new Redis(config[_0x77ab('0x9')]));require(_0x77ab('0xc'))[_0x77ab('0xd')](socket);try{if(!process['argv'][0x2]||process[_0x77ab('0xe')][0x2]===_0x77ab('0xf')||process[_0x77ab('0xe')][0x2]===_0x77ab('0x10')){throw new Error(_0x77ab('0x11'));}var FILEPATH=process[_0x77ab('0xe')][0x2];if(!process['argv'][0x3]||process[_0x77ab('0xe')][0x3]===_0x77ab('0xf')||process[_0x77ab('0xe')][0x3]===_0x77ab('0x10')||!process[_0x77ab('0xe')][0x4]||process[_0x77ab('0xe')][0x4]===_0x77ab('0xf')||process['argv'][0x4]===_0x77ab('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x77ab('0x12')](process['argv'][0x3][_0x77ab('0x13')](','),process[_0x77ab('0xe')][0x4][_0x77ab('0x13')](','));if(!process[_0x77ab('0xe')][0x5]||process[_0x77ab('0xe')][0x5]==='undefined'||process[_0x77ab('0xe')][0x5]==='null'){throw new Error(_0x77ab('0x14'));}var LISTID=process[_0x77ab('0xe')][0x5];var COMPANYID=process[_0x77ab('0xe')][0x6]&&process[_0x77ab('0xe')][0x6]!==_0x77ab('0xf')&&process['argv'][0x6]!==_0x77ab('0x10')?process['argv'][0x6]:null;var DUPLICATES=process[_0x77ab('0xe')][0x7]&&process[_0x77ab('0xe')][0x7]!=='undefined'&&process[_0x77ab('0xe')][0x7]!==_0x77ab('0x10')?process[_0x77ab('0xe')][0x7]:null;if(!process[_0x77ab('0xe')][0x8]||process['argv'][0x8]===_0x77ab('0xf')||process[_0x77ab('0xe')][0x8]===_0x77ab('0x10')){throw new Error(_0x77ab('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x285207){logger[_0x77ab('0x16')](_0x285207);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(_0x583699,_0xe0d0c7,_0x46a180,_0x3ffbd5){var _0x2e157c={'message':_0xe0d0c7};_0x2e157c[_0x583699]=!![];if(_0x46a180){_0x2e157c[_0x77ab('0x17')]=_0x46a180;}if(_0x3ffbd5){_0x2e157c[_0x77ab('0x18')]=_0x3ffbd5;}return _0x2e157c;}function isEmail(_0x217de1){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))*$/[_0x77ab('0x19')](_0x217de1);}function checkRow(_0x1be87a,_0x188c49,_0x46bee8){return new BPromise(function(_0x470da7,_0x3ba594){if(_[_0x77ab('0x1a')](_0x1be87a)){return _0x3ba594(handleCheckRowError(_0x77ab('0x16'),_0x77ab('0x1b'),null,_0x46bee8));}if(_0x1be87a[_0x77ab('0x1c')]&&_0x1be87a[_0x77ab('0x1c')]['length']){var _0x45dfb6=_[_0x77ab('0x1d')](_0x1be87a[_0x77ab('0x1c')],'message')[_0x77ab('0x1e')](';');return _0x3ba594(handleCheckRowError(_0x77ab('0x16'),_0x45dfb6,null,_0x46bee8));}var _0x40554b={};for(var _0x490e14 in FIELDS){if(FIELDS[_0x77ab('0x1f')](_0x490e14)&&FIELDS[_0x490e14]){_0x40554b[_0x490e14]=_0x1be87a[_0x77ab('0x20')][0x0][FIELDS[_0x490e14]]||_0x1be87a[_0x77ab('0x20')][0x0]['\ufeff'+FIELDS[_0x490e14]];}}if(!_0x40554b[_0x77ab('0x21')]){return _0x3ba594(handleCheckRowError(_0x77ab('0x16'),_0x77ab('0x22'),null,_0x46bee8));}if(!_0x40554b['phone']){return _0x3ba594(handleCheckRowError(_0x77ab('0x16'),'phone\x20not\x20specified!',null,_0x46bee8));}if(_0x40554b[_0x77ab('0x23')]){var _0x436999=moment(_0x40554b[_0x77ab('0x23')],_0x77ab('0x24'));if(!_0x436999[_0x77ab('0x25')]()){return _0x3ba594(handleCheckRowError(_0x77ab('0x16'),_0x77ab('0x26'),null,_0x46bee8));}}if(_0x40554b['email']){if(!isEmail(_0x40554b['email'])){return _0x3ba594(handleCheckRowError(_0x77ab('0x16'),_0x77ab('0x27'),null,_0x46bee8));}}_0x40554b[_0x77ab('0x28')]=LISTID;_0x40554b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x77ab('0x29')]&&_0x188c49){var _0x7e2995={};for(var _0x268e38=0x0,_0x309c40=DUPLICATES[_0x77ab('0x29')];_0x268e38<_0x309c40;_0x268e38+=0x1){_0x7e2995[DUPLICATES[_0x268e38]]=_0x40554b[DUPLICATES[_0x268e38]];}var _0x139bde=_[_0x77ab('0x2a')](_0x188c49,_0x7e2995);if(_0x139bde){return _0x3ba594(handleCheckRowError(_0x77ab('0x2b'),_0x77ab('0x2c'),_0x139bde,_0x46bee8));}}return db[_0x77ab('0x2d')][_0x77ab('0x2e')](_0x40554b,{'raw':!![],'hooks':![],'fields':_[_0x77ab('0x2f')](_0x40554b)})[_0x77ab('0x30')](function(_0x12c76e){if(DUPLICATES&&DUPLICATES['length']&&_0x188c49){_0x188c49[_0x77ab('0x31')](_[_0x77ab('0x32')](_0x40554b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x12c76e['id'];return _0x470da7();})[_0x77ab('0x33')](function(_0x18090c){return _0x3ba594(handleCheckRowError(_0x77ab('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x18090c[_0x77ab('0x34')]||JSON[_0x77ab('0x35')](_0x18090c)),null,_0x46bee8));});});}function checkHopper(){function _0x19d0e2(){return function(_0x1049a8){logger['error'](_0x77ab('0x36'),_0x77ab('0x37'),util[_0x77ab('0x38')](_0x1049a8,{'showHidden':![],'depth':null}));};}var _0x19ab94=function(_0x1b59f2,_0x1a1de4){var _0xc16558=squel[_0x77ab('0x39')]()['into']('cm_hopper')['fromQuery'](['phone',_0x77ab('0x3a'),_0x77ab('0x3b'),_0x77ab('0x28'),_0x1a1de4,'createdAt',_0x77ab('0x3c')],squel[_0x77ab('0x3d')]()[_0x77ab('0x3e')](_0x77ab('0x3f'),_0x77ab('0x3f'))[_0x77ab('0x3e')](_0x77ab('0x40'),'scheduledAt')[_0x77ab('0x3e')]('id',_0x77ab('0x3b'))[_0x77ab('0x3e')](LISTID[_0x77ab('0x41')](),_0x77ab('0x28'))[_0x77ab('0x3e')](_0x1b59f2['id'][_0x77ab('0x41')](),_0x1a1de4)['field'](_0x77ab('0x40'),_0x77ab('0x42'))[_0x77ab('0x3e')](_0x77ab('0x40'),_0x77ab('0x3c'))['from'](_0x77ab('0x43'))[_0x77ab('0x44')](_0x77ab('0x45'))[_0x77ab('0x44')](_0x77ab('0x46'),LISTID[_0x77ab('0x41')]())[_0x77ab('0x44')](_0x77ab('0x47'))[_0x77ab('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x77ab('0x3d')]()[_0x77ab('0x3e')](_0x77ab('0x3f'))[_0x77ab('0x48')](_0x77ab('0x49'))[_0x77ab('0x44')](_0x1a1de4+_0x77ab('0x4a'),_0x1b59f2['id'][_0x77ab('0x41')]())))[_0x77ab('0x41')]();return _0xc16558;};var _0x3a67f2=function(_0x3a92d9,_0x461924){var _0x39d9db=squel[_0x77ab('0x39')]()[_0x77ab('0x4b')](_0x77ab('0x49'))[_0x77ab('0x4c')]([_0x77ab('0x3f'),_0x77ab('0x3a'),'ContactId',_0x77ab('0x28'),_0x461924,_0x77ab('0x42'),'updatedAt'],squel[_0x77ab('0x3d')]()[_0x77ab('0x3e')](_0x77ab('0x3f'),_0x77ab('0x3f'))[_0x77ab('0x3e')]('NOW()',_0x77ab('0x3a'))['field']('id',_0x77ab('0x3b'))[_0x77ab('0x3e')](LISTID[_0x77ab('0x41')](),_0x77ab('0x28'))[_0x77ab('0x3e')](_0x3a92d9['id'][_0x77ab('0x41')](),_0x461924)[_0x77ab('0x3e')](_0x77ab('0x40'),_0x77ab('0x42'))['field'](_0x77ab('0x40'),_0x77ab('0x3c'))[_0x77ab('0x48')](_0x77ab('0x43'))[_0x77ab('0x44')](_0x77ab('0x45'))[_0x77ab('0x44')](_0x77ab('0x46'),LISTID[_0x77ab('0x41')]())[_0x77ab('0x44')](_0x77ab('0x4d'),squel[_0x77ab('0x4e')](hopperContacts))[_0x77ab('0x44')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x77ab('0x3e')]('calleridnum')[_0x77ab('0x48')](_0x77ab('0x4f'))[_0x77ab('0x44')](_0x461924+_0x77ab('0x4a'),_0x3a92d9['id'][_0x77ab('0x41')]()))['where'](_0x77ab('0x50'),squel[_0x77ab('0x3d')]()[_0x77ab('0x3e')]('phone')[_0x77ab('0x48')](_0x77ab('0x49'))[_0x77ab('0x44')](_0x461924+_0x77ab('0x4a'),_0x3a92d9['id'][_0x77ab('0x41')]())))[_0x77ab('0x41')]();return _0x39d9db;};function _0x4671a2(_0x388ac0,_0x5e068d){var _0x56b3bf=squel['insert']()['into']('cm_hopper')[_0x77ab('0x4c')]([_0x77ab('0x3f'),_0x77ab('0x3a'),_0x77ab('0x3b'),'ListId',_0x5e068d,_0x77ab('0x42'),_0x77ab('0x3c')],squel[_0x77ab('0x3d')]()[_0x77ab('0x3e')](_0x77ab('0x3f'),_0x77ab('0x3f'))[_0x77ab('0x3e')](_0x77ab('0x40'),_0x77ab('0x3a'))[_0x77ab('0x3e')]('id',_0x77ab('0x3b'))[_0x77ab('0x3e')](LISTID['toString'](),_0x77ab('0x28'))[_0x77ab('0x3e')](_0x388ac0['id'][_0x77ab('0x41')](),_0x5e068d)['field'](_0x77ab('0x40'),'createdAt')['field'](_0x77ab('0x40'),'updatedAt')[_0x77ab('0x48')]('cm_contacts')[_0x77ab('0x44')](_0x77ab('0x45'))['where']('ListId\x20=\x20?',LISTID[_0x77ab('0x41')]())[_0x77ab('0x44')](_0x77ab('0x4d'),squel['str'](hopperContacts))['where'](_0x77ab('0x47')))[_0x77ab('0x41')]();return _0x56b3bf;}function _0x1f9625(_0x235c54,_0x49c786){var _0x1f44dd=squel['insert']()[_0x77ab('0x4b')](_0x77ab('0x51'))[_0x77ab('0x4c')]([_0x77ab('0x3f'),_0x77ab('0x3b'),'ListId',_0x49c786,_0x77ab('0x42'),'updatedAt'],squel[_0x77ab('0x3d')]()[_0x77ab('0x3e')]('phone',_0x77ab('0x3f'))['field']('id',_0x77ab('0x3b'))['field'](LISTID[_0x77ab('0x41')](),_0x77ab('0x28'))[_0x77ab('0x3e')](_0x235c54['id'][_0x77ab('0x41')](),_0x49c786)['field'](_0x77ab('0x40'),_0x77ab('0x42'))[_0x77ab('0x3e')](_0x77ab('0x40'),_0x77ab('0x3c'))[_0x77ab('0x48')](_0x77ab('0x43'))[_0x77ab('0x44')](_0x77ab('0x45'))[_0x77ab('0x44')](_0x77ab('0x46'),LISTID[_0x77ab('0x41')]())[_0x77ab('0x44')]('id\x20IN\x20?',squel[_0x77ab('0x4e')](hopperContacts))[_0x77ab('0x44')](_0x77ab('0x47')))['toString']();return _0x1f44dd;}return db[_0x77ab('0x52')][_0x77ab('0x53')]({'where':{'type':_0x77ab('0x54')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x77ab('0x55'),'where':{'id':LISTID}}]})['then'](function(_0xc39ca9){var _0x40ecad=[];if(_0xc39ca9){var _0x19d786;for(var _0xb4bff=0x0,_0x4d8cbe;_0xb4bff<_0xc39ca9[_0x77ab('0x29')];_0xb4bff+=0x1){_0x4d8cbe=_0xc39ca9[_0xb4bff]['get']({'plain':!![]});switch(_0x4d8cbe['dialCheckDuplicateType']){case _0x77ab('0x56'):_0x40ecad[_0x77ab('0x31')](db[_0x77ab('0x57')][_0x77ab('0x58')](_0x3a67f2(_0x4d8cbe,'VoiceQueueId'))[_0x77ab('0x30')](function(){})['catch'](_0x19d0e2()));break;case _0x77ab('0x59'):_0x40ecad[_0x77ab('0x31')](db[_0x77ab('0x57')]['query'](_0x19ab94(_0x4d8cbe,_0x77ab('0x5a')))[_0x77ab('0x30')](function(){})[_0x77ab('0x33')](_0x19d0e2()));break;default:_0x40ecad[_0x77ab('0x31')](db[_0x77ab('0x57')][_0x77ab('0x58')](_0x4671a2(_0x4d8cbe,_0x77ab('0x5a')))[_0x77ab('0x30')](function(){})[_0x77ab('0x33')](_0x19d0e2()));}}}return _0x40ecad;})[_0x77ab('0x5b')]()['then'](function(){return db[_0x77ab('0x52')][_0x77ab('0x53')]({'where':{'type':_0x77ab('0x54')},'attributes':['id'],'include':[{'model':db[_0x77ab('0x5c')],'as':_0x77ab('0x5d'),'where':{'id':LISTID}}]})[_0x77ab('0x30')](function(_0x1e8cc8){var _0x259b63=[];if(_0x1e8cc8){var _0xc999a2;for(var _0x34dcbf=0x0,_0x483dc1;_0x34dcbf<_0x1e8cc8['length'];_0x34dcbf+=0x1){_0x483dc1=_0x1e8cc8[_0x34dcbf][_0x77ab('0x5e')]({'plain':!![]});_0x259b63[_0x77ab('0x31')](db[_0x77ab('0x57')]['query'](_0x1f9625(_0x483dc1,_0x77ab('0x5a')))[_0x77ab('0x30')](function(){})['catch'](_0x19d0e2()));}}return _0x259b63;})['all']();})[_0x77ab('0x30')](function(){return db[_0x77ab('0x5f')][_0x77ab('0x53')]({'attributes':['id',_0x77ab('0x60')],'include':[{'model':db['CmList'],'as':_0x77ab('0x55'),'where':{'id':LISTID}}]})[_0x77ab('0x30')](function(_0x5ca92d){var _0xb3ed57=[];if(_0x5ca92d){for(var _0x425f6b=0x0,_0x2e09c4;_0x425f6b<_0x5ca92d['length'];_0x425f6b+=0x1){_0x2e09c4=_0x5ca92d[_0x425f6b][_0x77ab('0x5e')]({'plain':!![]});switch(_0x2e09c4[_0x77ab('0x60')]){case _0x77ab('0x56'):_0xb3ed57['push'](db['sequelize'][_0x77ab('0x58')](_0x3a67f2(_0x2e09c4,_0x77ab('0x61')))[_0x77ab('0x30')](function(){})[_0x77ab('0x33')](_0x19d0e2()));break;case _0x77ab('0x59'):_0xb3ed57[_0x77ab('0x31')](db[_0x77ab('0x57')]['query'](_0x19ab94(_0x2e09c4,_0x77ab('0x61')))[_0x77ab('0x30')](function(){})['catch'](_0x19d0e2()));break;default:_0xb3ed57['push'](db[_0x77ab('0x57')][_0x77ab('0x58')](_0x4671a2(_0x2e09c4,'CampaignId'))['then'](function(){})['catch'](_0x19d0e2()));}}}return _0xb3ed57;})['all']();})[_0x77ab('0x30')](function(){return db[_0x77ab('0x5f')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x77ab('0x5c')],'as':_0x77ab('0x5d'),'where':{'id':LISTID}}]})[_0x77ab('0x30')](function(_0xaed23c){var _0x1ebee8=[];if(_0xaed23c){for(var _0x4fdbb7=0x0,_0x303f01;_0x4fdbb7<_0xaed23c[_0x77ab('0x29')];_0x4fdbb7+=0x1){_0x303f01=_0xaed23c[_0x4fdbb7][_0x77ab('0x5e')]({'plain':!![]});_0x1ebee8[_0x77ab('0x31')](db[_0x77ab('0x57')][_0x77ab('0x58')](_0x1f9625(_0x303f01,'CampaignId'))[_0x77ab('0x30')](function(){})[_0x77ab('0x33')](_0x19d0e2()));}}return _0x1ebee8;})[_0x77ab('0x5b')]();})[_0x77ab('0x33')](function(_0x591073){logger[_0x77ab('0x16')](_0x77ab('0x62'),_0x77ab('0x63'),_0x591073['message']);});}var processPromises=function(_0x965278){return BPromise[_0x77ab('0x5b')](promises)['then'](function(_0x2638a0){})[_0x77ab('0x33')](function(_0x30054b){logger[_0x77ab('0x16')](_0x77ab('0x64'),JSON[_0x77ab('0x35')](_0x30054b));})['finally'](function(){socket[_0x77ab('0x65')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x965278){return _0x965278['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x77ab('0x30')](function(){if(hopperContacts){return checkHopper();}})[_0x77ab('0x30')](function(){socket[_0x77ab('0x65')](_0x77ab('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2503b9){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x77ab('0x35')](_0x2503b9));}finally{process[_0x77ab('0x67')](0x0);}});};process['on'](_0x77ab('0x68'),function(){logger[_0x77ab('0x69')](_0x77ab('0x6a'));endCsv();});function main(){return BPromise[_0x77ab('0x6b')]()[_0x77ab('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x77ab('0x13')](',');return db['CmContact'][_0x77ab('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x77ab('0x30')](function(_0x56f060){var _0x1d7e11=fs[_0x77ab('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x77ab('0x6d')](_0x1d7e11,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2c4305,_0x26891b){total+=0x1;var _0x3aee7b=total;promises[_0x77ab('0x31')](checkRow(_0x2c4305,_0x56f060,_0x3aee7b)[_0x77ab('0x30')](function(){success+=0x1;})[_0x77ab('0x33')](function(_0x15a1a8){if(_0x15a1a8[_0x77ab('0x16')]){errors+=0x1;delete _0x15a1a8[_0x77ab('0x16')];}else if(_0x15a1a8[_0x77ab('0x2b')]){duplicates+=0x1;delete _0x15a1a8[_0x77ab('0x2b')];}rows[_0x77ab('0x31')](_0x15a1a8);}));if(total%0xc8===0x0){_0x26891b[_0x77ab('0x6e')]();return processPromises(_0x26891b);}},'complete':function(){return processPromises()[_0x77ab('0x30')](function(){logger['info'](_0x77ab('0x6f'));endCsv();});},'error':function(_0x926fcf,_0x23b2d5){logger['info']('CSV\x20parse\x20error',JSON[_0x77ab('0x35')](_0x926fcf));endCsv();}});})['catch'](function(_0x764f31){logger[_0x77ab('0x16')](_0x77ab('0x70'),JSON[_0x77ab('0x35')](_0x764f31));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6a06bf1..3f447cf 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 _0x2885=['../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','split','isNil','filter','findOne','update','updated','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','join','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','createdAt','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','cm_contacts','cm_contacts.createdAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','spread','all','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','utcOffset','set','main','stringify','send','start','clone','socket_timestamp','.csv','includes','header','name','_description','writeFileSync','parse','createReadStream','data','find','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','itemTypeId','description','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','affectedRows','argv','root','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird'];(function(_0x5708e6,_0x224d75){var _0xe7bb=function(_0x42c655){while(--_0x42c655){_0x5708e6['push'](_0x5708e6['shift']());}};_0xe7bb(++_0x224d75);}(_0x2885,0x164));var _0x5288=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x2885[_0x288f5e];return _0x476cc9;};'use strict';var fs=require('fs');var path=require(_0x5288('0x0'));var _=require(_0x5288('0x1'));var Papa=require(_0x5288('0x2'));var util=require('util');var BPromise=require(_0x5288('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0x5288('0x4'))['db'];var config=require(_0x5288('0x5'));var shared=require(_0x5288('0x6'));var logger=require(_0x5288('0x7'))('import');config[_0x5288('0x8')]=_[_0x5288('0x9')](config[_0x5288('0x8')],{'host':_0x5288('0xa'),'port':0x18eb});var socket=require(_0x5288('0xb'))(new Redis(config[_0x5288('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5288('0xc')](_0x5288('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5288('0xc')](_0x5288('0xd'));function isEmail(_0x4728d4){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))*$/[_0x5288('0xe')](_0x4728d4);}function selectNotIn(_0x42cedc,_0x24fad8,_0x4e7d3a,_0x14a257,_0x4c3540){return squel[_0x5288('0xf')]()[_0x5288('0x10')]('phone')[_0x5288('0x11')](_0x14a257)['join'](_0x24fad8,null,_0x24fad8+_0x5288('0x12')+_0x14a257+'.'+_0x4e7d3a)[_0x5288('0x13')](_0x14a257+'.'+_0x4e7d3a+_0x5288('0x14')+_0x42cedc+'.'+_0x4e7d3a)['where'](_0x24fad8+_0x5288('0x15')+_0x4c3540['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x150559,_0x50e623){promisesAdditionalPhones=[];return db[_0x5288('0x16')][_0x5288('0x17')]({'raw':!![],'attributes':['id',_0x5288('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5288('0x19')](function(_0x461992){if(_0x461992!==null){var _0x4e5364=[];for(var _0x3f66af=0x0;_0x3f66af<_0x461992[_0x5288('0x1a')];_0x3f66af++){var _0x56af3a=_0x461992[_0x3f66af];_0x4e5364[_0x5288('0x1b')](insertAdditionalPhones(_0x56af3a));}}Promise['all'](_0x4e5364)[_0x5288('0x19')](function(){_0x150559({'val':0x1});});});});}function insertAdditionalPhones(_0x2be1d0){return new Promise(function(_0x50b36b,_0x2a307f){var _0x34d5a4=_0x2be1d0[_0x5288('0x18')];var _0x7d2abd=_0x34d5a4[_0x5288('0x1c')](';');var _0x42558c=[];orderBy=0x0;for(var _0x7ae574=0x0;_0x7ae574<_0x7d2abd['length'];_0x7ae574++){_0x42558c['push'](splitAdditionalPhone(_0x2be1d0['id'],_0x7d2abd[_0x7ae574]));}Promise['all'](_0x42558c)[_0x5288('0x19')](function(){_0x50b36b({'val':_0x7d2abd[_0x5288('0x1a')]});});});}function splitAdditionalPhone(_0x144efa,_0x48c94f){return new Promise(function(_0x53312e,_0x5d33bb){var _0x4047df=_0x48c94f[_0x5288('0x1c')](':');var _0x4b0292=_0x4047df[0x0];var _0x542385=_0x4047df[0x1];if(!_[_0x5288('0x1d')](_0x542385)){var _0xb88e38=_0x542385['split']('|');var _0x313d5a=[];for(var _0x2ce88e=0x0;_0x2ce88e<_0xb88e38[_0x5288('0x1a')];_0x2ce88e++){if(_0xb88e38[_0x2ce88e]!==''){var _0x9be8b1=_[_0x5288('0x1e')](promisesAdditionalPhones,{'contactId':_0x144efa,'phone':_0xb88e38[_0x2ce88e]});if(_0x9be8b1[_0x5288('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x5288('0x1b')]({'contactId':_0x144efa,'contactTypeId':_0x4b0292,'phone':_0xb88e38[_0x2ce88e],'orderBy':orderBy});}}}_0x53312e({'ok':0x1});}else _0x53312e({'res':0x0});});}function createAdditionalPhone(_0x38b8bd,_0x231044,_0x1cb4b4,_0x77ddd0){var _0x310279='';var _0x4cca6c='';var _0x1cf80c=_0x1cb4b4[_0x5288('0x1c')]('§');_0x310279=_0x1cf80c[0x0];if(_0x1cf80c[_0x5288('0x1a')]==0x2)_0x4cca6c=_0x1cf80c[0x1];return new Promise(function(_0x4b474b,_0x499829){return db['CmContactHasItem'][_0x5288('0x1f')]({'where':{'CmContactId':_0x38b8bd,'item':_0x310279}})['then'](function(_0x5605fb){if(_0x5605fb){return db['CmContactHasItem'][_0x5288('0x20')]({'ItemTypeId':_0x231044,'description':_0x4cca6c,'OrderBy':_0x77ddd0},{'where':{'CmContactId':_0x38b8bd,'item':_0x310279}})[_0x5288('0x19')](function(_0x38d005){_0x4b474b({'res':_0x5288('0x21')});});}else{return db['CmContactHasItem'][_0x5288('0x22')]({'CmContactId':_0x38b8bd,'item':_0x310279,'description':_0x4cca6c,'ItemTypeId':_0x231044,'OrderBy':_0x77ddd0,'ItemClass':_0x5288('0x23')})['then'](function(_0x2f9b76){_0x4b474b({'res':_0x5288('0x24')});});}});});}function insertCmHopper(_0x1b487f,_0x12088b,_0x1f7530,_0x251674,_0x1ba9aa){var _0x5b8405=['cm_contacts.phone',_0x5288('0x25'),_0x5288('0x26'),_0x5288('0x27'),_0x12088b+'.'+_0x251674,'cm_contacts.createdAt',_0x5288('0x28'),'cm_contacts.priority',_0x5288('0x29'),'\x22'+_0x1ba9aa+'\x22'];return squel[_0x5288('0x2a')]()[_0x5288('0x2b')](_0x5288('0x2c'))[_0x5288('0x2d')]([_0x5288('0x2e'),'scheduledat',_0x5288('0x2f'),_0x5288('0x30'),_0x251674,'createdAt',_0x5288('0x31'),_0x5288('0x32'),_0x5288('0x33'),_0x5288('0x34')],squel[_0x5288('0xf')]()[_0x5288('0x35')](_0x5b8405)[_0x5288('0x11')](_0x12088b)[_0x5288('0x36')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x12088b+_0x5288('0x37'))[_0x5288('0x36')](_0x1f7530,null,_0x1f7530+_0x5288('0x12')+_0x12088b+'.'+_0x251674)[_0x5288('0x13')](_0x12088b+_0x5288('0x38'),_0x1b487f)[_0x5288('0x13')](_0x5288('0x39'),NOW)[_0x5288('0x13')](_0x5288('0x3a'),selectNotIn(_0x12088b,_0x1f7530,_0x251674,'cm_hopper',[_0x5288('0x3b'),_0x5288('0x3c')]))['where'](_0x5288('0x3a'),selectNotIn(_0x12088b,_0x1f7530,_0x251674,_0x5288('0x2c'),[_0x5288('0x3b')])))[_0x5288('0x3d')]();}function insertCmHopperBlack(_0x2c4710,_0x156b2e,_0x3bb863,_0x46416f){var _0x3b9ada=[_0x5288('0x3e'),_0x5288('0x26'),_0x5288('0x27'),_0x156b2e+'.'+_0x46416f,'cm_contacts.createdAt',_0x5288('0x28')];return squel['insert']()[_0x5288('0x2b')](_0x5288('0x3f'))[_0x5288('0x2d')]([_0x5288('0x2e'),'ContactId',_0x5288('0x30'),_0x46416f,_0x5288('0x40'),_0x5288('0x31')],squel['select']()[_0x5288('0x35')](_0x3b9ada)[_0x5288('0x11')](_0x156b2e)['join']('cm_contacts',null,_0x5288('0x41')+_0x156b2e+'.CmListId')[_0x5288('0x36')](_0x3bb863,null,_0x3bb863+'.id\x20=\x20'+_0x156b2e+'.'+_0x46416f)['where'](_0x156b2e+_0x5288('0x38'),_0x2c4710)[_0x5288('0x13')](_0x5288('0x39'),NOW)['where'](_0x5288('0x3a'),squel[_0x5288('0xf')]()[_0x5288('0x10')](_0x5288('0x2e'))[_0x5288('0x11')](_0x5288('0x3f'))[_0x5288('0x13')](_0x5288('0x42'),_0x2c4710)[_0x5288('0x13')](_0x46416f+'\x20=\x20'+_0x156b2e+'.'+_0x46416f)))['toString']();}function insertTzCmHopper(_0x4ffe11,_0x1d393a,_0x3d083e,_0x46a784,_0x3316a4,_0x5894a4){var _0x2ec90d=[_0x5288('0x3e'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x5894a4+_0x5288('0x43'),'cm_contacts.id',_0x5288('0x27'),_0x1d393a+'.'+_0x46a784,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0x5288('0x29'),'\x22'+_0x3316a4+'\x22'];var _0x37e35b=squel[_0x5288('0x2a')]()[_0x5288('0x2b')]('cm_hopper')[_0x5288('0x2d')](['phone',_0x5288('0x44'),_0x5288('0x2f'),_0x5288('0x30'),_0x46a784,_0x5288('0x40'),'updatedAt','priority',_0x5288('0x33'),_0x5288('0x34')],squel[_0x5288('0xf')]()[_0x5288('0x35')](_0x2ec90d)['from'](_0x1d393a)['join'](_0x5288('0x45'),null,_0x5288('0x41')+_0x1d393a+_0x5288('0x37'))[_0x5288('0x36')](_0x3d083e,null,_0x3d083e+_0x5288('0x12')+_0x1d393a+'.'+_0x46a784)['join'](_0x5894a4,null,_0x5894a4+_0x5288('0x12')+_0x1d393a+'.'+_0x46a784)['where'](_0x1d393a+_0x5288('0x38'),_0x4ffe11)[_0x5288('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5288('0x13')](_0x5288('0x3a'),selectNotIn(_0x1d393a,_0x3d083e,_0x46a784,_0x5288('0x2c'),['\x22always\x22',_0x5288('0x3c')]))[_0x5288('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1d393a,_0x3d083e,_0x46a784,'cm_hopper',[_0x5288('0x3b')])))[_0x5288('0x3d')]();return _0x37e35b;}function insertTzCmHopperBlack(_0x4ced35,_0x41a986,_0x382ca3,_0x2639f8){var _0x11c519=[_0x5288('0x3e'),'cm_contacts.id',_0x5288('0x27'),_0x41a986+'.'+_0x2639f8,_0x5288('0x46'),_0x5288('0x28')];return squel['insert']()['into']('cm_hopper_black')[_0x5288('0x2d')]([_0x5288('0x2e'),_0x5288('0x2f'),'ListId',_0x2639f8,'createdAt',_0x5288('0x31')],squel[_0x5288('0xf')]()[_0x5288('0x35')](_0x11c519)[_0x5288('0x11')](_0x41a986)[_0x5288('0x36')](_0x5288('0x45'),null,_0x5288('0x41')+_0x41a986+_0x5288('0x37'))[_0x5288('0x36')](_0x382ca3,null,_0x382ca3+_0x5288('0x12')+_0x41a986+'.'+_0x2639f8)['where'](_0x41a986+'.CmListId\x20=\x20?',_0x4ced35)['where'](_0x5288('0x39'),NOW)[_0x5288('0x13')](_0x5288('0x3a'),squel[_0x5288('0xf')]()[_0x5288('0x10')](_0x5288('0x2e'))[_0x5288('0x11')](_0x5288('0x3f'))[_0x5288('0x13')](_0x5288('0x42'),_0x4ced35)[_0x5288('0x13')](_0x2639f8+_0x5288('0x14')+_0x41a986+'.'+_0x2639f8)))[_0x5288('0x3d')]();}function insertCmHopperAdditionalPhones(_0x50f220){var _0x56ad65=[_0x5288('0x47'),_0x5288('0x48'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x5288('0x49')];return squel[_0x5288('0x2a')]()['into']('cm_hopper_additional_phones')[_0x5288('0x2d')]([_0x5288('0x4a'),_0x5288('0x2e'),_0x5288('0x4b'),_0x5288('0x40'),'updatedAt'],squel[_0x5288('0xf')]()[_0x5288('0x35')](_0x56ad65)['from'](_0x5288('0x2c'))[_0x5288('0x36')](_0x5288('0x45'),null,_0x5288('0x4c'))[_0x5288('0x36')](_0x5288('0x4d'),null,_0x5288('0x4e'))['where']('cm_hopper.ListId\x20=\x20?',_0x50f220)[_0x5288('0x13')](_0x5288('0x39'),NOW))[_0x5288('0x3d')]();}function insertCmContact(_0x24b3c3,_0x1be348,_0x1f725b,_0x407b95){var _0x2ae9fd=_['concat'](_[_0x5288('0x4f')](_0x407b95),[_0x5288('0x30'),_0x5288('0x50'),_0x5288('0x40'),'updatedAt',_0x5288('0x51')]);return squel[_0x5288('0x2a')]()[_0x5288('0x2b')](_0x5288('0x45'))[_0x5288('0x2d')](_0x2ae9fd,squel[_0x5288('0xf')]()['fields'](_0x2ae9fd)['from'](_0x1be348)[_0x5288('0x13')]('('+_0x1f725b['join'](',')+_0x5288('0x52'),squel[_0x5288('0xf')]()['fields'](_0x1f725b)[_0x5288('0x11')](_0x5288('0x45'))[_0x5288('0x13')](_0x5288('0x42'),_0x24b3c3)['where'](_0x5288('0x53')))[_0x5288('0x13')](_0x5288('0x54'),squel['select']()[_0x5288('0x10')](_0x5288('0x55'),_0x5288('0x56'))[_0x5288('0x11')](_0x1be348)[_0x5288('0x57')](_0x1f725b[_0x5288('0x36')](','))))[_0x5288('0x3d')]();}function handleStop(){logger[_0x5288('0x58')](_0x5288('0x59'));stopped=!![];}function handleUncaughtException(_0xfd2543){logger[_0x5288('0x5a')](_0xfd2543[_0x5288('0x5b')]);process[_0x5288('0x5c')](0x1);}function handleError(_0x1634c3,_0x1bcfad){stats[_0x5288('0x5d')][_0x5288('0x1b')]({'name':_0x1bcfad['code'],'message':_0x1bcfad['message'],'row':_0x1634c3});}function handleQuery(_0x4887f5){logger[_0x5288('0x58')](_0x4887f5);return db['sequelize'][_0x5288('0x5e')](_0x4887f5)['spread'](function(_0x1c2cd0){results[_0x5288('0x1b')](_0x1c2cd0);})[_0x5288('0x5f')](function(_0x5562b3){logger[_0x5288('0x5a')](_0x5562b3[_0x5288('0x5b')]);});}function updateTzCampaigns(_0x1a59dc){return new Promise(function(_0x50ceec,_0x4564b0){var _0x2adf83=squel['select']()[_0x5288('0x35')]([_0x5288('0x60'),_0x5288('0x61')])[_0x5288('0x11')](_0x5288('0x62'))[_0x5288('0x36')]('campaigns_has_cm_lists',null,_0x5288('0x63'))[_0x5288('0x13')](_0x5288('0x64')+_0x1a59dc);db[_0x5288('0x65')][_0x5288('0x5e')](_0x2adf83[_0x5288('0x3d')]())[_0x5288('0x66')](function(_0x111130){var _0x342526=[];for(var _0x2c892e=0x0;_0x2c892e<_0x111130['length'];_0x2c892e++){_0x342526['push'](getTimezoneData(_0x111130[_0x2c892e],tmp_campaigns));}BPromise[_0x5288('0x67')](_0x342526)[_0x5288('0x19')](function(){_0x50ceec({'val':0x1});});})[_0x5288('0x5f')](function(_0x3ef685){logger[_0x5288('0x5a')](_0x3ef685[_0x5288('0x5b')]);_0x50ceec({'val':0x0});});});}function updateTzVoiceQueues(_0x6f8e8e){return new Promise(function(_0x47f5f6,_0x1d8156){var _0x2a85c7=squel[_0x5288('0xf')]()[_0x5288('0x35')](['voice_queues.id',_0x5288('0x68')])[_0x5288('0x11')](_0x5288('0x69'))[_0x5288('0x36')]('voice_queues_has_cm_lists',null,_0x5288('0x6a'))[_0x5288('0x13')](_0x5288('0x6b')+_0x6f8e8e);db['sequelize'][_0x5288('0x5e')](_0x2a85c7[_0x5288('0x3d')]())[_0x5288('0x66')](function(_0x5c272d){var _0x165d42=[];for(var _0x501a70=0x0;_0x501a70<_0x5c272d[_0x5288('0x1a')];_0x501a70++){_0x165d42[_0x5288('0x1b')](getTimezoneData(_0x5c272d[_0x501a70],tmp_voice_queues));}BPromise[_0x5288('0x67')](_0x165d42)['then'](function(){_0x47f5f6({'val':0x1});});})[_0x5288('0x5f')](function(_0x2d3ee7){logger[_0x5288('0x5a')](_0x2d3ee7['message']);_0x47f5f6({'val':0x0});});});}function getTimezoneData(_0x2f9c39,_0x3cda00){return new Promise(function(_0x38dbcc,_0x11730e){var _0x3d5d78=shared['timezones'];var _0x549067=_0x3d5d78[_0x2f9c39[_0x5288('0x6c')]];if(_[_0x5288('0x1d')](_0x549067)){_0x38dbcc({'ret':0x1});}else{var _0xe53b5c=_0x549067[_0x5288('0x6d')];var _0x539135=squel[_0x5288('0x2a')]()['into'](_0x3cda00)[_0x5288('0x6e')]('id',_0x2f9c39['id'])[_0x5288('0x6e')]('offset',_0xe53b5c)['set'](_0x5288('0x6c'),_0x2f9c39[_0x5288('0x6c')])['toString']();return db['sequelize'][_0x5288('0x5e')](_0x539135)[_0x5288('0x66')](function(_0x12ff18){_0x38dbcc({'ret':0x1});})[_0x5288('0x5f')](function(_0x1016dc){logger[_0x5288('0x5a')](_0x1016dc[_0x5288('0x5b')]);_0x11730e({'ret':0x1});});}});}function handleTZQuery(_0x58c0e4){logger['info'](_0x58c0e4);return db[_0x5288('0x65')][_0x5288('0x5e')](_0x58c0e4)['spread'](function(_0x2cf5dc){})[_0x5288('0x5f')](function(_0x779936){logger[_0x5288('0x5a')](_0x779936[_0x5288('0x5b')]);});}function main(_0x3b1109,_0x5bc4c0,_0x1a19ee,_0x2c0056){logger[_0x5288('0x58')](_0x5288('0x6f'),_0x3b1109,JSON[_0x5288('0x70')](_0x5bc4c0));process[_0x5288('0x71')](_0x5288('0x72'));var _0x578fb0=_0x5bc4c0['binding'];var _0xf2d8f8=_[_0x5288('0x73')](_0x578fb0);var _0xf4d216=_0x5bc4c0[_0x5288('0x74')];var _0x5bf125=path[_0x5288('0x36')](config['root'],'server/files/tmp',_0xf4d216+_0x5288('0x75'));hasTZ=_[_0x5288('0x4f')](_0x578fb0)[_0x5288('0x76')](_0x5288('0x6c'));var _0x2b02f5=_[_0x5288('0x4f')](_0x578fb0)[_0x5288('0x36')]();logger['info'](_0x5288('0x77'),_0x2b02f5);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})[_0x5288('0x19')](function(_0x2cea69){for(var _0xd31fac=0x0;_0xd31fac<_0x2cea69['length'];_0xd31fac++){if(_0x2cea69[_0xd31fac][_0x5288('0x78')]in _0x578fb0){contactItemTypes[_0x5288('0x1b')](_0x2cea69[_0xd31fac]);delete _0xf2d8f8[_0x2cea69[_0xd31fac][_0x5288('0x78')]];hasAdditionalPhones=!![];}for(var _0x4c13a3 in _0x578fb0){if(_0x2cea69[_0xd31fac][_0x5288('0x78')]+_0x5288('0x79')===_0x4c13a3){phoneDescriptions[_0x5288('0x1b')]({'itemTypeId':_0x2cea69[_0xd31fac]['id'],'description':_0x4c13a3});delete _0xf2d8f8[_0x4c13a3];}}}if(hasAdditionalPhones)_0xf2d8f8[_0x5288('0x18')]='';var _0x83231a=_[_0x5288('0x4f')](_0xf2d8f8)[_0x5288('0x36')]();logger['info'](_0x5288('0x77'),_0x83231a);fs[_0x5288('0x7a')](_0x5bf125,_0x83231a+'\x0a');Papa[_0x5288('0x7b')](fs[_0x5288('0x7c')](_0x3b1109),{'header':!![],'skipEmptyLines':!![],'step':function(_0x11b28a,_0x522a8c){try{for(var _0x26558c=0x0,_0x2af6f3=[];_0x26558c<_0x11b28a[_0x5288('0x7d')]['length'];_0x26558c++){stats['rows']+=0x1;if(_0x11b28a[_0x5288('0x5d')][_0x26558c]){handleError(_0x11b28a[_0x5288('0x7d')][_0x26558c],_0x11b28a[_0x5288('0x5d')][_0x26558c]);}else{var _0xdc7a2e=[];var _0x3a9dbd=[];var _0x3d03e8={};for(var _0x140ae5 in _0x578fb0){let _0xe1568e=contactItemTypes[_0x5288('0x7e')](_0x511f5f=>_0x511f5f[_0x5288('0x78')]===_0x140ae5);let _0x3581d0=contactItemTypes[_0x5288('0x7e')](_0x31d6e8=>_0x31d6e8[_0x5288('0x78')]+_0x5288('0x79')===_0x140ae5);if(_[_0x5288('0x1d')](_0xe1568e)&&_[_0x5288('0x1d')](_0x3581d0)){if(_0x578fb0['hasOwnProperty'](_0x140ae5)){if(_0x11b28a[_0x5288('0x7d')][_0x26558c][_0x578fb0[_0x140ae5]]){var _0x30446b=_[_0x5288('0x7f')](_0x11b28a[_0x5288('0x7d')][_0x26558c][_0x578fb0[_0x140ae5]][_0x5288('0x80')](/"/g,'\x27'));switch(_0x140ae5){case _0x5288('0x44'):var _0x41ff07=moment(_0x30446b,_0x5288('0xd'),!![]);if(_0x41ff07['isValid']()){_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x30446b+'\x22');}else{_0xdc7a2e['push'](_0x5288('0x81'));}break;case _0x5288('0x32'):var _0x81c02c=parseInt(_0x30446b);_0x30446b=_[_0x5288('0x82')](_0x81c02c)||_0x81c02c<0x0||_0x81c02c>0x4?_0x2c0056?0x3:0x2:_0x81c02c;_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x30446b+'\x22');break;case _0x5288('0x33'):var _0x3c01b8=parseInt(_0x30446b);if(_[_0x5288('0x83')](_0x3c01b8)&&_[_0x5288('0x76')](_0x1a19ee,_0x3c01b8)){_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x3c01b8+'\x22');}else{_0xdc7a2e[_0x5288('0x1b')](_0x5288('0x84'));}break;case _0x5288('0x85'):if(isEmail(_0x30446b)){_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x30446b+'\x22');}else{_0xdc7a2e[_0x5288('0x1b')]('email\x20wrong\x20format');}break;case _0x5288('0x86'):var _0xdd8dcb=moment(_0x30446b,'YYYY-MM-DD',!![]);if(_0xdd8dcb['isValid']()){_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x30446b+'\x22');}else{_0xdc7a2e[_0x5288('0x1b')](_0x5288('0x87'));}break;case _0x5288('0x6c'):var _0x229501=shared[_0x5288('0x88')];var _0x295e09=_0x229501[_0x30446b];if(!_[_0x5288('0x1d')](_0x295e09)){var _0x3b0b24=_0x295e09['utcOffset'];_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x30446b+'\x22');_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x3b0b24+'\x22');}break;default:_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x30446b+'\x22');}}else{switch(_0x140ae5){case _0x5288('0x89'):case'phone':_0xdc7a2e[_0x5288('0x1b')](_0x140ae5+'\x20not\x20specified');break;default:_0x2af6f3['push']('\x22\x22');}}}}else{var _0x1460f6='';if(!_['isNil'](_0xe1568e)){if(!_0x3d03e8['hasOwnProperty'](_0xe1568e['id'])){if(!_['isNil'](_0x11b28a['data'][_0x26558c][_0x578fb0[_0x140ae5]])){var _0x30446b=_['trim'](_0x11b28a['data'][_0x26558c][_0x578fb0[_0x140ae5]][_0x5288('0x80')](/"/g,'\x27'));var _0x20de3c=phoneDescriptions[_0x5288('0x7e')](_0x5be4b7=>_0x5be4b7[_0x5288('0x8a')]===_0xe1568e['id']);if(!_[_0x5288('0x1d')](_0x20de3c)){var _0xd921d7=_[_0x5288('0x7f')](_0x11b28a[_0x5288('0x7d')][_0x26558c][_0x578fb0[_0x20de3c[_0x5288('0x8b')]]][_0x5288('0x80')](/"/g,'\x27'));if(!_['isNil'](_0xd921d7))_0x30446b=_0x30446b+'§'+_0xd921d7;}if(_0x1460f6=='')_0x1460f6=_0x30446b;else _0x1460f6+='|'+_0x30446b;}_0x3a9dbd[_0x5288('0x1b')](_0xe1568e['id']+':'+_0x1460f6);_0x3d03e8[_0xe1568e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2af6f3[_0x5288('0x1b')]('\x22'+_0x3a9dbd[_0x5288('0x36')](';')+'\x22');}if(_0xdc7a2e[_0x5288('0x1a')]){handleError(_0x11b28a[_0x5288('0x7d')][_0x26558c],{'code':'SystemRow','message':_0xdc7a2e[_0x5288('0x36')]()});}else{fs[_0x5288('0x8c')](_0x5bf125,_0x2af6f3[_0x5288('0x36')]()+'\x0a');}_0x2af6f3=[];}if(!(stats[_0x5288('0x8d')]%0xc8)){socket[_0x5288('0x8e')](_0x5288('0x8f')+_0xf4d216,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x5288('0x90'));_0x522a8c[_0x5288('0x91')]();}}catch(_0x4ff18c){handleError(_0x11b28a[_0x5288('0x7d')][_0x26558c],{'code':_0x5288('0x92'),'message':_0x4ff18c[_0x5288('0x5b')]});logger[_0x5288('0x5a')]('step',_0x4ff18c[_0x5288('0x5b')]);}},'complete':function(){try{var _0x4de303=[];var _0x16118c=[];var _0x335c26=_0x5288('0x45');if(_0x5bc4c0['duplicates']&&_0x5bc4c0[_0x5288('0x93')][_0x5288('0x1a')]){_0x335c26=_0x5288('0x94')+_0xf4d216;_0x4de303['push'](_0x5288('0x95')+_0x335c26+_0x5288('0x96'));}tmp_campaigns='campaigns_'+_0xf4d216;tmp_voice_queues=_0x5288('0x97')+_0xf4d216;_0x16118c['push'](_0x5288('0x95')+tmp_campaigns+_0x5288('0x98'));_0x16118c['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x5288('0x98'));BPromise[_0x5288('0x99')](_0x16118c,handleTZQuery)['then'](function(_0x28ba33){updateTzCampaigns(_0x5bc4c0[_0x5288('0x30')])[_0x5288('0x19')](function(_0x5cac94){updateTzVoiceQueues(_0x5bc4c0[_0x5288('0x30')])[_0x5288('0x19')](function(_0x4b1568){if(hasTZ)_0x83231a=_0x83231a[_0x5288('0x80')](_0x5288('0x6c'),_0x5288('0x9a'));var _0x3cad05=util[_0x5288('0xc')](_0x5288('0x9b'),_0x5bf125,_0x335c26,_0x83231a,_0x5bc4c0[_0x5288('0x30')],_0x5bc4c0['CompanyId']||null,NOW,NOW);if(_[_0x5288('0x1d')](_0x578fb0[_0x5288('0x44')])){_0x3cad05+=_0x5288('0x9c');}_0x4de303[_0x5288('0x1b')](_0x3cad05);if(_0x5bc4c0[_0x5288('0x93')]&&_0x5bc4c0[_0x5288('0x93')][_0x5288('0x1a')]){_0x4de303[_0x5288('0x1b')](insertCmContact(_0x5bc4c0[_0x5288('0x30')],_0x335c26,_0x5bc4c0[_0x5288('0x93')],_0x578fb0));_0x4de303['push']('DROP\x20TABLE\x20'+_0x335c26+';');}BPromise[_0x5288('0x99')](_0x4de303,handleQuery)[_0x5288('0x19')](function(_0x2626e1){BPromise[_0x5288('0x67')]([handleAdditionalPhones()])[_0x5288('0x19')](function(){_0x4de303=[];for(var _0x1bbf82=0x0;_0x1bbf82\x20\x20');}var _0x189ba7=path[_0x5288('0x36')](config[_0x5288('0xa8')],_0x5288('0xa9'),process['argv'][0x2]);if(!fs[_0x5288('0xaa')](_0x189ba7)){throw new Error(_0x5288('0xab'));}var _0x1c0db0={};try{_0x1c0db0=JSON['parse'](process[_0x5288('0xa7')][0x3]);if(!_0x1c0db0[_0x5288('0xac')]){throw new Error(_0x5288('0xad'));}if(!_0x1c0db0[_0x5288('0xac')][_0x5288('0x2e')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x1c0db0[_0x5288('0xac')][_0x5288('0x89')]){throw new Error(_0x5288('0xae'));}var _0x5b827d=0x0;if(_0x1c0db0[_0x5288('0xac')][_0x5288('0x33')]){_0x5b827d=0x1;}if(!_0x1c0db0['ListId']){throw new Error(_0x5288('0xaf'));}}catch(_0x241b3a){throw new Error('body\x20id\x20mandatory');}var _0x1ce216=[];try{_0x1ce216=_[_0x5288('0xb0')](JSON[_0x5288('0x7b')](process[_0x5288('0xa7')][0x4]),'id');}catch(_0x26324){logger[_0x5288('0x58')](_0x5288('0xb1'));}main(_0x189ba7,_0x1c0db0,_0x1ce216,_0x5b827d);}validate();process['on'](_0x5288('0xb2'),handleStop);process['on'](_0x5288('0xb3'),handleUncaughtException); \ No newline at end of file +var _0xee4b=['scheduledat','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','.CmListId\x20=\x20?','field','cm_hopper_black','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.createdAt','ContactId','.CmListId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','group','info','error','message','exit','errors','code','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','createReadStream','data','rows','find','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each',',\x20scheduledAt\x20=\x20NOW()','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','map','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','select','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xee4b,0x86));var _0xbee4=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xee4b[_0x21cb7f];return _0x5a079a;};'use strict';var fs=require('fs');var path=require(_0xbee4('0x0'));var _=require(_0xbee4('0x1'));var Papa=require(_0xbee4('0x2'));var util=require(_0xbee4('0x3'));var BPromise=require('bluebird');var moment=require(_0xbee4('0x4'));var squel=require(_0xbee4('0x5'));var Redis=require(_0xbee4('0x6'));var db=require(_0xbee4('0x7'))['db'];var config=require(_0xbee4('0x8'));var shared=require(_0xbee4('0x9'));var logger=require(_0xbee4('0xa'))(_0xbee4('0xb'));config[_0xbee4('0xc')]=_[_0xbee4('0xd')](config[_0xbee4('0xc')],{'host':_0xbee4('0xe'),'port':0x18eb});var socket=require(_0xbee4('0xf'))(new Redis(config[_0xbee4('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xbee4('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xbee4('0x11')](_0xbee4('0x10'));function isEmail(_0x34914d){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'](_0x34914d);}function selectNotIn(_0xab4057,_0x3d676c,_0x4b8384,_0x14a194,_0x6cebde){return squel[_0xbee4('0x12')]()['field'](_0xbee4('0x13'))[_0xbee4('0x14')](_0x14a194)[_0xbee4('0x15')](_0x3d676c,null,_0x3d676c+_0xbee4('0x16')+_0x14a194+'.'+_0x4b8384)['where'](_0x14a194+'.'+_0x4b8384+_0xbee4('0x17')+_0xab4057+'.'+_0x4b8384)['where'](_0x3d676c+_0xbee4('0x18')+_0x6cebde[_0xbee4('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x214d92,_0x168732){promisesAdditionalPhones=[];return db[_0xbee4('0x19')][_0xbee4('0x1a')]({'raw':!![],'attributes':['id',_0xbee4('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xbee4('0x1c')](function(_0x42e7b7){if(_0x42e7b7!==null){var _0x5c7022=[];for(var _0x179717=0x0;_0x179717<_0x42e7b7[_0xbee4('0x1d')];_0x179717++){var _0x51cd6f=_0x42e7b7[_0x179717];_0x5c7022[_0xbee4('0x1e')](insertAdditionalPhones(_0x51cd6f));}}Promise[_0xbee4('0x1f')](_0x5c7022)[_0xbee4('0x1c')](function(){_0x214d92({'val':0x1});});});});}function insertAdditionalPhones(_0x4eb420){return new Promise(function(_0x5cf8a1,_0x4e1d41){var _0x3ae3c7=_0x4eb420['AdditionalPhones'];var _0xf700b1=_0x3ae3c7[_0xbee4('0x20')](';');var _0x55f333=[];orderBy=0x0;for(var _0x274f3e=0x0;_0x274f3e<_0xf700b1[_0xbee4('0x1d')];_0x274f3e++){_0x55f333[_0xbee4('0x1e')](splitAdditionalPhone(_0x4eb420['id'],_0xf700b1[_0x274f3e]));}Promise[_0xbee4('0x1f')](_0x55f333)[_0xbee4('0x1c')](function(){_0x5cf8a1({'val':_0xf700b1[_0xbee4('0x1d')]});});});}function splitAdditionalPhone(_0x740927,_0x1e51fa){return new Promise(function(_0x58e951,_0x1a5501){var _0x6cc7ef=_0x1e51fa['split'](':');var _0x2242a6=_0x6cc7ef[0x0];var _0x291e6c=_0x6cc7ef[0x1];if(!_[_0xbee4('0x21')](_0x291e6c)){var _0x13256f=_0x291e6c['split']('|');var _0x37c197=[];for(var _0x3c8ade=0x0;_0x3c8ade<_0x13256f[_0xbee4('0x1d')];_0x3c8ade++){if(_0x13256f[_0x3c8ade]!==''){var _0xfebee=_['filter'](promisesAdditionalPhones,{'contactId':_0x740927,'phone':_0x13256f[_0x3c8ade]});if(_0xfebee[_0xbee4('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0xbee4('0x1e')]({'contactId':_0x740927,'contactTypeId':_0x2242a6,'phone':_0x13256f[_0x3c8ade],'orderBy':orderBy});}}}_0x58e951({'ok':0x1});}else _0x58e951({'res':0x0});});}function createAdditionalPhone(_0x3b0aef,_0x1ac521,_0x1fd87e,_0x49fba7){var _0x453ecf='';var _0x2433b1='';var _0x56bd55=_0x1fd87e[_0xbee4('0x20')]('§');_0x453ecf=_0x56bd55[0x0];if(_0x56bd55[_0xbee4('0x1d')]==0x2)_0x2433b1=_0x56bd55[0x1];return new Promise(function(_0x345348,_0x101ed3){return db[_0xbee4('0x22')][_0xbee4('0x23')]({'where':{'CmContactId':_0x3b0aef,'item':_0x453ecf}})[_0xbee4('0x1c')](function(_0x53e57f){if(_0x53e57f){return db[_0xbee4('0x22')][_0xbee4('0x24')]({'ItemTypeId':_0x1ac521,'description':_0x2433b1,'OrderBy':_0x49fba7},{'where':{'CmContactId':_0x3b0aef,'item':_0x453ecf}})['then'](function(_0x564dbf){_0x345348({'res':_0xbee4('0x25')});});}else{return db[_0xbee4('0x22')][_0xbee4('0x26')]({'CmContactId':_0x3b0aef,'item':_0x453ecf,'description':_0x2433b1,'ItemTypeId':_0x1ac521,'OrderBy':_0x49fba7,'ItemClass':'PHONE'})[_0xbee4('0x1c')](function(_0x355a19){_0x345348({'res':_0xbee4('0x27')});});}});});}function insertCmHopper(_0x3f572a,_0x527ead,_0x5d966d,_0x22951e,_0x223265){var _0x5d2b3b=[_0xbee4('0x28'),_0xbee4('0x29'),_0xbee4('0x2a'),_0xbee4('0x2b'),_0x527ead+'.'+_0x22951e,'cm_contacts.createdAt',_0xbee4('0x2c'),_0xbee4('0x2d'),'cm_contacts.UserId','\x22'+_0x223265+'\x22'];return squel[_0xbee4('0x2e')]()[_0xbee4('0x2f')](_0xbee4('0x30'))[_0xbee4('0x31')](['phone',_0xbee4('0x32'),'ContactId',_0xbee4('0x33'),_0x22951e,_0xbee4('0x34'),_0xbee4('0x35'),_0xbee4('0x36'),'UserId',_0xbee4('0x37')],squel['select']()[_0xbee4('0x38')](_0x5d2b3b)[_0xbee4('0x14')](_0x527ead)[_0xbee4('0x15')](_0xbee4('0x39'),null,_0xbee4('0x3a')+_0x527ead+'.CmListId')[_0xbee4('0x15')](_0x5d966d,null,_0x5d966d+'.id\x20=\x20'+_0x527ead+'.'+_0x22951e)[_0xbee4('0x3b')](_0x527ead+'.CmListId\x20=\x20?',_0x3f572a)['where'](_0xbee4('0x3c'),NOW)[_0xbee4('0x3b')](_0xbee4('0x3d'),selectNotIn(_0x527ead,_0x5d966d,_0x22951e,_0xbee4('0x30'),[_0xbee4('0x3e'),_0xbee4('0x3f')]))[_0xbee4('0x3b')](_0xbee4('0x3d'),selectNotIn(_0x527ead,_0x5d966d,_0x22951e,_0xbee4('0x30'),[_0xbee4('0x3e')])))['toString']();}function insertCmHopperBlack(_0x161b58,_0x1e43ef,_0x33858d,_0x3c39c4){var _0x4cd2a3=[_0xbee4('0x28'),'cm_contacts.id',_0xbee4('0x2b'),_0x1e43ef+'.'+_0x3c39c4,'cm_contacts.createdAt',_0xbee4('0x2c')];return squel[_0xbee4('0x2e')]()[_0xbee4('0x2f')]('cm_hopper_black')[_0xbee4('0x31')](['phone','ContactId',_0xbee4('0x33'),_0x3c39c4,_0xbee4('0x34'),_0xbee4('0x35')],squel['select']()['fields'](_0x4cd2a3)[_0xbee4('0x14')](_0x1e43ef)[_0xbee4('0x15')](_0xbee4('0x39'),null,_0xbee4('0x3a')+_0x1e43ef+'.CmListId')[_0xbee4('0x15')](_0x33858d,null,_0x33858d+_0xbee4('0x16')+_0x1e43ef+'.'+_0x3c39c4)['where'](_0x1e43ef+_0xbee4('0x40'),_0x161b58)[_0xbee4('0x3b')](_0xbee4('0x3c'),NOW)['where'](_0xbee4('0x3d'),squel[_0xbee4('0x12')]()[_0xbee4('0x41')](_0xbee4('0x13'))[_0xbee4('0x14')](_0xbee4('0x42'))[_0xbee4('0x3b')](_0xbee4('0x43'),_0x161b58)[_0xbee4('0x3b')](_0x3c39c4+_0xbee4('0x17')+_0x1e43ef+'.'+_0x3c39c4)))[_0xbee4('0x44')]();}function insertTzCmHopper(_0x2ada17,_0x208ef2,_0x8abfd7,_0x1b5b23,_0x14beaa,_0x10dcd9){var _0xcd0a3a=[_0xbee4('0x28'),_0xbee4('0x45')+_0x10dcd9+'.offset-cm_contacts.utcOffset\x20minute)',_0xbee4('0x2a'),'cm_contacts.ListId',_0x208ef2+'.'+_0x1b5b23,_0xbee4('0x46'),_0xbee4('0x2c'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x14beaa+'\x22'];var _0x4b9ace=squel['insert']()[_0xbee4('0x2f')](_0xbee4('0x30'))['fromQuery']([_0xbee4('0x13'),_0xbee4('0x32'),_0xbee4('0x47'),_0xbee4('0x33'),_0x1b5b23,_0xbee4('0x34'),_0xbee4('0x35'),_0xbee4('0x36'),'UserId',_0xbee4('0x37')],squel[_0xbee4('0x12')]()['fields'](_0xcd0a3a)['from'](_0x208ef2)[_0xbee4('0x15')](_0xbee4('0x39'),null,_0xbee4('0x3a')+_0x208ef2+_0xbee4('0x48'))[_0xbee4('0x15')](_0x8abfd7,null,_0x8abfd7+_0xbee4('0x16')+_0x208ef2+'.'+_0x1b5b23)[_0xbee4('0x15')](_0x10dcd9,null,_0x10dcd9+_0xbee4('0x16')+_0x208ef2+'.'+_0x1b5b23)['where'](_0x208ef2+_0xbee4('0x40'),_0x2ada17)[_0xbee4('0x3b')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbee4('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x208ef2,_0x8abfd7,_0x1b5b23,_0xbee4('0x30'),[_0xbee4('0x3e'),_0xbee4('0x3f')]))[_0xbee4('0x3b')](_0xbee4('0x3d'),selectNotIn(_0x208ef2,_0x8abfd7,_0x1b5b23,_0xbee4('0x30'),[_0xbee4('0x3e')])))[_0xbee4('0x44')]();return _0x4b9ace;}function insertTzCmHopperBlack(_0x582f0a,_0x2d0001,_0x2db95a,_0x4e19ae){var _0x49a158=[_0xbee4('0x28'),_0xbee4('0x2a'),_0xbee4('0x2b'),_0x2d0001+'.'+_0x4e19ae,_0xbee4('0x46'),_0xbee4('0x2c')];return squel[_0xbee4('0x2e')]()[_0xbee4('0x2f')](_0xbee4('0x42'))[_0xbee4('0x31')]([_0xbee4('0x13'),'ContactId',_0xbee4('0x33'),_0x4e19ae,'createdAt',_0xbee4('0x35')],squel[_0xbee4('0x12')]()[_0xbee4('0x38')](_0x49a158)[_0xbee4('0x14')](_0x2d0001)['join'](_0xbee4('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x2d0001+_0xbee4('0x48'))['join'](_0x2db95a,null,_0x2db95a+'.id\x20=\x20'+_0x2d0001+'.'+_0x4e19ae)[_0xbee4('0x3b')](_0x2d0001+_0xbee4('0x40'),_0x582f0a)[_0xbee4('0x3b')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xbee4('0x12')]()[_0xbee4('0x41')](_0xbee4('0x13'))[_0xbee4('0x14')](_0xbee4('0x42'))['where'](_0xbee4('0x43'),_0x582f0a)[_0xbee4('0x3b')](_0x4e19ae+_0xbee4('0x17')+_0x2d0001+'.'+_0x4e19ae)))['toString']();}function insertCmHopperAdditionalPhones(_0x4b288b){var _0xe59e50=[_0xbee4('0x49'),_0xbee4('0x4a'),_0xbee4('0x4b'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xbee4('0x2e')]()[_0xbee4('0x2f')](_0xbee4('0x4c'))[_0xbee4('0x31')]([_0xbee4('0x4d'),_0xbee4('0x13'),_0xbee4('0x4e'),_0xbee4('0x34'),'updatedAt'],squel[_0xbee4('0x12')]()['fields'](_0xe59e50)[_0xbee4('0x14')](_0xbee4('0x30'))[_0xbee4('0x15')]('cm_contacts',null,_0xbee4('0x4f'))[_0xbee4('0x15')]('cm_contact_has_items',null,_0xbee4('0x50'))[_0xbee4('0x3b')]('cm_hopper.ListId\x20=\x20?',_0x4b288b)[_0xbee4('0x3b')](_0xbee4('0x3c'),NOW))[_0xbee4('0x44')]();}function insertCmContact(_0x28836d,_0x59ce82,_0xfd23f4,_0x272d98){var _0x19df8c=_[_0xbee4('0x51')](_[_0xbee4('0x52')](_0x272d98),['ListId',_0xbee4('0x53'),_0xbee4('0x34'),_0xbee4('0x35'),_0xbee4('0x54')]);return squel['insert']()[_0xbee4('0x2f')](_0xbee4('0x39'))['fromQuery'](_0x19df8c,squel[_0xbee4('0x12')]()[_0xbee4('0x38')](_0x19df8c)['from'](_0x59ce82)[_0xbee4('0x3b')]('('+_0xfd23f4[_0xbee4('0x15')](',')+_0xbee4('0x55'),squel[_0xbee4('0x12')]()[_0xbee4('0x38')](_0xfd23f4)[_0xbee4('0x14')](_0xbee4('0x39'))['where'](_0xbee4('0x43'),_0x28836d)[_0xbee4('0x3b')](_0xbee4('0x56')))['where'](_0xbee4('0x57'),squel[_0xbee4('0x12')]()[_0xbee4('0x41')]('MIN(id)','min_id')['from'](_0x59ce82)[_0xbee4('0x58')](_0xfd23f4['join'](','))))[_0xbee4('0x44')]();}function handleStop(){logger[_0xbee4('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4cdd4b){logger[_0xbee4('0x5a')](_0x4cdd4b[_0xbee4('0x5b')]);process[_0xbee4('0x5c')](0x1);}function handleError(_0x2e6ca5,_0x30e2ed){stats[_0xbee4('0x5d')][_0xbee4('0x1e')]({'name':_0x30e2ed[_0xbee4('0x5e')],'message':_0x30e2ed[_0xbee4('0x5b')],'row':_0x2e6ca5});}function handleQuery(_0x5beed1){logger[_0xbee4('0x59')](_0x5beed1);return db[_0xbee4('0x5f')][_0xbee4('0x60')](_0x5beed1)['spread'](function(_0x1568ce){results[_0xbee4('0x1e')](_0x1568ce);})[_0xbee4('0x61')](function(_0x4672c2){logger[_0xbee4('0x5a')](_0x4672c2[_0xbee4('0x5b')]);});}function updateTzCampaigns(_0x261c9a){return new Promise(function(_0x1106ca,_0x1c8b96){var _0x31b51c=squel['select']()['fields']([_0xbee4('0x62'),_0xbee4('0x63')])[_0xbee4('0x14')](_0xbee4('0x64'))[_0xbee4('0x15')](_0xbee4('0x65'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where']('campaigns_has_cm_lists.CmListId='+_0x261c9a);db[_0xbee4('0x5f')][_0xbee4('0x60')](_0x31b51c[_0xbee4('0x44')]())[_0xbee4('0x66')](function(_0x363057){var _0x2f14fa=[];for(var _0x41e535=0x0;_0x41e535<_0x363057[_0xbee4('0x1d')];_0x41e535++){_0x2f14fa[_0xbee4('0x1e')](getTimezoneData(_0x363057[_0x41e535],tmp_campaigns));}BPromise[_0xbee4('0x1f')](_0x2f14fa)[_0xbee4('0x1c')](function(){_0x1106ca({'val':0x1});});})[_0xbee4('0x61')](function(_0x55e980){logger[_0xbee4('0x5a')](_0x55e980[_0xbee4('0x5b')]);_0x1106ca({'val':0x0});});});}function updateTzVoiceQueues(_0x26bd43){return new Promise(function(_0x165d40,_0x4d950f){var _0x2843c4=squel[_0xbee4('0x12')]()['fields']([_0xbee4('0x67'),_0xbee4('0x68')])[_0xbee4('0x14')](_0xbee4('0x69'))[_0xbee4('0x15')](_0xbee4('0x6a'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0xbee4('0x6b')+_0x26bd43);db[_0xbee4('0x5f')][_0xbee4('0x60')](_0x2843c4['toString']())[_0xbee4('0x66')](function(_0x4b1e81){var _0xfbd0bd=[];for(var _0xfae00d=0x0;_0xfae00d<_0x4b1e81['length'];_0xfae00d++){_0xfbd0bd[_0xbee4('0x1e')](getTimezoneData(_0x4b1e81[_0xfae00d],tmp_voice_queues));}BPromise[_0xbee4('0x1f')](_0xfbd0bd)[_0xbee4('0x1c')](function(){_0x165d40({'val':0x1});});})[_0xbee4('0x61')](function(_0x59ec1e){logger['error'](_0x59ec1e['message']);_0x165d40({'val':0x0});});});}function getTimezoneData(_0x3adcf1,_0x2cf227){return new Promise(function(_0x3226c1,_0x1ef264){var _0x4993f7=shared[_0xbee4('0x6c')];var _0x3d4c36=_0x4993f7[_0x3adcf1[_0xbee4('0x6d')]];if(_[_0xbee4('0x21')](_0x3d4c36)){_0x3226c1({'ret':0x1});}else{var _0x5cda9b=_0x3d4c36[_0xbee4('0x6e')];var _0x62f172=squel[_0xbee4('0x2e')]()[_0xbee4('0x2f')](_0x2cf227)[_0xbee4('0x6f')]('id',_0x3adcf1['id'])[_0xbee4('0x6f')]('offset',_0x5cda9b)[_0xbee4('0x6f')](_0xbee4('0x6d'),_0x3adcf1[_0xbee4('0x6d')])[_0xbee4('0x44')]();return db['sequelize'][_0xbee4('0x60')](_0x62f172)['spread'](function(_0x3272f8){_0x3226c1({'ret':0x1});})[_0xbee4('0x61')](function(_0xeca46b){logger[_0xbee4('0x5a')](_0xeca46b[_0xbee4('0x5b')]);_0x1ef264({'ret':0x1});});}});}function handleTZQuery(_0x577309){logger[_0xbee4('0x59')](_0x577309);return db[_0xbee4('0x5f')][_0xbee4('0x60')](_0x577309)[_0xbee4('0x66')](function(_0x5f2c27){})[_0xbee4('0x61')](function(_0x556d13){logger[_0xbee4('0x5a')](_0x556d13['message']);});}function main(_0x5aeef2,_0x1c4cd1,_0x14a339,_0x593892){logger[_0xbee4('0x59')](_0xbee4('0x70'),_0x5aeef2,JSON[_0xbee4('0x71')](_0x1c4cd1));process[_0xbee4('0x72')](_0xbee4('0x73'));var _0x134b23=_0x1c4cd1[_0xbee4('0x74')];var _0x54a428=_[_0xbee4('0x75')](_0x134b23);var _0x5d33cd=_0x1c4cd1[_0xbee4('0x76')];var _0x5187bd=path[_0xbee4('0x15')](config[_0xbee4('0x77')],_0xbee4('0x78'),_0x5d33cd+_0xbee4('0x79'));hasTZ=_['keys'](_0x134b23)[_0xbee4('0x7a')](_0xbee4('0x6d'));var _0x3db9c5=_['keys'](_0x134b23)[_0xbee4('0x15')]();logger[_0xbee4('0x59')](_0xbee4('0x7b'),_0x3db9c5);db[_0xbee4('0x7c')][_0xbee4('0x1a')]({'raw':!![],'attributes':['id',_0xbee4('0x7d')]})[_0xbee4('0x1c')](function(_0x5f4ec5){for(var _0x54a24e=0x0;_0x54a24e<_0x5f4ec5[_0xbee4('0x1d')];_0x54a24e++){if(_0x5f4ec5[_0x54a24e][_0xbee4('0x7d')]in _0x134b23){contactItemTypes[_0xbee4('0x1e')](_0x5f4ec5[_0x54a24e]);delete _0x54a428[_0x5f4ec5[_0x54a24e][_0xbee4('0x7d')]];hasAdditionalPhones=!![];}for(var _0x263292 in _0x134b23){if(_0x5f4ec5[_0x54a24e]['name']+_0xbee4('0x7e')===_0x263292){phoneDescriptions[_0xbee4('0x1e')]({'itemTypeId':_0x5f4ec5[_0x54a24e]['id'],'description':_0x263292});delete _0x54a428[_0x263292];}}}if(hasAdditionalPhones)_0x54a428[_0xbee4('0x1b')]='';var _0x4eb9f=_[_0xbee4('0x52')](_0x54a428)['join']();logger[_0xbee4('0x59')](_0xbee4('0x7b'),_0x4eb9f);fs['writeFileSync'](_0x5187bd,_0x4eb9f+'\x0a');Papa['parse'](fs[_0xbee4('0x7f')](_0x5aeef2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d87c6,_0x1ac72e){try{for(var _0x36acc7=0x0,_0x56ad70=[];_0x36acc7<_0x3d87c6[_0xbee4('0x80')]['length'];_0x36acc7++){stats[_0xbee4('0x81')]+=0x1;if(_0x3d87c6['errors'][_0x36acc7]){handleError(_0x3d87c6[_0xbee4('0x80')][_0x36acc7],_0x3d87c6[_0xbee4('0x5d')][_0x36acc7]);}else{var _0x2b14f9=[];var _0xf0cafa=[];var _0x59f2a6={};for(var _0x2a91fa in _0x134b23){let _0x38a274=contactItemTypes['find'](_0x76de96=>_0x76de96[_0xbee4('0x7d')]===_0x2a91fa);let _0x435f8b=contactItemTypes[_0xbee4('0x82')](_0x3d1d1b=>_0x3d1d1b['name']+'_description'===_0x2a91fa);if(_['isNil'](_0x38a274)&&_[_0xbee4('0x21')](_0x435f8b)){if(_0x134b23[_0xbee4('0x83')](_0x2a91fa)){if(_0x3d87c6[_0xbee4('0x80')][_0x36acc7][_0x134b23[_0x2a91fa]]){var _0x1b52fd=_[_0xbee4('0x84')](_0x3d87c6[_0xbee4('0x80')][_0x36acc7][_0x134b23[_0x2a91fa]]['replace'](/"/g,'\x27'));switch(_0x2a91fa){case _0xbee4('0x32'):var _0xb1f80a=moment(_0x1b52fd,_0xbee4('0x10'),!![]);if(_0xb1f80a['isValid']()){_0x56ad70['push']('\x22'+_0x1b52fd+'\x22');}else{_0x2b14f9[_0xbee4('0x1e')](_0xbee4('0x85'));}break;case _0xbee4('0x36'):var _0x22843e=parseInt(_0x1b52fd);_0x1b52fd=_[_0xbee4('0x86')](_0x22843e)||_0x22843e<0x0||_0x22843e>0x4?_0x593892?0x3:0x2:_0x22843e;_0x56ad70[_0xbee4('0x1e')]('\x22'+_0x1b52fd+'\x22');break;case'UserId':var _0x2bbd72=parseInt(_0x1b52fd);if(_[_0xbee4('0x87')](_0x2bbd72)&&_[_0xbee4('0x7a')](_0x14a339,_0x2bbd72)){_0x56ad70[_0xbee4('0x1e')]('\x22'+_0x2bbd72+'\x22');}else{_0x2b14f9[_0xbee4('0x1e')](_0xbee4('0x88'));}break;case'email':if(isEmail(_0x1b52fd)){_0x56ad70[_0xbee4('0x1e')]('\x22'+_0x1b52fd+'\x22');}else{_0x2b14f9[_0xbee4('0x1e')](_0xbee4('0x89'));}break;case'dateOfBirth':var _0x5cd204=moment(_0x1b52fd,_0xbee4('0x8a'),!![]);if(_0x5cd204[_0xbee4('0x8b')]()){_0x56ad70['push']('\x22'+_0x1b52fd+'\x22');}else{_0x2b14f9[_0xbee4('0x1e')](_0xbee4('0x8c'));}break;case _0xbee4('0x6d'):var _0x1e12c2=shared[_0xbee4('0x6c')];var _0x1d9113=_0x1e12c2[_0x1b52fd];if(!_[_0xbee4('0x21')](_0x1d9113)){var _0x3bcfb9=_0x1d9113[_0xbee4('0x6e')];_0x56ad70[_0xbee4('0x1e')]('\x22'+_0x1b52fd+'\x22');_0x56ad70['push']('\x22'+_0x3bcfb9+'\x22');}break;default:_0x56ad70[_0xbee4('0x1e')]('\x22'+_0x1b52fd+'\x22');}}else{switch(_0x2a91fa){case _0xbee4('0x8d'):case'phone':_0x2b14f9[_0xbee4('0x1e')](_0x2a91fa+_0xbee4('0x8e'));break;default:_0x56ad70['push']('\x22\x22');}}}}else{var _0x4a3c4b='';if(!_[_0xbee4('0x21')](_0x38a274)){if(!_0x59f2a6[_0xbee4('0x83')](_0x38a274['id'])){if(!_[_0xbee4('0x21')](_0x3d87c6['data'][_0x36acc7][_0x134b23[_0x2a91fa]])){var _0x1b52fd=_[_0xbee4('0x84')](_0x3d87c6[_0xbee4('0x80')][_0x36acc7][_0x134b23[_0x2a91fa]][_0xbee4('0x8f')](/"/g,'\x27'));var _0x35fc6e=phoneDescriptions[_0xbee4('0x82')](_0x8b0777=>_0x8b0777['itemTypeId']===_0x38a274['id']);if(!_[_0xbee4('0x21')](_0x35fc6e)){var _0x2deefd=_['trim'](_0x3d87c6[_0xbee4('0x80')][_0x36acc7][_0x134b23[_0x35fc6e[_0xbee4('0x90')]]][_0xbee4('0x8f')](/"/g,'\x27'));if(!_['isNil'](_0x2deefd))_0x1b52fd=_0x1b52fd+'§'+_0x2deefd;}if(_0x4a3c4b=='')_0x4a3c4b=_0x1b52fd;else _0x4a3c4b+='|'+_0x1b52fd;}_0xf0cafa[_0xbee4('0x1e')](_0x38a274['id']+':'+_0x4a3c4b);_0x59f2a6[_0x38a274['id']]=0x1;}}}}if(hasAdditionalPhones){_0x56ad70[_0xbee4('0x1e')]('\x22'+_0xf0cafa['join'](';')+'\x22');}if(_0x2b14f9['length']){handleError(_0x3d87c6['data'][_0x36acc7],{'code':_0xbee4('0x91'),'message':_0x2b14f9[_0xbee4('0x15')]()});}else{fs['appendFileSync'](_0x5187bd,_0x56ad70[_0xbee4('0x15')]()+'\x0a');}_0x56ad70=[];}if(!(stats[_0xbee4('0x81')]%0xc8)){socket[_0xbee4('0x92')](_0xbee4('0x93')+_0x5d33cd,stats);stats[_0xbee4('0x5d')]=[];}}if(stopped){logger[_0xbee4('0x59')](_0xbee4('0x94'));_0x1ac72e[_0xbee4('0x95')]();}}catch(_0x3e35b7){handleError(_0x3d87c6[_0xbee4('0x80')][_0x36acc7],{'code':_0xbee4('0x96'),'message':_0x3e35b7[_0xbee4('0x5b')]});logger[_0xbee4('0x5a')](_0xbee4('0x97'),_0x3e35b7[_0xbee4('0x5b')]);}},'complete':function(){try{var _0x22bd49=[];var _0x40f121=[];var _0x32b162='cm_contacts';if(_0x1c4cd1[_0xbee4('0x98')]&&_0x1c4cd1['duplicates'][_0xbee4('0x1d')]){_0x32b162=_0xbee4('0x99')+_0x5d33cd;_0x22bd49[_0xbee4('0x1e')](_0xbee4('0x9a')+_0x32b162+_0xbee4('0x9b'));}tmp_campaigns=_0xbee4('0x9c')+_0x5d33cd;tmp_voice_queues=_0xbee4('0x9d')+_0x5d33cd;_0x40f121['push'](_0xbee4('0x9a')+tmp_campaigns+_0xbee4('0x9e'));_0x40f121[_0xbee4('0x1e')](_0xbee4('0x9a')+tmp_voice_queues+_0xbee4('0x9e'));BPromise[_0xbee4('0x9f')](_0x40f121,handleTZQuery)[_0xbee4('0x1c')](function(_0x5a88f0){updateTzCampaigns(_0x1c4cd1['ListId'])['then'](function(_0x3a79be){updateTzVoiceQueues(_0x1c4cd1['ListId'])[_0xbee4('0x1c')](function(_0x480e3c){if(hasTZ)_0x4eb9f=_0x4eb9f[_0xbee4('0x8f')](_0xbee4('0x6d'),'dialTimezone,utcOffset');var _0x1cedb2=util[_0xbee4('0x11')]('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',_0x5187bd,_0x32b162,_0x4eb9f,_0x1c4cd1[_0xbee4('0x33')],_0x1c4cd1[_0xbee4('0x53')]||null,NOW,NOW);if(_['isNil'](_0x134b23[_0xbee4('0x32')])){_0x1cedb2+=_0xbee4('0xa0');}_0x22bd49[_0xbee4('0x1e')](_0x1cedb2);if(_0x1c4cd1[_0xbee4('0x98')]&&_0x1c4cd1[_0xbee4('0x98')][_0xbee4('0x1d')]){_0x22bd49['push'](insertCmContact(_0x1c4cd1['ListId'],_0x32b162,_0x1c4cd1['duplicates'],_0x134b23));_0x22bd49['push']('DROP\x20TABLE\x20'+_0x32b162+';');}BPromise[_0xbee4('0x9f')](_0x22bd49,handleQuery)['then'](function(_0x2fce15){BPromise['all']([handleAdditionalPhones()])[_0xbee4('0x1c')](function(){_0x22bd49=[];for(var _0x50abef=0x0;_0x50abef\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','length','isNil','push','all','then','message','AdditionalPhones','split','filter','CmContactHasItem','findOne','updated','PHONE','inserted','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.priority','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','recallme','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','toString','cm_contacts.id','cm_contacts.createdAt','cm_hopper_black','fields','cm_contacts','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc8ac[_0x32f7d7];return _0x133d09;};'use strict';var fs=require('fs');var path=require(_0xcc8a('0x0'));var _=require(_0xcc8a('0x1'));var Papa=require(_0xcc8a('0x2'));var util=require(_0xcc8a('0x3'));var BPromise=require('bluebird');var moment=require(_0xcc8a('0x4'));var squel=require('squel');var Redis=require(_0xcc8a('0x5'));var db=require(_0xcc8a('0x6'))['db'];var config=require(_0xcc8a('0x7'));var logger=require(_0xcc8a('0x8'))(_0xcc8a('0x9'));config['redis']=_['defaults'](config[_0xcc8a('0xa')],{'host':_0xcc8a('0xb'),'port':0x18eb});var socket=require(_0xcc8a('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xcc8a('0xd'));var tempTableName=_0xcc8a('0xe')+moment()['format'](_0xcc8a('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x34f02f){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'](_0x34f02f);}function selectNotIn(_0x2c5025,_0x4e175e,_0x5b018a,_0x17c646,_0x186896){return squel[_0xcc8a('0x10')]()[_0xcc8a('0x11')](_0xcc8a('0x12'))[_0xcc8a('0x13')](_0x17c646)[_0xcc8a('0x14')](_0x4e175e,null,_0x4e175e+_0xcc8a('0x15')+_0x17c646+'.'+_0x5b018a)[_0xcc8a('0x16')](_0x17c646+'.'+_0x5b018a+_0xcc8a('0x17')+_0x2c5025+'.'+_0x5b018a)[_0xcc8a('0x16')](_0x4e175e+'.dialCheckDuplicateType\x20IN\x20('+_0x186896[_0xcc8a('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x19c3bd,_0x290a00){promisesAdditionalPhones=[];promisesContact=[];return db[_0xcc8a('0x18')][_0xcc8a('0x19')](_0xcc8a('0x1a')+tempTableName)['spread'](function(_0x3a6bde){if(_0x3a6bde!==null){var _0x42ceb5=[];for(var _0x439ce2=0x0;_0x439ce2<_0x3a6bde[_0xcc8a('0x1b')];_0x439ce2++){var _0x96e899=_0x3a6bde[_0x439ce2];if(!_[_0xcc8a('0x1c')](_0x96e899[_0xcc8a('0x12')])){if(!_['isNil'](_0x96e899['AdditionalPhones']))_0x42ceb5[_0xcc8a('0x1d')](insertAdditionalPhones(_0x96e899));promisesContact[_0xcc8a('0x1d')]({'contact':_0x96e899});}}}Promise[_0xcc8a('0x1e')](_0x42ceb5)[_0xcc8a('0x1f')](function(){_0x19c3bd({'val':0x1});});})['catch'](function(_0x32a62a){logger['error'](_0x32a62a[_0xcc8a('0x20')]);});});}function insertAdditionalPhones(_0x3a2e3d){return new Promise(function(_0xa76ad9,_0x5cafdd){var _0x28f2b5=_0x3a2e3d[_0xcc8a('0x21')];if(_['isNil'](_0x28f2b5))_0x5cafdd({'val':0x0});else{var _0x3373ca=_0x28f2b5[_0xcc8a('0x22')](';');var _0x264559=[];orderBy=0x0;for(var _0x2c84c6=0x0;_0x2c84c6<_0x3373ca[_0xcc8a('0x1b')];_0x2c84c6++){_0x264559['push'](splitAdditionalPhone(_0x3a2e3d['id'],_0x3373ca[_0x2c84c6]));}Promise[_0xcc8a('0x1e')](_0x264559)[_0xcc8a('0x1f')](function(){_0xa76ad9({'val':_0x3373ca['length']});});}});}function splitAdditionalPhone(_0x1f542e,_0x443759){return new Promise(function(_0x583e3a,_0xe63a38){var _0x3185c3=_0x443759[_0xcc8a('0x22')](':');var _0x71acf1=_0x3185c3[0x0];var _0x221841=_0x3185c3[0x1];if(_0x221841!==''){var _0x3043a7=_0x221841[_0xcc8a('0x22')]('|');var _0x3ff6b7=[];for(var _0x33ea69=0x0;_0x33ea69<_0x3043a7[_0xcc8a('0x1b')];_0x33ea69++){if(_0x3043a7[_0x33ea69]!==''){var _0x338351=_[_0xcc8a('0x23')](promisesAdditionalPhones,{'contactId':_0x1f542e,'phone':_0x3043a7[_0x33ea69]});if(_0x338351['length']==0x0){orderBy++;promisesAdditionalPhones[_0xcc8a('0x1d')]({'contactId':_0x1f542e,'contactTypeId':_0x71acf1,'phone':_0x3043a7[_0x33ea69],'orderBy':orderBy});}}}_0x583e3a({'ok':0x1});}else _0x583e3a({'res':0x0});});}function createAdditionalPhone(_0x404d64,_0x4d1583,_0x41271f,_0x27f03){var _0x3ded69='';var _0xa05041='';var _0x581ae8=_0x41271f[_0xcc8a('0x22')]('§');_0x3ded69=_0x581ae8[0x0];if(_0x581ae8[_0xcc8a('0x1b')]==0x2)_0xa05041=_0x581ae8[0x1];return new Promise(function(_0x3b5ba2,_0x32c0ea){return db[_0xcc8a('0x24')][_0xcc8a('0x25')]({'where':{'CmContactId':_0x404d64,'item':_0x3ded69}})[_0xcc8a('0x1f')](function(_0x3a9031){if(_0x3a9031){return db['CmContactHasItem']['update']({'ItemTypeId':_0x4d1583,'description':_0xa05041,'OrderBy':_0x27f03},{'where':{'CmContactId':_0x404d64,'item':_0x3ded69}})[_0xcc8a('0x1f')](function(_0x542aa4){_0x3b5ba2({'res':_0xcc8a('0x26')});});}else{return db[_0xcc8a('0x24')]['create']({'CmContactId':_0x404d64,'item':_0x3ded69,'ItemTypeId':_0x4d1583,'description':_0xa05041,'OrderBy':_0x27f03,'ItemClass':_0xcc8a('0x27')})['then'](function(_0x59c470){_0x3b5ba2({'res':_0xcc8a('0x28')});});}});});}function updateContact(_0x3791bd){return new Promise(function(_0x6a1f49,_0x2fe6d6){var _0x4c55a5=_0x3791bd['id'];delete _0x3791bd['id'];return db['CmContact'][_0xcc8a('0x29')](_0x3791bd,{'where':{'id':_0x4c55a5}})[_0xcc8a('0x1f')](function(_0x3c262a){updatedRows+=0x1;return db[_0xcc8a('0x2a')][_0xcc8a('0x29')]({'phone':_0x3791bd[_0xcc8a('0x12')]},{'where':{'ContactId':_0x4c55a5}})[_0xcc8a('0x1f')](function(_0xc4ee3f){_0x6a1f49({'ret':'OK'});});});});}function insertCmHopper(_0x22a4cf,_0x3bd63b,_0x36125f,_0x145bd4,_0x47f107){var _0xa9be8c=[_0xcc8a('0x2b'),_0xcc8a('0x2c'),'cm_contacts.id',_0xcc8a('0x2d'),_0x3bd63b+'.'+_0x145bd4,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xcc8a('0x2e'),'cm_contacts.UserId','\x22'+_0x47f107+'\x22'];return squel[_0xcc8a('0x2f')]()[_0xcc8a('0x30')](_0xcc8a('0x31'))[_0xcc8a('0x32')]([_0xcc8a('0x12'),'scheduledat',_0xcc8a('0x33'),_0xcc8a('0x34'),_0x145bd4,_0xcc8a('0x35'),_0xcc8a('0x36'),'priority','UserId',_0xcc8a('0x37')],squel['select']()['fields'](_0xa9be8c)['from'](_0x3bd63b)['join']('cm_contacts',null,_0xcc8a('0x38')+_0x3bd63b+_0xcc8a('0x39'))[_0xcc8a('0x14')](_0x36125f,null,_0x36125f+_0xcc8a('0x15')+_0x3bd63b+'.'+_0x145bd4)[_0xcc8a('0x16')](_0x3bd63b+'.CmListId\x20=\x20?',_0x22a4cf)[_0xcc8a('0x16')](_0xcc8a('0x3a'),NOW)[_0xcc8a('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3bd63b,_0x36125f,_0x145bd4,'cm_hopper',[_0xcc8a('0x3b'),'\x22onlyIfOpen\x22']))[_0xcc8a('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3bd63b,_0x36125f,_0x145bd4,_0xcc8a('0x31'),[_0xcc8a('0x3b')])))[_0xcc8a('0x3c')]();}function insertCmHopperBlack(_0x5436b4,_0x142c48,_0x3c769d,_0x49b90a){var _0x3635f5=[_0xcc8a('0x2b'),_0xcc8a('0x3d'),'cm_contacts.ListId',_0x142c48+'.'+_0x49b90a,_0xcc8a('0x3e'),'cm_contacts.updatedAt'];return squel['insert']()[_0xcc8a('0x30')](_0xcc8a('0x3f'))[_0xcc8a('0x32')]([_0xcc8a('0x12'),_0xcc8a('0x33'),_0xcc8a('0x34'),_0x49b90a,_0xcc8a('0x35'),'updatedAt'],squel[_0xcc8a('0x10')]()[_0xcc8a('0x40')](_0x3635f5)[_0xcc8a('0x13')](_0x142c48)[_0xcc8a('0x14')](_0xcc8a('0x41'),null,_0xcc8a('0x38')+_0x142c48+_0xcc8a('0x39'))['join'](_0x3c769d,null,_0x3c769d+'.id\x20=\x20'+_0x142c48+'.'+_0x49b90a)[_0xcc8a('0x16')](_0x142c48+'.CmListId\x20=\x20?',_0x5436b4)[_0xcc8a('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xcc8a('0x42'),squel[_0xcc8a('0x10')]()[_0xcc8a('0x11')](_0xcc8a('0x12'))[_0xcc8a('0x13')](_0xcc8a('0x3f'))['where']('ListId\x20=\x20?',_0x5436b4)[_0xcc8a('0x16')](_0x49b90a+_0xcc8a('0x43'),_0x142c48+'.'+_0x49b90a)))['toString']();}function insertCmHopperAdditionalPhones(_0x15aaef){var _0x596bb1=[_0xcc8a('0x44'),_0xcc8a('0x45'),_0xcc8a('0x46'),_0xcc8a('0x47'),_0xcc8a('0x48')];return squel[_0xcc8a('0x2f')]()[_0xcc8a('0x30')]('cm_hopper_additional_phones')[_0xcc8a('0x32')]([_0xcc8a('0x49'),_0xcc8a('0x12'),_0xcc8a('0x4a'),_0xcc8a('0x35'),_0xcc8a('0x36')],squel[_0xcc8a('0x10')]()[_0xcc8a('0x40')](_0x596bb1)['from'](_0xcc8a('0x31'))[_0xcc8a('0x14')](_0xcc8a('0x41'),null,_0xcc8a('0x4b'))[_0xcc8a('0x14')](_0xcc8a('0x4c'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xcc8a('0x16')](_0xcc8a('0x4d'),_0x15aaef)[_0xcc8a('0x16')](_0xcc8a('0x3a'),NOW))[_0xcc8a('0x3c')]();}function insertCmContact(_0x229ddb,_0x477783,_0x5ea3a9,_0x2a7fc9){var _0x502b10=_['concat'](_['keys'](_0x2a7fc9),[_0xcc8a('0x34'),_0xcc8a('0x4e'),_0xcc8a('0x35'),_0xcc8a('0x36')]);return squel['insert']()[_0xcc8a('0x30')](_0xcc8a('0x41'))['fromQuery'](_0x502b10,squel[_0xcc8a('0x10')]()[_0xcc8a('0x40')](_0x502b10)['from'](_0x477783)[_0xcc8a('0x16')]('('+_0x5ea3a9[_0xcc8a('0x14')](',')+_0xcc8a('0x4f'),squel[_0xcc8a('0x10')]()[_0xcc8a('0x40')](_0x5ea3a9)[_0xcc8a('0x13')](_0xcc8a('0x41'))[_0xcc8a('0x16')](_0xcc8a('0x50'),_0x229ddb))[_0xcc8a('0x16')](_0xcc8a('0x51'),squel['select']()['field'](_0xcc8a('0x52'),_0xcc8a('0x53'))['from'](_0x477783)[_0xcc8a('0x54')](_0x5ea3a9[_0xcc8a('0x14')](','))))['toString']();}function handleStop(){logger[_0xcc8a('0x55')](_0xcc8a('0x56'));stopped=!![];}function handleUncaughtException(_0x2fc801){logger[_0xcc8a('0x57')](_0x2fc801[_0xcc8a('0x20')]);process[_0xcc8a('0x58')](0x1);}function handleError(_0x4dbc00,_0x16bb00){stats[_0xcc8a('0x59')][_0xcc8a('0x1d')]({'name':_0x16bb00[_0xcc8a('0x5a')],'message':_0x16bb00['message'],'row':_0x4dbc00});}function handleQuery(_0x4f72d1){logger[_0xcc8a('0x55')](_0x4f72d1);return db[_0xcc8a('0x18')][_0xcc8a('0x19')](_0x4f72d1)[_0xcc8a('0x5b')](function(_0x84274c){results[_0xcc8a('0x1d')](_0x84274c);})[_0xcc8a('0x5c')](function(_0x139d27){logger[_0xcc8a('0x57')](_0x139d27[_0xcc8a('0x20')]);});}function main(_0x12b78c,_0x170a30,_0x52d2fc,_0x3d096c){logger[_0xcc8a('0x55')](_0xcc8a('0x5d'),_0x12b78c,JSON[_0xcc8a('0x5e')](_0x170a30));process['send'](_0xcc8a('0x5f'));var _0x361751=_0x170a30[_0xcc8a('0x60')];var _0x3a9da0=_[_0xcc8a('0x61')](_0x361751);var _0x4d361a=_0x170a30[_0xcc8a('0x62')];var _0x10b64e=path['join'](config['root'],_0xcc8a('0x63'),_0x4d361a+'.csv');logger['info'](_0xcc8a('0x64'),_0x170a30);db['ContactItemType'][_0xcc8a('0x65')]({'raw':!![],'attributes':['id',_0xcc8a('0x66')]})[_0xcc8a('0x1f')](function(_0x3f076c){for(var _0x571498=0x0;_0x571498<_0x3f076c[_0xcc8a('0x1b')];_0x571498++){if(_0x3f076c[_0x571498][_0xcc8a('0x66')]in _0x361751){contactItemTypes[_0xcc8a('0x1d')](_0x3f076c[_0x571498]);delete _0x3a9da0[_0x3f076c[_0x571498][_0xcc8a('0x66')]];hasAdditionalPhones=!![];}for(var _0x17653e in _0x361751){if(_0x3f076c[_0x571498][_0xcc8a('0x66')]+_0xcc8a('0x67')===_0x17653e){phoneDescriptions[_0xcc8a('0x1d')]({'itemTypeId':_0x3f076c[_0x571498]['id'],'description':_0x17653e});delete _0x3a9da0[_0x17653e];}}}if(hasAdditionalPhones)_0x3a9da0[_0xcc8a('0x21')]='';var _0x538aa7=_['keys'](_0x3a9da0)[_0xcc8a('0x14')]();logger[_0xcc8a('0x55')](_0xcc8a('0x68'),_0x538aa7);fs[_0xcc8a('0x69')](_0x10b64e,_0x538aa7+'\x0a');Papa['parse'](fs['createReadStream'](_0x12b78c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1f1497,_0x3eedf8){try{for(var _0x3ae3c0=0x0,_0x55beb7=[];_0x3ae3c0<_0x1f1497[_0xcc8a('0x6a')][_0xcc8a('0x1b')];_0x3ae3c0++){stats['rows']+=0x1;if(_0x1f1497['errors'][_0x3ae3c0]){handleError(_0x1f1497[_0xcc8a('0x6a')][_0x3ae3c0],_0x1f1497[_0xcc8a('0x59')][_0x3ae3c0]);}else{var _0x8015b5=[];var _0x4d7f9f=[];var _0x415603={};for(var _0x94301f in _0x361751){let _0x1c868d=contactItemTypes['find'](_0x32a00a=>_0x32a00a[_0xcc8a('0x66')]===_0x94301f);let _0x4b2eb0=contactItemTypes[_0xcc8a('0x6b')](_0x4c2110=>_0x4c2110['name']+_0xcc8a('0x67')===_0x94301f);if(_[_0xcc8a('0x1c')](_0x1c868d)&&_['isNil'](_0x4b2eb0)){if(_0x361751['hasOwnProperty'](_0x94301f)){if(_0x1f1497[_0xcc8a('0x6a')][_0x3ae3c0][_0x361751[_0x94301f]]){var _0xb905db=_[_0xcc8a('0x6c')](_0x1f1497['data'][_0x3ae3c0][_0x361751[_0x94301f]][_0xcc8a('0x6d')](/"/g,'\x27'));switch(_0x94301f){case _0xcc8a('0x6e'):var _0x330382=moment(_0xb905db,_0xcc8a('0xd'),!![]);if(_0x330382['isValid']()){_0x55beb7[_0xcc8a('0x1d')]('\x22'+_0xb905db+'\x22');}else{_0x8015b5['push'](_0xcc8a('0x6f'));}break;case _0xcc8a('0x70'):var _0x54fd0c=parseInt(_0xb905db);_0xb905db=_[_0xcc8a('0x71')](_0x54fd0c)||_0x54fd0c<0x0||_0x54fd0c>0x4?_0x3d096c?0x3:0x2:_0x54fd0c;_0x55beb7[_0xcc8a('0x1d')]('\x22'+_0xb905db+'\x22');break;case _0xcc8a('0x72'):var _0x4f6b34=parseInt(_0xb905db);if(_[_0xcc8a('0x73')](_0x4f6b34)&&_['includes'](_0x52d2fc,_0x4f6b34)){_0x55beb7[_0xcc8a('0x1d')]('\x22'+_0x4f6b34+'\x22');}else{_0x8015b5[_0xcc8a('0x1d')](_0xcc8a('0x74'));}break;case _0xcc8a('0x75'):if(isEmail(_0xb905db)){_0x55beb7[_0xcc8a('0x1d')]('\x22'+_0xb905db+'\x22');}else{_0x8015b5[_0xcc8a('0x1d')](_0xcc8a('0x76'));}break;case _0xcc8a('0x77'):var _0x5952cb=moment(_0xb905db,'YYYY-MM-DD',!![]);if(_0x5952cb[_0xcc8a('0x78')]()){_0x55beb7[_0xcc8a('0x1d')]('\x22'+_0xb905db+'\x22');}else{_0x8015b5[_0xcc8a('0x1d')](_0xcc8a('0x79'));}break;default:_0x55beb7[_0xcc8a('0x1d')]('\x22'+_0xb905db+'\x22');}}else{switch(_0x94301f){case _0xcc8a('0x7a'):case'phone':_0x8015b5[_0xcc8a('0x1d')](_0x94301f+_0xcc8a('0x7b'));break;default:_0x55beb7[_0xcc8a('0x1d')]('\x22\x22');}}}}else{var _0x236784='';if(!_[_0xcc8a('0x1c')](_0x1c868d)){if(!_0x415603['hasOwnProperty'](_0x1c868d['id'])){for(var _0xe9078f=0x0;_0xe9078f<_0x361751[_0x94301f][_0xcc8a('0x1b')];_0xe9078f++){var _0xb905db=_['trim'](_0x1f1497[_0xcc8a('0x6a')][_0x3ae3c0][_0x361751[_0x94301f][_0xe9078f]][_0xcc8a('0x6d')](/"/g,'\x27'));var _0x852750=phoneDescriptions[_0xcc8a('0x6b')](_0x4ce7db=>_0x4ce7db['itemTypeId']===_0x1c868d['id']);if(!_['isNil'](_0x852750)){var _0x18f5d9=_['trim'](_0x1f1497['data'][_0x3ae3c0][_0x361751[_0x852750[_0xcc8a('0x7c')]][0x0]][_0xcc8a('0x6d')](/"/g,'\x27'));if(!_['isNil'](_0x18f5d9))_0xb905db=_0xb905db+'§'+_0x18f5d9;}if(_0x236784=='')_0x236784=_0xb905db;else _0x236784+='|'+_0xb905db;}_0x4d7f9f[_0xcc8a('0x1d')](_0x1c868d['id']+':'+_0x236784);_0x415603[_0x1c868d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x55beb7['push']('\x22'+_0x4d7f9f[_0xcc8a('0x14')](';')+'\x22');}if(_0x8015b5[_0xcc8a('0x1b')]){handleError(_0x1f1497[_0xcc8a('0x6a')][_0x3ae3c0],{'code':_0xcc8a('0x7d'),'message':_0x8015b5[_0xcc8a('0x14')]()});}else{fs[_0xcc8a('0x7e')](_0x10b64e,_0x55beb7['join']()+'\x0a');}_0x55beb7=[];}if(!(stats['rows']%0xc8)){socket[_0xcc8a('0x7f')](_0xcc8a('0x80')+_0x4d361a,stats);stats[_0xcc8a('0x59')]=[];}}if(stopped){logger[_0xcc8a('0x55')](_0xcc8a('0x81'));_0x3eedf8['abort']();}}catch(_0x542d6c){handleError(_0x1f1497[_0xcc8a('0x6a')][_0x3ae3c0],{'code':_0xcc8a('0x82'),'message':_0x542d6c[_0xcc8a('0x20')]});logger[_0xcc8a('0x57')](_0xcc8a('0x83'),_0x542d6c[_0xcc8a('0x20')]);}},'complete':function(){try{var _0x47764a=[];var _0x1ed1a4=tempTableName;_0x47764a[_0xcc8a('0x1d')](_0xcc8a('0x84')+_0x1ed1a4+'\x20LIKE\x20cm_contacts;');logger[_0xcc8a('0x55')](_0xcc8a('0x85'),contactItemTypes[_0xcc8a('0x1b')]);var _0x29541f=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x10b64e,_0x1ed1a4,_0x538aa7,_0x170a30[_0xcc8a('0x34')],_0x170a30[_0xcc8a('0x4e')]||null,NOW,NOW);if(_['isNil'](_0x361751['scheduledat'])){_0x29541f+=_0xcc8a('0x86');}_0x47764a['push'](_0x29541f);BPromise[_0xcc8a('0x87')](_0x47764a,handleQuery)['then'](function(_0x1c6b4d){BPromise[_0xcc8a('0x1e')]([handleAdditionalPhones()])[_0xcc8a('0x1f')](function(){_0x47764a=[];for(var _0x5ce344=0x0;_0x5ce344\x20\x20','root','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis'];(function(_0x1fd3e2,_0x1a6772){var _0x5a9210=function(_0x37e9c3){while(--_0x37e9c3){_0x1fd3e2['push'](_0x1fd3e2['shift']());}};_0x5a9210(++_0x1a6772);}(_0x7a52,0x1bd));var _0x27a5=function(_0x42c436,_0x49ad36){_0x42c436=_0x42c436-0x0;var _0x1bf0ce=_0x7a52[_0x42c436];return _0x1bf0ce;};'use strict';var fs=require('fs');var path=require(_0x27a5('0x0'));var _=require('lodash');var Papa=require(_0x27a5('0x1'));var util=require(_0x27a5('0x2'));var BPromise=require(_0x27a5('0x3'));var moment=require(_0x27a5('0x4'));var squel=require('squel');var Redis=require(_0x27a5('0x5'));var db=require(_0x27a5('0x6'))['db'];var config=require(_0x27a5('0x7'));var logger=require(_0x27a5('0x8'))(_0x27a5('0x9'));config[_0x27a5('0xa')]=_[_0x27a5('0xb')](config['redis'],{'host':_0x27a5('0xc'),'port':0x18eb});var socket=require(_0x27a5('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x27a5('0xe'));var tempTableName='cm_contacts_temp_'+moment()[_0x27a5('0xf')](_0x27a5('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2222c2){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'](_0x2222c2);}function selectNotIn(_0xb4c6ee,_0x3164d6,_0x30687b,_0x57b4fe,_0x5cf8a7){return squel[_0x27a5('0x11')]()['field']('phone')[_0x27a5('0x12')](_0x57b4fe)[_0x27a5('0x13')](_0x3164d6,null,_0x3164d6+_0x27a5('0x14')+_0x57b4fe+'.'+_0x30687b)[_0x27a5('0x15')](_0x57b4fe+'.'+_0x30687b+_0x27a5('0x16')+_0xb4c6ee+'.'+_0x30687b)[_0x27a5('0x15')](_0x3164d6+_0x27a5('0x17')+_0x5cf8a7['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x447f2c,_0x368d9){promisesAdditionalPhones=[];promisesContact=[];return db[_0x27a5('0x18')]['query']('select\x20*\x20from\x20'+tempTableName)[_0x27a5('0x19')](function(_0x4e03fb){if(_0x4e03fb!==null){var _0x4500c4=[];for(var _0x25e512=0x0;_0x25e512<_0x4e03fb[_0x27a5('0x1a')];_0x25e512++){var _0x24bec0=_0x4e03fb[_0x25e512];if(!_[_0x27a5('0x1b')](_0x24bec0[_0x27a5('0x1c')])){if(!_['isNil'](_0x24bec0[_0x27a5('0x1d')]))_0x4500c4[_0x27a5('0x1e')](insertAdditionalPhones(_0x24bec0));promisesContact[_0x27a5('0x1e')]({'contact':_0x24bec0});}}}Promise[_0x27a5('0x1f')](_0x4500c4)[_0x27a5('0x20')](function(){_0x447f2c({'val':0x1});});})[_0x27a5('0x21')](function(_0x110b3d){logger['error'](_0x110b3d[_0x27a5('0x22')]);});});}function insertAdditionalPhones(_0x4088f6){return new Promise(function(_0x499b6d,_0x3cf7b7){var _0x8851a0=_0x4088f6[_0x27a5('0x1d')];if(_[_0x27a5('0x1b')](_0x8851a0))_0x3cf7b7({'val':0x0});else{var _0x44f33a=_0x8851a0['split'](';');var _0x28c06c=[];orderBy=0x0;for(var _0x3c5073=0x0;_0x3c5073<_0x44f33a['length'];_0x3c5073++){_0x28c06c['push'](splitAdditionalPhone(_0x4088f6['id'],_0x44f33a[_0x3c5073]));}Promise[_0x27a5('0x1f')](_0x28c06c)[_0x27a5('0x20')](function(){_0x499b6d({'val':_0x44f33a[_0x27a5('0x1a')]});});}});}function splitAdditionalPhone(_0x304abb,_0x5b7313){return new Promise(function(_0x188b95,_0x49e862){var _0x37efdd=_0x5b7313['split'](':');var _0x38075e=_0x37efdd[0x0];var _0x2158b2=_0x37efdd[0x1];if(_0x2158b2!==''){var _0x34b5fc=_0x2158b2[_0x27a5('0x23')]('|');var _0x5128f0=[];for(var _0x5dd9d1=0x0;_0x5dd9d1<_0x34b5fc[_0x27a5('0x1a')];_0x5dd9d1++){if(_0x34b5fc[_0x5dd9d1]!==''){var _0x5c3906=_[_0x27a5('0x24')](promisesAdditionalPhones,{'contactId':_0x304abb,'phone':_0x34b5fc[_0x5dd9d1]});if(_0x5c3906[_0x27a5('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x27a5('0x1e')]({'contactId':_0x304abb,'contactTypeId':_0x38075e,'phone':_0x34b5fc[_0x5dd9d1],'orderBy':orderBy});}}}_0x188b95({'ok':0x1});}else _0x188b95({'res':0x0});});}function createAdditionalPhone(_0x4e2cf7,_0x45a33e,_0x1df29d,_0x6cdab1){var _0x3de6c3='';var _0x110a17='';var _0xaf45fa=_0x1df29d[_0x27a5('0x23')]('§');_0x3de6c3=_0xaf45fa[0x0];if(_0xaf45fa[_0x27a5('0x1a')]==0x2)_0x110a17=_0xaf45fa[0x1];return new Promise(function(_0x203a95,_0x4f8145){return db[_0x27a5('0x25')][_0x27a5('0x26')]({'where':{'CmContactId':_0x4e2cf7,'item':_0x3de6c3}})[_0x27a5('0x20')](function(_0x438850){if(_0x438850){return db['CmContactHasItem'][_0x27a5('0x27')]({'ItemTypeId':_0x45a33e,'description':_0x110a17,'OrderBy':_0x6cdab1},{'where':{'CmContactId':_0x4e2cf7,'item':_0x3de6c3}})[_0x27a5('0x20')](function(_0x3e8904){_0x203a95({'res':_0x27a5('0x28')});});}else{return db[_0x27a5('0x25')][_0x27a5('0x29')]({'CmContactId':_0x4e2cf7,'item':_0x3de6c3,'ItemTypeId':_0x45a33e,'description':_0x110a17,'OrderBy':_0x6cdab1,'ItemClass':_0x27a5('0x2a')})[_0x27a5('0x20')](function(_0xd8e800){_0x203a95({'res':_0x27a5('0x2b')});});}});});}function updateContact(_0x50ecdf){return new Promise(function(_0xea4e48,_0x3bb59f){var _0x57b7a6=_0x50ecdf['id'];delete _0x50ecdf['id'];return db['CmContact'][_0x27a5('0x27')](_0x50ecdf,{'where':{'id':_0x57b7a6}})['then'](function(_0xe22fc8){updatedRows+=0x1;return db[_0x27a5('0x2c')][_0x27a5('0x27')]({'phone':_0x50ecdf[_0x27a5('0x1c')]},{'where':{'ContactId':_0x57b7a6}})[_0x27a5('0x20')](function(_0x1b7c86){_0xea4e48({'ret':'OK'});});});});}function insertCmHopper(_0xac327c,_0x8f2ebe,_0x25c42f,_0x40629c,_0x97cb27){var _0x48f022=[_0x27a5('0x2d'),'cm_contacts.scheduledat',_0x27a5('0x2e'),_0x27a5('0x2f'),_0x8f2ebe+'.'+_0x40629c,_0x27a5('0x30'),'cm_contacts.updatedAt',_0x27a5('0x31'),'cm_contacts.UserId','\x22'+_0x97cb27+'\x22'];return squel[_0x27a5('0x32')]()[_0x27a5('0x33')]('cm_hopper')['fromQuery']([_0x27a5('0x1c'),_0x27a5('0x34'),'ContactId','ListId',_0x40629c,_0x27a5('0x35'),_0x27a5('0x36'),_0x27a5('0x37'),'UserId',_0x27a5('0x38')],squel[_0x27a5('0x11')]()[_0x27a5('0x39')](_0x48f022)[_0x27a5('0x12')](_0x8f2ebe)[_0x27a5('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x8f2ebe+_0x27a5('0x3a'))[_0x27a5('0x13')](_0x25c42f,null,_0x25c42f+_0x27a5('0x14')+_0x8f2ebe+'.'+_0x40629c)[_0x27a5('0x15')](_0x8f2ebe+_0x27a5('0x3b'),_0xac327c)[_0x27a5('0x15')](_0x27a5('0x3c'),NOW)[_0x27a5('0x15')](_0x27a5('0x3d'),selectNotIn(_0x8f2ebe,_0x25c42f,_0x40629c,_0x27a5('0x3e'),['\x22always\x22',_0x27a5('0x3f')]))[_0x27a5('0x15')](_0x27a5('0x3d'),selectNotIn(_0x8f2ebe,_0x25c42f,_0x40629c,_0x27a5('0x3e'),[_0x27a5('0x40')])))[_0x27a5('0x41')]();}function insertCmHopperBlack(_0x5ed676,_0x4fe261,_0x2f985e,_0x7b3aba){var _0x5e8e14=[_0x27a5('0x2d'),_0x27a5('0x2e'),_0x27a5('0x2f'),_0x4fe261+'.'+_0x7b3aba,_0x27a5('0x30'),_0x27a5('0x42')];return squel[_0x27a5('0x32')]()[_0x27a5('0x33')](_0x27a5('0x43'))[_0x27a5('0x44')]([_0x27a5('0x1c'),'ContactId',_0x27a5('0x45'),_0x7b3aba,_0x27a5('0x35'),_0x27a5('0x36')],squel[_0x27a5('0x11')]()[_0x27a5('0x39')](_0x5e8e14)[_0x27a5('0x12')](_0x4fe261)[_0x27a5('0x13')](_0x27a5('0x46'),null,_0x27a5('0x47')+_0x4fe261+_0x27a5('0x3a'))[_0x27a5('0x13')](_0x2f985e,null,_0x2f985e+'.id\x20=\x20'+_0x4fe261+'.'+_0x7b3aba)[_0x27a5('0x15')](_0x4fe261+'.CmListId\x20=\x20?',_0x5ed676)[_0x27a5('0x15')](_0x27a5('0x3c'),NOW)[_0x27a5('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x27a5('0x48')]('phone')[_0x27a5('0x12')](_0x27a5('0x43'))[_0x27a5('0x15')](_0x27a5('0x49'),_0x5ed676)[_0x27a5('0x15')](_0x7b3aba+_0x27a5('0x4a'),_0x4fe261+'.'+_0x7b3aba)))[_0x27a5('0x41')]();}function insertCmHopperAdditionalPhones(_0xf166b0){var _0x3e956b=['cm_hopper.id',_0x27a5('0x4b'),_0x27a5('0x4c'),_0x27a5('0x4d'),_0x27a5('0x4e')];return squel['insert']()[_0x27a5('0x33')](_0x27a5('0x4f'))[_0x27a5('0x44')]([_0x27a5('0x50'),_0x27a5('0x1c'),_0x27a5('0x51'),_0x27a5('0x35'),'updatedAt'],squel[_0x27a5('0x11')]()[_0x27a5('0x39')](_0x3e956b)[_0x27a5('0x12')](_0x27a5('0x3e'))[_0x27a5('0x13')]('cm_contacts',null,_0x27a5('0x52'))['join']('cm_contact_has_items',null,_0x27a5('0x53'))[_0x27a5('0x15')]('cm_hopper.ListId\x20=\x20?',_0xf166b0)[_0x27a5('0x15')](_0x27a5('0x3c'),NOW))[_0x27a5('0x41')]();}function insertCmContact(_0x364583,_0x43e984,_0xb5a42f,_0x52d059){var _0x25f31a=_['concat'](_['keys'](_0x52d059),['ListId',_0x27a5('0x54'),_0x27a5('0x35'),_0x27a5('0x36')]);return squel[_0x27a5('0x32')]()[_0x27a5('0x33')](_0x27a5('0x46'))[_0x27a5('0x44')](_0x25f31a,squel[_0x27a5('0x11')]()[_0x27a5('0x39')](_0x25f31a)[_0x27a5('0x12')](_0x43e984)[_0x27a5('0x15')]('('+_0xb5a42f[_0x27a5('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x27a5('0x11')]()[_0x27a5('0x39')](_0xb5a42f)[_0x27a5('0x12')]('cm_contacts')[_0x27a5('0x15')](_0x27a5('0x49'),_0x364583))['where'](_0x27a5('0x55'),squel[_0x27a5('0x11')]()[_0x27a5('0x48')](_0x27a5('0x56'),_0x27a5('0x57'))[_0x27a5('0x12')](_0x43e984)['group'](_0xb5a42f['join'](','))))[_0x27a5('0x41')]();}function handleStop(){logger[_0x27a5('0x58')](_0x27a5('0x59'));stopped=!![];}function handleUncaughtException(_0x58af78){logger[_0x27a5('0x5a')](_0x58af78[_0x27a5('0x22')]);process[_0x27a5('0x5b')](0x1);}function handleError(_0x1e415a,_0x8f2f15){stats[_0x27a5('0x5c')][_0x27a5('0x1e')]({'name':_0x8f2f15[_0x27a5('0x5d')],'message':_0x8f2f15['message'],'row':_0x1e415a});}function handleQuery(_0x3f89b7){logger[_0x27a5('0x58')](_0x3f89b7);return db[_0x27a5('0x18')]['query'](_0x3f89b7)['spread'](function(_0x40ca71){results['push'](_0x40ca71);})[_0x27a5('0x21')](function(_0x66281f){logger[_0x27a5('0x5a')](_0x66281f['message']);});}function main(_0x404c97,_0x26002c,_0x5de71f,_0x37615b){logger[_0x27a5('0x58')](_0x27a5('0x5e'),_0x404c97,JSON['stringify'](_0x26002c));process[_0x27a5('0x5f')](_0x27a5('0x60'));var _0x20f0d6=_0x26002c[_0x27a5('0x61')];var _0x4a3dd4=_['clone'](_0x20f0d6);var _0x33147b=_0x26002c['socket_timestamp'];var _0x31c3c2=path[_0x27a5('0x13')](config['root'],'server/files/tmp',_0x33147b+_0x27a5('0x62'));logger[_0x27a5('0x58')](_0x27a5('0x63'),_0x26002c);db[_0x27a5('0x64')][_0x27a5('0x65')]({'raw':!![],'attributes':['id',_0x27a5('0x66')]})[_0x27a5('0x20')](function(_0x188b71){for(var _0x5075a4=0x0;_0x5075a4<_0x188b71[_0x27a5('0x1a')];_0x5075a4++){if(_0x188b71[_0x5075a4]['name']in _0x20f0d6){contactItemTypes[_0x27a5('0x1e')](_0x188b71[_0x5075a4]);delete _0x4a3dd4[_0x188b71[_0x5075a4]['name']];hasAdditionalPhones=!![];}for(var _0xc47589 in _0x20f0d6){if(_0x188b71[_0x5075a4][_0x27a5('0x66')]+_0x27a5('0x67')===_0xc47589){phoneDescriptions[_0x27a5('0x1e')]({'itemTypeId':_0x188b71[_0x5075a4]['id'],'description':_0xc47589});delete _0x4a3dd4[_0xc47589];}}}if(hasAdditionalPhones)_0x4a3dd4[_0x27a5('0x1d')]='';var _0x5a58a8=_['keys'](_0x4a3dd4)['join']();logger['info'](_0x27a5('0x68'),_0x5a58a8);fs[_0x27a5('0x69')](_0x31c3c2,_0x5a58a8+'\x0a');Papa[_0x27a5('0x6a')](fs[_0x27a5('0x6b')](_0x404c97),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3697fa,_0x4ad71c){try{for(var _0x2f6d6b=0x0,_0x20d11d=[];_0x2f6d6b<_0x3697fa[_0x27a5('0x6c')][_0x27a5('0x1a')];_0x2f6d6b++){stats[_0x27a5('0x6d')]+=0x1;if(_0x3697fa[_0x27a5('0x5c')][_0x2f6d6b]){handleError(_0x3697fa['data'][_0x2f6d6b],_0x3697fa[_0x27a5('0x5c')][_0x2f6d6b]);}else{var _0x22b528=[];var _0x163e35=[];var _0x5448b0={};for(var _0x42e98e in _0x20f0d6){let _0x13eab5=contactItemTypes[_0x27a5('0x6e')](_0x9b6091=>_0x9b6091[_0x27a5('0x66')]===_0x42e98e);let _0x2c1a87=contactItemTypes[_0x27a5('0x6e')](_0x4f9b6e=>_0x4f9b6e[_0x27a5('0x66')]+_0x27a5('0x67')===_0x42e98e);if(_[_0x27a5('0x1b')](_0x13eab5)&&_['isNil'](_0x2c1a87)){if(_0x20f0d6[_0x27a5('0x6f')](_0x42e98e)){if(_0x3697fa[_0x27a5('0x6c')][_0x2f6d6b][_0x20f0d6[_0x42e98e]]){var _0x537ead=_[_0x27a5('0x70')](_0x3697fa['data'][_0x2f6d6b][_0x20f0d6[_0x42e98e]][_0x27a5('0x71')](/"/g,'\x27'));switch(_0x42e98e){case _0x27a5('0x34'):var _0x2b5c54=moment(_0x537ead,_0x27a5('0xe'),!![]);if(_0x2b5c54[_0x27a5('0x72')]()){_0x20d11d['push']('\x22'+_0x537ead+'\x22');}else{_0x22b528['push'](_0x27a5('0x73'));}break;case _0x27a5('0x37'):var _0x5df4fa=parseInt(_0x537ead);_0x537ead=_[_0x27a5('0x74')](_0x5df4fa)||_0x5df4fa<0x0||_0x5df4fa>0x4?_0x37615b?0x3:0x2:_0x5df4fa;_0x20d11d[_0x27a5('0x1e')]('\x22'+_0x537ead+'\x22');break;case _0x27a5('0x75'):var _0x4dcd69=parseInt(_0x537ead);if(_[_0x27a5('0x76')](_0x4dcd69)&&_['includes'](_0x5de71f,_0x4dcd69)){_0x20d11d[_0x27a5('0x1e')]('\x22'+_0x4dcd69+'\x22');}else{_0x22b528[_0x27a5('0x1e')](_0x27a5('0x77'));}break;case _0x27a5('0x78'):if(isEmail(_0x537ead)){_0x20d11d[_0x27a5('0x1e')]('\x22'+_0x537ead+'\x22');}else{_0x22b528[_0x27a5('0x1e')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x58718c=moment(_0x537ead,_0x27a5('0x79'),!![]);if(_0x58718c['isValid']()){_0x20d11d[_0x27a5('0x1e')]('\x22'+_0x537ead+'\x22');}else{_0x22b528['push'](_0x27a5('0x7a'));}break;default:_0x20d11d[_0x27a5('0x1e')]('\x22'+_0x537ead+'\x22');}}else{switch(_0x42e98e){case'firstName':case _0x27a5('0x1c'):_0x22b528[_0x27a5('0x1e')](_0x42e98e+'\x20not\x20specified');break;default:_0x20d11d[_0x27a5('0x1e')]('\x22\x22');}}}}else{var _0x4bc4a5='';if(!_[_0x27a5('0x1b')](_0x13eab5)){if(!_0x5448b0[_0x27a5('0x6f')](_0x13eab5['id'])){for(var _0x28ac55=0x0;_0x28ac55<_0x20f0d6[_0x42e98e][_0x27a5('0x1a')];_0x28ac55++){var _0x537ead=_['trim'](_0x3697fa[_0x27a5('0x6c')][_0x2f6d6b][_0x20f0d6[_0x42e98e][_0x28ac55]][_0x27a5('0x71')](/"/g,'\x27'));var _0x56ad59=phoneDescriptions[_0x27a5('0x6e')](_0x2bd859=>_0x2bd859['itemTypeId']===_0x13eab5['id']);if(!_['isNil'](_0x56ad59)){var _0x2ef778=_[_0x27a5('0x70')](_0x3697fa[_0x27a5('0x6c')][_0x2f6d6b][_0x20f0d6[_0x56ad59[_0x27a5('0x7b')]][0x0]][_0x27a5('0x71')](/"/g,'\x27'));if(!_[_0x27a5('0x1b')](_0x2ef778))_0x537ead=_0x537ead+'§'+_0x2ef778;}if(_0x4bc4a5=='')_0x4bc4a5=_0x537ead;else _0x4bc4a5+='|'+_0x537ead;}_0x163e35['push'](_0x13eab5['id']+':'+_0x4bc4a5);_0x5448b0[_0x13eab5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x20d11d[_0x27a5('0x1e')]('\x22'+_0x163e35[_0x27a5('0x13')](';')+'\x22');}if(_0x22b528[_0x27a5('0x1a')]){handleError(_0x3697fa[_0x27a5('0x6c')][_0x2f6d6b],{'code':_0x27a5('0x7c'),'message':_0x22b528['join']()});}else{fs['appendFileSync'](_0x31c3c2,_0x20d11d[_0x27a5('0x13')]()+'\x0a');}_0x20d11d=[];}if(!(stats['rows']%0xc8)){socket[_0x27a5('0x7d')]('contact:import:'+_0x33147b,stats);stats['errors']=[];}}if(stopped){logger[_0x27a5('0x58')](_0x27a5('0x7e'));_0x4ad71c[_0x27a5('0x7f')]();}}catch(_0x750093){handleError(_0x3697fa[_0x27a5('0x6c')][_0x2f6d6b],{'code':_0x27a5('0x80'),'message':_0x750093[_0x27a5('0x22')]});logger['error'](_0x27a5('0x81'),_0x750093[_0x27a5('0x22')]);}},'complete':function(){try{var _0x4d1e73=[];var _0x1a7118=tempTableName;_0x4d1e73[_0x27a5('0x1e')](_0x27a5('0x82')+_0x1a7118+_0x27a5('0x83'));logger[_0x27a5('0x58')]('CIS\x20len',contactItemTypes[_0x27a5('0x1a')]);var _0x259920=util[_0x27a5('0xf')](_0x27a5('0x84'),_0x31c3c2,_0x1a7118,_0x5a58a8,_0x26002c[_0x27a5('0x45')],_0x26002c['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x20f0d6[_0x27a5('0x34')])){_0x259920+=',\x20scheduledAt\x20=\x20NOW()';}_0x4d1e73[_0x27a5('0x1e')](_0x259920);BPromise['each'](_0x4d1e73,handleQuery)[_0x27a5('0x20')](function(_0x18ca37){BPromise[_0x27a5('0x1f')]([handleAdditionalPhones()])[_0x27a5('0x20')](function(){_0x4d1e73=[];for(var _0x54fe7a=0x0;_0x54fe7a\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','Setting','findOne','enableEmailPreview','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','select','field','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','name','buildExpression','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','ContactId','type','Tag','tags','ids','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','plainBody','body','some','compact','forEach','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','filter','capitalize','chat','Websites','Accounts','search','\x20IS\x20NULL','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','QueryTypes','sequelize','toString','keyBy','attributes','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END'];(function(_0x5caa59,_0x365340){var _0x44b83c=function(_0xea57de){while(--_0xea57de){_0x5caa59['push'](_0x5caa59['shift']());}};_0x44b83c(++_0x365340);}(_0xe2ee,0x163));var _0xee2e=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xe2ee[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0xee2e('0x0'));var squel=require('squel');var as=require(_0xee2e('0x1'));var qs=require(_0xee2e('0x2'));var updateInteraction=require('./update-interaction')[_0xee2e('0x3')];var utils=require(_0xee2e('0x4'));var db=require(_0xee2e('0x5'))['db'];function skipInteractionsQuery(_0x3b5f74,_0x484d6e,_0x7b0942){var _0x42f8e8=![];var _0x57901c=utils[_0xee2e('0x6')](_0x3b5f74);if(_0x484d6e[_0xee2e('0x7')]===_0xee2e('0x8')&&!_0x7b0942['search']&&!_0x7b0942[_0x57901c]){_0x42f8e8=!![];}return _0x42f8e8;}function getTagsQuery(){return squel[_0xee2e('0x9')]()['field']('id')[_0xee2e('0xa')]('name')[_0xee2e('0xa')]('color')[_0xee2e('0xb')](_0xee2e('0xc'));}function getUsersQuery(_0x309560,_0x457322){var _0x72c94f=utils[_0xee2e('0xd')](_0x309560);var _0x55342c=_0xee2e('0xe')+_0x309560+_0xee2e('0xf');var _0x58fb9a=squel[_0xee2e('0x9')]()[_0xee2e('0xa')](_0xee2e('0x10'))[_0xee2e('0xa')](_0xee2e('0x11'))[_0xee2e('0xa')](_0xee2e('0x12')+_0x72c94f)[_0xee2e('0xb')](_0x55342c,'ui')['left_join'](_0xee2e('0x13'),'u',_0xee2e('0x14'));if(_0x457322[_0xee2e('0x15')]>0x0){_0x58fb9a[_0xee2e('0x16')]('ui.'+_0x72c94f+_0xee2e('0x17'),_[_0xee2e('0x18')](_0x457322,'id'));}return _0x58fb9a;}function getInteractionsQuery(_0xb6e61e){var _0x113955=utils[_0xee2e('0x19')](_0xb6e61e);var _0x5d0096=utils[_0xee2e('0x6')](_0xb6e61e);var _0x1cb869=utils['getInteractionFK'](_0xb6e61e);return squel[_0xee2e('0x9')]()['from'](_0x113955[_0xee2e('0x1a')],'i')[_0xee2e('0x1b')](_0xee2e('0x1c'),'c',_0xee2e('0x1d'))[_0xee2e('0x1b')](_0xee2e('0x13'),'o',_0xee2e('0x1e'))[_0xee2e('0x1b')](_0x113955['accounts'],'a',_0xee2e('0x1f')+_0x5d0096)[_0xee2e('0x1b')](_0x113955['messages'],'me',_0xee2e('0x20')+_0x1cb869+_0xee2e('0x21'))[_0xee2e('0x1b')](_0x113955[_0xee2e('0x22')],'it',_0xee2e('0x23')+_0x1cb869+_0xee2e('0x21'))[_0xee2e('0x1b')](_0xee2e('0xc'),'t',_0xee2e('0x24'));}function getSqlClauses(){var _0x366526={'body':squel[_0xee2e('0x25')](),'contact':squel['expr'](),'default':squel[_0xee2e('0x25')](),'fields':squel['expr'](),'filter':squel[_0xee2e('0x25')](),'read':squel['expr'](),'tags':{'clause':squel[_0xee2e('0x25')](),'ids':null},'user':squel[_0xee2e('0x25')]()};return _0x366526;}function parseTagParameter(_0x4ec9db){var _0x3804bd=squel['expr']();if(_0x4ec9db){var _0x2a91e9=utils[_0xee2e('0x26')](_0x4ec9db);_0x2a91e9['forEach'](function(_0xad7692){_0x3804bd['or'](_0xee2e('0x27'),'%,'+_0xad7692+',%');});}return _0x3804bd;}function parseReadParameter(_0x5630e6){var _0x8cf260='';if(_0x5630e6){_0x8cf260=_0xee2e('0x28');if(_0x5630e6==='1'){_0x8cf260=_0x8cf260['replace']('{OPERATOR}','=');}else{_0x8cf260=_0x8cf260[_0xee2e('0x29')](_0xee2e('0x2a'),'>');}}return _0x8cf260;}function parseSearchFilter(_0x2cb8b2,_0x3be737){var _0x319c94=squel[_0xee2e('0x25')]();if(_0x3be737){var _0x95a59a=_0x3be737[_0xee2e('0x29')]('\x5c','\x5c\x5c')[_0xee2e('0x29')](/'/g,'\x27\x27');if(qs[_0xee2e('0x2b')](_0x95a59a)){_0x319c94['or'](_0xee2e('0x2c'),_0x95a59a+'%');if([_0xee2e('0x2d'),_0xee2e('0x2e')][_0xee2e('0x2f')](_0x2cb8b2)){_0x319c94['or'](_0xee2e('0x30'),_0x95a59a+'%');}else if(_0x2cb8b2===_0xee2e('0x31')){_0x319c94['or'](_0xee2e('0x32'),_0x95a59a+'%');}else if(_0x2cb8b2==='openchannel'){_0x319c94['or'](_0xee2e('0x33'),_0x95a59a+'%');}}else if(_0x2cb8b2==='mail'&&qs[_0xee2e('0x34')](_0x95a59a)){_0x319c94['or'](_0xee2e('0x35'),_0x95a59a+'%');}else{if(_0x2cb8b2===_0xee2e('0x36')){_0x319c94['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee2e('0x37')](_0x95a59a,!![]))['or'](_0xee2e('0x38'),qs[_0xee2e('0x37')](_0x95a59a));}else if(_0x2cb8b2!==_0xee2e('0x31')){_0x319c94['or'](_0xee2e('0x39'),qs['getFullTextValue'](_0x95a59a));}_0x319c94['or'](_0xee2e('0x3a'),qs['getFullTextValue'](_0x95a59a,!![]),null);}}return _0x319c94;}function parseAdvancedSearchFilter(_0x36c818,_0x5ebaab){var _0x37580b=getSqlClauses();var _0x513a1c=as['parseSearch'](_0x36c818);var _0x40d210=_0x513a1c[_0xee2e('0x3b')];for(var _0x129ac6=0x0;_0x129ac6<_0x513a1c['conditions'][_0xee2e('0x15')];_0x129ac6++){var _0x3d9902=_0x513a1c[_0xee2e('0x3c')][_0x129ac6];var _0x3e6e1d='i';var _0x2bcf76=_[_0xee2e('0x3d')](_0x5ebaab,[_0xee2e('0x3e'),_0x3d9902['field']]);if(_0x2bcf76){var _0x38acb5=as[_0xee2e('0x3f')](_0x3e6e1d,_0x2bcf76['type'],_0x3d9902);_0x37580b['default'][_0x40d210](_0x38acb5[_0xee2e('0x40')],_0x38acb5[_0xee2e('0x41')][_0xee2e('0x42')],_0x38acb5[_0xee2e('0x41')][_0xee2e('0x43')]);}else{switch(_0x3d9902[_0xee2e('0xa')]){case _0xee2e('0x44'):var _0x4bdf7a=parseReadParameter(_0x3d9902[_0xee2e('0x41')]);_0x37580b[_0xee2e('0x45')][_0xee2e('0x46')](_0x4bdf7a);break;case _0xee2e('0x47'):if(_0x3d9902[_0xee2e('0x48')]===_0xee2e('0x49')){if(_0x3d9902[_0xee2e('0x41')][_0xee2e('0x4a')]('\x20')['length']>0x1){_0x37580b[_0xee2e('0x4b')][_0x40d210]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee2e('0x37')](_0x3d9902[_0xee2e('0x41')],!![]),null);}else{var _0x418f3a='%'+_0x3d9902['value']+'%';_0x37580b['contact'][_0x40d210]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x418f3a,_0x418f3a,_0x418f3a);}}else{_0x2bcf76=_[_0xee2e('0x3d')](_0x5ebaab,['name',_0xee2e('0x4c')]);_0x3d9902[_0xee2e('0xa')]=_0xee2e('0x4c');_0x38acb5=as[_0xee2e('0x3f')](_0x3e6e1d,_0x2bcf76[_0xee2e('0x4d')],_0x3d9902);_0x37580b[_0xee2e('0x4b')][_0x40d210](_0x38acb5['text'],_0x38acb5['value'][_0xee2e('0x42')],_0x38acb5[_0xee2e('0x41')][_0xee2e('0x43')]);}break;case _0xee2e('0x4e'):var _0x3d37d4=_0x3d9902[_0xee2e('0x41')][_0xee2e('0x4a')](',')['map'](function(_0x468bd2){return Number(_0x468bd2);});var _0x59fe1d=parseTagParameter(_0x3d37d4);_0x37580b[_0xee2e('0x4f')]['clause']['and'](_0x59fe1d);_0x37580b[_0xee2e('0x4f')][_0xee2e('0x50')]=_0x3d37d4;break;case _0xee2e('0x51'):if(_0x3d9902[_0xee2e('0x48')]==='$substring'){_0x37580b['user'][_0x40d210](_0xee2e('0x52'),'%'+_0x3d9902[_0xee2e('0x41')]+'%',null);}else{_0x2bcf76=_[_0xee2e('0x3d')](_0x5ebaab,[_0xee2e('0x3e'),_0xee2e('0x53')]);_0x3d9902[_0xee2e('0xa')]=_0xee2e('0x53');_0x38acb5=as['buildExpression'](_0x3e6e1d,_0x2bcf76[_0xee2e('0x4d')],_0x3d9902);_0x37580b[_0xee2e('0x54')][_0x40d210](_0x38acb5['text'],_0x38acb5[_0xee2e('0x41')][_0xee2e('0x42')],_0x38acb5['value']['end']);}break;case'body':case _0xee2e('0x55'):_0x38acb5=as['buildExpression']('me',null,_0x3d9902);_0x37580b[_0xee2e('0x56')][_0x40d210](_0x38acb5[_0xee2e('0x40')],_0x38acb5['value'][_0xee2e('0x42')],_0x38acb5[_0xee2e('0x41')][_0xee2e('0x43')]);break;}}}return _0x37580b;}function parseModelFields(_0xc6ed62,_0x2a4d49,_0x30206f){var _0xa7c7dc=utils[_0xee2e('0x6')](_0xc6ed62);var _0x12ddd4=squel[_0xee2e('0x25')]();var _0x373fea=_(_0x2a4d49)['keys']()[_0xee2e('0x18')](function(_0x2dc1b9){return _[_0xee2e('0x57')](_0x30206f,[_0xee2e('0x3e'),_0x2dc1b9])?_0x2dc1b9:undefined;})[_0xee2e('0x58')]()[_0xee2e('0x41')]();if(_0x373fea[_0xee2e('0x15')]>0x0){_0x373fea[_0xee2e('0x59')](function(_0x28a408){if(_0x28a408===_0xa7c7dc){_0x12ddd4[_0xee2e('0x46')]('i.'+_0xa7c7dc+_0xee2e('0x17'),[][_0xee2e('0x5a')](_0x2a4d49[_0x28a408]));}else if(_0x28a408==='createdAt'){var _0x10b965=JSON['parse'](_0x2a4d49[_0x28a408])[_0xee2e('0x5b')];var _0x5e4d0d=JSON[_0xee2e('0x5c')](_0x2a4d49[_0x28a408])[_0xee2e('0x5d')];_0x12ddd4[_0xee2e('0x46')](_0xee2e('0x5e'),_0x10b965,_0x5e4d0d);}else{if(_0x2a4d49[_0x28a408]===_0xee2e('0x5f')){_0x12ddd4[_0xee2e('0x46')]('i.'+_0x28a408+'\x20IS\x20NULL');}else{_0x12ddd4[_0xee2e('0x46')]('i.'+_0x28a408+_0xee2e('0x60'),_0x2a4d49[_0x28a408]);}}});}return _0x12ddd4;}function parseQueryParameters(_0x340057,_0x577ba8,_0x2639c6){var _0x22207f=getSqlClauses();return Promise[_0xee2e('0x61')]()[_0xee2e('0x62')](function(){return parseModelFields(_0x340057,_0x577ba8,_0x2639c6);})[_0xee2e('0x62')](function(_0x3a4b89){_0x22207f[_0xee2e('0x63')][_0xee2e('0x46')](_0x3a4b89);return parseReadParameter(_0x577ba8['read']);})[_0xee2e('0x62')](function(_0x3e83ac){_0x22207f[_0xee2e('0x45')][_0xee2e('0x46')](_0x3e83ac);return parseTagParameter(_0x577ba8['tag']);})['then'](function(_0x58aee0){_0x22207f[_0xee2e('0x4f')]['clause'][_0xee2e('0x46')](_0x58aee0);return parseSearchFilter(_0x340057,_0x577ba8[_0xee2e('0x64')]);})[_0xee2e('0x62')](function(_0x33985c){_0x22207f['filter']=_0x33985c;return _0x22207f;});}function checkAccountsRestrictions(_0x2cb29a,_0x26126f,_0x3afe0a){var _0x17f0c3=utils[_0xee2e('0x6')](_0x2cb29a);var _0x208036='get'+_[_0xee2e('0x65')](_0x2cb29a)+(_0x2cb29a===_0xee2e('0x66')?_0xee2e('0x67'):_0xee2e('0x68'));var _0x12c3d6=squel['expr']();return Promise['resolve']()[_0xee2e('0x62')](function(){if(_0x3afe0a[_0xee2e('0x69')]&&_0x26126f[_0xee2e('0x7')]===_0xee2e('0x8')){return _0x26126f[_0x208036]({'attributes':['id'],'raw':!![]});}})[_0xee2e('0x62')](function(_0x337d9f){if(_0x337d9f){if(_0x337d9f['length']===0x0){_0x12c3d6['and']('i.'+_0x17f0c3+_0xee2e('0x6a'));}else{_0x12c3d6['and']('i.'+_0x17f0c3+_0xee2e('0x17'),_[_0xee2e('0x18')](_0x337d9f,'id'));}}else if(!_0x3afe0a[_0x17f0c3]){_0x12c3d6['and']('i.'+_0x17f0c3+'\x20IS\x20NOT\x20NULL');}})[_0xee2e('0x62')](function(){return _0x12c3d6;});}function getClosedOrderClause(_0x5c19a9,_0x50ed37){var _0x220e4e='';var _0xeec0c5=['i.thirdDisposition','i.secondDisposition',_0xee2e('0x6b')];if(_0x5c19a9==='mail'){_0xeec0c5[_0xee2e('0x6c')](_0xee2e('0x6d'));}if(_0x50ed37[_0xee2e('0x6e')]==='0'&&_0x5c19a9===_0xee2e('0x36')){_0x220e4e=_0xee2e('0x6d');}else{if(_0x50ed37[_0xee2e('0x6e')]==='1'){_0xeec0c5[_0xee2e('0x6f')]();}_0x220e4e=_0xee2e('0x70')+_0xeec0c5['join'](',\x20')+')';}return _0x220e4e;}function getFilteredInteractions(_0x54b8ec,_0x1d4612,_0x4e08ab,_0xeb4e9){var _0x14bed4=utils[_0xee2e('0xd')](_0x54b8ec);var _0x1f0a6a=_['capitalize'](_0x54b8ec)+'Interaction';var _0x13c6a0=[];var _0x75918e=getTagsQuery();var _0xc1e521={'type':db['Sequelize'][_0xee2e('0x71')]['SELECT'],'raw':!![]};var _0xdcd1ba=[];var _0x10f050=[];return db[_0xee2e('0x72')]['query'](_0x75918e[_0xee2e('0x73')](),_0xc1e521)[_0xee2e('0x62')](function(_0x315df2){_0x13c6a0=_[_0xee2e('0x74')](_0x315df2,'id');_0xc1e521=_['merge'](_0xc1e521,{'model':db[_0x1f0a6a],'mapToModel':!![],'nest':!![]});if(_0x4e08ab[_0xee2e('0x63')]){_0xeb4e9[_0xee2e('0x75')]['forEach'](function(_0x510be8){_0x1d4612[_0xee2e('0xa')]('i.'+_0x510be8);});}else{_0x1d4612[_0xee2e('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x1d4612[_0xee2e('0xa')](_0xee2e('0x76'),'Account.key');_0x1d4612['field'](_0xee2e('0x77'),_0xee2e('0x78'));if(_0x54b8ec===_0xee2e('0x36')){_0x1d4612[_0xee2e('0xa')]('a.email',_0xee2e('0x79'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x7a'),_0xee2e('0x7b'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x7c'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x7d'));_0x1d4612['field']('i.updatedAt');_0x1d4612['field'](_0xee2e('0x7e'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x7f'));_0x1d4612[_0xee2e('0xa')]('i.attach');_0x1d4612['field'](_0xee2e('0x80'));_0x1d4612['field'](_0xee2e('0x81'));_0x1d4612['field']('i.subject');_0x1d4612[_0xee2e('0xa')](_0xee2e('0x6b'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x82'));_0x1d4612['field'](_0xee2e('0x83'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x6d'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x84'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x85'));_0x1d4612[_0xee2e('0xa')]('i.MailAccountId');_0x1d4612[_0xee2e('0xa')](_0xee2e('0x86'));}else if(_0x54b8ec===_0xee2e('0x87')){_0x1d4612[_0xee2e('0xa')](_0xee2e('0x88'),_0xee2e('0x7b'));}else{_0x1d4612[_0xee2e('0xa')](_0xee2e('0x89'),'contactName');}if(_0x54b8ec!==_0xee2e('0x36')){_0x1d4612[_0xee2e('0xa')](_0xee2e('0x8a'));}_0x1d4612[_0xee2e('0xa')]('c.firstName','Contact.firstName');_0x1d4612['field']('c.lastName',_0xee2e('0x8b'));_0x1d4612[_0xee2e('0xa')]('c.email',_0xee2e('0x8c'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x8d'),_0xee2e('0x8e'));_0x1d4612['field']('c.mobile',_0xee2e('0x8f'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x90'),_0xee2e('0x91'));_0x1d4612['field'](_0xee2e('0x92'),'Owner.fullname');_0x1d4612[_0xee2e('0xa')](_0xee2e('0x93'),_0xee2e('0x94'));_0x1d4612[_0xee2e('0xa')](_0xee2e('0x95'),_0xee2e('0x96'));}if(_0xeb4e9[_0xee2e('0x97')]){_0x1d4612[_0xee2e('0x97')](_0xeb4e9[_0xee2e('0x97')]);}if(_0xeb4e9['offset']){_0x1d4612[_0xee2e('0x98')](_0xeb4e9['offset']);}return db[_0xee2e('0x72')]['query'](_0x1d4612[_0xee2e('0x73')](),_0xc1e521);})[_0xee2e('0x62')](function(_0x10bfd3){_0xdcd1ba=_0x10bfd3;var _0x9ad49a=getUsersQuery(_0x54b8ec,_0xdcd1ba);return db[_0xee2e('0x72')][_0xee2e('0x99')](_0x9ad49a[_0xee2e('0x73')](),_0xc1e521);})['then'](function(_0x4249d6){_0x10f050=_[_0xee2e('0x9a')](_0x4249d6,_0x14bed4);if(_0x54b8ec===_0xee2e('0x36')){return db[_0xee2e('0x9b')][_0xee2e('0x9c')]({'attributes':[_0xee2e('0x9d')],'raw':!![]});}})[_0xee2e('0x62')](function(_0x4e4dcc){var _0x4e8315=_0x4e4dcc?_0x4e4dcc[_0xee2e('0x9d')]:undefined;var _0x1ecb6c=_0xdcd1ba['map'](function(_0x645c12){return updateInteraction(_0x645c12,_0x13c6a0,_0x10f050,_0x4e8315);});return Promise['all'](_0x1ecb6c);});}function countFilteredInteractions(_0x5b5eba,_0x2082a3){var _0x523a96=_0x5b5eba['clone']();_0x523a96[_0xee2e('0xa')](_0xee2e('0x9e'));_0x523a96[_0xee2e('0xa')](_0xee2e('0x9f'),_0xee2e('0x44'));var _0x4420d0=utils['getSelectedTags'](_0x2082a3);if(!_[_0xee2e('0xa0')](_0x4420d0)){_0x523a96['where'](_0xee2e('0xa1'),_0x4420d0);}var _0x3f1b50={'type':db[_0xee2e('0xa2')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0xee2e('0x72')][_0xee2e('0x99')](_0x523a96[_0xee2e('0x73')](),_0x3f1b50);}module[_0xee2e('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x87a2=['start','end','unreadMessages','value','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','tags','clause','ids','User','user','UserId','body','plainBody','compact','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','tag','filter','get','capitalize','chat','Websites','Accounts','resolve','agent','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','closed','i.substatus','shift','join','Interaction','Sequelize','QueryTypes','sequelize','query','toString','keyBy','merge','fields','attributes','Account.key','a.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','color','from','tools_tags','getInteractionFK','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','\x20=\x20i.id','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','find','type','text'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x87a2,0x64));var _0x287a=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x87a2[_0x152678];return _0x311a9;};'use strict';var _=require(_0x287a('0x0'));var squel=require(_0x287a('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x287a('0x2'));var updateInteraction=require(_0x287a('0x3'))[_0x287a('0x4')];var utils=require(_0x287a('0x5'));var db=require(_0x287a('0x6'))['db'];function skipInteractionsQuery(_0x26ad1f,_0x473a4f,_0x48c37a){var _0x23e5fa=![];var _0x1fa8b1=utils[_0x287a('0x7')](_0x26ad1f);if(_0x473a4f[_0x287a('0x8')]==='agent'&&!_0x48c37a[_0x287a('0x9')]&&!_0x48c37a[_0x1fa8b1]){_0x23e5fa=!![];}return _0x23e5fa;}function getTagsQuery(){return squel[_0x287a('0xa')]()[_0x287a('0xb')]('id')[_0x287a('0xb')](_0x287a('0xc'))[_0x287a('0xb')](_0x287a('0xd'))[_0x287a('0xe')](_0x287a('0xf'));}function getUsersQuery(_0x176a93,_0x351abd){var _0x72b411=utils[_0x287a('0x10')](_0x176a93);var _0x2d5f35='user_has_'+_0x176a93+'_interactions';var _0x51d934=squel[_0x287a('0xa')]()['field']('u.id')[_0x287a('0xb')]('u.fullname')['field'](_0x287a('0x11')+_0x72b411)[_0x287a('0xe')](_0x2d5f35,'ui')['left_join'](_0x287a('0x12'),'u',_0x287a('0x13'));if(_0x351abd[_0x287a('0x14')]>0x0){_0x51d934[_0x287a('0x15')](_0x287a('0x11')+_0x72b411+_0x287a('0x16'),_[_0x287a('0x17')](_0x351abd,'id'));}return _0x51d934;}function getInteractionsQuery(_0x24d20e){var _0x57174e=utils[_0x287a('0x18')](_0x24d20e);var _0x40a35e=utils[_0x287a('0x7')](_0x24d20e);var _0x1d33ad=utils[_0x287a('0x10')](_0x24d20e);return squel['select']()['from'](_0x57174e['interactions'],'i')['left_join']('cm_contacts','c',_0x287a('0x19'))[_0x287a('0x1a')](_0x287a('0x12'),'o','o.id\x20=\x20i.UserId')[_0x287a('0x1a')](_0x57174e[_0x287a('0x1b')],'a',_0x287a('0x1c')+_0x40a35e)['left_join'](_0x57174e[_0x287a('0x1d')],'me',_0x287a('0x1e')+_0x1d33ad+'\x20=\x20i.id')[_0x287a('0x1a')](_0x57174e[_0x287a('0x1f')],'it',_0x287a('0x20')+_0x1d33ad+_0x287a('0x21'))[_0x287a('0x1a')](_0x287a('0xf'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x103684={'body':squel[_0x287a('0x22')](),'contact':squel[_0x287a('0x22')](),'default':squel[_0x287a('0x22')](),'fields':squel[_0x287a('0x22')](),'filter':squel[_0x287a('0x22')](),'read':squel[_0x287a('0x22')](),'tags':{'clause':squel[_0x287a('0x22')](),'ids':null},'user':squel['expr']()};return _0x103684;}function parseTagParameter(_0x3fa06f){var _0x585f57=squel[_0x287a('0x22')]();if(_0x3fa06f){var _0x45f139=utils['getSelectedTags'](_0x3fa06f);_0x45f139[_0x287a('0x23')](function(_0x129000){_0x585f57['or'](_0x287a('0x24'),'%,'+_0x129000+',%');});}return _0x585f57;}function parseReadParameter(_0x2eabc1){var _0x1cf312='';if(_0x2eabc1){_0x1cf312='unreadMessages\x20{OPERATOR}\x200';if(_0x2eabc1==='1'){_0x1cf312=_0x1cf312[_0x287a('0x25')]('{OPERATOR}','=');}else{_0x1cf312=_0x1cf312[_0x287a('0x25')](_0x287a('0x26'),'>');}}return _0x1cf312;}function parseSearchFilter(_0x689d29,_0xa9cfdf){var _0x591b2c=squel[_0x287a('0x22')]();if(_0xa9cfdf){var _0x183c7b=_0xa9cfdf[_0x287a('0x25')]('\x5c','\x5c\x5c')[_0x287a('0x25')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x183c7b)){_0x591b2c['or'](_0x287a('0x27'),_0x183c7b+'%');if([_0x287a('0x28'),_0x287a('0x29')]['includes'](_0x689d29)){_0x591b2c['or'](_0x287a('0x2a'),_0x183c7b+'%');}else if(_0x689d29===_0x287a('0x2b')){_0x591b2c['or'](_0x287a('0x2c'),_0x183c7b+'%');}else if(_0x689d29===_0x287a('0x2d')){_0x591b2c['or'](_0x287a('0x2e'),_0x183c7b+'%');}}else if(_0x689d29===_0x287a('0x2f')&&qs[_0x287a('0x30')](_0x183c7b)){_0x591b2c['or'](_0x287a('0x31'),_0x183c7b+'%');}else{if(_0x689d29===_0x287a('0x2f')){_0x591b2c['or'](_0x287a('0x32'),qs[_0x287a('0x33')](_0x183c7b,!![]))['or'](_0x287a('0x34'),qs[_0x287a('0x33')](_0x183c7b));}else if(_0x689d29!==_0x287a('0x2b')){_0x591b2c['or'](_0x287a('0x35'),qs[_0x287a('0x33')](_0x183c7b));}_0x591b2c['or'](_0x287a('0x36'),qs[_0x287a('0x33')](_0x183c7b,!![]),null);}}return _0x591b2c;}function parseAdvancedSearchFilter(_0x2ae820,_0x25def3){var _0x3560d9=getSqlClauses();var _0x30ca58=as[_0x287a('0x37')](_0x2ae820);var _0x5c8300=_0x30ca58[_0x287a('0x38')];for(var _0x3550f8=0x0;_0x3550f8<_0x30ca58['conditions'][_0x287a('0x14')];_0x3550f8++){var _0x264245=_0x30ca58['conditions'][_0x3550f8];var _0x4f4d77='i';var _0x437225=_[_0x287a('0x39')](_0x25def3,[_0x287a('0xc'),_0x264245[_0x287a('0xb')]]);if(_0x437225){var _0x20ed22=as['buildExpression'](_0x4f4d77,_0x437225[_0x287a('0x3a')],_0x264245);_0x3560d9['default'][_0x5c8300](_0x20ed22[_0x287a('0x3b')],_0x20ed22['value'][_0x287a('0x3c')],_0x20ed22['value'][_0x287a('0x3d')]);}else{switch(_0x264245[_0x287a('0xb')]){case _0x287a('0x3e'):var _0xc9a255=parseReadParameter(_0x264245[_0x287a('0x3f')]);_0x3560d9[_0x287a('0x40')][_0x287a('0x41')](_0xc9a255);break;case _0x287a('0x42'):if(_0x264245[_0x287a('0x43')]===_0x287a('0x44')){if(_0x264245[_0x287a('0x3f')][_0x287a('0x45')]('\x20')[_0x287a('0x14')]>0x1){_0x3560d9['contact'][_0x5c8300]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x287a('0x33')](_0x264245[_0x287a('0x3f')],!![]),null);}else{var _0x30a3ec='%'+_0x264245[_0x287a('0x3f')]+'%';_0x3560d9[_0x287a('0x46')][_0x5c8300](_0x287a('0x47'),_0x30a3ec,_0x30a3ec,_0x30a3ec);}}else{_0x437225=_[_0x287a('0x39')](_0x25def3,[_0x287a('0xc'),_0x287a('0x48')]);_0x264245[_0x287a('0xb')]=_0x287a('0x48');_0x20ed22=as[_0x287a('0x49')](_0x4f4d77,_0x437225[_0x287a('0x3a')],_0x264245);_0x3560d9[_0x287a('0x46')][_0x5c8300](_0x20ed22[_0x287a('0x3b')],_0x20ed22[_0x287a('0x3f')][_0x287a('0x3c')],_0x20ed22[_0x287a('0x3f')][_0x287a('0x3d')]);}break;case _0x287a('0x4a'):var _0x15323f=_0x264245[_0x287a('0x3f')][_0x287a('0x45')](',')[_0x287a('0x17')](function(_0x477d28){return Number(_0x477d28);});var _0xc9f645=parseTagParameter(_0x15323f);_0x3560d9[_0x287a('0x4b')][_0x287a('0x4c')][_0x287a('0x41')](_0xc9f645);_0x3560d9['tags'][_0x287a('0x4d')]=_0x15323f;break;case _0x287a('0x4e'):if(_0x264245[_0x287a('0x43')]===_0x287a('0x44')){_0x3560d9[_0x287a('0x4f')][_0x5c8300]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x264245[_0x287a('0x3f')]+'%',null);}else{_0x437225=_['find'](_0x25def3,[_0x287a('0xc'),_0x287a('0x50')]);_0x264245[_0x287a('0xb')]=_0x287a('0x50');_0x20ed22=as[_0x287a('0x49')](_0x4f4d77,_0x437225['type'],_0x264245);_0x3560d9[_0x287a('0x4f')][_0x5c8300](_0x20ed22['text'],_0x20ed22[_0x287a('0x3f')][_0x287a('0x3c')],_0x20ed22[_0x287a('0x3f')][_0x287a('0x3d')]);}break;case _0x287a('0x51'):case _0x287a('0x52'):_0x20ed22=as[_0x287a('0x49')]('me',null,_0x264245);_0x3560d9[_0x287a('0x51')][_0x5c8300](_0x20ed22[_0x287a('0x3b')],_0x20ed22['value']['start'],_0x20ed22[_0x287a('0x3f')][_0x287a('0x3d')]);break;}}}return _0x3560d9;}function parseModelFields(_0x354429,_0x1390e2,_0x1a8857){var _0x3fbab7=utils[_0x287a('0x7')](_0x354429);var _0x265c96=squel['expr']();var _0xa39d96=_(_0x1390e2)['keys']()['map'](function(_0x25eb28){return _['some'](_0x1a8857,[_0x287a('0xc'),_0x25eb28])?_0x25eb28:undefined;})[_0x287a('0x53')]()[_0x287a('0x3f')]();if(_0xa39d96[_0x287a('0x14')]>0x0){_0xa39d96[_0x287a('0x23')](function(_0x5bb071){if(_0x5bb071===_0x3fbab7){_0x265c96[_0x287a('0x41')]('i.'+_0x3fbab7+_0x287a('0x16'),[][_0x287a('0x54')](_0x1390e2[_0x5bb071]));}else if(_0x5bb071===_0x287a('0x55')){var _0x1bf799=JSON[_0x287a('0x56')](_0x1390e2[_0x5bb071])[_0x287a('0x57')];var _0x106bbf=JSON[_0x287a('0x56')](_0x1390e2[_0x5bb071])['$lte'];_0x265c96['and'](_0x287a('0x58'),_0x1bf799,_0x106bbf);}else{if(_0x1390e2[_0x5bb071]===_0x287a('0x59')){_0x265c96[_0x287a('0x41')]('i.'+_0x5bb071+'\x20IS\x20NULL');}else{_0x265c96['and']('i.'+_0x5bb071+_0x287a('0x5a'),_0x1390e2[_0x5bb071]);}}});}return _0x265c96;}function parseQueryParameters(_0x3b1868,_0x236c75,_0x341e2e){var _0x13f158=getSqlClauses();return Promise['resolve']()[_0x287a('0x5b')](function(){return parseModelFields(_0x3b1868,_0x236c75,_0x341e2e);})['then'](function(_0x3a1206){_0x13f158['fields'][_0x287a('0x41')](_0x3a1206);return parseReadParameter(_0x236c75[_0x287a('0x40')]);})[_0x287a('0x5b')](function(_0x119cc6){_0x13f158[_0x287a('0x40')][_0x287a('0x41')](_0x119cc6);return parseTagParameter(_0x236c75[_0x287a('0x5c')]);})[_0x287a('0x5b')](function(_0x3f98e2){_0x13f158['tags'][_0x287a('0x4c')]['and'](_0x3f98e2);return parseSearchFilter(_0x3b1868,_0x236c75[_0x287a('0x5d')]);})['then'](function(_0x3b75ce){_0x13f158[_0x287a('0x5d')]=_0x3b75ce;return _0x13f158;});}function checkAccountsRestrictions(_0x24a7c9,_0x1fb707,_0x474bad){var _0x3997c6=utils['getAccountFK'](_0x24a7c9);var _0x150780=_0x287a('0x5e')+_[_0x287a('0x5f')](_0x24a7c9)+(_0x24a7c9===_0x287a('0x60')?_0x287a('0x61'):_0x287a('0x62'));var _0x2ce36a=squel['expr']();return Promise[_0x287a('0x63')]()[_0x287a('0x5b')](function(){if(_0x474bad[_0x287a('0x9')]&&_0x1fb707[_0x287a('0x8')]===_0x287a('0x64')){return _0x1fb707[_0x150780]({'attributes':['id'],'raw':!![]});}})[_0x287a('0x5b')](function(_0x597dbb){if(_0x597dbb){if(_0x597dbb[_0x287a('0x14')]===0x0){_0x2ce36a[_0x287a('0x41')]('i.'+_0x3997c6+'\x20IS\x20NULL');}else{_0x2ce36a['and']('i.'+_0x3997c6+_0x287a('0x16'),_['map'](_0x597dbb,'id'));}}else if(!_0x474bad[_0x3997c6]){_0x2ce36a[_0x287a('0x41')]('i.'+_0x3997c6+_0x287a('0x65'));}})[_0x287a('0x5b')](function(){return _0x2ce36a;});}function getClosedOrderClause(_0x2f0f5c,_0x171f09){var _0x19e851='';var _0x4ccaec=['i.thirdDisposition',_0x287a('0x66'),_0x287a('0x67')];if(_0x2f0f5c===_0x287a('0x2f')){_0x4ccaec[_0x287a('0x68')]('i.substatus');}if(_0x171f09[_0x287a('0x69')]==='0'&&_0x2f0f5c===_0x287a('0x2f')){_0x19e851=_0x287a('0x6a');}else{if(_0x171f09[_0x287a('0x69')]==='1'){_0x4ccaec[_0x287a('0x6b')]();}_0x19e851='CONCAT_WS(\x27\x27,\x20'+_0x4ccaec[_0x287a('0x6c')](',\x20')+')';}return _0x19e851;}function getFilteredInteractions(_0x3b802f,_0x5f2806,_0x5d2909,_0x3c0b44){var _0xc36555=utils[_0x287a('0x10')](_0x3b802f);var _0x35de67=_[_0x287a('0x5f')](_0x3b802f)+_0x287a('0x6d');var _0x29fa41=[];var _0x17f0a6=getTagsQuery();var _0x580af4={'type':db[_0x287a('0x6e')][_0x287a('0x6f')]['SELECT'],'raw':!![]};var _0x2d6dc9=[];var _0x2120ab=[];return db[_0x287a('0x70')][_0x287a('0x71')](_0x17f0a6[_0x287a('0x72')](),_0x580af4)[_0x287a('0x5b')](function(_0x76404b){_0x29fa41=_[_0x287a('0x73')](_0x76404b,'id');_0x580af4=_[_0x287a('0x74')](_0x580af4,{'model':db[_0x35de67],'mapToModel':!![],'nest':!![]});if(_0x5d2909[_0x287a('0x75')]){_0x3c0b44[_0x287a('0x76')][_0x287a('0x23')](function(_0x2197ed){_0x5f2806['field']('i.'+_0x2197ed);});}else{_0x5f2806['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x287a('0x3e'));_0x5f2806[_0x287a('0xb')]('a.key',_0x287a('0x77'));_0x5f2806[_0x287a('0xb')](_0x287a('0x78'),'Account.mandatoryDisposition');if(_0x3b802f===_0x287a('0x2f')){_0x5f2806[_0x287a('0xb')](_0x287a('0x79'),'Account.email');_0x5f2806[_0x287a('0xb')](_0x287a('0x7a'),'contactName');_0x5f2806[_0x287a('0xb')](_0x287a('0x7b'));_0x5f2806['field']('i.createdAt');_0x5f2806['field'](_0x287a('0x7c'));_0x5f2806[_0x287a('0xb')](_0x287a('0x7d'));_0x5f2806['field'](_0x287a('0x7e'));_0x5f2806[_0x287a('0xb')](_0x287a('0x7f'));_0x5f2806[_0x287a('0xb')](_0x287a('0x80'));_0x5f2806[_0x287a('0xb')](_0x287a('0x81'));_0x5f2806[_0x287a('0xb')]('i.subject');_0x5f2806[_0x287a('0xb')]('i.disposition');_0x5f2806[_0x287a('0xb')](_0x287a('0x66'));_0x5f2806[_0x287a('0xb')](_0x287a('0x82'));_0x5f2806[_0x287a('0xb')](_0x287a('0x6a'));_0x5f2806[_0x287a('0xb')]('i.to');_0x5f2806[_0x287a('0xb')]('i.ContactId');_0x5f2806[_0x287a('0xb')]('i.MailAccountId');_0x5f2806[_0x287a('0xb')]('i.UserId');}else if(_0x3b802f===_0x287a('0x2d')){_0x5f2806[_0x287a('0xb')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}else{_0x5f2806[_0x287a('0xb')](_0x287a('0x83'),'contactName');}if(_0x3b802f!==_0x287a('0x2f')){_0x5f2806[_0x287a('0xb')]('i.*');}_0x5f2806['field']('c.firstName',_0x287a('0x84'));_0x5f2806['field']('c.lastName',_0x287a('0x85'));_0x5f2806[_0x287a('0xb')](_0x287a('0x86'),'Contact.email');_0x5f2806[_0x287a('0xb')]('c.phone',_0x287a('0x87'));_0x5f2806[_0x287a('0xb')](_0x287a('0x88'),_0x287a('0x89'));_0x5f2806[_0x287a('0xb')]('c.fax',_0x287a('0x8a'));_0x5f2806[_0x287a('0xb')](_0x287a('0x8b'),_0x287a('0x8c'));_0x5f2806['field'](_0x287a('0x8d'),_0x287a('0x8e'));_0x5f2806[_0x287a('0xb')](_0x287a('0x8f'),_0x287a('0x90'));}if(_0x3c0b44[_0x287a('0x91')]){_0x5f2806[_0x287a('0x91')](_0x3c0b44[_0x287a('0x91')]);}if(_0x3c0b44[_0x287a('0x92')]){_0x5f2806[_0x287a('0x92')](_0x3c0b44[_0x287a('0x92')]);}return db['sequelize'][_0x287a('0x71')](_0x5f2806['toString'](),_0x580af4);})[_0x287a('0x5b')](function(_0x33063b){_0x2d6dc9=_0x33063b;var _0x387424=getUsersQuery(_0x3b802f,_0x2d6dc9);return db[_0x287a('0x70')][_0x287a('0x71')](_0x387424[_0x287a('0x72')](),_0x580af4);})[_0x287a('0x5b')](function(_0x25ba3f){_0x2120ab=_[_0x287a('0x93')](_0x25ba3f,_0xc36555);if(_0x3b802f===_0x287a('0x2f')){return db[_0x287a('0x94')][_0x287a('0x95')]({'attributes':[_0x287a('0x96')],'raw':!![]});}})[_0x287a('0x5b')](function(_0x3039c3){var _0x26bed6=_0x3039c3?_0x3039c3[_0x287a('0x96')]:undefined;var _0x13dfb8=_0x2d6dc9['map'](function(_0x39658e){return updateInteraction(_0x39658e,_0x29fa41,_0x2120ab,_0x26bed6);});return Promise[_0x287a('0x97')](_0x13dfb8);});}function countFilteredInteractions(_0x9129dc,_0x470b78){var _0x4e100a=_0x9129dc[_0x287a('0x98')]();_0x4e100a['field'](_0x287a('0x99'));_0x4e100a[_0x287a('0xb')](_0x287a('0x9a'),_0x287a('0x3e'));var _0x47e7c1=utils[_0x287a('0x9b')](_0x470b78);if(!_[_0x287a('0x9c')](_0x47e7c1)){_0x4e100a[_0x287a('0x15')](_0x287a('0x9d'),_0x47e7c1);}var _0x270b69={'type':db[_0x287a('0x6e')][_0x287a('0x6f')][_0x287a('0x9e')],'raw':!![]};return db[_0x287a('0x70')][_0x287a('0x71')](_0x4e100a['toString'](),_0x270b69);}module[_0x287a('0x9f')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index e3fab31..95cc940 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d94=['updateInteraction','then','Users','TagIds','Tags','../../mysqldb','map','fullname','forEach','push','waiting','talking','answered','abandoned','total','closed','disposition','UserId','unmanaged','MailMessage','findOne','out','-id','plainBody','lastMsgText','catch'];(function(_0x1937a7,_0x3dfea2){var _0xed9eaa=function(_0x1be672){while(--_0x1be672){_0x1937a7['push'](_0x1937a7['shift']());}};_0xed9eaa(++_0x3dfea2);}(_0x3d94,0x171));var _0x43d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d94[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var db=require(_0x43d9('0x0'))['db'];function getInteractionUsers(_0x23c198,_0x294458){return new Promise(function(_0x23caac,_0x32d58f){try{var _0x4edd9a=[];if(_0x294458[_0x23c198]){_0x4edd9a=_0x294458[_0x23c198][_0x43d9('0x1')](function(_0x67ebde){return{'id':_0x67ebde['id'],'fullname':_0x67ebde[_0x43d9('0x2')]};});}return _0x23caac(_0x4edd9a);}catch(_0x4a86d0){_0x32d58f(_0x4a86d0);}});}function getInteractionTags(_0x420311,_0x2c84d4){var _0x491388=[];if(_0x420311){_0x420311['split'](',')[_0x43d9('0x3')](function(_0x5c7918){_0x491388[_0x43d9('0x4')](_0x2c84d4[_0x5c7918]);});}return _0x491388;}function updateWaitingCounter(_0x33233a){if(_0x33233a['waiting']){_0x33233a[_0x43d9('0x5')]-=0x1;}}function updateInteractionCounters(_0x56360f){_0x56360f[_0x43d9('0x5')]=0x0;_0x56360f[_0x43d9('0x6')]=0x0;_0x56360f[_0x43d9('0x7')]=0x0;_0x56360f['unmanaged']=0x0;_0x56360f[_0x43d9('0x8')]=0x0;_0x56360f[_0x43d9('0x9')]=0x0;if(_0x56360f[_0x43d9('0xa')]){if(_0x56360f[_0x43d9('0xb')]===_0x43d9('0x8')){_0x56360f['abandoned']+=0x1;updateWaitingCounter(_0x56360f);}if(_0x56360f[_0x43d9('0xc')]){_0x56360f['answered']+=0x1;if(_0x56360f[_0x43d9('0x6')]){_0x56360f['talking']-=0x1;}}else{if(_0x56360f[_0x43d9('0xb')]){_0x56360f[_0x43d9('0xd')]+=0x1;updateWaitingCounter(_0x56360f);}}}else{if(!_0x56360f[_0x43d9('0xc')]){_0x56360f['waiting']+=0x1;}if(_0x56360f['UserId']){_0x56360f['talking']+=0x1;updateWaitingCounter(_0x56360f);}}_0x56360f[_0x43d9('0x9')]+=0x1;return _0x56360f;}function getLastMessageText(_0x59fd9b){return db[_0x43d9('0xe')][_0x43d9('0xf')]({'where':{'$and':[{'MailInteractionId':_0x59fd9b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x43d9('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x43d9('0x11'),'raw':!![]})['then'](function(_0x3e57cd){if(_0x3e57cd&&_0x3e57cd[_0x43d9('0x12')]){_0x59fd9b[_0x43d9('0x13')]=_['trimStart'](_0x3e57cd[_0x43d9('0x12')]);}return _0x59fd9b;})[_0x43d9('0x14')](function(_0x3f7c8d){throw _0x3f7c8d;});}exports[_0x43d9('0x15')]=function(_0x1df832,_0x3f8ab,_0x40259,_0x5e334b){return new Promise(function(_0xb91af3,_0x76aecb){return getInteractionUsers(_0x1df832['id'],_0x40259)[_0x43d9('0x16')](function(_0x2a69c4){_0x1df832[_0x43d9('0x17')]=_0x2a69c4;return getInteractionTags(_0x1df832[_0x43d9('0x18')],_0x3f8ab);})['then'](function(_0x515cb4){_0x1df832[_0x43d9('0x19')]=_0x515cb4;delete _0x1df832[_0x43d9('0x18')];return updateInteractionCounters(_0x1df832);})['then'](function(_0x3c8770){if(_0x5e334b){return getLastMessageText(_0x3c8770);}else{return _0x3c8770;}})['then'](function(_0xfb2af5){_0xb91af3(_0xfb2af5);})[_0x43d9('0x14')](function(_0x4b269d){_0x76aecb(_0x4b269d);});});}; \ No newline at end of file +var _0x62f1=['then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','plainBody'];(function(_0x38ff4d,_0x6ef55b){var _0x2e5488=function(_0xd5f321){while(--_0xd5f321){_0x38ff4d['push'](_0x38ff4d['shift']());}};_0x2e5488(++_0x6ef55b);}(_0x62f1,0x131));var _0x162f=function(_0x31a137,_0x45d1a5){_0x31a137=_0x31a137-0x0;var _0x1e8017=_0x62f1[_0x31a137];return _0x1e8017;};'use strict';var _=require(_0x162f('0x0'));var db=require(_0x162f('0x1'))['db'];function getInteractionUsers(_0x3392e6,_0x5bf141){return new Promise(function(_0x53e5c2,_0x1642d8){try{var _0x56e697=[];if(_0x5bf141[_0x3392e6]){_0x56e697=_0x5bf141[_0x3392e6][_0x162f('0x2')](function(_0x7d7202){return{'id':_0x7d7202['id'],'fullname':_0x7d7202['fullname']};});}return _0x53e5c2(_0x56e697);}catch(_0x5437c0){_0x1642d8(_0x5437c0);}});}function getInteractionTags(_0x3fe838,_0x242ee6){var _0x1a2cde=[];if(_0x3fe838){_0x3fe838[_0x162f('0x3')](',')[_0x162f('0x4')](function(_0x70c948){_0x1a2cde[_0x162f('0x5')](_0x242ee6[_0x70c948]);});}return _0x1a2cde;}function updateWaitingCounter(_0x196e99){if(_0x196e99[_0x162f('0x6')]){_0x196e99['waiting']-=0x1;}}function updateInteractionCounters(_0xe54136){_0xe54136[_0x162f('0x6')]=0x0;_0xe54136[_0x162f('0x7')]=0x0;_0xe54136[_0x162f('0x8')]=0x0;_0xe54136[_0x162f('0x9')]=0x0;_0xe54136[_0x162f('0xa')]=0x0;_0xe54136[_0x162f('0xb')]=0x0;if(_0xe54136[_0x162f('0xc')]){if(_0xe54136[_0x162f('0xd')]===_0x162f('0xa')){_0xe54136[_0x162f('0xa')]+=0x1;updateWaitingCounter(_0xe54136);}if(_0xe54136[_0x162f('0xe')]){_0xe54136['answered']+=0x1;if(_0xe54136[_0x162f('0x7')]){_0xe54136[_0x162f('0x7')]-=0x1;}}else{if(_0xe54136['disposition']){_0xe54136['unmanaged']+=0x1;updateWaitingCounter(_0xe54136);}}}else{if(!_0xe54136[_0x162f('0xe')]){_0xe54136[_0x162f('0x6')]+=0x1;}if(_0xe54136[_0x162f('0xe')]){_0xe54136['talking']+=0x1;updateWaitingCounter(_0xe54136);}}_0xe54136[_0x162f('0xb')]+=0x1;return _0xe54136;}function getLastMessageText(_0x163c0d){return db[_0x162f('0xf')][_0x162f('0x10')]({'where':{'$and':[{'MailInteractionId':_0x163c0d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x162f('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x162f('0x12')],'order':'-id','raw':!![]})[_0x162f('0x13')](function(_0x520697){if(_0x520697&&_0x520697[_0x162f('0x12')]){_0x163c0d[_0x162f('0x14')]=_[_0x162f('0x15')](_0x520697['plainBody']);}return _0x163c0d;})[_0x162f('0x16')](function(_0xf6a448){throw _0xf6a448;});}exports[_0x162f('0x17')]=function(_0x4087ab,_0x42e4f1,_0x27cdb5,_0x7d0877){return new Promise(function(_0x41caa9,_0xb2bbee){return getInteractionUsers(_0x4087ab['id'],_0x27cdb5)[_0x162f('0x13')](function(_0x31eea7){_0x4087ab[_0x162f('0x18')]=_0x31eea7;return getInteractionTags(_0x4087ab[_0x162f('0x19')],_0x42e4f1);})[_0x162f('0x13')](function(_0x45c557){_0x4087ab[_0x162f('0x1a')]=_0x45c557;delete _0x4087ab['TagIds'];return updateInteractionCounters(_0x4087ab);})[_0x162f('0x13')](function(_0x37832b){if(_0x7d0877){return getLastMessageText(_0x37832b);}else{return _0x37832b;}})[_0x162f('0x13')](function(_0x11c68d){_0x41caa9(_0x11c68d);})[_0x162f('0x16')](function(_0x632f8c){_0xb2bbee(_0x632f8c);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 123bb44..ba4317d 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6c3=['error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','upperFirst','InteractionId','unknown','_interactions','_interaction_has_tags','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','catch'];(function(_0x360dc2,_0x843dd0){var _0x32817d=function(_0x427143){while(--_0x427143){_0x360dc2['push'](_0x360dc2['shift']());}};_0x32817d(++_0x843dd0);}(_0xa6c3,0x93));var _0x3a6c=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xa6c3[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require(_0x3a6c('0x0'));var db=require(_0x3a6c('0x1'))['db'];var loggers={'openchannel':require(_0x3a6c('0x2'))(_0x3a6c('0x3')),'mail':require(_0x3a6c('0x2'))('mail-interactions'),'fax':require(_0x3a6c('0x2'))(_0x3a6c('0x4')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x3a6c('0x2'))(_0x3a6c('0x5')),'whatsapp':require(_0x3a6c('0x2'))(_0x3a6c('0x6'))};function getAccountFK(_0xe39d0f){return _[_0x3a6c('0x7')](_0xe39d0f)+(_0xe39d0f===_0x3a6c('0x8')?_0x3a6c('0x9'):'Account')+'Id';}function getInteractionFK(_0x5364be){return _[_0x3a6c('0x7')](_0x5364be)+'InteractionId';}function getInteractionId(_0x1b99c5,_0x1fb8c9,_0xe95e15){if(_0x1b99c5&&_0x1b99c5[_[_0x3a6c('0xa')](_0xe95e15)+_0x3a6c('0xb')]){return _0x1b99c5[_[_0x3a6c('0xa')](_0xe95e15)+'InteractionId'];}else if(_0x1b99c5&&_0x1b99c5['id']){return _0x1b99c5['id'];}else if(_0x1fb8c9&&_0x1fb8c9['id']){return _0x1fb8c9['id'];}else{return _0x3a6c('0xc');}}function getInteractionsTables(_0x419215){return{'accounts':_0x419215+'_'+(_0x419215===_0x3a6c('0x8')?'websites':'accounts'),'interactions':_0x419215+_0x3a6c('0xd'),'interactionsTags':_0x419215+_0x3a6c('0xe'),'messages':_0x419215+_0x3a6c('0xf'),'userInteractions':'user_has_'+_0x419215+_0x3a6c('0xd')};}function getSelectedTags(_0x43af57){var _0x155e58=[];if(_0x43af57){_0x155e58=Array['isArray'](_0x43af57)?_0x43af57:[_0x43af57];}return _0x155e58;}function log(_0x243307,_0x169fa9,_0x84f444,_0x418841,_0x313051,_0x162a98){loggers[_0x313051[_0x3a6c('0x10')]()][_0x243307](_0x3a6c('0x11'),_0x162a98[_0x3a6c('0x12')](),_0x169fa9?_0x169fa9['id']:null,_0x169fa9?_0x169fa9[_0x3a6c('0x13')]:null,_0x169fa9?_0x169fa9[_0x3a6c('0x14')]:null,getInteractionId(_0x84f444,_0x418841,_0x313051),_0x84f444?JSON[_0x3a6c('0x15')](_0x84f444):_0x3a6c('0x16'));}function updateUser(_0x2dc69a,_0x126637,_0x49d48d,_0x323556,_0xf7d75e){db[_[_0x3a6c('0xa')](_0x323556)+_0x3a6c('0x17')][_0x3a6c('0x18')]({'where':{'id':getInteractionId(_0x126637,_0x49d48d,_0x323556)}})[_0x3a6c('0x19')](function(_0x1f04d1){if(_0x1f04d1){return _0x1f04d1['update']({'UserId':_0x2dc69a?_0x2dc69a['id']:null});}})[_0x3a6c('0x19')](function(_0x27a69f){if(_0x27a69f){log('info',_0x2dc69a,_0x126637,_0x49d48d,_0x323556,_0xf7d75e);}})[_0x3a6c('0x1a')](function(){log(_0x3a6c('0x1b'),_0x2dc69a,_0x126637,_0x49d48d,_0x323556,_0xf7d75e);});}module[_0x3a6c('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x6bdf=['lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','then','info','catch','error','exports'];(function(_0x178740,_0x1bf75d){var _0x4aa7bd=function(_0x47df96){while(--_0x47df96){_0x178740['push'](_0x178740['shift']());}};_0x4aa7bd(++_0x1bf75d);}(_0x6bdf,0x88));var _0xf6bd=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x6bdf[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0xf6bd('0x0'));var db=require(_0xf6bd('0x1'))['db'];var loggers={'openchannel':require(_0xf6bd('0x2'))(_0xf6bd('0x3')),'mail':require(_0xf6bd('0x2'))(_0xf6bd('0x4')),'fax':require(_0xf6bd('0x2'))(_0xf6bd('0x5')),'sms':require(_0xf6bd('0x2'))(_0xf6bd('0x6')),'chat':require('../../config/logger')(_0xf6bd('0x7')),'whatsapp':require('../../config/logger')(_0xf6bd('0x8'))};function getAccountFK(_0x21d8ba){return _[_0xf6bd('0x9')](_0x21d8ba)+(_0x21d8ba===_0xf6bd('0xa')?'Website':_0xf6bd('0xb'))+'Id';}function getInteractionFK(_0x44c73b){return _[_0xf6bd('0x9')](_0x44c73b)+_0xf6bd('0xc');}function getInteractionId(_0x5c10b8,_0x3a9a37,_0x47da0c){if(_0x5c10b8&&_0x5c10b8[_[_0xf6bd('0xd')](_0x47da0c)+_0xf6bd('0xc')]){return _0x5c10b8[_[_0xf6bd('0xd')](_0x47da0c)+'InteractionId'];}else if(_0x5c10b8&&_0x5c10b8['id']){return _0x5c10b8['id'];}else if(_0x3a9a37&&_0x3a9a37['id']){return _0x3a9a37['id'];}else{return _0xf6bd('0xe');}}function getInteractionsTables(_0x29ddfe){return{'accounts':_0x29ddfe+'_'+(_0x29ddfe===_0xf6bd('0xa')?_0xf6bd('0xf'):_0xf6bd('0x10')),'interactions':_0x29ddfe+'_interactions','interactionsTags':_0x29ddfe+_0xf6bd('0x11'),'messages':_0x29ddfe+_0xf6bd('0x12'),'userInteractions':_0xf6bd('0x13')+_0x29ddfe+_0xf6bd('0x14')};}function getSelectedTags(_0x342009){var _0x34868e=[];if(_0x342009){_0x34868e=Array[_0xf6bd('0x15')](_0x342009)?_0x342009:[_0x342009];}return _0x34868e;}function log(_0x1ea60d,_0x3559ed,_0x1a7d59,_0x1effb0,_0x5edf99,_0x10acbc){loggers[_0x5edf99[_0xf6bd('0x16')]()][_0x1ea60d](_0xf6bd('0x17'),_0x10acbc['toUpperCase'](),_0x3559ed?_0x3559ed['id']:null,_0x3559ed?_0x3559ed[_0xf6bd('0x18')]:null,_0x3559ed?_0x3559ed[_0xf6bd('0x19')]:null,getInteractionId(_0x1a7d59,_0x1effb0,_0x5edf99),_0x1a7d59?JSON[_0xf6bd('0x1a')](_0x1a7d59):_0xf6bd('0x1b'));}function updateUser(_0x54a5bf,_0x48ce26,_0x2d97a5,_0x3479b2,_0x5761ab){db[_[_0xf6bd('0xd')](_0x3479b2)+_0xf6bd('0x1c')]['findOne']({'where':{'id':getInteractionId(_0x48ce26,_0x2d97a5,_0x3479b2)}})[_0xf6bd('0x1d')](function(_0x2045d3){if(_0x2045d3){return _0x2045d3['update']({'UserId':_0x54a5bf?_0x54a5bf['id']:null});}})[_0xf6bd('0x1d')](function(_0x1effcd){if(_0x1effcd){log(_0xf6bd('0x1e'),_0x54a5bf,_0x48ce26,_0x2d97a5,_0x3479b2,_0x5761ab);}})[_0xf6bd('0x1f')](function(){log(_0xf6bd('0x20'),_0x54a5bf,_0x48ce26,_0x2d97a5,_0x3479b2,_0x5761ab);});}module[_0xf6bd('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 88b7815..7e72def 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 _0x5ed8=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','isUserLimit','crypto','composable-middleware','../../config/environment','data1','license','split','createDecipher','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','format'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x5ed8,0xc5));var _0x85ed=function(_0x322719,_0x16b381){_0x322719=_0x322719-0x0;var _0x30cb6f=_0x5ed8[_0x322719];return _0x30cb6f;};'use strict';var crypto=require(_0x85ed('0x0'));var util=require('util');var compose=require(_0x85ed('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x85ed('0x2'));function getValueFromLicense(_0x4cb055,_0x19fd53){if(_0x4cb055&&_0x19fd53){if(_0x19fd53[_0x85ed('0x3')]&&_0x19fd53[_0x85ed('0x4')]){var _0x28f4c8=_0x19fd53['data1'];var _0x1c7019=_0x19fd53[_0x85ed('0x4')];var _0x38b25e=_0x28f4c8[_0x85ed('0x5')]('-')[0x4];var _0x116ee8=_0x28f4c8[_0x85ed('0x5')]('-')[0x0];var _0x3fc568=crypto[_0x85ed('0x6')]('aes-256-ctr',util['format']('%s:%s:%s',_0x38b25e,_0x28f4c8,_0x116ee8));var _0x54da5e=_0x3fc568['update'](_0x1c7019,'base64',_0x85ed('0x7'));_0x54da5e+=_0x3fc568[_0x85ed('0x8')](_0x85ed('0x7'));var _0x3ebcfa=JSON[_0x85ed('0x9')](_0x54da5e);return _0x3ebcfa[_0x85ed('0xa')](_0x4cb055)?_0x3ebcfa[_0x4cb055]:null;}}return null;}function isLimit(_0x2bf893,_0x190e36,_0x137bd9,_0x4e44d9){var _0x39b6d4=_0x190e36;return compose()[_0x85ed('0xb')](function(_0x4b43f1,_0x2a178d,_0x4e8043){return db[_0x85ed('0xc')][_0x85ed('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x85ed('0xe')](function(_0x245dec){var _0x28c2a6=getValueFromLicense(_0x2bf893,_0x245dec);return _0x28c2a6?_0x28c2a6:_0x39b6d4;})['then'](function(_0x11133d){_0x39b6d4=_0x11133d;return _0x137bd9[_0x85ed('0xf')](_0x4e44d9);})[_0x85ed('0xe')](function(_0x142b27){if(_0x142b27>=_0x39b6d4){return _0x2a178d[_0x85ed('0x10')](0x193)[_0x85ed('0x11')]({'message':util[_0x85ed('0x12')](_0x85ed('0x13'),_0x2bf893)});}_0x4e8043();})[_0x85ed('0x14')](function(_0x43c426){_0x4e8043(_0x43c426);});});}function isUserLimit(){return isLimit(_0x85ed('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x85ed('0x16')}]}});}exports[_0x85ed('0x17')]=isUserLimit; \ No newline at end of file +var _0xdeb7=['License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xdeb7,0xb1));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var crypto=require(_0x7deb('0x0'));var util=require(_0x7deb('0x1'));var compose=require(_0x7deb('0x2'));var db=require(_0x7deb('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x934a19,_0x3cae79){if(_0x934a19&&_0x3cae79){if(_0x3cae79[_0x7deb('0x4')]&&_0x3cae79[_0x7deb('0x5')]){var _0x40cf4a=_0x3cae79['data1'];var _0x2c4360=_0x3cae79[_0x7deb('0x5')];var _0x407c52=_0x40cf4a['split']('-')[0x4];var _0x3b8b87=_0x40cf4a['split']('-')[0x0];var _0x56baf4=crypto['createDecipher'](_0x7deb('0x6'),util[_0x7deb('0x7')](_0x7deb('0x8'),_0x407c52,_0x40cf4a,_0x3b8b87));var _0x4e33b7=_0x56baf4['update'](_0x2c4360,_0x7deb('0x9'),_0x7deb('0xa'));_0x4e33b7+=_0x56baf4[_0x7deb('0xb')](_0x7deb('0xa'));var _0x58d5fd=JSON[_0x7deb('0xc')](_0x4e33b7);return _0x58d5fd[_0x7deb('0xd')](_0x934a19)?_0x58d5fd[_0x934a19]:null;}}return null;}function isLimit(_0x3ddb52,_0x27fa3f,_0x2b3b6d,_0x3ff2c0){var _0x545058=_0x27fa3f;return compose()[_0x7deb('0xe')](function(_0x44c12e,_0x3120fb,_0x4a42f5){return db[_0x7deb('0xf')][_0x7deb('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0xb53842){var _0xd40575=getValueFromLicense(_0x3ddb52,_0xb53842);return _0xd40575?_0xd40575:_0x545058;})[_0x7deb('0x11')](function(_0xaf069e){_0x545058=_0xaf069e;return _0x2b3b6d['count'](_0x3ff2c0);})[_0x7deb('0x11')](function(_0x1042b5){if(_0x1042b5>=_0x545058){return _0x3120fb[_0x7deb('0x12')](0x193)[_0x7deb('0x13')]({'message':util[_0x7deb('0x7')](_0x7deb('0x14'),_0x3ddb52)});}_0x4a42f5();})['catch'](function(_0x3f40ca){_0x4a42f5(_0x3f40ca);});});}function isUserLimit(){return isLimit(_0x7deb('0x15'),0x1,db[_0x7deb('0x16')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x7deb('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 103e1dc..4e8c7cf 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 _0xb76b=['and','replace','[$and]','length','split','slice','forEach','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','[$or]'];(function(_0x2a20f3,_0x4ef039){var _0x492068=function(_0x143ba6){while(--_0x143ba6){_0x2a20f3['push'](_0x2a20f3['shift']());}};_0x492068(++_0x4ef039);}(_0xb76b,0x17c));var _0xbb76=function(_0x50432d,_0x8d5dbb){_0x50432d=_0x50432d-0x0;var _0x20d1ce=_0xb76b[_0x50432d];return _0x20d1ce;};'use strict';var _=require(_0xbb76('0x0'));var moment=require(_0xbb76('0x1'));exports[_0xbb76('0x2')]=function(_0x2250c7){var _0x1db2f3={'conditions':[]};_0x1db2f3[_0xbb76('0x3')]=_['startsWith'](_0x2250c7,_0xbb76('0x4'))?'or':_0xbb76('0x5');var _0x5eb913=_0x2250c7[_0xbb76('0x6')](_0xbb76('0x7'),'')[_0xbb76('0x6')](_0xbb76('0x4'),'')['split']('||');for(var _0x3c202d=0x0;_0x3c202d<_0x5eb913[_0xbb76('0x8')];_0x3c202d++){var _0x512ed6=_0x5eb913[_0x3c202d][_0xbb76('0x9')](':=');var _0x355acc=_0x512ed6[0x0];var _0x4c90f3=_0x512ed6[_0xbb76('0xa')](0x1);_0x4c90f3['forEach'](function(_0x437fea){var _0x43c6cf=_0x437fea[_0xbb76('0x9')]('[')['shift']();var _0x250ffa=_0x437fea['match'](/\[(.*?)\]/g);_0x250ffa[_0xbb76('0xb')](function(_0x538234){var _0x16d407=_0x538234[_0xbb76('0x9')]('[')[_0xbb76('0xc')](function(_0x1c81f0){return _0x1c81f0[_0xbb76('0xd')](']')>-0x1;})['map'](function(_0x4e7390){return _0x4e7390[_0xbb76('0x9')](']')[0x0];})[0x0];_0x1db2f3[_0xbb76('0xe')][_0xbb76('0xf')]({'field':_0x355acc,'operator':_0x43c6cf,'value':_0x16d407});});});}return _0x1db2f3;};exports[_0xbb76('0x10')]=function(_0x305037,_0x324fb7,_0x4740ef){var _0x53c076={};if(_0x324fb7===_0xbb76('0x11')){if(_0x4740ef[_0xbb76('0x12')]===_0xbb76('0x13')){_0x4740ef[_0xbb76('0x12')]='$between';_0x4740ef[_0xbb76('0x14')]+=','+_0x4740ef[_0xbb76('0x14')];}else if(_[_0xbb76('0x15')]([_0xbb76('0x16'),_0xbb76('0x17')],_0x4740ef[_0xbb76('0x12')])){_0x4740ef['value']=moment(_0x4740ef['value'])[_0xbb76('0x18')](0x1,_0xbb76('0x19'))[_0xbb76('0x1a')]('YYYY-MM-DD');}}if(_0x4740ef[_0xbb76('0x1b')]){_0x324fb7=_0x4740ef[_0xbb76('0x1b')];_0x53c076[_0xbb76('0x1c')]=_0xbb76('0x1d')+_0x305037+'.'+_0x4740ef[_0xbb76('0x1e')]+_0xbb76('0x1f')+_0x4740ef['castTo']+')\x20'+parseOperator(_0x4740ef[_0xbb76('0x12')]);}else{_0x53c076['text']=_0x305037+'.'+_0x4740ef[_0xbb76('0x1e')]+'\x20'+parseOperator(_0x4740ef[_0xbb76('0x12')]);}if(_[_0xbb76('0x15')]([_0xbb76('0x20'),_0xbb76('0x21')],_0x4740ef[_0xbb76('0x12')]))_0x53c076[_0xbb76('0x1c')]='('+_0x53c076['text']+_0xbb76('0x22')+_0x305037+'.'+_0x4740ef[_0xbb76('0x1e')]+'\x20IS\x20NULL)';_0x53c076[_0xbb76('0x14')]=parseValue(_0x324fb7,_0x4740ef[_0xbb76('0x12')],_0x4740ef['value']);return _0x53c076;};function parseOperator(_0x443b4a){var _0x35b177;switch(_0x443b4a){case _0xbb76('0x23'):_0x35b177=_0xbb76('0x24');break;case _0xbb76('0x21'):_0x35b177=_0xbb76('0x25');break;case _0xbb76('0x13'):_0x35b177=_0xbb76('0x26');break;case'$ne':_0x35b177='<>\x20?';break;case _0xbb76('0x27'):case _0xbb76('0x28'):case _0xbb76('0x29'):_0x35b177=_0xbb76('0x2a');break;case'$lt':_0x35b177=_0xbb76('0x2b');break;case _0xbb76('0x16'):_0x35b177=_0xbb76('0x2c');break;case _0xbb76('0x17'):_0x35b177=_0xbb76('0x2d');break;case _0xbb76('0x2e'):_0x35b177=_0xbb76('0x2f');break;case _0xbb76('0x30'):_0x35b177=_0xbb76('0x31');break;}return _0x35b177;}function parseValue(_0x23f486,_0x648483,_0x488f62){var _0x215874={'start':undefined,'end':undefined};switch(_0x648483){case _0xbb76('0x23'):case _0xbb76('0x21'):_0x215874[_0xbb76('0x32')]=_0x488f62[_0xbb76('0x9')](',');break;case _0xbb76('0x27'):_0x215874[_0xbb76('0x32')]='%'+_0x488f62+'%';break;case _0xbb76('0x28'):_0x215874['start']=_0x488f62+'%';break;case _0xbb76('0x29'):_0x215874[_0xbb76('0x32')]='%'+_0x488f62;break;case _0xbb76('0x30'):var _0x1c4580=_0x488f62[_0xbb76('0x9')](',');var _0x488f62=_0x1c4580[_0xbb76('0x33')]();var _0x37adee=_0x1c4580['pop']();if(_0x23f486===_0xbb76('0x11')){_0x488f62=moment(_0x488f62)['utcOffset'](0x0,!![])[_0xbb76('0x1a')]();_0x37adee=moment(_0x37adee)[_0xbb76('0x34')](0x0,!![])[_0xbb76('0x18')](0x17,_0xbb76('0x35'))[_0xbb76('0x18')](0x3b,_0xbb76('0x36'))[_0xbb76('0x18')](0x3b,'seconds')['format']();}_0x215874={'start':_0x488f62,'end':_0x37adee};break;default:_0x215874[_0xbb76('0x32')]=_0x488f62;break;}return _0x215874;} \ No newline at end of file +var _0xf738=['$gte','BETWEEN\x20?\x20AND\x20?','start','$between','shift','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','length','split','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','$eq','operator','value','$gt','$lte','days','YYYY-MM-DD','castTo','text','field','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','$notIn','=\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','<=\x20?'];(function(_0x4391aa,_0x45396c){var _0x1dbef1=function(_0x102854){while(--_0x102854){_0x4391aa['push'](_0x4391aa['shift']());}};_0x1dbef1(++_0x45396c);}(_0xf738,0x10a));var _0x8f73=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xf738[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x8f73('0x0'));var moment=require(_0x8f73('0x1'));exports[_0x8f73('0x2')]=function(_0x12aba7){var _0x482e49={'conditions':[]};_0x482e49[_0x8f73('0x3')]=_['startsWith'](_0x12aba7,_0x8f73('0x4'))?'or':_0x8f73('0x5');var _0x51938d=_0x12aba7['replace']('[$and]','')[_0x8f73('0x6')](_0x8f73('0x4'),'')['split']('||');for(var _0x19ea46=0x0;_0x19ea46<_0x51938d[_0x8f73('0x7')];_0x19ea46++){var _0x5d74d1=_0x51938d[_0x19ea46][_0x8f73('0x8')](':=');var _0x54bfb5=_0x5d74d1[0x0];var _0x5a1710=_0x5d74d1['slice'](0x1);_0x5a1710[_0x8f73('0x9')](function(_0x113929){var _0x35420b=_0x113929[_0x8f73('0x8')]('[')['shift']();var _0x42f538=_0x113929[_0x8f73('0xa')](/\[(.*?)\]/g);_0x42f538[_0x8f73('0x9')](function(_0x17c879){var _0x32e241=_0x17c879['split']('[')[_0x8f73('0xb')](function(_0x1c4c0c){return _0x1c4c0c[_0x8f73('0xc')](']')>-0x1;})[_0x8f73('0xd')](function(_0x33c936){return _0x33c936[_0x8f73('0x8')](']')[0x0];})[0x0];_0x482e49[_0x8f73('0xe')][_0x8f73('0xf')]({'field':_0x54bfb5,'operator':_0x35420b,'value':_0x32e241});});});}return _0x482e49;};exports[_0x8f73('0x10')]=function(_0x16fd4c,_0x20f6a2,_0x145fd8){var _0x244682={};if(_0x20f6a2===_0x8f73('0x11')){if(_0x145fd8['operator']===_0x8f73('0x12')){_0x145fd8[_0x8f73('0x13')]='$between';_0x145fd8[_0x8f73('0x14')]+=','+_0x145fd8[_0x8f73('0x14')];}else if(_['includes']([_0x8f73('0x15'),_0x8f73('0x16')],_0x145fd8[_0x8f73('0x13')])){_0x145fd8[_0x8f73('0x14')]=moment(_0x145fd8[_0x8f73('0x14')])['add'](0x1,_0x8f73('0x17'))['format'](_0x8f73('0x18'));}}if(_0x145fd8[_0x8f73('0x19')]){_0x20f6a2=_0x145fd8[_0x8f73('0x19')];_0x244682[_0x8f73('0x1a')]='CAST('+_0x16fd4c+'.'+_0x145fd8[_0x8f73('0x1b')]+'\x20AS\x20'+_0x145fd8['castTo']+')\x20'+parseOperator(_0x145fd8['operator']);}else{_0x244682[_0x8f73('0x1a')]=_0x16fd4c+'.'+_0x145fd8[_0x8f73('0x1b')]+'\x20'+parseOperator(_0x145fd8[_0x8f73('0x13')]);}if(_['includes']([_0x8f73('0x1c'),'$notIn'],_0x145fd8['operator']))_0x244682[_0x8f73('0x1a')]='('+_0x244682['text']+_0x8f73('0x1d')+_0x16fd4c+'.'+_0x145fd8['field']+_0x8f73('0x1e');_0x244682[_0x8f73('0x14')]=parseValue(_0x20f6a2,_0x145fd8[_0x8f73('0x13')],_0x145fd8[_0x8f73('0x14')]);return _0x244682;};function parseOperator(_0x2600e4){var _0x331f97;switch(_0x2600e4){case _0x8f73('0x1f'):_0x331f97='IN\x20?';break;case _0x8f73('0x20'):_0x331f97='NOT\x20IN\x20?';break;case _0x8f73('0x12'):_0x331f97=_0x8f73('0x21');break;case _0x8f73('0x1c'):_0x331f97='<>\x20?';break;case _0x8f73('0x22'):case _0x8f73('0x23'):case'$endsWith':_0x331f97=_0x8f73('0x24');break;case _0x8f73('0x25'):_0x331f97=_0x8f73('0x26');break;case _0x8f73('0x15'):_0x331f97='>\x20?';break;case'$lte':_0x331f97=_0x8f73('0x27');break;case _0x8f73('0x28'):_0x331f97='>=\x20?';break;case'$between':_0x331f97=_0x8f73('0x29');break;}return _0x331f97;}function parseValue(_0x12f823,_0x30bf40,_0x4a642b){var _0x41edd2={'start':undefined,'end':undefined};switch(_0x30bf40){case _0x8f73('0x1f'):case _0x8f73('0x20'):_0x41edd2[_0x8f73('0x2a')]=_0x4a642b['split'](',');break;case'$substring':_0x41edd2['start']='%'+_0x4a642b+'%';break;case'$startsWith':_0x41edd2[_0x8f73('0x2a')]=_0x4a642b+'%';break;case'$endsWith':_0x41edd2['start']='%'+_0x4a642b;break;case _0x8f73('0x2b'):var _0x1a95c9=_0x4a642b[_0x8f73('0x8')](',');var _0x4a642b=_0x1a95c9[_0x8f73('0x2c')]();var _0x36e65c=_0x1a95c9[_0x8f73('0x2d')]();if(_0x12f823==='DATE'){_0x4a642b=moment(_0x4a642b)['utcOffset'](0x0,!![])['format']();_0x36e65c=moment(_0x36e65c)[_0x8f73('0x2e')](0x0,!![])[_0x8f73('0x2f')](0x17,_0x8f73('0x30'))[_0x8f73('0x2f')](0x3b,_0x8f73('0x31'))[_0x8f73('0x2f')](0x3b,_0x8f73('0x32'))['format']();}_0x41edd2={'start':_0x4a642b,'end':_0x36e65c};break;default:_0x41edd2[_0x8f73('0x2a')]=_0x4a642b;break;}return _0x41edd2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index aa5b994..b75617f 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 _0xa633=['forEach','replace','push','join','getOptions','query','$id','intersection','attributes','nolimit','order','sort','where','pick','filter','object','value','merge','type','VIRTUAL','lower','options','include','includeAll','lodash','../../mysqldb','keys','includes','parse','model','fields','raw','split','filters','forOwn','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','map','priority','col','unsigned','DESC','cast','ASC','omit','isEmpty','length','isObject','isString','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','{EXPR}'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xa633,0x15d));var _0x3a63=function(_0x31626b,_0x1c8197){_0x31626b=_0x31626b-0x0;var _0x30b96e=_0xa633[_0x31626b];return _0x30b96e;};'use strict';var _=require(_0x3a63('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require(_0x3a63('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x47b39e){var _0x529bef=['ne'];try{var _0x121a91=JSON['parse'](_0x47b39e);var _0x1d0884=Object[_0x3a63('0x2')](_0x121a91)[0x0];return _0x529bef[_0x3a63('0x3')](_0x1d0884);}catch(_0x3d4c94){return![];}}function getOperatorValue(_0x1315cb){var _0xc9221d=JSON[_0x3a63('0x4')](_0x1315cb);var _0x1f769d=Object['keys'](_0xc9221d)[0x0];var _0x574b7c=_0xc9221d[_0x1f769d];return{['$'+_0x1f769d]:_0x574b7c};}function parseIncludeModel(_0x77c6ff){var _0xa5b58d=JSON[_0x3a63('0x4')](_0x77c6ff);return{'model':db[_0xa5b58d[_0x3a63('0x5')]],'as':_0xa5b58d['alias'],'attributes':_0xa5b58d[_0x3a63('0x6')],'raw':_0xa5b58d[_0x3a63('0x7')]};}exports['fields']=function(_0x1511cc){var _0x595365=null;if(_0x1511cc){_0x595365=_0x1511cc[_0x3a63('0x8')](',');}return _0x595365;};exports[_0x3a63('0x9')]=function(_0x512d58,_0x537b93){var _0x118775={};if(!_['isEmpty'](_0x512d58)){_[_0x3a63('0xa')](_0x512d58,function(_0xa03c5a,_0x54e71b){try{if(_0x537b93){var _0x3c93df=_['find'](_0x537b93,{'name':_0x54e71b})||{};if(hasSequelizeOperator(_0xa03c5a)){_0x118775[_0x54e71b]=getOperatorValue(_0xa03c5a);}else if(_0x3c93df['type']==='DATE'&&_[_0x3a63('0xb')](_0xa03c5a)){var _0x19e7db=JSON[_0x3a63('0x4')](_0xa03c5a);var _0x5adaff={'$gte':moment(moment(_0x19e7db[_0x3a63('0xc')])[_0x3a63('0xd')](_0x3a63('0xe')))[_0x3a63('0xf')]()[_0x3a63('0xd')](),'$lte':moment(moment(_0x19e7db[_0x3a63('0x10')])[_0x3a63('0xd')]('YYYY-MM-DD'))[_0x3a63('0xf')]()[_0x3a63('0x11')](0x1,'s')[_0x3a63('0xd')]()};_0x118775[_0x54e71b]=_0x5adaff;}else if(_0x3c93df[_0x3a63('0x12')]===_0x3a63('0x13')){_0x118775[_0x54e71b]=_0xa03c5a;}else{_0x118775[_0x54e71b]=_[_0x3a63('0x14')](_0xa03c5a)?_0xa03c5a:JSON[_0x3a63('0x4')](_0xa03c5a);}}else{_0x118775[_0x54e71b]=_[_0x3a63('0x14')](_0xa03c5a)?_0xa03c5a:JSON[_0x3a63('0x4')](_0xa03c5a);}}catch(_0x3239df){_0x118775[_0x54e71b]=_0xa03c5a[_0x3a63('0x8')](',');}});}return _0x118775;};exports[_0x3a63('0x15')]=function(_0x32f8ee){_0x32f8ee=parseInt(_0x32f8ee,0xa);if(!_0x32f8ee||_0x32f8ee<0x0){_0x32f8ee=LIMIT_VALUE;}return _0x32f8ee;};exports[_0x3a63('0x16')]=function(_0x49eb08){_0x49eb08=parseInt(_0x49eb08,0xa);if(!_0x49eb08||_0x49eb08<0x0){_0x49eb08=0x0;}return _0x49eb08;};exports['sort']=function(_0x4c3566){var _0x560818,_0x514413=null;if(_0x4c3566){_0x560818=_0x4c3566[_0x3a63('0x8')](',');_0x514413=_[_0x3a63('0x17')](_0x560818,function(_0x3fa1fa){if(_0x3fa1fa['indexOf']('-')===0x0){return[_0x3fa1fa===_0x3a63('0x18')?sequelize['cast'](sequelize[_0x3a63('0x19')](_0x3a63('0x18')),_0x3a63('0x1a')):_0x3fa1fa['substr'](0x1),_0x3a63('0x1b')];}else{return[_0x3fa1fa===_0x3a63('0x18')?sequelize[_0x3a63('0x1c')](sequelize[_0x3a63('0x19')]('priority'),_0x3a63('0x1a')):_0x3fa1fa,_0x3a63('0x1d')];}});}return _0x514413;};exports[_0x3a63('0x1e')]=function(_0x477483,_0x219305){if(_[_0x3a63('0x1f')](_0x477483)){return _0x477483;}if(_[_0x3a63('0x14')](_0x477483)){for(var _0x402b45=0x0;_0x402b45<_0x477483[_0x3a63('0x20')];_0x402b45+=0x1){_0x477483[_0x402b45]=this[_0x3a63('0x1e')](_0x477483[_0x402b45],_0x219305);}return _0x477483;}if(!_[_0x3a63('0x21')](_0x477483)){return _0x477483;}if(_[_0x3a63('0x22')](_0x219305)){_0x219305=[_0x219305];}if(!_['isArray'](_0x219305)){return _0x477483;}for(var _0x4bde37=0x0;_0x4bde37<_0x219305[_0x3a63('0x20')];_0x4bde37+=0x1){_['unset'](_0x477483,_0x219305[_0x4bde37]);}for(var _0x48cee4 in _0x477483){if(_0x477483[_0x3a63('0x23')](_0x48cee4)){_0x477483[_0x48cee4]=this[_0x3a63('0x1e')](_0x477483[_0x48cee4],_0x219305);}}return _0x477483;};exports['isNumeric']=function(_0x1f58f1){return _0x1f58f1[_0x3a63('0x24')](RegExp(_0x3a63('0x25')))?!![]:![];};exports[_0x3a63('0x26')]=function(_0x164715){return _0x164715[_0x3a63('0x24')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x5f3c3d,_0x2c2c17){var _0x3782cc=[];var _0x1ea69a=/[ `!@#$%^&*()_\-?~]/;var _0x2b920f=_0x2c2c17?_0x3a63('0x27'):_0x3a63('0x28');_0x5f3c3d['split'](/[ ,]+/)[_0x3a63('0x29')](function(_0x756e8f){_0x756e8f=_0x756e8f[_0x3a63('0x2a')](/([^:]")"+/g,'$1');_0x756e8f='+'+_0x756e8f+'*';var _0x1da01e=_0x756e8f[_0x3a63('0x24')](_0x1ea69a);if(_0x1da01e){_0x756e8f='\x22'+_0x756e8f+'\x22';}_0x3782cc[_0x3a63('0x2b')](_0x756e8f);});_0x2b920f=_0x2b920f[_0x3a63('0x2a')](_0x3a63('0x28'),_0x3782cc[_0x3a63('0x2c')]('\x20'));return _0x2b920f;};exports[_0x3a63('0x2d')]=function(_0x2638b6,_0x794c38,_0x9e77f){var _0x237c38={},_0x4896ba={};if(_0x794c38[_0x3a63('0x2e')][_0x3a63('0x2f')]){_0x794c38['query']['id']=_0x794c38[_0x3a63('0x2e')][_0x3a63('0x2f')];delete _0x794c38[_0x3a63('0x2e')][_0x3a63('0x2f')];}_0x237c38[_0x3a63('0x5')]=_[_0x3a63('0x17')](_0x2638b6,'name');_0x237c38['query']=_[_0x3a63('0x2')](_0x794c38[_0x3a63('0x2e')]);_0x237c38[_0x3a63('0x9')]=_[_0x3a63('0x30')](_0x237c38[_0x3a63('0x5')],_0x237c38[_0x3a63('0x2e')]);_0x4896ba['attributes']=_['intersection'](_0x237c38[_0x3a63('0x5')],this['fields'](_0x794c38[_0x3a63('0x2e')][_0x3a63('0x6')]));_0x4896ba['attributes']=_0x4896ba[_0x3a63('0x31')][_0x3a63('0x20')]?_0x4896ba['attributes']:_0x237c38[_0x3a63('0x5')];if(!_0x794c38[_0x3a63('0x2e')][_0x3a63('0x23')](_0x3a63('0x32'))){_0x4896ba[_0x3a63('0x15')]=this[_0x3a63('0x15')](_0x794c38[_0x3a63('0x2e')][_0x3a63('0x15')]);_0x4896ba['offset']=this[_0x3a63('0x16')](_0x794c38[_0x3a63('0x2e')][_0x3a63('0x16')]);}_0x4896ba[_0x3a63('0x33')]=this[_0x3a63('0x34')](_0x794c38[_0x3a63('0x2e')][_0x3a63('0x34')]);_0x4896ba[_0x3a63('0x35')]=this['filters'](_[_0x3a63('0x36')](_0x794c38[_0x3a63('0x2e')],_0x237c38[_0x3a63('0x9')]),_0x2638b6);if(_0x794c38[_0x3a63('0x2e')][_0x3a63('0x37')]){var _0x307c4f=_0x2638b6;var _0xc76323=_0x794c38[_0x3a63('0x2e')][_0x3a63('0x37')];if(typeof _0xc76323===_0x3a63('0x38')){_0x307c4f=_['filter'](_0x2638b6,function(_0x4f00ae){return _[_0x3a63('0x3')](_0xc76323['columns'],_0x4f00ae[_0x3a63('0x12')]);});_0xc76323=_0xc76323[_0x3a63('0x39')];}_0x4896ba[_0x3a63('0x35')]=_[_0x3a63('0x3a')](_0x4896ba[_0x3a63('0x35')],{'$or':_[_0x3a63('0x17')](_0x307c4f,function(_0x3650d7){if(_0x3650d7[_0x3a63('0x3b')]!==_0x3a63('0x3c')){if(_0x9e77f){return sequelize[_0x3a63('0x35')](sequelize['fn'](_0x3a63('0x3d'),sequelize[_0x3a63('0x19')](_0x3650d7[_0x3a63('0x12')])),{'$like':sequelize['fn'](_0x3a63('0x3d'),'%'+_0x794c38['query'][_0x3a63('0x37')]+'%')});}else{var _0x31b774={};_0x31b774[_0x3650d7[_0x3a63('0x12')]]={'$like':'%'+_0x794c38[_0x3a63('0x2e')][_0x3a63('0x37')]+'%'};return _0x31b774;}}})});}_0x4896ba=_[_0x3a63('0x3a')]({},_0x4896ba,_0x794c38[_0x3a63('0x3e')]);return _0x4896ba;};exports[_0x3a63('0x3f')]=function(_0x4b5d35){var _0x51d3ee=[];if(_0x4b5d35[_0x3a63('0x40')]){_0x51d3ee[_0x3a63('0x2b')]({'all':!![]});}else if(_0x4b5d35[_0x3a63('0x3f')]){if(Array['isArray'](_0x4b5d35[_0x3a63('0x3f')])){_0x51d3ee=Object['keys'](_0x4b5d35[_0x3a63('0x3f')])[_0x3a63('0x17')](function(_0x505195){return parseIncludeModel(_0x4b5d35[_0x3a63('0x3f')][_0x505195]);});}else{var _0x4c22b7=parseIncludeModel(_0x4b5d35[_0x3a63('0x3f')]);_0x51d3ee[_0x3a63('0x2b')](_0x4c22b7);}}return _0x51d3ee;}; \ No newline at end of file +var _0x815b=['YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','match','isEmail','getFullTextValue','\x22{EXPR}\x22','push','{EXPR}','join','query','$id','intersection','attributes','hasOwnProperty','limit','order','filter','object','columns','value','where','VIRTUAL','lower','merge','options','include','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format'];(function(_0x43c07c,_0x27faf3){var _0x2534a9=function(_0x144b40){while(--_0x144b40){_0x43c07c['push'](_0x43c07c['shift']());}};_0x2534a9(++_0x27faf3);}(_0x815b,0xb4));var _0xb815=function(_0x32138c,_0x4090c5){_0x32138c=_0x32138c-0x0;var _0x20cec6=_0x815b[_0x32138c];return _0x20cec6;};'use strict';var _=require(_0xb815('0x0'));var sequelize=require(_0xb815('0x1'));var moment=require(_0xb815('0x2'));var db=require(_0xb815('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x6314c){var _0x592cd5=['ne'];try{var _0x1e70fa=JSON['parse'](_0x6314c);var _0x5b4516=Object[_0xb815('0x4')](_0x1e70fa)[0x0];return _0x592cd5[_0xb815('0x5')](_0x5b4516);}catch(_0x93c8e8){return![];}}function getOperatorValue(_0x5a5c18){var _0x466899=JSON[_0xb815('0x6')](_0x5a5c18);var _0x4930f6=Object[_0xb815('0x4')](_0x466899)[0x0];var _0x479b09=_0x466899[_0x4930f6];return{['$'+_0x4930f6]:_0x479b09};}function parseIncludeModel(_0x4d0873){var _0x1e626f=JSON[_0xb815('0x6')](_0x4d0873);return{'model':db[_0x1e626f[_0xb815('0x7')]],'as':_0x1e626f[_0xb815('0x8')],'attributes':_0x1e626f[_0xb815('0x9')],'raw':_0x1e626f[_0xb815('0xa')]};}exports[_0xb815('0x9')]=function(_0x205a49){var _0x50f5f0=null;if(_0x205a49){_0x50f5f0=_0x205a49[_0xb815('0xb')](',');}return _0x50f5f0;};exports[_0xb815('0xc')]=function(_0x22ed07,_0x3c9ebe){var _0x3753bb={};if(!_[_0xb815('0xd')](_0x22ed07)){_[_0xb815('0xe')](_0x22ed07,function(_0x5af22a,_0x5f360b){try{if(_0x3c9ebe){var _0x471ccc=_[_0xb815('0xf')](_0x3c9ebe,{'name':_0x5f360b})||{};if(hasSequelizeOperator(_0x5af22a)){_0x3753bb[_0x5f360b]=getOperatorValue(_0x5af22a);}else if(_0x471ccc[_0xb815('0x10')]===_0xb815('0x11')&&_[_0xb815('0x12')](_0x5af22a)){var _0x1d130f=JSON[_0xb815('0x6')](_0x5af22a);var _0x4636c7={'$gte':moment(moment(_0x1d130f[_0xb815('0x13')])[_0xb815('0x14')](_0xb815('0x15')))[_0xb815('0x16')]()[_0xb815('0x14')](),'$lte':moment(moment(_0x1d130f['$lte'])['format'](_0xb815('0x15')))[_0xb815('0x16')]()[_0xb815('0x17')](0x1,'s')[_0xb815('0x14')]()};_0x3753bb[_0x5f360b]=_0x4636c7;}else if(_0x471ccc[_0xb815('0x18')]===_0xb815('0x19')){_0x3753bb[_0x5f360b]=_0x5af22a;}else{_0x3753bb[_0x5f360b]=_[_0xb815('0x1a')](_0x5af22a)?_0x5af22a:JSON[_0xb815('0x6')](_0x5af22a);}}else{_0x3753bb[_0x5f360b]=_[_0xb815('0x1a')](_0x5af22a)?_0x5af22a:JSON['parse'](_0x5af22a);}}catch(_0x5bdcbc){_0x3753bb[_0x5f360b]=_0x5af22a[_0xb815('0xb')](',');}});}return _0x3753bb;};exports['limit']=function(_0x261b8d){_0x261b8d=parseInt(_0x261b8d,0xa);if(!_0x261b8d||_0x261b8d<0x0){_0x261b8d=LIMIT_VALUE;}return _0x261b8d;};exports[_0xb815('0x1b')]=function(_0x1343f8){_0x1343f8=parseInt(_0x1343f8,0xa);if(!_0x1343f8||_0x1343f8<0x0){_0x1343f8=0x0;}return _0x1343f8;};exports[_0xb815('0x1c')]=function(_0x4a1650){var _0x25d246,_0x3c787e=null;if(_0x4a1650){_0x25d246=_0x4a1650['split'](',');_0x3c787e=_[_0xb815('0x1d')](_0x25d246,function(_0x26e7d9){if(_0x26e7d9[_0xb815('0x1e')]('-')===0x0){return[_0x26e7d9===_0xb815('0x1f')?sequelize[_0xb815('0x20')](sequelize[_0xb815('0x21')](_0xb815('0x1f')),_0xb815('0x22')):_0x26e7d9[_0xb815('0x23')](0x1),_0xb815('0x24')];}else{return[_0x26e7d9===_0xb815('0x1f')?sequelize[_0xb815('0x20')](sequelize['col'](_0xb815('0x1f')),_0xb815('0x22')):_0x26e7d9,_0xb815('0x25')];}});}return _0x3c787e;};exports[_0xb815('0x26')]=function(_0x5f2eaf,_0x22f594){if(_[_0xb815('0xd')](_0x5f2eaf)){return _0x5f2eaf;}if(_[_0xb815('0x1a')](_0x5f2eaf)){for(var _0x4d014a=0x0;_0x4d014a<_0x5f2eaf[_0xb815('0x27')];_0x4d014a+=0x1){_0x5f2eaf[_0x4d014a]=this[_0xb815('0x26')](_0x5f2eaf[_0x4d014a],_0x22f594);}return _0x5f2eaf;}if(!_[_0xb815('0x28')](_0x5f2eaf)){return _0x5f2eaf;}if(_[_0xb815('0x29')](_0x22f594)){_0x22f594=[_0x22f594];}if(!_[_0xb815('0x1a')](_0x22f594)){return _0x5f2eaf;}for(var _0x3b0152=0x0;_0x3b0152<_0x22f594[_0xb815('0x27')];_0x3b0152+=0x1){_[_0xb815('0x2a')](_0x5f2eaf,_0x22f594[_0x3b0152]);}for(var _0x46c545 in _0x5f2eaf){if(_0x5f2eaf['hasOwnProperty'](_0x46c545)){_0x5f2eaf[_0x46c545]=this['omit'](_0x5f2eaf[_0x46c545],_0x22f594);}}return _0x5f2eaf;};exports['isNumeric']=function(_0x45b5e5){return _0x45b5e5[_0xb815('0x2b')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xb815('0x2c')]=function(_0x403276){return _0x403276[_0xb815('0x2b')](/^\S+@\S+$/)?!![]:![];};exports[_0xb815('0x2d')]=function(_0x5973c7,_0x3f9c60){var _0x17da68=[];var _0x4e2823=/[ `!@#$%^&*()_\-?~]/;var _0x51d053=_0x3f9c60?_0xb815('0x2e'):'{EXPR}';_0x5973c7[_0xb815('0xb')](/[ ,]+/)['forEach'](function(_0x6573cd){_0x6573cd=_0x6573cd['replace'](/([^:]")"+/g,'$1');_0x6573cd='+'+_0x6573cd+'*';var _0xa7b669=_0x6573cd[_0xb815('0x2b')](_0x4e2823);if(_0xa7b669){_0x6573cd='\x22'+_0x6573cd+'\x22';}_0x17da68[_0xb815('0x2f')](_0x6573cd);});_0x51d053=_0x51d053['replace'](_0xb815('0x30'),_0x17da68[_0xb815('0x31')]('\x20'));return _0x51d053;};exports['getOptions']=function(_0x441b5a,_0x19848c,_0x29ecee){var _0x131210={},_0x1c2ca6={};if(_0x19848c[_0xb815('0x32')]['$id']){_0x19848c[_0xb815('0x32')]['id']=_0x19848c[_0xb815('0x32')][_0xb815('0x33')];delete _0x19848c[_0xb815('0x32')][_0xb815('0x33')];}_0x131210['model']=_['map'](_0x441b5a,'name');_0x131210[_0xb815('0x32')]=_['keys'](_0x19848c[_0xb815('0x32')]);_0x131210[_0xb815('0xc')]=_[_0xb815('0x34')](_0x131210[_0xb815('0x7')],_0x131210[_0xb815('0x32')]);_0x1c2ca6[_0xb815('0x35')]=_[_0xb815('0x34')](_0x131210[_0xb815('0x7')],this[_0xb815('0x9')](_0x19848c[_0xb815('0x32')][_0xb815('0x9')]));_0x1c2ca6[_0xb815('0x35')]=_0x1c2ca6[_0xb815('0x35')][_0xb815('0x27')]?_0x1c2ca6[_0xb815('0x35')]:_0x131210[_0xb815('0x7')];if(!_0x19848c[_0xb815('0x32')][_0xb815('0x36')]('nolimit')){_0x1c2ca6['limit']=this['limit'](_0x19848c[_0xb815('0x32')][_0xb815('0x37')]);_0x1c2ca6['offset']=this[_0xb815('0x1b')](_0x19848c[_0xb815('0x32')][_0xb815('0x1b')]);}_0x1c2ca6[_0xb815('0x38')]=this[_0xb815('0x1c')](_0x19848c[_0xb815('0x32')]['sort']);_0x1c2ca6['where']=this[_0xb815('0xc')](_['pick'](_0x19848c['query'],_0x131210[_0xb815('0xc')]),_0x441b5a);if(_0x19848c[_0xb815('0x32')][_0xb815('0x39')]){var _0x388754=_0x441b5a;var _0x4c8655=_0x19848c['query'][_0xb815('0x39')];if(typeof _0x4c8655===_0xb815('0x3a')){_0x388754=_[_0xb815('0x39')](_0x441b5a,function(_0x38750d){return _[_0xb815('0x5')](_0x4c8655[_0xb815('0x3b')],_0x38750d[_0xb815('0x18')]);});_0x4c8655=_0x4c8655[_0xb815('0x3c')];}_0x1c2ca6[_0xb815('0x3d')]=_['merge'](_0x1c2ca6[_0xb815('0x3d')],{'$or':_['map'](_0x388754,function(_0x202ce5){if(_0x202ce5['type']!==_0xb815('0x3e')){if(_0x29ecee){return sequelize[_0xb815('0x3d')](sequelize['fn'](_0xb815('0x3f'),sequelize['col'](_0x202ce5['name'])),{'$like':sequelize['fn'](_0xb815('0x3f'),'%'+_0x19848c[_0xb815('0x32')][_0xb815('0x39')]+'%')});}else{var _0x5d7fbc={};_0x5d7fbc[_0x202ce5[_0xb815('0x18')]]={'$like':'%'+_0x19848c[_0xb815('0x32')][_0xb815('0x39')]+'%'};return _0x5d7fbc;}}})});}_0x1c2ca6=_[_0xb815('0x40')]({},_0x1c2ca6,_0x19848c[_0xb815('0x41')]);return _0x1c2ca6;};exports[_0xb815('0x42')]=function(_0x2fa188){var _0x3626ce=[];if(_0x2fa188['includeAll']){_0x3626ce['push']({'all':!![]});}else if(_0x2fa188[_0xb815('0x42')]){if(Array[_0xb815('0x1a')](_0x2fa188[_0xb815('0x42')])){_0x3626ce=Object[_0xb815('0x4')](_0x2fa188['include'])['map'](function(_0xf1bf3){return parseIncludeModel(_0x2fa188[_0xb815('0x42')][_0xf1bf3]);});}else{var _0x549106=parseIncludeModel(_0x2fa188[_0xb815('0x42')]);_0x3626ce['push'](_0x549106);}}return _0x3626ce;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index d5f3035..57280bb 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9a1=['order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','fullname','internal','substring','indexOf','validateSortParameter','DESC','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','chatCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','pauseType','find','globalStatus','getSortedAgentsIdsByStatus'];(function(_0x2b7f3a,_0x518001){var _0x58dfd0=function(_0x581f2b){while(--_0x581f2b){_0x2b7f3a['push'](_0x2b7f3a['shift']());}};_0x58dfd0(++_0x518001);}(_0xc9a1,0x131));var _0x1c9a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xc9a1[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x1c9a('0x0'));var jayson=require(_0x1c9a('0x1'));var db=require(_0x1c9a('0x2'))['db'];var amiClient=jayson['client'][_0x1c9a('0x3')]({'port':0x232a});var routingClient=jayson[_0x1c9a('0x4')][_0x1c9a('0x3')]({'port':0x232c});function isAgentPaused(_0x100a17,_0x321253){var _0x4f0943=[_0x100a17[_0x1c9a('0x5')],_0x100a17[_0x1c9a('0x6')],_0x100a17[_0x1c9a('0x7')],_0x100a17[_0x1c9a('0x8')],_0x100a17[_0x1c9a('0x9')],_0x100a17[_0x1c9a('0xa')],_0x100a17[_0x1c9a('0xb')]];if(!_0x321253)return _['every'](_0x4f0943);var _0x3ecfb4=_[_0x1c9a('0xc')](_0x4f0943);return _0x3ecfb4['length']>0x0&&_0x3ecfb4[_0x1c9a('0xd')]<_0x4f0943[_0x1c9a('0xd')]?!![]:![];}function isIdle(_0x645f5b){return _0x645f5b===_0x1c9a('0xe')||_0x645f5b===_0x1c9a('0xf')||_0x645f5b==='unavailable'||_0x645f5b===_0x1c9a('0x10')||_['isNil'](_0x645f5b);}function isAgentIdle(_0x33826f){if(_0x33826f[_0x1c9a('0x11')]!=='idle'&&_0x33826f[_0x1c9a('0xa')]){_0x33826f[_0x1c9a('0x11')]=_0x1c9a('0x12');return![];}return _['every']([_0x33826f[_0x1c9a('0x13')],_0x33826f[_0x1c9a('0x14')],_0x33826f[_0x1c9a('0x15')],_0x33826f[_0x1c9a('0x16')],_0x33826f[_0x1c9a('0x17')],_0x33826f[_0x1c9a('0x11')],_0x33826f[_0x1c9a('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x1c9a('0x19')](_0x1c9a('0x1a'),{})[_0x1c9a('0x1b')](function(_0x5c0200){if(_0x5c0200[_0x1c9a('0x1c')]){throw new Error(_0x1c9a('0x1d'));}var _0x20b9a7=_0x5c0200[_0x1c9a('0x1e')];return routingClient['request']('Agents',{})['then'](function(_0x353a6c){if(_0x353a6c[_0x1c9a('0x1c')]){throw new Error(_0x1c9a('0x1f'));}var _0x58d34a=_0x353a6c['result'];return _[_0x1c9a('0x20')]({},_0x20b9a7,_0x58d34a);});})['catch'](function(_0x29052b){throw _0x29052b;});}exports[_0x1c9a('0x21')]=getRealtimeAgents;function getAgentStatus(_0x666fc8){var _0x385e24=_0x1c9a('0xf');if(isAgentPaused(_0x666fc8))_0x385e24='pause';else if(isAgentPaused(_0x666fc8,!![]))_0x385e24='*pause';else if(isAgentIdle(_0x666fc8))_0x385e24=_0x1c9a('0xe');else _0x385e24=_0x1c9a('0x22');return _0x385e24;}exports[_0x1c9a('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x2dd047,_0x23de35){var _0x75281c=_['isArray'](_0x2dd047)?_0x2dd047:[_0x2dd047];var _0x47189c=_[_0x1c9a('0x24')](_0x23de35)+_0x1c9a('0x25');var _0x5c91f5=_[_0x1c9a('0x26')](_0x75281c,function(_0x5ae747){return db[_0x47189c][_0x1c9a('0x27')]({'where':{'id':_0x5ae747}})[_0x1c9a('0x1b')](function(_0x46fe3d){if(!_0x46fe3d)return[];return _0x46fe3d[_0x1c9a('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x1c9a('0x29')](_0x5c91f5)[_0x1c9a('0x1b')](function(_0x5dc301){var _0x16a671=_(_0x5dc301)[_0x1c9a('0x2a')]()[_0x1c9a('0x26')]('id')['uniq']()[_0x1c9a('0x2b')]();return _0x16a671;});}exports[_0x1c9a('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5485b0,_0x5841e0,_0x1aa26c){try{if(_0x5841e0[_0x1c9a('0xd')]>0x0){_0x5485b0=_0x5485b0['filter'](function(_0x44dd4d){return _0x5841e0[_0x1c9a('0x2d')](_0x44dd4d['id']);});}var _0x4d2c85=_0x5485b0[_0x1c9a('0xc')](function(_0x283366){var _0x1ed2b6=_0x1c9a('0x22');if(isAgentIdle(_0x283366)){_0x1ed2b6=_0x1c9a('0xe');}return _0x1ed2b6===_0x1aa26c;});return _[_0x1c9a('0x26')](_0x4d2c85,'id');}catch(_0x1f093a){throw _0x1f093a;}}exports[_0x1c9a('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4afc46,_0x351bfd,_0x52ccb5){return Promise[_0x1c9a('0x2f')]()['then'](function(){if(_0x351bfd[_0x1c9a('0xd')]>0x0){_0x4afc46=_0x4afc46['filter'](function(_0x30ef9e){return _0x351bfd[_0x1c9a('0x2d')](_0x30ef9e['id']);});}return _0x4afc46;})[_0x1c9a('0x1b')](function(){return db[_0x1c9a('0x30')][_0x1c9a('0x31')]({'attributes':['id',_0x1c9a('0x32'),'fullname',_0x1c9a('0x5'),'faxPause',_0x1c9a('0x7'),_0x1c9a('0x8'),'smsPause',_0x1c9a('0xa'),_0x1c9a('0xb'),_0x1c9a('0x33')],'where':{'id':{'$in':_['map'](_0x4afc46,'id')}},'raw':!![]});})[_0x1c9a('0x1b')](function(_0x503fc7){return _0x503fc7['map'](function(_0x344897){var _0x3ccb47=_[_0x1c9a('0x34')](_0x4afc46,['id',_0x344897['id']]);var _0x56a730=filterAgentAttributes(_0x3ccb47);_[_0x1c9a('0x20')](_0x344897,_0x56a730);_0x344897[_0x1c9a('0x35')]=getAgentStatus(_0x344897);return _0x344897;});})['then'](function(_0x30feed){var _0x3e695f=sortAgentsByStatus(_0x30feed,_0x52ccb5);return _[_0x1c9a('0x26')](_0x3e695f,'id');})['catch'](function(_0x2f8311){throw _0x2f8311;});}exports[_0x1c9a('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x275909){var _0x3e6bea={'fields':[],'order':null};var _0x5071f7=_0x275909['split'](',');_0x3e6bea['fields']=_['filter'](_0x5071f7,function(_0x5e41ca){if(!_0x5e41ca['includes']('globalStatus')){return!![];}_0x3e6bea[_0x1c9a('0x37')]=_[_0x1c9a('0x38')](_0x5e41ca,'-')?'DESC':_0x1c9a('0x39');return![];});return _0x3e6bea;}exports[_0x1c9a('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x574e4d){if(!_0x574e4d){_0x574e4d=_0x1c9a('0x3b');}if(_0x574e4d[_0x1c9a('0x2d')](_0x1c9a('0x3c'))&&!_0x574e4d[_0x1c9a('0x2d')](_0x1c9a('0x3d'))){var _0x491f47=_0x574e4d[_0x1c9a('0x3e')](0x0,_0x574e4d[_0x1c9a('0x3f')](_0x1c9a('0x3c')));_0x574e4d+=','+_0x491f47+'internal';}return _0x574e4d;}exports[_0x1c9a('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x295f2e,_0x45af12){var _0x552062=_0x295f2e['sort'](function(_0x5d0965,_0xb749cf){if(_0x5d0965[_0x1c9a('0x35')]===_0xb749cf[_0x1c9a('0x35')]){if(_0x5d0965[_0x1c9a('0x35')]===_0x1c9a('0x12')){if(_0x45af12===_0x1c9a('0x41')){return(_0x5d0965[_0x1c9a('0x33')]||'')<(_0xb749cf[_0x1c9a('0x33')]||'')||_0x5d0965[_0x1c9a('0x3c')][_0x1c9a('0x42')]()>_0xb749cf[_0x1c9a('0x3c')]['toLowerCase']()?0x1:-0x1;}else{return(_0x5d0965['pauseType']||'')<(_0xb749cf[_0x1c9a('0x33')]||'')||_0x5d0965['fullname'][_0x1c9a('0x42')]()>_0xb749cf[_0x1c9a('0x3c')][_0x1c9a('0x42')]()?-0x1:0x1;}}else{if(_0x45af12==='DESC'){return _0x5d0965[_0x1c9a('0x3c')][_0x1c9a('0x42')]()<_0xb749cf[_0x1c9a('0x3c')][_0x1c9a('0x42')]()?0x1:-0x1;}else{return _0x5d0965['fullname'][_0x1c9a('0x42')]()<_0xb749cf['fullname'][_0x1c9a('0x42')]()?-0x1:0x1;}}}else{if(_0x45af12===_0x1c9a('0x41')){return _0x5d0965[_0x1c9a('0x35')]<_0xb749cf[_0x1c9a('0x35')]?0x1:-0x1;}else{return _0x5d0965['globalStatus']<_0xb749cf[_0x1c9a('0x35')]?-0x1:0x1;}}});return _0x552062;}exports[_0x1c9a('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x3f4b88){var _0x15061a=['userpic',_0x1c9a('0x44'),_0x1c9a('0x45'),_0x1c9a('0x46'),'pauseType',_0x1c9a('0x46'),_0x1c9a('0x3d'),'address','chatPause',_0x1c9a('0x8'),_0x1c9a('0x7'),_0x1c9a('0x9'),_0x1c9a('0xb'),_0x1c9a('0x6'),_0x1c9a('0xa'),_0x1c9a('0x47'),'openchannelCapacity','mailCapacity',_0x1c9a('0x48'),'whatsappCapacity',_0x1c9a('0x49'),_0x1c9a('0x4a'),_0x1c9a('0x4b'),_0x1c9a('0x4c'),_0x1c9a('0x4d'),_0x1c9a('0x4e'),'faxCurrentCapacity',_0x1c9a('0x13'),'openchannelStatus',_0x1c9a('0x15'),_0x1c9a('0x17'),_0x1c9a('0x18'),'faxStatus','voiceStatus','chatStatusTime',_0x1c9a('0x4f'),'mailStatusTime',_0x1c9a('0x50'),_0x1c9a('0x51'),'faxStatusTime',_0x1c9a('0x52'),_0x1c9a('0x53'),_0x1c9a('0x54'),_0x1c9a('0x55'),_0x1c9a('0x56'),_0x1c9a('0x57'),_0x1c9a('0x58')];var _0x5c767f=[_0x1c9a('0x5'),_0x1c9a('0x8'),_0x1c9a('0x7'),'smsPause',_0x1c9a('0xb'),'faxPause','voicePause',_0x1c9a('0x44')];var _0x26948e=_(_0x3f4b88)[_0x1c9a('0x59')](_0x5c767f)['pick'](_0x15061a)[_0x1c9a('0x2b')]();return _0x26948e;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0xaedf=['ringing','isNil','voiceStatus','voicePause','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','all','flatten','value','filter','getAgentIdsByStatus','resolve','includes','User','findAll','name','globalStatus','order','startsWith','DESC','ASC','fullname,internal','fullname','internal','sort','pauseType','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','smsStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','length','idle','unknown','unavailable'];(function(_0x2af200,_0x28a8c0){var _0x1da2af=function(_0x25f499){while(--_0x25f499){_0x2af200['push'](_0x2af200['shift']());}};_0x1da2af(++_0x28a8c0);}(_0xaedf,0x1a3));var _0xfaed=function(_0x117e9c,_0x527d23){_0x117e9c=_0x117e9c-0x0;var _0x3a2cd9=_0xaedf[_0x117e9c];return _0x3a2cd9;};'use strict';var _=require(_0xfaed('0x0'));var jayson=require(_0xfaed('0x1'));var db=require(_0xfaed('0x2'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xfaed('0x3')][_0xfaed('0x4')]({'port':0x232c});function isAgentPaused(_0x489543,_0x167b2a){var _0x36d846=[_0x489543[_0xfaed('0x5')],_0x489543[_0xfaed('0x6')],_0x489543[_0xfaed('0x7')],_0x489543[_0xfaed('0x8')],_0x489543[_0xfaed('0x9')],_0x489543['voicePause'],_0x489543[_0xfaed('0xa')]];if(!_0x167b2a)return _[_0xfaed('0xb')](_0x36d846);var _0x5ecea1=_['filter'](_0x36d846);return _0x5ecea1[_0xfaed('0xc')]>0x0&&_0x5ecea1[_0xfaed('0xc')]<_0x36d846['length']?!![]:![];}function isIdle(_0x57dced){return _0x57dced===_0xfaed('0xd')||_0x57dced===_0xfaed('0xe')||_0x57dced===_0xfaed('0xf')||_0x57dced===_0xfaed('0x10')||_[_0xfaed('0x11')](_0x57dced);}function isAgentIdle(_0x9cc4ea){if(_0x9cc4ea[_0xfaed('0x12')]!=='idle'&&_0x9cc4ea[_0xfaed('0x13')]){_0x9cc4ea[_0xfaed('0x12')]=_0xfaed('0x14');return![];}return _[_0xfaed('0xb')]([_0x9cc4ea[_0xfaed('0x15')],_0x9cc4ea[_0xfaed('0x16')],_0x9cc4ea['mailStatus'],_0x9cc4ea[_0xfaed('0x17')],_0x9cc4ea[_0xfaed('0x18')],_0x9cc4ea[_0xfaed('0x12')],_0x9cc4ea[_0xfaed('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xfaed('0x1a')](_0xfaed('0x1b'),{})[_0xfaed('0x1c')](function(_0x125097){if(_0x125097[_0xfaed('0x1d')]){throw new Error(_0xfaed('0x1e'));}var _0x56ca89=_0x125097[_0xfaed('0x1f')];return routingClient[_0xfaed('0x1a')](_0xfaed('0x1b'),{})[_0xfaed('0x1c')](function(_0x3f4db9){if(_0x3f4db9[_0xfaed('0x1d')]){throw new Error(_0xfaed('0x20'));}var _0x4ab8a4=_0x3f4db9['result'];return _[_0xfaed('0x21')]({},_0x56ca89,_0x4ab8a4);});})[_0xfaed('0x22')](function(_0x5e5772){throw _0x5e5772;});}exports[_0xfaed('0x23')]=getRealtimeAgents;function getAgentStatus(_0x1dbbbe){var _0xf14fe1=_0xfaed('0xe');if(isAgentPaused(_0x1dbbbe))_0xf14fe1=_0xfaed('0x14');else if(isAgentPaused(_0x1dbbbe,!![]))_0xf14fe1='*pause';else if(isAgentIdle(_0x1dbbbe))_0xf14fe1=_0xfaed('0xd');else _0xf14fe1=_0xfaed('0x24');return _0xf14fe1;}exports[_0xfaed('0x25')]=getAgentStatus;function getAgentIdsByQueues(_0x2fec23,_0x9a8d6e){var _0x48563c=_[_0xfaed('0x26')](_0x2fec23)?_0x2fec23:[_0x2fec23];var _0x5d2e50=_[_0xfaed('0x27')](_0x9a8d6e)+_0xfaed('0x28');var _0x12a1f4=_[_0xfaed('0x29')](_0x48563c,function(_0x475f90){return db[_0x5d2e50]['findOne']({'where':{'id':_0x475f90}})['then'](function(_0x15ff4c){if(!_0x15ff4c)return[];return _0x15ff4c['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xfaed('0x2a')](_0x12a1f4)[_0xfaed('0x1c')](function(_0x102271){var _0x2a4977=_(_0x102271)[_0xfaed('0x2b')]()[_0xfaed('0x29')]('id')['uniq']()[_0xfaed('0x2c')]();return _0x2a4977;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x7174e5,_0x4fbd04,_0x1293ed){try{if(_0x4fbd04[_0xfaed('0xc')]>0x0){_0x7174e5=_0x7174e5[_0xfaed('0x2d')](function(_0x4155e8){return _0x4fbd04['includes'](_0x4155e8['id']);});}var _0x586cf3=_0x7174e5[_0xfaed('0x2d')](function(_0x2370b2){var _0x1b29a6=_0xfaed('0x24');if(isAgentIdle(_0x2370b2)){_0x1b29a6=_0xfaed('0xd');}return _0x1b29a6===_0x1293ed;});return _[_0xfaed('0x29')](_0x586cf3,'id');}catch(_0x1ba68f){throw _0x1ba68f;}}exports[_0xfaed('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2fcf95,_0x39af1d,_0x56982d){return Promise[_0xfaed('0x2f')]()[_0xfaed('0x1c')](function(){if(_0x39af1d[_0xfaed('0xc')]>0x0){_0x2fcf95=_0x2fcf95['filter'](function(_0x20e272){return _0x39af1d[_0xfaed('0x30')](_0x20e272['id']);});}return _0x2fcf95;})[_0xfaed('0x1c')](function(){return db[_0xfaed('0x31')][_0xfaed('0x32')]({'attributes':['id',_0xfaed('0x33'),'fullname',_0xfaed('0x5'),_0xfaed('0x6'),'mailPause',_0xfaed('0x8'),_0xfaed('0x9'),_0xfaed('0x13'),'whatsappPause','pauseType'],'where':{'id':{'$in':_[_0xfaed('0x29')](_0x2fcf95,'id')}},'raw':!![]});})[_0xfaed('0x1c')](function(_0x1b9305){return _0x1b9305[_0xfaed('0x29')](function(_0x116f80){var _0x293bd1=_['find'](_0x2fcf95,['id',_0x116f80['id']]);var _0xd0dd3=filterAgentAttributes(_0x293bd1);_[_0xfaed('0x21')](_0x116f80,_0xd0dd3);_0x116f80['globalStatus']=getAgentStatus(_0x116f80);return _0x116f80;});})[_0xfaed('0x1c')](function(_0x5a6ca5){var _0x3c6ec4=sortAgentsByStatus(_0x5a6ca5,_0x56982d);return _[_0xfaed('0x29')](_0x3c6ec4,'id');})[_0xfaed('0x22')](function(_0x3e3640){throw _0x3e3640;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x58a9f1){var _0x18b77c={'fields':[],'order':null};var _0x498e19=_0x58a9f1['split'](',');_0x18b77c['fields']=_[_0xfaed('0x2d')](_0x498e19,function(_0x45bf6f){if(!_0x45bf6f[_0xfaed('0x30')](_0xfaed('0x34'))){return!![];}_0x18b77c[_0xfaed('0x35')]=_[_0xfaed('0x36')](_0x45bf6f,'-')?_0xfaed('0x37'):_0xfaed('0x38');return![];});return _0x18b77c;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x2661e4){if(!_0x2661e4){_0x2661e4=_0xfaed('0x39');}if(_0x2661e4['includes'](_0xfaed('0x3a'))&&!_0x2661e4['includes'](_0xfaed('0x3b'))){var _0x5d32b0=_0x2661e4['substring'](0x0,_0x2661e4['indexOf'](_0xfaed('0x3a')));_0x2661e4+=','+_0x5d32b0+_0xfaed('0x3b');}return _0x2661e4;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x2d5d0d,_0x401e4a){var _0x3db2cc=_0x2d5d0d[_0xfaed('0x3c')](function(_0xb7e43,_0x4b1688){if(_0xb7e43[_0xfaed('0x34')]===_0x4b1688[_0xfaed('0x34')]){if(_0xb7e43[_0xfaed('0x34')]===_0xfaed('0x14')){if(_0x401e4a===_0xfaed('0x37')){return(_0xb7e43[_0xfaed('0x3d')]||'')<(_0x4b1688['pauseType']||'')||_0xb7e43['fullname']['toLowerCase']()>_0x4b1688[_0xfaed('0x3a')][_0xfaed('0x3e')]()?0x1:-0x1;}else{return(_0xb7e43['pauseType']||'')<(_0x4b1688[_0xfaed('0x3d')]||'')||_0xb7e43[_0xfaed('0x3a')]['toLowerCase']()>_0x4b1688['fullname'][_0xfaed('0x3e')]()?-0x1:0x1;}}else{if(_0x401e4a===_0xfaed('0x37')){return _0xb7e43[_0xfaed('0x3a')]['toLowerCase']()<_0x4b1688[_0xfaed('0x3a')][_0xfaed('0x3e')]()?0x1:-0x1;}else{return _0xb7e43[_0xfaed('0x3a')]['toLowerCase']()<_0x4b1688[_0xfaed('0x3a')][_0xfaed('0x3e')]()?-0x1:0x1;}}}else{if(_0x401e4a===_0xfaed('0x37')){return _0xb7e43[_0xfaed('0x34')]<_0x4b1688[_0xfaed('0x34')]?0x1:-0x1;}else{return _0xb7e43[_0xfaed('0x34')]<_0x4b1688[_0xfaed('0x34')]?-0x1:0x1;}}});return _0x3db2cc;}exports[_0xfaed('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x242cf8){var _0x35a20a=['userpic',_0xfaed('0x40'),_0xfaed('0x41'),_0xfaed('0x42'),_0xfaed('0x3d'),_0xfaed('0x42'),_0xfaed('0x3b'),_0xfaed('0x43'),'chatPause',_0xfaed('0x8'),_0xfaed('0x7'),'smsPause',_0xfaed('0xa'),_0xfaed('0x6'),'voicePause','chatCapacity',_0xfaed('0x44'),_0xfaed('0x45'),_0xfaed('0x46'),'whatsappCapacity',_0xfaed('0x47'),'chatCurrentCapacity',_0xfaed('0x48'),_0xfaed('0x49'),_0xfaed('0x4a'),_0xfaed('0x4b'),_0xfaed('0x4c'),_0xfaed('0x15'),'openchannelStatus','mailStatus','smsStatus',_0xfaed('0x19'),_0xfaed('0x16'),_0xfaed('0x12'),'chatStatusTime',_0xfaed('0x4d'),'mailStatusTime',_0xfaed('0x4e'),'whatsappStatusTime',_0xfaed('0x4f'),'voiceStatusTime',_0xfaed('0x50'),'destconnectedlinenum',_0xfaed('0x51'),_0xfaed('0x52'),_0xfaed('0x53'),_0xfaed('0x54')];var _0x52639a=[_0xfaed('0x5'),_0xfaed('0x8'),_0xfaed('0x7'),_0xfaed('0x9'),'whatsappPause','faxPause','voicePause',_0xfaed('0x40')];var _0x5201db=_(_0x242cf8)[_0xfaed('0x55')](_0x52639a)[_0xfaed('0x56')](_0x35a20a)[_0xfaed('0x2c')]();return _0x5201db;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 1bf6cbc..4373d1e 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7593=['unavailable','unknown','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','pTalking','find','initializeQueues','lodash','util','client','http','available','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking'];(function(_0x6c59fc,_0x5fe88d){var _0x17c96f=function(_0x5a6c82){while(--_0x5a6c82){_0x6c59fc['push'](_0x6c59fc['shift']());}};_0x17c96f(++_0x5fe88d);}(_0x7593,0xff));var _0x3759=function(_0x1f9773,_0x4365fb){_0x1f9773=_0x1f9773-0x0;var _0x3fc947=_0x7593[_0x1f9773];return _0x3fc947;};'use strict';var _=require(_0x3759('0x0'));var jayson=require('jayson/promise');var util=require(_0x3759('0x1'));var amiClient=jayson[_0x3759('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x3759('0x2')][_0x3759('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x3759('0x4'),'loggedIn',_0x3759('0x5'),_0x3759('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x3759('0x7'),'inUse',_0x3759('0x8'),_0x3759('0x9'),_0x3759('0xa'),_0x3759('0xb'),_0x3759('0xc'),_0x3759('0xd'),_0x3759('0xe'),_0x3759('0xf'),_0x3759('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0x3759('0x11'),_0x3759('0x12'),'dialActive',_0x3759('0x13'),_0x3759('0x14'),_0x3759('0x15'),_0x3759('0x16'),_0x3759('0x17'),_0x3759('0x18'),_0x3759('0x19'),_0x3759('0x1a'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x3759('0x1b'),_0x3759('0x1c'),_0x3759('0x1d'),_0x3759('0x1e'),_0x3759('0x1f'),_0x3759('0x20'),_0x3759('0x21'),_0x3759('0x22')];function getRealtimeQueues(_0xd7f795,_0x202f8a){var _0x44f059=_0x202f8a===_0x3759('0x23')?amiClient:routingClient;return _0x44f059[_0x3759('0x24')](_['startCase'](_0x202f8a)+_0x3759('0x25'),_0xd7f795)[_0x3759('0x26')](function(_0x525442){if(_0x525442[_0x3759('0x27')])throw new Error(util[_0x3759('0x28')](_0x3759('0x29'),_0x202f8a));return _0x525442[_0x3759('0x2a')];})[_0x3759('0x2b')](function(_0x2af038){throw _0x2af038;});}exports[_0x3759('0x2c')]=getRealtimeQueues;function initializeQueues(_0x2df425,_0x481275,_0x3bb7ba,_0x3953ab){var _0xf86c13=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3bb7ba===_0x3759('0x23')){if(_0x3953ab===_0x3759('0x2d')){_0xf86c13=_0xf86c13[_0x3759('0x2e')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3953ab===_0x3759('0x2f')){_0xf86c13=_0xf86c13[_0x3759('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2df425[_0x3759('0x30')](function(_0x3015e5){var _0x127da8=_0x3015e5[_0x3759('0x31')]({'plain':!![]});_0x127da8[_0x3759('0x5')]=0x0;_0x127da8[_0x3759('0x9')]=0x0;_0x127da8[_0x3759('0x32')]=0x0;_0x127da8['available']=0x0;_0x127da8[_0x3759('0x6')]=0x0;if(_0x3bb7ba===_0x3759('0x23')){_0x127da8[_0x3759('0xe')]=0x0;_0x127da8[_0x3759('0x7')]=0x0;if(_0x3953ab===_0x3759('0x2f')){_0x127da8[_0x3759('0x33')]=0x0;_0x127da8['originated']=0x0;}}var _0x4550af=_[_0x3759('0x34')](_0x481275,['id',_0x127da8['id']]);if(_0x4550af){_['merge'](_0x127da8,_['pick'](_0x4550af,_0xf86c13));}return _0x127da8;});}exports[_0x3759('0x35')]=initializeQueues; \ No newline at end of file +var _0x5a63=['client','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','ringInUse','talking','unavailable','unknown','originated','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','error','format','result','getRealtimeQueues','inbound','concat','outbound','map','get','pTalking','find','pick','jayson/promise','util','http'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0x5a63,0x11d));var _0x35a6=function(_0x4bfd8e,_0x29fa05){_0x4bfd8e=_0x4bfd8e-0x0;var _0xec89f4=_0x5a63[_0x4bfd8e];return _0xec89f4;};'use strict';var _=require('lodash');var jayson=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var amiClient=jayson['client'][_0x35a6('0x2')]({'port':0x232a});var routingClient=jayson[_0x35a6('0x3')][_0x35a6('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x35a6('0x4'),_0x35a6('0x5'),_0x35a6('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x35a6('0x7'),_0x35a6('0x8'),_0x35a6('0x9'),_0x35a6('0xa'),_0x35a6('0xb'),'onHold','ringing',_0x35a6('0xc'),_0x35a6('0xd'),_0x35a6('0xe'),_0x35a6('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x35a6('0x10'),'message','statusMessage','dialActive',_0x35a6('0x11'),_0x35a6('0x12'),_0x35a6('0x13'),_0x35a6('0x14'),_0x35a6('0x15'),_0x35a6('0x16'),_0x35a6('0x17'),_0x35a6('0x18'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x35a6('0x19'),_0x35a6('0x1a'),_0x35a6('0x1b'),_0x35a6('0x1c'),_0x35a6('0x1d'),_0x35a6('0x1e'),_0x35a6('0x1f'),_0x35a6('0x20')];function getRealtimeQueues(_0x50ae21,_0x59fcb0){var _0x2ec9ee=_0x59fcb0===_0x35a6('0x21')?amiClient:routingClient;return _0x2ec9ee[_0x35a6('0x22')](_[_0x35a6('0x23')](_0x59fcb0)+'Queues',_0x50ae21)['then'](function(_0x240159){if(_0x240159[_0x35a6('0x24')])throw new Error(util[_0x35a6('0x25')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x59fcb0));return _0x240159[_0x35a6('0x26')];})['catch'](function(_0x330bac){throw _0x330bac;});}exports[_0x35a6('0x27')]=getRealtimeQueues;function initializeQueues(_0x22efa7,_0xf859c2,_0x44c0ce,_0x5daba0){var _0xd86f8a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x44c0ce===_0x35a6('0x21')){if(_0x5daba0===_0x35a6('0x28')){_0xd86f8a=_0xd86f8a[_0x35a6('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5daba0===_0x35a6('0x2a')){_0xd86f8a=_0xd86f8a['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x22efa7[_0x35a6('0x2b')](function(_0xe3f2a8){var _0x569239=_0xe3f2a8[_0x35a6('0x2c')]({'plain':!![]});_0x569239['paused']=0x0;_0x569239[_0x35a6('0xa')]=0x0;_0x569239['loggedIn']=0x0;_0x569239['available']=0x0;_0x569239[_0x35a6('0x6')]=0x0;if(_0x44c0ce==='voice'){_0x569239['talking']=0x0;_0x569239[_0x35a6('0x7')]=0x0;if(_0x5daba0===_0x35a6('0x2a')){_0x569239[_0x35a6('0x2d')]=0x0;_0x569239['originated']=0x0;}}var _0x921abd=_[_0x35a6('0x2e')](_0xf859c2,['id',_0x569239['id']]);if(_0x921abd){_['merge'](_0x569239,_[_0x35a6('0x2f')](_0x921abd,_0xd86f8a));}return _0x569239;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ba6aeaa..8a89139 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(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x37f053,_0x4b2ad0){var _0x78f6a0=function(_0x84b926){while(--_0x84b926){_0x37f053['push'](_0x37f053['shift']());}};_0x78f6a0(++_0x4b2ad0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 6844187..a0290a8 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 _0x621f=['../environment','orderBy','keys','length','filter','family','IPv4','internal','head','mac','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','substring','lodash','crypto','bimedia-machine-uuid'];(function(_0x404c13,_0x5ea388){var _0x266bef=function(_0x33b721){while(--_0x33b721){_0x404c13['push'](_0x404c13['shift']());}};_0x266bef(++_0x5ea388);}(_0x621f,0xa2));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf621('0x0'));var os=require('os');var crypto=require(_0xf621('0x1'));var machine=require(_0xf621('0x2'));var exec=require('child_process')['execSync'];var config=require(_0xf621('0x3'));function getInterfaces(){var _0xe342ac=[];var _0x470bc9=os['networkInterfaces']();var _0x2f76fc=_[_0xf621('0x4')](_[_0xf621('0x5')](_0x470bc9));for(var _0x4cf916=0x0;_0x4cf916<_0x2f76fc[_0xf621('0x6')];_0x4cf916++){var _0x1e23a6=_0x470bc9[_0x2f76fc[_0x4cf916]][_0xf621('0x7')](function(_0x54e0f5){return _0x54e0f5[_0xf621('0x8')]===_0xf621('0x9')&&_0x54e0f5[_0xf621('0xa')]===![];});_0xe342ac=_0xe342ac['concat'](_0x1e23a6);}return _0xe342ac;}function getFirstInterface(){var _0xa695fb=_[_0xf621('0xb')](getInterfaces());return{'macAddress':_0xa695fb&&_0xa695fb['mac']?_0xa695fb[_0xf621('0xc')]:'00:00:00:00:00:00','ipAddress':_0xa695fb&&_0xa695fb[_0xf621('0xd')]?_0xa695fb[_0xf621('0xd')]:_0xf621('0xe')};}exports[_0xf621('0xf')]=getFirstInterface;function getCPUhash(){var _0x1c58bd=_[_0xf621('0x4')](os['cpus']()[_0xf621('0x10')](function(_0x4b97fa){return _0x4b97fa[_0xf621('0x11')];}))[_0xf621('0x12')](':');return crypto[_0xf621('0x13')](_0xf621('0x14'))[_0xf621('0x15')](_0x1c58bd)[_0xf621('0x16')](_0xf621('0x17'));}exports['getUuid']=function(){var _0x4791cd=os[_0xf621('0x18')]();var _0x29641d=/[0-9a-f-]{36}/;if(config[_0xf621('0x19')]&&_0x29641d[_0xf621('0x1a')](config[_0xf621('0x19')])){return config[_0xf621('0x19')];}else if(_0x4791cd===_0xf621('0x1b')){return exec(_0xf621('0x1c'),{'encoding':_0xf621('0x1d')})[_0xf621('0x1e')]('\x0d\x0a','');}else{var _0x9f4fb6=getFirstInterface();var _0x6a4784=getCPUhash();var _0x1d8f69=_0x6a4784+'|'+os[_0xf621('0x1f')]()+'|'+_0x9f4fb6['macAddress']+'|'+_0x9f4fb6['ipAddress'];var _0x2693d6=crypto[_0xf621('0x13')](_0xf621('0x14'))[_0xf621('0x15')](_0x1d8f69)[_0xf621('0x16')](_0xf621('0x17'));return _0x2693d6['substring'](0x0,0x8)+'-'+_0x2693d6[_0xf621('0x20')](0x8,0xc)+'-'+_0x2693d6[_0xf621('0x20')](0xc,0x10)+'-'+_0x2693d6[_0xf621('0x20')](0x10,0x14)+'-'+_0x2693d6['substring'](0x14);}}; \ No newline at end of file +var _0x4dba=['macAddress','md5','update','substring','lodash','crypto','bimedia-machine-uuid','../environment','orderBy','keys','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','digest','hex','getUuid','test','licenseToken','win32','utf8','replace'];(function(_0x544620,_0x3bef42){var _0x259b5e=function(_0x57b3a6){while(--_0x57b3a6){_0x544620['push'](_0x544620['shift']());}};_0x259b5e(++_0x3bef42);}(_0x4dba,0x9f));var _0xa4db=function(_0xa50aeb,_0x397379){_0xa50aeb=_0xa50aeb-0x0;var _0x424ab2=_0x4dba[_0xa50aeb];return _0x424ab2;};'use strict';var _=require(_0xa4db('0x0'));var os=require('os');var crypto=require(_0xa4db('0x1'));var machine=require(_0xa4db('0x2'));var exec=require('child_process')['execSync'];var config=require(_0xa4db('0x3'));function getInterfaces(){var _0x47727e=[];var _0x23a910=os['networkInterfaces']();var _0x7091d7=_[_0xa4db('0x4')](_[_0xa4db('0x5')](_0x23a910));for(var _0x2d4700=0x0;_0x2d4700<_0x7091d7['length'];_0x2d4700++){var _0x56427a=_0x23a910[_0x7091d7[_0x2d4700]][_0xa4db('0x6')](function(_0x3e710c){return _0x3e710c[_0xa4db('0x7')]==='IPv4'&&_0x3e710c[_0xa4db('0x8')]===![];});_0x47727e=_0x47727e[_0xa4db('0x9')](_0x56427a);}return _0x47727e;}function getFirstInterface(){var _0x3b6fd7=_['head'](getInterfaces());return{'macAddress':_0x3b6fd7&&_0x3b6fd7[_0xa4db('0xa')]?_0x3b6fd7['mac']:_0xa4db('0xb'),'ipAddress':_0x3b6fd7&&_0x3b6fd7[_0xa4db('0xc')]?_0x3b6fd7['address']:_0xa4db('0xd')};}exports[_0xa4db('0xe')]=getFirstInterface;function getCPUhash(){var _0x576634=_[_0xa4db('0x4')](os[_0xa4db('0xf')]()[_0xa4db('0x10')](function(_0x373ef7){return _0x373ef7[_0xa4db('0x11')];}))['join'](':');return crypto[_0xa4db('0x12')]('md5')['update'](_0x576634)[_0xa4db('0x13')](_0xa4db('0x14'));}exports[_0xa4db('0x15')]=function(){var _0x15e28a=os['platform']();var _0xd2351f=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0xd2351f[_0xa4db('0x16')](config['licenseToken'])){return config[_0xa4db('0x17')];}else if(_0x15e28a===_0xa4db('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xa4db('0x19')})[_0xa4db('0x1a')]('\x0d\x0a','');}else{var _0x2c992a=getFirstInterface();var _0x55d765=getCPUhash();var _0x445a98=_0x55d765+'|'+os['hostname']()+'|'+_0x2c992a[_0xa4db('0x1b')]+'|'+_0x2c992a['ipAddress'];var _0x15dcf7=crypto[_0xa4db('0x12')](_0xa4db('0x1c'))[_0xa4db('0x1d')](_0x445a98)[_0xa4db('0x13')](_0xa4db('0x14'));return _0x15dcf7[_0xa4db('0x1e')](0x0,0x8)+'-'+_0x15dcf7['substring'](0x8,0xc)+'-'+_0x15dcf7[_0xa4db('0x1e')](0xc,0x10)+'-'+_0x15dcf7['substring'](0x10,0x14)+'-'+_0x15dcf7[_0xa4db('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e618abb..a4afd0e 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 _0x04de=['license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','get','data1','then','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','util','pkginfo','version','../../components/encryptor','./hardware','../logger'];(function(_0x486c14,_0x22542d){var _0x1d3ff9=function(_0x3150ef){while(--_0x3150ef){_0x486c14['push'](_0x486c14['shift']());}};_0x1d3ff9(++_0x22542d);}(_0x04de,0x176));var _0xe04d=function(_0x218bf2,_0x30ca32){_0x218bf2=_0x218bf2-0x0;var _0x3922e0=_0x04de[_0x218bf2];return _0x3922e0;};'use strict';var util=require(_0xe04d('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0xe04d('0x1'))(module,_0xe04d('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xe04d('0x3'));var hardware=require(_0xe04d('0x4'));var logger=require(_0xe04d('0x5'))(_0xe04d('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x57e342){return new BPromise(function(_0x36eaa8,_0xa176aa){var _0x3c8ba4=util[_0xe04d('0x7')](_0xe04d('0x8'),HOST,_0x57e342,module[_0xe04d('0x9')][_0xe04d('0x2')]);if(oldToken){_0x3c8ba4=util['format'](_0xe04d('0xa'),HOST,_0x57e342,module[_0xe04d('0x9')]['version'],oldToken);}var _0x477cd7={'uri':_0x3c8ba4,'method':_0xe04d('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x477cd7)['then'](function(_0x217e45){_0x36eaa8(_0x217e45);})['catch'](function(_0x1b59dd){_0xa176aa(_0x1b59dd);});});}function manageLicense(_0x3d0375,_0x49db4e){var _0x2aac7b=_0x49db4e[_0xe04d('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x2aac7b[_0xe04d('0xd')]!==_0x3d0375&&!_0x2aac7b['data2']){oldToken=_0x2aac7b['data1'];}httpRequest(_0x3d0375)[_0xe04d('0xe')](function(_0x37c71b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x37c71b['active']){isOldTokenSent=![];if(!_0x2aac7b[_0xe04d('0x6')]&&_0x2aac7b['license']!=_0x37c71b[_0xe04d('0x6')]||_0x2aac7b[_0xe04d('0x6')]&&_0x2aac7b[_0xe04d('0xf')]){logger[_0xe04d('0x10')](_0xe04d('0x11'));}if(_0x2aac7b['license']&&!_0x2aac7b[_0xe04d('0xf')]&&_0x2aac7b['license']!=_0x37c71b[_0xe04d('0x6')]){logger[_0xe04d('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2aac7b[_0xe04d('0x6')]&&!_0x2aac7b[_0xe04d('0xf')]&&_0x2aac7b['license']==_0x37c71b[_0xe04d('0x6')]){return _0x49db4e;}return _0x49db4e['update']({'data1':_0x3d0375,'data2':null,'license':_0x37c71b[_0xe04d('0x6')]});}else{if(_0x37c71b[_0xe04d('0x6')]||_0x2aac7b['license']){if(!_0x2aac7b[_0xe04d('0xf')]){if(_0x2aac7b[_0xe04d('0xd')]==_0x3d0375){GRAY_PERIOD_REASON=_0xe04d('0x12');logger['info'](_0xe04d('0x13'));}else{GRAY_PERIOD_REASON=_0xe04d('0x14');logger[_0xe04d('0x10')](_0xe04d('0x15'),_0x2aac7b[_0xe04d('0xd')],_0x3d0375);}logger['info'](_0xe04d('0x16'),GRAY_PERIOD_REASON[_0xe04d('0x17')](),moment()['format'](_0xe04d('0x18')));return _0x49db4e[_0xe04d('0x19')]({'data2':encryptor[_0xe04d('0x1a')](moment()[_0xe04d('0x7')](_0xe04d('0x18')))});}else{if(moment()[_0xe04d('0x1b')](encryptor[_0xe04d('0x1c')](_0x2aac7b[_0xe04d('0xf')]),'days')>DAYS){logger['info'](_0xe04d('0x1d'),moment()[_0xe04d('0x7')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x49db4e[_0xe04d('0x19')]({'data1':_0x3d0375,'data2':null,'license':null});}}}else{if(_0x2aac7b[_0xe04d('0xd')]!=_0x3d0375){logger[_0xe04d('0x10')](_0xe04d('0x15'),_0x2aac7b[_0xe04d('0xd')],_0x3d0375);return _0x49db4e['update']({'data1':_0x3d0375,'data2':null,'license':null});}}}return _0x49db4e;})['then'](function(_0x421f31){_0x49db4e=_0x421f31;})['catch'](function(_0x59e78f){logger[_0xe04d('0x1e')](_0x59e78f[_0xe04d('0x1f')]);})[_0xe04d('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xe04d('0x21')](),_0x49db4e);},TIME);});}function defaultLicense(){var _0x11a257=hardware[_0xe04d('0x21')]();if(_0x11a257){return db[_0xe04d('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x11a257}})[_0xe04d('0x23')](function(_0x501588,_0x369589){logger[_0xe04d('0x10')](_0xe04d('0x24'),_0x11a257);manageLicense(_0x11a257,_0x501588);})[_0xe04d('0x25')](function(_0x2b140d){logger[_0xe04d('0x1e')](_0x2b140d['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xff16=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','version','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x5af7e2,_0x2a2ce2){var _0x156d8b=function(_0x3c7e62){while(--_0x3c7e62){_0x5af7e2['push'](_0x5af7e2['shift']());}};_0x156d8b(++_0x2a2ce2);}(_0xff16,0x161));var _0x6ff1=function(_0xcbfd81,_0x3273f7){_0xcbfd81=_0xcbfd81-0x0;var _0xe26470=_0xff16[_0xcbfd81];return _0xe26470;};'use strict';var util=require(_0x6ff1('0x0'));var moment=require(_0x6ff1('0x1'));var rp=require(_0x6ff1('0x2'));var BPromise=require(_0x6ff1('0x3'));var pkginfo=require('pkginfo')(module,_0x6ff1('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x6ff1('0x5'));var hardware=require(_0x6ff1('0x6'));var logger=require(_0x6ff1('0x7'))('license');var HOST=_0x6ff1('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x39b0a3){return new BPromise(function(_0x34bc55,_0x34b13f){var _0xf61e3e=util[_0x6ff1('0x9')](_0x6ff1('0xa'),HOST,_0x39b0a3,module[_0x6ff1('0xb')][_0x6ff1('0x4')]);if(oldToken){_0xf61e3e=util[_0x6ff1('0x9')](_0x6ff1('0xc'),HOST,_0x39b0a3,module['exports'][_0x6ff1('0x4')],oldToken);}var _0x2d9d78={'uri':_0xf61e3e,'method':_0x6ff1('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2d9d78)[_0x6ff1('0xe')](function(_0x2007f7){_0x34bc55(_0x2007f7);})[_0x6ff1('0xf')](function(_0x14107f){_0x34b13f(_0x14107f);});});}function manageLicense(_0x587940,_0x49b472){var _0x647555=_0x49b472[_0x6ff1('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x647555[_0x6ff1('0x11')]!==_0x587940&&!_0x647555[_0x6ff1('0x12')]){oldToken=_0x647555[_0x6ff1('0x11')];}httpRequest(_0x587940)[_0x6ff1('0xe')](function(_0x3df238){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3df238[_0x6ff1('0x13')]){isOldTokenSent=![];if(!_0x647555[_0x6ff1('0x14')]&&_0x647555[_0x6ff1('0x14')]!=_0x3df238[_0x6ff1('0x14')]||_0x647555[_0x6ff1('0x14')]&&_0x647555['data2']){logger[_0x6ff1('0x15')](_0x6ff1('0x16'));}if(_0x647555[_0x6ff1('0x14')]&&!_0x647555[_0x6ff1('0x12')]&&_0x647555[_0x6ff1('0x14')]!=_0x3df238[_0x6ff1('0x14')]){logger['info'](_0x6ff1('0x17'));}if(_0x647555[_0x6ff1('0x14')]&&!_0x647555[_0x6ff1('0x12')]&&_0x647555[_0x6ff1('0x14')]==_0x3df238[_0x6ff1('0x14')]){return _0x49b472;}return _0x49b472[_0x6ff1('0x18')]({'data1':_0x587940,'data2':null,'license':_0x3df238[_0x6ff1('0x14')]});}else{if(_0x3df238[_0x6ff1('0x14')]||_0x647555['license']){if(!_0x647555[_0x6ff1('0x12')]){if(_0x647555[_0x6ff1('0x11')]==_0x587940){GRAY_PERIOD_REASON=_0x6ff1('0x19');logger['info'](_0x6ff1('0x1a'));}else{GRAY_PERIOD_REASON=_0x6ff1('0x1b');logger[_0x6ff1('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x647555['data1'],_0x587940);}logger[_0x6ff1('0x15')](_0x6ff1('0x1c'),GRAY_PERIOD_REASON[_0x6ff1('0x1d')](),moment()['format'](_0x6ff1('0x1e')));return _0x49b472['update']({'data2':encryptor[_0x6ff1('0x1f')](moment()[_0x6ff1('0x9')](_0x6ff1('0x1e')))});}else{if(moment()[_0x6ff1('0x20')](encryptor['decryptString'](_0x647555[_0x6ff1('0x12')]),_0x6ff1('0x21'))>DAYS){logger[_0x6ff1('0x15')](_0x6ff1('0x22'),moment()[_0x6ff1('0x9')](_0x6ff1('0x1e')));isOldTokenSent=![];return _0x49b472[_0x6ff1('0x18')]({'data1':_0x587940,'data2':null,'license':null});}}}else{if(_0x647555[_0x6ff1('0x11')]!=_0x587940){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x647555['data1'],_0x587940);return _0x49b472[_0x6ff1('0x18')]({'data1':_0x587940,'data2':null,'license':null});}}}return _0x49b472;})[_0x6ff1('0xe')](function(_0x103d4a){_0x49b472=_0x103d4a;})[_0x6ff1('0xf')](function(_0x1aca24){logger[_0x6ff1('0x23')](_0x1aca24['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x6ff1('0x24')](),_0x49b472);},TIME);});}function defaultLicense(){var _0x1b5ecb=hardware['getUuid']();if(_0x1b5ecb){return db['License'][_0x6ff1('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x1b5ecb}})[_0x6ff1('0x26')](function(_0x4cff21,_0x2e1dcd){logger['info'](_0x6ff1('0x27'),_0x1b5ecb);manageLicense(_0x1b5ecb,_0x4cff21);})['catch'](function(_0x149ae5){logger[_0x6ff1('0x23')](_0x149ae5[_0x6ff1('0x28')]);});}}exports[_0x6ff1('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a955ef0..94e3736 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 _0x19db=['add','days','format','uuid','changed','disabled','User','role','sequelize','col','count','user','telephone','users','telephones','forEach','admin','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','demo','machineUuid','deadline'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x19db,0x132));var _0xb19d=function(_0x59987a,_0x399e11){_0x59987a=_0x59987a-0x0;var _0x460646=_0x19db[_0x59987a];return _0x460646;};'use strict';var util=require(_0xb19d('0x0'));var _=require(_0xb19d('0x1'));var moment=require(_0xb19d('0x2'));var BPromise=require(_0xb19d('0x3'));var hardware=require(_0xb19d('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0xb19d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb19d('0x6'),'machineUuid':hardware[_0xb19d('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb19d('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb19d('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x8d9746){return new BPromise(function(_0x2ef1ae,_0x22241e){return db[_0xb19d('0xa')]['find'](_['defaults'](_0x8d9746,{'raw':!![],'where':{'id':0x1}}))[_0xb19d('0xb')](function(_0xb82c30){return checkLicense(_0xb82c30,null);})[_0xb19d('0xb')](function(_0x1b6858){_0x2ef1ae(_0x1b6858);return;})[_0xb19d('0xc')](function(_0x2b151a){_0x22241e(_0x2b151a);});});}function checkLicense(_0x74251a,_0x5ebd45){if(!_0x74251a){demoLicense['uuid']=_0x74251a[_0xb19d('0xd')];return demoLicense;}try{var _0x7ca8b1=_0x5ebd45||_0x74251a[_0xb19d('0xe')];if(_[_0xb19d('0xf')](_0x7ca8b1)){throw new Error(_0xb19d('0x10'));}var _0x2cd7d5=_0x74251a[_0xb19d('0xd')];var _0x25d63f=_0x74251a['data2'];var _0x26c2bb=_0x2cd7d5[_0xb19d('0x11')]('-')[0x4];var _0x131486=_0x2cd7d5[_0xb19d('0x11')]('-')[0x0];var _0x3454d0=encryptor[_0xb19d('0x12')](_0x7ca8b1,util['format']('%s:%s:%s',_0x26c2bb,_0x2cd7d5,_0x131486));var _0x1f221b=JSON['parse'](_0x3454d0);_0x1f221b[_0xb19d('0x13')]=![];_0x1f221b['uuid']=_0x2cd7d5;_0x1f221b[_0xb19d('0x14')]=hardware[_0xb19d('0x7')]();if(_0x25d63f){var _0x59b83a=encryptor['decryptString'](_0x25d63f);_0x1f221b['gray']=_0x59b83a;_0x1f221b[_0xb19d('0x15')]=moment(_0x59b83a)[_0xb19d('0x16')](0x7,_0xb19d('0x17'))[_0xb19d('0x18')]();_0x1f221b['grayReason']=_0x1f221b[_0xb19d('0x19')]!=_0x1f221b[_0xb19d('0x14')]?_0xb19d('0x1a'):_0xb19d('0x1b');}return _0x1f221b;}catch(_0x5524e3){breakingLicense[_0xb19d('0x19')]=_0x74251a[_0xb19d('0xd')];breakingLicense['message']=_0x5524e3['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1b53eb,_0x4c7995){getLicense()[_0xb19d('0xb')](function(_0x116377){return db[_0xb19d('0x1c')]['findAll']({'attributes':[_0xb19d('0x1d'),[db[_0xb19d('0x1e')]['fn']('COUNT',db[_0xb19d('0x1e')][_0xb19d('0x1f')]('role')),_0xb19d('0x20')]],'group':'role','where':{'role':{'$or':['admin',_0xb19d('0x21'),_0xb19d('0x22')]}},'raw':!![]})[_0xb19d('0xb')](function(_0x565bd4){var _0x3a67c4={'user':_0x116377[_0xb19d('0x23')]||0x0,'telephone':_0x116377[_0xb19d('0x24')]||0x0};_0x565bd4[_0xb19d('0x25')](function(_0x1669ab){var _0x41870d=_0x1669ab[_0xb19d('0x1d')]===_0xb19d('0x26')?_0xb19d('0x21'):_0x1669ab[_0xb19d('0x1d')];_0x3a67c4[_0x41870d]-=_0x1669ab['count'];if(_0x3a67c4[_0x41870d]<0x0)_0x3a67c4[_0x41870d]=0x0;});_0x1b53eb(_0x3a67c4);return;});})['catch'](function(_0x25f27c){_0x4c7995(_0x25f27c);});});}function checkUserLimits(_0x1d392e){return new BPromise(function(_0x2dc2d4,_0x2e0d3f){getLimits()['then'](function(_0xbf0bc3){var _0x4e36b1=_['pick'](_['countBy'](_0x1d392e,_0xb19d('0x1d')),[_0xb19d('0x26'),_0xb19d('0x21'),_0xb19d('0x22')]);var _0x3b386a=(_0x4e36b1[_0xb19d('0x26')]||0x0)+(_0x4e36b1[_0xb19d('0x21')]||0x0);var _0x128316=_0x4e36b1[_0xb19d('0x22')]||0x0;if(_0x3b386a>_0xbf0bc3['user'])return _0x2e0d3f('License\x20limit\x20reached\x20for\x20users');if(_0x128316>_0xbf0bc3['telephone'])return _0x2e0d3f(_0xb19d('0x27'));return _0x2dc2d4();})['catch'](function(_0x42bd1a){_0x2e0d3f(_0x42bd1a);});});}module[_0xb19d('0x28')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0794=['License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','parse','machineUuid','decryptString','deadline','add','days','changed','disabled','message','User','findAll','sequelize','col','role','admin','users','telephones','forEach','user','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid'];(function(_0x9f140b,_0x1b5921){var _0x200190=function(_0x329ba5){while(--_0x329ba5){_0x9f140b['push'](_0x9f140b['shift']());}};_0x200190(++_0x1b5921);}(_0x0794,0xfc));var _0x4079=function(_0x7d061a,_0x1a35a5){_0x7d061a=_0x7d061a-0x0;var _0x42596a=_0x0794[_0x7d061a];return _0x42596a;};'use strict';var util=require(_0x4079('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x4079('0x1'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x4079('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4079('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4079('0x4'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4079('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x4079('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2e6774){return new BPromise(function(_0x3a2a91,_0x4ae93c){return db[_0x4079('0x6')][_0x4079('0x7')](_[_0x4079('0x8')](_0x2e6774,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4ee193){return checkLicense(_0x4ee193,null);})[_0x4079('0x9')](function(_0x244ff0){_0x3a2a91(_0x244ff0);return;})[_0x4079('0xa')](function(_0xdb6114){_0x4ae93c(_0xdb6114);});});}function checkLicense(_0x4fe3d8,_0x32547b){if(!_0x4fe3d8){demoLicense[_0x4079('0xb')]=_0x4fe3d8[_0x4079('0xc')];return demoLicense;}try{var _0x2192c2=_0x32547b||_0x4fe3d8[_0x4079('0xd')];if(_[_0x4079('0xe')](_0x2192c2)){throw new Error(_0x4079('0xf'));}var _0x520c56=_0x4fe3d8[_0x4079('0xc')];var _0x365472=_0x4fe3d8['data2'];var _0x247f1d=_0x520c56[_0x4079('0x10')]('-')[0x4];var _0x586e95=_0x520c56['split']('-')[0x0];var _0x316a53=encryptor['decryptString'](_0x2192c2,util['format']('%s:%s:%s',_0x247f1d,_0x520c56,_0x586e95));var _0x4396e8=JSON[_0x4079('0x11')](_0x316a53);_0x4396e8['demo']=![];_0x4396e8['uuid']=_0x520c56;_0x4396e8[_0x4079('0x12')]=hardware[_0x4079('0x5')]();if(_0x365472){var _0x5085c3=encryptor[_0x4079('0x13')](_0x365472);_0x4396e8['gray']=_0x5085c3;_0x4396e8[_0x4079('0x14')]=moment(_0x5085c3)[_0x4079('0x15')](0x7,_0x4079('0x16'))['format']();_0x4396e8['grayReason']=_0x4396e8['uuid']!=_0x4396e8[_0x4079('0x12')]?_0x4079('0x17'):_0x4079('0x18');}return _0x4396e8;}catch(_0x4492c8){breakingLicense['uuid']=_0x4fe3d8[_0x4079('0xc')];breakingLicense[_0x4079('0x19')]=_0x4492c8['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x239b3c,_0x152839){getLicense()['then'](function(_0x381dbc){return db[_0x4079('0x1a')][_0x4079('0x1b')]({'attributes':['role',[db['sequelize']['fn']('COUNT',db[_0x4079('0x1c')][_0x4079('0x1d')]('role')),'count']],'group':_0x4079('0x1e'),'where':{'role':{'$or':[_0x4079('0x1f'),'user','telephone']}},'raw':!![]})[_0x4079('0x9')](function(_0x2c6e36){var _0xf04814={'user':_0x381dbc[_0x4079('0x20')]||0x0,'telephone':_0x381dbc[_0x4079('0x21')]||0x0};_0x2c6e36[_0x4079('0x22')](function(_0x316f6c){var _0x290264=_0x316f6c[_0x4079('0x1e')]==='admin'?_0x4079('0x23'):_0x316f6c[_0x4079('0x1e')];_0xf04814[_0x290264]-=_0x316f6c[_0x4079('0x24')];if(_0xf04814[_0x290264]<0x0)_0xf04814[_0x290264]=0x0;});_0x239b3c(_0xf04814);return;});})[_0x4079('0xa')](function(_0x2e1a74){_0x152839(_0x2e1a74);});});}function checkUserLimits(_0x315b0a){return new BPromise(function(_0x4d8e1e,_0x161e67){getLimits()[_0x4079('0x9')](function(_0x5148e9){var _0x18856f=_[_0x4079('0x25')](_[_0x4079('0x26')](_0x315b0a,_0x4079('0x1e')),['admin',_0x4079('0x23'),'telephone']);var _0x5cdb19=(_0x18856f[_0x4079('0x1f')]||0x0)+(_0x18856f['user']||0x0);var _0x3a4d33=_0x18856f[_0x4079('0x27')]||0x0;if(_0x5cdb19>_0x5148e9[_0x4079('0x23')])return _0x161e67(_0x4079('0x28'));if(_0x3a4d33>_0x5148e9[_0x4079('0x27')])return _0x161e67(_0x4079('0x29'));return _0x4d8e1e();})['catch'](function(_0x3f2d0e){_0x161e67(_0x3f2d0e);});});}module[_0x4079('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 4fa2b7c..eb835af 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 _0x5204=['http://localhost:9000','app-id','secret','exports'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x5204,0xdf));var _0x4520=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x5204[_0x9d14e3];return _0x19bf32;};'use strict';module[_0x4520('0x0')]={'DOMAIN':_0x4520('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4520('0x2'),'GOOGLE_SECRET':_0x4520('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x84a0=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x4a3ea8,_0x3e6a1d){var _0x13cba1=function(_0x475ba3){while(--_0x475ba3){_0x4a3ea8['push'](_0x4a3ea8['shift']());}};_0x13cba1(++_0x3e6a1d);}(_0x84a0,0x66));var _0x084a=function(_0x1b3335,_0x2b2f52){_0x1b3335=_0x1b3335-0x0;var _0x300d95=_0x84a0[_0x1b3335];return _0x300d95;};'use strict';module[_0x084a('0x0')]={'DOMAIN':_0x084a('0x1'),'SESSION_SECRET':_0x084a('0x2'),'GOOGLE_ID':_0x084a('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 292ce9a..79b0b52 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f53=['fileLogger','exports','../utils/loggers'];(function(_0x565a70,_0x2c4aec){var _0x4fe73a=function(_0x262138){while(--_0x262138){_0x565a70['push'](_0x565a70['shift']());}};_0x4fe73a(++_0x2c4aec);}(_0x4f53,0x1df));var _0x34f5=function(_0xe1f088,_0x40713e){_0xe1f088=_0xe1f088-0x0;var _0x56328d=_0x4f53[_0xe1f088];return _0x56328d;};'use strict';var fileLogger=require(_0x34f5('0x0'))[_0x34f5('0x1')];module[_0x34f5('0x2')]=fileLogger; \ No newline at end of file +var _0x09c5=['exports','fileLogger'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x09c5,0x183));var _0x509c=function(_0x212579,_0xdb4d5a){_0x212579=_0x212579-0x0;var _0x55d50e=_0x09c5[_0x212579];return _0x55d50e;};'use strict';var fileLogger=require('../utils/loggers')[_0x509c('0x0')];module[_0x509c('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a58fdc7..b067a7f 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 _0x7f2a=['email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','root','legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js'];(function(_0x472a4d,_0x3c3c00){var _0x2b75bf=function(_0x3b6680){while(--_0x3b6680){_0x472a4d['push'](_0x472a4d['shift']());}};_0x2b75bf(++_0x3c3c00);}(_0x7f2a,0x86));var _0xa7f2=function(_0x5be652,_0x85d008){_0x5be652=_0x5be652-0x0;var _0x50775a=_0x7f2a[_0x5be652];return _0x50775a;};'use strict';var path=require(_0xa7f2('0x0'));var cfg=require(_0xa7f2('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0xa7f2('0x2')],_0xa7f2('0x3')))};var pm2config={'apps':[{'name':_0xa7f2('0x4'),'script':path[_0xa7f2('0x5')](__dirname,_0xa7f2('0x6')),'env':env},{'name':_0xa7f2('0x7'),'script':path[_0xa7f2('0x5')](__dirname,_0xa7f2('0x8')),'env':env},{'name':'agi','script':path[_0xa7f2('0x5')](__dirname,_0xa7f2('0x9')),'env':env},{'name':_0xa7f2('0xa'),'script':path[_0xa7f2('0x5')](__dirname,_0xa7f2('0xb')),'env':env},{'name':_0xa7f2('0xc'),'script':path[_0xa7f2('0x5')](__dirname,_0xa7f2('0xd')),'env':env},{'name':'xdr','script':path['join'](__dirname,_0xa7f2('0xe')),'env':env}]};module[_0xa7f2('0xf')]=pm2config; \ No newline at end of file +var _0xe57e=['path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports'];(function(_0x5f1292,_0x8fa358){var _0x3abdf2=function(_0x563664){while(--_0x563664){_0x5f1292['push'](_0x5f1292['shift']());}};_0x3abdf2(++_0x8fa358);}(_0xe57e,0x110));var _0xee57=function(_0x4c1769,_0x49036f){_0x4c1769=_0x4c1769-0x0;var _0x5aa20a=_0xe57e[_0x4c1769];return _0x5aa20a;};'use strict';var path=require(_0xee57('0x0'));var cfg=require(_0xee57('0x1'));var env={'NODE_PATH':path[_0xee57('0x2')](path[_0xee57('0x3')](cfg[_0xee57('0x4')],_0xee57('0x5')))};var pm2config={'apps':[{'name':_0xee57('0x6'),'script':path[_0xee57('0x3')](__dirname,_0xee57('0x7')),'env':env},{'name':'ami','script':path['join'](__dirname,_0xee57('0x8')),'env':env},{'name':'agi','script':path[_0xee57('0x3')](__dirname,_0xee57('0x9')),'env':env},{'name':_0xee57('0xa'),'script':path[_0xee57('0x3')](__dirname,_0xee57('0xb')),'env':env},{'name':_0xee57('0xc'),'script':path[_0xee57('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xee57('0xd'),'script':path[_0xee57('0x3')](__dirname,_0xee57('0xe')),'env':env}]};module[_0xee57('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 24f88c5..ee43f98 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 _0xb6c9=['delete','dump','saved','pm2','bluebird','./config','connect','start','then','stop','disconnect','restart','describe'];(function(_0x335b32,_0xa4a93e){var _0xeb4a45=function(_0xcccd75){while(--_0xcccd75){_0x335b32['push'](_0x335b32['shift']());}};_0xeb4a45(++_0xa4a93e);}(_0xb6c9,0x114));var _0x9b6c=function(_0x15fa77,_0x93eaff){_0x15fa77=_0x15fa77-0x0;var _0x1385ff=_0xb6c9[_0x15fa77];return _0x1385ff;};'use strict';var pm2=require(_0x9b6c('0x0'));var BPromise=require(_0x9b6c('0x1'));var config=require(_0x9b6c('0x2'));function connect(){return new BPromise(function(_0x5fb9ee,_0x30f7c9){return pm2[_0x9b6c('0x3')](function(_0x503813){if(_0x503813){return _0x30f7c9(_0x503813);}return _0x5fb9ee('connected');});});};exports[_0x9b6c('0x4')]=function(_0x169205){return connect()[_0x9b6c('0x5')](function(){return new BPromise(function(_0x49cb2f,_0xa7f049){return pm2[_0x9b6c('0x4')](_0x169205,function(_0x1e946e,_0x199974){if(_0x1e946e){return _0xa7f049(_0x1e946e);}pm2['disconnect']();return _0x49cb2f(_0x199974);});});});};exports[_0x9b6c('0x6')]=function(_0x68ddea){return connect()[_0x9b6c('0x5')](function(){return new BPromise(function(_0x324712,_0xfd5541){return pm2[_0x9b6c('0x6')](_0x68ddea,function(_0x239006,_0x568115){if(_0x239006){return _0xfd5541(_0x239006);}pm2[_0x9b6c('0x7')]();return _0x324712(_0x568115);});});});};exports['restart']=function(_0x42372e){return connect()[_0x9b6c('0x5')](function(){return new BPromise(function(_0x391ed4,_0x2b42f1){return pm2[_0x9b6c('0x8')](_0x42372e,function(_0x334780,_0x37ff36){if(_0x334780){return _0x2b42f1(_0x334780);}pm2[_0x9b6c('0x7')]();return _0x391ed4(_0x37ff36);});});});};exports['list']=function(){return connect()[_0x9b6c('0x5')](function(){return new BPromise(function(_0x3ce319,_0x31b93f){return pm2['list'](function(_0x3e38b7,_0x1e1489){if(_0x3e38b7){return _0x31b93f(_0x3e38b7);}pm2[_0x9b6c('0x7')]();return _0x3ce319(_0x1e1489);});});});};exports[_0x9b6c('0x9')]=function(_0x2ca135){return connect()[_0x9b6c('0x5')](function(){return new BPromise(function(_0x1485c3,_0x2df5c4){return pm2[_0x9b6c('0x9')](_0x2ca135,function(_0x546ab0,_0x8335b2){if(_0x546ab0){return _0x2df5c4(_0x546ab0);}pm2['disconnect']();return _0x1485c3(_0x8335b2);});});});};exports[_0x9b6c('0xa')]=function(_0x37413e){return connect()[_0x9b6c('0x5')](function(){return new BPromise(function(_0x45ff75,_0x3729b9){return pm2[_0x9b6c('0xa')](_0x37413e,function(_0x4114f9,_0x475b36){if(_0x4114f9){return _0x3729b9(_0x4114f9);}pm2[_0x9b6c('0x7')]();return _0x45ff75(_0x475b36);});});});};exports['dump']=function(){return connect()[_0x9b6c('0x5')](function(){return new BPromise(function(_0xdefd3e,_0x5fc183){return pm2[_0x9b6c('0xb')](function(_0x188481){if(_0x188481){return _0x5fc183(_0x188481);}return _0xdefd3e(_0x9b6c('0xc'));});});});}; \ No newline at end of file +var _0xe792=['list','describe','delete','dump','saved','bluebird','./config','connected','start','then','stop','disconnect','restart'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe792,0x13d));var _0x2e79=function(_0x350aa3,_0x40a901){_0x350aa3=_0x350aa3-0x0;var _0x570a10=_0xe792[_0x350aa3];return _0x570a10;};'use strict';var pm2=require('pm2');var BPromise=require(_0x2e79('0x0'));var config=require(_0x2e79('0x1'));function connect(){return new BPromise(function(_0x310872,_0x240a27){return pm2['connect'](function(_0x539c9e){if(_0x539c9e){return _0x240a27(_0x539c9e);}return _0x310872(_0x2e79('0x2'));});});};exports[_0x2e79('0x3')]=function(_0x47528c){return connect()[_0x2e79('0x4')](function(){return new BPromise(function(_0x40b299,_0x40a2d3){return pm2[_0x2e79('0x3')](_0x47528c,function(_0x25e923,_0x40a58e){if(_0x25e923){return _0x40a2d3(_0x25e923);}pm2['disconnect']();return _0x40b299(_0x40a58e);});});});};exports['stop']=function(_0x5335a6){return connect()['then'](function(){return new BPromise(function(_0x358172,_0x3573be){return pm2[_0x2e79('0x5')](_0x5335a6,function(_0x1ba595,_0x25348c){if(_0x1ba595){return _0x3573be(_0x1ba595);}pm2[_0x2e79('0x6')]();return _0x358172(_0x25348c);});});});};exports[_0x2e79('0x7')]=function(_0x259c61){return connect()[_0x2e79('0x4')](function(){return new BPromise(function(_0x150873,_0x29f20a){return pm2[_0x2e79('0x7')](_0x259c61,function(_0x544412,_0x2c4205){if(_0x544412){return _0x29f20a(_0x544412);}pm2[_0x2e79('0x6')]();return _0x150873(_0x2c4205);});});});};exports[_0x2e79('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5ec781,_0x151981){return pm2[_0x2e79('0x8')](function(_0x458f53,_0x59c182){if(_0x458f53){return _0x151981(_0x458f53);}pm2[_0x2e79('0x6')]();return _0x5ec781(_0x59c182);});});});};exports[_0x2e79('0x9')]=function(_0x129bb7){return connect()[_0x2e79('0x4')](function(){return new BPromise(function(_0x19b83d,_0x86596b){return pm2['describe'](_0x129bb7,function(_0x1d9454,_0x44c452){if(_0x1d9454){return _0x86596b(_0x1d9454);}pm2[_0x2e79('0x6')]();return _0x19b83d(_0x44c452);});});});};exports[_0x2e79('0xa')]=function(_0xbef2fa){return connect()[_0x2e79('0x4')](function(){return new BPromise(function(_0x19fa68,_0x479b58){return pm2[_0x2e79('0xa')](_0xbef2fa,function(_0x1558cc,_0x313ca8){if(_0x1558cc){return _0x479b58(_0x1558cc);}pm2[_0x2e79('0x6')]();return _0x19fa68(_0x313ca8);});});});};exports[_0x2e79('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3fed37,_0xb6ca81){return pm2[_0x2e79('0xb')](function(_0x2566fc){if(_0x2566fc){return _0xb6ca81(_0x2566fc);}return _0x3fed37(_0x2e79('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 2d92bd4..60be109 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 _0xd71c=['defaults','localhost','socket.io-emitter','then','chatTimeout','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','schedule','redis'];(function(_0x10348b,_0x48d5c2){var _0x5c74f9=function(_0x30fb05){while(--_0x30fb05){_0x10348b['push'](_0x10348b['shift']());}};_0x5c74f9(++_0x48d5c2);}(_0xd71c,0x145));var _0xcd71=function(_0x13e9cf,_0x32a3dc){_0x13e9cf=_0x13e9cf-0x0;var _0x521a43=_0xd71c[_0x13e9cf];return _0x521a43;};'use strict';var _=require(_0xcd71('0x0'));var moment=require(_0xcd71('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xcd71('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xcd71('0x3'));config[_0xcd71('0x4')]=_[_0xcd71('0x5')](config['redis'],{'host':_0xcd71('0x6'),'port':0x18eb});var io=require(_0xcd71('0x7'))(new Redis(config[_0xcd71('0x4')]));function closeInteractions(){var _0x50ff13=0x0;var _0x260037=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xcd71('0x8')](function(_0x2247a4){_0x50ff13=_0x2247a4[_0xcd71('0x9')];if(_0x50ff13){return db['ChatInteraction'][_0xcd71('0xa')]({'raw':!![],'attributes':['id',_0xcd71('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xcd71('0xc')](_0x2247a4[_0xcd71('0x9')],_0xcd71('0xd'))}}});}else{return[];}})[_0xcd71('0x8')](function(_0x1e4748){if(_0x1e4748&&_0x1e4748[_0xcd71('0xe')]){_0x260037=_[_0xcd71('0xf')](_0x1e4748||[],'id');logger[_0xcd71('0x10')](_0xcd71('0x11'),_0x260037[_0xcd71('0x12')]());return db[_0xcd71('0x13')]['update']({'closeReason':_0xcd71('0x14'),'disposition':_0xcd71('0x15'),'closed':!![],'closedAt':moment()[_0xcd71('0x16')](_0xcd71('0x17'))},{'where':{'id':_0x260037}});}})[_0xcd71('0x8')](function(){if(_0x260037&&_0x260037['length']){logger[_0xcd71('0x10')](_0xcd71('0x18'),_0x260037[_0xcd71('0x12')]());for(var _0x14a9f4=0x0;_0x14a9f4<_0x260037['length'];_0x14a9f4++){io['emit'](_0xcd71('0x19'),{'id':_0x260037[_0x14a9f4],'closed':!![]});}}})['catch'](function(_0x17a26d){logger[_0xcd71('0x1a')](_0xcd71('0x1b'),_0x17a26d?util[_0xcd71('0x1c')](_0x17a26d,{'showHidden':![],'depth':null}):'');});}exports[_0xcd71('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x589e=['localhost','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','defaults','redis'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x589e,0x1a7));var _0xe589=function(_0x32d5dc,_0x46c77f){_0x32d5dc=_0x32d5dc-0x0;var _0x2cb077=_0x589e[_0x32d5dc];return _0x2cb077;};'use strict';var _=require(_0xe589('0x0'));var moment=require(_0xe589('0x1'));var Redis=require(_0xe589('0x2'));var util=require(_0xe589('0x3'));var config=require(_0xe589('0x4'));var db=require(_0xe589('0x5'))['db'];var logger=require('../logger')(_0xe589('0x6'));config['redis']=_[_0xe589('0x7')](config[_0xe589('0x8')],{'host':_0xe589('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe589('0x8')]));function closeInteractions(){var _0x4e5466=0x0;var _0xb9d48f=[];return db[_0xe589('0xa')][_0xe589('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0xae7f1f){_0x4e5466=_0xae7f1f[_0xe589('0xc')];if(_0x4e5466){return db[_0xe589('0xd')][_0xe589('0xe')]({'raw':!![],'attributes':['id',_0xe589('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe589('0x10')](_0xae7f1f[_0xe589('0xc')],_0xe589('0x11'))}}});}else{return[];}})[_0xe589('0x12')](function(_0x433151){if(_0x433151&&_0x433151[_0xe589('0x13')]){_0xb9d48f=_[_0xe589('0x14')](_0x433151||[],'id');logger[_0xe589('0x15')](_0xe589('0x16'),_0xb9d48f[_0xe589('0x17')]());return db[_0xe589('0xd')][_0xe589('0x18')]({'closeReason':_0xe589('0x19'),'disposition':_0xe589('0x1a'),'closed':!![],'closedAt':moment()[_0xe589('0x1b')](_0xe589('0x1c'))},{'where':{'id':_0xb9d48f}});}})['then'](function(){if(_0xb9d48f&&_0xb9d48f[_0xe589('0x13')]){logger[_0xe589('0x15')](_0xe589('0x1d'),_0xb9d48f[_0xe589('0x17')]());for(var _0x3e396d=0x0;_0x3e396d<_0xb9d48f[_0xe589('0x13')];_0x3e396d++){io[_0xe589('0x1e')](_0xe589('0x1f'),{'id':_0xb9d48f[_0x3e396d],'closed':!![]});}}})['catch'](function(_0x43e0dc){logger[_0xe589('0x20')](_0xe589('0x21'),_0x43e0dc?util[_0xe589('0x22')](_0x43e0dc,{'showHidden':![],'depth':null}):'');});}exports[_0xe589('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index d8e4b7d..27f80db 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 _0x8703=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8703,0xab));var _0x3870=function(_0x499196,_0x8f554e){_0x499196=_0x499196-0x0;var _0x4c8b13=_0x8703[_0x499196];return _0x4c8b13;};'use strict';function start(){var _0x4394cc=require(_0x3870('0x0'));return _0x4394cc['startAllRefreshIntervals']();}module[_0x3870('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xb875=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x13ba21,_0x190d6e){var _0x4307f6=function(_0x231122){while(--_0x231122){_0x13ba21['push'](_0x13ba21['shift']());}};_0x4307f6(++_0x190d6e);}(_0xb875,0x6a));var _0x5b87=function(_0x4fb05b,_0x2be521){_0x4fb05b=_0x4fb05b-0x0;var _0x6c0e91=_0xb875[_0x4fb05b];return _0x6c0e91;};'use strict';function start(){var _0x20b566=require(_0x5b87('0x0'));return _0x20b566[_0x5b87('0x1')]();}module[_0x5b87('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 9f260f7..066a3ac 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 _0x23bd=['email','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','extname','zip','join','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','data','MailAccount','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','catch','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','stop','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','start','add\x20cron','exists','deleteJob','stop\x20cron','startAt','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x23bd,0x1a0));var _0xd23b=function(_0x457488,_0x142c1b){_0x457488=_0x457488-0x0;var _0x566ec7=_0x23bd[_0x457488];return _0x566ec7;};'use strict';var fs=require('fs');var util=require(_0xd23b('0x0'));var path=require(_0xd23b('0x1'));var _=require(_0xd23b('0x2'));var moment=require(_0xd23b('0x3'));var CronJobManager=require(_0xd23b('0x4'));var jayson=require(_0xd23b('0x5'));var BPromise=require(_0xd23b('0x6'));var logger=require(_0xd23b('0x7'))(_0xd23b('0x8'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xd23b('0x9'));var analyticDefaultReportController=require(_0xd23b('0xa'));var client=jayson[_0xd23b('0xb')][_0xd23b('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4106ef,_0x2a06de){return function(){logger['info'](_0xd23b('0xd'),_0x4106ef[_0xd23b('0xe')]);var _0x275266=!![];var _0x33fc36=_0x4106ef['MailAccount']['getSmtpOptions']();var _0x58d0f8={'account':_0x33fc36,'message':{'from':util[_0xd23b('0xf')](_0xd23b('0x10'),_0x4106ef['MailAccount'][_0xd23b('0x11')],_0x4106ef['MailAccount']['email']||_0x4106ef['MailAccount'][_0xd23b('0x12')][_0xd23b('0x13')]),'to':_0x4106ef['email'],'cc':_0x4106ef['cc'],'bcc':_0x4106ef[_0xd23b('0x14')],'subject':util['format'](_0xd23b('0x15'),_0x2a06de[_0xd23b('0x11')],_0x4106ef[_0xd23b('0x16')],_0x4106ef[_0xd23b('0x17')])}};var _0x23dba7=path['join'](__dirname,_0xd23b('0x18'));var _0x198ad0=_0x2a06de[_0xd23b('0x19')];var _0x307f53=util[_0xd23b('0xf')]('%s.%s',path['basename'](_0x2a06de[_0xd23b('0x19')],path[_0xd23b('0x1a')](_0x2a06de[_0xd23b('0x19')])),_0xd23b('0x1b'));var _0x2e7e0e=path[_0xd23b('0x1c')](_0x23dba7,_0x198ad0);var _0x56c36e=path['join'](_0x23dba7,_0x307f53);if(fs['existsSync'](_0x2e7e0e)){_0x2a06de['status']='Sent';_0x58d0f8[_0xd23b('0x1d')][_0xd23b('0x1e')]=[{'filename':_0x198ad0,'path':_0x2e7e0e}];_0x58d0f8[_0xd23b('0x1d')]['text']=util['format'](_0xd23b('0x1f'),JSON[_0xd23b('0x20')](_0x2a06de,null,0x2));}else if(fs[_0xd23b('0x21')](_0x56c36e)){_0x2a06de[_0xd23b('0x22')]=_0xd23b('0x23');_0x58d0f8[_0xd23b('0x1d')][_0xd23b('0x1e')]=[{'filename':_0x307f53,'path':_0x56c36e}];}else{_0x58d0f8[_0xd23b('0x1d')]['text']=_0xd23b('0x24');if(!_0x4106ef[_0xd23b('0x25')]){_0x275266=![];logger[_0xd23b('0x26')](_0xd23b('0x27'));}}if(_0x275266){return client['request'](_0xd23b('0x28'),_0x58d0f8)[_0xd23b('0x29')](function(_0x3eb87a){if(_0x3eb87a[_0xd23b('0x2a')]){return logger[_0xd23b('0x2a')](_0xd23b('0x2b'),JSON[_0xd23b('0x20')](_0x3eb87a));}return logger['info'](_0xd23b('0x2c'));})['catch'](function(_0x115890){return logger[_0xd23b('0x2a')](_0xd23b('0x2b'),JSON[_0xd23b('0x20')](_0x115890));});}};}function handleError(){return function(_0x407273){return logger[_0xd23b('0x2a')](JSON[_0xd23b('0x20')](_0x407273));};}function handleResult(_0x42ef67){return function(_0x230a6a){logger[_0xd23b('0x26')](_0xd23b('0x2d'),JSON[_0xd23b('0x20')](_0x230a6a));if(_0x42ef67['MailAccount']&&_0x42ef67[_0xd23b('0x2e')][_0xd23b('0x12')]&&!_[_0xd23b('0x2f')](_0x42ef67[_0xd23b('0xe')])){setTimeout(handleSendEmail(_0x42ef67,_0x230a6a),0x3c*0x3e8);}};}function handleJob(_0x42906b){return function(){try{if(_[_0xd23b('0x2f')](_0x42906b[_0xd23b('0x16')])){return logger[_0xd23b('0x26')](_0xd23b('0x30'));}if(_['isNil'](_0x42906b[_0xd23b('0x17')])){return logger[_0xd23b('0x26')](_0xd23b('0x31'));}var _0x35bec6={'startDate':moment()['subtract'](_0x42906b['subtractNumber'],_0x42906b[_0xd23b('0x17')])[_0xd23b('0xf')](_0xd23b('0x32')),'endDate':moment()[_0xd23b('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xd23b('0x33'),'output':_0x42906b[_0xd23b('0x34')],'name':_0x42906b[_0xd23b('0x11')]};if(!_[_0xd23b('0x2f')](_0x42906b[_0xd23b('0x35')])){logger[_0xd23b('0x26')]('exec\x20defaul\x20report\x20id:%s',_0x42906b['DefaultReportId']);return analyticDefaultReportController[_0xd23b('0x36')]({'id':_0x42906b[_0xd23b('0x35')]},_0x35bec6)[_0xd23b('0x29')](handleResult(_0x42906b))['catch'](handleError());}if(!_[_0xd23b('0x2f')](_0x42906b['CustomReportId'])){logger[_0xd23b('0x26')](_0xd23b('0x37'),_0x42906b[_0xd23b('0x38')]);return analyticCustomReportController[_0xd23b('0x36')]({'id':_0x42906b[_0xd23b('0x38')]},_0x35bec6)['then'](handleResult(_0x42906b))[_0xd23b('0x39')](handleError());}}catch(_0x1280fb){logger['error'](JSON[_0xd23b('0x20')](_0x1280fb));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x526eee){var _0x2dc356={};if(_0x526eee){_0x2dc356['id']=_0x526eee;}return db[_0xd23b('0x3a')]['findAll']({'where':_0x2dc356,'include':[{'model':db[_0xd23b('0x2e')],'attributes':['id','name',_0xd23b('0xe')],'include':[{'model':db[_0xd23b('0x3b')],'as':_0xd23b('0x12'),'include':[{'model':db[_0xd23b('0x3c')],'as':'CloudProvider'}]}]}]})[_0xd23b('0x29')](function(_0xed18e3){var _0x4c7d46=_[_0xd23b('0x3d')](manager[_0xd23b('0x3e')]);var _0xd3b4aa=_[_0xd23b('0x3f')](_0xed18e3,function(_0x1c1cd3){return _0x1c1cd3['id'][_0xd23b('0x40')]();});var _0xfa58d8=_[_0xd23b('0x41')](_0xed18e3,function(_0x14935c){return _0x14935c['id']['toString']();});var _0x33ab87=_0x526eee?_0xd3b4aa:_[_0xd23b('0x42')](_0xd3b4aa,_0x4c7d46);var _0x169299=_[_0xd23b('0x43')](_0xd3b4aa,_0x4c7d46);var _0x5e5acb=_['difference'](_0x4c7d46,_0xd3b4aa);var _0x5b8a0a;var _0x5cc87b;for(_0x5b8a0a=0x0;_0x5b8a0a<_0x5e5acb[_0xd23b('0x44')]&&!_0x526eee;_0x5b8a0a+=0x1){_0x5cc87b=_0x5e5acb[_0x5b8a0a]['toString']();if(manager['exists'](_0x5cc87b)){manager[_0xd23b('0x45')](_0x5cc87b);manager['deleteJob'](_0x5cc87b);logger[_0xd23b('0x26')]('delete\x20cron',_0x5cc87b);}}logger[_0xd23b('0x26')](_0xd23b('0x46'),JSON[_0xd23b('0x20')](_0x33ab87));for(_0x5b8a0a=0x0;_0x5b8a0a<_0x33ab87[_0xd23b('0x44')];_0x5b8a0a+=0x1){_0x5cc87b=_0x33ab87[_0x5b8a0a][_0xd23b('0x40')]();logger[_0xd23b('0x26')](_0xd23b('0x47'),_0x5cc87b);if(_0x526eee){logger[_0xd23b('0x26')](_0xd23b('0x48'),_0x526eee);logger[_0xd23b('0x26')](JSON[_0xd23b('0x20')](_0xfa58d8[_0x5cc87b]));BPromise[_0xd23b('0x49')]()[_0xd23b('0x29')](handleJob(_0xfa58d8[_0x5cc87b]));logger['info'](_0xd23b('0x4a'),_0xfa58d8[_0x5cc87b][_0xd23b('0x11')],_0xfa58d8[_0x5cc87b]['cron']);}else if(_0xfa58d8[_0x5cc87b][_0xd23b('0x4b')]&&_0xfa58d8[_0x5cc87b][_0xd23b('0x4c')]&&moment()[_0xd23b('0x4d')](_0xfa58d8[_0x5cc87b]['startAt'],_0xfa58d8[_0x5cc87b][_0xd23b('0x4e')])){manager['add'](_0x5cc87b,_0xfa58d8[_0x5cc87b]['cron'],handleJob(_0xfa58d8[_0x5cc87b]));manager[_0xd23b('0x4f')](_0x5cc87b);logger[_0xd23b('0x26')](_0xd23b('0x50'),_0xfa58d8[_0x5cc87b]['name'],_0xfa58d8[_0x5cc87b]['cron']);}else if(manager[_0xd23b('0x51')](_0x5cc87b)){manager[_0xd23b('0x45')](_0x5cc87b);manager[_0xd23b('0x52')](_0x5cc87b);logger[_0xd23b('0x26')](_0xd23b('0x53'),_0xfa58d8[_0x5cc87b][_0xd23b('0x11')],_0xfa58d8[_0x5cc87b][_0xd23b('0x4b')]);}}for(_0x5b8a0a=0x0,_0x5cc87b;_0x5b8a0a<_0x169299[_0xd23b('0x44')]&&!_0x526eee;_0x5b8a0a+=0x1){_0x5cc87b=_0x169299[_0x5b8a0a][_0xd23b('0x40')]();if(manager[_0xd23b('0x51')](_0x5cc87b)){if(_0xfa58d8[_0x5cc87b]['cron']&&_0xfa58d8[_0x5cc87b][_0xd23b('0x4c')]&&moment()[_0xd23b('0x4d')](_0xfa58d8[_0x5cc87b][_0xd23b('0x54')],_0xfa58d8[_0x5cc87b][_0xd23b('0x4e')])){manager['update'](_0x5cc87b,_0xfa58d8[_0x5cc87b]['cron'],handleJob(_0xfa58d8[_0x5cc87b]));logger['info']('update\x20cron',_0xfa58d8[_0x5cc87b][_0xd23b('0x11')],_0xfa58d8[_0x5cc87b][_0xd23b('0x4b')]);}else{manager[_0xd23b('0x45')](_0x5cc87b);manager['deleteJob'](_0x5cc87b);logger['info'](_0xd23b('0x53'),_0xfa58d8[_0x5cc87b]['name'],_0xfa58d8[_0x5cc87b][_0xd23b('0x4b')]);}}}})[_0xd23b('0x39')](function(_0x20148f){logger[_0xd23b('0x2a')](JSON['stringify'](_0x20148f));});}exports[_0xd23b('0x55')]=function(_0x48e9e4){return getJobs(_0x48e9e4);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0762=['no\x20report\x20id','findAll','MailServerOut','CloudProvider','jobs','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop','stop\x20cron','active','update','update\x20cron','util','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','zip','existsSync','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Sent','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s'];(function(_0x3672d7,_0x4c7eef){var _0xb8fc76=function(_0x269c08){while(--_0x269c08){_0x3672d7['push'](_0x3672d7['shift']());}};_0xb8fc76(++_0x4c7eef);}(_0x0762,0x1d1));var _0x2076=function(_0x1139ea,_0x1e9cc7){_0x1139ea=_0x1139ea-0x0;var _0x2b3ab5=_0x0762[_0x1139ea];return _0x2b3ab5;};'use strict';var fs=require('fs');var util=require(_0x2076('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x2076('0x1'));var CronJobManager=require(_0x2076('0x2'));var jayson=require(_0x2076('0x3'));var BPromise=require(_0x2076('0x4'));var logger=require('../logger')(_0x2076('0x5'));var db=require(_0x2076('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x2076('0x7'));var client=jayson[_0x2076('0x8')][_0x2076('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3f5f70,_0x115776){return function(){logger['info'](_0x2076('0xa'),_0x3f5f70[_0x2076('0xb')]);var _0x1cd426=!![];var _0x76fd37=_0x3f5f70[_0x2076('0xc')][_0x2076('0xd')]();var _0x176fd3={'account':_0x76fd37,'message':{'from':util[_0x2076('0xe')](_0x2076('0xf'),_0x3f5f70[_0x2076('0xc')]['name'],_0x3f5f70[_0x2076('0xc')][_0x2076('0xb')]||_0x3f5f70[_0x2076('0xc')][_0x2076('0x10')]['user']),'to':_0x3f5f70['email'],'cc':_0x3f5f70['cc'],'bcc':_0x3f5f70[_0x2076('0x11')],'subject':util[_0x2076('0xe')](_0x2076('0x12'),_0x115776[_0x2076('0x13')],_0x3f5f70[_0x2076('0x14')],_0x3f5f70[_0x2076('0x15')])}};var _0x37c332=path[_0x2076('0x16')](__dirname,_0x2076('0x17'));var _0x3cc945=_0x115776[_0x2076('0x18')];var _0xd10f78=util[_0x2076('0xe')]('%s.%s',path[_0x2076('0x19')](_0x115776[_0x2076('0x18')],path['extname'](_0x115776[_0x2076('0x18')])),_0x2076('0x1a'));var _0x3842cf=path[_0x2076('0x16')](_0x37c332,_0x3cc945);var _0x21785f=path['join'](_0x37c332,_0xd10f78);if(fs[_0x2076('0x1b')](_0x3842cf)){_0x115776['status']='Sent';_0x176fd3[_0x2076('0x1c')][_0x2076('0x1d')]=[{'filename':_0x3cc945,'path':_0x3842cf}];_0x176fd3[_0x2076('0x1c')][_0x2076('0x1e')]=util['format'](_0x2076('0x1f'),JSON[_0x2076('0x20')](_0x115776,null,0x2));}else if(fs[_0x2076('0x1b')](_0x21785f)){_0x115776[_0x2076('0x21')]=_0x2076('0x22');_0x176fd3[_0x2076('0x1c')][_0x2076('0x1d')]=[{'filename':_0xd10f78,'path':_0x21785f}];}else{_0x176fd3[_0x2076('0x1c')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3f5f70[_0x2076('0x23')]){_0x1cd426=![];logger[_0x2076('0x24')](_0x2076('0x25'));}}if(_0x1cd426){return client[_0x2076('0x26')](_0x2076('0x27'),_0x176fd3)[_0x2076('0x28')](function(_0x11a2b9){if(_0x11a2b9[_0x2076('0x29')]){return logger[_0x2076('0x29')](_0x2076('0x2a'),JSON[_0x2076('0x20')](_0x11a2b9));}return logger[_0x2076('0x24')](_0x2076('0x2b'));})[_0x2076('0x2c')](function(_0x2c7d1b){return logger['error'](_0x2076('0x2a'),JSON['stringify'](_0x2c7d1b));});}};}function handleError(){return function(_0x4347c2){return logger['error'](JSON[_0x2076('0x20')](_0x4347c2));};}function handleResult(_0x3345b1){return function(_0x49a2ab){logger[_0x2076('0x24')](_0x2076('0x2d'),JSON[_0x2076('0x20')](_0x49a2ab));if(_0x3345b1[_0x2076('0xc')]&&_0x3345b1[_0x2076('0xc')][_0x2076('0x10')]&&!_[_0x2076('0x2e')](_0x3345b1[_0x2076('0xb')])){setTimeout(handleSendEmail(_0x3345b1,_0x49a2ab),0x3c*0x3e8);}};}function handleJob(_0x4a75bb){return function(){try{if(_['isNil'](_0x4a75bb[_0x2076('0x14')])){return logger[_0x2076('0x24')](_0x2076('0x2f'));}if(_[_0x2076('0x2e')](_0x4a75bb[_0x2076('0x15')])){return logger[_0x2076('0x24')](_0x2076('0x30'));}var _0x4c9459={'startDate':moment()[_0x2076('0x31')](_0x4a75bb[_0x2076('0x14')],_0x4a75bb[_0x2076('0x15')])[_0x2076('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x2076('0xe')](_0x2076('0x32')),'type':_0x2076('0x33'),'output':_0x4a75bb['output'],'name':_0x4a75bb[_0x2076('0x13')]};if(!_[_0x2076('0x2e')](_0x4a75bb['DefaultReportId'])){logger[_0x2076('0x24')](_0x2076('0x34'),_0x4a75bb['DefaultReportId']);return analyticDefaultReportController[_0x2076('0x35')]({'id':_0x4a75bb[_0x2076('0x36')]},_0x4c9459)[_0x2076('0x28')](handleResult(_0x4a75bb))[_0x2076('0x2c')](handleError());}if(!_[_0x2076('0x2e')](_0x4a75bb[_0x2076('0x37')])){logger[_0x2076('0x24')](_0x2076('0x38'),_0x4a75bb[_0x2076('0x37')]);return analyticCustomReportController[_0x2076('0x35')]({'id':_0x4a75bb[_0x2076('0x37')]},_0x4c9459)[_0x2076('0x28')](handleResult(_0x4a75bb))[_0x2076('0x2c')](handleError());}}catch(_0x5af485){logger[_0x2076('0x29')](JSON[_0x2076('0x20')](_0x5af485));}return logger[_0x2076('0x24')](_0x2076('0x39'));};}function getJobs(_0x25f36b){var _0x17d322={};if(_0x25f36b){_0x17d322['id']=_0x25f36b;}return db['Schedule'][_0x2076('0x3a')]({'where':_0x17d322,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x2076('0xb')],'include':[{'model':db[_0x2076('0x3b')],'as':_0x2076('0x10'),'include':[{'model':db[_0x2076('0x3c')],'as':_0x2076('0x3c')}]}]}]})['then'](function(_0x5db5d3){var _0x1e80f4=_['keys'](manager[_0x2076('0x3d')]);var _0x507e37=_['map'](_0x5db5d3,function(_0x146437){return _0x146437['id']['toString']();});var _0x361086=_[_0x2076('0x3e')](_0x5db5d3,function(_0x2e9e00){return _0x2e9e00['id'][_0x2076('0x3f')]();});var _0x531e75=_0x25f36b?_0x507e37:_[_0x2076('0x40')](_0x507e37,_0x1e80f4);var _0x245ab0=_[_0x2076('0x41')](_0x507e37,_0x1e80f4);var _0x2862d3=_[_0x2076('0x40')](_0x1e80f4,_0x507e37);var _0x4c9c8a;var _0x36c2e4;for(_0x4c9c8a=0x0;_0x4c9c8a<_0x2862d3[_0x2076('0x42')]&&!_0x25f36b;_0x4c9c8a+=0x1){_0x36c2e4=_0x2862d3[_0x4c9c8a][_0x2076('0x3f')]();if(manager[_0x2076('0x43')](_0x36c2e4)){manager['stop'](_0x36c2e4);manager[_0x2076('0x44')](_0x36c2e4);logger[_0x2076('0x24')](_0x2076('0x45'),_0x36c2e4);}}logger[_0x2076('0x24')](_0x2076('0x46'),JSON[_0x2076('0x20')](_0x531e75));for(_0x4c9c8a=0x0;_0x4c9c8a<_0x531e75['length'];_0x4c9c8a+=0x1){_0x36c2e4=_0x531e75[_0x4c9c8a][_0x2076('0x3f')]();logger[_0x2076('0x24')](_0x2076('0x47'),_0x36c2e4);if(_0x25f36b){logger[_0x2076('0x24')](_0x2076('0x48'),_0x25f36b);logger['info'](JSON[_0x2076('0x20')](_0x361086[_0x36c2e4]));BPromise[_0x2076('0x49')]()[_0x2076('0x28')](handleJob(_0x361086[_0x36c2e4]));logger[_0x2076('0x24')](_0x2076('0x4a'),_0x361086[_0x36c2e4][_0x2076('0x13')],_0x361086[_0x36c2e4]['cron']);}else if(_0x361086[_0x36c2e4][_0x2076('0x4b')]&&_0x361086[_0x36c2e4]['active']&&moment()[_0x2076('0x4c')](_0x361086[_0x36c2e4][_0x2076('0x4d')],_0x361086[_0x36c2e4][_0x2076('0x4e')])){manager[_0x2076('0x4f')](_0x36c2e4,_0x361086[_0x36c2e4]['cron'],handleJob(_0x361086[_0x36c2e4]));manager[_0x2076('0x50')](_0x36c2e4);logger['info'](_0x2076('0x51'),_0x361086[_0x36c2e4][_0x2076('0x13')],_0x361086[_0x36c2e4][_0x2076('0x4b')]);}else if(manager[_0x2076('0x43')](_0x36c2e4)){manager[_0x2076('0x52')](_0x36c2e4);manager[_0x2076('0x44')](_0x36c2e4);logger[_0x2076('0x24')](_0x2076('0x53'),_0x361086[_0x36c2e4][_0x2076('0x13')],_0x361086[_0x36c2e4][_0x2076('0x4b')]);}}for(_0x4c9c8a=0x0,_0x36c2e4;_0x4c9c8a<_0x245ab0['length']&&!_0x25f36b;_0x4c9c8a+=0x1){_0x36c2e4=_0x245ab0[_0x4c9c8a][_0x2076('0x3f')]();if(manager['exists'](_0x36c2e4)){if(_0x361086[_0x36c2e4][_0x2076('0x4b')]&&_0x361086[_0x36c2e4][_0x2076('0x54')]&&moment()[_0x2076('0x4c')](_0x361086[_0x36c2e4][_0x2076('0x4d')],_0x361086[_0x36c2e4]['endAt'])){manager[_0x2076('0x55')](_0x36c2e4,_0x361086[_0x36c2e4]['cron'],handleJob(_0x361086[_0x36c2e4]));logger[_0x2076('0x24')](_0x2076('0x56'),_0x361086[_0x36c2e4][_0x2076('0x13')],_0x361086[_0x36c2e4][_0x2076('0x4b')]);}else{manager[_0x2076('0x52')](_0x36c2e4);manager[_0x2076('0x44')](_0x36c2e4);logger[_0x2076('0x24')](_0x2076('0x53'),_0x361086[_0x36c2e4][_0x2076('0x13')],_0x361086[_0x36c2e4]['cron']);}}}})['catch'](function(_0x439a76){logger[_0x2076('0x29')](JSON[_0x2076('0x20')](_0x439a76));});}exports['run']=function(_0x28171b){return getJobs(_0x28171b);};exports[_0x2076('0x50')]=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 c8bf58f..4f87988 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 _0x71f4=['bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Neutral','FailureReason','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','Cloud\x20Provider\x20not\x20available','Sentiment','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','SequelizeValidationError','error','inspect','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language'];(function(_0x1a5566,_0x51c8a5){var _0x1ff161=function(_0x880071){while(--_0x880071){_0x1a5566['push'](_0x1a5566['shift']());}};_0x1ff161(++_0x51c8a5);}(_0x71f4,0xf9));var _0x471f=function(_0x38a3e2,_0x5791d7){_0x38a3e2=_0x38a3e2-0x0;var _0x3d5f1f=_0x71f4[_0x38a3e2];return _0x3d5f1f;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x471f('0x0'));var util=require(_0x471f('0x1'));var BPromise=require(_0x471f('0x2'));var db=require(_0x471f('0x3'))['db'];var logger=require(_0x471f('0x4'))('transcribe');function getTranscriptionJob(_0x453f79,_0x57bbfa,_0x3e0c2e,_0x5978a7){return new Promise(function(_0x1d0101,_0x3bdf82){var _0x155a77=new AWS[(_0x471f('0x5'))]({'accessKeyId':_0x57bbfa,'secretAccessKey':_0x453f79,'region':_0x3e0c2e});_0x155a77[_0x471f('0x6')]({'TranscriptionJobName':_0x5978a7},function(_0x246851,_0x2844e2){if(_0x246851){return _0x3bdf82(_0x246851);}else{return _0x1d0101(_0x2844e2);}});});}function sentiment(_0x3a4fa9,_0x3e59ed,_0x556733,_0x51f77e,_0x519567){return new Promise(function(_0x321e48,_0x22ea73){var _0x55042a=new AWS[(_0x471f('0x7'))]({'accessKeyId':_0x3e59ed,'secretAccessKey':_0x3a4fa9,'region':_0x556733});_0x55042a[_0x471f('0x8')]({'Text':_0x51f77e,'LanguageCode':_0x519567[_0x471f('0x9')](0x0,0x2)},function(_0x4d7364,_0x8b54cb){if(_0x4d7364){return _0x22ea73(_0x4d7364);}else{return _0x321e48(_0x8b54cb);}});});}function checkTranscribeJob(_0x16662a,_0x9f73ca,_0x22651b){var _0xafc5e8;return new BPromise(function(_0x4151c1,_0xdc7747){logger[_0x471f('0xa')](util[_0x471f('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x16662a['id'],_0x16662a[_0x471f('0xc')]));return getTranscriptionJob(_0x22651b['data1'],_0x22651b[_0x471f('0xd')],_0x9f73ca[_0x471f('0xe')],_0x16662a[_0x471f('0xc')])[_0x471f('0xf')](function(_0x117e7f){logger[_0x471f('0xa')](util[_0x471f('0xb')](_0x471f('0x10'),_0x16662a['id'],_0x16662a['transcribeName'],_0x117e7f[_0x471f('0x11')][_0x471f('0x12')]));if(!_0x16662a['fileText']){switch(_0x117e7f[_0x471f('0x11')]['TranscriptionJobStatus']){case _0x471f('0x13'):var _0x4e9833={'transcribeStatus':_0x117e7f[_0x471f('0x11')][_0x471f('0x12')],'fileUri':_0x117e7f[_0x471f('0x11')][_0x471f('0x14')]['TranscriptFileUri']};logger['info'](util[_0x471f('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x16662a['id']));return rp({'uri':_0x117e7f[_0x471f('0x11')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x471f('0xf')](function(_0x2503f4){logger['info'](util[_0x471f('0xb')](_0x471f('0x15'),_0x16662a['id']));if(_0x2503f4&&_0x2503f4[_0x471f('0x16')]&&_0x2503f4['results'][_0x471f('0x17')]&&_0x2503f4[_0x471f('0x16')][_0x471f('0x17')][_0x471f('0x18')]){_0x4e9833[_0x471f('0x19')]='';for(var _0x505ca3=0x0;_0x505ca3<_0x2503f4[_0x471f('0x16')][_0x471f('0x17')]['length'];_0x505ca3++){_0x4e9833['fileText']+=_0x2503f4[_0x471f('0x16')][_0x471f('0x17')][_0x505ca3][_0x471f('0x1a')]+'';}}return _0x16662a[_0x471f('0x1b')](_0x4e9833);})[_0x471f('0xf')](function(){logger[_0x471f('0xa')](util[_0x471f('0xb')](_0x471f('0x1c'),_0x16662a['id']));if(!_0x16662a['tempSentiment']){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x9f73ca[_0x471f('0x1f')]||!_0x9f73ca[_0x471f('0x20')]||!_0x9f73ca[_0x471f('0x21')]||!_0x9f73ca[_0x471f('0x22')]||!_0x9f73ca[_0x471f('0x23')]){throw new db['Sequelize'][(_0x471f('0x1e'))](_0x471f('0x24'));}if(!_0x4e9833['fileText']){throw new Error(_0x471f('0x25'));}if(_0x9f73ca[_0x471f('0x20')]===_0x22651b['id']){return _0x22651b;}else{return db[_0x471f('0x26')][_0x471f('0x27')]({'where':{'id':_settings[_0x471f('0x20')]}});}})[_0x471f('0xf')](function(_0x28392f){if(!_0x28392f){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x28392f['data1']||!_0x28392f[_0x471f('0xd')]){throw new db[(_0x471f('0x1d'))]['ValidationError'](_0x471f('0x28'));}_0xafc5e8=_0x28392f;logger['info'](util[_0x471f('0xb')](_0x471f('0x29'),_0x16662a['id']));return sentiment(_0xafc5e8[_0x471f('0x2a')],_0xafc5e8[_0x471f('0xd')],_0x9f73ca[_0x471f('0x21')],_0x4e9833[_0x471f('0x19')],_0x9f73ca['language']);})[_0x471f('0xf')](function(_0x4fda1b){logger[_0x471f('0xa')](util[_0x471f('0xb')](_0x471f('0x2b'),_0x16662a['id']));return _0x16662a['update']({'sentiment':_0x4fda1b['Sentiment'],'sPositive':_0x4fda1b[_0x471f('0x2c')][_0x471f('0x2d')],'sNegative':_0x4fda1b[_0x471f('0x2c')][_0x471f('0x2e')],'sMixed':_0x4fda1b[_0x471f('0x2c')]['Mixed'],'sNeutral':_0x4fda1b['SentimentScore'][_0x471f('0x2f')]});})[_0x471f('0xf')](function(){logger[_0x471f('0xa')](util['format'](_0x471f('0x1c'),_0x16662a['id']));_0x4151c1();});case'FAILED':return _0x16662a['update']({'transcribeStatus':'FAILED','failureReason':_0x117e7f[_0x471f('0x11')][_0x471f('0x30')]})[_0x471f('0xf')](function(){logger[_0x471f('0xa')](util[_0x471f('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x16662a['id']));_0x4151c1();});default:logger['info'](util[_0x471f('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x16662a['id']));break;}}else{return BPromise[_0x471f('0x31')]()['then'](function(){if(!_0x16662a[_0x471f('0x32')]){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))](_0x471f('0x33'));}if(!_0x9f73ca[_0x471f('0x1f')]||!_0x9f73ca[_0x471f('0x20')]||!_0x9f73ca[_0x471f('0x21')]||!_0x9f73ca[_0x471f('0x22')]||!_0x9f73ca[_0x471f('0x23')]){throw new db[(_0x471f('0x1d'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x16662a[_0x471f('0x19')]){throw new Error(_0x471f('0x25'));}if(_0x9f73ca['sentimentAccountId']===_0x22651b['id']){return _0x22651b;}else{return db['CloudProvider'][_0x471f('0x27')]({'where':{'id':_settings[_0x471f('0x20')]}});}})[_0x471f('0xf')](function(_0x4e37b7){if(!_0x4e37b7){throw new db[(_0x471f('0x1d'))]['ValidationError'](_0x471f('0x34'));}if(!_0x4e37b7[_0x471f('0x2a')]||!_0x4e37b7['data2']){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))](_0x471f('0x28'));}_0xafc5e8=_0x4e37b7;logger[_0x471f('0xa')](util[_0x471f('0xb')](_0x471f('0x29'),_0x16662a['id']));return sentiment(_0xafc5e8[_0x471f('0x2a')],_0xafc5e8['data2'],_0x9f73ca['sentimentRegion'],_0x16662a[_0x471f('0x19')],_0x9f73ca[_0x471f('0x22')]);})[_0x471f('0xf')](function(_0x41ccd5){logger['info'](util[_0x471f('0xb')](_0x471f('0x2b'),_0x16662a['id']));return _0x16662a[_0x471f('0x1b')]({'sentiment':_0x41ccd5[_0x471f('0x35')],'sPositive':_0x41ccd5['SentimentScore'][_0x471f('0x2d')],'sNegative':_0x41ccd5[_0x471f('0x2c')][_0x471f('0x2e')],'sMixed':_0x41ccd5[_0x471f('0x2c')]['Mixed'],'sNeutral':_0x41ccd5['SentimentScore']['Neutral'],'transcribeStatus':_0x471f('0x13')});})[_0x471f('0xf')](function(){logger[_0x471f('0xa')](util[_0x471f('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x16662a['id']));_0x4151c1();});}})[_0x471f('0x36')](function(_0x56d79c){if(_0x56d79c){if(!_0x56d79c[_0x471f('0x37')]||_0x56d79c[_0x471f('0x37')]!=='SequelizeValidationError'){logger['error'](util['format'](_0x471f('0x38'),_0x16662a['id']),util['inspect'](_0x56d79c,{'showHidden':![],'depth':null}));}}_0x4151c1();});});}function checkTranscribe(){var _0x3b758b;var _0x245b1b;var _0x36a9e3;return db[_0x471f('0x39')][_0x471f('0x3a')]({'where':{'transcribeStatus':_0x471f('0x3b')}})[_0x471f('0xf')](function(_0x3a6625){if(!_0x3a6625||!_0x3a6625[_0x471f('0x18')]){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))]('No\x20transcribe\x20job\x20to\x20check');}_0x3b758b=_0x3a6625;return db[_0x471f('0x3c')][_0x471f('0x27')]({'where':{'id':0x1}});})[_0x471f('0xf')](function(_0x136687){if(!_0x136687){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))](_0x471f('0x3d'));}_0x245b1b=_0x136687;if(!_0x245b1b[_0x471f('0x3e')]||!_0x245b1b[_0x471f('0x3f')]||!_0x245b1b['transcribeRegion']||!_0x245b1b['language']||!_0x245b1b[_0x471f('0x23')]){throw new db['Sequelize'][(_0x471f('0x1e'))](_0x471f('0x40'));}return db['CloudProvider']['findOne']({'where':{'id':_0x245b1b[_0x471f('0x3f')]}});})[_0x471f('0xf')](function(_0x1f4e5a){if(!_0x1f4e5a){throw new db['Sequelize'][(_0x471f('0x1e'))](_0x471f('0x34'));}if(!_0x1f4e5a['data1']||!_0x1f4e5a['data2']){throw new db['Sequelize']['ValidationError'](_0x471f('0x28'));}_0x36a9e3=_0x1f4e5a;var _0x14c97c=[];_0x3b758b[_0x471f('0x41')](function(_0x183d2e){_0x14c97c['push'](checkTranscribeJob(_0x183d2e,_0x245b1b,_0x36a9e3));});return BPromise[_0x471f('0x42')](_0x14c97c);})[_0x471f('0x36')](function(_0x34af86){if(_0x34af86){if(!_0x34af86['name']||_0x34af86[_0x471f('0x37')]!==_0x471f('0x43')){logger[_0x471f('0x44')](util[_0x471f('0x45')](_0x34af86,{'showHidden':![],'depth':null}));}}});}exports[_0x471f('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xae87=['[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Neutral','FAILED','resolve','sentiment','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','Sentiment','Negative','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','push','all','catch','error','inspect','start','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','TranscriptFileUri'];(function(_0x5bcec9,_0x135159){var _0x1a6f0d=function(_0x20fbdb){while(--_0x20fbdb){_0x5bcec9['push'](_0x5bcec9['shift']());}};_0x1a6f0d(++_0x135159);}(_0xae87,0x1ce));var _0x7ae8=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xae87[_0x434783];return _0x13efcf;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0x7ae8('0x0'));var db=require(_0x7ae8('0x1'))['db'];var logger=require('../../config/logger')(_0x7ae8('0x2'));function getTranscriptionJob(_0x4a22a5,_0x4ca11e,_0x3b95c1,_0x33b313){return new Promise(function(_0x141978,_0x3b6a2d){var _0x57d2f2=new AWS[(_0x7ae8('0x3'))]({'accessKeyId':_0x4ca11e,'secretAccessKey':_0x4a22a5,'region':_0x3b95c1});_0x57d2f2[_0x7ae8('0x4')]({'TranscriptionJobName':_0x33b313},function(_0x26d4bb,_0x2aa2d5){if(_0x26d4bb){return _0x3b6a2d(_0x26d4bb);}else{return _0x141978(_0x2aa2d5);}});});}function sentiment(_0x1f049b,_0x45dfc2,_0x2138eb,_0x48d84d,_0x4a63d6){return new Promise(function(_0x2cc5f6,_0x334ae7){var _0x595760=new AWS[(_0x7ae8('0x5'))]({'accessKeyId':_0x45dfc2,'secretAccessKey':_0x1f049b,'region':_0x2138eb});_0x595760['detectSentiment']({'Text':_0x48d84d,'LanguageCode':_0x4a63d6[_0x7ae8('0x6')](0x0,0x2)},function(_0x5e7200,_0x24bddd){if(_0x5e7200){return _0x334ae7(_0x5e7200);}else{return _0x2cc5f6(_0x24bddd);}});});}function checkTranscribeJob(_0x4bf950,_0x218df1,_0x428e16){var _0x3e41c1;return new BPromise(function(_0x510852,_0x42af18){logger[_0x7ae8('0x7')](util['format'](_0x7ae8('0x8'),_0x4bf950['id'],_0x4bf950[_0x7ae8('0x9')]));return getTranscriptionJob(_0x428e16[_0x7ae8('0xa')],_0x428e16[_0x7ae8('0xb')],_0x218df1[_0x7ae8('0xc')],_0x4bf950[_0x7ae8('0x9')])[_0x7ae8('0xd')](function(_0x16fbcc){logger[_0x7ae8('0x7')](util[_0x7ae8('0xe')](_0x7ae8('0xf'),_0x4bf950['id'],_0x4bf950[_0x7ae8('0x9')],_0x16fbcc['TranscriptionJob'][_0x7ae8('0x10')]));if(!_0x4bf950[_0x7ae8('0x11')]){switch(_0x16fbcc['TranscriptionJob'][_0x7ae8('0x10')]){case _0x7ae8('0x12'):var _0x408e0b={'transcribeStatus':_0x16fbcc[_0x7ae8('0x13')]['TranscriptionJobStatus'],'fileUri':_0x16fbcc['TranscriptionJob']['Transcript'][_0x7ae8('0x14')]};logger[_0x7ae8('0x7')](util['format'](_0x7ae8('0x15'),_0x4bf950['id']));return rp({'uri':_0x16fbcc['TranscriptionJob'][_0x7ae8('0x16')][_0x7ae8('0x14')],'json':!![]})[_0x7ae8('0xd')](function(_0x35cbed){logger[_0x7ae8('0x7')](util[_0x7ae8('0xe')](_0x7ae8('0x17'),_0x4bf950['id']));if(_0x35cbed&&_0x35cbed[_0x7ae8('0x18')]&&_0x35cbed[_0x7ae8('0x18')][_0x7ae8('0x19')]&&_0x35cbed[_0x7ae8('0x18')][_0x7ae8('0x19')][_0x7ae8('0x1a')]){_0x408e0b[_0x7ae8('0x11')]='';for(var _0x2e11d9=0x0;_0x2e11d9<_0x35cbed['results']['transcripts'][_0x7ae8('0x1a')];_0x2e11d9++){_0x408e0b['fileText']+=_0x35cbed['results'][_0x7ae8('0x19')][_0x2e11d9]['transcript']+'';}}return _0x4bf950[_0x7ae8('0x1b')](_0x408e0b);})[_0x7ae8('0xd')](function(){logger['info'](util[_0x7ae8('0xe')](_0x7ae8('0x1c'),_0x4bf950['id']));if(!_0x4bf950[_0x7ae8('0x1d')]){throw new db[(_0x7ae8('0x1e'))][(_0x7ae8('0x1f'))](_0x7ae8('0x20'));}if(!_0x218df1['sentiment']||!_0x218df1[_0x7ae8('0x21')]||!_0x218df1['sentimentRegion']||!_0x218df1[_0x7ae8('0x22')]||!_0x218df1[_0x7ae8('0x23')]){throw new db[(_0x7ae8('0x1e'))]['ValidationError'](_0x7ae8('0x24'));}if(!_0x408e0b[_0x7ae8('0x11')]){throw new Error(_0x7ae8('0x25'));}if(_0x218df1['sentimentAccountId']===_0x428e16['id']){return _0x428e16;}else{return db[_0x7ae8('0x26')][_0x7ae8('0x27')]({'where':{'id':_settings[_0x7ae8('0x21')]}});}})[_0x7ae8('0xd')](function(_0x4d7c50){if(!_0x4d7c50){throw new db[(_0x7ae8('0x1e'))][(_0x7ae8('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4d7c50[_0x7ae8('0xa')]||!_0x4d7c50[_0x7ae8('0xb')]){throw new db[(_0x7ae8('0x1e'))]['ValidationError'](_0x7ae8('0x28'));}_0x3e41c1=_0x4d7c50;logger[_0x7ae8('0x7')](util[_0x7ae8('0xe')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4bf950['id']));return sentiment(_0x3e41c1[_0x7ae8('0xa')],_0x3e41c1['data2'],_0x218df1['sentimentRegion'],_0x408e0b['fileText'],_0x218df1[_0x7ae8('0x22')]);})[_0x7ae8('0xd')](function(_0x533bf8){logger[_0x7ae8('0x7')](util[_0x7ae8('0xe')](_0x7ae8('0x29'),_0x4bf950['id']));return _0x4bf950[_0x7ae8('0x1b')]({'sentiment':_0x533bf8['Sentiment'],'sPositive':_0x533bf8[_0x7ae8('0x2a')][_0x7ae8('0x2b')],'sNegative':_0x533bf8[_0x7ae8('0x2a')]['Negative'],'sMixed':_0x533bf8[_0x7ae8('0x2a')]['Mixed'],'sNeutral':_0x533bf8[_0x7ae8('0x2a')][_0x7ae8('0x2c')]});})[_0x7ae8('0xd')](function(){logger[_0x7ae8('0x7')](util['format'](_0x7ae8('0x1c'),_0x4bf950['id']));_0x510852();});case _0x7ae8('0x2d'):return _0x4bf950[_0x7ae8('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x16fbcc[_0x7ae8('0x13')]['FailureReason']})['then'](function(){logger[_0x7ae8('0x7')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4bf950['id']));_0x510852();});default:logger[_0x7ae8('0x7')](util[_0x7ae8('0xe')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4bf950['id']));break;}}else{return BPromise[_0x7ae8('0x2e')]()[_0x7ae8('0xd')](function(){if(!_0x4bf950[_0x7ae8('0x1d')]){throw new db['Sequelize'][(_0x7ae8('0x1f'))](_0x7ae8('0x20'));}if(!_0x218df1[_0x7ae8('0x2f')]||!_0x218df1[_0x7ae8('0x21')]||!_0x218df1['sentimentRegion']||!_0x218df1[_0x7ae8('0x22')]||!_0x218df1[_0x7ae8('0x23')]){throw new db[(_0x7ae8('0x1e'))][(_0x7ae8('0x1f'))](_0x7ae8('0x24'));}if(!_0x4bf950['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x218df1['sentimentAccountId']===_0x428e16['id']){return _0x428e16;}else{return db[_0x7ae8('0x26')][_0x7ae8('0x27')]({'where':{'id':_settings[_0x7ae8('0x21')]}});}})[_0x7ae8('0xd')](function(_0x4e2adb){if(!_0x4e2adb){throw new db[(_0x7ae8('0x1e'))][(_0x7ae8('0x1f'))](_0x7ae8('0x30'));}if(!_0x4e2adb[_0x7ae8('0xa')]||!_0x4e2adb[_0x7ae8('0xb')]){throw new db[(_0x7ae8('0x1e'))][(_0x7ae8('0x1f'))](_0x7ae8('0x28'));}_0x3e41c1=_0x4e2adb;logger[_0x7ae8('0x7')](util[_0x7ae8('0xe')](_0x7ae8('0x31'),_0x4bf950['id']));return sentiment(_0x3e41c1[_0x7ae8('0xa')],_0x3e41c1[_0x7ae8('0xb')],_0x218df1[_0x7ae8('0x32')],_0x4bf950[_0x7ae8('0x11')],_0x218df1[_0x7ae8('0x22')]);})[_0x7ae8('0xd')](function(_0x36f942){logger[_0x7ae8('0x7')](util['format'](_0x7ae8('0x29'),_0x4bf950['id']));return _0x4bf950['update']({'sentiment':_0x36f942[_0x7ae8('0x33')],'sPositive':_0x36f942[_0x7ae8('0x2a')][_0x7ae8('0x2b')],'sNegative':_0x36f942[_0x7ae8('0x2a')][_0x7ae8('0x34')],'sMixed':_0x36f942[_0x7ae8('0x2a')]['Mixed'],'sNeutral':_0x36f942[_0x7ae8('0x2a')][_0x7ae8('0x2c')],'transcribeStatus':_0x7ae8('0x12')});})[_0x7ae8('0xd')](function(){logger[_0x7ae8('0x7')](util[_0x7ae8('0xe')](_0x7ae8('0x1c'),_0x4bf950['id']));_0x510852();});}})['catch'](function(_0x5eee24){if(_0x5eee24){if(!_0x5eee24[_0x7ae8('0x35')]||_0x5eee24[_0x7ae8('0x35')]!==_0x7ae8('0x36')){logger['error'](util[_0x7ae8('0xe')](_0x7ae8('0x37'),_0x4bf950['id']),util['inspect'](_0x5eee24,{'showHidden':![],'depth':null}));}}_0x510852();});});}function checkTranscribe(){var _0x42ec4a;var _0x10e6b9;var _0x5c6435;return db[_0x7ae8('0x38')][_0x7ae8('0x39')]({'where':{'transcribeStatus':_0x7ae8('0x3a')}})['then'](function(_0x58f513){if(!_0x58f513||!_0x58f513['length']){throw new db['Sequelize'][(_0x7ae8('0x1f'))](_0x7ae8('0x3b'));}_0x42ec4a=_0x58f513;return db['Setting'][_0x7ae8('0x27')]({'where':{'id':0x1}});})[_0x7ae8('0xd')](function(_0x21dac6){if(!_0x21dac6){throw new db[(_0x7ae8('0x1e'))][(_0x7ae8('0x1f'))](_0x7ae8('0x3c'));}_0x10e6b9=_0x21dac6;if(!_0x10e6b9[_0x7ae8('0x2')]||!_0x10e6b9['transcribeAccountId']||!_0x10e6b9[_0x7ae8('0xc')]||!_0x10e6b9['language']||!_0x10e6b9[_0x7ae8('0x23')]){throw new db[(_0x7ae8('0x1e'))]['ValidationError'](_0x7ae8('0x3d'));}return db['CloudProvider'][_0x7ae8('0x27')]({'where':{'id':_0x10e6b9[_0x7ae8('0x3e')]}});})[_0x7ae8('0xd')](function(_0x2af06d){if(!_0x2af06d){throw new db[(_0x7ae8('0x1e'))]['ValidationError'](_0x7ae8('0x30'));}if(!_0x2af06d['data1']||!_0x2af06d[_0x7ae8('0xb')]){throw new db[(_0x7ae8('0x1e'))][(_0x7ae8('0x1f'))](_0x7ae8('0x28'));}_0x5c6435=_0x2af06d;var _0xf5e180=[];_0x42ec4a['forEach'](function(_0x5c2bae){_0xf5e180[_0x7ae8('0x3f')](checkTranscribeJob(_0x5c2bae,_0x10e6b9,_0x5c6435));});return BPromise[_0x7ae8('0x40')](_0xf5e180);})[_0x7ae8('0x41')](function(_0x1e6eb8){if(_0x1e6eb8){if(!_0x1e6eb8[_0x7ae8('0x35')]||_0x1e6eb8[_0x7ae8('0x35')]!==_0x7ae8('0x36')){logger[_0x7ae8('0x42')](util[_0x7ae8('0x43')](_0x1e6eb8,{'showHidden':![],'depth':null}));}}});}exports[_0x7ae8('0x44')]=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 28849cd..5676b99 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 _0xd06f=['length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd06f,0x15f));var _0xfd06=function(_0x528327,_0x234696){_0x528327=_0x528327-0x0;var _0x3732d8=_0xd06f[_0x528327];return _0x3732d8;};'use strict';var _=require(_0xfd06('0x0'));var moment=require(_0xfd06('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xfd06('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xfd06('0x3'));config[_0xfd06('0x4')]=_['defaults'](config[_0xfd06('0x4')],{'host':_0xfd06('0x5'),'port':0x18eb});var io=require(_0xfd06('0x6'))(new Redis(config[_0xfd06('0x4')]));function closeInteractions(){var _0x459016=[];return db[_0xfd06('0x7')][_0xfd06('0x8')]({'raw':!![],'attributes':['id',_0xfd06('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xfd06('0xa')](0x18,_0xfd06('0xb'))}}})[_0xfd06('0xc')](function(_0x564b01){if(_0x564b01&&_0x564b01[_0xfd06('0xd')]){_0x459016=_[_0xfd06('0xe')](_0x564b01||[],'id');logger[_0xfd06('0xf')](_0xfd06('0x10'),_0x459016[_0xfd06('0x11')]());return db[_0xfd06('0x7')][_0xfd06('0x12')]({'closeReason':_0xfd06('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xfd06('0x14')](_0xfd06('0x15'))},{'where':{'id':_0x459016}});}})[_0xfd06('0xc')](function(){if(_0x459016&&_0x459016[_0xfd06('0xd')]){logger[_0xfd06('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x459016['join']());for(var _0x112014=0x0;_0x112014<_0x459016[_0xfd06('0xd')];_0x112014++){io['emit'](_0xfd06('0x16'),{'id':_0x459016[_0x112014],'closed':!![]});}}})[_0xfd06('0x17')](function(_0x211540){logger[_0xfd06('0x18')](_0xfd06('0x19'),_0x211540?util[_0xfd06('0x1a')](_0x211540,{'showHidden':![],'depth':null}):'');});}exports[_0xfd06('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9271=['../../mysqldb','schedule','defaults','localhost','socket.io-emitter','redis','findAll','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','util','../../config/environment'];(function(_0x4dd374,_0x2dfdde){var _0x5cc428=function(_0x19be59){while(--_0x19be59){_0x4dd374['push'](_0x4dd374['shift']());}};_0x5cc428(++_0x2dfdde);}(_0x9271,0x1e3));var _0x1927=function(_0x305e96,_0x46e8fc){_0x305e96=_0x305e96-0x0;var _0x5f11ad=_0x9271[_0x305e96];return _0x5f11ad;};'use strict';var _=require(_0x1927('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x1927('0x1'));var config=require(_0x1927('0x2'));var db=require(_0x1927('0x3'))['db'];var logger=require('../logger')(_0x1927('0x4'));config['redis']=_[_0x1927('0x5')](config['redis'],{'host':_0x1927('0x6'),'port':0x18eb});var io=require(_0x1927('0x7'))(new Redis(config[_0x1927('0x8')]));function closeInteractions(){var _0x4942e1=[];return db['WhatsappInteraction'][_0x1927('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1927('0xa')](0x18,'hours')}}})[_0x1927('0xb')](function(_0x5e7e26){if(_0x5e7e26&&_0x5e7e26[_0x1927('0xc')]){_0x4942e1=_[_0x1927('0xd')](_0x5e7e26||[],'id');logger[_0x1927('0xe')](_0x1927('0xf'),_0x4942e1['join']());return db[_0x1927('0x10')][_0x1927('0x11')]({'closeReason':'system','disposition':_0x1927('0x12'),'closed':!![],'closedAt':moment()['format'](_0x1927('0x13'))},{'where':{'id':_0x4942e1}});}})[_0x1927('0xb')](function(){if(_0x4942e1&&_0x4942e1[_0x1927('0xc')]){logger['info'](_0x1927('0x14'),_0x4942e1[_0x1927('0x15')]());for(var _0x217a9f=0x0;_0x217a9f<_0x4942e1[_0x1927('0xc')];_0x217a9f++){io[_0x1927('0x16')](_0x1927('0x17'),{'id':_0x4942e1[_0x217a9f],'closed':!![]});}}})[_0x1927('0x18')](function(_0x21e8aa){logger['error'](_0x1927('0x19'),_0x21e8aa?util[_0x1927('0x1a')](_0x21e8aa,{'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 9b3ad56..549c6f5 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67c0=['../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','catch'];(function(_0x46ca7e,_0x37c8c8){var _0x4d9f7f=function(_0x3f0e9){while(--_0x3f0e9){_0x46ca7e['push'](_0x46ca7e['shift']());}};_0x4d9f7f(++_0x37c8c8);}(_0x67c0,0x85));var _0x067c=function(_0x4a93e9,_0x5b569f){_0x4a93e9=_0x4a93e9-0x0;var _0x4b3ba7=_0x67c0[_0x4a93e9];return _0x4b3ba7;};'use strict';var util=require('util');var db=require(_0x067c('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x067c('0x1')+i,'lastName':_0x067c('0x2')+i,'phone':0xf879fb460+i,'email':_0x067c('0x3')+i+_0x067c('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x067c('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x067c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x067c('0x6')](),'updatedAt':Date[_0x067c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x067c('0x5')]({'id':i,'firstName':_0x067c('0x1')+i,'lastName':_0x067c('0x2')+i,'phone':0xf879fb460+i,'email':_0x067c('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x067c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x067c('0x6')](),'updatedAt':Date[_0x067c('0x6')]()});}db[_0x067c('0x7')]['destroy']({'where':{}})[_0x067c('0x8')](function(){return db[_0x067c('0x7')][_0x067c('0x9')](contacts);})[_0x067c('0x8')](function(){console[_0x067c('0xa')](_0x067c('0xb'),_0x067c('0xc'));return db[_0x067c('0xd')][_0x067c('0xe')]({'where':{}});})['then'](function(){return db[_0x067c('0xd')]['bulkCreate'](hopper);})[_0x067c('0x8')](function(){console['log'](_0x067c('0xb'),_0x067c('0xf'));return db['CmContact']['bulkCreate'](contacts2);})['then'](function(){console[_0x067c('0xa')](_0x067c('0xb'),_0x067c('0x10'));return db[_0x067c('0xd')]['bulkCreate'](hopper2);})[_0x067c('0x8')](function(){console[_0x067c('0xa')]('finished\x20populating',_0x067c('0x11'));})[_0x067c('0x12')](function(_0xaf1f76){console[_0x067c('0xa')](_0xaf1f76);}); \ No newline at end of file +var _0x7bdf=['util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2'];(function(_0x63b6c3,_0x5c3125){var _0x1b01f9=function(_0x215a90){while(--_0x215a90){_0x63b6c3['push'](_0x63b6c3['shift']());}};_0x1b01f9(++_0x5c3125);}(_0x7bdf,0x1e6));var _0xf7bd=function(_0x4d3979,_0x5da18d){_0x4d3979=_0x4d3979-0x0;var _0x259c64=_0x7bdf[_0x4d3979];return _0x259c64;};'use strict';var util=require(_0xf7bd('0x0'));var db=require(_0xf7bd('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf7bd('0x2')]({'id':i,'firstName':_0xf7bd('0x3')+i,'lastName':_0xf7bd('0x4')+i,'phone':0xf879fb460+i,'email':_0xf7bd('0x5')+i+_0xf7bd('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf7bd('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf7bd('0x7')](),'updatedAt':Date[_0xf7bd('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xf7bd('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xf7bd('0x5')+i+_0xf7bd('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf7bd('0x7')](),'updatedAt':Date[_0xf7bd('0x7')]()});}db[_0xf7bd('0x8')][_0xf7bd('0x9')]({'where':{}})['then'](function(){return db[_0xf7bd('0x8')][_0xf7bd('0xa')](contacts);})[_0xf7bd('0xb')](function(){console[_0xf7bd('0xc')](_0xf7bd('0xd'),_0xf7bd('0xe'));return db[_0xf7bd('0xf')][_0xf7bd('0x9')]({'where':{}});})[_0xf7bd('0xb')](function(){return db['CmHopper'][_0xf7bd('0xa')](hopper);})[_0xf7bd('0xb')](function(){console[_0xf7bd('0xc')](_0xf7bd('0xd'),_0xf7bd('0x10'));return db[_0xf7bd('0x8')]['bulkCreate'](contacts2);})[_0xf7bd('0xb')](function(){console[_0xf7bd('0xc')]('finished\x20populating','contacts2');return db[_0xf7bd('0xf')][_0xf7bd('0xa')](hopper2);})['then'](function(){console[_0xf7bd('0xc')](_0xf7bd('0xd'),_0xf7bd('0x11'));})['catch'](function(_0x196d0f){console[_0xf7bd('0xc')](_0x196d0f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index cdf2412..2fb2c4f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa402=['actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','udp','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0xa402,0x9a));var _0x2a40=function(_0x13da1c,_0x1a06a8){_0x13da1c=_0x13da1c-0x0;var _0x33d386=_0xa402[_0x13da1c];return _0x33d386;};'use strict';var util=require(_0x2a40('0x0'));var db=require(_0x2a40('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2a40('0x2')]({'name':util[_0x2a40('0x3')]('%s%s',_0x2a40('0x4'),i),'fullname':util[_0x2a40('0x3')](_0x2a40('0x5'),_0x2a40('0x4'),i),'email':util[_0x2a40('0x3')](_0x2a40('0x6'),'agent',i),'role':_0x2a40('0x4'),'password':_0x2a40('0x7'),'internal':0xfa0+i,'type':_0x2a40('0x8'),'transport':[_0x2a40('0x9'),'ws','wss'],'disallow':[_0x2a40('0xa')],'allow':['ulaw'],'defaultuser':util['format'](_0x2a40('0x5'),_0x2a40('0x4'),i),'encryption':_0x2a40('0xb'),'avpf':'yes','force_avp':'yes','icesupport':_0x2a40('0xb'),'dtlsenable':_0x2a40('0xb'),'dtlsverify':'no','dtlscertfile':_0x2a40('0xc'),'dtlsprivatekey':_0x2a40('0xd'),'dtlssetup':_0x2a40('0xe'),'callerid':util[_0x2a40('0x3')](_0x2a40('0xf'),util[_0x2a40('0x3')](_0x2a40('0x5'),_0x2a40('0x4'),i),0xfa0+i)});}db['User'][_0x2a40('0x10')](users)[_0x2a40('0x11')](function(){console[_0x2a40('0x12')](_0x2a40('0x13'));})[_0x2a40('0x14')](function(_0x3cfcba){console[_0x2a40('0x12')](_0x3cfcba);}); \ No newline at end of file +var _0xc053=['catch','util','../mysqldb','format','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user'];(function(_0x2e4de4,_0x2d720b){var _0x427915=function(_0x3e4ae7){while(--_0x3e4ae7){_0x2e4de4['push'](_0x2e4de4['shift']());}};_0x427915(++_0x2d720b);}(_0xc053,0x1a5));var _0x3c05=function(_0x524c03,_0x43b170){_0x524c03=_0x524c03-0x0;var _0x42145e=_0xc053[_0x524c03];return _0x42145e;};'use strict';var util=require(_0x3c05('0x0'));var db=require(_0x3c05('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x3c05('0x2')]('%s%s',_0x3c05('0x3'),i),'fullname':util[_0x3c05('0x2')]('%s%s',_0x3c05('0x3'),i),'email':util[_0x3c05('0x2')](_0x3c05('0x4'),_0x3c05('0x3'),i),'role':'agent','password':_0x3c05('0x5'),'internal':0xfa0+i,'type':_0x3c05('0x6'),'transport':['udp','ws',_0x3c05('0x7')],'disallow':[_0x3c05('0x8')],'allow':[_0x3c05('0x9')],'defaultuser':util[_0x3c05('0x2')](_0x3c05('0xa'),_0x3c05('0x3'),i),'encryption':_0x3c05('0xb'),'avpf':_0x3c05('0xb'),'force_avp':_0x3c05('0xb'),'icesupport':_0x3c05('0xb'),'dtlsenable':_0x3c05('0xb'),'dtlsverify':'no','dtlscertfile':_0x3c05('0xc'),'dtlsprivatekey':_0x3c05('0xd'),'dtlssetup':_0x3c05('0xe'),'callerid':util[_0x3c05('0x2')](_0x3c05('0xf'),util[_0x3c05('0x2')](_0x3c05('0xa'),_0x3c05('0x3'),i),0xfa0+i)});}db[_0x3c05('0x10')][_0x3c05('0x11')](users)['then'](function(){console[_0x3c05('0x12')](_0x3c05('0x13'));})[_0x3c05('0x14')](function(_0x189429){console[_0x3c05('0x12')](_0x189429);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 461c46f..b5a8eb6 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe635=['voice:outbound','include','push','ChatQueue','SmsQueue','WhatsappQueue','Trunk','user','VoiceQueues','VoiceQueue','userProfileId','FaxQueue','SmsQueues','MailQueue','OpenchannelQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','user_has_chat_interactions:remove','leave','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','then','map','User','where','Campaign','format','%s:queue:%s','length','handshake','query','find','ChatInteractions','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound'];(function(_0x4409b9,_0x550352){var _0x3f0659=function(_0x22273f){while(--_0x22273f){_0x4409b9['push'](_0x4409b9['shift']());}};_0x3f0659(++_0x550352);}(_0xe635,0x1be));var _0x5e63=function(_0x5e5d8c,_0x2060c5){_0x5e5d8c=_0x5e5d8c-0x0;var _0x250676=_0xe635[_0x5e5d8c];return _0x250676;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var BPromise=require(_0x5e63('0x2'));var db=require(_0x5e63('0x3'))['db'];var config=require(_0x5e63('0x4'));var queryQueues={'attributes':['id',_0x5e63('0x5')],'include':[{'as':_0x5e63('0x6'),'model':db['User'],'attributes':['id','name',_0x5e63('0x7')],'raw':!![],'where':{'role':_0x5e63('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5e63('0x5')],'where':{'role':_0x5e63('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5e63('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x5e63('0x5')],'where':{'role':_0x5e63('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5e63('0x5'),_0x5e63('0xa')],'where':{'type':_0x5e63('0xb')}};function getAssociatedResources(_0x5cba07,_0x2794dc,_0x13501d){return db[_0x5e63('0xc')][_0x5e63('0xd')]({'where':{'name':_0x5cba07,'userProfileId':_0x2794dc},'raw':!![]})['then'](function(_0xd64e99){if(_0xd64e99){if(_0xd64e99[_0x5e63('0xe')]){switch(_0x5cba07){case'VoiceQueues':case _0x5e63('0xf'):case _0x5e63('0x10'):case'SmsQueues':case _0x5e63('0x11'):case'OpenchannelQueues':case _0x5e63('0x12'):return db[_0x13501d][_0x5e63('0x13')](queryQueues);case _0x5e63('0x14'):return db[_0x13501d][_0x5e63('0x13')](queryTelephones);case'Trunks':return db[_0x13501d]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x13501d][_0x5e63('0x13')](queryCampaigns);}}else{return db[_0x5e63('0x15')]['findAll']({'attributes':[_0x5e63('0x16')],'where':{'sectionId':_0xd64e99['id']},'raw':!![]})[_0x5e63('0x17')](function(_0x3c5d47){if(_0x3c5d47){var _0x491e27={'where':{'id':_[_0x5e63('0x18')](_0x3c5d47,_0x5e63('0x16'))},'raw':!![]};switch(_0x13501d){case _0x5e63('0x19'):_0x491e27[_0x5e63('0x1a')][_0x5e63('0x7')]='telephone';break;case _0x5e63('0x1b'):_0x491e27[_0x5e63('0x1a')][_0x5e63('0xa')]=_0x5e63('0xb');break;}return db[_0x13501d][_0x5e63('0x13')](_0x491e27);}else{return[];}});}}else{return[];}})['then'](function(_0x3d5b23){return _0x3d5b23;});}function joinOrLeaveQueues(_0x566514,_0x5d5cb4,_0xe8a6c5,_0x3eb7e6){_0x566514[_0x5d5cb4](util[_0x5e63('0x1c')](_0x5e63('0x1d'),_0xe8a6c5,_0x3eb7e6[_0x5e63('0x5')]));if(_0x3eb7e6[_0x5e63('0x6')]){for(var _0x464b76=0x0;_0x464b76<_0x3eb7e6[_0x5e63('0x6')][_0x5e63('0x1e')];_0x464b76+=0x1){_0x566514[_0x5d5cb4](util[_0x5e63('0x1c')]('user:%s',_0x3eb7e6[_0x5e63('0x6')][_0x464b76]['name']));}}}function joinOrLeave(_0x574d63,_0xeeff0e,_0x3ff002){var _0x2d9387;if(_0x574d63[_0x5e63('0x1f')][_0x5e63('0x20')]['id']){db[_0x5e63('0x19')][_0x5e63('0x21')]({'attributes':['id','name',_0x5e63('0x7'),'userProfileId'],'where':{'id':_0x574d63[_0x5e63('0x1f')][_0x5e63('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x5e63('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x5e63('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x5e63('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x5e63('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x5e63('0x26')],'as':_0x5e63('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x5e63('0x28')],'as':_0x5e63('0x29'),'attributes':['id'],'raw':!![]}]})[_0x5e63('0x17')](function(_0x4b3e42){if(_0x4b3e42){_0x2d9387=_0x4b3e42;_0x574d63[_0xeeff0e](util[_0x5e63('0x1c')]('user:%s',_0x4b3e42[_0x5e63('0x5')]));var _0x366f77=[];switch(_0x4b3e42[_0x5e63('0x7')]){case _0x5e63('0x2a'):_0x574d63[_0xeeff0e](_0x5e63('0x2b'));_0x574d63[_0xeeff0e](_0x5e63('0x2c'));if(queryQueues['hasOwnProperty'](_0x5e63('0x2d'))){delete queryQueues[_0x5e63('0x2d')];}_0x366f77[_0x5e63('0x2e')](db['VoiceQueue'][_0x5e63('0x13')](queryQueues));_0x366f77[_0x5e63('0x2e')](db[_0x5e63('0x2f')][_0x5e63('0x13')](queryQueues));_0x366f77['push'](db['FaxQueue']['findAll'](queryQueues));_0x366f77['push'](db[_0x5e63('0x30')][_0x5e63('0x13')](queryQueues));_0x366f77[_0x5e63('0x2e')](db['MailQueue'][_0x5e63('0x13')](queryQueues));_0x366f77[_0x5e63('0x2e')](db['OpenchannelQueue'][_0x5e63('0x13')](queryQueues));_0x366f77[_0x5e63('0x2e')](db[_0x5e63('0x31')][_0x5e63('0x13')](queryQueues));_0x366f77['push'](db[_0x5e63('0x19')]['findAll'](queryTelephones));_0x366f77['push'](db[_0x5e63('0x32')][_0x5e63('0x13')](queryTrunks));_0x366f77[_0x5e63('0x2e')](db[_0x5e63('0x1b')]['findAll'](queryCampaigns));_0x366f77[_0x5e63('0x2e')](db[_0x5e63('0x19')][_0x5e63('0x13')](queryAgents));break;case _0x5e63('0x33'):_0x574d63[_0xeeff0e](_0x5e63('0x2b'));_0x574d63[_0xeeff0e](_0x5e63('0x2c'));_0x366f77[_0x5e63('0x2e')](getAssociatedResources(_0x5e63('0x34'),_0x4b3e42['userProfileId'],_0x5e63('0x35')));_0x366f77['push'](getAssociatedResources(_0x5e63('0xf'),_0x4b3e42['userProfileId'],_0x5e63('0x2f')));_0x366f77[_0x5e63('0x2e')](getAssociatedResources('FaxQueues',_0x4b3e42[_0x5e63('0x36')],_0x5e63('0x37')));_0x366f77[_0x5e63('0x2e')](getAssociatedResources(_0x5e63('0x38'),_0x4b3e42['userProfileId'],'SmsQueue'));_0x366f77[_0x5e63('0x2e')](getAssociatedResources(_0x5e63('0x11'),_0x4b3e42[_0x5e63('0x36')],_0x5e63('0x39')));_0x366f77['push'](getAssociatedResources('OpenchannelQueues',_0x4b3e42['userProfileId'],_0x5e63('0x3a')));_0x366f77[_0x5e63('0x2e')](getAssociatedResources(_0x5e63('0x12'),_0x4b3e42[_0x5e63('0x36')],_0x5e63('0x31')));_0x366f77['push'](getAssociatedResources(_0x5e63('0x14'),_0x4b3e42[_0x5e63('0x36')],'User'));_0x366f77[_0x5e63('0x2e')](getAssociatedResources('Trunks',_0x4b3e42[_0x5e63('0x36')],'Trunk'));_0x366f77[_0x5e63('0x2e')](getAssociatedResources(_0x5e63('0x3b'),_0x4b3e42[_0x5e63('0x36')],'Campaign'));_0x366f77[_0x5e63('0x2e')](db[_0x5e63('0x19')][_0x5e63('0x13')](queryAgents));break;case _0x5e63('0x8'):_0x574d63[_0xeeff0e](_0x5e63('0x2b'));_0x574d63[_0xeeff0e](_0x5e63('0x2c'));_0x366f77['push'](_0x4b3e42[_0x5e63('0x3c')]({'attributes':['id',_0x5e63('0x5')]}));_0x366f77[_0x5e63('0x2e')](_0x4b3e42[_0x5e63('0x3d')]({'attributes':['id',_0x5e63('0x5')]}));_0x366f77['push'](_0x4b3e42[_0x5e63('0x3e')]({'attributes':['id',_0x5e63('0x5')]}));_0x366f77['push'](_0x4b3e42['getSmsQueues']({'attributes':['id',_0x5e63('0x5')]}));_0x366f77['push'](_0x4b3e42[_0x5e63('0x3f')]({'attributes':['id','name']}));_0x366f77['push'](_0x4b3e42[_0x5e63('0x40')]({'attributes':['id',_0x5e63('0x5')]}));_0x366f77[_0x5e63('0x2e')](_0x4b3e42[_0x5e63('0x41')]({'attributes':['id',_0x5e63('0x5')]}));break;}return BPromise[_0x5e63('0x42')](_0x366f77);}})[_0x5e63('0x17')](function(_0x2b4946){if(_0x2b4946&&_0x2b4946[_0x5e63('0x1e')]){for(var _0x174729=0x0;_0x174729<_0x2b4946[_0x5e63('0x1e')];_0x174729+=0x1){for(var _0x363c73=0x0;_0x363c73<_0x2b4946[_0x174729][_0x5e63('0x1e')];_0x363c73+=0x1){switch(_0x174729){case 0x0:joinOrLeaveQueues(_0x574d63,_0xeeff0e,'voice',_0x2b4946[_0x174729][_0x363c73]);break;case 0x1:joinOrLeaveQueues(_0x574d63,_0xeeff0e,_0x5e63('0x43'),_0x2b4946[_0x174729][_0x363c73]);break;case 0x2:joinOrLeaveQueues(_0x574d63,_0xeeff0e,_0x5e63('0x44'),_0x2b4946[_0x174729][_0x363c73]);break;case 0x3:joinOrLeaveQueues(_0x574d63,_0xeeff0e,_0x5e63('0x45'),_0x2b4946[_0x174729][_0x363c73]);break;case 0x4:joinOrLeaveQueues(_0x574d63,_0xeeff0e,_0x5e63('0x46'),_0x2b4946[_0x174729][_0x363c73]);break;case 0x5:joinOrLeaveQueues(_0x574d63,_0xeeff0e,_0x5e63('0x47'),_0x2b4946[_0x174729][_0x363c73]);break;case 0x6:joinOrLeaveQueues(_0x574d63,_0xeeff0e,_0x5e63('0x48'),_0x2b4946[_0x174729][_0x363c73]);break;case 0x7:if(_0x2d9387['role']!==_0x5e63('0x8'))_0x574d63[_0xeeff0e](util['format'](_0x5e63('0x49'),_0x2b4946[_0x174729][_0x363c73]['name']));break;case 0x8:if(_0x2d9387[_0x5e63('0x7')]!==_0x5e63('0x8'))_0x574d63[_0xeeff0e](util['format']('trunk:%s',_0x2b4946[_0x174729][_0x363c73]['name']));break;case 0x9:if(_0x2d9387[_0x5e63('0x7')]!=='agent')_0x574d63[_0xeeff0e](util[_0x5e63('0x1c')]('campaign:%s:%s',_0x2b4946[_0x174729][_0x363c73][_0x5e63('0xa')],_0x2b4946[_0x174729][_0x363c73][_0x5e63('0x5')]));break;case 0xa:_0x574d63[_0xeeff0e](util[_0x5e63('0x1c')]('user:%s',_0x2b4946[_0x174729][_0x363c73]['name']));break;}}}}})[_0x5e63('0x17')](function(){if(_0xeeff0e==='leave'){var _0x44ea72=_[_0x5e63('0x18')](_0x2d9387[_0x5e63('0x22')],'id');return _0x2d9387['removeChatInteractions'](_0x44ea72)[_0x5e63('0x17')](function(){for(var _0x5b3044=0x0;_0x5b3044<_0x44ea72[_0x5e63('0x1e')];_0x5b3044+=0x1){_0x3ff002['emit'](_0x5e63('0x4a'),{'ChatInteractionId':Number(_0x44ea72[_0x5b3044]),'UserId':Number(_0x2d9387['id'])});}});}})[_0x5e63('0x17')](function(){if(_0xeeff0e===_0x5e63('0x4b')){var _0x42c6d3=_[_0x5e63('0x18')](_0x2d9387[_0x5e63('0x23')],'id');return _0x2d9387[_0x5e63('0x4c')](_0x42c6d3)[_0x5e63('0x17')](function(){for(var _0xb9b836=0x0;_0xb9b836<_0x42c6d3[_0x5e63('0x1e')];_0xb9b836+=0x1){_0x3ff002[_0x5e63('0x4d')](_0x5e63('0x4e'),{'MailInteractionId':Number(_0x42c6d3[_0xb9b836]),'UserId':Number(_0x2d9387['id'])});}});}})['then'](function(){if(_0xeeff0e===_0x5e63('0x4b')){var _0x33c5b2=_[_0x5e63('0x18')](_0x2d9387[_0x5e63('0x4f')],'id');return _0x2d9387[_0x5e63('0x50')](_0x33c5b2)['then'](function(){for(var _0x1d0d22=0x0;_0x1d0d22<_0x33c5b2[_0x5e63('0x1e')];_0x1d0d22+=0x1){_0x3ff002['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x33c5b2[_0x1d0d22]),'UserId':Number(_0x2d9387['id'])});}});}})['then'](function(){if(_0xeeff0e==='leave'){var _0x45ff6d=_[_0x5e63('0x18')](_0x2d9387['SmsInteractions'],'id');return _0x2d9387['removeSmsInteractions'](_0x45ff6d)[_0x5e63('0x17')](function(){for(var _0x520aed=0x0;_0x520aed<_0x45ff6d[_0x5e63('0x1e')];_0x520aed+=0x1){_0x3ff002[_0x5e63('0x4d')](_0x5e63('0x51'),{'SmsInteractionId':Number(_0x45ff6d[_0x520aed]),'UserId':Number(_0x2d9387['id'])});}});}})[_0x5e63('0x17')](function(){if(_0xeeff0e===_0x5e63('0x4b')){var _0x5207a1=_[_0x5e63('0x18')](_0x2d9387['OpenchannelInteractions'],'id');return _0x2d9387['removeOpenchannelInteractions'](_0x5207a1)['then'](function(){for(var _0x4c5f6d=0x0;_0x4c5f6d<_0x5207a1[_0x5e63('0x1e')];_0x4c5f6d+=0x1){_0x3ff002[_0x5e63('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x5207a1[_0x4c5f6d]),'UserId':Number(_0x2d9387['id'])});}});}})[_0x5e63('0x17')](function(){if(_0xeeff0e==='leave'){var _0x5afb98=_[_0x5e63('0x18')](_0x2d9387[_0x5e63('0x29')],'id');return _0x2d9387[_0x5e63('0x52')](_0x5afb98)[_0x5e63('0x17')](function(){for(var _0x566aac=0x0;_0x566aac<_0x5afb98[_0x5e63('0x1e')];_0x566aac+=0x1){_0x3ff002[_0x5e63('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x5afb98[_0x566aac]),'UserId':Number(_0x2d9387['id'])});}});}})[_0x5e63('0x53')](function(_0x2b6cc6){_0x574d63['log'](_0x2b6cc6);});}}function onDisconnect(_0x287122,_0x4a0436){joinOrLeave(_0x287122,_0x5e63('0x4b'),_0x4a0436);}function onConnect(_0x281075){joinOrLeave(_0x281075,_0x5e63('0x54'));}exports[_0x5e63('0x55')]=function(_0x2d0fb5){_0x2d0fb5['on'](_0x5e63('0x56'),function(_0x3e4141){_0x3e4141[_0x5e63('0x57')](0x0);_0x3e4141[_0x5e63('0x58')]=_0x3e4141[_0x5e63('0x59')][_0x5e63('0x56')][_0x5e63('0x5a')]+':'+_0x3e4141[_0x5e63('0x59')][_0x5e63('0x56')][_0x5e63('0x5b')];_0x3e4141[_0x5e63('0x5c')]=new Date();_0x3e4141['log']=function(_0x35deeb){console[_0x5e63('0x5d')](_0x5e63('0x5e')+_0x3e4141['nsp'][_0x5e63('0x5')]+'['+_0x3e4141['address']+']',_0x35deeb);};_0x3e4141['on'](_0x5e63('0x5f'),function(){onDisconnect(_0x3e4141,_0x2d0fb5);_0x3e4141[_0x5e63('0x5d')](_0x5e63('0x60'));});onConnect(_0x3e4141);_0x3e4141[_0x5e63('0x5d')](_0x5e63('0x61'));});}; \ No newline at end of file +var _0x804d=['where','%s:queue:%s','format','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','VoiceQueues','SmsQueues','SmsQueue','MailQueue','WhatsappQueues','getVoiceQueues','getChatQueues','getSmsQueues','getWhatsappQueues','all','length','voice','chat','sms','openchannel','whatsapp','trunk:%s','leave','map','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x804d,0x116));var _0xd804=function(_0x5c6c2e,_0x86e980){_0x5c6c2e=_0x5c6c2e-0x0;var _0xd262ac=_0x804d[_0x5c6c2e];return _0xd262ac;};'use strict';var _=require(_0xd804('0x0'));var util=require(_0xd804('0x1'));var BPromise=require(_0xd804('0x2'));var db=require(_0xd804('0x3'))['db'];var config=require(_0xd804('0x4'));var queryQueues={'attributes':['id',_0xd804('0x5')],'include':[{'as':_0xd804('0x6'),'model':db[_0xd804('0x7')],'attributes':['id','name',_0xd804('0x8')],'raw':!![],'where':{'role':_0xd804('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd804('0x5')],'where':{'role':_0xd804('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd804('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xd804('0x5')],'where':{'role':_0xd804('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd804('0x5'),_0xd804('0xb')],'where':{'type':_0xd804('0xc')}};function getAssociatedResources(_0x1379b5,_0x1ebd40,_0x4d12bd){return db[_0xd804('0xd')][_0xd804('0xe')]({'where':{'name':_0x1379b5,'userProfileId':_0x1ebd40},'raw':!![]})[_0xd804('0xf')](function(_0xa48fe0){if(_0xa48fe0){if(_0xa48fe0['autoAssociation']){switch(_0x1379b5){case'VoiceQueues':case _0xd804('0x10'):case _0xd804('0x11'):case'SmsQueues':case _0xd804('0x12'):case _0xd804('0x13'):case'WhatsappQueues':return db[_0x4d12bd][_0xd804('0x14')](queryQueues);case _0xd804('0x15'):return db[_0x4d12bd][_0xd804('0x14')](queryTelephones);case'Trunks':return db[_0x4d12bd]['findAll'](queryTrunks);case _0xd804('0x16'):return db[_0x4d12bd][_0xd804('0x14')](queryCampaigns);}}else{return db[_0xd804('0x17')][_0xd804('0x14')]({'attributes':[_0xd804('0x18')],'where':{'sectionId':_0xa48fe0['id']},'raw':!![]})['then'](function(_0x18c4a0){if(_0x18c4a0){var _0x30be96={'where':{'id':_['map'](_0x18c4a0,_0xd804('0x18'))},'raw':!![]};switch(_0x4d12bd){case _0xd804('0x7'):_0x30be96[_0xd804('0x19')]['role']=_0xd804('0xa');break;case'Campaign':_0x30be96[_0xd804('0x19')][_0xd804('0xb')]=_0xd804('0xc');break;}return db[_0x4d12bd]['findAll'](_0x30be96);}else{return[];}});}}else{return[];}})[_0xd804('0xf')](function(_0x17aeee){return _0x17aeee;});}function joinOrLeaveQueues(_0x398f79,_0x2d881a,_0x13c0eb,_0x5d29d1){_0x398f79[_0x2d881a](util['format'](_0xd804('0x1a'),_0x13c0eb,_0x5d29d1['name']));if(_0x5d29d1[_0xd804('0x6')]){for(var _0x103f52=0x0;_0x103f52<_0x5d29d1[_0xd804('0x6')]['length'];_0x103f52+=0x1){_0x398f79[_0x2d881a](util[_0xd804('0x1b')]('user:%s',_0x5d29d1[_0xd804('0x6')][_0x103f52]['name']));}}}function joinOrLeave(_0x50ce5e,_0x52c85c,_0x51b191){var _0x2cde57;if(_0x50ce5e[_0xd804('0x1c')][_0xd804('0x1d')]['id']){db['User'][_0xd804('0x1e')]({'attributes':['id',_0xd804('0x5'),_0xd804('0x8'),_0xd804('0x1f')],'where':{'id':_0x50ce5e['handshake'][_0xd804('0x1d')]['id']},'include':[{'model':db[_0xd804('0x20')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd804('0x21')],'as':_0xd804('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xd804('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xd804('0x24')],'as':_0xd804('0x25'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xd804('0x26'),'attributes':['id'],'raw':!![]}]})[_0xd804('0xf')](function(_0x1858f0){if(_0x1858f0){_0x2cde57=_0x1858f0;_0x50ce5e[_0x52c85c](util[_0xd804('0x1b')](_0xd804('0x27'),_0x1858f0[_0xd804('0x5')]));var _0x11f19e=[];switch(_0x1858f0[_0xd804('0x8')]){case'admin':_0x50ce5e[_0x52c85c](_0xd804('0x28'));_0x50ce5e[_0x52c85c](_0xd804('0x29'));if(queryQueues[_0xd804('0x2a')](_0xd804('0x2b'))){delete queryQueues[_0xd804('0x2b')];}_0x11f19e[_0xd804('0x2c')](db[_0xd804('0x2d')][_0xd804('0x14')](queryQueues));_0x11f19e[_0xd804('0x2c')](db[_0xd804('0x2e')]['findAll'](queryQueues));_0x11f19e['push'](db[_0xd804('0x2f')][_0xd804('0x14')](queryQueues));_0x11f19e['push'](db['SmsQueue'][_0xd804('0x14')](queryQueues));_0x11f19e['push'](db['MailQueue'][_0xd804('0x14')](queryQueues));_0x11f19e[_0xd804('0x2c')](db[_0xd804('0x30')][_0xd804('0x14')](queryQueues));_0x11f19e[_0xd804('0x2c')](db[_0xd804('0x31')][_0xd804('0x14')](queryQueues));_0x11f19e[_0xd804('0x2c')](db['User'][_0xd804('0x14')](queryTelephones));_0x11f19e['push'](db[_0xd804('0x32')][_0xd804('0x14')](queryTrunks));_0x11f19e[_0xd804('0x2c')](db[_0xd804('0x33')][_0xd804('0x14')](queryCampaigns));_0x11f19e['push'](db['User']['findAll'](queryAgents));break;case _0xd804('0x34'):_0x50ce5e[_0x52c85c]('voice:inbound');_0x50ce5e[_0x52c85c](_0xd804('0x29'));_0x11f19e[_0xd804('0x2c')](getAssociatedResources(_0xd804('0x35'),_0x1858f0[_0xd804('0x1f')],_0xd804('0x2d')));_0x11f19e['push'](getAssociatedResources('ChatQueues',_0x1858f0[_0xd804('0x1f')],_0xd804('0x2e')));_0x11f19e[_0xd804('0x2c')](getAssociatedResources(_0xd804('0x11'),_0x1858f0['userProfileId'],'FaxQueue'));_0x11f19e[_0xd804('0x2c')](getAssociatedResources(_0xd804('0x36'),_0x1858f0[_0xd804('0x1f')],_0xd804('0x37')));_0x11f19e['push'](getAssociatedResources('MailQueues',_0x1858f0['userProfileId'],_0xd804('0x38')));_0x11f19e[_0xd804('0x2c')](getAssociatedResources(_0xd804('0x13'),_0x1858f0['userProfileId'],_0xd804('0x30')));_0x11f19e['push'](getAssociatedResources(_0xd804('0x39'),_0x1858f0[_0xd804('0x1f')],_0xd804('0x31')));_0x11f19e['push'](getAssociatedResources(_0xd804('0x15'),_0x1858f0[_0xd804('0x1f')],_0xd804('0x7')));_0x11f19e[_0xd804('0x2c')](getAssociatedResources('Trunks',_0x1858f0[_0xd804('0x1f')],_0xd804('0x32')));_0x11f19e[_0xd804('0x2c')](getAssociatedResources(_0xd804('0x16'),_0x1858f0[_0xd804('0x1f')],_0xd804('0x33')));_0x11f19e['push'](db['User'][_0xd804('0x14')](queryAgents));break;case'agent':_0x50ce5e[_0x52c85c](_0xd804('0x28'));_0x50ce5e[_0x52c85c](_0xd804('0x29'));_0x11f19e[_0xd804('0x2c')](_0x1858f0[_0xd804('0x3a')]({'attributes':['id',_0xd804('0x5')]}));_0x11f19e[_0xd804('0x2c')](_0x1858f0[_0xd804('0x3b')]({'attributes':['id',_0xd804('0x5')]}));_0x11f19e[_0xd804('0x2c')](_0x1858f0['getFaxQueues']({'attributes':['id','name']}));_0x11f19e[_0xd804('0x2c')](_0x1858f0[_0xd804('0x3c')]({'attributes':['id',_0xd804('0x5')]}));_0x11f19e[_0xd804('0x2c')](_0x1858f0['getMailQueues']({'attributes':['id','name']}));_0x11f19e[_0xd804('0x2c')](_0x1858f0['getOpenchannelQueues']({'attributes':['id',_0xd804('0x5')]}));_0x11f19e[_0xd804('0x2c')](_0x1858f0[_0xd804('0x3d')]({'attributes':['id',_0xd804('0x5')]}));break;}return BPromise[_0xd804('0x3e')](_0x11f19e);}})[_0xd804('0xf')](function(_0x38a454){if(_0x38a454&&_0x38a454[_0xd804('0x3f')]){for(var _0x4cf155=0x0;_0x4cf155<_0x38a454[_0xd804('0x3f')];_0x4cf155+=0x1){for(var _0x24a546=0x0;_0x24a546<_0x38a454[_0x4cf155]['length'];_0x24a546+=0x1){switch(_0x4cf155){case 0x0:joinOrLeaveQueues(_0x50ce5e,_0x52c85c,_0xd804('0x40'),_0x38a454[_0x4cf155][_0x24a546]);break;case 0x1:joinOrLeaveQueues(_0x50ce5e,_0x52c85c,_0xd804('0x41'),_0x38a454[_0x4cf155][_0x24a546]);break;case 0x2:joinOrLeaveQueues(_0x50ce5e,_0x52c85c,'fax',_0x38a454[_0x4cf155][_0x24a546]);break;case 0x3:joinOrLeaveQueues(_0x50ce5e,_0x52c85c,_0xd804('0x42'),_0x38a454[_0x4cf155][_0x24a546]);break;case 0x4:joinOrLeaveQueues(_0x50ce5e,_0x52c85c,'mail',_0x38a454[_0x4cf155][_0x24a546]);break;case 0x5:joinOrLeaveQueues(_0x50ce5e,_0x52c85c,_0xd804('0x43'),_0x38a454[_0x4cf155][_0x24a546]);break;case 0x6:joinOrLeaveQueues(_0x50ce5e,_0x52c85c,_0xd804('0x44'),_0x38a454[_0x4cf155][_0x24a546]);break;case 0x7:if(_0x2cde57['role']!==_0xd804('0x9'))_0x50ce5e[_0x52c85c](util[_0xd804('0x1b')]('telephone:%s',_0x38a454[_0x4cf155][_0x24a546][_0xd804('0x5')]));break;case 0x8:if(_0x2cde57[_0xd804('0x8')]!==_0xd804('0x9'))_0x50ce5e[_0x52c85c](util[_0xd804('0x1b')](_0xd804('0x45'),_0x38a454[_0x4cf155][_0x24a546][_0xd804('0x5')]));break;case 0x9:if(_0x2cde57[_0xd804('0x8')]!==_0xd804('0x9'))_0x50ce5e[_0x52c85c](util[_0xd804('0x1b')]('campaign:%s:%s',_0x38a454[_0x4cf155][_0x24a546][_0xd804('0xb')],_0x38a454[_0x4cf155][_0x24a546]['name']));break;case 0xa:_0x50ce5e[_0x52c85c](util[_0xd804('0x1b')](_0xd804('0x27'),_0x38a454[_0x4cf155][_0x24a546][_0xd804('0x5')]));break;}}}}})[_0xd804('0xf')](function(){if(_0x52c85c===_0xd804('0x46')){var _0xeb1408=_[_0xd804('0x47')](_0x2cde57[_0xd804('0x48')],'id');return _0x2cde57[_0xd804('0x49')](_0xeb1408)['then'](function(){for(var _0x465429=0x0;_0x465429<_0xeb1408[_0xd804('0x3f')];_0x465429+=0x1){_0x51b191['emit'](_0xd804('0x4a'),{'ChatInteractionId':Number(_0xeb1408[_0x465429]),'UserId':Number(_0x2cde57['id'])});}});}})[_0xd804('0xf')](function(){if(_0x52c85c===_0xd804('0x46')){var _0x5139ee=_[_0xd804('0x47')](_0x2cde57[_0xd804('0x22')],'id');return _0x2cde57[_0xd804('0x4b')](_0x5139ee)[_0xd804('0xf')](function(){for(var _0x5af81d=0x0;_0x5af81d<_0x5139ee['length'];_0x5af81d+=0x1){_0x51b191[_0xd804('0x4c')](_0xd804('0x4d'),{'MailInteractionId':Number(_0x5139ee[_0x5af81d]),'UserId':Number(_0x2cde57['id'])});}});}})[_0xd804('0xf')](function(){if(_0x52c85c===_0xd804('0x46')){var _0x37e174=_[_0xd804('0x47')](_0x2cde57[_0xd804('0x4e')],'id');return _0x2cde57[_0xd804('0x4f')](_0x37e174)[_0xd804('0xf')](function(){for(var _0x5947ce=0x0;_0x5947ce<_0x37e174[_0xd804('0x3f')];_0x5947ce+=0x1){_0x51b191['emit'](_0xd804('0x50'),{'FaxInteractionId':Number(_0x37e174[_0x5947ce]),'UserId':Number(_0x2cde57['id'])});}});}})[_0xd804('0xf')](function(){if(_0x52c85c===_0xd804('0x46')){var _0x9203e5=_['map'](_0x2cde57[_0xd804('0x23')],'id');return _0x2cde57[_0xd804('0x51')](_0x9203e5)[_0xd804('0xf')](function(){for(var _0x3c3405=0x0;_0x3c3405<_0x9203e5[_0xd804('0x3f')];_0x3c3405+=0x1){_0x51b191['emit'](_0xd804('0x52'),{'SmsInteractionId':Number(_0x9203e5[_0x3c3405]),'UserId':Number(_0x2cde57['id'])});}});}})[_0xd804('0xf')](function(){if(_0x52c85c===_0xd804('0x46')){var _0x46a608=_[_0xd804('0x47')](_0x2cde57[_0xd804('0x25')],'id');return _0x2cde57[_0xd804('0x53')](_0x46a608)['then'](function(){for(var _0x4b6327=0x0;_0x4b6327<_0x46a608[_0xd804('0x3f')];_0x4b6327+=0x1){_0x51b191[_0xd804('0x4c')](_0xd804('0x54'),{'OpenchannelInteractionId':Number(_0x46a608[_0x4b6327]),'UserId':Number(_0x2cde57['id'])});}});}})['then'](function(){if(_0x52c85c===_0xd804('0x46')){var _0x43bd48=_[_0xd804('0x47')](_0x2cde57[_0xd804('0x26')],'id');return _0x2cde57[_0xd804('0x55')](_0x43bd48)[_0xd804('0xf')](function(){for(var _0x2cccce=0x0;_0x2cccce<_0x43bd48['length'];_0x2cccce+=0x1){_0x51b191[_0xd804('0x4c')](_0xd804('0x56'),{'WhatsappInteractionId':Number(_0x43bd48[_0x2cccce]),'UserId':Number(_0x2cde57['id'])});}});}})[_0xd804('0x57')](function(_0x511456){_0x50ce5e[_0xd804('0x58')](_0x511456);});}}function onDisconnect(_0x141ea7,_0x266127){joinOrLeave(_0x141ea7,_0xd804('0x46'),_0x266127);}function onConnect(_0x2d14a9){joinOrLeave(_0x2d14a9,'join');}exports[_0xd804('0x59')]=function(_0x397c57){_0x397c57['on'](_0xd804('0x5a'),function(_0x5806cd){_0x5806cd[_0xd804('0x5b')](0x0);_0x5806cd[_0xd804('0x5c')]=_0x5806cd['request']['connection'][_0xd804('0x5d')]+':'+_0x5806cd[_0xd804('0x5e')][_0xd804('0x5a')][_0xd804('0x5f')];_0x5806cd[_0xd804('0x60')]=new Date();_0x5806cd[_0xd804('0x58')]=function(_0x37aa4d){console[_0xd804('0x58')](_0xd804('0x61')+_0x5806cd['nsp'][_0xd804('0x5')]+'['+_0x5806cd[_0xd804('0x5c')]+']',_0x37aa4d);};_0x5806cd['on'](_0xd804('0x62'),function(){onDisconnect(_0x5806cd,_0x397c57);_0x5806cd[_0xd804('0x58')](_0xd804('0x63'));});onConnect(_0x5806cd);_0x5806cd['log'](_0xd804('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3e5712b..a3041fe 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 _0x4f0f=['WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','error','catch','Trigger,\x20%s','channel','event','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','SELECT','contact','UserId','SIP/%s','name','agent','outgoingmessage','AfterCreateMessage','get','motionChannel','offlineMessage','sequelize','interface','format','AfterCreate','closed','changed','substatus','AfterUpdate','User','fullname','email','default','length','hasOwnProperty','model','callback','toLowerCase','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','afterUpdate','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','closedinteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4f0f,0x1d7));var _0xf4f0=function(_0x4321bc,_0x1217c7){_0x4321bc=_0x4321bc-0x0;var _0x402f2d=_0x4f0f[_0x4321bc];return _0x402f2d;};'use strict';var util=require(_0xf4f0('0x0'));var db=require(_0xf4f0('0x1'))['db'];var jayson=require(_0xf4f0('0x2'));var logger=require(_0xf4f0('0x3'))(_0xf4f0('0x4'));var client=jayson[_0xf4f0('0x5')][_0xf4f0('0x6')]({'port':0x232a});var triggers=[{'channel':_0xf4f0('0x7'),'model':'ChatInteraction','event':_0xf4f0('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xf4f0('0x7'),'model':'ChatInteraction','event':_0xf4f0('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf4f0('0x7'),'model':'ChatMessage','event':_0xf4f0('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf4f0('0x7'),'model':_0xf4f0('0xa'),'event':_0xf4f0('0x8'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xf4f0('0xb'),'model':_0xf4f0('0xc'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0xd'),'callback':afterCreate},{'channel':_0xf4f0('0xb'),'model':_0xf4f0('0xc'),'event':_0xf4f0('0x9'),'condition':_0xf4f0('0xe'),'callback':afterUpdate},{'channel':_0xf4f0('0xb'),'model':_0xf4f0('0xf'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0x10'),'callback':afterCreateMessage},{'channel':_0xf4f0('0x11'),'model':_0xf4f0('0x12'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0xd'),'callback':afterCreate},{'channel':_0xf4f0('0x11'),'model':_0xf4f0('0x12'),'event':_0xf4f0('0x9'),'condition':_0xf4f0('0xe'),'callback':afterUpdate},{'channel':_0xf4f0('0x11'),'model':_0xf4f0('0x13'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0x10'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xf4f0('0x14'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0xd'),'callback':afterCreate},{'channel':_0xf4f0('0x15'),'model':_0xf4f0('0x14'),'event':_0xf4f0('0x9'),'condition':_0xf4f0('0xe'),'callback':afterUpdate},{'channel':_0xf4f0('0x15'),'model':_0xf4f0('0x16'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0x10'),'callback':afterCreateMessage},{'channel':_0xf4f0('0x17'),'model':_0xf4f0('0x18'),'event':'afterCreate','condition':_0xf4f0('0xd'),'callback':afterCreate},{'channel':_0xf4f0('0x17'),'model':_0xf4f0('0x18'),'event':_0xf4f0('0x9'),'condition':_0xf4f0('0xe'),'callback':afterUpdate},{'channel':_0xf4f0('0x17'),'model':_0xf4f0('0x19'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0x10'),'callback':afterCreateMessage},{'channel':_0xf4f0('0x1a'),'model':_0xf4f0('0x1b'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0xd'),'callback':afterCreate},{'channel':_0xf4f0('0x1a'),'model':'OpenchannelInteraction','event':_0xf4f0('0x9'),'condition':_0xf4f0('0xe'),'callback':afterUpdate},{'channel':_0xf4f0('0x1a'),'model':_0xf4f0('0x1c'),'event':_0xf4f0('0x8'),'condition':_0xf4f0('0x10'),'callback':afterCreateMessage}];function request(_0x2a3b85){return client['request'](_0xf4f0('0x1d'),_0x2a3b85)[_0xf4f0('0x1e')](function(_0x2432d3){logger['info']('Trigger,\x20%s',_0xf4f0('0x1d'),_0x2432d3);if(_0x2432d3['error']){if(_0x2432d3[_0xf4f0('0x1f')]['code']===0x1f4){logger[_0xf4f0('0x1f')]('Trigger,\x20%s',_0xf4f0('0x1d'),_0x2432d3[_0xf4f0('0x1f')]);}}})[_0xf4f0('0x20')](function(_0xd661e){logger[_0xf4f0('0x1f')](_0xf4f0('0x21'),_0xf4f0('0x1d'),_0xd661e);});}function afterCreateMessage(_0x102828){return function(_0x4831cc){_0x4831cc=_0x4831cc['get']({'plain':!![]});_0x4831cc[_0xf4f0('0x22')]=_0x102828;_0x4831cc['motionChannel']=_0x102828;_0x4831cc[_0xf4f0('0x23')]=_0x4831cc['direction'];Promise[_0xf4f0('0x24')]()[_0xf4f0('0x1e')](function(){if(typeof _0x4831cc[_0xf4f0('0x25')]===_0xf4f0('0x26'))return null;var _0x33c353=_0xf4f0('0x27')+_0x4831cc[_0xf4f0('0x25')];return db['sequelize'][_0xf4f0('0x28')](_0x33c353,{'type':db[_0xf4f0('0x29')]['QueryTypes'][_0xf4f0('0x2a')],'raw':!![]});})[_0xf4f0('0x1e')](function(_0x41db88){if(_0x41db88){_0x4831cc[_0xf4f0('0x2b')]=_0x41db88[0x0];}if(typeof _0x4831cc['UserId']===_0xf4f0('0x26'))return;return getAgent(_0x4831cc[_0xf4f0('0x2c')]);})[_0xf4f0('0x1e')](function(_0x5e7a6a){if(_0x5e7a6a){_0x4831cc['interface']=util['format'](_0xf4f0('0x2d'),_0x5e7a6a[_0xf4f0('0x2e')]);_0x4831cc[_0xf4f0('0x2f')]=_0x5e7a6a;_0x4831cc[_0xf4f0('0x22')]=_0x102828;return request({'event':'incomingmessage','message':_0x4831cc});}else{return request({'event':_0xf4f0('0x30'),'message':_0x4831cc});}})[_0xf4f0('0x20')](function(_0x52bdc4){logger[_0xf4f0('0x1f')](_0xf4f0('0x21'),_0xf4f0('0x31'),_0x52bdc4);});};}function afterCreateOfflineMessage(_0x2b6b4d){return function(_0x4e0e12){_0x4e0e12=_0x4e0e12[_0xf4f0('0x32')]({'plain':!![]});_0x4e0e12[_0xf4f0('0x22')]=_0x2b6b4d;_0x4e0e12[_0xf4f0('0x33')]=_0x2b6b4d;_0x4e0e12[_0xf4f0('0x23')]=_0xf4f0('0x34');return request({'event':_0x4e0e12['event'],'message':_0x4e0e12});};}function afterCreate(_0x36aa2b,_0x5c0b6b){return function(_0x534794){_0x534794=_0x534794[_0xf4f0('0x32')]({'plain':!![]});_0x534794['channel']=_0x36aa2b;_0x534794[_0xf4f0('0x33')]=_0x36aa2b;_0x534794[_0xf4f0('0x23')]='opened';Promise[_0xf4f0('0x24')]()[_0xf4f0('0x1e')](function(){var _0x14a7cf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x534794['ContactId'];return db[_0xf4f0('0x35')][_0xf4f0('0x28')](_0x14a7cf,{'type':db[_0xf4f0('0x29')]['QueryTypes'][_0xf4f0('0x2a')],'raw':!![]});})[_0xf4f0('0x1e')](function(_0x3da59c){if(_0x3da59c){_0x534794[_0xf4f0('0x2b')]=_0x3da59c[0x0];}if(typeof _0x534794[_0xf4f0('0x2c')]===_0xf4f0('0x26'))return;return getAgent(_0x534794[_0xf4f0('0x2c')]);})[_0xf4f0('0x1e')](function(_0xaa0fbf){if(_0xaa0fbf){_0x534794[_0xf4f0('0x36')]=util[_0xf4f0('0x37')](_0xf4f0('0x2d'),_0xaa0fbf[_0xf4f0('0x2e')]);_0x534794[_0xf4f0('0x2f')]=_0xaa0fbf;}return request({'event':_0x5c0b6b,'message':_0x534794});})[_0xf4f0('0x20')](function(_0x30cada){logger[_0xf4f0('0x1f')](_0xf4f0('0x21'),_0xf4f0('0x38'),_0x30cada);});};}function afterUpdate(_0x7a02a6){return function(_0x1666d8){var _0x3ce8d6=_0x1666d8['changed'](_0xf4f0('0x39'))&&_0x1666d8[_0xf4f0('0x39')];var _0x5d98f4=_0x1666d8[_0xf4f0('0x3a')](_0xf4f0('0x3b'));if(_0x3ce8d6||_0x5d98f4){var _0x1ac03a=_0x3ce8d6?_0xf4f0('0xe'):_0xf4f0('0x3b');var _0x484750=_0x1666d8[_0xf4f0('0x32')]({'plain':!![]});_0x484750['channel']=_0x7a02a6;_0x484750['motionChannel']=_0x7a02a6;_0x484750[_0xf4f0('0x23')]=_0x3ce8d6?'closed':_0xf4f0('0x3b');var _0x542395=_0xf4f0('0x27')+_0x484750[_0xf4f0('0x25')];return db[_0xf4f0('0x35')][_0xf4f0('0x28')](_0x542395,{'type':db[_0xf4f0('0x29')]['QueryTypes'][_0xf4f0('0x2a')],'raw':!![]})['then'](function(_0x542599){if(_0x542599){_0x484750[_0xf4f0('0x2b')]=_0x542599[0x0];}if(typeof _0x484750[_0xf4f0('0x2c')]==='undefined')return;return getAgent(_0x484750['UserId']);})[_0xf4f0('0x1e')](function(_0x3b938f){if(_0x3b938f){_0x484750[_0xf4f0('0x36')]=util[_0xf4f0('0x37')](_0xf4f0('0x2d'),_0x3b938f[_0xf4f0('0x2e')]);_0x484750['agent']=_0x3b938f;}return request({'event':_0x1ac03a,'message':_0x484750});})[_0xf4f0('0x20')](function(_0x4e1b79){logger[_0xf4f0('0x1f')](_0xf4f0('0x21'),_0xf4f0('0x3c'),_0x4e1b79);});}};}function getAgent(_0x588fa7){return db[_0xf4f0('0x3d')]['find']({'where':{'id':_0x588fa7},'attributes':['id',_0xf4f0('0x2e'),_0xf4f0('0x3e'),_0xf4f0('0x3f'),'internal'],'raw':!![]})[_0xf4f0('0x1e')](function(_0x26e435){return _0x26e435;});}exports[_0xf4f0('0x40')]=function(){for(var _0x25baa7=0x0;_0x25baa7=_0x2baa61[_0xf150('0x12')]){throw Error(_0xf150('0x13'));}_0x1ac11f(_0x10c4f7);})[_0xf150('0x14')](function(_0x1efff5){_0x54ae5f(_0x1efff5);});});}; \ No newline at end of file +var _0x13aa=['clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','mail','chat','fax','whatsapp','openchannel','getChannels'];(function(_0xe2d6aa,_0x537dc5){var _0x53aeb3=function(_0x57ae4f){while(--_0x57ae4f){_0xe2d6aa['push'](_0xe2d6aa['shift']());}};_0x53aeb3(++_0x537dc5);}(_0x13aa,0x199));var _0xa13a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13aa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa13a('0x0'));var BPromise=require(_0xa13a('0x1'));var db=require(_0xa13a('0x2'))['db'];var util=require('./license/util');var channels=['voice',_0xa13a('0x3'),_0xa13a('0x4'),_0xa13a('0x5'),'sms',_0xa13a('0x6'),_0xa13a('0x7')];exports[_0xa13a('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x34e0ae){_0x34e0ae=_0x34e0ae['toLowerCase']();return _['includes'](channels,_0x34e0ae);};exports[_0xa13a('0x9')]=function(_0x4603da,_0x262d29,_0x1ae9c6,_0x1c34ec){var _0xdc556={'loginAttempts':_0x262d29,'blocked':_0x1ae9c6};if(!_[_0xa13a('0xa')](_0x1c34ec)){_0xdc556[_0xa13a('0xb')]=_0x1c34ec;}return _0x4603da[_0xa13a('0xc')](_0xdc556);};exports['getLicense']=function(_0x3a3233){return new BPromise(function(_0x496ac1,_0x432f55){var _0xebbb74=0x0;if(_0x3a3233[_0xa13a('0xd')]!==_0xa13a('0xe')){_0x496ac1(_0x3a3233);}db[_0xa13a('0xf')][_0xa13a('0x10')]({'where':{'role':_0xa13a('0xe'),'online':!![],'id':{'$ne':_0x3a3233['id']}}})[_0xa13a('0x11')](function(_0x567323){_0xebbb74=_0x567323;return util[_0xa13a('0x12')]();})['then'](function(_0xb23abe){if(_0xb23abe&&_0xb23abe[_0xa13a('0x13')]&&_0xebbb74>=_0xb23abe[_0xa13a('0x13')]){throw Error(_0xa13a('0x14'));}_0x496ac1(_0x3a3233);})[_0xa13a('0x15')](function(_0x2ed011){_0x432f55(_0x2ed011);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 442f90f..fcc9288 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x5c70ad,_0x57bed4){var _0x1bba68=function(_0x384547){while(--_0x384547){_0x5c70ad['push'](_0x5c70ad['shift']());}};_0x1bba68(++_0x57bed4);}(_0xadb5,0xad));var _0x5adb=function(_0x3a9850,_0x47535a){_0x3a9850=_0x3a9850-0x0;var _0x52ec1d=_0xadb5[_0x3a9850];return _0x52ec1d;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x9bde=['exports','../config/logger','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','OutOfInterval','error','stack','send'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5c372b,_0x16da3c){_0x5c372b=_0x5c372b-0x0;var _0x453278=_0x9bde[_0x5c372b];return _0x453278;};'use strict';var util=require('util');var logger=require(_0xe9bd('0x0'))('api');var APIError=function(_0xc79e0b,_0x4c63ca){this[_0xe9bd('0x1')]=_0xc79e0b||_0xe9bd('0x2');this[_0xe9bd('0x3')]=_0x4c63ca||_0xe9bd('0x4');util[_0xe9bd('0x5')](APIError,Error);};var APIBadRequestError=function(_0x1a4d14){this[_0xe9bd('0x1')]=_0x1a4d14||'Bad\x20Request';this[_0xe9bd('0x3')]=_0xe9bd('0x6');util[_0xe9bd('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xa66ae2){this[_0xe9bd('0x1')]=_0xa66ae2||_0xe9bd('0x7');this[_0xe9bd('0x3')]=_0xe9bd('0x8');util[_0xe9bd('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x45c7ba){switch(_0x45c7ba){case'Bad\x20Request':return 0x190;case'Forbidden',_0xe9bd('0x9'):return 0x193;case _0xe9bd('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2601ac){return function(_0x581ab9){logger[_0xe9bd('0xa')](_0x581ab9[_0xe9bd('0xb')]);var _0x3339f9=getStatusCode(_0x581ab9[_0xe9bd('0x3')]);if(_0x581ab9['name'])delete _0x581ab9[_0xe9bd('0x3')];return _0x2601ac['status'](_0x3339f9)[_0xe9bd('0xc')](_0x581ab9);};}module[_0xe9bd('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a386414..fab09ed 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c3=['exports','404','status','json'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0xb4c3,0x1c8));var _0x3b4c=function(_0x405d13,_0x250743){_0x405d13=_0x405d13-0x0;var _0x29e353=_0xb4c3[_0x405d13];return _0x29e353;};'use strict';module[_0x3b4c('0x0')][0x194]=function pageNotFound(_0x136c7c,_0x2fdcaf){var _0xab8387=_0x3b4c('0x1');var _0x26f72e=0x194;var _0x56b2e2={'status':_0x26f72e};_0x2fdcaf[_0x3b4c('0x2')](_0x56b2e2['status']);_0x2fdcaf['render'](_0xab8387,{},function(_0x377328,_0x23df2b){if(_0x377328){return _0x2fdcaf['status'](_0x56b2e2[_0x3b4c('0x2')])[_0x3b4c('0x3')](_0x56b2e2);}_0x2fdcaf['send'](_0x23df2b);});}; \ No newline at end of file +var _0xd7ff=['404','status','render','json','send','exports'];(function(_0x306100,_0x4e8ee9){var _0x57ff89=function(_0x17f303){while(--_0x17f303){_0x306100['push'](_0x306100['shift']());}};_0x57ff89(++_0x4e8ee9);}(_0xd7ff,0x6b));var _0xfd7f=function(_0x106629,_0x499504){_0x106629=_0x106629-0x0;var _0x770cfb=_0xd7ff[_0x106629];return _0x770cfb;};'use strict';module[_0xfd7f('0x0')][0x194]=function pageNotFound(_0x98068c,_0x322089){var _0x3446a0=_0xfd7f('0x1');var _0x58e02d=0x194;var _0x58184b={'status':_0x58e02d};_0x322089[_0xfd7f('0x2')](_0x58184b['status']);_0x322089[_0xfd7f('0x3')](_0x3446a0,{},function(_0x589f6d,_0x47eee3){if(_0x589f6d){return _0x322089[_0xfd7f('0x2')](_0x58184b[_0xfd7f('0x2')])[_0xfd7f('0x4')](_0x58184b);}_0x322089[_0xfd7f('0x5')](_0x47eee3);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1f4be53..bd873a4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../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','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../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','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 334e509..1595831 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x833b=['./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','/index.html','express','./config/environment','setupLoggers','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x833b,0x131));var _0xb833=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x833b[_0x5a9c0c];return _0x53c77d;};'use strict';var path=require('path');var express=require(_0xb833('0x0'));var errors=require('./errors');var config=require(_0xb833('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0xb833('0x2')];var clientSideLogs=require('./api/client-side-logs');exports[_0xb833('0x3')]=function(_0x37ea87){return setupLoggers(_0x37ea87)[_0xb833('0x4')](function(){_0x37ea87[_0xb833('0x5')](_0xb833('0x6'),require(_0xb833('0x7')));_0x37ea87[_0xb833('0x5')]('/api/voice/chanspy',require(_0xb833('0x8')));_0x37ea87[_0xb833('0x5')](_0xb833('0x9'),require(_0xb833('0xa')));_0x37ea87[_0xb833('0x5')](_0xb833('0xb'),require(_0xb833('0xc')));_0x37ea87['use'](_0xb833('0xd'),require('./api/voiceMusicOnHold'));_0x37ea87[_0xb833('0x5')](_0xb833('0xe'),require(_0xb833('0xf')));_0x37ea87[_0xb833('0x5')]('/api/voice/recordings',require('./api/voiceRecording'));_0x37ea87[_0xb833('0x5')](_0xb833('0x10'),require('./api/screenRecording'));_0x37ea87[_0xb833('0x5')]('/api/voice/mails',require(_0xb833('0x11')));_0x37ea87[_0xb833('0x5')](_0xb833('0x12'),require(_0xb833('0x13')));_0x37ea87[_0xb833('0x5')](_0xb833('0x14'),require(_0xb833('0x15')));_0x37ea87[_0xb833('0x5')]('/api/voice/dials/reports',require(_0xb833('0x16')));_0x37ea87[_0xb833('0x5')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x37ea87[_0xb833('0x5')]('/api/voice/queues/reports',require(_0xb833('0x17')));_0x37ea87[_0xb833('0x5')]('/api/members/reports',require(_0xb833('0x18')));_0x37ea87[_0xb833('0x5')]('/api/trunks',require(_0xb833('0x19')));_0x37ea87[_0xb833('0x5')](_0xb833('0x1a'),require('./api/voiceTransferReport'));_0x37ea87[_0xb833('0x5')](_0xb833('0x1b'),require(_0xb833('0x1c')));_0x37ea87[_0xb833('0x5')]('/api/mail/accounts',require('./api/mailAccount'));_0x37ea87[_0xb833('0x5')](_0xb833('0x1d'),require(_0xb833('0x1e')));_0x37ea87[_0xb833('0x5')](_0xb833('0x1f'),require(_0xb833('0x20')));_0x37ea87['use'](_0xb833('0x21'),require('./api/mailInteraction'));_0x37ea87['use']('/api/mail/messages',require(_0xb833('0x22')));_0x37ea87[_0xb833('0x5')](_0xb833('0x23'),require('./api/mailApplication'));_0x37ea87[_0xb833('0x5')](_0xb833('0x24'),require('./api/mailQueueReport'));_0x37ea87[_0xb833('0x5')](_0xb833('0x25'),require('./api/dashboard'));_0x37ea87[_0xb833('0x5')]('/api/dashboards/items',require(_0xb833('0x26')));_0x37ea87[_0xb833('0x5')](_0xb833('0x27'),require('./api/faxAccount'));_0x37ea87[_0xb833('0x5')](_0xb833('0x28'),require(_0xb833('0x29')));_0x37ea87['use'](_0xb833('0x2a'),require(_0xb833('0x2b')));_0x37ea87[_0xb833('0x5')]('/api/fax/messages',require('./api/faxMessage'));_0x37ea87[_0xb833('0x5')]('/api/fax/queues',require(_0xb833('0x2c')));_0x37ea87[_0xb833('0x5')](_0xb833('0x2d'),require(_0xb833('0x2e')));_0x37ea87[_0xb833('0x5')](_0xb833('0x2f'),require('./api/smsAccount'));_0x37ea87['use'](_0xb833('0x30'),require(_0xb833('0x31')));_0x37ea87[_0xb833('0x5')](_0xb833('0x32'),require(_0xb833('0x33')));_0x37ea87[_0xb833('0x5')]('/api/sms/messages',require('./api/smsMessage'));_0x37ea87['use'](_0xb833('0x34'),require(_0xb833('0x35')));_0x37ea87[_0xb833('0x5')](_0xb833('0x36'),require(_0xb833('0x37')));_0x37ea87[_0xb833('0x5')](_0xb833('0x38'),require(_0xb833('0x39')));_0x37ea87[_0xb833('0x5')](_0xb833('0x3a'),require(_0xb833('0x3b')));_0x37ea87[_0xb833('0x5')](_0xb833('0x3c'),require('./api/openchannelMessage'));_0x37ea87[_0xb833('0x5')]('/api/openchannel/queues',require(_0xb833('0x3d')));_0x37ea87['use'](_0xb833('0x3e'),require('./api/chatWebsite'));_0x37ea87[_0xb833('0x5')](_0xb833('0x3f'),require(_0xb833('0x40')));_0x37ea87[_0xb833('0x5')]('/api/chat/applications',require(_0xb833('0x41')));_0x37ea87[_0xb833('0x5')](_0xb833('0x42'),require('./api/chatInteraction'));_0x37ea87[_0xb833('0x5')](_0xb833('0x43'),require(_0xb833('0x44')));_0x37ea87[_0xb833('0x5')](_0xb833('0x45'),require(_0xb833('0x46')));_0x37ea87[_0xb833('0x5')](_0xb833('0x47'),require(_0xb833('0x48')));_0x37ea87[_0xb833('0x5')]('/api/chat/groups',require(_0xb833('0x49')));_0x37ea87[_0xb833('0x5')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x37ea87[_0xb833('0x5')]('/api/cm/companies',require(_0xb833('0x4a')));_0x37ea87['use'](_0xb833('0x4b'),require(_0xb833('0x4c')));_0x37ea87[_0xb833('0x5')](_0xb833('0x4d'),require(_0xb833('0x4e')));_0x37ea87[_0xb833('0x5')]('/api/cm/hopper_black',require(_0xb833('0x4f')));_0x37ea87['use'](_0xb833('0x50'),require(_0xb833('0x51')));_0x37ea87[_0xb833('0x5')]('/api/cm/hopper_history',require(_0xb833('0x52')));_0x37ea87[_0xb833('0x5')](_0xb833('0x53'),require(_0xb833('0x54')));_0x37ea87['use']('/api/actions',require(_0xb833('0x55')));_0x37ea87[_0xb833('0x5')](_0xb833('0x56'),require(_0xb833('0x57')));_0x37ea87[_0xb833('0x5')](_0xb833('0x58'),require(_0xb833('0x59')));_0x37ea87['use'](_0xb833('0x5a'),require(_0xb833('0x5b')));_0x37ea87[_0xb833('0x5')]('/api/conditions',require('./api/condition'));_0x37ea87[_0xb833('0x5')]('/api/intervals',require(_0xb833('0x5c')));_0x37ea87[_0xb833('0x5')]('/api/pauses',require(_0xb833('0x5d')));_0x37ea87[_0xb833('0x5')](_0xb833('0x5e'),require(_0xb833('0x5f')));_0x37ea87[_0xb833('0x5')](_0xb833('0x60'),require('./api/voiceQueuesLog'));_0x37ea87[_0xb833('0x5')](_0xb833('0x61'),require(_0xb833('0x62')));_0x37ea87['use'](_0xb833('0x63'),require(_0xb833('0x64')));_0x37ea87[_0xb833('0x5')]('/api/tags',require('./api/tag'));_0x37ea87[_0xb833('0x5')]('/api/contact_item_types',require('./api/contactItemType'));_0x37ea87[_0xb833('0x5')](_0xb833('0x65'),require(_0xb833('0x66')));_0x37ea87['use'](_0xb833('0x67'),require(_0xb833('0x68')));_0x37ea87[_0xb833('0x5')](_0xb833('0x69'),require(_0xb833('0x6a')));_0x37ea87['use'](_0xb833('0x6b'),require('./api/trigger'));_0x37ea87[_0xb833('0x5')](_0xb833('0x6c'),require(_0xb833('0x6d')));_0x37ea87['use'](_0xb833('0x6e'),require(_0xb833('0x6f')));_0x37ea87[_0xb833('0x5')]('/api/integrations/reports',require('./api/integrationReport'));_0x37ea87['use'](_0xb833('0x70'),require('./api/analyticCustomReport'));_0x37ea87[_0xb833('0x5')](_0xb833('0x71'),require(_0xb833('0x72')));_0x37ea87[_0xb833('0x5')]('/api/analytics/extracted_reports',require(_0xb833('0x73')));_0x37ea87[_0xb833('0x5')](_0xb833('0x74'),require(_0xb833('0x75')));_0x37ea87[_0xb833('0x5')](_0xb833('0x76'),require(_0xb833('0x77')));_0x37ea87[_0xb833('0x5')]('/api/analytics/tree_reports',require(_0xb833('0x78')));_0x37ea87[_0xb833('0x5')](_0xb833('0x79'),require(_0xb833('0x7a')));_0x37ea87['use'](_0xb833('0x7b'),require('./api/intSalesforceConfiguration'));_0x37ea87[_0xb833('0x5')](_0xb833('0x7c'),require('./api/intSalesforceField'));_0x37ea87[_0xb833('0x5')](_0xb833('0x7d'),require(_0xb833('0x7e')));_0x37ea87[_0xb833('0x5')](_0xb833('0x7f'),require('./api/intSugarcrmConfiguration'));_0x37ea87[_0xb833('0x5')](_0xb833('0x80'),require('./api/intSugarcrmField'));_0x37ea87[_0xb833('0x5')]('/api/integrations/desk/accounts',require(_0xb833('0x81')));_0x37ea87[_0xb833('0x5')](_0xb833('0x82'),require(_0xb833('0x83')));_0x37ea87[_0xb833('0x5')](_0xb833('0x84'),require(_0xb833('0x85')));_0x37ea87['use']('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x37ea87[_0xb833('0x5')](_0xb833('0x86'),require(_0xb833('0x87')));_0x37ea87['use'](_0xb833('0x88'),require('./api/intZohoField'));_0x37ea87[_0xb833('0x5')](_0xb833('0x89'),require(_0xb833('0x8a')));_0x37ea87[_0xb833('0x5')](_0xb833('0x8b'),require(_0xb833('0x8c')));_0x37ea87[_0xb833('0x5')](_0xb833('0x8d'),require(_0xb833('0x8e')));_0x37ea87[_0xb833('0x5')](_0xb833('0x8f'),require(_0xb833('0x90')));_0x37ea87[_0xb833('0x5')](_0xb833('0x91'),require(_0xb833('0x92')));_0x37ea87[_0xb833('0x5')](_0xb833('0x93'),require(_0xb833('0x94')));_0x37ea87[_0xb833('0x5')]('/api/integrations/vtiger/accounts',require(_0xb833('0x95')));_0x37ea87[_0xb833('0x5')]('/api/integrations/vtiger/configurations',require(_0xb833('0x96')));_0x37ea87[_0xb833('0x5')](_0xb833('0x97'),require('./api/intVtigerField'));_0x37ea87['use']('/api/integrations/servicenow/accounts',require(_0xb833('0x98')));_0x37ea87[_0xb833('0x5')](_0xb833('0x99'),require('./api/intServicenowConfiguration'));_0x37ea87['use'](_0xb833('0x9a'),require(_0xb833('0x9b')));_0x37ea87[_0xb833('0x5')](_0xb833('0x9c'),require('./api/intDynamics365Account'));_0x37ea87[_0xb833('0x5')](_0xb833('0x9d'),require(_0xb833('0x9e')));_0x37ea87[_0xb833('0x5')](_0xb833('0x9f'),require(_0xb833('0xa0')));_0x37ea87[_0xb833('0x5')]('/api/integrations/freshsales/accounts',require(_0xb833('0xa1')));_0x37ea87[_0xb833('0x5')](_0xb833('0xa2'),require(_0xb833('0xa3')));_0x37ea87[_0xb833('0x5')](_0xb833('0xa4'),require(_0xb833('0xa5')));_0x37ea87[_0xb833('0x5')](_0xb833('0xa6'),require(_0xb833('0xa7')));_0x37ea87[_0xb833('0x5')]('/api/chat/reports/queue',require(_0xb833('0xa8')));_0x37ea87[_0xb833('0x5')](_0xb833('0xa9'),require(_0xb833('0xaa')));_0x37ea87[_0xb833('0x5')]('/api/jscripty/answers/reports',require(_0xb833('0xab')));_0x37ea87[_0xb833('0x5')](_0xb833('0xac'),require(_0xb833('0xad')));_0x37ea87[_0xb833('0x5')](_0xb833('0xae'),require(_0xb833('0xaf')));_0x37ea87[_0xb833('0x5')](_0xb833('0xb0'),require(_0xb833('0xb1')));_0x37ea87[_0xb833('0x5')](_0xb833('0xb2'),require(_0xb833('0xb3')));_0x37ea87[_0xb833('0x5')]('/api/square/details/reports',require(_0xb833('0xb4')));_0x37ea87['use'](_0xb833('0xb5'),require(_0xb833('0xb6')));_0x37ea87[_0xb833('0x5')](_0xb833('0xb7'),require(_0xb833('0xb8')));_0x37ea87[_0xb833('0x5')](_0xb833('0xb9'),require('./api/squareOdbc'));_0x37ea87[_0xb833('0x5')](_0xb833('0xba'),require(_0xb833('0xbb')));_0x37ea87['use'](_0xb833('0xbc'),require(_0xb833('0xbd')));_0x37ea87['use']('/api/square/messages',require(_0xb833('0xbe')));_0x37ea87[_0xb833('0x5')](_0xb833('0xbf'),require(_0xb833('0xc0')));_0x37ea87[_0xb833('0x5')](_0xb833('0xc1'),require(_0xb833('0xc2')));_0x37ea87['use']('/api/campaigns',require(_0xb833('0xc3')));_0x37ea87[_0xb833('0x5')]('/api/migrations',require(_0xb833('0xc4')));_0x37ea87['use'](_0xb833('0xc5'),require(_0xb833('0xc6')));_0x37ea87[_0xb833('0x5')](_0xb833('0xc7'),require(_0xb833('0xc8')));_0x37ea87[_0xb833('0x5')](_0xb833('0xc9'),require(_0xb833('0xca')));_0x37ea87['use'](_0xb833('0xcb'),require(_0xb833('0xcc')));_0x37ea87[_0xb833('0x5')](_0xb833('0xcd'),require(_0xb833('0xce')));_0x37ea87['use'](_0xb833('0xcf'),require(_0xb833('0xd0')));_0x37ea87[_0xb833('0x5')](_0xb833('0xd1'),require('./api/smsTransferReport'));_0x37ea87['use'](_0xb833('0xd2'),require(_0xb833('0xd3')));_0x37ea87['use'](_0xb833('0xd4'),require(_0xb833('0xd5')));_0x37ea87[_0xb833('0x5')](_0xb833('0xd6'),require('./api/userProfile'));_0x37ea87[_0xb833('0x5')](_0xb833('0xd7'),require('./api/userProfileSection'));_0x37ea87[_0xb833('0x5')](_0xb833('0xd8'),require('./api/userProfileResource'));_0x37ea87['use'](_0xb833('0xd9'),require(_0xb833('0xda')));_0x37ea87['use']('/api/whatsapp/accounts',require(_0xb833('0xdb')));_0x37ea87['use'](_0xb833('0xdc'),require(_0xb833('0xdd')));_0x37ea87[_0xb833('0x5')]('/api/whatsapp/interactions',require(_0xb833('0xde')));_0x37ea87[_0xb833('0x5')]('/api/whatsapp/messages',require(_0xb833('0xdf')));_0x37ea87['use'](_0xb833('0xe0'),require(_0xb833('0xe1')));_0x37ea87[_0xb833('0x5')](_0xb833('0xe2'),require(_0xb833('0xe3')));_0x37ea87[_0xb833('0x5')](_0xb833('0xe4'),require(_0xb833('0xe5')));_0x37ea87['use'](_0xb833('0xe6'),require(_0xb833('0xe7')));_0x37ea87['use'](_0xb833('0xe8'),require(_0xb833('0xe9')));_0x37ea87[_0xb833('0x5')]('/api/user-settings',require('./api/user-setting'));_0x37ea87[_0xb833('0x5')]('/api/auth/local',require(_0xb833('0xea')));_0x37ea87['use'](_0xb833('0xeb'),require(_0xb833('0xec')));_0x37ea87['use'](_0xb833('0xed'),require('./api/authActiveDirectory'));_0x37ea87['use']('/api/jira',require(_0xb833('0xee')));_0x37ea87[_0xb833('0x5')](_0xb833('0xef'),require(_0xb833('0xf0')));_0x37ea87[_0xb833('0x5')](_0xb833('0xf1'),require(_0xb833('0xf2')));_0x37ea87[_0xb833('0x5')]('/api/system',require(_0xb833('0xf3')));_0x37ea87[_0xb833('0x5')](_0xb833('0xf4'),require('./api/pm2'));_0x37ea87['use'](_0xb833('0xf5'),require(_0xb833('0xf6')));_0x37ea87[_0xb833('0x5')](_0xb833('0xf7'),clientSideLogs);_0x37ea87[_0xb833('0x5')](_0xb833('0xf8'),express[_0xb833('0xf9')](path['join'](config[_0xb833('0xfa')],_0xb833('0xf8'))));_0x37ea87[_0xb833('0x5')](_0xb833('0xfb'),express[_0xb833('0xf9')](path[_0xb833('0xfc')](config[_0xb833('0xfa')],_0xb833('0xfb'))));_0x37ea87[_0xb833('0x5')](_0xb833('0xfd'),express['static'](path['join'](config[_0xb833('0xfa')],_0xb833('0xfd'))));_0x37ea87[_0xb833('0x5')](_0xb833('0xfe'),express[_0xb833('0xf9')](path['join'](config['root'],_0xb833('0xff'),_0xb833('0x100'))));_0x37ea87[_0xb833('0x5')](_0xb833('0x101'),express[_0xb833('0xf9')](path[_0xb833('0xfc')](config[_0xb833('0xfa')],_0xb833('0x102'))));_0x37ea87[_0xb833('0x103')](_0xb833('0x104'))['get'](errors[0x194]);_0x37ea87[_0xb833('0x103')]('/*')['get'](function(_0x1d868f,_0x363d66){_0x363d66[_0xb833('0x105')](path[_0xb833('0x106')](_0x37ea87[_0xb833('0x107')]('appPath')+_0xb833('0x108')));});return _0x37ea87;});}; \ No newline at end of file +var _0x3756=['sendFile','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/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/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','./api/webbar','/api/logs','static','/apidoc','/www','root','/demo','/snippet','3.5.0','/plugins','join','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get'];(function(_0x1b4cda,_0x282199){var _0x1e130e=function(_0x381432){while(--_0x381432){_0x1b4cda['push'](_0x1b4cda['shift']());}};_0x1e130e(++_0x282199);}(_0x3756,0x116));var _0x6375=function(_0x25924c,_0x337b8f){_0x25924c=_0x25924c-0x0;var _0x49740c=_0x3756[_0x25924c];return _0x49740c;};'use strict';var path=require(_0x6375('0x0'));var express=require(_0x6375('0x1'));var errors=require(_0x6375('0x2'));var config=require(_0x6375('0x3'));var setupLoggers=require(_0x6375('0x4'))[_0x6375('0x5')];var clientSideLogs=require(_0x6375('0x6'));exports[_0x6375('0x7')]=function(_0x3f7d9a){return setupLoggers(_0x3f7d9a)[_0x6375('0x8')](function(){_0x3f7d9a[_0x6375('0x9')](_0x6375('0xa'),require(_0x6375('0xb')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xc'),require(_0x6375('0xd')));_0x3f7d9a['use']('/api/voice/contexts',require(_0x6375('0xe')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xf'),require(_0x6375('0x10')));_0x3f7d9a[_0x6375('0x9')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x11'),require(_0x6375('0x12')));_0x3f7d9a[_0x6375('0x9')]('/api/voice/recordings',require(_0x6375('0x13')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x14'),require('./api/screenRecording'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x15'),require(_0x6375('0x16')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x17'),require('./api/voiceMailMessage'));_0x3f7d9a[_0x6375('0x9')]('/api/voice/calls/reports',require(_0x6375('0x18')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x19'),require(_0x6375('0x1a')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x1b'),require(_0x6375('0x1c')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x1d'),require('./api/voiceQueueReport'));_0x3f7d9a['use'](_0x6375('0x1e'),require(_0x6375('0x1f')));_0x3f7d9a[_0x6375('0x9')]('/api/trunks',require('./api/trunk'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x20'),require(_0x6375('0x21')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x22'),require(_0x6375('0x23')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x24'),require(_0x6375('0x25')));_0x3f7d9a[_0x6375('0x9')]('/api/mail/queues',require(_0x6375('0x26')));_0x3f7d9a[_0x6375('0x9')]('/api/mail/substatuses',require(_0x6375('0x27')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x28'),require(_0x6375('0x29')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x2a'),require(_0x6375('0x2b')));_0x3f7d9a[_0x6375('0x9')]('/api/mail/applications',require('./api/mailApplication'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x2c'),require(_0x6375('0x2d')));_0x3f7d9a[_0x6375('0x9')]('/api/dashboards',require(_0x6375('0x2e')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x2f'),require('./api/dashboardItem'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x30'),require(_0x6375('0x31')));_0x3f7d9a['use'](_0x6375('0x32'),require('./api/faxApplication'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x33'),require(_0x6375('0x34')));_0x3f7d9a['use']('/api/fax/messages',require(_0x6375('0x35')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x36'),require(_0x6375('0x37')));_0x3f7d9a['use']('/api/fax/reports/queue',require(_0x6375('0x38')));_0x3f7d9a['use'](_0x6375('0x39'),require('./api/smsAccount'));_0x3f7d9a['use'](_0x6375('0x3a'),require(_0x6375('0x3b')));_0x3f7d9a[_0x6375('0x9')]('/api/sms/interactions',require(_0x6375('0x3c')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x3d'),require('./api/smsMessage'));_0x3f7d9a['use'](_0x6375('0x3e'),require(_0x6375('0x3f')));_0x3f7d9a[_0x6375('0x9')]('/api/openchannel/accounts',require(_0x6375('0x40')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x41'),require('./api/openchannelApplication'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x42'),require('./api/openchannelInteraction'));_0x3f7d9a[_0x6375('0x9')]('/api/openchannel/messages',require(_0x6375('0x43')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x44'),require(_0x6375('0x45')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x46'),require(_0x6375('0x47')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x48'),require(_0x6375('0x49')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x4a'),require('./api/chatApplication'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x4b'),require('./api/chatInteraction'));_0x3f7d9a['use'](_0x6375('0x4c'),require(_0x6375('0x4d')));_0x3f7d9a['use'](_0x6375('0x4e'),require(_0x6375('0x4f')));_0x3f7d9a[_0x6375('0x9')]('/api/chat/queues',require(_0x6375('0x50')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x51'),require(_0x6375('0x52')));_0x3f7d9a['use'](_0x6375('0x53'),require(_0x6375('0x54')));_0x3f7d9a['use'](_0x6375('0x55'),require(_0x6375('0x56')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x57'),require(_0x6375('0x58')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x59'),require('./api/cmHopper'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x5a'),require(_0x6375('0x5b')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x5c'),require(_0x6375('0x5d')));_0x3f7d9a['use']('/api/cm/hopper_history',require(_0x6375('0x5e')));_0x3f7d9a['use'](_0x6375('0x5f'),require(_0x6375('0x60')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x61'),require('./api/action'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x62'),require(_0x6375('0x63')));_0x3f7d9a[_0x6375('0x9')]('/api/canned_answers',require(_0x6375('0x64')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x65'),require(_0x6375('0x66')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x67'),require(_0x6375('0x68')));_0x3f7d9a['use'](_0x6375('0x69'),require(_0x6375('0x6a')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x6b'),require(_0x6375('0x6c')));_0x3f7d9a[_0x6375('0x9')]('/api/cdr',require(_0x6375('0x6d')));_0x3f7d9a['use'](_0x6375('0x6e'),require(_0x6375('0x6f')));_0x3f7d9a[_0x6375('0x9')]('/api/schedules',require(_0x6375('0x70')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x71'),require(_0x6375('0x72')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x73'),require(_0x6375('0x74')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x75'),require(_0x6375('0x76')));_0x3f7d9a[_0x6375('0x9')]('/api/cm_contact_has_items',require(_0x6375('0x77')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x78'),require('./api/cmHopperAdditionalPhone'));_0x3f7d9a['use']('/api/templates',require(_0x6375('0x79')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x7a'),require(_0x6375('0x7b')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x7c'),require('./api/variable'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x7d'),require('./api/integration'));_0x3f7d9a['use'](_0x6375('0x7e'),require(_0x6375('0x7f')));_0x3f7d9a[_0x6375('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x3f7d9a['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x80'),require(_0x6375('0x81')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x82'),require('./api/analyticMetric'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x83'),require('./api/analyticFieldReport'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x84'),require(_0x6375('0x85')));_0x3f7d9a['use']('/api/integrations/salesforce/accounts',require(_0x6375('0x86')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x87'),require(_0x6375('0x88')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x89'),require(_0x6375('0x8a')));_0x3f7d9a[_0x6375('0x9')]('/api/integrations/sugarcrm/accounts',require(_0x6375('0x8b')));_0x3f7d9a['use'](_0x6375('0x8c'),require(_0x6375('0x8d')));_0x3f7d9a['use']('/api/integrations/sugarcrm/fields',require(_0x6375('0x8e')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x8f'),require('./api/intDeskAccount'));_0x3f7d9a[_0x6375('0x9')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x3f7d9a['use'](_0x6375('0x90'),require(_0x6375('0x91')));_0x3f7d9a[_0x6375('0x9')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x3f7d9a['use'](_0x6375('0x92'),require(_0x6375('0x93')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x94'),require(_0x6375('0x95')));_0x3f7d9a['use'](_0x6375('0x96'),require(_0x6375('0x97')));_0x3f7d9a['use'](_0x6375('0x98'),require(_0x6375('0x99')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x9a'),require(_0x6375('0x9b')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x9c'),require(_0x6375('0x9d')));_0x3f7d9a[_0x6375('0x9')]('/api/integrations/freshdesk/configurations',require(_0x6375('0x9e')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x9f'),require(_0x6375('0xa0')));_0x3f7d9a['use']('/api/integrations/vtiger/accounts',require(_0x6375('0xa1')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xa2'),require(_0x6375('0xa3')));_0x3f7d9a['use'](_0x6375('0xa4'),require(_0x6375('0xa5')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xa6'),require(_0x6375('0xa7')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xa8'),require(_0x6375('0xa9')));_0x3f7d9a['use'](_0x6375('0xaa'),require('./api/intServicenowField'));_0x3f7d9a['use']('/api/integrations/dynamics365/accounts',require(_0x6375('0xab')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xac'),require(_0x6375('0xad')));_0x3f7d9a['use'](_0x6375('0xae'),require('./api/intDynamics365Field'));_0x3f7d9a[_0x6375('0x9')]('/api/integrations/freshsales/accounts',require(_0x6375('0xaf')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xb0'),require('./api/intFreshsalesConfiguration'));_0x3f7d9a['use'](_0x6375('0xb1'),require(_0x6375('0xb2')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xb3'),require(_0x6375('0xb4')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xb5'),require(_0x6375('0xb6')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xb7'),require(_0x6375('0xb8')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xb9'),require('./api/jscriptyAnswerReport'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xba'),require(_0x6375('0xbb')));_0x3f7d9a['use']('/api/jscripty/sessions/reports',require(_0x6375('0xbc')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xbd'),require(_0x6375('0xbe')));_0x3f7d9a[_0x6375('0x9')]('/api/square/reports',require(_0x6375('0xbf')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xc0'),require(_0x6375('0xc1')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xc2'),require(_0x6375('0xc3')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xc4'),require('./api/setting'));_0x3f7d9a[_0x6375('0x9')]('/api/square/odbc',require(_0x6375('0xc5')));_0x3f7d9a['use'](_0x6375('0xc6'),require(_0x6375('0xc7')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xc8'),require(_0x6375('0xc9')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xca'),require(_0x6375('0xcb')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xcc'),require(_0x6375('0xcd')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xce'),require(_0x6375('0xcf')));_0x3f7d9a['use'](_0x6375('0xd0'),require(_0x6375('0xd1')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xd2'),require(_0x6375('0xd3')));_0x3f7d9a['use']('/api/attachments',require('./api/attachment'));_0x3f7d9a['use'](_0x6375('0xd4'),require('./api/plugin'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xd5'),require('./api/mailTransferReport'));_0x3f7d9a['use'](_0x6375('0xd6'),require(_0x6375('0xd7')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xd8'),require(_0x6375('0xd9')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xda'),require(_0x6375('0xdb')));_0x3f7d9a['use'](_0x6375('0xdc'),require('./api/smsTransferReport'));_0x3f7d9a['use'](_0x6375('0xdd'),require(_0x6375('0xde')));_0x3f7d9a['use'](_0x6375('0xdf'),require(_0x6375('0xe0')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xe1'),require(_0x6375('0xe2')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xe3'),require('./api/userProfileSection'));_0x3f7d9a[_0x6375('0x9')]('/api/userProfile/resources',require(_0x6375('0xe4')));_0x3f7d9a['use'](_0x6375('0xe5'),require('./api/userNotification'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xe6'),require(_0x6375('0xe7')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xe8'),require('./api/whatsappApplication'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xe9'),require(_0x6375('0xea')));_0x3f7d9a['use'](_0x6375('0xeb'),require('./api/whatsappMessage'));_0x3f7d9a['use'](_0x6375('0xec'),require(_0x6375('0xed')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xee'),require(_0x6375('0xef')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xf0'),require(_0x6375('0xf1')));_0x3f7d9a['use'](_0x6375('0xf2'),require(_0x6375('0xf3')));_0x3f7d9a['use'](_0x6375('0xf4'),require(_0x6375('0xf5')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xf6'),require('./api/user-setting'));_0x3f7d9a['use'](_0x6375('0xf7'),require(_0x6375('0xf8')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0xf9'),require(_0x6375('0xfa')));_0x3f7d9a['use'](_0x6375('0xfb'),require(_0x6375('0xfc')));_0x3f7d9a[_0x6375('0x9')]('/api/jira',require('./api/jira'));_0x3f7d9a['use'](_0x6375('0xfd'),require(_0x6375('0xfe')));_0x3f7d9a['use'](_0x6375('0xff'),require(_0x6375('0x100')));_0x3f7d9a['use']('/api/system',require('./api/system'));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x101'),require(_0x6375('0x102')));_0x3f7d9a[_0x6375('0x9')]('/api/webbar',require(_0x6375('0x103')));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x104'),clientSideLogs);_0x3f7d9a[_0x6375('0x9')]('/apidoc',express[_0x6375('0x105')](path['join'](config['root'],_0x6375('0x106'))));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x107'),express['static'](path['join'](config['root'],_0x6375('0x107'))));_0x3f7d9a[_0x6375('0x9')]('/demo',express[_0x6375('0x105')](path['join'](config[_0x6375('0x108')],_0x6375('0x109'))));_0x3f7d9a[_0x6375('0x9')](_0x6375('0x10a'),express[_0x6375('0x105')](path['join'](config[_0x6375('0x108')],'snippet',_0x6375('0x10b'))));_0x3f7d9a['use'](_0x6375('0x10c'),express[_0x6375('0x105')](path[_0x6375('0x10d')](config['root'],_0x6375('0x10e'))));_0x3f7d9a[_0x6375('0x10f')](_0x6375('0x110'))['get'](errors[0x194]);_0x3f7d9a[_0x6375('0x10f')]('/*')[_0x6375('0x111')](function(_0x595040,_0x32d68c){_0x32d68c[_0x6375('0x112')](path['resolve'](_0x3f7d9a[_0x6375('0x111')](_0x6375('0x113'))+'/index.html'));});return _0x3f7d9a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0a870c4..e1aa943 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x302c=['merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.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/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','lodash','../config/environment','listen'];(function(_0x5714c1,_0x8f8c91){var _0x2d7f8a=function(_0xc15abf){while(--_0xc15abf){_0x5714c1['push'](_0x5714c1['shift']());}};_0x2d7f8a(++_0x8f8c91);}(_0x302c,0x1d9));var _0xc302=function(_0x19c077,_0x140d50){_0x19c077=_0x19c077-0x0;var _0x505def=_0x302c[_0x19c077];return _0x505def;};'use strict';var jayson=require('jayson/promise');var _=require(_0xc302('0x0'));var config=require(_0xc302('0x1'));exports[_0xc302('0x2')]=function(){return new Promise(function(_0x420094,_0x518c19){var _0x5971eb={};_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x4')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x5')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x6')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x7')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x8')));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x9')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0xa')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0xb')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0xc')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0xd')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0xe')));_0x5971eb=_['merge'](_0x5971eb,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0xf')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x10')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/mailQueue/mailQueue.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x11')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x12')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x13')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x14')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x15')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x16')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/faxInteraction/faxInteraction.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/faxMessage/faxMessage.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/faxQueue/faxQueue.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x17')));_0x5971eb=_['merge'](_0x5971eb,require('../api/smsAccount/smsAccount.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/smsInteraction/smsInteraction.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x18')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x19')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x1a')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x1b')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x1c')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x1d')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x1e')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/chatMessage/chatMessage.rpc'));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x1f')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x20')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x21')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x22')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x23')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x24')));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x25')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x26')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x27')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x28')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x29')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/trigger/trigger.rpc'));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x2a')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x2b')));_0x5971eb=_['merge'](_0x5971eb,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x2c')));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x2d')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x2e')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x2f')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x30')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x31')));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x32')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x33')));_0x5971eb=_['merge'](_0x5971eb,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x34')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x35')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/squareProject/squareProject.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x36')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/squareMessage/squareMessage.rpc'));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x37')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x38')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/plugin/plugin.rpc'));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x39')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x3a')));_0x5971eb=_['merge'](_0x5971eb,require(_0xc302('0x3b')));_0x5971eb=_[_0xc302('0x3')](_0x5971eb,require(_0xc302('0x3c')));var _0x1051c7=jayson['server'](_0x5971eb)[_0xc302('0x3d')]();var _0x3f4c6d=config[_0xc302('0x3e')][_0xc302('0x3f')]||config[_0xc302('0x3f')]+0x1;var _0x1c89e0=config[_0xc302('0x3e')]['ip']||'localhost';_0x1051c7['on'](_0xc302('0x40'),function(_0x4c0533){return _0x518c19(_0x4c0533);});_0x1051c7['listen'](_0x3f4c6d,_0x1c89e0,function(){console['log'](_0xc302('0x41'),_0x1c89e0,_0x3f4c6d);require(_0xc302('0x42'))['default']();return _0x420094(_0xc302('0x43')+_0x1c89e0+':'+_0x3f4c6d);});});}; \ No newline at end of file +var _0x2603=['default','RPC\x20listening\x20on\x20','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/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/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.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/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers'];(function(_0x109b26,_0x3139b4){var _0x23e4d0=function(_0x8287af){while(--_0x8287af){_0x109b26['push'](_0x109b26['shift']());}};_0x23e4d0(++_0x3139b4);}(_0x2603,0x1ac));var _0x3260=function(_0x12e650,_0x33f29f){_0x12e650=_0x12e650-0x0;var _0x5b56b1=_0x2603[_0x12e650];return _0x5b56b1;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0x3260('0x0'));exports[_0x3260('0x1')]=function(){return new Promise(function(_0x4fe023,_0x391cdf){var _0xb34e46={};_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x3')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x4')));_0xb34e46=_['merge'](_0xb34e46,require('../api/voiceQueue/voiceQueue.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x5')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x6')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x7')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x8')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/memberReport/memberReport.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/trunk/trunk.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x9')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0xa')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0xb')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0xc')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0xd')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0xe')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0xf')));_0xb34e46=_['merge'](_0xb34e46,require('../api/mailApplication/mailApplication.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x10')));_0xb34e46=_['merge'](_0xb34e46,require('../api/faxAccount/faxAccount.rpc'));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x11')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x12')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x13')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x14')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x15')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x16')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x17')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x18')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x19')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x1a')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x1b')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x1c')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x1d')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/chatInteraction/chatInteraction.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/chatMessage/chatMessage.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x1e')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x1f')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x20')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x21')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x22')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x23')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x24')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x25')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x26')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x27')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x28')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/template/template.rpc'));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x29')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x2a')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x2b')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x2c')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x2d')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x2e')));_0xb34e46=_['merge'](_0xb34e46,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x2f')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x30')));_0xb34e46=_['merge'](_0xb34e46,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x31')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x32')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x33')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/setting/setting.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x34')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x35')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/squareRecording/squareRecording.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x36')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x37')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x38')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x39')));_0xb34e46=_['merge'](_0xb34e46,require(_0x3260('0x3a')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require(_0x3260('0x3b')));_0xb34e46=_[_0x3260('0x2')](_0xb34e46,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x51cb14=jayson[_0x3260('0x3c')](_0xb34e46)[_0x3260('0x3d')]();var _0x1a6bfa=config[_0x3260('0x3e')][_0x3260('0x3f')]||config[_0x3260('0x3f')]+0x1;var _0x3389b2=config[_0x3260('0x3e')]['ip']||_0x3260('0x40');_0x51cb14['on'](_0x3260('0x41'),function(_0x35ed33){return _0x391cdf(_0x35ed33);});_0x51cb14[_0x3260('0x1')](_0x1a6bfa,_0x3389b2,function(){console[_0x3260('0x42')](_0x3260('0x43'),_0x3389b2,_0x1a6bfa);require(_0x3260('0x44'))[_0x3260('0x45')]();return _0x4fe023(_0x3260('0x46')+_0x3389b2+':'+_0x1a6bfa);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e9f9a21..abc2536 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 _0xf71f=['label','exports','util','call','setEncoding','utf8','setTimeout','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','write','destroy','inherits','prototype','sendRequest','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','setVariable','isBoolean','toString','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0xf71f,0x112));var _0xff71=function(_0x5f5c3a,_0xb34c49){_0x5f5c3a=_0x5f5c3a-0x0;var _0x1c26a8=_0xf71f[_0x5f5c3a];return _0x1c26a8;};'use strict';var util=require(_0xff71('0x0'));var _=require('lodash');var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x2e0cfe){var _0x3ce312=this,_0x4d6880=new AGIReply(),_0x50203a=![],_0x14f568={};EventEmitter[_0xff71('0x1')](_0x3ce312);_0x2e0cfe[_0xff71('0x2')](_0xff71('0x3'));_0x2e0cfe[_0xff71('0x4')](0x8*0x3c*0x3c*0x3e8);_0x4d6880['setEncoding'](_0xff71('0x3'));_0x4d6880['on']('headers',function(_0x3c3e36){for(var _0x451115 in _0x3c3e36){_0x3ce312[_0x451115]=_0x3c3e36[_0x451115];}_0x3ce312[_0xff71('0x5')](_0xff71('0x6'));});_0x4d6880['on'](_0xff71('0x7'),function(_0x437e96){if(_0x437e96['toLowerCase']()==_0xff71('0x8')){_0x3ce312['emit']('hangup');return;}if(_0x437e96[_0xff71('0x9')](0x0,0xb)==_0xff71('0xa')){_0x50203a=!![];}if(_0x50203a){_0x14f568['rx']+=_0x437e96+'\x0a';if(_0x437e96[_0xff71('0xb')](_0xff71('0xc'))!=-0x1){_0x50203a=![];}}else{_0x14f568['rx']=_0x437e96;}if(_0x50203a){return;}if(typeof _0x14f568['cb']==_0xff71('0xd')){var _0x3cb7e0=_0x14f568['rx'][_0xff71('0x9')](0x0,0x3),_0x2980da=null,_0x32cacb=null;_0x3cb7e0=parseInt(_0x3cb7e0);if(isNaN(_0x3cb7e0)){_0x14f568['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xff71('0xe')});return;}if(_0x3cb7e0!=0xc8){_0x14f568['cb'](null,{'code':_0x3cb7e0,'result':-0x1,'extra':'KO'});return;}_0x2980da=_0x14f568['rx']['substring'](0x4)[_0xff71('0xf')](_0xff71('0x10'),'');if(_0x2980da['indexOf']('\x20')!=-0x1){_0x2980da=_0x2980da[_0xff71('0x11')](0x0,_0x2980da[_0xff71('0x12')]('\x20'));}if(_[_0xff71('0x13')](_0x2980da,'-1')){_0x2980da=parseInt(_0x2980da);}_0x32cacb=_0x14f568['rx']['split']('\x20');if(_0x32cacb[_0xff71('0x14')]==0x3){_0x32cacb=_0x32cacb[0x2][_0xff71('0x9')](0x1,_0x32cacb[0x2][_0xff71('0x14')]-0x1);}else if(_0x32cacb[_0xff71('0x14')]>0x3){var _0x1c96d5=/\((.+)\)/;var _0x3eac73=_0x14f568['rx']['match'](_0x1c96d5);if(_0x3eac73){_0x32cacb=_0x3eac73[0x1];}else{_0x32cacb=null;}}else{_0x32cacb=null;}_0x14f568['cb'](null,{'code':_0x3cb7e0,'result':_0x2980da,'extra':_0x32cacb});}});_0x2e0cfe['on'](_0xff71('0x15'),function(_0x10bc87){_0x3ce312[_0xff71('0x5')](_0xff71('0x15'),new AGIError(_0xff71('0x16'),_0x10bc87[_0xff71('0x17')]));});_0x2e0cfe['on'](_0xff71('0x18'),function(){_0x3ce312[_0xff71('0x5')]('close',new AGIError(_0xff71('0x19')));});_0x2e0cfe['on']('timeout',function(){_0x3ce312[_0xff71('0x5')](_0xff71('0x1a'),new AGIError(_0xff71('0x1b')));_0x2e0cfe['destroy']();});_0x2e0cfe[_0xff71('0x1c')](_0x4d6880);this['command']=function(_0x3e8cbf,_0x24b867){var _0x3e8cbf=_0x3e8cbf||'',_0x24b867=typeof _0x24b867=='function'?_0x24b867:new Function();_0x14f568={'tx':_0x3e8cbf,'rx':'','cb':_0x24b867};_0x2e0cfe[_0xff71('0x1d')](_0x3e8cbf+'\x0a');},this[_0xff71('0x18')]=function(){_0x2e0cfe[_0xff71('0x1e')]();};}util[_0xff71('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0xff71('0x20')][_0xff71('0x21')]=function(_0x4c264d){return this['command']['sync'](this,_0x4c264d);};AGIChannel[_0xff71('0x20')][_0xff71('0x22')]=function(){return this['sendRequest']('ANSWER');};AGIChannel['prototype'][_0xff71('0x23')]=function(_0x1e0cb8,_0x17efa4,_0x31bc99){_0x1e0cb8=_0x1e0cb8===undefined?_0xff71('0x24'):_0x1e0cb8;_0x17efa4=_0x17efa4===undefined?'5':_0x17efa4;_0x31bc99=_0x31bc99===undefined?'1':_0x31bc99;return this[_0xff71('0x21')](util[_0xff71('0x25')](_0xff71('0x26'),_0x1e0cb8,_0x17efa4*0x3e8,_0x31bc99));};AGIChannel[_0xff71('0x20')][_0xff71('0x27')]=function(_0x433a41){_0x433a41=_0x433a41||_0xff71('0x28');return this[_0xff71('0x21')](util[_0xff71('0x25')]('VERBOSE\x20\x22%s\x22',_0x433a41));};AGIChannel[_0xff71('0x20')][_0xff71('0x29')]=function(_0x5c5063,_0x935dc2){if(_[_0xff71('0x2a')](_0x935dc2)){return this[_0xff71('0x21')](util[_0xff71('0x25')](_0xff71('0x2b'),_0x5c5063,_0x935dc2[_0xff71('0x2c')](',')));}return this[_0xff71('0x21')](util[_0xff71('0x25')](_0xff71('0x2b'),_0x5c5063,_0x935dc2));};AGIChannel[_0xff71('0x20')][_0xff71('0x2d')]=function(_0x49ab25){return this[_0xff71('0x21')](util['format']('SET\x20CONTEXT\x20%s',_0x49ab25));};AGIChannel[_0xff71('0x20')][_0xff71('0x2e')]=function(_0x399df1){return this[_0xff71('0x21')](util[_0xff71('0x25')]('SET\x20EXTENSION\x20%s',_0x399df1));};AGIChannel[_0xff71('0x20')][_0xff71('0x2f')]=function(_0x5f0b77){return this[_0xff71('0x21')](util['format']('SET\x20PRIORITY\x20%s',_0x5f0b77));};AGIChannel[_0xff71('0x20')][_0xff71('0x8')]=function(){return this[_0xff71('0x21')]('HANGUP');};AGIChannel[_0xff71('0x20')][_0xff71('0x30')]=function(_0x360e45,_0x478ba0){var _0x2f97c2=_[_0xff71('0x31')](_0x478ba0)||_['isNumber'](_0x478ba0)?_0x478ba0[_0xff71('0x32')]():_0x478ba0;return this[_0xff71('0x21')](util[_0xff71('0x25')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x360e45,_0x2f97c2?_0x2f97c2[_0xff71('0x32')]()[_0xff71('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xff71('0x20')]['sayNumber']=function(_0x1f2665,_0x3bb94d){return this[_0xff71('0x21')](util[_0xff71('0x25')](_0xff71('0x33'),_0x1f2665,_0x3bb94d));};AGIChannel[_0xff71('0x20')]['sayDigits']=function(_0x1c9c14,_0x18b93b){return this[_0xff71('0x21')](util[_0xff71('0x25')](_0xff71('0x34'),_0x1c9c14,_0x18b93b));};AGIChannel['prototype']['sayPhonetic']=function(_0x3c9b4a,_0x54e475){return this[_0xff71('0x21')](util['format'](_0xff71('0x35'),_0x3c9b4a,_0x54e475));};AGIChannel[_0xff71('0x20')][_0xff71('0x36')]=function(_0x39943f,_0xd190b0,_0x2ded8e){_0xd190b0=_0xd190b0||this[_0xff71('0x37')];_0x2ded8e=_0x2ded8e||0x1;this[_0xff71('0x2d')](_0x39943f);this['setExtension'](_0xd190b0);this[_0xff71('0x2f')](_0x2ded8e);return this[_0xff71('0x27')](util[_0xff71('0x25')]('GOTO\x20%s\x20%s\x20%s',_0x39943f,_0xd190b0,_0x2ded8e));};AGIChannel[_0xff71('0x20')][_0xff71('0x38')]=function(_0x4931a8){return this[_0xff71('0x21')](util[_0xff71('0x25')](_0xff71('0x39'),_0x4931a8));};AGIChannel[_0xff71('0x20')][_0xff71('0x3a')]=function(_0x3758dc,_0x3c1714,_0x4fa744,_0x26ac9f,_0x4814c5,_0x11af0d){_0x3c1714=_0x3c1714||'wav';_0x4fa744=_0x4fa744||'';_0x26ac9f=_0x26ac9f===undefined?-0x1:_0x26ac9f==='-1'?-0x1:_0x26ac9f*0x3e8;_0x4814c5=_0x4814c5===undefined?'':'s='+_0x4814c5;_0x11af0d=_0x11af0d?_0xff71('0x3b'):'';return this[_0xff71('0x21')](util[_0xff71('0x25')](_0xff71('0x3c'),_0x3758dc,_0x3c1714,_0x4fa744,_0x26ac9f,_0x11af0d,_0x4814c5));};AGIChannel[_0xff71('0x20')][_0xff71('0x3d')]=function(_0x5675f7,_0x282c2c){_0x282c2c=_0x282c2c||'';return this['sendRequest'](util['format'](_0xff71('0x3e'),_0x5675f7,_0x282c2c));};AGIChannel[_0xff71('0x20')][_0xff71('0x3f')]=function(_0x235ad2){return this[_0xff71('0x29')](_0xff71('0x40'),_0x235ad2);};AGIChannel['prototype'][_0xff71('0x41')]=function(_0x39f3a8){return this[_0xff71('0x29')]('WAIT',_0x39f3a8);};AGIChannel[_0xff71('0x20')]['error']=function(_0x33f533,_0x3c4607){this[_0xff71('0x27')](util[_0xff71('0x25')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x33f533['id'],_0x33f533[_0xff71('0x42')],_0x3c4607));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xff71('0x43')]=AGIChannel; \ No newline at end of file +var _0x8d63=['no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','sync','answer','ANSWER','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','sayNumber','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./error','call','utf8','setEncoding','headers','emit','line','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring'];(function(_0x149ef4,_0x56cf46){var _0x8f0825=function(_0x53d8e2){while(--_0x53d8e2){_0x149ef4['push'](_0x149ef4['shift']());}};_0x8f0825(++_0x56cf46);}(_0x8d63,0xd9));var _0x38d6=function(_0x357301,_0x59dcf6){_0x357301=_0x357301-0x0;var _0x3cc84d=_0x8d63[_0x357301];return _0x3cc84d;};'use strict';var util=require(_0x38d6('0x0'));var _=require(_0x38d6('0x1'));var EventEmitter=require(_0x38d6('0x2'))[_0x38d6('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x38d6('0x4'));function AGIChannel(_0x4d4642){var _0x4003cb=this,_0x1fda2c=new AGIReply(),_0x5554b1=![],_0x5a5172={};EventEmitter[_0x38d6('0x5')](_0x4003cb);_0x4d4642['setEncoding'](_0x38d6('0x6'));_0x4d4642['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1fda2c[_0x38d6('0x7')](_0x38d6('0x6'));_0x1fda2c['on'](_0x38d6('0x8'),function(_0x1aeba8){for(var _0x2b6997 in _0x1aeba8){_0x4003cb[_0x2b6997]=_0x1aeba8[_0x2b6997];}_0x4003cb[_0x38d6('0x9')]('ready');});_0x1fda2c['on'](_0x38d6('0xa'),function(_0x464305){if(_0x464305[_0x38d6('0xb')]()==_0x38d6('0xc')){_0x4003cb[_0x38d6('0x9')](_0x38d6('0xc'));return;}if(_0x464305['substring'](0x0,0xb)==_0x38d6('0xd')){_0x5554b1=!![];}if(_0x5554b1){_0x5a5172['rx']+=_0x464305+'\x0a';if(_0x464305['search'](_0x38d6('0xe'))!=-0x1){_0x5554b1=![];}}else{_0x5a5172['rx']=_0x464305;}if(_0x5554b1){return;}if(typeof _0x5a5172['cb']==_0x38d6('0xf')){var _0x1561ce=_0x5a5172['rx'][_0x38d6('0x10')](0x0,0x3),_0x5369a6=null,_0x14bc04=null;_0x1561ce=parseInt(_0x1561ce);if(isNaN(_0x1561ce)){_0x5a5172['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x38d6('0x11')});return;}if(_0x1561ce!=0xc8){_0x5a5172['cb'](null,{'code':_0x1561ce,'result':-0x1,'extra':'KO'});return;}_0x5369a6=_0x5a5172['rx'][_0x38d6('0x10')](0x4)[_0x38d6('0x12')](_0x38d6('0x13'),'');if(_0x5369a6[_0x38d6('0x14')]('\x20')!=-0x1){_0x5369a6=_0x5369a6[_0x38d6('0x15')](0x0,_0x5369a6[_0x38d6('0x14')]('\x20'));}if(_[_0x38d6('0x16')](_0x5369a6,'-1')){_0x5369a6=parseInt(_0x5369a6);}_0x14bc04=_0x5a5172['rx'][_0x38d6('0x17')]('\x20');if(_0x14bc04[_0x38d6('0x18')]==0x3){_0x14bc04=_0x14bc04[0x2][_0x38d6('0x10')](0x1,_0x14bc04[0x2][_0x38d6('0x18')]-0x1);}else if(_0x14bc04['length']>0x3){var _0x16d65a=/\((.+)\)/;var _0x168934=_0x5a5172['rx']['match'](_0x16d65a);if(_0x168934){_0x14bc04=_0x168934[0x1];}else{_0x14bc04=null;}}else{_0x14bc04=null;}_0x5a5172['cb'](null,{'code':_0x1561ce,'result':_0x5369a6,'extra':_0x14bc04});}});_0x4d4642['on']('error',function(_0x47fa6d){_0x4003cb[_0x38d6('0x9')](_0x38d6('0x19'),new AGIError(_0x38d6('0x1a'),_0x47fa6d[_0x38d6('0x1b')]));});_0x4d4642['on'](_0x38d6('0x1c'),function(){_0x4003cb['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4d4642['on'](_0x38d6('0x1d'),function(){_0x4003cb[_0x38d6('0x9')](_0x38d6('0x1d'),new AGIError(_0x38d6('0x1e')));_0x4d4642[_0x38d6('0x1f')]();});_0x4d4642[_0x38d6('0x20')](_0x1fda2c);this[_0x38d6('0x21')]=function(_0x1edd18,_0x38cefb){var _0x1edd18=_0x1edd18||'',_0x38cefb=typeof _0x38cefb=='function'?_0x38cefb:new Function();_0x5a5172={'tx':_0x1edd18,'rx':'','cb':_0x38cefb};_0x4d4642[_0x38d6('0x22')](_0x1edd18+'\x0a');},this[_0x38d6('0x1c')]=function(){_0x4d4642[_0x38d6('0x1f')]();};}util[_0x38d6('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x38d6('0x24')]=function(_0x29cb7d){return this['command'][_0x38d6('0x25')](this,_0x29cb7d);};AGIChannel['prototype'][_0x38d6('0x26')]=function(){return this[_0x38d6('0x24')](_0x38d6('0x27'));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x29')]=function(_0x29e626,_0x42dd26,_0xa93c3b){_0x29e626=_0x29e626===undefined?_0x38d6('0x2a'):_0x29e626;_0x42dd26=_0x42dd26===undefined?'5':_0x42dd26;_0xa93c3b=_0xa93c3b===undefined?'1':_0xa93c3b;return this[_0x38d6('0x24')](util[_0x38d6('0x2b')](_0x38d6('0x2c'),_0x29e626,_0x42dd26*0x3e8,_0xa93c3b));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x2d')]=function(_0x30e530){_0x30e530=_0x30e530||'NO\x20MESSAGE';return this[_0x38d6('0x24')](util['format'](_0x38d6('0x2e'),_0x30e530));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x2f')]=function(_0x4ffcc4,_0x122681){if(_[_0x38d6('0x30')](_0x122681)){return this[_0x38d6('0x24')](util[_0x38d6('0x2b')](_0x38d6('0x31'),_0x4ffcc4,_0x122681[_0x38d6('0x32')](',')));}return this[_0x38d6('0x24')](util[_0x38d6('0x2b')](_0x38d6('0x31'),_0x4ffcc4,_0x122681));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x33')]=function(_0x2f8f74){return this[_0x38d6('0x24')](util[_0x38d6('0x2b')](_0x38d6('0x34'),_0x2f8f74));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x35')]=function(_0x3e597f){return this[_0x38d6('0x24')](util[_0x38d6('0x2b')]('SET\x20EXTENSION\x20%s',_0x3e597f));};AGIChannel[_0x38d6('0x28')]['setPriority']=function(_0xf43032){return this[_0x38d6('0x24')](util[_0x38d6('0x2b')](_0x38d6('0x36'),_0xf43032));};AGIChannel[_0x38d6('0x28')][_0x38d6('0xc')]=function(){return this[_0x38d6('0x24')]('HANGUP');};AGIChannel[_0x38d6('0x28')][_0x38d6('0x37')]=function(_0x41f794,_0x51164e){var _0x45c23f=_[_0x38d6('0x38')](_0x51164e)||_[_0x38d6('0x39')](_0x51164e)?_0x51164e[_0x38d6('0x3a')]():_0x51164e;return this[_0x38d6('0x24')](util[_0x38d6('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x41f794,_0x45c23f?_0x45c23f[_0x38d6('0x3a')]()[_0x38d6('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x3b')]=function(_0x3f2e46,_0x4cd9d2){return this[_0x38d6('0x24')](util[_0x38d6('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0x3f2e46,_0x4cd9d2));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x3c')]=function(_0x1cbba5,_0x3778f9){return this[_0x38d6('0x24')](util[_0x38d6('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x1cbba5,_0x3778f9));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x3d')]=function(_0x2ec02d,_0x5a3ff7){return this[_0x38d6('0x24')](util['format'](_0x38d6('0x3e'),_0x2ec02d,_0x5a3ff7));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x3f')]=function(_0x4a6201,_0x269b42,_0x49ece2){_0x269b42=_0x269b42||this[_0x38d6('0x40')];_0x49ece2=_0x49ece2||0x1;this['setContext'](_0x4a6201);this['setExtension'](_0x269b42);this['setPriority'](_0x49ece2);return this['noop'](util['format'](_0x38d6('0x41'),_0x4a6201,_0x269b42,_0x49ece2));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x42')]=function(_0x1cf4f6){return this[_0x38d6('0x24')](util[_0x38d6('0x2b')](_0x38d6('0x43'),_0x1cf4f6));};AGIChannel[_0x38d6('0x28')]['recordFile']=function(_0x443477,_0x464a41,_0x291c10,_0x48321d,_0x2ac3a4,_0x246d09){_0x464a41=_0x464a41||_0x38d6('0x44');_0x291c10=_0x291c10||'';_0x48321d=_0x48321d===undefined?-0x1:_0x48321d==='-1'?-0x1:_0x48321d*0x3e8;_0x2ac3a4=_0x2ac3a4===undefined?'':'s='+_0x2ac3a4;_0x246d09=_0x246d09?_0x38d6('0x45'):'';return this['sendRequest'](util[_0x38d6('0x2b')](_0x38d6('0x46'),_0x443477,_0x464a41,_0x291c10,_0x48321d,_0x246d09,_0x2ac3a4));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x47')]=function(_0x56370c,_0x249747){_0x249747=_0x249747||'';return this[_0x38d6('0x24')](util[_0x38d6('0x2b')](_0x38d6('0x48'),_0x56370c,_0x249747));};AGIChannel[_0x38d6('0x28')][_0x38d6('0x49')]=function(_0x17503a){return this[_0x38d6('0x2f')](_0x38d6('0x4a'),_0x17503a);};AGIChannel['prototype'][_0x38d6('0x4b')]=function(_0xaf8fb8){return this[_0x38d6('0x2f')]('WAIT',_0xaf8fb8);};AGIChannel[_0x38d6('0x28')]['error']=function(_0x5bb54f,_0x53883a){this[_0x38d6('0x2d')](util['format'](_0x38d6('0x4c'),_0x5bb54f['id'],_0x5bb54f['label'],_0x53883a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x38d6('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index eb1ade7..4b7277e 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 _0x1223=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x11cdf7,_0x11fd12){var _0x518d7d=function(_0x527e3d){while(--_0x527e3d){_0x11cdf7['push'](_0x11cdf7['shift']());}};_0x518d7d(++_0x11fd12);}(_0x1223,0x12f));var _0x3122=function(_0xcc1875,_0xa0f98d){_0xcc1875=_0xcc1875-0x0;var _0x113da2=_0x1223[_0xcc1875];return _0x113da2;};'use strict';var util=require(_0x3122('0x0'));var error={'E_AGI_UNDEFINED':_0x3122('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x3122('0x2'),'E_AGI_SERVER_CLOSE':_0x3122('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x3122('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x3122('0x5'),'E_AGI_SOCKET_ERROR':_0x3122('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x3122('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x3122('0x8')};function AGIError(_0x295c4f){var _0x295c4f=_0x295c4f||null,_0x5b3738=_0x5b3738||[],_0x56787a=0x1,_0x19e06e='';if(!error[_0x295c4f]){_0x295c4f=_0x3122('0x9');}_0x5b3738['push'](error[_0x295c4f]);while(arguments[_0x56787a]){_0x5b3738['push'](arguments[_0x56787a]);_0x56787a++;}_0x19e06e=util[_0x3122('0xa')][_0x3122('0xb')](util,_0x5b3738);this[_0x3122('0xc')]=_0x19e06e;this['name']=_0x295c4f;}module[_0x3122('0xd')]=AGIError; \ No newline at end of file +var _0xcd41=['message','name','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.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply'];(function(_0xb1ee0e,_0x2126df){var _0x376116=function(_0x44b7ad){while(--_0x44b7ad){_0xb1ee0e['push'](_0xb1ee0e['shift']());}};_0x376116(++_0x2126df);}(_0xcd41,0xa5));var _0x1cd4=function(_0x3320d3,_0x343207){_0x3320d3=_0x3320d3-0x0;var _0x412a73=_0xcd41[_0x3320d3];return _0x412a73;};'use strict';var util=require(_0x1cd4('0x0'));var error={'E_AGI_UNDEFINED':_0x1cd4('0x1'),'E_AGI_ARGUMENT_PORT':_0x1cd4('0x2'),'E_AGI_SERVER_ERROR':_0x1cd4('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x1cd4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x1cd4('0x5'),'E_AGI_SOCKET_ERROR':_0x1cd4('0x6'),'E_AGI_SOCKET_CLOSE':_0x1cd4('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x1cd4('0x8'),'E_AGI_COMMAND_EMPTY':_0x1cd4('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x1cd4('0xa')};function AGIError(_0x4d1eb1){var _0x4d1eb1=_0x4d1eb1||null,_0x30de16=_0x30de16||[],_0x22285b=0x1,_0x4789ca='';if(!error[_0x4d1eb1]){_0x4d1eb1=_0x1cd4('0xb');}_0x30de16[_0x1cd4('0xc')](error[_0x4d1eb1]);while(arguments[_0x22285b]){_0x30de16[_0x1cd4('0xc')](arguments[_0x22285b]);_0x22285b++;}_0x4789ca=util[_0x1cd4('0xd')][_0x1cd4('0xe')](util,_0x30de16);this[_0x1cd4('0xf')]=_0x4789ca;this[_0x1cd4('0x10')]=_0x4d1eb1;}module[_0x1cd4('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 700256f..309b99d 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcda3=['./error','defaults','redis','agi','emit','error','E_AGI_SERVER_ERROR','message','projectUpdate','events','EventEmitter','ioredis'];(function(_0x508677,_0x4f53cb){var _0x1ef259=function(_0x1968c7){while(--_0x1968c7){_0x508677['push'](_0x508677['shift']());}};_0x1ef259(++_0x4f53cb);}(_0xcda3,0x14d));var _0x3cda=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xcda3[_0x30d87a];return _0x48f64b;};'use strict';var _=require('lodash');var EventEmitter=require(_0x3cda('0x0'))[_0x3cda('0x1')];var Redis=require(_0x3cda('0x2'));var AGIError=require(_0x3cda('0x3'));var config=require('../../config/environment');config['redis']=_[_0x3cda('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x3cda('0x5')]);sub['subscribe'](_0x3cda('0x6'),function(_0x2c15a0){if(_0x2c15a0)return eventEmitter[_0x3cda('0x7')](_0x3cda('0x8'),new AGIError(_0x3cda('0x9'),_0x2c15a0));});sub['on'](_0x3cda('0xa'),function(_0x239b96,_0x29c8fe){if(_0x239b96!==_0x3cda('0x6'))return;try{var _0x50baab=JSON['parse'](_0x29c8fe);eventEmitter[_0x3cda('0x7')](_0x3cda('0xb'),_0x50baab);}catch(_0x234bfc){eventEmitter[_0x3cda('0x7')](_0x3cda('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x234bfc));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x5d36=['localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','projectUpdate','exports','lodash','EventEmitter','ioredis','../../config/environment','redis','defaults'];(function(_0x169000,_0x2f694e){var _0x53cac6=function(_0x17ae6e){while(--_0x17ae6e){_0x169000['push'](_0x169000['shift']());}};_0x53cac6(++_0x2f694e);}(_0x5d36,0x180));var _0x65d3=function(_0x378487,_0x1fdc2c){_0x378487=_0x378487-0x0;var _0x3bb63b=_0x5d36[_0x378487];return _0x3bb63b;};'use strict';var _=require(_0x65d3('0x0'));var EventEmitter=require('events')[_0x65d3('0x1')];var Redis=require(_0x65d3('0x2'));var AGIError=require('./error');var config=require(_0x65d3('0x3'));config[_0x65d3('0x4')]=_[_0x65d3('0x5')](config['redis'],{'host':_0x65d3('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x65d3('0x4')]);sub[_0x65d3('0x7')]('agi',function(_0xa1c7ec){if(_0xa1c7ec)return eventEmitter[_0x65d3('0x8')](_0x65d3('0x9'),new AGIError(_0x65d3('0xa'),_0xa1c7ec));});sub['on'](_0x65d3('0xb'),function(_0x190d81,_0x53c562){if(_0x190d81!==_0x65d3('0xc'))return;try{var _0x21f7e7=JSON['parse'](_0x53c562);eventEmitter[_0x65d3('0x8')](_0x65d3('0xd'),_0x21f7e7);}catch(_0x1685db){eventEmitter[_0x65d3('0x8')](_0x65d3('0x9'),new AGIError(_0x65d3('0xa'),_0x1685db));}});module[_0x65d3('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index bad006e..705ca4b 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 _0x5dd6=['lodash','../../../config/logger','menu','getdigits','getsecretdigits','edges','prototype','vertices','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','vswitch','target','default','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5dd6,0x1a4));var _0x65dd=function(_0x49c52e,_0x2fd41d){_0x49c52e=_0x49c52e-0x0;var _0x931127=_0x5dd6[_0x49c52e];return _0x931127;};'use strict';var _=require(_0x65dd('0x0'));var logger=require(_0x65dd('0x1'))('agi');var verticesWithRetry=[_0x65dd('0x2'),_0x65dd('0x3'),_0x65dd('0x4')];var Graph=function(){this['vertices']={};this[_0x65dd('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x65dd('0x6')]['addVertex']=function(_0x43e08e){this[_0x65dd('0x7')][_0x43e08e['id']]=_0x43e08e;this[_0x65dd('0x5')][_0x43e08e['id']]=[];};Graph['prototype'][_0x65dd('0x8')]=function(_0x2c7121,_0x5a5571,_0x35913a){this[_0x65dd('0x5')][_0x2c7121][_0x65dd('0x9')]({'target':_0x5a5571,'condition':_0x35913a});this[_0x65dd('0xa')]+=0x1;};Graph[_0x65dd('0x6')]['size']=function(){return _[_0x65dd('0xb')](this['vertices']);};Graph[_0x65dd('0x6')][_0x65dd('0xc')]=function(){return this[_0x65dd('0xa')];};Graph['prototype'][_0x65dd('0xd')]=function(_0x587d9a){return this[_0x65dd('0x7')][_0x587d9a];};Graph[_0x65dd('0x6')][_0x65dd('0xe')]=function(_0x5a3b4b,_0xa546ab){if(!this[_0x65dd('0x7')][_0x5a3b4b]){return logger[_0x65dd('0xf')](_0x65dd('0x10'));}var _0x2c9a05=_0xa546ab(this['vertices'][_0x5a3b4b]);if(!_0x2c9a05){return logger[_0x65dd('0xf')]('stop\x20traverse');}if(this[_0x65dd('0x5')][_0x5a3b4b][_0x65dd('0x11')]===0x0){return logger[_0x65dd('0xf')]('no\x20edge/s\x20available');}for(var _0x22d36e=0x0,_0xfeb29b=[],_0x2b0381=![];_0x22d36e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','then','catch','hasOwnProperty','indexOf','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','handleNotFound','production','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s'];(function(_0x1a9390,_0x3339e6){var _0x2b4514=function(_0x1c07d5){while(--_0x1c07d5){_0x1a9390['push'](_0x1a9390['shift']());}};_0x2b4514(++_0x3339e6);}(_0xa6e3,0x72));var _0x3a6e=function(_0x34bcbf,_0x529caf){_0x34bcbf=_0x34bcbf-0x0;var _0x4951ee=_0xa6e3[_0x34bcbf];return _0x4951ee;};'use strict';var _=require('lodash');var syncho=require(_0x3a6e('0x0'));var util=require('util');var config=require(_0x3a6e('0x1'));var logger=require(_0x3a6e('0x2'))('agi');var utilLicense=require(_0x3a6e('0x3'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0x3a6e('0x4'))[_0x3a6e('0x5')];var projects=[];config[_0x3a6e('0x6')]=_[_0x3a6e('0x7')](config['agi'],{'ip':_0x3a6e('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x434f40){process[_0x3a6e('0x9')](function(){syncho(function(){try{setChannelVariables(_0x434f40);agiHandler(_0x434f40);}catch(_0x325d74){logger['error'](_0x325d74[_0x3a6e('0xa')]);}});});}function projectUpdateHandler(_0x54d980){try{var _0x3e7710=_['findIndex'](projects,['id',_0x54d980['id']]);if(_0x3e7710>-0x1){if(_0x54d980[_0x3a6e('0xb')]===!![]){projects[_0x3a6e('0xc')](_0x3e7710,0x1);}else{projects[_0x3e7710]=_0x54d980;}}else{projects[_0x3a6e('0xd')](_0x54d980);}}catch(_0x4b7903){logger['error'](_0x4b7903['stack']);}}function listeningHandler(){console[_0x3a6e('0xe')](_0x3a6e('0xf'),config[_0x3a6e('0x6')][_0x3a6e('0x10')]);logger[_0x3a6e('0x11')](util['format'](_0x3a6e('0x12'),config[_0x3a6e('0x6')]['ip'],config[_0x3a6e('0x6')]['port']));}function errorHandler(_0x2d74a3){if(_0x2d74a3&&_0x2d74a3['name']&&_0x2d74a3[_0x3a6e('0x13')]){logger[_0x3a6e('0x14')](util[_0x3a6e('0x15')]('[%s]\x20%s',_0x2d74a3[_0x3a6e('0x16')],_0x2d74a3[_0x3a6e('0x13')]));}else{logger[_0x3a6e('0x14')](util['format']('[ERROR]\x20%s',_0x2d74a3[_0x3a6e('0xa')]));}}function closeHandler(){logger[_0x3a6e('0x11')](util['format'](_0x3a6e('0x17'),this[_0x3a6e('0x18')],this[_0x3a6e('0x19')],this[_0x3a6e('0x1a')],this[_0x3a6e('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x9378ec){logger[_0x3a6e('0x14')](_0x9378ec[_0x3a6e('0xa')]);}}function timeoutHandler(){logger[_0x3a6e('0x11')](util[_0x3a6e('0x15')](_0x3a6e('0x1c'),this[_0x3a6e('0x18')],this['calleridname'],this[_0x3a6e('0x1a')],this[_0x3a6e('0x1b')],this[_0x3a6e('0x1d')]));}function hangupHandler(){logger[_0x3a6e('0x11')](util[_0x3a6e('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x3a6e('0x19')],this[_0x3a6e('0x1a')],this['dnid'],this[_0x3a6e('0x1d')]));this[_0x3a6e('0x1e')]=!![];}function createSquareReport(_0x1a64c5,_0x505468){rpc['createSquareReport'](_0x1a64c5)[_0x3a6e('0x1f')](function(_0x34ac51){if(_0x505468){_0x505468(null,_0x34ac51);}})[_0x3a6e('0x20')](function(_0x574851){if(_0x505468){_0x505468(null,_0x574851);}});}function setChannelVariables(_0x55d7e0){for(var _0x27ab77 in _0x55d7e0){if(_0x55d7e0[_0x3a6e('0x21')](_0x27ab77)){if(_0x27ab77[_0x3a6e('0x22')]('agi_')===0x0){_0x55d7e0[_0x27ab77[_0x3a6e('0x23')](0x4)]=_0x55d7e0[_0x27ab77];delete _0x55d7e0[_0x27ab77];}}}}function agiHandler(_0x10b41b){logger[_0x3a6e('0x24')]('variables',JSON[_0x3a6e('0x25')](_0x10b41b,null,0x2));logger[_0x3a6e('0x11')](util['format'](_0x3a6e('0x26'),_0x10b41b[_0x3a6e('0x18')],_0x10b41b['calleridname'],_0x10b41b[_0x3a6e('0x1a')],_0x10b41b['dnid'],_0x10b41b[_0x3a6e('0x1d')]));_0x10b41b['on'](_0x3a6e('0x14'),errorHandler);_0x10b41b['on']('close',closeHandler);_0x10b41b['on'](_0x3a6e('0x27'),timeoutHandler);_0x10b41b[_0x3a6e('0x1e')]=![];_0x10b41b['on'](_0x3a6e('0x28'),hangupHandler);var _0xc2e297=_['find'](projects,['name',_0x10b41b[_0x3a6e('0x18')]]);if(!_0xc2e297)return Project[_0x3a6e('0x29')](_0x10b41b);if(!_0xc2e297[_0x3a6e('0x2a')])return Project[_0x3a6e('0x2b')](_0x10b41b);return Project[_0x3a6e('0x2c')](_0xc2e297,_0x10b41b);}function main(){var _0x618ad0;return utilLicense[_0x3a6e('0x2d')]()[_0x3a6e('0x1f')](function(_0xef85df){if(!_0xef85df)return;if(_0xef85df['voice']){if(_0xef85df[_0x3a6e('0x2e')]&&_0xef85df[_0x3a6e('0x2e')]>0x0){logger['info'](util[_0x3a6e('0x15')](_0x3a6e('0x2f'),_0xef85df[_0x3a6e('0x2e')]));_0x618ad0=_0xef85df[_0x3a6e('0x2e')];}else{logger[_0x3a6e('0x11')](_0x3a6e('0x30'));}}else{logger['info'](_0x3a6e('0x31'));_0x618ad0=-0x1;}})[_0x3a6e('0x1f')](function(){return Project[_0x3a6e('0x32')]();})[_0x3a6e('0x1f')](function(_0x132fd9){projects=_0x132fd9;return;})[_0x3a6e('0x20')](function(_0x36144d){logger[_0x3a6e('0x14')]('[LICENSE]',_0x36144d['stack']);})['finally'](function(){var _0x30f154=require(_0x3a6e('0x33'))(config[_0x3a6e('0x6')][_0x3a6e('0x10')],config[_0x3a6e('0x6')]['ip'],_0x618ad0);_0x30f154['on']('error',errorHandler);_0x30f154['on'](_0x3a6e('0x34'),listeningHandler);_0x30f154['on']('connection',connectionHandler);_0x30f154['on'](_0x3a6e('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0x2af4=['connection','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','defaults','127.0.0.1','nextTick','error','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','substring','debug','variables','stringify','callerid','close','timeout','handleNotFound','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x2af4,0x1c9));var _0x42af=function(_0x3cb2c2,_0x1dca9c){_0x3cb2c2=_0x3cb2c2-0x0;var _0x1640cc=_0x2af4[_0x3cb2c2];return _0x1640cc;};'use strict';var _=require('lodash');var syncho=require(_0x42af('0x0'));var util=require(_0x42af('0x1'));var config=require(_0x42af('0x2'));var logger=require(_0x42af('0x3'))(_0x42af('0x4'));var utilLicense=require(_0x42af('0x5'));var rpc=require(_0x42af('0x6'));var Project=require('./project');var AGIEmitter=require(_0x42af('0x7'))['EventEmitter'];var projects=[];config['agi']=_[_0x42af('0x8')](config[_0x42af('0x4')],{'ip':_0x42af('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x14b68e){process[_0x42af('0xa')](function(){syncho(function(){try{setChannelVariables(_0x14b68e);agiHandler(_0x14b68e);}catch(_0x368525){logger[_0x42af('0xb')](_0x368525['stack']);}});});}function projectUpdateHandler(_0x3a8709){try{var _0x5b162f=_[_0x42af('0xc')](projects,['id',_0x3a8709['id']]);if(_0x5b162f>-0x1){if(_0x3a8709[_0x42af('0xd')]===!![]){projects['splice'](_0x5b162f,0x1);}else{projects[_0x5b162f]=_0x3a8709;}}else{projects[_0x42af('0xe')](_0x3a8709);}}catch(_0x5da4c0){logger[_0x42af('0xb')](_0x5da4c0['stack']);}}function listeningHandler(){console[_0x42af('0xf')](_0x42af('0x10'),config[_0x42af('0x4')][_0x42af('0x11')]);logger[_0x42af('0x12')](util[_0x42af('0x13')](_0x42af('0x14'),config[_0x42af('0x4')]['ip'],config['agi'][_0x42af('0x11')]));}function errorHandler(_0x500b0d){if(_0x500b0d&&_0x500b0d[_0x42af('0x15')]&&_0x500b0d[_0x42af('0x16')]){logger['error'](util[_0x42af('0x13')](_0x42af('0x17'),_0x500b0d[_0x42af('0x15')],_0x500b0d['message']));}else{logger['error'](util[_0x42af('0x13')]('[ERROR]\x20%s',_0x500b0d[_0x42af('0x18')]));}}function closeHandler(){logger[_0x42af('0x12')](util[_0x42af('0x13')](_0x42af('0x19'),this['arg_1'],this[_0x42af('0x1a')],this['callerid'],this['dnid'],this[_0x42af('0x1b')]));try{createSquareReport(this);}catch(_0x4738ab){logger[_0x42af('0xb')](_0x4738ab[_0x42af('0x18')]);}}function timeoutHandler(){logger[_0x42af('0x12')](util[_0x42af('0x13')](_0x42af('0x1c'),this[_0x42af('0x1d')],this[_0x42af('0x1a')],this['callerid'],this[_0x42af('0x1e')],this[_0x42af('0x1b')]));}function hangupHandler(){logger['info'](util[_0x42af('0x13')](_0x42af('0x1f'),this[_0x42af('0x1d')],this['calleridname'],this['callerid'],this[_0x42af('0x1e')],this[_0x42af('0x1b')]));this[_0x42af('0x20')]=!![];}function createSquareReport(_0x5972b8,_0x39aea2){rpc[_0x42af('0x21')](_0x5972b8)[_0x42af('0x22')](function(_0x464419){if(_0x39aea2){_0x39aea2(null,_0x464419);}})[_0x42af('0x23')](function(_0x819903){if(_0x39aea2){_0x39aea2(null,_0x819903);}});}function setChannelVariables(_0x30b8ed){for(var _0x513e1d in _0x30b8ed){if(_0x30b8ed['hasOwnProperty'](_0x513e1d)){if(_0x513e1d['indexOf']('agi_')===0x0){_0x30b8ed[_0x513e1d[_0x42af('0x24')](0x4)]=_0x30b8ed[_0x513e1d];delete _0x30b8ed[_0x513e1d];}}}}function agiHandler(_0x3d11dc){logger[_0x42af('0x25')](_0x42af('0x26'),JSON[_0x42af('0x27')](_0x3d11dc,null,0x2));logger['info'](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3d11dc[_0x42af('0x1d')],_0x3d11dc[_0x42af('0x1a')],_0x3d11dc[_0x42af('0x28')],_0x3d11dc['dnid'],_0x3d11dc[_0x42af('0x1b')]));_0x3d11dc['on'](_0x42af('0xb'),errorHandler);_0x3d11dc['on'](_0x42af('0x29'),closeHandler);_0x3d11dc['on'](_0x42af('0x2a'),timeoutHandler);_0x3d11dc[_0x42af('0x20')]=![];_0x3d11dc['on']('hangup',hangupHandler);var _0x58b189=_['find'](projects,['name',_0x3d11dc[_0x42af('0x1d')]]);if(!_0x58b189)return Project[_0x42af('0x2b')](_0x3d11dc);if(!_0x58b189[_0x42af('0x2c')])return Project[_0x42af('0x2d')](_0x3d11dc);return Project[_0x42af('0x2e')](_0x58b189,_0x3d11dc);}function main(){var _0x430132;return utilLicense['getLicense']()[_0x42af('0x22')](function(_0x29bd1e){if(!_0x29bd1e)return;if(_0x29bd1e[_0x42af('0x2f')]){if(_0x29bd1e[_0x42af('0x30')]&&_0x29bd1e[_0x42af('0x30')]>0x0){logger['info'](util['format'](_0x42af('0x31'),_0x29bd1e['callysquare']));_0x430132=_0x29bd1e[_0x42af('0x30')];}else{logger[_0x42af('0x12')](_0x42af('0x32'));}}else{logger[_0x42af('0x12')](_0x42af('0x33'));_0x430132=-0x1;}})[_0x42af('0x22')](function(){return Project[_0x42af('0x34')]();})[_0x42af('0x22')](function(_0x5c1813){projects=_0x5c1813;return;})[_0x42af('0x23')](function(_0x5ee641){logger[_0x42af('0xb')](_0x42af('0x35'),_0x5ee641['stack']);})[_0x42af('0x36')](function(){var _0x474518=require(_0x42af('0x37'))(config[_0x42af('0x4')]['port'],config[_0x42af('0x4')]['ip'],_0x430132);_0x474518['on'](_0x42af('0xb'),errorHandler);_0x474518['on']('listening',listeningHandler);_0x474518['on'](_0x42af('0x38'),connectionHandler);_0x474518['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index daccfe9..da0f9e2 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 _0x3f32=['bluebird','jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x504338,_0x5cb4bf){var _0x168d66=function(_0x28d94a){while(--_0x28d94a){_0x504338['push'](_0x504338['shift']());}};_0x168d66(++_0x5cb4bf);}(_0x3f32,0xc0));var _0x23f3=function(_0x243cca,_0x514c2d){_0x243cca=_0x243cca-0x0;var _0xf94771=_0x3f32[_0x243cca];return _0xf94771;};'use strict';var BPromise=require(_0x23f3('0x0'));var jayson=require(_0x23f3('0x1'));var client=jayson[_0x23f3('0x2')][_0x23f3('0x3')]({'port':0x232b});function request(_0x34d686,_0x3aef5e){return new BPromise(function(_0x3aed76,_0x1a032f){return client[_0x23f3('0x4')](_0x34d686,_0x3aef5e)[_0x23f3('0x5')](function(_0xd05a00){if(_0xd05a00[_0x23f3('0x6')]){return _0x1a032f(_0xd05a00['error'][_0x23f3('0x7')]);}else{return _0x3aed76(_0xd05a00[_0x23f3('0x8')]);}})[_0x23f3('0x9')](function(_0x5345a3){return _0x1a032f(_0x5345a3);});});}exports[_0x23f3('0xa')]=function(_0x5ae38f,_0x5e5496){return request(_0x23f3('0xb'),{'account':_0x5ae38f,'message':_0x5e5496});}; \ No newline at end of file +var _0xa4c1=['then','error','message','result','catch','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0xa4c1,0x12f));var _0x1a4c=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0xa4c1[_0x50e0b4];return _0x2fa8b0;};'use strict';var BPromise=require(_0x1a4c('0x0'));var jayson=require(_0x1a4c('0x1'));var client=jayson[_0x1a4c('0x2')][_0x1a4c('0x3')]({'port':0x232b});function request(_0x5bd10d,_0x3ac6f6){return new BPromise(function(_0x35c5b6,_0x4e01ce){return client[_0x1a4c('0x4')](_0x5bd10d,_0x3ac6f6)[_0x1a4c('0x5')](function(_0x91910e){if(_0x91910e[_0x1a4c('0x6')]){return _0x4e01ce(_0x91910e['error'][_0x1a4c('0x7')]);}else{return _0x35c5b6(_0x91910e[_0x1a4c('0x8')]);}})[_0x1a4c('0x9')](function(_0x1191e5){return _0x4e01ce(_0x1191e5);});});}exports['sendMailMessage']=function(_0x325f6f,_0x23353b){return request(_0x1a4c('0xa'),{'account':_0x325f6f,'message':_0x23353b});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index d3890d7..a093931 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29f2=['length','source','target','toJson','inspect','production','start','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','traverseBFS','clear','vertex','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','response','code','result','evtHangup','isUndefined','toString','error','arg_1','calleridname','callerid','finally','agicommand\x20not\x20found','[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','priority','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','./rpc','./mailRpc','./graph','./vertices','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','isArray'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x29f2,0x1a0));var _0x229f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x229f('0x0'));var moment=require(_0x229f('0x1'));var parser=require(_0x229f('0x2'));var util=require(_0x229f('0x3'));var logger=require(_0x229f('0x4'))('agi');var rpc=require(_0x229f('0x5'));var mailRpc=require(_0x229f('0x6'));var Graph=require(_0x229f('0x7'));var Vertices=require(_0x229f('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x229f('0x9')](function(_0x377f5b){logger['error'](_0x229f('0xa'),_0x377f5b[_0x229f('0xb')]);return[];});}function addVertex(_0x178088,_0x2606cb,_0x5e409e){_0x2606cb[_0x229f('0xc')]=_0x5e409e;if(_0x2606cb[_0x229f('0xd')](_0x229f('0xe'))){_0x2606cb[_0x229f('0xf')]=parseInt(_0x2606cb[_0x229f('0xe')],0xa);}_0x178088[_0x229f('0x10')](_['omit'](_0x2606cb,'mxCell'));}function initGraph(_0x16fdc2,_0x5524b9){var _0x1a4110=new Graph();for(var _0x6fa662 in _0x16fdc2){if(_0x16fdc2[_0x229f('0xd')](_0x6fa662)){if(_[_0x229f('0x11')](_0x16fdc2[_0x6fa662])){for(var _0x43d5b2=0x0;_0x43d5b2<_0x16fdc2[_0x6fa662][_0x229f('0x12')];_0x43d5b2+=0x1){addVertex(_0x1a4110,_0x16fdc2[_0x6fa662][_0x43d5b2],_0x6fa662);}}else{addVertex(_0x1a4110,_0x16fdc2[_0x6fa662],_0x6fa662);}}}for(var _0x2390d1=0x0;_0x2390d1<_0x5524b9[_0x229f('0x12')];_0x2390d1+=0x1){if(_0x5524b9[_0x2390d1][_0x229f('0x13')]&&_0x5524b9[_0x2390d1]['target']){_0x1a4110['addEdge'](_0x5524b9[_0x2390d1][_0x229f('0x13')],_0x5524b9[_0x2390d1][_0x229f('0x14')],_0x5524b9[_0x2390d1]['value']);}}return _0x1a4110;}function getRoot(_0x17a0b6){return parser[_0x229f('0x15')](_0x17a0b6,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x13f11a){return util[_0x229f('0x16')](_0x13f11a,{'showHidden':![],'depth':null});}function initialize(_0x215e8d,_0x55aa96){var _0x34528d=getRoot(_0x215e8d[_0x229f('0x17')]);if(!_0x34528d||!_0x34528d[_0x229f('0x18')])return;var _0x1d15ba,_0xdff9d1,_0x2165a9;logger[_0x229f('0x19')](_0x229f('0x1a'),JSON[_0x229f('0x1b')](_0x34528d,null,0x2));_0x55aa96[_0x229f('0x1c')]=moment()['format'](_0x229f('0x1d'));_0x1d15ba=initGraph(_[_0x229f('0x1e')](_0x34528d,_0x229f('0x1f')),_0x34528d[_0x229f('0x1f')]);_0xdff9d1=new Vertices(_0x55aa96,rpc,mailRpc);logger['info'](util[_0x229f('0x20')](_0x229f('0x21'),_0x55aa96['arg_1'],_0x55aa96['calleridname'],_0x55aa96['callerid'],_0x55aa96[_0x229f('0x22')],_0x55aa96[_0x229f('0x23')]));_0x1d15ba[_0x229f('0x24')](_0x34528d[_0x229f('0x18')]['id'],function(_0x543882){try{_0x543882=_0xdff9d1[_0x229f('0x25')](_0x543882);logger[_0x229f('0x19')](_0x229f('0x26'),JSON[_0x229f('0x1b')](_0x543882,null,0x2));if(_0x543882[_0x229f('0xc')]==='gotoc'){logger[_0x229f('0x27')](_0x229f('0x28'));_0x55aa96['context']=_0x543882[_0x229f('0x29')]||_0x55aa96[_0x229f('0x29')];_0x55aa96[_0x229f('0x2a')]=_0x543882['extension'];_0x55aa96['priority']=_0x543882['priority']?_0x543882['priority']-0x1:0x1;return null;}else if(_0x543882&&_0xdff9d1[_0x543882[_0x229f('0xc')]]){_0x2165a9=_0xdff9d1[_0x543882[_0x229f('0xc')]](_0x543882);logger[_0x229f('0x27')](_0x229f('0x2b'),JSON['stringify'](_0x2165a9,null,0x2));if(_0x2165a9&&_0x2165a9[_0x229f('0x2c')]===AGI_CODE_SUCCESS&&_0x2165a9[_0x229f('0x2d')]!==AGI_RESULT_ERROR&&!_0x55aa96[_0x229f('0x2e')]){logger['debug'](_0x229f('0x2b'),inspect(_0x2165a9));return _[_0x229f('0x2f')](_0x2165a9[_0x229f('0x2d')])?null:_0x2165a9[_0x229f('0x2d')][_0x229f('0x30')]();}else{logger[_0x229f('0x31')]('response',inspect(_0x2165a9));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x27e6dc){logger[_0x229f('0x31')](_0x27e6dc[_0x229f('0xb')]);return null;}});if(_0x34528d['finally']){logger[_0x229f('0x27')](util[_0x229f('0x20')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x55aa96[_0x229f('0x32')],_0x55aa96[_0x229f('0x33')],_0x55aa96[_0x229f('0x34')],_0x55aa96[_0x229f('0x22')],_0x55aa96['uniqueid']));_0x1d15ba['traverseBFS'](_0x34528d[_0x229f('0x35')]['id'],function(_0x805d20){try{_0x805d20=_0xdff9d1[_0x229f('0x25')](_0x805d20);logger[_0x229f('0x19')](_0x229f('0x26'),JSON[_0x229f('0x1b')](_0x805d20,null,0x2));if(_0x805d20&&_0xdff9d1[_0x805d20[_0x229f('0xc')]]){_0x2165a9=_0xdff9d1[_0x805d20[_0x229f('0xc')]](_0x805d20);if(_0x2165a9){logger[_0x229f('0x19')](_0x229f('0x2b'),inspect(_0x2165a9));return _[_0x229f('0x2f')](_0x2165a9[_0x229f('0x2d')])?null:_0x2165a9['result'][_0x229f('0x30')]();}else{logger[_0x229f('0x31')]('response',inspect(_0x2165a9));return null;}}else{logger['error'](_0x229f('0x36'));return null;}}catch(_0x487f7a){logger['error'](_0x487f7a['stack']);return null;}});}logger[_0x229f('0x27')](util['format'](_0x229f('0x37'),_0x55aa96[_0x229f('0x32')],_0x55aa96[_0x229f('0x33')],_0x55aa96[_0x229f('0x34')],_0x55aa96[_0x229f('0x22')],_0x55aa96[_0x229f('0x23')]));logger[_0x229f('0x27')](util['format'](_0x229f('0x38'),_0x55aa96[_0x229f('0x29')],_0x55aa96[_0x229f('0x2a')],parseInt(_0x55aa96[_0x229f('0x39')],0xa)+0x1));_0x55aa96[_0x229f('0x3a')](_0x55aa96[_0x229f('0x29')],_0x55aa96[_0x229f('0x2a')],parseInt(_0x55aa96[_0x229f('0x39')],0xa)+0x1);_0x55aa96[_0x229f('0x3b')]();}function handleNotFound(_0x4654e1){logger['error'](util[_0x229f('0x20')]('Project\x20%s\x20not\x20found',_0x4654e1['arg_1']));_0x4654e1['continueAt'](_0x4654e1[_0x229f('0x29')],_0x4654e1[_0x229f('0x2a')],parseInt(_0x4654e1[_0x229f('0x39')],0xa)+0x1);_0x4654e1[_0x229f('0x3b')]();}function handleUnpublished(_0x581fbd){logger[_0x229f('0x31')](util[_0x229f('0x20')](_0x229f('0x3c'),_0x581fbd[_0x229f('0x32')]));_0x581fbd['continueAt'](_0x581fbd[_0x229f('0x29')],_0x581fbd[_0x229f('0x2a')],parseInt(_0x581fbd[_0x229f('0x39')],0xa)+0x1);_0x581fbd[_0x229f('0x3b')]();}module[_0x229f('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x0f1b=['catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','length','target','addEdge','source','value','root','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','clear','gotoc','context','extension','priority','response','code','result','evtHangup','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','toString','[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','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','util','../../config/logger','agi','./rpc','./mailRpc','./graph','getSquareProjects'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0f1b,0x15a));var _0xb0f1=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x0f1b[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xb0f1('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0xb0f1('0x1'));var logger=require(_0xb0f1('0x2'))(_0xb0f1('0x3'));var rpc=require(_0xb0f1('0x4'));var mailRpc=require(_0xb0f1('0x5'));var Graph=require(_0xb0f1('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb0f1('0x7')]()[_0xb0f1('0x8')](function(_0xd4201e){logger[_0xb0f1('0x9')](_0xb0f1('0xa'),_0xd4201e[_0xb0f1('0xb')]);return[];});}function addVertex(_0x5a6fec,_0x1abd51,_0x376c33){_0x1abd51[_0xb0f1('0xc')]=_0x376c33;if(_0x1abd51[_0xb0f1('0xd')](_0xb0f1('0xe'))){_0x1abd51[_0xb0f1('0xf')]=parseInt(_0x1abd51['retry'],0xa);}_0x5a6fec['addVertex'](_[_0xb0f1('0x10')](_0x1abd51,_0xb0f1('0x11')));}function initGraph(_0x3c7b90,_0x36eb03){var _0x323e36=new Graph();for(var _0x329909 in _0x3c7b90){if(_0x3c7b90[_0xb0f1('0xd')](_0x329909)){if(_['isArray'](_0x3c7b90[_0x329909])){for(var _0x4980fd=0x0;_0x4980fd<_0x3c7b90[_0x329909][_0xb0f1('0x12')];_0x4980fd+=0x1){addVertex(_0x323e36,_0x3c7b90[_0x329909][_0x4980fd],_0x329909);}}else{addVertex(_0x323e36,_0x3c7b90[_0x329909],_0x329909);}}}for(var _0x3c3c4e=0x0;_0x3c3c4e<_0x36eb03[_0xb0f1('0x12')];_0x3c3c4e+=0x1){if(_0x36eb03[_0x3c3c4e]['source']&&_0x36eb03[_0x3c3c4e][_0xb0f1('0x13')]){_0x323e36[_0xb0f1('0x14')](_0x36eb03[_0x3c3c4e][_0xb0f1('0x15')],_0x36eb03[_0x3c3c4e]['target'],_0x36eb03[_0x3c3c4e][_0xb0f1('0x16')]);}}return _0x323e36;}function getRoot(_0x4af65f){return parser['toJson'](_0x4af65f,{'object':!![]})['mxGraphModel'][_0xb0f1('0x17')];}function inspect(_0x3f950f){return util['inspect'](_0x3f950f,{'showHidden':![],'depth':null});}function initialize(_0x5984ed,_0x4515a1){var _0x13afba=getRoot(_0x5984ed['production']);if(!_0x13afba||!_0x13afba[_0xb0f1('0x18')])return;var _0x38e4fe,_0x294190,_0x32b3f6;logger[_0xb0f1('0x19')](_0xb0f1('0x17'),JSON[_0xb0f1('0x1a')](_0x13afba,null,0x2));_0x4515a1[_0xb0f1('0x1b')]=moment()[_0xb0f1('0x1c')](_0xb0f1('0x1d'));_0x38e4fe=initGraph(_['omit'](_0x13afba,_0xb0f1('0x11')),_0x13afba[_0xb0f1('0x11')]);_0x294190=new Vertices(_0x4515a1,rpc,mailRpc);logger[_0xb0f1('0x1e')](util[_0xb0f1('0x1c')](_0xb0f1('0x1f'),_0x4515a1[_0xb0f1('0x20')],_0x4515a1[_0xb0f1('0x21')],_0x4515a1[_0xb0f1('0x22')],_0x4515a1[_0xb0f1('0x23')],_0x4515a1[_0xb0f1('0x24')]));_0x38e4fe['traverseBFS'](_0x13afba[_0xb0f1('0x18')]['id'],function(_0x2885ca){try{_0x2885ca=_0x294190[_0xb0f1('0x25')](_0x2885ca);logger[_0xb0f1('0x19')]('vertex',JSON['stringify'](_0x2885ca,null,0x2));if(_0x2885ca[_0xb0f1('0xc')]===_0xb0f1('0x26')){logger[_0xb0f1('0x1e')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4515a1[_0xb0f1('0x27')]=_0x2885ca['context']||_0x4515a1[_0xb0f1('0x27')];_0x4515a1[_0xb0f1('0x28')]=_0x2885ca[_0xb0f1('0x28')];_0x4515a1[_0xb0f1('0x29')]=_0x2885ca['priority']?_0x2885ca[_0xb0f1('0x29')]-0x1:0x1;return null;}else if(_0x2885ca&&_0x294190[_0x2885ca[_0xb0f1('0xc')]]){_0x32b3f6=_0x294190[_0x2885ca[_0xb0f1('0xc')]](_0x2885ca);logger[_0xb0f1('0x1e')](_0xb0f1('0x2a'),JSON[_0xb0f1('0x1a')](_0x32b3f6,null,0x2));if(_0x32b3f6&&_0x32b3f6[_0xb0f1('0x2b')]===AGI_CODE_SUCCESS&&_0x32b3f6[_0xb0f1('0x2c')]!==AGI_RESULT_ERROR&&!_0x4515a1[_0xb0f1('0x2d')]){logger[_0xb0f1('0x19')](_0xb0f1('0x2a'),inspect(_0x32b3f6));return _[_0xb0f1('0x2e')](_0x32b3f6['result'])?null:_0x32b3f6[_0xb0f1('0x2c')]['toString']();}else{logger[_0xb0f1('0x9')](_0xb0f1('0x2a'),inspect(_0x32b3f6));return null;}}else{logger[_0xb0f1('0x9')](_0xb0f1('0x2f'));return null;}}catch(_0x2acf0b){logger[_0xb0f1('0x9')](_0x2acf0b[_0xb0f1('0xb')]);return null;}});if(_0x13afba[_0xb0f1('0x30')]){logger[_0xb0f1('0x1e')](util[_0xb0f1('0x1c')](_0xb0f1('0x31'),_0x4515a1[_0xb0f1('0x20')],_0x4515a1[_0xb0f1('0x21')],_0x4515a1['callerid'],_0x4515a1['dnid'],_0x4515a1[_0xb0f1('0x24')]));_0x38e4fe['traverseBFS'](_0x13afba['finally']['id'],function(_0x3240da){try{_0x3240da=_0x294190['clear'](_0x3240da);logger[_0xb0f1('0x19')](_0xb0f1('0x32'),JSON[_0xb0f1('0x1a')](_0x3240da,null,0x2));if(_0x3240da&&_0x294190[_0x3240da[_0xb0f1('0xc')]]){_0x32b3f6=_0x294190[_0x3240da[_0xb0f1('0xc')]](_0x3240da);if(_0x32b3f6){logger[_0xb0f1('0x19')](_0xb0f1('0x2a'),inspect(_0x32b3f6));return _[_0xb0f1('0x2e')](_0x32b3f6[_0xb0f1('0x2c')])?null:_0x32b3f6[_0xb0f1('0x2c')][_0xb0f1('0x33')]();}else{logger[_0xb0f1('0x9')](_0xb0f1('0x2a'),inspect(_0x32b3f6));return null;}}else{logger['error'](_0xb0f1('0x2f'));return null;}}catch(_0x342a49){logger[_0xb0f1('0x9')](_0x342a49[_0xb0f1('0xb')]);return null;}});}logger[_0xb0f1('0x1e')](util[_0xb0f1('0x1c')](_0xb0f1('0x34'),_0x4515a1['arg_1'],_0x4515a1['calleridname'],_0x4515a1[_0xb0f1('0x22')],_0x4515a1[_0xb0f1('0x23')],_0x4515a1[_0xb0f1('0x24')]));logger['info'](util[_0xb0f1('0x1c')](_0xb0f1('0x35'),_0x4515a1['context'],_0x4515a1[_0xb0f1('0x28')],parseInt(_0x4515a1[_0xb0f1('0x29')],0xa)+0x1));_0x4515a1['continueAt'](_0x4515a1['context'],_0x4515a1[_0xb0f1('0x28')],parseInt(_0x4515a1[_0xb0f1('0x29')],0xa)+0x1);_0x4515a1[_0xb0f1('0x36')]();}function handleNotFound(_0x462099){logger[_0xb0f1('0x9')](util[_0xb0f1('0x1c')](_0xb0f1('0x37'),_0x462099[_0xb0f1('0x20')]));_0x462099[_0xb0f1('0x38')](_0x462099[_0xb0f1('0x27')],_0x462099[_0xb0f1('0x28')],parseInt(_0x462099[_0xb0f1('0x29')],0xa)+0x1);_0x462099[_0xb0f1('0x36')]();}function handleUnpublished(_0x1647d2){logger[_0xb0f1('0x9')](util[_0xb0f1('0x1c')](_0xb0f1('0x39'),_0x1647d2[_0xb0f1('0x20')]));_0x1647d2['continueAt'](_0x1647d2[_0xb0f1('0x27')],_0x1647d2[_0xb0f1('0x28')],parseInt(_0x1647d2[_0xb0f1('0x29')],0xa)+0x1);_0x1647d2[_0xb0f1('0x36')]();}module[_0xb0f1('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index a90ffc1..388124f 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 _0x90e0=['_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','trim','slice','headers','line','length','exports','stream','Transform','call','_localBuffer','_inBody','inherits','prototype'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x90e0,0xe3));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var Transform=require(_0x090e('0x0'))[_0x090e('0x1')];function AGIReply(_0x227f0c){Transform[_0x090e('0x2')](this,_0x227f0c);this[_0x090e('0x3')]='';this[_0x090e('0x4')]=![];}util[_0x090e('0x5')](AGIReply,Transform);AGIReply[_0x090e('0x6')][_0x090e('0x7')]=function(_0x15c0ce,_0x5205a1,_0x54c9aa){var _0x5138e6='\x0a',_0x529eae=['\x0a\x0a',_0x090e('0x8')],_0x3581db=-0x1,_0x1738e3=-0x1,_0x22d987='',_0x1ae077=0x0,_0x41c935='',_0x3bbf92='';this['_localBuffer']+=_0x15c0ce[_0x090e('0x9')]();_0x41c935=this[_0x090e('0x3')];if(!this[_0x090e('0x4')]){_0x1ae077=0x0;while(_0x529eae[_0x1ae077]){while((_0x1738e3=_0x41c935[_0x090e('0xa')](_0x529eae[_0x1ae077]))!=-0x1){_0x22d987=_0x529eae[_0x1ae077];_0x3bbf92=_0x41c935[_0x090e('0xb')](0x0,_0x1738e3);_0x41c935=_0x41c935[_0x090e('0xb')](_0x1738e3+_0x22d987['length']);var _0x5831c=_0x3bbf92['split'](_0x5138e6),_0x158c57=0x0,_0x46f496={},_0x456001='',_0x21d4e8='',_0x4a528f=-0x1;while(_0x5831c[_0x158c57]){_0x4a528f=_0x5831c[_0x158c57][_0x090e('0xa')](':');if(_0x4a528f!=-0x1){_0x456001=_0x5831c[_0x158c57]['slice'](0x0,_0x4a528f)[_0x090e('0xc')]();_0x21d4e8=_0x5831c[_0x158c57][_0x090e('0xd')](_0x4a528f+0x1)['trim']();if(_0x456001['length']>0x0){_0x46f496[_0x456001]=_0x21d4e8;}}else{}_0x158c57++;}this['emit'](_0x090e('0xe'),_0x46f496);this[_0x090e('0x4')]=!![];}_0x1ae077++;}this[_0x090e('0x3')]=_0x41c935;}else{while((_0x3581db=_0x41c935[_0x090e('0xa')](_0x5138e6))!=-0x1){_0x3bbf92=_0x41c935[_0x090e('0xb')](0x0,_0x3581db);this['emit'](_0x090e('0xf'),_0x3bbf92);_0x41c935=_0x41c935['substring'](_0x3581db+_0x5138e6[_0x090e('0x10')]);}this[_0x090e('0x3')]=_0x41c935;}_0x54c9aa();};module[_0x090e('0x11')]=AGIReply; \ No newline at end of file +var _0xfb3f=['exports','util','stream','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer','indexOf','substring','length','split','slice','trim','emit','headers','line'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfb3f,0xd9));var _0xffb3=function(_0x51f825,_0x3eb3e5){_0x51f825=_0x51f825-0x0;var _0x4d0a14=_0xfb3f[_0x51f825];return _0x4d0a14;};'use strict';var util=require(_0xffb3('0x0'));var Transform=require(_0xffb3('0x1'))['Transform'];function AGIReply(_0x3b2630){Transform['call'](this,_0x3b2630);this['_localBuffer']='';this[_0xffb3('0x2')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xffb3('0x3')][_0xffb3('0x4')]=function(_0xaecfd9,_0x15cb2c,_0x30d7f7){var _0x25261c='\x0a',_0x3868a6=['\x0a\x0a',_0xffb3('0x5')],_0x146133=-0x1,_0x5177aa=-0x1,_0x2e9697='',_0x250f0f=0x0,_0x39014a='',_0x1d9adc='';this['_localBuffer']+=_0xaecfd9[_0xffb3('0x6')]();_0x39014a=this[_0xffb3('0x7')];if(!this[_0xffb3('0x2')]){_0x250f0f=0x0;while(_0x3868a6[_0x250f0f]){while((_0x5177aa=_0x39014a[_0xffb3('0x8')](_0x3868a6[_0x250f0f]))!=-0x1){_0x2e9697=_0x3868a6[_0x250f0f];_0x1d9adc=_0x39014a[_0xffb3('0x9')](0x0,_0x5177aa);_0x39014a=_0x39014a[_0xffb3('0x9')](_0x5177aa+_0x2e9697[_0xffb3('0xa')]);var _0x5fd707=_0x1d9adc[_0xffb3('0xb')](_0x25261c),_0x545d98=0x0,_0x13c1c7={},_0x40c953='',_0x55192c='',_0x21924a=-0x1;while(_0x5fd707[_0x545d98]){_0x21924a=_0x5fd707[_0x545d98][_0xffb3('0x8')](':');if(_0x21924a!=-0x1){_0x40c953=_0x5fd707[_0x545d98][_0xffb3('0xc')](0x0,_0x21924a)[_0xffb3('0xd')]();_0x55192c=_0x5fd707[_0x545d98][_0xffb3('0xc')](_0x21924a+0x1)[_0xffb3('0xd')]();if(_0x40c953[_0xffb3('0xa')]>0x0){_0x13c1c7[_0x40c953]=_0x55192c;}}else{}_0x545d98++;}this[_0xffb3('0xe')](_0xffb3('0xf'),_0x13c1c7);this[_0xffb3('0x2')]=!![];}_0x250f0f++;}this[_0xffb3('0x7')]=_0x39014a;}else{while((_0x146133=_0x39014a['indexOf'](_0x25261c))!=-0x1){_0x1d9adc=_0x39014a[_0xffb3('0x9')](0x0,_0x146133);this[_0xffb3('0xe')](_0xffb3('0x10'),_0x1d9adc);_0x39014a=_0x39014a['substring'](_0x146133+_0x25261c['length']);}this[_0xffb3('0x7')]=_0x39014a;}_0x30d7f7();};module[_0xffb3('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 ed22e38..dfa8fcd 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 _0x946e=['GetSquareProjects','name','ShowSquareProject','ShowMailAccount','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','jayson/promise','http','request','then','error','message','result'];(function(_0x15e950,_0x1db756){var _0x3425e5=function(_0x1fa0f4){while(--_0x1fa0f4){_0x15e950['push'](_0x15e950['shift']());}};_0x3425e5(++_0x1db756);}(_0x946e,0x1d0));var _0xe946=function(_0x26adc5,_0x3398b4){_0x26adc5=_0x26adc5-0x0;var _0x3f3cf4=_0x946e[_0x26adc5];return _0x3f3cf4;};'use strict';var _=require(_0xe946('0x0'));var moment=require('moment');var jayson=require(_0xe946('0x1'));var client=jayson['client'][_0xe946('0x2')]({'port':0x2329});function request(_0x5d4ee0,_0x5c9b66){return new Promise(function(_0x31cade,_0xb981db){return client[_0xe946('0x3')](_0x5d4ee0,_0x5c9b66)[_0xe946('0x4')](function(_0x11d758){if(_0x11d758['error']){return _0xb981db(_0x11d758[_0xe946('0x5')][_0xe946('0x6')]);}else{return _0x31cade(_0x11d758[_0xe946('0x7')]);}})['catch'](function(_0x39bd38){return _0xb981db(_0x39bd38);});});}exports['getSquareProjects']=function(){return request(_0xe946('0x8'),{'options':{'raw':![],'attributes':['id',_0xe946('0x9'),'production']}});};exports['getSquareProject']=function(_0x49e9fc){return request(_0xe946('0xa'),{'options':{'raw':![],'where':{'name':_0x49e9fc},'attributes':['production']}});};exports['getMailAccountById']=function(_0x35a35a){return request(_0xe946('0xb'),{'options':{'raw':![],'where':{'id':_0x35a35a},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xe946('0xc'),'as':_0xe946('0xc')}]}],'attributes':['id','name',_0xe946('0xd')],'smtp':!![]}});};exports[_0xe946('0xe')]=function(_0x36ad64){return request(_0xe946('0xa'),{'options':{'where':{'id':_0x36ad64},'attributes':[_0xe946('0x9')]}});};exports[_0xe946('0xf')]=function(_0x3eba3c){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x3eba3c},'attributes':['name']}});};exports[_0xe946('0x10')]=function(_0x2e66b8){return request(_0xe946('0x11'),{'options':{'where':{'id':_0x2e66b8},'attributes':['name']}});};exports[_0xe946('0x12')]=function(_0x437f13){return request(_0xe946('0x13'),{'options':{'where':{'id':_0x437f13},'attributes':['dsn']}});};exports[_0xe946('0x14')]=function(_0x1fbe13){return request(_0xe946('0x15'),{'options':{'where':{'id':_0x1fbe13},'attributes':['name']}});};exports[_0xe946('0x16')]=function(_0x3cde06){return request('GetContactByPhone',{'options':{'where':{'phone':_0x3cde06[_0xe946('0x17')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1489f4){return request(_0xe946('0x18'),{'options':{'where':{'id':_0x1489f4},'attributes':['name']}});};exports[_0xe946('0x19')]=function(_0x3c9027){return request(_0xe946('0x1a'),{'options':{'where':{'id':_0x3c9027},'attributes':[_0xe946('0x1b')]}});};exports[_0xe946('0x1c')]=function(_0x29fa47){return request(_0xe946('0x1d'),{'options':{'raw':![],'where':{'id':_0x29fa47},'include':[{'model':_0xe946('0x1e'),'as':_0xe946('0x1f')}]}});};exports[_0xe946('0x20')]=function(_0x5c0f83){return request(_0xe946('0x21'),{'options':{'where':{'id':_0x5c0f83},'attributes':['id',_0xe946('0x9')]}});};exports[_0xe946('0x22')]=function(_0x25dbfb){return request(_0xe946('0x23'),{'body':_0x25dbfb});};exports[_0xe946('0x24')]=function(_0x556045){return request(_0xe946('0x25'),{'body':_0x556045});};exports[_0xe946('0x26')]=function(_0x1d0b1f){return request(_0xe946('0x27'),{'body':_[_0xe946('0x28')](_0x1d0b1f,{'project_name':_0x1d0b1f[_0xe946('0x29')],'prev_project_name':_0x1d0b1f[_0xe946('0x2a')]||'','is_subproject':_0x1d0b1f[_0xe946('0x2a')]?!![]:![],'leaveAt':moment()[_0xe946('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xe946('0x2c')]=function(_0x4454d3){return request(_0xe946('0x2d'),{'body':_0x4454d3});};exports[_0xe946('0x2e')]=function(_0x33efee){return request(_0xe946('0x2f'),{'body':_0x33efee});};exports['createCmContact']=function(_0x20366d){return request(_0xe946('0x30'),{'options':{'raw':![],'where':{'phone':_0x20366d[_0xe946('0x17')],'ListId':_0x20366d[_0xe946('0x31')]}}})[_0xe946('0x4')](function(_0x1e41d2){if(_0x1e41d2){return _0x1e41d2;}return request(_0xe946('0x32'),{'body':_0x20366d});});};exports[_0xe946('0x33')]=function(_0x54ac40){return request(_0xe946('0x34'),{'options':{'where':{'id':_0x54ac40},'attributes':[_0xe946('0x9')]}});};exports['agentLogin']=function(_0x17f44c,_0x207a97){return request(_0xe946('0x35'),{'body':{'interface':_0x207a97},'options':{'where':_0x17f44c}});};exports[_0xe946('0x36')]=function(_0x5bf662,_0x39258e,_0xbd026d){return request(_0xe946('0x37'),{'body':{'type':_0x39258e,'uniqueid':_0xbd026d},'options':{'where':_0x5bf662}});};exports[_0xe946('0x38')]=function(_0x1711a1){return request('UnpauseUser',{'body':{},'options':{'where':_0x1711a1}});};exports[_0xe946('0x39')]=function(_0x1dcab6){return request(_0xe946('0x3a'),{'body':{},'options':{'where':_0x1dcab6}});}; \ No newline at end of file +var _0x6c84=['getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','client','http','error','message','result','catch','getSquareProjects','name','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0x6c84,0x112));var _0x46c8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6c84[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x46c8('0x0'));var moment=require(_0x46c8('0x1'));var jayson=require(_0x46c8('0x2'));var client=jayson[_0x46c8('0x3')][_0x46c8('0x4')]({'port':0x2329});function request(_0x51d202,_0x187ef9){return new Promise(function(_0x4e8480,_0x2f4e36){return client['request'](_0x51d202,_0x187ef9)['then'](function(_0x2b0d13){if(_0x2b0d13[_0x46c8('0x5')]){return _0x2f4e36(_0x2b0d13[_0x46c8('0x5')][_0x46c8('0x6')]);}else{return _0x4e8480(_0x2b0d13[_0x46c8('0x7')]);}})[_0x46c8('0x8')](function(_0xfe26c8){return _0x2f4e36(_0xfe26c8);});});}exports[_0x46c8('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x46c8('0xa'),'production']}});};exports['getSquareProject']=function(_0x527efe){return request(_0x46c8('0xb'),{'options':{'raw':![],'where':{'name':_0x527efe},'attributes':['production']}});};exports[_0x46c8('0xc')]=function(_0x38bd85){return request(_0x46c8('0xd'),{'options':{'raw':![],'where':{'id':_0x38bd85},'include':[{'model':_0x46c8('0xe'),'as':_0x46c8('0xf'),'include':[{'model':_0x46c8('0x10'),'as':_0x46c8('0x10')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x201cac){return request('ShowSquareProject',{'options':{'where':{'id':_0x201cac},'attributes':[_0x46c8('0xa')]}});};exports[_0x46c8('0x11')]=function(_0x30feb2){return request(_0x46c8('0x12'),{'options':{'where':{'id':_0x30feb2},'attributes':[_0x46c8('0xa')]}});};exports['getVariableById']=function(_0xb9f437){return request(_0x46c8('0x13'),{'options':{'where':{'id':_0xb9f437},'attributes':['name']}});};exports[_0x46c8('0x14')]=function(_0x279b28){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x279b28},'attributes':['dsn']}});};exports[_0x46c8('0x15')]=function(_0x255a0e){return request(_0x46c8('0x16'),{'options':{'where':{'id':_0x255a0e},'attributes':[_0x46c8('0xa')]}});};exports[_0x46c8('0x17')]=function(_0x40ea2c){return request(_0x46c8('0x18'),{'options':{'where':{'phone':_0x40ea2c[_0x46c8('0x19')]},'attributes':['id']}});};exports[_0x46c8('0x1a')]=function(_0x56a560){return request(_0x46c8('0x1b'),{'options':{'where':{'id':_0x56a560},'attributes':[_0x46c8('0xa')]}});};exports[_0x46c8('0x1c')]=function(_0x298e3d){return request(_0x46c8('0x1d'),{'options':{'where':{'id':_0x298e3d},'attributes':['save_name']}});};exports[_0x46c8('0x1e')]=function(_0x3d1089){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3d1089},'include':[{'model':'Interval','as':_0x46c8('0x1f')}]}});};exports[_0x46c8('0x20')]=function(_0x509238){return request(_0x46c8('0x21'),{'options':{'where':{'id':_0x509238},'attributes':['id','name']}});};exports[_0x46c8('0x22')]=function(_0x1d724b){return request(_0x46c8('0x23'),{'body':_0x1d724b});};exports[_0x46c8('0x24')]=function(_0x450cd0){return request(_0x46c8('0x25'),{'body':_0x450cd0});};exports[_0x46c8('0x26')]=function(_0x44a796){return request(_0x46c8('0x27'),{'body':_[_0x46c8('0x28')](_0x44a796,{'project_name':_0x44a796[_0x46c8('0x29')],'prev_project_name':_0x44a796[_0x46c8('0x2a')]||'','is_subproject':_0x44a796[_0x46c8('0x2a')]?!![]:![],'leaveAt':moment()['format'](_0x46c8('0x2b'))})});};exports[_0x46c8('0x2c')]=function(_0x316602){return request(_0x46c8('0x2d'),{'body':_0x316602});};exports[_0x46c8('0x2e')]=function(_0x55a5f7){return request(_0x46c8('0x2f'),{'body':_0x55a5f7});};exports[_0x46c8('0x30')]=function(_0x840dac){return request(_0x46c8('0x31'),{'options':{'raw':![],'where':{'phone':_0x840dac[_0x46c8('0x19')],'ListId':_0x840dac[_0x46c8('0x32')]}}})['then'](function(_0x420556){if(_0x420556){return _0x420556;}return request(_0x46c8('0x33'),{'body':_0x840dac});});};exports[_0x46c8('0x34')]=function(_0x5c0ce0){return request('ShowPause',{'options':{'where':{'id':_0x5c0ce0},'attributes':[_0x46c8('0xa')]}});};exports[_0x46c8('0x35')]=function(_0x69eac8,_0x404335){return request(_0x46c8('0x36'),{'body':{'interface':_0x404335},'options':{'where':_0x69eac8}});};exports[_0x46c8('0x37')]=function(_0x762292,_0x2ddfa5,_0x24e0ab){return request(_0x46c8('0x38'),{'body':{'type':_0x2ddfa5,'uniqueid':_0x24e0ab},'options':{'where':_0x762292}});};exports['agentUnpause']=function(_0x57a515){return request(_0x46c8('0x39'),{'body':{},'options':{'where':_0x57a515}});};exports['agentLogout']=function(_0xa584be){return request(_0x46c8('0x3a'),{'body':{},'options':{'where':_0xa584be}});}; \ 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 040607a..21c63c4 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77a9=['./polly','exports'];(function(_0x380275,_0x249705){var _0x11bf41=function(_0x2e873c){while(--_0x2e873c){_0x380275['push'](_0x380275['shift']());}};_0x11bf41(++_0x249705);}(_0x77a9,0x19e));var _0x977a=function(_0x3fd49b,_0x50408f){_0x3fd49b=_0x3fd49b-0x0;var _0x38de97=_0x77a9[_0x3fd49b];return _0x38de97;};var polly=require(_0x977a('0x0'));var lex=require('./lex');module[_0x977a('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xbacd=['./lex','./polly'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xbacd,0x1c5));var _0xdbac=function(_0x164ad3,_0x14ac81){_0x164ad3=_0x164ad3-0x0;var _0x4dfed9=_0xbacd[_0x164ad3];return _0x4dfed9;};var polly=require(_0xdbac('0x0'));var lex=require(_0xdbac('0x1'));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 d4a1daa..f0ab758 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 _0x702d=['exports','./lib/api'];(function(_0x4e313b,_0x2ec13c){var _0x33d59e=function(_0x44ab2f){while(--_0x44ab2f){_0x4e313b['push'](_0x4e313b['shift']());}};_0x33d59e(++_0x2ec13c);}(_0x702d,0x147));var _0xd702=function(_0x5a677e,_0x22a192){_0x5a677e=_0x5a677e-0x0;var _0x48bd14=_0x702d[_0x5a677e];return _0x48bd14;};'use strict';var lex=require(_0xd702('0x0'));module[_0xd702('0x1')]=function(_0x37c2c5,_0x33e7c5,_0x37ed5c,_0x5c2b9e,_0x20c11a,_0xebbd7c){return lex(_0x37c2c5,_0x33e7c5,_0x37ed5c,_0x5c2b9e,_0x20c11a,_0xebbd7c);}; \ No newline at end of file +var _0x2750=['./lib/api'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x2750,0x13b));var _0x0275=function(_0x49bafc,_0x2dbc00){_0x49bafc=_0x49bafc-0x0;var _0x4479b2=_0x2750[_0x49bafc];return _0x4479b2;};'use strict';var lex=require(_0x0275('0x0'));module['exports']=function(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06){return lex(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06);}; \ 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 35715ad..2191e27 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(_0x1d0bc1,_0x38cc28){var _0x6f2523=function(_0x14fc9e){while(--_0x14fc9e){_0x1d0bc1['push'](_0x1d0bc1['shift']());}};_0x6f2523(++_0x38cc28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x4303b0,_0x6fa924){var _0x2cb89a=function(_0x241a40){while(--_0x241a40){_0x4303b0['push'](_0x4303b0['shift']());}};_0x2cb89a(++_0x6fa924);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 76eafbf..66cb58a 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 _0xc5c5=['exports','./lib/api'];(function(_0x37d317,_0x46dcc1){var _0x2c757f=function(_0xcbee92){while(--_0xcbee92){_0x37d317['push'](_0x37d317['shift']());}};_0x2c757f(++_0x46dcc1);}(_0xc5c5,0x189));var _0x5c5c=function(_0x26ef70,_0x3dffa5){_0x26ef70=_0x26ef70-0x0;var _0x506e9a=_0xc5c5[_0x26ef70];return _0x506e9a;};'use strict';var polly=require(_0x5c5c('0x0'));module[_0x5c5c('0x1')]=function(_0x31d592,_0x540243,_0x33f167,_0x8da723,_0x23d3c0,_0x5f3b57,_0x22b160){return polly(_0x31d592,_0x540243,_0x33f167,_0x8da723,_0x23d3c0,_0x5f3b57,_0x22b160);}; \ No newline at end of file +var _0xa167=['./lib/api','exports'];(function(_0x4f3621,_0x28e265){var _0x3d6a2b=function(_0x21f37b){while(--_0x21f37b){_0x4f3621['push'](_0x4f3621['shift']());}};_0x3d6a2b(++_0x28e265);}(_0xa167,0x19e));var _0x7a16=function(_0x15f539,_0xa889c7){_0x15f539=_0x15f539-0x0;var _0x40dc9e=_0xa167[_0x15f539];return _0x40dc9e;};'use strict';var polly=require(_0x7a16('0x0'));module[_0x7a16('0x1')]=function(_0x1d4a27,_0x2e7885,_0x519bd8,_0x2b136f,_0x49b63c,_0x4cdf2c,_0x58ed29){return polly(_0x1d4a27,_0x2e7885,_0x519bd8,_0x2b136f,_0x49b63c,_0x4cdf2c,_0x58ed29);}; \ 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 ee4f7c8..82f5d64 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 _0xf483=['exports','text','path','randomstring','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x26e359,_0x33f445){var _0x99b90=function(_0x553c83){while(--_0x553c83){_0x26e359['push'](_0x26e359['shift']());}};_0x99b90(++_0x33f445);}(_0xf483,0xb1));var _0x3f48=function(_0x7dee36,_0x2dd3f0){_0x7dee36=_0x7dee36-0x0;var _0x2d6ce3=_0xf483[_0x7dee36];return _0x2d6ce3;};'use strict';var fs=require('fs');var path=require(_0x3f48('0x0'));var BPromise=require('bluebird');var rs=require(_0x3f48('0x1'));var AWS=require(_0x3f48('0x2'));function pollyResult(_0x24d8c6,_0x421550,_0x38be43){return new BPromise(function(_0x483caa,_0x2ef26a){_0x24d8c6['synthesizeSpeech'](_0x421550,function(_0x1fefe3,_0x155d29){if(_0x1fefe3){_0x2ef26a(_0x1fefe3);}else if(_0x155d29){if(_0x155d29[_0x3f48('0x3')]instanceof Buffer){fs['writeFile'](_0x38be43,_0x155d29[_0x3f48('0x3')],function(_0x3bc13b){if(_0x3bc13b){_0x2ef26a(_0x3bc13b);}else{_0x483caa();}});}else{_0x2ef26a(new Error(_0x3f48('0x4')));}}else{_0x2ef26a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x3f48('0x5')]=function(_0x5b6dbf,_0x20ffb6,_0x4bf826,_0x4143a4,_0x2da9b3,_0x5e4f2c,_0x1f7019){var _0x2c5a9e=new AWS['Polly']({'accessKeyId':_0x5b6dbf,'secretAccessKey':_0x20ffb6,'region':_0x4bf826});var _0x5c0076={'Text':_0x2da9b3,'TextType':_0x5e4f2c||_0x3f48('0x6'),'OutputFormat':'mp3','VoiceId':_0x4143a4};return pollyResult(_0x2c5a9e,_0x5c0076,_0x1f7019);}; \ No newline at end of file +var _0x85c9=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text'];(function(_0xfcb4ff,_0x414831){var _0x4175c9=function(_0x1e3d2a){while(--_0x1e3d2a){_0xfcb4ff['push'](_0xfcb4ff['shift']());}};_0x4175c9(++_0x414831);}(_0x85c9,0xcd));var _0x985c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x85c9[_0x819464];return _0x49dcc0;};'use strict';var fs=require('fs');var path=require(_0x985c('0x0'));var BPromise=require(_0x985c('0x1'));var rs=require(_0x985c('0x2'));var AWS=require(_0x985c('0x3'));function pollyResult(_0x57410b,_0x3ef82a,_0x1fdd2a){return new BPromise(function(_0x5a92d9,_0x2ffee9){_0x57410b[_0x985c('0x4')](_0x3ef82a,function(_0x2253d8,_0x30e008){if(_0x2253d8){_0x2ffee9(_0x2253d8);}else if(_0x30e008){if(_0x30e008[_0x985c('0x5')]instanceof Buffer){fs[_0x985c('0x6')](_0x1fdd2a,_0x30e008[_0x985c('0x5')],function(_0x292742){if(_0x292742){_0x2ffee9(_0x292742);}else{_0x5a92d9();}});}else{_0x2ffee9(new Error(_0x985c('0x7')));}}else{_0x2ffee9(new Error(_0x985c('0x8')));}});});}module[_0x985c('0x9')]=function(_0x505f39,_0x1945b3,_0x35f4a5,_0x41885e,_0x3abc98,_0x296c53,_0x424a93){var _0x24bf8b=new AWS['Polly']({'accessKeyId':_0x505f39,'secretAccessKey':_0x1945b3,'region':_0x35f4a5});var _0x511011={'Text':_0x3abc98,'TextType':_0x296c53||_0x985c('0xa'),'OutputFormat':_0x985c('0xb'),'VoiceId':_0x41885e};return pollyResult(_0x24bf8b,_0x511011,_0x424a93);}; \ 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 19eb38d..1bd1b6a 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 _0xe5bb=['./lib/api','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe5bb,0x166));var _0xbe5b=function(_0x5690cf,_0x15e988){_0x5690cf=_0x5690cf-0x0;var _0x5f38f2=_0xe5bb[_0x5690cf];return _0x5f38f2;};'use strict';var asr=require(_0xbe5b('0x0'));module[_0xbe5b('0x1')]=function(_0x519e1e,_0x2a7bbd,_0x34120c,_0x15616a){return asr(_0x519e1e,_0x2a7bbd,_0x34120c);}; \ No newline at end of file +var _0x1a07=['./lib/api','exports'];(function(_0x11ba21,_0x44fd71){var _0x53e8a6=function(_0x49babf){while(--_0x49babf){_0x11ba21['push'](_0x11ba21['shift']());}};_0x53e8a6(++_0x44fd71);}(_0x1a07,0x1b0));var _0x71a0=function(_0x382168,_0xe03b6a){_0x382168=_0x382168-0x0;var _0x3ecf7e=_0x1a07[_0x382168];return _0x3ecf7e;};'use strict';var asr=require(_0x71a0('0x0'));module[_0x71a0('0x1')]=function(_0x3c7ad4,_0x2c765b,_0xdbbd8e,_0xdc4aa3){return asr(_0x3c7ad4,_0x2c765b,_0xdbbd8e);}; \ 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 e94b2f8..dbdae05 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 _0x55e0=['bluebird','https://speech.googleapis.com','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x3ac83e,_0x9032a6){var _0x3b0e4e=function(_0xee57aa){while(--_0xee57aa){_0x3ac83e['push'](_0x3ac83e['shift']());}};_0x3b0e4e(++_0x9032a6);}(_0x55e0,0xdc));var _0x055e=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x55e0[_0x48c4ef];return _0x435715;};'use strict';var url=require(_0x055e('0x0'));var BPromise=require(_0x055e('0x1'));var fs=require('fs');var host=_0x055e('0x2');module[_0x055e('0x3')]=function(_0x5b82b9,_0x578882,_0x3a2ee6){return new BPromise(function(_0x2d9bd5,_0x33cd7b){var _0x2773e4;if(typeof _0x5b82b9!==_0x055e('0x4')||_0x5b82b9[_0x055e('0x5')]===0x0){return _0x33cd7b('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x578882!=='string'||_0x578882[_0x055e('0x5')]===0x0){return _0x33cd7b('key\x20should\x20be\x20a\x20string');}if(typeof _0x3a2ee6!==_0x055e('0x6')&&(typeof _0x3a2ee6!==_0x055e('0x4')||_0x3a2ee6[_0x055e('0x5')]===0x0)){return _0x33cd7b(_0x055e('0x7'));}try{_0x2773e4=fs[_0x055e('0x8')](_0x5b82b9)['toString'](_0x055e('0x9'));}catch(_0xd67814){return _0x33cd7b(_0xd67814);}return _0x2d9bd5({'method':_0x055e('0xa'),'uri':host+_0x055e('0xb')+_0x578882,'body':{'config':{'encoding':_0x055e('0xc'),'sampleRateHertz':'8000','languageCode':_0x3a2ee6},'audio':{'content':_0x2773e4}},'json':!![]});});}; \ No newline at end of file +var _0x2242=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST'];(function(_0x4ad807,_0x34531d){var _0x393359=function(_0x189674){while(--_0x189674){_0x4ad807['push'](_0x4ad807['shift']());}};_0x393359(++_0x34531d);}(_0x2242,0x1a3));var _0x2224=function(_0x3ae913,_0x2ee041){_0x3ae913=_0x3ae913-0x0;var _0x489c78=_0x2242[_0x3ae913];return _0x489c78;};'use strict';var url=require(_0x2224('0x0'));var BPromise=require(_0x2224('0x1'));var fs=require('fs');var host=_0x2224('0x2');module['exports']=function(_0x3180c8,_0x317565,_0x4acc10){return new BPromise(function(_0x1993b6,_0xb65b2f){var _0x4b2099;if(typeof _0x3180c8!==_0x2224('0x3')||_0x3180c8[_0x2224('0x4')]===0x0){return _0xb65b2f(_0x2224('0x5'));}if(typeof _0x317565!=='string'||_0x317565[_0x2224('0x4')]===0x0){return _0xb65b2f(_0x2224('0x6'));}if(typeof _0x4acc10!==_0x2224('0x7')&&(typeof _0x4acc10!==_0x2224('0x3')||_0x4acc10[_0x2224('0x4')]===0x0)){return _0xb65b2f(_0x2224('0x8'));}try{_0x4b2099=fs[_0x2224('0x9')](_0x3180c8)[_0x2224('0xa')](_0x2224('0xb'));}catch(_0x3a674f){return _0xb65b2f(_0x3a674f);}return _0x1993b6({'method':_0x2224('0xc'),'uri':host+_0x2224('0xd')+_0x317565,'body':{'config':{'encoding':_0x2224('0xe'),'sampleRateHertz':_0x2224('0xf'),'languageCode':_0x4acc10},'audio':{'content':_0x4b2099}},'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 2cc6042..a6123c5 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 _0xeba8=['exports'];(function(_0x343a87,_0x287af9){var _0x432c43=function(_0x45cb62){while(--_0x45cb62){_0x343a87['push'](_0x343a87['shift']());}};_0x432c43(++_0x287af9);}(_0xeba8,0x119));var _0x8eba=function(_0x4369ef,_0x55cfbc){_0x4369ef=_0x4369ef-0x0;var _0x5b6913=_0xeba8[_0x4369ef];return _0x5b6913;};var asr=require('./asr');module[_0x8eba('0x0')]={'asr':asr}; \ No newline at end of file +var _0x74a9=['exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x74a9,0x6b));var _0x974a=function(_0x53c493,_0x425909){_0x53c493=_0x53c493-0x0;var _0x1478ab=_0x74a9[_0x53c493];return _0x1478ab;};var asr=require('./asr');module[_0x974a('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index daa52c0..7431915 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 _0xdc0e=['readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','writeFile','.wav','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','goggleTTS\x20path','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','action','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','parse','util','./tilde','agi','https://api.ispeech.org/api/rest','host','path','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','protocol','https:','request\x20to\x20','data','end','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777'];(function(_0x4db1f4,_0x20352b){var _0x10110b=function(_0x4b3c9e){while(--_0x4b3c9e){_0x4db1f4['push'](_0x4db1f4['shift']());}};_0x10110b(++_0x20352b);}(_0xdc0e,0x1eb));var _0xedc0=function(_0x45a7a6,_0x380289){_0x45a7a6=_0x45a7a6-0x0;var _0x514f51=_0xdc0e[_0x45a7a6];return _0x514f51;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xedc0('0x0'));var fs=require('fs');var http=require(_0xedc0('0x1'));var https=require(_0xedc0('0x2'));var md5=require(_0xedc0('0x3'));var path=require('path');var querystring=require(_0xedc0('0x4'));var rp=require(_0xedc0('0x5'));var rs=require(_0xedc0('0x6'));var sox=require(_0xedc0('0x7'));var tts=require('google-tts-api');var urlParse=require('url')[_0xedc0('0x8')];var util=require(_0xedc0('0x9'));var aws=require('./aws');var google=require('./google');var sestek=require('./sestek');var tilde=require(_0xedc0('0xa'));var logger=require('../../../config/logger')(_0xedc0('0xb'));var ISPEECH_API=_0xedc0('0xc');function downloadFile(_0x229df2,_0x52ba8b){return new BPromise(function(_0x222e2b,_0x407e3c){var _0x574df3=urlParse(_0x229df2);var _0x436842=_0x574df3['protocol']==='https:'?https:http;var _0x21ba1b={'host':_0x574df3[_0xedc0('0xd')],'path':_0x574df3[_0xedc0('0xe')],'headers':{'user-agent':_0xedc0('0xf')}};_0x436842[_0xedc0('0x10')](_0x21ba1b,function(_0x1d6932){if(_0x1d6932[_0xedc0('0x11')]!==0xc8){logger[_0xedc0('0x12')]('request\x20to\x20'+_0x229df2+_0xedc0('0x13')+_0x1d6932[_0xedc0('0x11')]+'\x20('+_0x1d6932[_0xedc0('0x14')]+')');_0x407e3c(new Error('request\x20to\x20'+_0x229df2+_0xedc0('0x13')+_0x1d6932[_0xedc0('0x11')]+'\x20('+_0x1d6932[_0xedc0('0x14')]+')'));return;}var _0x506678=fs[_0xedc0('0x15')](_0x52ba8b);_0x506678['on'](_0xedc0('0x16'),function(){logger[_0xedc0('0x17')]('finish\x20download\x20file');_0x506678[_0xedc0('0x18')](_0x222e2b);});_0x506678['on']('error',function(_0x1ba7db){fs[_0xedc0('0x19')](_0x52ba8b);logger[_0xedc0('0x12')](_0xedc0('0x1a'),_0x1ba7db);_0x407e3c(_0x1ba7db);});_0x1d6932[_0xedc0('0x1b')](_0x506678);})['on'](_0xedc0('0x12'),function(_0x52a857){logger[_0xedc0('0x12')](_0x52a857);_0x407e3c(_0x52a857);})['end']();});}function uploadFile(_0x485a7c){return new BPromise(function(_0x2ee564,_0x366829){var _0x2f7b54=urlParse(_0x485a7c);var _0xfdbe95=_0x2f7b54[_0xedc0('0x1c')]===_0xedc0('0x1d')?https:http;var _0x4beca1={'host':_0x2f7b54[_0xedc0('0xd')],'path':_0x2f7b54[_0xedc0('0xe')],'headers':{'user-agent':_0xedc0('0xf')}};_0xfdbe95[_0xedc0('0x10')](_0x4beca1,function(_0x43262e){if(_0x43262e[_0xedc0('0x11')]!==0xc8){_0x366829(new Error(_0xedc0('0x1e')+_0x485a7c+'\x20failed,\x20status\x20code\x20=\x20'+_0x43262e[_0xedc0('0x11')]+'\x20('+_0x43262e[_0xedc0('0x14')]+')'));return;}var _0x232aeb='';_0x43262e['on'](_0xedc0('0x1f'),function(_0x3b369a){_0x232aeb+=_0x3b369a;});_0x43262e['on'](_0xedc0('0x20'),function(){_0x2ee564(_0x232aeb);});})['on'](_0xedc0('0x12'),function(_0x38ec8a){_0x366829(_0x38ec8a);})['end']();});}function convertFile(_0x4dd412,_0x13ca7b){return new BPromise(function(_0x251468,_0x53d452){var _0x4ca13c=sox[_0xedc0('0x21')](_0x4dd412,_0x13ca7b,{'sampleRate':0x1f40,'format':_0xedc0('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4ca13c['on']('error',function(_0xafaca4){logger['error']('error\x20convert',_0xafaca4);_0x53d452(_0xafaca4);});_0x4ca13c['on']('end',function(){logger[_0xedc0('0x17')](_0xedc0('0x23'));_0x251468();});_0x4ca13c[_0xedc0('0x24')]();});}function base64Decode(_0x2a8f3f,_0x1e8050){var _0x2aeb87=path[_0xedc0('0x25')](__dirname,_0xedc0('0x26'),rs[_0xedc0('0x27')](0x4)+'.wav');fs[_0xedc0('0x28')](_0x2aeb87,_0x2a8f3f,_0xedc0('0x29'));return convertFile(_0x2aeb87,_0x1e8050)[_0xedc0('0x2a')](function(){try{fs[_0xedc0('0x19')](_0x2aeb87);fs[_0xedc0('0x2b')](_0x1e8050,_0xedc0('0x2c'));}catch(_0xd8ce7c){logger[_0xedc0('0x12')](_0xd8ce7c);}return _0x1e8050['split']('.')[0x0];});}function base64Encode(_0x1af5ed){var _0x419ab3=fs[_0xedc0('0x2d')](_0x1af5ed);return new Buffer(_0x419ab3)[_0xedc0('0x2e')](_0xedc0('0x29'));}exports[_0xedc0('0x2f')]=function(_0x4fff85,_0x448b18,_0x38823f,_0x2a7535,_0x112cbb,_0x418e20){var _0x51da25,_0x19af6b;var _0x5f50fe=_0xedc0('0x30');var _0x48aaf1=_0xedc0('0x31')+_0x4fff85;var _0x550709={};if(_0x448b18===_0xedc0('0x32')){_0x550709[_0xedc0('0x33')]={'ssml':_0x38823f};}else{_0x550709[_0xedc0('0x33')]={'text':_0x38823f};};_0x550709[_0xedc0('0x34')]={'languageCode':_0x2a7535,'ssmlGender':_0x112cbb};_0x550709[_0xedc0('0x35')]={'audioEncoding':_0xedc0('0x36'),'sampleRateHertz':0x1f40};var _0xf06d65={'url':_0x5f50fe+_0xedc0('0x37')+_0x48aaf1,'method':_0xedc0('0x38'),'json':!![],'body':_0x550709};return rp(_0xf06d65)[_0xedc0('0x2a')](function(_0x9cad04){return new BPromise(function(_0x168d8,_0x1b6006){_0x51da25=path[_0xedc0('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0xedc0('0x39'));var _0x21271d=Buffer[_0xedc0('0x3a')](_0x9cad04['audioContent'],'base64');return fs[_0xedc0('0x3b')](_0x51da25,_0x21271d,function(_0x520aa8){_0x1b6006(_0x520aa8);},function(_0x481d06){fs['chmodSync'](_0x51da25,_0xedc0('0x2c'));_0x168d8(_0x481d06);});});})[_0xedc0('0x2a')](function(_0x213fef){_0x19af6b=path[_0xedc0('0x25')](__dirname,_0xedc0('0x26'),rs[_0xedc0('0x27')](0x4)+_0xedc0('0x3c'));return convertFile(_0x51da25,_0x19af6b);})['then'](function(){try{fs['unlink'](_0x51da25);fs[_0xedc0('0x2b')](_0x19af6b,'777');}catch(_0x15e1da){logger[_0xedc0('0x12')](_0x15e1da);}logger[_0xedc0('0x17')](_0xedc0('0x3d'),_0x19af6b[_0xedc0('0x3e')]('.')[0x0]);return _0x19af6b[_0xedc0('0x3e')]('.')[0x0];});};exports[_0xedc0('0x3f')]=function(_0x2924fa,_0x383698){var _0x591c40=_0xedc0('0x40');var _0x5d6011,_0x11c17c;var _0x54ba9d;var _0x318e9c={'encoding':'utf8','method':_0xedc0('0x38'),'timeout':0x2710,'url':_0x591c40,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xedc0('0x41')+encodeURIComponent(JSON[_0xedc0('0x42')]([[[_0xedc0('0x43'),JSON[_0xedc0('0x42')]([_0x2924fa,_0x383698||'en',![],_0xedc0('0x44')]),null,_0xedc0('0x45')]]]))};return rp(_0x318e9c)['then'](function(_0x49ca5c){try{_0x54ba9d=eval(_0x49ca5c[_0xedc0('0x46')](0x5))[0x0][0x2];}catch(_0x3f19ce){throw new Error(_0xedc0('0x47')+_0x49ca5c[_0xedc0('0x1f')]);}if(!_0x54ba9d){if(_0x2924fa[_0xedc0('0x48')]>0xc8){throw new Error(_0xedc0('0x49'));}else{throw new Error('lang\x20\x22'+_0x383698+'\x22\x20might\x20not\x20exist');}}try{_0x54ba9d=eval(_0x54ba9d)[0x0];}catch(_0x1ac4ec){throw new Error(_0xedc0('0x47')+res[_0xedc0('0x1f')]);}const _0x172fbf=_0x54ba9d;_0x5d6011=path[_0xedc0('0x25')](__dirname,_0xedc0('0x26'),rs['generate'](0x4)+_0xedc0('0x39'));fs['writeFileSync'](_0x5d6011,_0x54ba9d,{'encoding':_0xedc0('0x29')});_0x11c17c=path['resolve'](__dirname,'tmp',rs[_0xedc0('0x27')](0x4)+_0xedc0('0x3c'));return convertFile(_0x5d6011,_0x11c17c);})[_0xedc0('0x2a')](function(){try{fs[_0xedc0('0x19')](_0x5d6011);fs[_0xedc0('0x2b')](_0x11c17c,_0xedc0('0x2c'));}catch(_0x1080be){logger['error'](_0x1080be);}logger['info'](_0xedc0('0x4a'),_0x11c17c[_0xedc0('0x3e')]('.')[0x0]);return _0x11c17c[_0xedc0('0x3e')]('.')[0x0];});};exports['googleASR']=function(_0x36d831,_0x3d4027,_0x16129f){return google['asr'](_0x36d831,_0x3d4027,_0x16129f)[_0xedc0('0x2a')](function(_0x25ccbf){logger[_0xedc0('0x17')](_0x25ccbf['uri']);return rp(_0x25ccbf);})[_0xedc0('0x2a')](function(_0x181f6b){var _0x4db9b2='';var _0x464d32=0x0;try{fs[_0xedc0('0x19')](_0x36d831);}catch(_0x28e506){logger['error'](_0x28e506);}if(_0x181f6b&&_0x181f6b['results']){_0x4db9b2=_0x181f6b['results'][_0xedc0('0x4b')](function(_0x3193e4){return _0x3193e4&&_0x3193e4[_0xedc0('0x4c')][0x0]&&_0x3193e4[_0xedc0('0x4c')][0x0][_0xedc0('0x4d')]?_0x3193e4[_0xedc0('0x4c')][0x0][_0xedc0('0x4d')]:'';})[_0xedc0('0x4e')]('\x0a');_0x464d32=_0x181f6b[_0xedc0('0x4f')][_0xedc0('0x4b')](function(_0x1e8e87){return _0x1e8e87&&_0x1e8e87[_0xedc0('0x4c')][0x0]&&_0x1e8e87['alternatives'][0x0][_0xedc0('0x50')]?_0x1e8e87[_0xedc0('0x4c')][0x0]['confidence']:0x0;})[_0xedc0('0x4e')]('\x0a');}logger[_0xedc0('0x17')](_0xedc0('0x51'),_0x4db9b2);logger[_0xedc0('0x17')](_0xedc0('0x52'),_0x464d32);return{'transcript':_0x4db9b2,'confidence':_0x464d32};})[_0xedc0('0x53')](function(_0x4db226){logger[_0xedc0('0x12')]('[%s]\x20%s:%s',_0x4db226['statusCode'],_0x4db226[_0xedc0('0x54')],_0x4db226[_0xedc0('0x55')]);});};exports[_0xedc0('0x56')]=function(_0x1bb6d3,_0x3a3183,_0x37dad0,_0x2177b3){var _0x13ad9b=apiai(_0x3a3183,{'language':_0x2177b3||'en'});return _0x13ad9b[_0xedc0('0x57')](_0x37dad0,{'sessionId':md5(_0x1bb6d3)})[_0xedc0('0x2a')](function(_0x49fc73){logger['info'](JSON[_0xedc0('0x42')](_0x49fc73));return{'source':_0x49fc73[_0xedc0('0x58')][_0xedc0('0x59')],'resolvedQuery':_0x49fc73[_0xedc0('0x58')]['resolvedQuery'],'action':_0x49fc73[_0xedc0('0x58')][_0xedc0('0x5a')],'actionIncomplete':_0x49fc73[_0xedc0('0x58')]['actionIncomplete'],'speech':_0x49fc73[_0xedc0('0x58')]['fulfillment'][_0xedc0('0x5b')],'score':_0x49fc73[_0xedc0('0x58')][_0xedc0('0x5c')],'statusCode':_0x49fc73[_0xedc0('0x5d')][_0xedc0('0x5e')],'endConversation':_0x49fc73[_0xedc0('0x58')][_0xedc0('0x5f')][_0xedc0('0x60')]||![],'isFallbackIntent':_0x49fc73[_0xedc0('0x58')][_0xedc0('0x5f')]['isFallbackIntent']};});};exports[_0xedc0('0x61')]=function(_0x52d8ad,_0x491084,_0x23bd5b,_0x3e138,_0x2091c3,_0x9fae5b){var _0x36da08=_0x3e138[_0xedc0('0x62')](/\\n/g,'\x0a');var _0x2e47c3={'credentials':{'private_key':_0x36da08,'client_email':_0x23bd5b}};var _0x1521b0=new dialogflow[(_0xedc0('0x63'))](_0x2e47c3);var _0xe466b4=_0x1521b0[_0xedc0('0x64')](_0x491084,md5(_0x52d8ad));var _0x254cc5={'session':_0xe466b4,'queryInput':{'text':{'text':_0x2091c3,'languageCode':_0x9fae5b}}};return _0x1521b0[_0xedc0('0x65')](_0x254cc5)['then'](function(_0x3b4475){if(_0x3b4475&&_0x3b4475[_0xedc0('0x48')]){logger[_0xedc0('0x17')](_0xedc0('0x66'),JSON['stringify'](_0x3b4475));var _0x484ddb=_0x3b4475[0x0];if(_0x484ddb){var _0x5199d1={'action':_0x484ddb[_0xedc0('0x67')][_0xedc0('0x5a')],'allRequiredParamsPresent':_0x484ddb[_0xedc0('0x67')]['allRequiredParamsPresent'],'endConversation':_0x484ddb['queryResult'][_0xedc0('0x68')]&&_0x484ddb[_0xedc0('0x67')]['diagnosticInfo'][_0xedc0('0x69')]?_0x484ddb[_0xedc0('0x67')]['diagnosticInfo'][_0xedc0('0x69')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x484ddb[_0xedc0('0x67')][_0xedc0('0x6a')],'intentName':_0x484ddb['queryResult'][_0xedc0('0x6b')][_0xedc0('0x54')],'intentDisplayName':_0x484ddb[_0xedc0('0x67')][_0xedc0('0x6b')][_0xedc0('0x6c')],'isFallbackIntent':_0x484ddb[_0xedc0('0x67')][_0xedc0('0x6b')][_0xedc0('0x6d')],'languageCode':_0x484ddb['queryResult'][_0xedc0('0x6e')],'queryText':_0x484ddb['queryResult'][_0xedc0('0x6f')],'responseId':_0x484ddb[_0xedc0('0x70')],'score':_0x484ddb['queryResult'][_0xedc0('0x71')],'speech':_0x484ddb[_0xedc0('0x67')][_0xedc0('0x6a')],'providerResponse':JSON[_0xedc0('0x42')](_0x3b4475)};return _0x5199d1;}}});};exports[_0xedc0('0x72')]=function(_0x42c8e2,_0x2ca302,_0x916e9e,_0x5bb7b2){return tilde['asr'](_0x42c8e2,_0x2ca302,_0x916e9e,_0x5bb7b2)[_0xedc0('0x2a')](function(_0x1a2ecc){try{fs['unlink'](_0x42c8e2);}catch(_0x21ac1b){logger['error'](_0x21ac1b);}logger['info'](_0xedc0('0x73'),_0x1a2ecc['transcript']);logger['info'](_0xedc0('0x74'),_0x1a2ecc[_0xedc0('0x50')]);return _0x1a2ecc;});};exports['awsPolly']=function(_0x5bfa47,_0x3c8ff8,_0x4fdb0e,_0x5ecb52,_0x33bba4,_0x62045b){var _0x576553=path[_0xedc0('0x25')](__dirname,_0xedc0('0x26'),rs[_0xedc0('0x27')](0x4)+_0xedc0('0x39'));var _0x332480;return aws[_0xedc0('0x75')](_0x5bfa47,_0x3c8ff8,_0x4fdb0e,_0x5ecb52,_0x33bba4,_0x62045b,_0x576553)[_0xedc0('0x2a')](function(){_0x332480=path['resolve'](__dirname,_0xedc0('0x26'),rs['generate'](0x4)+_0xedc0('0x3c'));return convertFile(_0x576553,_0x332480);})[_0xedc0('0x2a')](function(){try{fs[_0xedc0('0x19')](_0x576553);fs[_0xedc0('0x2b')](_0x332480,_0xedc0('0x2c'));}catch(_0x31573f){logger['error'](_0x31573f);}return _0x332480[_0xedc0('0x3e')]('.')[0x0];});};exports[_0xedc0('0x76')]=function(_0x3d427f,_0x10d1e6,_0x4c0508,_0x5d351a,_0x30d90a,_0x32c1e1){return aws['lex'](_0x3d427f,_0x10d1e6,_0x4c0508,_0x5d351a,_0x30d90a,_0x32c1e1)[_0xedc0('0x2a')](function(_0x47374e){logger[_0xedc0('0x17')](JSON[_0xedc0('0x42')](_0x47374e));return _0x47374e;});};exports[_0xedc0('0x77')]=function(_0x20fb57,_0x2daae9,_0x169830,_0xaa9322){var _0xc9d72d=util[_0xedc0('0x78')](_0xedc0('0x79'),ISPEECH_API,_0x20fb57,encodeURIComponent(_0x2daae9),_0x169830,_0xaa9322);var _0x1fab24=path[_0xedc0('0x25')](__dirname,_0xedc0('0x26'),rs[_0xedc0('0x27')](0x4)+'.mp3');var _0x2db24b;return downloadFile(_0xc9d72d,_0x1fab24)['then'](function(){_0x2db24b=path[_0xedc0('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0xedc0('0x3c'));return convertFile(_0x1fab24,_0x2db24b);})[_0xedc0('0x2a')](function(){try{fs['unlink'](_0x1fab24);fs[_0xedc0('0x2b')](_0x2db24b,_0xedc0('0x2c'));}catch(_0x4b4571){logger[_0xedc0('0x12')](_0x4b4571);}return _0x2db24b[_0xedc0('0x3e')]('.')[0x0];});};exports[_0xedc0('0x7a')]=function(_0x38f1aa,_0x321671,_0x413f7f,_0x1f4c9){var _0x55e7b3=util[_0xedc0('0x78')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x321671,_0x413f7f,base64Encode(_0x38f1aa),_0x1f4c9?util[_0xedc0('0x78')](_0xedc0('0x7b'),encodeURIComponent(_0x1f4c9)):_0xedc0('0x7c'));return uploadFile(_0x55e7b3)[_0xedc0('0x2a')](function(_0x1f64ba){return querystring['parse'](_0x1f64ba);});};exports['sestekNDA']=function(_0x18ece8,_0x19adb6){return sestek[_0xedc0('0x7d')](_0x18ece8,_0x19adb6)[_0xedc0('0x2a')](function(_0x166e16){logger[_0xedc0('0x17')](JSON['stringify'](_0x166e16));var _0x1000ba={'speech':_0x166e16[_0xedc0('0x7e')],'action':_0x166e16[_0xedc0('0x7f')]?_0x166e16[_0xedc0('0x7f')][_0xedc0('0x80')]:undefined,'actiondata':_0x166e16[_0xedc0('0x7f')]?_0x166e16[_0xedc0('0x7f')][_0xedc0('0x81')]:undefined};if(_0x166e16[_0xedc0('0x7f')]&&_0x166e16[_0xedc0('0x7f')][_0xedc0('0x82')]){return base64Decode(_0x166e16[_0xedc0('0x7f')][_0xedc0('0x82')][_0xedc0('0x83')],path['resolve'](__dirname,'tmp',rs[_0xedc0('0x27')](0x4)+_0xedc0('0x3c')))[_0xedc0('0x2a')](function(_0x33c0d1){_0x1000ba[_0xedc0('0x84')]=_0x33c0d1;return _0x1000ba;});}return _0x1000ba;});};exports[_0xedc0('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x24c0=['sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','randomstring','sox','google-tts-api','url','util','./aws','./google','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','base64','then','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','.mp3','from','audioContent','writeFile','777','chmodSync','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','writeFileSync','.wav','goggleTTS\x20path','googleASR','asr','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','action','actionIncomplete','fulfillment','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse'];(function(_0x2051cd,_0x553ea4){var _0x33eafd=function(_0x58cbab){while(--_0x58cbab){_0x2051cd['push'](_0x2051cd['shift']());}};_0x33eafd(++_0x553ea4);}(_0x24c0,0x12e));var _0x024c=function(_0x3bbd1f,_0x119571){_0x3bbd1f=_0x3bbd1f-0x0;var _0x4cb1fe=_0x24c0[_0x3bbd1f];return _0x4cb1fe;};'use strict';var apiai=require(_0x024c('0x0'));var BPromise=require(_0x024c('0x1'));var dialogflow=require(_0x024c('0x2'));var fs=require('fs');var http=require(_0x024c('0x3'));var https=require(_0x024c('0x4'));var md5=require('md5');var path=require(_0x024c('0x5'));var querystring=require(_0x024c('0x6'));var rp=require('request-promise');var rs=require(_0x024c('0x7'));var sox=require(_0x024c('0x8'));var tts=require(_0x024c('0x9'));var urlParse=require(_0x024c('0xa'))['parse'];var util=require(_0x024c('0xb'));var aws=require(_0x024c('0xc'));var google=require(_0x024c('0xd'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x024c('0xe'))(_0x024c('0xf'));var ISPEECH_API=_0x024c('0x10');function downloadFile(_0x5c8c9d,_0x39efa1){return new BPromise(function(_0x3bec48,_0x3ff1e8){var _0x57bd87=urlParse(_0x5c8c9d);var _0x1a23b7=_0x57bd87[_0x024c('0x11')]===_0x024c('0x12')?https:http;var _0x43ce21={'host':_0x57bd87[_0x024c('0x13')],'path':_0x57bd87['path'],'headers':{'user-agent':_0x024c('0x14')}};_0x1a23b7['get'](_0x43ce21,function(_0x28d879){if(_0x28d879[_0x024c('0x15')]!==0xc8){logger[_0x024c('0x16')](_0x024c('0x17')+_0x5c8c9d+_0x024c('0x18')+_0x28d879[_0x024c('0x15')]+'\x20('+_0x28d879[_0x024c('0x19')]+')');_0x3ff1e8(new Error(_0x024c('0x17')+_0x5c8c9d+_0x024c('0x18')+_0x28d879[_0x024c('0x15')]+'\x20('+_0x28d879[_0x024c('0x19')]+')'));return;}var _0x3c2ed3=fs[_0x024c('0x1a')](_0x39efa1);_0x3c2ed3['on'](_0x024c('0x1b'),function(){logger[_0x024c('0x1c')](_0x024c('0x1d'));_0x3c2ed3[_0x024c('0x1e')](_0x3bec48);});_0x3c2ed3['on']('error',function(_0x18d5f2){fs[_0x024c('0x1f')](_0x39efa1);logger[_0x024c('0x16')](_0x024c('0x20'),_0x18d5f2);_0x3ff1e8(_0x18d5f2);});_0x28d879[_0x024c('0x21')](_0x3c2ed3);})['on'](_0x024c('0x16'),function(_0x238ca8){logger['error'](_0x238ca8);_0x3ff1e8(_0x238ca8);})[_0x024c('0x22')]();});}function uploadFile(_0x59bbb1){return new BPromise(function(_0x595d31,_0x402174){var _0x5a8272=urlParse(_0x59bbb1);var _0x2ed228=_0x5a8272['protocol']==='https:'?https:http;var _0x4775a1={'host':_0x5a8272['host'],'path':_0x5a8272[_0x024c('0x5')],'headers':{'user-agent':_0x024c('0x14')}};_0x2ed228[_0x024c('0x23')](_0x4775a1,function(_0x52ef4b){if(_0x52ef4b[_0x024c('0x15')]!==0xc8){_0x402174(new Error('request\x20to\x20'+_0x59bbb1+'\x20failed,\x20status\x20code\x20=\x20'+_0x52ef4b[_0x024c('0x15')]+'\x20('+_0x52ef4b['statusMessage']+')'));return;}var _0x2acb0a='';_0x52ef4b['on'](_0x024c('0x24'),function(_0x3a01d5){_0x2acb0a+=_0x3a01d5;});_0x52ef4b['on'](_0x024c('0x22'),function(){_0x595d31(_0x2acb0a);});})['on'](_0x024c('0x16'),function(_0x2baf59){_0x402174(_0x2baf59);})[_0x024c('0x22')]();});}function convertFile(_0x4d6cdc,_0x449ffb){return new BPromise(function(_0x3c1a1e,_0x3ac4fa){var _0xd02d9d=sox[_0x024c('0x25')](_0x4d6cdc,_0x449ffb,{'sampleRate':0x1f40,'format':_0x024c('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xd02d9d['on'](_0x024c('0x16'),function(_0x17fc66){logger[_0x024c('0x16')](_0x024c('0x27'),_0x17fc66);_0x3ac4fa(_0x17fc66);});_0xd02d9d['on']('end',function(){logger[_0x024c('0x1c')](_0x024c('0x28'));_0x3c1a1e();});_0xd02d9d[_0x024c('0x29')]();});}function base64Decode(_0x2df2a2,_0x4942f0){var _0x2f8ccd=path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs[_0x024c('0x2c')](0x4)+'.wav');fs['writeFileSync'](_0x2f8ccd,_0x2df2a2,_0x024c('0x2d'));return convertFile(_0x2f8ccd,_0x4942f0)[_0x024c('0x2e')](function(){try{fs['unlink'](_0x2f8ccd);fs['chmodSync'](_0x4942f0,'777');}catch(_0x86b89b){logger[_0x024c('0x16')](_0x86b89b);}return _0x4942f0['split']('.')[0x0];});}function base64Encode(_0x3539a0){var _0x4ef433=fs[_0x024c('0x2f')](_0x3539a0);return new Buffer(_0x4ef433)[_0x024c('0x30')]('base64');}exports[_0x024c('0x31')]=function(_0x403c82,_0x262800,_0x1b8587,_0x4fe733,_0x5cc429,_0x168ce6){var _0x511c47,_0x2b4882;var _0x33f86c=_0x024c('0x32');var _0x9c329b=_0x024c('0x33')+_0x403c82;var _0x9da44c={};if(_0x262800===_0x024c('0x34')){_0x9da44c[_0x024c('0x35')]={'ssml':_0x1b8587};}else{_0x9da44c['input']={'text':_0x1b8587};};_0x9da44c['voice']={'languageCode':_0x4fe733,'ssmlGender':_0x5cc429};_0x9da44c['audioConfig']={'audioEncoding':_0x024c('0x36'),'sampleRateHertz':0x1f40};var _0x2816fb={'url':_0x33f86c+_0x024c('0x37')+_0x9c329b,'method':'POST','json':!![],'body':_0x9da44c};return rp(_0x2816fb)[_0x024c('0x2e')](function(_0x2efc9d){return new BPromise(function(_0x3ea7dd,_0x32a030){_0x511c47=path['resolve'](__dirname,_0x024c('0x2b'),rs[_0x024c('0x2c')](0x4)+_0x024c('0x38'));var _0x4d54d4=Buffer[_0x024c('0x39')](_0x2efc9d[_0x024c('0x3a')],_0x024c('0x2d'));return fs[_0x024c('0x3b')](_0x511c47,_0x4d54d4,function(_0x256d6c){_0x32a030(_0x256d6c);},function(_0x26baae){fs['chmodSync'](_0x511c47,_0x024c('0x3c'));_0x3ea7dd(_0x26baae);});});})[_0x024c('0x2e')](function(_0x152c1d){_0x2b4882=path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs[_0x024c('0x2c')](0x4)+'.wav');return convertFile(_0x511c47,_0x2b4882);})[_0x024c('0x2e')](function(){try{fs[_0x024c('0x1f')](_0x511c47);fs[_0x024c('0x3d')](_0x2b4882,_0x024c('0x3c'));}catch(_0x184458){logger['error'](_0x184458);}logger['info'](_0x024c('0x3e'),_0x2b4882[_0x024c('0x3f')]('.')[0x0]);return _0x2b4882['split']('.')[0x0];});};exports[_0x024c('0x40')]=function(_0x331ea3,_0x587d6f){var _0x5def09=_0x024c('0x41');var _0x49a8cf,_0x44efe8;var _0x5268e3;var _0xe1bf72={'encoding':_0x024c('0x42'),'method':_0x024c('0x43'),'timeout':0x2710,'url':_0x5def09,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x024c('0x44')+encodeURIComponent(JSON[_0x024c('0x45')]([[['jQ1olc',JSON[_0x024c('0x45')]([_0x331ea3,_0x587d6f||'en',![],_0x024c('0x46')]),null,_0x024c('0x47')]]]))};return rp(_0xe1bf72)['then'](function(_0x221c62){try{_0x5268e3=eval(_0x221c62[_0x024c('0x48')](0x5))[0x0][0x2];}catch(_0x544c0a){throw new Error(_0x024c('0x49')+_0x221c62[_0x024c('0x24')]);}if(!_0x5268e3){if(_0x331ea3['length']>0xc8){throw new Error(_0x024c('0x4a'));}else{throw new Error(_0x024c('0x4b')+_0x587d6f+'\x22\x20might\x20not\x20exist');}}try{_0x5268e3=eval(_0x5268e3)[0x0];}catch(_0x5e0d2e){throw new Error(_0x024c('0x49')+res[_0x024c('0x24')]);}const _0x4f5a56=_0x5268e3;_0x49a8cf=path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs['generate'](0x4)+_0x024c('0x38'));fs[_0x024c('0x4c')](_0x49a8cf,_0x5268e3,{'encoding':_0x024c('0x2d')});_0x44efe8=path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs[_0x024c('0x2c')](0x4)+_0x024c('0x4d'));return convertFile(_0x49a8cf,_0x44efe8);})[_0x024c('0x2e')](function(){try{fs['unlink'](_0x49a8cf);fs[_0x024c('0x3d')](_0x44efe8,_0x024c('0x3c'));}catch(_0x317bef){logger[_0x024c('0x16')](_0x317bef);}logger['info'](_0x024c('0x4e'),_0x44efe8[_0x024c('0x3f')]('.')[0x0]);return _0x44efe8[_0x024c('0x3f')]('.')[0x0];});};exports[_0x024c('0x4f')]=function(_0x21c9f5,_0x1f3fdd,_0x41bf8a){return google[_0x024c('0x50')](_0x21c9f5,_0x1f3fdd,_0x41bf8a)['then'](function(_0x4d6018){logger[_0x024c('0x1c')](_0x4d6018['uri']);return rp(_0x4d6018);})[_0x024c('0x2e')](function(_0x172525){var _0x4d247a='';var _0x590f88=0x0;try{fs[_0x024c('0x1f')](_0x21c9f5);}catch(_0x19fb24){logger['error'](_0x19fb24);}if(_0x172525&&_0x172525['results']){_0x4d247a=_0x172525['results'][_0x024c('0x51')](function(_0x2ed4ab){return _0x2ed4ab&&_0x2ed4ab[_0x024c('0x52')][0x0]&&_0x2ed4ab[_0x024c('0x52')][0x0][_0x024c('0x53')]?_0x2ed4ab[_0x024c('0x52')][0x0][_0x024c('0x53')]:'';})[_0x024c('0x54')]('\x0a');_0x590f88=_0x172525[_0x024c('0x55')][_0x024c('0x51')](function(_0x15ebe1){return _0x15ebe1&&_0x15ebe1[_0x024c('0x52')][0x0]&&_0x15ebe1['alternatives'][0x0]['confidence']?_0x15ebe1[_0x024c('0x52')][0x0][_0x024c('0x56')]:0x0;})['join']('\x0a');}logger[_0x024c('0x1c')](_0x024c('0x57'),_0x4d247a);logger[_0x024c('0x1c')](_0x024c('0x58'),_0x590f88);return{'transcript':_0x4d247a,'confidence':_0x590f88};})[_0x024c('0x59')](function(_0x5ebc80){logger['error']('[%s]\x20%s:%s',_0x5ebc80[_0x024c('0x15')],_0x5ebc80[_0x024c('0x5a')],_0x5ebc80[_0x024c('0x5b')]);});};exports[_0x024c('0x5c')]=function(_0x2fea26,_0x3753f9,_0xf9d32b,_0x4fc82c){var _0x3a0e83=apiai(_0x3753f9,{'language':_0x4fc82c||'en'});return _0x3a0e83[_0x024c('0x5d')](_0xf9d32b,{'sessionId':md5(_0x2fea26)})[_0x024c('0x2e')](function(_0x582f9b){logger[_0x024c('0x1c')](JSON[_0x024c('0x45')](_0x582f9b));return{'source':_0x582f9b[_0x024c('0x5e')]['source'],'resolvedQuery':_0x582f9b[_0x024c('0x5e')]['resolvedQuery'],'action':_0x582f9b[_0x024c('0x5e')][_0x024c('0x5f')],'actionIncomplete':_0x582f9b[_0x024c('0x5e')][_0x024c('0x60')],'speech':_0x582f9b[_0x024c('0x5e')][_0x024c('0x61')]['speech'],'score':_0x582f9b[_0x024c('0x5e')][_0x024c('0x62')],'statusCode':_0x582f9b[_0x024c('0x63')]['code'],'endConversation':_0x582f9b['result'][_0x024c('0x64')][_0x024c('0x65')]||![],'isFallbackIntent':_0x582f9b['result'][_0x024c('0x64')][_0x024c('0x66')]};});};exports[_0x024c('0x67')]=function(_0x256679,_0x10a960,_0x927441,_0x530cb6,_0x26e406,_0x4997c1){var _0x3a8b5a=_0x530cb6[_0x024c('0x68')](/\\n/g,'\x0a');var _0x2db7e={'credentials':{'private_key':_0x3a8b5a,'client_email':_0x927441}};var _0x3f85f2=new dialogflow[(_0x024c('0x69'))](_0x2db7e);var _0x4b5a00=_0x3f85f2[_0x024c('0x6a')](_0x10a960,md5(_0x256679));var _0x14d0d5={'session':_0x4b5a00,'queryInput':{'text':{'text':_0x26e406,'languageCode':_0x4997c1}}};return _0x3f85f2[_0x024c('0x6b')](_0x14d0d5)[_0x024c('0x2e')](function(_0xa11a4){if(_0xa11a4&&_0xa11a4[_0x024c('0x6c')]){logger[_0x024c('0x1c')](_0x024c('0x6d'),JSON['stringify'](_0xa11a4));var _0x3e6d08=_0xa11a4[0x0];if(_0x3e6d08){var _0x1ef812={'action':_0x3e6d08['queryResult'][_0x024c('0x5f')],'allRequiredParamsPresent':_0x3e6d08[_0x024c('0x6e')][_0x024c('0x6f')],'endConversation':_0x3e6d08[_0x024c('0x6e')][_0x024c('0x70')]&&_0x3e6d08['queryResult'][_0x024c('0x70')]['fields']?_0x3e6d08[_0x024c('0x6e')][_0x024c('0x70')][_0x024c('0x71')][_0x024c('0x72')][_0x024c('0x73')]:![],'fulfillmentText':_0x3e6d08[_0x024c('0x6e')]['fulfillmentText'],'intentName':_0x3e6d08[_0x024c('0x6e')][_0x024c('0x74')][_0x024c('0x5a')],'intentDisplayName':_0x3e6d08[_0x024c('0x6e')][_0x024c('0x74')]['displayName'],'isFallbackIntent':_0x3e6d08[_0x024c('0x6e')]['intent'][_0x024c('0x75')],'languageCode':_0x3e6d08[_0x024c('0x6e')][_0x024c('0x76')],'queryText':_0x3e6d08[_0x024c('0x6e')][_0x024c('0x77')],'responseId':_0x3e6d08[_0x024c('0x78')],'score':_0x3e6d08['queryResult'][_0x024c('0x79')],'speech':_0x3e6d08[_0x024c('0x6e')][_0x024c('0x7a')],'providerResponse':JSON[_0x024c('0x45')](_0xa11a4)};return _0x1ef812;}}});};exports[_0x024c('0x7b')]=function(_0xe20c1d,_0x1826b8,_0x52f7c0,_0x5a876d){return tilde[_0x024c('0x50')](_0xe20c1d,_0x1826b8,_0x52f7c0,_0x5a876d)[_0x024c('0x2e')](function(_0x78d2dd){try{fs['unlink'](_0xe20c1d);}catch(_0x285228){logger[_0x024c('0x16')](_0x285228);}logger[_0x024c('0x1c')](_0x024c('0x7c'),_0x78d2dd[_0x024c('0x53')]);logger[_0x024c('0x1c')](_0x024c('0x7d'),_0x78d2dd[_0x024c('0x56')]);return _0x78d2dd;});};exports[_0x024c('0x7e')]=function(_0x5527c4,_0x36581d,_0x4884be,_0x15b379,_0x2edb54,_0x2253e0){var _0x2727f8=path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs[_0x024c('0x2c')](0x4)+_0x024c('0x38'));var _0x3be47f;return aws[_0x024c('0x7f')](_0x5527c4,_0x36581d,_0x4884be,_0x15b379,_0x2edb54,_0x2253e0,_0x2727f8)[_0x024c('0x2e')](function(){_0x3be47f=path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs['generate'](0x4)+'.wav');return convertFile(_0x2727f8,_0x3be47f);})[_0x024c('0x2e')](function(){try{fs[_0x024c('0x1f')](_0x2727f8);fs['chmodSync'](_0x3be47f,'777');}catch(_0x275e63){logger[_0x024c('0x16')](_0x275e63);}return _0x3be47f[_0x024c('0x3f')]('.')[0x0];});};exports[_0x024c('0x80')]=function(_0x47d9df,_0x41f3e8,_0x125e15,_0x234e07,_0x5cdc23,_0x16129b){return aws[_0x024c('0x81')](_0x47d9df,_0x41f3e8,_0x125e15,_0x234e07,_0x5cdc23,_0x16129b)[_0x024c('0x2e')](function(_0x115f4a){logger[_0x024c('0x1c')](JSON['stringify'](_0x115f4a));return _0x115f4a;});};exports['ispeechTTS']=function(_0x229061,_0x4beee1,_0x438327,_0x8827e6){var _0x30db6d=util[_0x024c('0x82')](_0x024c('0x83'),ISPEECH_API,_0x229061,encodeURIComponent(_0x4beee1),_0x438327,_0x8827e6);var _0x4791e0=path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs[_0x024c('0x2c')](0x4)+_0x024c('0x38'));var _0x469d05;return downloadFile(_0x30db6d,_0x4791e0)['then'](function(){_0x469d05=path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs[_0x024c('0x2c')](0x4)+_0x024c('0x4d'));return convertFile(_0x4791e0,_0x469d05);})[_0x024c('0x2e')](function(){try{fs['unlink'](_0x4791e0);fs[_0x024c('0x3d')](_0x469d05,_0x024c('0x3c'));}catch(_0x3d132e){logger[_0x024c('0x16')](_0x3d132e);}return _0x469d05['split']('.')[0x0];});};exports[_0x024c('0x84')]=function(_0x2e9976,_0x171703,_0x5bf562,_0x318aa7){var _0x881c6f=util[_0x024c('0x82')](_0x024c('0x85'),ISPEECH_API,_0x171703,_0x5bf562,base64Encode(_0x2e9976),_0x318aa7?util[_0x024c('0x82')](_0x024c('0x86'),encodeURIComponent(_0x318aa7)):'freeform=3');return uploadFile(_0x881c6f)['then'](function(_0xeb670e){return querystring[_0x024c('0x87')](_0xeb670e);});};exports[_0x024c('0x88')]=function(_0x4b7e9a,_0xea6f60){return sestek[_0x024c('0x89')](_0x4b7e9a,_0xea6f60)[_0x024c('0x2e')](function(_0x13b238){logger[_0x024c('0x1c')](JSON[_0x024c('0x45')](_0x13b238));var _0x236109={'speech':_0x13b238[_0x024c('0x8a')],'action':_0x13b238[_0x024c('0x8b')]?_0x13b238['channelData'][_0x024c('0x8c')]:undefined,'actiondata':_0x13b238['channelData']?_0x13b238['channelData'][_0x024c('0x8d')]:undefined};if(_0x13b238['channelData']&&_0x13b238['channelData']['AudioFromTts']){return base64Decode(_0x13b238['channelData'][_0x024c('0x8e')][_0x024c('0x8f')],path[_0x024c('0x2a')](__dirname,_0x024c('0x2b'),rs['generate'](0x4)+_0x024c('0x4d')))[_0x024c('0x2e')](function(_0x2bc539){_0x236109[_0x024c('0x90')]=_0x2bc539;return _0x236109;});}return _0x236109;});};exports[_0x024c('0x91')]=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 edfaa67..cf213e9 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 _0xed44=['exports','./nda'];(function(_0x554131,_0x4f835a){var _0x287224=function(_0x15456c){while(--_0x15456c){_0x554131['push'](_0x554131['shift']());}};_0x287224(++_0x4f835a);}(_0xed44,0x105));var _0x4ed4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xed44[_0x321bb2];return _0x9c12ed;};var nda=require(_0x4ed4('0x0'));module[_0x4ed4('0x1')]={'nda':nda}; \ No newline at end of file +var _0x47e0=['exports','./nda'];(function(_0x16972f,_0x24951d){var _0x3e2509=function(_0x52339a){while(--_0x52339a){_0x16972f['push'](_0x16972f['shift']());}};_0x3e2509(++_0x24951d);}(_0x47e0,0x131));var _0x047e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x47e0[_0x321bb2];return _0x9c12ed;};var nda=require(_0x047e('0x0'));module[_0x047e('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 eabc786..03174df 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 _0xcb18=['resolve','ndauth_url','/token','username','password','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomActionData','custom_action_data','info','../../../../../config/logger','exports','POST'];(function(_0x1e3aac,_0x5118ba){var _0x4e72d0=function(_0x15648c){while(--_0x15648c){_0x1e3aac['push'](_0x1e3aac['shift']());}};_0x4e72d0(++_0x5118ba);}(_0xcb18,0x159));var _0x8cb1=function(_0x3ace42,_0xbe496f){_0x3ace42=_0x3ace42-0x0;var _0x20eed8=_0xcb18[_0x3ace42];return _0x20eed8;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x8cb1('0x0'))('agi');module[_0x8cb1('0x1')]=function(_0x50513d,_0x5e800d){var _0x39e801={'method':_0x8cb1('0x2'),'uri':url[_0x8cb1('0x3')](_0x5e800d[_0x8cb1('0x4')],_0x8cb1('0x5')),'form':{'grant_type':'password','username':_0x5e800d[_0x8cb1('0x6')],'password':_0x5e800d[_0x8cb1('0x7')]},'json':!![]};return rp(_0x39e801)['then'](function(_0x186f71){var _0x510e92={'method':_0x8cb1('0x2'),'uri':url[_0x8cb1('0x3')](_0x5e800d['ndassistant_url'],_0x8cb1('0x8')),'body':{'type':_0x5e800d[_0x8cb1('0x9')]||_0x8cb1('0xa'),'channelId':_0x8cb1('0xb'),'conversation':{'id':_0x50513d[_0x8cb1('0xc')]},'from':{'id':_0x50513d['callerid'],'name':_0x50513d[_0x8cb1('0xd')]},'recipient':{'id':_0x50513d[_0x8cb1('0xe')],'name':_0x50513d[_0x8cb1('0xf')]},'text':_0x5e800d['text'],'channelData':{}},'headers':{'Authorization':_0x8cb1('0x10')+_0x186f71[_0x8cb1('0x11')]},'json':!![]};if(_0x5e800d[_0x8cb1('0x12')]){_0x510e92[_0x8cb1('0x13')][_0x8cb1('0x14')][_0x8cb1('0x15')]=_0x5e800d['project'];}if(_0x5e800d[_0x8cb1('0x16')]=='1'){_0x510e92['body'][_0x8cb1('0x14')][_0x8cb1('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8cb1('0x18')};}if(_0x5e800d[_0x8cb1('0x19')]){_0x510e92[_0x8cb1('0x13')][_0x8cb1('0x14')]['CustomAction']=_0x5e800d[_0x8cb1('0x19')];if(_0x5e800d['custom_action_data']){_0x510e92['body']['channelData'][_0x8cb1('0x1a')]=_0x5e800d[_0x8cb1('0x1b')];}}logger[_0x8cb1('0x1c')](JSON['stringify'](_0x510e92));return rp(_0x510e92);});}; \ No newline at end of file +var _0x3402=['request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','text','access_token','body','channelData','ProjectName','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0x3402,0x1f0));var _0x2340=function(_0x38f337,_0x5ce560){_0x38f337=_0x38f337-0x0;var _0x30675e=_0x3402[_0x38f337];return _0x30675e;};'use strict';var rp=require(_0x2340('0x0'));var url=require('url');var logger=require(_0x2340('0x1'))(_0x2340('0x2'));module[_0x2340('0x3')]=function(_0x5eeb10,_0x5dce8b){var _0x277b67={'method':_0x2340('0x4'),'uri':url[_0x2340('0x5')](_0x5dce8b[_0x2340('0x6')],_0x2340('0x7')),'form':{'grant_type':'password','username':_0x5dce8b['username'],'password':_0x5dce8b[_0x2340('0x8')]},'json':!![]};return rp(_0x277b67)[_0x2340('0x9')](function(_0x16174f){var _0x225250={'method':_0x2340('0x4'),'uri':url['resolve'](_0x5dce8b[_0x2340('0xa')],_0x2340('0xb')),'body':{'type':_0x5dce8b[_0x2340('0xc')]||_0x2340('0xd'),'channelId':_0x2340('0xe'),'conversation':{'id':_0x5eeb10['uniqueid']},'from':{'id':_0x5eeb10[_0x2340('0xf')],'name':_0x5eeb10[_0x2340('0x10')]},'recipient':{'id':_0x5eeb10['dnid'],'name':_0x5eeb10['extension']},'text':_0x5dce8b[_0x2340('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x16174f[_0x2340('0x12')]},'json':!![]};if(_0x5dce8b['project']){_0x225250[_0x2340('0x13')][_0x2340('0x14')][_0x2340('0x15')]=_0x5dce8b[_0x2340('0x16')];}if(_0x5dce8b[_0x2340('0x17')]=='1'){_0x225250[_0x2340('0x13')][_0x2340('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2340('0x18')};}if(_0x5dce8b[_0x2340('0x19')]){_0x225250[_0x2340('0x13')]['channelData'][_0x2340('0x1a')]=_0x5dce8b[_0x2340('0x19')];if(_0x5dce8b[_0x2340('0x1b')]){_0x225250[_0x2340('0x13')]['channelData'][_0x2340('0x1c')]=_0x5dce8b[_0x2340('0x1b')];}}logger[_0x2340('0x1d')](JSON[_0x2340('0x1e')](_0x225250));return rp(_0x225250);});}; \ 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 216b9c5..0c2e6dc 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 _0x1c63=['./lib/api','exports'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x1c63,0x94));var _0x31c6=function(_0x1f0d60,_0x58a2c2){_0x1f0d60=_0x1f0d60-0x0;var _0x148a20=_0x1c63[_0x1f0d60];return _0x148a20;};'use strict';var asr=require(_0x31c6('0x0'));module[_0x31c6('0x1')]=function(_0x4d6932,_0x53df8d,_0x5785c5,_0x4c159c){return asr(_0x4d6932,_0x53df8d,_0x5785c5,_0x4c159c);}; \ No newline at end of file +var _0xaa6f=['./lib/api','exports'];(function(_0x3dbbfc,_0x6669e){var _0x1f1734=function(_0x211d9c){while(--_0x211d9c){_0x3dbbfc['push'](_0x3dbbfc['shift']());}};_0x1f1734(++_0x6669e);}(_0xaa6f,0x6a));var _0xfaa6=function(_0x3519b9,_0x8ad5fb){_0x3519b9=_0x3519b9-0x0;var _0x3f2f2a=_0xaa6f[_0x3519b9];return _0x3f2f2a;};'use strict';var asr=require(_0xfaa6('0x0'));module[_0xfaa6('0x1')]=function(_0x5abea7,_0x29c5e5,_0x43ccbb,_0x135985){return asr(_0x5abea7,_0x29c5e5,_0x43ccbb,_0x135985);}; \ 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 a5a1577..a9a36ef 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 _0x48c9=['message','lodash','moment','crypto','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open'];(function(_0x126157,_0xb85d75){var _0x8c89db=function(_0x1d6e53){while(--_0x1d6e53){_0x126157['push'](_0x126157['shift']());}};_0x8c89db(++_0xb85d75);}(_0x48c9,0x112));var _0x948c=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0x48c9[_0x3efe9b];return _0x132073;};'use strict';var BPromise=require('bluebird');var _=require(_0x948c('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x948c('0x1'));var crypto=require(_0x948c('0x2'));var logger=require(_0x948c('0x3'))(_0x948c('0x4'));module['exports']=function(_0x4d471e,_0x1989b3,_0x50f46f,_0x36e163){return new BPromise(function(_0x277b5b,_0x2b59d1){logger[_0x948c('0x5')]('Tilde\x20URI',_0x36e163||_0x948c('0x6'));var _0x420103=new WebSocket(_0x36e163||_0x948c('0x6'),{'perMessageDeflate':![]});var _0x3a01b1='';var _0x2f5443='0';var _0x59776a='1';var _0x139d99='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x24f174(_0x49b5c4){var _0x5b0a93=crypto[_0x948c('0x7')](_0x948c('0x8'));_0x5b0a93[_0x948c('0x9')](_0x49b5c4);return _0x5b0a93['digest']('hex');}function _0x3191b6(){try{logger[_0x948c('0x5')](_0x948c('0xa'));var _0x6c7ab1=moment()[_0x948c('0xb')]();var _0x48e9a9=_0x24f174(_0x6c7ab1+_0x1989b3+_0x50f46f);_0x420103[_0x948c('0xc')](JSON[_0x948c('0xd')]({'appID':_0x1989b3,'timestamp':_0x6c7ab1,'appKey':_0x48e9a9}));var _0x16ce68=fs[_0x948c('0xe')](_0x4d471e);_0x16ce68['on']('data',function(_0x50415e){_0x420103[_0x948c('0xc')](_0x50415e);});_0x16ce68['on'](_0x948c('0xf'),function(){_0x420103[_0x948c('0xc')]('EOS');});}catch(_0xed36eb){logger[_0x948c('0x10')](_0x948c('0x11'),JSON[_0x948c('0xd')](_0xed36eb));_0x420103[_0x948c('0x12')]();}}function _0x332b4b(_0x1379fa){try{if(_0x1379fa){var _0x20258e=JSON[_0x948c('0x13')](_0x1379fa);switch(_0x20258e['status']){case 0x0:if(_0x20258e[_0x948c('0x14')]){if(_0x20258e[_0x948c('0x14')][_0x948c('0x15')]){logger[_0x948c('0x5')](_0x948c('0x16'),JSON[_0x948c('0xd')](_0x20258e['result'][_0x948c('0x17')]));_0x3a01b1=_0x20258e[_0x948c('0x14')][_0x948c('0x17')][0x0][_0x948c('0x18')];_0x2f5443=_0x20258e[_0x948c('0x14')][_0x948c('0x17')][0x0][_0x948c('0x19')];_0x59776a='0';_0x139d99=_0x948c('0x1a');_0x420103[_0x948c('0x12')]();}}break;case 0x1:logger[_0x948c('0x5')](_0x948c('0x1b'));_0x59776a='1';_0x139d99=_0x948c('0x1b');break;case 0x2:logger[_0x948c('0x5')](_0x948c('0x1c'));_0x59776a='2';_0x139d99=_0x948c('0x1c');break;case 0x9:logger[_0x948c('0x5')](_0x948c('0x1d'));_0x59776a='9';_0x139d99=_0x948c('0x1d');break;case 0xa:logger['info']('Authentication\x20failed.');_0x59776a='10';_0x139d99=_0x948c('0x1e');break;case 0xb:logger[_0x948c('0x5')](_0x948c('0x1f'));_0x59776a='11';_0x139d99='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x35f17e){logger[_0x948c('0x10')](_0x948c('0x20'),JSON[_0x948c('0xd')](_0x35f17e));_0x420103[_0x948c('0x12')]();}}function _0x307812(){logger[_0x948c('0x5')](_0x948c('0x21'));_0x277b5b({'transcript':_0x3a01b1,'confidence':_0x2f5443,'status':_0x59776a,'status_message':_0x139d99});}function _0x2e2211(_0x1b1d98){logger[_0x948c('0x10')](_0x948c('0x22'));if(!_[_0x948c('0x23')](_0x1b1d98)){logger[_0x948c('0x10')](_[_0x948c('0x24')](_0x1b1d98)?JSON[_0x948c('0xd')](_0x1b1d98):_0x1b1d98);}}_0x420103['on'](_0x948c('0x25'),_0x3191b6);_0x420103['on'](_0x948c('0x26'),_0x332b4b);_0x420103['on'](_0x948c('0xf'),_0x307812);_0x420103['on']('error',_0x2e2211);});}; \ No newline at end of file +var _0x27b4=['message','bluebird','moment','crypto','../../../../../../config/logger','agi','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','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x27b4,0xbf));var _0x427b=function(_0x17c67c,_0xd2afec){_0x17c67c=_0x17c67c-0x0;var _0x550479=_0x27b4[_0x17c67c];return _0x550479;};'use strict';var BPromise=require(_0x427b('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x427b('0x1'));var crypto=require(_0x427b('0x2'));var logger=require(_0x427b('0x3'))(_0x427b('0x4'));module['exports']=function(_0x1b44b7,_0x116c4e,_0x24df3e,_0xb7924c){return new BPromise(function(_0x3de49e,_0x483d46){logger[_0x427b('0x5')](_0x427b('0x6'),_0xb7924c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x23738d=new WebSocket(_0xb7924c||_0x427b('0x7'),{'perMessageDeflate':![]});var _0x32884f='';var _0x340dcb='0';var _0xc89ebe='1';var _0x351ec7=_0x427b('0x8');function _0x4c9092(_0x2c3f5d){var _0x4ce70f=crypto[_0x427b('0x9')]('sha1');_0x4ce70f[_0x427b('0xa')](_0x2c3f5d);return _0x4ce70f['digest'](_0x427b('0xb'));}function _0x4c203e(){try{logger['info'](_0x427b('0xc'));var _0x1d58ac=moment()[_0x427b('0xd')]();var _0x4a1e1b=_0x4c9092(_0x1d58ac+_0x116c4e+_0x24df3e);_0x23738d[_0x427b('0xe')](JSON['stringify']({'appID':_0x116c4e,'timestamp':_0x1d58ac,'appKey':_0x4a1e1b}));var _0x2dee7d=fs['createReadStream'](_0x1b44b7);_0x2dee7d['on'](_0x427b('0xf'),function(_0x5de00f){_0x23738d['send'](_0x5de00f);});_0x2dee7d['on'](_0x427b('0x10'),function(){_0x23738d[_0x427b('0xe')](_0x427b('0x11'));});}catch(_0x4720e1){logger[_0x427b('0x12')](_0x427b('0x13'),JSON[_0x427b('0x14')](_0x4720e1));_0x23738d[_0x427b('0x15')]();}}function _0x52cfb3(_0x5419d8){try{if(_0x5419d8){var _0x3592fa=JSON[_0x427b('0x16')](_0x5419d8);switch(_0x3592fa[_0x427b('0x17')]){case 0x0:if(_0x3592fa[_0x427b('0x18')]){if(_0x3592fa[_0x427b('0x18')]['final']){logger[_0x427b('0x5')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x3592fa[_0x427b('0x18')][_0x427b('0x19')]));_0x32884f=_0x3592fa[_0x427b('0x18')][_0x427b('0x19')][0x0][_0x427b('0x1a')];_0x340dcb=_0x3592fa[_0x427b('0x18')][_0x427b('0x19')][0x0][_0x427b('0x1b')];_0xc89ebe='0';_0x351ec7=_0x427b('0x1c');_0x23738d['terminate']();}}break;case 0x1:logger['info'](_0x427b('0x8'));_0xc89ebe='1';_0x351ec7='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x427b('0x5')](_0x427b('0x1d'));_0xc89ebe='2';_0x351ec7=_0x427b('0x1d');break;case 0x9:logger['info'](_0x427b('0x1e'));_0xc89ebe='9';_0x351ec7=_0x427b('0x1e');break;case 0xa:logger[_0x427b('0x5')](_0x427b('0x1f'));_0xc89ebe='10';_0x351ec7=_0x427b('0x1f');break;case 0xb:logger[_0x427b('0x5')](_0x427b('0x20'));_0xc89ebe='11';_0x351ec7=_0x427b('0x20');}}}catch(_0x217c08){logger[_0x427b('0x12')](_0x427b('0x21'),JSON[_0x427b('0x14')](_0x217c08));_0x23738d['terminate']();}}function _0x366395(){logger[_0x427b('0x5')](_0x427b('0x22'));_0x3de49e({'transcript':_0x32884f,'confidence':_0x340dcb,'status':_0xc89ebe,'status_message':_0x351ec7});}function _0x3b5d0a(_0x5c5efc){logger[_0x427b('0x12')](_0x427b('0x23'));if(!_['isNil'](_0x5c5efc)){logger[_0x427b('0x12')](_[_0x427b('0x24')](_0x5c5efc)?JSON['stringify'](_0x5c5efc):_0x5c5efc);}}_0x23738d['on']('open',_0x4c203e);_0x23738d['on'](_0x427b('0x25'),_0x52cfb3);_0x23738d['on']('close',_0x366395);_0x23738d['on'](_0x427b('0x12'),_0x3b5d0a);});}; \ 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 bc97ac9..cc9b333 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 _0x6520=['exports','./asr'];(function(_0x48fcff,_0x49665e){var _0x2e8198=function(_0x20a9f0){while(--_0x20a9f0){_0x48fcff['push'](_0x48fcff['shift']());}};_0x2e8198(++_0x49665e);}(_0x6520,0x181));var _0x0652=function(_0x2deee6,_0x507658){_0x2deee6=_0x2deee6-0x0;var _0x22c3aa=_0x6520[_0x2deee6];return _0x22c3aa;};var asr=require(_0x0652('0x0'));module[_0x0652('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1ea6=['exports','./asr'];(function(_0x1d9d77,_0x1b137a){var _0x303531=function(_0x4636c4){while(--_0x4636c4){_0x1d9d77['push'](_0x1d9d77['shift']());}};_0x303531(++_0x1b137a);}(_0x1ea6,0x83));var _0x61ea=function(_0x30fc1b,_0x2cc105){_0x30fc1b=_0x30fc1b-0x0;var _0x3bb05c=_0x1ea6[_0x30fc1b];return _0x3bb05c;};var asr=require(_0x61ea('0x0'));module[_0x61ea('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index cbc1a72..d00b8eb 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xe706,0xa3));var _0x6e70=function(_0x311fc0,_0x2c64f0){_0x311fc0=_0x311fc0-0x0;var _0xce2976=_0xe706[_0x311fc0];return _0xce2976;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index abb30df..575bf5d 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 _0x0b78=['getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','interval','map','Intervals','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','close','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','calleridname','context','extension','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','shellCommand','exec','trim','googleCloudTTS','apiKey','text','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','toUpperCase','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','maxRetry','retry','mrcpsynth','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','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','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','Smtp','user','bcc','subject','template_id','debug','smtpOptions','sendFax','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','answer','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','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','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','randomstring','mustache','../../config/logger','agi','../../config/environment','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunk'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var util=require(_0x80b7('0x0'));var _=require(_0x80b7('0x1'));var sh=require('shelljs');var odbc=require(_0x80b7('0x2'))();var rs=require(_0x80b7('0x3'));var moment=require('moment');var Mustache=require(_0x80b7('0x4'));var rp=require('request-promise');var logger=require(_0x80b7('0x5'))(_0x80b7('0x6'));var config=require(_0x80b7('0x7'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x80b7('0x8'),'rawBody'];var verticesWithRetry=[_0x80b7('0x9'),_0x80b7('0xa'),_0x80b7('0xb')];var AGIVertices=function(_0x445c23,_0x5b8fe9,_0x74b4a8){this[_0x80b7('0xc')]=_0x445c23;this[_0x80b7('0xd')]=_0x5b8fe9;this['mailRpc']=_0x74b4a8;};AGIVertices[_0x80b7('0xe')]['getVariable']=function(_0x2b1a00,_0x4599c1){this[_0x80b7('0xd')][_0x80b7('0xf')](_0x2b1a00)[_0x80b7('0x10')](function(_0x2d61d4){_0x4599c1(null,_0x2d61d4?_0x2d61d4[_0x80b7('0x11')]:![]);})[_0x80b7('0x12')](function(_0x323d06){_0x4599c1(_0x323d06);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x13')]=function(_0x519401,_0x2c2668){this[_0x80b7('0xd')]['getVoiceQueueById'](_0x519401)[_0x80b7('0x10')](function(_0x1a6317){_0x2c2668(null,_0x1a6317?_0x1a6317['name']:![]);})[_0x80b7('0x12')](function(_0x3b6b13){_0x2c2668(_0x3b6b13);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x14')]=function(_0x36d0bb,_0x352805){this[_0x80b7('0xd')][_0x80b7('0x15')](_0x36d0bb)[_0x80b7('0x10')](function(_0x34299c){_0x352805(null,_0x34299c?_0x34299c['name']:![]);})[_0x80b7('0x12')](function(_0x1d62ed){_0x352805(_0x1d62ed);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x16')]=function(_0x58dbda,_0x48c356){this[_0x80b7('0xd')][_0x80b7('0x17')](_0x58dbda)[_0x80b7('0x10')](function(_0xd51ad9){_0x48c356(null,_0xd51ad9?_0xd51ad9['dsn']:![]);})['catch'](function(_0x2aebe3){_0x48c356(_0x2aebe3);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x18')]=function(_0x3ad8c1,_0x527d0f){this[_0x80b7('0xd')]['getUserById'](_0x3ad8c1)['then'](function(_0x37dd00){_0x527d0f(null,_0x37dd00?_0x37dd00[_0x80b7('0x11')]:![]);})[_0x80b7('0x12')](function(_0x155c00){_0x527d0f(_0x155c00);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x19')]=function(_0x29a4e6,_0x8fa95e){this[_0x80b7('0xd')][_0x80b7('0x1a')](_0x29a4e6)[_0x80b7('0x10')](function(_0x311aa3){_0x8fa95e(null,_0x311aa3?_0x311aa3[_0x80b7('0x11')]:![]);})[_0x80b7('0x12')](function(_0x3995b5){_0x8fa95e(_0x3995b5);});};AGIVertices['prototype'][_0x80b7('0x1b')]=function(_0x1661be,_0x5e3f6f){var _0x370bfb=this;this[_0x80b7('0xd')][_0x80b7('0x1c')](_0x1661be)['then'](function(_0x1b7715){_0x5e3f6f(null,_0x1b7715?_0x370bfb[_0x80b7('0x1d')](_0x1b7715[_0x80b7('0x1e')]):![]);})[_0x80b7('0x12')](function(_0x1c4607){_0x5e3f6f(_0x1c4607);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x1f')]=function(_0x44f03e,_0x3fbdf3){this[_0x80b7('0xd')][_0x80b7('0x20')](_0x44f03e)[_0x80b7('0x10')](function(_0xf35e83){_0x3fbdf3(null,_0xf35e83?_0xf35e83:![]);})['catch'](function(_0x5a65b0){_0x3fbdf3(_0x5a65b0);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x21')]=function(_0x4fa26a,_0x4e8557,_0x106921){this[_0x80b7('0x22')][_0x80b7('0x21')](_0x4fa26a,_0x4e8557)[_0x80b7('0x10')](function(){_0x106921(null);})[_0x80b7('0x12')](function(_0x2339cf){_0x106921(_0x2339cf);});};AGIVertices['prototype'][_0x80b7('0x23')]=function(_0x1f9041,_0x6e7535){this[_0x80b7('0xd')]['getIntervalById'](_0x1f9041)[_0x80b7('0x10')](function(_0x25335e){if(_0x25335e){if(_0x25335e['IntervalId']){_0x6e7535(null,[_0x25335e[_0x80b7('0x24')]]);}else{_0x6e7535(null,_[_0x80b7('0x25')](_0x25335e[_0x80b7('0x26')],_0x80b7('0x24')));}}else{_0x6e7535(null,![]);}})[_0x80b7('0x12')](function(_0xfbd58e){_0x6e7535(_0xfbd58e);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x1d')]=function(_0x4c7084){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x4c7084);};AGIVertices[_0x80b7('0xe')][_0x80b7('0x27')]=function(_0x6f55,_0x28cc08,_0x462eb0){odbc[_0x80b7('0x28')](_0x6f55,function(_0x1c2341){if(_0x1c2341){logger[_0x80b7('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1c2341);_0x462eb0(_0x1c2341);}else{logger[_0x80b7('0x2a')](_0x80b7('0x2b'));odbc[_0x80b7('0x2c')](_0x28cc08,function(_0x44acf2,_0x44cfcd){if(_0x44acf2){logger[_0x80b7('0x2a')]('Error\x20executing\x20query\x20%s',_0x28cc08);_0x462eb0(_0x44acf2);}else{logger[_0x80b7('0x2a')]('Query\x20executed\x20correctly\x20%s',_0x28cc08);odbc[_0x80b7('0x2d')](function(_0x1a6e69){if(_0x1a6e69){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1a6e69);}_0x462eb0(null,_0x44cfcd);});}});}});};AGIVertices[_0x80b7('0xe')]['getSmsAccount']=function(_0x5c91d8,_0x295ca6){this[_0x80b7('0xd')]['getSmsAccountById'](_0x5c91d8)[_0x80b7('0x10')](function(_0x196f48){_0x295ca6(null,_0x196f48?_0x196f48:![]);})['catch'](function(_0x59e0c4){_0x295ca6(_0x59e0c4);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x2e')]=function(_0x3b89b4,_0x29170c){this[_0x80b7('0xd')][_0x80b7('0x2e')](_0x3b89b4)['then'](function(_0x1c28d2){_0x29170c(null,_0x1c28d2);})[_0x80b7('0x12')](function(_0x2cb860){_0x29170c(_0x2cb860);});};AGIVertices[_0x80b7('0xe')]['createSquareDetailsReport']=function(_0x20a9b9,_0x5741ec,_0x382fd7){this[_0x80b7('0xd')][_0x80b7('0x2f')]({'uniqueid':this[_0x80b7('0xc')][_0x80b7('0x30')],'node':_0x20a9b9[_0x80b7('0x31')],'application':_0x20a9b9[_0x80b7('0x32')],'data':_0x5741ec||null,'project_name':this[_0x80b7('0xc')][_0x80b7('0x33')],'callerid':this[_0x80b7('0xc')][_0x80b7('0x34')]})[_0x80b7('0x10')](function(_0x1384b7){if(_0x382fd7){_0x382fd7(null,_0x1384b7);}})['catch'](function(_0x311142){if(_0x382fd7){_0x382fd7(_0x311142);}});};AGIVertices[_0x80b7('0xe')]['createSquareRecording']=function(_0x435022,_0x5ac956,_0x4ef52d,_0x4418c3){this['rpc']['createSquareRecording']({'uniqueid':this[_0x80b7('0xc')][_0x80b7('0x30')],'callerid':this['channel'][_0x80b7('0x34')],'calleridname':this[_0x80b7('0xc')][_0x80b7('0x35')],'context':this['channel'][_0x80b7('0x36')],'extension':this[_0x80b7('0xc')][_0x80b7('0x37')],'priority':this[_0x80b7('0xc')]['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0x80b7('0xc')][_0x80b7('0x38')],'projectName':this[_0x80b7('0xc')][_0x80b7('0x33')],'saveName':_0x5ac956,'filename':_0x435022[_0x80b7('0x39')]||_0x5ac956,'savePath':_0x4ef52d})[_0x80b7('0x10')](function(_0x398925){_0x4418c3(null,_0x398925);})[_0x80b7('0x12')](function(_0x4a6cb5){_0x4418c3(_0x4a6cb5);});};AGIVertices['prototype'][_0x80b7('0x3a')]=function(_0x13ebaa,_0x3d01c6,_0x2d9168,_0x1fff8c,_0x2da4a1){this['rpc'][_0x80b7('0x3a')]({'uniqueid':this[_0x80b7('0xc')]['uniqueid'],'body':_0x13ebaa,'direction':_0x3d01c6,'providerName':_0x2d9168,'providerResponse':_0x1fff8c})[_0x80b7('0x10')](function(_0x40b524){if(_0x2da4a1){_0x2da4a1(null,_0x40b524);}})[_0x80b7('0x12')](function(_0x49ada9){if(_0x2da4a1){_0x2da4a1(_0x49ada9);}});};AGIVertices['prototype'][_0x80b7('0x3b')]=function(_0x66202,_0xbc9686){this[_0x80b7('0xd')][_0x80b7('0x3b')]({'firstName':_[_0x80b7('0x3c')](_0x66202['name'])||_[_0x80b7('0x3d')](_0x66202[_0x80b7('0x11')])?_0x80b7('0x3e')+Math[_0x80b7('0x3f')]():_0x66202[_0x80b7('0x11')],'lastName':_['isEmpty'](_0x66202['lastName'])||_[_0x80b7('0x3d')](_0x66202[_0x80b7('0x40')])?null:_0x66202[_0x80b7('0x40')],'phone':_0x66202['phone'],'ListId':_0x66202[_0x80b7('0x41')],'scheduledat':_0x66202['scheduledAt'],'callbackUniqueid':this[_0x80b7('0xc')][_0x80b7('0x30')],'tags':_0x80b7('0x42'),'description':_0x80b7('0x43')+_0x66202[_0x80b7('0x44')][_0x80b7('0x45')](),'priority':_0x66202[_0x80b7('0x46')]})[_0x80b7('0x10')](function(_0x43ea4f){_0xbc9686(null,_0x43ea4f);})[_0x80b7('0x12')](function(_0x1c408c){_0xbc9686(_0x1c408c);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x47')]=function(_0x10aebd,_0x5215f1){this[_0x80b7('0xd')][_0x80b7('0x48')](_0x10aebd)[_0x80b7('0x10')](function(_0x41c23c){_0x5215f1(null,_0x41c23c?_0x41c23c[_0x80b7('0x11')]:![]);})[_0x80b7('0x12')](function(_0x197c00){_0x5215f1(_0x197c00);});};AGIVertices['prototype'][_0x80b7('0x49')]=function(_0x23f06f,_0xc4b38,_0x251b87){var _0x48c39f={'role':_0x80b7('0x4a')};_0x48c39f[_0x23f06f]=this[_0x80b7('0xc')]['callerid'];this[_0x80b7('0xd')][_0x80b7('0x49')](_0x48c39f,_0xc4b38,this['channel'][_0x80b7('0x30')])[_0x80b7('0x10')](function(_0x56fd5e){_0x251b87(null,_['isNil'](_0x56fd5e)?![]:!![]);})[_0x80b7('0x12')](function(_0x5e256b){logger[_0x80b7('0x29')](_0x5e256b);_0x251b87(null,![]);});};AGIVertices[_0x80b7('0xe')]['agentUnpause']=function(_0x1ec5ee,_0x151939){var _0x4e3851={'role':_0x80b7('0x4a')};_0x4e3851[_0x1ec5ee]=this[_0x80b7('0xc')][_0x80b7('0x34')];this[_0x80b7('0xd')][_0x80b7('0x4b')](_0x4e3851)[_0x80b7('0x10')](function(_0x222466){_0x151939(null,_[_0x80b7('0x3d')](_0x222466)?![]:!![]);})[_0x80b7('0x12')](function(_0x5f255e){logger['error'](_0x5f255e);_0x151939(null,![]);});};AGIVertices[_0x80b7('0xe')]['agentLogout']=function(_0x24f889,_0x21d013){var _0x25fc84={'role':'agent'};_0x25fc84[_0x24f889]=this[_0x80b7('0xc')][_0x80b7('0x34')];this['rpc'][_0x80b7('0x4c')](_0x25fc84)[_0x80b7('0x10')](function(_0x4370b8){_0x21d013(null,_[_0x80b7('0x3d')](_0x4370b8)?![]:!![]);})['catch'](function(_0x5818f2){logger[_0x80b7('0x29')](_0x5818f2);_0x21d013(null,![]);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x4d')]=function(_0x54ec05,_0x502757){var _0x38867e={'role':_0x80b7('0x4a')};_0x38867e[_0x54ec05]=this[_0x80b7('0xc')]['callerid'];var _0x33b76f=_0x54ec05!=_0x80b7('0x4e')?util[_0x80b7('0x4f')](_0x80b7('0x50'),'LOCAL',this['channel'][_0x80b7('0x34')]):undefined;this[_0x80b7('0xd')]['agentLogin'](_0x38867e,_0x33b76f)['then'](function(_0x50a69b){_0x502757(null,_['isNil'](_0x50a69b)?![]:!![]);})[_0x80b7('0x12')](function(_0x500401){logger['error'](_0x500401);_0x502757(null,![]);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x51')]=function(_0x2ace46,_0x1fe9e6){sh[_0x80b7('0x52')](_[_0x80b7('0x53')](_0x2ace46),function(_0x328854,_0x28647a){var _0x3e5149=_0x28647a['replace'](/(\r\n|\n|\r)/gm,'');_0x1fe9e6(null,_0x3e5149);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x3fe3c3,_0x2dd01c){scripts[_0x80b7('0x54')](_0x3fe3c3[_0x80b7('0x55')],_0x3fe3c3['google_cloud_tts_text_type']||_0x80b7('0x56'),_0x3fe3c3[_0x80b7('0x56')],_0x3fe3c3['languageCode']||'en-US',_0x3fe3c3['ssmlGender']||_0x80b7('0x57'),_0x3fe3c3[_0x80b7('0x58')]||'MP3')[_0x80b7('0x10')](function(_0x4bf950){_0x2dd01c(null,_0x4bf950);})['catch'](function(_0x4d378a){_0x2dd01c(_0x4d378a);});};AGIVertices['prototype']['googleTTS']=function(_0x4b5e01,_0x5e8526){scripts[_0x80b7('0x59')](_0x4b5e01['text'],_0x4b5e01[_0x80b7('0x5a')]||'en',0x1)['then'](function(_0x2fd411){_0x5e8526(null,_0x2fd411);})[_0x80b7('0x12')](function(_0x2a6c1b){_0x5e8526(_0x2a6c1b);});};AGIVertices['prototype'][_0x80b7('0x5b')]=function(_0x37e1c8,_0x482cfc){var _0x190c5a={'uri':_0x37e1c8[_0x80b7('0x5c')],'method':_0x37e1c8['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x37e1c8[_0x80b7('0x5d')])===_0x80b7('0x5e')&&parseInt(_0x37e1c8[_0x80b7('0x5d')])>=0x1?parseInt(_0x37e1c8['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x80b7('0x5f')](['POST','PUT'],_0x190c5a['method'][_0x80b7('0x60')]())){try{_0x190c5a['body']=_0x37e1c8['rawBody']?JSON[_0x80b7('0x61')](_0x37e1c8[_0x80b7('0x62')]):{};}catch(_0x104afb){logger[_0x80b7('0x29')](_0x80b7('0x63'),_0x104afb);}}try{_0x190c5a[_0x80b7('0x64')]=_0x37e1c8[_0x80b7('0x8')]?JSON[_0x80b7('0x61')](_0x37e1c8[_0x80b7('0x8')]):{};}catch(_0x23df14){logger[_0x80b7('0x29')](_0x80b7('0x65'),_0x23df14);}if(_0x37e1c8['computedVariables']){try{var _0x270ea6=require(_0x37e1c8[_0x80b7('0x66')])[_0x80b7('0x67')](this,_0x190c5a);_0x190c5a['uri']=Mustache[_0x80b7('0x68')](_0x37e1c8[_0x80b7('0x5c')],_0x270ea6,{},['$$','$$']);if(_0x190c5a[_0x80b7('0x64')]){_0x190c5a[_0x80b7('0x64')]=JSON[_0x80b7('0x61')](Mustache[_0x80b7('0x68')](JSON[_0x80b7('0x69')](_0x190c5a[_0x80b7('0x64')]),_0x270ea6,{},['$$','$$']));}if(_0x190c5a['body']){_0x190c5a[_0x80b7('0x6a')]=JSON[_0x80b7('0x61')](Mustache[_0x80b7('0x68')](JSON['stringify'](_0x190c5a['body']),_0x270ea6,{},['$$','$$']));}}catch(_0xb22b8b){logger[_0x80b7('0x29')](_0x80b7('0x6b'),_0xb22b8b);}}rp(_0x190c5a)[_0x80b7('0x10')](function(_0x56d823){var _0x400bd0={'statusCode':_0x56d823[_0x80b7('0x6c')]||0xc8,'statusMessage':_0x56d823[_0x80b7('0x6d')]||'OK','headers':_0x56d823[_0x80b7('0x64')]||{},'body':_0x56d823['body']||{}};_0x482cfc(null,_0x400bd0);})[_0x80b7('0x12')](function(_0xa4a6e){var _0x55d727={'statusCode':_0xa4a6e['statusCode']||0x1f4,'statusMessage':_0xa4a6e[_0x80b7('0x6e')]||_0x80b7('0x6f'),'headers':_0xa4a6e[_0x80b7('0x70')][_0x80b7('0x64')]||{},'body':_0xa4a6e[_0x80b7('0x70')][_0x80b7('0x6a')]||{}};_0x482cfc(null,_0x55d727);});};AGIVertices['prototype'][_0x80b7('0x71')]=function(_0x13524c,_0x29aade){scripts['googleDialogflow'](this[_0x80b7('0xc')][_0x80b7('0x30')],_0x13524c[_0x80b7('0x72')],_0x13524c[_0x80b7('0x56')],_0x13524c[_0x80b7('0x73')]||'en')['then'](function(_0x133ce6){_0x29aade(null,_0x133ce6);})[_0x80b7('0x12')](function(_0x50b229){_0x29aade(_0x50b229);});};AGIVertices[_0x80b7('0xe')]['googleDialogflowV2']=function(_0x2fc6e8,_0x58d164){scripts[_0x80b7('0x74')](this[_0x80b7('0xc')]['uniqueid'],_0x2fc6e8[_0x80b7('0x75')],_0x2fc6e8[_0x80b7('0x76')],_0x2fc6e8[_0x80b7('0x77')],_0x2fc6e8[_0x80b7('0x56')],_0x2fc6e8[_0x80b7('0x78')]||'en')['then'](function(_0x57965f){_0x58d164(null,_0x57965f);})['catch'](function(_0x13bb33){_0x58d164(_0x13bb33);});};AGIVertices[_0x80b7('0xe')]['sestekNDA']=function(_0x5de47f,_0x186d10){scripts[_0x80b7('0x79')](this[_0x80b7('0xc')],_0x5de47f)[_0x80b7('0x10')](function(_0x176471){_0x186d10(null,_0x176471);})[_0x80b7('0x12')](function(_0x3216f9){_0x186d10(_0x3216f9);});};AGIVertices['prototype'][_0x80b7('0x7a')]=function(_0x2840d5,_0x355253){scripts[_0x80b7('0x7a')](_0x2840d5[_0x80b7('0x72')],_0x2840d5[_0x80b7('0x56')],_0x2840d5[_0x80b7('0x7b')]||_0x80b7('0x7c'),_0x2840d5[_0x80b7('0x7d')])['then'](function(_0x45e613){_0x355253(null,_0x45e613);})[_0x80b7('0x12')](function(_0x27ee8d){_0x355253(_0x27ee8d);});};AGIVertices[_0x80b7('0xe')]['ispeechASR']=function(_0x100942,_0x30603d,_0x4e7950){scripts[_0x80b7('0x7e')](_0x30603d,_0x100942[_0x80b7('0x72')],_0x100942[_0x80b7('0x7f')]||_0x80b7('0x7c'),this['isConfigured'](_0x100942[_0x80b7('0x80')])?_0x100942[_0x80b7('0x80')]:undefined)[_0x80b7('0x10')](function(_0x3f912a){_0x4e7950(null,_0x3f912a);})['catch'](function(_0x3ba543){_0x4e7950(_0x3ba543);});};AGIVertices['prototype'][_0x80b7('0x81')]=function(_0xaa27df,_0x4a1553){scripts[_0x80b7('0x81')](_0xaa27df[_0x80b7('0x82')],_0xaa27df['aws_secret_access_key'],_0xaa27df[_0x80b7('0x83')],_0xaa27df[_0x80b7('0x84')]||'Amy',_0xaa27df[_0x80b7('0x56')],_0xaa27df[_0x80b7('0x85')]||_0x80b7('0x56'))['then'](function(_0xeb7511){_0x4a1553(null,_0xeb7511);})[_0x80b7('0x12')](function(_0x17b8fd){_0x4a1553(_0x17b8fd);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x86')]=function(_0x3f1252,_0x1e0dd8){scripts[_0x80b7('0x86')](this[_0x80b7('0xc')][_0x80b7('0x30')],_0x3f1252['aws_access_key_id'],_0x3f1252['aws_secret_access_key'],_0x3f1252[_0x80b7('0x87')],_0x3f1252[_0x80b7('0x56')],_0x3f1252[_0x80b7('0x88')])[_0x80b7('0x10')](function(_0x22511a){_0x1e0dd8(null,_0x22511a);})['catch'](function(_0x3cd455){_0x1e0dd8(_0x3cd455);});};AGIVertices[_0x80b7('0xe')][_0x80b7('0x89')]=function(_0x6023a4,_0x5770d6,_0x48274e){scripts['googleASR'](_0x5770d6,_0x6023a4[_0x80b7('0x72')],_0x6023a4['google_asr_language']||_0x80b7('0x7c'))[_0x80b7('0x10')](function(_0x410182){_0x48274e(null,_0x410182);})[_0x80b7('0x12')](function(_0x35cc6e){_0x48274e(_0x35cc6e);});};AGIVertices[_0x80b7('0xe')]['tildeASR']=function(_0x339a21,_0x34e00,_0x395507){scripts[_0x80b7('0x8a')](_0x34e00,_0x339a21[_0x80b7('0x8b')],_0x339a21[_0x80b7('0x8c')],_0x339a21['uri'])[_0x80b7('0x10')](function(_0xa826cc){_0x395507(null,_0xa826cc);})[_0x80b7('0x12')](function(_0x21fb22){_0x395507(_0x21fb22);});};AGIVertices[_0x80b7('0xe')]['clear']=function(_0xd90591){var _0x13d090=_['includes'](verticesWithRetry,_0xd90591[_0x80b7('0x32')])?_0xd90591:_[_0x80b7('0x8d')](_0xd90591);for(var _0x59e878 in _0x13d090){if(_0x13d090[_0x80b7('0x8e')](_0x59e878)){if(_0x13d090[_0x59e878]&&_[_0x80b7('0x8f')](_0x13d090[_0x59e878])){if(_[_0x80b7('0x5f')](recursiveMapAttributes,_0x59e878)){_0x13d090[_0x59e878]=this[_0x80b7('0x90')](_0x13d090[_0x59e878]);}else{_0x13d090[_0x59e878]=this[_0x80b7('0x91')](_0x13d090[_0x59e878]);}}}}return _0x13d090;};AGIVertices[_0x80b7('0xe')]['recursiveNodeIndex']=function(_0x4dbdc4){for(var _0x1f2349 in _0x4dbdc4){if(_0x4dbdc4['hasOwnProperty'](_0x1f2349)){if(_[_0x80b7('0x92')](_0x4dbdc4[_0x1f2349])){this[_0x80b7('0x93')](_0x4dbdc4[_0x1f2349]);}else if(_[_0x80b7('0x94')](_0x4dbdc4[_0x1f2349])){for(var _0x520218=0x0;_0x520218<_0x4dbdc4[_0x1f2349][_0x80b7('0x95')];_0x520218++){this[_0x80b7('0x93')](_0x4dbdc4[_0x1f2349][_0x520218]);}}else if(_[_0x80b7('0x8f')](_0x4dbdc4[_0x1f2349])){_0x4dbdc4[_0x1f2349]=this[_0x80b7('0x91')](_0x4dbdc4[_0x1f2349]);}}}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x96')]=function(_0x3e9fb4,_0x4b4a8a){for(var _0x3900cc in _0x3e9fb4){if(_0x3e9fb4[_0x80b7('0x8e')](_0x3900cc)){if(_[_0x80b7('0x92')](_0x3e9fb4[_0x3900cc])){if(!_['isEmpty'](_0x3e9fb4[_0x3900cc])){this[_0x80b7('0x96')](_0x3e9fb4[_0x3900cc],util['format'](_0x80b7('0x97'),_0x4b4a8a,_0x3900cc));}}else if(_['isArray'](_0x3e9fb4[_0x3900cc])){for(var _0x59266f=0x0;_0x59266f<_0x3e9fb4[_0x3900cc][_0x80b7('0x95')];_0x59266f++){this[_0x80b7('0x96')](_0x3e9fb4[_0x3900cc][_0x59266f],util[_0x80b7('0x4f')](_0x80b7('0x97'),_0x4b4a8a,_0x3900cc+'['+_0x59266f+']'));}}else{if(!_[_0x80b7('0x3d')](_0x3e9fb4[_0x3900cc])){this[_0x80b7('0xc')]['setVariable'](util[_0x80b7('0x4f')](_0x80b7('0x97'),_0x4b4a8a,_0x3900cc),_0x3e9fb4[_0x3900cc]);}}}}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x90')]=function(_0x549e2e){try{var _0x39e9b9=JSON[_0x80b7('0x61')](_0x549e2e);this[_0x80b7('0x93')](_0x39e9b9);return JSON[_0x80b7('0x69')](_0x39e9b9);}catch(_0x4e69a2){return this[_0x80b7('0x91')](_0x549e2e);}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x91')]=function(_0x367165){var _0x5c938d=_0x367165[_0x80b7('0x98')]('{');for(var _0x49d0cb=0x1;_0x49d0cb<_0x5c938d[_0x80b7('0x95')];_0x49d0cb+=0x1){var _0x1d94de=_0x5c938d[_0x49d0cb][_0x80b7('0x98')]('}');if(_0x1d94de['length']>0x1){_0x367165=_0x367165[_0x80b7('0x99')]('{'+_0x1d94de[0x0]+'}',this['channel']['getVariable'](_0x1d94de[0x0])[_0x80b7('0x9a')]||_0x1d94de[0x0]);}}if(_0x5c938d[_0x80b7('0x95')]===0x1){return _0x367165['toString']();}return this[_0x80b7('0x91')](_0x367165);};AGIVertices[_0x80b7('0xe')]['getAndSetVariable']=function(_0x10f143,_0x2470f6){var _0x429354=this[_0x80b7('0xc')][_0x80b7('0x9b')](_0x10f143);if(_0x429354[_0x80b7('0x9c')]===-0x1){return _0x429354;}logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x9d'),_0x2470f6,_0x429354['extra']));return this[_0x80b7('0xc')][_0x80b7('0x9e')](_0x2470f6,_0x429354['extra']);};AGIVertices[_0x80b7('0xe')][_0x80b7('0x9f')]=function(_0x2329c4){return _0x2329c4&&_0x2329c4!=='0'&&_0x2329c4!=='-1'&&_0x2329c4!=='';};AGIVertices[_0x80b7('0xe')][_0x80b7('0xa0')]=function(_0x38c935){this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x38c935,'-');_0x38c935[_0x80b7('0xa1')]=_0x38c935['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x80b7('0xe')][_0x80b7('0xa2')]=function(_0x2b5303){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2b5303[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x2b5303['text'])){return this[_0x80b7('0xc')]['noop']('no\x20text\x20configured');}var _0x420aad='\x22'+_0x2b5303[_0x80b7('0x56')]+'\x22';if(this[_0x80b7('0x9f')](_0x2b5303[_0x80b7('0x70')])){_0x420aad+=','+_0x2b5303['options'];}var _0x902b77=this[_0x80b7('0xc')][_0x80b7('0x52')](_0x80b7('0xa3'),_0x420aad);if(_0x902b77['result']===-0x1){return _0x902b77;}return this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x420aad));};AGIVertices[_0x80b7('0xe')][_0x80b7('0xa4')]=function(_0x2e3a5a){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0xa5'),_0x2e3a5a[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x2e3a5a[_0x80b7('0xa6')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xa8'));}var _0xbc9cd2=_0x2e3a5a[_0x80b7('0xa6')];if(this[_0x80b7('0x9f')](_0x2e3a5a[_0x80b7('0x70')])){_0xbc9cd2+=','+_0x2e3a5a[_0x80b7('0x70')];}var _0x11cee6=this[_0x80b7('0xc')][_0x80b7('0x52')](_0x80b7('0xa9'),_0xbc9cd2);if(_0x11cee6[_0x80b7('0x9c')]===-0x1){return _0x11cee6;}var _0x3fe56b=this[_0x80b7('0xaa')](_0x80b7('0xab'),'MRCP_RECOG_CONFIDENCE');if(_0x3fe56b[_0x80b7('0x9c')]===-0x1){return _0x3fe56b;}var _0x104c91=this[_0x80b7('0xaa')](_0x80b7('0xac'),'MRCP_RECOG_TRANSCRIPT');if(_0x104c91[_0x80b7('0x9c')]===-0x1){return _0x104c91;}var _0x5eb4d6=this[_0x80b7('0xaa')](_0x80b7('0xad'),_0x80b7('0xae'));if(_0x5eb4d6['result']===-0x1){return _0x5eb4d6;}return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('Executed\x20command\x20MRCPRecog\x20%s',_0xbc9cd2));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x6')]=function(_0x1be785){logger['info'](util['format'](_0x80b7('0xaf'),_0x1be785[_0x80b7('0x31')]));return this[_0x80b7('0xc')][_0x80b7('0x6')]([_0x1be785['command'],_0x1be785[_0x80b7('0xb0')]]);};AGIVertices['prototype']['answer']=function(_0xbc54d1){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0xb1'),_0xbc54d1[_0x80b7('0x31')]));if(this['isConfigured'](_0xbc54d1['timeout'])){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xbc54d1[_0x80b7('0x5d')]));var _0x5181a7=this[_0x80b7('0xc')][_0x80b7('0xb2')](_0xbc54d1[_0x80b7('0x5d')]);if(_0x5181a7[_0x80b7('0x9c')]===-0x1){return _0x5181a7;}}return this['channel']['answer']();};AGIVertices[_0x80b7('0xe')]['callback']=function(_0x55fbfa){logger['info'](util[_0x80b7('0x4f')](_0x80b7('0xb3'),_0x55fbfa[_0x80b7('0x31')]));if(!this['isConfigured'](_0x55fbfa['list_id'])){return this['channel'][_0x80b7('0x29')](_0x55fbfa,_0x80b7('0xb4'));}_0x55fbfa[_0x80b7('0x44')]=moment();if(this['isConfigured'](_0x55fbfa[_0x80b7('0xb5')])){_0x55fbfa[_0x80b7('0x44')]=moment()[_0x80b7('0xb6')](_0x55fbfa[_0x80b7('0xb5')],_0x80b7('0xb7'));}if(!this[_0x80b7('0x9f')](_0x55fbfa[_0x80b7('0x46')])){_0x55fbfa[_0x80b7('0x46')]=0x2;}this[_0x80b7('0x3b')]['sync'](this,_0x55fbfa);return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xb8'),_0x55fbfa[_0x80b7('0xb9')],_0x55fbfa[_0x80b7('0x41')],_0x55fbfa['scheduledAt']));};AGIVertices[_0x80b7('0xe')]['custom_app']=function(_0x18b139){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0xba'),_0x18b139[_0x80b7('0x31')]));var _0x3d5e8e=this['channel'][_0x80b7('0x52')](_0x18b139[_0x80b7('0xbb')],_0x18b139[_0x80b7('0x70')]);if(_0x3d5e8e[_0x80b7('0x9c')]===-0x1){return _0x3d5e8e;}return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xbc'),_0x18b139['application'],_0x18b139[_0x80b7('0x70')]));};AGIVertices['prototype'][_0x80b7('0xbd')]=function(_0x163062){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0xbe'),_0x163062[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x163062['text'])){return this['channel']['noop'](_0x80b7('0xbf'));}var _0x36073d='\x22'+_0x163062[_0x80b7('0x56')]+'\x22';if(this[_0x80b7('0x9f')](_0x163062[_0x80b7('0x70')])){_0x36073d+=','+_0x163062[_0x80b7('0x70')];}var _0x55078a=this['channel']['exec'](_0x80b7('0xa3'),_0x36073d);if(_0x55078a['result']===-0x1){return _0x55078a;}return this['channel'][_0x80b7('0xa7')](util['format'](_0x80b7('0xc0'),_0x36073d));};AGIVertices[_0x80b7('0xe')][_0x80b7('0xc1')]=function(_0x51d571){logger['info'](util[_0x80b7('0x4f')](_0x80b7('0xc2'),_0x51d571[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x51d571[_0x80b7('0x56')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xbf'));}var _0x1e5e08='\x22'+_0x51d571[_0x80b7('0x56')]+'\x22';if(this['isConfigured'](_0x51d571[_0x80b7('0x70')])){_0x1e5e08+=','+_0x51d571[_0x80b7('0x70')];}var _0x38b026=this['channel'][_0x80b7('0x52')]('MRCPSynth',_0x1e5e08);if(_0x38b026['result']===-0x1){return _0x38b026;}return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xc0'),_0x1e5e08));};AGIVertices[_0x80b7('0xe')][_0x80b7('0xc3')]=function(_0x592a08){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x592a08[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x592a08[_0x80b7('0xa6')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')]('no\x20grammar\x20configured');}var _0x5213d7=_0x592a08[_0x80b7('0xa6')];if(this[_0x80b7('0x9f')](_0x592a08[_0x80b7('0x70')])){_0x5213d7+=','+_0x592a08[_0x80b7('0x70')];}var _0xe7706b=this[_0x80b7('0xc')][_0x80b7('0x52')](_0x80b7('0xa9'),_0x5213d7);if(_0xe7706b[_0x80b7('0x9c')]===-0x1){return _0xe7706b;}var _0x523724=this[_0x80b7('0xaa')](_0x80b7('0xab'),'LUMENVOX_ASR_CONFIDENCE');if(_0x523724['result']===-0x1){return _0x523724;}var _0x4da2b8=this['getAndSetVariable'](_0x80b7('0xac'),_0x80b7('0xc4'));if(_0x4da2b8[_0x80b7('0x9c')]===-0x1){return _0x4da2b8;}var _0x30056e=this[_0x80b7('0xaa')](_0x80b7('0xad'),_0x80b7('0xc5'));if(_0x30056e[_0x80b7('0x9c')]===-0x1){return _0x30056e;}return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xc6'),_0x5213d7));};AGIVertices['prototype'][_0x80b7('0xc7')]=function(_0x41e760){logger['info'](util[_0x80b7('0x4f')](_0x80b7('0xc8'),_0x41e760[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x41e760[_0x80b7('0xa6')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xa8'));}var _0x19ede8=_0x41e760[_0x80b7('0xa6')];if(this[_0x80b7('0x9f')](_0x41e760[_0x80b7('0x70')])){_0x19ede8+=','+_0x41e760[_0x80b7('0x70')];}var _0x4f4512=this['channel'][_0x80b7('0x52')](_0x80b7('0xa9'),_0x19ede8);if(_0x4f4512[_0x80b7('0x9c')]===-0x1){return _0x4f4512;}var _0x53d159=this[_0x80b7('0xaa')](_0x80b7('0xab'),_0x80b7('0xc9'));if(_0x53d159[_0x80b7('0x9c')]===-0x1){return _0x53d159;}var _0xd4ce5=this[_0x80b7('0xaa')](_0x80b7('0xac'),'SESTEK_ASR_TRANSCRIPT');if(_0xd4ce5[_0x80b7('0x9c')]===-0x1){return _0xd4ce5;}var _0x32956e=this[_0x80b7('0xaa')](_0x80b7('0xad'),_0x80b7('0xca'));if(_0x32956e[_0x80b7('0x9c')]===-0x1){return _0x32956e;}return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xc6'),_0x19ede8));};AGIVertices[_0x80b7('0xe')][_0x80b7('0xcb')]=function(_0x4fa041){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0xcc'),_0x4fa041[_0x80b7('0x31')]));if(!this['isConfigured'](_0x4fa041[_0x80b7('0xcd')])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x4fa041,_0x80b7('0xce'));}var _0x54b481=this[_0x80b7('0x16')][_0x80b7('0x67')](this,_0x4fa041['odbc_id']);if(!_0x54b481){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x4fa041,_0x80b7('0xcf'));}if(!this[_0x80b7('0x9f')](_0x4fa041['query'])){return this[_0x80b7('0xc')]['error'](_0x4fa041,_0x80b7('0xd0'));}var _0x3bbc8b=_0x4fa041[_0x80b7('0x2c')][_0x80b7('0xd1')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xd2'),_0x3bbc8b));var _0x44c28c=this[_0x80b7('0x27')]['sync'](this,_0x54b481,_0x3bbc8b);this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x4fa041,_0x3bbc8b);if(!this[_0x80b7('0x9f')](_0x4fa041[_0x80b7('0xd3')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xd4'));}var _0x239e23=this[_0x80b7('0x9b')][_0x80b7('0x67')](this,_0x4fa041[_0x80b7('0xd3')]);if(!_0x239e23){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x4fa041,_0x80b7('0xd5'));}var _0x1f7579=this;_0x44c28c[_0x80b7('0xd6')](function(_0x361562,_0x1336d0){Object[_0x80b7('0xd7')](_0x361562)['forEach'](function(_0x23b3ae){_0x1f7579[_0x80b7('0xc')][_0x80b7('0x9e')](util[_0x80b7('0x4f')](_0x80b7('0xd8'),_0x239e23,_0x1336d0,_0x23b3ae),_0x361562[_0x23b3ae]);});});this[_0x80b7('0xc')][_0x80b7('0x9e')](util[_0x80b7('0x4f')](_0x80b7('0xd9'),_0x239e23),_0x44c28c[_0x80b7('0x95')]);return this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')](_0x80b7('0xda'),_0x239e23));};AGIVertices[_0x80b7('0xe')][_0x80b7('0xdb')]=function(_0x21b492){logger['debug'](util[_0x80b7('0x4f')](_0x80b7('0xdc'),_0x21b492[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x21b492[_0x80b7('0xdd')])){return this['channel']['error'](_0x21b492,_0x80b7('0xde'));}var _0x375358=this[_0x80b7('0x18')]['sync'](this,_0x21b492['sip_id']);if(!_0x375358){return this['channel'][_0x80b7('0x29')](_0x21b492,_0x80b7('0xdf'));}var _0x4699ea=this[_0x80b7('0xc')][_0x80b7('0x52')](_0x80b7('0xe0'),[util[_0x80b7('0x4f')](_0x80b7('0xe1'),_0x375358),_0x21b492[_0x80b7('0x5d')],_0x21b492[_0x80b7('0xe2')],_0x21b492[_0x80b7('0x5c')]]);if(_0x4699ea[_0x80b7('0x9c')]===-0x1){return _0x4699ea;}return this['channel']['noop'](util['format'](_0x80b7('0xe3'),_0x80b7('0xe0')));};AGIVertices['prototype'][_0x80b7('0xe4')]=function(_0x14d022){logger['info'](util[_0x80b7('0x4f')](_0x80b7('0xe5'),_0x14d022[_0x80b7('0x31')]));if(!this['isConfigured'](_0x14d022[_0x80b7('0x72')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xe6'));}if(!this[_0x80b7('0x9f')](_0x14d022[_0x80b7('0x56')])){return this['channel'][_0x80b7('0xa7')](_0x80b7('0xbf'));}this['channel'][_0x80b7('0xe7')]=!![];this[_0x80b7('0x2f')](_0x14d022);this[_0x80b7('0x3a')](_0x14d022['text'],'in','','');this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('Trying\x20Dialogflow:\x20%s',_0x14d022[_0x80b7('0x56')]));var _0x448666=this[_0x80b7('0x71')][_0x80b7('0x67')](this,_0x14d022);if(_0x448666){for(var _0x3f58fc in _0x448666){if(_0x448666[_0x80b7('0x8e')](_0x3f58fc)){this[_0x80b7('0xc')][_0x80b7('0x9e')](util[_0x80b7('0x4f')](_0x80b7('0xe8'),_0x3f58fc[_0x80b7('0x60')]()),_0x448666[_0x3f58fc]);}}this[_0x80b7('0x3a')](_0x448666['speech'],_0x80b7('0xe9'),_0x80b7('0xe4'),'');return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xea'),_0x448666[_0x80b7('0xeb')]));}return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x14d022,_0x80b7('0xec'));};AGIVertices[_0x80b7('0xe')][_0x80b7('0xed')]=function(_0x4470d4){logger[_0x80b7('0x2a')](util['format'](_0x80b7('0xee'),_0x4470d4['label']));if(!this['isConfigured'](_0x4470d4[_0x80b7('0x75')])){return this[_0x80b7('0xc')]['noop']('no\x20project_id\x20configured');}if(!this[_0x80b7('0x9f')](_0x4470d4[_0x80b7('0x76')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')]('no\x20client_email\x20configured');}if(!this[_0x80b7('0x9f')](_0x4470d4[_0x80b7('0x77')])){return this['channel'][_0x80b7('0xa7')](_0x80b7('0xef'));}if(!this[_0x80b7('0x9f')](_0x4470d4[_0x80b7('0x78')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xf0'));}if(!this[_0x80b7('0x9f')](_0x4470d4[_0x80b7('0x56')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xbf'));}this[_0x80b7('0xc')][_0x80b7('0xe7')]=!![];this['createSquareDetailsReport'](_0x4470d4);this[_0x80b7('0x3a')](_0x4470d4['text'],'in','','');this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xf1'),_0x4470d4[_0x80b7('0x56')]));var _0x29e46f=this[_0x80b7('0x74')][_0x80b7('0x67')](this,_0x4470d4);if(_0x29e46f){for(var _0x4004c6 in _0x29e46f){if(_0x29e46f['hasOwnProperty'](_0x4004c6)){if(_0x4004c6!==_0x80b7('0xf2')){this[_0x80b7('0xc')][_0x80b7('0x9e')](util[_0x80b7('0x4f')](_0x80b7('0xe8'),_0x4004c6[_0x80b7('0x60')]()),_0x29e46f[_0x4004c6]);}}}this[_0x80b7('0x3a')](_0x29e46f[_0x80b7('0xeb')],_0x80b7('0xe9'),_0x80b7('0xed'),_0x29e46f[_0x80b7('0xf2')]);return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('DialogflowV2\x20Result\x20%s',_0x29e46f['speech']));}return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x4470d4,_0x80b7('0xf3'));};AGIVertices[_0x80b7('0xe')][_0x80b7('0xf4')]=function(_0x5e6b0b){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0xf5'),_0x5e6b0b[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x5e6b0b[_0x80b7('0xf6')])){return this['channel'][_0x80b7('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x80b7('0x9f')](_0x5e6b0b[_0x80b7('0xf7')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xf8'));}if(!this[_0x80b7('0x9f')](_0x5e6b0b['password'])){return this['channel'][_0x80b7('0xa7')](_0x80b7('0xf9'));}if(!this[_0x80b7('0x9f')](_0x5e6b0b[_0x80b7('0xfa')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xbf'));}this[_0x80b7('0xc')][_0x80b7('0xe7')]=!![];this[_0x80b7('0x2f')](_0x5e6b0b);this['createSquareMessage'](_0x5e6b0b[_0x80b7('0x56')],'in','','');this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xfb'),_0x5e6b0b['text']));var _0x420411=this[_0x80b7('0x79')][_0x80b7('0x67')](this,_0x5e6b0b);if(_0x420411){for(var _0x223128 in _0x420411){if(_0x420411[_0x80b7('0x8e')](_0x223128)){this[_0x80b7('0xc')][_0x80b7('0x9e')](util[_0x80b7('0x4f')](_0x80b7('0xfc'),_0x223128[_0x80b7('0x60')]()),_0x420411[_0x223128]);}}this[_0x80b7('0x3a')](_0x420411[_0x80b7('0xeb')],'out',_0x80b7('0xf4'),'');if(_0x420411[_0x80b7('0xfd')]){this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x420411['audiofile']));var _0x2d947d=this[_0x80b7('0xc')][_0x80b7('0xfe')](_0x420411[_0x80b7('0xfd')]);try{fs[_0x80b7('0xff')](_0x420411[_0x80b7('0xfd')]+'.wav');}catch(_0x398550){logger[_0x80b7('0x29')](_0x398550);}return _0x2d947d;}else{return this[_0x80b7('0xc')]['noop'](util['format'](_0x80b7('0x100'),_0x420411[_0x80b7('0xeb')]));}}return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x5e6b0b,_0x80b7('0x101'));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x102')]=function(_0x5417e9){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x103'),_0x5417e9[_0x80b7('0x31')]));return this['channel'][_0x80b7('0xa7')](_0x80b7('0x102'));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x104')]=function(_0x2cbdad){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x105'),_0x2cbdad[_0x80b7('0x31')]));var _0x5b2922='';if(_0x2cbdad[_0x80b7('0x106')]){if(!this['isConfigured'](_0x2cbdad[_0x80b7('0x106')])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x2cbdad,'no\x20trunk\x20selected');}else{var _0x4ca29d=parseInt(_0x2cbdad[_0x80b7('0x106')],0xa);if(isNaN(_0x4ca29d)){_0x5b2922=_0x2cbdad['trunk_id'];}else{_0x5b2922=this['getTrunk']['sync'](this,_0x2cbdad['trunk_id']);if(!_0x5b2922){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x2cbdad,_0x80b7('0x107'));}}}}else if(_0x2cbdad[_0x80b7('0x108')]){_0x5b2922=_0x2cbdad['trunk_name'];}else{return this['channel']['error'](_0x2cbdad,_0x80b7('0x109'));}var _0x3df464=this[_0x80b7('0xc')][_0x80b7('0x52')](_0x80b7('0xe0'),[util[_0x80b7('0x4f')]('SIP/%s/%s',_0x5b2922,_0x2cbdad[_0x80b7('0xb9')]),_0x2cbdad[_0x80b7('0x5d')],_0x2cbdad[_0x80b7('0xe2')],_0x2cbdad[_0x80b7('0x5c')]]);if(_0x3df464['result']===-0x1){return _0x3df464;}return this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')](_0x80b7('0xe3'),'DIAL'));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x10a')]=function(_0x40b910){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x10b'),_0x40b910[_0x80b7('0x31')]));return this[_0x80b7('0xc')][_0x80b7('0xa7')]('finally');};AGIVertices['prototype']['getdigits']=function(_0x5268bb){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x10c'),_0x5268bb[_0x80b7('0x31')]));if(_0x5268bb['retry']===0x0){return this[_0x80b7('0xa0')](_0x5268bb);}_0x5268bb['retry']-=0x1;if(!this[_0x80b7('0x9f')](_0x5268bb[_0x80b7('0x10d')])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x5268bb,_0x80b7('0x10e'));}var _0x5252e5=this[_0x80b7('0x1b')][_0x80b7('0x67')](this,_0x5268bb[_0x80b7('0x10d')]);if(!_0x5252e5){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x5268bb,_0x80b7('0x10f'));}if(!this[_0x80b7('0x9f')](_0x5268bb['variable_id'])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x80b7('0xd4'));}var _0x4d774c=this[_0x80b7('0xc')][_0x80b7('0x110')](_0x5252e5,_0x5268bb['response'],_0x5268bb[_0x80b7('0x111')]);var _0x54ed34=_0x4d774c[_0x80b7('0x9c')]?_0x4d774c[_0x80b7('0x9c')][_0x80b7('0x45')]():'';logger[_0x80b7('0x2a')]('test',JSON[_0x80b7('0x69')](_0x4d774c));if(_0x4d774c['result']===-0x1){this['createSquareDetailsReport'][_0x80b7('0x67')](this,_0x5268bb,_0x54ed34);return _0x4d774c;}else if(_0x4d774c[_0x80b7('0x9a')]==='timeout'){_0x4d774c[_0x80b7('0x9c')]=_0x54ed34[_0x80b7('0x95')]>=parseInt(_0x5268bb['mindigit'])?'x':'i';}else{_0x4d774c['result']=_0x54ed34[_0x80b7('0x95')]>=parseInt(_0x5268bb[_0x80b7('0x112')])&&_0x54ed34['length']<=parseInt(_0x5268bb[_0x80b7('0x111')])?'x':'i';}var _0x59cbaf=this[_0x80b7('0x9b')]['sync'](this,_0x5268bb['variable_id']);if(!_0x59cbaf){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x5268bb,_0x80b7('0xd5'));}this[_0x80b7('0xc')][_0x80b7('0x9e')](_0x59cbaf,_0x54ed34);if(this[_0x80b7('0x9f')](_0x5268bb[_0x80b7('0x113')])){var _0x367518=parseInt(_0x5268bb['hiddendigitsnum'],0xa);var _0x39ee29=rs[_0x80b7('0x114')]({'charset':'*','length':_0x367518});var _0x3e940d=_0x54ed34['length'];if(_0x3e940d>0x0){if(_0x3e940d>_0x367518){this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x5268bb,_0x5268bb[_0x80b7('0x115')]===_0x80b7('0x116')?_0x39ee29+_0x54ed34[_0x80b7('0x117')](_0x367518):_0x54ed34['substr'](0x0,_0x3e940d-_0x367518)+_0x39ee29);}else{this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x5268bb,rs[_0x80b7('0x114')]({'charset':'*','length':_0x3e940d}));}}else{this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x5268bb,'');}}else{this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x5268bb,_0x54ed34);}return _0x4d774c;};AGIVertices[_0x80b7('0xe')][_0x80b7('0xb')]=function(_0x21b802){logger[_0x80b7('0x2a')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x21b802['label']));return this[_0x80b7('0xa')](_0x21b802);};AGIVertices[_0x80b7('0xe')][_0x80b7('0x118')]=function(_0x4456e4){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x119'),_0x4456e4[_0x80b7('0x31')]));this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x4456e4,_0x4456e4[_0x80b7('0x11a')]);return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('GOAL\x20%s',_0x4456e4['goalname']));};AGIVertices[_0x80b7('0xe')]['awspolly']=function(_0x53db6e){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x11b'),_0x53db6e[_0x80b7('0x31')]));if(!this['isConfigured'](_0x53db6e['aws_access_key_id'])||!this['isConfigured'](_0x53db6e[_0x80b7('0x11c')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x80b7('0x9f')](_0x53db6e[_0x80b7('0x56')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xbf'));}this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x11d'),_0x53db6e[_0x80b7('0x56')]));var _0x219cfa=this[_0x80b7('0x81')][_0x80b7('0x67')](this,_0x53db6e);if(_0x219cfa){this[_0x80b7('0xc')][_0x80b7('0xa7')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x219cfa));var _0x2fdf2e=this[_0x80b7('0xc')][_0x80b7('0xfe')](_0x219cfa);try{fs['unlink'](_0x219cfa+_0x80b7('0x11e'));}catch(_0xfab59c){logger[_0x80b7('0x29')](_0xfab59c);}return _0x2fdf2e;}return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x53db6e,_0x80b7('0x11f'));};AGIVertices[_0x80b7('0xe')]['awslex']=function(_0x3794c0){logger['info'](util['format'](_0x80b7('0x120'),_0x3794c0[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x3794c0[_0x80b7('0x82')])||!this[_0x80b7('0x9f')](_0x3794c0[_0x80b7('0x11c')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x121'));}if(!this[_0x80b7('0x9f')](_0x3794c0[_0x80b7('0x88')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x122'));}if(!this[_0x80b7('0x9f')](_0x3794c0[_0x80b7('0x56')])){return this['channel'][_0x80b7('0xa7')](_0x80b7('0xbf'));}this[_0x80b7('0xc')][_0x80b7('0xe7')]=!![];this['createSquareDetailsReport'](_0x3794c0);this['createSquareMessage'](_0x3794c0[_0x80b7('0x56')],'in','','');this[_0x80b7('0xc')][_0x80b7('0xa7')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x3794c0[_0x80b7('0x56')]));var _0x164931=this[_0x80b7('0x86')][_0x80b7('0x67')](this,_0x3794c0);if(_0x164931){for(var _0x590ff8 in _0x164931){if(_0x164931[_0x80b7('0x8e')](_0x590ff8)&&_['isString'](_0x164931[_0x590ff8])){this['channel'][_0x80b7('0x9e')](util[_0x80b7('0x4f')](_0x80b7('0x123'),_0x590ff8['toUpperCase']()),_0x164931[_0x590ff8]);}}if(_['isNil'](_0x164931['message'])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x124'));}else{this['createSquareMessage'](_0x164931[_0x80b7('0x6e')],_0x80b7('0xe9'),_0x80b7('0x125'),'');return this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')]('Amazon\x20Lex\x20Result\x20%s',_0x164931[_0x80b7('0x6e')]));}}return this['channel'][_0x80b7('0x29')](_0x3794c0,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x80b7('0xe')]['googleasr']=function(_0x163ef1){logger['info'](util[_0x80b7('0x4f')](_0x80b7('0x126'),_0x163ef1['label'],_0x163ef1[_0x80b7('0x5d')]));if(!this['isConfigured'](_0x163ef1['key'])){return this[_0x80b7('0xc')]['noop']('no\x20key\x20configured');}var _0x4fa8ac='wav';var _0xcb0f2a=util[_0x80b7('0x4f')](_0x80b7('0x127'),FILES_PATH,rs[_0x80b7('0x114')](0x4));var _0x2e9c60=util[_0x80b7('0x4f')]('%s.%s',_0xcb0f2a,_0x4fa8ac);var _0x2f8f78=!![];if(_0x163ef1[_0x80b7('0x128')]===_0x80b7('0x129')){_0x2f8f78=![];}var _0xfce8c2=this[_0x80b7('0xc')][_0x80b7('0x12a')](_0xcb0f2a,_0x4fa8ac,_0x163ef1[_0x80b7('0x12b')],_0x163ef1[_0x80b7('0x5d')],undefined,_0x2f8f78);if(_0xfce8c2[_0x80b7('0x9c')]!==-0x1){this['channel'][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x12c'),_0x2e9c60));var _0x2dfd2e=this[_0x80b7('0x89')][_0x80b7('0x67')](this,_0x163ef1,_0x2e9c60);if(_0x2dfd2e){for(var _0x4451b9 in _0x2dfd2e){if(_0x2dfd2e[_0x80b7('0x8e')](_0x4451b9)){this[_0x80b7('0xc')]['setVariable'](util[_0x80b7('0x4f')](_0x80b7('0x12d'),_0x4451b9[_0x80b7('0x60')]()),_0x2dfd2e[_0x4451b9]);}}return this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')](_0x80b7('0x12e'),JSON[_0x80b7('0x69')](_0x2dfd2e)));}}return _0xfce8c2;};AGIVertices[_0x80b7('0xe')][_0x80b7('0x12f')]=function(_0x1b0034){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x130'),_0x1b0034[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x1b0034[_0x80b7('0x8b')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x131'));}if(!this['isConfigured'](_0x1b0034[_0x80b7('0x8c')])){return this['channel']['noop'](_0x80b7('0x132'));}var _0x472d44=_0x80b7('0x133');var _0x4142a6=util[_0x80b7('0x4f')]('%s/recordings/%s',FILES_PATH,rs[_0x80b7('0x114')](0x4));var _0x31eaf8=util[_0x80b7('0x4f')](_0x80b7('0x97'),_0x4142a6,_0x472d44);var _0x2a52a9=!![];if(_0x1b0034[_0x80b7('0x128')]===_0x80b7('0x129')){_0x2a52a9=![];}var _0x3dfbf5=this[_0x80b7('0xc')][_0x80b7('0x12a')](_0x4142a6,_0x472d44,_0x1b0034[_0x80b7('0x12b')],_0x1b0034['timeout'],undefined,_0x2a52a9);if(_0x3dfbf5['result']!==-0x1){this[_0x80b7('0xc')][_0x80b7('0xa7')](util['format'](_0x80b7('0x134'),_0x31eaf8));var _0x1f8148=this[_0x80b7('0x8a')][_0x80b7('0x67')](this,_0x1b0034,_0x31eaf8);if(_0x1f8148){for(var _0x2c4e89 in _0x1f8148){if(_0x1f8148['hasOwnProperty'](_0x2c4e89)){this['channel']['setVariable'](util[_0x80b7('0x4f')](_0x80b7('0x135'),_0x2c4e89[_0x80b7('0x60')]()),_0x1f8148[_0x2c4e89]);}}return this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')](_0x80b7('0x136'),JSON[_0x80b7('0x69')](_0x1f8148)));}}return _0x3dfbf5;};AGIVertices[_0x80b7('0xe')][_0x80b7('0x137')]=function(_0x286571){logger[_0x80b7('0x2a')](util['format'](_0x80b7('0x138'),_0x286571[_0x80b7('0x31')]));return this['channel'][_0x80b7('0x139')](_0x286571[_0x80b7('0x36')],_0x286571[_0x80b7('0x37')],_0x286571[_0x80b7('0x13a')]);};AGIVertices[_0x80b7('0xe')][_0x80b7('0x13b')]=function(_0x7f988d){logger[_0x80b7('0x2a')](util['format'](_0x80b7('0x13c'),_0x7f988d['label']));if(!this[_0x80b7('0x9f')](_0x7f988d[_0x80b7('0x13d')])){return this[_0x80b7('0xc')]['error'](_0x7f988d,_0x80b7('0x13e'));}try{var _0x3f0a53=eval(_0x7f988d['condition'])?_0x80b7('0x13f'):_0x80b7('0x140');this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('EVAL\x20CONDITION\x20%s\x20%s',_0x7f988d[_0x80b7('0x13d')],_0x3f0a53));return{'code':0xc8,'result':_0x3f0a53};}catch(_0x35818f){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x141')]=function(_0x18b0c9){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x142'),_0x18b0c9['label']));if(!this['isConfigured'](_0x18b0c9['interval_id'])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x18b0c9,'no\x20interval\x20configured');}var _0x516917=this[_0x80b7('0x23')][_0x80b7('0x67')](this,_0x18b0c9[_0x80b7('0x143')]);if(!_0x516917){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x18b0c9,_0x80b7('0x144'));}for(var _0x4be985=0x0;_0x4be985<_0x516917['length'];_0x4be985+=0x1){var _0x17f308=this[_0x80b7('0xc')]['getVariable'](util[_0x80b7('0x4f')](_0x80b7('0x145'),_0x516917[_0x4be985]));if(_0x17f308[_0x80b7('0x9c')]===-0x1){return _0x17f308;}logger[_0x80b7('0x2a')](util['format']('IFTIME\x20%s\x20%s',_0x516917[_0x4be985],_0x17f308['extra']));if(_0x17f308[_0x80b7('0x9a')]===_0x80b7('0x13f')){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x146'),_0x516917[_0x4be985],_0x80b7('0x13f')));this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('IFTIME\x20%s\x20%s',_0x516917[_0x4be985],_0x80b7('0x13f')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x80b7('0x4f')](_0x80b7('0x146'),_0x516917[_0x4be985],_0x80b7('0x140')));this[_0x80b7('0xc')][_0x80b7('0xa7')](util['format'](_0x80b7('0x146'),_0x516917[_0x4be985],_0x80b7('0x140')));}}return{'code':0xc8,'result':_0x80b7('0x140')};};AGIVertices['prototype']['hangup']=function(_0x25e883){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x147'),_0x25e883[_0x80b7('0x31')]));return this['channel']['hangup']();};AGIVertices[_0x80b7('0xe')][_0x80b7('0x148')]=function(_0x300b06){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x149'),_0x300b06[_0x80b7('0x31')]));if(!this['isConfigured'](_0x300b06['key'])){return this['channel'][_0x80b7('0xa7')](_0x80b7('0xe6'));}var _0x5bb6c6=_0x80b7('0x133');var _0x119eb8=util['format'](_0x80b7('0x127'),FILES_PATH,rs['generate'](0x4));var _0x4f7c70=util['format'](_0x80b7('0x97'),_0x119eb8,_0x5bb6c6);var _0xffb3cf=!![];if(_0x300b06['beep']===_0x80b7('0x129')){_0xffb3cf=![];}var _0x5d58a6=this['channel'][_0x80b7('0x12a')](_0x119eb8,_0x5bb6c6,_0x300b06[_0x80b7('0x12b')],_0x300b06[_0x80b7('0x5d')],undefined,_0xffb3cf);if(_0x5d58a6[_0x80b7('0x9c')]!==-0x1){this[_0x80b7('0xc')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x4f7c70));var _0x3e6c55=this[_0x80b7('0x7e')]['sync'](this,_0x300b06,_0x4f7c70);if(_0x3e6c55){for(var _0x460bed in _0x3e6c55){if(_0x3e6c55[_0x80b7('0x8e')](_0x460bed)){this[_0x80b7('0xc')][_0x80b7('0x9e')](util[_0x80b7('0x4f')](_0x80b7('0x14a'),_0x460bed[_0x80b7('0x60')]()),_0x3e6c55[_0x460bed]);}}return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x14b'),JSON[_0x80b7('0x69')](_0x3e6c55)));}}return _0x5d58a6;};AGIVertices[_0x80b7('0xe')][_0x80b7('0x14c')]=function(_0xb69052){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x14d'),_0xb69052[_0x80b7('0x31')]));if(!this['isConfigured'](_0xb69052[_0x80b7('0x72')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')]('no\x20key\x20configured');}if(!this[_0x80b7('0x9f')](_0xb69052['text'])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0xbf'));}this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('Trying\x20ispeech\x20TTS\x20%s',_0xb69052['text']));var _0x5ab30f=this[_0x80b7('0x7a')][_0x80b7('0x67')](this,_0xb69052);if(_0x5ab30f){this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x14e'),_0x5ab30f));var _0x501217=this['channel']['streamFile'](_0x5ab30f,_0xb69052[_0x80b7('0x12b')]);try{fs[_0x80b7('0xff')](_0x5ab30f+'.wav');}catch(_0x15cbbe){logger[_0x80b7('0x29')](_0x15cbbe);}return _0x501217;}return this[_0x80b7('0xc')]['error'](_0xb69052,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x80b7('0xe')]['login']=function(_0x5b94fd){logger[_0x80b7('0x2a')](util['format'](_0x80b7('0x14f'),_0x5b94fd[_0x80b7('0x31')]));if(!this['isConfigured'](_0x5b94fd['findBy'])){return this['channel']['error'](_0x5b94fd,_0x80b7('0x150'));}logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x151'),this[_0x80b7('0xc')][_0x80b7('0x34')],_0x5b94fd[_0x80b7('0x152')]));var _0x482380=this['agentLogin'][_0x80b7('0x67')](this,_0x5b94fd[_0x80b7('0x152')]);if(_0x482380){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x153'),this['channel'][_0x80b7('0x34')],_0x5b94fd['findBy']));this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x80b7('0xc')][_0x80b7('0x34')],_0x5b94fd['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x80b7('0x4f')](_0x80b7('0x154'),this['channel']['callerid'],_0x5b94fd['findBy']));this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x154'),this[_0x80b7('0xc')][_0x80b7('0x34')],_0x5b94fd[_0x80b7('0x152')]));return{'code':0xc8,'result':_0x80b7('0x155')};}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x156')]=function(_0x390857){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x157'),_0x390857[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x390857[_0x80b7('0x152')])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x390857,_0x80b7('0x150'));}logger['info'](util[_0x80b7('0x4f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x390857[_0x80b7('0x152')]));var _0x5c0258=this[_0x80b7('0x4c')]['sync'](this,_0x390857[_0x80b7('0x152')]);if(_0x5c0258){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x153'),this[_0x80b7('0xc')][_0x80b7('0x34')],_0x390857['findBy']));this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')](_0x80b7('0x153'),this[_0x80b7('0xc')][_0x80b7('0x34')],_0x390857[_0x80b7('0x152')]));return{'code':0xc8,'result':_0x80b7('0x158')};}else{logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x154'),this['channel'][_0x80b7('0x34')],_0x390857[_0x80b7('0x152')]));this[_0x80b7('0xc')][_0x80b7('0xa7')](util['format'](_0x80b7('0x154'),this['channel'][_0x80b7('0x34')],_0x390857[_0x80b7('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x159')]=function(_0x572b5e){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x15a'),_0x572b5e[_0x80b7('0x31')]));if(!this['isConfigured'](_0x572b5e[_0x80b7('0x15b')])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x572b5e,'no\x20operation\x20configured');}this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x15c'),_0x572b5e[_0x80b7('0x15b')]));var _0x42c715=eval(_0x572b5e[_0x80b7('0x15b')]);if(!this[_0x80b7('0x9f')](_0x572b5e[_0x80b7('0xd3')])){return this[_0x80b7('0xc')]['noop'](_0x80b7('0xd4'));}var _0x54fb5a=this[_0x80b7('0x9b')][_0x80b7('0x67')](this,_0x572b5e[_0x80b7('0xd3')]);if(!_0x54fb5a){return this[_0x80b7('0xc')]['error'](_0x572b5e,'no\x20variable\x20found');}if(_['isArray'](_0x42c715)){var _0x37f013=this;_0x42c715[_0x80b7('0xd6')](function(_0x17da26,_0x12e445){_0x37f013['channel'][_0x80b7('0x9e')](util[_0x80b7('0x4f')](_0x80b7('0x15d'),_0x54fb5a,_0x12e445),_0x17da26);});return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('variable\x20%s[key]\x20set',_0x54fb5a));}else{return this[_0x80b7('0xc')]['setVariable'](_0x54fb5a,_0x42c715);}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x9')]=function(_0x2832a3){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x15e'),_0x2832a3[_0x80b7('0x31')]));if(_0x2832a3[_0x80b7('0xa1')]===0x0){return this[_0x80b7('0xa0')](_0x2832a3);}_0x2832a3[_0x80b7('0xa1')]-=0x1;if(!this[_0x80b7('0x9f')](_0x2832a3[_0x80b7('0x10d')])){return this['channel'][_0x80b7('0x29')](_0x2832a3,_0x80b7('0x10e'));}var _0x1f01a6=this['getSound'][_0x80b7('0x67')](this,_0x2832a3[_0x80b7('0x10d')]);if(!_0x1f01a6){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x2832a3,_0x80b7('0x10f'));}var _0x44521d=this[_0x80b7('0xc')][_0x80b7('0x110')](_0x1f01a6,_0x2832a3[_0x80b7('0x15f')],_0x2832a3[_0x80b7('0x160')]);var _0x1db058=_0x44521d[_0x80b7('0x9c')];if(_0x44521d[_0x80b7('0x9c')]===-0x1){this['createSquareDetailsReport'][_0x80b7('0x67')](this,_0x2832a3,'-1');return _0x44521d;}else if(_0x44521d[_0x80b7('0x9a')]===_0x80b7('0x5d')){_0x44521d[_0x80b7('0x9c')]=_0x44521d['result']['length']>0x0?_0x44521d[_0x80b7('0x9c')]:'t';}else if(_['isEmpty'](_0x44521d[_0x80b7('0x9c')])){_0x44521d[_0x80b7('0x9c')]='#';_0x1db058='#';}if(!this[_0x80b7('0x9f')](_0x2832a3[_0x80b7('0xd3')])){this['channel'][_0x80b7('0xa7')](_0x80b7('0xd4'));}else{var _0x17d326=this[_0x80b7('0x9b')][_0x80b7('0x67')](this,_0x2832a3[_0x80b7('0xd3')]);if(!_0x17d326){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x2832a3,_0x80b7('0xd5'));}this[_0x80b7('0xc')][_0x80b7('0x9e')](_0x17d326,_0x1db058);}this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x2832a3,_0x1db058);return _0x44521d;};AGIVertices[_0x80b7('0xe')][_0x80b7('0xa7')]=function(_0x486748){logger[_0x80b7('0x2a')](util['format'](_0x80b7('0x161'),_0x486748[_0x80b7('0x31')]));return this[_0x80b7('0xc')]['noop'](_0x486748[_0x80b7('0x162')]||_0x486748['label']);};AGIVertices[_0x80b7('0xe')][_0x80b7('0x163')]=function(_0x26f20a){logger['info'](util[_0x80b7('0x4f')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x26f20a[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x26f20a['findBy'])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x26f20a,_0x80b7('0x150'));}logger['info'](util[_0x80b7('0x4f')](_0x80b7('0x151'),this[_0x80b7('0xc')][_0x80b7('0x34')],_0x26f20a[_0x80b7('0x152')]));var _0x123f3e=this['getPause'][_0x80b7('0x67')](this,_0x26f20a[_0x80b7('0x164')]);var _0x1bdd93=this[_0x80b7('0x49')][_0x80b7('0x67')](this,_0x26f20a[_0x80b7('0x152')],_0x123f3e);if(_0x1bdd93){logger['info'](util[_0x80b7('0x4f')](_0x80b7('0x153'),this['channel'][_0x80b7('0x34')],_0x26f20a[_0x80b7('0x152')]));this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x153'),this[_0x80b7('0xc')]['callerid'],_0x26f20a[_0x80b7('0x152')]));return{'code':0xc8,'result':_0x80b7('0x158')};}else{logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x80b7('0xc')]['callerid'],_0x26f20a[_0x80b7('0x152')]));this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x153'),this[_0x80b7('0xc')][_0x80b7('0x34')],_0x26f20a[_0x80b7('0x152')]));return{'code':0xc8,'result':_0x80b7('0x155')};}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x165')]=function(_0x3cb9ee){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x166'),_0x3cb9ee[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x3cb9ee[_0x80b7('0x10d')])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x3cb9ee,_0x80b7('0x10e'));}var _0x4a2400=this['getSound'][_0x80b7('0x67')](this,_0x3cb9ee[_0x80b7('0x10d')]);if(!_0x4a2400){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x3cb9ee,_0x80b7('0x10f'));}var _0x5daf71=this[_0x80b7('0xc')]['exec'](_0x80b7('0x167'),[_0x4a2400,_0x3cb9ee['opts']]);if(_0x5daf71[_0x80b7('0x9c')]===-0x1){return _0x5daf71;}return this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')](_0x80b7('0xbc'),_0x80b7('0x167'),_0x4a2400));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x168')]=function(_0x33e359){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x169'),_0x33e359[_0x80b7('0x31')]));if(!this['isConfigured'](_0x33e359[_0x80b7('0x16a')])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x33e359,_0x80b7('0x16b'));}var _0x41a5b4='';var _0x54e209=parseInt(_0x33e359[_0x80b7('0x16a')],0xa);if(isNaN(_0x54e209)){_0x41a5b4=_0x33e359[_0x80b7('0x16a')];}else{_0x41a5b4=this['getVoiceQueue'][_0x80b7('0x67')](this,_0x33e359['queue_id']);if(!_0x41a5b4){return this['channel'][_0x80b7('0x29')](_0x33e359,_0x80b7('0x16c'));}}var _0x3dfcb1='';if(this[_0x80b7('0x9f')](_0x33e359['file_id'])){var _0x3c42df=this[_0x80b7('0x1b')][_0x80b7('0x67')](this,_0x33e359['file_id']);if(_0x3c42df){_0x3dfcb1=_0x3c42df;}}this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x33e359,_0x41a5b4);if(_0x33e359['opts']['indexOf']('x')<0x0){_0x33e359['opts']+='x';}if(_0x33e359[_0x80b7('0xe2')][_0x80b7('0x16d')]('X')<0x0){_0x33e359[_0x80b7('0xe2')]+='X';}this[_0x80b7('0xc')][_0x80b7('0x9e')](_0x80b7('0x16e'),_0x41a5b4?_0x41a5b4['toLowerCase']():'');var _0x3d391f=this[_0x80b7('0xc')][_0x80b7('0x52')]('QUEUE',[_0x41a5b4,_0x33e359[_0x80b7('0xe2')],_0x33e359['url'],_0x3dfcb1,_0x33e359[_0x80b7('0x5d')],_0x33e359[_0x80b7('0x6')],_0x33e359[_0x80b7('0x16f')],_0x33e359[_0x80b7('0x170')],'',_0x33e359['position']]);if(_0x3d391f[_0x80b7('0x9c')]===-0x1){return _0x3d391f;}return this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0xbc'),_0x80b7('0x171'),_0x41a5b4));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x172')]=function(_0x266b10){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x173'),_0x266b10[_0x80b7('0x31')]));var _0x32c46c=_0x266b10[_0x80b7('0x174')]||'wav';var _0x160065=util[_0x80b7('0x4f')](_0x80b7('0x175'),this['channel'][_0x80b7('0x30')],rs[_0x80b7('0x114')](0x5));var _0x43a18c=util[_0x80b7('0x4f')](_0x80b7('0x176'),FILES_PATH,_0x160065,_0x32c46c);var _0x525d90=util[_0x80b7('0x4f')]('%s/recordings/%s',FILES_PATH,_0x160065);this[_0x80b7('0x177')][_0x80b7('0x67')](this,_0x266b10,_0x160065,_0x43a18c);this[_0x80b7('0xc')][_0x80b7('0x9e')](_0x80b7('0x178'),_0x160065);logger[_0x80b7('0x2a')](_0x80b7('0x179'),_0x525d90,_0x32c46c,_0x266b10[_0x80b7('0x17a')],_0x266b10['timeout']);return this[_0x80b7('0xc')][_0x80b7('0x12a')](_0x525d90,_0x32c46c,_0x266b10[_0x80b7('0x17a')],_0x266b10[_0x80b7('0x5d')],undefined,!![]);};AGIVertices['prototype'][_0x80b7('0x17b')]=function(_0x14803d){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x17c'),_0x14803d[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x14803d['url'])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x17d'));}var _0x1f19d3=this['restAPI'][_0x80b7('0x67')](this,_0x14803d);logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x17e'),util[_0x80b7('0x17f')](_0x1f19d3,{'showHidden':![],'depth':null})));if(!this[_0x80b7('0x9f')](_0x14803d['variable_id'])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x180'));}var _0x298550=this[_0x80b7('0x9b')][_0x80b7('0x67')](this,_0x14803d['variable_id']);if(!_0x298550){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x14803d,_0x80b7('0xd5'));}this[_0x80b7('0xc')][_0x80b7('0x9e')](util[_0x80b7('0x4f')]('%s_STATUS_CODE',_0x298550),_0x1f19d3['statusCode']?_0x1f19d3[_0x80b7('0x6c')]:_0x80b7('0x181'));this[_0x80b7('0xc')][_0x80b7('0x9e')](util[_0x80b7('0x4f')]('%s_STATUS_MESSAGE',_0x298550),_0x1f19d3[_0x80b7('0x6d')]?_0x1f19d3[_0x80b7('0x6d')]:'OK');if(_0x1f19d3[_0x80b7('0x6a')]){try{this[_0x80b7('0x96')](_0x1f19d3[_0x80b7('0x6a')],_0x298550);}catch(_0x3c0edd){logger['error'](util[_0x80b7('0x4f')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x298550));}}return this['channel'][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('variable\x20%s\x20set',_0x298550));};AGIVertices['prototype'][_0x80b7('0x182')]=function(_0x264b57){logger[_0x80b7('0x2a')](util['format'](_0x80b7('0x183'),_0x264b57[_0x80b7('0x31')]));return this['channel'][_0x80b7('0x184')](_0x264b57[_0x80b7('0x185')][_0x80b7('0xd1')](/\s+/g,''),_0x264b57[_0x80b7('0x17a')]);};AGIVertices[_0x80b7('0xe')][_0x80b7('0x186')]=function(_0x4af667){logger['info'](util[_0x80b7('0x4f')](_0x80b7('0x187'),_0x4af667[_0x80b7('0x31')]));return this['channel'][_0x80b7('0x188')](_0x4af667[_0x80b7('0x5e')][_0x80b7('0xd1')](/\s+/g,''),_0x4af667[_0x80b7('0x17a')]);};AGIVertices[_0x80b7('0xe')]['sayphonetic']=function(_0x5bee1b){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x189'),_0x5bee1b[_0x80b7('0x31')]));return this[_0x80b7('0xc')][_0x80b7('0x18a')](_0x5bee1b[_0x80b7('0x56')],_0x5bee1b['escape_digits']);};AGIVertices[_0x80b7('0xe')][_0x80b7('0x18b')]=function(_0x50cd27){logger['info'](util['format'](_0x80b7('0x18c'),_0x50cd27[_0x80b7('0x31')]));if(!this['isConfigured'](_0x50cd27[_0x80b7('0x18d')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x18e'));}var _0x18ea16=this[_0x80b7('0x1f')][_0x80b7('0x67')](this,_0x50cd27[_0x80b7('0x18d')]);if(!_0x18ea16||!_0x18ea16['Smtp']){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x50cd27,_0x80b7('0x18f'));}var _0x4068cb={'from':util[_0x80b7('0x4f')]('\x22%s\x22\x20<%s>',_0x18ea16['name'],_0x18ea16['email']||_0x18ea16[_0x80b7('0x190')][_0x80b7('0x191')]),'to':_0x50cd27['to']||'','cc':_0x50cd27['cc']||'','bcc':_0x50cd27[_0x80b7('0x192')]||'','subject':_0x50cd27[_0x80b7('0x193')],'html':_0x50cd27[_0x80b7('0x56')],'text':_0x50cd27['text']};if(this[_0x80b7('0x9f')](_0x50cd27[_0x80b7('0x194')])){}logger[_0x80b7('0x195')]('sendMail\x20message',JSON[_0x80b7('0x69')](_0x4068cb));this['createSquareDetailsReport'][_0x80b7('0x67')](this,_0x50cd27,_0x50cd27[_0x80b7('0x18d')]);this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x18ea16['name']));this[_0x80b7('0x21')][_0x80b7('0x67')](this,_0x18ea16[_0x80b7('0x196')],_0x4068cb);return this[_0x80b7('0xc')][_0x80b7('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x80b7('0xe')][_0x80b7('0x197')]=function(_0x15a0ff){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x15a0ff[_0x80b7('0x31')]));return this[_0x80b7('0xc')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x80b7('0x198')]=function(_0x42f87a){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x42f87a[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x42f87a[_0x80b7('0x199')])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x19a'));}var _0xd857bd=this[_0x80b7('0x19b')]['sync'](this,_0x42f87a[_0x80b7('0x199')]);if(!_0xd857bd){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x42f87a,'no\x20sms\x20account\x20found');}var _0x5405c4={'body':_0x42f87a[_0x80b7('0x19c')],'phone':_0x42f87a['to']||'','SmsAccountId':_0xd857bd['id']};logger[_0x80b7('0x195')](_0x80b7('0x19d'),JSON[_0x80b7('0x69')](_0x5405c4));this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x42f87a,_0x42f87a[_0x80b7('0x199')]);this['channel']['noop'](util['format'](_0x80b7('0x19e'),_0xd857bd[_0x80b7('0x11')]));this[_0x80b7('0x2e')][_0x80b7('0x67')](this,_0x5405c4);return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x19f'));};AGIVertices['prototype'][_0x80b7('0x1a0')]=function(_0x321abc){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x1a1'),_0x321abc[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x321abc[_0x80b7('0xd3')])){return this['channel'][_0x80b7('0x29')](_0x321abc,_0x80b7('0x1a2'));}var _0x16a24e=this[_0x80b7('0x9b')][_0x80b7('0x67')](this,_0x321abc[_0x80b7('0xd3')]);if(!_0x16a24e){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x321abc,_0x80b7('0xd5'));}return this[_0x80b7('0xc')]['setVariable'](_0x16a24e,_0x321abc[_0x80b7('0x1a3')]);};AGIVertices['prototype'][_0x80b7('0x1a4')]=function(_0x1fc9ab){logger[_0x80b7('0x2a')](util['format'](_0x80b7('0x1a5'),_0x1fc9ab[_0x80b7('0x31')]));this[_0x80b7('0xc')]['noop']('START\x20CALLY\x20SQUARE');var _0x1f3ba1=this[_0x80b7('0xc')]['getVariable'](_0x80b7('0x1a6'));if(!_['isEmpty'](_0x1f3ba1[_0x80b7('0x9a')])){this['channel'][_0x80b7('0x30')]=_0x1f3ba1[_0x80b7('0x9a')];}if(_0x1fc9ab[_0x80b7('0x1a7')]===_0x80b7('0x1a8')){this[_0x80b7('0xc')]['noop'](_0x80b7('0x1a9'));return this[_0x80b7('0xc')]['answer']();}return this[_0x80b7('0xc')]['noop'](_0x80b7('0x1aa'));};AGIVertices[_0x80b7('0xe')]['subproject']=function(_0xd81157){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x1ab'),_0xd81157[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0xd81157[_0x80b7('0x1ac')])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0xd81157,'no\x20subproject\x20selected');}var _0x118f43=this[_0x80b7('0x14')][_0x80b7('0x67')](this,_0xd81157[_0x80b7('0x1ac')]);if(!this[_0x80b7('0x9f')](_0x118f43)){return this[_0x80b7('0xc')]['error'](_0xd81157,util[_0x80b7('0x4f')](_0x80b7('0x1ad'),_0xd81157[_0x80b7('0x1ac')]));}if(_0x118f43===this[_0x80b7('0xc')]['arg_1']){return this['channel'][_0x80b7('0x29')](_0xd81157,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x80b7('0x2f')]['sync'](this,_0xd81157,_0x118f43);var _0x1ed9ab=this['channel'][_0x80b7('0x52')](_0x80b7('0x1ae'),util[_0x80b7('0x4f')](_0x80b7('0x1af'),config[_0x80b7('0x6')]['host']||_0x80b7('0x1b0'),_0x118f43,this[_0x80b7('0xc')]['arg_1']));if(_0x1ed9ab[_0x80b7('0x9c')]===-0x1){return _0x1ed9ab;}return this[_0x80b7('0xc')][_0x80b7('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0x80b7('0x1ae'),_0x118f43));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x1b1')]=function(_0x14e2fb){logger[_0x80b7('0x2a')](util['format'](_0x80b7('0x1b2'),_0x14e2fb['label']));var _0x2438e1=this[_0x80b7('0x51')][_0x80b7('0x67')](this,_0x14e2fb['command']);this[_0x80b7('0x2f')][_0x80b7('0x67')](this,_0x14e2fb,_0x14e2fb[_0x80b7('0x1b3')]);if(this[_0x80b7('0x9f')](_0x14e2fb[_0x80b7('0xd3')])){var _0x3b4e77=this['getVariable'][_0x80b7('0x67')](this,_0x14e2fb[_0x80b7('0xd3')]);if(_0x3b4e77){this[_0x80b7('0xc')]['setVariable'](_0x3b4e77,_0x2438e1);return this['channel'][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x1b4'),_0x14e2fb['command'],_0x3b4e77));}}return this['channel']['noop'](util[_0x80b7('0x4f')](_0x80b7('0x1b5'),_0x14e2fb['command']));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x1b6')]=function(_0x5e8289){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x1b7'),_0x5e8289[_0x80b7('0x31')]));_0x5e8289[_0x80b7('0x56')]=_0x5e8289['text'][_0x80b7('0xd1')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5e8289['apiKey'])){return this[_0x80b7('0xc')][_0x80b7('0xa7')](_0x80b7('0x1b8'));}if(!this['isConfigured'](_0x5e8289[_0x80b7('0x56')])){return this[_0x80b7('0xc')]['noop'](_0x80b7('0xbf'));}this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x1b9'),_0x5e8289[_0x80b7('0x56')]));var _0x2a3f83=this[_0x80b7('0x54')][_0x80b7('0x67')](this,_0x5e8289);if(_0x2a3f83){this[_0x80b7('0xc')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2a3f83));var _0x47d67a=this[_0x80b7('0xc')][_0x80b7('0xfe')](_0x2a3f83);try{fs[_0x80b7('0xff')](_0x2a3f83+_0x80b7('0x11e'));}catch(_0x1fc9d0){logger[_0x80b7('0x29')](_0x1fc9d0);}return _0x47d67a;}return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x5e8289,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x80b7('0xe')][_0x80b7('0x1ba')]=function(_0x553aa4){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x1bb'),_0x553aa4[_0x80b7('0x31')]));_0x553aa4[_0x80b7('0x56')]=_0x553aa4[_0x80b7('0x56')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x80b7('0x9f')](_0x553aa4[_0x80b7('0x56')])){return this['channel']['noop'](_0x80b7('0xbf'));}this[_0x80b7('0xc')][_0x80b7('0xa7')](util['format'](_0x80b7('0x1bc'),_0x553aa4[_0x80b7('0x56')]));var _0x94197f=this[_0x80b7('0x59')]['sync'](this,_0x553aa4);if(_0x94197f){this[_0x80b7('0xc')]['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x94197f));var _0x138d59=this[_0x80b7('0xc')][_0x80b7('0xfe')](_0x94197f);try{fs[_0x80b7('0xff')](_0x94197f+_0x80b7('0x11e'));}catch(_0x1b0954){logger['error'](_0x1b0954);}return _0x138d59;}return this[_0x80b7('0xc')]['error'](_0x553aa4,_0x80b7('0x1bd'));};AGIVertices[_0x80b7('0xe')]['unpause']=function(_0x248c15){logger['info'](util[_0x80b7('0x4f')](_0x80b7('0x1be'),_0x248c15['label']));if(!this[_0x80b7('0x9f')](_0x248c15['findBy'])){return this[_0x80b7('0xc')][_0x80b7('0x29')](_0x248c15,_0x80b7('0x150'));}logger['info'](util[_0x80b7('0x4f')](_0x80b7('0x151'),this[_0x80b7('0xc')][_0x80b7('0x34')],_0x248c15[_0x80b7('0x152')]));var _0x1ebf9e=this[_0x80b7('0x4b')][_0x80b7('0x67')](this,_0x248c15[_0x80b7('0x152')]);if(_0x1ebf9e){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x80b7('0xc')]['callerid'],_0x248c15[_0x80b7('0x152')]));this[_0x80b7('0xc')]['noop'](util[_0x80b7('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x80b7('0xc')]['callerid'],_0x248c15[_0x80b7('0x152')]));return{'code':0xc8,'result':_0x80b7('0x158')};}else{logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x154'),this[_0x80b7('0xc')]['callerid'],_0x248c15[_0x80b7('0x152')]));this[_0x80b7('0xc')][_0x80b7('0xa7')](util[_0x80b7('0x4f')](_0x80b7('0x154'),this[_0x80b7('0xc')][_0x80b7('0x34')],_0x248c15[_0x80b7('0x152')]));return{'code':0xc8,'result':_0x80b7('0x155')};}};AGIVertices[_0x80b7('0xe')][_0x80b7('0x1bf')]=function(_0x3955f9){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x1c0'),_0x3955f9[_0x80b7('0x31')]));var _0x2d5d65=this[_0x80b7('0xc')][_0x80b7('0x52')](_0x80b7('0x1c1'),[_0x3955f9[_0x80b7('0x1c2')],_0x3955f9[_0x80b7('0x70')]]);if(_0x2d5d65[_0x80b7('0x9c')]===-0x1){return _0x2d5d65;}return this['channel']['noop'](util[_0x80b7('0x4f')](_0x80b7('0xbc'),_0x80b7('0x1c1'),_0x3955f9[_0x80b7('0x1c2')]));};AGIVertices[_0x80b7('0xe')][_0x80b7('0x1c3')]=function(_0x6d2070){logger[_0x80b7('0x2a')](util[_0x80b7('0x4f')](_0x80b7('0x1c4'),_0x6d2070[_0x80b7('0x31')]));if(!this[_0x80b7('0x9f')](_0x6d2070[_0x80b7('0xd3')])){return this['channel'][_0x80b7('0x29')](_0x6d2070,_0x80b7('0x1a2'));}var _0x4579c4=this[_0x80b7('0x9b')][_0x80b7('0x67')](this,_0x6d2070[_0x80b7('0xd3')]);if(!_0x4579c4){return this[_0x80b7('0xc')]['error'](_0x6d2070,_0x80b7('0xd5'));}var _0x16a607=this[_0x80b7('0xc')][_0x80b7('0x9b')](_0x4579c4);return{'code':0xc8,'result':_0x16a607[_0x80b7('0x9a')]?_0x16a607[_0x80b7('0x9a')]:'-'};};String[_0x80b7('0xe')][_0x80b7('0x99')]=function(_0x557eb6,_0x12dfb4){return this[_0x80b7('0x98')](_0x557eb6)[_0x80b7('0x1c5')](_0x12dfb4);};module[_0x80b7('0x1c6')]=AGIVertices; \ No newline at end of file +var _0xed95=['SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','generate','hiddendigitspos','first','substr','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','%s/recordings/%s','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','no\x20subproject\x20selected','getSquareProject','project_id','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','host','127.0.0.1','system','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','Google\x20TTS\x20%s\x20file\x20created','unpause','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUserById','name','getTrunk','getTrunkById','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','timeout','number','includes','POST','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','computedVariables','sync','render','url','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','agicommand','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','no\x20list\x20selected','add','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query','no\x20query\x20configured','replace','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name'];(function(_0x8792a1,_0x5d2f49){var _0x2c380f=function(_0x5432b0){while(--_0x5432b0){_0x8792a1['push'](_0x8792a1['shift']());}};_0x2c380f(++_0x5d2f49);}(_0xed95,0xb9));var _0x5ed9=function(_0x46bbe7,_0x325560){_0x46bbe7=_0x46bbe7-0x0;var _0x26fb8c=_0xed95[_0x46bbe7];return _0x26fb8c;};'use strict';var fs=require('fs');var util=require(_0x5ed9('0x0'));var _=require(_0x5ed9('0x1'));var sh=require(_0x5ed9('0x2'));var odbc=require(_0x5ed9('0x3'))();var rs=require(_0x5ed9('0x4'));var moment=require(_0x5ed9('0x5'));var Mustache=require(_0x5ed9('0x6'));var rp=require(_0x5ed9('0x7'));var logger=require(_0x5ed9('0x8'))(_0x5ed9('0x9'));var config=require(_0x5ed9('0xa'));var scripts=require(_0x5ed9('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x5ed9('0xc')];var verticesWithRetry=[_0x5ed9('0xd'),_0x5ed9('0xe'),_0x5ed9('0xf')];var AGIVertices=function(_0x2d5474,_0x40e8eb,_0x5b48b1){this['channel']=_0x2d5474;this[_0x5ed9('0x10')]=_0x40e8eb;this[_0x5ed9('0x11')]=_0x5b48b1;};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x13')]=function(_0x526924,_0x575782){this[_0x5ed9('0x10')][_0x5ed9('0x14')](_0x526924)[_0x5ed9('0x15')](function(_0x2ed72e){_0x575782(null,_0x2ed72e?_0x2ed72e['name']:![]);})[_0x5ed9('0x16')](function(_0x110d83){_0x575782(_0x110d83);});};AGIVertices[_0x5ed9('0x12')]['getVoiceQueue']=function(_0x56695a,_0x3de296){this[_0x5ed9('0x10')]['getVoiceQueueById'](_0x56695a)[_0x5ed9('0x15')](function(_0x34ed28){_0x3de296(null,_0x34ed28?_0x34ed28['name']:![]);})['catch'](function(_0x1d2d60){_0x3de296(_0x1d2d60);});};AGIVertices[_0x5ed9('0x12')]['getSquareProject']=function(_0x3de09e,_0x10b784){this['rpc'][_0x5ed9('0x17')](_0x3de09e)[_0x5ed9('0x15')](function(_0x54a570){_0x10b784(null,_0x54a570?_0x54a570['name']:![]);})['catch'](function(_0x510ffe){_0x10b784(_0x510ffe);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x18')]=function(_0x3892d8,_0x44b8ca){this['rpc'][_0x5ed9('0x19')](_0x3892d8)[_0x5ed9('0x15')](function(_0x5cb2c1){_0x44b8ca(null,_0x5cb2c1?_0x5cb2c1['dsn']:![]);})['catch'](function(_0x302ec1){_0x44b8ca(_0x302ec1);});};AGIVertices[_0x5ed9('0x12')]['getUser']=function(_0x5eda05,_0xe7680){this[_0x5ed9('0x10')][_0x5ed9('0x1a')](_0x5eda05)['then'](function(_0x18b8c8){_0xe7680(null,_0x18b8c8?_0x18b8c8[_0x5ed9('0x1b')]:![]);})[_0x5ed9('0x16')](function(_0x40244e){_0xe7680(_0x40244e);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1c')]=function(_0x5da4d5,_0x492f36){this[_0x5ed9('0x10')][_0x5ed9('0x1d')](_0x5da4d5)[_0x5ed9('0x15')](function(_0x5b56df){_0x492f36(null,_0x5b56df?_0x5b56df['name']:![]);})[_0x5ed9('0x16')](function(_0x3a4968){_0x492f36(_0x3a4968);});};AGIVertices[_0x5ed9('0x12')]['getSound']=function(_0x1bc137,_0x7de1d2){var _0x389a73=this;this['rpc'][_0x5ed9('0x1e')](_0x1bc137)[_0x5ed9('0x15')](function(_0x411729){_0x7de1d2(null,_0x411729?_0x389a73[_0x5ed9('0x1f')](_0x411729['save_name']):![]);})['catch'](function(_0x43863c){_0x7de1d2(_0x43863c);});};AGIVertices['prototype'][_0x5ed9('0x20')]=function(_0xb39190,_0x1585e3){this[_0x5ed9('0x10')][_0x5ed9('0x21')](_0xb39190)[_0x5ed9('0x15')](function(_0xba5b97){_0x1585e3(null,_0xba5b97?_0xba5b97:![]);})['catch'](function(_0x58e2d0){_0x1585e3(_0x58e2d0);});};AGIVertices['prototype'][_0x5ed9('0x22')]=function(_0x36d050,_0x2cb3d2,_0x5da46e){this[_0x5ed9('0x11')]['sendMailMessage'](_0x36d050,_0x2cb3d2)[_0x5ed9('0x15')](function(){_0x5da46e(null);})[_0x5ed9('0x16')](function(_0x3061cd){_0x5da46e(_0x3061cd);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x23')]=function(_0x448778,_0x4a6567){this[_0x5ed9('0x10')][_0x5ed9('0x24')](_0x448778)[_0x5ed9('0x15')](function(_0x4c573e){if(_0x4c573e){if(_0x4c573e['IntervalId']){_0x4a6567(null,[_0x4c573e[_0x5ed9('0x25')]]);}else{_0x4a6567(null,_[_0x5ed9('0x26')](_0x4c573e['Intervals'],'interval'));}}else{_0x4a6567(null,![]);}})[_0x5ed9('0x16')](function(_0x1536c3){_0x4a6567(_0x1536c3);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1f')]=function(_0x29346d){return util[_0x5ed9('0x27')](_0x5ed9('0x28'),FILES_PATH,_0x29346d);};AGIVertices[_0x5ed9('0x12')]['getQueryOdbc']=function(_0x4bfe28,_0x59896b,_0x4699a0){odbc[_0x5ed9('0x29')](_0x4bfe28,function(_0x4f261f){if(_0x4f261f){logger[_0x5ed9('0x2a')](_0x5ed9('0x2b'),_0x4f261f);_0x4699a0(_0x4f261f);}else{logger[_0x5ed9('0x2c')](_0x5ed9('0x2d'));odbc['query'](_0x59896b,function(_0x34e190,_0x89486e){if(_0x34e190){logger[_0x5ed9('0x2c')](_0x5ed9('0x2e'),_0x59896b);_0x4699a0(_0x34e190);}else{logger[_0x5ed9('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x59896b);odbc[_0x5ed9('0x2f')](function(_0x2f728e){if(_0x2f728e){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x2f728e);}_0x4699a0(null,_0x89486e);});}});}});};AGIVertices[_0x5ed9('0x12')]['getSmsAccount']=function(_0x4fedbe,_0x5a9287){this[_0x5ed9('0x10')][_0x5ed9('0x30')](_0x4fedbe)['then'](function(_0x5f20a1){_0x5a9287(null,_0x5f20a1?_0x5f20a1:![]);})[_0x5ed9('0x16')](function(_0xb6ac0d){_0x5a9287(_0xb6ac0d);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x31')]=function(_0x3c4bbe,_0x3e844b){this[_0x5ed9('0x10')][_0x5ed9('0x31')](_0x3c4bbe)[_0x5ed9('0x15')](function(_0xbc9f61){_0x3e844b(null,_0xbc9f61);})[_0x5ed9('0x16')](function(_0xba8cc){_0x3e844b(_0xba8cc);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x32')]=function(_0x5b61af,_0x4494d1,_0x18bf88){this[_0x5ed9('0x10')][_0x5ed9('0x32')]({'uniqueid':this[_0x5ed9('0x33')]['uniqueid'],'node':_0x5b61af[_0x5ed9('0x34')],'application':_0x5b61af['agicommand'],'data':_0x4494d1||null,'project_name':this[_0x5ed9('0x33')][_0x5ed9('0x35')],'callerid':this[_0x5ed9('0x33')][_0x5ed9('0x36')]})[_0x5ed9('0x15')](function(_0x38e960){if(_0x18bf88){_0x18bf88(null,_0x38e960);}})[_0x5ed9('0x16')](function(_0x53c64f){if(_0x18bf88){_0x18bf88(_0x53c64f);}});};AGIVertices['prototype'][_0x5ed9('0x37')]=function(_0x41a1bf,_0x5a0ea6,_0x39ea43,_0x290508){this['rpc']['createSquareRecording']({'uniqueid':this[_0x5ed9('0x33')][_0x5ed9('0x38')],'callerid':this['channel'][_0x5ed9('0x36')],'calleridname':this[_0x5ed9('0x33')][_0x5ed9('0x39')],'context':this[_0x5ed9('0x33')][_0x5ed9('0x3a')],'extension':this[_0x5ed9('0x33')][_0x5ed9('0x3b')],'priority':this[_0x5ed9('0x33')][_0x5ed9('0x3c')],'accountcode':this[_0x5ed9('0x33')][_0x5ed9('0x3d')],'dnid':this[_0x5ed9('0x33')][_0x5ed9('0x3e')],'projectName':this['channel'][_0x5ed9('0x35')],'saveName':_0x5a0ea6,'filename':_0x41a1bf[_0x5ed9('0x3f')]||_0x5a0ea6,'savePath':_0x39ea43})[_0x5ed9('0x15')](function(_0x5e6515){_0x290508(null,_0x5e6515);})[_0x5ed9('0x16')](function(_0x4e65ed){_0x290508(_0x4e65ed);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x40')]=function(_0x1acd7b,_0x77d6df,_0x24b54,_0x3717fb,_0x17c434){this[_0x5ed9('0x10')][_0x5ed9('0x40')]({'uniqueid':this[_0x5ed9('0x33')][_0x5ed9('0x38')],'body':_0x1acd7b,'direction':_0x77d6df,'providerName':_0x24b54,'providerResponse':_0x3717fb})[_0x5ed9('0x15')](function(_0x533510){if(_0x17c434){_0x17c434(null,_0x533510);}})[_0x5ed9('0x16')](function(_0x1b5ff9){if(_0x17c434){_0x17c434(_0x1b5ff9);}});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x41')]=function(_0x2ca6d7,_0x550892){this['rpc']['createCmContact']({'firstName':_['isEmpty'](_0x2ca6d7['name'])||_[_0x5ed9('0x42')](_0x2ca6d7[_0x5ed9('0x1b')])?_0x5ed9('0x43')+Math[_0x5ed9('0x44')]():_0x2ca6d7[_0x5ed9('0x1b')],'lastName':_[_0x5ed9('0x45')](_0x2ca6d7[_0x5ed9('0x46')])||_[_0x5ed9('0x42')](_0x2ca6d7[_0x5ed9('0x46')])?null:_0x2ca6d7[_0x5ed9('0x46')],'phone':_0x2ca6d7[_0x5ed9('0x47')],'ListId':_0x2ca6d7[_0x5ed9('0x48')],'scheduledat':_0x2ca6d7[_0x5ed9('0x49')],'callbackUniqueid':this[_0x5ed9('0x33')]['uniqueid'],'tags':_0x5ed9('0x4a'),'description':_0x5ed9('0x4b')+_0x2ca6d7[_0x5ed9('0x49')][_0x5ed9('0x4c')](),'priority':_0x2ca6d7[_0x5ed9('0x4d')]})[_0x5ed9('0x15')](function(_0x5a090d){_0x550892(null,_0x5a090d);})[_0x5ed9('0x16')](function(_0x5dda6c){_0x550892(_0x5dda6c);});};AGIVertices['prototype'][_0x5ed9('0x4e')]=function(_0x53206f,_0x8fe239){this[_0x5ed9('0x10')]['getPauseById'](_0x53206f)[_0x5ed9('0x15')](function(_0x1bf047){_0x8fe239(null,_0x1bf047?_0x1bf047[_0x5ed9('0x1b')]:![]);})[_0x5ed9('0x16')](function(_0x573530){_0x8fe239(_0x573530);});};AGIVertices['prototype']['agentPause']=function(_0x354f7a,_0x2a66a6,_0x5f41d6){var _0x2e6f74={'role':_0x5ed9('0x4f')};_0x2e6f74[_0x354f7a]=this['channel'][_0x5ed9('0x36')];this[_0x5ed9('0x10')]['agentPause'](_0x2e6f74,_0x2a66a6,this[_0x5ed9('0x33')][_0x5ed9('0x38')])[_0x5ed9('0x15')](function(_0x4acc3d){_0x5f41d6(null,_[_0x5ed9('0x42')](_0x4acc3d)?![]:!![]);})[_0x5ed9('0x16')](function(_0x33f184){logger[_0x5ed9('0x2a')](_0x33f184);_0x5f41d6(null,![]);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x50')]=function(_0x21be65,_0xe72d99){var _0x59ecf6={'role':_0x5ed9('0x4f')};_0x59ecf6[_0x21be65]=this[_0x5ed9('0x33')][_0x5ed9('0x36')];this[_0x5ed9('0x10')][_0x5ed9('0x50')](_0x59ecf6)[_0x5ed9('0x15')](function(_0x252cac){_0xe72d99(null,_[_0x5ed9('0x42')](_0x252cac)?![]:!![]);})[_0x5ed9('0x16')](function(_0x1f6767){logger[_0x5ed9('0x2a')](_0x1f6767);_0xe72d99(null,![]);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x51')]=function(_0xa68a6c,_0x1e6c73){var _0x3d51b6={'role':'agent'};_0x3d51b6[_0xa68a6c]=this[_0x5ed9('0x33')][_0x5ed9('0x36')];this['rpc'][_0x5ed9('0x51')](_0x3d51b6)[_0x5ed9('0x15')](function(_0x15b345){_0x1e6c73(null,_[_0x5ed9('0x42')](_0x15b345)?![]:!![]);})[_0x5ed9('0x16')](function(_0x23e16d){logger[_0x5ed9('0x2a')](_0x23e16d);_0x1e6c73(null,![]);});};AGIVertices[_0x5ed9('0x12')]['agentLogin']=function(_0x30b77e,_0x575398){var _0x510c19={'role':_0x5ed9('0x4f')};_0x510c19[_0x30b77e]=this[_0x5ed9('0x33')][_0x5ed9('0x36')];var _0x570fc3=_0x30b77e!=_0x5ed9('0x52')?util[_0x5ed9('0x27')](_0x5ed9('0x53'),_0x5ed9('0x54'),this[_0x5ed9('0x33')][_0x5ed9('0x36')]):undefined;this[_0x5ed9('0x10')]['agentLogin'](_0x510c19,_0x570fc3)['then'](function(_0x4d387c){_0x575398(null,_[_0x5ed9('0x42')](_0x4d387c)?![]:!![]);})[_0x5ed9('0x16')](function(_0x5c15d3){logger[_0x5ed9('0x2a')](_0x5c15d3);_0x575398(null,![]);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x55')]=function(_0x31efd8,_0x18b411){sh[_0x5ed9('0x56')](_[_0x5ed9('0x57')](_0x31efd8),function(_0x279257,_0x1c0012){var _0x246763=_0x1c0012['replace'](/(\r\n|\n|\r)/gm,'');_0x18b411(null,_0x246763);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x58')]=function(_0x19d09c,_0x36768c){scripts[_0x5ed9('0x58')](_0x19d09c[_0x5ed9('0x59')],_0x19d09c[_0x5ed9('0x5a')]||_0x5ed9('0x5b'),_0x19d09c[_0x5ed9('0x5b')],_0x19d09c[_0x5ed9('0x5c')]||_0x5ed9('0x5d'),_0x19d09c[_0x5ed9('0x5e')]||_0x5ed9('0x5f'),_0x19d09c['audioEncoding']||_0x5ed9('0x60'))['then'](function(_0x28d100){_0x36768c(null,_0x28d100);})[_0x5ed9('0x16')](function(_0x5aa5a8){_0x36768c(_0x5aa5a8);});};AGIVertices['prototype']['googleTTS']=function(_0x1088ef,_0x29f0f3){scripts[_0x5ed9('0x61')](_0x1088ef[_0x5ed9('0x5b')],_0x1088ef[_0x5ed9('0x62')]||'en',0x1)['then'](function(_0x5c05a4){_0x29f0f3(null,_0x5c05a4);})[_0x5ed9('0x16')](function(_0x2dba3b){_0x29f0f3(_0x2dba3b);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x63')]=function(_0x55821c,_0x5bf1c0){var _0xbe0e06={'uri':_0x55821c['url'],'method':_0x55821c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x55821c[_0x5ed9('0x64')])===_0x5ed9('0x65')&&parseInt(_0x55821c[_0x5ed9('0x64')])>=0x1?parseInt(_0x55821c['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x5ed9('0x66')]([_0x5ed9('0x67'),'PUT'],_0xbe0e06[_0x5ed9('0x68')][_0x5ed9('0x69')]())){try{_0xbe0e06[_0x5ed9('0x6a')]=_0x55821c[_0x5ed9('0xc')]?JSON['parse'](_0x55821c[_0x5ed9('0xc')]):{};}catch(_0x5bdb42){logger[_0x5ed9('0x2a')](_0x5ed9('0x6b'),_0x5bdb42);}}try{_0xbe0e06[_0x5ed9('0x6c')]=_0x55821c[_0x5ed9('0x6d')]?JSON[_0x5ed9('0x6e')](_0x55821c['rawHeaders']):{};}catch(_0x4d105e){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4d105e);}if(_0x55821c[_0x5ed9('0x6f')]){try{var _0xa3e738=require(_0x55821c[_0x5ed9('0x6f')])[_0x5ed9('0x70')](this,_0xbe0e06);_0xbe0e06['uri']=Mustache[_0x5ed9('0x71')](_0x55821c[_0x5ed9('0x72')],_0xa3e738,{},['$$','$$']);if(_0xbe0e06['headers']){_0xbe0e06[_0x5ed9('0x6c')]=JSON[_0x5ed9('0x6e')](Mustache[_0x5ed9('0x71')](JSON[_0x5ed9('0x73')](_0xbe0e06[_0x5ed9('0x6c')]),_0xa3e738,{},['$$','$$']));}if(_0xbe0e06['body']){_0xbe0e06[_0x5ed9('0x6a')]=JSON[_0x5ed9('0x6e')](Mustache[_0x5ed9('0x71')](JSON[_0x5ed9('0x73')](_0xbe0e06[_0x5ed9('0x6a')]),_0xa3e738,{},['$$','$$']));}}catch(_0x24d9fe){logger[_0x5ed9('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x24d9fe);}}rp(_0xbe0e06)[_0x5ed9('0x15')](function(_0x174a48){var _0x4200dd={'statusCode':_0x174a48[_0x5ed9('0x74')]||0xc8,'statusMessage':_0x174a48[_0x5ed9('0x75')]||'OK','headers':_0x174a48[_0x5ed9('0x6c')]||{},'body':_0x174a48['body']||{}};_0x5bf1c0(null,_0x4200dd);})[_0x5ed9('0x16')](function(_0x38176b){var _0x2fa06e={'statusCode':_0x38176b[_0x5ed9('0x74')]||0x1f4,'statusMessage':_0x38176b['message']||_0x5ed9('0x76'),'headers':_0x38176b['options'][_0x5ed9('0x6c')]||{},'body':_0x38176b[_0x5ed9('0x77')][_0x5ed9('0x6a')]||{}};_0x5bf1c0(null,_0x2fa06e);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x78')]=function(_0x5db252,_0x37b98a){scripts[_0x5ed9('0x78')](this[_0x5ed9('0x33')][_0x5ed9('0x38')],_0x5db252['key'],_0x5db252[_0x5ed9('0x5b')],_0x5db252[_0x5ed9('0x79')]||'en')[_0x5ed9('0x15')](function(_0x5d5ff3){_0x37b98a(null,_0x5d5ff3);})[_0x5ed9('0x16')](function(_0x44afb0){_0x37b98a(_0x44afb0);});};AGIVertices['prototype'][_0x5ed9('0x7a')]=function(_0x2d8868,_0x2164f1){scripts['googleDialogflowV2'](this[_0x5ed9('0x33')][_0x5ed9('0x38')],_0x2d8868[_0x5ed9('0x7b')],_0x2d8868[_0x5ed9('0x7c')],_0x2d8868[_0x5ed9('0x7d')],_0x2d8868[_0x5ed9('0x5b')],_0x2d8868[_0x5ed9('0x7e')]||'en')[_0x5ed9('0x15')](function(_0x43c8c7){_0x2164f1(null,_0x43c8c7);})[_0x5ed9('0x16')](function(_0x9a16d5){_0x2164f1(_0x9a16d5);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x7f')]=function(_0x548fee,_0x1185c8){scripts[_0x5ed9('0x7f')](this[_0x5ed9('0x33')],_0x548fee)[_0x5ed9('0x15')](function(_0x5bc97c){_0x1185c8(null,_0x5bc97c);})['catch'](function(_0x12fc45){_0x1185c8(_0x12fc45);});};AGIVertices[_0x5ed9('0x12')]['ispeechTTS']=function(_0x508e02,_0x1ddcc8){scripts['ispeechTTS'](_0x508e02[_0x5ed9('0x80')],_0x508e02[_0x5ed9('0x5b')],_0x508e02[_0x5ed9('0x81')]||_0x5ed9('0x5d'),_0x508e02[_0x5ed9('0x82')])[_0x5ed9('0x15')](function(_0x5d5d10){_0x1ddcc8(null,_0x5d5d10);})['catch'](function(_0x323e4f){_0x1ddcc8(_0x323e4f);});};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x83')]=function(_0x3fad48,_0x511069,_0x2da35f){scripts['ispeechASR'](_0x511069,_0x3fad48[_0x5ed9('0x80')],_0x3fad48[_0x5ed9('0x84')]||_0x5ed9('0x5d'),this[_0x5ed9('0x85')](_0x3fad48[_0x5ed9('0x86')])?_0x3fad48['model']:undefined)[_0x5ed9('0x15')](function(_0x1d8ce2){_0x2da35f(null,_0x1d8ce2);})[_0x5ed9('0x16')](function(_0x3994a0){_0x2da35f(_0x3994a0);});};AGIVertices['prototype']['awsPolly']=function(_0x4701a2,_0x4b84ad){scripts[_0x5ed9('0x87')](_0x4701a2[_0x5ed9('0x88')],_0x4701a2['aws_secret_access_key'],_0x4701a2['aws_polly_region'],_0x4701a2['aws_polly_voice']||_0x5ed9('0x89'),_0x4701a2[_0x5ed9('0x5b')],_0x4701a2[_0x5ed9('0x8a')]||'text')[_0x5ed9('0x15')](function(_0x4d438e){_0x4b84ad(null,_0x4d438e);})[_0x5ed9('0x16')](function(_0x46629f){_0x4b84ad(_0x46629f);});};AGIVertices[_0x5ed9('0x12')]['awsLex']=function(_0xa2b99e,_0x1481bf){scripts[_0x5ed9('0x8b')](this[_0x5ed9('0x33')][_0x5ed9('0x38')],_0xa2b99e[_0x5ed9('0x88')],_0xa2b99e[_0x5ed9('0x8c')],_0xa2b99e[_0x5ed9('0x8d')],_0xa2b99e[_0x5ed9('0x5b')],_0xa2b99e[_0x5ed9('0x8e')])[_0x5ed9('0x15')](function(_0x2b1032){_0x1481bf(null,_0x2b1032);})[_0x5ed9('0x16')](function(_0x308015){_0x1481bf(_0x308015);});};AGIVertices[_0x5ed9('0x12')]['googleASR']=function(_0x16c26e,_0xbd9ea,_0x5ad38f){scripts[_0x5ed9('0x8f')](_0xbd9ea,_0x16c26e[_0x5ed9('0x80')],_0x16c26e['google_asr_language']||_0x5ed9('0x5d'))['then'](function(_0x28a050){_0x5ad38f(null,_0x28a050);})[_0x5ed9('0x16')](function(_0x23f6dc){_0x5ad38f(_0x23f6dc);});};AGIVertices[_0x5ed9('0x12')]['tildeASR']=function(_0x3b9d38,_0x483aa0,_0x203dbd){scripts[_0x5ed9('0x90')](_0x483aa0,_0x3b9d38[_0x5ed9('0x91')],_0x3b9d38[_0x5ed9('0x92')],_0x3b9d38[_0x5ed9('0x93')])[_0x5ed9('0x15')](function(_0xda9d33){_0x203dbd(null,_0xda9d33);})[_0x5ed9('0x16')](function(_0x97d3aa){_0x203dbd(_0x97d3aa);});};AGIVertices[_0x5ed9('0x12')]['clear']=function(_0x2d4236){var _0x7d5055=_[_0x5ed9('0x66')](verticesWithRetry,_0x2d4236[_0x5ed9('0x94')])?_0x2d4236:_['clone'](_0x2d4236);for(var _0x482ff1 in _0x7d5055){if(_0x7d5055[_0x5ed9('0x95')](_0x482ff1)){if(_0x7d5055[_0x482ff1]&&_['isString'](_0x7d5055[_0x482ff1])){if(_[_0x5ed9('0x66')](recursiveMapAttributes,_0x482ff1)){_0x7d5055[_0x482ff1]=this['replaceObjectAllVariables'](_0x7d5055[_0x482ff1]);}else{_0x7d5055[_0x482ff1]=this[_0x5ed9('0x96')](_0x7d5055[_0x482ff1]);}}}}return _0x7d5055;};AGIVertices['prototype'][_0x5ed9('0x97')]=function(_0x28abb9){for(var _0x14b4c0 in _0x28abb9){if(_0x28abb9[_0x5ed9('0x95')](_0x14b4c0)){if(_['isPlainObject'](_0x28abb9[_0x14b4c0])){this['recursiveNodeIndex'](_0x28abb9[_0x14b4c0]);}else if(_[_0x5ed9('0x98')](_0x28abb9[_0x14b4c0])){for(var _0x4a8455=0x0;_0x4a8455<_0x28abb9[_0x14b4c0][_0x5ed9('0x99')];_0x4a8455++){this[_0x5ed9('0x97')](_0x28abb9[_0x14b4c0][_0x4a8455]);}}else if(_[_0x5ed9('0x9a')](_0x28abb9[_0x14b4c0])){_0x28abb9[_0x14b4c0]=this[_0x5ed9('0x96')](_0x28abb9[_0x14b4c0]);}}}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x9b')]=function(_0x442c46,_0x5638d0){for(var _0xd776a7 in _0x442c46){if(_0x442c46[_0x5ed9('0x95')](_0xd776a7)){if(_[_0x5ed9('0x9c')](_0x442c46[_0xd776a7])){if(!_[_0x5ed9('0x45')](_0x442c46[_0xd776a7])){this[_0x5ed9('0x9b')](_0x442c46[_0xd776a7],util[_0x5ed9('0x27')](_0x5ed9('0x9d'),_0x5638d0,_0xd776a7));}}else if(_[_0x5ed9('0x98')](_0x442c46[_0xd776a7])){for(var _0xc7e0ae=0x0;_0xc7e0ae<_0x442c46[_0xd776a7][_0x5ed9('0x99')];_0xc7e0ae++){this[_0x5ed9('0x9b')](_0x442c46[_0xd776a7][_0xc7e0ae],util[_0x5ed9('0x27')]('%s.%s',_0x5638d0,_0xd776a7+'['+_0xc7e0ae+']'));}}else{if(!_[_0x5ed9('0x42')](_0x442c46[_0xd776a7])){this['channel'][_0x5ed9('0x9e')](util[_0x5ed9('0x27')](_0x5ed9('0x9d'),_0x5638d0,_0xd776a7),_0x442c46[_0xd776a7]);}}}}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x9f')]=function(_0x27ebd5){try{var _0xfb4219=JSON[_0x5ed9('0x6e')](_0x27ebd5);this['recursiveNodeIndex'](_0xfb4219);return JSON['stringify'](_0xfb4219);}catch(_0x4a13f6){return this[_0x5ed9('0x96')](_0x27ebd5);}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x96')]=function(_0x776c98){var _0xcd09fc=_0x776c98[_0x5ed9('0xa0')]('{');for(var _0x203b55=0x1;_0x203b55<_0xcd09fc[_0x5ed9('0x99')];_0x203b55+=0x1){var _0x437d69=_0xcd09fc[_0x203b55]['split']('}');if(_0x437d69[_0x5ed9('0x99')]>0x1){_0x776c98=_0x776c98[_0x5ed9('0xa1')]('{'+_0x437d69[0x0]+'}',this[_0x5ed9('0x33')][_0x5ed9('0x13')](_0x437d69[0x0])[_0x5ed9('0xa2')]||_0x437d69[0x0]);}}if(_0xcd09fc[_0x5ed9('0x99')]===0x1){return _0x776c98[_0x5ed9('0x4c')]();}return this['replaceAllVariables'](_0x776c98);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xa3')]=function(_0x2e143f,_0x5e6f9f){var _0x5d6141=this[_0x5ed9('0x33')][_0x5ed9('0x13')](_0x2e143f);if(_0x5d6141[_0x5ed9('0xa4')]===-0x1){return _0x5d6141;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5e6f9f,_0x5d6141[_0x5ed9('0xa2')]));return this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x5e6f9f,_0x5d6141[_0x5ed9('0xa2')]);};AGIVertices['prototype']['isConfigured']=function(_0x5d5b6d){return _0x5d5b6d&&_0x5d5b6d!=='0'&&_0x5d5b6d!=='-1'&&_0x5d5b6d!=='';};AGIVertices[_0x5ed9('0x12')]['maxRetry']=function(_0xee1a2d){this[_0x5ed9('0x32')]['sync'](this,_0xee1a2d,'-');_0xee1a2d[_0x5ed9('0xa5')]=_0xee1a2d[_0x5ed9('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xa7')]=function(_0x261853){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xa8'),_0x261853[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x261853['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}var _0x30846e='\x22'+_0x261853[_0x5ed9('0x5b')]+'\x22';if(this[_0x5ed9('0x85')](_0x261853['options'])){_0x30846e+=','+_0x261853[_0x5ed9('0x77')];}var _0x1f6a3c=this[_0x5ed9('0x33')]['exec'](_0x5ed9('0xab'),_0x30846e);if(_0x1f6a3c[_0x5ed9('0xa4')]===-0x1){return _0x1f6a3c;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xac'),_0x30846e));};AGIVertices[_0x5ed9('0x12')]['mrcprecog']=function(_0x6fb15f){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xad'),_0x6fb15f[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x6fb15f[_0x5ed9('0xae')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20grammar\x20configured');}var _0x6d7e5e=_0x6fb15f['grammar'];if(this['isConfigured'](_0x6fb15f[_0x5ed9('0x77')])){_0x6d7e5e+=','+_0x6fb15f['options'];}var _0x5a714b=this[_0x5ed9('0x33')][_0x5ed9('0x56')]('MRCPRecog',_0x6d7e5e);if(_0x5a714b[_0x5ed9('0xa4')]===-0x1){return _0x5a714b;}var _0x4e3bd8=this[_0x5ed9('0xa3')](_0x5ed9('0xaf'),_0x5ed9('0xb0'));if(_0x4e3bd8['result']===-0x1){return _0x4e3bd8;}var _0x497fca=this['getAndSetVariable'](_0x5ed9('0xb1'),'MRCP_RECOG_TRANSCRIPT');if(_0x497fca['result']===-0x1){return _0x497fca;}var _0x5c0b01=this['getAndSetVariable'](_0x5ed9('0xb2'),_0x5ed9('0xb3'));if(_0x5c0b01[_0x5ed9('0xa4')]===-0x1){return _0x5c0b01;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x6d7e5e));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x9')]=function(_0x7ae298){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xb4'),_0x7ae298[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')][_0x5ed9('0x9')]([_0x7ae298[_0x5ed9('0xb5')],_0x7ae298[_0x5ed9('0xb6')]]);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xb7')]=function(_0x1dcc51){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xb8'),_0x1dcc51[_0x5ed9('0x34')]));if(this[_0x5ed9('0x85')](_0x1dcc51['timeout'])){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0xb9'),_0x1dcc51[_0x5ed9('0x64')]));var _0x20d284=this[_0x5ed9('0x33')]['wait'](_0x1dcc51['timeout']);if(_0x20d284[_0x5ed9('0xa4')]===-0x1){return _0x20d284;}}return this['channel'][_0x5ed9('0xb7')]();};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x4a')]=function(_0x455a84){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x455a84[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x455a84[_0x5ed9('0x48')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x455a84,_0x5ed9('0xba'));}_0x455a84[_0x5ed9('0x49')]=moment();if(this[_0x5ed9('0x85')](_0x455a84['delay'])){_0x455a84[_0x5ed9('0x49')]=moment()[_0x5ed9('0xbb')](_0x455a84[_0x5ed9('0xbc')],_0x5ed9('0xbd'));}if(!this[_0x5ed9('0x85')](_0x455a84[_0x5ed9('0x4d')])){_0x455a84[_0x5ed9('0x4d')]=0x2;}this[_0x5ed9('0x41')][_0x5ed9('0x70')](this,_0x455a84);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x455a84[_0x5ed9('0x47')],_0x455a84[_0x5ed9('0x48')],_0x455a84[_0x5ed9('0x49')]));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xbe')]=function(_0x11fdcf){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xbf'),_0x11fdcf[_0x5ed9('0x34')]));var _0x87b220=this[_0x5ed9('0x33')]['exec'](_0x11fdcf[_0x5ed9('0xc0')],_0x11fdcf['options']);if(_0x87b220[_0x5ed9('0xa4')]===-0x1){return _0x87b220;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s\x20%s',_0x11fdcf[_0x5ed9('0xc0')],_0x11fdcf[_0x5ed9('0x77')]));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xc1')]=function(_0xacf47e){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xc2'),_0xacf47e[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0xacf47e['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}var _0x416f88='\x22'+_0xacf47e['text']+'\x22';if(this[_0x5ed9('0x85')](_0xacf47e[_0x5ed9('0x77')])){_0x416f88+=','+_0xacf47e[_0x5ed9('0x77')];}var _0x436b73=this[_0x5ed9('0x33')][_0x5ed9('0x56')]('MRCPSynth',_0x416f88);if(_0x436b73[_0x5ed9('0xa4')]===-0x1){return _0x436b73;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x416f88));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xc3')]=function(_0x22b027){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xc4'),_0x22b027[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x22b027['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}var _0x3ca355='\x22'+_0x22b027['text']+'\x22';if(this[_0x5ed9('0x85')](_0x22b027[_0x5ed9('0x77')])){_0x3ca355+=','+_0x22b027['options'];}var _0x594af1=this['channel']['exec'](_0x5ed9('0xab'),_0x3ca355);if(_0x594af1['result']===-0x1){return _0x594af1;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xac'),_0x3ca355));};AGIVertices['prototype']['lumenvoxasr']=function(_0x2f079c){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0xc5'),_0x2f079c[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x2f079c['grammar'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xc6'));}var _0x5f0fc3=_0x2f079c[_0x5ed9('0xae')];if(this[_0x5ed9('0x85')](_0x2f079c[_0x5ed9('0x77')])){_0x5f0fc3+=','+_0x2f079c['options'];}var _0x552d8b=this[_0x5ed9('0x33')][_0x5ed9('0x56')](_0x5ed9('0xc7'),_0x5f0fc3);if(_0x552d8b[_0x5ed9('0xa4')]===-0x1){return _0x552d8b;}var _0x57a8f5=this[_0x5ed9('0xa3')](_0x5ed9('0xaf'),_0x5ed9('0xc8'));if(_0x57a8f5[_0x5ed9('0xa4')]===-0x1){return _0x57a8f5;}var _0x339976=this[_0x5ed9('0xa3')]('RECOG_INPUT()',_0x5ed9('0xc9'));if(_0x339976[_0x5ed9('0xa4')]===-0x1){return _0x339976;}var _0x48de82=this['getAndSetVariable'](_0x5ed9('0xb2'),_0x5ed9('0xca'));if(_0x48de82[_0x5ed9('0xa4')]===-0x1){return _0x48de82;}return this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xcb'),_0x5f0fc3));};AGIVertices[_0x5ed9('0x12')]['sestekasr']=function(_0x1b1be0){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0xcc'),_0x1b1be0[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x1b1be0['grammar'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xc6'));}var _0x52412c=_0x1b1be0[_0x5ed9('0xae')];if(this[_0x5ed9('0x85')](_0x1b1be0[_0x5ed9('0x77')])){_0x52412c+=','+_0x1b1be0[_0x5ed9('0x77')];}var _0x4b8d23=this[_0x5ed9('0x33')]['exec']('MRCPRecog',_0x52412c);if(_0x4b8d23[_0x5ed9('0xa4')]===-0x1){return _0x4b8d23;}var _0x51ef1f=this[_0x5ed9('0xa3')](_0x5ed9('0xaf'),_0x5ed9('0xcd'));if(_0x51ef1f[_0x5ed9('0xa4')]===-0x1){return _0x51ef1f;}var _0x5835e9=this[_0x5ed9('0xa3')](_0x5ed9('0xb1'),'SESTEK_ASR_TRANSCRIPT');if(_0x5835e9[_0x5ed9('0xa4')]===-0x1){return _0x5835e9;}var _0x38719c=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x38719c['result']===-0x1){return _0x38719c;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xcb'),_0x52412c));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xce')]=function(_0x42fefd){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0xcf'),_0x42fefd[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x42fefd[_0x5ed9('0xd0')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x42fefd,'no\x20database\x20selected');}var _0x3c86d9=this[_0x5ed9('0x18')][_0x5ed9('0x70')](this,_0x42fefd['odbc_id']);if(!_0x3c86d9){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x42fefd,'no\x20odbc\x20database\x20found');}if(!this[_0x5ed9('0x85')](_0x42fefd[_0x5ed9('0xd1')])){return this['channel'][_0x5ed9('0x2a')](_0x42fefd,_0x5ed9('0xd2'));}var _0x4cb62c=_0x42fefd['query'][_0x5ed9('0xd3')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x5ed9('0xa9')](util['format']('query:\x20%s',_0x4cb62c));var _0x36205b=this[_0x5ed9('0xd4')][_0x5ed9('0x70')](this,_0x3c86d9,_0x4cb62c);this['createSquareDetailsReport']['sync'](this,_0x42fefd,_0x4cb62c);if(!this[_0x5ed9('0x85')](_0x42fefd['variable_id'])){return this[_0x5ed9('0x33')]['noop'](_0x5ed9('0xd5'));}var _0x18e11f=this[_0x5ed9('0x13')]['sync'](this,_0x42fefd[_0x5ed9('0xd6')]);if(!_0x18e11f){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x42fefd,_0x5ed9('0xd7'));}var _0x21f0d2=this;_0x36205b[_0x5ed9('0xd8')](function(_0xb381c2,_0x583c90){Object[_0x5ed9('0xd9')](_0xb381c2)[_0x5ed9('0xd8')](function(_0x4c668f){_0x21f0d2[_0x5ed9('0x33')][_0x5ed9('0x9e')](util[_0x5ed9('0x27')](_0x5ed9('0xda'),_0x18e11f,_0x583c90,_0x4c668f),_0xb381c2[_0x4c668f]);});});this['channel'][_0x5ed9('0x9e')](util[_0x5ed9('0x27')](_0x5ed9('0xdb'),_0x18e11f),_0x36205b[_0x5ed9('0x99')]);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xdc'),_0x18e11f));};AGIVertices[_0x5ed9('0x12')]['dial']=function(_0x3178af){logger[_0x5ed9('0xdd')](util[_0x5ed9('0x27')](_0x5ed9('0xde'),_0x3178af['label']));if(!this['isConfigured'](_0x3178af[_0x5ed9('0xdf')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3178af,_0x5ed9('0xe0'));}var _0x2d9594=this['getUser'][_0x5ed9('0x70')](this,_0x3178af[_0x5ed9('0xdf')]);if(!_0x2d9594){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3178af,'no\x20user\x20found');}var _0x330de6=this[_0x5ed9('0x33')][_0x5ed9('0x56')](_0x5ed9('0xe1'),[util[_0x5ed9('0x27')](_0x5ed9('0xe2'),_0x2d9594),_0x3178af[_0x5ed9('0x64')],_0x3178af[_0x5ed9('0xe3')],_0x3178af['url']]);if(_0x330de6[_0x5ed9('0xa4')]===-0x1){return _0x330de6;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x572dc2){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0xe4'),_0x572dc2[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x572dc2[_0x5ed9('0x80')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0xe5'));}if(!this[_0x5ed9('0x85')](_0x572dc2[_0x5ed9('0x5b')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')][_0x5ed9('0xe6')]=!![];this[_0x5ed9('0x32')](_0x572dc2);this[_0x5ed9('0x40')](_0x572dc2[_0x5ed9('0x5b')],'in','','');this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format']('Trying\x20Dialogflow:\x20%s',_0x572dc2[_0x5ed9('0x5b')]));var _0x60630d=this[_0x5ed9('0x78')][_0x5ed9('0x70')](this,_0x572dc2);if(_0x60630d){for(var _0x1a0cf8 in _0x60630d){if(_0x60630d['hasOwnProperty'](_0x1a0cf8)){this[_0x5ed9('0x33')]['setVariable'](util['format'](_0x5ed9('0xe7'),_0x1a0cf8[_0x5ed9('0x69')]()),_0x60630d[_0x1a0cf8]);}}this['createSquareMessage'](_0x60630d[_0x5ed9('0xe8')],_0x5ed9('0xe9'),_0x5ed9('0xea'),'');return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format'](_0x5ed9('0xeb'),_0x60630d['speech']));}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x572dc2,_0x5ed9('0xec'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xed')]=function(_0x323db1){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x323db1[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x7b')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xee'));}if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x7c')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xef'));}if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x7d')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20private_key\x20configured');}if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x7e')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xf0'));}if(!this[_0x5ed9('0x85')](_0x323db1[_0x5ed9('0x5b')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this['channel'][_0x5ed9('0xe6')]=!![];this[_0x5ed9('0x32')](_0x323db1);this[_0x5ed9('0x40')](_0x323db1['text'],'in','','');this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xf1'),_0x323db1[_0x5ed9('0x5b')]));var _0x1eec46=this[_0x5ed9('0x7a')][_0x5ed9('0x70')](this,_0x323db1);if(_0x1eec46){for(var _0x24eed6 in _0x1eec46){if(_0x1eec46[_0x5ed9('0x95')](_0x24eed6)){if(_0x24eed6!==_0x5ed9('0xf2')){this[_0x5ed9('0x33')]['setVariable'](util[_0x5ed9('0x27')](_0x5ed9('0xe7'),_0x24eed6[_0x5ed9('0x69')]()),_0x1eec46[_0x24eed6]);}}}this[_0x5ed9('0x40')](_0x1eec46['speech'],'out',_0x5ed9('0xed'),_0x1eec46[_0x5ed9('0xf2')]);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format'](_0x5ed9('0xf3'),_0x1eec46[_0x5ed9('0xe8')]));}return this['channel'][_0x5ed9('0x2a')](_0x323db1,_0x5ed9('0xf4'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xf5')]=function(_0x21dc3e){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0xf6'),_0x21dc3e['label']));if(!this[_0x5ed9('0x85')](_0x21dc3e[_0x5ed9('0xf7')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xf8'));}if(!this[_0x5ed9('0x85')](_0x21dc3e[_0x5ed9('0xf9')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xfa'));}if(!this[_0x5ed9('0x85')](_0x21dc3e[_0x5ed9('0xfb')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20password\x20configured');}if(!this[_0x5ed9('0x85')](_0x21dc3e['ndassistant_url'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20text\x20configured');}this[_0x5ed9('0x33')][_0x5ed9('0xe6')]=!![];this[_0x5ed9('0x32')](_0x21dc3e);this['createSquareMessage'](_0x21dc3e['text'],'in','','');this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xfc'),_0x21dc3e[_0x5ed9('0x5b')]));var _0x49a0e8=this['sestekNDA']['sync'](this,_0x21dc3e);if(_0x49a0e8){for(var _0x4b95b7 in _0x49a0e8){if(_0x49a0e8[_0x5ed9('0x95')](_0x4b95b7)){this[_0x5ed9('0x33')]['setVariable'](util['format'](_0x5ed9('0xfd'),_0x4b95b7['toUpperCase']()),_0x49a0e8[_0x4b95b7]);}}this[_0x5ed9('0x40')](_0x49a0e8[_0x5ed9('0xe8')],_0x5ed9('0xe9'),_0x5ed9('0xf5'),'');if(_0x49a0e8[_0x5ed9('0xfe')]){this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0xff'),_0x49a0e8[_0x5ed9('0xfe')]));var _0x547ebc=this[_0x5ed9('0x33')]['streamFile'](_0x49a0e8[_0x5ed9('0xfe')]);try{fs[_0x5ed9('0x100')](_0x49a0e8[_0x5ed9('0xfe')]+_0x5ed9('0x101'));}catch(_0x3dd1ea){logger[_0x5ed9('0x2a')](_0x3dd1ea);}return _0x547ebc;}else{return this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('SestekNDA\x20Result\x20%s',_0x49a0e8['speech']));}}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x21dc3e,_0x5ed9('0x102'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x103')]=function(_0x1b20a8){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x104'),_0x1b20a8[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x103'));};AGIVertices['prototype']['ext_dial']=function(_0x283620){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x283620[_0x5ed9('0x34')]));var _0x1eb44e='';if(_0x283620['trunk_id']){if(!this['isConfigured'](_0x283620[_0x5ed9('0x105')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x283620,_0x5ed9('0x106'));}else{var _0x1350e7=parseInt(_0x283620[_0x5ed9('0x105')],0xa);if(isNaN(_0x1350e7)){_0x1eb44e=_0x283620[_0x5ed9('0x105')];}else{_0x1eb44e=this[_0x5ed9('0x1c')][_0x5ed9('0x70')](this,_0x283620['trunk_id']);if(!_0x1eb44e){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x283620,_0x5ed9('0x107'));}}}}else if(_0x283620[_0x5ed9('0x108')]){_0x1eb44e=_0x283620['trunk_name'];}else{return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x283620,_0x5ed9('0x106'));}var _0x2e6cc0=this[_0x5ed9('0x33')][_0x5ed9('0x56')](_0x5ed9('0xe1'),[util['format'](_0x5ed9('0x109'),_0x1eb44e,_0x283620[_0x5ed9('0x47')]),_0x283620['timeout'],_0x283620[_0x5ed9('0xe3')],_0x283620[_0x5ed9('0x72')]]);if(_0x2e6cc0['result']===-0x1){return _0x2e6cc0;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x10a'),'DIAL'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x10b')]=function(_0x5700e1){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5700e1['label']));return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('finally');};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xe')]=function(_0x3c2e8c){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x10c'),_0x3c2e8c[_0x5ed9('0x34')]));if(_0x3c2e8c[_0x5ed9('0xa5')]===0x0){return this[_0x5ed9('0xa6')](_0x3c2e8c);}_0x3c2e8c[_0x5ed9('0xa5')]-=0x1;if(!this[_0x5ed9('0x85')](_0x3c2e8c[_0x5ed9('0x10d')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3c2e8c,_0x5ed9('0x10e'));}var _0x7f634f=this[_0x5ed9('0x10f')][_0x5ed9('0x70')](this,_0x3c2e8c['file_id']);if(!_0x7f634f){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3c2e8c,_0x5ed9('0x110'));}if(!this[_0x5ed9('0x85')](_0x3c2e8c[_0x5ed9('0xd6')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x5ed9('0xd5'));}var _0x4d7fab=this[_0x5ed9('0x33')][_0x5ed9('0x111')](_0x7f634f,_0x3c2e8c[_0x5ed9('0x112')],_0x3c2e8c[_0x5ed9('0x113')]);var _0x27500b=_0x4d7fab['result']?_0x4d7fab[_0x5ed9('0xa4')][_0x5ed9('0x4c')]():'';logger['info'](_0x5ed9('0x114'),JSON[_0x5ed9('0x73')](_0x4d7fab));if(_0x4d7fab[_0x5ed9('0xa4')]===-0x1){this[_0x5ed9('0x32')]['sync'](this,_0x3c2e8c,_0x27500b);return _0x4d7fab;}else if(_0x4d7fab['extra']===_0x5ed9('0x64')){_0x4d7fab['result']=_0x27500b[_0x5ed9('0x99')]>=parseInt(_0x3c2e8c['mindigit'])?'x':'i';}else{_0x4d7fab[_0x5ed9('0xa4')]=_0x27500b[_0x5ed9('0x99')]>=parseInt(_0x3c2e8c[_0x5ed9('0x115')])&&_0x27500b['length']<=parseInt(_0x3c2e8c[_0x5ed9('0x113')])?'x':'i';}var _0x37efee=this[_0x5ed9('0x13')][_0x5ed9('0x70')](this,_0x3c2e8c[_0x5ed9('0xd6')]);if(!_0x37efee){return this['channel'][_0x5ed9('0x2a')](_0x3c2e8c,'no\x20variable\x20found');}this['channel'][_0x5ed9('0x9e')](_0x37efee,_0x27500b);if(this[_0x5ed9('0x85')](_0x3c2e8c['hiddendigitsnum'])){var _0x548288=parseInt(_0x3c2e8c['hiddendigitsnum'],0xa);var _0x15a414=rs[_0x5ed9('0x116')]({'charset':'*','length':_0x548288});var _0x4b0f73=_0x27500b[_0x5ed9('0x99')];if(_0x4b0f73>0x0){if(_0x4b0f73>_0x548288){this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x3c2e8c,_0x3c2e8c[_0x5ed9('0x117')]===_0x5ed9('0x118')?_0x15a414+_0x27500b['substr'](_0x548288):_0x27500b[_0x5ed9('0x119')](0x0,_0x4b0f73-_0x548288)+_0x15a414);}else{this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x3c2e8c,rs[_0x5ed9('0x116')]({'charset':'*','length':_0x4b0f73}));}}else{this[_0x5ed9('0x32')]['sync'](this,_0x3c2e8c,'');}}else{this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x3c2e8c,_0x27500b);}return _0x4d7fab;};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0xf')]=function(_0x36ba69){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x36ba69[_0x5ed9('0x34')]));return this[_0x5ed9('0xe')](_0x36ba69);};AGIVertices[_0x5ed9('0x12')]['goal']=function(_0x51a1ee){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x11a'),_0x51a1ee[_0x5ed9('0x34')]));this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x51a1ee,_0x51a1ee[_0x5ed9('0x11b')]);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('GOAL\x20%s',_0x51a1ee[_0x5ed9('0x11b')]));};AGIVertices[_0x5ed9('0x12')]['awspolly']=function(_0x222287){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x11c'),_0x222287['label']));if(!this[_0x5ed9('0x85')](_0x222287['aws_access_key_id'])||!this['isConfigured'](_0x222287[_0x5ed9('0x8c')])){return this[_0x5ed9('0x33')]['noop'](_0x5ed9('0x11d'));}if(!this['isConfigured'](_0x222287['text'])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')]['noop'](util['format'](_0x5ed9('0x11e'),_0x222287['text']));var _0x54e644=this[_0x5ed9('0x87')][_0x5ed9('0x70')](this,_0x222287);if(_0x54e644){this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('aws\x20Polly\x20%s\x20file\x20created',_0x54e644));var _0x11bef2=this[_0x5ed9('0x33')][_0x5ed9('0x11f')](_0x54e644);try{fs[_0x5ed9('0x100')](_0x54e644+_0x5ed9('0x101'));}catch(_0x19ed70){logger[_0x5ed9('0x2a')](_0x19ed70);}return _0x11bef2;}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x222287,_0x5ed9('0x120'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x121')]=function(_0x51aebd){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x122'),_0x51aebd[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x51aebd[_0x5ed9('0x88')])||!this[_0x5ed9('0x85')](_0x51aebd[_0x5ed9('0x8c')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x11d'));}if(!this['isConfigured'](_0x51aebd['aws_bot_name'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x123'));}if(!this[_0x5ed9('0x85')](_0x51aebd[_0x5ed9('0x5b')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')]['bot']=!![];this[_0x5ed9('0x32')](_0x51aebd);this[_0x5ed9('0x40')](_0x51aebd[_0x5ed9('0x5b')],'in','','');this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x124'),_0x51aebd[_0x5ed9('0x5b')]));var _0x3f2924=this[_0x5ed9('0x8b')]['sync'](this,_0x51aebd);if(_0x3f2924){for(var _0x1db916 in _0x3f2924){if(_0x3f2924[_0x5ed9('0x95')](_0x1db916)&&_[_0x5ed9('0x9a')](_0x3f2924[_0x1db916])){this['channel'][_0x5ed9('0x9e')](util['format']('AWS_LEX_%s',_0x1db916['toUpperCase']()),_0x3f2924[_0x1db916]);}}if(_[_0x5ed9('0x42')](_0x3f2924[_0x5ed9('0x125')])){return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x126'));}else{this['createSquareMessage'](_0x3f2924[_0x5ed9('0x125')],_0x5ed9('0xe9'),_0x5ed9('0x127'),'');return this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Amazon\x20Lex\x20Result\x20%s',_0x3f2924['message']));}}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x51aebd,_0x5ed9('0x128'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x129')]=function(_0x38fcf9){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x12a'),_0x38fcf9['label'],_0x38fcf9[_0x5ed9('0x64')]));if(!this[_0x5ed9('0x85')](_0x38fcf9[_0x5ed9('0x80')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xe5'));}var _0x1d8ba7=_0x5ed9('0x12b');var _0x2f360c=util[_0x5ed9('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x5ed9('0x116')](0x4));var _0x5a8d33=util['format'](_0x5ed9('0x9d'),_0x2f360c,_0x1d8ba7);var _0x59ae5d=!![];if(_0x38fcf9['beep']===_0x5ed9('0x12c')){_0x59ae5d=![];}var _0x5306e6=this['channel'][_0x5ed9('0x12d')](_0x2f360c,_0x1d8ba7,_0x38fcf9['intKey'],_0x38fcf9[_0x5ed9('0x64')],undefined,_0x59ae5d);if(_0x5306e6[_0x5ed9('0xa4')]!==-0x1){this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x12e'),_0x5a8d33));var _0x15f290=this['googleASR']['sync'](this,_0x38fcf9,_0x5a8d33);if(_0x15f290){for(var _0xba7ef1 in _0x15f290){if(_0x15f290[_0x5ed9('0x95')](_0xba7ef1)){this[_0x5ed9('0x33')][_0x5ed9('0x9e')](util[_0x5ed9('0x27')]('GOOGLE_ASR_%s',_0xba7ef1[_0x5ed9('0x69')]()),_0x15f290[_0xba7ef1]);}}return this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x12f'),JSON[_0x5ed9('0x73')](_0x15f290)));}}return _0x5306e6;};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x130')]=function(_0x402e3d){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x402e3d[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x402e3d[_0x5ed9('0x91')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20appid\x20configured');}if(!this[_0x5ed9('0x85')](_0x402e3d[_0x5ed9('0x92')])){return this['channel'][_0x5ed9('0xa9')]('no\x20appsecret\x20configured');}var _0x253951=_0x5ed9('0x12b');var _0x2e5cb6=util[_0x5ed9('0x27')](_0x5ed9('0x131'),FILES_PATH,rs[_0x5ed9('0x116')](0x4));var _0x5b569b=util[_0x5ed9('0x27')](_0x5ed9('0x9d'),_0x2e5cb6,_0x253951);var _0x5ce05c=!![];if(_0x402e3d[_0x5ed9('0x132')]===_0x5ed9('0x12c')){_0x5ce05c=![];}var _0x3b2384=this['channel'][_0x5ed9('0x12d')](_0x2e5cb6,_0x253951,_0x402e3d[_0x5ed9('0x133')],_0x402e3d['timeout'],undefined,_0x5ce05c);if(_0x3b2384[_0x5ed9('0xa4')]!==-0x1){this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x134'),_0x5b569b));var _0x35d9a4=this[_0x5ed9('0x90')][_0x5ed9('0x70')](this,_0x402e3d,_0x5b569b);if(_0x35d9a4){for(var _0xc9bb13 in _0x35d9a4){if(_0x35d9a4[_0x5ed9('0x95')](_0xc9bb13)){this[_0x5ed9('0x33')][_0x5ed9('0x9e')](util['format'](_0x5ed9('0x135'),_0xc9bb13[_0x5ed9('0x69')]()),_0x35d9a4[_0xc9bb13]);}}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x136'),JSON[_0x5ed9('0x73')](_0x35d9a4)));}}return _0x3b2384;};AGIVertices['prototype'][_0x5ed9('0x137')]=function(_0x321796){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x138'),_0x321796[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')][_0x5ed9('0x139')](_0x321796[_0x5ed9('0x3a')],_0x321796[_0x5ed9('0x3b')],_0x321796['priority']);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x13a')]=function(_0x3070f4){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x13b'),_0x3070f4[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x3070f4[_0x5ed9('0x13c')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3070f4,_0x5ed9('0x13d'));}try{var _0x28d63d=eval(_0x3070f4[_0x5ed9('0x13c')])?_0x5ed9('0x13e'):_0x5ed9('0x13f');this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x3070f4[_0x5ed9('0x13c')],_0x28d63d));return{'code':0xc8,'result':_0x28d63d};}catch(_0x1e50d6){return{'code':0xc8,'result':_0x5ed9('0x13f')};}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x140')]=function(_0x3dddbc){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3dddbc[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x3dddbc[_0x5ed9('0x141')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3dddbc,_0x5ed9('0x142'));}var _0x5a9989=this['getIntervals'][_0x5ed9('0x70')](this,_0x3dddbc[_0x5ed9('0x141')]);if(!_0x5a9989){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3dddbc,_0x5ed9('0x143'));}for(var _0xf96148=0x0;_0xf96148<_0x5a9989[_0x5ed9('0x99')];_0xf96148+=0x1){var _0x4d685b=this[_0x5ed9('0x33')][_0x5ed9('0x13')](util[_0x5ed9('0x27')](_0x5ed9('0x144'),_0x5a9989[_0xf96148]));if(_0x4d685b[_0x5ed9('0xa4')]===-0x1){return _0x4d685b;}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('IFTIME\x20%s\x20%s',_0x5a9989[_0xf96148],_0x4d685b[_0x5ed9('0xa2')]));if(_0x4d685b[_0x5ed9('0xa2')]===_0x5ed9('0x13e')){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('IFTIME\x20%s\x20%s',_0x5a9989[_0xf96148],_0x5ed9('0x13e')));this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')]('IFTIME\x20%s\x20%s',_0x5a9989[_0xf96148],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x145'),_0x5a9989[_0xf96148],_0x5ed9('0x13f')));this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x145'),_0x5a9989[_0xf96148],_0x5ed9('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x5ed9('0x146')]=function(_0x325e39){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x325e39[_0x5ed9('0x34')]));return this['channel'][_0x5ed9('0x146')]();};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x147')]=function(_0x3f86b8){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x148'),_0x3f86b8[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x3f86b8['key'])){return this[_0x5ed9('0x33')]['noop'](_0x5ed9('0xe5'));}var _0x17ddd9=_0x5ed9('0x12b');var _0x467271=util[_0x5ed9('0x27')](_0x5ed9('0x131'),FILES_PATH,rs[_0x5ed9('0x116')](0x4));var _0x5a7d12=util[_0x5ed9('0x27')](_0x5ed9('0x9d'),_0x467271,_0x17ddd9);var _0x5b4884=!![];if(_0x3f86b8[_0x5ed9('0x132')]===_0x5ed9('0x12c')){_0x5b4884=![];}var _0x2344a9=this[_0x5ed9('0x33')][_0x5ed9('0x12d')](_0x467271,_0x17ddd9,_0x3f86b8['intKey'],_0x3f86b8['timeout'],undefined,_0x5b4884);if(_0x2344a9['result']!==-0x1){this['channel'][_0x5ed9('0xa9')](util['format']('ispeech\x20%s\x20file\x20created',_0x5a7d12));var _0x2a0316=this['ispeechASR'][_0x5ed9('0x70')](this,_0x3f86b8,_0x5a7d12);if(_0x2a0316){for(var _0x46c75b in _0x2a0316){if(_0x2a0316[_0x5ed9('0x95')](_0x46c75b)){this[_0x5ed9('0x33')][_0x5ed9('0x9e')](util[_0x5ed9('0x27')](_0x5ed9('0x149'),_0x46c75b[_0x5ed9('0x69')]()),_0x2a0316[_0x46c75b]);}}return this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x14a'),JSON[_0x5ed9('0x73')](_0x2a0316)));}}return _0x2344a9;};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x14b')]=function(_0x37dc92){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x37dc92[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x37dc92[_0x5ed9('0x80')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x37dc92['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x14c'),_0x37dc92[_0x5ed9('0x5b')]));var _0x55558f=this[_0x5ed9('0x14d')]['sync'](this,_0x37dc92);if(_0x55558f){this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x14e'),_0x55558f));var _0x30f6ad=this[_0x5ed9('0x33')]['streamFile'](_0x55558f,_0x37dc92[_0x5ed9('0x133')]);try{fs[_0x5ed9('0x100')](_0x55558f+_0x5ed9('0x101'));}catch(_0x1e687f){logger[_0x5ed9('0x2a')](_0x1e687f);}return _0x30f6ad;}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x37dc92,_0x5ed9('0x14f'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x150')]=function(_0x5b7cf1){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x151'),_0x5b7cf1['label']));if(!this[_0x5ed9('0x85')](_0x5b7cf1[_0x5ed9('0x152')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x5b7cf1,_0x5ed9('0x153'));}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x154'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x5b7cf1['findBy']));var _0x2658cb=this['agentLogin']['sync'](this,_0x5b7cf1[_0x5ed9('0x152')]);if(_0x2658cb){logger['info'](util[_0x5ed9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5b7cf1[_0x5ed9('0x152')]));this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this['channel']['callerid'],_0x5b7cf1[_0x5ed9('0x152')]));return{'code':0xc8,'result':_0x5ed9('0x156')};}else{logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x157'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x5b7cf1[_0x5ed9('0x152')]));this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x157'),this[_0x5ed9('0x33')]['callerid'],_0x5b7cf1[_0x5ed9('0x152')]));return{'code':0xc8,'result':_0x5ed9('0x158')};}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x159')]=function(_0x223af1){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x15a'),_0x223af1['label']));if(!this[_0x5ed9('0x85')](_0x223af1['findBy'])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x223af1,_0x5ed9('0x153'));}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x154'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x223af1['findBy']));var _0x4c1b1a=this[_0x5ed9('0x51')]['sync'](this,_0x223af1['findBy']);if(_0x4c1b1a){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5ed9('0x33')]['callerid'],_0x223af1[_0x5ed9('0x152')]));this[_0x5ed9('0x33')]['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x223af1['findBy']));return{'code':0xc8,'result':_0x5ed9('0x156')};}else{logger['info'](util['format'](_0x5ed9('0x157'),this['channel'][_0x5ed9('0x36')],_0x223af1[_0x5ed9('0x152')]));this['channel'][_0x5ed9('0xa9')](util['format'](_0x5ed9('0x157'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x223af1[_0x5ed9('0x152')]));return{'code':0xc8,'result':_0x5ed9('0x158')};}};AGIVertices['prototype']['math']=function(_0x3f9fae){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x15b'),_0x3f9fae[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x3f9fae['operation'])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3f9fae,_0x5ed9('0x15c'));}this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x15d'),_0x3f9fae[_0x5ed9('0x15e')]));var _0x4b3cc6=eval(_0x3f9fae[_0x5ed9('0x15e')]);if(!this['isConfigured'](_0x3f9fae[_0x5ed9('0xd6')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3f8f1e=this[_0x5ed9('0x13')]['sync'](this,_0x3f9fae['variable_id']);if(!_0x3f8f1e){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3f9fae,_0x5ed9('0xd7'));}if(_['isArray'](_0x4b3cc6)){var _0xdf7514=this;_0x4b3cc6[_0x5ed9('0xd8')](function(_0x45697b,_0x4ad1c4){_0xdf7514[_0x5ed9('0x33')][_0x5ed9('0x9e')](util[_0x5ed9('0x27')]('%s[%s]',_0x3f8f1e,_0x4ad1c4),_0x45697b);});return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x15f'),_0x3f8f1e));}else{return this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x3f8f1e,_0x4b3cc6);}};AGIVertices[_0x5ed9('0x12')]['menu']=function(_0x387a20){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x160'),_0x387a20[_0x5ed9('0x34')]));if(_0x387a20[_0x5ed9('0xa5')]===0x0){return this[_0x5ed9('0xa6')](_0x387a20);}_0x387a20[_0x5ed9('0xa5')]-=0x1;if(!this[_0x5ed9('0x85')](_0x387a20[_0x5ed9('0x10d')])){return this['channel'][_0x5ed9('0x2a')](_0x387a20,_0x5ed9('0x10e'));}var _0x32c2d3=this[_0x5ed9('0x10f')][_0x5ed9('0x70')](this,_0x387a20['file_id']);if(!_0x32c2d3){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x387a20,'no\x20file\x20audio\x20found');}var _0x180e50=this[_0x5ed9('0x33')][_0x5ed9('0x111')](_0x32c2d3,_0x387a20['response'],_0x387a20[_0x5ed9('0x161')]);var _0x2cebad=_0x180e50['result'];if(_0x180e50[_0x5ed9('0xa4')]===-0x1){this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x387a20,'-1');return _0x180e50;}else if(_0x180e50[_0x5ed9('0xa2')]===_0x5ed9('0x64')){_0x180e50[_0x5ed9('0xa4')]=_0x180e50[_0x5ed9('0xa4')]['length']>0x0?_0x180e50['result']:'t';}else if(_[_0x5ed9('0x45')](_0x180e50['result'])){_0x180e50[_0x5ed9('0xa4')]='#';_0x2cebad='#';}if(!this['isConfigured'](_0x387a20['variable_id'])){this[_0x5ed9('0x33')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x78f076=this[_0x5ed9('0x13')]['sync'](this,_0x387a20[_0x5ed9('0xd6')]);if(!_0x78f076){return this['channel'][_0x5ed9('0x2a')](_0x387a20,_0x5ed9('0xd7'));}this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x78f076,_0x2cebad);}this['createSquareDetailsReport'][_0x5ed9('0x70')](this,_0x387a20,_0x2cebad);return _0x180e50;};AGIVertices['prototype'][_0x5ed9('0xa9')]=function(_0x1458ec){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x162'),_0x1458ec['label']));return this['channel'][_0x5ed9('0xa9')](_0x1458ec[_0x5ed9('0x163')]||_0x1458ec[_0x5ed9('0x34')]);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x164')]=function(_0x50d41e){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x165'),_0x50d41e['label']));if(!this[_0x5ed9('0x85')](_0x50d41e[_0x5ed9('0x152')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x50d41e,_0x5ed9('0x153'));}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x154'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e[_0x5ed9('0x152')]));var _0x17a0ea=this[_0x5ed9('0x4e')][_0x5ed9('0x70')](this,_0x50d41e[_0x5ed9('0x166')]);var _0x284d87=this[_0x5ed9('0x167')]['sync'](this,_0x50d41e[_0x5ed9('0x152')],_0x17a0ea);if(_0x284d87){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e[_0x5ed9('0x152')]));this['channel'][_0x5ed9('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e[_0x5ed9('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5ed9('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e[_0x5ed9('0x152')]));this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x50d41e['findBy']));return{'code':0xc8,'result':_0x5ed9('0x158')};}};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x168')]=function(_0x4c504c){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x169'),_0x4c504c[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x4c504c['file_id'])){return this['channel']['error'](_0x4c504c,_0x5ed9('0x10e'));}var _0x38c90c=this[_0x5ed9('0x10f')]['sync'](this,_0x4c504c[_0x5ed9('0x10d')]);if(!_0x38c90c){return this['channel'][_0x5ed9('0x2a')](_0x4c504c,'no\x20file\x20audio\x20found');}var _0xa420e3=this['channel'][_0x5ed9('0x56')](_0x5ed9('0x16a'),[_0x38c90c,_0x4c504c['opts']]);if(_0xa420e3[_0x5ed9('0xa4')]===-0x1){return _0xa420e3;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x38c90c));};AGIVertices[_0x5ed9('0x12')]['queue']=function(_0xfc8e0e){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xfc8e0e[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0xfc8e0e[_0x5ed9('0x16b')])){return this['channel']['error'](_0xfc8e0e,_0x5ed9('0x16c'));}var _0xddabbd='';var _0x2e0823=parseInt(_0xfc8e0e[_0x5ed9('0x16b')],0xa);if(isNaN(_0x2e0823)){_0xddabbd=_0xfc8e0e[_0x5ed9('0x16b')];}else{_0xddabbd=this[_0x5ed9('0x16d')][_0x5ed9('0x70')](this,_0xfc8e0e[_0x5ed9('0x16b')]);if(!_0xddabbd){return this[_0x5ed9('0x33')]['error'](_0xfc8e0e,'no\x20queue\x20found');}}var _0x5980d0='';if(this['isConfigured'](_0xfc8e0e['file_id'])){var _0x57a7e3=this[_0x5ed9('0x10f')][_0x5ed9('0x70')](this,_0xfc8e0e[_0x5ed9('0x10d')]);if(_0x57a7e3){_0x5980d0=_0x57a7e3;}}this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0xfc8e0e,_0xddabbd);if(_0xfc8e0e[_0x5ed9('0xe3')][_0x5ed9('0x16e')]('x')<0x0){_0xfc8e0e[_0x5ed9('0xe3')]+='x';}if(_0xfc8e0e['opts'][_0x5ed9('0x16e')]('X')<0x0){_0xfc8e0e[_0x5ed9('0xe3')]+='X';}this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x5ed9('0x16f'),_0xddabbd?_0xddabbd[_0x5ed9('0x170')]():'');var _0x54e3a9=this['channel'][_0x5ed9('0x56')](_0x5ed9('0x171'),[_0xddabbd,_0xfc8e0e['opts'],_0xfc8e0e[_0x5ed9('0x72')],_0x5980d0,_0xfc8e0e['timeout'],_0xfc8e0e[_0x5ed9('0x9')],_0xfc8e0e[_0x5ed9('0x172')],_0xfc8e0e[_0x5ed9('0x173')],'',_0xfc8e0e[_0x5ed9('0x174')]]);if(_0x54e3a9[_0x5ed9('0xa4')]===-0x1){return _0x54e3a9;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x175'),_0x5ed9('0x171'),_0xddabbd));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x176')]=function(_0x28f044){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x177'),_0x28f044[_0x5ed9('0x34')]));var _0x1b7a87=_0x28f044['recordingFormat']||'wav';var _0x33abf2=util[_0x5ed9('0x27')]('%s_%s',this['channel']['uniqueid'],rs[_0x5ed9('0x116')](0x5));var _0xf8a790=util[_0x5ed9('0x27')](_0x5ed9('0x178'),FILES_PATH,_0x33abf2,_0x1b7a87);var _0x1bc5d7=util['format']('%s/recordings/%s',FILES_PATH,_0x33abf2);this['createSquareRecording'][_0x5ed9('0x70')](this,_0x28f044,_0x33abf2,_0xf8a790);this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x5ed9('0x179'),_0x33abf2);logger[_0x5ed9('0x2c')](_0x5ed9('0x17a'),_0x1bc5d7,_0x1b7a87,_0x28f044[_0x5ed9('0x17b')],_0x28f044['timeout']);return this[_0x5ed9('0x33')][_0x5ed9('0x12d')](_0x1bc5d7,_0x1b7a87,_0x28f044[_0x5ed9('0x17b')],_0x28f044[_0x5ed9('0x64')],undefined,!![]);};AGIVertices[_0x5ed9('0x12')]['restapi']=function(_0x27a703){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x17c'),_0x27a703['label']));if(!this[_0x5ed9('0x85')](_0x27a703['url'])){return this[_0x5ed9('0x33')]['noop'](_0x5ed9('0x17d'));}var _0x5596e5=this['restAPI'][_0x5ed9('0x70')](this,_0x27a703);logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x17e'),util[_0x5ed9('0x17f')](_0x5596e5,{'showHidden':![],'depth':null})));if(!this[_0x5ed9('0x85')](_0x27a703[_0x5ed9('0xd6')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x180'));}var _0x48434a=this[_0x5ed9('0x13')]['sync'](this,_0x27a703[_0x5ed9('0xd6')]);if(!_0x48434a){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x27a703,_0x5ed9('0xd7'));}this[_0x5ed9('0x33')][_0x5ed9('0x9e')](util['format']('%s_STATUS_CODE',_0x48434a),_0x5596e5[_0x5ed9('0x74')]?_0x5596e5['statusCode']:_0x5ed9('0x181'));this[_0x5ed9('0x33')]['setVariable'](util[_0x5ed9('0x27')](_0x5ed9('0x182'),_0x48434a),_0x5596e5['statusMessage']?_0x5596e5[_0x5ed9('0x75')]:'OK');if(_0x5596e5[_0x5ed9('0x6a')]){try{this['saveRestApiResult'](_0x5596e5['body'],_0x48434a);}catch(_0x413e07){logger['error'](util[_0x5ed9('0x27')](_0x5ed9('0x183'),_0x48434a));}}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format']('variable\x20%s\x20set',_0x48434a));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x184')]=function(_0xc10fce){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x185'),_0xc10fce[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')]['sayDigits'](_0xc10fce[_0x5ed9('0x186')]['replace'](/\s+/g,''),_0xc10fce['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x3f219f){logger[_0x5ed9('0x2c')](util['format'](_0x5ed9('0x187'),_0x3f219f[_0x5ed9('0x34')]));return this[_0x5ed9('0x33')]['sayNumber'](_0x3f219f[_0x5ed9('0x65')]['replace'](/\s+/g,''),_0x3f219f[_0x5ed9('0x17b')]);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x188')]=function(_0xfa8f32){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x189'),_0xfa8f32[_0x5ed9('0x34')]));return this['channel']['sayPhonetic'](_0xfa8f32['text'],_0xfa8f32[_0x5ed9('0x17b')]);};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x18a')]=function(_0x2cbcd9){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x18b'),_0x2cbcd9[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x2cbcd9[_0x5ed9('0x18c')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x18d'));}var _0x5d5ca2=this[_0x5ed9('0x20')]['sync'](this,_0x2cbcd9[_0x5ed9('0x18c')]);if(!_0x5d5ca2||!_0x5d5ca2[_0x5ed9('0x18e')]){return this[_0x5ed9('0x33')]['error'](_0x2cbcd9,_0x5ed9('0x18f'));}var _0x19647b={'from':util[_0x5ed9('0x27')]('\x22%s\x22\x20<%s>',_0x5d5ca2[_0x5ed9('0x1b')],_0x5d5ca2[_0x5ed9('0x190')]||_0x5d5ca2['Smtp'][_0x5ed9('0x191')]),'to':_0x2cbcd9['to']||'','cc':_0x2cbcd9['cc']||'','bcc':_0x2cbcd9['bcc']||'','subject':_0x2cbcd9[_0x5ed9('0x192')],'html':_0x2cbcd9[_0x5ed9('0x5b')],'text':_0x2cbcd9[_0x5ed9('0x5b')]};if(this[_0x5ed9('0x85')](_0x2cbcd9['template_id'])){}logger[_0x5ed9('0xdd')]('sendMail\x20message',JSON[_0x5ed9('0x73')](_0x19647b));this['createSquareDetailsReport'][_0x5ed9('0x70')](this,_0x2cbcd9,_0x2cbcd9['account_id']);this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x193'),_0x5d5ca2[_0x5ed9('0x1b')]));this[_0x5ed9('0x22')][_0x5ed9('0x70')](this,_0x5d5ca2[_0x5ed9('0x194')],_0x19647b);return this['channel'][_0x5ed9('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x195')]=function(_0x162437){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x196'),_0x162437[_0x5ed9('0x34')]));return this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x197'));};AGIVertices['prototype'][_0x5ed9('0x198')]=function(_0x3e5a70){logger['info'](util['format'](_0x5ed9('0x199'),_0x3e5a70[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x3e5a70[_0x5ed9('0x19a')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x19b'));}var _0x12eaad=this['getSmsAccount'][_0x5ed9('0x70')](this,_0x3e5a70['sms_account_id']);if(!_0x12eaad){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x3e5a70,_0x5ed9('0x19c'));}var _0x5766a3={'body':_0x3e5a70[_0x5ed9('0x19d')],'phone':_0x3e5a70['to']||'','SmsAccountId':_0x12eaad['id']};logger[_0x5ed9('0xdd')]('sendSMS\x20message',JSON[_0x5ed9('0x73')](_0x5766a3));this['createSquareDetailsReport']['sync'](this,_0x3e5a70,_0x3e5a70['sms_account_id']);this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x12eaad[_0x5ed9('0x1b')]));this['createSmsMessage']['sync'](this,_0x5766a3);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x19e'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x19f')]=function(_0x54f2ae){logger['info'](util[_0x5ed9('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x54f2ae[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x54f2ae['variable_id'])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x54f2ae,'no\x20variable\x20selected');}var _0x6c58c8=this[_0x5ed9('0x13')][_0x5ed9('0x70')](this,_0x54f2ae[_0x5ed9('0xd6')]);if(!_0x6c58c8){return this[_0x5ed9('0x33')]['error'](_0x54f2ae,_0x5ed9('0xd7'));}return this[_0x5ed9('0x33')]['setVariable'](_0x6c58c8,_0x54f2ae[_0x5ed9('0x1a0')]);};AGIVertices[_0x5ed9('0x12')]['start']=function(_0x1d29a4){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x1a1'),_0x1d29a4['label']));this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x1a2'));var _0xc32db9=this['channel'][_0x5ed9('0x13')](_0x5ed9('0x1a3'));if(!_[_0x5ed9('0x45')](_0xc32db9[_0x5ed9('0xa2')])){this[_0x5ed9('0x33')][_0x5ed9('0x38')]=_0xc32db9[_0x5ed9('0xa2')];}if(_0x1d29a4[_0x5ed9('0xb7')]===_0x5ed9('0x1a4')){this['channel'][_0x5ed9('0xa9')](_0x5ed9('0x1a5'));return this['channel'][_0x5ed9('0xb7')]();}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x1a6'));};AGIVertices[_0x5ed9('0x12')]['subproject']=function(_0x4f3631){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4f3631['label']));if(!this[_0x5ed9('0x85')](_0x4f3631['project_id'])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x4f3631,_0x5ed9('0x1a7'));}var _0x2993e8=this[_0x5ed9('0x1a8')][_0x5ed9('0x70')](this,_0x4f3631[_0x5ed9('0x1a9')]);if(!this['isConfigured'](_0x2993e8)){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x4f3631,util[_0x5ed9('0x27')](_0x5ed9('0x1aa'),_0x4f3631[_0x5ed9('0x1a9')]));}if(_0x2993e8===this['channel'][_0x5ed9('0x35')]){return this[_0x5ed9('0x33')]['error'](_0x4f3631,_0x5ed9('0x1ab'));}this['createSquareDetailsReport'][_0x5ed9('0x70')](this,_0x4f3631,_0x2993e8);var _0x51e879=this[_0x5ed9('0x33')][_0x5ed9('0x56')](_0x5ed9('0x1ac'),util[_0x5ed9('0x27')](_0x5ed9('0x1ad'),config[_0x5ed9('0x9')][_0x5ed9('0x1ae')]||_0x5ed9('0x1af'),_0x2993e8,this[_0x5ed9('0x33')][_0x5ed9('0x35')]));if(_0x51e879[_0x5ed9('0xa4')]===-0x1){return _0x51e879;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s\x20%s',_0x5ed9('0x1ac'),_0x2993e8));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1b0')]=function(_0x1cc206){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1cc206['label']));var _0x30d98f=this[_0x5ed9('0x55')][_0x5ed9('0x70')](this,_0x1cc206[_0x5ed9('0xb5')]);this[_0x5ed9('0x32')][_0x5ed9('0x70')](this,_0x1cc206,_0x1cc206[_0x5ed9('0xb5')]);if(this[_0x5ed9('0x85')](_0x1cc206[_0x5ed9('0xd6')])){var _0x2ce58f=this[_0x5ed9('0x13')][_0x5ed9('0x70')](this,_0x1cc206['variable_id']);if(_0x2ce58f){this[_0x5ed9('0x33')][_0x5ed9('0x9e')](_0x2ce58f,_0x30d98f);return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x1b1'),_0x1cc206[_0x5ed9('0xb5')],_0x2ce58f));}}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x1b2'),_0x1cc206[_0x5ed9('0xb5')]));};AGIVertices['prototype'][_0x5ed9('0x1b3')]=function(_0x2ed555){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x1b4'),_0x2ed555['label']));_0x2ed555[_0x5ed9('0x5b')]=_0x2ed555[_0x5ed9('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5ed9('0x85')](_0x2ed555['apiKey'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0x1b5'));}if(!this['isConfigured'](_0x2ed555['text'])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](_0x5ed9('0xaa'));}this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2ed555[_0x5ed9('0x5b')]));var _0x54dd80=this[_0x5ed9('0x58')][_0x5ed9('0x70')](this,_0x2ed555);if(_0x54dd80){this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x1b6'),_0x54dd80));var _0x3f7bbc=this[_0x5ed9('0x33')][_0x5ed9('0x11f')](_0x54dd80);try{fs[_0x5ed9('0x100')](_0x54dd80+'.wav');}catch(_0x17e409){logger[_0x5ed9('0x2a')](_0x17e409);}return _0x3f7bbc;}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x2ed555,_0x5ed9('0x1b7'));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1b8')]=function(_0x4ad5df){logger['info'](util[_0x5ed9('0x27')](_0x5ed9('0x1b9'),_0x4ad5df[_0x5ed9('0x34')]));_0x4ad5df[_0x5ed9('0x5b')]=_0x4ad5df[_0x5ed9('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5ed9('0x85')](_0x4ad5df[_0x5ed9('0x5b')])){return this[_0x5ed9('0x33')][_0x5ed9('0xa9')]('no\x20text\x20configured');}this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x4ad5df['text']));var _0x1d1204=this['googleTTS'][_0x5ed9('0x70')](this,_0x4ad5df);if(_0x1d1204){this['channel']['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x1ba'),_0x1d1204));var _0x567dcb=this['channel'][_0x5ed9('0x11f')](_0x1d1204);try{fs['unlink'](_0x1d1204+'.wav');}catch(_0x4dccb5){logger['error'](_0x4dccb5);}return _0x567dcb;}return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x4ad5df,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1bb')]=function(_0x11d626){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x11d626[_0x5ed9('0x34')]));if(!this['isConfigured'](_0x11d626[_0x5ed9('0x152')])){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x11d626,_0x5ed9('0x153'));}logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x154'),this[_0x5ed9('0x33')]['callerid'],_0x11d626[_0x5ed9('0x152')]));var _0x33da83=this[_0x5ed9('0x50')][_0x5ed9('0x70')](this,_0x11d626[_0x5ed9('0x152')]);if(_0x33da83){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x11d626[_0x5ed9('0x152')]));this['channel']['noop'](util[_0x5ed9('0x27')](_0x5ed9('0x155'),this[_0x5ed9('0x33')]['callerid'],_0x11d626[_0x5ed9('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x157'),this[_0x5ed9('0x33')]['callerid'],_0x11d626['findBy']));this['channel'][_0x5ed9('0xa9')](util[_0x5ed9('0x27')](_0x5ed9('0x157'),this[_0x5ed9('0x33')][_0x5ed9('0x36')],_0x11d626[_0x5ed9('0x152')]));return{'code':0xc8,'result':_0x5ed9('0x158')};}};AGIVertices[_0x5ed9('0x12')]['voicemail']=function(_0x162790){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x162790[_0x5ed9('0x34')]));var _0xb01a74=this[_0x5ed9('0x33')][_0x5ed9('0x56')]('VOICEMAIL',[_0x162790['mailbox'],_0x162790[_0x5ed9('0x77')]]);if(_0xb01a74[_0x5ed9('0xa4')]===-0x1){return _0xb01a74;}return this[_0x5ed9('0x33')][_0x5ed9('0xa9')](util[_0x5ed9('0x27')]('Executed\x20command\x20%s\x20%s',_0x5ed9('0x1bc'),_0x162790[_0x5ed9('0x1bd')]));};AGIVertices[_0x5ed9('0x12')][_0x5ed9('0x1be')]=function(_0x43d948){logger[_0x5ed9('0x2c')](util[_0x5ed9('0x27')](_0x5ed9('0x1bf'),_0x43d948[_0x5ed9('0x34')]));if(!this[_0x5ed9('0x85')](_0x43d948[_0x5ed9('0xd6')])){return this[_0x5ed9('0x33')]['error'](_0x43d948,_0x5ed9('0x1c0'));}var _0x5343fb=this['getVariable']['sync'](this,_0x43d948[_0x5ed9('0xd6')]);if(!_0x5343fb){return this[_0x5ed9('0x33')][_0x5ed9('0x2a')](_0x43d948,_0x5ed9('0xd7'));}var _0x32f6b3=this[_0x5ed9('0x33')]['getVariable'](_0x5343fb);return{'code':0xc8,'result':_0x32f6b3['extra']?_0x32f6b3[_0x5ed9('0xa2')]:'-'};};String[_0x5ed9('0x12')][_0x5ed9('0xa1')]=function(_0x1118e6,_0x54db1c){return this['split'](_0x1118e6)['join'](_0x54db1c);};module[_0x5ed9('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3a86600..a0d38e9 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 _0xfb65=['voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','[ACW][START]\x20%s','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','prototype','updateAcw','lastPauseAt','timers','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','then'];(function(_0x1d6f4f,_0x230710){var _0x4aa71a=function(_0x509115){while(--_0x509115){_0x1d6f4f['push'](_0x1d6f4f['shift']());}};_0x4aa71a(++_0x230710);}(_0xfb65,0x82));var _0x5fb6=function(_0x19ec18,_0x4f61ca){_0x19ec18=_0x19ec18-0x0;var _0x216d53=_0xfb65[_0x19ec18];return _0x216d53;};'use strict';var _=require('lodash');var moment=require(_0x5fb6('0x0'));var ami=require(_0x5fb6('0x1'));var logger=require('../../../config/logger')(_0x5fb6('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x5fb6('0x3'));function Acw(_0x15d15c){this[_0x5fb6('0x4')]=_0x15d15c[_0x5fb6('0x4')];this[_0x5fb6('0x5')]=_0x15d15c[_0x5fb6('0x5')];this['timers']=_0x15d15c['timers'];this[_0x5fb6('0x6')]={};ami['on'](_0x5fb6('0x7'),this[_0x5fb6('0x8')][_0x5fb6('0x9')](this));ami['on']('hanguprequest',this[_0x5fb6('0xa')][_0x5fb6('0x9')](this));ami['on'](_0x5fb6('0xb'),this[_0x5fb6('0xc')]['bind'](this));ami['on'](_0x5fb6('0xd'),this[_0x5fb6('0xe')]['bind'](this));ami['on'](_0x5fb6('0xf'),this[_0x5fb6('0x10')][_0x5fb6('0x9')](this));ami['on'](_0x5fb6('0x11'),this[_0x5fb6('0x12')]['bind'](this));ami['on'](_0x5fb6('0x13'),this[_0x5fb6('0x14')][_0x5fb6('0x9')](this));}function getDiff(_0x41d503){var _0x6b58a2=moment()[_0x5fb6('0x15')](0x0);var _0x1a391f=moment(_0x41d503)[_0x5fb6('0x15')](0x0);return _0x6b58a2['diff'](_0x1a391f,'seconds');}Acw[_0x5fb6('0x16')][_0x5fb6('0x17')]=function(_0x58febe,_0x1d57b1){var _0x21ddd3=this;var _0x11bb78=getDiff(_0x21ddd3['timers'][_0x58febe][_0x5fb6('0x18')]);clearTimeout(_0x21ddd3[_0x5fb6('0x19')][_0x58febe][_0x5fb6('0x1a')]);_0x21ddd3[_0x5fb6('0x19')][_0x58febe][_0x5fb6('0x1a')]=![];return RpcVoiceAgentReport[_0x5fb6('0x1b')]({'acwtime':_0x11bb78},_0x21ddd3['timers'][_0x58febe][_0x5fb6('0x1c')],_0x58febe)['then'](function(_0x32f58a){logger['info'](_0x5fb6('0x1d'),_0x1d57b1,_0x11bb78,_0x32f58a);})[_0x5fb6('0x1e')](function(_0x402e8a){logger[_0x5fb6('0x1f')](_0x5fb6('0x20'),_0x1d57b1,_0x402e8a);})[_0x5fb6('0x21')](function(){delete _0x21ddd3[_0x5fb6('0x19')][_0x58febe];});};Acw['prototype']['startAcw']=function(_0xfd8d78){try{var _0x39ace4=this;var _0x48a70e=this[_0x5fb6('0x6')][_0xfd8d78][_0x5fb6('0x22')];var _0x331bba=this[_0x5fb6('0x6')][_0xfd8d78]['queue'];var _0x2fca34=this[_0x5fb6('0x4')][_0x331bba];var _0x45b484=![];var _0x20de69=_0x5fb6('0x23');if(_0x2fca34[_0x5fb6('0x24')]&&_0x2fca34['mandatoryDispositionPause']['name']){_0x45b484=!![];_0x20de69=_0x2fca34[_0x5fb6('0x25')][_0x5fb6('0x26')];}if(!_0x39ace4[_0x5fb6('0x5')][_0x48a70e]){return Promise[_0x5fb6('0x27')]();}return RpcUser[_0x5fb6('0x28')](_0x39ace4[_0x5fb6('0x5')][_0x48a70e]['id'])[_0x5fb6('0x29')](function(_0x4d6e01){if(!_0x4d6e01||_0x4d6e01[_0x5fb6('0x2a')]){logger[_0x5fb6('0x2b')](_0x5fb6('0x2c'),_0xfd8d78,_0x48a70e,_0x331bba);return;}logger['info'](_0x5fb6('0x2d'),_0xfd8d78,_0x48a70e,_0x331bba);var _0x1b4ae4=_0x39ace4['channels'][_0xfd8d78][_0x5fb6('0x2e')]&&_0x39ace4[_0x5fb6('0x6')][_0xfd8d78]['destlinkedid']?_0x39ace4[_0x5fb6('0x6')][_0xfd8d78]['destlinkedid']:_0xfd8d78;return RpcUser[_0x5fb6('0x2f')](_0x39ace4['agents'][_0x48a70e],_0x20de69,_0x1b4ae4);})['then'](function(_0x159971){if(_0x45b484||!_0x159971){return;}_0x39ace4[_0x5fb6('0x19')][_0x48a70e]={};logger[_0x5fb6('0x2b')](_0x5fb6('0x30'),_0xfd8d78,_0x39ace4[_0x5fb6('0x4')][_0x331bba][_0x5fb6('0x31')],_0x48a70e,_0x331bba);_0x39ace4['timers'][_0x48a70e][_0x5fb6('0x1a')]=setTimeout(_0x39ace4[_0x5fb6('0x32')][_0x5fb6('0x9')](_0x39ace4,_0x48a70e),_0x39ace4[_0x5fb6('0x4')][_0x331bba][_0x5fb6('0x31')]*0x3e8);_0x39ace4[_0x5fb6('0x19')][_0x48a70e][_0x5fb6('0x18')]=moment()[_0x5fb6('0x33')](_0x5fb6('0x34'));_0x39ace4[_0x5fb6('0x19')][_0x48a70e][_0x5fb6('0x1c')]=_0xfd8d78;_0x39ace4['timers'][_0x48a70e][_0x5fb6('0x35')]=_0x331bba;_0x39ace4[_0x5fb6('0x19')][_0x48a70e]['updateAcw']=_0x39ace4[_0x5fb6('0x17')]['bind'](_0x39ace4,_0x48a70e,_0xfd8d78);})['catch'](function(){logger[_0x5fb6('0x1f')](_0x5fb6('0x30'),_0xfd8d78,_0x39ace4[_0x5fb6('0x4')][_0x331bba]['acwTimeout'],_0x48a70e,_0x331bba);})[_0x5fb6('0x21')](function(){delete _0x39ace4['channels'][_0xfd8d78];});}catch(_0x5c256c){logger[_0x5fb6('0x1f')](_0x5fb6('0x36'),_0x5c256c[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x32')]=function(_0x1b96c0){try{var _0x3a6f88=this;if(_0x3a6f88[_0x5fb6('0x19')][_0x1b96c0]){_0x3a6f88[_0x5fb6('0x19')][_0x1b96c0][_0x5fb6('0x1a')]=![];var _0x8446db=_0x3a6f88[_0x5fb6('0x19')][_0x1b96c0]['uniqueid'];var _0x245ea0=_0x3a6f88[_0x5fb6('0x19')][_0x1b96c0][_0x5fb6('0x35')];var _0x5f1e64=_0x3a6f88[_0x5fb6('0x4')][_0x245ea0]['acwTimeout'];logger[_0x5fb6('0x2b')]('[%s][TIMER][STOP][AGENT:%s]',_0x8446db,_0x1b96c0);RpcUser[_0x5fb6('0x38')](this[_0x5fb6('0x5')][_0x1b96c0]);RpcVoiceAgentReport[_0x5fb6('0x1b')]({'acwtime':_0x5f1e64,'agentacw':!![]},_0x8446db,_0x1b96c0)[_0x5fb6('0x29')](function(_0x25c38d){logger['info'](_0x5fb6('0x1d'),_0x8446db,_0x5f1e64,_0x25c38d);})[_0x5fb6('0x1e')](function(_0x3ab41f){logger[_0x5fb6('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x8446db,_0x3ab41f);});}else{logger[_0x5fb6('0x1f')](_0x5fb6('0x39'),_0x1b96c0);if(_0x3a6f88[_0x5fb6('0x19')]){logger[_0x5fb6('0x2b')](_0x5fb6('0x3a'),JSON[_0x5fb6('0x3b')](_0x3a6f88['timers']));}}}catch(_0x10c242){logger[_0x5fb6('0x1f')](_0x5fb6('0x3c'),_0x10c242[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x8')]=function(_0xd3245f){try{if(this[_0x5fb6('0x4')][_0xd3245f[_0x5fb6('0x35')]]&&(this[_0x5fb6('0x4')][_0xd3245f[_0x5fb6('0x35')]]['acw']||this[_0x5fb6('0x4')][_0xd3245f['queue']][_0x5fb6('0x24')])){if(this[_0x5fb6('0x5')][_0xd3245f['interface']]){this[_0x5fb6('0x6')][_0xd3245f[_0x5fb6('0x1c')]]={'queue':_0xd3245f[_0x5fb6('0x35')],'interface':_0xd3245f['interface'],'destlinkedid':_0xd3245f['destlinkedid']};}}}catch(_0x39280a){logger[_0x5fb6('0x1f')](_0x5fb6('0x3d'),_0x39280a[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x14')]=function(_0x205234){try{if(this[_0x5fb6('0x4')][_0x205234[_0x5fb6('0x35')]]&&(this[_0x5fb6('0x4')][_0x205234[_0x5fb6('0x35')]]['acw']||this[_0x5fb6('0x4')][_0x205234['queue']]['mandatoryDisposition'])){if(this[_0x5fb6('0x5')][_0x205234[_0x5fb6('0x22')]]){this[_0x5fb6('0x6')][_0x205234[_0x5fb6('0x1c')]]={'queue':_0x205234[_0x5fb6('0x35')],'interface':_0x205234[_0x5fb6('0x22')]};}}}catch(_0x45ba31){logger['error'](_0x5fb6('0x3e'),_0x45ba31[_0x5fb6('0x37')]);}};Acw['prototype'][_0x5fb6('0xa')]=function(_0x7934fd){try{if(this[_0x5fb6('0x6')][_0x7934fd[_0x5fb6('0x1c')]]&&_[_0x5fb6('0x3f')](this[_0x5fb6('0x6')][_0x7934fd[_0x5fb6('0x1c')]][_0x5fb6('0x2e')])){logger['info'](_0x5fb6('0x40'),_0x7934fd[_0x5fb6('0x1c')]);this['startAcw'](_0x7934fd[_0x5fb6('0x1c')]);}else if(this[_0x5fb6('0x6')][_0x7934fd[_0x5fb6('0x41')]]&&_[_0x5fb6('0x3f')](this['channels'][_0x7934fd['linkedid']][_0x5fb6('0x2e')])){logger[_0x5fb6('0x2b')](_0x5fb6('0x42'),_0x7934fd['linkedid']);this[_0x5fb6('0x43')](_0x7934fd['linkedid']);}}catch(_0x3293ad){logger['error'](_0x5fb6('0x44'),_0x3293ad[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')]['syncHangup']=function(_0x242bdf){try{if(this[_0x5fb6('0x6')][_0x242bdf[_0x5fb6('0x1c')]]&&this[_0x5fb6('0x6')][_0x242bdf[_0x5fb6('0x1c')]][_0x5fb6('0x2e')]){logger[_0x5fb6('0x2b')](_0x5fb6('0x45'),_0x242bdf[_0x5fb6('0x1c')]);this[_0x5fb6('0x43')](_0x242bdf[_0x5fb6('0x1c')]);}else if(this['channels'][_0x242bdf[_0x5fb6('0x41')]]&&this['channels'][_0x242bdf[_0x5fb6('0x41')]][_0x5fb6('0x2e')]){logger[_0x5fb6('0x2b')](_0x5fb6('0x46'),_0x242bdf[_0x5fb6('0x41')]);this[_0x5fb6('0x43')](_0x242bdf['linkedid']);}}catch(_0x51bf91){logger['error']('[ACW][syncHangup]\x20%s',_0x51bf91[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x10')]=function(_0x2fa95b){try{if(!_['isNil'](this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x47')]])){this['startAcw'](_0x2fa95b[_0x5fb6('0x47')]);if(this['channels'][_0x2fa95b[_0x5fb6('0x48')]]){this[_0x5fb6('0x6')][_0x2fa95b['secondtransfereruniqueid']][_0x5fb6('0x2e')]=!![];this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x49')]]=this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x48')]];delete this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x48')]];}}else if(!_[_0x5fb6('0x4a')](this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x49')]])){this[_0x5fb6('0x43')](_0x2fa95b['transfertargetuniqueid']);if(this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x4b')]]){this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x4b')]][_0x5fb6('0x2e')]=!![];this[_0x5fb6('0x6')][_0x2fa95b['transfereeuniqueid']]=this[_0x5fb6('0x6')][_0x2fa95b['origtransfereruniqueid']];delete this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x4b')]];}}}catch(_0x2c5c89){logger[_0x5fb6('0x1f')](_0x5fb6('0x4c'),_0x2c5c89[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x12')]=function(_0x5d2342){try{if(this['channels'][_0x5d2342[_0x5fb6('0x4d')]]){logger[_0x5fb6('0x2b')](_0x5fb6('0x4e'),JSON[_0x5fb6('0x3b')](_0x5d2342['transfereruniqueid']));this['startAcw'](_0x5d2342[_0x5fb6('0x4d')]);}else if(this['channels'][_0x5d2342['transfererlinkedid']]){logger[_0x5fb6('0x2b')](_0x5fb6('0x4f'),JSON[_0x5fb6('0x3b')](_0x5d2342[_0x5fb6('0x50')]));this[_0x5fb6('0x43')](_0x5d2342['transfererlinkedid']);}}catch(_0x264980){logger['error'](_0x5fb6('0x51'),_0x264980[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0xe')]=function(_0x1a1476){try{if(this[_0x5fb6('0x4')][_0x1a1476['queue']]&&this[_0x5fb6('0x4')][_0x1a1476[_0x5fb6('0x35')]][_0x5fb6('0x52')]==='all'){if(this['agents'][_0x1a1476['interface']]){logger[_0x5fb6('0x2b')](_0x5fb6('0x53'),_0x1a1476[_0x5fb6('0x1c')],_0x1a1476[_0x5fb6('0x22')],_0x1a1476[_0x5fb6('0x35')]);return RpcUser[_0x5fb6('0x2f')](this[_0x5fb6('0x5')][_0x1a1476['interface']],_0x5fb6('0x54'),_0x1a1476[_0x5fb6('0x1c')]);}}}catch(_0x3c99d2){logger[_0x5fb6('0x1f')](_0x5fb6('0x55'),_0x3c99d2['message']);}};module['exports']=Acw; \ No newline at end of file +var _0xfb65=['voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','[ACW][START]\x20%s','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','prototype','updateAcw','lastPauseAt','timers','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','then'];(function(_0x19903c,_0x5192e4){var _0x222a6c=function(_0x2121ae){while(--_0x2121ae){_0x19903c['push'](_0x19903c['shift']());}};_0x222a6c(++_0x5192e4);}(_0xfb65,0x82));var _0x5fb6=function(_0x3b12d3,_0x4dcab2){_0x3b12d3=_0x3b12d3-0x0;var _0xf32064=_0xfb65[_0x3b12d3];return _0xf32064;};'use strict';var _=require('lodash');var moment=require(_0x5fb6('0x0'));var ami=require(_0x5fb6('0x1'));var logger=require('../../../config/logger')(_0x5fb6('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x5fb6('0x3'));function Acw(_0x15d15c){this[_0x5fb6('0x4')]=_0x15d15c[_0x5fb6('0x4')];this[_0x5fb6('0x5')]=_0x15d15c[_0x5fb6('0x5')];this['timers']=_0x15d15c['timers'];this[_0x5fb6('0x6')]={};ami['on'](_0x5fb6('0x7'),this[_0x5fb6('0x8')][_0x5fb6('0x9')](this));ami['on']('hanguprequest',this[_0x5fb6('0xa')][_0x5fb6('0x9')](this));ami['on'](_0x5fb6('0xb'),this[_0x5fb6('0xc')]['bind'](this));ami['on'](_0x5fb6('0xd'),this[_0x5fb6('0xe')]['bind'](this));ami['on'](_0x5fb6('0xf'),this[_0x5fb6('0x10')][_0x5fb6('0x9')](this));ami['on'](_0x5fb6('0x11'),this[_0x5fb6('0x12')]['bind'](this));ami['on'](_0x5fb6('0x13'),this[_0x5fb6('0x14')][_0x5fb6('0x9')](this));}function getDiff(_0x41d503){var _0x6b58a2=moment()[_0x5fb6('0x15')](0x0);var _0x1a391f=moment(_0x41d503)[_0x5fb6('0x15')](0x0);return _0x6b58a2['diff'](_0x1a391f,'seconds');}Acw[_0x5fb6('0x16')][_0x5fb6('0x17')]=function(_0x58febe,_0x1d57b1){var _0x21ddd3=this;var _0x11bb78=getDiff(_0x21ddd3['timers'][_0x58febe][_0x5fb6('0x18')]);clearTimeout(_0x21ddd3[_0x5fb6('0x19')][_0x58febe][_0x5fb6('0x1a')]);_0x21ddd3[_0x5fb6('0x19')][_0x58febe][_0x5fb6('0x1a')]=![];return RpcVoiceAgentReport[_0x5fb6('0x1b')]({'acwtime':_0x11bb78},_0x21ddd3['timers'][_0x58febe][_0x5fb6('0x1c')],_0x58febe)['then'](function(_0x32f58a){logger['info'](_0x5fb6('0x1d'),_0x1d57b1,_0x11bb78,_0x32f58a);})[_0x5fb6('0x1e')](function(_0x402e8a){logger[_0x5fb6('0x1f')](_0x5fb6('0x20'),_0x1d57b1,_0x402e8a);})[_0x5fb6('0x21')](function(){delete _0x21ddd3[_0x5fb6('0x19')][_0x58febe];});};Acw['prototype']['startAcw']=function(_0xfd8d78){try{var _0x39ace4=this;var _0x48a70e=this[_0x5fb6('0x6')][_0xfd8d78][_0x5fb6('0x22')];var _0x331bba=this[_0x5fb6('0x6')][_0xfd8d78]['queue'];var _0x2fca34=this[_0x5fb6('0x4')][_0x331bba];var _0x45b484=![];var _0x20de69=_0x5fb6('0x23');if(_0x2fca34[_0x5fb6('0x24')]&&_0x2fca34['mandatoryDispositionPause']['name']){_0x45b484=!![];_0x20de69=_0x2fca34[_0x5fb6('0x25')][_0x5fb6('0x26')];}if(!_0x39ace4[_0x5fb6('0x5')][_0x48a70e]){return Promise[_0x5fb6('0x27')]();}return RpcUser[_0x5fb6('0x28')](_0x39ace4[_0x5fb6('0x5')][_0x48a70e]['id'])[_0x5fb6('0x29')](function(_0x4d6e01){if(!_0x4d6e01||_0x4d6e01[_0x5fb6('0x2a')]){logger[_0x5fb6('0x2b')](_0x5fb6('0x2c'),_0xfd8d78,_0x48a70e,_0x331bba);return;}logger['info'](_0x5fb6('0x2d'),_0xfd8d78,_0x48a70e,_0x331bba);var _0x1b4ae4=_0x39ace4['channels'][_0xfd8d78][_0x5fb6('0x2e')]&&_0x39ace4[_0x5fb6('0x6')][_0xfd8d78]['destlinkedid']?_0x39ace4[_0x5fb6('0x6')][_0xfd8d78]['destlinkedid']:_0xfd8d78;return RpcUser[_0x5fb6('0x2f')](_0x39ace4['agents'][_0x48a70e],_0x20de69,_0x1b4ae4);})['then'](function(_0x159971){if(_0x45b484||!_0x159971){return;}_0x39ace4[_0x5fb6('0x19')][_0x48a70e]={};logger[_0x5fb6('0x2b')](_0x5fb6('0x30'),_0xfd8d78,_0x39ace4[_0x5fb6('0x4')][_0x331bba][_0x5fb6('0x31')],_0x48a70e,_0x331bba);_0x39ace4['timers'][_0x48a70e][_0x5fb6('0x1a')]=setTimeout(_0x39ace4[_0x5fb6('0x32')][_0x5fb6('0x9')](_0x39ace4,_0x48a70e),_0x39ace4[_0x5fb6('0x4')][_0x331bba][_0x5fb6('0x31')]*0x3e8);_0x39ace4[_0x5fb6('0x19')][_0x48a70e][_0x5fb6('0x18')]=moment()[_0x5fb6('0x33')](_0x5fb6('0x34'));_0x39ace4[_0x5fb6('0x19')][_0x48a70e][_0x5fb6('0x1c')]=_0xfd8d78;_0x39ace4['timers'][_0x48a70e][_0x5fb6('0x35')]=_0x331bba;_0x39ace4[_0x5fb6('0x19')][_0x48a70e]['updateAcw']=_0x39ace4[_0x5fb6('0x17')]['bind'](_0x39ace4,_0x48a70e,_0xfd8d78);})['catch'](function(){logger[_0x5fb6('0x1f')](_0x5fb6('0x30'),_0xfd8d78,_0x39ace4[_0x5fb6('0x4')][_0x331bba]['acwTimeout'],_0x48a70e,_0x331bba);})[_0x5fb6('0x21')](function(){delete _0x39ace4['channels'][_0xfd8d78];});}catch(_0x5c256c){logger[_0x5fb6('0x1f')](_0x5fb6('0x36'),_0x5c256c[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x32')]=function(_0x1b96c0){try{var _0x3a6f88=this;if(_0x3a6f88[_0x5fb6('0x19')][_0x1b96c0]){_0x3a6f88[_0x5fb6('0x19')][_0x1b96c0][_0x5fb6('0x1a')]=![];var _0x8446db=_0x3a6f88[_0x5fb6('0x19')][_0x1b96c0]['uniqueid'];var _0x245ea0=_0x3a6f88[_0x5fb6('0x19')][_0x1b96c0][_0x5fb6('0x35')];var _0x5f1e64=_0x3a6f88[_0x5fb6('0x4')][_0x245ea0]['acwTimeout'];logger[_0x5fb6('0x2b')]('[%s][TIMER][STOP][AGENT:%s]',_0x8446db,_0x1b96c0);RpcUser[_0x5fb6('0x38')](this[_0x5fb6('0x5')][_0x1b96c0]);RpcVoiceAgentReport[_0x5fb6('0x1b')]({'acwtime':_0x5f1e64,'agentacw':!![]},_0x8446db,_0x1b96c0)[_0x5fb6('0x29')](function(_0x25c38d){logger['info'](_0x5fb6('0x1d'),_0x8446db,_0x5f1e64,_0x25c38d);})[_0x5fb6('0x1e')](function(_0x3ab41f){logger[_0x5fb6('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x8446db,_0x3ab41f);});}else{logger[_0x5fb6('0x1f')](_0x5fb6('0x39'),_0x1b96c0);if(_0x3a6f88[_0x5fb6('0x19')]){logger[_0x5fb6('0x2b')](_0x5fb6('0x3a'),JSON[_0x5fb6('0x3b')](_0x3a6f88['timers']));}}}catch(_0x10c242){logger[_0x5fb6('0x1f')](_0x5fb6('0x3c'),_0x10c242[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x8')]=function(_0xd3245f){try{if(this[_0x5fb6('0x4')][_0xd3245f[_0x5fb6('0x35')]]&&(this[_0x5fb6('0x4')][_0xd3245f[_0x5fb6('0x35')]]['acw']||this[_0x5fb6('0x4')][_0xd3245f['queue']][_0x5fb6('0x24')])){if(this[_0x5fb6('0x5')][_0xd3245f['interface']]){this[_0x5fb6('0x6')][_0xd3245f[_0x5fb6('0x1c')]]={'queue':_0xd3245f[_0x5fb6('0x35')],'interface':_0xd3245f['interface'],'destlinkedid':_0xd3245f['destlinkedid']};}}}catch(_0x39280a){logger[_0x5fb6('0x1f')](_0x5fb6('0x3d'),_0x39280a[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x14')]=function(_0x205234){try{if(this[_0x5fb6('0x4')][_0x205234[_0x5fb6('0x35')]]&&(this[_0x5fb6('0x4')][_0x205234[_0x5fb6('0x35')]]['acw']||this[_0x5fb6('0x4')][_0x205234['queue']]['mandatoryDisposition'])){if(this[_0x5fb6('0x5')][_0x205234[_0x5fb6('0x22')]]){this[_0x5fb6('0x6')][_0x205234[_0x5fb6('0x1c')]]={'queue':_0x205234[_0x5fb6('0x35')],'interface':_0x205234[_0x5fb6('0x22')]};}}}catch(_0x45ba31){logger['error'](_0x5fb6('0x3e'),_0x45ba31[_0x5fb6('0x37')]);}};Acw['prototype'][_0x5fb6('0xa')]=function(_0x7934fd){try{if(this[_0x5fb6('0x6')][_0x7934fd[_0x5fb6('0x1c')]]&&_[_0x5fb6('0x3f')](this[_0x5fb6('0x6')][_0x7934fd[_0x5fb6('0x1c')]][_0x5fb6('0x2e')])){logger['info'](_0x5fb6('0x40'),_0x7934fd[_0x5fb6('0x1c')]);this['startAcw'](_0x7934fd[_0x5fb6('0x1c')]);}else if(this[_0x5fb6('0x6')][_0x7934fd[_0x5fb6('0x41')]]&&_[_0x5fb6('0x3f')](this['channels'][_0x7934fd['linkedid']][_0x5fb6('0x2e')])){logger[_0x5fb6('0x2b')](_0x5fb6('0x42'),_0x7934fd['linkedid']);this[_0x5fb6('0x43')](_0x7934fd['linkedid']);}}catch(_0x3293ad){logger['error'](_0x5fb6('0x44'),_0x3293ad[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')]['syncHangup']=function(_0x242bdf){try{if(this[_0x5fb6('0x6')][_0x242bdf[_0x5fb6('0x1c')]]&&this[_0x5fb6('0x6')][_0x242bdf[_0x5fb6('0x1c')]][_0x5fb6('0x2e')]){logger[_0x5fb6('0x2b')](_0x5fb6('0x45'),_0x242bdf[_0x5fb6('0x1c')]);this[_0x5fb6('0x43')](_0x242bdf[_0x5fb6('0x1c')]);}else if(this['channels'][_0x242bdf[_0x5fb6('0x41')]]&&this['channels'][_0x242bdf[_0x5fb6('0x41')]][_0x5fb6('0x2e')]){logger[_0x5fb6('0x2b')](_0x5fb6('0x46'),_0x242bdf[_0x5fb6('0x41')]);this[_0x5fb6('0x43')](_0x242bdf['linkedid']);}}catch(_0x51bf91){logger['error']('[ACW][syncHangup]\x20%s',_0x51bf91[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x10')]=function(_0x2fa95b){try{if(!_['isNil'](this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x47')]])){this['startAcw'](_0x2fa95b[_0x5fb6('0x47')]);if(this['channels'][_0x2fa95b[_0x5fb6('0x48')]]){this[_0x5fb6('0x6')][_0x2fa95b['secondtransfereruniqueid']][_0x5fb6('0x2e')]=!![];this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x49')]]=this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x48')]];delete this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x48')]];}}else if(!_[_0x5fb6('0x4a')](this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x49')]])){this[_0x5fb6('0x43')](_0x2fa95b['transfertargetuniqueid']);if(this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x4b')]]){this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x4b')]][_0x5fb6('0x2e')]=!![];this[_0x5fb6('0x6')][_0x2fa95b['transfereeuniqueid']]=this[_0x5fb6('0x6')][_0x2fa95b['origtransfereruniqueid']];delete this[_0x5fb6('0x6')][_0x2fa95b[_0x5fb6('0x4b')]];}}}catch(_0x2c5c89){logger[_0x5fb6('0x1f')](_0x5fb6('0x4c'),_0x2c5c89[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0x12')]=function(_0x5d2342){try{if(this['channels'][_0x5d2342[_0x5fb6('0x4d')]]){logger[_0x5fb6('0x2b')](_0x5fb6('0x4e'),JSON[_0x5fb6('0x3b')](_0x5d2342['transfereruniqueid']));this['startAcw'](_0x5d2342[_0x5fb6('0x4d')]);}else if(this['channels'][_0x5d2342['transfererlinkedid']]){logger[_0x5fb6('0x2b')](_0x5fb6('0x4f'),JSON[_0x5fb6('0x3b')](_0x5d2342[_0x5fb6('0x50')]));this[_0x5fb6('0x43')](_0x5d2342['transfererlinkedid']);}}catch(_0x264980){logger['error'](_0x5fb6('0x51'),_0x264980[_0x5fb6('0x37')]);}};Acw[_0x5fb6('0x16')][_0x5fb6('0xe')]=function(_0x1a1476){try{if(this[_0x5fb6('0x4')][_0x1a1476['queue']]&&this[_0x5fb6('0x4')][_0x1a1476[_0x5fb6('0x35')]][_0x5fb6('0x52')]==='all'){if(this['agents'][_0x1a1476['interface']]){logger[_0x5fb6('0x2b')](_0x5fb6('0x53'),_0x1a1476[_0x5fb6('0x1c')],_0x1a1476[_0x5fb6('0x22')],_0x1a1476[_0x5fb6('0x35')]);return RpcUser[_0x5fb6('0x2f')](this[_0x5fb6('0x5')][_0x1a1476['interface']],_0x5fb6('0x54'),_0x1a1476[_0x5fb6('0x1c')]);}}}catch(_0x3c99d2){logger[_0x5fb6('0x1f')](_0x5fb6('0x55'),_0x3c99d2['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 7446f7a..93fd11c 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 _0xc1a6=['[ami.js][fullybooted]','once','exports','bluebird','util','../../config/logger','port','asterisk','username','password','keepConnected','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionQueueSummary','error'];(function(_0x19b9f5,_0x2ff200){var _0x89c067=function(_0x523a93){while(--_0x523a93){_0x19b9f5['push'](_0x19b9f5['shift']());}};_0x89c067(++_0x2ff200);}(_0xc1a6,0xad));var _0x6c1a=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xc1a6[_0x3054be];return _0x3df150;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x6c1a('0x0'));var util=require(_0x6c1a('0x1'));var logger=require(_0x6c1a('0x2'))('ami');var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x6c1a('0x3')],config[_0x6c1a('0x4')]['ip'],config[_0x6c1a('0x4')][_0x6c1a('0x5')],config['asterisk'][_0x6c1a('0x6')],!![]);ami[_0x6c1a('0x7')]();ami[_0x6c1a('0x8')]=BPromise[_0x6c1a('0x9')](ami['action']);function error(_0xf4cfa6){logger['error'](util[_0x6c1a('0xa')](_0x6c1a('0xb'),config[_0x6c1a('0x4')]['username'],config[_0x6c1a('0x4')]['ip'],config[_0x6c1a('0x4')][_0x6c1a('0x3')],util[_0x6c1a('0xc')](_0xf4cfa6,![],null)));}function close(){logger['error'](util[_0x6c1a('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x6c1a('0x4')][_0x6c1a('0x5')],config[_0x6c1a('0x4')]['ip'],config[_0x6c1a('0x4')][_0x6c1a('0x3')]));}ami[_0x6c1a('0xd')]=function(){return function(){return ami[_0x6c1a('0x8')]({'action':_0x6c1a('0xe')});};};ami[_0x6c1a('0xf')]=function(){return function(){return ami[_0x6c1a('0x8')]({'action':_0x6c1a('0x10')});};};ami[_0x6c1a('0x11')]=function(){return function(){return ami[_0x6c1a('0x8')]({'action':_0x6c1a('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x6c1a('0x8')]({'action':_0x6c1a('0x13')});};};ami[_0x6c1a('0x14')]=function(){return function(){return ami[_0x6c1a('0x8')]({'action':_0x6c1a('0x15')});};};function connect(){logger[_0x6c1a('0x16')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk']['username'],config[_0x6c1a('0x4')]['ip'],config[_0x6c1a('0x4')][_0x6c1a('0x3')]));ami['once']('error',error);ami['once'](_0x6c1a('0x17'),close);}ami['on'](_0x6c1a('0x18'),connect);ami['on'](_0x6c1a('0x19'),function(_0xb25502){logger['info'](util['format'](_0x6c1a('0x1a'),config[_0x6c1a('0x4')][_0x6c1a('0x5')],config[_0x6c1a('0x4')]['ip'],config[_0x6c1a('0x4')][_0x6c1a('0x3')],util['inspect'](_0xb25502,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0x6c1a('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x6c1a('0x4')]['username'],config[_0x6c1a('0x4')]['ip'],config[_0x6c1a('0x4')][_0x6c1a('0x3')]));return Promise[_0x6c1a('0x1b')]()['then'](ami[_0x6c1a('0xd')]())[_0x6c1a('0x1c')](ami[_0x6c1a('0xf')]())['then'](ami['actionSipPeerStatus']())['then'](ami[_0x6c1a('0x1d')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x517d01){logger[_0x6c1a('0x1e')](_0x6c1a('0x1f'),util[_0x6c1a('0xc')](_0x517d01,{'showHidden':![],'depth':null}));});});ami[_0x6c1a('0x20')](_0x6c1a('0x1e'),error);ami[_0x6c1a('0x20')]('close',close);module[_0x6c1a('0x21')]=ami; \ No newline at end of file +var _0x33a4=['ami','../../config/environment','port','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','Action','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','exports','asterisk-manager','bluebird','util','../../config/logger'];(function(_0x1bfc54,_0x32f479){var _0x32d184=function(_0x2690ca){while(--_0x2690ca){_0x1bfc54['push'](_0x1bfc54['shift']());}};_0x32d184(++_0x32f479);}(_0x33a4,0x178));var _0x433a=function(_0xfcde,_0xae1e0e){_0xfcde=_0xfcde-0x0;var _0x5a0b4d=_0x33a4[_0xfcde];return _0x5a0b4d;};'use strict';var Manager=require(_0x433a('0x0'));var BPromise=require(_0x433a('0x1'));var util=require(_0x433a('0x2'));var logger=require(_0x433a('0x3'))(_0x433a('0x4'));var config=require(_0x433a('0x5'));var ami=new Manager(config['asterisk'][_0x433a('0x6')],config[_0x433a('0x7')]['ip'],config[_0x433a('0x7')][_0x433a('0x8')],config[_0x433a('0x7')][_0x433a('0x9')],!![]);ami[_0x433a('0xa')]();ami['Action']=BPromise[_0x433a('0xb')](ami[_0x433a('0xc')]);function error(_0x307d76){logger[_0x433a('0xd')](util[_0x433a('0xe')](_0x433a('0xf'),config[_0x433a('0x7')][_0x433a('0x8')],config[_0x433a('0x7')]['ip'],config[_0x433a('0x7')]['port'],util['inspect'](_0x307d76,![],null)));}function close(){logger[_0x433a('0xd')](util[_0x433a('0xe')](_0x433a('0x10'),config[_0x433a('0x7')][_0x433a('0x8')],config[_0x433a('0x7')]['ip'],config[_0x433a('0x7')][_0x433a('0x6')]));}ami[_0x433a('0x11')]=function(){return function(){return ami['Action']({'action':_0x433a('0x12')});};};ami[_0x433a('0x13')]=function(){return function(){return ami[_0x433a('0x14')]({'action':'devicestatelist'});};};ami[_0x433a('0x15')]=function(){return function(){return ami[_0x433a('0x14')]({'action':_0x433a('0x16')});};};ami[_0x433a('0x17')]=function(){return function(){return ami[_0x433a('0x14')]({'action':_0x433a('0x18')});};};ami[_0x433a('0x19')]=function(){return function(){return ami[_0x433a('0x14')]({'action':'coreshowchannels'});};};function connect(){logger[_0x433a('0x1a')](util['format'](_0x433a('0x1b'),config[_0x433a('0x7')][_0x433a('0x8')],config[_0x433a('0x7')]['ip'],config[_0x433a('0x7')][_0x433a('0x6')]));ami['once']('error',error);ami[_0x433a('0x1c')](_0x433a('0x1d'),close);}ami['on']('connect',connect);ami['on'](_0x433a('0x1e'),function(_0x473e0c){logger[_0x433a('0x1a')](util[_0x433a('0xe')](_0x433a('0x1f'),config[_0x433a('0x7')][_0x433a('0x8')],config['asterisk']['ip'],config[_0x433a('0x7')][_0x433a('0x6')],util[_0x433a('0x20')](_0x473e0c,![],null)));});ami['on']('fullybooted',function(){logger['info'](util['format'](_0x433a('0x21'),config[_0x433a('0x7')][_0x433a('0x8')],config[_0x433a('0x7')]['ip'],config['asterisk'][_0x433a('0x6')]));return Promise[_0x433a('0x22')]()[_0x433a('0x23')](ami[_0x433a('0x11')]())['then'](ami[_0x433a('0x13')]())[_0x433a('0x23')](ami[_0x433a('0x15')]())['then'](ami[_0x433a('0x17')]())[_0x433a('0x23')](ami[_0x433a('0x19')]())[_0x433a('0x24')](function(_0x28669c){logger[_0x433a('0xd')]('[ami.js][fullybooted]',util[_0x433a('0x20')](_0x28669c,{'showHidden':![],'depth':null}));});});ami[_0x433a('0x1c')](_0x433a('0xd'),error);ami[_0x433a('0x1c')](_0x433a('0x1d'),close);module[_0x433a('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 1601bd9..34afd10 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x70e0,0x17b));var _0x070e=function(_0x46cd77,_0x334d7b){_0x46cd77=_0x46cd77-0x0;var _0x5d7f6b=_0x70e0[_0x46cd77];return _0x5d7f6b;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x3b1aec,_0x4a66ff){var _0x574c45=function(_0x4c5495){while(--_0x4c5495){_0x3b1aec['push'](_0x3b1aec['shift']());}};_0x574c45(++_0x4a66ff);}(_0xb43b,0x1b2));var _0xbb43=function(_0x41285f,_0x1cc4c3){_0x41285f=_0x41285f-0x0;var _0x23cfc3=_0xb43b[_0x41285f];return _0x23cfc3;};'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/index.js b/server/services/ami/dialer/index.js index ca46ada..8ebcfe0 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 _0x0172=['predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','dropreason','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','Abandoned','channel','actionid','rrmemory','isNil','locked','paused','stateinterface','idHopper','roundrobin','run','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','dialMachineMaxRetry','[syncHangupIvr][createHistory]','AnswerAGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','statusMessage','available','inUse','talking','pTalking','checkDialMethod','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','enqueue','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-VOICEQUEUEID','setXMDContactVariables','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','add','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','checkIsBlackListIvr','[actionOriginateIvr]\x20','not_inuse','push','countReScheduled','[actionOriginate]\x20','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[countReScheduled]\x20','checkIsBlackList','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','isUndefined','type','debug','inspect','voice:queue:%s','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','state','statedesc','endtime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','then','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Timezone:\x20','undefined','resolve','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueId','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','getSeconds','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','TIMEOUT','agiafterat','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','rescheduleContact','minutes','ContactId','ListId','VoiceQueueId','starttime','calleridname','calleridnum','swapAdditionalPhones'];(function(_0x27fa65,_0x4e02ee){var _0x456594=function(_0x43b6da){while(--_0x43b6da){_0x27fa65['push'](_0x27fa65['shift']());}};_0x456594(++_0x4e02ee);}(_0x0172,0x13b));var _0x2017=function(_0x293167,_0x27d212){_0x293167=_0x293167-0x0;var _0x2f4640=_0x0172[_0x293167];return _0x2f4640;};'use strict';var util=require('util');var _=require(_0x2017('0x0'));var uuid=require(_0x2017('0x1'));var moment=require(_0x2017('0x2'));var rr=require('rr');var Redis=require(_0x2017('0x3'));var utils=require(_0x2017('0x4'));var hopperUtils=require(_0x2017('0x5'));var ut=require(_0x2017('0x6'));var config=require(_0x2017('0x7'));var logger=require('../../../config/logger')(_0x2017('0x8'));var loggerBooked=require(_0x2017('0x9'))(_0x2017('0xa'));var loggerPredictive=require(_0x2017('0x9'))(_0x2017('0xb'));var loggerPredictiveCalls=require(_0x2017('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x2017('0xc'));var ami=require(_0x2017('0xd'));config[_0x2017('0xe')]=_[_0x2017('0xf')](config['redis'],{'host':_0x2017('0x10'),'port':0x18eb});var io=require(_0x2017('0x11'))(new Redis(config['redis']));var cmHopper=require(_0x2017('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x2017('0x13'));var Interval=require(_0x2017('0x14'));var Action=require(_0x2017('0x15'));var History=require(_0x2017('0x16'));var Final=require(_0x2017('0x17'));var AgentComplete=require(_0x2017('0x18'));var QueueCallerAbandon=require(_0x2017('0x19'));var Hangup=require('./models/hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x2017('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2017('0x1b')]['enqueue']=function(_0x486866){this['tail']=this[_0x2017('0x1c')]?this[_0x2017('0x1c')][_0x2017('0x1d')](_0x486866):_0x486866();};function Dialer(_0x1ac843,_0x335094){this[_0x2017('0x1e')]=new Sequence();this[_0x2017('0x1f')]=_0x335094;this[_0x2017('0x20')]=_0x1ac843['voiceQueues'];this[_0x2017('0x21')]=_0x1ac843[_0x2017('0x21')];this[_0x2017('0x22')]=_0x1ac843[_0x2017('0x22')];this[_0x2017('0x23')]=_0x1ac843[_0x2017('0x23')];this[_0x2017('0x24')]=config[_0x2017('0x24')]||0x2;this[_0x2017('0x25')]={};this[_0x2017('0x26')]={};this[_0x2017('0x27')]={};this['uniqueId']={};this[_0x2017('0x28')]={};this[_0x2017('0x29')]={};this[_0x2017('0x2a')]={};this[_0x2017('0x2b')]={};this[_0x2017('0x2c')]={};this[_0x2017('0x2d')]={};this['queuesSummary']={};ami['on'](_0x2017('0x2e'),this[_0x2017('0x2f')][_0x2017('0x30')](this));ami['on'](_0x2017('0x31'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x2017('0x32'),this[_0x2017('0x33')][_0x2017('0x30')](this));ami['on']('agentcomplete',this[_0x2017('0x34')][_0x2017('0x30')](this));ami['on'](_0x2017('0x35'),this[_0x2017('0xc')][_0x2017('0x30')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x2017('0x30')](this));ami['on']('hangup',this[_0x2017('0x36')]['bind'](this));ami['on']('newexten',this[_0x2017('0x37')][_0x2017('0x30')](this));ami['on'](_0x2017('0x38'),this[_0x2017('0x39')][_0x2017('0x30')](this));ami['on'](_0x2017('0x3a'),this[_0x2017('0x3b')][_0x2017('0x30')](this));ami['on'](_0x2017('0x3c'),this[_0x2017('0x3d')][_0x2017('0x30')](this));this[_0x2017('0x3e')]();this[_0x2017('0x3f')]();RpcSetting[_0x2017('0x40')]()['then'](function(_0x448a41){previewRecallmeReminderInterval=_0x448a41['previewRecallmeReminderInterval'];});}function isNotNull(_0x19c0b6){return _0x19c0b6!==null&&!_[_0x2017('0x41')](_0x19c0b6);}function msgResponse(_0x461d2c,_0x52fae4,_0x174486){return{'action':_0x461d2c,'response':_0x52fae4,'message':_0x174486,'stack':_0x174486};}function emit(_0x32291e,_0x24d8d3,_0x528828){io['to'](_0x32291e)['emit'](_0x24d8d3,_0x528828);}function emitOutboundVoiceQueueSummary(_0x2e8cc3){if(_0x2e8cc3[_0x2017('0x42')]==='outbound'){logger[_0x2017('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x2017('0x44')](_0x2e8cc3,{'showHidden':![],'depth':null}));emit(util['format'](_0x2017('0x45'),_0x2e8cc3['name']),_0x2017('0x46'),_0x2e8cc3);}}function checkGetDataPredictive(_0x3da445){if(isNotNull(_0x3da445)&&!_[_0x2017('0x47')](_0x3da445)){loggerPredictive[_0x2017('0x48')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x2017('0x48')](_0x2017('0x49'),_0x3da445['predictiveIntervalTotalCalls']);loggerPredictive[_0x2017('0x48')](_0x2017('0x4a'),_0x3da445[_0x2017('0x4b')]);loggerPredictive[_0x2017('0x48')](_0x2017('0x4c'),_0x3da445[_0x2017('0x4d')]);loggerPredictive['info'](_0x2017('0x4e'),_0x3da445['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3da445[_0x2017('0x4f')]);loggerPredictive['info'](_0x2017('0x50'),_0x3da445[_0x2017('0x51')]);loggerPredictive['info'](_0x2017('0x52'));if(_0x3da445['predictiveIntervalTotalCalls']>0x0){if(!_[_0x2017('0x41')](_0x3da445[_0x2017('0x51')])&&_0x3da445['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x2017('0x53'));if(!_[_0x2017('0x41')](_0x3da445['predictiveIntervalAvgHoldtime'])&&_0x3da445[_0x2017('0x4f')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x2017('0x48')](_0x2017('0x54'));}}else{loggerPredictive['info'](_0x2017('0x55'));}return![];}function mergeDataErlangB(_0x17233e){return function(_0x49fb56){loggerPredictive[_0x2017('0x48')](_0x2017('0x56'));loggerPredictive[_0x2017('0x48')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x49fb56[_0x2017('0x57')]);loggerPredictive[_0x2017('0x48')](_0x2017('0x58'),_0x49fb56[_0x2017('0x59')]);loggerPredictive[_0x2017('0x48')](_0x2017('0x5a'),_0x49fb56[_0x2017('0x5b')]);loggerPredictive[_0x2017('0x48')](_0x2017('0x5c'),_0x49fb56[_0x2017('0x5d')]);loggerPredictive[_0x2017('0x48')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x49fb56[_0x2017('0x5b')]);loggerPredictive[_0x2017('0x48')]('---------------------------');_[_0x2017('0x5e')](_0x17233e,_0x49fb56);};}function ifInterval(_0x541439,_0x5c915e){if(_['isUndefined'](_0x5c915e)){return![];}return utils['getSeconds'](undefined,_0x5c915e)<_0x541439*0x3c;}function clearPredictiveAttributes(_0x5e0c63){if(_0x5e0c63[_0x2017('0x2a')]){_0x5e0c63['startProgressive']=undefined;loggerPredictive[_0x2017('0x43')](_0x5e0c63[_0x2017('0x5f')],_0x2017('0x60'));}if(_0x5e0c63[_0x2017('0x29')]){_0x5e0c63[_0x2017('0x29')]=undefined;loggerPredictive[_0x2017('0x43')](_0x5e0c63[_0x2017('0x5f')],_0x2017('0x61'));}if(_0x5e0c63[_0x2017('0x62')]){clearInterval(_0x5e0c63[_0x2017('0x62')]);_0x5e0c63[_0x2017('0x62')]=undefined;loggerPredictive[_0x2017('0x43')](_0x5e0c63['name'],_0x2017('0x63'));}}function loggerCatchPredictive(_0x1569f2,_0x20b403){return function(_0x43e705){loggerPredictive[_0x2017('0x64')](_0x20b403[_0x2017('0x5f')],_0x1569f2);loggerPredictive[_0x2017('0x64')](_0x43e705[_0x2017('0x65')]);clearPredictiveAttributes(_0x20b403);};}function loggerCatch(_0xe4570e){return function(_0x3cecd3){logger[_0x2017('0x64')](_0xe4570e,util[_0x2017('0x44')](_0x3cecd3,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2c8da1,_0x270bc8,_0x2bfd40){return function(_0x51e86f){utils['checkContactLowerLimitOriginate'](_0x270bc8,_0x2bfd40,0x0);_0x270bc8['temp']=0x0;logger['error'](_0x2c8da1,util['inspect'](_0x51e86f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x47fb73){return function(_0x21d0ca){if(isNotNull(_0x21d0ca)&&isNotNull(_0x21d0ca[0x0])){if(_0x21d0ca[0x0]['contactsRescheduled']>0x0){_0x47fb73['message']=utils[_0x2017('0x66')][_0x2017('0x67')];logger['info'](_0x2017('0x68')+_0x47fb73[_0x2017('0x5f')],_0x21d0ca[0x0]['contactsRescheduled'],_0x2017('0x69'));}else{_0x47fb73['message']=utils[_0x2017('0x66')][_0x2017('0x6a')];logger['info'](_0x2017('0x6b')+_0x47fb73[_0x2017('0x5f')]);}}};}function createObjHistory(_0x4c8c01,_0x228e50,_0x23d5a0,_0x495014,_0x734da8){_0x4c8c01[_0x2017('0x6c')]=_0x23d5a0;var _0x4162b5=new Action(_0x4c8c01,_0x228e50);var _0x3d960c=new History(_0x4162b5);_0x3d960c[_0x2017('0x6d')]=_0x495014;_0x3d960c[_0x2017('0x6e')]=_0x734da8;_0x3d960c[_0x2017('0x6f')]=_0x4162b5['starttime'];return _0x3d960c;}function unlockQueueStatus(_0x2747ea,_0x40cd3e){setTimeout(function(){if(_['isUndefined'](_0x2747ea[_0x2017('0x70')])){loggerBooked[_0x2017('0x64')]('[unlockQueueStatus][undefined]',_0x40cd3e);}_0x2747ea['queueStatusComplete']=!![];loggerBooked[_0x2017('0x48')](_0x2017('0x71'),_0x40cd3e,JSON[_0x2017('0x72')](_[_0x2017('0x73')](_0x2747ea,[_0x2017('0x5f'),_0x2017('0x70')])));},0x1f3);}function checkInterval(_0x51ddbb){return function(){if(!isNotNull(_0x51ddbb['Interval'])){_0x51ddbb[_0x2017('0x6c')]=utils[_0x2017('0x66')][_0x2017('0x74')];throw _0x51ddbb[_0x2017('0x5f')]+_0x2017('0x75');}if(!isNotNull(_0x51ddbb[_0x2017('0x76')][_0x2017('0x77')])){_0x51ddbb['message']=utils['CAMPAIGN_STATUS'][_0x2017('0x74')];throw _0x51ddbb[_0x2017('0x5f')]+_0x2017('0x75');}if(!isNotNull(_['isEmpty'](_0x51ddbb['Interval'][_0x2017('0x77')]))){_0x51ddbb['message']=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x51ddbb['name']+_0x2017('0x75');}};}function checkIsIVRCampaignActive(_0x3fc104){return function(){if(!utils[_0x2017('0x78')](_0x3fc104)){_0x3fc104['message']=utils[_0x2017('0x66')][_0x2017('0x79')];throw _0x3fc104[_0x2017('0x5f')]+_0x2017('0x7a');}};}function emitCampaignSummary(_0x35e327){if(utils[_0x2017('0x7b')](_0x35e327)){emit(util[_0x2017('0x7c')](_0x2017('0x7d'),_0x35e327[_0x2017('0x5f')]),_0x2017('0x7e'),_0x35e327);}}function loggerCatchQueueSummary(_0x120066,_0x26d81c){return function(_0xf6951e){clearPredictiveAttributes(_0x26d81c);emitCampaignSummary(_0x26d81c);loggerSyncQueueSummary[_0x2017('0x43')](_0x120066,util['inspect'](_0xf6951e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2bc61e){if(_0x2bc61e[_0x2017('0x7f')]){if(_0x2bc61e[_0x2017('0x80')]===0x0){_0x2bc61e['sendMessageOneNotActive']=![];_0x2bc61e[_0x2017('0x6c')]=utils[_0x2017('0x66')][_0x2017('0x79')];loggerSyncQueueSummary[_0x2017('0x43')](_0x2017('0x81'),_0x2bc61e[_0x2017('0x5f')],'is\x20not\x20active');}else{_0x2bc61e[_0x2017('0x6c')]=utils[_0x2017('0x66')]['DISACTIVED'];loggerSyncQueueSummary[_0x2017('0x43')](_0x2017('0x81'),_0x2bc61e[_0x2017('0x5f')],_0x2017('0x82'));}emitCampaignSummary(_0x2bc61e);}}function myreject(_0x28eec6){return function(_0x5d1db1){return _0x28eec6(msgResponse(_0x2017('0x83'),_0x2017('0x84'),JSON[_0x2017('0x72')](_0x5d1db1)));};}Dialer[_0x2017('0x1b')][_0x2017('0x85')]=function(_0x444f4f){return!_[_0x2017('0x41')](_0x444f4f)&&_0x444f4f&&!_[_0x2017('0x41')](_0x444f4f[_0x2017('0x5f')])&&!_[_0x2017('0x41')](_0x444f4f[_0x2017('0x86')])&&_0x444f4f['active']&&(this[_0x2017('0x23')][util[_0x2017('0x7c')](_0x2017('0x87'),_0x444f4f['name'])][_0x2017('0x88')]===_0x2017('0x89')||this[_0x2017('0x23')][util[_0x2017('0x7c')](_0x2017('0x87'),_0x444f4f[_0x2017('0x5f')])][_0x2017('0x88')]===_0x2017('0x8a'));};Dialer['prototype'][_0x2017('0x8b')]=function(_0x3bf79f){var _0x8503ad=this;return function(){if(!_0x8503ad[_0x2017('0x85')](_0x3bf79f[_0x2017('0x8c')])){if(!_0x8503ad[_0x2017('0x85')](_0x3bf79f[_0x2017('0x8d')])){_0x3bf79f[_0x2017('0x6c')]=utils[_0x2017('0x66')][_0x2017('0x8e')];throw _0x3bf79f[_0x2017('0x5f')]+_0x2017('0x8f');}}};};Dialer[_0x2017('0x1b')]['checkIfTime']=function(_0x4dea47,_0x434938,_0x53a10e,_0x1e222b){var _0x573a99=this;return function(){var _0x263489=!![];return _0x573a99[_0x2017('0x90')](_0x4dea47,_0x434938,_0x53a10e,_0x1e222b,_0x263489);};};Dialer[_0x2017('0x1b')][_0x2017('0x91')]=function(_0x5ab994,_0xb8ad44,_0x585059,_0xc0afeb){var _0x4aac4f=this;return function(){var _0xe1e5ff=![];return _0x4aac4f['ifTimeIvr'](_0x5ab994[_0x2017('0x77')],_0xb8ad44,_0x585059,_0xc0afeb,_0xe1e5ff);};};Dialer[_0x2017('0x1b')][_0x2017('0x90')]=function(_0x30feae,_0x1a27e7,_0x1ffc49,_0x255912,_0x27dc4d){var _0x27f53e=[];return new Promise(function(_0x4402cb,_0x51a9be){if(!isNotNull(_0x30feae)){_0x255912['message']=utils[_0x2017('0x66')]['NULL_INTERVAL'];return _0x51a9be(msgResponse(_0x2017('0x92'),_0x2017('0x93'),_0x1ffc49+_0x2017('0x94')));}if(_[_0x2017('0x47')](_0x30feae)){_0x255912[_0x2017('0x6c')]=utils[_0x2017('0x66')][_0x2017('0x95')];return _0x51a9be(msgResponse(_0x2017('0x92'),_0x2017('0x93'),_0x1ffc49+_0x2017('0x96')));}if(_0x1a27e7&&_[_0x2017('0x41')](config[_0x2017('0x97')][_0x1a27e7])){_0x255912['message']=utils[_0x2017('0x66')][_0x2017('0x98')];return _0x51a9be(msgResponse(_0x2017('0x92'),_0x2017('0x93'),_0x1ffc49+_0x2017('0x99')+_0x1a27e7));}if(_[_0x2017('0x9a')](_0x30feae)){for(var _0x3b763d=0x0;_0x3b763d<_0x30feae['length'];_0x3b763d+=0x1){_0x27f53e['push'](ami[_0x2017('0x9b')]({'action':_0x2017('0x9c'),'command':util[_0x2017('0x7c')](_0x2017('0x9d'),_0x30feae[_0x3b763d][_0x2017('0x9e')],!_['isUndefined'](config[_0x2017('0x97')][_0x1a27e7])?_0x1a27e7:'')})['then'](function(_0x24d3ca){return _0x24d3ca[_0x2017('0x9f')][_0x2017('0xa0')](_0x2017('0xa1'))>=0x0;})[_0x2017('0xa2')](myreject(_0x51a9be)));}}else{_0x27f53e['push'](ami[_0x2017('0x9b')]({'action':_0x2017('0x9c'),'command':util['format'](_0x2017('0x9d'),_0x30feae,!_[_0x2017('0x41')](config[_0x2017('0x97')][_0x1a27e7])?_0x1a27e7:'')})[_0x2017('0xa3')](function(_0x3be3e2){return _0x3be3e2[_0x2017('0x9f')][_0x2017('0xa0')]('true')>=0x0;})[_0x2017('0xa2')](myreject(_0x51a9be)));}Promise[_0x2017('0xa4')](_0x27f53e)[_0x2017('0xa3')](function(_0x2845eb){var _0x4edfd0=_['some'](_0x2845eb);if(_0x4edfd0){return _0x4402cb(_0x4edfd0);}else{_0x255912[_0x2017('0x6c')]=_0x27dc4d?utils[_0x2017('0x66')][_0x2017('0xa5')]:utils['CAMPAIGN_STATUS'][_0x2017('0xa6')];return _0x51a9be(msgResponse('[ifTime][promiseAll]',_0x2017('0x93'),'Global:\x20'+_0x27dc4d+'\x20'+_0x1ffc49+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2017('0x44')](_0x30feae,{'showHidden':![],'depth':null})+_0x2017('0xa7')+_0x1a27e7));}})[_0x2017('0xa2')](function(_0x169a53){return _0x51a9be(msgResponse(_0x2017('0x92'),'Failure',JSON[_0x2017('0x72')](_0x169a53)));});});};Dialer[_0x2017('0x1b')][_0x2017('0x3e')]=function(){var _0x4f9c63=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x4f9c63['syncCampaigns']();},0x3e8);});};Dialer[_0x2017('0x1b')]['syncCampaigns']=function(){var _0x24a3eb=this;var _0x171ec1;for(var _0x42f3c7 in this['campaigns']){if(typeof this['campaigns'][_0x42f3c7]!==_0x2017('0xa8')){_0x171ec1=this[_0x2017('0x21')][_0x42f3c7];if(utils[_0x2017('0x7b')](_0x171ec1)&&utils[_0x2017('0x78')](_0x171ec1)){_0x171ec1[_0x2017('0x7f')]=!![];Promise[_0x2017('0xa9')]()[_0x2017('0xa3')](checkIsIVRCampaignActive(_0x171ec1))[_0x2017('0xa3')](checkInterval(_0x171ec1))[_0x2017('0xa3')](_0x24a3eb[_0x2017('0x8b')](_0x171ec1))[_0x2017('0xa3')](_0x24a3eb[_0x2017('0xaa')](_0x171ec1[_0x2017('0xab')],_0x171ec1[_0x2017('0xac')],_0x171ec1['name'],_0x171ec1))[_0x2017('0xa3')](_0x24a3eb[_0x2017('0x91')](_0x171ec1[_0x2017('0x76')],_0x171ec1['dialTimezone'],_0x171ec1[_0x2017('0x5f')],_0x171ec1))[_0x2017('0xa3')](_0x24a3eb[_0x2017('0xad')](_0x171ec1))['catch'](loggerCatchQueueSummary(_0x2017('0xae'),_0x171ec1));}else{notSendMessagesCampaign(_0x171ec1);}}}};Dialer['prototype']['checkDialMethod']=function(_0x335221){if(_0x335221[_0x2017('0xaf')]!==_0x2017('0xb')){clearPredictiveAttributes(_0x335221);}switch(_0x335221[_0x2017('0xaf')]){case _0x2017('0xb0'):this['handlePower'](_0x335221,0x1);break;case _0x2017('0xb1'):this[_0x2017('0xb2')](_0x335221,_0x335221[_0x2017('0xb3')]);break;case'predictive':this['predictive'](_0x335221);break;case _0x2017('0xa'):this[_0x2017('0xb2')](_0x335221,0x1);break;default:logger[_0x2017('0x64')](_0x2017('0xb4'),_0x335221['name'],_0x2017('0xb5'));}};Dialer['prototype']['ifTime']=function(_0x1c8dea,_0x495238){var _0x48cc81=_0x1c8dea['dialTimezone'];var _0x244932=_0x495238?_0x1c8dea['dialGlobalInterval']:_0x1c8dea[_0x2017('0x76')][_0x2017('0x77')];logger[_0x2017('0xb6')]('Dialer::ifTime()',_0x244932,_0x48cc81,_0x1c8dea[_0x2017('0x5f')],util[_0x2017('0x7c')](_0x2017('0xb7'),_0x1c8dea['name'],_0x1c8dea['id']));var _0x416f38=null;return Interval['intervalIftime'](_0x244932,_0x48cc81)[_0x2017('0xa3')](function(_0x308390){if(_0x308390===!![]){return _0x308390;}else{_0x1c8dea[_0x2017('0x6c')]=_0x495238?utils[_0x2017('0x66')][_0x2017('0xa5')]:utils[_0x2017('0x66')][_0x2017('0xa6')];_0x416f38=msgResponse(_0x2017('0xb8'),_0x2017('0x93'),_0x2017('0xb9')+_0x495238+'\x20'+_0x1c8dea[_0x2017('0x5f')]+_0x2017('0xba')+util['inspect'](_0x244932,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x48cc81);}if(_0x416f38!==null){logger[_0x2017('0xb6')](_0x2017('0xbb'),_0x416f38);_0x416f38[_0x2017('0xbc')]=_0x495238;throw _0x416f38;}})[_0x2017('0xa2')](function(_0x1ae68f){logger['error']('AMI\x20IfTime',_0x1ae68f);throw msgResponse('[ifTime][Action]',_0x2017('0x84'),util[_0x2017('0x44')](_0x1ae68f,{'showHidden':![],'depth':null}));});};Dialer[_0x2017('0x1b')]['syncAgentConnect']=function(_0x3bffd2){if(this[_0x2017('0x20')][_0x3bffd2[_0x2017('0xbd')]]){if(this[_0x2017('0xbe')][_0x3bffd2[_0x2017('0xbf')]]&&this[_0x2017('0xbe')][_0x3bffd2[_0x2017('0xbf')]][_0x2017('0x42')]!==_0x2017('0xc0')){this[_0x2017('0xc1')](this[_0x2017('0x20')][_0x3bffd2[_0x2017('0xbd')]]);this['uniqueId'][_0x3bffd2['uniqueid']]['answertime']=moment()[_0x2017('0x7c')](_0x2017('0xc2'));}}};Dialer[_0x2017('0x1b')]['syncAgentComplete']=function(_0x23387b){var _0x517bc5=this[_0x2017('0xbe')][_0x23387b[_0x2017('0xbf')]];if(this[_0x2017('0x20')][_0x23387b['queue']]){if(_0x517bc5&&_0x517bc5['type']!==_0x2017('0xc0')){delete this[_0x2017('0xbe')][_0x23387b[_0x2017('0xbf')]];this[_0x2017('0x20')][_0x23387b[_0x2017('0xbd')]][_0x2017('0xc3')]+=0x1;var _0x12ec3e=new AgentComplete(_0x517bc5,_0x23387b);if(_0x23387b['reason']===_0x2017('0xc4')){_0x12ec3e['agiafterat']=this[_0x2017('0x20')][_0x23387b[_0x2017('0xbd')]][_0x2017('0xc5')]&&this[_0x2017('0x20')][_0x23387b[_0x2017('0xbd')]][_0x2017('0xc6')]?moment()[_0x2017('0x7c')](_0x2017('0xc2')):undefined;}hopperUtils[_0x2017('0xc7')](_0x12ec3e)[_0x2017('0xa2')](loggerCatch(_0x2017('0xc8')));hopperUtils[_0x2017('0xc9')](_0x12ec3e)[_0x2017('0xa2')](loggerCatch(_0x2017('0xca')));}}};Dialer[_0x2017('0x1b')][_0x2017('0xcb')]=function(_0x467bf0){var _0x3f76bf=this[_0x2017('0xbe')][_0x467bf0[_0x2017('0xbf')]];var _0x4fa577=this;var _0x310a95=![];var _0x1d25a4;var _0x73305b;if(this['voiceQueues'][_0x467bf0[_0x2017('0xbd')]]){if(_0x3f76bf&&_0x3f76bf[_0x2017('0x42')]!==_0x2017('0xc0')){delete this[_0x2017('0xbe')][_0x467bf0['uniqueid']];this[_0x2017('0xc1')](this[_0x2017('0x20')][_0x467bf0['queue']]);_0x3f76bf[_0x2017('0xcc')]=moment()[_0x2017('0x7c')](_0x2017('0xc2'));var _0x28a5d9=new QueueCallerAbandon(_0x3f76bf,_0x467bf0);if(utils[_0x2017('0xcd')](_0x3f76bf[_0x2017('0xcc')],_0x3f76bf[_0x2017('0xce')])>=_0x3f76bf['dialQueueTimeout']){this[_0x2017('0x20')][_0x467bf0[_0x2017('0xbd')]][_0x2017('0x4d')]+=0x1;this['voiceQueues'][_0x467bf0[_0x2017('0xbd')]][_0x2017('0xcf')]+=0x1;this['voiceQueues'][_0x467bf0[_0x2017('0xbd')]][_0x2017('0xd0')]+=0x1;_0x28a5d9[_0x2017('0x6d')]=0xa;_0x28a5d9[_0x2017('0x6e')]='Drop';_0x28a5d9['dropreason']=_0x2017('0xd1');_0x28a5d9[_0x2017('0xd2')]=this[_0x2017('0x20')][_0x467bf0[_0x2017('0xbd')]][_0x2017('0xc5')]?moment()[_0x2017('0x7c')](_0x2017('0xc2')):undefined;_0x28a5d9[_0x2017('0xd3')]+=0x1;_0x28a5d9['countglobal']+=0x1;_0x1d25a4=this[_0x2017('0x20')][_0x467bf0['queue']][_0x2017('0xd4')];_0x73305b=this['voiceQueues'][_0x467bf0[_0x2017('0xbd')]][_0x2017('0xd5')];hopperUtils[_0x2017('0xd6')](_0x28a5d9,_0x28a5d9[_0x2017('0x6d')],_0x3f76bf[_0x2017('0xd7')])['then'](function(_0x2459a8){_0x310a95=_0x2459a8[_0x2017('0xd8')]==0x1;if(_0x28a5d9[_0x2017('0xd3')]>=_0x4fa577[_0x2017('0x20')][_0x467bf0[_0x2017('0xbd')]]['dialDropMaxRetry']){_0x4fa577['queueCallerAbandonCreateState'](_0x28a5d9,_0x2459a8[_0x2017('0xd8')]);}else{hopperUtils[_0x2017('0xd9')]({'active':![],'countdropretry':_0x28a5d9['countdropretry'],'scheduledat':moment()['add'](_0x4fa577[_0x2017('0x20')][_0x467bf0[_0x2017('0xbd')]]['dialDropRetryFrequency'],_0x2017('0xda'))['format'](_0x2017('0xc2')),'ContactId':_0x3f76bf[_0x2017('0xdb')],'ListId':_0x3f76bf[_0x2017('0xdc')],'VoiceQueueId':_0x3f76bf[_0x2017('0xdd')]||undefined,'CampaignId':_0x3f76bf['CampaignId']||undefined})[_0x2017('0xa2')](loggerCatch('[rescheduleContact][Drop]'));var _0x573fc4=new History(_0x28a5d9);_0x573fc4['state']=0xa;_0x573fc4[_0x2017('0x6e')]='Drop';_0x573fc4[_0x2017('0xde')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x573fc4[_0x2017('0x6f')]=_0x573fc4[_0x2017('0xde')];_0x573fc4['calleridname']=_0x28a5d9[_0x2017('0xdf')];_0x573fc4[_0x2017('0xe0')]=_0x28a5d9['calleridnum'];hopperUtils['createHistory'](_0x573fc4)[_0x2017('0xa2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x2017('0xa3')](function(){if(_0x310a95)hopperUtils[_0x2017('0xe1')](_0x28a5d9,_0x1d25a4,_0x73305b)[_0x2017('0xa3')](function(){return 0x1;});});}else{this['voiceQueues'][_0x467bf0[_0x2017('0xbd')]][_0x2017('0xe2')]+=0x1;this[_0x2017('0x20')][_0x467bf0['queue']][_0x2017('0xe3')]+=0x1;_0x28a5d9['state']=0xb;_0x28a5d9[_0x2017('0x6e')]='Abandoned';_0x28a5d9[_0x2017('0xe4')]='CALLEREXIT';_0x28a5d9[_0x2017('0xe5')]+=0x1;_0x28a5d9[_0x2017('0xe6')]+=0x1;_0x1d25a4=this[_0x2017('0x20')][_0x467bf0[_0x2017('0xbd')]][_0x2017('0xe7')];_0x73305b=this[_0x2017('0x20')][_0x467bf0[_0x2017('0xbd')]][_0x2017('0xd5')];hopperUtils[_0x2017('0xd6')](_0x28a5d9,_0x28a5d9[_0x2017('0x6d')],_0x3f76bf[_0x2017('0xd7')])[_0x2017('0xa3')](function(_0x11da9a){if(_0x28a5d9['countabandonedretry']>=_0x4fa577[_0x2017('0x20')][_0x467bf0[_0x2017('0xbd')]][_0x2017('0xe8')]){_0x4fa577['queueCallerAbandonCreateState'](_0x28a5d9,_0x11da9a['additional']);}else{hopperUtils[_0x2017('0xd9')]({'active':![],'countabandonedretry':_0x28a5d9[_0x2017('0xe5')],'scheduledat':moment()['add'](_0x4fa577[_0x2017('0x20')][_0x467bf0['queue']]['dialAbandonedRetryFrequency'],_0x2017('0xda'))[_0x2017('0x7c')](_0x2017('0xc2')),'ContactId':_0x3f76bf[_0x2017('0xdb')],'ListId':_0x3f76bf[_0x2017('0xdc')],'VoiceQueueId':_0x3f76bf[_0x2017('0xdd')]||undefined,'CampaignId':_0x3f76bf[_0x2017('0xe9')]||undefined})['catch'](loggerCatch(_0x2017('0xea')));var _0x2a19da=new History(_0x28a5d9);_0x2a19da[_0x2017('0x6d')]=0xb;_0x2a19da[_0x2017('0x6e')]=_0x2017('0xeb');_0x2a19da[_0x2017('0xde')]=moment()[_0x2017('0x7c')](_0x2017('0xc2'));_0x2a19da[_0x2017('0x6f')]=_0x2a19da['starttime'];_0x2a19da[_0x2017('0xdf')]=_0x28a5d9[_0x2017('0xdf')];_0x2a19da[_0x2017('0xe0')]=_0x28a5d9[_0x2017('0xe0')];hopperUtils['createHistory'](_0x2a19da)[_0x2017('0xa2')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x2017('0xa3')](function(){if(_0x310a95)hopperUtils[_0x2017('0xe1')](_0x28a5d9,_0x1d25a4,_0x73305b)[_0x2017('0xa3')](function(){return 0x1;});});}}}};Dialer[_0x2017('0x1b')]['syncNewExten']=function(_0x4e7395){if(this[_0x2017('0x26')][_0x4e7395[_0x2017('0xbf')]]){this[_0x2017('0x26')][_0x4e7395['uniqueid']][_0x2017('0xec')]=_0x4e7395['channel'];}if(this[_0x2017('0xbe')][_0x4e7395[_0x2017('0xbf')]]){this[_0x2017('0xbe')][_0x4e7395['uniqueid']][_0x2017('0xec')]=_0x4e7395['channel'];}};Dialer[_0x2017('0x1b')][_0x2017('0x3b')]=function(_0x290005){if(!this[_0x2017('0x26')][_0x290005[_0x2017('0xed')]]){return;}var _0x594e68=this[_0x2017('0x20')][this[_0x2017('0x26')][_0x290005['actionid']][_0x2017('0xbd')]]['strategy']||_0x2017('0xee');if(_0x594e68==='roundrobin'){if(this[_0x2017('0x26')][_0x290005[_0x2017('0xed')]]&&_[_0x2017('0xef')](this[_0x2017('0x26')][_0x290005['actionid']][_0x2017('0xf0')])&&_0x290005['status']==='1'&&_0x290005[_0x2017('0xf1')]==='0'){if(this['agents'][_0x290005['stateinterface']]){if(!this[_0x2017('0x22')][_0x290005[_0x2017('0xf2')]]['locked']){this[_0x2017('0x22')][_0x290005[_0x2017('0xf2')]][_0x2017('0xf0')]=!![];this['actions'][_0x290005['actionid']][_0x2017('0xf0')]=!![];this['actions'][_0x290005['actionid']][_0x2017('0xf2')]=_0x290005[_0x2017('0xf2')];}}}}else if(_0x594e68===_0x2017('0xee')){if(this[_0x2017('0x26')][_0x290005['actionid']]){if(this[_0x2017('0x22')][_0x290005[_0x2017('0xf2')]]){this[_0x2017('0x26')][_0x290005[_0x2017('0xed')]][_0x2017('0xf2')]=_0x290005[_0x2017('0xf2')];if(_[_0x2017('0xef')](this[_0x2017('0x2c')][this[_0x2017('0x26')][_0x290005['actionid']][_0x2017('0xbd')]])){this[_0x2017('0x2c')][this['actions'][_0x290005['actionid']][_0x2017('0xbd')]]=[];}this[_0x2017('0x2c')][this[_0x2017('0x26')][_0x290005['actionid']]['queue']]['push'](_[_0x2017('0x5e')](_['pick'](this['actions'][_0x290005[_0x2017('0xed')]],[_0x2017('0xf3'),'stateinterface']),{'status':_0x290005['status'],'paused':_0x290005['paused']}));}}}};Dialer[_0x2017('0x1b')][_0x2017('0x3d')]=function(_0xad3e77){if(!this['actions'][_0xad3e77['actionid']]){return;}var _0x516636=this;var _0x423100=this[_0x2017('0x20')][this[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]]['queue']];var _0x58c89e=_0x423100['strategy']||'rrmemory';if(_0x58c89e===_0x2017('0xf4')){if(this['actions'][_0xad3e77[_0x2017('0xed')]]&&this[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]][_0x2017('0xf2')]){this[_0x2017('0x1f')][_0x2017('0xf5')](this[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]]['idHopper'],this[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]][_0x2017('0xf2')])[_0x2017('0xa2')](function(_0x5e65c5){logger[_0x2017('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x5e65c5,{'showHidden':![],'depth':null}));})[_0x2017('0x1d')](function(){_0x516636[_0x2017('0xc1')](_0x516636[_0x2017('0x20')][_0x516636[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]][_0x2017('0xbd')]]);_0x516636[_0x2017('0x22')][_0x516636[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]][_0x2017('0xf2')]][_0x2017('0xf0')]=![];delete _0x516636[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]];unlockQueueStatus(_0x423100);});}else{this['updateOriginated'](this[_0x2017('0x20')][this['actions'][_0xad3e77[_0x2017('0xed')]]['queue']]);hopperUtils[_0x2017('0xd9')]({'active':![],'ContactId':this[_0x2017('0x26')][_0xad3e77['actionid']][_0x2017('0xdb')],'ListId':this['actions'][_0xad3e77[_0x2017('0xed')]][_0x2017('0xdc')],'VoiceQueueId':this[_0x2017('0x26')][_0xad3e77['actionid']][_0x2017('0xdd')]||undefined,'CampaignId':this[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]]['CampaignId']||undefined})[_0x2017('0xa2')](loggerCatch(_0x2017('0xf6')));delete this['actions'][_0xad3e77[_0x2017('0xed')]];unlockQueueStatus(_0x423100);}}else if(_0x58c89e===_0x2017('0xee')){var _0x2bdeb2;if(this['actions'][_0xad3e77[_0x2017('0xed')]]&&!_[_0x2017('0x47')](this[_0x2017('0x2c')][this[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]][_0x2017('0xbd')]])){if(this[_0x2017('0x2d')][_0x516636[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]][_0x2017('0xbd')]]){this[_0x2017('0x2d')][_0x516636[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]]['queue']]=this['queueBookedRR'][this['actions'][_0xad3e77[_0x2017('0xed')]][_0x2017('0xbd')]]?this[_0x2017('0x2d')][this[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]]['queue']]:this[_0x2017('0x2c')][this[_0x2017('0x26')][_0xad3e77['actionid']][_0x2017('0xbd')]]?this[_0x2017('0x2c')][this[_0x2017('0x26')][_0xad3e77[_0x2017('0xed')]][_0x2017('0xbd')]][_0x2017('0xf7')]||0x0:0x0;}this[_0x2017('0x2c')][this['actions'][_0xad3e77['actionid']][_0x2017('0xbd')]][_0x2017('0xf7')]=this['queueBookedRR'][this[_0x2017('0x26')][_0xad3e77['actionid']]['queue']];for(var _0x296497=0x0;_0x296497=_0x259fbd[_0x2017('0x11f')]){_0x259766[_0x2017('0x120')](_0x3b9200,_0x526bb0,_0x167f66,_0x2017('0x121'));}else{if(_0x3b9200[_0x2017('0x11e')]>=_0x259fbd['dialMachineMaxRetry']){_0x259766[_0x2017('0x122')](_0x3b9200,_0x526bb0,_0x167f66,_0x2017('0x123'));}else{hopperUtils[_0x2017('0xd9')]({'active':![],'countmachineretry':_0x3b9200[_0x2017('0x11e')],'scheduledat':moment()['add'](_0x259fbd[_0x2017('0x124')],_0x2017('0xda'))['format'](_0x2017('0xc2')),'ContactId':_0x3b9200[_0x2017('0xdb')],'ListId':_0x3b9200[_0x2017('0xdc')],'VoiceQueueId':_0x3b9200['VoiceQueueId']||undefined,'CampaignId':_0x3b9200[_0x2017('0xe9')]||undefined})[_0x2017('0xa2')](loggerCatch('[rescheduleContact][Machine]'));_0x526bb0({'reschedule':0x1});}}});}if(_0x5ce0a3[_0x2017('0x42')]===_0x2017('0xc0')&&this[_0x2017('0x21')][_0x5ce0a3[_0x2017('0xbd')]][_0x2017('0x10c')]&&_0x410f8f['value']==='HANGUP'){delete this[_0x2017('0xbe')][_0x410f8f[_0x2017('0xbf')]];this['updateOriginated'](this[_0x2017('0x21')][_0x5ce0a3[_0x2017('0xbd')]]);_0x5834e6=new Hangup(_0x5ce0a3,_0x410f8f);_0x5834e6[_0x2017('0x6d')]=0x12;_0x5834e6[_0x2017('0x6e')]='HangupInAMD';_0x5834e6[_0x2017('0x125')]=_0x2017('0x111');ami[_0x2017('0x112')](_0x2017('0x113'),ut[_0x2017('0x114')](_0x5834e6,_0x2017('0x115')));this[_0x2017('0x116')](_0x5834e6,_0x2017('0x126'),_0x2017('0x127'));}if(_0x5ce0a3[_0x2017('0x42')]===_0x2017('0xc0')&&this[_0x2017('0x21')][_0x5ce0a3['queue']][_0x2017('0x10c')]&&_0x410f8f[_0x2017('0x10d')]==='MACHINE'){return new Promise(function(_0x1acfeb,_0x5705ab){delete _0x259766['uniqueId'][_0x410f8f[_0x2017('0xbf')]];_0x259766[_0x2017('0xc1')](_0x259766['campaigns'][_0x5ce0a3[_0x2017('0xbd')]]);_0x259766[_0x2017('0x21')][_0x5ce0a3['queue']]['outboundAnswerCallsDay']+=0x1;_0x259766[_0x2017('0x21')][_0x5ce0a3['queue']][_0x2017('0x10f')]+=0x1;var _0x5ca513=_0x259766[_0x2017('0x21')][_0x5ce0a3[_0x2017('0xbd')]];var _0x2c1f0c=new Hangup(_0x5ce0a3,_0x410f8f);_0x2c1f0c[_0x2017('0x6d')]=0x13;_0x2c1f0c[_0x2017('0x6e')]='Machine';_0x2c1f0c[_0x2017('0x125')]=_0x2017('0x111');_0x2c1f0c[_0x2017('0x11e')]+=0x1;_0x2c1f0c['countglobal']+=0x1;_0x2c1f0c['amd']=!![];ami['emit'](_0x2017('0x113'),ut[_0x2017('0x114')](_0x2c1f0c,_0x2017('0x115')));hopperUtils[_0x2017('0xc7')](_0x2c1f0c)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2c1f0c[_0x2017('0x11b')]+_0x2c1f0c[_0x2017('0x128')]+_0x2c1f0c[_0x2017('0x11c')]+_0x2c1f0c[_0x2017('0x11d')]+_0x2c1f0c[_0x2017('0xd3')]+_0x2c1f0c['countabandonedretry']+_0x2c1f0c['countmachineretry']+_0x2c1f0c['countagentrejectretry']>=_0x5ca513[_0x2017('0x11f')]){_0x259766[_0x2017('0x120')](_0x2c1f0c,_0x1acfeb,_0x5705ab,_0x2017('0x121'));}else{if(_0x2c1f0c['countmachineretry']>=_0x5ca513[_0x2017('0x129')]){_0x259766[_0x2017('0x122')](_0x2c1f0c,_0x1acfeb,_0x5705ab,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2c1f0c['countmachineretry'],'scheduledat':moment()['add'](_0x5ca513[_0x2017('0x124')],_0x2017('0xda'))['format'](_0x2017('0xc2')),'ContactId':_0x2c1f0c[_0x2017('0xdb')],'ListId':_0x2c1f0c['ListId'],'VoiceQueueId':_0x2c1f0c[_0x2017('0xdd')]||undefined,'CampaignId':_0x2c1f0c[_0x2017('0xe9')]||undefined})[_0x2017('0xa2')](loggerCatch('[rescheduleContact][Machine]'));_0x1acfeb({'reschedule':0x1});}}});}}};Dialer[_0x2017('0x1b')][_0x2017('0x36')]=function(_0x5d27a5){var _0x173d24=this[_0x2017('0xbe')][_0x5d27a5[_0x2017('0xbf')]];var _0x394343;if(_0x173d24&&_0x173d24['type']===_0x2017('0xc0')){delete this[_0x2017('0xbe')][_0x5d27a5[_0x2017('0xbf')]];this[_0x2017('0xc1')](this[_0x2017('0x21')][_0x173d24[_0x2017('0xbd')]]);this[_0x2017('0x21')][_0x173d24[_0x2017('0xbd')]]['ivrAnswerCallsDay']+=0x1;_0x394343=new Hangup(_0x173d24,_0x5d27a5);hopperUtils[_0x2017('0xc7')](_0x394343)[_0x2017('0xa2')](loggerCatch(_0x2017('0x12a')));hopperUtils['moveContactManagedDialer'](_0x394343)[_0x2017('0xa2')](loggerCatch('[syncHangupIvr]'));}if(_0x173d24&&_0x173d24[_0x2017('0x42')]!==_0x2017('0xc0')&&isNotNull(this[_0x2017('0x20')][_0x173d24[_0x2017('0xbd')]]['dialQueueProject'])){delete this[_0x2017('0xbe')][_0x5d27a5[_0x2017('0xbf')]];this['updateOriginated'](this['voiceQueues'][_0x173d24[_0x2017('0xbd')]]);this[_0x2017('0x20')][_0x173d24[_0x2017('0xbd')]][_0x2017('0xc3')]+=0x1;this[_0x2017('0x20')][_0x173d24['queue']][_0x2017('0x10f')]+=0x1;_0x394343=new Hangup(_0x173d24,_0x5d27a5);_0x394343[_0x2017('0x6d')]=0x10;_0x394343[_0x2017('0x6e')]=_0x2017('0x12b');_0x394343['membername']='AGI';hopperUtils[_0x2017('0xc7')](_0x394343)[_0x2017('0xa2')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x394343)[_0x2017('0xa2')](loggerCatch(_0x2017('0x12c')));}if(_0x173d24&&_0x173d24[_0x2017('0x42')]!==_0x2017('0xc0')&&!isNotNull(this[_0x2017('0x20')][_0x173d24[_0x2017('0xbd')]]['dialQueueProject'])){delete this['uniqueId'][_0x5d27a5['uniqueid']];this[_0x2017('0xc1')](this[_0x2017('0x20')][_0x173d24[_0x2017('0xbd')]]);this[_0x2017('0x20')][_0x173d24['queue']][_0x2017('0x12d')]+=0x1;_0x394343=new Hangup(_0x173d24,_0x5d27a5);_0x394343[_0x2017('0x6d')]=0xc;_0x394343[_0x2017('0x6e')]=_0x5d27a5[_0x2017('0x12e')];_0x394343[_0x2017('0x125')]=_0x2017('0x12f');hopperUtils['createHistory'](_0x394343)[_0x2017('0xa2')](loggerCatch(_0x2017('0x12a')));hopperUtils[_0x2017('0xc9')](_0x394343)['catch'](loggerCatch(_0x2017('0x12c')));}};Dialer[_0x2017('0x1b')][_0x2017('0xc')]=function(_0x236dd8){var _0x1ec555=this;if(!_0x1ec555[_0x2017('0x130')][_0x236dd8[_0x2017('0x5f')]]){_0x1ec555[_0x2017('0x130')][_0x236dd8[_0x2017('0x5f')]]={'running':![]};}else if(_0x1ec555[_0x2017('0x130')][_0x236dd8['name']][_0x2017('0x131')]===!![]){return;}else if(_0x1ec555[_0x2017('0x130')][_0x236dd8[_0x2017('0x5f')]][_0x2017('0x131')]===![]){_0x1ec555['queuesSummary'][_0x236dd8['name']][_0x2017('0x131')]=!![];}var _0x94cbe3=_0x1ec555['voiceQueues'][_0x236dd8[_0x2017('0x5f')]];var _0x2ed8ee=_0x94cbe3[_0x2017('0x6c')]!==utils[_0x2017('0x66')][_0x2017('0x79')];var _0x380f37=utils['isPreviewCampaign'](_0x94cbe3);_0x94cbe3[_0x2017('0x132')]=utils['getQueueCampaignStatusMessage'](_0x94cbe3,_0x1ec555[_0x2017('0x23')]);Promise['resolve']()[_0x2017('0xa3')](function(){if(_0x94cbe3['statusMessage']===utils[_0x2017('0x66')][_0x2017('0x79')]){if(_0x2ed8ee){clearPredictiveAttributes(_0x94cbe3);_0x236dd8[_0x2017('0x29')]=undefined;_0x236dd8[_0x2017('0x2a')]=undefined;}if(_0x94cbe3[_0x2017('0x132')]===utils[_0x2017('0x66')][_0x2017('0x79')]){_0x236dd8[_0x2017('0x133')]=0x0;_0x236dd8[_0x2017('0xf1')]=0x0;_0x236dd8[_0x2017('0x134')]=0x0;_0x236dd8[_0x2017('0x135')]=0x0;_0x236dd8[_0x2017('0x136')]=0x0;}}else if(_0x94cbe3[_0x2017('0x132')]===utils[_0x2017('0x66')]['ACTIVE']&&!_0x380f37){return _0x1ec555[_0x2017('0x92')](_0x94cbe3,!![])[_0x2017('0xa3')](function(){return _0x1ec555[_0x2017('0x92')](_0x94cbe3,![]);})[_0x2017('0xa3')](function(){return _0x1ec555[_0x2017('0x137')](_0x94cbe3);})[_0x2017('0xa2')](function(_0x6c95f){loggerSyncQueueSummary[_0x2017('0x43')](_0x2017('0x138'),util[_0x2017('0x44')](_0x6c95f,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x94cbe3);});}else{clearPredictiveAttributes(_0x94cbe3);}})['then'](function(){var _0x265e65=_0x236dd8['compareToOutboundQueue'](_0x94cbe3);if(_0x265e65||_0x94cbe3[_0x2017('0x139')]){_0x94cbe3['queueSummaryCountersUpdated']=![];_0x236dd8[_0x2017('0x13a')](_0x94cbe3);Object[_0x2017('0x13b')](_0x94cbe3,_0x236dd8);emitOutboundVoiceQueueSummary(_0x236dd8);}_0x1ec555['queuesSummary'][_0x94cbe3[_0x2017('0x5f')]][_0x2017('0x131')]=![];})[_0x2017('0xa2')](function(_0x1f3016){logger['error'](_0x2017('0x138'),util[_0x2017('0x44')](_0x1f3016,{'showHidden':![],'depth':null}));_0x1ec555[_0x2017('0x130')][_0x94cbe3['name']][_0x2017('0x131')]=![];});};Dialer[_0x2017('0x1b')][_0x2017('0x13c')]=_[_0x2017('0x13d')](function(){var _0x34ed11=_[_0x2017('0x13e')](this['voiceQueues'],function(_0x468201){return _0x468201[_0x2017('0x13f')];});var _0xebd420=_[_0x2017('0x13e')](this['agents'],function(_0x5467fb){return _0x5467fb[_0x2017('0x140')]&&_0x5467fb[_0x2017('0x88')]===_0x2017('0x89');});if(_0x34ed11[_0x2017('0xf8')]>0x0&&_0xebd420[_0x2017('0xf8')]>0x0){return Promise[_0x2017('0xa9')]()[_0x2017('0xa3')](cmHopper[_0x2017('0x141')](_[_0x2017('0x142')](_0x34ed11,'id'),previewRecallmeReminderInterval,_[_0x2017('0x142')](_0xebd420,'id')))[_0x2017('0xa3')](function(_0x5e3ab5){for(var _0x213d14=0x0;_0x213d14<_0x5e3ab5[_0x2017('0xf8')];_0x213d14++){var _0x9d86b9=_0x5e3ab5[_0x213d14][_0x2017('0x143')][_0x2017('0x5f')];if(_0x9d86b9)io['to'](util['format'](_0x2017('0x144'),_0x9d86b9))[_0x2017('0x112')]('user:dialPreviewRecallReminder',{'hopper':_0x5e3ab5[_0x213d14]});}})[_0x2017('0xa2')](function(_0x29daeb){logger['error'](_0x2017('0x145'),_0x29daeb);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x2017('0x1b')][_0x2017('0x3f')]=function(){var _0x55573e=this;setInterval(function(){_0x55573e[_0x2017('0x146')](_0x55573e[_0x2017('0xbe')],_0x2017('0x147'));_0x55573e[_0x2017('0x146')](_0x55573e[_0x2017('0x26')],'[actions]');},0x32c8);};Dialer[_0x2017('0x1b')][_0x2017('0x146')]=function(_0x22e664,_0x3e2d2e){var _0x3f6133=this;for(var _0x544af4 in _0x22e664){if(typeof _0x22e664[_0x544af4]!==_0x2017('0xa8')){this['sequence'][_0x2017('0x148')](function(){if(!_[_0x2017('0xef')](_0x22e664[_0x544af4])){return ami['Action']({'action':_0x2017('0x88'),'channel':_0x22e664[_0x544af4][_0x2017('0xec')]})[_0x2017('0xa2')](function(_0x3d9344){if(_0x3d9344[_0x2017('0x6c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x22e664[_0x544af4]&&_0x22e664[_0x544af4][_0x2017('0x42')]!==_0x2017('0xc0')){_0x3f6133[_0x2017('0xc1')](_0x3f6133[_0x2017('0x20')][_0x22e664[_0x544af4][_0x2017('0xbd')]]);logger[_0x2017('0x64')](_0x2017('0x149'),_0x3e2d2e,_0x544af4,_0x22e664[_0x544af4][_0x2017('0xbd')]);delete _0x22e664[_0x544af4];}if(_0x22e664[_0x544af4]&&_0x22e664[_0x544af4][_0x2017('0x42')]==='ivr'){_0x3f6133[_0x2017('0xc1')](_0x3f6133['campaigns'][_0x22e664[_0x544af4][_0x2017('0xbd')]]);logger[_0x2017('0x64')]('[Dialer][checkChannel][ivr]',_0x3e2d2e,_0x544af4,_0x22e664[_0x544af4][_0x2017('0xbd')]);delete _0x22e664[_0x544af4];}},0x2328);}});}});}}};Dialer[_0x2017('0x1b')][_0x2017('0x14a')]=function(_0x58018b){return Promise['resolve']()['then'](voiceQueueRt[_0x2017('0x14a')](_0x58018b))[_0x2017('0xa2')](loggerCatch(_0x2017('0x14b')));};Dialer['prototype']['updateOriginated']=function(_0x3d476a){if(!_[_0x2017('0x41')](_0x3d476a)&&_0x3d476a!==null){if(typeof _0x3d476a['originated']!==_0x2017('0xa8')){if(_0x3d476a[_0x2017('0x80')]>0x0){_0x3d476a[_0x2017('0x80')]-=0x1;}else{logger[_0x2017('0x64')](_0x2017('0x14c'));}}}else{logger[_0x2017('0x64')](_0x2017('0x14d'));}};Dialer[_0x2017('0x1b')][_0x2017('0x14e')]=function(_0x5ed34e,_0x288faa){var _0x5c380f=this;return function(_0x4c3aee){_0x5c380f[_0x2017('0xc1')](_0x288faa);logger[_0x2017('0x64')](_0x5ed34e,util[_0x2017('0x44')](_0x4c3aee,{'showHidden':![],'depth':null}));};};Dialer[_0x2017('0x1b')][_0x2017('0x14f')]=function(_0x31e517,_0x3642af,_0x4d8f95){var _0x1905e9={'state':0x19,'statedesc':_0x2017('0x150')};this[_0x2017('0xc1')](_0x3642af);this[_0x2017('0x116')](_['merge'](_0x1905e9,_['pick'](_0x4d8f95,['ContactId',_0x2017('0xdc'),_0x2017('0x151'),'VoiceQueueId',_0x2017('0xe9')])),_0x2017('0x152'),_0x2017('0x153'));logger[_0x2017('0x64')](_0x31e517);};Dialer[_0x2017('0x1b')][_0x2017('0x116')]=function(_0x435333,_0x21edc5,_0x3b4261){hopperUtils['createHistory'](_0x435333)[_0x2017('0xa2')](loggerCatch(_0x21edc5));hopperUtils[_0x2017('0xc9')](_0x435333)[_0x2017('0xa2')](loggerCatch(_0x3b4261));};Dialer[_0x2017('0x1b')][_0x2017('0x154')]=function(_0xfdcff9,_0x4d6d8e){hopperUtils['createHistory'](_0xfdcff9)[_0x2017('0xa2')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x4d6d8e==0x0){hopperUtils[_0x2017('0xc9')](_0xfdcff9)[_0x2017('0xa2')](loggerCatch(_0x2017('0x155')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x503949){return Promise[_0x2017('0xa9')]()['then'](cmHopper[_0x2017('0x141')](_0x503949['id'],previewRecallmeReminderInterval))[_0x2017('0xa3')](function(_0x1303ed){for(var _0x5872f4=0x0;_0x5872f4<_0x1303ed[_0x2017('0xf8')];_0x5872f4++){var _0x2662ea=_0x1303ed[_0x5872f4]['Agent'][_0x2017('0x5f')];if(_0x2662ea)io['to'](util[_0x2017('0x7c')](_0x2017('0x144'),_0x2662ea))[_0x2017('0x112')](_0x2017('0x156'),{'hopper':_0x1303ed[_0x5872f4]});}})['catch'](function(){});};Dialer[_0x2017('0x1b')][_0x2017('0xad')]=function(_0x248930){var _0x243551=this;return function(){_0x243551[_0x2017('0x157')](_0x248930);};};Dialer[_0x2017('0x1b')][_0x2017('0x158')]=function(_0x2a2eb4,_0x1c99aa){var _0x5ece62=this;var _0x4c726d=uuid['v4']();this[_0x2017('0x26')][_0x4c726d]=new Action(_0x2a2eb4,_0x1c99aa,_0x4c726d);return new Promise(function(_0x3e0431,_0x39f1f7){if(_['isUndefined'](_0x2a2eb4)&&typeof _0x2a2eb4!=='object'){return _0x39f1f7(msgResponse(_0x2017('0x159'),_0x2017('0x93'),_0x2017('0x15a')));}if(_[_0x2017('0x41')](_0x1c99aa['phone'])||_0x1c99aa[_0x2017('0x15b')]===null){return _0x39f1f7(msgResponse(_0x2017('0x159'),_0x2017('0x93'),_0x2017('0x15c')));}var _0x446ada={'XMD-CALLERID':_0x5ece62['actions'][_0x4c726d][_0x2017('0x15d')](),'XMD-AGI':_0x2a2eb4[_0x2017('0x15e')]?util[_0x2017('0x7c')](_0x2017('0x15f'),ipAgi,_0x2a2eb4[_0x2017('0x15e')]):_0x2017('0x160'),'XMD-AGIAFTER':_0x2a2eb4[_0x2017('0xc5')]?util['format'](_0x2017('0x15f'),ipAgi,_0x2a2eb4[_0x2017('0xc5')]):_0x2017('0x160'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2a2eb4)?util[_0x2017('0x7c')]('\x22%s,%s%s,,,%s\x22',_0x2a2eb4['name'],_0x2a2eb4[_0x2017('0x161')]||'',_0x2a2eb4[_0x2017('0xc6')]?'c':'',_0x2a2eb4['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x1c99aa[_0x2017('0xdb')],'XMD-CDRTYPE':_0x2017('0x8'),'CALLERID(all)':_0x5ece62['actions'][_0x4c726d][_0x2017('0x15d')](),'XMD-AMD':_0x2a2eb4['dialAMDActive']?'ACTIVE':_0x2017('0x160'),'XMD-DESTINATION':_0x2017('0x10b')};if(_0x2a2eb4['dialAMDActive']){_0x446ada[_0x2017('0x162')]=_0x2a2eb4[_0x2017('0x163')]||0x9c4;_0x446ada[_0x2017('0x164')]=_0x2a2eb4[_0x2017('0x165')]||0x5dc;_0x446ada['XMD-AMDAFTERGREETINGSILENCE']=_0x2a2eb4[_0x2017('0x166')]||0x320;_0x446ada['XMD-AMDTOTALANALYSISTIME']=_0x2a2eb4[_0x2017('0x167')]||0x1388;_0x446ada[_0x2017('0x168')]=_0x2a2eb4[_0x2017('0x169')]||0x64;_0x446ada[_0x2017('0x16a')]=_0x2a2eb4[_0x2017('0x16b')]||0x32;_0x446ada['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2a2eb4[_0x2017('0x16c')]||0x3;_0x446ada[_0x2017('0x16d')]=_0x2a2eb4[_0x2017('0x16e')]||0x100;_0x446ada[_0x2017('0x16f')]=_0x2a2eb4['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x2017('0x170')](_0x2a2eb4)){_0x446ada[_0x2017('0x171')]=_0x1c99aa[_0x2017('0xdd')];}else{_0x446ada['XMD-CAMPAIGNID']=_0x1c99aa['CampaignId'];}var _0x49dd28=utils[_0x2017('0x172')](_0x1c99aa['Contact']);Object['assign'](_0x446ada,_0x49dd28);var _0x1facde=_0x5ece62[_0x2017('0x85')](_0x2a2eb4[_0x2017('0x8c')])?utils[_0x2017('0x173')](_0x2a2eb4[_0x2017('0x8c')]['callerid'],_0x2a2eb4['dialOriginateCallerIdName'],_0x2a2eb4[_0x2017('0x174')]>0x0?utils[_0x2017('0x175')](_0x2a2eb4[_0x2017('0x176')],_0x2a2eb4['dialRandomLastDigitCallerIdNumber']):_0x2a2eb4[_0x2017('0x176')]):utils[_0x2017('0x173')](_[_0x2017('0xef')](_0x2a2eb4[_0x2017('0x8d')])?_0x2a2eb4['Trunk'][_0x2017('0x177')]:_0x2a2eb4[_0x2017('0x8d')]['callerid'],_0x2a2eb4[_0x2017('0x178')],_0x2a2eb4[_0x2017('0x174')]>0x0?utils[_0x2017('0x175')](_0x2a2eb4[_0x2017('0x176')],_0x2a2eb4[_0x2017('0x174')]):_0x2a2eb4[_0x2017('0x176')]);if(_0x1facde){_0x446ada['XMD-ORIGINATECALLERIDNAME']=_0x5ece62['actions'][_0x4c726d][_0x2017('0x179')]=utils[_0x2017('0x17a')](_0x1facde);_0x446ada[_0x2017('0x17b')]=_0x1c99aa[_0x2017('0x15b')];}_0x2a2eb4[_0x2017('0x17c')]=_0x446ada;return ami[_0x2017('0x9b')]({'actionid':_0x4c726d,'action':_0x2017('0x159'),'channel':_0x5ece62[_0x2017('0x85')](_0x2a2eb4[_0x2017('0x8c')])?util[_0x2017('0x7c')](_0x2017('0x17d'),_0x2a2eb4[_0x2017('0x8c')][_0x2017('0x5f')],isNotNull(_0x2a2eb4['dialPrefix'])?_0x2a2eb4[_0x2017('0x17e')]['trim']()||'':'',_0x2a2eb4[_0x2017('0x17f')]>0x0?_0x1c99aa[_0x2017('0x15b')][_0x2017('0x180')](_0x2a2eb4[_0x2017('0x17f')]):_0x1c99aa['phone']):util['format']('SIP/%s/%s%s',_[_0x2017('0xef')](_0x2a2eb4['TrunkBackup'])?_0x2a2eb4[_0x2017('0x8c')][_0x2017('0x5f')]:_0x2a2eb4[_0x2017('0x8d')][_0x2017('0x5f')],isNotNull(_0x2a2eb4[_0x2017('0x17e')])?_0x2a2eb4[_0x2017('0x17e')]['trim']()||'':'',_0x2a2eb4[_0x2017('0x17f')]>0x0?_0x1c99aa[_0x2017('0x15b')]['substring'](_0x2a2eb4[_0x2017('0x17f')]):_0x1c99aa[_0x2017('0x15b')]),'callerid':_0x1facde,'Exten':'xcally-motion-dialer','Context':_0x2017('0x181'),'Priority':'1','variable':_0x446ada,'timeout':(_0x2a2eb4[_0x2017('0x182')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4c726d})['then'](function(_0x2531f9){return _0x3e0431(_0x2531f9);})['catch'](function(_0x1878fc){_0x2a2eb4['outboundOriginateFailureCallsDay']+=0x1;var _0x2025a6=new History(_0x5ece62['actions'][_0x4c726d]);logger[_0x2017('0x64')](util['format']('[originateError]:\x20%s',JSON['stringify'](_0x1878fc)));_0x2025a6[_0x2017('0x6d')]=0xe;_0x2025a6[_0x2017('0x6e')]=_0x2017('0x183');_0x2025a6['starttime']=moment()['format'](_0x2017('0xc2'));_0x2025a6[_0x2017('0x6f')]=_0x2025a6['starttime'];hopperUtils[_0x2017('0xc7')](_0x2025a6)['catch'](loggerCatch(_0x2017('0x184')));_0x5ece62['moveContactManagedDialer'](_0x2025a6)[_0x2017('0xa2')](loggerCatch(_0x2017('0x184')))['finally'](function(){delete _0x5ece62[_0x2017('0x26')][_0x4c726d];return _0x39f1f7(msgResponse(_0x2017('0x159'),_0x2017('0x84'),_0x2017('0x185')));});});});};Dialer['prototype'][_0x2017('0x186')]=function(_0x47461d,_0x363307,_0xf8336a){var _0x31877a=new History(_0x363307);if(_0x31877a[_0x2017('0x11b')]+_0x31877a[_0x2017('0x128')]+_0x31877a[_0x2017('0x11c')]+_0x31877a[_0x2017('0x11d')]+_0x31877a[_0x2017('0xd3')]+_0x31877a['countabandonedretry']+_0x31877a[_0x2017('0x11e')]+_0x31877a[_0x2017('0x187')]>=_0xf8336a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x47461d){case 0x3:if(_0x31877a[_0x2017('0x11c')]>=_0xf8336a[_0x2017('0x188')]-0x1){return!![];}hopperUtils[_0x2017('0xd9')]({'active':![],'countnoanswerretry':_0x31877a[_0x2017('0x11c')]+=0x1,'scheduledat':moment()['add'](_0xf8336a[_0x2017('0x189')],_0x2017('0xda'))[_0x2017('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31877a[_0x2017('0xdb')],'ListId':_0x31877a[_0x2017('0xdc')],'VoiceQueueId':_0x31877a['VoiceQueueId']||undefined,'CampaignId':_0x31877a[_0x2017('0xe9')]||undefined})[_0x2017('0xa2')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x31877a[_0x2017('0x11b')]>=_0xf8336a[_0x2017('0x18a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x31877a[_0x2017('0x11b')]+=0x1,'scheduledat':moment()[_0x2017('0x18b')](_0xf8336a[_0x2017('0x18c')],_0x2017('0xda'))[_0x2017('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31877a['ContactId'],'ListId':_0x31877a[_0x2017('0xdc')],'VoiceQueueId':_0x31877a[_0x2017('0xdd')]||undefined,'CampaignId':_0x31877a['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x31877a[_0x2017('0x128')]>=_0xf8336a[_0x2017('0x18d')]-0x1){return!![];}hopperUtils[_0x2017('0xd9')]({'active':![],'countcongestionretry':_0x31877a[_0x2017('0x128')]+=0x1,'scheduledat':moment()[_0x2017('0x18b')](_0xf8336a[_0x2017('0x18e')],_0x2017('0xda'))[_0x2017('0x7c')](_0x2017('0xc2')),'ContactId':_0x31877a[_0x2017('0xdb')],'ListId':_0x31877a[_0x2017('0xdc')],'VoiceQueueId':_0x31877a['VoiceQueueId']||undefined,'CampaignId':_0x31877a['CampaignId']||undefined})[_0x2017('0xa2')](loggerCatch(_0x2017('0x18f')));break;case 0x0:if(_0x31877a[_0x2017('0x11d')]>=_0xf8336a[_0x2017('0x190')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x31877a[_0x2017('0x11d')]+=0x1,'scheduledat':moment()[_0x2017('0x18b')](_0xf8336a['dialNoSuchNumberRetryFrequency'],_0x2017('0xda'))[_0x2017('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31877a[_0x2017('0xdb')],'ListId':_0x31877a['ListId'],'VoiceQueueId':_0x31877a[_0x2017('0xdd')]||undefined,'CampaignId':_0x31877a[_0x2017('0xe9')]||undefined})[_0x2017('0xa2')](loggerCatch(_0x2017('0x191')));}break;case 0xa:if(_0x31877a['countdropretry']>=_0xf8336a[_0x2017('0x192')]-0x1){return!![];}hopperUtils[_0x2017('0xd9')]({'active':![],'countdropretry':_0x31877a['countdropretry']+=0x1,'scheduledat':moment()[_0x2017('0x18b')](_0xf8336a[_0x2017('0xd4')],_0x2017('0xda'))[_0x2017('0x7c')](_0x2017('0xc2')),'ContactId':_0x31877a['ContactId'],'ListId':_0x31877a[_0x2017('0xdc')],'VoiceQueueId':_0x31877a[_0x2017('0xdd')]||undefined,'CampaignId':_0x31877a[_0x2017('0xe9')]||undefined})[_0x2017('0xa2')](loggerCatch(_0x2017('0x193')));break;case 0xb:if(_0x31877a[_0x2017('0xe5')]>=_0xf8336a[_0x2017('0xe8')]-0x1){return!![];}hopperUtils[_0x2017('0xd9')]({'active':![],'countabandonedretry':_0x31877a[_0x2017('0xe5')]+=0x1,'scheduledat':moment()[_0x2017('0x18b')](_0xf8336a['dialAbandonedRetryFrequency'],_0x2017('0xda'))[_0x2017('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31877a[_0x2017('0xdb')],'ListId':_0x31877a[_0x2017('0xdc')],'VoiceQueueId':_0x31877a['VoiceQueueId']||undefined,'CampaignId':_0x31877a[_0x2017('0xe9')]||undefined})['catch'](loggerCatch(_0x2017('0xea')));break;case 0x13:if(_0x31877a[_0x2017('0x11e')]>=_0xf8336a['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x31877a['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0xf8336a[_0x2017('0x124')],_0x2017('0xda'))[_0x2017('0x7c')](_0x2017('0xc2')),'ContactId':_0x31877a['ContactId'],'ListId':_0x31877a['ListId'],'VoiceQueueId':_0x31877a['VoiceQueueId']||undefined,'CampaignId':_0x31877a['CampaignId']||undefined})['catch'](loggerCatch(_0x2017('0x194')));break;case 0x14:if(_0x31877a[_0x2017('0x187')]>=_0xf8336a[_0x2017('0x195')]-0x1){return!![];}hopperUtils[_0x2017('0xd9')]({'active':![],'countagentrejectretry':_0x31877a[_0x2017('0x187')]+=0x1,'scheduledat':moment()[_0x2017('0x18b')](_0xf8336a[_0x2017('0x196')],_0x2017('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31877a['ContactId'],'ListId':_0x31877a['ListId'],'VoiceQueueId':_0x31877a[_0x2017('0xdd')]||undefined,'CampaignId':_0x31877a[_0x2017('0xe9')]||undefined})[_0x2017('0xa2')](loggerCatch(_0x2017('0x197')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x3a2ba2,_0x2bd3ea,_0x5186c6){var _0x4e6b25=this;var _0x13203f=new History(_0x3a2ba2);var _0xd1211=![];var _0x336b9a;var _0x2dbfd1;return new Promise(function(_0x238519,_0x5b2573){if(_[_0x2017('0x41')](_0x2bd3ea)&&typeof _0x2bd3ea!==_0x2017('0x198')){return _0x5b2573(msgResponse(_0x2017('0x199'),_0x2017('0x93'),_0x2017('0x19a')));}if(_['isUndefined'](_0x5186c6)&&typeof _0x5186c6!==_0x2017('0x198')){return _0x5b2573(msgResponse('[callProgressDetecting]',_0x2017('0x93'),_0x2017('0x19b')));}hopperUtils[_0x2017('0xd6')](_0x13203f,_0x5186c6[_0x2017('0x19c')],_0x2bd3ea)[_0x2017('0xa3')](function(_0x354832){if(_0x354832[_0x2017('0xd8')]==0x1)_0xd1211=!![];switch(_0x5186c6[_0x2017('0x19c')]){case'0':_0x2bd3ea[_0x2017('0x19d')]+=0x1;_0x13203f[_0x2017('0x6d')]=0x0;_0x13203f[_0x2017('0x6e')]=_0x2017('0x19e');_0x13203f[_0x2017('0x11d')]+=0x1;_0x13203f[_0x2017('0xe6')]+=0x1;ami[_0x2017('0x112')](_0x2017('0x19f'),ut['buildObj'](_0x3a2ba2,'nosuchnumber'));_0x336b9a=_0x2bd3ea[_0x2017('0x1a0')];_0x2dbfd1=_0x2bd3ea[_0x2017('0xd5')];hopperUtils['createHistory'](_0x13203f)[_0x2017('0xa2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4e6b25[_0x2017('0x186')](0x0,_0x3a2ba2,_0x2bd3ea)&&!_0xd1211){if(_0x13203f[_0x2017('0x11d')]>=_0x2bd3ea[_0x2017('0x190')]){_0x4e6b25[_0x2017('0x122')](_0x13203f,_0x238519,_0x5b2573,'reason\x200\x20no\x20such\x20number....');}else{_0x4e6b25['stateGlobal'](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1a1'));}}break;case'3':_0x2bd3ea[_0x2017('0x1a2')]+=0x1;_0x13203f[_0x2017('0x6d')]=0x3;_0x13203f['statedesc']=_0x2017('0x1a3');_0x13203f[_0x2017('0x11c')]+=0x1;_0x13203f[_0x2017('0xe6')]+=0x1;var _0x553c24=ut[_0x2017('0x1a4')](_0x3a2ba2,_0x2bd3ea);ami[_0x2017('0x112')]('custom:agentnoanswer',_0x553c24);_0x336b9a=_0x2bd3ea[_0x2017('0x189')];_0x2dbfd1=_0x2bd3ea[_0x2017('0xd5')];hopperUtils['createHistory'](_0x13203f)[_0x2017('0xa2')](loggerCatch(_0x2017('0x1a5')));if(_0x4e6b25['checkRetriveMax'](0x3,_0x3a2ba2,_0x2bd3ea)&&!_0xd1211){if(_0x13203f[_0x2017('0x11c')]>=_0x2bd3ea[_0x2017('0x188')]){_0x4e6b25['createStateFinal'](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1a6'));}else{_0x4e6b25[_0x2017('0x120')](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1a6'));}}break;case'5':_0x2bd3ea[_0x2017('0x1a7')]+=0x1;_0x13203f[_0x2017('0x6d')]=0x5;_0x13203f[_0x2017('0x6e')]=_0x2017('0x1a8');_0x13203f[_0x2017('0x11b')]+=0x1;_0x13203f['countglobal']+=0x1;ami[_0x2017('0x112')](_0x2017('0x1a9'),ut[_0x2017('0x114')](_0x3a2ba2,'busy'));_0x336b9a=_0x2bd3ea[_0x2017('0x18c')];_0x2dbfd1=_0x2bd3ea[_0x2017('0xd5')];hopperUtils[_0x2017('0xc7')](_0x13203f)[_0x2017('0xa2')](loggerCatch(_0x2017('0x1aa')));if(_0x4e6b25['checkRetriveMax'](0x5,_0x3a2ba2,_0x2bd3ea)&&!_0xd1211){if(_0x13203f[_0x2017('0x11b')]>=_0x2bd3ea['dialBusyMaxRetry']){_0x4e6b25[_0x2017('0x122')](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1ab'));}else{_0x4e6b25[_0x2017('0x120')](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1ab'));}}break;case'8':_0x2bd3ea['outboundCongestionCallsDay']+=0x1;_0x13203f['state']=0x8;_0x13203f[_0x2017('0x6e')]='Congestion';_0x13203f[_0x2017('0x128')]+=0x1;_0x13203f[_0x2017('0xe6')]+=0x1;_0x336b9a=_0x2bd3ea[_0x2017('0x18e')];_0x2dbfd1=_0x2bd3ea['callAdditionalPhoneAfterMin'];ami['emit'](_0x2017('0x1ac'),ut[_0x2017('0x114')](_0x3a2ba2,_0x2017('0x1ad')));hopperUtils['createHistory'](_0x13203f)[_0x2017('0xa2')](loggerCatch(_0x2017('0x1ae')));if(_0x4e6b25[_0x2017('0x186')](0x8,_0x3a2ba2,_0x2bd3ea)&&!_0xd1211){if(_0x13203f['countcongestionretry']>=_0x2bd3ea['dialCongestionMaxRetry']){_0x4e6b25['createStateFinal'](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1af'));}else{_0x4e6b25['stateGlobal'](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1af'));}}break;case'11':_0x2bd3ea[_0x2017('0x1b0')]+=0x1;_0x13203f['state']=0xb;_0x13203f[_0x2017('0x6e')]=_0x2017('0xeb');_0x13203f['countabandonedretry']+=0x1;_0x13203f[_0x2017('0xe6')]+=0x1;_0x336b9a=_0x2bd3ea['dialAbandonedRetryFrequency'];_0x2dbfd1=_0x2bd3ea[_0x2017('0xd5')];hopperUtils[_0x2017('0xc7')](_0x13203f)[_0x2017('0xa2')](loggerCatch(_0x2017('0x1b1')));if(_0x4e6b25[_0x2017('0x186')](0xb,_0x3a2ba2,_0x2bd3ea)&&!_0xd1211){if(_0x13203f[_0x2017('0xe5')]>=_0x2bd3ea[_0x2017('0xe8')]){_0x4e6b25[_0x2017('0x122')](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1b2'));}else{_0x4e6b25[_0x2017('0x120')](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1b2'));}}break;case'20':_0x2bd3ea[_0x2017('0x1b3')]+=0x1;_0x13203f[_0x2017('0x6d')]=0x14;_0x13203f[_0x2017('0x6e')]='AgentReject';_0x13203f[_0x2017('0x187')]+=0x1;_0x13203f[_0x2017('0xe6')]+=0x1;_0x336b9a=_0x2bd3ea[_0x2017('0x196')];_0x2dbfd1=_0x2bd3ea['callAdditionalPhoneAfterMin'];ami['emit'](_0x2017('0x1b4'),ut[_0x2017('0x114')](_0x3a2ba2,_0x2017('0x1b5')));hopperUtils[_0x2017('0xc7')](_0x13203f)[_0x2017('0xa2')](loggerCatch(_0x2017('0x1b6')));if(_0x4e6b25['checkRetriveMax'](0x14,_0x3a2ba2,_0x2bd3ea)&&!_0xd1211){if(_0x13203f[_0x2017('0x187')]>=_0x2bd3ea[_0x2017('0x195')]){_0x4e6b25[_0x2017('0x122')](_0x13203f,_0x238519,_0x5b2573,'reason\x2020\x20agentreject');}else{_0x4e6b25[_0x2017('0x120')](_0x13203f,_0x238519,_0x5b2573,_0x2017('0x1b7'));}}break;default:_0x2bd3ea[_0x2017('0x12d')]+=0x1;_0x13203f['state']=0xc;_0x13203f[_0x2017('0x6e')]=_0x5186c6['reason'];_0x336b9a=_0x2bd3ea[_0x2017('0x196')];_0x2dbfd1=_0x2bd3ea[_0x2017('0xd5')];hopperUtils[_0x2017('0xc7')](_0x13203f)['catch'](loggerCatch(_0x2017('0x1b8')));if(_0x4e6b25['checkRetriveMax'](_0x5186c6[_0x2017('0x19c')],_0x3a2ba2,_0x2bd3ea)&&!_0xd1211){if(_0x13203f['countbusyretry']+_0x13203f[_0x2017('0x128')]+_0x13203f[_0x2017('0x11c')]+_0x13203f[_0x2017('0x11d')]+_0x13203f[_0x2017('0xd3')]+_0x13203f[_0x2017('0xe5')]+_0x13203f[_0x2017('0x11e')]+_0x13203f[_0x2017('0x187')]>=_0x2bd3ea[_0x2017('0x11f')]){_0x4e6b25['stateGlobal'](_0x13203f,_0x238519,_0x5b2573,_0x5186c6[_0x2017('0x19c')]);}else{_0x4e6b25[_0x2017('0x122')](_0x13203f,_0x238519,_0x5b2573,_0x5186c6['reason']);}}}})['then'](function(){if(_0xd1211){hopperUtils[_0x2017('0xe1')](_0x13203f,_0x336b9a,_0x2dbfd1)[_0x2017('0xa3')](function(){return _0x238519(0x1);});}});});};Dialer[_0x2017('0x1b')]['stateGlobal']=function(_0x3621dc,_0x39d265,_0x316af3,_0x493d36){var _0x18e622=new Final(_0x3621dc);_0x18e622[_0x2017('0x6d')]=0xf;_0x18e622[_0x2017('0x6e')]=_0x2017('0x1b9');this[_0x2017('0x122')](_0x18e622,_0x39d265,_0x316af3,_0x493d36);};Dialer[_0x2017('0x1b')][_0x2017('0x122')]=function(_0x2ffedc,_0x36462e,_0x9c459d,_0x2d111b){hopperUtils[_0x2017('0xc9')](_0x2ffedc)[_0x2017('0xa3')](function(){return _0x36462e(msgResponse(_0x2017('0x199'),_0x2017('0x105'),_0x2d111b));})['catch'](function(){return _0x9c459d(msgResponse(_0x2017('0x1ba'),_0x2017('0x93'),_0x2017('0x1bb')));});};Dialer[_0x2017('0x1b')][_0x2017('0xb')]=function(_0x2f5878){var _0x31d3a9=_0x2f5878[_0x2017('0x1bc')]/0x64;var _0x357c63=_0x2f5878[_0x2017('0xcf')]/(_0x2f5878[_0x2017('0xcf')]+_0x2f5878[_0x2017('0xc3')]);var _0x59564c=Math[_0x2017('0x1bd')](_0x2f5878[_0x2017('0x1be')]*(_0x2f5878['predictiveIntervalMaxThreshold']/0x64));var _0x20484e=Math[_0x2017('0x1bd')](_0x2f5878[_0x2017('0x1be')]*(_0x2f5878[_0x2017('0x1bf')]/0x64));var _0x26ebbe=_0x2f5878[_0x2017('0x133')]+_0x2f5878[_0x2017('0x135')];var _0x1fc52e=Math[_0x2017('0x1c0')](_0x2f5878[_0x2017('0x57')]*_0x2f5878[_0x2017('0x5b')]*_0x2f5878[_0x2017('0x1c1')]*_0x2f5878[_0x2017('0x1c2')]);if(_[_0x2017('0x41')](_0x2f5878[_0x2017('0x2a')])){if(!_[_0x2017('0x41')](_0x2f5878[_0x2017('0x29')])){_0x2f5878[_0x2017('0x29')]=undefined;loggerPredictive['error'](_0x2017('0x1c3'),_0x2017('0x1c4'));}if(!_[_0x2017('0x41')](_0x2f5878[_0x2017('0x62')])){loggerPredictive[_0x2017('0x64')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2f5878[_0x2017('0x62')]);_0x2f5878['handlePredictive']=undefined;}_0x2f5878['startProgressive']=moment()['format'](_0x2017('0xc2'));loggerPredictive[_0x2017('0x48')](_0x2f5878[_0x2017('0x5f')],_0x2017('0x1c5'),_0x2f5878['startProgressive']);this['handlePower'](_0x2f5878,0x1);}else if(ifInterval(_0x2f5878[_0x2017('0x1c6')],_0x2f5878[_0x2017('0x2a')])){this[_0x2017('0xb2')](_0x2f5878,0x1);loggerPredictiveCalls[_0x2017('0x48')]('[startMethodPredictive][StartProgressive][Loop]',_0x2f5878['startProgressive'],_0x2f5878[_0x2017('0x5f')]);_0x2f5878[_0x2017('0x57')]=0x0;_0x2f5878[_0x2017('0xd0')]=0x0;}else if(_0x31d3a9<_0x357c63&&_0x2f5878['dialPredictiveOptimization']===_0x2017('0x1c7')){clearPredictiveAttributes(_0x2f5878);loggerPredictive[_0x2017('0x48')](_0x2017('0x1c8'),_0x2017('0x1c9'),_0x357c63,_0x2017('0x2a'),_0x2f5878['name']);}else if(_0x1fc52e<_0x2f5878['predictiveIntervalErlangCallsDroppedCalls']&&_0x2f5878['dialPredictiveOptimization']===_0x2017('0x1c7')){clearPredictiveAttributes(_0x2f5878);loggerPredictive[_0x2017('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2017('0x1ca'),_0x1fc52e,'Drop\x20in\x20this\x20interval',_0x2f5878[_0x2017('0xd0')],_0x2017('0x2a'),_0x2f5878[_0x2017('0x5f')]);}else if(!ifInterval(_0x2f5878[_0x2017('0x1c6')],_0x2f5878[_0x2017('0x2a')])&&_[_0x2017('0x41')](_0x2f5878[_0x2017('0x29')])&&!_[_0x2017('0x41')](_0x2f5878[_0x2017('0x2a')])){_0x2f5878['startPredictive']=moment()[_0x2017('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2f5878[_0x2017('0x5f')],_0x2017('0x1cb'),_0x2f5878[_0x2017('0x29')]);hopperUtils[_0x2017('0x1cc')](_0x2f5878[_0x2017('0x1c6')])['then'](this[_0x2017('0x1cd')](_0x2f5878))[_0x2017('0xa3')](mergeDataErlangB(_0x2f5878))[_0x2017('0xa3')](this['startMethodPredictive'](_0x2f5878))['catch'](loggerCatchPredictive(_0x2017('0x1ce'),_0x2f5878));}else if(!ifInterval(_0x2f5878[_0x2017('0x1c6')],_0x2f5878[_0x2017('0x29')])){_0x2f5878['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2f5878[_0x2017('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2f5878[_0x2017('0x5f')],_0x2017('0x1cf'),_0x2f5878[_0x2017('0x29')]);clearInterval(_0x2f5878[_0x2017('0x62')]);_0x2f5878['handlePredictive']=undefined;hopperUtils[_0x2017('0x1cc')](_0x2f5878[_0x2017('0x1c6')])[_0x2017('0xa3')](this['getDataPredictive'](_0x2f5878))[_0x2017('0xa3')](mergeDataErlangB(_0x2f5878))[_0x2017('0xa3')](this[_0x2017('0x1d0')](_0x2f5878))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x2f5878));}else if(_0x2f5878[_0x2017('0x1be')]&&_0x26ebbe<_0x2f5878['predictiveIntervalAvailable']-_0x20484e){clearPredictiveAttributes(_0x2f5878);loggerPredictive[_0x2017('0x48')](_0x2f5878[_0x2017('0x5f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x26ebbe,_0x2017('0x1d1'),_0x2f5878['predictiveIntervalAvailable'],'-',_0x20484e,'=',_0x2f5878[_0x2017('0x1be')]-_0x20484e,')');}else if(_0x2f5878[_0x2017('0x1be')]&&_0x26ebbe>_0x2f5878[_0x2017('0x1be')]+_0x59564c){clearPredictiveAttributes(_0x2f5878);loggerPredictive[_0x2017('0x48')](_0x2f5878[_0x2017('0x5f')],_0x2017('0x1d2'),_0x26ebbe,_0x2017('0x1d3'),_0x2f5878[_0x2017('0x1be')],'+',_0x59564c,'=',_0x2f5878[_0x2017('0x1be')]+_0x59564c,')');}};Dialer[_0x2017('0x1b')][_0x2017('0x1cd')]=function(_0x2e11cc){var _0x5c7aaa=this;return function(_0x137bb4){return new Promise(function(_0x4d2b95,_0x4207ed){_[_0x2017('0x5e')](_0x2e11cc,_0x137bb4[0x0]);if(checkGetDataPredictive(_0x137bb4[0x0])){var _0x446427=_0x2e11cc[_0x2017('0x1be')]=_0x2e11cc[_0x2017('0x135')]+_0x2e11cc[_0x2017('0x133')];var _0x410e1a=_0x2e11cc[_0x2017('0x1c6')]*0x3c;var _0x22464e=_0x137bb4[0x0][_0x2017('0x51')]+_0x137bb4[0x0][_0x2017('0x4f')];var _0x52dab7=(_0x137bb4[0x0][_0x2017('0x4b')]+_0x137bb4[0x0][_0x2017('0x4d')]+_0x137bb4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x137bb4[0x0][_0x2017('0x1d4')];_0x2e11cc[_0x2017('0x1c1')]=_0x52dab7>0x0?_0x52dab7:0x1;switch(_0x2e11cc[_0x2017('0x1d5')]){case _0x2017('0x1c7'):var _0x578def=_0x2e11cc[_0x2017('0x1bc')]/0x64;return _0x5c7aaa[_0x2017('0x1d6')](_0x446427,_0x410e1a,_0x22464e,_0x52dab7,_0x578def)[_0x2017('0xa3')](function(_0x4a6832){return _0x4d2b95(_0x4a6832);});case _0x2017('0x1d7'):var _0x45cf53=_0x2e11cc['dialPredictiveOptimizationPercentage']/0x64;return _0x5c7aaa['busyFactor'](_0x446427,_0x410e1a,_0x22464e,_0x52dab7,_0x45cf53)[_0x2017('0xa3')](function(_0x2576e0){return _0x4d2b95(_0x2576e0);});default:return _0x4207ed(msgResponse(_0x2017('0x1d8'),_0x2017('0x93'),_0x2017('0x1d9')));}}else{return _0x4207ed(msgResponse(_0x2017('0x1d8'),'Failure',_0x2017('0x1da')));}});};};Dialer[_0x2017('0x1b')]['getDataPredictiveOld']=function(_0x13d472){var _0x11e0c0=this;return function(_0x520888){return new Promise(function(_0x3b5274,_0x5b87ed){_[_0x2017('0x5e')](_0x13d472,_0x520888[0x0]);if(checkGetDataPredictive(_0x520888[0x0])){loggerPredictive[_0x2017('0x48')](JSON[_0x2017('0x72')](_0x520888[0x0]));if(_0x13d472['dialPredictiveOptimization']===_0x2017('0x1c7')){return _0x11e0c0[_0x2017('0x14a')](_0x13d472['id'])[_0x2017('0xa3')](function(_0x7fd125){var _0x24b21e=_0x13d472[_0x2017('0x1db')]-_0x7fd125[0x0][_0x2017('0x1dc')];var _0x1f9948=_0x13d472['dialPredictiveInterval']*0x3c;var _0x433cb8=_0x520888[0x0][_0x2017('0x51')]+_0x520888[0x0]['predictiveIntervalAvgHoldtime'];var _0x2dc29b=(_0x520888[0x0]['predictiveIntervalAnsweredCalls']+_0x520888[0x0][_0x2017('0x4d')]+_0x520888[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x520888[0x0][_0x2017('0x1d4')];var _0x2ebc64=_0x13d472['dialPredictiveOptimizationPercentage']/0x64;_0x13d472[_0x2017('0x1dd')]=_0x7fd125[0x0][_0x2017('0x1dc')]||0x0;_0x13d472[_0x2017('0x1c1')]=_0x2dc29b>0x0?_0x2dc29b:0x1;return _0x11e0c0[_0x2017('0x1d6')](_0x24b21e,_0x1f9948,_0x433cb8,_0x2dc29b,_0x2ebc64);})['then'](function(_0x1715cc){return _0x3b5274(_0x1715cc);})[_0x2017('0xa2')](function(_0x585445){return _0x5b87ed(msgResponse('[CatchErlangB]',_0x2017('0x93'),JSON[_0x2017('0x72')](_0x585445)));});}if(_0x13d472[_0x2017('0x1d5')]===_0x2017('0x1d7')){return _0x11e0c0[_0x2017('0x14a')](_0x13d472['id'])[_0x2017('0xa3')](function(_0x2cc8db){var _0x1f459c=_0x13d472['loggedIn']-_0x2cc8db[0x0]['outboundQueuePauses'];var _0x3931c0=_0x13d472[_0x2017('0x1c6')]*0x3c;var _0x4caee2=_0x520888[0x0]['predictiveIntervalAvgTalktime']+_0x520888[0x0][_0x2017('0x4f')];var _0x2528b2=(_0x520888[0x0][_0x2017('0x4b')]+_0x520888[0x0][_0x2017('0x4d')]+_0x520888[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x520888[0x0][_0x2017('0x1d4')];var _0x5a1170=_0x13d472['dialPredictiveOptimizationPercentage']/0x64;_0x13d472['predictiveIntervalPauses']=_0x2cc8db[0x0][_0x2017('0x1dc')]||0x0;_0x13d472[_0x2017('0x1c1')]=_0x2528b2>0x0?_0x2528b2:0x1;return _0x11e0c0['busyFactor'](_0x1f459c,_0x3931c0,_0x4caee2,_0x2528b2,_0x5a1170);})[_0x2017('0xa3')](function(_0x595b66){return _0x3b5274(_0x595b66);})[_0x2017('0xa2')](function(_0x2d4acd){return _0x5b87ed(msgResponse('[CatchErlangB]',_0x2017('0x93'),JSON[_0x2017('0x72')](_0x2d4acd)));});}}else{return _0x5b87ed(msgResponse(_0x2017('0x1d8'),_0x2017('0x93'),_0x2017('0x1da')));}});};};Dialer['prototype'][_0x2017('0x1d0')]=function(_0x554a74){var _0xe7bb9b=this;return function(){var _0x4899af=0x0;var _0x2d5e1c=Math[_0x2017('0x1c0')](_0x554a74[_0x2017('0x59')]*0x3e8);if(_0x2d5e1c>0x0){_0x2d5e1c=_0x2d5e1c<0x64?0x64:_0x2d5e1c;loggerPredictive[_0x2017('0x48')](_0x554a74[_0x2017('0x5f')],'one\x20call\x20every:',_0x2d5e1c,_0x2017('0x1de'));_0x554a74[_0x2017('0x62')]=setInterval(function(){_0xe7bb9b[_0x2017('0x62')](_0x554a74);loggerPredictiveCalls['info'](_0x2017('0x1df'),_0x4899af+=0x1);},_0x2d5e1c);}else{loggerPredictive['info'](_0x554a74[_0x2017('0x5f')],_0x2017('0x1e0'));}};};Dialer['prototype'][_0x2017('0x1e1')]=function(_0x4116b3,_0x11ef7c){var _0x31bc18=this;return function(_0x3d1ba9){if(_[_0x2017('0x47')](_0x3d1ba9)){if(_[_0x2017('0xef')](_0x11ef7c[_0x2017('0x151')])||!_0x11ef7c[_0x2017('0x1e2')]){if(_0x4116b3[_0x2017('0xaf')]===_0x2017('0xa')){_0x4116b3['queueStatusComplete']=_[_0x2017('0x41')](_0x4116b3[_0x2017('0x70')])?!![]:_0x4116b3[_0x2017('0x70')];var _0x1e5b1a=uuid['v4']();_0x31bc18[_0x2017('0x26')][_0x1e5b1a]=new Action(_0x4116b3,_0x11ef7c,_0x1e5b1a);loggerBooked[_0x2017('0x48')](_0x2017('0x1e3'),_0x1e5b1a,_0x2017('0x1e4'),JSON[_0x2017('0x72')](_0x4116b3['queueStatusComplete']),_0x2017('0x1e5'),_0x4116b3[_0x2017('0x5f')]);if(_0x4116b3[_0x2017('0x70')]){_0x4116b3[_0x2017('0x70')]=![];_0x31bc18[_0x2017('0x2c')][_0x31bc18['actions'][_0x1e5b1a][_0x2017('0xbd')]]=[];ami[_0x2017('0x9b')]({'actionid':_0x1e5b1a,'action':_0x2017('0x1e6'),'queue':_0x4116b3[_0x2017('0x5f')]})['catch'](function(){_0x31bc18[_0x2017('0xc1')](_0x4116b3);hopperUtils[_0x2017('0xd9')]({'active':![],'ContactId':_0x31bc18[_0x2017('0x26')][_0x1e5b1a][_0x2017('0xdb')],'ListId':_0x31bc18['actions'][_0x1e5b1a][_0x2017('0xdc')],'VoiceQueueId':_0x31bc18['actions'][_0x1e5b1a][_0x2017('0xdd')]||undefined,'CampaignId':_0x31bc18[_0x2017('0x26')][_0x1e5b1a][_0x2017('0xe9')]||undefined})['catch'](loggerCatch(_0x2017('0x1e7')));delete _0x31bc18[_0x2017('0x26')][_0x1e5b1a];});}else{loggerBooked[_0x2017('0x48')](_0x2017('0x1e8'),JSON[_0x2017('0x72')](_0x4116b3['queueStatusComplete']),_0x2017('0x1e5'),_0x4116b3['name']);_0x31bc18[_0x2017('0xc1')](_0x4116b3);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x31bc18['actions'][_0x1e5b1a][_0x2017('0xdb')],'ListId':_0x31bc18[_0x2017('0x26')][_0x1e5b1a][_0x2017('0xdc')],'VoiceQueueId':_0x31bc18['actions'][_0x1e5b1a][_0x2017('0xdd')]||undefined,'CampaignId':_0x31bc18[_0x2017('0x26')][_0x1e5b1a]['CampaignId']||undefined})[_0x2017('0xa2')](loggerCatch(_0x2017('0x1e7')));delete _0x31bc18[_0x2017('0x26')][_0x1e5b1a];}}else{return _0x31bc18['actionOriginate'](_0x4116b3,_0x11ef7c);}}else{if(utils['getSeconds'](undefined,_0x11ef7c[_0x2017('0x1e9')])<_0x4116b3['dialRecallMeTimeout']*0x3c){if(_0x11ef7c['Agent']&&!_0x11ef7c[_0x2017('0x143')][_0x2017('0x1ea')]){_0x31bc18[_0x2017('0x1f')][_0x2017('0xf5')](_0x11ef7c['id'])[_0x2017('0x1d')](function(){_0x31bc18['updateOriginated'](_0x4116b3);});}else{hopperUtils[_0x2017('0x1eb')]({'active':![]},_0x11ef7c['id'],0x1)[_0x2017('0x1d')](function(){_0x31bc18[_0x2017('0xc1')](_0x4116b3);});}}else{_0x4116b3[_0x2017('0x1ec')]+=0x1;_0x31bc18[_0x2017('0xc1')](_0x4116b3);if(_0x4116b3[_0x2017('0x1ed')]){hopperUtils[_0x2017('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x11ef7c['ContactId'],'ListId':_0x11ef7c[_0x2017('0xdc')],'VoiceQueueId':_0x11ef7c[_0x2017('0xdd')]||undefined,'CampaignId':_0x11ef7c[_0x2017('0xe9')]||undefined})[_0x2017('0xa2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x2017('0xc7')](createObjHistory(_0x4116b3,_0x11ef7c,utils[_0x2017('0x66')][_0x2017('0x1ee')],0x17,_0x2017('0x1ef')))[_0x2017('0xa2')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x31bc18[_0x2017('0x116')](createObjHistory(_0x4116b3,_0x11ef7c,utils[_0x2017('0x66')][_0x2017('0x1f0')],0x16,_0x2017('0x1f1')),'[Originate][HistoryRecallClose][historyCatch]',_0x2017('0x1f2'));}}}}else{_0x4116b3['outboundBlacklistCallsDay']+=0x1;_0x31bc18['saveInDb'](createObjHistory(_0x4116b3,_0x11ef7c,utils[_0x2017('0x66')]['BLACKLIST'],0xd,_0x2017('0x1f3')),'[Originate][historyBlacklist]',_0x2017('0x1f4'));throw'inBlackList';}};};Dialer[_0x2017('0x1b')][_0x2017('0x157')]=function(_0xbd8b4b){var _0x187354=this;var _0x2b9c98=_0xbd8b4b[_0x2017('0x1f5')]-_0xbd8b4b[_0x2017('0x80')];emitCampaignSummary(_0xbd8b4b);if(_0x2b9c98>0x0&&_0xbd8b4b[_0x2017('0x1f6')]==0x0){if(_0x2b9c98>this['maxNumberOriginate']){_0x2b9c98=this['maxNumberOriginate'];}_0xbd8b4b[_0x2017('0x1f6')]=0x1;hopperUtils[_0x2017('0x1f7')](_0xbd8b4b,_0x2b9c98)[_0x2017('0xa3')](function(_0x445ee1){_0xbd8b4b['temp']=0x0;if(_0x445ee1){if(!utils[_0x2017('0x1f8')](_0x445ee1)){_0xbd8b4b[_0x2017('0x6c')]=utils[_0x2017('0x66')][_0x2017('0x6a')];logger[_0x2017('0x48')](_0x2017('0x1f9')+_0xbd8b4b['name']);}else{_0xbd8b4b['originated']+=_0x445ee1['length'];_0xbd8b4b[_0x2017('0x6c')]=utils[_0x2017('0x66')][_0x2017('0x1fa')];for(var _0x173f68=0x0;_0x173f68<_0x445ee1['length'];_0x173f68+=0x1){_0xbd8b4b[_0x2017('0x1fb')]+=0x1;if(_[_0x2017('0xef')](_0x445ee1[_0x173f68])||_[_0x2017('0xef')](_0x445ee1[_0x173f68][_0x2017('0x1fc')])||_[_0x2017('0xef')](_0x445ee1[_0x173f68][_0x2017('0x15b')])){_0x187354[_0x2017('0x14f')]('[actionOriginate]\x20',_0xbd8b4b,_0x445ee1[_0x173f68]);}else{hopperUtils[_0x2017('0x1fd')](_[_0x2017('0x73')](_0x445ee1[_0x173f68],[_0x2017('0xe9'),_0x2017('0x15b')]))[_0x2017('0xa3')](_0x187354[_0x2017('0x1e1')](_0xbd8b4b,_0x445ee1[_0x173f68]))[_0x2017('0xa2')](_0x187354[_0x2017('0x14e')](_0x2017('0x1fe'),_0xbd8b4b));}}}}})[_0x2017('0xa2')](loggerGetContactDialer('[getContactCampaign2]',_0xbd8b4b,_0x2b9c98));}};Dialer[_0x2017('0x1b')]['handlePower']=function(_0x33b2c5,_0xc76849){var _0x5f499a=this;var _0x245b4e=[];if(_0xc76849<0x1||_0x33b2c5[_0x2017('0xaf')]===_0x2017('0xa')){_0xc76849=0x1;}var _0x1a25c2=Math['floor'](_0x33b2c5[_0x2017('0x133')]*_0xc76849)-_0x33b2c5['originated'];if(_0x33b2c5['dialLimitQueue']>0x0){var _0x196ff7=_0x33b2c5['dialLimitQueue']-_0x33b2c5[_0x2017('0x80')]-_0x33b2c5['talking']-_0x33b2c5['pTalking'];if(_0x1a25c2>_0x196ff7){_0x1a25c2=_0x196ff7;}}if(_0x1a25c2>0x0&&_0x33b2c5[_0x2017('0x1f6')]==0x0){if(_0x33b2c5['dialMethod']===_0x2017('0xa')){_0x1a25c2=0x1;}if(_0x1a25c2>this['maxNumberOriginate']){_0x1a25c2=this[_0x2017('0x24')];}for(var _0xde6609 in this[_0x2017('0x22')]){if(typeof this['agents'][_0xde6609]!=='undefined'){if(this[_0x2017('0x22')][_0xde6609][_0x2017('0x6d')]===_0x2017('0x1ff')&&this[_0x2017('0x22')][_0xde6609][_0x2017('0x88')]===_0x2017('0x89')){_0x245b4e[_0x2017('0x200')](this[_0x2017('0x22')][_0xde6609]['id']);}}}_0x33b2c5[_0x2017('0x1f6')]=0x1;hopperUtils['getContactDialer'](_0x33b2c5,_0x245b4e,_0x1a25c2)[_0x2017('0xa3')](function(_0x5c2e08){_0x33b2c5['temp']=0x0;if(_0x5c2e08){if(!utils[_0x2017('0x1f8')](_0x5c2e08)){hopperUtils[_0x2017('0x201')](_0x33b2c5)['then'](sendMessageReschedule(_0x33b2c5))[_0x2017('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x33b2c5['originated']+=_0x5c2e08[_0x2017('0xf8')];_0x33b2c5['message']=_0x33b2c5[_0x2017('0xaf')]===_0x2017('0xa')?utils[_0x2017('0x66')]['ACTIVE']:utils[_0x2017('0x66')][_0x2017('0x1fa')];for(var _0x7d1cfc=0x0;_0x7d1cfc<_0x5c2e08[_0x2017('0xf8')];_0x7d1cfc+=0x1){if(_[_0x2017('0xef')](_0x5c2e08[_0x7d1cfc])||_[_0x2017('0xef')](_0x5c2e08[_0x7d1cfc]['Contact'])||_[_0x2017('0xef')](_0x5c2e08[_0x7d1cfc][_0x2017('0x15b')])){_0x5f499a['emptyContact'](_0x2017('0x202'),_0x33b2c5,_0x5c2e08[_0x7d1cfc]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x5c2e08[_0x7d1cfc],[_0x2017('0xdd'),'phone']))[_0x2017('0xa3')](_0x5f499a[_0x2017('0x1e1')](_0x33b2c5,_0x5c2e08[_0x7d1cfc]))['catch'](_0x5f499a['loggerHandler']('[actionOriginate]\x20',_0x33b2c5));}}}}})[_0x2017('0xa2')](loggerGetContactDialer(_0x2017('0x203'),_0x33b2c5,_0x1a25c2));}};Dialer[_0x2017('0x1b')]['handlePredictive']=function(_0xa0cbaa){if(_0xa0cbaa[_0x2017('0x204')]>0x0){var _0x1afe5d=_0xa0cbaa[_0x2017('0x204')]-_0xa0cbaa['originated']-_0xa0cbaa[_0x2017('0x135')];if(_0x1afe5d>0x0&&_0xa0cbaa[_0x2017('0x1f6')]==0x0){this[_0x2017('0x205')](_0xa0cbaa);}else{loggerPredictiveCalls[_0x2017('0x48')](_0x2017('0x206'));}}else{this[_0x2017('0x205')](_0xa0cbaa);}};Dialer[_0x2017('0x1b')]['tryOriginatePredictive']=function(_0x370d60){var _0x264f95=this;var _0x1a9c58=[];_0x370d60['originated']+=0x1;for(var _0x345f8b in this[_0x2017('0x22')]){if(typeof this[_0x2017('0x22')][_0x345f8b]!==_0x2017('0xa8')){if(this['agents'][_0x345f8b]['state']==='not_inuse'&&this[_0x2017('0x22')][_0x345f8b][_0x2017('0x88')]===_0x2017('0x89')){_0x1a9c58[_0x2017('0x200')](this['agents'][_0x345f8b]['id']);}}}_0x370d60[_0x2017('0x1f6')]=0x1;return this[_0x2017('0x207')](_0x370d60['id'],_0x1a9c58,0x1,_0x370d60[_0x2017('0x208')],_0x370d60)[_0x2017('0xa3')](function(_0x357f9f){_0x370d60[_0x2017('0x1f6')]=0x1;if(_0x357f9f){if(!utils['checkContactEmpty'](_0x357f9f)){utils[_0x2017('0x209')](_0x370d60,0x1,0x0);return hopperUtils[_0x2017('0x201')](_0x370d60)[_0x2017('0xa3')](sendMessageReschedule(_0x370d60))[_0x2017('0xa2')](loggerCatch(_0x2017('0x20a')));}else{_0x370d60['message']=utils[_0x2017('0x66')][_0x2017('0x1fa')];if(_['isNil'](_0x357f9f[0x0])||_[_0x2017('0xef')](_0x357f9f[0x0][_0x2017('0x1fc')])||_[_0x2017('0xef')](_0x357f9f[0x0][_0x2017('0x15b')])){_0x264f95['emptyContact']('[actionOriginate]\x20',_0x370d60,_0x357f9f[0x0]);}else{return hopperUtils[_0x2017('0x20b')](_[_0x2017('0x73')](_0x357f9f[0x0],[_0x2017('0xdd'),'phone']))[_0x2017('0xa3')](_0x264f95[_0x2017('0x1e1')](_0x370d60,_0x357f9f[0x0]))['catch'](_0x264f95['loggerHandler'](_0x2017('0x20c'),_0x370d60));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x370d60,0x1));};Dialer[_0x2017('0x1b')][_0x2017('0x1d6')]=function(_0x1ce87b,_0x35b69e,_0x192321,_0x50d357,_0x4b1554,_0x3a5ae8){loggerPredictive[_0x2017('0x48')](_0x2017('0x20d'));loggerPredictive[_0x2017('0x48')](_0x2017('0x20e'),_0x1ce87b);loggerPredictive[_0x2017('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35b69e);loggerPredictive[_0x2017('0x48')](_0x2017('0x20f'),_0x192321);loggerPredictive[_0x2017('0x48')](_0x2017('0x210'),_0x50d357);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',_0x4b1554);loggerPredictive['info'](_0x2017('0x52'));return new Promise(function(_0x1701f3,_0xeff5d8){if(_0x1ce87b<=0x0||isNaN(_0x1ce87b)){return _0xeff5d8(msgResponse(_0x2017('0x211'),'Error',_0x2017('0x212')+_0x1ce87b));}if(_0x192321<=0x0||isNaN(_0x192321)){return _0xeff5d8(msgResponse(_0x2017('0x211'),_0x2017('0x84'),_0x2017('0x213')+_0x192321));}if(_0x50d357<=0x0||isNaN(_0x50d357)){return _0xeff5d8(msgResponse('[abandonmentRate]',_0x2017('0x84'),_0x2017('0x214')+_0x50d357));}if(_0x35b69e<=0x0||isNaN(_0x35b69e)){return _0xeff5d8(msgResponse(_0x2017('0x211'),_0x2017('0x84'),_0x2017('0x215')+_0x35b69e));}if(_0x4b1554<=0x0||isNaN(_0x4b1554)){return _0xeff5d8(msgResponse(_0x2017('0x211'),'Error','Amax\x20=\x20'+_0x4b1554));}_0x3a5ae8=_0x3a5ae8||0x0;var _0x1f0e2a=0x1/_0x192321;var _0x13608e=0x0;var _0x401e7f=0x0;var _0x26c1fe=0x0;var _0x357fe1=0x0;for(var _0x3b4c1d=0x0;_0x26c1fe<_0x4b1554;_0x3b4c1d+=0x1){_0x401e7f=_0x3b4c1d/_0x35b69e;_0x13608e=(_0x50d357*_0x401e7f+_0x3a5ae8)/_0x1f0e2a;_0x26c1fe=utils[_0x2017('0x216')](_0x13608e,_0x1ce87b);_0x357fe1=_0x13608e/_0x1ce87b*(0x1-utils['erlangb'](_0x13608e,_0x1ce87b));}return _0x1701f3({'erlangCalls':_0x3b4c1d,'erlangCallToSecond':_0x35b69e/_0x3b4c1d,'erlangAbandonmentRate':_0x26c1fe,'erlangBusyFactor':_0x357fe1});});};Dialer[_0x2017('0x1b')][_0x2017('0x217')]=function(_0x202bfa,_0x7e334c,_0x42a423,_0x10002b,_0xcd2825,_0x47edb5){loggerPredictive[_0x2017('0x48')](_0x2017('0x218'));loggerPredictive[_0x2017('0x48')]('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',_0x202bfa);loggerPredictive[_0x2017('0x48')](_0x2017('0x219'),_0x7e334c);loggerPredictive[_0x2017('0x48')](_0x2017('0x20f'),_0x42a423);loggerPredictive[_0x2017('0x48')]('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',_0x10002b);loggerPredictive[_0x2017('0x48')](_0x2017('0x21a'),_0xcd2825);loggerPredictive[_0x2017('0x48')]('---------------------------');return new Promise(function(_0x2cc070,_0x47be48){if(_0x202bfa<=0x0||isNaN(_0x202bfa)){return _0x47be48(msgResponse(_0x2017('0x21b'),_0x2017('0x84'),_0x2017('0x212')+_0x202bfa));}if(_0x42a423<=0x0||isNaN(_0x42a423)){return _0x47be48(msgResponse(_0x2017('0x21b'),_0x2017('0x84'),_0x2017('0x213')+_0x42a423));}if(_0x10002b<=0x0||isNaN(_0x10002b)){return _0x47be48(msgResponse('[busyFactor]',_0x2017('0x84'),'p\x20=\x20'+_0x10002b));}if(_0x7e334c<=0x0||isNaN(_0x7e334c)){return _0x47be48(msgResponse(_0x2017('0x21b'),'Error','interval\x20=\x20'+_0x7e334c));}if(_0xcd2825<=0x0||isNaN(_0xcd2825)){return _0x47be48(msgResponse('[busyFactor]',_0x2017('0x84'),'Umin\x20=\x20'+_0xcd2825));}_0x47edb5=_0x47edb5||0x0;var _0x2e66b3=0x1/_0x42a423;var _0x1d3149=0x0;var _0x3bf417=0x0;var _0x53b5ba=0x0;var _0x326c22=0x0;for(var _0x1166b2=0x0;_0x326c22<_0xcd2825;_0x1166b2+=0x1){_0x3bf417=_0x1166b2/_0x7e334c;_0x1d3149=(_0x10002b*_0x3bf417+_0x47edb5)/_0x2e66b3;_0x53b5ba=utils[_0x2017('0x216')](_0x1d3149,_0x202bfa);_0x326c22=_0x1d3149/_0x202bfa*(0x1-utils[_0x2017('0x216')](_0x1d3149,_0x202bfa));}return _0x2cc070({'erlangCalls':_0x1166b2,'erlangCallToSecond':_0x7e334c/_0x1166b2,'erlangAbandonmentRate':_0x53b5ba,'erlangBusyFactor':_0x326c22});});};module[_0x2017('0x21c')]=Dialer; \ No newline at end of file +var _0xbc2b=['stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','moveContactManagedDialer','Unknow','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','assign','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','reachable','resolve','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','Agent','handleIvr','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','[originateError]:\x20%s','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','outboundUnknownCallsDay','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','scheduledat','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','loggerHandler','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','RUNNING','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','countReScheduled','[countReScheduled]\x20','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','agentcomplete','custom:queuesummary','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','interval','timezones','content','indexOf','true','command','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','isIVRCampaignActive','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','OVERTIME_GLOBAL_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','additional','CampaignId','[rescheduleContact][Abandoned]','Abandoned','endtime','calleridname','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','isNil','locked','paused','stateinterface','rrmemory','idHopper','roundrobin','run','[unlock][syncQueueStatusComplete]','_rr','[booked][RR]','Agent:\x20','unlockRR','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','custom:amd','buildObj','saveInDb','[syncHangupInAMD]','MACHINE','Machine','AMD','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xbc2b,0xfa));var _0xbbc2=function(_0x192caf,_0x363f32){_0x192caf=_0x192caf-0x0;var _0x58fb05=_0xbc2b[_0x192caf];return _0x58fb05;};'use strict';var util=require(_0xbbc2('0x0'));var _=require(_0xbbc2('0x1'));var uuid=require(_0xbbc2('0x2'));var moment=require(_0xbbc2('0x3'));var rr=require('rr');var Redis=require(_0xbbc2('0x4'));var utils=require(_0xbbc2('0x5'));var hopperUtils=require(_0xbbc2('0x6'));var ut=require(_0xbbc2('0x7'));var config=require(_0xbbc2('0x8'));var logger=require(_0xbbc2('0x9'))(_0xbbc2('0xa'));var loggerBooked=require('../../../config/logger')(_0xbbc2('0xb'));var loggerPredictive=require('../../../config/logger')(_0xbbc2('0xc'));var loggerPredictiveCalls=require(_0xbbc2('0x9'))(_0xbbc2('0xd'));var loggerSyncQueueSummary=require(_0xbbc2('0x9'))(_0xbbc2('0xe'));var ami=require(_0xbbc2('0xf'));config[_0xbbc2('0x10')]=_[_0xbbc2('0x11')](config[_0xbbc2('0x10')],{'host':_0xbbc2('0x12'),'port':0x18eb});var io=require(_0xbbc2('0x13'))(new Redis(config[_0xbbc2('0x10')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0xbbc2('0x14'));var Action=require(_0xbbc2('0x15'));var History=require('./models/history');var Final=require(_0xbbc2('0x16'));var AgentComplete=require(_0xbbc2('0x17'));var QueueCallerAbandon=require(_0xbbc2('0x18'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0xbbc2('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xbbc2('0x1a')][_0xbbc2('0x1b')]=function(_0x1bf6ba){this[_0xbbc2('0x1c')]=this[_0xbbc2('0x1c')]?this[_0xbbc2('0x1c')][_0xbbc2('0x1d')](_0x1bf6ba):_0x1bf6ba();};function Dialer(_0x5cfa10,_0x1ef84a){this[_0xbbc2('0x1e')]=new Sequence();this[_0xbbc2('0x1f')]=_0x1ef84a;this[_0xbbc2('0x20')]=_0x5cfa10[_0xbbc2('0x20')];this[_0xbbc2('0x21')]=_0x5cfa10['campaigns'];this[_0xbbc2('0x22')]=_0x5cfa10[_0xbbc2('0x22')];this[_0xbbc2('0x23')]=_0x5cfa10[_0xbbc2('0x23')];this[_0xbbc2('0x24')]=config[_0xbbc2('0x24')]||0x2;this[_0xbbc2('0x25')]={};this[_0xbbc2('0x26')]={};this[_0xbbc2('0x27')]={};this[_0xbbc2('0x28')]={};this[_0xbbc2('0x29')]={};this[_0xbbc2('0x2a')]={};this[_0xbbc2('0x2b')]={};this[_0xbbc2('0x2c')]={};this[_0xbbc2('0x2d')]={};this[_0xbbc2('0x2e')]={};this[_0xbbc2('0x2f')]={};ami['on'](_0xbbc2('0x30'),this[_0xbbc2('0x31')][_0xbbc2('0x32')](this));ami['on']('queuecallerabandon',this[_0xbbc2('0x33')]['bind'](this));ami['on'](_0xbbc2('0x34'),this['syncOriginateResponse'][_0xbbc2('0x32')](this));ami['on'](_0xbbc2('0x35'),this['syncAgentComplete'][_0xbbc2('0x32')](this));ami['on'](_0xbbc2('0x36'),this['syncQueueSummary']['bind'](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0xbbc2('0x32')](this));ami['on']('hangup',this[_0xbbc2('0x37')][_0xbbc2('0x32')](this));ami['on']('newexten',this[_0xbbc2('0x38')][_0xbbc2('0x32')](this));ami['on'](_0xbbc2('0x39'),this[_0xbbc2('0x3a')]['bind'](this));ami['on']('queuemember',this[_0xbbc2('0x3b')][_0xbbc2('0x32')](this));ami['on']('queuestatuscomplete',this[_0xbbc2('0x3c')]['bind'](this));this[_0xbbc2('0x3d')]();this[_0xbbc2('0x3e')]();RpcSetting[_0xbbc2('0x3f')]()[_0xbbc2('0x40')](function(_0x415a68){previewRecallmeReminderInterval=_0x415a68[_0xbbc2('0x41')];});}function isNotNull(_0x116997){return _0x116997!==null&&!_['isUndefined'](_0x116997);}function msgResponse(_0x39f9ea,_0x437ee7,_0x1e0797){return{'action':_0x39f9ea,'response':_0x437ee7,'message':_0x1e0797,'stack':_0x1e0797};}function emit(_0x117cbb,_0x46cbe2,_0x25a2dc){io['to'](_0x117cbb)[_0xbbc2('0x42')](_0x46cbe2,_0x25a2dc);}function emitOutboundVoiceQueueSummary(_0x2bd13f){if(_0x2bd13f[_0xbbc2('0x43')]===_0xbbc2('0x44')){logger[_0xbbc2('0x45')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xbbc2('0x46')](_0x2bd13f,{'showHidden':![],'depth':null}));emit(util[_0xbbc2('0x47')](_0xbbc2('0x48'),_0x2bd13f[_0xbbc2('0x49')]),'voice_queue:save',_0x2bd13f);}}function checkGetDataPredictive(_0x3ebc56){if(isNotNull(_0x3ebc56)&&!_[_0xbbc2('0x4a')](_0x3ebc56)){loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x4c'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ebc56[_0xbbc2('0x4d')]);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x4e'),_0x3ebc56['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0xbbc2('0x4f'),_0x3ebc56[_0xbbc2('0x50')]);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x51'),_0x3ebc56[_0xbbc2('0x52')]);loggerPredictive[_0xbbc2('0x4b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ebc56[_0xbbc2('0x53')]);loggerPredictive[_0xbbc2('0x4b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ebc56[_0xbbc2('0x54')]);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x55'));if(_0x3ebc56[_0xbbc2('0x4d')]>0x0){if(!_[_0xbbc2('0x56')](_0x3ebc56[_0xbbc2('0x54')])&&_0x3ebc56[_0xbbc2('0x54')]>0x0){return!![];}loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x57'));if(!_['isUndefined'](_0x3ebc56['predictiveIntervalAvgHoldtime'])&&_0x3ebc56['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x58'));}else{loggerPredictive['info'](_0xbbc2('0x59'));}}else{loggerPredictive[_0xbbc2('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x37e74c){return function(_0x2f01cd){loggerPredictive[_0xbbc2('0x4b')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x5a'),_0x2f01cd[_0xbbc2('0x5b')]);loggerPredictive[_0xbbc2('0x4b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2f01cd[_0xbbc2('0x5c')]);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x5d'),_0x2f01cd[_0xbbc2('0x5e')]);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x5f'),_0x2f01cd['erlangBusyFactor']);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x5d'),_0x2f01cd[_0xbbc2('0x5e')]);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x55'));_[_0xbbc2('0x60')](_0x37e74c,_0x2f01cd);};}function ifInterval(_0x1107a0,_0x449934){if(_['isUndefined'](_0x449934)){return![];}return utils[_0xbbc2('0x61')](undefined,_0x449934)<_0x1107a0*0x3c;}function clearPredictiveAttributes(_0xc2294){if(_0xc2294[_0xbbc2('0x2b')]){_0xc2294[_0xbbc2('0x2b')]=undefined;loggerPredictive[_0xbbc2('0x45')](_0xc2294[_0xbbc2('0x49')],_0xbbc2('0x62'));}if(_0xc2294['startPredictive']){_0xc2294[_0xbbc2('0x2a')]=undefined;loggerPredictive[_0xbbc2('0x45')](_0xc2294[_0xbbc2('0x49')],'startPredictive\x20value\x20cleared');}if(_0xc2294['handlePredictive']){clearInterval(_0xc2294['handlePredictive']);_0xc2294[_0xbbc2('0x63')]=undefined;loggerPredictive[_0xbbc2('0x45')](_0xc2294[_0xbbc2('0x49')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1a0aef,_0x40646d){return function(_0x523101){loggerPredictive['error'](_0x40646d[_0xbbc2('0x49')],_0x1a0aef);loggerPredictive[_0xbbc2('0x64')](_0x523101[_0xbbc2('0x65')]);clearPredictiveAttributes(_0x40646d);};}function loggerCatch(_0x31ca5d){return function(_0x26184e){logger[_0xbbc2('0x64')](_0x31ca5d,util['inspect'](_0x26184e,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x35c18b,_0x547a4d,_0x1a31f0){return function(_0x4e852d){utils[_0xbbc2('0x66')](_0x547a4d,_0x1a31f0,0x0);logger[_0xbbc2('0x64')](_0x35c18b,util[_0xbbc2('0x46')](_0x4e852d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x16cb8c){return function(_0xf8bb13){if(isNotNull(_0xf8bb13)&&isNotNull(_0xf8bb13[0x0])){if(_0xf8bb13[0x0][_0xbbc2('0x67')]>0x0){_0x16cb8c[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')][_0xbbc2('0x6a')];logger[_0xbbc2('0x4b')](_0xbbc2('0x6b')+_0x16cb8c[_0xbbc2('0x49')],_0xf8bb13[0x0][_0xbbc2('0x67')],_0xbbc2('0x6c'));}else{_0x16cb8c[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')][_0xbbc2('0x6d')];logger[_0xbbc2('0x4b')](_0xbbc2('0x6e')+_0x16cb8c[_0xbbc2('0x49')]);}}};}function createObjHistory(_0x51fd44,_0x3b2fea,_0x95c8c9,_0x3dd94f,_0x24b16a){_0x51fd44['message']=_0x95c8c9;var _0xdf13c1=new Action(_0x51fd44,_0x3b2fea);var _0x2b718d=new History(_0xdf13c1);_0x2b718d[_0xbbc2('0x6f')]=_0x3dd94f;_0x2b718d[_0xbbc2('0x70')]=_0x24b16a;_0x2b718d['endtime']=_0xdf13c1[_0xbbc2('0x71')];return _0x2b718d;}function unlockQueueStatus(_0x29a487,_0x336670){setTimeout(function(){if(_[_0xbbc2('0x56')](_0x29a487[_0xbbc2('0x72')])){loggerBooked['error'](_0xbbc2('0x73'),_0x336670);}_0x29a487[_0xbbc2('0x72')]=!![];loggerBooked[_0xbbc2('0x4b')](_0xbbc2('0x74'),_0x336670,JSON[_0xbbc2('0x75')](_[_0xbbc2('0x76')](_0x29a487,[_0xbbc2('0x49'),_0xbbc2('0x72')])));},0x1f3);}function checkInterval(_0xf8af20){return function(){if(!isNotNull(_0xf8af20[_0xbbc2('0x77')])){_0xf8af20[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')][_0xbbc2('0x78')];throw _0xf8af20[_0xbbc2('0x49')]+_0xbbc2('0x79');}if(!isNotNull(_0xf8af20[_0xbbc2('0x77')][_0xbbc2('0x7a')])){_0xf8af20[_0xbbc2('0x68')]=utils['CAMPAIGN_STATUS'][_0xbbc2('0x78')];throw _0xf8af20[_0xbbc2('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xbbc2('0x4a')](_0xf8af20[_0xbbc2('0x77')][_0xbbc2('0x7a')]))){_0xf8af20[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')]['NULL_INTERVAL'];throw _0xf8af20[_0xbbc2('0x49')]+_0xbbc2('0x79');}};}function checkIsIVRCampaignActive(_0x1b1f1c){return function(){if(!utils['isIVRCampaignActive'](_0x1b1f1c)){_0x1b1f1c[_0xbbc2('0x68')]=utils['CAMPAIGN_STATUS'][_0xbbc2('0x7b')];throw _0x1b1f1c[_0xbbc2('0x49')]+_0xbbc2('0x7c');}};}function emitCampaignSummary(_0x388d22){if(utils[_0xbbc2('0x7d')](_0x388d22)){emit(util[_0xbbc2('0x47')](_0xbbc2('0x7e'),_0x388d22['name']),_0xbbc2('0x7f'),_0x388d22);}}function loggerCatchQueueSummary(_0x5045ad,_0x3e40b6){return function(_0x2dc05e){clearPredictiveAttributes(_0x3e40b6);emitCampaignSummary(_0x3e40b6);loggerSyncQueueSummary[_0xbbc2('0x45')](_0x5045ad,util[_0xbbc2('0x46')](_0x2dc05e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2af0b6){if(_0x2af0b6[_0xbbc2('0x80')]){if(_0x2af0b6['originated']===0x0){_0x2af0b6[_0xbbc2('0x80')]=![];_0x2af0b6[_0xbbc2('0x68')]=utils['CAMPAIGN_STATUS'][_0xbbc2('0x7b')];loggerSyncQueueSummary[_0xbbc2('0x45')](_0xbbc2('0x81'),_0x2af0b6[_0xbbc2('0x49')],_0xbbc2('0x82'));}else{_0x2af0b6[_0xbbc2('0x68')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0xbbc2('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2af0b6[_0xbbc2('0x49')],_0xbbc2('0x83'));}emitCampaignSummary(_0x2af0b6);}}function myreject(_0x7a0f74){return function(_0x3f18cb){return _0x7a0f74(msgResponse(_0xbbc2('0x84'),_0xbbc2('0x85'),JSON[_0xbbc2('0x75')](_0x3f18cb)));};}Dialer[_0xbbc2('0x1a')][_0xbbc2('0x86')]=function(_0x3c3ed1){return!_[_0xbbc2('0x56')](_0x3c3ed1)&&_0x3c3ed1&&!_[_0xbbc2('0x56')](_0x3c3ed1[_0xbbc2('0x49')])&&!_['isUndefined'](_0x3c3ed1[_0xbbc2('0x87')])&&_0x3c3ed1['active']&&(this[_0xbbc2('0x23')][util['format'](_0xbbc2('0x88'),_0x3c3ed1['name'])][_0xbbc2('0x89')]==='reachable'||this['trunks'][util['format'](_0xbbc2('0x88'),_0x3c3ed1[_0xbbc2('0x49')])][_0xbbc2('0x89')]===_0xbbc2('0x8a'));};Dialer[_0xbbc2('0x1a')]['checkIsTrunkReachable']=function(_0x120abf){var _0x31bc00=this;return function(){if(!_0x31bc00['isTrunkReachable'](_0x120abf[_0xbbc2('0x8b')])){if(!_0x31bc00[_0xbbc2('0x86')](_0x120abf[_0xbbc2('0x8c')])){_0x120abf[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')][_0xbbc2('0x8d')];throw _0x120abf[_0xbbc2('0x49')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype']['checkIfTime']=function(_0x568a04,_0x45cf66,_0xf595c9,_0x5ae551){var _0x4625fc=this;return function(){var _0x2fa1bd=!![];return _0x4625fc[_0xbbc2('0x8e')](_0x568a04,_0x45cf66,_0xf595c9,_0x5ae551,_0x2fa1bd);};};Dialer['prototype'][_0xbbc2('0x8f')]=function(_0x2e0f21,_0x387369,_0x571e7e,_0x4701de){var _0x5e54e9=this;return function(){var _0x39d530=![];return _0x5e54e9[_0xbbc2('0x8e')](_0x2e0f21['Intervals'],_0x387369,_0x571e7e,_0x4701de,_0x39d530);};};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x8e')]=function(_0x3d841c,_0x5aa710,_0x580716,_0x2f728b,_0x160886){var _0x1f3065=[];return new Promise(function(_0x5f20ec,_0x1564d7){if(!isNotNull(_0x3d841c)){_0x2f728b[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')][_0xbbc2('0x78')];return _0x1564d7(msgResponse(_0xbbc2('0x90'),_0xbbc2('0x91'),_0x580716+_0xbbc2('0x92')));}if(_[_0xbbc2('0x4a')](_0x3d841c)){_0x2f728b[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')][_0xbbc2('0x93')];return _0x1564d7(msgResponse(_0xbbc2('0x90'),_0xbbc2('0x91'),_0x580716+_0xbbc2('0x94')));}if(_0x5aa710&&_[_0xbbc2('0x56')](config['timezones'][_0x5aa710])){_0x2f728b[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')][_0xbbc2('0x95')];return _0x1564d7(msgResponse(_0xbbc2('0x90'),_0xbbc2('0x91'),_0x580716+_0xbbc2('0x96')+_0x5aa710));}if(_[_0xbbc2('0x97')](_0x3d841c)){for(var _0x407aff=0x0;_0x407aff<_0x3d841c[_0xbbc2('0x98')];_0x407aff+=0x1){_0x1f3065[_0xbbc2('0x99')](ami[_0xbbc2('0x9a')]({'action':'command','command':util[_0xbbc2('0x47')]('iftime\x20%s,%s',_0x3d841c[_0x407aff][_0xbbc2('0x9b')],!_[_0xbbc2('0x56')](config[_0xbbc2('0x9c')][_0x5aa710])?_0x5aa710:'')})[_0xbbc2('0x40')](function(_0x3376f8){return _0x3376f8[_0xbbc2('0x9d')][_0xbbc2('0x9e')](_0xbbc2('0x9f'))>=0x0;})['catch'](myreject(_0x1564d7)));}}else{_0x1f3065[_0xbbc2('0x99')](ami[_0xbbc2('0x9a')]({'action':_0xbbc2('0xa0'),'command':util['format']('iftime\x20%s,%s',_0x3d841c,!_[_0xbbc2('0x56')](config[_0xbbc2('0x9c')][_0x5aa710])?_0x5aa710:'')})[_0xbbc2('0x40')](function(_0x2e0721){return _0x2e0721[_0xbbc2('0x9d')]['indexOf'](_0xbbc2('0x9f'))>=0x0;})[_0xbbc2('0xa1')](myreject(_0x1564d7)));}Promise[_0xbbc2('0xa2')](_0x1f3065)[_0xbbc2('0x40')](function(_0x300707){var _0x559a20=_[_0xbbc2('0xa3')](_0x300707);if(_0x559a20){return _0x5f20ec(_0x559a20);}else{_0x2f728b[_0xbbc2('0x68')]=_0x160886?utils[_0xbbc2('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xbbc2('0x69')][_0xbbc2('0xa4')];return _0x1564d7(msgResponse(_0xbbc2('0xa5'),_0xbbc2('0x91'),_0xbbc2('0xa6')+_0x160886+'\x20'+_0x580716+_0xbbc2('0xa7')+util[_0xbbc2('0x46')](_0x3d841c,{'showHidden':![],'depth':null})+_0xbbc2('0xa8')+_0x5aa710));}})[_0xbbc2('0xa1')](function(_0x306d49){return _0x1564d7(msgResponse('ifTime','Failure',JSON['stringify'](_0x306d49)));});});};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x3d')]=function(){var _0x541966=this;return cmHopper[_0xbbc2('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0xbbc2('0x40')](function(){setInterval(function(){_0x541966[_0xbbc2('0xaa')]();},0x3e8);});};Dialer[_0xbbc2('0x1a')][_0xbbc2('0xaa')]=function(){var _0x21d27e=this;var _0x267d69;for(var _0x5602a2 in this[_0xbbc2('0x21')]){if(typeof this[_0xbbc2('0x21')][_0x5602a2]!=='undefined'){_0x267d69=this[_0xbbc2('0x21')][_0x5602a2];if(utils[_0xbbc2('0x7d')](_0x267d69)&&utils[_0xbbc2('0xab')](_0x267d69)){_0x267d69['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xbbc2('0x40')](checkIsIVRCampaignActive(_0x267d69))[_0xbbc2('0x40')](checkInterval(_0x267d69))['then'](_0x21d27e[_0xbbc2('0xac')](_0x267d69))[_0xbbc2('0x40')](_0x21d27e[_0xbbc2('0xad')](_0x267d69[_0xbbc2('0xae')],_0x267d69[_0xbbc2('0xaf')],_0x267d69[_0xbbc2('0x49')],_0x267d69))[_0xbbc2('0x40')](_0x21d27e[_0xbbc2('0x8f')](_0x267d69[_0xbbc2('0x77')],_0x267d69['dialTimezone'],_0x267d69[_0xbbc2('0x49')],_0x267d69))[_0xbbc2('0x40')](_0x21d27e[_0xbbc2('0xb0')](_0x267d69))[_0xbbc2('0xa1')](loggerCatchQueueSummary(_0xbbc2('0xb1'),_0x267d69));}else{notSendMessagesCampaign(_0x267d69);}}}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0xb2')]=function(_0x15feda){if(_0x15feda[_0xbbc2('0xb3')]!==_0xbbc2('0xc')){clearPredictiveAttributes(_0x15feda);}switch(_0x15feda[_0xbbc2('0xb3')]){case _0xbbc2('0xb4'):this['handlePower'](_0x15feda,0x1);break;case'power':this[_0xbbc2('0xb5')](_0x15feda,_0x15feda[_0xbbc2('0xb6')]);break;case _0xbbc2('0xc'):this[_0xbbc2('0xc')](_0x15feda);break;case'booked':this[_0xbbc2('0xb5')](_0x15feda,0x1);break;default:logger[_0xbbc2('0x64')](_0xbbc2('0xb7'),_0x15feda['name'],_0xbbc2('0xb8'));}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x90')]=function(_0x2a0e4e,_0x516068){var _0x30d31a=_0x2a0e4e[_0xbbc2('0xaf')];var _0x593bcc=_0x516068?_0x2a0e4e[_0xbbc2('0xae')]:_0x2a0e4e['Interval'][_0xbbc2('0x7a')];logger[_0xbbc2('0xb9')](_0xbbc2('0xba'),_0x593bcc,_0x30d31a,_0x2a0e4e[_0xbbc2('0x49')],util[_0xbbc2('0x47')]('Voice\x20Queue\x20%s\x20$s',_0x2a0e4e[_0xbbc2('0x49')],_0x2a0e4e['id']));var _0x521a68=null;return Interval['intervalIftime'](_0x593bcc,_0x30d31a)['then'](function(_0x3aeabe){if(_0x3aeabe===!![]){return _0x3aeabe;}else{_0x2a0e4e[_0xbbc2('0x68')]=_0x516068?utils[_0xbbc2('0x69')][_0xbbc2('0xbb')]:utils['CAMPAIGN_STATUS'][_0xbbc2('0xa4')];_0x521a68=msgResponse(_0xbbc2('0xa5'),_0xbbc2('0x91'),_0xbbc2('0xa6')+_0x516068+'\x20'+_0x2a0e4e[_0xbbc2('0x49')]+_0xbbc2('0xa7')+util[_0xbbc2('0x46')](_0x593bcc,{'showHidden':![],'depth':null})+_0xbbc2('0xa8')+_0x30d31a);}if(_0x521a68!==null){logger[_0xbbc2('0xb9')](_0xbbc2('0xbc'),_0x521a68);_0x521a68['isGlobal']=_0x516068;throw _0x521a68;}})[_0xbbc2('0xa1')](function(_0x5d4818){logger['error'](_0xbbc2('0xbd'),_0x5d4818);throw msgResponse(_0xbbc2('0x84'),_0xbbc2('0x85'),util['inspect'](_0x5d4818,{'showHidden':![],'depth':null}));});};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x31')]=function(_0x44c72c){if(this[_0xbbc2('0x20')][_0x44c72c[_0xbbc2('0xbe')]]){if(this[_0xbbc2('0x28')][_0x44c72c[_0xbbc2('0xbf')]]&&this['uniqueId'][_0x44c72c[_0xbbc2('0xbf')]][_0xbbc2('0x43')]!==_0xbbc2('0xc0')){this[_0xbbc2('0xc1')](this['voiceQueues'][_0x44c72c[_0xbbc2('0xbe')]]);this[_0xbbc2('0x28')][_0x44c72c[_0xbbc2('0xbf')]][_0xbbc2('0xc2')]=moment()[_0xbbc2('0x47')](_0xbbc2('0xc3'));}}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0xc4')]=function(_0x153ece){var _0x53ebaf=this['uniqueId'][_0x153ece[_0xbbc2('0xbf')]];if(this['voiceQueues'][_0x153ece[_0xbbc2('0xbe')]]){if(_0x53ebaf&&_0x53ebaf[_0xbbc2('0x43')]!=='ivr'){delete this[_0xbbc2('0x28')][_0x153ece[_0xbbc2('0xbf')]];this[_0xbbc2('0x20')][_0x153ece[_0xbbc2('0xbe')]][_0xbbc2('0xc5')]+=0x1;var _0xcf664c=new AgentComplete(_0x53ebaf,_0x153ece);if(_0x153ece[_0xbbc2('0xc6')]===_0xbbc2('0xc7')){_0xcf664c[_0xbbc2('0xc8')]=this['voiceQueues'][_0x153ece[_0xbbc2('0xbe')]][_0xbbc2('0xc9')]&&this[_0xbbc2('0x20')][_0x153ece[_0xbbc2('0xbe')]]['dialAgiAfterHangupAgent']?moment()[_0xbbc2('0x47')](_0xbbc2('0xc3')):undefined;}hopperUtils[_0xbbc2('0xca')](_0xcf664c)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0xcb')));hopperUtils['moveContactManagedDialer'](_0xcf664c)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0xcc')));}}};Dialer['prototype'][_0xbbc2('0x33')]=function(_0x21e821){var _0x2cc9b8=this[_0xbbc2('0x28')][_0x21e821[_0xbbc2('0xbf')]];var _0x599a47=this;var _0x4e4959=![];var _0x5288c1;var _0x97ef9b;if(this[_0xbbc2('0x20')][_0x21e821[_0xbbc2('0xbe')]]){if(_0x2cc9b8&&_0x2cc9b8[_0xbbc2('0x43')]!==_0xbbc2('0xc0')){delete this['uniqueId'][_0x21e821[_0xbbc2('0xbf')]];this['updateOriginated'](this[_0xbbc2('0x20')][_0x21e821[_0xbbc2('0xbe')]]);_0x2cc9b8[_0xbbc2('0xcd')]=moment()[_0xbbc2('0x47')](_0xbbc2('0xc3'));var _0x261d69=new QueueCallerAbandon(_0x2cc9b8,_0x21e821);if(utils[_0xbbc2('0x61')](_0x2cc9b8[_0xbbc2('0xcd')],_0x2cc9b8[_0xbbc2('0xce')])>=_0x2cc9b8['dialQueueTimeout']){this[_0xbbc2('0x20')][_0x21e821[_0xbbc2('0xbe')]][_0xbbc2('0x50')]+=0x1;this['voiceQueues'][_0x21e821[_0xbbc2('0xbe')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xbbc2('0x20')][_0x21e821['queue']][_0xbbc2('0xcf')]+=0x1;_0x261d69[_0xbbc2('0x6f')]=0xa;_0x261d69[_0xbbc2('0x70')]=_0xbbc2('0xd0');_0x261d69[_0xbbc2('0xd1')]='TIMEOUT';_0x261d69[_0xbbc2('0xc8')]=this[_0xbbc2('0x20')][_0x21e821[_0xbbc2('0xbe')]][_0xbbc2('0xc9')]?moment()['format'](_0xbbc2('0xc3')):undefined;_0x261d69[_0xbbc2('0xd2')]+=0x1;_0x261d69[_0xbbc2('0xd3')]+=0x1;_0x5288c1=this['voiceQueues'][_0x21e821['queue']][_0xbbc2('0xd4')];_0x97ef9b=this['voiceQueues'][_0x21e821[_0xbbc2('0xbe')]][_0xbbc2('0xd5')];hopperUtils[_0xbbc2('0xd6')](_0x261d69,_0x261d69['state'],_0x2cc9b8['voiceQueue'])[_0xbbc2('0x40')](function(_0x260c68){_0x4e4959=_0x260c68['additional']==0x1;if(_0x261d69[_0xbbc2('0xd2')]>=_0x599a47['voiceQueues'][_0x21e821[_0xbbc2('0xbe')]][_0xbbc2('0xd7')]){_0x599a47[_0xbbc2('0xd8')](_0x261d69,_0x260c68['additional']);}else{hopperUtils[_0xbbc2('0xd9')]({'active':![],'countdropretry':_0x261d69[_0xbbc2('0xd2')],'scheduledat':moment()[_0xbbc2('0xda')](_0x599a47[_0xbbc2('0x20')][_0x21e821[_0xbbc2('0xbe')]][_0xbbc2('0xd4')],_0xbbc2('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cc9b8[_0xbbc2('0xdc')],'ListId':_0x2cc9b8[_0xbbc2('0xdd')],'VoiceQueueId':_0x2cc9b8[_0xbbc2('0xde')]||undefined,'CampaignId':_0x2cc9b8['CampaignId']||undefined})['catch'](loggerCatch(_0xbbc2('0xdf')));var _0x3c2be6=new History(_0x261d69);_0x3c2be6[_0xbbc2('0x6f')]=0xa;_0x3c2be6[_0xbbc2('0x70')]=_0xbbc2('0xd0');_0x3c2be6[_0xbbc2('0x71')]=moment()[_0xbbc2('0x47')](_0xbbc2('0xc3'));_0x3c2be6['endtime']=_0x3c2be6[_0xbbc2('0x71')];_0x3c2be6['calleridname']=_0x261d69['calleridname'];_0x3c2be6[_0xbbc2('0xe0')]=_0x261d69[_0xbbc2('0xe0')];hopperUtils['createHistory'](_0x3c2be6)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0xe1')));}})[_0xbbc2('0x40')](function(){if(_0x4e4959)hopperUtils[_0xbbc2('0xe2')](_0x261d69,_0x5288c1,_0x97ef9b)[_0xbbc2('0x40')](function(){return 0x1;});});}else{this['voiceQueues'][_0x21e821['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x21e821[_0xbbc2('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0x261d69[_0xbbc2('0x6f')]=0xb;_0x261d69[_0xbbc2('0x70')]='Abandoned';_0x261d69[_0xbbc2('0xd1')]=_0xbbc2('0xe3');_0x261d69[_0xbbc2('0xe4')]+=0x1;_0x261d69[_0xbbc2('0xd3')]+=0x1;_0x5288c1=this['voiceQueues'][_0x21e821[_0xbbc2('0xbe')]][_0xbbc2('0xe5')];_0x97ef9b=this[_0xbbc2('0x20')][_0x21e821[_0xbbc2('0xbe')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xbbc2('0xd6')](_0x261d69,_0x261d69['state'],_0x2cc9b8[_0xbbc2('0xe6')])[_0xbbc2('0x40')](function(_0x710716){if(_0x261d69['countabandonedretry']>=_0x599a47[_0xbbc2('0x20')][_0x21e821[_0xbbc2('0xbe')]][_0xbbc2('0xe7')]){_0x599a47['queueCallerAbandonCreateState'](_0x261d69,_0x710716[_0xbbc2('0xe8')]);}else{hopperUtils[_0xbbc2('0xd9')]({'active':![],'countabandonedretry':_0x261d69[_0xbbc2('0xe4')],'scheduledat':moment()[_0xbbc2('0xda')](_0x599a47[_0xbbc2('0x20')][_0x21e821[_0xbbc2('0xbe')]][_0xbbc2('0xe5')],_0xbbc2('0xdb'))[_0xbbc2('0x47')](_0xbbc2('0xc3')),'ContactId':_0x2cc9b8[_0xbbc2('0xdc')],'ListId':_0x2cc9b8[_0xbbc2('0xdd')],'VoiceQueueId':_0x2cc9b8[_0xbbc2('0xde')]||undefined,'CampaignId':_0x2cc9b8[_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0xea')));var _0x5e7af7=new History(_0x261d69);_0x5e7af7[_0xbbc2('0x6f')]=0xb;_0x5e7af7['statedesc']=_0xbbc2('0xeb');_0x5e7af7[_0xbbc2('0x71')]=moment()[_0xbbc2('0x47')](_0xbbc2('0xc3'));_0x5e7af7[_0xbbc2('0xec')]=_0x5e7af7['starttime'];_0x5e7af7[_0xbbc2('0xed')]=_0x261d69[_0xbbc2('0xed')];_0x5e7af7[_0xbbc2('0xe0')]=_0x261d69[_0xbbc2('0xe0')];hopperUtils['createHistory'](_0x5e7af7)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0xee')));}})[_0xbbc2('0x40')](function(){if(_0x4e4959)hopperUtils['swapAdditionalPhones'](_0x261d69,_0x5288c1,_0x97ef9b)[_0xbbc2('0x40')](function(){return 0x1;});});}}}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x38')]=function(_0x38fcae){if(this[_0xbbc2('0x26')][_0x38fcae[_0xbbc2('0xbf')]]){this[_0xbbc2('0x26')][_0x38fcae[_0xbbc2('0xbf')]]['channel']=_0x38fcae[_0xbbc2('0xef')];}if(this['uniqueId'][_0x38fcae[_0xbbc2('0xbf')]]){this[_0xbbc2('0x28')][_0x38fcae[_0xbbc2('0xbf')]]['channel']=_0x38fcae[_0xbbc2('0xef')];}};Dialer[_0xbbc2('0x1a')]['syncQueueMember']=function(_0x344e47){if(!this[_0xbbc2('0x26')][_0x344e47[_0xbbc2('0xf0')]]){return;}var _0x80a38e=this[_0xbbc2('0x20')][this[_0xbbc2('0x26')][_0x344e47[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]][_0xbbc2('0xf1')]||'rrmemory';if(_0x80a38e==='roundrobin'){if(this[_0xbbc2('0x26')][_0x344e47['actionid']]&&_[_0xbbc2('0xf2')](this['actions'][_0x344e47[_0xbbc2('0xf0')]][_0xbbc2('0xf3')])&&_0x344e47[_0xbbc2('0x89')]==='1'&&_0x344e47[_0xbbc2('0xf4')]==='0'){if(this[_0xbbc2('0x22')][_0x344e47['stateinterface']]){if(!this[_0xbbc2('0x22')][_0x344e47[_0xbbc2('0xf5')]]['locked']){this['agents'][_0x344e47['stateinterface']][_0xbbc2('0xf3')]=!![];this['actions'][_0x344e47[_0xbbc2('0xf0')]]['locked']=!![];this['actions'][_0x344e47[_0xbbc2('0xf0')]][_0xbbc2('0xf5')]=_0x344e47[_0xbbc2('0xf5')];}}}}else if(_0x80a38e===_0xbbc2('0xf6')){if(this['actions'][_0x344e47[_0xbbc2('0xf0')]]){if(this['agents'][_0x344e47['stateinterface']]){this[_0xbbc2('0x26')][_0x344e47[_0xbbc2('0xf0')]][_0xbbc2('0xf5')]=_0x344e47[_0xbbc2('0xf5')];if(_[_0xbbc2('0xf2')](this['queueBooked'][this['actions'][_0x344e47[_0xbbc2('0xf0')]]['queue']])){this['queueBooked'][this['actions'][_0x344e47[_0xbbc2('0xf0')]]['queue']]=[];}this[_0xbbc2('0x2d')][this['actions'][_0x344e47['actionid']][_0xbbc2('0xbe')]][_0xbbc2('0x99')](_[_0xbbc2('0x60')](_[_0xbbc2('0x76')](this[_0xbbc2('0x26')][_0x344e47[_0xbbc2('0xf0')]],[_0xbbc2('0xf7'),'stateinterface']),{'status':_0x344e47[_0xbbc2('0x89')],'paused':_0x344e47[_0xbbc2('0xf4')]}));}}}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x3c')]=function(_0x59aab9){if(!this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]]){return;}var _0x4a7dbe=this;var _0x53f811=this[_0xbbc2('0x20')][this[_0xbbc2('0x26')][_0x59aab9['actionid']][_0xbbc2('0xbe')]];var _0x5c5918=_0x53f811[_0xbbc2('0xf1')]||_0xbbc2('0xf6');if(_0x5c5918===_0xbbc2('0xf8')){if(this[_0xbbc2('0x26')][_0x59aab9['actionid']]&&this['actions'][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xf5')]){this['preview'][_0xbbc2('0xf9')](this['actions'][_0x59aab9['actionid']][_0xbbc2('0xf7')],this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]]['stateinterface'])[_0xbbc2('0xa1')](function(_0x5ce143){logger[_0xbbc2('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xbbc2('0x46')](_0x5ce143,{'showHidden':![],'depth':null}));})[_0xbbc2('0x1d')](function(){_0x4a7dbe['updateOriginated'](_0x4a7dbe['voiceQueues'][_0x4a7dbe[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]]);_0x4a7dbe['agents'][_0x4a7dbe['actions'][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xf5')]]['locked']=![];delete _0x4a7dbe['actions'][_0x59aab9[_0xbbc2('0xf0')]];unlockQueueStatus(_0x53f811);});}else{this[_0xbbc2('0xc1')](this[_0xbbc2('0x20')][this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0xbbc2('0x26')][_0x59aab9['actionid']][_0xbbc2('0xdc')],'ListId':this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]]['ListId'],'VoiceQueueId':this['actions'][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xde')]||undefined,'CampaignId':this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]]['CampaignId']||undefined})['catch'](loggerCatch(_0xbbc2('0xfa')));delete this['actions'][_0x59aab9[_0xbbc2('0xf0')]];unlockQueueStatus(_0x53f811);}}else if(_0x5c5918===_0xbbc2('0xf6')){var _0x4dc564;if(this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]]&&!_[_0xbbc2('0x4a')](this[_0xbbc2('0x2d')][this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]])){if(this['queueBookedRR'][_0x4a7dbe[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]]){this[_0xbbc2('0x2e')][_0x4a7dbe[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]]=this['queueBookedRR'][this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]]?this[_0xbbc2('0x2e')][this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]]:this['queueBooked'][this[_0xbbc2('0x26')][_0x59aab9['actionid']][_0xbbc2('0xbe')]]?this[_0xbbc2('0x2d')][this['actions'][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]][_0xbbc2('0xfb')]=this[_0xbbc2('0x2e')][this[_0xbbc2('0x26')][_0x59aab9[_0xbbc2('0xf0')]][_0xbbc2('0xbe')]];for(var _0x257245=0x0;_0x257245=_0x11b232[_0xbbc2('0x121')]){_0x3195cb[_0xbbc2('0x122')](_0x2f76a6,_0xb8c157,_0x38a1c4,_0xbbc2('0x123'));}else{if(_0x2f76a6[_0xbbc2('0x11f')]>=_0x11b232[_0xbbc2('0x124')]){_0x3195cb[_0xbbc2('0x125')](_0x2f76a6,_0xb8c157,_0x38a1c4,_0xbbc2('0x126'));}else{hopperUtils[_0xbbc2('0xd9')]({'active':![],'countmachineretry':_0x2f76a6[_0xbbc2('0x11f')],'scheduledat':moment()[_0xbbc2('0xda')](_0x11b232[_0xbbc2('0x127')],_0xbbc2('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f76a6[_0xbbc2('0xdc')],'ListId':_0x2f76a6[_0xbbc2('0xdd')],'VoiceQueueId':_0x2f76a6['VoiceQueueId']||undefined,'CampaignId':_0x2f76a6[_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch('[rescheduleContact][Machine]'));_0xb8c157({'reschedule':0x1});}}});}if(_0x1b341f[_0xbbc2('0x43')]===_0xbbc2('0xc0')&&this[_0xbbc2('0x21')][_0x1b341f[_0xbbc2('0xbe')]]['dialAMDActive']&&_0x1b1eeb[_0xbbc2('0x10f')]===_0xbbc2('0x110')){delete this[_0xbbc2('0x28')][_0x1b1eeb['uniqueid']];this[_0xbbc2('0xc1')](this[_0xbbc2('0x21')][_0x1b341f[_0xbbc2('0xbe')]]);_0xc882c2=new Hangup(_0x1b341f,_0x1b1eeb);_0xc882c2[_0xbbc2('0x6f')]=0x12;_0xc882c2['statedesc']=_0xbbc2('0x128');_0xc882c2[_0xbbc2('0x112')]=_0xbbc2('0x119');ami[_0xbbc2('0x42')]('custom:amd',ut[_0xbbc2('0x114')](_0xc882c2,_0xbbc2('0x11a')));this[_0xbbc2('0x115')](_0xc882c2,_0xbbc2('0x129'),_0xbbc2('0x12a'));}if(_0x1b341f['type']===_0xbbc2('0xc0')&&this[_0xbbc2('0x21')][_0x1b341f[_0xbbc2('0xbe')]][_0xbbc2('0x10e')]&&_0x1b1eeb['value']==='MACHINE'){return new Promise(function(_0x57906e,_0x91790d){delete _0x3195cb[_0xbbc2('0x28')][_0x1b1eeb[_0xbbc2('0xbf')]];_0x3195cb[_0xbbc2('0xc1')](_0x3195cb[_0xbbc2('0x21')][_0x1b341f[_0xbbc2('0xbe')]]);_0x3195cb[_0xbbc2('0x21')][_0x1b341f[_0xbbc2('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x3195cb[_0xbbc2('0x21')][_0x1b341f[_0xbbc2('0xbe')]][_0xbbc2('0x111')]+=0x1;var _0x26b034=_0x3195cb[_0xbbc2('0x21')][_0x1b341f[_0xbbc2('0xbe')]];var _0x4ca7f6=new Hangup(_0x1b341f,_0x1b1eeb);_0x4ca7f6[_0xbbc2('0x6f')]=0x13;_0x4ca7f6[_0xbbc2('0x70')]=_0xbbc2('0x118');_0x4ca7f6['membername']='AMD';_0x4ca7f6[_0xbbc2('0x11f')]+=0x1;_0x4ca7f6[_0xbbc2('0xd3')]+=0x1;_0x4ca7f6[_0xbbc2('0x11a')]=!![];ami['emit'](_0xbbc2('0x113'),ut[_0xbbc2('0x114')](_0x4ca7f6,_0xbbc2('0x11a')));hopperUtils[_0xbbc2('0xca')](_0x4ca7f6)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x11b')));if(_0x4ca7f6[_0xbbc2('0x11c')]+_0x4ca7f6[_0xbbc2('0x12b')]+_0x4ca7f6['countnoanswerretry']+_0x4ca7f6[_0xbbc2('0x11e')]+_0x4ca7f6[_0xbbc2('0xd2')]+_0x4ca7f6['countabandonedretry']+_0x4ca7f6['countmachineretry']+_0x4ca7f6[_0xbbc2('0x120')]>=_0x26b034[_0xbbc2('0x121')]){_0x3195cb[_0xbbc2('0x122')](_0x4ca7f6,_0x57906e,_0x91790d,_0xbbc2('0x123'));}else{if(_0x4ca7f6['countmachineretry']>=_0x26b034[_0xbbc2('0x124')]){_0x3195cb[_0xbbc2('0x125')](_0x4ca7f6,_0x57906e,_0x91790d,_0xbbc2('0x126'));}else{hopperUtils[_0xbbc2('0xd9')]({'active':![],'countmachineretry':_0x4ca7f6['countmachineretry'],'scheduledat':moment()['add'](_0x26b034[_0xbbc2('0x127')],_0xbbc2('0xdb'))[_0xbbc2('0x47')](_0xbbc2('0xc3')),'ContactId':_0x4ca7f6[_0xbbc2('0xdc')],'ListId':_0x4ca7f6[_0xbbc2('0xdd')],'VoiceQueueId':_0x4ca7f6['VoiceQueueId']||undefined,'CampaignId':_0x4ca7f6[_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x12c')));_0x57906e({'reschedule':0x1});}}});}}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x37')]=function(_0x892632){var _0x4e046b=this[_0xbbc2('0x28')][_0x892632[_0xbbc2('0xbf')]];var _0x4507b9;if(_0x4e046b&&_0x4e046b[_0xbbc2('0x43')]==='ivr'){delete this[_0xbbc2('0x28')][_0x892632[_0xbbc2('0xbf')]];this[_0xbbc2('0xc1')](this[_0xbbc2('0x21')][_0x4e046b[_0xbbc2('0xbe')]]);this['campaigns'][_0x4e046b['queue']]['ivrAnswerCallsDay']+=0x1;_0x4507b9=new Hangup(_0x4e046b,_0x892632);hopperUtils['createHistory'](_0x4507b9)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x12d')));hopperUtils['moveContactManagedDialer'](_0x4507b9)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x12e')));}if(_0x4e046b&&_0x4e046b[_0xbbc2('0x43')]!==_0xbbc2('0xc0')&&isNotNull(this[_0xbbc2('0x20')][_0x4e046b[_0xbbc2('0xbe')]][_0xbbc2('0x12f')])){delete this['uniqueId'][_0x892632[_0xbbc2('0xbf')]];this[_0xbbc2('0xc1')](this[_0xbbc2('0x20')][_0x4e046b[_0xbbc2('0xbe')]]);this['voiceQueues'][_0x4e046b[_0xbbc2('0xbe')]][_0xbbc2('0xc5')]+=0x1;this[_0xbbc2('0x20')][_0x4e046b[_0xbbc2('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4507b9=new Hangup(_0x4e046b,_0x892632);_0x4507b9[_0xbbc2('0x6f')]=0x10;_0x4507b9[_0xbbc2('0x70')]=_0xbbc2('0x130');_0x4507b9['membername']=_0xbbc2('0x131');hopperUtils[_0xbbc2('0xca')](_0x4507b9)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x12d')));hopperUtils[_0xbbc2('0x132')](_0x4507b9)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x12e')));}if(_0x4e046b&&_0x4e046b[_0xbbc2('0x43')]!==_0xbbc2('0xc0')&&!isNotNull(this[_0xbbc2('0x20')][_0x4e046b[_0xbbc2('0xbe')]][_0xbbc2('0x12f')])){delete this[_0xbbc2('0x28')][_0x892632[_0xbbc2('0xbf')]];this[_0xbbc2('0xc1')](this[_0xbbc2('0x20')][_0x4e046b['queue']]);this['voiceQueues'][_0x4e046b[_0xbbc2('0xbe')]]['outboundUnknownCallsDay']+=0x1;_0x4507b9=new Hangup(_0x4e046b,_0x892632);_0x4507b9[_0xbbc2('0x6f')]=0xc;_0x4507b9['statedesc']=_0x892632['cause-txt'];_0x4507b9[_0xbbc2('0x112')]=_0xbbc2('0x133');hopperUtils['createHistory'](_0x4507b9)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x12d')));hopperUtils['moveContactManagedDialer'](_0x4507b9)[_0xbbc2('0xa1')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0xbbc2('0xe')]=function(_0x5d4e6e){var _0x3e4cda=this;if(!_0x3e4cda['queuesSummary'][_0x5d4e6e['name']]){_0x3e4cda['queuesSummary'][_0x5d4e6e[_0xbbc2('0x49')]]={'running':![]};}else if(_0x3e4cda[_0xbbc2('0x2f')][_0x5d4e6e[_0xbbc2('0x49')]][_0xbbc2('0x134')]===!![]){return;}else if(_0x3e4cda[_0xbbc2('0x2f')][_0x5d4e6e['name']][_0xbbc2('0x134')]===![]){_0x3e4cda[_0xbbc2('0x2f')][_0x5d4e6e['name']][_0xbbc2('0x134')]=!![];}var _0x1382a0=_0x3e4cda[_0xbbc2('0x20')][_0x5d4e6e[_0xbbc2('0x49')]];var _0xbd10bc=_0x1382a0['message']!==utils[_0xbbc2('0x69')][_0xbbc2('0x7b')];var _0x554b42=utils[_0xbbc2('0x135')](_0x1382a0);_0x1382a0[_0xbbc2('0x136')]=utils['getQueueCampaignStatusMessage'](_0x1382a0,_0x3e4cda[_0xbbc2('0x23')]);Promise['resolve']()[_0xbbc2('0x40')](function(){if(_0x1382a0[_0xbbc2('0x136')]===utils[_0xbbc2('0x69')][_0xbbc2('0x7b')]){if(_0xbd10bc){clearPredictiveAttributes(_0x1382a0);_0x5d4e6e[_0xbbc2('0x2a')]=undefined;_0x5d4e6e['startProgressive']=undefined;}if(_0x1382a0[_0xbbc2('0x136')]===utils['CAMPAIGN_STATUS'][_0xbbc2('0x7b')]){_0x5d4e6e[_0xbbc2('0x137')]=0x0;_0x5d4e6e[_0xbbc2('0xf4')]=0x0;_0x5d4e6e[_0xbbc2('0x138')]=0x0;_0x5d4e6e[_0xbbc2('0x139')]=0x0;_0x5d4e6e[_0xbbc2('0x13a')]=0x0;}}else if(_0x1382a0['statusMessage']===utils[_0xbbc2('0x69')][_0xbbc2('0x13b')]&&!_0x554b42){return _0x3e4cda[_0xbbc2('0x90')](_0x1382a0,!![])[_0xbbc2('0x40')](function(){return _0x3e4cda['ifTime'](_0x1382a0,![]);})[_0xbbc2('0x40')](function(){return _0x3e4cda['checkDialMethod'](_0x1382a0);})['catch'](function(_0x3e9d4e){loggerSyncQueueSummary[_0xbbc2('0x45')]('[syncQueueSummary]',util['inspect'](_0x3e9d4e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1382a0);});}else{clearPredictiveAttributes(_0x1382a0);}})['then'](function(){var _0x324d5b=_0x5d4e6e[_0xbbc2('0x13c')](_0x1382a0);if(_0x324d5b||_0x1382a0[_0xbbc2('0x13d')]){_0x1382a0['queueSummaryCountersUpdated']=![];_0x5d4e6e['updateReportFromOutboundQueue'](_0x1382a0);Object[_0xbbc2('0x13e')](_0x1382a0,_0x5d4e6e);emitOutboundVoiceQueueSummary(_0x5d4e6e);}_0x3e4cda['queuesSummary'][_0x1382a0[_0xbbc2('0x49')]][_0xbbc2('0x134')]=![];})[_0xbbc2('0xa1')](function(_0x52cc9c){logger[_0xbbc2('0x64')](_0xbbc2('0x13f'),util['inspect'](_0x52cc9c,{'showHidden':![],'depth':null}));_0x3e4cda['queuesSummary'][_0x1382a0[_0xbbc2('0x49')]]['running']=![];});};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x140')]=_[_0xbbc2('0x141')](function(){var _0x436ebf=_[_0xbbc2('0x142')](this[_0xbbc2('0x20')],function(_0x561759){return _0x561759[_0xbbc2('0x143')];});var _0x136fcd=_[_0xbbc2('0x142')](this[_0xbbc2('0x22')],function(_0x3d0588){return _0x3d0588[_0xbbc2('0x144')]&&_0x3d0588[_0xbbc2('0x89')]===_0xbbc2('0x145');});if(_0x436ebf[_0xbbc2('0x98')]>0x0&&_0x136fcd['length']>0x0){return Promise[_0xbbc2('0x146')]()[_0xbbc2('0x40')](cmHopper[_0xbbc2('0x147')](_[_0xbbc2('0x148')](_0x436ebf,'id'),previewRecallmeReminderInterval,_['map'](_0x136fcd,'id')))[_0xbbc2('0x40')](function(_0x54df6f){for(var _0x507ac0=0x0;_0x507ac0<_0x54df6f['length'];_0x507ac0++){var _0x2e60aa=_0x54df6f[_0x507ac0]['Agent'][_0xbbc2('0x49')];if(_0x2e60aa)io['to'](util[_0xbbc2('0x47')](_0xbbc2('0x149'),_0x2e60aa))['emit'](_0xbbc2('0x14a'),{'hopper':_0x54df6f[_0x507ac0]});}})[_0xbbc2('0xa1')](function(_0x83836b){logger[_0xbbc2('0x64')](_0xbbc2('0x14b'),_0x83836b);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x248583=this;setInterval(function(){_0x248583[_0xbbc2('0x14c')](_0x248583['uniqueId'],_0xbbc2('0x14d'));_0x248583[_0xbbc2('0x14c')](_0x248583[_0xbbc2('0x26')],_0xbbc2('0x14e'));},0x32c8);};Dialer[_0xbbc2('0x1a')]['clearZombieChannels']=function(_0x575a02,_0xce7c49){var _0x27e08a=this;for(var _0x4a5c31 in _0x575a02){if(typeof _0x575a02[_0x4a5c31]!==_0xbbc2('0x14f')){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x575a02[_0x4a5c31])){return ami[_0xbbc2('0x9a')]({'action':_0xbbc2('0x89'),'channel':_0x575a02[_0x4a5c31]['channel']})[_0xbbc2('0xa1')](function(_0x248beb){if(_0x248beb[_0xbbc2('0x68')]===_0xbbc2('0x150')){setTimeout(function(){if(_0x575a02[_0x4a5c31]&&_0x575a02[_0x4a5c31]['type']!=='ivr'){_0x27e08a['updateOriginated'](_0x27e08a[_0xbbc2('0x20')][_0x575a02[_0x4a5c31][_0xbbc2('0xbe')]]);logger[_0xbbc2('0x64')]('[Dialer][checkChannel]',_0xce7c49,_0x4a5c31,_0x575a02[_0x4a5c31][_0xbbc2('0xbe')]);delete _0x575a02[_0x4a5c31];}if(_0x575a02[_0x4a5c31]&&_0x575a02[_0x4a5c31]['type']==='ivr'){_0x27e08a[_0xbbc2('0xc1')](_0x27e08a[_0xbbc2('0x21')][_0x575a02[_0x4a5c31][_0xbbc2('0xbe')]]);logger[_0xbbc2('0x64')](_0xbbc2('0x151'),_0xce7c49,_0x4a5c31,_0x575a02[_0x4a5c31]['queue']);delete _0x575a02[_0x4a5c31];}},0x2328);}});}});}}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x152')]=function(_0x2e5c7d){return Promise['resolve']()[_0xbbc2('0x40')](voiceQueueRt[_0xbbc2('0x152')](_0x2e5c7d))[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x153')));};Dialer[_0xbbc2('0x1a')]['updateOriginated']=function(_0x3ac601){if(!_[_0xbbc2('0x56')](_0x3ac601)&&_0x3ac601!==null){if(typeof _0x3ac601['originated']!=='undefined'){if(_0x3ac601[_0xbbc2('0x154')]>0x0){_0x3ac601[_0xbbc2('0x154')]-=0x1;}else{logger[_0xbbc2('0x64')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xbbc2('0x64')](_0xbbc2('0x155'));}};Dialer[_0xbbc2('0x1a')]['loggerHandler']=function(_0x4eb021,_0x193bb0){var _0x1d063d=this;return function(_0x2f3396){_0x1d063d[_0xbbc2('0xc1')](_0x193bb0);logger[_0xbbc2('0x64')](_0x4eb021,util[_0xbbc2('0x46')](_0x2f3396,{'showHidden':![],'depth':null}));};};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x156')]=function(_0x230033,_0x13f506,_0x4edb7a){var _0x4235a2={'state':0x19,'statedesc':_0xbbc2('0x157')};this['updateOriginated'](_0x13f506);this['saveInDb'](_[_0xbbc2('0x60')](_0x4235a2,_[_0xbbc2('0x76')](_0x4edb7a,['ContactId',_0xbbc2('0xdd'),_0xbbc2('0x158'),'VoiceQueueId',_0xbbc2('0xe9')])),_0xbbc2('0x159'),_0xbbc2('0x15a'));logger['error'](_0x230033);};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x115')]=function(_0x1c95f8,_0x277128,_0x558547){hopperUtils[_0xbbc2('0xca')](_0x1c95f8)['catch'](loggerCatch(_0x277128));hopperUtils['moveContactManagedDialer'](_0x1c95f8)[_0xbbc2('0xa1')](loggerCatch(_0x558547));};Dialer['prototype'][_0xbbc2('0xd8')]=function(_0x164619,_0x384d6f){hopperUtils[_0xbbc2('0xca')](_0x164619)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0xcb')));if(_0x384d6f==0x0){hopperUtils[_0xbbc2('0x132')](_0x164619)[_0xbbc2('0xa1')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x14b')]=function(_0x2f4690){return Promise[_0xbbc2('0x146')]()[_0xbbc2('0x40')](cmHopper['handlePreviewRecallNotifications'](_0x2f4690['id'],previewRecallmeReminderInterval))[_0xbbc2('0x40')](function(_0x43750e){for(var _0x814ed8=0x0;_0x814ed8<_0x43750e[_0xbbc2('0x98')];_0x814ed8++){var _0x29cf21=_0x43750e[_0x814ed8][_0xbbc2('0x15b')]['name'];if(_0x29cf21)io['to'](util['format'](_0xbbc2('0x149'),_0x29cf21))[_0xbbc2('0x42')](_0xbbc2('0x14a'),{'hopper':_0x43750e[_0x814ed8]});}})[_0xbbc2('0xa1')](function(){});};Dialer[_0xbbc2('0x1a')][_0xbbc2('0xb0')]=function(_0x302ddf){var _0x383e16=this;return function(){_0x383e16[_0xbbc2('0x15c')](_0x302ddf);};};Dialer[_0xbbc2('0x1a')]['actionOriginate']=function(_0x5dfd0a,_0x3ab023){var _0x202103=this;var _0x919ec8=uuid['v4']();this[_0xbbc2('0x26')][_0x919ec8]=new Action(_0x5dfd0a,_0x3ab023,_0x919ec8);return new Promise(function(_0x3c429f,_0x419f25){if(_[_0xbbc2('0x56')](_0x5dfd0a)&&typeof _0x5dfd0a!==_0xbbc2('0x15d')){return _0x419f25(msgResponse('originate',_0xbbc2('0x91'),_0xbbc2('0x15e')));}if(_['isUndefined'](_0x3ab023[_0xbbc2('0x15f')])||_0x3ab023[_0xbbc2('0x15f')]===null){return _0x419f25(msgResponse(_0xbbc2('0x160'),_0xbbc2('0x91'),_0xbbc2('0x161')));}var _0x4846e0={'XMD-CALLERID':_0x202103['actions'][_0x919ec8]['getCaller'](),'XMD-AGI':_0x5dfd0a['dialQueueProject']?util[_0xbbc2('0x47')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5dfd0a['dialQueueProject']):_0xbbc2('0x162'),'XMD-AGIAFTER':_0x5dfd0a[_0xbbc2('0xc9')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5dfd0a[_0xbbc2('0xc9')]):_0xbbc2('0x162'),'XMD-QUEUE':utils[_0xbbc2('0x163')](_0x5dfd0a)?util[_0xbbc2('0x47')](_0xbbc2('0x164'),_0x5dfd0a['name'],_0x5dfd0a[_0xbbc2('0x165')]||'',_0x5dfd0a['dialAgiAfterHangupAgent']?'c':'',_0x5dfd0a[_0xbbc2('0x166')]||0x3):_0xbbc2('0x162'),'XMD-CONTACTID':_0x3ab023[_0xbbc2('0xdc')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x202103[_0xbbc2('0x26')][_0x919ec8]['getCaller'](),'XMD-AMD':_0x5dfd0a['dialAMDActive']?_0xbbc2('0x13b'):_0xbbc2('0x162'),'XMD-DESTINATION':_0xbbc2('0x10d')};if(_0x5dfd0a[_0xbbc2('0x10e')]){_0x4846e0[_0xbbc2('0x167')]=_0x5dfd0a['dialAMDInitialSilence']||0x9c4;_0x4846e0[_0xbbc2('0x168')]=_0x5dfd0a['dialAMDGreeting']||0x5dc;_0x4846e0[_0xbbc2('0x169')]=_0x5dfd0a[_0xbbc2('0x16a')]||0x320;_0x4846e0[_0xbbc2('0x16b')]=_0x5dfd0a['dialAMDTotalAnalysisTime']||0x1388;_0x4846e0[_0xbbc2('0x16c')]=_0x5dfd0a[_0xbbc2('0x16d')]||0x64;_0x4846e0['XMD-AMDBETWEENWORDSSILENCE']=_0x5dfd0a[_0xbbc2('0x16e')]||0x32;_0x4846e0[_0xbbc2('0x16f')]=_0x5dfd0a[_0xbbc2('0x170')]||0x3;_0x4846e0['XMD-AMDSILENCETHRESHOLD']=_0x5dfd0a[_0xbbc2('0x171')]||0x100;_0x4846e0[_0xbbc2('0x172')]=_0x5dfd0a['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xbbc2('0x163')](_0x5dfd0a)){_0x4846e0[_0xbbc2('0x173')]=_0x3ab023[_0xbbc2('0xde')];}else{_0x4846e0[_0xbbc2('0x174')]=_0x3ab023[_0xbbc2('0xe9')];}var _0x370526=utils[_0xbbc2('0x175')](_0x3ab023[_0xbbc2('0x176')]);Object['assign'](_0x4846e0,_0x370526);var _0x371187=_0x202103['isTrunkReachable'](_0x5dfd0a[_0xbbc2('0x8b')])?utils[_0xbbc2('0x177')](_0x5dfd0a[_0xbbc2('0x8b')][_0xbbc2('0x178')],_0x5dfd0a['dialOriginateCallerIdName'],_0x5dfd0a[_0xbbc2('0x179')]>0x0?utils[_0xbbc2('0x17a')](_0x5dfd0a['dialOriginateCallerIdNumber'],_0x5dfd0a['dialRandomLastDigitCallerIdNumber']):_0x5dfd0a[_0xbbc2('0x17b')]):utils[_0xbbc2('0x177')](_[_0xbbc2('0xf2')](_0x5dfd0a[_0xbbc2('0x8c')])?_0x5dfd0a['Trunk']['callerid']:_0x5dfd0a[_0xbbc2('0x8c')]['callerid'],_0x5dfd0a['dialOriginateCallerIdName'],_0x5dfd0a['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xbbc2('0x17a')](_0x5dfd0a[_0xbbc2('0x17b')],_0x5dfd0a[_0xbbc2('0x179')]):_0x5dfd0a[_0xbbc2('0x17b')]);if(_0x371187){_0x4846e0[_0xbbc2('0x17c')]=_0x202103[_0xbbc2('0x26')][_0x919ec8][_0xbbc2('0x17d')]=utils[_0xbbc2('0x17e')](_0x371187);_0x4846e0[_0xbbc2('0x17f')]=_0x3ab023[_0xbbc2('0x15f')];}_0x5dfd0a[_0xbbc2('0x180')]=_0x4846e0;return ami[_0xbbc2('0x9a')]({'actionid':_0x919ec8,'action':'originate','channel':_0x202103['isTrunkReachable'](_0x5dfd0a['Trunk'])?util['format']('SIP/%s/%s%s',_0x5dfd0a[_0xbbc2('0x8b')][_0xbbc2('0x49')],isNotNull(_0x5dfd0a[_0xbbc2('0x181')])?_0x5dfd0a[_0xbbc2('0x181')][_0xbbc2('0x182')]()||'':'',_0x5dfd0a[_0xbbc2('0x183')]>0x0?_0x3ab023[_0xbbc2('0x15f')][_0xbbc2('0x184')](_0x5dfd0a[_0xbbc2('0x183')]):_0x3ab023['phone']):util[_0xbbc2('0x47')](_0xbbc2('0x185'),_[_0xbbc2('0xf2')](_0x5dfd0a[_0xbbc2('0x8c')])?_0x5dfd0a[_0xbbc2('0x8b')][_0xbbc2('0x49')]:_0x5dfd0a['TrunkBackup']['name'],isNotNull(_0x5dfd0a[_0xbbc2('0x181')])?_0x5dfd0a['dialPrefix'][_0xbbc2('0x182')]()||'':'',_0x5dfd0a[_0xbbc2('0x183')]>0x0?_0x3ab023[_0xbbc2('0x15f')][_0xbbc2('0x184')](_0x5dfd0a[_0xbbc2('0x183')]):_0x3ab023[_0xbbc2('0x15f')]),'callerid':_0x371187,'Exten':'xcally-motion-dialer','Context':_0xbbc2('0x186'),'Priority':'1','variable':_0x4846e0,'timeout':(_0x5dfd0a[_0xbbc2('0x187')]||0x1e)*0x3e8,'async':!![],'channelid':_0x919ec8})[_0xbbc2('0x40')](function(_0x22b3fc){return _0x3c429f(_0x22b3fc);})[_0xbbc2('0xa1')](function(_0x4a16f0){_0x5dfd0a['outboundOriginateFailureCallsDay']+=0x1;var _0x1fdb69=new History(_0x202103['actions'][_0x919ec8]);logger[_0xbbc2('0x64')](util[_0xbbc2('0x47')](_0xbbc2('0x188'),JSON[_0xbbc2('0x75')](_0x4a16f0)));_0x1fdb69[_0xbbc2('0x6f')]=0xe;_0x1fdb69[_0xbbc2('0x70')]='OriginateError';_0x1fdb69[_0xbbc2('0x71')]=moment()[_0xbbc2('0x47')](_0xbbc2('0xc3'));_0x1fdb69[_0xbbc2('0xec')]=_0x1fdb69[_0xbbc2('0x71')];hopperUtils[_0xbbc2('0xca')](_0x1fdb69)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x189')));_0x202103[_0xbbc2('0x132')](_0x1fdb69)['catch'](loggerCatch(_0xbbc2('0x189')))[_0xbbc2('0x1d')](function(){delete _0x202103[_0xbbc2('0x26')][_0x919ec8];return _0x419f25(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xbbc2('0x18a')]=function(_0x1cb9ce,_0x58af96,_0x586f60){var _0x3146f3=new History(_0x58af96);if(_0x3146f3[_0xbbc2('0x11c')]+_0x3146f3[_0xbbc2('0x12b')]+_0x3146f3['countnoanswerretry']+_0x3146f3[_0xbbc2('0x11e')]+_0x3146f3[_0xbbc2('0xd2')]+_0x3146f3[_0xbbc2('0xe4')]+_0x3146f3['countmachineretry']+_0x3146f3[_0xbbc2('0x120')]>=_0x586f60['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1cb9ce){case 0x3:if(_0x3146f3[_0xbbc2('0x11d')]>=_0x586f60[_0xbbc2('0x18b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3146f3['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xbbc2('0xda')](_0x586f60['dialNoAnswerRetryFrequency'],_0xbbc2('0xdb'))[_0xbbc2('0x47')](_0xbbc2('0xc3')),'ContactId':_0x3146f3['ContactId'],'ListId':_0x3146f3[_0xbbc2('0xdd')],'VoiceQueueId':_0x3146f3[_0xbbc2('0xde')]||undefined,'CampaignId':_0x3146f3[_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x18c')));break;case 0x5:if(_0x3146f3[_0xbbc2('0x11c')]>=_0x586f60[_0xbbc2('0x18d')]-0x1){return!![];}hopperUtils[_0xbbc2('0xd9')]({'active':![],'countbusyretry':_0x3146f3[_0xbbc2('0x11c')]+=0x1,'scheduledat':moment()[_0xbbc2('0xda')](_0x586f60[_0xbbc2('0x18e')],_0xbbc2('0xdb'))[_0xbbc2('0x47')](_0xbbc2('0xc3')),'ContactId':_0x3146f3[_0xbbc2('0xdc')],'ListId':_0x3146f3[_0xbbc2('0xdd')],'VoiceQueueId':_0x3146f3[_0xbbc2('0xde')]||undefined,'CampaignId':_0x3146f3['CampaignId']||undefined})[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x18f')));break;case 0x8:if(_0x3146f3[_0xbbc2('0x12b')]>=_0x586f60['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xbbc2('0xd9')]({'active':![],'countcongestionretry':_0x3146f3['countcongestionretry']+=0x1,'scheduledat':moment()[_0xbbc2('0xda')](_0x586f60[_0xbbc2('0x190')],_0xbbc2('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3146f3['ContactId'],'ListId':_0x3146f3[_0xbbc2('0xdd')],'VoiceQueueId':_0x3146f3[_0xbbc2('0xde')]||undefined,'CampaignId':_0x3146f3[_0xbbc2('0xe9')]||undefined})['catch'](loggerCatch(_0xbbc2('0x191')));break;case 0x0:if(_0x3146f3[_0xbbc2('0x11e')]>=_0x586f60[_0xbbc2('0x192')]-0x1){return!![];}else{hopperUtils[_0xbbc2('0xd9')]({'active':![],'countnosuchnumberretry':_0x3146f3['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x586f60[_0xbbc2('0x193')],_0xbbc2('0xdb'))[_0xbbc2('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3146f3[_0xbbc2('0xdc')],'ListId':_0x3146f3[_0xbbc2('0xdd')],'VoiceQueueId':_0x3146f3['VoiceQueueId']||undefined,'CampaignId':_0x3146f3[_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x194')));}break;case 0xa:if(_0x3146f3[_0xbbc2('0xd2')]>=_0x586f60[_0xbbc2('0xd7')]-0x1){return!![];}hopperUtils[_0xbbc2('0xd9')]({'active':![],'countdropretry':_0x3146f3[_0xbbc2('0xd2')]+=0x1,'scheduledat':moment()[_0xbbc2('0xda')](_0x586f60['dialDropRetryFrequency'],_0xbbc2('0xdb'))[_0xbbc2('0x47')](_0xbbc2('0xc3')),'ContactId':_0x3146f3[_0xbbc2('0xdc')],'ListId':_0x3146f3['ListId'],'VoiceQueueId':_0x3146f3[_0xbbc2('0xde')]||undefined,'CampaignId':_0x3146f3[_0xbbc2('0xe9')]||undefined})['catch'](loggerCatch(_0xbbc2('0xdf')));break;case 0xb:if(_0x3146f3['countabandonedretry']>=_0x586f60['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3146f3[_0xbbc2('0xe4')]+=0x1,'scheduledat':moment()[_0xbbc2('0xda')](_0x586f60['dialAbandonedRetryFrequency'],_0xbbc2('0xdb'))[_0xbbc2('0x47')](_0xbbc2('0xc3')),'ContactId':_0x3146f3[_0xbbc2('0xdc')],'ListId':_0x3146f3[_0xbbc2('0xdd')],'VoiceQueueId':_0x3146f3[_0xbbc2('0xde')]||undefined,'CampaignId':_0x3146f3['CampaignId']||undefined})[_0xbbc2('0xa1')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3146f3[_0xbbc2('0x11f')]>=_0x586f60['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xbbc2('0xd9')]({'active':![],'countmachineretry':_0x3146f3[_0xbbc2('0x11f')]+=0x1,'scheduledat':moment()[_0xbbc2('0xda')](_0x586f60[_0xbbc2('0x127')],_0xbbc2('0xdb'))[_0xbbc2('0x47')](_0xbbc2('0xc3')),'ContactId':_0x3146f3[_0xbbc2('0xdc')],'ListId':_0x3146f3['ListId'],'VoiceQueueId':_0x3146f3['VoiceQueueId']||undefined,'CampaignId':_0x3146f3[_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x12c')));break;case 0x14:if(_0x3146f3[_0xbbc2('0x120')]>=_0x586f60[_0xbbc2('0x195')]-0x1){return!![];}hopperUtils[_0xbbc2('0xd9')]({'active':![],'countagentrejectretry':_0x3146f3[_0xbbc2('0x120')]+=0x1,'scheduledat':moment()[_0xbbc2('0xda')](_0x586f60['dialAgentRejectRetryFrequency'],_0xbbc2('0xdb'))[_0xbbc2('0x47')](_0xbbc2('0xc3')),'ContactId':_0x3146f3['ContactId'],'ListId':_0x3146f3['ListId'],'VoiceQueueId':_0x3146f3[_0xbbc2('0xde')]||undefined,'CampaignId':_0x3146f3[_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xbbc2('0x109')]=function(_0x43ee4c,_0x2f0742,_0x44a8c4){var _0xaf5155=this;var _0x305f32=new History(_0x43ee4c);var _0x37f910=![];var _0x2ceb7a;var _0x144a99;return new Promise(function(_0x5a4be9,_0x4f23b6){if(_[_0xbbc2('0x56')](_0x2f0742)&&typeof _0x2f0742!==_0xbbc2('0x15d')){return _0x4f23b6(msgResponse(_0xbbc2('0x196'),_0xbbc2('0x91'),_0xbbc2('0x197')));}if(_[_0xbbc2('0x56')](_0x44a8c4)&&typeof _0x44a8c4!=='object'){return _0x4f23b6(msgResponse(_0xbbc2('0x196'),_0xbbc2('0x91'),_0xbbc2('0x198')));}hopperUtils[_0xbbc2('0xd6')](_0x305f32,_0x44a8c4['reason'],_0x2f0742)[_0xbbc2('0x40')](function(_0x729422){if(_0x729422['additional']==0x1)_0x37f910=!![];switch(_0x44a8c4['reason']){case'0':_0x2f0742[_0xbbc2('0x199')]+=0x1;_0x305f32[_0xbbc2('0x6f')]=0x0;_0x305f32[_0xbbc2('0x70')]=_0xbbc2('0x19a');_0x305f32[_0xbbc2('0x11e')]+=0x1;_0x305f32['countglobal']+=0x1;ami[_0xbbc2('0x42')](_0xbbc2('0x19b'),ut[_0xbbc2('0x114')](_0x43ee4c,'nosuchnumber'));_0x2ceb7a=_0x2f0742['dialNoSuchNumberRetryFrequency'];_0x144a99=_0x2f0742[_0xbbc2('0xd5')];hopperUtils['createHistory'](_0x305f32)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x11b')));if(_0xaf5155[_0xbbc2('0x18a')](0x0,_0x43ee4c,_0x2f0742)&&!_0x37f910){if(_0x305f32[_0xbbc2('0x11e')]>=_0x2f0742[_0xbbc2('0x192')]){_0xaf5155[_0xbbc2('0x125')](_0x305f32,_0x5a4be9,_0x4f23b6,_0xbbc2('0x19c'));}else{_0xaf5155[_0xbbc2('0x122')](_0x305f32,_0x5a4be9,_0x4f23b6,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2f0742[_0xbbc2('0x19d')]+=0x1;_0x305f32[_0xbbc2('0x6f')]=0x3;_0x305f32[_0xbbc2('0x70')]='NoAnswer';_0x305f32[_0xbbc2('0x11d')]+=0x1;_0x305f32[_0xbbc2('0xd3')]+=0x1;var _0x385850=ut[_0xbbc2('0x19e')](_0x43ee4c,_0x2f0742);ami[_0xbbc2('0x42')]('custom:agentnoanswer',_0x385850);_0x2ceb7a=_0x2f0742[_0xbbc2('0x19f')];_0x144a99=_0x2f0742['callAdditionalPhoneAfterMin'];hopperUtils[_0xbbc2('0xca')](_0x305f32)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0xaf5155[_0xbbc2('0x18a')](0x3,_0x43ee4c,_0x2f0742)&&!_0x37f910){if(_0x305f32['countnoanswerretry']>=_0x2f0742['dialNoAnswerMaxRetry']){_0xaf5155['createStateFinal'](_0x305f32,_0x5a4be9,_0x4f23b6,_0xbbc2('0x1a0'));}else{_0xaf5155['stateGlobal'](_0x305f32,_0x5a4be9,_0x4f23b6,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2f0742[_0xbbc2('0x1a1')]+=0x1;_0x305f32[_0xbbc2('0x6f')]=0x5;_0x305f32[_0xbbc2('0x70')]=_0xbbc2('0x1a2');_0x305f32['countbusyretry']+=0x1;_0x305f32[_0xbbc2('0xd3')]+=0x1;ami[_0xbbc2('0x42')]('custom:agentbusy',ut[_0xbbc2('0x114')](_0x43ee4c,_0xbbc2('0x1a3')));_0x2ceb7a=_0x2f0742['dialBusyRetryFrequency'];_0x144a99=_0x2f0742[_0xbbc2('0xd5')];hopperUtils[_0xbbc2('0xca')](_0x305f32)[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x1a4')));if(_0xaf5155['checkRetriveMax'](0x5,_0x43ee4c,_0x2f0742)&&!_0x37f910){if(_0x305f32[_0xbbc2('0x11c')]>=_0x2f0742['dialBusyMaxRetry']){_0xaf5155[_0xbbc2('0x125')](_0x305f32,_0x5a4be9,_0x4f23b6,'reason\x205\x20busy');}else{_0xaf5155['stateGlobal'](_0x305f32,_0x5a4be9,_0x4f23b6,_0xbbc2('0x1a5'));}}break;case'8':_0x2f0742['outboundCongestionCallsDay']+=0x1;_0x305f32[_0xbbc2('0x6f')]=0x8;_0x305f32['statedesc']=_0xbbc2('0x1a6');_0x305f32[_0xbbc2('0x12b')]+=0x1;_0x305f32[_0xbbc2('0xd3')]+=0x1;_0x2ceb7a=_0x2f0742[_0xbbc2('0x190')];_0x144a99=_0x2f0742[_0xbbc2('0xd5')];ami[_0xbbc2('0x42')](_0xbbc2('0x1a7'),ut[_0xbbc2('0x114')](_0x43ee4c,_0xbbc2('0x1a8')));hopperUtils['createHistory'](_0x305f32)[_0xbbc2('0xa1')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xaf5155[_0xbbc2('0x18a')](0x8,_0x43ee4c,_0x2f0742)&&!_0x37f910){if(_0x305f32['countcongestionretry']>=_0x2f0742[_0xbbc2('0x1a9')]){_0xaf5155[_0xbbc2('0x125')](_0x305f32,_0x5a4be9,_0x4f23b6,_0xbbc2('0x1aa'));}else{_0xaf5155['stateGlobal'](_0x305f32,_0x5a4be9,_0x4f23b6,_0xbbc2('0x1aa'));}}break;case'11':_0x2f0742[_0xbbc2('0x1ab')]+=0x1;_0x305f32[_0xbbc2('0x6f')]=0xb;_0x305f32[_0xbbc2('0x70')]=_0xbbc2('0xeb');_0x305f32[_0xbbc2('0xe4')]+=0x1;_0x305f32['countglobal']+=0x1;_0x2ceb7a=_0x2f0742[_0xbbc2('0xe5')];_0x144a99=_0x2f0742[_0xbbc2('0xd5')];hopperUtils[_0xbbc2('0xca')](_0x305f32)[_0xbbc2('0xa1')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0xaf5155['checkRetriveMax'](0xb,_0x43ee4c,_0x2f0742)&&!_0x37f910){if(_0x305f32[_0xbbc2('0xe4')]>=_0x2f0742[_0xbbc2('0xe7')]){_0xaf5155[_0xbbc2('0x125')](_0x305f32,_0x5a4be9,_0x4f23b6,_0xbbc2('0x1ac'));}else{_0xaf5155[_0xbbc2('0x122')](_0x305f32,_0x5a4be9,_0x4f23b6,_0xbbc2('0x1ac'));}}break;case'20':_0x2f0742['outboundRejectCallsDay']+=0x1;_0x305f32[_0xbbc2('0x6f')]=0x14;_0x305f32[_0xbbc2('0x70')]='AgentReject';_0x305f32[_0xbbc2('0x120')]+=0x1;_0x305f32[_0xbbc2('0xd3')]+=0x1;_0x2ceb7a=_0x2f0742[_0xbbc2('0x1ad')];_0x144a99=_0x2f0742[_0xbbc2('0xd5')];ami['emit'](_0xbbc2('0x1ae'),ut[_0xbbc2('0x114')](_0x43ee4c,_0xbbc2('0x1af')));hopperUtils[_0xbbc2('0xca')](_0x305f32)[_0xbbc2('0xa1')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xaf5155[_0xbbc2('0x18a')](0x14,_0x43ee4c,_0x2f0742)&&!_0x37f910){if(_0x305f32[_0xbbc2('0x120')]>=_0x2f0742[_0xbbc2('0x195')]){_0xaf5155[_0xbbc2('0x125')](_0x305f32,_0x5a4be9,_0x4f23b6,'reason\x2020\x20agentreject');}else{_0xaf5155[_0xbbc2('0x122')](_0x305f32,_0x5a4be9,_0x4f23b6,'reason\x2020\x20agentreject');}}break;default:_0x2f0742[_0xbbc2('0x1b0')]+=0x1;_0x305f32[_0xbbc2('0x6f')]=0xc;_0x305f32['statedesc']=_0x44a8c4[_0xbbc2('0xc6')];_0x2ceb7a=_0x2f0742[_0xbbc2('0x1ad')];_0x144a99=_0x2f0742[_0xbbc2('0xd5')];hopperUtils[_0xbbc2('0xca')](_0x305f32)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0xaf5155['checkRetriveMax'](_0x44a8c4[_0xbbc2('0xc6')],_0x43ee4c,_0x2f0742)&&!_0x37f910){if(_0x305f32['countbusyretry']+_0x305f32[_0xbbc2('0x12b')]+_0x305f32[_0xbbc2('0x11d')]+_0x305f32['countnosuchnumberretry']+_0x305f32[_0xbbc2('0xd2')]+_0x305f32[_0xbbc2('0xe4')]+_0x305f32[_0xbbc2('0x11f')]+_0x305f32[_0xbbc2('0x120')]>=_0x2f0742[_0xbbc2('0x121')]){_0xaf5155[_0xbbc2('0x122')](_0x305f32,_0x5a4be9,_0x4f23b6,_0x44a8c4[_0xbbc2('0xc6')]);}else{_0xaf5155[_0xbbc2('0x125')](_0x305f32,_0x5a4be9,_0x4f23b6,_0x44a8c4[_0xbbc2('0xc6')]);}}}})[_0xbbc2('0x40')](function(){if(_0x37f910){hopperUtils[_0xbbc2('0xe2')](_0x305f32,_0x2ceb7a,_0x144a99)[_0xbbc2('0x40')](function(){return _0x5a4be9(0x1);});}});});};Dialer[_0xbbc2('0x1a')]['stateGlobal']=function(_0x3418fe,_0x4066b8,_0x3c2176,_0x3659a9){var _0x591712=new Final(_0x3418fe);_0x591712['state']=0xf;_0x591712[_0xbbc2('0x70')]=_0xbbc2('0x1b1');this[_0xbbc2('0x125')](_0x591712,_0x4066b8,_0x3c2176,_0x3659a9);};Dialer['prototype'][_0xbbc2('0x125')]=function(_0x140018,_0x3a33b8,_0x414a13,_0x43252c){hopperUtils['moveContactManagedDialer'](_0x140018)[_0xbbc2('0x40')](function(){return _0x3a33b8(msgResponse(_0xbbc2('0x196'),_0xbbc2('0x108'),_0x43252c));})[_0xbbc2('0xa1')](function(){return _0x414a13(msgResponse(_0xbbc2('0x1b2'),_0xbbc2('0x91'),'contact\x20not\x20moved'));});};Dialer[_0xbbc2('0x1a')][_0xbbc2('0xc')]=function(_0x496854){var _0x4989fc=_0x496854[_0xbbc2('0x1b3')]/0x64;var _0x514653=_0x496854['outboundDropCallsDayTimeout']/(_0x496854[_0xbbc2('0x1b4')]+_0x496854[_0xbbc2('0xc5')]);var _0x179645=Math['round'](_0x496854[_0xbbc2('0x1b5')]*(_0x496854[_0xbbc2('0x1b6')]/0x64));var _0x4d7d18=Math[_0xbbc2('0x1b7')](_0x496854[_0xbbc2('0x1b5')]*(_0x496854[_0xbbc2('0x1b8')]/0x64));var _0x2498e6=_0x496854[_0xbbc2('0x137')]+_0x496854['talking'];var _0x58fa0c=Math[_0xbbc2('0x1b9')](_0x496854[_0xbbc2('0x5b')]*_0x496854[_0xbbc2('0x5e')]*_0x496854['predictiveIntervalHitRate']*_0x496854[_0xbbc2('0x1ba')]);if(_['isUndefined'](_0x496854[_0xbbc2('0x2b')])){if(!_[_0xbbc2('0x56')](_0x496854['startPredictive'])){_0x496854[_0xbbc2('0x2a')]=undefined;loggerPredictive[_0xbbc2('0x64')]('[startMethodPredictive][StartProgressive]',_0xbbc2('0x1bb'));}if(!_['isUndefined'](_0x496854[_0xbbc2('0x63')])){loggerPredictive[_0xbbc2('0x64')](_0xbbc2('0x1bc'),_0xbbc2('0x1bd'));clearInterval(_0x496854[_0xbbc2('0x63')]);_0x496854[_0xbbc2('0x63')]=undefined;}_0x496854['startProgressive']=moment()['format'](_0xbbc2('0xc3'));loggerPredictive[_0xbbc2('0x4b')](_0x496854[_0xbbc2('0x49')],_0xbbc2('0x1be'),_0x496854[_0xbbc2('0x2b')]);this[_0xbbc2('0xb5')](_0x496854,0x1);}else if(ifInterval(_0x496854[_0xbbc2('0x1bf')],_0x496854[_0xbbc2('0x2b')])){this[_0xbbc2('0xb5')](_0x496854,0x1);loggerPredictiveCalls[_0xbbc2('0x4b')](_0xbbc2('0x1c0'),_0x496854[_0xbbc2('0x2b')],_0x496854[_0xbbc2('0x49')]);_0x496854['erlangCalls']=0x0;_0x496854[_0xbbc2('0xcf')]=0x0;}else if(_0x4989fc<_0x514653&&_0x496854[_0xbbc2('0x1c1')]===_0xbbc2('0x1c2')){clearPredictiveAttributes(_0x496854);loggerPredictive['info'](_0xbbc2('0x1c3'),_0xbbc2('0x1c4'),_0x514653,_0xbbc2('0x2b'),_0x496854[_0xbbc2('0x49')]);}else if(_0x58fa0c<_0x496854[_0xbbc2('0xcf')]&&_0x496854[_0xbbc2('0x1c1')]==='dropRate'){clearPredictiveAttributes(_0x496854);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x1c5'),'Max\x20Drop\x20',_0x58fa0c,_0xbbc2('0x1c6'),_0x496854[_0xbbc2('0xcf')],_0xbbc2('0x2b'),_0x496854[_0xbbc2('0x49')]);}else if(!ifInterval(_0x496854[_0xbbc2('0x1bf')],_0x496854[_0xbbc2('0x2b')])&&_[_0xbbc2('0x56')](_0x496854[_0xbbc2('0x2a')])&&!_[_0xbbc2('0x56')](_0x496854[_0xbbc2('0x2b')])){_0x496854[_0xbbc2('0x2a')]=moment()[_0xbbc2('0x47')](_0xbbc2('0xc3'));loggerPredictive[_0xbbc2('0x4b')](_0x496854[_0xbbc2('0x49')],'started\x20in\x20predictive\x20at',_0x496854['startPredictive']);hopperUtils[_0xbbc2('0x1c7')](_0x496854[_0xbbc2('0x1bf')])['then'](this['getDataPredictive'](_0x496854))['then'](mergeDataErlangB(_0x496854))[_0xbbc2('0x40')](this[_0xbbc2('0x1c8')](_0x496854))[_0xbbc2('0xa1')](loggerCatchPredictive(_0xbbc2('0x1c9'),_0x496854));}else if(!ifInterval(_0x496854['dialPredictiveInterval'],_0x496854[_0xbbc2('0x2a')])){_0x496854['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x496854[_0xbbc2('0x2a')]=moment()[_0xbbc2('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xbbc2('0x4b')](_0x496854['name'],_0xbbc2('0x1ca'),_0x496854[_0xbbc2('0x2a')]);clearInterval(_0x496854['handlePredictive']);_0x496854[_0xbbc2('0x63')]=undefined;hopperUtils['avgHandleTime'](_0x496854[_0xbbc2('0x1bf')])[_0xbbc2('0x40')](this['getDataPredictive'](_0x496854))[_0xbbc2('0x40')](mergeDataErlangB(_0x496854))[_0xbbc2('0x40')](this[_0xbbc2('0x1c8')](_0x496854))[_0xbbc2('0xa1')](loggerCatchPredictive(_0xbbc2('0x1cb'),_0x496854));}else if(_0x496854[_0xbbc2('0x1b5')]&&_0x2498e6<_0x496854[_0xbbc2('0x1b5')]-_0x4d7d18){clearPredictiveAttributes(_0x496854);loggerPredictive['info'](_0x496854[_0xbbc2('0x49')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2498e6,_0xbbc2('0x1cc'),_0x496854[_0xbbc2('0x1b5')],'-',_0x4d7d18,'=',_0x496854[_0xbbc2('0x1b5')]-_0x4d7d18,')');}else if(_0x496854[_0xbbc2('0x1b5')]&&_0x2498e6>_0x496854[_0xbbc2('0x1b5')]+_0x179645){clearPredictiveAttributes(_0x496854);loggerPredictive[_0xbbc2('0x4b')](_0x496854[_0xbbc2('0x49')],_0xbbc2('0x1cd'),_0x2498e6,_0xbbc2('0x1ce'),_0x496854[_0xbbc2('0x1b5')],'+',_0x179645,'=',_0x496854[_0xbbc2('0x1b5')]+_0x179645,')');}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x1cf')]=function(_0x5a8aed){var _0x4c2408=this;return function(_0xc982){return new Promise(function(_0x325010,_0x1ec551){_[_0xbbc2('0x60')](_0x5a8aed,_0xc982[0x0]);if(checkGetDataPredictive(_0xc982[0x0])){var _0x4425fc=_0x5a8aed[_0xbbc2('0x1b5')]=_0x5a8aed[_0xbbc2('0x139')]+_0x5a8aed['available'];var _0x1c96d1=_0x5a8aed['dialPredictiveInterval']*0x3c;var _0x42061b=_0xc982[0x0][_0xbbc2('0x54')]+_0xc982[0x0][_0xbbc2('0x53')];var _0xf1d84e=(_0xc982[0x0][_0xbbc2('0x1d0')]+_0xc982[0x0][_0xbbc2('0x50')]+_0xc982[0x0][_0xbbc2('0x52')])/_0xc982[0x0][_0xbbc2('0x4d')];_0x5a8aed[_0xbbc2('0x1d1')]=_0xf1d84e>0x0?_0xf1d84e:0x1;switch(_0x5a8aed[_0xbbc2('0x1c1')]){case'dropRate':var _0x39bf95=_0x5a8aed[_0xbbc2('0x1b3')]/0x64;return _0x4c2408[_0xbbc2('0x1d2')](_0x4425fc,_0x1c96d1,_0x42061b,_0xf1d84e,_0x39bf95)['then'](function(_0xf63b47){return _0x325010(_0xf63b47);});case _0xbbc2('0x1d3'):var _0x43decf=_0x5a8aed[_0xbbc2('0x1b3')]/0x64;return _0x4c2408[_0xbbc2('0x1d4')](_0x4425fc,_0x1c96d1,_0x42061b,_0xf1d84e,_0x43decf)[_0xbbc2('0x40')](function(_0x16c606){return _0x325010(_0x16c606);});default:return _0x1ec551(msgResponse(_0xbbc2('0x1d5'),_0xbbc2('0x91'),_0xbbc2('0x1d6')));}}else{return _0x1ec551(msgResponse(_0xbbc2('0x1d5'),'Failure','check\x20failure'));}});};};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x1d7')]=function(_0x12ec03){var _0x3df1f8=this;return function(_0x4fa332){return new Promise(function(_0x338dc8,_0x307bf4){_[_0xbbc2('0x60')](_0x12ec03,_0x4fa332[0x0]);if(checkGetDataPredictive(_0x4fa332[0x0])){loggerPredictive[_0xbbc2('0x4b')](JSON[_0xbbc2('0x75')](_0x4fa332[0x0]));if(_0x12ec03[_0xbbc2('0x1c1')]===_0xbbc2('0x1c2')){return _0x3df1f8[_0xbbc2('0x152')](_0x12ec03['id'])['then'](function(_0x1ad30b){var _0x47aedb=_0x12ec03[_0xbbc2('0x1d8')]-_0x1ad30b[0x0][_0xbbc2('0x1d9')];var _0xe108e1=_0x12ec03[_0xbbc2('0x1bf')]*0x3c;var _0x4d8c30=_0x4fa332[0x0][_0xbbc2('0x54')]+_0x4fa332[0x0][_0xbbc2('0x53')];var _0x532aae=(_0x4fa332[0x0][_0xbbc2('0x1d0')]+_0x4fa332[0x0][_0xbbc2('0x50')]+_0x4fa332[0x0][_0xbbc2('0x52')])/_0x4fa332[0x0][_0xbbc2('0x4d')];var _0x17e51e=_0x12ec03['dialPredictiveOptimizationPercentage']/0x64;_0x12ec03['predictiveIntervalPauses']=_0x1ad30b[0x0][_0xbbc2('0x1d9')]||0x0;_0x12ec03[_0xbbc2('0x1d1')]=_0x532aae>0x0?_0x532aae:0x1;return _0x3df1f8[_0xbbc2('0x1d2')](_0x47aedb,_0xe108e1,_0x4d8c30,_0x532aae,_0x17e51e);})[_0xbbc2('0x40')](function(_0x3993f8){return _0x338dc8(_0x3993f8);})[_0xbbc2('0xa1')](function(_0x12dd47){return _0x307bf4(msgResponse(_0xbbc2('0x1da'),'Failure',JSON[_0xbbc2('0x75')](_0x12dd47)));});}if(_0x12ec03[_0xbbc2('0x1c1')]===_0xbbc2('0x1d3')){return _0x3df1f8[_0xbbc2('0x152')](_0x12ec03['id'])[_0xbbc2('0x40')](function(_0x9e9f2d){var _0xff52e4=_0x12ec03[_0xbbc2('0x1d8')]-_0x9e9f2d[0x0][_0xbbc2('0x1d9')];var _0x2bf2c4=_0x12ec03['dialPredictiveInterval']*0x3c;var _0x1fc1c0=_0x4fa332[0x0][_0xbbc2('0x54')]+_0x4fa332[0x0][_0xbbc2('0x53')];var _0x34e637=(_0x4fa332[0x0][_0xbbc2('0x1d0')]+_0x4fa332[0x0][_0xbbc2('0x50')]+_0x4fa332[0x0][_0xbbc2('0x52')])/_0x4fa332[0x0][_0xbbc2('0x4d')];var _0x2f1f48=_0x12ec03[_0xbbc2('0x1b3')]/0x64;_0x12ec03[_0xbbc2('0x1db')]=_0x9e9f2d[0x0][_0xbbc2('0x1d9')]||0x0;_0x12ec03['predictiveIntervalHitRate']=_0x34e637>0x0?_0x34e637:0x1;return _0x3df1f8[_0xbbc2('0x1d4')](_0xff52e4,_0x2bf2c4,_0x1fc1c0,_0x34e637,_0x2f1f48);})[_0xbbc2('0x40')](function(_0x1af033){return _0x338dc8(_0x1af033);})[_0xbbc2('0xa1')](function(_0x33f831){return _0x307bf4(msgResponse(_0xbbc2('0x1da'),_0xbbc2('0x91'),JSON[_0xbbc2('0x75')](_0x33f831)));});}}else{return _0x307bf4(msgResponse('[getDataPredictive]',_0xbbc2('0x91'),_0xbbc2('0x1dc')));}});};};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x1c8')]=function(_0x3071c4){var _0x2b3a4e=this;return function(){var _0x5c3544=0x0;var _0x4cbf87=Math[_0xbbc2('0x1b9')](_0x3071c4['erlangCallToSecond']*0x3e8);if(_0x4cbf87>0x0){_0x4cbf87=_0x4cbf87<0x64?0x64:_0x4cbf87;loggerPredictive[_0xbbc2('0x4b')](_0x3071c4['name'],_0xbbc2('0x1dd'),_0x4cbf87,'milliseconds');_0x3071c4['handlePredictive']=setInterval(function(){_0x2b3a4e['handlePredictive'](_0x3071c4);loggerPredictiveCalls[_0xbbc2('0x4b')](_0xbbc2('0x1de'),_0x5c3544+=0x1);},_0x4cbf87);}else{loggerPredictive[_0xbbc2('0x4b')](_0x3071c4['name'],_0xbbc2('0x1df'));}};};Dialer[_0xbbc2('0x1a')]['checkContactBlack']=function(_0x384d51,_0xfba033){var _0x2d4a18=this;return function(_0x30cc98){if(_[_0xbbc2('0x4a')](_0x30cc98)){if(_[_0xbbc2('0xf2')](_0xfba033[_0xbbc2('0x158')])||!_0xfba033['recallme']){if(_0x384d51[_0xbbc2('0xb3')]==='booked'){_0x384d51[_0xbbc2('0x72')]=_[_0xbbc2('0x56')](_0x384d51[_0xbbc2('0x72')])?!![]:_0x384d51[_0xbbc2('0x72')];var _0x39be3f=uuid['v4']();_0x2d4a18[_0xbbc2('0x26')][_0x39be3f]=new Action(_0x384d51,_0xfba033,_0x39be3f);loggerBooked['info'](_0xbbc2('0x1e0'),_0x39be3f,_0xbbc2('0x1e1'),JSON[_0xbbc2('0x75')](_0x384d51[_0xbbc2('0x72')]),'Queue:\x20',_0x384d51['name']);if(_0x384d51[_0xbbc2('0x72')]){_0x384d51[_0xbbc2('0x72')]=![];_0x2d4a18[_0xbbc2('0x2d')][_0x2d4a18['actions'][_0x39be3f][_0xbbc2('0xbe')]]=[];ami['Action']({'actionid':_0x39be3f,'action':_0xbbc2('0x1e2'),'queue':_0x384d51[_0xbbc2('0x49')]})[_0xbbc2('0xa1')](function(){_0x2d4a18[_0xbbc2('0xc1')](_0x384d51);hopperUtils[_0xbbc2('0xd9')]({'active':![],'ContactId':_0x2d4a18[_0xbbc2('0x26')][_0x39be3f][_0xbbc2('0xdc')],'ListId':_0x2d4a18[_0xbbc2('0x26')][_0x39be3f][_0xbbc2('0xdd')],'VoiceQueueId':_0x2d4a18[_0xbbc2('0x26')][_0x39be3f][_0xbbc2('0xde')]||undefined,'CampaignId':_0x2d4a18[_0xbbc2('0x26')][_0x39be3f][_0xbbc2('0xe9')]||undefined})['catch'](loggerCatch(_0xbbc2('0x1e3')));delete _0x2d4a18[_0xbbc2('0x26')][_0x39be3f];});}else{loggerBooked['info'](_0xbbc2('0x1e4'),JSON[_0xbbc2('0x75')](_0x384d51[_0xbbc2('0x72')]),_0xbbc2('0x1e5'),_0x384d51['name']);_0x2d4a18['updateOriginated'](_0x384d51);hopperUtils[_0xbbc2('0xd9')]({'active':![],'ContactId':_0x2d4a18['actions'][_0x39be3f][_0xbbc2('0xdc')],'ListId':_0x2d4a18['actions'][_0x39be3f]['ListId'],'VoiceQueueId':_0x2d4a18[_0xbbc2('0x26')][_0x39be3f][_0xbbc2('0xde')]||undefined,'CampaignId':_0x2d4a18['actions'][_0x39be3f][_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x1e3')));delete _0x2d4a18[_0xbbc2('0x26')][_0x39be3f];}}else{return _0x2d4a18[_0xbbc2('0x1e6')](_0x384d51,_0xfba033);}}else{if(utils[_0xbbc2('0x61')](undefined,_0xfba033[_0xbbc2('0x1e7')])<_0x384d51['dialRecallMeTimeout']*0x3c){if(_0xfba033[_0xbbc2('0x15b')]&&!_0xfba033[_0xbbc2('0x15b')][_0xbbc2('0x1e8')]){_0x2d4a18[_0xbbc2('0x1f')]['run'](_0xfba033['id'])['finally'](function(){_0x2d4a18['updateOriginated'](_0x384d51);});}else{hopperUtils[_0xbbc2('0x1e9')]({'active':![]},_0xfba033['id'],0x1)[_0xbbc2('0x1d')](function(){_0x2d4a18[_0xbbc2('0xc1')](_0x384d51);});}}else{_0x384d51['outboundReCallsDay']+=0x1;_0x2d4a18[_0xbbc2('0xc1')](_0x384d51);if(_0x384d51[_0xbbc2('0x1ea')]){hopperUtils[_0xbbc2('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xfba033['ContactId'],'ListId':_0xfba033[_0xbbc2('0xdd')],'VoiceQueueId':_0xfba033[_0xbbc2('0xde')]||undefined,'CampaignId':_0xfba033[_0xbbc2('0xe9')]||undefined})[_0xbbc2('0xa1')](loggerCatch(_0xbbc2('0x1eb')));hopperUtils[_0xbbc2('0xca')](createObjHistory(_0x384d51,_0xfba033,utils['CAMPAIGN_STATUS'][_0xbbc2('0x1ec')],0x17,_0xbbc2('0x1ed')))['catch'](loggerCatch(_0xbbc2('0x1ee')));}else{_0x2d4a18[_0xbbc2('0x115')](createObjHistory(_0x384d51,_0xfba033,utils[_0xbbc2('0x69')][_0xbbc2('0x1ef')],0x16,_0xbbc2('0x1f0')),_0xbbc2('0x1f1'),_0xbbc2('0x1f2'));}}}}else{_0x384d51[_0xbbc2('0x1f3')]+=0x1;_0x2d4a18[_0xbbc2('0x115')](createObjHistory(_0x384d51,_0xfba033,utils[_0xbbc2('0x69')][_0xbbc2('0x1f4')],0xd,_0xbbc2('0x1f5')),'[Originate][historyBlacklist]',_0xbbc2('0x1f6'));throw'inBlackList';}};};Dialer['prototype'][_0xbbc2('0x15c')]=function(_0x18c850){var _0x27a72e=this;var _0x158c15=_0x18c850[_0xbbc2('0x1f7')]-_0x18c850[_0xbbc2('0x154')];emitCampaignSummary(_0x18c850);if(_0x158c15>0x0&&_0x18c850[_0xbbc2('0x1f8')]==0x0){if(_0x158c15>this[_0xbbc2('0x24')]){_0x158c15=this[_0xbbc2('0x24')];}_0x18c850[_0xbbc2('0x1f8')]=0x1;hopperUtils[_0xbbc2('0x1f9')](_0x18c850,_0x158c15)[_0xbbc2('0x40')](function(_0x94facd){_0x18c850[_0xbbc2('0x1f8')]=0x0;if(_0x94facd){if(!utils[_0xbbc2('0x1fa')](_0x94facd)){_0x18c850[_0xbbc2('0x68')]=utils[_0xbbc2('0x69')][_0xbbc2('0x6d')];logger['info']('[getContactCampaign2][Empty]'+_0x18c850[_0xbbc2('0x49')]);}else{_0x18c850[_0xbbc2('0x154')]+=_0x94facd[_0xbbc2('0x98')];_0x18c850[_0xbbc2('0x68')]=utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x9612b7=0x0;_0x9612b7<_0x94facd[_0xbbc2('0x98')];_0x9612b7+=0x1){_0x18c850[_0xbbc2('0x1fb')]+=0x1;if(_['isNil'](_0x94facd[_0x9612b7])||_[_0xbbc2('0xf2')](_0x94facd[_0x9612b7]['Contact'])||_[_0xbbc2('0xf2')](_0x94facd[_0x9612b7]['phone'])){_0x27a72e[_0xbbc2('0x156')](_0xbbc2('0x1fc'),_0x18c850,_0x94facd[_0x9612b7]);}else{hopperUtils[_0xbbc2('0x1fd')](_['pick'](_0x94facd[_0x9612b7],[_0xbbc2('0xe9'),_0xbbc2('0x15f')]))[_0xbbc2('0x40')](_0x27a72e[_0xbbc2('0x1fe')](_0x18c850,_0x94facd[_0x9612b7]))[_0xbbc2('0xa1')](_0x27a72e[_0xbbc2('0x1ff')]('[actionOriginateIvr]\x20',_0x18c850));}}}}})['catch'](loggerGetContactDialer(_0xbbc2('0x200'),_0x18c850,_0x158c15));}};Dialer[_0xbbc2('0x1a')][_0xbbc2('0xb5')]=function(_0x3d4605,_0x3bfe5b){var _0x1f340a=this;var _0x195352=[];if(_0x3bfe5b<0x1||_0x3d4605[_0xbbc2('0xb3')]===_0xbbc2('0xb')){_0x3bfe5b=0x1;}var _0xf0346=Math[_0xbbc2('0x1b9')](_0x3d4605[_0xbbc2('0x137')]*_0x3bfe5b)-_0x3d4605['originated'];if(_0x3d4605[_0xbbc2('0x201')]>0x0){var _0x7eb82b=_0x3d4605[_0xbbc2('0x201')]-_0x3d4605[_0xbbc2('0x154')]-_0x3d4605[_0xbbc2('0x139')]-_0x3d4605[_0xbbc2('0x13a')];if(_0xf0346>_0x7eb82b){_0xf0346=_0x7eb82b;}}if(_0xf0346>0x0&&_0x3d4605[_0xbbc2('0x1f8')]==0x0){if(_0x3d4605[_0xbbc2('0xb3')]===_0xbbc2('0xb')){_0xf0346=0x1;}if(_0xf0346>this['maxNumberOriginate']){_0xf0346=this[_0xbbc2('0x24')];}for(var _0x433fc8 in this[_0xbbc2('0x22')]){if(typeof this[_0xbbc2('0x22')][_0x433fc8]!==_0xbbc2('0x14f')){if(this[_0xbbc2('0x22')][_0x433fc8][_0xbbc2('0x6f')]===_0xbbc2('0x202')&&this[_0xbbc2('0x22')][_0x433fc8][_0xbbc2('0x89')]===_0xbbc2('0x145')){_0x195352['push'](this[_0xbbc2('0x22')][_0x433fc8]['id']);}}}_0x3d4605[_0xbbc2('0x1f8')]=0x1;hopperUtils[_0xbbc2('0x203')](_0x3d4605,_0x195352,_0xf0346)[_0xbbc2('0x40')](function(_0x25e2ed){_0x3d4605[_0xbbc2('0x1f8')]=0x0;if(_0x25e2ed){if(!utils[_0xbbc2('0x1fa')](_0x25e2ed)){hopperUtils['countReScheduled'](_0x3d4605)[_0xbbc2('0x40')](sendMessageReschedule(_0x3d4605))[_0xbbc2('0xa1')](loggerCatch('[countReScheduled]\x20'));}else{_0x3d4605[_0xbbc2('0x154')]+=_0x25e2ed[_0xbbc2('0x98')];_0x3d4605[_0xbbc2('0x68')]=_0x3d4605[_0xbbc2('0xb3')]===_0xbbc2('0xb')?utils[_0xbbc2('0x69')][_0xbbc2('0x13b')]:utils['CAMPAIGN_STATUS'][_0xbbc2('0x204')];for(var _0x58d1de=0x0;_0x58d1de<_0x25e2ed[_0xbbc2('0x98')];_0x58d1de+=0x1){if(_['isNil'](_0x25e2ed[_0x58d1de])||_[_0xbbc2('0xf2')](_0x25e2ed[_0x58d1de][_0xbbc2('0x176')])||_[_0xbbc2('0xf2')](_0x25e2ed[_0x58d1de]['phone'])){_0x1f340a[_0xbbc2('0x156')](_0xbbc2('0x1fc'),_0x3d4605,_0x25e2ed[_0x58d1de]);}else{hopperUtils[_0xbbc2('0x205')](_['pick'](_0x25e2ed[_0x58d1de],[_0xbbc2('0xde'),_0xbbc2('0x15f')]))[_0xbbc2('0x40')](_0x1f340a[_0xbbc2('0x1fe')](_0x3d4605,_0x25e2ed[_0x58d1de]))[_0xbbc2('0xa1')](_0x1f340a[_0xbbc2('0x1ff')](_0xbbc2('0x1fc'),_0x3d4605));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x3d4605,_0xf0346));}};Dialer[_0xbbc2('0x1a')]['handlePredictive']=function(_0x978adf){if(_0x978adf[_0xbbc2('0x201')]>0x0){var _0x30280=_0x978adf[_0xbbc2('0x201')]-_0x978adf[_0xbbc2('0x154')]-_0x978adf[_0xbbc2('0x139')];if(_0x30280>0x0&&_0x978adf[_0xbbc2('0x1f8')]==0x0){this[_0xbbc2('0x206')](_0x978adf);}else{loggerPredictiveCalls[_0xbbc2('0x4b')](_0xbbc2('0x207'));}}else{this['tryOriginatePredictive'](_0x978adf);}};Dialer[_0xbbc2('0x1a')]['tryOriginatePredictive']=function(_0x418a11){var _0x39328d=this;var _0x26ca57=[];_0x418a11[_0xbbc2('0x154')]+=0x1;for(var _0x14a26e in this['agents']){if(typeof this[_0xbbc2('0x22')][_0x14a26e]!==_0xbbc2('0x14f')){if(this['agents'][_0x14a26e]['state']===_0xbbc2('0x202')&&this[_0xbbc2('0x22')][_0x14a26e]['status']===_0xbbc2('0x145')){_0x26ca57[_0xbbc2('0x99')](this['agents'][_0x14a26e]['id']);}}}_0x418a11[_0xbbc2('0x1f8')]=0x1;return this[_0xbbc2('0x203')](_0x418a11['id'],_0x26ca57,0x1,_0x418a11['dialOrderByScheduledAt'],_0x418a11)[_0xbbc2('0x40')](function(_0x1b310d){_0x418a11[_0xbbc2('0x1f8')]=0x1;if(_0x1b310d){if(!utils[_0xbbc2('0x1fa')](_0x1b310d)){utils[_0xbbc2('0x66')](_0x418a11,0x1,0x0);return hopperUtils[_0xbbc2('0x208')](_0x418a11)[_0xbbc2('0x40')](sendMessageReschedule(_0x418a11))['catch'](loggerCatch(_0xbbc2('0x209')));}else{_0x418a11['message']=utils[_0xbbc2('0x69')][_0xbbc2('0x204')];if(_[_0xbbc2('0xf2')](_0x1b310d[0x0])||_[_0xbbc2('0xf2')](_0x1b310d[0x0][_0xbbc2('0x176')])||_['isNil'](_0x1b310d[0x0]['phone'])){_0x39328d[_0xbbc2('0x156')]('[actionOriginate]\x20',_0x418a11,_0x1b310d[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xbbc2('0x76')](_0x1b310d[0x0],[_0xbbc2('0xde'),_0xbbc2('0x15f')]))[_0xbbc2('0x40')](_0x39328d['checkContactBlack'](_0x418a11,_0x1b310d[0x0]))[_0xbbc2('0xa1')](_0x39328d[_0xbbc2('0x1ff')](_0xbbc2('0x20a'),_0x418a11));}}}})[_0xbbc2('0xa1')](loggerGetContactDialer(_0xbbc2('0x20b'),_0x418a11,0x1));};Dialer[_0xbbc2('0x1a')][_0xbbc2('0x1d2')]=function(_0x3d2e9d,_0x364b76,_0xf57cbd,_0x410a4b,_0x1f7089,_0x9935a7){loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x20c'));loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x20d'),_0x3d2e9d);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x364b76);loggerPredictive[_0xbbc2('0x4b')]('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',_0xf57cbd);loggerPredictive['info'](_0xbbc2('0x20e'),_0x410a4b);loggerPredictive[_0xbbc2('0x4b')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f7089);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x55'));return new Promise(function(_0x152059,_0x246728){if(_0x3d2e9d<=0x0||isNaN(_0x3d2e9d)){return _0x246728(msgResponse(_0xbbc2('0x20f'),'Error',_0xbbc2('0x210')+_0x3d2e9d));}if(_0xf57cbd<=0x0||isNaN(_0xf57cbd)){return _0x246728(msgResponse(_0xbbc2('0x20f'),'Error',_0xbbc2('0x211')+_0xf57cbd));}if(_0x410a4b<=0x0||isNaN(_0x410a4b)){return _0x246728(msgResponse(_0xbbc2('0x20f'),_0xbbc2('0x85'),_0xbbc2('0x212')+_0x410a4b));}if(_0x364b76<=0x0||isNaN(_0x364b76)){return _0x246728(msgResponse(_0xbbc2('0x20f'),_0xbbc2('0x85'),_0xbbc2('0x213')+_0x364b76));}if(_0x1f7089<=0x0||isNaN(_0x1f7089)){return _0x246728(msgResponse(_0xbbc2('0x20f'),'Error',_0xbbc2('0x214')+_0x1f7089));}_0x9935a7=_0x9935a7||0x0;var _0x25e5e0=0x1/_0xf57cbd;var _0x564ad2=0x0;var _0x5da126=0x0;var _0x55a62a=0x0;var _0x65f991=0x0;for(var _0x2d96a8=0x0;_0x55a62a<_0x1f7089;_0x2d96a8+=0x1){_0x5da126=_0x2d96a8/_0x364b76;_0x564ad2=(_0x410a4b*_0x5da126+_0x9935a7)/_0x25e5e0;_0x55a62a=utils[_0xbbc2('0x215')](_0x564ad2,_0x3d2e9d);_0x65f991=_0x564ad2/_0x3d2e9d*(0x1-utils[_0xbbc2('0x215')](_0x564ad2,_0x3d2e9d));}return _0x152059({'erlangCalls':_0x2d96a8,'erlangCallToSecond':_0x364b76/_0x2d96a8,'erlangAbandonmentRate':_0x55a62a,'erlangBusyFactor':_0x65f991});});};Dialer['prototype'][_0xbbc2('0x1d4')]=function(_0x44195d,_0x289f35,_0x2b8a6c,_0x7f512b,_0x567087,_0x520026){loggerPredictive[_0xbbc2('0x4b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xbbc2('0x4b')]('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',_0x44195d);loggerPredictive['info'](_0xbbc2('0x216'),_0x289f35);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x217'),_0x2b8a6c);loggerPredictive['info']('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',_0x7f512b);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x218'),_0x567087);loggerPredictive[_0xbbc2('0x4b')](_0xbbc2('0x55'));return new Promise(function(_0x5f37a4,_0x32ac10){if(_0x44195d<=0x0||isNaN(_0x44195d)){return _0x32ac10(msgResponse('[busyFactor]',_0xbbc2('0x85'),'m\x20=\x20'+_0x44195d));}if(_0x2b8a6c<=0x0||isNaN(_0x2b8a6c)){return _0x32ac10(msgResponse(_0xbbc2('0x219'),'Error',_0xbbc2('0x211')+_0x2b8a6c));}if(_0x7f512b<=0x0||isNaN(_0x7f512b)){return _0x32ac10(msgResponse('[busyFactor]',_0xbbc2('0x85'),_0xbbc2('0x212')+_0x7f512b));}if(_0x289f35<=0x0||isNaN(_0x289f35)){return _0x32ac10(msgResponse('[busyFactor]',_0xbbc2('0x85'),'interval\x20=\x20'+_0x289f35));}if(_0x567087<=0x0||isNaN(_0x567087)){return _0x32ac10(msgResponse(_0xbbc2('0x219'),'Error',_0xbbc2('0x21a')+_0x567087));}_0x520026=_0x520026||0x0;var _0x2a71d4=0x1/_0x2b8a6c;var _0x2d2c83=0x0;var _0x26da59=0x0;var _0x5c30b9=0x0;var _0x13dede=0x0;for(var _0x142784=0x0;_0x13dede<_0x567087;_0x142784+=0x1){_0x26da59=_0x142784/_0x289f35;_0x2d2c83=(_0x7f512b*_0x26da59+_0x520026)/_0x2a71d4;_0x5c30b9=utils[_0xbbc2('0x215')](_0x2d2c83,_0x44195d);_0x13dede=_0x2d2c83/_0x44195d*(0x1-utils[_0xbbc2('0x215')](_0x2d2c83,_0x44195d));}return _0x5f37a4({'erlangCalls':_0x142784,'erlangCallToSecond':_0x289f35/_0x142784,'erlangAbandonmentRate':_0x5c30b9,'erlangBusyFactor':_0x13dede});});};module[_0xbbc2('0x21b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index d8fa41d..6dc312d 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7d0=['\x22%s\x22\x20<%s>','number','substring','dialCutDigit','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xf7d0,0x11a));var _0x0f7d=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xf7d0[_0x4fbfd9];return _0x31dc94;};'use strict';var util=require(_0x0f7d('0x0'));var _=require(_0x0f7d('0x1'));var moment=require(_0x0f7d('0x2'));function checkNameSurname(_0x30d34f,_0x4190e2,_0x3af3b8){var _0x37bfae='';if(!_[_0x0f7d('0x3')](_0x4190e2)&&_0x0f7d('0x4')===typeof _0x4190e2){_0x37bfae+=_0x4190e2;}if(!_[_0x0f7d('0x3')](_0x3af3b8)&&_0x0f7d('0x4')===typeof _0x3af3b8){_0x37bfae+='\x20'+_0x3af3b8;}if(_0x37bfae!==''){return _0x37bfae;}return _0x30d34f;}function Action(_0xff8388,_0x2cfacf,_0x3fc3be){this[_0x0f7d('0x5')]=_0xff8388;this[_0x0f7d('0x6')]=_0x3fc3be||undefined;this['name']=checkNameSurname(_0x2cfacf[_0x0f7d('0x7')][_0x0f7d('0x8')],_0x2cfacf[_0x0f7d('0x7')][_0x0f7d('0x9')],_0x2cfacf[_0x0f7d('0x7')][_0x0f7d('0xa')]);this['number']=_0x2cfacf[_0x0f7d('0x8')];this['queue']=_0xff8388[_0x0f7d('0xb')];this[_0x0f7d('0xc')]=_0x2cfacf[_0x0f7d('0xc')]||![];this[_0x0f7d('0xd')]=_0xff8388['type'];this[_0x0f7d('0xe')]=_0xff8388[_0x0f7d('0xe')]||0x3;this[_0x0f7d('0xf')]=_0x2cfacf[_0x0f7d('0xf')];this[_0x0f7d('0x10')]=_0x2cfacf[_0x0f7d('0x10')];this[_0x0f7d('0x11')]=_0x2cfacf['countcongestionretry'];this[_0x0f7d('0x12')]=_0x2cfacf[_0x0f7d('0x12')];this[_0x0f7d('0x13')]=_0x2cfacf[_0x0f7d('0x13')];this[_0x0f7d('0x14')]=_0x2cfacf[_0x0f7d('0x14')];this[_0x0f7d('0x15')]=_0x2cfacf[_0x0f7d('0x15')];this[_0x0f7d('0x16')]=_0x2cfacf[_0x0f7d('0x16')];this[_0x0f7d('0x17')]=_0x2cfacf[_0x0f7d('0x17')];this[_0x0f7d('0x18')]=_0x2cfacf['ContactId'];this['ListId']=_0x2cfacf[_0x0f7d('0x19')];this[_0x0f7d('0x1a')]=_0x2cfacf[_0x0f7d('0x1a')];this[_0x0f7d('0x1b')]=_0x2cfacf['VoiceQueueId'];this['CampaignId']=_0x2cfacf[_0x0f7d('0x1c')];this[_0x0f7d('0x1d')]=_0x2cfacf['id'];this[_0x0f7d('0x1e')]=_0x2cfacf['Contact'][_0x0f7d('0x9')]||'';this[_0x0f7d('0x1f')]=moment()[_0x0f7d('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x2cfacf[_0x0f7d('0x21')];this[_0x0f7d('0x22')]=_0x2cfacf[_0x0f7d('0x22')];this[_0x0f7d('0x23')]=_0x2cfacf[_0x0f7d('0x23')];this[_0x0f7d('0x24')]=_0x2cfacf[_0x0f7d('0x24')];this[_0x0f7d('0x25')]='';this['originatecalleridname']='';}Action[_0x0f7d('0x26')][_0x0f7d('0x27')]=function(){return util[_0x0f7d('0x20')](_0x0f7d('0x28'),this[_0x0f7d('0xb')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x0f7d('0x29')][_0x0f7d('0x2a')](this[_0x0f7d('0x5')][_0x0f7d('0x2b')]):this['number']);};Action['prototype']['getQueue']=function(){return this[_0x0f7d('0x2c')];};module[_0x0f7d('0x2d')]=Action; \ No newline at end of file +var _0xe767=['active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','lastName','phone','queue'];(function(_0x34ea3d,_0x1929e9){var _0x406193=function(_0x25bf2a){while(--_0x25bf2a){_0x34ea3d['push'](_0x34ea3d['shift']());}};_0x406193(++_0x1929e9);}(_0xe767,0x1c1));var _0x7e76=function(_0x22f048,_0x98c8b7){_0x22f048=_0x22f048-0x0;var _0x49ef43=_0xe767[_0x22f048];return _0x49ef43;};'use strict';var util=require(_0x7e76('0x0'));var _=require(_0x7e76('0x1'));var moment=require(_0x7e76('0x2'));function checkNameSurname(_0x93b78f,_0x151e86,_0x500a3d){var _0x25ac5d='';if(!_[_0x7e76('0x3')](_0x151e86)&&_0x7e76('0x4')===typeof _0x151e86){_0x25ac5d+=_0x151e86;}if(!_[_0x7e76('0x3')](_0x500a3d)&&'string'===typeof _0x500a3d){_0x25ac5d+='\x20'+_0x500a3d;}if(_0x25ac5d!==''){return _0x25ac5d;}return _0x93b78f;}function Action(_0x406830,_0x4fbe9c,_0x605311){this['voiceQueue']=_0x406830;this[_0x7e76('0x5')]=_0x605311||undefined;this[_0x7e76('0x6')]=checkNameSurname(_0x4fbe9c['Contact']['phone'],_0x4fbe9c[_0x7e76('0x7')]['firstName'],_0x4fbe9c[_0x7e76('0x7')][_0x7e76('0x8')]);this['number']=_0x4fbe9c[_0x7e76('0x9')];this[_0x7e76('0xa')]=_0x406830[_0x7e76('0x6')];this[_0x7e76('0xb')]=_0x4fbe9c[_0x7e76('0xb')]||![];this[_0x7e76('0xc')]=_0x406830[_0x7e76('0xc')];this[_0x7e76('0xd')]=_0x406830[_0x7e76('0xd')]||0x3;this['scheduledat']=_0x4fbe9c[_0x7e76('0xe')];this[_0x7e76('0xf')]=_0x4fbe9c[_0x7e76('0xf')];this[_0x7e76('0x10')]=_0x4fbe9c[_0x7e76('0x10')];this['countnoanswerretry']=_0x4fbe9c[_0x7e76('0x11')];this['countnosuchnumberretry']=_0x4fbe9c[_0x7e76('0x12')];this[_0x7e76('0x13')]=_0x4fbe9c['countdropretry'];this['countabandonedretry']=_0x4fbe9c[_0x7e76('0x14')];this[_0x7e76('0x15')]=_0x4fbe9c['countmachineretry'];this[_0x7e76('0x16')]=_0x4fbe9c['countagentrejectretry'];this['ContactId']=_0x4fbe9c['ContactId'];this[_0x7e76('0x17')]=_0x4fbe9c[_0x7e76('0x17')];this[_0x7e76('0x18')]=_0x4fbe9c[_0x7e76('0x18')];this[_0x7e76('0x19')]=_0x4fbe9c['VoiceQueueId'];this[_0x7e76('0x1a')]=_0x4fbe9c[_0x7e76('0x1a')];this[_0x7e76('0x1b')]=_0x4fbe9c['id'];this[_0x7e76('0x1c')]=_0x4fbe9c[_0x7e76('0x7')][_0x7e76('0x1d')]||'';this[_0x7e76('0x1e')]=moment()[_0x7e76('0x1f')](_0x7e76('0x20'));this[_0x7e76('0x21')]=_0x4fbe9c[_0x7e76('0x21')];this[_0x7e76('0x22')]=_0x4fbe9c[_0x7e76('0x22')];this[_0x7e76('0x23')]=_0x4fbe9c[_0x7e76('0x23')];this[_0x7e76('0x24')]=_0x4fbe9c[_0x7e76('0x24')];this[_0x7e76('0x25')]='';this['originatecalleridname']='';}Action[_0x7e76('0x26')]['getCaller']=function(){return util[_0x7e76('0x1f')](_0x7e76('0x27'),this[_0x7e76('0x6')],this[_0x7e76('0x28')][_0x7e76('0x29')]>0x0?this[_0x7e76('0x2a')][_0x7e76('0x2b')](this[_0x7e76('0x28')][_0x7e76('0x29')]):this[_0x7e76('0x2a')]);};Action[_0x7e76('0x26')][_0x7e76('0x2c')]=function(){return this['queue'];};module[_0x7e76('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 94a2692..e9ff3a0 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c41=['number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x0c41,0xc9));var _0x10c4=function(_0x1a801b,_0x3ab1bc){_0x1a801b=_0x1a801b-0x0;var _0x34faa1=_0x0c41[_0x1a801b];return _0x34faa1;};'use strict';var moment=require(_0x10c4('0x0'));var utils=require(_0x10c4('0x1'));function AgentComplete(_0xba398c,_0x499863){this[_0x10c4('0x2')]=0x4;this['statedesc']='Answer';this[_0x10c4('0x3')]=_0xba398c[_0x10c4('0x3')];this[_0x10c4('0x4')]=_0xba398c['type'];this['campaigntype']=_0xba398c[_0x10c4('0x4')]===_0x10c4('0x5')?_0x10c4('0x6'):_0xba398c[_0x10c4('0x4')];this[_0x10c4('0x7')]=_0xba398c['countbusyretry'];this['countcongestionretry']=_0xba398c[_0x10c4('0x8')];this[_0x10c4('0x9')]=_0xba398c[_0x10c4('0x9')];this['countglobal']=_0xba398c[_0x10c4('0x7')]+_0xba398c[_0x10c4('0x8')]+_0xba398c[_0x10c4('0x9')]+_0xba398c[_0x10c4('0xa')]+_0xba398c['countdropretry']+_0xba398c[_0x10c4('0xb')]+_0xba398c['countmachineretry']+_0xba398c[_0x10c4('0xc')];this[_0x10c4('0xa')]=_0xba398c['countnosuchnumberretry'];this['countdropretry']=_0xba398c[_0x10c4('0xd')];this[_0x10c4('0xb')]=_0xba398c[_0x10c4('0xb')];this[_0x10c4('0xe')]=_0xba398c[_0x10c4('0xe')];this['countagentrejectretry']=_0xba398c[_0x10c4('0xc')];this[_0x10c4('0xf')]=_0x499863['uniqueid'];this[_0x10c4('0x10')]=_0xba398c[_0x10c4('0x11')];this[_0x10c4('0x12')]=_0xba398c[_0x10c4('0x13')];this['starttime']=_0xba398c[_0x10c4('0x14')];this[_0x10c4('0x15')]=_0xba398c[_0x10c4('0x15')];this[_0x10c4('0x16')]=_0xba398c[_0x10c4('0x16')];this[_0x10c4('0x17')]=moment()[_0x10c4('0x18')](_0x10c4('0x19'));this[_0x10c4('0x1a')]=utils['getSeconds'](_0xba398c[_0x10c4('0x15')],_0xba398c[_0x10c4('0x14')]);this[_0x10c4('0x1b')]=utils[_0x10c4('0x1c')](_0xba398c['answertime'],_0xba398c[_0x10c4('0x15')]);this[_0x10c4('0x1d')]=utils[_0x10c4('0x1c')](this[_0x10c4('0x17')],_0xba398c[_0x10c4('0x16')]);this[_0x10c4('0x6')]=_0x499863['queue'];this[_0x10c4('0x1e')]=_0x499863[_0x10c4('0x1e')];this['reason']=_0x499863['reason'];this['callback']=_0xba398c[_0x10c4('0x1f')];this[_0x10c4('0x20')]=_0xba398c[_0x10c4('0x20')];this[_0x10c4('0x21')]=_0xba398c[_0x10c4('0x21')];this[_0x10c4('0x22')]=_0xba398c[_0x10c4('0x22')];this[_0x10c4('0x23')]=_0xba398c[_0x10c4('0x23')];this['ListId']=_0xba398c[_0x10c4('0x24')];this[_0x10c4('0x25')]=_0xba398c[_0x10c4('0x25')];this[_0x10c4('0x26')]=_0xba398c[_0x10c4('0x26')];this[_0x10c4('0x27')]=_0xba398c['CampaignId'];this['originatecalleridnum']=_0xba398c[_0x10c4('0x28')]||'';this[_0x10c4('0x29')]=_0xba398c[_0x10c4('0x29')]||'';this['agiafterat']=_0xba398c[_0x10c4('0x2a')];}module[_0x10c4('0x2b')]=AgentComplete; \ No newline at end of file +var _0x2dac=['type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','../utils','state','scheduledat'];(function(_0x5207a2,_0x316913){var _0x314716=function(_0x2ca663){while(--_0x2ca663){_0x5207a2['push'](_0x5207a2['shift']());}};_0x314716(++_0x316913);}(_0x2dac,0x1e0));var _0xc2da=function(_0x4cd74e,_0x312dc6){_0x4cd74e=_0x4cd74e-0x0;var _0x479c40=_0x2dac[_0x4cd74e];return _0x479c40;};'use strict';var moment=require(_0xc2da('0x0'));var utils=require(_0xc2da('0x1'));function AgentComplete(_0x3156d4,_0x5295d8){this[_0xc2da('0x2')]=0x4;this['statedesc']='Answer';this[_0xc2da('0x3')]=_0x3156d4[_0xc2da('0x3')];this[_0xc2da('0x4')]=_0x3156d4[_0xc2da('0x4')];this['campaigntype']=_0x3156d4[_0xc2da('0x4')]===_0xc2da('0x5')?_0xc2da('0x6'):_0x3156d4[_0xc2da('0x4')];this[_0xc2da('0x7')]=_0x3156d4[_0xc2da('0x7')];this['countcongestionretry']=_0x3156d4['countcongestionretry'];this[_0xc2da('0x8')]=_0x3156d4['countnoanswerretry'];this[_0xc2da('0x9')]=_0x3156d4[_0xc2da('0x7')]+_0x3156d4[_0xc2da('0xa')]+_0x3156d4['countnoanswerretry']+_0x3156d4[_0xc2da('0xb')]+_0x3156d4[_0xc2da('0xc')]+_0x3156d4[_0xc2da('0xd')]+_0x3156d4['countmachineretry']+_0x3156d4[_0xc2da('0xe')];this[_0xc2da('0xb')]=_0x3156d4[_0xc2da('0xb')];this[_0xc2da('0xc')]=_0x3156d4[_0xc2da('0xc')];this[_0xc2da('0xd')]=_0x3156d4[_0xc2da('0xd')];this[_0xc2da('0xf')]=_0x3156d4['countmachineretry'];this[_0xc2da('0xe')]=_0x3156d4[_0xc2da('0xe')];this['uniqueid']=_0x5295d8[_0xc2da('0x10')];this[_0xc2da('0x11')]=_0x3156d4[_0xc2da('0x12')];this[_0xc2da('0x13')]=_0x3156d4['number'];this['starttime']=_0x3156d4[_0xc2da('0x14')];this[_0xc2da('0x15')]=_0x3156d4['responsetime'];this[_0xc2da('0x16')]=_0x3156d4[_0xc2da('0x16')];this[_0xc2da('0x17')]=moment()[_0xc2da('0x18')](_0xc2da('0x19'));this[_0xc2da('0x1a')]=utils[_0xc2da('0x1b')](_0x3156d4['responsetime'],_0x3156d4[_0xc2da('0x14')]);this[_0xc2da('0x1c')]=utils[_0xc2da('0x1b')](_0x3156d4[_0xc2da('0x16')],_0x3156d4[_0xc2da('0x15')]);this[_0xc2da('0x1d')]=utils[_0xc2da('0x1b')](this['endtime'],_0x3156d4[_0xc2da('0x16')]);this[_0xc2da('0x6')]=_0x5295d8[_0xc2da('0x6')];this['membername']=_0x5295d8[_0xc2da('0x1e')];this['reason']=_0x5295d8[_0xc2da('0x1f')];this[_0xc2da('0x20')]=_0x3156d4[_0xc2da('0x20')];this[_0xc2da('0x21')]=_0x3156d4[_0xc2da('0x21')];this[_0xc2da('0x22')]=_0x3156d4[_0xc2da('0x22')];this[_0xc2da('0x23')]=_0x3156d4[_0xc2da('0x23')];this[_0xc2da('0x24')]=_0x3156d4[_0xc2da('0x24')];this[_0xc2da('0x25')]=_0x3156d4['ListId'];this[_0xc2da('0x26')]=_0x3156d4[_0xc2da('0x26')];this[_0xc2da('0x27')]=_0x3156d4[_0xc2da('0x27')];this[_0xc2da('0x28')]=_0x3156d4['CampaignId'];this[_0xc2da('0x29')]=_0x3156d4['originatecalleridnum']||'';this[_0xc2da('0x2a')]=_0x3156d4[_0xc2da('0x2a')]||'';this['agiafterat']=_0x3156d4['agiafterat'];}module[_0xc2da('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index d2304fb..2bb5671 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a10=['countglobal','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','queue','calleridname','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0x9a10,0x190));var _0x09a1=function(_0x56eae7,_0x20e474){_0x56eae7=_0x56eae7-0x0;var _0xee28dc=_0x9a10[_0x56eae7];return _0xee28dc;};'use strict';function Final(_0x2380b9){this[_0x09a1('0x0')]=_0x2380b9[_0x09a1('0x0')];this[_0x09a1('0x1')]=_0x2380b9['scheduledat'];this[_0x09a1('0x2')]=_0x2380b9[_0x09a1('0x2')];this[_0x09a1('0x3')]=_0x2380b9[_0x09a1('0x2')]===_0x09a1('0x4')?'queue':_0x2380b9[_0x09a1('0x2')];this[_0x09a1('0x5')]=_0x2380b9[_0x09a1('0x5')];this[_0x09a1('0x6')]=_0x2380b9[_0x09a1('0x6')];this[_0x09a1('0x7')]=_0x2380b9[_0x09a1('0x7')];this[_0x09a1('0x8')]=_0x2380b9[_0x09a1('0x5')]+_0x2380b9['countcongestionretry']+_0x2380b9[_0x09a1('0x7')]+_0x2380b9['countnosuchnumberretry']+_0x2380b9['countdropretry']+_0x2380b9['countabandonedretry']+_0x2380b9['countmachineretry']+_0x2380b9[_0x09a1('0x9')];this['countnosuchnumberretry']=_0x2380b9[_0x09a1('0xa')];this[_0x09a1('0xb')]=_0x2380b9[_0x09a1('0xb')];this[_0x09a1('0xc')]=_0x2380b9[_0x09a1('0xc')];this[_0x09a1('0xd')]=_0x2380b9['countmachineretry'];this['countagentrejectretry']=_0x2380b9['countagentrejectretry'];this[_0x09a1('0xe')]=_0x2380b9[_0x09a1('0xe')];this[_0x09a1('0xf')]=_0x2380b9[_0x09a1('0xf')];this['calleridnum']=_0x2380b9['calleridnum'];this['starttime']=_0x2380b9['starttime'];this['responsetime']=_0x2380b9[_0x09a1('0x10')];this[_0x09a1('0x11')]=_0x2380b9[_0x09a1('0x10')];this[_0x09a1('0x12')]=_0x2380b9[_0x09a1('0x12')]||0x0;this[_0x09a1('0x13')]=_0x2380b9[_0x09a1('0x13')]||0x0;this[_0x09a1('0x14')]=_0x2380b9[_0x09a1('0x14')]||0x0;this['callback']=_0x2380b9[_0x09a1('0x15')];this['callbackuniqueid']=_0x2380b9[_0x09a1('0x16')];this['callbackat']=_0x2380b9[_0x09a1('0x17')];this[_0x09a1('0x18')]=_0x2380b9[_0x09a1('0x18')];this[_0x09a1('0x19')]=_0x2380b9[_0x09a1('0x19')];this[_0x09a1('0x1a')]=_0x2380b9[_0x09a1('0x1a')];this[_0x09a1('0x1b')]=_0x2380b9[_0x09a1('0x1b')];this[_0x09a1('0x1c')]=_0x2380b9[_0x09a1('0x1c')];this[_0x09a1('0x1d')]=_0x2380b9[_0x09a1('0x1d')];this[_0x09a1('0x1e')]=_0x2380b9['originatecalleridnum']||'';this['originatecalleridname']=_0x2380b9[_0x09a1('0x1f')]||'';this['state']=_0x2380b9['state'];this[_0x09a1('0x20')]=_0x2380b9['statedesc'];}module[_0x09a1('0x21')]=Final; \ No newline at end of file +var _0xcabe=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x2c6281,_0x29effb){var _0x4e988b=function(_0x3decdd){while(--_0x3decdd){_0x2c6281['push'](_0x2c6281['shift']());}};_0x4e988b(++_0x29effb);}(_0xcabe,0x11a));var _0xecab=function(_0x7630eb,_0x190c23){_0x7630eb=_0x7630eb-0x0;var _0x2e129f=_0xcabe[_0x7630eb];return _0x2e129f;};'use strict';function Final(_0x4e5988){this['uniqueid']=_0x4e5988['uniqueid'];this[_0xecab('0x0')]=_0x4e5988[_0xecab('0x0')];this[_0xecab('0x1')]=_0x4e5988[_0xecab('0x1')];this[_0xecab('0x2')]=_0x4e5988[_0xecab('0x1')]===_0xecab('0x3')?_0xecab('0x4'):_0x4e5988[_0xecab('0x1')];this[_0xecab('0x5')]=_0x4e5988[_0xecab('0x5')];this[_0xecab('0x6')]=_0x4e5988['countcongestionretry'];this[_0xecab('0x7')]=_0x4e5988[_0xecab('0x7')];this[_0xecab('0x8')]=_0x4e5988[_0xecab('0x5')]+_0x4e5988[_0xecab('0x6')]+_0x4e5988[_0xecab('0x7')]+_0x4e5988[_0xecab('0x9')]+_0x4e5988['countdropretry']+_0x4e5988['countabandonedretry']+_0x4e5988['countmachineretry']+_0x4e5988[_0xecab('0xa')];this['countnosuchnumberretry']=_0x4e5988[_0xecab('0x9')];this[_0xecab('0xb')]=_0x4e5988[_0xecab('0xb')];this[_0xecab('0xc')]=_0x4e5988[_0xecab('0xc')];this[_0xecab('0xd')]=_0x4e5988[_0xecab('0xd')];this[_0xecab('0xa')]=_0x4e5988['countagentrejectretry'];this['queue']=_0x4e5988[_0xecab('0x4')];this['calleridname']=_0x4e5988[_0xecab('0xe')];this['calleridnum']=_0x4e5988[_0xecab('0xf')];this[_0xecab('0x10')]=_0x4e5988[_0xecab('0x10')];this[_0xecab('0x11')]=_0x4e5988[_0xecab('0x11')];this['endtime']=_0x4e5988['responsetime'];this[_0xecab('0x12')]=_0x4e5988[_0xecab('0x12')]||0x0;this['holdtime']=_0x4e5988['holdtime']||0x0;this[_0xecab('0x13')]=_0x4e5988[_0xecab('0x13')]||0x0;this[_0xecab('0x14')]=_0x4e5988[_0xecab('0x14')];this['callbackuniqueid']=_0x4e5988['callbackuniqueid'];this[_0xecab('0x15')]=_0x4e5988[_0xecab('0x15')];this[_0xecab('0x16')]=_0x4e5988[_0xecab('0x16')];this['ContactId']=_0x4e5988[_0xecab('0x17')];this[_0xecab('0x18')]=_0x4e5988['ListId'];this[_0xecab('0x19')]=_0x4e5988['UserId'];this[_0xecab('0x1a')]=_0x4e5988['VoiceQueueId'];this[_0xecab('0x1b')]=_0x4e5988[_0xecab('0x1b')];this[_0xecab('0x1c')]=_0x4e5988['originatecalleridnum']||'';this[_0xecab('0x1d')]=_0x4e5988[_0xecab('0x1d')]||'';this[_0xecab('0x1e')]=_0x4e5988[_0xecab('0x1e')];this['statedesc']=_0x4e5988['statedesc'];}module[_0xecab('0x1f')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 49449ae..de50670 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3a=['amd','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','IVR','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','CampaignId','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue'];(function(_0x2222a0,_0x28ed7a){var _0x155625=function(_0x2fa632){while(--_0x2fa632){_0x2222a0['push'](_0x2222a0['shift']());}};_0x155625(++_0x28ed7a);}(_0xed3a,0x155));var _0xaed3=function(_0x48c4df,_0x1ee1aa){_0x48c4df=_0x48c4df-0x0;var _0x1fa08d=_0xed3a[_0x48c4df];return _0x1fa08d;};'use strict';var moment=require(_0xaed3('0x0'));var utils=require(_0xaed3('0x1'));function Hangup(_0x5879d6,_0x4d3f5c){this[_0xaed3('0x2')]=0x4;this[_0xaed3('0x3')]=_0xaed3('0x4');this[_0xaed3('0x5')]=_0x5879d6[_0xaed3('0x5')];this[_0xaed3('0x6')]=_0x5879d6[_0xaed3('0x6')];this[_0xaed3('0x7')]=_0x5879d6[_0xaed3('0x6')]===_0xaed3('0x8')?_0xaed3('0x9'):_0x5879d6['type'];this[_0xaed3('0xa')]=_0x5879d6[_0xaed3('0xa')]||![];this['countbusyretry']=_0x5879d6['countbusyretry'];this['countcongestionretry']=_0x5879d6[_0xaed3('0xb')];this[_0xaed3('0xc')]=_0x5879d6['countnoanswerretry'];this[_0xaed3('0xd')]=_0x5879d6[_0xaed3('0xe')]+_0x5879d6[_0xaed3('0xb')]+_0x5879d6[_0xaed3('0xc')]+_0x5879d6[_0xaed3('0xf')]+_0x5879d6['countdropretry']+_0x5879d6['countabandonedretry']+_0x5879d6[_0xaed3('0x10')]+_0x5879d6[_0xaed3('0x11')];this[_0xaed3('0xf')]=_0x5879d6[_0xaed3('0xf')];this['countdropretry']=_0x5879d6[_0xaed3('0x12')];this[_0xaed3('0x13')]=_0x5879d6[_0xaed3('0x13')];this[_0xaed3('0x10')]=_0x5879d6[_0xaed3('0x10')];this[_0xaed3('0x11')]=_0x5879d6['countagentrejectretry'];this[_0xaed3('0x14')]=_0x4d3f5c[_0xaed3('0x14')];this['calleridname']=_0x5879d6[_0xaed3('0x15')];this[_0xaed3('0x16')]=_0x5879d6[_0xaed3('0x17')];this[_0xaed3('0x18')]=_0x5879d6[_0xaed3('0x18')];this[_0xaed3('0x19')]=_0x5879d6['responsetime'];this[_0xaed3('0x1a')]=moment()[_0xaed3('0x1b')](_0xaed3('0x1c'));this['ringtime']=utils['getSeconds'](_0x5879d6[_0xaed3('0x19')],_0x5879d6['starttime']);this['holdtime']=0x0;this['talktime']=utils[_0xaed3('0x1d')](this[_0xaed3('0x1a')],_0x5879d6[_0xaed3('0x19')]);this[_0xaed3('0x9')]=_0x5879d6[_0xaed3('0x9')];this['membername']=_0xaed3('0x1e');this[_0xaed3('0x1f')]=_0x4d3f5c['cause-txt'];this[_0xaed3('0x20')]=_0x5879d6['callback'];this[_0xaed3('0x21')]=_0x5879d6['callbackuniqueid'];this[_0xaed3('0x22')]=_0x5879d6['callbackat'];this['recallme']=_0x5879d6['recallme'];this[_0xaed3('0x23')]=_0x5879d6[_0xaed3('0x23')];this[_0xaed3('0x24')]=_0x5879d6[_0xaed3('0x24')];this[_0xaed3('0x25')]=_0x5879d6['UserId'];this['VoiceQueueId']=_0x5879d6['VoiceQueueId'];this[_0xaed3('0x26')]=_0x5879d6[_0xaed3('0x26')];}module['exports']=Hangup; \ No newline at end of file +var _0x0f6c=['countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x2d699b,_0x135cd2){var _0x474b24=function(_0x4827d6){while(--_0x4827d6){_0x2d699b['push'](_0x2d699b['shift']());}};_0x474b24(++_0x135cd2);}(_0x0f6c,0x1bd));var _0xc0f6=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0f6c[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0xc0f6('0x0'));var utils=require(_0xc0f6('0x1'));function Hangup(_0x1d5d5a,_0x58cda2){this['state']=0x4;this[_0xc0f6('0x2')]=_0xc0f6('0x3');this[_0xc0f6('0x4')]=_0x1d5d5a['scheduledat'];this[_0xc0f6('0x5')]=_0x1d5d5a['type'];this[_0xc0f6('0x6')]=_0x1d5d5a[_0xc0f6('0x5')]===_0xc0f6('0x7')?_0xc0f6('0x8'):_0x1d5d5a['type'];this[_0xc0f6('0x9')]=_0x1d5d5a['amd']||![];this['countbusyretry']=_0x1d5d5a[_0xc0f6('0xa')];this[_0xc0f6('0xb')]=_0x1d5d5a[_0xc0f6('0xb')];this[_0xc0f6('0xc')]=_0x1d5d5a['countnoanswerretry'];this[_0xc0f6('0xd')]=_0x1d5d5a['countbusyretry']+_0x1d5d5a['countcongestionretry']+_0x1d5d5a[_0xc0f6('0xc')]+_0x1d5d5a[_0xc0f6('0xe')]+_0x1d5d5a[_0xc0f6('0xf')]+_0x1d5d5a[_0xc0f6('0x10')]+_0x1d5d5a[_0xc0f6('0x11')]+_0x1d5d5a['countagentrejectretry'];this['countnosuchnumberretry']=_0x1d5d5a[_0xc0f6('0xe')];this['countdropretry']=_0x1d5d5a[_0xc0f6('0xf')];this[_0xc0f6('0x10')]=_0x1d5d5a[_0xc0f6('0x10')];this[_0xc0f6('0x11')]=_0x1d5d5a['countmachineretry'];this[_0xc0f6('0x12')]=_0x1d5d5a['countagentrejectretry'];this['uniqueid']=_0x58cda2[_0xc0f6('0x13')];this[_0xc0f6('0x14')]=_0x1d5d5a['name'];this[_0xc0f6('0x15')]=_0x1d5d5a['number'];this[_0xc0f6('0x16')]=_0x1d5d5a[_0xc0f6('0x16')];this[_0xc0f6('0x17')]=_0x1d5d5a['responsetime'];this[_0xc0f6('0x18')]=moment()['format'](_0xc0f6('0x19'));this[_0xc0f6('0x1a')]=utils[_0xc0f6('0x1b')](_0x1d5d5a[_0xc0f6('0x17')],_0x1d5d5a[_0xc0f6('0x16')]);this[_0xc0f6('0x1c')]=0x0;this[_0xc0f6('0x1d')]=utils[_0xc0f6('0x1b')](this['endtime'],_0x1d5d5a[_0xc0f6('0x17')]);this[_0xc0f6('0x8')]=_0x1d5d5a[_0xc0f6('0x8')];this[_0xc0f6('0x1e')]=_0xc0f6('0x1f');this[_0xc0f6('0x20')]=_0x58cda2['cause-txt'];this[_0xc0f6('0x21')]=_0x1d5d5a[_0xc0f6('0x21')];this[_0xc0f6('0x22')]=_0x1d5d5a[_0xc0f6('0x22')];this[_0xc0f6('0x23')]=_0x1d5d5a[_0xc0f6('0x23')];this['recallme']=_0x1d5d5a[_0xc0f6('0x24')];this['ContactId']=_0x1d5d5a[_0xc0f6('0x25')];this[_0xc0f6('0x26')]=_0x1d5d5a[_0xc0f6('0x26')];this[_0xc0f6('0x27')]=_0x1d5d5a[_0xc0f6('0x27')];this['VoiceQueueId']=_0x1d5d5a[_0xc0f6('0x28')];this[_0xc0f6('0x29')]=_0x1d5d5a[_0xc0f6('0x29')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index e145676..5afd9d3 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c19=['originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countnosuchnumberretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x5d5407,_0x235a0a){var _0x44a09c=function(_0x20cf7c){while(--_0x20cf7c){_0x5d5407['push'](_0x5d5407['shift']());}};_0x44a09c(++_0x235a0a);}(_0x3c19,0x15a));var _0x93c1=function(_0x4670a6,_0x48156b){_0x4670a6=_0x4670a6-0x0;var _0x2cac9d=_0x3c19[_0x4670a6];return _0x2cac9d;};'use strict';var utils=require(_0x93c1('0x0'));function History(_0x5b71be){this[_0x93c1('0x1')]=_0x5b71be['uniqueid'];this['scheduledat']=_0x5b71be[_0x93c1('0x2')]||undefined;this[_0x93c1('0x3')]=_0x5b71be['type'];this[_0x93c1('0x4')]=_0x5b71be['type']===_0x93c1('0x5')?_0x93c1('0x6'):_0x5b71be[_0x93c1('0x3')];this[_0x93c1('0x7')]=_0x5b71be['countbusyretry'];this[_0x93c1('0x8')]=_0x5b71be[_0x93c1('0x8')];this[_0x93c1('0x9')]=_0x5b71be['countnoanswerretry'];this['countglobal']=_0x5b71be['countbusyretry']+_0x5b71be['countcongestionretry']+_0x5b71be[_0x93c1('0x9')]+_0x5b71be['countnosuchnumberretry']+_0x5b71be['countdropretry']+_0x5b71be['countabandonedretry']+_0x5b71be[_0x93c1('0xa')]+_0x5b71be['countagentrejectretry'];this[_0x93c1('0xb')]=_0x5b71be[_0x93c1('0xb')];this[_0x93c1('0xc')]=_0x5b71be[_0x93c1('0xc')];this[_0x93c1('0xd')]=_0x5b71be[_0x93c1('0xd')];this[_0x93c1('0xa')]=_0x5b71be['countmachineretry'];this['countagentrejectretry']=_0x5b71be['countagentrejectretry'];this[_0x93c1('0x6')]=_0x5b71be[_0x93c1('0x6')];this[_0x93c1('0xe')]=_0x5b71be[_0x93c1('0xf')];this[_0x93c1('0x10')]=_0x5b71be[_0x93c1('0x11')];this['starttime']=_0x5b71be[_0x93c1('0x12')];this[_0x93c1('0x13')]=_0x5b71be['responsetime'];this[_0x93c1('0x14')]=_0x5b71be[_0x93c1('0x13')];this[_0x93c1('0x15')]=utils['getSeconds'](_0x5b71be['responsetime'],_0x5b71be[_0x93c1('0x12')]);this[_0x93c1('0x16')]=0x0;this[_0x93c1('0x17')]=0x0;this[_0x93c1('0x18')]=_0x5b71be[_0x93c1('0x18')];this[_0x93c1('0x19')]=_0x5b71be[_0x93c1('0x19')];this[_0x93c1('0x1a')]=_0x5b71be['callbackat'];this[_0x93c1('0x1b')]=_0x5b71be[_0x93c1('0x1b')];this[_0x93c1('0x1c')]=_0x5b71be[_0x93c1('0x1c')];this[_0x93c1('0x1d')]=_0x5b71be[_0x93c1('0x1d')];this['UserId']=_0x5b71be[_0x93c1('0x1e')];this[_0x93c1('0x1f')]=_0x5b71be[_0x93c1('0x1f')];this[_0x93c1('0x20')]=_0x5b71be[_0x93c1('0x20')];this[_0x93c1('0x21')]=_0x5b71be['originatecalleridnum']||'';this[_0x93c1('0x22')]=_0x5b71be[_0x93c1('0x22')]||'';this[_0x93c1('0x23')]=_0x5b71be['state'];this['statedesc']=_0x5b71be[_0x93c1('0x24')];}module[_0x93c1('0x25')]=History; \ No newline at end of file +var _0xaf8b=['callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x30ad75,_0x4c92e1){var _0x1993b5=function(_0x532dc0){while(--_0x532dc0){_0x30ad75['push'](_0x30ad75['shift']());}};_0x1993b5(++_0x4c92e1);}(_0xaf8b,0x1bb));var _0xbaf8=function(_0x3864b4,_0x966f05){_0x3864b4=_0x3864b4-0x0;var _0x14c62f=_0xaf8b[_0x3864b4];return _0x14c62f;};'use strict';var utils=require(_0xbaf8('0x0'));function History(_0x2519a9){this['uniqueid']=_0x2519a9[_0xbaf8('0x1')];this[_0xbaf8('0x2')]=_0x2519a9[_0xbaf8('0x2')]||undefined;this[_0xbaf8('0x3')]=_0x2519a9[_0xbaf8('0x3')];this[_0xbaf8('0x4')]=_0x2519a9[_0xbaf8('0x3')]==='outbound'?_0xbaf8('0x5'):_0x2519a9[_0xbaf8('0x3')];this[_0xbaf8('0x6')]=_0x2519a9[_0xbaf8('0x6')];this['countcongestionretry']=_0x2519a9[_0xbaf8('0x7')];this['countnoanswerretry']=_0x2519a9['countnoanswerretry'];this[_0xbaf8('0x8')]=_0x2519a9[_0xbaf8('0x6')]+_0x2519a9[_0xbaf8('0x7')]+_0x2519a9[_0xbaf8('0x9')]+_0x2519a9['countnosuchnumberretry']+_0x2519a9[_0xbaf8('0xa')]+_0x2519a9['countabandonedretry']+_0x2519a9[_0xbaf8('0xb')]+_0x2519a9[_0xbaf8('0xc')];this['countnosuchnumberretry']=_0x2519a9['countnosuchnumberretry'];this[_0xbaf8('0xa')]=_0x2519a9[_0xbaf8('0xa')];this['countabandonedretry']=_0x2519a9[_0xbaf8('0xd')];this[_0xbaf8('0xb')]=_0x2519a9['countmachineretry'];this['countagentrejectretry']=_0x2519a9['countagentrejectretry'];this[_0xbaf8('0x5')]=_0x2519a9['queue'];this[_0xbaf8('0xe')]=_0x2519a9[_0xbaf8('0xf')];this[_0xbaf8('0x10')]=_0x2519a9[_0xbaf8('0x11')];this[_0xbaf8('0x12')]=_0x2519a9[_0xbaf8('0x12')];this[_0xbaf8('0x13')]=_0x2519a9['responsetime'];this[_0xbaf8('0x14')]=_0x2519a9['responsetime'];this[_0xbaf8('0x15')]=utils['getSeconds'](_0x2519a9['responsetime'],_0x2519a9['starttime']);this[_0xbaf8('0x16')]=0x0;this[_0xbaf8('0x17')]=0x0;this[_0xbaf8('0x18')]=_0x2519a9['callback'];this[_0xbaf8('0x19')]=_0x2519a9[_0xbaf8('0x19')];this[_0xbaf8('0x1a')]=_0x2519a9['callbackat'];this[_0xbaf8('0x1b')]=_0x2519a9[_0xbaf8('0x1b')];this['ContactId']=_0x2519a9['ContactId'];this[_0xbaf8('0x1c')]=_0x2519a9[_0xbaf8('0x1c')];this[_0xbaf8('0x1d')]=_0x2519a9[_0xbaf8('0x1d')];this['VoiceQueueId']=_0x2519a9[_0xbaf8('0x1e')];this['CampaignId']=_0x2519a9[_0xbaf8('0x1f')];this['originatecalleridnum']=_0x2519a9['originatecalleridnum']||'';this[_0xbaf8('0x20')]=_0x2519a9[_0xbaf8('0x20')]||'';this[_0xbaf8('0x21')]=_0x2519a9[_0xbaf8('0x21')];this[_0xbaf8('0x22')]=_0x2519a9[_0xbaf8('0x22')];}module[_0xbaf8('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index d7f65c2..afbe3a9 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8ef=['connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','membername'];(function(_0x2bb398,_0xd7c0dc){var _0x4dfefc=function(_0x20b088){while(--_0x20b088){_0x2bb398['push'](_0x2bb398['shift']());}};_0x4dfefc(++_0xd7c0dc);}(_0xb8ef,0x1bd));var _0xfb8e=function(_0x2a6cee,_0x446a67){_0x2a6cee=_0x2a6cee-0x0;var _0x3b5cfc=_0xb8ef[_0x2a6cee];return _0x3b5cfc;};'use strict';var utils=require(_0xfb8e('0x0'));function QueueCallerAbandon(_0x35b969,_0x3af371){this[_0xfb8e('0x1')]=_0x35b969['scheduledat'];this[_0xfb8e('0x2')]=_0x35b969[_0xfb8e('0x2')];this[_0xfb8e('0x3')]=_0x35b969[_0xfb8e('0x2')]===_0xfb8e('0x4')?_0xfb8e('0x5'):_0x35b969[_0xfb8e('0x2')];this[_0xfb8e('0x6')]=_0x35b969[_0xfb8e('0x6')];this[_0xfb8e('0x7')]=_0x35b969['countcongestionretry'];this[_0xfb8e('0x8')]=_0x35b969[_0xfb8e('0x8')];this[_0xfb8e('0x9')]=_0x35b969[_0xfb8e('0x6')]+_0x35b969[_0xfb8e('0x7')]+_0x35b969[_0xfb8e('0x8')]+_0x35b969[_0xfb8e('0xa')]+_0x35b969['countdropretry']+_0x35b969['countabandonedretry']+_0x35b969[_0xfb8e('0xb')]+_0x35b969[_0xfb8e('0xc')];this[_0xfb8e('0xa')]=_0x35b969[_0xfb8e('0xa')];this[_0xfb8e('0xd')]=_0x35b969[_0xfb8e('0xd')];this[_0xfb8e('0xe')]=_0x35b969[_0xfb8e('0xe')];this[_0xfb8e('0xb')]=_0x35b969['countmachineretry'];this[_0xfb8e('0xc')]=_0x35b969[_0xfb8e('0xc')];this[_0xfb8e('0xf')]=_0x3af371[_0xfb8e('0xf')];this[_0xfb8e('0x10')]=_0x35b969[_0xfb8e('0x11')];this['calleridnum']=_0x35b969[_0xfb8e('0x12')];this[_0xfb8e('0x13')]=_0x35b969[_0xfb8e('0x13')];this[_0xfb8e('0x14')]=_0x35b969[_0xfb8e('0x14')];this[_0xfb8e('0x15')]=_0x35b969[_0xfb8e('0x15')];this['dropreason']=_0x35b969[_0xfb8e('0x16')];this[_0xfb8e('0x17')]=this[_0xfb8e('0x15')];this[_0xfb8e('0x18')]=utils[_0xfb8e('0x19')](_0x35b969[_0xfb8e('0x14')],_0x35b969[_0xfb8e('0x13')]);this[_0xfb8e('0x1a')]=utils[_0xfb8e('0x19')](this[_0xfb8e('0x15')],_0x35b969[_0xfb8e('0x14')]);this['talktime']=0x0;this[_0xfb8e('0x5')]=_0x3af371[_0xfb8e('0x5')];this[_0xfb8e('0x1b')]=_0x3af371[_0xfb8e('0x1c')];this['reason']=_0x3af371[_0xfb8e('0x1d')];this['callback']=_0x35b969[_0xfb8e('0x1e')];this['callbackuniqueid']=_0x35b969['callbackuniqueid'];this[_0xfb8e('0x1f')]=_0x35b969[_0xfb8e('0x1f')];this[_0xfb8e('0x20')]=_0x35b969[_0xfb8e('0x20')];this['ContactId']=_0x35b969[_0xfb8e('0x21')];this[_0xfb8e('0x22')]=_0x35b969[_0xfb8e('0x22')];this['UserId']=_0x35b969[_0xfb8e('0x23')];this[_0xfb8e('0x24')]=_0x35b969[_0xfb8e('0x24')];this[_0xfb8e('0x25')]=_0x35b969[_0xfb8e('0x25')];this[_0xfb8e('0x26')]=_0x35b969['originatecalleridnum']||'';this['originatecalleridname']=_0x35b969['originatecalleridname']||'';this[_0xfb8e('0x27')]=_0x35b969[_0xfb8e('0x27')];this[_0xfb8e('0x28')]=_0x35b969[_0xfb8e('0x28')];this[_0xfb8e('0x29')]=_0x35b969[_0xfb8e('0x29')];}module[_0xfb8e('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xd270=['getSeconds','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason','ringtime'];(function(_0x2c3d4f,_0x448a69){var _0x2dddb6=function(_0x35974e){while(--_0x35974e){_0x2c3d4f['push'](_0x2c3d4f['shift']());}};_0x2dddb6(++_0x448a69);}(_0xd270,0xf2));var _0x0d27=function(_0x4f14ec,_0x3e7175){_0x4f14ec=_0x4f14ec-0x0;var _0x212bb2=_0xd270[_0x4f14ec];return _0x212bb2;};'use strict';var utils=require(_0x0d27('0x0'));function QueueCallerAbandon(_0x31cd15,_0x42d2b5){this[_0x0d27('0x1')]=_0x31cd15[_0x0d27('0x1')];this[_0x0d27('0x2')]=_0x31cd15[_0x0d27('0x2')];this[_0x0d27('0x3')]=_0x31cd15[_0x0d27('0x2')]===_0x0d27('0x4')?'queue':_0x31cd15[_0x0d27('0x2')];this['countbusyretry']=_0x31cd15['countbusyretry'];this[_0x0d27('0x5')]=_0x31cd15[_0x0d27('0x5')];this[_0x0d27('0x6')]=_0x31cd15[_0x0d27('0x6')];this[_0x0d27('0x7')]=_0x31cd15[_0x0d27('0x8')]+_0x31cd15[_0x0d27('0x5')]+_0x31cd15['countnoanswerretry']+_0x31cd15[_0x0d27('0x9')]+_0x31cd15[_0x0d27('0xa')]+_0x31cd15[_0x0d27('0xb')]+_0x31cd15[_0x0d27('0xc')]+_0x31cd15[_0x0d27('0xd')];this[_0x0d27('0x9')]=_0x31cd15[_0x0d27('0x9')];this[_0x0d27('0xa')]=_0x31cd15[_0x0d27('0xa')];this[_0x0d27('0xb')]=_0x31cd15[_0x0d27('0xb')];this[_0x0d27('0xc')]=_0x31cd15['countmachineretry'];this[_0x0d27('0xd')]=_0x31cd15[_0x0d27('0xd')];this[_0x0d27('0xe')]=_0x42d2b5[_0x0d27('0xe')];this[_0x0d27('0xf')]=_0x31cd15['name'];this['calleridnum']=_0x31cd15[_0x0d27('0x10')];this[_0x0d27('0x11')]=_0x31cd15['starttime'];this['responsetime']=_0x31cd15[_0x0d27('0x12')];this[_0x0d27('0x13')]=_0x31cd15['droptime'];this[_0x0d27('0x14')]=_0x31cd15[_0x0d27('0x14')];this['endtime']=this[_0x0d27('0x13')];this[_0x0d27('0x15')]=utils[_0x0d27('0x16')](_0x31cd15['responsetime'],_0x31cd15['starttime']);this[_0x0d27('0x17')]=utils[_0x0d27('0x16')](this[_0x0d27('0x13')],_0x31cd15['responsetime']);this[_0x0d27('0x18')]=0x0;this['queue']=_0x42d2b5[_0x0d27('0x19')];this[_0x0d27('0x1a')]=_0x42d2b5[_0x0d27('0x1b')];this[_0x0d27('0x1c')]=_0x42d2b5[_0x0d27('0x1c')];this[_0x0d27('0x1d')]=_0x31cd15['callback'];this[_0x0d27('0x1e')]=_0x31cd15[_0x0d27('0x1e')];this[_0x0d27('0x1f')]=_0x31cd15[_0x0d27('0x1f')];this[_0x0d27('0x20')]=_0x31cd15['recallme'];this[_0x0d27('0x21')]=_0x31cd15['ContactId'];this['ListId']=_0x31cd15[_0x0d27('0x22')];this[_0x0d27('0x23')]=_0x31cd15[_0x0d27('0x23')];this[_0x0d27('0x24')]=_0x31cd15[_0x0d27('0x24')];this['CampaignId']=_0x31cd15[_0x0d27('0x25')];this[_0x0d27('0x26')]=_0x31cd15[_0x0d27('0x26')]||'';this[_0x0d27('0x27')]=_0x31cd15[_0x0d27('0x27')]||'';this[_0x0d27('0x28')]=_0x31cd15[_0x0d27('0x28')];this[_0x0d27('0x29')]=_0x31cd15[_0x0d27('0x29')];this[_0x0d27('0x2a')]=_0x31cd15[_0x0d27('0x2a')];}module[_0x0d27('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 756142f..03a36d6 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['[countReScheduled]','countReScheduled','[rescheduleContact]','unlockContact','[moveContactManagedDialer]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','[createHistory]','createHistory','util','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','catch','error','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xee2f('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0xee2f('0x1'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xee2f('0x2'));var cmHopperHistory=require(_0xee2f('0x3'));function inspectError(_0xe5ad8a){return util[_0xee2f('0x4')](_0xe5ad8a,{'showHidden':![],'depth':null});}function getContactDialer(_0xcb45e6,_0x4ba89f,_0x311a2f){return cmHopper[_0xee2f('0x5')](_0xcb45e6['id'],_0x4ba89f,_0x311a2f,_0xcb45e6['dialOrderByScheduledAt'])[_0xee2f('0x6')](function(_0x2e1c8c){_0xcb45e6['temp']=0x0;logger[_0xee2f('0x7')]('[getContactDialer]',inspectError(_0x2e1c8c));});}exports[_0xee2f('0x5')]=getContactDialer;function getContactDialerIvr(_0x36920f,_0x53f7dd){return cmHopper[_0xee2f('0x8')](_0x36920f['id'],_0x53f7dd,_0x36920f[_0xee2f('0x9')])['catch'](function(_0x5597ea){_0x36920f['temp']=0x0;logger['error'](_0xee2f('0xa'),inspectError(_0x5597ea));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x481ea7){return cmHopper['countReScheduled'](_0x481ea7)[_0xee2f('0x6')](function(_0x346dbc){logger[_0xee2f('0x7')](_0xee2f('0xb'),inspectError(_0x346dbc));});}exports[_0xee2f('0xc')]=countReScheduled;function rescheduleContact(_0x3ab91f){return cmHopper['rescheduleContact'](_0x3ab91f)[_0xee2f('0x6')](function(_0x531c3a){logger[_0xee2f('0x7')](_0xee2f('0xd'),inspectError(_0x531c3a));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x445ba8,_0x145241,_0x28b614){return cmHopper[_0xee2f('0xe')](_0x445ba8,_0x145241,_0x28b614)[_0xee2f('0x6')](function(_0x58f42a){logger[_0xee2f('0x7')]('[unlockContact]',inspectError(_0x58f42a));});}exports[_0xee2f('0xe')]=unlockContact;function moveContactManagedDialer(_0x3359ff){return cmHopper['moveContactManagedDialer'](_0x3359ff)['catch'](function(_0x40b5bc){logger['error'](_0xee2f('0xf'),inspectError(_0x40b5bc));});}exports[_0xee2f('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0x28549d){return cmHopperBlack['checkIsBlackList'](_0x28549d)[_0xee2f('0x6')](function(_0x1e70aa){logger[_0xee2f('0x7')](_0xee2f('0x11'),inspectError(_0x1e70aa));});}exports[_0xee2f('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x5d36d4){return cmHopperBlack['checkIsBlackListIvr'](_0x5d36d4)[_0xee2f('0x6')](function(_0x3a1852){logger[_0xee2f('0x7')](_0xee2f('0x13'),inspectError(_0x3a1852));});}exports[_0xee2f('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xf278cc,_0x39a39c,_0x4d68d3){return cmHopperAdditionalPhone[_0xee2f('0x15')](_0xf278cc,_0x39a39c,_0x4d68d3)[_0xee2f('0x6')](function(_0x15ceda){logger[_0xee2f('0x7')](_0xee2f('0x16'),inspectError(_0x15ceda));});}exports[_0xee2f('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x15a1b1,_0x13013f,_0x382174){return cmHopperAdditionalPhone[_0xee2f('0x17')](_0x15a1b1,_0x13013f,_0x382174)[_0xee2f('0x6')](function(_0x168adc){logger[_0xee2f('0x7')](_0xee2f('0x18'),inspectError(_0x168adc));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x4ef690){return cmHopperHistory['avgHandleTime'](_0x4ef690)[_0xee2f('0x6')](function(_0x18ff19){logger[_0xee2f('0x7')](_0xee2f('0x19'),inspectError(_0x18ff19));});}exports[_0xee2f('0x1a')]=avgHandleTime;function createHistory(_0x3737fd){return cmHopperHistory['createHistory'](_0x3737fd)[_0xee2f('0x6')](function(_0x52e1fa){logger[_0xee2f('0x7')](_0xee2f('0x1b'),inspectError(_0x52e1fa));});}exports[_0xee2f('0x1c')]=createHistory; \ No newline at end of file +var _0xf61e=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xf61e,0x191));var _0xef61=function(_0xdd6e6c,_0x377421){_0xdd6e6c=_0xdd6e6c-0x0;var _0xe6dfaa=_0xf61e[_0xdd6e6c];return _0xe6dfaa;};'use strict';var util=require(_0xef61('0x0'));var logger=require(_0xef61('0x1'))(_0xef61('0x2'));var cmHopper=require(_0xef61('0x3'));var cmHopperAdditionalPhone=require(_0xef61('0x4'));var cmHopperBlack=require(_0xef61('0x5'));var cmHopperHistory=require(_0xef61('0x6'));function inspectError(_0x40509e){return util[_0xef61('0x7')](_0x40509e,{'showHidden':![],'depth':null});}function getContactDialer(_0x14122a,_0x239fa9,_0x45a18d){return cmHopper['getContactDialer'](_0x14122a['id'],_0x239fa9,_0x45a18d,_0x14122a[_0xef61('0x8')])[_0xef61('0x9')](function(_0x4f0cc5){_0x14122a[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xc'),inspectError(_0x4f0cc5));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x47d0a7,_0x188894){return cmHopper[_0xef61('0xd')](_0x47d0a7['id'],_0x188894,_0x47d0a7[_0xef61('0x8')])[_0xef61('0x9')](function(_0x2af74c){_0x47d0a7[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xe'),inspectError(_0x2af74c));});}exports[_0xef61('0xd')]=getContactDialerIvr;function countReScheduled(_0x66e7b2){return cmHopper[_0xef61('0xf')](_0x66e7b2)[_0xef61('0x9')](function(_0x114e1f){logger[_0xef61('0xb')]('[countReScheduled]',inspectError(_0x114e1f));});}exports[_0xef61('0xf')]=countReScheduled;function rescheduleContact(_0x58d9a0){return cmHopper[_0xef61('0x10')](_0x58d9a0)[_0xef61('0x9')](function(_0x370ee0){logger[_0xef61('0xb')]('[rescheduleContact]',inspectError(_0x370ee0));});}exports[_0xef61('0x10')]=rescheduleContact;function unlockContact(_0x435beb,_0x1224c2,_0x78ff22){return cmHopper['unlockContact'](_0x435beb,_0x1224c2,_0x78ff22)[_0xef61('0x9')](function(_0xbe23a7){logger['error'](_0xef61('0x11'),inspectError(_0xbe23a7));});}exports[_0xef61('0x12')]=unlockContact;function moveContactManagedDialer(_0x36f558){return cmHopper[_0xef61('0x13')](_0x36f558)[_0xef61('0x9')](function(_0x28315a){logger[_0xef61('0xb')]('[moveContactManagedDialer]',inspectError(_0x28315a));});}exports[_0xef61('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x2c8dad){return cmHopperBlack['checkIsBlackList'](_0x2c8dad)[_0xef61('0x9')](function(_0x36966a){logger[_0xef61('0xb')](_0xef61('0x14'),inspectError(_0x36966a));});}exports[_0xef61('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x2ed61e){return cmHopperBlack[_0xef61('0x16')](_0x2ed61e)['catch'](function(_0x536e9e){logger[_0xef61('0xb')]('[checkIsBlackListIvr]',inspectError(_0x536e9e));});}exports[_0xef61('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5ae7a2,_0x488b47,_0x2f0569){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5ae7a2,_0x488b47,_0x2f0569)['catch'](function(_0xfbee94){logger[_0xef61('0xb')](_0xef61('0x17'),inspectError(_0xfbee94));});}exports[_0xef61('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5e56da,_0x16b144,_0x4e738f){return cmHopperAdditionalPhone[_0xef61('0x19')](_0x5e56da,_0x16b144,_0x4e738f)[_0xef61('0x9')](function(_0x2419a9){logger[_0xef61('0xb')](_0xef61('0x1a'),inspectError(_0x2419a9));});}exports[_0xef61('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x258b5a){return cmHopperHistory[_0xef61('0x1b')](_0x258b5a)[_0xef61('0x9')](function(_0x1ee27b){logger[_0xef61('0xb')](_0xef61('0x1c'),inspectError(_0x1ee27b));});}exports[_0xef61('0x1b')]=avgHandleTime;function createHistory(_0x63edd4){return cmHopperHistory[_0xef61('0x1d')](_0x63edd4)[_0xef61('0x9')](function(_0x39c15e){logger[_0xef61('0xb')](_0xef61('0x1e'),inspectError(_0x39c15e));});}exports[_0xef61('0x1d')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index bcbc42e..ce588b0 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x234c=['dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','IS_DISACTIVED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','outbound','dialActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','replace','random','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger'];(function(_0x2b0e78,_0x160fd5){var _0x157f98=function(_0x1b6792){while(--_0x1b6792){_0x2b0e78['push'](_0x2b0e78['shift']());}};_0x157f98(++_0x160fd5);}(_0x234c,0x140));var _0xc234=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x234c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc234('0x0'));var moment=require(_0xc234('0x1'));var util=require(_0xc234('0x2'));var logger=require(_0xc234('0x3'))(_0xc234('0x4'));var timezones=require(_0xc234('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xc234('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xc234('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xc234('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xc234('0x9'),'NULL_INTERVAL':_0xc234('0xa'),'OVERTIME_INTERVAL':_0xc234('0xb'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xc234('0xc'),'RECALL_TIMEOUT':_0xc234('0xd'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xc234('0xe'),'UNREACHABLE_TRUNK':_0xc234('0xf')};exports[_0xc234('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x50c49d){return _0x50c49d[_0xc234('0x11')]==='preview';}exports[_0xc234('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x3bd14d){return _0x3bd14d[_0xc234('0x13')]===_0xc234('0x14');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x10f57f){return _0x10f57f[_0xc234('0x13')]===_0xc234('0x15');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x5e689e){return _0x5e689e[_0xc234('0x16')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x272f26){return _0x272f26[_0xc234('0x17')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x50e753,_0x3d21c1){var _0x50764d=moment(_0x50e753)[_0xc234('0x18')](0x0);var _0x32b2ac=moment(_0x3d21c1)[_0xc234('0x18')](0x0);return _0x50764d[_0xc234('0x19')](_0x32b2ac,_0xc234('0x1a'));}exports[_0xc234('0x1b')]=getSeconds;function hasQueueCampaignDataChanged(_0x32c18c,_0x15a350){var _0x15e280=![];var _0x3582f2=_0x32c18c['dialMethod']!==_0x15a350[_0xc234('0x11')]||_0x32c18c[_0xc234('0x16')]!==_0x15a350[_0xc234('0x16')]||_0x32c18c['message']!==_0x15a350[_0xc234('0x1c')];var _0x1e2d81=_0x32c18c[_0xc234('0x1d')]!==_0x15a350[_0xc234('0x1d')]||_0x32c18c[_0xc234('0x1e')]!==_0x15a350[_0xc234('0x1e')]||_0x32c18c[_0xc234('0x1f')]!==_0x15a350['loggedInDb']||_0x32c18c[_0xc234('0x20')]!==_0x15a350[_0xc234('0x20')]||_0x32c18c[_0xc234('0x21')]!==_0x15a350['talking']||_0x32c18c[_0xc234('0x22')]!==_0x15a350['pTalking']||_0x32c18c[_0xc234('0x23')]!==_0x15a350['waiting']||_0x32c18c[_0xc234('0x24')]!==_0x15a350[_0xc234('0x24')]||_0x32c18c[_0xc234('0x25')]!==_0x15a350['originated'];if(_0x32c18c[_0xc234('0x26')]&&_0x15a350[_0xc234('0x26')]){_0x15e280=_0x32c18c[_0xc234('0x26')][_0xc234('0x27')]!==_0x15a350['Trunk'][_0xc234('0x27')]||_0x32c18c['Trunk'][_0xc234('0x17')]!==_0x15a350[_0xc234('0x26')][_0xc234('0x17')];}return _0x3582f2||_0x1e2d81||_0x15e280;}exports[_0xc234('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x112e00){var _0x20663d=null;var _0x364b66=_0x112e00[_0xc234('0x29')];if(_[_0xc234('0x2a')](_0x112e00[_0xc234('0x2b')])||_[_0xc234('0x2a')](_0x112e00[_0xc234('0x2c')])||_['isNil'](_0x112e00[_0xc234('0x2c')][_0xc234('0x2d')])){_0x20663d=CAMPAIGN_STATUS[_0xc234('0x2e')];}else if(_['isEmpty'](_0x112e00[_0xc234('0x2b')])||_['isEmpty'](_0x112e00[_0xc234('0x2c')][_0xc234('0x2d')])){_0x20663d=CAMPAIGN_STATUS[_0xc234('0x2f')];}else if(_0x364b66&&!timezones[_0x364b66]){_0x20663d=CAMPAIGN_STATUS[_0xc234('0x30')];}return _0x20663d;}function checkAnyValidTrunk(_0x501344,_0x3a33c0){var _0xadc80d=null;var _0x16ee42=_0xc234('0x31');var _0x3e2a5a=[_0xc234('0x32'),_0xc234('0x33')];var _0x359f1b=!![];if(_0x501344['Trunk']&&_0x501344[_0xc234('0x26')][_0xc234('0x17')]){_0x16ee42+=_0x501344['Trunk'][_0xc234('0x27')];_0xadc80d=_0x3a33c0[_0x16ee42];_0x359f1b=_0x3e2a5a[_0xc234('0x34')](_0xadc80d[_0xc234('0x35')]);}else if(_0x501344['TrunkBackup']&&_0x501344[_0xc234('0x36')]['active']){_0x16ee42+=_0x501344[_0xc234('0x36')]['name'];_0xadc80d=_0x3a33c0[_0x16ee42];_0x359f1b=_0x3e2a5a[_0xc234('0x34')](_0xadc80d[_0xc234('0x35')]);}return _0x359f1b;}function getQueueCampaignStatusMessage(_0x3a13a8,_0x4b912f){var _0x5da951=CAMPAIGN_STATUS['ACTIVE'];var _0x4a7a7b=isPreviewCampaign(_0x3a13a8);if(!isQueueCampaignActive(_0x3a13a8)){if(_0x4a7a7b){_0x5da951=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3a13a8[_0xc234('0x25')]===0x0&&_0x3a13a8[_0xc234('0x21')]===0x0&&_0x3a13a8[_0xc234('0x23')]===0x0&&(_0x3a13a8[_0xc234('0x22')]||0x0)===0x0){_0x5da951=CAMPAIGN_STATUS[_0xc234('0x37')];}else{_0x5da951=CAMPAIGN_STATUS[_0xc234('0x38')];}}}else if(_0x3a13a8[_0xc234('0x1e')]===0x0){_0x5da951=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x3a13a8,_0x4b912f)){_0x5da951=CAMPAIGN_STATUS[_0xc234('0x39')];}else if(!isPreviewCampaign(_0x3a13a8)){var _0x1cc0dc=checkAnyValidQueueCampaignInterval(_0x3a13a8);if(_0x1cc0dc){_0x5da951=_0x1cc0dc;}}return _0x5da951;}exports[_0xc234('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xe2b103){var _0x151ba4=CAMPAIGN_STATUS[_0xc234('0x38')];if(_0xe2b103[_0xc234('0x25')]===0x0&&_0xe2b103['talking']===0x0&&_0xe2b103[_0xc234('0x23')]===0x0&&(_0xe2b103[_0xc234('0x22')]||0x0)===0x0){_0x151ba4=CAMPAIGN_STATUS[_0xc234('0x37')];}return _0x151ba4;}exports[_0xc234('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x59fb5a){var _0x5ece26=_0x59fb5a[_0xc234('0x3c')](/"(.*?)"/);return _0x5ece26?_0x5ece26[0x1]:_0x59fb5a;}exports[_0xc234('0x3d')]=extractCalleridName;function getCallerId(_0x3381bd,_0x18557f,_0x13e7d5){if(!_[_0xc234('0x3e')](_0x13e7d5)&&typeof _0x13e7d5===_0xc234('0x3f')&&!_[_0xc234('0x40')](_0x13e7d5)){if(!_[_0xc234('0x3e')](_0x18557f)&&typeof _0x18557f==='string'&&!_['isEmpty'](_0x18557f)){return util[_0xc234('0x41')]('\x22%s\x22\x20<%s>',_0x18557f,_0x13e7d5);}return util[_0xc234('0x41')](_0xc234('0x42'),_0x13e7d5,_0x13e7d5);}if(!_[_0xc234('0x3e')](_0x3381bd)&&typeof _0x3381bd===_0xc234('0x3f')&&!_[_0xc234('0x40')](_0x3381bd)){return _0x3381bd;}return _0xc234('0x43');}exports[_0xc234('0x44')]=getCallerId;function getCallerIdRandom(_0x52d789,_0x3a8b4a){var _0x19dd4f;var _0x1bebd8;var _0x184f92;if(_0x3a8b4a<=0x0){_0x3a8b4a=0x1;}_0x19dd4f=new RegExp('\x5cw{0,'+_0x3a8b4a+'}$');_0x1bebd8=Math['pow'](0xa,_0x3a8b4a-0x1);_0x184f92=Math['pow'](0xa,_0x3a8b4a)-0x1;return util[_0xc234('0x41')]('%s',_[_0xc234('0x45')](_0x52d789,_0x19dd4f,_[_0xc234('0x46')](_0x1bebd8,_0x184f92)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x460730){if(_0x460730[_0xc234('0x25')]&&_0x460730['originated']>0x0){_0x460730[_0xc234('0x25')]-=0x1;}else{logger[_0xc234('0x47')](_0xc234('0x48'));}}exports[_0xc234('0x49')]=decrementOriginate;function checkContactEmpty(_0x25ae79){return _0x25ae79&&_0x25ae79[_0xc234('0x4a')]>0x0;}exports[_0xc234('0x4b')]=checkContactEmpty;function erlangb(_0x1c2119,_0x378f7e){if(_0x378f7e===0x0){return 0x0;}var _0x297a6c=0x1;for(var _0x19e2c2=0x1;_0x19e2c2<=_0x378f7e;_0x19e2c2+=0x1){_0x297a6c=0x1+_0x297a6c*_0x19e2c2/_0x1c2119;}return 0x1/_0x297a6c;}exports[_0xc234('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x533b7c,_0x1f421c,_0x129e66){if(_0x1f421c>_0x129e66){for(var _0x19ff1a=0x0;_0x19ff1a<_0x1f421c-_0x129e66;_0x19ff1a+=0x1){decrementOriginate(_0x533b7c);}}}exports[_0xc234('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4b8391){var _0x415fb8={};var _0x234e99=['id','createdAt','description',_0xc234('0x4e'),'updatedAt'];if(_0x4b8391){for(var _0x4e0354 in _0x4b8391){if(typeof _0x4b8391[_0x4e0354]!=='undefined'){if(!_[_0xc234('0x2a')](_0x4b8391[_0x4e0354])&&!_0x234e99['includes'](_0x4e0354)){_0x415fb8[util['format']('%s%s','XMD-',_0x4e0354[_0xc234('0x4f')]())]=_0x4b8391[_0x4e0354];}}}}return _0x415fb8;}exports[_0xc234('0x50')]=setXMDContactVariables; \ No newline at end of file +var _0xbfe9=['IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignActiveStatusMessage','match','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','%s%s','XMD-','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED'];(function(_0x40959a,_0x30a483){var _0x3f5b61=function(_0x31944){while(--_0x31944){_0x40959a['push'](_0x40959a['shift']());}};_0x3f5b61(++_0x30a483);}(_0xbfe9,0xa4));var _0x9bfe=function(_0x51be01,_0x46add5){_0x51be01=_0x51be01-0x0;var _0x2606e1=_0xbfe9[_0x51be01];return _0x2606e1;};'use strict';var _=require(_0x9bfe('0x0'));var moment=require(_0x9bfe('0x1'));var util=require(_0x9bfe('0x2'));var logger=require(_0x9bfe('0x3'))(_0x9bfe('0x4'));var timezones=require(_0x9bfe('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x9bfe('0x6'),'BLACKLIST':_0x9bfe('0x7'),'CONTACTS_RESCHEDULED':_0x9bfe('0x8'),'DEACTIVATED':_0x9bfe('0x9'),'DISACTIVED':_0x9bfe('0xa'),'EMPTY_INTERVAL':_0x9bfe('0xb'),'INACTIVE':_0x9bfe('0xc'),'NO_AGENTS_LOGGED':_0x9bfe('0xd'),'NO_AVAILABLE_CONTACTS':_0x9bfe('0xe'),'NULL_INTERVAL':_0x9bfe('0xf'),'OVERTIME_INTERVAL':_0x9bfe('0x10'),'OVERTIME_GLOBAL_INTERVAL':_0x9bfe('0x11'),'QUEUE_RECALL':_0x9bfe('0x12'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x9bfe('0x13'),'UNREACHABLE_TRUNK':_0x9bfe('0x14')};exports[_0x9bfe('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xa4545e){return _0xa4545e['dialMethod']===_0x9bfe('0x16');}exports[_0x9bfe('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x4babe4){return _0x4babe4[_0x9bfe('0x18')]===_0x9bfe('0x19');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x374b5a){return _0x374b5a[_0x9bfe('0x18')]===_0x9bfe('0x1a');}exports[_0x9bfe('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0x31eb2b){return _0x31eb2b[_0x9bfe('0x1c')];}exports[_0x9bfe('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x22bf58){return _0x22bf58[_0x9bfe('0x1e')];}exports[_0x9bfe('0x1f')]=isIVRCampaignActive;function getSeconds(_0x181cf5,_0x24e75a){var _0x5a64dc=moment(_0x181cf5)['milliseconds'](0x0);var _0x437e0e=moment(_0x24e75a)['milliseconds'](0x0);return _0x5a64dc['diff'](_0x437e0e,_0x9bfe('0x20'));}exports[_0x9bfe('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x5ee4d6,_0x14f791){var _0x1c80e6=![];var _0x39fc8a=_0x5ee4d6[_0x9bfe('0x22')]!==_0x14f791['dialMethod']||_0x5ee4d6[_0x9bfe('0x1c')]!==_0x14f791['dialActive']||_0x5ee4d6['message']!==_0x14f791[_0x9bfe('0x23')];var _0x366e5a=_0x5ee4d6['available']!==_0x14f791[_0x9bfe('0x24')]||_0x5ee4d6[_0x9bfe('0x25')]!==_0x14f791[_0x9bfe('0x25')]||_0x5ee4d6[_0x9bfe('0x26')]!==_0x14f791[_0x9bfe('0x26')]||_0x5ee4d6[_0x9bfe('0x27')]!==_0x14f791['paused']||_0x5ee4d6[_0x9bfe('0x28')]!==_0x14f791['talking']||_0x5ee4d6['pTalking']!==_0x14f791[_0x9bfe('0x29')]||_0x5ee4d6['waiting']!==_0x14f791[_0x9bfe('0x2a')]||_0x5ee4d6[_0x9bfe('0x2b')]!==_0x14f791['inUse']||_0x5ee4d6[_0x9bfe('0x2c')]!==_0x14f791[_0x9bfe('0x2c')];if(_0x5ee4d6['Trunk']&&_0x14f791['Trunk']){_0x1c80e6=_0x5ee4d6[_0x9bfe('0x2d')][_0x9bfe('0x2e')]!==_0x14f791[_0x9bfe('0x2d')][_0x9bfe('0x2e')]||_0x5ee4d6[_0x9bfe('0x2d')][_0x9bfe('0x1e')]!==_0x14f791[_0x9bfe('0x2d')][_0x9bfe('0x1e')];}return _0x39fc8a||_0x366e5a||_0x1c80e6;}exports[_0x9bfe('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x116cf1){var _0x9f8e1b=null;var _0xf7c3b9=_0x116cf1[_0x9bfe('0x30')];if(_[_0x9bfe('0x31')](_0x116cf1[_0x9bfe('0x32')])||_[_0x9bfe('0x31')](_0x116cf1[_0x9bfe('0x33')])||_[_0x9bfe('0x31')](_0x116cf1['Interval']['Intervals'])){_0x9f8e1b=CAMPAIGN_STATUS[_0x9bfe('0x34')];}else if(_[_0x9bfe('0x35')](_0x116cf1['dialGlobalInterval'])||_[_0x9bfe('0x35')](_0x116cf1[_0x9bfe('0x33')][_0x9bfe('0x36')])){_0x9f8e1b=CAMPAIGN_STATUS[_0x9bfe('0x37')];}else if(_0xf7c3b9&&!timezones[_0xf7c3b9]){_0x9f8e1b=CAMPAIGN_STATUS[_0x9bfe('0x38')];}return _0x9f8e1b;}function checkAnyValidTrunk(_0x2e54b7,_0x36c3c8){var _0x2caf1e=null;var _0x5a536d=_0x9bfe('0x39');var _0x5110a7=['reachable','unmonitored'];var _0x2851fb=!![];if(_0x2e54b7[_0x9bfe('0x2d')]&&_0x2e54b7[_0x9bfe('0x2d')][_0x9bfe('0x1e')]){_0x5a536d+=_0x2e54b7[_0x9bfe('0x2d')][_0x9bfe('0x2e')];_0x2caf1e=_0x36c3c8[_0x5a536d];_0x2851fb=_0x5110a7[_0x9bfe('0x3a')](_0x2caf1e['status']);}else if(_0x2e54b7[_0x9bfe('0x3b')]&&_0x2e54b7[_0x9bfe('0x3b')][_0x9bfe('0x1e')]){_0x5a536d+=_0x2e54b7['TrunkBackup'][_0x9bfe('0x2e')];_0x2caf1e=_0x36c3c8[_0x5a536d];_0x2851fb=_0x5110a7[_0x9bfe('0x3a')](_0x2caf1e[_0x9bfe('0x3c')]);}return _0x2851fb;}function getQueueCampaignStatusMessage(_0x2ea48d,_0x5097ad){var _0x46ce02=CAMPAIGN_STATUS['ACTIVE'];var _0xa06fb2=isPreviewCampaign(_0x2ea48d);if(!isQueueCampaignActive(_0x2ea48d)){if(_0xa06fb2){_0x46ce02=CAMPAIGN_STATUS[_0x9bfe('0x3d')];}else{if(_0x2ea48d['originated']===0x0&&_0x2ea48d[_0x9bfe('0x28')]===0x0&&_0x2ea48d[_0x9bfe('0x2a')]===0x0&&(_0x2ea48d['pTalking']||0x0)===0x0){_0x46ce02=CAMPAIGN_STATUS['INACTIVE'];}else{_0x46ce02=CAMPAIGN_STATUS[_0x9bfe('0x3e')];}}}else if(_0x2ea48d['loggedIn']===0x0){_0x46ce02=CAMPAIGN_STATUS[_0x9bfe('0x3f')];}else if(!checkAnyValidTrunk(_0x2ea48d,_0x5097ad)){_0x46ce02=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x2ea48d)){var _0x5cc615=checkAnyValidQueueCampaignInterval(_0x2ea48d);if(_0x5cc615){_0x46ce02=_0x5cc615;}}return _0x46ce02;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x320945){var _0x5c0245=CAMPAIGN_STATUS[_0x9bfe('0x3e')];if(_0x320945['originated']===0x0&&_0x320945[_0x9bfe('0x28')]===0x0&&_0x320945['waiting']===0x0&&(_0x320945[_0x9bfe('0x29')]||0x0)===0x0){_0x5c0245=CAMPAIGN_STATUS['INACTIVE'];}return _0x5c0245;}exports[_0x9bfe('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4f9b3c){var _0x179d70=_0x4f9b3c[_0x9bfe('0x41')](/"(.*?)"/);return _0x179d70?_0x179d70[0x1]:_0x4f9b3c;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x44231d,_0xd89be6,_0xe0f034){if(!_[_0x9bfe('0x42')](_0xe0f034)&&typeof _0xe0f034==='string'&&!_[_0x9bfe('0x35')](_0xe0f034)){if(!_[_0x9bfe('0x42')](_0xd89be6)&&typeof _0xd89be6===_0x9bfe('0x43')&&!_[_0x9bfe('0x35')](_0xd89be6)){return util['format'](_0x9bfe('0x44'),_0xd89be6,_0xe0f034);}return util[_0x9bfe('0x45')](_0x9bfe('0x44'),_0xe0f034,_0xe0f034);}if(!_['isUndefined'](_0x44231d)&&typeof _0x44231d==='string'&&!_[_0x9bfe('0x35')](_0x44231d)){return _0x44231d;}return _0x9bfe('0x46');}exports[_0x9bfe('0x47')]=getCallerId;function getCallerIdRandom(_0x4b0136,_0x1a33be){var _0x5e7e6e;var _0xffb04b;var _0xad2f9d;if(_0x1a33be<=0x0){_0x1a33be=0x1;}_0x5e7e6e=new RegExp(_0x9bfe('0x48')+_0x1a33be+'}$');_0xffb04b=Math[_0x9bfe('0x49')](0xa,_0x1a33be-0x1);_0xad2f9d=Math[_0x9bfe('0x49')](0xa,_0x1a33be)-0x1;return util['format']('%s',_[_0x9bfe('0x4a')](_0x4b0136,_0x5e7e6e,_[_0x9bfe('0x4b')](_0xffb04b,_0xad2f9d)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x243382){if(_0x243382[_0x9bfe('0x2c')]&&_0x243382['originated']>0x0){_0x243382[_0x9bfe('0x2c')]-=0x1;}else{logger[_0x9bfe('0x4c')](_0x9bfe('0x4d'));}}exports[_0x9bfe('0x4e')]=decrementOriginate;function checkContactEmpty(_0x4abdf9){return _0x4abdf9&&_0x4abdf9[_0x9bfe('0x4f')]>0x0;}exports[_0x9bfe('0x50')]=checkContactEmpty;function erlangb(_0x4c28bd,_0x551967){if(_0x551967===0x0){return 0x0;}var _0x262e26=0x1;for(var _0x4c7597=0x1;_0x4c7597<=_0x551967;_0x4c7597+=0x1){_0x262e26=0x1+_0x262e26*_0x4c7597/_0x4c28bd;}return 0x1/_0x262e26;}exports[_0x9bfe('0x51')]=erlangb;function checkContactLowerLimitOriginate(_0x56365e,_0x8043a8,_0x2ed0bc){if(_0x8043a8>_0x2ed0bc){for(var _0x7e4e4d=0x0;_0x7e4e4d<_0x8043a8-_0x2ed0bc;_0x7e4e4d+=0x1){decrementOriginate(_0x56365e);}}}exports[_0x9bfe('0x52')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4bf713){var _0x12a111={};var _0x7c83cd=['id',_0x9bfe('0x53'),'description',_0x9bfe('0x54'),'updatedAt'];if(_0x4bf713){for(var _0x554695 in _0x4bf713){if(typeof _0x4bf713[_0x554695]!=='undefined'){if(!_[_0x9bfe('0x31')](_0x4bf713[_0x554695])&&!_0x7c83cd[_0x9bfe('0x3a')](_0x554695)){_0x12a111[util[_0x9bfe('0x45')](_0x9bfe('0x55'),_0x9bfe('0x56'),_0x554695['toUpperCase']())]=_0x4bf713[_0x554695];}}}}return _0x12a111;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0b806dc..d1fdfc1 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(_0x241865,_0x2ffc60){var _0x135ff3=function(_0x153af5){while(--_0x153af5){_0x241865['push'](_0x241865['shift']());}};_0x135ff3(++_0x2ffc60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x11d8cf,_0x404f6a){var _0x3288f6=function(_0x41e33e){while(--_0x41e33e){_0x11d8cf['push'](_0x11d8cf['shift']());}};_0x3288f6(++_0x404f6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 5e6dd65..bef6f7f 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 _0x7321=['../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','receivefax','syncReceiveFax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20receiveFax\x20','merge','pick','response','reason','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','stringify','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment'];(function(_0x5ed227,_0x3931eb){var _0x52ed79=function(_0x4140f4){while(--_0x4140f4){_0x5ed227['push'](_0x5ed227['shift']());}};_0x52ed79(++_0x3931eb);}(_0x7321,0x14f));var _0x1732=function(_0x134ee6,_0x1419ae){_0x134ee6=_0x134ee6-0x0;var _0x35debc=_0x7321[_0x134ee6];return _0x35debc;};'use strict';var util=require(_0x1732('0x0'));var _=require(_0x1732('0x1'));var BPromise=require(_0x1732('0x2'));var uuid=require('uuid');var moment=require(_0x1732('0x3'));var path=require(_0x1732('0x4'));var tiff2pdf=require(_0x1732('0x5'));var gs=require(_0x1732('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0x1732('0x7'));var rpcDb=require(_0x1732('0x8'));var Channel=require(_0x1732('0x9'));var ut=require(_0x1732('0xa'));var Action=require(_0x1732('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x1732('0xc'));var faxMessage=require(_0x1732('0xd'));function Fax(_0x1953af){this[_0x1732('0xe')]={};this[_0x1732('0xf')]=_0x1953af[_0x1732('0xf')];this[_0x1732('0x10')]=_0x1953af[_0x1732('0x10')];this['actions']={};ami['on'](_0x1732('0x11'),this[_0x1732('0x12')][_0x1732('0x13')](this));ami['on'](_0x1732('0x14'),this[_0x1732('0x15')][_0x1732('0x13')](this));ami['on']('newstate',this[_0x1732('0x16')][_0x1732('0x13')](this));ami['on'](_0x1732('0x17'),this[_0x1732('0x18')][_0x1732('0x13')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x1732('0x13')](this));ami['on'](_0x1732('0x19'),this[_0x1732('0x1a')][_0x1732('0x13')](this));ami['on'](_0x1732('0x1b'),this['syncHangup']['bind'](this));ami['on'](_0x1732('0x1c'),this['syncOriginateResponse'][_0x1732('0x13')](this));}Fax[_0x1732('0x1d')][_0x1732('0x12')]=function(_0x5572bc){if(_0x5572bc[_0x1732('0x1e')]===_0x1732('0x1f')){for(var _0x2a2463 in this['faxAccounts']){if(this['faxAccounts'][_0x1732('0x20')](_0x2a2463)){if(_0x5572bc[_0x1732('0x21')]===this[_0x1732('0xf')][_0x2a2463][_0x1732('0x22')]){this[_0x1732('0xe')][_0x5572bc[_0x1732('0x23')]]={};this[_0x1732('0xe')][_0x5572bc['uniqueid']][_0x1732('0x24')]=_0x5572bc[_0x1732('0x24')];this[_0x1732('0xe')][_0x5572bc[_0x1732('0x23')]]['id']=this[_0x1732('0xf')][_0x2a2463]['id'];this[_0x1732('0xe')][_0x5572bc[_0x1732('0x23')]][_0x1732('0x25')]=this[_0x1732('0xf')][_0x2a2463][_0x1732('0x25')];logger[_0x1732('0x26')](_0x5572bc[_0x1732('0x23')],_0x1732('0x27'));}}}}if(this[_0x1732('0x28')][_0x5572bc[_0x1732('0x23')]]){this[_0x1732('0xe')][_0x5572bc[_0x1732('0x23')]]={};this[_0x1732('0xe')][_0x5572bc[_0x1732('0x23')]][_0x1732('0x24')]=_0x5572bc[_0x1732('0x24')];logger[_0x1732('0x26')](_0x5572bc[_0x1732('0x23')],_0x1732('0x27'));}};Fax[_0x1732('0x1d')][_0x1732('0x15')]=function(_0x6cefa2){if(this[_0x1732('0xe')][_0x6cefa2[_0x1732('0x23')]]){for(var _0x5b68d2 in _0x6cefa2[_0x1732('0x29')]){if(_0x6cefa2['variable'][_0x1732('0x20')](_0x5b68d2)){this[_0x1732('0xe')][_0x6cefa2[_0x1732('0x23')]][_0x5b68d2]=_0x6cefa2[_0x1732('0x2a')];}}}};Fax[_0x1732('0x1d')]['syncNewState']=function(_0x377a04){if(this[_0x1732('0xe')][_0x377a04[_0x1732('0x23')]]){this[_0x1732('0xe')][_0x377a04[_0x1732('0x23')]][_0x1732('0x2b')]=_0x377a04[_0x1732('0x2b')];this['channels'][_0x377a04[_0x1732('0x23')]][_0x1732('0x2c')]=_0x377a04[_0x1732('0x2c')];}};Fax[_0x1732('0x1d')]['syncNewExten']=function(_0x38fde2){if(this[_0x1732('0xe')][_0x38fde2['uniqueid']]){for(var _0x302c50 in _0x38fde2[_0x1732('0x29')]){if(_0x38fde2[_0x1732('0x29')][_0x1732('0x20')](_0x302c50)){this['channels'][_0x38fde2[_0x1732('0x23')]][_0x302c50]=_0x38fde2[_0x1732('0x2a')];}}}};Fax[_0x1732('0x1d')][_0x1732('0x2d')]=function(_0x424e82){if(this[_0x1732('0xe')][_0x424e82[_0x1732('0x23')]]){this[_0x1732('0xe')][_0x424e82[_0x1732('0x23')]]['operation']=_0x424e82[_0x1732('0x2e')];this[_0x1732('0xe')][_0x424e82[_0x1732('0x23')]][_0x1732('0x2f')]=_0x424e82[_0x1732('0x2f')];this['channels'][_0x424e82[_0x1732('0x23')]][_0x1732('0x22')]=_0x424e82['localstationid'];this[_0x1732('0xe')][_0x424e82['uniqueid']][_0x1732('0x30')]=_0x424e82[_0x1732('0x30')];logger[_0x1732('0x26')](_0x424e82[_0x1732('0x23')],_0x1732('0x31'));}};Fax['prototype'][_0x1732('0x1a')]=function(_0x2d07fd){var _0x419b13=this;if(this['channels'][_0x2d07fd[_0x1732('0x23')]]){var _0x55cae9=this['channels'][_0x2d07fd[_0x1732('0x23')]]['id'];this[_0x1732('0xe')][_0x2d07fd[_0x1732('0x23')]]['remotestationid']=_0x2d07fd[_0x1732('0x32')];this[_0x1732('0xe')][_0x2d07fd[_0x1732('0x23')]][_0x1732('0x33')]=_0x2d07fd[_0x1732('0x33')];this[_0x1732('0xe')][_0x2d07fd['uniqueid']]['localstationid']=_0x2d07fd[_0x1732('0x22')];this[_0x1732('0xe')][_0x2d07fd[_0x1732('0x23')]]['resolution']=_0x2d07fd[_0x1732('0x34')];this[_0x1732('0xe')][_0x2d07fd['uniqueid']][_0x1732('0x35')]=_0x2d07fd[_0x1732('0x35')];this[_0x1732('0xe')][_0x2d07fd['uniqueid']][_0x1732('0x30')]=_0x2d07fd[_0x1732('0x30')];this[_0x1732('0xe')][_0x2d07fd[_0x1732('0x23')]][_0x1732('0x36')]=_0x2d07fd[_0x1732('0x36')];if(this['channels'][_0x2d07fd[_0x1732('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x2d07fd[_0x1732('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x515e8a){logger['info'](_0x2d07fd['uniqueid'],_0x1732('0x37'),_0x515e8a[_0x1732('0x38')]);attachment[_0x1732('0x39')]({'name':path['parse'](_0x2d07fd[_0x1732('0x30')])[_0x1732('0x25')],'basename':path[_0x1732('0x3a')](_0x2d07fd[_0x1732('0x30')])['name']+_0x1732('0x3b'),'type':_0x1732('0x3c')})[_0x1732('0x3d')](function(_0x426b29){faxAccount[_0x1732('0x3e')](_0x55cae9,{'from':_0x2d07fd['calleridnum'],'mapKey':_0x1732('0x3f'),'body':path['parse'](_0x2d07fd[_0x1732('0x30')])[_0x1732('0x25')]+_0x1732('0x3b'),'AttachmentId':_0x426b29['id']})[_0x1732('0x40')](function(_0x4c0467){logger[_0x1732('0x41')](_0x2d07fd[_0x1732('0x23')],'\x20notify\x20',JSON['stringify'](_0x4c0467));});})['catch'](function(_0x8fd764){logger['error'](_0x2d07fd[_0x1732('0x23')],_0x1732('0x42'),JSON['stringify'](_0x8fd764));});});}logger['info'](_0x2d07fd[_0x1732('0x23')],_0x1732('0x42'));}};Fax[_0x1732('0x1d')]['syncOriginateResponse']=function(_0x1f0146){if(this[_0x1732('0x28')][_0x1f0146[_0x1732('0x23')]]){_[_0x1732('0x43')](this[_0x1732('0xe')][_0x1f0146[_0x1732('0x23')]],_[_0x1732('0x44')](_0x1f0146,[_0x1732('0x45'),_0x1732('0x46')]));}};function updateStatus(_0x4a3158){if(_0x4a3158['AttachmentId']){faxMessage['update'](_0x4a3158['AttachmentId'],{'failMessage':_0x1732('0x47')})[_0x1732('0x3d')](function(_0x285dd1){ut[_0x1732('0x48')]('[Fax][Message][Error][Updated]',_0x285dd1);})[_0x1732('0x40')](function(_0x32b0f1){ut[_0x1732('0x48')](_0x1732('0x49'),_0x32b0f1);});}else{ut[_0x1732('0x48')](_0x1732('0x4a'));}}Fax[_0x1732('0x1d')][_0x1732('0x4b')]=function(_0x3d77b6,_0x511abe,_0x36f80b){var _0x15e70a=this;var _0x476ac1={};if(_0x511abe){_0x476ac1={'read':_0x511abe};}else{_0x476ac1={'failMessage':_0x36f80b};}if(this[_0x1732('0x28')][_0x3d77b6][_0x1732('0x4c')]){faxMessage['update'](this['actions'][_0x3d77b6][_0x1732('0x4c')],_0x476ac1)[_0x1732('0x3d')](function(_0x1077c9){ut['logger'](_0x1732('0x4d'),_0x1077c9);})[_0x1732('0x40')](function(_0x121484){ut[_0x1732('0x48')](_0x1732('0x4e'),_0x121484);})[_0x1732('0x4f')](function(){delete _0x15e70a[_0x1732('0xe')][_0x3d77b6];delete _0x15e70a[_0x1732('0x28')][_0x3d77b6];});}else{ut[_0x1732('0x48')](_0x1732('0x50'));delete this[_0x1732('0xe')][_0x3d77b6];delete this['actions'][_0x3d77b6];}};Fax[_0x1732('0x1d')]['syncHangup']=function(_0x132be6){var _0x1f748c=this;if(this[_0x1732('0xe')][_0x132be6['uniqueid']]){if(this['actions'][_0x132be6[_0x1732('0x23')]]){this[_0x1732('0xe')][_0x132be6[_0x1732('0x23')]]['id']=this[_0x1732('0x28')][_0x132be6[_0x1732('0x23')]]['id'];this['channels'][_0x132be6[_0x1732('0x23')]][_0x1732('0x25')]=this[_0x1732('0x28')][_0x132be6[_0x1732('0x23')]][_0x1732('0x25')];}logger['info'](_0x132be6[_0x1732('0x23')],this['actions'][_0x132be6['uniqueid']]?_0x1732('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0x1732('0x52')](this[_0x1732('0xe')][_0x132be6[_0x1732('0x23')]]));if(this[_0x1732('0x28')][_0x132be6[_0x1732('0x23')]]){if(this[_0x1732('0xe')][_0x132be6[_0x1732('0x23')]][_0x1732('0x53')]>0x0&&this[_0x1732('0xe')][_0x132be6[_0x1732('0x23')]][_0x1732('0x54')]===_0x1732('0x55')){this['updateStatus'](_0x132be6[_0x1732('0x23')],!![]);}else{this[_0x1732('0x4b')](_0x132be6[_0x1732('0x23')],![],this[_0x1732('0xe')][_0x132be6[_0x1732('0x23')]][_0x1732('0x56')]?_0x1732('0x57')+this['channels'][_0x132be6[_0x1732('0x23')]][_0x1732('0x56')]:'SENDING\x20FAILED');}}}};Fax[_0x1732('0x1d')]['send']=function(_0x4b5614){var _0x2b2416=this;return new BPromise(function(_0x2c2241,_0x1d6f49){_0x2b2416['execOriginate'](_0x4b5614,_0x2b2416['faxAccounts'][_0x4b5614['FaxAccountId']])['then'](function(_0x2c9b48){ut[_0x1732('0x48')](_0x1732('0x58'),_0x2c9b48);_0x2c2241(ut[_0x1732('0x38')](_0x1732('0x59')));})[_0x1732('0x40')](function(_0x22b179){ut['logger']('[Fax][execOriginate][failure]',_0x22b179);updateStatus(_0x4b5614);_0x1d6f49(ut['message'](_0x1732('0x5a')));});});};Fax[_0x1732('0x1d')][_0x1732('0x5b')]=function(_0x7095a4){var _0x9e548=this;return new BPromise(function(_0x4bb77e,_0x5b0c35){var _0xb07ac9=_0x9e548[_0x1732('0x5c')](_0x9e548['faxAccounts'][_0x7095a4['FaxAccountId']][_0x1732('0x5d')],_0x7095a4);if(_0xb07ac9[_0x1732('0x5e')]){_0x4bb77e(ut[_0x1732('0x38')]('Trunk\x20Reachable'));}else{_0x5b0c35(ut[_0x1732('0x38')](_0xb07ac9['message']));}});};function originate(_0x1bd093,_0x3369c1,_0x47bdef){return new BPromise(function(_0x5e679f,_0x5c5f72){if(_0x47bdef){var _0x3bde72=util[_0x1732('0x5f')](_0x1732('0x60'),path[_0x1732('0x3a')](_0x1bd093[_0x1732('0x4')])[_0x1732('0x25')],_0x1bd093['path']);gs[_0x1732('0x61')](_0x3bde72)[_0x1732('0x3d')](function(){_0x1bd093['path']=util[_0x1732('0x5f')](_0x1732('0x62'),path[_0x1732('0x3a')](_0x1bd093[_0x1732('0x4')])['dir'],path[_0x1732('0x3a')](_0x1bd093[_0x1732('0x4')])[_0x1732('0x25')]);_0x3369c1[_0x1732('0x63')]=_0x1bd093[_0x1732('0x4')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x1732('0x64')](ut[_0x1732('0x65')](_0x1bd093,_0x3369c1))[_0x1732('0x3d')](function(_0x802a5c){_0x5e679f(_0x802a5c);})[_0x1732('0x40')](function(_0x2814f9){_0x5c5f72(_0x2814f9);});})[_0x1732('0x40')](function(_0xba32d4){_0x5c5f72(_0xba32d4);});}else{ami[_0x1732('0x64')](ut['variablesAction'](_0x1bd093,_0x3369c1))[_0x1732('0x3d')](function(_0xd9eb65){_0x5e679f(_0xd9eb65);})[_0x1732('0x40')](function(_0x397328){_0x5c5f72(_0x397328);});}});}Fax[_0x1732('0x1d')][_0x1732('0x66')]=function(_0x381909,_0x593a19){var _0x293060=this;return new BPromise(function(_0x19ff08,_0x2da8f){var _0x156630=uuid['v4']();var _0x2c98a5=ut[_0x1732('0x67')](_0x381909,_0x593a19);_0x293060['actions'][_0x156630]=new Action(_0x156630,_0x593a19,_0x381909);var _0x2b155f=_0x293060[_0x1732('0x28')][_0x156630];if(path[_0x1732('0x3a')](_0x381909[_0x1732('0x4')])[_0x1732('0x68')]===_0x1732('0x3b')){originate(_0x2b155f,_0x2c98a5,!![])[_0x1732('0x3d')](function(_0x3b89d9){_0x19ff08(_0x3b89d9);})[_0x1732('0x40')](function(_0x55a6fe){_0x2da8f(_0x55a6fe);});}else{originate(_0x2b155f,_0x2c98a5,![])['then'](function(_0x2c665b){_0x19ff08(_0x2c665b);})['catch'](function(_0x468e21){_0x2da8f(_0x468e21);});}});};Fax[_0x1732('0x1d')]['isTrunkReachable']=function(_0x2009c9){return!_[_0x1732('0x69')](_0x2009c9)&&!_['isNil'](_0x2009c9['name'])&&!_[_0x1732('0x69')](_0x2009c9[_0x1732('0x6a')])&&_0x2009c9[_0x1732('0x6a')]&&!_[_0x1732('0x69')](this[_0x1732('0x10')][util[_0x1732('0x5f')](_0x1732('0x6b'),_0x2009c9[_0x1732('0x25')])])&&!_[_0x1732('0x69')](this['trunks'][util['format'](_0x1732('0x6b'),_0x2009c9[_0x1732('0x25')])][_0x1732('0x2f')])&&(this[_0x1732('0x10')][util[_0x1732('0x5f')](_0x1732('0x6b'),_0x2009c9[_0x1732('0x25')])][_0x1732('0x2f')]==='reachable'||this[_0x1732('0x10')][util['format']('SIP/%s',_0x2009c9[_0x1732('0x25')])][_0x1732('0x2f')]===_0x1732('0x6c'));};Fax[_0x1732('0x1d')]['checkTrunk']=function(_0x1d0184,_0x54c653){if(!this[_0x1732('0x6d')](_0x1d0184)){ut['logger'](_0x1732('0x6e'),_[_0x1732('0x69')](_0x1d0184)?'':_0x1d0184[_0x1732('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x1732('0x6f')};}if(_[_0x1732('0x69')](_0x54c653[_0x1732('0x3f')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x54c653));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x1732('0x69')](_0x54c653[_0x1732('0x4')])){ut[_0x1732('0x48')](_0x1732('0x70'),JSON[_0x1732('0x52')](_0x54c653));return{'isValid':![],'message':_0x1732('0x71')};}return{'isValid':!![],'message':_0x1732('0x72')};};module[_0x1732('0x73')]=Fax; \ No newline at end of file +var _0xaa2d=['\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','varset','syncNewState','bind','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum'];(function(_0x1a0471,_0x2de8ce){var _0x47b336=function(_0x4ae51b){while(--_0x4ae51b){_0x1a0471['push'](_0x1a0471['shift']());}};_0x47b336(++_0x2de8ce);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xdaa2('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var path=require(_0xdaa2('0x1'));var tiff2pdf=require(_0xdaa2('0x2'));var gs=require(_0xdaa2('0x3'));var logger=require('../../../config/logger')(_0xdaa2('0x4'));var ami=require(_0xdaa2('0x5'));var rpcDb=require(_0xdaa2('0x6'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0xdaa2('0x7'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xdaa2('0x8'));var faxMessage=require(_0xdaa2('0x9'));function Fax(_0x259599){this['channels']={};this[_0xdaa2('0xa')]=_0x259599[_0xdaa2('0xa')];this[_0xdaa2('0xb')]=_0x259599[_0xdaa2('0xb')];this[_0xdaa2('0xc')]={};ami['on'](_0xdaa2('0xd'),this['syncNewchannel']['bind'](this));ami['on'](_0xdaa2('0xe'),this['syncVarSet']['bind'](this));ami['on']('newstate',this[_0xdaa2('0xf')][_0xdaa2('0x10')](this));ami['on']('newexten',this[_0xdaa2('0x11')][_0xdaa2('0x10')](this));ami['on'](_0xdaa2('0x12'),this[_0xdaa2('0x13')][_0xdaa2('0x10')](this));ami['on'](_0xdaa2('0x14'),this[_0xdaa2('0x15')][_0xdaa2('0x10')](this));ami['on'](_0xdaa2('0x16'),this[_0xdaa2('0x17')][_0xdaa2('0x10')](this));ami['on'](_0xdaa2('0x18'),this[_0xdaa2('0x19')][_0xdaa2('0x10')](this));}Fax[_0xdaa2('0x1a')][_0xdaa2('0x1b')]=function(_0x5d24b7){if(_0x5d24b7[_0xdaa2('0x1c')]==='from-voip-provider'){for(var _0x303391 in this['faxAccounts']){if(this[_0xdaa2('0xa')][_0xdaa2('0x1d')](_0x303391)){if(_0x5d24b7[_0xdaa2('0x1e')]===this['faxAccounts'][_0x303391][_0xdaa2('0x1f')]){this[_0xdaa2('0x20')][_0x5d24b7[_0xdaa2('0x21')]]={};this[_0xdaa2('0x20')][_0x5d24b7[_0xdaa2('0x21')]][_0xdaa2('0x22')]=_0x5d24b7[_0xdaa2('0x22')];this[_0xdaa2('0x20')][_0x5d24b7['uniqueid']]['id']=this[_0xdaa2('0xa')][_0x303391]['id'];this[_0xdaa2('0x20')][_0x5d24b7[_0xdaa2('0x21')]][_0xdaa2('0x23')]=this['faxAccounts'][_0x303391][_0xdaa2('0x23')];logger['info'](_0x5d24b7[_0xdaa2('0x21')],_0xdaa2('0x24'));}}}}if(this[_0xdaa2('0xc')][_0x5d24b7[_0xdaa2('0x21')]]){this[_0xdaa2('0x20')][_0x5d24b7[_0xdaa2('0x21')]]={};this[_0xdaa2('0x20')][_0x5d24b7[_0xdaa2('0x21')]]['channel']=_0x5d24b7[_0xdaa2('0x22')];logger[_0xdaa2('0x25')](_0x5d24b7['uniqueid'],_0xdaa2('0x24'));}};Fax[_0xdaa2('0x1a')][_0xdaa2('0x26')]=function(_0x212f1a){if(this['channels'][_0x212f1a[_0xdaa2('0x21')]]){for(var _0xfc982d in _0x212f1a[_0xdaa2('0x27')]){if(_0x212f1a['variable']['hasOwnProperty'](_0xfc982d)){this['channels'][_0x212f1a['uniqueid']][_0xfc982d]=_0x212f1a[_0xdaa2('0x28')];}}}};Fax[_0xdaa2('0x1a')][_0xdaa2('0xf')]=function(_0x3a8071){if(this['channels'][_0x3a8071[_0xdaa2('0x21')]]){this['channels'][_0x3a8071['uniqueid']][_0xdaa2('0x29')]=_0x3a8071[_0xdaa2('0x29')];this[_0xdaa2('0x20')][_0x3a8071[_0xdaa2('0x21')]]['channelstatedesc']=_0x3a8071[_0xdaa2('0x2a')];}};Fax[_0xdaa2('0x1a')]['syncNewExten']=function(_0x3c513a){if(this[_0xdaa2('0x20')][_0x3c513a['uniqueid']]){for(var _0x5b00a2 in _0x3c513a[_0xdaa2('0x27')]){if(_0x3c513a[_0xdaa2('0x27')][_0xdaa2('0x1d')](_0x5b00a2)){this['channels'][_0x3c513a[_0xdaa2('0x21')]][_0x5b00a2]=_0x3c513a[_0xdaa2('0x28')];}}}};Fax['prototype'][_0xdaa2('0x13')]=function(_0x253356){if(this['channels'][_0x253356['uniqueid']]){this['channels'][_0x253356[_0xdaa2('0x21')]][_0xdaa2('0x2b')]=_0x253356[_0xdaa2('0x2b')];this['channels'][_0x253356['uniqueid']][_0xdaa2('0x2c')]=_0x253356['status'];this[_0xdaa2('0x20')][_0x253356[_0xdaa2('0x21')]]['localstationid']=_0x253356[_0xdaa2('0x1f')];this[_0xdaa2('0x20')][_0x253356[_0xdaa2('0x21')]][_0xdaa2('0x2d')]=_0x253356[_0xdaa2('0x2d')];logger[_0xdaa2('0x25')](_0x253356[_0xdaa2('0x21')],_0xdaa2('0x2e'));}};Fax[_0xdaa2('0x1a')]['syncReceiveFax']=function(_0x332076){var _0x417390=this;if(this['channels'][_0x332076['uniqueid']]){var _0x1f36ba=this[_0xdaa2('0x20')][_0x332076[_0xdaa2('0x21')]]['id'];this[_0xdaa2('0x20')][_0x332076[_0xdaa2('0x21')]][_0xdaa2('0x2f')]=_0x332076[_0xdaa2('0x2f')];this['channels'][_0x332076[_0xdaa2('0x21')]][_0xdaa2('0x30')]=_0x332076[_0xdaa2('0x30')];this[_0xdaa2('0x20')][_0x332076[_0xdaa2('0x21')]][_0xdaa2('0x1f')]=_0x332076['localstationid'];this[_0xdaa2('0x20')][_0x332076[_0xdaa2('0x21')]]['resolution']=_0x332076[_0xdaa2('0x31')];this[_0xdaa2('0x20')][_0x332076[_0xdaa2('0x21')]][_0xdaa2('0x32')]=_0x332076[_0xdaa2('0x32')];this[_0xdaa2('0x20')][_0x332076['uniqueid']][_0xdaa2('0x2d')]=_0x332076['filename'];this[_0xdaa2('0x20')][_0x332076[_0xdaa2('0x21')]][_0xdaa2('0x33')]=_0x332076['calleridnum'];if(this[_0xdaa2('0x20')][_0x332076[_0xdaa2('0x21')]][_0xdaa2('0x30')]>0x0){tiff2pdf(_0x332076['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x269e98){logger[_0xdaa2('0x25')](_0x332076[_0xdaa2('0x21')],_0xdaa2('0x34'),_0x269e98[_0xdaa2('0x35')]);attachment['create']({'name':path[_0xdaa2('0x36')](_0x332076['filename'])[_0xdaa2('0x23')],'basename':path[_0xdaa2('0x36')](_0x332076[_0xdaa2('0x2d')])[_0xdaa2('0x23')]+_0xdaa2('0x37'),'type':_0xdaa2('0x38')})['then'](function(_0x4f820b){faxAccount[_0xdaa2('0x39')](_0x1f36ba,{'from':_0x332076[_0xdaa2('0x33')],'mapKey':_0xdaa2('0x4'),'body':path['parse'](_0x332076[_0xdaa2('0x2d')])['name']+_0xdaa2('0x37'),'AttachmentId':_0x4f820b['id']})[_0xdaa2('0x3a')](function(_0xb7d60f){logger['error'](_0x332076[_0xdaa2('0x21')],_0xdaa2('0x3b'),JSON[_0xdaa2('0x3c')](_0xb7d60f));});})['catch'](function(_0x3f10fa){logger[_0xdaa2('0x3d')](_0x332076[_0xdaa2('0x21')],'\x20receiveFax\x20',JSON[_0xdaa2('0x3c')](_0x3f10fa));});});}logger[_0xdaa2('0x25')](_0x332076[_0xdaa2('0x21')],_0xdaa2('0x3e'));}};Fax['prototype'][_0xdaa2('0x19')]=function(_0x1966ad){if(this[_0xdaa2('0xc')][_0x1966ad[_0xdaa2('0x21')]]){_[_0xdaa2('0x3f')](this['channels'][_0x1966ad[_0xdaa2('0x21')]],_[_0xdaa2('0x40')](_0x1966ad,['response',_0xdaa2('0x41')]));}};function updateStatus(_0x37d992){if(_0x37d992[_0xdaa2('0x42')]){faxMessage['update'](_0x37d992[_0xdaa2('0x42')],{'failMessage':_0xdaa2('0x43')})['then'](function(_0x290610){ut[_0xdaa2('0x44')](_0xdaa2('0x45'),_0x290610);})[_0xdaa2('0x3a')](function(_0x423e32){ut[_0xdaa2('0x44')](_0xdaa2('0x46'),_0x423e32);});}else{ut[_0xdaa2('0x44')](_0xdaa2('0x47'));}}Fax[_0xdaa2('0x1a')][_0xdaa2('0x48')]=function(_0x52d24d,_0x46e27c,_0x26f69b){var _0x211b10=this;var _0x4db97f={};if(_0x46e27c){_0x4db97f={'read':_0x46e27c};}else{_0x4db97f={'failMessage':_0x26f69b};}if(this['actions'][_0x52d24d][_0xdaa2('0x42')]){faxMessage['update'](this['actions'][_0x52d24d]['AttachmentId'],_0x4db97f)[_0xdaa2('0x49')](function(_0x239fb1){ut[_0xdaa2('0x44')](_0xdaa2('0x4a'),_0x239fb1);})['catch'](function(_0x5dd2ed){ut[_0xdaa2('0x44')]('[Fax][Message][NoUpdate1]',_0x5dd2ed);})[_0xdaa2('0x4b')](function(){delete _0x211b10[_0xdaa2('0x20')][_0x52d24d];delete _0x211b10[_0xdaa2('0xc')][_0x52d24d];});}else{ut[_0xdaa2('0x44')](_0xdaa2('0x4c'));delete this['channels'][_0x52d24d];delete this[_0xdaa2('0xc')][_0x52d24d];}};Fax[_0xdaa2('0x1a')][_0xdaa2('0x17')]=function(_0x2b5b74){var _0x1c48b7=this;if(this[_0xdaa2('0x20')][_0x2b5b74[_0xdaa2('0x21')]]){if(this[_0xdaa2('0xc')][_0x2b5b74[_0xdaa2('0x21')]]){this[_0xdaa2('0x20')][_0x2b5b74[_0xdaa2('0x21')]]['id']=this[_0xdaa2('0xc')][_0x2b5b74[_0xdaa2('0x21')]]['id'];this[_0xdaa2('0x20')][_0x2b5b74[_0xdaa2('0x21')]][_0xdaa2('0x23')]=this[_0xdaa2('0xc')][_0x2b5b74[_0xdaa2('0x21')]][_0xdaa2('0x23')];}logger[_0xdaa2('0x25')](_0x2b5b74[_0xdaa2('0x21')],this[_0xdaa2('0xc')][_0x2b5b74[_0xdaa2('0x21')]]?_0xdaa2('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0xdaa2('0x3c')](this[_0xdaa2('0x20')][_0x2b5b74[_0xdaa2('0x21')]]));if(this[_0xdaa2('0xc')][_0x2b5b74[_0xdaa2('0x21')]]){if(this[_0xdaa2('0x20')][_0x2b5b74[_0xdaa2('0x21')]]['faxpages']>0x0&&this[_0xdaa2('0x20')][_0x2b5b74[_0xdaa2('0x21')]][_0xdaa2('0x12')]===_0xdaa2('0x4e')){this[_0xdaa2('0x48')](_0x2b5b74['uniqueid'],!![]);}else{this[_0xdaa2('0x48')](_0x2b5b74[_0xdaa2('0x21')],![],this[_0xdaa2('0x20')][_0x2b5b74[_0xdaa2('0x21')]][_0xdaa2('0x4f')]?_0xdaa2('0x50')+this[_0xdaa2('0x20')][_0x2b5b74['uniqueid']][_0xdaa2('0x4f')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0xdaa2('0x51')]=function(_0x2428b3){var _0x45052e=this;return new BPromise(function(_0xa382fe,_0x4531a7){_0x45052e['execOriginate'](_0x2428b3,_0x45052e[_0xdaa2('0xa')][_0x2428b3[_0xdaa2('0x52')]])[_0xdaa2('0x49')](function(_0x457752){ut['logger']('[Fax][execOriginate][success]',_0x457752);_0xa382fe(ut['message'](_0xdaa2('0x53')));})[_0xdaa2('0x3a')](function(_0x296a3a){ut[_0xdaa2('0x44')](_0xdaa2('0x54'),_0x296a3a);updateStatus(_0x2428b3);_0x4531a7(ut[_0xdaa2('0x35')]('Fax\x20failed'));});});};Fax[_0xdaa2('0x1a')]['checkAfterSend']=function(_0x498a20){var _0x30b289=this;return new BPromise(function(_0x3f33ff,_0x46ba1c){var _0x26321d=_0x30b289[_0xdaa2('0x55')](_0x30b289[_0xdaa2('0xa')][_0x498a20[_0xdaa2('0x52')]][_0xdaa2('0x56')],_0x498a20);if(_0x26321d[_0xdaa2('0x57')]){_0x3f33ff(ut[_0xdaa2('0x35')](_0xdaa2('0x58')));}else{_0x46ba1c(ut['message'](_0x26321d[_0xdaa2('0x35')]));}});};function originate(_0x59bb12,_0xfa2648,_0x2fa64b){return new BPromise(function(_0x22a8cb,_0x52e245){if(_0x2fa64b){var _0x51c5be=util[_0xdaa2('0x59')]('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[_0xdaa2('0x36')](_0x59bb12[_0xdaa2('0x1')])[_0xdaa2('0x23')],_0x59bb12[_0xdaa2('0x1')]);gs[_0xdaa2('0x5a')](_0x51c5be)[_0xdaa2('0x49')](function(){_0x59bb12['path']=util[_0xdaa2('0x59')]('%s/%s.tif',path[_0xdaa2('0x36')](_0x59bb12['path'])['dir'],path['parse'](_0x59bb12['path'])[_0xdaa2('0x23')]);_0xfa2648[_0xdaa2('0x5b')]=_0x59bb12['path'];ut['logger'](_0xdaa2('0x5c'),'');ami[_0xdaa2('0x5d')](ut[_0xdaa2('0x5e')](_0x59bb12,_0xfa2648))['then'](function(_0x37fbcb){_0x22a8cb(_0x37fbcb);})['catch'](function(_0x4f19fe){_0x52e245(_0x4f19fe);});})['catch'](function(_0x543957){_0x52e245(_0x543957);});}else{ami[_0xdaa2('0x5d')](ut['variablesAction'](_0x59bb12,_0xfa2648))[_0xdaa2('0x49')](function(_0x15da90){_0x22a8cb(_0x15da90);})[_0xdaa2('0x3a')](function(_0x43aac7){_0x52e245(_0x43aac7);});}});}Fax[_0xdaa2('0x1a')][_0xdaa2('0x5f')]=function(_0x4a08e9,_0x37de8a){var _0x47b18f=this;return new BPromise(function(_0x17900f,_0x2df84e){var _0xf9089e=uuid['v4']();var _0x186ab8=ut[_0xdaa2('0x60')](_0x4a08e9,_0x37de8a);_0x47b18f[_0xdaa2('0xc')][_0xf9089e]=new Action(_0xf9089e,_0x37de8a,_0x4a08e9);var _0x480efe=_0x47b18f[_0xdaa2('0xc')][_0xf9089e];if(path[_0xdaa2('0x36')](_0x4a08e9[_0xdaa2('0x1')])[_0xdaa2('0x61')]===_0xdaa2('0x37')){originate(_0x480efe,_0x186ab8,!![])[_0xdaa2('0x49')](function(_0x361f0a){_0x17900f(_0x361f0a);})['catch'](function(_0x3725b1){_0x2df84e(_0x3725b1);});}else{originate(_0x480efe,_0x186ab8,![])['then'](function(_0x2309d7){_0x17900f(_0x2309d7);})[_0xdaa2('0x3a')](function(_0xab2b13){_0x2df84e(_0xab2b13);});}});};Fax['prototype'][_0xdaa2('0x62')]=function(_0x239b56){return!_[_0xdaa2('0x63')](_0x239b56)&&!_[_0xdaa2('0x63')](_0x239b56['name'])&&!_[_0xdaa2('0x63')](_0x239b56[_0xdaa2('0x64')])&&_0x239b56[_0xdaa2('0x64')]&&!_[_0xdaa2('0x63')](this['trunks'][util[_0xdaa2('0x59')]('SIP/%s',_0x239b56[_0xdaa2('0x23')])])&&!_['isNil'](this[_0xdaa2('0xb')][util[_0xdaa2('0x59')](_0xdaa2('0x65'),_0x239b56[_0xdaa2('0x23')])][_0xdaa2('0x2c')])&&(this[_0xdaa2('0xb')][util[_0xdaa2('0x59')]('SIP/%s',_0x239b56[_0xdaa2('0x23')])][_0xdaa2('0x2c')]===_0xdaa2('0x66')||this['trunks'][util[_0xdaa2('0x59')](_0xdaa2('0x65'),_0x239b56['name'])][_0xdaa2('0x2c')]==='unmonitored');};Fax[_0xdaa2('0x1a')]['checkTrunk']=function(_0x41502d,_0x30277e){if(!this[_0xdaa2('0x62')](_0x41502d)){ut[_0xdaa2('0x44')](_0xdaa2('0x67'),_['isNil'](_0x41502d)?'':_0x41502d['name']+_0xdaa2('0x68'));return{'isValid':![],'message':_0xdaa2('0x69')};}if(_[_0xdaa2('0x63')](_0x30277e[_0xdaa2('0x4')])){ut[_0xdaa2('0x44')](_0xdaa2('0x6a'),JSON['stringify'](_0x30277e));return{'isValid':![],'message':_0xdaa2('0x6b')};}if(_['isNil'](_0x30277e[_0xdaa2('0x1')])){ut[_0xdaa2('0x44')](_0xdaa2('0x6c'),JSON[_0xdaa2('0x3c')](_0x30277e));return{'isValid':![],'message':_0xdaa2('0x6d')};}return{'isValid':!![],'message':_0xdaa2('0x6e')};};module[_0xdaa2('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index fcf10fb..e30b309 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 _0xdbe2=['inspect','notify','then','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x56aa25,_0x4f44ea){var _0x4ab23b=function(_0x92ac21){while(--_0x92ac21){_0x56aa25['push'](_0x56aa25['shift']());}};_0x4ab23b(++_0x4f44ea);}(_0xdbe2,0x1e0));var _0x2dbe=function(_0x31d6c2,_0x422dcd){_0x31d6c2=_0x31d6c2-0x0;var _0x295dd0=_0xdbe2[_0x31d6c2];return _0x295dd0;};'use strict';var util=require(_0x2dbe('0x0'));var BPromise=require(_0x2dbe('0x1'));var logger=require(_0x2dbe('0x2'))(_0x2dbe('0x3'));var _=require(_0x2dbe('0x4'));var faxAccount=require(_0x2dbe('0x5'));function loggerCatch(_0x3a630b){return function(_0x36e3c5){logger['error'](_0x3a630b,util[_0x2dbe('0x6')](_0x36e3c5,{'showHidden':![],'depth':null}));};}exports[_0x2dbe('0x7')]=function(_0x17c899,_0x36d8a1){return BPromise['resolve']()[_0x2dbe('0x8')](faxAccount[_0x2dbe('0x7')](_0x17c899,_0x36d8a1))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xdb7c=['util','bluebird','../../../config/logger','preview','lodash','error','inspect','resolve','then','notify','catch','[Notify]\x20'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xdb7c,0xb4));var _0xcdb7=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0xdb7c[_0x403fc7];return _0x5d0827;};'use strict';var util=require(_0xcdb7('0x0'));var BPromise=require(_0xcdb7('0x1'));var logger=require(_0xcdb7('0x2'))(_0xcdb7('0x3'));var _=require(_0xcdb7('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5d68eb){return function(_0x40e70d){logger[_0xcdb7('0x5')](_0x5d68eb,util[_0xcdb7('0x6')](_0x40e70d,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x157adb,_0x5c974e){return BPromise[_0xcdb7('0x7')]()[_0xcdb7('0x8')](faxAccount[_0xcdb7('0x9')](_0x157adb,_0x5c974e))[_0xcdb7('0xa')](loggerCatch(_0xcdb7('0xb')));}; \ 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 29bc88c..dd61c21 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 _0xa836=['inspect','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xa836,0x1e1));var _0x6a83=function(_0x3ae816,_0x576dc9){_0x3ae816=_0x3ae816-0x0;var _0x56974d=_0xa836[_0x3ae816];return _0x56974d;};'use strict';var util=require('util');var logger=require(_0x6a83('0x0'))(_0x6a83('0x1'));var BPromise=require(_0x6a83('0x2'));var exec=require(_0x6a83('0x3'))[_0x6a83('0x4')];exports[_0x6a83('0x5')]=function(_0x3bf48d){return new BPromise(function(_0x3100d3,_0x2985d8){exec(_0x3bf48d,function(_0x17f2dc,_0x2e8d73,_0x4c71d1){logger[_0x6a83('0x6')](_0x6a83('0x7'),_0x2e8d73);if(_0x17f2dc){logger[_0x6a83('0x6')](_0x6a83('0x7'),_0x6a83('0x8'),util[_0x6a83('0x9')](_0x17f2dc,{'showHidden':![],'depth':null}),_0x2e8d73,_0x4c71d1);_0x2985d8(_0x17f2dc);}_0x3100d3(_0x2e8d73);});});}; \ No newline at end of file +var _0x2eff=['Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','exec','execute','info'];(function(_0x5f3f24,_0x44366c){var _0x3f7072=function(_0x3c13d2){while(--_0x3c13d2){_0x5f3f24['push'](_0x5f3f24['shift']());}};_0x3f7072(++_0x44366c);}(_0x2eff,0x1d7));var _0xf2ef=function(_0xc988e4,_0x4e3b13){_0xc988e4=_0xc988e4-0x0;var _0x2c9d58=_0x2eff[_0xc988e4];return _0x2c9d58;};'use strict';var util=require(_0xf2ef('0x0'));var logger=require('../../../../config/logger')(_0xf2ef('0x1'));var BPromise=require(_0xf2ef('0x2'));var exec=require('child_process')[_0xf2ef('0x3')];exports[_0xf2ef('0x4')]=function(_0x609692){return new BPromise(function(_0x282587,_0x1d7a83){exec(_0x609692,function(_0x1b46b0,_0x5b7f2d,_0x399838){logger[_0xf2ef('0x5')](_0xf2ef('0x6'),_0x5b7f2d);if(_0x1b46b0){logger[_0xf2ef('0x5')](_0xf2ef('0x6'),_0xf2ef('0x7'),util[_0xf2ef('0x8')](_0x1b46b0,{'showHidden':![],'depth':null}),_0x5b7f2d,_0x399838);_0x1d7a83(_0x1b46b0);}_0x282587(_0x5b7f2d);});});}; \ 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 0e95f62..3ee38a4 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 _0xc2e8=['localstationid','path','variablesAction','uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','fax','message','logger','inspect','addVariables','ecm','minrate','format','modem','gateway','t38timeout'];(function(_0x53c7a0,_0x41ece0){var _0x150d96=function(_0x1ba987){while(--_0x1ba987){_0x53c7a0['push'](_0x53c7a0['shift']());}};_0x150d96(++_0x41ece0);}(_0xc2e8,0x1c0));var _0x8c2e=function(_0x4f39bd,_0x376303){_0x4f39bd=_0x4f39bd-0x0;var _0x2334ac=_0xc2e8[_0x4f39bd];return _0x2334ac;};'use strict';var util=require(_0x8c2e('0x0'));var _=require(_0x8c2e('0x1'));var moment=require(_0x8c2e('0x2'));var logger=require('../../../../config/logger')(_0x8c2e('0x3'));exports[_0x8c2e('0x4')]=function(_0x3308f1){return{'message':_0x3308f1};};exports[_0x8c2e('0x5')]=function(_0x5d375e,_0x2a2d29){logger['info'](_0x5d375e,util[_0x8c2e('0x6')](_0x2a2d29,{'showHidden':![],'depth':null}));};exports[_0x8c2e('0x7')]=function(_0x28145c,_0x5df44c){var _0x2c06b6={'XMF-ECM':_0x5df44c[_0x8c2e('0x8')],'XMF-HEADERINFO':_0x5df44c['headerinfo'],'XMF-MINRATE':_0x5df44c[_0x8c2e('0x9')],'XMF-MAXRATE':_0x5df44c['maxrate'],'XMF-MODEM':util[_0x8c2e('0xa')]('\x22%s\x22',_0x5df44c[_0x8c2e('0xb')]),'XMF-GATEWAY':_0x5df44c[_0x8c2e('0xc')],'XMF-FAXDETECT':_0x5df44c['faxdetect'],'XMF-T38TIMEOUT':_0x5df44c[_0x8c2e('0xd')],'XMF-LOCALSTATIONID':_0x5df44c[_0x8c2e('0xe')],'XMF-PATH':_0x28145c[_0x8c2e('0xf')]};return _0x2c06b6;};exports[_0x8c2e('0x10')]=function(_0x47d2bc,_0x268ebd){return{'actionid':_0x47d2bc[_0x8c2e('0x11')],'action':'originate','channel':_0x47d2bc['channel'],'Exten':_0x8c2e('0x12'),'Context':_0x8c2e('0x13'),'Priority':'1','callerid':util[_0x8c2e('0xa')](_0x8c2e('0x14'),_0x47d2bc['headerinfo']?_0x47d2bc[_0x8c2e('0x15')]:'',_0x47d2bc[_0x8c2e('0xe')]),'variable':_0x268ebd,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x47d2bc[_0x8c2e('0x11')]};}; \ No newline at end of file +var _0x1d21=['inspect','ecm','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','info'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x1d21,0xaa));var _0x11d2=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0x1d21[_0xae282f];return _0x5f46d4;};'use strict';var util=require('util');var _=require(_0x11d2('0x0'));var moment=require(_0x11d2('0x1'));var logger=require(_0x11d2('0x2'))(_0x11d2('0x3'));exports[_0x11d2('0x4')]=function(_0x23fedf){return{'message':_0x23fedf};};exports['logger']=function(_0x427df5,_0x17b79e){logger[_0x11d2('0x5')](_0x427df5,util[_0x11d2('0x6')](_0x17b79e,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5045d7,_0x551dea){var _0x35fc37={'XMF-ECM':_0x551dea[_0x11d2('0x7')],'XMF-HEADERINFO':_0x551dea[_0x11d2('0x8')],'XMF-MINRATE':_0x551dea[_0x11d2('0x9')],'XMF-MAXRATE':_0x551dea[_0x11d2('0xa')],'XMF-MODEM':util[_0x11d2('0xb')]('\x22%s\x22',_0x551dea[_0x11d2('0xc')]),'XMF-GATEWAY':_0x551dea[_0x11d2('0xd')],'XMF-FAXDETECT':_0x551dea[_0x11d2('0xe')],'XMF-T38TIMEOUT':_0x551dea['t38timeout'],'XMF-LOCALSTATIONID':_0x551dea[_0x11d2('0xf')],'XMF-PATH':_0x5045d7[_0x11d2('0x10')]};return _0x35fc37;};exports[_0x11d2('0x11')]=function(_0x3a11bf,_0x53d656){return{'actionid':_0x3a11bf['uniqueid'],'action':_0x11d2('0x12'),'channel':_0x3a11bf[_0x11d2('0x13')],'Exten':_0x11d2('0x14'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x11d2('0x15'),_0x3a11bf[_0x11d2('0x8')]?_0x3a11bf['headerinfo']:'',_0x3a11bf[_0x11d2('0xf')]),'variable':_0x53d656,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3a11bf['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 5c9d579..c128959 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 _0xe328=['initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','listen','catch','error','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getTelephones','getVoiceQueues'];(function(_0x100338,_0x5cdbcc){var _0x330d32=function(_0x50c3dc){while(--_0x50c3dc){_0x100338['push'](_0x100338['shift']());}};_0x330d32(++_0x5cdbcc);}(_0xe328,0x145));var _0x8e32=function(_0xd5e296,_0x4cd945){_0xd5e296=_0xd5e296-0x0;var _0x2a4363=_0xe328[_0xd5e296];return _0x2a4363;};'use strict';var util=require(_0x8e32('0x0'));var moment=require(_0x8e32('0x1'));var server=require(_0x8e32('0x2'));var Realtime=require(_0x8e32('0x3'));var Report=require(_0x8e32('0x4'));var Acw=require(_0x8e32('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x8e32('0x6'));var Preview=require(_0x8e32('0x7'));var Fax=require(_0x8e32('0x8'));var user=require(_0x8e32('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x8e32('0xa'));var voiceCallReport=require(_0x8e32('0xb'));var trunk=require(_0x8e32('0xc'));var trigger=require(_0x8e32('0xd'));var template=require(_0x8e32('0xe'));var cmHopperHistory=require(_0x8e32('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x8e32('0x10'));var faxAccount=require(_0x8e32('0x11'));var zendesk=require(_0x8e32('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x8e32('0x13'));var freshdesk=require(_0x8e32('0x14'));var desk=require(_0x8e32('0x15'));var zoho=require(_0x8e32('0x16'));var vtiger=require(_0x8e32('0x17'));var freshsales=require(_0x8e32('0x18'));var servicenow=require(_0x8e32('0x19'));var dynamics365=require(_0x8e32('0x1a'));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(_0x8e32('0x1b'))(_0x8e32('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8e32('0x1d')](_0x8e32('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x8e32('0x1f')]()['then'](user['getAgents']())[_0x8e32('0x20')](realtime['initAgents']())['then'](user[_0x8e32('0x21')]())['then'](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x8e32('0x20')](realtime['initTrunks']())[_0x8e32('0x20')](voiceQueue[_0x8e32('0x22')]())[_0x8e32('0x20')](realtime[_0x8e32('0x23')]())[_0x8e32('0x20')](trigger[_0x8e32('0x24')]())[_0x8e32('0x20')](realtime[_0x8e32('0x25')]())[_0x8e32('0x20')](template[_0x8e32('0x26')]())['then'](realtime[_0x8e32('0x27')]())[_0x8e32('0x20')](zendesk[_0x8e32('0x28')]())[_0x8e32('0x20')](realtime['initZendeskAccounts']())[_0x8e32('0x20')](salesforce[_0x8e32('0x29')]())[_0x8e32('0x20')](realtime[_0x8e32('0x2a')]())[_0x8e32('0x20')](sugarcrm[_0x8e32('0x2b')]())['then'](realtime['initSugarcrmAccounts']())[_0x8e32('0x20')](freshdesk[_0x8e32('0x2c')]())[_0x8e32('0x20')](realtime[_0x8e32('0x2d')]())[_0x8e32('0x20')](desk[_0x8e32('0x2e')]())['then'](realtime[_0x8e32('0x2f')]())['then'](zoho['getZohoAccounts']())['then'](realtime[_0x8e32('0x30')]())[_0x8e32('0x20')](vtiger[_0x8e32('0x31')]())[_0x8e32('0x20')](realtime[_0x8e32('0x32')]())[_0x8e32('0x20')](freshsales['getFreshsalesAccounts']())[_0x8e32('0x20')](realtime[_0x8e32('0x33')]())[_0x8e32('0x20')](servicenow['getServicenowAccounts']())[_0x8e32('0x20')](realtime[_0x8e32('0x34')]())[_0x8e32('0x20')](dynamics365[_0x8e32('0x35')]())[_0x8e32('0x20')](realtime[_0x8e32('0x36')]())[_0x8e32('0x20')](campaign['getCampaigns']())[_0x8e32('0x20')](realtime[_0x8e32('0x37')]())[_0x8e32('0x20')](voiceExtension[_0x8e32('0x38')]())[_0x8e32('0x20')](realtime['initVoiceExtensions']())[_0x8e32('0x20')](faxAccount[_0x8e32('0x39')]())[_0x8e32('0x20')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0x8e32('0x3a')]())[_0x8e32('0x20')](realtime[_0x8e32('0x3b')]())[_0x8e32('0x20')](cmHopperHistory[_0x8e32('0x3c')]())['then'](realtime[_0x8e32('0x3d')]())[_0x8e32('0x20')](cmHopperHistory[_0x8e32('0x3e')]())[_0x8e32('0x20')](realtime[_0x8e32('0x3f')]())[_0x8e32('0x20')](voiceCallReport[_0x8e32('0x40')]())[_0x8e32('0x20')](realtime[_0x8e32('0x41')]())['catch'](function(_0x1cf927){logger['error'](_0x8e32('0x42'),util['inspect'](_0x1cf927,{'showHidden':![],'depth':null}));});}function main(){return server[_0x8e32('0x43')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x8e32('0x20')](function(){return initParams();})[_0x8e32('0x20')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x8e32('0x44')](function(_0x3ac084){logger[_0x8e32('0x45')](_0x8e32('0x46'),util[_0x8e32('0x47')](_0x3ac084,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x3dac=['getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','[index.js][initParams]','inspect','sync','[index.js][main]','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x532a08,_0x1079ab){var _0xd9c5ee=function(_0x1ce50c){while(--_0x1ce50c){_0x532a08['push'](_0x532a08['shift']());}};_0xd9c5ee(++_0x1079ab);}(_0x3dac,0x161));var _0xc3da=function(_0x1572af,_0x3591b1){_0x1572af=_0x1572af-0x0;var _0x26a867=_0x3dac[_0x1572af];return _0x26a867;};'use strict';var util=require(_0xc3da('0x0'));var moment=require('moment');var server=require(_0xc3da('0x1'));var Realtime=require(_0xc3da('0x2'));var Report=require(_0xc3da('0x3'));var Acw=require(_0xc3da('0x4'));var Trigger=require(_0xc3da('0x5'));var Dialer=require(_0xc3da('0x6'));var Preview=require(_0xc3da('0x7'));var Fax=require(_0xc3da('0x8'));var user=require(_0xc3da('0x9'));var voiceQueue=require(_0xc3da('0xa'));var voiceQueueReport=require(_0xc3da('0xb'));var voiceCallReport=require(_0xc3da('0xc'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xc3da('0xd'));var voiceExtension=require(_0xc3da('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xc3da('0xf'));var salesforce=require(_0xc3da('0x10'));var sugarcrm=require(_0xc3da('0x11'));var freshdesk=require(_0xc3da('0x12'));var desk=require(_0xc3da('0x13'));var zoho=require(_0xc3da('0x14'));var vtiger=require(_0xc3da('0x15'));var freshsales=require(_0xc3da('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xc3da('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(_0xc3da('0x18'))(_0xc3da('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc3da('0x1a')](_0xc3da('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc3da('0x1a')](_0xc3da('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xc3da('0x1c')]()[_0xc3da('0x1d')](user[_0xc3da('0x1e')]())[_0xc3da('0x1d')](realtime['initAgents']())[_0xc3da('0x1d')](user[_0xc3da('0x1f')]())[_0xc3da('0x1d')](realtime[_0xc3da('0x20')]())[_0xc3da('0x1d')](trunk['getTrunks']())[_0xc3da('0x1d')](realtime[_0xc3da('0x21')]())[_0xc3da('0x1d')](voiceQueue[_0xc3da('0x22')]())[_0xc3da('0x1d')](realtime[_0xc3da('0x23')]())[_0xc3da('0x1d')](trigger[_0xc3da('0x24')]())[_0xc3da('0x1d')](realtime['initTriggers']())[_0xc3da('0x1d')](template['getTemplates']())['then'](realtime[_0xc3da('0x25')]())[_0xc3da('0x1d')](zendesk['getZendeskAccounts']())[_0xc3da('0x1d')](realtime[_0xc3da('0x26')]())[_0xc3da('0x1d')](salesforce[_0xc3da('0x27')]())[_0xc3da('0x1d')](realtime['initSalesforceAccounts']())[_0xc3da('0x1d')](sugarcrm[_0xc3da('0x28')]())[_0xc3da('0x1d')](realtime[_0xc3da('0x29')]())[_0xc3da('0x1d')](freshdesk[_0xc3da('0x2a')]())[_0xc3da('0x1d')](realtime[_0xc3da('0x2b')]())[_0xc3da('0x1d')](desk[_0xc3da('0x2c')]())[_0xc3da('0x1d')](realtime[_0xc3da('0x2d')]())[_0xc3da('0x1d')](zoho['getZohoAccounts']())[_0xc3da('0x1d')](realtime['initZohoAccounts']())['then'](vtiger[_0xc3da('0x2e')]())[_0xc3da('0x1d')](realtime[_0xc3da('0x2f')]())['then'](freshsales[_0xc3da('0x30')]())[_0xc3da('0x1d')](realtime['initFreshsalesAccounts']())[_0xc3da('0x1d')](servicenow[_0xc3da('0x31')]())['then'](realtime[_0xc3da('0x32')]())[_0xc3da('0x1d')](dynamics365[_0xc3da('0x33')]())[_0xc3da('0x1d')](realtime['initDynamics365Accounts']())[_0xc3da('0x1d')](campaign['getCampaigns']())[_0xc3da('0x1d')](realtime[_0xc3da('0x34')]())[_0xc3da('0x1d')](voiceExtension[_0xc3da('0x35')]())['then'](realtime[_0xc3da('0x36')]())['then'](faxAccount[_0xc3da('0x37')]())['then'](realtime[_0xc3da('0x38')]())[_0xc3da('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0xc3da('0x1c')]()[_0xc3da('0x1d')](voiceQueueReport[_0xc3da('0x39')]())[_0xc3da('0x1d')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xc3da('0x3a')]())[_0xc3da('0x1d')](realtime[_0xc3da('0x3b')]())[_0xc3da('0x1d')](cmHopperHistory[_0xc3da('0x3c')]())[_0xc3da('0x1d')](realtime[_0xc3da('0x3d')]())[_0xc3da('0x1d')](voiceCallReport[_0xc3da('0x3e')]())[_0xc3da('0x1d')](realtime['initVoiceCallReports']())[_0xc3da('0x3f')](function(_0x8b9c7){logger['error'](_0xc3da('0x40'),util[_0xc3da('0x41')](_0x8b9c7,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xc3da('0x1d')](function(){return initRealtime();})[_0xc3da('0x1d')](function(){return initParams();})[_0xc3da('0x1d')](function(){report[_0xc3da('0x42')]();setInterval(initRealtime,0x1388);})[_0xc3da('0x3f')](function(_0x41efce){logger['error'](_0xc3da('0x43'),util['inspect'](_0x41efce,{'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 849f1ba..b9b3826 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 _0x32ef=['local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','onhold','user:%s','emit','user:ami:update','exports','lodash','util','moment','ioredis','../../../config/environment','redis','localhost','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue'];(function(_0x2e33ee,_0x167303){var _0x15cd50=function(_0x6a25f5){while(--_0x6a25f5){_0x2e33ee['push'](_0x2e33ee['shift']());}};_0x15cd50(++_0x167303);}(_0x32ef,0xf9));var _0xf32e=function(_0x15de9c,_0x1a0b86){_0x15de9c=_0x15de9c-0x0;var _0x13e9ea=_0x32ef[_0x15de9c];return _0x13e9ea;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var moment=require(_0xf32e('0x2'));var Redis=require(_0xf32e('0x3'));var config=require(_0xf32e('0x4'));config[_0xf32e('0x5')]=_['defaults'](config[_0xf32e('0x5')],{'host':_0xf32e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf32e('0x5')]));function Agent(_0x23dcc1){this['id']=_0x23dcc1['id']||0x0;this[_0xf32e('0x7')]=_0x23dcc1[_0xf32e('0x7')]||'';this[_0xf32e('0x8')]=_0x23dcc1[_0xf32e('0x8')]||'';this['accountcode']=_0x23dcc1[_0xf32e('0x9')]||'';this['fullname']=_0x23dcc1[_0xf32e('0xa')]||'';this[_0xf32e('0xb')]=_0xf32e('0xc');this[_0xf32e('0xd')]=0x0;this[_0xf32e('0xe')]='unknown';this[_0xf32e('0xf')]='';this[_0xf32e('0x10')]='';this[_0xf32e('0x11')]='';this[_0xf32e('0x12')]='';this[_0xf32e('0x13')]=_0x23dcc1[_0xf32e('0x13')]||![];this[_0xf32e('0x14')]=_0xf32e('0xc');this[_0xf32e('0x15')]=0x0;this[_0xf32e('0x16')]='';this[_0xf32e('0x17')]='';this['onhold']=![];this[_0xf32e('0x18')]=![];}Agent[_0xf32e('0x19')][_0xf32e('0x1a')]=function(_0x336e26){if(!_0x336e26[_0xf32e('0xb')]){return;}var _0x458002=null;var _0x5c5ab7=_0x336e26[_0xf32e('0xb')][_0xf32e('0x1b')]();switch(_0x5c5ab7){case _0xf32e('0x1c'):_0x5c5ab7=_0xf32e('0x1d');break;case _0xf32e('0x1e'):_0x5c5ab7=_0xf32e('0x1f');break;}if(this[_0xf32e('0x14')]!==_0x5c5ab7||_0x336e26[_0xf32e('0x20')]){_0x458002=_[_0xf32e('0x21')](moment()['format']('x'));}var _0x3510ec={'id':this['id'],'name':this[_0xf32e('0x7')],'email':this[_0xf32e('0x8')],'accountcode':this[_0xf32e('0x9')],'fullname':this[_0xf32e('0xa')],'state':this[_0xf32e('0xb')],'stateTime':this[_0xf32e('0xd')],'status':this[_0xf32e('0xe')],'address':this[_0xf32e('0xf')],'voiceStatus':_0x5c5ab7||this[_0xf32e('0x14')],'voiceStatusTime':_0x458002||this[_0xf32e('0x15')],'voiceStatusCallerIdNumber':this[_0xf32e('0x16')],'voiceStatusQueue':this[_0xf32e('0x17')],'interface':this[_0xf32e('0x12')],'onhold':this[_0xf32e('0x22')]};if(this['voiceStatus']!==_0x5c5ab7){this[_0xf32e('0x14')]=_0x5c5ab7;io['to'](util['format'](_0xf32e('0x23'),_0x3510ec[_0xf32e('0x7')]))[_0xf32e('0x24')](_0xf32e('0x25'),_0x3510ec);io[_0xf32e('0x24')]('user:presence',_0x3510ec);}};module[_0xf32e('0x26')]=Agent; \ No newline at end of file +var _0x24ca=['state','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','not_inuse','idle','voiceStatus','statePause','format','onhold','user:%s','emit','user:ami:update','user:presence','exports','lodash','moment','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x421ec4,_0x3cae81){var _0x3cab77=function(_0x12ee94){while(--_0x12ee94){_0x421ec4['push'](_0x421ec4['shift']());}};_0x3cab77(++_0x3cae81);}(_0x24ca,0x1bc));var _0xa24c=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x24ca[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var Redis=require(_0xa24c('0x2'));var config=require(_0xa24c('0x3'));config['redis']=_[_0xa24c('0x4')](config[_0xa24c('0x5')],{'host':_0xa24c('0x6'),'port':0x18eb});var io=require(_0xa24c('0x7'))(new Redis(config[_0xa24c('0x5')]));function Agent(_0x15a5cd){this['id']=_0x15a5cd['id']||0x0;this[_0xa24c('0x8')]=_0x15a5cd[_0xa24c('0x8')]||'';this[_0xa24c('0x9')]=_0x15a5cd[_0xa24c('0x9')]||'';this[_0xa24c('0xa')]=_0x15a5cd['accountcode']||'';this[_0xa24c('0xb')]=_0x15a5cd[_0xa24c('0xb')]||'';this[_0xa24c('0xc')]='unknown';this[_0xa24c('0xd')]=0x0;this[_0xa24c('0xe')]=_0xa24c('0xf');this[_0xa24c('0x10')]='';this[_0xa24c('0x11')]='';this[_0xa24c('0x12')]='';this[_0xa24c('0x13')]='';this[_0xa24c('0x14')]=_0x15a5cd[_0xa24c('0x14')]||![];this['voiceStatus']=_0xa24c('0xf');this[_0xa24c('0x15')]=0x0;this[_0xa24c('0x16')]='';this[_0xa24c('0x17')]='';this['onhold']=![];this[_0xa24c('0x18')]=![];}Agent[_0xa24c('0x19')][_0xa24c('0x1a')]=function(_0x2fcd8b){if(!_0x2fcd8b[_0xa24c('0xc')]){return;}var _0x2d185c=null;var _0x448275=_0x2fcd8b['state']['toLowerCase']();switch(_0x448275){case _0xa24c('0x1b'):_0x448275=_0xa24c('0x1c');break;case'inuse':_0x448275='talking';break;}if(this[_0xa24c('0x1d')]!==_0x448275||_0x2fcd8b[_0xa24c('0x1e')]){_0x2d185c=_['toNumber'](moment()[_0xa24c('0x1f')]('x'));}var _0x5de3e6={'id':this['id'],'name':this[_0xa24c('0x8')],'email':this[_0xa24c('0x9')],'accountcode':this[_0xa24c('0xa')],'fullname':this[_0xa24c('0xb')],'state':this['state'],'stateTime':this[_0xa24c('0xd')],'status':this[_0xa24c('0xe')],'address':this[_0xa24c('0x10')],'voiceStatus':_0x448275||this['voiceStatus'],'voiceStatusTime':_0x2d185c||this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xa24c('0x13')],'onhold':this[_0xa24c('0x20')]};if(this[_0xa24c('0x1d')]!==_0x448275){this[_0xa24c('0x1d')]=_0x448275;io['to'](util['format'](_0xa24c('0x21'),_0x5de3e6['name']))[_0xa24c('0x22')](_0xa24c('0x23'),_0x5de3e6);io['emit'](_0xa24c('0x24'),_0x5de3e6);}};module[_0xa24c('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8ac18e5..d6733f6 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 _0x4f33=['dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4f33,0x11c));var _0x34f3=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x4f33[_0x4f6d08];return _0x53a9c6;};'use strict';function Campaign(_0x3dad80){this['id']=_0x3dad80['id']||0x0;this[_0x34f3('0x0')]=_0x3dad80[_0x34f3('0x0')]||'';this[_0x34f3('0x1')]=_0x3dad80[_0x34f3('0x1')]||_0x34f3('0x2');this['originated']=0x0;this[_0x34f3('0x3')]=0x0;this[_0x34f3('0x4')]=0x0;this[_0x34f3('0x5')]=0x0;this[_0x34f3('0x6')]='';this[_0x34f3('0x7')]=!![];this['active']=_0x3dad80[_0x34f3('0x8')];this[_0x34f3('0x9')]=_0x3dad80['limitCalls'];this[_0x34f3('0xa')]=_0x3dad80[_0x34f3('0xa')]||null;this['dialGlobalInterval']=_0x3dad80[_0x34f3('0xb')]?_0x3dad80[_0x34f3('0xb')]:null;this[_0x34f3('0xc')]=_0x3dad80['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x3dad80['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x3dad80[_0x34f3('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x3dad80[_0x34f3('0xe')];this[_0x34f3('0xf')]=_0x3dad80[_0x34f3('0xf')];this[_0x34f3('0x10')]=_0x3dad80['dialBusyMaxRetry'];this[_0x34f3('0x11')]=_0x3dad80[_0x34f3('0x11')];this['dialNoAnswerMaxRetry']=_0x3dad80[_0x34f3('0x12')];this[_0x34f3('0x13')]=_0x3dad80[_0x34f3('0x13')];this[_0x34f3('0x14')]=_0x3dad80[_0x34f3('0x14')];this[_0x34f3('0x15')]=_0x3dad80[_0x34f3('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3dad80['dialNoSuchNumberRetryFrequency']||0x96;this[_0x34f3('0x16')]=_0x3dad80[_0x34f3('0x16')]||0x3;this[_0x34f3('0x17')]=_0x3dad80['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x3dad80['dialAbandonedMaxRetry']||0x3;this[_0x34f3('0x18')]=_0x3dad80[_0x34f3('0x18')]||0x96;this[_0x34f3('0x19')]=_0x3dad80['dialMachineMaxRetry']||0x3;this[_0x34f3('0x1a')]=_0x3dad80[_0x34f3('0x1a')]||0x96;this[_0x34f3('0x1b')]=_0x3dad80[_0x34f3('0x1b')]||0x3;this[_0x34f3('0x1c')]=_0x3dad80['dialAgentRejectRetryFrequency']||0x96;this[_0x34f3('0x1d')]=_0x3dad80['dialOrderByScheduledAt']||_0x34f3('0x1e');this[_0x34f3('0x1f')]=_0x3dad80['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x3dad80[_0x34f3('0x20')]||undefined;this[_0x34f3('0x21')]=_0x3dad80[_0x34f3('0x21')]||undefined;this[_0x34f3('0x22')]=_0x3dad80['TrunkBackup']?_0x3dad80['TrunkBackup']:undefined;this[_0x34f3('0x23')]=_0x3dad80[_0x34f3('0x23')]?_0x3dad80['Trunk']:undefined;this['Interval']=_0x3dad80['Interval']?_0x3dad80[_0x34f3('0x24')]:undefined;this[_0x34f3('0x25')]=_0x3dad80[_0x34f3('0x25')]?_0x3dad80[_0x34f3('0x25')]:undefined;this['dialQueueProject']=_0x3dad80[_0x34f3('0x25')]?_0x3dad80[_0x34f3('0x25')][_0x34f3('0x0')]:undefined;this[_0x34f3('0x26')]=_0x3dad80['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x3dad80['dialAMDInitialSilence'];this[_0x34f3('0x27')]=_0x3dad80['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x3dad80[_0x34f3('0x28')];this[_0x34f3('0x29')]=_0x3dad80[_0x34f3('0x29')];this[_0x34f3('0x2a')]=_0x3dad80[_0x34f3('0x2a')];this[_0x34f3('0x2b')]=_0x3dad80['dialAMDBetweenWordsSilence'];this[_0x34f3('0x2c')]=_0x3dad80[_0x34f3('0x2c')];this['dialAMDSilenceThreshold']=_0x3dad80['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x3dad80['dialAMDMaximumWordLength'];}module[_0x34f3('0x2d')]=Campaign; \ No newline at end of file +var _0xd88a=['message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrTotalCallsDays'];(function(_0x2911f5,_0x237d41){var _0x108843=function(_0x513785){while(--_0x513785){_0x2911f5['push'](_0x2911f5['shift']());}};_0x108843(++_0x237d41);}(_0xd88a,0x14b));var _0xad88=function(_0x31b11d,_0x5d7fa9){_0x31b11d=_0x31b11d-0x0;var _0x1c1668=_0xd88a[_0x31b11d];return _0x1c1668;};'use strict';function Campaign(_0xf3cf62){this['id']=_0xf3cf62['id']||0x0;this[_0xad88('0x0')]=_0xf3cf62[_0xad88('0x0')]||'';this['type']=_0xf3cf62[_0xad88('0x1')]||_0xad88('0x2');this['originated']=0x0;this[_0xad88('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xad88('0x4')]=0x0;this[_0xad88('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0xad88('0x6')]=_0xf3cf62[_0xad88('0x6')];this[_0xad88('0x7')]=_0xf3cf62[_0xad88('0x7')];this[_0xad88('0x8')]=_0xf3cf62[_0xad88('0x8')]||null;this[_0xad88('0x9')]=_0xf3cf62[_0xad88('0x9')]?_0xf3cf62[_0xad88('0x9')]:null;this['dialOriginateCallerIdName']=_0xf3cf62['dialOriginateCallerIdName'];this[_0xad88('0xa')]=_0xf3cf62[_0xad88('0xa')];this[_0xad88('0xb')]=_0xf3cf62[_0xad88('0xb')]||0x1e;this[_0xad88('0xc')]=_0xf3cf62[_0xad88('0xc')];this[_0xad88('0xd')]=_0xf3cf62[_0xad88('0xd')];this[_0xad88('0xe')]=_0xf3cf62['dialBusyMaxRetry'];this[_0xad88('0xf')]=_0xf3cf62[_0xad88('0xf')];this[_0xad88('0x10')]=_0xf3cf62['dialNoAnswerMaxRetry'];this[_0xad88('0x11')]=_0xf3cf62[_0xad88('0x11')];this[_0xad88('0x12')]=_0xf3cf62[_0xad88('0x12')];this['dialNoSuchNumberMaxRetry']=_0xf3cf62[_0xad88('0x13')]||0x3;this[_0xad88('0x14')]=_0xf3cf62[_0xad88('0x14')]||0x96;this['dialDropMaxRetry']=_0xf3cf62[_0xad88('0x15')]||0x3;this[_0xad88('0x16')]=_0xf3cf62[_0xad88('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0xf3cf62['dialAbandonedMaxRetry']||0x3;this[_0xad88('0x17')]=_0xf3cf62['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0xf3cf62[_0xad88('0x18')]||0x3;this[_0xad88('0x19')]=_0xf3cf62[_0xad88('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0xf3cf62[_0xad88('0x1a')]||0x3;this[_0xad88('0x1b')]=_0xf3cf62[_0xad88('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0xf3cf62[_0xad88('0x1c')]||_0xad88('0x1d');this[_0xad88('0x1e')]=_0xf3cf62['dialPrefix']||undefined;this[_0xad88('0x1f')]=_0xf3cf62['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xad88('0x20')]=_0xf3cf62[_0xad88('0x20')]||undefined;this[_0xad88('0x21')]=_0xf3cf62[_0xad88('0x21')]?_0xf3cf62['TrunkBackup']:undefined;this[_0xad88('0x22')]=_0xf3cf62[_0xad88('0x22')]?_0xf3cf62[_0xad88('0x22')]:undefined;this[_0xad88('0x23')]=_0xf3cf62[_0xad88('0x23')]?_0xf3cf62['Interval']:undefined;this[_0xad88('0x24')]=_0xf3cf62[_0xad88('0x24')]?_0xf3cf62[_0xad88('0x24')]:undefined;this[_0xad88('0x25')]=_0xf3cf62[_0xad88('0x24')]?_0xf3cf62['SquareProject']['name']:undefined;this['dialAMDActive']=_0xf3cf62['dialAMDActive']||![];this[_0xad88('0x26')]=_0xf3cf62[_0xad88('0x26')];this['dialAMDGreeting']=_0xf3cf62[_0xad88('0x27')];this[_0xad88('0x28')]=_0xf3cf62[_0xad88('0x28')];this[_0xad88('0x29')]=_0xf3cf62[_0xad88('0x29')];this[_0xad88('0x2a')]=_0xf3cf62[_0xad88('0x2a')];this[_0xad88('0x2b')]=_0xf3cf62[_0xad88('0x2b')];this[_0xad88('0x2c')]=_0xf3cf62[_0xad88('0x2c')];this[_0xad88('0x2d')]=_0xf3cf62[_0xad88('0x2d')];this[_0xad88('0x2e')]=_0xf3cf62['dialAMDMaximumWordLength'];}module[_0xad88('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 717eb8a..2651da0 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 _0x7a71=['destinationchannel','calleridname','connectedlinenum','context','exten','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a71,0xad));var _0x17a7=function(_0x469830,_0x584dea){_0x469830=_0x469830-0x0;var _0x503fed=_0x7a71[_0x469830];return _0x503fed;};'use strict';function Channel(){this[_0x17a7('0x0')]=null;this[_0x17a7('0x1')]='';this[_0x17a7('0x2')]='';this['calleridnum']=0x0;this[_0x17a7('0x3')]='';this[_0x17a7('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x17a7('0x5')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x17a7('0x6')]=0x0;this['answered']=![];this['answertime']=null;this[_0x17a7('0x7')]=null;this[_0x17a7('0x8')]=![];this[_0x17a7('0x9')]=![];this[_0x17a7('0xa')]='';this[_0x17a7('0xb')]='';this[_0x17a7('0xc')]=0x0;this[_0x17a7('0xd')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0x17a7('0xe')]=null;this[_0x17a7('0xf')]=null;this[_0x17a7('0x10')]=![];this[_0x17a7('0x11')]=null;this[_0x17a7('0x12')]=null;this[_0x17a7('0x13')]=[];this[_0x17a7('0x14')]=undefined;this[_0x17a7('0x15')]=undefined;this[_0x17a7('0x16')]=undefined;this[_0x17a7('0x17')]=0x0;}module[_0x17a7('0x18')]=Channel; \ No newline at end of file +var _0xa693=['exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','type','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType'];(function(_0x55daf2,_0x1b48de){var _0x1c8500=function(_0x4686b5){while(--_0x4686b5){_0x55daf2['push'](_0x55daf2['shift']());}};_0x1c8500(++_0x1b48de);}(_0xa693,0xf1));var _0x3a69=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xa693[_0x52f1e6];return _0x21f104;};'use strict';function Channel(){this[_0x3a69('0x0')]=null;this[_0x3a69('0x1')]='';this[_0x3a69('0x2')]='';this[_0x3a69('0x3')]=0x0;this[_0x3a69('0x4')]='';this[_0x3a69('0x5')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x3a69('0x6')]=0x0;this[_0x3a69('0x7')]=0x0;this[_0x3a69('0x8')]=0x0;this[_0x3a69('0x9')]=![];this[_0x3a69('0xa')]=null;this[_0x3a69('0xb')]=null;this[_0x3a69('0xc')]=![];this['abandoned']=![];this[_0x3a69('0xd')]='';this[_0x3a69('0xe')]='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x3a69('0xf')]=null;this['tag']=null;this[_0x3a69('0x10')]=null;this[_0x3a69('0x11')]=![];this[_0x3a69('0x12')]=null;this[_0x3a69('0x13')]=null;this[_0x3a69('0x14')]=[];this['transfercalleridnum']=undefined;this[_0x3a69('0x15')]=undefined;this[_0x3a69('0x16')]=undefined;this['mohtime']=0x0;}module[_0x3a69('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 85ff980..c25c063 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 _0x1840=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey'];(function(_0x35e40f,_0x46885f){var _0x33d84f=function(_0x283abf){while(--_0x283abf){_0x35e40f['push'](_0x35e40f['shift']());}};_0x33d84f(++_0x46885f);}(_0x1840,0x16f));var _0x0184=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1840[_0x5d2803];return _0xdcad2c;};'use strict';function DeskAccount(_0x3df11b){this['id']=_0x3df11b['id']||0x0;this[_0x0184('0x0')]=_0x3df11b[_0x0184('0x0')]||'';this['username']=_0x3df11b['username']||'';this['remoteUri']=_0x3df11b[_0x0184('0x1')]||'';this['authType']=_0x3df11b[_0x0184('0x2')]||'';this['password']=_0x3df11b[_0x0184('0x3')]||'';this[_0x0184('0x4')]=_0x3df11b[_0x0184('0x4')]||'';this[_0x0184('0x5')]=_0x3df11b[_0x0184('0x5')]||'';this[_0x0184('0x6')]=_0x3df11b[_0x0184('0x6')]||'';this[_0x0184('0x7')]=_0x3df11b[_0x0184('0x7')]||'';this['type']=_0x3df11b[_0x0184('0x8')]||'';this[_0x0184('0x9')]=_0x3df11b[_0x0184('0x9')]||'';this['Configurations']=_0x3df11b[_0x0184('0xa')]||{};}module[_0x0184('0xb')]=DeskAccount; \ No newline at end of file +var _0xbfc0=['type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x15c972,_0x13a7d4){var _0x2b6451=function(_0x2d62e5){while(--_0x2d62e5){_0x15c972['push'](_0x15c972['shift']());}};_0x2b6451(++_0x13a7d4);}(_0xbfc0,0x1cb));var _0x0bfc=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xbfc0[_0x25e109];return _0xc0f7d6;};'use strict';function DeskAccount(_0x131d68){this['id']=_0x131d68['id']||0x0;this['name']=_0x131d68[_0x0bfc('0x0')]||'';this['username']=_0x131d68[_0x0bfc('0x1')]||'';this[_0x0bfc('0x2')]=_0x131d68['remoteUri']||'';this[_0x0bfc('0x3')]=_0x131d68[_0x0bfc('0x3')]||'';this[_0x0bfc('0x4')]=_0x131d68[_0x0bfc('0x4')]||'';this[_0x0bfc('0x5')]=_0x131d68['consumerKey']||'';this[_0x0bfc('0x6')]=_0x131d68[_0x0bfc('0x6')]||'';this['token']=_0x131d68[_0x0bfc('0x7')]||'';this[_0x0bfc('0x8')]=_0x131d68['tokenSecret']||'';this[_0x0bfc('0x9')]=_0x131d68['type']||'';this[_0x0bfc('0xa')]=_0x131d68[_0x0bfc('0xa')]||'';this[_0x0bfc('0xb')]=_0x131d68['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 7248fac..dbc8725 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 _0xbd99=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0xbd99,0x126));var _0x9bd9=function(_0xdd74ad,_0xc82422){_0xdd74ad=_0xdd74ad-0x0;var _0x4cc259=_0xbd99[_0xdd74ad];return _0x4cc259;};'use strict';function Dynamics365Account(_0x152168){this['id']=_0x152168['id']||0x0;this['name']=_0x152168[_0x9bd9('0x0')]||'';this['username']=_0x152168[_0x9bd9('0x1')]||'';this[_0x9bd9('0x2')]=_0x152168[_0x9bd9('0x2')]||'';this[_0x9bd9('0x3')]=_0x152168[_0x9bd9('0x3')]||'';this[_0x9bd9('0x4')]=_0x152168['tenantId']||'';this[_0x9bd9('0x5')]=_0x152168[_0x9bd9('0x5')]||'';this['clientSecret']=_0x152168[_0x9bd9('0x6')]||{};this[_0x9bd9('0x7')]=_0x152168[_0x9bd9('0x7')]||'';this[_0x9bd9('0x8')]=_0x152168[_0x9bd9('0x8')]||![];this[_0x9bd9('0x9')]=_0x152168[_0x9bd9('0x9')]||{};this[_0x9bd9('0xa')]=_0x152168[_0x9bd9('0xa')]||{};}module[_0x9bd9('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x04f1=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x5ae0bf,_0x395a8b){var _0x122f56=function(_0x2d8546){while(--_0x2d8546){_0x5ae0bf['push'](_0x5ae0bf['shift']());}};_0x122f56(++_0x395a8b);}(_0x04f1,0x1b0));var _0x104f=function(_0x1261b4,_0x898a27){_0x1261b4=_0x1261b4-0x0;var _0x37e8ce=_0x04f1[_0x1261b4];return _0x37e8ce;};'use strict';function Dynamics365Account(_0x3ccf95){this['id']=_0x3ccf95['id']||0x0;this[_0x104f('0x0')]=_0x3ccf95[_0x104f('0x0')]||'';this[_0x104f('0x1')]=_0x3ccf95[_0x104f('0x1')]||'';this[_0x104f('0x2')]=_0x3ccf95[_0x104f('0x2')]||'';this[_0x104f('0x3')]=_0x3ccf95[_0x104f('0x3')]||'';this['tenantId']=_0x3ccf95[_0x104f('0x4')]||'';this[_0x104f('0x5')]=_0x3ccf95['clientId']||'';this[_0x104f('0x6')]=_0x3ccf95['clientSecret']||{};this[_0x104f('0x7')]=_0x3ccf95[_0x104f('0x7')]||'';this[_0x104f('0x8')]=_0x3ccf95[_0x104f('0x8')]||![];this[_0x104f('0x9')]=_0x3ccf95['Configurations']||{};this[_0x104f('0xa')]=_0x3ccf95['CloudProvider']||{};}module[_0x104f('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0f77db7..290859a 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 _0xe413=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','localstationid'];(function(_0x5b6dd2,_0x43f939){var _0x4a62e8=function(_0xa07ca4){while(--_0xa07ca4){_0x5b6dd2['push'](_0x5b6dd2['shift']());}};_0x4a62e8(++_0x43f939);}(_0xe413,0x1ca));var _0x3e41=function(_0x181100,_0x645def){_0x181100=_0x181100-0x0;var _0x5a4507=_0xe413[_0x181100];return _0x5a4507;};'use strict';function FaxAccount(_0x57cfcf){this['id']=_0x57cfcf['id']||0x0;this[_0x3e41('0x0')]=_0x57cfcf[_0x3e41('0x0')]||'';this[_0x3e41('0x1')]=_0x57cfcf['description'];this[_0x3e41('0x2')]=_0x57cfcf[_0x3e41('0x2')];this['headerinfo']=_0x57cfcf['headerinfo'];this[_0x3e41('0x3')]=_0x57cfcf[_0x3e41('0x3')];this[_0x3e41('0x4')]=_0x57cfcf[_0x3e41('0x4')]||0x960;this['maxrate']=_0x57cfcf[_0x3e41('0x5')]||0x3840;this[_0x3e41('0x6')]=_0x57cfcf['modem']||'v17,v27,v29';this[_0x3e41('0x7')]=_0x57cfcf[_0x3e41('0x7')]||'no';this[_0x3e41('0x8')]=_0x57cfcf[_0x3e41('0x8')]||'no';this[_0x3e41('0x9')]=_0x57cfcf[_0x3e41('0x9')]||0x1388;this[_0x3e41('0xa')]=_0x57cfcf[_0x3e41('0xa')]||'SIP';this[_0x3e41('0xb')]=_0x57cfcf['Trunk']?_0x57cfcf['Trunk']:undefined;this[_0x3e41('0xc')]=_0x57cfcf[_0x3e41('0xc')];this['key']=_0x57cfcf[_0x3e41('0xd')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x218c=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x2e6544,_0x168aef){var _0x8dceb5=function(_0x54d448){while(--_0x54d448){_0x2e6544['push'](_0x2e6544['shift']());}};_0x8dceb5(++_0x168aef);}(_0x218c,0x92));var _0xc218=function(_0x20edcb,_0x4d49a8){_0x20edcb=_0x20edcb-0x0;var _0x1ced78=_0x218c[_0x20edcb];return _0x1ced78;};'use strict';function FaxAccount(_0x382761){this['id']=_0x382761['id']||0x0;this['name']=_0x382761[_0xc218('0x0')]||'';this[_0xc218('0x1')]=_0x382761[_0xc218('0x1')];this[_0xc218('0x2')]=_0x382761[_0xc218('0x2')];this[_0xc218('0x3')]=_0x382761['headerinfo'];this[_0xc218('0x4')]=_0x382761[_0xc218('0x4')];this['minrate']=_0x382761[_0xc218('0x5')]||0x960;this[_0xc218('0x6')]=_0x382761[_0xc218('0x6')]||0x3840;this[_0xc218('0x7')]=_0x382761[_0xc218('0x7')]||_0xc218('0x8');this[_0xc218('0x9')]=_0x382761[_0xc218('0x9')]||'no';this[_0xc218('0xa')]=_0x382761[_0xc218('0xa')]||'no';this[_0xc218('0xb')]=_0x382761['t38timeout']||0x1388;this['tech']=_0x382761[_0xc218('0xc')]||'SIP';this['Trunk']=_0x382761['Trunk']?_0x382761[_0xc218('0xd')]:undefined;this[_0xc218('0xe')]=_0x382761[_0xc218('0xe')];this[_0xc218('0xf')]=_0x382761[_0xc218('0xf')];}module[_0xc218('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 989a496..994957f 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 _0xf60d=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x1b0a89,_0x5f4f8f){var _0x3800f0=function(_0x2765fb){while(--_0x2765fb){_0x1b0a89['push'](_0x1b0a89['shift']());}};_0x3800f0(++_0x5f4f8f);}(_0xf60d,0x13d));var _0xdf60=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf60d[_0x101e7b];return _0x4995c0;};'use strict';function FreshdeskAccount(_0x21f1bb){this['id']=_0x21f1bb['id']||0x0;this[_0xdf60('0x0')]=_0x21f1bb[_0xdf60('0x0')]||'';this['username']=_0x21f1bb[_0xdf60('0x1')]||'';this[_0xdf60('0x2')]=_0x21f1bb[_0xdf60('0x3')]||'';this[_0xdf60('0x4')]=_0x21f1bb[_0xdf60('0x4')]||'';this[_0xdf60('0x5')]=_0x21f1bb['serverUrl']||'';this[_0xdf60('0x6')]=_0x21f1bb[_0xdf60('0x6')]||{};}module[_0xdf60('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x0e06=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x30efb4,_0x2dfa9d){var _0x5461d1=function(_0x33ce56){while(--_0x33ce56){_0x30efb4['push'](_0x30efb4['shift']());}};_0x5461d1(++_0x2dfa9d);}(_0x0e06,0x11a));var _0x60e0=function(_0x55b25f,_0xad5c1a){_0x55b25f=_0x55b25f-0x0;var _0xbb8f9d=_0x0e06[_0x55b25f];return _0xbb8f9d;};'use strict';function FreshdeskAccount(_0x34bf12){this['id']=_0x34bf12['id']||0x0;this['name']=_0x34bf12[_0x60e0('0x0')]||'';this[_0x60e0('0x1')]=_0x34bf12['username']||'';this[_0x60e0('0x2')]=_0x34bf12[_0x60e0('0x3')]||'';this['remoteUri']=_0x34bf12[_0x60e0('0x4')]||'';this[_0x60e0('0x5')]=_0x34bf12[_0x60e0('0x5')]||'';this[_0x60e0('0x6')]=_0x34bf12[_0x60e0('0x6')]||{};}module[_0x60e0('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 8bca805..29ab07d 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 _0x21d1=['Configurations','name','username','apiKey','remoteUri','serverUrl'];(function(_0x2a7210,_0x2f3d23){var _0x460766=function(_0xd575dd){while(--_0xd575dd){_0x2a7210['push'](_0x2a7210['shift']());}};_0x460766(++_0x2f3d23);}(_0x21d1,0x1c9));var _0x121d=function(_0x3d7720,_0x53ad3f){_0x3d7720=_0x3d7720-0x0;var _0xac734f=_0x21d1[_0x3d7720];return _0xac734f;};'use strict';function FreshsalesAccount(_0x42b9a7){this['id']=_0x42b9a7['id']||0x0;this[_0x121d('0x0')]=_0x42b9a7[_0x121d('0x0')]||'';this[_0x121d('0x1')]=_0x42b9a7[_0x121d('0x1')]||'';this[_0x121d('0x2')]=_0x42b9a7['token']||'';this['remoteUri']=_0x42b9a7[_0x121d('0x3')]||'';this[_0x121d('0x4')]=_0x42b9a7[_0x121d('0x4')]||'';this[_0x121d('0x5')]=_0x42b9a7[_0x121d('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x4250=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x4250,0x146));var _0x0425=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4250[_0x37bd26];return _0xe83dc4;};'use strict';function FreshsalesAccount(_0x5134b5){this['id']=_0x5134b5['id']||0x0;this[_0x0425('0x0')]=_0x5134b5[_0x0425('0x0')]||'';this[_0x0425('0x1')]=_0x5134b5['username']||'';this[_0x0425('0x2')]=_0x5134b5[_0x0425('0x3')]||'';this[_0x0425('0x4')]=_0x5134b5['remoteUri']||'';this[_0x0425('0x5')]=_0x5134b5[_0x0425('0x5')]||'';this[_0x0425('0x6')]=_0x5134b5[_0x0425('0x6')]||{};}module[_0x0425('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a2ac7bc..be9bfe3 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 _0x5bde=['queuecallerexitAt','channel','connectedlinenum','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x5bde,0x8c));var _0xe5bd=function(_0x1db555,_0x1bdb29){_0x1db555=_0x1db555-0x0;var _0x315cee=_0x5bde[_0x1db555];return _0x315cee;};'use strict';function QueueReport(){this['type']=_0xe5bd('0x0');this[_0xe5bd('0x1')]='';this[_0xe5bd('0x2')]='';this['calleridname']='';this[_0xe5bd('0x3')]='';this[_0xe5bd('0x4')]=null;this['queuecallerleaveAt']=null;this[_0xe5bd('0x5')]=0x1;this['count']=0x1;this[_0xe5bd('0x6')]=![];this[_0xe5bd('0x7')]=null;this['queuecallercomplete']=![];this[_0xe5bd('0x8')]=null;this[_0xe5bd('0x9')]=![];this[_0xe5bd('0xa')]=null;this['originalposition']=0x1;this[_0xe5bd('0xb')]='';this[_0xe5bd('0xc')]='';this['connectedlinename']='';this['accountcode']='';this[_0xe5bd('0xd')]='';this[_0xe5bd('0xe')]='';this[_0xe5bd('0xf')]='';this[_0xe5bd('0x10')]=0x0;this[_0xe5bd('0x11')]=![];this[_0xe5bd('0x12')]='';this[_0xe5bd('0x13')]=_0xe5bd('0x14');this[_0xe5bd('0x15')]=null;this[_0xe5bd('0x16')]=0x0;this[_0xe5bd('0x17')]={};}module[_0xe5bd('0x18')]=QueueReport; \ No newline at end of file +var _0xcd38=['voice','routealias','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo'];(function(_0x249ee5,_0x26a0bd){var _0x2d520d=function(_0x94a08c){while(--_0x94a08c){_0x249ee5['push'](_0x249ee5['shift']());}};_0x2d520d(++_0x26a0bd);}(_0xcd38,0x124));var _0x8cd3=function(_0x8a56df,_0xb003fa){_0x8a56df=_0x8a56df-0x0;var _0x35e0a7=_0xcd38[_0x8a56df];return _0x35e0a7;};'use strict';function QueueReport(){this['type']=_0x8cd3('0x0');this[_0x8cd3('0x1')]='';this[_0x8cd3('0x2')]='';this[_0x8cd3('0x3')]='';this[_0x8cd3('0x4')]='';this['queuecallerjoinAt']=null;this[_0x8cd3('0x5')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x8cd3('0x6')]=null;this[_0x8cd3('0x7')]=![];this['queuecallercompleteAt']=null;this[_0x8cd3('0x8')]=![];this[_0x8cd3('0x9')]=null;this[_0x8cd3('0xa')]=0x1;this[_0x8cd3('0xb')]='';this[_0x8cd3('0xc')]='';this[_0x8cd3('0xd')]='';this['accountcode']='';this[_0x8cd3('0xe')]='';this[_0x8cd3('0xf')]='';this[_0x8cd3('0x10')]='';this[_0x8cd3('0x11')]=0x0;this[_0x8cd3('0x12')]=![];this[_0x8cd3('0x13')]='';this['motionChannel']=_0x8cd3('0x14');this[_0x8cd3('0x15')]=null;this['mohtime']=0x0;this[_0x8cd3('0x16')]={};}module[_0x8cd3('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 64ed9d1..d8b136e 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 _0x83eb=['Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x5ddda9,_0x43e558){var _0x53a004=function(_0x2794a1){while(--_0x2794a1){_0x5ddda9['push'](_0x5ddda9['shift']());}};_0x53a004(++_0x43e558);}(_0x83eb,0x1e5));var _0xb83e=function(_0x33f32b,_0x5bee90){_0x33f32b=_0x33f32b-0x0;var _0x2bc6e7=_0x83eb[_0x33f32b];return _0x2bc6e7;};'use strict';function SalesforceAccount(_0xfd5bb7){this['id']=_0xfd5bb7['id']||0x0;this['name']=_0xfd5bb7[_0xb83e('0x0')]||'';this[_0xb83e('0x1')]=_0xfd5bb7[_0xb83e('0x1')]||'';this[_0xb83e('0x2')]=_0xfd5bb7[_0xb83e('0x2')]||'';this[_0xb83e('0x3')]=_0xfd5bb7[_0xb83e('0x3')]||'';this[_0xb83e('0x4')]=_0xfd5bb7['clientId']||'';this[_0xb83e('0x5')]=_0xfd5bb7['clientSecret']||'';this['securityToken']=_0xfd5bb7[_0xb83e('0x6')]||'';this[_0xb83e('0x7')]=_0xfd5bb7[_0xb83e('0x7')]||_0xb83e('0x8');this[_0xb83e('0x9')]=_0xfd5bb7[_0xb83e('0x9')]||'';this['Configurations']=_0xfd5bb7[_0xb83e('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x6946=['securityToken','type','integrationTab','Configurations','exports','name','username','remoteUri','clientId','clientSecret'];(function(_0x2028ae,_0x272151){var _0x5d5b36=function(_0x74bcc){while(--_0x74bcc){_0x2028ae['push'](_0x2028ae['shift']());}};_0x5d5b36(++_0x272151);}(_0x6946,0x1b3));var _0x6694=function(_0x29586d,_0xdb79f0){_0x29586d=_0x29586d-0x0;var _0x2dd375=_0x6946[_0x29586d];return _0x2dd375;};'use strict';function SalesforceAccount(_0x15cf09){this['id']=_0x15cf09['id']||0x0;this[_0x6694('0x0')]=_0x15cf09[_0x6694('0x0')]||'';this[_0x6694('0x1')]=_0x15cf09[_0x6694('0x1')]||'';this[_0x6694('0x2')]=_0x15cf09[_0x6694('0x2')]||'';this['password']=_0x15cf09['password']||'';this[_0x6694('0x3')]=_0x15cf09[_0x6694('0x3')]||'';this[_0x6694('0x4')]=_0x15cf09[_0x6694('0x4')]||'';this[_0x6694('0x5')]=_0x15cf09[_0x6694('0x5')]||'';this[_0x6694('0x6')]=_0x15cf09[_0x6694('0x6')]||_0x6694('0x7');this['serverUrl']=_0x15cf09['serverUrl']||'';this[_0x6694('0x8')]=_0x15cf09[_0x6694('0x8')]||{};}module[_0x6694('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a8747c8..60a0a55 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 _0xecb2=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x3a8a49,_0x5a2b8c){var _0x43c69a=function(_0x534e97){while(--_0x534e97){_0x3a8a49['push'](_0x3a8a49['shift']());}};_0x43c69a(++_0x5a2b8c);}(_0xecb2,0x15a));var _0x2ecb=function(_0x33ad3b,_0x41f400){_0x33ad3b=_0x33ad3b-0x0;var _0x1a8548=_0xecb2[_0x33ad3b];return _0x1a8548;};'use strict';function ServicenowAccount(_0x384c2b){this['id']=_0x384c2b['id']||0x0;this[_0x2ecb('0x0')]=_0x384c2b[_0x2ecb('0x0')]||'';this[_0x2ecb('0x1')]=_0x384c2b['username']||'';this[_0x2ecb('0x2')]=_0x384c2b['password']||'';this[_0x2ecb('0x3')]=_0x384c2b['remoteUri']||'';this[_0x2ecb('0x4')]=_0x384c2b[_0x2ecb('0x4')]||'';this[_0x2ecb('0x5')]=_0x384c2b[_0x2ecb('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x2222=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x453460,_0x48fb09){var _0x159b53=function(_0x511d73){while(--_0x511d73){_0x453460['push'](_0x453460['shift']());}};_0x159b53(++_0x48fb09);}(_0x2222,0xad));var _0x2222=function(_0x5d5649,_0x4578c4){_0x5d5649=_0x5d5649-0x0;var _0x591c21=_0x2222[_0x5d5649];return _0x591c21;};'use strict';function ServicenowAccount(_0x28eb7d){this['id']=_0x28eb7d['id']||0x0;this['name']=_0x28eb7d[_0x2222('0x0')]||'';this['username']=_0x28eb7d[_0x2222('0x1')]||'';this[_0x2222('0x2')]=_0x28eb7d[_0x2222('0x2')]||'';this[_0x2222('0x3')]=_0x28eb7d['remoteUri']||'';this['serverUrl']=_0x28eb7d[_0x2222('0x4')]||'';this[_0x2222('0x5')]=_0x28eb7d[_0x2222('0x5')]||{};}module[_0x2222('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index f081b26..2758fd2 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 _0xe07f=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x2739ac,_0x45a29d){var _0xa610df=function(_0x630fbe){while(--_0x630fbe){_0x2739ac['push'](_0x2739ac['shift']());}};_0xa610df(++_0x45a29d);}(_0xe07f,0x9e));var _0xfe07=function(_0x50f1ef,_0x36d778){_0x50f1ef=_0x50f1ef-0x0;var _0x4d868f=_0xe07f[_0x50f1ef];return _0x4d868f;};'use strict';function SugarcrmAccount(_0x469bef){this['id']=_0x469bef['id']||0x0;this[_0xfe07('0x0')]=_0x469bef[_0xfe07('0x0')]||'';this[_0xfe07('0x1')]=_0x469bef[_0xfe07('0x1')]||'';this['password']=_0x469bef[_0xfe07('0x2')]||'';this[_0xfe07('0x3')]=_0x469bef[_0xfe07('0x3')]||'';this[_0xfe07('0x4')]=_0x469bef[_0xfe07('0x4')]||'';this['Configurations']=_0x469bef[_0xfe07('0x5')]||{};}module[_0xfe07('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x8264=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1a379a,_0x2868e0){var _0x528c58=function(_0x25a00a){while(--_0x25a00a){_0x1a379a['push'](_0x1a379a['shift']());}};_0x528c58(++_0x2868e0);}(_0x8264,0x1e9));var _0x4826=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0x8264[_0x4f8d61];return _0x3bc078;};'use strict';function SugarcrmAccount(_0x196b38){this['id']=_0x196b38['id']||0x0;this[_0x4826('0x0')]=_0x196b38[_0x4826('0x0')]||'';this[_0x4826('0x1')]=_0x196b38['username']||'';this[_0x4826('0x2')]=_0x196b38[_0x4826('0x2')]||'';this[_0x4826('0x3')]=_0x196b38[_0x4826('0x3')]||'';this[_0x4826('0x4')]=_0x196b38[_0x4826('0x4')]||'';this[_0x4826('0x5')]=_0x196b38[_0x4826('0x5')]||{};}module[_0x4826('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 477c710..284227b 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 _0x2d58=['unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x413a14,_0x2c0629){var _0x3714ad=function(_0x1a8c53){while(--_0x1a8c53){_0x413a14['push'](_0x413a14['shift']());}};_0x3714ad(++_0x2c0629);}(_0x2d58,0x186));var _0x82d5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2d58[_0xa464c9];return _0x3d73c4;};'use strict';function Telephone(_0x17a086){this['id']=_0x17a086['id']||0x0;this[_0x82d5('0x0')]=_0x17a086[_0x82d5('0x0')]||'';this['accountcode']=_0x17a086[_0x82d5('0x1')]||'';this['state']=_0x82d5('0x2');this[_0x82d5('0x3')]=0x0;this[_0x82d5('0x4')]=_0x82d5('0x2');this[_0x82d5('0x5')]='';}module[_0x82d5('0x6')]=Telephone; \ No newline at end of file +var _0x4574=['status','exports','name','accountcode','state','unknown'];(function(_0x5863bd,_0x26d618){var _0x43fb16=function(_0x392da4){while(--_0x392da4){_0x5863bd['push'](_0x5863bd['shift']());}};_0x43fb16(++_0x26d618);}(_0x4574,0xbc));var _0x4457=function(_0x1eff33,_0x562ab8){_0x1eff33=_0x1eff33-0x0;var _0x38d024=_0x4574[_0x1eff33];return _0x38d024;};'use strict';function Telephone(_0x5b64bd){this['id']=_0x5b64bd['id']||0x0;this['name']=_0x5b64bd[_0x4457('0x0')]||'';this[_0x4457('0x1')]=_0x5b64bd['accountcode']||'';this[_0x4457('0x2')]=_0x4457('0x3');this['stateTime']=0x0;this[_0x4457('0x4')]=_0x4457('0x3');this['address']='';}module[_0x4457('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b9a66c0..3931ade 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(_0x289bd2,_0x1a2247){var _0x4f9149=function(_0x5eb6b6){while(--_0x5eb6b6){_0x289bd2['push'](_0x289bd2['shift']());}};_0x4f9149(++_0x1a2247);}(_0xb10b,0x12a));var _0xbb10=function(_0x5cd675,_0x352cca){_0x5cd675=_0x5cd675-0x0;var _0x2379b0=_0xb10b[_0x5cd675];return _0x2379b0;};'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(_0x297735,_0x54acc7){var _0x32b693=function(_0x473ebb){while(--_0x473ebb){_0x297735['push'](_0x297735['shift']());}};_0x32b693(++_0x54acc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 a21f11c..67bed61 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x214a3c,_0x48bd33){var _0x3743dc=function(_0x559994){while(--_0x559994){_0x214a3c['push'](_0x214a3c['shift']());}};_0x3743dc(++_0x48bd33);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 3aa7123..92bccd5 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 _0x478f=['indexOf','split','host','port','domain','domainport','registrationtime','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x2e9fe9,_0x24eb2d){var _0x230ea9=function(_0x64c83c){while(--_0x64c83c){_0x2e9fe9['push'](_0x2e9fe9['shift']());}};_0x230ea9(++_0x24eb2d);}(_0x478f,0x119));var _0xf478=function(_0x159c06,_0x171765){_0x159c06=_0x159c06-0x0;var _0x181bbc=_0x478f[_0x159c06];return _0x181bbc;};'use strict';function Trunk(_0x37052){this['id']=_0x37052['id']||0x0;this[_0xf478('0x0')]=_0x37052[_0xf478('0x0')]||![];this[_0xf478('0x1')]=_0x37052[_0xf478('0x1')]||'';this[_0xf478('0x2')]=_0xf478('0x3');this[_0xf478('0x4')]=0x0;this[_0xf478('0x5')]='unknown';this[_0xf478('0x6')]=_0x37052[_0xf478('0x6')]&&_0x37052['registry'][_0xf478('0x7')](':')?_0x37052[_0xf478('0x6')][_0xf478('0x8')](':')[0x0]:'';this[_0xf478('0x9')]='';this[_0xf478('0xa')]='';this[_0xf478('0xb')]='';this[_0xf478('0xc')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0xf478('0xd')]='';this['address']='';this[_0xf478('0xe')]=_0x37052[_0xf478('0xe')]||'';}module[_0xf478('0xf')]=Trunk; \ No newline at end of file +var _0xf7f4=['port','stateRegistry','address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','split','host'];(function(_0x259d53,_0x45422c){var _0x53d123=function(_0x5ec56f){while(--_0x5ec56f){_0x259d53['push'](_0x259d53['shift']());}};_0x53d123(++_0x45422c);}(_0xf7f4,0x9f));var _0x4f7f=function(_0x450413,_0xece709){_0x450413=_0x450413-0x0;var _0x39dbc3=_0xf7f4[_0x450413];return _0x39dbc3;};'use strict';function Trunk(_0x2dba9b){this['id']=_0x2dba9b['id']||0x0;this[_0x4f7f('0x0')]=_0x2dba9b['active']||![];this[_0x4f7f('0x1')]=_0x2dba9b[_0x4f7f('0x1')]||'';this[_0x4f7f('0x2')]='unknown';this[_0x4f7f('0x3')]=0x0;this[_0x4f7f('0x4')]=_0x4f7f('0x5');this[_0x4f7f('0x6')]=_0x2dba9b[_0x4f7f('0x6')]&&_0x2dba9b[_0x4f7f('0x6')]['indexOf'](':')?_0x2dba9b['registry'][_0x4f7f('0x7')](':')[0x0]:'';this[_0x4f7f('0x8')]='';this[_0x4f7f('0x9')]='';this['domain']='';this['domainport']='';this['refresh']='';this[_0x4f7f('0xa')]=_0x4f7f('0x5');this['registrationtime']='';this[_0x4f7f('0xb')]='';this['defaultuser']=_0x2dba9b[_0x4f7f('0xc')]||'';}module[_0x4f7f('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d3b06fd..558f959 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 _0xb9ef=['exten','recordingFormat','mandatoryDisposition'];(function(_0x49841d,_0x32c573){var _0x43a278=function(_0x40d562){while(--_0x40d562){_0x49841d['push'](_0x49841d['shift']());}};_0x43a278(++_0x32c573);}(_0xb9ef,0x9f));var _0xfb9e=function(_0x4ef070,_0x3b4001){_0x4ef070=_0x4ef070-0x0;var _0x5cfeec=_0xb9ef[_0x4ef070];return _0x5cfeec;};'use strict';function voiceExtension(_0x350010){this['id']=_0x350010['id']||0x0;this[_0xfb9e('0x0')]=_0x350010[_0xfb9e('0x0')]||'';this['recordingFormat']=_0x350010[_0xfb9e('0x1')]||'none';this[_0xfb9e('0x2')]=_0x350010[_0xfb9e('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xa386=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa386,0xb1));var _0x6a38=function(_0xdb0cc5,_0x33653a){_0xdb0cc5=_0xdb0cc5-0x0;var _0x153aa=_0xa386[_0xdb0cc5];return _0x153aa;};'use strict';function voiceExtension(_0xa18cc3){this['id']=_0xa18cc3['id']||0x0;this[_0x6a38('0x0')]=_0xa18cc3[_0x6a38('0x0')]||'';this[_0x6a38('0x1')]=_0xa18cc3[_0x6a38('0x1')]||_0x6a38('0x2');this[_0x6a38('0x3')]=_0xa18cc3[_0x6a38('0x3')]||![];}module[_0x6a38('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index fdbabca..294b051 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 _0xd4f4=['dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','fewestcalls','leastrecent','ringall','rrordered','wrandom','name','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','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','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber'];(function(_0x7154d9,_0x11915c){var _0x545073=function(_0x4c438e){while(--_0x4c438e){_0x7154d9['push'](_0x7154d9['shift']());}};_0x545073(++_0x11915c);}(_0xd4f4,0x1bc));var _0x4d4f=function(_0x254d01,_0x102fb6){_0x254d01=_0x254d01-0x0;var _0x18e8fa=_0xd4f4[_0x254d01];return _0x18e8fa;};'use strict';var monitorFormat={'wav':_0x4d4f('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0x4d4f('0x1'),'leastrecent':_0x4d4f('0x2'),'linear':'linear','random':'random','ringall':_0x4d4f('0x3'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x4d4f('0x4'),'wrandom':_0x4d4f('0x5')};function VoiceQueue(_0x23168c){this['id']=_0x23168c['id']||0x0;this['name']=_0x23168c[_0x4d4f('0x6')]||'';this['monitor_format']=_0x23168c['monitor_format']||'';this['type']=_0x23168c[_0x4d4f('0x7')]||_0x4d4f('0x8');this[_0x4d4f('0x9')]=0x0;this[_0x4d4f('0xa')]=0x0;this[_0x4d4f('0xb')]=0x0;this[_0x4d4f('0xc')]=0x0;this[_0x4d4f('0xd')]=0x0;this['sumBillable']=0x0;this[_0x4d4f('0xe')]=0x0;this[_0x4d4f('0xf')]=0x0;this[_0x4d4f('0x10')]=0x0;this[_0x4d4f('0x11')]=0x0;this[_0x4d4f('0x12')]=0x0;this[_0x4d4f('0x13')]=0x0;this[_0x4d4f('0x14')]=0x0;this[_0x4d4f('0x15')]=0x0;this['onHold']=0x0;this[_0x4d4f('0x16')]=0x0;this[_0x4d4f('0x17')]=0x0;this[_0x4d4f('0x18')]=0x0;this['talking']=0x0;this[_0x4d4f('0x19')]=0x0;this[_0x4d4f('0x1a')]=0x0;this[_0x4d4f('0x1b')]=_0x23168c[_0x4d4f('0x1b')]||![];this['acwTimeout']=_0x23168c[_0x4d4f('0x1c')]||0xa;this[_0x4d4f('0x1d')]=_0x23168c[_0x4d4f('0x1d')]||'no';this[_0x4d4f('0x1e')]=!![];this[_0x4d4f('0x1f')]='';this['statusMessage']='';this[_0x4d4f('0x20')]=0x0;this[_0x4d4f('0x21')]=0x0;this['dialTimezone']=_0x23168c[_0x4d4f('0x22')]||null;this[_0x4d4f('0x23')]=_0x23168c[_0x4d4f('0x23')]?_0x23168c[_0x4d4f('0x23')]:null;this['dialActive']=_0x23168c['dialActive'];this[_0x4d4f('0x24')]=_0x23168c[_0x4d4f('0x24')]||_0x4d4f('0x25');this[_0x4d4f('0x26')]=_0x23168c[_0x4d4f('0x26')]||0x0;this[_0x4d4f('0x27')]=_0x23168c[_0x4d4f('0x27')]||0x0;this[_0x4d4f('0x28')]=_0x23168c[_0x4d4f('0x28')]||0x1;this[_0x4d4f('0x29')]=_0x23168c[_0x4d4f('0x29')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x23168c[_0x4d4f('0x2a')]||0.03;this['dialPredictiveInterval']=_0x23168c[_0x4d4f('0x2b')]||0x258;this[_0x4d4f('0x2c')]=_0x23168c[_0x4d4f('0x2c')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x23168c[_0x4d4f('0x2d')]||_0x4d4f('0x2e');this[_0x4d4f('0x2f')]=_0x23168c[_0x4d4f('0x2f')]||0x1e;this['dialQueueOptions']=_0x23168c[_0x4d4f('0x30')]||'tTxX';this[_0x4d4f('0x31')]=_0x23168c[_0x4d4f('0x31')]||0x3;this[_0x4d4f('0x32')]=_0x23168c['dialQueueProject']||undefined;this[_0x4d4f('0x33')]=_0x23168c[_0x4d4f('0x33')]||0x3;this[_0x4d4f('0x34')]=_0x23168c[_0x4d4f('0x34')]||0x96;this[_0x4d4f('0x35')]=_0x23168c[_0x4d4f('0x35')]||0x3;this[_0x4d4f('0x36')]=_0x23168c['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x23168c[_0x4d4f('0x37')]||0x3;this[_0x4d4f('0x38')]=_0x23168c[_0x4d4f('0x38')]||0x96;this[_0x4d4f('0x39')]=_0x23168c['dialNoSuchNumberMaxRetry']||0x3;this[_0x4d4f('0x3a')]=_0x23168c[_0x4d4f('0x3a')]||0x96;this[_0x4d4f('0x3b')]=_0x23168c[_0x4d4f('0x3b')]||0x3;this['dialDropRetryFrequency']=_0x23168c[_0x4d4f('0x3c')]||0x96;this[_0x4d4f('0x3d')]=_0x23168c[_0x4d4f('0x3d')]||0x3;this[_0x4d4f('0x3e')]=_0x23168c[_0x4d4f('0x3e')]||0x96;this[_0x4d4f('0x3f')]=_0x23168c[_0x4d4f('0x3f')]||0x3;this[_0x4d4f('0x40')]=_0x23168c[_0x4d4f('0x40')]||0x96;this[_0x4d4f('0x41')]=_0x23168c[_0x4d4f('0x41')]||0x3;this[_0x4d4f('0x42')]=_0x23168c[_0x4d4f('0x42')]||0x96;this['callAdditionalPhoneAfterMin']=_0x23168c[_0x4d4f('0x43')]||0x3;this[_0x4d4f('0x44')]=_0x23168c['dialGlobalMaxRetry']||0x4;this[_0x4d4f('0x45')]=_0x23168c['Trunk']?_0x23168c[_0x4d4f('0x45')]:undefined;this[_0x4d4f('0x46')]=_0x23168c[_0x4d4f('0x46')]?_0x23168c[_0x4d4f('0x46')]:undefined;this[_0x4d4f('0x47')]=_0x23168c['dialPrefix']||undefined;this['Interval']=_0x23168c[_0x4d4f('0x48')]?_0x23168c[_0x4d4f('0x48')]:undefined;this['dialOrderByScheduledAt']=_0x23168c[_0x4d4f('0x49')]||_0x4d4f('0x4a');this['dialRandomLastDigitCallerIdNumber']=_0x23168c[_0x4d4f('0x4b')]||undefined;this['dialCutDigit']=_0x23168c[_0x4d4f('0x4c')]||undefined;this[_0x4d4f('0x4d')]=strategy[_0x23168c[_0x4d4f('0x4d')]];this[_0x4d4f('0x4e')]=!![];this[_0x4d4f('0x4f')]=_0x23168c['dialAMDActive']||![];this[_0x4d4f('0x50')]=_0x23168c[_0x4d4f('0x50')];this[_0x4d4f('0x51')]=_0x23168c[_0x4d4f('0x51')];this[_0x4d4f('0x52')]=_0x23168c[_0x4d4f('0x52')];this['dialAMDTotalAnalysisTime']=_0x23168c[_0x4d4f('0x53')];this[_0x4d4f('0x54')]=_0x23168c[_0x4d4f('0x54')];this['dialAMDBetweenWordsSilence']=_0x23168c[_0x4d4f('0x55')];this[_0x4d4f('0x56')]=_0x23168c['dialAMDMaximumNumberOfWords'];this[_0x4d4f('0x57')]=_0x23168c[_0x4d4f('0x57')];this[_0x4d4f('0x58')]=_0x23168c['dialAMDMaximumWordLength'];this[_0x4d4f('0x59')]=0x0;this[_0x4d4f('0x5a')]=0x0;this[_0x4d4f('0x5b')]=_0x23168c['timeout'];this[_0x4d4f('0x5c')]=0x0;this[_0x4d4f('0x5d')]=0x0;this[_0x4d4f('0x5e')]=0x0;this[_0x4d4f('0x5f')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x4d4f('0x60')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x4d4f('0x61')]=0x0;this[_0x4d4f('0x62')]=0x0;this[_0x4d4f('0x63')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x4d4f('0x64')]=0x0;this[_0x4d4f('0x65')]=0x0;this[_0x4d4f('0x66')]=0x0;this[_0x4d4f('0x67')]=undefined;this['startPredictive']=undefined;this[_0x4d4f('0x68')]=undefined;this[_0x4d4f('0x69')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x4d4f('0x6a')]=0x0;this[_0x4d4f('0x6b')]=0x0;this[_0x4d4f('0x6c')]=0x0;this[_0x4d4f('0x6d')]=0x0;this[_0x4d4f('0x6e')]=0x0;this[_0x4d4f('0x6f')]=0x0;this[_0x4d4f('0x70')]=0x0;this[_0x4d4f('0x71')]=_0x23168c[_0x4d4f('0x72')]||0x14;this[_0x4d4f('0x73')]=_0x23168c[_0x4d4f('0x72')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x4d4f('0x74')]=0x1;this[_0x4d4f('0x75')]=0x0;this['erlangCallToSecond']=0x0;this[_0x4d4f('0x76')]=0x0;this[_0x4d4f('0x77')]=0x0;this[_0x4d4f('0x78')]=_0x23168c[_0x4d4f('0x78')]||0x1e;this[_0x4d4f('0x79')]=_0x23168c[_0x4d4f('0x79')]||![];this[_0x4d4f('0x7a')]=!!_0x23168c[_0x4d4f('0x7a')]||![];this['dialPreviewRecallmeReminder']=!!_0x23168c['dialPreviewRecallmeReminder']||![];this[_0x4d4f('0x7b')]=_0x23168c[_0x4d4f('0x7b')]||undefined;this['dialAgiAfterHangupClient']=_0x23168c['dialAgiAfterHangupClient']||![];this[_0x4d4f('0x7c')]=_0x23168c['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x23168c[_0x4d4f('0x7d')]]?monitorFormat[_0x23168c[_0x4d4f('0x7d')]]:undefined;this['mandatoryDisposition']=_0x23168c[_0x4d4f('0x7e')]||![];this[_0x4d4f('0x7f')]=_0x23168c[_0x4d4f('0x7f')]?_0x23168c['mandatoryDispositionPause']:undefined;this[_0x4d4f('0x80')]=![];}module[_0x4d4f('0x81')]=VoiceQueue; \ No newline at end of file +var _0x1bce=['rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','total','sumDuration','sumHoldTime','sumBillable','abandoned','available','inUse','invalid','onHold','paused','ringing','unavailable','unknown','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','roundrobin'];(function(_0x304ad1,_0x3bf97d){var _0x5ab805=function(_0x209875){while(--_0x209875){_0x304ad1['push'](_0x304ad1['shift']());}};_0x5ab805(++_0x3bf97d);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var monitorFormat={'wav':_0xe1bc('0x0'),'wav49':_0xe1bc('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xe1bc('0x2'),'leastrecent':_0xe1bc('0x3'),'linear':_0xe1bc('0x4'),'random':_0xe1bc('0x5'),'ringall':_0xe1bc('0x6'),'rr':_0xe1bc('0x7'),'rrmemory':_0xe1bc('0x8'),'rrordered':_0xe1bc('0x9'),'wrandom':_0xe1bc('0xa')};function VoiceQueue(_0x57ebd4){this['id']=_0x57ebd4['id']||0x0;this['name']=_0x57ebd4[_0xe1bc('0xb')]||'';this[_0xe1bc('0xc')]=_0x57ebd4[_0xe1bc('0xc')]||'';this[_0xe1bc('0xd')]=_0x57ebd4[_0xe1bc('0xd')]||_0xe1bc('0xe');this['waiting']=0x0;this[_0xe1bc('0xf')]=0x0;this['answered']=0x0;this[_0xe1bc('0x10')]=0x0;this[_0xe1bc('0x11')]=0x0;this[_0xe1bc('0x12')]=0x0;this['unmanaged']=0x0;this[_0xe1bc('0x13')]=0x0;this[_0xe1bc('0x14')]=0x0;this['busy']=0x0;this[_0xe1bc('0x15')]=0x0;this[_0xe1bc('0x16')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0xe1bc('0x17')]=0x0;this[_0xe1bc('0x18')]=0x0;this[_0xe1bc('0x19')]=0x0;this['ringInUse']=0x0;this['talking']=0x0;this[_0xe1bc('0x1a')]=0x0;this[_0xe1bc('0x1b')]=0x0;this[_0xe1bc('0x1c')]=_0x57ebd4['acw']||![];this[_0xe1bc('0x1d')]=_0x57ebd4[_0xe1bc('0x1d')]||0xa;this[_0xe1bc('0x1e')]=_0x57ebd4[_0xe1bc('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this[_0xe1bc('0x1f')]='';this['statusMessage']='';this[_0xe1bc('0x20')]=0x0;this[_0xe1bc('0x21')]=0x0;this['dialTimezone']=_0x57ebd4[_0xe1bc('0x22')]||null;this[_0xe1bc('0x23')]=_0x57ebd4[_0xe1bc('0x23')]?_0x57ebd4[_0xe1bc('0x23')]:null;this[_0xe1bc('0x24')]=_0x57ebd4[_0xe1bc('0x24')];this['dialMethod']=_0x57ebd4[_0xe1bc('0x25')]||'progressive';this[_0xe1bc('0x26')]=_0x57ebd4[_0xe1bc('0x26')]||0x0;this[_0xe1bc('0x27')]=_0x57ebd4[_0xe1bc('0x27')]||0x0;this[_0xe1bc('0x28')]=_0x57ebd4['dialPowerLevel']||0x1;this[_0xe1bc('0x29')]=_0x57ebd4['dialPredictiveOptimization']||'dropRate';this[_0xe1bc('0x2a')]=_0x57ebd4[_0xe1bc('0x2a')]||0.03;this['dialPredictiveInterval']=_0x57ebd4['dialPredictiveInterval']||0x258;this[_0xe1bc('0x2b')]=_0x57ebd4[_0xe1bc('0x2b')]||_0xe1bc('0x2c');this[_0xe1bc('0x2d')]=_0x57ebd4[_0xe1bc('0x2d')]||_0xe1bc('0x2c');this[_0xe1bc('0x2e')]=_0x57ebd4[_0xe1bc('0x2e')]||0x1e;this[_0xe1bc('0x2f')]=_0x57ebd4[_0xe1bc('0x2f')]||_0xe1bc('0x30');this[_0xe1bc('0x31')]=_0x57ebd4[_0xe1bc('0x31')]||0x3;this['dialQueueProject']=_0x57ebd4['dialQueueProject']||undefined;this[_0xe1bc('0x32')]=_0x57ebd4['dialCongestionMaxRetry']||0x3;this[_0xe1bc('0x33')]=_0x57ebd4['dialCongestionRetryFrequency']||0x96;this[_0xe1bc('0x34')]=_0x57ebd4['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x57ebd4[_0xe1bc('0x35')]||0x96;this[_0xe1bc('0x36')]=_0x57ebd4['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x57ebd4[_0xe1bc('0x37')]||0x96;this[_0xe1bc('0x38')]=_0x57ebd4[_0xe1bc('0x38')]||0x3;this[_0xe1bc('0x39')]=_0x57ebd4[_0xe1bc('0x39')]||0x96;this[_0xe1bc('0x3a')]=_0x57ebd4[_0xe1bc('0x3a')]||0x3;this[_0xe1bc('0x3b')]=_0x57ebd4[_0xe1bc('0x3b')]||0x96;this['dialAbandonedMaxRetry']=_0x57ebd4[_0xe1bc('0x3c')]||0x3;this[_0xe1bc('0x3d')]=_0x57ebd4[_0xe1bc('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x57ebd4[_0xe1bc('0x3e')]||0x3;this[_0xe1bc('0x3f')]=_0x57ebd4[_0xe1bc('0x3f')]||0x96;this[_0xe1bc('0x40')]=_0x57ebd4[_0xe1bc('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x57ebd4[_0xe1bc('0x41')]||0x96;this['callAdditionalPhoneAfterMin']=_0x57ebd4['callAdditionalPhoneAfterMin']||0x3;this[_0xe1bc('0x42')]=_0x57ebd4[_0xe1bc('0x42')]||0x4;this[_0xe1bc('0x43')]=_0x57ebd4['Trunk']?_0x57ebd4[_0xe1bc('0x43')]:undefined;this[_0xe1bc('0x44')]=_0x57ebd4['TrunkBackup']?_0x57ebd4[_0xe1bc('0x44')]:undefined;this[_0xe1bc('0x45')]=_0x57ebd4[_0xe1bc('0x45')]||undefined;this[_0xe1bc('0x46')]=_0x57ebd4[_0xe1bc('0x46')]?_0x57ebd4[_0xe1bc('0x46')]:undefined;this['dialOrderByScheduledAt']=_0x57ebd4[_0xe1bc('0x47')]||_0xe1bc('0x48');this['dialRandomLastDigitCallerIdNumber']=_0x57ebd4[_0xe1bc('0x49')]||undefined;this['dialCutDigit']=_0x57ebd4[_0xe1bc('0x4a')]||undefined;this[_0xe1bc('0x4b')]=strategy[_0x57ebd4[_0xe1bc('0x4b')]];this[_0xe1bc('0x4c')]=!![];this['dialAMDActive']=_0x57ebd4[_0xe1bc('0x4d')]||![];this[_0xe1bc('0x4e')]=_0x57ebd4[_0xe1bc('0x4e')];this[_0xe1bc('0x4f')]=_0x57ebd4[_0xe1bc('0x4f')];this[_0xe1bc('0x50')]=_0x57ebd4[_0xe1bc('0x50')];this[_0xe1bc('0x51')]=_0x57ebd4[_0xe1bc('0x51')];this[_0xe1bc('0x52')]=_0x57ebd4[_0xe1bc('0x52')];this[_0xe1bc('0x53')]=_0x57ebd4[_0xe1bc('0x53')];this[_0xe1bc('0x54')]=_0x57ebd4['dialAMDMaximumNumberOfWords'];this[_0xe1bc('0x55')]=_0x57ebd4[_0xe1bc('0x55')];this['dialAMDMaximumWordLength']=_0x57ebd4[_0xe1bc('0x56')];this['outboundRejectCallsDay']=0x0;this[_0xe1bc('0x57')]=0x0;this[_0xe1bc('0x58')]=_0x57ebd4[_0xe1bc('0x58')];this[_0xe1bc('0x59')]=0x0;this[_0xe1bc('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xe1bc('0x5b')]=0x0;this[_0xe1bc('0x5c')]=0x0;this[_0xe1bc('0x5d')]=0x0;this[_0xe1bc('0x5e')]=0x0;this[_0xe1bc('0x5f')]=0x0;this[_0xe1bc('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xe1bc('0x61')]=0x0;this[_0xe1bc('0x62')]=0x0;this[_0xe1bc('0x63')]=0x0;this['startProgressive']=undefined;this[_0xe1bc('0x64')]=undefined;this['handlePredictive']=undefined;this[_0xe1bc('0x65')]=1.05;this[_0xe1bc('0x66')]=0x0;this[_0xe1bc('0x67')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xe1bc('0x68')]=0x0;this[_0xe1bc('0x69')]=0x0;this[_0xe1bc('0x6a')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xe1bc('0x6b')]=0x0;this['predictiveIntervalMaxThreshold']=_0x57ebd4['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x57ebd4['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xe1bc('0x6c')]=0x1;this[_0xe1bc('0x6d')]=0x0;this[_0xe1bc('0x6e')]=0x0;this[_0xe1bc('0x6f')]=0x0;this[_0xe1bc('0x70')]=0x0;this[_0xe1bc('0x71')]=_0x57ebd4['dialRecallMeTimeout']||0x1e;this[_0xe1bc('0x72')]=_0x57ebd4[_0xe1bc('0x72')]||![];this[_0xe1bc('0x73')]=!!_0x57ebd4[_0xe1bc('0x73')]||![];this[_0xe1bc('0x74')]=!!_0x57ebd4['dialPreviewRecallmeReminder']||![];this[_0xe1bc('0x75')]=_0x57ebd4[_0xe1bc('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x57ebd4[_0xe1bc('0x76')]||![];this[_0xe1bc('0x77')]=_0x57ebd4['dialAgiAfterHangupAgent']||![];this[_0xe1bc('0xc')]=monitorFormat[_0x57ebd4['monitor_format']]?monitorFormat[_0x57ebd4[_0xe1bc('0xc')]]:undefined;this['mandatoryDisposition']=_0x57ebd4['mandatoryDisposition']||![];this[_0xe1bc('0x78')]=_0x57ebd4[_0xe1bc('0x78')]?_0x57ebd4[_0xe1bc('0x78')]:undefined;this[_0xe1bc('0x79')]=![];}module[_0xe1bc('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 1ebe78c..31a9d77 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x207c=['outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','Trunk','active','callerid','prototype','invalid','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','exten','compareToInboundQueue','some','compareToOutboundQueue','statusMessage','updateReportFromOutboundQueue','preview','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','available','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','name','strategy','abandoned','answered','busy','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x39551a,_0x116007){var _0x4b0b62=function(_0x3d8a12){while(--_0x3d8a12){_0x39551a['push'](_0x39551a['shift']());}};_0x4b0b62(++_0x116007);}(_0x207c,0x1e8));var _0xc207=function(_0x3e61d4,_0x224d2d){_0x3e61d4=_0x3e61d4-0x0;var _0x40bd4e=_0x207c[_0x3e61d4];return _0x40bd4e;};'use strict';var INBOUND_COUNTERS=['available',_0xc207('0x0'),_0xc207('0x1'),_0xc207('0x2'),_0xc207('0x3'),_0xc207('0x4'),_0xc207('0x5')];var OUTBOUND_COUNTERS=[_0xc207('0x6'),'answered',_0xc207('0x7'),'loggedIn','loggedInDb','originated',_0xc207('0x8'),_0xc207('0x9'),_0xc207('0xa'),'outboundBusyCallsDay',_0xc207('0xb'),_0xc207('0xc'),_0xc207('0xd'),'outboundReCallsDay',_0xc207('0xe'),_0xc207('0xf'),_0xc207('0x2'),_0xc207('0x10'),_0xc207('0x4'),_0xc207('0x11'),'sumDuration','total','waiting'];function VoiceQueueSummary(_0x19b297){this['id']=_0x19b297['id'];this['name']=_0x19b297[_0xc207('0x12')];this[_0xc207('0x13')]=_0x19b297['strategy'];this[_0xc207('0x14')]=_0x19b297[_0xc207('0x14')]||0x0;this[_0xc207('0x15')]=_0x19b297[_0xc207('0x15')]||0x0;this[_0xc207('0x6')]=_0x19b297['available']||0x0;this[_0xc207('0x16')]=_0x19b297[_0xc207('0x16')]||0x0;this[_0xc207('0x7')]=_0x19b297[_0xc207('0x7')]||0x0;this['invalid']=_0x19b297['invalid']||0x0;this['loggedIn']=_0x19b297[_0xc207('0x0')]||0x0;this[_0xc207('0x1')]=_0x19b297[_0xc207('0x1')]||0x0;this[_0xc207('0x17')]=_0x19b297['onHold']||0x0;this[_0xc207('0x18')]=_0x19b297[_0xc207('0x18')]||0x0;this[_0xc207('0x2')]=_0x19b297['paused']||0x0;this[_0xc207('0x3')]=_0x19b297['ringing']||0x0;this[_0xc207('0x19')]=_0x19b297[_0xc207('0x19')];this[_0xc207('0x11')]=_0x19b297[_0xc207('0x11')];this[_0xc207('0x1a')]=_0x19b297[_0xc207('0x1a')];this[_0xc207('0x1b')]=_0x19b297[_0xc207('0x1b')]||0x0;this[_0xc207('0x4')]=_0x19b297[_0xc207('0x4')]||0x0;this[_0xc207('0x1c')]=_0x19b297[_0xc207('0x1c')]||0x0;this[_0xc207('0x1d')]=_0x19b297['type'];this[_0xc207('0x1e')]=_0x19b297['unavailable']||0x0;this[_0xc207('0x1f')]=_0x19b297[_0xc207('0x1f')]||0x0;this[_0xc207('0x20')]=_0x19b297[_0xc207('0x20')]||0x0;this[_0xc207('0x5')]=_0x19b297[_0xc207('0x5')]||0x0;if(_0x19b297[_0xc207('0x1d')]===_0xc207('0x21')){this[_0xc207('0x10')]=_0x19b297[_0xc207('0x10')]||0x0;this[_0xc207('0x22')]=_0x19b297[_0xc207('0x22')];this[_0xc207('0x23')]=_0x19b297[_0xc207('0x23')];this[_0xc207('0x24')]=_0x19b297['dialOriginateCallerIdName'];this[_0xc207('0x25')]=_0x19b297['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x19b297[_0xc207('0x26')];this[_0xc207('0x27')]=_0x19b297[_0xc207('0x27')];this[_0xc207('0x28')]=_0x19b297[_0xc207('0x28')];this['outboundAnswerAgiCallsDay']=_0x19b297[_0xc207('0x29')];this[_0xc207('0x9')]=_0x19b297[_0xc207('0x9')];this[_0xc207('0xa')]=_0x19b297[_0xc207('0xa')];this[_0xc207('0x2a')]=_0x19b297[_0xc207('0x2a')];this[_0xc207('0xb')]=_0x19b297[_0xc207('0xb')];this[_0xc207('0x2b')]=_0x19b297[_0xc207('0x2b')];this[_0xc207('0x2c')]=_0x19b297[_0xc207('0x2c')];this['outboundDropCallsDayTimeout']=_0x19b297[_0xc207('0x2d')];this[_0xc207('0xc')]=_0x19b297[_0xc207('0xc')];this[_0xc207('0xd')]=_0x19b297[_0xc207('0xd')];this[_0xc207('0x2e')]=_0x19b297['outboundOriginateFailureCallsDay'];this[_0xc207('0x2f')]=_0x19b297[_0xc207('0x2f')];this[_0xc207('0xe')]=_0x19b297[_0xc207('0xe')];this['outboundUnknownCallsDay']=_0x19b297[_0xc207('0xf')];this[_0xc207('0x30')]=_0x19b297[_0xc207('0x30')];this[_0xc207('0x31')]=_0x19b297[_0xc207('0x31')];this[_0xc207('0x32')]=_0x19b297[_0xc207('0x32')];this[_0xc207('0x33')]=_0x19b297[_0xc207('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x19b297['predictiveIntervalDroppedCallsTimeout'];this[_0xc207('0x34')]=_0x19b297[_0xc207('0x34')];this[_0xc207('0x35')]=_0x19b297[_0xc207('0x35')];this['predictiveIntervalHitRate']=_0x19b297[_0xc207('0x36')];this[_0xc207('0x37')]=_0x19b297[_0xc207('0x37')];this[_0xc207('0x38')]=_0x19b297[_0xc207('0x38')];this['predictiveIntervalAvailable']=_0x19b297[_0xc207('0x39')];this[_0xc207('0x3a')]=_0x19b297['predictiveIntervalTotalCalls'];this[_0xc207('0x3b')]=_0x19b297['originated'];this[_0xc207('0x3c')]=_0x19b297[_0xc207('0x3c')];this['erlangCallToSecond']=_0x19b297[_0xc207('0x3d')];this[_0xc207('0x3e')]=_0x19b297[_0xc207('0x3e')];this['erlangBusyFactor']=_0x19b297['erlangBusyFactor'];this[_0xc207('0x3f')]=_0x19b297[_0xc207('0x3f')];this[_0xc207('0x40')]=_0x19b297[_0xc207('0x40')];this['message']=_0x19b297[_0xc207('0x41')];this['statusMessage']=_0x19b297['statusMessage'];}if(_0x19b297['Trunk']){this['Trunk']={'id':_0x19b297[_0xc207('0x42')]['id'],'name':_0x19b297[_0xc207('0x42')][_0xc207('0x12')],'active':_0x19b297['Trunk'][_0xc207('0x43')],'callerid':_0x19b297[_0xc207('0x42')][_0xc207('0x44')]};}}VoiceQueueSummary[_0xc207('0x45')]['createReport']=function(_0x47d43a,_0x223349,_0x123a46,_0x46aa9f){this[_0xc207('0x1')]=0x0;this['talking']=0x0;this[_0xc207('0x2')]=0x0;this[_0xc207('0x1f')]=0x0;this[_0xc207('0x18')]=0x0;this[_0xc207('0x7')]=0x0;this[_0xc207('0x16')]=0x0;this[_0xc207('0x46')]=0x0;this[_0xc207('0x1e')]=0x0;this[_0xc207('0x3')]=0x0;this[_0xc207('0x19')]=0x0;this['onHold']=0x0;if(_0x123a46){if(_0x123a46[_0xc207('0x6')]){this[_0xc207('0x6')]=Number(_0x123a46['available']);}if(_0x123a46[_0xc207('0x47')]){this[_0xc207('0x0')]=Number(_0x123a46[_0xc207('0x47')]);}if(_0x123a46[_0xc207('0x48')]){this[_0xc207('0x5')]=Number(_0x123a46['callers']);}}for(var _0x11989b=0x0;_0x11989b<_0x47d43a[_0xc207('0x49')];_0x11989b++){var _0x17da25=_0x223349['SIP/'+_0x47d43a[_0x11989b][_0xc207('0x12')]];if(_0x17da25&&_0x17da25[_0xc207('0x4a')]){this[_0xc207('0x1')]+=0x1;}if(_0x47d43a[_0x11989b][_0xc207('0x4b')]==='1'){this['talking']+=0x1;}if(_0x47d43a[_0x11989b]['paused']==='1'&&!['2','7','8'][_0xc207('0x4c')](_0x47d43a[_0x11989b][_0xc207('0x4d')])){this[_0xc207('0x2')]+=0x1;}switch(_0x47d43a[_0x11989b][_0xc207('0x4d')]){case'0':this[_0xc207('0x1f')]+=0x1;break;case'1':this[_0xc207('0x18')]+=0x1;break;case'2':this[_0xc207('0x7')]+=0x1;break;case'3':this[_0xc207('0x16')]+=0x1;break;case'4':this[_0xc207('0x46')]+=0x1;break;case'5':this[_0xc207('0x1e')]+=0x1;break;case'6':this[_0xc207('0x3')]+=0x1;break;case'7':this[_0xc207('0x19')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0xc207('0x4e')){var _0xb39172=Object[_0xc207('0x4f')](_0x46aa9f);for(var _0x480f12=0x0;_0x480f12<_0xb39172[_0xc207('0x49')];_0x480f12++){var _0x3f712d=_0xb39172[_0x480f12];var _0x1beb3c=_0x46aa9f[_0x3f712d];if(_0x1beb3c[_0xc207('0x50')]===this['name']&&_0x1beb3c[_0xc207('0x1d')]==='dialer'&&_0x1beb3c[_0xc207('0x51')]==='xcally-motion-preview'){this['talking']+=0x1;}}if(this[_0xc207('0x4')]>this[_0xc207('0x7')]){this['talking']=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xc207('0x45')][_0xc207('0x52')]=function(_0x1b887c){var _0x1acc33=![];if(_0x1b887c){_0x1acc33=INBOUND_COUNTERS[_0xc207('0x53')](function(_0x35e967){return this[_0x35e967]!==_0x1b887c[_0x35e967];},this);}return _0x1acc33;};VoiceQueueSummary[_0xc207('0x45')][_0xc207('0x54')]=function(_0x49d1bc){var _0x26bcfe=![];var _0x1435a9=![];var _0x5aedd3=![];if(_0x49d1bc){_0x26bcfe=this['dialMethod']!==_0x49d1bc[_0xc207('0x23')]||this['dialActive']!==_0x49d1bc['dialActive']||this[_0xc207('0x41')]!==_0x49d1bc[_0xc207('0x41')]||this[_0xc207('0x55')]!==_0x49d1bc[_0xc207('0x55')];_0x1435a9=OUTBOUND_COUNTERS[_0xc207('0x53')](function(_0x3b926e){return this[_0x3b926e]!==_0x49d1bc[_0x3b926e];},this);if(this[_0xc207('0x42')]&&_0x49d1bc[_0xc207('0x42')]){_0x5aedd3=this[_0xc207('0x42')][_0xc207('0x12')]!==_0x49d1bc[_0xc207('0x42')]['name']||this['Trunk'][_0xc207('0x43')]!==_0x49d1bc[_0xc207('0x42')][_0xc207('0x43')];}}return _0x26bcfe||_0x1435a9||_0x5aedd3;};VoiceQueueSummary[_0xc207('0x45')][_0xc207('0x56')]=function(_0x21c12b){this[_0xc207('0x15')]=_0x21c12b[_0xc207('0x15')];this[_0xc207('0x41')]=_0x21c12b['message'];this[_0xc207('0x55')]=_0x21c12b[_0xc207('0x55')];this[_0xc207('0x3b')]=_0x21c12b[_0xc207('0x3b')];this['outboundAbandonedCallsDay']=_0x21c12b[_0xc207('0x8')];this[_0xc207('0x9')]=_0x21c12b[_0xc207('0x9')];this[_0xc207('0xa')]=_0x21c12b[_0xc207('0xa')];this[_0xc207('0x2a')]=_0x21c12b[_0xc207('0x2a')];this['outboundCongestionCallsDay']=_0x21c12b[_0xc207('0xb')];this[_0xc207('0xc')]=_0x21c12b[_0xc207('0xc')];this[_0xc207('0xd')]=_0x21c12b['outboundNoSuchCallsDay'];this[_0xc207('0x2f')]=_0x21c12b['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x21c12b[_0xc207('0xe')];this[_0xc207('0xf')]=_0x21c12b[_0xc207('0xf')];this[_0xc207('0x11')]=_0x21c12b[_0xc207('0x11')];this[_0xc207('0x1a')]=_0x21c12b[_0xc207('0x1a')];this[_0xc207('0x1c')]=_0x21c12b[_0xc207('0x1c')];if(this[_0xc207('0x23')]===_0xc207('0x57')){this[_0xc207('0x10')]=_0x21c12b[_0xc207('0x10')];}};module[_0xc207('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x0a9f=['includes','status','booked','keys','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','preview','loggedIn','loggedInDb','talking','available','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','waiting','name','strategy','answered','busy','inUse','invalid','onHold','notInUse','paused','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','length','SIP/','online','incall'];(function(_0x3e9819,_0x6a5a11){var _0x2e836a=function(_0x1364e2){while(--_0x1364e2){_0x3e9819['push'](_0x3e9819['shift']());}};_0x2e836a(++_0x6a5a11);}(_0x0a9f,0x64));var _0xf0a9=function(_0xf1bf12,_0x4558e4){_0xf1bf12=_0xf1bf12-0x0;var _0x340ce8=_0x0a9f[_0xf1bf12];return _0x340ce8;};'use strict';var INBOUND_COUNTERS=['available',_0xf0a9('0x0'),_0xf0a9('0x1'),'paused','ringing',_0xf0a9('0x2'),'waiting'];var OUTBOUND_COUNTERS=[_0xf0a9('0x3'),'answered','inUse','loggedIn','loggedInDb',_0xf0a9('0x4'),_0xf0a9('0x5'),'outboundAnswerCallsDay',_0xf0a9('0x6'),'outboundBusyCallsDay',_0xf0a9('0x7'),_0xf0a9('0x8'),'outboundNoSuchCallsDay',_0xf0a9('0x9'),_0xf0a9('0xa'),_0xf0a9('0xb'),'paused',_0xf0a9('0xc'),'talking',_0xf0a9('0xd'),_0xf0a9('0xe'),_0xf0a9('0xf'),_0xf0a9('0x10')];function VoiceQueueSummary(_0x4ecd0c){this['id']=_0x4ecd0c['id'];this[_0xf0a9('0x11')]=_0x4ecd0c[_0xf0a9('0x11')];this[_0xf0a9('0x12')]=_0x4ecd0c[_0xf0a9('0x12')];this['abandoned']=_0x4ecd0c['abandoned']||0x0;this[_0xf0a9('0x13')]=_0x4ecd0c[_0xf0a9('0x13')]||0x0;this[_0xf0a9('0x3')]=_0x4ecd0c[_0xf0a9('0x3')]||0x0;this[_0xf0a9('0x14')]=_0x4ecd0c[_0xf0a9('0x14')]||0x0;this[_0xf0a9('0x15')]=_0x4ecd0c['inUse']||0x0;this[_0xf0a9('0x16')]=_0x4ecd0c[_0xf0a9('0x16')]||0x0;this[_0xf0a9('0x0')]=_0x4ecd0c['loggedIn']||0x0;this[_0xf0a9('0x1')]=_0x4ecd0c['loggedInDb']||0x0;this[_0xf0a9('0x17')]=_0x4ecd0c[_0xf0a9('0x17')]||0x0;this[_0xf0a9('0x18')]=_0x4ecd0c[_0xf0a9('0x18')]||0x0;this[_0xf0a9('0x19')]=_0x4ecd0c[_0xf0a9('0x19')]||0x0;this[_0xf0a9('0x1a')]=_0x4ecd0c[_0xf0a9('0x1a')]||0x0;this[_0xf0a9('0x1b')]=_0x4ecd0c['ringInUse'];this[_0xf0a9('0xd')]=_0x4ecd0c[_0xf0a9('0xd')];this[_0xf0a9('0xe')]=_0x4ecd0c['sumDuration'];this[_0xf0a9('0x1c')]=_0x4ecd0c['sumHoldTime']||0x0;this[_0xf0a9('0x2')]=_0x4ecd0c[_0xf0a9('0x2')]||0x0;this['total']=_0x4ecd0c[_0xf0a9('0xf')]||0x0;this[_0xf0a9('0x1d')]=_0x4ecd0c[_0xf0a9('0x1d')];this['unavailable']=_0x4ecd0c[_0xf0a9('0x1e')]||0x0;this[_0xf0a9('0x1f')]=_0x4ecd0c[_0xf0a9('0x1f')]||0x0;this[_0xf0a9('0x20')]=_0x4ecd0c[_0xf0a9('0x20')]||0x0;this[_0xf0a9('0x10')]=_0x4ecd0c[_0xf0a9('0x10')]||0x0;if(_0x4ecd0c['type']==='outbound'){this['pTalking']=_0x4ecd0c[_0xf0a9('0xc')]||0x0;this[_0xf0a9('0x21')]=_0x4ecd0c[_0xf0a9('0x21')];this['dialMethod']=_0x4ecd0c[_0xf0a9('0x22')];this[_0xf0a9('0x23')]=_0x4ecd0c[_0xf0a9('0x23')];this[_0xf0a9('0x24')]=_0x4ecd0c[_0xf0a9('0x24')];this[_0xf0a9('0x25')]=_0x4ecd0c['dialOriginateTimeout'];this[_0xf0a9('0x26')]=_0x4ecd0c[_0xf0a9('0x26')];this[_0xf0a9('0x27')]=_0x4ecd0c[_0xf0a9('0x27')];this[_0xf0a9('0x28')]=_0x4ecd0c['outboundAnswerAgiCallsDay'];this[_0xf0a9('0x29')]=_0x4ecd0c['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x4ecd0c['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x4ecd0c[_0xf0a9('0x2a')];this[_0xf0a9('0x7')]=_0x4ecd0c[_0xf0a9('0x7')];this['outboundDropCallsDayACS']=_0x4ecd0c[_0xf0a9('0x2b')];this['outboundDropCallsDayCallersExit']=_0x4ecd0c[_0xf0a9('0x2c')];this[_0xf0a9('0x2d')]=_0x4ecd0c['outboundDropCallsDayTimeout'];this[_0xf0a9('0x8')]=_0x4ecd0c[_0xf0a9('0x8')];this[_0xf0a9('0x2e')]=_0x4ecd0c[_0xf0a9('0x2e')];this[_0xf0a9('0x2f')]=_0x4ecd0c[_0xf0a9('0x2f')];this['outboundReCallsDay']=_0x4ecd0c['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x4ecd0c['outboundRejectCallsDay'];this[_0xf0a9('0xb')]=_0x4ecd0c['outboundUnknownCallsDay'];this[_0xf0a9('0x30')]=_0x4ecd0c[_0xf0a9('0x30')];this[_0xf0a9('0x31')]=_0x4ecd0c[_0xf0a9('0x31')];this[_0xf0a9('0x32')]=_0x4ecd0c['predictiveIntervalAvgTalktime'];this[_0xf0a9('0x33')]=_0x4ecd0c[_0xf0a9('0x33')];this[_0xf0a9('0x34')]=_0x4ecd0c['predictiveIntervalDroppedCallsTimeout'];this[_0xf0a9('0x35')]=_0x4ecd0c['predictiveIntervalErlangCalls'];this[_0xf0a9('0x36')]=_0x4ecd0c[_0xf0a9('0x36')];this[_0xf0a9('0x37')]=_0x4ecd0c[_0xf0a9('0x37')];this[_0xf0a9('0x38')]=_0x4ecd0c[_0xf0a9('0x38')];this['predictiveIntervalPauses']=_0x4ecd0c[_0xf0a9('0x39')];this['predictiveIntervalAvailable']=_0x4ecd0c[_0xf0a9('0x3a')];this[_0xf0a9('0x3b')]=_0x4ecd0c[_0xf0a9('0x3b')];this[_0xf0a9('0x4')]=_0x4ecd0c[_0xf0a9('0x4')];this[_0xf0a9('0x3c')]=_0x4ecd0c[_0xf0a9('0x3c')];this[_0xf0a9('0x3d')]=_0x4ecd0c['erlangCallToSecond'];this['erlangAbandonmentRate']=_0x4ecd0c[_0xf0a9('0x3e')];this['erlangBusyFactor']=_0x4ecd0c[_0xf0a9('0x3f')];this[_0xf0a9('0x40')]=_0x4ecd0c[_0xf0a9('0x40')];this['startProgressive']=_0x4ecd0c[_0xf0a9('0x41')];this[_0xf0a9('0x42')]=_0x4ecd0c[_0xf0a9('0x42')];this[_0xf0a9('0x43')]=_0x4ecd0c[_0xf0a9('0x43')];}if(_0x4ecd0c['Trunk']){this['Trunk']={'id':_0x4ecd0c[_0xf0a9('0x44')]['id'],'name':_0x4ecd0c['Trunk'][_0xf0a9('0x11')],'active':_0x4ecd0c[_0xf0a9('0x44')][_0xf0a9('0x45')],'callerid':_0x4ecd0c[_0xf0a9('0x44')]['callerid']};}}VoiceQueueSummary[_0xf0a9('0x46')][_0xf0a9('0x47')]=function(_0x39978a,_0x27979f,_0xbfb1cc,_0x3f87d6){this[_0xf0a9('0x1')]=0x0;this[_0xf0a9('0x2')]=0x0;this[_0xf0a9('0x19')]=0x0;this[_0xf0a9('0x1f')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xf0a9('0x16')]=0x0;this[_0xf0a9('0x1e')]=0x0;this[_0xf0a9('0x1a')]=0x0;this[_0xf0a9('0x1b')]=0x0;this[_0xf0a9('0x17')]=0x0;if(_0xbfb1cc){if(_0xbfb1cc[_0xf0a9('0x3')]){this[_0xf0a9('0x3')]=Number(_0xbfb1cc[_0xf0a9('0x3')]);}if(_0xbfb1cc[_0xf0a9('0x48')]){this[_0xf0a9('0x0')]=Number(_0xbfb1cc[_0xf0a9('0x48')]);}if(_0xbfb1cc[_0xf0a9('0x49')]){this['waiting']=Number(_0xbfb1cc['callers']);}}for(var _0x2cd881=0x0;_0x2cd881<_0x39978a[_0xf0a9('0x4a')];_0x2cd881++){var _0x10fb4e=_0x27979f[_0xf0a9('0x4b')+_0x39978a[_0x2cd881]['name']];if(_0x10fb4e&&_0x10fb4e[_0xf0a9('0x4c')]){this[_0xf0a9('0x1')]+=0x1;}if(_0x39978a[_0x2cd881][_0xf0a9('0x4d')]==='1'){this[_0xf0a9('0x2')]+=0x1;}if(_0x39978a[_0x2cd881][_0xf0a9('0x19')]==='1'&&!['2','7','8'][_0xf0a9('0x4e')](_0x39978a[_0x2cd881][_0xf0a9('0x4f')])){this[_0xf0a9('0x19')]+=0x1;}switch(_0x39978a[_0x2cd881]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0xf0a9('0x18')]+=0x1;break;case'2':this[_0xf0a9('0x15')]+=0x1;break;case'3':this[_0xf0a9('0x14')]+=0x1;break;case'4':this[_0xf0a9('0x16')]+=0x1;break;case'5':this[_0xf0a9('0x1e')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xf0a9('0x17')]+=0x1;break;}}if(this[_0xf0a9('0x22')]===_0xf0a9('0x50')){var _0x1cf00e=Object[_0xf0a9('0x51')](_0x3f87d6);for(var _0x292a9e=0x0;_0x292a9e<_0x1cf00e[_0xf0a9('0x4a')];_0x292a9e++){var _0x584d2e=_0x1cf00e[_0x292a9e];var _0x2a2fdd=_0x3f87d6[_0x584d2e];if(_0x2a2fdd[_0xf0a9('0x52')]===this[_0xf0a9('0x11')]&&_0x2a2fdd[_0xf0a9('0x1d')]===_0xf0a9('0x53')&&_0x2a2fdd['exten']===_0xf0a9('0x54')){this[_0xf0a9('0x2')]+=0x1;}}if(this[_0xf0a9('0x2')]>this[_0xf0a9('0x15')]){this[_0xf0a9('0x2')]=this[_0xf0a9('0x15')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xf0a9('0x46')][_0xf0a9('0x55')]=function(_0x4cb976){var _0x51e847=![];if(_0x4cb976){_0x51e847=INBOUND_COUNTERS[_0xf0a9('0x56')](function(_0x240b1b){return this[_0x240b1b]!==_0x4cb976[_0x240b1b];},this);}return _0x51e847;};VoiceQueueSummary['prototype'][_0xf0a9('0x57')]=function(_0x2ab20c){var _0x2ee2a6=![];var _0x269731=![];var _0x54fe07=![];if(_0x2ab20c){_0x2ee2a6=this[_0xf0a9('0x22')]!==_0x2ab20c[_0xf0a9('0x22')]||this[_0xf0a9('0x21')]!==_0x2ab20c[_0xf0a9('0x21')]||this[_0xf0a9('0x42')]!==_0x2ab20c[_0xf0a9('0x42')]||this['statusMessage']!==_0x2ab20c['statusMessage'];_0x269731=OUTBOUND_COUNTERS[_0xf0a9('0x56')](function(_0x6828e0){return this[_0x6828e0]!==_0x2ab20c[_0x6828e0];},this);if(this[_0xf0a9('0x44')]&&_0x2ab20c['Trunk']){_0x54fe07=this[_0xf0a9('0x44')][_0xf0a9('0x11')]!==_0x2ab20c[_0xf0a9('0x44')]['name']||this['Trunk'][_0xf0a9('0x45')]!==_0x2ab20c['Trunk'][_0xf0a9('0x45')];}}return _0x2ee2a6||_0x269731||_0x54fe07;};VoiceQueueSummary[_0xf0a9('0x46')]['updateReportFromOutboundQueue']=function(_0x59f7c1){this[_0xf0a9('0x13')]=_0x59f7c1[_0xf0a9('0x13')];this[_0xf0a9('0x42')]=_0x59f7c1[_0xf0a9('0x42')];this[_0xf0a9('0x43')]=_0x59f7c1[_0xf0a9('0x43')];this[_0xf0a9('0x4')]=_0x59f7c1['originated'];this[_0xf0a9('0x5')]=_0x59f7c1['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x59f7c1[_0xf0a9('0x29')];this[_0xf0a9('0x6')]=_0x59f7c1['outboundBlacklistCallsDay'];this[_0xf0a9('0x2a')]=_0x59f7c1[_0xf0a9('0x2a')];this[_0xf0a9('0x7')]=_0x59f7c1[_0xf0a9('0x7')];this[_0xf0a9('0x8')]=_0x59f7c1[_0xf0a9('0x8')];this[_0xf0a9('0x2e')]=_0x59f7c1['outboundNoSuchCallsDay'];this[_0xf0a9('0x9')]=_0x59f7c1[_0xf0a9('0x9')];this[_0xf0a9('0xa')]=_0x59f7c1[_0xf0a9('0xa')];this[_0xf0a9('0xb')]=_0x59f7c1[_0xf0a9('0xb')];this['sumBillable']=_0x59f7c1[_0xf0a9('0xd')];this[_0xf0a9('0xe')]=_0x59f7c1[_0xf0a9('0xe')];this['total']=_0x59f7c1[_0xf0a9('0xf')];if(this[_0xf0a9('0x22')]===_0xf0a9('0x58')){this[_0xf0a9('0xc')]=_0x59f7c1[_0xf0a9('0xc')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b684046..1b249d7 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 _0x8e5d=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x493b70,_0x168e73){var _0x4c2355=function(_0x1e0247){while(--_0x1e0247){_0x493b70['push'](_0x493b70['shift']());}};_0x4c2355(++_0x168e73);}(_0x8e5d,0x121));var _0xd8e5=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0x8e5d[_0x118653];return _0xc11fa6;};'use strict';function VtigerAccount(_0x1ab569){this['id']=_0x1ab569['id']||0x0;this[_0xd8e5('0x0')]=_0x1ab569[_0xd8e5('0x0')]||'';this['username']=_0x1ab569[_0xd8e5('0x1')]||'';this[_0xd8e5('0x2')]=_0x1ab569['accessKey']||'';this[_0xd8e5('0x3')]=_0x1ab569[_0xd8e5('0x3')]||'';this[_0xd8e5('0x4')]=_0x1ab569[_0xd8e5('0x4')]||'';this[_0xd8e5('0x5')]=_0x1ab569[_0xd8e5('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x2530=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2530,0x107));var _0x0253=function(_0x42de85,_0x3ea9a9){_0x42de85=_0x42de85-0x0;var _0x5dfa56=_0x2530[_0x42de85];return _0x5dfa56;};'use strict';function VtigerAccount(_0x3c0fb4){this['id']=_0x3c0fb4['id']||0x0;this[_0x0253('0x0')]=_0x3c0fb4[_0x0253('0x0')]||'';this[_0x0253('0x1')]=_0x3c0fb4[_0x0253('0x1')]||'';this['accessKey']=_0x3c0fb4['accessKey']||'';this['remoteUri']=_0x3c0fb4[_0x0253('0x2')]||'';this[_0x0253('0x3')]=_0x3c0fb4[_0x0253('0x3')]||'';this[_0x0253('0x4')]=_0x3c0fb4['Configurations']||{};}module[_0x0253('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index ec48799..da2e7e9 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 _0x8b26=['integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri','authType','type'];(function(_0x5ad4e8,_0x3f9c9d){var _0x33e5cd=function(_0x208573){while(--_0x208573){_0x5ad4e8['push'](_0x5ad4e8['shift']());}};_0x33e5cd(++_0x3f9c9d);}(_0x8b26,0xcb));var _0x68b2=function(_0x4afc33,_0x5088fd){_0x4afc33=_0x4afc33-0x0;var _0x448b1c=_0x8b26[_0x4afc33];return _0x448b1c;};'use strict';function ZendeskAccount(_0x40f24e){this['id']=_0x40f24e['id']||0x0;this[_0x68b2('0x0')]=_0x40f24e['name']||'';this[_0x68b2('0x1')]=_0x40f24e[_0x68b2('0x1')]||'';this[_0x68b2('0x2')]=_0x40f24e[_0x68b2('0x2')]||'';this[_0x68b2('0x3')]=_0x40f24e['token']||'';this[_0x68b2('0x4')]=_0x40f24e['remoteUri']||'';this['authType']=_0x40f24e[_0x68b2('0x5')]||'';this[_0x68b2('0x6')]=_0x40f24e['type']||_0x68b2('0x7');this[_0x68b2('0x8')]=_0x40f24e['serverUrl']||'';this[_0x68b2('0x9')]=_0x40f24e[_0x68b2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x6c65=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x498ceb,_0x5e0184){var _0x367699=function(_0x165a35){while(--_0x165a35){_0x498ceb['push'](_0x498ceb['shift']());}};_0x367699(++_0x5e0184);}(_0x6c65,0x10e));var _0x56c6=function(_0x483afe,_0x4f6d9c){_0x483afe=_0x483afe-0x0;var _0x2303e5=_0x6c65[_0x483afe];return _0x2303e5;};'use strict';function ZendeskAccount(_0x188582){this['id']=_0x188582['id']||0x0;this[_0x56c6('0x0')]=_0x188582[_0x56c6('0x0')]||'';this[_0x56c6('0x1')]=_0x188582['username']||'';this[_0x56c6('0x2')]=_0x188582['password']||'';this[_0x56c6('0x3')]=_0x188582[_0x56c6('0x3')]||'';this[_0x56c6('0x4')]=_0x188582[_0x56c6('0x4')]||'';this[_0x56c6('0x5')]=_0x188582[_0x56c6('0x5')]||'';this[_0x56c6('0x6')]=_0x188582[_0x56c6('0x6')]||_0x56c6('0x7');this[_0x56c6('0x8')]=_0x188582['serverUrl']||'';this['Configurations']=_0x188582[_0x56c6('0x9')]||{};}module[_0x56c6('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 5e6574c..8b37818 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 _0x09dd=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x09dd,0x15e));var _0xd09d=function(_0x4cd22f,_0x57c3ea){_0x4cd22f=_0x4cd22f-0x0;var _0x2342d3=_0x09dd[_0x4cd22f];return _0x2342d3;};'use strict';function ZohoAccount(_0x13c1df){this['id']=_0x13c1df['id']||0x0;this[_0xd09d('0x0')]=_0x13c1df[_0xd09d('0x0')]||'';this['description']=_0x13c1df[_0xd09d('0x1')]||'';this[_0xd09d('0x2')]=_0x13c1df[_0xd09d('0x2')]||'';this[_0xd09d('0x3')]=_0x13c1df[_0xd09d('0x3')]||'';this[_0xd09d('0x4')]=_0x13c1df['clientId']||'';this[_0xd09d('0x5')]=_0x13c1df[_0xd09d('0x5')]||'';this['serverUrl']=_0x13c1df[_0xd09d('0x6')]||'';this['code']=_0x13c1df[_0xd09d('0x7')]||'';this[_0xd09d('0x8')]=_0x13c1df[_0xd09d('0x8')]||'';this[_0xd09d('0x9')]=_0x13c1df['Configurations']||{};}module[_0xd09d('0xa')]=ZohoAccount; \ No newline at end of file +var _0x967f=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x4b47fa,_0x5816d1){var _0x49fb27=function(_0x31d1a9){while(--_0x31d1a9){_0x4b47fa['push'](_0x4b47fa['shift']());}};_0x49fb27(++_0x5816d1);}(_0x967f,0xd1));var _0xf967=function(_0x45557e,_0x15c22c){_0x45557e=_0x45557e-0x0;var _0x2a468e=_0x967f[_0x45557e];return _0x2a468e;};'use strict';function ZohoAccount(_0xa7a2bc){this['id']=_0xa7a2bc['id']||0x0;this[_0xf967('0x0')]=_0xa7a2bc[_0xf967('0x0')]||'';this['description']=_0xa7a2bc[_0xf967('0x1')]||'';this[_0xf967('0x2')]=_0xa7a2bc[_0xf967('0x2')]||'';this[_0xf967('0x3')]=_0xa7a2bc[_0xf967('0x3')]||'';this[_0xf967('0x4')]=_0xa7a2bc[_0xf967('0x4')]||'';this[_0xf967('0x5')]=_0xa7a2bc[_0xf967('0x5')]||'';this[_0xf967('0x6')]=_0xa7a2bc[_0xf967('0x6')]||'';this[_0xf967('0x7')]=_0xa7a2bc[_0xf967('0x7')]||'';this[_0xf967('0x8')]=_0xa7a2bc[_0xf967('0x8')]||'';this['Configurations']=_0xa7a2bc[_0xf967('0x9')]||{};}module[_0xf967('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 607b86b..936df79 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 _0xf61e=['phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','Contact','firstName','lastName','active','calleridnum'];(function(_0x2fe85a,_0x28c346){var _0x468e0f=function(_0x515887){while(--_0x515887){_0x2fe85a['push'](_0x2fe85a['shift']());}};_0x468e0f(++_0x28c346);}(_0xf61e,0x191));var _0xef61=function(_0x5de942,_0x2b9bec){_0x5de942=_0x5de942-0x0;var _0x3fde74=_0xf61e[_0x5de942];return _0x3fde74;};'use strict';var util=require(_0xef61('0x0'));var _=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));function checkNameSurname(_0xcf15bd,_0x205269,_0xeccd26){var _0x3613e6='';if(!_[_0xef61('0x3')](_0x205269)&&_0xef61('0x4')===typeof _0x205269){_0x3613e6+=_0x205269;}if(!_[_0xef61('0x3')](_0xeccd26)&&_0xef61('0x4')===typeof _0xeccd26){_0x3613e6+='\x20'+_0xeccd26;}if(_0x3613e6!==''){return _0x3613e6;}return _0xcf15bd;}function Action(_0x45a18d,_0x5b00b2,_0x9e17f4,_0x3e2f79,_0x4f0cc5){this[_0xef61('0x5')]=_0x9e17f4||undefined;this[_0xef61('0x6')]=_0x45a18d['id'];this[_0xef61('0x7')]=_0x5b00b2['name'];this['type']=_0x5b00b2[_0xef61('0x8')];this[_0xef61('0x9')]=_0xef61('0x7');this[_0xef61('0xa')]=![];this[_0xef61('0xb')]=_[_0xef61('0x3')](_0x45a18d[_0xef61('0xc')])?undefined:_0x45a18d[_0xef61('0xc')][_0xef61('0xd')];this[_0xef61('0xe')]=this[_0xef61('0xb')]?util[_0xef61('0xf')](_0xef61('0x10'),this[_0xef61('0xb')]):_0x3e2f79||undefined;this['calleridname']=checkNameSurname(_0x45a18d[_0xef61('0x11')]['phone'],_0x45a18d[_0xef61('0x11')][_0xef61('0x12')],_0x45a18d[_0xef61('0x11')][_0xef61('0x13')]);this['active']=_0x45a18d[_0xef61('0x14')]||![];this[_0xef61('0x15')]=_0x45a18d[_0xef61('0x16')];this[_0xef61('0x17')]=_0x45a18d['scheduledat'];this[_0xef61('0x18')]=_0x45a18d[_0xef61('0x18')]||0x0;this['countcongestionretry']=_0x45a18d[_0xef61('0x19')]||0x0;this[_0xef61('0x1a')]=_0x45a18d[_0xef61('0x1a')]||0x0;this[_0xef61('0x1b')]=(_0x45a18d[_0xef61('0x18')]||0x0)+(_0x45a18d[_0xef61('0x19')]||0x0)+(_0x45a18d[_0xef61('0x1a')]||0x0)+(_0x45a18d['countnosuchnumberretry']||0x0)+(_0x45a18d[_0xef61('0x1c')]||0x0)+(_0x45a18d[_0xef61('0x1d')]||0x0)+(_0x45a18d['countmachineretry']||0x0)+(_0x45a18d[_0xef61('0x1e')]||0x0);this[_0xef61('0x1f')]=_0x45a18d[_0xef61('0x1f')]||0x0;this[_0xef61('0x1c')]=_0x45a18d[_0xef61('0x1c')]||0x0;this[_0xef61('0x1d')]=_0x45a18d[_0xef61('0x1d')]||0x0;this['countmachineretry']=_0x45a18d['countmachineretry']||0x0;this[_0xef61('0x1e')]=_0x45a18d['countagentrejectretry']||0x0;this[_0xef61('0x20')]=_0x45a18d['callback'];this['callbackuniqueid']=_0x45a18d[_0xef61('0x21')];this['callbackat']=_0x45a18d['callbackat'];this[_0xef61('0x22')]=_0x45a18d[_0xef61('0x22')];this[_0xef61('0x23')]=_0x45a18d[_0xef61('0x23')];this['ListId']=_0x45a18d[_0xef61('0x24')];this['UserId']=_[_0xef61('0x3')](_0x45a18d[_0xef61('0xc')])?_0x45a18d[_0xef61('0x25')]:_0x45a18d[_0xef61('0xc')]['id'];this[_0xef61('0x26')]=_0x45a18d[_0xef61('0x26')];this[_0xef61('0x27')]='';this[_0xef61('0x28')]='';}Action[_0xef61('0x29')][_0xef61('0x2a')]=function(){return util[_0xef61('0xf')](_0xef61('0x2b'),this[_0xef61('0x2c')],this[_0xef61('0x2d')]);};module[_0xef61('0x2e')]=Action; \ No newline at end of file +var _0xcf66=['membername','calleridname','Contact','phone','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','dialAnswer','Agent','SIP/%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf66,0x71));var _0x6cf6=function(_0x325681,_0x1ead05){_0x325681=_0x325681-0x0;var _0x198068=_0xcf66[_0x325681];return _0x198068;};'use strict';var util=require(_0x6cf6('0x0'));var _=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));function checkNameSurname(_0x56f1fd,_0x7ed4c0,_0x1af283){var _0x49ce88='';if(!_['isNil'](_0x7ed4c0)&&_0x6cf6('0x3')===typeof _0x7ed4c0){_0x49ce88+=_0x7ed4c0;}if(!_[_0x6cf6('0x4')](_0x1af283)&&'string'===typeof _0x1af283){_0x49ce88+='\x20'+_0x1af283;}if(_0x49ce88!==''){return _0x49ce88;}return _0x56f1fd;}function Action(_0x39f1d6,_0x1fbedd,_0x2a573e,_0x5eb082,_0x94c6a9){this[_0x6cf6('0x5')]=_0x2a573e||undefined;this[_0x6cf6('0x6')]=_0x39f1d6['id'];this[_0x6cf6('0x7')]=_0x1fbedd[_0x6cf6('0x8')];this[_0x6cf6('0x9')]=_0x1fbedd['type'];this['campaigntype']='queue';this[_0x6cf6('0xa')]=![];this['membername']=_[_0x6cf6('0x4')](_0x39f1d6[_0x6cf6('0xb')])?undefined:_0x39f1d6[_0x6cf6('0xb')][_0x6cf6('0x8')];this['channelAgent']=this['membername']?util['format'](_0x6cf6('0xc'),this[_0x6cf6('0xd')]):_0x5eb082||undefined;this[_0x6cf6('0xe')]=checkNameSurname(_0x39f1d6[_0x6cf6('0xf')][_0x6cf6('0x10')],_0x39f1d6[_0x6cf6('0xf')]['firstName'],_0x39f1d6[_0x6cf6('0xf')]['lastName']);this[_0x6cf6('0x11')]=_0x39f1d6[_0x6cf6('0x11')]||![];this['calleridnum']=_0x39f1d6[_0x6cf6('0x10')];this[_0x6cf6('0x12')]=_0x39f1d6[_0x6cf6('0x12')];this[_0x6cf6('0x13')]=_0x39f1d6[_0x6cf6('0x13')]||0x0;this[_0x6cf6('0x14')]=_0x39f1d6[_0x6cf6('0x14')]||0x0;this[_0x6cf6('0x15')]=_0x39f1d6[_0x6cf6('0x15')]||0x0;this[_0x6cf6('0x16')]=(_0x39f1d6['countbusyretry']||0x0)+(_0x39f1d6[_0x6cf6('0x14')]||0x0)+(_0x39f1d6[_0x6cf6('0x15')]||0x0)+(_0x39f1d6[_0x6cf6('0x17')]||0x0)+(_0x39f1d6['countdropretry']||0x0)+(_0x39f1d6[_0x6cf6('0x18')]||0x0)+(_0x39f1d6[_0x6cf6('0x19')]||0x0)+(_0x39f1d6[_0x6cf6('0x1a')]||0x0);this[_0x6cf6('0x17')]=_0x39f1d6[_0x6cf6('0x17')]||0x0;this[_0x6cf6('0x1b')]=_0x39f1d6[_0x6cf6('0x1b')]||0x0;this['countabandonedretry']=_0x39f1d6[_0x6cf6('0x18')]||0x0;this[_0x6cf6('0x19')]=_0x39f1d6[_0x6cf6('0x19')]||0x0;this[_0x6cf6('0x1a')]=_0x39f1d6[_0x6cf6('0x1a')]||0x0;this[_0x6cf6('0x1c')]=_0x39f1d6[_0x6cf6('0x1c')];this[_0x6cf6('0x1d')]=_0x39f1d6['callbackuniqueid'];this['callbackat']=_0x39f1d6[_0x6cf6('0x1e')];this['recallme']=_0x39f1d6[_0x6cf6('0x1f')];this[_0x6cf6('0x20')]=_0x39f1d6[_0x6cf6('0x20')];this[_0x6cf6('0x21')]=_0x39f1d6[_0x6cf6('0x21')];this[_0x6cf6('0x22')]=_[_0x6cf6('0x4')](_0x39f1d6['Agent'])?_0x39f1d6[_0x6cf6('0x22')]:_0x39f1d6[_0x6cf6('0xb')]['id'];this[_0x6cf6('0x23')]=_0x39f1d6['VoiceQueueId'];this[_0x6cf6('0x24')]='';this[_0x6cf6('0x25')]='';}Action[_0x6cf6('0x26')][_0x6cf6('0x27')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x6cf6('0xe')],this[_0x6cf6('0x28')]);};module[_0x6cf6('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 237c4ad..38ad343 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 _0x892d=['ioredis','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','type','dialActive','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','getContactRecallMe','then','length','getDiff','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','totalGlobal','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','Global','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','isValid','[Preview][getContactPreview]','Call\x20unsuccessful','Queue','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','dialCutDigit','substring','TrunkBackup','trim','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','addVariables','setXMDContactVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variables','variablesAction','[originated][increment]','OriginateError','clone','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','[syncHangup][talking][transfer]','addVariable','filterKey','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','lodash','uuid'];(function(_0x194022,_0x416fc6){var _0xcc9efb=function(_0x2d2207){while(--_0x2d2207){_0x194022['push'](_0x194022['shift']());}};_0xcc9efb(++_0x416fc6);}(_0x892d,0x136));var _0xd892=function(_0x50084d,_0x2552c2){_0x50084d=_0x50084d-0x0;var _0x463432=_0x892d[_0x50084d];return _0x463432;};'use strict';var util=require(_0xd892('0x0'));var _=require(_0xd892('0x1'));var uuid=require(_0xd892('0x2'));var moment=require('moment');var Redis=require(_0xd892('0x3'));var config=require('../../../config/environment');var logger=require(_0xd892('0x4'))(_0xd892('0x5'));var loggerAction=require(_0xd892('0x4'))('actionPreview');var ami=require(_0xd892('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xd892('0x7'));var Action=require(_0xd892('0x8'));var ut=require(_0xd892('0x9'));var utils=require(_0xd892('0xa'));config['redis']=_[_0xd892('0xb')](config[_0xd892('0xc')],{'host':_0xd892('0xd'),'port':0x18eb});var io=require(_0xd892('0xe'))(new Redis(config[_0xd892('0xc')]));var Sequence=function(){};Sequence[_0xd892('0xf')][_0xd892('0x10')]=function(_0x1053a2){this[_0xd892('0x11')]=this['tail']?this[_0xd892('0x11')][_0xd892('0x12')](_0x1053a2):_0x1053a2();};function Preview(_0x24ffd5){this[_0xd892('0x13')]=new Sequence();this['campaignsPreview']=_0x24ffd5[_0xd892('0x14')];this[_0xd892('0x15')]=_0x24ffd5['trunks'];this['actions']={};this[_0xd892('0x16')]=_0x24ffd5[_0xd892('0x16')];this[_0xd892('0x17')]=0x0;ami['on'](_0xd892('0x18'),this[_0xd892('0x19')]['bind'](this));ami['on'](_0xd892('0x1a'),this[_0xd892('0x1b')][_0xd892('0x1c')](this));ami['on'](_0xd892('0x1d'),this[_0xd892('0x1e')]['bind'](this));ami['on'](_0xd892('0x1f'),this[_0xd892('0x20')][_0xd892('0x1c')](this));ami['on'](_0xd892('0x21'),this[_0xd892('0x22')][_0xd892('0x1c')](this));ami['on'](_0xd892('0x23'),this[_0xd892('0x24')][_0xd892('0x1c')](this));ami['on']('attendedtransfer',this[_0xd892('0x25')]['bind'](this));ami['on'](_0xd892('0x26'),this['syncBlindTransfer'][_0xd892('0x1c')](this));this[_0xd892('0x27')](this[_0xd892('0x28')]);}function emit(_0x529b18,_0x2990e8,_0x4f5af0){io['to'](_0x529b18)[_0xd892('0x29')](_0x2990e8,_0x4f5af0);}function emitVoiceQueueChannelRemove(_0x4b870c){logger[_0xd892('0x2a')](_0xd892('0x2b'),JSON[_0xd892('0x2c')](_0x4b870c));emit(util[_0xd892('0x2d')](_0xd892('0x2e'),_0x4b870c['name']),_0xd892('0x2f'),_0x4b870c);io[_0xd892('0x29')](_0xd892('0x30'),_0x4b870c);}function notSendMessagesQueue(_0x400c12){if(_0x400c12[_0xd892('0x31')]){if(_0x400c12[_0xd892('0x32')]===0x0&&_0x400c12[_0xd892('0x33')]===0x0){_0x400c12[_0xd892('0x31')]=![];_0x400c12[_0xd892('0x34')]=0x0;_0x400c12[_0xd892('0x35')]=0x0;_0x400c12[_0xd892('0x36')]=utils[_0xd892('0x37')][_0xd892('0x38')];ut[_0xd892('0x39')](_0xd892('0x3a'),_0x400c12[_0xd892('0x3b')]+_0xd892('0x3c'));}else{_0x400c12[_0xd892('0x36')]=utils[_0xd892('0x37')][_0xd892('0x3d')];ut[_0xd892('0x39')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x400c12[_0xd892('0x3b')]+'\x20is\x20deactivated');}}}Preview[_0xd892('0xf')][_0xd892('0x27')]=function(){var _0x5354b8=this;setInterval(function(){_0x5354b8[_0xd892('0x3e')]();},0x7cf);};Preview[_0xd892('0xf')][_0xd892('0x3e')]=function(){var _0x2594eb=this[_0xd892('0x28')];this[_0xd892('0x17')]+=0x1;for(var _0x4e4f15 in _0x2594eb){if(_0x2594eb[_0xd892('0x3f')](_0x4e4f15)&&(_0x2594eb[_0x4e4f15][_0xd892('0x40')]==='preview'||_0x2594eb[_0x4e4f15][_0xd892('0x40')]===_0xd892('0x41'))&&_0x2594eb[_0x4e4f15]['type']===_0xd892('0x42')){if(this['clockClearZombieChannels']>0x7){this[_0xd892('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x2594eb[_0xd892('0x3f')](_0x4e4f15)&&_0x2594eb[_0x4e4f15]['dialMethod']==='preview'&&_0x2594eb[_0x4e4f15][_0xd892('0x43')]===_0xd892('0x42')){if(_0x2594eb[_0x4e4f15][_0xd892('0x44')]){this['setMessage'](_0x2594eb[_0x4e4f15]);if(_0x2594eb[_0x4e4f15]['dialPreviewAutoRecallMe'])this[_0xd892('0x45')](_0x2594eb[_0x4e4f15]);}else{notSendMessagesQueue(_0x2594eb[_0x4e4f15]);}}}};Preview['prototype'][_0xd892('0x46')]=function(_0xe61c0a){var _0x5f308a=this;this[_0xd892('0x13')]['enqueue'](function(){if(!_[_0xd892('0x47')](_0x5f308a[_0xd892('0x48')][_0xe61c0a])){loggerAction[_0xd892('0x2a')](_0xd892('0x49'),_0xe61c0a,'Queue',_0x5f308a[_0xd892('0x48')][_0xe61c0a]['queue'],'originated:\x20',JSON['stringify'](_0x5f308a[_0xd892('0x28')][_0x5f308a['actions'][_0xe61c0a][_0xd892('0x4a')]][_0xd892('0x32')]),_0xd892('0x4b'),JSON[_0xd892('0x2c')](_0x5f308a[_0xd892('0x28')][_0x5f308a[_0xd892('0x48')][_0xe61c0a][_0xd892('0x4a')]][_0xd892('0x33')]),JSON[_0xd892('0x2c')](_0x5f308a[_0xd892('0x48')][_0xe61c0a][_0xd892('0x4c')]),JSON[_0xd892('0x2c')](_[_0xd892('0x4d')](_0x5f308a[_0xd892('0x48')][_0xe61c0a],[_0xd892('0x4e'),_0xd892('0x4f'),'VoiceQueueId',_0xd892('0x50')])));return ami[_0xd892('0x51')]({'action':_0xd892('0x52'),'channel':_0x5f308a[_0xd892('0x48')][_0xe61c0a][_0xd892('0x53')]})['catch'](function(_0x36384d){if(_0x36384d[_0xd892('0x36')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5f308a[_0xd892('0x48')][_0xe61c0a]){ut[_0xd892('0x54')](_0x5f308a[_0xd892('0x28')][_0x5f308a['actions'][_0xe61c0a][_0xd892('0x4a')]],_0xd892('0x55'));if(_0x5f308a[_0xd892('0x48')][_0xe61c0a][_0xd892('0x4c')]===!![]){ut[_0xd892('0x56')](_0x5f308a[_0xd892('0x28')][_0x5f308a[_0xd892('0x48')][_0xe61c0a][_0xd892('0x4a')]],_0xd892('0x55'));ut[_0xd892('0x57')](_0xd892('0x58')+_0xe61c0a,_0x5f308a['actions'][_0xe61c0a][_0xd892('0x4a')]);}ut[_0xd892('0x57')]('[Dialer][checkChannel][Preview]'+_0xe61c0a,_0x5f308a[_0xd892('0x48')][_0xe61c0a][_0xd892('0x4a')]);delete _0x5f308a['actions'][_0xe61c0a];}},0x2328);}});}});};Preview[_0xd892('0xf')]['clearZombieChannels']=function(){var _0x5af4a3=this;loggerAction[_0xd892('0x2a')]('[action]',_[_0xd892('0x59')](this[_0xd892('0x48')]));for(var _0x41fb44 in this[_0xd892('0x48')]){if(_0x5af4a3[_0xd892('0x48')][_0xd892('0x3f')](_0x41fb44)){_0x5af4a3[_0xd892('0x46')](_0x41fb44);}}};Preview['prototype'][_0xd892('0x45')]=function(_0x11e98e){var _0x2854e0=this;rpcDb[_0xd892('0x5a')](_0x11e98e['id'],ut['agentReadyId'](this['agents']))[_0xd892('0x5b')](function(_0x3da90f){if(!_[_0xd892('0x47')](_0x3da90f)){for(var _0xe2c770=0x0;_0xe2c770<_0x3da90f[_0xd892('0x5c')];_0xe2c770+=0x1){if(ut[_0xd892('0x5d')](_0x3da90f[_0xe2c770]['scheduledat'])<_0x11e98e['dialRecallMeTimeout']*0x3c){if(_0x3da90f[_0xe2c770][_0xd892('0x5e')]&&!_0x3da90f[_0xe2c770][_0xd892('0x5e')][_0xd892('0x5f')]){_0x2854e0[_0xd892('0x60')](_0x3da90f[_0xe2c770]['id'])[_0xd892('0x5b')](ut['logger2'](_0xd892('0x61')))[_0xd892('0x62')](ut[_0xd892('0x63')](_0xd892('0x61')));}else{rpcDb[_0xd892('0x64')](_0x3da90f[_0xe2c770]['id']);}}else{var _0x3d7130=new Action(_0x3da90f[_0xe2c770],_0x11e98e);_0x3d7130[_0xd892('0x65')]=moment()[_0xd892('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');_0x11e98e[_0xd892('0x66')]+=0x1;ut[_0xd892('0x67')](_0x3d7130,0x17,_0xd892('0x68'));if(_0x11e98e['dialRecallInQueue']){rpcDb[_0xd892('0x69')](ut[_0xd892('0x6a')](_0x3da90f[_0xe2c770]));rpcDb[_0xd892('0x6b')](_0x3d7130,_0xd892('0x6c'));}else{ut[_0xd892('0x67')](_0x3d7130,0x16,_0xd892('0x6d'));rpcDb[_0xd892('0x6b')](_0x3d7130,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x3d7130,'[HistoryRecallClose]');}}}}})[_0xd892('0x62')](ut[_0xd892('0x63')]('[getContactRecallMe]'));};Preview[_0xd892('0xf')][_0xd892('0x6e')]=function(_0x539add){_0x539add[_0xd892('0x31')]=!![];if(ut[_0xd892('0x6f')](_0x539add['loggedIn'])){_0x539add[_0xd892('0x36')]=utils[_0xd892('0x37')][_0xd892('0x70')];}else if(!ut[_0xd892('0x71')](_0x539add[_0xd892('0x44')])){_0x539add[_0xd892('0x36')]=utils[_0xd892('0x37')]['INACTIVE'];}else if(!this[_0xd892('0x72')](_0x539add[_0xd892('0x73')])){if(!this[_0xd892('0x72')](_0x539add['TrunkBackup'])){_0x539add['message']=utils['CAMPAIGN_STATUS'][_0xd892('0x74')];}else{_0x539add[_0xd892('0x36')]=utils[_0xd892('0x37')][_0xd892('0x75')];}}else{_0x539add[_0xd892('0x36')]=utils[_0xd892('0x37')][_0xd892('0x75')];}};Preview[_0xd892('0xf')][_0xd892('0x76')]=function(_0x139a79,_0x2ad950,_0x2063bb){var _0x3ba739=this;var _0x38e1d2=this[_0xd892('0x48')][_0x2ad950];var _0xe2579b=this[_0xd892('0x28')][_0x38e1d2['queue']];var _0x3d3fc8;var _0x399766=![];var _0x52f223=0x2;var _0x5ea425=0x3;if(_0xe2579b){switch(_0x2063bb){case'1':_0xe2579b[_0xd892('0x77')]+=0x1;_0x38e1d2['countnosuchnumberretry']+=0x1;_0x38e1d2[_0xd892('0x78')]=ut['totalGlobal'](_0x38e1d2);ut['logCustomer'](_0x38e1d2,0x0,_0xd892('0x79'));ami[_0xd892('0x29')]('custom:agentnosuchnumber',ut[_0xd892('0x7a')](_0x38e1d2,_0xd892('0x7b')));rpcDb[_0xd892('0x6b')](_0x38e1d2,_0xd892('0x7c'));_0x3ba739[_0xd892('0x7d')](_0x38e1d2,'0',_0xe2579b)['then'](function(_0x3dbc1b){_0x399766=_0x3dbc1b[_0xd892('0x7e')]==0x1;_0x52f223=_0xe2579b[_0xd892('0x7f')];_0x5ea425=_0xe2579b['callAdditionalPhoneAfterMin'];if(!_0x399766){if(ut['totalGlobal'](_0x38e1d2)>=_0xe2579b[_0xd892('0x80')]){_0x3d3fc8=ut[_0xd892('0x81')](_0x38e1d2,0xf,'Global');rpcDb[_0xd892('0x82')](_0x3d3fc8,_0xd892('0x83'));}else{if(_0x38e1d2[_0xd892('0x84')]>=_0xe2579b[_0xd892('0x85')]){rpcDb[_0xd892('0x82')](_0x38e1d2,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0xd892('0x86')](_0x38e1d2,_0xd892('0x84'),_0xe2579b['dialNoSuchNumberRetryFrequency']),_0x38e1d2[_0xd892('0x87')],_0x38e1d2[_0xd892('0x88')]);}}delete this[_0xd892('0x48')][_0x139a79[_0xd892('0x89')]];}else{_0x38e1d2[_0xd892('0x84')]++;logger[_0xd892('0x2a')](_0xd892('0x8a'),_0x38e1d2[_0xd892('0x84')]);logger[_0xd892('0x2a')]('id',_0x38e1d2[_0xd892('0x8b')]);_0x3ba739[_0xd892('0x8c')]({'id':_0x38e1d2[_0xd892('0x8b')],'field':{'countnosuchnumberretry':_0x38e1d2['countnosuchnumberretry']}})['then'](function(){_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)['then'](function(){});});}});break;case _0xd892('0x8e'):var _0x1fba33=moment()[_0xd892('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');_0x38e1d2['responsetime']=_0x1fba33;_0x38e1d2['answertime']=_0x1fba33;_0x38e1d2[_0xd892('0x4c')]=!![];_0xe2579b[_0xd892('0x33')]+=0x1;logger[_0xd892('0x2a')]('[syncHangup][talking][increment]',_0x38e1d2[_0xd892('0x8f')],_0xd892('0x90'),_0xe2579b[_0xd892('0x3b')],_0xd892('0x4b'),_0xe2579b[_0xd892('0x33')]);ami[_0xd892('0x29')](_0xd892('0x91'),ut['buildObj'](_0x38e1d2,_0xd892('0x92'),this[_0xd892('0x28')][_0x38e1d2['queue']]));if(_0xe2579b['acw']){ami[_0xd892('0x29')](_0xd892('0x93'),ut[_0xd892('0x94')](_0x38e1d2));}break;case'16':ami[_0xd892('0x29')](_0xd892('0x95'),ut[_0xd892('0x7a')](_0x38e1d2,_0xd892('0x96'),this[_0xd892('0x28')][_0x38e1d2[_0xd892('0x4a')]]));emitVoiceQueueChannelRemove(ut[_0xd892('0x7a')](_0x38e1d2,_0xd892('0x96')));_0xe2579b[_0xd892('0x97')]+=0x1;_0xe2579b[_0xd892('0x98')]+=0x1;_0xe2579b[_0xd892('0x99')]+=0x1;ut[_0xd892('0x56')](_0xe2579b,_0xd892('0x9a'));_0x38e1d2['countglobal']=ut[_0xd892('0x9b')](_0x38e1d2);ut[_0xd892('0x67')](_0x38e1d2,0x4,_0xd892('0x9c'));rpcDb[_0xd892('0x6b')](_0x38e1d2,_0xd892('0x9d'));rpcDb[_0xd892('0x82')](_0x38e1d2,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x38e1d2);_0xe2579b[_0xd892('0x9e')]+=_0x38e1d2[_0xd892('0x9f')];_0xe2579b[_0xd892('0xa0')]+=_0x38e1d2[_0xd892('0x9f')];logger[_0xd892('0x2a')](_0xd892('0xa1'),_0x38e1d2[_0xd892('0x8f')],_0xd892('0x90'),_0xe2579b[_0xd892('0x3b')],_0xd892('0x4b'),_0xe2579b['pTalking']);delete this[_0xd892('0x48')][_0x139a79[_0xd892('0x89')]];break;case _0xd892('0xa2'):_0xe2579b[_0xd892('0xa3')]+=0x1;_0x38e1d2['countbusyretry']+=0x1;_0x38e1d2[_0xd892('0x78')]=ut[_0xd892('0x9b')](_0x38e1d2);ut['logCustomer'](_0x38e1d2,0x5,_0xd892('0xa4'));_0x52f223=_0xe2579b[_0xd892('0xa5')];_0x5ea425=_0xe2579b[_0xd892('0xa6')];ami[_0xd892('0x29')](_0xd892('0xa7'),ut[_0xd892('0x7a')](_0x38e1d2,'busy'));rpcDb[_0xd892('0x6b')](_0x38e1d2,_0xd892('0xa8'));_0x3ba739['verifyAdditionalPhones'](_0x38e1d2,'5',_0xe2579b)[_0xd892('0x5b')](function(_0x159879){_0x399766=_0x159879[_0xd892('0x7e')]==0x1;if(!_0x399766){if(ut[_0xd892('0x9b')](_0x38e1d2)>=_0xe2579b['dialGlobalMaxRetry']){_0x3d3fc8=ut[_0xd892('0x81')](_0x38e1d2,0xf,'Global');rpcDb[_0xd892('0x82')](_0x3d3fc8,_0xd892('0xa9'));}else{if(_0x38e1d2[_0xd892('0xaa')]>=_0xe2579b[_0xd892('0xab')]){rpcDb[_0xd892('0x82')](_0x38e1d2,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd892('0xac')](ut['scheduledAt'](_0x38e1d2,_0xd892('0xaa'),_0xe2579b[_0xd892('0xa5')]),_0x38e1d2['unlockAgent'],_0x38e1d2['activeContact']);}}}else{_0x38e1d2[_0xd892('0xaa')]++;_0x3ba739[_0xd892('0x8c')]({'id':_0x38e1d2[_0xd892('0x8b')],'field':{'countbusyretry':_0x38e1d2[_0xd892('0xaa')]}})['then'](function(){_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)['then'](function(){});});}});break;case _0xd892('0xad'):_0xe2579b[_0xd892('0xae')]+=0x1;_0x38e1d2['countnoanswerretry']+=0x1;_0x38e1d2[_0xd892('0x78')]=ut['totalGlobal'](_0x38e1d2);ut[_0xd892('0x67')](_0x38e1d2,0x3,_0xd892('0xaf'));_0x52f223=_0xe2579b[_0xd892('0xb0')];_0x5ea425=_0xe2579b[_0xd892('0xa6')];var _0x4d57d7=ut[_0xd892('0xb1')](_0x38e1d2,_0xe2579b);ami[_0xd892('0x29')](_0xd892('0xb2'),_0x4d57d7);rpcDb[_0xd892('0x6b')](_0x38e1d2,'[callProgressDetectingCustomer][logNoAnswer]');_0x3ba739[_0xd892('0x7d')](_0x38e1d2,'3',_0xe2579b)[_0xd892('0x5b')](function(_0x1f65f0){_0x399766=_0x1f65f0['additional']==0x1;if(!_0x399766){if(ut[_0xd892('0x9b')](_0x38e1d2)>=_0xe2579b['dialGlobalMaxRetry']){_0x3d3fc8=ut[_0xd892('0x81')](_0x38e1d2,0xf,'Global');rpcDb[_0xd892('0x82')](_0x3d3fc8,_0xd892('0xb3'));}else{if(_0x38e1d2[_0xd892('0xb4')]>=_0xe2579b[_0xd892('0xb5')]){rpcDb['createCustomerFinal'](_0x38e1d2,_0xd892('0xb6'));}else{rpcDb[_0xd892('0xac')](ut[_0xd892('0x86')](_0x38e1d2,'countnoanswerretry',_0xe2579b['dialNoAnswerRetryFrequency']),_0x38e1d2['unlockAgent'],_0x38e1d2[_0xd892('0x88')]);}}}else{_0x38e1d2['countnoanswerretry']++;_0x3ba739[_0xd892('0x8c')]({'id':_0x38e1d2[_0xd892('0x8b')],'field':{'countnoanswerretry':_0x38e1d2[_0xd892('0xb4')]}})['then'](function(){_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)[_0xd892('0x5b')](function(){});});}});break;case _0xd892('0xb7'):_0xe2579b[_0xd892('0xb8')]+=0x1;_0x38e1d2[_0xd892('0xb9')]+=0x1;_0x38e1d2['countglobal']=ut[_0xd892('0x9b')](_0x38e1d2);ut[_0xd892('0x67')](_0x38e1d2,0x8,_0xd892('0xba'));_0x52f223=_0xe2579b[_0xd892('0xbb')];_0x5ea425=_0xe2579b[_0xd892('0xa6')];ami[_0xd892('0x29')]('custom:agentcongestion',ut[_0xd892('0x7a')](_0x38e1d2,_0xd892('0xbc')));rpcDb[_0xd892('0x6b')](_0x38e1d2,_0xd892('0xbd'));_0x3ba739[_0xd892('0x7d')](_0x38e1d2,'8',_0xe2579b)[_0xd892('0x5b')](function(_0x283927){_0x399766=_0x283927[_0xd892('0x7e')]==0x1;if(!_0x399766){if(ut[_0xd892('0x9b')](_0x38e1d2)>=_0xe2579b[_0xd892('0x80')]){_0x3d3fc8=ut[_0xd892('0x81')](_0x38e1d2,0xf,_0xd892('0xbe'));rpcDb[_0xd892('0x82')](_0x3d3fc8,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x38e1d2['countcongestionretry']>=_0xe2579b['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x38e1d2,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xd892('0xac')](ut[_0xd892('0x86')](_0x38e1d2,_0xd892('0xb9'),_0xe2579b[_0xd892('0xa5')]),_0x38e1d2[_0xd892('0x87')],_0x38e1d2[_0xd892('0x88')]);}}}else{_0x38e1d2[_0xd892('0xb9')]++;_0x3ba739[_0xd892('0x8c')]({'id':_0x38e1d2['idContact'],'field':{'countcongestionretry':_0x38e1d2[_0xd892('0xb9')]}})[_0xd892('0x5b')](function(){_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)[_0xd892('0x5b')](function(){});});}});break;case _0xd892('0xbf'):_0xe2579b[_0xd892('0xc0')]+=0x1;_0x38e1d2[_0xd892('0xc1')]+=0x1;_0x38e1d2['countglobal']=ut[_0xd892('0x9b')](_0x38e1d2);ut[_0xd892('0x67')](_0x38e1d2,0x14,_0xd892('0xc2'));_0x52f223=_0xe2579b[_0xd892('0xc3')];_0x5ea425=_0xe2579b[_0xd892('0xa6')];ami[_0xd892('0x29')](_0xd892('0xc4'),ut[_0xd892('0x7a')](_0x38e1d2,_0xd892('0xc5')));rpcDb['createCustomerHistory'](_0x38e1d2,_0xd892('0xc6'));_0x3ba739[_0xd892('0x7d')](_0x38e1d2,'20',_0xe2579b)['then'](function(_0x5dba25){_0x399766=_0x5dba25['additional']==0x1;if(!_0x399766){if(ut[_0xd892('0x9b')](_0x38e1d2)>=_0xe2579b['dialGlobalMaxRetry']){_0x3d3fc8=ut['cloneAction'](_0x38e1d2,0x14,_0xd892('0xc2'));rpcDb[_0xd892('0x82')](_0x3d3fc8,_0xd892('0xc7'));}else{if(_0x38e1d2[_0xd892('0xc1')]>=_0xe2579b[_0xd892('0xc8')]){rpcDb['createCustomerFinal'](_0x38e1d2,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x38e1d2,_0xd892('0xc1'),_0xe2579b['dialAgentRejectRetryFrequency']),_0x38e1d2['unlockAgent'],_0x38e1d2['activeContact']);}}}else{_0x38e1d2[_0xd892('0xb4')]++;_0x3ba739[_0xd892('0x8c')]({'id':_0x38e1d2[_0xd892('0x8b')],'field':{'countnoanswerretry':_0x38e1d2[_0xd892('0xb4')]}})[_0xd892('0x5b')](function(){_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)[_0xd892('0x5b')](function(){});});}});break;case _0xd892('0xc9'):_0xe2579b[_0xd892('0xca')]+=0x1;_0x38e1d2['countabandonedretry']+=0x1;_0x38e1d2[_0xd892('0x78')]=ut[_0xd892('0x9b')](_0x38e1d2);ut[_0xd892('0x67')](_0x38e1d2,0xb,_0xd892('0xcb'));rpcDb['createCustomerHistory'](_0x38e1d2,_0xd892('0xcc'));_0x3ba739[_0xd892('0x7d')](_0x38e1d2,'11',_0xe2579b)['then'](function(_0x4026d0){_0x399766=_0x4026d0[_0xd892('0x7e')]==0x1;if(!_0x399766){if(ut['totalGlobal'](_0x38e1d2)>=_0xe2579b[_0xd892('0x80')]){_0x3d3fc8=ut[_0xd892('0x81')](_0x38e1d2,0xf,'Global');rpcDb[_0xd892('0x82')](_0x3d3fc8,_0xd892('0xcc'));}else{if(_0x38e1d2[_0xd892('0xcd')]>=_0xe2579b[_0xd892('0xce')]){rpcDb['createCustomerFinal'](_0x38e1d2,_0xd892('0xcc'));}else{rpcDb[_0xd892('0xac')](ut['scheduledAt'](_0x38e1d2,_0xd892('0xcf'),_0xe2579b[_0xd892('0xd0')]),_0x38e1d2[_0xd892('0x87')],_0x38e1d2['activeContact']);}}}else{_0x38e1d2['countnoanswerretry']++;_0x3ba739[_0xd892('0x8c')]({'id':_0x38e1d2[_0xd892('0x8b')],'field':{'countnoanswerretry':_0x38e1d2[_0xd892('0xb4')]}})[_0xd892('0x5b')](function(){_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)[_0xd892('0x5b')](function(){});});}});break;case'18':_0xe2579b[_0xd892('0xd1')]+=0x1;_0x38e1d2[_0xd892('0xd2')]+=0x1;_0x38e1d2['countglobal']=ut[_0xd892('0x9b')](_0x38e1d2);ut[_0xd892('0x67')](_0x38e1d2,0x12,_0x139a79[_0xd892('0xd3')]||_0x139a79[_0xd892('0xd4')]);ami['emit'](_0xd892('0xd5'),ut[_0xd892('0x7a')](_0x38e1d2,'amd'));rpcDb['createCustomerHistory'](_0x38e1d2,'[callProgressDetectingCustomer][hangupInAMD]');_0x3ba739['verifyAdditionalPhones'](_0x38e1d2,'18',_0xe2579b)['then'](function(_0x287cf5){_0x399766=_0x287cf5[_0xd892('0x7e')]==0x1;if(!_0x399766){if(ut[_0xd892('0x9b')](_0x38e1d2)>=_0xe2579b['dialGlobalMaxRetry']){_0x3d3fc8=ut[_0xd892('0x81')](_0x38e1d2,0x12,_0xd892('0xbe'));rpcDb[_0xd892('0x82')](_0x3d3fc8,_0xd892('0xd6'));}else{rpcDb[_0xd892('0x82')](_0x38e1d2,_0xd892('0xd6'));}}else{_0x38e1d2['countnoanswerretry']++;_0x3ba739['incrementPreviewCounters']({'id':_0x38e1d2[_0xd892('0x8b')],'field':{'countnoanswerretry':_0x38e1d2[_0xd892('0xb4')]}})['then'](function(){_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)[_0xd892('0x5b')](function(){});});}});delete this[_0xd892('0x48')][_0x139a79[_0xd892('0x89')]];break;case'19':_0xe2579b['outboundUnknownCallsDay']+=0x1;_0x38e1d2[_0xd892('0x78')]=ut[_0xd892('0x9b')](_0x38e1d2);ut[_0xd892('0x67')](_0x38e1d2,0x13,_0x139a79[_0xd892('0xd3')]||_0x139a79[_0xd892('0xd4')]);ami[_0xd892('0x29')]('custom:amd',ut[_0xd892('0x7a')](_0x38e1d2,_0xd892('0xd7')));rpcDb[_0xd892('0x6b')](_0x38e1d2,_0xd892('0xd8'));_0x3ba739[_0xd892('0x7d')](_0x38e1d2,'18',_0xe2579b)[_0xd892('0x5b')](function(_0xc97f97){_0x399766=_0xc97f97['additional']==0x1;if(!_0x399766){if(ut['totalGlobal'](_0x38e1d2)>=_0xe2579b['dialGlobalMaxRetry']){_0x3d3fc8=ut[_0xd892('0x81')](_0x38e1d2,0xf,_0xd892('0xbe'));rpcDb[_0xd892('0x82')](_0x3d3fc8,_0xd892('0xd8'));}else{rpcDb['createCustomerFinal'](_0x38e1d2,'[callProgressDetectingCustomer][machine]');}}else{_0x38e1d2[_0xd892('0xb4')]++;_0x3ba739['incrementPreviewCounters']({'id':_0x38e1d2[_0xd892('0x8b')],'field':{'countnoanswerretry':_0x38e1d2[_0xd892('0xb4')]}})[_0xd892('0x5b')](function(){_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)['then'](function(){});});}});delete this['actions'][_0x139a79[_0xd892('0x89')]];break;default:if(_0x38e1d2[_0xd892('0x4c')]){ut['decrementTalkink'](_0xe2579b,'[default]');ut[_0xd892('0x57')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0xe2579b[_0xd892('0x3b')],_0x139a79);}_0xe2579b[_0xd892('0xd1')]+=0x1;_0x38e1d2[_0xd892('0x78')]=ut['totalGlobal'](_0x38e1d2);ut['logCustomer'](_0x38e1d2,0xc,_0x139a79[_0xd892('0xd3')]||_0x139a79[_0xd892('0xd4')]);_0x52f223=_0xe2579b[_0xd892('0xc3')];_0x5ea425=_0xe2579b[_0xd892('0xa6')];rpcDb['createCustomerHistory'](_0x38e1d2,'[callProgressDetectingCustomer][logUnknown]');_0x3ba739[_0xd892('0x7d')](_0x38e1d2,'20',_0xe2579b)['then'](function(_0x4c35e9){_0x399766=_0x4c35e9[_0xd892('0x7e')]==0x1;if(!_0x399766){if(ut[_0xd892('0x9b')](_0x38e1d2)>=_0xe2579b['dialGlobalMaxRetry']){_0x3d3fc8=ut[_0xd892('0x81')](_0x38e1d2,0xf,'Global');rpcDb[_0xd892('0x82')](_0x3d3fc8,_0xd892('0xd9'));}else{rpcDb[_0xd892('0x82')](_0x38e1d2,_0xd892('0xd9'));}delete this['actions'][_0x139a79[_0xd892('0x89')]];}else{_0x3ba739[_0xd892('0x8d')](_0x38e1d2,_0x52f223,_0x5ea425)[_0xd892('0x5b')](function(){});}});}if(!(_0x38e1d2[_0xd892('0x4c')]&&_0x2063bb==='16')){ut[_0xd892('0x54')](_0xe2579b,'[callProgressDetectingCustomer]');logger['info'](_0xd892('0xda'),_0x38e1d2[_0xd892('0x8f')],_0xd892('0x90'),_0xe2579b[_0xd892('0x3b')],_0xd892('0xdb'),_0xe2579b['originated']);}if(_0x2063bb!==_0xd892('0x8e')){delete this['actions'][_0x139a79['linkedid']];delete this[_0xd892('0x48')][_0x139a79[_0xd892('0xdc')]];}_0xe2579b[_0xd892('0xdd')]=!![];}};Preview['prototype']['callProgressDetectingAgent']=function(_0x117932,_0x2b057d,_0x30a0b5){if(_[_0xd892('0xde')](_0x2b057d)&&_0xd892('0xdf')!==typeof _0x2b057d){return;}if(_[_0xd892('0xde')](_0x30a0b5)&&_0xd892('0xdf')!==typeof _0x30a0b5){return;}switch(_0x30a0b5[_0xd892('0xe0')]){case'0':ut[_0xd892('0xe1')](_0x117932,0x0,_0xd892('0x79'));rpcDb['createAgentHistory'](_0x117932,_0xd892('0xe2'));break;case'3':ut[_0xd892('0xe1')](_0x117932,0x3,'NoAnswer');rpcDb[_0xd892('0xe3')](_0x117932,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xd892('0xe1')](_0x117932,0x5,_0xd892('0xa4'));rpcDb[_0xd892('0xe3')](_0x117932,_0xd892('0xe4'));break;case'8':ut[_0xd892('0xe1')](_0x117932,0x8,_0xd892('0xba'));rpcDb[_0xd892('0xe3')](_0x117932,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xd892('0xe1')](_0x117932,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x117932,_0xd892('0xe5'));break;default:ut[_0xd892('0xe1')](_0x117932,0xc,_0x30a0b5[_0xd892('0xe0')]);rpcDb[_0xd892('0xe3')](_0x117932,'[callProgressDetectingAgent][logCongestion]');}ut[_0xd892('0x54')](_0x2b057d,_0xd892('0xe6'));logger[_0xd892('0x2a')](_0xd892('0xe7'),_0x117932['uniqueid'],_0xd892('0x90'),_0x2b057d[_0xd892('0x3b')],'originated:\x20',_0x2b057d['originated']);delete this[_0xd892('0x48')][_0x117932['uniqueid']];};Preview[_0xd892('0xf')][_0xd892('0x7d')]=function(_0x222b6a,_0x17265f,_0x5beb23){return cmHopperAdditionalPhone[_0xd892('0x7d')](_0x222b6a,_0x17265f,_0x5beb23)[_0xd892('0x62')](logger['info'](_0xd892('0xe8')));};Preview['prototype'][_0xd892('0x8d')]=function(_0x4bf932,_0x597821,_0x3bd840){return cmHopperAdditionalPhone[_0xd892('0x8d')](_0x4bf932,_0x597821,_0x3bd840)['catch'](logger[_0xd892('0x2a')](_0xd892('0xe9')));};Preview['prototype']['incrementPreviewCounters']=function(_0x4cba02){return Promise[_0xd892('0xea')]()[_0xd892('0x5b')](cmHopperAdditionalPhone[_0xd892('0x8c')](_0x4cba02))['catch'](logger[_0xd892('0x2a')](_0xd892('0xeb')));};Preview[_0xd892('0xf')][_0xd892('0xec')]=function(_0x2a5f0f,_0x2e24fd,_0x20bbb0,_0x6e1a49,_0x238f8e){var _0x279377=this;return new Promise(function(_0x28f4a9,_0x1f475a){if(_[_0xd892('0x47')](_0x2e24fd)||_['isNil'](_0x2e24fd[_0xd892('0xed')])||_[_0xd892('0x47')](_0x2e24fd[_0xd892('0xee')])||_[_0xd892('0x47')](_0x2e24fd[_0xd892('0xef')])){_0x1f475a(ut[_0xd892('0x36')](_0xd892('0xf0'),_0x6e1a49,_0x238f8e));return;}var _0x311a81=uuid['v4']();var _0x595718=_0x279377[_0xd892('0x28')][_0x2e24fd['Queue'][_0xd892('0x3b')]];var _0x17ae1e=_0x20bbb0?_0x279377[_0xd892('0x16')][_0x20bbb0]['id']:undefined;_0x279377[_0xd892('0x48')][_0x311a81]=new Action(_0x2e24fd,_0x595718,_0x311a81,_0x20bbb0,_0x17ae1e);var _0x3f102a=_0x279377[_0xd892('0x48')][_0x311a81];_0x3f102a[_0xd892('0x87')]=_0x6e1a49;_0x3f102a['activeContact']=_0x238f8e;_0x3f102a[_0xd892('0xf1')]=_0x20bbb0;if(_[_0xd892('0xf2')](_0x2a5f0f)){_0x279377[_0xd892('0xf3')](_0x3f102a,_0x595718,_0x2e24fd,_0x20bbb0)[_0xd892('0x5b')](function(_0x2265e2){logger[_0xd892('0x2a')](_0xd892('0xf4'),_0xd892('0xf5')+_0x3f102a[_0xd892('0x4a')]+_0xd892('0xf6')+_0x3f102a[_0xd892('0x8b')],JSON[_0xd892('0x2c')](_0x2265e2));ami[_0xd892('0x29')](_0xd892('0xf7'),ut['buildObj'](_0x3f102a,_0xd892('0xf8'),_0x279377[_0xd892('0x28')][_0x3f102a[_0xd892('0x4a')]]));_0x28f4a9(ut[_0xd892('0x36')](_0xd892('0xf9')));})[_0xd892('0x62')](function(_0x41f549){ut[_0xd892('0x39')]('[Preview][execCall][failure]',_0x41f549);_0x1f475a(ut['message'](_0xd892('0xfa'),_0x6e1a49,_0x238f8e));});}else{_0x595718['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x3f102a);rpcDb[_0xd892('0xfb')](_0x3f102a,'[Blacklist][error]');delete _0x279377[_0xd892('0x48')][_0x311a81];_0x1f475a(ut[_0xd892('0x36')]('Contact\x20in\x20black\x20List',_0x6e1a49,_0x238f8e));}});};Preview[_0xd892('0xf')][_0xd892('0x72')]=function(_0x480d6e){return!_[_0xd892('0x47')](_0x480d6e)&&!_[_0xd892('0x47')](_0x480d6e[_0xd892('0x3b')])&&!_[_0xd892('0x47')](_0x480d6e[_0xd892('0xfc')])&&_0x480d6e[_0xd892('0xfc')]&&!_[_0xd892('0x47')](this[_0xd892('0x15')][util['format'](_0xd892('0xfd'),_0x480d6e[_0xd892('0x3b')])])&&!_[_0xd892('0x47')](this[_0xd892('0x15')][util['format'](_0xd892('0xfd'),_0x480d6e[_0xd892('0x3b')])][_0xd892('0x52')])&&(this[_0xd892('0x15')][util[_0xd892('0x2d')](_0xd892('0xfd'),_0x480d6e[_0xd892('0x3b')])][_0xd892('0x52')]===_0xd892('0xfe')||this[_0xd892('0x15')][util[_0xd892('0x2d')](_0xd892('0xfd'),_0x480d6e[_0xd892('0x3b')])]['status']===_0xd892('0xff'));};Preview[_0xd892('0xf')][_0xd892('0x60')]=function(_0x426041,_0x3b1395){return this[_0xd892('0x100')](_0x426041,_0x3b1395)[_0xd892('0x5b')](function(_0x4ae62d){return _['pick'](_0x4ae62d,[_0xd892('0x36')]);})[_0xd892('0x62')](function(_0x465876){if(_0x465876[_0xd892('0x101')]){rpcDb[_0xd892('0x102')](_0x426041);}if(_0x465876['active']){rpcDb[_0xd892('0x64')](_0x426041);}throw _[_0xd892('0x4d')](_0x465876,[_0xd892('0x36')]);});};Preview[_0xd892('0xf')][_0xd892('0x100')]=function(_0x318002,_0x504f14){var _0x4516e9=this;var _0x1b5bfb,_0x254176;return rpcDb['getContactPreview'](_0x318002)['then'](function(_0xdd797d){if(!_[_0xd892('0x47')](_0xdd797d[0x0])){_0x254176=_0xdd797d[0x0][_0xd892('0x103')]?![]:!![];_0x1b5bfb=_0xdd797d[0x0][_0xd892('0x103')]?!![]:![];_0x1b5bfb=_0x504f14?!![]:_0x1b5bfb;}var _0x306545=_0x4516e9['validateContact'](_0xdd797d);if(_0x306545[_0xd892('0x104')]){rpcDb['checkIsBlackList'](_[_0xd892('0x4d')](_0xdd797d[0x0],[_0xd892('0xef'),_0xd892('0xee')]))['then'](function(_0x3c5bcf){_0x4516e9['checkInBlack'](_0x3c5bcf,_0xdd797d[0x0],_0x504f14,_0x254176,_0x1b5bfb)[_0xd892('0x5b')](function(_0x4cdbda){return _0x4cdbda;})[_0xd892('0x62')](function(_0x580254){throw _0x580254;});})[_0xd892('0x62')](function(_0x108dd0){ut[_0xd892('0x39')]('[Preview][checkIsBlackList]',_0x108dd0);throw ut['message']('Call\x20unsuccessful',_0x254176,_0x1b5bfb);});}else{throw ut['message'](_0x306545[_0xd892('0x36')],_0x254176,_0x1b5bfb);}})[_0xd892('0x62')](function(_0x2a1495){ut[_0xd892('0x39')](_0xd892('0x105'),_0x2a1495);throw ut['message'](_0xd892('0x106'),![],!![]);});};Preview[_0xd892('0xf')]['validateContact']=function(_0x5c0179){if(_[_0xd892('0x47')](_0x5c0179)||_['isEmpty'](_0x5c0179)||!_[_0xd892('0x47')](_0x5c0179[0x0][_0xd892('0x5e')])&&_[_0xd892('0x47')](_0x5c0179[0x0][_0xd892('0x5e')]['name'])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x5c0179);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x93dfc0=this['campaignsPreview'][_0x5c0179[0x0][_0xd892('0x107')]['name']];_0x93dfc0[_0xd892('0x36')]=utils[_0xd892('0x37')][_0xd892('0x75')];if(_[_0xd892('0x47')](_0x93dfc0)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x93dfc0);return{'isValid':![],'message':_0xd892('0x108')};}if(!this[_0xd892('0x72')](_0x93dfc0['Trunk'])){ut[_0xd892('0x39')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xd892('0x109')+_0x93dfc0[_0xd892('0x3b')]+_0xd892('0x10a'));if(!this[_0xd892('0x72')](_0x93dfc0['TrunkBackup'])){ut[_0xd892('0x39')](_0xd892('0x10b'),_0x93dfc0['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xd892('0x10c')};}}if(!ut[_0xd892('0x71')](_0x93dfc0['dialActive'])){ut[_0xd892('0x39')](_0xd892('0x10d'),_0x93dfc0[_0xd892('0x3b')]+_0xd892('0x10e'));return{'isValid':![],'message':_0xd892('0x109')+_0x93dfc0[_0xd892('0x3b')]+_0xd892('0x10e')};}return{'isValid':!![],'message':_0xd892('0x10f')};};Preview[_0xd892('0xf')][_0xd892('0xf3')]=function(_0x46ee78,_0x29fe96,_0x1d5e32,_0x485955){var _0xfee1f5=this;return new Promise(function(_0x3d8c89,_0x24c3c8){var _0x29a682=_0x46ee78['uniqueid'];var _0x14c1c6=_0xfee1f5[_0xd892('0x72')](_0x29fe96[_0xd892('0x73')])?util['format']('SIP/%s/%s%s',_0x29fe96['Trunk']['name'],_[_0xd892('0x47')](_0x29fe96[_0xd892('0x110')])?'':_0x29fe96[_0xd892('0x110')]['trim']()||'',_0x29fe96[_0xd892('0x111')]>0x0?_0x1d5e32['phone'][_0xd892('0x112')](_0x29fe96['dialCutDigit']):_0x1d5e32[_0xd892('0xee')]):util[_0xd892('0x2d')]('SIP/%s/%s%s',_[_0xd892('0x47')](_0x29fe96[_0xd892('0x113')])?_0x29fe96[_0xd892('0x73')][_0xd892('0x3b')]:_0x29fe96[_0xd892('0x113')][_0xd892('0x3b')],_[_0xd892('0x47')](_0x29fe96[_0xd892('0x110')])?'':_0x29fe96[_0xd892('0x110')][_0xd892('0x114')]()||'',_0x29fe96[_0xd892('0x111')]>0x0?_0x1d5e32['phone'][_0xd892('0x112')](_0x29fe96[_0xd892('0x111')]):_0x1d5e32['phone']);var _0xea2ec2=_0xfee1f5[_0xd892('0x72')](_0x29fe96[_0xd892('0x73')])?ut[_0xd892('0x115')](_0x29fe96[_0xd892('0x73')][_0xd892('0x116')],_0x29fe96[_0xd892('0x117')],_0x29fe96[_0xd892('0x118')]>0x0?ut[_0xd892('0x119')](_0x29fe96[_0xd892('0x11a')],_0x29fe96[_0xd892('0x118')]):_0x29fe96[_0xd892('0x11a')]):ut[_0xd892('0x115')](_['isNil'](_0x29fe96[_0xd892('0x113')])?_0x29fe96[_0xd892('0x73')][_0xd892('0x116')]:_0x29fe96[_0xd892('0x113')][_0xd892('0x116')],_0x29fe96['dialOriginateCallerIdName'],_0x29fe96[_0xd892('0x118')]>0x0?ut[_0xd892('0x119')](_0x29fe96[_0xd892('0x11a')],_0x29fe96[_0xd892('0x118')]):_0x29fe96[_0xd892('0x11a')]);if(_0xea2ec2){_0x46ee78[_0xd892('0x11b')]=ut['extractCalleridName'](_0xea2ec2);_0x46ee78['originatecalleridnum']=ut['extractCalleridNumber'](_0xea2ec2);}var _0x4ae966=ut[_0xd892('0x11c')](_0x29fe96,_0x1d5e32,_0x14c1c6,_0xea2ec2,_0x29a682,_0x46ee78);var _0x5699d4=utils[_0xd892('0x11d')](_0x1d5e32[_0xd892('0xed')]);Object['assign'](_0x4ae966,_0x5699d4);_[_0xd892('0x11e')](_0x46ee78,ut[_0xd892('0x11f')](_0x4ae966));_0x46ee78['starttime']=moment()[_0xd892('0x2d')](_0xd892('0x120'));_0x29fe96[_0xd892('0x121')]=_0x4ae966;var _0x76729a=ut[_0xd892('0x122')](_0x46ee78,_0x29fe96,_0x4ae966,_0x46ee78[_0xd892('0x88')],_0x485955);return ami[_0xd892('0x51')](_0x76729a)[_0xd892('0x5b')](function(_0x352139){_0x29fe96[_0xd892('0x32')]+=0x1;logger[_0xd892('0x2a')](_0xd892('0x123'),_0x29a682,_0xd892('0x90'),_0x29fe96[_0xd892('0x3b')],_0xd892('0xdb'),_0x29fe96[_0xd892('0x32')]);_0x3d8c89(_0x352139);})[_0xd892('0x62')](function(_0x4a4d66){ut[_0xd892('0xe1')](_0x46ee78,0xe,_0xd892('0x124'));rpcDb['createAgentHistory'](_0x46ee78,'[originateFailure][logOriginateFailure]');_0x24c3c8(_0x4a4d66);});});};Preview['prototype'][_0xd892('0x22')]=function(_0x2b73cf){if(this['actions'][_0x2b73cf['linkedid']]){this[_0xd892('0x48')][_0x2b73cf[_0xd892('0x89')]][_0xd892('0x53')]=_0x2b73cf[_0xd892('0x53')];}};Preview['prototype'][_0xd892('0x19')]=function(_0x217d25){var _0x4706a6=this;var _0x57bb1c=this[_0xd892('0x48')][_0x217d25['actionid']];if(_0x57bb1c){if(_0x57bb1c[_0xd892('0xf1')]&&this[_0xd892('0x16')][_0x57bb1c[_0xd892('0xf1')]]){ut['logLookAgent'](_0x57bb1c,this[_0xd892('0x16')][_0x57bb1c[_0xd892('0xf1')]][_0xd892('0x3b')],this[_0xd892('0x16')][_0x57bb1c[_0xd892('0xf1')]]['id']);}var _0x1d2e6a=_[_0xd892('0x125')](_0x57bb1c);_0x1d2e6a['responsetime']=moment()[_0xd892('0x2d')](_0xd892('0x120'));var _0x5c372d=_0x4706a6[_0xd892('0x28')][_0x57bb1c['queue']];if(ut['isFailure'](_0x217d25['response'])){if(_0x57bb1c[_0xd892('0x87')]){rpcDb[_0xd892('0x102')](_0x57bb1c[_0xd892('0x8b')]);}if(_0x57bb1c[_0xd892('0x88')]){rpcDb[_0xd892('0x64')](_0x57bb1c[_0xd892('0x8b')]);}ami[_0xd892('0x29')]('custom:agentringnoanswer',ut[_0xd892('0x7a')](_0x57bb1c,_0xd892('0x126'),this['campaignsPreview'][_0x57bb1c[_0xd892('0x4a')]]));this[_0xd892('0x127')](_0x1d2e6a,_0x5c372d,_0x217d25);}else{_0x57bb1c['starttime']=moment()['format'](_0xd892('0x120'));ut['logAgent'](_0x1d2e6a,0x4,_0xd892('0x9c'));rpcDb[_0xd892('0xe3')](_0x1d2e6a,_0xd892('0x128'));}}};Preview[_0xd892('0xf')]['syncHangup']=function(_0x5a0f9d){var _0x3ef549=this[_0xd892('0x48')][_0x5a0f9d[_0xd892('0x89')]];var _0x1bcae4;if(_0x3ef549){_0x1bcae4=this[_0xd892('0x28')][_0x3ef549[_0xd892('0x4a')]];logger['info'](_0xd892('0x129'),_0x5a0f9d[_0xd892('0x89')],'\x20Queue',_0x1bcae4[_0xd892('0x3b')],_0xd892('0x4b'),_0x1bcae4['pTalking']);}if(this[_0xd892('0x48')][_0x5a0f9d[_0xd892('0x89')]]&&_0x5a0f9d[_0xd892('0x89')]!==_0x5a0f9d[_0xd892('0x8f')]){if(_0x5a0f9d[_0xd892('0x12a')]==='16'&&this[_0xd892('0x48')][_0x5a0f9d['linkedid']]['dialAnswer']){this['callProgressDetectingCustomer'](_0x5a0f9d,_0x5a0f9d[_0xd892('0x89')],_0x5a0f9d[_0xd892('0x12a')]);}else if(this['actions'][_0x5a0f9d[_0xd892('0x89')]][_0xd892('0x4c')]){logger['info'](_0xd892('0x12b'),_0x5a0f9d[_0xd892('0x89')],_0x5a0f9d[_0xd892('0x12a')],_0xd892('0x90'),_0x1bcae4[_0xd892('0x3b')],_0xd892('0x4b'),_0x1bcae4[_0xd892('0x33')]);this[_0xd892('0x76')](_0x5a0f9d,_0x5a0f9d['linkedid'],_0x5a0f9d[_0xd892('0x12a')]);}}else if(_0x3ef549&&_['isNil'](_0x3ef549[_0xd892('0x12c')])&&_0x1bcae4[_0xd892('0x12d')]&&_0x5a0f9d[_0xd892('0x89')]===_0x5a0f9d[_0xd892('0x8f')]&&_['isNil'](_0x5a0f9d[_0xd892('0xe0')])&&_0x5a0f9d['cause']==='16'&&_0x5a0f9d['channelstate']==='6'&&_[_0xd892('0xde')](_0x3ef549['transfer'])){if(_0x3ef549['unlockAgent']){rpcDb[_0xd892('0x102')](_0x3ef549['idContact']);}if(_0x3ef549[_0xd892('0x88')]){rpcDb[_0xd892('0x64')](_0x3ef549[_0xd892('0x8b')]);}_0x5a0f9d[_0xd892('0xe0')]='22';this[_0xd892('0x127')](_0x3ef549,_0x1bcae4,_0x5a0f9d);}else if(_0x3ef549&&_0x3ef549['transfer']){if(_0x5a0f9d[_0xd892('0x12a')]==='16'&&this[_0xd892('0x48')][_0x5a0f9d[_0xd892('0x89')]][_0xd892('0x4c')]){logger[_0xd892('0x2a')](_0xd892('0x12e'),_0x5a0f9d[_0xd892('0x89')],_0x5a0f9d[_0xd892('0x12a')],_0xd892('0x90'),_0x1bcae4['name'],'pTalking:\x20',_0x1bcae4[_0xd892('0x33')]);this['callProgressDetectingCustomer'](_0x5a0f9d,_0x5a0f9d[_0xd892('0x89')],_0x5a0f9d[_0xd892('0x12a')]);}else if(this[_0xd892('0x48')][_0x5a0f9d[_0xd892('0x89')]][_0xd892('0x4c')]){logger[_0xd892('0x2a')](_0xd892('0x12b'),_0x5a0f9d[_0xd892('0x89')],_0x5a0f9d[_0xd892('0x12a')],_0xd892('0x90'),_0x1bcae4[_0xd892('0x3b')],_0xd892('0x4b'),_0x1bcae4[_0xd892('0x33')]);this['callProgressDetectingCustomer'](_0x5a0f9d,_0x5a0f9d['linkedid'],_0x5a0f9d[_0xd892('0x12a')]);}}};Preview[_0xd892('0xf')][_0xd892('0x20')]=function(_0x29a851){if(this[_0xd892('0x48')][_0x29a851[_0xd892('0xdc')]]&&_0x29a851[_0xd892('0xdc')]!==_0x29a851['destuniqueid']){this[_0xd892('0x76')](_0x29a851,_0x29a851['destlinkedid'],_0x29a851[_0xd892('0xd4')]);}};Preview[_0xd892('0xf')][_0xd892('0x1e')]=function(_0x332429){if(this[_0xd892('0x48')][_0x332429[_0xd892('0x89')]]&&_0x332429[_0xd892('0x89')]!==_0x332429['uniqueid']&&!this[_0xd892('0x48')][_0x332429[_0xd892('0x89')]][_0xd892('0x4c')]){if(_0x332429[_0xd892('0x12a')]==='1'){this[_0xd892('0x76')](_0x332429,_0x332429[_0xd892('0x89')],_0x332429[_0xd892('0x12a')]);}}};Preview[_0xd892('0xf')][_0xd892('0x12f')]=function(_0x274b39,_0x5ea098,_0xd285c3){if(this[_0xd892('0x48')][_0x274b39]){if(_[_0xd892('0x47')](this[_0xd892('0x48')][_0x274b39][_0xd892('0x121')])){this[_0xd892('0x48')][_0x274b39]['variables']={};}this[_0xd892('0x48')][_0x274b39][_0xd892('0x121')][_0x5ea098]=_0xd285c3;}};Preview[_0xd892('0xf')]['syncVarSet']=function(_0x14bf5c){try{if(!_[_0xd892('0x47')](_0x14bf5c)){if(ut[_0xd892('0x130')](_['keys'](_0x14bf5c[_0xd892('0x131')])[0x0])){this['addVariable'](_0x14bf5c['uniqueid'],_['keys'](_0x14bf5c[_0xd892('0x131')])[0x0],_0x14bf5c[_0xd892('0x132')]);}}}catch(_0xc0d511){logger[_0xd892('0x133')](_0xd892('0x134'),util['inspect'](_0xc0d511,{'showHidden':![],'depth':null}));}};Preview[_0xd892('0xf')]['syncAttendedTransfer']=function(_0x1e3e17){if(_0x1e3e17){if(this[_0xd892('0x48')][_0x1e3e17[_0xd892('0x135')]]){this[_0xd892('0x48')][_0x1e3e17['transfertargetlinkedid']][_0xd892('0x136')]=!![];}}};Preview[_0xd892('0xf')]['syncBlindTransfer']=function(_0x565d07){if(_0x565d07){if(this['actions'][_0x565d07['transfererlinkedid']]){this[_0xd892('0x48')][_0x565d07[_0xd892('0x137')]][_0xd892('0x136')]=!![];}}};module[_0xd892('0x138')]=Preview; \ No newline at end of file +var _0xe84a=['message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','actions','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','agents','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','catch','disableContact','starttime','outboundReCallsDay','RecallInQueue','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','logCustomer','emit','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','acw','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','createCustomerFinal','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','additional','dialBusyMaxRetry','activeContact','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','amd','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','unlock','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','phone','trim','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','extractCalleridNumber','setXMDContactVariables','Contact','assign','merge','toLowerVariables','variables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','YYYY-MM-DD\x20HH:mm:ss','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','bind','newexten','syncNewExten','varset','syncVarSet','blindtransfer','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','sendMessageOneNotActive','originated','pTalking','available','paused'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0xe84a,0x113));var _0xae84=function(_0xc890e2,_0x18a3e1){_0xc890e2=_0xc890e2-0x0;var _0x581dff=_0xe84a[_0xc890e2];return _0x581dff;};'use strict';var util=require(_0xae84('0x0'));var _=require(_0xae84('0x1'));var uuid=require(_0xae84('0x2'));var moment=require(_0xae84('0x3'));var Redis=require(_0xae84('0x4'));var config=require(_0xae84('0x5'));var logger=require(_0xae84('0x6'))(_0xae84('0x7'));var loggerAction=require(_0xae84('0x6'))(_0xae84('0x8'));var ami=require('../ami');var rpcDb=require(_0xae84('0x9'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xae84('0xa'));var ut=require(_0xae84('0xb'));var utils=require('../dialer/utils');config[_0xae84('0xc')]=_[_0xae84('0xd')](config[_0xae84('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xae84('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xae84('0xf')]['enqueue']=function(_0x2090e8){this['tail']=this[_0xae84('0x10')]?this[_0xae84('0x10')][_0xae84('0x11')](_0x2090e8):_0x2090e8();};function Preview(_0x2134a8){this[_0xae84('0x12')]=new Sequence();this[_0xae84('0x13')]=_0x2134a8[_0xae84('0x14')];this[_0xae84('0x15')]=_0x2134a8[_0xae84('0x15')];this['actions']={};this['agents']=_0x2134a8['agents'];this[_0xae84('0x16')]=0x0;ami['on'](_0xae84('0x17'),this[_0xae84('0x18')]['bind'](this));ami['on'](_0xae84('0x19'),this[_0xae84('0x1a')]['bind'](this));ami['on'](_0xae84('0x1b'),this[_0xae84('0x1c')]['bind'](this));ami['on'](_0xae84('0x1d'),this[_0xae84('0x1e')][_0xae84('0x1f')](this));ami['on'](_0xae84('0x20'),this[_0xae84('0x21')]['bind'](this));ami['on'](_0xae84('0x22'),this[_0xae84('0x23')][_0xae84('0x1f')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xae84('0x1f')](this));ami['on'](_0xae84('0x24'),this['syncBlindTransfer']['bind'](this));this['loopCampaigns'](this[_0xae84('0x13')]);}function emit(_0x28a395,_0x2214f2,_0x254b72){io['to'](_0x28a395)['emit'](_0x2214f2,_0x254b72);}function emitVoiceQueueChannelRemove(_0x46c8f3){logger['info'](_0xae84('0x25'),JSON[_0xae84('0x26')](_0x46c8f3));emit(util[_0xae84('0x27')](_0xae84('0x28'),_0x46c8f3[_0xae84('0x29')]),_0xae84('0x2a'),_0x46c8f3);io['emit']('voice_queue_presence:remove',_0x46c8f3);}function notSendMessagesQueue(_0x557080){if(_0x557080[_0xae84('0x2b')]){if(_0x557080[_0xae84('0x2c')]===0x0&&_0x557080[_0xae84('0x2d')]===0x0){_0x557080['sendMessageOneNotActive']=![];_0x557080[_0xae84('0x2e')]=0x0;_0x557080[_0xae84('0x2f')]=0x0;_0x557080[_0xae84('0x30')]=utils[_0xae84('0x31')][_0xae84('0x32')];ut[_0xae84('0x33')](_0xae84('0x34'),_0x557080[_0xae84('0x29')]+_0xae84('0x35'));}else{_0x557080[_0xae84('0x30')]=utils[_0xae84('0x31')]['DEACTIVATED'];ut['logger'](_0xae84('0x34'),_0x557080['name']+'\x20is\x20deactivated');}}}Preview[_0xae84('0xf')][_0xae84('0x36')]=function(){var _0x3252e6=this;setInterval(function(){_0x3252e6[_0xae84('0x37')]();},0x7cf);};Preview['prototype'][_0xae84('0x37')]=function(){var _0x390526=this[_0xae84('0x13')];this[_0xae84('0x16')]+=0x1;for(var _0x4b8cc1 in _0x390526){if(_0x390526[_0xae84('0x38')](_0x4b8cc1)&&(_0x390526[_0x4b8cc1][_0xae84('0x39')]===_0xae84('0x7')||_0x390526[_0x4b8cc1][_0xae84('0x39')]===_0xae84('0x3a'))&&_0x390526[_0x4b8cc1][_0xae84('0x3b')]===_0xae84('0x3c')){if(this['clockClearZombieChannels']>0x7){this[_0xae84('0x16')]=0x0;this[_0xae84('0x3d')]();}}if(_0x390526[_0xae84('0x38')](_0x4b8cc1)&&_0x390526[_0x4b8cc1]['dialMethod']==='preview'&&_0x390526[_0x4b8cc1][_0xae84('0x3b')]===_0xae84('0x3c')){if(_0x390526[_0x4b8cc1][_0xae84('0x3e')]){this[_0xae84('0x3f')](_0x390526[_0x4b8cc1]);if(_0x390526[_0x4b8cc1][_0xae84('0x40')])this['recallMe'](_0x390526[_0x4b8cc1]);}else{notSendMessagesQueue(_0x390526[_0x4b8cc1]);}}}};Preview['prototype'][_0xae84('0x41')]=function(_0x3da16d){var _0x33f7d0=this;this[_0xae84('0x12')]['enqueue'](function(){if(!_[_0xae84('0x42')](_0x33f7d0[_0xae84('0x43')][_0x3da16d])){loggerAction[_0xae84('0x44')](_0xae84('0x45'),_0x3da16d,_0xae84('0x46'),_0x33f7d0[_0xae84('0x43')][_0x3da16d][_0xae84('0x47')],_0xae84('0x48'),JSON[_0xae84('0x26')](_0x33f7d0[_0xae84('0x13')][_0x33f7d0[_0xae84('0x43')][_0x3da16d][_0xae84('0x47')]][_0xae84('0x2c')]),_0xae84('0x49'),JSON['stringify'](_0x33f7d0['campaignsPreview'][_0x33f7d0['actions'][_0x3da16d][_0xae84('0x47')]][_0xae84('0x2d')]),JSON['stringify'](_0x33f7d0[_0xae84('0x43')][_0x3da16d][_0xae84('0x4a')]),JSON[_0xae84('0x26')](_[_0xae84('0x4b')](_0x33f7d0['actions'][_0x3da16d],[_0xae84('0x4c'),_0xae84('0x4d'),_0xae84('0x4e'),'ListId'])));return ami[_0xae84('0x4f')]({'action':_0xae84('0x50'),'channel':_0x33f7d0[_0xae84('0x43')][_0x3da16d][_0xae84('0x51')]})['catch'](function(_0x485a1a){if(_0x485a1a[_0xae84('0x30')]===_0xae84('0x52')){setTimeout(function(){if(_0x33f7d0[_0xae84('0x43')][_0x3da16d]){ut[_0xae84('0x53')](_0x33f7d0[_0xae84('0x13')][_0x33f7d0[_0xae84('0x43')][_0x3da16d]['queue']],_0xae84('0x54'));if(_0x33f7d0[_0xae84('0x43')][_0x3da16d]['dialAnswer']===!![]){ut[_0xae84('0x55')](_0x33f7d0['campaignsPreview'][_0x33f7d0[_0xae84('0x43')][_0x3da16d][_0xae84('0x47')]],_0xae84('0x54'));ut[_0xae84('0x56')](_0xae84('0x57')+_0x3da16d,_0x33f7d0['actions'][_0x3da16d]['queue']);}ut['loggerError'](_0xae84('0x58')+_0x3da16d,_0x33f7d0[_0xae84('0x43')][_0x3da16d][_0xae84('0x47')]);delete _0x33f7d0['actions'][_0x3da16d];}},0x2328);}});}});};Preview[_0xae84('0xf')]['clearZombieChannels']=function(){var _0x54e305=this;loggerAction[_0xae84('0x44')](_0xae84('0x59'),_['size'](this[_0xae84('0x43')]));for(var _0x29aa51 in this['actions']){if(_0x54e305[_0xae84('0x43')][_0xae84('0x38')](_0x29aa51)){_0x54e305[_0xae84('0x41')](_0x29aa51);}}};Preview[_0xae84('0xf')]['recallMe']=function(_0x4182c8){var _0x3eef77=this;rpcDb[_0xae84('0x5a')](_0x4182c8['id'],ut[_0xae84('0x5b')](this[_0xae84('0x5c')]))['then'](function(_0x28a2da){if(!_['isNil'](_0x28a2da)){for(var _0x44835f=0x0;_0x44835f<_0x28a2da[_0xae84('0x5d')];_0x44835f+=0x1){if(ut[_0xae84('0x5e')](_0x28a2da[_0x44835f][_0xae84('0x5f')])<_0x4182c8[_0xae84('0x60')]*0x3c){if(_0x28a2da[_0x44835f][_0xae84('0x61')]&&!_0x28a2da[_0x44835f][_0xae84('0x61')][_0xae84('0x62')]){_0x3eef77[_0xae84('0x63')](_0x28a2da[_0x44835f]['id'])[_0xae84('0x64')](ut[_0xae84('0x65')]('[RecallMe]'))[_0xae84('0x66')](ut[_0xae84('0x65')]('[RecallMe]'));}else{rpcDb[_0xae84('0x67')](_0x28a2da[_0x44835f]['id']);}}else{var _0x12542f=new Action(_0x28a2da[_0x44835f],_0x4182c8);_0x12542f[_0xae84('0x68')]=moment()[_0xae84('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x4182c8[_0xae84('0x69')]+=0x1;ut['logCustomer'](_0x12542f,0x17,_0xae84('0x6a'));if(_0x4182c8[_0xae84('0x6b')]){rpcDb['rescheduleContactInQueue'](ut[_0xae84('0x6c')](_0x28a2da[_0x44835f]));rpcDb['createCustomerHistory'](_0x12542f,_0xae84('0x6d'));}else{ut['logCustomer'](_0x12542f,0x16,'RecallFailedTimeout');rpcDb[_0xae84('0x6e')](_0x12542f,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x12542f,'[HistoryRecallClose]');}}}}})[_0xae84('0x66')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xae84('0xf')][_0xae84('0x3f')]=function(_0x3c85c2){_0x3c85c2[_0xae84('0x2b')]=!![];if(ut[_0xae84('0x6f')](_0x3c85c2['loggedIn'])){_0x3c85c2['message']=utils[_0xae84('0x31')][_0xae84('0x70')];}else if(!ut[_0xae84('0x71')](_0x3c85c2[_0xae84('0x3e')])){_0x3c85c2[_0xae84('0x30')]=utils[_0xae84('0x31')][_0xae84('0x32')];}else if(!this['isTrunkReachable'](_0x3c85c2[_0xae84('0x72')])){if(!this[_0xae84('0x73')](_0x3c85c2[_0xae84('0x74')])){_0x3c85c2[_0xae84('0x30')]=utils[_0xae84('0x31')][_0xae84('0x75')];}else{_0x3c85c2[_0xae84('0x30')]=utils[_0xae84('0x31')][_0xae84('0x76')];}}else{_0x3c85c2['message']=utils[_0xae84('0x31')]['ACTIVE'];}};Preview[_0xae84('0xf')]['callProgressDetectingCustomer']=function(_0x5712d8,_0x2c18d3,_0x552322){var _0x4e57ec=this;var _0x5067e9=this[_0xae84('0x43')][_0x2c18d3];var _0x15e088=this[_0xae84('0x13')][_0x5067e9[_0xae84('0x47')]];var _0x9161df;var _0x31e379=![];var _0x160c4f=0x2;var _0x30f409=0x3;if(_0x15e088){switch(_0x552322){case'1':_0x15e088['outboundNoSuchCallsDay']+=0x1;_0x5067e9[_0xae84('0x77')]+=0x1;_0x5067e9[_0xae84('0x78')]=ut[_0xae84('0x79')](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0x0,'NoSuchNumber');ami[_0xae84('0x7b')]('custom:agentnosuchnumber',ut[_0xae84('0x7c')](_0x5067e9,_0xae84('0x7d')));rpcDb[_0xae84('0x6e')](_0x5067e9,_0xae84('0x7e'));_0x4e57ec[_0xae84('0x7f')](_0x5067e9,'0',_0x15e088)[_0xae84('0x64')](function(_0x18893a){_0x31e379=_0x18893a['additional']==0x1;_0x160c4f=_0x15e088['dialNoSuchNumberRetryFrequency'];_0x30f409=_0x15e088[_0xae84('0x80')];if(!_0x31e379){if(ut[_0xae84('0x79')](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut[_0xae84('0x82')](_0x5067e9,0xf,_0xae84('0x83'));rpcDb['createCustomerFinal'](_0x9161df,_0xae84('0x84'));}else{if(_0x5067e9[_0xae84('0x77')]>=_0x15e088[_0xae84('0x85')]){rpcDb['createCustomerFinal'](_0x5067e9,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xae84('0x86')](ut[_0xae84('0x87')](_0x5067e9,'countnosuchnumberretry',_0x15e088['dialNoSuchNumberRetryFrequency']),_0x5067e9[_0xae84('0x88')],_0x5067e9['activeContact']);}}delete this[_0xae84('0x43')][_0x5712d8[_0xae84('0x89')]];}else{_0x5067e9[_0xae84('0x77')]++;logger['info']('actioncountonusuch',_0x5067e9[_0xae84('0x77')]);logger['info']('id',_0x5067e9[_0xae84('0x8a')]);_0x4e57ec[_0xae84('0x8b')]({'id':_0x5067e9[_0xae84('0x8a')],'field':{'countnosuchnumberretry':_0x5067e9[_0xae84('0x77')]}})['then'](function(){_0x4e57ec[_0xae84('0x8c')](_0x5067e9,_0x160c4f,_0x30f409)[_0xae84('0x64')](function(){});});}});break;case _0xae84('0x8d'):var _0x386ea2=moment()[_0xae84('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x5067e9[_0xae84('0x8e')]=_0x386ea2;_0x5067e9[_0xae84('0x8f')]=_0x386ea2;_0x5067e9['dialAnswer']=!![];_0x15e088[_0xae84('0x2d')]+=0x1;logger['info'](_0xae84('0x90'),_0x5067e9['uniqueid'],_0xae84('0x91'),_0x15e088[_0xae84('0x29')],_0xae84('0x49'),_0x15e088['pTalking']);ami[_0xae84('0x7b')](_0xae84('0x92'),ut[_0xae84('0x7c')](_0x5067e9,'connect',this['campaignsPreview'][_0x5067e9[_0xae84('0x47')]]));if(_0x15e088[_0xae84('0x93')]){ami[_0xae84('0x7b')]('custom:agentConnectPreview',ut[_0xae84('0x94')](_0x5067e9));}break;case'16':ami[_0xae84('0x7b')](_0xae84('0x95'),ut[_0xae84('0x7c')](_0x5067e9,_0xae84('0x96'),this[_0xae84('0x13')][_0x5067e9['queue']]));emitVoiceQueueChannelRemove(ut[_0xae84('0x7c')](_0x5067e9,_0xae84('0x96')));_0x15e088[_0xae84('0x97')]+=0x1;_0x15e088[_0xae84('0x98')]+=0x1;_0x15e088['answered']+=0x1;ut[_0xae84('0x55')](_0x15e088,_0xae84('0x99'));_0x5067e9['countglobal']=ut[_0xae84('0x79')](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0x4,_0xae84('0x9a'));rpcDb['createCustomerHistory'](_0x5067e9,_0xae84('0x9b'));rpcDb[_0xae84('0x9c')](_0x5067e9,_0xae84('0x9d'));rpcDb[_0xae84('0x9e')](_0x5067e9);_0x15e088['sumDuration']+=_0x5067e9[_0xae84('0x9f')];_0x15e088['sumBillable']+=_0x5067e9[_0xae84('0x9f')];logger[_0xae84('0x44')](_0xae84('0xa0'),_0x5067e9[_0xae84('0xa1')],_0xae84('0x91'),_0x15e088[_0xae84('0x29')],_0xae84('0x49'),_0x15e088[_0xae84('0x2d')]);delete this[_0xae84('0x43')][_0x5712d8[_0xae84('0x89')]];break;case _0xae84('0xa2'):_0x15e088[_0xae84('0xa3')]+=0x1;_0x5067e9[_0xae84('0xa4')]+=0x1;_0x5067e9[_0xae84('0x78')]=ut['totalGlobal'](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0x5,_0xae84('0xa5'));_0x160c4f=_0x15e088[_0xae84('0xa6')];_0x30f409=_0x15e088[_0xae84('0x80')];ami['emit'](_0xae84('0xa7'),ut[_0xae84('0x7c')](_0x5067e9,_0xae84('0xa8')));rpcDb[_0xae84('0x6e')](_0x5067e9,_0xae84('0xa9'));_0x4e57ec[_0xae84('0x7f')](_0x5067e9,'5',_0x15e088)['then'](function(_0x4e7a03){_0x31e379=_0x4e7a03[_0xae84('0xaa')]==0x1;if(!_0x31e379){if(ut['totalGlobal'](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut['cloneAction'](_0x5067e9,0xf,_0xae84('0x83'));rpcDb['createCustomerFinal'](_0x9161df,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5067e9[_0xae84('0xa4')]>=_0x15e088[_0xae84('0xab')]){rpcDb[_0xae84('0x9c')](_0x5067e9,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xae84('0x86')](ut[_0xae84('0x87')](_0x5067e9,_0xae84('0xa4'),_0x15e088[_0xae84('0xa6')]),_0x5067e9[_0xae84('0x88')],_0x5067e9[_0xae84('0xac')]);}}}else{_0x5067e9[_0xae84('0xa4')]++;_0x4e57ec[_0xae84('0x8b')]({'id':_0x5067e9['idContact'],'field':{'countbusyretry':_0x5067e9[_0xae84('0xa4')]}})[_0xae84('0x64')](function(){_0x4e57ec['swapAdditionalPhones'](_0x5067e9,_0x160c4f,_0x30f409)[_0xae84('0x64')](function(){});});}});break;case _0xae84('0xad'):_0x15e088['outboundNoAnswerCallsDay']+=0x1;_0x5067e9[_0xae84('0xae')]+=0x1;_0x5067e9[_0xae84('0x78')]=ut[_0xae84('0x79')](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0x3,'NoAnswer');_0x160c4f=_0x15e088[_0xae84('0xaf')];_0x30f409=_0x15e088[_0xae84('0x80')];var _0x32ce4c=ut['buildNoAnswerEventPayload'](_0x5067e9,_0x15e088);ami[_0xae84('0x7b')](_0xae84('0xb0'),_0x32ce4c);rpcDb[_0xae84('0x6e')](_0x5067e9,_0xae84('0xb1'));_0x4e57ec[_0xae84('0x7f')](_0x5067e9,'3',_0x15e088)[_0xae84('0x64')](function(_0x4dbd0c){_0x31e379=_0x4dbd0c[_0xae84('0xaa')]==0x1;if(!_0x31e379){if(ut['totalGlobal'](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut[_0xae84('0x82')](_0x5067e9,0xf,_0xae84('0x83'));rpcDb[_0xae84('0x9c')](_0x9161df,_0xae84('0xb2'));}else{if(_0x5067e9[_0xae84('0xae')]>=_0x15e088[_0xae84('0xb3')]){rpcDb[_0xae84('0x9c')](_0x5067e9,_0xae84('0xb1'));}else{rpcDb[_0xae84('0x86')](ut['scheduledAt'](_0x5067e9,_0xae84('0xae'),_0x15e088[_0xae84('0xaf')]),_0x5067e9['unlockAgent'],_0x5067e9[_0xae84('0xac')]);}}}else{_0x5067e9[_0xae84('0xae')]++;_0x4e57ec['incrementPreviewCounters']({'id':_0x5067e9[_0xae84('0x8a')],'field':{'countnoanswerretry':_0x5067e9['countnoanswerretry']}})[_0xae84('0x64')](function(){_0x4e57ec[_0xae84('0x8c')](_0x5067e9,_0x160c4f,_0x30f409)[_0xae84('0x64')](function(){});});}});break;case _0xae84('0xb4'):_0x15e088[_0xae84('0xb5')]+=0x1;_0x5067e9['countcongestionretry']+=0x1;_0x5067e9[_0xae84('0x78')]=ut[_0xae84('0x79')](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0x8,_0xae84('0xb6'));_0x160c4f=_0x15e088[_0xae84('0xb7')];_0x30f409=_0x15e088[_0xae84('0x80')];ami[_0xae84('0x7b')](_0xae84('0xb8'),ut[_0xae84('0x7c')](_0x5067e9,'congestion'));rpcDb[_0xae84('0x6e')](_0x5067e9,_0xae84('0xb9'));_0x4e57ec[_0xae84('0x7f')](_0x5067e9,'8',_0x15e088)[_0xae84('0x64')](function(_0xf074d3){_0x31e379=_0xf074d3[_0xae84('0xaa')]==0x1;if(!_0x31e379){if(ut['totalGlobal'](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut[_0xae84('0x82')](_0x5067e9,0xf,'Global');rpcDb[_0xae84('0x9c')](_0x9161df,_0xae84('0xba'));}else{if(_0x5067e9['countcongestionretry']>=_0x15e088['dialCongestionMaxRetry']){rpcDb[_0xae84('0x9c')](_0x5067e9,_0xae84('0xb9'));}else{rpcDb[_0xae84('0x86')](ut['scheduledAt'](_0x5067e9,_0xae84('0xbb'),_0x15e088['dialBusyRetryFrequency']),_0x5067e9[_0xae84('0x88')],_0x5067e9['activeContact']);}}}else{_0x5067e9[_0xae84('0xbb')]++;_0x4e57ec['incrementPreviewCounters']({'id':_0x5067e9[_0xae84('0x8a')],'field':{'countcongestionretry':_0x5067e9['countcongestionretry']}})[_0xae84('0x64')](function(){_0x4e57ec['swapAdditionalPhones'](_0x5067e9,_0x160c4f,_0x30f409)[_0xae84('0x64')](function(){});});}});break;case _0xae84('0xbc'):_0x15e088[_0xae84('0xbd')]+=0x1;_0x5067e9[_0xae84('0xbe')]+=0x1;_0x5067e9['countglobal']=ut['totalGlobal'](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0x14,_0xae84('0xbf'));_0x160c4f=_0x15e088[_0xae84('0xc0')];_0x30f409=_0x15e088[_0xae84('0x80')];ami[_0xae84('0x7b')](_0xae84('0xc1'),ut[_0xae84('0x7c')](_0x5067e9,'agentreject'));rpcDb['createCustomerHistory'](_0x5067e9,_0xae84('0xc2'));_0x4e57ec['verifyAdditionalPhones'](_0x5067e9,'20',_0x15e088)['then'](function(_0x3c7b25){_0x31e379=_0x3c7b25[_0xae84('0xaa')]==0x1;if(!_0x31e379){if(ut[_0xae84('0x79')](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut[_0xae84('0x82')](_0x5067e9,0x14,_0xae84('0xbf'));rpcDb[_0xae84('0x9c')](_0x9161df,_0xae84('0xc3'));}else{if(_0x5067e9[_0xae84('0xbe')]>=_0x15e088[_0xae84('0xc4')]){rpcDb[_0xae84('0x9c')](_0x5067e9,_0xae84('0xc3'));}else{rpcDb[_0xae84('0x86')](ut['scheduledAt'](_0x5067e9,_0xae84('0xbe'),_0x15e088['dialAgentRejectRetryFrequency']),_0x5067e9[_0xae84('0x88')],_0x5067e9[_0xae84('0xac')]);}}}else{_0x5067e9[_0xae84('0xae')]++;_0x4e57ec[_0xae84('0x8b')]({'id':_0x5067e9['idContact'],'field':{'countnoanswerretry':_0x5067e9['countnoanswerretry']}})['then'](function(){_0x4e57ec[_0xae84('0x8c')](_0x5067e9,_0x160c4f,_0x30f409)[_0xae84('0x64')](function(){});});}});break;case _0xae84('0xc5'):_0x15e088[_0xae84('0xc6')]+=0x1;_0x5067e9['countabandonedretry']+=0x1;_0x5067e9[_0xae84('0x78')]=ut[_0xae84('0x79')](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0xb,_0xae84('0xc7'));rpcDb[_0xae84('0x6e')](_0x5067e9,_0xae84('0xc8'));_0x4e57ec[_0xae84('0x7f')](_0x5067e9,'11',_0x15e088)['then'](function(_0x5ecff9){_0x31e379=_0x5ecff9[_0xae84('0xaa')]==0x1;if(!_0x31e379){if(ut[_0xae84('0x79')](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut[_0xae84('0x82')](_0x5067e9,0xf,_0xae84('0x83'));rpcDb[_0xae84('0x9c')](_0x9161df,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5067e9[_0xae84('0xc9')]>=_0x15e088['dialAbandonedMaxRety']){rpcDb[_0xae84('0x9c')](_0x5067e9,_0xae84('0xc8'));}else{rpcDb[_0xae84('0x86')](ut[_0xae84('0x87')](_0x5067e9,_0xae84('0xca'),_0x15e088[_0xae84('0xcb')]),_0x5067e9[_0xae84('0x88')],_0x5067e9[_0xae84('0xac')]);}}}else{_0x5067e9[_0xae84('0xae')]++;_0x4e57ec[_0xae84('0x8b')]({'id':_0x5067e9[_0xae84('0x8a')],'field':{'countnoanswerretry':_0x5067e9[_0xae84('0xae')]}})[_0xae84('0x64')](function(){_0x4e57ec[_0xae84('0x8c')](_0x5067e9,_0x160c4f,_0x30f409)[_0xae84('0x64')](function(){});});}});break;case'18':_0x15e088['outboundUnknownCallsDay']+=0x1;_0x5067e9[_0xae84('0xcc')]+=0x1;_0x5067e9[_0xae84('0x78')]=ut['totalGlobal'](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0x12,_0x5712d8[_0xae84('0xcd')]||_0x5712d8[_0xae84('0xce')]);ami[_0xae84('0x7b')](_0xae84('0xcf'),ut[_0xae84('0x7c')](_0x5067e9,'amd'));rpcDb[_0xae84('0x6e')](_0x5067e9,_0xae84('0xd0'));_0x4e57ec[_0xae84('0x7f')](_0x5067e9,'18',_0x15e088)['then'](function(_0x37d32c){_0x31e379=_0x37d32c['additional']==0x1;if(!_0x31e379){if(ut['totalGlobal'](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut[_0xae84('0x82')](_0x5067e9,0x12,_0xae84('0x83'));rpcDb[_0xae84('0x9c')](_0x9161df,_0xae84('0xd0'));}else{rpcDb[_0xae84('0x9c')](_0x5067e9,_0xae84('0xd0'));}}else{_0x5067e9[_0xae84('0xae')]++;_0x4e57ec[_0xae84('0x8b')]({'id':_0x5067e9[_0xae84('0x8a')],'field':{'countnoanswerretry':_0x5067e9[_0xae84('0xae')]}})[_0xae84('0x64')](function(){_0x4e57ec['swapAdditionalPhones'](_0x5067e9,_0x160c4f,_0x30f409)['then'](function(){});});}});delete this['actions'][_0x5712d8[_0xae84('0x89')]];break;case'19':_0x15e088[_0xae84('0xd1')]+=0x1;_0x5067e9[_0xae84('0x78')]=ut[_0xae84('0x79')](_0x5067e9);ut[_0xae84('0x7a')](_0x5067e9,0x13,_0x5712d8[_0xae84('0xcd')]||_0x5712d8[_0xae84('0xce')]);ami['emit'](_0xae84('0xcf'),ut['buildObj'](_0x5067e9,_0xae84('0xd2')));rpcDb['createCustomerHistory'](_0x5067e9,_0xae84('0xd3'));_0x4e57ec[_0xae84('0x7f')](_0x5067e9,'18',_0x15e088)[_0xae84('0x64')](function(_0x5cbbe3){_0x31e379=_0x5cbbe3[_0xae84('0xaa')]==0x1;if(!_0x31e379){if(ut[_0xae84('0x79')](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut[_0xae84('0x82')](_0x5067e9,0xf,_0xae84('0x83'));rpcDb[_0xae84('0x9c')](_0x9161df,_0xae84('0xd3'));}else{rpcDb[_0xae84('0x9c')](_0x5067e9,_0xae84('0xd3'));}}else{_0x5067e9[_0xae84('0xae')]++;_0x4e57ec[_0xae84('0x8b')]({'id':_0x5067e9[_0xae84('0x8a')],'field':{'countnoanswerretry':_0x5067e9[_0xae84('0xae')]}})['then'](function(){_0x4e57ec[_0xae84('0x8c')](_0x5067e9,_0x160c4f,_0x30f409)[_0xae84('0x64')](function(){});});}});delete this[_0xae84('0x43')][_0x5712d8['linkedid']];break;default:if(_0x5067e9['dialAnswer']){ut[_0xae84('0x55')](_0x15e088,'[default]');ut[_0xae84('0x56')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x15e088[_0xae84('0x29')],_0x5712d8);}_0x15e088['outboundUnknownCallsDay']+=0x1;_0x5067e9[_0xae84('0x78')]=ut[_0xae84('0x79')](_0x5067e9);ut['logCustomer'](_0x5067e9,0xc,_0x5712d8['cause-txt']||_0x5712d8['dialstatus']);_0x160c4f=_0x15e088[_0xae84('0xc0')];_0x30f409=_0x15e088[_0xae84('0x80')];rpcDb['createCustomerHistory'](_0x5067e9,_0xae84('0xd4'));_0x4e57ec[_0xae84('0x7f')](_0x5067e9,'20',_0x15e088)[_0xae84('0x64')](function(_0x2f5250){_0x31e379=_0x2f5250[_0xae84('0xaa')]==0x1;if(!_0x31e379){if(ut[_0xae84('0x79')](_0x5067e9)>=_0x15e088[_0xae84('0x81')]){_0x9161df=ut[_0xae84('0x82')](_0x5067e9,0xf,_0xae84('0x83'));rpcDb[_0xae84('0x9c')](_0x9161df,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xae84('0x9c')](_0x5067e9,_0xae84('0xd5'));}delete this['actions'][_0x5712d8[_0xae84('0x89')]];}else{_0x4e57ec[_0xae84('0x8c')](_0x5067e9,_0x160c4f,_0x30f409)[_0xae84('0x64')](function(){});}});}if(!(_0x5067e9[_0xae84('0x4a')]&&_0x552322==='16')){ut['updateOriginated'](_0x15e088,_0xae84('0xd6'));logger[_0xae84('0x44')]('[originated][decrement][callProgressDetectingCustomer]',_0x5067e9['uniqueid'],_0xae84('0x91'),_0x15e088[_0xae84('0x29')],'originated:\x20',_0x15e088[_0xae84('0x2c')]);}if(_0x552322!=='ANSWER'){delete this[_0xae84('0x43')][_0x5712d8['linkedid']];delete this[_0xae84('0x43')][_0x5712d8[_0xae84('0xd7')]];}_0x15e088[_0xae84('0xd8')]=!![];}};Preview[_0xae84('0xf')][_0xae84('0xd9')]=function(_0x12ddb2,_0x4b799e,_0x128408){if(_['isUndefined'](_0x4b799e)&&_0xae84('0xda')!==typeof _0x4b799e){return;}if(_[_0xae84('0xdb')](_0x128408)&&_0xae84('0xda')!==typeof _0x128408){return;}switch(_0x128408[_0xae84('0xdc')]){case'0':ut[_0xae84('0xdd')](_0x12ddb2,0x0,_0xae84('0xde'));rpcDb[_0xae84('0xdf')](_0x12ddb2,_0xae84('0xe0'));break;case'3':ut[_0xae84('0xdd')](_0x12ddb2,0x3,_0xae84('0xe1'));rpcDb[_0xae84('0xdf')](_0x12ddb2,_0xae84('0xe2'));break;case'5':ut[_0xae84('0xdd')](_0x12ddb2,0x5,'Busy');rpcDb['createAgentHistory'](_0x12ddb2,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xae84('0xdd')](_0x12ddb2,0x8,_0xae84('0xb6'));rpcDb[_0xae84('0xdf')](_0x12ddb2,_0xae84('0xe3'));break;case'22':ut['logAgent'](_0x12ddb2,0x16,_0xae84('0xe4'));rpcDb[_0xae84('0xdf')](_0x12ddb2,_0xae84('0xe5'));break;default:ut[_0xae84('0xdd')](_0x12ddb2,0xc,_0x128408['reason']);rpcDb['createAgentHistory'](_0x12ddb2,_0xae84('0xe3'));}ut['updateOriginated'](_0x4b799e,_0xae84('0xe6'));logger[_0xae84('0x44')](_0xae84('0xe7'),_0x12ddb2[_0xae84('0xa1')],_0xae84('0x91'),_0x4b799e[_0xae84('0x29')],_0xae84('0x48'),_0x4b799e[_0xae84('0x2c')]);delete this['actions'][_0x12ddb2['uniqueid']];};Preview[_0xae84('0xf')]['verifyAdditionalPhones']=function(_0x49e704,_0x28d1e4,_0xf4a1f){return cmHopperAdditionalPhone[_0xae84('0x7f')](_0x49e704,_0x28d1e4,_0xf4a1f)['catch'](logger['info'](_0xae84('0xe8')));};Preview['prototype'][_0xae84('0x8c')]=function(_0x5b34a5,_0x541b58,_0x560846){return cmHopperAdditionalPhone[_0xae84('0x8c')](_0x5b34a5,_0x541b58,_0x560846)[_0xae84('0x66')](logger[_0xae84('0x44')](_0xae84('0xe9')));};Preview[_0xae84('0xf')]['incrementPreviewCounters']=function(_0x2f9597){return Promise['resolve']()[_0xae84('0x64')](cmHopperAdditionalPhone[_0xae84('0x8b')](_0x2f9597))[_0xae84('0x66')](logger['info'](_0xae84('0xea')));};Preview[_0xae84('0xf')]['checkInBlack']=function(_0x4f3110,_0x37acd2,_0x2fbb90,_0x26146e,_0x3aecbe){var _0x2fe987=this;return new Promise(function(_0x2f801f,_0x117e9e){if(_[_0xae84('0x42')](_0x37acd2)||_['isNil'](_0x37acd2['Contact'])||_[_0xae84('0x42')](_0x37acd2['phone'])||_['isNil'](_0x37acd2[_0xae84('0x4e')])){_0x117e9e(ut['message'](_0xae84('0xeb'),_0x26146e,_0x3aecbe));return;}var _0x2b8a9a=uuid['v4']();var _0x911217=_0x2fe987[_0xae84('0x13')][_0x37acd2['Queue']['name']];var _0x346274=_0x2fbb90?_0x2fe987[_0xae84('0x5c')][_0x2fbb90]['id']:undefined;_0x2fe987['actions'][_0x2b8a9a]=new Action(_0x37acd2,_0x911217,_0x2b8a9a,_0x2fbb90,_0x346274);var _0x3729f7=_0x2fe987[_0xae84('0x43')][_0x2b8a9a];_0x3729f7[_0xae84('0x88')]=_0x26146e;_0x3729f7['activeContact']=_0x3aecbe;_0x3729f7[_0xae84('0xec')]=_0x2fbb90;if(_[_0xae84('0xed')](_0x4f3110)){_0x2fe987[_0xae84('0xee')](_0x3729f7,_0x911217,_0x37acd2,_0x2fbb90)[_0xae84('0x64')](function(_0x1986b9){logger[_0xae84('0x44')](_0xae84('0xef'),'Queue:\x20'+_0x3729f7['queue']+'\x20IdHopper:\x20'+_0x3729f7[_0xae84('0x8a')],JSON[_0xae84('0x26')](_0x1986b9));ami[_0xae84('0x7b')](_0xae84('0xf0'),ut[_0xae84('0x7c')](_0x3729f7,_0xae84('0xf1'),_0x2fe987[_0xae84('0x13')][_0x3729f7[_0xae84('0x47')]]));_0x2f801f(ut['message'](_0xae84('0xf2')));})['catch'](function(_0x26dbf5){ut[_0xae84('0x33')](_0xae84('0xf3'),_0x26dbf5);_0x117e9e(ut[_0xae84('0x30')](_0xae84('0xf4'),_0x26146e,_0x3aecbe));});}else{_0x911217['outboundBlacklistCallsDay']+=0x1;ut[_0xae84('0xf5')](_0x3729f7);rpcDb[_0xae84('0xf6')](_0x3729f7,_0xae84('0xf7'));delete _0x2fe987[_0xae84('0x43')][_0x2b8a9a];_0x117e9e(ut[_0xae84('0x30')](_0xae84('0xf8'),_0x26146e,_0x3aecbe));}});};Preview[_0xae84('0xf')][_0xae84('0x73')]=function(_0x4f7b84){return!_[_0xae84('0x42')](_0x4f7b84)&&!_['isNil'](_0x4f7b84[_0xae84('0x29')])&&!_[_0xae84('0x42')](_0x4f7b84[_0xae84('0xf9')])&&_0x4f7b84[_0xae84('0xf9')]&&!_[_0xae84('0x42')](this[_0xae84('0x15')][util[_0xae84('0x27')](_0xae84('0xfa'),_0x4f7b84['name'])])&&!_[_0xae84('0x42')](this[_0xae84('0x15')][util[_0xae84('0x27')](_0xae84('0xfa'),_0x4f7b84[_0xae84('0x29')])][_0xae84('0x50')])&&(this['trunks'][util[_0xae84('0x27')](_0xae84('0xfa'),_0x4f7b84['name'])]['status']==='reachable'||this[_0xae84('0x15')][util[_0xae84('0x27')](_0xae84('0xfa'),_0x4f7b84[_0xae84('0x29')])]['status']===_0xae84('0xfb'));};Preview[_0xae84('0xf')][_0xae84('0x63')]=function(_0x5a1a59,_0x2a1967){return this[_0xae84('0xfc')](_0x5a1a59,_0x2a1967)[_0xae84('0x64')](function(_0x1ddfb0){return _[_0xae84('0x4b')](_0x1ddfb0,['message']);})[_0xae84('0x66')](function(_0x5bf8a6){if(_0x5bf8a6[_0xae84('0xfd')]){rpcDb['unlockContact'](_0x5a1a59);}if(_0x5bf8a6['active']){rpcDb[_0xae84('0x67')](_0x5a1a59);}throw _[_0xae84('0x4b')](_0x5bf8a6,[_0xae84('0x30')]);});};Preview[_0xae84('0xf')]['execRun']=function(_0x15fa90,_0xab794){var _0x1a4fa2=this;var _0x37be84,_0x29a6b9;return rpcDb[_0xae84('0xfe')](_0x15fa90)[_0xae84('0x64')](function(_0x350cff){if(!_[_0xae84('0x42')](_0x350cff[0x0])){_0x29a6b9=_0x350cff[0x0]['recallme']?![]:!![];_0x37be84=_0x350cff[0x0][_0xae84('0xff')]?!![]:![];_0x37be84=_0xab794?!![]:_0x37be84;}var _0xa2d285=_0x1a4fa2['validateContact'](_0x350cff);if(_0xa2d285[_0xae84('0x100')]){rpcDb[_0xae84('0x101')](_[_0xae84('0x4b')](_0x350cff[0x0],[_0xae84('0x4e'),'phone']))['then'](function(_0x5e5eb7){_0x1a4fa2['checkInBlack'](_0x5e5eb7,_0x350cff[0x0],_0xab794,_0x29a6b9,_0x37be84)[_0xae84('0x64')](function(_0x261226){return _0x261226;})[_0xae84('0x66')](function(_0x339b8e){throw _0x339b8e;});})[_0xae84('0x66')](function(_0x14d29a){ut[_0xae84('0x33')](_0xae84('0x102'),_0x14d29a);throw ut[_0xae84('0x30')](_0xae84('0x103'),_0x29a6b9,_0x37be84);});}else{throw ut[_0xae84('0x30')](_0xa2d285[_0xae84('0x30')],_0x29a6b9,_0x37be84);}})['catch'](function(_0x233c55){ut[_0xae84('0x33')](_0xae84('0x104'),_0x233c55);throw ut[_0xae84('0x30')](_0xae84('0x103'),![],!![]);});};Preview[_0xae84('0xf')][_0xae84('0x105')]=function(_0x2f5fd6){if(_[_0xae84('0x42')](_0x2f5fd6)||_[_0xae84('0xed')](_0x2f5fd6)||!_['isNil'](_0x2f5fd6[0x0][_0xae84('0x61')])&&_[_0xae84('0x42')](_0x2f5fd6[0x0]['Agent']['name'])){ut['logger'](_0xae84('0x106'),_0x2f5fd6);return{'isValid':![],'message':_0xae84('0x107')};}var _0x1b19a5=this[_0xae84('0x13')][_0x2f5fd6[0x0]['Queue'][_0xae84('0x29')]];_0x1b19a5[_0xae84('0x30')]=utils['CAMPAIGN_STATUS'][_0xae84('0x76')];if(_['isNil'](_0x1b19a5)){ut[_0xae84('0x33')]('[Preview][validateContact][Empty\x20Campaign]',_0x1b19a5);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x1b19a5['Trunk'])){ut[_0xae84('0x33')](_0xae84('0x108'),_0xae84('0x109')+_0x1b19a5[_0xae84('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x1b19a5[_0xae84('0x74')])){ut[_0xae84('0x33')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x1b19a5['name']+_0xae84('0x10a'));return{'isValid':![],'message':_0xae84('0x10b')};}}if(!ut[_0xae84('0x71')](_0x1b19a5['dialActive'])){ut[_0xae84('0x33')](_0xae84('0x10c'),_0x1b19a5[_0xae84('0x29')]+_0xae84('0x10d'));return{'isValid':![],'message':_0xae84('0x109')+_0x1b19a5[_0xae84('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xae84('0x10e')};};Preview[_0xae84('0xf')]['execCall']=function(_0x80450b,_0x1a303f,_0x300067,_0x3afe17){var _0x5275b2=this;return new Promise(function(_0x12fbfa,_0x2e39d1){var _0x528390=_0x80450b[_0xae84('0xa1')];var _0x45a104=_0x5275b2['isTrunkReachable'](_0x1a303f[_0xae84('0x72')])?util[_0xae84('0x27')](_0xae84('0x10f'),_0x1a303f['Trunk'][_0xae84('0x29')],_[_0xae84('0x42')](_0x1a303f[_0xae84('0x110')])?'':_0x1a303f[_0xae84('0x110')]['trim']()||'',_0x1a303f[_0xae84('0x111')]>0x0?_0x300067[_0xae84('0x112')]['substring'](_0x1a303f[_0xae84('0x111')]):_0x300067[_0xae84('0x112')]):util[_0xae84('0x27')](_0xae84('0x10f'),_[_0xae84('0x42')](_0x1a303f['TrunkBackup'])?_0x1a303f[_0xae84('0x72')][_0xae84('0x29')]:_0x1a303f[_0xae84('0x74')]['name'],_['isNil'](_0x1a303f[_0xae84('0x110')])?'':_0x1a303f[_0xae84('0x110')][_0xae84('0x113')]()||'',_0x1a303f[_0xae84('0x111')]>0x0?_0x300067[_0xae84('0x112')][_0xae84('0x114')](_0x1a303f[_0xae84('0x111')]):_0x300067[_0xae84('0x112')]);var _0xb4b8c6=_0x5275b2[_0xae84('0x73')](_0x1a303f[_0xae84('0x72')])?ut[_0xae84('0x115')](_0x1a303f[_0xae84('0x72')][_0xae84('0x116')],_0x1a303f['dialOriginateCallerIdName'],_0x1a303f[_0xae84('0x117')]>0x0?ut[_0xae84('0x118')](_0x1a303f['dialOriginateCallerIdNumber'],_0x1a303f['dialRandomLastDigitCallerIdNumber']):_0x1a303f[_0xae84('0x119')]):ut[_0xae84('0x115')](_[_0xae84('0x42')](_0x1a303f[_0xae84('0x74')])?_0x1a303f['Trunk']['callerid']:_0x1a303f[_0xae84('0x74')][_0xae84('0x116')],_0x1a303f[_0xae84('0x11a')],_0x1a303f[_0xae84('0x117')]>0x0?ut[_0xae84('0x118')](_0x1a303f[_0xae84('0x119')],_0x1a303f[_0xae84('0x117')]):_0x1a303f[_0xae84('0x119')]);if(_0xb4b8c6){_0x80450b['originatecalleridname']=ut[_0xae84('0x11b')](_0xb4b8c6);_0x80450b[_0xae84('0x11c')]=ut[_0xae84('0x11d')](_0xb4b8c6);}var _0x1c22eb=ut['addVariables'](_0x1a303f,_0x300067,_0x45a104,_0xb4b8c6,_0x528390,_0x80450b);var _0x5f1663=utils[_0xae84('0x11e')](_0x300067[_0xae84('0x11f')]);Object[_0xae84('0x120')](_0x1c22eb,_0x5f1663);_[_0xae84('0x121')](_0x80450b,ut[_0xae84('0x122')](_0x1c22eb));_0x80450b['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1a303f[_0xae84('0x123')]=_0x1c22eb;var _0x284f56=ut[_0xae84('0x124')](_0x80450b,_0x1a303f,_0x1c22eb,_0x80450b[_0xae84('0xac')],_0x3afe17);return ami[_0xae84('0x4f')](_0x284f56)['then'](function(_0x14bffc){_0x1a303f[_0xae84('0x2c')]+=0x1;logger[_0xae84('0x44')]('[originated][increment]',_0x528390,_0xae84('0x91'),_0x1a303f[_0xae84('0x29')],_0xae84('0x48'),_0x1a303f[_0xae84('0x2c')]);_0x12fbfa(_0x14bffc);})[_0xae84('0x66')](function(_0x420903){ut['logAgent'](_0x80450b,0xe,_0xae84('0x125'));rpcDb['createAgentHistory'](_0x80450b,_0xae84('0x126'));_0x2e39d1(_0x420903);});});};Preview[_0xae84('0xf')][_0xae84('0x21')]=function(_0x8e85b0){if(this[_0xae84('0x43')][_0x8e85b0['linkedid']]){this[_0xae84('0x43')][_0x8e85b0[_0xae84('0x89')]][_0xae84('0x51')]=_0x8e85b0['channel'];}};Preview[_0xae84('0xf')]['syncOriginateResponse']=function(_0x227bd0){var _0x4b9484=this;var _0x4f37e7=this['actions'][_0x227bd0[_0xae84('0x127')]];if(_0x4f37e7){if(_0x4f37e7[_0xae84('0xec')]&&this[_0xae84('0x5c')][_0x4f37e7[_0xae84('0xec')]]){ut[_0xae84('0x128')](_0x4f37e7,this[_0xae84('0x5c')][_0x4f37e7[_0xae84('0xec')]][_0xae84('0x29')],this[_0xae84('0x5c')][_0x4f37e7[_0xae84('0xec')]]['id']);}var _0x1fd2e6=_[_0xae84('0x129')](_0x4f37e7);_0x1fd2e6[_0xae84('0x8e')]=moment()[_0xae84('0x27')](_0xae84('0x12a'));var _0x33b2d4=_0x4b9484['campaignsPreview'][_0x4f37e7[_0xae84('0x47')]];if(ut['isFailure'](_0x227bd0['response'])){if(_0x4f37e7[_0xae84('0x88')]){rpcDb[_0xae84('0x12b')](_0x4f37e7['idContact']);}if(_0x4f37e7['activeContact']){rpcDb['disableContact'](_0x4f37e7[_0xae84('0x8a')]);}ami[_0xae84('0x7b')](_0xae84('0x12c'),ut['buildObj'](_0x4f37e7,_0xae84('0x12d'),this[_0xae84('0x13')][_0x4f37e7['queue']]));this[_0xae84('0xd9')](_0x1fd2e6,_0x33b2d4,_0x227bd0);}else{_0x4f37e7[_0xae84('0x68')]=moment()[_0xae84('0x27')](_0xae84('0x12a'));ut[_0xae84('0xdd')](_0x1fd2e6,0x4,_0xae84('0x9a'));rpcDb['createAgentHistory'](_0x1fd2e6,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xae84('0xf')][_0xae84('0x1a')]=function(_0x24a410){var _0xfde7e5=this['actions'][_0x24a410[_0xae84('0x89')]];var _0x17a703;if(_0xfde7e5){_0x17a703=this['campaignsPreview'][_0xfde7e5['queue']];logger[_0xae84('0x44')](_0xae84('0x12e'),_0x24a410[_0xae84('0x89')],_0xae84('0x91'),_0x17a703['name'],'pTalking:\x20',_0x17a703[_0xae84('0x2d')]);}if(this['actions'][_0x24a410['linkedid']]&&_0x24a410['linkedid']!==_0x24a410[_0xae84('0xa1')]){if(_0x24a410[_0xae84('0x12f')]==='16'&&this[_0xae84('0x43')][_0x24a410[_0xae84('0x89')]][_0xae84('0x4a')]){this['callProgressDetectingCustomer'](_0x24a410,_0x24a410[_0xae84('0x89')],_0x24a410[_0xae84('0x12f')]);}else if(this[_0xae84('0x43')][_0x24a410[_0xae84('0x89')]][_0xae84('0x4a')]){logger['info']('[syncHangup][talking][cause]',_0x24a410[_0xae84('0x89')],_0x24a410[_0xae84('0x12f')],_0xae84('0x91'),_0x17a703['name'],_0xae84('0x49'),_0x17a703[_0xae84('0x2d')]);this[_0xae84('0x130')](_0x24a410,_0x24a410[_0xae84('0x89')],_0x24a410[_0xae84('0x12f')]);}}else if(_0xfde7e5&&_[_0xae84('0x42')](_0xfde7e5[_0xae84('0x131')])&&_0x17a703['dialQueueProject']&&_0x24a410[_0xae84('0x89')]===_0x24a410['uniqueid']&&_[_0xae84('0x42')](_0x24a410[_0xae84('0xdc')])&&_0x24a410[_0xae84('0x12f')]==='16'&&_0x24a410[_0xae84('0x132')]==='6'&&_['isUndefined'](_0xfde7e5[_0xae84('0x133')])){if(_0xfde7e5['unlockAgent']){rpcDb[_0xae84('0x12b')](_0xfde7e5[_0xae84('0x8a')]);}if(_0xfde7e5[_0xae84('0xac')]){rpcDb[_0xae84('0x67')](_0xfde7e5[_0xae84('0x8a')]);}_0x24a410[_0xae84('0xdc')]='22';this[_0xae84('0xd9')](_0xfde7e5,_0x17a703,_0x24a410);}else if(_0xfde7e5&&_0xfde7e5[_0xae84('0x133')]){if(_0x24a410[_0xae84('0x12f')]==='16'&&this['actions'][_0x24a410[_0xae84('0x89')]][_0xae84('0x4a')]){logger['info'](_0xae84('0x134'),_0x24a410[_0xae84('0x89')],_0x24a410[_0xae84('0x12f')],'\x20Queue',_0x17a703[_0xae84('0x29')],'pTalking:\x20',_0x17a703[_0xae84('0x2d')]);this[_0xae84('0x130')](_0x24a410,_0x24a410['linkedid'],_0x24a410[_0xae84('0x12f')]);}else if(this[_0xae84('0x43')][_0x24a410[_0xae84('0x89')]]['dialAnswer']){logger['info'](_0xae84('0x135'),_0x24a410['linkedid'],_0x24a410[_0xae84('0x12f')],_0xae84('0x91'),_0x17a703[_0xae84('0x29')],_0xae84('0x49'),_0x17a703[_0xae84('0x2d')]);this[_0xae84('0x130')](_0x24a410,_0x24a410[_0xae84('0x89')],_0x24a410[_0xae84('0x12f')]);}}};Preview[_0xae84('0xf')][_0xae84('0x1e')]=function(_0x4f55ef){if(this[_0xae84('0x43')][_0x4f55ef[_0xae84('0xd7')]]&&_0x4f55ef['destlinkedid']!==_0x4f55ef['destuniqueid']){this[_0xae84('0x130')](_0x4f55ef,_0x4f55ef[_0xae84('0xd7')],_0x4f55ef[_0xae84('0xce')]);}};Preview[_0xae84('0xf')][_0xae84('0x1c')]=function(_0x1a8f99){if(this['actions'][_0x1a8f99['linkedid']]&&_0x1a8f99[_0xae84('0x89')]!==_0x1a8f99[_0xae84('0xa1')]&&!this['actions'][_0x1a8f99['linkedid']][_0xae84('0x4a')]){if(_0x1a8f99[_0xae84('0x12f')]==='1'){this[_0xae84('0x130')](_0x1a8f99,_0x1a8f99['linkedid'],_0x1a8f99[_0xae84('0x12f')]);}}};Preview[_0xae84('0xf')][_0xae84('0x136')]=function(_0xb7952d,_0x1fe964,_0x5175fe){if(this[_0xae84('0x43')][_0xb7952d]){if(_[_0xae84('0x42')](this[_0xae84('0x43')][_0xb7952d]['variables'])){this[_0xae84('0x43')][_0xb7952d][_0xae84('0x123')]={};}this[_0xae84('0x43')][_0xb7952d][_0xae84('0x123')][_0x1fe964]=_0x5175fe;}};Preview[_0xae84('0xf')][_0xae84('0x23')]=function(_0x522c0c){try{if(!_[_0xae84('0x42')](_0x522c0c)){if(ut[_0xae84('0x137')](_[_0xae84('0x138')](_0x522c0c[_0xae84('0x139')])[0x0])){this[_0xae84('0x136')](_0x522c0c[_0xae84('0xa1')],_[_0xae84('0x138')](_0x522c0c['variable'])[0x0],_0x522c0c[_0xae84('0x13a')]);}}}catch(_0x1af6a7){logger[_0xae84('0x13b')](_0xae84('0x13c'),util[_0xae84('0x13d')](_0x1af6a7,{'showHidden':![],'depth':null}));}};Preview[_0xae84('0xf')][_0xae84('0x13e')]=function(_0x133676){if(_0x133676){if(this[_0xae84('0x43')][_0x133676['transfertargetlinkedid']]){this[_0xae84('0x43')][_0x133676[_0xae84('0x13f')]][_0xae84('0x133')]=!![];}}};Preview[_0xae84('0xf')][_0xae84('0x140')]=function(_0x1ca0ba){if(_0x1ca0ba){if(this['actions'][_0x1ca0ba[_0xae84('0x141')]]){this[_0xae84('0x43')][_0x1ca0ba[_0xae84('0x141')]][_0xae84('0x133')]=!![];}}};module[_0xae84('0x142')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 8ea52f5..bf2c305 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 _0x7c62=['resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','createHistory'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c62,0x1df));var _0x27c6=function(_0x247068,_0x4f3719){_0x247068=_0x247068-0x0;var _0x2dbf0e=_0x7c62[_0x247068];return _0x2dbf0e;};'use strict';var util=require('util');var BPromise=require(_0x27c6('0x0'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0x27c6('0x1'));var cmHopperHistory=require(_0x27c6('0x2'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x27c6('0x3'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x37f514){return function(_0x3e4fc2){logger[_0x27c6('0x4')](_0x37f514,util[_0x27c6('0x5')](_0x3e4fc2,{'showHidden':![],'depth':null}));};}function create(_0x184a76){return cmHopperHistory[_0x27c6('0x6')](_0x184a76)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2dc526){return BPromise[_0x27c6('0x7')]()[_0x27c6('0x8')](agentReportPreview[_0x27c6('0x6')](_0x2dc526))[_0x27c6('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2a07e2){return cmHopper[_0x27c6('0xa')](_0x2a07e2,!![])[_0x27c6('0x9')](loggerCatch(_0x27c6('0xb')));}exports[_0x27c6('0xc')]=function(_0x29c42b){return cmHopperBlack[_0x27c6('0xc')](_0x29c42b)[_0x27c6('0x9')](loggerCatch(_0x27c6('0xd')));};exports['getContactPreview']=function(_0x4ba47f){return BPromise[_0x27c6('0x7')]()[_0x27c6('0x8')](cmHopper[_0x27c6('0xe')](_0x4ba47f))[_0x27c6('0x9')](loggerCatch(_0x27c6('0xf')));};exports[_0x27c6('0x6')]=function(_0xb22696,_0x41e2ed){create(_0xb22696)[_0x27c6('0x9')](loggerCatch(_0x41e2ed));moveContact(_0xb22696)[_0x27c6('0x9')](loggerCatch(_0x41e2ed));};exports[_0x27c6('0x10')]=function(_0xa24fa5,_0x2fcbde){createAgent(_0xa24fa5)['catch'](loggerCatch(_0x2fcbde));};exports[_0x27c6('0x11')]=function(_0x5e3419,_0x447402){create(_0x5e3419)['catch'](loggerCatch(_0x447402));};exports[_0x27c6('0x12')]=function(_0x169036,_0x2ac4fd){moveContact(_0x169036)[_0x27c6('0x9')](loggerCatch(_0x2ac4fd));};exports[_0x27c6('0x13')]=function(_0x33fcf1,_0x2d8a78,_0x39899e){if(_0x2d8a78){_0x33fcf1['UserId']=null;}if(_0x39899e){_0x33fcf1['active']=![];}return cmHopper[_0x27c6('0x13')](_0x33fcf1)['catch'](loggerCatch(_0x27c6('0x14')));};exports[_0x27c6('0x15')]=function(_0xb9f6f4){return cmHopper[_0x27c6('0x15')](_0xb9f6f4)[_0x27c6('0x9')](loggerCatch(_0x27c6('0x16')));};exports[_0x27c6('0x17')]=function(_0x1ea527){return cmHopper[_0x27c6('0x17')]({'UserId':null},_0x1ea527,0x1)[_0x27c6('0x9')](loggerCatch(_0x27c6('0x18')));};exports[_0x27c6('0x19')]=function(_0x5747d4){return cmHopper[_0x27c6('0x17')]({'active':![]},_0x5747d4,0x1)[_0x27c6('0x9')](loggerCatch(_0x27c6('0x1a')));};exports[_0x27c6('0x1b')]=function(_0x173a1c){var _0x58a0f3={};_0x58a0f3[_0x27c6('0x1c')]=_0x173a1c[_0x27c6('0x1c')];_0x58a0f3[_0x27c6('0x1d')]=_0x173a1c[_0x27c6('0x1d')];_0x58a0f3[_0x27c6('0x1e')]=_0x173a1c[_0x27c6('0x1e')];_0x58a0f3[_0x27c6('0x1f')]=_0x173a1c[_0x27c6('0x1f')];_0x58a0f3[_0x27c6('0x20')]=_0x173a1c['queue'];_0x58a0f3[_0x27c6('0x21')]=_0x173a1c[_0x27c6('0x22')];_0x58a0f3[_0x27c6('0x23')]=_0x173a1c[_0x27c6('0x22')];_0x58a0f3[_0x27c6('0x24')]=0x1;_0x58a0f3[_0x27c6('0x25')]=_0x173a1c[_0x27c6('0x26')];_0x58a0f3['connectedlinename']=_0x173a1c[_0x27c6('0x27')];_0x58a0f3['context']=_0x27c6('0x28');_0x58a0f3[_0x27c6('0x29')]=_0x27c6('0x2a');_0x58a0f3[_0x27c6('0x2b')]=0x0;_0x58a0f3[_0x27c6('0x2c')]=0x1;_0x58a0f3[_0x27c6('0x2d')]=_0x173a1c[_0x27c6('0x27')];_0x58a0f3[_0x27c6('0x2e')]=_0x27c6('0x2f');return BPromise[_0x27c6('0x7')]()[_0x27c6('0x8')](voiceQueueReport[_0x27c6('0x30')](_0x58a0f3))[_0x27c6('0x9')](loggerCatch(_0x27c6('0x31')));};exports[_0x27c6('0x32')]=function(_0x23b47b,_0x4ed2c9){return BPromise[_0x27c6('0x7')]()['then'](cmHopper['getContactRecallMe'](_0x23b47b,_0x4ed2c9))[_0x27c6('0x9')](loggerCatch(_0x27c6('0x33')));};exports[_0x27c6('0x34')]=function(_0x1bcce9){return cmHopper[_0x27c6('0x13')](_0x1bcce9,!![],!![])[_0x27c6('0x9')](loggerCatch(_0x27c6('0x35')));}; \ No newline at end of file +var _0xdadc=['[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact'];(function(_0x3de5d0,_0x17eb94){var _0x7c4432=function(_0x5341fa){while(--_0x5341fa){_0x3de5d0['push'](_0x3de5d0['shift']());}};_0x7c4432(++_0x17eb94);}(_0xdadc,0x122));var _0xcdad=function(_0x33d766,_0x5b2d9a){_0x33d766=_0x33d766-0x0;var _0x5117e0=_0xdadc[_0x33d766];return _0x5117e0;};'use strict';var util=require(_0xcdad('0x0'));var BPromise=require(_0xcdad('0x1'));var logger=require(_0xcdad('0x2'))(_0xcdad('0x3'));var cmHopper=require(_0xcdad('0x4'));var cmHopperHistory=require(_0xcdad('0x5'));var cmHopperBlack=require(_0xcdad('0x6'));var agentReportPreview=require(_0xcdad('0x7'));var voiceQueueReport=require(_0xcdad('0x8'));function loggerCatch(_0x539875){return function(_0x44fb83){logger['error'](_0x539875,util[_0xcdad('0x9')](_0x44fb83,{'showHidden':![],'depth':null}));};}function create(_0x3e08e5){return cmHopperHistory['createHistory'](_0x3e08e5)[_0xcdad('0xa')](loggerCatch(_0xcdad('0xb')));}function createAgent(_0xa1ff80){return BPromise[_0xcdad('0xc')]()[_0xcdad('0xd')](agentReportPreview[_0xcdad('0xe')](_0xa1ff80))['catch'](loggerCatch(_0xcdad('0xb')));}function moveContact(_0x402771){return cmHopper[_0xcdad('0xf')](_0x402771,!![])[_0xcdad('0xa')](loggerCatch(_0xcdad('0x10')));}exports[_0xcdad('0x11')]=function(_0x1166cf){return cmHopperBlack['checkIsBlackList'](_0x1166cf)[_0xcdad('0xa')](loggerCatch(_0xcdad('0x12')));};exports[_0xcdad('0x13')]=function(_0x99c2a2){return BPromise[_0xcdad('0xc')]()['then'](cmHopper[_0xcdad('0x13')](_0x99c2a2))[_0xcdad('0xa')](loggerCatch('[getContactPreview]\x20'));};exports[_0xcdad('0xe')]=function(_0x48f594,_0x2e5d77){create(_0x48f594)[_0xcdad('0xa')](loggerCatch(_0x2e5d77));moveContact(_0x48f594)[_0xcdad('0xa')](loggerCatch(_0x2e5d77));};exports[_0xcdad('0x14')]=function(_0x40e34d,_0x4bb4c1){createAgent(_0x40e34d)['catch'](loggerCatch(_0x4bb4c1));};exports['createCustomerHistory']=function(_0x44cd36,_0x39da97){create(_0x44cd36)[_0xcdad('0xa')](loggerCatch(_0x39da97));};exports['createCustomerFinal']=function(_0xc15f55,_0x5c3518){moveContact(_0xc15f55)[_0xcdad('0xa')](loggerCatch(_0x5c3518));};exports[_0xcdad('0x15')]=function(_0x3e4461,_0x4d9093,_0x529dd2){if(_0x4d9093){_0x3e4461[_0xcdad('0x16')]=null;}if(_0x529dd2){_0x3e4461[_0xcdad('0x17')]=![];}return cmHopper['rescheduleContact'](_0x3e4461)[_0xcdad('0xa')](loggerCatch(_0xcdad('0x18')));};exports[_0xcdad('0x19')]=function(_0x24169b){return cmHopper['countReScheduled'](_0x24169b)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xcdad('0x1a')]=function(_0xe4551c){return cmHopper[_0xcdad('0x1a')]({'UserId':null},_0xe4551c,0x1)[_0xcdad('0xa')](loggerCatch('[unlockContact]\x20'));};exports[_0xcdad('0x1b')]=function(_0x2f2e03){return cmHopper[_0xcdad('0x1a')]({'active':![]},_0x2f2e03,0x1)[_0xcdad('0xa')](loggerCatch(_0xcdad('0x1c')));};exports[_0xcdad('0x1d')]=function(_0x105323){var _0x3f9c23={};_0x3f9c23['type']=_0x105323[_0xcdad('0x1e')];_0x3f9c23[_0xcdad('0x1f')]=_0x105323[_0xcdad('0x1f')];_0x3f9c23['calleridnum']=_0x105323[_0xcdad('0x20')];_0x3f9c23['calleridname']=_0x105323[_0xcdad('0x21')];_0x3f9c23[_0xcdad('0x22')]=_0x105323['queue'];_0x3f9c23[_0xcdad('0x23')]=_0x105323[_0xcdad('0x24')];_0x3f9c23[_0xcdad('0x25')]=_0x105323['answertime'];_0x3f9c23['queuecallercomplete']=0x1;_0x3f9c23[_0xcdad('0x26')]=_0x105323[_0xcdad('0x27')];_0x3f9c23[_0xcdad('0x28')]=_0x105323[_0xcdad('0x29')];_0x3f9c23['context']='from-sip';_0x3f9c23[_0xcdad('0x2a')]='xcally-motion-preview';_0x3f9c23[_0xcdad('0x2b')]=0x0;_0x3f9c23[_0xcdad('0x2c')]=0x1;_0x3f9c23[_0xcdad('0x2d')]=_0x105323[_0xcdad('0x29')];_0x3f9c23[_0xcdad('0x2e')]=_0xcdad('0x2f');return BPromise[_0xcdad('0xc')]()[_0xcdad('0xd')](voiceQueueReport['create'](_0x3f9c23))[_0xcdad('0xa')](loggerCatch(_0xcdad('0x30')));};exports[_0xcdad('0x31')]=function(_0x30a392,_0x77c588){return BPromise['resolve']()[_0xcdad('0xd')](cmHopper['getContactRecallMe'](_0x30a392,_0x77c588))['catch'](loggerCatch(_0xcdad('0x32')));};exports[_0xcdad('0x33')]=function(_0x2e4fbd){return cmHopper['rescheduleContact'](_0x2e4fbd,!![],!![])[_0xcdad('0xa')](loggerCatch(_0xcdad('0x34')));}; \ 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 9d75574..d8d73b6 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 _0x965b=['countglobal','callbackat','recallme','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','../../dialer/utils','loggerCatch','error','info','inspect','loggerError','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','endtime','logAgent','ringtime','getSeconds','starttime','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','statedesc','scheduledAt','scheduledat','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','voice','mandatoryDisposition','agentReadyId','not_inuse','status','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','campaigntype','dialAnswer','membername','countbusyretry'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x965b,0x1c7));var _0xb965=function(_0x21d93c,_0x18bc1d){_0x21d93c=_0x21d93c-0x0;var _0x59d6a9=_0x965b[_0x21d93c];return _0x59d6a9;};'use strict';var util=require(_0xb965('0x0'));var _=require(_0xb965('0x1'));var moment=require(_0xb965('0x2'));var logger=require(_0xb965('0x3'))(_0xb965('0x4'));var ipAgi=process[_0xb965('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0xb965('0x6'));exports[_0xb965('0x7')]=function(_0x2f69ea){return function(_0x4d4bad){logger[_0xb965('0x8')](_0x2f69ea,util['inspect'](_0x4d4bad,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3b4da5,_0x3396cc){logger[_0xb965('0x9')](_0x3b4da5,util[_0xb965('0xa')](_0x3396cc,{'showHidden':![],'depth':null}));};exports[_0xb965('0xb')]=function(_0x23f3cf,_0x4c6c35){logger['error'](_0x23f3cf,util[_0xb965('0xa')](_0x4c6c35,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x5a3009){return function(_0x52ec29){logger[_0xb965('0x9')](_0x5a3009,util['inspect'](_0x52ec29,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4c3a3d,_0x3a9f42,_0x52be68){return{'message':_0x4c3a3d,'unlock':_0x3a9f42,'active':_0x52be68};};exports['getCallerId']=function(_0x2c2813,_0x4ca0d2,_0x337660){if(!_[_0xb965('0xc')](_0x337660)&&_0xb965('0xd')===typeof _0x337660&&!_[_0xb965('0xe')](_0x337660)){if(!_[_0xb965('0xc')](_0x4ca0d2)&&_0xb965('0xd')===typeof _0x4ca0d2&&!_[_0xb965('0xe')](_0x4ca0d2)){return util[_0xb965('0xf')](_0xb965('0x10'),_0x4ca0d2,_0x337660);}return util[_0xb965('0xf')]('\x22%s\x22\x20<%s>',_0x337660,_0x337660);}if(!_['isUndefined'](_0x2c2813)&&'string'===typeof _0x2c2813&&!_[_0xb965('0xe')](_0x2c2813)){return _0x2c2813;}return _0xb965('0x11');};exports[_0xb965('0x12')]=function(_0x33294c){if(_[_0xb965('0x13')](_0x33294c)){return![];}return _0x33294c;};exports[_0xb965('0x14')]=function(_0x40ff36,_0x3b6738,_0x3c7753,_0x4f4ef4,_0x13e7ad,_0x11191b){var _0x1e1c68={'XMD-QUEUE':_0x3b6738[_0xb965('0x15')]?_0x3b6738[_0xb965('0x15')][_0xb965('0x16')]:'','XMD-CALLERID':_0x4f4ef4,'XMD-CALLERID-PREVIEW':_0x11191b?util[_0xb965('0xf')](_0xb965('0x10'),_0x11191b[_0xb965('0x17')],_0x11191b[_0xb965('0x18')]):_0x4f4ef4,'XMD-DIALID':_0x13e7ad,'XMD-CONTACTID':_0x3b6738[_0xb965('0x19')],'XMD-CDRTYPE':_0xb965('0x1a'),'CALLERID(all)':_0x4f4ef4,'XMD-VOICEQUEUEID':_0x3b6738['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3c7753,'XMD-DIALTIMEOUT':_0x40ff36[_0xb965('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xb965('0xf')]('\x22rtTxX%s%s\x22',_0x40ff36['dialQueueProject2']?'g':'',_['isEmpty'](_0x40ff36[_0xb965('0x1c')])?'':_0xb965('0x1d')),'XMD-DIALURL':_0x40ff36[_0xb965('0x1e')]||'','XMD-AGI':_0x40ff36['dialQueueProject']?util[_0xb965('0xf')](_0xb965('0x1f'),ipAgi,_0x40ff36[_0xb965('0x20')]):_0xb965('0x21'),'XMD-AGIAFTER':_0x40ff36[_0xb965('0x22')]?util[_0xb965('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x40ff36['dialQueueProject2']):_0xb965('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x11191b?_0x11191b[_0xb965('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x11191b?_0x11191b[_0xb965('0x24')]:'','XMD-DESTINATION':_0xb965('0x25'),'SIPADDHEADER':_0xb965('0x26')};if(!_[_0xb965('0xe')](_0x40ff36['monitor_format'])){_0x1e1c68[util[_0xb965('0xf')]('%s',_0xb965('0x27'))]=_0x40ff36[_0xb965('0x1c')];_0x1e1c68[util[_0xb965('0xf')]('%s',_0xb965('0x28'))]=_0x13e7ad;}return _0x1e1c68;};exports[_0xb965('0x29')]=function(_0x1c731c){var _0x10ee54={};for(var _0x3eba09 in _0x1c731c){if(_0x1c731c[_0xb965('0x2a')](_0x3eba09)){_0x10ee54[util[_0xb965('0xf')]('%s',_[_0xb965('0x2b')](_0x3eba09))]=_0x1c731c[_0x3eba09];}}return{'variables':_0x10ee54};};exports[_0xb965('0x2c')]=function(_0x3d3205,_0x5b636d){if(!_['isNil'](_0x3d3205)){if(_0x3d3205[_0xb965('0x2a')](_0xb965('0x2d'))){if(_0x3d3205[_0xb965('0x2d')]>0x0){_0x3d3205[_0xb965('0x2d')]-=0x1;}else{logger['error'](_0xb965('0x2e'),_0x5b636d);}}}else{logger[_0xb965('0x8')](_0xb965('0x2f'),_0x5b636d);}};exports[_0xb965('0x30')]=function(_0x57a5d5){var _0x690956=moment()[_0xb965('0xf')](_0xb965('0x31'));_0x57a5d5[_0xb965('0x32')]=0xd;_0x57a5d5['statedesc']='Blacklist';_0x57a5d5['starttime']=_0x690956;_0x57a5d5[_0xb965('0x33')]=_0x690956;_0x57a5d5[_0xb965('0x34')]=_0x690956;};exports[_0xb965('0x35')]=function(_0x47824f,_0x48afb4,_0x317877){var _0x2cc581=moment()[_0xb965('0xf')](_0xb965('0x31'));_0x47824f['state']=_0x48afb4;_0x47824f['statedesc']=_0x317877;_0x47824f[_0xb965('0x33')]=_0x2cc581;_0x47824f[_0xb965('0x36')]=utils[_0xb965('0x37')](_0x47824f['responsetime'],_0x47824f[_0xb965('0x38')]);};exports['logLookAgent']=function(_0x2165ab,_0x41054f,_0x3f465a){_0x2165ab['membername']=_0x41054f;_0x2165ab[_0xb965('0x39')]=_0x3f465a;};exports[_0xb965('0x3a')]=function(_0x38c280,_0x39d35c,_0x3ab19f){var _0x366b57=moment()['format'](_0xb965('0x31'));_0x38c280[_0xb965('0x32')]=_0x39d35c;_0x38c280['statedesc']=_0x3ab19f;_0x38c280[_0xb965('0x33')]=_0x38c280[_0xb965('0x33')]?_0x38c280[_0xb965('0x33')]:_0x366b57;_0x38c280[_0xb965('0x34')]=_0x38c280[_0xb965('0x34')]?_0x38c280['endtime']:_0x366b57;_0x38c280[_0xb965('0x36')]=utils[_0xb965('0x37')](_0x38c280[_0xb965('0x33')]||0x0,_0x38c280[_0xb965('0x38')]||0x0);_0x38c280[_0xb965('0x3b')]=_0x38c280[_0xb965('0x3c')]?utils['getSeconds'](_0x38c280[_0xb965('0x34')],_0x38c280[_0xb965('0x3c')]):0x0;};exports[_0xb965('0x3d')]=function(_0x5eb4ba){return _0x5eb4ba===_0xb965('0x3e');};exports['variablesAction']=function(_0x1d86c1,_0x513cfd,_0x2b3b5b,_0x562753,_0x4bcc07){var _0x6999c5=_0x562753?_0xb965('0x3f'):_0x1d86c1[_0xb965('0x17')];_0x6999c5=_0x4bcc07?_0xb965('0x40'):_0x6999c5;return{'actionid':_0x1d86c1[_0xb965('0x41')],'action':_0xb965('0x42'),'channel':_0x1d86c1[_0xb965('0x43')],'callerid':util[_0xb965('0xf')](_0xb965('0x10'),_0x6999c5,_0x1d86c1[_0xb965('0x18')]),'Exten':'xcally-motion-preview','Context':_0xb965('0x44'),'Priority':'1','variable':_0x2b3b5b,'timeout':(_0x513cfd[_0xb965('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1d86c1[_0xb965('0x41')]};};exports[_0xb965('0x46')]=function(_0x2dccec){return _0x2dccec['countbusyretry']+_0x2dccec[_0xb965('0x47')]+_0x2dccec[_0xb965('0x48')]+_0x2dccec[_0xb965('0x49')]+_0x2dccec[_0xb965('0x4a')];};exports[_0xb965('0x4b')]=function(_0x1e9830){var _0x46fe92=_['clone'](_0x1e9830);_0x46fe92[_0xb965('0x32')]=0xf;_0x46fe92[_0xb965('0x4c')]='Global';return _0x46fe92;};exports[_0xb965('0x4d')]=function(_0x10115a,_0x288b2e,_0x4230b8){var _0xd203ed={};_0xd203ed[_0x288b2e]=_0x10115a[_0x288b2e];_0xd203ed['active']=![];_0xd203ed[_0xb965('0x4e')]=moment()[_0xb965('0x4f')](_0x4230b8,'minutes')[_0xb965('0xf')](_0xb965('0x31'));_0xd203ed[_0xb965('0x19')]=_0x10115a[_0xb965('0x19')];_0xd203ed[_0xb965('0x50')]=_0x10115a[_0xb965('0x50')];_0xd203ed[_0xb965('0x51')]=_0x10115a['VoiceQueueId']||undefined;return _0xd203ed;};exports[_0xb965('0x52')]=function(_0xf63315,_0x3ebe9a){if(!_[_0xb965('0x13')](_0xf63315)){if(_0xf63315[_0xb965('0x53')]>0x0){_0xf63315['pTalking']-=0x1;}else{logger[_0xb965('0x8')](_0x3ebe9a,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xb965('0x8')](_0x3ebe9a,_0xb965('0x54'));}};exports[_0xb965('0x55')]=function(_0x282cb6){if(_0x282cb6<=0x0){return!![];}return![];};function buildObj(_0x659441,_0x349479,_0x32144a){_0x659441[_0xb965('0x56')]=_0x349479;_0x659441[_0xb965('0x16')]=_0x659441[_0xb965('0x57')];_0x659441[_0xb965('0x58')]=_0x659441[_0xb965('0x43')];_0x659441['motionChannel']=_0xb965('0x59');if(_0x32144a){_0x659441[_0xb965('0x5a')]=_0x32144a['mandatoryDisposition'];}return _0x659441;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x3244e9){var _0x3ffc3a={};_0x3ffc3a['queue']=_0x3244e9[_0xb965('0x57')];_0x3ffc3a[_0xb965('0x58')]=_0x3244e9[_0xb965('0x43')];_0x3ffc3a[_0xb965('0x41')]=_0x3244e9[_0xb965('0x41')];return _0x3ffc3a;};exports[_0xb965('0x5b')]=function(_0x700fa2){var _0x1b1706=[];for(var _0x477c61 in _0x700fa2){if(_0x700fa2['hasOwnProperty'](_0x477c61)){if(!_['isNil'](_0x700fa2[_0x477c61])&&_0x700fa2[_0x477c61]['state']===_0xb965('0x5c')&&_0x700fa2[_0x477c61][_0xb965('0x5d')]==='reachable'){_0x1b1706[_0xb965('0x5e')](_0x700fa2[_0x477c61]['id']);}}}return _0x1b1706;};exports[_0xb965('0x5f')]=function(_0x3db7a2){var _0x3bafa3=moment()[_0xb965('0x60')](0x0);var _0x35b5d4=moment(_0x3db7a2)[_0xb965('0x60')](0x0);return _0x3bafa3['diff'](_0x35b5d4,_0xb965('0x61'));};exports[_0xb965('0x62')]=function(_0x3b73a3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3b73a3[_0xb965('0x19')],'ListId':_0x3b73a3[_0xb965('0x50')],'VoiceQueueId':_0x3b73a3[_0xb965('0x51')]||undefined,'CampaignId':_0x3b73a3[_0xb965('0x63')]||undefined};};exports[_0xb965('0x64')]=function(_0x1c51bc){if(_0x1c51bc==='uniqueid'||_0x1c51bc==='idContact'||_0x1c51bc===_0xb965('0x57')||_0x1c51bc==='type'||_0x1c51bc===_0xb965('0x65')||_0x1c51bc===_0xb965('0x66')||_0x1c51bc===_0xb965('0x67')||_0x1c51bc==='channelAgent'||_0x1c51bc===_0xb965('0x17')||_0x1c51bc==='active'||_0x1c51bc===_0xb965('0x18')||_0x1c51bc===_0xb965('0x4e')||_0x1c51bc===_0xb965('0x68')||_0x1c51bc===_0xb965('0x47')||_0x1c51bc==='countnoanswerretry'||_0x1c51bc===_0xb965('0x69')||_0x1c51bc==='callback'||_0x1c51bc==='callbackuniqueid'||_0x1c51bc===_0xb965('0x6a')||_0x1c51bc===_0xb965('0x6b')||_0x1c51bc===_0xb965('0x19')||_0x1c51bc==='ListId'||_0x1c51bc==='UserId'||_0x1c51bc===_0xb965('0x51')||_0x1c51bc==='sipcallid'||_0x1c51bc===_0xb965('0x6c')||_0x1c51bc==='xmd-queue'||_0x1c51bc===_0xb965('0x6d')||_0x1c51bc===_0xb965('0x6e')||_0x1c51bc==='xmd-dialurl'||_0x1c51bc===_0xb965('0x6f')||_0x1c51bc===_0xb965('0x70')||_0x1c51bc===_0xb965('0x71')||_0x1c51bc===_0xb965('0x72')||_0x1c51bc===_0xb965('0x73')||_0x1c51bc==='xmd-cdrtype'||_0x1c51bc===_0xb965('0x74')||_0x1c51bc===_0xb965('0x75')||_0x1c51bc===_0xb965('0x76')||_0x1c51bc===_0xb965('0x77')||_0x1c51bc==='rtpaudioqosbridged'||_0x1c51bc===_0xb965('0x78')||_0x1c51bc===_0xb965('0x79')||_0x1c51bc===_0xb965('0x7a')||_0x1c51bc==='rtpaudioqoslossbridged'||_0x1c51bc===_0xb965('0x7b')||_0x1c51bc===_0xb965('0x7c')||_0x1c51bc===_0xb965('0x77')||_0x1c51bc===_0xb965('0x7d')||_0x1c51bc===_0xb965('0x78')||_0x1c51bc===_0xb965('0x79')||_0x1c51bc===_0xb965('0x7a')||_0x1c51bc===_0xb965('0x7e')||_0x1c51bc===_0xb965('0x7b')||_0x1c51bc==='rtpaudioqosrttbridged'||_0x1c51bc===_0xb965('0x7f')||_0x1c51bc==='bridgepvtcallid'||_0x1c51bc===_0xb965('0x32')||_0x1c51bc==='statedesc'){return![];}return!![];};exports[_0xb965('0x80')]=function(_0x16ff8b,_0xaeb97){var _0x4f0ff5,_0x312514,_0x1e925c;if(_0xaeb97<=0x0){_0xaeb97=0x1;}_0x4f0ff5=new RegExp(_0xb965('0x81')+_0xaeb97+'}$');_0x312514=Math[_0xb965('0x82')](0xa,_0xaeb97-0x1);_0x1e925c=Math[_0xb965('0x82')](0xa,_0xaeb97)-0x1;return util[_0xb965('0xf')]('%s',_[_0xb965('0x83')](_0x16ff8b,_0x4f0ff5,_[_0xb965('0x84')](_0x312514,_0x1e925c)));};exports[_0xb965('0x85')]=function(_0x2c4677){var _0x1aa0ac=_0x2c4677[_0xb965('0x86')](/"(.*?)"/);return _0x1aa0ac?_0x1aa0ac[0x1]:_0x2c4677;};exports[_0xb965('0x87')]=function(_0x1a4e2e){var _0x1746a5=_0x1a4e2e[_0xb965('0x86')](/<(.*?)>/);return _0x1746a5?_0x1746a5[0x1]:_0x1a4e2e;};function buildNoAnswerEventPayload(_0x3caba7,_0x5811fe){var _0x479e55=buildObj(_0x3caba7,_0xb965('0x88'));if(!_[_0xb965('0xe')](_0x5811fe['variables'])){Object['keys'](_0x5811fe[_0xb965('0x89')])[_0xb965('0x8a')](function(_0x2abcb9){_0x479e55[_0x2abcb9[_0xb965('0x8b')]()]=_0x5811fe[_0xb965('0x89')][_0x2abcb9];});}return _0x479e55;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x444e=['forEach','toLowerCase','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','inspect','loggerError','logger2','info','message','getCallerId','string','isUndefined','isEmpty','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLower','updateOriginated','hasOwnProperty','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','noanswer','variables','keys'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x444e,0x1a0));var _0xe444=function(_0x3e8eaf,_0x1a7c57){_0x3e8eaf=_0x3e8eaf-0x0;var _0x6b76e6=_0x444e[_0x3e8eaf];return _0x6b76e6;};'use strict';var util=require('util');var _=require(_0xe444('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xe444('0x1'));var ipAgi=process[_0xe444('0x2')][_0xe444('0x3')]||_0xe444('0x4');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0xbeb51b){return function(_0x553294){logger['error'](_0xbeb51b,util[_0xe444('0x5')](_0x553294,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x132717,_0x527e9a){logger['info'](_0x132717,util[_0xe444('0x5')](_0x527e9a,{'showHidden':![],'depth':null}));};exports[_0xe444('0x6')]=function(_0xa2578a,_0x54c3f5){logger['error'](_0xa2578a,util[_0xe444('0x5')](_0x54c3f5,{'showHidden':![],'depth':null}));};exports[_0xe444('0x7')]=function(_0x141601){return function(_0x5349dd){logger[_0xe444('0x8')](_0x141601,util[_0xe444('0x5')](_0x5349dd,{'showHidden':![],'depth':null}));};};exports[_0xe444('0x9')]=function(_0x3b710d,_0x122ab4,_0x57fe8b){return{'message':_0x3b710d,'unlock':_0x122ab4,'active':_0x57fe8b};};exports[_0xe444('0xa')]=function(_0x5b4d55,_0x3f5dad,_0x420726){if(!_['isUndefined'](_0x420726)&&_0xe444('0xb')===typeof _0x420726&&!_['isEmpty'](_0x420726)){if(!_[_0xe444('0xc')](_0x3f5dad)&&_0xe444('0xb')===typeof _0x3f5dad&&!_[_0xe444('0xd')](_0x3f5dad)){return util['format']('\x22%s\x22\x20<%s>',_0x3f5dad,_0x420726);}return util[_0xe444('0xe')]('\x22%s\x22\x20<%s>',_0x420726,_0x420726);}if(!_[_0xe444('0xc')](_0x5b4d55)&&_0xe444('0xb')===typeof _0x5b4d55&&!_[_0xe444('0xd')](_0x5b4d55)){return _0x5b4d55;}return _0xe444('0xf');};exports[_0xe444('0x10')]=function(_0x5e9d98){if(_[_0xe444('0x11')](_0x5e9d98)){return![];}return _0x5e9d98;};exports[_0xe444('0x12')]=function(_0x2a2365,_0x234f75,_0x27057f,_0x2a7d40,_0x2a5d11,_0x32edd1){var _0x356152={'XMD-QUEUE':_0x234f75[_0xe444('0x13')]?_0x234f75[_0xe444('0x13')][_0xe444('0x14')]:'','XMD-CALLERID':_0x2a7d40,'XMD-CALLERID-PREVIEW':_0x32edd1?util[_0xe444('0xe')](_0xe444('0x15'),_0x32edd1[_0xe444('0x16')],_0x32edd1[_0xe444('0x17')]):_0x2a7d40,'XMD-DIALID':_0x2a5d11,'XMD-CONTACTID':_0x234f75['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2a7d40,'XMD-VOICEQUEUEID':_0x234f75[_0xe444('0x18')],'XMD-DIALCHANNEL':_0x27057f,'XMD-DIALTIMEOUT':_0x2a2365[_0xe444('0x19')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x2a2365[_0xe444('0x1a')]?'g':'',_['isEmpty'](_0x2a2365[_0xe444('0x1b')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2a2365[_0xe444('0x1c')]||'','XMD-AGI':_0x2a2365[_0xe444('0x1d')]?util[_0xe444('0xe')](_0xe444('0x1e'),ipAgi,_0x2a2365[_0xe444('0x1d')]):_0xe444('0x1f'),'XMD-AGIAFTER':_0x2a2365[_0xe444('0x1a')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2a2365[_0xe444('0x1a')]):_0xe444('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x32edd1?_0x32edd1[_0xe444('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x32edd1?_0x32edd1[_0xe444('0x21')]:'','XMD-DESTINATION':_0xe444('0x22'),'SIPADDHEADER':_0xe444('0x23')};if(!_[_0xe444('0xd')](_0x2a2365[_0xe444('0x1b')])){_0x356152[util[_0xe444('0xe')]('%s',_0xe444('0x24'))]=_0x2a2365[_0xe444('0x1b')];_0x356152[util[_0xe444('0xe')]('%s',_0xe444('0x25'))]=_0x2a5d11;}return _0x356152;};exports['toLowerVariables']=function(_0x125cba){var _0x1d01ec={};for(var _0x116620 in _0x125cba){if(_0x125cba['hasOwnProperty'](_0x116620)){_0x1d01ec[util[_0xe444('0xe')]('%s',_[_0xe444('0x26')](_0x116620))]=_0x125cba[_0x116620];}}return{'variables':_0x1d01ec};};exports[_0xe444('0x27')]=function(_0x4bb762,_0x4213d1){if(!_[_0xe444('0x11')](_0x4bb762)){if(_0x4bb762[_0xe444('0x28')]('originated')){if(_0x4bb762[_0xe444('0x29')]>0x0){_0x4bb762[_0xe444('0x29')]-=0x1;}else{logger[_0xe444('0x2a')](_0xe444('0x2b'),_0x4213d1);}}}else{logger[_0xe444('0x2a')](_0xe444('0x2c'),_0x4213d1);}};exports[_0xe444('0x2d')]=function(_0x122cf){var _0x571bce=moment()['format'](_0xe444('0x2e'));_0x122cf[_0xe444('0x2f')]=0xd;_0x122cf[_0xe444('0x30')]=_0xe444('0x31');_0x122cf[_0xe444('0x32')]=_0x571bce;_0x122cf[_0xe444('0x33')]=_0x571bce;_0x122cf['endtime']=_0x571bce;};exports['logAgent']=function(_0x5c9f0e,_0x19bb34,_0x328b51){var _0x10f053=moment()[_0xe444('0xe')](_0xe444('0x2e'));_0x5c9f0e[_0xe444('0x2f')]=_0x19bb34;_0x5c9f0e[_0xe444('0x30')]=_0x328b51;_0x5c9f0e[_0xe444('0x33')]=_0x10f053;_0x5c9f0e[_0xe444('0x34')]=utils[_0xe444('0x35')](_0x5c9f0e[_0xe444('0x33')],_0x5c9f0e[_0xe444('0x32')]);};exports[_0xe444('0x36')]=function(_0x3e6420,_0x59e9aa,_0x1a13ab){_0x3e6420[_0xe444('0x37')]=_0x59e9aa;_0x3e6420[_0xe444('0x38')]=_0x1a13ab;};exports[_0xe444('0x39')]=function(_0x661284,_0x41e68c,_0x5652c1){var _0x46c9d4=moment()[_0xe444('0xe')](_0xe444('0x2e'));_0x661284['state']=_0x41e68c;_0x661284['statedesc']=_0x5652c1;_0x661284[_0xe444('0x33')]=_0x661284[_0xe444('0x33')]?_0x661284['responsetime']:_0x46c9d4;_0x661284[_0xe444('0x3a')]=_0x661284[_0xe444('0x3a')]?_0x661284[_0xe444('0x3a')]:_0x46c9d4;_0x661284['ringtime']=utils['getSeconds'](_0x661284['responsetime']||0x0,_0x661284[_0xe444('0x32')]||0x0);_0x661284[_0xe444('0x3b')]=_0x661284[_0xe444('0x3c')]?utils[_0xe444('0x35')](_0x661284[_0xe444('0x3a')],_0x661284[_0xe444('0x3c')]):0x0;};exports[_0xe444('0x3d')]=function(_0x5dcdb7){return _0x5dcdb7===_0xe444('0x3e');};exports[_0xe444('0x3f')]=function(_0x11679e,_0x26ba25,_0x4a063f,_0xb72504,_0x10951b){var _0x150ee6=_0xb72504?'RECALL':_0x11679e['calleridname'];_0x150ee6=_0x10951b?_0xe444('0x40'):_0x150ee6;return{'actionid':_0x11679e[_0xe444('0x41')],'action':_0xe444('0x42'),'channel':_0x11679e[_0xe444('0x43')],'callerid':util[_0xe444('0xe')](_0xe444('0x15'),_0x150ee6,_0x11679e[_0xe444('0x17')]),'Exten':_0xe444('0x22'),'Context':_0xe444('0x44'),'Priority':'1','variable':_0x4a063f,'timeout':(_0x26ba25[_0xe444('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x11679e[_0xe444('0x41')]};};exports['totalGlobal']=function(_0x506c1d){return _0x506c1d[_0xe444('0x46')]+_0x506c1d[_0xe444('0x47')]+_0x506c1d['countnoanswerretry']+_0x506c1d[_0xe444('0x48')]+_0x506c1d[_0xe444('0x49')];};exports[_0xe444('0x4a')]=function(_0x4dfb89){var _0x114902=_[_0xe444('0x4b')](_0x4dfb89);_0x114902[_0xe444('0x2f')]=0xf;_0x114902['statedesc']='Global';return _0x114902;};exports[_0xe444('0x4c')]=function(_0x4f0379,_0x537809,_0x4c0559){var _0x4f1fe2={};_0x4f1fe2[_0x537809]=_0x4f0379[_0x537809];_0x4f1fe2[_0xe444('0x4d')]=![];_0x4f1fe2[_0xe444('0x4e')]=moment()['add'](_0x4c0559,_0xe444('0x4f'))[_0xe444('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f1fe2[_0xe444('0x50')]=_0x4f0379[_0xe444('0x50')];_0x4f1fe2[_0xe444('0x51')]=_0x4f0379[_0xe444('0x51')];_0x4f1fe2[_0xe444('0x18')]=_0x4f0379[_0xe444('0x18')]||undefined;return _0x4f1fe2;};exports['decrementTalkink']=function(_0x59ed95,_0x170070){if(!_[_0xe444('0x11')](_0x59ed95)){if(_0x59ed95[_0xe444('0x52')]>0x0){_0x59ed95[_0xe444('0x52')]-=0x1;}else{logger[_0xe444('0x2a')](_0x170070,_0xe444('0x53'));}}else{logger['error'](_0x170070,_0xe444('0x54'));}};exports['IsNotLoggedIn']=function(_0x1857a8){if(_0x1857a8<=0x0){return!![];}return![];};function buildObj(_0x2e416e,_0x249f80,_0x144ab4){_0x2e416e[_0xe444('0x55')]=_0x249f80;_0x2e416e[_0xe444('0x14')]=_0x2e416e[_0xe444('0x56')];_0x2e416e['interface']=_0x2e416e[_0xe444('0x43')];_0x2e416e[_0xe444('0x57')]=_0xe444('0x58');if(_0x144ab4){_0x2e416e[_0xe444('0x59')]=_0x144ab4[_0xe444('0x59')];}return _0x2e416e;}exports[_0xe444('0x5a')]=buildObj;exports['buildAcw']=function(_0x447f7a){var _0x8f64ae={};_0x8f64ae[_0xe444('0x56')]=_0x447f7a[_0xe444('0x56')];_0x8f64ae['interface']=_0x447f7a[_0xe444('0x43')];_0x8f64ae[_0xe444('0x41')]=_0x447f7a['uniqueid'];return _0x8f64ae;};exports[_0xe444('0x5b')]=function(_0x2acdac){var _0xc02849=[];for(var _0x248aaf in _0x2acdac){if(_0x2acdac[_0xe444('0x28')](_0x248aaf)){if(!_[_0xe444('0x11')](_0x2acdac[_0x248aaf])&&_0x2acdac[_0x248aaf]['state']===_0xe444('0x5c')&&_0x2acdac[_0x248aaf][_0xe444('0x5d')]==='reachable'){_0xc02849['push'](_0x2acdac[_0x248aaf]['id']);}}}return _0xc02849;};exports['getDiff']=function(_0x8acfb5){var _0x1360df=moment()[_0xe444('0x5e')](0x0);var _0x146c2d=moment(_0x8acfb5)[_0xe444('0x5e')](0x0);return _0x1360df[_0xe444('0x5f')](_0x146c2d,_0xe444('0x60'));};exports[_0xe444('0x61')]=function(_0x515388){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x515388['ContactId'],'ListId':_0x515388[_0xe444('0x51')],'VoiceQueueId':_0x515388['VoiceQueueId']||undefined,'CampaignId':_0x515388[_0xe444('0x62')]||undefined};};exports[_0xe444('0x63')]=function(_0x56a6cf){if(_0x56a6cf===_0xe444('0x41')||_0x56a6cf==='idContact'||_0x56a6cf===_0xe444('0x56')||_0x56a6cf===_0xe444('0x64')||_0x56a6cf===_0xe444('0x65')||_0x56a6cf==='dialAnswer'||_0x56a6cf==='membername'||_0x56a6cf===_0xe444('0x43')||_0x56a6cf===_0xe444('0x16')||_0x56a6cf===_0xe444('0x4d')||_0x56a6cf===_0xe444('0x17')||_0x56a6cf==='scheduledat'||_0x56a6cf===_0xe444('0x46')||_0x56a6cf===_0xe444('0x47')||_0x56a6cf==='countnoanswerretry'||_0x56a6cf===_0xe444('0x66')||_0x56a6cf===_0xe444('0x67')||_0x56a6cf===_0xe444('0x68')||_0x56a6cf===_0xe444('0x69')||_0x56a6cf===_0xe444('0x6a')||_0x56a6cf===_0xe444('0x50')||_0x56a6cf===_0xe444('0x51')||_0x56a6cf===_0xe444('0x38')||_0x56a6cf==='VoiceQueueId'||_0x56a6cf===_0xe444('0x6b')||_0x56a6cf===_0xe444('0x6c')||_0x56a6cf==='xmd-queue'||_0x56a6cf==='xmd-phone'||_0x56a6cf===_0xe444('0x6d')||_0x56a6cf==='xmd-dialurl'||_0x56a6cf==='xmd-dialtimeout'||_0x56a6cf===_0xe444('0x6e')||_0x56a6cf===_0xe444('0x6f')||_0x56a6cf===_0xe444('0x70')||_0x56a6cf===_0xe444('0x71')||_0x56a6cf===_0xe444('0x72')||_0x56a6cf===_0xe444('0x73')||_0x56a6cf===_0xe444('0x74')||_0x56a6cf==='xmd-agi'||_0x56a6cf===_0xe444('0x75')||_0x56a6cf==='rtpaudioqosbridged'||_0x56a6cf===_0xe444('0x76')||_0x56a6cf===_0xe444('0x77')||_0x56a6cf===_0xe444('0x78')||_0x56a6cf==='rtpaudioqoslossbridged'||_0x56a6cf===_0xe444('0x79')||_0x56a6cf===_0xe444('0x7a')||_0x56a6cf===_0xe444('0x75')||_0x56a6cf===_0xe444('0x7b')||_0x56a6cf===_0xe444('0x76')||_0x56a6cf===_0xe444('0x77')||_0x56a6cf===_0xe444('0x78')||_0x56a6cf===_0xe444('0x7c')||_0x56a6cf==='rtpaudioqosrtt'||_0x56a6cf===_0xe444('0x7a')||_0x56a6cf===_0xe444('0x7d')||_0x56a6cf===_0xe444('0x7e')||_0x56a6cf===_0xe444('0x2f')||_0x56a6cf===_0xe444('0x30')){return![];}return!![];};exports[_0xe444('0x7f')]=function(_0x46c627,_0x54ad1c){var _0x3b1019,_0x1cb252,_0x10367d;if(_0x54ad1c<=0x0){_0x54ad1c=0x1;}_0x3b1019=new RegExp('\x5cw{0,'+_0x54ad1c+'}$');_0x1cb252=Math[_0xe444('0x80')](0xa,_0x54ad1c-0x1);_0x10367d=Math[_0xe444('0x80')](0xa,_0x54ad1c)-0x1;return util[_0xe444('0xe')]('%s',_[_0xe444('0x81')](_0x46c627,_0x3b1019,_[_0xe444('0x82')](_0x1cb252,_0x10367d)));};exports[_0xe444('0x83')]=function(_0x190dc9){var _0x5c0500=_0x190dc9[_0xe444('0x84')](/"(.*?)"/);return _0x5c0500?_0x5c0500[0x1]:_0x190dc9;};exports['extractCalleridNumber']=function(_0x409e33){var _0x2cb62c=_0x409e33[_0xe444('0x84')](/<(.*?)>/);return _0x2cb62c?_0x2cb62c[0x1]:_0x409e33;};function buildNoAnswerEventPayload(_0x37de49,_0x23a2a7){var _0x844300=buildObj(_0x37de49,_0xe444('0x85'));if(!_[_0xe444('0xd')](_0x23a2a7[_0xe444('0x86')])){Object[_0xe444('0x87')](_0x23a2a7['variables'])[_0xe444('0x88')](function(_0x4edf84){_0x844300[_0x4edf84[_0xe444('0x89')]()]=_0x23a2a7[_0xe444('0x86')][_0x4edf84];});}return _0x844300;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2b521cf..d9313f0 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 _0x1a92=['voicequeuechannelhangup','queueadd','string','number','boolean','voicequeuechannel','voicechannel'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1a92,0x1f2));var _0x21a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a92[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0x21a9('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x21a9('0x1'),'required':!![]},'penalty':{'type':_0x21a9('0x2'),'required':![]},'paused':{'type':_0x21a9('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x21a9('0x1'),'required':!![]},'interface':{'type':_0x21a9('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x21a9('0x1'),'required':!![]},'paused':{'type':_0x21a9('0x3')},'reason':{'type':_0x21a9('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x21a9('0x4')]={'uniqueid':{'type':_0x21a9('0x1'),'required':!![]}};exports[_0x21a9('0x5')]={'uniqueid':{'type':_0x21a9('0x1'),'required':!![]},'filename':{'type':_0x21a9('0x1')},'format':{'type':_0x21a9('0x1')},'mixmonitorid':{'type':_0x21a9('0x1')}};exports[_0x21a9('0x6')]={'uniqueid':{'type':_0x21a9('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x21a9('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x36c9=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','boolean'];(function(_0x235a41,_0x4f4e5d){var _0x2a5977=function(_0x5c12e3){while(--_0x5c12e3){_0x235a41['push'](_0x235a41['shift']());}};_0x2a5977(++_0x4f4e5d);}(_0x36c9,0x1be));var _0x936c=function(_0x2d632b,_0x5ada10){_0x2d632b=_0x2d632b-0x0;var _0x3bd47a=_0x36c9[_0x2d632b];return _0x3bd47a;};'use strict';exports['queueadd']={'queue':{'type':_0x936c('0x0'),'required':!![]},'interface':{'type':_0x936c('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x936c('0x1'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x936c('0x0'),'required':!![]}};exports[_0x936c('0x2')]={'interface':{'type':_0x936c('0x0'),'required':!![]},'paused':{'type':_0x936c('0x1')},'reason':{'type':_0x936c('0x0'),'required':![]}};exports[_0x936c('0x3')]={'module':{'type':_0x936c('0x0'),'required':![]}};exports[_0x936c('0x4')]={'uniqueid':{'type':_0x936c('0x0'),'required':!![]}};exports[_0x936c('0x5')]={'uniqueid':{'type':_0x936c('0x0'),'required':!![]},'filename':{'type':_0x936c('0x0')},'format':{'type':_0x936c('0x0')},'mixmonitorid':{'type':'string'}};exports[_0x936c('0x6')]={'uniqueid':{'type':_0x936c('0x0'),'required':!![]}};exports[_0x936c('0x7')]={'uniqueid':{'type':_0x936c('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x936c('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8e7f795..6030284 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x0b0e[_0x2c0be1];return _0x3d4bd2;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0x0b0e[_0x137da3];return _0x1ac46c;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 0793aac..ea87f39 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4bb=['hasOwnProperty'];(function(_0x2619b1,_0x3ccef1){var _0x21b9df=function(_0x513b81){while(--_0x513b81){_0x2619b1['push'](_0x2619b1['shift']());}};_0x21b9df(++_0x3ccef1);}(_0xe4bb,0x185));var _0xbe4b=function(_0x33dd2d,_0x2954b6){_0x33dd2d=_0x33dd2d-0x0;var _0x496d37=_0xe4bb[_0x33dd2d];return _0x496d37;};'use strict';function mergeDBDataToRealtime(_0xd4c95a,_0x28668f){var _0x334fbd=Object['assign']({},_0xd4c95a);for(var _0x56d0f4 in _0x28668f){if(_0x334fbd[_0xbe4b('0x0')](_0x56d0f4)){_0x334fbd[_0x56d0f4]=_0x28668f[_0x56d0f4];}}return _0x334fbd;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x1c93=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x4bf1cc,_0x279292){var _0x5e9db6=function(_0x4536ef){while(--_0x4536ef){_0x4bf1cc['push'](_0x4bf1cc['shift']());}};_0x5e9db6(++_0x279292);}(_0x1c93,0xec));var _0x31c9=function(_0x2bedf3,_0x248a47){_0x2bedf3=_0x2bedf3-0x0;var _0x3cc140=_0x1c93[_0x2bedf3];return _0x3cc140;};'use strict';function mergeDBDataToRealtime(_0x220d57,_0x248440){var _0x5912f7=Object[_0x31c9('0x0')]({},_0x220d57);for(var _0xe95d85 in _0x248440){if(_0x5912f7[_0x31c9('0x1')](_0xe95d85)){_0x5912f7[_0xe95d85]=_0x248440[_0xe95d85];}}return _0x5912f7;}exports[_0x31c9('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 6c2cee5..4601cfd 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 _0xd0a6=['callerid','ANSWERED','connectedlinenum','calleridname','calleridnum','transfers','linkedid','uniqueid','UserId','getAgentByInternal','monitor','monitors','filename','createdAt','exten','connectedlinename','membername','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','assigned','interface','YYYY-MM-DD\x20HH:mm:ss','voiceQueueReport','create','keys','getCallType','split','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','xcally-motion-preview','calleridpreview','originatecalleridnum','channel','destinationchannel'];(function(_0x329b6b,_0x8b5e6e){var _0x366e3e=function(_0x271628){while(--_0x271628){_0x329b6b['push'](_0x329b6b['shift']());}};_0x366e3e(++_0x8b5e6e);}(_0xd0a6,0x123));var _0x6d0a=function(_0x377174,_0x49290f){_0x377174=_0x377174-0x0;var _0x165519=_0xd0a6[_0x377174];return _0x165519;};'use strict';var _=require(_0x6d0a('0x0'));var moment=require(_0x6d0a('0x1'));var util=require(_0x6d0a('0x2'));var config=require(_0x6d0a('0x3'));var ami=require(_0x6d0a('0x4'));var RpcVoiceAgentReport=require(_0x6d0a('0x5'));var RpcVoiceCallReport=require(_0x6d0a('0x6'));var RpcVoiceDialReport=require(_0x6d0a('0x7'));var RpcMemberReport=require(_0x6d0a('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x6d0a('0x9'));var RpcVoiceTransferReport=require(_0x6d0a('0xa'));var VoiceQueueReport=require(_0x6d0a('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x12aee8){this['realtime']=_0x12aee8;this['agents']=_0x12aee8[_0x6d0a('0xc')];this[_0x6d0a('0xd')]=_0x12aee8[_0x6d0a('0xd')];}Report[_0x6d0a('0xe')]['sync']=function(_0x1dcf75){var _0x2c763b=new VoiceQueueReport(this[_0x6d0a('0xf')]);var _0x47eeff=new VoiceAgentReport(this[_0x6d0a('0xf')]);var _0x2fa61b=new VoiceDialReport(this['realtime']);var _0x1ca1fe=new VoiceCallReport(this[_0x6d0a('0xf')]);var _0x2da0c=new UserReport(this['realtime']);if(config[_0x6d0a('0x10')]&&config[_0x6d0a('0x10')][_0x6d0a('0x11')]){ami['on'](_0x6d0a('0x12'),this['voiceQueueReport'][_0x6d0a('0x13')](this));ami['on'](_0x6d0a('0x14'),this[_0x6d0a('0x15')][_0x6d0a('0x13')](this));ami['on'](_0x6d0a('0x16'),this[_0x6d0a('0x17')][_0x6d0a('0x13')](this));ami['on'](_0x6d0a('0x18'),this[_0x6d0a('0x19')][_0x6d0a('0x13')](this));ami['on'](_0x6d0a('0x1a'),this[_0x6d0a('0x1b')][_0x6d0a('0x13')](this));ami['on'](_0x6d0a('0x1c'),this[_0x6d0a('0x1d')]['bind'](this));}};Report[_0x6d0a('0xe')][_0x6d0a('0x1e')]=function(_0x5cb9ec){var _0x1d42de;_0x1d42de=_[_0x6d0a('0x1f')](this['agents'],function(_0x359e97){return _0x359e97[_0x6d0a('0x20')]==_0x5cb9ec||_0x359e97[_0x6d0a('0x21')]==_0x5cb9ec;});if(_[_0x6d0a('0x22')](_0x1d42de)){var _0x25de6b=_[_0x6d0a('0x1f')](this[_0x6d0a('0xd')],function(_0x3590d1){return _0x3590d1['accountcode']==_0x5cb9ec||_0x3590d1[_0x6d0a('0x21')]==_0x5cb9ec;});if(_0x25de6b){_0x1d42de=_[_0x6d0a('0x1f')](this[_0x6d0a('0xc')],function(_0x4fef6e){return _0x4fef6e['interface']==util[_0x6d0a('0x23')](_0x6d0a('0x24'),_0x25de6b[_0x6d0a('0x21')]);});}}return _0x1d42de;};Report[_0x6d0a('0xe')]['voiceQueueReport']=function(_0x37dcb4){for(var _0xeac668=0x0;_0xeac668<_0x37dcb4[_0x6d0a('0x25')];_0xeac668+=0x1){var _0x40fa0d=this[_0x6d0a('0x1e')](_0x37dcb4[_0xeac668]['connectedlinenum']);if(_0x40fa0d){_0x37dcb4[_0xeac668][_0x6d0a('0x20')]=_0x40fa0d[_0x6d0a('0x20')];_0x37dcb4[_0xeac668][_0x6d0a('0x26')]=!![];_0x37dcb4[_0xeac668]['lastAssignedTo']=_0x40fa0d[_0x6d0a('0x21')];_0x37dcb4[_0xeac668]['interface']=_[_0x6d0a('0x22')](_0x40fa0d['interface'])?util[_0x6d0a('0x23')](_0x6d0a('0x24'),_0x40fa0d['name']):_0x40fa0d[_0x6d0a('0x27')];if(_0x37dcb4[_0xeac668]['queuecallercomplete']){_0x37dcb4[_0xeac668]['queuecallercompleteAt']=moment()['format'](_0x6d0a('0x28'));}if(_0x37dcb4[_0xeac668]['queuecallerexit']){_0x37dcb4[_0xeac668]['queuecallerexitAt']=moment()[_0x6d0a('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x6d0a('0x29')](_0x37dcb4[_0xeac668]);}RpcVoiceQueueReport[_0x6d0a('0x2a')](_0x37dcb4[_0xeac668]);}};function extractCalleridNumber(_0x3395c4){var _0x48904f=_0x3395c4['match'](/<(.*?)>/);return _0x48904f?_0x48904f[0x1]:_0x3395c4;}Report[_0x6d0a('0xe')]['getAgentByInternal']=function(_0x1ca995){for(var _0x9b7595=0x0;_0x9b7595',_0xed3baa[_0x6d0a('0x40')],_0xed3baa[_0x6d0a('0x41')]);}if(RpcVoiceTransferReport[_0x6d0a('0x42')][_0xed3baa[_0x6d0a('0x43')]]){var _0x1a85c3=RpcVoiceTransferReport[_0x6d0a('0x42')][_0xed3baa[_0x6d0a('0x43')]];_0x1a85c3['transfereelinkedid']=_0xed3baa[_0x6d0a('0x44')];RpcVoiceTransferReport[_0x6d0a('0x1b')](_0x1a85c3);delete RpcVoiceTransferReport[_0x6d0a('0x42')][_0xed3baa['linkedid']];}if(_[_0x6d0a('0x22')](_0xed3baa['type'])){_0xed3baa[_0x6d0a('0x31')]=this[_0x6d0a('0x2c')](_0xed3baa);}if(_[_0x6d0a('0x22')](_0xed3baa[_0x6d0a('0x45')])){var _0x11fdc3=_0xed3baa['channel'][_0x6d0a('0x2d')]('-')[0x0];var _0x280623=this[_0x6d0a('0xc')][_0x11fdc3];if(!_0x280623)_0x280623=this[_0x6d0a('0x46')](_0xed3baa[_0x6d0a('0x20')]);if(_0x280623){_0xed3baa[_0x6d0a('0x45')]=_0x280623['id'];_0xed3baa['membername']=_0x280623[_0x6d0a('0x21')];}}RpcVoiceCallReport[_0x6d0a('0x2a')](_0xed3baa);if(_0xed3baa[_0x6d0a('0x47')]){for(var _0x5a4492=0x0;_0x5a4492<_0xed3baa['monitors'][_0x6d0a('0x25')];_0x5a4492+=0x1){_0xed3baa['monitorFilename']=_0xed3baa[_0x6d0a('0x48')][_0x5a4492][_0x6d0a('0x49')];_0xed3baa[_0x6d0a('0x4a')]=_0xed3baa[_0x6d0a('0x48')][_0x5a4492][_0x6d0a('0x4a')];if(_0xed3baa[_0x6d0a('0x4b')]==_0x6d0a('0x38')){_0xed3baa[_0x6d0a('0x41')]=_0xed3baa[_0x6d0a('0x3f')];_0xed3baa[_0x6d0a('0x40')]=_0xed3baa[_0x6d0a('0x4c')];_0xed3baa['connectedlinenum']=_0xed3baa['accountcode'];_0xed3baa[_0x6d0a('0x4c')]=_0xed3baa[_0x6d0a('0x4d')];_0xed3baa[_0x6d0a('0x4b')]=_0xed3baa[_0x6d0a('0x3a')];}else if(_0xed3baa[_0x6d0a('0x4b')]=='xcally-motion-dialer'){_0xed3baa[_0x6d0a('0x41')]=_0xed3baa[_0x6d0a('0x30')];_0xed3baa[_0x6d0a('0x4b')]=_0xed3baa['originatecalleridnum'];}RpcVoiceRecording[_0x6d0a('0x2a')](_0xed3baa);}}};Report[_0x6d0a('0xe')][_0x6d0a('0x17')]=function(_0x4efc0c){if(_[_0x6d0a('0x4e')](_0x4efc0c)){_0x4efc0c[_0x6d0a('0x4f')](function(_0x4b7b75){RpcVoiceAgentReport[_0x6d0a('0x2a')](_0x4b7b75);});}else{RpcVoiceAgentReport[_0x6d0a('0x2a')](_0x4efc0c);}};Report[_0x6d0a('0xe')][_0x6d0a('0x19')]=function(_0x5f8c70){RpcVoiceDialReport['create'](_0x5f8c70);var _0x48c78c;var _0x16f42f;var _0x10d16d=_0x5f8c70['channel'];if(_[_0x6d0a('0x50')](_0x10d16d,_0x6d0a('0x51'))){_0x16f42f=_0x10d16d[_0x6d0a('0x52')](_0x10d16d[_0x6d0a('0x53')]('/')+0x1,_0x10d16d['indexOf']('@'));_0x48c78c=_[_0x6d0a('0x1f')](this[_0x6d0a('0xc')],function(_0x50af7c){return _0x50af7c[_0x6d0a('0x54')]==_0x16f42f||_0x50af7c[_0x6d0a('0x55')]==_0x16f42f||_0x50af7c[_0x6d0a('0x20')]==_0x16f42f;});}else{_0x16f42f=_0x10d16d['substring'](_0x10d16d['indexOf']('/')+0x1,_0x10d16d[_0x6d0a('0x56')]('-'));_0x48c78c=this['findAgent'](_0x16f42f);}if(_0x48c78c){_0x5f8c70[_0x6d0a('0x27')]=_[_0x6d0a('0x22')](_0x48c78c[_0x6d0a('0x27')])?util[_0x6d0a('0x23')](_0x6d0a('0x24'),_0x48c78c[_0x6d0a('0x21')]):_0x48c78c[_0x6d0a('0x27')];_0x5f8c70['membername']=_0x48c78c[_0x6d0a('0x21')];_0x5f8c70[_0x6d0a('0x20')]=_0x48c78c[_0x6d0a('0x20')];RpcMemberReport[_0x6d0a('0x19')](_0x5f8c70);}};Report[_0x6d0a('0xe')][_0x6d0a('0x1b')]=function(_0x58d974){RpcVoiceTransferReport[_0x6d0a('0x42')][_0x58d974[_0x6d0a('0x57')]]=_0x58d974;};Report['prototype'][_0x6d0a('0x1d')]=function(_0x41b8b7){RpcVoiceTransferReport[_0x6d0a('0x1d')](_0x41b8b7);};module['exports']=Report; \ No newline at end of file +var _0xa8ff=['originatecalleridnum','destinationchannel','disposition','ANSWERED','calleridname','transfers','linkedid','uniqueid','monitor','filename','createdAt','connectedlinename','membername','isArray','forEach','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','util','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','format','connectedlinenum','assigned','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','length','getCallType','channel','split','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum'];(function(_0x3bfbe9,_0x52821c){var _0x447485=function(_0x292d03){while(--_0x292d03){_0x3bfbe9['push'](_0x3bfbe9['shift']());}};_0x447485(++_0x52821c);}(_0xa8ff,0x11f));var _0xfa8f=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xa8ff[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xfa8f('0x0'));var moment=require('moment');var util=require(_0xfa8f('0x1'));var config=require('../../../config/environment');var ami=require(_0xfa8f('0x2'));var RpcVoiceAgentReport=require(_0xfa8f('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xfa8f('0x4'));var RpcMemberReport=require(_0xfa8f('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xfa8f('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xfa8f('0x7'));var VoiceCallReport=require(_0xfa8f('0x8'));var VoiceAgentReport=require(_0xfa8f('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xfa8f('0xa'));function Report(_0x208c21){this[_0xfa8f('0xb')]=_0x208c21;this['agents']=_0x208c21[_0xfa8f('0xc')];this['telephones']=_0x208c21[_0xfa8f('0xd')];}Report[_0xfa8f('0xe')][_0xfa8f('0xf')]=function(_0x15a91f){var _0x13bda8=new VoiceQueueReport(this['realtime']);var _0x4ec085=new VoiceAgentReport(this[_0xfa8f('0xb')]);var _0x294485=new VoiceDialReport(this[_0xfa8f('0xb')]);var _0x192fb0=new VoiceCallReport(this[_0xfa8f('0xb')]);var _0x4944af=new UserReport(this[_0xfa8f('0xb')]);if(config[_0xfa8f('0x10')]&&config['xdr']['disabled']){ami['on'](_0xfa8f('0x11'),this[_0xfa8f('0x12')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0xfa8f('0x13')][_0xfa8f('0x14')](this));ami['on'](_0xfa8f('0x15'),this[_0xfa8f('0x16')][_0xfa8f('0x14')](this));ami['on'](_0xfa8f('0x17'),this[_0xfa8f('0x18')][_0xfa8f('0x14')](this));ami['on'](_0xfa8f('0x19'),this[_0xfa8f('0x1a')]['bind'](this));ami['on'](_0xfa8f('0x1b'),this['attendedTransfer']['bind'](this));}};Report[_0xfa8f('0xe')][_0xfa8f('0x1c')]=function(_0x40fa43){var _0x1079a3;_0x1079a3=_[_0xfa8f('0x1d')](this[_0xfa8f('0xc')],function(_0xf10aec){return _0xf10aec[_0xfa8f('0x1e')]==_0x40fa43||_0xf10aec[_0xfa8f('0x1f')]==_0x40fa43;});if(_['isNil'](_0x1079a3)){var _0x183257=_['find'](this[_0xfa8f('0xd')],function(_0x40ad37){return _0x40ad37[_0xfa8f('0x1e')]==_0x40fa43||_0x40ad37['name']==_0x40fa43;});if(_0x183257){_0x1079a3=_[_0xfa8f('0x1d')](this[_0xfa8f('0xc')],function(_0x59b42f){return _0x59b42f[_0xfa8f('0x20')]==util[_0xfa8f('0x21')]('SIP/%s',_0x183257['name']);});}}return _0x1079a3;};Report[_0xfa8f('0xe')][_0xfa8f('0x12')]=function(_0x1c638d){for(var _0x37fa1a=0x0;_0x37fa1a<_0x1c638d['length'];_0x37fa1a+=0x1){var _0xbeff49=this[_0xfa8f('0x1c')](_0x1c638d[_0x37fa1a][_0xfa8f('0x22')]);if(_0xbeff49){_0x1c638d[_0x37fa1a][_0xfa8f('0x1e')]=_0xbeff49[_0xfa8f('0x1e')];_0x1c638d[_0x37fa1a][_0xfa8f('0x23')]=!![];_0x1c638d[_0x37fa1a][_0xfa8f('0x24')]=_0xbeff49[_0xfa8f('0x1f')];_0x1c638d[_0x37fa1a][_0xfa8f('0x20')]=_[_0xfa8f('0x25')](_0xbeff49[_0xfa8f('0x20')])?util[_0xfa8f('0x21')](_0xfa8f('0x26'),_0xbeff49['name']):_0xbeff49[_0xfa8f('0x20')];if(_0x1c638d[_0x37fa1a][_0xfa8f('0x27')]){_0x1c638d[_0x37fa1a][_0xfa8f('0x28')]=moment()['format'](_0xfa8f('0x29'));}if(_0x1c638d[_0x37fa1a][_0xfa8f('0x2a')]){_0x1c638d[_0x37fa1a][_0xfa8f('0x2b')]=moment()['format'](_0xfa8f('0x29'));}RpcMemberReport['voiceQueueReport'](_0x1c638d[_0x37fa1a]);}RpcVoiceQueueReport[_0xfa8f('0x2c')](_0x1c638d[_0x37fa1a]);}};function extractCalleridNumber(_0x33ac2a){var _0x3ac4a1=_0x33ac2a[_0xfa8f('0x2d')](/<(.*?)>/);return _0x3ac4a1?_0x3ac4a1[0x1]:_0x33ac2a;}Report[_0xfa8f('0xe')][_0xfa8f('0x2e')]=function(_0x3690f0){for(var _0x938d7f=0x0;_0x938d7f',_0xf75556[_0xfa8f('0x45')],_0xf75556[_0xfa8f('0x40')]);}if(RpcVoiceTransferReport[_0xfa8f('0x46')][_0xf75556[_0xfa8f('0x47')]]){var _0x22ac63=RpcVoiceTransferReport['transfers'][_0xf75556[_0xfa8f('0x47')]];_0x22ac63['transfereelinkedid']=_0xf75556[_0xfa8f('0x48')];RpcVoiceTransferReport['blindTransfer'](_0x22ac63);delete RpcVoiceTransferReport[_0xfa8f('0x46')][_0xf75556['linkedid']];}if(_[_0xfa8f('0x25')](_0xf75556['type'])){_0xf75556['type']=this[_0xfa8f('0x31')](_0xf75556);}if(_[_0xfa8f('0x25')](_0xf75556['UserId'])){var _0x40bbc7=_0xf75556[_0xfa8f('0x32')][_0xfa8f('0x33')]('-')[0x0];var _0x2e19c5=this[_0xfa8f('0xc')][_0x40bbc7];if(!_0x2e19c5)_0x2e19c5=this[_0xfa8f('0x2e')](_0xf75556[_0xfa8f('0x1e')]);if(_0x2e19c5){_0xf75556['UserId']=_0x2e19c5['id'];_0xf75556['membername']=_0x2e19c5[_0xfa8f('0x1f')];}}RpcVoiceCallReport[_0xfa8f('0x2c')](_0xf75556);if(_0xf75556[_0xfa8f('0x49')]){for(var _0x132566=0x0;_0x132566<_0xf75556['monitors'][_0xfa8f('0x30')];_0x132566+=0x1){_0xf75556['monitorFilename']=_0xf75556['monitors'][_0x132566][_0xfa8f('0x4a')];_0xf75556[_0xfa8f('0x4b')]=_0xf75556['monitors'][_0x132566][_0xfa8f('0x4b')];if(_0xf75556[_0xfa8f('0x35')]=='xcally-motion-preview'){_0xf75556[_0xfa8f('0x40')]=_0xf75556[_0xfa8f('0x22')];_0xf75556[_0xfa8f('0x45')]=_0xf75556[_0xfa8f('0x4c')];_0xf75556[_0xfa8f('0x22')]=_0xf75556['accountcode'];_0xf75556[_0xfa8f('0x4c')]=_0xf75556[_0xfa8f('0x4d')];_0xf75556['exten']=_0xf75556[_0xfa8f('0x41')];}else if(_0xf75556['exten']=='xcally-motion-dialer'){_0xf75556[_0xfa8f('0x40')]=_0xf75556['destination'];_0xf75556[_0xfa8f('0x35')]=_0xf75556[_0xfa8f('0x41')];}RpcVoiceRecording[_0xfa8f('0x2c')](_0xf75556);}}};Report[_0xfa8f('0xe')][_0xfa8f('0x16')]=function(_0x4c38b8){if(_[_0xfa8f('0x4e')](_0x4c38b8)){_0x4c38b8[_0xfa8f('0x4f')](function(_0xa997cb){RpcVoiceAgentReport['create'](_0xa997cb);});}else{RpcVoiceAgentReport[_0xfa8f('0x2c')](_0x4c38b8);}};Report[_0xfa8f('0xe')][_0xfa8f('0x18')]=function(_0x36c303){RpcVoiceDialReport['create'](_0x36c303);var _0x581e7c;var _0x175c31;var _0x379ed1=_0x36c303[_0xfa8f('0x32')];if(_['startsWith'](_0x379ed1,'Local')){_0x175c31=_0x379ed1['substring'](_0x379ed1[_0xfa8f('0x50')]('/')+0x1,_0x379ed1['indexOf']('@'));_0x581e7c=_[_0xfa8f('0x1d')](this[_0xfa8f('0xc')],function(_0xeff3b){return _0xeff3b[_0xfa8f('0x51')]==_0x175c31||_0xeff3b[_0xfa8f('0x52')]==_0x175c31||_0xeff3b['accountcode']==_0x175c31;});}else{_0x175c31=_0x379ed1[_0xfa8f('0x53')](_0x379ed1[_0xfa8f('0x50')]('/')+0x1,_0x379ed1[_0xfa8f('0x54')]('-'));_0x581e7c=this[_0xfa8f('0x1c')](_0x175c31);}if(_0x581e7c){_0x36c303[_0xfa8f('0x20')]=_[_0xfa8f('0x25')](_0x581e7c[_0xfa8f('0x20')])?util[_0xfa8f('0x21')](_0xfa8f('0x26'),_0x581e7c['name']):_0x581e7c[_0xfa8f('0x20')];_0x36c303[_0xfa8f('0x4d')]=_0x581e7c['name'];_0x36c303[_0xfa8f('0x1e')]=_0x581e7c['accountcode'];RpcMemberReport[_0xfa8f('0x18')](_0x36c303);}};Report[_0xfa8f('0xe')][_0xfa8f('0x1a')]=function(_0x13c8a4){RpcVoiceTransferReport['transfers'][_0x13c8a4[_0xfa8f('0x55')]]=_0x13c8a4;};Report[_0xfa8f('0xe')][_0xfa8f('0x56')]=function(_0x36ea7a){RpcVoiceTransferReport[_0xfa8f('0x56')](_0x36ea7a);};module[_0xfa8f('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index b60793f..5889ab0 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 _0xac23=['[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','substring','indexOf','mobile','[userReport][devicestatechange]','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','util','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','catch','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','event','actionid'];(function(_0x1a396b,_0x5345ac){var _0x5ac2e9=function(_0x16ba81){while(--_0x16ba81){_0x1a396b['push'](_0x1a396b['shift']());}};_0x5ac2e9(++_0x5345ac);}(_0xac23,0x65));var _0x3ac2=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0xac23[_0x834bb6];return _0xa35d00;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x3ac2('0x0'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x3ac2('0x1'));var logger=require(_0x3ac2('0x2'))(_0x3ac2('0x3'));var ami=require(_0x3ac2('0x4'));config[_0x3ac2('0x5')]=_['defaults'](config[_0x3ac2('0x5')],{'host':_0x3ac2('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3ac2('0x5')]));function UserReport(_0x3c34c8){this[_0x3ac2('0x7')]=_0x3c34c8[_0x3ac2('0x7')];this[_0x3ac2('0x8')]=_0x3c34c8[_0x3ac2('0x8')];this[_0x3ac2('0x9')]=_0x3c34c8[_0x3ac2('0x9')];ami['on'](_0x3ac2('0xa'),this[_0x3ac2('0xb')][_0x3ac2('0xc')](this));ami['on'](_0x3ac2('0xd'),this['syncRegistry'][_0x3ac2('0xc')](this));ami['on'](_0x3ac2('0xe'),this[_0x3ac2('0xf')][_0x3ac2('0xc')](this));ami['on']('peerstatus',this[_0x3ac2('0x10')][_0x3ac2('0xc')](this));return this[_0x3ac2('0x11')]();}function showSipRegistrations(){Promise[_0x3ac2('0x12')]()[_0x3ac2('0x13')](ami['actionSipShowRegistry']())[_0x3ac2('0x14')](function(_0x2efc81){logger[_0x3ac2('0x15')]('[userReport][sipshowregistry]',util['inspect'](_0x2efc81,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x3ac2('0x12')]()[_0x3ac2('0x13')](ami['actionDeviceStateList']())[_0x3ac2('0x14')](function(_0x431150){logger[_0x3ac2('0x15')](_0x3ac2('0x16'),util[_0x3ac2('0x17')](_0x431150,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3ac2('0x12')]()[_0x3ac2('0x13')](ami[_0x3ac2('0x18')]())[_0x3ac2('0x14')](function(_0x33e4b3){logger['error'](_0x3ac2('0x19'),util[_0x3ac2('0x17')](_0x33e4b3,{'showHidden':![],'depth':null}));});}UserReport[_0x3ac2('0x1a')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x3ac2('0x12')]()[_0x3ac2('0x13')](showSipRegistrations())[_0x3ac2('0x13')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x3ac2('0x1a')][_0x3ac2('0x1b')]=function(_0x2def76){return _0x2def76!==null&&!_[_0x3ac2('0x1c')](_0x2def76);};UserReport['prototype'][_0x3ac2('0x1d')]=function(_0x5bf137,_0x14e793,_0x1a756d){io['to'](_0x5bf137)['emit'](_0x14e793,_0x1a756d);};UserReport['prototype'][_0x3ac2('0xb')]=function(_0x1ec656){try{if(this[_0x3ac2('0x1b')](_0x1ec656)){logger[_0x3ac2('0x1e')](_0x3ac2('0x1f'),_0x1ec656[_0x3ac2('0x20')],_0x1ec656[_0x3ac2('0x21')]);logger[_0x3ac2('0x22')](_0x3ac2('0x23'),util[_0x3ac2('0x17')](_0x1ec656,{'showHidden':![],'depth':null}));var _0x180dfd=_[_0x3ac2('0x24')](this[_0x3ac2('0x7')],{'defaultuser':_0x1ec656[_0x3ac2('0x20')]});if(_0x180dfd){_0x1ec656['stateRegistry']=_0x1ec656[_0x3ac2('0x21')];_['merge'](_0x180dfd,_['omit'](_0x1ec656,[_0x3ac2('0x25'),_0x3ac2('0x26'),_0x3ac2('0x20'),_0x3ac2('0x21')]));logger[_0x3ac2('0x22')](_0x3ac2('0x27'),util[_0x3ac2('0x17')](_0x180dfd,{'showHidden':![],'depth':null}));this[_0x3ac2('0x1d')](util[_0x3ac2('0x28')](_0x3ac2('0x29'),_0x180dfd[_0x3ac2('0x2a')]),'trunk:save',_0x180dfd);}}}catch(_0x896b10){logger[_0x3ac2('0x15')]('[userReport][registry]',util[_0x3ac2('0x17')](_0x896b10,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x3fbd11){try{if(this[_0x3ac2('0x1b')](_0x3fbd11)){logger[_0x3ac2('0x1e')](_0x3ac2('0x2b'),_0x3fbd11[_0x3ac2('0x2c')],_0x3fbd11['state']);logger['debug']('[userReport][devicestatechange]',util[_0x3ac2('0x17')](_0x3fbd11,{'showHidden':![],'depth':null}));if(this[_0x3ac2('0x8')][_0x3fbd11['device']]){if(!this['agents'][_0x3fbd11[_0x3ac2('0x2c')]][_0x3ac2('0x2d')]||_0x3fbd11[_0x3ac2('0x21')][_0x3ac2('0x2e')]()==_0x3ac2('0x2f')){this[_0x3ac2('0x8')][_0x3fbd11[_0x3ac2('0x2c')]]['local']=![];if(this[_0x3ac2('0x8')][_0x3fbd11['device']][_0x3ac2('0x21')]!==_0x3fbd11['state'][_0x3ac2('0x2e')]()){this[_0x3ac2('0x8')][_0x3fbd11[_0x3ac2('0x2c')]][_0x3ac2('0x30')]=_[_0x3ac2('0x31')](moment()['format']('x'));}this[_0x3ac2('0x8')][_0x3fbd11[_0x3ac2('0x2c')]][_0x3ac2('0x21')]=_0x3fbd11[_0x3ac2('0x21')][_0x3ac2('0x2e')]();this[_0x3ac2('0x8')][_0x3fbd11[_0x3ac2('0x2c')]][_0x3ac2('0x32')](_0x3fbd11);}}else if(this[_0x3ac2('0x9')][_0x3fbd11[_0x3ac2('0x2c')]]){if(this[_0x3ac2('0x9')][_0x3fbd11[_0x3ac2('0x2c')]][_0x3ac2('0x21')]!==_0x3fbd11['state'][_0x3ac2('0x2e')]()){this[_0x3ac2('0x9')][_0x3fbd11[_0x3ac2('0x2c')]][_0x3ac2('0x30')]=_[_0x3ac2('0x31')](moment()[_0x3ac2('0x28')]('x'));}this[_0x3ac2('0x9')][_0x3fbd11[_0x3ac2('0x2c')]]['state']=_0x3fbd11[_0x3ac2('0x21')][_0x3ac2('0x2e')]();logger[_0x3ac2('0x22')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x3ac2('0x17')](this['telephones'][_0x3fbd11[_0x3ac2('0x2c')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x3ac2('0x28')](_0x3ac2('0x33'),this['telephones'][_0x3fbd11[_0x3ac2('0x2c')]]['name']),'telephone:save',this[_0x3ac2('0x9')][_0x3fbd11[_0x3ac2('0x2c')]]);}else if(this[_0x3ac2('0x7')][_0x3fbd11[_0x3ac2('0x2c')]]){if(this[_0x3ac2('0x7')][_0x3fbd11['device']][_0x3ac2('0x21')]!==_0x3fbd11[_0x3ac2('0x21')][_0x3ac2('0x2e')]()){this[_0x3ac2('0x7')][_0x3fbd11[_0x3ac2('0x2c')]]['stateTime']=_[_0x3ac2('0x31')](moment()[_0x3ac2('0x28')]('x'));}this['trunks'][_0x3fbd11[_0x3ac2('0x2c')]][_0x3ac2('0x21')]=_0x3fbd11[_0x3ac2('0x21')]['toLowerCase']();logger[_0x3ac2('0x22')](_0x3ac2('0x34'),util['inspect'](this['trunks'][_0x3fbd11['device']],{'showHidden':![],'depth':null}));this[_0x3ac2('0x1d')](util[_0x3ac2('0x28')]('trunk:%s',this[_0x3ac2('0x7')][_0x3fbd11[_0x3ac2('0x2c')]][_0x3ac2('0x2a')]),_0x3ac2('0x35'),this[_0x3ac2('0x7')][_0x3fbd11[_0x3ac2('0x2c')]]);}else if(_['startsWith'](_0x3fbd11[_0x3ac2('0x2c')],_0x3ac2('0x36'))){var _0x3a73a1=_0x3fbd11[_0x3ac2('0x2c')];var _0x59cb3f=_0x3a73a1[_0x3ac2('0x37')](_0x3a73a1[_0x3ac2('0x38')]('/')+0x1,_0x3a73a1['indexOf']('@'));var _0x5d7a80=_['find'](this[_0x3ac2('0x8')],function(_0xfaa2c9){return _0xfaa2c9[_0x3ac2('0x39')]==_0x59cb3f||_0xfaa2c9['phone']==_0x59cb3f||_0xfaa2c9['accountcode']==_0x59cb3f;});if(_0x5d7a80){if(_0x5d7a80[_0x3ac2('0x21')]!==_0x3fbd11[_0x3ac2('0x21')][_0x3ac2('0x2e')]()){_0x5d7a80[_0x3ac2('0x30')]=_[_0x3ac2('0x31')](moment()[_0x3ac2('0x28')]('x'));}_0x5d7a80['state']=_0x3fbd11[_0x3ac2('0x21')][_0x3ac2('0x2e')]();_0x5d7a80['local']=!![];_0x5d7a80[_0x3ac2('0x32')](_0x3fbd11);}}}}catch(_0x5d2f80){logger[_0x3ac2('0x15')](_0x3ac2('0x3a'),util[_0x3ac2('0x17')](_0x5d2f80,{'showHidden':![],'depth':null}));}};UserReport[_0x3ac2('0x1a')][_0x3ac2('0x10')]=function(_0x4eedbc){try{if(this['isNotNull'](_0x4eedbc)&&this[_0x3ac2('0x1b')](_0x4eedbc[_0x3ac2('0x3b')])){logger[_0x3ac2('0x1e')](_0x3ac2('0x3c'),_0x4eedbc[_0x3ac2('0x3d')],_0x4eedbc['address'],_0x4eedbc[_0x3ac2('0x3b')]);logger['debug'](_0x3ac2('0x3e'),util[_0x3ac2('0x17')](_0x4eedbc,{'showHidden':![],'depth':null}));if(this[_0x3ac2('0x8')][_0x4eedbc[_0x3ac2('0x3d')]]){if(!this[_0x3ac2('0x8')][_0x4eedbc[_0x3ac2('0x3d')]][_0x3ac2('0x2d')]||_0x4eedbc[_0x3ac2('0x3b')][_0x3ac2('0x2e')]()==_0x3ac2('0x3f')){this[_0x3ac2('0x8')][_0x4eedbc[_0x3ac2('0x3d')]][_0x3ac2('0x2d')]=![];this[_0x3ac2('0x8')][_0x4eedbc[_0x3ac2('0x3d')]][_0x3ac2('0x40')]=_0x4eedbc[_0x3ac2('0x3b')][_0x3ac2('0x2e')]();this[_0x3ac2('0x8')][_0x4eedbc['peer']][_0x3ac2('0x41')]=_0x4eedbc[_0x3ac2('0x41')];this[_0x3ac2('0x8')][_0x4eedbc['peer']][_0x3ac2('0x32')](_0x4eedbc);}}else if(this[_0x3ac2('0x9')][_0x4eedbc[_0x3ac2('0x3d')]]){this[_0x3ac2('0x9')][_0x4eedbc[_0x3ac2('0x3d')]][_0x3ac2('0x40')]=_0x4eedbc['peerstatus'][_0x3ac2('0x2e')]();this[_0x3ac2('0x9')][_0x4eedbc[_0x3ac2('0x3d')]][_0x3ac2('0x41')]=_0x4eedbc[_0x3ac2('0x41')];logger[_0x3ac2('0x22')](_0x3ac2('0x42'),util['inspect'](this[_0x3ac2('0x9')][_0x4eedbc[_0x3ac2('0x3d')]],{'showHidden':![],'depth':null}));this[_0x3ac2('0x1d')](util[_0x3ac2('0x28')](_0x3ac2('0x33'),this['telephones'][_0x4eedbc[_0x3ac2('0x3d')]][_0x3ac2('0x2a')]),_0x3ac2('0x43'),this[_0x3ac2('0x9')][_0x4eedbc['peer']]);}else if(this['trunks'][_0x4eedbc[_0x3ac2('0x3d')]]){this[_0x3ac2('0x7')][_0x4eedbc['peer']]['status']=_0x4eedbc[_0x3ac2('0x3b')][_0x3ac2('0x2e')]();this[_0x3ac2('0x7')][_0x4eedbc[_0x3ac2('0x3d')]]['address']=_0x4eedbc[_0x3ac2('0x41')];logger['debug'](_0x3ac2('0x44'),util[_0x3ac2('0x17')](this[_0x3ac2('0x7')][_0x4eedbc[_0x3ac2('0x3d')]],{'showHidden':![],'depth':null}));this[_0x3ac2('0x1d')](util[_0x3ac2('0x28')](_0x3ac2('0x29'),this[_0x3ac2('0x7')][_0x4eedbc['peer']]['name']),_0x3ac2('0x35'),this[_0x3ac2('0x7')][_0x4eedbc[_0x3ac2('0x3d')]]);}}}catch(_0x2f8dbb){logger[_0x3ac2('0x15')](_0x3ac2('0x3e'),util[_0x3ac2('0x17')](_0x2f8dbb,{'showHidden':![],'depth':null}));}};module[_0x3ac2('0x45')]=UserReport; \ No newline at end of file +var _0x1c42=['actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','debug','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','updateStatusRealtime','toNumber','telephone:%s','trunk:save','startsWith','Local','substring','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','status','address','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','state','[userReport][registry]','find','username','merge','event'];(function(_0x58a935,_0x1dbf6f){var _0x26b636=function(_0x41b630){while(--_0x41b630){_0x58a935['push'](_0x58a935['shift']());}};_0x26b636(++_0x1dbf6f);}(_0x1c42,0x13a));var _0x21c4=function(_0x25ceb0,_0x3be50d){_0x25ceb0=_0x25ceb0-0x0;var _0x28d9e3=_0x1c42[_0x25ceb0];return _0x28d9e3;};'use strict';var _=require('lodash');var moment=require(_0x21c4('0x0'));var util=require(_0x21c4('0x1'));var Redis=require(_0x21c4('0x2'));var BPromise=require('bluebird');var config=require(_0x21c4('0x3'));var logger=require(_0x21c4('0x4'))(_0x21c4('0x5'));var ami=require(_0x21c4('0x6'));config[_0x21c4('0x7')]=_[_0x21c4('0x8')](config[_0x21c4('0x7')],{'host':_0x21c4('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21c4('0x7')]));function UserReport(_0x472df1){this['trunks']=_0x472df1[_0x21c4('0xa')];this['agents']=_0x472df1[_0x21c4('0xb')];this[_0x21c4('0xc')]=_0x472df1[_0x21c4('0xc')];ami['on'](_0x21c4('0xd'),this[_0x21c4('0xe')][_0x21c4('0xf')](this));ami['on'](_0x21c4('0x10'),this[_0x21c4('0xe')][_0x21c4('0xf')](this));ami['on']('devicestatechange',this[_0x21c4('0x11')]['bind'](this));ami['on'](_0x21c4('0x12'),this['syncPeerStatus'][_0x21c4('0xf')](this));return this[_0x21c4('0x13')]();}function showSipRegistrations(){Promise[_0x21c4('0x14')]()[_0x21c4('0x15')](ami[_0x21c4('0x16')]())[_0x21c4('0x17')](function(_0x3a8a3a){logger[_0x21c4('0x18')](_0x21c4('0x19'),util[_0x21c4('0x1a')](_0x3a8a3a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x21c4('0x14')]()[_0x21c4('0x15')](ami[_0x21c4('0x1b')]())['catch'](function(_0x50b3fd){logger[_0x21c4('0x18')](_0x21c4('0x1c'),util[_0x21c4('0x1a')](_0x50b3fd,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x21c4('0x14')]()[_0x21c4('0x15')](ami[_0x21c4('0x1d')]())[_0x21c4('0x17')](function(_0x9cd43c){logger[_0x21c4('0x18')](_0x21c4('0x1e'),util[_0x21c4('0x1a')](_0x9cd43c,{'showHidden':![],'depth':null}));});}UserReport[_0x21c4('0x1f')][_0x21c4('0x13')]=function(){setInterval(function(){BPromise[_0x21c4('0x14')]()[_0x21c4('0x15')](showSipRegistrations())[_0x21c4('0x15')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x21c4('0x20')]=function(_0x42f2d7){return _0x42f2d7!==null&&!_['isUndefined'](_0x42f2d7);};UserReport[_0x21c4('0x1f')]['emit']=function(_0x2a58c0,_0x3c1998,_0x42091a){io['to'](_0x2a58c0)[_0x21c4('0x21')](_0x3c1998,_0x42091a);};UserReport[_0x21c4('0x1f')][_0x21c4('0xe')]=function(_0x3c9b8f){try{if(this[_0x21c4('0x20')](_0x3c9b8f)){logger[_0x21c4('0x22')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x3c9b8f['username'],_0x3c9b8f[_0x21c4('0x23')]);logger['debug'](_0x21c4('0x24'),util[_0x21c4('0x1a')](_0x3c9b8f,{'showHidden':![],'depth':null}));var _0x102728=_[_0x21c4('0x25')](this[_0x21c4('0xa')],{'defaultuser':_0x3c9b8f[_0x21c4('0x26')]});if(_0x102728){_0x3c9b8f['stateRegistry']=_0x3c9b8f[_0x21c4('0x23')];_[_0x21c4('0x27')](_0x102728,_['omit'](_0x3c9b8f,[_0x21c4('0x28'),_0x21c4('0x29'),_0x21c4('0x26'),'state']));logger['debug'](_0x21c4('0x2a'),util[_0x21c4('0x1a')](_0x102728,{'showHidden':![],'depth':null}));this[_0x21c4('0x21')](util[_0x21c4('0x2b')](_0x21c4('0x2c'),_0x102728[_0x21c4('0x2d')]),'trunk:save',_0x102728);}}}catch(_0x5017ac){logger['error'](_0x21c4('0x24'),util['inspect'](_0x5017ac,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0xf9ec39){try{if(this[_0x21c4('0x20')](_0xf9ec39)){logger['info'](_0x21c4('0x2e'),_0xf9ec39[_0x21c4('0x2f')],_0xf9ec39[_0x21c4('0x23')]);logger[_0x21c4('0x30')](_0x21c4('0x31'),util[_0x21c4('0x1a')](_0xf9ec39,{'showHidden':![],'depth':null}));if(this[_0x21c4('0xb')][_0xf9ec39[_0x21c4('0x2f')]]){if(!this['agents'][_0xf9ec39['device']][_0x21c4('0x32')]||_0xf9ec39[_0x21c4('0x23')][_0x21c4('0x33')]()==_0x21c4('0x34')){this[_0x21c4('0xb')][_0xf9ec39[_0x21c4('0x2f')]]['local']=![];if(this[_0x21c4('0xb')][_0xf9ec39['device']][_0x21c4('0x23')]!==_0xf9ec39[_0x21c4('0x23')]['toLowerCase']()){this[_0x21c4('0xb')][_0xf9ec39[_0x21c4('0x2f')]][_0x21c4('0x35')]=_['toNumber'](moment()[_0x21c4('0x2b')]('x'));}this['agents'][_0xf9ec39[_0x21c4('0x2f')]][_0x21c4('0x23')]=_0xf9ec39[_0x21c4('0x23')][_0x21c4('0x33')]();this['agents'][_0xf9ec39['device']][_0x21c4('0x36')](_0xf9ec39);}}else if(this[_0x21c4('0xc')][_0xf9ec39[_0x21c4('0x2f')]]){if(this[_0x21c4('0xc')][_0xf9ec39[_0x21c4('0x2f')]][_0x21c4('0x23')]!==_0xf9ec39[_0x21c4('0x23')][_0x21c4('0x33')]()){this[_0x21c4('0xc')][_0xf9ec39[_0x21c4('0x2f')]][_0x21c4('0x35')]=_[_0x21c4('0x37')](moment()['format']('x'));}this[_0x21c4('0xc')][_0xf9ec39[_0x21c4('0x2f')]][_0x21c4('0x23')]=_0xf9ec39[_0x21c4('0x23')][_0x21c4('0x33')]();logger[_0x21c4('0x30')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x21c4('0x1a')](this[_0x21c4('0xc')][_0xf9ec39[_0x21c4('0x2f')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x21c4('0x2b')](_0x21c4('0x38'),this[_0x21c4('0xc')][_0xf9ec39[_0x21c4('0x2f')]][_0x21c4('0x2d')]),'telephone:save',this[_0x21c4('0xc')][_0xf9ec39[_0x21c4('0x2f')]]);}else if(this[_0x21c4('0xa')][_0xf9ec39[_0x21c4('0x2f')]]){if(this[_0x21c4('0xa')][_0xf9ec39[_0x21c4('0x2f')]][_0x21c4('0x23')]!==_0xf9ec39[_0x21c4('0x23')][_0x21c4('0x33')]()){this['trunks'][_0xf9ec39[_0x21c4('0x2f')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['trunks'][_0xf9ec39[_0x21c4('0x2f')]][_0x21c4('0x23')]=_0xf9ec39[_0x21c4('0x23')][_0x21c4('0x33')]();logger[_0x21c4('0x30')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x21c4('0x1a')](this[_0x21c4('0xa')][_0xf9ec39[_0x21c4('0x2f')]],{'showHidden':![],'depth':null}));this[_0x21c4('0x21')](util[_0x21c4('0x2b')]('trunk:%s',this[_0x21c4('0xa')][_0xf9ec39[_0x21c4('0x2f')]]['name']),_0x21c4('0x39'),this[_0x21c4('0xa')][_0xf9ec39[_0x21c4('0x2f')]]);}else if(_[_0x21c4('0x3a')](_0xf9ec39[_0x21c4('0x2f')],_0x21c4('0x3b'))){var _0x175bd1=_0xf9ec39[_0x21c4('0x2f')];var _0x3165c3=_0x175bd1[_0x21c4('0x3c')](_0x175bd1['indexOf']('/')+0x1,_0x175bd1['indexOf']('@'));var _0x70d352=_['find'](this[_0x21c4('0xb')],function(_0x2323be){return _0x2323be[_0x21c4('0x3d')]==_0x3165c3||_0x2323be[_0x21c4('0x3e')]==_0x3165c3||_0x2323be[_0x21c4('0x3f')]==_0x3165c3;});if(_0x70d352){if(_0x70d352[_0x21c4('0x23')]!==_0xf9ec39['state'][_0x21c4('0x33')]()){_0x70d352[_0x21c4('0x35')]=_[_0x21c4('0x37')](moment()[_0x21c4('0x2b')]('x'));}_0x70d352['state']=_0xf9ec39[_0x21c4('0x23')][_0x21c4('0x33')]();_0x70d352[_0x21c4('0x32')]=!![];_0x70d352[_0x21c4('0x36')](_0xf9ec39);}}}}catch(_0xdeacec){logger[_0x21c4('0x18')](_0x21c4('0x31'),util[_0x21c4('0x1a')](_0xdeacec,{'showHidden':![],'depth':null}));}};UserReport[_0x21c4('0x1f')]['syncPeerStatus']=function(_0x57b3cf){try{if(this['isNotNull'](_0x57b3cf)&&this['isNotNull'](_0x57b3cf[_0x21c4('0x12')])){logger[_0x21c4('0x22')](_0x21c4('0x40'),_0x57b3cf[_0x21c4('0x41')],_0x57b3cf['address'],_0x57b3cf[_0x21c4('0x12')]);logger[_0x21c4('0x30')](_0x21c4('0x42'),util['inspect'](_0x57b3cf,{'showHidden':![],'depth':null}));if(this[_0x21c4('0xb')][_0x57b3cf['peer']]){if(!this['agents'][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x32')]||_0x57b3cf[_0x21c4('0x12')][_0x21c4('0x33')]()=='registered'){this[_0x21c4('0xb')][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x32')]=![];this[_0x21c4('0xb')][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x43')]=_0x57b3cf[_0x21c4('0x12')][_0x21c4('0x33')]();this[_0x21c4('0xb')][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x44')]=_0x57b3cf['address'];this['agents'][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x36')](_0x57b3cf);}}else if(this['telephones'][_0x57b3cf['peer']]){this[_0x21c4('0xc')][_0x57b3cf[_0x21c4('0x41')]]['status']=_0x57b3cf['peerstatus'][_0x21c4('0x33')]();this[_0x21c4('0xc')][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x44')]=_0x57b3cf[_0x21c4('0x44')];logger[_0x21c4('0x30')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x21c4('0x1a')](this[_0x21c4('0xc')][_0x57b3cf[_0x21c4('0x41')]],{'showHidden':![],'depth':null}));this[_0x21c4('0x21')](util[_0x21c4('0x2b')](_0x21c4('0x38'),this[_0x21c4('0xc')][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x2d')]),'telephone:save',this[_0x21c4('0xc')][_0x57b3cf[_0x21c4('0x41')]]);}else if(this[_0x21c4('0xa')][_0x57b3cf[_0x21c4('0x41')]]){this['trunks'][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x43')]=_0x57b3cf[_0x21c4('0x12')][_0x21c4('0x33')]();this[_0x21c4('0xa')][_0x57b3cf[_0x21c4('0x41')]][_0x21c4('0x44')]=_0x57b3cf[_0x21c4('0x44')];logger[_0x21c4('0x30')](_0x21c4('0x45'),util[_0x21c4('0x1a')](this[_0x21c4('0xa')][_0x57b3cf[_0x21c4('0x41')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x21c4('0x2b')](_0x21c4('0x2c'),this['trunks'][_0x57b3cf['peer']][_0x21c4('0x2d')]),_0x21c4('0x39'),this[_0x21c4('0xa')][_0x57b3cf[_0x21c4('0x41')]]);}}}catch(_0x40cdb6){logger[_0x21c4('0x18')](_0x21c4('0x42'),util['inspect'](_0x40cdb6,{'showHidden':![],'depth':null}));}};module[_0x21c4('0x46')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 98aa8ee..eb62ea3 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 _0xa516=['syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','inspect','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','assign','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','agentconnectAt','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','merge','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:%s','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','talktime','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','syncVarSet','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','isUndefined','[%s][voiceAgentReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','defaults','redis','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer'];(function(_0x5d26a7,_0x3cdfe1){var _0x1d9b46=function(_0xdd9073){while(--_0xdd9073){_0x5d26a7['push'](_0x5d26a7['shift']());}};_0x1d9b46(++_0x3cdfe1);}(_0xa516,0x1ca));var _0x6a51=function(_0x3143b3,_0x2d6dad){_0x3143b3=_0x3143b3-0x0;var _0x1dc4e0=_0xa516[_0x3143b3];return _0x1dc4e0;};'use strict';var _=require(_0x6a51('0x0'));var moment=require(_0x6a51('0x1'));var util=require(_0x6a51('0x2'));var Redis=require(_0x6a51('0x3'));var config=require('../../../config/environment');var logger=require(_0x6a51('0x4'))('ami');var ami=require(_0x6a51('0x5'));config['redis']=_[_0x6a51('0x6')](config[_0x6a51('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a51('0x7')]));function VoiceAgentReport(_0x246b76){this[_0x6a51('0x8')]={};this[_0x6a51('0x9')]=_0x246b76['channels'];this[_0x6a51('0xa')]=_0x246b76['voiceQueues'];this['agents']=_0x246b76[_0x6a51('0xb')];this[_0x6a51('0xc')]={};ami['on'](_0x6a51('0xd'),this[_0x6a51('0xe')][_0x6a51('0xf')](this));ami['on'](_0x6a51('0x10'),this[_0x6a51('0x11')][_0x6a51('0xf')](this));ami['on'](_0x6a51('0x12'),this[_0x6a51('0x13')]['bind'](this));ami['on'](_0x6a51('0x14'),this['syncQueueCallerAbandon'][_0x6a51('0xf')](this));ami['on'](_0x6a51('0x15'),this[_0x6a51('0x16')][_0x6a51('0xf')](this));ami['on'](_0x6a51('0x17'),this['syncVarSet'][_0x6a51('0xf')](this));ami['on'](_0x6a51('0x18'),this[_0x6a51('0x19')][_0x6a51('0xf')](this));ami['on'](_0x6a51('0x1a'),this[_0x6a51('0x1b')][_0x6a51('0xf')](this));ami['on'](_0x6a51('0x1c'),this[_0x6a51('0x1d')]['bind'](this));ami['on'](_0x6a51('0x1e'),this[_0x6a51('0x1f')][_0x6a51('0xf')](this));ami['on'](_0x6a51('0x20'),this[_0x6a51('0x21')][_0x6a51('0xf')](this));}VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x23')]=function(_0x4c33d6,_0xa6a974,_0x47306d){io['to'](_0x4c33d6)[_0x6a51('0x23')](_0xa6a974,_0x47306d);};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x24')]=function(_0x19ec8c){return _0x19ec8c!==null&&!_['isUndefined'](_0x19ec8c);};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0xe')]=function(_0x4939e6){try{if(this[_0x6a51('0x24')](_0x4939e6)){logger[_0x6a51('0x25')](_0x6a51('0x26'),_0x4939e6[_0x6a51('0x27')],_0x4939e6[_0x6a51('0x28')],_0x4939e6[_0x6a51('0x29')]);logger[_0x6a51('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x4939e6['uniqueid'],util[_0x6a51('0x2b')](_0x4939e6,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x6a51('0x8')][_0x4939e6[_0x6a51('0x27')]])){this[_0x6a51('0x8')][_0x4939e6[_0x6a51('0x27')]]={};}var _0x142632=this[_0x6a51('0xb')][_0x4939e6[_0x6a51('0x2c')]];var _0x3d6f83=this[_0x6a51('0x8')][_0x4939e6[_0x6a51('0x27')]][_0x4939e6[_0x6a51('0x29')]];var _0x51cf7a=this[_0x6a51('0xa')][_0x4939e6[_0x6a51('0x2d')]];var _0x2cb887=this[_0x6a51('0xc')][_0x4939e6[_0x6a51('0x27')]];if(_['isUndefined'](_0x3d6f83)){_0x3d6f83={'agentcalledAt':moment()[_0x6a51('0x2e')](_0x6a51('0x2f')),'lastevent':_0x6a51('0x30'),'mandatoryDisposition':_0x51cf7a&&_0x51cf7a[_0x6a51('0x31')]?_0x51cf7a['mandatoryDisposition']:![],'type':_0x51cf7a&&_0x51cf7a[_0x6a51('0x32')]?_0x51cf7a[_0x6a51('0x32')]:'inbound','variables':_0x2cb887,'motionChannel':'voice'};}Object[_0x6a51('0x33')](_0x3d6f83,_['omit'](_0x4939e6,[_0x6a51('0x34'),_0x6a51('0x35')]));this[_0x6a51('0x8')][_0x4939e6[_0x6a51('0x27')]][_0x4939e6[_0x6a51('0x29')]]=_0x3d6f83;logger[_0x6a51('0x2a')](_0x6a51('0x36'),_0x4939e6[_0x6a51('0x27')],util['inspect'](_0x3d6f83,{'showHidden':![],'depth':null}));ami[_0x6a51('0x23')](_0x6a51('0x37'),_0x3d6f83);var _0x2b7a0c={'id':_0x142632['id'],'calleridnum':_0x3d6f83['calleridnum'],'queue':_0x3d6f83['queue'],'variables':_0x3d6f83['variables'],'uniqueid':_0x4939e6[_0x6a51('0x27')]};logger[_0x6a51('0x2a')](_0x6a51('0x38'),_0x4939e6[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x2b7a0c,{'showHidden':![],'depth':null}));this[_0x6a51('0x23')](util[_0x6a51('0x2e')]('user:%s',_0x4939e6[_0x6a51('0x28')]),_0x6a51('0x39'),_0x2b7a0c);}}catch(_0x3af051){logger[_0x6a51('0x3a')](_0x6a51('0x3b'),_0x4939e6[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x3af051,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x11')]=function(_0x4d6f62){try{if(this[_0x6a51('0x24')](_0x4d6f62)){if(this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]]){for(var _0x19e015 in this[_0x6a51('0x8')][_0x4d6f62['uniqueid']]){if(this[_0x6a51('0x8')][_0x4d6f62['uniqueid']][_0x6a51('0x3c')](_0x19e015)){if(_0x4d6f62['destuniqueid']===_0x19e015){logger[_0x6a51('0x25')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4d6f62[_0x6a51('0x27')],_0x4d6f62[_0x6a51('0x28')],_0x4d6f62[_0x6a51('0x29')]);this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x3d')]=moment()[_0x6a51('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6a51('0x8')][_0x4d6f62['uniqueid']][_0x19e015]['connectedlinename']=_0x4d6f62['connectedlinename'];this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x3e')]=_0x4d6f62[_0x6a51('0x3e')];this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x3f')]=_0x4d6f62['destchannelstate'];this['channels'][_0x4d6f62['uniqueid']][_0x19e015]['destchannelstatedesc']=_0x4d6f62[_0x6a51('0x40')];this[_0x6a51('0x8')][_0x4d6f62['uniqueid']][_0x19e015][_0x6a51('0x41')]=_0x4d6f62[_0x6a51('0x41')];this['channels'][_0x4d6f62['uniqueid']][_0x19e015][_0x6a51('0x42')]=_0x6a51('0x43');if(this[_0x6a51('0x9')][this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x27')]]){var _0x11d58a=this['voiceChannels'][this[_0x6a51('0x8')][_0x4d6f62['uniqueid']][_0x19e015]['uniqueid']][_0x6a51('0x44')];this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015]['routealias']=_0x11d58a;_0x4d6f62['routealias']=_0x11d58a;}_[_0x6a51('0x45')](this[_0x6a51('0xb')][_0x4d6f62[_0x6a51('0x2c')]],_['pick'](_0x4d6f62,[_0x6a51('0x2d'),_0x6a51('0x46'),_0x6a51('0x44')]));var _0x4982eb=this[_0x6a51('0xb')][_0x4d6f62[_0x6a51('0x2c')]];var _0x352767={'id':_0x4982eb['id'],'name':_0x4982eb[_0x6a51('0x47')],'agentconnected':!![],'destaccountcode':_0x4982eb[_0x6a51('0x48')],'destconnectedlinenum':this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x4d6f62[_0x6a51('0x29')]][_0x6a51('0x49')],'queue':this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x4d6f62[_0x6a51('0x29')]]['queue'],'routealias':this['channels'][_0x4d6f62[_0x6a51('0x27')]][_0x4d6f62['destuniqueid']][_0x6a51('0x44')],'uniqueid':this['channels'][_0x4d6f62['uniqueid']][_0x4d6f62[_0x6a51('0x29')]][_0x6a51('0x27')]};ami[_0x6a51('0x23')](_0x6a51('0x4a'),this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x4d6f62[_0x6a51('0x29')]]);this['emit'](util[_0x6a51('0x2e')]('user:%s',_0x4d6f62[_0x6a51('0x28')]),'user:agentconnect',_0x352767);}else if(!this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x12')]&&!this['channels'][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x15')]){logger[_0x6a51('0x25')](_0x6a51('0x4b'),_0x4d6f62[_0x6a51('0x27')],this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x28')],_0x19e015);this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x12')]=!![];this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x4c')]=moment()['format'](_0x6a51('0x2f'));this['channels'][_0x4d6f62['uniqueid']][_0x19e015][_0x6a51('0x4d')]=_0x4d6f62[_0x6a51('0x29')];this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x4e')]=_0x4d6f62['membername'];this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015]['lastevent']=_0x6a51('0x4f');this['channels'][_0x4d6f62[_0x6a51('0x27')]][_0x19e015][_0x6a51('0x50')]=_0x6a51('0x4f');logger[_0x6a51('0x2a')](_0x6a51('0x51'),_0x4d6f62['uniqueid'],util[_0x6a51('0x2b')](this['channels'][_0x4d6f62[_0x6a51('0x27')]][_0x19e015],{'showHidden':![],'depth':null}));ami[_0x6a51('0x23')](_0x6a51('0x52'),this[_0x6a51('0x8')][_0x4d6f62[_0x6a51('0x27')]][_0x19e015]);}else{logger[_0x6a51('0x2a')](_0x6a51('0x53'),_0x4d6f62['uniqueid']);}}}}}}catch(_0x285e6b){logger['error'](_0x6a51('0x54'),_0x4d6f62[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x285e6b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x13')]=function(_0x462945){try{if(this[_0x6a51('0x24')](_0x462945)){logger[_0x6a51('0x2a')](_0x6a51('0x55'),_0x462945[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x462945,{'showHidden':![],'depth':null}));if(this[_0x6a51('0x8')][_0x462945[_0x6a51('0x27')]]&&this['channels'][_0x462945[_0x6a51('0x27')]][_0x462945['destuniqueid']]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x462945[_0x6a51('0x27')],_0x462945['membername'],_0x462945[_0x6a51('0x29')]);var _0x1a4114=this[_0x6a51('0xb')][_0x462945[_0x6a51('0x2c')]];var _0x5673bc=this[_0x6a51('0x8')][_0x462945['uniqueid']][_0x462945[_0x6a51('0x29')]];_0x5673bc[_0x6a51('0x12')]=!![];_0x5673bc[_0x6a51('0x4c')]=moment()[_0x6a51('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x5673bc[_0x6a51('0x42')]=_0x6a51('0x56');_0x5673bc[_0x6a51('0x50')]=_0x6a51('0x56');var _0x75faf4={'id':_0x1a4114['id'],'name':_0x1a4114[_0x6a51('0x47')],'queue':_0x5673bc[_0x6a51('0x2d')],'uniqueid':_0x5673bc['uniqueid']};logger[_0x6a51('0x2a')](_0x6a51('0x57'),_0x462945[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x75faf4,{'showHidden':![],'depth':null}));this[_0x6a51('0x23')](util[_0x6a51('0x2e')](_0x6a51('0x58'),_0x1a4114[_0x6a51('0x47')]),_0x6a51('0x59'),_0x75faf4);ami[_0x6a51('0x23')](_0x6a51('0x5a'),_0x5673bc);this['channels'][_0x462945['uniqueid']][_0x462945['destuniqueid']]=Object[_0x6a51('0x33')]({},_0x5673bc);}}}catch(_0x5977aa){logger['error'](_0x6a51('0x5b'),_0x462945['uniqueid'],util[_0x6a51('0x2b')](_0x5977aa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x5c')]=function(_0x3c6625){try{if(this[_0x6a51('0x24')](_0x3c6625)){logger[_0x6a51('0x2a')](_0x6a51('0x5d'),_0x3c6625[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x3c6625,{'showHidden':![],'depth':null}));if(this[_0x6a51('0x8')][_0x3c6625[_0x6a51('0x27')]]){for(var _0x4e23f1 in this[_0x6a51('0x8')][_0x3c6625[_0x6a51('0x27')]]){if(this['channels'][_0x3c6625[_0x6a51('0x27')]]['hasOwnProperty'](_0x4e23f1)&&!this['channels'][_0x3c6625['uniqueid']][_0x4e23f1][_0x6a51('0x12')]&&!this[_0x6a51('0x8')][_0x3c6625[_0x6a51('0x27')]][_0x4e23f1][_0x6a51('0x15')]){logger['info'](_0x6a51('0x5e'),_0x3c6625[_0x6a51('0x27')],this[_0x6a51('0x8')][_0x3c6625[_0x6a51('0x27')]][_0x4e23f1]['membername'],_0x4e23f1);this[_0x6a51('0x8')][_0x3c6625['uniqueid']][_0x4e23f1][_0x6a51('0x12')]=!![];this['channels'][_0x3c6625['uniqueid']][_0x4e23f1][_0x6a51('0x4c')]=moment()['format'](_0x6a51('0x2f'));this['channels'][_0x3c6625['uniqueid']][_0x4e23f1]['lastevent']='abandoned';this[_0x6a51('0x8')][_0x3c6625[_0x6a51('0x27')]][_0x4e23f1][_0x6a51('0x50')]=_0x6a51('0x5f');logger[_0x6a51('0x2a')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x3c6625['uniqueid'],util[_0x6a51('0x2b')](this[_0x6a51('0x8')][_0x3c6625[_0x6a51('0x27')]][_0x4e23f1],{'showHidden':![],'depth':null}));ami[_0x6a51('0x23')](_0x6a51('0x60'),this[_0x6a51('0x8')][_0x3c6625[_0x6a51('0x27')]][_0x4e23f1]);}}}}}catch(_0x12bc5d){logger[_0x6a51('0x3a')](_0x6a51('0x61'),_0x3c6625['uniqueid'],util[_0x6a51('0x2b')](_0x12bc5d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x16')]=function(_0x1ac266){try{if(this[_0x6a51('0x24')](_0x1ac266)){logger[_0x6a51('0x2a')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x1ac266[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x1ac266,{'showHidden':![],'depth':null}));if(this[_0x6a51('0x8')][_0x1ac266[_0x6a51('0x27')]]){for(var _0x36ebd5 in this['channels'][_0x1ac266['uniqueid']]){if(this['channels'][_0x1ac266[_0x6a51('0x27')]][_0x6a51('0x3c')](_0x36ebd5)){if(this[_0x6a51('0x8')][_0x1ac266[_0x6a51('0x27')]][_0x36ebd5]['agentconnectAt']&&!this[_0x6a51('0x8')][_0x1ac266[_0x6a51('0x27')]][_0x36ebd5][_0x6a51('0x15')]){logger[_0x6a51('0x25')](_0x6a51('0x62'),_0x1ac266['uniqueid'],this['channels'][_0x1ac266['uniqueid']][_0x36ebd5]['membername'],_0x36ebd5);this['channels'][_0x1ac266['uniqueid']][_0x36ebd5]['agentcomplete']=!![];this['channels'][_0x1ac266['uniqueid']][_0x36ebd5][_0x6a51('0x63')]=moment()[_0x6a51('0x2e')](_0x6a51('0x2f'));this[_0x6a51('0x8')][_0x1ac266[_0x6a51('0x27')]][_0x36ebd5]['lastevent']=_0x6a51('0x64');this[_0x6a51('0x8')][_0x1ac266[_0x6a51('0x27')]][_0x36ebd5][_0x6a51('0x50')]=_0x1ac266[_0x6a51('0x50')]=='transfer'?'agent':_0x1ac266['reason'];this[_0x6a51('0x8')][_0x1ac266[_0x6a51('0x27')]][_0x36ebd5][_0x6a51('0x65')]=_0x1ac266['talktime'];if(this[_0x6a51('0xa')][_0x1ac266[_0x6a51('0x2d')]]&&this[_0x6a51('0xa')][_0x1ac266[_0x6a51('0x2d')]]['acw']){this[_0x6a51('0x8')][_0x1ac266[_0x6a51('0x27')]][_0x36ebd5][_0x6a51('0x66')]=this['voiceQueues'][_0x1ac266[_0x6a51('0x2d')]][_0x6a51('0x67')];this[_0x6a51('0x8')][_0x1ac266['uniqueid']][_0x36ebd5]['agentacw']=!![];}this[_0x6a51('0xb')][_0x1ac266[_0x6a51('0x2c')]]=_['omit'](this['agents'][_0x1ac266[_0x6a51('0x2c')]],[_0x6a51('0x2d'),_0x6a51('0x46')]);logger[_0x6a51('0x2a')](_0x6a51('0x68'),_0x1ac266[_0x6a51('0x27')],util[_0x6a51('0x2b')](this[_0x6a51('0x8')][_0x1ac266['uniqueid']][_0x36ebd5],{'showHidden':![],'depth':null}));ami[_0x6a51('0x23')](_0x6a51('0x69'),this[_0x6a51('0x8')][_0x1ac266[_0x6a51('0x27')]][_0x36ebd5]);logger[_0x6a51('0x2a')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x1ac266[_0x6a51('0x27')],util[_0x6a51('0x2b')]({'id':this[_0x6a51('0xb')][_0x1ac266[_0x6a51('0x2c')]]['id'],'destaccountcode':_0x1ac266[_0x6a51('0x6a')]},{'showHidden':![],'depth':null}));this[_0x6a51('0x23')](util[_0x6a51('0x2e')](_0x6a51('0x58'),_0x1ac266[_0x6a51('0x28')]),'user:agentcomplete',{'id':this[_0x6a51('0xb')][_0x1ac266[_0x6a51('0x2c')]]['id'],'destaccountcode':Number(_0x1ac266[_0x6a51('0x6a')])});}}}}}}catch(_0x178994){logger['error'](_0x6a51('0x6b'),_0x1ac266[_0x6a51('0x27')],util['inspect'](_0x178994,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x6c')]=function(_0x4f46e4){try{if(this[_0x6a51('0x24')](_0x4f46e4)){logger[_0x6a51('0x2a')]('[%s][voiceAgentReport][varset]\x20event:',_0x4f46e4[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x4f46e4,{'showHidden':![],'depth':null}));this[_0x6a51('0x6d')](_0x4f46e4[_0x6a51('0x27')],_['keys'](_0x4f46e4[_0x6a51('0x6e')])[0x0],_0x4f46e4[_0x6a51('0x6f')]);if(this[_0x6a51('0x8')][_0x4f46e4[_0x6a51('0x27')]]){for(var _0xcd7b88 in this[_0x6a51('0x8')][_0x4f46e4[_0x6a51('0x27')]]){if(this['channels'][_0x4f46e4[_0x6a51('0x27')]]['hasOwnProperty'](_0xcd7b88)){logger['info'](_0x6a51('0x70'),_0x4f46e4[_0x6a51('0x27')],_0xcd7b88,_[_0x6a51('0x71')](_0x4f46e4[_0x6a51('0x6e')])[0x0],_0x4f46e4[_0x6a51('0x6f')]);if(_[_0x6a51('0x72')](this[_0x6a51('0x8')][_0x4f46e4[_0x6a51('0x27')]][_0xcd7b88][_0x6a51('0xc')])){this[_0x6a51('0x8')][_0x4f46e4['uniqueid']][_0xcd7b88][_0x6a51('0xc')]={};}this[_0x6a51('0x8')][_0x4f46e4[_0x6a51('0x27')]][_0xcd7b88][_0x6a51('0xc')]=this[_0x6a51('0xc')][_0x4f46e4['uniqueid']];}}}}}catch(_0x41d2c5){logger[_0x6a51('0x3a')](_0x6a51('0x73'),_0x4f46e4['uniqueid'],util[_0x6a51('0x2b')](_0x41d2c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x6d')]=function(_0x16f286,_0x404bc8,_0xd7be6f){var _0x41e680=['rtpaudioqos','rtpaudioqosbridged',_0x6a51('0x74'),_0x6a51('0x75'),_0x6a51('0x76'),_0x6a51('0x77'),_0x6a51('0x78'),_0x6a51('0x79'),_0x6a51('0x7a'),_0x6a51('0x7b'),_0x6a51('0x7c'),'bridgepvtcallid',_0x6a51('0x7d'),_0x6a51('0x7e'),_0x6a51('0x7f'),_0x6a51('0x80'),_0x6a51('0x28'),_0x6a51('0x81'),_0x6a51('0x82')];if(!_[_0x6a51('0x83')](_0x404bc8)&&!_[_0x6a51('0x84')](_0x41e680,_0x404bc8)){if(_[_0x6a51('0x72')](this[_0x6a51('0xc')][_0x16f286])){this[_0x6a51('0xc')][_0x16f286]={};}this[_0x6a51('0xc')][_0x16f286][_0x404bc8]=_0xd7be6f;}};VoiceAgentReport['prototype'][_0x6a51('0x19')]=function(_0x2d38ff){try{if(this[_0x6a51('0x24')](_0x2d38ff)){logger['debug'](_0x6a51('0x85'),_0x2d38ff['uniqueid'],util['inspect'](_0x2d38ff,{'showHidden':![],'depth':null}));if(this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]]){for(var _0x3db463 in this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]]){if(this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]][_0x6a51('0x3c')](_0x3db463)){if(this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]][_0x3db463][_0x6a51('0x50')]==_0x6a51('0x86')&&this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]][_0x3db463][_0x6a51('0x15')]){logger[_0x6a51('0x25')](_0x6a51('0x87'),_0x2d38ff[_0x6a51('0x27')],_0x3db463);this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]][_0x3db463][_0x6a51('0x63')]=moment()['format'](_0x6a51('0x2f'));}}}logger[_0x6a51('0x2a')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x2d38ff[_0x6a51('0x27')],util[_0x6a51('0x2b')](_['values'](this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]]),{'showHidden':![],'depth':null}));ami[_0x6a51('0x23')](_0x6a51('0x88'),_['values'](this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]]));delete this[_0x6a51('0x8')][_0x2d38ff[_0x6a51('0x27')]];}if(this[_0x6a51('0xc')][_0x2d38ff['uniqueid']]){delete this[_0x6a51('0xc')][_0x2d38ff[_0x6a51('0x27')]];}}}catch(_0x4937e5){logger[_0x6a51('0x3a')](_0x6a51('0x89'),_0x2d38ff[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x4937e5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x5dab15){try{if(this[_0x6a51('0x24')](_0x5dab15)){logger[_0x6a51('0x2a')](_0x6a51('0x8a'),_0x5dab15['uniqueid'],util['inspect'](_0x5dab15,{'showHidden':![],'depth':null}));if(this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x8b')]]){for(var _0x104935 in this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x8b')]]){if(this[_0x6a51('0x8')][_0x5dab15['transfereeuniqueid']][_0x6a51('0x3c')](_0x104935)){if(_0x5dab15[_0x6a51('0x8c')]===_0x104935){logger[_0x6a51('0x25')](_0x6a51('0x8d'),_0x5dab15[_0x6a51('0x27')],this['channels'][_0x5dab15['transfereeuniqueid']][_0x104935][_0x6a51('0x28')],_0x104935);var _0x5ea682=moment();this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x8b')]][_0x104935][_0x6a51('0x15')]=!![];this['channels'][_0x5dab15['transfereeuniqueid']][_0x104935][_0x6a51('0x63')]=moment()[_0x6a51('0x2e')](_0x6a51('0x2f'));this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x8b')]][_0x104935][_0x6a51('0x42')]=_0x6a51('0x64');this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x8b')]][_0x104935][_0x6a51('0x50')]=_0x6a51('0x86');this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x8b')]][_0x104935][_0x6a51('0x65')]=_0x5ea682[_0x6a51('0x8e')](this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x8b')]][_0x104935]['agentconnectAt'],_0x6a51('0x8f'));}}}}if(this['channels'][_0x5dab15[_0x6a51('0x90')]]){var _0x21f21b=this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x90')]];this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x90')]]=this['channels'][_0x5dab15[_0x6a51('0x8b')]];this[_0x6a51('0x8')][_0x5dab15[_0x6a51('0x8b')]]=_0x21f21b;}}}catch(_0x4ca485){logger[_0x6a51('0x3a')](_0x6a51('0x91'),_0x5dab15[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x4ca485,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6a51('0x22')][_0x6a51('0x21')]=function(_0x36d885){try{if(this['isNotNull'](_0x36d885)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x36d885[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x36d885,{'showHidden':![],'depth':null}));if(this[_0x6a51('0x8')][_0x36d885[_0x6a51('0x8b')]]){for(var _0x241dc5 in this['channels'][_0x36d885[_0x6a51('0x8b')]]){if(this[_0x6a51('0x8')][_0x36d885[_0x6a51('0x8b')]][_0x6a51('0x3c')](_0x241dc5)){if(_0x36d885[_0x6a51('0x92')]===_0x241dc5){logger[_0x6a51('0x25')](_0x6a51('0x93'),_0x36d885[_0x6a51('0x27')],this[_0x6a51('0x8')][_0x36d885[_0x6a51('0x8b')]][_0x241dc5][_0x6a51('0x28')],_0x241dc5);var _0x5002cb=moment();this[_0x6a51('0x8')][_0x36d885[_0x6a51('0x8b')]][_0x241dc5][_0x6a51('0x15')]=!![];this[_0x6a51('0x8')][_0x36d885[_0x6a51('0x8b')]][_0x241dc5][_0x6a51('0x63')]=_0x5002cb;this['channels'][_0x36d885[_0x6a51('0x8b')]][_0x241dc5][_0x6a51('0x42')]=_0x6a51('0x64');this[_0x6a51('0x8')][_0x36d885['transfereeuniqueid']][_0x241dc5][_0x6a51('0x50')]=_0x6a51('0x86');this['channels'][_0x36d885[_0x6a51('0x8b')]][_0x241dc5]['talktime']=_0x5002cb[_0x6a51('0x8e')](this[_0x6a51('0x8')][_0x36d885['transfereeuniqueid']][_0x241dc5][_0x6a51('0x3d')],'seconds');}}}}}}catch(_0x469abf){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x36d885['uniqueid'],util[_0x6a51('0x2b')](_0x469abf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6a51('0x1b')]=function(_0x386c18){var _0x1eadb9='';try{if(this[_0x6a51('0x24')](_0x386c18)){logger['debug'](_0x6a51('0x94'),_0x386c18[_0x6a51('0x27')],util['inspect'](_0x386c18,{'showHidden':![],'depth':null}));if(_0x386c18[_0x6a51('0x95')]){_0x1eadb9=_0x386c18[_0x6a51('0x95')][_0x6a51('0x96')](0x0,_0x386c18[_0x6a51('0x95')][_0x6a51('0x97')]('-'));if(this[_0x6a51('0xb')][_0x1eadb9]){logger['info'](_0x6a51('0x98'),_0x386c18[_0x6a51('0x27')],_0x1eadb9);this['agents'][_0x1eadb9]['onhold']=!![];}}}}catch(_0x506fcd){logger['error'](_0x6a51('0x99'),_0x386c18[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x506fcd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6a51('0x1d')]=function(_0x494aac){var _0x527ca7='';try{if(this[_0x6a51('0x24')](_0x494aac)){logger[_0x6a51('0x2a')](_0x6a51('0x9a'),_0x494aac[_0x6a51('0x27')],util[_0x6a51('0x2b')](_0x494aac,{'showHidden':![],'depth':null}));if(_0x494aac[_0x6a51('0x95')]){_0x527ca7=_0x494aac[_0x6a51('0x95')]['substring'](0x0,_0x494aac[_0x6a51('0x95')][_0x6a51('0x97')]('-'));if(this[_0x6a51('0xb')][_0x527ca7]){logger[_0x6a51('0x25')](_0x6a51('0x9b'),_0x494aac[_0x6a51('0x27')],_0x527ca7);this['agents'][_0x527ca7][_0x6a51('0x9c')]=![];}}}}catch(_0x28a9c9){logger[_0x6a51('0x3a')](_0x6a51('0x9d'),_0x494aac[_0x6a51('0x27')],util['inspect'](_0x28a9c9,{'showHidden':![],'depth':null}));}};module[_0x6a51('0x9e')]=VoiceAgentReport; \ No newline at end of file +var _0xac0f=['[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','isNotNull','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','merge','interface','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','assign','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','agentconnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','info','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','queue','variables','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','voice','omit','event','privilege','debug'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0xac0f,0x1ba));var _0xfac0=function(_0x2338ef,_0x263a87){_0x2338ef=_0x2338ef-0x0;var _0x1b576e=_0xac0f[_0x2338ef];return _0x1b576e;};'use strict';var _=require(_0xfac0('0x0'));var moment=require(_0xfac0('0x1'));var util=require(_0xfac0('0x2'));var Redis=require('ioredis');var config=require(_0xfac0('0x3'));var logger=require(_0xfac0('0x4'))(_0xfac0('0x5'));var ami=require(_0xfac0('0x6'));config[_0xfac0('0x7')]=_[_0xfac0('0x8')](config[_0xfac0('0x7')],{'host':_0xfac0('0x9'),'port':0x18eb});var io=require(_0xfac0('0xa'))(new Redis(config[_0xfac0('0x7')]));function VoiceAgentReport(_0xb90e04){this[_0xfac0('0xb')]={};this[_0xfac0('0xc')]=_0xb90e04[_0xfac0('0xb')];this[_0xfac0('0xd')]=_0xb90e04['voiceQueues'];this[_0xfac0('0xe')]=_0xb90e04[_0xfac0('0xe')];this['variables']={};ami['on'](_0xfac0('0xf'),this[_0xfac0('0x10')]['bind'](this));ami['on'](_0xfac0('0x11'),this['syncAgentConnect'][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x13'),this[_0xfac0('0x14')][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x15'),this[_0xfac0('0x16')][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x17'),this[_0xfac0('0x18')][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x19'),this[_0xfac0('0x1a')][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x1b'),this[_0xfac0('0x1c')][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x1d'),this[_0xfac0('0x1e')][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x1f'),this[_0xfac0('0x20')][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x21'),this['syncAttendedTransfer'][_0xfac0('0x12')](this));ami['on'](_0xfac0('0x22'),this[_0xfac0('0x23')][_0xfac0('0x12')](this));}VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x25')]=function(_0x3cb7ec,_0x252e1b,_0xc13a77){io['to'](_0x3cb7ec)['emit'](_0x252e1b,_0xc13a77);};VoiceAgentReport['prototype']['isNotNull']=function(_0x59182a){return _0x59182a!==null&&!_[_0xfac0('0x26')](_0x59182a);};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x10')]=function(_0x27072f){try{if(this['isNotNull'](_0x27072f)){logger[_0xfac0('0x27')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x27072f[_0xfac0('0x28')],_0x27072f[_0xfac0('0x29')],_0x27072f['destuniqueid']);logger['debug'](_0xfac0('0x2a'),_0x27072f[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x27072f,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xfac0('0xb')][_0x27072f[_0xfac0('0x28')]])){this['channels'][_0x27072f[_0xfac0('0x28')]]={};}var _0x22dcb3=this[_0xfac0('0xe')][_0x27072f['interface']];var _0x5bb836=this[_0xfac0('0xb')][_0x27072f[_0xfac0('0x28')]][_0x27072f[_0xfac0('0x2c')]];var _0xc3c3b0=this['voiceQueues'][_0x27072f[_0xfac0('0x2d')]];var _0x73982c=this[_0xfac0('0x2e')][_0x27072f[_0xfac0('0x28')]];if(_[_0xfac0('0x26')](_0x5bb836)){_0x5bb836={'agentcalledAt':moment()[_0xfac0('0x2f')](_0xfac0('0x30')),'lastevent':'called','mandatoryDisposition':_0xc3c3b0&&_0xc3c3b0['mandatoryDisposition']?_0xc3c3b0[_0xfac0('0x31')]:![],'type':_0xc3c3b0&&_0xc3c3b0[_0xfac0('0x32')]?_0xc3c3b0[_0xfac0('0x32')]:'inbound','variables':_0x73982c,'motionChannel':_0xfac0('0x33')};}Object['assign'](_0x5bb836,_[_0xfac0('0x34')](_0x27072f,[_0xfac0('0x35'),_0xfac0('0x36')]));this[_0xfac0('0xb')][_0x27072f[_0xfac0('0x28')]][_0x27072f[_0xfac0('0x2c')]]=_0x5bb836;logger[_0xfac0('0x37')](_0xfac0('0x38'),_0x27072f[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x5bb836,{'showHidden':![],'depth':null}));ami[_0xfac0('0x25')](_0xfac0('0x39'),_0x5bb836);var _0x57b09d={'id':_0x22dcb3['id'],'calleridnum':_0x5bb836[_0xfac0('0x3a')],'queue':_0x5bb836['queue'],'variables':_0x5bb836['variables'],'uniqueid':_0x27072f[_0xfac0('0x28')]};logger[_0xfac0('0x37')](_0xfac0('0x3b'),_0x27072f['uniqueid'],util['inspect'](_0x57b09d,{'showHidden':![],'depth':null}));this[_0xfac0('0x25')](util['format']('user:%s',_0x27072f[_0xfac0('0x29')]),_0xfac0('0x3c'),_0x57b09d);}}catch(_0x2f4424){logger['error'](_0xfac0('0x3d'),_0x27072f['uniqueid'],util[_0xfac0('0x2b')](_0x2f4424,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x3e')]=function(_0x54ad12){try{if(this[_0xfac0('0x3f')](_0x54ad12)){if(this['channels'][_0x54ad12[_0xfac0('0x28')]]){for(var _0x412a02 in this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]]){if(this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0xfac0('0x40')](_0x412a02)){if(_0x54ad12[_0xfac0('0x2c')]===_0x412a02){logger['info'](_0xfac0('0x41'),_0x54ad12['uniqueid'],_0x54ad12[_0xfac0('0x29')],_0x54ad12[_0xfac0('0x2c')]);this[_0xfac0('0xb')][_0x54ad12['uniqueid']][_0x412a02][_0xfac0('0x42')]=moment()[_0xfac0('0x2f')](_0xfac0('0x30'));this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x43')]=_0x54ad12[_0xfac0('0x43')];this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02]['connectedlinenum']=_0x54ad12[_0xfac0('0x44')];this['channels'][_0x54ad12['uniqueid']][_0x412a02][_0xfac0('0x45')]=_0x54ad12[_0xfac0('0x45')];this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x46')]=_0x54ad12['destchannelstatedesc'];this['channels'][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x47')]=_0x54ad12[_0xfac0('0x47')];this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x48')]=_0xfac0('0x49');if(this[_0xfac0('0xc')][this['channels'][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x28')]]){var _0x3526e6=this['voiceChannels'][this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x28')]][_0xfac0('0x4a')];this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x4a')]=_0x3526e6;_0x54ad12['routealias']=_0x3526e6;}_[_0xfac0('0x4b')](this['agents'][_0x54ad12[_0xfac0('0x4c')]],_[_0xfac0('0x4d')](_0x54ad12,[_0xfac0('0x2d'),_0xfac0('0x4e'),'routealias']));var _0x3640ba=this['agents'][_0x54ad12[_0xfac0('0x4c')]];var _0x4b1ada={'id':_0x3640ba['id'],'name':_0x3640ba[_0xfac0('0x4f')],'agentconnected':!![],'destaccountcode':_0x3640ba[_0xfac0('0x50')],'destconnectedlinenum':this[_0xfac0('0xb')][_0x54ad12['uniqueid']][_0x54ad12[_0xfac0('0x2c')]][_0xfac0('0x51')],'queue':this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x54ad12[_0xfac0('0x2c')]]['queue'],'routealias':this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x54ad12[_0xfac0('0x2c')]][_0xfac0('0x4a')],'uniqueid':this[_0xfac0('0xb')][_0x54ad12['uniqueid']][_0x54ad12['destuniqueid']][_0xfac0('0x28')]};ami[_0xfac0('0x25')](_0xfac0('0x52'),this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x54ad12[_0xfac0('0x2c')]]);this['emit'](util[_0xfac0('0x2f')]('user:%s',_0x54ad12['membername']),_0xfac0('0x53'),_0x4b1ada);}else if(!this[_0xfac0('0xb')][_0x54ad12['uniqueid']][_0x412a02][_0xfac0('0x13')]&&!this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x17')]){logger[_0xfac0('0x27')](_0xfac0('0x54'),_0x54ad12[_0xfac0('0x28')],this['channels'][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x29')],_0x412a02);this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x13')]=!![];this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x55')]=moment()['format'](_0xfac0('0x30'));this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x56')]=_0x54ad12[_0xfac0('0x2c')];this[_0xfac0('0xb')][_0x54ad12['uniqueid']][_0x412a02][_0xfac0('0x57')]=_0x54ad12['membername'];this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02][_0xfac0('0x48')]=_0xfac0('0x58');this['channels'][_0x54ad12[_0xfac0('0x28')]][_0x412a02]['reason']=_0xfac0('0x58');logger[_0xfac0('0x37')](_0xfac0('0x59'),_0x54ad12[_0xfac0('0x28')],util['inspect'](this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02],{'showHidden':![],'depth':null}));ami[_0xfac0('0x25')](_0xfac0('0x5a'),this[_0xfac0('0xb')][_0x54ad12[_0xfac0('0x28')]][_0x412a02]);}else{logger[_0xfac0('0x37')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x54ad12[_0xfac0('0x28')]);}}}}}}catch(_0x20b829){logger[_0xfac0('0x5b')]('[%s][voiceAgentReport][agentconnect]',_0x54ad12['uniqueid'],util[_0xfac0('0x2b')](_0x20b829,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x14')]=function(_0x526358){try{if(this[_0xfac0('0x3f')](_0x526358)){logger[_0xfac0('0x37')](_0xfac0('0x5c'),_0x526358[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x526358,{'showHidden':![],'depth':null}));if(this['channels'][_0x526358['uniqueid']]&&this[_0xfac0('0xb')][_0x526358[_0xfac0('0x28')]][_0x526358['destuniqueid']]){logger[_0xfac0('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x526358[_0xfac0('0x28')],_0x526358[_0xfac0('0x29')],_0x526358['destuniqueid']);var _0x20f20f=this[_0xfac0('0xe')][_0x526358[_0xfac0('0x4c')]];var _0x71de52=this[_0xfac0('0xb')][_0x526358[_0xfac0('0x28')]][_0x526358['destuniqueid']];_0x71de52[_0xfac0('0x13')]=!![];_0x71de52[_0xfac0('0x55')]=moment()[_0xfac0('0x2f')](_0xfac0('0x30'));_0x71de52[_0xfac0('0x48')]=_0xfac0('0x5d');_0x71de52[_0xfac0('0x5e')]=_0xfac0('0x5d');var _0x7696a3={'id':_0x20f20f['id'],'name':_0x20f20f['name'],'queue':_0x71de52[_0xfac0('0x2d')],'uniqueid':_0x71de52[_0xfac0('0x28')]};logger['debug'](_0xfac0('0x5f'),_0x526358[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x7696a3,{'showHidden':![],'depth':null}));this[_0xfac0('0x25')](util[_0xfac0('0x2f')]('user:%s',_0x20f20f[_0xfac0('0x4f')]),_0xfac0('0x60'),_0x7696a3);ami['emit']('custom:agentringnoanswer',_0x71de52);this[_0xfac0('0xb')][_0x526358[_0xfac0('0x28')]][_0x526358[_0xfac0('0x2c')]]=Object[_0xfac0('0x61')]({},_0x71de52);}}}catch(_0x29641e){logger[_0xfac0('0x5b')](_0xfac0('0x62'),_0x526358['uniqueid'],util[_0xfac0('0x2b')](_0x29641e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x16')]=function(_0x206811){try{if(this['isNotNull'](_0x206811)){logger['debug'](_0xfac0('0x63'),_0x206811[_0xfac0('0x28')],util['inspect'](_0x206811,{'showHidden':![],'depth':null}));if(this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]]){for(var _0x471cee in this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]]){if(this['channels'][_0x206811[_0xfac0('0x28')]][_0xfac0('0x40')](_0x471cee)&&!this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]][_0x471cee][_0xfac0('0x13')]&&!this[_0xfac0('0xb')][_0x206811['uniqueid']][_0x471cee][_0xfac0('0x17')]){logger['info'](_0xfac0('0x64'),_0x206811['uniqueid'],this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]][_0x471cee]['membername'],_0x471cee);this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]][_0x471cee]['agentringnoanswer']=!![];this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]][_0x471cee][_0xfac0('0x55')]=moment()[_0xfac0('0x2f')](_0xfac0('0x30'));this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]][_0x471cee][_0xfac0('0x48')]=_0xfac0('0x65');this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]][_0x471cee][_0xfac0('0x5e')]=_0xfac0('0x65');logger[_0xfac0('0x37')](_0xfac0('0x66'),_0x206811[_0xfac0('0x28')],util[_0xfac0('0x2b')](this['channels'][_0x206811[_0xfac0('0x28')]][_0x471cee],{'showHidden':![],'depth':null}));ami['emit'](_0xfac0('0x67'),this[_0xfac0('0xb')][_0x206811[_0xfac0('0x28')]][_0x471cee]);}}}}}catch(_0x123253){logger[_0xfac0('0x5b')](_0xfac0('0x68'),_0x206811[_0xfac0('0x28')],util['inspect'](_0x123253,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x18')]=function(_0x33e8d3){try{if(this[_0xfac0('0x3f')](_0x33e8d3)){logger[_0xfac0('0x37')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x33e8d3[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x33e8d3,{'showHidden':![],'depth':null}));if(this['channels'][_0x33e8d3[_0xfac0('0x28')]]){for(var _0x4e0ed0 in this['channels'][_0x33e8d3[_0xfac0('0x28')]]){if(this[_0xfac0('0xb')][_0x33e8d3[_0xfac0('0x28')]][_0xfac0('0x40')](_0x4e0ed0)){if(this[_0xfac0('0xb')][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0][_0xfac0('0x42')]&&!this[_0xfac0('0xb')][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0][_0xfac0('0x17')]){logger['info'](_0xfac0('0x69'),_0x33e8d3[_0xfac0('0x28')],this['channels'][_0x33e8d3['uniqueid']][_0x4e0ed0]['membername'],_0x4e0ed0);this[_0xfac0('0xb')][_0x33e8d3['uniqueid']][_0x4e0ed0][_0xfac0('0x17')]=!![];this[_0xfac0('0xb')][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0][_0xfac0('0x6a')]=moment()['format'](_0xfac0('0x30'));this[_0xfac0('0xb')][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0][_0xfac0('0x48')]=_0xfac0('0x6b');this['channels'][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0][_0xfac0('0x5e')]=_0x33e8d3[_0xfac0('0x5e')]==_0xfac0('0x6c')?'agent':_0x33e8d3['reason'];this[_0xfac0('0xb')][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0]['talktime']=_0x33e8d3[_0xfac0('0x6d')];if(this[_0xfac0('0xd')][_0x33e8d3[_0xfac0('0x2d')]]&&this[_0xfac0('0xd')][_0x33e8d3[_0xfac0('0x2d')]][_0xfac0('0x6e')]){this['channels'][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0][_0xfac0('0x6f')]=this[_0xfac0('0xd')][_0x33e8d3[_0xfac0('0x2d')]]['acwTimeout'];this[_0xfac0('0xb')][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0]['agentacw']=!![];}this[_0xfac0('0xe')][_0x33e8d3['interface']]=_['omit'](this['agents'][_0x33e8d3[_0xfac0('0x4c')]],[_0xfac0('0x2d'),'destconnectedlinenum']);logger[_0xfac0('0x37')](_0xfac0('0x70'),_0x33e8d3[_0xfac0('0x28')],util[_0xfac0('0x2b')](this[_0xfac0('0xb')][_0x33e8d3['uniqueid']][_0x4e0ed0],{'showHidden':![],'depth':null}));ami[_0xfac0('0x25')](_0xfac0('0x71'),this[_0xfac0('0xb')][_0x33e8d3[_0xfac0('0x28')]][_0x4e0ed0]);logger[_0xfac0('0x37')](_0xfac0('0x72'),_0x33e8d3[_0xfac0('0x28')],util['inspect']({'id':this['agents'][_0x33e8d3[_0xfac0('0x4c')]]['id'],'destaccountcode':_0x33e8d3[_0xfac0('0x73')]},{'showHidden':![],'depth':null}));this[_0xfac0('0x25')](util['format']('user:%s',_0x33e8d3[_0xfac0('0x29')]),_0xfac0('0x74'),{'id':this[_0xfac0('0xe')][_0x33e8d3['interface']]['id'],'destaccountcode':Number(_0x33e8d3[_0xfac0('0x73')])});}}}}}}catch(_0x591740){logger['error'](_0xfac0('0x75'),_0x33e8d3[_0xfac0('0x28')],util['inspect'](_0x591740,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x1a')]=function(_0x97a432){try{if(this[_0xfac0('0x3f')](_0x97a432)){logger[_0xfac0('0x37')](_0xfac0('0x76'),_0x97a432[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x97a432,{'showHidden':![],'depth':null}));this[_0xfac0('0x77')](_0x97a432[_0xfac0('0x28')],_[_0xfac0('0x78')](_0x97a432[_0xfac0('0x79')])[0x0],_0x97a432['value']);if(this[_0xfac0('0xb')][_0x97a432[_0xfac0('0x28')]]){for(var _0xdd1938 in this[_0xfac0('0xb')][_0x97a432[_0xfac0('0x28')]]){if(this[_0xfac0('0xb')][_0x97a432[_0xfac0('0x28')]]['hasOwnProperty'](_0xdd1938)){logger[_0xfac0('0x27')](_0xfac0('0x7a'),_0x97a432[_0xfac0('0x28')],_0xdd1938,_[_0xfac0('0x78')](_0x97a432[_0xfac0('0x79')])[0x0],_0x97a432[_0xfac0('0x7b')]);if(_['isUndefined'](this[_0xfac0('0xb')][_0x97a432[_0xfac0('0x28')]][_0xdd1938][_0xfac0('0x2e')])){this[_0xfac0('0xb')][_0x97a432[_0xfac0('0x28')]][_0xdd1938][_0xfac0('0x2e')]={};}this[_0xfac0('0xb')][_0x97a432[_0xfac0('0x28')]][_0xdd1938][_0xfac0('0x2e')]=this['variables'][_0x97a432[_0xfac0('0x28')]];}}}}}catch(_0x55b3f1){logger[_0xfac0('0x5b')](_0xfac0('0x7c'),_0x97a432['uniqueid'],util[_0xfac0('0x2b')](_0x55b3f1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x77')]=function(_0x40037e,_0x403f2a,_0x3c959f){var _0x47a2ba=[_0xfac0('0x7d'),_0xfac0('0x7e'),_0xfac0('0x7f'),_0xfac0('0x80'),'rtpaudioqosloss',_0xfac0('0x81'),_0xfac0('0x82'),'rtpaudioqosrttbridged','sipcallid','sipuri',_0xfac0('0x83'),_0xfac0('0x84'),_0xfac0('0x85'),_0xfac0('0x86'),_0xfac0('0x87'),_0xfac0('0x88'),_0xfac0('0x29'),'memberpenalty',_0xfac0('0x89')];if(!_[_0xfac0('0x8a')](_0x403f2a)&&!_['includes'](_0x47a2ba,_0x403f2a)){if(_[_0xfac0('0x26')](this[_0xfac0('0x2e')][_0x40037e])){this[_0xfac0('0x2e')][_0x40037e]={};}this[_0xfac0('0x2e')][_0x40037e][_0x403f2a]=_0x3c959f;}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x1c')]=function(_0x3105a1){try{if(this[_0xfac0('0x3f')](_0x3105a1)){logger['debug'](_0xfac0('0x8b'),_0x3105a1[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x3105a1,{'showHidden':![],'depth':null}));if(this[_0xfac0('0xb')][_0x3105a1[_0xfac0('0x28')]]){for(var _0x46ebd0 in this[_0xfac0('0xb')][_0x3105a1[_0xfac0('0x28')]]){if(this[_0xfac0('0xb')][_0x3105a1[_0xfac0('0x28')]]['hasOwnProperty'](_0x46ebd0)){if(this[_0xfac0('0xb')][_0x3105a1[_0xfac0('0x28')]][_0x46ebd0][_0xfac0('0x5e')]==_0xfac0('0x6c')&&this[_0xfac0('0xb')][_0x3105a1[_0xfac0('0x28')]][_0x46ebd0][_0xfac0('0x17')]){logger[_0xfac0('0x27')](_0xfac0('0x8c'),_0x3105a1[_0xfac0('0x28')],_0x46ebd0);this[_0xfac0('0xb')][_0x3105a1['uniqueid']][_0x46ebd0][_0xfac0('0x6a')]=moment()[_0xfac0('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xfac0('0x37')](_0xfac0('0x8d'),_0x3105a1[_0xfac0('0x28')],util[_0xfac0('0x2b')](_['values'](this['channels'][_0x3105a1['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xfac0('0x25')](_0xfac0('0x8e'),_[_0xfac0('0x8f')](this[_0xfac0('0xb')][_0x3105a1[_0xfac0('0x28')]]));delete this[_0xfac0('0xb')][_0x3105a1['uniqueid']];}if(this[_0xfac0('0x2e')][_0x3105a1[_0xfac0('0x28')]]){delete this[_0xfac0('0x2e')][_0x3105a1['uniqueid']];}}}catch(_0x5e76eb){logger[_0xfac0('0x5b')](_0xfac0('0x90'),_0x3105a1['uniqueid'],util[_0xfac0('0x2b')](_0x5e76eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x1a104c){try{if(this['isNotNull'](_0x1a104c)){logger[_0xfac0('0x37')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1a104c[_0xfac0('0x28')],util['inspect'](_0x1a104c,{'showHidden':![],'depth':null}));if(this[_0xfac0('0xb')][_0x1a104c[_0xfac0('0x91')]]){for(var _0x5756cd in this[_0xfac0('0xb')][_0x1a104c[_0xfac0('0x91')]]){if(this[_0xfac0('0xb')][_0x1a104c['transfereeuniqueid']]['hasOwnProperty'](_0x5756cd)){if(_0x1a104c[_0xfac0('0x92')]===_0x5756cd){logger[_0xfac0('0x27')](_0xfac0('0x93'),_0x1a104c[_0xfac0('0x28')],this['channels'][_0x1a104c[_0xfac0('0x91')]][_0x5756cd]['membername'],_0x5756cd);var _0x1da635=moment();this[_0xfac0('0xb')][_0x1a104c['transfereeuniqueid']][_0x5756cd][_0xfac0('0x17')]=!![];this['channels'][_0x1a104c[_0xfac0('0x91')]][_0x5756cd]['agentcompleteAt']=moment()[_0xfac0('0x2f')](_0xfac0('0x30'));this['channels'][_0x1a104c[_0xfac0('0x91')]][_0x5756cd][_0xfac0('0x48')]=_0xfac0('0x6b');this[_0xfac0('0xb')][_0x1a104c[_0xfac0('0x91')]][_0x5756cd][_0xfac0('0x5e')]=_0xfac0('0x6c');this['channels'][_0x1a104c[_0xfac0('0x91')]][_0x5756cd][_0xfac0('0x6d')]=_0x1da635[_0xfac0('0x94')](this['channels'][_0x1a104c[_0xfac0('0x91')]][_0x5756cd][_0xfac0('0x42')],_0xfac0('0x95'));}}}}if(this['channels'][_0x1a104c[_0xfac0('0x96')]]){var _0xef2f15=this[_0xfac0('0xb')][_0x1a104c['secondtransfereruniqueid']];this[_0xfac0('0xb')][_0x1a104c['secondtransfereruniqueid']]=this[_0xfac0('0xb')][_0x1a104c['transfereeuniqueid']];this[_0xfac0('0xb')][_0x1a104c['transfereeuniqueid']]=_0xef2f15;}}}catch(_0x2bb4ce){logger['error'](_0xfac0('0x97'),_0x1a104c[_0xfac0('0x28')],util['inspect'](_0x2bb4ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x23')]=function(_0x396faf){try{if(this[_0xfac0('0x3f')](_0x396faf)){logger[_0xfac0('0x37')](_0xfac0('0x98'),_0x396faf[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x396faf,{'showHidden':![],'depth':null}));if(this['channels'][_0x396faf[_0xfac0('0x91')]]){for(var _0x55e552 in this[_0xfac0('0xb')][_0x396faf['transfereeuniqueid']]){if(this[_0xfac0('0xb')][_0x396faf[_0xfac0('0x91')]]['hasOwnProperty'](_0x55e552)){if(_0x396faf[_0xfac0('0x99')]===_0x55e552){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x396faf['uniqueid'],this['channels'][_0x396faf[_0xfac0('0x91')]][_0x55e552][_0xfac0('0x29')],_0x55e552);var _0x1ca7ce=moment();this[_0xfac0('0xb')][_0x396faf[_0xfac0('0x91')]][_0x55e552][_0xfac0('0x17')]=!![];this['channels'][_0x396faf['transfereeuniqueid']][_0x55e552][_0xfac0('0x6a')]=_0x1ca7ce;this[_0xfac0('0xb')][_0x396faf[_0xfac0('0x91')]][_0x55e552][_0xfac0('0x48')]=_0xfac0('0x6b');this[_0xfac0('0xb')][_0x396faf[_0xfac0('0x91')]][_0x55e552]['reason']=_0xfac0('0x6c');this[_0xfac0('0xb')][_0x396faf[_0xfac0('0x91')]][_0x55e552][_0xfac0('0x6d')]=_0x1ca7ce[_0xfac0('0x94')](this['channels'][_0x396faf[_0xfac0('0x91')]][_0x55e552][_0xfac0('0x42')],_0xfac0('0x95'));}}}}}}catch(_0x44d282){logger[_0xfac0('0x5b')](_0xfac0('0x9a'),_0x396faf[_0xfac0('0x28')],util['inspect'](_0x44d282,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x1e')]=function(_0x28dd8d){var _0x14701f='';try{if(this[_0xfac0('0x3f')](_0x28dd8d)){logger[_0xfac0('0x37')](_0xfac0('0x9b'),_0x28dd8d[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x28dd8d,{'showHidden':![],'depth':null}));if(_0x28dd8d[_0xfac0('0x9c')]){_0x14701f=_0x28dd8d['channel'][_0xfac0('0x9d')](0x0,_0x28dd8d[_0xfac0('0x9c')][_0xfac0('0x9e')]('-'));if(this[_0xfac0('0xe')][_0x14701f]){logger[_0xfac0('0x27')](_0xfac0('0x9f'),_0x28dd8d[_0xfac0('0x28')],_0x14701f);this['agents'][_0x14701f][_0xfac0('0xa0')]=!![];}}}}catch(_0x3e5126){logger[_0xfac0('0x5b')](_0xfac0('0xa1'),_0x28dd8d[_0xfac0('0x28')],util[_0xfac0('0x2b')](_0x3e5126,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfac0('0x24')][_0xfac0('0x20')]=function(_0x5b26e4){var _0x9aba49='';try{if(this[_0xfac0('0x3f')](_0x5b26e4)){logger[_0xfac0('0x37')](_0xfac0('0xa2'),_0x5b26e4[_0xfac0('0x28')],util['inspect'](_0x5b26e4,{'showHidden':![],'depth':null}));if(_0x5b26e4['channel']){_0x9aba49=_0x5b26e4['channel'][_0xfac0('0x9d')](0x0,_0x5b26e4[_0xfac0('0x9c')]['lastIndexOf']('-'));if(this[_0xfac0('0xe')][_0x9aba49]){logger[_0xfac0('0x27')](_0xfac0('0xa3'),_0x5b26e4['uniqueid'],_0x9aba49);this[_0xfac0('0xe')][_0x9aba49]['onhold']=![];}}}}catch(_0x5bbd2a){logger[_0xfac0('0x5b')](_0xfac0('0xa4'),_0x5b26e4[_0xfac0('0x28')],util['inspect'](_0x5bbd2a,{'showHidden':![],'depth':null}));}};module[_0xfac0('0xa5')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index c9b7717..efae821 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 _0x41f9=['../model/channel','../rpc/setting','set','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','syncNewChannel','newstate','syncNewState','varset','hangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','name','accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','context','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','keys','from-sip','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','subtract','duration','seconds','lastdata','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','connectedlinename','channel','channelstate','holdtime','diff','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','.wav49','replace','find','monitors','push','rec','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\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','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','syncHangup','destinationchannel','cause-txt','endtime','billableseconds','omit','user:agentcomplete','length','resolve','then','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transferType','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','ATTENDED','some','origtransfererlinkedid','transferToInternal','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','path','../../../config/environment','../../../config/logger','ami'];(function(_0x160fea,_0x3fe078){var _0x523561=function(_0x69dff9){while(--_0x69dff9){_0x160fea['push'](_0x160fea['shift']());}};_0x523561(++_0x3fe078);}(_0x41f9,0x179));var _0x941f=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x41f9[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var moment=require(_0x941f('0x0'));var util=require('util');var path=require(_0x941f('0x1'));var Redis=require('ioredis');var config=require(_0x941f('0x2'));var logger=require(_0x941f('0x3'))(_0x941f('0x4'));var ami=require('../ami');var Channel=require(_0x941f('0x5'));var RpcSetting=require(_0x941f('0x6'));var applications=[_0x941f('0x7'),_0x941f('0x8'),_0x941f('0x9'),_0x941f('0xa'),_0x941f('0xb'),'voicemail'];var dispositions=[_0x941f('0xc'),_0x941f('0xd'),_0x941f('0xd'),_0x941f('0xc'),_0x941f('0xc'),_0x941f('0xc'),_0x941f('0xe'),'BUSY','FAILED',_0x941f('0xd'),_0x941f('0xd')];config[_0x941f('0xf')]=_[_0x941f('0x10')](config[_0x941f('0xf')],{'host':_0x941f('0x11'),'port':0x18eb});var io=require(_0x941f('0x12'))(new Redis(config['redis']));function VoiceCallReport(_0x5761f5){this[_0x941f('0x13')]=_0x5761f5[_0x941f('0x13')];this['agents']=_0x5761f5[_0x941f('0x14')];this['blindTransfers']={};ami['on'](_0x941f('0x15'),this['syncNewExten'][_0x941f('0x16')](this));ami['on'](_0x941f('0x17'),this[_0x941f('0x18')]['bind'](this));ami['on']('newchannel',this[_0x941f('0x19')][_0x941f('0x16')](this));ami['on'](_0x941f('0x1a'),this[_0x941f('0x1b')][_0x941f('0x16')](this));ami['on'](_0x941f('0x1c'),this['syncVarSet'][_0x941f('0x16')](this));ami['on'](_0x941f('0x1d'),this['syncHangup'][_0x941f('0x16')](this));ami['on']('newcallerid',this[_0x941f('0x1e')]['bind'](this));ami['on'](_0x941f('0x1f'),this[_0x941f('0x20')][_0x941f('0x16')](this));ami['on']('blindtransfer',this[_0x941f('0x21')][_0x941f('0x16')](this));ami['on'](_0x941f('0x22'),this['syncMusicOnHoldStart'][_0x941f('0x16')](this));ami['on'](_0x941f('0x23'),this[_0x941f('0x24')][_0x941f('0x16')](this));try{logger[_0x941f('0x25')](_0x941f('0x26'));ami[_0x941f('0x27')]();}catch(_0x15e3bc){logger[_0x941f('0x28')]('[voiceCallReport][coreshowchannels]',util[_0x941f('0x29')](_0x15e3bc,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x941f('0x2a')][_0x941f('0x2b')]=function(_0x2f076c){return _0x2f076c!==null&&!_[_0x941f('0x2c')](_0x2f076c);};VoiceCallReport[_0x941f('0x2a')][_0x941f('0x2d')]=function(_0x29b2a1,_0x42e1f3,_0x345e0b){io['to'](_0x29b2a1)[_0x941f('0x2d')](_0x42e1f3,_0x345e0b);};VoiceCallReport[_0x941f('0x2a')][_0x941f('0x1e')]=function(_0x181797){try{if(this[_0x941f('0x2b')](_0x181797)){logger[_0x941f('0x25')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x181797[_0x941f('0x2e')],_0x181797[_0x941f('0x2f')],_0x181797[_0x941f('0x30')]);logger[_0x941f('0x31')](_0x941f('0x32'),_0x181797[_0x941f('0x2e')],util[_0x941f('0x29')](_0x181797,{'showHidden':![],'depth':null}));if(_0x181797[_0x941f('0x2e')]===_0x181797[_0x941f('0x33')]){if(!_['isUndefined'](this[_0x941f('0x13')][_0x181797[_0x941f('0x2e')]])){_[_0x941f('0x34')](this['channels'][_0x181797[_0x941f('0x2e')]],_[_0x941f('0x35')](_0x181797,_['keys'](this[_0x941f('0x13')][_0x181797['uniqueid']])));}}if(_0x181797['context']==='from-sip'){var _0x51a6b5=this[_0x941f('0x14')][_0x181797['channel'][_0x941f('0x36')]('-')[0x0]];if(_0x51a6b5){if(_0x181797[_0x941f('0x37')]==_0x941f('0x38')){_0x51a6b5[_0x941f('0x39')]=_0x181797[_0x941f('0x3a')];this[_0x941f('0x2d')](util[_0x941f('0x3b')]('user:%s',_0x51a6b5[_0x941f('0x3c')]),'user:agentconnect',{'id':_0x51a6b5['id'],'destaccountcode':_0x51a6b5[_0x941f('0x3d')],'destconnectedlinenum':_0x181797['connectedlinenum']});}}}}}catch(_0x51356f){logger[_0x941f('0x28')]('[%s][voiceCallReport][newcallerid]',_0x181797[_0x941f('0x2e')],util[_0x941f('0x29')](_0x51356f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x941f('0x2a')]['syncNewChannel']=function(_0x10fe60){try{if(this['isNotNull'](_0x10fe60)){logger[_0x941f('0x31')](_0x941f('0x3e'),_0x10fe60[_0x941f('0x2e')],util[_0x941f('0x29')](_0x10fe60,{'showHidden':![],'depth':null}));if(this['channels'][_0x10fe60[_0x941f('0x2e')]]){return;}if(_0x10fe60['channel']===_0x941f('0x3f')){return;}if(_0x10fe60[_0x941f('0x2e')]!==_0x10fe60[_0x941f('0x33')]&&!this[_0x941f('0x40')][_0x10fe60[_0x941f('0x33')]]){return;}logger[_0x941f('0x25')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x10fe60[_0x941f('0x2e')],_0x10fe60[_0x941f('0x41')],_0x10fe60[_0x941f('0x37')]);this[_0x941f('0x13')][_0x10fe60[_0x941f('0x2e')]]=new Channel();this[_0x941f('0x13')][_0x10fe60[_0x941f('0x2e')]][_0x941f('0x42')]=moment()[_0x941f('0x3b')](_0x941f('0x43'));this[_0x941f('0x13')][_0x10fe60[_0x941f('0x2e')]][_0x941f('0x44')]=dispositions[_[_0x941f('0x45')](_0x10fe60['channelstate'])];_[_0x941f('0x34')](this[_0x941f('0x13')][_0x10fe60[_0x941f('0x2e')]],_[_0x941f('0x35')](_0x10fe60,_[_0x941f('0x46')](this[_0x941f('0x13')][_0x10fe60[_0x941f('0x2e')]])));if(_0x10fe60[_0x941f('0x41')]===_0x941f('0x47')){var _0x32ad24=this[_0x941f('0x14')][_0x10fe60['channel'][_0x941f('0x36')]('-')[0x0]];if(_0x32ad24&&typeof _0x32ad24[_0x941f('0x39')]===_0x941f('0x48')){_0x32ad24[_0x941f('0x39')]=_0x10fe60['exten'];logger['debug'](_0x941f('0x49'),_0x10fe60[_0x941f('0x2e')],util[_0x941f('0x29')]({'id':_0x32ad24['id'],'destaccountcode':_0x32ad24['accountcode'],'destconnectedlinenum':_0x10fe60['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0x941f('0x3b')](_0x941f('0x4a'),_0x32ad24[_0x941f('0x3c')]),_0x941f('0x4b'),{'id':_0x32ad24['id'],'destaccountcode':_0x32ad24[_0x941f('0x3d')],'destconnectedlinenum':_0x10fe60[_0x941f('0x37')]});}}}}catch(_0x40612a){logger['error'](_0x941f('0x4c'),_0x10fe60[_0x941f('0x2e')],util[_0x941f('0x29')](_0x40612a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x941f('0x2a')][_0x941f('0x18')]=function(_0x2d965c){try{if(this[_0x941f('0x2b')](_0x2d965c)){logger['debug'](_0x941f('0x4d'),_0x2d965c[_0x941f('0x2e')],util[_0x941f('0x29')](_0x2d965c,{'showHidden':![],'depth':null}));if(_0x2d965c['channel']===_0x941f('0x3f')||_0x2d965c['exten']==='h')return;if(_0x2d965c[_0x941f('0x2e')]===_0x2d965c[_0x941f('0x33')]||this['blindTransfers'][_0x2d965c[_0x941f('0x33')]]){_0x2d965c[_0x941f('0x4e')]=_0x2d965c[_0x941f('0x4e')]?_0x2d965c[_0x941f('0x4e')][_0x941f('0x4f')]():undefined;_0x2d965c[_0x941f('0x50')]=_0x2d965c[_0x941f('0x51')]||_0x2d965c['applicationdata'];if(_0x2d965c['appdata']&&!_0x2d965c[_0x941f('0x51')][_0x941f('0x52')]('CDR(routeAlias)')&&_0x2d965c[_0x941f('0x4e')]!=='queue'){_0x2d965c['applicationdata']=_0x2d965c[_0x941f('0x50')][_0x941f('0x4f')]();}logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2d965c[_0x941f('0x2e')],_0x2d965c['application'],_0x2d965c['applicationdata']);if(_[_0x941f('0x2c')](this[_0x941f('0x13')][_0x2d965c[_0x941f('0x2e')]])){this[_0x941f('0x13')][_0x2d965c[_0x941f('0x2e')]]=new Channel();this[_0x941f('0x13')][_0x2d965c[_0x941f('0x2e')]]['starttime']=_0x2d965c['duration']?moment()[_0x941f('0x53')](moment['duration'](_0x2d965c[_0x941f('0x54')])[_0x941f('0x55')](),_0x941f('0x55'))['format'](_0x941f('0x43')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x941f('0x13')][_0x2d965c[_0x941f('0x2e')]][_0x941f('0x44')]='NO\x20ANSWER';}_[_0x941f('0x34')](this['channels'][_0x2d965c[_0x941f('0x2e')]],_['pick'](_0x2d965c,_[_0x941f('0x46')](this['channels'][_0x2d965c[_0x941f('0x2e')]])));if(_['includes'](applications,_0x2d965c[_0x941f('0x4e')])){this['channels'][_0x2d965c[_0x941f('0x2e')]]['lastapplication']=_0x2d965c[_0x941f('0x4e')];this[_0x941f('0x13')][_0x2d965c['uniqueid']][_0x941f('0x56')]=_0x2d965c['applicationdata'];if(_0x2d965c[_0x941f('0x4e')]===_0x941f('0x7')&&_['startsWith'](_0x2d965c[_0x941f('0x50')][_0x941f('0x4f')](),_0x941f('0x57'))){var _0xc30573=_0x2d965c[_0x941f('0x50')][_0x941f('0x36')]('=');var _0x24d2c2=_0xc30573[0x0][_0x941f('0x4f')]()[_0x941f('0x58')](/cdr\((.*)\)/);if(_0x24d2c2){if(_0x24d2c2[0x1]===_0x941f('0x59')&&!_[_0x941f('0x5a')](this[_0x941f('0x13')][_0x2d965c[_0x941f('0x2e')]][_0x24d2c2[0x1]]))return;this['channels'][_0x2d965c[_0x941f('0x2e')]][_0x24d2c2[0x1]]=_0xc30573[0x1];}}else if(_0x2d965c[_0x941f('0x4e')]===_0x941f('0x8')){this[_0x941f('0x13')][_0x2d965c[_0x941f('0x2e')]]['queue']=_0x2d965c[_0x941f('0x50')][_0x941f('0x36')](',')[0x0];}}}}}catch(_0x51a0d7){logger[_0x941f('0x28')](_0x941f('0x5b'),_0x2d965c['uniqueid'],util[_0x941f('0x29')](_0x51a0d7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x3bb2c7){try{if(this[_0x941f('0x2b')](_0x3bb2c7)){logger[_0x941f('0x25')](_0x941f('0x5c'),_0x3bb2c7['uniqueid'],_0x3bb2c7[_0x941f('0x33')],_0x3bb2c7[_0x941f('0x2f')],_0x3bb2c7[_0x941f('0x30')]);logger[_0x941f('0x31')]('[%s][voiceCallReport][newstate]\x20event:',_0x3bb2c7[_0x941f('0x2e')],util['inspect'](_0x3bb2c7,{'showHidden':![],'depth':null}));if(_0x3bb2c7['channelstate']!=='6')return;var _0x895f71=this['agents'][_0x3bb2c7['channel'][_0x941f('0x36')]('-')[0x0]];if(_0x3bb2c7[_0x941f('0x2e')]!==_0x3bb2c7[_0x941f('0x33')]){var _0x9ae009=moment();if(this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x33')]]){if(!this[_0x941f('0x13')][_0x3bb2c7['linkedid']][_0x941f('0x5d')]){this['channels'][_0x3bb2c7[_0x941f('0x33')]][_0x941f('0x5d')]=!![];this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x33')]][_0x941f('0x5e')]=_0x9ae009[_0x941f('0x3b')](_0x941f('0x43'));if(this['channels'][_0x3bb2c7[_0x941f('0x33')]][_0x941f('0x42')]){this[_0x941f('0x13')][_0x3bb2c7['linkedid']]['holdtime']=_0x9ae009['diff'](this['channels'][_0x3bb2c7[_0x941f('0x33')]][_0x941f('0x42')],'seconds');}}this[_0x941f('0x13')][_0x3bb2c7['linkedid']]['linkedid']=_0x3bb2c7[_0x941f('0x2e')];if(_0x3bb2c7[_0x941f('0x30')]!==_0x941f('0x38')){this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x33')]][_0x941f('0x3a')]=_0x3bb2c7[_0x941f('0x30')];}this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x33')]][_0x941f('0x5f')]=_0x3bb2c7[_0x941f('0x2f')];this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x33')]]['destinationchannel']=_0x3bb2c7[_0x941f('0x60')];this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x33')]]['disposition']=dispositions[_['toNumber'](_0x3bb2c7[_0x941f('0x61')])];if(_0x895f71){this[_0x941f('0x13')][_0x3bb2c7['linkedid']]['UserId']=_0x895f71['id'];this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x33')]]['membername']=_0x895f71[_0x941f('0x3c')];}}if(this[_0x941f('0x13')][_0x3bb2c7['uniqueid']]){if(!this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x2e')]][_0x941f('0x5d')]){this[_0x941f('0x13')][_0x3bb2c7['uniqueid']][_0x941f('0x5d')]=!![];this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x2e')]]['answertime']=_0x9ae009[_0x941f('0x3b')](_0x941f('0x43'));if(this['channels'][_0x3bb2c7[_0x941f('0x2e')]][_0x941f('0x42')]){this['channels'][_0x3bb2c7[_0x941f('0x2e')]][_0x941f('0x62')]=_0x9ae009[_0x941f('0x63')](this['channels'][_0x3bb2c7[_0x941f('0x2e')]][_0x941f('0x42')],_0x941f('0x55'));}}if(_0x3bb2c7[_0x941f('0x30')]!==_0x941f('0x38')){this[_0x941f('0x13')][_0x3bb2c7['uniqueid']][_0x941f('0x3a')]=_0x3bb2c7[_0x941f('0x30')];}this[_0x941f('0x13')][_0x3bb2c7['uniqueid']][_0x941f('0x5f')]=_0x3bb2c7['calleridname'];this[_0x941f('0x13')][_0x3bb2c7['uniqueid']]['destinationchannel']=_0x3bb2c7[_0x941f('0x60')];this['channels'][_0x3bb2c7[_0x941f('0x2e')]][_0x941f('0x44')]=dispositions[_[_0x941f('0x45')](_0x3bb2c7['channelstate'])];}}else{if(this['channels'][_0x3bb2c7['uniqueid']]){if(_0x895f71){this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x2e')]][_0x941f('0x64')]=_0x895f71['id'];this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x2e')]][_0x941f('0x65')]=_0x895f71[_0x941f('0x3c')];}}}if(_0x3bb2c7['context']==='from-sip'){if(_0x895f71){_0x895f71[_0x941f('0x39')]=_0x3bb2c7[_0x941f('0x37')];var _0x150156,_0x37099a;if(this['channels'][_0x3bb2c7[_0x941f('0x2e')]]){_0x150156=this[_0x941f('0x13')][_0x3bb2c7['uniqueid']][_0x941f('0x66')];_0x37099a=this[_0x941f('0x13')][_0x3bb2c7['uniqueid']][_0x941f('0x8')];}else if(this['channels'][_0x3bb2c7['linkedid']]){_0x150156=this[_0x941f('0x13')][_0x3bb2c7[_0x941f('0x33')]][_0x941f('0x66')];_0x37099a=this[_0x941f('0x13')][_0x3bb2c7['linkedid']]['queue'];}_0x895f71['queue']=_0x37099a;_0x895f71[_0x941f('0x66')]=_0x150156;var _0x544ddc={'id':_0x895f71['id'],'name':_0x895f71[_0x941f('0x3c')],'agentconnected':!![],'destaccountcode':_0x895f71[_0x941f('0x3d')],'destconnectedlinenum':_0x3bb2c7[_0x941f('0x37')],'queue':_0x37099a||undefined,'routealias':_0x150156,'uniqueid':_0x3bb2c7[_0x941f('0x33')]};logger['debug'](_0x941f('0x67'),_0x3bb2c7[_0x941f('0x2e')],util[_0x941f('0x29')](_0x544ddc,{'showHidden':![],'depth':null}));this[_0x941f('0x2d')](util[_0x941f('0x3b')](_0x941f('0x4a'),_0x895f71[_0x941f('0x3c')]),_0x941f('0x4b'),_0x544ddc);}}}}catch(_0x2812bf){logger['error']('[%s][voiceCallReport][newstate]',_0x3bb2c7[_0x941f('0x2e')],util[_0x941f('0x29')](_0x2812bf,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x941f('0x68')]=function(_0x1ff350,_0x7e2b79){try{if(this[_0x941f('0x13')][_0x1ff350]){logger[_0x941f('0x25')](_0x941f('0x69'),_0x1ff350,_0x7e2b79);this[_0x941f('0x13')][_0x1ff350]['monitor']=!![];if(_['endsWith'](_0x7e2b79,_0x941f('0x6a'))){_0x7e2b79=_0x7e2b79[_0x941f('0x6b')](_0x941f('0x6a'),'.WAV');}this[_0x941f('0x13')][_0x1ff350]['monitorFilename']=_0x7e2b79;var _0x14e769=_[_0x941f('0x6c')](this['channels'][_0x1ff350][_0x941f('0x6d')],{'filename':_0x7e2b79});if(_[_0x941f('0x5a')](_0x14e769)){this[_0x941f('0x13')][_0x1ff350][_0x941f('0x6d')][_0x941f('0x6e')]({'filename':_0x7e2b79,'createdAt':moment()[_0x941f('0x3b')](_0x941f('0x43')),'mixmonitorid':'','status':_0x941f('0x6f')});}}}catch(_0x50f8c0){logger[_0x941f('0x28')]('[%s][voiceCallReport][mixMonitorFilename]',_0x1ff350,util[_0x941f('0x29')](_0x50f8c0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x941f('0x2a')][_0x941f('0x70')]=function(_0x11ed0b){try{if(this[_0x941f('0x2b')](_0x11ed0b)){logger[_0x941f('0x31')](_0x941f('0x71'),_0x11ed0b[_0x941f('0x2e')],util[_0x941f('0x29')](_0x11ed0b,{'showHidden':![],'depth':null}));if(this[_0x941f('0x13')][_0x11ed0b[_0x941f('0x2e')]]&&_0x11ed0b['channel']!=_0x941f('0x3f')){if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')])){if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')][_0x941f('0x73')])){logger[_0x941f('0x25')](_0x941f('0x74'),_0x11ed0b[_0x941f('0x2e')],_0x11ed0b[_0x941f('0x75')]);this[_0x941f('0x68')](_0x11ed0b['uniqueid'],_0x11ed0b[_0x941f('0x75')]);}else if(this['isNotNull'](_0x11ed0b[_0x941f('0x72')][_0x941f('0x76')])){logger[_0x941f('0x25')](_0x941f('0x77'),_0x11ed0b[_0x941f('0x2e')],_0x11ed0b[_0x941f('0x75')]);this[_0x941f('0x13')][_0x11ed0b['uniqueid']]['calleridnum']=_0x11ed0b[_0x941f('0x75')];}else if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')][_0x941f('0x78')])){logger[_0x941f('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x11ed0b['uniqueid'],_0x11ed0b[_0x941f('0x75')]);this[_0x941f('0x13')][_0x11ed0b[_0x941f('0x2e')]]['callerid']=_0x11ed0b[_0x941f('0x75')];}else if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')][_0x941f('0x79')])){logger['info'](_0x941f('0x7a'),_0x11ed0b[_0x941f('0x2e')],_0x11ed0b['value']);this[_0x941f('0x13')][_0x11ed0b[_0x941f('0x2e')]]['type']=_0x11ed0b['value'];}else if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')][_0x941f('0x7b')])){logger['info'](_0x941f('0x7c'),_0x11ed0b[_0x941f('0x2e')],_0x11ed0b[_0x941f('0x75')][_0x941f('0x36')](',')[0x0]);this[_0x941f('0x13')][_0x11ed0b['uniqueid']][_0x941f('0x8')]=_0x11ed0b[_0x941f('0x75')][_0x941f('0x36')](',')[0x0];}else if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')][_0x941f('0x7d')])){logger[_0x941f('0x25')](_0x941f('0x7e'),_0x11ed0b[_0x941f('0x2e')],_0x11ed0b[_0x941f('0x75')]);this[_0x941f('0x13')][_0x11ed0b[_0x941f('0x2e')]]['originatecalleridnum']=_0x11ed0b['value'];}else if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')]['xmd-destination'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x11ed0b[_0x941f('0x2e')],_0x11ed0b[_0x941f('0x75')]);this[_0x941f('0x13')][_0x11ed0b['uniqueid']][_0x941f('0x7f')]=_0x11ed0b[_0x941f('0x75')];}else if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')][_0x941f('0x80')])){logger[_0x941f('0x25')](_0x941f('0x81'),_0x11ed0b['uniqueid'],_0x11ed0b[_0x941f('0x75')]);this[_0x941f('0x13')][_0x11ed0b[_0x941f('0x2e')]][_0x941f('0x82')]=_0x11ed0b['value'];}else if(this[_0x941f('0x2b')](_0x11ed0b['variable'][_0x941f('0x83')])){logger[_0x941f('0x25')](_0x941f('0x84'),_0x11ed0b['uniqueid'],_0x11ed0b['value']);this[_0x941f('0x13')][_0x11ed0b[_0x941f('0x2e')]][_0x941f('0x8')]=_0x11ed0b['value'];}else if(this[_0x941f('0x2b')](_0x11ed0b['variable'][_0x941f('0x85')])){logger[_0x941f('0x25')](_0x941f('0x86'),_0x11ed0b['uniqueid'],_0x11ed0b[_0x941f('0x75')]);this[_0x941f('0x13')][_0x11ed0b['uniqueid']]['sipcalluniqueid']=_0x11ed0b['value'];}}}else if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')][_0x941f('0x73')])){if(_0x11ed0b[_0x941f('0x75')]){var _0x1d086b=path['parse'](_0x11ed0b['value'])[_0x941f('0x3c')];logger[_0x941f('0x25')](_0x941f('0x74'),_0x1d086b,_0x11ed0b[_0x941f('0x75')]);this[_0x941f('0x68')](_0x1d086b,_0x11ed0b['value']);}}else if(this[_0x941f('0x13')][_0x11ed0b[_0x941f('0x33')]]){if(this['isNotNull'](_0x11ed0b[_0x941f('0x72')])){if(this[_0x941f('0x2b')](_0x11ed0b[_0x941f('0x72')][_0x941f('0x85')])){logger[_0x941f('0x25')](_0x941f('0x86'),_0x11ed0b[_0x941f('0x33')],_0x11ed0b['value']);this['channels'][_0x11ed0b[_0x941f('0x33')]][_0x941f('0x87')]=_0x11ed0b[_0x941f('0x75')];}}}}}catch(_0x25e3e0){logger[_0x941f('0x28')]('[%s][voiceCallReport][varset]',_0x11ed0b[_0x941f('0x2e')],util[_0x941f('0x29')](_0x25e3e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x941f('0x2a')][_0x941f('0x88')]=function(_0x25acae){try{if(this[_0x941f('0x2b')](_0x25acae)){logger[_0x941f('0x31')]('[%s][voiceCallReport][hangup]\x20event:',_0x25acae[_0x941f('0x2e')],util['inspect'](_0x25acae,{'showHidden':![],'depth':null}));if(this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]]){if(this[_0x941f('0x13')][this['blindTransfers'][_0x25acae[_0x941f('0x33')]]['linkedid']]){this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x33')]][_0x941f('0x2e')]=_0x25acae['uniqueid'];this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x33')]][_0x941f('0x5d')]=this[_0x941f('0x13')][_0x25acae['uniqueid']][_0x941f('0x5d')];this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae['linkedid']][_0x941f('0x33')]][_0x941f('0x5e')]=this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]][_0x941f('0x5e')];this[_0x941f('0x13')][this['blindTransfers'][_0x25acae[_0x941f('0x33')]]['linkedid']][_0x941f('0x89')]=this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x33')]][_0x941f('0x60')];this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x33')]][_0x941f('0x44')]=this[_0x941f('0x13')][_0x25acae['uniqueid']][_0x941f('0x44')];this[_0x941f('0x13')][_0x25acae['uniqueid']]=this[_0x941f('0x13')][this['blindTransfers'][_0x25acae[_0x941f('0x33')]][_0x941f('0x33')]];delete this[_0x941f('0x13')][this['blindTransfers'][_0x25acae[_0x941f('0x33')]][_0x941f('0x33')]];}else if(this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x2e')]]){this[_0x941f('0x13')][this['blindTransfers'][_0x25acae[_0x941f('0x33')]][_0x941f('0x2e')]]['uniqueid']=[this[_0x941f('0x13')][this['blindTransfers'][_0x25acae[_0x941f('0x33')]]['uniqueid']][_0x941f('0x33')],this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x2e')]][_0x941f('0x33')]=this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]]['uniqueid']][_0x941f('0x2e')]][0x0];this['channels'][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x2e')]][_0x941f('0x5d')]=this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]][_0x941f('0x5d')];this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x2e')]]['answertime']=this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]][_0x941f('0x5e')];this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x2e')]][_0x941f('0x89')]=this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae['linkedid']][_0x941f('0x2e')]][_0x941f('0x60')];this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x2e')]][_0x941f('0x44')]=this['channels'][_0x25acae['uniqueid']][_0x941f('0x44')];this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]]=this[_0x941f('0x13')][this[_0x941f('0x40')][_0x25acae[_0x941f('0x33')]][_0x941f('0x2e')]];delete this['channels'][this[_0x941f('0x40')][_0x25acae['linkedid']]['uniqueid']];}}if(this['channels'][_0x25acae[_0x941f('0x2e')]]){logger[_0x941f('0x25')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x25acae[_0x941f('0x2e')],_0x25acae[_0x941f('0x8a')]);var _0xc7e452=moment();this[_0x941f('0x13')][_0x25acae['uniqueid']][_0x941f('0x8b')]=_0xc7e452[_0x941f('0x3b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]][_0x941f('0x54')]=_0xc7e452['diff'](this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]][_0x941f('0x42')],'seconds');if(this['channels'][_0x25acae[_0x941f('0x2e')]][_0x941f('0x5d')]){this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]][_0x941f('0x8c')]=_0xc7e452['diff'](this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]][_0x941f('0x5e')],_0x941f('0x55'));this[_0x941f('0x13')][_0x25acae[_0x941f('0x2e')]][_0x941f('0x62')]=this['channels'][_0x25acae['uniqueid']][_0x941f('0x54')]-this['channels'][_0x25acae['uniqueid']][_0x941f('0x8c')];}if(_0x25acae[_0x941f('0x41')]===_0x941f('0x47')){if(this[_0x941f('0x14')][_0x25acae['channel']['split']('-')[0x0]]){this[_0x941f('0x14')][_0x25acae[_0x941f('0x60')][_0x941f('0x36')]('-')[0x0]]=_[_0x941f('0x8d')](this[_0x941f('0x14')][_0x25acae[_0x941f('0x60')]['split']('-')[0x0]],[_0x941f('0x39')]);logger[_0x941f('0x31')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x25acae[_0x941f('0x2e')],util['inspect']({'id':this[_0x941f('0x14')][_0x25acae[_0x941f('0x60')][_0x941f('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0x941f('0x14')][_0x25acae[_0x941f('0x60')][_0x941f('0x36')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x941f('0x3b')](_0x941f('0x4a'),this[_0x941f('0x14')][_0x25acae['channel']['split']('-')[0x0]][_0x941f('0x3c')]),_0x941f('0x8e'),{'id':this[_0x941f('0x14')][_0x25acae['channel'][_0x941f('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0x941f('0x14')][_0x25acae['channel']['split']('-')[0x0]][_0x941f('0x3d')]});for(var _0x29e62b=0x0;_0x29e62b0x0?!![]:![];if(!_0x44054f){return this[_0x66df('0x1b')](this[_0x66df('0x49')]['completeEvent']);}};VoiceQueueReport[_0x66df('0xc')]['syncQueueMember']=function(_0x5335d8){var _0x376a48=this[_0x66df('0x49')]['id'];if(this[_0x66df('0x49')][_0x66df('0x66')][_0x376a48]&&this['summary'][_0x66df('0x66')][_0x376a48][_0x5335d8[_0x66df('0x6f')]]){this[_0x66df('0x49')]['queuestatus'][_0x376a48][_0x5335d8['actionid']][_0x66df('0x13')][_0x66df('0x72')](_0x5335d8);}};VoiceQueueReport[_0x66df('0xc')][_0x66df('0x18')]=function(_0x5ad8aa){var _0x17b580=this;try{if(this[_0x66df('0x60')](_0x5ad8aa)&&this[_0x66df('0x60')](_0x5ad8aa[_0x66df('0x52')])){logger[_0x66df('0x4c')](_0x66df('0x73'),util[_0x66df('0x44')](_0x5ad8aa,{'showHidden':![],'depth':null}));var _0x3cfc8b=this[_0x66df('0x15')][_0x5ad8aa[_0x66df('0x52')]];if(_0x3cfc8b){logger[_0x66df('0x4c')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x3cfc8b['name']);this[_0x66df('0x49')]['queues'][_0x3cfc8b[_0x66df('0x5e')]]={'summaryEvent':_0x5ad8aa};this[_0x66df('0x49')][_0x66df('0x74')]+=0x1;return ami['Action']({'action':_0x66df('0x66'),'queue':_0x3cfc8b['name']})['then'](function(_0x31033e){if(!_0x17b580[_0x66df('0x49')][_0x66df('0x66')][_0x5ad8aa[_0x66df('0x6f')]]){_0x17b580['summary'][_0x66df('0x66')][_0x5ad8aa[_0x66df('0x6f')]]={};}_0x17b580[_0x66df('0x49')][_0x66df('0x66')][_0x5ad8aa['actionid']][_0x31033e[_0x66df('0x6f')]]={'queue':_0x3cfc8b[_0x66df('0x5e')],'agents':[]};})[_0x66df('0x40')](function(_0x518473){throw _0x518473;});}}}catch(_0x240a3a){logger['error'](_0x66df('0x67'),util['inspect'](_0x240a3a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x66df('0x1b')]=function(_0x4250c9){if(this[_0x66df('0x49')][_0x66df('0x74')]>0x0){this['summary']['completeEvent']=_0x4250c9;return;}logger[_0x66df('0x4c')](_0x66df('0x75'),util['inspect'](_0x4250c9,{'showHidden':![],'depth':null}));this[_0x66df('0x49')]=initializeSummary();ami[_0x66df('0x4a')](_0x66df('0x76'),{});};VoiceQueueReport['prototype'][_0x66df('0x1f')]=function(_0x1cf5ca){try{if(this[_0x66df('0x60')](_0x1cf5ca)){logger[_0x66df('0x4c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1cf5ca[_0x66df('0x4f')],util[_0x66df('0x44')](_0x1cf5ca,{'showHidden':![],'depth':null}));if(_[_0x66df('0x61')](this[_0x66df('0x11')][_0x1cf5ca[_0x66df('0x4f')]])){this[_0x66df('0x11')][_0x1cf5ca[_0x66df('0x4f')]]=[];}if(_[_0x66df('0x61')](this[_0x66df('0x14')][_0x1cf5ca[_0x66df('0x4f')]])){this['channels'][_0x1cf5ca[_0x66df('0x4f')]]={};}var _0x14ceee=new QueueReport();_0x14ceee[_0x66df('0x52')]=_0x1cf5ca[_0x66df('0x52')];_0x14ceee[_0x66df('0x5b')]=this[_0x66df('0x15')][_0x14ceee[_0x66df('0x52')]]&&this[_0x66df('0x15')][_0x14ceee[_0x66df('0x52')]]['type']?this[_0x66df('0x15')][_0x14ceee[_0x66df('0x52')]][_0x66df('0x5b')]||_0x66df('0x5c'):_0x66df('0x5c');_0x14ceee[_0x66df('0x77')]=moment()[_0x66df('0x50')](_0x66df('0x78'));_0x14ceee[_0x66df('0x79')]=_0x1cf5ca['position'];_0x14ceee[_0x66df('0x7a')]=_0x1cf5ca['count'];_0x14ceee[_0x66df('0x4f')]=_0x1cf5ca[_0x66df('0x4f')];_0x14ceee['routealias']=this[_0x66df('0x14')][_0x1cf5ca['uniqueid']][_0x66df('0x7b')];logger[_0x66df('0x7c')](_0x66df('0x7d'),_0x14ceee[_0x66df('0x52')],_0x14ceee[_0x66df('0x5b')]);Object[_0x66df('0x6e')](_0x14ceee,_[_0x66df('0x7e')](_0x1cf5ca,_[_0x66df('0x7f')](_0x14ceee)));this[_0x66df('0x11')][_0x1cf5ca['uniqueid']]['push'](_0x14ceee);this['channels'][_0x1cf5ca[_0x66df('0x4f')]]=_0x14ceee;this[_0x66df('0x4b')](_0x14ceee,_0x66df('0x80'));}}catch(_0x58defb){logger[_0x66df('0x42')](_0x66df('0x81'),_0x1cf5ca['uniqueid'],util[_0x66df('0x44')](_0x58defb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x66df('0xc')][_0x66df('0x20')]=function(_0x542e2e){try{if(this['isNotNull'](_0x542e2e)){logger[_0x66df('0x4c')](_0x66df('0x82'),_0x542e2e[_0x66df('0x4f')],util['inspect'](_0x542e2e,{'showHidden':![],'depth':null}));if(this[_0x66df('0x11')][_0x542e2e[_0x66df('0x4f')]]){var _0x23b5b5=_[_0x66df('0x83')](this[_0x66df('0x11')][_0x542e2e[_0x66df('0x4f')]]);_0x23b5b5['queuecallercomplete']=![];_0x23b5b5['queuecallercompleteAt']=null;_0x23b5b5['holdtime']=_0x542e2e[_0x66df('0x84')];_0x23b5b5[_0x66df('0x85')]=_0x542e2e[_0x66df('0x85')];_0x23b5b5['queuecallerabandon']=!![];_0x23b5b5['queuecallerabandonAt']=moment()[_0x66df('0x50')](_0x66df('0x78'));_0x23b5b5[_0x66df('0x57')]='ABANDONED';_0x23b5b5[_0x66df('0x86')]=null;logger[_0x66df('0x7c')](_0x66df('0x87'),_0x23b5b5[_0x66df('0x52')],_0x23b5b5[_0x66df('0x5b')]);this[_0x66df('0x14')][_0x542e2e['uniqueid']]=_0x23b5b5;this[_0x66df('0x55')](_0x23b5b5,_0x66df('0x3b'));}}}catch(_0x2c5aab){logger[_0x66df('0x42')](_0x66df('0x82'),_0x542e2e[_0x66df('0x4f')],util[_0x66df('0x44')](_0x2c5aab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x66df('0xc')]['syncQueueCallerLeave']=function(_0x1f1869){try{if(this[_0x66df('0x60')](_0x1f1869)){logger[_0x66df('0x4c')](_0x66df('0x88'),_0x1f1869[_0x66df('0x4f')],util[_0x66df('0x44')](_0x1f1869,{'showHidden':![],'depth':null}));if(this[_0x66df('0x11')][_0x1f1869[_0x66df('0x4f')]]){var _0x3b0199=_[_0x66df('0x83')](this[_0x66df('0x11')][_0x1f1869[_0x66df('0x4f')]]);_0x3b0199[_0x66df('0x89')]=moment()['format'](_0x66df('0x78'));_0x3b0199[_0x66df('0x8a')]=_0x1f1869[_0x66df('0x8a')];_0x3b0199['connectedlinename']=_0x1f1869[_0x66df('0x8b')];logger[_0x66df('0x7c')](_0x66df('0x8c'),_0x3b0199[_0x66df('0x52')],_0x3b0199[_0x66df('0x5b')],_0x1f1869[_0x66df('0x8a')],_0x1f1869['connectedlinename']);this['channels'][_0x1f1869[_0x66df('0x4f')]]=_0x3b0199;this[_0x66df('0x4b')](_0x3b0199,'queuecallerleave');}}}catch(_0x623129){logger['error'](_0x66df('0x88'),_0x1f1869[_0x66df('0x4f')],util[_0x66df('0x44')](_0x623129,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x66df('0xc')]['syncAgentConnect']=function(_0x521c3d){try{if(this[_0x66df('0x60')](_0x521c3d)){logger[_0x66df('0x4c')](_0x66df('0x8d'),_0x521c3d['uniqueid'],util[_0x66df('0x44')](_0x521c3d,{'showHidden':![],'depth':null}));if(this[_0x66df('0x11')][_0x521c3d[_0x66df('0x4f')]]){var _0x1d1942=_['last'](this[_0x66df('0x11')][_0x521c3d[_0x66df('0x4f')]]);_0x1d1942[_0x66df('0x3c')]=!![];_0x1d1942[_0x66df('0x57')]=_0x66df('0x8e');logger[_0x66df('0x7c')](_0x66df('0x8f'),_0x1d1942[_0x66df('0x52')],_0x1d1942[_0x66df('0x5b')]);}}}catch(_0x372dce){logger[_0x66df('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x521c3d['uniqueid'],util['inspect'](_0x372dce,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x66df('0x24')]=function(_0x55b37e){try{if(this['isNotNull'](_0x55b37e)){logger[_0x66df('0x4c')](_0x66df('0x90'),_0x55b37e[_0x66df('0x4f')],util['inspect'](_0x55b37e,{'showHidden':![],'depth':null}));if(this[_0x66df('0x11')][_0x55b37e['uniqueid']]){var _0x1eaf67=_['last'](this['queueReports'][_0x55b37e[_0x66df('0x4f')]]);_0x1eaf67[_0x66df('0x3b')]=![];_0x1eaf67['queuecallerabandonAt']=null;_0x1eaf67[_0x66df('0x91')]=!![];_0x1eaf67[_0x66df('0x86')]=_0x55b37e[_0x66df('0x92')];_0x1eaf67[_0x66df('0x84')]=_0x55b37e[_0x66df('0x84')];_0x1eaf67[_0x66df('0x3c')]=!![];_0x1eaf67['queuecallerexit']=![];_0x1eaf67[_0x66df('0x93')]=null;if(!_0x1eaf67['transfer']){if(_0x55b37e['reason']==_0x66df('0x94')){_0x1eaf67[_0x66df('0x57')]=_0x66df('0x95');logger[_0x66df('0x7c')](_0x66df('0x96'),_0x1eaf67[_0x66df('0x52')],_0x1eaf67['type']);}else{if(_[_0x66df('0x97')](_0x55b37e[_0x66df('0x98')][_0x66df('0x99')](),_0x66df('0x9a'))){if(this[_0x66df('0x11')][_0x55b37e['linkedid']]){var _0x1fb126=_['last'](this['queueReports'][_0x55b37e['linkedid']]);_0x1fb126[_0x66df('0x3c')]=![];_0x1fb126[_0x66df('0x9b')]=!![];_0x1fb126[_0x66df('0x93')]=moment(_0x1eaf67['queuecallerjoinAt'])[_0x66df('0x9c')](_0x55b37e[_0x66df('0x84')],_0x66df('0x9d'))[_0x66df('0x50')](_0x66df('0x78'));_0x1fb126['queuecallerexitreason']=_0x66df('0x9e');_0x1fb126['transfer']=!![];_0x1fb126[_0x66df('0x9f')]=_0x66df('0xa0');_0x1fb126[_0x66df('0xa1')]=_0x55b37e[_0x66df('0xa2')];_0x1fb126['transferuniqueid']=_0x55b37e[_0x66df('0x4f')];logger[_0x66df('0x7c')](_0x66df('0xa3'),_0x1fb126[_0x66df('0x52')],_0x1fb126[_0x66df('0x5b')]);var _0x150531=this['queueReports'][_0x55b37e[_0x66df('0xa4')]];this[_0x66df('0x11')][_0x55b37e[_0x66df('0xa4')]]=this[_0x66df('0x11')][_0x55b37e['uniqueid']];this[_0x66df('0x11')][_0x55b37e[_0x66df('0x4f')]]=_0x150531;}}else{_0x1eaf67[_0x66df('0x57')]='COMPLETEDBY'+_0x55b37e[_0x66df('0xa5')]['toUpperCase']();logger[_0x66df('0x7c')](_0x66df('0xa6'),_0x1eaf67[_0x66df('0x52')],_0x1eaf67[_0x66df('0x5b')],_0x1eaf67[_0x66df('0x57')]);}}}this[_0x66df('0x14')][_0x55b37e['uniqueid']]=_0x1eaf67;}}}catch(_0x398dc3){logger[_0x66df('0x42')]('[%s][voiceQueueReport][agentcomplete]',_0x55b37e['uniqueid'],util['inspect'](_0x398dc3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0xffe4d7){try{if(this[_0x66df('0x60')](_0xffe4d7)){logger['debug'](_0x66df('0xa7'),_0xffe4d7[_0x66df('0x4f')],util[_0x66df('0x44')](_0xffe4d7,{'showHidden':![],'depth':null}));this[_0x66df('0xa8')](_0xffe4d7[_0x66df('0x4f')],_[_0x66df('0x7f')](_0xffe4d7[_0x66df('0xa9')])[0x0],_0xffe4d7[_0x66df('0xaa')]);if(this[_0x66df('0x11')][_0xffe4d7['uniqueid']]){var _0x3b2946=_[_0x66df('0x83')](this[_0x66df('0x11')][_0xffe4d7[_0x66df('0x4f')]]);if(_0x3b2946){if(this[_0x66df('0x60')](_0xffe4d7['variable'])&&this[_0x66df('0x60')](_0xffe4d7[_0x66df('0xa9')][_0x66df('0x66')])){switch(_0xffe4d7[_0x66df('0xaa')]){case _0x66df('0xab'):_0x3b2946['queuecallerexit']=![];_0x3b2946[_0x66df('0x93')]=null;break;case'TIMEOUT':_0x3b2946[_0x66df('0xac')]=_0x66df('0xad');_0x3b2946[_0x66df('0x9b')]=!![];_0x3b2946[_0x66df('0x93')]=moment()[_0x66df('0x50')](_0x66df('0x78'));_0x3b2946[_0x66df('0x89')]=moment()[_0x66df('0x50')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x66df('0x4c')](_0x66df('0xae'),_0xffe4d7[_0x66df('0x4f')],util[_0x66df('0x44')](_0x3b2946,{'showHidden':![],'depth':null}));ami[_0x66df('0x4a')](_0x66df('0xaf'),_0x3b2946);break;default:_0x3b2946[_0x66df('0x9b')]=!![];_0x3b2946[_0x66df('0x93')]=moment()['format'](_0x66df('0x78'));_0x3b2946[_0x66df('0x89')]=moment()['format'](_0x66df('0x78'));}_0x3b2946[_0x66df('0x3b')]=![];_0x3b2946[_0x66df('0xb0')]=null;_0x3b2946[_0x66df('0x57')]=_0xffe4d7['value'];this[_0x66df('0x14')][_0xffe4d7[_0x66df('0x4f')]]=_0x3b2946;this[_0x66df('0x55')](_0x3b2946,_0x66df('0x26'));}else if(this['isNotNull'](_0xffe4d7[_0x66df('0xa9')])&&this[_0x66df('0x60')](_0xffe4d7['variable']['queueposition'])){if(!_0x3b2946['queuecallerabandon']){_0x3b2946[_0x66df('0x9b')]=!![];_0x3b2946['queuecallerexitAt']=moment()[_0x66df('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b2946[_0x66df('0x57')]='EXITWITHKEY';_0x3b2946[_0x66df('0x89')]=moment()[_0x66df('0x50')](_0x66df('0x78'));this[_0x66df('0x14')][_0xffe4d7[_0x66df('0x4f')]]=_0x3b2946;}}logger['info'](_0x66df('0xb1'),_0xffe4d7['uniqueid'],_0x3b2946[_0x66df('0x52')],_0x3b2946[_0x66df('0x5b')],_[_0x66df('0x7f')](_0xffe4d7[_0x66df('0xa9')])[0x0],_0xffe4d7[_0x66df('0xaa')]);_0x3b2946[_0x66df('0x46')]=this[_0x66df('0x46')][_0xffe4d7[_0x66df('0x4f')]];}}}}catch(_0x4b4b5e){logger[_0x66df('0x42')](_0x66df('0xa7'),_0xffe4d7[_0x66df('0x4f')],util[_0x66df('0x44')](_0x4b4b5e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x66df('0xc')][_0x66df('0xa8')]=function(_0x48e7a2,_0x351959,_0x63ca7b){var _0x483a5e=['rtpaudioqos',_0x66df('0xb2'),_0x66df('0xb3'),'rtpaudioqosjitterbridged',_0x66df('0xb4'),_0x66df('0xb5'),_0x66df('0xb6'),'rtpaudioqosrttbridged',_0x66df('0xb7'),_0x66df('0xb8'),_0x66df('0xb9'),_0x66df('0xba'),_0x66df('0xbb'),_0x66df('0xbc'),_0x66df('0xbd'),_0x66df('0xbe'),_0x66df('0x92'),_0x66df('0xbf'),_0x66df('0xc0')];if(!_[_0x66df('0xc1')](_0x351959)&&!_[_0x66df('0xc2')](_0x483a5e,_0x351959)){if(_[_0x66df('0x61')](this[_0x66df('0x46')][_0x48e7a2])){this[_0x66df('0x46')][_0x48e7a2]={};}this[_0x66df('0x46')][_0x48e7a2][_0x351959]=_0x63ca7b;}};VoiceQueueReport['prototype'][_0x66df('0xc3')]=function(_0x1bb7ab,_0x29c749,_0x3d6f96){try{var _0x8bd22f={};if(this['queueReports'][_0x1bb7ab]){for(var _0x17ae31=0x0;_0x17ae310x0?!![]:![];if(!_0x2227ba){return this[_0x4ede('0x1c')](this[_0x4ede('0x16')][_0x4ede('0x70')]);}};VoiceQueueReport[_0x4ede('0xd')][_0x4ede('0x1e')]=function(_0xbbe306){var _0x49e116=this[_0x4ede('0x16')]['id'];if(this[_0x4ede('0x16')][_0x4ede('0x63')][_0x49e116]&&this[_0x4ede('0x16')][_0x4ede('0x63')][_0x49e116][_0xbbe306[_0x4ede('0x71')]]){this[_0x4ede('0x16')][_0x4ede('0x63')][_0x49e116][_0xbbe306['actionid']]['agents'][_0x4ede('0x72')](_0xbbe306);}};VoiceQueueReport[_0x4ede('0xd')][_0x4ede('0x19')]=function(_0x370696){var _0x15adab=this;try{if(this[_0x4ede('0x5d')](_0x370696)&&this['isNotNull'](_0x370696[_0x4ede('0x6b')])){logger[_0x4ede('0x53')](_0x4ede('0x73'),util[_0x4ede('0x45')](_0x370696,{'showHidden':![],'depth':null}));var _0x61c788=this[_0x4ede('0x14')][_0x370696[_0x4ede('0x6b')]];if(_0x61c788){logger['debug'](_0x4ede('0x74'),_0x61c788['name']);this[_0x4ede('0x16')]['queues'][_0x61c788[_0x4ede('0x5b')]]={'summaryEvent':_0x370696};this[_0x4ede('0x16')][_0x4ede('0x6f')]+=0x1;return ami[_0x4ede('0x3f')]({'action':_0x4ede('0x63'),'queue':_0x61c788[_0x4ede('0x5b')]})['then'](function(_0xe5c732){if(!_0x15adab[_0x4ede('0x16')][_0x4ede('0x63')][_0x370696['actionid']]){_0x15adab[_0x4ede('0x16')][_0x4ede('0x63')][_0x370696['actionid']]={};}_0x15adab[_0x4ede('0x16')][_0x4ede('0x63')][_0x370696[_0x4ede('0x71')]][_0xe5c732[_0x4ede('0x71')]]={'queue':_0x61c788[_0x4ede('0x5b')],'agents':[]};})[_0x4ede('0x42')](function(_0x448f75){throw _0x448f75;});}}}catch(_0x870fb8){logger['error']('[voiceQueueReport][queuesummary]',util[_0x4ede('0x45')](_0x870fb8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4ede('0x1c')]=function(_0x3869c0){if(this[_0x4ede('0x16')][_0x4ede('0x6f')]>0x0){this['summary']['completeEvent']=_0x3869c0;return;}logger[_0x4ede('0x53')](_0x4ede('0x75'),util['inspect'](_0x3869c0,{'showHidden':![],'depth':null}));this[_0x4ede('0x16')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x4ede('0xd')][_0x4ede('0x20')]=function(_0x8fbfee){try{if(this[_0x4ede('0x5d')](_0x8fbfee)){logger[_0x4ede('0x53')]('[%s][voiceQueueReport][queuecallerjoin]',_0x8fbfee[_0x4ede('0x4f')],util['inspect'](_0x8fbfee,{'showHidden':![],'depth':null}));if(_[_0x4ede('0x5e')](this['queueReports'][_0x8fbfee['uniqueid']])){this[_0x4ede('0x46')][_0x8fbfee[_0x4ede('0x4f')]]=[];}if(_[_0x4ede('0x5e')](this[_0x4ede('0x12')][_0x8fbfee[_0x4ede('0x4f')]])){this[_0x4ede('0x12')][_0x8fbfee[_0x4ede('0x4f')]]={};}var _0x4efe54=new QueueReport();_0x4efe54['queue']=_0x8fbfee['queue'];_0x4efe54['type']=this[_0x4ede('0x14')][_0x4efe54[_0x4ede('0x6b')]]&&this[_0x4ede('0x14')][_0x4efe54[_0x4ede('0x6b')]]['type']?this[_0x4ede('0x14')][_0x4efe54[_0x4ede('0x6b')]]['type']||'inbound':_0x4ede('0x6c');_0x4efe54[_0x4ede('0x76')]=moment()[_0x4ede('0x50')](_0x4ede('0x77'));_0x4efe54['position']=_0x8fbfee[_0x4ede('0x78')];_0x4efe54[_0x4ede('0x79')]=_0x8fbfee[_0x4ede('0x79')];_0x4efe54[_0x4ede('0x4f')]=_0x8fbfee[_0x4ede('0x4f')];_0x4efe54[_0x4ede('0x7a')]=this[_0x4ede('0x12')][_0x8fbfee[_0x4ede('0x4f')]][_0x4ede('0x7a')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4efe54[_0x4ede('0x6b')],_0x4efe54[_0x4ede('0x5a')]);Object[_0x4ede('0x69')](_0x4efe54,_[_0x4ede('0x7b')](_0x8fbfee,_[_0x4ede('0x7c')](_0x4efe54)));this[_0x4ede('0x46')][_0x8fbfee[_0x4ede('0x4f')]][_0x4ede('0x72')](_0x4efe54);this[_0x4ede('0x12')][_0x8fbfee['uniqueid']]=_0x4efe54;this['emitVoiceQueueChannelSave'](_0x4efe54,_0x4ede('0x7d'));}}catch(_0xeac351){logger[_0x4ede('0x44')](_0x4ede('0x7e'),_0x8fbfee[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0xeac351,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ede('0xd')][_0x4ede('0x21')]=function(_0x2b1cca){try{if(this[_0x4ede('0x5d')](_0x2b1cca)){logger[_0x4ede('0x53')](_0x4ede('0x7f'),_0x2b1cca[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0x2b1cca,{'showHidden':![],'depth':null}));if(this[_0x4ede('0x46')][_0x2b1cca[_0x4ede('0x4f')]]){var _0x1a38ed=_[_0x4ede('0x80')](this['queueReports'][_0x2b1cca[_0x4ede('0x4f')]]);_0x1a38ed['queuecallercomplete']=![];_0x1a38ed['queuecallercompleteAt']=null;_0x1a38ed[_0x4ede('0x81')]=_0x2b1cca['holdtime'];_0x1a38ed[_0x4ede('0x82')]=_0x2b1cca[_0x4ede('0x82')];_0x1a38ed[_0x4ede('0x83')]=!![];_0x1a38ed[_0x4ede('0x84')]=moment()[_0x4ede('0x50')](_0x4ede('0x77'));_0x1a38ed[_0x4ede('0x55')]=_0x4ede('0x85');_0x1a38ed['lastAssignedTo']=null;logger[_0x4ede('0x86')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1a38ed[_0x4ede('0x6b')],_0x1a38ed[_0x4ede('0x5a')]);this[_0x4ede('0x12')][_0x2b1cca[_0x4ede('0x4f')]]=_0x1a38ed;this[_0x4ede('0x87')](_0x1a38ed,_0x4ede('0x83'));}}}catch(_0x4828e8){logger[_0x4ede('0x44')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2b1cca[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0x4828e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ede('0xd')]['syncQueueCallerLeave']=function(_0x3399a5){try{if(this[_0x4ede('0x5d')](_0x3399a5)){logger['debug'](_0x4ede('0x88'),_0x3399a5[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0x3399a5,{'showHidden':![],'depth':null}));if(this[_0x4ede('0x46')][_0x3399a5[_0x4ede('0x4f')]]){var _0x507c47=_[_0x4ede('0x80')](this['queueReports'][_0x3399a5['uniqueid']]);_0x507c47['queuecallerleaveAt']=moment()[_0x4ede('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x507c47[_0x4ede('0x89')]=_0x3399a5['connectedlinenum'];_0x507c47[_0x4ede('0x8a')]=_0x3399a5[_0x4ede('0x8a')];logger[_0x4ede('0x86')](_0x4ede('0x8b'),_0x507c47['queue'],_0x507c47[_0x4ede('0x5a')],_0x3399a5['connectedlinenum'],_0x3399a5['connectedlinename']);this['channels'][_0x3399a5['uniqueid']]=_0x507c47;this[_0x4ede('0x8c')](_0x507c47,'queuecallerleave');}}}catch(_0x1644b1){logger[_0x4ede('0x44')](_0x4ede('0x88'),_0x3399a5[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0x1644b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ede('0xd')][_0x4ede('0x26')]=function(_0xcc2a25){try{if(this[_0x4ede('0x5d')](_0xcc2a25)){logger[_0x4ede('0x53')](_0x4ede('0x8d'),_0xcc2a25[_0x4ede('0x4f')],util['inspect'](_0xcc2a25,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xcc2a25['uniqueid']]){var _0x2599a0=_[_0x4ede('0x80')](this['queueReports'][_0xcc2a25[_0x4ede('0x4f')]]);_0x2599a0[_0x4ede('0x3b')]=!![];_0x2599a0[_0x4ede('0x55')]=_0x4ede('0x8e');logger[_0x4ede('0x86')](_0x4ede('0x8f'),_0x2599a0['queue'],_0x2599a0[_0x4ede('0x5a')]);}}}catch(_0x100e90){logger[_0x4ede('0x44')]('[%s][voiceQueueReport][agentconnect]',_0xcc2a25[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0x100e90,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ede('0xd')]['syncAgentComplete']=function(_0x441972){try{if(this[_0x4ede('0x5d')](_0x441972)){logger['debug'](_0x4ede('0x90'),_0x441972[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0x441972,{'showHidden':![],'depth':null}));if(this[_0x4ede('0x46')][_0x441972[_0x4ede('0x4f')]]){var _0x48a8e3=_[_0x4ede('0x80')](this['queueReports'][_0x441972[_0x4ede('0x4f')]]);_0x48a8e3['queuecallerabandon']=![];_0x48a8e3[_0x4ede('0x84')]=null;_0x48a8e3['assigned']=!![];_0x48a8e3[_0x4ede('0x91')]=_0x441972[_0x4ede('0x92')];_0x48a8e3[_0x4ede('0x81')]=_0x441972[_0x4ede('0x81')];_0x48a8e3['queuecallercomplete']=!![];_0x48a8e3['queuecallerexit']=![];_0x48a8e3['queuecallerexitAt']=null;if(!_0x48a8e3['transfer']){if(_0x441972['reason']==_0x4ede('0x93')){_0x48a8e3[_0x4ede('0x55')]=_0x4ede('0x94');logger[_0x4ede('0x86')](_0x4ede('0x95'),_0x48a8e3['queue'],_0x48a8e3['type']);}else{if(_[_0x4ede('0x96')](_0x441972[_0x4ede('0x41')]['toLowerCase'](),'local/')){if(this[_0x4ede('0x46')][_0x441972[_0x4ede('0x97')]]){var _0x471d69=_['last'](this[_0x4ede('0x46')][_0x441972[_0x4ede('0x97')]]);_0x471d69[_0x4ede('0x3b')]=![];_0x471d69[_0x4ede('0x98')]=!![];_0x471d69[_0x4ede('0x99')]=moment(_0x48a8e3[_0x4ede('0x76')])[_0x4ede('0x9a')](_0x441972[_0x4ede('0x81')],_0x4ede('0x9b'))[_0x4ede('0x50')](_0x4ede('0x77'));_0x471d69[_0x4ede('0x55')]='FORWARDTRANSFER';_0x471d69[_0x4ede('0x93')]=!![];_0x471d69['transfertype']=_0x4ede('0x9c');_0x471d69[_0x4ede('0x9d')]=_0x441972[_0x4ede('0x9e')];_0x471d69['transferuniqueid']=_0x441972['uniqueid'];logger[_0x4ede('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x471d69[_0x4ede('0x6b')],_0x471d69[_0x4ede('0x5a')]);var _0x463bf5=this[_0x4ede('0x46')][_0x441972[_0x4ede('0x97')]];this[_0x4ede('0x46')][_0x441972[_0x4ede('0x97')]]=this['queueReports'][_0x441972[_0x4ede('0x4f')]];this[_0x4ede('0x46')][_0x441972[_0x4ede('0x4f')]]=_0x463bf5;}}else{_0x48a8e3['queuecallerexitreason']=_0x4ede('0x9f')+_0x441972['reason'][_0x4ede('0xa0')]();logger[_0x4ede('0x86')](_0x4ede('0xa1'),_0x48a8e3[_0x4ede('0x6b')],_0x48a8e3[_0x4ede('0x5a')],_0x48a8e3[_0x4ede('0x55')]);}}}this[_0x4ede('0x12')][_0x441972[_0x4ede('0x4f')]]=_0x48a8e3;}}}catch(_0x427370){logger['error'](_0x4ede('0x90'),_0x441972[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0x427370,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ede('0xd')][_0x4ede('0x28')]=function(_0x71c4f1){try{if(this['isNotNull'](_0x71c4f1)){logger[_0x4ede('0x53')](_0x4ede('0xa2'),_0x71c4f1['uniqueid'],util[_0x4ede('0x45')](_0x71c4f1,{'showHidden':![],'depth':null}));this[_0x4ede('0xa3')](_0x71c4f1[_0x4ede('0x4f')],_[_0x4ede('0x7c')](_0x71c4f1[_0x4ede('0xa4')])[0x0],_0x71c4f1['value']);if(this[_0x4ede('0x46')][_0x71c4f1[_0x4ede('0x4f')]]){var _0x707d08=_[_0x4ede('0x80')](this[_0x4ede('0x46')][_0x71c4f1['uniqueid']]);if(_0x707d08){if(this[_0x4ede('0x5d')](_0x71c4f1['variable'])&&this[_0x4ede('0x5d')](_0x71c4f1[_0x4ede('0xa4')][_0x4ede('0x63')])){switch(_0x71c4f1[_0x4ede('0xa5')]){case _0x4ede('0xa6'):_0x707d08[_0x4ede('0x98')]=![];_0x707d08[_0x4ede('0x99')]=null;break;case _0x4ede('0xa7'):_0x707d08[_0x4ede('0xa8')]=_0x4ede('0xa9');_0x707d08[_0x4ede('0x98')]=!![];_0x707d08[_0x4ede('0x99')]=moment()[_0x4ede('0x50')](_0x4ede('0x77'));_0x707d08[_0x4ede('0xaa')]=moment()['format'](_0x4ede('0x77'));logger['debug'](_0x4ede('0xab'),_0x71c4f1[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0x707d08,{'showHidden':![],'depth':null}));ami[_0x4ede('0x4c')](_0x4ede('0xac'),_0x707d08);break;default:_0x707d08['queuecallerexit']=!![];_0x707d08[_0x4ede('0x99')]=moment()['format'](_0x4ede('0x77'));_0x707d08[_0x4ede('0xaa')]=moment()[_0x4ede('0x50')](_0x4ede('0x77'));}_0x707d08[_0x4ede('0x83')]=![];_0x707d08[_0x4ede('0x84')]=null;_0x707d08[_0x4ede('0x55')]=_0x71c4f1[_0x4ede('0xa5')];this[_0x4ede('0x12')][_0x71c4f1[_0x4ede('0x4f')]]=_0x707d08;this[_0x4ede('0x87')](_0x707d08,_0x4ede('0x27'));}else if(this[_0x4ede('0x5d')](_0x71c4f1[_0x4ede('0xa4')])&&this[_0x4ede('0x5d')](_0x71c4f1[_0x4ede('0xa4')][_0x4ede('0xad')])){if(!_0x707d08[_0x4ede('0x83')]){_0x707d08[_0x4ede('0x98')]=!![];_0x707d08[_0x4ede('0x99')]=moment()[_0x4ede('0x50')](_0x4ede('0x77'));_0x707d08[_0x4ede('0x55')]=_0x4ede('0xae');_0x707d08[_0x4ede('0xaa')]=moment()[_0x4ede('0x50')](_0x4ede('0x77'));this['channels'][_0x71c4f1[_0x4ede('0x4f')]]=_0x707d08;}}logger[_0x4ede('0x86')](_0x4ede('0xaf'),_0x71c4f1[_0x4ede('0x4f')],_0x707d08[_0x4ede('0x6b')],_0x707d08[_0x4ede('0x5a')],_[_0x4ede('0x7c')](_0x71c4f1['variable'])[0x0],_0x71c4f1[_0x4ede('0xa5')]);_0x707d08['variables']=this[_0x4ede('0x17')][_0x71c4f1['uniqueid']];}}}}catch(_0xff71eb){logger[_0x4ede('0x44')](_0x4ede('0xa2'),_0x71c4f1[_0x4ede('0x4f')],util[_0x4ede('0x45')](_0xff71eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ede('0xd')]['addVariable']=function(_0x68ec49,_0x3539ef,_0xa54937){var _0x31065a=[_0x4ede('0xb0'),_0x4ede('0xb1'),_0x4ede('0xb2'),_0x4ede('0xb3'),_0x4ede('0xb4'),_0x4ede('0xb5'),_0x4ede('0xb6'),_0x4ede('0xb7'),_0x4ede('0xb8'),'sipuri','bridgepeer',_0x4ede('0xb9'),'membercalls','memberdynamic','memberinterface',_0x4ede('0xba'),_0x4ede('0x92'),_0x4ede('0xbb'),_0x4ede('0xbc')];if(!_[_0x4ede('0x3e')](_0x3539ef)&&!_[_0x4ede('0xbd')](_0x31065a,_0x3539ef)){if(_[_0x4ede('0x5e')](this[_0x4ede('0x17')][_0x68ec49])){this[_0x4ede('0x17')][_0x68ec49]={};}this['variables'][_0x68ec49][_0x3539ef]=_0xa54937;}};VoiceQueueReport['prototype'][_0x4ede('0xbe')]=function(_0x351946,_0x5cff03,_0x246f8e){try{var _0x4b6973={};if(this[_0x4ede('0x46')][_0x351946]){for(var _0xb32aa1=0x0;_0xb32aa1=0x0?moment(_0x1c6c44['endtime'])['diff'](_0x1c6c44[_0xc9db('0x17')],_0xc9db('0xc')):null,'data1':_0xc9db('0x19'),'data2':_0x1c6c44[_0xc9db('0x11')],'data3':_0x1c6c44[_0xc9db('0xe')],'data4':_0x1c6c44['dialstring']||null,'role':_0xc9db('0x10'),'internal':_0x1c6c44[_0xc9db('0x11')]?_['toNumber'](_0x1c6c44['accountcode']):undefined,'uniqueid':_0x1c6c44[_0xc9db('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x6f2a=['interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','agent','accountcode','toNumber','uniqueid','voiceDialReport','endtime','starttime','outbound','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','SIP/%s'];(function(_0x3d83ac,_0x1d0135){var _0x299760=function(_0x40c1a3){while(--_0x40c1a3){_0x3d83ac['push'](_0x3d83ac['shift']());}};_0x299760(++_0x1d0135);}(_0x6f2a,0xa5));var _0xa6f2=function(_0xe97643,_0x25f1c9){_0xe97643=_0xe97643-0x0;var _0x34a163=_0x6f2a[_0xe97643];return _0x34a163;};'use strict';var moment=require('moment');var _=require(_0xa6f2('0x0'));var util=require(_0xa6f2('0x1'));var client=require(_0xa6f2('0x2'));exports[_0xa6f2('0x3')]=function(_0x54d3c1){var _0xb93636=_0x54d3c1[_0xa6f2('0x4')]||_0x54d3c1[_0xa6f2('0x5')];return client[_0xa6f2('0x6')](_0xa6f2('0x7'),{'body':{'channel':_0xa6f2('0x8'),'membername':_0x54d3c1['lastAssignedTo'],'interface':_['isNil'](_0x54d3c1['interface'])?util['format'](_0xa6f2('0x9'),_0x54d3c1['lastAssignedTo']):_0x54d3c1[_0xa6f2('0xa')],'type':_0xa6f2('0xb'),'enterAt':_0x54d3c1[_0xa6f2('0xc')],'exitAt':_0xb93636,'duration':moment(_0xb93636)[_0xa6f2('0xd')](_0x54d3c1[_0xa6f2('0xc')],_0xa6f2('0xe')),'data1':_0xa6f2('0xf'),'data2':_0x54d3c1[_0xa6f2('0x10')],'data3':_0x54d3c1['exten'],'data4':null,'data5':_0x54d3c1['queue'],'role':_0xa6f2('0x11'),'internal':_0x54d3c1[_0xa6f2('0x12')]?_[_0xa6f2('0x13')](_0x54d3c1[_0xa6f2('0x12')]):undefined,'uniqueid':_0x54d3c1[_0xa6f2('0x14')]},'log':'CreateMemberReport'});};exports[_0xa6f2('0x15')]=function(_0x5cf647){return client[_0xa6f2('0x6')](_0xa6f2('0x7'),{'body':{'channel':_0xa6f2('0x8'),'membername':_0x5cf647['membername'],'interface':_0x5cf647['interface'],'type':_0xa6f2('0xb'),'enterAt':_0x5cf647['starttime'],'exitAt':_0x5cf647[_0xa6f2('0x16')],'duration':moment(_0x5cf647[_0xa6f2('0x16')])['diff'](_0x5cf647[_0xa6f2('0x17')],_0xa6f2('0xe'))>=0x0?moment(_0x5cf647['endtime'])['diff'](_0x5cf647[_0xa6f2('0x17')],_0xa6f2('0xe')):null,'data1':_0xa6f2('0x18'),'data2':_0x5cf647['accountcode'],'data3':_0x5cf647['exten'],'data4':_0x5cf647['dialstring']||null,'role':_0xa6f2('0x11'),'internal':_0x5cf647[_0xa6f2('0x12')]?_[_0xa6f2('0x13')](_0x5cf647['accountcode']):undefined,'uniqueid':_0x5cf647[_0xa6f2('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4d8fa36..a41a652 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 _0x48bc=['../client','getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x48bc,0x1b6));var _0xc48b=function(_0x14c751,_0x439963){_0x14c751=_0x14c751-0x0;var _0x433948=_0x48bc[_0x14c751];return _0x433948;};'use strict';var client=require(_0xc48b('0x0'));exports[_0xc48b('0x1')]=function(){return client[_0xc48b('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc48b('0x3'),_0xc48b('0x4')]},'log':_0xc48b('0x5')});}; \ No newline at end of file +var _0x6257=['../client','Request','previewRecallmeReminderInterval','GetSettings'];(function(_0x4686f8,_0x135c71){var _0x2d4bdc=function(_0x42dd52){while(--_0x42dd52){_0x4686f8['push'](_0x4686f8['shift']());}};_0x2d4bdc(++_0x135c71);}(_0x6257,0x1d4));var _0x7625=function(_0x4b03de,_0x2f8336){_0x4b03de=_0x4b03de-0x0;var _0x2b8ea8=_0x6257[_0x4b03de];return _0x2b8ea8;};'use strict';var client=require(_0x7625('0x0'));exports['getSettings']=function(){return client[_0x7625('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x7625('0x2')]},'log':_0x7625('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f0145a5..ab5c70c 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 _0x560e=['html','getTemplates','GetTemplate','name'];(function(_0x5219e4,_0x5b574f){var _0x3f6e1e=function(_0x4b8c2f){while(--_0x4b8c2f){_0x5219e4['push'](_0x5219e4['shift']());}};_0x3f6e1e(++_0x5b574f);}(_0x560e,0x141));var _0xe560=function(_0x23cd3e,_0x4cd643){_0x23cd3e=_0x23cd3e-0x0;var _0x42c132=_0x560e[_0x23cd3e];return _0x42c132;};'use strict';var client=require('../client');exports[_0xe560('0x0')]=function(_0x14d043){return function(_0x549481){return client['Request'](_0xe560('0x1'),{'options':{'raw':!![],'attributes':['id',_0xe560('0x2'),_0xe560('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x37e9=['getTemplates','Request','GetTemplate','name'];(function(_0x493079,_0x3657e1){var _0x4ffb5f=function(_0x3a2263){while(--_0x3a2263){_0x493079['push'](_0x493079['shift']());}};_0x4ffb5f(++_0x3657e1);}(_0x37e9,0x1f4));var _0x937e=function(_0x4aa0c4,_0x375647){_0x4aa0c4=_0x4aa0c4-0x0;var _0x4b701b=_0x37e9[_0x4aa0c4];return _0x4b701b;};'use strict';var client=require('../client');exports[_0x937e('0x0')]=function(_0x648221){return function(_0x13ef09){return client[_0x937e('0x1')](_0x937e('0x2'),{'options':{'raw':!![],'attributes':['id',_0x937e('0x3'),'html']},'log':_0x937e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 0806623..1d73cde 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 _0xf440=['GetTrigger','name','Condition','AllConditions','field','operator','value','AnyConditions','action','data1','data2','data3','data5','data6','data7','../client','getTriggers','Request'];(function(_0x3fa431,_0x2b40cb){var _0x4e1e15=function(_0x161faf){while(--_0x161faf){_0x3fa431['push'](_0x3fa431['shift']());}};_0x4e1e15(++_0x2b40cb);}(_0xf440,0x189));var _0x0f44=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf440[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x0f44('0x0'));exports[_0x0f44('0x1')]=function(_0x44e1a8){return function(_0x561b41){return client[_0x0f44('0x2')](_0x0f44('0x3'),{'options':{'raw':![],'attributes':['id',_0x0f44('0x4'),'channel','status'],'include':[{'model':_0x0f44('0x5'),'as':_0x0f44('0x6'),'attributes':['id',_0x0f44('0x7'),_0x0f44('0x8'),_0x0f44('0x9')]},{'model':_0x0f44('0x5'),'as':_0x0f44('0xa'),'attributes':['id',_0x0f44('0x7'),_0x0f44('0x8'),_0x0f44('0x9')]},{'model':'Action','as':'Actions','attributes':['id',_0x0f44('0xb'),_0x0f44('0xc'),_0x0f44('0xd'),_0x0f44('0xe'),'data4',_0x0f44('0xf'),_0x0f44('0x10'),_0x0f44('0x11')]}]},'log':_0x0f44('0x3')});};}; \ No newline at end of file +var _0x651e=['data3','data4','data6','data7','../client','getTriggers','Request','GetTrigger','name','Condition','AllConditions','field','operator','value','AnyConditions','Action','action','data1','data2'];(function(_0x5c4587,_0x37f2a4){var _0x209263=function(_0x46ba5f){while(--_0x46ba5f){_0x5c4587['push'](_0x5c4587['shift']());}};_0x209263(++_0x37f2a4);}(_0x651e,0xd5));var _0xe651=function(_0x58b167,_0x4ae4c1){_0x58b167=_0x58b167-0x0;var _0x323de9=_0x651e[_0x58b167];return _0x323de9;};'use strict';var client=require(_0xe651('0x0'));exports[_0xe651('0x1')]=function(_0x201390){return function(_0x30fd5a){return client[_0xe651('0x2')](_0xe651('0x3'),{'options':{'raw':![],'attributes':['id',_0xe651('0x4'),'channel','status'],'include':[{'model':_0xe651('0x5'),'as':_0xe651('0x6'),'attributes':['id',_0xe651('0x7'),_0xe651('0x8'),_0xe651('0x9')]},{'model':_0xe651('0x5'),'as':_0xe651('0xa'),'attributes':['id','field','operator',_0xe651('0x9')]},{'model':_0xe651('0xb'),'as':'Actions','attributes':['id',_0xe651('0xc'),_0xe651('0xd'),_0xe651('0xe'),_0xe651('0xf'),_0xe651('0x10'),'data5',_0xe651('0x11'),_0xe651('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6e6b2ae..8b95a92 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 _0x32ff=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x3e5ae8,_0x487b95){var _0x3b0fc6=function(_0x3e9305){while(--_0x3e9305){_0x3e5ae8['push'](_0x3e5ae8['shift']());}};_0x3b0fc6(++_0x487b95);}(_0x32ff,0xc7));var _0xf32f=function(_0x19303c,_0x2e7ae2){_0x19303c=_0x19303c-0x0;var _0x357f9c=_0x32ff[_0x19303c];return _0x357f9c;};'use strict';var client=require(_0xf32f('0x0'));exports[_0xf32f('0x1')]=function(_0x3587a2){return function(_0x1e3aa3){return client[_0xf32f('0x2')](_0xf32f('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf32f('0x4'),_0xf32f('0x5'),_0xf32f('0x6')]},'log':_0xf32f('0x3')});};}; \ No newline at end of file +var _0x925e=['name','registry','defaultuser','GetTrunk','Request'];(function(_0xde8187,_0x47e993){var _0x3c5a4d=function(_0x3a49ee){while(--_0x3a49ee){_0xde8187['push'](_0xde8187['shift']());}};_0x3c5a4d(++_0x47e993);}(_0x925e,0x199));var _0xe925=function(_0x4bac76,_0x526f97){_0x4bac76=_0x4bac76-0x0;var _0x12bf53=_0x925e[_0x4bac76];return _0x12bf53;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x393167){return function(_0x28a99a){return client[_0xe925('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe925('0x1'),_0xe925('0x2'),_0xe925('0x3')]},'log':_0xe925('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 401a8f2..866b14e 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe706,0xa3));var _0x6e70=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe706[_0x160c73];return _0xd9302;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x1fd545,_0x41d46f){var _0x52f7b3=function(_0x362a44){while(--_0x362a44){_0x1fd545['push'](_0x1fd545['shift']());}};_0x52f7b3(++_0x41d46f);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1a7628d..73324a8 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 _0x65e7=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0xfeb91e,_0x3c348b){var _0x5910d8=function(_0x4f294d){while(--_0x4f294d){_0xfeb91e['push'](_0xfeb91e['shift']());}};_0x5910d8(++_0x3c348b);}(_0x65e7,0xfe));var _0x765e=function(_0x2bb293,_0x3b3a15){_0x2bb293=_0x2bb293-0x0;var _0x2ae198=_0x65e7[_0x2bb293];return _0x2ae198;};'use strict';var client=require(_0x765e('0x0'));exports[_0x765e('0x1')]=function(_0x5e29e9){return client[_0x765e('0x2')](_0x765e('0x3'),{'body':_0x5e29e9,'log':_0x765e('0x3')});};exports[_0x765e('0x4')]=function(_0x357551,_0x40a341,_0x225103){return client[_0x765e('0x2')](_0x765e('0x5'),{'body':_0x357551,'options':{'where':{'uniqueid':_0x40a341,'interface':_0x225103,'agentcomplete':!![]}},'log':_0x765e('0x5')});}; \ No newline at end of file +var _0x9e31=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x3fe139,_0x34ddcd){var _0x9b11ca=function(_0x3a328c){while(--_0x3a328c){_0x3fe139['push'](_0x3fe139['shift']());}};_0x9b11ca(++_0x34ddcd);}(_0x9e31,0x1ba));var _0x19e3=function(_0x1e43a7,_0x1c895b){_0x1e43a7=_0x1e43a7-0x0;var _0x6256e0=_0x9e31[_0x1e43a7];return _0x6256e0;};'use strict';var client=require(_0x19e3('0x0'));exports[_0x19e3('0x1')]=function(_0x12de5b){return client[_0x19e3('0x2')]('CreateVoiceAgentReport',{'body':_0x12de5b,'log':_0x19e3('0x3')});};exports['update']=function(_0x217921,_0x53f077,_0x4c067c){return client[_0x19e3('0x2')](_0x19e3('0x4'),{'body':_0x217921,'options':{'where':{'uniqueid':_0x53f077,'interface':_0x4c067c,'agentcomplete':!![]}},'log':_0x19e3('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f48706c..5b36956 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 _0x9457=['calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','util','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9457,0x176));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var util=require(_0x7945('0x0'));var _=require('lodash');var client=require(_0x7945('0x1'));exports[_0x7945('0x2')]=function(_0x3a5c32){return client[_0x7945('0x3')](_0x7945('0x4'),{'body':_[_0x7945('0x5')](_0x3a5c32,{'source':_0x3a5c32[_0x7945('0x6')],'destinationcontext':_0x3a5c32[_0x7945('0x7')],'callerid':_0x3a5c32['callerid'],'amaflags':_0x7945('0x8')}),'log':_0x7945('0x4')});};exports[_0x7945('0x9')]=function(){return function(){return client[_0x7945('0x3')](_0x7945('0xa'),{'options':{'where':{'type':[_0x7945('0xb')],'createdAt':{'$between':[moment()[_0x7945('0xc')](_0x7945('0xd'))[_0x7945('0xe')](_0x7945('0xf')),moment()[_0x7945('0x10')](_0x7945('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x7945('0x11'),_0x7945('0x12'),_0x7945('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x6781=['callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum'];(function(_0x5accad,_0x5791e0){var _0x5768c7=function(_0x701df9){while(--_0x701df9){_0x5accad['push'](_0x5accad['shift']());}};_0x5768c7(++_0x5791e0);}(_0x6781,0x162));var _0x1678=function(_0x20fff2,_0xb25962){_0x20fff2=_0x20fff2-0x0;var _0x179193=_0x6781[_0x20fff2];return _0x179193;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x1678('0x0'));var client=require(_0x1678('0x1'));exports[_0x1678('0x2')]=function(_0x50ebb9){return client[_0x1678('0x3')](_0x1678('0x4'),{'body':_[_0x1678('0x5')](_0x50ebb9,{'source':_0x50ebb9[_0x1678('0x6')],'destinationcontext':_0x50ebb9['context'],'callerid':_0x50ebb9[_0x1678('0x7')],'amaflags':_0x1678('0x8')}),'log':_0x1678('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x1678('0x3')](_0x1678('0x9'),{'options':{'where':{'type':[_0x1678('0xa')],'createdAt':{'$between':[moment()[_0x1678('0xb')](_0x1678('0xc'))[_0x1678('0xd')](_0x1678('0xe')),moment()['endOf']('day')[_0x1678('0xd')](_0x1678('0xe'))]}},'attributes':['type',_0x1678('0xf'),_0x1678('0x10'),_0x1678('0x11')]},'log':_0x1678('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d930036..b74cbd0 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 _0x9b99=['CreateVoiceDialReport','../client','create','Request'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0x9b99,0x141));var _0x99b9=function(_0x245714,_0x2a8a65){_0x245714=_0x245714-0x0;var _0x2caa48=_0x9b99[_0x245714];return _0x2caa48;};'use strict';var client=require(_0x99b9('0x0'));exports[_0x99b9('0x1')]=function(_0x3d8ef3){return client[_0x99b9('0x2')](_0x99b9('0x3'),{'body':_0x3d8ef3,'log':_0x99b9('0x3')});}; \ No newline at end of file +var _0xb3fe=['../client','Request','CreateVoiceDialReport'];(function(_0x42e1db,_0x25d99d){var _0x5c96b5=function(_0x100c29){while(--_0x100c29){_0x42e1db['push'](_0x42e1db['shift']());}};_0x5c96b5(++_0x25d99d);}(_0xb3fe,0x1a7));var _0xeb3f=function(_0x1dc7c4,_0x803bb1){_0x1dc7c4=_0x1dc7c4-0x0;var _0xded053=_0xb3fe[_0x1dc7c4];return _0xded053;};'use strict';var client=require(_0xeb3f('0x0'));exports['create']=function(_0xac787c){return client[_0xeb3f('0x1')]('CreateVoiceDialReport',{'body':_0xac787c,'log':_0xeb3f('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 71df592..39b7fc9 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 _0xd404=['getVoiceExtensions','GetVoiceExtension','exten','../client'];(function(_0x84772e,_0x54ab62){var _0x4482a3=function(_0x24ed50){while(--_0x24ed50){_0x84772e['push'](_0x84772e['shift']());}};_0x4482a3(++_0x54ab62);}(_0xd404,0x15b));var _0x4d40=function(_0x3ccb8b,_0x3c78a2){_0x3ccb8b=_0x3ccb8b-0x0;var _0x3757a9=_0xd404[_0x3ccb8b];return _0x3757a9;};'use strict';var client=require(_0x4d40('0x0'));exports[_0x4d40('0x1')]=function(){return function(){return client['Request'](_0x4d40('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4d40('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x4d40('0x1')});};}; \ No newline at end of file +var _0x0c5d=['../client','getVoiceExtensions','GetVoiceExtension','recordingFormat'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0c5d,0x6c));var _0xd0c5=function(_0xf0d4da,_0x4f8e3c){_0xf0d4da=_0xf0d4da-0x0;var _0xd615e2=_0x0c5d[_0xf0d4da];return _0xd615e2;};'use strict';var client=require(_0xd0c5('0x0'));exports[_0xd0c5('0x1')]=function(){return function(){return client['Request'](_0xd0c5('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xd0c5('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xd0c5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 3947f40..6f4e571 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 _0x4df9=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','name','Interval','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','autopause','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x4f4b11,_0x3d5678){var _0x47f757=function(_0x54071f){while(--_0x54071f){_0x4f4b11['push'](_0x4f4b11['shift']());}};_0x47f757(++_0x3d5678);}(_0x4df9,0xd7));var _0x94df=function(_0x13ee5e,_0x5f3736){_0x13ee5e=_0x13ee5e-0x0;var _0x16af41=_0x4df9[_0x13ee5e];return _0x16af41;};'use strict';var client=require(_0x94df('0x0'));exports[_0x94df('0x1')]=function(){return function(){return client[_0x94df('0x2')](_0x94df('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0x94df('0x4'),_0x94df('0x5'),'monitor_format','type',_0x94df('0x6'),'dialMethod',_0x94df('0x7'),_0x94df('0x8'),_0x94df('0x9'),_0x94df('0xa'),'dialPredictiveOptimizationPercentage',_0x94df('0xb'),_0x94df('0xc'),_0x94df('0xd'),_0x94df('0xe'),_0x94df('0xf'),_0x94df('0x10'),_0x94df('0x11'),_0x94df('0x12'),_0x94df('0x13'),'dialBusyMaxRetry',_0x94df('0x14'),_0x94df('0x15'),_0x94df('0x16'),_0x94df('0x17'),_0x94df('0x18'),_0x94df('0x19'),_0x94df('0x1a'),_0x94df('0x1b'),_0x94df('0x1c'),_0x94df('0x1d'),_0x94df('0x1e'),_0x94df('0x1f'),_0x94df('0x20'),'dialAMDMinWordLength',_0x94df('0x21'),_0x94df('0x22'),_0x94df('0x23'),'dialAMDMaximumWordLength','timeout',_0x94df('0x24'),_0x94df('0x25'),_0x94df('0x26'),_0x94df('0x27'),_0x94df('0x28'),_0x94df('0x29'),'monitor_format',_0x94df('0x2a'),_0x94df('0x2b'),_0x94df('0x2c'),_0x94df('0x2d'),'dialNoSuchNumberRetryFrequency',_0x94df('0x2e'),_0x94df('0x2f'),_0x94df('0x30'),_0x94df('0x31'),_0x94df('0x32'),_0x94df('0x33'),_0x94df('0x34'),_0x94df('0x35'),_0x94df('0x36'),_0x94df('0x37'),_0x94df('0x38'),_0x94df('0x39'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x94df('0x3a'),'attributes':['id','name',_0x94df('0x3b'),_0x94df('0x3c')]},{'model':_0x94df('0x3d'),'as':_0x94df('0x3e'),'attributes':['id','name']},{'model':_0x94df('0x3a'),'as':_0x94df('0x3f'),'attributes':['id',_0x94df('0x40'),'callerid',_0x94df('0x3c')]},{'model':_0x94df('0x41'),'as':_0x94df('0x41'),'attributes':['id','name'],'include':[{'model':_0x94df('0x41'),'as':'Intervals','attributes':['id','name','interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x8b97=['TrunkBackup','Interval','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause'];(function(_0x35fa47,_0x1298ac){var _0x467b4b=function(_0x5a045f){while(--_0x5a045f){_0x35fa47['push'](_0x35fa47['shift']());}};_0x467b4b(++_0x1298ac);}(_0x8b97,0x1d9));var _0x78b9=function(_0x4ea090,_0x164bfb){_0x4ea090=_0x4ea090-0x0;var _0x115504=_0x8b97[_0x4ea090];return _0x115504;};'use strict';var client=require(_0x78b9('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x78b9('0x1')](_0x78b9('0x2'),{'options':{'raw':![],'attributes':['id',_0x78b9('0x3'),_0x78b9('0x4'),_0x78b9('0x5'),_0x78b9('0x6'),'monitor_format',_0x78b9('0x7'),_0x78b9('0x8'),'dialMethod',_0x78b9('0x9'),_0x78b9('0xa'),'dialPowerLevel',_0x78b9('0xb'),_0x78b9('0xc'),_0x78b9('0xd'),_0x78b9('0xe'),_0x78b9('0xf'),_0x78b9('0x10'),_0x78b9('0x11'),_0x78b9('0x12'),_0x78b9('0x13'),_0x78b9('0x14'),_0x78b9('0x15'),_0x78b9('0x16'),_0x78b9('0x17'),'dialNoAnswerMaxRetry',_0x78b9('0x18'),_0x78b9('0x19'),_0x78b9('0x1a'),'dialGlobalInterval',_0x78b9('0x1b'),_0x78b9('0x1c'),_0x78b9('0x1d'),_0x78b9('0x1e'),_0x78b9('0x1f'),_0x78b9('0x20'),_0x78b9('0x21'),_0x78b9('0x22'),_0x78b9('0x23'),_0x78b9('0x24'),_0x78b9('0x25'),_0x78b9('0x26'),_0x78b9('0x27'),_0x78b9('0x28'),_0x78b9('0x29'),_0x78b9('0x2a'),_0x78b9('0x2b'),_0x78b9('0x2c'),_0x78b9('0x2d'),_0x78b9('0x2e'),'strategy',_0x78b9('0x2f'),_0x78b9('0x30'),_0x78b9('0x31'),_0x78b9('0x32'),_0x78b9('0x33'),_0x78b9('0x34'),_0x78b9('0x35'),_0x78b9('0x36'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x78b9('0x37'),_0x78b9('0x38'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x78b9('0x39'),_0x78b9('0x3a')],'include':[{'model':_0x78b9('0x3b'),'as':_0x78b9('0x3b'),'attributes':['id',_0x78b9('0x3'),_0x78b9('0x3c'),_0x78b9('0x3d')]},{'model':'Pause','as':_0x78b9('0x3e'),'attributes':['id',_0x78b9('0x3')]},{'model':_0x78b9('0x3b'),'as':_0x78b9('0x3f'),'attributes':['id',_0x78b9('0x3'),_0x78b9('0x3c'),_0x78b9('0x3d')]},{'model':_0x78b9('0x40'),'as':'Interval','attributes':['id',_0x78b9('0x3')],'include':[{'model':_0x78b9('0x40'),'as':'Intervals','attributes':['id','name',_0x78b9('0x41')]}]}]},'log':_0x78b9('0x42')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f115856..11a4a23 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(_0x331641,_0x113877){var _0x373eb0=function(_0x192313){while(--_0x192313){_0x331641['push'](_0x331641['shift']());}};_0x373eb0(++_0x113877);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x1b1f9c,_0x43783d){var _0x1ccf2e=function(_0x20baad){while(--_0x20baad){_0x1b1f9c['push'](_0x1b1f9c['shift']());}};_0x1ccf2e(++_0x43783d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 9cc6050..eb62d7d 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 _0x9cf6=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x50aba6,_0xc3e265){var _0x3eec74=function(_0x15b017){while(--_0x15b017){_0x50aba6['push'](_0x50aba6['shift']());}};_0x3eec74(++_0xc3e265);}(_0x9cf6,0x16c));var _0x69cf=function(_0x29267f,_0x5497fb){_0x29267f=_0x29267f-0x0;var _0x5461e6=_0x9cf6[_0x29267f];return _0x5461e6;};'use strict';var client=require(_0x69cf('0x0'));exports[_0x69cf('0x1')]=function(_0x437d75){return function(){return client['Request'](_0x69cf('0x2'),{'options':{'where':{'VoiceQueueId':_0x437d75,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x86dd=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0xd8faf7,_0xde4abe){var _0x2c4a80=function(_0x2265c0){while(--_0x2265c0){_0xd8faf7['push'](_0xd8faf7['shift']());}};_0x2c4a80(++_0xde4abe);}(_0x86dd,0x195));var _0xd86d=function(_0x18063c,_0xaf71b2){_0x18063c=_0x18063c-0x0;var _0x5a77fb=_0x86dd[_0x18063c];return _0x5a77fb;};'use strict';var client=require(_0xd86d('0x0'));exports[_0xd86d('0x1')]=function(_0x4df4a5){return function(){return client['Request'](_0xd86d('0x2'),{'options':{'where':{'VoiceQueueId':_0x4df4a5,'paused':!![]},'raw':!![]},'log':_0xd86d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 9d7ee29..b10e1fd 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(_0x1965a2,_0x5b6955){var _0x241a22=function(_0xe1bb93){while(--_0xe1bb93){_0x1965a2['push'](_0x1965a2['shift']());}};_0x241a22(++_0x5b6955);}(_0x7a54,0x106));var _0x47a5=function(_0x38825e,_0x1e5bdd){_0x38825e=_0x38825e-0x0;var _0x534c8e=_0x7a54[_0x38825e];return _0x534c8e;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x373d04,_0x1beccf){var _0x453268=function(_0x309f84){while(--_0x309f84){_0x373d04['push'](_0x373d04['shift']());}};_0x453268(++_0x1beccf);}(_0x7a54,0x106));var _0x47a5=function(_0x516f11,_0xecc180){_0x516f11=_0x516f11-0x0;var _0x2ee6ad=_0x7a54[_0x516f11];return _0x2ee6ad;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c066d46..138d5df 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 _0x46c6=['origtransfererexten','attended','transfers','Request','result','transfererchannel','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext'];(function(_0x1d90ca,_0x3bab16){var _0x28872b=function(_0x3ea71b){while(--_0x3ea71b){_0x1d90ca['push'](_0x1d90ca['shift']());}};_0x28872b(++_0x3bab16);}(_0x46c6,0x11a));var _0x646c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x46c6[_0x819464];return _0x49dcc0;};'use strict';var client=require('../client');exports[_0x646c('0x0')]={};exports['blindTransfer']=function(_0x3100da){return client[_0x646c('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x3100da[_0x646c('0x2')],'transfererchannel':_0x3100da[_0x646c('0x3')],'transferercalleridnum':_0x3100da['transferercalleridnum'],'transferercalleridname':_0x3100da['transferercalleridname'],'transfererconnectedlinenum':_0x3100da['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3100da[_0x646c('0x4')],'transfereraccountcode':_0x3100da[_0x646c('0x5')],'transferercontext':_0x3100da['transferercontext'],'transfererexten':_0x3100da[_0x646c('0x6')],'transfererlinkedid':_0x3100da[_0x646c('0x7')],'transfereechannel':_0x3100da[_0x646c('0x8')],'transfereecalleridnum':_0x3100da[_0x646c('0x9')],'transfereecalleridname':_0x3100da[_0x646c('0xa')],'transfereeconnectedlinenum':_0x3100da[_0x646c('0xb')],'transfereeconnectedlinename':_0x3100da[_0x646c('0xc')],'transfereeaccountcode':_0x3100da[_0x646c('0xd')],'transfereecontext':_0x3100da[_0x646c('0xe')],'transfereeexten':_0x3100da[_0x646c('0xf')],'transfereelinkedid':_0x3100da[_0x646c('0x10')],'isexternal':_0x3100da[_0x646c('0x11')],'context':_0x3100da[_0x646c('0x12')],'extension':_0x3100da['extension'],'type':_0x646c('0x13')},'log':_0x646c('0x14')});};exports[_0x646c('0x15')]=function(_0x525dfc){return client[_0x646c('0x1')](_0x646c('0x14'),{'body':{'result':_0x525dfc[_0x646c('0x2')],'transfererchannel':_0x525dfc[_0x646c('0x16')],'transferercalleridnum':_0x525dfc[_0x646c('0x17')],'transferercalleridname':_0x525dfc['origtransferercalleridname'],'transfererconnectedlinenum':_0x525dfc[_0x646c('0x18')],'transfererconnectedlinename':_0x525dfc[_0x646c('0x19')],'transfereraccountcode':_0x525dfc[_0x646c('0x1a')],'transferercontext':_0x525dfc['secondtransferercontext'],'transfererexten':_0x525dfc[_0x646c('0x1b')],'transfererlinkedid':_0x525dfc[_0x646c('0x1c')],'transfereechannel':_0x525dfc['transfertargetchannel'],'transfereecalleridnum':_0x525dfc[_0x646c('0x1d')],'transfereecalleridname':_0x525dfc[_0x646c('0x1e')],'transfereeconnectedlinenum':_0x525dfc[_0x646c('0x1f')],'transfereeconnectedlinename':_0x525dfc[_0x646c('0x20')],'transfereeaccountcode':_0x525dfc[_0x646c('0x21')],'transfereecontext':_0x525dfc[_0x646c('0x22')],'transfereeexten':_0x525dfc[_0x646c('0x23')],'transfereelinkedid':_0x525dfc[_0x646c('0x24')],'isexternal':_0x525dfc[_0x646c('0x11')],'context':_0x525dfc[_0x646c('0x25')],'extension':_0x525dfc[_0x646c('0x26')],'type':_0x646c('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xc10c=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransferercontext','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','context','blind','attendedTransfer','origtransfererchannel'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0xc10c,0x11d));var _0xcc10=function(_0x503d00,_0x323df1){_0x503d00=_0x503d00-0x0;var _0x2263d8=_0xc10c[_0x503d00];return _0x2263d8;};'use strict';var client=require(_0xcc10('0x0'));exports[_0xcc10('0x1')]={};exports[_0xcc10('0x2')]=function(_0x39ce07){return client['Request'](_0xcc10('0x3'),{'body':{'result':_0x39ce07[_0xcc10('0x4')],'transfererchannel':_0x39ce07[_0xcc10('0x5')],'transferercalleridnum':_0x39ce07[_0xcc10('0x6')],'transferercalleridname':_0x39ce07[_0xcc10('0x7')],'transfererconnectedlinenum':_0x39ce07[_0xcc10('0x8')],'transfererconnectedlinename':_0x39ce07[_0xcc10('0x9')],'transfereraccountcode':_0x39ce07['transfereraccountcode'],'transferercontext':_0x39ce07[_0xcc10('0xa')],'transfererexten':_0x39ce07['transfererexten'],'transfererlinkedid':_0x39ce07[_0xcc10('0xb')],'transfereechannel':_0x39ce07[_0xcc10('0xc')],'transfereecalleridnum':_0x39ce07['transfereecalleridnum'],'transfereecalleridname':_0x39ce07[_0xcc10('0xd')],'transfereeconnectedlinenum':_0x39ce07[_0xcc10('0xe')],'transfereeconnectedlinename':_0x39ce07[_0xcc10('0xf')],'transfereeaccountcode':_0x39ce07['transfereeaccountcode'],'transfereecontext':_0x39ce07['transfereecontext'],'transfereeexten':_0x39ce07[_0xcc10('0x10')],'transfereelinkedid':_0x39ce07['transfereelinkedid'],'isexternal':_0x39ce07['isexternal'],'context':_0x39ce07[_0xcc10('0x11')],'extension':_0x39ce07['extension'],'type':_0xcc10('0x12')},'log':_0xcc10('0x3')});};exports[_0xcc10('0x13')]=function(_0x2fdd3d){return client['Request'](_0xcc10('0x3'),{'body':{'result':_0x2fdd3d['result'],'transfererchannel':_0x2fdd3d[_0xcc10('0x14')],'transferercalleridnum':_0x2fdd3d['origtransferercalleridnum'],'transferercalleridname':_0x2fdd3d[_0xcc10('0x15')],'transfererconnectedlinenum':_0x2fdd3d[_0xcc10('0x16')],'transfererconnectedlinename':_0x2fdd3d['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2fdd3d['origtransfereraccountcode'],'transferercontext':_0x2fdd3d[_0xcc10('0x17')],'transfererexten':_0x2fdd3d[_0xcc10('0x18')],'transfererlinkedid':_0x2fdd3d['origtransfererlinkedid'],'transfereechannel':_0x2fdd3d[_0xcc10('0x19')],'transfereecalleridnum':_0x2fdd3d[_0xcc10('0x1a')],'transfereecalleridname':_0x2fdd3d[_0xcc10('0x1b')],'transfereeconnectedlinenum':_0x2fdd3d['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2fdd3d[_0xcc10('0x1c')],'transfereeaccountcode':_0x2fdd3d[_0xcc10('0x1d')],'transfereecontext':_0x2fdd3d[_0xcc10('0x1e')],'transfereeexten':_0x2fdd3d[_0xcc10('0x1f')],'transfereelinkedid':_0x2fdd3d['transfertargetlinkedid'],'isexternal':_0x2fdd3d[_0xcc10('0x20')],'context':_0x2fdd3d[_0xcc10('0x21')],'extension':_0x2fdd3d['origtransfererexten'],'type':'attended'},'log':_0xcc10('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 2885e90..e9933fb 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x11e6f8,_0x5c6e8b){var _0x10d812=function(_0x117abf){while(--_0x117abf){_0x11e6f8['push'](_0x11e6f8['shift']());}};_0x10d812(++_0x5c6e8b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e0c31,_0x208e9f){_0x4e0c31=_0x4e0c31-0x0;var _0x3fd7df=_0xb10b[_0x4e0c31];return _0x3fd7df;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x37312b,_0x23e200){var _0x20f532=function(_0x17a33f){while(--_0x17a33f){_0x37312b['push'](_0x37312b['shift']());}};_0x20f532(++_0x23e200);}(_0x7a54,0x106));var _0x47a5=function(_0x4e2555,_0x1265f6){_0x4e2555=_0x4e2555-0x0;var _0x4fc49f=_0x7a54[_0x4e2555];return _0x4fc49f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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 1dc513b..51842b1 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 _0x36e2=['then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','firstName','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','phone','mobile','fax','createdAt','updatedAt','resolve'];(function(_0x24f847,_0x586340){var _0x1de50f=function(_0x57b0e0){while(--_0x57b0e0){_0x24f847['push'](_0x24f847['shift']());}};_0x1de50f(++_0x586340);}(_0x36e2,0xdc));var _0x236e=function(_0x506797,_0x226668){_0x506797=_0x506797-0x0;var _0x3dc2b4=_0x36e2[_0x506797];return _0x3dc2b4;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x236e('0x0'));var util=require(_0x236e('0x1'));var config=require(_0x236e('0x2'));var logger=require(_0x236e('0x3'))(_0x236e('0x4'));var cmContactRpc=require(_0x236e('0x5'));config[_0x236e('0x6')]=_['defaults'](config[_0x236e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x236e('0x7'))(new Redis(config[_0x236e('0x6')]));function emit(_0x1fad05,_0x4aa7b6,_0x380c36,_0x3d321e,_0x670f9f){logger[_0x236e('0x8')](_0x236e('0x9'),_0x1fad05,_0x4aa7b6['id'],_0x380c36,_0x3d321e,JSON[_0x236e('0xa')](_0x670f9f));io['to'](_0x380c36)[_0x236e('0xb')](_0x3d321e,_0x670f9f);}exports['exec']=function(_0x1674a4,_0x5d7cb4,_0x56ab4e,_0x4d8908){var _0x41bc58,_0xb0546b;var _0x282433={};var _0xe81e7e;var _0x4bfe78=Number(_0x56ab4e['data1']);var _0x2e5f41=_0x56ab4e['data2']?Boolean(Number(_0x56ab4e[_0x236e('0xc')])):![];var _0x98181c;var _0x356edb=![];if(!_[_0x236e('0xd')](_0x56ab4e[_0x236e('0xe')])){if(_0x56ab4e['data5']=='1')_0x356edb=!![];}if(!_0x356edb){if(_0x4d8908[_0x236e('0xf')]){_0x282433['id']=_0x4d8908['xmd-contactid'];}}if(!_0x282433['id']){_0x282433[_0x236e('0x10')]=_0x4bfe78;_0x98181c=_0x56ab4e['data3']&&_0x56ab4e[_0x236e('0x11')]!=='0'?_0x56ab4e[_0x236e('0x11')][_0x236e('0x12')](','):['phone'];_0x282433[_0x236e('0x13')]=_[_0x236e('0x14')](_0x98181c,function(_0x535079){var _0x3d27ec={};_0x3d27ec[_0x535079]=_0x4d8908[_0x236e('0x15')]?_0x4d8908[_0x236e('0x16')]:_0x4d8908[_0x236e('0x17')];return _0x3d27ec;});_0xe81e7e=_0x4d8908['routeId']?_0x4d8908[_0x236e('0x16')]:_0x4d8908['calleridnum'];}var _0x4c5505=['id','firstName','lastName',_0x236e('0x18'),_0x236e('0x19'),_0x236e('0x1a'),_0x236e('0x10'),_0x236e('0x1b'),'scheduledAt',_0x236e('0x1c')];var _0x1611a5=_['union'](_0x4c5505,_0x98181c);BPromise[_0x236e('0x1d')]()[_0x236e('0x1e')](cmContactRpc[_0x236e('0x1f')]({'attributes':_0x1611a5,'where':_0x282433,'phone':_0xe81e7e}))[_0x236e('0x1e')](function(_0x39e721){_0xb0546b=_0x39e721;if(!_[_0x236e('0x20')](_0xb0546b)){if(_0xb0546b[_0x236e('0x21')]===0x1){_0x41bc58=_0xb0546b[0x0];logger['info'](_0x236e('0x22'),_0x4d8908[_0x236e('0x23')],_0x5d7cb4['id'],_0x41bc58['id']);}else{logger[_0x236e('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4d8908[_0x236e('0x23')],_0x5d7cb4['id'],_[_0x236e('0x14')](_0xb0546b,'id')['join'](','));}return;}else{logger[_0x236e('0x8')](_0x236e('0x24'),_0x4d8908[_0x236e('0x23')],_0x5d7cb4['id']);var _0x436962={'ListId':_0x4bfe78};var _0x8cdc6=_0x56ab4e['data4']&&_0x56ab4e['data4']!=='0'?_0x56ab4e['data4']:_0x236e('0x18');if(_0x2e5f41){logger[_0x236e('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4d8908[_0x236e('0x23')],_0x5d7cb4['id']);_0x436962[_0x8cdc6]=_['isNil'](_0x4d8908[_0x236e('0x15')])?_0x4d8908[_0x236e('0x17')]:_0x4d8908[_0x236e('0x16')];if(_[_0x236e('0xd')](_0x4d8908['routeId'])){_0x436962[_0x236e('0x25')]=_0x4d8908[_0x236e('0x26')]&&_0x4d8908[_0x236e('0x26')]!==_0x236e('0x27')?_0x4d8908['calleridname']:'Unknown';}else{_0x436962[_0x236e('0x25')]=_0x4d8908[_0x236e('0x28')]&&_0x4d8908['destcalleridname']!==''?_0x4d8908[_0x236e('0x28')]:_0x236e('0x29');}return BPromise[_0x236e('0x1d')]()['then'](cmContactRpc['createContact'](_0x436962))[_0x236e('0x1e')](function(_0x5198c6){_0x41bc58=_0x5198c6;_0xb0546b[_0x236e('0x2a')](_0x5198c6);if(_0x41bc58){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x4d8908[_0x236e('0x23')],_0x5d7cb4['id'],_0x41bc58['id']);}return;});}else{logger[_0x236e('0x8')](_0x236e('0x2b'),_0x4d8908[_0x236e('0x23')],_0x5d7cb4['id']);_0x436962[_0x8cdc6]=_[_0x236e('0xd')](_0x4d8908[_0x236e('0x15')])?_0x4d8908[_0x236e('0x17')]:_0x4d8908[_0x236e('0x16')];if(_[_0x236e('0xd')](_0x4d8908['routeId'])){_0x436962[_0x236e('0x25')]=_0x4d8908[_0x236e('0x26')]&&_0x4d8908[_0x236e('0x26')]!==_0x236e('0x27')?_0x4d8908[_0x236e('0x26')]:_0x236e('0x29');}else{_0x436962['firstName']=_0x4d8908[_0x236e('0x28')]&&_0x4d8908[_0x236e('0x28')]!==''?_0x4d8908[_0x236e('0x28')]:_0x236e('0x29');}_0x41bc58=_0x436962;_0xb0546b[_0x236e('0x2a')](_0x436962);return;}}})['then'](function(){if(_0x1674a4){emit(_0x4d8908[_0x236e('0x23')],_0x5d7cb4,util[_0x236e('0x2c')](_0x236e('0x2d'),_0x1674a4[_0x236e('0x2e')]),util[_0x236e('0x2c')](_0x236e('0x2f'),_0x56ab4e[_0x236e('0x30')][_0x236e('0x31')]()),{'evt':_['merge'](_0x4d8908,{'autoCreate':_0x2e5f41}),'contact':_0x41bc58===undefined?{}:_0x41bc58,'contacts':_0xb0546b[_0x236e('0x21')]===0x0?undefined:_0xb0546b});}});}; \ No newline at end of file +var _0xfbeb=['data3','split','$or','map','routeId','destcalleridnum','calleridnum','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','merge','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId'];(function(_0xcb0159,_0xa3584d){var _0x2ecd83=function(_0x11c504){while(--_0x11c504){_0xcb0159['push'](_0xcb0159['shift']());}};_0x2ecd83(++_0xa3584d);}(_0xfbeb,0x1b6));var _0xbfbe=function(_0x53e29e,_0x17c540){_0x53e29e=_0x53e29e-0x0;var _0x54c118=_0xfbeb[_0x53e29e];return _0x54c118;};'use strict';var _=require('lodash');var BPromise=require(_0xbfbe('0x0'));var Redis=require(_0xbfbe('0x1'));var util=require(_0xbfbe('0x2'));var config=require(_0xbfbe('0x3'));var logger=require('../../../../config/logger')(_0xbfbe('0x4'));var cmContactRpc=require(_0xbfbe('0x5'));config[_0xbfbe('0x6')]=_[_0xbfbe('0x7')](config['redis'],{'host':_0xbfbe('0x8'),'port':0x18eb});var io=require(_0xbfbe('0x9'))(new Redis(config[_0xbfbe('0x6')]));function emit(_0x5c7c34,_0x35d37f,_0x3c8d26,_0x3b51f9,_0x416886){logger['info']('[CM][%s][%s]',_0x5c7c34,_0x35d37f['id'],_0x3c8d26,_0x3b51f9,JSON[_0xbfbe('0xa')](_0x416886));io['to'](_0x3c8d26)[_0xbfbe('0xb')](_0x3b51f9,_0x416886);}exports['exec']=function(_0x2de902,_0x140882,_0x16a4ff,_0x573968){var _0x3c00da,_0x3092f8;var _0x43f4f3={};var _0x3293b8;var _0x3e6710=Number(_0x16a4ff[_0xbfbe('0xc')]);var _0x58cf55=_0x16a4ff['data2']?Boolean(Number(_0x16a4ff[_0xbfbe('0xd')])):![];var _0x599b54;var _0x567039=![];if(!_[_0xbfbe('0xe')](_0x16a4ff[_0xbfbe('0xf')])){if(_0x16a4ff[_0xbfbe('0xf')]=='1')_0x567039=!![];}if(!_0x567039){if(_0x573968[_0xbfbe('0x10')]){_0x43f4f3['id']=_0x573968['xmd-contactid'];}}if(!_0x43f4f3['id']){_0x43f4f3[_0xbfbe('0x11')]=_0x3e6710;_0x599b54=_0x16a4ff[_0xbfbe('0x12')]&&_0x16a4ff['data3']!=='0'?_0x16a4ff[_0xbfbe('0x12')][_0xbfbe('0x13')](','):['phone'];_0x43f4f3[_0xbfbe('0x14')]=_[_0xbfbe('0x15')](_0x599b54,function(_0x50cb27){var _0xd96a39={};_0xd96a39[_0x50cb27]=_0x573968[_0xbfbe('0x16')]?_0x573968[_0xbfbe('0x17')]:_0x573968[_0xbfbe('0x18')];return _0xd96a39;});_0x3293b8=_0x573968[_0xbfbe('0x16')]?_0x573968[_0xbfbe('0x17')]:_0x573968[_0xbfbe('0x18')];}var _0x2a2c44=['id','firstName',_0xbfbe('0x19'),_0xbfbe('0x1a'),_0xbfbe('0x1b'),'fax',_0xbfbe('0x11'),_0xbfbe('0x1c'),_0xbfbe('0x1d'),_0xbfbe('0x1e')];var _0x240973=_[_0xbfbe('0x1f')](_0x2a2c44,_0x599b54);BPromise[_0xbfbe('0x20')]()[_0xbfbe('0x21')](cmContactRpc['getContacts']({'attributes':_0x240973,'where':_0x43f4f3,'phone':_0x3293b8}))['then'](function(_0x10f485){_0x3092f8=_0x10f485;if(!_[_0xbfbe('0x22')](_0x3092f8)){if(_0x3092f8[_0xbfbe('0x23')]===0x1){_0x3c00da=_0x3092f8[0x0];logger['info'](_0xbfbe('0x24'),_0x573968[_0xbfbe('0x25')],_0x140882['id'],_0x3c00da['id']);}else{logger[_0xbfbe('0x26')](_0xbfbe('0x27'),_0x573968[_0xbfbe('0x25')],_0x140882['id'],_['map'](_0x3092f8,'id')[_0xbfbe('0x28')](','));}return;}else{logger[_0xbfbe('0x26')](_0xbfbe('0x29'),_0x573968[_0xbfbe('0x25')],_0x140882['id']);var _0x45f4d1={'ListId':_0x3e6710};var _0x22f6ba=_0x16a4ff['data4']&&_0x16a4ff[_0xbfbe('0x2a')]!=='0'?_0x16a4ff[_0xbfbe('0x2a')]:_0xbfbe('0x1a');if(_0x58cf55){logger[_0xbfbe('0x26')](_0xbfbe('0x2b'),_0x573968[_0xbfbe('0x25')],_0x140882['id']);_0x45f4d1[_0x22f6ba]=_[_0xbfbe('0xe')](_0x573968[_0xbfbe('0x16')])?_0x573968[_0xbfbe('0x18')]:_0x573968[_0xbfbe('0x17')];if(_[_0xbfbe('0xe')](_0x573968[_0xbfbe('0x16')])){_0x45f4d1[_0xbfbe('0x2c')]=_0x573968[_0xbfbe('0x2d')]&&_0x573968[_0xbfbe('0x2d')]!==_0xbfbe('0x2e')?_0x573968[_0xbfbe('0x2d')]:'Unknown';}else{_0x45f4d1['firstName']=_0x573968[_0xbfbe('0x2f')]&&_0x573968[_0xbfbe('0x2f')]!==''?_0x573968['destcalleridname']:_0xbfbe('0x30');}return BPromise[_0xbfbe('0x20')]()[_0xbfbe('0x21')](cmContactRpc['createContact'](_0x45f4d1))[_0xbfbe('0x21')](function(_0x2bf884){_0x3c00da=_0x2bf884;_0x3092f8[_0xbfbe('0x31')](_0x2bf884);if(_0x3c00da){logger['info'](_0xbfbe('0x32'),_0x573968['uniqueid'],_0x140882['id'],_0x3c00da['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x573968[_0xbfbe('0x25')],_0x140882['id']);_0x45f4d1[_0x22f6ba]=_[_0xbfbe('0xe')](_0x573968[_0xbfbe('0x16')])?_0x573968[_0xbfbe('0x18')]:_0x573968[_0xbfbe('0x17')];if(_[_0xbfbe('0xe')](_0x573968[_0xbfbe('0x16')])){_0x45f4d1['firstName']=_0x573968[_0xbfbe('0x2d')]&&_0x573968[_0xbfbe('0x2d')]!==_0xbfbe('0x2e')?_0x573968['calleridname']:_0xbfbe('0x30');}else{_0x45f4d1[_0xbfbe('0x2c')]=_0x573968['destcalleridname']&&_0x573968[_0xbfbe('0x2f')]!==_0xbfbe('0x2e')?_0x573968[_0xbfbe('0x2f')]:_0xbfbe('0x30');}_0x3c00da=_0x45f4d1;_0x3092f8['push'](_0x45f4d1);return;}}})[_0xbfbe('0x21')](function(){if(_0x2de902){emit(_0x573968[_0xbfbe('0x25')],_0x140882,util[_0xbfbe('0x33')](_0xbfbe('0x34'),_0x2de902[_0xbfbe('0x35')]),util[_0xbfbe('0x33')](_0xbfbe('0x36'),_0x16a4ff[_0xbfbe('0x37')]['toLowerCase']()),{'evt':_[_0xbfbe('0x38')](_0x573968,{'autoCreate':_0x58cf55}),'contact':_0x3c00da===undefined?{}:_0x3c00da,'contacts':_0x3092f8[_0xbfbe('0x23')]===0x0?undefined:_0x3092f8});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 9d2b1ab..54c6382 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 _0x324b=['600','data6','winapp','format','name','trigger:%s:%s','jscripty','user:%s','trigger:%s','exec','integration','routeId','script','parse','query','search','replace','checkTrigger','channel','every','AllConditions','checkConditions','AnyConditions','debug','evt','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','membername','lastevent','null','substatus','undefined','offlineMessage','equals','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/logger','trigger','redis','localhost','socket.io-emitter','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','emit','info','prototype','clone','motionChannel','inspect','checkTriggers','interface','hasOwnProperty','status','merge','variables','Actions','length','agents','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','render','html','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','data5','windowHeight'];(function(_0x4d37a2,_0x45eb28){var _0x5e2047=function(_0x400e72){while(--_0x400e72){_0x4d37a2['push'](_0x4d37a2['shift']());}};_0x5e2047(++_0x45eb28);}(_0x324b,0x1a5));var _0xb324=function(_0x33b471,_0x2df881){_0x33b471=_0x33b471-0x0;var _0x21ed12=_0x324b[_0x33b471];return _0x21ed12;};'use strict';var util=require('util');var _=require(_0xb324('0x0'));var url=require(_0xb324('0x1'));var Mustache=require(_0xb324('0x2'));var Redis=require(_0xb324('0x3'));var urlforward=require(_0xb324('0x4'));var integration=require(_0xb324('0x5'));var cmContact=require(_0xb324('0x6'));var script=require(_0xb324('0x7'));var config=require('../../../config/environment');var logger=require(_0xb324('0x8'))(_0xb324('0x9'));var ami=require('../ami');config[_0xb324('0xa')]=_['defaults'](config[_0xb324('0xa')],{'host':_0xb324('0xb'),'port':0x18eb});var io=require(_0xb324('0xc'))(new Redis(config[_0xb324('0xa')]));var operators={'equals':function(_0x39d39d,_0x328704){return _0x39d39d==_0x328704;},'not_equals':function(_0x2cde21,_0x30a2f2){return _0x2cde21!=_0x30a2f2;}};var barAndWebActions=['popup',_0xb324('0x1'),'winapp'];function Trigger(_0x3603f7){this[_0xb324('0xd')]=_0x3603f7[_0xb324('0xd')];this['agents']=_0x3603f7['agents'];this[_0xb324('0xe')]=_0x3603f7[_0xb324('0xe')];this[_0xb324('0xf')]=_0x3603f7[_0xb324('0xf')];this[_0xb324('0x10')]=_0x3603f7[_0xb324('0x10')];this[_0xb324('0x11')]=_0x3603f7[_0xb324('0x11')];this[_0xb324('0x12')]=_0x3603f7['freshdeskAccounts'];this[_0xb324('0x13')]=_0x3603f7[_0xb324('0x13')];this[_0xb324('0x14')]=_0x3603f7[_0xb324('0x14')];this[_0xb324('0x15')]=_0x3603f7['zohoAccounts'];this[_0xb324('0x16')]=_0x3603f7[_0xb324('0x16')];this['vtigerAccounts']=_0x3603f7[_0xb324('0x17')];this[_0xb324('0x18')]=_0x3603f7[_0xb324('0x18')];this[_0xb324('0x19')]=_0x3603f7['dynamics365Accounts'];this[_0xb324('0x1a')]=_0x3603f7[_0xb324('0x1a')];this[_0xb324('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xb324('0x13')],'freshdesk':this[_0xb324('0x12')],'sugarcrm':this[_0xb324('0x14')],'zoho':this[_0xb324('0x15')],'desk':this[_0xb324('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xb324('0x18')]};ami['on']('custom:agentcalled',this[_0xb324('0x1c')][_0xb324('0x1d')](this));ami['on'](_0xb324('0x1e'),this[_0xb324('0x1c')]['bind'](this));ami['on'](_0xb324('0x1f'),this['syncCustomEvent'][_0xb324('0x1d')](this));ami['on'](_0xb324('0x20'),this[_0xb324('0x1c')][_0xb324('0x1d')](this));ami['on'](_0xb324('0x21'),this[_0xb324('0x1c')]['bind'](this));ami['on'](_0xb324('0x22'),this[_0xb324('0x1c')]['bind'](this));ami['on'](_0xb324('0x23'),this[_0xb324('0x1c')][_0xb324('0x1d')](this));ami['on'](_0xb324('0x24'),this[_0xb324('0x1c')]['bind'](this));ami['on'](_0xb324('0x25'),this[_0xb324('0x1c')][_0xb324('0x1d')](this));ami['on'](_0xb324('0x26'),this[_0xb324('0x1c')][_0xb324('0x1d')](this));ami['on'](_0xb324('0x27'),this[_0xb324('0x1c')][_0xb324('0x1d')](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0xb324('0x1d')](this));ami['on'](_0xb324('0x28'),this[_0xb324('0x29')][_0xb324('0x1d')](this));ami['on'](_0xb324('0x2a'),this[_0xb324('0x29')]['bind'](this));ami['on'](_0xb324('0x2b'),this[_0xb324('0x29')]['bind'](this));ami['on'](_0xb324('0x2c'),this['syncCustomEvent'][_0xb324('0x1d')](this));ami['on'](_0xb324('0x2d'),this['syncCustomEvent']['bind'](this));ami['on']('custom:substatus',this[_0xb324('0x1c')]['bind'](this));ami['on'](_0xb324('0x2e'),this[_0xb324('0x1c')][_0xb324('0x1d')](this));ami['on'](_0xb324('0x2f'),this['syncCustomEvent']['bind'](this));ami['on'](_0xb324('0x30'),this[_0xb324('0x1c')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xb324('0x1c')][_0xb324('0x1d')](this));ami['on'](_0xb324('0x31'),this['syncCustomEvent'][_0xb324('0x1d')](this));}Trigger['prototype'][_0xb324('0x32')]=function(_0x252333,_0x2edb67,_0x1cb084){logger[_0xb324('0x33')](_0x252333,_0x2edb67,JSON['stringify'](_0x1cb084));io['to'](_0x252333)[_0xb324('0x32')](_0x2edb67,_0x1cb084);};Trigger[_0xb324('0x34')][_0xb324('0x1c')]=function(_0x250454){var _0x2b0822=_[_0xb324('0x35')](_0x250454);if(typeof _0x2b0822[_0xb324('0x36')]==='undefined'){_0x2b0822[_0xb324('0x36')]='voice';}logger['debug'](_0xb324('0x1c'),util[_0xb324('0x37')](_0x2b0822,{'showHidden':!![],'depth':null}));this[_0xb324('0x38')](_0x2b0822);};Trigger['prototype'][_0xb324('0x29')]=function(_0x4876f1){if(this['agents'][_0x4876f1[_0xb324('0x39')]]){this['syncCustomEvent'](_0x4876f1);}};Trigger[_0xb324('0x34')]['checkTriggers']=function(_0x3a9cd3){var _0x1c1467;for(var _0x60cdd9 in this[_0xb324('0xd')]){if(this[_0xb324('0xd')][_0xb324('0x3a')](_0x60cdd9)){if(this[_0xb324('0xd')][_0x60cdd9][_0xb324('0x3b')]){_0x1c1467=this['checkTrigger'](this[_0xb324('0xd')][_0x60cdd9],_0x3a9cd3);if(_0x1c1467){_[_0xb324('0x3c')](_0x3a9cd3,_0x3a9cd3[_0xb324('0x3d')]);for(var _0x10b2fd=0x0,_0x2550e5,_0x34f2d4,_0x3fdcb2;_0x10b2fd0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _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(_0x1b1a36,_0x60096c){var _0x45ea19=function(_0x21a034){while(--_0x21a034){_0x1b1a36['push'](_0x1b1a36['shift']());}};_0x45ea19(++_0x60096c);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 dc47d62..5b17cc8 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 _0xcca1=['body','headers','substring','lastIndexOf','enduserId','message','GET','contacts?$select=','&$filter=','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','nameField','idField','indexOf','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','ticketType','phonecall','callDirection','queue','/systemusers(','phonecalls','odata-entityid','ticketId','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','validateEmail','email','userEmail','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','internalemailaddress','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','Bearer\x20'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcca1,0xa6));var _0x1cca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcca1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1cca('0x0'));var rp=require('request-promise');var util=require(_0x1cca('0x1'));var intUtil=require(_0x1cca('0x2'));var md5=require('md5');var Redis=require(_0x1cca('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x1cca('0x4'));config[_0x1cca('0x5')]=_['defaults'](config['redis'],{'host':_0x1cca('0x6'),'port':0x18eb});var io=require(_0x1cca('0x7'))(new Redis(config[_0x1cca('0x5')]));function getAuthToken(_0x59114b,_0x5cd480,_0x258678){if(_0x59114b[_0x1cca('0x8')]){_0x59114b['remoteUri']=_0x59114b[_0x1cca('0x9')][_0x1cca('0xa')];_0x59114b['tenantId']=_0x59114b[_0x1cca('0x9')][_0x1cca('0xb')];return Promise[_0x1cca('0xc')](_0x59114b[_0x1cca('0x9')][_0x1cca('0xd')]);}var _0x5f4945={'method':_0x1cca('0xe'),'uri':_0x5cd480,'form':{'client_id':_0x59114b[_0x1cca('0xf')],'resource':_0x59114b[_0x1cca('0x10')],'username':_0x59114b[_0x1cca('0x11')],'password':_0x59114b[_0x1cca('0x12')],'grant_type':'password','client_secret':_0x59114b[_0x1cca('0x13')]},'json':!![]};return rp(_0x5f4945)['then'](function(_0x24b85a){return _0x24b85a[_0x1cca('0x14')];})['catch'](function(_0x86cbe2){logger[_0x1cca('0x15')]('['+[_0x258678[_0x1cca('0x16')]()]+_0x1cca('0x17'));return _0x86cbe2['message'];});}function getUser(_0x5a4991,_0x1a51f6,_0xd18066,_0x1315be,_0x385b40,_0x5cef58){return new Promise(function(_0xde8b81,_0x14fe52){return getAuthToken(_0x1a51f6,_0x1315be,_0x5cef58)[_0x1cca('0x18')](function(_0x30cef1){var _0x55e965={'method':'GET','uri':_0x385b40+_0x1cca('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x30cef1,'OData-Version':_0x1cca('0x1a')},'json':!![]};return rp(_0x55e965);})['then'](function(_0x22b2e2){var _0x212d57=_0x22b2e2['value'];var _0x523b77=![];var _0xe16a6a=null;if(!_[_0x1cca('0x1b')](_0xd18066)){if(intUtil[_0x1cca('0x1c')](_0xd18066[_0x1cca('0x1d')])){_0x5a4991[_0x1cca('0x1e')]=_0xd18066[_0x1cca('0x1d')];for(_0xe16a6a=0x0;_0xe16a6a<_0x212d57['length'];_0xe16a6a++){if(_0x212d57[_0xe16a6a]['internalemailaddress']===_0xd18066[_0x1cca('0x1d')]&&!_0x212d57[_0xe16a6a]['isdisabled']){_0x523b77=!![];logger[_0x1cca('0x1f')]('['+[_0x5cef58[_0x1cca('0x16')]()]+']\x20Agent\x20found\x20'+_0x212d57[_0xe16a6a][_0x1cca('0x20')]+'!');_0x5a4991[_0x1cca('0x21')]=_0x212d57[_0xe16a6a]['systemuserid'];}}}}if(!_0x523b77){logger[_0x1cca('0x1f')]('['+[_0x5cef58[_0x1cca('0x16')]()]+_0x1cca('0x22'));_0x5a4991[_0x1cca('0x1e')]=_0x1a51f6['username'];for(_0xe16a6a=0x0;_0xe16a6a<_0x212d57[_0x1cca('0x23')];_0xe16a6a++){if(_0x212d57[_0xe16a6a][_0x1cca('0x24')]===_0x1a51f6[_0x1cca('0x11')]){_0x5a4991['userId']=_0x212d57[_0xe16a6a]['systemuserid'];}}}_0xde8b81(_0x5a4991);})[_0x1cca('0x25')](function(_0x34f48f){_0x14fe52(_0x34f48f['message']);});});}function createEndUser(_0x59cdb0,_0x508d91,_0x2e3ee8,_0x55b222,_0x96e3cb,_0x2c4784,_0x5c361b){return new Promise(function(_0x455472,_0x4c9831){return getAuthToken(_0x508d91,_0x2e3ee8,_0x2c4784)['then'](function(_0x508153){var _0x4af7b2=_0x2c4784[_0x1cca('0x26')]()===_0x1cca('0x27')?_0x96e3cb[_0x1cca('0x28')]:_0x96e3cb[_0x1cca('0x29')];var _0x317df5={'method':_0x1cca('0xe'),'uri':_0x55b222+_0x1cca('0x2a'),'body':{'fullname':_0x4af7b2,'firstname':_0x4af7b2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x59cdb0[_0x1cca('0x21')]+')'},'headers':{'Authorization':_0x1cca('0x2b')+_0x508153,'OData-Version':_0x1cca('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x317df5[_0x1cca('0x2c')][_0x5c361b]=_0x4af7b2;return rp(_0x317df5);})[_0x1cca('0x18')](function(_0x51c2fd){var _0x45a584=_0x51c2fd[_0x1cca('0x2d')]['odata-entityid'];var _0x41c8a6=_0x45a584[_0x1cca('0x2e')](_0x45a584[_0x1cca('0x2f')]('(')+0x1,_0x45a584['lastIndexOf'](')'));_0x59cdb0[_0x1cca('0x30')]=_0x41c8a6;_0x455472(_0x59cdb0);})['catch'](function(_0x2ba970){_0x4c9831(_0x2ba970[_0x1cca('0x31')]);});});}function getEndUser(_0x551e5b,_0x5c0a0b,_0x4c13e5,_0x121fce,_0x3fefea,_0x31b34d,_0x1a87ca,_0x2b0c8c){var _0x5e9089=_0x31b34d[_0x1cca('0x26')]()===_0x1cca('0x27')?_0x3fefea[_0x1cca('0x28')]:_0x3fefea[_0x1cca('0x29')];return getAuthToken(_0x5c0a0b,_0x4c13e5,_0x31b34d)[_0x1cca('0x18')](function(_0x5f1fb8){_0x2b0c8c=_0x2b0c8c?_0x2b0c8c:'telephone1';var _0x5f545f={'method':_0x1cca('0x32'),'uri':_0x121fce+_0x1cca('0x33')+_0x2b0c8c+_0x1cca('0x34')+_0x2b0c8c+'\x20eq\x20\x27'+_0x5e9089[_0x1cca('0x35')]('+',_0x1cca('0x36'))+'\x27','headers':{'Authorization':_0x1cca('0x2b')+_0x5f1fb8,'If-None-Match':null,'OData-Version':_0x1cca('0x1a')},'json':!![]};return rp(_0x5f545f);})[_0x1cca('0x18')](function(_0x318b01){var _0x3ed992=![];if(!_0x318b01)return _0x3ed992;var _0x40e7c7=_0x318b01['value'];for(var _0x1e6181=0x0;_0x1e6181<_0x40e7c7[_0x1cca('0x23')];_0x1e6181++){if(_0x40e7c7[_0x1e6181][_0x2b0c8c]===_0x5e9089){_0x3ed992=!![];_0x551e5b[_0x1cca('0x30')]=_0x40e7c7[_0x1e6181]['contactid'];}}return _0x3ed992;})[_0x1cca('0x18')](function(_0x47811a){if(_0x47811a)return _0x551e5b;if(_0x1a87ca===_0x1cca('0x37')){logger[_0x1cca('0x1f')]('['+[_0x31b34d['toUpperCase']()]+_0x1cca('0x38'));return _0x551e5b;}return createEndUser(_0x551e5b,_0x5c0a0b,_0x4c13e5,_0x121fce,_0x3fefea,_0x31b34d,_0x2b0c8c)[_0x1cca('0x18')](function(_0x11c1dc){logger[_0x1cca('0x1f')]('['+[_0x31b34d[_0x1cca('0x16')]()]+_0x1cca('0x39'),_0x11c1dc[_0x1cca('0x30')]);return _0x11c1dc;});});}function getCustomFields(_0x2ae861,_0x508d26,_0xc1024d){var _0x5b23db={};if(_0x2ae861[_0x1cca('0x23')]>0x0){_[_0x1cca('0x3a')](_0x2ae861,function(_0x20ed75){if(_[_0x1cca('0x3b')]([_0x1cca('0x3c'),'picklist'],_0x20ed75['type'])&&_0x20ed75[_0x1cca('0x3d')]&&!_0x20ed75['customField']){var _0x5d58e3=_0x20ed75[_0x1cca('0x3e')]['toLowerCase']();var _0x4ecb6f=_0x5d58e3[_0x1cca('0x2e')](0x0,_0x5d58e3[_0x1cca('0x3f')]('_'));var _0x26e9d2=_0x5d58e3[_0x1cca('0x2e')](_0x5d58e3[_0x1cca('0x3f')]('_')+0x1);if(_0x4ecb6f===_0xc1024d){_0x5b23db[_0x26e9d2]=_0x20ed75['content'];}}});}return _0x5b23db;}function getTicket(_0x3b8555,_0x5a9251,_0x41bd2e,_0x25d702,_0x2e241d,_0x3ca792,_0x2b9085){return new Promise(function(_0xc3f4b3,_0x567b4){var _0x5f37c0;return getAuthToken(_0x5a9251,_0x41bd2e,_0x2b9085)[_0x1cca('0x18')](function(_0x3ebb48){if(_0x3ca792['ticketType']===_0x1cca('0x40')){_0x5f37c0={'method':_0x1cca('0xe'),'uri':_0x25d702+_0x1cca('0x41'),'body':Object[_0x1cca('0x42')]({},{'title':intUtil['getString'](_0x3ca792[_0x1cca('0x43')],_0x2e241d,'\x20'),'description':intUtil[_0x1cca('0x44')](_0x3ca792[_0x1cca('0x45')],_0x2e241d,'\x0a'),'customerid_contact@odata.bind':_0x3b8555['enduserId']?_0x1cca('0x46')+_0x3b8555['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3b8555[_0x1cca('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x3ca792['Fields'],_0x2e241d,_0x3ca792[_0x1cca('0x47')])),'headers':{'Authorization':'Bearer\x20'+_0x3ebb48,'OData-Version':_0x1cca('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3ca792[_0x1cca('0x47')]===_0x1cca('0x48')){var _0xea2902=_0x3b8555[_0x1cca('0x30')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3b8555[_0x1cca('0x21')]+')','participationtypemask':_0x3b8555[_0x1cca('0x49')]===_0x1cca('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0x1cca('0x46')+_0x3b8555[_0x1cca('0x30')]+')','participationtypemask':_0x3b8555[_0x1cca('0x49')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1cca('0x4b')+_0x3b8555[_0x1cca('0x21')]+')','participationtypemask':_0x3b8555[_0x1cca('0x49')]===_0x1cca('0x4a')?0x2:0x1}];_0x5f37c0={'method':_0x1cca('0xe'),'uri':_0x25d702+_0x1cca('0x4c'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x3ca792['Subjects'],_0x2e241d,'\x20'),'phonenumber':String(_0x2e241d[_0x1cca('0x29')]),'description':intUtil[_0x1cca('0x44')](_0x3ca792[_0x1cca('0x45')],_0x2e241d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3b8555['enduserId']?_0x1cca('0x46')+_0x3b8555[_0x1cca('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3b8555[_0x1cca('0x21')]+')','directioncode':_0x3b8555[_0x1cca('0x49')]===_0x1cca('0x4a')?![]:!![],'phonecall_activity_parties':_0xea2902},getCustomFields(_0x3ca792['Fields'],_0x2e241d,_0x3ca792[_0x1cca('0x47')])),'headers':{'Authorization':_0x1cca('0x2b')+_0x3ebb48,'OData-Version':_0x1cca('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5f37c0);})[_0x1cca('0x18')](function(_0x45f913){var _0x30b589=_0x45f913[_0x1cca('0x2d')][_0x1cca('0x4d')];var _0x228b32=_0x30b589[_0x1cca('0x2e')](_0x30b589[_0x1cca('0x2f')]('(')+0x1,_0x30b589[_0x1cca('0x2f')](')'));_0x3b8555[_0x1cca('0x4e')]=_0x228b32;_0xc3f4b3(_0x3b8555);})[_0x1cca('0x25')](function(_0x3dc34b){_0x567b4(_0x3dc34b[_0x1cca('0x31')]);});});}function emit(_0x25cee6,_0x5899a4,_0x15d4e7,_0x392ea3){var _0x3ddd37={'uri':util[_0x1cca('0x4f')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x25cee6,_0x15d4e7,_0x392ea3)};io['to'](util['format'](_0x1cca('0x50'),_0x5899a4))['emit'](_0x1cca('0x51'),_0x3ddd37);}exports['cs']=function(_0x24ecc7,_0x4f5784,_0x7ca58a,_0x5caf03,_0x33ec8b,_0x1a23d9,_0x1417d0,_0x345635){var _0x40ca02={};_0x1a23d9[_0x1cca('0x10')]=_0x1a23d9[_0x1cca('0x8')]?intUtil[_0x1cca('0x52')](_0x1a23d9[_0x1cca('0x9')][_0x1cca('0xa')]):intUtil[_0x1cca('0x52')](_0x1a23d9[_0x1cca('0x10')]);_0x1a23d9[_0x1cca('0x53')]=intUtil['stripTrailingSlash'](_0x1a23d9['serverUrl']);_0x40ca02[_0x1cca('0x49')]=_0x345635==='queue'||_0x345635===_0x1cca('0x54')?'queue':_0x1cca('0x27');var _0x1d72c2=_0x1a23d9['modernAuthentication']?util['format'](_0x1cca('0x55'),_0x1a23d9[_0x1cca('0x9')][_0x1cca('0xa')]):util[_0x1cca('0x4f')](_0x1cca('0x55'),_0x1a23d9[_0x1cca('0x10')]);var _0x62fd41=util[_0x1cca('0x4f')](_0x1cca('0x56'),_0x1a23d9['tenantId']);var _0x2a3298=util['format'](_0x1cca('0x57'),_0x1a23d9['serverUrl'],_0x4f5784['uniqueid'],md5(_0x4f5784['uniqueid']));if(_0x33ec8b&&_0x33ec8b[_0x1cca('0x58')]){logger[_0x1cca('0x1f')](_0x1cca('0x59'),_0x1cca('0x5a'));_0x4f5784[_0x1cca('0x5b')]=_0x2a3298;}else if(_0x1417d0&&_0x1417d0[_0x1cca('0x5c')]&&_0x1417d0['recordingFormat']!==_0x1cca('0x5d')){logger[_0x1cca('0x1f')](_0x1cca('0x5e'),'Recording\x20is\x20enabled!');_0x4f5784[_0x1cca('0x5b')]=_0x2a3298;}else{_0x4f5784['recordingURL']='';}return getUser(_0x40ca02,_0x1a23d9,_0x5caf03,_0x62fd41,_0x1d72c2,_0x345635)['then'](function(_0x1b0566){logger[_0x1cca('0x1f')]('['+_0x345635['toUpperCase']()+_0x1cca('0x5f'),_0x1b0566[_0x1cca('0x21')]);logger[_0x1cca('0x1f')]('['+_0x345635[_0x1cca('0x16')]()+_0x1cca('0x60'),_0x1b0566[_0x1cca('0x1e')]);return getEndUser(_0x1b0566,_0x1a23d9,_0x62fd41,_0x1d72c2,_0x4f5784,_0x345635,_0x7ca58a['moduleCreate'],_0x7ca58a[_0x1cca('0x61')]);})[_0x1cca('0x18')](function(_0x3f81df){logger[_0x1cca('0x1f')]('['+_0x345635[_0x1cca('0x16')]()+_0x1cca('0x62'),_0x3f81df[_0x1cca('0x30')]);logger[_0x1cca('0x1f')]('['+_0x345635['toUpperCase']()+_0x1cca('0x63'),_0x4f5784[_0x1cca('0x29')]);return getTicket(_0x3f81df,_0x1a23d9,_0x62fd41,_0x1d72c2,_0x4f5784,_0x7ca58a,_0x345635);})[_0x1cca('0x18')](function(_0xc55897){logger[_0x1cca('0x1f')](util[_0x1cca('0x4f')]('['+_0x345635['toUpperCase']()+_0x1cca('0x64'),_0x7ca58a[_0x1cca('0x47')],_0xc55897['ticketId']));logger[_0x1cca('0x1f')](util[_0x1cca('0x4f')]('['+_0x345635['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x345635));if(_0x345635!==_0x1cca('0x54')&&_0x7ca58a[_0x1cca('0x65')]){logger[_0x1cca('0x1f')]('['+_0x345635[_0x1cca('0x16')]()+']',_0x1cca('0x66'));emit(_0x1a23d9[_0x1cca('0x10')],_0x5caf03[_0x1cca('0x67')],_0x7ca58a[_0x1cca('0x47')],_0xc55897['ticketId']);}})[_0x1cca('0x25')](function(_0x2f9690){logger[_0x1cca('0x15')]('['+_0x345635[_0x1cca('0x16')]()+_0x1cca('0x68'),_0x2f9690[_0x1cca('0x31')]);console[_0x1cca('0x15')]('Error\x20running\x20Dynamics365\x20integration',_0x2f9690);});}; \ No newline at end of file +var _0x39ff=['Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','modernAuthentication','stripTrailingSlash','CloudProvider','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','data7','tenantId','resolve','data5','POST','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','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!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','message','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing','forEach','includes','picklist','type','nameField','indexOf','content','ticketType','assign','getString'];(function(_0x5e1938,_0x3f8e97){var _0x278ee7=function(_0x26873a){while(--_0x26873a){_0x5e1938['push'](_0x5e1938['shift']());}};_0x278ee7(++_0x3f8e97);}(_0x39ff,0x90));var _0xf39f=function(_0x4ce0b9,_0x4e1112){_0x4ce0b9=_0x4ce0b9-0x0;var _0x3b750c=_0x39ff[_0x4ce0b9];return _0x3b750c;};'use strict';var _=require('lodash');var rp=require(_0xf39f('0x0'));var util=require(_0xf39f('0x1'));var intUtil=require(_0xf39f('0x2'));var md5=require(_0xf39f('0x3'));var Redis=require(_0xf39f('0x4'));var logger=require('../../../../config/logger')(_0xf39f('0x5'));var config=require(_0xf39f('0x6'));config[_0xf39f('0x7')]=_[_0xf39f('0x8')](config[_0xf39f('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf39f('0x7')]));function getAuthToken(_0x4a3c5c,_0x484166,_0x5f4c8a){if(_0x4a3c5c['modernAuthentication']){_0x4a3c5c['remoteUri']=_0x4a3c5c['CloudProvider'][_0xf39f('0x9')];_0x4a3c5c[_0xf39f('0xa')]=_0x4a3c5c['CloudProvider']['data2'];return Promise[_0xf39f('0xb')](_0x4a3c5c['CloudProvider'][_0xf39f('0xc')]);}var _0x17bc38={'method':_0xf39f('0xd'),'uri':_0x484166,'form':{'client_id':_0x4a3c5c['clientId'],'resource':_0x4a3c5c[_0xf39f('0xe')],'username':_0x4a3c5c[_0xf39f('0xf')],'password':_0x4a3c5c[_0xf39f('0x10')],'grant_type':_0xf39f('0x10'),'client_secret':_0x4a3c5c[_0xf39f('0x11')]},'json':!![]};return rp(_0x17bc38)[_0xf39f('0x12')](function(_0xe7df47){return _0xe7df47[_0xf39f('0x13')];})[_0xf39f('0x14')](function(_0x14d144){logger[_0xf39f('0x15')]('['+[_0x5f4c8a[_0xf39f('0x16')]()]+_0xf39f('0x17'));return _0x14d144['message'];});}function getUser(_0x383e53,_0x56f301,_0x9bee23,_0x3c92bc,_0x452a3c,_0x484e8c){return new Promise(function(_0x5ecc00,_0x1ff570){return getAuthToken(_0x56f301,_0x3c92bc,_0x484e8c)[_0xf39f('0x12')](function(_0xe15316){var _0x38158d={'method':_0xf39f('0x18'),'uri':_0x452a3c+_0xf39f('0x19'),'headers':{'Authorization':_0xf39f('0x1a')+_0xe15316,'OData-Version':_0xf39f('0x1b')},'json':!![]};return rp(_0x38158d);})[_0xf39f('0x12')](function(_0x393747){var _0x39b837=_0x393747[_0xf39f('0x1c')];var _0x895273=![];var _0x1d7600=null;if(!_[_0xf39f('0x1d')](_0x9bee23)){if(intUtil[_0xf39f('0x1e')](_0x9bee23[_0xf39f('0x1f')])){_0x383e53[_0xf39f('0x20')]=_0x9bee23[_0xf39f('0x1f')];for(_0x1d7600=0x0;_0x1d7600<_0x39b837[_0xf39f('0x21')];_0x1d7600++){if(_0x39b837[_0x1d7600][_0xf39f('0x22')]===_0x9bee23['email']&&!_0x39b837[_0x1d7600][_0xf39f('0x23')]){_0x895273=!![];logger[_0xf39f('0x24')]('['+[_0x484e8c['toUpperCase']()]+_0xf39f('0x25')+_0x39b837[_0x1d7600][_0xf39f('0x26')]+'!');_0x383e53[_0xf39f('0x27')]=_0x39b837[_0x1d7600]['systemuserid'];}}}}if(!_0x895273){logger[_0xf39f('0x24')]('['+[_0x484e8c[_0xf39f('0x16')]()]+_0xf39f('0x28'));_0x383e53[_0xf39f('0x20')]=_0x56f301[_0xf39f('0xf')];for(_0x1d7600=0x0;_0x1d7600<_0x39b837[_0xf39f('0x21')];_0x1d7600++){if(_0x39b837[_0x1d7600][_0xf39f('0x22')]===_0x56f301[_0xf39f('0xf')]){_0x383e53['userId']=_0x39b837[_0x1d7600][_0xf39f('0x26')];}}}_0x5ecc00(_0x383e53);})[_0xf39f('0x14')](function(_0x5c4f68){_0x1ff570(_0x5c4f68['message']);});});}function createEndUser(_0x3e5ffa,_0x199ed5,_0x5ac17f,_0x23a182,_0x313b80,_0x47652c,_0x376360){return new Promise(function(_0x468efc,_0x520ab3){return getAuthToken(_0x199ed5,_0x5ac17f,_0x47652c)[_0xf39f('0x12')](function(_0x44f4cb){var _0x134029=_0x47652c[_0xf39f('0x29')]()===_0xf39f('0x2a')?_0x313b80[_0xf39f('0x2b')]:_0x313b80[_0xf39f('0x2c')];var _0x21b385={'method':'POST','uri':_0x23a182+_0xf39f('0x2d'),'body':{'fullname':_0x134029,'firstname':_0x134029,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3e5ffa[_0xf39f('0x27')]+')'},'headers':{'Authorization':_0xf39f('0x1a')+_0x44f4cb,'OData-Version':_0xf39f('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x21b385[_0xf39f('0x2e')][_0x376360]=_0x134029;return rp(_0x21b385);})[_0xf39f('0x12')](function(_0x3d53d1){var _0x3a0994=_0x3d53d1[_0xf39f('0x2f')][_0xf39f('0x30')];var _0xfaf07b=_0x3a0994[_0xf39f('0x31')](_0x3a0994[_0xf39f('0x32')]('(')+0x1,_0x3a0994['lastIndexOf'](')'));_0x3e5ffa['enduserId']=_0xfaf07b;_0x468efc(_0x3e5ffa);})[_0xf39f('0x14')](function(_0x20c2b2){_0x520ab3(_0x20c2b2[_0xf39f('0x33')]);});});}function getEndUser(_0x58e898,_0x3ee325,_0x1e91e0,_0x347045,_0x5ca147,_0x47b9b5,_0x342768,_0x4337ca){var _0x4e91a3=_0x47b9b5['toLowerCase']()==='outbound'?_0x5ca147[_0xf39f('0x2b')]:_0x5ca147['calleridnum'];return getAuthToken(_0x3ee325,_0x1e91e0,_0x47b9b5)[_0xf39f('0x12')](function(_0x7a27bf){_0x4337ca=_0x4337ca?_0x4337ca:_0xf39f('0x34');var _0x231b5a={'method':'GET','uri':_0x347045+_0xf39f('0x35')+_0x4337ca+'&$filter='+_0x4337ca+_0xf39f('0x36')+_0x4e91a3[_0xf39f('0x37')]('+',_0xf39f('0x38'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x7a27bf,'If-None-Match':null,'OData-Version':_0xf39f('0x1b')},'json':!![]};return rp(_0x231b5a);})[_0xf39f('0x12')](function(_0x2d8551){var _0x11a653=![];if(!_0x2d8551)return _0x11a653;var _0x4bca0f=_0x2d8551[_0xf39f('0x1c')];for(var _0x39d72e=0x0;_0x39d72e<_0x4bca0f[_0xf39f('0x21')];_0x39d72e++){if(_0x4bca0f[_0x39d72e][_0x4337ca]===_0x4e91a3){_0x11a653=!![];_0x58e898[_0xf39f('0x39')]=_0x4bca0f[_0x39d72e][_0xf39f('0x3a')];}}return _0x11a653;})['then'](function(_0x38eac9){if(_0x38eac9)return _0x58e898;if(_0x342768===_0xf39f('0x3b')){logger[_0xf39f('0x24')]('['+[_0x47b9b5[_0xf39f('0x16')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x58e898;}return createEndUser(_0x58e898,_0x3ee325,_0x1e91e0,_0x347045,_0x5ca147,_0x47b9b5,_0x4337ca)['then'](function(_0x21c8d8){logger['info']('['+[_0x47b9b5[_0xf39f('0x16')]()]+']\x20Enduser\x20created!',_0x21c8d8[_0xf39f('0x39')]);return _0x21c8d8;});});}function getCustomFields(_0x345d1b,_0x48cc02,_0x345425){var _0x194bcb={};if(_0x345d1b['length']>0x0){_[_0xf39f('0x3c')](_0x345d1b,function(_0x5a7a17){if(_[_0xf39f('0x3d')](['string',_0xf39f('0x3e')],_0x5a7a17[_0xf39f('0x3f')])&&_0x5a7a17[_0xf39f('0x40')]&&!_0x5a7a17['customField']){var _0x213a0f=_0x5a7a17['idField'][_0xf39f('0x29')]();var _0x66b380=_0x213a0f[_0xf39f('0x31')](0x0,_0x213a0f[_0xf39f('0x41')]('_'));var _0x8fd47f=_0x213a0f[_0xf39f('0x31')](_0x213a0f[_0xf39f('0x41')]('_')+0x1);if(_0x66b380===_0x345425){_0x194bcb[_0x8fd47f]=_0x5a7a17[_0xf39f('0x42')];}}});}return _0x194bcb;}function getTicket(_0x1d3866,_0x46e68a,_0x43eef8,_0x52aace,_0x5bc899,_0x43fbf5,_0x1540ac){return new Promise(function(_0x4c1677,_0x6b84){var _0x43ec3a;return getAuthToken(_0x46e68a,_0x43eef8,_0x1540ac)[_0xf39f('0x12')](function(_0x523168){if(_0x43fbf5[_0xf39f('0x43')]==='incident'){_0x43ec3a={'method':_0xf39f('0xd'),'uri':_0x52aace+'incidents','body':Object[_0xf39f('0x44')]({},{'title':intUtil[_0xf39f('0x45')](_0x43fbf5[_0xf39f('0x46')],_0x5bc899,'\x20'),'description':intUtil['getString'](_0x43fbf5[_0xf39f('0x47')],_0x5bc899,'\x0a'),'customerid_contact@odata.bind':_0x1d3866[_0xf39f('0x39')]?_0xf39f('0x48')+_0x1d3866[_0xf39f('0x39')]+')':undefined,'ownerid@odata.bind':_0xf39f('0x49')+_0x1d3866[_0xf39f('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x43fbf5[_0xf39f('0x4a')],_0x5bc899,_0x43fbf5[_0xf39f('0x43')])),'headers':{'Authorization':_0xf39f('0x1a')+_0x523168,'OData-Version':_0xf39f('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x43fbf5['ticketType']===_0xf39f('0x4b')){var _0x21821d=_0x1d3866[_0xf39f('0x39')]?[{'partyid_systemuser@odata.bind':_0xf39f('0x49')+_0x1d3866[_0xf39f('0x27')]+')','participationtypemask':_0x1d3866[_0xf39f('0x4c')]===_0xf39f('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0xf39f('0x48')+_0x1d3866[_0xf39f('0x39')]+')','participationtypemask':_0x1d3866[_0xf39f('0x4c')]===_0xf39f('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1d3866[_0xf39f('0x27')]+')','participationtypemask':_0x1d3866[_0xf39f('0x4c')]==='queue'?0x2:0x1}];_0x43ec3a={'method':_0xf39f('0xd'),'uri':_0x52aace+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xf39f('0x45')](_0x43fbf5['Subjects'],_0x5bc899,'\x20'),'phonenumber':String(_0x5bc899[_0xf39f('0x2c')]),'description':intUtil[_0xf39f('0x45')](_0x43fbf5['Descriptions'],_0x5bc899,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1d3866[_0xf39f('0x39')]?'/contacts('+_0x1d3866[_0xf39f('0x39')]+')':undefined,'ownerid@odata.bind':_0xf39f('0x49')+_0x1d3866[_0xf39f('0x27')]+')','directioncode':_0x1d3866['callDirection']===_0xf39f('0x4d')?![]:!![],'phonecall_activity_parties':_0x21821d},getCustomFields(_0x43fbf5[_0xf39f('0x4a')],_0x5bc899,_0x43fbf5['ticketType'])),'headers':{'Authorization':_0xf39f('0x1a')+_0x523168,'OData-Version':_0xf39f('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x43ec3a);})['then'](function(_0x42d9b7){var _0x49867f=_0x42d9b7['headers'][_0xf39f('0x30')];var _0x299b7b=_0x49867f[_0xf39f('0x31')](_0x49867f['lastIndexOf']('(')+0x1,_0x49867f[_0xf39f('0x32')](')'));_0x1d3866[_0xf39f('0x4e')]=_0x299b7b;_0x4c1677(_0x1d3866);})[_0xf39f('0x14')](function(_0x2323b6){_0x6b84(_0x2323b6['message']);});});}function emit(_0x2ae307,_0x5bb307,_0x35c236,_0x1b44d8){var _0x184251={'uri':util[_0xf39f('0x4f')](_0xf39f('0x50'),_0x2ae307,_0x35c236,_0x1b44d8)};io['to'](util[_0xf39f('0x4f')](_0xf39f('0x51'),_0x5bb307))['emit']('trigger:browser:url',_0x184251);}exports['cs']=function(_0x10e63c,_0x5023ca,_0x13691c,_0x435374,_0x122f41,_0x566ce4,_0x4ee236,_0x3e4ca9){var _0x2e557a={};_0x566ce4['remoteUri']=_0x566ce4[_0xf39f('0x52')]?intUtil[_0xf39f('0x53')](_0x566ce4[_0xf39f('0x54')][_0xf39f('0x9')]):intUtil[_0xf39f('0x53')](_0x566ce4[_0xf39f('0xe')]);_0x566ce4[_0xf39f('0x55')]=intUtil[_0xf39f('0x53')](_0x566ce4[_0xf39f('0x55')]);_0x2e557a[_0xf39f('0x4c')]=_0x3e4ca9===_0xf39f('0x4d')||_0x3e4ca9===_0xf39f('0x56')?_0xf39f('0x4d'):'outbound';var _0x30d235=_0x566ce4[_0xf39f('0x52')]?util[_0xf39f('0x4f')]('%s/api/data/v9.0/',_0x566ce4[_0xf39f('0x54')][_0xf39f('0x9')]):util[_0xf39f('0x4f')](_0xf39f('0x57'),_0x566ce4['remoteUri']);var _0x25b6e0=util[_0xf39f('0x4f')]('https://login.microsoftonline.com/%s/oauth2/token',_0x566ce4[_0xf39f('0xa')]);var _0x2daea7=util[_0xf39f('0x4f')](_0xf39f('0x58'),_0x566ce4[_0xf39f('0x55')],_0x5023ca['uniqueid'],md5(_0x5023ca[_0xf39f('0x59')]));if(_0x122f41&&_0x122f41[_0xf39f('0x5a')]){logger[_0xf39f('0x24')](_0xf39f('0x5b'),_0xf39f('0x5c'));_0x5023ca['recordingURL']=_0x2daea7;}else if(_0x4ee236&&_0x4ee236[_0xf39f('0x5d')]&&_0x4ee236[_0xf39f('0x5d')]!==_0xf39f('0x5e')){logger[_0xf39f('0x24')]('[OUTBOUND]',_0xf39f('0x5c'));_0x5023ca[_0xf39f('0x5f')]=_0x2daea7;}else{_0x5023ca[_0xf39f('0x5f')]='';}return getUser(_0x2e557a,_0x566ce4,_0x435374,_0x25b6e0,_0x30d235,_0x3e4ca9)[_0xf39f('0x12')](function(_0x497d57){logger[_0xf39f('0x24')]('['+_0x3e4ca9[_0xf39f('0x16')]()+_0xf39f('0x60'),_0x497d57[_0xf39f('0x27')]);logger[_0xf39f('0x24')]('['+_0x3e4ca9[_0xf39f('0x16')]()+_0xf39f('0x61'),_0x497d57[_0xf39f('0x20')]);return getEndUser(_0x497d57,_0x566ce4,_0x25b6e0,_0x30d235,_0x5023ca,_0x3e4ca9,_0x13691c[_0xf39f('0x62')],_0x13691c[_0xf39f('0x63')]);})[_0xf39f('0x12')](function(_0x9e8c61){logger['info']('['+_0x3e4ca9[_0xf39f('0x16')]()+_0xf39f('0x64'),_0x9e8c61[_0xf39f('0x39')]);logger['info']('['+_0x3e4ca9[_0xf39f('0x16')]()+_0xf39f('0x65'),_0x5023ca['calleridnum']);return getTicket(_0x9e8c61,_0x566ce4,_0x25b6e0,_0x30d235,_0x5023ca,_0x13691c,_0x3e4ca9);})[_0xf39f('0x12')](function(_0x4fbd7d){logger[_0xf39f('0x24')](util[_0xf39f('0x4f')]('['+_0x3e4ca9[_0xf39f('0x16')]()+_0xf39f('0x66'),_0x13691c[_0xf39f('0x43')],_0x4fbd7d[_0xf39f('0x4e')]));logger[_0xf39f('0x24')](util['format']('['+_0x3e4ca9[_0xf39f('0x16')]()+_0xf39f('0x67'),_0x3e4ca9));if(_0x3e4ca9!=='unmanaged'&&_0x13691c[_0xf39f('0x68')]){logger['info']('['+_0x3e4ca9[_0xf39f('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x566ce4[_0xf39f('0xe')],_0x435374[_0xf39f('0x69')],_0x13691c['ticketType'],_0x4fbd7d[_0xf39f('0x4e')]);}})['catch'](function(_0x3a5bf8){logger[_0xf39f('0x15')]('['+_0x3e4ca9['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x3a5bf8[_0xf39f('0x33')]);console['error'](_0xf39f('0x6a'),_0x3a5bf8);});}; \ 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 a621505..fd39aa3 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 _0x00af=['find','contact','email','%s/api/v2/agents/me','remoteUri','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','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','idField','push','type','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','trigger:browser:url','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','emit','info','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!'];(function(_0x2b3bb9,_0x1556ce){var _0x5d3da5=function(_0x10e14d){while(--_0x10e14d){_0x2b3bb9['push'](_0x2b3bb9['shift']());}};_0x5d3da5(++_0x1556ce);}(_0x00af,0x99));var _0xf00a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00af[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xf00a('0x0'));var rp=require(_0xf00a('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xf00a('0x2'));var intUtil=require(_0xf00a('0x3'));var config=require(_0xf00a('0x4'));var logger=require(_0xf00a('0x5'))(_0xf00a('0x6'));config[_0xf00a('0x7')]=_[_0xf00a('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf00a('0x9'))(new Redis(config[_0xf00a('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x16d798,_0x20b143,_0x27ae8b){io['to'](_0x16d798)[_0xf00a('0xa')](_0x20b143,_0x27ae8b);}function getTicket(_0x4cfc6f,_0x238f1c,_0x3d32ee,_0x3d87be,_0x339247){logger[_0xf00a('0xb')]('Creating\x20new\x20ticket...');var _0x569fd5=_['merge']({'responder_id':_0x238f1c['id'],'requester_id':_0x3d32ee['id'],'name':util[_0xf00a('0xc')](_0xf00a('0xd'),_0x339247[_0xf00a('0xe')]),'phone':_0x339247[_0xf00a('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf00a('0x10')](_0x3d87be[_0xf00a('0x11')],_0x339247,'\x20'),'description':intUtil[_0xf00a('0x10')](_0x3d87be[_0xf00a('0x12')],_0x339247,'
'),'tags':getTags(_0x3d87be[_0xf00a('0x13')],_0xf00a('0x14'))},getCustomFields(_0x3d87be[_0xf00a('0x15')],_0x339247));_0x569fd5[_0xf00a('0x16')]=_[_0xf00a('0x17')](_[_0xf00a('0x18')](_0x569fd5[_0xf00a('0x16')],'id'),_0xf00a('0x19'));return request({'uri':util[_0xf00a('0xc')](_0xf00a('0x1a'),_0x4cfc6f['remoteUri']),'method':_0xf00a('0x1b'),'body':_0x569fd5})[_0xf00a('0x1c')](function(_0x609453){logger[_0xf00a('0xb')](_0xf00a('0x1d'));return _0x609453;});}function getUser(_0x491b95,_0x9c0d94){if(intUtil[_0xf00a('0x1e')](_0x9c0d94)){return request({'uri':util['format'](_0xf00a('0x1f'),_0x491b95['remoteUri']),'qs':{'email':_0x9c0d94}})[_0xf00a('0x1c')](function(_0x414b70){if(_0x414b70['length']){logger[_0xf00a('0xb')](_0xf00a('0x20'));return _[_0xf00a('0x21')](_0x414b70,function(_0x3912f0){return _0x3912f0[_0xf00a('0x22')][_0xf00a('0x23')]===_0x9c0d94;});}else{logger[_0xf00a('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf00a('0xc')](_0xf00a('0x24'),_0x491b95[_0xf00a('0x25')])})[_0xf00a('0x1c')](function(_0x4f33be){logger['info'](_0xf00a('0x26'));return _0x4f33be;});}});}else{logger[_0xf00a('0xb')](_0xf00a('0x27'));return request({'uri':util[_0xf00a('0xc')](_0xf00a('0x24'),_0x491b95['remoteUri'])})[_0xf00a('0x1c')](function(_0x595318){logger[_0xf00a('0xb')](_0xf00a('0x26'));return _0x595318;});}}function getEndUser(_0x56f871,_0x215b29,_0x18b527){logger[_0xf00a('0xb')](_0xf00a('0x28'),_0x18b527);return request({'uri':util[_0xf00a('0xc')](_0xf00a('0x29'),_0x56f871['remoteUri']),'qs':{'phone':_0x18b527}})['then'](function(_0x4a8249){if(_0x4a8249[_0xf00a('0x2a')]){logger[_0xf00a('0xb')]('Enduser\x20found!');return _[_0xf00a('0x21')](_0x4a8249,{'phone':_0x18b527});}else{logger[_0xf00a('0xb')](_0xf00a('0x2b'));return request({'uri':util[_0xf00a('0xc')](_0xf00a('0x29'),_0x56f871[_0xf00a('0x25')]),'method':_0xf00a('0x1b'),'body':{'name':_0x215b29,'phone':_0x18b527}})[_0xf00a('0x1c')](function(_0x420b9b){logger['info']('Enduser\x20created.');return _0x420b9b;});}});}function getAuth(_0x4177b0){return util['format'](_0xf00a('0x2c'),new Buffer(_0x4177b0[_0xf00a('0x2d')]+':X')[_0xf00a('0x2e')](_0xf00a('0x2f')));}function request(_0x5da040){logger[_0xf00a('0x30')](_0xf00a('0x31'),JSON[_0xf00a('0x32')](_0x5da040));return rp(_['defaults'](_0x5da040,{'method':_0xf00a('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x2293e8,_0x2d0887){var _0x331cab=[];if(_0x2293e8&&_0x2293e8['length']>0x0){_0x331cab=_['map'](_0x2293e8,_0x2d0887);}return _0x331cab;}function getCustomFields(_0x4ea5e3,_0x591997){var _0x927362=[];var _0x37c3c6={'custom_fields':[]};if(_0x4ea5e3[_0xf00a('0x2a')]>0x0){_[_0xf00a('0x34')](_0x4ea5e3,function(_0x1608ef){if(_[_0xf00a('0x35')]([_0xf00a('0x36'),_0xf00a('0x37')],_0x1608ef['type'])&&_0x1608ef[_0xf00a('0x38')]&&!_0x1608ef[_0xf00a('0x39')]){_0x37c3c6[_0x1608ef['nameField'][_0xf00a('0x3a')]()]=_0x1608ef[_0xf00a('0x3b')][_0xf00a('0x2e')]();}else if(_[_0xf00a('0x35')](['string',_0xf00a('0x37')],_0x1608ef['type'])&&_0x1608ef[_0xf00a('0x3c')]&&_0x1608ef[_0xf00a('0x39')]){_0x37c3c6['custom_fields'][_0xf00a('0x3d')]({'id':_0x1608ef['idField'],'value':_0x1608ef['content'][_0xf00a('0x2e')]()});}else if(_0x1608ef[_0xf00a('0x3e')]===_0xf00a('0x3f')&&_0x1608ef[_0xf00a('0x40')]&&_0x1608ef['idField']&&_0x1608ef[_0xf00a('0x39')]){_0x591997[_0x1608ef[_0xf00a('0x40')]]&&_0x37c3c6[_0xf00a('0x16')][_0xf00a('0x3d')]({'id':_0x1608ef[_0xf00a('0x3c')],'value':_0x591997[_0x1608ef[_0xf00a('0x40')]][_0xf00a('0x2e')]()});}else if(_0x1608ef['type']===_0xf00a('0x41')&&_0x1608ef[_0xf00a('0x42')]&&_0x1608ef[_0xf00a('0x42')][_0xf00a('0x14')]&&_0x1608ef['idField']&&_0x1608ef[_0xf00a('0x39')]){_0x591997[_0x1608ef['Variable']['name']['toLowerCase']()]&&_0x37c3c6['custom_fields'][_0xf00a('0x3d')]({'id':_0x1608ef['idField'],'value':_0x591997[_0x1608ef[_0xf00a('0x42')][_0xf00a('0x14')][_0xf00a('0x3a')]()][_0xf00a('0x2e')]()});}});}return _0x37c3c6;}exports[_0xf00a('0x43')]=function(_0x32eee4,_0x4b9802,_0x1b670c,_0x409f21,_0x1adf8f,_0x5690c1){var _0x11d94c,_0xbc5314;_0x5690c1[_0xf00a('0x25')]=intUtil[_0xf00a('0x44')](_0x5690c1[_0xf00a('0x25')]);_0x5690c1[_0xf00a('0x45')]=intUtil[_0xf00a('0x44')](_0x5690c1[_0xf00a('0x45')]);if(_0x1adf8f&&_0x1adf8f[_0xf00a('0x46')]){logger[_0xf00a('0xb')](_0xf00a('0x47'),'Recording\x20is\x20enabled!');_0x4b9802['recordingURL']=util[_0xf00a('0xc')](_0xf00a('0x48'),_0x5690c1[_0xf00a('0x45')],_0x4b9802[_0xf00a('0x49')],md5(_0x4b9802['uniqueid']));}else{_0x4b9802[_0xf00a('0x4a')]='';}headers[_0xf00a('0x4b')]=getAuth(_0x5690c1);return getUser(_0x5690c1,_0x409f21[_0xf00a('0x23')])[_0xf00a('0x1c')](function(_0x54aadd){_0x11d94c=_0x54aadd;logger[_0xf00a('0xb')](_0xf00a('0x4c'),_0x11d94c['id']);return getEndUser(_0x5690c1,_0x4b9802[_0xf00a('0xe')],_0x4b9802[_0xf00a('0xf')]);})[_0xf00a('0x1c')](function(_0x5deae3){_0xbc5314=_0x5deae3;logger[_0xf00a('0xb')](_0xf00a('0x4d'),_0xbc5314['id']);return getTicket(_0x5690c1,_0x11d94c,_0xbc5314,_0x1b670c,_0x4b9802);})[_0xf00a('0x1c')](function(_0x1acbe4){if(_0x1acbe4&&_0x1acbe4['id']){logger[_0xf00a('0xb')]('Ticket\x20created!');logger[_0xf00a('0xb')](_0xf00a('0x4e'),_0x1acbe4['id']);logger[_0xf00a('0xb')]('[QUEUE]',_0xf00a('0x4f'));emit(util['format'](_0xf00a('0x50'),_0x409f21[_0xf00a('0x14')]),'trigger:browser:url',{'uri':util['format'](_0xf00a('0x51'),_0x5690c1['remoteUri'],_0x1acbe4['id'])});}})[_0xf00a('0x52')](function(_0x310a67){logger[_0xf00a('0x53')](_0xf00a('0x47'),JSON[_0xf00a('0x32')](_0x310a67));});};exports[_0xf00a('0x54')]=function(_0x1a535e,_0x35a584,_0x5923a8,_0x23cb57,_0x5efcb8,_0x43b6c7,_0x3ade08){var _0x2ee7e9,_0x403a7b;_0x43b6c7[_0xf00a('0x25')]=intUtil[_0xf00a('0x44')](_0x43b6c7[_0xf00a('0x25')]);_0x43b6c7[_0xf00a('0x45')]=intUtil['stripTrailingSlash'](_0x43b6c7['serverUrl']);if(_0x3ade08&&_0x3ade08['recordingFormat']&&_0x3ade08['recordingFormat']!==_0xf00a('0x55')){logger[_0xf00a('0xb')](_0xf00a('0x56'),_0xf00a('0x57'));_0x35a584[_0xf00a('0x4a')]=util[_0xf00a('0xc')](_0xf00a('0x48'),_0x43b6c7['serverUrl'],_0x35a584[_0xf00a('0x49')],md5(_0x35a584[_0xf00a('0x49')]));}headers[_0xf00a('0x4b')]=getAuth(_0x43b6c7);return getUser(_0x43b6c7,_0x23cb57[_0xf00a('0x23')])[_0xf00a('0x1c')](function(_0x3e375a){_0x2ee7e9=_0x3e375a;logger[_0xf00a('0xb')](_0xf00a('0x4c'),_0x2ee7e9['id']);return getEndUser(_0x43b6c7,_0x35a584[_0xf00a('0x58')],_0x35a584[_0xf00a('0x59')]);})[_0xf00a('0x1c')](function(_0x51b11f){_0x403a7b=_0x51b11f;logger[_0xf00a('0xb')]('The\x20Enduser\x20ID\x20is:',_0x403a7b['id']);return getTicket(_0x43b6c7,_0x2ee7e9,_0x403a7b,_0x5923a8,_0x35a584);})[_0xf00a('0x1c')](function(_0x19eee3){if(_0x19eee3&&_0x19eee3['id']){logger['info']('Ticket\x20created!');logger[_0xf00a('0xb')]('The\x20Ticket\x20ID\x20is:',_0x19eee3['id']);logger['info'](_0xf00a('0x56'),_0xf00a('0x4f'));emit(util[_0xf00a('0xc')]('user:%s',_0x23cb57[_0xf00a('0x14')]),_0xf00a('0x5a'),{'uri':util[_0xf00a('0xc')](_0xf00a('0x51'),_0x43b6c7[_0xf00a('0x25')],_0x19eee3['id'])});}})[_0xf00a('0x52')](function(_0x432001){logger[_0xf00a('0x53')](_0xf00a('0x56'),JSON['stringify'](_0x432001));});};exports['unmanaged']=function(_0x1a4cd5,_0x2fde3d,_0x1b757f,_0x56b3c3,_0xb0f928,_0x1ebac2){var _0x3687a4,_0x486d21;_0x1ebac2[_0xf00a('0x25')]=intUtil[_0xf00a('0x44')](_0x1ebac2['remoteUri']);_0x1ebac2[_0xf00a('0x45')]=intUtil['stripTrailingSlash'](_0x1ebac2[_0xf00a('0x45')]);if(_0xb0f928&&_0xb0f928[_0xf00a('0x46')]){logger[_0xf00a('0xb')]('['+_0x2fde3d[_0xf00a('0x5b')][_0xf00a('0x5c')]()+']','Recording\x20is\x20enabled!');_0x2fde3d['recordingURL']=util[_0xf00a('0xc')](_0xf00a('0x48'),_0x1ebac2[_0xf00a('0x45')],_0x2fde3d[_0xf00a('0x49')],md5(_0x2fde3d[_0xf00a('0x49')]));}else{_0x2fde3d[_0xf00a('0x4a')]='';}headers[_0xf00a('0x4b')]=getAuth(_0x1ebac2);return getUser(_0x1ebac2,'')[_0xf00a('0x1c')](function(_0x2097ff){_0x3687a4=_0x2097ff;logger[_0xf00a('0xb')]('The\x20User\x20ID\x20is:',_0x3687a4['id']);return getEndUser(_0x1ebac2,_0x2fde3d[_0xf00a('0xe')],_0x2fde3d['calleridnum']);})[_0xf00a('0x1c')](function(_0x32c9cb){_0x486d21=_0x32c9cb;logger[_0xf00a('0xb')]('The\x20Enduser\x20ID\x20is:',_0x486d21['id']);return getTicket(_0x1ebac2,_0x3687a4,_0x486d21,_0x1b757f,_0x2fde3d);})[_0xf00a('0x1c')](function(_0x52a474){if(_0x52a474){logger[_0xf00a('0xb')]('Ticket\x20created!');logger[_0xf00a('0xb')](_0xf00a('0x4e'),_0x52a474['id']);}})[_0xf00a('0x52')](function(_0x1d6381){logger['error']('['+_0x2fde3d[_0xf00a('0x5b')][_0xf00a('0x5c')]()+']',JSON[_0xf00a('0x32')](_0x1d6381));});}; \ No newline at end of file +var _0x260c=['stringify','GET','map','picklist','type','nameField','customField','toLowerCase','content','includes','push','idField','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','error','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Subjects','
','Tags','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','toString','debug'];(function(_0x18f532,_0x1119e5){var _0x222579=function(_0x57af8a){while(--_0x57af8a){_0x18f532['push'](_0x18f532['shift']());}};_0x222579(++_0x1119e5);}(_0x260c,0x12f));var _0xc260=function(_0x593c9c,_0x12a4cd){_0x593c9c=_0x593c9c-0x0;var _0x481128=_0x260c[_0x593c9c];return _0x481128;};'use strict';var _=require(_0xc260('0x0'));var rp=require(_0xc260('0x1'));var md5=require(_0xc260('0x2'));var util=require('util');var Redis=require(_0xc260('0x3'));var intUtil=require(_0xc260('0x4'));var config=require(_0xc260('0x5'));var logger=require('../../../../config/logger')(_0xc260('0x6'));config[_0xc260('0x7')]=_[_0xc260('0x8')](config[_0xc260('0x7')],{'host':_0xc260('0x9'),'port':0x18eb});var io=require(_0xc260('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xc260('0xb'),'Accept':_0xc260('0xb')};function emit(_0x4d2f7e,_0x587970,_0x33c092){io['to'](_0x4d2f7e)['emit'](_0x587970,_0x33c092);}function getTicket(_0xa936d,_0x1e5dd7,_0x2119f,_0x5567dd,_0x39a0c1){logger[_0xc260('0xc')](_0xc260('0xd'));var _0x3a6095=_[_0xc260('0xe')]({'responder_id':_0x1e5dd7['id'],'requester_id':_0x2119f['id'],'name':util[_0xc260('0xf')]('Caller\x20-\x20%s',_0x39a0c1['calleridname']),'phone':_0x39a0c1[_0xc260('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc260('0x11')](_0x5567dd[_0xc260('0x12')],_0x39a0c1,'\x20'),'description':intUtil[_0xc260('0x11')](_0x5567dd['Descriptions'],_0x39a0c1,_0xc260('0x13')),'tags':getTags(_0x5567dd[_0xc260('0x14')],'name')},getCustomFields(_0x5567dd['Fields'],_0x39a0c1));_0x3a6095[_0xc260('0x15')]=_[_0xc260('0x16')](_[_0xc260('0x17')](_0x3a6095['custom_fields'],'id'),_0xc260('0x18'));return request({'uri':util[_0xc260('0xf')]('%s/api/v2/tickets',_0xa936d[_0xc260('0x19')]),'method':_0xc260('0x1a'),'body':_0x3a6095})[_0xc260('0x1b')](function(_0x5665aa){logger[_0xc260('0xc')](_0xc260('0x1c'));return _0x5665aa;});}function getUser(_0x3f2b5d,_0x4f507b){if(intUtil[_0xc260('0x1d')](_0x4f507b)){return request({'uri':util[_0xc260('0xf')](_0xc260('0x1e'),_0x3f2b5d[_0xc260('0x19')]),'qs':{'email':_0x4f507b}})[_0xc260('0x1b')](function(_0x13d8f7){if(_0x13d8f7[_0xc260('0x1f')]){logger[_0xc260('0xc')](_0xc260('0x20'));return _[_0xc260('0x21')](_0x13d8f7,function(_0x42a325){return _0x42a325[_0xc260('0x22')][_0xc260('0x23')]===_0x4f507b;});}else{logger[_0xc260('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc260('0xf')](_0xc260('0x24'),_0x3f2b5d[_0xc260('0x19')])})[_0xc260('0x1b')](function(_0x1e5cc4){logger['info'](_0xc260('0x25'));return _0x1e5cc4;});}});}else{logger['info'](_0xc260('0x26'));return request({'uri':util[_0xc260('0xf')](_0xc260('0x24'),_0x3f2b5d[_0xc260('0x19')])})['then'](function(_0x90607a){logger[_0xc260('0xc')](_0xc260('0x25'));return _0x90607a;});}}function getEndUser(_0x5496b1,_0x35d4b6,_0x45a2eb){logger[_0xc260('0xc')](_0xc260('0x27'),_0x45a2eb);return request({'uri':util[_0xc260('0xf')](_0xc260('0x28'),_0x5496b1[_0xc260('0x19')]),'qs':{'phone':_0x45a2eb}})['then'](function(_0xc38663){if(_0xc38663[_0xc260('0x1f')]){logger['info'](_0xc260('0x29'));return _[_0xc260('0x21')](_0xc38663,{'phone':_0x45a2eb});}else{logger[_0xc260('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xc260('0xf')](_0xc260('0x28'),_0x5496b1[_0xc260('0x19')]),'method':_0xc260('0x1a'),'body':{'name':_0x35d4b6,'phone':_0x45a2eb}})[_0xc260('0x1b')](function(_0x3fb306){logger['info'](_0xc260('0x2a'));return _0x3fb306;});}});}function getAuth(_0x130c34){return util[_0xc260('0xf')]('Basic\x20%s',new Buffer(_0x130c34['apiKey']+':X')[_0xc260('0x2b')]('base64'));}function request(_0x322bed){logger[_0xc260('0x2c')]('[HTTP]',JSON[_0xc260('0x2d')](_0x322bed));return rp(_[_0xc260('0x8')](_0x322bed,{'method':_0xc260('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x2416b9,_0x4fbf5d){var _0x54db3b=[];if(_0x2416b9&&_0x2416b9[_0xc260('0x1f')]>0x0){_0x54db3b=_[_0xc260('0x2f')](_0x2416b9,_0x4fbf5d);}return _0x54db3b;}function getCustomFields(_0x197201,_0x2fbe6f){var _0x370891=[];var _0x577ca7={'custom_fields':[]};if(_0x197201['length']>0x0){_['forEach'](_0x197201,function(_0x41c58b){if(_['includes'](['string',_0xc260('0x30')],_0x41c58b[_0xc260('0x31')])&&_0x41c58b[_0xc260('0x32')]&&!_0x41c58b[_0xc260('0x33')]){_0x577ca7[_0x41c58b['nameField'][_0xc260('0x34')]()]=_0x41c58b[_0xc260('0x35')][_0xc260('0x2b')]();}else if(_[_0xc260('0x36')](['string',_0xc260('0x30')],_0x41c58b[_0xc260('0x31')])&&_0x41c58b['idField']&&_0x41c58b['customField']){_0x577ca7['custom_fields'][_0xc260('0x37')]({'id':_0x41c58b[_0xc260('0x38')],'value':_0x41c58b['content'][_0xc260('0x2b')]()});}else if(_0x41c58b['type']===_0xc260('0x39')&&_0x41c58b['variableName']&&_0x41c58b[_0xc260('0x38')]&&_0x41c58b[_0xc260('0x33')]){_0x2fbe6f[_0x41c58b['variableName']]&&_0x577ca7[_0xc260('0x15')][_0xc260('0x37')]({'id':_0x41c58b[_0xc260('0x38')],'value':_0x2fbe6f[_0x41c58b[_0xc260('0x3a')]][_0xc260('0x2b')]()});}else if(_0x41c58b[_0xc260('0x31')]===_0xc260('0x3b')&&_0x41c58b[_0xc260('0x3c')]&&_0x41c58b[_0xc260('0x3c')]['name']&&_0x41c58b[_0xc260('0x38')]&&_0x41c58b[_0xc260('0x33')]){_0x2fbe6f[_0x41c58b[_0xc260('0x3c')]['name']['toLowerCase']()]&&_0x577ca7[_0xc260('0x15')][_0xc260('0x37')]({'id':_0x41c58b[_0xc260('0x38')],'value':_0x2fbe6f[_0x41c58b[_0xc260('0x3c')][_0xc260('0x3d')][_0xc260('0x34')]()][_0xc260('0x2b')]()});}});}return _0x577ca7;}exports[_0xc260('0x3e')]=function(_0x33a27f,_0x251978,_0x1445f0,_0x5f2e3d,_0x2df0d7,_0x1ae374){var _0x2d9d51,_0x4803b6;_0x1ae374[_0xc260('0x19')]=intUtil[_0xc260('0x3f')](_0x1ae374[_0xc260('0x19')]);_0x1ae374[_0xc260('0x40')]=intUtil['stripTrailingSlash'](_0x1ae374[_0xc260('0x40')]);if(_0x2df0d7&&_0x2df0d7[_0xc260('0x41')]){logger[_0xc260('0xc')](_0xc260('0x42'),_0xc260('0x43'));_0x251978['recordingURL']=util[_0xc260('0xf')](_0xc260('0x44'),_0x1ae374[_0xc260('0x40')],_0x251978[_0xc260('0x45')],md5(_0x251978[_0xc260('0x45')]));}else{_0x251978[_0xc260('0x46')]='';}headers['Authorization']=getAuth(_0x1ae374);return getUser(_0x1ae374,_0x5f2e3d[_0xc260('0x23')])[_0xc260('0x1b')](function(_0x521036){_0x2d9d51=_0x521036;logger[_0xc260('0xc')](_0xc260('0x47'),_0x2d9d51['id']);return getEndUser(_0x1ae374,_0x251978[_0xc260('0x48')],_0x251978['calleridnum']);})[_0xc260('0x1b')](function(_0x46d5f2){_0x4803b6=_0x46d5f2;logger['info'](_0xc260('0x49'),_0x4803b6['id']);return getTicket(_0x1ae374,_0x2d9d51,_0x4803b6,_0x1445f0,_0x251978);})[_0xc260('0x1b')](function(_0x1c7330){if(_0x1c7330&&_0x1c7330['id']){logger[_0xc260('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x1c7330['id']);logger[_0xc260('0xc')](_0xc260('0x42'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x5f2e3d['name']),'trigger:browser:url',{'uri':util[_0xc260('0xf')]('%s/helpdesk/tickets/%d',_0x1ae374['remoteUri'],_0x1c7330['id'])});}})['catch'](function(_0x1f1afa){logger[_0xc260('0x4a')]('[QUEUE]',JSON[_0xc260('0x2d')](_0x1f1afa));});};exports[_0xc260('0x4b')]=function(_0x5cd0bf,_0xc75fcf,_0x51b224,_0x2b7434,_0x2398ea,_0x5104ae,_0x598bcc){var _0x25c4f4,_0x3bbb77;_0x5104ae[_0xc260('0x19')]=intUtil['stripTrailingSlash'](_0x5104ae[_0xc260('0x19')]);_0x5104ae[_0xc260('0x40')]=intUtil[_0xc260('0x3f')](_0x5104ae[_0xc260('0x40')]);if(_0x598bcc&&_0x598bcc['recordingFormat']&&_0x598bcc[_0xc260('0x4c')]!==_0xc260('0x4d')){logger[_0xc260('0xc')](_0xc260('0x4e'),_0xc260('0x43'));_0xc75fcf['recordingURL']=util[_0xc260('0xf')](_0xc260('0x44'),_0x5104ae[_0xc260('0x40')],_0xc75fcf['uniqueid'],md5(_0xc75fcf[_0xc260('0x45')]));}headers[_0xc260('0x4f')]=getAuth(_0x5104ae);return getUser(_0x5104ae,_0x2b7434['email'])[_0xc260('0x1b')](function(_0x12dbb1){_0x25c4f4=_0x12dbb1;logger[_0xc260('0xc')](_0xc260('0x47'),_0x25c4f4['id']);return getEndUser(_0x5104ae,_0xc75fcf[_0xc260('0x50')],_0xc75fcf['destcalleridnum']);})[_0xc260('0x1b')](function(_0x2dfc39){_0x3bbb77=_0x2dfc39;logger[_0xc260('0xc')](_0xc260('0x49'),_0x3bbb77['id']);return getTicket(_0x5104ae,_0x25c4f4,_0x3bbb77,_0x51b224,_0xc75fcf);})[_0xc260('0x1b')](function(_0x282aab){if(_0x282aab&&_0x282aab['id']){logger[_0xc260('0xc')](_0xc260('0x1c'));logger[_0xc260('0xc')](_0xc260('0x51'),_0x282aab['id']);logger[_0xc260('0xc')](_0xc260('0x4e'),_0xc260('0x52'));emit(util[_0xc260('0xf')]('user:%s',_0x2b7434[_0xc260('0x3d')]),_0xc260('0x53'),{'uri':util[_0xc260('0xf')]('%s/helpdesk/tickets/%d',_0x5104ae[_0xc260('0x19')],_0x282aab['id'])});}})[_0xc260('0x54')](function(_0xee5290){logger[_0xc260('0x4a')](_0xc260('0x4e'),JSON['stringify'](_0xee5290));});};exports['unmanaged']=function(_0x4f1cf7,_0x34ef41,_0x4fd64e,_0x10977b,_0x175f2d,_0x31566a){var _0x204bf5,_0x7a529a;_0x31566a[_0xc260('0x19')]=intUtil[_0xc260('0x3f')](_0x31566a[_0xc260('0x19')]);_0x31566a[_0xc260('0x40')]=intUtil[_0xc260('0x3f')](_0x31566a['serverUrl']);if(_0x175f2d&&_0x175f2d[_0xc260('0x41')]){logger[_0xc260('0xc')]('['+_0x34ef41[_0xc260('0x55')][_0xc260('0x56')]()+']',_0xc260('0x43'));_0x34ef41[_0xc260('0x46')]=util[_0xc260('0xf')](_0xc260('0x44'),_0x31566a['serverUrl'],_0x34ef41[_0xc260('0x45')],md5(_0x34ef41[_0xc260('0x45')]));}else{_0x34ef41[_0xc260('0x46')]='';}headers['Authorization']=getAuth(_0x31566a);return getUser(_0x31566a,'')['then'](function(_0x5b31bc){_0x204bf5=_0x5b31bc;logger[_0xc260('0xc')](_0xc260('0x47'),_0x204bf5['id']);return getEndUser(_0x31566a,_0x34ef41[_0xc260('0x48')],_0x34ef41[_0xc260('0x10')]);})[_0xc260('0x1b')](function(_0x4da93f){_0x7a529a=_0x4da93f;logger[_0xc260('0xc')]('The\x20Enduser\x20ID\x20is:',_0x7a529a['id']);return getTicket(_0x31566a,_0x204bf5,_0x7a529a,_0x4fd64e,_0x34ef41);})[_0xc260('0x1b')](function(_0x4fdfae){if(_0x4fdfae){logger[_0xc260('0xc')](_0xc260('0x1c'));logger[_0xc260('0xc')](_0xc260('0x51'),_0x4fdfae['id']);}})[_0xc260('0x54')](function(_0x4c5bf4){logger['error']('['+_0x34ef41[_0xc260('0x55')][_0xc260('0x56')]()+']',JSON[_0xc260('0x2d')](_0x4c5bf4));});}; \ 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 596b503..72588fc 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 _0x781a=['Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','format','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','info','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts'];(function(_0xbfe7f2,_0x4ed8a4){var _0x48895=function(_0x151143){while(--_0x151143){_0xbfe7f2['push'](_0xbfe7f2['shift']());}};_0x48895(++_0x4ed8a4);}(_0x781a,0x1ea));var _0xa781=function(_0x3e5ac1,_0x213ec1){_0x3e5ac1=_0x3e5ac1-0x0;var _0x5c9069=_0x781a[_0x3e5ac1];return _0x5c9069;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xa781('0x0'));var util=require(_0xa781('0x1'));var moment=require(_0xa781('0x2'));var Promise=require(_0xa781('0x3'));var Redis=require(_0xa781('0x4'));var intUtil=require('./util');var config=require(_0xa781('0x5'));var logger=require(_0xa781('0x6'))(_0xa781('0x7'));config[_0xa781('0x8')]=_[_0xa781('0x9')](config[_0xa781('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa781('0xa'))(new Redis(config[_0xa781('0x8')]));function getAdminId(_0x419192,_0x4ab19b,_0x305f47,_0x3ef701){return new Promise(function(_0x5d10d1,_0x14dd5c){var _0x38d97d=![];var _0x291771={'method':_0xa781('0xb'),'uri':_0x3ef701+_0xa781('0xc'),'json':!![]};_0x291771['headers']=_0x305f47;logger['info'](_0xa781('0xd'));return rp(_0x291771)[_0xa781('0xe')](function(_0x53ae4c){if(_0x53ae4c){var _0x36d143=_0x53ae4c[_0xa781('0xf')];var _0x377cfc=null;for(_0x377cfc=0x0;_0x377cfc<_0x36d143[_0xa781('0x10')];_0x377cfc++){if(_0x36d143[_0x377cfc][_0xa781('0x11')]===_0x419192[_0xa781('0x12')]){_0x419192[_0xa781('0x13')]=_0x36d143[_0x377cfc]['id'];_0x38d97d=!![];}}if(_0x38d97d){logger['info']('Admin\x20found:',_0x419192[_0xa781('0x13')]);_0x5d10d1(_0x419192);}else{_0x14dd5c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x14dd5c({'statusCode':0x194,'message':_0xa781('0x14')});}})[_0xa781('0x15')](function(_0x4a5542){logger[_0xa781('0x16')]('['+[_0x4ab19b['toUpperCase']()]+']',_0x4a5542[_0xa781('0x17')]);_0x14dd5c(_0x4a5542);});});}function getUser(_0x5a103b,_0x4934fc,_0x33df60){return function(_0x4b30b8){return new Promise(function(_0x3d3fae,_0x40e123){var _0x162a2f={'method':_0xa781('0xb'),'uri':_0x33df60+_0xa781('0xc'),'json':!![]};_0x162a2f[_0xa781('0x18')]=_0x4934fc;logger[_0xa781('0x19')](_0xa781('0x1a'));return rp(_0x162a2f)[_0xa781('0xe')](function(_0x3fb6ca){if(_0x3fb6ca){var _0x344bb3=_0x3fb6ca[_0xa781('0xf')];var _0xd6fdbd=![];var _0x2ae94a=null;if(_0x4b30b8[_0xa781('0x1b')]!==null){logger[_0xa781('0x19')](_0xa781('0x1c'),_0x4b30b8[_0xa781('0x1b')]);_0x4b30b8['userEmail']=_0x4b30b8['agentEmail'];for(_0x2ae94a=0x0;_0x2ae94a<_0x344bb3[_0xa781('0x10')];_0x2ae94a++){if(_0x344bb3[_0x2ae94a][_0xa781('0x11')]===_0x4b30b8[_0xa781('0x1b')]){_0xd6fdbd=!![];_0x4b30b8[_0xa781('0x1d')]=_0x344bb3[_0x2ae94a]['id'];logger[_0xa781('0x19')](_0xa781('0x1e'),_0x4b30b8[_0xa781('0x1d')]);}}}if(!_0xd6fdbd){logger[_0xa781('0x19')](_0xa781('0x1f'));_0x4b30b8['userEmail']=_0x4b30b8[_0xa781('0x12')];_0x4b30b8['userId']=_0x4b30b8[_0xa781('0x13')];_0xd6fdbd=!![];}if(_0xd6fdbd){_0x3d3fae(_0x4b30b8);}else{_0x40e123({'statusCode':0x194,'message':_0xa781('0x14')});}}else{_0x40e123({'statusCode':0x194,'message':_0xa781('0x14')});}})[_0xa781('0x15')](function(_0x1ecb0b){logger[_0xa781('0x16')]('['+[_0x5a103b[_0xa781('0x20')]()]+']',_0x1ecb0b[_0xa781('0x17')]);_0x40e123(_0x1ecb0b);});});};}function searchContact(_0x32182d,_0x50ff43,_0x384804,_0x28bf1a){return new Promise(function(_0x3bc9cf,_0x40f2a1){var _0x5c2cac={'method':_0xa781('0xb'),'headers':_0x50ff43,'uri':_0x32182d+_0xa781('0x21')+_0x28bf1a+_0xa781('0x22')+_0x384804+_0xa781('0x23'),'json':!![]};rp(_0x5c2cac)['then'](function(_0x58a8b4){var _0x46b2c6=_[_0xa781('0x24')](_0x58a8b4[_0xa781('0x25')][_0xa781('0x25')],[_0x384804,_0x28bf1a]);_0x3bc9cf(_0x46b2c6);})[_0xa781('0x15')](function(_0x532829){_0x40f2a1(_0x532829);});});}function getEndUser(_0x2147a1,_0x17c8e7,_0x38abee){return function(_0x27088c){return new Promise(function(_0xdd0bd6,_0x509d0a){logger[_0xa781('0x19')](util['format'](_0xa781('0x26'),_0x27088c[_0xa781('0x27')]));searchContact(_0x38abee,_0x17c8e7,_0xa781('0x28'),_0x27088c['contactNumber'])[_0xa781('0xe')](function(_0x53f47d){if(_0x53f47d){_0x27088c[_0xa781('0x29')]=_0x53f47d['id'];logger[_0xa781('0x19')](_0xa781('0x2a'),_0x27088c['endUserId']);return _0xdd0bd6(_0x27088c);}searchContact(_0x38abee,_0x17c8e7,_0xa781('0x2b'),_0x27088c[_0xa781('0x27')])[_0xa781('0xe')](function(_0x292d6d){if(_0x292d6d){_0x27088c[_0xa781('0x29')]=_0x292d6d['id'];logger[_0xa781('0x19')](_0xa781('0x2c'),_0x27088c[_0xa781('0x29')]);return _0xdd0bd6(_0x27088c);}createEndUser(_0x27088c,_0x2147a1,_0x17c8e7,_0x38abee)[_0xa781('0xe')](function(_0x50d8d4){logger[_0xa781('0x19')](_0xa781('0x2d'),_0x50d8d4[_0xa781('0x29')]);return _0xdd0bd6(_0x50d8d4);});});})[_0xa781('0x15')](function(_0x24df8e){_0x509d0a(_0x24df8e);});});};}function createEndUser(_0x33fd60,_0x7de930,_0x530444,_0x331ef2){return new Promise(function(_0x5f1e45,_0x2e96c3){var _0xc13b5=moment();var _0x4dcad1={'method':_0xa781('0x2e'),'uri':_0x331ef2+_0xa781('0x2f'),'body':{'contact':{'last_name':_0x33fd60[_0xa781('0x27')],'work_number':_0x33fd60[_0xa781('0x27')],'mobile_number':_0x33fd60[_0xa781('0x27')],'owner_id':_0x33fd60[_0xa781('0x1d')],'created_at':_0xc13b5['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4dcad1[_0xa781('0x18')]=_0x530444;logger[_0xa781('0x19')](_0xa781('0x30'));return rp(_0x4dcad1)[_0xa781('0xe')](function(_0x34312c){_0x33fd60['endUserId']=_0x34312c[_0xa781('0x31')]['id'];_0x5f1e45(_0x33fd60);})[_0xa781('0x15')](function(_0x57c34e){logger[_0xa781('0x16')]('['+[_0x7de930[_0xa781('0x20')]()]+']',_0x57c34e[_0xa781('0x17')]);_0x2e96c3(_0x57c34e[_0xa781('0x17')]);});});}function getTicket(_0x3e61ec,_0x5d9cb2,_0x3b5e66,_0x60e8fb,_0x2b3a6a){return function(_0x30d041){logger[_0xa781('0x19')](_0xa781('0x32'));return new Promise(function(_0x4998c5,_0xa59589){var _0x26f64a=moment();var _0x1ddbe8={'method':'POST','uri':_0x3b5e66+_0xa781('0x33'),'body':{'title':intUtil[_0xa781('0x34')](_0x60e8fb[_0xa781('0x35')],_0x2b3a6a,'\x20'),'description':intUtil[_0xa781('0x34')](_0x60e8fb[_0xa781('0x36')],_0x2b3a6a,'\x0a'),'owner_id':_0x30d041[_0xa781('0x1d')],'creater_id':_0x30d041[_0xa781('0x13')],'targetable_id':_0x30d041[_0xa781('0x29')],'targetable_type':_0xa781('0x37'),'created_at':_0x26f64a[_0xa781('0x38')](_0xa781('0x39')),'due_date':_0x26f64a[_0xa781('0x3a')](0x1e,'m')[_0xa781('0x38')](_0xa781('0x39'))},'json':!![]};_0x1ddbe8[_0xa781('0x18')]=_0x5d9cb2;return rp(_0x1ddbe8)[_0xa781('0xe')](function(_0x58cb0e){_0x30d041[_0xa781('0x3b')]=_0x58cb0e[_0xa781('0x3c')]['id'];logger[_0xa781('0x19')]('Task\x20created:',_0x30d041[_0xa781('0x3b')]);_0x4998c5(_0x30d041);})[_0xa781('0x15')](function(_0xb9eb5c){logger[_0xa781('0x16')]('['+[_0x3e61ec[_0xa781('0x20')]()]+']',_0xb9eb5c[_0xa781('0x17')]);_0xa59589(_0xb9eb5c[_0xa781('0x17')]);});});};}function emit(_0x43e9d7,_0x301167,_0x1b2393){var _0x4c2bfc={'uri':_0x43e9d7+_0xa781('0x3d')+_0x1b2393};io['to'](util['format'](_0xa781('0x3e'),_0x301167))[_0xa781('0x3f')]('trigger:browser:url',_0x4c2bfc);}exports['cs']=function(_0x3ec0a4,_0x2891dd,_0x3babdd,_0x23a4df,_0x34afd9,_0x24a34b,_0x5b5f95,_0x244a07){var _0x3375a8={};var _0x4b2fae={'Authorization':_0xa781('0x40')+_0x24a34b[_0xa781('0x41')]};_0x24a34b[_0xa781('0x42')]=intUtil[_0xa781('0x43')](_0x24a34b[_0xa781('0x42')]);_0x24a34b[_0xa781('0x44')]=intUtil[_0xa781('0x43')](_0x24a34b['serverUrl']);var _0x379275=_0x24a34b[_0xa781('0x42')];_0x3375a8[_0xa781('0x12')]=_0x24a34b[_0xa781('0x45')];_0x3375a8['contactNumber']=_0x244a07[_0xa781('0x46')]()===_0xa781('0x47')?_0x2891dd[_0xa781('0x48')]:_0x2891dd[_0xa781('0x49')];_0x3375a8[_0xa781('0x4a')]=_0x244a07==='queue'||_0x244a07===_0xa781('0x4b')?_0xa781('0x4c'):_0xa781('0x47');if(_0x23a4df){_0x3375a8[_0xa781('0x1b')]=_0x23a4df[_0xa781('0x11')];}var _0x4b94a5=util[_0xa781('0x38')](_0xa781('0x4d'),_0x24a34b[_0xa781('0x44')],_0x2891dd['uniqueid'],md5(_0x2891dd['uniqueid']));if(_0x34afd9&&_0x34afd9[_0xa781('0x4e')]){logger[_0xa781('0x19')]('[QUEUE]',_0xa781('0x4f'));_0x2891dd[_0xa781('0x50')]=_0x4b94a5;}else if(_0x5b5f95&&_0x5b5f95[_0xa781('0x51')]&&_0x5b5f95['recordingFormat']!=='none'){logger[_0xa781('0x19')](_0xa781('0x52'),_0xa781('0x4f'));_0x2891dd[_0xa781('0x50')]=_0x4b94a5;}else{_0x2891dd[_0xa781('0x50')]='';}return getAdminId(_0x3375a8,_0x244a07,_0x4b2fae,_0x379275)[_0xa781('0xe')](getUser(_0x244a07,_0x4b2fae,_0x379275))[_0xa781('0xe')](getEndUser(_0x244a07,_0x4b2fae,_0x379275))['then'](getTicket(_0x244a07,_0x4b2fae,_0x379275,_0x3babdd,_0x2891dd))[_0xa781('0xe')](function(_0x21a2be){logger['info'](util[_0xa781('0x38')](_0xa781('0x53'),_0x21a2be[_0xa781('0x3b')]));if(_0x244a07!==_0xa781('0x4b')){logger[_0xa781('0x19')]('['+[_0x244a07[_0xa781('0x20')]()]+']',_0xa781('0x54'));emit(_0x379275,_0x23a4df[_0xa781('0x55')],_0x21a2be[_0xa781('0x29')]);}})[_0xa781('0x15')](function(_0x1ee4e7){logger['error']('['+[_0x244a07[_0xa781('0x20')]()]+_0xa781('0x56'),util[_0xa781('0x57')](_0x1ee4e7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc5c5=['Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','userId','User\x20found:','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','catch','format','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','agentEmail','email','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0xc5c5,0x1ca));var _0x5c5c=function(_0x4bd737,_0x2eaea5){_0x4bd737=_0x4bd737-0x0;var _0x5e170a=_0xc5c5[_0x4bd737];return _0x5e170a;};'use strict';var _=require(_0x5c5c('0x0'));var rp=require(_0x5c5c('0x1'));var md5=require('md5');var util=require(_0x5c5c('0x2'));var moment=require(_0x5c5c('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x5c5c('0x4'));var config=require(_0x5c5c('0x5'));var logger=require(_0x5c5c('0x6'))(_0x5c5c('0x7'));config[_0x5c5c('0x8')]=_['defaults'](config['redis'],{'host':_0x5c5c('0x9'),'port':0x18eb});var io=require(_0x5c5c('0xa'))(new Redis(config[_0x5c5c('0x8')]));function getAdminId(_0x3b8390,_0x47abcc,_0x34335e,_0xd63a7d){return new Promise(function(_0x47d2c1,_0x401955){var _0x11378a=![];var _0x13b5fe={'method':_0x5c5c('0xb'),'uri':_0xd63a7d+_0x5c5c('0xc'),'json':!![]};_0x13b5fe[_0x5c5c('0xd')]=_0x34335e;logger[_0x5c5c('0xe')](_0x5c5c('0xf'));return rp(_0x13b5fe)[_0x5c5c('0x10')](function(_0x3df757){if(_0x3df757){var _0x3a7cdb=_0x3df757[_0x5c5c('0x11')];var _0x155f4b=null;for(_0x155f4b=0x0;_0x155f4b<_0x3a7cdb[_0x5c5c('0x12')];_0x155f4b++){if(_0x3a7cdb[_0x155f4b]['email']===_0x3b8390[_0x5c5c('0x13')]){_0x3b8390[_0x5c5c('0x14')]=_0x3a7cdb[_0x155f4b]['id'];_0x11378a=!![];}}if(_0x11378a){logger['info'](_0x5c5c('0x15'),_0x3b8390['adminId']);_0x47d2c1(_0x3b8390);}else{_0x401955({'statusCode':0x194,'message':_0x5c5c('0x16')});}}else{_0x401955({'statusCode':0x194,'message':_0x5c5c('0x16')});}})['catch'](function(_0x410c77){logger[_0x5c5c('0x17')]('['+[_0x47abcc[_0x5c5c('0x18')]()]+']',_0x410c77[_0x5c5c('0x19')]);_0x401955(_0x410c77);});});}function getUser(_0x4cc445,_0x51d925,_0x214498){return function(_0x400b2e){return new Promise(function(_0x30d73b,_0x3dee9e){var _0x108f84={'method':_0x5c5c('0xb'),'uri':_0x214498+_0x5c5c('0xc'),'json':!![]};_0x108f84[_0x5c5c('0xd')]=_0x51d925;logger['info'](_0x5c5c('0x1a'));return rp(_0x108f84)[_0x5c5c('0x10')](function(_0x12f481){if(_0x12f481){var _0x515550=_0x12f481[_0x5c5c('0x11')];var _0xc0014=![];var _0x11187e=null;if(_0x400b2e['agentEmail']!==null){logger[_0x5c5c('0xe')]('Getting\x20user\x20with\x20email',_0x400b2e['agentEmail']);_0x400b2e['userEmail']=_0x400b2e['agentEmail'];for(_0x11187e=0x0;_0x11187e<_0x515550[_0x5c5c('0x12')];_0x11187e++){if(_0x515550[_0x11187e]['email']===_0x400b2e['agentEmail']){_0xc0014=!![];_0x400b2e[_0x5c5c('0x1b')]=_0x515550[_0x11187e]['id'];logger[_0x5c5c('0xe')](_0x5c5c('0x1c'),_0x400b2e[_0x5c5c('0x1b')]);}}}if(!_0xc0014){logger[_0x5c5c('0xe')]('Admin\x20selected');_0x400b2e[_0x5c5c('0x1d')]=_0x400b2e['adminEmail'];_0x400b2e[_0x5c5c('0x1b')]=_0x400b2e[_0x5c5c('0x14')];_0xc0014=!![];}if(_0xc0014){_0x30d73b(_0x400b2e);}else{_0x3dee9e({'statusCode':0x194,'message':_0x5c5c('0x16')});}}else{_0x3dee9e({'statusCode':0x194,'message':_0x5c5c('0x16')});}})['catch'](function(_0x5c79d6){logger['error']('['+[_0x4cc445[_0x5c5c('0x18')]()]+']',_0x5c79d6[_0x5c5c('0x19')]);_0x3dee9e(_0x5c79d6);});});};}function searchContact(_0x218d7c,_0x4f5767,_0x1976a2,_0x2c9ef6){return new Promise(function(_0x1773f6,_0xd7fe28){var _0x2a0c23={'method':_0x5c5c('0xb'),'headers':_0x4f5767,'uri':_0x218d7c+_0x5c5c('0x1e')+_0x2c9ef6+_0x5c5c('0x1f')+_0x1976a2+_0x5c5c('0x20'),'json':!![]};rp(_0x2a0c23)['then'](function(_0x1703cf){var _0x2aa602=_[_0x5c5c('0x21')](_0x1703cf[_0x5c5c('0x22')][_0x5c5c('0x22')],[_0x1976a2,_0x2c9ef6]);_0x1773f6(_0x2aa602);})[_0x5c5c('0x23')](function(_0x4c9d16){_0xd7fe28(_0x4c9d16);});});}function getEndUser(_0x54da62,_0x6b77dc,_0x45f7e3){return function(_0x2e1c2a){return new Promise(function(_0xeb1788,_0xfff15e){logger[_0x5c5c('0xe')](util[_0x5c5c('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2e1c2a[_0x5c5c('0x25')]));searchContact(_0x45f7e3,_0x6b77dc,'mobile_number',_0x2e1c2a['contactNumber'])[_0x5c5c('0x10')](function(_0x2dd1e0){if(_0x2dd1e0){_0x2e1c2a[_0x5c5c('0x26')]=_0x2dd1e0['id'];logger[_0x5c5c('0xe')](_0x5c5c('0x27'),_0x2e1c2a[_0x5c5c('0x26')]);return _0xeb1788(_0x2e1c2a);}searchContact(_0x45f7e3,_0x6b77dc,'work_number',_0x2e1c2a[_0x5c5c('0x25')])[_0x5c5c('0x10')](function(_0x38a1b6){if(_0x38a1b6){_0x2e1c2a[_0x5c5c('0x26')]=_0x38a1b6['id'];logger[_0x5c5c('0xe')](_0x5c5c('0x28'),_0x2e1c2a[_0x5c5c('0x26')]);return _0xeb1788(_0x2e1c2a);}createEndUser(_0x2e1c2a,_0x54da62,_0x6b77dc,_0x45f7e3)['then'](function(_0xaff60b){logger['info'](_0x5c5c('0x29'),_0xaff60b[_0x5c5c('0x26')]);return _0xeb1788(_0xaff60b);});});})['catch'](function(_0xc12c69){_0xfff15e(_0xc12c69);});});};}function createEndUser(_0x1a62b2,_0x2c1e13,_0x4b0955,_0x595615){return new Promise(function(_0x3bf05c,_0x57ea8d){var _0x187e5d=moment();var _0x8d9271={'method':'POST','uri':_0x595615+_0x5c5c('0x2a'),'body':{'contact':{'last_name':_0x1a62b2[_0x5c5c('0x25')],'work_number':_0x1a62b2[_0x5c5c('0x25')],'mobile_number':_0x1a62b2[_0x5c5c('0x25')],'owner_id':_0x1a62b2[_0x5c5c('0x1b')],'created_at':_0x187e5d[_0x5c5c('0x24')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x8d9271[_0x5c5c('0xd')]=_0x4b0955;logger[_0x5c5c('0xe')](_0x5c5c('0x2b'));return rp(_0x8d9271)[_0x5c5c('0x10')](function(_0x1084e0){_0x1a62b2[_0x5c5c('0x26')]=_0x1084e0[_0x5c5c('0x2c')]['id'];_0x3bf05c(_0x1a62b2);})[_0x5c5c('0x23')](function(_0x160adb){logger[_0x5c5c('0x17')]('['+[_0x2c1e13[_0x5c5c('0x18')]()]+']',_0x160adb[_0x5c5c('0x19')]);_0x57ea8d(_0x160adb[_0x5c5c('0x19')]);});});}function getTicket(_0x24ad53,_0x35c1fd,_0x3ae4b3,_0x55a25d,_0x3112a5){return function(_0x92f42e){logger[_0x5c5c('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x3fcdfb,_0xf72de5){var _0x30bc7a=moment();var _0x1e4319={'method':_0x5c5c('0x2d'),'uri':_0x3ae4b3+_0x5c5c('0x2e'),'body':{'title':intUtil['getString'](_0x55a25d['Subjects'],_0x3112a5,'\x20'),'description':intUtil['getString'](_0x55a25d['Descriptions'],_0x3112a5,'\x0a'),'owner_id':_0x92f42e[_0x5c5c('0x1b')],'creater_id':_0x92f42e['adminId'],'targetable_id':_0x92f42e['endUserId'],'targetable_type':_0x5c5c('0x2f'),'created_at':_0x30bc7a[_0x5c5c('0x24')](_0x5c5c('0x30')),'due_date':_0x30bc7a['add'](0x1e,'m')['format'](_0x5c5c('0x30'))},'json':!![]};_0x1e4319[_0x5c5c('0xd')]=_0x35c1fd;return rp(_0x1e4319)[_0x5c5c('0x10')](function(_0x5d1ea3){_0x92f42e[_0x5c5c('0x31')]=_0x5d1ea3['task']['id'];logger[_0x5c5c('0xe')](_0x5c5c('0x32'),_0x92f42e['ticketId']);_0x3fcdfb(_0x92f42e);})[_0x5c5c('0x23')](function(_0x4bdf5b){logger[_0x5c5c('0x17')]('['+[_0x24ad53[_0x5c5c('0x18')]()]+']',_0x4bdf5b['message']);_0xf72de5(_0x4bdf5b[_0x5c5c('0x19')]);});});};}function emit(_0x2a3e80,_0x1889ba,_0x37264e){var _0x52b2c4={'uri':_0x2a3e80+'/contacts/'+_0x37264e};io['to'](util[_0x5c5c('0x24')](_0x5c5c('0x33'),_0x1889ba))[_0x5c5c('0x34')](_0x5c5c('0x35'),_0x52b2c4);}exports['cs']=function(_0x5482e6,_0x18356d,_0x13c557,_0x35eb19,_0x3b52bb,_0x2501af,_0x55b586,_0x16f445){var _0x2bdf49={};var _0x4b3798={'Authorization':_0x5c5c('0x36')+_0x2501af[_0x5c5c('0x37')]};_0x2501af[_0x5c5c('0x38')]=intUtil[_0x5c5c('0x39')](_0x2501af['remoteUri']);_0x2501af['serverUrl']=intUtil[_0x5c5c('0x39')](_0x2501af[_0x5c5c('0x3a')]);var _0xab3725=_0x2501af[_0x5c5c('0x38')];_0x2bdf49[_0x5c5c('0x13')]=_0x2501af[_0x5c5c('0x3b')];_0x2bdf49[_0x5c5c('0x25')]=_0x16f445[_0x5c5c('0x3c')]()===_0x5c5c('0x3d')?_0x18356d[_0x5c5c('0x3e')]:_0x18356d[_0x5c5c('0x3f')];_0x2bdf49['callDirection']=_0x16f445===_0x5c5c('0x40')||_0x16f445===_0x5c5c('0x41')?'queue':'outbound';if(_0x35eb19){_0x2bdf49[_0x5c5c('0x42')]=_0x35eb19[_0x5c5c('0x43')];}var _0xb22fe1=util[_0x5c5c('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2501af[_0x5c5c('0x3a')],_0x18356d[_0x5c5c('0x44')],md5(_0x18356d[_0x5c5c('0x44')]));if(_0x3b52bb&&_0x3b52bb['monitor_format']){logger[_0x5c5c('0xe')](_0x5c5c('0x45'),_0x5c5c('0x46'));_0x18356d[_0x5c5c('0x47')]=_0xb22fe1;}else if(_0x55b586&&_0x55b586[_0x5c5c('0x48')]&&_0x55b586['recordingFormat']!==_0x5c5c('0x49')){logger['info'](_0x5c5c('0x4a'),_0x5c5c('0x46'));_0x18356d[_0x5c5c('0x47')]=_0xb22fe1;}else{_0x18356d[_0x5c5c('0x47')]='';}return getAdminId(_0x2bdf49,_0x16f445,_0x4b3798,_0xab3725)[_0x5c5c('0x10')](getUser(_0x16f445,_0x4b3798,_0xab3725))['then'](getEndUser(_0x16f445,_0x4b3798,_0xab3725))[_0x5c5c('0x10')](getTicket(_0x16f445,_0x4b3798,_0xab3725,_0x13c557,_0x18356d))[_0x5c5c('0x10')](function(_0x2869cc){logger[_0x5c5c('0xe')](util[_0x5c5c('0x24')](_0x5c5c('0x4b'),_0x2869cc['ticketId']));if(_0x16f445!==_0x5c5c('0x41')){logger[_0x5c5c('0xe')]('['+[_0x16f445[_0x5c5c('0x18')]()]+']',_0x5c5c('0x4c'));emit(_0xab3725,_0x35eb19[_0x5c5c('0x4d')],_0x2869cc[_0x5c5c('0x26')]);}})[_0x5c5c('0x23')](function(_0x4fa238){logger[_0x5c5c('0x17')]('['+[_0x16f445[_0x5c5c('0x18')]()]+_0x5c5c('0x4e'),util[_0x5c5c('0x4f')](_0x4fa238,{'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 5d4a228..cbe6886 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 _0xc8db=['data2','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','dynamics365','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error'];(function(_0x174369,_0x597960){var _0x5a96d1=function(_0x49a0f8){while(--_0x49a0f8){_0x174369['push'](_0x174369['shift']());}};_0x5a96d1(++_0x597960);}(_0xc8db,0x1ae));var _0xbc8d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc8db[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xbc8d('0x0'));var util=require(_0xbc8d('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xbc8d('0x2'));var sugarcrm=require(_0xbc8d('0x3'));var freshdesk=require(_0xbc8d('0x4'));var zoho=require(_0xbc8d('0x5'));var desk=require(_0xbc8d('0x6'));var vtiger=require(_0xbc8d('0x7'));var servicenow=require(_0xbc8d('0x8'));var dynamics365=require(_0xbc8d('0x9'));var freshsales=require(_0xbc8d('0xa'));var integrations=[_0xbc8d('0xb'),_0xbc8d('0xc'),_0xbc8d('0xd'),_0xbc8d('0xe'),_0xbc8d('0xf'),_0xbc8d('0x10'),_0xbc8d('0x11'),'dynamics365',_0xbc8d('0x12'),_0xbc8d('0x13')];exports[_0xbc8d('0x14')]=function(_0x415c1e,_0x24bff1,_0x39f308,_0x256b97,_0x30e747,_0x1ba70c){if(_0x39f308){if(_[_0xbc8d('0x15')](integrations,_0x415c1e[_0xbc8d('0x16')]['toLowerCase']())){try{var _0x1372ee=null;var _0x46ef73='';var _0x2eed2e=_0x39f308[_0x415c1e[_0xbc8d('0x16')][_0xbc8d('0x17')]()];if(_0x2eed2e){var _0x2c2b11=_0x2eed2e[_0x415c1e['data2']];if(_0x2c2b11){var _0x1487d1=_[_0xbc8d('0x18')](_0x2c2b11['Configurations'],{'id':parseInt(_0x415c1e[_0xbc8d('0x19')],0xa)});if(_0x1487d1){if(_0x256b97){if(_0x30e747&&_0x24bff1[_0xbc8d('0x1a')]){_0x46ef73='queue';}else if(_0x24bff1[_0xbc8d('0x1b')]){_0x46ef73=_0xbc8d('0x1c');}else{console[_0xbc8d('0x1d')](_0xbc8d('0x1e'),_0x24bff1);}}else{_0x46ef73=_0xbc8d('0x1f');}switch(_0x415c1e[_0xbc8d('0x16')][_0xbc8d('0x17')]()){case'zendesk':zendesk[_0x46ef73](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c);break;case _0xbc8d('0xc'):salesforce[_0x46ef73](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c);break;case _0xbc8d('0xd'):sugarcrm[_0x46ef73](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c);break;case _0xbc8d('0xe'):freshdesk[_0x46ef73](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c);break;case _0xbc8d('0xf'):zoho[_0x46ef73](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c);break;case _0xbc8d('0x10'):desk[_0x46ef73](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c);break;case'vtiger':vtiger[_0x46ef73](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c);break;case _0xbc8d('0x12'):freshsales['cs'](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c,_0x46ef73);break;case _0xbc8d('0x13'):servicenow['cs'](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c,_0x46ef73);break;case _0xbc8d('0x20'):dynamics365['cs'](_0x415c1e,_0x24bff1,_0x1487d1,_0x256b97,_0x30e747,_0x2c2b11,_0x1ba70c,_0x46ef73);break;default:console[_0xbc8d('0x1d')]('unknown\x20integration');}}else{_0x1372ee=require(_0xbc8d('0x21'))(_0x415c1e[_0xbc8d('0x16')][_0xbc8d('0x17')]());_0x1372ee['error'](_0xbc8d('0x22'),util[_0xbc8d('0x23')](_0xbc8d('0x24'),_0x415c1e[_0xbc8d('0x16')]['toLowerCase'](),_0x415c1e[_0xbc8d('0x19')]));}}else{_0x1372ee=require('../../../../config/logger')(_0x415c1e[_0xbc8d('0x16')][_0xbc8d('0x17')]());_0x1372ee[_0xbc8d('0x25')](_0xbc8d('0x22'),util[_0xbc8d('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x415c1e['data1'][_0xbc8d('0x17')](),_0x415c1e[_0xbc8d('0x26')]));}}else{}}catch(_0x1b1d46){console[_0xbc8d('0x25')](_0x1b1d46);}}}}; \ No newline at end of file +var _0xe899=['log','EVENT\x20UNKNOWN','data1','zendesk','salesforce','zoho','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','sugarcrm','desk','vtiger','dynamics365','freshsales','servicenow','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId'];(function(_0x20a695,_0x7a391c){var _0x259658=function(_0x43d62a){while(--_0x43d62a){_0x20a695['push'](_0x20a695['shift']());}};_0x259658(++_0x7a391c);}(_0xe899,0xf3));var _0x9e89=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0xe899[_0x380a3f];return _0x2b4eca;};'use strict';var _=require('lodash');var util=require(_0x9e89('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x9e89('0x1'));var freshdesk=require(_0x9e89('0x2'));var zoho=require(_0x9e89('0x3'));var desk=require('./desk');var vtiger=require(_0x9e89('0x4'));var servicenow=require(_0x9e89('0x5'));var dynamics365=require(_0x9e89('0x6'));var freshsales=require('./freshsales');var integrations=['zendesk','salesforce',_0x9e89('0x7'),'freshdesk','zoho',_0x9e89('0x8'),_0x9e89('0x9'),_0x9e89('0xa'),_0x9e89('0xb'),_0x9e89('0xc')];exports['exec']=function(_0x51bb35,_0x545073,_0x344a1e,_0x15392e,_0xf0edf1,_0x343088){if(_0x344a1e){if(_[_0x9e89('0xd')](integrations,_0x51bb35['data1'][_0x9e89('0xe')]())){try{var _0x5e0d06=null;var _0x3f83a5='';var _0x17dbfd=_0x344a1e[_0x51bb35['data1'][_0x9e89('0xe')]()];if(_0x17dbfd){var _0x20b6b4=_0x17dbfd[_0x51bb35[_0x9e89('0xf')]];if(_0x20b6b4){var _0x149fde=_[_0x9e89('0x10')](_0x20b6b4[_0x9e89('0x11')],{'id':parseInt(_0x51bb35[_0x9e89('0x12')],0xa)});if(_0x149fde){if(_0x15392e){if(_0xf0edf1&&_0x545073[_0x9e89('0x13')]){_0x3f83a5=_0x9e89('0x13');}else if(_0x545073[_0x9e89('0x14')]){_0x3f83a5='outbound';}else{console[_0x9e89('0x15')](_0x9e89('0x16'),_0x545073);}}else{_0x3f83a5='unmanaged';}switch(_0x51bb35[_0x9e89('0x17')]['toLowerCase']()){case _0x9e89('0x18'):zendesk[_0x3f83a5](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088);break;case _0x9e89('0x19'):salesforce[_0x3f83a5](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088);break;case _0x9e89('0x7'):sugarcrm[_0x3f83a5](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088);break;case'freshdesk':freshdesk[_0x3f83a5](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088);break;case _0x9e89('0x1a'):zoho[_0x3f83a5](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088);break;case _0x9e89('0x8'):desk[_0x3f83a5](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088);break;case _0x9e89('0x9'):vtiger[_0x3f83a5](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088);break;case _0x9e89('0xb'):freshsales['cs'](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088,_0x3f83a5);break;case'servicenow':servicenow['cs'](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088,_0x3f83a5);break;case _0x9e89('0xa'):dynamics365['cs'](_0x51bb35,_0x545073,_0x149fde,_0x15392e,_0xf0edf1,_0x20b6b4,_0x343088,_0x3f83a5);break;default:console['log']('unknown\x20integration');}}else{_0x5e0d06=require(_0x9e89('0x1b'))(_0x51bb35[_0x9e89('0x17')][_0x9e89('0xe')]());_0x5e0d06[_0x9e89('0x1c')](_0x9e89('0x1d'),util[_0x9e89('0x1e')](_0x9e89('0x1f'),_0x51bb35[_0x9e89('0x17')][_0x9e89('0xe')](),_0x51bb35[_0x9e89('0x12')]));}}else{_0x5e0d06=require(_0x9e89('0x1b'))(_0x51bb35['data1'][_0x9e89('0xe')]());_0x5e0d06['error'](_0x9e89('0x1d'),util[_0x9e89('0x1e')](_0x9e89('0x20'),_0x51bb35[_0x9e89('0x17')][_0x9e89('0xe')](),_0x51bb35[_0x9e89('0xf')]));}}else{}}catch(_0x105f03){console[_0x9e89('0x1c')](_0x105f03);}}}}; \ 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 c2deefc..5abf625 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 _0xee9f=['variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','md5','jsforce','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign','getString','Subjects','Descriptions','Task','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','ticketType','Case','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','find','execute','then','Agent\x20%s\x20found.','Name','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','length','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','forEach','string','picklist','idField','content','toString','variable'];(function(_0x47794f,_0x12c9b3){var _0x2ca51d=function(_0x43deb3){while(--_0x43deb3){_0x47794f['push'](_0x47794f['shift']());}};_0x2ca51d(++_0x12c9b3);}(_0xee9f,0x1b0));var _0xfee9=function(_0x1dc7dc,_0x19e753){_0x1dc7dc=_0x1dc7dc-0x0;var _0x1a1177=_0xee9f[_0x1dc7dc];return _0x1a1177;};'use strict';var _=require(_0xfee9('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfee9('0x1'));var md5=require(_0xfee9('0x2'));var jsforce=require(_0xfee9('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xfee9('0x4'));var config=require(_0xfee9('0x5'));var logger=require(_0xfee9('0x6'))(_0xfee9('0x7'));config[_0xfee9('0x8')]=_[_0xfee9('0x9')](config['redis'],{'host':_0xfee9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfee9('0x8')]));function emit(_0x2edf7f,_0x146869,_0x4cd262){io['to'](_0x2edf7f)['emit'](_0x146869,_0x4cd262);}function getTicket(_0x6f48d9,_0x4d3e21,_0x336986,_0x436ad4,_0x12f5d6,_0x1cdc61,_0x2e35f8,_0xb7a897){var _0x3cd3ec=Object[_0xfee9('0xb')]({},{'OwnerId':_0x4d3e21['id'],'Subject':intUtil[_0xfee9('0xc')](_0x436ad4[_0xfee9('0xd')],_0x12f5d6,'\x20'),'Description':intUtil['getString'](_0x436ad4[_0xfee9('0xe')],_0x12f5d6,'\x0a')},getCustomFields(_0x1cdc61,_0x12f5d6));if(_0x336986){if(_0x436ad4['ticketType']===_0xfee9('0xf')){_0x3cd3ec['ActivityDate']=moment['utc']();_0x3cd3ec[_0xfee9('0x10')]=![];_0x3cd3ec[_0xfee9('0x11')]=![];if(_0x336986[_0xfee9('0x12')]===_0xfee9('0x13')||_0x336986[_0xfee9('0x12')]==='lead'){_0x3cd3ec[_0xfee9('0x14')]=_0x336986['id'];}else if(_0x336986[_0xfee9('0x12')]===_0xfee9('0x15')){_0x3cd3ec[_0xfee9('0x16')]=_0x336986['id'];}}else if(_0x436ad4[_0xfee9('0x17')]===_0xfee9('0x18')){if(_0x336986[_0xfee9('0x12')]==='contact'){_0x3cd3ec[_0xfee9('0x19')]=_0x336986['id'];}else if(_0x336986[_0xfee9('0x12')]===_0xfee9('0x15')){_0x3cd3ec['AccountId']=_0x336986['id'];}else if(_0x336986[_0xfee9('0x12')]===_0xfee9('0x1a')&&_0x436ad4[_0xfee9('0x1b')]){_0x3cd3ec[_0x436ad4[_0xfee9('0x1b')]]=_0x336986['id'];}else{logger[_0xfee9('0x1c')](_0xfee9('0x1d'));}}}return _0x2e35f8[_0xfee9('0x1e')](_0x436ad4[_0xfee9('0x17')])[_0xfee9('0x1f')](_0x3cd3ec);}function getUser(_0x2665d9,_0x12523f,_0x4059d0){if(!_['isNil'](_0x12523f)&&intUtil['validateEmail'](_0x12523f)){var _0x170bde={'Email':_0x12523f};var _0x1abaf7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4059d0[_0xfee9('0x1e')](_0xfee9('0x20'))[_0xfee9('0x21')](_0x170bde,_0x1abaf7)[_0xfee9('0x22')]()[_0xfee9('0x23')](function(_0x5533c2){if(_0x5533c2['length']){var _0x5de156=_[_0xfee9('0x21')](_0x5533c2,function(_0x15f0d5){return _0x15f0d5['Email']===_0x12523f;});if(_0x5de156){logger[_0xfee9('0x1c')](_0xfee9('0x24'),_0x12523f);return BPromise['resolve']({'id':_0x5de156['Id'],'name':_0x5de156[_0xfee9('0x25')]});}}else{logger[_0xfee9('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x12523f);return _0x4059d0['identity']()[_0xfee9('0x23')](function(_0x443cc9){return BPromise[_0xfee9('0x26')]({'id':_0x443cc9[_0xfee9('0x27')],'name':_0x443cc9[_0xfee9('0x28')]});});}});}else{logger[_0xfee9('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x12523f);return _0x4059d0[_0xfee9('0x29')]()['then'](function(_0x232d62){return BPromise[_0xfee9('0x26')]({'id':_0x232d62[_0xfee9('0x27')],'name':_0x232d62['display_name']});});}}function getEndUser(_0x845ab,_0x3357f4,_0x2d71be,_0x34c380,_0x2cfadf){var _0x1df594={'$or':{'Phone':_0x34c380}};var _0x2c593e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfee9('0x26')]()[_0xfee9('0x23')](function(){logger[_0xfee9('0x1c')](_0xfee9('0x2a'),_0x34c380,_0x3357f4[_0xfee9('0x2b')]);switch(_0x3357f4[_0xfee9('0x2b')]){case _0xfee9('0x2c'):var _0x41906f=_[_0xfee9('0x2d')](_0x1df594);if(_0x3357f4[_0xfee9('0x2e')]){var _0xbf4893={};_0xbf4893[_0x3357f4[_0xfee9('0x2e')]]=_0x34c380;_[_0xfee9('0x2f')](_0x41906f[_0xfee9('0x30')],_0xbf4893);}return _0x2cfadf['sobject'](_0xfee9('0x31'))[_0xfee9('0x21')](_0x41906f,_0x2c593e)['execute']()[_0xfee9('0x23')](function(_0x26ee02){if(_0x26ee02&&_0x26ee02['length']){return _0x26ee02;}else{var _0x58c492=_['cloneDeep'](_0x1df594);if(_0x3357f4[_0xfee9('0x32')]){var _0x36cf1f={};_0x36cf1f[_0x3357f4[_0xfee9('0x32')]]=_0x34c380;_[_0xfee9('0x2f')](_0x58c492[_0xfee9('0x30')],_0x36cf1f);}return _0x2cfadf[_0xfee9('0x1e')](_0xfee9('0x33'))[_0xfee9('0x21')](_0x58c492,_0x2c593e);}});case _0xfee9('0x34'):var _0x2820b9=_[_0xfee9('0x2d')](_0x1df594);if(_0x3357f4['additionalSearchAccount']){var _0xbf4893={};_0xbf4893[_0x3357f4[_0xfee9('0x35')]]=_0x34c380;_[_0xfee9('0x2f')](_0x2820b9[_0xfee9('0x30')],_0xbf4893);}return _0x2cfadf['sobject'](_0xfee9('0x36'))[_0xfee9('0x21')](_0x2820b9,_0x2c593e)[_0xfee9('0x22')]()[_0xfee9('0x23')](function(_0x471c01){if(_0x471c01&&_0x471c01[_0xfee9('0x37')]){return _0x471c01;}else{var _0x117569=_['cloneDeep'](_0x1df594);if(_0x3357f4['additionalSearchContact']){var _0xbebd94={};_0xbebd94[_0x3357f4['additionalSearchContact']]=_0x34c380;_['merge'](_0x117569[_0xfee9('0x30')],_0xbebd94);}return _0x2cfadf['sobject'](_0xfee9('0x31'))['find'](_0x117569,_0x2c593e)[_0xfee9('0x23')](function(_0x59ca20){if(_0x59ca20&&_0x59ca20[_0xfee9('0x37')]){return _0x59ca20;}else{var _0x3fa15b=_['cloneDeep'](_0x1df594);if(_0x3357f4[_0xfee9('0x32')]){var _0x1de507={};_0x1de507[_0x3357f4['additionalSearchLead']]=_0x34c380;_['merge'](_0x3fa15b[_0xfee9('0x30')],_0x1de507);}return _0x2cfadf[_0xfee9('0x1e')](_0xfee9('0x33'))[_0xfee9('0x21')](_0x3fa15b,_0x2c593e);}});}});case'contact':var _0x41906f=_[_0xfee9('0x2d')](_0x1df594);if(_0x3357f4['additionalSearchContact']){var _0xbf4893={};_0xbf4893[_0x3357f4['additionalSearchContact']]=_0x34c380;_['merge'](_0x41906f[_0xfee9('0x30')],_0xbf4893);}return _0x2cfadf[_0xfee9('0x1e')]('Contact')[_0xfee9('0x21')](_0x41906f,_0x2c593e)['execute']();case _0xfee9('0x1a'):var _0x392a3b=_['cloneDeep'](_0x1df594);if(_0x3357f4[_0xfee9('0x32')]){var _0xbf4893={};_0xbf4893[_0x3357f4[_0xfee9('0x32')]]=_0x34c380;_[_0xfee9('0x2f')](_0x392a3b['$or'],_0xbf4893);}return _0x2cfadf['sobject'](_0xfee9('0x33'))['find'](_0x392a3b,_0x2c593e);case _0xfee9('0x15'):var _0x2820b9=_['cloneDeep'](_0x1df594);if(_0x3357f4['additionalSearchAccount']){var _0xbf4893={};_0xbf4893[_0x3357f4[_0xfee9('0x35')]]=_0x34c380;_[_0xfee9('0x2f')](_0x2820b9[_0xfee9('0x30')],_0xbf4893);}return _0x2cfadf[_0xfee9('0x1e')](_0xfee9('0x36'))[_0xfee9('0x21')](_0x2820b9,_0x2c593e);default:return null;}})[_0xfee9('0x23')](function(_0xafe6bf){if(_0xafe6bf&&_0xafe6bf[_0xfee9('0x37')]){var _0x115279=_['first'](_0xafe6bf);if(_0x115279){return BPromise[_0xfee9('0x26')]({'id':_0x115279['Id'],'name':_0x115279[_0xfee9('0x25')],'phone':_0x115279[_0xfee9('0x38')],'endUserType':_0x115279['attributes'][_0xfee9('0x39')][_0xfee9('0x3a')]()});}}})['then'](function(_0xfa7b60){if(_0xfa7b60){logger[_0xfee9('0x1c')](_0xfee9('0x3b'),_0xfa7b60['endUserType'],_0x34c380);return BPromise['resolve'](_0xfa7b60);}else{logger[_0xfee9('0x1c')](_0xfee9('0x3c'),_0x34c380);var _0x1e343d={'Phone':_0x34c380};if(_0x3357f4[_0xfee9('0x3d')]){if(_0x3357f4['moduleCreate']==='contact'){logger[_0xfee9('0x1c')](_0xfee9('0x3e'),_0x34c380,_0x3357f4['moduleCreate']);_0x1e343d['LastName']=_0x2d71be!==_0xfee9('0x3f')?_0x2d71be:util[_0xfee9('0x40')](_0xfee9('0x41'),_0x34c380);}else if(_0x3357f4['moduleCreate']===_0xfee9('0x1a')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x34c380,_0x3357f4[_0xfee9('0x3d')]);_0x1e343d[_0xfee9('0x42')]=_0x2d71be!==_0xfee9('0x3f')?_0x2d71be:util[_0xfee9('0x40')](_0xfee9('0x41'),_0x34c380);_0x1e343d[_0xfee9('0x43')]=_0xfee9('0x44');}else if(_0x3357f4[_0xfee9('0x3d')]==='account'){logger['info'](_0xfee9('0x3e'),_0x34c380,_0x3357f4[_0xfee9('0x3d')]);_0x1e343d[_0xfee9('0x25')]=_0x2d71be!==_0xfee9('0x3f')?_0x2d71be:util[_0xfee9('0x40')](_0xfee9('0x41'),_0x34c380);}else{return null;}}return _0x2cfadf[_0xfee9('0x1e')](_['upperFirst'](_0x3357f4[_0xfee9('0x3d')]))[_0xfee9('0x1f')](_0x1e343d)[_0xfee9('0x23')](function(_0x165db5){return BPromise[_0xfee9('0x26')]({'id':_0x165db5['id'],'endUserType':_0x3357f4[_0xfee9('0x3d')]});});}});}function getCustomFields(_0x55a762,_0x207c40){var _0x5e359c={};if(_0x55a762['length']>0x0){_[_0xfee9('0x45')](_0x55a762,function(_0x52f97d){if(_['includes']([_0xfee9('0x46'),_0xfee9('0x47')],_0x52f97d[_0xfee9('0x39')])&&_0x52f97d['idField']){_0x5e359c[_0x52f97d[_0xfee9('0x48')]]=_0x52f97d[_0xfee9('0x49')][_0xfee9('0x4a')]();}else if(_0x52f97d[_0xfee9('0x39')]===_0xfee9('0x4b')&&_0x52f97d[_0xfee9('0x4c')]&&_0x52f97d[_0xfee9('0x48')]){_0x207c40[_0x52f97d[_0xfee9('0x4c')]]&&(_0x5e359c[_0x52f97d[_0xfee9('0x48')]]=_0x207c40[_0x52f97d[_0xfee9('0x4c')]][_0xfee9('0x4a')]());}else if(_0x52f97d[_0xfee9('0x39')]===_0xfee9('0x4d')&&_0x52f97d[_0xfee9('0x4e')]&&_0x52f97d[_0xfee9('0x4e')][_0xfee9('0x4f')]&&_0x52f97d[_0xfee9('0x48')]){_0x207c40[_0x52f97d[_0xfee9('0x4e')][_0xfee9('0x4f')][_0xfee9('0x3a')]()]&&(_0x5e359c[_0x52f97d[_0xfee9('0x48')]]=_0x207c40[_0x52f97d[_0xfee9('0x4e')][_0xfee9('0x4f')][_0xfee9('0x3a')]()][_0xfee9('0x4a')]());}});}return _0x5e359c;}function getConnection(_0x36d72a){var _0xf06a88=_0x36d72a[_0xfee9('0x50')][_0xfee9('0x51')](_0x36d72a[_0xfee9('0x52')]);var _0x109754=new jsforce[(_0xfee9('0x53'))]({'oauth2':{'loginUrl':_0x36d72a[_0xfee9('0x54')]||_0xfee9('0x55'),'clientId':_0x36d72a[_0xfee9('0x56')],'clientSecret':_0x36d72a['clientSecret']}});return _0x109754[_0xfee9('0x57')](_0x36d72a[_0xfee9('0x58')],_0xf06a88)[_0xfee9('0x23')](function(){logger['info'](_0xfee9('0x59'));return _0x109754;});}exports[_0xfee9('0x5a')]=function(_0x483f08,_0x1a489f,_0x481216,_0x317ccb,_0x4b1745,_0x209a85){var _0x1eeb88,_0x25962f,_0x263efa,_0x1f4e4a;_0x209a85[_0xfee9('0x5b')]=intUtil[_0xfee9('0x5c')](_0x209a85[_0xfee9('0x5b')]);_0x209a85[_0xfee9('0x54')]=intUtil[_0xfee9('0x5c')](_0x209a85[_0xfee9('0x54')]);if(_0x4b1745&&_0x4b1745[_0xfee9('0x5d')]){logger[_0xfee9('0x1c')]('[QUEUE]',_0xfee9('0x5e'));_0x1a489f[_0xfee9('0x5f')]=util[_0xfee9('0x40')](_0xfee9('0x60'),_0x209a85[_0xfee9('0x5b')],_0x1a489f[_0xfee9('0x61')],md5(_0x1a489f[_0xfee9('0x61')]));}else{_0x1a489f['recordingURL']='';}return getConnection(_0x209a85)[_0xfee9('0x23')](function(_0x242810){_0x1f4e4a=_0x242810;return getUser(_0x209a85,_0x317ccb['email'],_0x1f4e4a);})[_0xfee9('0x23')](function(_0x593642){_0x1eeb88=_0x593642;return getEndUser(_0x209a85,_0x481216,_0x1a489f[_0xfee9('0x62')],_0x1a489f[_0xfee9('0x63')],_0x1f4e4a);})[_0xfee9('0x23')](function(_0x49f444){_0x25962f=_0x49f444;return getTicket(_0x209a85,_0x1eeb88,_0x25962f,_0x481216,_0x1a489f,_0x481216[_0xfee9('0x64')],_0x1f4e4a,_0xfee9('0x5a'));})[_0xfee9('0x23')](function(_0x598aa5){_0x263efa=_0x598aa5;logger[_0xfee9('0x1c')](_0xfee9('0x65'),_0x263efa['id']);logger[_0xfee9('0x1c')](_0xfee9('0x66'),_0x263efa['id'],_0x317ccb['name'],_0x209a85[_0xfee9('0x39')]);switch(_0x209a85['type']){case _0xfee9('0x67'):emit(util['format']('user:%s',_0x317ccb[_0xfee9('0x4f')]),_0xfee9('0x68'),{'recordId':_0x263efa['id']});break;case _0xfee9('0x69'):emit(util['format'](_0xfee9('0x6a'),_0x317ccb[_0xfee9('0x4f')]),_0xfee9('0x6b'),{'uri':util[_0xfee9('0x40')](_0xfee9('0x6c'),_0x1f4e4a[_0xfee9('0x6d')],_0x263efa['id'])});break;default:logger[_0xfee9('0x6e')](_0xfee9('0x6f'));}})[_0xfee9('0x70')](function(_0x2ac9d4){logger['error'](_0xfee9('0x71'),_0x2ac9d4);});};exports['outbound']=function(_0x1b7bd1,_0xeaf99d,_0x1da93e,_0xf86221,_0x452bb5,_0x23c678,_0x1b387e){var _0x450bd3,_0x375522,_0x3d265d,_0x282ad5;_0x23c678[_0xfee9('0x5b')]=intUtil['stripTrailingSlash'](_0x23c678['serverUrl']);_0x23c678[_0xfee9('0x54')]=intUtil['stripTrailingSlash'](_0x23c678[_0xfee9('0x54')]);if(_0x1b387e&&_0x1b387e[_0xfee9('0x72')]&&_0x1b387e['recordingFormat']!==_0xfee9('0x73')){logger[_0xfee9('0x1c')](_0xfee9('0x74'),_0xfee9('0x5e'));_0xeaf99d[_0xfee9('0x5f')]=util[_0xfee9('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23c678[_0xfee9('0x5b')],_0xeaf99d['uniqueid'],md5(_0xeaf99d['uniqueid']));}return getConnection(_0x23c678)[_0xfee9('0x23')](function(_0x33f9de){_0x282ad5=_0x33f9de;return getUser(_0x23c678,_0xf86221[_0xfee9('0x75')],_0x282ad5);})[_0xfee9('0x23')](function(_0x1d6686){_0x450bd3=_0x1d6686;return getEndUser(_0x23c678,_0x1da93e,_0xeaf99d[_0xfee9('0x76')],_0xeaf99d[_0xfee9('0x77')],_0x282ad5);})[_0xfee9('0x23')](function(_0x28da1d){_0x375522=_0x28da1d;return getTicket(_0x23c678,_0x450bd3,_0x375522,_0x1da93e,_0xeaf99d,_0x1da93e['Fields'],_0x282ad5,_0xfee9('0x78'));})['then'](function(_0xf5f71b){_0x3d265d=_0xf5f71b;logger[_0xfee9('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3d265d['id']);logger['info'](_0xfee9('0x79'),_0x3d265d['id'],_0xf86221[_0xfee9('0x4f')],_0x23c678[_0xfee9('0x39')]);switch(_0x23c678['type']){case'integrationTab':emit(util[_0xfee9('0x40')]('user:%s',_0xf86221['name']),'trigger:salesforce:display',{'recordId':_0x3d265d['id']});break;case _0xfee9('0x69'):emit(util[_0xfee9('0x40')](_0xfee9('0x6a'),_0xf86221[_0xfee9('0x4f')]),_0xfee9('0x6b'),{'uri':util[_0xfee9('0x40')]('%s/%s/e',_0x282ad5[_0xfee9('0x6d')],_0x3d265d['id'])});break;default:logger[_0xfee9('0x6e')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x10f9a1){logger[_0xfee9('0x6e')](_0xfee9('0x74'),_0x10f9a1);});};exports['unmanaged']=function(_0x3e05b5,_0x21db97,_0x4f7910,_0x3d8ea0,_0x3e3b82,_0x114f7c){var _0x37b667,_0xaa2dec,_0x3da8a7,_0x312130;_0x114f7c[_0xfee9('0x5b')]=intUtil[_0xfee9('0x5c')](_0x114f7c[_0xfee9('0x5b')]);_0x114f7c['remoteUri']=intUtil[_0xfee9('0x5c')](_0x114f7c[_0xfee9('0x54')]);if(_0x3e3b82&&_0x3e3b82[_0xfee9('0x5d')]){logger['info']('['+_0x21db97[_0xfee9('0x7a')][_0xfee9('0x7b')]()+']','Recording\x20is\x20enabled!');_0x21db97[_0xfee9('0x5f')]=util[_0xfee9('0x40')](_0xfee9('0x60'),_0x114f7c[_0xfee9('0x5b')],_0x21db97[_0xfee9('0x61')],md5(_0x21db97[_0xfee9('0x61')]));}else{_0x21db97[_0xfee9('0x5f')]='';}return getConnection(_0x114f7c)[_0xfee9('0x23')](function(_0x2c0246){_0x312130=_0x2c0246;if(!_[_0xfee9('0x7c')](_0x3d8ea0)){return getUser(_0x114f7c,_0x3d8ea0[_0xfee9('0x4f')],_0x312130);}else{return getUser(_0x114f7c,null,_0x312130);}})[_0xfee9('0x23')](function(_0x1cac55){_0x37b667=_0x1cac55;return getEndUser(_0x114f7c,_0x4f7910,_0x21db97['calleridname'],_0x21db97[_0xfee9('0x63')],_0x312130);})[_0xfee9('0x23')](function(_0x177dae){_0xaa2dec=_0x177dae;return getTicket(_0x114f7c,_0x37b667,_0xaa2dec,_0x4f7910,_0x21db97,_0x4f7910[_0xfee9('0x64')],_0x312130);})[_0xfee9('0x23')](function(_0x4c945e){_0x3da8a7=_0x4c945e;logger[_0xfee9('0x1c')]('['+_0x21db97['lastevent'][_0xfee9('0x7b')]()+_0xfee9('0x7d'),_0x3da8a7['id']);logger[_0xfee9('0x1c')]('['+_0x21db97[_0xfee9('0x7a')][_0xfee9('0x7b')]()+_0xfee9('0x7e'),_0x114f7c[_0xfee9('0x39')]);})[_0xfee9('0x70')](function(_0x4b1132){logger['error']('['+_0x21db97[_0xfee9('0x7a')]['toUpperCase']()+']',_0x4b1132);});}; \ No newline at end of file +var _0xe4a0=['md5','jsforce','util','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','contact','ContactId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Email','resolve','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','additionalSearchContact','$or','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Contact','first','Phone','attributes','type','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Name','upperFirst','includes','string','picklist','idField','variableName','Variable','name','toLowerCase','toString','password','securityToken','remoteUri','clientId','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','newTab','trigger:browser:url','instanceUrl','error','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[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','unmanaged','lastevent','toUpperCase','request-promise','moment'];(function(_0x507996,_0x16eaba){var _0xa0ff4c=function(_0x3155ef){while(--_0x3155ef){_0x507996['push'](_0x507996['shift']());}};_0xa0ff4c(++_0x16eaba);}(_0xe4a0,0x163));var _0x0e4a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe4a0[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var rp=require(_0x0e4a('0x0'));var moment=require(_0x0e4a('0x1'));var BPromise=require('bluebird');var md5=require(_0x0e4a('0x2'));var jsforce=require(_0x0e4a('0x3'));var util=require(_0x0e4a('0x4'));var Redis=require(_0x0e4a('0x5'));var intUtil=require('./util');var config=require(_0x0e4a('0x6'));var logger=require('../../../../config/logger')(_0x0e4a('0x7'));config[_0x0e4a('0x8')]=_[_0x0e4a('0x9')](config['redis'],{'host':_0x0e4a('0xa'),'port':0x18eb});var io=require(_0x0e4a('0xb'))(new Redis(config['redis']));function emit(_0x1e5302,_0x46bff3,_0x4f9816){io['to'](_0x1e5302)[_0x0e4a('0xc')](_0x46bff3,_0x4f9816);}function getTicket(_0x3d61fe,_0x510ee1,_0xedc8a1,_0x59da5e,_0x53828d,_0x128b02,_0x43a14b,_0x41b3f9){var _0x14dedd=Object['assign']({},{'OwnerId':_0x510ee1['id'],'Subject':intUtil[_0x0e4a('0xd')](_0x59da5e[_0x0e4a('0xe')],_0x53828d,'\x20'),'Description':intUtil[_0x0e4a('0xd')](_0x59da5e[_0x0e4a('0xf')],_0x53828d,'\x0a')},getCustomFields(_0x128b02,_0x53828d));if(_0xedc8a1){if(_0x59da5e[_0x0e4a('0x10')]===_0x0e4a('0x11')){_0x14dedd['ActivityDate']=moment[_0x0e4a('0x12')]();_0x14dedd[_0x0e4a('0x13')]=![];_0x14dedd[_0x0e4a('0x14')]=![];if(_0xedc8a1[_0x0e4a('0x15')]==='contact'||_0xedc8a1[_0x0e4a('0x15')]===_0x0e4a('0x16')){_0x14dedd[_0x0e4a('0x17')]=_0xedc8a1['id'];}else if(_0xedc8a1[_0x0e4a('0x15')]===_0x0e4a('0x18')){_0x14dedd[_0x0e4a('0x19')]=_0xedc8a1['id'];}}else if(_0x59da5e[_0x0e4a('0x10')]==='Case'){if(_0xedc8a1['endUserType']===_0x0e4a('0x1a')){_0x14dedd[_0x0e4a('0x1b')]=_0xedc8a1['id'];}else if(_0xedc8a1[_0x0e4a('0x15')]===_0x0e4a('0x18')){_0x14dedd['AccountId']=_0xedc8a1['id'];}else if(_0xedc8a1[_0x0e4a('0x15')]===_0x0e4a('0x16')&&_0x59da5e[_0x0e4a('0x1c')]){_0x14dedd[_0x59da5e[_0x0e4a('0x1c')]]=_0xedc8a1['id'];}else{logger['info'](_0x0e4a('0x1d'));}}}return _0x43a14b[_0x0e4a('0x1e')](_0x59da5e[_0x0e4a('0x10')])[_0x0e4a('0x1f')](_0x14dedd);}function getUser(_0xd1599a,_0x4759a1,_0x198b9a){if(!_[_0x0e4a('0x20')](_0x4759a1)&&intUtil['validateEmail'](_0x4759a1)){var _0x5a5773={'Email':_0x4759a1};var _0x49c142={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x198b9a['sobject'](_0x0e4a('0x21'))[_0x0e4a('0x22')](_0x5a5773,_0x49c142)[_0x0e4a('0x23')]()[_0x0e4a('0x24')](function(_0x47d472){if(_0x47d472[_0x0e4a('0x25')]){var _0x43f01b=_[_0x0e4a('0x22')](_0x47d472,function(_0x411490){return _0x411490[_0x0e4a('0x26')]===_0x4759a1;});if(_0x43f01b){logger['info']('Agent\x20%s\x20found.',_0x4759a1);return BPromise[_0x0e4a('0x27')]({'id':_0x43f01b['Id'],'name':_0x43f01b['Name']});}}else{logger[_0x0e4a('0x28')](_0x0e4a('0x29'),_0x4759a1);return _0x198b9a[_0x0e4a('0x2a')]()[_0x0e4a('0x24')](function(_0xfbe864){return BPromise[_0x0e4a('0x27')]({'id':_0xfbe864[_0x0e4a('0x2b')],'name':_0xfbe864[_0x0e4a('0x2c')]});});}});}else{logger['info'](_0x0e4a('0x29'),_0x4759a1);return _0x198b9a[_0x0e4a('0x2a')]()[_0x0e4a('0x24')](function(_0x67b719){return BPromise[_0x0e4a('0x27')]({'id':_0x67b719[_0x0e4a('0x2b')],'name':_0x67b719[_0x0e4a('0x2c')]});});}}function getEndUser(_0x3e5971,_0x2b1a0a,_0x8af41,_0x39ae29,_0x1129f2){var _0x53b1f3={'$or':{'Phone':_0x39ae29}};var _0x35be72={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0e4a('0x27')]()[_0x0e4a('0x24')](function(){logger[_0x0e4a('0x28')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x39ae29,_0x2b1a0a[_0x0e4a('0x2d')]);switch(_0x2b1a0a[_0x0e4a('0x2d')]){case _0x0e4a('0x2e'):var _0x222a01=_['cloneDeep'](_0x53b1f3);if(_0x2b1a0a['additionalSearchContact']){var _0x149ae0={};_0x149ae0[_0x2b1a0a[_0x0e4a('0x2f')]]=_0x39ae29;_['merge'](_0x222a01[_0x0e4a('0x30')],_0x149ae0);}return _0x1129f2[_0x0e4a('0x1e')]('Contact')[_0x0e4a('0x22')](_0x222a01,_0x35be72)[_0x0e4a('0x23')]()[_0x0e4a('0x24')](function(_0x5653e7){if(_0x5653e7&&_0x5653e7[_0x0e4a('0x25')]){return _0x5653e7;}else{var _0x2d7fd3=_[_0x0e4a('0x31')](_0x53b1f3);if(_0x2b1a0a['additionalSearchLead']){var _0x39aa93={};_0x39aa93[_0x2b1a0a[_0x0e4a('0x32')]]=_0x39ae29;_[_0x0e4a('0x33')](_0x2d7fd3[_0x0e4a('0x30')],_0x39aa93);}return _0x1129f2['sobject'](_0x0e4a('0x34'))['find'](_0x2d7fd3,_0x35be72);}});case _0x0e4a('0x35'):var _0x4746b0=_['cloneDeep'](_0x53b1f3);if(_0x2b1a0a[_0x0e4a('0x36')]){var _0x149ae0={};_0x149ae0[_0x2b1a0a[_0x0e4a('0x36')]]=_0x39ae29;_[_0x0e4a('0x33')](_0x4746b0[_0x0e4a('0x30')],_0x149ae0);}return _0x1129f2[_0x0e4a('0x1e')]('Account')[_0x0e4a('0x22')](_0x4746b0,_0x35be72)[_0x0e4a('0x23')]()[_0x0e4a('0x24')](function(_0x1206c9){if(_0x1206c9&&_0x1206c9[_0x0e4a('0x25')]){return _0x1206c9;}else{var _0x1f1bce=_[_0x0e4a('0x31')](_0x53b1f3);if(_0x2b1a0a['additionalSearchContact']){var _0xc0ecd7={};_0xc0ecd7[_0x2b1a0a['additionalSearchContact']]=_0x39ae29;_['merge'](_0x1f1bce[_0x0e4a('0x30')],_0xc0ecd7);}return _0x1129f2[_0x0e4a('0x1e')](_0x0e4a('0x37'))[_0x0e4a('0x22')](_0x1f1bce,_0x35be72)[_0x0e4a('0x24')](function(_0x4f434c){if(_0x4f434c&&_0x4f434c[_0x0e4a('0x25')]){return _0x4f434c;}else{var _0x478123=_['cloneDeep'](_0x53b1f3);if(_0x2b1a0a['additionalSearchLead']){var _0x11707d={};_0x11707d[_0x2b1a0a[_0x0e4a('0x32')]]=_0x39ae29;_[_0x0e4a('0x33')](_0x478123[_0x0e4a('0x30')],_0x11707d);}return _0x1129f2[_0x0e4a('0x1e')](_0x0e4a('0x34'))[_0x0e4a('0x22')](_0x478123,_0x35be72);}});}});case _0x0e4a('0x1a'):var _0x222a01=_['cloneDeep'](_0x53b1f3);if(_0x2b1a0a[_0x0e4a('0x2f')]){var _0x149ae0={};_0x149ae0[_0x2b1a0a[_0x0e4a('0x2f')]]=_0x39ae29;_['merge'](_0x222a01[_0x0e4a('0x30')],_0x149ae0);}return _0x1129f2['sobject']('Contact')[_0x0e4a('0x22')](_0x222a01,_0x35be72)['execute']();case _0x0e4a('0x16'):var _0x5ddb3f=_[_0x0e4a('0x31')](_0x53b1f3);if(_0x2b1a0a[_0x0e4a('0x32')]){var _0x149ae0={};_0x149ae0[_0x2b1a0a[_0x0e4a('0x32')]]=_0x39ae29;_[_0x0e4a('0x33')](_0x5ddb3f[_0x0e4a('0x30')],_0x149ae0);}return _0x1129f2[_0x0e4a('0x1e')](_0x0e4a('0x34'))[_0x0e4a('0x22')](_0x5ddb3f,_0x35be72);case _0x0e4a('0x18'):var _0x4746b0=_[_0x0e4a('0x31')](_0x53b1f3);if(_0x2b1a0a[_0x0e4a('0x36')]){var _0x149ae0={};_0x149ae0[_0x2b1a0a[_0x0e4a('0x36')]]=_0x39ae29;_[_0x0e4a('0x33')](_0x4746b0[_0x0e4a('0x30')],_0x149ae0);}return _0x1129f2[_0x0e4a('0x1e')]('Account')[_0x0e4a('0x22')](_0x4746b0,_0x35be72);default:return null;}})[_0x0e4a('0x24')](function(_0x16367e){if(_0x16367e&&_0x16367e[_0x0e4a('0x25')]){var _0x149c3e=_[_0x0e4a('0x38')](_0x16367e);if(_0x149c3e){return BPromise[_0x0e4a('0x27')]({'id':_0x149c3e['Id'],'name':_0x149c3e['Name'],'phone':_0x149c3e[_0x0e4a('0x39')],'endUserType':_0x149c3e[_0x0e4a('0x3a')][_0x0e4a('0x3b')]['toLowerCase']()});}}})[_0x0e4a('0x24')](function(_0x355b29){if(_0x355b29){logger[_0x0e4a('0x28')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x355b29[_0x0e4a('0x15')],_0x39ae29);return BPromise['resolve'](_0x355b29);}else{logger[_0x0e4a('0x28')](_0x0e4a('0x3c'),_0x39ae29);var _0xed73d={'Phone':_0x39ae29};if(_0x2b1a0a['moduleCreate']){if(_0x2b1a0a[_0x0e4a('0x3d')]===_0x0e4a('0x1a')){logger[_0x0e4a('0x28')](_0x0e4a('0x3e'),_0x39ae29,_0x2b1a0a[_0x0e4a('0x3d')]);_0xed73d[_0x0e4a('0x3f')]=_0x8af41!==_0x0e4a('0x40')?_0x8af41:util[_0x0e4a('0x41')](_0x0e4a('0x42'),_0x39ae29);}else if(_0x2b1a0a[_0x0e4a('0x3d')]==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x39ae29,_0x2b1a0a[_0x0e4a('0x3d')]);_0xed73d[_0x0e4a('0x3f')]=_0x8af41!==_0x0e4a('0x40')?_0x8af41:util[_0x0e4a('0x41')]('Caller\x20-\x20%s',_0x39ae29);_0xed73d[_0x0e4a('0x43')]=_0x0e4a('0x44');}else if(_0x2b1a0a[_0x0e4a('0x3d')]===_0x0e4a('0x18')){logger['info'](_0x0e4a('0x3e'),_0x39ae29,_0x2b1a0a[_0x0e4a('0x3d')]);_0xed73d[_0x0e4a('0x45')]=_0x8af41!==_0x0e4a('0x40')?_0x8af41:util[_0x0e4a('0x41')]('Caller\x20-\x20%s',_0x39ae29);}else{return null;}}return _0x1129f2[_0x0e4a('0x1e')](_[_0x0e4a('0x46')](_0x2b1a0a[_0x0e4a('0x3d')]))[_0x0e4a('0x1f')](_0xed73d)[_0x0e4a('0x24')](function(_0x16edfe){return BPromise[_0x0e4a('0x27')]({'id':_0x16edfe['id'],'endUserType':_0x2b1a0a[_0x0e4a('0x3d')]});});}});}function getCustomFields(_0x3feb77,_0x334f86){var _0x3e2ac9={};if(_0x3feb77[_0x0e4a('0x25')]>0x0){_['forEach'](_0x3feb77,function(_0x58624b){if(_[_0x0e4a('0x47')]([_0x0e4a('0x48'),_0x0e4a('0x49')],_0x58624b[_0x0e4a('0x3b')])&&_0x58624b['idField']){_0x3e2ac9[_0x58624b[_0x0e4a('0x4a')]]=_0x58624b['content']['toString']();}else if(_0x58624b[_0x0e4a('0x3b')]==='variable'&&_0x58624b[_0x0e4a('0x4b')]&&_0x58624b['idField']){_0x334f86[_0x58624b[_0x0e4a('0x4b')]]&&(_0x3e2ac9[_0x58624b[_0x0e4a('0x4a')]]=_0x334f86[_0x58624b[_0x0e4a('0x4b')]]['toString']());}else if(_0x58624b[_0x0e4a('0x3b')]==='customVariable'&&_0x58624b[_0x0e4a('0x4c')]&&_0x58624b[_0x0e4a('0x4c')]['name']&&_0x58624b[_0x0e4a('0x4a')]){_0x334f86[_0x58624b['Variable'][_0x0e4a('0x4d')][_0x0e4a('0x4e')]()]&&(_0x3e2ac9[_0x58624b[_0x0e4a('0x4a')]]=_0x334f86[_0x58624b['Variable']['name'][_0x0e4a('0x4e')]()][_0x0e4a('0x4f')]());}});}return _0x3e2ac9;}function getConnection(_0x3f15a3){var _0x46b83c=_0x3f15a3[_0x0e4a('0x50')]['concat'](_0x3f15a3[_0x0e4a('0x51')]);var _0x323472=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3f15a3[_0x0e4a('0x52')]||'https://login.salesforce.com','clientId':_0x3f15a3[_0x0e4a('0x53')],'clientSecret':_0x3f15a3['clientSecret']}});return _0x323472[_0x0e4a('0x54')](_0x3f15a3[_0x0e4a('0x55')],_0x46b83c)[_0x0e4a('0x24')](function(){logger['info'](_0x0e4a('0x56'));return _0x323472;});}exports['queue']=function(_0x489d52,_0x4fc321,_0x2ec740,_0x1bfccc,_0x2315ab,_0x40874b){var _0x1d2335,_0x2ee7e6,_0x1e2c08,_0x4198e6;_0x40874b['serverUrl']=intUtil[_0x0e4a('0x57')](_0x40874b[_0x0e4a('0x58')]);_0x40874b[_0x0e4a('0x52')]=intUtil['stripTrailingSlash'](_0x40874b[_0x0e4a('0x52')]);if(_0x2315ab&&_0x2315ab[_0x0e4a('0x59')]){logger[_0x0e4a('0x28')](_0x0e4a('0x5a'),_0x0e4a('0x5b'));_0x4fc321[_0x0e4a('0x5c')]=util[_0x0e4a('0x41')](_0x0e4a('0x5d'),_0x40874b[_0x0e4a('0x58')],_0x4fc321[_0x0e4a('0x5e')],md5(_0x4fc321[_0x0e4a('0x5e')]));}else{_0x4fc321[_0x0e4a('0x5c')]='';}return getConnection(_0x40874b)[_0x0e4a('0x24')](function(_0xefb4c1){_0x4198e6=_0xefb4c1;return getUser(_0x40874b,_0x1bfccc[_0x0e4a('0x5f')],_0x4198e6);})[_0x0e4a('0x24')](function(_0x454a6b){_0x1d2335=_0x454a6b;return getEndUser(_0x40874b,_0x2ec740,_0x4fc321[_0x0e4a('0x60')],_0x4fc321[_0x0e4a('0x61')],_0x4198e6);})['then'](function(_0x142a26){_0x2ee7e6=_0x142a26;return getTicket(_0x40874b,_0x1d2335,_0x2ee7e6,_0x2ec740,_0x4fc321,_0x2ec740['Fields'],_0x4198e6,_0x0e4a('0x62'));})[_0x0e4a('0x24')](function(_0x2e652c){_0x1e2c08=_0x2e652c;logger[_0x0e4a('0x28')](_0x0e4a('0x63'),_0x1e2c08['id']);logger[_0x0e4a('0x28')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1e2c08['id'],_0x1bfccc[_0x0e4a('0x4d')],_0x40874b[_0x0e4a('0x3b')]);switch(_0x40874b[_0x0e4a('0x3b')]){case'integrationTab':emit(util[_0x0e4a('0x41')](_0x0e4a('0x64'),_0x1bfccc[_0x0e4a('0x4d')]),'trigger:salesforce:display',{'recordId':_0x1e2c08['id']});break;case _0x0e4a('0x65'):emit(util[_0x0e4a('0x41')](_0x0e4a('0x64'),_0x1bfccc[_0x0e4a('0x4d')]),_0x0e4a('0x66'),{'uri':util['format']('%s/%s/e',_0x4198e6[_0x0e4a('0x67')],_0x1e2c08['id'])});break;default:logger[_0x0e4a('0x68')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x0e4a('0x69')](function(_0x485645){logger[_0x0e4a('0x68')]('[QUEUE]',_0x485645);});};exports['outbound']=function(_0x2fbc1e,_0x64134e,_0x28d2d6,_0x333941,_0x448713,_0x5930a4,_0x3f3556){var _0x45dd45,_0x9b8d60,_0xb0aa8e,_0x5ad5a1;_0x5930a4[_0x0e4a('0x58')]=intUtil[_0x0e4a('0x57')](_0x5930a4['serverUrl']);_0x5930a4[_0x0e4a('0x52')]=intUtil[_0x0e4a('0x57')](_0x5930a4[_0x0e4a('0x52')]);if(_0x3f3556&&_0x3f3556['recordingFormat']&&_0x3f3556[_0x0e4a('0x6a')]!==_0x0e4a('0x6b')){logger[_0x0e4a('0x28')](_0x0e4a('0x6c'),'Recording\x20is\x20enabled!');_0x64134e[_0x0e4a('0x5c')]=util['format'](_0x0e4a('0x5d'),_0x5930a4[_0x0e4a('0x58')],_0x64134e[_0x0e4a('0x5e')],md5(_0x64134e[_0x0e4a('0x5e')]));}return getConnection(_0x5930a4)[_0x0e4a('0x24')](function(_0x1e834d){_0x5ad5a1=_0x1e834d;return getUser(_0x5930a4,_0x333941['email'],_0x5ad5a1);})['then'](function(_0xa1039c){_0x45dd45=_0xa1039c;return getEndUser(_0x5930a4,_0x28d2d6,_0x64134e[_0x0e4a('0x6d')],_0x64134e[_0x0e4a('0x6e')],_0x5ad5a1);})[_0x0e4a('0x24')](function(_0x3e3af0){_0x9b8d60=_0x3e3af0;return getTicket(_0x5930a4,_0x45dd45,_0x9b8d60,_0x28d2d6,_0x64134e,_0x28d2d6[_0x0e4a('0x6f')],_0x5ad5a1,'outbound');})[_0x0e4a('0x24')](function(_0x323d89){_0xb0aa8e=_0x323d89;logger['info'](_0x0e4a('0x70'),_0xb0aa8e['id']);logger['info'](_0x0e4a('0x71'),_0xb0aa8e['id'],_0x333941[_0x0e4a('0x4d')],_0x5930a4[_0x0e4a('0x3b')]);switch(_0x5930a4[_0x0e4a('0x3b')]){case _0x0e4a('0x72'):emit(util[_0x0e4a('0x41')](_0x0e4a('0x64'),_0x333941[_0x0e4a('0x4d')]),'trigger:salesforce:display',{'recordId':_0xb0aa8e['id']});break;case _0x0e4a('0x65'):emit(util['format']('user:%s',_0x333941[_0x0e4a('0x4d')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x5ad5a1[_0x0e4a('0x67')],_0xb0aa8e['id'])});break;default:logger[_0x0e4a('0x68')](_0x0e4a('0x6c'),_0x0e4a('0x73'));}})[_0x0e4a('0x69')](function(_0x4af172){logger[_0x0e4a('0x68')](_0x0e4a('0x6c'),_0x4af172);});};exports[_0x0e4a('0x74')]=function(_0x43ee81,_0x588798,_0x13770b,_0x31b0ed,_0x53c33c,_0x2b51cc){var _0x4afe26,_0x28af58,_0x4306bc,_0x3f53ae;_0x2b51cc[_0x0e4a('0x58')]=intUtil[_0x0e4a('0x57')](_0x2b51cc[_0x0e4a('0x58')]);_0x2b51cc[_0x0e4a('0x52')]=intUtil[_0x0e4a('0x57')](_0x2b51cc[_0x0e4a('0x52')]);if(_0x53c33c&&_0x53c33c['monitor_format']){logger['info']('['+_0x588798[_0x0e4a('0x75')][_0x0e4a('0x76')]()+']',_0x0e4a('0x5b'));_0x588798[_0x0e4a('0x5c')]=util[_0x0e4a('0x41')](_0x0e4a('0x5d'),_0x2b51cc['serverUrl'],_0x588798[_0x0e4a('0x5e')],md5(_0x588798['uniqueid']));}else{_0x588798[_0x0e4a('0x5c')]='';}return getConnection(_0x2b51cc)['then'](function(_0x351304){_0x3f53ae=_0x351304;if(!_[_0x0e4a('0x20')](_0x31b0ed)){return getUser(_0x2b51cc,_0x31b0ed[_0x0e4a('0x4d')],_0x3f53ae);}else{return getUser(_0x2b51cc,null,_0x3f53ae);}})['then'](function(_0x440a0a){_0x4afe26=_0x440a0a;return getEndUser(_0x2b51cc,_0x13770b,_0x588798[_0x0e4a('0x60')],_0x588798[_0x0e4a('0x61')],_0x3f53ae);})[_0x0e4a('0x24')](function(_0x59c536){_0x28af58=_0x59c536;return getTicket(_0x2b51cc,_0x4afe26,_0x28af58,_0x13770b,_0x588798,_0x13770b[_0x0e4a('0x6f')],_0x3f53ae);})[_0x0e4a('0x24')](function(_0x35909d){_0x4306bc=_0x35909d;logger[_0x0e4a('0x28')]('['+_0x588798[_0x0e4a('0x75')][_0x0e4a('0x76')]()+']\x20Ticket\x20%s\x20created.',_0x4306bc['id']);logger[_0x0e4a('0x28')]('['+_0x588798[_0x0e4a('0x75')][_0x0e4a('0x76')]()+']\x20Integration\x20account\x20type\x20%s.',_0x2b51cc['type']);})[_0x0e4a('0x69')](function(_0x56e671){logger[_0x0e4a('0x68')]('['+_0x588798[_0x0e4a('0x75')]['toUpperCase']()+']',_0x56e671);});}; \ 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 b3c66b6..419d7dc 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 _0x31d0=['../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','adminId','sys_id','],\x20getAdminUser\x20crm','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','variable','variableName','Variable','outbound','assign','true','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment'];(function(_0x51741b,_0x5a5c63){var _0x56ef68=function(_0x5ac1f8){while(--_0x5ac1f8){_0x51741b['push'](_0x51741b['shift']());}};_0x56ef68(++_0x5a5c63);}(_0x31d0,0xd7));var _0x031d=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x31d0[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require(_0x031d('0x0'));var Promise=require(_0x031d('0x1'));var rp=require(_0x031d('0x2'));var util=require(_0x031d('0x3'));var md5=require('md5');var Redis=require(_0x031d('0x4'));var intUtil=require(_0x031d('0x5'));var config=require(_0x031d('0x6'));var logger=require(_0x031d('0x7'))(_0x031d('0x8'));config[_0x031d('0x9')]=_[_0x031d('0xa')](config[_0x031d('0x9')],{'host':_0x031d('0xb'),'port':0x18eb});var io=require(_0x031d('0xc'))(new Redis(config['redis']));function getAdminUser(_0x1e2491,_0x181531,_0x58775a,_0x591e7f,_0x99428b,_0x19c5fa){return new Promise(function(_0x150a7e,_0x1d0a3a){var _0x1c87ec={'method':_0x031d('0xd'),'uri':_0x591e7f+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x99428b+'&'+_0x19c5fa,'auth':_0x181531,'json':!![]};return rp(_0x1c87ec)[_0x031d('0xe')](function(_0x101d24){if(_0x101d24[_0x031d('0xf')][_0x031d('0x10')]>0x0){_0x58775a[_0x031d('0x11')]=_0x101d24[_0x031d('0xf')][0x0][_0x031d('0x12')];}logger['info']('['+[_0x1e2491['toUpperCase']()]+_0x031d('0x13'),_0x58775a);_0x150a7e(_0x58775a);})['catch'](function(_0x4062c8){logger[_0x031d('0x14')]('['+[_0x1e2491[_0x031d('0x15')]()]+']',_0x4062c8[_0x031d('0x16')]);_0x1d0a3a(_0x4062c8['message']);});});}function getUser(_0x560f1d,_0x5e7498,_0x84438e,_0x2a1159,_0x207b1d){return function(_0x1efb72){logger['info']('['+[_0x560f1d[_0x031d('0x15')]()]+_0x031d('0x17'),_0x1efb72);return new Promise(function(_0x1b4c17,_0x5c1a39){if(intUtil[_0x031d('0x18')](_0x1efb72[_0x031d('0x19')])){var _0x2b45f4={'method':_0x031d('0xd'),'uri':_0x84438e+_0x031d('0x1a')+_0x1efb72[_0x031d('0x19')]+'&'+_0x2a1159+'&'+_0x207b1d,'auth':_0x5e7498,'json':!![]};logger[_0x031d('0x1b')]('['+[_0x560f1d[_0x031d('0x15')]()]+_0x031d('0x1c'),_0x2b45f4);return rp(_0x2b45f4)['then'](function(_0x5e6d42){logger[_0x031d('0x1b')]('['+[_0x560f1d[_0x031d('0x15')]()]+_0x031d('0x1d'),_0x5e6d42);if(_0x5e6d42[_0x031d('0xf')][_0x031d('0x10')]>0x0&&String(_0x5e6d42[_0x031d('0xf')][0x0][_0x031d('0x1e')])==='true'){_0x1efb72[_0x031d('0x1f')]=_0x5e6d42[_0x031d('0xf')][0x0][_0x031d('0x12')];}else{_0x1efb72['userId']=_0x1efb72[_0x031d('0x11')];_0x1efb72[_0x031d('0x19')]=_0x1efb72['adminEmail'];}logger[_0x031d('0x1b')]('['+[_0x560f1d[_0x031d('0x15')]()]+_0x031d('0x20'),_0x1efb72);_0x1b4c17(_0x1efb72);})[_0x031d('0x21')](function(_0x520696){logger['error']('['+[_0x560f1d[_0x031d('0x15')]()]+']',_0x520696['message']);_0x5c1a39(_0x520696[_0x031d('0x16')]);});}else{logger[_0x031d('0x1b')]('['+[_0x560f1d['toUpperCase']()]+_0x031d('0x22'));_0x1efb72[_0x031d('0x1f')]=_0x1efb72['adminId'];_0x1efb72[_0x031d('0x19')]=_0x1efb72[_0x031d('0x23')];_0x1b4c17(_0x1efb72);}});};}function createEndUser(_0x156c51,_0x76fbd5,_0xb35154,_0x209270,_0x176f53){logger[_0x031d('0x1b')]('['+[_0x156c51['toUpperCase']()]+_0x031d('0x24'),_0xb35154);return new Promise(function(_0x13dd2b,_0x2666be){var _0x62aeb1={'method':_0x031d('0x25'),'uri':_0x209270+_0x031d('0x26')+_0x176f53,'body':{'user_name':_0xb35154['endUserNumber'],'roles':_0x031d('0x27'),'first_name':_0xb35154[_0x031d('0x28')],'active':'true','date_format':'System','phone':_0xb35154[_0x031d('0x28')]},'auth':_0x76fbd5,'json':!![]};return rp(_0x62aeb1)[_0x031d('0xe')](function(_0x255904){logger[_0x031d('0x1b')]('['+[_0x156c51['toUpperCase']()]+_0x031d('0x29'),_0x255904['result']);_0xb35154[_0x031d('0x2a')]=_0x255904[_0x031d('0xf')]['sys_id'];_0x13dd2b(_0xb35154);})[_0x031d('0x21')](function(_0x13bb7f){logger[_0x031d('0x14')]('['+[_0x156c51[_0x031d('0x15')]()]+']',_0x13bb7f[_0x031d('0x16')]);_0x2666be(_0x13bb7f[_0x031d('0x16')]);});});}function getEndUser(_0x5d09d7,_0x2146de,_0x31b107,_0x427ec9,_0x564304){return function(_0x8ce2d3){logger[_0x031d('0x1b')]('['+[_0x5d09d7[_0x031d('0x15')]()]+'],\x20getEndUser\x20input\x20crm',_0x8ce2d3);return new Promise(function(_0x179d1a,_0x5f3dca){var _0x266a60={'method':_0x031d('0xd'),'uri':_0x31b107+_0x031d('0x2b')+_0x8ce2d3[_0x031d('0x28')]+'&'+_0x427ec9+'&'+_0x564304,'auth':_0x2146de,'json':!![]};return rp(_0x266a60)[_0x031d('0xe')](function(_0x5697da){if(_0x5697da['result'][_0x031d('0x10')]>0x0){_0x8ce2d3[_0x031d('0x2a')]=_0x5697da[_0x031d('0xf')][0x0][_0x031d('0x12')];logger[_0x031d('0x1b')]('['+[_0x5d09d7[_0x031d('0x15')]()]+'],\x20getEndUser\x20crm',_0x8ce2d3);_0x179d1a(_0x8ce2d3);}else{return createEndUser(_0x5d09d7,_0x2146de,_0x8ce2d3,_0x31b107,_0x427ec9)[_0x031d('0xe')](function(_0x4847a5){logger[_0x031d('0x1b')]('['+[_0x5d09d7[_0x031d('0x15')]()]+_0x031d('0x2c'),_0x4847a5);_0x179d1a(_0x4847a5);});}})[_0x031d('0x21')](function(_0x23003f){logger[_0x031d('0x14')]('['+[_0x5d09d7[_0x031d('0x15')]()]+']',_0x23003f[_0x031d('0x16')]);_0x5f3dca(_0x23003f[_0x031d('0x16')]);});});};}function getCustomFields(_0x562eb4,_0xb3982a){var _0x23f5bd={};if(_0x562eb4[_0x031d('0x10')]>0x0){_[_0x031d('0x2d')](_0x562eb4,function(_0x4c87ca){if(_['includes']([_0x031d('0x2e'),_0x031d('0x2f')],_0x4c87ca[_0x031d('0x30')])&&_0x4c87ca[_0x031d('0x31')]&&!_0x4c87ca[_0x031d('0x32')]){_0x23f5bd[_0x4c87ca['nameField'][_0x031d('0x33')]()]=_0x4c87ca[_0x031d('0x34')][_0x031d('0x35')]();}else if(_[_0x031d('0x36')]([_0x031d('0x2e'),_0x031d('0x2f')],_0x4c87ca[_0x031d('0x30')])&&_0x4c87ca[_0x031d('0x37')]&&_0x4c87ca['customField']){_0x23f5bd[_0x4c87ca['idField']['toLowerCase']()]=_0x4c87ca[_0x031d('0x34')]['toString']();}else if(_0x4c87ca[_0x031d('0x30')]===_0x031d('0x38')&&_0x4c87ca[_0x031d('0x39')]&&_0x4c87ca[_0x031d('0x37')]&&_0x4c87ca['customField']){_0x23f5bd[_0x4c87ca[_0x031d('0x37')][_0x031d('0x33')]()]=_0xb3982a[_0x4c87ca[_0x031d('0x39')]][_0x031d('0x35')]();}else if(_0x4c87ca[_0x031d('0x30')]==='customVariable'&&_0x4c87ca[_0x031d('0x3a')]&&_0x4c87ca[_0x031d('0x3a')]['name']&&_0x4c87ca[_0x031d('0x37')]&&_0x4c87ca[_0x031d('0x32')]){_0x23f5bd[_0x4c87ca[_0x031d('0x37')][_0x031d('0x33')]()]=_0xb3982a[_0x4c87ca[_0x031d('0x3a')]['name'][_0x031d('0x33')]()][_0x031d('0x35')]();}});}return _0x23f5bd;}function getTicket(_0x53315b,_0x22906a,_0x2a51ec,_0x184fd0,_0x2fea91,_0x2b1e22){return function(_0x4d57d2){logger[_0x031d('0x1b')]('['+[_0x53315b[_0x031d('0x15')]()]+']\x20getTicket\x20input\x20crm',_0x4d57d2);return new Promise(function(_0x20eea8,_0x165666){var _0x469eb5=_0x53315b['toLowerCase']()===_0x031d('0x3b')?_0x4d57d2[_0x031d('0x1f')]:_0x4d57d2[_0x031d('0x2a')];var _0x48fb71={'method':_0x031d('0x25'),'uri':_0x2a51ec+'incident'+'?'+_0x2b1e22,'body':Object[_0x031d('0x3c')]({},{'active':_0x031d('0x3d'),'caller_id':_0x469eb5,'assigned_to':_0x4d57d2['userId'],'short_description':intUtil[_0x031d('0x3e')](_0x184fd0[_0x031d('0x3f')],_0x2fea91,'\x20'),'description':intUtil[_0x031d('0x3e')](_0x184fd0[_0x031d('0x40')],_0x2fea91,'\x0a')},getCustomFields(_0x184fd0[_0x031d('0x41')],_0x2fea91)),'auth':_0x22906a,'json':!![]};return rp(_0x48fb71)['then'](function(_0x503a54){logger[_0x031d('0x1b')]('['+[_0x53315b[_0x031d('0x15')]()]+_0x031d('0x42'),_0x503a54['result']);_0x4d57d2[_0x031d('0x43')]=_0x503a54['result'][_0x031d('0x12')];_0x4d57d2[_0x031d('0x44')]=_0x503a54[_0x031d('0xf')][_0x031d('0x45')];logger['info']('['+[_0x53315b['toUpperCase']()]+_0x031d('0x46'),_0x4d57d2);_0x20eea8(_0x4d57d2);})['catch'](function(_0x29bbab){logger[_0x031d('0x14')]('['+[_0x53315b['toUpperCase']()]+']',_0x29bbab[_0x031d('0x16')]);_0x165666(_0x29bbab[_0x031d('0x16')]);});});};}function createRemoteTag(_0x301992,_0x2bc2f9,_0x14f8cd,_0x3594a1){return new Promise(function(_0x107c6f,_0x15abf4){var _0x4e9963={'method':_0x031d('0x25'),'uri':_0x14f8cd+_0x031d('0x47')+'?'+_0x3594a1,'body':{'short_description':_0x301992,'global':!![],'active':!![],'name':_0x301992},'auth':_0x2bc2f9,'json':!![]};return rp(_0x4e9963)[_0x031d('0xe')](function(_0x2f9f75){var _0x3dbca9=_0x2f9f75[_0x031d('0xf')]['sys_id'];_0x107c6f(_0x3dbca9);});});}function getRemoteTag(_0x24ae08,_0xe3d9a,_0x393f5b,_0x5761d4,_0x1f8729){return new Promise(function(_0x1a360e,_0x1c4199){var _0x34edd8={'method':_0x031d('0xd'),'uri':_0x393f5b+'label'+_0x031d('0x48')+_0x24ae08+'&'+_0x5761d4,'auth':_0xe3d9a,'json':!![]};return rp(_0x34edd8)['then'](function(_0x179c96){if(_0x179c96['result'][_0x031d('0x10')]>0x0){var _0x3f8b5a=_0x179c96[_0x031d('0xf')][0x0][_0x031d('0x12')];_0x1a360e(_0x3f8b5a);}else{return createRemoteTag(_0x24ae08,_0xe3d9a,_0x393f5b,_0x5761d4)[_0x031d('0xe')](function(_0x1e6685){_0x1a360e(_0x1e6685);});}});});}function assignTagToIncident(_0x83023,_0x3606f6,_0x11d577,_0x5e1ba2,_0x4d0933){return new Promise(function(_0x3c2c04,_0xd961a7){var _0x2c3f6d={'method':_0x031d('0x25'),'uri':_0x11d577+'label_entry'+'?'+_0x4d0933,'body':{'label':_0x83023,'table':_0x031d('0x49'),'id_type':'Incident','table_key':_0x5e1ba2['ticketId'],'title':_0x031d('0x4a')+_0x5e1ba2['ticketNumber'],'id_display':_0x5e1ba2[_0x031d('0x44')]},'auth':_0x3606f6,'json':!![]};return rp(_0x2c3f6d)['then'](function(_0x33f2d9){_0x3c2c04();})[_0x031d('0x21')](function(){_0x3c2c04();});});}function manageTags(_0xa27804,_0x483904,_0xa7cc4a,_0x160e51,_0x15c4c9,_0x44a6bb,_0x3df18c){return new Promise(function(_0xc9436c,_0x4f2703){var _0x76dcb8=[];_0x483904[_0x031d('0x2d')](function(_0x5dab7f){_0x76dcb8[_0x031d('0x4b')](getRemoteTag(_0x5dab7f,_0xa7cc4a,_0x160e51,_0x44a6bb,_0x3df18c));});return Promise[_0x031d('0x4c')](_0x76dcb8)[_0x031d('0xe')](function(_0x36200b){if(_0x36200b[_0x031d('0x10')]){logger[_0x031d('0x1b')]('['+[_0xa27804['toUpperCase']()]+_0x031d('0x4d'),_0x36200b);var _0x5cd745=[];_0x36200b[_0x031d('0x2d')](function(_0x2429be){_0x5cd745[_0x031d('0x4b')](assignTagToIncident(_0x2429be,_0xa7cc4a,_0x160e51,_0x15c4c9,_0x44a6bb));});return Promise[_0x031d('0x4c')](_0x5cd745)[_0x031d('0xe')](function(){_0xc9436c();})[_0x031d('0x21')](function(){_0xc9436c();});}else{_0xc9436c();}});});}function getTags(_0x31a81a,_0x11ca16,_0x1745e0,_0x3d3a15,_0x14a869,_0x5666b1){return function(_0x1d1371){return new Promise(function(_0x43ef3d,_0x47e9ee){var _0x2ac6de=[];var _0x42deb2=_0x3d3a15[_0x031d('0x4e')];if(_0x42deb2&&_0x42deb2[_0x031d('0x10')]>0x0){_0x2ac6de=_[_0x031d('0x4f')](_0x42deb2,_0x031d('0x50'));}if(_0x2ac6de['length']>0x0){return manageTags(_0x31a81a,_0x2ac6de,_0x11ca16,_0x1745e0,_0x1d1371,_0x14a869,_0x5666b1)['then'](function(){_0x43ef3d(_0x1d1371);});}else{_0x43ef3d(_0x1d1371);}});};}function emit(_0x274219,_0x2725f6,_0x3899c2){var _0xe6c92c=_0x031d('0x51')+_0x031d('0x52')+_0x031d('0x53')+_0x031d('0x54');var _0x16862b={'uri':_0x274219+_0x031d('0x55')+_0x3899c2+_0xe6c92c};io['to'](util[_0x031d('0x56')](_0x031d('0x57'),_0x2725f6))[_0x031d('0x58')](_0x031d('0x59'),_0x16862b);}exports['cs']=function(_0x18b03c,_0x50cc31,_0x46bdd7,_0x296747,_0x314fee,_0x2b74da,_0x70f24b,_0x34fd03){var _0x1ccbf9={};var _0x4baefb={'user':_0x2b74da[_0x031d('0x5a')],'pass':_0x2b74da[_0x031d('0x5b')]};var _0x365b28=_0x031d('0x5c');var _0x34d9f6=_0x031d('0x5d');_0x2b74da[_0x031d('0x5e')]=intUtil['stripTrailingSlash'](_0x2b74da['remoteUri']);_0x2b74da[_0x031d('0x5f')]=intUtil[_0x031d('0x60')](_0x2b74da[_0x031d('0x5f')]);var _0x10697f=util[_0x031d('0x56')]('%s/api/now/table/',_0x2b74da[_0x031d('0x5e')]);_0x1ccbf9[_0x031d('0x19')]=!_[_0x031d('0x61')](_0x296747)?_0x296747[_0x031d('0x62')]:null;_0x1ccbf9['adminEmail']=_0x2b74da[_0x031d('0x62')];_0x1ccbf9[_0x031d('0x28')]=_0x34fd03['toLowerCase']()==='outbound'?_0x50cc31['destcalleridnum']:_0x50cc31[_0x031d('0x63')];_0x1ccbf9['callDirection']=_0x34fd03===_0x031d('0x64')||_0x34fd03===_0x031d('0x65')?'queue':_0x031d('0x3b');var _0x46dcdf=util[_0x031d('0x56')](_0x031d('0x66'),_0x2b74da['serverUrl'],_0x50cc31[_0x031d('0x67')],md5(_0x50cc31[_0x031d('0x67')]));if(_0x314fee&&_0x314fee['monitor_format']){logger[_0x031d('0x1b')](_0x031d('0x68'),'Recording\x20is\x20enabled!');_0x50cc31['recordingURL']=_0x46dcdf;}else if(_0x70f24b&&_0x70f24b[_0x031d('0x69')]&&_0x70f24b[_0x031d('0x69')]!==_0x031d('0x6a')){logger[_0x031d('0x1b')](_0x031d('0x6b'),'Recording\x20is\x20enabled!');_0x50cc31['recordingURL']=_0x46dcdf;}else{_0x50cc31[_0x031d('0x6c')]='';}return getAdminUser(_0x34fd03,_0x4baefb,_0x1ccbf9,_0x10697f,_0x34d9f6,_0x365b28)[_0x031d('0xe')](getUser(_0x34fd03,_0x4baefb,_0x10697f,_0x34d9f6,_0x365b28))[_0x031d('0xe')](getEndUser(_0x34fd03,_0x4baefb,_0x10697f,_0x34d9f6,_0x365b28))[_0x031d('0xe')](getTicket(_0x34fd03,_0x4baefb,_0x10697f,_0x46bdd7,_0x50cc31,_0x34d9f6))[_0x031d('0xe')](function(_0x3d1174){logger[_0x031d('0x1b')](util[_0x031d('0x56')](_0x031d('0x6d'),_0x3d1174[_0x031d('0x43')]));logger[_0x031d('0x1b')](util['format']('call\x20direction:\x20%s',_0x34fd03));if(_0x34fd03!==_0x031d('0x65')){logger[_0x031d('0x1b')]('['+[_0x34fd03[_0x031d('0x15')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2b74da[_0x031d('0x5e')],_0x296747[_0x031d('0x50')],_0x3d1174[_0x031d('0x43')]);}})[_0x031d('0x21')](function(_0x41cf22){logger[_0x031d('0x14')]('['+[_0x34fd03[_0x031d('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x031d('0x6e')](_0x41cf22,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xefe6=['outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','userEmail','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','string','picklist','nameField','customField','toLowerCase','includes','type','idField','content','toString','variable','variableName','customVariable','name',']\x20getTicket\x20input\x20crm'];(function(_0x2da1ef,_0x4c0fbd){var _0x5900a4=function(_0x51212c){while(--_0x51212c){_0x2da1ef['push'](_0x2da1ef['shift']());}};_0x5900a4(++_0x4c0fbd);}(_0xefe6,0x1ee));var _0x6efe=function(_0x49e66,_0x43f4b9){_0x49e66=_0x49e66-0x0;var _0x545549=_0xefe6[_0x49e66];return _0x545549;};'use strict';var _=require(_0x6efe('0x0'));var Promise=require(_0x6efe('0x1'));var rp=require(_0x6efe('0x2'));var util=require(_0x6efe('0x3'));var md5=require(_0x6efe('0x4'));var Redis=require(_0x6efe('0x5'));var intUtil=require('./util');var config=require(_0x6efe('0x6'));var logger=require(_0x6efe('0x7'))(_0x6efe('0x8'));config[_0x6efe('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6efe('0x9')]));function getAdminUser(_0x30f878,_0xe3f5b6,_0x3868b4,_0x1bdad1,_0x3cbcfb,_0x5271d9){return new Promise(function(_0x87167f,_0x341b9d){var _0x4047ed={'method':_0x6efe('0xa'),'uri':_0x1bdad1+_0x6efe('0xb')+'&'+_0x3cbcfb+'&'+_0x5271d9,'auth':_0xe3f5b6,'json':!![]};return rp(_0x4047ed)[_0x6efe('0xc')](function(_0x42a5f6){if(_0x42a5f6[_0x6efe('0xd')][_0x6efe('0xe')]>0x0){_0x3868b4[_0x6efe('0xf')]=_0x42a5f6[_0x6efe('0xd')][0x0][_0x6efe('0x10')];}logger[_0x6efe('0x11')]('['+[_0x30f878[_0x6efe('0x12')]()]+_0x6efe('0x13'),_0x3868b4);_0x87167f(_0x3868b4);})[_0x6efe('0x14')](function(_0x1c0d84){logger[_0x6efe('0x15')]('['+[_0x30f878[_0x6efe('0x12')]()]+']',_0x1c0d84[_0x6efe('0x16')]);_0x341b9d(_0x1c0d84['message']);});});}function getUser(_0x2b7ce6,_0x2c2298,_0x53246d,_0x557a2c,_0x1ce376){return function(_0x5c937c){logger[_0x6efe('0x11')]('['+[_0x2b7ce6[_0x6efe('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x5c937c);return new Promise(function(_0x336ce5,_0x235208){if(intUtil[_0x6efe('0x17')](_0x5c937c['userEmail'])){var _0x5525a4={'method':_0x6efe('0xa'),'uri':_0x53246d+'sys_user?sysparm_query=email%3D'+_0x5c937c['userEmail']+'&'+_0x557a2c+'&'+_0x1ce376,'auth':_0x2c2298,'json':!![]};logger['info']('['+[_0x2b7ce6[_0x6efe('0x12')]()]+_0x6efe('0x18'),_0x5525a4);return rp(_0x5525a4)[_0x6efe('0xc')](function(_0x48cf26){logger[_0x6efe('0x11')]('['+[_0x2b7ce6[_0x6efe('0x12')]()]+_0x6efe('0x19'),_0x48cf26);if(_0x48cf26[_0x6efe('0xd')][_0x6efe('0xe')]>0x0&&String(_0x48cf26['result'][0x0][_0x6efe('0x1a')])===_0x6efe('0x1b')){_0x5c937c[_0x6efe('0x1c')]=_0x48cf26[_0x6efe('0xd')][0x0]['sys_id'];}else{_0x5c937c['userId']=_0x5c937c[_0x6efe('0xf')];_0x5c937c[_0x6efe('0x1d')]=_0x5c937c[_0x6efe('0x1e')];}logger[_0x6efe('0x11')]('['+[_0x2b7ce6[_0x6efe('0x12')]()]+'],\x20getUser\x20crm',_0x5c937c);_0x336ce5(_0x5c937c);})[_0x6efe('0x14')](function(_0x117212){logger['error']('['+[_0x2b7ce6[_0x6efe('0x12')]()]+']',_0x117212[_0x6efe('0x16')]);_0x235208(_0x117212[_0x6efe('0x16')]);});}else{logger[_0x6efe('0x11')]('['+[_0x2b7ce6[_0x6efe('0x12')]()]+_0x6efe('0x1f'));_0x5c937c[_0x6efe('0x1c')]=_0x5c937c[_0x6efe('0xf')];_0x5c937c['userEmail']=_0x5c937c['adminEmail'];_0x336ce5(_0x5c937c);}});};}function createEndUser(_0x394f44,_0x534ec8,_0x240744,_0x4c5688,_0x3f979f){logger[_0x6efe('0x11')]('['+[_0x394f44['toUpperCase']()]+_0x6efe('0x20'),_0x240744);return new Promise(function(_0x19bbaf,_0x3923ff){var _0x3b408a={'method':_0x6efe('0x21'),'uri':_0x4c5688+_0x6efe('0x22')+_0x3f979f,'body':{'user_name':_0x240744[_0x6efe('0x23')],'roles':_0x6efe('0x24'),'first_name':_0x240744[_0x6efe('0x23')],'active':_0x6efe('0x1b'),'date_format':_0x6efe('0x25'),'phone':_0x240744[_0x6efe('0x23')]},'auth':_0x534ec8,'json':!![]};return rp(_0x3b408a)[_0x6efe('0xc')](function(_0x2db016){logger[_0x6efe('0x11')]('['+[_0x394f44['toUpperCase']()]+_0x6efe('0x26'),_0x2db016[_0x6efe('0xd')]);_0x240744['endUserId']=_0x2db016[_0x6efe('0xd')][_0x6efe('0x10')];_0x19bbaf(_0x240744);})[_0x6efe('0x14')](function(_0x30cdcc){logger[_0x6efe('0x15')]('['+[_0x394f44[_0x6efe('0x12')]()]+']',_0x30cdcc[_0x6efe('0x16')]);_0x3923ff(_0x30cdcc[_0x6efe('0x16')]);});});}function getEndUser(_0x266162,_0x269503,_0x16d10a,_0x1e8940,_0x4bb88c){return function(_0x4582ae){logger[_0x6efe('0x11')]('['+[_0x266162[_0x6efe('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0x4582ae);return new Promise(function(_0x179384,_0x52c936){var _0x7cb153={'method':_0x6efe('0xa'),'uri':_0x16d10a+_0x6efe('0x27')+_0x4582ae[_0x6efe('0x23')]+'&'+_0x1e8940+'&'+_0x4bb88c,'auth':_0x269503,'json':!![]};return rp(_0x7cb153)['then'](function(_0x415ed5){if(_0x415ed5[_0x6efe('0xd')][_0x6efe('0xe')]>0x0){_0x4582ae['endUserId']=_0x415ed5['result'][0x0]['sys_id'];logger['info']('['+[_0x266162[_0x6efe('0x12')]()]+'],\x20getEndUser\x20crm',_0x4582ae);_0x179384(_0x4582ae);}else{return createEndUser(_0x266162,_0x269503,_0x4582ae,_0x16d10a,_0x1e8940)[_0x6efe('0xc')](function(_0x4c1b0e){logger[_0x6efe('0x11')]('['+[_0x266162[_0x6efe('0x12')]()]+_0x6efe('0x28'),_0x4c1b0e);_0x179384(_0x4c1b0e);});}})[_0x6efe('0x14')](function(_0x44c6cf){logger['error']('['+[_0x266162[_0x6efe('0x12')]()]+']',_0x44c6cf[_0x6efe('0x16')]);_0x52c936(_0x44c6cf['message']);});});};}function getCustomFields(_0x4392ec,_0xc03688){var _0x368cdc={};if(_0x4392ec[_0x6efe('0xe')]>0x0){_['forEach'](_0x4392ec,function(_0x4b23e1){if(_['includes']([_0x6efe('0x29'),_0x6efe('0x2a')],_0x4b23e1['type'])&&_0x4b23e1[_0x6efe('0x2b')]&&!_0x4b23e1[_0x6efe('0x2c')]){_0x368cdc[_0x4b23e1['nameField'][_0x6efe('0x2d')]()]=_0x4b23e1['content']['toString']();}else if(_[_0x6efe('0x2e')]([_0x6efe('0x29'),_0x6efe('0x2a')],_0x4b23e1[_0x6efe('0x2f')])&&_0x4b23e1[_0x6efe('0x30')]&&_0x4b23e1[_0x6efe('0x2c')]){_0x368cdc[_0x4b23e1[_0x6efe('0x30')][_0x6efe('0x2d')]()]=_0x4b23e1[_0x6efe('0x31')][_0x6efe('0x32')]();}else if(_0x4b23e1[_0x6efe('0x2f')]===_0x6efe('0x33')&&_0x4b23e1[_0x6efe('0x34')]&&_0x4b23e1[_0x6efe('0x30')]&&_0x4b23e1[_0x6efe('0x2c')]){_0x368cdc[_0x4b23e1[_0x6efe('0x30')][_0x6efe('0x2d')]()]=_0xc03688[_0x4b23e1[_0x6efe('0x34')]][_0x6efe('0x32')]();}else if(_0x4b23e1[_0x6efe('0x2f')]===_0x6efe('0x35')&&_0x4b23e1['Variable']&&_0x4b23e1['Variable'][_0x6efe('0x36')]&&_0x4b23e1[_0x6efe('0x30')]&&_0x4b23e1[_0x6efe('0x2c')]){_0x368cdc[_0x4b23e1['idField'][_0x6efe('0x2d')]()]=_0xc03688[_0x4b23e1['Variable'][_0x6efe('0x36')]['toLowerCase']()]['toString']();}});}return _0x368cdc;}function getTicket(_0x24c882,_0x2fb73b,_0x2abdc9,_0x57bd93,_0x154988,_0x54d569){return function(_0x442b95){logger[_0x6efe('0x11')]('['+[_0x24c882['toUpperCase']()]+_0x6efe('0x37'),_0x442b95);return new Promise(function(_0x50a034,_0x57406a){var _0xb75949=_0x24c882['toLowerCase']()===_0x6efe('0x38')?_0x442b95[_0x6efe('0x1c')]:_0x442b95['endUserId'];var _0x1c406f={'method':'POST','uri':_0x2abdc9+_0x6efe('0x39')+'?'+_0x54d569,'body':Object[_0x6efe('0x3a')]({},{'active':'true','caller_id':_0xb75949,'assigned_to':_0x442b95[_0x6efe('0x1c')],'short_description':intUtil[_0x6efe('0x3b')](_0x57bd93[_0x6efe('0x3c')],_0x154988,'\x20'),'description':intUtil[_0x6efe('0x3b')](_0x57bd93['Descriptions'],_0x154988,'\x0a')},getCustomFields(_0x57bd93[_0x6efe('0x3d')],_0x154988)),'auth':_0x2fb73b,'json':!![]};return rp(_0x1c406f)[_0x6efe('0xc')](function(_0x50ffe4){logger['info']('['+[_0x24c882[_0x6efe('0x12')]()]+_0x6efe('0x3e'),_0x50ffe4[_0x6efe('0xd')]);_0x442b95[_0x6efe('0x3f')]=_0x50ffe4['result'][_0x6efe('0x10')];_0x442b95[_0x6efe('0x40')]=_0x50ffe4['result'][_0x6efe('0x41')];logger[_0x6efe('0x11')]('['+[_0x24c882[_0x6efe('0x12')]()]+_0x6efe('0x42'),_0x442b95);_0x50a034(_0x442b95);})[_0x6efe('0x14')](function(_0x147cb4){logger[_0x6efe('0x15')]('['+[_0x24c882[_0x6efe('0x12')]()]+']',_0x147cb4[_0x6efe('0x16')]);_0x57406a(_0x147cb4[_0x6efe('0x16')]);});});};}function createRemoteTag(_0xd91816,_0x46cc56,_0x282c70,_0x12ff7d){return new Promise(function(_0x334163,_0x2e3eea){var _0x43b1cb={'method':_0x6efe('0x21'),'uri':_0x282c70+_0x6efe('0x43')+'?'+_0x12ff7d,'body':{'short_description':_0xd91816,'global':!![],'active':!![],'name':_0xd91816},'auth':_0x46cc56,'json':!![]};return rp(_0x43b1cb)[_0x6efe('0xc')](function(_0x2ece4e){var _0x278a9d=_0x2ece4e[_0x6efe('0xd')][_0x6efe('0x10')];_0x334163(_0x278a9d);});});}function getRemoteTag(_0x51d745,_0x328dd9,_0x32899d,_0x4b1598,_0x23b02a){return new Promise(function(_0x39ce32,_0x3dad6f){var _0x19c4fc={'method':'GET','uri':_0x32899d+'label'+_0x6efe('0x44')+_0x51d745+'&'+_0x4b1598,'auth':_0x328dd9,'json':!![]};return rp(_0x19c4fc)['then'](function(_0x501456){if(_0x501456[_0x6efe('0xd')]['length']>0x0){var _0x729f27=_0x501456['result'][0x0][_0x6efe('0x10')];_0x39ce32(_0x729f27);}else{return createRemoteTag(_0x51d745,_0x328dd9,_0x32899d,_0x4b1598)[_0x6efe('0xc')](function(_0xe8d6d0){_0x39ce32(_0xe8d6d0);});}});});}function assignTagToIncident(_0x2a48fd,_0x7e563d,_0x4e6d30,_0x57490e,_0x66a6a2){return new Promise(function(_0x50ea38,_0x40e464){var _0x11198b={'method':'POST','uri':_0x4e6d30+_0x6efe('0x45')+'?'+_0x66a6a2,'body':{'label':_0x2a48fd,'table':_0x6efe('0x39'),'id_type':_0x6efe('0x46'),'table_key':_0x57490e[_0x6efe('0x3f')],'title':_0x6efe('0x47')+_0x57490e['ticketNumber'],'id_display':_0x57490e['ticketNumber']},'auth':_0x7e563d,'json':!![]};return rp(_0x11198b)[_0x6efe('0xc')](function(_0x12392e){_0x50ea38();})[_0x6efe('0x14')](function(){_0x50ea38();});});}function manageTags(_0x186f7e,_0x2b6426,_0x337c80,_0x5529ef,_0x462da,_0x1ce199,_0x52d934){return new Promise(function(_0x187c2c,_0x408d41){var _0x27d909=[];_0x2b6426[_0x6efe('0x48')](function(_0xdcd468){_0x27d909[_0x6efe('0x49')](getRemoteTag(_0xdcd468,_0x337c80,_0x5529ef,_0x1ce199,_0x52d934));});return Promise[_0x6efe('0x4a')](_0x27d909)[_0x6efe('0xc')](function(_0x1619f2){if(_0x1619f2[_0x6efe('0xe')]){logger[_0x6efe('0x11')]('['+[_0x186f7e[_0x6efe('0x12')]()]+_0x6efe('0x4b'),_0x1619f2);var _0x673c16=[];_0x1619f2[_0x6efe('0x48')](function(_0x24684e){_0x673c16['push'](assignTagToIncident(_0x24684e,_0x337c80,_0x5529ef,_0x462da,_0x1ce199));});return Promise[_0x6efe('0x4a')](_0x673c16)[_0x6efe('0xc')](function(){_0x187c2c();})[_0x6efe('0x14')](function(){_0x187c2c();});}else{_0x187c2c();}});});}function getTags(_0x534240,_0x3bc809,_0x41490b,_0x3c6731,_0x132d0f,_0x51e2ad){return function(_0x2752f){return new Promise(function(_0x14a6fa,_0xb7ae97){var _0x49c001=[];var _0x1d0617=_0x3c6731['Tags'];if(_0x1d0617&&_0x1d0617[_0x6efe('0xe')]>0x0){_0x49c001=_['map'](_0x1d0617,'name');}if(_0x49c001[_0x6efe('0xe')]>0x0){return manageTags(_0x534240,_0x49c001,_0x3bc809,_0x41490b,_0x2752f,_0x132d0f,_0x51e2ad)[_0x6efe('0xc')](function(){_0x14a6fa(_0x2752f);});}else{_0x14a6fa(_0x2752f);}});};}function emit(_0x3941ff,_0x3e58a8,_0xbd0da7){var _0x1ce4f9=_0x6efe('0x4c')+_0x6efe('0x4d')+_0x6efe('0x4e')+'%255EORDERBYDESCnumber';var _0x4c0a03={'uri':_0x3941ff+_0x6efe('0x4f')+_0xbd0da7+_0x1ce4f9};io['to'](util[_0x6efe('0x50')](_0x6efe('0x51'),_0x3e58a8))[_0x6efe('0x52')](_0x6efe('0x53'),_0x4c0a03);}exports['cs']=function(_0x42b777,_0x3078ce,_0x3e57c6,_0x44e316,_0x5ba317,_0x1a0245,_0x1ad9b3,_0x1dee51){var _0x251b1c={};var _0x39d089={'user':_0x1a0245[_0x6efe('0x54')],'pass':_0x1a0245[_0x6efe('0x55')]};var _0x20b49b=_0x6efe('0x56');var _0x3266b3=_0x6efe('0x57');_0x1a0245[_0x6efe('0x58')]=intUtil[_0x6efe('0x59')](_0x1a0245[_0x6efe('0x58')]);_0x1a0245[_0x6efe('0x5a')]=intUtil[_0x6efe('0x59')](_0x1a0245[_0x6efe('0x5a')]);var _0x4630e7=util[_0x6efe('0x50')](_0x6efe('0x5b'),_0x1a0245[_0x6efe('0x58')]);_0x251b1c[_0x6efe('0x1d')]=!_['isNil'](_0x44e316)?_0x44e316[_0x6efe('0x5c')]:null;_0x251b1c[_0x6efe('0x1e')]=_0x1a0245[_0x6efe('0x5c')];_0x251b1c[_0x6efe('0x23')]=_0x1dee51['toLowerCase']()===_0x6efe('0x38')?_0x3078ce[_0x6efe('0x5d')]:_0x3078ce[_0x6efe('0x5e')];_0x251b1c[_0x6efe('0x5f')]=_0x1dee51===_0x6efe('0x60')||_0x1dee51===_0x6efe('0x61')?_0x6efe('0x60'):_0x6efe('0x38');var _0x37253b=util[_0x6efe('0x50')](_0x6efe('0x62'),_0x1a0245['serverUrl'],_0x3078ce[_0x6efe('0x63')],md5(_0x3078ce[_0x6efe('0x63')]));if(_0x5ba317&&_0x5ba317[_0x6efe('0x64')]){logger[_0x6efe('0x11')](_0x6efe('0x65'),'Recording\x20is\x20enabled!');_0x3078ce[_0x6efe('0x66')]=_0x37253b;}else if(_0x1ad9b3&&_0x1ad9b3[_0x6efe('0x67')]&&_0x1ad9b3[_0x6efe('0x67')]!==_0x6efe('0x68')){logger[_0x6efe('0x11')]('[OUTBOUND]',_0x6efe('0x69'));_0x3078ce['recordingURL']=_0x37253b;}else{_0x3078ce[_0x6efe('0x66')]='';}return getAdminUser(_0x1dee51,_0x39d089,_0x251b1c,_0x4630e7,_0x3266b3,_0x20b49b)[_0x6efe('0xc')](getUser(_0x1dee51,_0x39d089,_0x4630e7,_0x3266b3,_0x20b49b))[_0x6efe('0xc')](getEndUser(_0x1dee51,_0x39d089,_0x4630e7,_0x3266b3,_0x20b49b))[_0x6efe('0xc')](getTicket(_0x1dee51,_0x39d089,_0x4630e7,_0x3e57c6,_0x3078ce,_0x3266b3))[_0x6efe('0xc')](function(_0x2d4ffb){logger[_0x6efe('0x11')](util[_0x6efe('0x50')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2d4ffb[_0x6efe('0x3f')]));logger[_0x6efe('0x11')](util[_0x6efe('0x50')](_0x6efe('0x6a'),_0x1dee51));if(_0x1dee51!=='unmanaged'){logger[_0x6efe('0x11')]('['+[_0x1dee51[_0x6efe('0x12')]()]+']',_0x6efe('0x6b'));emit(_0x1a0245[_0x6efe('0x58')],_0x44e316[_0x6efe('0x36')],_0x2d4ffb[_0x6efe('0x3f')]);}})[_0x6efe('0x14')](function(_0x5faf2c){logger[_0x6efe('0x15')]('['+[_0x1dee51[_0x6efe('0x12')]()]+_0x6efe('0x6c'),util[_0x6efe('0x6d')](_0x5faf2c,{'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 d195976..0e0027b 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 _0xeea2=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','catch','unmanaged','uri','toUpperCase','Inbound','error','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','stringify','format','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','toString','string','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0xd9a115,_0xf48e41){var _0x46de1f=function(_0x175223){while(--_0x175223){_0xd9a115['push'](_0xd9a115['shift']());}};_0x46de1f(++_0xf48e41);}(_0xeea2,0x112));var _0x2eea=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xeea2[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x2eea('0x0'));var rp=require(_0x2eea('0x1'));var BPromise=require(_0x2eea('0x2'));var md5=require(_0x2eea('0x3'));var util=require(_0x2eea('0x4'));var Redis=require(_0x2eea('0x5'));var intUtil=require(_0x2eea('0x6'));var config=require(_0x2eea('0x7'));var logger=require(_0x2eea('0x8'))(_0x2eea('0x9'));config[_0x2eea('0xa')]=_[_0x2eea('0xb')](config[_0x2eea('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x2eea('0xc'))(new Redis(config[_0x2eea('0xa')]));var def={'method':_0x2eea('0xd'),'json':!![]};function emit(_0x415201,_0x450484,_0x5b0c8d){io['to'](_0x415201)[_0x2eea('0xe')](_0x450484,_0x5b0c8d);}function getTicket(_0x109144,_0x46fe14,_0x10cf09,_0x4e9be4,_0xa60377,_0x956c1f,_0x42ece8,_0x5d79c6){logger[_0x2eea('0xf')](_0x2eea('0x10'));var _0x2636a8=new Date();var _0x402293=[{'name':_0x2eea('0x11'),'value':intUtil[_0x2eea('0x12')](_0x4e9be4['Subjects'],_0xa60377,'\x20')},{'name':_0x2eea('0x13'),'value':_0x46fe14['id']},{'name':_0x2eea('0x14'),'value':_0x46fe14['id']},{'name':_0x2eea('0x15'),'value':intUtil[_0x2eea('0x12')](_0x4e9be4[_0x2eea('0x16')],_0xa60377,'\x0a')},{'name':'date_start','value':_0x2636a8[_0x2eea('0x17')]()[_0x2eea('0x18')](0x0,0x13)[_0x2eea('0x19')]('T','\x20')},{'name':_0x2eea('0x1a'),'value':'0'},{'name':_0x2eea('0x1b'),'value':'15'},{'name':'parent_id','value':_0x10cf09['id']},{'name':'parent_type','value':_0x2eea('0x1c')},{'name':_0x2eea('0x1d'),'value':_0x10cf09[_0x2eea('0x11')]},{'name':_0x2eea('0x1e'),'value':_0x5d79c6}];if(_0x956c1f[_0x2eea('0x1f')]){_[_0x2eea('0x20')](_0x956c1f,function(_0xb14ede){if(_0xa60377[_0xb14ede[_0x2eea('0x21')]]){_0x402293[_0x2eea('0x22')]({'name':_0xb14ede[_0x2eea('0x23')],'value':_0xa60377[_0xb14ede[_0x2eea('0x21')]]});}});}return request({'form':{'method':_0x2eea('0x24'),'input_type':_0x2eea('0x25'),'response_type':_0x2eea('0x25'),'rest_data':JSON['stringify']({'session':_0x42ece8['id'],'module_name':'Calls','name_value_list':_0x402293})}});}function getAuth(_0x387e61){return util['format']('Basic\x20%s',new Buffer(_0x387e61[_0x2eea('0x26')]+':X')['toString'](_0x2eea('0x27')));}function getServerInfo(_0x30b9c5){return request({'form':{'method':_0x2eea('0x28'),'input_type':_0x2eea('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x30b9c5['id']})}});}function getUser(_0xa385fc,_0x3a3011,_0x243259){if(!_[_0x2eea('0x29')](_0x3a3011)){logger[_0x2eea('0xf')](_0x2eea('0x2a'),_0x3a3011);return request({'form':{'method':_0x2eea('0x2b'),'input_type':'JSON','response_type':_0x2eea('0x25'),'rest_data':JSON['stringify']({'session':_0x243259['id'],'module_name':'Employees','query':util['format'](_0x2eea('0x2c'),_0x3a3011),'order_by':'','offset':'0','select_fields':['id',_0x2eea('0x11'),_0x2eea('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2eea('0x2e')](function(_0x589050){if(_0x589050['entry_list']['length']){var _0x331506=_['find'](_0x589050[_0x2eea('0x2f')],function(_0x21d399){return _0x21d399[_0x2eea('0x30')][_0x2eea('0x2d')][_0x2eea('0x31')]===_0x3a3011;});if(_0x331506){logger[_0x2eea('0xf')](_0x2eea('0x32'));return BPromise[_0x2eea('0x33')]({'id':_0x331506[_0x2eea('0x30')]['id'][_0x2eea('0x31')],'name':_0x331506['name_value_list']['name']['value']});}}logger[_0x2eea('0xf')](_0x2eea('0x34'));return BPromise['resolve']({'id':_0x243259[_0x2eea('0x30')][_0x2eea('0x35')][_0x2eea('0x31')],'name':_0x243259[_0x2eea('0x30')]['user_name'][_0x2eea('0x31')]});});}else{logger['info'](_0x2eea('0x36'));return BPromise[_0x2eea('0x33')]({'id':_0x243259[_0x2eea('0x30')][_0x2eea('0x35')][_0x2eea('0x31')],'name':_0x243259[_0x2eea('0x30')][_0x2eea('0x2d')][_0x2eea('0x31')]});}}function getEndUser(_0x25cefe,_0x2ee04e,_0x56b4b4,_0x2eb5e6){logger[_0x2eea('0xf')]('Searching\x20enduser\x20with\x20phone',_0x56b4b4);return request({'form':{'method':_0x2eea('0x2b'),'input_type':_0x2eea('0x25'),'response_type':_0x2eea('0x25'),'rest_data':JSON[_0x2eea('0x37')]({'session':_0x2eb5e6['id'],'module_name':_0x2eea('0x1c'),'query':util[_0x2eea('0x38')](_0x2eea('0x39'),_0x56b4b4),'order_by':'','offset':'0','select_fields':['id','name',_0x2eea('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2eea('0x2e')](function(_0x4ca891){if(_0x4ca891[_0x2eea('0x2f')][_0x2eea('0x1f')]){var _0x17f379=_[_0x2eea('0x3b')](_0x4ca891[_0x2eea('0x2f')],function(_0x110e69){return _0x110e69['name_value_list'][_0x2eea('0x3a')][_0x2eea('0x31')]===_0x56b4b4;});if(_0x17f379){logger[_0x2eea('0xf')]('Enduser\x20found!');return BPromise[_0x2eea('0x33')]({'id':_0x17f379[_0x2eea('0x30')]['id']['value'],'name':_0x17f379[_0x2eea('0x30')]['name'][_0x2eea('0x31')],'phone':_0x17f379[_0x2eea('0x30')][_0x2eea('0x3a')][_0x2eea('0x31')]});}}else{logger['info'](_0x2eea('0x3c'));return request({'form':{'method':'set_entry','input_type':_0x2eea('0x25'),'response_type':_0x2eea('0x25'),'rest_data':JSON[_0x2eea('0x37')]({'session':_0x2eb5e6['id'],'module_name':_0x2eea('0x1c'),'name_value_list':[{'name':_0x2eea('0x3d'),'value':_0x2ee04e!==''?_0x2ee04e:util['format']('Caller\x20-\x20%s',_0x56b4b4)},{'name':_0x2eea('0x3a'),'value':_0x56b4b4}]})}})[_0x2eea('0x2e')](function(_0x18eba0){logger[_0x2eea('0xf')](_0x2eea('0x3e'));return BPromise[_0x2eea('0x33')]({'id':_0x18eba0['id'],'name':_0x18eba0[_0x2eea('0x2f')]['first_name'][_0x2eea('0x31')],'phone':_0x18eba0[_0x2eea('0x2f')][_0x2eea('0x3a')][_0x2eea('0x31')]});});}});}function request(_0x190edc){logger[_0x2eea('0x3f')](_0x2eea('0x40'),JSON[_0x2eea('0x37')](_0x190edc));return rp(_[_0x2eea('0x41')](def,_0x190edc));}function getTags(_0x3ebdc0,_0x3c3712){var _0x171693=[];if(_0x3ebdc0&&_0x3ebdc0[_0x2eea('0x1f')]>0x0){_0x171693=_[_0x2eea('0x42')](_0x3ebdc0,_0x3c3712);}return _0x171693;}function getCustomFields(_0xb3dd68,_0x1c71d8){var _0x406525=[];var _0x2f9c33={'custom_fields':[]};if(_0xb3dd68['length']>0x0){_[_0x2eea('0x20')](_0xb3dd68,function(_0x1c0a9d){if(_0x1c0a9d[_0x2eea('0x43')]==='string'&&_0x1c0a9d[_0x2eea('0x44')]&&!_0x1c0a9d[_0x2eea('0x45')]){_0x2f9c33[_0x1c0a9d[_0x2eea('0x44')][_0x2eea('0x46')]()]=_0x1c0a9d['content'][_0x2eea('0x47')]();}else if(_0x1c0a9d[_0x2eea('0x43')]===_0x2eea('0x48')&&_0x1c0a9d[_0x2eea('0x23')]&&_0x1c0a9d[_0x2eea('0x45')]){_0x2f9c33[_0x2eea('0x49')][_0x2eea('0x22')]({'id':_0x1c0a9d['idField'],'value':_0x1c0a9d[_0x2eea('0x4a')][_0x2eea('0x47')]()});}else if(_0x1c0a9d['type']===_0x2eea('0x4b')&&_0x1c0a9d['variableName']&&_0x1c0a9d['idField']&&_0x1c0a9d[_0x2eea('0x45')]){_0x1c71d8[_0x1c0a9d['variableName']]&&_0x2f9c33[_0x2eea('0x49')][_0x2eea('0x22')]({'id':_0x1c0a9d[_0x2eea('0x23')],'value':_0x1c71d8[_0x1c0a9d['variableName']][_0x2eea('0x47')]()});}else if(_0x1c0a9d[_0x2eea('0x43')]===_0x2eea('0x4c')&&_0x1c0a9d['Variable']&&_0x1c0a9d[_0x2eea('0x4d')]['name']&&_0x1c0a9d[_0x2eea('0x23')]&&_0x1c0a9d[_0x2eea('0x45')]){_0x1c71d8[_0x1c0a9d[_0x2eea('0x4d')]['name']['toLowerCase']()]&&_0x2f9c33['custom_fields'][_0x2eea('0x22')]({'id':_0x1c0a9d[_0x2eea('0x23')],'value':_0x1c71d8[_0x1c0a9d[_0x2eea('0x4d')][_0x2eea('0x11')]['toLowerCase']()][_0x2eea('0x47')]()});}});}return _0x2f9c33;}function getConnection(_0x3de904){return request({'method':'POST','form':{'method':_0x2eea('0x4e'),'input_type':'JSON','response_type':_0x2eea('0x25'),'rest_data':JSON[_0x2eea('0x37')]({'user_auth':{'user_name':_0x3de904[_0x2eea('0x4f')],'password':_0x3de904[_0x2eea('0x50')],'encryption':_0x2eea('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x14175f){var _0xefd3=_0x14175f;if(_0xefd3['id']){def['sessionID']=_0xefd3['id'];return BPromise[_0x2eea('0x33')](_0xefd3);}else{throw new Error(util['format'](_0x2eea('0x52'),_0x3de904['id']));}});}function setRelationship(_0x187d4f,_0x521b77,_0x5b0966,_0x267400){return request({'form':{'method':_0x2eea('0x53'),'input_type':_0x2eea('0x25'),'response_type':_0x2eea('0x25'),'rest_data':JSON['stringify']({'session':_0x187d4f['id'],'module_name':'Calls','module_id':_0x5b0966['id'],'link_field_name':_0x267400,'related_ids':[_0x521b77['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x2eea('0x54')]=function(_0x88bed3,_0x3fbb05,_0x10b9ca,_0x2174dc,_0x388719,_0x4aca5e){var _0x189520,_0x1da231,_0xab9161,_0x2d4b76;_0x4aca5e[_0x2eea('0x55')]=intUtil[_0x2eea('0x56')](_0x4aca5e['remoteUri']);_0x4aca5e['serverUrl']=intUtil[_0x2eea('0x56')](_0x4aca5e[_0x2eea('0x57')]);def['uri']=util[_0x2eea('0x38')](_0x2eea('0x58'),_0x4aca5e[_0x2eea('0x55')]);if(_0x388719&&_0x388719[_0x2eea('0x59')]){logger[_0x2eea('0xf')](_0x2eea('0x5a'),_0x2eea('0x5b'));_0x3fbb05[_0x2eea('0x5c')]=util['format'](_0x2eea('0x5d'),_0x4aca5e[_0x2eea('0x57')],_0x3fbb05['uniqueid'],md5(_0x3fbb05[_0x2eea('0x5e')]));}else{_0x3fbb05[_0x2eea('0x5c')]='';}return getConnection(_0x4aca5e)[_0x2eea('0x2e')](function(_0xf739ad){_0x2d4b76=_0xf739ad;return getUser(_0x4aca5e,_0x2174dc['name'],_0x2d4b76);})[_0x2eea('0x2e')](function(_0x2af96e){_0x189520=_0x2af96e;logger[_0x2eea('0xf')]('The\x20User\x20ID\x20is:',_0x189520['id']);return getEndUser(_0x4aca5e,_0x3fbb05[_0x2eea('0x5f')],_0x3fbb05[_0x2eea('0x60')],_0x2d4b76);})[_0x2eea('0x2e')](function(_0x4e1f6f){_0x1da231=_0x4e1f6f;logger[_0x2eea('0xf')](_0x2eea('0x61'),_0x1da231['id']);return getTicket(_0x4aca5e,_0x189520,_0x1da231,_0x10b9ca,_0x3fbb05,_0x10b9ca[_0x2eea('0x62')],_0x2d4b76,'Inbound');})[_0x2eea('0x2e')](function(_0x572dd4){_0xab9161=_0x572dd4;logger[_0x2eea('0xf')](_0x2eea('0x63'));logger[_0x2eea('0xf')]('The\x20Ticket\x20ID\x20is:',_0xab9161['id']);return setRelationship(_0x2d4b76,_0x189520,_0xab9161,_0x2eea('0x64'));})[_0x2eea('0x2e')](function(){return setRelationship(_0x2d4b76,_0x1da231,_0xab9161,_0x2eea('0x65'));})[_0x2eea('0x2e')](function(){return getServerInfo(_0x2d4b76);})['then'](function(_0x1707fe){var _0x7433b8=parseInt(_0x1707fe['version'][_0x2eea('0x66')](0x0));var _0x140bda=util[_0x2eea('0x38')](_0x2eea('0x67'),_0x4aca5e[_0x2eea('0x55')],_0xab9161['id']);if(_0x7433b8>0x6){_0x140bda=util[_0x2eea('0x38')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4aca5e[_0x2eea('0x55')],_0xab9161['id']);}logger[_0x2eea('0xf')]('[QUEUE]',_0x2eea('0x68'));emit(util[_0x2eea('0x38')](_0x2eea('0x69'),_0x2174dc['name']),_0x2eea('0x6a'),{'uri':_0x140bda});})['catch'](function(_0x3ac1df){logger['error'](_0x2eea('0x5a'),JSON[_0x2eea('0x37')](_0x3ac1df));});};exports[_0x2eea('0x6b')]=function(_0x418b96,_0x461a40,_0x576da0,_0x461e1f,_0x8ca2ff,_0x5d5eea,_0x4870f0){var _0x352f7a,_0x42f09a,_0x184378,_0x13fd2f;_0x5d5eea[_0x2eea('0x55')]=intUtil[_0x2eea('0x56')](_0x5d5eea['remoteUri']);_0x5d5eea[_0x2eea('0x57')]=intUtil[_0x2eea('0x56')](_0x5d5eea[_0x2eea('0x57')]);def['uri']=util[_0x2eea('0x38')](_0x2eea('0x58'),_0x5d5eea[_0x2eea('0x55')]);if(_0x4870f0&&_0x4870f0[_0x2eea('0x6c')]&&_0x4870f0['recordingFormat']!==_0x2eea('0x6d')){logger[_0x2eea('0xf')]('[OUTBOUND]',_0x2eea('0x5b'));_0x461a40['recordingURL']=util[_0x2eea('0x38')](_0x2eea('0x5d'),_0x5d5eea[_0x2eea('0x57')],_0x461a40[_0x2eea('0x5e')],md5(_0x461a40[_0x2eea('0x5e')]));}return getConnection(_0x5d5eea)[_0x2eea('0x2e')](function(_0x4871b9){_0x13fd2f=_0x4871b9;return getUser(_0x5d5eea,_0x461e1f[_0x2eea('0x11')],_0x13fd2f);})['then'](function(_0x182b96){_0x352f7a=_0x182b96;logger[_0x2eea('0xf')](_0x2eea('0x6e'),_0x352f7a['id']);return getEndUser(_0x5d5eea,_0x461a40['destcalleridname'],_0x461a40['destcalleridnum'],_0x13fd2f);})['then'](function(_0x17cf17){_0x42f09a=_0x17cf17;logger['info'](_0x2eea('0x61'),_0x42f09a['id']);return getTicket(_0x5d5eea,_0x352f7a,_0x42f09a,_0x576da0,_0x461a40,_0x576da0[_0x2eea('0x62')],_0x13fd2f,_0x2eea('0x6f'));})[_0x2eea('0x2e')](function(_0x51acde){_0x184378=_0x51acde;logger['info'](_0x2eea('0x63'));logger[_0x2eea('0xf')](_0x2eea('0x70'),_0x184378['id']);return setRelationship(_0x13fd2f,_0x352f7a,_0x184378,_0x2eea('0x64'));})['then'](function(){return setRelationship(_0x13fd2f,_0x42f09a,_0x184378,_0x2eea('0x65'));})[_0x2eea('0x2e')](function(){return getServerInfo(_0x13fd2f);})[_0x2eea('0x2e')](function(_0x9d9927){var _0x309837=parseInt(_0x9d9927[_0x2eea('0x71')]['charAt'](0x0));var _0x50334b=util[_0x2eea('0x38')](_0x2eea('0x67'),_0x5d5eea[_0x2eea('0x55')],_0x184378['id']);if(_0x309837>0x6){_0x50334b=util[_0x2eea('0x38')](_0x2eea('0x72'),_0x5d5eea[_0x2eea('0x55')],_0x184378['id']);}logger[_0x2eea('0xf')](_0x2eea('0x73'),_0x2eea('0x68'));emit(util[_0x2eea('0x38')]('user:%s',_0x461e1f[_0x2eea('0x11')]),_0x2eea('0x6a'),{'uri':_0x50334b});})[_0x2eea('0x74')](function(_0x1ac7d0){logger['error'](_0x2eea('0x73'),JSON[_0x2eea('0x37')](_0x1ac7d0));});};exports[_0x2eea('0x75')]=function(_0x5e1371,_0x74ab7b,_0x359d33,_0x1ccb4b,_0x1fb75f,_0x4afb95){var _0x31e43c,_0x3fb9b8,_0x45c396,_0x2e9218;_0x4afb95[_0x2eea('0x55')]=intUtil['stripTrailingSlash'](_0x4afb95[_0x2eea('0x55')]);_0x4afb95[_0x2eea('0x57')]=intUtil['stripTrailingSlash'](_0x4afb95['serverUrl']);def[_0x2eea('0x76')]=util[_0x2eea('0x38')](_0x2eea('0x58'),_0x4afb95[_0x2eea('0x55')]);if(_0x1fb75f&&_0x1fb75f['monitor_format']){logger[_0x2eea('0xf')]('['+_0x74ab7b['lastevent'][_0x2eea('0x77')]()+']','Recording\x20is\x20enabled!');_0x74ab7b[_0x2eea('0x5c')]=util[_0x2eea('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4afb95[_0x2eea('0x57')],_0x74ab7b[_0x2eea('0x5e')],md5(_0x74ab7b['uniqueid']));}else{_0x74ab7b['recordingURL']='';}return getConnection(_0x4afb95)[_0x2eea('0x2e')](function(_0x3da58c){_0x2e9218=_0x3da58c;if(!_[_0x2eea('0x29')](_0x1ccb4b)){return getUser(_0x4afb95,_0x1ccb4b['name'],_0x2e9218);}else{return getUser(_0x4afb95,null,_0x2e9218);}})[_0x2eea('0x2e')](function(_0x139f0d){_0x31e43c=_0x139f0d;logger[_0x2eea('0xf')](_0x2eea('0x6e'),_0x31e43c['id']);return getEndUser(_0x4afb95,_0x74ab7b[_0x2eea('0x5f')],_0x74ab7b['calleridnum'],_0x2e9218);})['then'](function(_0x427112){_0x3fb9b8=_0x427112;logger[_0x2eea('0xf')]('The\x20Enduser\x20ID\x20is:',_0x3fb9b8['id']);return getTicket(_0x4afb95,_0x31e43c,_0x3fb9b8,_0x359d33,_0x74ab7b,_0x359d33[_0x2eea('0x62')],_0x2e9218,_0x2eea('0x78'));})[_0x2eea('0x2e')](function(_0x4164ce){_0x45c396=_0x4164ce;logger['info'](_0x2eea('0x63'));logger[_0x2eea('0xf')](_0x2eea('0x70'),_0x45c396['id']);return setRelationship(_0x2e9218,_0x31e43c,_0x45c396,_0x2eea('0x64'));})[_0x2eea('0x2e')](function(){return setRelationship(_0x2e9218,_0x3fb9b8,_0x45c396,_0x2eea('0x65'));})[_0x2eea('0x2e')](function(){return getServerInfo(_0x2e9218);})[_0x2eea('0x74')](function(_0x2b890b){logger[_0x2eea('0x79')]('['+_0x74ab7b[_0x2eea('0x7a')][_0x2eea('0x77')]()+']',JSON[_0x2eea('0x37')](_0x2b890b));});}; \ No newline at end of file +var _0xd394=['Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','resolve','name_value_list','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!','set_entry','first_name','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','variable','customVariable','Variable','POST','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','error','unmanaged','%s/service/v4_1/rest.php','monitor_format','lastevent','calleridname','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','emit','info','name','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','length','forEach','push','idField','variableName','JSON','stringify','Calls','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd394,0x13c));var _0x4d39=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd394[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4d39('0x0'));var rp=require(_0x4d39('0x1'));var BPromise=require(_0x4d39('0x2'));var md5=require(_0x4d39('0x3'));var util=require(_0x4d39('0x4'));var Redis=require(_0x4d39('0x5'));var intUtil=require('./util');var config=require(_0x4d39('0x6'));var logger=require(_0x4d39('0x7'))(_0x4d39('0x8'));config[_0x4d39('0x9')]=_['defaults'](config[_0x4d39('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4d39('0xa'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x4f9e3b,_0x44c252,_0x4b3cb8){io['to'](_0x4f9e3b)[_0x4d39('0xb')](_0x44c252,_0x4b3cb8);}function getTicket(_0x5f4e0d,_0x2a59b6,_0x233552,_0x2f651e,_0x1795d7,_0x1fe817,_0x1792b9,_0x49a2cd){logger[_0x4d39('0xc')]('Creating\x20new\x20ticket...');var _0x415fc1=new Date();var _0x5137d6=[{'name':_0x4d39('0xd'),'value':intUtil['getString'](_0x2f651e['Subjects'],_0x1795d7,'\x20')},{'name':_0x4d39('0xe'),'value':_0x2a59b6['id']},{'name':_0x4d39('0xf'),'value':_0x2a59b6['id']},{'name':_0x4d39('0x10'),'value':intUtil['getString'](_0x2f651e[_0x4d39('0x11')],_0x1795d7,'\x0a')},{'name':_0x4d39('0x12'),'value':_0x415fc1[_0x4d39('0x13')]()[_0x4d39('0x14')](0x0,0x13)[_0x4d39('0x15')]('T','\x20')},{'name':_0x4d39('0x16'),'value':'0'},{'name':_0x4d39('0x17'),'value':'15'},{'name':_0x4d39('0x18'),'value':_0x233552['id']},{'name':'parent_type','value':_0x4d39('0x19')},{'name':'parent_name','value':_0x233552[_0x4d39('0xd')]},{'name':'direction','value':_0x49a2cd}];if(_0x1fe817[_0x4d39('0x1a')]){_[_0x4d39('0x1b')](_0x1fe817,function(_0x5e04ed){if(_0x1795d7[_0x5e04ed['variableName']]){_0x5137d6[_0x4d39('0x1c')]({'name':_0x5e04ed[_0x4d39('0x1d')],'value':_0x1795d7[_0x5e04ed[_0x4d39('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x4d39('0x1f'),'rest_data':JSON[_0x4d39('0x20')]({'session':_0x1792b9['id'],'module_name':_0x4d39('0x21'),'name_value_list':_0x5137d6})}});}function getAuth(_0x4c8982){return util[_0x4d39('0x22')](_0x4d39('0x23'),new Buffer(_0x4c8982[_0x4d39('0x24')]+':X')[_0x4d39('0x25')](_0x4d39('0x26')));}function getServerInfo(_0x2f20ca){return request({'form':{'method':_0x4d39('0x27'),'input_type':_0x4d39('0x1f'),'response_type':_0x4d39('0x1f'),'rest_data':JSON['stringify']({'session':_0x2f20ca['id']})}});}function getUser(_0x24e8f4,_0x1b8b11,_0xe9bc60){if(!_[_0x4d39('0x28')](_0x1b8b11)){logger['info'](_0x4d39('0x29'),_0x1b8b11);return request({'form':{'method':'get_entry_list','input_type':_0x4d39('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xe9bc60['id'],'module_name':'Employees','query':util[_0x4d39('0x22')](_0x4d39('0x2a'),_0x1b8b11),'order_by':'','offset':'0','select_fields':['id',_0x4d39('0xd'),_0x4d39('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4d39('0x2c')](function(_0x1130aa){if(_0x1130aa[_0x4d39('0x2d')][_0x4d39('0x1a')]){var _0x47cb3a=_[_0x4d39('0x2e')](_0x1130aa[_0x4d39('0x2d')],function(_0x274424){return _0x274424['name_value_list'][_0x4d39('0x2b')][_0x4d39('0x2f')]===_0x1b8b11;});if(_0x47cb3a){logger[_0x4d39('0xc')]('Agent\x20found!');return BPromise[_0x4d39('0x30')]({'id':_0x47cb3a[_0x4d39('0x31')]['id'][_0x4d39('0x2f')],'name':_0x47cb3a['name_value_list'][_0x4d39('0xd')]['value']});}}logger[_0x4d39('0xc')](_0x4d39('0x32'));return BPromise[_0x4d39('0x30')]({'id':_0xe9bc60[_0x4d39('0x31')][_0x4d39('0x33')][_0x4d39('0x2f')],'name':_0xe9bc60[_0x4d39('0x31')][_0x4d39('0x2b')][_0x4d39('0x2f')]});});}else{logger[_0x4d39('0xc')](_0x4d39('0x34'));return BPromise[_0x4d39('0x30')]({'id':_0xe9bc60[_0x4d39('0x31')][_0x4d39('0x33')][_0x4d39('0x2f')],'name':_0xe9bc60[_0x4d39('0x31')][_0x4d39('0x2b')][_0x4d39('0x2f')]});}}function getEndUser(_0xfa3a92,_0x3cee39,_0x5ca869,_0xe62c9e){logger[_0x4d39('0xc')](_0x4d39('0x35'),_0x5ca869);return request({'form':{'method':'get_entry_list','input_type':_0x4d39('0x1f'),'response_type':_0x4d39('0x1f'),'rest_data':JSON['stringify']({'session':_0xe62c9e['id'],'module_name':_0x4d39('0x19'),'query':util[_0x4d39('0x22')](_0x4d39('0x36'),_0x5ca869),'order_by':'','offset':'0','select_fields':['id',_0x4d39('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2f11b0){if(_0x2f11b0[_0x4d39('0x2d')][_0x4d39('0x1a')]){var _0x15769c=_[_0x4d39('0x2e')](_0x2f11b0[_0x4d39('0x2d')],function(_0x542a28){return _0x542a28[_0x4d39('0x31')][_0x4d39('0x37')][_0x4d39('0x2f')]===_0x5ca869;});if(_0x15769c){logger[_0x4d39('0xc')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x15769c[_0x4d39('0x31')]['id'][_0x4d39('0x2f')],'name':_0x15769c[_0x4d39('0x31')][_0x4d39('0xd')][_0x4d39('0x2f')],'phone':_0x15769c[_0x4d39('0x31')][_0x4d39('0x37')][_0x4d39('0x2f')]});}}else{logger[_0x4d39('0xc')](_0x4d39('0x38'));return request({'form':{'method':_0x4d39('0x39'),'input_type':_0x4d39('0x1f'),'response_type':'JSON','rest_data':JSON[_0x4d39('0x20')]({'session':_0xe62c9e['id'],'module_name':_0x4d39('0x19'),'name_value_list':[{'name':_0x4d39('0x3a'),'value':_0x3cee39!==''?_0x3cee39:util['format']('Caller\x20-\x20%s',_0x5ca869)},{'name':'phone_home','value':_0x5ca869}]})}})['then'](function(_0x35abdc){logger[_0x4d39('0xc')](_0x4d39('0x3b'));return BPromise[_0x4d39('0x30')]({'id':_0x35abdc['id'],'name':_0x35abdc[_0x4d39('0x2d')][_0x4d39('0x3a')][_0x4d39('0x2f')],'phone':_0x35abdc[_0x4d39('0x2d')][_0x4d39('0x37')][_0x4d39('0x2f')]});});}});}function request(_0x48a78d){logger[_0x4d39('0x3c')](_0x4d39('0x3d'),JSON[_0x4d39('0x20')](_0x48a78d));return rp(_[_0x4d39('0x3e')](def,_0x48a78d));}function getTags(_0x2e369e,_0x2f91a7){var _0x5559e8=[];if(_0x2e369e&&_0x2e369e[_0x4d39('0x1a')]>0x0){_0x5559e8=_[_0x4d39('0x3f')](_0x2e369e,_0x2f91a7);}return _0x5559e8;}function getCustomFields(_0xd7b4b2,_0x5410af){var _0x5a3f70=[];var _0x5daa07={'custom_fields':[]};if(_0xd7b4b2[_0x4d39('0x1a')]>0x0){_[_0x4d39('0x1b')](_0xd7b4b2,function(_0x2ff027){if(_0x2ff027[_0x4d39('0x40')]===_0x4d39('0x41')&&_0x2ff027[_0x4d39('0x42')]&&!_0x2ff027[_0x4d39('0x43')]){_0x5daa07[_0x2ff027['nameField'][_0x4d39('0x44')]()]=_0x2ff027['content']['toString']();}else if(_0x2ff027[_0x4d39('0x40')]===_0x4d39('0x41')&&_0x2ff027[_0x4d39('0x1d')]&&_0x2ff027[_0x4d39('0x43')]){_0x5daa07[_0x4d39('0x45')][_0x4d39('0x1c')]({'id':_0x2ff027[_0x4d39('0x1d')],'value':_0x2ff027['content'][_0x4d39('0x25')]()});}else if(_0x2ff027[_0x4d39('0x40')]===_0x4d39('0x46')&&_0x2ff027[_0x4d39('0x1e')]&&_0x2ff027[_0x4d39('0x1d')]&&_0x2ff027[_0x4d39('0x43')]){_0x5410af[_0x2ff027[_0x4d39('0x1e')]]&&_0x5daa07[_0x4d39('0x45')][_0x4d39('0x1c')]({'id':_0x2ff027['idField'],'value':_0x5410af[_0x2ff027[_0x4d39('0x1e')]][_0x4d39('0x25')]()});}else if(_0x2ff027[_0x4d39('0x40')]===_0x4d39('0x47')&&_0x2ff027[_0x4d39('0x48')]&&_0x2ff027['Variable'][_0x4d39('0xd')]&&_0x2ff027[_0x4d39('0x1d')]&&_0x2ff027[_0x4d39('0x43')]){_0x5410af[_0x2ff027[_0x4d39('0x48')]['name']['toLowerCase']()]&&_0x5daa07[_0x4d39('0x45')][_0x4d39('0x1c')]({'id':_0x2ff027[_0x4d39('0x1d')],'value':_0x5410af[_0x2ff027[_0x4d39('0x48')][_0x4d39('0xd')]['toLowerCase']()][_0x4d39('0x25')]()});}});}return _0x5daa07;}function getConnection(_0x317c81){return request({'method':_0x4d39('0x49'),'form':{'method':_0x4d39('0x4a'),'input_type':_0x4d39('0x1f'),'response_type':_0x4d39('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x317c81[_0x4d39('0x4b')],'password':_0x317c81[_0x4d39('0x4c')],'encryption':_0x4d39('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4d39('0x2c')](function(_0x513c40){var _0x3fd77c=_0x513c40;if(_0x3fd77c['id']){def[_0x4d39('0x4e')]=_0x3fd77c['id'];return BPromise[_0x4d39('0x30')](_0x3fd77c);}else{throw new Error(util[_0x4d39('0x22')](_0x4d39('0x4f'),_0x317c81['id']));}});}function setRelationship(_0x41f7b1,_0x5b8ba8,_0x41734b,_0x4404e4){return request({'form':{'method':_0x4d39('0x50'),'input_type':'JSON','response_type':_0x4d39('0x1f'),'rest_data':JSON['stringify']({'session':_0x41f7b1['id'],'module_name':'Calls','module_id':_0x41734b['id'],'link_field_name':_0x4404e4,'related_ids':[_0x5b8ba8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4d39('0x51')]=function(_0x658ba0,_0x387ac2,_0x43a922,_0x5c555d,_0x108217,_0x4fb635){var _0x479158,_0x207580,_0x2e718,_0x1ec5bb;_0x4fb635['remoteUri']=intUtil[_0x4d39('0x52')](_0x4fb635[_0x4d39('0x53')]);_0x4fb635[_0x4d39('0x54')]=intUtil['stripTrailingSlash'](_0x4fb635[_0x4d39('0x54')]);def[_0x4d39('0x55')]=util['format']('%s/service/v4_1/rest.php',_0x4fb635['remoteUri']);if(_0x108217&&_0x108217['monitor_format']){logger[_0x4d39('0xc')](_0x4d39('0x56'),_0x4d39('0x57'));_0x387ac2[_0x4d39('0x58')]=util[_0x4d39('0x22')](_0x4d39('0x59'),_0x4fb635['serverUrl'],_0x387ac2[_0x4d39('0x5a')],md5(_0x387ac2[_0x4d39('0x5a')]));}else{_0x387ac2['recordingURL']='';}return getConnection(_0x4fb635)[_0x4d39('0x2c')](function(_0x51bbb1){_0x1ec5bb=_0x51bbb1;return getUser(_0x4fb635,_0x5c555d[_0x4d39('0xd')],_0x1ec5bb);})[_0x4d39('0x2c')](function(_0x5d26da){_0x479158=_0x5d26da;logger[_0x4d39('0xc')](_0x4d39('0x5b'),_0x479158['id']);return getEndUser(_0x4fb635,_0x387ac2['calleridname'],_0x387ac2[_0x4d39('0x5c')],_0x1ec5bb);})[_0x4d39('0x2c')](function(_0x299f66){_0x207580=_0x299f66;logger[_0x4d39('0xc')]('The\x20Enduser\x20ID\x20is:',_0x207580['id']);return getTicket(_0x4fb635,_0x479158,_0x207580,_0x43a922,_0x387ac2,_0x43a922[_0x4d39('0x5d')],_0x1ec5bb,'Inbound');})[_0x4d39('0x2c')](function(_0xdb35c6){_0x2e718=_0xdb35c6;logger[_0x4d39('0xc')](_0x4d39('0x5e'));logger[_0x4d39('0xc')](_0x4d39('0x5f'),_0x2e718['id']);return setRelationship(_0x1ec5bb,_0x479158,_0x2e718,_0x4d39('0x60'));})[_0x4d39('0x2c')](function(){return setRelationship(_0x1ec5bb,_0x207580,_0x2e718,_0x4d39('0x61'));})[_0x4d39('0x2c')](function(){return getServerInfo(_0x1ec5bb);})[_0x4d39('0x2c')](function(_0x37f9c8){var _0x267d35=parseInt(_0x37f9c8[_0x4d39('0x62')][_0x4d39('0x63')](0x0));var _0x1e3a7e=util['format'](_0x4d39('0x64'),_0x4fb635[_0x4d39('0x53')],_0x2e718['id']);if(_0x267d35>0x6){_0x1e3a7e=util[_0x4d39('0x22')](_0x4d39('0x65'),_0x4fb635[_0x4d39('0x53')],_0x2e718['id']);}logger[_0x4d39('0xc')](_0x4d39('0x56'),_0x4d39('0x66'));emit(util[_0x4d39('0x22')](_0x4d39('0x67'),_0x5c555d[_0x4d39('0xd')]),_0x4d39('0x68'),{'uri':_0x1e3a7e});})[_0x4d39('0x69')](function(_0x182250){logger['error'](_0x4d39('0x56'),JSON[_0x4d39('0x20')](_0x182250));});};exports[_0x4d39('0x6a')]=function(_0x43aaa0,_0x3cee3b,_0x20ef46,_0x59e0b5,_0x509847,_0x1c8dfa,_0x5b7836){var _0x4d5f85,_0x167155,_0x2ce11b,_0x51a5d8;_0x1c8dfa[_0x4d39('0x53')]=intUtil[_0x4d39('0x52')](_0x1c8dfa[_0x4d39('0x53')]);_0x1c8dfa[_0x4d39('0x54')]=intUtil['stripTrailingSlash'](_0x1c8dfa[_0x4d39('0x54')]);def[_0x4d39('0x55')]=util[_0x4d39('0x22')]('%s/service/v4_1/rest.php',_0x1c8dfa[_0x4d39('0x53')]);if(_0x5b7836&&_0x5b7836['recordingFormat']&&_0x5b7836[_0x4d39('0x6b')]!==_0x4d39('0x6c')){logger[_0x4d39('0xc')](_0x4d39('0x6d'),_0x4d39('0x57'));_0x3cee3b['recordingURL']=util[_0x4d39('0x22')](_0x4d39('0x59'),_0x1c8dfa[_0x4d39('0x54')],_0x3cee3b[_0x4d39('0x5a')],md5(_0x3cee3b[_0x4d39('0x5a')]));}return getConnection(_0x1c8dfa)[_0x4d39('0x2c')](function(_0x5515dc){_0x51a5d8=_0x5515dc;return getUser(_0x1c8dfa,_0x59e0b5[_0x4d39('0xd')],_0x51a5d8);})[_0x4d39('0x2c')](function(_0x2f28a1){_0x4d5f85=_0x2f28a1;logger[_0x4d39('0xc')](_0x4d39('0x5b'),_0x4d5f85['id']);return getEndUser(_0x1c8dfa,_0x3cee3b[_0x4d39('0x6e')],_0x3cee3b['destcalleridnum'],_0x51a5d8);})[_0x4d39('0x2c')](function(_0x3e1d12){_0x167155=_0x3e1d12;logger[_0x4d39('0xc')]('The\x20Enduser\x20ID\x20is:',_0x167155['id']);return getTicket(_0x1c8dfa,_0x4d5f85,_0x167155,_0x20ef46,_0x3cee3b,_0x20ef46[_0x4d39('0x5d')],_0x51a5d8,'Outbound');})[_0x4d39('0x2c')](function(_0x52a039){_0x2ce11b=_0x52a039;logger['info'](_0x4d39('0x5e'));logger['info'](_0x4d39('0x5f'),_0x2ce11b['id']);return setRelationship(_0x51a5d8,_0x4d5f85,_0x2ce11b,_0x4d39('0x60'));})[_0x4d39('0x2c')](function(){return setRelationship(_0x51a5d8,_0x167155,_0x2ce11b,_0x4d39('0x61'));})['then'](function(){return getServerInfo(_0x51a5d8);})[_0x4d39('0x2c')](function(_0x34b42c){var _0x3b2121=parseInt(_0x34b42c[_0x4d39('0x62')][_0x4d39('0x63')](0x0));var _0x4a74aa=util[_0x4d39('0x22')](_0x4d39('0x64'),_0x1c8dfa['remoteUri'],_0x2ce11b['id']);if(_0x3b2121>0x6){_0x4a74aa=util[_0x4d39('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1c8dfa[_0x4d39('0x53')],_0x2ce11b['id']);}logger[_0x4d39('0xc')](_0x4d39('0x6d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4d39('0x22')](_0x4d39('0x67'),_0x59e0b5[_0x4d39('0xd')]),'trigger:browser:url',{'uri':_0x4a74aa});})[_0x4d39('0x69')](function(_0x5b2a08){logger[_0x4d39('0x6f')](_0x4d39('0x6d'),JSON['stringify'](_0x5b2a08));});};exports[_0x4d39('0x70')]=function(_0x5de63c,_0x593953,_0x1de7b8,_0x3040c2,_0x51a4b4,_0x5c3981){var _0x13d757,_0x415047,_0x559c23,_0x4f5513;_0x5c3981[_0x4d39('0x53')]=intUtil[_0x4d39('0x52')](_0x5c3981[_0x4d39('0x53')]);_0x5c3981[_0x4d39('0x54')]=intUtil[_0x4d39('0x52')](_0x5c3981[_0x4d39('0x54')]);def[_0x4d39('0x55')]=util['format'](_0x4d39('0x71'),_0x5c3981['remoteUri']);if(_0x51a4b4&&_0x51a4b4[_0x4d39('0x72')]){logger[_0x4d39('0xc')]('['+_0x593953[_0x4d39('0x73')]['toUpperCase']()+']',_0x4d39('0x57'));_0x593953[_0x4d39('0x58')]=util[_0x4d39('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c3981[_0x4d39('0x54')],_0x593953[_0x4d39('0x5a')],md5(_0x593953[_0x4d39('0x5a')]));}else{_0x593953[_0x4d39('0x58')]='';}return getConnection(_0x5c3981)[_0x4d39('0x2c')](function(_0x5b99ea){_0x4f5513=_0x5b99ea;if(!_[_0x4d39('0x28')](_0x3040c2)){return getUser(_0x5c3981,_0x3040c2[_0x4d39('0xd')],_0x4f5513);}else{return getUser(_0x5c3981,null,_0x4f5513);}})[_0x4d39('0x2c')](function(_0x467c05){_0x13d757=_0x467c05;logger[_0x4d39('0xc')](_0x4d39('0x5b'),_0x13d757['id']);return getEndUser(_0x5c3981,_0x593953[_0x4d39('0x74')],_0x593953['calleridnum'],_0x4f5513);})['then'](function(_0x65c329){_0x415047=_0x65c329;logger['info']('The\x20Enduser\x20ID\x20is:',_0x415047['id']);return getTicket(_0x5c3981,_0x13d757,_0x415047,_0x1de7b8,_0x593953,_0x1de7b8['Fields'],_0x4f5513,'Inbound');})[_0x4d39('0x2c')](function(_0x379311){_0x559c23=_0x379311;logger[_0x4d39('0xc')](_0x4d39('0x5e'));logger[_0x4d39('0xc')](_0x4d39('0x5f'),_0x559c23['id']);return setRelationship(_0x4f5513,_0x13d757,_0x559c23,'users');})[_0x4d39('0x2c')](function(){return setRelationship(_0x4f5513,_0x415047,_0x559c23,_0x4d39('0x61'));})[_0x4d39('0x2c')](function(){return getServerInfo(_0x4f5513);})[_0x4d39('0x69')](function(_0x3a061d){logger['error']('['+_0x593953[_0x4d39('0x73')]['toUpperCase']()+']',JSON[_0x4d39('0x20')](_0x3a061d));});}; \ 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 21cdebd..72670d8 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 _0x8db5=['key','%s:\x20%s','variable','format','toLowerCase','join','slice','validateEmail','lodash','getString','length','sortBy','type','string','push','content','variableName','customVariable','Variable','name','toString','keyValue','keyType'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x8db5,0x1d4));var _0x58db=function(_0x581714,_0x19b53c){_0x581714=_0x581714-0x0;var _0x3b9dad=_0x8db5[_0x581714];return _0x3b9dad;};'use strict';var _=require(_0x58db('0x0'));var util=require('util');exports[_0x58db('0x1')]=function(_0x52942d,_0x34f1d9,_0x22b217){var _0xedcd83=[];if(_0x52942d[_0x58db('0x2')]>0x0){var _0x32b0c4=_[_0x58db('0x3')](_0x52942d,['id']);for(var _0xb394e9=0x0;_0xb394e9<_0x32b0c4['length'];_0xb394e9++){var _0x3c52b8=_0x32b0c4[_0xb394e9];if(_0x3c52b8[_0x58db('0x4')]===_0x58db('0x5')){_0xedcd83[_0x58db('0x6')](_0x3c52b8[_0x58db('0x7')]);}else if(_0x3c52b8[_0x58db('0x4')]==='variable'&&_0x3c52b8[_0x58db('0x8')]){_0x34f1d9[_0x3c52b8[_0x58db('0x8')]]&&_0xedcd83[_0x58db('0x6')](_0x34f1d9[_0x3c52b8[_0x58db('0x8')]]['toString']());}else if(_0x3c52b8[_0x58db('0x4')]===_0x58db('0x9')&&_0x3c52b8[_0x58db('0xa')]&&_0x3c52b8[_0x58db('0xa')][_0x58db('0xb')]){_0x34f1d9[_0x3c52b8[_0x58db('0xa')][_0x58db('0xb')]['toLowerCase']()]&&_0xedcd83['push'](_0x34f1d9[_0x3c52b8[_0x58db('0xa')]['name']['toLowerCase']()][_0x58db('0xc')]());}else if(_0x3c52b8[_0x58db('0x4')]===_0x58db('0xd')){if(_0x3c52b8[_0x58db('0xe')]===_0x58db('0x5')&&_0x3c52b8[_0x58db('0xf')]){_0xedcd83[_0x58db('0x6')](util['format'](_0x58db('0x10'),_0x3c52b8['key'],_0x3c52b8['keyContent']));}else if(_0x3c52b8[_0x58db('0xe')]===_0x58db('0x11')&&_0x3c52b8[_0x58db('0x8')]&&_0x3c52b8[_0x58db('0xf')]){_0x34f1d9[_0x3c52b8[_0x58db('0x8')]]&&_0xedcd83[_0x58db('0x6')](util[_0x58db('0x12')](_0x58db('0x10'),_0x3c52b8[_0x58db('0xf')],_0x34f1d9[_0x3c52b8[_0x58db('0x8')]]));}else if(_0x3c52b8[_0x58db('0xe')]==='customVariable'&&_0x3c52b8['Variable']&&_0x3c52b8[_0x58db('0xa')][_0x58db('0xb')]&&_0x3c52b8['key']){_0x34f1d9[_0x3c52b8[_0x58db('0xa')]['name'][_0x58db('0x13')]()]&&_0xedcd83[_0x58db('0x6')](util['format'](_0x58db('0x10'),_0x3c52b8['key'],_0x34f1d9[_0x3c52b8[_0x58db('0xa')]['name'][_0x58db('0x13')]()]));}}}}return _0xedcd83[_0x58db('0x14')](_0x22b217);};exports['stripTrailingSlash']=function(_0x4f4413){var _0x733be9=_0x4f4413[_0x58db('0x15')](-0x1);if(_0x733be9==='/'){_0x4f4413=_0x4f4413['substring'](0x0,_0x4f4413['lastIndexOf'](_0x733be9));}return _0x4f4413;};exports[_0x58db('0x16')]=function(_0x22c84a){if(!_['isNil'](_0x22c84a)&&_0x22c84a!==''){var _0x2215cd=/^(([^<>()\[\]\\.,;:\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 _0x2215cd['test'](String(_0x22c84a)[_0x58db('0x13')]());}else{return![];}}; \ No newline at end of file +var _0xbbb7=['type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','format','%s:\x20%s','key','keyContent','slice','substring','lastIndexOf','isNil','test','util','sortBy','length'];(function(_0x50b409,_0x4ec514){var _0x4e487c=function(_0x5a06de){while(--_0x5a06de){_0x50b409['push'](_0x50b409['shift']());}};_0x4e487c(++_0x4ec514);}(_0xbbb7,0x1a6));var _0x7bbb=function(_0x1c33db,_0xf3ce5c){_0x1c33db=_0x1c33db-0x0;var _0x2173d2=_0xbbb7[_0x1c33db];return _0x2173d2;};'use strict';var _=require('lodash');var util=require(_0x7bbb('0x0'));exports['getString']=function(_0x1ac68a,_0x579f89,_0x4be6b6){var _0x57eb87=[];if(_0x1ac68a['length']>0x0){var _0x57b99c=_[_0x7bbb('0x1')](_0x1ac68a,['id']);for(var _0x36162b=0x0;_0x36162b<_0x57b99c[_0x7bbb('0x2')];_0x36162b++){var _0x405adb=_0x57b99c[_0x36162b];if(_0x405adb[_0x7bbb('0x3')]==='string'){_0x57eb87[_0x7bbb('0x4')](_0x405adb[_0x7bbb('0x5')]);}else if(_0x405adb['type']===_0x7bbb('0x6')&&_0x405adb['variableName']){_0x579f89[_0x405adb[_0x7bbb('0x7')]]&&_0x57eb87['push'](_0x579f89[_0x405adb['variableName']][_0x7bbb('0x8')]());}else if(_0x405adb[_0x7bbb('0x3')]===_0x7bbb('0x9')&&_0x405adb[_0x7bbb('0xa')]&&_0x405adb[_0x7bbb('0xa')][_0x7bbb('0xb')]){_0x579f89[_0x405adb[_0x7bbb('0xa')][_0x7bbb('0xb')][_0x7bbb('0xc')]()]&&_0x57eb87[_0x7bbb('0x4')](_0x579f89[_0x405adb[_0x7bbb('0xa')][_0x7bbb('0xb')][_0x7bbb('0xc')]()][_0x7bbb('0x8')]());}else if(_0x405adb['type']===_0x7bbb('0xd')){if(_0x405adb[_0x7bbb('0xe')]===_0x7bbb('0xf')&&_0x405adb['key']){_0x57eb87[_0x7bbb('0x4')](util[_0x7bbb('0x10')](_0x7bbb('0x11'),_0x405adb[_0x7bbb('0x12')],_0x405adb[_0x7bbb('0x13')]));}else if(_0x405adb[_0x7bbb('0xe')]==='variable'&&_0x405adb[_0x7bbb('0x7')]&&_0x405adb[_0x7bbb('0x12')]){_0x579f89[_0x405adb[_0x7bbb('0x7')]]&&_0x57eb87[_0x7bbb('0x4')](util[_0x7bbb('0x10')](_0x7bbb('0x11'),_0x405adb[_0x7bbb('0x12')],_0x579f89[_0x405adb[_0x7bbb('0x7')]]));}else if(_0x405adb[_0x7bbb('0xe')]==='customVariable'&&_0x405adb['Variable']&&_0x405adb[_0x7bbb('0xa')][_0x7bbb('0xb')]&&_0x405adb[_0x7bbb('0x12')]){_0x579f89[_0x405adb[_0x7bbb('0xa')]['name'][_0x7bbb('0xc')]()]&&_0x57eb87[_0x7bbb('0x4')](util[_0x7bbb('0x10')]('%s:\x20%s',_0x405adb[_0x7bbb('0x12')],_0x579f89[_0x405adb[_0x7bbb('0xa')]['name'][_0x7bbb('0xc')]()]));}}}}return _0x57eb87['join'](_0x4be6b6);};exports['stripTrailingSlash']=function(_0x538169){var _0x2b5565=_0x538169[_0x7bbb('0x14')](-0x1);if(_0x2b5565==='/'){_0x538169=_0x538169[_0x7bbb('0x15')](0x0,_0x538169[_0x7bbb('0x16')](_0x2b5565));}return _0x538169;};exports['validateEmail']=function(_0x2206d0){if(!_[_0x7bbb('0x17')](_0x2206d0)&&_0x2206d0!==''){var _0x16ba75=/^(([^<>()\[\]\\.,;:\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 _0x16ba75[_0x7bbb('0x18')](String(_0x2206d0)[_0x7bbb('0xc')]());}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 8d7a0a7..505371b 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x1b6460,_0x77964d){var _0x2e396c=function(_0x13ae17){while(--_0x13ae17){_0x1b6460['push'](_0x1b6460['shift']());}};_0x2e396c(++_0x77964d);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0xf8dd36,_0x46941f){var _0x2337d3=function(_0x4b1f0d){while(--_0x4b1f0d){_0xf8dd36['push'](_0xf8dd36['shift']());}};_0x2337d3(++_0x46941f);}(_0x34e8,0x12c));var _0x834e=function(_0x1d62f1,_0x216a2e){_0x1d62f1=_0x1d62f1-0x0;var _0x5017bc=_0x34e8[_0x1d62f1];return _0x5017bc;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ 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 b298987..e96e6b4 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 _0x81db=['Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','merge','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','picklist','type','nameField','customField','content','includes','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','toLowerCase','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error'];(function(_0x201ed2,_0x1042cc){var _0x138582=function(_0x682b4a){while(--_0x682b4a){_0x201ed2['push'](_0x201ed2['shift']());}};_0x138582(++_0x1042cc);}(_0x81db,0x86));var _0xb81d=function(_0x3857f2,_0x6639dd){_0x3857f2=_0x3857f2-0x0;var _0xa2623a=_0x81db[_0x3857f2];return _0xa2623a;};'use strict';var _=require(_0xb81d('0x0'));var rp=require(_0xb81d('0x1'));var md5=require(_0xb81d('0x2'));var util=require(_0xb81d('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xb81d('0x4'));var logger=require(_0xb81d('0x5'))(_0xb81d('0x6'));config[_0xb81d('0x7')]=_[_0xb81d('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb81d('0x9'))(new Redis(config[_0xb81d('0x7')]));function emit(_0x52cbdc,_0x37cc5b,_0x50a727){io['to'](_0x52cbdc)[_0xb81d('0xa')](_0x37cc5b,_0x50a727);}var headers={'Content-Type':_0xb81d('0xb'),'Accept':_0xb81d('0xb')};function getTicket(_0x7b3895,_0x25af45,_0x5de6df,_0x261275,_0x337d5a){logger[_0xb81d('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xb81d('0xd')](_0xb81d('0xe'),_0x7b3895[_0xb81d('0xf')]),'method':'POST','body':{'ticket':_[_0xb81d('0x10')]({'requester_id':_0x5de6df['id'],'submitter_id':_0x25af45?_0x25af45['id']:undefined,'assignee_id':_0x25af45?_0x25af45['id']:undefined,'tags':getTags(_0x261275[_0xb81d('0x11')],'name'),'subject':intUtil['getString'](_0x261275[_0xb81d('0x12')],_0x337d5a,'\x20'),'description':intUtil[_0xb81d('0x13')](_0x261275[_0xb81d('0x14')],_0x337d5a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb81d('0x13')](_0x261275['Descriptions'],_0x337d5a,'\x0a')}},getCustomFields(_0x261275[_0xb81d('0x15')],_0x337d5a))}})[_0xb81d('0x16')](function(_0x575ad3){logger['info'](_0xb81d('0x17'));return _0x575ad3[_0xb81d('0x18')];});}function getUser(_0x347e44,_0x3cf430){if(intUtil['validateEmail'](_0x3cf430)){logger['info'](_0xb81d('0x19'),_0x3cf430);return request({'uri':util['format'](_0xb81d('0x1a'),_0x347e44[_0xb81d('0xf')]),'qs':{'query':util[_0xb81d('0xd')](_0xb81d('0x1b'),_0x3cf430)}})['then'](function(_0x3a5e70){if(_0x3a5e70[_0xb81d('0x1c')]){logger[_0xb81d('0xc')](_0xb81d('0x1d'));return _['find'](_0x3a5e70[_0xb81d('0x1e')],{'email':_0x3cf430,'role':_0xb81d('0x1f')});}else{logger['info'](_0xb81d('0x20'));return request({'uri':util[_0xb81d('0xd')](_0xb81d('0x21'),_0x347e44['remoteUri'])})[_0xb81d('0x16')](function(_0x4f40fe){logger[_0xb81d('0xc')](_0xb81d('0x22'));return _0x4f40fe[_0xb81d('0x23')];});}});}else{logger[_0xb81d('0xc')](_0xb81d('0x20'));return request({'uri':util['format'](_0xb81d('0x21'),_0x347e44[_0xb81d('0xf')])})[_0xb81d('0x16')](function(_0x15c7b4){logger[_0xb81d('0xc')](_0xb81d('0x22'));return _0x15c7b4[_0xb81d('0x23')];});}}function getEndUser(_0x47bc97,_0x722996,_0x32c7ee){logger[_0xb81d('0xc')]('Searching\x20enduser\x20with\x20phone',_0x32c7ee);return request({'uri':util[_0xb81d('0xd')](_0xb81d('0x1a'),_0x47bc97[_0xb81d('0xf')]),'qs':{'query':util[_0xb81d('0xd')](_0xb81d('0x24'),_0x32c7ee)}})[_0xb81d('0x16')](function(_0x5b4ed6){var _0x433821;if(_0x5b4ed6[_0xb81d('0x1e')][_0xb81d('0x25')]){_0x5b4ed6[_0xb81d('0x1e')]=_[_0xb81d('0x26')](_0x5b4ed6[_0xb81d('0x1e')],{'suspended':![],'role':_0xb81d('0x27')});if(_0x5b4ed6['results'][_0xb81d('0x25')]){_0x433821=_[_0xb81d('0x28')](_0x5b4ed6['results']);}}if(_0x433821){logger[_0xb81d('0xc')](_0xb81d('0x29'));return _0x433821;}else{logger[_0xb81d('0xc')](_0xb81d('0x2a'));return request({'uri':util['format'](_0xb81d('0x2b'),_0x47bc97['remoteUri']),'method':_0xb81d('0x2c'),'body':{'user':{'role':_0xb81d('0x27'),'name':util[_0xb81d('0xd')](_0xb81d('0x2d'),_0x722996||_0x32c7ee),'phone':_0x32c7ee}}})[_0xb81d('0x16')](function(_0x3229ec){logger[_0xb81d('0xc')](_0xb81d('0x2e'));return _0x3229ec[_0xb81d('0x23')];});}});}function getAuth(_0x2cb813){var _0xb6dc47;if(_0x2cb813[_0xb81d('0x2f')]===_0xb81d('0x30')){_0xb6dc47=util[_0xb81d('0xd')](_0xb81d('0x31'),_0x2cb813[_0xb81d('0x32')],_0x2cb813[_0xb81d('0x30')]);}else if(_0x2cb813['authType']===_0xb81d('0x33')){_0xb6dc47=util[_0xb81d('0xd')](_0xb81d('0x34'),_0x2cb813[_0xb81d('0x32')],_0x2cb813[_0xb81d('0x33')]);}return util['format'](_0xb81d('0x35'),new Buffer(_0xb6dc47)[_0xb81d('0x36')](_0xb81d('0x37')));}function request(_0x53f491){logger[_0xb81d('0x38')](_0xb81d('0x39'),JSON[_0xb81d('0x3a')](_0x53f491));return rp(_[_0xb81d('0x8')](_0x53f491,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5857aa,_0x105c60){var _0x5a272e=[];if(_0x5857aa&&_0x5857aa['length']>0x0){_0x5a272e=_[_0xb81d('0x3b')](_0x5857aa,_0x105c60);}return _0x5a272e;}function getCustomFields(_0x351753,_0xce8241){var _0x3dd000=[];var _0x240467={'custom_fields':[]};if(_0x351753[_0xb81d('0x25')]>0x0){_['forEach'](_0x351753,function(_0xce4b57){if(_['includes'](['string',_0xb81d('0x3c')],_0xce4b57[_0xb81d('0x3d')])&&_0xce4b57[_0xb81d('0x3e')]&&!_0xce4b57[_0xb81d('0x3f')]){_0x240467[_0xce4b57['nameField']['toLowerCase']()]=_0xce4b57[_0xb81d('0x40')][_0xb81d('0x36')]();}else if(_[_0xb81d('0x41')]([_0xb81d('0x42'),_0xb81d('0x3c')],_0xce4b57['type'])&&_0xce4b57[_0xb81d('0x43')]&&_0xce4b57[_0xb81d('0x3f')]){_0x240467[_0xb81d('0x44')]['push']({'id':_0xce4b57[_0xb81d('0x43')],'value':_0xce4b57[_0xb81d('0x40')][_0xb81d('0x36')]()});}else if(_0xce4b57[_0xb81d('0x3d')]===_0xb81d('0x45')&&_0xce4b57['variableName']&&_0xce4b57[_0xb81d('0x43')]&&_0xce4b57[_0xb81d('0x3f')]){_0xce8241[_0xce4b57[_0xb81d('0x46')]]&&_0x240467[_0xb81d('0x44')]['push']({'id':_0xce4b57[_0xb81d('0x43')],'value':_0xce8241[_0xce4b57[_0xb81d('0x46')]]['toString']()});}else if(_0xce4b57['type']===_0xb81d('0x47')&&_0xce4b57[_0xb81d('0x48')]&&_0xce4b57['Variable'][_0xb81d('0x49')]&&_0xce4b57[_0xb81d('0x43')]&&_0xce4b57[_0xb81d('0x3f')]){_0xce8241[_0xce4b57[_0xb81d('0x48')][_0xb81d('0x49')][_0xb81d('0x4a')]()]&&_0x240467[_0xb81d('0x44')][_0xb81d('0x4b')]({'id':_0xce4b57[_0xb81d('0x43')],'value':_0xce8241[_0xce4b57['Variable'][_0xb81d('0x49')]['toLowerCase']()][_0xb81d('0x36')]()});}});}return _0x240467;}exports[_0xb81d('0x4c')]=function(_0x17aa57,_0x47a31f,_0x1787c9,_0x4fb644,_0x325197,_0x8a9fe7){var _0x254526,_0x3b9084;_0x8a9fe7[_0xb81d('0xf')]=intUtil[_0xb81d('0x4d')](_0x8a9fe7[_0xb81d('0xf')]);_0x8a9fe7[_0xb81d('0x4e')]=intUtil[_0xb81d('0x4d')](_0x8a9fe7[_0xb81d('0x4e')]);if(_0x325197&&_0x325197[_0xb81d('0x4f')]){logger[_0xb81d('0xc')](_0xb81d('0x50'),_0xb81d('0x51'));_0x47a31f[_0xb81d('0x52')]=util[_0xb81d('0xd')](_0xb81d('0x53'),_0x8a9fe7[_0xb81d('0x4e')],_0x47a31f[_0xb81d('0x54')],md5(_0x47a31f[_0xb81d('0x54')]));}else{_0x47a31f[_0xb81d('0x52')]='';}headers['Authorization']=getAuth(_0x8a9fe7);return getUser(_0x8a9fe7,_0x4fb644['email'])[_0xb81d('0x16')](function(_0x16ea6e){_0x254526=_0x16ea6e;logger['info'](_0xb81d('0x55'),_0x254526['id']);return getEndUser(_0x8a9fe7,_0x47a31f[_0xb81d('0x56')],_0x47a31f[_0xb81d('0x57')]);})[_0xb81d('0x16')](function(_0x3d8098){_0x3b9084=_0x3d8098;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3b9084['id']);return getTicket(_0x8a9fe7,_0x254526,_0x3b9084,_0x1787c9,_0x47a31f);})[_0xb81d('0x16')](function(_0x266863){if(_0x266863){logger[_0xb81d('0xc')](_0xb81d('0x58'),_0x266863['id']);switch(_0x8a9fe7['type']){case _0xb81d('0x59'):logger['info'](_0xb81d('0x50'),_0xb81d('0x5a'));return request({'uri':util[_0xb81d('0xd')](_0xb81d('0x5b'),_0x8a9fe7[_0xb81d('0xf')],_0x254526['id'],_0x266863['id']),'method':'POST'});case _0xb81d('0x5c'):logger['info'](_0xb81d('0x50'),_0xb81d('0x5d'));emit(util[_0xb81d('0xd')](_0xb81d('0x5e'),_0x4fb644[_0xb81d('0x49')]),_0xb81d('0x5f'),{'uri':util['format'](_0xb81d('0x60'),_0x8a9fe7['remoteUri'][_0xb81d('0x61')](_0xb81d('0x62'),''),_0x266863['id'])});break;default:logger[_0xb81d('0x63')](_0xb81d('0x50'),_0xb81d('0x64'));}}})[_0xb81d('0x65')](function(_0x330378){logger[_0xb81d('0x63')](_0xb81d('0x66'),util[_0xb81d('0x67')](_0x330378,{'showHidden':!![],'depth':null}));});};exports[_0xb81d('0x68')]=function(_0x5bccde,_0x19eaaf,_0x317695,_0x30df92,_0x4bfcbb,_0x44257a,_0x448b49){var _0x14e9e2,_0x31d550;_0x44257a[_0xb81d('0xf')]=intUtil[_0xb81d('0x4d')](_0x44257a[_0xb81d('0xf')]);_0x44257a[_0xb81d('0x4e')]=intUtil[_0xb81d('0x4d')](_0x44257a['serverUrl']);if(_0x448b49&&_0x448b49[_0xb81d('0x69')]&&_0x448b49[_0xb81d('0x69')]!=='none'){logger[_0xb81d('0xc')](_0xb81d('0x6a'),_0xb81d('0x51'));_0x19eaaf[_0xb81d('0x52')]=util['format'](_0xb81d('0x53'),_0x44257a[_0xb81d('0x4e')],_0x19eaaf[_0xb81d('0x54')],md5(_0x19eaaf['uniqueid']));}headers[_0xb81d('0x6b')]=getAuth(_0x44257a);return getUser(_0x44257a,_0x30df92[_0xb81d('0x6c')])[_0xb81d('0x16')](function(_0x48eb8d){_0x14e9e2=_0x48eb8d;logger[_0xb81d('0xc')](_0xb81d('0x55'),_0x14e9e2['id']);return getEndUser(_0x44257a,_0x19eaaf[_0xb81d('0x6d')],_0x19eaaf[_0xb81d('0x6e')]);})['then'](function(_0x14b078){_0x31d550=_0x14b078;logger[_0xb81d('0xc')](_0xb81d('0x6f'),_0x31d550['id']);return getTicket(_0x44257a,_0x14e9e2,_0x31d550,_0x317695,_0x19eaaf);})[_0xb81d('0x16')](function(_0x4a01){if(_0x4a01){logger[_0xb81d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4a01['id']);switch(_0x44257a['type']){case _0xb81d('0x59'):logger['info'](_0xb81d('0x6a'),_0xb81d('0x5a'));return request({'uri':util['format'](_0xb81d('0x5b'),_0x44257a['remoteUri'],_0x14e9e2['id'],_0x4a01['id']),'method':_0xb81d('0x2c')});case _0xb81d('0x5c'):logger[_0xb81d('0xc')]('[OUTBOUND]',_0xb81d('0x5d'));emit(util['format'](_0xb81d('0x5e'),_0x30df92[_0xb81d('0x49')]),'trigger:browser:url',{'uri':util[_0xb81d('0xd')](_0xb81d('0x60'),_0x44257a[_0xb81d('0xf')][_0xb81d('0x61')](_0xb81d('0x62'),''),_0x4a01['id'])});break;default:logger['error'](_0xb81d('0x6a'),_0xb81d('0x64'));}}})[_0xb81d('0x65')](function(_0x35c9ec){logger['error'](_0xb81d('0x70'),util[_0xb81d('0x67')](_0x35c9ec,{'showHidden':!![],'depth':null}));});};exports[_0xb81d('0x71')]=function(_0x389202,_0xe95d02,_0x464c68,_0x1a42b9,_0x3f36ae,_0x1a8930){var _0x510231,_0x297286;_0x1a8930['remoteUri']=intUtil[_0xb81d('0x4d')](_0x1a8930[_0xb81d('0xf')]);_0x1a8930[_0xb81d('0x4e')]=intUtil[_0xb81d('0x4d')](_0x1a8930[_0xb81d('0x4e')]);if(_0x3f36ae&&_0x3f36ae['monitor_format']){logger[_0xb81d('0xc')]('['+_0xe95d02[_0xb81d('0x72')][_0xb81d('0x73')]()+']','Recording\x20is\x20enabled!');_0xe95d02[_0xb81d('0x52')]=util[_0xb81d('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a8930[_0xb81d('0x4e')],_0xe95d02[_0xb81d('0x54')],md5(_0xe95d02[_0xb81d('0x54')]));}else{_0xe95d02[_0xb81d('0x52')]='';}headers[_0xb81d('0x6b')]=getAuth(_0x1a8930);return getUser(_0x1a8930)['then'](function(_0x115a94){_0x510231=_0x115a94;logger[_0xb81d('0xc')](_0xb81d('0x55'),_0x510231['id']);return getEndUser(_0x1a8930,_0xe95d02[_0xb81d('0x56')],_0xe95d02[_0xb81d('0x57')]);})[_0xb81d('0x16')](function(_0x44ec02){_0x297286=_0x44ec02;logger[_0xb81d('0xc')](_0xb81d('0x6f'),_0x297286['id']);return getTicket(_0x1a8930,_0x510231,_0x297286,_0x464c68,_0xe95d02);})['then'](function(_0xe35678){if(_0xe35678){logger[_0xb81d('0xc')](_0xb81d('0x58'),_0xe35678['id']);}})['catch'](function(_0x4d4b19){logger[_0xb81d('0x63')]('['+_0xe95d02[_0xb81d('0x72')]['toUpperCase']()+']'+_0xb81d('0x74'),util[_0xb81d('0x67')](_0x4d4b19,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3712=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','/api/v2','inspect','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','./util','../../../../config/environment','../../../../config/logger','zendesk','localhost','socket.io-emitter','redis','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','nameField','picklist','type','custom_fields','push','idField','variable','variableName','customField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab'];(function(_0xcdb190,_0x2f3df2){var _0x45c609=function(_0x7078a0){while(--_0x7078a0){_0xcdb190['push'](_0xcdb190['shift']());}};_0x45c609(++_0x2f3df2);}(_0x3712,0x1eb));var _0x2371=function(_0x56ba58,_0x1697c4){_0x56ba58=_0x56ba58-0x0;var _0x337772=_0x3712[_0x56ba58];return _0x337772;};'use strict';var _=require(_0x2371('0x0'));var rp=require('request-promise');var md5=require(_0x2371('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x2371('0x2'));var config=require(_0x2371('0x3'));var logger=require(_0x2371('0x4'))(_0x2371('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x2371('0x6'),'port':0x18eb});var io=require(_0x2371('0x7'))(new Redis(config[_0x2371('0x8')]));function emit(_0x5b0d96,_0x47ed2c,_0x29fd10){io['to'](_0x5b0d96)[_0x2371('0x9')](_0x47ed2c,_0x29fd10);}var headers={'Content-Type':_0x2371('0xa'),'Accept':_0x2371('0xa')};function getTicket(_0x153ae4,_0x1691e2,_0xc0582c,_0xbc6aca,_0x5bc343){logger[_0x2371('0xb')](_0x2371('0xc'));return request({'uri':util[_0x2371('0xd')](_0x2371('0xe'),_0x153ae4[_0x2371('0xf')]),'method':'POST','body':{'ticket':_[_0x2371('0x10')]({'requester_id':_0xc0582c['id'],'submitter_id':_0x1691e2?_0x1691e2['id']:undefined,'assignee_id':_0x1691e2?_0x1691e2['id']:undefined,'tags':getTags(_0xbc6aca[_0x2371('0x11')],_0x2371('0x12')),'subject':intUtil[_0x2371('0x13')](_0xbc6aca[_0x2371('0x14')],_0x5bc343,'\x20'),'description':intUtil[_0x2371('0x13')](_0xbc6aca[_0x2371('0x15')],_0x5bc343,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2371('0x13')](_0xbc6aca[_0x2371('0x15')],_0x5bc343,'\x0a')}},getCustomFields(_0xbc6aca[_0x2371('0x16')],_0x5bc343))}})[_0x2371('0x17')](function(_0x375e9d){logger['info'](_0x2371('0x18'));return _0x375e9d[_0x2371('0x19')];});}function getUser(_0x5c81a6,_0x25a5cd){if(intUtil[_0x2371('0x1a')](_0x25a5cd)){logger[_0x2371('0xb')](_0x2371('0x1b'),_0x25a5cd);return request({'uri':util[_0x2371('0xd')](_0x2371('0x1c'),_0x5c81a6[_0x2371('0xf')]),'qs':{'query':util['format'](_0x2371('0x1d'),_0x25a5cd)}})[_0x2371('0x17')](function(_0x4c2514){if(_0x4c2514['count']){logger['info']('Agent\x20found!');return _[_0x2371('0x1e')](_0x4c2514[_0x2371('0x1f')],{'email':_0x25a5cd,'role':_0x2371('0x20')});}else{logger[_0x2371('0xb')](_0x2371('0x21'));return request({'uri':util['format'](_0x2371('0x22'),_0x5c81a6[_0x2371('0xf')])})[_0x2371('0x17')](function(_0x2b69a6){logger[_0x2371('0xb')]('Admin\x20account\x20selected.');return _0x2b69a6[_0x2371('0x23')];});}});}else{logger[_0x2371('0xb')](_0x2371('0x21'));return request({'uri':util[_0x2371('0xd')]('%s/users/me.json',_0x5c81a6[_0x2371('0xf')])})[_0x2371('0x17')](function(_0x44aa47){logger['info'](_0x2371('0x24'));return _0x44aa47[_0x2371('0x23')];});}}function getEndUser(_0x5dbd8c,_0x1355c7,_0x367600){logger[_0x2371('0xb')](_0x2371('0x25'),_0x367600);return request({'uri':util['format']('%s/search.json',_0x5dbd8c[_0x2371('0xf')]),'qs':{'query':util[_0x2371('0xd')](_0x2371('0x26'),_0x367600)}})[_0x2371('0x17')](function(_0x50ac5b){var _0x5c84a2;if(_0x50ac5b[_0x2371('0x1f')][_0x2371('0x27')]){_0x50ac5b[_0x2371('0x1f')]=_['filter'](_0x50ac5b[_0x2371('0x1f')],{'suspended':![],'role':_0x2371('0x28')});if(_0x50ac5b[_0x2371('0x1f')][_0x2371('0x27')]){_0x5c84a2=_[_0x2371('0x29')](_0x50ac5b[_0x2371('0x1f')]);}}if(_0x5c84a2){logger[_0x2371('0xb')](_0x2371('0x2a'));return _0x5c84a2;}else{logger[_0x2371('0xb')](_0x2371('0x2b'));return request({'uri':util[_0x2371('0xd')](_0x2371('0x2c'),_0x5dbd8c['remoteUri']),'method':_0x2371('0x2d'),'body':{'user':{'role':'end-user','name':util[_0x2371('0xd')](_0x2371('0x2e'),_0x1355c7||_0x367600),'phone':_0x367600}}})['then'](function(_0x5b5ab4){logger[_0x2371('0xb')]('Enduser\x20created.');return _0x5b5ab4[_0x2371('0x23')];});}});}function getAuth(_0x520053){var _0x2b0f0e;if(_0x520053[_0x2371('0x2f')]===_0x2371('0x30')){_0x2b0f0e=util['format'](_0x2371('0x31'),_0x520053[_0x2371('0x32')],_0x520053[_0x2371('0x30')]);}else if(_0x520053[_0x2371('0x2f')]===_0x2371('0x33')){_0x2b0f0e=util[_0x2371('0xd')]('%s/token:%s',_0x520053[_0x2371('0x32')],_0x520053['token']);}return util[_0x2371('0xd')](_0x2371('0x34'),new Buffer(_0x2b0f0e)[_0x2371('0x35')](_0x2371('0x36')));}function request(_0x440a29){logger[_0x2371('0x37')](_0x2371('0x38'),JSON[_0x2371('0x39')](_0x440a29));return rp(_[_0x2371('0x3a')](_0x440a29,{'method':_0x2371('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x2e1b13,_0x12b358){var _0x580ef1=[];if(_0x2e1b13&&_0x2e1b13['length']>0x0){_0x580ef1=_[_0x2371('0x3c')](_0x2e1b13,_0x12b358);}return _0x580ef1;}function getCustomFields(_0x2fda37,_0x3c9a26){var _0x57c757=[];var _0x118426={'custom_fields':[]};if(_0x2fda37['length']>0x0){_[_0x2371('0x3d')](_0x2fda37,function(_0x114a34){if(_[_0x2371('0x3e')]([_0x2371('0x3f'),'picklist'],_0x114a34['type'])&&_0x114a34[_0x2371('0x40')]&&!_0x114a34['customField']){_0x118426[_0x114a34[_0x2371('0x40')]['toLowerCase']()]=_0x114a34['content'][_0x2371('0x35')]();}else if(_[_0x2371('0x3e')]([_0x2371('0x3f'),_0x2371('0x41')],_0x114a34[_0x2371('0x42')])&&_0x114a34['idField']&&_0x114a34['customField']){_0x118426[_0x2371('0x43')][_0x2371('0x44')]({'id':_0x114a34[_0x2371('0x45')],'value':_0x114a34['content'][_0x2371('0x35')]()});}else if(_0x114a34[_0x2371('0x42')]===_0x2371('0x46')&&_0x114a34[_0x2371('0x47')]&&_0x114a34['idField']&&_0x114a34[_0x2371('0x48')]){_0x3c9a26[_0x114a34['variableName']]&&_0x118426['custom_fields']['push']({'id':_0x114a34[_0x2371('0x45')],'value':_0x3c9a26[_0x114a34['variableName']]['toString']()});}else if(_0x114a34['type']===_0x2371('0x49')&&_0x114a34[_0x2371('0x4a')]&&_0x114a34['Variable']['name']&&_0x114a34[_0x2371('0x45')]&&_0x114a34[_0x2371('0x48')]){_0x3c9a26[_0x114a34['Variable'][_0x2371('0x12')][_0x2371('0x4b')]()]&&_0x118426[_0x2371('0x43')][_0x2371('0x44')]({'id':_0x114a34[_0x2371('0x45')],'value':_0x3c9a26[_0x114a34['Variable']['name'][_0x2371('0x4b')]()][_0x2371('0x35')]()});}});}return _0x118426;}exports[_0x2371('0x4c')]=function(_0x592e0a,_0x38cae7,_0x10cc8c,_0x31c7b0,_0x2dbb00,_0x200c30){var _0x7bb11e,_0x1b8766;_0x200c30['remoteUri']=intUtil[_0x2371('0x4d')](_0x200c30[_0x2371('0xf')]);_0x200c30[_0x2371('0x4e')]=intUtil['stripTrailingSlash'](_0x200c30['serverUrl']);if(_0x2dbb00&&_0x2dbb00[_0x2371('0x4f')]){logger[_0x2371('0xb')](_0x2371('0x50'),_0x2371('0x51'));_0x38cae7[_0x2371('0x52')]=util[_0x2371('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x200c30['serverUrl'],_0x38cae7[_0x2371('0x53')],md5(_0x38cae7[_0x2371('0x53')]));}else{_0x38cae7['recordingURL']='';}headers[_0x2371('0x54')]=getAuth(_0x200c30);return getUser(_0x200c30,_0x31c7b0[_0x2371('0x55')])[_0x2371('0x17')](function(_0x2f1713){_0x7bb11e=_0x2f1713;logger[_0x2371('0xb')](_0x2371('0x56'),_0x7bb11e['id']);return getEndUser(_0x200c30,_0x38cae7[_0x2371('0x57')],_0x38cae7['calleridnum']);})[_0x2371('0x17')](function(_0x3ddc03){_0x1b8766=_0x3ddc03;logger[_0x2371('0xb')](_0x2371('0x58'),_0x1b8766['id']);return getTicket(_0x200c30,_0x7bb11e,_0x1b8766,_0x10cc8c,_0x38cae7);})['then'](function(_0x2e5aaf){if(_0x2e5aaf){logger[_0x2371('0xb')](_0x2371('0x59'),_0x2e5aaf['id']);switch(_0x200c30[_0x2371('0x42')]){case _0x2371('0x5a'):logger['info'](_0x2371('0x50'),_0x2371('0x5b'));return request({'uri':util['format'](_0x2371('0x5c'),_0x200c30[_0x2371('0xf')],_0x7bb11e['id'],_0x2e5aaf['id']),'method':_0x2371('0x2d')});case _0x2371('0x5d'):logger[_0x2371('0xb')](_0x2371('0x50'),_0x2371('0x5e'));emit(util[_0x2371('0xd')](_0x2371('0x5f'),_0x31c7b0['name']),_0x2371('0x60'),{'uri':util['format'](_0x2371('0x61'),_0x200c30[_0x2371('0xf')][_0x2371('0x62')]('/api/v2',''),_0x2e5aaf['id'])});break;default:logger[_0x2371('0x63')](_0x2371('0x50'),_0x2371('0x64'));}}})[_0x2371('0x65')](function(_0x448ce3){logger[_0x2371('0x63')](_0x2371('0x66'),util['inspect'](_0x448ce3,{'showHidden':!![],'depth':null}));});};exports[_0x2371('0x67')]=function(_0x29e3a9,_0x2e6007,_0x22aa37,_0x1c49e0,_0x295ad9,_0x16964a,_0x14cff3){var _0x116202,_0x1e041e;_0x16964a[_0x2371('0xf')]=intUtil[_0x2371('0x4d')](_0x16964a[_0x2371('0xf')]);_0x16964a[_0x2371('0x4e')]=intUtil[_0x2371('0x4d')](_0x16964a[_0x2371('0x4e')]);if(_0x14cff3&&_0x14cff3[_0x2371('0x68')]&&_0x14cff3[_0x2371('0x68')]!==_0x2371('0x69')){logger[_0x2371('0xb')]('[OUTBOUND]',_0x2371('0x51'));_0x2e6007['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x16964a[_0x2371('0x4e')],_0x2e6007[_0x2371('0x53')],md5(_0x2e6007['uniqueid']));}headers[_0x2371('0x54')]=getAuth(_0x16964a);return getUser(_0x16964a,_0x1c49e0['email'])[_0x2371('0x17')](function(_0x1a1dd6){_0x116202=_0x1a1dd6;logger[_0x2371('0xb')]('The\x20User\x20ID\x20is:',_0x116202['id']);return getEndUser(_0x16964a,_0x2e6007[_0x2371('0x6a')],_0x2e6007[_0x2371('0x6b')]);})[_0x2371('0x17')](function(_0x26ae41){_0x1e041e=_0x26ae41;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1e041e['id']);return getTicket(_0x16964a,_0x116202,_0x1e041e,_0x22aa37,_0x2e6007);})[_0x2371('0x17')](function(_0x2e1329){if(_0x2e1329){logger[_0x2371('0xb')](_0x2371('0x59'),_0x2e1329['id']);switch(_0x16964a[_0x2371('0x42')]){case _0x2371('0x5a'):logger[_0x2371('0xb')](_0x2371('0x6c'),_0x2371('0x5b'));return request({'uri':util[_0x2371('0xd')](_0x2371('0x5c'),_0x16964a[_0x2371('0xf')],_0x116202['id'],_0x2e1329['id']),'method':_0x2371('0x2d')});case _0x2371('0x5d'):logger[_0x2371('0xb')]('[OUTBOUND]',_0x2371('0x5e'));emit(util[_0x2371('0xd')](_0x2371('0x5f'),_0x1c49e0[_0x2371('0x12')]),_0x2371('0x60'),{'uri':util['format'](_0x2371('0x61'),_0x16964a[_0x2371('0xf')][_0x2371('0x62')](_0x2371('0x6d'),''),_0x2e1329['id'])});break;default:logger[_0x2371('0x63')](_0x2371('0x6c'),_0x2371('0x64'));}}})[_0x2371('0x65')](function(_0x2a37a1){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2371('0x6e')](_0x2a37a1,{'showHidden':!![],'depth':null}));});};exports[_0x2371('0x6f')]=function(_0x56a3be,_0x8ab38a,_0x34b784,_0x59b171,_0x4daf39,_0xea2ae8){var _0x46498e,_0x3c0da4;_0xea2ae8[_0x2371('0xf')]=intUtil[_0x2371('0x4d')](_0xea2ae8[_0x2371('0xf')]);_0xea2ae8[_0x2371('0x4e')]=intUtil[_0x2371('0x4d')](_0xea2ae8[_0x2371('0x4e')]);if(_0x4daf39&&_0x4daf39['monitor_format']){logger[_0x2371('0xb')]('['+_0x8ab38a['lastevent']['toUpperCase']()+']',_0x2371('0x51'));_0x8ab38a[_0x2371('0x52')]=util[_0x2371('0xd')](_0x2371('0x70'),_0xea2ae8[_0x2371('0x4e')],_0x8ab38a['uniqueid'],md5(_0x8ab38a['uniqueid']));}else{_0x8ab38a[_0x2371('0x52')]='';}headers[_0x2371('0x54')]=getAuth(_0xea2ae8);return getUser(_0xea2ae8)['then'](function(_0x507e0c){_0x46498e=_0x507e0c;logger[_0x2371('0xb')](_0x2371('0x56'),_0x46498e['id']);return getEndUser(_0xea2ae8,_0x8ab38a[_0x2371('0x57')],_0x8ab38a[_0x2371('0x71')]);})[_0x2371('0x17')](function(_0xff785e){_0x3c0da4=_0xff785e;logger[_0x2371('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3c0da4['id']);return getTicket(_0xea2ae8,_0x46498e,_0x3c0da4,_0x34b784,_0x8ab38a);})['then'](function(_0xba3450){if(_0xba3450){logger[_0x2371('0xb')](_0x2371('0x59'),_0xba3450['id']);}})[_0x2371('0x65')](function(_0x105b08){logger[_0x2371('0x63')]('['+_0x8ab38a[_0x2371('0x72')][_0x2371('0x73')]()+']'+_0x2371('0x74'),util['inspect'](_0x105b08,{'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 5d47d6d..5fbbae2 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 _0x100a=['md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','emit','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','isNil','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','enduserType','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','connect','Answered','Call_Result','abandoned','timeout','Call_Start_Time','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','lastevent','toUpperCase','calleridnum','lodash'];(function(_0x2902ec,_0xfdfc09){var _0x27b09d=function(_0x232615){while(--_0x232615){_0x2902ec['push'](_0x2902ec['shift']());}};_0x27b09d(++_0xfdfc09);}(_0x100a,0x97));var _0xa100=function(_0x2aa69e,_0x1f0a4a){_0x2aa69e=_0x2aa69e-0x0;var _0x51daf9=_0x100a[_0x2aa69e];return _0x51daf9;};'use strict';var _=require(_0xa100('0x0'));var rp=require('request-promise');var md5=require(_0xa100('0x1'));var util=require(_0xa100('0x2'));var intUtil=require(_0xa100('0x3'));var moment=require(_0xa100('0x4'));var Redis=require(_0xa100('0x5'));var BPromise=require(_0xa100('0x6'));var config=require(_0xa100('0x7'));var logger=require(_0xa100('0x8'))(_0xa100('0x9'));config['redis']=_[_0xa100('0xa')](config['redis'],{'host':_0xa100('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5f404e,_0x255ba2,_0x2f2435){io['to'](_0x5f404e)[_0xa100('0xc')](_0x255ba2,_0x2f2435);}function request(_0x4c99bf){logger['debug']('[HTTP]',JSON[_0xa100('0xd')](_0x4c99bf));return rp(_0x4c99bf);}function getCustomFields(_0x30ecda,_0x1fc921){var _0x366e82={};if(_0x30ecda[_0xa100('0xe')]>0x0){_[_0xa100('0xf')](_0x30ecda,function(_0x24625c){if(_[_0xa100('0x10')]([_0xa100('0x11'),_0xa100('0x12')],_0x24625c[_0xa100('0x13')])&&_0x24625c[_0xa100('0x14')]){_0x366e82[_0x24625c[_0xa100('0x14')]]=_0x24625c[_0xa100('0x15')][_0xa100('0x16')]();}else if(_0x24625c[_0xa100('0x13')]==='variable'&&_0x24625c['variableName']&&_0x24625c['idField']&&_0x1fc921[_0x24625c[_0xa100('0x17')]]){_0x366e82[_0x24625c['idField']]=_0x1fc921[_0x24625c[_0xa100('0x17')]][_0xa100('0x16')]();}else if(_0x24625c[_0xa100('0x13')]==='customVariable'&&_0x24625c['Variable']&&_0x24625c[_0xa100('0x18')]['name']&&_0x24625c['idField']&&_0x1fc921[_0x24625c['Variable'][_0xa100('0x19')][_0xa100('0x1a')]()]){_0x366e82[_0x24625c[_0xa100('0x14')]]=_0x1fc921[_0x24625c[_0xa100('0x18')][_0xa100('0x19')]['toLowerCase']()][_0xa100('0x16')]();}});}return _0x366e82;}function getName(_0x510931){if(_0x510931['indexOf']('\x20')>0x0){var _0x72f241=_0x510931['split'](/ (.+)/);if(_0x72f241[0x1]){return _0x72f241;}}return[_0x510931,_0x510931];}var accountsTokens={};function getAccessToken(_0x2d04fb){return new Promise(function(_0x3e20ad,_0x49a947){if(!_[_0xa100('0x1b')](accountsTokens[_0x2d04fb['id']])&&!_[_0xa100('0x1b')](accountsTokens[_0x2d04fb['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x2d04fb['id']]['expires_in'])){_0x3e20ad(accountsTokens[_0x2d04fb['id']][_0xa100('0x1c')]);}}var _0x123380;switch(_0x2d04fb[_0xa100('0x1d')]){case'US':_0x123380='https://accounts.zoho.com';break;case'AU':_0x123380=_0xa100('0x1e');break;case'EU':_0x123380='https://accounts.zoho.eu';break;case'IN':_0x123380=_0xa100('0x1f');break;case'CN':_0x123380=_0xa100('0x20');break;default:_0x123380=_0xa100('0x21');break;}var _0x4b6ad1={'method':_0xa100('0x22'),'uri':_0x123380+_0xa100('0x23'),'qs':{'refresh_token':_0x2d04fb[_0xa100('0x24')],'client_id':_0x2d04fb[_0xa100('0x25')],'client_secret':_0x2d04fb[_0xa100('0x26')],'grant_type':_0xa100('0x27')},'json':!![]};return rp(_0x4b6ad1)['then'](function(_0x444cd3){accountsTokens[_0x2d04fb['id']]={'access_token':_0x444cd3['access_token'],'expires_in':moment()[_0xa100('0x28')](_0x444cd3[_0xa100('0x29')],_0xa100('0x2a'))};_0x3e20ad(_0x444cd3['access_token']);})[_0xa100('0x2b')](function(_0x4384a9){logger[_0xa100('0x2c')](_0xa100('0x2d'),_0x4384a9['stack']);_0x49a947(_0x4384a9);});});}function getUser(_0x4b5bf6,_0x149d43,_0x4e4c1f,_0x16c243){logger[_0xa100('0x2e')](_0xa100('0x2f'));return request({'method':'GET','uri':util[_0xa100('0x30')](_0xa100('0x31'),_0x149d43),'qs':{'type':_0xa100('0x32')},'headers':{'Authorization':_0xa100('0x33')+_0x4b5bf6},'json':!![]})['then'](function(_0x49849d){if(_0x49849d[_0xa100('0x34')]){var _0x445d1b=-0x1;if(_[_0xa100('0x35')](_0x49849d[_0xa100('0x34')])){if(!_['isNil'](_0x16c243)){_0x445d1b=_[_0xa100('0x36')](_0x49849d['users'],function(_0x11d312){return _0x11d312[_0xa100('0x37')]===_0x16c243;});}if(_0x445d1b>=0x0){logger[_0xa100('0x2e')](_0xa100('0x38'));}else{logger[_0xa100('0x2e')](_0xa100('0x39'));_0x445d1b=_['findIndex'](_0x49849d['users'],function(_0x29c4c7){return _0x29c4c7['profile'][_0xa100('0x19')]===_0xa100('0x3a');});}return _0x49849d['users'][_0x445d1b];}else{if(_0x49849d['user'][_0xa100('0x3b')][_0xa100('0x19')]===_0xa100('0x3a')){logger[_0xa100('0x2e')](_0xa100('0x39'));user=_0x49849d['user'];return user;}else{logger[_0xa100('0x2c')](_0xa100('0x3c'),JSON[_0xa100('0xd')](_0x49849d));throw new Error(_0xa100('0x3d')+JSON[_0xa100('0xd')](_0x49849d));}}}else{logger[_0xa100('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x49849d));throw new Error(_0xa100('0x3d')+JSON['stringify'](_0x49849d));}})[_0xa100('0x2b')](function(_0x11f3fc){console['error'](_0x11f3fc);});}function getZohoUser(_0x19f1c7,_0x58e336){return new BPromise(function(_0x58d368,_0x736bc1){request(_0x19f1c7)[_0xa100('0x3e')](function(_0x42176e){var _0x2b6533=null;if(_0x42176e){_0x2b6533=_0x42176e[_0xa100('0x3f')][0x0];_0x2b6533[_0xa100('0x40')]=_0x58e336;}_0x58d368(_0x2b6533);})[_0xa100('0x2b')](function(_0x12519d){_0x736bc1(_0x12519d);});});}function createEndUser(_0x52e58a,_0x3f99fa,_0x5ab570,_0x34007d,_0x1660e9,_0x29010e){var _0x5ab570=getName(_0x5ab570);return request({'method':_0xa100('0x22'),'uri':'https://www.zohoapis.'+_0x3f99fa+_0xa100('0x41')+_['startCase'](_0x29010e[_0xa100('0x42')])+'s','body':{'data':[{'Last_Name':_0x5ab570[0x1],'First_Name':_0x5ab570[0x0],'Phone':_0x34007d,'Owner':{'name':!_[_0xa100('0x1b')](_0x1660e9['role'][_0xa100('0x19')])?_0x1660e9[_0xa100('0x43')][_0xa100('0x19')]:!_[_0xa100('0x1b')](_0x1660e9['first_name'])?_0x1660e9[_0xa100('0x44')]+'\x20'+_0x1660e9[_0xa100('0x45')]:_0x1660e9['last_name'],'id':_0x1660e9['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x52e58a},'json':!![]})[_0xa100('0x3e')](function(_0x17bf7c){if(_0x17bf7c&&_0x17bf7c['data'][0x0][_0xa100('0x46')]===_0xa100('0x47')){var _0x371fbf=_0x17bf7c['data'][0x0][_0xa100('0x48')];_0x371fbf[_0xa100('0x40')]=_[_0xa100('0x49')](_0x29010e[_0xa100('0x42')])+'s';return _0x371fbf;}logger['error'](_0xa100('0x3c'),JSON[_0xa100('0xd')](data));throw new Error('Error:\x20'+JSON[_0xa100('0xd')](data));})[_0xa100('0x2b')](function(_0x396ad6){console[_0xa100('0x4a')](_0xa100('0x4b'),_0x396ad6);});}function getEndUser(_0x1fb6cc,_0x3218f4,_0x56b62c,_0x8de236,_0x2c4e07,_0x3201d7,_0x6bbc76){var _0x293887={'method':_0xa100('0x4c'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1fb6cc},'json':!![]};switch(_0x6bbc76[_0xa100('0x4d')]){case _0xa100('0x4e'):_0x293887['uri']='https://www.zohoapis.'+_0x3218f4+_0xa100('0x4f')+_0x2c4e07+'))';return getZohoUser(_0x293887,_0xa100('0x50'))[_0xa100('0x3e')](function(_0x2ac781){if(_0x2ac781)return _0x2ac781;_0x293887[_0xa100('0x51')]=_0xa100('0x52')+_0x3218f4+_0xa100('0x53')+_0x2c4e07+'))';return getZohoUser(_0x293887,_0xa100('0x54'))[_0xa100('0x3e')](function(_0x1f48a1){if(_0x1f48a1)return _0x1f48a1;if(_0x6bbc76[_0xa100('0x42')]!=_0xa100('0x55')){return createEndUser(_0x1fb6cc,_0x3218f4,_0x8de236,_0x2c4e07,_0x3201d7,_0x6bbc76);}else{return{};}});});break;case'contact':_0x293887['uri']=_0xa100('0x52')+_0x3218f4+_0xa100('0x4f')+_0x2c4e07+'))';return getZohoUser(_0x293887,_0xa100('0x50'))[_0xa100('0x3e')](function(_0x384dd6){if(_0x384dd6)return _0x384dd6;if(_0x6bbc76[_0xa100('0x42')]!=_0xa100('0x55')){return createEndUser(_0x1fb6cc,_0x3218f4,_0x8de236,_0x2c4e07,_0x3201d7,_0x6bbc76);}else{return{};}});break;case _0xa100('0x56'):_0x293887[_0xa100('0x51')]=_0xa100('0x52')+_0x3218f4+_0xa100('0x53')+_0x2c4e07+'))';return getZohoUser(_0x293887,_0xa100('0x54'))[_0xa100('0x3e')](function(_0x50264b){if(_0x50264b)return _0x50264b;if(_0x6bbc76[_0xa100('0x42')]!=_0xa100('0x55')){return createEndUser(_0x1fb6cc,_0x3218f4,_0x8de236,_0x2c4e07,_0x3201d7,_0x6bbc76);}else{return{};}});break;}}function getCall(_0x41ac0b,_0x57051a,_0x350cdf,_0xfc9abb,_0x232011,_0x2551f1,_0x2b476e,_0x57b7f6){logger[_0xa100('0x2e')](_0xa100('0x57'));var _0xd5efcc={};_0xd5efcc[_0xa100('0x58')]={'name':!_['isNil'](_0xfc9abb[_0xa100('0x43')]['name'])&&!_[_0xa100('0x1b')](_0xfc9abb['profile']['name'])&&_0xfc9abb[_0xa100('0x3b')][_0xa100('0x19')]===_0xa100('0x59')?_0xfc9abb[_0xa100('0x43')]['name']:!_[_0xa100('0x1b')](_0xfc9abb[_0xa100('0x44')])?_0xfc9abb['first_name']+'\x20'+_0xfc9abb[_0xa100('0x45')]:_0xfc9abb[_0xa100('0x45')],'id':_0xfc9abb['id']};_0xd5efcc[_0xa100('0x5a')]=intUtil['getString'](_0x2551f1[_0xa100('0x5b')],_0x2b476e,'\x20');_0xd5efcc[_0xa100('0x5c')]=intUtil[_0xa100('0x5d')](_0x2551f1[_0xa100('0x5e')],_0x2b476e,'\x0a');if(_0x232011[_0xa100('0x40')]===_0xa100('0x50')){_0xd5efcc['Who_Id']={'name':!_[_0xa100('0x1b')](_0x232011[_0xa100('0x5f')])?_0x232011['Full_Name']:!_[_0xa100('0x1b')](_0x232011[_0xa100('0x60')])?_0x232011[_0xa100('0x60')]+'\x20'+_0x232011[_0xa100('0x61')]:_0x232011[_0xa100('0x61')],'id':_0x232011['id']};}if(_0x232011[_0xa100('0x40')]==='Leads'){_0xd5efcc['What_Id']={'name':!_['isNil'](_0x232011[_0xa100('0x5f')])?_0x232011[_0xa100('0x5f')]:!_[_0xa100('0x1b')](_0x232011[_0xa100('0x60')])?_0x232011['First_Name']+'\x20'+_0x232011['Last_Name']:_0x232011['Last_Name'],'id':_0x232011['id']};_0xd5efcc[_0xa100('0x62')]=_['startCase'](_0x232011[_0xa100('0x40')]);}if(_0x2b476e[_0xa100('0x63')]){_0xd5efcc[_0xa100('0x64')]=moment[_0xa100('0x65')](parseInt(_0x2b476e[_0xa100('0x63')])*0x3e8)[_0xa100('0x30')](_0xa100('0x66'));}else if(_0x2b476e[_0xa100('0x67')]&&_0x2b476e[_0xa100('0x68')]){_0xd5efcc[_0xa100('0x64')]=moment['utc'](moment(_0x2b476e[_0xa100('0x68')],_0xa100('0x69'))[_0xa100('0x6a')](moment(_0x2b476e[_0xa100('0x6b')],_0xa100('0x69'))))[_0xa100('0x30')](_0xa100('0x66'));}switch(_0x2b476e['lastevent']){case _0xa100('0x6c'):_0xd5efcc['Call_Result']='Called';break;case'complete':case _0xa100('0x6d'):_0xd5efcc['Call_Result']=_0xa100('0x6e');break;case'rejected':_0xd5efcc[_0xa100('0x6f')]='Rejected';break;case _0xa100('0x70'):_0xd5efcc[_0xa100('0x6f')]='Abandoned';break;case _0xa100('0x71'):_0xd5efcc['Call_Result']='Timeout';default:}_0xd5efcc[_0xa100('0x72')]=(_0x57b7f6==='outbound'?moment(_0x2b476e[_0xa100('0x6b')])[_0xa100('0x30')](_0xa100('0x69')):moment(_0x2b476e['agentcalledAt'])['format'](_0xa100('0x69')))||moment()[_0xa100('0x30')](_0xa100('0x69'));_0xd5efcc[_0xa100('0x73')]=_0x57b7f6||_0xa100('0x74');_0xd5efcc=_[_0xa100('0x75')](_0xd5efcc,getCustomFields(_0x2551f1['Fields'],_0x2b476e));return request({'method':_0xa100('0x22'),'uri':'https://www.zohoapis.'+_0x57051a+_0xa100('0x76'),'headers':{'Authorization':_0xa100('0x33')+_0x41ac0b},'body':{'data':[_0xd5efcc]},'json':!![]})[_0xa100('0x3e')](function(_0x356429){if(_0x356429&&_0x356429[_0xa100('0x3f')][0x0][_0xa100('0x46')]===_0xa100('0x47')){logger[_0xa100('0x2e')](_0xa100('0x77'));return{'id':_0x356429[_0xa100('0x3f')][0x0][_0xa100('0x48')]['id']};}})['catch'](function(_0x531184){logger[_0xa100('0x2e')](_0xa100('0x78'),_0x531184[_0xa100('0x79')]);console[_0xa100('0x4a')]('err',_0x531184);});}exports[_0xa100('0x7a')]=function(_0x42082d,_0x14c787,_0x305ac9,_0x3ecbfe,_0x10991b,_0x380763){var _0x551fc3,_0x1f6636,_0x532ed1;_0x380763[_0xa100('0x7b')]=intUtil['stripTrailingSlash'](_0x380763[_0xa100('0x7b')]);_0x380763[_0xa100('0x7c')]=intUtil[_0xa100('0x7d')](_0x380763[_0xa100('0x7c')]);if(_0x10991b&&_0x10991b[_0xa100('0x7e')]){logger[_0xa100('0x2e')](_0xa100('0x7f'),_0xa100('0x80'));_0x14c787[_0xa100('0x81')]=_0x380763['serverUrl']+_0xa100('0x82')+_0x14c787['uniqueid']+_0xa100('0x83')+md5(_0x14c787[_0xa100('0x84')]);}else{_0x14c787[_0xa100('0x81')]='';}var _0x2d7f05=_0x380763[_0xa100('0x7b')]===_0xa100('0x85')?'eu':_0xa100('0x86');return getAccessToken(_0x380763)[_0xa100('0x3e')](function(_0x48c0bf){_0x532ed1=_0x48c0bf;return getUser(_0x532ed1,_0x2d7f05,_0x380763,_0x3ecbfe[_0xa100('0x37')]);})[_0xa100('0x3e')](function(_0x4f9c57){_0x551fc3=_0x4f9c57;logger['info'](_0xa100('0x87'),_0x551fc3['id']);return getEndUser(_0x532ed1,_0x2d7f05,_0x380763,_0x14c787[_0xa100('0x88')],_0x14c787['calleridnum'],_0x551fc3,_0x305ac9);})[_0xa100('0x3e')](function(_0x2f15a0){_0x1f6636=_0x2f15a0;return getCall(_0x532ed1,_0x2d7f05,_0x380763,_0x551fc3,_0x1f6636,_0x305ac9,_0x14c787,'Inbound');})[_0xa100('0x3e')](function(_0x15e820){if(_0x15e820){logger[_0xa100('0x2e')](_0xa100('0x89'),_0x15e820['id']);logger['info'](_0xa100('0x7f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3ecbfe[_0xa100('0x19')]),_0xa100('0x8a'),{'uri':_0xa100('0x8b')+_0x380763['host']+_0xa100('0x8c')+_0x15e820['id']});}})['catch'](function(_0x146365){logger[_0xa100('0x2c')](_0xa100('0x7f'),JSON[_0xa100('0xd')](_0x146365));});};exports[_0xa100('0x8d')]=function(_0x4e809c,_0x265328,_0x7c8df9,_0x5d028d,_0xaee406,_0x304eff,_0x88c698){var _0x5b5650,_0x2b7d2f,_0x448f64;_0x304eff[_0xa100('0x7b')]=intUtil[_0xa100('0x7d')](_0x304eff['host']);_0x304eff[_0xa100('0x7c')]=intUtil[_0xa100('0x7d')](_0x304eff['serverUrl']);if(_0x88c698&&_0x88c698['recordingFormat']&&_0x88c698[_0xa100('0x8e')]!=='none'){logger['info'](_0xa100('0x8f'),_0xa100('0x80'));_0x265328[_0xa100('0x81')]=_0x304eff[_0xa100('0x7c')]+'/api/voice/recordings/'+_0x265328[_0xa100('0x84')]+_0xa100('0x83')+md5(_0x265328[_0xa100('0x84')]);}var _0x4ca645=_0x304eff['host']===_0xa100('0x85')?'eu':_0xa100('0x86');return getAccessToken(_0x304eff)[_0xa100('0x3e')](function(_0x36dd18){_0x448f64=_0x36dd18;return getUser(_0x448f64,_0x4ca645,_0x304eff,_0x5d028d[_0xa100('0x37')]);})[_0xa100('0x3e')](function(_0x414332){_0x5b5650=_0x414332;logger[_0xa100('0x2e')](_0xa100('0x87'),_0x5b5650['id']);return getEndUser(_0x448f64,_0x4ca645,_0x304eff,_0x265328[_0xa100('0x90')],_0x265328['destcalleridnum'],_0x5b5650,_0x7c8df9);})[_0xa100('0x3e')](function(_0x33858f){_0x2b7d2f=_0x33858f;return getCall(_0x448f64,_0x4ca645,_0x304eff,_0x5b5650,_0x2b7d2f,_0x7c8df9,_0x265328,_0xa100('0x91'));})[_0xa100('0x3e')](function(_0x2ebfff){if(_0x2ebfff){logger['info']('The\x20Call\x20ID\x20is:',_0x2ebfff['id']);logger[_0xa100('0x2e')](_0xa100('0x8f'),_0xa100('0x92'));emit(util[_0xa100('0x30')](_0xa100('0x93'),_0x5d028d[_0xa100('0x19')]),_0xa100('0x8a'),{'uri':_0xa100('0x8b')+_0x304eff['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x2ebfff['id']});}})[_0xa100('0x2b')](function(_0x56c374){logger['error']('[OUTBOUND]',JSON['stringify'](_0x56c374));});};exports[_0xa100('0x94')]=function(_0x3f1122,_0x54b431,_0x20f1b6,_0x16db63,_0x408177,_0x2f621c){var _0x34e504,_0x18ca76,_0x1c48a9;_0x2f621c[_0xa100('0x7b')]=intUtil[_0xa100('0x7d')](_0x2f621c[_0xa100('0x7b')]);_0x2f621c[_0xa100('0x7c')]=intUtil[_0xa100('0x7d')](_0x2f621c[_0xa100('0x7c')]);if(_0x408177&&_0x408177[_0xa100('0x7e')]){logger[_0xa100('0x2e')]('['+_0x54b431[_0xa100('0x95')][_0xa100('0x96')]()+']','Recording\x20is\x20enabled!');_0x54b431['recordingURL']=_0x2f621c[_0xa100('0x7c')]+'/api/voice/recordings/'+_0x54b431[_0xa100('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x54b431['uniqueid']);}else{_0x54b431[_0xa100('0x81')]='';}var _0x19fd4e=_0x2f621c[_0xa100('0x7b')]===_0xa100('0x85')?'eu':'com';return getAccessToken(_0x2f621c)[_0xa100('0x3e')](function(_0x10f162){_0x1c48a9=_0x10f162;return getUser(_0x1c48a9,_0x19fd4e,_0x2f621c);})[_0xa100('0x3e')](function(_0x5a4316){_0x34e504=_0x5a4316;logger[_0xa100('0x2e')]('The\x20User\x20ID\x20is:',_0x34e504['id']);return getEndUser(_0x1c48a9,_0x19fd4e,_0x2f621c,_0x54b431[_0xa100('0x88')],_0x54b431[_0xa100('0x97')],_0x34e504,_0x20f1b6);})[_0xa100('0x3e')](function(_0x21e0f9){_0x18ca76=_0x21e0f9;return getCall(_0x1c48a9,_0x19fd4e,_0x2f621c,_0x34e504,_0x18ca76,_0x20f1b6,_0x54b431,'Inbound');})[_0xa100('0x3e')](function(_0xc7f1a){if(_0xc7f1a){logger[_0xa100('0x2e')](_0xa100('0x89'),_0xc7f1a['id']);}})[_0xa100('0x2b')](function(_0x1ae83a){logger[_0xa100('0x2c')]('['+_0x54b431['lastevent'][_0xa100('0x96')]()+']',JSON['stringify'](_0x1ae83a));});}; \ No newline at end of file +var _0x5965=['variable','variableName','toString','Variable','name','toLowerCase','indexOf','isNil','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','seconds','catch','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','stringify','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','startCase','Error:\x20','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','Call_Result','Called','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Outbound','unmanaged','zoho.eu','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','forEach','includes','picklist','idField','content','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5965,0x1ac));var _0x5596=function(_0xe1336b,_0x3f3130){_0xe1336b=_0xe1336b-0x0;var _0x1cf4b2=_0x5965[_0xe1336b];return _0x1cf4b2;};'use strict';var _=require(_0x5596('0x0'));var rp=require(_0x5596('0x1'));var md5=require(_0x5596('0x2'));var util=require(_0x5596('0x3'));var intUtil=require(_0x5596('0x4'));var moment=require(_0x5596('0x5'));var Redis=require(_0x5596('0x6'));var BPromise=require(_0x5596('0x7'));var config=require(_0x5596('0x8'));var logger=require(_0x5596('0x9'))('zoho');config[_0x5596('0xa')]=_[_0x5596('0xb')](config['redis'],{'host':_0x5596('0xc'),'port':0x18eb});var io=require(_0x5596('0xd'))(new Redis(config[_0x5596('0xa')]));function emit(_0x4c2f27,_0x50a368,_0x19fc22){io['to'](_0x4c2f27)['emit'](_0x50a368,_0x19fc22);}function request(_0x9d5456){logger[_0x5596('0xe')](_0x5596('0xf'),JSON['stringify'](_0x9d5456));return rp(_0x9d5456);}function getCustomFields(_0x2118b7,_0x2b5f3e){var _0x952b0e={};if(_0x2118b7['length']>0x0){_[_0x5596('0x10')](_0x2118b7,function(_0x2bdfdd){if(_[_0x5596('0x11')](['string',_0x5596('0x12')],_0x2bdfdd['type'])&&_0x2bdfdd[_0x5596('0x13')]){_0x952b0e[_0x2bdfdd['idField']]=_0x2bdfdd[_0x5596('0x14')]['toString']();}else if(_0x2bdfdd[_0x5596('0x15')]===_0x5596('0x16')&&_0x2bdfdd[_0x5596('0x17')]&&_0x2bdfdd[_0x5596('0x13')]&&_0x2b5f3e[_0x2bdfdd[_0x5596('0x17')]]){_0x952b0e[_0x2bdfdd['idField']]=_0x2b5f3e[_0x2bdfdd[_0x5596('0x17')]][_0x5596('0x18')]();}else if(_0x2bdfdd[_0x5596('0x15')]==='customVariable'&&_0x2bdfdd[_0x5596('0x19')]&&_0x2bdfdd['Variable'][_0x5596('0x1a')]&&_0x2bdfdd[_0x5596('0x13')]&&_0x2b5f3e[_0x2bdfdd[_0x5596('0x19')]['name'][_0x5596('0x1b')]()]){_0x952b0e[_0x2bdfdd[_0x5596('0x13')]]=_0x2b5f3e[_0x2bdfdd[_0x5596('0x19')]['name']['toLowerCase']()]['toString']();}});}return _0x952b0e;}function getName(_0x3fe6c0){if(_0x3fe6c0[_0x5596('0x1c')]('\x20')>0x0){var _0x4a5190=_0x3fe6c0['split'](/ (.+)/);if(_0x4a5190[0x1]){return _0x4a5190;}}return[_0x3fe6c0,_0x3fe6c0];}var accountsTokens={};function getAccessToken(_0x4c0386){return new Promise(function(_0x2ae8d2,_0x130dee){if(!_[_0x5596('0x1d')](accountsTokens[_0x4c0386['id']])&&!_[_0x5596('0x1d')](accountsTokens[_0x4c0386['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x4c0386['id']][_0x5596('0x1e')])){_0x2ae8d2(accountsTokens[_0x4c0386['id']][_0x5596('0x1f')]);}}var _0x1b3bf3;switch(_0x4c0386['zone']){case'US':_0x1b3bf3=_0x5596('0x20');break;case'AU':_0x1b3bf3=_0x5596('0x21');break;case'EU':_0x1b3bf3=_0x5596('0x22');break;case'IN':_0x1b3bf3='https://accounts.zoho.in';break;case'CN':_0x1b3bf3='https://accounts.zoho.com.cn';break;default:_0x1b3bf3='https://accounts.zoho.eu';break;}var _0x26da30={'method':_0x5596('0x23'),'uri':_0x1b3bf3+_0x5596('0x24'),'qs':{'refresh_token':_0x4c0386['refreshToken'],'client_id':_0x4c0386[_0x5596('0x25')],'client_secret':_0x4c0386[_0x5596('0x26')],'grant_type':_0x5596('0x27')},'json':!![]};return rp(_0x26da30)[_0x5596('0x28')](function(_0x7b0e1){accountsTokens[_0x4c0386['id']]={'access_token':_0x7b0e1[_0x5596('0x1f')],'expires_in':moment()['add'](_0x7b0e1[_0x5596('0x1e')],_0x5596('0x29'))};_0x2ae8d2(_0x7b0e1[_0x5596('0x1f')]);})[_0x5596('0x2a')](function(_0x2a2d1f){logger['error']('Failing\x20creating\x20the\x20access_token',_0x2a2d1f[_0x5596('0x2b')]);_0x130dee(_0x2a2d1f);});});}function getUser(_0x1cbb4f,_0x1864c7,_0x19c8c5,_0x181d42){logger[_0x5596('0x2c')](_0x5596('0x2d'));return request({'method':_0x5596('0x2e'),'uri':util['format'](_0x5596('0x2f'),_0x1864c7),'qs':{'type':_0x5596('0x30')},'headers':{'Authorization':_0x5596('0x31')+_0x1cbb4f},'json':!![]})[_0x5596('0x28')](function(_0x3676f7){if(_0x3676f7[_0x5596('0x32')]){var _0xd1b789=-0x1;if(_[_0x5596('0x33')](_0x3676f7['users'])){if(!_[_0x5596('0x1d')](_0x181d42)){_0xd1b789=_[_0x5596('0x34')](_0x3676f7[_0x5596('0x32')],function(_0x3d3b73){return _0x3d3b73[_0x5596('0x35')]===_0x181d42;});}if(_0xd1b789>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x5596('0x2c')](_0x5596('0x36'));_0xd1b789=_[_0x5596('0x34')](_0x3676f7[_0x5596('0x32')],function(_0x29d77e){return _0x29d77e[_0x5596('0x37')][_0x5596('0x1a')]===_0x5596('0x38');});}return _0x3676f7[_0x5596('0x32')][_0xd1b789];}else{if(_0x3676f7['user'][_0x5596('0x37')][_0x5596('0x1a')]===_0x5596('0x38')){logger[_0x5596('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x3676f7['user'];return user;}else{logger['error'](_0x5596('0x39'),JSON[_0x5596('0x3a')](_0x3676f7));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5596('0x3a')](_0x3676f7));}}}else{logger[_0x5596('0x3b')]('The\x20failing\x20result\x20is',JSON[_0x5596('0x3a')](_0x3676f7));throw new Error(_0x5596('0x3c')+JSON[_0x5596('0x3a')](_0x3676f7));}})['catch'](function(_0x1d5b4a){console[_0x5596('0x3b')](_0x1d5b4a);});}function getZohoUser(_0x1cf6a6,_0x9ab6f4){return new BPromise(function(_0x46d067,_0x1beeab){request(_0x1cf6a6)['then'](function(_0x56c4bc){var _0x3450be=null;if(_0x56c4bc){_0x3450be=_0x56c4bc[_0x5596('0x3d')][0x0];_0x3450be['enduserType']=_0x9ab6f4;}_0x46d067(_0x3450be);})[_0x5596('0x2a')](function(_0x7099a8){_0x1beeab(_0x7099a8);});});}function createEndUser(_0x56e0b7,_0x37bcb6,_0x5633ee,_0x2f6c58,_0x41db82,_0x31123c){var _0x5633ee=getName(_0x5633ee);return request({'method':'POST','uri':_0x5596('0x3e')+_0x37bcb6+_0x5596('0x3f')+_['startCase'](_0x31123c[_0x5596('0x40')])+'s','body':{'data':[{'Last_Name':_0x5633ee[0x1],'First_Name':_0x5633ee[0x0],'Phone':_0x2f6c58,'Owner':{'name':!_[_0x5596('0x1d')](_0x41db82[_0x5596('0x41')][_0x5596('0x1a')])?_0x41db82[_0x5596('0x41')][_0x5596('0x1a')]:!_[_0x5596('0x1d')](_0x41db82['first_name'])?_0x41db82[_0x5596('0x42')]+'\x20'+_0x41db82[_0x5596('0x43')]:_0x41db82[_0x5596('0x43')],'id':_0x41db82['id']}}]},'headers':{'Authorization':_0x5596('0x31')+_0x56e0b7},'json':!![]})['then'](function(_0xe9bf27){if(_0xe9bf27&&_0xe9bf27[_0x5596('0x3d')][0x0][_0x5596('0x44')]===_0x5596('0x45')){var _0x183387=_0xe9bf27[_0x5596('0x3d')][0x0][_0x5596('0x46')];_0x183387[_0x5596('0x47')]=_[_0x5596('0x48')](_0x31123c[_0x5596('0x40')])+'s';return _0x183387;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x5596('0x3a')](data));throw new Error(_0x5596('0x49')+JSON[_0x5596('0x3a')](data));})['catch'](function(_0x4bebfb){console[_0x5596('0x4a')]('CREATE\x20ERROR',_0x4bebfb);});}function getEndUser(_0x266dea,_0x359547,_0x51e0c3,_0x5b6ce4,_0x46ce5f,_0x1daba3,_0x45f90b){var _0x3b8f5b={'method':_0x5596('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x266dea},'json':!![]};switch(_0x45f90b['moduleSearch']){case _0x5596('0x4b'):_0x3b8f5b[_0x5596('0x4c')]='https://www.zohoapis.'+_0x359547+_0x5596('0x4d')+_0x46ce5f+'))';return getZohoUser(_0x3b8f5b,'Contacts')['then'](function(_0x12b553){if(_0x12b553)return _0x12b553;_0x3b8f5b[_0x5596('0x4c')]='https://www.zohoapis.'+_0x359547+_0x5596('0x4e')+_0x46ce5f+'))';return getZohoUser(_0x3b8f5b,_0x5596('0x4f'))[_0x5596('0x28')](function(_0xce378b){if(_0xce378b)return _0xce378b;if(_0x45f90b[_0x5596('0x40')]!=_0x5596('0x50')){return createEndUser(_0x266dea,_0x359547,_0x5b6ce4,_0x46ce5f,_0x1daba3,_0x45f90b);}else{return{};}});});break;case _0x5596('0x51'):_0x3b8f5b[_0x5596('0x4c')]=_0x5596('0x3e')+_0x359547+_0x5596('0x4d')+_0x46ce5f+'))';return getZohoUser(_0x3b8f5b,_0x5596('0x52'))[_0x5596('0x28')](function(_0x5cb096){if(_0x5cb096)return _0x5cb096;if(_0x45f90b[_0x5596('0x40')]!=_0x5596('0x50')){return createEndUser(_0x266dea,_0x359547,_0x5b6ce4,_0x46ce5f,_0x1daba3,_0x45f90b);}else{return{};}});break;case _0x5596('0x53'):_0x3b8f5b[_0x5596('0x4c')]=_0x5596('0x3e')+_0x359547+_0x5596('0x4e')+_0x46ce5f+'))';return getZohoUser(_0x3b8f5b,_0x5596('0x4f'))[_0x5596('0x28')](function(_0x354727){if(_0x354727)return _0x354727;if(_0x45f90b[_0x5596('0x40')]!=_0x5596('0x50')){return createEndUser(_0x266dea,_0x359547,_0x5b6ce4,_0x46ce5f,_0x1daba3,_0x45f90b);}else{return{};}});break;}}function getCall(_0x13122d,_0x4b95cb,_0x3c291e,_0x2d3c2b,_0x4058ee,_0x158cdf,_0xb570bf,_0x497e40){logger[_0x5596('0x2c')](_0x5596('0x54'));var _0x7f2f76={};_0x7f2f76['Owner']={'name':!_[_0x5596('0x1d')](_0x2d3c2b[_0x5596('0x41')][_0x5596('0x1a')])&&!_[_0x5596('0x1d')](_0x2d3c2b[_0x5596('0x37')]['name'])&&_0x2d3c2b[_0x5596('0x37')][_0x5596('0x1a')]===_0x5596('0x55')?_0x2d3c2b['role'][_0x5596('0x1a')]:!_[_0x5596('0x1d')](_0x2d3c2b['first_name'])?_0x2d3c2b['first_name']+'\x20'+_0x2d3c2b[_0x5596('0x43')]:_0x2d3c2b[_0x5596('0x43')],'id':_0x2d3c2b['id']};_0x7f2f76[_0x5596('0x56')]=intUtil[_0x5596('0x57')](_0x158cdf[_0x5596('0x58')],_0xb570bf,'\x20');_0x7f2f76[_0x5596('0x59')]=intUtil[_0x5596('0x57')](_0x158cdf['Descriptions'],_0xb570bf,'\x0a');if(_0x4058ee[_0x5596('0x47')]===_0x5596('0x52')){_0x7f2f76[_0x5596('0x5a')]={'name':!_[_0x5596('0x1d')](_0x4058ee[_0x5596('0x5b')])?_0x4058ee[_0x5596('0x5b')]:!_['isNil'](_0x4058ee['First_Name'])?_0x4058ee[_0x5596('0x5c')]+'\x20'+_0x4058ee['Last_Name']:_0x4058ee[_0x5596('0x5d')],'id':_0x4058ee['id']};}if(_0x4058ee[_0x5596('0x47')]===_0x5596('0x4f')){_0x7f2f76[_0x5596('0x5e')]={'name':!_[_0x5596('0x1d')](_0x4058ee[_0x5596('0x5b')])?_0x4058ee[_0x5596('0x5b')]:!_['isNil'](_0x4058ee['First_Name'])?_0x4058ee[_0x5596('0x5c')]+'\x20'+_0x4058ee[_0x5596('0x5d')]:_0x4058ee['Last_Name'],'id':_0x4058ee['id']};_0x7f2f76['$se_module']=_[_0x5596('0x48')](_0x4058ee['enduserType']);}if(_0xb570bf[_0x5596('0x5f')]){_0x7f2f76[_0x5596('0x60')]=moment[_0x5596('0x61')](parseInt(_0xb570bf[_0x5596('0x5f')])*0x3e8)[_0x5596('0x62')](_0x5596('0x63'));}else if(_0xb570bf['answertime']&&_0xb570bf[_0x5596('0x64')]){_0x7f2f76[_0x5596('0x60')]=moment[_0x5596('0x61')](moment(_0xb570bf[_0x5596('0x64')],_0x5596('0x65'))['diff'](moment(_0xb570bf[_0x5596('0x66')],_0x5596('0x65'))))['format'](_0x5596('0x63'));}switch(_0xb570bf[_0x5596('0x67')]){case'called':_0x7f2f76[_0x5596('0x68')]=_0x5596('0x69');break;case'complete':case'connect':_0x7f2f76[_0x5596('0x68')]=_0x5596('0x6a');break;case _0x5596('0x6b'):_0x7f2f76[_0x5596('0x68')]=_0x5596('0x6c');break;case _0x5596('0x6d'):_0x7f2f76[_0x5596('0x68')]=_0x5596('0x6e');break;case _0x5596('0x6f'):_0x7f2f76['Call_Result']=_0x5596('0x70');default:}_0x7f2f76['Call_Start_Time']=(_0x497e40===_0x5596('0x71')?moment(_0xb570bf[_0x5596('0x66')])[_0x5596('0x62')](_0x5596('0x65')):moment(_0xb570bf[_0x5596('0x72')])[_0x5596('0x62')](_0x5596('0x65')))||moment()[_0x5596('0x62')](_0x5596('0x65'));_0x7f2f76[_0x5596('0x73')]=_0x497e40||_0x5596('0x74');_0x7f2f76=_[_0x5596('0x75')](_0x7f2f76,getCustomFields(_0x158cdf[_0x5596('0x76')],_0xb570bf));return request({'method':_0x5596('0x23'),'uri':'https://www.zohoapis.'+_0x4b95cb+'/crm/v2/Calls','headers':{'Authorization':_0x5596('0x31')+_0x13122d},'body':{'data':[_0x7f2f76]},'json':!![]})[_0x5596('0x28')](function(_0x5503c8){if(_0x5503c8&&_0x5503c8['data'][0x0][_0x5596('0x44')]===_0x5596('0x45')){logger[_0x5596('0x2c')](_0x5596('0x77'));return{'id':_0x5503c8[_0x5596('0x3d')][0x0][_0x5596('0x46')]['id']};}})[_0x5596('0x2a')](function(_0x21d54c){logger['info'](_0x5596('0x78'),_0x21d54c[_0x5596('0x2b')]);console[_0x5596('0x4a')](_0x5596('0x78'),_0x21d54c);});}exports['queue']=function(_0x28cadd,_0x499478,_0x31dc14,_0x241b57,_0x1301ba,_0x2b0b1b){var _0x581c5e,_0x14fb3b,_0x59824e;_0x2b0b1b[_0x5596('0x79')]=intUtil[_0x5596('0x7a')](_0x2b0b1b[_0x5596('0x79')]);_0x2b0b1b[_0x5596('0x7b')]=intUtil[_0x5596('0x7a')](_0x2b0b1b[_0x5596('0x7b')]);if(_0x1301ba&&_0x1301ba[_0x5596('0x7c')]){logger[_0x5596('0x2c')]('[QUEUE]',_0x5596('0x7d'));_0x499478[_0x5596('0x7e')]=_0x2b0b1b['serverUrl']+_0x5596('0x7f')+_0x499478['uniqueid']+_0x5596('0x80')+md5(_0x499478['uniqueid']);}else{_0x499478[_0x5596('0x7e')]='';}var _0x35302a=_0x2b0b1b[_0x5596('0x79')]==='zoho.eu'?'eu':_0x5596('0x81');return getAccessToken(_0x2b0b1b)['then'](function(_0x3e98a8){_0x59824e=_0x3e98a8;return getUser(_0x59824e,_0x35302a,_0x2b0b1b,_0x241b57[_0x5596('0x35')]);})[_0x5596('0x28')](function(_0x5ba0c1){_0x581c5e=_0x5ba0c1;logger[_0x5596('0x2c')](_0x5596('0x82'),_0x581c5e['id']);return getEndUser(_0x59824e,_0x35302a,_0x2b0b1b,_0x499478[_0x5596('0x83')],_0x499478[_0x5596('0x84')],_0x581c5e,_0x31dc14);})['then'](function(_0xb27f0){_0x14fb3b=_0xb27f0;return getCall(_0x59824e,_0x35302a,_0x2b0b1b,_0x581c5e,_0x14fb3b,_0x31dc14,_0x499478,_0x5596('0x74'));})[_0x5596('0x28')](function(_0x16c2c7){if(_0x16c2c7){logger[_0x5596('0x2c')](_0x5596('0x85'),_0x16c2c7['id']);logger[_0x5596('0x2c')](_0x5596('0x86'),_0x5596('0x87'));emit(util[_0x5596('0x62')](_0x5596('0x88'),_0x241b57[_0x5596('0x1a')]),_0x5596('0x89'),{'uri':_0x5596('0x8a')+_0x2b0b1b['host']+_0x5596('0x8b')+_0x16c2c7['id']});}})[_0x5596('0x2a')](function(_0x44153b){logger[_0x5596('0x3b')](_0x5596('0x86'),JSON['stringify'](_0x44153b));});};exports[_0x5596('0x71')]=function(_0x4145fe,_0x37ae90,_0xe1e4b4,_0x58efce,_0xe77da,_0x32ba16,_0x50cfea){var _0x3b6f9a,_0x55ed0e,_0x4bd511;_0x32ba16[_0x5596('0x79')]=intUtil[_0x5596('0x7a')](_0x32ba16['host']);_0x32ba16[_0x5596('0x7b')]=intUtil[_0x5596('0x7a')](_0x32ba16[_0x5596('0x7b')]);if(_0x50cfea&&_0x50cfea['recordingFormat']&&_0x50cfea[_0x5596('0x8c')]!==_0x5596('0x8d')){logger[_0x5596('0x2c')](_0x5596('0x8e'),'Recording\x20is\x20enabled!');_0x37ae90[_0x5596('0x7e')]=_0x32ba16[_0x5596('0x7b')]+_0x5596('0x7f')+_0x37ae90[_0x5596('0x8f')]+'/downloads?type=uniqueid&token='+md5(_0x37ae90[_0x5596('0x8f')]);}var _0xfa352b=_0x32ba16['host']==='zoho.eu'?'eu':_0x5596('0x81');return getAccessToken(_0x32ba16)['then'](function(_0x2d174f){_0x4bd511=_0x2d174f;return getUser(_0x4bd511,_0xfa352b,_0x32ba16,_0x58efce[_0x5596('0x35')]);})[_0x5596('0x28')](function(_0x44a8fb){_0x3b6f9a=_0x44a8fb;logger['info'](_0x5596('0x82'),_0x3b6f9a['id']);return getEndUser(_0x4bd511,_0xfa352b,_0x32ba16,_0x37ae90[_0x5596('0x90')],_0x37ae90[_0x5596('0x91')],_0x3b6f9a,_0xe1e4b4);})['then'](function(_0x20f02a){_0x55ed0e=_0x20f02a;return getCall(_0x4bd511,_0xfa352b,_0x32ba16,_0x3b6f9a,_0x55ed0e,_0xe1e4b4,_0x37ae90,_0x5596('0x92'));})[_0x5596('0x28')](function(_0x856c19){if(_0x856c19){logger[_0x5596('0x2c')](_0x5596('0x85'),_0x856c19['id']);logger[_0x5596('0x2c')](_0x5596('0x8e'),_0x5596('0x87'));emit(util[_0x5596('0x62')](_0x5596('0x88'),_0x58efce[_0x5596('0x1a')]),_0x5596('0x89'),{'uri':_0x5596('0x8a')+_0x32ba16[_0x5596('0x79')]+_0x5596('0x8b')+_0x856c19['id']});}})[_0x5596('0x2a')](function(_0x33a75a){logger[_0x5596('0x3b')]('[OUTBOUND]',JSON[_0x5596('0x3a')](_0x33a75a));});};exports[_0x5596('0x93')]=function(_0x2795f3,_0x3ff57a,_0x14ae17,_0x6f78ed,_0x302f86,_0x4eaf42){var _0x19eac7,_0x5df9e4,_0x32561a;_0x4eaf42[_0x5596('0x79')]=intUtil['stripTrailingSlash'](_0x4eaf42[_0x5596('0x79')]);_0x4eaf42[_0x5596('0x7b')]=intUtil[_0x5596('0x7a')](_0x4eaf42[_0x5596('0x7b')]);if(_0x302f86&&_0x302f86['monitor_format']){logger[_0x5596('0x2c')]('['+_0x3ff57a[_0x5596('0x67')]['toUpperCase']()+']',_0x5596('0x7d'));_0x3ff57a[_0x5596('0x7e')]=_0x4eaf42[_0x5596('0x7b')]+_0x5596('0x7f')+_0x3ff57a['uniqueid']+_0x5596('0x80')+md5(_0x3ff57a['uniqueid']);}else{_0x3ff57a[_0x5596('0x7e')]='';}var _0x2fb54d=_0x4eaf42['host']===_0x5596('0x94')?'eu':_0x5596('0x81');return getAccessToken(_0x4eaf42)[_0x5596('0x28')](function(_0x3dd983){_0x32561a=_0x3dd983;return getUser(_0x32561a,_0x2fb54d,_0x4eaf42);})[_0x5596('0x28')](function(_0x1cefb9){_0x19eac7=_0x1cefb9;logger[_0x5596('0x2c')](_0x5596('0x82'),_0x19eac7['id']);return getEndUser(_0x32561a,_0x2fb54d,_0x4eaf42,_0x3ff57a[_0x5596('0x83')],_0x3ff57a[_0x5596('0x84')],_0x19eac7,_0x14ae17);})['then'](function(_0x36d1fb){_0x5df9e4=_0x36d1fb;return getCall(_0x32561a,_0x2fb54d,_0x4eaf42,_0x19eac7,_0x5df9e4,_0x14ae17,_0x3ff57a,'Inbound');})[_0x5596('0x28')](function(_0x4765c7){if(_0x4765c7){logger['info'](_0x5596('0x85'),_0x4765c7['id']);}})[_0x5596('0x2a')](function(_0x260277){logger[_0x5596('0x3b')]('['+_0x3ff57a['lastevent'][_0x5596('0x95')]()+']',JSON[_0x5596('0x3a')](_0x260277));});}; \ 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 198519e..4a69078 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 _0x2707=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','exec','data2','Script','data3','error','format'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0x2707,0xea));var _0x7270=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x2707[_0x47fd36];return _0x21a0fc;};'use strict';var util=require('util');var sh=require(_0x7270('0x0'));var Mustache=require(_0x7270('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x7270('0x2')]=function(_0x4382f1,_0x5e6ac5){var _0x1c3d1e=_0x4382f1[_0x7270('0x3')]?_0x4382f1[_0x7270('0x3')]:_0x7270('0x4');var _0x525344=_0x4382f1[_0x7270('0x5')]?Mustache['render'](_0x4382f1['data3'],_0x5e6ac5):_0x5e6ac5;sh['exec'](_0x525344,function(_0x522351,_0x25476b,_0xfb83ed){if(_0x522351!==0x0){logger[_0x7270('0x6')](util[_0x7270('0x7')](_0x7270('0x8'),_0x1c3d1e,_0x525344,_0x522351,_0xfb83ed));}else{logger[_0x7270('0x9')](util['format'](_0x7270('0xa'),_0x1c3d1e,_0x525344,_0x25476b));}});}; \ No newline at end of file +var _0x633d=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','data2','Script','render','exec','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format'];(function(_0x56bba6,_0x5b9243){var _0x1195c5=function(_0x2753e3){while(--_0x2753e3){_0x56bba6['push'](_0x56bba6['shift']());}};_0x1195c5(++_0x5b9243);}(_0x633d,0x11f));var _0xd633=function(_0x1e3162,_0x366118){_0x1e3162=_0x1e3162-0x0;var _0x53e351=_0x633d[_0x1e3162];return _0x53e351;};'use strict';var util=require('util');var sh=require(_0xd633('0x0'));var Mustache=require(_0xd633('0x1'));var logger=require(_0xd633('0x2'))(_0xd633('0x3'));exports['exec']=function(_0x1a80ae,_0x38e994){var _0x1e3e1c=_0x1a80ae[_0xd633('0x4')]?_0x1a80ae[_0xd633('0x4')]:_0xd633('0x5');var _0x5d8066=_0x1a80ae['data3']?Mustache[_0xd633('0x6')](_0x1a80ae['data3'],_0x38e994):_0x38e994;sh[_0xd633('0x7')](_0x5d8066,function(_0xfff686,_0x4a069c,_0x1d4655){if(_0xfff686!==0x0){logger['error'](util['format'](_0xd633('0x8'),_0x1e3e1c,_0x5d8066,_0xfff686,_0x1d4655));}else{logger['info'](util[_0xd633('0x9')](_0xd633('0xa'),_0x1e3e1c,_0x5d8066,_0x4a069c));}});}; \ 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 569025e..11d1097 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 _0x0e3a=['catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','headers','data6','parse','stack','GET','DELETE','POST','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode'];(function(_0x4eb4ad,_0x183488){var _0x1312b2=function(_0x19aabe){while(--_0x19aabe){_0x4eb4ad['push'](_0x4eb4ad['shift']());}};_0x1312b2(++_0x183488);}(_0x0e3a,0xb8));var _0xa0e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0e3a[_0x57b54c];return _0x59cc19;};'use strict';var rp=require(_0xa0e3('0x0'));var util=require('util');var _=require(_0xa0e3('0x1'));var Mustache=require(_0xa0e3('0x2'));var logger=require(_0xa0e3('0x3'))(_0xa0e3('0x4'));exports[_0xa0e3('0x5')]=function(_0x5271f0,_0xb9d19d){var _0x34d72b,_0x287654;var _0x13cf99={'method':_0x5271f0[_0xa0e3('0x6')][_0xa0e3('0x7')](),'uri':Mustache[_0xa0e3('0x8')](_0x5271f0[_0xa0e3('0x9')],_0xb9d19d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5271f0['data5'])==='number'&&parseInt(_0x5271f0[_0xa0e3('0xa')])>=0x1&&parseInt(_0x5271f0['data5'])<=0xa?parseInt(_0x5271f0[_0xa0e3('0xa')])*0x3e8:0x5*0x3e8};try{_0x13cf99[_0xa0e3('0xb')]=_0x5271f0[_0xa0e3('0xc')]?JSON[_0xa0e3('0xd')](Mustache[_0xa0e3('0x8')](_0x5271f0[_0xa0e3('0xc')],_0xb9d19d)):{};}catch(_0x1cf3ef){logger['error'](_0x1cf3ef[_0xa0e3('0xe')]);}switch(_0x5271f0[_0xa0e3('0x6')]['toUpperCase']()){case _0xa0e3('0xf'):case _0xa0e3('0x10'):_0x34d72b=null;_0x13cf99['qs']=_0xb9d19d;break;case _0xa0e3('0x11'):case'PUT':if(_0x5271f0[_0xa0e3('0x12')]){try{_0x34d72b=JSON[_0xa0e3('0xd')](Mustache[_0xa0e3('0x8')](_0x5271f0[_0xa0e3('0x12')],_0xb9d19d));_0x13cf99[_0xa0e3('0x13')]=_0x34d72b;}catch(_0x394bdd){logger['error'](_0x394bdd[_0xa0e3('0xe')]);logger[_0xa0e3('0x14')](_0xa0e3('0x15'));}}else{_0x34d72b=_0xb9d19d;_0x13cf99[_0xa0e3('0x13')]=_0x34d72b;}break;}logger['info'](util[_0xa0e3('0x16')](_0xa0e3('0x17'),_0x5271f0[_0xa0e3('0x6')],_0x5271f0[_0xa0e3('0x9')],JSON['stringify'](_0x13cf99)));rp(_0x13cf99)[_0xa0e3('0x18')](function(_0x734705){_0x34d72b=!_[_0xa0e3('0x19')](_0x34d72b)?_0xa0e3('0x1a')+_0x34d72b:'';_0x287654=typeof _0x734705[_0xa0e3('0x13')]===_0xa0e3('0x1b')?JSON[_0xa0e3('0x1c')](_0x734705['body']):_0x734705[_0xa0e3('0x13')];logger[_0xa0e3('0x1d')](util[_0xa0e3('0x16')](_0xa0e3('0x1e'),_0x5271f0['data1'],_0x5271f0[_0xa0e3('0x9')],_0x734705[_0xa0e3('0x1f')],_0x287654));})[_0xa0e3('0x20')](function(_0xf7006d){logger[_0xa0e3('0x14')](util[_0xa0e3('0x16')](_0xa0e3('0x21'),_0x5271f0[_0xa0e3('0x6')],_0x5271f0[_0xa0e3('0x9')],_0xf7006d[_0xa0e3('0x1f')],_0xf7006d[_0xa0e3('0x22')],_0xf7006d[_0xa0e3('0x23')]));});}; \ No newline at end of file +var _0x8438=['format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','render','data2','number','data5','data6','stack','data1','GET','DELETE','POST','PUT','data7','parse','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info'];(function(_0x2ebe07,_0x5cb865){var _0x1ea79c=function(_0x16a5d7){while(--_0x16a5d7){_0x2ebe07['push'](_0x2ebe07['shift']());}};_0x1ea79c(++_0x5cb865);}(_0x8438,0x78));var _0x8843=function(_0x1b4b1d,_0x2bb789){_0x1b4b1d=_0x1b4b1d-0x0;var _0x178754=_0x8438[_0x1b4b1d];return _0x178754;};'use strict';var rp=require('request-promise');var util=require(_0x8843('0x0'));var _=require(_0x8843('0x1'));var Mustache=require(_0x8843('0x2'));var logger=require(_0x8843('0x3'))(_0x8843('0x4'));exports[_0x8843('0x5')]=function(_0x55f4a2,_0x4cdc51){var _0x1a2317,_0x279c8e;var _0x5e115c={'method':_0x55f4a2['data1'][_0x8843('0x6')](),'uri':Mustache[_0x8843('0x7')](_0x55f4a2[_0x8843('0x8')],_0x4cdc51),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x55f4a2['data5'])===_0x8843('0x9')&&parseInt(_0x55f4a2[_0x8843('0xa')])>=0x1&&parseInt(_0x55f4a2[_0x8843('0xa')])<=0xa?parseInt(_0x55f4a2['data5'])*0x3e8:0x5*0x3e8};try{_0x5e115c['headers']=_0x55f4a2[_0x8843('0xb')]?JSON['parse'](Mustache[_0x8843('0x7')](_0x55f4a2[_0x8843('0xb')],_0x4cdc51)):{};}catch(_0x459112){logger['error'](_0x459112[_0x8843('0xc')]);}switch(_0x55f4a2[_0x8843('0xd')][_0x8843('0x6')]()){case _0x8843('0xe'):case _0x8843('0xf'):_0x1a2317=null;_0x5e115c['qs']=_0x4cdc51;break;case _0x8843('0x10'):case _0x8843('0x11'):if(_0x55f4a2[_0x8843('0x12')]){try{_0x1a2317=JSON[_0x8843('0x13')](Mustache['render'](_0x55f4a2[_0x8843('0x12')],_0x4cdc51));_0x5e115c['body']=_0x1a2317;}catch(_0xbfcd0b){logger[_0x8843('0x14')](_0xbfcd0b[_0x8843('0xc')]);logger[_0x8843('0x14')](_0x8843('0x15'));}}else{_0x1a2317=_0x4cdc51;_0x5e115c[_0x8843('0x16')]=_0x1a2317;}break;}logger[_0x8843('0x17')](util[_0x8843('0x18')](_0x8843('0x19'),_0x55f4a2[_0x8843('0xd')],_0x55f4a2[_0x8843('0x8')],JSON['stringify'](_0x5e115c)));rp(_0x5e115c)[_0x8843('0x1a')](function(_0x52d361){_0x1a2317=!_[_0x8843('0x1b')](_0x1a2317)?_0x8843('0x1c')+_0x1a2317:'';_0x279c8e=typeof _0x52d361[_0x8843('0x16')]===_0x8843('0x1d')?JSON[_0x8843('0x1e')](_0x52d361[_0x8843('0x16')]):_0x52d361[_0x8843('0x16')];logger['info'](util[_0x8843('0x18')](_0x8843('0x1f'),_0x55f4a2[_0x8843('0xd')],_0x55f4a2['data2'],_0x52d361[_0x8843('0x20')],_0x279c8e));})[_0x8843('0x21')](function(_0x1ae834){logger[_0x8843('0x14')](util[_0x8843('0x18')](_0x8843('0x22'),_0x55f4a2[_0x8843('0xd')],_0x55f4a2[_0x8843('0x8')],_0x1ae834[_0x8843('0x20')],_0x1ae834['name'],_0x1ae834[_0x8843('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e301150..7d07d24 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 _0x58c4=['http','Request','request','then','debug','routing','error','rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','client'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x58c4,0x1cd));var _0x458c=function(_0x406a2a,_0x1af57b){_0x406a2a=_0x406a2a-0x0;var _0x52a293=_0x58c4[_0x406a2a];return _0x52a293;};'use strict';var jayson=require(_0x458c('0x0'));var BPromise=require(_0x458c('0x1'));var logger=require(_0x458c('0x2'))('routing');var client=jayson[_0x458c('0x3')][_0x458c('0x4')]({'port':0x2329});client[_0x458c('0x5')]=function(_0x42d5db,_0x40b216){return new BPromise(function(_0xe0770f,_0x1559d1){return client[_0x458c('0x6')](_0x42d5db,_0x40b216)[_0x458c('0x7')](function(_0x396c88){logger[_0x458c('0x8')]('rpc',_0x458c('0x9'),_0x42d5db,_0x40b216,_0x396c88);if(_0x396c88[_0x458c('0xa')]){logger[_0x458c('0xa')](_0x458c('0xb'),_0x458c('0x9'),_0x42d5db,_0x396c88[_0x458c('0xa')][_0x458c('0xc')],_0x40b216);return _0x1559d1(_0x396c88[_0x458c('0xa')]['message']);}else{return _0xe0770f(_0x396c88['result']);}})[_0x458c('0xd')](function(_0x109f7d){logger['error'](_0x458c('0xb'),'routing',_0x42d5db,_0x109f7d,_0x40b216);return _0x1559d1(_0x109f7d);});});};module[_0x458c('0xe')]=client; \ No newline at end of file +var _0xee04=['message','result','exports','jayson/promise','../../config/logger','routing','client','http','Request','debug','rpc','error'];(function(_0x2f6d8e,_0x41ac39){var _0x4fe268=function(_0xf5128b){while(--_0xf5128b){_0x2f6d8e['push'](_0x2f6d8e['shift']());}};_0x4fe268(++_0x41ac39);}(_0xee04,0x9f));var _0x4ee0=function(_0x17b32d,_0x3d0f98){_0x17b32d=_0x17b32d-0x0;var _0x1160b7=_0xee04[_0x17b32d];return _0x1160b7;};'use strict';var jayson=require(_0x4ee0('0x0'));var BPromise=require('bluebird');var logger=require(_0x4ee0('0x1'))(_0x4ee0('0x2'));var client=jayson[_0x4ee0('0x3')][_0x4ee0('0x4')]({'port':0x2329});client[_0x4ee0('0x5')]=function(_0x45ef78,_0x2d46a0){return new BPromise(function(_0x4b0da0,_0x405738){return client['request'](_0x45ef78,_0x2d46a0)['then'](function(_0x3c35ee){logger[_0x4ee0('0x6')](_0x4ee0('0x7'),_0x4ee0('0x2'),_0x45ef78,_0x2d46a0,_0x3c35ee);if(_0x3c35ee['error']){logger[_0x4ee0('0x8')](_0x4ee0('0x7'),'routing',_0x45ef78,_0x3c35ee[_0x4ee0('0x8')][_0x4ee0('0x9')],_0x2d46a0);return _0x405738(_0x3c35ee['error'][_0x4ee0('0x9')]);}else{return _0x4b0da0(_0x3c35ee[_0x4ee0('0xa')]);}})['catch'](function(_0x596355){logger['error'](_0x4ee0('0x7'),'routing',_0x45ef78,_0x596355,_0x2d46a0);return _0x405738(_0x596355);});});};module[_0x4ee0('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f2996ca..8d9c897 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 _0x76ad=['Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','../../config/logger','resolve','then','getMailAccounts','refresh','listen','getSettings','catch'];(function(_0x4c72f8,_0x112a58){var _0x3fa6b6=function(_0x4d33e9){while(--_0x4d33e9){_0x4c72f8['push'](_0x4c72f8['shift']());}};_0x3fa6b6(++_0x112a58);}(_0x76ad,0x1c9));var _0xd76a=function(_0x30a1b6,_0x158e1e){_0x30a1b6=_0x30a1b6-0x0;var _0x304819=_0x76ad[_0x30a1b6];return _0x304819;};'use strict';var server=require(_0xd76a('0x0'));var Realtime=require(_0xd76a('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xd76a('0x2'));var setting=require('./rpc/setting');var logger=require(_0xd76a('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd76a('0x4')]()[_0xd76a('0x5')](mailAccount[_0xd76a('0x6')]())['then'](realtime['initMailAccounts']())[_0xd76a('0x5')](function(){email[_0xd76a('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xd76a('0x8')](realtime,email)[_0xd76a('0x5')](function(){return initRealtime();})[_0xd76a('0x5')](function(){return setting[_0xd76a('0x9')]();})[_0xd76a('0x5')](function(_0x43243e){return setInterval(initRealtime,_0x43243e['loginMailFrequency']*0x3e8);})[_0xd76a('0xa')](function(_0x593dc2){logger['error'](_0xd76a('0xb'),_0x593dc2);});}main(); \ No newline at end of file +var _0x2cf8=['./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','refresh','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x568676,_0x2b1c64){var _0x6c84c2=function(_0x33e0fa){while(--_0x33e0fa){_0x568676['push'](_0x568676['shift']());}};_0x6c84c2(++_0x2b1c64);}(_0x2cf8,0x176));var _0x82cf=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x2cf8[_0x4f431d];return _0x4f31e1;};'use strict';var server=require(_0x82cf('0x0'));var Realtime=require(_0x82cf('0x1'));var EmailChannel=require(_0x82cf('0x2'));var mailAccount=require(_0x82cf('0x3'));var setting=require(_0x82cf('0x4'));var logger=require(_0x82cf('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x82cf('0x6')]()[_0x82cf('0x7')](mailAccount['getMailAccounts']())[_0x82cf('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0x82cf('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x82cf('0x9')](realtime,email)[_0x82cf('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x82cf('0xa')]();})[_0x82cf('0x7')](function(_0x13b789){return setInterval(initRealtime,_0x13b789[_0x82cf('0xb')]*0x3e8);})[_0x82cf('0xc')](function(_0x22f992){logger[_0x82cf('0xd')](_0x82cf('0xe'),_0x22f992);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2bedca6..103427a 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 _0x40c9=['ioredis','../../../config/environment','../../../config/logger','email','redis','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','then','verify','moment','md5'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x40c9,0xde));var _0x940c=function(_0x186787,_0xc29d48){_0x186787=_0x186787-0x0;var _0x5e0f6a=_0x40c9[_0x186787];return _0x5e0f6a;};'use strict';var _=require('lodash');var moment=require(_0x940c('0x0'));var BPromise=require('bluebird');var md5=require(_0x940c('0x1'));var Redis=require(_0x940c('0x2'));var config=require(_0x940c('0x3'));var logger=require(_0x940c('0x4'))(_0x940c('0x5'));config['redis']=_['defaults'](config[_0x940c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x940c('0x7'))(new Redis(config['redis']));var EmailImap=require(_0x940c('0x8'));var EmailSmtp=require(_0x940c('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2c5bac){logger[_0x940c('0xa')](_0x940c('0xb'));this['mailAccounts']=_0x2c5bac[_0x940c('0xc')];this[_0x940c('0xd')]={};this[_0x940c('0xe')]=new EmailSmtp();}EmailChannel[_0x940c('0xf')][_0x940c('0x10')]=function(_0x31b4ef){var _0x108510=this['mailAccounts'][_0x31b4ef];var _0x1cdcb4={'id':_0x108510['id'],'name':_0x108510[_0x940c('0x11')],'key':_0x108510[_0x940c('0x12')],'active':_0x108510[_0x940c('0x13')],'Imap':{'status':_0x108510[_0x940c('0x14')][_0x940c('0x15')],'messageStatus':_0x108510[_0x940c('0x14')][_0x940c('0x16')],'total':_0x108510[_0x940c('0x14')]['total']}};if(_[_0x940c('0x17')](md5Accounts[_0x31b4ef])){md5Accounts[_0x31b4ef]={};}var _0x307c78=md5(JSON[_0x940c('0x18')](_0x1cdcb4));if(md5Accounts[_0x31b4ef][_0x940c('0x1')]!==_0x307c78){md5Accounts[_0x31b4ef][_0x940c('0x1')]=_0x307c78;io[_0x940c('0x10')](_0x940c('0x19'),_0x1cdcb4);}};EmailChannel[_0x940c('0xf')][_0x940c('0x1a')]=function(_0x39a552){for(var _0x57442c in _0x39a552){if(_0x39a552[_0x940c('0x1b')](_0x57442c)){if(_0x39a552[_0x57442c]['Imap']&&_0x39a552[_0x57442c][_0x940c('0x13')]){var _0x3f65a7=_0x39a552[_0x57442c][_0x940c('0x14')];if(!_0x3f65a7[_0x940c('0x1c')]&&_0x39a552[_0x57442c]['provider']!==_0x940c('0x1d'))_0x3f65a7['service']=_0x39a552[_0x57442c][_0x940c('0x1e')];if(!this['imapAccounts'][_0x940c('0x1b')](_0x3f65a7['id'])){this[_0x940c('0xd')][_0x3f65a7['id']]=new EmailImap(_0x3f65a7,_0x39a552[_0x57442c][_0x940c('0x5')]);this['imapAccounts'][_0x3f65a7['id']]['on'](_0x940c('0x1f'),this[_0x940c('0x20')][_0x940c('0x21')](this,_0x57442c));this['imapAccounts'][_0x3f65a7['id']]['on'](_0x940c('0x5'),this[_0x940c('0x22')][_0x940c('0x21')](this,_0x57442c));this[_0x940c('0xd')][_0x3f65a7['id']]['on'](_0x940c('0x23'),this[_0x940c('0x24')][_0x940c('0x21')](this,_0x57442c));this[_0x940c('0xd')][_0x3f65a7['id']]['on'](_0x940c('0x25'),this['handleImapError'][_0x940c('0x21')](this,_0x57442c));}}else{if(_[_0x940c('0x17')](this['mailAccounts'][_0x57442c][_0x940c('0x14')])){this[_0x940c('0xc')][_0x57442c]['Imap']={};}this['mailAccounts'][_0x57442c]['Imap']['status']=_0x940c('0x26');this['mailAccounts'][_0x57442c][_0x940c('0x14')][_0x940c('0x16')]='';this['emit'](_0x57442c);}}}};EmailChannel['prototype'][_0x940c('0x20')]=function(_0x2589ed,_0x1977d5){if(this['mailAccounts'][_0x2589ed]){this[_0x940c('0xc')][_0x2589ed][_0x940c('0x14')][_0x940c('0x15')]='connected';this[_0x940c('0xc')][_0x2589ed][_0x940c('0x14')]['messageStatus']=_0x1977d5[_0x940c('0x11')];if(_0x1977d5[_0x940c('0x27')]){this[_0x940c('0xc')][_0x2589ed][_0x940c('0x14')][_0x940c('0x28')]=_0x1977d5['messages'][_0x940c('0x28')];}return this['emit'](_0x2589ed);}};EmailChannel[_0x940c('0xf')][_0x940c('0x22')]=function(_0x3199b1,_0x3d62d6){logger[_0x940c('0xa')](_0x940c('0x29'),_0x3d62d6[_0x940c('0x2a')],_0x3d62d6[_0x940c('0x2b')],_0x3d62d6['from'],_0x3199b1);if(this[_0x940c('0xc')][_0x3199b1]){return mailAccount[_0x940c('0x2c')](_0x3199b1,_0x3d62d6)['then'](function(_0x5268c1){if(_0x5268c1){logger[_0x940c('0xa')](_0x940c('0x2d'));}})[_0x940c('0x2e')](function(_0x496899){logger['error'](_0x940c('0x2f'),JSON[_0x940c('0x18')](_0x496899));});}};EmailChannel[_0x940c('0xf')][_0x940c('0x24')]=function(_0x1c41fd){if(this[_0x940c('0xc')][_0x1c41fd]&&this[_0x940c('0xc')][_0x1c41fd][_0x940c('0x14')]){if(this[_0x940c('0xd')][this[_0x940c('0xc')][_0x1c41fd][_0x940c('0x14')]['id']]){delete this[_0x940c('0xd')][this[_0x940c('0xc')][_0x1c41fd]['Imap']['id']];}this[_0x940c('0xc')][_0x1c41fd]['Imap'][_0x940c('0x30')]=moment();this[_0x940c('0x10')](_0x1c41fd);}};EmailChannel['prototype'][_0x940c('0x31')]=function(_0x3a738f,_0x2ca7ab){if(this[_0x940c('0xc')][_0x3a738f]){this[_0x940c('0xc')][_0x3a738f][_0x940c('0x14')][_0x940c('0x15')]=_0x940c('0x25');this[_0x940c('0xc')][_0x3a738f][_0x940c('0x14')][_0x940c('0x16')]=_0x2ca7ab;return this[_0x940c('0x10')](_0x3a738f);}};EmailChannel[_0x940c('0xf')][_0x940c('0x32')]=function(_0x492958,_0x4257e1){return this['smtp'][_0x940c('0x33')](_0x492958,_0x4257e1);};EmailChannel[_0x940c('0xf')][_0x940c('0x34')]=function(_0x566e9f){var _0x2b03db=this;if(this[_0x940c('0xc')][_0x566e9f['id']]){if(_[_0x940c('0x17')](this[_0x940c('0xc')][_0x566e9f['id']][_0x940c('0x35')])){this[_0x940c('0xc')][_0x566e9f['id']][_0x940c('0x35')]={};}this[_0x940c('0xc')][_0x566e9f['id']][_0x940c('0x35')][_0x940c('0x30')]=moment();return new BPromise(function(_0x19a6d8,_0x19071e){return _0x2b03db[_0x940c('0xe')]['verify'](_0x566e9f)[_0x940c('0x36')](function(_0x180fc8){_0x2b03db[_0x940c('0xc')][_0x566e9f['id']][_0x940c('0x35')][_0x940c('0x15')]='verified';_0x2b03db[_0x940c('0xc')][_0x566e9f['id']][_0x940c('0x35')][_0x940c('0x16')]='';_0x2b03db[_0x940c('0x10')](_0x566e9f['id']);_0x19a6d8(_0x180fc8);})[_0x940c('0x2e')](function(_0x254d1e){_0x2b03db[_0x940c('0xc')][_0x566e9f['id']][_0x940c('0x35')][_0x940c('0x15')]='error';_0x2b03db['mailAccounts'][_0x566e9f['id']][_0x940c('0x35')][_0x940c('0x16')]=_0x254d1e;_0x2b03db[_0x940c('0x10')](_0x566e9f['id']);_0x19071e(_0x254d1e);});});}return this[_0x940c('0xe')][_0x940c('0x37')](_0x566e9f);};module['exports']=EmailChannel; \ No newline at end of file +var _0x30f6=['./imap','info','mailAccounts','imapAccounts','emit','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','service','custom','provider','hasOwnProperty','box','bind','handleImapEmail','end','error','handleImapError','status','disabled','handleImapBox','connected','name','messages','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','verifySmtp','Smtp','verified','verify','exports','lodash','moment','md5','ioredis','../../../config/environment','email','redis','localhost'];(function(_0x309b62,_0x5b7bc7){var _0x5f5397=function(_0x63fe69){while(--_0x63fe69){_0x309b62['push'](_0x309b62['shift']());}};_0x5f5397(++_0x5b7bc7);}(_0x30f6,0x190));var _0x630f=function(_0x678959,_0x256da5){_0x678959=_0x678959-0x0;var _0x1cee4e=_0x30f6[_0x678959];return _0x1cee4e;};'use strict';var _=require(_0x630f('0x0'));var moment=require(_0x630f('0x1'));var BPromise=require('bluebird');var md5=require(_0x630f('0x2'));var Redis=require(_0x630f('0x3'));var config=require(_0x630f('0x4'));var logger=require('../../../config/logger')(_0x630f('0x5'));config['redis']=_['defaults'](config[_0x630f('0x6')],{'host':_0x630f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x630f('0x6')]));var EmailImap=require(_0x630f('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5490d1){logger[_0x630f('0x9')]('start\x20email\x20channel');this['mailAccounts']=_0x5490d1[_0x630f('0xa')];this[_0x630f('0xb')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x630f('0xc')]=function(_0x2dcf97){var _0x35ec4e=this[_0x630f('0xa')][_0x2dcf97];var _0x417065={'id':_0x35ec4e['id'],'name':_0x35ec4e['name'],'key':_0x35ec4e[_0x630f('0xd')],'active':_0x35ec4e[_0x630f('0xe')],'Imap':{'status':_0x35ec4e[_0x630f('0xf')]['status'],'messageStatus':_0x35ec4e[_0x630f('0xf')][_0x630f('0x10')],'total':_0x35ec4e['Imap'][_0x630f('0x11')]}};if(_[_0x630f('0x12')](md5Accounts[_0x2dcf97])){md5Accounts[_0x2dcf97]={};}var _0x4e9a5e=md5(JSON[_0x630f('0x13')](_0x417065));if(md5Accounts[_0x2dcf97][_0x630f('0x2')]!==_0x4e9a5e){md5Accounts[_0x2dcf97][_0x630f('0x2')]=_0x4e9a5e;io[_0x630f('0xc')](_0x630f('0x14'),_0x417065);}};EmailChannel[_0x630f('0x15')][_0x630f('0x16')]=function(_0x2cb145){for(var _0xeb8bbd in _0x2cb145){if(_0x2cb145['hasOwnProperty'](_0xeb8bbd)){if(_0x2cb145[_0xeb8bbd]['Imap']&&_0x2cb145[_0xeb8bbd]['active']){var _0xf68f1a=_0x2cb145[_0xeb8bbd][_0x630f('0xf')];if(!_0xf68f1a[_0x630f('0x17')]&&_0x2cb145[_0xeb8bbd]['provider']!==_0x630f('0x18'))_0xf68f1a[_0x630f('0x17')]=_0x2cb145[_0xeb8bbd][_0x630f('0x19')];if(!this[_0x630f('0xb')][_0x630f('0x1a')](_0xf68f1a['id'])){this[_0x630f('0xb')][_0xf68f1a['id']]=new EmailImap(_0xf68f1a,_0x2cb145[_0xeb8bbd][_0x630f('0x5')]);this[_0x630f('0xb')][_0xf68f1a['id']]['on'](_0x630f('0x1b'),this['handleImapBox'][_0x630f('0x1c')](this,_0xeb8bbd));this[_0x630f('0xb')][_0xf68f1a['id']]['on']('email',this[_0x630f('0x1d')]['bind'](this,_0xeb8bbd));this[_0x630f('0xb')][_0xf68f1a['id']]['on'](_0x630f('0x1e'),this['handleImapEnd']['bind'](this,_0xeb8bbd));this[_0x630f('0xb')][_0xf68f1a['id']]['on'](_0x630f('0x1f'),this[_0x630f('0x20')][_0x630f('0x1c')](this,_0xeb8bbd));}}else{if(_[_0x630f('0x12')](this['mailAccounts'][_0xeb8bbd]['Imap'])){this['mailAccounts'][_0xeb8bbd]['Imap']={};}this['mailAccounts'][_0xeb8bbd][_0x630f('0xf')][_0x630f('0x21')]=_0x630f('0x22');this['mailAccounts'][_0xeb8bbd]['Imap'][_0x630f('0x10')]='';this['emit'](_0xeb8bbd);}}}};EmailChannel[_0x630f('0x15')][_0x630f('0x23')]=function(_0x10d2c3,_0x33b9fc){if(this[_0x630f('0xa')][_0x10d2c3]){this['mailAccounts'][_0x10d2c3]['Imap'][_0x630f('0x21')]=_0x630f('0x24');this[_0x630f('0xa')][_0x10d2c3][_0x630f('0xf')]['messageStatus']=_0x33b9fc[_0x630f('0x25')];if(_0x33b9fc['messages']){this[_0x630f('0xa')][_0x10d2c3][_0x630f('0xf')][_0x630f('0x11')]=_0x33b9fc[_0x630f('0x26')][_0x630f('0x11')];}return this[_0x630f('0xc')](_0x10d2c3);}};EmailChannel[_0x630f('0x15')][_0x630f('0x1d')]=function(_0x4159fe,_0x277e0e){logger[_0x630f('0x9')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x277e0e['firstName'],_0x277e0e['lastName'],_0x277e0e['from'],_0x4159fe);if(this['mailAccounts'][_0x4159fe]){return mailAccount[_0x630f('0x27')](_0x4159fe,_0x277e0e)[_0x630f('0x28')](function(_0x20e724){if(_0x20e724){logger[_0x630f('0x9')](_0x630f('0x29'));}})[_0x630f('0x2a')](function(_0x5d78ac){logger[_0x630f('0x1f')](_0x630f('0x2b'),JSON[_0x630f('0x13')](_0x5d78ac));});}};EmailChannel[_0x630f('0x15')]['handleImapEnd']=function(_0x3581d8){if(this[_0x630f('0xa')][_0x3581d8]&&this[_0x630f('0xa')][_0x3581d8][_0x630f('0xf')]){if(this[_0x630f('0xb')][this[_0x630f('0xa')][_0x3581d8][_0x630f('0xf')]['id']]){delete this[_0x630f('0xb')][this['mailAccounts'][_0x3581d8][_0x630f('0xf')]['id']];}this[_0x630f('0xa')][_0x3581d8][_0x630f('0xf')][_0x630f('0x2c')]=moment();this[_0x630f('0xc')](_0x3581d8);}};EmailChannel[_0x630f('0x15')]['handleImapError']=function(_0x2f23a3,_0x4c5f68){if(this['mailAccounts'][_0x2f23a3]){this[_0x630f('0xa')][_0x2f23a3]['Imap']['status']='error';this[_0x630f('0xa')][_0x2f23a3]['Imap'][_0x630f('0x10')]=_0x4c5f68;return this['emit'](_0x2f23a3);}};EmailChannel[_0x630f('0x15')]['sendMail']=function(_0x3c3e47,_0x1fc648){return this[_0x630f('0x2d')]['send'](_0x3c3e47,_0x1fc648);};EmailChannel[_0x630f('0x15')][_0x630f('0x2e')]=function(_0x467ea8){var _0x4786c9=this;if(this[_0x630f('0xa')][_0x467ea8['id']]){if(_[_0x630f('0x12')](this[_0x630f('0xa')][_0x467ea8['id']][_0x630f('0x2f')])){this[_0x630f('0xa')][_0x467ea8['id']][_0x630f('0x2f')]={};}this[_0x630f('0xa')][_0x467ea8['id']]['Smtp'][_0x630f('0x2c')]=moment();return new BPromise(function(_0x2492dc,_0x578601){return _0x4786c9['smtp']['verify'](_0x467ea8)[_0x630f('0x28')](function(_0x82f4ad){_0x4786c9['mailAccounts'][_0x467ea8['id']][_0x630f('0x2f')][_0x630f('0x21')]=_0x630f('0x30');_0x4786c9[_0x630f('0xa')][_0x467ea8['id']][_0x630f('0x2f')]['messageStatus']='';_0x4786c9[_0x630f('0xc')](_0x467ea8['id']);_0x2492dc(_0x82f4ad);})[_0x630f('0x2a')](function(_0x44dcde){_0x4786c9['mailAccounts'][_0x467ea8['id']][_0x630f('0x2f')][_0x630f('0x21')]=_0x630f('0x1f');_0x4786c9['mailAccounts'][_0x467ea8['id']]['Smtp'][_0x630f('0x10')]=_0x44dcde;_0x4786c9[_0x630f('0xc')](_0x467ea8['id']);_0x578601(_0x44dcde);});});}return this[_0x630f('0x2d')][_0x630f('0x31')](_0x467ea8);};module[_0x630f('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4fdeb6a..e1e70d9 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 _0xfe30=['ready','handleReady','bind','once','end','handleEnd','handleError','connect','inherits','getAccount','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','prototype','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','../../../config/logger','email','mailbox','account'];(function(_0xe2b013,_0x5790ce){var _0x37e2cc=function(_0x146231){while(--_0x146231){_0xe2b013['push'](_0xe2b013['shift']());}};_0x37e2cc(++_0x5790ce);}(_0xfe30,0x1ec));var _0x0fe3=function(_0x2a00dd,_0x10da34){_0x2a00dd=_0x2a00dd-0x0;var _0x54613f=_0xfe30[_0x2a00dd];return _0x54613f;};'use strict';var _=require(_0x0fe3('0x0'));var util=require(_0x0fe3('0x1'));var Imap=require(_0x0fe3('0x2'));var simpleParser=require(_0x0fe3('0x3'))[_0x0fe3('0x4')];var Iconv=require(_0x0fe3('0x5'))[_0x0fe3('0x6')];var EventEmitter=require(_0x0fe3('0x7'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x0fe3('0x8'))(_0x0fe3('0x9'));function EmailImap(_0x5375c8,_0x26861b){this[_0x0fe3('0xa')]=_0x5375c8[_0x0fe3('0xa')];this[_0x0fe3('0xb')]=this['getAccount'](_0x5375c8,_0x26861b);this[_0x0fe3('0x2')]=new Imap(this[_0x0fe3('0xb')]);this[_0x0fe3('0x2')]['once'](_0x0fe3('0xc'),this[_0x0fe3('0xd')][_0x0fe3('0xe')](this));this[_0x0fe3('0x2')][_0x0fe3('0xf')](_0x0fe3('0x10'),this[_0x0fe3('0x11')][_0x0fe3('0xe')](this));this[_0x0fe3('0x2')]['on']('error',this[_0x0fe3('0x12')][_0x0fe3('0xe')](this));this[_0x0fe3('0x2')][_0x0fe3('0x13')]();}util[_0x0fe3('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x0fe3('0x15')]=function(_0x4faa93,_0x1e28f1){var _0x49b525={'connTimeout':_0x4faa93[_0x0fe3('0x16')]?_0x4faa93['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4faa93[_0x0fe3('0x17')]?_0x4faa93['authTimeout']*0x3e8:0x1388};if(_0x4faa93['service']){_0x49b525[_0x0fe3('0x18')]=_0x4faa93[_0x0fe3('0x18')];if(_0x4faa93[_0x0fe3('0x19')]){_0x49b525[_0x0fe3('0x1a')]=utils[_0x0fe3('0x1b')](_0x4faa93[_0x0fe3('0x1c')]['data5'],_0x4faa93[_0x0fe3('0x18')]);}else{_0x49b525[_0x0fe3('0x1d')]=_0x4faa93['password'];}}else{if(_0x4faa93[_0x0fe3('0x1e')]){_0x49b525[_0x0fe3('0x18')]=_0x4faa93['user'];_0x49b525[_0x0fe3('0x1d')]=_0x4faa93['password'];}}_0x49b525[_0x0fe3('0x9')]=_0x1e28f1||_0x4faa93[_0x0fe3('0x18')]||_0x0fe3('0x1f');_0x49b525[_0x0fe3('0x20')]=_0x4faa93[_0x0fe3('0x20')];_0x49b525[_0x0fe3('0x21')]=_0x4faa93[_0x0fe3('0x21')]||0x3e1;if(_0x4faa93['tls']){_0x49b525[_0x0fe3('0x22')]=!![];}else{_0x49b525[_0x0fe3('0x22')]=![];_0x49b525['autotls']='required';}return _0x49b525;};EmailImap['prototype'][_0x0fe3('0xd')]=function(){this[_0x0fe3('0x2')]['openBox'](this['mailbox'],![],this['handleOpenBox'][_0x0fe3('0xe')](this));};EmailImap[_0x0fe3('0x23')]['handleOpenBox']=function(_0x2d3ebc,_0x4e9418){if(_0x2d3ebc){this['handleError'](_0x2d3ebc,!![]);}else{this[_0x0fe3('0x24')](_0x0fe3('0x25'),_0x4e9418);this[_0x0fe3('0x26')]();}};EmailImap['prototype'][_0x0fe3('0x27')]=function(_0x3e3b24){if(_0x3e3b24){this[_0x0fe3('0x12')](_0x3e3b24,!![]);}else{this['imap'][_0x0fe3('0x10')]();}};EmailImap[_0x0fe3('0x23')][_0x0fe3('0x26')]=function(){this[_0x0fe3('0x2')][_0x0fe3('0x28')]([_0x0fe3('0x29')],this[_0x0fe3('0x2a')][_0x0fe3('0xe')](this));};EmailImap[_0x0fe3('0x23')][_0x0fe3('0x2a')]=function(_0x479d1a,_0x384387){if(_0x479d1a){this[_0x0fe3('0x12')](_0x479d1a,!![]);}else{if(_0x384387[_0x0fe3('0x2b')]){try{var _0x18ee79=this[_0x0fe3('0x2')][_0x0fe3('0x2c')](_0x384387,{'bodies':'','markSeen':!![]});_0x18ee79['on'](_0x0fe3('0x2d'),this[_0x0fe3('0x2e')]['bind'](this));_0x18ee79[_0x0fe3('0xf')](_0x0fe3('0x2f'),this['handleFetchError'][_0x0fe3('0xe')](this));_0x18ee79[_0x0fe3('0xf')](_0x0fe3('0x10'),this[_0x0fe3('0x30')]['bind'](this));}catch(_0x49e570){logger[_0x0fe3('0x2f')](_0x49e570);}}else{this[_0x0fe3('0x2')][_0x0fe3('0x31')](!![],this[_0x0fe3('0x27')][_0x0fe3('0xe')](this));}}};EmailImap[_0x0fe3('0x23')][_0x0fe3('0x2e')]=function(_0x5e4711){_0x5e4711['on'](_0x0fe3('0x32'),this[_0x0fe3('0x33')][_0x0fe3('0xe')](this));_0x5e4711[_0x0fe3('0xf')](_0x0fe3('0x34'),this[_0x0fe3('0x35')]['bind'](this));_0x5e4711[_0x0fe3('0xf')](_0x0fe3('0x10'),this['handleMessageEnd'][_0x0fe3('0xe')](this));};EmailImap[_0x0fe3('0x23')][_0x0fe3('0x33')]=function(_0x53cd47){simpleParser(_0x53cd47,{'Iconv':Iconv},this['handleSimpleParser'][_0x0fe3('0xe')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x0fe3('0x36')]=function(){};EmailImap['prototype'][_0x0fe3('0x37')]=function(_0x5e5290,_0x525830){if(_0x5e5290){logger['error'](_0x5e5290);}else{var _0x3a2ca0=this;utils[_0x0fe3('0x38')](this[_0x0fe3('0xb')],_0x525830,function(_0x4af612){_0x3a2ca0[_0x0fe3('0x24')]('email',_0x4af612);});}};EmailImap['prototype'][_0x0fe3('0x30')]=function(){this['imap']['closeBox'](!![],this[_0x0fe3('0x27')]['bind'](this));};EmailImap[_0x0fe3('0x23')][_0x0fe3('0x39')]=function(_0x3d3780){this[_0x0fe3('0x12')](_0x3d3780);this['imap'][_0x0fe3('0x31')](!![],this[_0x0fe3('0x27')][_0x0fe3('0xe')](this));};EmailImap['prototype'][_0x0fe3('0x11')]=function(){this['emit'](_0x0fe3('0x10'));};EmailImap[_0x0fe3('0x23')]['handleError']=function(_0x1ae278,_0x251bb0){logger[_0x0fe3('0x2f')](_0x0fe3('0x12'),this['account']['email'],JSON[_0x0fe3('0x3a')](_0x1ae278));var _0x413e78='';if(_0x1ae278){if(_0x1ae278[_0x0fe3('0x3b')]){_0x413e78=_0x1ae278[_0x0fe3('0x3b')];}else{for(var _0xeea6fe in _0x1ae278){if(_0x1ae278[_0x0fe3('0x3c')](_0xeea6fe)){_0x413e78+=_[_0x0fe3('0x3d')](_0xeea6fe)+':\x20'+_0x1ae278[_0xeea6fe]+'\x0a';}}}}if(_0x251bb0){this[_0x0fe3('0x2')][_0x0fe3('0x10')]();}else{this[_0x0fe3('0x24')](_0x0fe3('0x2f'),_0x413e78);this['emit']('end');}};module[_0x0fe3('0x3e')]=EmailImap; \ No newline at end of file +var _0x4d0c=['handleMessageEnd','handleSimpleParser','parser','emit','handleFetchError','stringify','textCode','upperFirst','exports','lodash','util','mailparser','simpleParser','iconv','mailbox','account','getAccount','imap','handleReady','once','end','handleEnd','bind','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','email','host','port','tls','autotls','required','openBox','handleOpenBox','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','error','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes'];(function(_0x51186a,_0x3a4e16){var _0x545fac=function(_0x170019){while(--_0x170019){_0x51186a['push'](_0x51186a['shift']());}};_0x545fac(++_0x3a4e16);}(_0x4d0c,0x135));var _0xc4d0=function(_0x2cb786,_0x2a2f06){_0x2cb786=_0x2cb786-0x0;var _0x2c1854=_0x4d0c[_0x2cb786];return _0x2c1854;};'use strict';var _=require(_0xc4d0('0x0'));var util=require(_0xc4d0('0x1'));var Imap=require('imap');var simpleParser=require(_0xc4d0('0x2'))[_0xc4d0('0x3')];var Iconv=require(_0xc4d0('0x4'))['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0x4f576d,_0x7bc2ba){this[_0xc4d0('0x5')]=_0x4f576d[_0xc4d0('0x5')];this[_0xc4d0('0x6')]=this[_0xc4d0('0x7')](_0x4f576d,_0x7bc2ba);this[_0xc4d0('0x8')]=new Imap(this['account']);this[_0xc4d0('0x8')]['once']('ready',this[_0xc4d0('0x9')]['bind'](this));this[_0xc4d0('0x8')][_0xc4d0('0xa')](_0xc4d0('0xb'),this[_0xc4d0('0xc')][_0xc4d0('0xd')](this));this[_0xc4d0('0x8')]['on']('error',this[_0xc4d0('0xe')][_0xc4d0('0xd')](this));this['imap']['connect']();}util[_0xc4d0('0xf')](EmailImap,EventEmitter);EmailImap[_0xc4d0('0x10')]['getAccount']=function(_0x31a9d0,_0x19187a){var _0x2fc1f3={'connTimeout':_0x31a9d0[_0xc4d0('0x11')]?_0x31a9d0[_0xc4d0('0x11')]*0x3e8:0x2710,'authTimeout':_0x31a9d0[_0xc4d0('0x12')]?_0x31a9d0['authTimeout']*0x3e8:0x1388};if(_0x31a9d0[_0xc4d0('0x13')]){_0x2fc1f3[_0xc4d0('0x14')]=_0x31a9d0[_0xc4d0('0x14')];if(_0x31a9d0[_0xc4d0('0x15')]){_0x2fc1f3[_0xc4d0('0x16')]=utils[_0xc4d0('0x17')](_0x31a9d0['CloudProvider'][_0xc4d0('0x18')],_0x31a9d0['user']);}else{_0x2fc1f3[_0xc4d0('0x19')]=_0x31a9d0['password'];}}else{if(_0x31a9d0[_0xc4d0('0x1a')]){_0x2fc1f3[_0xc4d0('0x14')]=_0x31a9d0['user'];_0x2fc1f3['password']=_0x31a9d0[_0xc4d0('0x19')];}}_0x2fc1f3[_0xc4d0('0x1b')]=_0x19187a||_0x31a9d0['user']||'anonymous@xcally.com';_0x2fc1f3[_0xc4d0('0x1c')]=_0x31a9d0[_0xc4d0('0x1c')];_0x2fc1f3[_0xc4d0('0x1d')]=_0x31a9d0[_0xc4d0('0x1d')]||0x3e1;if(_0x31a9d0[_0xc4d0('0x1e')]){_0x2fc1f3[_0xc4d0('0x1e')]=!![];}else{_0x2fc1f3[_0xc4d0('0x1e')]=![];_0x2fc1f3[_0xc4d0('0x1f')]=_0xc4d0('0x20');}return _0x2fc1f3;};EmailImap['prototype'][_0xc4d0('0x9')]=function(){this[_0xc4d0('0x8')][_0xc4d0('0x21')](this[_0xc4d0('0x5')],![],this[_0xc4d0('0x22')][_0xc4d0('0xd')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x44f92b,_0x3889c9){if(_0x44f92b){this[_0xc4d0('0xe')](_0x44f92b,!![]);}else{this['emit'](_0xc4d0('0x23'),_0x3889c9);this['readUnseen']();}};EmailImap[_0xc4d0('0x10')][_0xc4d0('0x24')]=function(_0x2f7980){if(_0x2f7980){this['handleError'](_0x2f7980,!![]);}else{this['imap'][_0xc4d0('0xb')]();}};EmailImap['prototype'][_0xc4d0('0x25')]=function(){this['imap'][_0xc4d0('0x26')]([_0xc4d0('0x27')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xc4d0('0x10')][_0xc4d0('0x28')]=function(_0x3d6c11,_0x2069a9){if(_0x3d6c11){this[_0xc4d0('0xe')](_0x3d6c11,!![]);}else{if(_0x2069a9['length']){try{var _0x59e6c6=this[_0xc4d0('0x8')][_0xc4d0('0x29')](_0x2069a9,{'bodies':'','markSeen':!![]});_0x59e6c6['on'](_0xc4d0('0x2a'),this[_0xc4d0('0x2b')]['bind'](this));_0x59e6c6[_0xc4d0('0xa')](_0xc4d0('0x2c'),this['handleFetchError'][_0xc4d0('0xd')](this));_0x59e6c6['once'](_0xc4d0('0xb'),this[_0xc4d0('0x2d')][_0xc4d0('0xd')](this));}catch(_0x23ab73){logger[_0xc4d0('0x2c')](_0x23ab73);}}else{this[_0xc4d0('0x8')][_0xc4d0('0x2e')](!![],this[_0xc4d0('0x24')]['bind'](this));}}};EmailImap[_0xc4d0('0x10')][_0xc4d0('0x2b')]=function(_0xb0d43a){_0xb0d43a['on'](_0xc4d0('0x2f'),this[_0xc4d0('0x30')]['bind'](this));_0xb0d43a[_0xc4d0('0xa')](_0xc4d0('0x31'),this[_0xc4d0('0x32')][_0xc4d0('0xd')](this));_0xb0d43a[_0xc4d0('0xa')](_0xc4d0('0xb'),this[_0xc4d0('0x33')][_0xc4d0('0xd')](this));};EmailImap['prototype'][_0xc4d0('0x30')]=function(_0x25b196){simpleParser(_0x25b196,{'Iconv':Iconv},this['handleSimpleParser'][_0xc4d0('0xd')](this));};EmailImap[_0xc4d0('0x10')][_0xc4d0('0x32')]=function(){};EmailImap[_0xc4d0('0x10')][_0xc4d0('0x33')]=function(){};EmailImap['prototype'][_0xc4d0('0x34')]=function(_0x246b35,_0xf31633){if(_0x246b35){logger[_0xc4d0('0x2c')](_0x246b35);}else{var _0x524b3c=this;utils[_0xc4d0('0x35')](this[_0xc4d0('0x6')],_0xf31633,function(_0x33ba28){_0x524b3c[_0xc4d0('0x36')]('email',_0x33ba28);});}};EmailImap[_0xc4d0('0x10')]['handleFetchEnd']=function(){this[_0xc4d0('0x8')][_0xc4d0('0x2e')](!![],this[_0xc4d0('0x24')][_0xc4d0('0xd')](this));};EmailImap[_0xc4d0('0x10')][_0xc4d0('0x37')]=function(_0x3dede5){this[_0xc4d0('0xe')](_0x3dede5);this[_0xc4d0('0x8')][_0xc4d0('0x2e')](!![],this[_0xc4d0('0x24')][_0xc4d0('0xd')](this));};EmailImap['prototype'][_0xc4d0('0xc')]=function(){this[_0xc4d0('0x36')]('end');};EmailImap['prototype'][_0xc4d0('0xe')]=function(_0x4dd5c7,_0x1af7c0){logger['error']('handleError',this[_0xc4d0('0x6')][_0xc4d0('0x1b')],JSON[_0xc4d0('0x38')](_0x4dd5c7));var _0x237bd1='';if(_0x4dd5c7){if(_0x4dd5c7[_0xc4d0('0x39')]){_0x237bd1=_0x4dd5c7[_0xc4d0('0x39')];}else{for(var _0x346b91 in _0x4dd5c7){if(_0x4dd5c7['hasOwnProperty'](_0x346b91)){_0x237bd1+=_[_0xc4d0('0x3a')](_0x346b91)+':\x20'+_0x4dd5c7[_0x346b91]+'\x0a';}}}}if(_0x1af7c0){this[_0xc4d0('0x8')][_0xc4d0('0xb')]();}else{this[_0xc4d0('0x36')](_0xc4d0('0x2c'),_0x237bd1);this[_0xc4d0('0x36')](_0xc4d0('0xb'));}};module[_0xc4d0('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 1cc554f..ebce767 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 _0xb4f9=['createTransport','compile','verify','toString','Not\x20verifired','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x410b9c,_0x7e820d){var _0x5b3036=function(_0x138bdc){while(--_0x138bdc){_0x410b9c['push'](_0x410b9c['shift']());}};_0x5b3036(++_0x7e820d);}(_0xb4f9,0x15d));var _0x9b4f=function(_0x57f6ad,_0x4795b6){_0x57f6ad=_0x57f6ad-0x0;var _0x425c09=_0xb4f9[_0x57f6ad];return _0x425c09;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x9b4f('0x0'));function EmailSmtp(){}EmailSmtp[_0x9b4f('0x1')][_0x9b4f('0x2')]=function(_0x276771,_0x1db0ba){return new Promise(function(_0x1fc0d9,_0xa95700){var _0x17b315=nodemailer[_0x9b4f('0x3')](_0x276771);_0x17b315['use'](_0x9b4f('0x4'),inlineBase64());_0x17b315['sendMail'](_0x1db0ba,function(_0x471ca6,_0x24b773){if(_0x471ca6){_0xa95700(_0x471ca6['toString']());}else{_0x1fc0d9(_0x24b773);}});});};EmailSmtp['prototype'][_0x9b4f('0x5')]=function(_0x5505f1){return new Promise(function(_0x5a2ceb,_0x34e28b){var _0x5e78a7=nodemailer[_0x9b4f('0x3')](_0x5505f1);_0x5e78a7['verify'](function(_0x16ac12,_0xfda6e){if(_0x16ac12){_0x34e28b(_0x16ac12[_0x9b4f('0x6')]());}else{if(_0xfda6e){_0x5a2ceb(_0xfda6e);}else{_0x34e28b(_0x9b4f('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x48e3=['use','compile','sendMail','toString','verify','createTransport','nodemailer-plugin-inline-base64','prototype','send'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0x48e3,0x1da));var _0x348e=function(_0xdc5654,_0xea4a9c){_0xdc5654=_0xdc5654-0x0;var _0x2541f8=_0x48e3[_0xdc5654];return _0x2541f8;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x348e('0x0'));function EmailSmtp(){}EmailSmtp[_0x348e('0x1')][_0x348e('0x2')]=function(_0x2097b0,_0x1732f9){return new Promise(function(_0x55fd5c,_0x725941){var _0x3af67e=nodemailer['createTransport'](_0x2097b0);_0x3af67e[_0x348e('0x3')](_0x348e('0x4'),inlineBase64());_0x3af67e[_0x348e('0x5')](_0x1732f9,function(_0x47d745,_0x95ed4f){if(_0x47d745){_0x725941(_0x47d745[_0x348e('0x6')]());}else{_0x55fd5c(_0x95ed4f);}});});};EmailSmtp['prototype'][_0x348e('0x7')]=function(_0x580051){return new Promise(function(_0x310b91,_0x593640){var _0x2dba23=nodemailer[_0x348e('0x8')](_0x580051);_0x2dba23[_0x348e('0x7')](function(_0x588dee,_0xb0a65e){if(_0x588dee){_0x593640(_0x588dee[_0x348e('0x6')]());}else{if(_0xb0a65e){_0x310b91(_0xb0a65e);}else{_0x593640('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 66232fa..4c3d959 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 _0x382a=['indexOf','split','length','slice','Anonymous','isEmpty','@xcally.com','html','replace','includes','attachments','forEach','push','filename','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','base64','moment','randomstring','path','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','name','substring'];(function(_0x36c6c6,_0x103c44){var _0x4bd317=function(_0xf4188a){while(--_0xf4188a){_0x36c6c6['push'](_0x36c6c6['shift']());}};_0x4bd317(++_0x103c44);}(_0x382a,0x197));var _0xa382=function(_0x4d3287,_0xe83871){_0x4d3287=_0x4d3287-0x0;var _0x3e46fc=_0x382a[_0x4d3287];return _0x3e46fc;};'use strict';var _=require('lodash');var moment=require(_0xa382('0x0'));var random=require(_0xa382('0x1'));var fs=require('fs');var path=require(_0xa382('0x2'));var util=require('util');var tnef=require(_0xa382('0x3'));var logger=require(_0xa382('0x4'))(_0xa382('0x5'));var config=require('../../../config/environment');function getAddress(_0xc8e2ea){var _0x1bea6c=_[_0xa382('0x6')](_0xc8e2ea[_0xa382('0x7')]);return _0x1bea6c&&_0x1bea6c[_0xa382('0x8')]?_0x1bea6c['address']:_0xa382('0x9')+random[_0xa382('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x145bf9){var _0x33fd37=_['head'](_0x145bf9['value']);if(_0x33fd37&&_0x33fd37[_0xa382('0xb')]){if(_0x33fd37[_0xa382('0xb')]==_0x33fd37['address']){return _0x33fd37[_0xa382('0xb')][_0xa382('0xc')](0x0,_0x33fd37[_0xa382('0xb')][_0xa382('0xd')]('@'));}var _0x520874=_0x33fd37[_0xa382('0xb')][_0xa382('0xe')](/\s+/);return _0x520874[_0xa382('0xf')]>0x1?_0x520874[_0xa382('0x10')](0x0,-0x1)['join']('\x20'):_0x33fd37[_0xa382('0xb')];}return _0xa382('0x11');}function getLastName(_0x43bc60){var _0x357d06=_[_0xa382('0x6')](_0x43bc60[_0xa382('0x7')]);if(_0x357d06&&_0x357d06[_0xa382('0xb')]){var _0x4e30f7=_0x357d06[_0xa382('0xb')][_0xa382('0xe')](/\s+/);return _0x4e30f7[_0xa382('0xf')]>0x1?_0x4e30f7['pop']():'';}return'';}function getMails(_0x216d35,_0x314472){var _0x537d0a='';for(var _0x4215a7=0x0;_0x4215a7<_0x314472['value'][_0xa382('0xf')];_0x4215a7+=0x1){if(_0x314472[_0xa382('0x7')][_0x4215a7][_0xa382('0x8')]!==_0x216d35){if(!_[_0xa382('0x12')](_0x537d0a)){_0x537d0a+=',';}_0x537d0a+=_0x314472[_0xa382('0x7')][_0x4215a7][_0xa382('0xb')]||_0x314472[_0xa382('0x7')][_0x4215a7][_0xa382('0x8')]||'';_0x537d0a+='\x20<';_0x537d0a+=_0x314472[_0xa382('0x7')][_0x4215a7][_0xa382('0x8')]?_0x314472['value'][_0x4215a7][_0xa382('0x8')]:_0xa382('0x9')+random[_0xa382('0xa')](0x6)+_0xa382('0x13');_0x537d0a+='>';}}return _0x537d0a;}function parseEmail(_0x6a88a7,_0x133de6,_0x246857){if(_0x133de6['html']){var _0x13e3cb=/)<[^<]*)*<\/script>/gi;while(_0x13e3cb['test'](_0x133de6[_0xa382('0x14')])){_0x133de6['html']=_0x133de6[_0xa382('0x14')][_0xa382('0x15')](_0x13e3cb,'');}if(_0x133de6[_0xa382('0x14')][_0xa382('0x16')]('{_0x2990af[_0xa382('0x19')](_0x5f0054[_0xa382('0x1a')]);});var _0x25e615=/]+>/g;var _0x30d2a2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x515fc4=_0x133de6[_0xa382('0x14')][_0xa382('0x15')](_0x30d2a2,'_SRC');var _0x17269d=_0x515fc4[_0xa382('0x15')](_0x25e615,_0xa382('0x1b'));for(let _0x3297d5=0x0;_0x3297d5<_0x2990af[_0xa382('0xf')];_0x3297d5++){var _0xe4d403=_0x17269d['replace']('_IMG',_0xa382('0x1c')+_0x2990af[_0x3297d5]+_0xa382('0x1d'));_0x17269d=_0xe4d403;}_0x133de6['html']=_0x17269d;}_0x246857[_0xa382('0x1e')]=_0x133de6[_0xa382('0x14')];}else{_0x246857[_0xa382('0x1e')]=_0x133de6[_0xa382('0x1f')];}if(_0x246857[_0xa382('0x1e')]){_0x246857[_0xa382('0x1e')]=_0x246857[_0xa382('0x1e')][_0xa382('0x15')](/0x0){var _0x42fd7f=['Auto-Submitted:\x20auto-replied',_0xa382('0x2f'),_0xa382('0x30')];for(var _0x475d87=0x0;_0x475d87<_0x133de6[_0xa382('0x2e')][_0xa382('0xf')];_0x475d87++){var _0x21091b=_['indexOf'](_0x42fd7f,_0x133de6[_0xa382('0x2e')][_0x475d87][_0xa382('0x31')]);if(_0x21091b>=0x0){_0x246857['isAutoreply']=!![];}}}return _0x246857;}exports[_0xa382('0x32')]=function(_0x54aecd,_0x5ea2cc,_0x249ff9){var _0x10b0fc={'from':getAddress(_0x5ea2cc[_0xa382('0x33')]),'firstName':getFirstName(_0x5ea2cc[_0xa382('0x33')]),'lastName':getLastName(_0x5ea2cc[_0xa382('0x33')]),'mapKey':_0xa382('0x5'),'message':{'from':getMails(_0x54aecd[_0xa382('0x5')],_0x5ea2cc[_0xa382('0x33')]),'to':_0x54aecd['email'],'cc':'','subject':_0x5ea2cc['subject']||'','messageId':_0x5ea2cc[_0xa382('0x34')],'inReplyTo':_0x5ea2cc[_0xa382('0x35')],'sentAt':moment(_0x5ea2cc[_0xa382('0x36')])[_0xa382('0x28')](_0xa382('0x37')),'attach':![],'attachments':[]}};if(!_0x5ea2cc[_0xa382('0x14')]&&!_0x5ea2cc[_0xa382('0x1f')]){var _0x303d78=_[_0xa382('0x38')](_0x5ea2cc[_0xa382('0x17')],{'contentType':_0xa382('0x39')});if(_0x303d78['length']){logger[_0xa382('0x3a')](util[_0xa382('0x28')](_0xa382('0x3b'),_0x5ea2cc[_0xa382('0x34')]));tnef[_0xa382('0x3c')](_[_0xa382('0x3d')](_0x303d78)['content'],function(_0x42f4f5,_0x50d210){if(_0x50d210){_0x5ea2cc[_0xa382('0x14')]=_0x50d210[_0xa382('0x3e')]||_0xa382('0x3f');if(_0x50d210['Attachments']){for(var _0x38e1dc=0x0;_0x38e1dc<_0x50d210[_0xa382('0x40')]['length'];_0x38e1dc++){var _0x3933ec=_0x50d210[_0xa382('0x40')][_0x38e1dc];_0x10b0fc['message'][_0xa382('0x17')][_0xa382('0x19')]({'filename':_0x3933ec[_0xa382('0x41')],'content':Buffer[_0xa382('0x33')](_0x3933ec[_0xa382('0x42')])});}}}_0x249ff9(parseEmail(_0x54aecd,_0x5ea2cc,_0x10b0fc));});}else{_0x5ea2cc[_0xa382('0x14')]=_0xa382('0x3f');_0x249ff9(parseEmail(_0x54aecd,_0x5ea2cc,_0x10b0fc));}}else{_0x249ff9(parseEmail(_0x54aecd,_0x5ea2cc,_0x10b0fc));}};exports[_0xa382('0x43')]=function(_0x558c2d,_0x5c7074){var _0x206efd=['user='+(_0x5c7074||''),_0xa382('0x44')+_0x558c2d,'',''];return Buffer[_0xa382('0x33')](_0x206efd['join'](''),'utf-8')['toString'](_0xa382('0x45'));}; \ No newline at end of file +var _0x1794=['\x20]','body','Empty\x20message

','generateXOAuth2Token','user=','base64','moment','randomstring','path','../../../config/logger','email','head','address','generate','value','name','indexOf','length','slice','join','Anonymous','split','pop','anonymous','@xcally.com','html','replace','\x20[Attachment:\x20'];(function(_0x1e028c,_0x2bd5b0){var _0x336831=function(_0x506de1){while(--_0x506de1){_0x1e028c['push'](_0x1e028c['shift']());}};_0x336831(++_0x2bd5b0);}(_0x1794,0x69));var _0x4179=function(_0x1aa552,_0x3ac508){_0x1aa552=_0x1aa552-0x0;var _0x4a773d=_0x1794[_0x1aa552];return _0x4a773d;};'use strict';var _=require('lodash');var moment=require(_0x4179('0x0'));var random=require(_0x4179('0x1'));var fs=require('fs');var path=require(_0x4179('0x2'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0x4179('0x3'))(_0x4179('0x4'));var config=require('../../../config/environment');function getAddress(_0x68ede7){var _0x139d2a=_[_0x4179('0x5')](_0x68ede7['value']);return _0x139d2a&&_0x139d2a[_0x4179('0x6')]?_0x139d2a[_0x4179('0x6')]:'anonymous'+random[_0x4179('0x7')](0x6)+'@xcally.com';}function getFirstName(_0x198019){var _0x54c5a9=_[_0x4179('0x5')](_0x198019[_0x4179('0x8')]);if(_0x54c5a9&&_0x54c5a9[_0x4179('0x9')]){if(_0x54c5a9['name']==_0x54c5a9[_0x4179('0x6')]){return _0x54c5a9['name']['substring'](0x0,_0x54c5a9[_0x4179('0x9')][_0x4179('0xa')]('@'));}var _0x52bcdd=_0x54c5a9[_0x4179('0x9')]['split'](/\s+/);return _0x52bcdd[_0x4179('0xb')]>0x1?_0x52bcdd[_0x4179('0xc')](0x0,-0x1)[_0x4179('0xd')]('\x20'):_0x54c5a9[_0x4179('0x9')];}return _0x4179('0xe');}function getLastName(_0x4a65fb){var _0x1138bc=_['head'](_0x4a65fb[_0x4179('0x8')]);if(_0x1138bc&&_0x1138bc['name']){var _0x5370f0=_0x1138bc[_0x4179('0x9')][_0x4179('0xf')](/\s+/);return _0x5370f0[_0x4179('0xb')]>0x1?_0x5370f0[_0x4179('0x10')]():'';}return'';}function getMails(_0x45a762,_0x388ca1){var _0xda12a7='';for(var _0x284b4c=0x0;_0x284b4c<_0x388ca1[_0x4179('0x8')][_0x4179('0xb')];_0x284b4c+=0x1){if(_0x388ca1[_0x4179('0x8')][_0x284b4c]['address']!==_0x45a762){if(!_['isEmpty'](_0xda12a7)){_0xda12a7+=',';}_0xda12a7+=_0x388ca1[_0x4179('0x8')][_0x284b4c][_0x4179('0x9')]||_0x388ca1[_0x4179('0x8')][_0x284b4c]['address']||'';_0xda12a7+='\x20<';_0xda12a7+=_0x388ca1[_0x4179('0x8')][_0x284b4c][_0x4179('0x6')]?_0x388ca1['value'][_0x284b4c][_0x4179('0x6')]:_0x4179('0x11')+random[_0x4179('0x7')](0x6)+_0x4179('0x12');_0xda12a7+='>';}}return _0xda12a7;}function parseEmail(_0x25a903,_0x267bec,_0x3efb9a){if(_0x267bec['html']){var _0x451fb7=/)<[^<]*)*<\/script>/gi;while(_0x451fb7['test'](_0x267bec[_0x4179('0x13')])){_0x267bec[_0x4179('0x13')]=_0x267bec[_0x4179('0x13')][_0x4179('0x14')](_0x451fb7,'');}if(_0x267bec[_0x4179('0x13')]['includes'](_0x4179('0x15'))){var _0x451002=[];_0x267bec[_0x4179('0x16')]['forEach'](_0x5d079a=>{_0x451002[_0x4179('0x17')](_0x5d079a['filename']);});var _0x282046=/]+>/g;var _0x173ba7=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5a6549=_0x267bec['html'][_0x4179('0x14')](_0x173ba7,_0x4179('0x18'));var _0x2402d4=_0x5a6549[_0x4179('0x14')](_0x282046,_0x4179('0x19'));for(let _0x5b5a67=0x0;_0x5b5a67<_0x451002[_0x4179('0xb')];_0x5b5a67++){var _0xf7c0fe=_0x2402d4[_0x4179('0x14')](_0x4179('0x19'),_0x4179('0x1a')+_0x451002[_0x5b5a67]+_0x4179('0x1b'));_0x2402d4=_0xf7c0fe;}_0x267bec[_0x4179('0x13')]=_0x2402d4;}_0x3efb9a[_0x4179('0x1c')]=_0x267bec[_0x4179('0x13')];}else{_0x3efb9a['body']=_0x267bec['textAsHtml'];}if(_0x3efb9a[_0x4179('0x1c')]){_0x3efb9a[_0x4179('0x1c')]=_0x3efb9a['body'][_0x4179('0x14')](/0x0){var _0x1b0032=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x11bc91=0x0;_0x11bc91<_0x267bec[_0x4179('0x2d')][_0x4179('0xb')];_0x11bc91++){var _0x917416=_[_0x4179('0xa')](_0x1b0032,_0x267bec[_0x4179('0x2d')][_0x11bc91][_0x4179('0x2e')]);if(_0x917416>=0x0){_0x3efb9a[_0x4179('0x2f')]=!![];}}}return _0x3efb9a;}exports[_0x4179('0x30')]=function(_0x5c6109,_0x3b9e38,_0x57e687){var _0x4a2871={'from':getAddress(_0x3b9e38[_0x4179('0x31')]),'firstName':getFirstName(_0x3b9e38['from']),'lastName':getLastName(_0x3b9e38[_0x4179('0x31')]),'mapKey':_0x4179('0x4'),'message':{'from':getMails(_0x5c6109[_0x4179('0x4')],_0x3b9e38[_0x4179('0x31')]),'to':_0x5c6109[_0x4179('0x4')],'cc':'','subject':_0x3b9e38[_0x4179('0x32')]||'','messageId':_0x3b9e38[_0x4179('0x33')],'inReplyTo':_0x3b9e38[_0x4179('0x34')],'sentAt':moment(_0x3b9e38['date'])[_0x4179('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3b9e38[_0x4179('0x13')]&&!_0x3b9e38[_0x4179('0x35')]){var _0x2be6f3=_[_0x4179('0x36')](_0x3b9e38[_0x4179('0x16')],{'contentType':_0x4179('0x37')});if(_0x2be6f3[_0x4179('0xb')]){logger[_0x4179('0x38')](util[_0x4179('0x27')](_0x4179('0x39'),_0x3b9e38['messageId']));tnef['parseBuffer'](_[_0x4179('0x3a')](_0x2be6f3)[_0x4179('0x2b')],function(_0x5ebd5d,_0x3cce3b){if(_0x3cce3b){_0x3b9e38[_0x4179('0x13')]=_0x3cce3b[_0x4179('0x3b')]||'

Empty\x20message

';if(_0x3cce3b[_0x4179('0x3c')]){for(var _0x4f12e7=0x0;_0x4f12e7<_0x3cce3b[_0x4179('0x3c')][_0x4179('0xb')];_0x4f12e7++){var _0x21fa2a=_0x3cce3b['Attachments'][_0x4f12e7];_0x4a2871[_0x4179('0x1e')][_0x4179('0x16')][_0x4179('0x17')]({'filename':_0x21fa2a['Title'],'content':Buffer['from'](_0x21fa2a[_0x4179('0x3d')])});}}}_0x57e687(parseEmail(_0x5c6109,_0x3b9e38,_0x4a2871));});}else{_0x3b9e38[_0x4179('0x13')]=_0x4179('0x3e');_0x57e687(parseEmail(_0x5c6109,_0x3b9e38,_0x4a2871));}}else{_0x57e687(parseEmail(_0x5c6109,_0x3b9e38,_0x4a2871));}};exports[_0x4179('0x3f')]=function(_0x3837af,_0x44cd03){var _0x582758=[_0x4179('0x40')+(_0x44cd03||''),'auth=Bearer\x20'+_0x3837af,'',''];return Buffer[_0x4179('0x31')](_0x582758[_0x4179('0xd')](''),'utf-8')['toString'](_0x4179('0x41'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 4d2f3a8..8d9358f 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 _0xc6dc=['Smtp','exports','lodash','name','key','SERV','active','Imap'];(function(_0x50f5cf,_0x2e95c5){var _0x532b44=function(_0x410e8b){while(--_0x410e8b){_0x50f5cf['push'](_0x50f5cf['shift']());}};_0x532b44(++_0x2e95c5);}(_0xc6dc,0xa2));var _0xcc6d=function(_0x2f0fde,_0x4f8514){_0x2f0fde=_0x2f0fde-0x0;var _0x61f5ea=_0xc6dc[_0x2f0fde];return _0x61f5ea;};'use strict';var _=require(_0xcc6d('0x0'));function MailAccount(_0x538038){this['id']=_0x538038['id']||0x0;this['name']=_0x538038[_0xcc6d('0x1')]||'Service';this[_0xcc6d('0x2')]=_0x538038[_0xcc6d('0x2')]||_0xcc6d('0x3');this[_0xcc6d('0x4')]=_0x538038['active']||![];this['Imap']=_0x538038[_0xcc6d('0x5')]||[];this[_0xcc6d('0x6')]=_0x538038[_0xcc6d('0x6')]||[];}module[_0xcc6d('0x7')]=MailAccount; \ No newline at end of file +var _0x8b0d=['Imap','Smtp','exports','lodash','name','key','SERV','active'];(function(_0x376b70,_0x3b05b0){var _0x2d5206=function(_0x58e805){while(--_0x58e805){_0x376b70['push'](_0x376b70['shift']());}};_0x2d5206(++_0x3b05b0);}(_0x8b0d,0x13b));var _0xd8b0=function(_0x4bf9e8,_0x15b76d){_0x4bf9e8=_0x4bf9e8-0x0;var _0x1f7d05=_0x8b0d[_0x4bf9e8];return _0x1f7d05;};'use strict';var _=require(_0xd8b0('0x0'));function MailAccount(_0x363f51){this['id']=_0x363f51['id']||0x0;this[_0xd8b0('0x1')]=_0x363f51[_0xd8b0('0x1')]||'Service';this[_0xd8b0('0x2')]=_0x363f51[_0xd8b0('0x2')]||_0xd8b0('0x3');this[_0xd8b0('0x4')]=_0x363f51['active']||![];this[_0xd8b0('0x5')]=_0x363f51['Imap']||[];this[_0xd8b0('0x6')]=_0x363f51[_0xd8b0('0x6')]||[];}module[_0xd8b0('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 9502aaa..2aa72b2 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 _0xb13e=['mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x3621ab,_0x15c6ac){var _0x39804f=function(_0x4c606f){while(--_0x4c606f){_0x3621ab['push'](_0x3621ab['shift']());}};_0x39804f(++_0x15c6ac);}(_0xb13e,0x150));var _0xeb13=function(_0x54faf6,_0x471178){_0x54faf6=_0x54faf6-0x0;var _0x40c799=_0xb13e[_0x54faf6];return _0x40c799;};'use strict';var _=require(_0xeb13('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xeb13('0x1')]={};};function freeIsNotKey(_0x4c2e9f,_0x4595f7,_0x1e5f55){var _0x1b93d4=_[_0xeb13('0x2')](_0x4c2e9f,function(_0x17290d,_0x309989){return _0x17290d[_0x1e5f55];});for(var _0x32f3ad in _0x4595f7){if(_0x4595f7[_0xeb13('0x3')](_0x32f3ad)){if(!_0x1b93d4[_0x32f3ad]){delete _0x4595f7[_0x32f3ad];}}}}Realtime[_0xeb13('0x4')][_0xeb13('0x5')]=function(_0xc6f477,_0x1712d2){for(var _0x357ce7 in _0x1712d2){if(_0xc6f477[_0xeb13('0x3')](_0x357ce7)){_0xc6f477[_0x357ce7]=_0x1712d2[_0x357ce7];}}};Realtime[_0xeb13('0x4')][_0xeb13('0x6')]=function(){var _0x55a2f3=this;return function(_0x3817a7){if(_0x3817a7){freeIsNotKey(_0x3817a7,_0x55a2f3['mailAccounts'],'id');for(var _0x389072=0x0,_0x5059df={},_0x3681a8={};_0x389072<_0x3817a7[_0xeb13('0x7')];_0x389072+=0x1){_0x5059df=_0x3817a7[_0x389072];if(_[_0xeb13('0x8')](_0x55a2f3[_0xeb13('0x1')][_0x5059df['id']])){_0x55a2f3['mailAccounts'][_0x5059df['id']]=new MailAccount(_0x5059df);}else{_[_0xeb13('0x9')](_0x55a2f3[_0xeb13('0x1')][_0x5059df['id']],_0x5059df);}}}return _0x55a2f3[_0xeb13('0x1')];};};module[_0xeb13('0xa')]=Realtime; \ No newline at end of file +var _0xe04f=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','exports','lodash','mailAccounts'];(function(_0x594867,_0x2ee5d3){var _0x9ac5b1=function(_0x4609ec){while(--_0x4609ec){_0x594867['push'](_0x594867['shift']());}};_0x9ac5b1(++_0x2ee5d3);}(_0xe04f,0x1c6));var _0xfe04=function(_0xdd9a5f,_0x3ced93){_0xdd9a5f=_0xdd9a5f-0x0;var _0x3464b7=_0xe04f[_0xdd9a5f];return _0x3464b7;};'use strict';var _=require(_0xfe04('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xfe04('0x1')]={};};function freeIsNotKey(_0x221b5c,_0x278fec,_0x15c71c){var _0x3b5cfb=_[_0xfe04('0x2')](_0x221b5c,function(_0x34dbe6,_0x3d5452){return _0x34dbe6[_0x15c71c];});for(var _0x21113b in _0x278fec){if(_0x278fec[_0xfe04('0x3')](_0x21113b)){if(!_0x3b5cfb[_0x21113b]){delete _0x278fec[_0x21113b];}}}}Realtime[_0xfe04('0x4')][_0xfe04('0x5')]=function(_0x3a9c8a,_0x523df1){for(var _0x3e1b74 in _0x523df1){if(_0x3a9c8a[_0xfe04('0x3')](_0x3e1b74)){_0x3a9c8a[_0x3e1b74]=_0x523df1[_0x3e1b74];}}};Realtime[_0xfe04('0x4')][_0xfe04('0x6')]=function(){var _0x2ca215=this;return function(_0x3c8c3f){if(_0x3c8c3f){freeIsNotKey(_0x3c8c3f,_0x2ca215[_0xfe04('0x1')],'id');for(var _0x588775=0x0,_0xeb3f03={},_0x1656a7={};_0x588775<_0x3c8c3f['length'];_0x588775+=0x1){_0xeb3f03=_0x3c8c3f[_0x588775];if(_['isUndefined'](_0x2ca215['mailAccounts'][_0xeb3f03['id']])){_0x2ca215[_0xfe04('0x1')][_0xeb3f03['id']]=new MailAccount(_0xeb3f03);}else{_['merge'](_0x2ca215[_0xfe04('0x1')][_0xeb3f03['id']],_0xeb3f03);}}}return _0x2ca215[_0xfe04('0x1')];};};module[_0xfe04('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ed0fac6..23c214b 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 _0x36c3=['Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','provider','service','email','active','key','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x36c3,0x1a6));var _0x336c=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x36c3[_0x2d8fc2];return _0x3a9e53;};'use strict';var client=require(_0x336c('0x0'));exports[_0x336c('0x1')]=function(){return function(){return client['Request'](_0x336c('0x2'),{'options':{'attributes':['id',_0x336c('0x3'),_0x336c('0x4'),_0x336c('0x5'),_0x336c('0x6'),_0x336c('0x7'),_0x336c('0x8'),'ListId',_0x336c('0x9')],'raw':![],'include':[{'model':_0x336c('0xa'),'as':_0x336c('0xb'),'include':[{'model':_0x336c('0xc'),'attributes':['id',_0x336c('0x3'),'service',_0x336c('0xd'),_0x336c('0xe')],'as':_0x336c('0xc')}]},{'model':_0x336c('0xf'),'as':_0x336c('0x10'),'include':[{'model':_0x336c('0xc'),'attributes':['id',_0x336c('0x3'),_0x336c('0x5'),_0x336c('0xd'),_0x336c('0xe')],'as':_0x336c('0xc')}]}]},'log':_0x336c('0x11')});};};exports[_0x336c('0x12')]=function(_0x244e74,_0x146cf9){return client[_0x336c('0x13')](_0x336c('0x14'),{'account':{'id':_0x244e74},'body':_0x146cf9,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x0e50=['getMailAccounts','Request','name','provider','service','email','active','ListId','MailServerIn','Imap','CloudProvider','data5','MailServerOut','Smtp','type','getMailAccount','notify','NotifyMailAccount','../client'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x0e50,0x168));var _0x00e5=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x0e50[_0x25e7cb];return _0x375d92;};'use strict';var client=require(_0x00e5('0x0'));exports[_0x00e5('0x1')]=function(){return function(){return client[_0x00e5('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x00e5('0x3'),_0x00e5('0x4'),_0x00e5('0x5'),_0x00e5('0x6'),_0x00e5('0x7'),'key',_0x00e5('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x00e5('0x9'),'as':_0x00e5('0xa'),'include':[{'model':_0x00e5('0xb'),'attributes':['id',_0x00e5('0x3'),_0x00e5('0x5'),'type',_0x00e5('0xc')],'as':_0x00e5('0xb')}]},{'model':_0x00e5('0xd'),'as':_0x00e5('0xe'),'include':[{'model':_0x00e5('0xb'),'attributes':['id',_0x00e5('0x3'),'service',_0x00e5('0xf'),_0x00e5('0xc')],'as':'CloudProvider'}]}]},'log':_0x00e5('0x10')});};};exports[_0x00e5('0x11')]=function(_0x500b8b,_0x558dcb){return client[_0x00e5('0x2')](_0x00e5('0x12'),{'account':{'id':_0x500b8b},'body':_0x558dcb,'log':_0x00e5('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 25aacfa..4d74444 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 _0x4034=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x21a314,_0xbe022b){var _0x3eb9f6=function(_0x3b53ff){while(--_0x3b53ff){_0x21a314['push'](_0x21a314['shift']());}};_0x3eb9f6(++_0xbe022b);}(_0x4034,0x67));var _0x4403=function(_0x50e30b,_0x216368){_0x50e30b=_0x50e30b-0x0;var _0x4b7300=_0x4034[_0x50e30b];return _0x4b7300;};'use strict';var client=require(_0x4403('0x0'));exports[_0x4403('0x1')]=function(){return client[_0x4403('0x2')](_0x4403('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x4403('0x4')]},'log':_0x4403('0x5')});}; \ No newline at end of file +var _0x03c1=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x03c1,0x1c3));var _0x103c=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0x03c1[_0x533528];return _0x3189f1;};'use strict';var client=require(_0x103c('0x0'));exports[_0x103c('0x1')]=function(){return client[_0x103c('0x2')](_0x103c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x103c('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 6ce6f7e..94b36e5 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 90e3b22..7f3d9d0 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 _0x20b3=['createServer','port','socket.io','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','ioredis'];(function(_0x38cd7d,_0x17f16a){var _0x327af5=function(_0x48c670){while(--_0x48c670){_0x38cd7d['push'](_0x38cd7d['shift']());}};_0x327af5(++_0x17f16a);}(_0x20b3,0xda));var _0x320b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x320b('0x0'));var http=require(_0x320b('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x320b('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x320b('0x3')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x320b('0x4')])){var socketio=require(_0x320b('0x5'))(server,{'transports':['websocket','polling']});config[_0x320b('0x6')]=_['defaults'](config[_0x320b('0x6')],{'host':_0x320b('0x7'),'port':0x18eb});socketio[_0x320b('0x8')](require(_0x320b('0x9'))({'pubClient':new Redis(config[_0x320b('0x6')]),'subClient':new Redis(config[_0x320b('0x6')])}));require(_0x320b('0xa'))[_0x320b('0xb')]();require('../../config/socketio')[_0x320b('0xb')](socketio);require(_0x320b('0xc'))[_0x320b('0xb')](app);require('../../routes')['default'](app);}else{server['once'](_0x320b('0xd'),function(){console[_0x320b('0xe')](_0x320b('0xf'),config[_0x320b('0x4')]);});}exports=module[_0x320b('0x10')]=app; \ No newline at end of file +var _0xa82a=['adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','createServer','timeout','listen','port','socket.io','websocket','polling','defaults','redis'];(function(_0x329cc6,_0x5c7b33){var _0x4f0426=function(_0x30866a){while(--_0x30866a){_0x329cc6['push'](_0x329cc6['shift']());}};_0x4f0426(++_0x5c7b33);}(_0xa82a,0x105));var _0xaa82=function(_0x10cbca,_0x4d0c8d){_0x10cbca=_0x10cbca-0x0;var _0xbd5eef=_0xa82a[_0x10cbca];return _0xbd5eef;};'use strict';var _=require(_0xaa82('0x0'));var http=require('http');var express=require(_0xaa82('0x1'));var sticky=require(_0xaa82('0x2'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0xaa82('0x3')](app);server[_0xaa82('0x4')]=0xdbba0;if(sticky[_0xaa82('0x5')](server,config[_0xaa82('0x6')])){var socketio=require(_0xaa82('0x7'))(server,{'transports':[_0xaa82('0x8'),_0xaa82('0x9')]});config['redis']=_[_0xaa82('0xa')](config[_0xaa82('0xb')],{'host':'localhost','port':0x18eb});socketio[_0xaa82('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0xaa82('0xb')]),'subClient':new Redis(config['redis'])}));require(_0xaa82('0xd'))[_0xaa82('0xe')]();require(_0xaa82('0xf'))['default'](socketio);require(_0xaa82('0x10'))[_0xaa82('0xe')](app);require(_0xaa82('0x11'))[_0xaa82('0xe')](app);}else{server['once']('listening',function(){console[_0xaa82('0x12')](_0xaa82('0x13'),config['port']);});}exports=module[_0xaa82('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index ef95616..f95b4bc 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 _0xc262=['catch','exports','jayson/promise','bluebird','client','Request','request','debug','rpc','routing','error','message','result'];(function(_0x514e5d,_0x5ddd58){var _0xd419df=function(_0x5a82c1){while(--_0x5a82c1){_0x514e5d['push'](_0x514e5d['shift']());}};_0xd419df(++_0x5ddd58);}(_0xc262,0x154));var _0x2c26=function(_0x1e6641,_0x6a80a3){_0x1e6641=_0x1e6641-0x0;var _0x2396c7=_0xc262[_0x1e6641];return _0x2396c7;};'use strict';var jayson=require(_0x2c26('0x0'));var BPromise=require(_0x2c26('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x2c26('0x2')]['http']({'port':0x2329});client[_0x2c26('0x3')]=function(_0x15fa23,_0x1ace1f){return new BPromise(function(_0x189336,_0x166c79){return client[_0x2c26('0x4')](_0x15fa23,_0x1ace1f)['then'](function(_0x520dcd){logger[_0x2c26('0x5')](_0x2c26('0x6'),_0x2c26('0x7'),_0x15fa23,_0x1ace1f,_0x520dcd);if(_0x520dcd[_0x2c26('0x8')]){logger[_0x2c26('0x8')](_0x2c26('0x6'),_0x2c26('0x7'),_0x15fa23,_0x520dcd[_0x2c26('0x8')][_0x2c26('0x9')],_0x1ace1f);return _0x166c79(_0x520dcd['error'][_0x2c26('0x9')]);}else{return _0x189336(_0x520dcd[_0x2c26('0xa')]);}})[_0x2c26('0xb')](function(_0x38e06f){logger['error'](_0x2c26('0x6'),_0x2c26('0x7'),_0x15fa23,_0x38e06f,_0x1ace1f);return _0x166c79(_0x38e06f);});});};module[_0x2c26('0xc')]=client; \ No newline at end of file +var _0xfec1=['routing','client','http','Request','rpc','error','message','result','bluebird','../../config/logger'];(function(_0x143a22,_0x33a8fc){var _0x2be673=function(_0x1d3d8a){while(--_0x1d3d8a){_0x143a22['push'](_0x143a22['shift']());}};_0x2be673(++_0x33a8fc);}(_0xfec1,0x15c));var _0x1fec=function(_0x25cd6d,_0x30a718){_0x25cd6d=_0x25cd6d-0x0;var _0x7811e1=_0xfec1[_0x25cd6d];return _0x7811e1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x1fec('0x0'));var logger=require(_0x1fec('0x1'))(_0x1fec('0x2'));var client=jayson[_0x1fec('0x3')][_0x1fec('0x4')]({'port':0x2329});client[_0x1fec('0x5')]=function(_0x5bf3bf,_0x1923f4){return new BPromise(function(_0x9c7c3f,_0x3fdc1d){return client['request'](_0x5bf3bf,_0x1923f4)['then'](function(_0x2a6faa){logger['debug'](_0x1fec('0x6'),'routing',_0x5bf3bf,_0x1923f4,_0x2a6faa);if(_0x2a6faa[_0x1fec('0x7')]){logger[_0x1fec('0x7')]('rpc','routing',_0x5bf3bf,_0x2a6faa[_0x1fec('0x7')][_0x1fec('0x8')],_0x1923f4);return _0x3fdc1d(_0x2a6faa[_0x1fec('0x7')][_0x1fec('0x8')]);}else{return _0x9c7c3f(_0x2a6faa[_0x1fec('0x9')]);}})['catch'](function(_0x56b74d){logger[_0x1fec('0x7')](_0x1fec('0x6'),_0x1fec('0x2'),_0x5bf3bf,_0x56b74d,_0x1923f4);return _0x3fdc1d(_0x56b74d);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 8b77396..04edc99 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 _0x2e39=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x2e39,0xdc));var _0x92e3=function(_0x280537,_0x54259e){_0x280537=_0x280537-0x0;var _0x281260=_0x2e39[_0x280537];return _0x281260;};'use strict';var BPromise=require(_0x92e3('0x0'));var server=require(_0x92e3('0x1'));var Realtime=require(_0x92e3('0x2'));var user=require('./rpc/user');var interval=require(_0x92e3('0x3'));var openchannelQueue=require(_0x92e3('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x92e3('0x5'));var mailQueue=require(_0x92e3('0x6'));var faxQueue=require(_0x92e3('0x7'));var whatsappQueue=require(_0x92e3('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x92e3('0x9')]()[_0x92e3('0xa')](user[_0x92e3('0xb')]())[_0x92e3('0xa')](realtime[_0x92e3('0xc')]())[_0x92e3('0xa')](interval[_0x92e3('0xd')]())['then'](realtime[_0x92e3('0xe')]())[_0x92e3('0xa')](openchannelQueue[_0x92e3('0xf')]())[_0x92e3('0xa')](realtime[_0x92e3('0x10')]())['then'](chatQueue[_0x92e3('0x11')]())[_0x92e3('0xa')](realtime['initChatQueues']())[_0x92e3('0xa')](smsQueue['getSmsQueues']())[_0x92e3('0xa')](realtime[_0x92e3('0x12')]())[_0x92e3('0xa')](mailQueue[_0x92e3('0x13')]())[_0x92e3('0xa')](realtime[_0x92e3('0x14')]())[_0x92e3('0xa')](faxQueue[_0x92e3('0x15')]())[_0x92e3('0xa')](realtime[_0x92e3('0x16')]())[_0x92e3('0xa')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x92e3('0x17')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x92e3('0xa')](function(_0x258971){return initRealtime();})[_0x92e3('0xa')](function(_0x1b5ba9){return setInterval(initRealtime,0x1388);})[_0x92e3('0x18')](function(_0x5d2b2b){console[_0x92e3('0x19')](_0x5d2b2b);});}main(); \ No newline at end of file +var _0x6d8e=['./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','initOpenchannelQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','log','./server','./realtime'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0x6d8e,0x1e2));var _0xe6d8=function(_0x1756e1,_0x3b74a9){_0x1756e1=_0x1756e1-0x0;var _0x2687fe=_0x6d8e[_0x1756e1];return _0x2687fe;};'use strict';var BPromise=require('bluebird');var server=require(_0xe6d8('0x0'));var Realtime=require(_0xe6d8('0x1'));var user=require(_0xe6d8('0x2'));var interval=require(_0xe6d8('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xe6d8('0x4'));var smsQueue=require(_0xe6d8('0x5'));var mailQueue=require(_0xe6d8('0x6'));var faxQueue=require(_0xe6d8('0x7'));var whatsappQueue=require(_0xe6d8('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xe6d8('0x9')]()[_0xe6d8('0xa')](user[_0xe6d8('0xb')]())[_0xe6d8('0xa')](realtime[_0xe6d8('0xc')]())[_0xe6d8('0xa')](interval['getIntervals']())[_0xe6d8('0xa')](realtime[_0xe6d8('0xd')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xe6d8('0xa')](realtime[_0xe6d8('0xe')]())[_0xe6d8('0xa')](chatQueue['getChatQueues']())[_0xe6d8('0xa')](realtime['initChatQueues']())[_0xe6d8('0xa')](smsQueue[_0xe6d8('0xf')]())[_0xe6d8('0xa')](realtime[_0xe6d8('0x10')]())[_0xe6d8('0xa')](mailQueue['getMailQueues']())[_0xe6d8('0xa')](realtime[_0xe6d8('0x11')]())['then'](faxQueue[_0xe6d8('0x12')]())[_0xe6d8('0xa')](realtime[_0xe6d8('0x13')]())[_0xe6d8('0xa')](whatsappQueue['getWhatsappQueues']())[_0xe6d8('0xa')](realtime[_0xe6d8('0x14')]())[_0xe6d8('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xe6d8('0xa')](function(_0x5e6478){return initRealtime();})[_0xe6d8('0xa')](function(_0x55ec30){return setInterval(initRealtime,0x1388);})['catch'](function(_0xbf36fa){console[_0xe6d8('0x15')](_0xbf36fa);});}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 6e6f34b..717b700 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x27cf4c,_0x20aed1){var _0x2a453b=function(_0x859482){while(--_0x859482){_0x27cf4c['push'](_0x27cf4c['shift']());}};_0x2a453b(++_0x20aed1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x4f2498,_0x6428e1){var _0xe9a958=function(_0x174154){while(--_0x174154){_0x4f2498['push'](_0x4f2498['shift']());}};_0xe9a958(++_0x6428e1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x5fc3[_0x27dba4];return _0x35ec9d;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index dfa07a9..2173436 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 _0xd3ec=['bluebird','http','request','error','result','catch','sendMailMessage','SendMail'];(function(_0x7cdf81,_0x2a5313){var _0x44e9e0=function(_0x557a38){while(--_0x557a38){_0x7cdf81['push'](_0x7cdf81['shift']());}};_0x44e9e0(++_0x2a5313);}(_0xd3ec,0x88));var _0xcd3e=function(_0x6a8a66,_0x554a7e){_0x6a8a66=_0x6a8a66-0x0;var _0x4f57d6=_0xd3ec[_0x6a8a66];return _0x4f57d6;};'use strict';var BPromise=require(_0xcd3e('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd3e('0x1')]({'port':0x232b});function request(_0x4af3a8,_0x54f4ac){return new BPromise(function(_0x432059,_0x2b7c9d){return client[_0xcd3e('0x2')](_0x4af3a8,_0x54f4ac)['then'](function(_0x54548e){if(_0x54548e['error']){return _0x2b7c9d(_0x54548e[_0xcd3e('0x3')]['message']);}else{return _0x432059(_0x54548e[_0xcd3e('0x4')]);}})[_0xcd3e('0x5')](function(_0x13912f){return _0x2b7c9d(_0x13912f);});});}exports[_0xcd3e('0x6')]=function(_0x536eca,_0x3b3767){return request(_0xcd3e('0x7'),{'account':_0x536eca,'message':_0x3b3767});}; \ No newline at end of file +var _0x8eb8=['error','catch','sendMailMessage','SendMail','bluebird','http','then'];(function(_0x31122e,_0x24fbf7){var _0x54922b=function(_0x142778){while(--_0x142778){_0x31122e['push'](_0x31122e['shift']());}};_0x54922b(++_0x24fbf7);}(_0x8eb8,0x7b));var _0x88eb=function(_0x181ea9,_0x330e48){_0x181ea9=_0x181ea9-0x0;var _0x15d704=_0x8eb8[_0x181ea9];return _0x15d704;};'use strict';var BPromise=require(_0x88eb('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x88eb('0x1')]({'port':0x232b});function request(_0xadfab,_0x449ff0){return new BPromise(function(_0x4c5e9d,_0x1ddc63){return client['request'](_0xadfab,_0x449ff0)[_0x88eb('0x2')](function(_0x34e0ba){if(_0x34e0ba[_0x88eb('0x3')]){return _0x1ddc63(_0x34e0ba[_0x88eb('0x3')]['message']);}else{return _0x4c5e9d(_0x34e0ba['result']);}})[_0x88eb('0x4')](function(_0x3c5be9){return _0x1ddc63(_0x3c5be9);});});}exports[_0x88eb('0x5')]=function(_0x170aa3,_0x2eb741){return request(_0x88eb('0x6'),{'account':_0x170aa3,'message':_0x2eb741});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index fff2afd..d270ad0 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 _0xc73f=['openchannelStatusTime','openchannelCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','format','online','smsCapacity','whatsappStatus','openchannelCurrentCapacity','busy','stringify','emit','user:routing:update','moment','md5','ioredis','../../../config/environment','redis','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus'];(function(_0x3f7d26,_0x4eb72b){var _0x25464e=function(_0x53d300){while(--_0x53d300){_0x3f7d26['push'](_0x3f7d26['shift']());}};_0x25464e(++_0x4eb72b);}(_0xc73f,0x1d8));var _0xfc73=function(_0x3aa1c9,_0x50e81f){_0x3aa1c9=_0x3aa1c9-0x0;var _0x4ea269=_0xc73f[_0x3aa1c9];return _0x4ea269;};'use strict';var _=require('lodash');var moment=require(_0xfc73('0x0'));var md5=require(_0xfc73('0x1'));var Redis=require(_0xfc73('0x2'));var config=require(_0xfc73('0x3'));config[_0xfc73('0x4')]=_['defaults'](config[_0xfc73('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfc73('0x4')]));function Agent(_0x3abf69){this['id']=_0x3abf69['id']||0x0;this[_0xfc73('0x5')]=_0x3abf69[_0xfc73('0x5')]||'';this[_0xfc73('0x6')]=_0x3abf69[_0xfc73('0x6')]||![];this['chatPause']=_0x3abf69[_0xfc73('0x7')]||![];this[_0xfc73('0x8')]=_0x3abf69['mailPause']||![];this[_0xfc73('0x9')]=_0x3abf69[_0xfc73('0x9')]||![];this[_0xfc73('0xa')]=_0x3abf69['smsPause']||![];this[_0xfc73('0xb')]=_0x3abf69[_0xfc73('0xb')]||![];this[_0xfc73('0xc')]='unknown';this[_0xfc73('0xd')]=0x0;this[_0xfc73('0xe')]=_0x3abf69[_0xfc73('0xe')]||0x0;this[_0xfc73('0xf')]=0x0;this[_0xfc73('0x10')]=_0xfc73('0x11');this[_0xfc73('0x12')]=0x0;this['mailCapacity']=_0x3abf69[_0xfc73('0x13')]||0x0;this[_0xfc73('0x14')]=0x0;this[_0xfc73('0x15')]=_0xfc73('0x11');this[_0xfc73('0x16')]=0x0;this[_0xfc73('0x17')]=_0x3abf69[_0xfc73('0x17')]||0x0;this[_0xfc73('0x18')]=0x0;this[_0xfc73('0x19')]=_0xfc73('0x11');this[_0xfc73('0x1a')]=0x0;this['smsCapacity']=_0x3abf69['smsCapacity']||0x0;this[_0xfc73('0x1b')]=0x0;this['whatsappStatus']=_0xfc73('0x11');this[_0xfc73('0x1c')]=0x0;this['whatsappCapacity']=_0x3abf69[_0xfc73('0x1d')]||0x0;this[_0xfc73('0x1e')]=0x0;this[_0xfc73('0x1f')]=_0xfc73('0x11');this[_0xfc73('0x20')]=0x0;this[_0xfc73('0x21')]=_0x3abf69[_0xfc73('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0xfc73('0x22')]=undefined;this[_0xfc73('0x1')]='';this[_0xfc73('0x23')]={};this[_0xfc73('0x24')]={};this[_0xfc73('0x25')]={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this[_0xfc73('0x26')]={};this[_0xfc73('0x27')]();}Agent[_0xfc73('0x28')][_0xfc73('0x29')]=function(_0x5d95fe){if(this[_0x5d95fe+_0xfc73('0x2a')]>0x0){if(this[_0x5d95fe+_0xfc73('0x2b')]>0x0&&this[_0x5d95fe+_0xfc73('0x2a')]>=this[_0x5d95fe+_0xfc73('0x2b')]){return'maxcapacity';}else{return _0xfc73('0x2c');}}else{return _0xfc73('0x2d');}};Agent[_0xfc73('0x28')][_0xfc73('0x27')]=function(){var _0x596ffc=[_0xfc73('0x2e'),_0xfc73('0x2f'),'openchannel',_0xfc73('0x30'),_0xfc73('0x31'),_0xfc73('0x32')];for(var _0x5430ef=0x0;_0x5430ef<_0x596ffc[_0xfc73('0x33')];_0x5430ef+=0x1){var _0x3a0ff0=this[_0xfc73('0x29')](_0x596ffc[_0x5430ef]);if(this[_0x596ffc[_0x5430ef]+_0xfc73('0x34')]!==_0x3a0ff0){this[_0x596ffc[_0x5430ef]+_0xfc73('0x35')]=_['toNumber'](moment()[_0xfc73('0x36')]('x'));}this[_0x596ffc[_0x5430ef]+_0xfc73('0x34')]=_0x3a0ff0;}var _0x1e8367={'id':this['id'],'name':this[_0xfc73('0x5')],'online':this[_0xfc73('0x37')],'voicePause':this[_0xfc73('0x6')],'chatPause':this[_0xfc73('0x7')],'mailPause':this[_0xfc73('0x8')],'smsPause':this[_0xfc73('0xa')],'faxPause':this[_0xfc73('0x9')],'openchannelPause':this[_0xfc73('0xb')],'chatStatus':this[_0xfc73('0xc')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xfc73('0xe')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xfc73('0x12')],'mailCapacity':this[_0xfc73('0x13')],'mailCurrentCapacity':this[_0xfc73('0x14')],'faxStatus':this[_0xfc73('0x15')],'faxStatusTime':this[_0xfc73('0x16')],'faxCapacity':this[_0xfc73('0x17')],'faxCurrentCapacity':this[_0xfc73('0x18')],'smsStatus':this[_0xfc73('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xfc73('0x38')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xfc73('0x39')],'whatsappStatusTime':this[_0xfc73('0x1c')],'whatsappCapacity':this[_0xfc73('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xfc73('0x1f')],'openchannelStatusTime':this[_0xfc73('0x20')],'openchannelCapacity':this[_0xfc73('0x21')],'openchannelCurrentCapacity':this[_0xfc73('0x3a')],'busy':this[_0xfc73('0x3b')],'busyQueue':this[_0xfc73('0x22')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xfc73('0x25')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x37e83a=md5(JSON[_0xfc73('0x3c')](_0x1e8367));if(this['md5']!==_0x37e83a){this[_0xfc73('0x1')]=_0x37e83a;io[_0xfc73('0x3d')](_0xfc73('0x3e'),_0x1e8367);}};module['exports']=Agent; \ No newline at end of file +var _0x2533=['exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','chat','fax','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','mailPause','mailStatus','faxStatus','whatsappStatus','openchannelCurrentCapacity','chatWaitingInteractions','emit','user:routing:update'];(function(_0x238bcb,_0xdedc35){var _0x21021a=function(_0x35de35){while(--_0x35de35){_0x238bcb['push'](_0x238bcb['shift']());}};_0x21021a(++_0xdedc35);}(_0x2533,0x7f));var _0x3253=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x2533[_0x223461];return _0x4dbe0a;};'use strict';var _=require(_0x3253('0x0'));var moment=require(_0x3253('0x1'));var md5=require('md5');var Redis=require(_0x3253('0x2'));var config=require(_0x3253('0x3'));config[_0x3253('0x4')]=_[_0x3253('0x5')](config[_0x3253('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x3253('0x6'))(new Redis(config[_0x3253('0x4')]));function Agent(_0x5bca61){this['id']=_0x5bca61['id']||0x0;this[_0x3253('0x7')]=_0x5bca61[_0x3253('0x7')]||'';this[_0x3253('0x8')]=_0x5bca61[_0x3253('0x8')]||![];this['chatPause']=_0x5bca61[_0x3253('0x9')]||![];this['mailPause']=_0x5bca61['mailPause']||![];this[_0x3253('0xa')]=_0x5bca61['faxPause']||![];this[_0x3253('0xb')]=_0x5bca61[_0x3253('0xb')]||![];this[_0x3253('0xc')]=_0x5bca61[_0x3253('0xc')]||![];this[_0x3253('0xd')]=_0x3253('0xe');this[_0x3253('0xf')]=0x0;this['chatCapacity']=_0x5bca61['chatCapacity']||0x0;this[_0x3253('0x10')]=0x0;this['mailStatus']=_0x3253('0xe');this[_0x3253('0x11')]=0x0;this[_0x3253('0x12')]=_0x5bca61[_0x3253('0x12')]||0x0;this[_0x3253('0x13')]=0x0;this['faxStatus']=_0x3253('0xe');this[_0x3253('0x14')]=0x0;this['faxCapacity']=_0x5bca61[_0x3253('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x3253('0x16')]=_0x3253('0xe');this[_0x3253('0x17')]=0x0;this['smsCapacity']=_0x5bca61[_0x3253('0x18')]||0x0;this[_0x3253('0x19')]=0x0;this['whatsappStatus']=_0x3253('0xe');this[_0x3253('0x1a')]=0x0;this[_0x3253('0x1b')]=_0x5bca61[_0x3253('0x1b')]||0x0;this[_0x3253('0x1c')]=0x0;this[_0x3253('0x1d')]=_0x3253('0xe');this[_0x3253('0x1e')]=0x0;this[_0x3253('0x1f')]=_0x5bca61[_0x3253('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x3253('0x20')]=![];this[_0x3253('0x21')]=undefined;this[_0x3253('0x22')]='';this['chatWaitingInteractions']={};this[_0x3253('0x23')]={};this[_0x3253('0x24')]={};this[_0x3253('0x25')]={};this[_0x3253('0x26')]={};this[_0x3253('0x27')]={};this[_0x3253('0x28')]();}Agent[_0x3253('0x29')]['getChannelStatus']=function(_0x395513){if(this[_0x395513+'CurrentCapacity']>0x0){if(this[_0x395513+'Capacity']>0x0&&this[_0x395513+_0x3253('0x2a')]>=this[_0x395513+_0x3253('0x2b')]){return'maxcapacity';}else{return _0x3253('0x2c');}}else{return _0x3253('0x2d');}};Agent[_0x3253('0x29')][_0x3253('0x28')]=function(){var _0x50df97=['mail',_0x3253('0x2e'),'openchannel',_0x3253('0x2f'),'sms',_0x3253('0x30')];for(var _0x70794=0x0;_0x70794<_0x50df97[_0x3253('0x31')];_0x70794+=0x1){var _0x215880=this[_0x3253('0x32')](_0x50df97[_0x70794]);if(this[_0x50df97[_0x70794]+_0x3253('0x33')]!==_0x215880){this[_0x50df97[_0x70794]+_0x3253('0x34')]=_[_0x3253('0x35')](moment()['format']('x'));}this[_0x50df97[_0x70794]+'Status']=_0x215880;}var _0xf4afe8={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x3253('0x9')],'mailPause':this[_0x3253('0x36')],'smsPause':this[_0x3253('0xb')],'faxPause':this[_0x3253('0xa')],'openchannelPause':this[_0x3253('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x3253('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x3253('0x10')],'mailStatus':this[_0x3253('0x37')],'mailStatusTime':this[_0x3253('0x11')],'mailCapacity':this[_0x3253('0x12')],'mailCurrentCapacity':this[_0x3253('0x13')],'faxStatus':this[_0x3253('0x38')],'faxStatusTime':this[_0x3253('0x14')],'faxCapacity':this[_0x3253('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x3253('0x16')],'smsStatusTime':this[_0x3253('0x17')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x3253('0x19')],'whatsappStatus':this[_0x3253('0x39')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x3253('0x1b')],'whatsappCurrentCapacity':this[_0x3253('0x1c')],'openchannelStatus':this[_0x3253('0x1d')],'openchannelStatusTime':this[_0x3253('0x1e')],'openchannelCapacity':this[_0x3253('0x1f')],'openchannelCurrentCapacity':this[_0x3253('0x3a')],'busy':this[_0x3253('0x20')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x3253('0x3b')],'faxWaitingInteractions':this[_0x3253('0x23')],'mailWaitingInteractions':this[_0x3253('0x24')],'openchannelWaitingInteractions':this[_0x3253('0x25')],'smsWaitingInteractions':this[_0x3253('0x26')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x1bf879=md5(JSON['stringify'](_0xf4afe8));if(this[_0x3253('0x22')]!==_0x1bf879){this[_0x3253('0x22')]=_0x1bf879;io[_0x3253('0x3c')](_0x3253('0x3d'),_0xf4afe8);}};module[_0x3253('0x3e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 58c7741..692ef31 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 _0xc889=['updateRealtime','map','_rr','loggedIn','online','paused','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x49414e,_0x4f507a){var _0x291c56=function(_0x377b56){while(--_0x377b56){_0x49414e['push'](_0x49414e['shift']());}};_0x291c56(++_0x4f507a);}(_0xc889,0x108));var _0x9c88=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xc889[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x9c88('0x0'));var md5=require(_0x9c88('0x1'));var util=require(_0x9c88('0x2'));var Redis=require(_0x9c88('0x3'));var config=require(_0x9c88('0x4'));config[_0x9c88('0x5')]=_[_0x9c88('0x6')](config[_0x9c88('0x5')],{'host':_0x9c88('0x7'),'port':0x18eb});var io=require(_0x9c88('0x8'))(new Redis(config[_0x9c88('0x5')]));function ChatQueue(_0x1c9dcb){this['id']=_0x1c9dcb['id']||0x0;this[_0x9c88('0x9')]=_0x1c9dcb['name']||'';this[_0x9c88('0xa')]=_0x1c9dcb[_0x9c88('0xa')]||0xa;this['strategy']=_0x1c9dcb['strategy']||_0x9c88('0xb');this[_0x9c88('0xc')]=_0x1c9dcb[_0x9c88('0xc')];this[_0x9c88('0xd')]={};this[_0x9c88('0xe')]=0x0;this[_0x9c88('0x1')]='';this[_0x9c88('0xf')]();this[_0x9c88('0x10')]();}ChatQueue['prototype'][_0x9c88('0xf')]=function(){var _0x4e8dc0=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x9c88('0x11')](this['Agents'],'id');this[_0x9c88('0xd')][_0x9c88('0x12')]=_0x4e8dc0;};ChatQueue['prototype'][_0x9c88('0x10')]=function(){this[_0x9c88('0x13')]=0x0;this['paused']=0x0;for(var _0x39244e=0x0;_0x39244e=0x0?this[_0x9c88('0x16')]:0x0;var _0x518f41={'id':this['id'],'available':this[_0x9c88('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x9c88('0x15')],'waiting':this[_0x9c88('0xe')]};var _0x20cb66=md5(JSON[_0x9c88('0x17')](_0x518f41));if(this['md5']!==_0x20cb66){this[_0x9c88('0x1')]=_0x20cb66;io['to'](util['format'](_0x9c88('0x18'),_0x518f41[_0x9c88('0x9')]))[_0x9c88('0x19')](_0x9c88('0x1a'),_0x518f41);}};module[_0x9c88('0x1b')]=ChatQueue; \ No newline at end of file +var _0x364f=['paused','online','chatPause','available','format','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x364f,0x102));var _0xf364=function(_0x506cbe,_0x818678){_0x506cbe=_0x506cbe-0x0;var _0x4fdaa7=_0x364f[_0x506cbe];return _0x4fdaa7;};'use strict';var _=require(_0xf364('0x0'));var md5=require(_0xf364('0x1'));var util=require('util');var Redis=require(_0xf364('0x2'));var config=require(_0xf364('0x3'));config[_0xf364('0x4')]=_[_0xf364('0x5')](config[_0xf364('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf364('0x4')]));function ChatQueue(_0x2e3f93){this['id']=_0x2e3f93['id']||0x0;this['name']=_0x2e3f93['name']||'';this[_0xf364('0x6')]=_0x2e3f93[_0xf364('0x6')]||0xa;this[_0xf364('0x7')]=_0x2e3f93[_0xf364('0x7')]||_0xf364('0x8');this[_0xf364('0x9')]=_0x2e3f93[_0xf364('0x9')];this[_0xf364('0xa')]={};this['waiting']=0x0;this[_0xf364('0x1')]='';this[_0xf364('0xb')]();this[_0xf364('0xc')]();}ChatQueue[_0xf364('0xd')][_0xf364('0xb')]=function(){var _0x112248=this[_0xf364('0xa')][_0xf364('0xe')];this['mapAgentsId']=_[_0xf364('0xf')](this[_0xf364('0x9')],'id');this[_0xf364('0xa')][_0xf364('0xe')]=_0x112248;};ChatQueue['prototype'][_0xf364('0xc')]=function(){this[_0xf364('0x10')]=0x0;this[_0xf364('0x11')]=0x0;for(var _0x4ea99b=0x0;_0x4ea99b=0x0?this[_0xf364('0x14')]:0x0;var _0x468650={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf364('0x10')],'name':this['name'],'paused':this[_0xf364('0x11')],'waiting':this['waiting']};var _0xf9002b=md5(JSON['stringify'](_0x468650));if(this[_0xf364('0x1')]!==_0xf9002b){this[_0xf364('0x1')]=_0xf9002b;io['to'](util[_0xf364('0x15')]('chat:queue:%s',_0x468650['name']))[_0xf364('0x16')](_0xf364('0x17'),_0x468650);}};module[_0xf364('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 513e55d..0c9678d 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 _0xcd14=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x5d4203,_0x29b4ca){var _0xe67eba=function(_0x241f08){while(--_0x241f08){_0x5d4203['push'](_0x5d4203['shift']());}};_0xe67eba(++_0x29b4ca);}(_0xcd14,0x147));var _0x4cd1=function(_0x1c1d33,_0x39503b){_0x1c1d33=_0x1c1d33-0x0;var _0x2107c0=_0xcd14[_0x1c1d33];return _0x2107c0;};'use strict';var _=require(_0x4cd1('0x0'));var md5=require(_0x4cd1('0x1'));var util=require(_0x4cd1('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4cd1('0x3')]=_[_0x4cd1('0x4')](config[_0x4cd1('0x3')],{'host':_0x4cd1('0x5'),'port':0x18eb});var io=require(_0x4cd1('0x6'))(new Redis(config[_0x4cd1('0x3')]));function FaxQueue(_0x430174){this['id']=_0x430174['id']||0x0;this[_0x4cd1('0x7')]=_0x430174[_0x4cd1('0x7')]||'';this[_0x4cd1('0x8')]=_0x430174[_0x4cd1('0x8')]||0xa;this[_0x4cd1('0x9')]=_0x430174[_0x4cd1('0x9')]||'beepall';this[_0x4cd1('0xa')]=_0x430174[_0x4cd1('0xa')];this[_0x4cd1('0xb')]={};this[_0x4cd1('0xc')]=0x0;this[_0x4cd1('0x1')]='';this[_0x4cd1('0xd')]();this[_0x4cd1('0xe')]();}FaxQueue[_0x4cd1('0xf')]['updateRouting']=function(){var _0x274041=this[_0x4cd1('0xb')][_0x4cd1('0x10')];this[_0x4cd1('0xb')]=_['map'](this[_0x4cd1('0xa')],'id');this[_0x4cd1('0xb')][_0x4cd1('0x10')]=_0x274041;};FaxQueue['prototype'][_0x4cd1('0xe')]=function(){this[_0x4cd1('0x11')]=0x0;this[_0x4cd1('0x12')]=0x0;for(var _0xb8088=0x0;_0xb8088=0x0?this['available']:0x0;var _0x4d49d3={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4cd1('0x11')],'name':this[_0x4cd1('0x7')],'paused':this[_0x4cd1('0x12')],'waiting':this[_0x4cd1('0xc')]};var _0x35ed49=md5(JSON[_0x4cd1('0x16')](_0x4d49d3));if(this[_0x4cd1('0x1')]!==_0x35ed49){this['md5']=_0x35ed49;io['to'](util[_0x4cd1('0x17')](_0x4cd1('0x18'),_0x4d49d3['name']))[_0x4cd1('0x19')](_0x4cd1('0x1a'),_0x4d49d3);}};module[_0x4cd1('0x1b')]=FaxQueue; \ No newline at end of file +var _0x007f=['exports','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','faxPause','available','format','emit','fax_queue:save'];(function(_0x4f85c5,_0x517e60){var _0x46fc5b=function(_0x23381a){while(--_0x23381a){_0x4f85c5['push'](_0x4f85c5['shift']());}};_0x46fc5b(++_0x517e60);}(_0x007f,0x71));var _0xf007=function(_0xc069,_0x3005d6){_0xc069=_0xc069-0x0;var _0x3f143c=_0x007f[_0xc069];return _0x3f143c;};'use strict';var _=require('lodash');var md5=require(_0xf007('0x0'));var util=require(_0xf007('0x1'));var Redis=require(_0xf007('0x2'));var config=require(_0xf007('0x3'));config['redis']=_[_0xf007('0x4')](config['redis'],{'host':_0xf007('0x5'),'port':0x18eb});var io=require(_0xf007('0x6'))(new Redis(config['redis']));function FaxQueue(_0x215970){this['id']=_0x215970['id']||0x0;this['name']=_0x215970[_0xf007('0x7')]||'';this['timeout']=_0x215970['timeout']||0xa;this[_0xf007('0x8')]=_0x215970[_0xf007('0x8')]||_0xf007('0x9');this[_0xf007('0xa')]=_0x215970[_0xf007('0xa')];this[_0xf007('0xb')]={};this[_0xf007('0xc')]=0x0;this[_0xf007('0x0')]='';this[_0xf007('0xd')]();this[_0xf007('0xe')]();}FaxQueue[_0xf007('0xf')][_0xf007('0xd')]=function(){var _0x240e9d=this[_0xf007('0xb')]['_rr'];this['mapAgentsId']=_[_0xf007('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xf007('0x11')]=_0x240e9d;};FaxQueue[_0xf007('0xf')]['updateRealtime']=function(){this[_0xf007('0x12')]=0x0;this[_0xf007('0x13')]=0x0;for(var _0x1e5410=0x0;_0x1e5410=0x0?this[_0xf007('0x17')]:0x0;var _0x3ff2d0={'id':this['id'],'available':this[_0xf007('0x17')],'loggedIn':this[_0xf007('0x12')],'name':this[_0xf007('0x7')],'paused':this[_0xf007('0x13')],'waiting':this['waiting']};var _0x424146=md5(JSON['stringify'](_0x3ff2d0));if(this[_0xf007('0x0')]!==_0x424146){this[_0xf007('0x0')]=_0x424146;io['to'](util[_0xf007('0x18')]('fax:queue:%s',_0x3ff2d0[_0xf007('0x7')]))[_0xf007('0x19')](_0xf007('0x1a'),_0x3ff2d0);}};module[_0xf007('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 7cf8956..5f2220e 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 _0xe495=['name','exports'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xe495,0x11e));var _0x5e49=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe495[_0x599f41];return _0x2e4d58;};'use strict';function Interval(_0x5a5c31){this['id']=_0x5a5c31['id']||0x0;this[_0x5e49('0x0')]=_0x5a5c31['name']||'';this['Intervals']=_0x5a5c31['Intervals']||{};}module[_0x5e49('0x1')]=Interval; \ No newline at end of file +var _0x40ad=['name','Intervals','exports'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x40ad,0xf0));var _0xd40a=function(_0x4f4765,_0xd0d762){_0x4f4765=_0x4f4765-0x0;var _0x5e65ec=_0x40ad[_0x4f4765];return _0x5e65ec;};'use strict';function Interval(_0x20c1aa){this['id']=_0x20c1aa['id']||0x0;this[_0xd40a('0x0')]=_0x20c1aa[_0xd40a('0x0')]||'';this[_0xd40a('0x1')]=_0x20c1aa[_0xd40a('0x1')]||{};}module[_0xd40a('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 e6a8f4c..6ef8d75 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 _0xcf2b=['format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','updateRouting','updateRealtime','prototype','_rr','map','Agents','mapAgentsId','loggedIn','paused','length','online','mailPause','available'];(function(_0x3d4a91,_0x18d54b){var _0x1728d2=function(_0x2e6926){while(--_0x2e6926){_0x3d4a91['push'](_0x3d4a91['shift']());}};_0x1728d2(++_0x18d54b);}(_0xcf2b,0x161));var _0xbcf2=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0xcf2b[_0x58ac34];return _0x3921ab;};'use strict';var _=require('lodash');var md5=require(_0xbcf2('0x0'));var util=require(_0xbcf2('0x1'));var Redis=require(_0xbcf2('0x2'));var config=require(_0xbcf2('0x3'));config[_0xbcf2('0x4')]=_[_0xbcf2('0x5')](config['redis'],{'host':_0xbcf2('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x1b5ddf){this['id']=_0x1b5ddf['id']||0x0;this[_0xbcf2('0x7')]=_0x1b5ddf[_0xbcf2('0x7')]||'';this['timeout']=_0x1b5ddf[_0xbcf2('0x8')]||0xa;this[_0xbcf2('0x9')]=_0x1b5ddf[_0xbcf2('0x9')]||_0xbcf2('0xa');this['Agents']=_0x1b5ddf['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xbcf2('0x0')]='';this[_0xbcf2('0xb')]();this[_0xbcf2('0xc')]();}MailQueue[_0xbcf2('0xd')]['updateRouting']=function(){var _0x3418a2=this['mapAgentsId'][_0xbcf2('0xe')];this['mapAgentsId']=_[_0xbcf2('0xf')](this[_0xbcf2('0x10')],'id');this[_0xbcf2('0x11')][_0xbcf2('0xe')]=_0x3418a2;};MailQueue['prototype'][_0xbcf2('0xc')]=function(){this[_0xbcf2('0x12')]=0x0;this[_0xbcf2('0x13')]=0x0;for(var _0x137161=0x0;_0x137161=0x0?this['available']:0x0;var _0x5e6d2f={'id':this['id'],'available':this[_0xbcf2('0x17')],'loggedIn':this[_0xbcf2('0x12')],'name':this[_0xbcf2('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x185226=md5(JSON['stringify'](_0x5e6d2f));if(this[_0xbcf2('0x0')]!==_0x185226){this['md5']=_0x185226;io['to'](util[_0xbcf2('0x18')](_0xbcf2('0x19'),_0x5e6d2f[_0xbcf2('0x7')]))[_0xbcf2('0x1a')](_0xbcf2('0x1b'),_0x5e6d2f);}};module[_0xbcf2('0x1c')]=MailQueue; \ No newline at end of file +var _0x6f06=['redis','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','exports','md5','util','ioredis','../../../config/environment','defaults'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f06,0xb1));var _0x66f0=function(_0xa64531,_0x48c65f){_0xa64531=_0xa64531-0x0;var _0x1b1f42=_0x6f06[_0xa64531];return _0x1b1f42;};'use strict';var _=require('lodash');var md5=require(_0x66f0('0x0'));var util=require(_0x66f0('0x1'));var Redis=require(_0x66f0('0x2'));var config=require(_0x66f0('0x3'));config['redis']=_[_0x66f0('0x4')](config[_0x66f0('0x5')],{'host':_0x66f0('0x6'),'port':0x18eb});var io=require(_0x66f0('0x7'))(new Redis(config['redis']));function MailQueue(_0x5debe7){this['id']=_0x5debe7['id']||0x0;this[_0x66f0('0x8')]=_0x5debe7[_0x66f0('0x8')]||'';this['timeout']=_0x5debe7['timeout']||0xa;this['strategy']=_0x5debe7[_0x66f0('0x9')]||'beepall';this[_0x66f0('0xa')]=_0x5debe7['Agents'];this[_0x66f0('0xb')]={};this['waiting']=0x0;this[_0x66f0('0x0')]='';this[_0x66f0('0xc')]();this['updateRealtime']();}MailQueue[_0x66f0('0xd')][_0x66f0('0xc')]=function(){var _0x27e9d6=this['mapAgentsId'][_0x66f0('0xe')];this[_0x66f0('0xb')]=_[_0x66f0('0xf')](this[_0x66f0('0xa')],'id');this['mapAgentsId']['_rr']=_0x27e9d6;};MailQueue[_0x66f0('0xd')][_0x66f0('0x10')]=function(){this[_0x66f0('0x11')]=0x0;this[_0x66f0('0x12')]=0x0;for(var _0x3e543d=0x0;_0x3e543d=0x0?this[_0x66f0('0x15')]:0x0;var _0x1ee3d5={'id':this['id'],'available':this[_0x66f0('0x15')],'loggedIn':this[_0x66f0('0x11')],'name':this[_0x66f0('0x8')],'paused':this[_0x66f0('0x12')],'waiting':this['waiting']};var _0x2d6a8b=md5(JSON[_0x66f0('0x16')](_0x1ee3d5));if(this['md5']!==_0x2d6a8b){this[_0x66f0('0x0')]=_0x2d6a8b;io['to'](util[_0x66f0('0x17')](_0x66f0('0x18'),_0x1ee3d5[_0x66f0('0x8')]))['emit']('mail_queue:save',_0x1ee3d5);}};module[_0x66f0('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 2b8fd9e..3fd1b84 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x2ef3,0xba));var _0x32ef=function(_0x2f7794,_0x3be68e){_0x2f7794=_0x2f7794-0x0;var _0x370a45=_0x2ef3[_0x2f7794];return _0x370a45;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x557ef5,_0x14791c){var _0x7b01d8=function(_0x387bbe){while(--_0x387bbe){_0x557ef5['push'](_0x557ef5['shift']());}};_0x7b01d8(++_0x14791c);}(_0x814b,0x1a2));var _0xb814=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x814b[_0x516ffb];return _0x319667;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bb958f0..016fa5d 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 _0xd3d1=['name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','smsPause','available','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x1ef113,_0x142659){var _0x1abf50=function(_0x2c4ef4){while(--_0x2c4ef4){_0x1ef113['push'](_0x1ef113['shift']());}};_0x1abf50(++_0x142659);}(_0xd3d1,0x172));var _0x1d3d=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xd3d1[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x1d3d('0x0'));var md5=require(_0x1d3d('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x1d3d('0x2'));config[_0x1d3d('0x3')]=_[_0x1d3d('0x4')](config[_0x1d3d('0x3')],{'host':_0x1d3d('0x5'),'port':0x18eb});var io=require(_0x1d3d('0x6'))(new Redis(config[_0x1d3d('0x3')]));function SmsQueue(_0xc64465){this['id']=_0xc64465['id']||0x0;this[_0x1d3d('0x7')]=_0xc64465[_0x1d3d('0x7')]||'';this[_0x1d3d('0x8')]=_0xc64465[_0x1d3d('0x8')]||0xa;this[_0x1d3d('0x9')]=_0xc64465[_0x1d3d('0x9')]||_0x1d3d('0xa');this[_0x1d3d('0xb')]=_0xc64465[_0x1d3d('0xb')];this['mapAgentsId']={};this[_0x1d3d('0xc')]=0x0;this[_0x1d3d('0x1')]='';this[_0x1d3d('0xd')]();this[_0x1d3d('0xe')]();}SmsQueue[_0x1d3d('0xf')][_0x1d3d('0xd')]=function(){var _0x44b374=this[_0x1d3d('0x10')][_0x1d3d('0x11')];this[_0x1d3d('0x10')]=_[_0x1d3d('0x12')](this['Agents'],'id');this[_0x1d3d('0x10')][_0x1d3d('0x11')]=_0x44b374;};SmsQueue['prototype']['updateRealtime']=function(){this[_0x1d3d('0x13')]=0x0;this[_0x1d3d('0x14')]=0x0;for(var _0x1a8035=0x0;_0x1a8035=0x0?this[_0x1d3d('0x18')]:0x0;var _0x50bab4={'id':this['id'],'available':this[_0x1d3d('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x1d3d('0x7')],'paused':this[_0x1d3d('0x14')],'waiting':this[_0x1d3d('0xc')]};var _0x2d6dfb=md5(JSON['stringify'](_0x50bab4));if(this[_0x1d3d('0x1')]!==_0x2d6dfb){this['md5']=_0x2d6dfb;io['to'](util['format'](_0x1d3d('0x19'),_0x50bab4[_0x1d3d('0x7')]))[_0x1d3d('0x1a')](_0x1d3d('0x1b'),_0x50bab4);}};module[_0x1d3d('0x1c')]=SmsQueue; \ No newline at end of file +var _0x3e25=['mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents'];(function(_0x2c55d1,_0x558f3d){var _0x5de2dd=function(_0x41e660){while(--_0x41e660){_0x2c55d1['push'](_0x2c55d1['shift']());}};_0x5de2dd(++_0x558f3d);}(_0x3e25,0x14f));var _0x53e2=function(_0x198ace,_0x388ad3){_0x198ace=_0x198ace-0x0;var _0xf001ed=_0x3e25[_0x198ace];return _0xf001ed;};'use strict';var _=require(_0x53e2('0x0'));var md5=require(_0x53e2('0x1'));var util=require(_0x53e2('0x2'));var Redis=require('ioredis');var config=require(_0x53e2('0x3'));config['redis']=_[_0x53e2('0x4')](config['redis'],{'host':_0x53e2('0x5'),'port':0x18eb});var io=require(_0x53e2('0x6'))(new Redis(config[_0x53e2('0x7')]));function SmsQueue(_0x476761){this['id']=_0x476761['id']||0x0;this[_0x53e2('0x8')]=_0x476761[_0x53e2('0x8')]||'';this[_0x53e2('0x9')]=_0x476761[_0x53e2('0x9')]||0xa;this[_0x53e2('0xa')]=_0x476761[_0x53e2('0xa')]||_0x53e2('0xb');this[_0x53e2('0xc')]=_0x476761[_0x53e2('0xc')];this[_0x53e2('0xd')]={};this[_0x53e2('0xe')]=0x0;this[_0x53e2('0x1')]='';this[_0x53e2('0xf')]();this[_0x53e2('0x10')]();}SmsQueue['prototype'][_0x53e2('0xf')]=function(){var _0x5cf96c=this['mapAgentsId']['_rr'];this[_0x53e2('0xd')]=_[_0x53e2('0x11')](this[_0x53e2('0xc')],'id');this[_0x53e2('0xd')][_0x53e2('0x12')]=_0x5cf96c;};SmsQueue[_0x53e2('0x13')][_0x53e2('0x10')]=function(){this[_0x53e2('0x14')]=0x0;this[_0x53e2('0x15')]=0x0;for(var _0x5d16e2=0x0;_0x5d16e2=0x0?this['available']:0x0;var _0x4213d0={'id':this['id'],'available':this[_0x53e2('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x53e2('0x8')],'paused':this['paused'],'waiting':this[_0x53e2('0xe')]};var _0x55a1ba=md5(JSON['stringify'](_0x4213d0));if(this[_0x53e2('0x1')]!==_0x55a1ba){this[_0x53e2('0x1')]=_0x55a1ba;io['to'](util[_0x53e2('0x19')](_0x53e2('0x1a'),_0x4213d0['name']))[_0x53e2('0x1b')](_0x53e2('0x1c'),_0x4213d0);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 49d9198..bc0e908 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 _0x85b4=['whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','online','whatsappPause','available','loggedIn','waiting','stringify','format','whatsapp:queue:%s'];(function(_0x566904,_0x17ef58){var _0x2735a4=function(_0x3089da){while(--_0x3089da){_0x566904['push'](_0x566904['shift']());}};_0x2735a4(++_0x17ef58);}(_0x85b4,0x1a5));var _0x485b=function(_0x552115,_0x3b83ad){_0x552115=_0x552115-0x0;var _0x8c6e20=_0x85b4[_0x552115];return _0x8c6e20;};'use strict';var _=require(_0x485b('0x0'));var md5=require(_0x485b('0x1'));var util=require(_0x485b('0x2'));var Redis=require(_0x485b('0x3'));var config=require(_0x485b('0x4'));config[_0x485b('0x5')]=_['defaults'](config[_0x485b('0x5')],{'host':_0x485b('0x6'),'port':0x18eb});var io=require(_0x485b('0x7'))(new Redis(config[_0x485b('0x5')]));function WhatsappQueue(_0x25f8ec){this['id']=_0x25f8ec['id']||0x0;this['name']=_0x25f8ec[_0x485b('0x8')]||'';this[_0x485b('0x9')]=_0x25f8ec[_0x485b('0x9')]||0xa;this[_0x485b('0xa')]=_0x25f8ec[_0x485b('0xa')]||'beepall';this[_0x485b('0xb')]=_0x25f8ec['Agents'];this[_0x485b('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x485b('0xd')]();this[_0x485b('0xe')]();}WhatsappQueue[_0x485b('0xf')][_0x485b('0xd')]=function(){var _0xfeaf73=this[_0x485b('0xc')][_0x485b('0x10')];this[_0x485b('0xc')]=_[_0x485b('0x11')](this['Agents'],'id');this[_0x485b('0xc')][_0x485b('0x10')]=_0xfeaf73;};WhatsappQueue[_0x485b('0xf')][_0x485b('0xe')]=function(){this['loggedIn']=0x0;this[_0x485b('0x12')]=0x0;for(var _0x38919b=0x0;_0x38919b=0x0?this[_0x485b('0x15')]:0x0;var _0x3f1c14={'id':this['id'],'available':this[_0x485b('0x15')],'loggedIn':this[_0x485b('0x16')],'name':this[_0x485b('0x8')],'paused':this['paused'],'waiting':this[_0x485b('0x17')]};var _0x1649c6=md5(JSON[_0x485b('0x18')](_0x3f1c14));if(this[_0x485b('0x1')]!==_0x1649c6){this[_0x485b('0x1')]=_0x1649c6;io['to'](util[_0x485b('0x19')](_0x485b('0x1a'),_0x3f1c14[_0x485b('0x8')]))['emit'](_0x485b('0x1b'),_0x3f1c14);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x097a=['format','whatsapp_queue:save','exports','md5','util','defaults','redis','localhost','name','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','length','online','loggedIn','whatsappPause','available'];(function(_0x7bc94,_0x15c543){var _0x4ea45d=function(_0x19c71b){while(--_0x19c71b){_0x7bc94['push'](_0x7bc94['shift']());}};_0x4ea45d(++_0x15c543);}(_0x097a,0x1c5));var _0xa097=function(_0x2084f8,_0x3f1624){_0x2084f8=_0x2084f8-0x0;var _0xbeba7a=_0x097a[_0x2084f8];return _0xbeba7a;};'use strict';var _=require('lodash');var md5=require(_0xa097('0x0'));var util=require(_0xa097('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa097('0x2')](config[_0xa097('0x3')],{'host':_0xa097('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x9422c9){this['id']=_0x9422c9['id']||0x0;this[_0xa097('0x5')]=_0x9422c9['name']||'';this['timeout']=_0x9422c9['timeout']||0xa;this[_0xa097('0x6')]=_0x9422c9[_0xa097('0x6')]||_0xa097('0x7');this[_0xa097('0x8')]=_0x9422c9['Agents'];this['mapAgentsId']={};this[_0xa097('0x9')]=0x0;this[_0xa097('0x0')]='';this[_0xa097('0xa')]();this[_0xa097('0xb')]();}WhatsappQueue[_0xa097('0xc')][_0xa097('0xa')]=function(){var _0x4c15cf=this[_0xa097('0xd')][_0xa097('0xe')];this[_0xa097('0xd')]=_[_0xa097('0xf')](this[_0xa097('0x8')],'id');this[_0xa097('0xd')]['_rr']=_0x4c15cf;};WhatsappQueue['prototype'][_0xa097('0xb')]=function(){this['loggedIn']=0x0;this[_0xa097('0x10')]=0x0;for(var _0x4fb759=0x0;_0x4fb759=0x0?this['available']:0x0;var _0x3c9261={'id':this['id'],'available':this[_0xa097('0x15')],'loggedIn':this[_0xa097('0x13')],'name':this[_0xa097('0x5')],'paused':this[_0xa097('0x10')],'waiting':this['waiting']};var _0x382b1d=md5(JSON['stringify'](_0x3c9261));if(this[_0xa097('0x0')]!==_0x382b1d){this['md5']=_0x382b1d;io['to'](util[_0xa097('0x16')]('whatsapp:queue:%s',_0x3c9261['name']))['emit'](_0xa097('0x17'),_0x3c9261);}};module[_0xa097('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index a5b5172..d5bf42a 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x3b8933,_0x248dcf){var _0x5b3ec7=function(_0x2501c4){while(--_0x2501c4){_0x3b8933['push'](_0x3b8933['shift']());}};_0x5b3ec7(++_0x248dcf);}(_0xb10b,0x12a));var _0xbb10=function(_0x32c154,_0xfd915b){_0x32c154=_0x32c154-0x0;var _0x43a11a=_0xb10b[_0x32c154];return _0x43a11a;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x8b5b33,_0x253d07){var _0x45660c=function(_0x1fced5){while(--_0x1fced5){_0x8b5b33['push'](_0x8b5b33['shift']());}};_0x45660c(++_0x253d07);}(_0xb10b,0x12a));var _0xbb10=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0xb10b[_0x75267d];return _0x21ccec;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 2695b4c..f0eae03 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 _0xf38f=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','Request'];(function(_0x1ff08f,_0x18d1ff){var _0x46ead0=function(_0x53cc9c){while(--_0x53cc9c){_0x1ff08f['push'](_0x1ff08f['shift']());}};_0x46ead0(++_0x18d1ff);}(_0xf38f,0x1af));var _0xff38=function(_0x1c2aeb,_0x48433c){_0x1c2aeb=_0x1c2aeb-0x0;var _0x783379=_0xf38f[_0x1c2aeb];return _0x783379;};'use strict';var client=require('../client');exports['update']=function(_0x216171,_0x4fae23){return client[_0xff38('0x0')](_0xff38('0x1'),{'body':_0x4fae23,'options':{'where':{'id':_0x216171}},'log':_0xff38('0x2')});};exports[_0xff38('0x3')]=function(_0x2d0e04,_0x2e0ff6){return client[_0xff38('0x0')](_0xff38('0x4'),{'body':_0x2e0ff6,'options':{'where':{'id':_0x2d0e04}},'log':_0xff38('0x5')});}; \ No newline at end of file +var _0xb55d=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x2eb6f3,_0x43fff8){var _0x22eb2c=function(_0x2c1364){while(--_0x2c1364){_0x2eb6f3['push'](_0x2eb6f3['shift']());}};_0x22eb2c(++_0x43fff8);}(_0xb55d,0x13d));var _0xdb55=function(_0x525275,_0xcd98aa){_0x525275=_0x525275-0x0;var _0x5453e3=_0xb55d[_0x525275];return _0x5453e3;};'use strict';var client=require(_0xdb55('0x0'));exports[_0xdb55('0x1')]=function(_0x302994,_0x4fff45){return client[_0xdb55('0x2')](_0xdb55('0x3'),{'body':_0x4fff45,'options':{'where':{'id':_0x302994}},'log':_0xdb55('0x4')});};exports[_0xdb55('0x5')]=function(_0x452526,_0x37181b){return client['Request'](_0xdb55('0x6'),{'body':_0x37181b,'options':{'where':{'id':_0x452526}},'log':_0xdb55('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f8b76d8..fde6fa4 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 _0xa150=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x5b8425,_0x5813d1){var _0x41aa92=function(_0x23d67d){while(--_0x23d67d){_0x5b8425['push'](_0x5b8425['shift']());}};_0x41aa92(++_0x5813d1);}(_0xa150,0x1ec));var _0x0a15=function(_0x265ff7,_0x24b073){_0x265ff7=_0x265ff7-0x0;var _0x5a6f28=_0xa150[_0x265ff7];return _0x5a6f28;};'use strict';var client=require(_0x0a15('0x0'));exports[_0x0a15('0x1')]=function(_0x406142){return client[_0x0a15('0x2')](_0x0a15('0x3'),{'body':_0x406142,'log':_0x0a15('0x4')});}; \ No newline at end of file +var _0xea0b=['../client','Request','CreateChatMessage'];(function(_0x421f64,_0x5f748a){var _0x533360=function(_0x5a6869){while(--_0x5a6869){_0x421f64['push'](_0x421f64['shift']());}};_0x533360(++_0x5f748a);}(_0xea0b,0xb1));var _0xbea0=function(_0x262531,_0x5f3eeb){_0x262531=_0x262531-0x0;var _0x8e52b5=_0xea0b[_0x262531];return _0x8e52b5;};'use strict';var client=require(_0xbea0('0x0'));exports['create']=function(_0x1da38a){return client[_0xbea0('0x1')](_0xbea0('0x2'),{'body':_0x1da38a,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index e950124..0eb2e72 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 _0xe700=['GetChatQueue','name','timeout','strategy','User','Agents','chatPause','../client','getChatQueues','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe700,0x75));var _0x0e70=function(_0x2b222e,_0x4bd0ff){_0x2b222e=_0x2b222e-0x0;var _0x2ec979=_0xe700[_0x2b222e];return _0x2ec979;};'use strict';var client=require(_0x0e70('0x0'));exports[_0x0e70('0x1')]=function(){return function(){return client[_0x0e70('0x2')](_0x0e70('0x3'),{'options':{'raw':![],'attributes':['id',_0x0e70('0x4'),_0x0e70('0x5'),_0x0e70('0x6')],'include':[{'model':_0x0e70('0x7'),'as':_0x0e70('0x8'),'attributes':['id',_0x0e70('0x4'),'online',_0x0e70('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x3f1c=['Agents','name','online','getChatQueues','../client','GetChatQueue','strategy','User'];(function(_0x116322,_0x388496){var _0x1aea71=function(_0x52577e){while(--_0x52577e){_0x116322['push'](_0x116322['shift']());}};_0x1aea71(++_0x388496);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x245a6e,_0x179244){_0x245a6e=_0x245a6e-0x0;var _0x2be3da=_0x3f1c[_0x245a6e];return _0x2be3da;};'use strict';var client=require(_0xc3f1('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0xc3f1('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xc3f1('0x2')],'include':[{'model':_0xc3f1('0x3'),'as':_0xc3f1('0x4'),'attributes':['id',_0xc3f1('0x5'),_0xc3f1('0x6'),'chatPause']}]},'log':_0xc3f1('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ef427df..322a9de 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 _0x24cd=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','../client'];(function(_0x44feb5,_0x3f7964){var _0x45e3b8=function(_0x2848be){while(--_0x2848be){_0x44feb5['push'](_0x44feb5['shift']());}};_0x45e3b8(++_0x3f7964);}(_0x24cd,0x83));var _0xd24c=function(_0x4fb2da,_0x8b1d01){_0x4fb2da=_0x4fb2da-0x0;var _0x2e45d7=_0x24cd[_0x4fb2da];return _0x2e45d7;};'use strict';var client=require(_0xd24c('0x0'));exports[_0xd24c('0x1')]=function(_0x4dc270){return client[_0xd24c('0x2')]('CreateChatQueueReport',{'body':_0x4dc270,'log':_0xd24c('0x3')});};exports[_0xd24c('0x4')]=function(_0x3bd534,_0x4d515c){return client[_0xd24c('0x2')](_0xd24c('0x5'),{'body':_0x4d515c,'options':{'where':{'uniqueid':_0x3bd534},'order':[['id','DESC']],'limit':0x1},'log':_0xd24c('0x5')});}; \ No newline at end of file +var _0x80fb=['update','Request','UpdateChatQueueReport','DESC','create','CreateChatQueueReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x80fb,0x11e));var _0xb80f=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x80fb[_0x2bf141];return _0x48277b;};'use strict';var client=require('../client');exports[_0xb80f('0x0')]=function(_0x2ee5b7){return client['Request'](_0xb80f('0x1'),{'body':_0x2ee5b7,'log':_0xb80f('0x1')});};exports[_0xb80f('0x2')]=function(_0x3a37b3,_0x22de9a){return client[_0xb80f('0x3')](_0xb80f('0x4'),{'body':_0x22de9a,'options':{'where':{'uniqueid':_0x3a37b3},'order':[['id',_0xb80f('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index f0bb2ca..b426c55 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0x7a54,0x106));var _0x47a5=function(_0x45bdc2,_0x5cbe30){_0x45bdc2=_0x45bdc2-0x0;var _0x5ee8fe=_0x7a54[_0x45bdc2];return _0x5ee8fe;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x54efa8,_0x3bedbe){var _0x5eafc1=function(_0x5b0c7e){while(--_0x5b0c7e){_0x54efa8['push'](_0x54efa8['shift']());}};_0x5eafc1(++_0x3bedbe);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a5b6e26..33f2dd7 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 _0x16b2=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x2d83bb,_0x249620){var _0x328ae8=function(_0x4456d8){while(--_0x4456d8){_0x2d83bb['push'](_0x2d83bb['shift']());}};_0x328ae8(++_0x249620);}(_0x16b2,0x197));var _0x216b=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x16b2[_0x1ebce2];return _0x4a330c;};'use strict';var client=require(_0x216b('0x0'));exports[_0x216b('0x1')]=function(_0x57bd0c){return client['Request'](_0x216b('0x2'),{'body':_0x57bd0c,'log':_0x216b('0x3')});}; \ No newline at end of file +var _0xe917=['create','Request','CreateFaxMessage'];(function(_0x5b2667,_0xfa04de){var _0x1c348e=function(_0x2dd1ff){while(--_0x2dd1ff){_0x5b2667['push'](_0x5b2667['shift']());}};_0x1c348e(++_0xfa04de);}(_0xe917,0xab));var _0x7e91=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xe917[_0x50aa2e];return _0x5e07f0;};'use strict';var client=require('../client');exports[_0x7e91('0x0')]=function(_0x3bfe79){return client[_0x7e91('0x1')](_0x7e91('0x2'),{'body':_0x3bfe79,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2e888ad..393d6d5 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 _0x638f=['getFaxQueues','Request','GetFaxQueue','name','timeout','User','Agents','online','faxPause'];(function(_0x4be9db,_0x4b2c1b){var _0x20f265=function(_0x36f4dd){while(--_0x36f4dd){_0x4be9db['push'](_0x4be9db['shift']());}};_0x20f265(++_0x4b2c1b);}(_0x638f,0x18d));var _0xf638=function(_0x4815a6,_0x29ef5e){_0x4815a6=_0x4815a6-0x0;var _0x309740=_0x638f[_0x4815a6];return _0x309740;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xf638('0x0')](_0xf638('0x1'),{'options':{'raw':![],'attributes':['id',_0xf638('0x2'),_0xf638('0x3'),'strategy'],'include':[{'model':_0xf638('0x4'),'as':_0xf638('0x5'),'attributes':['id',_0xf638('0x2'),_0xf638('0x6'),_0xf638('0x7')]}]},'log':_0xf638('0x8')});};}; \ No newline at end of file +var _0x069b=['GetFaxQueue','name','strategy','Agents','online','faxPause','getFaxQueues','../client','Request'];(function(_0x1b0680,_0x49f513){var _0x19c30d=function(_0x4eb734){while(--_0x4eb734){_0x1b0680['push'](_0x1b0680['shift']());}};_0x19c30d(++_0x49f513);}(_0x069b,0x1e4));var _0xb069=function(_0x837592,_0x4a642c){_0x837592=_0x837592-0x0;var _0x5b1c29=_0x069b[_0x837592];return _0x5b1c29;};'use strict';var client=require(_0xb069('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xb069('0x1')](_0xb069('0x2'),{'options':{'raw':![],'attributes':['id',_0xb069('0x3'),'timeout',_0xb069('0x4')],'include':[{'model':'User','as':_0xb069('0x5'),'attributes':['id',_0xb069('0x3'),_0xb069('0x6'),_0xb069('0x7')]}]},'log':_0xb069('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 18b0efb..6d6f432 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 _0xed9f=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0xed9f,0x1a3));var _0xfed9=function(_0x41eb44,_0x229d85){_0x41eb44=_0x41eb44-0x0;var _0x334ba7=_0xed9f[_0x41eb44];return _0x334ba7;};'use strict';var client=require(_0xfed9('0x0'));exports[_0xfed9('0x1')]=function(_0x2e134d){return client[_0xfed9('0x2')](_0xfed9('0x3'),{'body':_0x2e134d,'log':'CreateFaxQueueReport'});};exports[_0xfed9('0x4')]=function(_0x4a5dc1,_0x1b6b49){return client[_0xfed9('0x2')](_0xfed9('0x5'),{'body':_0x1b6b49,'options':{'where':{'uniqueid':_0x4a5dc1},'order':[['id','DESC']],'limit':0x1},'log':_0xfed9('0x5')});}; \ No newline at end of file +var _0xc89b=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0xcc9e86,_0x4417fe){var _0x1ba436=function(_0x145b13){while(--_0x145b13){_0xcc9e86['push'](_0xcc9e86['shift']());}};_0x1ba436(++_0x4417fe);}(_0xc89b,0x7d));var _0xbc89=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xc89b[_0x54d4fe];return _0x1ab5bb;};'use strict';var client=require(_0xbc89('0x0'));exports['create']=function(_0x1280cc){return client[_0xbc89('0x1')](_0xbc89('0x2'),{'body':_0x1280cc,'log':_0xbc89('0x2')});};exports[_0xbc89('0x3')]=function(_0x4fd6e6,_0x17932b){return client['Request'](_0xbc89('0x4'),{'body':_0x17932b,'options':{'where':{'uniqueid':_0x4fd6e6},'order':[['id',_0xbc89('0x5')]],'limit':0x1},'log':_0xbc89('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d064ff6..ed87f66 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 _0x6e25=['name','Interval','interval','../client','getIntervals','Request','GetInterval'];(function(_0xf9dc73,_0x2b0cb8){var _0x5a6dae=function(_0x142fbe){while(--_0x142fbe){_0xf9dc73['push'](_0xf9dc73['shift']());}};_0x5a6dae(++_0x2b0cb8);}(_0x6e25,0x65));var _0x56e2=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x6e25[_0x59342a];return _0x17abc9;};'use strict';var client=require(_0x56e2('0x0'));exports[_0x56e2('0x1')]=function(){return function(){return client[_0x56e2('0x2')](_0x56e2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x56e2('0x4')],'include':[{'model':_0x56e2('0x5'),'as':'Intervals','attributes':['id','name',_0x56e2('0x6')]}]},'log':_0x56e2('0x1')});};}; \ No newline at end of file +var _0x37a1=['interval','Request','Intervals'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x37a1,0xdc));var _0x137a=function(_0x5b1a89,_0x332e92){_0x5b1a89=_0x5b1a89-0x0;var _0x59c40a=_0x37a1[_0x5b1a89];return _0x59c40a;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x137a('0x0')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x137a('0x1'),'attributes':['id','name',_0x137a('0x2')]}]},'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 a3ea013..1eff3f7 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 _0x3de3=['../client','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x5c3dd3,_0x4a252b){var _0x115d79=function(_0x3c8f1e){while(--_0x3c8f1e){_0x5c3dd3['push'](_0x5c3dd3['shift']());}};_0x115d79(++_0x4a252b);}(_0x3de3,0x1ce));var _0x33de=function(_0x112e34,_0x5ada1b){_0x112e34=_0x112e34-0x0;var _0x4da89e=_0x3de3[_0x112e34];return _0x4da89e;};'use strict';var client=require(_0x33de('0x0'));exports['update']=function(_0x19d1ba,_0x100783){return client['Request'](_0x33de('0x1'),{'body':_0x100783,'options':{'where':{'id':_0x19d1ba}},'log':_0x33de('0x2')});};exports[_0x33de('0x3')]=function(_0xbdd404,_0x56b413){return client[_0x33de('0x4')](_0x33de('0x5'),{'body':_0x56b413,'options':{'where':{'id':_0xbdd404}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xb03e=['addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0xf49d6b,_0x46478f){var _0x37adac=function(_0x558462){while(--_0x558462){_0xf49d6b['push'](_0xf49d6b['shift']());}};_0x37adac(++_0x46478f);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3e4517,_0x59e747){_0x3e4517=_0x3e4517-0x0;var _0x2a879b=_0xb03e[_0x3e4517];return _0x2a879b;};'use strict';var client=require('../client');exports[_0xeb03('0x0')]=function(_0x399504,_0x868905){return client[_0xeb03('0x1')](_0xeb03('0x2'),{'body':_0x868905,'options':{'where':{'id':_0x399504}},'log':_0xeb03('0x3')});};exports[_0xeb03('0x4')]=function(_0x1fe650,_0x474450){return client[_0xeb03('0x1')](_0xeb03('0x5'),{'body':_0x474450,'options':{'where':{'id':_0x1fe650}},'log':_0xeb03('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 7e44116..18fc5c0 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 _0x563b=['create','../client'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x563b,0x73));var _0xb563=function(_0x298421,_0x33af0e){_0x298421=_0x298421-0x0;var _0x3ac563=_0x563b[_0x298421];return _0x3ac563;};'use strict';var client=require(_0xb563('0x0'));exports[_0xb563('0x1')]=function(_0x3fcef2){return client['Request']('CreateMailMessage',{'body':_0x3fcef2,'log':'createMailMessage'});}; \ No newline at end of file +var _0x8e54=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x4cdefc,_0xd38d9b){var _0x4d61a8=function(_0x3a35b4){while(--_0x3a35b4){_0x4cdefc['push'](_0x4cdefc['shift']());}};_0x4d61a8(++_0xd38d9b);}(_0x8e54,0x15d));var _0x48e5=function(_0x385460,_0x2aec74){_0x385460=_0x385460-0x0;var _0x5ef6b2=_0x8e54[_0x385460];return _0x5ef6b2;};'use strict';var client=require('../client');exports[_0x48e5('0x0')]=function(_0x1d433b){return client[_0x48e5('0x1')](_0x48e5('0x2'),{'body':_0x1d433b,'log':_0x48e5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8079727..e746781 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 _0xf465=['getMailQueues','Request','GetMailQueue','timeout','User','online','mailPause','../client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf465,0x8f));var _0x5f46=function(_0x26cebc,_0x4fbbfa){_0x26cebc=_0x26cebc-0x0;var _0x18cf95=_0xf465[_0x26cebc];return _0x18cf95;};'use strict';var client=require(_0x5f46('0x0'));exports[_0x5f46('0x1')]=function(){return function(){return client[_0x5f46('0x2')](_0x5f46('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5f46('0x4'),'strategy'],'include':[{'model':_0x5f46('0x5'),'as':'Agents','attributes':['id','name',_0x5f46('0x6'),_0x5f46('0x7')]}]},'log':_0x5f46('0x1')});};}; \ No newline at end of file +var _0x2093=['timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request','name'];(function(_0x1b581c,_0x23b66c){var _0x38a9d5=function(_0x5ef127){while(--_0x5ef127){_0x1b581c['push'](_0x1b581c['shift']());}};_0x38a9d5(++_0x23b66c);}(_0x2093,0x15a));var _0x3209=function(_0x105c51,_0x412d34){_0x105c51=_0x105c51-0x0;var _0x1f727d=_0x2093[_0x105c51];return _0x1f727d;};'use strict';var client=require(_0x3209('0x0'));exports[_0x3209('0x1')]=function(){return function(){return client[_0x3209('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x3209('0x3'),_0x3209('0x4'),_0x3209('0x5')],'include':[{'model':_0x3209('0x6'),'as':_0x3209('0x7'),'attributes':['id',_0x3209('0x3'),_0x3209('0x8'),_0x3209('0x9')]}]},'log':_0x3209('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 281869e..671e617 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 _0x8235=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x468668,_0x16c8dd){var _0x4a8820=function(_0x2f0430){while(--_0x2f0430){_0x468668['push'](_0x468668['shift']());}};_0x4a8820(++_0x16c8dd);}(_0x8235,0x1a5));var _0x5823=function(_0x53b450,_0x347ca5){_0x53b450=_0x53b450-0x0;var _0x3e38ec=_0x8235[_0x53b450];return _0x3e38ec;};'use strict';var client=require(_0x5823('0x0'));exports[_0x5823('0x1')]=function(_0x593949){return client[_0x5823('0x2')](_0x5823('0x3'),{'body':_0x593949,'log':'CreateMailQueueReport'});};exports[_0x5823('0x4')]=function(_0x4064e9,_0x33c854){return client[_0x5823('0x2')](_0x5823('0x5'),{'body':_0x33c854,'options':{'where':{'uniqueid':_0x4064e9},'order':[['id',_0x5823('0x6')]],'limit':0x1},'log':_0x5823('0x5')});}; \ No newline at end of file +var _0x195d=['../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0x195d,0x73));var _0xd195=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0x195d[_0x12d812];return _0x3711ab;};'use strict';var client=require(_0xd195('0x0'));exports[_0xd195('0x1')]=function(_0x5189a1){return client[_0xd195('0x2')](_0xd195('0x3'),{'body':_0x5189a1,'log':_0xd195('0x3')});};exports['update']=function(_0x527952,_0x5d1b77){return client['Request'](_0xd195('0x4'),{'body':_0x5d1b77,'options':{'where':{'uniqueid':_0x527952},'order':[['id','DESC']],'limit':0x1},'log':_0xd195('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 8a47369..222cb95 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 _0x14a4=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x377756,_0x393726){var _0x5c4f4c=function(_0x32fb00){while(--_0x32fb00){_0x377756['push'](_0x377756['shift']());}};_0x5c4f4c(++_0x393726);}(_0x14a4,0x71));var _0x414a=function(_0x3e6852,_0x481312){_0x3e6852=_0x3e6852-0x0;var _0x389515=_0x14a4[_0x3e6852];return _0x389515;};'use strict';var client=require(_0x414a('0x0'));exports['update']=function(_0x16373b,_0x2e8256){return client[_0x414a('0x1')](_0x414a('0x2'),{'body':_0x2e8256,'options':{'where':{'id':_0x16373b}},'log':_0x414a('0x3')});};exports[_0x414a('0x4')]=function(_0x2543b7,_0x5ad89c){return client[_0x414a('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x5ad89c,'options':{'where':{'id':_0x2543b7}},'log':_0x414a('0x5')});}; \ No newline at end of file +var _0xe839=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x9406e8,_0x5bae3e){var _0x361ce9=function(_0x247384){while(--_0x247384){_0x9406e8['push'](_0x9406e8['shift']());}};_0x361ce9(++_0x5bae3e);}(_0xe839,0xc9));var _0x9e83=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0xe839[_0x1034ee];return _0x2922af;};'use strict';var client=require(_0x9e83('0x0'));exports[_0x9e83('0x1')]=function(_0x44e933,_0x58e441){return client[_0x9e83('0x2')](_0x9e83('0x3'),{'body':_0x58e441,'options':{'where':{'id':_0x44e933}},'log':_0x9e83('0x4')});};exports['addTags']=function(_0x46ea69,_0x4ec7b3){return client[_0x9e83('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x4ec7b3,'options':{'where':{'id':_0x46ea69}},'log':_0x9e83('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b8ee384..2f935a6 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 _0x6c5b=['createOpenchannelMessage','../client','create','Request'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x6c5b,0xc5));var _0xb6c5=function(_0x32e29c,_0x260b4e){_0x32e29c=_0x32e29c-0x0;var _0x96c768=_0x6c5b[_0x32e29c];return _0x96c768;};'use strict';var client=require(_0xb6c5('0x0'));exports[_0xb6c5('0x1')]=function(_0x477c5e){return client[_0xb6c5('0x2')]('CreateOpenchannelMessage',{'body':_0x477c5e,'log':_0xb6c5('0x3')});}; \ No newline at end of file +var _0x7fed=['../client','Request','createOpenchannelMessage'];(function(_0x26ad67,_0x1f49c9){var _0x97d92f=function(_0x3d4a0b){while(--_0x3d4a0b){_0x26ad67['push'](_0x26ad67['shift']());}};_0x97d92f(++_0x1f49c9);}(_0x7fed,0x1bf));var _0xd7fe=function(_0x1307ea,_0x5661e6){_0x1307ea=_0x1307ea-0x0;var _0x2ccb3b=_0x7fed[_0x1307ea];return _0x2ccb3b;};'use strict';var client=require(_0xd7fe('0x0'));exports['create']=function(_0x4c151e){return client[_0xd7fe('0x1')]('CreateOpenchannelMessage',{'body':_0x4c151e,'log':_0xd7fe('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 54b2e92..6af0d52 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 _0x5a4b=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents','openchannelPause','../client'];(function(_0x3cbf9b,_0x1b1b2d){var _0x5e8205=function(_0x1213b2){while(--_0x1213b2){_0x3cbf9b['push'](_0x3cbf9b['shift']());}};_0x5e8205(++_0x1b1b2d);}(_0x5a4b,0x1a6));var _0xb5a4=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x5a4b[_0x2070da];return _0x4f9fe1;};'use strict';var client=require(_0xb5a4('0x0'));exports[_0xb5a4('0x1')]=function(){return function(){return client[_0xb5a4('0x2')](_0xb5a4('0x3'),{'options':{'raw':![],'attributes':['id',_0xb5a4('0x4'),_0xb5a4('0x5'),_0xb5a4('0x6')],'include':[{'model':'User','as':_0xb5a4('0x7'),'attributes':['id','name','online',_0xb5a4('0x8')]}]},'log':_0xb5a4('0x1')});};}; \ No newline at end of file +var _0xbe0f=['getOpenchannelQueues','name','strategy','Agents','online','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe0f,0x1d3));var _0xfbe0=function(_0x419f92,_0x3486d6){_0x419f92=_0x419f92-0x0;var _0x28b5ca=_0xbe0f[_0x419f92];return _0x28b5ca;};'use strict';var client=require(_0xfbe0('0x0'));exports[_0xfbe0('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xfbe0('0x2'),'timeout',_0xfbe0('0x3')],'include':[{'model':'User','as':_0xfbe0('0x4'),'attributes':['id',_0xfbe0('0x2'),_0xfbe0('0x5'),'openchannelPause']}]},'log':_0xfbe0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8da0433..2e1862a 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 _0x4cbc=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x103d2c,_0x524121){var _0x1e09e6=function(_0x35ffff){while(--_0x35ffff){_0x103d2c['push'](_0x103d2c['shift']());}};_0x1e09e6(++_0x524121);}(_0x4cbc,0x1cf));var _0xc4cb=function(_0x51aebb,_0x337d75){_0x51aebb=_0x51aebb-0x0;var _0x4d162e=_0x4cbc[_0x51aebb];return _0x4d162e;};'use strict';var client=require(_0xc4cb('0x0'));exports[_0xc4cb('0x1')]=function(_0x259b58){return client[_0xc4cb('0x2')](_0xc4cb('0x3'),{'body':_0x259b58,'log':_0xc4cb('0x3')});};exports[_0xc4cb('0x4')]=function(_0x2f2301,_0x29af26){return client[_0xc4cb('0x2')](_0xc4cb('0x5'),{'body':_0x29af26,'options':{'where':{'uniqueid':_0x2f2301},'order':[['id',_0xc4cb('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xa3b9=['update','DESC','../client','create','Request'];(function(_0x18e3fc,_0x4ac195){var _0x366d5a=function(_0x3896e3){while(--_0x3896e3){_0x18e3fc['push'](_0x18e3fc['shift']());}};_0x366d5a(++_0x4ac195);}(_0xa3b9,0x6b));var _0x9a3b=function(_0x408541,_0x477f3e){_0x408541=_0x408541-0x0;var _0x2e04db=_0xa3b9[_0x408541];return _0x2e04db;};'use strict';var client=require(_0x9a3b('0x0'));exports[_0x9a3b('0x1')]=function(_0x32be50){return client[_0x9a3b('0x2')]('CreateOpenchannelQueueReport',{'body':_0x32be50,'log':'CreateOpenchannelQueueReport'});};exports[_0x9a3b('0x3')]=function(_0xab2fa1,_0x19f6f2){return client[_0x9a3b('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x19f6f2,'options':{'where':{'uniqueid':_0xab2fa1},'order':[['id',_0x9a3b('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c18a546..d6e3e83 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 _0xf452=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0xd80622,_0x1b700a){var _0xb45dfb=function(_0x14fe1e){while(--_0x14fe1e){_0xd80622['push'](_0xd80622['shift']());}};_0xb45dfb(++_0x1b700a);}(_0xf452,0x13b));var _0x2f45=function(_0x276d43,_0x509837){_0x276d43=_0x276d43-0x0;var _0x218b21=_0xf452[_0x276d43];return _0x218b21;};'use strict';var client=require(_0x2f45('0x0'));exports[_0x2f45('0x1')]=function(_0x55d48e,_0x3b13d3){return client[_0x2f45('0x2')](_0x2f45('0x3'),{'body':_0x3b13d3,'options':{'where':{'id':_0x55d48e}},'log':_0x2f45('0x4')});};exports[_0x2f45('0x5')]=function(_0x3f0b30,_0x24c61d){return client[_0x2f45('0x2')](_0x2f45('0x6'),{'body':_0x24c61d,'options':{'where':{'id':_0x3f0b30}},'log':_0x2f45('0x7')});}; \ No newline at end of file +var _0x27bf=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client'];(function(_0x15a551,_0x63d4a4){var _0x14034f=function(_0x5d9515){while(--_0x5d9515){_0x15a551['push'](_0x15a551['shift']());}};_0x14034f(++_0x63d4a4);}(_0x27bf,0x117));var _0xf27b=function(_0x1b0e66,_0x552dce){_0x1b0e66=_0x1b0e66-0x0;var _0x43f2a8=_0x27bf[_0x1b0e66];return _0x43f2a8;};'use strict';var client=require(_0xf27b('0x0'));exports[_0xf27b('0x1')]=function(_0x2227af,_0x43cecf){return client[_0xf27b('0x2')](_0xf27b('0x3'),{'body':_0x43cecf,'options':{'where':{'id':_0x2227af}},'log':_0xf27b('0x4')});};exports[_0xf27b('0x5')]=function(_0x339bb9,_0x1542e3){return client[_0xf27b('0x2')]('AddTagsToSmsInteraction',{'body':_0x1542e3,'options':{'where':{'id':_0x339bb9}},'log':_0xf27b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index af206e6..4fd6231 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 _0x9e29=['Request','../client','create'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9e29,0x17e));var _0x99e2=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x9e29[_0x4dc7b9];return _0x3ab114;};'use strict';var client=require(_0x99e2('0x0'));exports[_0x99e2('0x1')]=function(_0x179347){return client[_0x99e2('0x2')]('CreateSmsMessage',{'body':_0x179347,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x1d70=['CreateSmsMessage','../client','create','Request'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x1d70,0x1e9));var _0x01d7=function(_0x247b15,_0x4ecec5){_0x247b15=_0x247b15-0x0;var _0x5c123a=_0x1d70[_0x247b15];return _0x5c123a;};'use strict';var client=require(_0x01d7('0x0'));exports[_0x01d7('0x1')]=function(_0x588f08){return client[_0x01d7('0x2')](_0x01d7('0x3'),{'body':_0x588f08,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3b4facf..a4513b4 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x303ded,_0x4aa993){var _0xf693ea=function(_0x863cbf){while(--_0x863cbf){_0x303ded['push'](_0x303ded['shift']());}};_0xf693ea(++_0x4aa993);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0xc4d135,_0x11e0a0){var _0x2bf805=function(_0x30a617){while(--_0x30a617){_0xc4d135['push'](_0xc4d135['shift']());}};_0x2bf805(++_0x11e0a0);}(_0xe706,0xa3));var _0x6e70=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0xe706[_0x2265da];return _0x430c2b;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f46043f..3124ecf 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x32e48c,_0x34673b){var _0x465027=function(_0x14e878){while(--_0x14e878){_0x32e48c['push'](_0x32e48c['shift']());}};_0x465027(++_0x34673b);}(_0x34e8,0x12c));var _0x834e=function(_0x39d3b2,_0x3e23d){_0x39d3b2=_0x39d3b2-0x0;var _0x2a2764=_0x34e8[_0x39d3b2];return _0x2a2764;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x25c1bd,_0x2b9085){var _0x1eea5f=function(_0x3b720c){while(--_0x3b720c){_0x25c1bd['push'](_0x25c1bd['shift']());}};_0x1eea5f(++_0x2b9085);}(_0x008c,0x188));var _0xc008=function(_0x3d5798,_0x11a5a4){_0x3d5798=_0x3d5798-0x0;var _0x2f9b86=_0x008c[_0x3d5798];return _0x2f9b86;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 986aabe..46cd0c2 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(_0x59bca9,_0x3cf77f){var _0x472e28=function(_0x3175e4){while(--_0x3175e4){_0x59bca9['push'](_0x59bca9['shift']());}};_0x472e28(++_0x3cf77f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x4da1fb,_0xe089b6){var _0x5c3b30=function(_0x126b49){while(--_0x126b49){_0x4da1fb['push'](_0x4da1fb['shift']());}};_0x5c3b30(++_0xe089b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 e036abe..3338fa7 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 _0x6eed=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction'];(function(_0x5bd1f3,_0x209c43){var _0x521d80=function(_0x3b76db){while(--_0x3b76db){_0x5bd1f3['push'](_0x5bd1f3['shift']());}};_0x521d80(++_0x209c43);}(_0x6eed,0xff));var _0xd6ee=function(_0x5f2349,_0x551a0d){_0x5f2349=_0x5f2349-0x0;var _0x50bc34=_0x6eed[_0x5f2349];return _0x50bc34;};'use strict';var client=require(_0xd6ee('0x0'));exports[_0xd6ee('0x1')]=function(_0x1d3217,_0x27b7bf){return client[_0xd6ee('0x2')]('UpdateWhatsappInteraction',{'body':_0x27b7bf,'options':{'where':{'id':_0x1d3217}},'log':_0xd6ee('0x3')});};exports[_0xd6ee('0x4')]=function(_0x588715,_0x53cce9){return client[_0xd6ee('0x2')](_0xd6ee('0x5'),{'body':_0x53cce9,'options':{'where':{'id':_0x588715}},'log':_0xd6ee('0x6')});}; \ No newline at end of file +var _0x90ec=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client'];(function(_0x46cea2,_0x4cd50d){var _0x4d1f5a=function(_0x37696c){while(--_0x37696c){_0x46cea2['push'](_0x46cea2['shift']());}};_0x4d1f5a(++_0x4cd50d);}(_0x90ec,0x1d4));var _0xc90e=function(_0x41ba7c,_0x21b2bb){_0x41ba7c=_0x41ba7c-0x0;var _0xb1bf6a=_0x90ec[_0x41ba7c];return _0xb1bf6a;};'use strict';var client=require(_0xc90e('0x0'));exports[_0xc90e('0x1')]=function(_0x54f2e6,_0x3ed0fc){return client[_0xc90e('0x2')](_0xc90e('0x3'),{'body':_0x3ed0fc,'options':{'where':{'id':_0x54f2e6}},'log':_0xc90e('0x4')});};exports[_0xc90e('0x5')]=function(_0x57acfe,_0x1c13c4){return client[_0xc90e('0x2')](_0xc90e('0x6'),{'body':_0x1c13c4,'options':{'where':{'id':_0x57acfe}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 596d4a8..26d5e8b 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 _0x18da=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x56739b,_0x2d2cc9){var _0x1c752f=function(_0x228220){while(--_0x228220){_0x56739b['push'](_0x56739b['shift']());}};_0x1c752f(++_0x2d2cc9);}(_0x18da,0x167));var _0xa18d=function(_0x438c12,_0x14ae57){_0x438c12=_0x438c12-0x0;var _0x3d76e6=_0x18da[_0x438c12];return _0x3d76e6;};'use strict';var client=require(_0xa18d('0x0'));exports[_0xa18d('0x1')]=function(_0x5654e1){return client[_0xa18d('0x2')](_0xa18d('0x3'),{'body':_0x5654e1,'log':_0xa18d('0x4')});}; \ No newline at end of file +var _0x57a7=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x57a7,0xf9));var _0x757a=function(_0x363ac4,_0xdaf72a){_0x363ac4=_0x363ac4-0x0;var _0x18289e=_0x57a7[_0x363ac4];return _0x18289e;};'use strict';var client=require(_0x757a('0x0'));exports[_0x757a('0x1')]=function(_0xd9e9a8){return client['Request'](_0x757a('0x2'),{'body':_0xd9e9a8,'log':_0x757a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 741b612..798e134 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 _0xc92f=['../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','whatsappPause'];(function(_0x465f47,_0xa750e7){var _0x23740f=function(_0x208bd2){while(--_0x208bd2){_0x465f47['push'](_0x465f47['shift']());}};_0x23740f(++_0xa750e7);}(_0xc92f,0x136));var _0xfc92=function(_0xad12e7,_0x2301f1){_0xad12e7=_0xad12e7-0x0;var _0x2316ca=_0xc92f[_0xad12e7];return _0x2316ca;};'use strict';var client=require(_0xfc92('0x0'));exports[_0xfc92('0x1')]=function(){return function(){return client[_0xfc92('0x2')](_0xfc92('0x3'),{'options':{'raw':![],'attributes':['id',_0xfc92('0x4'),_0xfc92('0x5'),_0xfc92('0x6')],'include':[{'model':_0xfc92('0x7'),'as':_0xfc92('0x8'),'attributes':['id',_0xfc92('0x4'),'online',_0xfc92('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x7531=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','whatsappPause','../client'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x7531,0x1d5));var _0x1753=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7531[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x1753('0x0'));exports[_0x1753('0x1')]=function(){return function(){return client[_0x1753('0x2')](_0x1753('0x3'),{'options':{'raw':![],'attributes':['id',_0x1753('0x4'),_0x1753('0x5'),_0x1753('0x6')],'include':[{'model':_0x1753('0x7'),'as':_0x1753('0x8'),'attributes':['id','name','online',_0x1753('0x9')]}]},'log':_0x1753('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e62f2f4..c282ea3 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 _0x1d6f=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x3c9cd1,_0x555129){var _0x4820a9=function(_0x1e552e){while(--_0x1e552e){_0x3c9cd1['push'](_0x3c9cd1['shift']());}};_0x4820a9(++_0x555129);}(_0x1d6f,0x73));var _0xf1d6=function(_0x494be2,_0x254a77){_0x494be2=_0x494be2-0x0;var _0x35224d=_0x1d6f[_0x494be2];return _0x35224d;};'use strict';var client=require(_0xf1d6('0x0'));exports[_0xf1d6('0x1')]=function(_0x3d7a48){return client[_0xf1d6('0x2')](_0xf1d6('0x3'),{'body':_0x3d7a48,'log':_0xf1d6('0x3')});};exports[_0xf1d6('0x4')]=function(_0x591b5f,_0x19601b){return client[_0xf1d6('0x2')](_0xf1d6('0x5'),{'body':_0x19601b,'options':{'where':{'uniqueid':_0x591b5f},'order':[['id',_0xf1d6('0x6')]],'limit':0x1},'log':_0xf1d6('0x5')});}; \ No newline at end of file +var _0xfb55=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x5695ff,_0x324735){var _0x3dbfc5=function(_0xc5a01b){while(--_0xc5a01b){_0x5695ff['push'](_0x5695ff['shift']());}};_0x3dbfc5(++_0x324735);}(_0xfb55,0x6b));var _0x5fb5=function(_0x5eaaa0,_0x587f9b){_0x5eaaa0=_0x5eaaa0-0x0;var _0x175f72=_0xfb55[_0x5eaaa0];return _0x175f72;};'use strict';var client=require(_0x5fb5('0x0'));exports['create']=function(_0x343b03){return client[_0x5fb5('0x1')]('CreateWhatsappQueueReport',{'body':_0x343b03,'log':_0x5fb5('0x2')});};exports['update']=function(_0x35e36d,_0x3bfe89){return client[_0x5fb5('0x1')](_0x5fb5('0x3'),{'body':_0x3bfe89,'options':{'where':{'uniqueid':_0x35e36d},'order':[['id',_0x5fb5('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 78965b5..4f16f09 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 _0x2d68=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','close','next','agent'];(function(_0x51c2d3,_0x12ab5f){var _0x491337=function(_0x277735){while(--_0x277735){_0x51c2d3['push'](_0x51c2d3['shift']());}};_0x491337(++_0x12ab5f);}(_0x2d68,0x150));var _0x82d6=function(_0x31ba1a,_0x4e88ce){_0x31ba1a=_0x31ba1a-0x0;var _0xf8402b=_0x2d68[_0x31ba1a];return _0xf8402b;};'use strict';var schema=require(_0x82d6('0x0'));var _=require(_0x82d6('0x1'));var util=require(_0x82d6('0x2'));var seqqueue=require(_0x82d6('0x3'));var logger=require(_0x82d6('0x4'))(_0x82d6('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x82d6('0x6')},'timeout':{'type':_0x82d6('0x7'),'message':_0x82d6('0x8')}});function writeLog(_0x435c6e,_0x2d0cf9,_0x4d24e1){return logger[_0x82d6('0x9')](util[_0x82d6('0xa')](_0x82d6('0xb'),_0x435c6e,_0x2d0cf9[_0x82d6('0xc')],_0x4d24e1));}function handleFindAgent(_0x9771f1){return function(_0x420e0c){return _0x420e0c['name'][_0x82d6('0xd')]()===_0x9771f1[_0x82d6('0xd')]();};}exports[_0x82d6('0xe')]=function(_0x323e4d,_0x44636f,_0x496d1d,_0x194de6){return function(_0x51691f){try{var _0x5da9f6={'name':_0x44636f[0x0],'timeout':_0x44636f[0x1]};var _0x202f3a=queue[_0x82d6('0x0')](_0x5da9f6,{'typecast':!![]});if(_0x202f3a[_0x82d6('0xf')]){logger[_0x82d6('0x10')](_0x82d6('0x11'),_0x323e4d,_[_0x82d6('0x12')](_0x202f3a,'message')['join'](',\x20'));_0x51691f['stop']();}else{var _0xf0e4f6=_[_0x82d6('0x13')](_0x496d1d[_0x82d6('0x14')],handleFindAgent(_0x5da9f6[_0x82d6('0xc')]));if(_0xf0e4f6){var _0x323817=(_0x5da9f6[_0x82d6('0x15')]||0xa)*0x3e8;var _0x566a05,_0x2fa093;var _0x549d2d=seqqueue[_0x82d6('0x16')](_0x323817);_0x549d2d['id']=_0x323e4d;_0x549d2d[_0x82d6('0x17')]=_0x323817;_0x549d2d[_0x82d6('0x18')]=_0x194de6['channel'];writeLog(_0x323e4d,_0xf0e4f6,util[_0x82d6('0xa')](_0x82d6('0x19'),_0x323817));_0x496d1d[_0x82d6('0x1a')][_0x323e4d]['on'](_0x82d6('0x1b'),function(){logger[_0x82d6('0x9')](_0x82d6('0x1c'),_0x323e4d);clearTimeout(_0x2fa093);_0x2fa093=undefined;_0x549d2d['close']();if(_0x496d1d[_0x82d6('0x1a')][_0x323e4d]){delete _0x496d1d[_0x82d6('0x1a')][_0x323e4d];}_0x51691f[_0x82d6('0x1d')]();});_0x496d1d[_0x82d6('0x1a')][_0x323e4d]['on'](_0x82d6('0x1e'),function(){if(_0x496d1d[_0x82d6('0x1a')][_0x323e4d]){delete _0x496d1d[_0x82d6('0x1a')][_0x323e4d];}});_0x2fa093=setTimeout(function(){logger[_0x82d6('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x323e4d);clearTimeout(_0x2fa093);_0x549d2d[_0x82d6('0x1f')]();_0x51691f[_0x82d6('0x20')]();},_0x323817);strategy[_0x82d6('0x21')](_0x549d2d,_0xf0e4f6,_0x496d1d,_0x194de6);}else{logger[_0x82d6('0x10')](_0x82d6('0x22'),_0x323e4d,_0x5da9f6[_0x82d6('0xc')]);_0x51691f[_0x82d6('0x1d')]();}}}catch(_0x165dd5){console['log'](_0x165dd5);logger['error'](_0x82d6('0x23'),_0x323e4d,_0x165dd5[_0x82d6('0x24')]);_0x51691f['stop']();}};}; \ No newline at end of file +var _0x343e=['rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue','atimeout','channel','START:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x343e,0x9a));var _0xe343=function(_0x55da1f,_0x389f97){_0x55da1f=_0x55da1f-0x0;var _0x1c8a1c=_0x343e[_0x55da1f];return _0x1c8a1c;};'use strict';var schema=require(_0xe343('0x0'));var _=require('lodash');var util=require(_0xe343('0x1'));var seqqueue=require(_0xe343('0x2'));var logger=require(_0xe343('0x3'))(_0xe343('0x4'));var strategy=require(_0xe343('0x5'));var queue=schema({'name':{'type':_0xe343('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xe343('0x7')}});function writeLog(_0x2d5671,_0x4bdcc1,_0x1fa12b){return logger[_0xe343('0x8')](util[_0xe343('0x9')](_0xe343('0xa'),_0x2d5671,_0x4bdcc1['name'],_0x1fa12b));}function handleFindAgent(_0x5c34dd){return function(_0x29d68c){return _0x29d68c[_0xe343('0xb')][_0xe343('0xc')]()===_0x5c34dd['toLowerCase']();};}exports[_0xe343('0xd')]=function(_0x4818b9,_0x2b91fd,_0x38b073,_0x46c0cb){return function(_0x3aa544){try{var _0x2d66e2={'name':_0x2b91fd[0x0],'timeout':_0x2b91fd[0x1]};var _0x336c81=queue['validate'](_0x2d66e2,{'typecast':!![]});if(_0x336c81['length']){logger[_0xe343('0xe')](_0xe343('0xf'),_0x4818b9,_[_0xe343('0x10')](_0x336c81,_0xe343('0x11'))[_0xe343('0x12')](',\x20'));_0x3aa544[_0xe343('0x13')]();}else{var _0x215f28=_[_0xe343('0x14')](_0x38b073[_0xe343('0x15')],handleFindAgent(_0x2d66e2[_0xe343('0xb')]));if(_0x215f28){var _0x314385=(_0x2d66e2['timeout']||0xa)*0x3e8;var _0x493b94,_0x575707;var _0x2f5958=seqqueue[_0xe343('0x16')](_0x314385);_0x2f5958['id']=_0x4818b9;_0x2f5958[_0xe343('0x17')]=_0x314385;_0x2f5958[_0xe343('0x18')]=_0x46c0cb[_0xe343('0x18')];writeLog(_0x4818b9,_0x215f28,util[_0xe343('0x9')](_0xe343('0x19'),_0x314385));_0x38b073[_0xe343('0x1a')][_0x4818b9]['on'](_0xe343('0x1b'),function(){logger['info'](_0xe343('0x1c'),_0x4818b9);clearTimeout(_0x575707);_0x575707=undefined;_0x2f5958[_0xe343('0x1d')]();if(_0x38b073['rules'][_0x4818b9]){delete _0x38b073['rules'][_0x4818b9];}_0x3aa544[_0xe343('0x13')]();});_0x38b073[_0xe343('0x1a')][_0x4818b9]['on']('complete',function(){if(_0x38b073[_0xe343('0x1a')][_0x4818b9]){delete _0x38b073[_0xe343('0x1a')][_0x4818b9];}});_0x575707=setTimeout(function(){logger[_0xe343('0x8')](_0xe343('0x1e'),_0x4818b9);clearTimeout(_0x575707);_0x2f5958[_0xe343('0x1d')]();_0x3aa544[_0xe343('0x1f')]();},_0x314385);strategy[_0xe343('0x20')](_0x2f5958,_0x215f28,_0x38b073,_0x46c0cb);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4818b9,_0x2d66e2[_0xe343('0xb')]);_0x3aa544[_0xe343('0x13')]();}}}catch(_0x2f7898){console[_0xe343('0x21')](_0x2f7898);logger[_0xe343('0xe')](_0xe343('0x22'),_0x4818b9,_0x2f7898[_0xe343('0x23')]);_0x3aa544[_0xe343('0x13')]();}};}; \ 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 d34a986..196993a 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 _0xe5ce=['Message','create','Failed','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','getMustacheRender','catch','[%s][AMAZONLEX]\x20%s','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','body','toString','postText','message','providerResponse'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xe5ce,0x15c));var _0xee5c=function(_0x10f8e3,_0x426c27){_0x10f8e3=_0x10f8e3-0x0;var _0x34ff6c=_0xe5ce[_0x10f8e3];return _0x34ff6c;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xee5c('0x0'));var logger=require(_0xee5c('0x1'))(_0xee5c('0x2'));var rpc={'chatMessage':require(_0xee5c('0x3')),'openchannelMessage':require(_0xee5c('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xee5c('0x5')),'whatsappMessage':require(_0xee5c('0x6'))};exports[_0xee5c('0x7')]=function(_0x5a810f,_0x5a4008){return function(_0x3ae726){try{if(!_[_0xee5c('0x8')](this[_0xee5c('0x9')]['UserId'])){logger[_0xee5c('0xa')]('[%s][AMAZONLEX]\x20%s',_0x5a810f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3ae726[_0xee5c('0xb')]();}var _0x54abff={'ContactId':this[_0xee5c('0xc')]['id'],'sentAt':moment()['format'](_0xee5c('0xd')),'direction':_0xee5c('0xe')};if(this['channel']==='sms'||this[_0xee5c('0xf')]===_0xee5c('0x10')){_0x54abff[_0xee5c('0x11')]=this['interaction'][_0xee5c('0x11')];}var _0x2eac18=this[_0xee5c('0xf')];if(_0x2eac18===_0xee5c('0x12')){_0x54abff[_0xee5c('0x13')]=this['account']['id'];}else{_0x54abff[_[_0xee5c('0x14')](_0x2eac18)+'AccountId']=this[_0xee5c('0x15')]['id'];}_0x54abff[_[_0xee5c('0x14')](_0x2eac18)+_0xee5c('0x16')]=this['interaction']['id'];if(this['interaction'][_0xee5c('0x17')]){var _0x56d990=_0x5a4008[0x4];if(!_[_0xee5c('0x18')](_0x56d990)){_0x54abff['body']=utils[_0xee5c('0x19')](_0x56d990,this);return rpc[_0x2eac18+'Message']['create'](_0x54abff)['then'](function(_0x5c3000){logger[_0xee5c('0xa')]('[%s][AMAZONLEX]\x20%s',_0x5a810f,_0x54abff['body']);})[_0xee5c('0x1a')](function(_0x5db2ef){logger['error'](_0xee5c('0x1b'),_0x5a810f,JSON[_0xee5c('0x1c')](_0x5db2ef));})[_0xee5c('0x1d')](function(){logger[_0xee5c('0xa')](_0xee5c('0x1e'),_0x5a810f);_0x3ae726[_0xee5c('0x1f')]();});}else{logger[_0xee5c('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5a810f);_0x3ae726[_0xee5c('0x1f')]();}}else{var _0x1dc2a2=this;var _0x2b4ace=new AWS[(_0xee5c('0x20'))]({'accessKeyId':_0x5a4008[0x0],'secretAccessKey':_0x5a4008[0x1],'region':_0x5a4008[0x2]});var _0x5d4201={'botAlias':_0xee5c('0x21'),'botName':_0x5a4008[0x3],'inputText':this['message'][_0xee5c('0x22')],'userId':this['channel']+':'+this[_0xee5c('0x9')]['id'][_0xee5c('0x23')]()};_0x2b4ace[_0xee5c('0x24')](_0x5d4201,function(_0x15a809,_0x2825d7){if(_0x15a809){logger['error'](_0xee5c('0x1b'),_0x5a810f,_0x15a809['message']);_0x3ae726[_0xee5c('0xb')]();}else if(_0x2825d7&&_0x2825d7[_0xee5c('0x25')]){_0x1dc2a2['body']['amazonlex']=_0x2825d7;_0x54abff[_0xee5c('0x22')]=_0x2825d7[_0xee5c('0x25')];_0x54abff['providerName']='amazonlex';_0x54abff[_0xee5c('0x26')]=JSON[_0xee5c('0x1c')](_0x2825d7);return rpc[_0x2eac18+_0xee5c('0x27')][_0xee5c('0x28')](_0x54abff)['then'](function(_0x379a85){logger['info'](_0xee5c('0x1b'),_0x5a810f,_0x54abff[_0xee5c('0x22')]);if(_0x2825d7['dialogState']==_0xee5c('0x29')){_0x3ae726['next']();}else{_0x3ae726[_0xee5c('0x1f')]();}})[_0xee5c('0x1a')](function(_0x122c9b){logger[_0xee5c('0x2a')](_0xee5c('0x1b'),_0x5a810f,JSON[_0xee5c('0x1c')](_0x122c9b));_0x3ae726[_0xee5c('0xb')]();});}else{_0x3ae726[_0xee5c('0xb')]();}});}}catch(_0x24f2d1){logger[_0xee5c('0x2a')](_0xee5c('0x1b'),_0x5a810f,JSON['stringify'](_0x24f2d1));_0x3ae726[_0xee5c('0x1f')]();}};}; \ No newline at end of file +var _0x8b83=['create','then','info','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0x8b83,0x15b));var _0x38b8=function(_0x5221c0,_0x5aba00){_0x5221c0=_0x5221c0-0x0;var _0x1653a7=_0x8b83[_0x5221c0];return _0x1653a7;};'use strict';var _=require(_0x38b8('0x0'));var moment=require(_0x38b8('0x1'));var AWS=require(_0x38b8('0x2'));var utils=require(_0x38b8('0x3'));var logger=require(_0x38b8('0x4'))(_0x38b8('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x38b8('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x38b8('0x7'))};exports[_0x38b8('0x8')]=function(_0xb7b02d,_0x2e164b){return function(_0x5b8f75){try{if(!_[_0x38b8('0x9')](this[_0x38b8('0xa')][_0x38b8('0xb')])){logger['info'](_0x38b8('0xc'),_0xb7b02d,_0x38b8('0xd'));return _0x5b8f75[_0x38b8('0xe')]();}var _0xc2f6f4={'ContactId':this[_0x38b8('0xf')]['id'],'sentAt':moment()[_0x38b8('0x10')](_0x38b8('0x11')),'direction':'out'};if(this[_0x38b8('0x12')]==='sms'||this['channel']===_0x38b8('0x13')){_0xc2f6f4[_0x38b8('0x14')]=this[_0x38b8('0xa')][_0x38b8('0x14')];}var _0x604733=this[_0x38b8('0x12')];if(_0x604733===_0x38b8('0x15')){_0xc2f6f4['ChatWebsiteId']=this['account']['id'];}else{_0xc2f6f4[_[_0x38b8('0x16')](_0x604733)+_0x38b8('0x17')]=this['account']['id'];}_0xc2f6f4[_[_0x38b8('0x16')](_0x604733)+_0x38b8('0x18')]=this[_0x38b8('0xa')]['id'];if(this[_0x38b8('0xa')][_0x38b8('0x19')]){var _0x578482=_0x2e164b[0x4];if(!_[_0x38b8('0x1a')](_0x578482)){_0xc2f6f4[_0x38b8('0x1b')]=utils['getMustacheRender'](_0x578482,this);return rpc[_0x604733+_0x38b8('0x1c')][_0x38b8('0x1d')](_0xc2f6f4)[_0x38b8('0x1e')](function(_0xd500e8){logger[_0x38b8('0x1f')](_0x38b8('0xc'),_0xb7b02d,_0xc2f6f4['body']);})['catch'](function(_0x20130c){logger[_0x38b8('0x20')](_0x38b8('0xc'),_0xb7b02d,JSON[_0x38b8('0x21')](_0x20130c));})['finally'](function(){logger[_0x38b8('0x1f')](_0x38b8('0x22'),_0xb7b02d);_0x5b8f75[_0x38b8('0x23')]();});}else{logger[_0x38b8('0x1f')](_0x38b8('0x24'),_0xb7b02d);_0x5b8f75[_0x38b8('0x23')]();}}else{var _0x10e53a=this;var _0x53b5af=new AWS[(_0x38b8('0x25'))]({'accessKeyId':_0x2e164b[0x0],'secretAccessKey':_0x2e164b[0x1],'region':_0x2e164b[0x2]});var _0x4d6c6f={'botAlias':_0x38b8('0x26'),'botName':_0x2e164b[0x3],'inputText':this[_0x38b8('0x27')]['body'],'userId':this[_0x38b8('0x12')]+':'+this['interaction']['id'][_0x38b8('0x28')]()};_0x53b5af[_0x38b8('0x29')](_0x4d6c6f,function(_0x21da63,_0x21c269){if(_0x21da63){logger[_0x38b8('0x20')](_0x38b8('0xc'),_0xb7b02d,_0x21da63[_0x38b8('0x27')]);_0x5b8f75[_0x38b8('0xe')]();}else if(_0x21c269&&_0x21c269[_0x38b8('0x27')]){_0x10e53a['body'][_0x38b8('0x2a')]=_0x21c269;_0xc2f6f4[_0x38b8('0x1b')]=_0x21c269[_0x38b8('0x27')];_0xc2f6f4[_0x38b8('0x2b')]=_0x38b8('0x2a');_0xc2f6f4[_0x38b8('0x2c')]=JSON[_0x38b8('0x21')](_0x21c269);return rpc[_0x604733+_0x38b8('0x1c')]['create'](_0xc2f6f4)['then'](function(_0x46e9bf){logger[_0x38b8('0x1f')](_0x38b8('0xc'),_0xb7b02d,_0xc2f6f4[_0x38b8('0x1b')]);if(_0x21c269[_0x38b8('0x2d')]==_0x38b8('0x2e')){_0x5b8f75[_0x38b8('0xe')]();}else{_0x5b8f75['stop']();}})['catch'](function(_0x2fdd60){logger[_0x38b8('0x20')]('[%s][AMAZONLEX]\x20%s',_0xb7b02d,JSON[_0x38b8('0x21')](_0x2fdd60));_0x5b8f75[_0x38b8('0xe')]();});}else{_0x5b8f75[_0x38b8('0xe')]();}});}}catch(_0x706db1){logger[_0x38b8('0x20')](_0x38b8('0xc'),_0xb7b02d,JSON[_0x38b8('0x21')](_0x706db1));_0x5b8f75['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index de55918..cdad99a 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 _0xe4ef=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','replace',''+_[_0xfe4e('0x34')](_0x5972fd[_0xfe4e('0x12')],_0xfe4e('0x35'),_0xfe4e('0x36'))+'';_0x5972fd[_0xfe4e('0x37')]={'Auto-Submitted':_0xfe4e('0x38'),'X-Auto-Response-Suppress':_0xfe4e('0x39'),'Precedence':_0xfe4e('0x3a')};return mailRpc[_0xfe4e('0x3b')](this['account'][_0xfe4e('0x3c')],_0x5972fd)[_0xfe4e('0x3d')](function(_0x396662){logger[_0xfe4e('0x14')](_0xfe4e('0x3e'),_0x3438e5);_0x5972fd[_0xfe4e('0x33')]=_0x396662[_0xfe4e('0x23')][_0xfe4e('0x33')];return rpc[_0x2eb789+_0xfe4e('0x31')][_0xfe4e('0x3f')](_0x5972fd);})['then'](function(_0x1985ee){logger[_0xfe4e('0x14')](_0xfe4e('0x15'),_0x3438e5,JSON[_0xfe4e('0x40')](_0x1985ee));})[_0xfe4e('0x41')](function(_0x27321f){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x3438e5,JSON[_0xfe4e('0x40')](_0x27321f));})[_0xfe4e('0x42')](function(){Promise['resolve']()[_0xfe4e('0x3d')](function(){if(_0x1eba44[0x0]!=='2'||_0x2b9550[_0xfe4e('0x43')])return;return rpc[_0x2eb789+'Interaction'][_0xfe4e('0x44')](_0x2b9550['id'],{'autoreplyExecuted':!![]})[_0xfe4e('0x3d')](function(_0x1afb83){logger['info'](_0xfe4e('0x1c'),_0x3438e5,JSON['stringify'](_0x1afb83));})[_0xfe4e('0x41')](function(_0x5c64a3){logger['error'](_0xfe4e('0x45'),_0x3438e5,JSON['stringify'](_0x5c64a3));});})['then'](function(){_0x7f15ea[_0xfe4e('0x17')]();});});}else{return rpc[this[_0xfe4e('0x10')]+_0xfe4e('0x31')][_0xfe4e('0x3f')](_0x5972fd)[_0xfe4e('0x3d')](function(){logger['info'](_0xfe4e('0x15'),_0x3438e5,_0x5972fd[_0xfe4e('0x12')]);})['catch'](function(_0x4a13af){logger[_0xfe4e('0x46')]('[%s][AUTOREPLY]\x20%s',_0x3438e5,JSON[_0xfe4e('0x40')](_0x4a13af));})[_0xfe4e('0x42')](function(){Promise[_0xfe4e('0x47')]()[_0xfe4e('0x3d')](function(){if(_0x1eba44[0x0]!=='2'||_0x2b9550['autoreplyExecuted'])return;return rpc[_0x2eb789+'Interaction'][_0xfe4e('0x44')](_0x2b9550['id'],{'autoreplyExecuted':!![]})[_0xfe4e('0x3d')](function(_0x27962a){logger[_0xfe4e('0x14')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3438e5,JSON[_0xfe4e('0x40')](_0x27962a));})[_0xfe4e('0x41')](function(_0x34742f){logger[_0xfe4e('0x46')](_0xfe4e('0x45'),_0x3438e5,JSON[_0xfe4e('0x40')](_0x34742f));});})['then'](function(){_0x7f15ea['next']();});});}}}catch(_0x359dcc){logger['error'](_0xfe4e('0x15'),_0x3438e5,JSON[_0xfe4e('0x40')](_0x359dcc));_0x7f15ea[_0xfe4e('0x48')]();}};}; \ No newline at end of file +var _0x291f=['then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','body','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','messageId','','replace','','headers','auto-replied','All','auto_reply','smtpOptions'];(function(_0xb93836,_0x2e7941){var _0x2b3e5b=function(_0x56d0a4){while(--_0x56d0a4){_0xb93836['push'](_0xb93836['shift']());}};_0x2b3e5b(++_0x2e7941);}(_0x291f,0xd4));var _0xf291=function(_0x49cf57,_0x366ece){_0x49cf57=_0x49cf57-0x0;var _0x3b2e91=_0x291f[_0x49cf57];return _0x3b2e91;};'use strict';var _=require(_0xf291('0x0'));var moment=require(_0xf291('0x1'));var utils=require(_0xf291('0x2'));var logger=require(_0xf291('0x3'))(_0xf291('0x4'));var rpc={'chatMessage':require(_0xf291('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf291('0x6')),'smsMessage':require(_0xf291('0x7')),'faxMessage':require(_0xf291('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xf291('0x9')),'openchannelInteraction':require(_0xf291('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xf291('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf291('0xc'))};var mailRpc=require(_0xf291('0xd'));exports[_0xf291('0xe')]=function(_0x48c2c8,_0x4926c7,_0x58bc96,_0x55ee80){return function(_0x1c3ce2){try{var _0xf95267=this[_0xf291('0xf')];if(_0xf95267===_0xf291('0x10')&&_0x55ee80['body'][_0xf291('0x11')]){logger[_0xf291('0x12')](_0xf291('0x13'),_0x48c2c8,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1c3ce2[_0xf291('0x14')]();}if(_0x4926c7[0x0]==='1'&&(_[_0xf291('0x15')](this[_0xf291('0x16')][_0xf291('0x17')])||!this['interaction'][_0xf291('0x17')])){logger['info'](_0xf291('0x13'),_0x48c2c8,'Autoreply\x20already\x20sent');return _0x1c3ce2[_0xf291('0x14')]();}if(_0x4926c7[0x0]==='2'&&this['interaction'][_0xf291('0x18')]){logger['info'](_0xf291('0x19'),_0x48c2c8,_0xf291('0x1a'));return _0x1c3ce2[_0xf291('0x14')]();}var _0x35598e={'ContactId':this[_0xf291('0x1b')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0xf291('0x10')){_0x35598e[_0xf291('0x1c')]=utils[_0xf291('0x1d')](_0x4926c7[0x2],this);}else{_0x35598e[_0xf291('0x1c')]=utils[_0xf291('0x1d')](_0x4926c7[0x1],this);}if(this[_0xf291('0x1e')]){_0x35598e['to']=this[_0xf291('0x1e')][_0xf291('0x1f')]||'';if(this['channel']===_0xf291('0x10')&&_0x4926c7[0x1]==='1'){_0x35598e['cc']=this[_0xf291('0x1e')]['cc']||'';}_0x35598e[_0xf291('0x1f')]=this['message']['to']||'';_0x35598e[_0xf291('0x20')]=this[_0xf291('0x1e')][_0xf291('0x20')]||'';_0x35598e[_0xf291('0x21')]=!![];if(this[_0xf291('0x1e')][_0xf291('0x22')]){_0x35598e[_0xf291('0x22')]='';_0x35598e['subject']+=_['startsWith'](this[_0xf291('0x1e')][_0xf291('0x22')],'Re:')?'':_0xf291('0x23');_0x35598e['subject']+=this[_0xf291('0x1e')]['subject'];}}if(this[_0xf291('0xf')]===_0xf291('0x24')){_0x35598e['ChatWebsiteId']=this[_0xf291('0x25')]['id'];}else{_0x35598e[_[_0xf291('0x26')](this['channel'])+_0xf291('0x27')]=this[_0xf291('0x25')]['id'];}_0x35598e[_[_0xf291('0x26')](this[_0xf291('0xf')])+_0xf291('0x28')]=this[_0xf291('0x16')]['id'];var _0xe5056b=this['interaction'];if(rpc[this[_0xf291('0xf')]+'Message']){if(this[_0xf291('0xf')]===_0xf291('0x10')){_0x35598e['inReplyTo']=this[_0xf291('0x1e')][_0xf291('0x29')];_0x35598e['html']=_0xf291('0x2a')+_[_0xf291('0x2b')](_0x35598e['body'],_0xf291('0x2c'),_0xf291('0x2d'))+_0xf291('0x2e');_0x35598e[_0xf291('0x2f')]={'Auto-Submitted':_0xf291('0x30'),'X-Auto-Response-Suppress':_0xf291('0x31'),'Precedence':_0xf291('0x32')};return mailRpc['sendMailMessage'](this['account'][_0xf291('0x33')],_0x35598e)[_0xf291('0x34')](function(_0x8575d2){logger[_0xf291('0x12')](_0xf291('0x35'),_0x48c2c8);_0x35598e[_0xf291('0x29')]=_0x8575d2[_0xf291('0x1e')][_0xf291('0x29')];return rpc[_0xf95267+_0xf291('0x36')][_0xf291('0x37')](_0x35598e);})[_0xf291('0x34')](function(_0x199cc9){logger[_0xf291('0x12')](_0xf291('0x13'),_0x48c2c8,JSON[_0xf291('0x38')](_0x199cc9));})[_0xf291('0x39')](function(_0x27abdb){logger['error'](_0xf291('0x3a'),_0x48c2c8,JSON['stringify'](_0x27abdb));})[_0xf291('0x3b')](function(){Promise[_0xf291('0x3c')]()[_0xf291('0x34')](function(){if(_0x4926c7[0x0]!=='2'||_0xe5056b[_0xf291('0x18')])return;return rpc[_0xf95267+_0xf291('0x3d')][_0xf291('0x3e')](_0xe5056b['id'],{'autoreplyExecuted':!![]})[_0xf291('0x34')](function(_0x265880){logger[_0xf291('0x12')](_0xf291('0x19'),_0x48c2c8,JSON[_0xf291('0x38')](_0x265880));})[_0xf291('0x39')](function(_0x668b1c){logger[_0xf291('0x3f')](_0xf291('0x40'),_0x48c2c8,JSON[_0xf291('0x38')](_0x668b1c));});})[_0xf291('0x34')](function(){_0x1c3ce2[_0xf291('0x14')]();});});}else{return rpc[this[_0xf291('0xf')]+_0xf291('0x36')]['create'](_0x35598e)['then'](function(){logger[_0xf291('0x12')]('[%s][AUTOREPLY]\x20%s',_0x48c2c8,_0x35598e['body']);})['catch'](function(_0x528db4){logger[_0xf291('0x3f')](_0xf291('0x13'),_0x48c2c8,JSON[_0xf291('0x38')](_0x528db4));})[_0xf291('0x3b')](function(){Promise[_0xf291('0x3c')]()[_0xf291('0x34')](function(){if(_0x4926c7[0x0]!=='2'||_0xe5056b[_0xf291('0x18')])return;return rpc[_0xf95267+_0xf291('0x3d')][_0xf291('0x3e')](_0xe5056b['id'],{'autoreplyExecuted':!![]})[_0xf291('0x34')](function(_0x34e02d){logger[_0xf291('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x48c2c8,JSON[_0xf291('0x38')](_0x34e02d));})[_0xf291('0x39')](function(_0x5e7bdd){logger[_0xf291('0x3f')](_0xf291('0x40'),_0x48c2c8,JSON[_0xf291('0x38')](_0x5e7bdd));});})[_0xf291('0x34')](function(){_0x1c3ce2[_0xf291('0x14')]();});});}}}catch(_0x29d875){logger['error'](_0xf291('0x13'),_0x48c2c8,JSON[_0xf291('0x38')](_0x29d875));_0x1c3ce2[_0xf291('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index c40562e..de7a8c1 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aef=['stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x27f673,_0x1b97ba){var _0x7e7b76=function(_0x194c8a){while(--_0x194c8a){_0x27f673['push'](_0x27f673['shift']());}};_0x7e7b76(++_0x1b97ba);}(_0x0aef,0xb9));var _0xf0ae=function(_0x477a00,_0x220f09){_0x477a00=_0x477a00-0x0;var _0x116283=_0x0aef[_0x477a00];return _0x116283;};'use strict';var moment=require(_0xf0ae('0x0'));var logger=require(_0xf0ae('0x1'))(_0xf0ae('0x2'));var rpc={'chatInteraction':require(_0xf0ae('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xf0ae('0x4')),'faxInteraction':require(_0xf0ae('0x5')),'whatsappInteraction':require(_0xf0ae('0x6'))};exports['consequence']=function(_0x1dc2a6,_0x7f2006,_0x588de3,_0x3fa50b){return function(_0x3d32be){try{logger['info'](_0xf0ae('0x7'),_0x1dc2a6,_0x7f2006[0x0]);var _0x479077={'closed':0x1,'closedAt':moment()[_0xf0ae('0x8')](_0xf0ae('0x9')),'closeReason':_0xf0ae('0xa'),'disposition':_0x7f2006[0x0]};if(rpc[_0x3fa50b[_0xf0ae('0xb')]+_0xf0ae('0xc')]){rpc[_0x3fa50b[_0xf0ae('0xb')]+_0xf0ae('0xc')][_0xf0ae('0xd')](_0x3fa50b[_0xf0ae('0xe')]['id'],_0x479077)[_0xf0ae('0xf')](function(_0x2c6261){logger[_0xf0ae('0x10')](_0xf0ae('0x11'),_0x1dc2a6,_0x3fa50b[_0xf0ae('0xe')]['id']);})[_0xf0ae('0x12')](function(_0x2368b0){logger['error'](_0xf0ae('0x13'),_0x1dc2a6,JSON[_0xf0ae('0x14')](_0x2368b0));})[_0xf0ae('0x15')](function(){_0x3d32be[_0xf0ae('0x16')]();});}}catch(_0x4c6311){logger['error'](_0xf0ae('0x13'),_0x1dc2a6,JSON[_0xf0ae('0x14')](_0x4c6311));_0x3d32be['stop']();}};}; \ No newline at end of file +var _0x8c92=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','Interaction','channel','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8c92,0x155));var _0x28c9=function(_0x3acc8e,_0x2e5b3d){_0x3acc8e=_0x3acc8e-0x0;var _0x5eeea0=_0x8c92[_0x3acc8e];return _0x5eeea0;};'use strict';var moment=require('moment');var logger=require(_0x28c9('0x0'))(_0x28c9('0x1'));var rpc={'chatInteraction':require(_0x28c9('0x2')),'openchannelInteraction':require(_0x28c9('0x3')),'smsInteraction':require(_0x28c9('0x4')),'mailInteraction':require(_0x28c9('0x5')),'faxInteraction':require(_0x28c9('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x28c9('0x7')]=function(_0x1d66e5,_0x331669,_0x4c8c08,_0x3e8aa8){return function(_0x262c0d){try{logger[_0x28c9('0x8')](_0x28c9('0x9'),_0x1d66e5,_0x331669[0x0]);var _0x352b79={'closed':0x1,'closedAt':moment()[_0x28c9('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x28c9('0xb'),'disposition':_0x331669[0x0]};if(rpc[_0x3e8aa8['channel']+_0x28c9('0xc')]){rpc[_0x3e8aa8[_0x28c9('0xd')]+_0x28c9('0xc')][_0x28c9('0xe')](_0x3e8aa8['interaction']['id'],_0x352b79)[_0x28c9('0xf')](function(_0x33fbf8){logger[_0x28c9('0x8')](_0x28c9('0x10'),_0x1d66e5,_0x3e8aa8['interaction']['id']);})[_0x28c9('0x11')](function(_0x21ffdd){logger[_0x28c9('0x12')](_0x28c9('0x13'),_0x1d66e5,JSON[_0x28c9('0x14')](_0x21ffdd));})[_0x28c9('0x15')](function(){_0x262c0d[_0x28c9('0x16')]();});}}catch(_0x28acb7){logger[_0x28c9('0x12')]('[%s][CLOSE]\x20%s',_0x1d66e5,JSON[_0x28c9('0x14')](_0x28acb7));_0x262c0d[_0x28c9('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 2557d5c..d7778fc 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52aa=['dialogflow','fulfillment','speech','providerName','providerResponse','result','metadata','endConversation','error','message','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','catch','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then'];(function(_0x778f1b,_0x3c9178){var _0x4d4270=function(_0x5d74dd){while(--_0x5d74dd){_0x778f1b['push'](_0x778f1b['shift']());}};_0x4d4270(++_0x3c9178);}(_0x52aa,0x113));var _0xa52a=function(_0x218d52,_0x5aefe3){_0x218d52=_0x218d52-0x0;var _0x18734a=_0x52aa[_0x218d52];return _0x18734a;};'use strict';var _=require('lodash');var moment=require(_0xa52a('0x0'));var apiai=require(_0xa52a('0x1'));var md5=require(_0xa52a('0x2'));var utils=require(_0xa52a('0x3'));var logger=require(_0xa52a('0x4'))(_0xa52a('0x5'));var rpc={'chatMessage':require(_0xa52a('0x6')),'openchannelMessage':require(_0xa52a('0x7')),'mailMessage':require(_0xa52a('0x8')),'smsMessage':require(_0xa52a('0x9')),'faxMessage':require(_0xa52a('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x8609ec,_0x14bc85){return function(_0x289bb0){try{if(!_[_0xa52a('0xb')](this[_0xa52a('0xc')][_0xa52a('0xd')])){logger[_0xa52a('0xe')](_0xa52a('0xf'),_0x8609ec,_0xa52a('0x10'));return _0x289bb0[_0xa52a('0x11')]();}var _0x57b153={'ContactId':this[_0xa52a('0x12')]['id'],'sentAt':moment()['format'](_0xa52a('0x13')),'direction':_0xa52a('0x14')};if(this[_0xa52a('0x15')]===_0xa52a('0x16')||this[_0xa52a('0x15')]===_0xa52a('0x17')){_0x57b153[_0xa52a('0x18')]=this[_0xa52a('0xc')][_0xa52a('0x18')];}var _0x10342c=this[_0xa52a('0x15')];if(_0x10342c===_0xa52a('0x19')){_0x57b153[_0xa52a('0x1a')]=this['account']['id'];}else{_0x57b153[_['upperFirst'](_0x10342c)+_0xa52a('0x1b')]=this[_0xa52a('0x1c')]['id'];}_0x57b153[_['upperFirst'](_0x10342c)+_0xa52a('0x1d')]=this[_0xa52a('0xc')]['id'];if(this[_0xa52a('0xc')][_0xa52a('0x1e')]){var _0xa0faac=_0x14bc85[0x2];if(!_[_0xa52a('0x1f')](_0xa0faac)){_0x57b153[_0xa52a('0x20')]=utils[_0xa52a('0x21')](_0xa0faac,this);return rpc[_0x10342c+_0xa52a('0x22')][_0xa52a('0x23')](_0x57b153)['then'](function(_0x1e2cc8){logger[_0xa52a('0xe')](_0xa52a('0xf'),_0x8609ec,_0x57b153[_0xa52a('0x20')]);})[_0xa52a('0x24')](function(_0xa0fd2d){logger['error'](_0xa52a('0xf'),_0x8609ec,JSON[_0xa52a('0x25')](_0xa0fd2d));})[_0xa52a('0x26')](function(){logger[_0xa52a('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x8609ec);_0x289bb0[_0xa52a('0x27')]();});}else{logger[_0xa52a('0xe')](_0xa52a('0x28'),_0x8609ec);_0x289bb0[_0xa52a('0x27')]();}}else{var _0x13ef38=this;var _0x4c8361=apiai(_0x14bc85[0x0],{'language':_0x14bc85[0x1]||'en'});return _0x4c8361[_0xa52a('0x29')](this['message']['body'],{'sessionId':md5(this[_0xa52a('0xc')]['id'])})[_0xa52a('0x2a')](function(_0x598849){_0x13ef38['body'][_0xa52a('0x2b')]=_0x598849;_0x57b153[_0xa52a('0x20')]=_0x598849['result'][_0xa52a('0x2c')][_0xa52a('0x2d')];_0x57b153[_0xa52a('0x2e')]=_0xa52a('0x2b');_0x57b153[_0xa52a('0x2f')]=JSON[_0xa52a('0x25')](_0x598849);return rpc[_0x10342c+_0xa52a('0x22')][_0xa52a('0x23')](_0x57b153)[_0xa52a('0x2a')](function(_0x1e8ff6){logger[_0xa52a('0xe')](_0xa52a('0xf'),_0x8609ec,_0x57b153[_0xa52a('0x20')]);if(_0x598849[_0xa52a('0x30')][_0xa52a('0x31')][_0xa52a('0x32')]){_0x289bb0[_0xa52a('0x11')]();}else{_0x289bb0[_0xa52a('0x27')]();}})['catch'](function(_0x1903fb){logger[_0xa52a('0x33')](_0xa52a('0xf'),_0x8609ec,JSON['stringify'](_0x1903fb));_0x289bb0['next']();});})[_0xa52a('0x24')](function(_0x2d2180){logger[_0xa52a('0x33')]('[%s][DIALOGFLOW]\x20%s',_0x8609ec,_0x2d2180[_0xa52a('0x34')]);_0x289bb0[_0xa52a('0x11')]();});}}catch(_0x552fc5){logger[_0xa52a('0x33')](_0xa52a('0xf'),_0x8609ec,JSON[_0xa52a('0x25')](_0x552fc5));_0x289bb0[_0xa52a('0x27')]();}};}; \ No newline at end of file +var _0x27a8=['chat','ChatWebsiteId','AccountId','account','upperFirst','created','isEmpty','body','getMustacheRender','then','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','result','fulfillment','speech','providerName','dialogflow','Message','create','metadata','catch','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone'];(function(_0xc04a7b,_0x21952a){var _0xa0a816=function(_0x498d26){while(--_0x498d26){_0xc04a7b['push'](_0xc04a7b['shift']());}};_0xa0a816(++_0x21952a);}(_0x27a8,0x170));var _0x827a=function(_0x5f4718,_0x58384c){_0x5f4718=_0x5f4718-0x0;var _0xdbb3c4=_0x27a8[_0x5f4718];return _0xdbb3c4;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0x827a('0x0'));var md5=require(_0x827a('0x1'));var utils=require(_0x827a('0x2'));var logger=require(_0x827a('0x3'))(_0x827a('0x4'));var rpc={'chatMessage':require(_0x827a('0x5')),'openchannelMessage':require(_0x827a('0x6')),'mailMessage':require(_0x827a('0x7')),'smsMessage':require(_0x827a('0x8')),'faxMessage':require(_0x827a('0x9')),'whatsappMessage':require(_0x827a('0xa'))};exports[_0x827a('0xb')]=function(_0xa0df3c,_0x2b9fe3){return function(_0x2e20da){try{if(!_[_0x827a('0xc')](this[_0x827a('0xd')][_0x827a('0xe')])){logger[_0x827a('0xf')](_0x827a('0x10'),_0xa0df3c,_0x827a('0x11'));return _0x2e20da[_0x827a('0x12')]();}var _0x1bc07f={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x827a('0x13')),'direction':_0x827a('0x14')};if(this[_0x827a('0x15')]==='sms'||this['channel']===_0x827a('0x16')){_0x1bc07f[_0x827a('0x17')]=this['interaction'][_0x827a('0x17')];}var _0x5c6d03=this[_0x827a('0x15')];if(_0x5c6d03===_0x827a('0x18')){_0x1bc07f[_0x827a('0x19')]=this['account']['id'];}else{_0x1bc07f[_['upperFirst'](_0x5c6d03)+_0x827a('0x1a')]=this[_0x827a('0x1b')]['id'];}_0x1bc07f[_[_0x827a('0x1c')](_0x5c6d03)+'InteractionId']=this[_0x827a('0xd')]['id'];if(this[_0x827a('0xd')][_0x827a('0x1d')]){var _0x47e8fc=_0x2b9fe3[0x2];if(!_[_0x827a('0x1e')](_0x47e8fc)){_0x1bc07f[_0x827a('0x1f')]=utils[_0x827a('0x20')](_0x47e8fc,this);return rpc[_0x5c6d03+'Message']['create'](_0x1bc07f)[_0x827a('0x21')](function(_0x8f07db){logger['info']('[%s][DIALOGFLOW]\x20%s',_0xa0df3c,_0x1bc07f[_0x827a('0x1f')]);})['catch'](function(_0x4f1b6c){logger[_0x827a('0x22')](_0x827a('0x10'),_0xa0df3c,JSON[_0x827a('0x23')](_0x4f1b6c));})['finally'](function(){logger['info'](_0x827a('0x24'),_0xa0df3c);_0x2e20da[_0x827a('0x25')]();});}else{logger['info'](_0x827a('0x26'),_0xa0df3c);_0x2e20da[_0x827a('0x25')]();}}else{var _0x11737e=this;var _0x7ae849=apiai(_0x2b9fe3[0x0],{'language':_0x2b9fe3[0x1]||'en'});return _0x7ae849['textRequest'](this[_0x827a('0x27')]['body'],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x11670e){_0x11737e[_0x827a('0x1f')]['dialogflow']=_0x11670e;_0x1bc07f[_0x827a('0x1f')]=_0x11670e[_0x827a('0x28')][_0x827a('0x29')][_0x827a('0x2a')];_0x1bc07f[_0x827a('0x2b')]=_0x827a('0x2c');_0x1bc07f['providerResponse']=JSON[_0x827a('0x23')](_0x11670e);return rpc[_0x5c6d03+_0x827a('0x2d')][_0x827a('0x2e')](_0x1bc07f)['then'](function(_0xa86e63){logger[_0x827a('0xf')](_0x827a('0x10'),_0xa0df3c,_0x1bc07f[_0x827a('0x1f')]);if(_0x11670e[_0x827a('0x28')][_0x827a('0x2f')]['endConversation']){_0x2e20da['next']();}else{_0x2e20da[_0x827a('0x25')]();}})[_0x827a('0x30')](function(_0x336891){logger[_0x827a('0x22')](_0x827a('0x10'),_0xa0df3c,JSON[_0x827a('0x23')](_0x336891));_0x2e20da[_0x827a('0x12')]();});})[_0x827a('0x30')](function(_0x554b1e){logger['error'](_0x827a('0x10'),_0xa0df3c,_0x554b1e[_0x827a('0x27')]);_0x2e20da[_0x827a('0x12')]();});}}catch(_0x5bb496){logger[_0x827a('0x22')](_0x827a('0x10'),_0xa0df3c,JSON[_0x827a('0x23')](_0x5bb496));_0x2e20da[_0x827a('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 59736da..f975c0c 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ba4=['error','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','then','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','queryResult','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','fulfillmentText','push','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','body','catch'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2ba4,0xcc));var _0x42ba=function(_0x355220,_0x43fb5c){_0x355220=_0x355220-0x0;var _0x196039=_0x2ba4[_0x355220];return _0x196039;};'use strict';var _=require(_0x42ba('0x0'));var dialogflow=require(_0x42ba('0x1'));var md5=require(_0x42ba('0x2'));var moment=require(_0x42ba('0x3'));var Promise=require(_0x42ba('0x4'));var logger=require(_0x42ba('0x5'))(_0x42ba('0x6'));var utils=require(_0x42ba('0x7'));var rpc={'chatMessage':require(_0x42ba('0x8')),'openchannelMessage':require(_0x42ba('0x9')),'mailMessage':require(_0x42ba('0xa')),'smsMessage':require(_0x42ba('0xb')),'faxMessage':require(_0x42ba('0xc')),'whatsappMessage':require(_0x42ba('0xd'))};function createMessage(_0x51d7d8,_0x558760,_0x44ee19,_0x4ecca5){return new Promise(function(_0x5b30d6,_0x36c8fa){var _0x1549e8=_[_0x42ba('0xe')](_0x44ee19);_0x1549e8['body']=_0x4ecca5;return rpc[_0x558760+_0x42ba('0xf')][_0x42ba('0x10')](_0x1549e8)['then'](function(){logger[_0x42ba('0x11')](_0x42ba('0x12'),_0x51d7d8,_0x1549e8[_0x42ba('0x13')]);_0x5b30d6();})[_0x42ba('0x14')](function(_0x59969d){logger[_0x42ba('0x15')](_0x42ba('0x12'),_0x51d7d8,JSON['stringify'](_0x59969d));_0x36c8fa(_0x59969d);});});}exports['consequence']=function(_0x474742,_0xc0fea9){return function(_0x5c9d6d){try{if(!_[_0x42ba('0x16')](this[_0x42ba('0x17')][_0x42ba('0x18')])){logger[_0x42ba('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x474742,_0x42ba('0x19'));return _0x5c9d6d[_0x42ba('0x1a')]();}var _0x585842={'ContactId':this[_0x42ba('0x1b')]['id'],'sentAt':moment()[_0x42ba('0x1c')](_0x42ba('0x1d')),'direction':_0x42ba('0x1e')};if(this[_0x42ba('0x1f')]==='sms'||this[_0x42ba('0x1f')]==='whatsapp'){_0x585842['phone']=this['interaction'][_0x42ba('0x20')];}var _0x47f02b=this[_0x42ba('0x1f')];if(_0x47f02b===_0x42ba('0x21')){_0x585842[_0x42ba('0x22')]=this['account']['id'];}else{_0x585842[_['upperFirst'](_0x47f02b)+_0x42ba('0x23')]=this[_0x42ba('0x24')]['id'];}_0x585842[_[_0x42ba('0x25')](_0x47f02b)+_0x42ba('0x26')]=this[_0x42ba('0x17')]['id'];if(this[_0x42ba('0x17')][_0x42ba('0x27')]){var _0xa89e55=_0xc0fea9[0x4];if(!_[_0x42ba('0x28')](_0xa89e55)){_0x585842[_0x42ba('0x13')]=utils['getMustacheRender'](_0xa89e55,this);return rpc[_0x47f02b+'Message'][_0x42ba('0x10')](_0x585842)[_0x42ba('0x29')](function(_0x417b84){logger[_0x42ba('0x11')](_0x42ba('0x12'),_0x474742,_0x585842['body']);})[_0x42ba('0x14')](function(_0x3afa49){logger[_0x42ba('0x15')](_0x42ba('0x12'),_0x474742,JSON[_0x42ba('0x2a')](_0x3afa49));})[_0x42ba('0x2b')](function(){logger[_0x42ba('0x11')](_0x42ba('0x2c'),_0x474742);_0x5c9d6d[_0x42ba('0x2d')]();});}else{logger[_0x42ba('0x11')](_0x42ba('0x2e'),_0x474742);_0x5c9d6d[_0x42ba('0x2d')]();}}else{var _0x3dd6e2=this;var _0x435efa=_0xc0fea9[0x2][_0x42ba('0x2f')](/\\n/g,'\x0a');var _0x45bb4f={'credentials':{'private_key':_0x435efa,'client_email':_0xc0fea9[0x1]}};var _0xd430d4=new dialogflow[(_0x42ba('0x30'))](_0x45bb4f);var _0x2e0af5=_0xd430d4[_0x42ba('0x31')](_0xc0fea9[0x0],md5(_0x3dd6e2[_0x42ba('0x17')]['id']));var _0x372345={'session':_0x2e0af5,'queryInput':{'text':{'text':_0x3dd6e2['message'][_0x42ba('0x13')],'languageCode':_0xc0fea9[0x3]||'en'}}};return _0xd430d4[_0x42ba('0x32')](_0x372345)[_0x42ba('0x29')](function(_0x51324f){if(_0x51324f&&_0x51324f['length']){_0x3dd6e2['body']['dialogflowV2']=_0x51324f;var _0x497429=_0x51324f[0x0];var _0x482344=_0x497429[_0x42ba('0x33')]['diagnosticInfo']&&_0x497429['queryResult'][_0x42ba('0x34')]['fields']?_0x497429[_0x42ba('0x33')][_0x42ba('0x34')]['fields'][_0x42ba('0x35')][_0x42ba('0x36')]:![];_0x3dd6e2[_0x42ba('0x13')][_0x42ba('0x37')]=_0x497429['queryResult'][_0x42ba('0x38')];_0x3dd6e2[_0x42ba('0x13')][_0x42ba('0x39')]=_0x497429[_0x42ba('0x33')][_0x42ba('0x3a')];_0x3dd6e2[_0x42ba('0x13')][_0x42ba('0x3b')]=_0x497429[_0x42ba('0x33')][_0x42ba('0x34')]&&_0x497429[_0x42ba('0x33')]['diagnosticInfo'][_0x42ba('0x3c')]?_0x497429[_0x42ba('0x33')][_0x42ba('0x34')]['fields']['end_conversation'][_0x42ba('0x36')]:![];_0x3dd6e2[_0x42ba('0x13')][_0x42ba('0x3d')]=_0x497429[_0x42ba('0x33')][_0x42ba('0x3e')][_0x42ba('0x3f')];_0x3dd6e2['body'][_0x42ba('0x40')]=_0x497429[_0x42ba('0x33')][_0x42ba('0x3e')][_0x42ba('0x41')];_0x3dd6e2[_0x42ba('0x13')][_0x42ba('0x42')]=_0x497429[_0x42ba('0x33')][_0x42ba('0x3e')][_0x42ba('0x43')];_0x3dd6e2['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x497429[_0x42ba('0x33')]['languageCode'];_0x3dd6e2[_0x42ba('0x13')]['DIALOGFLOWV2_QUERYTEXT']=_0x497429[_0x42ba('0x33')]['queryText'];_0x3dd6e2[_0x42ba('0x13')][_0x42ba('0x44')]=_0x497429[_0x42ba('0x33')][_0x42ba('0x45')];_0x585842[_0x42ba('0x46')]=_0x42ba('0x47');_0x585842['providerResponse']=JSON[_0x42ba('0x2a')](_0x51324f);var _0x2e8693=[];for(var _0xbfe871=0x0;_0xbfe871<_0x51324f['length'];_0xbfe871++){var _0x31b137=_0x51324f[_0xbfe871];if(_0x31b137&&_0x31b137[_0x42ba('0x33')]&&_0x31b137['queryResult'][_0x42ba('0x48')]){_0x2e8693[_0x42ba('0x49')](createMessage(_0x474742,_0x47f02b,_0x585842,_0x31b137[_0x42ba('0x33')][_0x42ba('0x48')]));}}return Promise['all'](_0x2e8693)[_0x42ba('0x29')](function(){if(_0x482344){_0x5c9d6d[_0x42ba('0x1a')]();}else{_0x5c9d6d[_0x42ba('0x2d')]();}})[_0x42ba('0x14')](function(_0x1ed1df){logger[_0x42ba('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x474742,JSON[_0x42ba('0x2a')](_0x1ed1df));_0x5c9d6d['next']();});}})[_0x42ba('0x14')](function(_0x27f29f){logger[_0x42ba('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x474742,_0x27f29f['message'],_0x27f29f[_0x42ba('0x4a')]);_0x5c9d6d[_0x42ba('0x1a')]();});}}catch(_0x1f089e){logger[_0x42ba('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x474742,JSON[_0x42ba('0x2a')](_0x1f089e));_0x5c9d6d[_0x42ba('0x2d')]();}};}; \ No newline at end of file +var _0xfd35=['InteractionId','isEmpty','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','providerResponse','fulfillmentText','message','stack','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','account','upperFirst','AccountId'];(function(_0x22aa42,_0x4dc4fc){var _0x5ad26b=function(_0x172a78){while(--_0x172a78){_0x22aa42['push'](_0x22aa42['shift']());}};_0x5ad26b(++_0x4dc4fc);}(_0xfd35,0x17c));var _0x5fd3=function(_0x8a0d94,_0x16fcee){_0x8a0d94=_0x8a0d94-0x0;var _0x48f382=_0xfd35[_0x8a0d94];return _0x48f382;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x5fd3('0x0'));var moment=require('moment');var Promise=require(_0x5fd3('0x1'));var logger=require(_0x5fd3('0x2'))(_0x5fd3('0x3'));var utils=require(_0x5fd3('0x4'));var rpc={'chatMessage':require(_0x5fd3('0x5')),'openchannelMessage':require(_0x5fd3('0x6')),'mailMessage':require(_0x5fd3('0x7')),'smsMessage':require(_0x5fd3('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5fd3('0x9'))};function createMessage(_0xc834ea,_0x4c570d,_0x4ee9b7,_0x4ad8e2){return new Promise(function(_0x52ff34,_0x3bc940){var _0x519e8d=_[_0x5fd3('0xa')](_0x4ee9b7);_0x519e8d[_0x5fd3('0xb')]=_0x4ad8e2;return rpc[_0x4c570d+'Message'][_0x5fd3('0xc')](_0x519e8d)[_0x5fd3('0xd')](function(){logger[_0x5fd3('0xe')](_0x5fd3('0xf'),_0xc834ea,_0x519e8d[_0x5fd3('0xb')]);_0x52ff34();})[_0x5fd3('0x10')](function(_0x40ebae){logger[_0x5fd3('0x11')](_0x5fd3('0xf'),_0xc834ea,JSON[_0x5fd3('0x12')](_0x40ebae));_0x3bc940(_0x40ebae);});});}exports[_0x5fd3('0x13')]=function(_0x431fcb,_0x42cd12){return function(_0x5c8f32){try{if(!_[_0x5fd3('0x14')](this[_0x5fd3('0x15')][_0x5fd3('0x16')])){logger[_0x5fd3('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x431fcb,_0x5fd3('0x17'));return _0x5c8f32[_0x5fd3('0x18')]();}var _0x3e6e6f={'ContactId':this[_0x5fd3('0x19')]['id'],'sentAt':moment()[_0x5fd3('0x1a')](_0x5fd3('0x1b')),'direction':'out'};if(this[_0x5fd3('0x1c')]==='sms'||this[_0x5fd3('0x1c')]==='whatsapp'){_0x3e6e6f[_0x5fd3('0x1d')]=this[_0x5fd3('0x15')][_0x5fd3('0x1d')];}var _0xbe11db=this[_0x5fd3('0x1c')];if(_0xbe11db===_0x5fd3('0x1e')){_0x3e6e6f['ChatWebsiteId']=this[_0x5fd3('0x1f')]['id'];}else{_0x3e6e6f[_[_0x5fd3('0x20')](_0xbe11db)+_0x5fd3('0x21')]=this[_0x5fd3('0x1f')]['id'];}_0x3e6e6f[_[_0x5fd3('0x20')](_0xbe11db)+_0x5fd3('0x22')]=this[_0x5fd3('0x15')]['id'];if(this[_0x5fd3('0x15')]['created']){var _0x15609a=_0x42cd12[0x4];if(!_[_0x5fd3('0x23')](_0x15609a)){_0x3e6e6f[_0x5fd3('0xb')]=utils[_0x5fd3('0x24')](_0x15609a,this);return rpc[_0xbe11db+_0x5fd3('0x25')][_0x5fd3('0xc')](_0x3e6e6f)['then'](function(_0x1ebaae){logger[_0x5fd3('0xe')](_0x5fd3('0xf'),_0x431fcb,_0x3e6e6f[_0x5fd3('0xb')]);})[_0x5fd3('0x10')](function(_0x30a66a){logger[_0x5fd3('0x11')](_0x5fd3('0xf'),_0x431fcb,JSON['stringify'](_0x30a66a));})[_0x5fd3('0x26')](function(){logger[_0x5fd3('0xe')](_0x5fd3('0x27'),_0x431fcb);_0x5c8f32['stop']();});}else{logger[_0x5fd3('0xe')](_0x5fd3('0x28'),_0x431fcb);_0x5c8f32[_0x5fd3('0x29')]();}}else{var _0x3689bd=this;var _0x22642c=_0x42cd12[0x2][_0x5fd3('0x2a')](/\\n/g,'\x0a');var _0x238c01={'credentials':{'private_key':_0x22642c,'client_email':_0x42cd12[0x1]}};var _0x47141d=new dialogflow[(_0x5fd3('0x2b'))](_0x238c01);var _0x31416c=_0x47141d[_0x5fd3('0x2c')](_0x42cd12[0x0],md5(_0x3689bd[_0x5fd3('0x15')]['id']));var _0x9e437b={'session':_0x31416c,'queryInput':{'text':{'text':_0x3689bd['message']['body'],'languageCode':_0x42cd12[0x3]||'en'}}};return _0x47141d[_0x5fd3('0x2d')](_0x9e437b)[_0x5fd3('0xd')](function(_0x140d23){if(_0x140d23&&_0x140d23[_0x5fd3('0x2e')]){_0x3689bd[_0x5fd3('0xb')][_0x5fd3('0x2f')]=_0x140d23;var _0x2d2ea4=_0x140d23[0x0];var _0x325d8a=_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x31')]&&_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x31')][_0x5fd3('0x32')]?_0x2d2ea4[_0x5fd3('0x30')]['diagnosticInfo'][_0x5fd3('0x32')][_0x5fd3('0x33')][_0x5fd3('0x34')]:![];_0x3689bd[_0x5fd3('0xb')][_0x5fd3('0x35')]=_0x2d2ea4[_0x5fd3('0x30')]['action'];_0x3689bd['body'][_0x5fd3('0x36')]=_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x37')];_0x3689bd[_0x5fd3('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x31')]&&_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x31')][_0x5fd3('0x32')]?_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x31')][_0x5fd3('0x32')][_0x5fd3('0x33')]['boolValue']:![];_0x3689bd[_0x5fd3('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x38')][_0x5fd3('0x39')];_0x3689bd[_0x5fd3('0xb')][_0x5fd3('0x3a')]=_0x2d2ea4[_0x5fd3('0x30')]['intent']['displayName'];_0x3689bd[_0x5fd3('0xb')][_0x5fd3('0x3b')]=_0x2d2ea4[_0x5fd3('0x30')]['intent'][_0x5fd3('0x3c')];_0x3689bd[_0x5fd3('0xb')][_0x5fd3('0x3d')]=_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x3e')];_0x3689bd[_0x5fd3('0xb')][_0x5fd3('0x3f')]=_0x2d2ea4[_0x5fd3('0x30')]['queryText'];_0x3689bd[_0x5fd3('0xb')]['DIALOGFLOWV2_SCORE']=_0x2d2ea4[_0x5fd3('0x30')][_0x5fd3('0x40')];_0x3e6e6f['providerName']='dialogflowV2';_0x3e6e6f[_0x5fd3('0x41')]=JSON[_0x5fd3('0x12')](_0x140d23);var _0x3035ad=[];for(var _0x3aa41f=0x0;_0x3aa41f<_0x140d23[_0x5fd3('0x2e')];_0x3aa41f++){var _0x4d9a96=_0x140d23[_0x3aa41f];if(_0x4d9a96&&_0x4d9a96[_0x5fd3('0x30')]&&_0x4d9a96['queryResult'][_0x5fd3('0x42')]){_0x3035ad['push'](createMessage(_0x431fcb,_0xbe11db,_0x3e6e6f,_0x4d9a96[_0x5fd3('0x30')][_0x5fd3('0x42')]));}}return Promise['all'](_0x3035ad)[_0x5fd3('0xd')](function(){if(_0x325d8a){_0x5c8f32[_0x5fd3('0x18')]();}else{_0x5c8f32[_0x5fd3('0x29')]();}})[_0x5fd3('0x10')](function(_0xadb345){logger[_0x5fd3('0x11')](_0x5fd3('0xf'),_0x431fcb,JSON['stringify'](_0xadb345));_0x5c8f32[_0x5fd3('0x18')]();});}})[_0x5fd3('0x10')](function(_0x272c6c){logger[_0x5fd3('0x11')](_0x5fd3('0xf'),_0x431fcb,_0x272c6c[_0x5fd3('0x43')],_0x272c6c[_0x5fd3('0x44')]);_0x5c8f32[_0x5fd3('0x18')]();});}}catch(_0x3e5b65){logger['error'](_0x5fd3('0xf'),_0x431fcb,JSON[_0x5fd3('0x12')](_0x3e5b65));_0x5c8f32[_0x5fd3('0x29')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 6af3c14..ae96798 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ab0=['getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x1f4c8c,_0x19c0d9){var _0x1c06dd=function(_0x2ed464){while(--_0x2ed464){_0x1f4c8c['push'](_0x1f4c8c['shift']());}};_0x1c06dd(++_0x19c0d9);}(_0x4ab0,0x19a));var _0x04ab=function(_0x548bab,_0x53f638){_0x548bab=_0x548bab-0x0;var _0x40173d=_0x4ab0[_0x548bab];return _0x40173d;};'use strict';var schema=require(_0x04ab('0x0'));var _=require('lodash');var htmlToText=require(_0x04ab('0x1'));var utils=require(_0x04ab('0x2'));var logger=require(_0x04ab('0x3'))(_0x04ab('0x4'));var gotoif=schema({'condition':{'type':_0x04ab('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x04ab('0x6'),'message':_0x04ab('0x7')},'priorityFalse':{'type':'number','message':_0x04ab('0x8')}});exports[_0x04ab('0x9')]=function(_0x1285b7,_0x58871e){return function(_0x3dc433){try{var _0x323c02={'condition':htmlToText['fromString'](utils[_0x04ab('0xa')](_0x58871e[0x0],this),{'wordwrap':![]})[_0x04ab('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x58871e[0x1],'priorityFalse':_0x58871e[0x2]};var _0x514736=gotoif[_0x04ab('0x0')](_0x323c02,{'typecast':!![]});if(_0x514736[_0x04ab('0xc')]){logger[_0x04ab('0xd')](_0x04ab('0xe'),_0x1285b7,_[_0x04ab('0xf')](_0x514736,'message')[_0x04ab('0x10')](',\x20'));_0x3dc433[_0x04ab('0x11')]();}else{try{var _0x50a836=eval('('+_0x323c02[_0x04ab('0x12')]+')');var _0x4cca8f=_0x50a836?_0x323c02['priorityTrue']:_0x323c02['priorityFalse'];logger[_0x04ab('0x13')](_0x04ab('0x14'),_0x1285b7,_0x323c02[_0x04ab('0x12')],_0x50a836,_0x4cca8f||_0x04ab('0x15'));if(_0x4cca8f){var _0x4e3a1a=_[_0x04ab('0x16')](_0x3dc433[_0x04ab('0x17')](),{'p':_0x4cca8f});if(_0x4e3a1a>=0x0){logger[_0x04ab('0x13')](_0x04ab('0x18'),_0x1285b7,_0x4cca8f||_0x04ab('0x15'),_0x4e3a1a);_0x3dc433['next'](_0x4e3a1a);}else{logger[_0x04ab('0x13')](_0x04ab('0x19'),_0x1285b7,_0x4cca8f||_0x04ab('0x15'));_0x3dc433[_0x04ab('0x11')]();}}else{_0x3dc433[_0x04ab('0x15')]();}}catch(_0x564f82){logger['error'](_0x04ab('0x1a'),_0x1285b7,_0x564f82['message']);_0x3dc433['stop']();}}}catch(_0x783ea1){logger[_0x04ab('0xd')]('[%s][GOTOIF]\x20%s',_0x1285b7,JSON[_0x04ab('0x1b')](_0x783ea1));_0x3dc433['stop']();}};}; \ No newline at end of file +var _0xd4a6=['getMustacheRender','replace','validate','length','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stop','error','stringify','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x406eab,_0x510331){var _0x49574c=function(_0x4d8e40){while(--_0x4d8e40){_0x406eab['push'](_0x406eab['shift']());}};_0x49574c(++_0x510331);}(_0xd4a6,0x164));var _0x6d4a=function(_0x97a39d,_0x4fd37c){_0x97a39d=_0x97a39d-0x0;var _0x4736c2=_0xd4a6[_0x97a39d];return _0x4736c2;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x6d4a('0x0'));var utils=require(_0x6d4a('0x1'));var logger=require(_0x6d4a('0x2'))('routing');var gotoif=schema({'condition':{'type':_0x6d4a('0x3'),'required':!![],'message':_0x6d4a('0x4')},'priorityTrue':{'type':_0x6d4a('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x6d4a('0x5'),'message':_0x6d4a('0x6')}});exports[_0x6d4a('0x7')]=function(_0x591ecd,_0x5d413d){return function(_0x24bebf){try{var _0x452cd5={'condition':htmlToText['fromString'](utils[_0x6d4a('0x8')](_0x5d413d[0x0],this),{'wordwrap':![]})[_0x6d4a('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5d413d[0x1],'priorityFalse':_0x5d413d[0x2]};var _0x27bef6=gotoif[_0x6d4a('0xa')](_0x452cd5,{'typecast':!![]});if(_0x27bef6[_0x6d4a('0xb')]){logger['error'](_0x6d4a('0xc'),_0x591ecd,_[_0x6d4a('0xd')](_0x27bef6,_0x6d4a('0xe'))[_0x6d4a('0xf')](',\x20'));_0x24bebf['stop']();}else{try{var _0x2eeef1=eval('('+_0x452cd5[_0x6d4a('0x10')]+')');var _0x2d66fd=_0x2eeef1?_0x452cd5['priorityTrue']:_0x452cd5[_0x6d4a('0x11')];logger[_0x6d4a('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x591ecd,_0x452cd5[_0x6d4a('0x10')],_0x2eeef1,_0x2d66fd||_0x6d4a('0x13'));if(_0x2d66fd){var _0x45d829=_[_0x6d4a('0x14')](_0x24bebf[_0x6d4a('0x15')](),{'p':_0x2d66fd});if(_0x45d829>=0x0){logger[_0x6d4a('0x12')](_0x6d4a('0x16'),_0x591ecd,_0x2d66fd||_0x6d4a('0x13'),_0x45d829);_0x24bebf[_0x6d4a('0x13')](_0x45d829);}else{logger[_0x6d4a('0x12')](_0x6d4a('0x17'),_0x591ecd,_0x2d66fd||_0x6d4a('0x13'));_0x24bebf['stop']();}}else{_0x24bebf['next']();}}catch(_0x244be0){logger['error'](_0x6d4a('0x18'),_0x591ecd,_0x244be0['message']);_0x24bebf[_0x6d4a('0x19')]();}}}catch(_0x357e06){logger[_0x6d4a('0x1a')](_0x6d4a('0xc'),_0x591ecd,JSON[_0x6d4a('0x1b')](_0x357e06));_0x24bebf[_0x6d4a('0x19')]();}};}; \ 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 5086066..00f046f 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 _0x14cb=['validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','stop','error','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14cb,0x121));var _0xb14c=function(_0x4b6b16,_0xc18e50){_0x4b6b16=_0x4b6b16-0x0;var _0x4fb3ee=_0x14cb[_0x4b6b16];return _0x4fb3ee;};'use strict';var schema=require(_0xb14c('0x0'));var _=require(_0xb14c('0x1'));var logger=require('../../../../config/logger')(_0xb14c('0x2'));var gotop=schema({'priority':{'type':_0xb14c('0x3'),'required':!![],'message':_0xb14c('0x4')}});exports['consequence']=function(_0x412fb1,_0xbaaa6e){return function(_0x327c2b){try{var _0x547f42={'priority':_0xbaaa6e[0x0]};var _0x547540=gotop[_0xb14c('0x0')](_0x547f42,{'typecast':!![]});if(_0x547540[_0xb14c('0x5')]){logger['error'](_0xb14c('0x6'),_0x412fb1,_['map'](_0x547540,'message')['join'](',\x20'));_0x327c2b['stop']();}else{logger['info'](_0xb14c('0x7'),_0x412fb1,_0x547f42['priority']);if(_0x547f42['priority']){var _0x13b5a3=_[_0xb14c('0x8')](_0x327c2b[_0xb14c('0x9')](),{'p':_0x547f42[_0xb14c('0xa')]});if(_0x13b5a3>=0x0){logger['info'](_0xb14c('0xb'),_0x412fb1,_0x547f42[_0xb14c('0xa')]||_0xb14c('0xc'),_0x13b5a3);_0x327c2b['next'](_0x13b5a3);}else{logger[_0xb14c('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x412fb1,_0x547f42['priority']||'next');_0x327c2b[_0xb14c('0xe')]();}}else{_0x327c2b[_0xb14c('0xc')]();}}}catch(_0x449df1){logger[_0xb14c('0xf')](_0xb14c('0x6'),_0x412fb1,JSON[_0xb14c('0x10')](_0x449df1));_0x327c2b['stop']();}};}; \ No newline at end of file +var _0x46ff=['length','error','[%s][GOTOP]\x20%s','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number'];(function(_0x52e24b,_0x5bbcd5){var _0x3fd7f7=function(_0x3a6b9b){while(--_0x3a6b9b){_0x52e24b['push'](_0x52e24b['shift']());}};_0x3fd7f7(++_0x5bbcd5);}(_0x46ff,0x1d8));var _0xf46f=function(_0x28d46f,_0xc22e7d){_0x28d46f=_0x28d46f-0x0;var _0x313a7c=_0x46ff[_0x28d46f];return _0x313a7c;};'use strict';var schema=require('validate');var _=require(_0xf46f('0x0'));var logger=require(_0xf46f('0x1'))(_0xf46f('0x2'));var gotop=schema({'priority':{'type':_0xf46f('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1e65bc,_0x39c4c5){return function(_0x38f153){try{var _0x723a88={'priority':_0x39c4c5[0x0]};var _0x4b8c0c=gotop['validate'](_0x723a88,{'typecast':!![]});if(_0x4b8c0c[_0xf46f('0x4')]){logger[_0xf46f('0x5')](_0xf46f('0x6'),_0x1e65bc,_['map'](_0x4b8c0c,_0xf46f('0x7'))['join'](',\x20'));_0x38f153[_0xf46f('0x8')]();}else{logger[_0xf46f('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x1e65bc,_0x723a88['priority']);if(_0x723a88[_0xf46f('0xa')]){var _0x575005=_[_0xf46f('0xb')](_0x38f153[_0xf46f('0xc')](),{'p':_0x723a88['priority']});if(_0x575005>=0x0){logger[_0xf46f('0x9')](_0xf46f('0xd'),_0x1e65bc,_0x723a88['priority']||_0xf46f('0xe'),_0x575005);_0x38f153[_0xf46f('0xe')](_0x575005);}else{logger[_0xf46f('0x9')](_0xf46f('0xf'),_0x1e65bc,_0x723a88['priority']||_0xf46f('0xe'));_0x38f153[_0xf46f('0x8')]();}}else{_0x38f153['next']();}}}catch(_0x20e969){logger[_0xf46f('0x5')](_0xf46f('0x6'),_0x1e65bc,JSON[_0xf46f('0x10')](_0x20e969));_0x38f153[_0xf46f('0x8')]();}};}; \ 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 cbd2167..64e77d7 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 _0x25c2=['../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/openchannelMessage'];(function(_0x3f27b2,_0x368044){var _0x3d5063=function(_0x960b40){while(--_0x960b40){_0x3f27b2['push'](_0x3f27b2['shift']());}};_0x3d5063(++_0x368044);}(_0x25c2,0xdd));var _0x225c=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x25c2[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x225c('0x0'));var utils=require('./utils');var logger=require(_0x225c('0x1'))(_0x225c('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x225c('0x3')),'mailMessage':require(_0x225c('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x225c('0x5')),'whatsappMessage':require(_0x225c('0x6'))};exports['consequence']=function(_0x169435,_0x1f3b42){return function(_0x1fac61){try{var _0x36c1aa={'body':utils[_0x225c('0x7')](_0x1f3b42[0x0],this),'ContactId':this[_0x225c('0x8')]['id']};if(this['channel']===_0x225c('0x9')){_0x36c1aa['ChatWebsiteId']=this['account']['id'];}else{_0x36c1aa[_[_0x225c('0xa')](this[_0x225c('0xb')])+_0x225c('0xc')]=this['account']['id'];}_0x36c1aa[_[_0x225c('0xa')](this[_0x225c('0xb')])+_0x225c('0xd')]=this[_0x225c('0xe')]['id'];if(rpc[this['channel']+_0x225c('0xf')]){return rpc[this[_0x225c('0xb')]+'Message'][_0x225c('0x10')](_0x36c1aa)[_0x225c('0x11')](function(_0x18ab23){logger['info'](_0x225c('0x12'),_0x169435,_0x36c1aa[_0x225c('0x13')]);_0x1fac61[_0x225c('0x14')]();})[_0x225c('0x15')](function(_0x1f9782){logger[_0x225c('0x16')](_0x225c('0x12'),_0x169435,JSON[_0x225c('0x17')](_0x1f9782));_0x1fac61['stop']();});}}catch(_0x5a2c4b){logger[_0x225c('0x16')](_0x225c('0x12'),_0x169435,JSON[_0x225c('0x17')](_0x5a2c4b));_0x1fac61[_0x225c('0x18')]();}};}; \ No newline at end of file +var _0xfdb8=['stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','upperFirst','AccountId','account','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x1ed272,_0x44921a){var _0x547251=function(_0x5dcf35){while(--_0x5dcf35){_0x1ed272['push'](_0x1ed272['shift']());}};_0x547251(++_0x44921a);}(_0xfdb8,0x120));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8fdb('0x0'));var utils=require(_0x8fdb('0x1'));var logger=require(_0x8fdb('0x2'))(_0x8fdb('0x3'));var rpc={'chatMessage':require(_0x8fdb('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8fdb('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8fdb('0x6')),'whatsappMessage':require(_0x8fdb('0x7'))};exports['consequence']=function(_0x4c14d2,_0x7a9123){return function(_0x60813c){try{var _0x2b7eab={'body':utils[_0x8fdb('0x8')](_0x7a9123[0x0],this),'ContactId':this[_0x8fdb('0x9')]['id']};if(this[_0x8fdb('0xa')]===_0x8fdb('0xb')){_0x2b7eab['ChatWebsiteId']=this['account']['id'];}else{_0x2b7eab[_[_0x8fdb('0xc')](this[_0x8fdb('0xa')])+_0x8fdb('0xd')]=this[_0x8fdb('0xe')]['id'];}_0x2b7eab[_[_0x8fdb('0xc')](this[_0x8fdb('0xa')])+_0x8fdb('0xf')]=this[_0x8fdb('0x10')]['id'];if(rpc[this[_0x8fdb('0xa')]+_0x8fdb('0x11')]){return rpc[this[_0x8fdb('0xa')]+_0x8fdb('0x11')][_0x8fdb('0x12')](_0x2b7eab)[_0x8fdb('0x13')](function(_0x38c820){logger['info'](_0x8fdb('0x14'),_0x4c14d2,_0x2b7eab[_0x8fdb('0x15')]);_0x60813c[_0x8fdb('0x16')]();})[_0x8fdb('0x17')](function(_0x56c95f){logger['error'](_0x8fdb('0x14'),_0x4c14d2,JSON['stringify'](_0x56c95f));_0x60813c[_0x8fdb('0x18')]();});}}catch(_0x1699f2){logger['error'](_0x8fdb('0x14'),_0x4c14d2,JSON[_0x8fdb('0x19')](_0x1699f2));_0x60813c[_0x8fdb('0x18')]();}};}; \ 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 094f4ae..6201d39 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 _0x7899=['[%s][NOOP]\x20%s','next','error','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x43606b,_0x2f2292){var _0xbfd21a=function(_0x2f28fa){while(--_0x2f28fa){_0x43606b['push'](_0x43606b['shift']());}};_0xbfd21a(++_0x2f2292);}(_0x7899,0x15a));var _0x9789=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0x7899[_0x4b8156];return _0x4a819c;};'use strict';var utils=require(_0x9789('0x0'));var logger=require(_0x9789('0x1'))(_0x9789('0x2'));exports[_0x9789('0x3')]=function(_0x2ea5ee,_0x1419aa){return function(_0x339480){try{logger[_0x9789('0x4')](_0x9789('0x5'),_0x2ea5ee,utils['getMustacheRender'](_0x1419aa[0x0],this));_0x339480[_0x9789('0x6')]();}catch(_0x599ac5){logger[_0x9789('0x7')](_0x9789('0x5'),_0x2ea5ee,JSON['stringify'](_0x599ac5));_0x339480[_0x9789('0x8')]();}};}; \ No newline at end of file +var _0xb22f=['error','[%s][NOOP]\x20%s','stringify','stop','./utils','routing','consequence','info','next'];(function(_0x3e35e9,_0x343705){var _0x5a9829=function(_0x590aa6){while(--_0x590aa6){_0x3e35e9['push'](_0x3e35e9['shift']());}};_0x5a9829(++_0x343705);}(_0xb22f,0x175));var _0xfb22=function(_0x576202,_0x27da95){_0x576202=_0x576202-0x0;var _0x5a1606=_0xb22f[_0x576202];return _0x5a1606;};'use strict';var utils=require(_0xfb22('0x0'));var logger=require('../../../../config/logger')(_0xfb22('0x1'));exports[_0xfb22('0x2')]=function(_0x3095e8,_0x321f87){return function(_0x262592){try{logger[_0xfb22('0x3')]('[%s][NOOP]\x20%s',_0x3095e8,utils['getMustacheRender'](_0x321f87[0x0],this));_0x262592[_0xfb22('0x4')]();}catch(_0x3de8b5){logger[_0xfb22('0x5')](_0xfb22('0x6'),_0x3095e8,JSON[_0xfb22('0x7')](_0x3de8b5));_0x262592[_0xfb22('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index ac8f515..7d630ed 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 _0xeb3e=['stack','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','defaults','localhost','socket.io-emitter','redis','queue_id','account','queue','from','emit','clone','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','interaction','MessageId','message','upperFirst','chat','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall'];(function(_0x5d1017,_0x1fbe76){var _0x5ed206=function(_0x38844d){while(--_0x38844d){_0x5d1017['push'](_0x5d1017['shift']());}};_0x5ed206(++_0x1fbe76);}(_0xeb3e,0x106));var _0xeeb3=function(_0x393173,_0x4beba2){_0x393173=_0x393173-0x0;var _0x3f1990=_0xeb3e[_0x393173];return _0x3f1990;};'use strict';var schema=require('validate');var _=require(_0xeeb3('0x0'));var util=require(_0xeeb3('0x1'));var seqqueue=require(_0xeeb3('0x2'));var moment=require(_0xeeb3('0x3'));var Redis=require(_0xeeb3('0x4'));var config=require('../../../../config/environment');var logger=require(_0xeeb3('0x5'))(_0xeeb3('0x6'));var strategy=require(_0xeeb3('0x7'));config['redis']=_[_0xeeb3('0x8')](config['redis'],{'host':_0xeeb3('0x9'),'port':0x18eb});var io=require(_0xeeb3('0xa'))(new Redis(config[_0xeeb3('0xb')]));var attributes=['id',_0xeeb3('0xc'),_0xeeb3('0xd'),_0xeeb3('0xe'),_0xeeb3('0xf'),'joinAt'];function emit(_0x5b751a,_0x289444,_0x3a9542){io['to'](_0x5b751a)[_0xeeb3('0x10')](_0x289444,_0x3a9542);}function emitChannelQueueInteraction(_0x5b885a,_0x3e8d18,_0x5047d8,_0x485272,_0x79d78a,_0x6c4b00,_0x20fd5b,_0x57f7f6){var _0x192dfc=_[_0xeeb3('0x11')](_0x5047d8);_0x192dfc[_0xeeb3('0xc')]=_0x57f7f6;_0x192dfc[_0xeeb3('0xe')]=_0x3e8d18;_0x192dfc['account']=_0x485272;_0x192dfc['id']=_0x79d78a;if(_0x6c4b00){attributes['push'](_[_0xeeb3('0x12')](_0x5b885a)+_0xeeb3('0x13'));_0x20fd5b[util[_0xeeb3('0x14')](_0xeeb3('0x15'),_0x5b885a)][_0x79d78a]=_[_0xeeb3('0x16')](_0x192dfc,attributes);}else{delete _0x20fd5b[util[_0xeeb3('0x14')](_0xeeb3('0x15'),_0x5b885a)][_0x79d78a];}emit(util[_0xeeb3('0x14')](_0xeeb3('0x17'),_0x5b885a,_0x3e8d18),util[_0xeeb3('0x14')](_0xeeb3('0x18'),_0x5b885a,_0x6c4b00?'save':_0xeeb3('0x19')),_[_0xeeb3('0x16')](_0x192dfc,attributes));}var rpc={'openchannelQueueReport':require(_0xeeb3('0x1a')),'mailQueueReport':require(_0xeeb3('0x1b')),'chatQueueReport':require(_0xeeb3('0x1c')),'smsQueueReport':require(_0xeeb3('0x1d')),'faxQueueReport':require(_0xeeb3('0x1e')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0xeeb3('0x1f')),'smsInteraction':require(_0xeeb3('0x20')),'whatsappInteraction':require(_0xeeb3('0x21'))};var queue=schema({'name':{'type':_0xeeb3('0x22'),'required':!![],'message':_0xeeb3('0x23')},'timeout':{'type':_0xeeb3('0x24'),'message':_0xeeb3('0x25')}});function startRouting(_0x4dc259,_0x5ca6d4,_0x392b6d,_0x5d770a){if(_0x4dc259&&_0x5ca6d4&&_0x392b6d){_0x5ca6d4[_0xeeb3('0x26')]+=0x1;var _0x8f9fe4={'uniqueid':_0x4dc259,'from':_0x392b6d[_0xeeb3('0x27')]?_0x392b6d[_0xeeb3('0x27')]['from']:'','joinAt':moment()[_0xeeb3('0x14')](_0xeeb3('0x28')),'ContactId':_0x392b6d['contact']?_0x392b6d[_0xeeb3('0x29')]['id']:null,'ListId':_0x392b6d[_0xeeb3('0x2a')]?_0x392b6d['list']['id']:null};_0x8f9fe4[_['upperFirst'](_0x392b6d[_0xeeb3('0x2b')])+_0xeeb3('0x2c')]=_0x5ca6d4['id']||null;_0x8f9fe4[_['upperFirst'](_0x392b6d[_0xeeb3('0x2b')])+_0xeeb3('0x13')]=_0x392b6d['interaction']?_0x392b6d[_0xeeb3('0x2d')]['id']:null;_0x8f9fe4[_['upperFirst'](_0x392b6d['channel'])+_0xeeb3('0x2e')]=_0x392b6d[_0xeeb3('0x2f')]?_0x392b6d[_0xeeb3('0x2f')]['id']:null;_0x8f9fe4[_[_0xeeb3('0x30')](_0x392b6d[_0xeeb3('0x2b')])+(_0x392b6d[_0xeeb3('0x2b')]!==_0xeeb3('0x31')?'AccountId':_0xeeb3('0x32'))]=_0x392b6d[_0xeeb3('0xd')]?_0x392b6d[_0xeeb3('0xd')]['id']:null;logger[_0xeeb3('0x33')](util[_0xeeb3('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4dc259,_0x5ca6d4[_0xeeb3('0x34')]));emitChannelQueueInteraction(_0x392b6d[_0xeeb3('0x2b')],_0x5ca6d4[_0xeeb3('0x34')],_0x8f9fe4,_0x392b6d['account'][_0xeeb3('0x34')],_0x392b6d[_0xeeb3('0x2f')]['id'],!![],_0x5d770a,_0x5ca6d4['id']);if(rpc[_0x392b6d[_0xeeb3('0x2b')]+_0xeeb3('0x35')]){return rpc[_0x392b6d[_0xeeb3('0x2b')]+_0xeeb3('0x35')][_0xeeb3('0x36')](_0x8f9fe4)[_0xeeb3('0x37')](function(_0x5277b5){logger[_0xeeb3('0x38')](_0xeeb3('0x39'),_0x5277b5);});}}}function stopRouting(_0x312189,_0x1dbee0,_0x3a6e46,_0x57f5f3){if(_0x312189&&_0x1dbee0){_0x1dbee0[_0xeeb3('0x26')]-=0x1;var _0xb1e6f3={'leaveAt':moment()[_0xeeb3('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xeeb3('0x14')](_0xeeb3('0x28')),'reason':'accepted'};logger[_0xeeb3('0x33')](util[_0xeeb3('0x14')](_0xeeb3('0x3a'),_0x312189,_0x1dbee0[_0xeeb3('0x34')]));emitChannelQueueInteraction(_0x3a6e46[_0xeeb3('0x2b')],_0x1dbee0[_0xeeb3('0x34')],_0x3a6e46[_0xeeb3('0x27')],_0x3a6e46[_0xeeb3('0xd')][_0xeeb3('0x34')],_0x3a6e46['message']['id'],![],_0x57f5f3,_0x1dbee0['id']);return rpc[_0x3a6e46['channel']+_0xeeb3('0x3b')]['update'](_0x3a6e46[_0xeeb3('0x2d')]['id'],{'queueId':_0x1dbee0['id']})[_0xeeb3('0x3c')](function(){if(rpc[_0x3a6e46[_0xeeb3('0x2b')]+_0xeeb3('0x35')]){return rpc[_0x3a6e46[_0xeeb3('0x2b')]+_0xeeb3('0x35')][_0xeeb3('0x3d')](_0x312189,_0xb1e6f3)[_0xeeb3('0x37')](function(_0x59ab76){logger['error'](_0xeeb3('0x3e'),_0x59ab76);});}});}}function endRouting(_0x1fb7f5,_0x80aa19,_0x267382,_0x278fe5){if(_0x1fb7f5&&_0x80aa19){_0x80aa19[_0xeeb3('0x26')]-=0x1;var _0x1144d6={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xeeb3('0x14')](_0xeeb3('0x28')),'reason':_0xeeb3('0x3f')};logger[_0xeeb3('0x33')](util[_0xeeb3('0x14')](_0xeeb3('0x40'),_0x1fb7f5,_0x80aa19['name']));emitChannelQueueInteraction(_0x267382['channel'],_0x80aa19[_0xeeb3('0x34')],_0x267382[_0xeeb3('0x27')],_0x267382[_0xeeb3('0xd')][_0xeeb3('0x34')],_0x267382['message']['id'],![],_0x278fe5);if(rpc[_0x267382[_0xeeb3('0x2b')]+'QueueReport']){return rpc[_0x267382[_0xeeb3('0x2b')]+_0xeeb3('0x35')]['update'](_0x1fb7f5,_0x1144d6)['catch'](function(_0x162535){logger['error'](_0xeeb3('0x3e'),_0x162535);});}}}function handleFindQueue(_0x37ed38){return function(_0x3cf13b){return _0x3cf13b[_0xeeb3('0x34')]['toLowerCase']()===_0x37ed38[_0xeeb3('0x41')]();};}exports[_0xeeb3('0x42')]=function(_0x1dbdf6,_0x52e8ab,_0x1e974c,_0xfd7984){return function(_0x6b4e10){try{var _0x512e8e={'name':_0x52e8ab[0x0],'timeout':_0x52e8ab[0x1]};var _0x45d57e=queue['validate'](_0x512e8e,{'typecast':!![]});if(_0x45d57e[_0xeeb3('0x43')]){logger[_0xeeb3('0x38')](_0xeeb3('0x44'),_0x1dbdf6,_[_0xeeb3('0x45')](_0x45d57e,'message')[_0xeeb3('0x46')](',\x20'));_0x6b4e10[_0xeeb3('0x47')]();}else{var _0x4e0508=_[_0xeeb3('0x48')](_0x1e974c[_0xfd7984['channel']+'Queues'],handleFindQueue(_0x512e8e[_0xeeb3('0x34')]));if(_0x4e0508){startRouting(_0x1dbdf6,_0x4e0508,_0xfd7984,_0x1e974c);var _0x3653cf=(_0x4e0508[_0xeeb3('0x3f')]||0xa)*0x3e8;var _0x33d599=(_0x512e8e[_0xeeb3('0x3f')]||0x14)*0x3e8;var _0x450dc2;if(_0x3653cf>_0x33d599){_0x33d599=_0x3653cf;}var _0x4b3c5d=seqqueue[_0xeeb3('0x49')](_0x3653cf);_0x4b3c5d['id']=_0x1dbdf6;_0x4b3c5d[_0xeeb3('0x4a')]=_0x3653cf;_0x4b3c5d[_0xeeb3('0x4b')]=_0x33d599;_0x4b3c5d[_0xeeb3('0x2b')]=_0xfd7984[_0xeeb3('0x2b')];_0x1e974c['rules'][_0x1dbdf6]['on'](_0xeeb3('0x4c'),function(){logger[_0xeeb3('0x33')](_0xeeb3('0x4d'),_0x1dbdf6);stopRouting(_0x1dbdf6,_0x4e0508,_0xfd7984,_0x1e974c);clearTimeout(_0x450dc2);_0x450dc2=undefined;_0x4b3c5d[_0xeeb3('0x4e')](!![]);if(_0x1e974c[_0xeeb3('0x4f')][_0x1dbdf6]){delete _0x1e974c[_0xeeb3('0x4f')][_0x1dbdf6];}_0x6b4e10['stop']();});_0x1e974c[_0xeeb3('0x4f')][_0x1dbdf6]['on'](_0xeeb3('0x50'),function(){if(_0x1e974c[_0xeeb3('0x4f')][_0x1dbdf6]){delete _0x1e974c[_0xeeb3('0x4f')][_0x1dbdf6];}});_0x450dc2=setTimeout(function(){logger[_0xeeb3('0x33')](_0xeeb3('0x51'),_0x1dbdf6);endRouting(_0x1dbdf6,_0x4e0508,_0xfd7984,_0x1e974c);clearTimeout(_0x450dc2);_0x4b3c5d['close'](!![]);_0x6b4e10[_0xeeb3('0x52')]();},_0x33d599);switch(_0x4e0508[_0xeeb3('0x53')]){case _0xeeb3('0x54'):strategy['rrmemory'](_0x4b3c5d,_0x4e0508,_0x1e974c,_0xfd7984);break;default:strategy[_0xeeb3('0x55')](_0x4b3c5d,_0x4e0508,_0x1e974c,_0xfd7984);}}else{logger[_0xeeb3('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1dbdf6,_0x512e8e['name']);_0x6b4e10[_0xeeb3('0x47')]();}}}catch(_0x2c3431){logger[_0xeeb3('0x38')](_0xeeb3('0x44'),_0x1dbdf6,_0x2c3431[_0xeeb3('0x56')]);_0x6b4e10[_0xeeb3('0x47')]();}};}; \ No newline at end of file +var _0xb5e1=['routing','./strategy','redis','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','pick','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','message','chat','WebsiteId','info','name','QueueReport','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger'];(function(_0x30e3d6,_0x2bf00f){var _0xe35a6f=function(_0x503cc4){while(--_0x503cc4){_0x30e3d6['push'](_0x30e3d6['shift']());}};_0xe35a6f(++_0x2bf00f);}(_0xb5e1,0x18f));var _0x1b5e=function(_0x1e62b8,_0x5eed4c){_0x1e62b8=_0x1e62b8-0x0;var _0x2ab271=_0xb5e1[_0x1e62b8];return _0x2ab271;};'use strict';var schema=require(_0x1b5e('0x0'));var _=require(_0x1b5e('0x1'));var util=require(_0x1b5e('0x2'));var seqqueue=require(_0x1b5e('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x1b5e('0x4'));var logger=require(_0x1b5e('0x5'))(_0x1b5e('0x6'));var strategy=require(_0x1b5e('0x7'));config[_0x1b5e('0x8')]=_['defaults'](config[_0x1b5e('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x1b5e('0x9'))(new Redis(config[_0x1b5e('0x8')]));var attributes=['id',_0x1b5e('0xa'),_0x1b5e('0xb'),_0x1b5e('0xc'),_0x1b5e('0xd'),_0x1b5e('0xe')];function emit(_0x194074,_0x5d4ea5,_0x4b9b53){io['to'](_0x194074)[_0x1b5e('0xf')](_0x5d4ea5,_0x4b9b53);}function emitChannelQueueInteraction(_0x34c103,_0x5bc6c4,_0x592ae4,_0x180171,_0x59bb47,_0xd069d5,_0x1d88b5,_0x80979b){var _0x4b4eb3=_[_0x1b5e('0x10')](_0x592ae4);_0x4b4eb3[_0x1b5e('0xa')]=_0x80979b;_0x4b4eb3['queue']=_0x5bc6c4;_0x4b4eb3['account']=_0x180171;_0x4b4eb3['id']=_0x59bb47;if(_0xd069d5){attributes[_0x1b5e('0x11')](_[_0x1b5e('0x12')](_0x34c103)+_0x1b5e('0x13'));_0x1d88b5[util['format']('%sQueuesWaitingInteractions',_0x34c103)][_0x59bb47]=_[_0x1b5e('0x14')](_0x4b4eb3,attributes);}else{delete _0x1d88b5[util[_0x1b5e('0x15')](_0x1b5e('0x16'),_0x34c103)][_0x59bb47];}emit(util[_0x1b5e('0x15')]('%s:queue:%s',_0x34c103,_0x5bc6c4),util['format'](_0x1b5e('0x17'),_0x34c103,_0xd069d5?_0x1b5e('0x18'):_0x1b5e('0x19')),_[_0x1b5e('0x14')](_0x4b4eb3,attributes));}var rpc={'openchannelQueueReport':require(_0x1b5e('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x1b5e('0x1b')),'smsQueueReport':require(_0x1b5e('0x1c')),'faxQueueReport':require(_0x1b5e('0x1d')),'whatsappQueueReport':require(_0x1b5e('0x1e')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x1b5e('0x1f')),'openchannelInteraction':require(_0x1b5e('0x20')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x1b5e('0x21'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x1b5e('0x22'),'message':_0x1b5e('0x23')}});function startRouting(_0x53bdd0,_0x476196,_0x4cf30c,_0x32c03d){if(_0x53bdd0&&_0x476196&&_0x4cf30c){_0x476196[_0x1b5e('0x24')]+=0x1;var _0x1321e9={'uniqueid':_0x53bdd0,'from':_0x4cf30c[_0x1b5e('0x25')]?_0x4cf30c[_0x1b5e('0x25')]['from']:'','joinAt':moment()[_0x1b5e('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4cf30c[_0x1b5e('0x26')]?_0x4cf30c[_0x1b5e('0x26')]['id']:null,'ListId':_0x4cf30c[_0x1b5e('0x27')]?_0x4cf30c[_0x1b5e('0x27')]['id']:null};_0x1321e9[_[_0x1b5e('0x28')](_0x4cf30c[_0x1b5e('0x29')])+_0x1b5e('0x2a')]=_0x476196['id']||null;_0x1321e9[_[_0x1b5e('0x28')](_0x4cf30c[_0x1b5e('0x29')])+_0x1b5e('0x13')]=_0x4cf30c[_0x1b5e('0x2b')]?_0x4cf30c[_0x1b5e('0x2b')]['id']:null;_0x1321e9[_[_0x1b5e('0x28')](_0x4cf30c['channel'])+'MessageId']=_0x4cf30c[_0x1b5e('0x2c')]?_0x4cf30c[_0x1b5e('0x2c')]['id']:null;_0x1321e9[_[_0x1b5e('0x28')](_0x4cf30c['channel'])+(_0x4cf30c[_0x1b5e('0x29')]!==_0x1b5e('0x2d')?'AccountId':_0x1b5e('0x2e'))]=_0x4cf30c[_0x1b5e('0xb')]?_0x4cf30c[_0x1b5e('0xb')]['id']:null;logger[_0x1b5e('0x2f')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x53bdd0,_0x476196['name']));emitChannelQueueInteraction(_0x4cf30c[_0x1b5e('0x29')],_0x476196['name'],_0x1321e9,_0x4cf30c[_0x1b5e('0xb')][_0x1b5e('0x30')],_0x4cf30c[_0x1b5e('0x2c')]['id'],!![],_0x32c03d,_0x476196['id']);if(rpc[_0x4cf30c['channel']+_0x1b5e('0x31')]){return rpc[_0x4cf30c[_0x1b5e('0x29')]+_0x1b5e('0x31')]['create'](_0x1321e9)[_0x1b5e('0x32')](function(_0x4bc1ee){logger[_0x1b5e('0x33')]('create\x20queue\x20report',_0x4bc1ee);});}}}function stopRouting(_0x16aea3,_0x482b19,_0xd66376,_0x450798){if(_0x16aea3&&_0x482b19){_0x482b19[_0x1b5e('0x24')]-=0x1;var _0x5ec50d={'leaveAt':moment()[_0x1b5e('0x15')](_0x1b5e('0x34')),'acceptAt':moment()['format'](_0x1b5e('0x34')),'reason':_0x1b5e('0x35')};logger[_0x1b5e('0x2f')](util[_0x1b5e('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x16aea3,_0x482b19['name']));emitChannelQueueInteraction(_0xd66376['channel'],_0x482b19[_0x1b5e('0x30')],_0xd66376[_0x1b5e('0x25')],_0xd66376[_0x1b5e('0xb')]['name'],_0xd66376[_0x1b5e('0x2c')]['id'],![],_0x450798,_0x482b19['id']);return rpc[_0xd66376[_0x1b5e('0x29')]+_0x1b5e('0x36')][_0x1b5e('0x37')](_0xd66376[_0x1b5e('0x2b')]['id'],{'queueId':_0x482b19['id']})[_0x1b5e('0x38')](function(){if(rpc[_0xd66376['channel']+_0x1b5e('0x31')]){return rpc[_0xd66376[_0x1b5e('0x29')]+_0x1b5e('0x31')]['update'](_0x16aea3,_0x5ec50d)[_0x1b5e('0x32')](function(_0x3da6e0){logger['error'](_0x1b5e('0x39'),_0x3da6e0);});}});}}function endRouting(_0x47bbcf,_0xab588f,_0x47cecf,_0x315e22){if(_0x47bbcf&&_0xab588f){_0xab588f[_0x1b5e('0x24')]-=0x1;var _0x293172={'leaveAt':moment()[_0x1b5e('0x15')](_0x1b5e('0x34')),'exitAt':moment()[_0x1b5e('0x15')](_0x1b5e('0x34')),'reason':_0x1b5e('0x3a')};logger['info'](util['format'](_0x1b5e('0x3b'),_0x47bbcf,_0xab588f[_0x1b5e('0x30')]));emitChannelQueueInteraction(_0x47cecf['channel'],_0xab588f[_0x1b5e('0x30')],_0x47cecf[_0x1b5e('0x25')],_0x47cecf['account']['name'],_0x47cecf[_0x1b5e('0x2c')]['id'],![],_0x315e22);if(rpc[_0x47cecf[_0x1b5e('0x29')]+_0x1b5e('0x31')]){return rpc[_0x47cecf['channel']+_0x1b5e('0x31')][_0x1b5e('0x37')](_0x47bbcf,_0x293172)[_0x1b5e('0x32')](function(_0x15b594){logger[_0x1b5e('0x33')]('update\x20queue\x20report',_0x15b594);});}}}function handleFindQueue(_0x40678f){return function(_0x145d1b){return _0x145d1b['name'][_0x1b5e('0x3c')]()===_0x40678f['toLowerCase']();};}exports[_0x1b5e('0x3d')]=function(_0x3312ca,_0xf3f6d4,_0x5174f8,_0x31fc1f){return function(_0x18e807){try{var _0x313e52={'name':_0xf3f6d4[0x0],'timeout':_0xf3f6d4[0x1]};var _0x2f01b9=queue[_0x1b5e('0x0')](_0x313e52,{'typecast':!![]});if(_0x2f01b9[_0x1b5e('0x3e')]){logger[_0x1b5e('0x33')](_0x1b5e('0x3f'),_0x3312ca,_[_0x1b5e('0x40')](_0x2f01b9,_0x1b5e('0x2c'))[_0x1b5e('0x41')](',\x20'));_0x18e807[_0x1b5e('0x42')]();}else{var _0x2781ce=_['find'](_0x5174f8[_0x31fc1f[_0x1b5e('0x29')]+_0x1b5e('0x43')],handleFindQueue(_0x313e52['name']));if(_0x2781ce){startRouting(_0x3312ca,_0x2781ce,_0x31fc1f,_0x5174f8);var _0x2500f7=(_0x2781ce[_0x1b5e('0x3a')]||0xa)*0x3e8;var _0x37c812=(_0x313e52['timeout']||0x14)*0x3e8;var _0x181b45;if(_0x2500f7>_0x37c812){_0x37c812=_0x2500f7;}var _0x3325f2=seqqueue[_0x1b5e('0x44')](_0x2500f7);_0x3325f2['id']=_0x3312ca;_0x3325f2[_0x1b5e('0x45')]=_0x2500f7;_0x3325f2[_0x1b5e('0x46')]=_0x37c812;_0x3325f2[_0x1b5e('0x29')]=_0x31fc1f[_0x1b5e('0x29')];_0x5174f8[_0x1b5e('0x47')][_0x3312ca]['on'](_0x1b5e('0x48'),function(){logger['info'](_0x1b5e('0x49'),_0x3312ca);stopRouting(_0x3312ca,_0x2781ce,_0x31fc1f,_0x5174f8);clearTimeout(_0x181b45);_0x181b45=undefined;_0x3325f2[_0x1b5e('0x4a')](!![]);if(_0x5174f8[_0x1b5e('0x47')][_0x3312ca]){delete _0x5174f8[_0x1b5e('0x47')][_0x3312ca];}_0x18e807[_0x1b5e('0x42')]();});_0x5174f8['rules'][_0x3312ca]['on']('complete',function(){if(_0x5174f8[_0x1b5e('0x47')][_0x3312ca]){delete _0x5174f8[_0x1b5e('0x47')][_0x3312ca];}});_0x181b45=setTimeout(function(){logger[_0x1b5e('0x2f')](_0x1b5e('0x4b'),_0x3312ca);endRouting(_0x3312ca,_0x2781ce,_0x31fc1f,_0x5174f8);clearTimeout(_0x181b45);_0x3325f2[_0x1b5e('0x4a')](!![]);_0x18e807[_0x1b5e('0x4c')]();},_0x37c812);switch(_0x2781ce['strategy']){case'rrmemory':strategy[_0x1b5e('0x4d')](_0x3325f2,_0x2781ce,_0x5174f8,_0x31fc1f);break;default:strategy[_0x1b5e('0x4e')](_0x3325f2,_0x2781ce,_0x5174f8,_0x31fc1f);}}else{logger[_0x1b5e('0x33')](_0x1b5e('0x4f'),_0x3312ca,_0x313e52[_0x1b5e('0x30')]);_0x18e807[_0x1b5e('0x42')]();}}}catch(_0x505cf2){logger[_0x1b5e('0x33')](_0x1b5e('0x3f'),_0x3312ca,_0x505cf2[_0x1b5e('0x50')]);_0x18e807[_0x1b5e('0x42')]();}};}; \ 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 c72024b..f6df595 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 _0xb66c=['TIMEOUT','lodash','./util','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','agents','busyQueue','saveWaitingNotification','channel','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','writeLog','STOP'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb66c,0x175));var _0xcb66=function(_0x12c01b,_0x4a8c23){_0x12c01b=_0x12c01b-0x0;var _0x1d0bce=_0xb66c[_0x12c01b];return _0x1d0bce;};'use strict';var _=require(_0xcb66('0x0'));var uuid=require('uuid');var util=require(_0xcb66('0x1'));var logger=require('../../../../../config/logger')(_0xcb66('0x2'));var Agent=function(_0x24ea13,_0xf7ccc5,_0x5f487c,_0x35d439){this[_0xcb66('0x3')]=uuid['v4']();this[_0xcb66('0x4')]=_0x24ea13;this[_0xcb66('0x5')]=_0xf7ccc5;this['realtime']=_0x5f487c;this['routing']=_0x35d439;this[_0xcb66('0x4')][_0xcb66('0x6')](this[_0xcb66('0x7')][_0xcb66('0x8')](this),this[_0xcb66('0x9')]['bind'](this));this[_0xcb66('0x4')]['on'](_0xcb66('0xa'),this[_0xcb66('0x9')][_0xcb66('0x8')](this));this[_0xcb66('0x4')]['on']('drained',this[_0xcb66('0xb')][_0xcb66('0x8')](this));};Agent[_0xcb66('0xc')][_0xcb66('0x6')]=function(){this['squeue'][_0xcb66('0x6')](this[_0xcb66('0x7')][_0xcb66('0x8')](this),this[_0xcb66('0x9')]['bind'](this));};Agent[_0xcb66('0xc')][_0xcb66('0xb')]=function(){this[_0xcb66('0x9')](!![]);};Agent[_0xcb66('0xc')]['handleRun']=function(){logger[_0xcb66('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xcb66('0x4')]['id'],this['agent']['id']);if(_[_0xcb66('0xe')](this['realtime']['agents'][this[_0xcb66('0x5')]['id']])){logger[_0xcb66('0xd')](_0xcb66('0xf'),this[_0xcb66('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}else{if(this[_0xcb66('0x2')]['forcedOwnership']||util[_0xcb66('0x10')](this['squeue']['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],this[_0xcb66('0x4')]['channel'],![])){this['realtime']['agents'][this[_0xcb66('0x5')]['id']]['busy']=!![];this['realtime'][_0xcb66('0x12')][this['agent']['id']][_0xcb66('0x13')]=undefined;util[_0xcb66('0x14')](this[_0xcb66('0x11')],this[_0xcb66('0x2')],this[_0xcb66('0x5')],this[_0xcb66('0x4')][_0xcb66('0x15')]);util['showNotification'](this[_0xcb66('0x3')],this['squeue']['id'],this['realtime'][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],null,this[_0xcb66('0x2')]);util['writeLog'](this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],'RINGING'+(this[_0xcb66('0x2')][_0xcb66('0x16')]?_0xcb66('0x17'):''));}else{logger[_0xcb66('0xd')](_0xcb66('0x18'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}}};Agent[_0xcb66('0xc')]['handleTimeout']=function(_0x2152dc){if(_['isNil'](this['realtime']['agents'][this[_0xcb66('0x5')]['id']])){return logger['debug'](_0xcb66('0xf'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);}else{logger['debug'](_0xcb66('0x19'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);util[_0xcb66('0x1a')](this[_0xcb66('0x3')],this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],null,this[_0xcb66('0x2')]);this['realtime'][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']][_0xcb66('0x1b')]=![];this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']][_0xcb66('0x13')]=undefined;util['removeWaitingNotification'](this[_0xcb66('0x11')],this[_0xcb66('0x2')],this[_0xcb66('0x5')],this[_0xcb66('0x4')]['channel']);util[_0xcb66('0x1c')](this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],_0x2152dc?_0xcb66('0x1d'):_0xcb66('0x1e'));}if(!_0x2152dc){setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}};function agent(_0x299156,_0x3dc592,_0x17b087,_0x4ef8ba){return new Agent(_0x299156,_0x3dc592,_0x17b087,_0x4ef8ba);}module['exports']=agent; \ No newline at end of file +var _0xf006=['realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','channel','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','STOP','TIMEOUT','./util','../../../../../config/logger','squeue','agent'];(function(_0x4c4be2,_0x11027c){var _0x5eea8d=function(_0x5ec046){while(--_0x5ec046){_0x4c4be2['push'](_0x4c4be2['shift']());}};_0x5eea8d(++_0x11027c);}(_0xf006,0x146));var _0x6f00=function(_0x55e9bf,_0x4456cc){_0x55e9bf=_0x55e9bf-0x0;var _0x576914=_0xf006[_0x55e9bf];return _0x576914;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x6f00('0x0'));var logger=require(_0x6f00('0x1'))('routing');var Agent=function(_0xbab575,_0x4e9dbc,_0x1c7a9e,_0x4f4466){this['notificationId']=uuid['v4']();this[_0x6f00('0x2')]=_0xbab575;this[_0x6f00('0x3')]=_0x4e9dbc;this[_0x6f00('0x4')]=_0x1c7a9e;this['routing']=_0x4f4466;this[_0x6f00('0x2')]['push'](this[_0x6f00('0x5')][_0x6f00('0x6')](this),this[_0x6f00('0x7')][_0x6f00('0x6')](this));this[_0x6f00('0x2')]['on'](_0x6f00('0x8'),this[_0x6f00('0x7')][_0x6f00('0x6')](this));this[_0x6f00('0x2')]['on'](_0x6f00('0x9'),this[_0x6f00('0xa')][_0x6f00('0x6')](this));};Agent[_0x6f00('0xb')]['push']=function(){this[_0x6f00('0x2')][_0x6f00('0xc')](this[_0x6f00('0x5')][_0x6f00('0x6')](this),this[_0x6f00('0x7')]['bind'](this));};Agent[_0x6f00('0xb')]['handleDrained']=function(){this[_0x6f00('0x7')](!![]);};Agent['prototype'][_0x6f00('0x5')]=function(){logger[_0x6f00('0xd')](_0x6f00('0xe'),this[_0x6f00('0x2')]['id'],this[_0x6f00('0x3')]['id']);if(_[_0x6f00('0xf')](this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']])){logger['debug'](_0x6f00('0x11'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}else{if(this[_0x6f00('0x12')][_0x6f00('0x13')]||util[_0x6f00('0x14')](this[_0x6f00('0x2')]['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],this[_0x6f00('0x2')][_0x6f00('0x15')],![])){this[_0x6f00('0x4')]['agents'][this['agent']['id']]['busy']=!![];this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']]['busyQueue']=undefined;util[_0x6f00('0x16')](this[_0x6f00('0x4')],this[_0x6f00('0x12')],this[_0x6f00('0x3')],this[_0x6f00('0x2')][_0x6f00('0x15')]);util[_0x6f00('0x17')](this[_0x6f00('0x18')],this['squeue']['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],null,this['routing']);util[_0x6f00('0x19')](this['squeue']['id'],this[_0x6f00('0x4')]['agents'][this[_0x6f00('0x3')]['id']],_0x6f00('0x1a')+(this[_0x6f00('0x12')][_0x6f00('0x13')]?_0x6f00('0x1b'):''));}else{logger['debug'](_0x6f00('0x1c'),this[_0x6f00('0x2')]['id'],this[_0x6f00('0x3')]['id']);setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}}};Agent[_0x6f00('0xb')][_0x6f00('0x7')]=function(_0x451849){if(_[_0x6f00('0xf')](this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']])){return logger[_0x6f00('0xd')](_0x6f00('0x11'),this['squeue']['id'],this['agent']['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x6f00('0x1d')](this['notificationId'],this[_0x6f00('0x2')]['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],null,this[_0x6f00('0x12')]);this[_0x6f00('0x4')]['agents'][this[_0x6f00('0x3')]['id']][_0x6f00('0x1e')]=![];this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']]['busyQueue']=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x6f00('0x12')],this[_0x6f00('0x3')],this[_0x6f00('0x2')][_0x6f00('0x15')]);util[_0x6f00('0x19')](this['squeue']['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],_0x451849?_0x6f00('0x1f'):_0x6f00('0x20'));}if(!_0x451849){setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}};function agent(_0x52936d,_0x28e436,_0x1dee52,_0x4ba56d){return new Agent(_0x52936d,_0x28e436,_0x1dee52,_0x4ba56d);}module['exports']=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 fd28c5a..afb548a 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 _0x577f=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','[%s][QUEUE]\x20EMPTY','notificationId','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','squeue','queue','realtime','routing','handleRun','bind','handleTimeout','handleDrained','prototype','push','isNil','Agents','length','agents','debug'];(function(_0x1f9f83,_0x2fc8f2){var _0x250314=function(_0x25ac67){while(--_0x25ac67){_0x1f9f83['push'](_0x1f9f83['shift']());}};_0x250314(++_0x2fc8f2);}(_0x577f,0x1bf));var _0xf577=function(_0x103dcb,_0x5aa6b3){_0x103dcb=_0x103dcb-0x0;var _0x173cce=_0x577f[_0x103dcb];return _0x173cce;};'use strict';var _=require(_0xf577('0x0'));var uuid=require('uuid');var util=require(_0xf577('0x1'));var logger=require(_0xf577('0x2'))('routing');var Beepall=function(_0x522eb6,_0x4543f1,_0xa134a3,_0x1889f0){this['notificationId']=uuid['v4']();this[_0xf577('0x3')]=_0x522eb6;this[_0xf577('0x4')]=_0x4543f1;this[_0xf577('0x5')]=_0xa134a3;this[_0xf577('0x6')]=_0x1889f0;this[_0xf577('0x3')]['push'](this[_0xf577('0x7')][_0xf577('0x8')](this),this[_0xf577('0x9')][_0xf577('0x8')](this));this[_0xf577('0x3')]['on']('timeout',this[_0xf577('0x9')][_0xf577('0x8')](this));this[_0xf577('0x3')]['on']('drained',this[_0xf577('0xa')]['bind'](this));};Beepall[_0xf577('0xb')][_0xf577('0xc')]=function(){this[_0xf577('0x3')][_0xf577('0xc')](this['handleRun'][_0xf577('0x8')](this),this[_0xf577('0x9')]['bind'](this));};Beepall[_0xf577('0xb')]['handleDrained']=function(){this[_0xf577('0x9')](!![]);};Beepall['prototype'][_0xf577('0x7')]=function(){var _0x116546=!![];if(!_[_0xf577('0xd')](this['queue'])&&!_[_0xf577('0xd')](this[_0xf577('0x4')][_0xf577('0xe')])&&this['queue'][_0xf577('0xe')][_0xf577('0xf')]>0x0){for(var _0x293154=0x0,_0x1a5eb6;_0x2931540x0){for(var _0x3405de=0x0,_0x3ef769;_0x3405de0x0&&_0x2f0c96[_0x15836e+_0x0e5e('0x24')]>=_0x2f0c96[_0x15836e+_0x0e5e('0x22')]){writeLog(_0x56daf9,_0x2f0c96,_0x15836e[_0x0e5e('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x0e5e('0x26')]=function(_0x34dbf5,_0x5e5349,_0x848d2d,_0x2b4b98,_0x2f7f52){return sendNotification(!![],_0x34dbf5,_0x5e5349,_0x848d2d,_0x2b4b98,_0x2f7f52);};exports['hideNotification']=function(_0x1b75f4,_0x27d8ba,_0xd620d6,_0x106dc3,_0x49a401){return sendNotification(![],_0x1b75f4,_0x27d8ba,_0xd620d6,_0x106dc3,_0x49a401);};exports['checkWaitingNotifications']=function(_0x2803c3,_0x5b5f53,_0x29c57d){var _0x364309=_0x5b5f53['interaction'][_0x0e5e('0x27')];if(!_0x364309&&_0x29c57d){_0x364309=_0x29c57d['id'];}var _0x38e4bc=_['some'](_0x2803c3[_0x5b5f53[_0x0e5e('0x28')]+'QueuesWaitingInteractions'],function(_0x27cf6e){var _0x218daf=_[_0x0e5e('0x29')](_0x5b5f53[_0x0e5e('0x28')])+_0x0e5e('0x2a');return _0x27cf6e[_0x218daf]===_0x5b5f53[_0x0e5e('0x2b')]['id'];});if(!_0x38e4bc&&_0x364309&&_0x2803c3['agents'][_0x364309]){_0x38e4bc=_[_0x0e5e('0x2c')](_0x2803c3['agents'][_0x364309][_0x5b5f53['channel']+'WaitingInteractions'],function(_0x2a14e7){return _0x2a14e7['id']===_0x5b5f53[_0x0e5e('0x2b')]['id'];});}return _0x38e4bc;};exports[_0x0e5e('0x2d')]=function(_0x1f6935,_0x1cde0e,_0x429e1c,_0x2fcbae){if(_0x429e1c&&_0x429e1c['id']&&_0x1f6935[_0x0e5e('0x2e')]&&_0x1f6935[_0x0e5e('0x2e')][_0x429e1c['id']]){_0x1f6935[_0x0e5e('0x2e')][_0x429e1c['id']][_0x2fcbae+_0x0e5e('0x2f')][_0x1cde0e[_0x0e5e('0x30')]['id']]={'id':_0x1cde0e[_0x0e5e('0x2b')]['id']};}};exports[_0x0e5e('0x31')]=function(_0x4562a5,_0x1f9876,_0x56736f,_0x40ed25){if(_0x56736f&&_0x56736f['id']&&_0x4562a5[_0x0e5e('0x2e')]&&_0x4562a5[_0x0e5e('0x2e')][_0x56736f['id']]){delete _0x4562a5[_0x0e5e('0x2e')][_0x56736f['id']][_0x40ed25+_0x0e5e('0x2f')][_0x1f9876[_0x0e5e('0x30')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0xae24=['socket.io-emitter','redis','name','emit','split','account','notificationSound','notificationShake','body','queue','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','removeWaitingNotification','writeLog','lodash','../utils','../../../../../config/environment','../../../../../config/logger','defaults','localhost'];(function(_0x9cd331,_0x3a6874){var _0x5cbd70=function(_0x6c8854){while(--_0x6c8854){_0x9cd331['push'](_0x9cd331['shift']());}};_0x5cbd70(++_0x3a6874);}(_0xae24,0x182));var _0x4ae2=function(_0x27d1fc,_0x30a58b){_0x27d1fc=_0x27d1fc-0x0;var _0x1e442e=_0xae24[_0x27d1fc];return _0x1e442e;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var utils=require(_0x4ae2('0x1'));var Redis=require('ioredis');var config=require(_0x4ae2('0x2'));var logger=require(_0x4ae2('0x3'))('routing');config['redis']=_[_0x4ae2('0x4')](config['redis'],{'host':_0x4ae2('0x5'),'port':0x18eb});var io=require(_0x4ae2('0x6'))(new Redis(config[_0x4ae2('0x7')]));function sendNotification(_0x3e6055,_0x428054,_0x307247,_0x4f2e84,_0x5f589a,_0x41cdf1){io['to'](util['format']('user:%s',_0x4f2e84[_0x4ae2('0x8')]))[_0x4ae2('0x9')]('user:save',_0x4f2e84);var _0x3b3acc=_0x41cdf1||{};var _0x449e1a=_0x307247[_0x4ae2('0xa')]('.');var _0xb70265={'uniqueid':_0x428054,'channel':_0x449e1a[0x0],'id':_0x449e1a[0x1],'title':_0x449e1a[0x0]+'\x20interaction','interactionId':_0x449e1a[0x2],'queue':_0x5f589a?_0x5f589a[_0x4ae2('0x8')]:null,'sound':_0x3b3acc[_0x4ae2('0xb')][_0x4ae2('0xc')],'shake':_0x3b3acc['account'][_0x4ae2('0xd')]};try{if(!_0x3b3acc[_0x4ae2('0xe')]){_0x3b3acc[_0x4ae2('0xe')]={};}if(_0x5f589a){_0x3b3acc[_0x4ae2('0xe')][_0x4ae2('0xf')]=_0x5f589a;}else if(_0x3b3acc[_0x4ae2('0xe')][_0x4ae2('0xf')]){delete _0x3b3acc[_0x4ae2('0xe')][_0x4ae2('0xf')];}_0xb70265['msg']=utils['getMustacheRender'](_0x3b3acc['account'][_0x4ae2('0x10')],_0x3b3acc);}catch(_0xf834a1){_0xb70265['msg']=_0x4ae2('0x11');logger[_0x4ae2('0x12')](util[_0x4ae2('0x13')](_0x4ae2('0x14'),_0x428054,_0xf834a1[_0x4ae2('0x15')]));}io['to'](util[_0x4ae2('0x13')](_0x4ae2('0x16'),_0x4f2e84[_0x4ae2('0x8')]))[_0x4ae2('0x9')](util[_0x4ae2('0x13')]('notification:%s',_0x3e6055?'save':_0x4ae2('0x17')),_0xb70265);}function writeLog(_0x2d910c,_0x51e20c,_0x45c1bf){return logger[_0x4ae2('0x18')](util[_0x4ae2('0x13')](_0x4ae2('0x19'),_0x2d910c,_0x51e20c[_0x4ae2('0x8')],_0x45c1bf));}exports['isAgentAvailable']=function(_0x2bf5fe,_0x53c686,_0x522165,_0x2ceec4){if(_0x53c686[_0x4ae2('0x1a')]){writeLog(_0x2bf5fe,_0x53c686,_0x4ae2('0x1b'));return![];}if(!_0x53c686[_0x4ae2('0x1c')]){writeLog(_0x2bf5fe,_0x53c686,_0x4ae2('0x1d'));return![];}if(_0x53c686[_0x522165+'Pause']){writeLog(_0x2bf5fe,_0x53c686,_0x4ae2('0x1e'));return![];}if(_0x2ceec4&&_0x53c686['hasOwnProperty'](_0x522165+_0x4ae2('0x1f'))&&_0x53c686[_0x4ae2('0x20')](_0x522165+_0x4ae2('0x21'))){if(_0x53c686[_0x522165+'Capacity']>0x0&&_0x53c686[_0x522165+_0x4ae2('0x21')]>=_0x53c686[_0x522165+_0x4ae2('0x1f')]){writeLog(_0x2bf5fe,_0x53c686,_0x522165[_0x4ae2('0x22')]()+_0x4ae2('0x23'));return![];}}return!![];};exports[_0x4ae2('0x24')]=function(_0x255772,_0x5b2e65,_0x5962b0,_0x9508d7,_0x3030f8){return sendNotification(!![],_0x255772,_0x5b2e65,_0x5962b0,_0x9508d7,_0x3030f8);};exports[_0x4ae2('0x25')]=function(_0x329588,_0x3a9b96,_0x20ef44,_0x57a377,_0x5ec1fd){return sendNotification(![],_0x329588,_0x3a9b96,_0x20ef44,_0x57a377,_0x5ec1fd);};exports[_0x4ae2('0x26')]=function(_0x4e7741,_0x554cff,_0x5e9f03){var _0x1e2b2d=_0x554cff[_0x4ae2('0x27')]['UserId'];if(!_0x1e2b2d&&_0x5e9f03){_0x1e2b2d=_0x5e9f03['id'];}var _0x883fd5=_[_0x4ae2('0x28')](_0x4e7741[_0x554cff[_0x4ae2('0x29')]+_0x4ae2('0x2a')],function(_0x14fdb3){var _0x23f954=_[_0x4ae2('0x2b')](_0x554cff[_0x4ae2('0x29')])+_0x4ae2('0x2c');return _0x14fdb3[_0x23f954]===_0x554cff[_0x4ae2('0x27')]['id'];});if(!_0x883fd5&&_0x1e2b2d&&_0x4e7741[_0x4ae2('0x2d')][_0x1e2b2d]){_0x883fd5=_[_0x4ae2('0x28')](_0x4e7741[_0x4ae2('0x2d')][_0x1e2b2d][_0x554cff[_0x4ae2('0x29')]+_0x4ae2('0x2e')],function(_0x31017c){return _0x31017c['id']===_0x554cff[_0x4ae2('0x27')]['id'];});}return _0x883fd5;};exports['saveWaitingNotification']=function(_0xdcd11e,_0x516e8c,_0x3479a1,_0x233e02){if(_0x3479a1&&_0x3479a1['id']&&_0xdcd11e['agents']&&_0xdcd11e[_0x4ae2('0x2d')][_0x3479a1['id']]){_0xdcd11e[_0x4ae2('0x2d')][_0x3479a1['id']][_0x233e02+_0x4ae2('0x2e')][_0x516e8c[_0x4ae2('0x15')]['id']]={'id':_0x516e8c['interaction']['id']};}};exports[_0x4ae2('0x2f')]=function(_0x269a91,_0x29458e,_0x32cd5e,_0x3ea0fb){if(_0x32cd5e&&_0x32cd5e['id']&&_0x269a91[_0x4ae2('0x2d')]&&_0x269a91[_0x4ae2('0x2d')][_0x32cd5e['id']]){delete _0x269a91[_0x4ae2('0x2d')][_0x32cd5e['id']][_0x3ea0fb+_0x4ae2('0x2e')][_0x29458e['message']['id']];}};exports[_0x4ae2('0x30')]=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 062cc88..70d3a48 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 _0x27c9=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x1721f7,_0x2f5f07){var _0x5b1192=function(_0x311cec){while(--_0x311cec){_0x1721f7['push'](_0x1721f7['shift']());}};_0x5b1192(++_0x2f5f07);}(_0x27c9,0x12e));var _0x927c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x27c9[_0x432682];return _0x463d05;};'use strict';var schema=require(_0x927c('0x0'));var sh=require(_0x927c('0x1'));var _=require('lodash');var utils=require(_0x927c('0x2'));var logger=require(_0x927c('0x3'))(_0x927c('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x927c('0x5')}});exports[_0x927c('0x6')]=function(_0xc97926,_0x19b972){return function(_0x2d826e){try{var _0x4a834f={'command':_0x19b972[0x0]};var _0x37d83c=system[_0x927c('0x0')](_0x4a834f,{'typecast':!![]});if(_0x37d83c[_0x927c('0x7')]){logger[_0x927c('0x8')](_0x927c('0x9'),_0xc97926,_[_0x927c('0xa')](_0x37d83c,'message')[_0x927c('0xb')](',\x20'));logger[_0x927c('0xc')](_0x927c('0xd'),_0xc97926);_0x2d826e[_0x927c('0xe')]();}else{var _0x5b1edc=this;var _0x103c46=utils[_0x927c('0xf')](_0x19b972[0x0],this);logger['info'](_0x927c('0x10'),_0xc97926,_0x103c46);sh[_0x927c('0x11')](_[_0x927c('0x12')](_0x103c46),function(_0x2cd898,_0x3e1379){logger[_0x927c('0xc')](_0x927c('0x13'),_0xc97926,_0x2cd898);if(_0x2cd898==0x0){var _0xe2036a=_0x3e1379['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x19b972[0x1])||_[_0x927c('0x14')](_0x19b972[0x1])){logger['info'](_0x927c('0x15'),_0xc97926);_0x5b1edc[_0x927c('0x16')][_0x19b972[0x1]]=_0xe2036a;}else{logger[_0x927c('0xc')](_0x927c('0x17'),_0xc97926,_0x19b972[0x1],_0xe2036a);_0x5b1edc['body'][_0x19b972[0x1]]=_0xe2036a;}}_0x2d826e[_0x927c('0xe')]();});}}catch(_0x542bb1){logger[_0x927c('0x8')](_0x927c('0x9'),_0xc97926,_[_0x927c('0x18')](_0x542bb1)?JSON['stringify'](_0x542bb1):_0x542bb1);logger[_0x927c('0xc')](_0x927c('0xd'),_0xc97926);_0x2d826e['next']();}};}; \ No newline at end of file +var _0xab9e=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','../../../../config/logger','string','length','error','[%s][SYSTEM]\x20%s','map','message','info'];(function(_0xabe64d,_0x2618da){var _0x59af04=function(_0x8e7866){while(--_0x8e7866){_0xabe64d['push'](_0xabe64d['shift']());}};_0x59af04(++_0x2618da);}(_0xab9e,0x6e));var _0xeab9=function(_0x1a6fdd,_0xebbd98){_0x1a6fdd=_0x1a6fdd-0x0;var _0x2b49bd=_0xab9e[_0x1a6fdd];return _0x2b49bd;};'use strict';var schema=require(_0xeab9('0x0'));var sh=require(_0xeab9('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xeab9('0x2'))('routing');var system=schema({'command':{'type':_0xeab9('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x2d587e,_0x44d431){return function(_0x3657e2){try{var _0x4857b0={'command':_0x44d431[0x0]};var _0x54944a=system['validate'](_0x4857b0,{'typecast':!![]});if(_0x54944a[_0xeab9('0x4')]){logger[_0xeab9('0x5')](_0xeab9('0x6'),_0x2d587e,_[_0xeab9('0x7')](_0x54944a,_0xeab9('0x8'))['join'](',\x20'));logger[_0xeab9('0x9')](_0xeab9('0xa'),_0x2d587e);_0x3657e2[_0xeab9('0xb')]();}else{var _0x24e89b=this;var _0x593272=utils['getMustacheRender'](_0x44d431[0x0],this);logger[_0xeab9('0x9')](_0xeab9('0xc'),_0x2d587e,_0x593272);sh[_0xeab9('0xd')](_[_0xeab9('0xe')](_0x593272),function(_0x41bde8,_0x1ed5d5){logger[_0xeab9('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2d587e,_0x41bde8);if(_0x41bde8==0x0){var _0x26cc65=_0x1ed5d5[_0xeab9('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0xeab9('0x10')](_0x44d431[0x1])||_['isEmpty'](_0x44d431[0x1])){logger[_0xeab9('0x9')]('[%s][SYSTEM]\x20no\x20variable',_0x2d587e);_0x24e89b[_0xeab9('0x11')][_0x44d431[0x1]]=_0x26cc65;}else{logger[_0xeab9('0x9')](_0xeab9('0x12'),_0x2d587e,_0x44d431[0x1],_0x26cc65);_0x24e89b[_0xeab9('0x11')][_0x44d431[0x1]]=_0x26cc65;}}_0x3657e2['next']();});}}catch(_0x42faf3){logger['error']('[%s][SYSTEM]\x20%s',_0x2d587e,_[_0xeab9('0x13')](_0x42faf3)?JSON['stringify'](_0x42faf3):_0x42faf3);logger[_0xeab9('0x9')](_0xeab9('0xa'),_0x2d587e);_0x3657e2[_0xeab9('0xb')]();}};}; \ 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 3c66ca3..e4e6c23 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 _0xdfaa=['channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20%s','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction'];(function(_0x45f1a0,_0x2a9516){var _0x57503d=function(_0x4330ee){while(--_0x4330ee){_0x45f1a0['push'](_0x45f1a0['shift']());}};_0x57503d(++_0x2a9516);}(_0xdfaa,0x9f));var _0xadfa=function(_0x41ef54,_0x4f7dfe){_0x41ef54=_0x41ef54-0x0;var _0xc8bb62=_0xdfaa[_0x41ef54];return _0xc8bb62;};'use strict';var schema=require('validate');var _=require(_0xadfa('0x0'));var rpc={'chatInteraction':require(_0xadfa('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xadfa('0x2')),'faxInteraction':require(_0xadfa('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xadfa('0x4'))(_0xadfa('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xadfa('0x6')}});exports[_0xadfa('0x7')]=function(_0x2b6efe,_0x396351,_0x4761ee,_0xecfa37){return function(_0x4b1860){try{var _0x43dc43={'tag':_0x396351[0x0]};var _0x55a00f=tag[_0xadfa('0x8')](_0x43dc43,{'typecast':!![]});if(_0x55a00f[_0xadfa('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x2b6efe,_['map'](_0x55a00f,_0xadfa('0xa'))[_0xadfa('0xb')](',\x20'));logger[_0xadfa('0xc')](_0xadfa('0xd'),_0x2b6efe);_0x4b1860[_0xadfa('0xe')]();}else{var _0x583327={'ids':[_0x396351[0x0]]};if(rpc[_0xecfa37['channel']+_0xadfa('0xf')]){rpc[_0xecfa37[_0xadfa('0x10')]+'Interaction']['addTags'](_0xecfa37[_0xadfa('0x11')]['id'],_0x583327)[_0xadfa('0x12')](function(_0x418c27){logger[_0xadfa('0xc')](_0xadfa('0x13'),_0x2b6efe,_0x396351[0x1],_0xecfa37[_0xadfa('0x10')],_0xecfa37['interaction']['id']);})[_0xadfa('0x14')](function(_0x122261){logger[_0xadfa('0x15')](_0xadfa('0x16'),_0x2b6efe,JSON[_0xadfa('0x17')](_0x122261));logger[_0xadfa('0xc')](_0xadfa('0xd'),_0x2b6efe);})['finally'](function(){_0x4b1860[_0xadfa('0xe')]();});}}}catch(_0x40a3f4){logger[_0xadfa('0x15')](_0xadfa('0x16'),_0x2b6efe,_[_0xadfa('0x18')](_0x40a3f4)?JSON[_0xadfa('0x17')](_0x40a3f4):_0x40a3f4);logger[_0xadfa('0xc')](_0xadfa('0xd'),_0x2b6efe);_0x4b1860[_0xadfa('0xe')]();}};}; \ No newline at end of file +var _0x9ce7=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','routing','number'];(function(_0x3eb13b,_0x50ce9b){var _0xa906ba=function(_0x150d57){while(--_0x150d57){_0x3eb13b['push'](_0x3eb13b['shift']());}};_0xa906ba(++_0x50ce9b);}(_0x9ce7,0x1b8));var _0x79ce=function(_0x3e449b,_0x3c213d){_0x3e449b=_0x3e449b-0x0;var _0x572975=_0x9ce7[_0x3e449b];return _0x572975;};'use strict';var schema=require('validate');var _=require(_0x79ce('0x0'));var rpc={'chatInteraction':require(_0x79ce('0x1')),'openchannelInteraction':require(_0x79ce('0x2')),'smsInteraction':require(_0x79ce('0x3')),'mailInteraction':require(_0x79ce('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x79ce('0x5'))};var logger=require('../../../../config/logger')(_0x79ce('0x6'));var tag=schema({'tag':{'type':_0x79ce('0x7'),'required':!![],'message':_0x79ce('0x8')}});exports['consequence']=function(_0x77d21f,_0x20fd1d,_0x3034ce,_0x38130d){return function(_0x162483){try{var _0x58ed8b={'tag':_0x20fd1d[0x0]};var _0x473f08=tag[_0x79ce('0x9')](_0x58ed8b,{'typecast':!![]});if(_0x473f08[_0x79ce('0xa')]){logger['error'](_0x79ce('0xb'),_0x77d21f,_[_0x79ce('0xc')](_0x473f08,_0x79ce('0xd'))[_0x79ce('0xe')](',\x20'));logger[_0x79ce('0xf')](_0x79ce('0x10'),_0x77d21f);_0x162483[_0x79ce('0x11')]();}else{var _0x24ec87={'ids':[_0x20fd1d[0x0]]};if(rpc[_0x38130d[_0x79ce('0x12')]+'Interaction']){rpc[_0x38130d[_0x79ce('0x12')]+_0x79ce('0x13')][_0x79ce('0x14')](_0x38130d[_0x79ce('0x15')]['id'],_0x24ec87)[_0x79ce('0x16')](function(_0xd9895d){logger['info'](_0x79ce('0x17'),_0x77d21f,_0x20fd1d[0x1],_0x38130d[_0x79ce('0x12')],_0x38130d[_0x79ce('0x15')]['id']);})['catch'](function(_0x4282c6){logger[_0x79ce('0x18')]('[%s][TAG]\x20%s',_0x77d21f,JSON[_0x79ce('0x19')](_0x4282c6));logger[_0x79ce('0xf')](_0x79ce('0x10'),_0x77d21f);})[_0x79ce('0x1a')](function(){_0x162483[_0x79ce('0x11')]();});}}}catch(_0x394b93){logger[_0x79ce('0x18')](_0x79ce('0xb'),_0x77d21f,_[_0x79ce('0x1b')](_0x394b93)?JSON[_0x79ce('0x19')](_0x394b93):_0x394b93);logger[_0x79ce('0xf')](_0x79ce('0x10'),_0x77d21f);_0x162483[_0x79ce('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 daa23a4..2cfa608 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 _0xf8ac=['urlOnRing','?params=','jsonrpc','method','params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','info','stop','catch','error','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','consequence','replace','includes','push','urlOnAnswer'];(function(_0x416088,_0x20daff){var _0x4babe8=function(_0x156863){while(--_0x156863){_0x416088['push'](_0x416088['shift']());}};_0x4babe8(++_0x20daff);}(_0xf8ac,0xb6));var _0xcf8a=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xf8ac[_0x5f4cd7];return _0x47c93f;};'use strict';var rp=require('request-promise');var logger=require(_0xcf8a('0x0'))(_0xcf8a('0x1'));var _=require('lodash');var arr=[];exports[_0xcf8a('0x2')]=function(_0x5ee7eb,_0x28f022){return function(_0x145547){var _0x59b4d3=_0x28f022[0xa];var _0x5590d7=_0x28f022[0xb];var _0x419af3=_0x28f022[0xc];var _0x539615=_0x28f022[0xd];var _0x514e6c=_0x28f022[0xe];var _0xe7cedc=_0x28f022[0xf][_0xcf8a('0x3')](/\n/g,'\x20-\x20');var _0x2d9057=_0x28f022[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xcf8a('0x4')](_0x5590d7)){arr[_0xcf8a('0x5')](_0x5590d7);var _0x338e9f=_0x28f022[0x3];var _0x545bd0=_0x28f022[0x4];var _0x3bd5af=_0x28f022[0x1];var _0x238332=_0x28f022[0x0];var _0x16ee7f={};_0x16ee7f[_0xcf8a('0x6')]=_0x28f022[0x8]+'?params='+_0x419af3+'|'+_0x59b4d3+'|'+_0x539615+'|'+_0x5590d7+'|'+_0x514e6c;_0x16ee7f[_0xcf8a('0x7')]=_0x28f022[0x7]+_0xcf8a('0x8')+_0x419af3+'|'+_0x59b4d3+'|'+_0x539615+'|'+_0x5590d7+'|'+_0x514e6c+'|'+_0xe7cedc+'|'+_0x2d9057;_0x16ee7f['title']=_0x28f022[0x9];var _0x29a3f4={};_0x29a3f4[_0xcf8a('0x9')]='2.0';_0x29a3f4[_0xcf8a('0xa')]='login';var _0x47eabb=[];_0x47eabb[_0xcf8a('0x5')](_0x28f022[0x2]);_0x47eabb[_0xcf8a('0x5')](_0x28f022[0x5]);_0x47eabb[_0xcf8a('0x5')](_0x28f022[0x6]);_0x29a3f4[_0xcf8a('0xb')]=_0x47eabb;_0x29a3f4['id']=0x1;var _0x4f4e31=JSON[_0xcf8a('0xc')](_0x29a3f4);var _0x53c8aa={'encoding':_0xcf8a('0xd'),'method':'POST','timeout':0x2710,'url':_0x338e9f,'headers':{'Content-Type':'application/json-rpc'},'body':_0x4f4e31};return rp(_0x53c8aa)[_0xcf8a('0xe')](function(_0x37f3c8){const _0x13eb0b=JSON[_0xcf8a('0xf')](_0x37f3c8);if(!_0x13eb0b[_0xcf8a('0x10')][_0xcf8a('0x11')]){throw new Error(_0xcf8a('0x12'));}var _0x3b436f=_0x5590d7;var _0x2be3be=_0xcf8a('0x13')+_0x3bd5af+_0xcf8a('0x14')+_0x238332+'&sessionId='+_0x3b436f+'&data='+JSON[_0xcf8a('0xc')](_0x16ee7f);var _0x187c5c=_0x545bd0+'?'+_0x2be3be;return rp(_0x187c5c);})['then'](function(_0x145819){logger[_0xcf8a('0x15')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x5ee7eb,_0x145819);_0x145547[_0xcf8a('0x16')]();})[_0xcf8a('0x17')](function(_0x44472b){logger[_0xcf8a('0x18')]('[%s][TVOX]\x20%s',_0x5ee7eb,_['isObject'](_0x44472b)?JSON[_0xcf8a('0xc')](_0x44472b):_0x44472b);_0x145547[_0xcf8a('0x16')]();});}else{logger[_0xcf8a('0x15')](_0xcf8a('0x19'),_0x5ee7eb);_0x145547[_0xcf8a('0x1a')]();}};}; \ No newline at end of file +var _0x22eb=['2.0','method','stringify','utf8','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','routing','lodash','consequence','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x22eb,0x12b));var _0xb22e=function(_0x191013,_0x446e0e){_0x191013=_0x191013-0x0;var _0x2631e1=_0x22eb[_0x191013];return _0x2631e1;};'use strict';var rp=require(_0xb22e('0x0'));var logger=require('../../../../config/logger')(_0xb22e('0x1'));var _=require(_0xb22e('0x2'));var arr=[];exports[_0xb22e('0x3')]=function(_0x34eb4b,_0x167cad){return function(_0x166d41){var _0x16acab=_0x167cad[0xa];var _0x564890=_0x167cad[0xb];var _0x2d9195=_0x167cad[0xc];var _0x9a90f9=_0x167cad[0xd];var _0x48ffbb=_0x167cad[0xe];var _0x11a0c2=_0x167cad[0xf]['replace'](/\n/g,_0xb22e('0x4'));var _0x5be37c=_0x167cad[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x564890)){arr[_0xb22e('0x5')](_0x564890);var _0x5f4607=_0x167cad[0x3];var _0x253ef0=_0x167cad[0x4];var _0x48806d=_0x167cad[0x1];var _0x49d606=_0x167cad[0x0];var _0x4a0f9f={};_0x4a0f9f[_0xb22e('0x6')]=_0x167cad[0x8]+_0xb22e('0x7')+_0x2d9195+'|'+_0x16acab+'|'+_0x9a90f9+'|'+_0x564890+'|'+_0x48ffbb;_0x4a0f9f[_0xb22e('0x8')]=_0x167cad[0x7]+'?params='+_0x2d9195+'|'+_0x16acab+'|'+_0x9a90f9+'|'+_0x564890+'|'+_0x48ffbb+'|'+_0x11a0c2+'|'+_0x5be37c;_0x4a0f9f[_0xb22e('0x9')]=_0x167cad[0x9];var _0x2691b6={};_0x2691b6[_0xb22e('0xa')]=_0xb22e('0xb');_0x2691b6[_0xb22e('0xc')]='login';var _0x394e01=[];_0x394e01[_0xb22e('0x5')](_0x167cad[0x2]);_0x394e01['push'](_0x167cad[0x5]);_0x394e01['push'](_0x167cad[0x6]);_0x2691b6['params']=_0x394e01;_0x2691b6['id']=0x1;var _0x34c936=JSON[_0xb22e('0xd')](_0x2691b6);var _0x5eaafe={'encoding':_0xb22e('0xe'),'method':_0xb22e('0xf'),'timeout':0x2710,'url':_0x5f4607,'headers':{'Content-Type':_0xb22e('0x10')},'body':_0x34c936};return rp(_0x5eaafe)[_0xb22e('0x11')](function(_0xbe3580){const _0x45a847=JSON['parse'](_0xbe3580);if(!_0x45a847[_0xb22e('0x12')][_0xb22e('0x13')]){throw new Error(_0xb22e('0x14'));}var _0x227170=_0x564890;var _0x4d4a2a=_0xb22e('0x15')+_0x48806d+_0xb22e('0x16')+_0x49d606+'&sessionId='+_0x227170+'&data='+JSON[_0xb22e('0xd')](_0x4a0f9f);var _0xc0a98c=_0x253ef0+'?'+_0x4d4a2a;return rp(_0xc0a98c);})[_0xb22e('0x11')](function(_0x55258d){logger['info'](_0xb22e('0x17'),_0x34eb4b,_0x55258d);_0x166d41['stop']();})[_0xb22e('0x18')](function(_0x346833){logger[_0xb22e('0x19')](_0xb22e('0x1a'),_0x34eb4b,_[_0xb22e('0x1b')](_0x346833)?JSON[_0xb22e('0xd')](_0x346833):_0x346833);_0x166d41[_0xb22e('0x1c')]();});}else{logger[_0xb22e('0x1d')](_0xb22e('0x1e'),_0x34eb4b);_0x166d41['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 ad42df7..2f64a7e 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(_0x5b4740,_0xaba357){var _0x1e0fd9=function(_0x25fd01){while(--_0x25fd01){_0x5b4740['push'](_0x5b4740['shift']());}};_0x1e0fd9(++_0xaba357);}(_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(_0x513a8e,_0x155c27){var _0x53c044=function(_0x404f69){while(--_0x404f69){_0x513a8e['push'](_0x513a8e['shift']());}};_0x53c044(++_0x155c27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 f0468d0..31d3553 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 _0x0b2c=['IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','appdata','tag','TagId','getMustacheRender','account','notificationTemplate','ContactId','body','condition','./applications/','consequence','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x0b2c,0xb6));var _0xc0b2=function(_0xf8dcb6,_0x1a15cb){_0xf8dcb6=_0xf8dcb6-0x0;var _0x141251=_0x0b2c[_0xf8dcb6];return _0x141251;};'use strict';var _=require(_0xc0b2('0x0'));var util=require('util');var path=require(_0xc0b2('0x1'));var fs=require('fs');var jayson=require(_0xc0b2('0x2'));var BPromise=require(_0xc0b2('0x3'));var utils=require(_0xc0b2('0x4'));var sUtils=require(_0xc0b2('0x5'));var logger=require(_0xc0b2('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xc0b2('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xc0b2('0x8')),'smsQueueReport':require(_0xc0b2('0x9')),'faxQueueReport':require(_0xc0b2('0xa')),'whatsappQueueReport':require(_0xc0b2('0xb'))};var RuleEngine=require(_0xc0b2('0xc'));function getId(_0xb76295,_0x123ceb,_0x3004c4){return util[_0xc0b2('0xd')](_0xc0b2('0xe'),_0xb76295,_0x123ceb||0x0,_0x3004c4||0x0);}function getIntervals(_0x4e0a2f,_0x57b802){var _0x324323=[];if(!_[_0xc0b2('0xf')](_0x57b802[_0xc0b2('0x10')])&&!_[_0xc0b2('0xf')](_0x4e0a2f[_0x57b802['IntervalId']])&&!_[_0xc0b2('0xf')](_0x4e0a2f[_0x57b802[_0xc0b2('0x10')]][_0xc0b2('0x11')])){_0x324323=_[_0xc0b2('0x12')](_0x4e0a2f[_0x57b802[_0xc0b2('0x10')]][_0xc0b2('0x11')],_0xc0b2('0x13'));}else if(!_[_0xc0b2('0xf')](_0x57b802[_0xc0b2('0x13')])){_0x324323=[_0x57b802[_0xc0b2('0x13')]];}return _0x324323;}exports[_0xc0b2('0x14')]=function(_0x440c1f){_0x440c1f['rules']={};return new BPromise(function(_0x1ae155,_0xa3e99b){var _0x3b7a13={'Start':function(_0x38b787){var _0x174326=this;return new Promise(function(_0x2c47bb,_0x70a694){if(_0x38b787){try{var _0x2db55b=[];var _0x5bda9b=getId(_0x38b787[_0xc0b2('0x15')],_0x38b787[_0xc0b2('0x16')]?_0x38b787[_0xc0b2('0x16')]['id']:0x0,_0x38b787[_0xc0b2('0x17')]?_0x38b787[_0xc0b2('0x17')]['id']:0x0);var _0x3630dd=sUtils[_0xc0b2('0x18')](_0x440c1f,_0x38b787);if(!_0x3630dd&&_0x38b787[_0xc0b2('0x19')]&&_[_0xc0b2('0x1a')](_0x38b787[_0xc0b2('0x19')])&&_0x38b787[_0xc0b2('0x19')][_0xc0b2('0x1b')]){for(var _0x5ae500=0x0;_0x5ae500<_0x38b787[_0xc0b2('0x19')][_0xc0b2('0x1b')];_0x5ae500+=0x1){var _0x5a5fba=_0x38b787['applications'][_0x5ae500];if(fs[_0xc0b2('0x1c')](path[_0xc0b2('0x1d')](__dirname,'applications',_0x5a5fba[_0xc0b2('0x1e')]+_0xc0b2('0x1f')))){var _0x4a51d8=[];switch(_0x5a5fba['app'][_0xc0b2('0x20')]()){case _0xc0b2('0x21'):var _0x59f7d7=_0x5a5fba['appdata'][_0xc0b2('0x22')](',');if(_0x38b787[_0xc0b2('0x15')]===_0xc0b2('0x23')){_0x4a51d8[_0xc0b2('0x24')](_0x59f7d7[0x0]);_0x4a51d8[_0xc0b2('0x24')](_0x59f7d7[0x1]);_0x4a51d8[_0xc0b2('0x24')](_0x59f7d7[_0xc0b2('0x25')](0x2,_0x59f7d7['length'])['join'](','));}else{_0x4a51d8[_0xc0b2('0x24')](_0x59f7d7[0x0]);_0x4a51d8[_0xc0b2('0x24')](_0x59f7d7[_0xc0b2('0x25')](0x1,_0x59f7d7[_0xc0b2('0x1b')])['join'](','));}break;case _0xc0b2('0x26'):var _0x96100b=_0x5a5fba['appdata'][_0xc0b2('0x22')](',');_0x4a51d8['push'](_0x96100b[0x0]);_0x4a51d8[_0xc0b2('0x24')](_0x96100b[0x1]);_0x4a51d8['push'](_0x96100b[_0xc0b2('0x25')](0x2,_0x96100b[_0xc0b2('0x1b')])[_0xc0b2('0x1d')](','));break;case _0xc0b2('0x27'):var _0x26badc=_0x5a5fba['appdata'][_0xc0b2('0x22')](',');_0x4a51d8[_0xc0b2('0x24')](_0x26badc[0x0]);_0x4a51d8[_0xc0b2('0x24')](_0x26badc[0x1]);_0x4a51d8[_0xc0b2('0x24')](_0x26badc[0x2]);_0x4a51d8[_0xc0b2('0x24')](_0x26badc[0x3]);_0x4a51d8['push'](_0x26badc[_0xc0b2('0x25')](0x4,_0x26badc[_0xc0b2('0x1b')])[_0xc0b2('0x1d')](','));break;case _0xc0b2('0x28'):var _0x2e9360=_0x5a5fba[_0xc0b2('0x29')][_0xc0b2('0x22')](',');_0x4a51d8[_0xc0b2('0x24')](_0x2e9360[0x0]);_0x4a51d8[_0xc0b2('0x24')](_0x2e9360[0x1]);_0x4a51d8[_0xc0b2('0x24')](_0x2e9360[0x2]);_0x4a51d8[_0xc0b2('0x24')](_0x2e9360[0x3]);_0x4a51d8[_0xc0b2('0x24')](_0x2e9360[_0xc0b2('0x25')](0x4,_0x2e9360[_0xc0b2('0x1b')])[_0xc0b2('0x1d')](','));break;case _0xc0b2('0x16'):_0x4a51d8[_0xc0b2('0x24')](_0x5a5fba[_0xc0b2('0x29')]);break;case _0xc0b2('0x2a'):_0x4a51d8['push'](_0x5a5fba[_0xc0b2('0x2b')]);_0x4a51d8[_0xc0b2('0x24')](_0x5a5fba[_0xc0b2('0x29')]);break;case'tvox':var _0x31d244=utils[_0xc0b2('0x2c')](_0x38b787[_0xc0b2('0x2d')][_0xc0b2('0x2e')],_0x38b787);var _0x2f2946=_0x5a5fba[_0xc0b2('0x29')][_0xc0b2('0x22')](',');_0x4a51d8[_0xc0b2('0x24')](_0x2f2946[0x0]);_0x4a51d8[_0xc0b2('0x24')](_0x2f2946[0x1]);_0x4a51d8[_0xc0b2('0x24')](_0x2f2946[0x2]);_0x4a51d8['push'](_0x2f2946[0x3]);_0x4a51d8['push'](_0x2f2946[0x4]);_0x4a51d8[_0xc0b2('0x24')](_0x2f2946[0x5]);_0x4a51d8['push'](_0x2f2946[0x6]);_0x4a51d8[_0xc0b2('0x24')](_0x2f2946[0x7]);_0x4a51d8[_0xc0b2('0x24')](_0x2f2946[0x8]);_0x4a51d8['push'](_0x2f2946[0x9]);_0x4a51d8[_0xc0b2('0x24')](_0x2f2946[0xa]);_0x4a51d8['push'](_0x38b787['interaction']['id']);_0x4a51d8[_0xc0b2('0x24')](_0x38b787[_0xc0b2('0x16')]['id']);_0x4a51d8[_0xc0b2('0x24')](_0x5a5fba['ChatWebsiteId']);_0x4a51d8['push'](_0x38b787[_0xc0b2('0x17')][_0xc0b2('0x2f')]);_0x4a51d8[_0xc0b2('0x24')](_0x38b787[_0xc0b2('0x30')][_0xc0b2('0x30')]);_0x4a51d8[_0xc0b2('0x24')](_0x31d244);break;default:_0x4a51d8=_['isNil'](_0x5a5fba[_0xc0b2('0x29')])?[]:_0x5a5fba[_0xc0b2('0x29')][_0xc0b2('0x22')](',');}var _0x4dcb91={'id':util[_0xc0b2('0xd')]('%s:%s:%s',_0x5bda9b,_0x5a5fba['id'],_0x5a5fba['app']),'condition':require('./interval')[_0xc0b2('0x31')](_0x5bda9b,getIntervals(_0x440c1f['intervals'],_0x5a5fba),_0x440c1f),'consequence':require(_0xc0b2('0x32')+_0x5a5fba['app'])[_0xc0b2('0x33')](_0x5bda9b,_0x4a51d8,_0x440c1f,_0x38b787),'p':_0x5a5fba['priority']||0x0};logger['info'](_0xc0b2('0x34'),_0x4dcb91['id'],_0xc0b2('0x35'),getIntervals(_0x440c1f['intervals'],_0x5a5fba)['join'](_0xc0b2('0x36')));_0x2db55b[_0xc0b2('0x24')](_0x4dcb91);}else{logger['error'](_0xc0b2('0x37'),path[_0xc0b2('0x1d')](__dirname,_0xc0b2('0x19'),_0x5a5fba[_0xc0b2('0x1e')]+_0xc0b2('0x1f')));}}_0x440c1f[_0xc0b2('0x38')][_0x5bda9b]=new RuleEngine(_0x2db55b);_0x440c1f[_0xc0b2('0x38')][_0x5bda9b][_0xc0b2('0x39')](_0x38b787,function(_0xc371d6){logger[_0xc0b2('0x3a')]('Applications\x20executed',JSON['stringify'](_0xc371d6['matchPath']));if(_0x440c1f[_0xc0b2('0x38')][_0x5bda9b]){_0x440c1f[_0xc0b2('0x38')][_0x5bda9b][_0xc0b2('0x3b')]('complete');}});return _0x2c47bb({'code':0xc8,'message':_0x38b787});}else{if(_0x3630dd){logger[_0xc0b2('0x3a')](util[_0xc0b2('0xd')](_0xc0b2('0x3c'),_0x5bda9b));}else{logger[_0xc0b2('0x3a')](_0xc0b2('0x3d'));}return _0x2c47bb({'code':0xc8,'message':_0x38b787});}}catch(_0x59c894){logger[_0xc0b2('0x3e')](_0x59c894[_0xc0b2('0x3f')]);return _0x70a694(_0x174326[_0xc0b2('0x3e')](0x1f4,_0x59c894));}}return _0x70a694(_0xc0b2('0x40'));});},'AcceptMessage':function(_0x2d2990){var _0x15f931=this;return new Promise(function(_0x20da13,_0x4db756){if(_0x2d2990['agent']&&_0x2d2990[_0xc0b2('0x41')]['id']){if(_0x440c1f[_0xc0b2('0x42')][_0x2d2990[_0xc0b2('0x41')]['id']]){_0x440c1f[_0xc0b2('0x42')][_0x2d2990[_0xc0b2('0x41')]['id']]['busy']=![];_0x440c1f[_0xc0b2('0x42')][_0x2d2990[_0xc0b2('0x41')]['id']][_0xc0b2('0x43')]=undefined;}}if(_0x2d2990['message']&&_0x2d2990[_0xc0b2('0x16')]['id']){try{var _0x459929=getId(_0x2d2990[_0xc0b2('0x15')],_0x2d2990['message']?_0x2d2990[_0xc0b2('0x16')]['id']:0x0,_0x2d2990[_0xc0b2('0x17')]?_0x2d2990[_0xc0b2('0x17')]['id']:0x0);if(_0x440c1f['rules'][_0x459929]){_0x440c1f[_0xc0b2('0x38')][_0x459929][_0xc0b2('0x3b')](_0xc0b2('0x44'));if(rpc[_0x2d2990['channel']+'QueueReport']){rpc[_0x2d2990[_0xc0b2('0x15')]+_0xc0b2('0x45')][_0xc0b2('0x46')](_0x459929,{'UserId':_0x2d2990['message'][_0xc0b2('0x47')]})['catch'](function(){logger['error'](_0xc0b2('0x48'));});}}return _0x20da13({'code':0xc8,'message':_0x2d2990});}catch(_0x46a3ad){logger[_0xc0b2('0x3e')](_0x46a3ad[_0xc0b2('0x3f')]);return _0x4db756(_0x15f931[_0xc0b2('0x3e')](0x1f4,_0x46a3ad));}}logger['error'](_0xc0b2('0x49'));return _0x4db756(_0x15f931['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3ac5a0){var _0x1e4f4f=this;return new Promise(function(_0x56ecd1,_0x542d7a){if(_0x3ac5a0[_0xc0b2('0x41')]&&_0x3ac5a0[_0xc0b2('0x41')]['id']){try{if(_0x440c1f['agents'][_0x3ac5a0[_0xc0b2('0x41')]['id']]){_0x440c1f[_0xc0b2('0x42')][_0x3ac5a0[_0xc0b2('0x41')]['id']]['busy']=![];_0x440c1f[_0xc0b2('0x42')][_0x3ac5a0[_0xc0b2('0x41')]['id']]['busyQueue']=undefined;}return _0x56ecd1({'code':0xc8,'message':_0x3ac5a0});}catch(_0x4a376e){logger[_0xc0b2('0x3e')](_0x4a376e['stack']);return _0x542d7a(_0x1e4f4f['error'](0x1f4,_0x4a376e));}}logger[_0xc0b2('0x3e')]('message\x20is\x20empty');return _0x542d7a(_0x1e4f4f[_0xc0b2('0x3e')](0x1f4,_0xc0b2('0x49')));});},'AbandonInteraction':function(_0x1ae727){var _0x3d8e23=this;return new Promise(function(_0x570b0b,_0x30727e){if(_0x1ae727[_0xc0b2('0x15')]&&_0x1ae727['interaction']&&_0x1ae727[_0xc0b2('0x17')]['id']){try{var _0x57de60=getId(_0x1ae727[_0xc0b2('0x15')],_0x1ae727[_0xc0b2('0x16')]?_0x1ae727[_0xc0b2('0x16')]['id']:0x0,_0x1ae727[_0xc0b2('0x17')]?_0x1ae727['interaction']['id']:0x0);if(_0x440c1f[_0xc0b2('0x38')][_0x57de60]){_0x440c1f['rules'][_0x57de60][_0xc0b2('0x3b')](_0xc0b2('0x44'));}return _0x570b0b({'code':0xc8,'message':_0x1ae727});}catch(_0x1a5138){logger['error'](_0x1a5138[_0xc0b2('0x3f')]);return _0x30727e(_0x3d8e23[_0xc0b2('0x3e')](0x1f4,_0x1a5138));}}logger[_0xc0b2('0x3e')](_0xc0b2('0x49'));return _0x30727e(_0x3d8e23[_0xc0b2('0x3e')](0x1f4,_0xc0b2('0x49')));});},'AgentCapacity':function(_0x214607){var _0x7e2068=this;return new Promise(function(_0x3f840d,_0x31c83f){if(_0x440c1f[_0xc0b2('0x42')]['hasOwnProperty'](_0x214607['id'])){for(var _0x54fb7a in _0x214607[_0xc0b2('0x4a')]){if(_0x214607[_0xc0b2('0x4a')][_0xc0b2('0x4b')](_0x54fb7a)){if(_0x440c1f[_0xc0b2('0x42')][_0x214607['id']][_0xc0b2('0x4b')](_0x54fb7a+_0xc0b2('0x4c'))){_0x440c1f['agents'][_0x214607['id']][_0x54fb7a+_0xc0b2('0x4c')]=parseInt(_0x214607[_0xc0b2('0x4a')][_0x54fb7a],0xa);}}}_0x440c1f['agents'][_0x214607['id']][_0xc0b2('0x4d')]();return _0x3f840d({'code':0xc8,'message':_0x440c1f['agents'][_0x214607['id']]});}else{return _0x31c83f(_0x7e2068[_0xc0b2('0x3e')](0x1f4,_0xc0b2('0x4e')));}});},'Agents':function(_0x59826b){return new Promise(function(_0x5dcebf){var _0x1af124=_[_0xc0b2('0x4f')](_0x440c1f[_0xc0b2('0x42')]);if(_0x59826b&&_0x59826b['id']){var _0x50e3f4=_[_0xc0b2('0x50')](_0x1af124,function(_0x127027){return _0x127027['id']===_0x59826b['id'];});_0x5dcebf(_0x50e3f4);}else{_0x5dcebf({'count':_0x1af124[_0xc0b2('0x1b')],'rows':_0x1af124});}});},'ChatQueues':function(){return new Promise(function(_0x248e33){var _0x2a7519=[];for(var _0x445f78 in _0x440c1f[_0xc0b2('0x51')]){if(_0x440c1f[_0xc0b2('0x51')][_0xc0b2('0x4b')](_0x445f78)){var _0x1851b=_0x440c1f[_0xc0b2('0x51')][_0x445f78];var _0x33c907={'id':_0x1851b['id'],'available':_0x1851b['available'],'loggedIn':_0x1851b[_0xc0b2('0x52')],'name':_0x1851b[_0xc0b2('0x53')],'paused':_0x1851b[_0xc0b2('0x54')],'waiting':_0x1851b[_0xc0b2('0x55')]};_0x2a7519[_0xc0b2('0x24')](_0x33c907);}}_0x248e33({'count':_0x2a7519[_0xc0b2('0x1b')],'rows':_0x2a7519});});},'MailQueues':function(){return new Promise(function(_0x1b71e9){var _0x2738da=[];for(var _0x2490e6 in _0x440c1f[_0xc0b2('0x56')]){if(_0x440c1f[_0xc0b2('0x56')][_0xc0b2('0x4b')](_0x2490e6)){var _0x1525a0=_0x440c1f[_0xc0b2('0x56')][_0x2490e6];var _0x1d83ba={'id':_0x1525a0['id'],'available':_0x1525a0['available'],'loggedIn':_0x1525a0[_0xc0b2('0x52')],'name':_0x1525a0[_0xc0b2('0x53')],'paused':_0x1525a0[_0xc0b2('0x54')],'waiting':_0x1525a0['waiting']};_0x2738da[_0xc0b2('0x24')](_0x1d83ba);}}_0x1b71e9({'count':_0x2738da[_0xc0b2('0x1b')],'rows':_0x2738da});});},'OpenchannelQueues':function(){return new Promise(function(_0x559a4c){var _0x38af56=[];for(var _0x48f7b4 in _0x440c1f[_0xc0b2('0x57')]){if(_0x440c1f[_0xc0b2('0x57')][_0xc0b2('0x4b')](_0x48f7b4)){var _0x499803=_0x440c1f[_0xc0b2('0x57')][_0x48f7b4];var _0x1cf46c={'id':_0x499803['id'],'available':_0x499803[_0xc0b2('0x58')],'loggedIn':_0x499803['loggedIn'],'name':_0x499803['name'],'paused':_0x499803[_0xc0b2('0x54')],'waiting':_0x499803[_0xc0b2('0x55')]};_0x38af56[_0xc0b2('0x24')](_0x1cf46c);}}_0x559a4c({'count':_0x38af56[_0xc0b2('0x1b')],'rows':_0x38af56});});},'SmsQueues':function(){return new Promise(function(_0x1fa38b){var _0x3ef27e=[];for(var _0x4a0c15 in _0x440c1f[_0xc0b2('0x59')]){if(_0x440c1f['smsQueues'][_0xc0b2('0x4b')](_0x4a0c15)){var _0x20f117=_0x440c1f[_0xc0b2('0x59')][_0x4a0c15];var _0x441ca6={'id':_0x20f117['id'],'available':_0x20f117[_0xc0b2('0x58')],'loggedIn':_0x20f117[_0xc0b2('0x52')],'name':_0x20f117[_0xc0b2('0x53')],'paused':_0x20f117[_0xc0b2('0x54')],'waiting':_0x20f117['waiting']};_0x3ef27e[_0xc0b2('0x24')](_0x441ca6);}}_0x1fa38b({'count':_0x3ef27e[_0xc0b2('0x1b')],'rows':_0x3ef27e});});},'FaxQueues':function(){return new Promise(function(_0xdb94e1){var _0x10c9b0=[];for(var _0x961be1 in _0x440c1f[_0xc0b2('0x5a')]){if(_0x440c1f[_0xc0b2('0x5a')][_0xc0b2('0x4b')](_0x961be1)){var _0x3ef309=_0x440c1f[_0xc0b2('0x5a')][_0x961be1];var _0x57fc95={'id':_0x3ef309['id'],'available':_0x3ef309[_0xc0b2('0x58')],'loggedIn':_0x3ef309[_0xc0b2('0x52')],'name':_0x3ef309[_0xc0b2('0x53')],'paused':_0x3ef309['paused'],'waiting':_0x3ef309[_0xc0b2('0x55')]};_0x10c9b0['push'](_0x57fc95);}}_0xdb94e1({'count':_0x10c9b0[_0xc0b2('0x1b')],'rows':_0x10c9b0});});},'WhatsappQueues':function(){return new Promise(function(_0x26b1d0){var _0x46fbd2=[];for(var _0x141212 in _0x440c1f[_0xc0b2('0x5b')]){if(_0x440c1f[_0xc0b2('0x5b')][_0xc0b2('0x4b')](_0x141212)){var _0x220bb3=_0x440c1f[_0xc0b2('0x5b')][_0x141212];var _0x4753a6={'id':_0x220bb3['id'],'available':_0x220bb3[_0xc0b2('0x58')],'loggedIn':_0x220bb3[_0xc0b2('0x52')],'name':_0x220bb3['name'],'paused':_0x220bb3[_0xc0b2('0x54')],'waiting':_0x220bb3[_0xc0b2('0x55')]};_0x46fbd2[_0xc0b2('0x24')](_0x4753a6);}}_0x26b1d0({'count':_0x46fbd2[_0xc0b2('0x1b')],'rows':_0x46fbd2});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x410229){var _0x3c1566=_[_0xc0b2('0x4f')](_0x440c1f['chatQueuesWaitingInteractions']);_0x410229({'count':_0x3c1566[_0xc0b2('0x1b')],'rows':_0x3c1566});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x22c2fb){var _0x2e8b44=_[_0xc0b2('0x4f')](_0x440c1f['mailQueuesWaitingInteractions']);_0x22c2fb({'count':_0x2e8b44['length'],'rows':_0x2e8b44});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x334074){var _0x4ae333=_[_0xc0b2('0x4f')](_0x440c1f[_0xc0b2('0x5c')]);_0x334074({'count':_0x4ae333[_0xc0b2('0x1b')],'rows':_0x4ae333});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x51d08b){var _0x21d52e=_[_0xc0b2('0x4f')](_0x440c1f[_0xc0b2('0x5d')]);_0x51d08b({'count':_0x21d52e[_0xc0b2('0x1b')],'rows':_0x21d52e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x345da5){var _0x324c23=_[_0xc0b2('0x4f')](_0x440c1f[_0xc0b2('0x5e')]);_0x345da5({'count':_0x324c23[_0xc0b2('0x1b')],'rows':_0x324c23});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x498acf){var _0x44b2eb=_[_0xc0b2('0x4f')](_0x440c1f[_0xc0b2('0x5f')]);_0x498acf({'count':_0x44b2eb['length'],'rows':_0x44b2eb});});}};var _0x29640a=jayson[_0xc0b2('0x60')](_0x3b7a13)['http']();_0x29640a['on'](_0xc0b2('0x3e'),function(_0xe4c270){logger['error'](JSON['stringify'](_0xe4c270));return _0xa3e99b(_0xe4c270);});_0x29640a['listen'](0x232c,'127.0.0.1',function(){console['log'](_0xc0b2('0x61'),0x232c);return _0x1ae155(_0xc0b2('0x62')+0x232c);});});}; \ No newline at end of file +var _0xcb6b=['jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','channel','mail','push','dialogflow','slice','amazonlex','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path'];(function(_0x942eca,_0x1d0181){var _0x589c16=function(_0x235ca1){while(--_0x235ca1){_0x942eca['push'](_0x942eca['shift']());}};_0x589c16(++_0x1d0181);}(_0xcb6b,0x1a2));var _0xbcb6=function(_0x5ccbaa,_0x3f6e2c){_0x5ccbaa=_0x5ccbaa-0x0;var _0x235e2f=_0xcb6b[_0x5ccbaa];return _0x235e2f;};'use strict';var _=require(_0xbcb6('0x0'));var util=require('util');var path=require(_0xbcb6('0x1'));var fs=require('fs');var jayson=require(_0xbcb6('0x2'));var BPromise=require(_0xbcb6('0x3'));var utils=require(_0xbcb6('0x4'));var sUtils=require(_0xbcb6('0x5'));var logger=require(_0xbcb6('0x6'))(_0xbcb6('0x7'));var rpc={'openchannelQueueReport':require(_0xbcb6('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xbcb6('0x9')),'faxQueueReport':require(_0xbcb6('0xa')),'whatsappQueueReport':require(_0xbcb6('0xb'))};var RuleEngine=require(_0xbcb6('0xc'));function getId(_0x1078b8,_0x58f82a,_0x46392d){return util[_0xbcb6('0xd')](_0xbcb6('0xe'),_0x1078b8,_0x58f82a||0x0,_0x46392d||0x0);}function getIntervals(_0x1ff57c,_0x16c397){var _0x1bce92=[];if(!_[_0xbcb6('0xf')](_0x16c397['IntervalId'])&&!_['isNil'](_0x1ff57c[_0x16c397[_0xbcb6('0x10')]])&&!_[_0xbcb6('0xf')](_0x1ff57c[_0x16c397[_0xbcb6('0x10')]]['Intervals'])){_0x1bce92=_[_0xbcb6('0x11')](_0x1ff57c[_0x16c397[_0xbcb6('0x10')]][_0xbcb6('0x12')],_0xbcb6('0x13'));}else if(!_[_0xbcb6('0xf')](_0x16c397[_0xbcb6('0x13')])){_0x1bce92=[_0x16c397[_0xbcb6('0x13')]];}return _0x1bce92;}exports[_0xbcb6('0x14')]=function(_0x308120){_0x308120[_0xbcb6('0x15')]={};return new BPromise(function(_0x5c1968,_0x5af1c7){var _0x26177f={'Start':function(_0x26ef8a){var _0xf1b96a=this;return new Promise(function(_0x396652,_0x260238){if(_0x26ef8a){try{var _0xc2314=[];var _0x4c06bd=getId(_0x26ef8a['channel'],_0x26ef8a['message']?_0x26ef8a[_0xbcb6('0x16')]['id']:0x0,_0x26ef8a[_0xbcb6('0x17')]?_0x26ef8a[_0xbcb6('0x17')]['id']:0x0);var _0x75ad08=sUtils[_0xbcb6('0x18')](_0x308120,_0x26ef8a);if(!_0x75ad08&&_0x26ef8a[_0xbcb6('0x19')]&&_['isArray'](_0x26ef8a[_0xbcb6('0x19')])&&_0x26ef8a[_0xbcb6('0x19')][_0xbcb6('0x1a')]){for(var _0x2243d5=0x0;_0x2243d5<_0x26ef8a[_0xbcb6('0x19')][_0xbcb6('0x1a')];_0x2243d5+=0x1){var _0x10209c=_0x26ef8a[_0xbcb6('0x19')][_0x2243d5];if(fs[_0xbcb6('0x1b')](path[_0xbcb6('0x1c')](__dirname,_0xbcb6('0x19'),_0x10209c[_0xbcb6('0x1d')]+_0xbcb6('0x1e')))){var _0x253554=[];switch(_0x10209c[_0xbcb6('0x1d')][_0xbcb6('0x1f')]()){case _0xbcb6('0x20'):var _0xedd4e5=_0x10209c[_0xbcb6('0x21')][_0xbcb6('0x22')](',');if(_0x26ef8a[_0xbcb6('0x23')]===_0xbcb6('0x24')){_0x253554[_0xbcb6('0x25')](_0xedd4e5[0x0]);_0x253554[_0xbcb6('0x25')](_0xedd4e5[0x1]);_0x253554[_0xbcb6('0x25')](_0xedd4e5['slice'](0x2,_0xedd4e5['length'])['join'](','));}else{_0x253554[_0xbcb6('0x25')](_0xedd4e5[0x0]);_0x253554[_0xbcb6('0x25')](_0xedd4e5['slice'](0x1,_0xedd4e5[_0xbcb6('0x1a')])[_0xbcb6('0x1c')](','));}break;case _0xbcb6('0x26'):var _0x4d8ca3=_0x10209c[_0xbcb6('0x21')][_0xbcb6('0x22')](',');_0x253554[_0xbcb6('0x25')](_0x4d8ca3[0x0]);_0x253554['push'](_0x4d8ca3[0x1]);_0x253554[_0xbcb6('0x25')](_0x4d8ca3[_0xbcb6('0x27')](0x2,_0x4d8ca3['length'])['join'](','));break;case'dialogflowv2':var _0xe4734b=_0x10209c['appdata'][_0xbcb6('0x22')](',');_0x253554[_0xbcb6('0x25')](_0xe4734b[0x0]);_0x253554[_0xbcb6('0x25')](_0xe4734b[0x1]);_0x253554[_0xbcb6('0x25')](_0xe4734b[0x2]);_0x253554[_0xbcb6('0x25')](_0xe4734b[0x3]);_0x253554[_0xbcb6('0x25')](_0xe4734b['slice'](0x4,_0xe4734b[_0xbcb6('0x1a')])[_0xbcb6('0x1c')](','));break;case _0xbcb6('0x28'):var _0x1f2861=_0x10209c[_0xbcb6('0x21')][_0xbcb6('0x22')](',');_0x253554[_0xbcb6('0x25')](_0x1f2861[0x0]);_0x253554[_0xbcb6('0x25')](_0x1f2861[0x1]);_0x253554[_0xbcb6('0x25')](_0x1f2861[0x2]);_0x253554['push'](_0x1f2861[0x3]);_0x253554[_0xbcb6('0x25')](_0x1f2861[_0xbcb6('0x27')](0x4,_0x1f2861['length'])[_0xbcb6('0x1c')](','));break;case _0xbcb6('0x16'):_0x253554[_0xbcb6('0x25')](_0x10209c[_0xbcb6('0x21')]);break;case'tag':_0x253554[_0xbcb6('0x25')](_0x10209c['TagId']);_0x253554[_0xbcb6('0x25')](_0x10209c[_0xbcb6('0x21')]);break;case _0xbcb6('0x29'):var _0x537189=utils[_0xbcb6('0x2a')](_0x26ef8a[_0xbcb6('0x2b')][_0xbcb6('0x2c')],_0x26ef8a);var _0x3d1a6f=_0x10209c[_0xbcb6('0x21')][_0xbcb6('0x22')](',');_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x0]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x1]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x2]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x3]);_0x253554['push'](_0x3d1a6f[0x4]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x5]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x6]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x7]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x8]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0x9]);_0x253554[_0xbcb6('0x25')](_0x3d1a6f[0xa]);_0x253554['push'](_0x26ef8a[_0xbcb6('0x17')]['id']);_0x253554[_0xbcb6('0x25')](_0x26ef8a[_0xbcb6('0x16')]['id']);_0x253554[_0xbcb6('0x25')](_0x10209c[_0xbcb6('0x2d')]);_0x253554[_0xbcb6('0x25')](_0x26ef8a[_0xbcb6('0x17')][_0xbcb6('0x2e')]);_0x253554['push'](_0x26ef8a['body'][_0xbcb6('0x2f')]);_0x253554['push'](_0x537189);break;default:_0x253554=_[_0xbcb6('0xf')](_0x10209c[_0xbcb6('0x21')])?[]:_0x10209c[_0xbcb6('0x21')][_0xbcb6('0x22')](',');}var _0x4cefcf={'id':util[_0xbcb6('0xd')](_0xbcb6('0x30'),_0x4c06bd,_0x10209c['id'],_0x10209c[_0xbcb6('0x1d')]),'condition':require('./interval')['condition'](_0x4c06bd,getIntervals(_0x308120['intervals'],_0x10209c),_0x308120),'consequence':require(_0xbcb6('0x31')+_0x10209c['app'])[_0xbcb6('0x32')](_0x4c06bd,_0x253554,_0x308120,_0x26ef8a),'p':_0x10209c[_0xbcb6('0x33')]||0x0};logger[_0xbcb6('0x34')](_0xbcb6('0x35'),_0x4cefcf['id'],_0xbcb6('0x36'),getIntervals(_0x308120[_0xbcb6('0x37')],_0x10209c)[_0xbcb6('0x1c')](_0xbcb6('0x38')));_0xc2314['push'](_0x4cefcf);}else{logger[_0xbcb6('0x39')](_0xbcb6('0x3a'),path[_0xbcb6('0x1c')](__dirname,_0xbcb6('0x19'),_0x10209c[_0xbcb6('0x1d')]+_0xbcb6('0x1e')));}}_0x308120[_0xbcb6('0x15')][_0x4c06bd]=new RuleEngine(_0xc2314);_0x308120[_0xbcb6('0x15')][_0x4c06bd][_0xbcb6('0x3b')](_0x26ef8a,function(_0x3713ae){logger['info'](_0xbcb6('0x3c'),JSON[_0xbcb6('0x3d')](_0x3713ae['matchPath']));if(_0x308120[_0xbcb6('0x15')][_0x4c06bd]){_0x308120['rules'][_0x4c06bd][_0xbcb6('0x3e')](_0xbcb6('0x3f'));}});return _0x396652({'code':0xc8,'message':_0x26ef8a});}else{if(_0x75ad08){logger[_0xbcb6('0x34')](util['format'](_0xbcb6('0x40'),_0x4c06bd));}else{logger[_0xbcb6('0x34')](_0xbcb6('0x41'));}return _0x396652({'code':0xc8,'message':_0x26ef8a});}}catch(_0x27063d){logger[_0xbcb6('0x39')](_0x27063d[_0xbcb6('0x42')]);return _0x260238(_0xf1b96a[_0xbcb6('0x39')](0x1f4,_0x27063d));}}return _0x260238(_0xbcb6('0x43'));});},'AcceptMessage':function(_0x18bc1b){var _0x47fc19=this;return new Promise(function(_0x165821,_0x437325){if(_0x18bc1b[_0xbcb6('0x44')]&&_0x18bc1b[_0xbcb6('0x44')]['id']){if(_0x308120[_0xbcb6('0x45')][_0x18bc1b[_0xbcb6('0x44')]['id']]){_0x308120[_0xbcb6('0x45')][_0x18bc1b[_0xbcb6('0x44')]['id']][_0xbcb6('0x46')]=![];_0x308120['agents'][_0x18bc1b[_0xbcb6('0x44')]['id']]['busyQueue']=undefined;}}if(_0x18bc1b[_0xbcb6('0x16')]&&_0x18bc1b[_0xbcb6('0x16')]['id']){try{var _0x8220fe=getId(_0x18bc1b[_0xbcb6('0x23')],_0x18bc1b[_0xbcb6('0x16')]?_0x18bc1b[_0xbcb6('0x16')]['id']:0x0,_0x18bc1b[_0xbcb6('0x17')]?_0x18bc1b[_0xbcb6('0x17')]['id']:0x0);if(_0x308120[_0xbcb6('0x15')][_0x8220fe]){_0x308120[_0xbcb6('0x15')][_0x8220fe][_0xbcb6('0x3e')](_0xbcb6('0x47'));if(rpc[_0x18bc1b[_0xbcb6('0x23')]+_0xbcb6('0x48')]){rpc[_0x18bc1b[_0xbcb6('0x23')]+_0xbcb6('0x48')][_0xbcb6('0x49')](_0x8220fe,{'UserId':_0x18bc1b['message'][_0xbcb6('0x4a')]})[_0xbcb6('0x4b')](function(){logger[_0xbcb6('0x39')](_0xbcb6('0x4c'));});}}return _0x165821({'code':0xc8,'message':_0x18bc1b});}catch(_0x113b93){logger['error'](_0x113b93[_0xbcb6('0x42')]);return _0x437325(_0x47fc19[_0xbcb6('0x39')](0x1f4,_0x113b93));}}logger['error'](_0xbcb6('0x4d'));return _0x437325(_0x47fc19[_0xbcb6('0x39')](0x1f4,_0xbcb6('0x4d')));});},'RejectMessage':function(_0x5d62fc){var _0x554f67=this;return new Promise(function(_0x5e5540,_0x28b68e){if(_0x5d62fc[_0xbcb6('0x44')]&&_0x5d62fc[_0xbcb6('0x44')]['id']){try{if(_0x308120[_0xbcb6('0x45')][_0x5d62fc[_0xbcb6('0x44')]['id']]){_0x308120[_0xbcb6('0x45')][_0x5d62fc[_0xbcb6('0x44')]['id']][_0xbcb6('0x46')]=![];_0x308120['agents'][_0x5d62fc['agent']['id']][_0xbcb6('0x4e')]=undefined;}return _0x5e5540({'code':0xc8,'message':_0x5d62fc});}catch(_0x2924ed){logger[_0xbcb6('0x39')](_0x2924ed[_0xbcb6('0x42')]);return _0x28b68e(_0x554f67[_0xbcb6('0x39')](0x1f4,_0x2924ed));}}logger['error'](_0xbcb6('0x4d'));return _0x28b68e(_0x554f67[_0xbcb6('0x39')](0x1f4,_0xbcb6('0x4d')));});},'AbandonInteraction':function(_0xaabc81){var _0x3baf89=this;return new Promise(function(_0x1fa91d,_0xdcb14f){if(_0xaabc81[_0xbcb6('0x23')]&&_0xaabc81['interaction']&&_0xaabc81[_0xbcb6('0x17')]['id']){try{var _0x308b=getId(_0xaabc81[_0xbcb6('0x23')],_0xaabc81[_0xbcb6('0x16')]?_0xaabc81[_0xbcb6('0x16')]['id']:0x0,_0xaabc81[_0xbcb6('0x17')]?_0xaabc81['interaction']['id']:0x0);if(_0x308120[_0xbcb6('0x15')][_0x308b]){_0x308120['rules'][_0x308b][_0xbcb6('0x3e')](_0xbcb6('0x47'));}return _0x1fa91d({'code':0xc8,'message':_0xaabc81});}catch(_0x319fe3){logger[_0xbcb6('0x39')](_0x319fe3[_0xbcb6('0x42')]);return _0xdcb14f(_0x3baf89[_0xbcb6('0x39')](0x1f4,_0x319fe3));}}logger[_0xbcb6('0x39')](_0xbcb6('0x4d'));return _0xdcb14f(_0x3baf89['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x37497d){var _0x1d169f=this;return new Promise(function(_0x5df7a1,_0x3e0a2e){if(_0x308120[_0xbcb6('0x45')][_0xbcb6('0x4f')](_0x37497d['id'])){for(var _0x350341 in _0x37497d[_0xbcb6('0x50')]){if(_0x37497d[_0xbcb6('0x50')][_0xbcb6('0x4f')](_0x350341)){if(_0x308120['agents'][_0x37497d['id']]['hasOwnProperty'](_0x350341+_0xbcb6('0x51'))){_0x308120[_0xbcb6('0x45')][_0x37497d['id']][_0x350341+'CurrentCapacity']=parseInt(_0x37497d[_0xbcb6('0x50')][_0x350341],0xa);}}}_0x308120[_0xbcb6('0x45')][_0x37497d['id']]['updateRealtime']();return _0x5df7a1({'code':0xc8,'message':_0x308120[_0xbcb6('0x45')][_0x37497d['id']]});}else{return _0x3e0a2e(_0x1d169f['error'](0x1f4,_0xbcb6('0x52')));}});},'Agents':function(_0x49cb47){return new Promise(function(_0x3dc42a){var _0x2136ee=_[_0xbcb6('0x53')](_0x308120[_0xbcb6('0x45')]);if(_0x49cb47&&_0x49cb47['id']){var _0x43aa78=_[_0xbcb6('0x54')](_0x2136ee,function(_0x3a9271){return _0x3a9271['id']===_0x49cb47['id'];});_0x3dc42a(_0x43aa78);}else{_0x3dc42a({'count':_0x2136ee[_0xbcb6('0x1a')],'rows':_0x2136ee});}});},'ChatQueues':function(){return new Promise(function(_0x3eef33){var _0xe2dd3=[];for(var _0x387bd8 in _0x308120[_0xbcb6('0x55')]){if(_0x308120[_0xbcb6('0x55')]['hasOwnProperty'](_0x387bd8)){var _0x3ebb3b=_0x308120[_0xbcb6('0x55')][_0x387bd8];var _0x17e391={'id':_0x3ebb3b['id'],'available':_0x3ebb3b['available'],'loggedIn':_0x3ebb3b[_0xbcb6('0x56')],'name':_0x3ebb3b[_0xbcb6('0x57')],'paused':_0x3ebb3b[_0xbcb6('0x58')],'waiting':_0x3ebb3b[_0xbcb6('0x59')]};_0xe2dd3[_0xbcb6('0x25')](_0x17e391);}}_0x3eef33({'count':_0xe2dd3['length'],'rows':_0xe2dd3});});},'MailQueues':function(){return new Promise(function(_0x3331d9){var _0x22ec02=[];for(var _0x47340a in _0x308120['mailQueues']){if(_0x308120[_0xbcb6('0x5a')]['hasOwnProperty'](_0x47340a)){var _0x3577f1=_0x308120[_0xbcb6('0x5a')][_0x47340a];var _0x1cffee={'id':_0x3577f1['id'],'available':_0x3577f1[_0xbcb6('0x5b')],'loggedIn':_0x3577f1[_0xbcb6('0x56')],'name':_0x3577f1['name'],'paused':_0x3577f1['paused'],'waiting':_0x3577f1[_0xbcb6('0x59')]};_0x22ec02[_0xbcb6('0x25')](_0x1cffee);}}_0x3331d9({'count':_0x22ec02[_0xbcb6('0x1a')],'rows':_0x22ec02});});},'OpenchannelQueues':function(){return new Promise(function(_0x1afca2){var _0x36ac19=[];for(var _0x495da0 in _0x308120[_0xbcb6('0x5c')]){if(_0x308120[_0xbcb6('0x5c')][_0xbcb6('0x4f')](_0x495da0)){var _0x42e4e9=_0x308120['openchannelQueues'][_0x495da0];var _0x4b65c5={'id':_0x42e4e9['id'],'available':_0x42e4e9['available'],'loggedIn':_0x42e4e9['loggedIn'],'name':_0x42e4e9[_0xbcb6('0x57')],'paused':_0x42e4e9[_0xbcb6('0x58')],'waiting':_0x42e4e9[_0xbcb6('0x59')]};_0x36ac19[_0xbcb6('0x25')](_0x4b65c5);}}_0x1afca2({'count':_0x36ac19[_0xbcb6('0x1a')],'rows':_0x36ac19});});},'SmsQueues':function(){return new Promise(function(_0x274861){var _0x9bae93=[];for(var _0x59e893 in _0x308120[_0xbcb6('0x5d')]){if(_0x308120[_0xbcb6('0x5d')][_0xbcb6('0x4f')](_0x59e893)){var _0x450781=_0x308120[_0xbcb6('0x5d')][_0x59e893];var _0x5022b6={'id':_0x450781['id'],'available':_0x450781['available'],'loggedIn':_0x450781[_0xbcb6('0x56')],'name':_0x450781[_0xbcb6('0x57')],'paused':_0x450781[_0xbcb6('0x58')],'waiting':_0x450781['waiting']};_0x9bae93[_0xbcb6('0x25')](_0x5022b6);}}_0x274861({'count':_0x9bae93[_0xbcb6('0x1a')],'rows':_0x9bae93});});},'FaxQueues':function(){return new Promise(function(_0x1399a5){var _0x50255b=[];for(var _0x10be9f in _0x308120[_0xbcb6('0x5e')]){if(_0x308120['faxQueues']['hasOwnProperty'](_0x10be9f)){var _0x1d7789=_0x308120[_0xbcb6('0x5e')][_0x10be9f];var _0x2bb9dd={'id':_0x1d7789['id'],'available':_0x1d7789[_0xbcb6('0x5b')],'loggedIn':_0x1d7789[_0xbcb6('0x56')],'name':_0x1d7789[_0xbcb6('0x57')],'paused':_0x1d7789['paused'],'waiting':_0x1d7789[_0xbcb6('0x59')]};_0x50255b[_0xbcb6('0x25')](_0x2bb9dd);}}_0x1399a5({'count':_0x50255b[_0xbcb6('0x1a')],'rows':_0x50255b});});},'WhatsappQueues':function(){return new Promise(function(_0x16d397){var _0x1ae851=[];for(var _0x20246c in _0x308120[_0xbcb6('0x5f')]){if(_0x308120['whatsappQueues'][_0xbcb6('0x4f')](_0x20246c)){var _0x4d9be0=_0x308120[_0xbcb6('0x5f')][_0x20246c];var _0x5ba2ae={'id':_0x4d9be0['id'],'available':_0x4d9be0[_0xbcb6('0x5b')],'loggedIn':_0x4d9be0[_0xbcb6('0x56')],'name':_0x4d9be0['name'],'paused':_0x4d9be0['paused'],'waiting':_0x4d9be0[_0xbcb6('0x59')]};_0x1ae851[_0xbcb6('0x25')](_0x5ba2ae);}}_0x16d397({'count':_0x1ae851[_0xbcb6('0x1a')],'rows':_0x1ae851});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3232ee){var _0x314224=_[_0xbcb6('0x53')](_0x308120[_0xbcb6('0x60')]);_0x3232ee({'count':_0x314224[_0xbcb6('0x1a')],'rows':_0x314224});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x25c6de){var _0x50a92b=_[_0xbcb6('0x53')](_0x308120[_0xbcb6('0x61')]);_0x25c6de({'count':_0x50a92b[_0xbcb6('0x1a')],'rows':_0x50a92b});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1394ef){var _0x3c03f2=_[_0xbcb6('0x53')](_0x308120['openchannelQueuesWaitingInteractions']);_0x1394ef({'count':_0x3c03f2[_0xbcb6('0x1a')],'rows':_0x3c03f2});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5ecb7a){var _0x1ad857=_[_0xbcb6('0x53')](_0x308120[_0xbcb6('0x62')]);_0x5ecb7a({'count':_0x1ad857['length'],'rows':_0x1ad857});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3b6721){var _0x22aacd=_[_0xbcb6('0x53')](_0x308120[_0xbcb6('0x63')]);_0x3b6721({'count':_0x22aacd[_0xbcb6('0x1a')],'rows':_0x22aacd});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2c5a2a){var _0x5a6ab0=_['values'](_0x308120['whatsappQueuesWaitingInteractions']);_0x2c5a2a({'count':_0x5a6ab0[_0xbcb6('0x1a')],'rows':_0x5a6ab0});});}};var _0x551bcc=jayson['server'](_0x26177f)[_0xbcb6('0x64')]();_0x551bcc['on'](_0xbcb6('0x39'),function(_0x5e9012){logger['error'](JSON[_0xbcb6('0x3d')](_0x5e9012));return _0x5af1c7(_0x5e9012);});_0x551bcc[_0xbcb6('0x14')](0x232c,_0xbcb6('0x65'),function(){console[_0xbcb6('0x66')](_0xbcb6('0x67'),0x232c);return _0x5c1968(_0xbcb6('0x68')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index b2cee9b..52ef920 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 _0x3b9b=['info','stop','length','Command','format','iftime\x20%s','then','indexOf','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','routing','client','error','message','result','rules'];(function(_0x2233c6,_0x227b09){var _0x11c4ea=function(_0x45ca0b){while(--_0x45ca0b){_0x2233c6['push'](_0x2233c6['shift']());}};_0x11c4ea(++_0x227b09);}(_0x3b9b,0x170));var _0xb3b9=function(_0xcccdf4,_0x220dc3){_0xcccdf4=_0xcccdf4-0x0;var _0x58abbb=_0x3b9b[_0xcccdf4];return _0x58abbb;};'use strict';var util=require(_0xb3b9('0x0'));var BPromise=require(_0xb3b9('0x1'));var jayson=require(_0xb3b9('0x2'));var _=require(_0xb3b9('0x3'));var logger=require('../../../config/logger')(_0xb3b9('0x4'));var client=jayson[_0xb3b9('0x5')]['http']({'port':0x232a});function request(_0x48fdb2,_0x361fcc){return new BPromise(function(_0x24dfe8,_0xb5cc21){return client['request'](_0x48fdb2,_0x361fcc)['then'](function(_0x4922f0){if(_0x4922f0[_0xb3b9('0x6')]){return _0xb5cc21(_0x4922f0['error'][_0xb3b9('0x7')]);}else{return _0x24dfe8(_0x4922f0[_0xb3b9('0x8')]);}})['catch'](function(_0x678d0b){return _0xb5cc21(_0x678d0b);});});}exports['condition']=function(_0xa3ad32,_0x38223b,_0x15493a){return function(_0x5ee345){if(_0x15493a[_0xb3b9('0x9')]&&!_0x15493a[_0xb3b9('0x9')][_0xa3ad32]){logger[_0xb3b9('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xa3ad32);return _0x5ee345[_0xb3b9('0xb')]();}var _0x45340a=[];for(var _0x4ed99f=0x0;_0x4ed99f<_0x38223b[_0xb3b9('0xc')];_0x4ed99f+=0x1){_0x45340a['push'](request(_0xb3b9('0xd'),{'command':util[_0xb3b9('0xe')](_0xb3b9('0xf'),_0x38223b[_0x4ed99f])})[_0xb3b9('0x10')](function(_0x1519cd){return _0x1519cd&&_0x1519cd[_0xb3b9('0x7')]&&_0x1519cd[_0xb3b9('0x7')][_0xb3b9('0x11')]('true')>=0x0?!![]:![];})[_0xb3b9('0x12')](function(_0x323f65){logger[_0xb3b9('0x6')](_0xb3b9('0x13'),_0xa3ad32,_0x38223b[_0x4ed99f]);}));}BPromise[_0xb3b9('0x14')](_0x45340a)[_0xb3b9('0x10')](function(_0x42fdc6){var _0x1bda25=_[_0xb3b9('0x15')](_0x42fdc6);logger['info'](_0xb3b9('0x16'),_0xa3ad32,_0x38223b[_0xb3b9('0x17')]('\x20|\x20'),_0x1bda25);_0x5ee345[_0xb3b9('0x18')](_0x1bda25);})[_0xb3b9('0x12')](function(_0x4ec86c){console['log'](_0x4ec86c);logger[_0xb3b9('0x6')](_0xb3b9('0x16'),_0xa3ad32,_0x38223b[_0xb3b9('0x17')](_0xb3b9('0x19')),_0x4ec86c[_0xb3b9('0x1a')]);_0x5ee345[_0xb3b9('0xb')]();});};}; \ No newline at end of file +var _0x1b12=['all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','stack','stop','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','then','error','message','result','catch','condition','rules','info','push','Command','iftime\x20%s','true'];(function(_0x161883,_0x693d30){var _0xa75f56=function(_0x3e24fc){while(--_0x3e24fc){_0x161883['push'](_0x161883['shift']());}};_0xa75f56(++_0x693d30);}(_0x1b12,0x10b));var _0x21b1=function(_0x411b66,_0x16c586){_0x411b66=_0x411b66-0x0;var _0x1cd278=_0x1b12[_0x411b66];return _0x1cd278;};'use strict';var util=require('util');var BPromise=require(_0x21b1('0x0'));var jayson=require(_0x21b1('0x1'));var _=require(_0x21b1('0x2'));var logger=require(_0x21b1('0x3'))('routing');var client=jayson[_0x21b1('0x4')][_0x21b1('0x5')]({'port':0x232a});function request(_0x5658db,_0x583e2b){return new BPromise(function(_0x45a2b0,_0x1fe5f5){return client[_0x21b1('0x6')](_0x5658db,_0x583e2b)[_0x21b1('0x7')](function(_0x63acbd){if(_0x63acbd[_0x21b1('0x8')]){return _0x1fe5f5(_0x63acbd['error'][_0x21b1('0x9')]);}else{return _0x45a2b0(_0x63acbd[_0x21b1('0xa')]);}})[_0x21b1('0xb')](function(_0xa0a07){return _0x1fe5f5(_0xa0a07);});});}exports[_0x21b1('0xc')]=function(_0x485cb7,_0x27f9cd,_0x551b4e){return function(_0x12e41a){if(_0x551b4e[_0x21b1('0xd')]&&!_0x551b4e['rules'][_0x485cb7]){logger[_0x21b1('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x485cb7);return _0x12e41a['stop']();}var _0x594dcd=[];for(var _0x5aae44=0x0;_0x5aae44<_0x27f9cd['length'];_0x5aae44+=0x1){_0x594dcd[_0x21b1('0xf')](request(_0x21b1('0x10'),{'command':util['format'](_0x21b1('0x11'),_0x27f9cd[_0x5aae44])})[_0x21b1('0x7')](function(_0x35a0e2){return _0x35a0e2&&_0x35a0e2[_0x21b1('0x9')]&&_0x35a0e2[_0x21b1('0x9')]['indexOf'](_0x21b1('0x12'))>=0x0?!![]:![];})[_0x21b1('0xb')](function(_0x4bd168){logger[_0x21b1('0x8')]('[%s][INTERVAL]\x20%s',_0x485cb7,_0x27f9cd[_0x5aae44]);}));}BPromise[_0x21b1('0x13')](_0x594dcd)[_0x21b1('0x7')](function(_0x4377d4){var _0x5eca68=_[_0x21b1('0x14')](_0x4377d4);logger['info'](_0x21b1('0x15'),_0x485cb7,_0x27f9cd[_0x21b1('0x16')]('\x20|\x20'),_0x5eca68);_0x12e41a[_0x21b1('0x17')](_0x5eca68);})[_0x21b1('0xb')](function(_0x211ea7){console['log'](_0x211ea7);logger[_0x21b1('0x8')](_0x21b1('0x15'),_0x485cb7,_0x27f9cd[_0x21b1('0x16')]('\x20|\x20'),_0x211ea7[_0x21b1('0x18')]);_0x12e41a[_0x21b1('0x19')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 5ff4a3f..a72c231 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 _0xf290=['now','connectedlinename','error','agentringnoanswer','timeout','reason','holdtime','push','[%s][agents][agentringnoanswer]','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','[%s][agents][hangup]','rejected','indexOf','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x5c9a07,_0x3643e2){var _0x9a3291=function(_0x1ac1d0){while(--_0x1ac1d0){_0x5c9a07['push'](_0x5c9a07['shift']());}};_0x9a3291(++_0x3643e2);}(_0xf290,0xde));var _0x0f29=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xf290[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d35f0,_0x4b16e4){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x3'),_0x1d35f0[_0x0f29('0x4')],_0x1d35f0[_0x0f29('0x5')],_0x1d35f0['queue'],_0x1d35f0[_0x0f29('0x6')],_0x1d35f0['interface'],_0x1d35f0[_0x0f29('0x7')],_0x1d35f0[_0x0f29('0x8')],_0x1d35f0[_0x0f29('0x9')]));if(_0x1d35f0[_0x0f29('0xa')]){utils[_0x0f29('0xb')](_0x1d35f0[_0x0f29('0xa')])[_0x0f29('0xc')](function(_0x3c6a6e){if(_0x3c6a6e){_0x1d35f0[_0x0f29('0xd')]=_0x3c6a6e[_0x0f29('0xd')];_0x1d35f0[_0x0f29('0xe')]=_0x1d35f0[_0x0f29('0xf')]?_0x3c6a6e[_0x0f29('0x10')]:![];_0x1d35f0[_0x0f29('0x11')]=_0x1d35f0[_0x0f29('0xe')]?_0x3c6a6e['acwTimeout']:0x0;}utils[_0x0f29('0x12')]('CreateVoiceAgentReport',_0x1d35f0);});}else{utils[_0x0f29('0x12')](_0x0f29('0x13'),_0x1d35f0);}if(_0x4b16e4){delete transfers[_0x1d35f0[_0x0f29('0x4')]];}else{delete agents[_0x1d35f0[_0x0f29('0x14')]];}}exports[_0x0f29('0x15')]=function(_0x2d2573){try{utils['debug'](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x2d2573);agents[_0x2d2573[_0x0f29('0x14')]]=_0x2d2573;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();agents[_0x2d2573[_0x0f29('0x14')]]['lastevent']='called';agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x8')]=null;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x19')]=null;utils['info'](util[_0x0f29('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2d2573[_0x0f29('0x4')],agents[_0x2d2573['destuniqueid']]['membername'],_0x2d2573['destuniqueid']));}catch(_0x23a44f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x23a44f);}};exports[_0x0f29('0x1b')]=function(_0x150271){try{if(!_['isNil'](agents[_0x150271[_0x0f29('0x14')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x150271['uniqueid']),_0x150271);utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x150271[_0x0f29('0x4')],agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x6')],_0x150271[_0x0f29('0x14')]));agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswer']=!![];agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswerAt']=utils[_0x0f29('0x18')]();agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x1c');agents[_0x150271['destuniqueid']][_0x0f29('0x1d')]='timeout';agents[_0x150271['destuniqueid']][_0x0f29('0x1e')]=_0x150271['ringtime']?parseInt(_0x150271['ringtime'])/0x3e8:0x0;agents[_0x150271['destuniqueid']]['talktime']=0x0;unanswered[_0x0f29('0x1f')](_0x150271[_0x0f29('0x14')]);}}catch(_0x4cc5a0){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x20'),_0x150271['uniqueid']),_0x4cc5a0);}};exports['queuecallerabandon']=function(_0x37ebcc){try{_['forIn'](agents,function(_0x36b65c,_0x561c31){if(_0x36b65c['uniqueid']==_0x37ebcc[_0x0f29('0x4')]&&!_[_0x0f29('0x21')](unanswered,_0x36b65c[_0x0f29('0x14')])){utils[_0x0f29('0x22')](util['format']('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x37ebcc);utils['info'](util['format'](_0x0f29('0x23'),_0x37ebcc['uniqueid'],_0x36b65c[_0x0f29('0x6')],_0x36b65c['destuniqueid']));_0x36b65c['agentringnoanswer']=!![];_0x36b65c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x36b65c[_0x0f29('0x9')]=_0x0f29('0x25');_0x36b65c[_0x0f29('0x1d')]='abandoned';_0x36b65c[_0x0f29('0x1e')]=_0x37ebcc['holdtime'];_0x36b65c[_0x0f29('0x26')]=0x0;writeDB(_0x36b65c);}});}catch(_0x3e8f3f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')]('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x3e8f3f);}};exports[_0x0f29('0x27')]=function(_0x5be4fa){try{if(agents[_0x5be4fa[_0x0f29('0x14')]]){utils[_0x0f29('0x22')](util['format']('[%s][agents][agentconnect]',_0x5be4fa[_0x0f29('0x4')]),_0x5be4fa);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x28'),_0x5be4fa[_0x0f29('0x4')],agents[_0x5be4fa[_0x0f29('0x14')]]['membername'],_0x5be4fa[_0x0f29('0x14')]));agents[_0x5be4fa['destuniqueid']][_0x0f29('0x29')]=utils['now']();agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x8')]=_0x5be4fa[_0x0f29('0x8')];agents[_0x5be4fa['destuniqueid']]['connectedlinename']=_0x5be4fa[_0x0f29('0x19')];agents[_0x5be4fa['destuniqueid']][_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x2b');_['forIn'](agents,function(_0x13c05c,_0xf77c66){if(_0x13c05c[_0x0f29('0x14')]!=_0x5be4fa[_0x0f29('0x14')]&&_0x13c05c[_0x0f29('0x4')]==_0x5be4fa[_0x0f29('0x4')]){_0x13c05c[_0x0f29('0x26')]=0x0;_0x13c05c[_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];_0x13c05c['agentringnoanswer']=!![];_0x13c05c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x13c05c[_0x0f29('0x9')]=_0x0f29('0x2c');_0x13c05c['reason']=_0x0f29('0x2c');_0x13c05c[_0x0f29('0x2d')]=_0x5be4fa[_0x0f29('0x14')];_0x13c05c[_0x0f29('0x2e')]=_0x5be4fa[_0x0f29('0x6')];writeDB(_0x13c05c);}});}}catch(_0x56062d){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x2f'),_0x5be4fa['uniqueid']),_0x56062d);}};exports[_0x0f29('0xf')]=function(_0x284279){try{if(!_[_0x0f29('0x30')](agents[_0x284279[_0x0f29('0x14')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x284279);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x284279[_0x0f29('0x4')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x6')],_0x284279[_0x0f29('0x14')]));agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0xf')]=!![];agents[_0x284279['destuniqueid']][_0x0f29('0x32')]=utils['now']();agents[_0x284279[_0x0f29('0x14')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x32')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x29')]);agents[_0x284279['destuniqueid']][_0x0f29('0x1d')]=_0x284279[_0x0f29('0x1d')];agents[_0x284279[_0x0f29('0x14')]]['lastevent']=_0x0f29('0x34');writeDB(agents[_0x284279['destuniqueid']]);}}catch(_0x4fd625){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x4fd625);}};exports[_0x0f29('0x35')]=function(_0x335435){try{if(!_['isNil'](agents[_0x335435[_0x0f29('0x36')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x335435);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x38'),_0x335435[_0x0f29('0x4')],agents[_0x335435[_0x0f29('0x36')]]['membername'],agents[_0x335435['transfereruniqueid']][_0x0f29('0x4')]));agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x39')]=!![];agents[_0x335435[_0x0f29('0x36')]]['transfertype']=_0x0f29('0x3a');agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3b')]=_0x335435[_0x0f29('0x3c')];agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3d')]=agents[_0x335435[_0x0f29('0x36')]]['uniqueid'];}}catch(_0x17f33){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x17f33);}};exports[_0x0f29('0x3e')]=function(_0x5ec172){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x3f'),_0x5ec172['origtransfereruniqueid']),_0x5ec172);if(_0x5ec172[_0x0f29('0x40')]==_0x5ec172['origtransfererlinkedid']){if(!_[_0x0f29('0x30')](agents[_0x5ec172['secondtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x41')]][_0x0f29('0x6')]));agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x42')]=_0x0f29('0x43');agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x44')];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3d')]=_0x5ec172['origtransfereruniqueid'];}if(_0x5ec172[_0x0f29('0x45')]&&agents[_0x5ec172['transfereeuniqueid']]){agents[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x46')]=0x1;transfers[_0x5ec172[_0x0f29('0x45')]]=_['clone'](agents[_0x5ec172[_0x0f29('0x45')]]);transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x7')]=agents[_0x5ec172[_0x0f29('0x41')]]['calleridnum'];transfers[_0x5ec172[_0x0f29('0x45')]]['calleridname']=agents[_0x5ec172[_0x0f29('0x41')]]['calleridname'];transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x45')]]['agententerreason']=0x2;}}else if(_0x5ec172[_0x0f29('0x41')]==_0x5ec172[_0x0f29('0x47')]){if(!_[_0x0f29('0x30')](agents[_0x5ec172['origtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x48'),_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x40')]]['membername']));agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x42')]='ATTENDED';agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x49')];agents[_0x5ec172[_0x0f29('0x40')]]['transferuniqueid']=_0x5ec172['secondtransfereruniqueid'];}if(_0x5ec172['transfertargetuniqueid']&&agents[_0x5ec172[_0x0f29('0x4a')]]){agents[_0x5ec172[_0x0f29('0x4a')]]['agententerreason']=0x1;transfers[_0x5ec172[_0x0f29('0x4a')]]=_[_0x0f29('0x4b')](agents[_0x5ec172['transfertargetuniqueid']]);transfers[_0x5ec172[_0x0f29('0x4a')]]['calleridnum']=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x7')];transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x4c')]=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x4c')];transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x4a')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x46')]=0x2;}}}catch(_0x4bbc7e){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x3f'),_0x5ec172[_0x0f29('0x40')]),_0x4bbc7e);}};exports[_0x0f29('0x4d')]=function(_0x4bd8f1){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x4e'),_0x4bd8f1[_0x0f29('0x4')]),_0x4bd8f1);if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1[_0x0f29('0x4')]]['reason']===_0x0f29('0x1c')){if(_0x4bd8f1['cause']==='21'){agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')]=_0x0f29('0x4f');agents[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]=_0x0f29('0x4f');}utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1['uniqueid'],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']]['reason'],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);var _0x473eac=unanswered[_0x0f29('0x50')](_0x4bd8f1[_0x0f29('0x4')]);if(_0x473eac>-0x1){unanswered['splice'](_0x473eac,0x1);}}if(transfers[_0x4bd8f1[_0x0f29('0x4')]]){transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0xf')]=!![];transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')]=utils['now']();transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x26')]=utils[_0x0f29('0x33')](transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x29')]);transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=_0x0f29('0x51');transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],transfers[_0x4bd8f1[_0x0f29('0x4')]]['reason'],transfers[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]));writeDB(transfers[_0x4bd8f1[_0x0f29('0x4')]],!![]);}if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1['uniqueid']][_0x0f29('0x29')]){agents[_0x4bd8f1['uniqueid']][_0x0f29('0xf')]=!![];agents[_0x4bd8f1['uniqueid']][_0x0f29('0x32')]=utils[_0x0f29('0x18')]();agents[_0x4bd8f1[_0x0f29('0x4')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x4bd8f1['uniqueid']]['agentcompleteAt'],agents[_0x4bd8f1[_0x0f29('0x4')]]['agentconnectAt']);agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=agents[_0x4bd8f1['uniqueid']][_0x0f29('0x39')]?_0x0f29('0x39'):_0x0f29('0x51');agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);}}catch(_0x5e39a7){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x4e'),_0x4bd8f1['uniqueid']),_0x5e39a7);}}; \ No newline at end of file +var _0xb688=['agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','util','./utils','info','format','uniqueid','channel','queue','membername','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','reason','talktime','[%s][agents][queuecallerabandon]'];(function(_0x39a321,_0x18ebe3){var _0x2f90eb=function(_0xf940a8){while(--_0xf940a8){_0x39a321['push'](_0x39a321['shift']());}};_0x2f90eb(++_0x18ebe3);}(_0xb688,0xcf));var _0x8b68=function(_0x5d7463,_0x5d2f43){_0x5d7463=_0x5d7463-0x0;var _0x4dfc33=_0xb688[_0x5d7463];return _0x4dfc33;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var utils=require(_0x8b68('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x266285,_0x1080e8){utils[_0x8b68('0x2')](util[_0x8b68('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x266285[_0x8b68('0x4')],_0x266285[_0x8b68('0x5')],_0x266285[_0x8b68('0x6')],_0x266285[_0x8b68('0x7')],_0x266285['interface'],_0x266285[_0x8b68('0x8')],_0x266285['connectedlinenum'],_0x266285[_0x8b68('0x9')]));if(_0x266285[_0x8b68('0x6')]){utils[_0x8b68('0xa')](_0x266285[_0x8b68('0x6')])[_0x8b68('0xb')](function(_0x3f9685){if(_0x3f9685){_0x266285[_0x8b68('0xc')]=_0x3f9685[_0x8b68('0xc')];_0x266285[_0x8b68('0xd')]=_0x266285[_0x8b68('0xe')]?_0x3f9685[_0x8b68('0xf')]:![];_0x266285[_0x8b68('0x10')]=_0x266285[_0x8b68('0xd')]?_0x3f9685['acwTimeout']:0x0;}utils[_0x8b68('0x11')](_0x8b68('0x12'),_0x266285);});}else{utils[_0x8b68('0x11')](_0x8b68('0x12'),_0x266285);}if(_0x1080e8){delete transfers[_0x266285[_0x8b68('0x4')]];}else{delete agents[_0x266285[_0x8b68('0x13')]];}}exports[_0x8b68('0x14')]=function(_0x137c8e){try{utils[_0x8b68('0x15')](util['format'](_0x8b68('0x16'),_0x137c8e['uniqueid']),_0x137c8e);agents[_0x137c8e['destuniqueid']]=_0x137c8e;agents[_0x137c8e[_0x8b68('0x13')]][_0x8b68('0x17')]=utils[_0x8b68('0x18')]();agents[_0x137c8e['destuniqueid']]['lastevent']=_0x8b68('0x19');agents[_0x137c8e['destuniqueid']][_0x8b68('0x1a')]=null;agents[_0x137c8e[_0x8b68('0x13')]][_0x8b68('0x1b')]=null;utils[_0x8b68('0x2')](util['format'](_0x8b68('0x1c'),_0x137c8e[_0x8b68('0x4')],agents[_0x137c8e['destuniqueid']][_0x8b68('0x7')],_0x137c8e[_0x8b68('0x13')]));}catch(_0x3cf3bd){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')]('[%s][agents][agentcalled]',_0x137c8e[_0x8b68('0x4')]),_0x3cf3bd);}};exports[_0x8b68('0x1e')]=function(_0x59e9b1){try{if(!_[_0x8b68('0x1f')](agents[_0x59e9b1[_0x8b68('0x13')]])){utils[_0x8b68('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x59e9b1[_0x8b68('0x4')]),_0x59e9b1);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x20'),_0x59e9b1[_0x8b68('0x4')],agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x7')],_0x59e9b1[_0x8b68('0x13')]));agents[_0x59e9b1['destuniqueid']][_0x8b68('0x1e')]=!![];agents[_0x59e9b1[_0x8b68('0x13')]]['agentringnoanswerAt']=utils[_0x8b68('0x18')]();agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x9')]='timeout';agents[_0x59e9b1['destuniqueid']]['reason']=_0x8b68('0x21');agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x22')]=_0x59e9b1['ringtime']?parseInt(_0x59e9b1[_0x8b68('0x23')])/0x3e8:0x0;agents[_0x59e9b1['destuniqueid']]['talktime']=0x0;unanswered[_0x8b68('0x24')](_0x59e9b1['destuniqueid']);}}catch(_0x26cad7){utils[_0x8b68('0x1d')](util['format']('[%s][agents][agentringnoanswer]',_0x59e9b1[_0x8b68('0x4')]),_0x26cad7);}};exports[_0x8b68('0x25')]=function(_0x1e7c06){try{_[_0x8b68('0x26')](agents,function(_0x210926,_0x2ad2df){if(_0x210926[_0x8b68('0x4')]==_0x1e7c06['uniqueid']&&!_[_0x8b68('0x27')](unanswered,_0x210926['destuniqueid'])){utils[_0x8b68('0x15')](util[_0x8b68('0x3')]('[%s][agents][queuecallerabandon]',_0x1e7c06[_0x8b68('0x4')]),_0x1e7c06);utils[_0x8b68('0x2')](util[_0x8b68('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1e7c06['uniqueid'],_0x210926[_0x8b68('0x7')],_0x210926[_0x8b68('0x13')]));_0x210926[_0x8b68('0x1e')]=!![];_0x210926[_0x8b68('0x28')]=utils[_0x8b68('0x18')]();_0x210926[_0x8b68('0x9')]=_0x8b68('0x29');_0x210926[_0x8b68('0x2a')]=_0x8b68('0x29');_0x210926[_0x8b68('0x22')]=_0x1e7c06[_0x8b68('0x22')];_0x210926[_0x8b68('0x2b')]=0x0;writeDB(_0x210926);}});}catch(_0x232fa9){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')](_0x8b68('0x2c'),_0x1e7c06[_0x8b68('0x4')]),_0x232fa9);}};exports[_0x8b68('0x2d')]=function(_0x120b34){try{if(agents[_0x120b34[_0x8b68('0x13')]]){utils[_0x8b68('0x15')](util[_0x8b68('0x3')]('[%s][agents][agentconnect]',_0x120b34['uniqueid']),_0x120b34);utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x2e'),_0x120b34[_0x8b68('0x4')],agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x7')],_0x120b34[_0x8b68('0x13')]));agents[_0x120b34[_0x8b68('0x13')]]['agentconnectAt']=utils[_0x8b68('0x18')]();agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x1a')]=_0x120b34[_0x8b68('0x1a')];agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x1b')]=_0x120b34[_0x8b68('0x1b')];agents[_0x120b34[_0x8b68('0x13')]]['holdtime']=_0x120b34[_0x8b68('0x23')];agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x9')]=_0x8b68('0x2f');_[_0x8b68('0x26')](agents,function(_0x3b3394,_0xa748c2){if(_0x3b3394['destuniqueid']!=_0x120b34[_0x8b68('0x13')]&&_0x3b3394[_0x8b68('0x4')]==_0x120b34['uniqueid']){_0x3b3394[_0x8b68('0x2b')]=0x0;_0x3b3394[_0x8b68('0x22')]=_0x120b34['ringtime'];_0x3b3394['agentringnoanswer']=!![];_0x3b3394['agentringnoanswerAt']=utils['now']();_0x3b3394[_0x8b68('0x9')]=_0x8b68('0x30');_0x3b3394['reason']=_0x8b68('0x30');_0x3b3394['answeredelsewheredestinationuniqueid']=_0x120b34[_0x8b68('0x13')];_0x3b3394[_0x8b68('0x31')]=_0x120b34['membername'];writeDB(_0x3b3394);}});}}catch(_0x2f90d9){utils['error'](util['format']('[%s][agents][agentconnect]',_0x120b34[_0x8b68('0x4')]),_0x2f90d9);}};exports[_0x8b68('0xe')]=function(_0x3ba80e){try{if(!_[_0x8b68('0x1f')](agents[_0x3ba80e['destuniqueid']])){utils[_0x8b68('0x15')](util['format'](_0x8b68('0x32'),_0x3ba80e[_0x8b68('0x4')]),_0x3ba80e);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x33'),_0x3ba80e[_0x8b68('0x4')],agents[_0x3ba80e[_0x8b68('0x13')]]['membername'],_0x3ba80e[_0x8b68('0x13')]));agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0xe')]=!![];agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x34')],agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x36')]);agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x2a')]=_0x3ba80e[_0x8b68('0x2a')];agents[_0x3ba80e['destuniqueid']][_0x8b68('0x9')]=_0x8b68('0x37');writeDB(agents[_0x3ba80e['destuniqueid']]);}}catch(_0xeab810){utils['error'](util['format']('[%s][agents][agentcomplete]',_0x3ba80e[_0x8b68('0x4')]),_0xeab810);}};exports[_0x8b68('0x38')]=function(_0x34047c){try{if(!_[_0x8b68('0x1f')](agents[_0x34047c['transfereruniqueid']])){utils['debug'](util[_0x8b68('0x3')](_0x8b68('0x39'),_0x34047c[_0x8b68('0x4')]),_0x34047c);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x3a'),_0x34047c['uniqueid'],agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x7')],agents[_0x34047c['transfereruniqueid']][_0x8b68('0x4')]));agents[_0x34047c[_0x8b68('0x3b')]]['transfer']=!![];agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x3c')]='blind';agents[_0x34047c['transfereruniqueid']]['transferexten']=_0x34047c[_0x8b68('0x3d')];agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x3e')]=agents[_0x34047c[_0x8b68('0x3b')]]['uniqueid'];}}catch(_0x5a1711){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')](_0x8b68('0x39'),_0x34047c['uniqueid']),_0x5a1711);}};exports[_0x8b68('0x3f')]=function(_0xe1ba20){try{utils[_0x8b68('0x15')](util['format'](_0x8b68('0x40'),_0xe1ba20['origtransfereruniqueid']),_0xe1ba20);if(_0xe1ba20[_0x8b68('0x41')]==_0xe1ba20[_0x8b68('0x42')]){if(!_['isNil'](agents[_0xe1ba20[_0x8b68('0x43')]])){utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x44'),_0xe1ba20[_0x8b68('0x41')],agents[_0xe1ba20['secondtransfereruniqueid']][_0x8b68('0x7')]));agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x45')]=!![];agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x3c')]=_0x8b68('0x46');agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x47')]=_0xe1ba20['origtransfererexten'];agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x3e')]=_0xe1ba20[_0x8b68('0x41')];}if(_0xe1ba20[_0x8b68('0x48')]&&agents[_0xe1ba20[_0x8b68('0x48')]]){agents[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x49')]=0x1;transfers[_0xe1ba20[_0x8b68('0x48')]]=_[_0x8b68('0x4a')](agents[_0xe1ba20[_0x8b68('0x48')]]);transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x8')]=agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x8')];transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x4b')]=agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x4b')];transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x17')]=utils['now']();transfers[_0xe1ba20[_0x8b68('0x48')]]['agentconnectAt']=utils['now']();transfers[_0xe1ba20[_0x8b68('0x48')]]['holdtime']=0x0;transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x49')]=0x2;}}else if(_0xe1ba20[_0x8b68('0x43')]==_0xe1ba20['secondtransfererlinkedid']){if(!_[_0x8b68('0x1f')](agents[_0xe1ba20[_0x8b68('0x41')]])){utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x44'),_0xe1ba20[_0x8b68('0x41')],agents[_0xe1ba20[_0x8b68('0x41')]]['membername']));agents[_0xe1ba20['origtransfereruniqueid']][_0x8b68('0x45')]=!![];agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x3c')]=_0x8b68('0x46');agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x47')]=_0xe1ba20[_0x8b68('0x4c')];agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x3e')]=_0xe1ba20[_0x8b68('0x43')];}if(_0xe1ba20[_0x8b68('0x4d')]&&agents[_0xe1ba20[_0x8b68('0x4d')]]){agents[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x49')]=0x1;transfers[_0xe1ba20[_0x8b68('0x4d')]]=_[_0x8b68('0x4a')](agents[_0xe1ba20[_0x8b68('0x4d')]]);transfers[_0xe1ba20[_0x8b68('0x4d')]]['calleridnum']=agents[_0xe1ba20['origtransfereruniqueid']][_0x8b68('0x8')];transfers[_0xe1ba20[_0x8b68('0x4d')]]['calleridname']=agents[_0xe1ba20['origtransfereruniqueid']]['calleridname'];transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x17')]=utils[_0x8b68('0x18')]();transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x36')]=utils['now']();transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x22')]=0x0;transfers[_0xe1ba20['transfertargetuniqueid']][_0x8b68('0x49')]=0x2;}}}catch(_0x5aa883){utils['error'](util['format'](_0x8b68('0x40'),_0xe1ba20[_0x8b68('0x41')]),_0x5aa883);}};exports[_0x8b68('0x4e')]=function(_0x7269fd){try{utils[_0x8b68('0x15')](util[_0x8b68('0x3')](_0x8b68('0x4f'),_0x7269fd[_0x8b68('0x4')]),_0x7269fd);if(agents[_0x7269fd[_0x8b68('0x4')]]&&agents[_0x7269fd[_0x8b68('0x4')]]['reason']===_0x8b68('0x21')){if(_0x7269fd[_0x8b68('0x50')]==='21'){agents[_0x7269fd[_0x8b68('0x4')]]['reason']='rejected';agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]='rejected';}utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x51'),_0x7269fd[_0x8b68('0x4')],agents[_0x7269fd['uniqueid']][_0x8b68('0x7')],agents[_0x7269fd['uniqueid']]['reason'],agents[_0x7269fd[_0x8b68('0x4')]]['lastevent']));writeDB(agents[_0x7269fd[_0x8b68('0x4')]]);var _0x385eda=unanswered['indexOf'](_0x7269fd[_0x8b68('0x4')]);if(_0x385eda>-0x1){unanswered[_0x8b68('0x52')](_0x385eda,0x1);}}if(transfers[_0x7269fd[_0x8b68('0x4')]]){transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0xe')]=!![];transfers[_0x7269fd['uniqueid']][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](transfers[_0x7269fd['uniqueid']]['agentcompleteAt'],transfers[_0x7269fd[_0x8b68('0x4')]]['agentconnectAt']);transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')]=_0x8b68('0x53');transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]=_0x8b68('0x37');utils[_0x8b68('0x2')](util['format'](_0x8b68('0x51'),_0x7269fd['uniqueid'],transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x7')],transfers[_0x7269fd[_0x8b68('0x4')]]['reason'],transfers[_0x7269fd[_0x8b68('0x4')]]['lastevent']));writeDB(transfers[_0x7269fd[_0x8b68('0x4')]],!![]);}if(agents[_0x7269fd['uniqueid']]&&agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x36')]){agents[_0x7269fd[_0x8b68('0x4')]]['agentcomplete']=!![];agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x34')],agents[_0x7269fd[_0x8b68('0x4')]]['agentconnectAt']);agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')]=agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x45')]?_0x8b68('0x45'):'agent';agents[_0x7269fd[_0x8b68('0x4')]]['lastevent']=_0x8b68('0x37');utils[_0x8b68('0x2')](util['format'](_0x8b68('0x51'),_0x7269fd[_0x8b68('0x4')],agents[_0x7269fd[_0x8b68('0x4')]]['membername'],agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')],agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]));writeDB(agents[_0x7269fd[_0x8b68('0x4')]]);}}catch(_0x42464c){utils['error'](util[_0x8b68('0x3')](_0x8b68('0x4f'),_0x7269fd[_0x8b68('0x4')]),_0x42464c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 055e51e..40e61cd 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 _0x38ba=['endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','userfield','origtransfererchannel','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','channel','now','DOCUMENTATION','error','newstate','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s'];(function(_0x53f0f0,_0x1e0a0d){var _0x3192dd=function(_0x35011e){while(--_0x35011e){_0x53f0f0['push'](_0x53f0f0['shift']());}};_0x3192dd(++_0x1e0a0d);}(_0x38ba,0x10b));var _0xa38b=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x38ba[_0x609988];return _0x159984;};'use strict';var _=require(_0xa38b('0x0'));var util=require('util');var utils=require(_0xa38b('0x1'));var dispositions=[_0xa38b('0x2'),_0xa38b('0x3'),_0xa38b('0x3'),_0xa38b('0x2'),_0xa38b('0x2'),_0xa38b('0x2'),_0xa38b('0x4'),_0xa38b('0x5'),_0xa38b('0x3'),_0xa38b('0x3'),_0xa38b('0x3')];var channels={};function writeDB(_0x55ad9d){utils[_0xa38b('0x6')](util[_0xa38b('0x7')](_0xa38b('0x8'),_0x55ad9d[_0xa38b('0x9')],_0x55ad9d['channel'],_0x55ad9d[_0xa38b('0xa')],_0x55ad9d[_0xa38b('0xb')],_0x55ad9d['interface'],_0x55ad9d[_0xa38b('0xc')],_0x55ad9d[_0xa38b('0xd')],_0x55ad9d[_0xa38b('0xe')]));if(_0x55ad9d[_0xa38b('0xf')]){utils['getUserByInternal'](_0x55ad9d[_0xa38b('0xf')])[_0xa38b('0x10')](function(_0x5c3fbf){if(_0x5c3fbf){_0x55ad9d[_0xa38b('0x11')]=_0x5c3fbf['id'];}utils[_0xa38b('0x12')](_0xa38b('0x13'),_0x55ad9d);});}else{utils[_0xa38b('0x12')]('CreateVoiceCallReport',_0x55ad9d);}if(channels[_0x55ad9d[_0xa38b('0x9')]]){delete channels[_0x55ad9d['uniqueid']];}}exports[_0xa38b('0x14')]=function(_0x44d40f){try{utils[_0xa38b('0x15')](util['format'](_0xa38b('0x16'),_0x44d40f[_0xa38b('0x9')]),_0x44d40f);if(_0x44d40f[_0xa38b('0x9')]==_0x44d40f[_0xa38b('0x17')]&&_0x44d40f['channel']!=_0xa38b('0x18')){utils['info'](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x44d40f[_0xa38b('0x9')],_0x44d40f[_0xa38b('0x19')],_0x44d40f[_0xa38b('0x1a')]));channels[_0x44d40f[_0xa38b('0x9')]]={'uniqueid':_0x44d40f['uniqueid'],'accountcode':_0x44d40f['accountcode'],'source':_0x44d40f['calleridnum'],'destination':_0x44d40f[_0xa38b('0x1a')],'destinationcontext':_0x44d40f[_0xa38b('0x19')],'channel':_0x44d40f[_0xa38b('0x1b')],'starttime':utils[_0xa38b('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa38b('0x2'),'amaflags':_0xa38b('0x1d')};}}catch(_0x2b4dc3){utils[_0xa38b('0x1e')](util[_0xa38b('0x7')](_0xa38b('0x16'),_0x44d40f[_0xa38b('0x9')]),_0x2b4dc3);}};exports[_0xa38b('0x1f')]=function(_0x95e85a){try{utils[_0xa38b('0x15')](util['format']('[%s][calls][newstate]',_0x95e85a[_0xa38b('0x9')]),_0x95e85a);if(!_['isNil'](channels[_0x95e85a[_0xa38b('0x9')]])&&_0x95e85a[_0xa38b('0x20')]==0x6){utils[_0xa38b('0x6')](util[_0xa38b('0x7')](_0xa38b('0x21'),_0x95e85a[_0xa38b('0x9')],_0x95e85a[_0xa38b('0x19')],_0x95e85a['channel']));if(_[_0xa38b('0x22')](channels[_0x95e85a[_0xa38b('0x9')]][_0xa38b('0x23')])){channels[_0x95e85a['uniqueid']][_0xa38b('0x23')]=utils[_0xa38b('0x1c')]();}}else if(!_[_0xa38b('0x22')](channels[_0x95e85a[_0xa38b('0x17')]])&&_0x95e85a[_0xa38b('0x20')]==0x6&&_0x95e85a[_0xa38b('0x19')]!=_0xa38b('0x24')){utils[_0xa38b('0x6')](util[_0xa38b('0x7')](_0xa38b('0x25'),_0x95e85a[_0xa38b('0x9')],_0x95e85a[_0xa38b('0x17')],_0x95e85a['context'],_0x95e85a[_0xa38b('0x1b')]));channels[_0x95e85a['linkedid']][_0xa38b('0xf')]=_0x95e85a['accountcode'];channels[_0x95e85a[_0xa38b('0x17')]][_0xa38b('0x26')]=_0x95e85a['channel'];if(_[_0xa38b('0x22')](channels[_0x95e85a[_0xa38b('0x17')]][_0xa38b('0x27')])){channels[_0x95e85a['linkedid']]['answertime']=utils[_0xa38b('0x1c')]();}channels[_0x95e85a[_0xa38b('0x17')]][_0xa38b('0x28')]=dispositions[_[_0xa38b('0x29')](_0x95e85a[_0xa38b('0x20')])]||'ANSWERED';}}catch(_0x350990){utils[_0xa38b('0x1e')](util['format'](_0xa38b('0x2a'),_0x95e85a[_0xa38b('0x9')]),_0x350990);}};exports[_0xa38b('0x2b')]=function(_0x170604){try{if(!_[_0xa38b('0x22')](channels[_0x170604[_0xa38b('0x9')]])){utils[_0xa38b('0x15')](util[_0xa38b('0x7')](_0xa38b('0x2c'),_0x170604['uniqueid']),_0x170604);if(_[_0xa38b('0x22')](channels[_0x170604[_0xa38b('0x9')]][_0xa38b('0x2d')])){channels[_0x170604['uniqueid']][_0xa38b('0x2d')]=_0x170604[_0xa38b('0x2e')]+'\x20<'+_0x170604[_0xa38b('0xc')]+'>';}utils[_0xa38b('0x6')](util[_0xa38b('0x7')](_0xa38b('0x2f'),_0x170604['uniqueid'],channels[_0x170604[_0xa38b('0x9')]][_0xa38b('0x2d')],_0x170604['cause-txt']));channels[_0x170604[_0xa38b('0x9')]][_0xa38b('0x30')]=utils['now']();channels[_0x170604[_0xa38b('0x9')]][_0xa38b('0x31')]=utils['diffTime'](channels[_0x170604[_0xa38b('0x9')]]['endtime'],channels[_0x170604[_0xa38b('0x9')]][_0xa38b('0x32')]);channels[_0x170604[_0xa38b('0x9')]][_0xa38b('0x33')]=channels[_0x170604['uniqueid']]['answertime']?utils[_0xa38b('0x34')](channels[_0x170604[_0xa38b('0x9')]]['endtime'],channels[_0x170604[_0xa38b('0x9')]]['answertime']):0x0;writeDB(channels[_0x170604[_0xa38b('0x9')]]);}}catch(_0x1967f7){utils[_0xa38b('0x1e')](util[_0xa38b('0x7')](_0xa38b('0x2c'),_0x170604[_0xa38b('0x9')]),_0x1967f7);}};exports[_0xa38b('0x35')]=function(_0x47f836){try{if(!_[_0xa38b('0x22')](channels[_0x47f836['localtwolinkedid']])){utils['debug'](util['format'](_0xa38b('0x36'),_0x47f836[_0xa38b('0x37')]),_0x47f836);if(channels[_0x47f836['localtwolinkedid']]['channel']==_0x47f836[_0xa38b('0x38')]){utils[_0xa38b('0x6')](util[_0xa38b('0x7')](_0xa38b('0x39'),_0x47f836[_0xa38b('0x37')],_0x47f836[_0xa38b('0x3a')],_0x47f836[_0xa38b('0x3b')]));channels[_0x47f836[_0xa38b('0x3a')]]['destinationchannel']=_0x47f836[_0xa38b('0x3b')];channels[_0x47f836[_0xa38b('0x3a')]][_0xa38b('0x3c')]='_attended';}else if(channels[_0x47f836[_0xa38b('0x3a')]][_0xa38b('0x1b')]=_0x47f836['transfertargetchannel']){utils[_0xa38b('0x6')](util['format'](_0xa38b('0x39'),_0x47f836[_0xa38b('0x37')],_0x47f836[_0xa38b('0x3a')],_0x47f836[_0xa38b('0x3d')]));channels[_0x47f836[_0xa38b('0x3a')]]['destinationchannel']=_0x47f836[_0xa38b('0x3d')];channels[_0x47f836[_0xa38b('0x3a')]][_0xa38b('0x3c')]=_0xa38b('0x3e');}}}catch(_0x5e5fa0){utils[_0xa38b('0x1e')](util[_0xa38b('0x7')](_0xa38b('0x36'),_0x47f836[_0xa38b('0x37')]),_0x5e5fa0);}};exports['musiconholdstart']=function(_0x1769c2){try{if(!_[_0xa38b('0x22')](channels[_0x1769c2[_0xa38b('0x9')]])){utils[_0xa38b('0x15')](util[_0xa38b('0x7')](_0xa38b('0x3f'),_0x1769c2['uniqueid']),_0x1769c2);channels[_0x1769c2['uniqueid']][_0xa38b('0x40')]=utils[_0xa38b('0x1c')]();utils['info'](util['format'](_0xa38b('0x41'),_0x1769c2[_0xa38b('0x9')],channels[_0x1769c2['uniqueid']][_0xa38b('0x40')]));}}catch(_0x3851b9){utils[_0xa38b('0x1e')](util[_0xa38b('0x7')]('[%s][calls][musiconholdstart]',_0x1769c2[_0xa38b('0x9')]),_0x3851b9);}};exports[_0xa38b('0x42')]=function(_0x5853fa){try{if(!_[_0xa38b('0x22')](channels[_0x5853fa[_0xa38b('0x9')]])){utils[_0xa38b('0x15')](util[_0xa38b('0x7')](_0xa38b('0x43'),_0x5853fa[_0xa38b('0x9')]),_0x5853fa);if(!_['isNil'](channels[_0x5853fa[_0xa38b('0x9')]][_0xa38b('0x40')])){channels[_0x5853fa[_0xa38b('0x9')]]['mohtime']+=utils['diffTime'](utils[_0xa38b('0x1c')](),channels[_0x5853fa[_0xa38b('0x9')]][_0xa38b('0x40')]);utils[_0xa38b('0x6')](util[_0xa38b('0x7')](_0xa38b('0x44'),_0x5853fa['uniqueid'],channels[_0x5853fa[_0xa38b('0x9')]][_0xa38b('0x45')]));delete channels[_0x5853fa[_0xa38b('0x9')]][_0xa38b('0x40')];}}}catch(_0x4d9089){utils[_0xa38b('0x1e')](util[_0xa38b('0x7')](_0xa38b('0x43'),_0x5853fa['uniqueid']),_0x4d9089);}};exports[_0xa38b('0x46')]=function(_0x4eb08e){try{if(!_[_0xa38b('0x22')](channels[_0x4eb08e[_0xa38b('0x9')]])){utils[_0xa38b('0x15')](util[_0xa38b('0x7')](_0xa38b('0x47'),_0x4eb08e['uniqueid']),_0x4eb08e);if(!_[_0xa38b('0x22')](_0x4eb08e[_0xa38b('0x48')][_0xa38b('0x49')])){utils['info'](util['format'](_0xa38b('0x4a'),_0x4eb08e[_0xa38b('0x9')],_0x4eb08e[_0xa38b('0x4b')]));channels[_0x4eb08e[_0xa38b('0x9')]]['source']=_0x4eb08e[_0xa38b('0x4b')];}if(!_[_0xa38b('0x22')](_0x4eb08e['variable']['xmd-phone'])){utils[_0xa38b('0x6')](util[_0xa38b('0x7')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4eb08e[_0xa38b('0x9')],_0x4eb08e[_0xa38b('0x4b')]));channels[_0x4eb08e[_0xa38b('0x9')]][_0xa38b('0x4c')]=_0x4eb08e[_0xa38b('0x4b')];channels[_0x4eb08e[_0xa38b('0x9')]][_0xa38b('0x2d')]='\x22'+_0x4eb08e[_0xa38b('0x4b')]+'\x22\x20<'+_0x4eb08e['value']+'>';}if(!_['isNil'](_0x4eb08e[_0xa38b('0x48')][_0xa38b('0x4d')])||!_['isNil'](_0x4eb08e[_0xa38b('0x48')][_0xa38b('0x4e')])){utils[_0xa38b('0x6')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4eb08e[_0xa38b('0x9')],!_['isNil'](_0x4eb08e[_0xa38b('0x48')]['xmd-callerid-preview'])?_0xa38b('0x4d'):_0xa38b('0x4e'),_0x4eb08e[_0xa38b('0x4b')]));channels[_0x4eb08e[_0xa38b('0x9')]][_0xa38b('0x2d')]=_0x4eb08e[_0xa38b('0x4b')];}if(!_[_0xa38b('0x22')](_0x4eb08e[_0xa38b('0x48')][_0xa38b('0x4f')])||!_[_0xa38b('0x22')](_0x4eb08e[_0xa38b('0x48')][_0xa38b('0x50')])){utils[_0xa38b('0x6')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4eb08e['uniqueid'],!_['isNil'](_0x4eb08e[_0xa38b('0x48')][_0xa38b('0x4f')])?_0xa38b('0x4f'):'xmcs-queue',_0x4eb08e['value']));channels[_0x4eb08e['uniqueid']][_0xa38b('0x51')]=_0xa38b('0x52');channels[_0x4eb08e[_0xa38b('0x9')]][_0xa38b('0x53')]=_0x4eb08e['value'];channels[_0x4eb08e[_0xa38b('0x9')]][_0xa38b('0xa')]=!![];}if(!_[_0xa38b('0x22')](_0x4eb08e['variable'][_0xa38b('0x54')])){utils['info'](util['format'](_0xa38b('0x55'),_0x4eb08e['uniqueid'],_0x4eb08e[_0xa38b('0x4b')]));channels[_0x4eb08e[_0xa38b('0x9')]]['ContactId']=_0x4eb08e[_0xa38b('0x4b')];}if(!_[_0xa38b('0x22')](_0x4eb08e[_0xa38b('0x48')]['xmd-cdrtype'])){utils[_0xa38b('0x6')](util['format'](_0xa38b('0x56'),_0x4eb08e['uniqueid'],_0x4eb08e[_0xa38b('0x4b')]));channels[_0x4eb08e['uniqueid']][_0xa38b('0x57')]=_0x4eb08e[_0xa38b('0x4b')];}if(!_[_0xa38b('0x22')](_0x4eb08e[_0xa38b('0x48')]['outboundrouteid'])){utils[_0xa38b('0x6')](util[_0xa38b('0x7')](_0xa38b('0x58'),_0x4eb08e[_0xa38b('0x9')],_0x4eb08e[_0xa38b('0x4b')]));channels[_0x4eb08e[_0xa38b('0x9')]][_0xa38b('0x59')]=_0x4eb08e[_0xa38b('0x4b')];}if(!_[_0xa38b('0x22')](_0x4eb08e[_0xa38b('0x48')][_0xa38b('0x5a')])){utils['info'](util[_0xa38b('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x4eb08e[_0xa38b('0x9')],_0x4eb08e['value']));channels[_0x4eb08e[_0xa38b('0x9')]][_0xa38b('0x5a')]=_0x4eb08e[_0xa38b('0x4b')];}}}catch(_0x1db932){utils[_0xa38b('0x1e')](util[_0xa38b('0x7')](_0xa38b('0x47'),_0x4eb08e['uniqueid']),_0x1db932);}};exports[_0xa38b('0x5b')]=function(_0x282b2d){try{if(!_[_0xa38b('0x22')](channels[_0x282b2d[_0xa38b('0x9')]])){utils[_0xa38b('0x15')](util[_0xa38b('0x7')]('[%s][calls][newexten]',_0x282b2d[_0xa38b('0x9')]),_0x282b2d);utils[_0xa38b('0x6')](util[_0xa38b('0x7')](_0xa38b('0x5c'),_0x282b2d[_0xa38b('0x9')],_0x282b2d[_0xa38b('0x5d')],_0x282b2d[_0xa38b('0x5e')]));if(_0x282b2d[_0xa38b('0x5d')][_0xa38b('0x5f')]()==_0xa38b('0x60')&&_[_0xa38b('0x61')](_0x282b2d[_0xa38b('0x5e')][_0xa38b('0x5f')](),'cdr')){var _0x425df0=_0x282b2d[_0xa38b('0x5e')][_0xa38b('0x62')]('=');var _0x8945ee=_0x425df0[0x0][_0xa38b('0x63')](_0x425df0[0x0][_0xa38b('0x64')]('(')+0x1,_0x425df0[0x0][_0xa38b('0x64')](')'));var _0x3a03f7=_0x425df0[0x1];channels[_0x282b2d[_0xa38b('0x9')]][_0x8945ee]=_0x3a03f7;}if(!_[_0xa38b('0x65')](['hangup',_0xa38b('0x66'),_0xa38b('0x67'),_0xa38b('0x60'),_0xa38b('0x68')],_0x282b2d[_0xa38b('0x5d')][_0xa38b('0x5f')]())){channels[_0x282b2d['uniqueid']][_0xa38b('0x51')]=_0x282b2d[_0xa38b('0x5d')];channels[_0x282b2d[_0xa38b('0x9')]][_0xa38b('0x53')]=_0x282b2d[_0xa38b('0x5e')];}}}catch(_0x145671){utils[_0xa38b('0x1e')](util[_0xa38b('0x7')]('[%s][calls][newexten]',_0x282b2d[_0xa38b('0x9')]),_0x145671);}}; \ No newline at end of file +var _0x7dfb=['execif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','format','uniqueid','channel','membername','calleridnum','connectedlinenum','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','duration','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','xmd-phone','destination','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','lastIndexOf','includes','noop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dfb,0x1ad));var _0xb7df=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7dfb[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0xb7df('0x0'));var util=require(_0xb7df('0x1'));var utils=require(_0xb7df('0x2'));var dispositions=[_0xb7df('0x3'),_0xb7df('0x4'),_0xb7df('0x4'),_0xb7df('0x3'),_0xb7df('0x3'),_0xb7df('0x3'),_0xb7df('0x5'),'BUSY',_0xb7df('0x4'),'FAILED',_0xb7df('0x4')];var channels={};function writeDB(_0x583560){utils['info'](util[_0xb7df('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x583560[_0xb7df('0x7')],_0x583560[_0xb7df('0x8')],_0x583560['queue'],_0x583560[_0xb7df('0x9')],_0x583560['interface'],_0x583560[_0xb7df('0xa')],_0x583560[_0xb7df('0xb')],_0x583560['lastevent']));if(_0x583560[_0xb7df('0xc')]){utils['getUserByInternal'](_0x583560[_0xb7df('0xc')])[_0xb7df('0xd')](function(_0x31fb95){if(_0x31fb95){_0x583560[_0xb7df('0xe')]=_0x31fb95['id'];}utils['request'](_0xb7df('0xf'),_0x583560);});}else{utils[_0xb7df('0x10')](_0xb7df('0xf'),_0x583560);}if(channels[_0x583560['uniqueid']]){delete channels[_0x583560[_0xb7df('0x7')]];}}exports[_0xb7df('0x11')]=function(_0x3f128a){try{utils['debug'](util[_0xb7df('0x6')](_0xb7df('0x12'),_0x3f128a[_0xb7df('0x7')]),_0x3f128a);if(_0x3f128a['uniqueid']==_0x3f128a['linkedid']&&_0x3f128a[_0xb7df('0x8')]!=_0xb7df('0x13')){utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x15'),_0x3f128a['uniqueid'],_0x3f128a[_0xb7df('0x16')],_0x3f128a[_0xb7df('0x17')]));channels[_0x3f128a['uniqueid']]={'uniqueid':_0x3f128a[_0xb7df('0x7')],'accountcode':_0x3f128a[_0xb7df('0xc')],'source':_0x3f128a[_0xb7df('0xa')],'destination':_0x3f128a[_0xb7df('0x17')],'destinationcontext':_0x3f128a[_0xb7df('0x16')],'channel':_0x3f128a['channel'],'starttime':utils[_0xb7df('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xb7df('0x3'),'amaflags':_0xb7df('0x19')};}}catch(_0x2f2c70){utils['error'](util[_0xb7df('0x6')](_0xb7df('0x12'),_0x3f128a['uniqueid']),_0x2f2c70);}};exports['newstate']=function(_0x229937){try{utils[_0xb7df('0x1a')](util[_0xb7df('0x6')](_0xb7df('0x1b'),_0x229937['uniqueid']),_0x229937);if(!_[_0xb7df('0x1c')](channels[_0x229937[_0xb7df('0x7')]])&&_0x229937[_0xb7df('0x1d')]==0x6){utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x1e'),_0x229937[_0xb7df('0x7')],_0x229937['context'],_0x229937[_0xb7df('0x8')]));if(_[_0xb7df('0x1c')](channels[_0x229937[_0xb7df('0x7')]][_0xb7df('0x1f')])){channels[_0x229937[_0xb7df('0x7')]][_0xb7df('0x1f')]=utils[_0xb7df('0x18')]();}}else if(!_[_0xb7df('0x1c')](channels[_0x229937[_0xb7df('0x20')]])&&_0x229937[_0xb7df('0x1d')]==0x6&&_0x229937[_0xb7df('0x16')]!='transfer'){utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x21'),_0x229937[_0xb7df('0x7')],_0x229937[_0xb7df('0x20')],_0x229937['context'],_0x229937[_0xb7df('0x8')]));channels[_0x229937[_0xb7df('0x20')]][_0xb7df('0xc')]=_0x229937['accountcode'];channels[_0x229937[_0xb7df('0x20')]][_0xb7df('0x22')]=_0x229937[_0xb7df('0x8')];if(_['isNil'](channels[_0x229937[_0xb7df('0x20')]][_0xb7df('0x23')])){channels[_0x229937['linkedid']][_0xb7df('0x23')]=utils[_0xb7df('0x18')]();}channels[_0x229937[_0xb7df('0x20')]][_0xb7df('0x24')]=dispositions[_['toNumber'](_0x229937['channelstate'])]||'ANSWERED';}}catch(_0x4e95c4){utils[_0xb7df('0x25')](util[_0xb7df('0x6')]('[%s][calls][newstate]',_0x229937[_0xb7df('0x7')]),_0x4e95c4);}};exports[_0xb7df('0x26')]=function(_0x56f188){try{if(!_[_0xb7df('0x1c')](channels[_0x56f188[_0xb7df('0x7')]])){utils[_0xb7df('0x1a')](util['format'](_0xb7df('0x27'),_0x56f188[_0xb7df('0x7')]),_0x56f188);if(_[_0xb7df('0x1c')](channels[_0x56f188[_0xb7df('0x7')]]['callerid'])){channels[_0x56f188[_0xb7df('0x7')]][_0xb7df('0x28')]=_0x56f188[_0xb7df('0x29')]+'\x20<'+_0x56f188[_0xb7df('0xa')]+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x56f188[_0xb7df('0x7')],channels[_0x56f188[_0xb7df('0x7')]]['callerid'],_0x56f188[_0xb7df('0x2a')]));channels[_0x56f188[_0xb7df('0x7')]]['endtime']=utils[_0xb7df('0x18')]();channels[_0x56f188[_0xb7df('0x7')]][_0xb7df('0x2b')]=utils['diffTime'](channels[_0x56f188['uniqueid']][_0xb7df('0x2c')],channels[_0x56f188[_0xb7df('0x7')]][_0xb7df('0x2d')]);channels[_0x56f188['uniqueid']][_0xb7df('0x2e')]=channels[_0x56f188['uniqueid']][_0xb7df('0x23')]?utils[_0xb7df('0x2f')](channels[_0x56f188[_0xb7df('0x7')]][_0xb7df('0x2c')],channels[_0x56f188[_0xb7df('0x7')]]['answertime']):0x0;writeDB(channels[_0x56f188['uniqueid']]);}}catch(_0x27ebfe){utils[_0xb7df('0x25')](util[_0xb7df('0x6')](_0xb7df('0x27'),_0x56f188[_0xb7df('0x7')]),_0x27ebfe);}};exports[_0xb7df('0x30')]=function(_0x294113){try{if(!_[_0xb7df('0x1c')](channels[_0x294113[_0xb7df('0x31')]])){utils[_0xb7df('0x1a')](util['format'](_0xb7df('0x32'),_0x294113[_0xb7df('0x33')]),_0x294113);if(channels[_0x294113[_0xb7df('0x31')]]['channel']==_0x294113[_0xb7df('0x34')]){utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x35'),_0x294113[_0xb7df('0x33')],_0x294113['localtwolinkedid'],_0x294113[_0xb7df('0x36')]));channels[_0x294113['localtwolinkedid']][_0xb7df('0x22')]=_0x294113['secondtransfererchannel'];channels[_0x294113['localtwolinkedid']]['userfield']=_0xb7df('0x37');}else if(channels[_0x294113[_0xb7df('0x31')]][_0xb7df('0x8')]=_0x294113['transfertargetchannel']){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x294113[_0xb7df('0x33')],_0x294113[_0xb7df('0x31')],_0x294113[_0xb7df('0x38')]));channels[_0x294113[_0xb7df('0x31')]]['destinationchannel']=_0x294113[_0xb7df('0x38')];channels[_0x294113[_0xb7df('0x31')]][_0xb7df('0x39')]=_0xb7df('0x37');}}}catch(_0x3ee0fb){utils[_0xb7df('0x25')](util[_0xb7df('0x6')](_0xb7df('0x32'),_0x294113[_0xb7df('0x33')]),_0x3ee0fb);}};exports[_0xb7df('0x3a')]=function(_0x4dacec){try{if(!_[_0xb7df('0x1c')](channels[_0x4dacec['uniqueid']])){utils[_0xb7df('0x1a')](util[_0xb7df('0x6')](_0xb7df('0x3b'),_0x4dacec[_0xb7df('0x7')]),_0x4dacec);channels[_0x4dacec[_0xb7df('0x7')]][_0xb7df('0x3c')]=utils[_0xb7df('0x18')]();utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x3d'),_0x4dacec[_0xb7df('0x7')],channels[_0x4dacec[_0xb7df('0x7')]]['musiconholdstartAt']));}}catch(_0x1b88a2){utils[_0xb7df('0x25')](util[_0xb7df('0x6')](_0xb7df('0x3b'),_0x4dacec[_0xb7df('0x7')]),_0x1b88a2);}};exports[_0xb7df('0x3e')]=function(_0x29c6d0){try{if(!_[_0xb7df('0x1c')](channels[_0x29c6d0[_0xb7df('0x7')]])){utils[_0xb7df('0x1a')](util[_0xb7df('0x6')]('[%s][calls][musiconholdstop]',_0x29c6d0['uniqueid']),_0x29c6d0);if(!_[_0xb7df('0x1c')](channels[_0x29c6d0[_0xb7df('0x7')]]['musiconholdstartAt'])){channels[_0x29c6d0[_0xb7df('0x7')]][_0xb7df('0x3f')]+=utils[_0xb7df('0x2f')](utils[_0xb7df('0x18')](),channels[_0x29c6d0[_0xb7df('0x7')]][_0xb7df('0x3c')]);utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x40'),_0x29c6d0[_0xb7df('0x7')],channels[_0x29c6d0[_0xb7df('0x7')]][_0xb7df('0x3f')]));delete channels[_0x29c6d0[_0xb7df('0x7')]][_0xb7df('0x3c')];}}}catch(_0x2a9eb5){utils['error'](util[_0xb7df('0x6')]('[%s][calls][musiconholdstop]',_0x29c6d0[_0xb7df('0x7')]),_0x2a9eb5);}};exports['varset']=function(_0x2c33ce){try{if(!_[_0xb7df('0x1c')](channels[_0x2c33ce[_0xb7df('0x7')]])){utils[_0xb7df('0x1a')](util[_0xb7df('0x6')](_0xb7df('0x41'),_0x2c33ce[_0xb7df('0x7')]),_0x2c33ce);if(!_['isNil'](_0x2c33ce[_0xb7df('0x42')][_0xb7df('0x43')])){utils[_0xb7df('0x14')](util['format'](_0xb7df('0x44'),_0x2c33ce['uniqueid'],_0x2c33ce['value']));channels[_0x2c33ce[_0xb7df('0x7')]][_0xb7df('0x45')]=_0x2c33ce['value'];}if(!_[_0xb7df('0x1c')](_0x2c33ce[_0xb7df('0x42')][_0xb7df('0x46')])){utils[_0xb7df('0x14')](util[_0xb7df('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2c33ce['uniqueid'],_0x2c33ce['value']));channels[_0x2c33ce['uniqueid']][_0xb7df('0x47')]=_0x2c33ce[_0xb7df('0x48')];channels[_0x2c33ce['uniqueid']]['callerid']='\x22'+_0x2c33ce['value']+_0xb7df('0x49')+_0x2c33ce[_0xb7df('0x48')]+'>';}if(!_[_0xb7df('0x1c')](_0x2c33ce[_0xb7df('0x42')][_0xb7df('0x4a')])||!_[_0xb7df('0x1c')](_0x2c33ce['variable']['xmd-callerid'])){utils[_0xb7df('0x14')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2c33ce[_0xb7df('0x7')],!_[_0xb7df('0x1c')](_0x2c33ce[_0xb7df('0x42')][_0xb7df('0x4a')])?_0xb7df('0x4a'):_0xb7df('0x4b'),_0x2c33ce[_0xb7df('0x48')]));channels[_0x2c33ce[_0xb7df('0x7')]][_0xb7df('0x28')]=_0x2c33ce[_0xb7df('0x48')];}if(!_['isNil'](_0x2c33ce[_0xb7df('0x42')][_0xb7df('0x4c')])||!_[_0xb7df('0x1c')](_0x2c33ce[_0xb7df('0x42')]['xmcs-queue'])){utils['info'](util[_0xb7df('0x6')](_0xb7df('0x4d'),_0x2c33ce['uniqueid'],!_['isNil'](_0x2c33ce[_0xb7df('0x42')][_0xb7df('0x4c')])?_0xb7df('0x4c'):_0xb7df('0x4e'),_0x2c33ce['value']));channels[_0x2c33ce['uniqueid']][_0xb7df('0x4f')]='Queue';channels[_0x2c33ce[_0xb7df('0x7')]][_0xb7df('0x50')]=_0x2c33ce[_0xb7df('0x48')];channels[_0x2c33ce[_0xb7df('0x7')]][_0xb7df('0x51')]=!![];}if(!_[_0xb7df('0x1c')](_0x2c33ce[_0xb7df('0x42')][_0xb7df('0x52')])){utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x53'),_0x2c33ce[_0xb7df('0x7')],_0x2c33ce[_0xb7df('0x48')]));channels[_0x2c33ce[_0xb7df('0x7')]][_0xb7df('0x54')]=_0x2c33ce[_0xb7df('0x48')];}if(!_[_0xb7df('0x1c')](_0x2c33ce['variable'][_0xb7df('0x55')])){utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x56'),_0x2c33ce[_0xb7df('0x7')],_0x2c33ce[_0xb7df('0x48')]));channels[_0x2c33ce[_0xb7df('0x7')]][_0xb7df('0x57')]=_0x2c33ce[_0xb7df('0x48')];}if(!_[_0xb7df('0x1c')](_0x2c33ce['variable'][_0xb7df('0x58')])){utils['info'](util[_0xb7df('0x6')](_0xb7df('0x59'),_0x2c33ce[_0xb7df('0x7')],_0x2c33ce[_0xb7df('0x48')]));channels[_0x2c33ce[_0xb7df('0x7')]][_0xb7df('0x5a')]=_0x2c33ce[_0xb7df('0x48')];}if(!_['isNil'](_0x2c33ce['variable'][_0xb7df('0x5b')])){utils[_0xb7df('0x14')](util[_0xb7df('0x6')](_0xb7df('0x5c'),_0x2c33ce[_0xb7df('0x7')],_0x2c33ce[_0xb7df('0x48')]));channels[_0x2c33ce[_0xb7df('0x7')]][_0xb7df('0x5b')]=_0x2c33ce[_0xb7df('0x48')];}}}catch(_0x252cb1){utils[_0xb7df('0x25')](util[_0xb7df('0x6')](_0xb7df('0x41'),_0x2c33ce[_0xb7df('0x7')]),_0x252cb1);}};exports[_0xb7df('0x5d')]=function(_0x4622da){try{if(!_['isNil'](channels[_0x4622da['uniqueid']])){utils[_0xb7df('0x1a')](util[_0xb7df('0x6')](_0xb7df('0x5e'),_0x4622da[_0xb7df('0x7')]),_0x4622da);utils[_0xb7df('0x14')](util['format'](_0xb7df('0x5f'),_0x4622da[_0xb7df('0x7')],_0x4622da[_0xb7df('0x60')],_0x4622da[_0xb7df('0x61')]));if(_0x4622da[_0xb7df('0x60')]['toLowerCase']()==_0xb7df('0x62')&&_[_0xb7df('0x63')](_0x4622da[_0xb7df('0x61')][_0xb7df('0x64')](),_0xb7df('0x65'))){var _0x3837fa=_0x4622da[_0xb7df('0x61')][_0xb7df('0x66')]('=');var _0x7a24e6=_0x3837fa[0x0]['substring'](_0x3837fa[0x0]['lastIndexOf']('(')+0x1,_0x3837fa[0x0][_0xb7df('0x67')](')'));var _0xeb5da8=_0x3837fa[0x1];channels[_0x4622da[_0xb7df('0x7')]][_0x7a24e6]=_0xeb5da8;}if(!_[_0xb7df('0x68')]([_0xb7df('0x26'),_0xb7df('0x69'),_0xb7df('0x6a'),'set','gotoif'],_0x4622da[_0xb7df('0x60')][_0xb7df('0x64')]())){channels[_0x4622da[_0xb7df('0x7')]]['lastapplication']=_0x4622da[_0xb7df('0x60')];channels[_0x4622da[_0xb7df('0x7')]]['lastdata']=_0x4622da[_0xb7df('0x61')];}}}catch(_0x24446f){utils[_0xb7df('0x25')](util[_0xb7df('0x6')]('[%s][calls][newexten]',_0x4622da[_0xb7df('0x7')]),_0x24446f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 61ffcfe..b2e1ae4 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 _0xbdc2=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x3e1cc0,_0x9749c5){var _0x372ee1=function(_0x492d4f){while(--_0x492d4f){_0x3e1cc0['push'](_0x3e1cc0['shift']());}};_0x372ee1(++_0x9749c5);}(_0xbdc2,0xba));var _0x2bdc=function(_0x5c9939,_0x5f1deb){_0x5c9939=_0x5c9939-0x0;var _0x6ce458=_0xbdc2[_0x5c9939];return _0x6ce458;};'use strict';var utils=require(_0x2bdc('0x0'));exports[_0x2bdc('0x1')]=function(){utils[_0x2bdc('0x2')](_0x2bdc('0x3'));};exports[_0x2bdc('0x4')]=function(){utils[_0x2bdc('0x2')](_0x2bdc('0x5'));};exports['fullybooted']=function(){utils['info'](_0x2bdc('0x6'));};exports['error']=function(_0x14c814){utils['error'](_0x2bdc('0x7'),_0x14c814);};exports[_0x2bdc('0x8')]=function(){utils['info'](_0x2bdc('0x9'));};exports[_0x2bdc('0xa')]=function(_0x1f7093){}; \ No newline at end of file +var _0x65ce=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0x65ce,0x110));var _0xe65c=function(_0x3593bb,_0x1d05ce){_0x3593bb=_0x3593bb-0x0;var _0x3da89f=_0x65ce[_0x3593bb];return _0x3da89f;};'use strict';var utils=require(_0xe65c('0x0'));exports[_0xe65c('0x1')]=function(){utils[_0xe65c('0x2')](_0xe65c('0x3'));};exports[_0xe65c('0x4')]=function(){utils[_0xe65c('0x2')](_0xe65c('0x5'));};exports[_0xe65c('0x6')]=function(){utils[_0xe65c('0x2')](_0xe65c('0x7'));};exports[_0xe65c('0x8')]=function(_0x46c6ba){utils['error'](_0xe65c('0x9'),_0x46c6ba);};exports['close']=function(){utils[_0xe65c('0x2')](_0xe65c('0xa'));};exports[_0xe65c('0xb')]=function(_0x1eff26){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f71ae23..56ec340 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 _0xaa10=['hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','varset','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','dialstatus','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]'];(function(_0x1bd17c,_0x4f5223){var _0x3c9562=function(_0x284812){while(--_0x284812){_0x1bd17c['push'](_0x1bd17c['shift']());}};_0x3c9562(++_0x4f5223);}(_0xaa10,0x1f4));var _0x0aa1=function(_0x506858,_0x44411c){_0x506858=_0x506858-0x0;var _0x313ad1=_0xaa10[_0x506858];return _0x313ad1;};'use strict';var _=require(_0x0aa1('0x0'));var util=require('util');var utils=require(_0x0aa1('0x1'));var dials={};function writeDB(_0x132b68){utils[_0x0aa1('0x2')](util[_0x0aa1('0x3')](_0x0aa1('0x4'),_0x132b68[_0x0aa1('0x5')],_0x132b68['channel'],_0x132b68['dialstring'],_0x132b68[_0x0aa1('0x6')],_0x132b68[_0x0aa1('0x7')],_0x132b68['dialstatus']));utils[_0x0aa1('0x8')](_0x0aa1('0x9'),_0x132b68);delete dials[_0x132b68[_0x0aa1('0x5')]];}exports[_0x0aa1('0xa')]=function(_0x1f8eed){try{utils[_0x0aa1('0xb')](util['format']('[%s][dials][newexten]',_0x1f8eed[_0x0aa1('0x5')]),_0x1f8eed);utils['info'](util[_0x0aa1('0x3')](_0x0aa1('0xc'),_0x1f8eed[_0x0aa1('0x5')],_0x1f8eed[_0x0aa1('0xd')],_0x1f8eed[_0x0aa1('0xe')]));if(_0x1f8eed[_0x0aa1('0xd')][_0x0aa1('0xf')]()==_0x0aa1('0x10')&&_[_0x0aa1('0x11')](_0x1f8eed['appdata'][_0x0aa1('0xf')](),'cdr(routeid)')){var _0x1cc13b=_0x1f8eed[_0x0aa1('0xe')][_0x0aa1('0x12')]('=');dials[_0x1f8eed['uniqueid']]={'routeId':_0x1cc13b[0x1]};}}catch(_0x348376){utils['error'](util[_0x0aa1('0x3')]('[%s][dials][newexten]',_0x1f8eed[_0x0aa1('0x5')]),_0x348376);}};exports[_0x0aa1('0x13')]=function(_0x317342){try{utils['debug'](util[_0x0aa1('0x3')]('[%s][dials][varset]',_0x317342[_0x0aa1('0x5')]),_0x317342);if(!_['isNil'](_0x317342[_0x0aa1('0x14')]['outboundrouteid'])){utils['info'](util[_0x0aa1('0x3')](_0x0aa1('0x15'),_0x317342[_0x0aa1('0x5')],_0x317342[_0x0aa1('0x16')]));dials[_0x317342[_0x0aa1('0x5')]]={'routeId':_0x317342['value']};}}catch(_0x17f564){utils[_0x0aa1('0x17')](util[_0x0aa1('0x3')](_0x0aa1('0x18'),_0x317342['uniqueid']),_0x17f564);}};exports['dialbegin']=function(_0x56cf05){try{if(!_[_0x0aa1('0x19')](dials[_0x56cf05[_0x0aa1('0x5')]])){utils[_0x0aa1('0xb')](util['format'](_0x0aa1('0x1a'),_0x56cf05['uniqueid']),_0x56cf05);dials[_0x56cf05[_0x0aa1('0x5')]]=_[_0x0aa1('0x1b')](dials[_0x56cf05['uniqueid']],_0x56cf05);dials[_0x56cf05[_0x0aa1('0x5')]][_0x0aa1('0x1c')]=utils[_0x0aa1('0x1d')]();dials[_0x56cf05[_0x0aa1('0x5')]][_0x0aa1('0x1e')]=_0x0aa1('0x1f');utils[_0x0aa1('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x56cf05['uniqueid'],dials[_0x56cf05[_0x0aa1('0x5')]][_0x0aa1('0x1c')]));}}catch(_0x3c7b76){utils['error'](util['format'](_0x0aa1('0x1a'),_0x56cf05[_0x0aa1('0x5')]),_0x3c7b76);}};exports[_0x0aa1('0x20')]=function(_0x4d00e1){try{if(!_['isNil'](dials[_0x4d00e1['uniqueid']])){utils[_0x0aa1('0xb')](util['format']('[%s][dials][dialend]',_0x4d00e1[_0x0aa1('0x5')]),_0x4d00e1);dials[_0x4d00e1['uniqueid']][_0x0aa1('0x21')]=_0x4d00e1[_0x0aa1('0x21')];if(_0x4d00e1[_0x0aa1('0x21')]==_0x0aa1('0x22')){dials[_0x4d00e1[_0x0aa1('0x5')]]=_[_0x0aa1('0x1b')](dials[_0x4d00e1[_0x0aa1('0x5')]],_0x4d00e1);dials[_0x4d00e1['uniqueid']][_0x0aa1('0x23')]=utils[_0x0aa1('0x1d')]();dials[_0x4d00e1[_0x0aa1('0x5')]][_0x0aa1('0x1e')]='connect';utils[_0x0aa1('0x2')](util[_0x0aa1('0x3')](_0x0aa1('0x24'),_0x4d00e1[_0x0aa1('0x5')],_0x4d00e1['dialstatus'],dials[_0x4d00e1[_0x0aa1('0x5')]]['answertime']));}else{utils['info'](util['format'](_0x0aa1('0x25'),_0x4d00e1[_0x0aa1('0x5')],_0x4d00e1[_0x0aa1('0x21')]));}}}catch(_0x14d243){utils[_0x0aa1('0x17')](util[_0x0aa1('0x3')](_0x0aa1('0x26'),_0x4d00e1[_0x0aa1('0x5')]),_0x14d243);}};exports[_0x0aa1('0x27')]=function(_0x22cb13){try{if(!_[_0x0aa1('0x19')](dials[_0x22cb13[_0x0aa1('0x5')]])){utils['debug'](util[_0x0aa1('0x3')](_0x0aa1('0x28'),_0x22cb13[_0x0aa1('0x5')]),_0x22cb13);utils['info'](util['format'](_0x0aa1('0x29'),_0x22cb13[_0x0aa1('0x5')],_0x22cb13[_0x0aa1('0x6')],_0x22cb13[_0x0aa1('0x2a')],_0x22cb13[_0x0aa1('0x2b')]));dials[_0x22cb13[_0x0aa1('0x5')]]=_['assign'](dials[_0x22cb13['uniqueid']],{'endtime':utils[_0x0aa1('0x1d')](),'lastevent':_0x0aa1('0x2c')});dials[_0x22cb13['uniqueid']][_0x0aa1('0x2d')]=utils[_0x0aa1('0x2e')](dials[_0x22cb13[_0x0aa1('0x5')]]['endtime'],dials[_0x22cb13[_0x0aa1('0x5')]][_0x0aa1('0x1c')]);dials[_0x22cb13[_0x0aa1('0x5')]][_0x0aa1('0x2f')]=utils[_0x0aa1('0x2e')](dials[_0x22cb13[_0x0aa1('0x5')]]['answertime']||dials[_0x22cb13[_0x0aa1('0x5')]][_0x0aa1('0x30')],dials[_0x22cb13[_0x0aa1('0x5')]]['starttime']);dials[_0x22cb13[_0x0aa1('0x5')]]['billableseconds']=dials[_0x22cb13[_0x0aa1('0x5')]][_0x0aa1('0x23')]?utils[_0x0aa1('0x2e')](dials[_0x22cb13[_0x0aa1('0x5')]][_0x0aa1('0x30')],dials[_0x22cb13[_0x0aa1('0x5')]]['answertime']):0x0;writeDB(dials[_0x22cb13[_0x0aa1('0x5')]]);}}catch(_0x4f95a8){utils[_0x0aa1('0x17')](util[_0x0aa1('0x3')](_0x0aa1('0x28'),_0x22cb13[_0x0aa1('0x5')]),_0x4f95a8);}}; \ No newline at end of file +var _0xd73a=['format','application','toLowerCase','startsWith','cdr(routeid)','appdata','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','starttime','lastevent','dialend','[%s][dials][dialend]','ANSWER','answertime','now','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','assign','complete','duration','holdtime','diffTime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','newexten','debug','[%s][dials][newexten]'];(function(_0x395558,_0x1aadcf){var _0x350565=function(_0x2d62e0){while(--_0x2d62e0){_0x395558['push'](_0x395558['shift']());}};_0x350565(++_0x1aadcf);}(_0xd73a,0x7c));var _0xad73=function(_0x25820c,_0x38cd80){_0x25820c=_0x25820c-0x0;var _0x3b66b8=_0xd73a[_0x25820c];return _0x3b66b8;};'use strict';var _=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var utils=require(_0xad73('0x2'));var dials={};function writeDB(_0x43cf0f){utils[_0xad73('0x3')](util['format'](_0xad73('0x4'),_0x43cf0f[_0xad73('0x5')],_0x43cf0f[_0xad73('0x6')],_0x43cf0f[_0xad73('0x7')],_0x43cf0f[_0xad73('0x8')],_0x43cf0f[_0xad73('0x9')],_0x43cf0f[_0xad73('0xa')]));utils['request']('CreateVoiceDialReport',_0x43cf0f);delete dials[_0x43cf0f[_0xad73('0x5')]];}exports[_0xad73('0xb')]=function(_0xa506e9){try{utils[_0xad73('0xc')](util['format'](_0xad73('0xd'),_0xa506e9[_0xad73('0x5')]),_0xa506e9);utils[_0xad73('0x3')](util[_0xad73('0xe')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0xa506e9[_0xad73('0x5')],_0xa506e9[_0xad73('0xf')],_0xa506e9['appdata']));if(_0xa506e9[_0xad73('0xf')][_0xad73('0x10')]()=='set'&&_[_0xad73('0x11')](_0xa506e9['appdata'][_0xad73('0x10')](),_0xad73('0x12'))){var _0x273c87=_0xa506e9[_0xad73('0x13')]['split']('=');dials[_0xa506e9[_0xad73('0x5')]]={'routeId':_0x273c87[0x1]};}}catch(_0x1c0105){utils[_0xad73('0x14')](util[_0xad73('0xe')](_0xad73('0xd'),_0xa506e9[_0xad73('0x5')]),_0x1c0105);}};exports[_0xad73('0x15')]=function(_0x1540e2){try{utils[_0xad73('0xc')](util[_0xad73('0xe')](_0xad73('0x16'),_0x1540e2[_0xad73('0x5')]),_0x1540e2);if(!_[_0xad73('0x17')](_0x1540e2['variable'][_0xad73('0x18')])){utils[_0xad73('0x3')](util[_0xad73('0xe')](_0xad73('0x19'),_0x1540e2[_0xad73('0x5')],_0x1540e2['value']));dials[_0x1540e2[_0xad73('0x5')]]={'routeId':_0x1540e2[_0xad73('0x1a')]};}}catch(_0x3f04ec){utils[_0xad73('0x14')](util[_0xad73('0xe')](_0xad73('0x16'),_0x1540e2[_0xad73('0x5')]),_0x3f04ec);}};exports['dialbegin']=function(_0x5ba6f7){try{if(!_[_0xad73('0x17')](dials[_0x5ba6f7[_0xad73('0x5')]])){utils[_0xad73('0xc')](util[_0xad73('0xe')](_0xad73('0x1b'),_0x5ba6f7[_0xad73('0x5')]),_0x5ba6f7);dials[_0x5ba6f7[_0xad73('0x5')]]=_['assign'](dials[_0x5ba6f7[_0xad73('0x5')]],_0x5ba6f7);dials[_0x5ba6f7[_0xad73('0x5')]][_0xad73('0x1c')]=utils['now']();dials[_0x5ba6f7[_0xad73('0x5')]][_0xad73('0x1d')]='called';utils[_0xad73('0x3')](util[_0xad73('0xe')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x5ba6f7['uniqueid'],dials[_0x5ba6f7[_0xad73('0x5')]][_0xad73('0x1c')]));}}catch(_0x4f5046){utils[_0xad73('0x14')](util[_0xad73('0xe')]('[%s][dials][dialbegin]',_0x5ba6f7['uniqueid']),_0x4f5046);}};exports[_0xad73('0x1e')]=function(_0x514aa0){try{if(!_['isNil'](dials[_0x514aa0['uniqueid']])){utils[_0xad73('0xc')](util[_0xad73('0xe')](_0xad73('0x1f'),_0x514aa0[_0xad73('0x5')]),_0x514aa0);dials[_0x514aa0[_0xad73('0x5')]]['dialstatus']=_0x514aa0[_0xad73('0xa')];if(_0x514aa0['dialstatus']==_0xad73('0x20')){dials[_0x514aa0[_0xad73('0x5')]]=_['assign'](dials[_0x514aa0['uniqueid']],_0x514aa0);dials[_0x514aa0[_0xad73('0x5')]][_0xad73('0x21')]=utils[_0xad73('0x22')]();dials[_0x514aa0[_0xad73('0x5')]]['lastevent']='connect';utils[_0xad73('0x3')](util[_0xad73('0xe')](_0xad73('0x23'),_0x514aa0[_0xad73('0x5')],_0x514aa0['dialstatus'],dials[_0x514aa0[_0xad73('0x5')]][_0xad73('0x21')]));}else{utils[_0xad73('0x3')](util[_0xad73('0xe')]('[%s][dials][dialend]\x20dialstatus:%s',_0x514aa0[_0xad73('0x5')],_0x514aa0[_0xad73('0xa')]));}}}catch(_0x3ae00b){utils['error'](util['format'](_0xad73('0x1f'),_0x514aa0[_0xad73('0x5')]),_0x3ae00b);}};exports[_0xad73('0x24')]=function(_0x241544){try{if(!_[_0xad73('0x17')](dials[_0x241544[_0xad73('0x5')]])){utils[_0xad73('0xc')](util['format']('[%s][dials][hangup]',_0x241544[_0xad73('0x5')]),_0x241544);utils['info'](util[_0xad73('0xe')](_0xad73('0x25'),_0x241544[_0xad73('0x5')],_0x241544[_0xad73('0x8')],_0x241544['calleridname'],_0x241544[_0xad73('0x26')]));dials[_0x241544[_0xad73('0x5')]]=_[_0xad73('0x27')](dials[_0x241544[_0xad73('0x5')]],{'endtime':utils['now'](),'lastevent':_0xad73('0x28')});dials[_0x241544['uniqueid']][_0xad73('0x29')]=utils['diffTime'](dials[_0x241544[_0xad73('0x5')]]['endtime'],dials[_0x241544[_0xad73('0x5')]]['starttime']);dials[_0x241544[_0xad73('0x5')]][_0xad73('0x2a')]=utils[_0xad73('0x2b')](dials[_0x241544['uniqueid']][_0xad73('0x21')]||dials[_0x241544[_0xad73('0x5')]]['endtime'],dials[_0x241544[_0xad73('0x5')]][_0xad73('0x1c')]);dials[_0x241544[_0xad73('0x5')]][_0xad73('0x2c')]=dials[_0x241544[_0xad73('0x5')]][_0xad73('0x21')]?utils[_0xad73('0x2b')](dials[_0x241544[_0xad73('0x5')]]['endtime'],dials[_0x241544[_0xad73('0x5')]][_0xad73('0x21')]):0x0;writeDB(dials[_0x241544[_0xad73('0x5')]]);}}catch(_0x4cea11){utils[_0xad73('0x14')](util['format'](_0xad73('0x2d'),_0x241544[_0xad73('0x5')]),_0x4cea11);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8188914..938859d 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 _0xf813=['device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','disabled','xdr','env','local','asterisk','port','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]'];(function(_0x1fd5fb,_0x409790){var _0x4eeb8c=function(_0x1f17ba){while(--_0x1f17ba){_0x1fd5fb['push'](_0x1fd5fb['shift']());}};_0x4eeb8c(++_0x409790);}(_0xf813,0xb6));var _0x3f81=function(_0x57baae,_0x4fbee0){_0x57baae=_0x57baae-0x0;var _0x33dde6=_0xf813[_0x57baae];return _0x33dde6;};var AsteriskManager=require(_0x3f81('0x0'));var config=require('../../config/environment');var utils=require(_0x3f81('0x1'));var util=require(_0x3f81('0x2'));var isXDREnabled=config['xdr']&&config['xdr'][_0x3f81('0x3')]?!config[_0x3f81('0x4')][_0x3f81('0x3')]:!![];var isProduction=config[_0x3f81('0x5')]==='production'||![];var isLocalAsterisk=config[_0x3f81('0x4')]&&config['xdr'][_0x3f81('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x3f81('0x7')][_0x3f81('0x8')],config[_0x3f81('0x7')]['ip'],config[_0x3f81('0x7')][_0x3f81('0x9')],config[_0x3f81('0x7')][_0x3f81('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x3f81('0xb')](_0x3f81('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x3f81('0xd'));}else{var agents=require(_0x3f81('0xe'));var calls=require('./calls.controller');var queues=require(_0x3f81('0xf'));var recordings=require(_0x3f81('0x10'));var members=require(_0x3f81('0x11'));var dials=require('./dials.controller');var transfers=require(_0x3f81('0x12'));var core=require('./core.controller');ami['on'](_0x3f81('0x13'),core[_0x3f81('0x13')]);ami['on'](_0x3f81('0x14'),core['shutdown']);ami['on']('fullybooted',core[_0x3f81('0x15')]);ami['on'](_0x3f81('0x16'),core[_0x3f81('0x16')]);ami['on'](_0x3f81('0x17'),core[_0x3f81('0x17')]);ami['on'](_0x3f81('0x18'),core[_0x3f81('0x18')]);ami['on']('devicestatechange',function(_0x5141ef){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x1b'),_0x5141ef[_0x3f81('0x1c')]),_0x5141ef);members[_0x3f81('0x1d')](_0x5141ef);}catch(_0x2f1c2f){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x1b'),_0x5141ef[_0x3f81('0x1c')]),_0x2f1c2f);}});ami['on'](_0x3f81('0x1e'),function(_0x461f12){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')]('[%s][index][agentcalled]',_0x461f12['uniqueid']),_0x461f12);agents[_0x3f81('0x1e')](_0x461f12);}catch(_0x4543cb){utils['error'](util[_0x3f81('0x1a')](_0x3f81('0x1f'),_0x461f12[_0x3f81('0x20')]),_0x4543cb);}});ami['on']('agentringnoanswer',function(_0x19962b){try{utils[_0x3f81('0x19')](util['format'](_0x3f81('0x21'),_0x19962b[_0x3f81('0x20')]),_0x19962b);agents[_0x3f81('0x22')](_0x19962b);}catch(_0x3ec304){utils['error'](util[_0x3f81('0x1a')]('[%s][index][agentringnoanswer]',_0x19962b['uniqueid']),_0x3ec304);}});ami['on'](_0x3f81('0x23'),function(_0x237a3e){try{utils[_0x3f81('0x19')](util['format'](_0x3f81('0x24'),_0x237a3e[_0x3f81('0x20')]),_0x237a3e);agents[_0x3f81('0x23')](_0x237a3e);queues['agentconnect'](_0x237a3e);}catch(_0x40a428){utils['error'](util[_0x3f81('0x1a')](_0x3f81('0x24'),_0x237a3e['uniqueid']),_0x40a428);}});ami['on'](_0x3f81('0x25'),function(_0x2ed7d1){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x26'),_0x2ed7d1[_0x3f81('0x20')]),_0x2ed7d1);agents['agentcomplete'](_0x2ed7d1);queues[_0x3f81('0x25')](_0x2ed7d1);members['agentcomplete'](_0x2ed7d1);}catch(_0x10038b){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')]('[%s][index][agentcomplete]',_0x2ed7d1[_0x3f81('0x20')]),_0x10038b);}});ami['on'](_0x3f81('0x27'),function(_0x3c9114){try{utils[_0x3f81('0x19')](util['format'](_0x3f81('0x28'),_0x3c9114['uniqueid']),_0x3c9114);agents[_0x3f81('0x27')](_0x3c9114);queues[_0x3f81('0x27')](_0x3c9114);}catch(_0x56d179){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x28'),_0x3c9114[_0x3f81('0x20')]),_0x56d179);}});ami['on'](_0x3f81('0x29'),function(_0x347dfe){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x2a'),_0x347dfe['uniqueid']),_0x347dfe);queues[_0x3f81('0x29')](_0x347dfe);recordings[_0x3f81('0x29')](_0x347dfe);}catch(_0x15b22f){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x2a'),_0x347dfe[_0x3f81('0x20')]),_0x15b22f);}});ami['on']('queuecallerleave',function(_0x3cc594){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x2b'),_0x3cc594[_0x3f81('0x20')]),_0x3cc594);queues[_0x3f81('0x2c')](_0x3cc594);}catch(_0xc42695){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x2b'),_0x3cc594[_0x3f81('0x20')]),_0xc42695);}});ami['on'](_0x3f81('0x2d'),function(_0x2ff011){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x2e'),_0x2ff011['uniqueid']),_0x2ff011);queues[_0x3f81('0x2d')](_0x2ff011);calls[_0x3f81('0x2d')](_0x2ff011);}catch(_0x3ad50e){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')]('[%s][index][musiconholdstart]',_0x2ff011[_0x3f81('0x20')]),_0x3ad50e);}});ami['on'](_0x3f81('0x2f'),function(_0x3f8477){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x30'),_0x3f8477[_0x3f81('0x20')]),_0x3f8477);queues[_0x3f81('0x2f')](_0x3f8477);calls[_0x3f81('0x2f')](_0x3f8477);}catch(_0x17f9ba){utils['error'](util['format'](_0x3f81('0x30'),_0x3f8477[_0x3f81('0x20')]),_0x17f9ba);}});ami['on'](_0x3f81('0x31'),function(_0x2ebdf2){try{utils['debug'](util[_0x3f81('0x1a')](_0x3f81('0x32'),_0x2ebdf2[_0x3f81('0x20')]),_0x2ebdf2);calls[_0x3f81('0x31')](_0x2ebdf2);recordings['newstate'](_0x2ebdf2);}catch(_0x4bc547){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x32'),_0x2ebdf2['uniqueid']),_0x4bc547);}});ami['on'](_0x3f81('0x33'),function(_0xe1f692){try{utils[_0x3f81('0x19')](util['format'](_0x3f81('0x34'),_0xe1f692[_0x3f81('0x20')]),_0xe1f692);calls[_0x3f81('0x33')](_0xe1f692);recordings[_0x3f81('0x33')](_0xe1f692);dials[_0x3f81('0x33')](_0xe1f692);agents[_0x3f81('0x33')](_0xe1f692);queues[_0x3f81('0x33')](_0xe1f692);}catch(_0x51902b){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x34'),_0xe1f692[_0x3f81('0x20')]),_0x51902b);}});ami['on'](_0x3f81('0x35'),function(_0x4d9693){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')]('[%s][index][cdr]',_0x4d9693[_0x3f81('0x20')]),_0x4d9693);members[_0x3f81('0x35')](_0x4d9693);}catch(_0x2e5fd4){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')]('[%s][index][cdr]',_0x4d9693['uniqueid']),_0x2e5fd4);}});ami['on'](_0x3f81('0x36'),function(_0x32d711){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x37'),_0x32d711[_0x3f81('0x20')]),_0x32d711);queues[_0x3f81('0x36')](_0x32d711);agents[_0x3f81('0x36')](_0x32d711);transfers[_0x3f81('0x36')](_0x32d711);}catch(_0x831fe5){utils[_0x3f81('0x16')](util['format'](_0x3f81('0x37'),_0x32d711[_0x3f81('0x20')]),_0x831fe5);}});ami['on'](_0x3f81('0x38'),function(_0xd1fa66){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x39'),_0xd1fa66[_0x3f81('0x3a')]),_0xd1fa66);queues[_0x3f81('0x38')](_0xd1fa66);transfers[_0x3f81('0x38')](_0xd1fa66);agents['attendedtransfer'](_0xd1fa66);calls[_0x3f81('0x38')](_0xd1fa66);}catch(_0x234f12){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x39'),_0xd1fa66[_0x3f81('0x3a')]),_0x234f12);}});ami['on'](_0x3f81('0x3b'),function(_0x1cc7d5){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x3c'),_0x1cc7d5['uniqueid']),_0x1cc7d5);queues[_0x3f81('0x3b')](_0x1cc7d5);recordings[_0x3f81('0x3b')](_0x1cc7d5);calls['varset'](_0x1cc7d5);dials[_0x3f81('0x3b')](_0x1cc7d5);}catch(_0x5761c5){utils['error'](util[_0x3f81('0x1a')]('[%s][index][varset]',_0x1cc7d5[_0x3f81('0x20')]),_0x5761c5);}});ami['on']('newexten',function(_0x9e1ebf){try{utils['debug'](util[_0x3f81('0x1a')](_0x3f81('0x3d'),_0x9e1ebf['uniqueid']),_0x9e1ebf);calls[_0x3f81('0x3e')](_0x9e1ebf);recordings[_0x3f81('0x3e')](_0x9e1ebf);dials[_0x3f81('0x3e')](_0x9e1ebf);}catch(_0x2a0b47){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x3d'),_0x9e1ebf[_0x3f81('0x20')]),_0x2a0b47);}});ami['on'](_0x3f81('0x3f'),function(_0x32e829){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x40'),_0x32e829[_0x3f81('0x20')]),_0x32e829);calls['newchannel'](_0x32e829);recordings['newchannel'](_0x32e829);}catch(_0x504dd8){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x40'),_0x32e829['uniqueid']),_0x504dd8);}});ami['on'](_0x3f81('0x41'),function(_0x283594){try{utils[_0x3f81('0x19')](util[_0x3f81('0x1a')](_0x3f81('0x42'),_0x283594[_0x3f81('0x20')]),_0x283594);dials['dialbegin'](_0x283594);}catch(_0x389a9f){utils['error'](util[_0x3f81('0x1a')](_0x3f81('0x43'),_0x283594['uniqueid']),_0x389a9f);}});ami['on'](_0x3f81('0x44'),function(_0x196048){try{utils[_0x3f81('0x19')](util['format'](_0x3f81('0x45'),_0x196048[_0x3f81('0x20')]),_0x196048);dials[_0x3f81('0x44')](_0x196048);}catch(_0xa5e398){utils[_0x3f81('0x16')](util[_0x3f81('0x1a')](_0x3f81('0x45'),_0x196048[_0x3f81('0x20')]),_0xa5e398);}});} \ No newline at end of file +var _0x240e=['uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialend','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','username','password','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]'];(function(_0x33267c,_0x70826f){var _0xe6f23=function(_0x1f9316){while(--_0x1f9316){_0x33267c['push'](_0x33267c['shift']());}};_0xe6f23(++_0x70826f);}(_0x240e,0x12b));var _0xe240=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x240e[_0x34bf97];return _0x292719;};var AsteriskManager=require('asterisk-manager');var config=require(_0xe240('0x0'));var utils=require(_0xe240('0x1'));var util=require(_0xe240('0x2'));var isXDREnabled=config[_0xe240('0x3')]&&config[_0xe240('0x3')][_0xe240('0x4')]?!config[_0xe240('0x3')]['disabled']:!![];var isProduction=config['env']===_0xe240('0x5')||![];var isLocalAsterisk=config[_0xe240('0x3')]&&config[_0xe240('0x3')][_0xe240('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xe240('0x7')]['port'],config[_0xe240('0x7')]['ip'],config[_0xe240('0x7')][_0xe240('0x8')],config[_0xe240('0x7')][_0xe240('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xe240('0xa')](_0xe240('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xe240('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xe240('0xc'));var calls=require('./calls.controller');var queues=require(_0xe240('0xd'));var recordings=require(_0xe240('0xe'));var members=require('./members.controller');var dials=require(_0xe240('0xf'));var transfers=require(_0xe240('0x10'));var core=require(_0xe240('0x11'));ami['on'](_0xe240('0x12'),core[_0xe240('0x12')]);ami['on'](_0xe240('0x13'),core[_0xe240('0x13')]);ami['on']('fullybooted',core[_0xe240('0x14')]);ami['on'](_0xe240('0x15'),core['error']);ami['on'](_0xe240('0x16'),core[_0xe240('0x16')]);ami['on'](_0xe240('0x17'),core['managerevent']);ami['on'](_0xe240('0x18'),function(_0x8a85ac){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')](_0xe240('0x1b'),_0x8a85ac[_0xe240('0x1c')]),_0x8a85ac);members['devicestatechange'](_0x8a85ac);}catch(_0x29249b){utils[_0xe240('0x15')](util[_0xe240('0x1a')](_0xe240('0x1b'),_0x8a85ac['device']),_0x29249b);}});ami['on'](_0xe240('0x1d'),function(_0x3b25f2){try{utils['debug'](util['format'](_0xe240('0x1e'),_0x3b25f2[_0xe240('0x1f')]),_0x3b25f2);agents['agentcalled'](_0x3b25f2);}catch(_0x23fd19){utils[_0xe240('0x15')](util[_0xe240('0x1a')](_0xe240('0x1e'),_0x3b25f2[_0xe240('0x1f')]),_0x23fd19);}});ami['on'](_0xe240('0x20'),function(_0x9b9c22){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')](_0xe240('0x21'),_0x9b9c22[_0xe240('0x1f')]),_0x9b9c22);agents[_0xe240('0x20')](_0x9b9c22);}catch(_0x38519a){utils[_0xe240('0x15')](util['format']('[%s][index][agentringnoanswer]',_0x9b9c22['uniqueid']),_0x38519a);}});ami['on']('agentconnect',function(_0x1531ab){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')](_0xe240('0x22'),_0x1531ab['uniqueid']),_0x1531ab);agents['agentconnect'](_0x1531ab);queues[_0xe240('0x23')](_0x1531ab);}catch(_0x14b712){utils['error'](util[_0xe240('0x1a')](_0xe240('0x22'),_0x1531ab[_0xe240('0x1f')]),_0x14b712);}});ami['on'](_0xe240('0x24'),function(_0x2c1208){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')](_0xe240('0x25'),_0x2c1208[_0xe240('0x1f')]),_0x2c1208);agents['agentcomplete'](_0x2c1208);queues[_0xe240('0x24')](_0x2c1208);members[_0xe240('0x24')](_0x2c1208);}catch(_0x4353d5){utils[_0xe240('0x15')](util[_0xe240('0x1a')]('[%s][index][agentcomplete]',_0x2c1208['uniqueid']),_0x4353d5);}});ami['on'](_0xe240('0x26'),function(_0x2d304a){try{utils[_0xe240('0x19')](util['format'](_0xe240('0x27'),_0x2d304a[_0xe240('0x1f')]),_0x2d304a);agents[_0xe240('0x26')](_0x2d304a);queues[_0xe240('0x26')](_0x2d304a);}catch(_0x273cca){utils[_0xe240('0x15')](util[_0xe240('0x1a')]('[%s][index][queuecallerabandon]',_0x2d304a[_0xe240('0x1f')]),_0x273cca);}});ami['on'](_0xe240('0x28'),function(_0x3c9542){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')](_0xe240('0x29'),_0x3c9542['uniqueid']),_0x3c9542);queues[_0xe240('0x28')](_0x3c9542);recordings[_0xe240('0x28')](_0x3c9542);}catch(_0x20003c){utils[_0xe240('0x15')](util['format'](_0xe240('0x29'),_0x3c9542['uniqueid']),_0x20003c);}});ami['on'](_0xe240('0x2a'),function(_0x524092){try{utils['debug'](util[_0xe240('0x1a')](_0xe240('0x2b'),_0x524092['uniqueid']),_0x524092);queues[_0xe240('0x2a')](_0x524092);}catch(_0x54fe7b){utils['error'](util['format'](_0xe240('0x2b'),_0x524092[_0xe240('0x1f')]),_0x54fe7b);}});ami['on']('musiconholdstart',function(_0x5bd9ad){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')](_0xe240('0x2c'),_0x5bd9ad['uniqueid']),_0x5bd9ad);queues[_0xe240('0x2d')](_0x5bd9ad);calls['musiconholdstart'](_0x5bd9ad);}catch(_0x58aa77){utils[_0xe240('0x15')](util[_0xe240('0x1a')](_0xe240('0x2c'),_0x5bd9ad[_0xe240('0x1f')]),_0x58aa77);}});ami['on'](_0xe240('0x2e'),function(_0x5e41d5){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')]('[%s][index][musiconholdstop]',_0x5e41d5['uniqueid']),_0x5e41d5);queues[_0xe240('0x2e')](_0x5e41d5);calls[_0xe240('0x2e')](_0x5e41d5);}catch(_0x3021ee){utils[_0xe240('0x15')](util[_0xe240('0x1a')](_0xe240('0x2f'),_0x5e41d5[_0xe240('0x1f')]),_0x3021ee);}});ami['on'](_0xe240('0x30'),function(_0xe7cfd){try{utils[_0xe240('0x19')](util['format'](_0xe240('0x31'),_0xe7cfd[_0xe240('0x1f')]),_0xe7cfd);calls[_0xe240('0x30')](_0xe7cfd);recordings[_0xe240('0x30')](_0xe7cfd);}catch(_0x2202b8){utils['error'](util['format'](_0xe240('0x31'),_0xe7cfd[_0xe240('0x1f')]),_0x2202b8);}});ami['on'](_0xe240('0x32'),function(_0x479390){try{utils[_0xe240('0x19')](util['format'](_0xe240('0x33'),_0x479390[_0xe240('0x1f')]),_0x479390);calls['hangup'](_0x479390);recordings['hangup'](_0x479390);dials[_0xe240('0x32')](_0x479390);agents[_0xe240('0x32')](_0x479390);queues[_0xe240('0x32')](_0x479390);}catch(_0x53c8a3){utils[_0xe240('0x15')](util[_0xe240('0x1a')](_0xe240('0x33'),_0x479390[_0xe240('0x1f')]),_0x53c8a3);}});ami['on'](_0xe240('0x34'),function(_0x180f2d){try{utils[_0xe240('0x19')](util['format'](_0xe240('0x35'),_0x180f2d[_0xe240('0x1f')]),_0x180f2d);members[_0xe240('0x34')](_0x180f2d);}catch(_0x1003ab){utils[_0xe240('0x15')](util['format'](_0xe240('0x35'),_0x180f2d[_0xe240('0x1f')]),_0x1003ab);}});ami['on'](_0xe240('0x36'),function(_0xa2af1e){try{utils['debug'](util[_0xe240('0x1a')](_0xe240('0x37'),_0xa2af1e[_0xe240('0x1f')]),_0xa2af1e);queues[_0xe240('0x36')](_0xa2af1e);agents['blindtransfer'](_0xa2af1e);transfers[_0xe240('0x36')](_0xa2af1e);}catch(_0x5b66fd){utils[_0xe240('0x15')](util[_0xe240('0x1a')]('[%s][index][blindtransfer]',_0xa2af1e[_0xe240('0x1f')]),_0x5b66fd);}});ami['on'](_0xe240('0x38'),function(_0x31b41a){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')]('[%s][index][attendedtransfer]',_0x31b41a[_0xe240('0x39')]),_0x31b41a);queues[_0xe240('0x38')](_0x31b41a);transfers['attendedtransfer'](_0x31b41a);agents[_0xe240('0x38')](_0x31b41a);calls[_0xe240('0x38')](_0x31b41a);}catch(_0x5e6212){utils['error'](util['format'](_0xe240('0x3a'),_0x31b41a[_0xe240('0x39')]),_0x5e6212);}});ami['on']('varset',function(_0x2467a6){try{utils['debug'](util['format']('[%s][index][varset]',_0x2467a6['uniqueid']),_0x2467a6);queues[_0xe240('0x3b')](_0x2467a6);recordings[_0xe240('0x3b')](_0x2467a6);calls[_0xe240('0x3b')](_0x2467a6);dials[_0xe240('0x3b')](_0x2467a6);}catch(_0x18a5e2){utils[_0xe240('0x15')](util['format']('[%s][index][varset]',_0x2467a6[_0xe240('0x1f')]),_0x18a5e2);}});ami['on'](_0xe240('0x3c'),function(_0x20968d){try{utils[_0xe240('0x19')](util[_0xe240('0x1a')](_0xe240('0x3d'),_0x20968d['uniqueid']),_0x20968d);calls['newexten'](_0x20968d);recordings['newexten'](_0x20968d);dials[_0xe240('0x3c')](_0x20968d);}catch(_0x22ae58){utils[_0xe240('0x15')](util['format']('[%s][index][newexten]',_0x20968d['uniqueid']),_0x22ae58);}});ami['on']('newchannel',function(_0x3aaa87){try{utils['debug'](util[_0xe240('0x1a')]('[%s][index][newchannel]',_0x3aaa87[_0xe240('0x1f')]),_0x3aaa87);calls[_0xe240('0x3e')](_0x3aaa87);recordings[_0xe240('0x3e')](_0x3aaa87);}catch(_0x3cd2ad){utils[_0xe240('0x15')](util['format'](_0xe240('0x3f'),_0x3aaa87[_0xe240('0x1f')]),_0x3cd2ad);}});ami['on']('dialbegin',function(_0x14f494){try{utils['debug'](util[_0xe240('0x1a')](_0xe240('0x40'),_0x14f494['uniqueid']),_0x14f494);dials['dialbegin'](_0x14f494);}catch(_0xf71b31){utils['error'](util['format']('[%s]dialbegin',_0x14f494[_0xe240('0x1f')]),_0xf71b31);}});ami['on']('dialend',function(_0xd7db79){try{utils[_0xe240('0x19')](util['format']('[%s][index][dialend]',_0xd7db79[_0xe240('0x1f')]),_0xd7db79);dials[_0xe240('0x41')](_0xd7db79);}catch(_0x327568){utils[_0xe240('0x15')](util[_0xe240('0x1a')]('[%s][index][dialend]',_0xd7db79[_0xe240('0x1f')]),_0x327568);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 6b1b6de..df1eb29 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 _0x953e=['destinationchannel','split','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','getUserByName','request','CreateMemberReport','catch','error','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','data2','source','data3','destination'];(function(_0x209b9e,_0x225070){var _0x51ea59=function(_0xf05dab){while(--_0xf05dab){_0x209b9e['push'](_0x209b9e['shift']());}};_0x51ea59(++_0x225070);}(_0x953e,0xc6));var _0xe953=function(_0x56f8ca,_0x1e2379){_0x56f8ca=_0x56f8ca-0x0;var _0x58740d=_0x953e[_0x56f8ca];return _0x58740d;};'use strict';var _=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var utils=require(_0xe953('0x2'));var members={};var exclude=[_0xe953('0x3'),_0xe953('0x4')];function writeDB(_0x4f2140){utils[_0xe953('0x5')](util[_0xe953('0x6')](_0xe953('0x7'),_0x4f2140[_0xe953('0x8')],_0x4f2140[_0xe953('0x9')],_0x4f2140[_0xe953('0xa')],_0x4f2140['data2'],_0x4f2140[_0xe953('0xb')],_0x4f2140[_0xe953('0xc')]));if(_0x4f2140[_0xe953('0x9')]){utils[_0xe953('0xd')](_0x4f2140[_0xe953('0x9')])[_0xe953('0xe')](function(_0x325cb4){if(_0x325cb4){_0x4f2140[_0xe953('0xb')]=_0x325cb4[_0xe953('0xf')];_0x4f2140[_0xe953('0x10')]=_0x325cb4[_0xe953('0x10')];utils['request']('CreateMemberReport',_0x4f2140);}else{utils[_0xe953('0x11')](_0x4f2140['interface']['split']('/')[0x1])[_0xe953('0xe')](function(_0x19e36e){if(_0x19e36e){_0x4f2140['membername']=_0x19e36e[_0xe953('0xf')];_0x4f2140[_0xe953('0x10')]=_0x19e36e[_0xe953('0x10')];utils[_0xe953('0x12')](_0xe953('0x13'),_0x4f2140);}});}})[_0xe953('0x14')](function(_0x33c14e){utils[_0xe953('0x15')](util[_0xe953('0x6')]('[%s][members][writeDB]',_0x4f2140[_0xe953('0x8')]),_0x33c14e);});}delete members[_0x4f2140[_0xe953('0x9')]];}function startsWith(_0x5c6af4,_0xfa4963){return _[_0xe953('0x16')](_0x5c6af4,function(_0x374cab){return _[_0xe953('0x17')](_0xfa4963,_0x374cab);});}exports['devicestatechange']=function(_0x3db6f5){try{utils[_0xe953('0x18')](util[_0xe953('0x6')]('[%s][members][devicestatechange]',members[_0x3db6f5[_0xe953('0x19')]]?members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x8')]:_0x3db6f5['device']),_0x3db6f5);utils['info'](util[_0xe953('0x6')](_0xe953('0x1a'),members[_0x3db6f5[_0xe953('0x19')]]?members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x8')]:_0x3db6f5[_0xe953('0x19')],_0x3db6f5[_0xe953('0x1b')],_0x3db6f5[_0xe953('0x19')]));switch(_0x3db6f5[_0xe953('0x1b')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x3db6f5[_0xe953('0x19')])){members[_0x3db6f5[_0xe953('0x19')]]={'channel':'voice','interface':_0x3db6f5[_0xe953('0x19')],'type':_0xe953('0x1c'),'enterAt':utils[_0xe953('0x1d')](),'role':_0xe953('0x1e')};}break;case _0xe953('0x1f'):if(!_[_0xe953('0x20')](members[_0x3db6f5[_0xe953('0x19')]])){members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x21')]=utils[_0xe953('0x1d')]();members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x22')]=utils[_0xe953('0x23')](members[_0x3db6f5[_0xe953('0x19')]]['exitAt'],members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x24')]);if(members[_0x3db6f5[_0xe953('0x19')]]['uniqueid']){writeDB(members[_0x3db6f5[_0xe953('0x19')]]);}}break;default:break;}}catch(_0x1f49a9){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x3db6f5[_0xe953('0x19')]]?members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x8')]:_0x3db6f5[_0xe953('0x19')]),_0x1f49a9);}};exports['agentcomplete']=function(_0x4b8ee5){try{if(!_[_0xe953('0x20')](members[_0x4b8ee5[_0xe953('0x9')]])){utils[_0xe953('0x18')](util[_0xe953('0x6')](_0xe953('0x25'),_0x4b8ee5[_0xe953('0x8')]),_0x4b8ee5);utils[_0xe953('0x5')](util[_0xe953('0x6')](_0xe953('0x26'),_0x4b8ee5[_0xe953('0x8')],_0x4b8ee5[_0xe953('0x9')],_0x4b8ee5[_0xe953('0x27')]));members[_0x4b8ee5[_0xe953('0x9')]]=_[_0xe953('0x28')](members[_0x4b8ee5[_0xe953('0x9')]],{'data4':_0x4b8ee5['queue'],'uniqueid':_0x4b8ee5[_0xe953('0x8')]});}}catch(_0x1e2105){utils[_0xe953('0x15')](util[_0xe953('0x6')]('[%s][members][agentcomplete]',_0x4b8ee5[_0xe953('0x8')]),_0x1e2105);}};exports['cdr']=function(_0x1d4a37){try{utils[_0xe953('0x18')](util[_0xe953('0x6')](_0xe953('0x29'),_0x1d4a37[_0xe953('0x8')]),_0x1d4a37);if(_0x1d4a37[_0xe953('0xa')]){var _0x2e06b=_0x1d4a37[_0xe953('0xa')]['split']('-')[0x0];if(!_[_0xe953('0x20')](members[_0x2e06b])){members[_0x2e06b]=_[_0xe953('0x28')](members[_0x2e06b],{'data1':members[_0x2e06b][_0xe953('0x2a')]||_0x1d4a37[_0xe953('0xc')],'data2':members[_0x2e06b][_0xe953('0x2b')]||_0x1d4a37[_0xe953('0x2c')],'data3':members[_0x2e06b][_0xe953('0x2d')]||_0x1d4a37[_0xe953('0x2e')],'uniqueid':members[_0x2e06b][_0xe953('0x8')]||_0x1d4a37['uniqueid']});utils[_0xe953('0x5')](util[_0xe953('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1d4a37['uniqueid'],members[_0x2e06b][_0xe953('0x2a')],members[_0x2e06b][_0xe953('0x2b')],members[_0x2e06b][_0xe953('0x2d')]));if(members[_0x2e06b][_0xe953('0x21')]){writeDB(members[_0x2e06b]);}}}if(_0x1d4a37['destinationchannel']){var _0xaf2893=_0x1d4a37[_0xe953('0x2f')][_0xe953('0x30')]('-')[0x0];if(!_[_0xe953('0x20')](members[_0xaf2893])){members[_0xaf2893]=_[_0xe953('0x28')](members[_0xaf2893],{'data1':members[_0xaf2893][_0xe953('0x2a')]||_0x1d4a37['type'],'data2':members[_0xaf2893]['data2']||_0x1d4a37['source'],'data3':members[_0xaf2893][_0xe953('0x2d')]||_0x1d4a37[_0xe953('0x2e')],'uniqueid':members[_0xaf2893][_0xe953('0x8')]||_0x1d4a37[_0xe953('0x8')]});utils[_0xe953('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1d4a37[_0xe953('0x8')],members[_0xaf2893]['data1'],members[_0xaf2893][_0xe953('0x2b')],members[_0xaf2893]['data3']));if(members[_0xaf2893]['exitAt']){writeDB(members[_0xaf2893]);}}}}catch(_0xe3df3d){utils[_0xe953('0x15')](util[_0xe953('0x6')](_0xe953('0x29'),_0x1d4a37[_0xe953('0x8')]),_0xe3df3d);}}; \ No newline at end of file +var _0xc21d=['exitAt','[%s][members][devicestatechange]','isNil','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','source','data3','[%s][members][cdr]','lodash','util','./utils','Queue:','interface','channel','data2','membername','type','getUserByInterface','then','name','request','CreateMemberReport','getUserByName','split','internal','catch','error','format','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','now','agent','NOT_INUSE','duration','diffTime'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xc21d,0x1a8));var _0xdc21=function(_0x56d085,_0x391670){_0x56d085=_0x56d085-0x0;var _0x3afbae=_0xc21d[_0x56d085];return _0x3afbae;};'use strict';var _=require(_0xdc21('0x0'));var util=require(_0xdc21('0x1'));var utils=require(_0xdc21('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xdc21('0x3')];function writeDB(_0x2cc585){utils['info'](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2cc585['uniqueid'],_0x2cc585[_0xdc21('0x4')],_0x2cc585[_0xdc21('0x5')],_0x2cc585[_0xdc21('0x6')],_0x2cc585[_0xdc21('0x7')],_0x2cc585[_0xdc21('0x8')]));if(_0x2cc585['interface']){utils[_0xdc21('0x9')](_0x2cc585[_0xdc21('0x4')])[_0xdc21('0xa')](function(_0x5daebf){if(_0x5daebf){_0x2cc585[_0xdc21('0x7')]=_0x5daebf[_0xdc21('0xb')];_0x2cc585['internal']=_0x5daebf['internal'];utils[_0xdc21('0xc')](_0xdc21('0xd'),_0x2cc585);}else{utils[_0xdc21('0xe')](_0x2cc585[_0xdc21('0x4')][_0xdc21('0xf')]('/')[0x1])['then'](function(_0xb0e70b){if(_0xb0e70b){_0x2cc585['membername']=_0xb0e70b[_0xdc21('0xb')];_0x2cc585[_0xdc21('0x10')]=_0xb0e70b['internal'];utils['request']('CreateMemberReport',_0x2cc585);}});}})[_0xdc21('0x11')](function(_0x386a47){utils[_0xdc21('0x12')](util[_0xdc21('0x13')](_0xdc21('0x14'),_0x2cc585[_0xdc21('0x15')]),_0x386a47);});}delete members[_0x2cc585['interface']];}function startsWith(_0x6ef3da,_0x1a7fe1){return _[_0xdc21('0x16')](_0x6ef3da,function(_0x12ee9d){return _[_0xdc21('0x17')](_0x1a7fe1,_0x12ee9d);});}exports[_0xdc21('0x18')]=function(_0x31b1a3){try{utils[_0xdc21('0x19')](util[_0xdc21('0x13')]('[%s][members][devicestatechange]',members[_0x31b1a3[_0xdc21('0x1a')]]?members[_0x31b1a3['device']][_0xdc21('0x15')]:_0x31b1a3[_0xdc21('0x1a')]),_0x31b1a3);utils['info'](util[_0xdc21('0x13')](_0xdc21('0x1b'),members[_0x31b1a3[_0xdc21('0x1a')]]?members[_0x31b1a3[_0xdc21('0x1a')]][_0xdc21('0x15')]:_0x31b1a3[_0xdc21('0x1a')],_0x31b1a3['state'],_0x31b1a3[_0xdc21('0x1a')]));switch(_0x31b1a3[_0xdc21('0x1c')]){case _0xdc21('0x1d'):case'BUSY':if(!startsWith(exclude,_0x31b1a3[_0xdc21('0x1a')])){members[_0x31b1a3[_0xdc21('0x1a')]]={'channel':'voice','interface':_0x31b1a3['device'],'type':'TALKING','enterAt':utils[_0xdc21('0x1e')](),'role':_0xdc21('0x1f')};}break;case _0xdc21('0x20'):if(!_['isNil'](members[_0x31b1a3['device']])){members[_0x31b1a3[_0xdc21('0x1a')]]['exitAt']=utils['now']();members[_0x31b1a3[_0xdc21('0x1a')]][_0xdc21('0x21')]=utils[_0xdc21('0x22')](members[_0x31b1a3[_0xdc21('0x1a')]][_0xdc21('0x23')],members[_0x31b1a3[_0xdc21('0x1a')]]['enterAt']);if(members[_0x31b1a3['device']][_0xdc21('0x15')]){writeDB(members[_0x31b1a3[_0xdc21('0x1a')]]);}}break;default:break;}}catch(_0x3d9533){utils[_0xdc21('0x12')](util[_0xdc21('0x13')](_0xdc21('0x24'),members[_0x31b1a3[_0xdc21('0x1a')]]?members[_0x31b1a3['device']][_0xdc21('0x15')]:_0x31b1a3[_0xdc21('0x1a')]),_0x3d9533);}};exports['agentcomplete']=function(_0x1786ab){try{if(!_[_0xdc21('0x25')](members[_0x1786ab[_0xdc21('0x4')]])){utils[_0xdc21('0x19')](util[_0xdc21('0x13')](_0xdc21('0x26'),_0x1786ab[_0xdc21('0x15')]),_0x1786ab);utils[_0xdc21('0x27')](util['format'](_0xdc21('0x28'),_0x1786ab[_0xdc21('0x15')],_0x1786ab[_0xdc21('0x4')],_0x1786ab[_0xdc21('0x29')]));members[_0x1786ab[_0xdc21('0x4')]]=_[_0xdc21('0x2a')](members[_0x1786ab[_0xdc21('0x4')]],{'data4':_0x1786ab['queue'],'uniqueid':_0x1786ab['uniqueid']});}}catch(_0x562c5d){utils[_0xdc21('0x12')](util[_0xdc21('0x13')]('[%s][members][agentcomplete]',_0x1786ab[_0xdc21('0x15')]),_0x562c5d);}};exports[_0xdc21('0x2b')]=function(_0x342cd6){try{utils[_0xdc21('0x19')](util[_0xdc21('0x13')]('[%s][members][cdr]',_0x342cd6['uniqueid']),_0x342cd6);if(_0x342cd6[_0xdc21('0x5')]){var _0x3f4518=_0x342cd6[_0xdc21('0x5')][_0xdc21('0xf')]('-')[0x0];if(!_[_0xdc21('0x25')](members[_0x3f4518])){members[_0x3f4518]=_[_0xdc21('0x2a')](members[_0x3f4518],{'data1':members[_0x3f4518]['data1']||_0x342cd6[_0xdc21('0x8')],'data2':members[_0x3f4518][_0xdc21('0x6')]||_0x342cd6['source'],'data3':members[_0x3f4518]['data3']||_0x342cd6[_0xdc21('0x2c')],'uniqueid':members[_0x3f4518][_0xdc21('0x15')]||_0x342cd6[_0xdc21('0x15')]});utils[_0xdc21('0x27')](util['format'](_0xdc21('0x2d'),_0x342cd6[_0xdc21('0x15')],members[_0x3f4518]['data1'],members[_0x3f4518][_0xdc21('0x6')],members[_0x3f4518]['data3']));if(members[_0x3f4518]['exitAt']){writeDB(members[_0x3f4518]);}}}if(_0x342cd6[_0xdc21('0x2e')]){var _0x1e7f7c=_0x342cd6[_0xdc21('0x2e')][_0xdc21('0xf')]('-')[0x0];if(!_[_0xdc21('0x25')](members[_0x1e7f7c])){members[_0x1e7f7c]=_[_0xdc21('0x2a')](members[_0x1e7f7c],{'data1':members[_0x1e7f7c][_0xdc21('0x2f')]||_0x342cd6['type'],'data2':members[_0x1e7f7c][_0xdc21('0x6')]||_0x342cd6[_0xdc21('0x30')],'data3':members[_0x1e7f7c][_0xdc21('0x31')]||_0x342cd6['destination'],'uniqueid':members[_0x1e7f7c][_0xdc21('0x15')]||_0x342cd6[_0xdc21('0x15')]});utils[_0xdc21('0x27')](util[_0xdc21('0x13')](_0xdc21('0x2d'),_0x342cd6[_0xdc21('0x15')],members[_0x1e7f7c][_0xdc21('0x2f')],members[_0x1e7f7c][_0xdc21('0x6')],members[_0x1e7f7c][_0xdc21('0x31')]));if(members[_0x1e7f7c][_0xdc21('0x23')]){writeDB(members[_0x1e7f7c]);}}}}catch(_0x148cf8){utils['error'](util['format'](_0xdc21('0x32'),_0x342cd6['uniqueid']),_0x148cf8);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 57ca854..8f70e12 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 _0xbc6e=['calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][hangup]','varset','variable','value','queuecallerabandon','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][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','transfereelinkedid','clone'];(function(_0x44c3fd,_0x1136c3){var _0xfb251=function(_0x163031){while(--_0x163031){_0x44c3fd['push'](_0x44c3fd['shift']());}};_0xfb251(++_0x1136c3);}(_0xbc6e,0x1b7));var _0xebc6=function(_0x3e6bec,_0x37a2ca){_0x3e6bec=_0x3e6bec-0x0;var _0x52ff29=_0xbc6e[_0x3e6bec];return _0x52ff29;};'use strict';var _=require(_0xebc6('0x0'));var util=require('util');var utils=require(_0xebc6('0x1'));var queues={};function writeDB(_0x2ec502){utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x4'),_0x2ec502[_0xebc6('0x5')],_0x2ec502[_0xebc6('0x6')],_0x2ec502[_0xebc6('0x7')],_0x2ec502[_0xebc6('0x8')],_0x2ec502[_0xebc6('0x9')],_0x2ec502[_0xebc6('0xa')],_0x2ec502['queuecallerexitreason']));if(_0x2ec502[_0xebc6('0x7')]){utils[_0xebc6('0xb')](_0x2ec502[_0xebc6('0x7')])['then'](function(_0x18c35f){if(_0x18c35f){_0x2ec502[_0xebc6('0xc')]=_0x18c35f[_0xebc6('0xc')];}utils['request'](_0xebc6('0xd'),_0x2ec502);});}else{utils[_0xebc6('0xe')](_0xebc6('0xd'),_0x2ec502);}if(_0x2ec502[_0xebc6('0xf')]){delete queues[_0x2ec502[_0xebc6('0xf')]];}else{delete queues[_0x2ec502['uniqueid']];}}exports[_0xebc6('0x10')]=function(_0x16c599){try{utils[_0xebc6('0x11')](util[_0xebc6('0x3')](_0xebc6('0x12'),_0x16c599[_0xebc6('0x5')]),_0x16c599);utils[_0xebc6('0x2')](util['format'](_0xebc6('0x13'),_0x16c599[_0xebc6('0x5')],_0x16c599[_0xebc6('0x7')],_0x16c599[_0xebc6('0x14')]));queues[_0x16c599['uniqueid']]=_[_0xebc6('0x15')](_0x16c599,{'originalposition':_0x16c599[_0xebc6('0x14')],'queuecallerjoinAt':utils[_0xebc6('0x16')](),'mohtime':0x0});}catch(_0x538e29){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x16c599[_0xebc6('0x5')]),_0x538e29);}};exports[_0xebc6('0x17')]=function(_0x25a119){try{if(!_[_0xebc6('0x18')](queues[_0x25a119[_0xebc6('0x5')]])){utils[_0xebc6('0x11')](util[_0xebc6('0x3')]('[%s][queues][hangup]',_0x25a119['uniqueid']),_0x25a119);if(queues[_0x25a119[_0xebc6('0x5')]]['queuecallerleaveAt']){if(!queues[_0x25a119[_0xebc6('0x5')]]['queuecallerabandon']&&!queues[_0x25a119['uniqueid']][_0xebc6('0x19')]){queues[_0x25a119[_0xebc6('0x5')]]['queuecallercomplete']=!![];queues[_0x25a119[_0xebc6('0x5')]][_0xebc6('0x1a')]=utils[_0xebc6('0x16')]();queues[_0x25a119[_0xebc6('0x5')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils['info'](util['format'](_0xebc6('0x1b'),_0x25a119[_0xebc6('0x5')],queues[_0x25a119[_0xebc6('0x5')]][_0xebc6('0x1c')],queues[_0x25a119[_0xebc6('0x5')]][_0xebc6('0x1d')]));writeDB(queues[_0x25a119['uniqueid']]);}else if(queues[_0x25a119[_0xebc6('0x5')]][_0xebc6('0xf')]){utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x1e'),_0x25a119[_0xebc6('0x5')],queues[_0x25a119[_0xebc6('0x5')]][_0xebc6('0x1c')],queues[_0x25a119[_0xebc6('0x5')]][_0xebc6('0xf')]));queues[queues[_0x25a119['uniqueid']]['transfereduniqueid']]=queues[_0x25a119[_0xebc6('0x5')]];queues[queues[_0x25a119[_0xebc6('0x5')]][_0xebc6('0xf')]][_0xebc6('0x1f')]=0x2;delete queues[_0x25a119[_0xebc6('0x5')]];}}}catch(_0x4d0f0d){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x21'),_0x25a119[_0xebc6('0x5')]),_0x4d0f0d);}};exports[_0xebc6('0x22')]=function(_0x3212a1){try{utils[_0xebc6('0x11')](util[_0xebc6('0x3')]('[%s][queues][varset]',_0x3212a1[_0xebc6('0x5')]),_0x3212a1);if(!_['isNil'](_0x3212a1[_0xebc6('0x23')]['queuestatus'])&&_0x3212a1[_0xebc6('0x24')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xebc6('0x18')](queues[_0x3212a1['uniqueid']])){queues[_0x3212a1['uniqueid']][_0xebc6('0x25')]=![];queues[_0x3212a1['uniqueid']][_0xebc6('0x26')]=null;queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x19')]=!![];queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x27')]=utils[_0xebc6('0x16')]();queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x1d')]=_0x3212a1[_0xebc6('0x24')]['toUpperCase']();utils['info'](util['format'](_0xebc6('0x28'),_0x3212a1[_0xebc6('0x5')],queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x1c')],_0x3212a1[_0xebc6('0x24')],queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x1d')]));writeDB(queues[_0x3212a1['uniqueid']]);}}else if(!_[_0xebc6('0x18')](_0x3212a1[_0xebc6('0x23')][_0xebc6('0x29')])){if(!_[_0xebc6('0x18')](queues[_0x3212a1[_0xebc6('0x5')]])&&!queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x25')]){queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x25')]=![];queues[_0x3212a1['uniqueid']][_0xebc6('0x26')]=null;queues[_0x3212a1['uniqueid']][_0xebc6('0x19')]=!![];queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x27')]=utils[_0xebc6('0x16')]();queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x1d')]=_0xebc6('0x2a');utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x2b'),_0x3212a1[_0xebc6('0x5')],queues[_0x3212a1[_0xebc6('0x5')]][_0xebc6('0x1c')],_0x3212a1[_0xebc6('0x24')],queues[_0x3212a1['uniqueid']][_0xebc6('0x1d')]));}}}catch(_0x1dc8bc){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x2c'),_0x3212a1[_0xebc6('0x5')]),_0x1dc8bc);}};exports[_0xebc6('0x25')]=function(_0x5e37b0){try{if(!_['isNil'](queues[_0x5e37b0[_0xebc6('0x5')]])){utils[_0xebc6('0x11')](util[_0xebc6('0x3')](_0xebc6('0x2d'),_0x5e37b0['uniqueid']),_0x5e37b0);queues[_0x5e37b0[_0xebc6('0x5')]][_0xebc6('0x19')]=![];queues[_0x5e37b0[_0xebc6('0x5')]][_0xebc6('0x27')]=null;queues[_0x5e37b0[_0xebc6('0x5')]][_0xebc6('0x25')]=!![];queues[_0x5e37b0[_0xebc6('0x5')]][_0xebc6('0x26')]=utils['now']();queues[_0x5e37b0[_0xebc6('0x5')]][_0xebc6('0x1d')]=_0xebc6('0x2e');utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x2f'),_0x5e37b0[_0xebc6('0x5')],queues[_0x5e37b0['uniqueid']][_0xebc6('0x1c')],queues[_0x5e37b0[_0xebc6('0x5')]][_0xebc6('0x1d')]));}}catch(_0x48ea06){utils['error'](util[_0xebc6('0x3')]('[%s][queues][queuecallerabandon]',_0x5e37b0[_0xebc6('0x5')]),_0x48ea06);}};exports[_0xebc6('0x30')]=function(_0x313de5){try{if(!_['isNil'](queues[_0x313de5['uniqueid']])){utils[_0xebc6('0x11')](util[_0xebc6('0x3')](_0xebc6('0x31'),_0x313de5[_0xebc6('0x5')]),_0x313de5);utils[_0xebc6('0x2')](util['format'](_0xebc6('0x32'),_0x313de5['uniqueid'],queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x1c')],_0x313de5[_0xebc6('0x33')],_0x313de5[_0xebc6('0x34')]));queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x30')]=!![];queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x35')]=utils[_0xebc6('0x16')]();queues[_0x313de5[_0xebc6('0x5')]]['holdtime']=utils['diffTime'](queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x35')],queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x36')]);queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x14')]=_0x313de5[_0xebc6('0x14')];queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x37')]=_0x313de5[_0xebc6('0x37')];queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x33')]=_0x313de5[_0xebc6('0x33')];queues[_0x313de5[_0xebc6('0x5')]][_0xebc6('0x34')]=_0x313de5[_0xebc6('0x34')];}}catch(_0x58efb7){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x31'),_0x313de5[_0xebc6('0x5')]),_0x58efb7);}};exports[_0xebc6('0x38')]=function(_0xd5cf8c){try{if(!_[_0xebc6('0x18')](queues[_0xd5cf8c[_0xebc6('0x5')]])){utils[_0xebc6('0x11')](util['format'](_0xebc6('0x39'),_0xd5cf8c[_0xebc6('0x5')]),_0xd5cf8c);utils['info'](util['format'](_0xebc6('0x3a'),_0xd5cf8c['uniqueid'],queues[_0xd5cf8c['uniqueid']]['name'],_0xd5cf8c['membername'],_0xd5cf8c[_0xebc6('0x3b')]));queues[_0xd5cf8c[_0xebc6('0x5')]][_0xebc6('0x25')]=![];queues[_0xd5cf8c[_0xebc6('0x5')]]['queuecallerabandon']=![];queues[_0xd5cf8c[_0xebc6('0x5')]][_0xebc6('0x26')]=null;queues[_0xd5cf8c['uniqueid']][_0xebc6('0x19')]=![];queues[_0xd5cf8c[_0xebc6('0x5')]][_0xebc6('0x1d')]=null;queues[_0xd5cf8c[_0xebc6('0x5')]][_0xebc6('0x27')]=null;queues[_0xd5cf8c[_0xebc6('0x5')]]['assigned']=!![];queues[_0xd5cf8c[_0xebc6('0x5')]][_0xebc6('0xa')]=_0xd5cf8c[_0xebc6('0x3b')];queues[_0xd5cf8c[_0xebc6('0x5')]][_0xebc6('0x8')]=_0xd5cf8c[_0xebc6('0x3c')];}}catch(_0x382bfe){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x39'),_0xd5cf8c['uniqueid']),_0x382bfe);}};exports[_0xebc6('0x3d')]=function(_0x21ae53){try{if(!_[_0xebc6('0x18')](queues[_0x21ae53[_0xebc6('0x5')]])){if(queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x35')]){utils[_0xebc6('0x11')](util['format'](_0xebc6('0x3e'),_0x21ae53[_0xebc6('0x5')]),_0x21ae53);queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x25')]=![];queues[_0x21ae53['uniqueid']][_0xebc6('0x25')]=![];queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x26')]=null;queues[_0x21ae53['uniqueid']]['queuecallerexit']=![];queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x27')]=null;queues[_0x21ae53[_0xebc6('0x5')]]['assigned']=!![];queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x8')]=_0x21ae53[_0xebc6('0x3c')];queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x3f')]=!![];queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x1a')]=utils[_0xebc6('0x16')]();if(_0x21ae53[_0xebc6('0x40')]=='transfer'){if(!queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x41')]){queues[_0x21ae53[_0xebc6('0x5')]][_0xebc6('0x1d')]=_0xebc6('0x42');}}else{queues[_0x21ae53[_0xebc6('0x5')]]['queuecallerexitreason']=_0xebc6('0x43')+_0x21ae53[_0xebc6('0x40')][_0xebc6('0x44')]();}utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x45'),_0x21ae53['uniqueid'],queues[_0x21ae53[_0xebc6('0x5')]]['name'],_0x21ae53[_0xebc6('0x3c')],queues[_0x21ae53['uniqueid']][_0xebc6('0x1d')]));writeDB(queues[_0x21ae53['uniqueid']]);}}}catch(_0x2af413){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x3e'),_0x21ae53[_0xebc6('0x5')]),_0x2af413);}};exports['blindtransfer']=function(_0x58aeb4){try{if(!_[_0xebc6('0x18')](queues[_0x58aeb4[_0xebc6('0x46')]])){utils['debug'](util[_0xebc6('0x3')](_0xebc6('0x47'),_0x58aeb4[_0xebc6('0x5')]),_0x58aeb4);queues[_0x58aeb4[_0xebc6('0x46')]][_0xebc6('0x41')]=!![];queues[_0x58aeb4[_0xebc6('0x46')]][_0xebc6('0x48')]='BLIND';queues[_0x58aeb4[_0xebc6('0x46')]]['transferexten']=_0x58aeb4[_0xebc6('0x49')];queues[_0x58aeb4[_0xebc6('0x46')]][_0xebc6('0x4a')]=_0x58aeb4[_0xebc6('0x46')];queues[_0x58aeb4[_0xebc6('0x46')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x4b'),_0x58aeb4[_0xebc6('0x5')],queues[_0x58aeb4[_0xebc6('0x46')]]['name'],_0x58aeb4['transfereeuniqueid'],_0x58aeb4[_0xebc6('0x49')]));}}catch(_0x2683cf){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x47'),_0x58aeb4[_0xebc6('0x5')]),_0x2683cf);}};exports[_0xebc6('0x4c')]=function(_0x457037){try{utils['debug'](util[_0xebc6('0x3')](_0xebc6('0x4d'),_0x457037[_0xebc6('0x4e')]),_0x457037);if(_0x457037['origtransfereruniqueid']==_0x457037[_0xebc6('0x4f')]){if(!_[_0xebc6('0x18')](queues[_0x457037[_0xebc6('0x50')]])){utils['info'](util[_0xebc6('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x457037[_0xebc6('0x4e')],queues[_0x457037['secondtransfererlinkedid']][_0xebc6('0x1c')],_0x457037[_0xebc6('0x51')]));queues[_0x457037[_0xebc6('0x50')]][_0xebc6('0x41')]=!![];queues[_0x457037['secondtransfererlinkedid']][_0xebc6('0x48')]=_0xebc6('0x52');queues[_0x457037['secondtransfererlinkedid']][_0xebc6('0x53')]=_0x457037['origtransfererexten'];queues[_0x457037[_0xebc6('0x50')]][_0xebc6('0x4a')]=_0x457037[_0xebc6('0x4e')];queues[_0x457037[_0xebc6('0x50')]][_0xebc6('0x1d')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x457037[_0xebc6('0x4f')]])){if(_0x457037[_0xebc6('0x54')]&&queues[_0x457037['transfereelinkedid']]){queues[_0x457037[_0xebc6('0x54')]]['queuecallerenterreason']=0x1;queues[_0x457037[_0xebc6('0x46')]]=_[_0xebc6('0x55')](queues[_0x457037[_0xebc6('0x54')]]);queues[_0x457037['transfereeuniqueid']][_0xebc6('0xf')]=_0x457037['transfertargetuniqueid'];queues[_0x457037[_0xebc6('0x46')]][_0xebc6('0x1f')]=0x2;queues[_0x457037[_0xebc6('0x46')]]['calleridnum']=queues[_0x457037[_0xebc6('0x50')]][_0xebc6('0x9')];queues[_0x457037[_0xebc6('0x46')]][_0xebc6('0x56')]=queues[_0x457037[_0xebc6('0x50')]]['calleridname'];queues[_0x457037[_0xebc6('0x46')]][_0xebc6('0x36')]=utils[_0xebc6('0x16')]();queues[_0x457037['transfereeuniqueid']][_0xebc6('0x35')]=utils['now']();queues[_0x457037[_0xebc6('0x46')]][_0xebc6('0x57')]=0x0;queues[_0x457037['transfereeuniqueid']][_0xebc6('0x58')]=0x0;utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x59'),_0x457037[_0xebc6('0x4e')],queues[_0x457037[_0xebc6('0x46')]]['name'],queues[_0x457037[_0xebc6('0x46')]][_0xebc6('0x9')],queues[_0x457037[_0xebc6('0x46')]][_0xebc6('0x56')]));}else{utils[_0xebc6('0x2')](util[_0xebc6('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x457037[_0xebc6('0x4e')],queues[_0x457037[_0xebc6('0x4f')]][_0xebc6('0x1c')],_0x457037[_0xebc6('0x50')]));queues[_0x457037[_0xebc6('0x4f')]][_0xebc6('0xf')]=_0x457037[_0xebc6('0x50')];}}}else if(_0x457037[_0xebc6('0x5a')]==_0x457037[_0xebc6('0x50')]){if(!_[_0xebc6('0x18')](queues[_0x457037[_0xebc6('0x4f')]])){utils['info'](util[_0xebc6('0x3')](_0xebc6('0x5b'),_0x457037[_0xebc6('0x4e')],queues[_0x457037['origtransfererlinkedid']][_0xebc6('0x1c')],_0x457037['secondtransfereruniqueid'],_0x457037[_0xebc6('0x5c')]));queues[_0x457037[_0xebc6('0x4f')]][_0xebc6('0x41')]=!![];queues[_0x457037[_0xebc6('0x4f')]][_0xebc6('0x48')]='ATTENDED';queues[_0x457037[_0xebc6('0x4f')]][_0xebc6('0x53')]=_0x457037['secondtransfererexten'];queues[_0x457037[_0xebc6('0x4f')]][_0xebc6('0x4a')]=_0x457037[_0xebc6('0x5a')];queues[_0x457037[_0xebc6('0x4f')]][_0xebc6('0x1d')]=_0xebc6('0x5d');}if(!_[_0xebc6('0x18')](queues[_0x457037[_0xebc6('0x50')]])){if(_0x457037[_0xebc6('0x5e')]&&queues[_0x457037[_0xebc6('0x5e')]]){queues[_0x457037[_0xebc6('0x5e')]][_0xebc6('0x1f')]=0x1;queues[_0x457037[_0xebc6('0x5f')]]=_['clone'](queues[_0x457037[_0xebc6('0x5e')]]);queues[_0x457037[_0xebc6('0x5f')]][_0xebc6('0xf')]=_0x457037[_0xebc6('0x5f')];queues[_0x457037[_0xebc6('0x5f')]][_0xebc6('0x1f')]=0x2;queues[_0x457037['transfertargetuniqueid']][_0xebc6('0x9')]=queues[_0x457037[_0xebc6('0x4f')]][_0xebc6('0x9')];queues[_0x457037[_0xebc6('0x5f')]]['calleridname']=queues[_0x457037['origtransfererlinkedid']]['calleridname'];queues[_0x457037[_0xebc6('0x5f')]]['queuecallerjoinAt']=utils[_0xebc6('0x16')]();queues[_0x457037[_0xebc6('0x5f')]][_0xebc6('0x35')]=utils['now']();queues[_0x457037[_0xebc6('0x5f')]][_0xebc6('0x57')]=0x0;queues[_0x457037[_0xebc6('0x5f')]][_0xebc6('0x58')]=0x0;utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x60'),_0x457037[_0xebc6('0x4e')],queues[_0x457037['transfertargetuniqueid']][_0xebc6('0x1c')],queues[_0x457037[_0xebc6('0x5f')]]['transfereduniqueid'],queues[_0x457037[_0xebc6('0x5f')]][_0xebc6('0x9')],queues[_0x457037[_0xebc6('0x5f')]][_0xebc6('0x56')]));}else{utils[_0xebc6('0x2')](util[_0xebc6('0x3')](_0xebc6('0x61'),_0x457037[_0xebc6('0x4e')],queues[_0x457037[_0xebc6('0x50')]][_0xebc6('0x1c')],_0x457037['origtransfererlinkedid']));queues[_0x457037[_0xebc6('0x50')]][_0xebc6('0xf')]=_0x457037[_0xebc6('0x4f')];}}}}catch(_0x59e1a8){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x4d'),_0x457037[_0xebc6('0x4e')]),_0x59e1a8);}};exports['musiconholdstart']=function(_0x5ff856){try{if(!_['isNil'](queues[_0x5ff856[_0xebc6('0x5')]])){utils['debug'](util[_0xebc6('0x3')](_0xebc6('0x62'),_0x5ff856[_0xebc6('0x5')]),_0x5ff856);queues[_0x5ff856['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0xebc6('0x2')](util['format'](_0xebc6('0x63'),_0x5ff856[_0xebc6('0x5')],queues[_0x5ff856[_0xebc6('0x5')]][_0xebc6('0x1c')],queues[_0x5ff856[_0xebc6('0x5')]][_0xebc6('0x64')]));}}catch(_0x499cb3){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x62'),_0x5ff856['uniqueid']),_0x499cb3);}};exports[_0xebc6('0x65')]=function(_0x287b72){try{if(!_[_0xebc6('0x18')](queues[_0x287b72[_0xebc6('0x5')]])){if(!_['isNil'](queues[_0x287b72[_0xebc6('0x5')]][_0xebc6('0x64')])){utils[_0xebc6('0x11')](util[_0xebc6('0x3')]('[%s][queues][musiconholdstop]',_0x287b72[_0xebc6('0x5')]),_0x287b72);queues[_0x287b72[_0xebc6('0x5')]][_0xebc6('0x58')]+=utils[_0xebc6('0x66')](utils['now'](),queues[_0x287b72[_0xebc6('0x5')]][_0xebc6('0x64')]);utils['info'](util[_0xebc6('0x3')](_0xebc6('0x67'),_0x287b72['uniqueid'],queues[_0x287b72[_0xebc6('0x5')]][_0xebc6('0x1c')],queues[_0x287b72[_0xebc6('0x5')]][_0xebc6('0x58')]));delete queues[_0x287b72[_0xebc6('0x5')]][_0xebc6('0x64')];}}}catch(_0x28db81){utils[_0xebc6('0x20')](util[_0xebc6('0x3')](_0xebc6('0x68'),_0x287b72['uniqueid']),_0x28db81);}}; \ No newline at end of file +var _0x04b5=['[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','error','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','toUpperCase','[%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','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s'];(function(_0x1e40ec,_0x10f980){var _0x437917=function(_0x125df6){while(--_0x125df6){_0x1e40ec['push'](_0x1e40ec['shift']());}};_0x437917(++_0x10f980);}(_0x04b5,0x146));var _0x504b=function(_0x1b17ca,_0x3adb66){_0x1b17ca=_0x1b17ca-0x0;var _0x4b627d=_0x04b5[_0x1b17ca];return _0x4b627d;};'use strict';var _=require(_0x504b('0x0'));var util=require(_0x504b('0x1'));var utils=require(_0x504b('0x2'));var queues={};function writeDB(_0x4388bf){utils['info'](util[_0x504b('0x3')](_0x504b('0x4'),_0x4388bf['uniqueid'],_0x4388bf[_0x504b('0x5')],_0x4388bf[_0x504b('0x6')],_0x4388bf[_0x504b('0x7')],_0x4388bf[_0x504b('0x8')],_0x4388bf['accountcode'],_0x4388bf[_0x504b('0x9')]));if(_0x4388bf[_0x504b('0x6')]){utils['getVoiceQueueByName'](_0x4388bf['queue'])['then'](function(_0x47bc2d){if(_0x47bc2d){_0x4388bf['type']=_0x47bc2d[_0x504b('0xa')];}utils['request'](_0x504b('0xb'),_0x4388bf);});}else{utils[_0x504b('0xc')]('CreateVoiceQueueReport',_0x4388bf);}if(_0x4388bf[_0x504b('0xd')]){delete queues[_0x4388bf[_0x504b('0xd')]];}else{delete queues[_0x4388bf['uniqueid']];}}exports[_0x504b('0xe')]=function(_0xe7e5bf){try{utils[_0x504b('0xf')](util[_0x504b('0x3')](_0x504b('0x10'),_0xe7e5bf[_0x504b('0x11')]),_0xe7e5bf);utils[_0x504b('0x12')](util[_0x504b('0x3')](_0x504b('0x13'),_0xe7e5bf[_0x504b('0x11')],_0xe7e5bf[_0x504b('0x6')],_0xe7e5bf['position']));queues[_0xe7e5bf[_0x504b('0x11')]]=_[_0x504b('0x14')](_0xe7e5bf,{'originalposition':_0xe7e5bf[_0x504b('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x261646){utils[_0x504b('0x16')](util[_0x504b('0x3')](_0x504b('0x10'),_0xe7e5bf[_0x504b('0x11')]),_0x261646);}};exports['hangup']=function(_0x56b4f7){try{if(!_['isNil'](queues[_0x56b4f7[_0x504b('0x11')]])){utils[_0x504b('0xf')](util[_0x504b('0x3')](_0x504b('0x17'),_0x56b4f7[_0x504b('0x11')]),_0x56b4f7);if(queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0x18')]){if(!queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0x19')]&&!queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0x1a')]){queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0x1b')]=!![];queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0x1c')]=utils['now']();queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0x9')]=_0x504b('0x1d');}utils['info'](util[_0x504b('0x3')](_0x504b('0x1e'),_0x56b4f7[_0x504b('0x11')],queues[_0x56b4f7['uniqueid']][_0x504b('0x1f')],queues[_0x56b4f7['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x56b4f7[_0x504b('0x11')]]);}else if(queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0xd')]){utils[_0x504b('0x12')](util[_0x504b('0x3')](_0x504b('0x20'),_0x56b4f7['uniqueid'],queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0x1f')],queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0xd')]));queues[queues[_0x56b4f7[_0x504b('0x11')]][_0x504b('0xd')]]=queues[_0x56b4f7['uniqueid']];queues[queues[_0x56b4f7['uniqueid']][_0x504b('0xd')]][_0x504b('0x21')]=0x2;delete queues[_0x56b4f7[_0x504b('0x11')]];}}}catch(_0x437941){utils[_0x504b('0x16')](util['format'](_0x504b('0x17'),_0x56b4f7['uniqueid']),_0x437941);}};exports[_0x504b('0x22')]=function(_0x8b32c3){try{utils[_0x504b('0xf')](util['format'](_0x504b('0x23'),_0x8b32c3[_0x504b('0x11')]),_0x8b32c3);if(!_[_0x504b('0x24')](_0x8b32c3['variable'][_0x504b('0x25')])&&_0x8b32c3[_0x504b('0x26')]['toUpperCase']()!==_0x504b('0x27')){if(!_['isNil'](queues[_0x8b32c3[_0x504b('0x11')]])){queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x19')]=![];queues[_0x8b32c3['uniqueid']][_0x504b('0x28')]=null;queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x1a')]=!![];queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x29')]=utils[_0x504b('0x2a')]();queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x9')]=_0x8b32c3[_0x504b('0x26')][_0x504b('0x2b')]();utils['info'](util[_0x504b('0x3')](_0x504b('0x2c'),_0x8b32c3[_0x504b('0x11')],queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x1f')],_0x8b32c3['value'],queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x9')]));writeDB(queues[_0x8b32c3[_0x504b('0x11')]]);}}else if(!_['isNil'](_0x8b32c3['variable'][_0x504b('0x2d')])){if(!_[_0x504b('0x24')](queues[_0x8b32c3[_0x504b('0x11')]])&&!queues[_0x8b32c3[_0x504b('0x11')]]['queuecallerabandon']){queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x19')]=![];queues[_0x8b32c3['uniqueid']][_0x504b('0x28')]=null;queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x1a')]=!![];queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x29')]=utils[_0x504b('0x2a')]();queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x9')]=_0x504b('0x2e');utils['info'](util[_0x504b('0x3')](_0x504b('0x2f'),_0x8b32c3[_0x504b('0x11')],queues[_0x8b32c3['uniqueid']][_0x504b('0x1f')],_0x8b32c3[_0x504b('0x26')],queues[_0x8b32c3[_0x504b('0x11')]][_0x504b('0x9')]));}}}catch(_0x4c99a7){utils[_0x504b('0x16')](util[_0x504b('0x3')](_0x504b('0x23'),_0x8b32c3[_0x504b('0x11')]),_0x4c99a7);}};exports[_0x504b('0x19')]=function(_0x268359){try{if(!_[_0x504b('0x24')](queues[_0x268359[_0x504b('0x11')]])){utils['debug'](util[_0x504b('0x3')](_0x504b('0x30'),_0x268359[_0x504b('0x11')]),_0x268359);queues[_0x268359[_0x504b('0x11')]][_0x504b('0x1a')]=![];queues[_0x268359[_0x504b('0x11')]][_0x504b('0x29')]=null;queues[_0x268359[_0x504b('0x11')]][_0x504b('0x19')]=!![];queues[_0x268359[_0x504b('0x11')]][_0x504b('0x28')]=utils[_0x504b('0x2a')]();queues[_0x268359[_0x504b('0x11')]][_0x504b('0x9')]=_0x504b('0x31');utils[_0x504b('0x12')](util[_0x504b('0x3')](_0x504b('0x32'),_0x268359['uniqueid'],queues[_0x268359[_0x504b('0x11')]][_0x504b('0x1f')],queues[_0x268359['uniqueid']]['queuecallerexitreason']));}}catch(_0x2d6d52){utils[_0x504b('0x16')](util['format'](_0x504b('0x30'),_0x268359[_0x504b('0x11')]),_0x2d6d52);}};exports['queuecallerleave']=function(_0x184bb3){try{if(!_[_0x504b('0x24')](queues[_0x184bb3[_0x504b('0x11')]])){utils[_0x504b('0xf')](util[_0x504b('0x3')](_0x504b('0x33'),_0x184bb3[_0x504b('0x11')]),_0x184bb3);utils['info'](util[_0x504b('0x3')](_0x504b('0x34'),_0x184bb3[_0x504b('0x11')],queues[_0x184bb3[_0x504b('0x11')]][_0x504b('0x1f')],_0x184bb3[_0x504b('0x35')],_0x184bb3[_0x504b('0x36')]));queues[_0x184bb3['uniqueid']][_0x504b('0x37')]=!![];queues[_0x184bb3['uniqueid']]['queuecallerleaveAt']=utils[_0x504b('0x2a')]();queues[_0x184bb3[_0x504b('0x11')]][_0x504b('0x38')]=utils[_0x504b('0x39')](queues[_0x184bb3[_0x504b('0x11')]][_0x504b('0x18')],queues[_0x184bb3[_0x504b('0x11')]][_0x504b('0x3a')]);queues[_0x184bb3[_0x504b('0x11')]][_0x504b('0x15')]=_0x184bb3[_0x504b('0x15')];queues[_0x184bb3['uniqueid']]['count']=_0x184bb3[_0x504b('0x3b')];queues[_0x184bb3[_0x504b('0x11')]][_0x504b('0x35')]=_0x184bb3[_0x504b('0x35')];queues[_0x184bb3[_0x504b('0x11')]][_0x504b('0x36')]=_0x184bb3[_0x504b('0x36')];}}catch(_0x3ddd3b){utils['error'](util[_0x504b('0x3')](_0x504b('0x33'),_0x184bb3[_0x504b('0x11')]),_0x3ddd3b);}};exports[_0x504b('0x3c')]=function(_0x1f4610){try{if(!_[_0x504b('0x24')](queues[_0x1f4610[_0x504b('0x11')]])){utils[_0x504b('0xf')](util[_0x504b('0x3')](_0x504b('0x3d'),_0x1f4610[_0x504b('0x11')]),_0x1f4610);utils[_0x504b('0x12')](util['format'](_0x504b('0x3e'),_0x1f4610[_0x504b('0x11')],queues[_0x1f4610[_0x504b('0x11')]][_0x504b('0x1f')],_0x1f4610['membername'],_0x1f4610[_0x504b('0x3f')]));queues[_0x1f4610[_0x504b('0x11')]][_0x504b('0x19')]=![];queues[_0x1f4610[_0x504b('0x11')]][_0x504b('0x19')]=![];queues[_0x1f4610[_0x504b('0x11')]][_0x504b('0x28')]=null;queues[_0x1f4610[_0x504b('0x11')]][_0x504b('0x1a')]=![];queues[_0x1f4610[_0x504b('0x11')]][_0x504b('0x9')]=null;queues[_0x1f4610[_0x504b('0x11')]][_0x504b('0x29')]=null;queues[_0x1f4610[_0x504b('0x11')]][_0x504b('0x40')]=!![];queues[_0x1f4610['uniqueid']]['accountcode']=_0x1f4610[_0x504b('0x3f')];queues[_0x1f4610['uniqueid']][_0x504b('0x7')]=_0x1f4610[_0x504b('0x41')];}}catch(_0xb1564c){utils[_0x504b('0x16')](util[_0x504b('0x3')](_0x504b('0x3d'),_0x1f4610[_0x504b('0x11')]),_0xb1564c);}};exports[_0x504b('0x42')]=function(_0x44fc57){try{if(!_[_0x504b('0x24')](queues[_0x44fc57[_0x504b('0x11')]])){if(queues[_0x44fc57[_0x504b('0x11')]]['queuecallerleaveAt']){utils[_0x504b('0xf')](util[_0x504b('0x3')]('[%s][queues][agentcomplete]',_0x44fc57[_0x504b('0x11')]),_0x44fc57);queues[_0x44fc57['uniqueid']]['queuecallerabandon']=![];queues[_0x44fc57[_0x504b('0x11')]][_0x504b('0x19')]=![];queues[_0x44fc57[_0x504b('0x11')]][_0x504b('0x28')]=null;queues[_0x44fc57['uniqueid']]['queuecallerexit']=![];queues[_0x44fc57[_0x504b('0x11')]][_0x504b('0x29')]=null;queues[_0x44fc57[_0x504b('0x11')]]['assigned']=!![];queues[_0x44fc57[_0x504b('0x11')]][_0x504b('0x7')]=_0x44fc57[_0x504b('0x41')];queues[_0x44fc57['uniqueid']]['queuecallercomplete']=!![];queues[_0x44fc57[_0x504b('0x11')]]['queuecallercompleteAt']=utils['now']();if(_0x44fc57[_0x504b('0x43')]==_0x504b('0x44')){if(!queues[_0x44fc57['uniqueid']][_0x504b('0x44')]){queues[_0x44fc57['uniqueid']]['queuecallerexitreason']=_0x504b('0x45');}}else{queues[_0x44fc57[_0x504b('0x11')]][_0x504b('0x9')]=_0x504b('0x46')+_0x44fc57['reason'][_0x504b('0x2b')]();}utils[_0x504b('0x12')](util[_0x504b('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x44fc57[_0x504b('0x11')],queues[_0x44fc57[_0x504b('0x11')]][_0x504b('0x1f')],_0x44fc57[_0x504b('0x41')],queues[_0x44fc57[_0x504b('0x11')]][_0x504b('0x9')]));writeDB(queues[_0x44fc57[_0x504b('0x11')]]);}}}catch(_0x347340){utils[_0x504b('0x16')](util[_0x504b('0x3')](_0x504b('0x47'),_0x44fc57[_0x504b('0x11')]),_0x347340);}};exports[_0x504b('0x48')]=function(_0x2b825e){try{if(!_[_0x504b('0x24')](queues[_0x2b825e[_0x504b('0x49')]])){utils[_0x504b('0xf')](util[_0x504b('0x3')](_0x504b('0x4a'),_0x2b825e[_0x504b('0x11')]),_0x2b825e);queues[_0x2b825e['transfereeuniqueid']]['transfer']=!![];queues[_0x2b825e[_0x504b('0x49')]]['transfertype']=_0x504b('0x4b');queues[_0x2b825e[_0x504b('0x49')]][_0x504b('0x4c')]=_0x2b825e['extension'];queues[_0x2b825e['transfereeuniqueid']]['transferuniqueid']=_0x2b825e[_0x504b('0x49')];queues[_0x2b825e['transfereeuniqueid']][_0x504b('0x9')]=_0x504b('0x4d');utils[_0x504b('0x12')](util[_0x504b('0x3')](_0x504b('0x4e'),_0x2b825e[_0x504b('0x11')],queues[_0x2b825e[_0x504b('0x49')]][_0x504b('0x1f')],_0x2b825e[_0x504b('0x49')],_0x2b825e[_0x504b('0x4f')]));}}catch(_0x34436f){utils[_0x504b('0x16')](util['format'](_0x504b('0x4a'),_0x2b825e['uniqueid']),_0x34436f);}};exports[_0x504b('0x50')]=function(_0x467760){try{utils['debug'](util[_0x504b('0x3')](_0x504b('0x51'),_0x467760[_0x504b('0x52')]),_0x467760);if(_0x467760[_0x504b('0x52')]==_0x467760[_0x504b('0x53')]){if(!_[_0x504b('0x24')](queues[_0x467760[_0x504b('0x54')]])){utils[_0x504b('0x12')](util['format'](_0x504b('0x55'),_0x467760[_0x504b('0x52')],queues[_0x467760[_0x504b('0x54')]][_0x504b('0x1f')],_0x467760[_0x504b('0x56')]));queues[_0x467760[_0x504b('0x54')]][_0x504b('0x44')]=!![];queues[_0x467760[_0x504b('0x54')]][_0x504b('0x57')]=_0x504b('0x58');queues[_0x467760[_0x504b('0x54')]][_0x504b('0x4c')]=_0x467760[_0x504b('0x56')];queues[_0x467760['secondtransfererlinkedid']][_0x504b('0x59')]=_0x467760[_0x504b('0x52')];queues[_0x467760['secondtransfererlinkedid']]['queuecallerexitreason']=_0x504b('0x5a');}if(!_['isNil'](queues[_0x467760[_0x504b('0x53')]])){if(_0x467760['transfereelinkedid']&&queues[_0x467760['transfereelinkedid']]){queues[_0x467760[_0x504b('0x5b')]][_0x504b('0x21')]=0x1;queues[_0x467760[_0x504b('0x49')]]=_[_0x504b('0x5c')](queues[_0x467760[_0x504b('0x5b')]]);queues[_0x467760[_0x504b('0x49')]][_0x504b('0xd')]=_0x467760['transfertargetuniqueid'];queues[_0x467760[_0x504b('0x49')]][_0x504b('0x21')]=0x2;queues[_0x467760[_0x504b('0x49')]][_0x504b('0x8')]=queues[_0x467760[_0x504b('0x54')]][_0x504b('0x8')];queues[_0x467760[_0x504b('0x49')]][_0x504b('0x5d')]=queues[_0x467760['secondtransfererlinkedid']][_0x504b('0x5d')];queues[_0x467760[_0x504b('0x49')]]['queuecallerjoinAt']=utils['now']();queues[_0x467760[_0x504b('0x49')]][_0x504b('0x18')]=utils[_0x504b('0x2a')]();queues[_0x467760[_0x504b('0x49')]][_0x504b('0x38')]=0x0;queues[_0x467760[_0x504b('0x49')]]['mohtime']=0x0;utils['info'](util[_0x504b('0x3')](_0x504b('0x5e'),_0x467760['origtransfereruniqueid'],queues[_0x467760[_0x504b('0x49')]]['name'],queues[_0x467760['transfereeuniqueid']][_0x504b('0x8')],queues[_0x467760[_0x504b('0x49')]][_0x504b('0x5d')]));}else{utils[_0x504b('0x12')](util[_0x504b('0x3')](_0x504b('0x5f'),_0x467760[_0x504b('0x52')],queues[_0x467760['origtransfererlinkedid']]['name'],_0x467760[_0x504b('0x54')]));queues[_0x467760[_0x504b('0x53')]][_0x504b('0xd')]=_0x467760[_0x504b('0x54')];}}}else if(_0x467760['secondtransfereruniqueid']==_0x467760['secondtransfererlinkedid']){if(!_[_0x504b('0x24')](queues[_0x467760[_0x504b('0x53')]])){utils[_0x504b('0x12')](util[_0x504b('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x467760[_0x504b('0x52')],queues[_0x467760[_0x504b('0x53')]][_0x504b('0x1f')],_0x467760[_0x504b('0x60')],_0x467760[_0x504b('0x61')]));queues[_0x467760[_0x504b('0x53')]]['transfer']=!![];queues[_0x467760[_0x504b('0x53')]][_0x504b('0x57')]=_0x504b('0x58');queues[_0x467760[_0x504b('0x53')]][_0x504b('0x4c')]=_0x467760['secondtransfererexten'];queues[_0x467760['origtransfererlinkedid']][_0x504b('0x59')]=_0x467760['secondtransfereruniqueid'];queues[_0x467760[_0x504b('0x53')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x467760['secondtransfererlinkedid']])){if(_0x467760[_0x504b('0x62')]&&queues[_0x467760[_0x504b('0x62')]]){queues[_0x467760[_0x504b('0x62')]][_0x504b('0x21')]=0x1;queues[_0x467760[_0x504b('0x63')]]=_[_0x504b('0x5c')](queues[_0x467760['transfertargetlinkedid']]);queues[_0x467760[_0x504b('0x63')]][_0x504b('0xd')]=_0x467760[_0x504b('0x63')];queues[_0x467760['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x467760[_0x504b('0x63')]][_0x504b('0x8')]=queues[_0x467760['origtransfererlinkedid']][_0x504b('0x8')];queues[_0x467760[_0x504b('0x63')]][_0x504b('0x5d')]=queues[_0x467760[_0x504b('0x53')]][_0x504b('0x5d')];queues[_0x467760[_0x504b('0x63')]][_0x504b('0x3a')]=utils[_0x504b('0x2a')]();queues[_0x467760['transfertargetuniqueid']][_0x504b('0x18')]=utils[_0x504b('0x2a')]();queues[_0x467760[_0x504b('0x63')]][_0x504b('0x38')]=0x0;queues[_0x467760[_0x504b('0x63')]][_0x504b('0x64')]=0x0;utils[_0x504b('0x12')](util[_0x504b('0x3')](_0x504b('0x65'),_0x467760[_0x504b('0x52')],queues[_0x467760['transfertargetuniqueid']][_0x504b('0x1f')],queues[_0x467760[_0x504b('0x63')]][_0x504b('0xd')],queues[_0x467760[_0x504b('0x63')]][_0x504b('0x8')],queues[_0x467760[_0x504b('0x63')]][_0x504b('0x5d')]));}else{utils[_0x504b('0x12')](util[_0x504b('0x3')](_0x504b('0x5f'),_0x467760[_0x504b('0x52')],queues[_0x467760[_0x504b('0x54')]][_0x504b('0x1f')],_0x467760[_0x504b('0x53')]));queues[_0x467760[_0x504b('0x54')]]['transfereduniqueid']=_0x467760['origtransfererlinkedid'];}}}}catch(_0x10129a){utils['error'](util['format'](_0x504b('0x51'),_0x467760[_0x504b('0x52')]),_0x10129a);}};exports['musiconholdstart']=function(_0x430aee){try{if(!_['isNil'](queues[_0x430aee['uniqueid']])){utils[_0x504b('0xf')](util[_0x504b('0x3')](_0x504b('0x66'),_0x430aee[_0x504b('0x11')]),_0x430aee);queues[_0x430aee[_0x504b('0x11')]][_0x504b('0x67')]=utils['now']();utils['info'](util[_0x504b('0x3')](_0x504b('0x68'),_0x430aee[_0x504b('0x11')],queues[_0x430aee[_0x504b('0x11')]][_0x504b('0x1f')],queues[_0x430aee['uniqueid']]['musiconholdstartAt']));}}catch(_0x25ccb7){utils[_0x504b('0x16')](util['format'](_0x504b('0x66'),_0x430aee[_0x504b('0x11')]),_0x25ccb7);}};exports['musiconholdstop']=function(_0x5da384){try{if(!_['isNil'](queues[_0x5da384[_0x504b('0x11')]])){if(!_['isNil'](queues[_0x5da384[_0x504b('0x11')]][_0x504b('0x67')])){utils[_0x504b('0xf')](util[_0x504b('0x3')]('[%s][queues][musiconholdstop]',_0x5da384[_0x504b('0x11')]),_0x5da384);queues[_0x5da384[_0x504b('0x11')]][_0x504b('0x64')]+=utils[_0x504b('0x39')](utils['now'](),queues[_0x5da384[_0x504b('0x11')]]['musiconholdstartAt']);utils[_0x504b('0x12')](util[_0x504b('0x3')](_0x504b('0x69'),_0x5da384[_0x504b('0x11')],queues[_0x5da384[_0x504b('0x11')]][_0x504b('0x1f')],queues[_0x5da384[_0x504b('0x11')]][_0x504b('0x64')]));delete queues[_0x5da384[_0x504b('0x11')]][_0x504b('0x67')];}}}catch(_0x56494c){utils[_0x504b('0x16')](util['format'](_0x504b('0x6a'),_0x5da384[_0x504b('0x11')]),_0x56494c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index cbedfb5..448b244 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 _0x9557=['appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','./utils','info','format','[%s][recordings][writeDB]','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x9557,0x1d4));var _0x7955=function(_0x5956d6,_0x58b769){_0x5956d6=_0x5956d6-0x0;var _0x49d6e6=_0x9557[_0x5956d6];return _0x49d6e6;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x7955('0x0'));var recordings={};function writeDB(_0x293703){utils[_0x7955('0x1')](util[_0x7955('0x2')](_0x7955('0x3'),_0x293703['uniqueid']));if(_0x293703[_0x7955('0x4')]){utils['getUserByInternal'](_0x293703['accountcode'])[_0x7955('0x5')](function(_0x350372){if(_0x350372){_0x293703[_0x7955('0x6')]=_0x350372['name'];_0x293703[_0x7955('0x7')]=_0x350372['id'];}utils[_0x7955('0x8')]('CreateVoiceRecording',_0x293703);});}else{utils['request'](_0x7955('0x9'),_0x293703);}}exports[_0x7955('0xa')]=function(_0x13702d){try{utils[_0x7955('0xb')](util['format'](_0x7955('0xc'),_0x13702d[_0x7955('0xd')]),_0x13702d);if(_0x13702d[_0x7955('0xd')]==_0x13702d[_0x7955('0xe')]){utils['info'](util['format'](_0x7955('0xf'),_0x13702d[_0x7955('0xd')],_0x13702d[_0x7955('0x10')],_0x13702d[_0x7955('0x11')]));recordings[_0x13702d[_0x7955('0xd')]]={'uniqueid':_0x13702d[_0x7955('0xd')],'accountcode':_0x13702d['accountcode'],'exten':_0x13702d[_0x7955('0x11')],'context':_0x13702d[_0x7955('0x10')],'channel':_0x13702d[_0x7955('0x12')],'monitors':[]};}}catch(_0x17cf89){utils[_0x7955('0x13')](util['format']('[%s][recordings][newchannel]',_0x13702d[_0x7955('0xd')]),_0x17cf89);}};exports[_0x7955('0x14')]=function(_0x4cc5ba){try{utils[_0x7955('0xb')](util[_0x7955('0x2')](_0x7955('0x15'),_0x4cc5ba[_0x7955('0xd')]),_0x4cc5ba);if(!_[_0x7955('0x16')](recordings[_0x4cc5ba[_0x7955('0xd')]])&&_0x4cc5ba['channelstate']==0x6){utils[_0x7955('0x1')](util[_0x7955('0x2')](_0x7955('0x17'),_0x4cc5ba['uniqueid'],_0x4cc5ba[_0x7955('0x10')],_0x4cc5ba['channel']));}else if(!_[_0x7955('0x16')](recordings[_0x4cc5ba['linkedid']])&&_0x4cc5ba[_0x7955('0x18')]==0x6&&_0x4cc5ba[_0x7955('0x10')]!=_0x7955('0x19')){utils[_0x7955('0x1')](util[_0x7955('0x2')](_0x7955('0x1a'),_0x4cc5ba['uniqueid'],_0x4cc5ba[_0x7955('0xe')],_0x4cc5ba[_0x7955('0x10')],_0x4cc5ba['channel']));recordings[_0x4cc5ba[_0x7955('0xe')]][_0x7955('0x4')]=_0x4cc5ba[_0x7955('0x4')];}}catch(_0x156b1e){utils['error'](util['format'](_0x7955('0x15'),_0x4cc5ba[_0x7955('0xd')]),_0x156b1e);}};exports[_0x7955('0x1b')]=function(_0x3d7d23){try{if(!_[_0x7955('0x16')](_0x3d7d23['variable'])&&!_[_0x7955('0x16')](_0x3d7d23[_0x7955('0x1c')][_0x7955('0x1d')])){utils[_0x7955('0xb')](util['format']('[%s][recordings][varset]',_0x3d7d23[_0x7955('0xd')]),_0x3d7d23);utils[_0x7955('0x1')](util['format'](_0x7955('0x1e'),_0x3d7d23['uniqueid'],_0x3d7d23[_0x7955('0x1c')],_0x3d7d23[_0x7955('0x1f')]));if(_['endsWith'](_0x3d7d23[_0x7955('0x1f')],_0x7955('0x20'))){_0x3d7d23[_0x7955('0x1f')]=_0x3d7d23[_0x7955('0x1f')][_0x7955('0x21')](_0x7955('0x20'),_0x7955('0x22'));}if(recordings[_0x3d7d23[_0x7955('0xe')]]){var _0x5918f8=_['find'](recordings[_0x3d7d23[_0x7955('0xe')]][_0x7955('0x23')],{'value':_0x3d7d23['value']});if(_[_0x7955('0x16')](_0x5918f8)){recordings[_0x3d7d23[_0x7955('0xe')]][_0x7955('0x23')][_0x7955('0x24')]({'value':_0x3d7d23[_0x7955('0x1f')]});}}}}catch(_0x3fa9a3){utils['error'](util[_0x7955('0x2')](_0x7955('0x25'),_0x3d7d23[_0x7955('0xd')]),_0x3fa9a3);}};exports[_0x7955('0x26')]=function(_0x3f4377){try{if(!_[_0x7955('0x16')](recordings[_0x3f4377[_0x7955('0xd')]])){utils['debug'](util['format'](_0x7955('0x27'),_0x3f4377[_0x7955('0xd')]),_0x3f4377);utils[_0x7955('0x1')](util[_0x7955('0x2')](_0x7955('0x28'),_0x3f4377['uniqueid'],_0x3f4377['calleridnum'],_0x3f4377['calleridname'],_0x3f4377[_0x7955('0x29')]));recordings[_0x3f4377[_0x7955('0xd')]][_0x7955('0x2a')]=_0x3f4377['calleridnum'];recordings[_0x3f4377[_0x7955('0xd')]][_0x7955('0x2b')]=_0x3f4377[_0x7955('0x2b')];recordings[_0x3f4377[_0x7955('0xd')]][_0x7955('0x2c')]=_0x3f4377[_0x7955('0x2c')];recordings[_0x3f4377[_0x7955('0xd')]][_0x7955('0x2d')]=_0x3f4377[_0x7955('0x2d')];if(recordings[_0x3f4377['uniqueid']]['type']==_0x7955('0x2e')&&recordings[_0x3f4377[_0x7955('0xd')]][_0x7955('0x4')]){recordings[_0x3f4377[_0x7955('0xd')]][_0x7955('0x2c')]=recordings[_0x3f4377['uniqueid']][_0x7955('0x4')];recordings[_0x3f4377[_0x7955('0xd')]][_0x7955('0x2d')]='';}recordings[_0x3f4377[_0x7955('0xd')]][_0x7955('0x23')][_0x7955('0x2f')](function(_0x8601c0){var _0x75abfc=_[_0x7955('0x30')](recordings[_0x3f4377[_0x7955('0xd')]]);_0x75abfc[_0x7955('0x1f')]=_0x8601c0['value'];writeDB(_0x75abfc);});delete recordings[_0x3f4377[_0x7955('0xd')]];}}catch(_0x2fd0f3){utils[_0x7955('0x13')](util['format'](_0x7955('0x27'),_0x3f4377[_0x7955('0xd')]),_0x2fd0f3);}};exports[_0x7955('0x31')]=function(_0x3eebef){try{if(!_[_0x7955('0x16')](recordings[_0x3eebef[_0x7955('0xd')]])){utils[_0x7955('0xb')](util[_0x7955('0x2')]('[%s][recordings][newexten]',_0x3eebef[_0x7955('0xd')]),_0x3eebef);utils[_0x7955('0x1')](util['format'](_0x7955('0x32'),_0x3eebef[_0x7955('0xd')],_0x3eebef[_0x7955('0x33')],_0x3eebef[_0x7955('0x34')]));if(_0x3eebef[_0x7955('0x33')][_0x7955('0x35')]()==_0x7955('0x36')&&_[_0x7955('0x37')](_0x3eebef[_0x7955('0x34')][_0x7955('0x35')](),_0x7955('0x38'))){var _0x4adbb9=_0x3eebef['appdata'][_0x7955('0x39')]('=');var _0xabcd74=_0x4adbb9[0x0][_0x7955('0x3a')](_0x4adbb9[0x0][_0x7955('0x3b')]('(')+0x1,_0x4adbb9[0x0][_0x7955('0x3b')](')'));var _0x5e13de=_0x4adbb9[0x1];recordings[_0x3eebef['uniqueid']][_0xabcd74]=_0x5e13de;}}}catch(_0x352c09){utils[_0x7955('0x13')](util[_0x7955('0x2')](_0x7955('0x3c'),_0x3eebef[_0x7955('0xd')]),_0x352c09);}};exports[_0x7955('0x3d')]=function(_0x407e4f){try{if(!_['isNil'](recordings[_0x407e4f['uniqueid']])){utils[_0x7955('0xb')](util['format'](_0x7955('0x3e'),_0x407e4f[_0x7955('0xd')]),_0x407e4f);utils[_0x7955('0x1')](util['format'](_0x7955('0x3f'),_0x407e4f['uniqueid'],_0x407e4f[_0x7955('0x40')]));recordings[_0x407e4f[_0x7955('0xd')]][_0x7955('0x40')]=_0x407e4f['queue'];}}catch(_0x58d785){utils[_0x7955('0x13')](util['format'](_0x7955('0x3e'),_0x407e4f[_0x7955('0xd')]),_0x58d785);}}; \ No newline at end of file +var _0xee2d=['CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request'];(function(_0x7217a6,_0x43950e){var _0x35bc74=function(_0x3d86db){while(--_0x3d86db){_0x7217a6['push'](_0x7217a6['shift']());}};_0x35bc74(++_0x43950e);}(_0xee2d,0x139));var _0xdee2=function(_0x288164,_0x2bca6c){_0x288164=_0x288164-0x0;var _0x3fed99=_0xee2d[_0x288164];return _0x3fed99;};'use strict';var _=require(_0xdee2('0x0'));var util=require(_0xdee2('0x1'));var utils=require(_0xdee2('0x2'));var recordings={};function writeDB(_0x31a993){utils[_0xdee2('0x3')](util['format'](_0xdee2('0x4'),_0x31a993[_0xdee2('0x5')]));if(_0x31a993[_0xdee2('0x6')]){utils[_0xdee2('0x7')](_0x31a993[_0xdee2('0x6')])['then'](function(_0x357352){if(_0x357352){_0x31a993[_0xdee2('0x8')]=_0x357352[_0xdee2('0x9')];_0x31a993[_0xdee2('0xa')]=_0x357352['id'];}utils[_0xdee2('0xb')](_0xdee2('0xc'),_0x31a993);});}else{utils[_0xdee2('0xb')]('CreateVoiceRecording',_0x31a993);}}exports[_0xdee2('0xd')]=function(_0x47c2ac){try{utils['debug'](util[_0xdee2('0xe')](_0xdee2('0xf'),_0x47c2ac[_0xdee2('0x5')]),_0x47c2ac);if(_0x47c2ac[_0xdee2('0x5')]==_0x47c2ac[_0xdee2('0x10')]){utils[_0xdee2('0x3')](util[_0xdee2('0xe')](_0xdee2('0x11'),_0x47c2ac[_0xdee2('0x5')],_0x47c2ac[_0xdee2('0x12')],_0x47c2ac['exten']));recordings[_0x47c2ac[_0xdee2('0x5')]]={'uniqueid':_0x47c2ac[_0xdee2('0x5')],'accountcode':_0x47c2ac[_0xdee2('0x6')],'exten':_0x47c2ac[_0xdee2('0x13')],'context':_0x47c2ac['context'],'channel':_0x47c2ac[_0xdee2('0x14')],'monitors':[]};}}catch(_0x3d57ef){utils[_0xdee2('0x15')](util[_0xdee2('0xe')](_0xdee2('0xf'),_0x47c2ac[_0xdee2('0x5')]),_0x3d57ef);}};exports[_0xdee2('0x16')]=function(_0x400621){try{utils[_0xdee2('0x17')](util[_0xdee2('0xe')](_0xdee2('0x18'),_0x400621[_0xdee2('0x5')]),_0x400621);if(!_['isNil'](recordings[_0x400621[_0xdee2('0x5')]])&&_0x400621[_0xdee2('0x19')]==0x6){utils[_0xdee2('0x3')](util['format'](_0xdee2('0x1a'),_0x400621[_0xdee2('0x5')],_0x400621[_0xdee2('0x12')],_0x400621[_0xdee2('0x14')]));}else if(!_[_0xdee2('0x1b')](recordings[_0x400621[_0xdee2('0x10')]])&&_0x400621[_0xdee2('0x19')]==0x6&&_0x400621[_0xdee2('0x12')]!=_0xdee2('0x1c')){utils['info'](util[_0xdee2('0xe')](_0xdee2('0x1d'),_0x400621[_0xdee2('0x5')],_0x400621[_0xdee2('0x10')],_0x400621[_0xdee2('0x12')],_0x400621[_0xdee2('0x14')]));recordings[_0x400621[_0xdee2('0x10')]][_0xdee2('0x6')]=_0x400621['accountcode'];}}catch(_0xb5e514){utils[_0xdee2('0x15')](util[_0xdee2('0xe')](_0xdee2('0x18'),_0x400621[_0xdee2('0x5')]),_0xb5e514);}};exports['varset']=function(_0x1bbdbb){try{if(!_['isNil'](_0x1bbdbb[_0xdee2('0x1e')])&&!_[_0xdee2('0x1b')](_0x1bbdbb[_0xdee2('0x1e')][_0xdee2('0x1f')])){utils[_0xdee2('0x17')](util[_0xdee2('0xe')](_0xdee2('0x20'),_0x1bbdbb[_0xdee2('0x5')]),_0x1bbdbb);utils[_0xdee2('0x3')](util[_0xdee2('0xe')](_0xdee2('0x21'),_0x1bbdbb[_0xdee2('0x5')],_0x1bbdbb[_0xdee2('0x1e')],_0x1bbdbb['value']));if(_['endsWith'](_0x1bbdbb[_0xdee2('0x22')],_0xdee2('0x23'))){_0x1bbdbb[_0xdee2('0x22')]=_0x1bbdbb[_0xdee2('0x22')][_0xdee2('0x24')](_0xdee2('0x23'),_0xdee2('0x25'));}if(recordings[_0x1bbdbb[_0xdee2('0x10')]]){var _0x1e36ad=_[_0xdee2('0x26')](recordings[_0x1bbdbb[_0xdee2('0x10')]][_0xdee2('0x27')],{'value':_0x1bbdbb[_0xdee2('0x22')]});if(_[_0xdee2('0x1b')](_0x1e36ad)){recordings[_0x1bbdbb[_0xdee2('0x10')]][_0xdee2('0x27')][_0xdee2('0x28')]({'value':_0x1bbdbb[_0xdee2('0x22')]});}}}}catch(_0x54a91a){utils[_0xdee2('0x15')](util['format']('[%s][recordings][varset]',_0x1bbdbb[_0xdee2('0x5')]),_0x54a91a);}};exports[_0xdee2('0x29')]=function(_0x4a2179){try{if(!_['isNil'](recordings[_0x4a2179['uniqueid']])){utils[_0xdee2('0x17')](util['format'](_0xdee2('0x2a'),_0x4a2179[_0xdee2('0x5')]),_0x4a2179);utils['info'](util[_0xdee2('0xe')](_0xdee2('0x2b'),_0x4a2179[_0xdee2('0x5')],_0x4a2179[_0xdee2('0x2c')],_0x4a2179[_0xdee2('0x2d')],_0x4a2179[_0xdee2('0x2e')]));recordings[_0x4a2179['uniqueid']][_0xdee2('0x2c')]=_0x4a2179[_0xdee2('0x2c')];recordings[_0x4a2179['uniqueid']][_0xdee2('0x2d')]=_0x4a2179[_0xdee2('0x2d')];recordings[_0x4a2179[_0xdee2('0x5')]][_0xdee2('0x2f')]=_0x4a2179[_0xdee2('0x2f')];recordings[_0x4a2179[_0xdee2('0x5')]][_0xdee2('0x30')]=_0x4a2179[_0xdee2('0x30')];if(recordings[_0x4a2179[_0xdee2('0x5')]]['type']==_0xdee2('0x31')&&recordings[_0x4a2179['uniqueid']][_0xdee2('0x6')]){recordings[_0x4a2179[_0xdee2('0x5')]][_0xdee2('0x2f')]=recordings[_0x4a2179[_0xdee2('0x5')]][_0xdee2('0x6')];recordings[_0x4a2179[_0xdee2('0x5')]][_0xdee2('0x30')]='';}recordings[_0x4a2179[_0xdee2('0x5')]][_0xdee2('0x27')]['forEach'](function(_0x28b6bc){var _0x3f6ef9=_[_0xdee2('0x32')](recordings[_0x4a2179[_0xdee2('0x5')]]);_0x3f6ef9['value']=_0x28b6bc[_0xdee2('0x22')];writeDB(_0x3f6ef9);});delete recordings[_0x4a2179['uniqueid']];}}catch(_0x56eff4){utils[_0xdee2('0x15')](util['format']('[%s][recordings][hangup]',_0x4a2179['uniqueid']),_0x56eff4);}};exports[_0xdee2('0x33')]=function(_0x533fec){try{if(!_[_0xdee2('0x1b')](recordings[_0x533fec[_0xdee2('0x5')]])){utils[_0xdee2('0x17')](util[_0xdee2('0xe')](_0xdee2('0x34'),_0x533fec[_0xdee2('0x5')]),_0x533fec);utils[_0xdee2('0x3')](util[_0xdee2('0xe')](_0xdee2('0x35'),_0x533fec['uniqueid'],_0x533fec['application'],_0x533fec[_0xdee2('0x36')]));if(_0x533fec[_0xdee2('0x37')][_0xdee2('0x38')]()=='set'&&_[_0xdee2('0x39')](_0x533fec[_0xdee2('0x36')][_0xdee2('0x38')](),_0xdee2('0x3a'))){var _0x2c7a3b=_0x533fec[_0xdee2('0x36')][_0xdee2('0x3b')]('=');var _0x3f9349=_0x2c7a3b[0x0][_0xdee2('0x3c')](_0x2c7a3b[0x0][_0xdee2('0x3d')]('(')+0x1,_0x2c7a3b[0x0][_0xdee2('0x3d')](')'));var _0xd2119d=_0x2c7a3b[0x1];recordings[_0x533fec[_0xdee2('0x5')]][_0x3f9349]=_0xd2119d;}}}catch(_0x49aff3){utils[_0xdee2('0x15')](util[_0xdee2('0xe')]('[%s][recordings][newexten]',_0x533fec[_0xdee2('0x5')]),_0x49aff3);}};exports[_0xdee2('0x3e')]=function(_0x1e618b){try{if(!_[_0xdee2('0x1b')](recordings[_0x1e618b[_0xdee2('0x5')]])){utils['debug'](util[_0xdee2('0xe')]('[%s][recordings][queuecallerjoin]',_0x1e618b[_0xdee2('0x5')]),_0x1e618b);utils[_0xdee2('0x3')](util[_0xdee2('0xe')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x1e618b[_0xdee2('0x5')],_0x1e618b[_0xdee2('0x3f')]));recordings[_0x1e618b[_0xdee2('0x5')]]['queue']=_0x1e618b[_0xdee2('0x3f')];}}catch(_0xb02d89){utils[_0xdee2('0x15')](util[_0xdee2('0xe')](_0xdee2('0x40'),_0x1e618b[_0xdee2('0x5')]),_0xb02d89);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8a71bcc..eaada71 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 _0x7872=['format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','util','info'];(function(_0x5048ff,_0x2e26aa){var _0x5292a6=function(_0x256340){while(--_0x256340){_0x5048ff['push'](_0x5048ff['shift']());}};_0x5292a6(++_0x2e26aa);}(_0x7872,0x9e));var _0x2787=function(_0x32d865,_0x1cd6b0){_0x32d865=_0x32d865-0x0;var _0x563ca1=_0x7872[_0x32d865];return _0x563ca1;};'use strict';var _=require('lodash');var util=require(_0x2787('0x0'));var utils=require('./utils');function writeDB(_0x1ed9ae){utils[_0x2787('0x1')](util[_0x2787('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x1ed9ae[_0x2787('0x3')]===_0x2787('0x4')?_0x1ed9ae[_0x2787('0x5')]:_0x1ed9ae[_0x2787('0x6')],_0x1ed9ae['type']));utils[_0x2787('0x7')](_0x2787('0x8'),_0x1ed9ae);}exports['blindtransfer']=function(_0x539f27){try{utils[_0x2787('0x9')](util[_0x2787('0x2')](_0x2787('0xa'),_0x539f27[_0x2787('0x6')]),_0x539f27);utils['info'](util['format'](_0x2787('0xb'),_0x539f27[_0x2787('0x6')],_0x539f27['transferercalleridnum'],_0x539f27[_0x2787('0xc')],_0x539f27[_0x2787('0xd')],_0x539f27[_0x2787('0xe')]));_0x539f27[_0x2787('0x3')]=_0x2787('0xf');writeDB(_0x539f27);}catch(_0x41fb42){utils[_0x2787('0x10')](util[_0x2787('0x2')](_0x2787('0xa'),_0x539f27[_0x2787('0x6')]),_0x41fb42);}};exports[_0x2787('0x11')]=function(_0x1a31d7){try{utils[_0x2787('0x9')](util[_0x2787('0x2')](_0x2787('0x12'),_0x1a31d7[_0x2787('0x5')]),_0x1a31d7);utils[_0x2787('0x1')](util[_0x2787('0x2')](_0x2787('0x13'),_0x1a31d7[_0x2787('0x5')],_0x1a31d7['origtransferercalleridnum'],_0x1a31d7[_0x2787('0x14')],_0x1a31d7[_0x2787('0x15')],_0x1a31d7['transfertargetcalleridname']));_0x1a31d7=_[_0x2787('0x16')](_0x1a31d7,{'transfererchannel':_0x1a31d7['origtransfererchannel'],'transferercalleridnum':_0x1a31d7[_0x2787('0x17')],'transferercalleridname':_0x1a31d7[_0x2787('0x14')],'transfererconnectedlinenum':_0x1a31d7[_0x2787('0x18')],'transfererconnectedlinename':_0x1a31d7[_0x2787('0x19')],'transfereraccountcode':_0x1a31d7[_0x2787('0x1a')],'transferercontext':_0x1a31d7[_0x2787('0x1b')],'transfererexten':_0x1a31d7[_0x2787('0x1c')],'transfererlinkedid':_0x1a31d7[_0x2787('0x1d')],'context':_0x1a31d7[_0x2787('0x1e')],'extension':_0x1a31d7[_0x2787('0x1f')],'type':_0x2787('0x4')});if(_['isNil'](_0x1a31d7[_0x2787('0x20')])){_0x1a31d7=_[_0x2787('0x16')](_0x1a31d7,{'transfereechannel':_0x1a31d7[_0x2787('0x21')],'transfereecalleridnum':_0x1a31d7[_0x2787('0x15')],'transfereecalleridname':_0x1a31d7[_0x2787('0x22')],'transfereeconnectedlinenum':_0x1a31d7[_0x2787('0x23')],'transfereeconnectedlinename':_0x1a31d7[_0x2787('0x24')],'transfereeaccountcode':_0x1a31d7[_0x2787('0x25')],'transfereecontext':_0x1a31d7['transfertargetcontext'],'transfereeexten':_0x1a31d7[_0x2787('0x26')],'transfereelinkedid':_0x1a31d7[_0x2787('0x27')]});}writeDB(_0x1a31d7);}catch(_0x3e884e){utils[_0x2787('0x10')](util[_0x2787('0x2')]('[%s][transfers][attendedtransfer]',_0x1a31d7[_0x2787('0x5')]),_0x3e884e);}}; \ No newline at end of file +var _0x0066=['attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','util','type','attended','origtransfereruniqueid','uniqueid','request','debug','info','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','[%s][transfers][blindtransfer]'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x0066,0x195));var _0x6006=function(_0x2fda86,_0x376a4a){_0x2fda86=_0x2fda86-0x0;var _0x445798=_0x0066[_0x2fda86];return _0x445798;};'use strict';var _=require(_0x6006('0x0'));var util=require(_0x6006('0x1'));var utils=require('./utils');function writeDB(_0x50f00a){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x50f00a[_0x6006('0x2')]===_0x6006('0x3')?_0x50f00a[_0x6006('0x4')]:_0x50f00a[_0x6006('0x5')],_0x50f00a['type']));utils[_0x6006('0x6')]('CreateVoiceTransferReport',_0x50f00a);}exports['blindtransfer']=function(_0x3fb8b4){try{utils[_0x6006('0x7')](util['format']('[%s][transfers][blindtransfer]',_0x3fb8b4[_0x6006('0x5')]),_0x3fb8b4);utils[_0x6006('0x8')](util[_0x6006('0x9')](_0x6006('0xa'),_0x3fb8b4[_0x6006('0x5')],_0x3fb8b4[_0x6006('0xb')],_0x3fb8b4[_0x6006('0xc')],_0x3fb8b4['transfereecalleridnum'],_0x3fb8b4['transfereecalleridname']));_0x3fb8b4['type']=_0x6006('0xd');writeDB(_0x3fb8b4);}catch(_0x1f5ae7){utils['error'](util[_0x6006('0x9')](_0x6006('0xe'),_0x3fb8b4[_0x6006('0x5')]),_0x1f5ae7);}};exports[_0x6006('0xf')]=function(_0xa65cbe){try{utils[_0x6006('0x7')](util[_0x6006('0x9')]('[%s][transfers][attendedtransfer]',_0xa65cbe[_0x6006('0x4')]),_0xa65cbe);utils[_0x6006('0x8')](util[_0x6006('0x9')](_0x6006('0x10'),_0xa65cbe[_0x6006('0x4')],_0xa65cbe[_0x6006('0x11')],_0xa65cbe[_0x6006('0x12')],_0xa65cbe['transfertargetcalleridnum'],_0xa65cbe[_0x6006('0x13')]));_0xa65cbe=_[_0x6006('0x14')](_0xa65cbe,{'transfererchannel':_0xa65cbe[_0x6006('0x15')],'transferercalleridnum':_0xa65cbe['origtransferercalleridnum'],'transferercalleridname':_0xa65cbe[_0x6006('0x12')],'transfererconnectedlinenum':_0xa65cbe[_0x6006('0x16')],'transfererconnectedlinename':_0xa65cbe[_0x6006('0x17')],'transfereraccountcode':_0xa65cbe[_0x6006('0x18')],'transferercontext':_0xa65cbe[_0x6006('0x19')],'transfererexten':_0xa65cbe['secondtransfererexten'],'transfererlinkedid':_0xa65cbe[_0x6006('0x1a')],'context':_0xa65cbe[_0x6006('0x1b')],'extension':_0xa65cbe['origtransfererexten'],'type':_0x6006('0x3')});if(_['isNil'](_0xa65cbe[_0x6006('0x1c')])){_0xa65cbe=_[_0x6006('0x14')](_0xa65cbe,{'transfereechannel':_0xa65cbe[_0x6006('0x1d')],'transfereecalleridnum':_0xa65cbe['transfertargetcalleridnum'],'transfereecalleridname':_0xa65cbe[_0x6006('0x13')],'transfereeconnectedlinenum':_0xa65cbe['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xa65cbe['transfertargetconnectedlinename'],'transfereeaccountcode':_0xa65cbe[_0x6006('0x1e')],'transfereecontext':_0xa65cbe[_0x6006('0x1f')],'transfereeexten':_0xa65cbe['transfertargetexten'],'transfereelinkedid':_0xa65cbe[_0x6006('0x20')]});}writeDB(_0xa65cbe);}catch(_0x27536e){utils[_0x6006('0x21')](util[_0x6006('0x9')](_0x6006('0x22'),_0xa65cbe['origtransfereruniqueid']),_0x27536e);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2c59fa3..af0d2d0 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 _0xf6ed=['request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','moment','client','http','xdr','info','debug','inspect','error'];(function(_0x284d33,_0x5b003f){var _0x225cf8=function(_0xe512c4){while(--_0xe512c4){_0x284d33['push'](_0x284d33['shift']());}};_0x225cf8(++_0x5b003f);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x3ba206,_0x549cf2){_0x3ba206=_0x3ba206-0x0;var _0x292706=_0xf6ed[_0x3ba206];return _0x292706;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0xdf6e('0x0'));var util=require('util');var client=jayson[_0xdf6e('0x1')][_0xdf6e('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0xdf6e('0x3'));exports['info']=function(_0x3c635c,_0x3992d7){logger[_0xdf6e('0x4')](_0x3c635c,_0x3992d7?util['inspect'](_0x3992d7,{'showHidden':![],'depth':null}):'');};exports[_0xdf6e('0x5')]=function(_0x1b6c6c,_0x1fd20c){logger[_0xdf6e('0x5')](_0x1b6c6c,_0x1fd20c?util[_0xdf6e('0x6')](_0x1fd20c,{'showHidden':![],'depth':null}):'');};exports[_0xdf6e('0x7')]=function(_0x433411,_0x4a470a){logger[_0xdf6e('0x7')](_0x433411,_0x4a470a?util[_0xdf6e('0x6')](_0x4a470a,{'showHidden':![],'depth':null}):'');};exports[_0xdf6e('0x8')]=function(_0x230bd7,_0x3603ce){return client[_0xdf6e('0x8')](_0x230bd7,{'body':_0x3603ce})['then'](function(_0x3b0d50){logger[_0xdf6e('0x5')](_0xdf6e('0x9'),_0x230bd7,_0x3b0d50?util[_0xdf6e('0x6')](_0x3b0d50,{'showHidden':![],'depth':null}):'');})[_0xdf6e('0xa')](function(_0x323bd9){logger[_0xdf6e('0x7')](_0xdf6e('0x9'),_0x230bd7,_0x323bd9?util[_0xdf6e('0x6')](_0x323bd9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x29e0c7){return client[_0xdf6e('0x8')](_0xdf6e('0xb'),{'options':{'raw':!![],'attributes':['id',_0xdf6e('0xc'),_0xdf6e('0xd'),_0xdf6e('0xe')],'where':_0x29e0c7,'limit':0x1}})[_0xdf6e('0xf')](function(_0x4cd837){logger['debug'](_0xdf6e('0x10'),JSON[_0xdf6e('0x11')](_0x29e0c7),_0x4cd837?util[_0xdf6e('0x6')](_0x4cd837,{'showHidden':![],'depth':null}):'');return _0x4cd837[_0xdf6e('0x12')]['length']?_0x4cd837[_0xdf6e('0x12')][0x0]:null;});}exports[_0xdf6e('0x13')]=function(_0x5c3966){return new BPromise(function(_0x554cb9,_0xe5db14){if(_0x5c3966){return getUser({'internal':_0x5c3966})[_0xdf6e('0xf')](function(_0x575d13){logger[_0xdf6e('0x4')](_0xdf6e('0x14'),_0x5c3966,_0x575d13?_0xdf6e('0x15'):_0xdf6e('0x16'));return _0x554cb9(_0x575d13);})[_0xdf6e('0xa')](function(_0x45cc55){logger[_0xdf6e('0x7')](_0xdf6e('0x17'),_0x45cc55?util['inspect'](_0x45cc55,{'showHidden':![],'depth':null}):'');return _0x554cb9(null);});}return _0x554cb9(null);});};exports[_0xdf6e('0x18')]=function(_0x3441fc){return new BPromise(function(_0x5d5156,_0xbcd108){if(_0x3441fc){return getUser({'interface':_0x3441fc})[_0xdf6e('0xf')](function(_0x3828d6){logger['info'](_0xdf6e('0x19'),_0x3441fc,_0x3828d6?_0xdf6e('0x15'):_0xdf6e('0x16'));return _0x5d5156(_0x3828d6);})['catch'](function(_0x53253c){logger[_0xdf6e('0x7')]('[utils][getUserByInterface]',_0x53253c?util[_0xdf6e('0x6')](_0x53253c,{'showHidden':![],'depth':null}):'');return _0x5d5156(null);});}return _0x5d5156(null);});};exports['getUserByName']=function(_0x4bbc5f){return new BPromise(function(_0x455cca,_0x1b55f6){if(_0x4bbc5f){return getUser({'name':_0x4bbc5f})[_0xdf6e('0xf')](function(_0x5c7a24){logger['info'](_0xdf6e('0x1a'),_0x4bbc5f,_0x5c7a24?_0xdf6e('0x15'):'notfound');return _0x455cca(_0x5c7a24);})[_0xdf6e('0xa')](function(_0x1a3abb){logger['error'](_0xdf6e('0x1b'),_0x1a3abb?util[_0xdf6e('0x6')](_0x1a3abb,{'showHidden':![],'depth':null}):'');return _0x455cca(null);});}return _0x455cca(null);});};exports[_0xdf6e('0x1c')]=function(_0x52c45e){return new BPromise(function(_0x436821,_0x5e5474){if(_0x52c45e){return client[_0xdf6e('0x8')](_0xdf6e('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xdf6e('0xd'),_0xdf6e('0x1e'),_0xdf6e('0x1f'),_0xdf6e('0x20')],'where':{'name':_0x52c45e},'limit':0x1}})[_0xdf6e('0xf')](function(_0x21ad88){logger[_0xdf6e('0x5')](_0xdf6e('0x21'),_0x52c45e,_0x21ad88?util['inspect'](_0x21ad88,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x52c45e,_0x21ad88?'found':_0xdf6e('0x16'));return _0x436821(_0x21ad88['result'][_0xdf6e('0x22')]?_0x21ad88['result'][0x0]:null);})[_0xdf6e('0xa')](function(_0x7a364d){logger[_0xdf6e('0x7')](_0xdf6e('0x23'),_0x7a364d?util[_0xdf6e('0x6')](_0x7a364d,{'showHidden':![],'depth':null}):'');return _0x436821(null);});}return _0x436821(null);});};exports[_0xdf6e('0x24')]=function(_0x4ecb91,_0x13dc3d){return moment(_0x4ecb91)[_0xdf6e('0x25')](_0x13dc3d,_0xdf6e('0x26'))[_0xdf6e('0x27')](_0xdf6e('0x28'));};exports['subtractTime']=function(_0x1df5e3,_0x5a8b4a){return moment(_0x1df5e3)['subtract'](_0x5a8b4a,_0xdf6e('0x26'))[_0xdf6e('0x27')](_0xdf6e('0x28'));};exports[_0xdf6e('0x29')]=function(_0x205687,_0x21eaf5){return moment(_0x205687)[_0xdf6e('0x2a')](moment(_0x21eaf5),_0xdf6e('0x26'));};exports[_0xdf6e('0x2b')]=function(_0x1794cc,_0x3fb572){return parseInt(_0x1794cc,0xa)+parseInt(_0x3fb572,0xa);};exports[_0xdf6e('0x2c')]=function(){return moment()[_0xdf6e('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x4d5d92,_0x293f29){if(_0x293f29){return moment(_0x4d5d92)[_0xdf6e('0x2d')](_0x293f29);}return!![];};exports[_0xdf6e('0x2e')]=function(_0x54a0fd,_0x2a38c0){if(_0x2a38c0){return moment(_0x54a0fd)[_0xdf6e('0x2e')](_0x2a38c0);}else if(_0x54a0fd){return!![];}return![];}; \ No newline at end of file +var _0x8a62=['notfound','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','interface','then','[utils][getUser]\x20where:%s','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8a62,0x18f));var _0x28a6=function(_0x4357d8,_0x503aa2){_0x4357d8=_0x4357d8-0x0;var _0x5350d6=_0x8a62[_0x4357d8];return _0x5350d6;};'use strict';var BPromise=require(_0x28a6('0x0'));var jayson=require('jayson/promise');var moment=require(_0x28a6('0x1'));var util=require(_0x28a6('0x2'));var client=jayson[_0x28a6('0x3')][_0x28a6('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x28a6('0x5'));exports[_0x28a6('0x6')]=function(_0x46439a,_0x295366){logger[_0x28a6('0x6')](_0x46439a,_0x295366?util[_0x28a6('0x7')](_0x295366,{'showHidden':![],'depth':null}):'');};exports[_0x28a6('0x8')]=function(_0x97d860,_0x5ae651){logger[_0x28a6('0x8')](_0x97d860,_0x5ae651?util[_0x28a6('0x7')](_0x5ae651,{'showHidden':![],'depth':null}):'');};exports[_0x28a6('0x9')]=function(_0x5bcd10,_0x417f8e){logger['error'](_0x5bcd10,_0x417f8e?util[_0x28a6('0x7')](_0x417f8e,{'showHidden':![],'depth':null}):'');};exports[_0x28a6('0xa')]=function(_0x5bacae,_0x47fc1f){return client[_0x28a6('0xa')](_0x5bacae,{'body':_0x47fc1f})['then'](function(_0x265f7b){logger['debug'](_0x28a6('0xb'),_0x5bacae,_0x265f7b?util[_0x28a6('0x7')](_0x265f7b,{'showHidden':![],'depth':null}):'');})['catch'](function(_0xc6e917){logger[_0x28a6('0x9')](_0x28a6('0xb'),_0x5bacae,_0xc6e917?util[_0x28a6('0x7')](_0xc6e917,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5a63c7){return client[_0x28a6('0xa')](_0x28a6('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x28a6('0xd')],'where':_0x5a63c7,'limit':0x1}})[_0x28a6('0xe')](function(_0x9fef62){logger[_0x28a6('0x8')](_0x28a6('0xf'),JSON['stringify'](_0x5a63c7),_0x9fef62?util[_0x28a6('0x7')](_0x9fef62,{'showHidden':![],'depth':null}):'');return _0x9fef62[_0x28a6('0x10')][_0x28a6('0x11')]?_0x9fef62[_0x28a6('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0x5b282f){return new BPromise(function(_0x5433ca,_0x2b4d7d){if(_0x5b282f){return getUser({'internal':_0x5b282f})[_0x28a6('0xe')](function(_0x5328c9){logger[_0x28a6('0x6')](_0x28a6('0x12'),_0x5b282f,_0x5328c9?_0x28a6('0x13'):'notfound');return _0x5433ca(_0x5328c9);})[_0x28a6('0x14')](function(_0x60ce82){logger[_0x28a6('0x9')]('[utils][getUserByInternal]',_0x60ce82?util[_0x28a6('0x7')](_0x60ce82,{'showHidden':![],'depth':null}):'');return _0x5433ca(null);});}return _0x5433ca(null);});};exports[_0x28a6('0x15')]=function(_0x1e7270){return new BPromise(function(_0x1ae2b6,_0x2f433b){if(_0x1e7270){return getUser({'interface':_0x1e7270})['then'](function(_0x49651e){logger[_0x28a6('0x6')](_0x28a6('0x16'),_0x1e7270,_0x49651e?_0x28a6('0x13'):'notfound');return _0x1ae2b6(_0x49651e);})[_0x28a6('0x14')](function(_0x47d051){logger[_0x28a6('0x9')](_0x28a6('0x17'),_0x47d051?util['inspect'](_0x47d051,{'showHidden':![],'depth':null}):'');return _0x1ae2b6(null);});}return _0x1ae2b6(null);});};exports[_0x28a6('0x18')]=function(_0xf45b89){return new BPromise(function(_0x48f976,_0x4088dd){if(_0xf45b89){return getUser({'name':_0xf45b89})[_0x28a6('0xe')](function(_0x1ae8fd){logger['info'](_0x28a6('0x19'),_0xf45b89,_0x1ae8fd?_0x28a6('0x13'):'notfound');return _0x48f976(_0x1ae8fd);})['catch'](function(_0x52ba25){logger['error'](_0x28a6('0x1a'),_0x52ba25?util[_0x28a6('0x7')](_0x52ba25,{'showHidden':![],'depth':null}):'');return _0x48f976(null);});}return _0x48f976(null);});};exports[_0x28a6('0x1b')]=function(_0x4501e9){return new BPromise(function(_0x896917,_0x28d5bd){if(_0x4501e9){return client[_0x28a6('0xa')](_0x28a6('0x1c'),{'options':{'raw':!![],'attributes':['id','name','type',_0x28a6('0x1d'),_0x28a6('0x1e')],'where':{'name':_0x4501e9},'limit':0x1}})['then'](function(_0x4716a1){logger[_0x28a6('0x8')](_0x28a6('0x1f'),_0x4501e9,_0x4716a1?util[_0x28a6('0x7')](_0x4716a1,{'showHidden':![],'depth':null}):'');logger[_0x28a6('0x6')](_0x28a6('0x20'),_0x4501e9,_0x4716a1?_0x28a6('0x13'):_0x28a6('0x21'));return _0x896917(_0x4716a1['result'][_0x28a6('0x11')]?_0x4716a1[_0x28a6('0x10')][0x0]:null);})[_0x28a6('0x14')](function(_0x268241){logger[_0x28a6('0x9')](_0x28a6('0x22'),_0x268241?util[_0x28a6('0x7')](_0x268241,{'showHidden':![],'depth':null}):'');return _0x896917(null);});}return _0x896917(null);});};exports[_0x28a6('0x23')]=function(_0x225878,_0x4126f3){return moment(_0x225878)[_0x28a6('0x24')](_0x4126f3,_0x28a6('0x25'))[_0x28a6('0x26')](_0x28a6('0x27'));};exports[_0x28a6('0x28')]=function(_0x442e6e,_0x69eb3c){return moment(_0x442e6e)[_0x28a6('0x29')](_0x69eb3c,_0x28a6('0x25'))[_0x28a6('0x26')](_0x28a6('0x27'));};exports[_0x28a6('0x2a')]=function(_0x5a2f8b,_0x5e001e){return moment(_0x5a2f8b)[_0x28a6('0x2b')](moment(_0x5e001e),_0x28a6('0x25'));};exports[_0x28a6('0x2c')]=function(_0x49c38c,_0x286287){return parseInt(_0x49c38c,0xa)+parseInt(_0x286287,0xa);};exports[_0x28a6('0x2d')]=function(){return moment()[_0x28a6('0x26')](_0x28a6('0x27'));};exports[_0x28a6('0x2e')]=function(_0x3509ce,_0x379b41){if(_0x379b41){return moment(_0x3509ce)[_0x28a6('0x2e')](_0x379b41);}return!![];};exports[_0x28a6('0x2f')]=function(_0x4da848,_0x17b591){if(_0x17b591){return moment(_0x4da848)[_0x28a6('0x2f')](_0x17b591);}else if(_0x4da848){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 bbebe4f..27458ae 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 _0x8c1d=['other','agent_name','test','fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','client','name','ensureDir','then','log','user','error','api','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','method','headers','x-forwarded-for','remoteAddress','url','responseTime','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','connection','statusCode'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x8c1d,0x145));var _0xd8c1=function(_0x397eee,_0x5ad835){_0x397eee=_0x397eee-0x0;var _0x3d3fcc=_0x8c1d[_0x397eee];return _0x3d3fcc;};var fs=require(_0xd8c1('0x0'));var _=require(_0xd8c1('0x1'));var ewinston=require('express-winston');var path=require(_0xd8c1('0x2'));var util=require(_0xd8c1('0x3'));var fileLogger=require(_0xd8c1('0x4'))[_0xd8c1('0x5')];var safeTemplate=require(_0xd8c1('0x6'))[_0xd8c1('0x7')];var maskSensitiveData=require(_0xd8c1('0x8'))[_0xd8c1('0x9')];function ClientSideLogger(){function _0x31a1ce(_0x3201b2){var _0x1b503a=path[_0xd8c1('0xa')](_0xd8c1('0xb'),'log','xcally');var _0x7cbc02=path['join'](_0xd8c1('0xc'),_0x3201b2['role']+'-'+_0x3201b2[_0xd8c1('0xd')]);return fs[_0xd8c1('0xe')](path[_0xd8c1('0xa')](_0x1b503a,_0x7cbc02))[_0xd8c1('0xf')](function(){var _0xab1f1=fileLogger('client',path[_0xd8c1('0xa')](_0x1b503a,_0x7cbc02));return _0xab1f1;})['catch'](function(_0x281bdf){throw _0x281bdf;});}this[_0xd8c1('0x10')]=function(_0x3cdf2c,_0x30aab0,_0x2607df,_0x4464d0){return _0x31a1ce(_0x3cdf2c[_0xd8c1('0x11')])[_0xd8c1('0xf')](function(_0x244ece){var _0x13928a=_0x244ece[_0x30aab0];return _0x13928a;})[_0xd8c1('0xf')](function(_0x5d7ad9){var _0x520b91=_0x3cdf2c[_0xd8c1('0x11')]?_0x3cdf2c[_0xd8c1('0x11')]['id']:'no-user';var _0x1c585b=_0x4464d0['data'];var _0x567a34=_0x4464d0['timestamp'];var _0x2eecfe=new Date(Number(_0x567a34));return _0x5d7ad9(_0x520b91,_0x2eecfe,_0x2607df,_0x1c585b);})['catch'](function(_0xf9d11f){fileLogger(_0xd8c1('0xc'))[_0xd8c1('0x12')](_0xf9d11f);});};}function setupLoggers(_0x3a1a40){return new Promise(function(_0x54d71f){var _0x4a2ffa=new ClientSideLogger();var _0x13b2da=fileLogger(_0xd8c1('0x13'));var _0x5f29a8=fileLogger(_0xd8c1('0x14'));_0x3a1a40['set'](_0xd8c1('0x15'),_0x4a2ffa);_0x3a1a40['use'](ewinston[_0xd8c1('0x16')]({'winstonInstance':_0x13b2da,'meta':![],'statusLevels':!![],'msg':function(_0x3101e2,_0x5ca8e4){var _0x19b2b1=_0xd8c1('0x17');if(!_[_0xd8c1('0x18')](_0x3101e2['body'])){_0x19b2b1+=_0xd8c1('0x19');var _0x191ace=_0x3101e2[_0xd8c1('0x1a')];maskSensitiveData(_0x191ace);}return safeTemplate(util['format'](_0x19b2b1,_0x3101e2[_0xd8c1('0x1b')],_0x3101e2[_0xd8c1('0x1c')]['x-forwarded-for']?_0x3101e2[_0xd8c1('0x1c')][_0xd8c1('0x1d')]:_0x3101e2['connection'][_0xd8c1('0x1e')]||_0x3101e2['ip'],_0x3101e2[_0xd8c1('0x1f')],_0x5ca8e4['statusCode'],_0x5ca8e4[_0xd8c1('0x20')],_0x3101e2[_0xd8c1('0x11')]?_0x3101e2[_0xd8c1('0x11')]['id']:null,_0x3101e2[_0xd8c1('0x11')]?_0x3101e2[_0xd8c1('0x11')][_0xd8c1('0xd')]:null,_0x3101e2[_0xd8c1('0x11')]?_0x3101e2[_0xd8c1('0x11')][_0xd8c1('0x21')]:null,_0x191ace?util[_0xd8c1('0x22')](_0x191ace,![],null):''));}}));_0x3a1a40[_0xd8c1('0x23')](ewinston['logger']({'winstonInstance':_0x5f29a8,'meta':![],'statusLevels':!![],'msg':function(_0x21e8d0,_0x43ecc6){var _0xc5100f=_0xd8c1('0x24');if(_0x21e8d0['body']&&_0x21e8d0[_0xd8c1('0x1a')][_0xd8c1('0x25')]&&_0x21e8d0[_0xd8c1('0x1a')][_0xd8c1('0x26')]){_0xc5100f=_0xd8c1('0x27');}return util[_0xd8c1('0x28')](_0xc5100f,_0x21e8d0['method'],_0x21e8d0['headers']['x-forwarded-for']?_0x21e8d0[_0xd8c1('0x1c')][_0xd8c1('0x1d')]:_0x21e8d0[_0xd8c1('0x29')][_0xd8c1('0x1e')]||_0x21e8d0['ip'],_0x21e8d0[_0xd8c1('0x1f')],_0x43ecc6[_0xd8c1('0x2a')],_0x43ecc6[_0xd8c1('0x20')],_0x21e8d0['user']?_0x21e8d0[_0xd8c1('0x11')]['id']:null,_0x21e8d0[_0xd8c1('0x11')]?_0x21e8d0['user'][_0xd8c1('0xd')]:null,_0x21e8d0['user']?_0x21e8d0['user']['role']:null,_0x21e8d0[_0xd8c1('0x1a')]&&_0x21e8d0[_0xd8c1('0x1a')]['device']?_0x21e8d0['body'][_0xd8c1('0x25')]:_0xd8c1('0x2b'),_0x21e8d0[_0xd8c1('0x1a')]&&_0x21e8d0[_0xd8c1('0x1a')]['agent_id']?_0x21e8d0['body']['agent_id']:'',_0x21e8d0[_0xd8c1('0x1a')]&&_0x21e8d0['body'][_0xd8c1('0x2c')]?_0x21e8d0['body']['agent_name']:'');},'ignoreRoute':function(_0x467a57){var _0x6d5e09=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x6d5e09[_0xd8c1('0x2d')](_0x467a57[_0xd8c1('0x1f')]);}}));return _0x54d71f();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x8ff4=['device','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','then','user','no-user','timestamp','catch','error','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','name','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','connection'];(function(_0x351ed5,_0x51af29){var _0x5d5a9b=function(_0x11954b){while(--_0x11954b){_0x351ed5['push'](_0x351ed5['shift']());}};_0x5d5a9b(++_0x51af29);}(_0x8ff4,0x13f));var _0x48ff=function(_0x4cefbc,_0x3ffa6c){_0x4cefbc=_0x4cefbc-0x0;var _0x423c86=_0x8ff4[_0x4cefbc];return _0x423c86;};var fs=require(_0x48ff('0x0'));var _=require(_0x48ff('0x1'));var ewinston=require(_0x48ff('0x2'));var path=require(_0x48ff('0x3'));var util=require('util');var fileLogger=require(_0x48ff('0x4'))[_0x48ff('0x5')];var safeTemplate=require(_0x48ff('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x48ff('0x7'))[_0x48ff('0x8')];function ClientSideLogger(){function _0x1d920e(_0x2bda58){var _0x2d10bf=path[_0x48ff('0x9')](_0x48ff('0xa'),_0x48ff('0xb'),'xcally');var _0x44536b=path['join'](_0x48ff('0xc'),_0x2bda58[_0x48ff('0xd')]+'-'+_0x2bda58['name']);return fs['ensureDir'](path['join'](_0x2d10bf,_0x44536b))[_0x48ff('0xe')](function(){var _0x3f3c71=fileLogger(_0x48ff('0xc'),path[_0x48ff('0x9')](_0x2d10bf,_0x44536b));return _0x3f3c71;})['catch'](function(_0x37be74){throw _0x37be74;});}this[_0x48ff('0xb')]=function(_0x264ea2,_0x53483e,_0x225079,_0x536233){return _0x1d920e(_0x264ea2[_0x48ff('0xf')])['then'](function(_0x4146e7){var _0x22ef14=_0x4146e7[_0x53483e];return _0x22ef14;})['then'](function(_0x38121b){var _0x3c9449=_0x264ea2[_0x48ff('0xf')]?_0x264ea2['user']['id']:_0x48ff('0x10');var _0x30de28=_0x536233['data'];var _0x4f1823=_0x536233[_0x48ff('0x11')];var _0x2b3c22=new Date(Number(_0x4f1823));return _0x38121b(_0x3c9449,_0x2b3c22,_0x225079,_0x30de28);})[_0x48ff('0x12')](function(_0x10d524){fileLogger(_0x48ff('0xc'))[_0x48ff('0x13')](_0x10d524);});};}function setupLoggers(_0x5ab12d){return new Promise(function(_0x4a48e5){var _0x3bf257=new ClientSideLogger();var _0x106311=fileLogger(_0x48ff('0x14'));var _0x128006=fileLogger(_0x48ff('0x15'));_0x5ab12d[_0x48ff('0x16')]('client-side-logger',_0x3bf257);_0x5ab12d[_0x48ff('0x17')](ewinston['logger']({'winstonInstance':_0x106311,'meta':![],'statusLevels':!![],'msg':function(_0x36c249,_0x2d4668){var _0xa2d22b=_0x48ff('0x18');if(!_[_0x48ff('0x19')](_0x36c249[_0x48ff('0x1a')])){_0xa2d22b+=_0x48ff('0x1b');var _0x5700e0=_0x36c249['body'];maskSensitiveData(_0x5700e0);}return safeTemplate(util[_0x48ff('0x1c')](_0xa2d22b,_0x36c249['method'],_0x36c249[_0x48ff('0x1d')][_0x48ff('0x1e')]?_0x36c249[_0x48ff('0x1d')][_0x48ff('0x1e')]:_0x36c249['connection'][_0x48ff('0x1f')]||_0x36c249['ip'],_0x36c249[_0x48ff('0x20')],_0x2d4668[_0x48ff('0x21')],_0x2d4668[_0x48ff('0x22')],_0x36c249[_0x48ff('0xf')]?_0x36c249['user']['id']:null,_0x36c249[_0x48ff('0xf')]?_0x36c249[_0x48ff('0xf')][_0x48ff('0x23')]:null,_0x36c249[_0x48ff('0xf')]?_0x36c249[_0x48ff('0xf')][_0x48ff('0xd')]:null,_0x5700e0?util[_0x48ff('0x24')](_0x5700e0,![],null):''));}}));_0x5ab12d[_0x48ff('0x17')](ewinston[_0x48ff('0x25')]({'winstonInstance':_0x128006,'meta':![],'statusLevels':!![],'msg':function(_0x17162e,_0x1e6473){var _0x3b8d9a=_0x48ff('0x26');if(_0x17162e['body']&&_0x17162e[_0x48ff('0x1a')]['device']&&_0x17162e['body'][_0x48ff('0x27')]){_0x3b8d9a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x48ff('0x1c')](_0x3b8d9a,_0x17162e['method'],_0x17162e['headers']['x-forwarded-for']?_0x17162e['headers'][_0x48ff('0x1e')]:_0x17162e[_0x48ff('0x28')][_0x48ff('0x1f')]||_0x17162e['ip'],_0x17162e[_0x48ff('0x20')],_0x1e6473[_0x48ff('0x21')],_0x1e6473[_0x48ff('0x22')],_0x17162e[_0x48ff('0xf')]?_0x17162e[_0x48ff('0xf')]['id']:null,_0x17162e['user']?_0x17162e[_0x48ff('0xf')][_0x48ff('0x23')]:null,_0x17162e['user']?_0x17162e[_0x48ff('0xf')][_0x48ff('0xd')]:null,_0x17162e['body']&&_0x17162e[_0x48ff('0x1a')][_0x48ff('0x29')]?_0x17162e[_0x48ff('0x1a')]['device']:_0x48ff('0x2a'),_0x17162e[_0x48ff('0x1a')]&&_0x17162e['body'][_0x48ff('0x27')]?_0x17162e[_0x48ff('0x1a')][_0x48ff('0x27')]:'',_0x17162e['body']&&_0x17162e['body'][_0x48ff('0x2b')]?_0x17162e[_0x48ff('0x1a')][_0x48ff('0x2b')]:'');},'ignoreRoute':function(_0x40ecac){var _0x4d41c1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4d41c1['test'](_0x40ecac[_0x48ff('0x20')]);}}));return _0x4a48e5();});}exports[_0x48ff('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index dda4242..b5947fc 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc645=['ddd','includes','dowCompare','date','daysInMonth','min','domCompare','monthCompare','guess','test','isMoment','padStart','length','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','exports','monthsShort','toLowerCase','concat','circularMonthInterval','clone','minutes','hours','startOf','day','timeCompare','format'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0xc645,0xc1));var _0x5c64=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xc645[_0x4ae6ef];return _0x3cbb4e;};var _=require(_0x5c64('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x5c64('0x1')](function(_0x417f67){return _0x417f67[_0x5c64('0x2')];})[_0x5c64('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x5c64('0x4');var EINVALID_DATE=_0x5c64('0x5');function throwIfDateNotValid(_0x2e659f){if(!_0x2e659f['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x403962){var _0x1a52ab=_0x403962[_0x5c64('0x6')](':')[_0x5c64('0x1')](function(_0x219056){return parseInt(_0x219056,0xa);});var _0x32cced=_0x1a52ab[0x0];var _0x17fba9=_0x1a52ab[0x1];if(_0x32cced<0x0||_0x32cced>0x17||_0x17fba9<0x0||_0x17fba9>0x3b){throw new Error(EINVALID_DATE);}return[_0x32cced,_0x17fba9];}function circularDoWInterval(_0x14c5a0,_0x56f456){if(_0x14c5a0===_0x56f456){return[_0x14c5a0];}else{var _0x4a3ff2=moment[_0x5c64('0x7')]();moment['locale']('en');var _0x1714c6=moment[_0x5c64('0x8')]()['map'](function(_0x461ed9){return _0x461ed9['toLowerCase']();});moment[_0x5c64('0x7')](_0x4a3ff2);var _0x26d8b2=_0x1714c6['indexOf'](_0x14c5a0);var _0x255396=_0x1714c6[_0x5c64('0x9')](_0x56f456);if(_0x255396>_0x26d8b2){return _0x1714c6['slice'](_0x26d8b2,_0x255396+0x1);}else{var _0x15b89f=_0x1714c6[_0x5c64('0xa')](0x0,_0x255396+0x1);var _0x2dc763=_0x1714c6[_0x5c64('0xa')](_0x26d8b2);return _0x2dc763['concat'](_0x15b89f);}}}module[_0x5c64('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x2fe961,_0x53e6d6){if(_0x2fe961===_0x53e6d6){return[_0x2fe961];}else{var _0x16a4f8=moment[_0x5c64('0x7')]();moment['locale']('en');var _0x1b6be8=moment[_0x5c64('0xc')]()[_0x5c64('0x1')](function(_0x5642f2){return _0x5642f2[_0x5c64('0xd')]();});moment[_0x5c64('0x7')](_0x16a4f8);var _0xa9424f=_0x1b6be8[_0x5c64('0x9')](_0x2fe961);var _0x1b24cf=_0x1b6be8[_0x5c64('0x9')](_0x53e6d6);if(_0x1b24cf>_0xa9424f){return _0x1b6be8[_0x5c64('0xa')](_0xa9424f,_0x1b24cf+0x1);}else{var _0xb35451=_0x1b6be8[_0x5c64('0xa')](0x0,_0x1b24cf+0x1);var _0x512334=_0x1b6be8[_0x5c64('0xa')](_0xa9424f);return _0x512334[_0x5c64('0xe')](_0xb35451);}}}module[_0x5c64('0xb')][_0x5c64('0xf')]=circularMonthInterval;function parseDom(_0x54636b){var _0x236abf=parseInt(_0x54636b,0xa);if(_0x236abf<0x1||_0x236abf>0x1f){throw new Error(EINVALID_DATE);}return _0x236abf;}function timeCompare(_0x344b8f,_0x1e7ffb,_0x46979f){var _0x5dd86d=_0x344b8f[_0x5c64('0x10')]();var _0x29c510=extractTime(_0x1e7ffb);var _0x202691=_0x29c510[0x0];var _0x4bf5a1=_0x29c510[0x1];var _0x373ba4=_0x344b8f['clone']()['hours'](_0x202691)[_0x5c64('0x11')](_0x4bf5a1);throwIfDateNotValid(_0x373ba4);var _0x1e9355=extractTime(_0x46979f);var _0x140420=_0x1e9355[0x0];var _0x2e8d8c=_0x1e9355[0x1];var _0x217119=_0x344b8f[_0x5c64('0x10')]()[_0x5c64('0x12')](_0x140420)[_0x5c64('0x11')](_0x2e8d8c);throwIfDateNotValid(_0x217119);if(_0x217119['isBefore'](_0x373ba4)){var _0x24cdfa=_0x5dd86d[_0x5c64('0x10')]()[_0x5c64('0x13')](_0x5c64('0x14'));var _0x25a13b=_0x5dd86d['clone']()['endOf'](_0x5c64('0x14'));return _0x5dd86d['isBetween'](_0x373ba4,_0x25a13b,undefined,'[]')||_0x5dd86d['isBetween'](_0x24cdfa,_0x217119,undefined,'[]');}else{return _0x5dd86d['isBetween'](_0x373ba4,_0x217119,undefined,'[]');}}module['exports'][_0x5c64('0x15')]=timeCompare;function dowCompare(_0x55fc53,_0x7b8b38,_0x20c9f7){var _0x44c5ff=_0x55fc53[_0x5c64('0x7')]('en')[_0x5c64('0x16')](_0x5c64('0x17'))[_0x5c64('0xd')]();return circularDoWInterval(_0x7b8b38,_0x20c9f7)[_0x5c64('0x18')](_0x44c5ff);}module[_0x5c64('0xb')][_0x5c64('0x19')]=dowCompare;function domCompare(_0x4b8d03,_0x11ca8f,_0x545fbd){var _0x44254e=_0x4b8d03[_0x5c64('0x1a')]();if(_0x11ca8f===_0x545fbd){return _0x44254e===_0x11ca8f;}else{var _0x3cb66c=_0x4b8d03[_0x5c64('0x1b')]();var _0x89ec65=_0x11ca8f<_0x545fbd;let _0x196287=![];var _0x578ffe=0x0;var _0x46cd15=0x0;if(_0x89ec65){_0x578ffe=Math['max'](0x1,_0x11ca8f);_0x46cd15=Math['min'](_0x545fbd,_0x3cb66c);_0x196287=_0x44254e>=_0x578ffe&&_0x44254e<=_0x46cd15;}else{_0x578ffe=Math[_0x5c64('0x1c')](_0x11ca8f,_0x3cb66c);_0x46cd15=Math['max'](0x1,_0x545fbd);_0x196287=_0x44254e>=_0x578ffe||_0x44254e<=_0x46cd15;}return _0x196287;}}module[_0x5c64('0xb')][_0x5c64('0x1d')]=domCompare;function monthCompare(_0x11779f,_0x35f71c,_0x402326){var _0x27d222=_0x11779f[_0x5c64('0x7')]('en')[_0x5c64('0x16')]('MMM')[_0x5c64('0xd')]();return circularMonthInterval(_0x35f71c,_0x402326)[_0x5c64('0x18')](_0x27d222);}module[_0x5c64('0xb')][_0x5c64('0x1e')]=monthCompare;function iftime(_0x13fc81,_0x27387f=moment['tz'][_0x5c64('0x1f')](),_0x172646=moment()){if(!validateRx[_0x5c64('0x20')](_0x13fc81)){throw new Error(EINVALID_STRING);}else{var _0xb6400f=(moment[_0x5c64('0x21')](_0x172646)?_0x172646[_0x5c64('0x10')]():moment(_0x172646))['tz'](_0x27387f)[_0x5c64('0x7')]('en');throwIfDateNotValid(_0xb6400f);var _0x10b862=_0x13fc81['split'](',');var _0x33289b=_0x10b862[0x0];var _0x1847c3=_0x10b862[0x1];var _0x108d67=_0x10b862[0x2];var _0x265cf8=_0x10b862[0x3];let _0x3edf19=!![];if(_0x33289b!=='*'){var _0x3b1753=_0x33289b[_0x5c64('0x6')]('-');var _0x3b0a0b=_[_0x5c64('0x22')](_0x3b1753[0x0],0x5,'0');var _0x1967a3=_0x3b1753[_0x5c64('0x23')]===0x2?_['padStart'](_0x3b1753[0x1],0x5,'0'):_0x3b0a0b;_0x3edf19=timeCompare(_0xb6400f,_0x3b0a0b,_0x1967a3);}let _0x531ebb=!![];if(_0x1847c3!=='*'){var _0x442f0c=_0x1847c3[_0x5c64('0x6')]('-');var _0x44b0ae=_0x442f0c[0x0];var _0x312196=_0x442f0c['length']===0x2?_0x442f0c[0x1]:_0x44b0ae;_0x531ebb=dowCompare(_0xb6400f,_0x44b0ae,_0x312196);}let _0x3c9d0a=!![];if(_0x108d67!=='*'){var _0x574dc2=_0x108d67[_0x5c64('0x6')]('-');var _0x4c5cab=parseDom(_0x574dc2[0x0]);var _0x3e5ded=_0x574dc2[_0x5c64('0x23')]===0x2?parseDom(_0x574dc2[0x1]):_0x4c5cab;_0x3c9d0a=domCompare(_0xb6400f,_0x4c5cab,_0x3e5ded);}let _0x28fb09=!![];if(_0x265cf8!=='*'){var _0x483875=_0x265cf8[_0x5c64('0x6')]('-');var _0xa1bedc=_0x483875[0x0];var _0x1d9f21=_0x483875[_0x5c64('0x23')]===0x2?_0x483875[0x1]:_0x483875[0x0];_0x28fb09=monthCompare(_0xb6400f,_0xa1bedc,_0x1d9f21);}return _0x3edf19&&_0x531ebb&&_0x3c9d0a&&_0x28fb09;}}module[_0x5c64('0xb')]['iftime']=iftime; \ No newline at end of file +var _0x9d9d=['format','ddd','includes','date','daysInMonth','max','min','domCompare','guess','test','isMoment','length','padStart','iftime','moment-timezone','map','source','join','Date\x20not\x20valid','isValid','split','locale','toLowerCase','slice','exports','circularDoWInterval','monthsShort','indexOf','concat','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween'];(function(_0x3b76e2,_0xfcc9e5){var _0x47a49f=function(_0xc085a1){while(--_0xc085a1){_0x3b76e2['push'](_0x3b76e2['shift']());}};_0x47a49f(++_0xfcc9e5);}(_0x9d9d,0xc7));var _0xd9d9=function(_0x18acde,_0x2d02d4){_0x18acde=_0x18acde-0x0;var _0x41ff9e=_0x9d9d[_0x18acde];return _0x41ff9e;};var _=require('lodash');var moment=require(_0xd9d9('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xd9d9('0x1')](function(_0x1ed40d){return _0x1ed40d[_0xd9d9('0x2')];})[_0xd9d9('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0xd9d9('0x4');function throwIfDateNotValid(_0x22e29a){if(!_0x22e29a[_0xd9d9('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4c5bce){var _0x1913b5=_0x4c5bce[_0xd9d9('0x6')](':')[_0xd9d9('0x1')](function(_0x54c5a3){return parseInt(_0x54c5a3,0xa);});var _0x11f305=_0x1913b5[0x0];var _0xf47d5a=_0x1913b5[0x1];if(_0x11f305<0x0||_0x11f305>0x17||_0xf47d5a<0x0||_0xf47d5a>0x3b){throw new Error(EINVALID_DATE);}return[_0x11f305,_0xf47d5a];}function circularDoWInterval(_0x571224,_0x13da32){if(_0x571224===_0x13da32){return[_0x571224];}else{var _0x3c3b8b=moment[_0xd9d9('0x7')]();moment[_0xd9d9('0x7')]('en');var _0x328de3=moment['weekdaysShort']()[_0xd9d9('0x1')](function(_0x520649){return _0x520649[_0xd9d9('0x8')]();});moment[_0xd9d9('0x7')](_0x3c3b8b);var _0x696aea=_0x328de3['indexOf'](_0x571224);var _0x475873=_0x328de3['indexOf'](_0x13da32);if(_0x475873>_0x696aea){return _0x328de3[_0xd9d9('0x9')](_0x696aea,_0x475873+0x1);}else{var _0x34bfd2=_0x328de3[_0xd9d9('0x9')](0x0,_0x475873+0x1);var _0x33567b=_0x328de3[_0xd9d9('0x9')](_0x696aea);return _0x33567b['concat'](_0x34bfd2);}}}module[_0xd9d9('0xa')][_0xd9d9('0xb')]=circularDoWInterval;function circularMonthInterval(_0x39036f,_0x16bb12){if(_0x39036f===_0x16bb12){return[_0x39036f];}else{var _0x324d52=moment[_0xd9d9('0x7')]();moment['locale']('en');var _0x49dad5=moment[_0xd9d9('0xc')]()[_0xd9d9('0x1')](function(_0x53c1c0){return _0x53c1c0[_0xd9d9('0x8')]();});moment[_0xd9d9('0x7')](_0x324d52);var _0xb9586a=_0x49dad5[_0xd9d9('0xd')](_0x39036f);var _0x2dd305=_0x49dad5[_0xd9d9('0xd')](_0x16bb12);if(_0x2dd305>_0xb9586a){return _0x49dad5[_0xd9d9('0x9')](_0xb9586a,_0x2dd305+0x1);}else{var _0x3cc4b9=_0x49dad5[_0xd9d9('0x9')](0x0,_0x2dd305+0x1);var _0x54a8d5=_0x49dad5[_0xd9d9('0x9')](_0xb9586a);return _0x54a8d5[_0xd9d9('0xe')](_0x3cc4b9);}}}module[_0xd9d9('0xa')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x272e7f){var _0xabe324=parseInt(_0x272e7f,0xa);if(_0xabe324<0x1||_0xabe324>0x1f){throw new Error(EINVALID_DATE);}return _0xabe324;}function timeCompare(_0x23617f,_0xda6267,_0xce6943){var _0x374512=_0x23617f[_0xd9d9('0xf')]();var _0x2c3290=extractTime(_0xda6267);var _0x938ecc=_0x2c3290[0x0];var _0x10df69=_0x2c3290[0x1];var _0xa29365=_0x23617f['clone']()[_0xd9d9('0x10')](_0x938ecc)[_0xd9d9('0x11')](_0x10df69);throwIfDateNotValid(_0xa29365);var _0x3a86cc=extractTime(_0xce6943);var _0x536758=_0x3a86cc[0x0];var _0x53fab8=_0x3a86cc[0x1];var _0x183ae8=_0x23617f[_0xd9d9('0xf')]()[_0xd9d9('0x10')](_0x536758)[_0xd9d9('0x11')](_0x53fab8);throwIfDateNotValid(_0x183ae8);if(_0x183ae8[_0xd9d9('0x12')](_0xa29365)){var _0x4d65e9=_0x374512[_0xd9d9('0xf')]()[_0xd9d9('0x13')](_0xd9d9('0x14'));var _0x3ab1a5=_0x374512['clone']()[_0xd9d9('0x15')]('day');return _0x374512[_0xd9d9('0x16')](_0xa29365,_0x3ab1a5,undefined,'[]')||_0x374512[_0xd9d9('0x16')](_0x4d65e9,_0x183ae8,undefined,'[]');}else{return _0x374512[_0xd9d9('0x16')](_0xa29365,_0x183ae8,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x1ae8e5,_0x30ee5d,_0x5deb9b){var _0x1fd4ae=_0x1ae8e5[_0xd9d9('0x7')]('en')[_0xd9d9('0x17')](_0xd9d9('0x18'))[_0xd9d9('0x8')]();return circularDoWInterval(_0x30ee5d,_0x5deb9b)[_0xd9d9('0x19')](_0x1fd4ae);}module[_0xd9d9('0xa')]['dowCompare']=dowCompare;function domCompare(_0x13863c,_0x46b30d,_0x195a35){var _0x4d69d9=_0x13863c[_0xd9d9('0x1a')]();if(_0x46b30d===_0x195a35){return _0x4d69d9===_0x46b30d;}else{var _0x3014d=_0x13863c[_0xd9d9('0x1b')]();var _0x406aa3=_0x46b30d<_0x195a35;let _0x306d12=![];var _0x470ed1=0x0;var _0x30992c=0x0;if(_0x406aa3){_0x470ed1=Math[_0xd9d9('0x1c')](0x1,_0x46b30d);_0x30992c=Math[_0xd9d9('0x1d')](_0x195a35,_0x3014d);_0x306d12=_0x4d69d9>=_0x470ed1&&_0x4d69d9<=_0x30992c;}else{_0x470ed1=Math[_0xd9d9('0x1d')](_0x46b30d,_0x3014d);_0x30992c=Math['max'](0x1,_0x195a35);_0x306d12=_0x4d69d9>=_0x470ed1||_0x4d69d9<=_0x30992c;}return _0x306d12;}}module[_0xd9d9('0xa')][_0xd9d9('0x1e')]=domCompare;function monthCompare(_0x120a75,_0x42c9b5,_0x25ecc8){var _0x499757=_0x120a75['locale']('en')[_0xd9d9('0x17')]('MMM')[_0xd9d9('0x8')]();return circularMonthInterval(_0x42c9b5,_0x25ecc8)['includes'](_0x499757);}module[_0xd9d9('0xa')]['monthCompare']=monthCompare;function iftime(_0x530b28,_0x1c15c2=moment['tz'][_0xd9d9('0x1f')](),_0x25e551=moment()){if(!validateRx[_0xd9d9('0x20')](_0x530b28)){throw new Error(EINVALID_STRING);}else{var _0x2d35bd=(moment[_0xd9d9('0x21')](_0x25e551)?_0x25e551[_0xd9d9('0xf')]():moment(_0x25e551))['tz'](_0x1c15c2)['locale']('en');throwIfDateNotValid(_0x2d35bd);var _0x4e3601=_0x530b28[_0xd9d9('0x6')](',');var _0xdc4d2f=_0x4e3601[0x0];var _0x3f5bfc=_0x4e3601[0x1];var _0x588280=_0x4e3601[0x2];var _0x33e18b=_0x4e3601[0x3];let _0x50634e=!![];if(_0xdc4d2f!=='*'){var _0x408f36=_0xdc4d2f[_0xd9d9('0x6')]('-');var _0x44dd1a=_['padStart'](_0x408f36[0x0],0x5,'0');var _0x276ff0=_0x408f36[_0xd9d9('0x22')]===0x2?_[_0xd9d9('0x23')](_0x408f36[0x1],0x5,'0'):_0x44dd1a;_0x50634e=timeCompare(_0x2d35bd,_0x44dd1a,_0x276ff0);}let _0x19d546=!![];if(_0x3f5bfc!=='*'){var _0x1859e9=_0x3f5bfc['split']('-');var _0x13a68d=_0x1859e9[0x0];var _0x529efc=_0x1859e9[_0xd9d9('0x22')]===0x2?_0x1859e9[0x1]:_0x13a68d;_0x19d546=dowCompare(_0x2d35bd,_0x13a68d,_0x529efc);}let _0x3b2996=!![];if(_0x588280!=='*'){var _0x423407=_0x588280['split']('-');var _0xb25c48=parseDom(_0x423407[0x0]);var _0x4ceaf5=_0x423407['length']===0x2?parseDom(_0x423407[0x1]):_0xb25c48;_0x3b2996=domCompare(_0x2d35bd,_0xb25c48,_0x4ceaf5);}let _0x4190e7=!![];if(_0x33e18b!=='*'){var _0x1fd840=_0x33e18b[_0xd9d9('0x6')]('-');var _0x4dffc7=_0x1fd840[0x0];var _0x1a58cf=_0x1fd840['length']===0x2?_0x1fd840[0x1]:_0x1fd840[0x0];_0x4190e7=monthCompare(_0x2d35bd,_0x4dffc7,_0x1a58cf);}return _0x50634e&&_0x19d546&&_0x3b2996&&_0x4190e7;}}module[_0xd9d9('0xa')][_0xd9d9('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 33d941a..a7f8125 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98f9=['keys','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','join','format','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','level','{{{'];(function(_0xf32af1,_0x4086a8){var _0x8148c1=function(_0x3ca5f0){while(--_0x3ca5f0){_0xf32af1['push'](_0xf32af1['shift']());}};_0x8148c1(++_0x4086a8);}(_0x98f9,0x13f));var _0x998f=function(_0x1ea016,_0x1c558e){_0x1ea016=_0x1ea016-0x0;var _0x202e44=_0x98f9[_0x1ea016];return _0x202e44;};'use strict';var path=require('path');var util=require(_0x998f('0x0'));var moment=require('moment');var winston=require(_0x998f('0x1'));var config=require(_0x998f('0x2'));var debugLevel=config[_0x998f('0x3')]?config[_0x998f('0x3')][_0x998f('0x4')]():_0x998f('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x998f('0x6'),'error':'red','warn':_0x998f('0x7'),'info':_0x998f('0x8'),'print':_0x998f('0x9'),'success':_0x998f('0xa'),'http':_0x998f('0xb'),'verbose':_0x998f('0xc'),'debug':'bold\x20blue','silly':_0x998f('0xd')};winston[_0x998f('0xe')](XC_LOG_COLORS);function getLogFileName(_0x29c667,_0x25d246,_0x4abdfb){var _0x78a510=_0x29c667||'/var/log/xcally';return path[_0x998f('0xf')](_0x78a510,util[_0x998f('0x10')](_0x998f('0x11'),_0x25d246,_0x4abdfb));}function formatter(_0x536f80,_0x325e3b){_0x325e3b['message']=_0x325e3b[_0x998f('0x12')][_0x998f('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')[_0x998f('0x13')](/@{/g,'{{')[_0x998f('0x13')](/}@/g,'}}');return util[_0x998f('0x10')](_0x998f('0x14'),moment()[_0x998f('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x325e3b[_0x998f('0x15')]['toUpperCase'](),_0x536f80,_0x325e3b[_0x998f('0x12')]);}function fileFormat(_0x417390,_0x452c61){_0x452c61[_0x998f('0x12')]=_0x452c61[_0x998f('0x12')]['replace'](/@@{/g,_0x998f('0x16'))[_0x998f('0x13')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x998f('0x13')](/}@/g,'}}');var _0x4d6e8b=_0x452c61['meta']&&Object[_0x998f('0x17')](_0x452c61[_0x998f('0x18')])[_0x998f('0x19')]?'\x0a\x09'+JSON['stringify'](_0x452c61[_0x998f('0x18')]):'';return util[_0x998f('0x10')](_0x998f('0x1a'),moment()['format'](_0x998f('0x1b')),_0x452c61['level'][_0x998f('0x1c')](),_0x417390,_0x452c61[_0x998f('0x12')],_0x4d6e8b);}function consoleLogger(){var _0x113e17=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x998f('0x1d'))][(_0x998f('0x1e'))]({'level':_0x998f('0x1f'),'json':![],'formatter':function(_0x4c2a2b){return formatter('',_0x4c2a2b);}})]});return _0x113e17;}function fileLogger(_0x46bb93,_0x5587aa){var _0x34afaf=new winston[(_0x998f('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x998f('0x1d'))][(_0x998f('0x21'))]({'name':util['format'](_0x998f('0x22'),_0x46bb93,_0x998f('0x23')),'filename':getLogFileName(_0x5587aa,_0x46bb93,_0x998f('0x23')),'level':_0x998f('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7038f){return fileFormat(_0x46bb93,_0x7038f);}}),new winston['transports']['File']({'name':util['format'](_0x998f('0x22'),_0x46bb93,debugLevel),'filename':getLogFileName(_0x5587aa,_0x46bb93,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a5701){return fileFormat(_0x46bb93,_0x4a5701);}}),new winston[(_0x998f('0x1d'))]['Console']({'level':_0x998f('0x1f'),'json':![],'formatter':function(_0x116fb4){return fileFormat(_0x46bb93,_0x116fb4);}})]});return _0x34afaf;}exports[_0x998f('0x24')]=consoleLogger;exports[_0x998f('0x25')]=fileLogger; \ No newline at end of file +var _0x40b6=['Console','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','white','bold\x20white','gray','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','{{{','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','warn','File','%s-%s','error'];(function(_0xc5f1ae,_0xe05212){var _0x1d3b61=function(_0x676c6e){while(--_0x676c6e){_0xc5f1ae['push'](_0xc5f1ae['shift']());}};_0x1d3b61(++_0xe05212);}(_0x40b6,0x9a));var _0x640b=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x40b6[_0x3da612];return _0x1a9d1d;};'use strict';var path=require(_0x640b('0x0'));var util=require(_0x640b('0x1'));var moment=require(_0x640b('0x2'));var winston=require(_0x640b('0x3'));var config=require(_0x640b('0x4'));var debugLevel=config[_0x640b('0x5')]?config[_0x640b('0x5')][_0x640b('0x6')]():_0x640b('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x640b('0x8'),'error':_0x640b('0x9'),'warn':'bold\x20yellow','info':_0x640b('0xa'),'print':_0x640b('0xb'),'success':'bold\x20green','http':_0x640b('0xc'),'verbose':'bold\x20magenta','debug':_0x640b('0xd'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x36e04e,_0x2937c8,_0xed05eb){var _0x150546=_0x36e04e||_0x640b('0xe');return path[_0x640b('0xf')](_0x150546,util[_0x640b('0x10')](_0x640b('0x11'),_0x2937c8,_0xed05eb));}function formatter(_0x407b6f,_0x50926a){_0x50926a[_0x640b('0x12')]=_0x50926a['message']['replace'](/@@{/g,_0x640b('0x13'))['replace'](/}@@/g,_0x640b('0x14'))[_0x640b('0x15')](/@{/g,'{{')[_0x640b('0x15')](/}@/g,'}}');return util[_0x640b('0x10')](_0x640b('0x16'),moment()[_0x640b('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x50926a[_0x640b('0x17')][_0x640b('0x18')](),_0x407b6f,_0x50926a[_0x640b('0x12')]);}function fileFormat(_0x23e4b5,_0x3f4690){_0x3f4690[_0x640b('0x12')]=_0x3f4690['message'][_0x640b('0x15')](/@@{/g,_0x640b('0x13'))[_0x640b('0x15')](/}@@/g,_0x640b('0x14'))['replace'](/@{/g,'{{')[_0x640b('0x15')](/}@/g,'}}');var _0x42fb12=_0x3f4690[_0x640b('0x19')]&&Object['keys'](_0x3f4690[_0x640b('0x19')])[_0x640b('0x1a')]?'\x0a\x09'+JSON[_0x640b('0x1b')](_0x3f4690[_0x640b('0x19')]):'';return util[_0x640b('0x10')](_0x640b('0x1c'),moment()[_0x640b('0x10')](_0x640b('0x1d')),_0x3f4690[_0x640b('0x17')][_0x640b('0x18')](),_0x23e4b5,_0x3f4690['message'],_0x42fb12);}function consoleLogger(){var _0x4934d6=new winston[(_0x640b('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x640b('0x1f'))]['Console']({'level':_0x640b('0x20'),'json':![],'formatter':function(_0x30b795){return formatter('',_0x30b795);}})]});return _0x4934d6;}function fileLogger(_0x5d04be,_0x5524b6){var _0x4071be=new winston[(_0x640b('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x640b('0x21'))]({'name':util[_0x640b('0x10')](_0x640b('0x22'),_0x5d04be,'error'),'filename':getLogFileName(_0x5524b6,_0x5d04be,_0x640b('0x23')),'level':_0x640b('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x47b9a9){return fileFormat(_0x5d04be,_0x47b9a9);}}),new winston[(_0x640b('0x1f'))][(_0x640b('0x21'))]({'name':util[_0x640b('0x10')](_0x640b('0x22'),_0x5d04be,debugLevel),'filename':getLogFileName(_0x5524b6,_0x5d04be,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x588b90){return fileFormat(_0x5d04be,_0x588b90);}}),new winston['transports'][(_0x640b('0x24'))]({'level':'warn','json':![],'formatter':function(_0x2c2ad1){return fileFormat(_0x5d04be,_0x2c2ad1);}})]});return _0x4071be;}exports['consoleLogger']=consoleLogger;exports[_0x640b('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index e2ca745..962b1d7 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 _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x68e67d,_0x4424a0){_0x68e67d=_0x68e67d-0x0;var _0x2a5025=_0x7a54[_0x68e67d];return _0x2a5025;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x4552ea,_0x5607ea){var _0x28fec0=function(_0x41323e){while(--_0x41323e){_0x4552ea['push'](_0x4552ea['shift']());}};_0x28fec0(++_0x5607ea);}(_0x2ef3,0xba));var _0x32ef=function(_0x2ddc42,_0x426454){_0x2ddc42=_0x2ddc42-0x0;var _0x4105df=_0x2ef3[_0x2ddc42];return _0x4105df;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 0caf403..78f16e0 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 _0x1eba=['\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20'];(function(_0x52bdfe,_0x5282ec){var _0x5c6df7=function(_0x2355bb){while(--_0x2355bb){_0x52bdfe['push'](_0x52bdfe['shift']());}};_0x5c6df7(++_0x5282ec);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x1eba[_0x8ba19a];return _0x2bd8b4;};var _=require(_0xa1eb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b1355){return _0x2b1355==='{{'?_0xa1eb('0x1'):_0xa1eb('0x2');}function safeTemplate(_0x3ef7ee){var _0x5865fc=_0x3ef7ee;if(typeof _0x3ef7ee==='string'){_0x5865fc=_0x3ef7ee[_0xa1eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa1eb('0x4')](_0x3ef7ee)){_0x5865fc=_0x3ef7ee[_0xa1eb('0x5')](function(_0xf9d704){return safeTemplate(_0xf9d704);});}else if(_[_0xa1eb('0x6')](_0x3ef7ee)){_0x5865fc=Object[_0xa1eb('0x7')](_0x3ef7ee)[_0xa1eb('0x8')](function(_0x2bfbb0,_0x39a5a3){_0x2bfbb0[_0x39a5a3]=safeTemplate(_0x3ef7ee[_0x39a5a3]);return _0x2bfbb0;},{});}return _0x5865fc;}module[_0xa1eb('0x9')][_0xa1eb('0xa')]=safeTemplate; \ No newline at end of file +var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x8952,0x17e));var _0x2895=function(_0x1fb81a,_0xb91617){_0x1fb81a=_0x1fb81a-0x0;var _0x557bd7=_0x8952[_0x1fb81a];return _0x557bd7;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 4f8d75b..7c1a2e0 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea42=['updated','Updating\x20app.json','fs-extra','path','../config/environment','root','resolve','server/app.json','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON'];(function(_0x2cb578,_0x17975c){var _0x2d38b3=function(_0x813325){while(--_0x813325){_0x2cb578['push'](_0x2cb578['shift']());}};_0x2d38b3(++_0x17975c);}(_0xea42,0x11f));var _0x2ea4=function(_0x1687be,_0x1a1217){_0x1687be=_0x1687be-0x0;var _0x1760bd=_0xea42[_0x1687be];return _0x1760bd;};var fs=require(_0x2ea4('0x0'));var path=require(_0x2ea4('0x1'));var config=require(_0x2ea4('0x2'));var root=config[_0x2ea4('0x3')];var APP_JSON_PATH=path[_0x2ea4('0x4')](root,_0x2ea4('0x5'));var NODEPATH=path[_0x2ea4('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x436bc1){let _0x5e21ca=![];if(Array[_0x2ea4('0x6')](_0x436bc1[_0x2ea4('0x7')])){var _0x30cb02=_0x436bc1['apps'][_0x2ea4('0x8')](function(_0xb7c7ea){return _0xb7c7ea[_0x2ea4('0x9')]===_0x2ea4('0xa');});if(_0x30cb02>-0x1){var _0x5f2951=_0x436bc1[_0x2ea4('0x7')][_0x30cb02];if(typeof _0x5f2951[_0x2ea4('0xb')][_0x2ea4('0xc')]!==_0x2ea4('0xd')){_0x5f2951[_0x2ea4('0xb')][_0x2ea4('0xc')]=NODEPATH;_0x5e21ca=!![];}}return{'appConfig':_0x436bc1,'updated':_0x5e21ca};}}function updateAppConfig(_0x625a76){return fs[_0x2ea4('0xe')](APP_JSON_PATH)[_0x2ea4('0xf')](function(_0x132a9b){if(_0x132a9b){return fs[_0x2ea4('0x10')](APP_JSON_PATH)[_0x2ea4('0xf')](function(_0x1c720f){var _0x22634e=setLegacyLibsNodeEnvPath(_0x1c720f);if(_0x22634e[_0x2ea4('0x11')]){_0x625a76['info'](_0x2ea4('0x12'));return fs['writeJSON'](APP_JSON_PATH,_0x1c720f,{'spaces':0x2});}else{return Promise[_0x2ea4('0x4')]();}});}else{return Promise[_0x2ea4('0x4')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xcc35=['apps','findIndex','name','env','NODE_PATH','pathExists','then','readJSON','updated','Updating\x20app.json','writeJSON','fs-extra','path','root','resolve','legacy-libs','isArray'];(function(_0x28b977,_0x16a6e5){var _0x2279d8=function(_0x5887d7){while(--_0x5887d7){_0x28b977['push'](_0x28b977['shift']());}};_0x2279d8(++_0x16a6e5);}(_0xcc35,0x1a3));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};var fs=require(_0x5cc3('0x0'));var path=require(_0x5cc3('0x1'));var config=require('../config/environment');var root=config[_0x5cc3('0x2')];var APP_JSON_PATH=path[_0x5cc3('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x5cc3('0x4'));function setLegacyLibsNodeEnvPath(_0x3cfca5){let _0x46858b=![];if(Array[_0x5cc3('0x5')](_0x3cfca5['apps'])){var _0xecdf54=_0x3cfca5[_0x5cc3('0x6')][_0x5cc3('0x7')](function(_0x494633){return _0x494633[_0x5cc3('0x8')]==='motion2';});if(_0xecdf54>-0x1){var _0x5b099e=_0x3cfca5[_0x5cc3('0x6')][_0xecdf54];if(typeof _0x5b099e[_0x5cc3('0x9')]['NODE_PATH']!=='string'){_0x5b099e[_0x5cc3('0x9')][_0x5cc3('0xa')]=NODEPATH;_0x46858b=!![];}}return{'appConfig':_0x3cfca5,'updated':_0x46858b};}}function updateAppConfig(_0x45e35d){return fs[_0x5cc3('0xb')](APP_JSON_PATH)[_0x5cc3('0xc')](function(_0x2e475f){if(_0x2e475f){return fs[_0x5cc3('0xd')](APP_JSON_PATH)[_0x5cc3('0xc')](function(_0x341307){var _0x2d873b=setLegacyLibsNodeEnvPath(_0x341307);if(_0x2d873b[_0x5cc3('0xe')]){_0x45e35d['info'](_0x5cc3('0xf'));return fs[_0x5cc3('0x10')](APP_JSON_PATH,_0x341307,{'spaces':0x2});}else{return Promise[_0x5cc3('0x3')]();}});}else{return Promise[_0x5cc3('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file diff --git a/snippet/3.5.0/index.html b/snippet/3.5.0/index.html index 28d2a15..bd4c600 100644 --- a/snippet/3.5.0/index.html +++ b/snippet/3.5.0/index.html @@ -26,4 +26,4 @@ status != 'online' && status != 'offline' && status != 'unmanaged' - " ng-click="vm.close(); $event.stopPropagation();">
\ No newline at end of file + " ng-click="vm.close(); $event.stopPropagation();">
\ No newline at end of file